From: support Date: Tue, 6 Dec 2022 07:54:41 +0000 (+0000) Subject: Built motion from commit 839dd6ea.|2.6.25 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=e08d4e18be95402971d8224fc198a0a41ac0cff8;p=motion2.git Built motion from commit 839dd6ea.|2.6.25 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index f7d16de..b78ecc1 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-12-05T16:11:31.266Z", + "time": "2022-12-06T07:45:43.590Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 01a99c2..e023275 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-12-05T16:11:31.266Z", + "time": "2022-12-06T07:45:43.590Z", "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 5895a46..6c7715e 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 _0xeb76=['bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT','sequelize','exports','VIRTUAL','action','STRING','contactManager','integration','motionbar','jscripty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb76,0x171));var _0x6eb7=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0xeb76[_0x3826ad];return _0x17b900;};'use strict';var Sequelize=require(_0x6eb7('0x0'));module[_0x6eb7('0x1')]={'name':{'type':Sequelize[_0x6eb7('0x2')],'get':function(_0x1e5c45){return this['getDataValue'](_0x6eb7('0x3'));}},'action':{'type':Sequelize[_0x6eb7('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x6eb7('0x5'),_0x6eb7('0x6'),_0x6eb7('0x7'),_0x6eb7('0x8'),'urlForward','browser',_0x6eb7('0x9'),_0x6eb7('0xa')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x6eb7('0xb')},'data1':{'type':Sequelize[_0x6eb7('0x4')](0x1000),'comment':_0x6eb7('0xc')},'data2':{'type':Sequelize[_0x6eb7('0x4')](0x1000),'comment':_0x6eb7('0xd')},'data3':{'type':Sequelize[_0x6eb7('0x4')](0x1000),'comment':_0x6eb7('0xe')},'data4':{'type':Sequelize[_0x6eb7('0x4')](0x1000),'comments':_0x6eb7('0xf')},'data5':{'type':Sequelize[_0x6eb7('0x4')](0x1000),'comments':_0x6eb7('0x10')},'data6':{'type':Sequelize[_0x6eb7('0x4')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x6eb7('0x11')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0xc57c=['jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','getDataValue','contactManager','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING'];(function(_0x40995b,_0x29964d){var _0x537b3d=function(_0x33b7be){while(--_0x33b7be){_0x40995b['push'](_0x40995b['shift']());}};_0x537b3d(++_0x29964d);}(_0xc57c,0x149));var _0xcc57=function(_0x3dbe53,_0x57d1de){_0x3dbe53=_0x3dbe53-0x0;var _0x2c6d34=_0xc57c[_0x3dbe53];return _0x2c6d34;};'use strict';var Sequelize=require(_0xcc57('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x597b64){return this[_0xcc57('0x1')]('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xcc57('0x2'),'integration',_0xcc57('0x3'),_0xcc57('0x4'),_0xcc57('0x5'),_0xcc57('0x6'),_0xcc57('0x7'),_0xcc57('0x8')]],'msg':_0xcc57('0x9')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0xcc57('0xa')](0x1000),'comment':_0xcc57('0xb')},'data2':{'type':Sequelize[_0xcc57('0xa')](0x1000),'comment':_0xcc57('0xc')},'data3':{'type':Sequelize[_0xcc57('0xa')](0x1000),'comment':_0xcc57('0xd')},'data4':{'type':Sequelize[_0xcc57('0xa')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0xcc57('0xa')],'comments':_0xcc57('0xe')},'data7':{'type':Sequelize[_0xcc57('0xf')],'comments':_0xcc57('0x10')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 908b70e..96c3e40 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 _0x4b30=['jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','destroy','then','error','stack','name','send','update','body','find','params','catch','Action','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x543769,_0x8da6aa){var _0x1be8be=function(_0x5eed72){while(--_0x5eed72){_0x543769['push'](_0x543769['shift']());}};_0x1be8be(++_0x8da6aa);}(_0x4b30,0x102));var _0x04b3=function(_0x123e6f,_0x3a0ccb){_0x123e6f=_0x123e6f-0x0;var _0x2e0627=_0x4b30[_0x123e6f];return _0x2e0627;};'use strict';var emlformat=require(_0x04b3('0x0'));var rimraf=require(_0x04b3('0x1'));var zipdir=require(_0x04b3('0x2'));var jsonpatch=require(_0x04b3('0x3'));var rp=require('request-promise');var moment=require(_0x04b3('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x04b3('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x04b3('0x6'));var ejs=require(_0x04b3('0x7'));var fs=require('fs');var fs_extra=require(_0x04b3('0x8'));var _=require(_0x04b3('0x9'));var squel=require(_0x04b3('0xa'));var crypto=require(_0x04b3('0xb'));var jsforce=require(_0x04b3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x04b3('0x6'));var querystring=require('querystring');var Papa=require(_0x04b3('0xd'));var Redis=require(_0x04b3('0xe'));var authService=require(_0x04b3('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x04b3('0x10'));var hardwareService=require(_0x04b3('0x11'));var logger=require('../../config/logger')(_0x04b3('0x12'));var utils=require(_0x04b3('0x13'));var config=require(_0x04b3('0x14'));var licenseUtil=require(_0x04b3('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1eb8aa,_0x4d217e){_0x4d217e=_0x4d217e||0xcc;return function(_0x25d199){if(_0x25d199){return _0x1eb8aa[_0x04b3('0x16')](_0x4d217e);}return _0x1eb8aa[_0x04b3('0x17')](_0x4d217e)[_0x04b3('0x18')]();};}function respondWithResult(_0x3f2f62,_0x891a2e){_0x891a2e=_0x891a2e||0xc8;return function(_0x386095){if(_0x386095){return _0x3f2f62[_0x04b3('0x17')](_0x891a2e)[_0x04b3('0x19')](_0x386095);}};}function respondWithFilteredResult(_0xe75106,_0x4c2c67){return function(_0x3b716b){if(_0x3b716b){var _0x459909=typeof _0x4c2c67[_0x04b3('0x1a')]===_0x04b3('0x1b')&&typeof _0x4c2c67['limit']===_0x04b3('0x1b');var _0xaa02e2=_0x3b716b[_0x04b3('0x1c')];var _0x2e8fca=_0x459909?0x0:_0x4c2c67['offset'];var _0x494b89=_0x459909?_0x3b716b[_0x04b3('0x1c')]:_0x4c2c67['offset']+_0x4c2c67[_0x04b3('0x1d')];var _0x111cd9;if(_0x494b89>=_0xaa02e2){_0x494b89=_0xaa02e2;_0x111cd9=0xc8;}else{_0x111cd9=0xce;}_0xe75106[_0x04b3('0x17')](_0x111cd9);return _0xe75106[_0x04b3('0x1e')](_0x04b3('0x1f'),_0x2e8fca+'-'+_0x494b89+'/'+_0xaa02e2)[_0x04b3('0x19')](_0x3b716b);}return null;};}function patchUpdates(_0x226189){return function(_0x136fa2){try{jsonpatch[_0x04b3('0x20')](_0x136fa2,_0x226189,!![]);}catch(_0x37d451){return BPromise['reject'](_0x37d451);}return _0x136fa2['save']();};}function saveUpdates(_0x45f1fc,_0xa6d0c1){return function(_0xea1273){if(_0xea1273){return _0xea1273['update'](_0x45f1fc)['then'](function(_0x3799c4){return _0x3799c4;});}return null;};}function removeEntity(_0x199f33,_0x2e4613){return function(_0x32d30d){if(_0x32d30d){return _0x32d30d[_0x04b3('0x21')]()[_0x04b3('0x22')](function(){_0x199f33[_0x04b3('0x17')](0xcc)[_0x04b3('0x18')]();});}};}function handleEntityNotFound(_0x5be1e6,_0x2a33fd){return function(_0x267a62){if(!_0x267a62){_0x5be1e6['sendStatus'](0x194);}return _0x267a62;};}function handleError(_0xdeaef2,_0x2b72d6){_0x2b72d6=_0x2b72d6||0x1f4;return function(_0x19edf6){logger[_0x04b3('0x23')](_0x19edf6[_0x04b3('0x24')]);if(_0x19edf6[_0x04b3('0x25')]){delete _0x19edf6[_0x04b3('0x25')];}_0xdeaef2[_0x04b3('0x17')](_0x2b72d6)[_0x04b3('0x26')](_0x19edf6);};}exports[_0x04b3('0x27')]=function(_0x1f286a,_0x470905){if(_0x1f286a[_0x04b3('0x28')]['id']){delete _0x1f286a[_0x04b3('0x28')]['id'];}return db['Action'][_0x04b3('0x29')]({'where':{'id':_0x1f286a[_0x04b3('0x2a')]['id']}})['then'](handleEntityNotFound(_0x470905,null))[_0x04b3('0x22')](saveUpdates(_0x1f286a['body'],null))[_0x04b3('0x22')](respondWithResult(_0x470905,null))[_0x04b3('0x2b')](handleError(_0x470905,null));};exports[_0x04b3('0x21')]=function(_0x396f8e,_0x529036){return db[_0x04b3('0x2c')][_0x04b3('0x29')]({'where':{'id':_0x396f8e[_0x04b3('0x2a')]['id']}})[_0x04b3('0x22')](handleEntityNotFound(_0x529036,null))['then'](removeEntity(_0x529036,null))[_0x04b3('0x2b')](handleError(_0x529036,null));}; \ No newline at end of file +var _0x652c=['squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','Content-Range','reject','save','then','destroy','error','stack','name','send','body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash'];(function(_0x55e099,_0x9fa64a){var _0x551a58=function(_0x2e2fe9){while(--_0x2e2fe9){_0x55e099['push'](_0x55e099['shift']());}};_0x551a58(++_0x9fa64a);}(_0x652c,0x15c));var _0xc652=function(_0x51a238,_0x3f451e){_0x51a238=_0x51a238-0x0;var _0xb427bf=_0x652c[_0x51a238];return _0xb427bf;};'use strict';var emlformat=require(_0xc652('0x0'));var rimraf=require(_0xc652('0x1'));var zipdir=require(_0xc652('0x2'));var jsonpatch=require(_0xc652('0x3'));var rp=require(_0xc652('0x4'));var moment=require(_0xc652('0x5'));var BPromise=require(_0xc652('0x6'));var Mustache=require(_0xc652('0x7'));var util=require('util');var path=require(_0xc652('0x8'));var sox=require(_0xc652('0x9'));var csv=require(_0xc652('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc652('0xb'));var squel=require(_0xc652('0xc'));var crypto=require('crypto');var jsforce=require(_0xc652('0xd'));var deskjs=require(_0xc652('0xe'));var toCsv=require(_0xc652('0xa'));var querystring=require('querystring');var Papa=require(_0xc652('0xf'));var Redis=require('ioredis');var authService=require(_0xc652('0x10'));var qs=require(_0xc652('0x11'));var as=require(_0xc652('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc652('0x13'))(_0xc652('0x14'));var utils=require('../../config/utils');var config=require(_0xc652('0x15'));var licenseUtil=require(_0xc652('0x16'));var db=require(_0xc652('0x17'))['db'];function respondWithStatusCode(_0x25accb,_0x48959f){_0x48959f=_0x48959f||0xcc;return function(_0x5726d5){if(_0x5726d5){return _0x25accb[_0xc652('0x18')](_0x48959f);}return _0x25accb[_0xc652('0x19')](_0x48959f)[_0xc652('0x1a')]();};}function respondWithResult(_0xea6aac,_0x1d562b){_0x1d562b=_0x1d562b||0xc8;return function(_0x5ae05d){if(_0x5ae05d){return _0xea6aac['status'](_0x1d562b)[_0xc652('0x1b')](_0x5ae05d);}};}function respondWithFilteredResult(_0x1d8c95,_0x1be3d2){return function(_0x211d20){if(_0x211d20){var _0x192233=typeof _0x1be3d2['offset']===_0xc652('0x1c')&&typeof _0x1be3d2['limit']===_0xc652('0x1c');var _0x560a18=_0x211d20['count'];var _0x95a8a5=_0x192233?0x0:_0x1be3d2['offset'];var _0x4ae5e2=_0x192233?_0x211d20[_0xc652('0x1d')]:_0x1be3d2[_0xc652('0x1e')]+_0x1be3d2['limit'];var _0x256244;if(_0x4ae5e2>=_0x560a18){_0x4ae5e2=_0x560a18;_0x256244=0xc8;}else{_0x256244=0xce;}_0x1d8c95[_0xc652('0x19')](_0x256244);return _0x1d8c95['set'](_0xc652('0x1f'),_0x95a8a5+'-'+_0x4ae5e2+'/'+_0x560a18)[_0xc652('0x1b')](_0x211d20);}return null;};}function patchUpdates(_0x3c7547){return function(_0x51a9ca){try{jsonpatch['apply'](_0x51a9ca,_0x3c7547,!![]);}catch(_0x32c558){return BPromise[_0xc652('0x20')](_0x32c558);}return _0x51a9ca[_0xc652('0x21')]();};}function saveUpdates(_0x125101,_0x5a829e){return function(_0x391d0b){if(_0x391d0b){return _0x391d0b['update'](_0x125101)[_0xc652('0x22')](function(_0x4548bc){return _0x4548bc;});}return null;};}function removeEntity(_0x3737d6,_0x3d0c6d){return function(_0x32c90e){if(_0x32c90e){return _0x32c90e[_0xc652('0x23')]()[_0xc652('0x22')](function(){_0x3737d6[_0xc652('0x19')](0xcc)[_0xc652('0x1a')]();});}};}function handleEntityNotFound(_0x36812c,_0x310628){return function(_0x2e2ffe){if(!_0x2e2ffe){_0x36812c[_0xc652('0x18')](0x194);}return _0x2e2ffe;};}function handleError(_0x42ae24,_0x2185d7){_0x2185d7=_0x2185d7||0x1f4;return function(_0x3f815b){logger[_0xc652('0x24')](_0x3f815b[_0xc652('0x25')]);if(_0x3f815b[_0xc652('0x26')]){delete _0x3f815b[_0xc652('0x26')];}_0x42ae24[_0xc652('0x19')](_0x2185d7)[_0xc652('0x27')](_0x3f815b);};}exports['update']=function(_0x2c8b86,_0x51ef17){if(_0x2c8b86[_0xc652('0x28')]['id']){delete _0x2c8b86[_0xc652('0x28')]['id'];}return db[_0xc652('0x29')][_0xc652('0x2a')]({'where':{'id':_0x2c8b86[_0xc652('0x2b')]['id']}})[_0xc652('0x22')](handleEntityNotFound(_0x51ef17,null))[_0xc652('0x22')](saveUpdates(_0x2c8b86[_0xc652('0x28')],null))[_0xc652('0x22')](respondWithResult(_0x51ef17,null))[_0xc652('0x2c')](handleError(_0x51ef17,null));};exports[_0xc652('0x23')]=function(_0x19d445,_0x576126){return db[_0xc652('0x29')]['find']({'where':{'id':_0x19d445['params']['id']}})[_0xc652('0x22')](handleEntityNotFound(_0x576126,null))['then'](removeEntity(_0x576126,null))[_0xc652('0x2c')](handleError(_0x576126,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index fcf4ce9..0cb8071 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 _0xe205=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./action.attributes','exports','define'];(function(_0x363562,_0x416a2c){var _0x56d17b=function(_0x3ffcdb){while(--_0x3ffcdb){_0x363562['push'](_0x363562['shift']());}};_0x56d17b(++_0x416a2c);}(_0xe205,0x1ec));var _0x5e20=function(_0x26277b,_0x3b474d){_0x26277b=_0x26277b-0x0;var _0x4f2fc3=_0xe205[_0x26277b];return _0x4f2fc3;};'use strict';var _=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var logger=require(_0x5e20('0x2'))(_0x5e20('0x3'));var moment=require(_0x5e20('0x4'));var BPromise=require(_0x5e20('0x5'));var rp=require(_0x5e20('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5e20('0x7'));var config=require(_0x5e20('0x8'));var attributes=require(_0x5e20('0x9'));module[_0x5e20('0xa')]=function(_0x4554b5,_0x2e68e6){return _0x4554b5[_0x5e20('0xb')]('Action',attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29b1=['rimraf','../../config/environment','./action.attributes','exports','Action','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x3291c0,_0x147635){var _0x559165=function(_0x11624f){while(--_0x11624f){_0x3291c0['push'](_0x3291c0['shift']());}};_0x559165(++_0x147635);}(_0x29b1,0x16d));var _0x129b=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x29b1[_0xac151d];return _0x111dba;};'use strict';var _=require(_0x129b('0x0'));var util=require(_0x129b('0x1'));var logger=require(_0x129b('0x2'))(_0x129b('0x3'));var moment=require(_0x129b('0x4'));var BPromise=require('bluebird');var rp=require(_0x129b('0x5'));var fs=require('fs');var path=require(_0x129b('0x6'));var rimraf=require(_0x129b('0x7'));var config=require(_0x129b('0x8'));var attributes=require(_0x129b('0x9'));module[_0x129b('0xa')]=function(_0x31e428,_0xe27ed4){return _0x31e428['define'](_0x129b('0xb'),attributes,{'tableName':'tools_actions','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 d8db7a4..9c844e8 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(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x53ec,0x192));var _0xc53e=function(_0x44ab9d,_0x3d060c){_0x44ab9d=_0x44ab9d-0x0;var _0x279648=_0x53ec[_0x44ab9d];return _0x279648;};'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 _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x5827aa,_0xa68f2a){var _0xd8dfc4=function(_0x32bcf2){while(--_0x32bcf2){_0x5827aa['push'](_0x5827aa['shift']());}};_0xd8dfc4(++_0xa68f2a);}(_0x1261,0x144));var _0x1126=function(_0x2a67fe,_0x295c09){_0x2a67fe=_0x2a67fe-0x0;var _0x57e726=_0x1261[_0x2a67fe];return _0x57e726;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('Action,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 8031971..ff4c278 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 _0x133a=['destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./action.controller','/:id','isAuthenticated','update'];(function(_0x46d441,_0x392c98){var _0x419105=function(_0x5b95c4){while(--_0x5b95c4){_0x46d441['push'](_0x46d441['shift']());}};_0x419105(++_0x392c98);}(_0x133a,0x1e3));var _0xa133=function(_0x548657,_0x479937){_0x548657=_0x548657-0x0;var _0x8e3ae5=_0x133a[_0x548657];return _0x8e3ae5;};'use strict';var multer=require(_0xa133('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa133('0x1'));var express=require(_0xa133('0x2'));var router=express[_0xa133('0x3')]();var fs_extra=require(_0xa133('0x4'));var auth=require(_0xa133('0x5'));var interaction=require(_0xa133('0x6'));var config=require('../../config/environment');var controller=require(_0xa133('0x7'));router['put'](_0xa133('0x8'),auth[_0xa133('0x9')](),controller[_0xa133('0xa')]);router['delete'](_0xa133('0x8'),auth[_0xa133('0x9')](),controller[_0xa133('0xb')]);module[_0xa133('0xc')]=router; \ No newline at end of file +var _0x7d8e=['exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','update','delete','destroy'];(function(_0x2f870e,_0x5af455){var _0x39fef1=function(_0x27b3b6){while(--_0x27b3b6){_0x2f870e['push'](_0x2f870e['shift']());}};_0x39fef1(++_0x5af455);}(_0x7d8e,0x79));var _0xe7d8=function(_0x347471,_0x1c9a02){_0x347471=_0x347471-0x0;var _0x422b6a=_0x7d8e[_0x347471];return _0x422b6a;};'use strict';var multer=require('multer');var util=require(_0xe7d8('0x0'));var path=require('path');var timeout=require(_0xe7d8('0x1'));var express=require('express');var router=express[_0xe7d8('0x2')]();var fs_extra=require(_0xe7d8('0x3'));var auth=require(_0xe7d8('0x4'));var interaction=require(_0xe7d8('0x5'));var config=require(_0xe7d8('0x6'));var controller=require('./action.controller');router['put'](_0xe7d8('0x7'),auth['isAuthenticated'](),controller[_0xe7d8('0x8')]);router[_0xe7d8('0x9')](_0xe7d8('0x7'),auth['isAuthenticated'](),controller[_0xe7d8('0xa')]);module[_0xe7d8('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 8b87c19..c7498c2 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 _0x5fab=['exports','STRING','TEXT','sequelize'];(function(_0x44d28c,_0x3a197b){var _0x754673=function(_0x5a5773){while(--_0x5a5773){_0x44d28c['push'](_0x44d28c['shift']());}};_0x754673(++_0x3a197b);}(_0x5fab,0x177));var _0xb5fa=function(_0x587dd0,_0x273922){_0x587dd0=_0x587dd0-0x0;var _0x56f153=_0x5fab[_0x587dd0];return _0x56f153;};'use strict';var Sequelize=require(_0xb5fa('0x0'));module[_0xb5fa('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb5fa('0x2')]},'parent':{'type':Sequelize[_0xb5fa('0x2')]},'table':{'type':Sequelize[_0xb5fa('0x2')]},'conditions':{'type':Sequelize[_0xb5fa('0x3')]},'joins':{'type':Sequelize[_0xb5fa('0x3')]}}; \ No newline at end of file +var _0x3eea=['STRING','TEXT','sequelize'];(function(_0x32e002,_0x2f8a42){var _0x3c03f9=function(_0x192dd3){while(--_0x192dd3){_0x32e002['push'](_0x32e002['shift']());}};_0x3c03f9(++_0x2f8a42);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x26e622,_0x132c7c){_0x26e622=_0x26e622-0x0;var _0x2c00c7=_0x3eea[_0x26e622];return _0x2c00c7;};'use strict';var Sequelize=require(_0xa3ee('0x0'));module['exports']={'name':{'type':Sequelize[_0xa3ee('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa3ee('0x1')]},'parent':{'type':Sequelize[_0xa3ee('0x1')]},'table':{'type':Sequelize[_0xa3ee('0x1')]},'conditions':{'type':Sequelize[_0xa3ee('0x2')]},'joins':{'type':Sequelize[_0xa3ee('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index b30a01d..dd6c434 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 _0x009e=['type','key','query','filters','intersection','model','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticCustomReport','count','includeAll','include','findAll','rows','catch','show','keys','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Reports','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','table','MetricId','metric','field','function','replace','format','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','keyBy','from','groupBy','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','../../components/export/','select','countTable','COUNT(*)','run','HOUR(%s)','operator','%s.%s\x20=\x20%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','get','CustomReports','UserProfileResource','then','stack','name','send','index','map','rawAttributes','fieldName'];(function(_0x1524a4,_0x33f93e){var _0x388207=function(_0x4d2db6){while(--_0x4d2db6){_0x1524a4['push'](_0x1524a4['shift']());}};_0x388207(++_0x33f93e);}(_0x009e,0x11c));var _0xe009=function(_0x4663f7,_0x41b7b8){_0x4663f7=_0x4663f7-0x0;var _0x5f450b=_0x009e[_0x4663f7];return _0x5f450b;};'use strict';var emlformat=require(_0xe009('0x0'));var rimraf=require(_0xe009('0x1'));var zipdir=require(_0xe009('0x2'));var jsonpatch=require(_0xe009('0x3'));var rp=require(_0xe009('0x4'));var moment=require('moment');var BPromise=require(_0xe009('0x5'));var Mustache=require('mustache');var util=require(_0xe009('0x6'));var path=require('path');var sox=require(_0xe009('0x7'));var csv=require(_0xe009('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe009('0x9'));var _=require('lodash');var squel=require(_0xe009('0xa'));var crypto=require(_0xe009('0xb'));var jsforce=require(_0xe009('0xc'));var deskjs=require(_0xe009('0xd'));var toCsv=require(_0xe009('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe009('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe009('0xf'));var as=require(_0xe009('0x10'));var hardwareService=require(_0xe009('0x11'));var logger=require(_0xe009('0x12'))(_0xe009('0x13'));var utils=require(_0xe009('0x14'));var config=require(_0xe009('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe009('0x16'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0x3c6791,_0x2f411a){_0x2f411a=_0x2f411a||0xcc;return function(_0x3fb2a8){if(_0x3fb2a8){return _0x3c6791[_0xe009('0x17')](_0x2f411a);}return _0x3c6791[_0xe009('0x18')](_0x2f411a)[_0xe009('0x19')]();};}function respondWithResult(_0x198d15,_0x3737d6){_0x3737d6=_0x3737d6||0xc8;return function(_0x1ffa85){if(_0x1ffa85){return _0x198d15[_0xe009('0x18')](_0x3737d6)[_0xe009('0x1a')](_0x1ffa85);}};}function respondWithFilteredResult(_0x22e5ad,_0xfdbbe8){return function(_0x4494c3){if(_0x4494c3){var _0xa007b9=typeof _0xfdbbe8[_0xe009('0x1b')]===_0xe009('0x1c')&&typeof _0xfdbbe8[_0xe009('0x1d')]===_0xe009('0x1c');var _0x4eefa4=_0x4494c3['count'];var _0x570741=_0xa007b9?0x0:_0xfdbbe8[_0xe009('0x1b')];var _0x1611e2=_0xa007b9?_0x4494c3['count']:_0xfdbbe8['offset']+_0xfdbbe8[_0xe009('0x1d')];var _0xd0ed82;if(_0x1611e2>=_0x4eefa4){_0x1611e2=_0x4eefa4;_0xd0ed82=0xc8;}else{_0xd0ed82=0xce;}_0x22e5ad[_0xe009('0x18')](_0xd0ed82);return _0x22e5ad[_0xe009('0x1e')](_0xe009('0x1f'),_0x570741+'-'+_0x1611e2+'/'+_0x4eefa4)[_0xe009('0x1a')](_0x4494c3);}return null;};}function patchUpdates(_0x19686c){return function(_0x2aec0c){try{jsonpatch[_0xe009('0x20')](_0x2aec0c,_0x19686c,!![]);}catch(_0x5c8653){return BPromise['reject'](_0x5c8653);}return _0x2aec0c[_0xe009('0x21')]();};}function saveUpdates(_0x2b4120,_0x53dab6){return function(_0x26ba88){if(_0x26ba88){return _0x26ba88[_0xe009('0x22')](_0x2b4120)['then'](function(_0x80156c){return _0x80156c;});}return null;};}function removeEntity(_0x37a881,_0x14eef6){return function(_0x475d92){if(_0x475d92){return _0x475d92['destroy']()['then'](function(){var _0x417dac=_0x475d92[_0xe009('0x23')]({'plain':!![]});var _0x517f72=_0xe009('0x24');return db[_0xe009('0x25')]['destroy']({'where':{'type':_0x517f72,'resourceId':_0x417dac['id']}})['then'](function(){return _0x475d92;});})[_0xe009('0x26')](function(){_0x37a881[_0xe009('0x18')](0xcc)[_0xe009('0x19')]();});}};}function handleEntityNotFound(_0x3ebefb,_0x503646){return function(_0x25ff53){if(!_0x25ff53){_0x3ebefb[_0xe009('0x17')](0x194);}return _0x25ff53;};}function handleError(_0x51c2f1,_0x5567c2){_0x5567c2=_0x5567c2||0x1f4;return function(_0x4769e6){logger['error'](_0x4769e6[_0xe009('0x27')]);if(_0x4769e6[_0xe009('0x28')]){delete _0x4769e6[_0xe009('0x28')];}_0x51c2f1[_0xe009('0x18')](_0x5567c2)[_0xe009('0x29')](_0x4769e6);};}exports[_0xe009('0x2a')]=function(_0x4fe786,_0x137bdd){var _0x117d7e={},_0x3bb962={},_0x29d0e8={'count':0x0,'rows':[]};var _0x90a38d=_[_0xe009('0x2b')](db['AnalyticCustomReport'][_0xe009('0x2c')],function(_0x1f5d94){return{'name':_0x1f5d94[_0xe009('0x2d')],'type':_0x1f5d94[_0xe009('0x2e')][_0xe009('0x2f')]};});_0x3bb962['model']=_['map'](_0x90a38d,_0xe009('0x28'));_0x3bb962[_0xe009('0x30')]=_['keys'](_0x4fe786['query']);_0x3bb962[_0xe009('0x31')]=_['intersection'](_0x3bb962['model'],_0x3bb962[_0xe009('0x30')]);_0x117d7e['attributes']=_[_0xe009('0x32')](_0x3bb962[_0xe009('0x33')],qs[_0xe009('0x34')](_0x4fe786[_0xe009('0x30')][_0xe009('0x34')]));_0x117d7e[_0xe009('0x35')]=_0x117d7e[_0xe009('0x35')]['length']?_0x117d7e['attributes']:_0x3bb962[_0xe009('0x33')];if(!_0x4fe786[_0xe009('0x30')]['hasOwnProperty'](_0xe009('0x36'))){_0x117d7e[_0xe009('0x1d')]=qs['limit'](_0x4fe786[_0xe009('0x30')][_0xe009('0x1d')]);_0x117d7e[_0xe009('0x1b')]=qs[_0xe009('0x1b')](_0x4fe786[_0xe009('0x30')]['offset']);}_0x117d7e[_0xe009('0x37')]=qs[_0xe009('0x38')](_0x4fe786[_0xe009('0x30')][_0xe009('0x38')]);_0x117d7e[_0xe009('0x39')]=qs[_0xe009('0x31')](_[_0xe009('0x3a')](_0x4fe786[_0xe009('0x30')],_0x3bb962[_0xe009('0x31')]),_0x90a38d);if(_0x4fe786[_0xe009('0x30')][_0xe009('0x3b')]){_0x117d7e[_0xe009('0x39')]=_[_0xe009('0x3c')](_0x117d7e[_0xe009('0x39')],{'$or':_[_0xe009('0x2b')](_0x90a38d,function(_0xbf0d51){if(_0xbf0d51[_0xe009('0x2e')]!==_0xe009('0x3d')){var _0x52450d={};_0x52450d[_0xbf0d51['name']]={'$like':'%'+_0x4fe786[_0xe009('0x30')][_0xe009('0x3b')]+'%'};return _0x52450d;}})});}_0x117d7e=_['merge']({},_0x117d7e,_0x4fe786[_0xe009('0x3e')]);var _0x29cac0={'where':_0x117d7e[_0xe009('0x39')]};return db[_0xe009('0x3f')][_0xe009('0x40')](_0x29cac0)[_0xe009('0x26')](function(_0x15f515){_0x29d0e8[_0xe009('0x40')]=_0x15f515;if(_0x4fe786[_0xe009('0x30')][_0xe009('0x41')]){_0x117d7e[_0xe009('0x42')]=[{'all':!![]}];}return db[_0xe009('0x3f')][_0xe009('0x43')](_0x117d7e);})[_0xe009('0x26')](function(_0x5b2fa4){_0x29d0e8[_0xe009('0x44')]=_0x5b2fa4;return _0x29d0e8;})[_0xe009('0x26')](respondWithFilteredResult(_0x137bdd,_0x117d7e))[_0xe009('0x45')](handleError(_0x137bdd,null));};exports[_0xe009('0x46')]=function(_0x491105,_0x2e2055){var _0x2b205d={'raw':![],'where':{'id':_0x491105['params']['id']}},_0x4da5c6={};_0x4da5c6[_0xe009('0x33')]=_[_0xe009('0x47')](db['AnalyticCustomReport'][_0xe009('0x2c')]);_0x4da5c6['query']=_[_0xe009('0x47')](_0x491105[_0xe009('0x30')]);_0x4da5c6[_0xe009('0x31')]=_[_0xe009('0x32')](_0x4da5c6['model'],_0x4da5c6[_0xe009('0x30')]);_0x2b205d[_0xe009('0x35')]=_[_0xe009('0x32')](_0x4da5c6[_0xe009('0x33')],qs['fields'](_0x491105[_0xe009('0x30')][_0xe009('0x34')]));_0x2b205d[_0xe009('0x35')]=_0x2b205d['attributes'][_0xe009('0x48')]?_0x2b205d[_0xe009('0x35')]:_0x4da5c6[_0xe009('0x33')];if(_0x491105[_0xe009('0x30')]['includeAll']){_0x2b205d[_0xe009('0x42')]=[{'all':!![]}];}_0x2b205d=_[_0xe009('0x3c')]({},_0x2b205d,_0x491105[_0xe009('0x3e')]);return db['AnalyticCustomReport'][_0xe009('0x49')](_0x2b205d)[_0xe009('0x26')](handleEntityNotFound(_0x2e2055,null))[_0xe009('0x26')](respondWithResult(_0x2e2055,null))[_0xe009('0x45')](handleError(_0x2e2055,null));};exports[_0xe009('0x4a')]=function(_0x55a736,_0x219b3f){return db['AnalyticCustomReport'][_0xe009('0x4a')](_0x55a736[_0xe009('0x4b')],{})[_0xe009('0x26')](function(_0x4b4f50){var _0x3f587a=_0x55a736['user'][_0xe009('0x23')]({'plain':!![]});if(!_0x3f587a)throw new Error(_0xe009('0x4c'));if(_0x3f587a['role']===_0xe009('0x4d')){var _0x1068b0=_0x4b4f50[_0xe009('0x23')]({'plain':!![]});var _0x17a2cc=_0xe009('0x4e');return db[_0xe009('0x4f')][_0xe009('0x49')]({'where':{'name':_0x17a2cc,'userProfileId':_0x3f587a[_0xe009('0x50')]},'raw':!![]})['then'](function(_0x27f3ae){if(_0x27f3ae&&_0x27f3ae[_0xe009('0x51')]===0x0){return db[_0xe009('0x25')][_0xe009('0x4a')]({'name':_0x1068b0[_0xe009('0x28')],'resourceId':_0x1068b0['id'],'type':_0xe009('0x24'),'sectionId':_0x27f3ae['id']},{})[_0xe009('0x26')](function(){return _0x4b4f50;});}else{return _0x4b4f50;}})[_0xe009('0x45')](function(_0x82af5){logger[_0xe009('0x52')](_0xe009('0x53'),_0x82af5);throw _0x82af5;});}return _0x4b4f50;})[_0xe009('0x26')](respondWithResult(_0x219b3f,0xc9))['catch'](handleError(_0x219b3f,null));};exports[_0xe009('0x22')]=function(_0x3f1829,_0x27e66b){if(_0x3f1829['body']['id']){delete _0x3f1829[_0xe009('0x4b')]['id'];}return db[_0xe009('0x3f')][_0xe009('0x49')]({'where':{'id':_0x3f1829[_0xe009('0x54')]['id']}})[_0xe009('0x26')](handleEntityNotFound(_0x27e66b,null))[_0xe009('0x26')](saveUpdates(_0x3f1829[_0xe009('0x4b')],null))[_0xe009('0x26')](respondWithResult(_0x27e66b,null))[_0xe009('0x45')](handleError(_0x27e66b,null));};exports[_0xe009('0x55')]=function(_0x16c7a8,_0x2ab008){return db[_0xe009('0x3f')][_0xe009('0x49')]({'where':{'id':_0x16c7a8['params']['id']}})[_0xe009('0x26')](handleEntityNotFound(_0x2ab008,null))['then'](removeEntity(_0x2ab008,null))[_0xe009('0x45')](handleError(_0x2ab008,null));};exports['preview']=function(_0x243dde,_0x44b93c){var _0x2d1446=0xa;var _0xb23c79=[_0xe009('0x56'),_0xe009('0x57'),_0xe009('0x58'),_0xe009('0x59')];var _0x171b44={'SUM':_0xe009('0x5a'),'COUNT':_0xe009('0x5b'),'COUNT DISTINCT':_0xe009('0x5c'),'MAX':_0xe009('0x5d'),'MIN':'MIN(%s)','AVG':_0xe009('0x5e'),'GROUP_CONCAT':_0xe009('0x5f'),'GROUP_CONCAT ASC':_0xe009('0x60'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x19a162={'SEC_TO_TIME':_0xe009('0x61'),'DATE':_0xe009('0x62'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1bff70=function(_0x5da0ca){return!_[_0xe009('0x63')]([_0xe009('0x64'),_0xe009('0x65'),_0xe009('0x66'),'IS\x20NOT\x20EMPTY'],_0x5da0ca);};var _0xc859bf=function(_0x611770){if(!_0x611770||!_0x611770[_0xe009('0x67')]['length']){return'';}for(var _0x4790a6='(',_0x56d9c5=0x0;_0x56d9c5<_0x611770[_0xe009('0x67')][_0xe009('0x48')];_0x56d9c5+=0x1){_0x56d9c5>0x0&&(_0x4790a6+='\x20'+_0x611770['operator']+'\x20');_0x4790a6+=_0x611770[_0xe009('0x67')][_0x56d9c5][_0xe009('0x68')]?_0xc859bf(_0x611770[_0xe009('0x67')][_0x56d9c5]['group']):_0x611770[_0xe009('0x67')][_0x56d9c5]['field']+'\x20'+_0x611770[_0xe009('0x67')][_0x56d9c5][_0xe009('0x69')]+(_0x1bff70(_0x611770[_0xe009('0x67')][_0x56d9c5][_0xe009('0x69')])?'\x20'+_0x611770[_0xe009('0x67')][_0x56d9c5][_0xe009('0x6a')]:'');}return _0x4790a6+')';};var _0x914923={'where':{'id':_0x243dde['params']['id']}},_0x4cb72c,_0x4360ab,_0x1f0902,_0x2bd865,_0x486a8a;_0x914923=_[_0xe009('0x3c')]({},_0x914923,_0x243dde[_0xe009('0x3e')]);return db[_0xe009('0x3f')][_0xe009('0x49')](_0x914923)['then'](function(_0x32c909){if(_0x32c909){_0x4cb72c=_0x32c909;return _0x32c909[_0xe009('0x6b')]();}return null;})[_0xe009('0x26')](function(_0x1ad80a){if(_0x1ad80a){if(!_0x1ad80a['length']){throw new db[(_0xe009('0x6c'))][(_0xe009('0x6d'))](_0xe009('0x6e'),0x193);}_0x4360ab=_0x1ad80a;return db[_0xe009('0x6f')]['findAll']({'raw':!![]});}return null;})[_0xe009('0x26')](function(_0x2da7f7){if(_0x2da7f7){_0x1f0902=_['keyBy'](_0x2da7f7,'id');var _0x4597e2;var _0x5a3678=squel['select']();_0x5a3678['from'](_0x4cb72c[_0xe009('0x70')]);for(var _0x4f480b=0x0;_0x4f480b<_0x4360ab[_0xe009('0x48')];_0x4f480b+=0x1){_0x4597e2=_0x4360ab[_0x4f480b][_0xe009('0x71')]?_0x1f0902[_0x4360ab[_0x4f480b][_0xe009('0x71')]][_0xe009('0x72')]:_0x4360ab[_0x4f480b][_0xe009('0x73')];_0x4597e2=_0x4360ab[_0x4f480b][_0xe009('0x74')]?_[_0xe009('0x75')](_0x171b44[_0x4360ab[_0x4f480b][_0xe009('0x74')]],'%s',_0x4597e2):_0x4597e2;_0x4597e2=_0x4360ab[_0x4f480b][_0xe009('0x76')]?_[_0xe009('0x75')](_0x19a162[_0x4360ab[_0x4f480b][_0xe009('0x76')]],'%s',_0x4597e2):_0x4597e2;if(_0x4360ab[_0x4f480b]['groupBy']){_0x5a3678[_0xe009('0x68')](_0x4597e2);}_0x4360ab[_0x4f480b][_0xe009('0x77')]&&_0x5a3678[_0xe009('0x37')](_0x4597e2,_0x4360ab[_0x4f480b][_0xe009('0x77')]===_0xe009('0x78')?![]:!![]);_0x5a3678[_0xe009('0x73')](_0x4597e2,_0x4360ab[_0x4f480b][_0xe009('0x79')]||_0x4597e2);}if(_0x4cb72c[_0xe009('0x7a')]){_0x4cb72c[_0xe009('0x7a')]=JSON[_0xe009('0x7b')](_0x4cb72c[_0xe009('0x7a')]);for(var _0x3efed0=0x0;_0x3efed0<_0x4cb72c[_0xe009('0x7a')][_0xe009('0x48')];_0x3efed0+=0x1){if(_0x4cb72c[_0xe009('0x7a')][_0x3efed0]['type']&&_[_0xe009('0x63')](_0xb23c79,_0x4cb72c[_0xe009('0x7a')][_0x3efed0][_0xe009('0x2e')])&&_0x4cb72c[_0xe009('0x7a')][_0x3efed0][_0xe009('0x7c')]&&_0x4cb72c[_0xe009('0x7a')][_0x3efed0][_0xe009('0x7d')]&&_0x4cb72c[_0xe009('0x7a')][_0x3efed0][_0xe009('0x7e')]){_0x5a3678[_0x4cb72c[_0xe009('0x7a')][_0x3efed0][_0xe009('0x2e')]](_0x4cb72c[_0xe009('0x7a')][_0x3efed0][_0xe009('0x7d')],null,util[_0xe009('0x76')]('%s.%s\x20=\x20%s.%s',_0x4cb72c['table'],_0x4cb72c[_0xe009('0x7a')][_0x3efed0]['parentKey'],_0x4cb72c['joins'][_0x3efed0][_0xe009('0x7d')],_0x4cb72c[_0xe009('0x7a')][_0x3efed0][_0xe009('0x7e')]));}}}if(_0x4cb72c[_0xe009('0x7f')]){_0x4cb72c[_0xe009('0x7f')]=JSON[_0xe009('0x7b')](_0x4cb72c['conditions']);_0x5a3678[_0xe009('0x39')](_0xc859bf(_0x4cb72c[_0xe009('0x7f')]['group']));}_0x486a8a=_0x5a3678['clone']();_0x5a3678[_0xe009('0x1d')](_0x2d1446);_0x5a3678[_0xe009('0x1b')](0x0);logger[_0xe009('0x80')](_0xe009('0x81'),_0x5a3678['toString']());return dbH[_0xe009('0x82')][_0xe009('0x30')](_0x5a3678[_0xe009('0x83')](),{'type':dbH['sequelize'][_0xe009('0x84')][_0xe009('0x85')]});}})[_0xe009('0x26')](respondWithResult(_0x44b93c,null))[_0xe009('0x45')](handleError(_0x44b93c,null));};function runReport(_0x3264d9,_0x47467c,_0x5cda68){var _0x87b397=_0x47467c[_0xe009('0x28')];var _0xa7777=0xa;var _0x31f028=[_0xe009('0x56'),_0xe009('0x57'),'right_join','cross_join'];var _0x5a5242={'SUM':_0xe009('0x5a'),'COUNT':_0xe009('0x5b'),'COUNT DISTINCT':_0xe009('0x5c'),'MAX':_0xe009('0x5d'),'MIN':_0xe009('0x86'),'AVG':_0xe009('0x5e'),'GROUP_CONCAT':_0xe009('0x5f'),'GROUP_CONCAT ASC':_0xe009('0x60'),'GROUP_CONCAT DESC':_0xe009('0x87')};var _0x430c14={'SEC_TO_TIME':_0xe009('0x61'),'DATE':_0xe009('0x62'),'HOUR':'HOUR(%s)','ROUND':_0xe009('0x88'),'UNIX_TIMESTAMP':_0xe009('0x89')};var _0x297144=function(_0x502224){return!_['includes']([_0xe009('0x64'),'IS\x20NOT\x20NULL',_0xe009('0x66'),_0xe009('0x8a')],_0x502224);};var _0x45a9c8=function(_0x1903ff){if(!_0x1903ff||!_0x1903ff[_0xe009('0x67')][_0xe009('0x48')]){return'';}for(var _0x276ff8='(',_0x2d833d=0x0;_0x2d833d<_0x1903ff['rules']['length'];_0x2d833d+=0x1){_0x2d833d>0x0&&(_0x276ff8+='\x20'+_0x1903ff['operator']+'\x20');_0x276ff8+=_0x1903ff['rules'][_0x2d833d][_0xe009('0x68')]?_0x45a9c8(_0x1903ff[_0xe009('0x67')][_0x2d833d][_0xe009('0x68')]):_0x1903ff[_0xe009('0x67')][_0x2d833d]['field']+'\x20'+_0x1903ff[_0xe009('0x67')][_0x2d833d][_0xe009('0x69')]+(_0x297144(_0x1903ff[_0xe009('0x67')][_0x2d833d]['condition'])?'\x20'+_0x1903ff[_0xe009('0x67')][_0x2d833d][_0xe009('0x6a')]:'');}return _0x276ff8+')';};var _0x1615ca={'where':{'id':_0x3264d9['id']}},_0x3cd004,_0x4905bf,_0x4a3db2,_0x10b2db,_0x4bc02b;_0x1615ca=_[_0xe009('0x3c')]({},_0x1615ca,_0x5cda68);return db['AnalyticCustomReport'][_0xe009('0x49')](_0x1615ca)[_0xe009('0x26')](function(_0x386046){if(_0x386046){_0x3cd004=_0x386046;return _0x386046[_0xe009('0x6b')]();}return null;})[_0xe009('0x26')](function(_0x3f7954){if(_0x3f7954){if(!_0x3f7954[_0xe009('0x48')]){throw new db[(_0xe009('0x6c'))][(_0xe009('0x6d'))](_0xe009('0x6e'),0x193);}_0x4905bf=_0x3f7954;return db[_0xe009('0x6f')][_0xe009('0x43')]({'raw':!![]});}return null;})[_0xe009('0x26')](function(_0x4b1c51){if(_0x4b1c51){_0x4a3db2=_[_0xe009('0x8b')](_0x4b1c51,'id');var _0xcf40e0;var _0x2e1534=squel['select']();_0x2e1534[_0xe009('0x8c')](_0x3cd004[_0xe009('0x70')]);for(var _0xcb65fa=0x0;_0xcb65fa<_0x4905bf['length'];_0xcb65fa+=0x1){_0xcf40e0=_0x4905bf[_0xcb65fa][_0xe009('0x71')]?_0x4a3db2[_0x4905bf[_0xcb65fa][_0xe009('0x71')]]['metric']:_0x4905bf[_0xcb65fa][_0xe009('0x73')];_0xcf40e0=_0x4905bf[_0xcb65fa][_0xe009('0x74')]?_[_0xe009('0x75')](_0x5a5242[_0x4905bf[_0xcb65fa]['function']],'%s',_0xcf40e0):_0xcf40e0;_0xcf40e0=_0x4905bf[_0xcb65fa][_0xe009('0x76')]?_[_0xe009('0x75')](_0x430c14[_0x4905bf[_0xcb65fa]['format']],'%s',_0xcf40e0):_0xcf40e0;if(_0x4905bf[_0xcb65fa][_0xe009('0x8d')]){_0x2e1534[_0xe009('0x68')](_0xcf40e0);}_0x4905bf[_0xcb65fa]['orderBy']&&_0x2e1534[_0xe009('0x37')](_0xcf40e0,_0x4905bf[_0xcb65fa][_0xe009('0x77')]===_0xe009('0x78')?![]:!![]);_0x2e1534[_0xe009('0x73')](_0xcf40e0,_0x4905bf[_0xcb65fa]['alias']||_0xcf40e0);}if(_0x3cd004['joins']){_0x3cd004['joins']=JSON[_0xe009('0x7b')](_0x3cd004['joins']);for(var _0x2495ed=0x0;_0x2495ed<_0x3cd004[_0xe009('0x7a')][_0xe009('0x48')];_0x2495ed+=0x1){if(_0x3cd004[_0xe009('0x7a')][_0x2495ed][_0xe009('0x2e')]&&_[_0xe009('0x63')](_0x31f028,_0x3cd004['joins'][_0x2495ed][_0xe009('0x2e')])&&_0x3cd004[_0xe009('0x7a')][_0x2495ed][_0xe009('0x7c')]&&_0x3cd004[_0xe009('0x7a')][_0x2495ed][_0xe009('0x7d')]&&_0x3cd004[_0xe009('0x7a')][_0x2495ed][_0xe009('0x7e')]){_0x2e1534[_0x3cd004[_0xe009('0x7a')][_0x2495ed][_0xe009('0x2e')]](_0x3cd004['joins'][_0x2495ed][_0xe009('0x7d')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3cd004[_0xe009('0x70')],_0x3cd004[_0xe009('0x7a')][_0x2495ed][_0xe009('0x7c')],_0x3cd004[_0xe009('0x7a')][_0x2495ed]['foreignTable'],_0x3cd004[_0xe009('0x7a')][_0x2495ed][_0xe009('0x7e')]));}}}if(_0x3cd004['conditions']){_0x3cd004['conditions']=JSON[_0xe009('0x7b')](_0x3cd004[_0xe009('0x7f')]);_0x2e1534[_0xe009('0x39')](_0x45a9c8(_0x3cd004[_0xe009('0x7f')][_0xe009('0x68')]));}_0x4bc02b=_0x2e1534[_0xe009('0x8e')]();_0x2e1534[_0xe009('0x1d')](_0xa7777);_0x2e1534['offset'](0x0);return;}})[_0xe009('0x26')](function(){if(_0x47467c[_0xe009('0x8f')]===_0xe009('0x90')){return null;}var _0x39c42e=_[_0xe009('0x3c')](_0x47467c,{'name':_0x47467c[_0xe009('0x91')]||_0x47467c[_0xe009('0x28')]||_0x3cd004['name'],'basename':_0x87b397,'savename':util[_0xe009('0x76')](_0xe009('0x92'),_0x47467c[_0xe009('0x28')]||_0x3cd004[_0xe009('0x28')],require(_0xe009('0x93'))[_0xe009('0x94')](0x4),_0x47467c[_0xe009('0x8f')]||_0xe009('0x95')),'reportId':_0x3cd004['id'],'reportType':'custom'});return db['AnalyticExtractedReport']['create'](_0x39c42e,{'raw':!![]});})[_0xe009('0x26')](function(_0x2ba59b){if(_0x3cd004[_0xe009('0x70')]===_0xe009('0x96')){_0x4bc02b[_0xe009('0x39')](_0x3cd004['table']+_0xe009('0x97'),_0x47467c[_0xe009('0x98')],_0x47467c[_0xe009('0x99')]);}else{_0x4bc02b[_0xe009('0x39')](_0x3cd004[_0xe009('0x70')]+_0xe009('0x9a'),_0x47467c[_0xe009('0x98')],_0x47467c[_0xe009('0x99')]);}if(_0x2ba59b){logger['info'](_0xe009('0x9b'),_0x4bc02b[_0xe009('0x83')]());require(_0xe009('0x9c'))['fork'](path[_0xe009('0x56')](__dirname,_0xe009('0x9d'),_0x2ba59b['output']),[_0x2ba59b['id'],_0x4bc02b[_0xe009('0x83')](),path[_0xe009('0x56')](__dirname,'../../files/reports',_0x2ba59b['savename']),_0x87b397]);return _0x2ba59b;}else{var _0x3a7357=squel[_0xe009('0x9e')]();_0x3a7357[_0xe009('0x8c')]('('+_0x4bc02b[_0xe009('0x83')]()+')',_0xe009('0x9f'));_0x3a7357[_0xe009('0x73')](_0xe009('0xa0'),_0xe009('0x40'));_0x4bc02b[_0xe009('0x1d')](_0x47467c[_0xe009('0x1d')]||_0xa7777);_0x4bc02b[_0xe009('0x1b')](_0x47467c['offset']||0x0);return dbH[_0xe009('0x82')][_0xe009('0x30')](_0x3a7357[_0xe009('0x83')](),{'type':dbH[_0xe009('0x82')][_0xe009('0x84')][_0xe009('0x85')]})['then'](function(_0x58963d){if(!_0x58963d[_0xe009('0x48')]){_0x10b2db=0x0;}else{_0x10b2db=_0x58963d[0x0][_0xe009('0x40')]||0x0;}return dbH['sequelize'][_0xe009('0x30')](_0x4bc02b['toString'](),{'type':dbH[_0xe009('0x82')][_0xe009('0x84')]['SELECT']});})[_0xe009('0x26')](function(_0x5461c9){return{'rows':_0x5461c9||[],'count':_0x10b2db};});}});}exports[_0xe009('0xa1')]=function(_0x4c9cac,_0x6c288a){return runReport(_0x4c9cac[_0xe009('0x54')],_0x4c9cac['query'],_0x4c9cac[_0xe009('0x3e')])[_0xe009('0x26')](respondWithResult(_0x6c288a,null))[_0xe009('0x45')](handleError(_0x6c288a,null));};exports['runReport']=runReport;exports['query']=function(_0x32f555,_0xe0613d){var _0x42270a=0xa;var _0x184891=['join',_0xe009('0x57'),_0xe009('0x58'),'cross_join'];var _0x1c3d3c={'SUM':_0xe009('0x5a'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xe009('0x5c'),'MAX':_0xe009('0x5d'),'MIN':_0xe009('0x86'),'AVG':_0xe009('0x5e'),'GROUP_CONCAT':_0xe009('0x5f'),'GROUP_CONCAT ASC':_0xe009('0x60'),'GROUP_CONCAT DESC':_0xe009('0x87')};var _0x46b91d={'SEC_TO_TIME':_0xe009('0x61'),'DATE':_0xe009('0x62'),'HOUR':_0xe009('0xa2'),'ROUND':_0xe009('0x88'),'UNIX_TIMESTAMP':_0xe009('0x89')};var _0x15d2d5=function(_0x2c8ed9){return!_[_0xe009('0x63')]([_0xe009('0x64'),'IS\x20NOT\x20NULL',_0xe009('0x66'),_0xe009('0x8a')],_0x2c8ed9);};var _0x5e90ba=function(_0x5076dc){if(!_0x5076dc||!_0x5076dc['rules'][_0xe009('0x48')]){return'';}for(var _0x3035a5='(',_0x106186=0x0;_0x106186<_0x5076dc[_0xe009('0x67')][_0xe009('0x48')];_0x106186+=0x1){_0x106186>0x0&&(_0x3035a5+='\x20'+_0x5076dc[_0xe009('0xa3')]+'\x20');_0x3035a5+=_0x5076dc[_0xe009('0x67')][_0x106186][_0xe009('0x68')]?_0x5e90ba(_0x5076dc['rules'][_0x106186][_0xe009('0x68')]):_0x5076dc['rules'][_0x106186][_0xe009('0x73')]+'\x20'+_0x5076dc[_0xe009('0x67')][_0x106186]['condition']+(_0x15d2d5(_0x5076dc[_0xe009('0x67')][_0x106186][_0xe009('0x69')])?'\x20'+_0x5076dc['rules'][_0x106186]['value']:'');}return _0x3035a5+')';};var _0x5d351c={'where':{'id':_0x32f555[_0xe009('0x54')]['id']}},_0x36cd39,_0x26cfca,_0x4e81d1,_0x46bcab,_0x1e9374;_0x5d351c=_[_0xe009('0x3c')]({},_0x5d351c,_0x32f555[_0xe009('0x3e')]);return db[_0xe009('0x3f')][_0xe009('0x49')](_0x5d351c)['then'](function(_0x410809){if(_0x410809){_0x36cd39=_0x410809;return _0x410809['getFields']();}return null;})[_0xe009('0x26')](function(_0x3c5e61){if(_0x3c5e61){if(!_0x3c5e61[_0xe009('0x48')]){throw new db[(_0xe009('0x6c'))][(_0xe009('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x26cfca=_0x3c5e61;return db[_0xe009('0x6f')][_0xe009('0x43')]({'raw':!![]});}return null;})['then'](function(_0x3ea34f){if(_0x3ea34f){_0x4e81d1=_[_0xe009('0x8b')](_0x3ea34f,'id');var _0x5dba23;var _0x2aebe4=squel[_0xe009('0x9e')]();_0x2aebe4[_0xe009('0x8c')](_0x36cd39['table']);for(var _0x1f5db5=0x0;_0x1f5db5<_0x26cfca[_0xe009('0x48')];_0x1f5db5+=0x1){_0x5dba23=_0x26cfca[_0x1f5db5][_0xe009('0x71')]?_0x4e81d1[_0x26cfca[_0x1f5db5][_0xe009('0x71')]][_0xe009('0x72')]:_0x26cfca[_0x1f5db5][_0xe009('0x73')];_0x5dba23=_0x26cfca[_0x1f5db5][_0xe009('0x74')]?_[_0xe009('0x75')](_0x1c3d3c[_0x26cfca[_0x1f5db5][_0xe009('0x74')]],'%s',_0x5dba23):_0x5dba23;_0x5dba23=_0x26cfca[_0x1f5db5][_0xe009('0x76')]?_['replace'](_0x46b91d[_0x26cfca[_0x1f5db5]['format']],'%s',_0x5dba23):_0x5dba23;if(_0x26cfca[_0x1f5db5][_0xe009('0x8d')]){_0x2aebe4[_0xe009('0x68')](_0x5dba23);}_0x26cfca[_0x1f5db5]['orderBy']&&_0x2aebe4[_0xe009('0x37')](_0x5dba23,_0x26cfca[_0x1f5db5][_0xe009('0x77')]===_0xe009('0x78')?![]:!![]);_0x2aebe4[_0xe009('0x73')](_0x5dba23,_0x26cfca[_0x1f5db5][_0xe009('0x79')]||_0x5dba23);}if(_0x36cd39[_0xe009('0x7a')]){_0x36cd39[_0xe009('0x7a')]=JSON['parse'](_0x36cd39['joins']);for(var _0x213211=0x0;_0x213211<_0x36cd39['joins'][_0xe009('0x48')];_0x213211+=0x1){if(_0x36cd39[_0xe009('0x7a')][_0x213211]['type']&&_[_0xe009('0x63')](_0x184891,_0x36cd39[_0xe009('0x7a')][_0x213211]['type'])&&_0x36cd39[_0xe009('0x7a')][_0x213211]['parentKey']&&_0x36cd39[_0xe009('0x7a')][_0x213211]['foreignTable']&&_0x36cd39[_0xe009('0x7a')][_0x213211][_0xe009('0x7e')]){_0x2aebe4[_0x36cd39[_0xe009('0x7a')][_0x213211]['type']](_0x36cd39[_0xe009('0x7a')][_0x213211][_0xe009('0x7d')],null,util['format'](_0xe009('0xa4'),_0x36cd39['table'],_0x36cd39['joins'][_0x213211][_0xe009('0x7c')],_0x36cd39[_0xe009('0x7a')][_0x213211][_0xe009('0x7d')],_0x36cd39[_0xe009('0x7a')][_0x213211][_0xe009('0x7e')]));}}}if(_0x36cd39[_0xe009('0x7f')]){_0x36cd39[_0xe009('0x7f')]=JSON[_0xe009('0x7b')](_0x36cd39[_0xe009('0x7f')]);_0x2aebe4['where'](_0x5e90ba(_0x36cd39[_0xe009('0x7f')][_0xe009('0x68')]));}_0x1e9374=_0x2aebe4[_0xe009('0x8e')]();_0x2aebe4[_0xe009('0x1d')](_0x42270a);_0x2aebe4['offset'](0x0);logger[_0xe009('0x80')]('Limited\x20Query:',_0x2aebe4[_0xe009('0x83')]());return dbH[_0xe009('0x82')][_0xe009('0x30')](_0x2aebe4['toString'](),{'type':dbH['sequelize'][_0xe009('0x84')][_0xe009('0x85')]});}})[_0xe009('0x26')](function(){return{'sql':_0x1e9374[_0xe009('0x83')]()};})[_0xe009('0x26')](respondWithResult(_0xe0613d,null))[_0xe009('0x45')](handleError(_0xe0613d,null));}; \ No newline at end of file +var _0x1724=['conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','SEC_TO_TIME(%s)','HOUR(%s)','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','select','metric','output','web','fullPath','%s-%s.%s','randomstring','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','Run\x20Query:','../../components/export/','../../files/reports','savename','COUNT(*)','getFields','debug','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','json','undefined','limit','count','offset','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','sendStatus','error','stack','name','index','map','type','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','AnalyticCustomReport','includeAll','include','findAll','params','rawAttributes','fields','catch','create','body','user','role','Reports','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','right_join','SUM(%s)','MIN(%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\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','ValidationErrorItem','AnalyticMetric','keyBy','from','MetricId','function','replace','format','groupBy','orderBy','DESC','alias','parse','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','table'];(function(_0x315df3,_0x5e1513){var _0x3f1014=function(_0x18b73a){while(--_0x18b73a){_0x315df3['push'](_0x315df3['shift']());}};_0x3f1014(++_0x5e1513);}(_0x1724,0xca));var _0x4172=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x1724[_0x34021d];return _0x16597b;};'use strict';var emlformat=require(_0x4172('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4172('0x1'));var jsonpatch=require(_0x4172('0x2'));var rp=require(_0x4172('0x3'));var moment=require('moment');var BPromise=require(_0x4172('0x4'));var Mustache=require('mustache');var util=require(_0x4172('0x5'));var path=require(_0x4172('0x6'));var sox=require(_0x4172('0x7'));var csv=require(_0x4172('0x8'));var ejs=require(_0x4172('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4172('0xa'));var squel=require(_0x4172('0xb'));var crypto=require('crypto');var jsforce=require(_0x4172('0xc'));var deskjs=require(_0x4172('0xd'));var toCsv=require(_0x4172('0x8'));var querystring=require(_0x4172('0xe'));var Papa=require(_0x4172('0xf'));var Redis=require(_0x4172('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4172('0x11'));var as=require(_0x4172('0x12'));var hardwareService=require(_0x4172('0x13'));var logger=require(_0x4172('0x14'))(_0x4172('0x15'));var utils=require(_0x4172('0x16'));var config=require(_0x4172('0x17'));var licenseUtil=require(_0x4172('0x18'));var db=require(_0x4172('0x19'))['db'];var dbH=require(_0x4172('0x19'))[_0x4172('0x1a')];function respondWithStatusCode(_0xdac044,_0x54cd1e){_0x54cd1e=_0x54cd1e||0xcc;return function(_0x4b573b){if(_0x4b573b){return _0xdac044['sendStatus'](_0x54cd1e);}return _0xdac044[_0x4172('0x1b')](_0x54cd1e)[_0x4172('0x1c')]();};}function respondWithResult(_0x5c83de,_0x742dae){_0x742dae=_0x742dae||0xc8;return function(_0x2a66a8){if(_0x2a66a8){return _0x5c83de[_0x4172('0x1b')](_0x742dae)[_0x4172('0x1d')](_0x2a66a8);}};}function respondWithFilteredResult(_0xf7f7df,_0x4a0b4e){return function(_0x250bc7){if(_0x250bc7){var _0x3aa3f4=typeof _0x4a0b4e['offset']===_0x4172('0x1e')&&typeof _0x4a0b4e[_0x4172('0x1f')]===_0x4172('0x1e');var _0x594a77=_0x250bc7['count'];var _0x3840c3=_0x3aa3f4?0x0:_0x4a0b4e['offset'];var _0x16d50e=_0x3aa3f4?_0x250bc7[_0x4172('0x20')]:_0x4a0b4e[_0x4172('0x21')]+_0x4a0b4e[_0x4172('0x1f')];var _0x36e7c2;if(_0x16d50e>=_0x594a77){_0x16d50e=_0x594a77;_0x36e7c2=0xc8;}else{_0x36e7c2=0xce;}_0xf7f7df[_0x4172('0x1b')](_0x36e7c2);return _0xf7f7df['set']('Content-Range',_0x3840c3+'-'+_0x16d50e+'/'+_0x594a77)['json'](_0x250bc7);}return null;};}function patchUpdates(_0x24cb11){return function(_0xb6f7f2){try{jsonpatch['apply'](_0xb6f7f2,_0x24cb11,!![]);}catch(_0x54f6fa){return BPromise[_0x4172('0x22')](_0x54f6fa);}return _0xb6f7f2[_0x4172('0x23')]();};}function saveUpdates(_0x1a5667,_0x1ade23){return function(_0x2b214e){if(_0x2b214e){return _0x2b214e[_0x4172('0x24')](_0x1a5667)[_0x4172('0x25')](function(_0x2c393f){return _0x2c393f;});}return null;};}function removeEntity(_0x5e90a4,_0x304804){return function(_0x461e59){if(_0x461e59){return _0x461e59[_0x4172('0x26')]()['then'](function(){var _0x33b36b=_0x461e59[_0x4172('0x27')]({'plain':!![]});var _0x3f7bf5=_0x4172('0x28');return db[_0x4172('0x29')][_0x4172('0x26')]({'where':{'type':_0x3f7bf5,'resourceId':_0x33b36b['id']}})[_0x4172('0x25')](function(){return _0x461e59;});})[_0x4172('0x25')](function(){_0x5e90a4[_0x4172('0x1b')](0xcc)[_0x4172('0x1c')]();});}};}function handleEntityNotFound(_0x21b175,_0x1c1fe4){return function(_0x455ec6){if(!_0x455ec6){_0x21b175[_0x4172('0x2a')](0x194);}return _0x455ec6;};}function handleError(_0x5f090d,_0x94bcf5){_0x94bcf5=_0x94bcf5||0x1f4;return function(_0x37b580){logger[_0x4172('0x2b')](_0x37b580[_0x4172('0x2c')]);if(_0x37b580[_0x4172('0x2d')]){delete _0x37b580[_0x4172('0x2d')];}_0x5f090d[_0x4172('0x1b')](_0x94bcf5)['send'](_0x37b580);};}exports[_0x4172('0x2e')]=function(_0x2f6ece,_0x43c40b){var _0x32929a={},_0x5cbd60={},_0x913caa={'count':0x0,'rows':[]};var _0x258918=_[_0x4172('0x2f')](db['AnalyticCustomReport']['rawAttributes'],function(_0xfb45e){return{'name':_0xfb45e['fieldName'],'type':_0xfb45e[_0x4172('0x30')]['key']};});_0x5cbd60[_0x4172('0x31')]=_[_0x4172('0x2f')](_0x258918,_0x4172('0x2d'));_0x5cbd60[_0x4172('0x32')]=_[_0x4172('0x33')](_0x2f6ece[_0x4172('0x32')]);_0x5cbd60[_0x4172('0x34')]=_['intersection'](_0x5cbd60['model'],_0x5cbd60[_0x4172('0x32')]);_0x32929a[_0x4172('0x35')]=_[_0x4172('0x36')](_0x5cbd60[_0x4172('0x31')],qs['fields'](_0x2f6ece[_0x4172('0x32')]['fields']));_0x32929a[_0x4172('0x35')]=_0x32929a[_0x4172('0x35')][_0x4172('0x37')]?_0x32929a[_0x4172('0x35')]:_0x5cbd60[_0x4172('0x31')];if(!_0x2f6ece['query'][_0x4172('0x38')](_0x4172('0x39'))){_0x32929a[_0x4172('0x1f')]=qs['limit'](_0x2f6ece['query'][_0x4172('0x1f')]);_0x32929a[_0x4172('0x21')]=qs['offset'](_0x2f6ece[_0x4172('0x32')][_0x4172('0x21')]);}_0x32929a[_0x4172('0x3a')]=qs['sort'](_0x2f6ece[_0x4172('0x32')][_0x4172('0x3b')]);_0x32929a[_0x4172('0x3c')]=qs['filters'](_[_0x4172('0x3d')](_0x2f6ece[_0x4172('0x32')],_0x5cbd60[_0x4172('0x34')]),_0x258918);if(_0x2f6ece[_0x4172('0x32')]['filter']){_0x32929a['where']=_[_0x4172('0x3e')](_0x32929a[_0x4172('0x3c')],{'$or':_[_0x4172('0x2f')](_0x258918,function(_0x5192d7){if(_0x5192d7[_0x4172('0x30')]!==_0x4172('0x3f')){var _0x1a23ad={};_0x1a23ad[_0x5192d7[_0x4172('0x2d')]]={'$like':'%'+_0x2f6ece[_0x4172('0x32')][_0x4172('0x40')]+'%'};return _0x1a23ad;}})});}_0x32929a=_[_0x4172('0x3e')]({},_0x32929a,_0x2f6ece[_0x4172('0x41')]);var _0x1624de={'where':_0x32929a[_0x4172('0x3c')]};return db[_0x4172('0x42')][_0x4172('0x20')](_0x1624de)[_0x4172('0x25')](function(_0x2774b3){_0x913caa[_0x4172('0x20')]=_0x2774b3;if(_0x2f6ece[_0x4172('0x32')][_0x4172('0x43')]){_0x32929a[_0x4172('0x44')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x4172('0x45')](_0x32929a);})[_0x4172('0x25')](function(_0x284902){_0x913caa['rows']=_0x284902;return _0x913caa;})['then'](respondWithFilteredResult(_0x43c40b,_0x32929a))['catch'](handleError(_0x43c40b,null));};exports['show']=function(_0x2290b5,_0x17f62e){var _0x392962={'raw':![],'where':{'id':_0x2290b5[_0x4172('0x46')]['id']}},_0x4851ba={};_0x4851ba[_0x4172('0x31')]=_[_0x4172('0x33')](db[_0x4172('0x42')][_0x4172('0x47')]);_0x4851ba[_0x4172('0x32')]=_[_0x4172('0x33')](_0x2290b5['query']);_0x4851ba['filters']=_[_0x4172('0x36')](_0x4851ba['model'],_0x4851ba[_0x4172('0x32')]);_0x392962[_0x4172('0x35')]=_['intersection'](_0x4851ba[_0x4172('0x31')],qs[_0x4172('0x48')](_0x2290b5['query'][_0x4172('0x48')]));_0x392962[_0x4172('0x35')]=_0x392962[_0x4172('0x35')][_0x4172('0x37')]?_0x392962[_0x4172('0x35')]:_0x4851ba['model'];if(_0x2290b5[_0x4172('0x32')][_0x4172('0x43')]){_0x392962[_0x4172('0x44')]=[{'all':!![]}];}_0x392962=_[_0x4172('0x3e')]({},_0x392962,_0x2290b5[_0x4172('0x41')]);return db[_0x4172('0x42')]['find'](_0x392962)['then'](handleEntityNotFound(_0x17f62e,null))['then'](respondWithResult(_0x17f62e,null))[_0x4172('0x49')](handleError(_0x17f62e,null));};exports[_0x4172('0x4a')]=function(_0x1e87b0,_0x4e1e5b){return db['AnalyticCustomReport']['create'](_0x1e87b0[_0x4172('0x4b')],{})['then'](function(_0x4a5105){var _0xcf1b6c=_0x1e87b0[_0x4172('0x4c')]['get']({'plain':!![]});if(!_0xcf1b6c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xcf1b6c[_0x4172('0x4d')]==='user'){var _0x25aece=_0x4a5105[_0x4172('0x27')]({'plain':!![]});var _0x52fe07=_0x4172('0x4e');return db['UserProfileSection'][_0x4172('0x4f')]({'where':{'name':_0x52fe07,'userProfileId':_0xcf1b6c[_0x4172('0x50')]},'raw':!![]})[_0x4172('0x25')](function(_0x542450){if(_0x542450&&_0x542450[_0x4172('0x51')]===0x0){return db[_0x4172('0x29')][_0x4172('0x4a')]({'name':_0x25aece['name'],'resourceId':_0x25aece['id'],'type':'CustomReports','sectionId':_0x542450['id']},{})[_0x4172('0x25')](function(){return _0x4a5105;});}else{return _0x4a5105;}})[_0x4172('0x49')](function(_0x23b7dc){logger[_0x4172('0x2b')](_0x4172('0x52'),_0x23b7dc);throw _0x23b7dc;});}return _0x4a5105;})[_0x4172('0x25')](respondWithResult(_0x4e1e5b,0xc9))[_0x4172('0x49')](handleError(_0x4e1e5b,null));};exports[_0x4172('0x24')]=function(_0xd7568,_0xf25cd4){if(_0xd7568[_0x4172('0x4b')]['id']){delete _0xd7568['body']['id'];}return db[_0x4172('0x42')]['find']({'where':{'id':_0xd7568[_0x4172('0x46')]['id']}})[_0x4172('0x25')](handleEntityNotFound(_0xf25cd4,null))[_0x4172('0x25')](saveUpdates(_0xd7568[_0x4172('0x4b')],null))[_0x4172('0x25')](respondWithResult(_0xf25cd4,null))[_0x4172('0x49')](handleError(_0xf25cd4,null));};exports[_0x4172('0x26')]=function(_0x6b4e9b,_0x2cfad0){return db[_0x4172('0x42')][_0x4172('0x4f')]({'where':{'id':_0x6b4e9b[_0x4172('0x46')]['id']}})[_0x4172('0x25')](handleEntityNotFound(_0x2cfad0,null))[_0x4172('0x25')](removeEntity(_0x2cfad0,null))[_0x4172('0x49')](handleError(_0x2cfad0,null));};exports[_0x4172('0x53')]=function(_0x2af08e,_0x2d3c14){var _0x43e310=0xa;var _0x123859=[_0x4172('0x54'),'left_join',_0x4172('0x55'),'cross_join'];var _0x5a1f3e={'SUM':_0x4172('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x4172('0x57'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4172('0x58'),'GROUP_CONCAT ASC':_0x4172('0x59'),'GROUP_CONCAT DESC':_0x4172('0x5a')};var _0x547730={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4172('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0x4172('0x5c'),'UNIX_TIMESTAMP':_0x4172('0x5d')};var _0x5d085c=function(_0x3b8edb){return!_[_0x4172('0x5e')]([_0x4172('0x5f'),_0x4172('0x60'),_0x4172('0x61'),_0x4172('0x62')],_0x3b8edb);};var _0x5bf8ed=function(_0x2a9a9c){if(!_0x2a9a9c||!_0x2a9a9c[_0x4172('0x63')][_0x4172('0x37')]){return'';}for(var _0x26a4a9='(',_0x685ecd=0x0;_0x685ecd<_0x2a9a9c[_0x4172('0x63')]['length'];_0x685ecd+=0x1){_0x685ecd>0x0&&(_0x26a4a9+='\x20'+_0x2a9a9c[_0x4172('0x64')]+'\x20');_0x26a4a9+=_0x2a9a9c['rules'][_0x685ecd][_0x4172('0x65')]?_0x5bf8ed(_0x2a9a9c['rules'][_0x685ecd][_0x4172('0x65')]):_0x2a9a9c[_0x4172('0x63')][_0x685ecd][_0x4172('0x66')]+'\x20'+_0x2a9a9c[_0x4172('0x63')][_0x685ecd][_0x4172('0x67')]+(_0x5d085c(_0x2a9a9c[_0x4172('0x63')][_0x685ecd][_0x4172('0x67')])?'\x20'+_0x2a9a9c['rules'][_0x685ecd][_0x4172('0x68')]:'');}return _0x26a4a9+')';};var _0x2f055f={'where':{'id':_0x2af08e['params']['id']}},_0xbe4ae4,_0x580ed1,_0x187a34,_0x50d33c,_0x577eac;_0x2f055f=_[_0x4172('0x3e')]({},_0x2f055f,_0x2af08e[_0x4172('0x41')]);return db[_0x4172('0x42')][_0x4172('0x4f')](_0x2f055f)[_0x4172('0x25')](function(_0x1dae4b){if(_0x1dae4b){_0xbe4ae4=_0x1dae4b;return _0x1dae4b['getFields']();}return null;})[_0x4172('0x25')](function(_0x2ee003){if(_0x2ee003){if(!_0x2ee003[_0x4172('0x37')]){throw new db['Sequelize'][(_0x4172('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x580ed1=_0x2ee003;return db[_0x4172('0x6a')][_0x4172('0x45')]({'raw':!![]});}return null;})[_0x4172('0x25')](function(_0xf4ed1b){if(_0xf4ed1b){_0x187a34=_[_0x4172('0x6b')](_0xf4ed1b,'id');var _0x5a459e;var _0x11fa24=squel['select']();_0x11fa24[_0x4172('0x6c')](_0xbe4ae4['table']);for(var _0x558d23=0x0;_0x558d23<_0x580ed1[_0x4172('0x37')];_0x558d23+=0x1){_0x5a459e=_0x580ed1[_0x558d23][_0x4172('0x6d')]?_0x187a34[_0x580ed1[_0x558d23][_0x4172('0x6d')]]['metric']:_0x580ed1[_0x558d23][_0x4172('0x66')];_0x5a459e=_0x580ed1[_0x558d23][_0x4172('0x6e')]?_[_0x4172('0x6f')](_0x5a1f3e[_0x580ed1[_0x558d23]['function']],'%s',_0x5a459e):_0x5a459e;_0x5a459e=_0x580ed1[_0x558d23][_0x4172('0x70')]?_[_0x4172('0x6f')](_0x547730[_0x580ed1[_0x558d23][_0x4172('0x70')]],'%s',_0x5a459e):_0x5a459e;if(_0x580ed1[_0x558d23][_0x4172('0x71')]){_0x11fa24[_0x4172('0x65')](_0x5a459e);}_0x580ed1[_0x558d23][_0x4172('0x72')]&&_0x11fa24['order'](_0x5a459e,_0x580ed1[_0x558d23][_0x4172('0x72')]===_0x4172('0x73')?![]:!![]);_0x11fa24['field'](_0x5a459e,_0x580ed1[_0x558d23][_0x4172('0x74')]||_0x5a459e);}if(_0xbe4ae4['joins']){_0xbe4ae4['joins']=JSON[_0x4172('0x75')](_0xbe4ae4[_0x4172('0x76')]);for(var _0x78bd55=0x0;_0x78bd55<_0xbe4ae4['joins']['length'];_0x78bd55+=0x1){if(_0xbe4ae4[_0x4172('0x76')][_0x78bd55]['type']&&_['includes'](_0x123859,_0xbe4ae4[_0x4172('0x76')][_0x78bd55][_0x4172('0x30')])&&_0xbe4ae4[_0x4172('0x76')][_0x78bd55][_0x4172('0x77')]&&_0xbe4ae4[_0x4172('0x76')][_0x78bd55]['foreignTable']&&_0xbe4ae4[_0x4172('0x76')][_0x78bd55][_0x4172('0x78')]){_0x11fa24[_0xbe4ae4[_0x4172('0x76')][_0x78bd55][_0x4172('0x30')]](_0xbe4ae4['joins'][_0x78bd55][_0x4172('0x79')],null,util[_0x4172('0x70')](_0x4172('0x7a'),_0xbe4ae4[_0x4172('0x7b')],_0xbe4ae4[_0x4172('0x76')][_0x78bd55][_0x4172('0x77')],_0xbe4ae4[_0x4172('0x76')][_0x78bd55][_0x4172('0x79')],_0xbe4ae4['joins'][_0x78bd55][_0x4172('0x78')]));}}}if(_0xbe4ae4[_0x4172('0x7c')]){_0xbe4ae4['conditions']=JSON[_0x4172('0x75')](_0xbe4ae4[_0x4172('0x7c')]);_0x11fa24[_0x4172('0x3c')](_0x5bf8ed(_0xbe4ae4['conditions'][_0x4172('0x65')]));}_0x577eac=_0x11fa24[_0x4172('0x7d')]();_0x11fa24[_0x4172('0x1f')](_0x43e310);_0x11fa24[_0x4172('0x21')](0x0);logger['debug'](_0x4172('0x7e'),_0x11fa24[_0x4172('0x7f')]());return dbH['sequelize']['query'](_0x11fa24[_0x4172('0x7f')](),{'type':dbH[_0x4172('0x80')][_0x4172('0x81')][_0x4172('0x82')]});}})['then'](respondWithResult(_0x2d3c14,null))[_0x4172('0x49')](handleError(_0x2d3c14,null));};function runReport(_0x26f11a,_0x5ca8b5,_0x5a596c){var _0x570484=_0x5ca8b5[_0x4172('0x2d')];var _0x5f4a0b=0xa;var _0xd3010b=[_0x4172('0x54'),_0x4172('0x83'),_0x4172('0x55'),_0x4172('0x84')];var _0x1b8355={'SUM':'SUM(%s)','COUNT':_0x4172('0x85'),'COUNT DISTINCT':_0x4172('0x86'),'MAX':_0x4172('0x87'),'MIN':_0x4172('0x57'),'AVG':_0x4172('0x88'),'GROUP_CONCAT':_0x4172('0x58'),'GROUP_CONCAT ASC':_0x4172('0x59'),'GROUP_CONCAT DESC':_0x4172('0x5a')};var _0x1a4289={'SEC_TO_TIME':_0x4172('0x89'),'DATE':_0x4172('0x5b'),'HOUR':_0x4172('0x8a'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4172('0x5d')};var _0x1f974e=function(_0x552d39){return!_[_0x4172('0x5e')](['IS\x20NULL',_0x4172('0x60'),_0x4172('0x61'),_0x4172('0x62')],_0x552d39);};var _0x163ace=function(_0x39de52){if(!_0x39de52||!_0x39de52['rules'][_0x4172('0x37')]){return'';}for(var _0x4d61c2='(',_0x444c63=0x0;_0x444c63<_0x39de52[_0x4172('0x63')][_0x4172('0x37')];_0x444c63+=0x1){_0x444c63>0x0&&(_0x4d61c2+='\x20'+_0x39de52[_0x4172('0x64')]+'\x20');_0x4d61c2+=_0x39de52[_0x4172('0x63')][_0x444c63][_0x4172('0x65')]?_0x163ace(_0x39de52[_0x4172('0x63')][_0x444c63][_0x4172('0x65')]):_0x39de52[_0x4172('0x63')][_0x444c63][_0x4172('0x66')]+'\x20'+_0x39de52[_0x4172('0x63')][_0x444c63][_0x4172('0x67')]+(_0x1f974e(_0x39de52[_0x4172('0x63')][_0x444c63][_0x4172('0x67')])?'\x20'+_0x39de52[_0x4172('0x63')][_0x444c63][_0x4172('0x68')]:'');}return _0x4d61c2+')';};var _0x59f033={'where':{'id':_0x26f11a['id']}},_0x42a59d,_0x3fbbae,_0x14df14,_0x80e2fc,_0x4d0505;_0x59f033=_['merge']({},_0x59f033,_0x5a596c);return db['AnalyticCustomReport'][_0x4172('0x4f')](_0x59f033)[_0x4172('0x25')](function(_0x201eb6){if(_0x201eb6){_0x42a59d=_0x201eb6;return _0x201eb6['getFields']();}return null;})[_0x4172('0x25')](function(_0x7f8624){if(_0x7f8624){if(!_0x7f8624['length']){throw new db[(_0x4172('0x8b'))]['ValidationErrorItem'](_0x4172('0x8c'),0x193);}_0x3fbbae=_0x7f8624;return db[_0x4172('0x6a')][_0x4172('0x45')]({'raw':!![]});}return null;})['then'](function(_0x3a7264){if(_0x3a7264){_0x14df14=_[_0x4172('0x6b')](_0x3a7264,'id');var _0x2b57e9;var _0x47b6df=squel[_0x4172('0x8d')]();_0x47b6df['from'](_0x42a59d[_0x4172('0x7b')]);for(var _0x2a1e7f=0x0;_0x2a1e7f<_0x3fbbae[_0x4172('0x37')];_0x2a1e7f+=0x1){_0x2b57e9=_0x3fbbae[_0x2a1e7f][_0x4172('0x6d')]?_0x14df14[_0x3fbbae[_0x2a1e7f][_0x4172('0x6d')]][_0x4172('0x8e')]:_0x3fbbae[_0x2a1e7f]['field'];_0x2b57e9=_0x3fbbae[_0x2a1e7f][_0x4172('0x6e')]?_['replace'](_0x1b8355[_0x3fbbae[_0x2a1e7f]['function']],'%s',_0x2b57e9):_0x2b57e9;_0x2b57e9=_0x3fbbae[_0x2a1e7f]['format']?_[_0x4172('0x6f')](_0x1a4289[_0x3fbbae[_0x2a1e7f][_0x4172('0x70')]],'%s',_0x2b57e9):_0x2b57e9;if(_0x3fbbae[_0x2a1e7f][_0x4172('0x71')]){_0x47b6df['group'](_0x2b57e9);}_0x3fbbae[_0x2a1e7f][_0x4172('0x72')]&&_0x47b6df[_0x4172('0x3a')](_0x2b57e9,_0x3fbbae[_0x2a1e7f][_0x4172('0x72')]===_0x4172('0x73')?![]:!![]);_0x47b6df[_0x4172('0x66')](_0x2b57e9,_0x3fbbae[_0x2a1e7f][_0x4172('0x74')]||_0x2b57e9);}if(_0x42a59d[_0x4172('0x76')]){_0x42a59d[_0x4172('0x76')]=JSON[_0x4172('0x75')](_0x42a59d[_0x4172('0x76')]);for(var _0xde2803=0x0;_0xde2803<_0x42a59d[_0x4172('0x76')][_0x4172('0x37')];_0xde2803+=0x1){if(_0x42a59d[_0x4172('0x76')][_0xde2803][_0x4172('0x30')]&&_['includes'](_0xd3010b,_0x42a59d[_0x4172('0x76')][_0xde2803][_0x4172('0x30')])&&_0x42a59d[_0x4172('0x76')][_0xde2803][_0x4172('0x77')]&&_0x42a59d['joins'][_0xde2803][_0x4172('0x79')]&&_0x42a59d[_0x4172('0x76')][_0xde2803][_0x4172('0x78')]){_0x47b6df[_0x42a59d['joins'][_0xde2803][_0x4172('0x30')]](_0x42a59d[_0x4172('0x76')][_0xde2803][_0x4172('0x79')],null,util[_0x4172('0x70')]('%s.%s\x20=\x20%s.%s',_0x42a59d[_0x4172('0x7b')],_0x42a59d[_0x4172('0x76')][_0xde2803]['parentKey'],_0x42a59d[_0x4172('0x76')][_0xde2803]['foreignTable'],_0x42a59d[_0x4172('0x76')][_0xde2803]['foreignKey']));}}}if(_0x42a59d['conditions']){_0x42a59d['conditions']=JSON[_0x4172('0x75')](_0x42a59d['conditions']);_0x47b6df[_0x4172('0x3c')](_0x163ace(_0x42a59d['conditions']['group']));}_0x4d0505=_0x47b6df['clone']();_0x47b6df['limit'](_0x5f4a0b);_0x47b6df[_0x4172('0x21')](0x0);return;}})[_0x4172('0x25')](function(){if(_0x5ca8b5[_0x4172('0x8f')]===_0x4172('0x90')){return null;}var _0x317859=_[_0x4172('0x3e')](_0x5ca8b5,{'name':_0x5ca8b5[_0x4172('0x91')]||_0x5ca8b5[_0x4172('0x2d')]||_0x42a59d[_0x4172('0x2d')],'basename':_0x570484,'savename':util[_0x4172('0x70')](_0x4172('0x92'),_0x5ca8b5['name']||_0x42a59d[_0x4172('0x2d')],require(_0x4172('0x93'))['generate'](0x4),_0x5ca8b5[_0x4172('0x8f')]||_0x4172('0x94')),'reportId':_0x42a59d['id'],'reportType':_0x4172('0x95')});return db[_0x4172('0x96')][_0x4172('0x4a')](_0x317859,{'raw':!![]});})[_0x4172('0x25')](function(_0x4c9273){if(_0x42a59d[_0x4172('0x7b')]===_0x4172('0x97')){_0x4d0505[_0x4172('0x3c')](_0x42a59d['table']+_0x4172('0x98'),_0x5ca8b5['startDate'],_0x5ca8b5[_0x4172('0x99')]);}else{_0x4d0505['where'](_0x42a59d['table']+_0x4172('0x9a'),_0x5ca8b5[_0x4172('0x9b')],_0x5ca8b5[_0x4172('0x99')]);}if(_0x4c9273){logger['info'](_0x4172('0x9c'),_0x4d0505['toString']());require('child_process')['fork'](path[_0x4172('0x54')](__dirname,_0x4172('0x9d'),_0x4c9273[_0x4172('0x8f')]),[_0x4c9273['id'],_0x4d0505['toString'](),path['join'](__dirname,_0x4172('0x9e'),_0x4c9273[_0x4172('0x9f')]),_0x570484]);return _0x4c9273;}else{var _0x2f6173=squel[_0x4172('0x8d')]();_0x2f6173[_0x4172('0x6c')]('('+_0x4d0505['toString']()+')','countTable');_0x2f6173[_0x4172('0x66')](_0x4172('0xa0'),_0x4172('0x20'));_0x4d0505[_0x4172('0x1f')](_0x5ca8b5[_0x4172('0x1f')]||_0x5f4a0b);_0x4d0505[_0x4172('0x21')](_0x5ca8b5[_0x4172('0x21')]||0x0);return dbH['sequelize'][_0x4172('0x32')](_0x2f6173[_0x4172('0x7f')](),{'type':dbH[_0x4172('0x80')][_0x4172('0x81')][_0x4172('0x82')]})[_0x4172('0x25')](function(_0x405438){if(!_0x405438[_0x4172('0x37')]){_0x80e2fc=0x0;}else{_0x80e2fc=_0x405438[0x0]['count']||0x0;}return dbH[_0x4172('0x80')][_0x4172('0x32')](_0x4d0505[_0x4172('0x7f')](),{'type':dbH[_0x4172('0x80')][_0x4172('0x81')][_0x4172('0x82')]});})[_0x4172('0x25')](function(_0x19bf7b){return{'rows':_0x19bf7b||[],'count':_0x80e2fc};});}});}exports['run']=function(_0x5c30ac,_0x13ce1a){return runReport(_0x5c30ac[_0x4172('0x46')],_0x5c30ac[_0x4172('0x32')],_0x5c30ac[_0x4172('0x41')])[_0x4172('0x25')](respondWithResult(_0x13ce1a,null))[_0x4172('0x49')](handleError(_0x13ce1a,null));};exports['runReport']=runReport;exports['query']=function(_0x1c3236,_0x2dba19){var _0x1d4e30=0xa;var _0x42039d=[_0x4172('0x54'),_0x4172('0x83'),_0x4172('0x55'),_0x4172('0x84')];var _0x1a6172={'SUM':_0x4172('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x4172('0x87'),'MIN':_0x4172('0x57'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4172('0x58'),'GROUP_CONCAT ASC':_0x4172('0x59'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x9b9012={'SEC_TO_TIME':_0x4172('0x89'),'DATE':_0x4172('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0x4172('0x5c'),'UNIX_TIMESTAMP':_0x4172('0x5d')};var _0x33173e=function(_0x790af4){return!_[_0x4172('0x5e')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x4172('0x61'),_0x4172('0x62')],_0x790af4);};var _0x401456=function(_0x465ac7){if(!_0x465ac7||!_0x465ac7[_0x4172('0x63')]['length']){return'';}for(var _0x2aa463='(',_0x4f286a=0x0;_0x4f286a<_0x465ac7[_0x4172('0x63')][_0x4172('0x37')];_0x4f286a+=0x1){_0x4f286a>0x0&&(_0x2aa463+='\x20'+_0x465ac7[_0x4172('0x64')]+'\x20');_0x2aa463+=_0x465ac7['rules'][_0x4f286a][_0x4172('0x65')]?_0x401456(_0x465ac7[_0x4172('0x63')][_0x4f286a]['group']):_0x465ac7[_0x4172('0x63')][_0x4f286a]['field']+'\x20'+_0x465ac7[_0x4172('0x63')][_0x4f286a][_0x4172('0x67')]+(_0x33173e(_0x465ac7[_0x4172('0x63')][_0x4f286a][_0x4172('0x67')])?'\x20'+_0x465ac7[_0x4172('0x63')][_0x4f286a][_0x4172('0x68')]:'');}return _0x2aa463+')';};var _0x448196={'where':{'id':_0x1c3236['params']['id']}},_0x30547d,_0x56d99c,_0x43ea70,_0xef1cd4,_0x729cd7;_0x448196=_[_0x4172('0x3e')]({},_0x448196,_0x1c3236[_0x4172('0x41')]);return db[_0x4172('0x42')][_0x4172('0x4f')](_0x448196)[_0x4172('0x25')](function(_0x1ef1b9){if(_0x1ef1b9){_0x30547d=_0x1ef1b9;return _0x1ef1b9[_0x4172('0xa1')]();}return null;})[_0x4172('0x25')](function(_0x5b03e8){if(_0x5b03e8){if(!_0x5b03e8[_0x4172('0x37')]){throw new db[(_0x4172('0x8b'))][(_0x4172('0x69'))](_0x4172('0x8c'),0x193);}_0x56d99c=_0x5b03e8;return db[_0x4172('0x6a')][_0x4172('0x45')]({'raw':!![]});}return null;})[_0x4172('0x25')](function(_0x3fdcba){if(_0x3fdcba){_0x43ea70=_['keyBy'](_0x3fdcba,'id');var _0x44c1b7;var _0x47e9bd=squel['select']();_0x47e9bd[_0x4172('0x6c')](_0x30547d[_0x4172('0x7b')]);for(var _0x16aaaf=0x0;_0x16aaaf<_0x56d99c[_0x4172('0x37')];_0x16aaaf+=0x1){_0x44c1b7=_0x56d99c[_0x16aaaf][_0x4172('0x6d')]?_0x43ea70[_0x56d99c[_0x16aaaf][_0x4172('0x6d')]][_0x4172('0x8e')]:_0x56d99c[_0x16aaaf][_0x4172('0x66')];_0x44c1b7=_0x56d99c[_0x16aaaf]['function']?_['replace'](_0x1a6172[_0x56d99c[_0x16aaaf][_0x4172('0x6e')]],'%s',_0x44c1b7):_0x44c1b7;_0x44c1b7=_0x56d99c[_0x16aaaf][_0x4172('0x70')]?_[_0x4172('0x6f')](_0x9b9012[_0x56d99c[_0x16aaaf][_0x4172('0x70')]],'%s',_0x44c1b7):_0x44c1b7;if(_0x56d99c[_0x16aaaf]['groupBy']){_0x47e9bd['group'](_0x44c1b7);}_0x56d99c[_0x16aaaf]['orderBy']&&_0x47e9bd[_0x4172('0x3a')](_0x44c1b7,_0x56d99c[_0x16aaaf][_0x4172('0x72')]===_0x4172('0x73')?![]:!![]);_0x47e9bd[_0x4172('0x66')](_0x44c1b7,_0x56d99c[_0x16aaaf][_0x4172('0x74')]||_0x44c1b7);}if(_0x30547d['joins']){_0x30547d['joins']=JSON[_0x4172('0x75')](_0x30547d[_0x4172('0x76')]);for(var _0x22d006=0x0;_0x22d006<_0x30547d[_0x4172('0x76')][_0x4172('0x37')];_0x22d006+=0x1){if(_0x30547d[_0x4172('0x76')][_0x22d006][_0x4172('0x30')]&&_[_0x4172('0x5e')](_0x42039d,_0x30547d[_0x4172('0x76')][_0x22d006][_0x4172('0x30')])&&_0x30547d[_0x4172('0x76')][_0x22d006][_0x4172('0x77')]&&_0x30547d[_0x4172('0x76')][_0x22d006]['foreignTable']&&_0x30547d[_0x4172('0x76')][_0x22d006][_0x4172('0x78')]){_0x47e9bd[_0x30547d['joins'][_0x22d006][_0x4172('0x30')]](_0x30547d[_0x4172('0x76')][_0x22d006][_0x4172('0x79')],null,util['format'](_0x4172('0x7a'),_0x30547d[_0x4172('0x7b')],_0x30547d[_0x4172('0x76')][_0x22d006][_0x4172('0x77')],_0x30547d[_0x4172('0x76')][_0x22d006][_0x4172('0x79')],_0x30547d[_0x4172('0x76')][_0x22d006][_0x4172('0x78')]));}}}if(_0x30547d['conditions']){_0x30547d[_0x4172('0x7c')]=JSON[_0x4172('0x75')](_0x30547d[_0x4172('0x7c')]);_0x47e9bd[_0x4172('0x3c')](_0x401456(_0x30547d['conditions']['group']));}_0x729cd7=_0x47e9bd[_0x4172('0x7d')]();_0x47e9bd[_0x4172('0x1f')](_0x1d4e30);_0x47e9bd[_0x4172('0x21')](0x0);logger[_0x4172('0xa2')]('Limited\x20Query:',_0x47e9bd[_0x4172('0x7f')]());return dbH[_0x4172('0x80')][_0x4172('0x32')](_0x47e9bd[_0x4172('0x7f')](),{'type':dbH[_0x4172('0x80')][_0x4172('0x81')][_0x4172('0x82')]});}})['then'](function(){return{'sql':_0x729cd7[_0x4172('0x7f')]()};})['then'](respondWithResult(_0x2dba19,null))[_0x4172('0x49')](handleError(_0x2dba19,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 28c51f3..4a4eaf4 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 _0xbeab=['../../config/logger','api','bluebird','path','../../config/environment','exports','define','analytics_custom_reports','lodash','util'];(function(_0x23d521,_0x5aaab6){var _0x13ed95=function(_0x5d6874){while(--_0x5d6874){_0x23d521['push'](_0x23d521['shift']());}};_0x13ed95(++_0x5aaab6);}(_0xbeab,0x198));var _0xbbea=function(_0x3dad23,_0x2a41b5){_0x3dad23=_0x3dad23-0x0;var _0x24b0cb=_0xbeab[_0x3dad23];return _0x24b0cb;};'use strict';var _=require(_0xbbea('0x0'));var util=require(_0xbbea('0x1'));var logger=require(_0xbbea('0x2'))(_0xbbea('0x3'));var moment=require('moment');var BPromise=require(_0xbbea('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbbea('0x5'));var rimraf=require('rimraf');var config=require(_0xbbea('0x6'));var attributes=require('./analyticCustomReport.attributes');module[_0xbbea('0x7')]=function(_0x1d302b,_0x54c899){return _0x1d302b[_0xbbea('0x8')]('AnalyticCustomReport',attributes,{'tableName':_0xbbea('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2800=['request-promise','rimraf','exports','define','AnalyticCustomReport','analytics_custom_reports','util','../../config/logger','moment','bluebird'];(function(_0x267446,_0x12abbb){var _0x19a3dc=function(_0x308966){while(--_0x308966){_0x267446['push'](_0x267446['shift']());}};_0x19a3dc(++_0x12abbb);}(_0x2800,0xba));var _0x0280=function(_0x531822,_0x15c292){_0x531822=_0x531822-0x0;var _0x455533=_0x2800[_0x531822];return _0x455533;};'use strict';var _=require('lodash');var util=require(_0x0280('0x0'));var logger=require(_0x0280('0x1'))('api');var moment=require(_0x0280('0x2'));var BPromise=require(_0x0280('0x3'));var rp=require(_0x0280('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0280('0x5'));var config=require('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module[_0x0280('0x6')]=function(_0x75a1ec,_0x3c05b9){return _0x75a1ec[_0x0280('0x7')](_0x0280('0x8'),attributes,{'tableName':_0x0280('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 19f07aa..408065a 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 _0x56db=['stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s'];(function(_0x36e0ef,_0x310e21){var _0x35d366=function(_0x461cbf){while(--_0x461cbf){_0x36e0ef['push'](_0x36e0ef['shift']());}};_0x35d366(++_0x310e21);}(_0x56db,0xed));var _0xb56d=function(_0x2d873a,_0x4656a0){_0x2d873a=_0x2d873a-0x0;var _0x4e45b9=_0x56db[_0x2d873a];return _0x4e45b9;};'use strict';var _=require(_0xb56d('0x0'));var util=require(_0xb56d('0x1'));var moment=require(_0xb56d('0x2'));var BPromise=require(_0xb56d('0x3'));var rs=require(_0xb56d('0x4'));var fs=require('fs');var Redis=require(_0xb56d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb56d('0x6'));var logger=require('../../config/logger')(_0xb56d('0x7'));var config=require(_0xb56d('0x8'));var jayson=require(_0xb56d('0x9'));var client=jayson['client'][_0xb56d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ebcca,_0x2b29e3,_0x1f665b){return new BPromise(function(_0x4fd914,_0x3a5491){return client['request'](_0x5ebcca,_0x1f665b)[_0xb56d('0xb')](function(_0x205623){logger['info'](_0xb56d('0xc'),_0x2b29e3,_0xb56d('0xd'));logger[_0xb56d('0xe')](_0xb56d('0xf'),_0x2b29e3,_0xb56d('0xd'),JSON[_0xb56d('0x10')](_0x205623));if(_0x205623[_0xb56d('0x11')]){if(_0x205623['error'][_0xb56d('0x12')]===0x1f4){logger[_0xb56d('0x11')](_0xb56d('0xc'),_0x2b29e3,_0x205623[_0xb56d('0x11')][_0xb56d('0x13')]);return _0x3a5491(_0x205623['error'][_0xb56d('0x13')]);}logger[_0xb56d('0x11')](_0xb56d('0xc'),_0x2b29e3,_0x205623[_0xb56d('0x11')][_0xb56d('0x13')]);return _0x4fd914(_0x205623[_0xb56d('0x11')][_0xb56d('0x13')]);}else{logger[_0xb56d('0x14')](_0xb56d('0xc'),_0x2b29e3,_0xb56d('0xd'));_0x4fd914(_0x205623[_0xb56d('0x15')][_0xb56d('0x13')]);}})[_0xb56d('0x16')](function(_0x477dd7){logger[_0xb56d('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x2b29e3,_0x477dd7);_0x3a5491(_0x477dd7);});});} \ No newline at end of file +var _0xed89=['jayson/promise','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x3a1dec,_0x1f943f){var _0x60ede0=function(_0x285fd5){while(--_0x285fd5){_0x3a1dec['push'](_0x3a1dec['shift']());}};_0x60ede0(++_0x1f943f);}(_0xed89,0x140));var _0x9ed8=function(_0x5b0f9c,_0x11b8a5){_0x5b0f9c=_0x5b0f9c-0x0;var _0x265bc3=_0xed89[_0x5b0f9c];return _0x265bc3;};'use strict';var _=require(_0x9ed8('0x0'));var util=require(_0x9ed8('0x1'));var moment=require(_0x9ed8('0x2'));var BPromise=require(_0x9ed8('0x3'));var rs=require(_0x9ed8('0x4'));var fs=require('fs');var Redis=require(_0x9ed8('0x5'));var db=require(_0x9ed8('0x6'))['db'];var utils=require(_0x9ed8('0x7'));var logger=require('../../config/logger')(_0x9ed8('0x8'));var config=require(_0x9ed8('0x9'));var jayson=require(_0x9ed8('0xa'));var client=jayson['client'][_0x9ed8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c0ead,_0x51b64a,_0x336ed0){return new BPromise(function(_0x19a7d7,_0x3df7dd){return client[_0x9ed8('0xc')](_0x1c0ead,_0x336ed0)[_0x9ed8('0xd')](function(_0x539420){logger['info'](_0x9ed8('0xe'),_0x51b64a,_0x9ed8('0xf'));logger[_0x9ed8('0x10')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x51b64a,_0x9ed8('0xf'),JSON['stringify'](_0x539420));if(_0x539420[_0x9ed8('0x11')]){if(_0x539420['error'][_0x9ed8('0x12')]===0x1f4){logger[_0x9ed8('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x51b64a,_0x539420[_0x9ed8('0x11')][_0x9ed8('0x13')]);return _0x3df7dd(_0x539420['error'][_0x9ed8('0x13')]);}logger[_0x9ed8('0x11')](_0x9ed8('0xe'),_0x51b64a,_0x539420[_0x9ed8('0x11')]['message']);return _0x19a7d7(_0x539420[_0x9ed8('0x11')][_0x9ed8('0x13')]);}else{logger[_0x9ed8('0x14')](_0x9ed8('0xe'),_0x51b64a,_0x9ed8('0xf'));_0x19a7d7(_0x539420[_0x9ed8('0x15')]['message']);}})['catch'](function(_0x577b13){logger[_0x9ed8('0x11')](_0x9ed8('0xe'),_0x51b64a,_0x577b13);_0x3df7dd(_0x577b13);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 7406e45..5af133d 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 _0xa64e=['../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','create','put','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x26b1ff,_0x4dea7c){var _0x502074=function(_0x54731a){while(--_0x54731a){_0x26b1ff['push'](_0x26b1ff['shift']());}};_0x502074(++_0x4dea7c);}(_0xa64e,0x131));var _0xea64=function(_0x211b80,_0x5cb5fa){_0x211b80=_0x211b80-0x0;var _0x1c3037=_0xa64e[_0x211b80];return _0x1c3037;};'use strict';var multer=require('multer');var util=require(_0xea64('0x0'));var path=require(_0xea64('0x1'));var timeout=require(_0xea64('0x2'));var express=require(_0xea64('0x3'));var router=express[_0xea64('0x4')]();var fs_extra=require(_0xea64('0x5'));var auth=require(_0xea64('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xea64('0x7'));var controller=require(_0xea64('0x8'));router[_0xea64('0x9')]('/',auth[_0xea64('0xa')](),controller[_0xea64('0xb')]);router[_0xea64('0x9')](_0xea64('0xc'),auth[_0xea64('0xa')](),controller[_0xea64('0xd')]);router['get'](_0xea64('0xe'),auth['isAuthenticated'](),controller[_0xea64('0xf')]);router[_0xea64('0x9')](_0xea64('0x10'),auth[_0xea64('0xa')](),controller[_0xea64('0x11')]);router[_0xea64('0x9')](_0xea64('0x12'),auth['isAuthenticated'](),controller[_0xea64('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0xea64('0x14')]);router[_0xea64('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xea64('0x16')]);router['delete'](_0xea64('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xea64('0x17')]=router; \ No newline at end of file +var _0x2923=['update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','/:id'];(function(_0x78c164,_0x559f15){var _0x5c51e9=function(_0x5de669){while(--_0x5de669){_0x78c164['push'](_0x78c164['shift']());}};_0x5c51e9(++_0x559f15);}(_0x2923,0x19b));var _0x3292=function(_0x1be67a,_0x35bf66){_0x1be67a=_0x1be67a-0x0;var _0x42d454=_0x2923[_0x1be67a];return _0x42d454;};'use strict';var multer=require('multer');var util=require(_0x3292('0x0'));var path=require(_0x3292('0x1'));var timeout=require(_0x3292('0x2'));var express=require(_0x3292('0x3'));var router=express[_0x3292('0x4')]();var fs_extra=require(_0x3292('0x5'));var auth=require(_0x3292('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3292('0x7'));var controller=require(_0x3292('0x8'));router[_0x3292('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x3292('0xa')](),controller[_0x3292('0xb')]);router[_0x3292('0x9')](_0x3292('0xc'),auth[_0x3292('0xa')](),controller[_0x3292('0xd')]);router[_0x3292('0x9')](_0x3292('0xe'),auth['isAuthenticated'](),controller[_0x3292('0xf')]);router[_0x3292('0x9')](_0x3292('0x10'),auth[_0x3292('0xa')](),controller[_0x3292('0x11')]);router[_0x3292('0x12')]('/',auth['isAuthenticated'](),controller[_0x3292('0x13')]);router['put'](_0x3292('0x14'),auth[_0x3292('0xa')](),controller[_0x3292('0x15')]);router[_0x3292('0x16')](_0x3292('0x14'),auth[_0x3292('0xa')](),controller[_0x3292('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index e70bf2b..b66c64f 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 _0x7217=['sequelize','STRING','TEXT'];(function(_0x505457,_0x183165){var _0x596444=function(_0x1f7238){while(--_0x1f7238){_0x505457['push'](_0x505457['shift']());}};_0x596444(++_0x183165);}(_0x7217,0x19e));var _0x7721=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x7217[_0x92c450];return _0x2a9599;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'name':{'type':Sequelize[_0x7721('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7721('0x1')]},'parent':{'type':Sequelize[_0x7721('0x1')]},'table':{'type':Sequelize[_0x7721('0x1')]},'conditions':{'type':Sequelize[_0x7721('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x9c5a=['exports','STRING','TEXT','sequelize'];(function(_0x3d1246,_0x23fef1){var _0x5b5f3d=function(_0x423c74){while(--_0x423c74){_0x3d1246['push'](_0x3d1246['shift']());}};_0x5b5f3d(++_0x23fef1);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x49e536,_0x2c04e6){_0x49e536=_0x49e536-0x0;var _0x57638a=_0x9c5a[_0x49e536];return _0x57638a;};'use strict';var Sequelize=require(_0xa9c5('0x0'));module[_0xa9c5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa9c5('0x2')]},'parent':{'type':Sequelize[_0xa9c5('0x2')]},'table':{'type':Sequelize[_0xa9c5('0x2')]},'conditions':{'type':Sequelize[_0xa9c5('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index f933401..e0bec2d 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(_0x7f537e,_0x2757d3){var _0x386a50=function(_0x535748){while(--_0x535748){_0x7f537e['push'](_0x7f537e['shift']());}};_0x386a50(++_0x2757d3);}(_0x2675,0x75));var _0x5267=function(_0xebaa92,_0x5bacb2){_0xebaa92=_0xebaa92-0x0;var _0x1f2153=_0x2675[_0xebaa92];return _0x1f2153;};'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 _0xda19=['ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','field','function','replace','groupBy','orderBy','order','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','operator','Sequelize','metric','format','DESC','parse','parentKey','web','output','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','run','runReport','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','dbH','status','json','offset','undefined','limit','count','set','apply','update','then','DefaultReports','destroy','end','error','stack','name','send','map','AnalyticDefaultReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','merge','includeAll','include','findAll','show','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','condition','value','options','find','getFields'];(function(_0x46eff4,_0xeca82e){var _0x230734=function(_0xbed990){while(--_0xbed990){_0x46eff4['push'](_0x46eff4['shift']());}};_0x230734(++_0xeca82e);}(_0xda19,0xd5));var _0x9da1=function(_0x1e32c3,_0x4aec3c){_0x1e32c3=_0x1e32c3-0x0;var _0x4d295e=_0xda19[_0x1e32c3];return _0x4d295e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9da1('0x0'));var zipdir=require(_0x9da1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9da1('0x2'));var moment=require('moment');var BPromise=require(_0x9da1('0x3'));var Mustache=require('mustache');var util=require(_0x9da1('0x4'));var path=require(_0x9da1('0x5'));var sox=require(_0x9da1('0x6'));var csv=require(_0x9da1('0x7'));var ejs=require(_0x9da1('0x8'));var fs=require('fs');var fs_extra=require(_0x9da1('0x9'));var _=require(_0x9da1('0xa'));var squel=require(_0x9da1('0xb'));var crypto=require(_0x9da1('0xc'));var jsforce=require(_0x9da1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9da1('0xe'));var Redis=require('ioredis');var authService=require(_0x9da1('0xf'));var qs=require(_0x9da1('0x10'));var as=require(_0x9da1('0x11'));var hardwareService=require(_0x9da1('0x12'));var logger=require(_0x9da1('0x13'))(_0x9da1('0x14'));var utils=require(_0x9da1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9da1('0x16'))['db'];var dbH=require('../../mysqldb')[_0x9da1('0x17')];function respondWithStatusCode(_0x1d93f8,_0xd2d225){_0xd2d225=_0xd2d225||0xcc;return function(_0x1ffa2a){if(_0x1ffa2a){return _0x1d93f8['sendStatus'](_0xd2d225);}return _0x1d93f8[_0x9da1('0x18')](_0xd2d225)['end']();};}function respondWithResult(_0x4d17e1,_0x40ba9d){_0x40ba9d=_0x40ba9d||0xc8;return function(_0x479ccd){if(_0x479ccd){return _0x4d17e1[_0x9da1('0x18')](_0x40ba9d)[_0x9da1('0x19')](_0x479ccd);}};}function respondWithFilteredResult(_0x37653d,_0x1a1a6b){return function(_0x7f1a64){if(_0x7f1a64){var _0x514d8e=typeof _0x1a1a6b[_0x9da1('0x1a')]===_0x9da1('0x1b')&&typeof _0x1a1a6b[_0x9da1('0x1c')]===_0x9da1('0x1b');var _0xfb278d=_0x7f1a64[_0x9da1('0x1d')];var _0x497676=_0x514d8e?0x0:_0x1a1a6b['offset'];var _0x17205d=_0x514d8e?_0x7f1a64[_0x9da1('0x1d')]:_0x1a1a6b[_0x9da1('0x1a')]+_0x1a1a6b[_0x9da1('0x1c')];var _0x40a967;if(_0x17205d>=_0xfb278d){_0x17205d=_0xfb278d;_0x40a967=0xc8;}else{_0x40a967=0xce;}_0x37653d[_0x9da1('0x18')](_0x40a967);return _0x37653d[_0x9da1('0x1e')]('Content-Range',_0x497676+'-'+_0x17205d+'/'+_0xfb278d)[_0x9da1('0x19')](_0x7f1a64);}return null;};}function patchUpdates(_0x554845){return function(_0x9c3b37){try{jsonpatch[_0x9da1('0x1f')](_0x9c3b37,_0x554845,!![]);}catch(_0x1fc065){return BPromise['reject'](_0x1fc065);}return _0x9c3b37['save']();};}function saveUpdates(_0x14793b,_0x3e6f85){return function(_0x16ee0c){if(_0x16ee0c){return _0x16ee0c[_0x9da1('0x20')](_0x14793b)[_0x9da1('0x21')](function(_0x165b73){return _0x165b73;});}return null;};}function removeEntity(_0x4c60aa,_0x2413fe){return function(_0x3bfa40){if(_0x3bfa40){return _0x3bfa40['destroy']()[_0x9da1('0x21')](function(){var _0x3f5680=_0x3bfa40['get']({'plain':!![]});var _0x2fd49c=_0x9da1('0x22');return db['UserProfileResource'][_0x9da1('0x23')]({'where':{'type':_0x2fd49c,'resourceId':_0x3f5680['id']}})[_0x9da1('0x21')](function(){return _0x3bfa40;});})['then'](function(){_0x4c60aa['status'](0xcc)[_0x9da1('0x24')]();});}};}function handleEntityNotFound(_0x47055e,_0x5eca5b){return function(_0x27c6e2){if(!_0x27c6e2){_0x47055e['sendStatus'](0x194);}return _0x27c6e2;};}function handleError(_0x5a6f2d,_0x5a59c2){_0x5a59c2=_0x5a59c2||0x1f4;return function(_0x31b826){logger[_0x9da1('0x25')](_0x31b826[_0x9da1('0x26')]);if(_0x31b826[_0x9da1('0x27')]){delete _0x31b826[_0x9da1('0x27')];}_0x5a6f2d['status'](_0x5a59c2)[_0x9da1('0x28')](_0x31b826);};}exports['index']=function(_0x1feae0,_0x235ced){var _0x5b38b3={},_0xc29ba8={},_0x2eb48f={'count':0x0,'rows':[]};var _0x4f318b=_[_0x9da1('0x29')](db[_0x9da1('0x2a')][_0x9da1('0x2b')],function(_0x2b2b48){return{'name':_0x2b2b48['fieldName'],'type':_0x2b2b48['type'][_0x9da1('0x2c')]};});_0xc29ba8[_0x9da1('0x2d')]=_[_0x9da1('0x29')](_0x4f318b,_0x9da1('0x27'));_0xc29ba8[_0x9da1('0x2e')]=_['keys'](_0x1feae0[_0x9da1('0x2e')]);_0xc29ba8[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xc29ba8[_0x9da1('0x2d')],_0xc29ba8[_0x9da1('0x2e')]);_0x5b38b3[_0x9da1('0x31')]=_['intersection'](_0xc29ba8[_0x9da1('0x2d')],qs['fields'](_0x1feae0['query'][_0x9da1('0x32')]));_0x5b38b3['attributes']=_0x5b38b3[_0x9da1('0x31')][_0x9da1('0x33')]?_0x5b38b3[_0x9da1('0x31')]:_0xc29ba8[_0x9da1('0x2d')];if(!_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x34')](_0x9da1('0x35'))){_0x5b38b3[_0x9da1('0x1c')]=qs['limit'](_0x1feae0[_0x9da1('0x2e')]['limit']);_0x5b38b3[_0x9da1('0x1a')]=qs['offset'](_0x1feae0['query'][_0x9da1('0x1a')]);}_0x5b38b3['order']=qs[_0x9da1('0x36')](_0x1feae0[_0x9da1('0x2e')]['sort']);_0x5b38b3[_0x9da1('0x37')]=qs[_0x9da1('0x2f')](_[_0x9da1('0x38')](_0x1feae0[_0x9da1('0x2e')],_0xc29ba8['filters']),_0x4f318b);if(_0x1feae0[_0x9da1('0x2e')]['filter']){_0x5b38b3[_0x9da1('0x37')]=_['merge'](_0x5b38b3[_0x9da1('0x37')],{'$or':_[_0x9da1('0x29')](_0x4f318b,function(_0x58e165){if(_0x58e165[_0x9da1('0x39')]!==_0x9da1('0x3a')){var _0x394acf={};_0x394acf[_0x58e165['name']]={'$like':'%'+_0x1feae0['query']['filter']+'%'};return _0x394acf;}})});}_0x5b38b3=_[_0x9da1('0x3b')]({},_0x5b38b3,_0x1feae0['options']);var _0x5b215c={'where':_0x5b38b3[_0x9da1('0x37')]};return db[_0x9da1('0x2a')][_0x9da1('0x1d')](_0x5b215c)['then'](function(_0x42dbd8){_0x2eb48f[_0x9da1('0x1d')]=_0x42dbd8;if(_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x3c')]){_0x5b38b3[_0x9da1('0x3d')]=[{'all':!![]}];}return db[_0x9da1('0x2a')][_0x9da1('0x3e')](_0x5b38b3);})['then'](function(_0x467350){_0x2eb48f['rows']=_0x467350;return _0x2eb48f;})[_0x9da1('0x21')](respondWithFilteredResult(_0x235ced,_0x5b38b3))['catch'](handleError(_0x235ced,null));};exports[_0x9da1('0x3f')]=function(_0x40d848,_0x599211){var _0x265366={'raw':!![],'where':{'id':_0x40d848['params']['id']}},_0xfeec5f={};_0xfeec5f[_0x9da1('0x2d')]=_['keys'](db[_0x9da1('0x2a')][_0x9da1('0x2b')]);_0xfeec5f['query']=_['keys'](_0x40d848[_0x9da1('0x2e')]);_0xfeec5f[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],_0xfeec5f[_0x9da1('0x2e')]);_0x265366[_0x9da1('0x31')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],qs['fields'](_0x40d848[_0x9da1('0x2e')][_0x9da1('0x32')]));_0x265366[_0x9da1('0x31')]=_0x265366['attributes'][_0x9da1('0x33')]?_0x265366[_0x9da1('0x31')]:_0xfeec5f[_0x9da1('0x2d')];if(_0x40d848['query'][_0x9da1('0x3c')]){_0x265366[_0x9da1('0x3d')]=[{'all':!![]}];}_0x265366=_[_0x9da1('0x3b')]({},_0x265366,_0x40d848['options']);return db[_0x9da1('0x2a')]['find'](_0x265366)['then'](handleEntityNotFound(_0x599211,null))[_0x9da1('0x21')](respondWithResult(_0x599211,null))[_0x9da1('0x40')](handleError(_0x599211,null));};exports['create']=function(_0x712d10,_0x2066d2){return db['AnalyticDefaultReport'][_0x9da1('0x41')](_0x712d10[_0x9da1('0x42')],{})[_0x9da1('0x21')](function(_0x3a529d){var _0x4780ca=_0x712d10[_0x9da1('0x43')][_0x9da1('0x44')]({'plain':!![]});if(!_0x4780ca)throw new Error(_0x9da1('0x45'));if(_0x4780ca[_0x9da1('0x46')]==='user'){var _0x147c65=_0x3a529d[_0x9da1('0x44')]({'plain':!![]});var _0x34a203=_0x9da1('0x47');return db['UserProfileSection']['find']({'where':{'name':_0x34a203,'userProfileId':_0x4780ca[_0x9da1('0x48')]},'raw':!![]})[_0x9da1('0x21')](function(_0x3870dd){if(_0x3870dd&&_0x3870dd[_0x9da1('0x49')]===0x0){return db[_0x9da1('0x4a')][_0x9da1('0x41')]({'name':_0x147c65[_0x9da1('0x27')],'resourceId':_0x147c65['id'],'type':_0x9da1('0x22'),'sectionId':_0x3870dd['id']},{})[_0x9da1('0x21')](function(){return _0x3a529d;});}else{return _0x3a529d;}})[_0x9da1('0x40')](function(_0x868167){logger[_0x9da1('0x25')](_0x9da1('0x4b'),_0x868167);throw _0x868167;});}return _0x3a529d;})[_0x9da1('0x21')](respondWithResult(_0x2066d2,0xc9))['catch'](handleError(_0x2066d2,null));};exports[_0x9da1('0x20')]=function(_0x1fbb5d,_0x4d241a){if(_0x1fbb5d[_0x9da1('0x42')]['id']){delete _0x1fbb5d['body']['id'];}return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x1fbb5d[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x4d241a,null))[_0x9da1('0x21')](saveUpdates(_0x1fbb5d[_0x9da1('0x42')],null))[_0x9da1('0x21')](respondWithResult(_0x4d241a,null))[_0x9da1('0x40')](handleError(_0x4d241a,null));};exports[_0x9da1('0x23')]=function(_0x343b05,_0x170351){return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x343b05[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x170351,null))[_0x9da1('0x21')](removeEntity(_0x170351,null))[_0x9da1('0x40')](handleError(_0x170351,null));};exports[_0x9da1('0x4d')]=function(_0x4607a9,_0x2020d0){var _0x3c01c3=0xa;var _0xfa8d3f=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),_0x9da1('0x50')];var _0x5bda2a={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0xc27b00={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x27ac84=function(_0x10ebc9){return!_[_0x9da1('0x5c')]([_0x9da1('0x5d'),_0x9da1('0x5e'),_0x9da1('0x5f'),'IS\x20NOT\x20EMPTY'],_0x10ebc9);};var _0x5f5dc2=function(_0x454a68){if(!_0x454a68||!_0x454a68['rules']['length']){return'';}for(var _0x5b4a05='(',_0x6f86c3=0x0;_0x6f86c3<_0x454a68['rules'][_0x9da1('0x33')];_0x6f86c3+=0x1){_0x6f86c3>0x0&&(_0x5b4a05+='\x20'+_0x454a68['operator']+'\x20');_0x5b4a05+=_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x61')]?_0x5f5dc2(_0x454a68['rules'][_0x6f86c3][_0x9da1('0x61')]):_0x454a68[_0x9da1('0x60')][_0x6f86c3]['field']+'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x62')]+(_0x27ac84(_0x454a68['rules'][_0x6f86c3]['condition'])?'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x63')]:'');}return _0x5b4a05+')';};var _0x21d00c={'where':{'id':_0x4607a9['params']['id']}},_0x3ca531,_0x236b01,_0x44d7fe,_0x5cb102,_0x3d2c25;_0x21d00c=_['merge']({},_0x21d00c,_0x4607a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0x21d00c)[_0x9da1('0x21')](function(_0x3382b1){if(_0x3382b1){_0x3ca531=_0x3382b1;return _0x3382b1[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x1f2a4b){if(_0x1f2a4b){if(!_0x1f2a4b[_0x9da1('0x33')]){throw new db['Sequelize'][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x236b01=_0x1f2a4b;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x491fcb){if(_0x491fcb){_0x44d7fe=_[_0x9da1('0x6a')](_0x491fcb,'id');var _0x13fadd;var _0x419f78=squel[_0x9da1('0x6b')]();_0x419f78[_0x9da1('0x6c')](_0x3ca531[_0x9da1('0x6d')]);for(var _0x55a6d2=0x0;_0x55a6d2<_0x236b01[_0x9da1('0x33')];_0x55a6d2+=0x1){_0x13fadd=_0x236b01[_0x55a6d2]['MetricId']?_0x44d7fe[_0x236b01[_0x55a6d2][_0x9da1('0x6e')]]['metric']:_0x236b01[_0x55a6d2][_0x9da1('0x6f')];_0x13fadd=_0x236b01[_0x55a6d2][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x5bda2a[_0x236b01[_0x55a6d2][_0x9da1('0x70')]],'%s',_0x13fadd):_0x13fadd;_0x13fadd=_0x236b01[_0x55a6d2]['format']?_['replace'](_0xc27b00[_0x236b01[_0x55a6d2]['format']],'%s',_0x13fadd):_0x13fadd;if(_0x236b01[_0x55a6d2][_0x9da1('0x72')]){_0x419f78[_0x9da1('0x61')](_0x13fadd);}_0x236b01[_0x55a6d2][_0x9da1('0x73')]&&_0x419f78[_0x9da1('0x74')](_0x13fadd,_0x236b01[_0x55a6d2]['orderBy']==='DESC'?![]:!![]);_0x419f78[_0x9da1('0x6f')](_0x13fadd,_0x236b01[_0x55a6d2][_0x9da1('0x75')]||_0x13fadd);}if(_0x3ca531[_0x9da1('0x76')]){_0x3ca531['joins']=JSON['parse'](_0x3ca531[_0x9da1('0x76')]);for(var _0x1deb93=0x0;_0x1deb93<_0x3ca531[_0x9da1('0x76')]['length'];_0x1deb93+=0x1){if(_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0xfa8d3f,_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x39')])&&_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey']&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')]&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x78')]){_0x419f78[_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]](_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0x3ca531[_0x9da1('0x6d')],_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey'],_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],_0x3ca531['joins'][_0x1deb93][_0x9da1('0x78')]));}}}if(_0x3ca531['conditions']){_0x3ca531[_0x9da1('0x7a')]=JSON['parse'](_0x3ca531[_0x9da1('0x7a')]);_0x419f78[_0x9da1('0x37')](_0x5f5dc2(_0x3ca531[_0x9da1('0x7a')][_0x9da1('0x61')]));}_0x3d2c25=_0x419f78[_0x9da1('0x7b')]();_0x419f78[_0x9da1('0x1c')](_0x3c01c3);_0x419f78[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x419f78[_0x9da1('0x7e')]());return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x419f78[_0x9da1('0x7e')](),{'type':dbH['sequelize'][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](respondWithResult(_0x2020d0,null))[_0x9da1('0x40')](handleError(_0x2020d0,null));};function runReport(_0x162597,_0x4f39bc,_0x1ca102){var _0x2eb5e6=_0x4f39bc['name'];var _0x4a4cda=0xa;var _0x84f8d8=[_0x9da1('0x4e'),_0x9da1('0x82'),_0x9da1('0x4f'),_0x9da1('0x50')];var _0x4701b3={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x3a0a84={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':_0x9da1('0x83'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9da1('0x84')};var _0x354c5a=function(_0x53ab6a){return!_[_0x9da1('0x5c')](['IS\x20NULL',_0x9da1('0x5e'),'IS\x20EMPTY',_0x9da1('0x85')],_0x53ab6a);};var _0x106bd9=function(_0x347cb8){if(!_0x347cb8||!_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x3e331a='(',_0x1f785c=0x0;_0x1f785c<_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')];_0x1f785c+=0x1){_0x1f785c>0x0&&(_0x3e331a+='\x20'+_0x347cb8[_0x9da1('0x86')]+'\x20');_0x3e331a+=_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x61')]?_0x106bd9(_0x347cb8['rules'][_0x1f785c][_0x9da1('0x61')]):_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x6f')]+'\x20'+_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x62')]+(_0x354c5a(_0x347cb8[_0x9da1('0x60')][_0x1f785c]['condition'])?'\x20'+_0x347cb8['rules'][_0x1f785c][_0x9da1('0x63')]:'');}return _0x3e331a+')';};var _0xdecc82={'where':{'id':_0x162597['id']}},_0xe12dd7,_0x4cd85f,_0x4bf74c,_0x28335d,_0x175b4b;_0xdecc82=_[_0x9da1('0x3b')]({},_0xdecc82,_0x1ca102);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xdecc82)[_0x9da1('0x21')](function(_0x5561f0){if(_0x5561f0){_0xe12dd7=_0x5561f0;return _0x5561f0[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x5a64fd){if(_0x5a64fd){if(!_0x5a64fd['length']){throw new db[(_0x9da1('0x87'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4cd85f=_0x5a64fd;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x18ae08){if(_0x18ae08){_0x4bf74c=_[_0x9da1('0x6a')](_0x18ae08,'id');var _0x30065d;var _0x40a2ef=squel[_0x9da1('0x6b')]();_0x40a2ef['from'](_0xe12dd7['table']);for(var _0xd10ba4=0x0;_0xd10ba4<_0x4cd85f[_0x9da1('0x33')];_0xd10ba4+=0x1){_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]?_0x4bf74c[_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]][_0x9da1('0x88')]:_0x4cd85f[_0xd10ba4][_0x9da1('0x6f')];_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x4701b3[_0x4cd85f[_0xd10ba4]['function']],'%s',_0x30065d):_0x30065d;_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]?_['replace'](_0x3a0a84[_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]],'%s',_0x30065d):_0x30065d;if(_0x4cd85f[_0xd10ba4][_0x9da1('0x72')]){_0x40a2ef[_0x9da1('0x61')](_0x30065d);}_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]&&_0x40a2ef[_0x9da1('0x74')](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]===_0x9da1('0x8a')?![]:!![]);_0x40a2ef['field'](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x75')]||_0x30065d);}if(_0xe12dd7['joins']){_0xe12dd7[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0xe12dd7[_0x9da1('0x76')]);for(var _0x22b679=0x0;_0x22b679<_0xe12dd7['joins'][_0x9da1('0x33')];_0x22b679+=0x1){if(_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0x84f8d8,_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')])&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]){_0x40a2ef[_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]](_0xe12dd7['joins'][_0x22b679][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0xe12dd7['table'],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]));}}}if(_0xe12dd7[_0x9da1('0x7a')]){_0xe12dd7[_0x9da1('0x7a')]=JSON['parse'](_0xe12dd7[_0x9da1('0x7a')]);_0x40a2ef[_0x9da1('0x37')](_0x106bd9(_0xe12dd7['conditions'][_0x9da1('0x61')]));}_0x175b4b=_0x40a2ef[_0x9da1('0x7b')]();_0x40a2ef[_0x9da1('0x1c')](_0x4a4cda);_0x40a2ef['offset'](0x0);return;}})['then'](function(){if(_0x4f39bc['output']===_0x9da1('0x8d')){return null;}var _0x3b17aa=_[_0x9da1('0x3b')](_0x4f39bc,{'name':_0x4f39bc['fullPath']||_0x4f39bc['name']||_0xe12dd7[_0x9da1('0x27')],'basename':_0x2eb5e6,'savename':util[_0x9da1('0x89')]('%s-%s.%s',_0x4f39bc[_0x9da1('0x27')]||_0xe12dd7['name'],require('randomstring')['generate'](0x4),_0x4f39bc[_0x9da1('0x8e')]||_0x9da1('0x8f')),'reportId':_0xe12dd7['id'],'reportType':_0x9da1('0x90')});return db[_0x9da1('0x91')][_0x9da1('0x41')](_0x3b17aa,{'raw':!![]});})[_0x9da1('0x21')](function(_0x2aac99){if(_0xe12dd7[_0x9da1('0x6d')]===_0x9da1('0x92')){_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc['startDate'],_0x4f39bc['endDate']);}else{_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc[_0x9da1('0x93')],_0x4f39bc[_0x9da1('0x94')]);}if(_0x2aac99){logger[_0x9da1('0x95')](_0x9da1('0x96'),_0x175b4b[_0x9da1('0x7e')]());require(_0x9da1('0x97'))[_0x9da1('0x98')](path[_0x9da1('0x4e')](__dirname,'../../components/export/',_0x2aac99[_0x9da1('0x8e')]),[_0x2aac99['id'],_0x175b4b[_0x9da1('0x7e')](),path[_0x9da1('0x4e')](__dirname,_0x9da1('0x99'),_0x2aac99[_0x9da1('0x9a')]),_0x2eb5e6]);return _0x2aac99;}else{var _0x5ad3f8=squel[_0x9da1('0x6b')]();_0x5ad3f8['from']('('+_0x175b4b[_0x9da1('0x7e')]()+')',_0x9da1('0x9b'));_0x5ad3f8[_0x9da1('0x6f')]('COUNT(*)','count');_0x175b4b[_0x9da1('0x1c')](_0x4f39bc[_0x9da1('0x1c')]||_0x4a4cda);_0x175b4b[_0x9da1('0x1a')](_0x4f39bc['offset']||0x0);return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x5ad3f8['toString'](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')]['SELECT']})['then'](function(_0x489b3f){if(!_0x489b3f[_0x9da1('0x33')]){_0x28335d=0x0;}else{_0x28335d=_0x489b3f[0x0]['count']||0x0;}return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x175b4b[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});})['then'](function(_0x355a71){return{'rows':_0x355a71||[],'count':_0x28335d};});}});}exports[_0x9da1('0x9c')]=function(_0x492e1a,_0x449a17){return runReport(_0x492e1a[_0x9da1('0x4c')],_0x492e1a[_0x9da1('0x2e')],_0x492e1a[_0x9da1('0x64')])['then'](respondWithResult(_0x449a17,null))[_0x9da1('0x40')](handleError(_0x449a17,null));};exports[_0x9da1('0x9d')]=runReport;exports[_0x9da1('0x2e')]=function(_0x8280a9,_0x374754){var _0x1e466a=0xa;var _0x3f9133=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),'cross_join'];var _0x3dd3e0={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x52e4a6={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4aa903=function(_0x55d7f2){return!_['includes'](['IS\x20NULL',_0x9da1('0x5e'),_0x9da1('0x5f'),_0x9da1('0x85')],_0x55d7f2);};var _0x3212ad=function(_0x5ac65b){if(!_0x5ac65b||!_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x21a99d='(',_0xd19a7c=0x0;_0xd19a7c<_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')];_0xd19a7c+=0x1){_0xd19a7c>0x0&&(_0x21a99d+='\x20'+_0x5ac65b[_0x9da1('0x86')]+'\x20');_0x21a99d+=_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]?_0x3212ad(_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]):_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x6f')]+'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c]['condition']+(_0x4aa903(_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x62')])?'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x63')]:'');}return _0x21a99d+')';};var _0xb14af1={'where':{'id':_0x8280a9[_0x9da1('0x4c')]['id']}},_0x245566,_0x5b2591,_0x3c51e3,_0x54b83d,_0x23bf86;_0xb14af1=_['merge']({},_0xb14af1,_0x8280a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xb14af1)[_0x9da1('0x21')](function(_0x4bb140){if(_0x4bb140){_0x245566=_0x4bb140;return _0x4bb140[_0x9da1('0x66')]();}return null;})['then'](function(_0x47cbdd){if(_0x47cbdd){if(!_0x47cbdd['length']){throw new db[(_0x9da1('0x87'))][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x5b2591=_0x47cbdd;return db['AnalyticMetric'][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x5e1e24){if(_0x5e1e24){_0x3c51e3=_[_0x9da1('0x6a')](_0x5e1e24,'id');var _0x49ddec;var _0x407218=squel['select']();_0x407218['from'](_0x245566['table']);for(var _0x316fee=0x0;_0x316fee<_0x5b2591['length'];_0x316fee+=0x1){_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x6e')]?_0x3c51e3[_0x5b2591[_0x316fee][_0x9da1('0x6e')]]['metric']:_0x5b2591[_0x316fee]['field'];_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x70')]?_['replace'](_0x3dd3e0[_0x5b2591[_0x316fee][_0x9da1('0x70')]],'%s',_0x49ddec):_0x49ddec;_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x89')]?_['replace'](_0x52e4a6[_0x5b2591[_0x316fee]['format']],'%s',_0x49ddec):_0x49ddec;if(_0x5b2591[_0x316fee][_0x9da1('0x72')]){_0x407218[_0x9da1('0x61')](_0x49ddec);}_0x5b2591[_0x316fee][_0x9da1('0x73')]&&_0x407218[_0x9da1('0x74')](_0x49ddec,_0x5b2591[_0x316fee]['orderBy']==='DESC'?![]:!![]);_0x407218[_0x9da1('0x6f')](_0x49ddec,_0x5b2591[_0x316fee][_0x9da1('0x75')]||_0x49ddec);}if(_0x245566[_0x9da1('0x76')]){_0x245566[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0x245566['joins']);for(var _0x56ec7d=0x0;_0x56ec7d<_0x245566[_0x9da1('0x76')][_0x9da1('0x33')];_0x56ec7d+=0x1){if(_0x245566['joins'][_0x56ec7d][_0x9da1('0x39')]&&_['includes'](_0x3f9133,_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')])&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x8c')]&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')]&&_0x245566['joins'][_0x56ec7d][_0x9da1('0x78')]){_0x407218[_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')]](_0x245566[_0x9da1('0x76')][_0x56ec7d]['foreignTable'],null,util[_0x9da1('0x89')](_0x9da1('0x79'),_0x245566[_0x9da1('0x6d')],_0x245566['joins'][_0x56ec7d]['parentKey'],_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')],_0x245566['joins'][_0x56ec7d]['foreignKey']));}}}if(_0x245566[_0x9da1('0x7a')]){_0x245566[_0x9da1('0x7a')]=JSON[_0x9da1('0x8b')](_0x245566[_0x9da1('0x7a')]);_0x407218[_0x9da1('0x37')](_0x3212ad(_0x245566['conditions'][_0x9da1('0x61')]));}_0x23bf86=_0x407218['clone']();_0x407218[_0x9da1('0x1c')](_0x1e466a);_0x407218[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x407218['toString']());return dbH['sequelize'][_0x9da1('0x2e')](_0x407218[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](function(){return{'sql':_0x23bf86['toString']()};})[_0x9da1('0x21')](respondWithResult(_0x374754,null))[_0x9da1('0x40')](handleError(_0x374754,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 2317794..b945bf0 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 _0xeaf3=['./analyticDefaultReport.attributes','exports','define','analytics_default_reports','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x47e669,_0x14922f){var _0x148310=function(_0xa0718f){while(--_0xa0718f){_0x47e669['push'](_0x47e669['shift']());}};_0x148310(++_0x14922f);}(_0xeaf3,0x1e5));var _0x3eaf=function(_0xd59766,_0x8d1df1){_0xd59766=_0xd59766-0x0;var _0x5e850e=_0xeaf3[_0xd59766];return _0x5e850e;};'use strict';var _=require(_0x3eaf('0x0'));var util=require(_0x3eaf('0x1'));var logger=require(_0x3eaf('0x2'))(_0x3eaf('0x3'));var moment=require(_0x3eaf('0x4'));var BPromise=require('bluebird');var rp=require(_0x3eaf('0x5'));var fs=require('fs');var path=require(_0x3eaf('0x6'));var rimraf=require(_0x3eaf('0x7'));var config=require(_0x3eaf('0x8'));var attributes=require(_0x3eaf('0x9'));module[_0x3eaf('0xa')]=function(_0x282054,_0x3dc4dc){return _0x282054[_0x3eaf('0xb')]('AnalyticDefaultReport',attributes,{'tableName':_0x3eaf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x435a=['exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./analyticDefaultReport.attributes'];(function(_0x5759aa,_0x5d8639){var _0x434a4d=function(_0x4006fc){while(--_0x4006fc){_0x5759aa['push'](_0x5759aa['shift']());}};_0x434a4d(++_0x5d8639);}(_0x435a,0x1a6));var _0xa435=function(_0x3e5a76,_0x1e2316){_0x3e5a76=_0x3e5a76-0x0;var _0x2b9bc6=_0x435a[_0x3e5a76];return _0x2b9bc6;};'use strict';var _=require(_0xa435('0x0'));var util=require(_0xa435('0x1'));var logger=require(_0xa435('0x2'))(_0xa435('0x3'));var moment=require(_0xa435('0x4'));var BPromise=require(_0xa435('0x5'));var rp=require(_0xa435('0x6'));var fs=require('fs');var path=require(_0xa435('0x7'));var rimraf=require(_0xa435('0x8'));var config=require('../../config/environment');var attributes=require(_0xa435('0x9'));module[_0xa435('0xa')]=function(_0x200873,_0x3a75a4){return _0x200873[_0xa435('0xb')]('AnalyticDefaultReport',attributes,{'tableName':'analytics_default_reports','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 049cedb..62d9c16 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 _0x2afb=['AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3cb530,_0x170e8c){var _0x4168ea=function(_0x83990a){while(--_0x83990a){_0x3cb530['push'](_0x3cb530['shift']());}};_0x4168ea(++_0x170e8c);}(_0x2afb,0x6b));var _0xb2af=function(_0x4492af,_0x47e25d){_0x4492af=_0x4492af-0x0;var _0x216729=_0x2afb[_0x4492af];return _0x216729;};'use strict';var _=require(_0xb2af('0x0'));var util=require(_0xb2af('0x1'));var moment=require(_0xb2af('0x2'));var BPromise=require(_0xb2af('0x3'));var rs=require(_0xb2af('0x4'));var fs=require('fs');var Redis=require(_0xb2af('0x5'));var db=require(_0xb2af('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb2af('0x7'))(_0xb2af('0x8'));var config=require(_0xb2af('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb2af('0xa')][_0xb2af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5cc19f,_0x385f35,_0x556dda){return new BPromise(function(_0x127df0,_0x4e6b4b){return client[_0xb2af('0xc')](_0x5cc19f,_0x556dda)[_0xb2af('0xd')](function(_0xa6f42f){logger[_0xb2af('0xe')](_0xb2af('0xf'),_0x385f35,_0xb2af('0x10'));logger[_0xb2af('0x11')](_0xb2af('0x12'),_0x385f35,'request\x20sent',JSON[_0xb2af('0x13')](_0xa6f42f));if(_0xa6f42f[_0xb2af('0x14')]){if(_0xa6f42f[_0xb2af('0x14')][_0xb2af('0x15')]===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x385f35,_0xa6f42f[_0xb2af('0x14')][_0xb2af('0x16')]);return _0x4e6b4b(_0xa6f42f['error'][_0xb2af('0x16')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x385f35,_0xa6f42f['error'][_0xb2af('0x16')]);return _0x127df0(_0xa6f42f['error']['message']);}else{logger[_0xb2af('0xe')](_0xb2af('0xf'),_0x385f35,'request\x20sent');_0x127df0(_0xa6f42f[_0xb2af('0x17')]['message']);}})[_0xb2af('0x18')](function(_0x66577b){logger[_0xb2af('0x14')](_0xb2af('0xf'),_0x385f35,_0x66577b);_0x4e6b4b(_0x66577b);});});} \ No newline at end of file +var _0x02b8=['request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x02b8,0xad));var _0x802b=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x02b8[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x802b('0x0'));var util=require(_0x802b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x802b('0x2'));var fs=require('fs');var Redis=require(_0x802b('0x3'));var db=require(_0x802b('0x4'))['db'];var utils=require(_0x802b('0x5'));var logger=require('../../config/logger')(_0x802b('0x6'));var config=require(_0x802b('0x7'));var jayson=require(_0x802b('0x8'));var client=jayson[_0x802b('0x9')][_0x802b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f9eea,_0xf46384,_0x240f35){return new BPromise(function(_0x3ab2ad,_0x9e5358){return client[_0x802b('0xb')](_0x2f9eea,_0x240f35)[_0x802b('0xc')](function(_0x42f8de){logger[_0x802b('0xd')](_0x802b('0xe'),_0xf46384,_0x802b('0xf'));logger[_0x802b('0x10')](_0x802b('0x11'),_0xf46384,_0x802b('0xf'),JSON[_0x802b('0x12')](_0x42f8de));if(_0x42f8de[_0x802b('0x13')]){if(_0x42f8de['error'][_0x802b('0x14')]===0x1f4){logger[_0x802b('0x13')](_0x802b('0xe'),_0xf46384,_0x42f8de[_0x802b('0x13')][_0x802b('0x15')]);return _0x9e5358(_0x42f8de[_0x802b('0x13')][_0x802b('0x15')]);}logger[_0x802b('0x13')](_0x802b('0xe'),_0xf46384,_0x42f8de[_0x802b('0x13')]['message']);return _0x3ab2ad(_0x42f8de[_0x802b('0x13')]['message']);}else{logger[_0x802b('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xf46384,_0x802b('0xf'));_0x3ab2ad(_0x42f8de['result']['message']);}})[_0x802b('0x16')](function(_0x355750){logger['error'](_0x802b('0xe'),_0xf46384,_0x355750);_0x9e5358(_0x355750);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 380897c..0d8238a 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 _0xb334=['../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','/:id','show','get','/:id/preview','/:id/run','run','/:id/query','query','post','create','put','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2ede49,_0x56bd37){var _0x699234=function(_0x27e2d9){while(--_0x27e2d9){_0x2ede49['push'](_0x2ede49['shift']());}};_0x699234(++_0x56bd37);}(_0xb334,0x101));var _0x4b33=function(_0x42c437,_0x4cf128){_0x42c437=_0x42c437-0x0;var _0x57640a=_0xb334[_0x42c437];return _0x57640a;};'use strict';var multer=require('multer');var util=require(_0x4b33('0x0'));var path=require(_0x4b33('0x1'));var timeout=require(_0x4b33('0x2'));var express=require(_0x4b33('0x3'));var router=express[_0x4b33('0x4')]();var fs_extra=require(_0x4b33('0x5'));var auth=require(_0x4b33('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4b33('0x7'));var controller=require(_0x4b33('0x8'));router['get']('/',auth[_0x4b33('0x9')](),controller[_0x4b33('0xa')]);router['get'](_0x4b33('0xb'),auth[_0x4b33('0x9')](),controller[_0x4b33('0xc')]);router[_0x4b33('0xd')](_0x4b33('0xe'),auth[_0x4b33('0x9')](),controller['preview']);router['get'](_0x4b33('0xf'),auth[_0x4b33('0x9')](),controller[_0x4b33('0x10')]);router[_0x4b33('0xd')](_0x4b33('0x11'),auth[_0x4b33('0x9')](),controller[_0x4b33('0x12')]);router[_0x4b33('0x13')]('/',auth[_0x4b33('0x9')](),controller[_0x4b33('0x14')]);router[_0x4b33('0x15')](_0x4b33('0xb'),auth[_0x4b33('0x9')](),controller[_0x4b33('0x16')]);router['delete']('/:id',auth[_0x4b33('0x9')](),controller['destroy']);module[_0x4b33('0x17')]=router; \ No newline at end of file +var _0xf1d6=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','query'];(function(_0x12d17f,_0x5d9692){var _0x469779=function(_0xdaa74e){while(--_0xdaa74e){_0x12d17f['push'](_0x12d17f['shift']());}};_0x469779(++_0x5d9692);}(_0xf1d6,0x195));var _0x6f1d=function(_0x47c69b,_0x4a2d92){_0x47c69b=_0x47c69b-0x0;var _0x1ba395=_0xf1d6[_0x47c69b];return _0x1ba395;};'use strict';var multer=require(_0x6f1d('0x0'));var util=require(_0x6f1d('0x1'));var path=require(_0x6f1d('0x2'));var timeout=require(_0x6f1d('0x3'));var express=require(_0x6f1d('0x4'));var router=express['Router']();var fs_extra=require(_0x6f1d('0x5'));var auth=require(_0x6f1d('0x6'));var interaction=require(_0x6f1d('0x7'));var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router['get']('/',auth[_0x6f1d('0x8')](),controller[_0x6f1d('0x9')]);router[_0x6f1d('0xa')](_0x6f1d('0xb'),auth[_0x6f1d('0x8')](),controller['show']);router['get']('/:id/preview',auth[_0x6f1d('0x8')](),controller['preview']);router['get']('/:id/run',auth['isAuthenticated'](),controller['run']);router[_0x6f1d('0xa')]('/:id/query',auth[_0x6f1d('0x8')](),controller[_0x6f1d('0xc')]);router[_0x6f1d('0xd')]('/',auth[_0x6f1d('0x8')](),controller['create']);router[_0x6f1d('0xe')](_0x6f1d('0xb'),auth[_0x6f1d('0x8')](),controller[_0x6f1d('0xf')]);router[_0x6f1d('0x10')](_0x6f1d('0xb'),auth[_0x6f1d('0x8')](),controller[_0x6f1d('0x11')]);module[_0x6f1d('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index d0154bb..6d78645 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 _0x82bb=['exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual','INTEGER','UNSIGNED','sequelize','moment'];(function(_0x43fb15,_0x4b3f5b){var _0x42d47a=function(_0x27859b){while(--_0x27859b){_0x43fb15['push'](_0x43fb15['shift']());}};_0x42d47a(++_0x4b3f5b);}(_0x82bb,0x1ec));var _0xb82b=function(_0x588afd,_0x3e0d6e){_0x588afd=_0x588afd-0x0;var _0x2a4b57=_0x82bb[_0x588afd];return _0x2a4b57;};'use strict';var Sequelize=require(_0xb82b('0x0'));var moment=require(_0xb82b('0x1'));module[_0xb82b('0x2')]={'name':{'type':Sequelize[_0xb82b('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xb82b('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xb82b('0x4')](_0xb82b('0x5'),_0xb82b('0x6'),_0xb82b('0x7')),'allowNull':![],'defaultValue':_0xb82b('0x5')},'savename':{'type':Sequelize[_0xb82b('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xb82b('0x8')]},'endDate':{'type':Sequelize[_0xb82b('0x8')]},'status':{'type':Sequelize[_0xb82b('0x3')],'defaultValue':_0xb82b('0x9')},'type':{'type':Sequelize[_0xb82b('0x4')](_0xb82b('0xa'),'scheduled'),'allowNull':![],'defaultValue':_0xb82b('0xa')},'reportId':{'type':Sequelize[_0xb82b('0xb')](0xb)[_0xb82b('0xc')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3919=['ENUM','csv','pdf','xlsx','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING'];(function(_0x1e4b80,_0x11cc64){var _0x303865=function(_0x5b9121){while(--_0x5b9121){_0x1e4b80['push'](_0x1e4b80['shift']());}};_0x303865(++_0x11cc64);}(_0x3919,0x1f4));var _0x9391=function(_0x1313f0,_0x2b2750){_0x1313f0=_0x1313f0-0x0;var _0xc3fad0=_0x3919[_0x1313f0];return _0xc3fad0;};'use strict';var Sequelize=require(_0x9391('0x0'));var moment=require(_0x9391('0x1'));module[_0x9391('0x2')]={'name':{'type':Sequelize[_0x9391('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x9391('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x9391('0x4')](_0x9391('0x5'),_0x9391('0x6'),_0x9391('0x7')),'allowNull':![],'defaultValue':_0x9391('0x5')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x9391('0x8')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':_0x9391('0x9')},'type':{'type':Sequelize[_0x9391('0x4')](_0x9391('0xa'),_0x9391('0xb')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x9391('0xc')](0xb)[_0x9391('0xd')]},'reportType':{'type':Sequelize[_0x9391('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 76d7ce6..038eaee 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 _0xb08f=['reject','save','update','then','destroy','get','UserProfileResource','error','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','offset','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','include','findAll','rows','catch','show','params','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','UserProfileSection','find','autoAssociation','body','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','download','format','%s.%s','rimraf','zip-dir','fast-json-patch','moment','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','set','apply'];(function(_0x18f152,_0x41585a){var _0xa10b34=function(_0x1e9798){while(--_0x1e9798){_0x18f152['push'](_0x18f152['shift']());}};_0xa10b34(++_0x41585a);}(_0xb08f,0xa1));var _0xfb08=function(_0x534e94,_0x7c755e){_0x534e94=_0x534e94-0x0;var _0x4e1d5c=_0xb08f[_0x534e94];return _0x4e1d5c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfb08('0x0'));var zipdir=require(_0xfb08('0x1'));var jsonpatch=require(_0xfb08('0x2'));var rp=require('request-promise');var moment=require(_0xfb08('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfb08('0x4'));var path=require('path');var sox=require(_0xfb08('0x5'));var csv=require('to-csv');var ejs=require(_0xfb08('0x6'));var fs=require('fs');var fs_extra=require(_0xfb08('0x7'));var _=require(_0xfb08('0x8'));var squel=require(_0xfb08('0x9'));var crypto=require(_0xfb08('0xa'));var jsforce=require(_0xfb08('0xb'));var deskjs=require(_0xfb08('0xc'));var toCsv=require(_0xfb08('0xd'));var querystring=require('querystring');var Papa=require(_0xfb08('0xe'));var Redis=require(_0xfb08('0xf'));var authService=require(_0xfb08('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xfb08('0x11'));var hardwareService=require(_0xfb08('0x12'));var logger=require(_0xfb08('0x13'))(_0xfb08('0x14'));var utils=require(_0xfb08('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xfb08('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24feb8,_0x20dd55){_0x20dd55=_0x20dd55||0xcc;return function(_0x3ce01f){if(_0x3ce01f){return _0x24feb8[_0xfb08('0x17')](_0x20dd55);}return _0x24feb8[_0xfb08('0x18')](_0x20dd55)[_0xfb08('0x19')]();};}function respondWithResult(_0x427991,_0x3f60aa){_0x3f60aa=_0x3f60aa||0xc8;return function(_0x1ea9d0){if(_0x1ea9d0){return _0x427991['status'](_0x3f60aa)[_0xfb08('0x1a')](_0x1ea9d0);}};}function respondWithFilteredResult(_0x2eeea5,_0x505597){return function(_0x1177ce){if(_0x1177ce){var _0x308be2=typeof _0x505597['offset']===_0xfb08('0x1b')&&typeof _0x505597[_0xfb08('0x1c')]==='undefined';var _0x2af683=_0x1177ce['count'];var _0xd8822e=_0x308be2?0x0:_0x505597['offset'];var _0x32c3d6=_0x308be2?_0x1177ce['count']:_0x505597['offset']+_0x505597['limit'];var _0x3df52e;if(_0x32c3d6>=_0x2af683){_0x32c3d6=_0x2af683;_0x3df52e=0xc8;}else{_0x3df52e=0xce;}_0x2eeea5[_0xfb08('0x18')](_0x3df52e);return _0x2eeea5[_0xfb08('0x1d')]('Content-Range',_0xd8822e+'-'+_0x32c3d6+'/'+_0x2af683)[_0xfb08('0x1a')](_0x1177ce);}return null;};}function patchUpdates(_0x2648c1){return function(_0x3cb358){try{jsonpatch[_0xfb08('0x1e')](_0x3cb358,_0x2648c1,!![]);}catch(_0x2f743d){return BPromise[_0xfb08('0x1f')](_0x2f743d);}return _0x3cb358[_0xfb08('0x20')]();};}function saveUpdates(_0x65f73d,_0x5ed8bc){return function(_0x21cef7){if(_0x21cef7){return _0x21cef7[_0xfb08('0x21')](_0x65f73d)[_0xfb08('0x22')](function(_0x419c03){return _0x419c03;});}return null;};}function removeEntity(_0xd61689,_0x3d8ba5){return function(_0x10ccab){if(_0x10ccab){return _0x10ccab[_0xfb08('0x23')]()['then'](function(){var _0x13db13=_0x10ccab[_0xfb08('0x24')]({'plain':!![]});var _0x48f398='ExtractedReports';return db[_0xfb08('0x25')][_0xfb08('0x23')]({'where':{'type':_0x48f398,'resourceId':_0x13db13['id']}})[_0xfb08('0x22')](function(){return _0x10ccab;});})['then'](function(){_0xd61689[_0xfb08('0x18')](0xcc)[_0xfb08('0x19')]();});}};}function handleEntityNotFound(_0xfa7eeb,_0x2c9424){return function(_0x3086af){if(!_0x3086af){_0xfa7eeb['sendStatus'](0x194);}return _0x3086af;};}function handleError(_0x3407d9,_0x54d6a4){_0x54d6a4=_0x54d6a4||0x1f4;return function(_0x156763){logger[_0xfb08('0x26')](_0x156763['stack']);if(_0x156763[_0xfb08('0x27')]){delete _0x156763[_0xfb08('0x27')];}_0x3407d9[_0xfb08('0x18')](_0x54d6a4)[_0xfb08('0x28')](_0x156763);};}exports[_0xfb08('0x29')]=function(_0x39647c,_0x4cf3e1){var _0x1d1983={},_0x2317b9={},_0x554b6f={'count':0x0,'rows':[]};var _0x4e868a=_[_0xfb08('0x2a')](db[_0xfb08('0x2b')][_0xfb08('0x2c')],function(_0x27ac12){return{'name':_0x27ac12[_0xfb08('0x2d')],'type':_0x27ac12[_0xfb08('0x2e')][_0xfb08('0x2f')]};});_0x2317b9['model']=_['map'](_0x4e868a,_0xfb08('0x27'));_0x2317b9[_0xfb08('0x30')]=_[_0xfb08('0x31')](_0x39647c[_0xfb08('0x30')]);_0x2317b9['filters']=_[_0xfb08('0x32')](_0x2317b9[_0xfb08('0x33')],_0x2317b9['query']);_0x1d1983[_0xfb08('0x34')]=_[_0xfb08('0x32')](_0x2317b9[_0xfb08('0x33')],qs[_0xfb08('0x35')](_0x39647c[_0xfb08('0x30')][_0xfb08('0x35')]));_0x1d1983[_0xfb08('0x34')]=_0x1d1983[_0xfb08('0x34')][_0xfb08('0x36')]?_0x1d1983[_0xfb08('0x34')]:_0x2317b9[_0xfb08('0x33')];if(!_0x39647c[_0xfb08('0x30')]['hasOwnProperty'](_0xfb08('0x37'))){_0x1d1983[_0xfb08('0x1c')]=qs[_0xfb08('0x1c')](_0x39647c[_0xfb08('0x30')]['limit']);_0x1d1983['offset']=qs[_0xfb08('0x38')](_0x39647c[_0xfb08('0x30')][_0xfb08('0x38')]);}_0x1d1983[_0xfb08('0x39')]=qs[_0xfb08('0x3a')](_0x39647c[_0xfb08('0x30')][_0xfb08('0x3a')]);_0x1d1983[_0xfb08('0x3b')]=qs[_0xfb08('0x3c')](_[_0xfb08('0x3d')](_0x39647c[_0xfb08('0x30')],_0x2317b9['filters']),_0x4e868a);if(_0x39647c[_0xfb08('0x30')][_0xfb08('0x3e')]){_0x1d1983[_0xfb08('0x3b')]=_['merge'](_0x1d1983[_0xfb08('0x3b')],{'$or':_[_0xfb08('0x2a')](_0x4e868a,function(_0x539d71){if(_0x539d71[_0xfb08('0x2e')]!==_0xfb08('0x3f')){var _0x2f85be={};_0x2f85be[_0x539d71['name']]={'$like':'%'+_0x39647c[_0xfb08('0x30')][_0xfb08('0x3e')]+'%'};return _0x2f85be;}})});}_0x1d1983=_[_0xfb08('0x40')]({},_0x1d1983,_0x39647c[_0xfb08('0x41')]);var _0x5dc08b={'where':_0x1d1983['where']};return db[_0xfb08('0x2b')][_0xfb08('0x42')](_0x5dc08b)[_0xfb08('0x22')](function(_0x92b1d7){_0x554b6f['count']=_0x92b1d7;if(_0x39647c[_0xfb08('0x30')]['includeAll']){_0x1d1983[_0xfb08('0x43')]=[{'all':!![]}];}return db[_0xfb08('0x2b')][_0xfb08('0x44')](_0x1d1983);})[_0xfb08('0x22')](function(_0x4a078d){_0x554b6f[_0xfb08('0x45')]=_0x4a078d;return _0x554b6f;})['then'](respondWithFilteredResult(_0x4cf3e1,_0x1d1983))[_0xfb08('0x46')](handleError(_0x4cf3e1,null));};exports[_0xfb08('0x47')]=function(_0x13965a,_0x148c25){var _0x3a3095={'raw':!![],'where':{'id':_0x13965a[_0xfb08('0x48')]['id']}},_0x2c69f8={};_0x2c69f8[_0xfb08('0x33')]=_[_0xfb08('0x31')](db[_0xfb08('0x2b')][_0xfb08('0x2c')]);_0x2c69f8[_0xfb08('0x30')]=_[_0xfb08('0x31')](_0x13965a['query']);_0x2c69f8[_0xfb08('0x3c')]=_[_0xfb08('0x32')](_0x2c69f8[_0xfb08('0x33')],_0x2c69f8[_0xfb08('0x30')]);_0x3a3095[_0xfb08('0x34')]=_[_0xfb08('0x32')](_0x2c69f8[_0xfb08('0x33')],qs[_0xfb08('0x35')](_0x13965a[_0xfb08('0x30')]['fields']));_0x3a3095[_0xfb08('0x34')]=_0x3a3095['attributes'][_0xfb08('0x36')]?_0x3a3095[_0xfb08('0x34')]:_0x2c69f8['model'];if(_0x13965a['query'][_0xfb08('0x49')]){_0x3a3095[_0xfb08('0x43')]=[{'all':!![]}];}_0x3a3095=_[_0xfb08('0x40')]({},_0x3a3095,_0x13965a[_0xfb08('0x41')]);return db['AnalyticExtractedReport']['find'](_0x3a3095)[_0xfb08('0x22')](handleEntityNotFound(_0x148c25,null))[_0xfb08('0x22')](respondWithResult(_0x148c25,null))['catch'](handleError(_0x148c25,null));};exports[_0xfb08('0x4a')]=function(_0x34157f,_0x3fd503){return db['AnalyticExtractedReport'][_0xfb08('0x4a')](_0x34157f['body'],{})[_0xfb08('0x22')](function(_0x3227a1){var _0x35253a=_0x34157f[_0xfb08('0x4b')][_0xfb08('0x24')]({'plain':!![]});if(!_0x35253a)throw new Error(_0xfb08('0x4c'));if(_0x35253a[_0xfb08('0x4d')]===_0xfb08('0x4b')){var _0x48ceaa=_0x3227a1['get']({'plain':!![]});var _0x955c0d=_0xfb08('0x4e');return db[_0xfb08('0x4f')][_0xfb08('0x50')]({'where':{'name':_0x955c0d,'userProfileId':_0x35253a['userProfileId']},'raw':!![]})[_0xfb08('0x22')](function(_0x42ba5d){if(_0x42ba5d&&_0x42ba5d[_0xfb08('0x51')]===0x0){return db[_0xfb08('0x25')][_0xfb08('0x4a')]({'name':_0x48ceaa['name'],'resourceId':_0x48ceaa['id'],'type':_0x42ba5d[_0xfb08('0x27')],'sectionId':_0x42ba5d['id']},{})[_0xfb08('0x22')](function(){return _0x3227a1;});}else{return _0x3227a1;}})[_0xfb08('0x46')](function(_0x179d62){logger[_0xfb08('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x179d62);throw _0x179d62;});}return _0x3227a1;})[_0xfb08('0x22')](respondWithResult(_0x3fd503,0xc9))[_0xfb08('0x46')](handleError(_0x3fd503,null));};exports[_0xfb08('0x21')]=function(_0x4d1c7e,_0x5e2fc0){if(_0x4d1c7e['body']['id']){delete _0x4d1c7e[_0xfb08('0x52')]['id'];}return db[_0xfb08('0x2b')]['find']({'where':{'id':_0x4d1c7e[_0xfb08('0x48')]['id']}})[_0xfb08('0x22')](handleEntityNotFound(_0x5e2fc0,null))[_0xfb08('0x22')](saveUpdates(_0x4d1c7e[_0xfb08('0x52')],null))[_0xfb08('0x22')](respondWithResult(_0x5e2fc0,null))['catch'](handleError(_0x5e2fc0,null));};exports[_0xfb08('0x23')]=function(_0x2eba31,_0x122337){return db[_0xfb08('0x2b')][_0xfb08('0x50')]({'where':{'id':_0x2eba31[_0xfb08('0x48')]['id']}})[_0xfb08('0x22')](handleEntityNotFound(_0x122337,null))[_0xfb08('0x22')](removeEntity(_0x122337,null))[_0xfb08('0x46')](handleError(_0x122337,null));};exports['download']=function(_0x3e2837,_0x18d2e1,_0x3d789d){return db[_0xfb08('0x2b')][_0xfb08('0x50')]({'where':{'id':_0x3e2837['params']['id']},'attributes':[_0xfb08('0x27'),_0xfb08('0x53'),_0xfb08('0x54'),_0xfb08('0x55')],'raw':!![]})[_0xfb08('0x22')](handleEntityNotFound(_0x18d2e1,null))[_0xfb08('0x22')](function(_0x4b6628){if(_0x4b6628){if(!fs[_0xfb08('0x56')](path[_0xfb08('0x57')](config[_0xfb08('0x58')],_0xfb08('0x59'),_0x4b6628[_0xfb08('0x54')]))){throw new db[(_0xfb08('0x5a'))]['ValidationError'](_0xfb08('0x5b'));}if(_0x3e2837[_0xfb08('0x30')][_0xfb08('0x5c')]){return _0x18d2e1['sendStatus'](0xc8);}return _0x18d2e1[_0xfb08('0x5d')](path['join'](config['root'],_0xfb08('0x59'),_0x4b6628['savename']),util[_0xfb08('0x5e')](_0xfb08('0x5f'),_0x4b6628[_0xfb08('0x53')]||_0x4b6628['name'],_0x4b6628[_0xfb08('0x55')]['toLowerCase']()));}})['catch'](handleError(_0x18d2e1,null));}; \ No newline at end of file +var _0x234a=['merge','VIRTUAL','filter','options','AnalyticExtractedReport','includeAll','include','show','params','rawAttributes','find','catch','create','user','role','ExtractedReports','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','basename','savename','output','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','destroy','then','get','error','stack','name','send','index','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','order','where'];(function(_0x6e6098,_0x5fa384){var _0xcf2c19=function(_0x218eb3){while(--_0x218eb3){_0x6e6098['push'](_0x6e6098['shift']());}};_0xcf2c19(++_0x5fa384);}(_0x234a,0x18e));var _0xa234=function(_0x2f23c6,_0x8eacbc){_0x2f23c6=_0x2f23c6-0x0;var _0x12e26a=_0x234a[_0x2f23c6];return _0x12e26a;};'use strict';var emlformat=require(_0xa234('0x0'));var rimraf=require(_0xa234('0x1'));var zipdir=require(_0xa234('0x2'));var jsonpatch=require(_0xa234('0x3'));var rp=require(_0xa234('0x4'));var moment=require(_0xa234('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa234('0x6'));var util=require(_0xa234('0x7'));var path=require(_0xa234('0x8'));var sox=require(_0xa234('0x9'));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(_0xa234('0xa'));var crypto=require(_0xa234('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa234('0xc'));var toCsv=require(_0xa234('0xd'));var querystring=require('querystring');var Papa=require(_0xa234('0xe'));var Redis=require(_0xa234('0xf'));var authService=require(_0xa234('0x10'));var qs=require(_0xa234('0x11'));var as=require(_0xa234('0x12'));var hardwareService=require(_0xa234('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xa234('0x14'));var config=require(_0xa234('0x15'));var licenseUtil=require(_0xa234('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d7bd5,_0x398d34){_0x398d34=_0x398d34||0xcc;return function(_0x1c1dfd){if(_0x1c1dfd){return _0x2d7bd5[_0xa234('0x17')](_0x398d34);}return _0x2d7bd5[_0xa234('0x18')](_0x398d34)[_0xa234('0x19')]();};}function respondWithResult(_0x2cc849,_0x2ab4d8){_0x2ab4d8=_0x2ab4d8||0xc8;return function(_0x28227c){if(_0x28227c){return _0x2cc849['status'](_0x2ab4d8)['json'](_0x28227c);}};}function respondWithFilteredResult(_0x4d3245,_0x1b3ffb){return function(_0x119ccb){if(_0x119ccb){var _0x52d960=typeof _0x1b3ffb[_0xa234('0x1a')]===_0xa234('0x1b')&&typeof _0x1b3ffb[_0xa234('0x1c')]==='undefined';var _0x380741=_0x119ccb[_0xa234('0x1d')];var _0x25887e=_0x52d960?0x0:_0x1b3ffb[_0xa234('0x1a')];var _0x1d8cfb=_0x52d960?_0x119ccb[_0xa234('0x1d')]:_0x1b3ffb[_0xa234('0x1a')]+_0x1b3ffb[_0xa234('0x1c')];var _0x2d72ad;if(_0x1d8cfb>=_0x380741){_0x1d8cfb=_0x380741;_0x2d72ad=0xc8;}else{_0x2d72ad=0xce;}_0x4d3245[_0xa234('0x18')](_0x2d72ad);return _0x4d3245['set'](_0xa234('0x1e'),_0x25887e+'-'+_0x1d8cfb+'/'+_0x380741)[_0xa234('0x1f')](_0x119ccb);}return null;};}function patchUpdates(_0x4fb519){return function(_0x341530){try{jsonpatch[_0xa234('0x20')](_0x341530,_0x4fb519,!![]);}catch(_0x5ef0c7){return BPromise[_0xa234('0x21')](_0x5ef0c7);}return _0x341530[_0xa234('0x22')]();};}function saveUpdates(_0x40e972,_0x23a23e){return function(_0x4630e1){if(_0x4630e1){return _0x4630e1[_0xa234('0x23')](_0x40e972)['then'](function(_0x46c4e7){return _0x46c4e7;});}return null;};}function removeEntity(_0x560750,_0x242447){return function(_0x18f476){if(_0x18f476){return _0x18f476[_0xa234('0x24')]()[_0xa234('0x25')](function(){var _0x5047ac=_0x18f476[_0xa234('0x26')]({'plain':!![]});var _0x19ed6d='ExtractedReports';return db['UserProfileResource'][_0xa234('0x24')]({'where':{'type':_0x19ed6d,'resourceId':_0x5047ac['id']}})[_0xa234('0x25')](function(){return _0x18f476;});})['then'](function(){_0x560750[_0xa234('0x18')](0xcc)[_0xa234('0x19')]();});}};}function handleEntityNotFound(_0x12050c,_0x496283){return function(_0x2cf348){if(!_0x2cf348){_0x12050c[_0xa234('0x17')](0x194);}return _0x2cf348;};}function handleError(_0x15025d,_0x3fe62a){_0x3fe62a=_0x3fe62a||0x1f4;return function(_0x2a2594){logger[_0xa234('0x27')](_0x2a2594[_0xa234('0x28')]);if(_0x2a2594[_0xa234('0x29')]){delete _0x2a2594['name'];}_0x15025d['status'](_0x3fe62a)[_0xa234('0x2a')](_0x2a2594);};}exports[_0xa234('0x2b')]=function(_0x3de3d2,_0x351515){var _0x3bb6a6={},_0xec2031={},_0x371aa6={'count':0x0,'rows':[]};var _0x6b2ecb=_['map'](db['AnalyticExtractedReport']['rawAttributes'],function(_0x1ddb5f){return{'name':_0x1ddb5f['fieldName'],'type':_0x1ddb5f[_0xa234('0x2c')][_0xa234('0x2d')]};});_0xec2031[_0xa234('0x2e')]=_[_0xa234('0x2f')](_0x6b2ecb,'name');_0xec2031[_0xa234('0x30')]=_[_0xa234('0x31')](_0x3de3d2[_0xa234('0x30')]);_0xec2031[_0xa234('0x32')]=_['intersection'](_0xec2031[_0xa234('0x2e')],_0xec2031[_0xa234('0x30')]);_0x3bb6a6[_0xa234('0x33')]=_[_0xa234('0x34')](_0xec2031[_0xa234('0x2e')],qs[_0xa234('0x35')](_0x3de3d2[_0xa234('0x30')]['fields']));_0x3bb6a6[_0xa234('0x33')]=_0x3bb6a6[_0xa234('0x33')][_0xa234('0x36')]?_0x3bb6a6[_0xa234('0x33')]:_0xec2031[_0xa234('0x2e')];if(!_0x3de3d2[_0xa234('0x30')]['hasOwnProperty']('nolimit')){_0x3bb6a6[_0xa234('0x1c')]=qs[_0xa234('0x1c')](_0x3de3d2[_0xa234('0x30')][_0xa234('0x1c')]);_0x3bb6a6[_0xa234('0x1a')]=qs['offset'](_0x3de3d2[_0xa234('0x30')][_0xa234('0x1a')]);}_0x3bb6a6[_0xa234('0x37')]=qs['sort'](_0x3de3d2[_0xa234('0x30')]['sort']);_0x3bb6a6[_0xa234('0x38')]=qs[_0xa234('0x32')](_['pick'](_0x3de3d2[_0xa234('0x30')],_0xec2031[_0xa234('0x32')]),_0x6b2ecb);if(_0x3de3d2[_0xa234('0x30')]['filter']){_0x3bb6a6[_0xa234('0x38')]=_[_0xa234('0x39')](_0x3bb6a6[_0xa234('0x38')],{'$or':_[_0xa234('0x2f')](_0x6b2ecb,function(_0x3e900a){if(_0x3e900a[_0xa234('0x2c')]!==_0xa234('0x3a')){var _0x3da3ce={};_0x3da3ce[_0x3e900a[_0xa234('0x29')]]={'$like':'%'+_0x3de3d2[_0xa234('0x30')][_0xa234('0x3b')]+'%'};return _0x3da3ce;}})});}_0x3bb6a6=_[_0xa234('0x39')]({},_0x3bb6a6,_0x3de3d2[_0xa234('0x3c')]);var _0xe53329={'where':_0x3bb6a6[_0xa234('0x38')]};return db[_0xa234('0x3d')][_0xa234('0x1d')](_0xe53329)['then'](function(_0x3c96db){_0x371aa6[_0xa234('0x1d')]=_0x3c96db;if(_0x3de3d2[_0xa234('0x30')][_0xa234('0x3e')]){_0x3bb6a6[_0xa234('0x3f')]=[{'all':!![]}];}return db[_0xa234('0x3d')]['findAll'](_0x3bb6a6);})[_0xa234('0x25')](function(_0x5b8992){_0x371aa6['rows']=_0x5b8992;return _0x371aa6;})[_0xa234('0x25')](respondWithFilteredResult(_0x351515,_0x3bb6a6))['catch'](handleError(_0x351515,null));};exports[_0xa234('0x40')]=function(_0xa149ef,_0x3c0d2d){var _0x28b332={'raw':!![],'where':{'id':_0xa149ef[_0xa234('0x41')]['id']}},_0x1e84d9={};_0x1e84d9['model']=_['keys'](db[_0xa234('0x3d')][_0xa234('0x42')]);_0x1e84d9['query']=_[_0xa234('0x31')](_0xa149ef['query']);_0x1e84d9[_0xa234('0x32')]=_[_0xa234('0x34')](_0x1e84d9[_0xa234('0x2e')],_0x1e84d9[_0xa234('0x30')]);_0x28b332['attributes']=_[_0xa234('0x34')](_0x1e84d9['model'],qs[_0xa234('0x35')](_0xa149ef[_0xa234('0x30')][_0xa234('0x35')]));_0x28b332[_0xa234('0x33')]=_0x28b332[_0xa234('0x33')][_0xa234('0x36')]?_0x28b332[_0xa234('0x33')]:_0x1e84d9[_0xa234('0x2e')];if(_0xa149ef[_0xa234('0x30')][_0xa234('0x3e')]){_0x28b332[_0xa234('0x3f')]=[{'all':!![]}];}_0x28b332=_['merge']({},_0x28b332,_0xa149ef[_0xa234('0x3c')]);return db[_0xa234('0x3d')][_0xa234('0x43')](_0x28b332)[_0xa234('0x25')](handleEntityNotFound(_0x3c0d2d,null))[_0xa234('0x25')](respondWithResult(_0x3c0d2d,null))[_0xa234('0x44')](handleError(_0x3c0d2d,null));};exports[_0xa234('0x45')]=function(_0x3f3985,_0x2571e7){return db[_0xa234('0x3d')][_0xa234('0x45')](_0x3f3985['body'],{})[_0xa234('0x25')](function(_0x1b8150){var _0xe666a7=_0x3f3985[_0xa234('0x46')][_0xa234('0x26')]({'plain':!![]});if(!_0xe666a7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe666a7[_0xa234('0x47')]==='user'){var _0x4db157=_0x1b8150[_0xa234('0x26')]({'plain':!![]});var _0x3aff61=_0xa234('0x48');return db[_0xa234('0x49')][_0xa234('0x43')]({'where':{'name':_0x3aff61,'userProfileId':_0xe666a7['userProfileId']},'raw':!![]})['then'](function(_0x21ae74){if(_0x21ae74&&_0x21ae74[_0xa234('0x4a')]===0x0){return db['UserProfileResource'][_0xa234('0x45')]({'name':_0x4db157[_0xa234('0x29')],'resourceId':_0x4db157['id'],'type':_0x21ae74[_0xa234('0x29')],'sectionId':_0x21ae74['id']},{})[_0xa234('0x25')](function(){return _0x1b8150;});}else{return _0x1b8150;}})[_0xa234('0x44')](function(_0x34205b){logger[_0xa234('0x27')](_0xa234('0x4b'),_0x34205b);throw _0x34205b;});}return _0x1b8150;})[_0xa234('0x25')](respondWithResult(_0x2571e7,0xc9))[_0xa234('0x44')](handleError(_0x2571e7,null));};exports['update']=function(_0x5318c1,_0x7b4374){if(_0x5318c1[_0xa234('0x4c')]['id']){delete _0x5318c1['body']['id'];}return db[_0xa234('0x3d')]['find']({'where':{'id':_0x5318c1[_0xa234('0x41')]['id']}})[_0xa234('0x25')](handleEntityNotFound(_0x7b4374,null))[_0xa234('0x25')](saveUpdates(_0x5318c1[_0xa234('0x4c')],null))['then'](respondWithResult(_0x7b4374,null))[_0xa234('0x44')](handleError(_0x7b4374,null));};exports[_0xa234('0x24')]=function(_0x11d98a,_0x1ade36){return db['AnalyticExtractedReport'][_0xa234('0x43')]({'where':{'id':_0x11d98a['params']['id']}})[_0xa234('0x25')](handleEntityNotFound(_0x1ade36,null))[_0xa234('0x25')](removeEntity(_0x1ade36,null))[_0xa234('0x44')](handleError(_0x1ade36,null));};exports[_0xa234('0x4d')]=function(_0x21dd86,_0x459103,_0x27c743){return db['AnalyticExtractedReport'][_0xa234('0x43')]({'where':{'id':_0x21dd86[_0xa234('0x41')]['id']},'attributes':[_0xa234('0x29'),_0xa234('0x4e'),_0xa234('0x4f'),_0xa234('0x50')],'raw':!![]})[_0xa234('0x25')](handleEntityNotFound(_0x459103,null))['then'](function(_0x5da9a1){if(_0x5da9a1){if(!fs['existsSync'](path[_0xa234('0x51')](config[_0xa234('0x52')],_0xa234('0x53'),_0x5da9a1['savename']))){throw new db[(_0xa234('0x54'))][(_0xa234('0x55'))](_0xa234('0x56'));}if(_0x21dd86[_0xa234('0x30')][_0xa234('0x57')]){return _0x459103['sendStatus'](0xc8);}return _0x459103['download'](path['join'](config[_0xa234('0x52')],'server/files/reports',_0x5da9a1['savename']),util[_0xa234('0x58')](_0xa234('0x59'),_0x5da9a1[_0xa234('0x4e')]||_0x5da9a1[_0xa234('0x29')],_0x5da9a1[_0xa234('0x50')][_0xa234('0x5a')]()));}})[_0xa234('0x44')](handleError(_0x459103,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index b6e0e7d..84d3c2b 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 _0xcbbc=['path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','api','moment','request-promise'];(function(_0x2b9e6c,_0x39e705){var _0x4ed3da=function(_0x240c88){while(--_0x240c88){_0x2b9e6c['push'](_0x2b9e6c['shift']());}};_0x4ed3da(++_0x39e705);}(_0xcbbc,0xeb));var _0xccbb=function(_0x57db49,_0x288094){_0x57db49=_0x57db49-0x0;var _0xd0636f=_0xcbbc[_0x57db49];return _0xd0636f;};'use strict';var _=require('lodash');var util=require(_0xccbb('0x0'));var logger=require(_0xccbb('0x1'))(_0xccbb('0x2'));var moment=require(_0xccbb('0x3'));var BPromise=require('bluebird');var rp=require(_0xccbb('0x4'));var fs=require('fs');var path=require(_0xccbb('0x5'));var rimraf=require(_0xccbb('0x6'));var config=require(_0xccbb('0x7'));var attributes=require(_0xccbb('0x8'));module[_0xccbb('0x9')]=function(_0x23fcfe,_0x52dc6f){return _0x23fcfe['define'](_0xccbb('0xa'),attributes,{'tableName':_0xccbb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6681=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util'];(function(_0x4b0581,_0x2e47f7){var _0x5a8f4d=function(_0x418603){while(--_0x418603){_0x4b0581['push'](_0x4b0581['shift']());}};_0x5a8f4d(++_0x2e47f7);}(_0x6681,0xb4));var _0x1668=function(_0x2927a6,_0x4c6c2f){_0x2927a6=_0x2927a6-0x0;var _0x3c7a6f=_0x6681[_0x2927a6];return _0x3c7a6f;};'use strict';var _=require(_0x1668('0x0'));var util=require(_0x1668('0x1'));var logger=require(_0x1668('0x2'))('api');var moment=require(_0x1668('0x3'));var BPromise=require(_0x1668('0x4'));var rp=require(_0x1668('0x5'));var fs=require('fs');var path=require(_0x1668('0x6'));var rimraf=require(_0x1668('0x7'));var config=require(_0x1668('0x8'));var attributes=require(_0x1668('0x9'));module[_0x1668('0xa')]=function(_0x3e0b54,_0x3572f3){return _0x3e0b54[_0x1668('0xb')](_0x1668('0xc'),attributes,{'tableName':_0x1668('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 1c29572..3cf385c 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 _0xfa88=['code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfa88,0x1a7));var _0x8fa8=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xfa88[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x8fa8('0x0'));var util=require(_0x8fa8('0x1'));var moment=require('moment');var BPromise=require(_0x8fa8('0x2'));var rs=require(_0x8fa8('0x3'));var fs=require('fs');var Redis=require(_0x8fa8('0x4'));var db=require(_0x8fa8('0x5'))['db'];var utils=require(_0x8fa8('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8fa8('0x7'));var client=jayson[_0x8fa8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c40d8,_0x5dcb2a,_0x5f54b4){return new BPromise(function(_0x3f08be,_0x31a69a){return client[_0x8fa8('0x9')](_0x5c40d8,_0x5f54b4)['then'](function(_0x5d29ef){logger[_0x8fa8('0xa')](_0x8fa8('0xb'),_0x5dcb2a,_0x8fa8('0xc'));logger[_0x8fa8('0xd')](_0x8fa8('0xe'),_0x5dcb2a,_0x8fa8('0xc'),JSON[_0x8fa8('0xf')](_0x5d29ef));if(_0x5d29ef[_0x8fa8('0x10')]){if(_0x5d29ef['error'][_0x8fa8('0x11')]===0x1f4){logger[_0x8fa8('0x10')](_0x8fa8('0xb'),_0x5dcb2a,_0x5d29ef[_0x8fa8('0x10')][_0x8fa8('0x12')]);return _0x31a69a(_0x5d29ef[_0x8fa8('0x10')][_0x8fa8('0x12')]);}logger[_0x8fa8('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5dcb2a,_0x5d29ef[_0x8fa8('0x10')][_0x8fa8('0x12')]);return _0x3f08be(_0x5d29ef['error']['message']);}else{logger[_0x8fa8('0xa')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5dcb2a,'request\x20sent');_0x3f08be(_0x5d29ef['result']['message']);}})[_0x8fa8('0x13')](function(_0x1c106f){logger[_0x8fa8('0x10')](_0x8fa8('0xb'),_0x5dcb2a,_0x1c106f);_0x31a69a(_0x1c106f);});});} \ No newline at end of file +var _0xad35=['../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x30c649,_0x2ebbac){var _0x3edfb9=function(_0xab82f5){while(--_0xab82f5){_0x30c649['push'](_0x30c649['shift']());}};_0x3edfb9(++_0x2ebbac);}(_0xad35,0xd0));var _0x5ad3=function(_0x5a5e22,_0x224fe5){_0x5a5e22=_0x5a5e22-0x0;var _0x39eb18=_0xad35[_0x5a5e22];return _0x39eb18;};'use strict';var _=require(_0x5ad3('0x0'));var util=require(_0x5ad3('0x1'));var moment=require(_0x5ad3('0x2'));var BPromise=require(_0x5ad3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ad3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5ad3('0x5'));var logger=require(_0x5ad3('0x6'))(_0x5ad3('0x7'));var config=require(_0x5ad3('0x8'));var jayson=require(_0x5ad3('0x9'));var client=jayson[_0x5ad3('0xa')][_0x5ad3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f64a7,_0x50fa7a,_0x1f0d8f){return new BPromise(function(_0x3fef0e,_0x4b3e6b){return client[_0x5ad3('0xc')](_0x1f64a7,_0x1f0d8f)[_0x5ad3('0xd')](function(_0x56d0c7){logger[_0x5ad3('0xe')](_0x5ad3('0xf'),_0x50fa7a,'request\x20sent');logger[_0x5ad3('0x10')](_0x5ad3('0x11'),_0x50fa7a,_0x5ad3('0x12'),JSON['stringify'](_0x56d0c7));if(_0x56d0c7['error']){if(_0x56d0c7['error'][_0x5ad3('0x13')]===0x1f4){logger[_0x5ad3('0x14')](_0x5ad3('0xf'),_0x50fa7a,_0x56d0c7[_0x5ad3('0x14')][_0x5ad3('0x15')]);return _0x4b3e6b(_0x56d0c7[_0x5ad3('0x14')][_0x5ad3('0x15')]);}logger[_0x5ad3('0x14')](_0x5ad3('0xf'),_0x50fa7a,_0x56d0c7[_0x5ad3('0x14')][_0x5ad3('0x15')]);return _0x3fef0e(_0x56d0c7[_0x5ad3('0x14')][_0x5ad3('0x15')]);}else{logger[_0x5ad3('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x50fa7a,'request\x20sent');_0x3fef0e(_0x56d0c7[_0x5ad3('0x16')][_0x5ad3('0x15')]);}})[_0x5ad3('0x17')](function(_0x1259da){logger[_0x5ad3('0x14')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x50fa7a,_0x1259da);_0x4b3e6b(_0x1259da);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 3a470d0..8aaf557 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 _0x452f=['express','Router','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','create','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x22660a,_0x32955a){var _0x10785a=function(_0x126cf5){while(--_0x126cf5){_0x22660a['push'](_0x22660a['shift']());}};_0x10785a(++_0x32955a);}(_0x452f,0x138));var _0xf452=function(_0x1562a2,_0x2e4655){_0x1562a2=_0x1562a2-0x0;var _0x39a636=_0x452f[_0x1562a2];return _0x39a636;};'use strict';var multer=require(_0xf452('0x0'));var util=require('util');var path=require(_0xf452('0x1'));var timeout=require(_0xf452('0x2'));var express=require(_0xf452('0x3'));var router=express[_0xf452('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf452('0x5'));var config=require(_0xf452('0x6'));var controller=require(_0xf452('0x7'));router[_0xf452('0x8')]('/',auth[_0xf452('0x9')](),controller[_0xf452('0xa')]);router[_0xf452('0x8')](_0xf452('0xb'),auth['isAuthenticated'](),controller[_0xf452('0xc')]);router['get'](_0xf452('0xd'),auth[_0xf452('0x9')](),controller[_0xf452('0xe')]);router['post']('/',auth[_0xf452('0x9')](),controller[_0xf452('0xf')]);router[_0xf452('0x10')](_0xf452('0xb'),auth[_0xf452('0x9')](),controller[_0xf452('0x11')]);router[_0xf452('0x12')](_0xf452('0xb'),auth['isAuthenticated'](),controller[_0xf452('0x13')]);module[_0xf452('0x14')]=router; \ No newline at end of file +var _0x1d2e=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','/:id','show','get','/:id/download','post','create','update','delete','exports','multer','util','path'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x1d2e,0x19f));var _0xe1d2=function(_0x3f7dfc,_0x8f0dad){_0x3f7dfc=_0x3f7dfc-0x0;var _0x499d09=_0x1d2e[_0x3f7dfc];return _0x499d09;};'use strict';var multer=require(_0xe1d2('0x0'));var util=require(_0xe1d2('0x1'));var path=require(_0xe1d2('0x2'));var timeout=require(_0xe1d2('0x3'));var express=require(_0xe1d2('0x4'));var router=express[_0xe1d2('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe1d2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe1d2('0x7'));var controller=require('./analyticExtractedReport.controller');router['get']('/',auth[_0xe1d2('0x8')](),controller[_0xe1d2('0x9')]);router['get'](_0xe1d2('0xa'),auth[_0xe1d2('0x8')](),controller[_0xe1d2('0xb')]);router[_0xe1d2('0xc')](_0xe1d2('0xd'),auth[_0xe1d2('0x8')](),controller['download']);router[_0xe1d2('0xe')]('/',auth[_0xe1d2('0x8')](),controller[_0xe1d2('0xf')]);router['put'](_0xe1d2('0xa'),auth['isAuthenticated'](),controller[_0xe1d2('0x10')]);router[_0xe1d2('0x11')](_0xe1d2('0xa'),auth[_0xe1d2('0x8')](),controller['destroy']);module[_0xe1d2('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 5806bd9..fceaba5 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 _0x7f14=['STRING','BOOLEAN','exports','TEXT'];(function(_0xf0ec6e,_0xa183d3){var _0x8bbc27=function(_0x39822b){while(--_0x39822b){_0xf0ec6e['push'](_0xf0ec6e['shift']());}};_0x8bbc27(++_0xa183d3);}(_0x7f14,0x1ba));var _0x47f1=function(_0x273c4e,_0x42074a){_0x273c4e=_0x273c4e-0x0;var _0x13feda=_0x7f14[_0x273c4e];return _0x13feda;};'use strict';var Sequelize=require('sequelize');module[_0x47f1('0x0')]={'field':{'type':Sequelize[_0x47f1('0x1')]},'alias':{'type':Sequelize[_0x47f1('0x2')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x47f1('0x2')]},'groupBy':{'type':Sequelize[_0x47f1('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7651=['exports','TEXT','STRING','BOOLEAN'];(function(_0x5678d2,_0x46ae41){var _0x40a15a=function(_0x2be971){while(--_0x2be971){_0x5678d2['push'](_0x5678d2['shift']());}};_0x40a15a(++_0x46ae41);}(_0x7651,0xa0));var _0x1765=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7651[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x1765('0x0')]={'field':{'type':Sequelize[_0x1765('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x1765('0x2')]},'format':{'type':Sequelize[_0x1765('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x1765('0x2')]},'custom':{'type':Sequelize[_0x1765('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 1bedae4..124f99a 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 _0x0b99=['index','map','AnalyticFieldReport','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','options','include','findAll','params','includeAll','find','catch','create','body','destroy','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','CustomReportId','bulkCreate','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','error','name','send'];(function(_0x243bba,_0x1ea69f){var _0x12e696=function(_0x5d3ab5){while(--_0x5d3ab5){_0x243bba['push'](_0x243bba['shift']());}};_0x12e696(++_0x1ea69f);}(_0x0b99,0x1bc));var _0x90b9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0b99[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x90b9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x90b9('0x1'));var BPromise=require(_0x90b9('0x2'));var Mustache=require(_0x90b9('0x3'));var util=require(_0x90b9('0x4'));var path=require(_0x90b9('0x5'));var sox=require(_0x90b9('0x6'));var csv=require(_0x90b9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x90b9('0x8'));var _=require(_0x90b9('0x9'));var squel=require(_0x90b9('0xa'));var crypto=require('crypto');var jsforce=require(_0x90b9('0xb'));var deskjs=require(_0x90b9('0xc'));var toCsv=require(_0x90b9('0x7'));var querystring=require(_0x90b9('0xd'));var Papa=require('papaparse');var Redis=require(_0x90b9('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x90b9('0xf'));var as=require(_0x90b9('0x10'));var hardwareService=require(_0x90b9('0x11'));var logger=require(_0x90b9('0x12'))(_0x90b9('0x13'));var utils=require(_0x90b9('0x14'));var config=require(_0x90b9('0x15'));var licenseUtil=require(_0x90b9('0x16'));var db=require(_0x90b9('0x17'))['db'];function respondWithStatusCode(_0x55d111,_0x235580){_0x235580=_0x235580||0xcc;return function(_0x7521b){if(_0x7521b){return _0x55d111[_0x90b9('0x18')](_0x235580);}return _0x55d111['status'](_0x235580)[_0x90b9('0x19')]();};}function respondWithResult(_0x11f325,_0x1b254b){_0x1b254b=_0x1b254b||0xc8;return function(_0x2f31f6){if(_0x2f31f6){return _0x11f325['status'](_0x1b254b)[_0x90b9('0x1a')](_0x2f31f6);}};}function respondWithFilteredResult(_0x42c3b1,_0x4fcc49){return function(_0x417049){if(_0x417049){var _0x23a32a=typeof _0x4fcc49[_0x90b9('0x1b')]===_0x90b9('0x1c')&&typeof _0x4fcc49[_0x90b9('0x1d')]==='undefined';var _0x1bce2a=_0x417049[_0x90b9('0x1e')];var _0x5d921a=_0x23a32a?0x0:_0x4fcc49[_0x90b9('0x1b')];var _0x3a5e3d=_0x23a32a?_0x417049['count']:_0x4fcc49['offset']+_0x4fcc49['limit'];var _0x570ff4;if(_0x3a5e3d>=_0x1bce2a){_0x3a5e3d=_0x1bce2a;_0x570ff4=0xc8;}else{_0x570ff4=0xce;}_0x42c3b1[_0x90b9('0x1f')](_0x570ff4);return _0x42c3b1[_0x90b9('0x20')](_0x90b9('0x21'),_0x5d921a+'-'+_0x3a5e3d+'/'+_0x1bce2a)['json'](_0x417049);}return null;};}function patchUpdates(_0x4628da){return function(_0x2c1ad8){try{jsonpatch[_0x90b9('0x22')](_0x2c1ad8,_0x4628da,!![]);}catch(_0x3ac16a){return BPromise[_0x90b9('0x23')](_0x3ac16a);}return _0x2c1ad8[_0x90b9('0x24')]();};}function saveUpdates(_0x35b43b,_0x5dae0b){return function(_0x3ec4fa){if(_0x3ec4fa){return _0x3ec4fa[_0x90b9('0x25')](_0x35b43b)[_0x90b9('0x26')](function(_0x266a39){return _0x266a39;});}return null;};}function removeEntity(_0x388684,_0x2a75a9){return function(_0x4ccddf){if(_0x4ccddf){return _0x4ccddf['destroy']()['then'](function(){_0x388684[_0x90b9('0x1f')](0xcc)[_0x90b9('0x19')]();});}};}function handleEntityNotFound(_0x28b56a,_0xb47df7){return function(_0x4179eb){if(!_0x4179eb){_0x28b56a['sendStatus'](0x194);}return _0x4179eb;};}function handleError(_0x3d7490,_0x820186){_0x820186=_0x820186||0x1f4;return function(_0x47c2e1){logger[_0x90b9('0x27')](_0x47c2e1['stack']);if(_0x47c2e1['name']){delete _0x47c2e1[_0x90b9('0x28')];}_0x3d7490[_0x90b9('0x1f')](_0x820186)[_0x90b9('0x29')](_0x47c2e1);};}exports[_0x90b9('0x2a')]=function(_0x1ab4f6,_0x160729){var _0x4ed665={},_0x1350b2={},_0x8432ac={'count':0x0,'rows':[]};var _0x4c3f15=_[_0x90b9('0x2b')](db[_0x90b9('0x2c')]['rawAttributes'],function(_0x5a1a58){return{'name':_0x5a1a58[_0x90b9('0x2d')],'type':_0x5a1a58[_0x90b9('0x2e')][_0x90b9('0x2f')]};});_0x1350b2[_0x90b9('0x30')]=_['map'](_0x4c3f15,_0x90b9('0x28'));_0x1350b2[_0x90b9('0x31')]=_[_0x90b9('0x32')](_0x1ab4f6['query']);_0x1350b2['filters']=_[_0x90b9('0x33')](_0x1350b2[_0x90b9('0x30')],_0x1350b2[_0x90b9('0x31')]);_0x4ed665['attributes']=_[_0x90b9('0x33')](_0x1350b2[_0x90b9('0x30')],qs[_0x90b9('0x34')](_0x1ab4f6[_0x90b9('0x31')][_0x90b9('0x34')]));_0x4ed665[_0x90b9('0x35')]=_0x4ed665['attributes'][_0x90b9('0x36')]?_0x4ed665[_0x90b9('0x35')]:_0x1350b2[_0x90b9('0x30')];if(!_0x1ab4f6[_0x90b9('0x31')][_0x90b9('0x37')](_0x90b9('0x38'))){_0x4ed665[_0x90b9('0x1d')]=qs[_0x90b9('0x1d')](_0x1ab4f6[_0x90b9('0x31')][_0x90b9('0x1d')]);_0x4ed665[_0x90b9('0x1b')]=qs[_0x90b9('0x1b')](_0x1ab4f6[_0x90b9('0x31')]['offset']);}_0x4ed665[_0x90b9('0x39')]=qs[_0x90b9('0x3a')](_0x1ab4f6[_0x90b9('0x31')][_0x90b9('0x3a')]);_0x4ed665['where']=qs[_0x90b9('0x3b')](_['pick'](_0x1ab4f6['query'],_0x1350b2[_0x90b9('0x3b')]),_0x4c3f15);if(_0x1ab4f6[_0x90b9('0x31')][_0x90b9('0x3c')]){_0x4ed665[_0x90b9('0x3d')]=_[_0x90b9('0x3e')](_0x4ed665[_0x90b9('0x3d')],{'$or':_[_0x90b9('0x2b')](_0x4c3f15,function(_0x755dcf){if(_0x755dcf[_0x90b9('0x2e')]!=='VIRTUAL'){var _0x179475={};_0x179475[_0x755dcf[_0x90b9('0x28')]]={'$like':'%'+_0x1ab4f6['query']['filter']+'%'};return _0x179475;}})});}_0x4ed665=_[_0x90b9('0x3e')]({},_0x4ed665,_0x1ab4f6[_0x90b9('0x3f')]);var _0x3c620d={'where':_0x4ed665[_0x90b9('0x3d')]};return db['AnalyticFieldReport'][_0x90b9('0x1e')](_0x3c620d)[_0x90b9('0x26')](function(_0x5a8aff){_0x8432ac[_0x90b9('0x1e')]=_0x5a8aff;if(_0x1ab4f6['query']['includeAll']){_0x4ed665[_0x90b9('0x40')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x90b9('0x41')](_0x4ed665);})['then'](function(_0x132202){_0x8432ac['rows']=_0x132202;return _0x8432ac;})[_0x90b9('0x26')](respondWithFilteredResult(_0x160729,_0x4ed665))['catch'](handleError(_0x160729,null));};exports['show']=function(_0x385a80,_0x45780b){var _0x9fb2d3={'raw':![],'where':{'id':_0x385a80[_0x90b9('0x42')]['id']}},_0x3eaff2={};_0x3eaff2[_0x90b9('0x30')]=_[_0x90b9('0x32')](db[_0x90b9('0x2c')]['rawAttributes']);_0x3eaff2['query']=_['keys'](_0x385a80['query']);_0x3eaff2[_0x90b9('0x3b')]=_[_0x90b9('0x33')](_0x3eaff2[_0x90b9('0x30')],_0x3eaff2[_0x90b9('0x31')]);_0x9fb2d3['attributes']=_[_0x90b9('0x33')](_0x3eaff2[_0x90b9('0x30')],qs[_0x90b9('0x34')](_0x385a80['query'][_0x90b9('0x34')]));_0x9fb2d3['attributes']=_0x9fb2d3[_0x90b9('0x35')][_0x90b9('0x36')]?_0x9fb2d3['attributes']:_0x3eaff2[_0x90b9('0x30')];if(_0x385a80[_0x90b9('0x31')][_0x90b9('0x43')]){_0x9fb2d3['include']=[{'all':!![]}];}_0x9fb2d3=_[_0x90b9('0x3e')]({},_0x9fb2d3,_0x385a80['options']);return db['AnalyticFieldReport'][_0x90b9('0x44')](_0x9fb2d3)['then'](handleEntityNotFound(_0x45780b,null))[_0x90b9('0x26')](respondWithResult(_0x45780b,null))[_0x90b9('0x45')](handleError(_0x45780b,null));};exports['create']=function(_0x11593b,_0x44849d){return db['AnalyticFieldReport'][_0x90b9('0x46')](_0x11593b[_0x90b9('0x47')],{})[_0x90b9('0x26')](respondWithResult(_0x44849d,0xc9))[_0x90b9('0x45')](handleError(_0x44849d,null));};exports['bulkCreate']=function(_0x57e514,_0x5ae415){return db[_0x90b9('0x2c')]['bulkCreate'](_0x57e514[_0x90b9('0x47')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x5ae415,0xc9))[_0x90b9('0x45')](handleError(_0x5ae415,null));};exports[_0x90b9('0x25')]=function(_0x5b88cf,_0x3da282){if(_0x5b88cf[_0x90b9('0x47')]['id']){delete _0x5b88cf['body']['id'];}return db['AnalyticFieldReport'][_0x90b9('0x44')]({'where':{'id':_0x5b88cf[_0x90b9('0x42')]['id']}})['then'](handleEntityNotFound(_0x3da282,null))['then'](saveUpdates(_0x5b88cf[_0x90b9('0x47')],null))[_0x90b9('0x26')](respondWithResult(_0x3da282,null))[_0x90b9('0x45')](handleError(_0x3da282,null));};exports[_0x90b9('0x48')]=function(_0x47095a,_0x4e8ebe){return db[_0x90b9('0x2c')][_0x90b9('0x44')]({'where':{'id':_0x47095a[_0x90b9('0x42')]['id']}})[_0x90b9('0x26')](handleEntityNotFound(_0x4e8ebe,null))[_0x90b9('0x26')](removeEntity(_0x4e8ebe,null))['catch'](handleError(_0x4e8ebe,null));};exports[_0x90b9('0x49')]=function(_0xf59833,_0x3d7ef0){return db[_0x90b9('0x2c')][_0x90b9('0x48')]({'where':{'id':_0xf59833['query'][_0x90b9('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0x90b9('0x26')](respondWithResult(_0x3d7ef0,0xcc))[_0x90b9('0x45')](handleError(_0x3d7ef0,null));};exports[_0x90b9('0x4b')]=function(_0x258671,_0x2e2e9b,_0x5d8b68){return db[_0x90b9('0x4c')][_0x90b9('0x4d')]({'where':{'id':_0x258671[_0x90b9('0x42')]['id']}})[_0x90b9('0x26')](handleEntityNotFound(_0x2e2e9b,null))[_0x90b9('0x26')](function(_0x1b9d42){if(_0x1b9d42){return db[_0x90b9('0x4e')]['transaction'](function(_0x1d4705){return db[_0x90b9('0x2c')][_0x90b9('0x48')]({'where':{'CustomReportId':_0x258671[_0x90b9('0x42')]['id']},'transaction':_0x1d4705})[_0x90b9('0x26')](function(_0x56d8aa){var _0xf6dc85=_[_0x90b9('0x2b')](_0x258671[_0x90b9('0x47')],function(_0x5af3f6){delete _0x5af3f6['id'];_0x5af3f6[_0x90b9('0x4f')]=_0x258671[_0x90b9('0x42')]['id'];return _0x5af3f6;});return db[_0x90b9('0x2c')][_0x90b9('0x50')](_0xf6dc85,{'transaction':_0x1d4705});});})[_0x90b9('0x26')](function(){return db[_0x90b9('0x2c')][_0x90b9('0x41')]({'where':{'CustomReportId':_0x258671[_0x90b9('0x42')]['id']}});});}})['then'](respondWithResult(_0x2e2e9b,null))[_0x90b9('0x45')](handleError(_0x2e2e9b,null));}; \ No newline at end of file +var _0x3b78=['end','offset','undefined','limit','count','json','apply','save','update','destroy','then','error','stack','name','send','index','AnalyticFieldReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','VIRTUAL','where','includeAll','include','rows','show','options','find','catch','create','bulkCreate','body','params','bulkDestroy','ids','findOne','sequelize','transaction','findAll','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status'];(function(_0x19832a,_0x30b1a5){var _0x287da5=function(_0x437e36){while(--_0x437e36){_0x19832a['push'](_0x19832a['shift']());}};_0x287da5(++_0x30b1a5);}(_0x3b78,0x1cb));var _0x83b7=function(_0x51f764,_0x4c5c26){_0x51f764=_0x51f764-0x0;var _0x40eee9=_0x3b78[_0x51f764];return _0x40eee9;};'use strict';var emlformat=require(_0x83b7('0x0'));var rimraf=require(_0x83b7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x83b7('0x2'));var moment=require(_0x83b7('0x3'));var BPromise=require(_0x83b7('0x4'));var Mustache=require('mustache');var util=require(_0x83b7('0x5'));var path=require(_0x83b7('0x6'));var sox=require(_0x83b7('0x7'));var csv=require(_0x83b7('0x8'));var ejs=require(_0x83b7('0x9'));var fs=require('fs');var fs_extra=require(_0x83b7('0xa'));var _=require(_0x83b7('0xb'));var squel=require(_0x83b7('0xc'));var crypto=require('crypto');var jsforce=require(_0x83b7('0xd'));var deskjs=require(_0x83b7('0xe'));var toCsv=require(_0x83b7('0x8'));var querystring=require(_0x83b7('0xf'));var Papa=require('papaparse');var Redis=require(_0x83b7('0x10'));var authService=require(_0x83b7('0x11'));var qs=require(_0x83b7('0x12'));var as=require(_0x83b7('0x13'));var hardwareService=require(_0x83b7('0x14'));var logger=require(_0x83b7('0x15'))(_0x83b7('0x16'));var utils=require(_0x83b7('0x17'));var config=require(_0x83b7('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x83b7('0x19'))['db'];function respondWithStatusCode(_0x43522d,_0x33340f){_0x33340f=_0x33340f||0xcc;return function(_0xbee060){if(_0xbee060){return _0x43522d['sendStatus'](_0x33340f);}return _0x43522d[_0x83b7('0x1a')](_0x33340f)[_0x83b7('0x1b')]();};}function respondWithResult(_0x513891,_0x17d5a1){_0x17d5a1=_0x17d5a1||0xc8;return function(_0x405c97){if(_0x405c97){return _0x513891[_0x83b7('0x1a')](_0x17d5a1)['json'](_0x405c97);}};}function respondWithFilteredResult(_0x2289a5,_0x147e1e){return function(_0xf4ccad){if(_0xf4ccad){var _0x47a7e3=typeof _0x147e1e[_0x83b7('0x1c')]===_0x83b7('0x1d')&&typeof _0x147e1e[_0x83b7('0x1e')]===_0x83b7('0x1d');var _0x529e4c=_0xf4ccad[_0x83b7('0x1f')];var _0x21fe9f=_0x47a7e3?0x0:_0x147e1e[_0x83b7('0x1c')];var _0x4ba517=_0x47a7e3?_0xf4ccad[_0x83b7('0x1f')]:_0x147e1e[_0x83b7('0x1c')]+_0x147e1e[_0x83b7('0x1e')];var _0x1775a5;if(_0x4ba517>=_0x529e4c){_0x4ba517=_0x529e4c;_0x1775a5=0xc8;}else{_0x1775a5=0xce;}_0x2289a5[_0x83b7('0x1a')](_0x1775a5);return _0x2289a5['set']('Content-Range',_0x21fe9f+'-'+_0x4ba517+'/'+_0x529e4c)[_0x83b7('0x20')](_0xf4ccad);}return null;};}function patchUpdates(_0x5e8a73){return function(_0x31252){try{jsonpatch[_0x83b7('0x21')](_0x31252,_0x5e8a73,!![]);}catch(_0x4f5643){return BPromise['reject'](_0x4f5643);}return _0x31252[_0x83b7('0x22')]();};}function saveUpdates(_0x488ef7,_0x596a03){return function(_0x28b4a5){if(_0x28b4a5){return _0x28b4a5[_0x83b7('0x23')](_0x488ef7)['then'](function(_0x7a42ef){return _0x7a42ef;});}return null;};}function removeEntity(_0x1f8106,_0x13fdc6){return function(_0xb71792){if(_0xb71792){return _0xb71792[_0x83b7('0x24')]()[_0x83b7('0x25')](function(){_0x1f8106[_0x83b7('0x1a')](0xcc)[_0x83b7('0x1b')]();});}};}function handleEntityNotFound(_0x1075d8,_0x10fcfa){return function(_0x1acb0c){if(!_0x1acb0c){_0x1075d8['sendStatus'](0x194);}return _0x1acb0c;};}function handleError(_0x10ff43,_0x5e0da8){_0x5e0da8=_0x5e0da8||0x1f4;return function(_0xe7d4d){logger[_0x83b7('0x26')](_0xe7d4d[_0x83b7('0x27')]);if(_0xe7d4d['name']){delete _0xe7d4d[_0x83b7('0x28')];}_0x10ff43[_0x83b7('0x1a')](_0x5e0da8)[_0x83b7('0x29')](_0xe7d4d);};}exports[_0x83b7('0x2a')]=function(_0x2c6d01,_0x45b123){var _0x2c5275={},_0x332edf={},_0x5d8c16={'count':0x0,'rows':[]};var _0x1997c8=_['map'](db[_0x83b7('0x2b')][_0x83b7('0x2c')],function(_0x47819a){return{'name':_0x47819a[_0x83b7('0x2d')],'type':_0x47819a[_0x83b7('0x2e')]['key']};});_0x332edf[_0x83b7('0x2f')]=_[_0x83b7('0x30')](_0x1997c8,_0x83b7('0x28'));_0x332edf[_0x83b7('0x31')]=_[_0x83b7('0x32')](_0x2c6d01[_0x83b7('0x31')]);_0x332edf[_0x83b7('0x33')]=_[_0x83b7('0x34')](_0x332edf[_0x83b7('0x2f')],_0x332edf[_0x83b7('0x31')]);_0x2c5275[_0x83b7('0x35')]=_[_0x83b7('0x34')](_0x332edf[_0x83b7('0x2f')],qs['fields'](_0x2c6d01[_0x83b7('0x31')][_0x83b7('0x36')]));_0x2c5275[_0x83b7('0x35')]=_0x2c5275[_0x83b7('0x35')][_0x83b7('0x37')]?_0x2c5275[_0x83b7('0x35')]:_0x332edf['model'];if(!_0x2c6d01['query']['hasOwnProperty'](_0x83b7('0x38'))){_0x2c5275[_0x83b7('0x1e')]=qs[_0x83b7('0x1e')](_0x2c6d01[_0x83b7('0x31')]['limit']);_0x2c5275[_0x83b7('0x1c')]=qs[_0x83b7('0x1c')](_0x2c6d01['query'][_0x83b7('0x1c')]);}_0x2c5275[_0x83b7('0x39')]=qs[_0x83b7('0x3a')](_0x2c6d01[_0x83b7('0x31')][_0x83b7('0x3a')]);_0x2c5275['where']=qs[_0x83b7('0x33')](_[_0x83b7('0x3b')](_0x2c6d01[_0x83b7('0x31')],_0x332edf[_0x83b7('0x33')]),_0x1997c8);if(_0x2c6d01[_0x83b7('0x31')][_0x83b7('0x3c')]){_0x2c5275['where']=_[_0x83b7('0x3d')](_0x2c5275['where'],{'$or':_['map'](_0x1997c8,function(_0xd9787){if(_0xd9787[_0x83b7('0x2e')]!==_0x83b7('0x3e')){var _0x3d57f0={};_0x3d57f0[_0xd9787[_0x83b7('0x28')]]={'$like':'%'+_0x2c6d01['query']['filter']+'%'};return _0x3d57f0;}})});}_0x2c5275=_['merge']({},_0x2c5275,_0x2c6d01['options']);var _0x43bdf9={'where':_0x2c5275[_0x83b7('0x3f')]};return db[_0x83b7('0x2b')][_0x83b7('0x1f')](_0x43bdf9)[_0x83b7('0x25')](function(_0x2b0bb3){_0x5d8c16['count']=_0x2b0bb3;if(_0x2c6d01[_0x83b7('0x31')][_0x83b7('0x40')]){_0x2c5275[_0x83b7('0x41')]=[{'all':!![]}];}return db[_0x83b7('0x2b')]['findAll'](_0x2c5275);})[_0x83b7('0x25')](function(_0x32054b){_0x5d8c16[_0x83b7('0x42')]=_0x32054b;return _0x5d8c16;})[_0x83b7('0x25')](respondWithFilteredResult(_0x45b123,_0x2c5275))['catch'](handleError(_0x45b123,null));};exports[_0x83b7('0x43')]=function(_0x5fcc14,_0x17fd48){var _0x496988={'raw':![],'where':{'id':_0x5fcc14['params']['id']}},_0x527644={};_0x527644[_0x83b7('0x2f')]=_[_0x83b7('0x32')](db[_0x83b7('0x2b')][_0x83b7('0x2c')]);_0x527644[_0x83b7('0x31')]=_['keys'](_0x5fcc14[_0x83b7('0x31')]);_0x527644[_0x83b7('0x33')]=_['intersection'](_0x527644[_0x83b7('0x2f')],_0x527644[_0x83b7('0x31')]);_0x496988['attributes']=_[_0x83b7('0x34')](_0x527644[_0x83b7('0x2f')],qs['fields'](_0x5fcc14[_0x83b7('0x31')][_0x83b7('0x36')]));_0x496988[_0x83b7('0x35')]=_0x496988['attributes'][_0x83b7('0x37')]?_0x496988[_0x83b7('0x35')]:_0x527644[_0x83b7('0x2f')];if(_0x5fcc14[_0x83b7('0x31')][_0x83b7('0x40')]){_0x496988[_0x83b7('0x41')]=[{'all':!![]}];}_0x496988=_['merge']({},_0x496988,_0x5fcc14[_0x83b7('0x44')]);return db[_0x83b7('0x2b')][_0x83b7('0x45')](_0x496988)[_0x83b7('0x25')](handleEntityNotFound(_0x17fd48,null))[_0x83b7('0x25')](respondWithResult(_0x17fd48,null))[_0x83b7('0x46')](handleError(_0x17fd48,null));};exports[_0x83b7('0x47')]=function(_0x3910d1,_0x278a22){return db[_0x83b7('0x2b')][_0x83b7('0x47')](_0x3910d1['body'],{})['then'](respondWithResult(_0x278a22,0xc9))[_0x83b7('0x46')](handleError(_0x278a22,null));};exports[_0x83b7('0x48')]=function(_0x2c68a8,_0x95414c){return db['AnalyticFieldReport']['bulkCreate'](_0x2c68a8[_0x83b7('0x49')],{'raw':![],'individualHooks':!![]})[_0x83b7('0x25')](respondWithResult(_0x95414c,0xc9))[_0x83b7('0x46')](handleError(_0x95414c,null));};exports[_0x83b7('0x23')]=function(_0x1422f7,_0x484aa9){if(_0x1422f7[_0x83b7('0x49')]['id']){delete _0x1422f7['body']['id'];}return db[_0x83b7('0x2b')][_0x83b7('0x45')]({'where':{'id':_0x1422f7['params']['id']}})['then'](handleEntityNotFound(_0x484aa9,null))[_0x83b7('0x25')](saveUpdates(_0x1422f7[_0x83b7('0x49')],null))[_0x83b7('0x25')](respondWithResult(_0x484aa9,null))[_0x83b7('0x46')](handleError(_0x484aa9,null));};exports[_0x83b7('0x24')]=function(_0x214ceb,_0x36057c){return db['AnalyticFieldReport']['find']({'where':{'id':_0x214ceb[_0x83b7('0x4a')]['id']}})[_0x83b7('0x25')](handleEntityNotFound(_0x36057c,null))[_0x83b7('0x25')](removeEntity(_0x36057c,null))[_0x83b7('0x46')](handleError(_0x36057c,null));};exports[_0x83b7('0x4b')]=function(_0x5ae60d,_0x389860){return db[_0x83b7('0x2b')][_0x83b7('0x24')]({'where':{'id':_0x5ae60d['query'][_0x83b7('0x4c')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x389860,0xcc))[_0x83b7('0x46')](handleError(_0x389860,null));};exports['addFields']=function(_0x9fc8db,_0x32cebe,_0x2fbb47){return db['AnalyticCustomReport'][_0x83b7('0x4d')]({'where':{'id':_0x9fc8db[_0x83b7('0x4a')]['id']}})[_0x83b7('0x25')](handleEntityNotFound(_0x32cebe,null))['then'](function(_0x55c55a){if(_0x55c55a){return db[_0x83b7('0x4e')][_0x83b7('0x4f')](function(_0x123fe8){return db[_0x83b7('0x2b')]['destroy']({'where':{'CustomReportId':_0x9fc8db['params']['id']},'transaction':_0x123fe8})['then'](function(_0x23c93f){var _0x2ca7cd=_['map'](_0x9fc8db[_0x83b7('0x49')],function(_0x53fea5){delete _0x53fea5['id'];_0x53fea5['CustomReportId']=_0x9fc8db[_0x83b7('0x4a')]['id'];return _0x53fea5;});return db[_0x83b7('0x2b')]['bulkCreate'](_0x2ca7cd,{'transaction':_0x123fe8});});})[_0x83b7('0x25')](function(){return db[_0x83b7('0x2b')][_0x83b7('0x50')]({'where':{'CustomReportId':_0x9fc8db['params']['id']}});});}})['then'](respondWithResult(_0x32cebe,null))[_0x83b7('0x46')](handleError(_0x32cebe,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index c1e4118..6f78e84 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 _0x3cd2=['request-promise','path','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','lodash','util','../../config/logger','moment'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3cd2,0x18c));var _0x23cd=function(_0x3644f9,_0x501c12){_0x3644f9=_0x3644f9-0x0;var _0x5aaa15=_0x3cd2[_0x3644f9];return _0x5aaa15;};'use strict';var _=require(_0x23cd('0x0'));var util=require(_0x23cd('0x1'));var logger=require(_0x23cd('0x2'))('api');var moment=require(_0x23cd('0x3'));var BPromise=require('bluebird');var rp=require(_0x23cd('0x4'));var fs=require('fs');var path=require(_0x23cd('0x5'));var rimraf=require('rimraf');var config=require(_0x23cd('0x6'));var attributes=require(_0x23cd('0x7'));module[_0x23cd('0x8')]=function(_0x257f43,_0x1b4222){return _0x257f43['define'](_0x23cd('0x9'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa407=['../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','api','moment','path','rimraf'];(function(_0x330414,_0x4f3207){var _0x99dbff=function(_0x166f85){while(--_0x166f85){_0x330414['push'](_0x330414['shift']());}};_0x99dbff(++_0x4f3207);}(_0xa407,0x16e));var _0x7a40=function(_0x37c3bd,_0x51bf68){_0x37c3bd=_0x37c3bd-0x0;var _0x51147d=_0xa407[_0x37c3bd];return _0x51147d;};'use strict';var _=require(_0x7a40('0x0'));var util=require('util');var logger=require(_0x7a40('0x1'))(_0x7a40('0x2'));var moment=require(_0x7a40('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a40('0x4'));var rimraf=require(_0x7a40('0x5'));var config=require(_0x7a40('0x6'));var attributes=require(_0x7a40('0x7'));module[_0x7a40('0x8')]=function(_0x224d1,_0x4363ca){return _0x224d1[_0x7a40('0x9')](_0x7a40('0xa'),attributes,{'tableName':_0x7a40('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 2d7a442..31a3eaf 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 _0x5cfd=['client','http','request','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0xf2dad0,_0x499aa9){var _0x447e18=function(_0x5df4ca){while(--_0x5df4ca){_0xf2dad0['push'](_0xf2dad0['shift']());}};_0x447e18(++_0x499aa9);}(_0x5cfd,0xdd));var _0xd5cf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5cfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd5cf('0x0'));var util=require(_0xd5cf('0x1'));var moment=require(_0xd5cf('0x2'));var BPromise=require('bluebird');var rs=require(_0xd5cf('0x3'));var fs=require('fs');var Redis=require(_0xd5cf('0x4'));var db=require(_0xd5cf('0x5'))['db'];var utils=require(_0xd5cf('0x6'));var logger=require(_0xd5cf('0x7'))('rpc');var config=require(_0xd5cf('0x8'));var jayson=require(_0xd5cf('0x9'));var client=jayson[_0xd5cf('0xa')][_0xd5cf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4924f3,_0x22f7a3,_0x264443){return new BPromise(function(_0x20e01d,_0x5b221a){return client[_0xd5cf('0xc')](_0x4924f3,_0x264443)['then'](function(_0x456632){logger['info'](_0xd5cf('0xd'),_0x22f7a3,_0xd5cf('0xe'));logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x22f7a3,_0xd5cf('0xe'),JSON[_0xd5cf('0xf')](_0x456632));if(_0x456632[_0xd5cf('0x10')]){if(_0x456632[_0xd5cf('0x10')]['code']===0x1f4){logger[_0xd5cf('0x10')](_0xd5cf('0xd'),_0x22f7a3,_0x456632[_0xd5cf('0x10')][_0xd5cf('0x11')]);return _0x5b221a(_0x456632[_0xd5cf('0x10')]['message']);}logger[_0xd5cf('0x10')](_0xd5cf('0xd'),_0x22f7a3,_0x456632[_0xd5cf('0x10')][_0xd5cf('0x11')]);return _0x20e01d(_0x456632[_0xd5cf('0x10')][_0xd5cf('0x11')]);}else{logger[_0xd5cf('0x12')](_0xd5cf('0xd'),_0x22f7a3,_0xd5cf('0xe'));_0x20e01d(_0x456632[_0xd5cf('0x13')]['message']);}})[_0xd5cf('0x14')](function(_0x14c467){logger[_0xd5cf('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x22f7a3,_0x14c467);_0x5b221a(_0x14c467);});});} \ No newline at end of file +var _0x7737=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','bluebird','randomstring'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7737,0x178));var _0x7773=function(_0x9c1f48,_0x25da55){_0x9c1f48=_0x9c1f48-0x0;var _0x52ecd4=_0x7737[_0x9c1f48];return _0x52ecd4;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x7773('0x0'));var rs=require(_0x7773('0x1'));var fs=require('fs');var Redis=require(_0x7773('0x2'));var db=require(_0x7773('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7773('0x4'));var config=require(_0x7773('0x5'));var jayson=require(_0x7773('0x6'));var client=jayson['client'][_0x7773('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x27f538,_0x5c5e0d,_0x5a2221){return new BPromise(function(_0x3d350d,_0x3e393f){return client[_0x7773('0x8')](_0x27f538,_0x5a2221)[_0x7773('0x9')](function(_0x30102a){logger[_0x7773('0xa')](_0x7773('0xb'),_0x5c5e0d,_0x7773('0xc'));logger[_0x7773('0xd')](_0x7773('0xe'),_0x5c5e0d,'request\x20sent',JSON[_0x7773('0xf')](_0x30102a));if(_0x30102a['error']){if(_0x30102a['error'][_0x7773('0x10')]===0x1f4){logger['error'](_0x7773('0xb'),_0x5c5e0d,_0x30102a[_0x7773('0x11')][_0x7773('0x12')]);return _0x3e393f(_0x30102a[_0x7773('0x11')]['message']);}logger['error'](_0x7773('0xb'),_0x5c5e0d,_0x30102a[_0x7773('0x11')]['message']);return _0x3d350d(_0x30102a[_0x7773('0x11')][_0x7773('0x12')]);}else{logger[_0x7773('0xa')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5c5e0d,_0x7773('0xc'));_0x3d350d(_0x30102a[_0x7773('0x13')][_0x7773('0x12')]);}})[_0x7773('0x14')](function(_0x1163f5){logger[_0x7773('0x11')](_0x7773('0xb'),_0x5c5e0d,_0x1163f5);_0x3e393f(_0x1163f5);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 6162445..af66b0c 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(_0x63ef97,_0x457ea8){var _0x1d7e21=function(_0xda9eae){while(--_0xda9eae){_0x63ef97['push'](_0x63ef97['shift']());}};_0x1d7e21(++_0x457ea8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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(_0x4885b0,_0x3db942){var _0x3604b5=function(_0xeb63f3){while(--_0xeb63f3){_0x4885b0['push'](_0x4885b0['shift']());}};_0x3604b5(++_0x3db942);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index ea323fe..9540f78 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 _0xbee0=['STRING','name','TEXT','exports'];(function(_0x564f68,_0x4da1ff){var _0x4330f5=function(_0x3c546d){while(--_0x3c546d){_0x564f68['push'](_0x564f68['shift']());}};_0x4330f5(++_0x4da1ff);}(_0xbee0,0x147));var _0x0bee=function(_0x162707,_0x4059d7){_0x162707=_0x162707-0x0;var _0x4e2fd5=_0xbee0[_0x162707];return _0x4e2fd5;};'use strict';var Sequelize=require('sequelize');module[_0x0bee('0x0')]={'name':{'type':Sequelize[_0x0bee('0x1')],'allowNull':![],'unique':_0x0bee('0x2')},'table':{'type':Sequelize[_0x0bee('0x1')]},'metric':{'type':Sequelize[_0x0bee('0x3')]},'description':{'type':Sequelize[_0x0bee('0x1')]}}; \ No newline at end of file +var _0x3ee7=['exports','STRING'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x3ee7,0x98));var _0x73ee=function(_0x23bd05,_0x409ba8){_0x23bd05=_0x23bd05-0x0;var _0x2ea842=_0x3ee7[_0x23bd05];return _0x2ea842;};'use strict';var Sequelize=require('sequelize');module[_0x73ee('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x73ee('0x1')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x73ee('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 31aaa47..55dde0e 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 _0x8ef6=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','index','map','fieldName','key','model','keys','query','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','options','AnalyticMetric','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x22a112,_0x4ef65c){var _0x83d8c7=function(_0x39a793){while(--_0x39a793){_0x22a112['push'](_0x22a112['shift']());}};_0x83d8c7(++_0x4ef65c);}(_0x8ef6,0xf2));var _0x68ef=function(_0x2c6a9d,_0x8479bc){_0x2c6a9d=_0x2c6a9d-0x0;var _0x22181e=_0x8ef6[_0x2c6a9d];return _0x22181e;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];function respondWithStatusCode(_0x1e117a,_0x454ef4){_0x454ef4=_0x454ef4||0xcc;return function(_0x40f253){if(_0x40f253){return _0x1e117a[_0x68ef('0x1b')](_0x454ef4);}return _0x1e117a['status'](_0x454ef4)[_0x68ef('0x1c')]();};}function respondWithResult(_0xc50cce,_0x2657c5){_0x2657c5=_0x2657c5||0xc8;return function(_0x47fbb5){if(_0x47fbb5){return _0xc50cce[_0x68ef('0x1d')](_0x2657c5)[_0x68ef('0x1e')](_0x47fbb5);}};}function respondWithFilteredResult(_0x24682d,_0x5005ba){return function(_0x35493d){if(_0x35493d){var _0x37c4cc=typeof _0x5005ba[_0x68ef('0x1f')]===_0x68ef('0x20')&&typeof _0x5005ba['limit']===_0x68ef('0x20');var _0x54139e=_0x35493d['count'];var _0x2633c1=_0x37c4cc?0x0:_0x5005ba[_0x68ef('0x1f')];var _0x4ade0d=_0x37c4cc?_0x35493d['count']:_0x5005ba[_0x68ef('0x1f')]+_0x5005ba[_0x68ef('0x21')];var _0x318514;if(_0x4ade0d>=_0x54139e){_0x4ade0d=_0x54139e;_0x318514=0xc8;}else{_0x318514=0xce;}_0x24682d['status'](_0x318514);return _0x24682d[_0x68ef('0x22')](_0x68ef('0x23'),_0x2633c1+'-'+_0x4ade0d+'/'+_0x54139e)[_0x68ef('0x1e')](_0x35493d);}return null;};}function patchUpdates(_0x5b246b){return function(_0x3c46d4){try{jsonpatch[_0x68ef('0x24')](_0x3c46d4,_0x5b246b,!![]);}catch(_0x5af19f){return BPromise[_0x68ef('0x25')](_0x5af19f);}return _0x3c46d4[_0x68ef('0x26')]();};}function saveUpdates(_0x19aa3d,_0x5ddec7){return function(_0x59723c){if(_0x59723c){return _0x59723c['update'](_0x19aa3d)[_0x68ef('0x27')](function(_0x2023f2){return _0x2023f2;});}return null;};}function removeEntity(_0x312cc9,_0x2e6e39){return function(_0x438b4c){if(_0x438b4c){return _0x438b4c[_0x68ef('0x28')]()[_0x68ef('0x27')](function(){var _0x49374f=_0x438b4c[_0x68ef('0x29')]({'plain':!![]});var _0x13280b='Metrics';return db[_0x68ef('0x2a')]['destroy']({'where':{'type':_0x13280b,'resourceId':_0x49374f['id']}})['then'](function(){return _0x438b4c;});})['then'](function(){_0x312cc9[_0x68ef('0x1d')](0xcc)[_0x68ef('0x1c')]();});}};}function handleEntityNotFound(_0x123041,_0x29518e){return function(_0x52e67e){if(!_0x52e67e){_0x123041['sendStatus'](0x194);}return _0x52e67e;};}function handleError(_0x1cbe4f,_0x28907a){_0x28907a=_0x28907a||0x1f4;return function(_0x7bf96){logger[_0x68ef('0x2b')](_0x7bf96[_0x68ef('0x2c')]);if(_0x7bf96[_0x68ef('0x2d')]){delete _0x7bf96[_0x68ef('0x2d')];}_0x1cbe4f[_0x68ef('0x1d')](_0x28907a)['send'](_0x7bf96);};}exports[_0x68ef('0x2e')]=function(_0x4314bd,_0x132d9e){var _0x4c25aa={},_0x370a8f={},_0x523120={'count':0x0,'rows':[]};var _0x133788=_[_0x68ef('0x2f')](db['AnalyticMetric']['rawAttributes'],function(_0x159395){return{'name':_0x159395[_0x68ef('0x30')],'type':_0x159395['type'][_0x68ef('0x31')]};});_0x370a8f[_0x68ef('0x32')]=_[_0x68ef('0x2f')](_0x133788,_0x68ef('0x2d'));_0x370a8f['query']=_[_0x68ef('0x33')](_0x4314bd[_0x68ef('0x34')]);_0x370a8f['filters']=_[_0x68ef('0x35')](_0x370a8f['model'],_0x370a8f[_0x68ef('0x34')]);_0x4c25aa[_0x68ef('0x36')]=_['intersection'](_0x370a8f[_0x68ef('0x32')],qs['fields'](_0x4314bd[_0x68ef('0x34')]['fields']));_0x4c25aa[_0x68ef('0x36')]=_0x4c25aa[_0x68ef('0x36')][_0x68ef('0x37')]?_0x4c25aa['attributes']:_0x370a8f[_0x68ef('0x32')];if(!_0x4314bd['query'][_0x68ef('0x38')]('nolimit')){_0x4c25aa[_0x68ef('0x21')]=qs[_0x68ef('0x21')](_0x4314bd[_0x68ef('0x34')][_0x68ef('0x21')]);_0x4c25aa[_0x68ef('0x1f')]=qs[_0x68ef('0x1f')](_0x4314bd['query'][_0x68ef('0x1f')]);}_0x4c25aa[_0x68ef('0x39')]=qs[_0x68ef('0x3a')](_0x4314bd['query'][_0x68ef('0x3a')]);_0x4c25aa[_0x68ef('0x3b')]=qs[_0x68ef('0x3c')](_['pick'](_0x4314bd['query'],_0x370a8f[_0x68ef('0x3c')]),_0x133788);if(_0x4314bd[_0x68ef('0x34')][_0x68ef('0x3d')]){_0x4c25aa[_0x68ef('0x3b')]=_[_0x68ef('0x3e')](_0x4c25aa[_0x68ef('0x3b')],{'$or':_[_0x68ef('0x2f')](_0x133788,function(_0x5b1246){if(_0x5b1246[_0x68ef('0x3f')]!==_0x68ef('0x40')){var _0x2f6ee0={};_0x2f6ee0[_0x5b1246[_0x68ef('0x2d')]]={'$like':'%'+_0x4314bd['query'][_0x68ef('0x3d')]+'%'};return _0x2f6ee0;}})});}_0x4c25aa=_[_0x68ef('0x3e')]({},_0x4c25aa,_0x4314bd[_0x68ef('0x41')]);var _0x410c10={'where':_0x4c25aa[_0x68ef('0x3b')]};return db[_0x68ef('0x42')]['count'](_0x410c10)[_0x68ef('0x27')](function(_0x3f7699){_0x523120[_0x68ef('0x43')]=_0x3f7699;if(_0x4314bd[_0x68ef('0x34')][_0x68ef('0x44')]){_0x4c25aa[_0x68ef('0x45')]=[{'all':!![]}];}return db[_0x68ef('0x42')][_0x68ef('0x46')](_0x4c25aa);})[_0x68ef('0x27')](function(_0x531096){_0x523120[_0x68ef('0x47')]=_0x531096;return _0x523120;})[_0x68ef('0x27')](respondWithFilteredResult(_0x132d9e,_0x4c25aa))[_0x68ef('0x48')](handleError(_0x132d9e,null));};exports[_0x68ef('0x49')]=function(_0xdeacf2,_0x183377){var _0xcac58f={'raw':!![],'where':{'id':_0xdeacf2[_0x68ef('0x4a')]['id']}},_0x576767={};_0x576767['model']=_[_0x68ef('0x33')](db[_0x68ef('0x42')][_0x68ef('0x4b')]);_0x576767[_0x68ef('0x34')]=_['keys'](_0xdeacf2[_0x68ef('0x34')]);_0x576767['filters']=_[_0x68ef('0x35')](_0x576767['model'],_0x576767[_0x68ef('0x34')]);_0xcac58f[_0x68ef('0x36')]=_[_0x68ef('0x35')](_0x576767['model'],qs['fields'](_0xdeacf2[_0x68ef('0x34')][_0x68ef('0x4c')]));_0xcac58f['attributes']=_0xcac58f['attributes']['length']?_0xcac58f[_0x68ef('0x36')]:_0x576767[_0x68ef('0x32')];if(_0xdeacf2[_0x68ef('0x34')][_0x68ef('0x44')]){_0xcac58f[_0x68ef('0x45')]=[{'all':!![]}];}_0xcac58f=_['merge']({},_0xcac58f,_0xdeacf2['options']);return db[_0x68ef('0x42')][_0x68ef('0x4d')](_0xcac58f)[_0x68ef('0x27')](handleEntityNotFound(_0x183377,null))[_0x68ef('0x27')](respondWithResult(_0x183377,null))['catch'](handleError(_0x183377,null));};exports[_0x68ef('0x4e')]=function(_0x474e5a,_0x1c9b6f){return db[_0x68ef('0x42')]['create'](_0x474e5a['body'],{})[_0x68ef('0x27')](function(_0x3c3074){var _0x566e7c=_0x474e5a[_0x68ef('0x4f')][_0x68ef('0x29')]({'plain':!![]});if(!_0x566e7c)throw new Error(_0x68ef('0x50'));if(_0x566e7c[_0x68ef('0x51')]===_0x68ef('0x4f')){var _0x4f0f77=_0x3c3074[_0x68ef('0x29')]({'plain':!![]});var _0x3984ca=_0x68ef('0x52');return db['UserProfileSection'][_0x68ef('0x4d')]({'where':{'name':_0x3984ca,'userProfileId':_0x566e7c[_0x68ef('0x53')]},'raw':!![]})[_0x68ef('0x27')](function(_0x50ef1f){if(_0x50ef1f&&_0x50ef1f[_0x68ef('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x4f0f77[_0x68ef('0x2d')],'resourceId':_0x4f0f77['id'],'type':_0x50ef1f['name'],'sectionId':_0x50ef1f['id']},{})[_0x68ef('0x27')](function(){return _0x3c3074;});}else{return _0x3c3074;}})[_0x68ef('0x48')](function(_0x53ebd){logger[_0x68ef('0x2b')](_0x68ef('0x55'),_0x53ebd);throw _0x53ebd;});}return _0x3c3074;})[_0x68ef('0x27')](respondWithResult(_0x1c9b6f,0xc9))[_0x68ef('0x48')](handleError(_0x1c9b6f,null));};exports[_0x68ef('0x56')]=function(_0x2b35f4,_0x247915){if(_0x2b35f4['body']['id']){delete _0x2b35f4['body']['id'];}return db[_0x68ef('0x42')][_0x68ef('0x4d')]({'where':{'id':_0x2b35f4[_0x68ef('0x4a')]['id']}})[_0x68ef('0x27')](handleEntityNotFound(_0x247915,null))[_0x68ef('0x27')](saveUpdates(_0x2b35f4[_0x68ef('0x57')],null))[_0x68ef('0x27')](respondWithResult(_0x247915,null))[_0x68ef('0x48')](handleError(_0x247915,null));};exports[_0x68ef('0x28')]=function(_0x4c2e9c,_0x5685bb){return db[_0x68ef('0x42')]['find']({'where':{'id':_0x4c2e9c[_0x68ef('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5685bb,null))[_0x68ef('0x27')](removeEntity(_0x5685bb,null))[_0x68ef('0x48')](handleError(_0x5685bb,null));}; \ No newline at end of file +var _0x55ca=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','get','Metrics','UserProfileResource','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','AnalyticMetric','findAll','catch','show','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x46ad10,_0x55f736){var _0x3ff9ea=function(_0x3e347a){while(--_0x3e347a){_0x46ad10['push'](_0x46ad10['shift']());}};_0x3ff9ea(++_0x55f736);}(_0x55ca,0x126));var _0xa55c=function(_0x1defb2,_0x429099){_0x1defb2=_0x1defb2-0x0;var _0xad8973=_0x55ca[_0x1defb2];return _0xad8973;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){var _0x54b038=_0x5ba836[_0xa55c('0x21')]({'plain':!![]});var _0x190757=_0xa55c('0x22');return db[_0xa55c('0x23')][_0xa55c('0x24')]({'where':{'type':_0x190757,'resourceId':_0x54b038['id']}})[_0xa55c('0x20')](function(){return _0x5ba836;});})[_0xa55c('0x20')](function(){_0x1fc828[_0xa55c('0x18')](0xcc)[_0xa55c('0x25')]();});}};}function handleEntityNotFound(_0x3cd152,_0x1273d7){return function(_0x57f271){if(!_0x57f271){_0x3cd152[_0xa55c('0x26')](0x194);}return _0x57f271;};}function handleError(_0x28814f,_0x1c9f6b){_0x1c9f6b=_0x1c9f6b||0x1f4;return function(_0x906caa){logger['error'](_0x906caa[_0xa55c('0x27')]);if(_0x906caa[_0xa55c('0x28')]){delete _0x906caa[_0xa55c('0x28')];}_0x28814f[_0xa55c('0x18')](_0x1c9f6b)[_0xa55c('0x29')](_0x906caa);};}exports[_0xa55c('0x2a')]=function(_0x52d37f,_0x23e698){var _0x490b7d={},_0x35c9c2={},_0x1d730b={'count':0x0,'rows':[]};var _0x1cc53e=_[_0xa55c('0x2b')](db['AnalyticMetric'][_0xa55c('0x2c')],function(_0x2096ae){return{'name':_0x2096ae[_0xa55c('0x2d')],'type':_0x2096ae[_0xa55c('0x2e')][_0xa55c('0x2f')]};});_0x35c9c2[_0xa55c('0x30')]=_[_0xa55c('0x2b')](_0x1cc53e,_0xa55c('0x28'));_0x35c9c2[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x52d37f[_0xa55c('0x31')]);_0x35c9c2['filters']=_['intersection'](_0x35c9c2[_0xa55c('0x30')],_0x35c9c2[_0xa55c('0x31')]);_0x490b7d['attributes']=_[_0xa55c('0x33')](_0x35c9c2[_0xa55c('0x30')],qs[_0xa55c('0x34')](_0x52d37f[_0xa55c('0x31')][_0xa55c('0x34')]));_0x490b7d[_0xa55c('0x35')]=_0x490b7d[_0xa55c('0x35')][_0xa55c('0x36')]?_0x490b7d[_0xa55c('0x35')]:_0x35c9c2['model'];if(!_0x52d37f['query']['hasOwnProperty'](_0xa55c('0x37'))){_0x490b7d[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x52d37f['query'][_0xa55c('0x1c')]);_0x490b7d['offset']=qs[_0xa55c('0x1a')](_0x52d37f['query'][_0xa55c('0x1a')]);}_0x490b7d[_0xa55c('0x38')]=qs[_0xa55c('0x39')](_0x52d37f['query'][_0xa55c('0x39')]);_0x490b7d[_0xa55c('0x3a')]=qs['filters'](_[_0xa55c('0x3b')](_0x52d37f[_0xa55c('0x31')],_0x35c9c2['filters']),_0x1cc53e);if(_0x52d37f['query'][_0xa55c('0x3c')]){_0x490b7d['where']=_[_0xa55c('0x3d')](_0x490b7d[_0xa55c('0x3a')],{'$or':_['map'](_0x1cc53e,function(_0x542d76){if(_0x542d76['type']!=='VIRTUAL'){var _0x3b3308={};_0x3b3308[_0x542d76[_0xa55c('0x28')]]={'$like':'%'+_0x52d37f[_0xa55c('0x31')][_0xa55c('0x3c')]+'%'};return _0x3b3308;}})});}_0x490b7d=_[_0xa55c('0x3d')]({},_0x490b7d,_0x52d37f['options']);var _0x3d52d8={'where':_0x490b7d[_0xa55c('0x3a')]};return db[_0xa55c('0x3e')][_0xa55c('0x1d')](_0x3d52d8)[_0xa55c('0x20')](function(_0x23cef5){_0x1d730b['count']=_0x23cef5;if(_0x52d37f[_0xa55c('0x31')]['includeAll']){_0x490b7d['include']=[{'all':!![]}];}return db[_0xa55c('0x3e')][_0xa55c('0x3f')](_0x490b7d);})['then'](function(_0x2bd98b){_0x1d730b['rows']=_0x2bd98b;return _0x1d730b;})['then'](respondWithFilteredResult(_0x23e698,_0x490b7d))[_0xa55c('0x40')](handleError(_0x23e698,null));};exports[_0xa55c('0x41')]=function(_0x1630ac,_0x540337){var _0x1b2708={'raw':!![],'where':{'id':_0x1630ac['params']['id']}},_0xd5a006={};_0xd5a006[_0xa55c('0x30')]=_['keys'](db[_0xa55c('0x3e')][_0xa55c('0x2c')]);_0xd5a006['query']=_[_0xa55c('0x32')](_0x1630ac[_0xa55c('0x31')]);_0xd5a006['filters']=_[_0xa55c('0x33')](_0xd5a006[_0xa55c('0x30')],_0xd5a006[_0xa55c('0x31')]);_0x1b2708['attributes']=_[_0xa55c('0x33')](_0xd5a006['model'],qs[_0xa55c('0x34')](_0x1630ac[_0xa55c('0x31')][_0xa55c('0x34')]));_0x1b2708['attributes']=_0x1b2708[_0xa55c('0x35')][_0xa55c('0x36')]?_0x1b2708['attributes']:_0xd5a006[_0xa55c('0x30')];if(_0x1630ac[_0xa55c('0x31')]['includeAll']){_0x1b2708[_0xa55c('0x42')]=[{'all':!![]}];}_0x1b2708=_[_0xa55c('0x3d')]({},_0x1b2708,_0x1630ac['options']);return db[_0xa55c('0x3e')][_0xa55c('0x43')](_0x1b2708)[_0xa55c('0x20')](handleEntityNotFound(_0x540337,null))[_0xa55c('0x20')](respondWithResult(_0x540337,null))['catch'](handleError(_0x540337,null));};exports[_0xa55c('0x44')]=function(_0x58a7ea,_0x2157d6){return db[_0xa55c('0x3e')][_0xa55c('0x44')](_0x58a7ea['body'],{})[_0xa55c('0x20')](function(_0x250b00){var _0x574fe9=_0x58a7ea[_0xa55c('0x45')][_0xa55c('0x21')]({'plain':!![]});if(!_0x574fe9)throw new Error(_0xa55c('0x46'));if(_0x574fe9[_0xa55c('0x47')]===_0xa55c('0x45')){var _0x1c84d9=_0x250b00[_0xa55c('0x21')]({'plain':!![]});var _0x129626=_0xa55c('0x22');return db[_0xa55c('0x48')]['find']({'where':{'name':_0x129626,'userProfileId':_0x574fe9[_0xa55c('0x49')]},'raw':!![]})[_0xa55c('0x20')](function(_0x216de8){if(_0x216de8&&_0x216de8['autoAssociation']===0x0){return db[_0xa55c('0x23')][_0xa55c('0x44')]({'name':_0x1c84d9['name'],'resourceId':_0x1c84d9['id'],'type':_0x216de8[_0xa55c('0x28')],'sectionId':_0x216de8['id']},{})['then'](function(){return _0x250b00;});}else{return _0x250b00;}})[_0xa55c('0x40')](function(_0x228df4){logger[_0xa55c('0x4a')](_0xa55c('0x4b'),_0x228df4);throw _0x228df4;});}return _0x250b00;})[_0xa55c('0x20')](respondWithResult(_0x2157d6,0xc9))['catch'](handleError(_0x2157d6,null));};exports[_0xa55c('0x1f')]=function(_0x4607ca,_0x4b85cc){if(_0x4607ca[_0xa55c('0x4c')]['id']){delete _0x4607ca[_0xa55c('0x4c')]['id'];}return db[_0xa55c('0x3e')][_0xa55c('0x43')]({'where':{'id':_0x4607ca['params']['id']}})['then'](handleEntityNotFound(_0x4b85cc,null))[_0xa55c('0x20')](saveUpdates(_0x4607ca[_0xa55c('0x4c')],null))[_0xa55c('0x20')](respondWithResult(_0x4b85cc,null))[_0xa55c('0x40')](handleError(_0x4b85cc,null));};exports['destroy']=function(_0x30c0c9,_0x5ce463){return db[_0xa55c('0x3e')][_0xa55c('0x43')]({'where':{'id':_0x30c0c9[_0xa55c('0x4d')]['id']}})[_0xa55c('0x20')](handleEntityNotFound(_0x5ce463,null))[_0xa55c('0x20')](removeEntity(_0x5ce463,null))['catch'](handleError(_0x5ce463,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index be2f4bb..bade044 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 _0x5c91=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticMetric','lodash','util','../../config/logger'];(function(_0x281a8d,_0x447bde){var _0x136e85=function(_0x5752dd){while(--_0x5752dd){_0x281a8d['push'](_0x281a8d['shift']());}};_0x136e85(++_0x447bde);}(_0x5c91,0x1e9));var _0x15c9=function(_0x22216a,_0xecb681){_0x22216a=_0x22216a-0x0;var _0x1195e9=_0x5c91[_0x22216a];return _0x1195e9;};'use strict';var _=require(_0x15c9('0x0'));var util=require(_0x15c9('0x1'));var logger=require(_0x15c9('0x2'))('api');var moment=require(_0x15c9('0x3'));var BPromise=require(_0x15c9('0x4'));var rp=require(_0x15c9('0x5'));var fs=require('fs');var path=require(_0x15c9('0x6'));var rimraf=require(_0x15c9('0x7'));var config=require(_0x15c9('0x8'));var attributes=require('./analyticMetric.attributes');module[_0x15c9('0x9')]=function(_0x216469,_0x1ce11a){return _0x216469[_0x15c9('0xa')](_0x15c9('0xb'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5bd7=['analytics_metrics','util','../../config/logger','api','bluebird','path','rimraf','./analyticMetric.attributes','exports','define','AnalyticMetric'];(function(_0x37c142,_0x361d66){var _0x5e088e=function(_0x2b9345){while(--_0x2b9345){_0x37c142['push'](_0x37c142['shift']());}};_0x5e088e(++_0x361d66);}(_0x5bd7,0x12a));var _0x75bd=function(_0x4216bf,_0x4efdde){_0x4216bf=_0x4216bf-0x0;var _0x3b4806=_0x5bd7[_0x4216bf];return _0x3b4806;};'use strict';var _=require('lodash');var util=require(_0x75bd('0x0'));var logger=require(_0x75bd('0x1'))(_0x75bd('0x2'));var moment=require('moment');var BPromise=require(_0x75bd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x75bd('0x4'));var rimraf=require(_0x75bd('0x5'));var config=require('../../config/environment');var attributes=require(_0x75bd('0x6'));module[_0x75bd('0x7')]=function(_0x2aaa6a,_0x47c9c7){return _0x2aaa6a[_0x75bd('0x8')](_0x75bd('0x9'),attributes,{'tableName':_0x75bd('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 68ce495..bc92305 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 _0x0f6d=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1777d3,_0x35d883){var _0x3a87e8=function(_0x2e57b8){while(--_0x2e57b8){_0x1777d3['push'](_0x1777d3['shift']());}};_0x3a87e8(++_0x35d883);}(_0x0f6d,0x182));var _0xd0f6=function(_0x107f10,_0x5529f2){_0x107f10=_0x107f10-0x0;var _0x811cab=_0x0f6d[_0x107f10];return _0x811cab;};'use strict';var _=require(_0xd0f6('0x0'));var util=require('util');var moment=require(_0xd0f6('0x1'));var BPromise=require(_0xd0f6('0x2'));var rs=require(_0xd0f6('0x3'));var fs=require('fs');var Redis=require(_0xd0f6('0x4'));var db=require(_0xd0f6('0x5'))['db'];var utils=require(_0xd0f6('0x6'));var logger=require(_0xd0f6('0x7'))(_0xd0f6('0x8'));var config=require('../../config/environment');var jayson=require(_0xd0f6('0x9'));var client=jayson['client'][_0xd0f6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5234ff,_0xc983a8,_0x4c17eb){return new BPromise(function(_0x3c9489,_0x5e2aa4){return client[_0xd0f6('0xb')](_0x5234ff,_0x4c17eb)[_0xd0f6('0xc')](function(_0x429fbc){logger[_0xd0f6('0xd')](_0xd0f6('0xe'),_0xc983a8,_0xd0f6('0xf'));logger[_0xd0f6('0x10')](_0xd0f6('0x11'),_0xc983a8,'request\x20sent',JSON[_0xd0f6('0x12')](_0x429fbc));if(_0x429fbc['error']){if(_0x429fbc[_0xd0f6('0x13')][_0xd0f6('0x14')]===0x1f4){logger[_0xd0f6('0x13')](_0xd0f6('0xe'),_0xc983a8,_0x429fbc[_0xd0f6('0x13')]['message']);return _0x5e2aa4(_0x429fbc[_0xd0f6('0x13')][_0xd0f6('0x15')]);}logger[_0xd0f6('0x13')](_0xd0f6('0xe'),_0xc983a8,_0x429fbc[_0xd0f6('0x13')][_0xd0f6('0x15')]);return _0x3c9489(_0x429fbc['error'][_0xd0f6('0x15')]);}else{logger[_0xd0f6('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0xc983a8,_0xd0f6('0xf'));_0x3c9489(_0x429fbc[_0xd0f6('0x16')][_0xd0f6('0x15')]);}})[_0xd0f6('0x17')](function(_0x1ce546){logger['error'](_0xd0f6('0xe'),_0xc983a8,_0x1ce546);_0x5e2aa4(_0x1ce546);});});} \ No newline at end of file +var _0x30ef=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x54d24b,_0x42d95e){var _0x295740=function(_0x1fa805){while(--_0x1fa805){_0x54d24b['push'](_0x54d24b['shift']());}};_0x295740(++_0x42d95e);}(_0x30ef,0x79));var _0xf30e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x30ef[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf30e('0x0'));var util=require('util');var moment=require(_0xf30e('0x1'));var BPromise=require(_0xf30e('0x2'));var rs=require(_0xf30e('0x3'));var fs=require('fs');var Redis=require(_0xf30e('0x4'));var db=require(_0xf30e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf30e('0x6'))(_0xf30e('0x7'));var config=require(_0xf30e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf30e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x131fb0,_0x5709bf,_0x53d4ab){return new BPromise(function(_0xa36fb3,_0x49c438){return client[_0xf30e('0xa')](_0x131fb0,_0x53d4ab)['then'](function(_0x12fc8f){logger[_0xf30e('0xb')](_0xf30e('0xc'),_0x5709bf,_0xf30e('0xd'));logger[_0xf30e('0xe')](_0xf30e('0xf'),_0x5709bf,_0xf30e('0xd'),JSON[_0xf30e('0x10')](_0x12fc8f));if(_0x12fc8f[_0xf30e('0x11')]){if(_0x12fc8f[_0xf30e('0x11')]['code']===0x1f4){logger[_0xf30e('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x5709bf,_0x12fc8f['error'][_0xf30e('0x12')]);return _0x49c438(_0x12fc8f[_0xf30e('0x11')]['message']);}logger[_0xf30e('0x11')](_0xf30e('0xc'),_0x5709bf,_0x12fc8f[_0xf30e('0x11')]['message']);return _0xa36fb3(_0x12fc8f[_0xf30e('0x11')]['message']);}else{logger['info'](_0xf30e('0xc'),_0x5709bf,_0xf30e('0xd'));_0xa36fb3(_0x12fc8f['result'][_0xf30e('0x12')]);}})[_0xf30e('0x13')](function(_0x4366d3){logger[_0xf30e('0x11')](_0xf30e('0xc'),_0x5709bf,_0x4366d3);_0x49c438(_0x4366d3);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 588b7cb..df46150 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 _0x7f3f=['Router','fs-extra','../../components/auth/service','../../config/environment','./analyticMetric.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7f3f,0x1c8));var _0xf7f3=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x7f3f[_0x40a825];return _0x273a54;};'use strict';var multer=require(_0xf7f3('0x0'));var util=require(_0xf7f3('0x1'));var path=require('path');var timeout=require(_0xf7f3('0x2'));var express=require(_0xf7f3('0x3'));var router=express[_0xf7f3('0x4')]();var fs_extra=require(_0xf7f3('0x5'));var auth=require(_0xf7f3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf7f3('0x7'));var controller=require(_0xf7f3('0x8'));router['get']('/',auth[_0xf7f3('0x9')](),controller[_0xf7f3('0xa')]);router[_0xf7f3('0xb')](_0xf7f3('0xc'),auth[_0xf7f3('0x9')](),controller[_0xf7f3('0xd')]);router[_0xf7f3('0xe')]('/',auth['isAuthenticated'](),controller[_0xf7f3('0xf')]);router[_0xf7f3('0x10')](_0xf7f3('0xc'),auth[_0xf7f3('0x9')](),controller[_0xf7f3('0x11')]);router[_0xf7f3('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xf7f3('0x13')]);module['exports']=router; \ No newline at end of file +var _0x1d7e=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','create','update','exports','util','path','connect-timeout'];(function(_0x6527e0,_0x35e367){var _0x1a8d1b=function(_0x41d7b6){while(--_0x41d7b6){_0x6527e0['push'](_0x6527e0['shift']());}};_0x1a8d1b(++_0x35e367);}(_0x1d7e,0x7d));var _0xe1d7=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x1d7e[_0x9df060];return _0x338dfe;};'use strict';var multer=require('multer');var util=require(_0xe1d7('0x0'));var path=require(_0xe1d7('0x1'));var timeout=require(_0xe1d7('0x2'));var express=require('express');var router=express[_0xe1d7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe1d7('0x4'));var interaction=require(_0xe1d7('0x5'));var config=require(_0xe1d7('0x6'));var controller=require(_0xe1d7('0x7'));router[_0xe1d7('0x8')]('/',auth[_0xe1d7('0x9')](),controller[_0xe1d7('0xa')]);router[_0xe1d7('0x8')](_0xe1d7('0xb'),auth[_0xe1d7('0x9')](),controller[_0xe1d7('0xc')]);router['post']('/',auth[_0xe1d7('0x9')](),controller[_0xe1d7('0xd')]);router['put'](_0xe1d7('0xb'),auth['isAuthenticated'](),controller[_0xe1d7('0xe')]);router['delete'](_0xe1d7('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xe1d7('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 4dae772..7f7ec5d 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 _0x2b44=['TEXT','sequelize'];(function(_0x4a2555,_0x3df257){var _0x13c557=function(_0x762348){while(--_0x762348){_0x4a2555['push'](_0x4a2555['shift']());}};_0x13c557(++_0x3df257);}(_0x2b44,0x1d7));var _0x42b4=function(_0x4cae6a,_0x41fe19){_0x4cae6a=_0x4cae6a-0x0;var _0x2fe2b8=_0x2b44[_0x4cae6a];return _0x2fe2b8;};'use strict';var Sequelize=require(_0x42b4('0x0'));module['exports']={'tree':{'type':Sequelize[_0x42b4('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xe02d=['exports','TEXT','sequelize'];(function(_0x1e953a,_0x4878d4){var _0x10498d=function(_0x51980f){while(--_0x51980f){_0x1e953a['push'](_0x1e953a['shift']());}};_0x10498d(++_0x4878d4);}(_0xe02d,0x8f));var _0xde02=function(_0x5aea3e,_0x20d237){_0x5aea3e=_0x5aea3e-0x0;var _0x558b7b=_0xe02d[_0x5aea3e];return _0x558b7b;};'use strict';var Sequelize=require(_0xde02('0x0'));module[_0xde02('0x1')]={'tree':{'type':Sequelize[_0xde02('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 c5e3ab3..5dd083a 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 _0xa13b=['moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','AnalyticTreeReport','keys','find','create','body','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x4ee813,_0x59f32b){var _0xa254ec=function(_0x34c3dd){while(--_0x34c3dd){_0x4ee813['push'](_0x4ee813['shift']());}};_0xa254ec(++_0x59f32b);}(_0xa13b,0x94));var _0xba13=function(_0x3ff07a,_0x1c4e69){_0x3ff07a=_0x3ff07a-0x0;var _0x2e5ce4=_0xa13b[_0x3ff07a];return _0x2e5ce4;};'use strict';var emlformat=require(_0xba13('0x0'));var rimraf=require(_0xba13('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xba13('0x2'));var rp=require(_0xba13('0x3'));var moment=require(_0xba13('0x4'));var BPromise=require(_0xba13('0x5'));var Mustache=require(_0xba13('0x6'));var util=require('util');var path=require(_0xba13('0x7'));var sox=require(_0xba13('0x8'));var csv=require(_0xba13('0x9'));var ejs=require(_0xba13('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xba13('0xb'));var squel=require(_0xba13('0xc'));var crypto=require(_0xba13('0xd'));var jsforce=require(_0xba13('0xe'));var deskjs=require(_0xba13('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xba13('0x10'));var Redis=require(_0xba13('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xba13('0x12'));var as=require(_0xba13('0x13'));var hardwareService=require(_0xba13('0x14'));var logger=require(_0xba13('0x15'))(_0xba13('0x16'));var utils=require(_0xba13('0x17'));var config=require(_0xba13('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xba13('0x19'))['db'];function respondWithStatusCode(_0x1d4824,_0x4f6d4c){_0x4f6d4c=_0x4f6d4c||0xcc;return function(_0x3ec76a){if(_0x3ec76a){return _0x1d4824[_0xba13('0x1a')](_0x4f6d4c);}return _0x1d4824[_0xba13('0x1b')](_0x4f6d4c)[_0xba13('0x1c')]();};}function respondWithResult(_0x27b18f,_0x2bc677){_0x2bc677=_0x2bc677||0xc8;return function(_0x5c98b7){if(_0x5c98b7){return _0x27b18f['status'](_0x2bc677)['json'](_0x5c98b7);}};}function respondWithFilteredResult(_0x22d975,_0x338fe3){return function(_0x13fe79){if(_0x13fe79){var _0x2c3434=typeof _0x338fe3[_0xba13('0x1d')]===_0xba13('0x1e')&&typeof _0x338fe3[_0xba13('0x1f')]===_0xba13('0x1e');var _0x5ce355=_0x13fe79[_0xba13('0x20')];var _0x4f353b=_0x2c3434?0x0:_0x338fe3['offset'];var _0x4e2209=_0x2c3434?_0x13fe79[_0xba13('0x20')]:_0x338fe3[_0xba13('0x1d')]+_0x338fe3[_0xba13('0x1f')];var _0x32b069;if(_0x4e2209>=_0x5ce355){_0x4e2209=_0x5ce355;_0x32b069=0xc8;}else{_0x32b069=0xce;}_0x22d975[_0xba13('0x1b')](_0x32b069);return _0x22d975[_0xba13('0x21')](_0xba13('0x22'),_0x4f353b+'-'+_0x4e2209+'/'+_0x5ce355)['json'](_0x13fe79);}return null;};}function patchUpdates(_0x156229){return function(_0x4e1cb2){try{jsonpatch[_0xba13('0x23')](_0x4e1cb2,_0x156229,!![]);}catch(_0x3b8883){return BPromise[_0xba13('0x24')](_0x3b8883);}return _0x4e1cb2[_0xba13('0x25')]();};}function saveUpdates(_0x54641d,_0x340b10){return function(_0x1e5942){if(_0x1e5942){return _0x1e5942[_0xba13('0x26')](_0x54641d)[_0xba13('0x27')](function(_0xd7c4a){return _0xd7c4a;});}return null;};}function removeEntity(_0x3a38f,_0x57c077){return function(_0x1a33bb){if(_0x1a33bb){return _0x1a33bb[_0xba13('0x28')]()[_0xba13('0x27')](function(){_0x3a38f[_0xba13('0x1b')](0xcc)[_0xba13('0x1c')]();});}};}function handleEntityNotFound(_0x261569,_0x4fd47f){return function(_0x414b5e){if(!_0x414b5e){_0x261569[_0xba13('0x1a')](0x194);}return _0x414b5e;};}function handleError(_0x76787b,_0x30edf3){_0x30edf3=_0x30edf3||0x1f4;return function(_0x454cbc){logger[_0xba13('0x29')](_0x454cbc[_0xba13('0x2a')]);if(_0x454cbc['name']){delete _0x454cbc[_0xba13('0x2b')];}_0x76787b[_0xba13('0x1b')](_0x30edf3)[_0xba13('0x2c')](_0x454cbc);};}exports[_0xba13('0x2d')]=function(_0x5d4848,_0x23e0f9){var _0x4f000c={},_0x413e58={},_0x1adf15={'count':0x0,'rows':[]};var _0x34a104=_['map'](db['AnalyticTreeReport'][_0xba13('0x2e')],function(_0x42a165){return{'name':_0x42a165[_0xba13('0x2f')],'type':_0x42a165[_0xba13('0x30')]['key']};});_0x413e58['model']=_[_0xba13('0x31')](_0x34a104,_0xba13('0x2b'));_0x413e58['query']=_['keys'](_0x5d4848[_0xba13('0x32')]);_0x413e58[_0xba13('0x33')]=_[_0xba13('0x34')](_0x413e58[_0xba13('0x35')],_0x413e58['query']);_0x4f000c[_0xba13('0x36')]=_[_0xba13('0x34')](_0x413e58[_0xba13('0x35')],qs[_0xba13('0x37')](_0x5d4848[_0xba13('0x32')]['fields']));_0x4f000c[_0xba13('0x36')]=_0x4f000c[_0xba13('0x36')]['length']?_0x4f000c[_0xba13('0x36')]:_0x413e58[_0xba13('0x35')];if(!_0x5d4848[_0xba13('0x32')]['hasOwnProperty'](_0xba13('0x38'))){_0x4f000c[_0xba13('0x1f')]=qs['limit'](_0x5d4848[_0xba13('0x32')][_0xba13('0x1f')]);_0x4f000c['offset']=qs[_0xba13('0x1d')](_0x5d4848[_0xba13('0x32')][_0xba13('0x1d')]);}_0x4f000c[_0xba13('0x39')]=qs[_0xba13('0x3a')](_0x5d4848[_0xba13('0x32')]['sort']);_0x4f000c[_0xba13('0x3b')]=qs[_0xba13('0x33')](_[_0xba13('0x3c')](_0x5d4848['query'],_0x413e58['filters']),_0x34a104);if(_0x5d4848[_0xba13('0x32')][_0xba13('0x3d')]){_0x4f000c[_0xba13('0x3b')]=_[_0xba13('0x3e')](_0x4f000c[_0xba13('0x3b')],{'$or':_[_0xba13('0x31')](_0x34a104,function(_0x525711){if(_0x525711[_0xba13('0x30')]!==_0xba13('0x3f')){var _0x107a8c={};_0x107a8c[_0x525711['name']]={'$like':'%'+_0x5d4848[_0xba13('0x32')][_0xba13('0x3d')]+'%'};return _0x107a8c;}})});}_0x4f000c=_['merge']({},_0x4f000c,_0x5d4848[_0xba13('0x40')]);var _0x526dc4={'where':_0x4f000c[_0xba13('0x3b')]};return db['AnalyticTreeReport'][_0xba13('0x20')](_0x526dc4)[_0xba13('0x27')](function(_0x399147){_0x1adf15[_0xba13('0x20')]=_0x399147;if(_0x5d4848[_0xba13('0x32')][_0xba13('0x41')]){_0x4f000c[_0xba13('0x42')]=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x4f000c);})[_0xba13('0x27')](function(_0x19e7f4){_0x1adf15[_0xba13('0x43')]=_0x19e7f4;return _0x1adf15;})[_0xba13('0x27')](respondWithFilteredResult(_0x23e0f9,_0x4f000c))[_0xba13('0x44')](handleError(_0x23e0f9,null));};exports[_0xba13('0x45')]=function(_0x37f5e6,_0x251cfe){var _0x574911={'raw':!![],'where':{'id':_0x37f5e6[_0xba13('0x46')]['id']}},_0x12a667={};_0x12a667['model']=_['keys'](db[_0xba13('0x47')][_0xba13('0x2e')]);_0x12a667[_0xba13('0x32')]=_[_0xba13('0x48')](_0x37f5e6['query']);_0x12a667[_0xba13('0x33')]=_[_0xba13('0x34')](_0x12a667['model'],_0x12a667[_0xba13('0x32')]);_0x574911['attributes']=_[_0xba13('0x34')](_0x12a667[_0xba13('0x35')],qs[_0xba13('0x37')](_0x37f5e6[_0xba13('0x32')][_0xba13('0x37')]));_0x574911[_0xba13('0x36')]=_0x574911[_0xba13('0x36')]['length']?_0x574911[_0xba13('0x36')]:_0x12a667[_0xba13('0x35')];if(_0x37f5e6[_0xba13('0x32')][_0xba13('0x41')]){_0x574911['include']=[{'all':!![]}];}_0x574911=_[_0xba13('0x3e')]({},_0x574911,_0x37f5e6[_0xba13('0x40')]);return db['AnalyticTreeReport'][_0xba13('0x49')](_0x574911)[_0xba13('0x27')](handleEntityNotFound(_0x251cfe,null))['then'](respondWithResult(_0x251cfe,null))[_0xba13('0x44')](handleError(_0x251cfe,null));};exports[_0xba13('0x4a')]=function(_0x74039d,_0x387730){return db[_0xba13('0x47')][_0xba13('0x4a')](_0x74039d[_0xba13('0x4b')],{})[_0xba13('0x27')](respondWithResult(_0x387730,0xc9))[_0xba13('0x44')](handleError(_0x387730,null));};exports[_0xba13('0x26')]=function(_0x3a17f8,_0x375a60){if(_0x3a17f8[_0xba13('0x4b')]['id']){delete _0x3a17f8[_0xba13('0x4b')]['id'];}return db[_0xba13('0x47')][_0xba13('0x49')]({'where':{'id':_0x3a17f8['params']['id']}})['then'](handleEntityNotFound(_0x375a60,null))[_0xba13('0x27')](saveUpdates(_0x3a17f8[_0xba13('0x4b')],null))['then'](respondWithResult(_0x375a60,null))[_0xba13('0x44')](handleError(_0x375a60,null));};exports[_0xba13('0x28')]=function(_0x10e707,_0x229d0f){return db[_0xba13('0x47')][_0xba13('0x49')]({'where':{'id':_0x10e707[_0xba13('0x46')]['id']}})['then'](handleEntityNotFound(_0x229d0f,null))['then'](removeEntity(_0x229d0f,null))['catch'](handleError(_0x229d0f,null));}; \ No newline at end of file +var _0xf40f=['order','sort','where','merge','type','VIRTUAL','filter','include','findAll','catch','params','includeAll','options','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xf40f,0xa5));var _0xff40=function(_0x531aa0,_0x3dfce1){_0x531aa0=_0x531aa0-0x0;var _0x450cce=_0xf40f[_0x531aa0];return _0x450cce;};'use strict';var emlformat=require(_0xff40('0x0'));var rimraf=require(_0xff40('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xff40('0x2'));var rp=require(_0xff40('0x3'));var moment=require('moment');var BPromise=require(_0xff40('0x4'));var Mustache=require('mustache');var util=require(_0xff40('0x5'));var path=require(_0xff40('0x6'));var sox=require(_0xff40('0x7'));var csv=require(_0xff40('0x8'));var ejs=require(_0xff40('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xff40('0xa'));var squel=require(_0xff40('0xb'));var crypto=require(_0xff40('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xff40('0x8'));var querystring=require(_0xff40('0xd'));var Papa=require(_0xff40('0xe'));var Redis=require(_0xff40('0xf'));var authService=require(_0xff40('0x10'));var qs=require(_0xff40('0x11'));var as=require(_0xff40('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xff40('0x13'))('api');var utils=require(_0xff40('0x14'));var config=require(_0xff40('0x15'));var licenseUtil=require(_0xff40('0x16'));var db=require(_0xff40('0x17'))['db'];function respondWithStatusCode(_0x36c091,_0xcce1bd){_0xcce1bd=_0xcce1bd||0xcc;return function(_0x1a111e){if(_0x1a111e){return _0x36c091[_0xff40('0x18')](_0xcce1bd);}return _0x36c091[_0xff40('0x19')](_0xcce1bd)['end']();};}function respondWithResult(_0x287b60,_0x275efb){_0x275efb=_0x275efb||0xc8;return function(_0x3651ee){if(_0x3651ee){return _0x287b60[_0xff40('0x19')](_0x275efb)[_0xff40('0x1a')](_0x3651ee);}};}function respondWithFilteredResult(_0x4893a6,_0x521a0b){return function(_0x4813ac){if(_0x4813ac){var _0x1635b8=typeof _0x521a0b[_0xff40('0x1b')]===_0xff40('0x1c')&&typeof _0x521a0b[_0xff40('0x1d')]===_0xff40('0x1c');var _0x477a04=_0x4813ac[_0xff40('0x1e')];var _0x1136ac=_0x1635b8?0x0:_0x521a0b[_0xff40('0x1b')];var _0x5a1562=_0x1635b8?_0x4813ac['count']:_0x521a0b['offset']+_0x521a0b[_0xff40('0x1d')];var _0x236ae4;if(_0x5a1562>=_0x477a04){_0x5a1562=_0x477a04;_0x236ae4=0xc8;}else{_0x236ae4=0xce;}_0x4893a6['status'](_0x236ae4);return _0x4893a6[_0xff40('0x1f')](_0xff40('0x20'),_0x1136ac+'-'+_0x5a1562+'/'+_0x477a04)[_0xff40('0x1a')](_0x4813ac);}return null;};}function patchUpdates(_0x5a25f8){return function(_0x501720){try{jsonpatch[_0xff40('0x21')](_0x501720,_0x5a25f8,!![]);}catch(_0x880842){return BPromise[_0xff40('0x22')](_0x880842);}return _0x501720[_0xff40('0x23')]();};}function saveUpdates(_0x503b41,_0x5e9bfd){return function(_0x5739a0){if(_0x5739a0){return _0x5739a0['update'](_0x503b41)[_0xff40('0x24')](function(_0x271928){return _0x271928;});}return null;};}function removeEntity(_0x3c00b8,_0x5b07c5){return function(_0x47858e){if(_0x47858e){return _0x47858e[_0xff40('0x25')]()['then'](function(){_0x3c00b8[_0xff40('0x19')](0xcc)[_0xff40('0x26')]();});}};}function handleEntityNotFound(_0x310258,_0xa5e543){return function(_0x595b72){if(!_0x595b72){_0x310258[_0xff40('0x18')](0x194);}return _0x595b72;};}function handleError(_0x8fe2c3,_0x586b2b){_0x586b2b=_0x586b2b||0x1f4;return function(_0x5e5448){logger['error'](_0x5e5448['stack']);if(_0x5e5448[_0xff40('0x27')]){delete _0x5e5448['name'];}_0x8fe2c3[_0xff40('0x19')](_0x586b2b)[_0xff40('0x28')](_0x5e5448);};}exports[_0xff40('0x29')]=function(_0x38b57f,_0x77b79){var _0x521109={},_0x321242={},_0x448277={'count':0x0,'rows':[]};var _0x86fab7=_[_0xff40('0x2a')](db[_0xff40('0x2b')][_0xff40('0x2c')],function(_0x2039f5){return{'name':_0x2039f5[_0xff40('0x2d')],'type':_0x2039f5['type'][_0xff40('0x2e')]};});_0x321242['model']=_[_0xff40('0x2a')](_0x86fab7,_0xff40('0x27'));_0x321242[_0xff40('0x2f')]=_[_0xff40('0x30')](_0x38b57f['query']);_0x321242[_0xff40('0x31')]=_[_0xff40('0x32')](_0x321242['model'],_0x321242[_0xff40('0x2f')]);_0x521109[_0xff40('0x33')]=_['intersection'](_0x321242[_0xff40('0x34')],qs[_0xff40('0x35')](_0x38b57f[_0xff40('0x2f')][_0xff40('0x35')]));_0x521109[_0xff40('0x33')]=_0x521109[_0xff40('0x33')][_0xff40('0x36')]?_0x521109['attributes']:_0x321242['model'];if(!_0x38b57f[_0xff40('0x2f')][_0xff40('0x37')](_0xff40('0x38'))){_0x521109[_0xff40('0x1d')]=qs[_0xff40('0x1d')](_0x38b57f[_0xff40('0x2f')][_0xff40('0x1d')]);_0x521109['offset']=qs[_0xff40('0x1b')](_0x38b57f['query'][_0xff40('0x1b')]);}_0x521109[_0xff40('0x39')]=qs[_0xff40('0x3a')](_0x38b57f[_0xff40('0x2f')][_0xff40('0x3a')]);_0x521109[_0xff40('0x3b')]=qs[_0xff40('0x31')](_['pick'](_0x38b57f[_0xff40('0x2f')],_0x321242[_0xff40('0x31')]),_0x86fab7);if(_0x38b57f['query']['filter']){_0x521109['where']=_[_0xff40('0x3c')](_0x521109[_0xff40('0x3b')],{'$or':_[_0xff40('0x2a')](_0x86fab7,function(_0x387013){if(_0x387013[_0xff40('0x3d')]!==_0xff40('0x3e')){var _0x21453f={};_0x21453f[_0x387013[_0xff40('0x27')]]={'$like':'%'+_0x38b57f[_0xff40('0x2f')][_0xff40('0x3f')]+'%'};return _0x21453f;}})});}_0x521109=_[_0xff40('0x3c')]({},_0x521109,_0x38b57f['options']);var _0x5a198e={'where':_0x521109[_0xff40('0x3b')]};return db[_0xff40('0x2b')][_0xff40('0x1e')](_0x5a198e)[_0xff40('0x24')](function(_0x5e5307){_0x448277[_0xff40('0x1e')]=_0x5e5307;if(_0x38b57f['query']['includeAll']){_0x521109[_0xff40('0x40')]=[{'all':!![]}];}return db[_0xff40('0x2b')][_0xff40('0x41')](_0x521109);})[_0xff40('0x24')](function(_0x41ed7f){_0x448277['rows']=_0x41ed7f;return _0x448277;})[_0xff40('0x24')](respondWithFilteredResult(_0x77b79,_0x521109))[_0xff40('0x42')](handleError(_0x77b79,null));};exports['show']=function(_0x5d7a7e,_0x5bdac8){var _0xf5cab9={'raw':!![],'where':{'id':_0x5d7a7e[_0xff40('0x43')]['id']}},_0x12b56f={};_0x12b56f[_0xff40('0x34')]=_['keys'](db['AnalyticTreeReport'][_0xff40('0x2c')]);_0x12b56f[_0xff40('0x2f')]=_[_0xff40('0x30')](_0x5d7a7e['query']);_0x12b56f[_0xff40('0x31')]=_[_0xff40('0x32')](_0x12b56f[_0xff40('0x34')],_0x12b56f[_0xff40('0x2f')]);_0xf5cab9[_0xff40('0x33')]=_[_0xff40('0x32')](_0x12b56f[_0xff40('0x34')],qs[_0xff40('0x35')](_0x5d7a7e['query'][_0xff40('0x35')]));_0xf5cab9[_0xff40('0x33')]=_0xf5cab9[_0xff40('0x33')][_0xff40('0x36')]?_0xf5cab9['attributes']:_0x12b56f[_0xff40('0x34')];if(_0x5d7a7e[_0xff40('0x2f')][_0xff40('0x44')]){_0xf5cab9[_0xff40('0x40')]=[{'all':!![]}];}_0xf5cab9=_[_0xff40('0x3c')]({},_0xf5cab9,_0x5d7a7e[_0xff40('0x45')]);return db[_0xff40('0x2b')][_0xff40('0x46')](_0xf5cab9)[_0xff40('0x24')](handleEntityNotFound(_0x5bdac8,null))[_0xff40('0x24')](respondWithResult(_0x5bdac8,null))['catch'](handleError(_0x5bdac8,null));};exports[_0xff40('0x47')]=function(_0x233d1b,_0x26590f){return db['AnalyticTreeReport'][_0xff40('0x47')](_0x233d1b[_0xff40('0x48')],{})[_0xff40('0x24')](respondWithResult(_0x26590f,0xc9))['catch'](handleError(_0x26590f,null));};exports[_0xff40('0x49')]=function(_0x5cb9fd,_0x4f92e1){if(_0x5cb9fd['body']['id']){delete _0x5cb9fd['body']['id'];}return db[_0xff40('0x2b')][_0xff40('0x46')]({'where':{'id':_0x5cb9fd[_0xff40('0x43')]['id']}})['then'](handleEntityNotFound(_0x4f92e1,null))[_0xff40('0x24')](saveUpdates(_0x5cb9fd[_0xff40('0x48')],null))[_0xff40('0x24')](respondWithResult(_0x4f92e1,null))[_0xff40('0x42')](handleError(_0x4f92e1,null));};exports['destroy']=function(_0x10374d,_0x48489b){return db[_0xff40('0x2b')][_0xff40('0x46')]({'where':{'id':_0x10374d[_0xff40('0x43')]['id']}})['then'](handleEntityNotFound(_0x48489b,null))['then'](removeEntity(_0x48489b,null))['catch'](handleError(_0x48489b,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 223caa8..5bc7a1f 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 _0x2f79=['util','../../config/logger','api','request-promise','path','rimraf','exports','define','lodash'];(function(_0x2241f6,_0xb1cce9){var _0x199d95=function(_0x134215){while(--_0x134215){_0x2241f6['push'](_0x2241f6['shift']());}};_0x199d95(++_0xb1cce9);}(_0x2f79,0x194));var _0x92f7=function(_0x1c5ae6,_0x30f2bd){_0x1c5ae6=_0x1c5ae6-0x0;var _0x4623f3=_0x2f79[_0x1c5ae6];return _0x4623f3;};'use strict';var _=require(_0x92f7('0x0'));var util=require(_0x92f7('0x1'));var logger=require(_0x92f7('0x2'))(_0x92f7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x92f7('0x4'));var fs=require('fs');var path=require(_0x92f7('0x5'));var rimraf=require(_0x92f7('0x6'));var config=require('../../config/environment');var attributes=require('./analyticTreeReport.attributes');module[_0x92f7('0x7')]=function(_0x4583da,_0x2475e6){return _0x4583da[_0x92f7('0x8')]('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfec8=['path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','analytics_report_trees','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xfec8,0x72));var _0x8fec=function(_0x34232c,_0x18e61d){_0x34232c=_0x34232c-0x0;var _0x4d4f4e=_0xfec8[_0x34232c];return _0x4d4f4e;};'use strict';var _=require(_0x8fec('0x0'));var util=require(_0x8fec('0x1'));var logger=require(_0x8fec('0x2'))('api');var moment=require(_0x8fec('0x3'));var BPromise=require(_0x8fec('0x4'));var rp=require(_0x8fec('0x5'));var fs=require('fs');var path=require(_0x8fec('0x6'));var rimraf=require(_0x8fec('0x7'));var config=require(_0x8fec('0x8'));var attributes=require(_0x8fec('0x9'));module[_0x8fec('0xa')]=function(_0x409059,_0x751863){return _0x409059['define']('AnalyticTreeReport',attributes,{'tableName':_0x8fec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 67ee857..f92b188 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(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x533439,_0x218a06){_0x533439=_0x533439-0x0;var _0xf75563=_0x7a54[_0x533439];return _0xf75563;};'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 _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(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x32babe,_0x4e4839){_0x32babe=_0x32babe-0x0;var _0x42a401=_0x7a54[_0x32babe];return _0x42a401;};'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 diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 0a396c5..69926af 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 _0xc01c=['put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post'];(function(_0x1b70e3,_0x3a15b1){var _0x1452ab=function(_0x692883){while(--_0x692883){_0x1b70e3['push'](_0x1b70e3['shift']());}};_0x1452ab(++_0x3a15b1);}(_0xc01c,0xd4));var _0xcc01=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc01c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xcc01('0x0'));var util=require(_0xcc01('0x1'));var path=require(_0xcc01('0x2'));var timeout=require(_0xcc01('0x3'));var express=require(_0xcc01('0x4'));var router=express['Router']();var fs_extra=require(_0xcc01('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcc01('0x6'));var config=require(_0xcc01('0x7'));var controller=require('./analyticTreeReport.controller');router[_0xcc01('0x8')]('/',auth[_0xcc01('0x9')](),controller['index']);router['get'](_0xcc01('0xa'),auth[_0xcc01('0x9')](),controller['show']);router[_0xcc01('0xb')]('/',auth[_0xcc01('0x9')](),controller['create']);router[_0xcc01('0xc')]('/:id',auth[_0xcc01('0x9')](),controller[_0xcc01('0xd')]);router[_0xcc01('0xe')](_0xcc01('0xa'),auth[_0xcc01('0x9')](),controller[_0xcc01('0xf')]);module['exports']=router; \ No newline at end of file +var _0x5e0c=['../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x33af76,_0x3ebd88){var _0x3969c1=function(_0x440686){while(--_0x440686){_0x33af76['push'](_0x33af76['shift']());}};_0x3969c1(++_0x3ebd88);}(_0x5e0c,0x8c));var _0xc5e0=function(_0xcc69c5,_0x5b35b2){_0xcc69c5=_0xcc69c5-0x0;var _0x14ec59=_0x5e0c[_0xcc69c5];return _0x14ec59;};'use strict';var multer=require(_0xc5e0('0x0'));var util=require(_0xc5e0('0x1'));var path=require(_0xc5e0('0x2'));var timeout=require(_0xc5e0('0x3'));var express=require(_0xc5e0('0x4'));var router=express['Router']();var fs_extra=require(_0xc5e0('0x5'));var auth=require(_0xc5e0('0x6'));var interaction=require(_0xc5e0('0x7'));var config=require(_0xc5e0('0x8'));var controller=require(_0xc5e0('0x9'));router[_0xc5e0('0xa')]('/',auth[_0xc5e0('0xb')](),controller[_0xc5e0('0xc')]);router[_0xc5e0('0xa')](_0xc5e0('0xd'),auth[_0xc5e0('0xb')](),controller[_0xc5e0('0xe')]);router[_0xc5e0('0xf')]('/',auth['isAuthenticated'](),controller[_0xc5e0('0x10')]);router[_0xc5e0('0x11')](_0xc5e0('0xd'),auth[_0xc5e0('0xb')](),controller[_0xc5e0('0x12')]);router[_0xc5e0('0x13')](_0xc5e0('0xd'),auth[_0xc5e0('0xb')](),controller['destroy']);module[_0xc5e0('0x14')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 7cde43d..9cc8c4e 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 _0xc831=['STRING','exports'];(function(_0x2bdd8d,_0xec359a){var _0x20f57e=function(_0x1af017){while(--_0x1af017){_0x2bdd8d['push'](_0x2bdd8d['shift']());}};_0x20f57e(++_0xec359a);}(_0xc831,0x103));var _0x1c83=function(_0x4cae1e,_0x3447fb){_0x4cae1e=_0x4cae1e-0x0;var _0x17210e=_0xc831[_0x4cae1e];return _0x17210e;};'use strict';var Sequelize=require('sequelize');module[_0x1c83('0x0')]={'name':{'type':Sequelize[_0x1c83('0x1')]},'basename':{'type':Sequelize[_0x1c83('0x1')]},'type':{'type':Sequelize[_0x1c83('0x1')]}}; \ No newline at end of file +var _0xec56=['STRING','sequelize'];(function(_0x802a40,_0x1d3a52){var _0x25cec0=function(_0x4f2530){while(--_0x4f2530){_0x802a40['push'](_0x802a40['shift']());}};_0x25cec0(++_0x1d3a52);}(_0xec56,0x1bd));var _0x6ec5=function(_0x284f93,_0x2539ce){_0x284f93=_0x284f93-0x0;var _0x3e0a59=_0xec56[_0x284f93];return _0x3e0a59;};'use strict';var Sequelize=require(_0x6ec5('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x6ec5('0x1')]},'type':{'type':Sequelize[_0x6ec5('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index e46aad8..6f0994f 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 _0x6ba7=['rimraf','zip-dir','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','map','Attachment','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','length','options','find','clone','omit','updatedAt','body','create','file','originalname','basename','type','mimetype','download','ChatOfflineMessageId','join','server/files/attachments/','eml-format'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6ba7,0x104));var _0x76ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6ba7[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x76ba('0x0'));var rimraf=require(_0x76ba('0x1'));var zipdir=require(_0x76ba('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x76ba('0x3'));var moment=require(_0x76ba('0x4'));var BPromise=require(_0x76ba('0x5'));var Mustache=require('mustache');var util=require(_0x76ba('0x6'));var path=require('path');var sox=require(_0x76ba('0x7'));var csv=require('to-csv');var ejs=require(_0x76ba('0x8'));var fs=require('fs');var fs_extra=require(_0x76ba('0x9'));var _=require(_0x76ba('0xa'));var squel=require(_0x76ba('0xb'));var crypto=require(_0x76ba('0xc'));var jsforce=require(_0x76ba('0xd'));var deskjs=require(_0x76ba('0xe'));var toCsv=require(_0x76ba('0xf'));var querystring=require(_0x76ba('0x10'));var Papa=require('papaparse');var Redis=require(_0x76ba('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x76ba('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x76ba('0x13'));var logger=require(_0x76ba('0x14'))(_0x76ba('0x15'));var utils=require('../../config/utils');var config=require(_0x76ba('0x16'));var licenseUtil=require(_0x76ba('0x17'));var db=require(_0x76ba('0x18'))['db'];function respondWithStatusCode(_0x25b458,_0x32527e){_0x32527e=_0x32527e||0xcc;return function(_0xa76d59){if(_0xa76d59){return _0x25b458[_0x76ba('0x19')](_0x32527e);}return _0x25b458[_0x76ba('0x1a')](_0x32527e)[_0x76ba('0x1b')]();};}function respondWithResult(_0x50fcac,_0x37e39e){_0x37e39e=_0x37e39e||0xc8;return function(_0x50b759){if(_0x50b759){return _0x50fcac['status'](_0x37e39e)[_0x76ba('0x1c')](_0x50b759);}};}function respondWithFilteredResult(_0x4d2bbf,_0x2d7674){return function(_0x50263f){if(_0x50263f){var _0x2367ce=typeof _0x2d7674[_0x76ba('0x1d')]==='undefined'&&typeof _0x2d7674[_0x76ba('0x1e')]===_0x76ba('0x1f');var _0x5a61b0=_0x50263f['count'];var _0x447c8e=_0x2367ce?0x0:_0x2d7674[_0x76ba('0x1d')];var _0xab4a06=_0x2367ce?_0x50263f[_0x76ba('0x20')]:_0x2d7674[_0x76ba('0x1d')]+_0x2d7674['limit'];var _0x158510;if(_0xab4a06>=_0x5a61b0){_0xab4a06=_0x5a61b0;_0x158510=0xc8;}else{_0x158510=0xce;}_0x4d2bbf[_0x76ba('0x1a')](_0x158510);return _0x4d2bbf[_0x76ba('0x21')](_0x76ba('0x22'),_0x447c8e+'-'+_0xab4a06+'/'+_0x5a61b0)[_0x76ba('0x1c')](_0x50263f);}return null;};}function patchUpdates(_0x302c02){return function(_0x577816){try{jsonpatch[_0x76ba('0x23')](_0x577816,_0x302c02,!![]);}catch(_0x8b8cf7){return BPromise[_0x76ba('0x24')](_0x8b8cf7);}return _0x577816[_0x76ba('0x25')]();};}function saveUpdates(_0x7086e7,_0x3eb00f){return function(_0x25cd14){if(_0x25cd14){return _0x25cd14[_0x76ba('0x26')](_0x7086e7)['then'](function(_0x4614f5){return _0x4614f5;});}return null;};}function removeEntity(_0x4656a0,_0x3c92d7){return function(_0x544321){if(_0x544321){return _0x544321[_0x76ba('0x27')]()[_0x76ba('0x28')](function(){_0x4656a0[_0x76ba('0x1a')](0xcc)[_0x76ba('0x1b')]();});}};}function handleEntityNotFound(_0x1da710,_0x510a5e){return function(_0x256449){if(!_0x256449){_0x1da710[_0x76ba('0x19')](0x194);}return _0x256449;};}function handleError(_0x9022d7,_0x539be1){_0x539be1=_0x539be1||0x1f4;return function(_0x35f426){logger[_0x76ba('0x29')](_0x35f426['stack']);if(_0x35f426[_0x76ba('0x2a')]){delete _0x35f426[_0x76ba('0x2a')];}_0x9022d7[_0x76ba('0x1a')](_0x539be1)[_0x76ba('0x2b')](_0x35f426);};}exports[_0x76ba('0x2c')]=function(_0x282a98,_0x2354c5){var _0x1ec408={},_0x59c6bc={},_0x5af678={'count':0x0,'rows':[]};var _0xf5dd30=_[_0x76ba('0x2d')](db[_0x76ba('0x2e')][_0x76ba('0x2f')],function(_0x156576){return{'name':_0x156576[_0x76ba('0x30')],'type':_0x156576['type']['key']};});_0x59c6bc[_0x76ba('0x31')]=_[_0x76ba('0x2d')](_0xf5dd30,'name');_0x59c6bc[_0x76ba('0x32')]=_[_0x76ba('0x33')](_0x282a98[_0x76ba('0x32')]);_0x59c6bc[_0x76ba('0x34')]=_[_0x76ba('0x35')](_0x59c6bc[_0x76ba('0x31')],_0x59c6bc[_0x76ba('0x32')]);_0x1ec408[_0x76ba('0x36')]=_['intersection'](_0x59c6bc['model'],qs[_0x76ba('0x37')](_0x282a98['query'][_0x76ba('0x37')]));_0x1ec408[_0x76ba('0x36')]=_0x1ec408['attributes']['length']?_0x1ec408['attributes']:_0x59c6bc[_0x76ba('0x31')];if(!_0x282a98[_0x76ba('0x32')][_0x76ba('0x38')](_0x76ba('0x39'))){_0x1ec408[_0x76ba('0x1e')]=qs[_0x76ba('0x1e')](_0x282a98[_0x76ba('0x32')][_0x76ba('0x1e')]);_0x1ec408[_0x76ba('0x1d')]=qs[_0x76ba('0x1d')](_0x282a98[_0x76ba('0x32')]['offset']);}_0x1ec408['order']=qs[_0x76ba('0x3a')](_0x282a98['query'][_0x76ba('0x3a')]);_0x1ec408[_0x76ba('0x3b')]=qs[_0x76ba('0x34')](_[_0x76ba('0x3c')](_0x282a98[_0x76ba('0x32')],_0x59c6bc['filters']),_0xf5dd30);if(_0x282a98[_0x76ba('0x32')][_0x76ba('0x3d')]){_0x1ec408[_0x76ba('0x3b')]=_[_0x76ba('0x3e')](_0x1ec408[_0x76ba('0x3b')],{'$or':_[_0x76ba('0x2d')](_0xf5dd30,function(_0x81f828){if(_0x81f828['type']!=='VIRTUAL'){var _0x1bf4d1={};_0x1bf4d1[_0x81f828[_0x76ba('0x2a')]]={'$like':'%'+_0x282a98[_0x76ba('0x32')]['filter']+'%'};return _0x1bf4d1;}})});}_0x1ec408=_['merge']({},_0x1ec408,_0x282a98['options']);var _0x31e43e={'where':_0x1ec408[_0x76ba('0x3b')]};return db[_0x76ba('0x2e')]['count'](_0x31e43e)[_0x76ba('0x28')](function(_0x369a40){_0x5af678[_0x76ba('0x20')]=_0x369a40;if(_0x282a98[_0x76ba('0x32')][_0x76ba('0x3f')]){_0x1ec408[_0x76ba('0x40')]=[{'all':!![]}];}return db[_0x76ba('0x2e')][_0x76ba('0x41')](_0x1ec408);})['then'](function(_0x2f6cfa){_0x5af678[_0x76ba('0x42')]=_0x2f6cfa;return _0x5af678;})[_0x76ba('0x28')](respondWithFilteredResult(_0x2354c5,_0x1ec408))[_0x76ba('0x43')](handleError(_0x2354c5,null));};exports[_0x76ba('0x44')]=function(_0x1879d1,_0x44c8be){var _0x364eab={'raw':!![],'where':{'id':_0x1879d1[_0x76ba('0x45')]['id']}},_0x5d4092={};_0x5d4092[_0x76ba('0x31')]=_['keys'](db[_0x76ba('0x2e')][_0x76ba('0x2f')]);_0x5d4092[_0x76ba('0x32')]=_[_0x76ba('0x33')](_0x1879d1[_0x76ba('0x32')]);_0x5d4092['filters']=_['intersection'](_0x5d4092[_0x76ba('0x31')],_0x5d4092[_0x76ba('0x32')]);_0x364eab[_0x76ba('0x36')]=_['intersection'](_0x5d4092['model'],qs[_0x76ba('0x37')](_0x1879d1[_0x76ba('0x32')][_0x76ba('0x37')]));_0x364eab['attributes']=_0x364eab[_0x76ba('0x36')][_0x76ba('0x46')]?_0x364eab[_0x76ba('0x36')]:_0x5d4092['model'];if(_0x1879d1[_0x76ba('0x32')]['includeAll']){_0x364eab['include']=[{'all':!![]}];}_0x364eab=_[_0x76ba('0x3e')]({},_0x364eab,_0x1879d1[_0x76ba('0x47')]);return db[_0x76ba('0x2e')][_0x76ba('0x48')](_0x364eab)[_0x76ba('0x28')](handleEntityNotFound(_0x44c8be,null))[_0x76ba('0x28')](respondWithResult(_0x44c8be,null))[_0x76ba('0x43')](handleError(_0x44c8be,null));};exports[_0x76ba('0x49')]=function(_0x413a40,_0x3d2a1f){var _0x1b20a3={'where':{'id':_0x413a40[_0x76ba('0x45')]['id']}},_0x53ecd8={};_0x53ecd8[_0x76ba('0x31')]=_[_0x76ba('0x33')](db[_0x76ba('0x2e')][_0x76ba('0x2f')]);_0x1b20a3['attributes']=_['intersection'](_0x53ecd8['model'],qs[_0x76ba('0x37')](_0x413a40[_0x76ba('0x32')][_0x76ba('0x37')]));_0x1b20a3[_0x76ba('0x36')]=_0x1b20a3['attributes'][_0x76ba('0x46')]?_0x1b20a3[_0x76ba('0x36')]:_0x53ecd8['model'];if(_0x413a40[_0x76ba('0x32')][_0x76ba('0x3f')]){_0x1b20a3[_0x76ba('0x40')]=[{'all':!![]}];}_0x1b20a3=_[_0x76ba('0x3e')]({},_0x1b20a3,_0x413a40[_0x76ba('0x47')]);return db[_0x76ba('0x2e')][_0x76ba('0x48')](_0x1b20a3)[_0x76ba('0x28')](handleEntityNotFound(_0x3d2a1f,null))[_0x76ba('0x28')](function(_0x1fc6fd){if(_0x1fc6fd){var _0x3fc834=_0x1fc6fd['get']({'plain':!![]});_0x3fc834=qs[_0x76ba('0x4a')](_0x3fc834,['id','createdAt',_0x76ba('0x4b')]);_0x413a40['body']=_[_0x76ba('0x4a')](_0x413a40[_0x76ba('0x4c')],['id','createdAt',_0x76ba('0x4b')]);return db['Attachment'][_0x76ba('0x4d')](_[_0x76ba('0x3e')](_0x3fc834,_0x413a40[_0x76ba('0x4c')]),{'include':_0x413a40[_0x76ba('0x32')][_0x76ba('0x3f')]?[{'all':!![]}]:undefined});}})[_0x76ba('0x28')](respondWithResult(_0x3d2a1f,0xc9))[_0x76ba('0x43')](handleError(_0x3d2a1f,null));};exports[_0x76ba('0x26')]=function(_0x30f34b,_0x50fdf1){if(_0x30f34b[_0x76ba('0x4c')]['id']){delete _0x30f34b[_0x76ba('0x4c')]['id'];}return db[_0x76ba('0x2e')][_0x76ba('0x48')]({'where':{'id':_0x30f34b[_0x76ba('0x45')]['id']}})['then'](handleEntityNotFound(_0x50fdf1,null))[_0x76ba('0x28')](saveUpdates(_0x30f34b[_0x76ba('0x4c')],null))[_0x76ba('0x28')](respondWithResult(_0x50fdf1,null))[_0x76ba('0x43')](handleError(_0x50fdf1,null));};exports[_0x76ba('0x27')]=function(_0x2fbaeb,_0x18ec07){return db[_0x76ba('0x2e')][_0x76ba('0x48')]({'where':{'id':_0x2fbaeb[_0x76ba('0x45')]['id']}})[_0x76ba('0x28')](handleEntityNotFound(_0x18ec07,null))[_0x76ba('0x28')](removeEntity(_0x18ec07,null))[_0x76ba('0x43')](handleError(_0x18ec07,null));};exports[_0x76ba('0x4d')]=function(_0xf439a3,_0xb996eb,_0x344ea7){_0xf439a3[_0x76ba('0x4c')][_0x76ba('0x2a')]=_0xf439a3[_0x76ba('0x4e')][_0x76ba('0x4f')];_0xf439a3[_0x76ba('0x4c')][_0x76ba('0x50')]=_0xf439a3[_0x76ba('0x4e')]['filename'];_0xf439a3[_0x76ba('0x4c')][_0x76ba('0x51')]=_0xf439a3[_0x76ba('0x4e')][_0x76ba('0x52')];return db[_0x76ba('0x2e')][_0x76ba('0x4d')](_0xf439a3[_0x76ba('0x4c')])['then'](respondWithResult(_0xb996eb,0xc9))[_0x76ba('0x43')](handleError(_0xb996eb,null));};exports[_0x76ba('0x53')]=function(_0x19bd7b,_0x4cecd3,_0x60a5b1){return db[_0x76ba('0x2e')]['findOne']({'where':{'id':_0x19bd7b['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4cecd3,null))[_0x76ba('0x28')](function(_0x5d1993){if(_0x5d1993){var _0x13e70f=_0x5d1993[_0x76ba('0x54')]!==null;var _0x1b3a1c=path[_0x76ba('0x55')](config['root'],_0x76ba('0x56'));if(_0x13e70f){_0x1b3a1c=path[_0x76ba('0x55')](_0x1b3a1c,'offline-chat/');}var _0x2c093d=path['join'](_0x1b3a1c,_0x5d1993['basename']);return _0x4cecd3['download'](_0x2c093d);}})[_0x76ba('0x43')](handleError(_0x4cecd3,null));}; \ No newline at end of file +var _0xef51=['create','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Attachment','type','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','VIRTUAL','options','where','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','createdAt','updatedAt','body','omit'];(function(_0x5c83b3,_0x256f06){var _0x3dc918=function(_0x34bebd){while(--_0x34bebd){_0x5c83b3['push'](_0x5c83b3['shift']());}};_0x3dc918(++_0x256f06);}(_0xef51,0x6a));var _0x1ef5=function(_0x3a90b6,_0x782086){_0x3a90b6=_0x3a90b6-0x0;var _0x56f71a=_0xef51[_0x3a90b6];return _0x56f71a;};'use strict';var emlformat=require(_0x1ef5('0x0'));var rimraf=require(_0x1ef5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1ef5('0x2'));var rp=require(_0x1ef5('0x3'));var moment=require(_0x1ef5('0x4'));var BPromise=require(_0x1ef5('0x5'));var Mustache=require(_0x1ef5('0x6'));var util=require(_0x1ef5('0x7'));var path=require(_0x1ef5('0x8'));var sox=require('sox');var csv=require(_0x1ef5('0x9'));var ejs=require(_0x1ef5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1ef5('0xb'));var squel=require(_0x1ef5('0xc'));var crypto=require(_0x1ef5('0xd'));var jsforce=require(_0x1ef5('0xe'));var deskjs=require(_0x1ef5('0xf'));var toCsv=require(_0x1ef5('0x9'));var querystring=require('querystring');var Papa=require(_0x1ef5('0x10'));var Redis=require(_0x1ef5('0x11'));var authService=require(_0x1ef5('0x12'));var qs=require(_0x1ef5('0x13'));var as=require(_0x1ef5('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1ef5('0x15'))(_0x1ef5('0x16'));var utils=require(_0x1ef5('0x17'));var config=require(_0x1ef5('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1ef5('0x19'))['db'];function respondWithStatusCode(_0x1cd278,_0x22f2b7){_0x22f2b7=_0x22f2b7||0xcc;return function(_0x132516){if(_0x132516){return _0x1cd278[_0x1ef5('0x1a')](_0x22f2b7);}return _0x1cd278[_0x1ef5('0x1b')](_0x22f2b7)[_0x1ef5('0x1c')]();};}function respondWithResult(_0x1a887a,_0xf7aa1b){_0xf7aa1b=_0xf7aa1b||0xc8;return function(_0x9ee04c){if(_0x9ee04c){return _0x1a887a['status'](_0xf7aa1b)[_0x1ef5('0x1d')](_0x9ee04c);}};}function respondWithFilteredResult(_0x2c6905,_0x474a54){return function(_0x557419){if(_0x557419){var _0x3dd1f6=typeof _0x474a54['offset']==='undefined'&&typeof _0x474a54['limit']===_0x1ef5('0x1e');var _0x261cc7=_0x557419['count'];var _0x258717=_0x3dd1f6?0x0:_0x474a54[_0x1ef5('0x1f')];var _0xe4c4b9=_0x3dd1f6?_0x557419['count']:_0x474a54[_0x1ef5('0x1f')]+_0x474a54[_0x1ef5('0x20')];var _0x1eb16c;if(_0xe4c4b9>=_0x261cc7){_0xe4c4b9=_0x261cc7;_0x1eb16c=0xc8;}else{_0x1eb16c=0xce;}_0x2c6905[_0x1ef5('0x1b')](_0x1eb16c);return _0x2c6905[_0x1ef5('0x21')](_0x1ef5('0x22'),_0x258717+'-'+_0xe4c4b9+'/'+_0x261cc7)[_0x1ef5('0x1d')](_0x557419);}return null;};}function patchUpdates(_0x44e667){return function(_0x3b3741){try{jsonpatch[_0x1ef5('0x23')](_0x3b3741,_0x44e667,!![]);}catch(_0x36b78b){return BPromise[_0x1ef5('0x24')](_0x36b78b);}return _0x3b3741[_0x1ef5('0x25')]();};}function saveUpdates(_0x5c0d92,_0x424892){return function(_0x19b640){if(_0x19b640){return _0x19b640[_0x1ef5('0x26')](_0x5c0d92)[_0x1ef5('0x27')](function(_0x3b488f){return _0x3b488f;});}return null;};}function removeEntity(_0x3f35f1,_0x5b9aec){return function(_0x5740b9){if(_0x5740b9){return _0x5740b9[_0x1ef5('0x28')]()[_0x1ef5('0x27')](function(){_0x3f35f1[_0x1ef5('0x1b')](0xcc)[_0x1ef5('0x1c')]();});}};}function handleEntityNotFound(_0x4d8d20,_0x460fc4){return function(_0x2eb94a){if(!_0x2eb94a){_0x4d8d20[_0x1ef5('0x1a')](0x194);}return _0x2eb94a;};}function handleError(_0x4222f7,_0x629333){_0x629333=_0x629333||0x1f4;return function(_0x1f11da){logger[_0x1ef5('0x29')](_0x1f11da[_0x1ef5('0x2a')]);if(_0x1f11da[_0x1ef5('0x2b')]){delete _0x1f11da['name'];}_0x4222f7[_0x1ef5('0x1b')](_0x629333)[_0x1ef5('0x2c')](_0x1f11da);};}exports[_0x1ef5('0x2d')]=function(_0x34a538,_0x4491ab){var _0x3681e5={},_0x39fe48={},_0xd64a4={'count':0x0,'rows':[]};var _0x53220d=_[_0x1ef5('0x2e')](db[_0x1ef5('0x2f')]['rawAttributes'],function(_0x53f56d){return{'name':_0x53f56d['fieldName'],'type':_0x53f56d[_0x1ef5('0x30')]['key']};});_0x39fe48['model']=_[_0x1ef5('0x2e')](_0x53220d,_0x1ef5('0x2b'));_0x39fe48[_0x1ef5('0x31')]=_[_0x1ef5('0x32')](_0x34a538[_0x1ef5('0x31')]);_0x39fe48[_0x1ef5('0x33')]=_['intersection'](_0x39fe48[_0x1ef5('0x34')],_0x39fe48[_0x1ef5('0x31')]);_0x3681e5['attributes']=_[_0x1ef5('0x35')](_0x39fe48[_0x1ef5('0x34')],qs[_0x1ef5('0x36')](_0x34a538[_0x1ef5('0x31')]['fields']));_0x3681e5[_0x1ef5('0x37')]=_0x3681e5['attributes'][_0x1ef5('0x38')]?_0x3681e5['attributes']:_0x39fe48[_0x1ef5('0x34')];if(!_0x34a538['query'][_0x1ef5('0x39')](_0x1ef5('0x3a'))){_0x3681e5['limit']=qs[_0x1ef5('0x20')](_0x34a538[_0x1ef5('0x31')]['limit']);_0x3681e5['offset']=qs['offset'](_0x34a538[_0x1ef5('0x31')][_0x1ef5('0x1f')]);}_0x3681e5[_0x1ef5('0x3b')]=qs[_0x1ef5('0x3c')](_0x34a538[_0x1ef5('0x31')]['sort']);_0x3681e5['where']=qs['filters'](_['pick'](_0x34a538[_0x1ef5('0x31')],_0x39fe48[_0x1ef5('0x33')]),_0x53220d);if(_0x34a538[_0x1ef5('0x31')][_0x1ef5('0x3d')]){_0x3681e5['where']=_[_0x1ef5('0x3e')](_0x3681e5['where'],{'$or':_[_0x1ef5('0x2e')](_0x53220d,function(_0x17300b){if(_0x17300b[_0x1ef5('0x30')]!==_0x1ef5('0x3f')){var _0x3080a3={};_0x3080a3[_0x17300b[_0x1ef5('0x2b')]]={'$like':'%'+_0x34a538[_0x1ef5('0x31')][_0x1ef5('0x3d')]+'%'};return _0x3080a3;}})});}_0x3681e5=_[_0x1ef5('0x3e')]({},_0x3681e5,_0x34a538[_0x1ef5('0x40')]);var _0x428bd1={'where':_0x3681e5[_0x1ef5('0x41')]};return db[_0x1ef5('0x2f')][_0x1ef5('0x42')](_0x428bd1)[_0x1ef5('0x27')](function(_0x4a2a81){_0xd64a4[_0x1ef5('0x42')]=_0x4a2a81;if(_0x34a538[_0x1ef5('0x31')][_0x1ef5('0x43')]){_0x3681e5[_0x1ef5('0x44')]=[{'all':!![]}];}return db[_0x1ef5('0x2f')][_0x1ef5('0x45')](_0x3681e5);})[_0x1ef5('0x27')](function(_0x581695){_0xd64a4[_0x1ef5('0x46')]=_0x581695;return _0xd64a4;})['then'](respondWithFilteredResult(_0x4491ab,_0x3681e5))[_0x1ef5('0x47')](handleError(_0x4491ab,null));};exports[_0x1ef5('0x48')]=function(_0x53fb28,_0xb8f13f){var _0x466054={'raw':!![],'where':{'id':_0x53fb28[_0x1ef5('0x49')]['id']}},_0x382109={};_0x382109[_0x1ef5('0x34')]=_[_0x1ef5('0x32')](db['Attachment'][_0x1ef5('0x4a')]);_0x382109['query']=_[_0x1ef5('0x32')](_0x53fb28[_0x1ef5('0x31')]);_0x382109['filters']=_[_0x1ef5('0x35')](_0x382109[_0x1ef5('0x34')],_0x382109['query']);_0x466054[_0x1ef5('0x37')]=_['intersection'](_0x382109[_0x1ef5('0x34')],qs[_0x1ef5('0x36')](_0x53fb28['query'][_0x1ef5('0x36')]));_0x466054[_0x1ef5('0x37')]=_0x466054['attributes']['length']?_0x466054[_0x1ef5('0x37')]:_0x382109['model'];if(_0x53fb28['query']['includeAll']){_0x466054[_0x1ef5('0x44')]=[{'all':!![]}];}_0x466054=_[_0x1ef5('0x3e')]({},_0x466054,_0x53fb28[_0x1ef5('0x40')]);return db[_0x1ef5('0x2f')][_0x1ef5('0x4b')](_0x466054)['then'](handleEntityNotFound(_0xb8f13f,null))[_0x1ef5('0x27')](respondWithResult(_0xb8f13f,null))[_0x1ef5('0x47')](handleError(_0xb8f13f,null));};exports['clone']=function(_0x287e1b,_0x4055df){var _0x305308={'where':{'id':_0x287e1b[_0x1ef5('0x49')]['id']}},_0x548e9d={};_0x548e9d[_0x1ef5('0x34')]=_[_0x1ef5('0x32')](db[_0x1ef5('0x2f')][_0x1ef5('0x4a')]);_0x305308[_0x1ef5('0x37')]=_[_0x1ef5('0x35')](_0x548e9d['model'],qs[_0x1ef5('0x36')](_0x287e1b['query'][_0x1ef5('0x36')]));_0x305308['attributes']=_0x305308['attributes'][_0x1ef5('0x38')]?_0x305308[_0x1ef5('0x37')]:_0x548e9d[_0x1ef5('0x34')];if(_0x287e1b[_0x1ef5('0x31')]['includeAll']){_0x305308[_0x1ef5('0x44')]=[{'all':!![]}];}_0x305308=_[_0x1ef5('0x3e')]({},_0x305308,_0x287e1b['options']);return db['Attachment'][_0x1ef5('0x4b')](_0x305308)[_0x1ef5('0x27')](handleEntityNotFound(_0x4055df,null))[_0x1ef5('0x27')](function(_0xce1c3){if(_0xce1c3){var _0x3f3271=_0xce1c3['get']({'plain':!![]});_0x3f3271=qs['omit'](_0x3f3271,['id',_0x1ef5('0x4c'),_0x1ef5('0x4d')]);_0x287e1b[_0x1ef5('0x4e')]=_[_0x1ef5('0x4f')](_0x287e1b[_0x1ef5('0x4e')],['id',_0x1ef5('0x4c'),_0x1ef5('0x4d')]);return db['Attachment'][_0x1ef5('0x50')](_[_0x1ef5('0x3e')](_0x3f3271,_0x287e1b[_0x1ef5('0x4e')]),{'include':_0x287e1b['query'][_0x1ef5('0x43')]?[{'all':!![]}]:undefined});}})[_0x1ef5('0x27')](respondWithResult(_0x4055df,0xc9))[_0x1ef5('0x47')](handleError(_0x4055df,null));};exports['update']=function(_0x2a2d3d,_0x545f8e){if(_0x2a2d3d[_0x1ef5('0x4e')]['id']){delete _0x2a2d3d[_0x1ef5('0x4e')]['id'];}return db[_0x1ef5('0x2f')]['find']({'where':{'id':_0x2a2d3d['params']['id']}})[_0x1ef5('0x27')](handleEntityNotFound(_0x545f8e,null))[_0x1ef5('0x27')](saveUpdates(_0x2a2d3d[_0x1ef5('0x4e')],null))[_0x1ef5('0x27')](respondWithResult(_0x545f8e,null))[_0x1ef5('0x47')](handleError(_0x545f8e,null));};exports['destroy']=function(_0x159a81,_0x288d4a){return db[_0x1ef5('0x2f')][_0x1ef5('0x4b')]({'where':{'id':_0x159a81['params']['id']}})[_0x1ef5('0x27')](handleEntityNotFound(_0x288d4a,null))['then'](removeEntity(_0x288d4a,null))[_0x1ef5('0x47')](handleError(_0x288d4a,null));};exports[_0x1ef5('0x50')]=function(_0x521804,_0x535e54,_0x2cdba9){_0x521804[_0x1ef5('0x4e')][_0x1ef5('0x2b')]=_0x521804[_0x1ef5('0x51')][_0x1ef5('0x52')];_0x521804[_0x1ef5('0x4e')][_0x1ef5('0x53')]=_0x521804[_0x1ef5('0x51')][_0x1ef5('0x54')];_0x521804[_0x1ef5('0x4e')]['type']=_0x521804[_0x1ef5('0x51')][_0x1ef5('0x55')];return db[_0x1ef5('0x2f')][_0x1ef5('0x50')](_0x521804['body'])['then'](respondWithResult(_0x535e54,0xc9))[_0x1ef5('0x47')](handleError(_0x535e54,null));};exports[_0x1ef5('0x56')]=function(_0x1cba08,_0x12de90,_0x2fa176){return db['Attachment'][_0x1ef5('0x57')]({'where':{'id':_0x1cba08[_0x1ef5('0x49')]['id']},'raw':!![]})[_0x1ef5('0x27')](handleEntityNotFound(_0x12de90,null))[_0x1ef5('0x27')](function(_0x561c0d){if(_0x561c0d){var _0x57a5f9=_0x561c0d[_0x1ef5('0x58')]!==null;var _0xbf8120=path[_0x1ef5('0x59')](config[_0x1ef5('0x5a')],_0x1ef5('0x5b'));if(_0x57a5f9){_0xbf8120=path[_0x1ef5('0x59')](_0xbf8120,_0x1ef5('0x5c'));}var _0x541a3e=path[_0x1ef5('0x59')](_0xbf8120,_0x561c0d[_0x1ef5('0x53')]);return _0x12de90[_0x1ef5('0x56')](_0x541a3e);}})[_0x1ef5('0x47')](handleError(_0x12de90,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index bcf6cc9..6846ad4 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 _0x48d7=['api','moment','bluebird','request-promise','../../config/environment','define','Attachment','util'];(function(_0x538f18,_0x3f3236){var _0x1d72d4=function(_0x177255){while(--_0x177255){_0x538f18['push'](_0x538f18['shift']());}};_0x1d72d4(++_0x3f3236);}(_0x48d7,0x1a7));var _0x748d=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x48d7[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var util=require(_0x748d('0x0'));var logger=require('../../config/logger')(_0x748d('0x1'));var moment=require(_0x748d('0x2'));var BPromise=require(_0x748d('0x3'));var rp=require(_0x748d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x748d('0x5'));var attributes=require('./attachment.attributes');module['exports']=function(_0x47e22a,_0x1eca71){return _0x47e22a[_0x748d('0x6')](_0x748d('0x7'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7611=['request-promise','path','../../config/environment','./attachment.attributes','exports','define','Attachment','lodash','../../config/logger','api','moment','bluebird'];(function(_0x274638,_0x578968){var _0x5755df=function(_0x3227d5){while(--_0x3227d5){_0x274638['push'](_0x274638['shift']());}};_0x5755df(++_0x578968);}(_0x7611,0xd3));var _0x1761=function(_0x30392d,_0x4d1354){_0x30392d=_0x30392d-0x0;var _0x16819d=_0x7611[_0x30392d];return _0x16819d;};'use strict';var _=require(_0x1761('0x0'));var util=require('util');var logger=require(_0x1761('0x1'))(_0x1761('0x2'));var moment=require(_0x1761('0x3'));var BPromise=require(_0x1761('0x4'));var rp=require(_0x1761('0x5'));var fs=require('fs');var path=require(_0x1761('0x6'));var rimraf=require('rimraf');var config=require(_0x1761('0x7'));var attributes=require(_0x1761('0x8'));module[_0x1761('0x9')]=function(_0x4e7386,_0x4497e0){return _0x4e7386[_0x1761('0xa')](_0x1761('0xb'),attributes,{'tableName':'attachments','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 b9a6f7d..376cef2 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 _0xfd2f=['rpc','../../config/environment','then','info','Attachment,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','CreateAttachment','Attachment','create','body','raw','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x31d91a,_0x3fa4bb){var _0xf9398c=function(_0x3e6149){while(--_0x3e6149){_0x31d91a['push'](_0x31d91a['shift']());}};_0xf9398c(++_0x3fa4bb);}(_0xfd2f,0x14a));var _0xffd2=function(_0x4bf20d,_0x188fa2){_0x4bf20d=_0x4bf20d-0x0;var _0x5ffdca=_0xfd2f[_0x4bf20d];return _0x5ffdca;};'use strict';var _=require(_0xffd2('0x0'));var util=require(_0xffd2('0x1'));var moment=require(_0xffd2('0x2'));var BPromise=require('bluebird');var rs=require(_0xffd2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xffd2('0x4'))['db'];var utils=require(_0xffd2('0x5'));var logger=require('../../config/logger')(_0xffd2('0x6'));var config=require(_0xffd2('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xd5e752,_0x2074e0,_0x56a1e2){return new BPromise(function(_0x35d327,_0x5b24ca){return client['request'](_0xd5e752,_0x56a1e2)[_0xffd2('0x8')](function(_0x15e33f){logger[_0xffd2('0x9')](_0xffd2('0xa'),_0x2074e0,'request\x20sent');logger[_0xffd2('0xb')]('Attachment,\x20%s,\x20%s,\x20%s',_0x2074e0,'request\x20sent',JSON['stringify'](_0x15e33f));if(_0x15e33f[_0xffd2('0xc')]){if(_0x15e33f[_0xffd2('0xc')][_0xffd2('0xd')]===0x1f4){logger[_0xffd2('0xc')](_0xffd2('0xa'),_0x2074e0,_0x15e33f[_0xffd2('0xc')][_0xffd2('0xe')]);return _0x5b24ca(_0x15e33f['error']['message']);}logger['error']('Attachment,\x20%s,\x20%s',_0x2074e0,_0x15e33f[_0xffd2('0xc')][_0xffd2('0xe')]);return _0x35d327(_0x15e33f['error'][_0xffd2('0xe')]);}else{logger[_0xffd2('0x9')](_0xffd2('0xa'),_0x2074e0,_0xffd2('0xf'));_0x35d327(_0x15e33f[_0xffd2('0x10')][_0xffd2('0xe')]);}})[_0xffd2('0x11')](function(_0x132d38){logger[_0xffd2('0xc')]('Attachment,\x20%s,\x20%s',_0x2074e0,_0x132d38);_0x5b24ca(_0x132d38);});});}exports[_0xffd2('0x12')]=function(_0x1f3c23){var _0x214737=this;return new Promise(function(_0x53f6e6,_0x2b2f71){return db[_0xffd2('0x13')][_0xffd2('0x14')](_0x1f3c23[_0xffd2('0x15')],{'raw':_0x1f3c23['options']?_0x1f3c23['options'][_0xffd2('0x16')]===undefined?!![]:![]:!![]})[_0xffd2('0x8')](function(_0x40a88c){logger['info'](_0xffd2('0x12'),_0x1f3c23);logger['debug'](_0xffd2('0x12'),_0x1f3c23,JSON[_0xffd2('0x17')](_0x40a88c));_0x53f6e6(_0x40a88c);})['catch'](function(_0x3ed47f){logger[_0xffd2('0xc')](_0xffd2('0x12'),_0x3ed47f[_0xffd2('0xe')],_0x1f3c23);_0x2b2f71(_0x214737[_0xffd2('0xc')](0x1f4,_0x3ed47f[_0xffd2('0xe')]));});});}; \ No newline at end of file +var _0x3685=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateAttachment','Attachment','options','raw','catch','lodash','moment','bluebird','randomstring'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x3685,0xf8));var _0x5368=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3685[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x5368('0x0'));var util=require('util');var moment=require(_0x5368('0x1'));var BPromise=require(_0x5368('0x2'));var rs=require(_0x5368('0x3'));var fs=require('fs');var Redis=require(_0x5368('0x4'));var db=require(_0x5368('0x5'))['db'];var utils=require(_0x5368('0x6'));var logger=require(_0x5368('0x7'))(_0x5368('0x8'));var config=require(_0x5368('0x9'));var jayson=require(_0x5368('0xa'));var client=jayson['client'][_0x5368('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2529a2,_0x39223d,_0xaf4549){return new BPromise(function(_0x55fb7d,_0x14e621){return client[_0x5368('0xc')](_0x2529a2,_0xaf4549)[_0x5368('0xd')](function(_0x2a6ce8){logger[_0x5368('0xe')](_0x5368('0xf'),_0x39223d,_0x5368('0x10'));logger[_0x5368('0x11')]('Attachment,\x20%s,\x20%s,\x20%s',_0x39223d,_0x5368('0x10'),JSON[_0x5368('0x12')](_0x2a6ce8));if(_0x2a6ce8[_0x5368('0x13')]){if(_0x2a6ce8['error'][_0x5368('0x14')]===0x1f4){logger[_0x5368('0x13')]('Attachment,\x20%s,\x20%s',_0x39223d,_0x2a6ce8['error']['message']);return _0x14e621(_0x2a6ce8[_0x5368('0x13')][_0x5368('0x15')]);}logger[_0x5368('0x13')](_0x5368('0xf'),_0x39223d,_0x2a6ce8[_0x5368('0x13')][_0x5368('0x15')]);return _0x55fb7d(_0x2a6ce8[_0x5368('0x13')][_0x5368('0x15')]);}else{logger[_0x5368('0xe')](_0x5368('0xf'),_0x39223d,'request\x20sent');_0x55fb7d(_0x2a6ce8[_0x5368('0x16')][_0x5368('0x15')]);}})['catch'](function(_0x19790d){logger[_0x5368('0x13')](_0x5368('0xf'),_0x39223d,_0x19790d);_0x14e621(_0x19790d);});});}exports[_0x5368('0x17')]=function(_0x5b10e9){var _0x3fcae0=this;return new Promise(function(_0x56ac4d,_0x4baaa9){return db[_0x5368('0x18')]['create'](_0x5b10e9['body'],{'raw':_0x5b10e9['options']?_0x5b10e9[_0x5368('0x19')][_0x5368('0x1a')]===undefined?!![]:![]:!![]})[_0x5368('0xd')](function(_0x5cef40){logger['info'](_0x5368('0x17'),_0x5b10e9);logger[_0x5368('0x11')](_0x5368('0x17'),_0x5b10e9,JSON[_0x5368('0x12')](_0x5cef40));_0x56ac4d(_0x5cef40);})[_0x5368('0x1b')](function(_0x1093e2){logger[_0x5368('0x13')](_0x5368('0x17'),_0x1093e2[_0x5368('0x15')],_0x5b10e9);_0x4baaa9(_0x3fcae0[_0x5368('0x13')](0x1f4,_0x1093e2['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index ae0a703..45cbb68 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 _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x547e20,_0x284545){_0x547e20=_0x547e20-0x0;var _0x359171=_0x0b0e[_0x547e20];return _0x359171;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x5cb57c,_0x8be2d6){_0x5cb57c=_0x5cb57c-0x0;var _0x316318=_0xdb28[_0x5cb57c];return _0x316318;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./attachment.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index f20b19d..b276894 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 _0xf7ec=['password','salt','blocked','blockedAt','admin','user','agent','name','disabled','minutes','clearBlockUser','getLicense','catch','status','send','message','login','ad-login','online','User','passport-local','Strategy','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/logger','api','activedirectory','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled'];(function(_0x40b66c,_0x5c1d58){var _0x159671=function(_0x17a129){while(--_0x17a129){_0x40b66c['push'](_0x40b66c['shift']());}};_0x159671(++_0x5c1d58);}(_0xf7ec,0x1cc));var _0xcf7e=function(_0x19a61d,_0x55d5da){_0x19a61d=_0x19a61d-0x0;var _0xe7b18a=_0xf7ec[_0x19a61d];return _0xe7b18a;};'use strict';var passport=require('passport');var LocalStrategy=require(_0xcf7e('0x0'))[_0xcf7e('0x1')];var moment=require('moment');var ActiveDirectory=require(_0xcf7e('0x2'));var BPromise=require(_0xcf7e('0x3'));var util=require(_0xcf7e('0x4'));var db=require(_0xcf7e('0x5'))['db'];var authService=require(_0xcf7e('0x6'));var utils=require('../../config/utils');var config=require('../../config/environment');var logger=require(_0xcf7e('0x7'))(_0xcf7e('0x8'));function isActiveDirectoryConfigured(_0x145528){var _0x447bd5=![];if(typeof _0x145528[_0xcf7e('0x9')]!=='undefined'){_0x447bd5=_0x145528[_0xcf7e('0x9')]['baseDN']&&_0x145528[_0xcf7e('0x9')][_0xcf7e('0xa')]&&_0x145528[_0xcf7e('0x9')][_0xcf7e('0xb')];}return _0x447bd5;}function adAuthenticate(_0x49456c,_0x432008,_0x4507f2){return new BPromise(function(_0x32da64,_0x177833){try{var _0xa00508=new ActiveDirectory(_0x49456c);_0xa00508[_0xcf7e('0xc')](_0x432008,_0x4507f2,function(_0x101aca,_0x313f2c){if(_0x101aca){logger[_0xcf7e('0xd')](_0xcf7e('0xe'),_0x432008,util['inspect'](_0x101aca,{'showHidden':![],'depth':null}));_0x177833(_0xcf7e('0xf'));}else if(!_0x313f2c){logger['error'](_0xcf7e('0x10'),_0x432008);_0x177833(_0xcf7e('0xf'));}else{_0x32da64(_0x313f2c);}});}catch(_0x3d583e){_0x177833(_0x3d583e);}});}function ActiveDirectoryAuthenticate(_0x2368e4,_0x17bdc5,_0xe3b2fc,_0x51e391){var _0x243f54,_0x37872f;if(!isActiveDirectoryConfigured(config)){logger[_0xcf7e('0xd')](_0xcf7e('0x11'),_0x17bdc5);return _0x51e391(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0xcf7e('0x12')][_0xcf7e('0x13')]({'where':{'id':0x1},'attributes':[_0xcf7e('0x14'),_0xcf7e('0x15')],'raw':!![]})[_0xcf7e('0x16')](function(_0xbae394){_0x243f54=_0xbae394;if(!_0x243f54[_0xcf7e('0x14')]){logger['error'](_0xcf7e('0x17'),_0x17bdc5);throw new Error(_0xcf7e('0xf'));}return _0x2368e4[_0xcf7e('0x13')]({'attributes':['id','name',_0xcf7e('0x18'),_0xcf7e('0x19'),'role','disabled',_0xcf7e('0x1a'),_0xcf7e('0x1b'),'online'],'where':{'name':_0x17bdc5,'role':{'$or':[_0xcf7e('0x1c'),_0xcf7e('0x1d'),_0xcf7e('0x1e')]},'adSsoEnabled':!![]}});})[_0xcf7e('0x16')](function(_0x1dfd02){if(!_0x1dfd02||_0x1dfd02&&_0x1dfd02['name']!==_0x17bdc5){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x37872f=_0x1dfd02;var _0x2563e4=_0x37872f[_0xcf7e('0x1f')]+'@'+config['activedirectory'][_0xcf7e('0xb')];return adAuthenticate(config[_0xcf7e('0x9')],_0x2563e4,_0xe3b2fc);})[_0xcf7e('0x16')](function(_0x35e888){if(_0x37872f[_0xcf7e('0x20')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x243f54[_0xcf7e('0x15')]>0x0){if(_0x37872f[_0xcf7e('0x1a')]){if(moment(_0x37872f[_0xcf7e('0x1b')])['add'](_0x243f54[_0xcf7e('0x15')],_0xcf7e('0x21'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0xcf7e('0x22')](_0x37872f,0x0,![],null)[_0xcf7e('0x16')](function(){return utils['getLicense'](_0x37872f);})[_0xcf7e('0x16')](function(){return _0x51e391(null,_0x37872f);});}else{return utils['getLicense'](_0x37872f)['then'](function(){return _0x51e391(null,_0x37872f);});}}else{return utils[_0xcf7e('0x23')](_0x37872f)['then'](function(){return _0x51e391(null,_0x37872f);});}})[_0xcf7e('0x24')](function(_0x35769f){return _0x51e391(null,![],_0x35769f);});}function handleError(_0x3d6725,_0x5143be,_0x2157ba){return _0x3d6725[_0xcf7e('0x25')](_0x5143be||0x1f4)[_0xcf7e('0x26')]({'message':_0x2157ba?_0x2157ba[_0xcf7e('0x27')]||_0x2157ba:''});}exports[_0xcf7e('0x28')]=function(_0x17acb8,_0x5de987,_0x26c19f){passport[_0xcf7e('0xc')](_0xcf7e('0x29'),function(_0x38df72,_0x16dcbd,_0x198c07){var _0x40bf62=_0x38df72||_0x198c07;if(_0x40bf62){return handleError(_0x5de987,0x191,_0x40bf62);}if(!_0x16dcbd){return handleError(_0x5de987,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x11994e={'payload':{'id':_0x16dcbd['id'],'role':_0x16dcbd['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x11994e)[_0xcf7e('0x16')](function(_0x45a38a){_0x5de987['json']({'id':_0x16dcbd['id'],'token':_0x45a38a,'statusCall':'','isAlreadyLogged':_0x16dcbd[_0xcf7e('0x2a')]});});}})(_0x17acb8,_0x5de987,_0x26c19f);};passport['use'](_0xcf7e('0x29'),new LocalStrategy({'usernameField':_0xcf7e('0x1f'),'passwordField':_0xcf7e('0x18')},function(_0x43881f,_0x4dcca9,_0x2725d6){return ActiveDirectoryAuthenticate(db[_0xcf7e('0x2b')],_0x43881f,_0x4dcca9,_0x2725d6);})); \ No newline at end of file +var _0x397a=['Setting','adSsoEnabled','blockDuration','then','findOne','name','password','salt','role','disabled','blocked','blockedAt','online','admin','user','agent','domain','add','minutes','getLicense','catch','message','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','User','passport','passport-local','Strategy','moment','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','url','authenticate','error','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x6bb814,_0x17196b){var _0x3c4bf6=function(_0x5bf6b9){while(--_0x5bf6b9){_0x6bb814['push'](_0x6bb814['shift']());}};_0x3c4bf6(++_0x17196b);}(_0x397a,0x130));var _0xa397=function(_0x4873df,_0x1f09e6){_0x4873df=_0x4873df-0x0;var _0x1906b1=_0x397a[_0x4873df];return _0x1906b1;};'use strict';var passport=require(_0xa397('0x0'));var LocalStrategy=require(_0xa397('0x1'))[_0xa397('0x2')];var moment=require(_0xa397('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0xa397('0x4'));var util=require(_0xa397('0x5'));var db=require(_0xa397('0x6'))['db'];var authService=require(_0xa397('0x7'));var utils=require(_0xa397('0x8'));var config=require(_0xa397('0x9'));var logger=require(_0xa397('0xa'))(_0xa397('0xb'));function isActiveDirectoryConfigured(_0x8ec4ea){var _0x46c389=![];if(typeof _0x8ec4ea[_0xa397('0xc')]!==_0xa397('0xd')){_0x46c389=_0x8ec4ea[_0xa397('0xc')]['baseDN']&&_0x8ec4ea[_0xa397('0xc')][_0xa397('0xe')]&&_0x8ec4ea[_0xa397('0xc')]['domain'];}return _0x46c389;}function adAuthenticate(_0x28d07e,_0x5ee2c3,_0x5dcb31){return new BPromise(function(_0x4caa69,_0x26df94){try{var _0xf59a07=new ActiveDirectory(_0x28d07e);_0xf59a07[_0xa397('0xf')](_0x5ee2c3,_0x5dcb31,function(_0x317176,_0x13cf9c){if(_0x317176){logger[_0xa397('0x10')]('Error\x20authenticate\x20%s:\x20%s',_0x5ee2c3,util['inspect'](_0x317176,{'showHidden':![],'depth':null}));_0x26df94('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x13cf9c){logger[_0xa397('0x10')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x5ee2c3);_0x26df94(_0xa397('0x11'));}else{_0x4caa69(_0x13cf9c);}});}catch(_0x4e9ad3){_0x26df94(_0x4e9ad3);}});}function ActiveDirectoryAuthenticate(_0x2b83a5,_0x435203,_0x5a4932,_0x3bb50f){var _0x43d2e5,_0x24c092;if(!isActiveDirectoryConfigured(config)){logger[_0xa397('0x10')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x435203);return _0x3bb50f(null,![],{'message':_0xa397('0x11')});}return db[_0xa397('0x12')]['findOne']({'where':{'id':0x1},'attributes':[_0xa397('0x13'),_0xa397('0x14')],'raw':!![]})[_0xa397('0x15')](function(_0x1be661){_0x43d2e5=_0x1be661;if(!_0x43d2e5['adSsoEnabled']){logger[_0xa397('0x10')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x435203);throw new Error(_0xa397('0x11'));}return _0x2b83a5[_0xa397('0x16')]({'attributes':['id',_0xa397('0x17'),_0xa397('0x18'),_0xa397('0x19'),_0xa397('0x1a'),_0xa397('0x1b'),_0xa397('0x1c'),_0xa397('0x1d'),_0xa397('0x1e')],'where':{'name':_0x435203,'role':{'$or':[_0xa397('0x1f'),_0xa397('0x20'),_0xa397('0x21')]},'adSsoEnabled':!![]}});})['then'](function(_0x375727){if(!_0x375727||_0x375727&&_0x375727[_0xa397('0x17')]!==_0x435203){throw new Error(_0xa397('0x11'));}_0x24c092=_0x375727;var _0x39cea5=_0x24c092[_0xa397('0x17')]+'@'+config['activedirectory'][_0xa397('0x22')];return adAuthenticate(config[_0xa397('0xc')],_0x39cea5,_0x5a4932);})[_0xa397('0x15')](function(_0xf7b69e){if(_0x24c092[_0xa397('0x1b')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x43d2e5[_0xa397('0x14')]>0x0){if(_0x24c092[_0xa397('0x1c')]){if(moment(_0x24c092[_0xa397('0x1d')])[_0xa397('0x23')](_0x43d2e5[_0xa397('0x14')],_0xa397('0x24'))>moment()){throw new Error(_0xa397('0x11'));}return utils['clearBlockUser'](_0x24c092,0x0,![],null)[_0xa397('0x15')](function(){return utils[_0xa397('0x25')](_0x24c092);})[_0xa397('0x15')](function(){return _0x3bb50f(null,_0x24c092);});}else{return utils[_0xa397('0x25')](_0x24c092)['then'](function(){return _0x3bb50f(null,_0x24c092);});}}else{return utils[_0xa397('0x25')](_0x24c092)[_0xa397('0x15')](function(){return _0x3bb50f(null,_0x24c092);});}})[_0xa397('0x26')](function(_0x29a288){return _0x3bb50f(null,![],_0x29a288);});}function handleError(_0x2f44fc,_0x545b59,_0x2e93fb){return _0x2f44fc['status'](_0x545b59||0x1f4)['send']({'message':_0x2e93fb?_0x2e93fb[_0xa397('0x27')]||_0x2e93fb:''});}exports['login']=function(_0x18f556,_0x247b3d,_0x1c886b){passport[_0xa397('0xf')](_0xa397('0x28'),function(_0x24de30,_0x367f31,_0x4be86f){var _0x45bd44=_0x24de30||_0x4be86f;if(_0x45bd44){return handleError(_0x247b3d,0x191,_0x45bd44);}if(!_0x367f31){return handleError(_0x247b3d,0x194,{'message':_0xa397('0x29')});}else{var _0x823110={'payload':{'id':_0x367f31['id'],'role':_0x367f31[_0xa397('0x1a')]},'options':{'expiresIn':0x15180}};return authService[_0xa397('0x2a')](_0x823110)[_0xa397('0x15')](function(_0x439a59){_0x247b3d[_0xa397('0x2b')]({'id':_0x367f31['id'],'token':_0x439a59,'statusCall':'','isAlreadyLogged':_0x367f31['online']});});}})(_0x18f556,_0x247b3d,_0x1c886b);};passport[_0xa397('0x2c')](_0xa397('0x28'),new LocalStrategy({'usernameField':_0xa397('0x17'),'passwordField':_0xa397('0x18')},function(_0x233f8b,_0x92b643,_0x41814e){return ActiveDirectoryAuthenticate(db[_0xa397('0x2d')],_0x233f8b,_0x92b643,_0x41814e);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index e89869f..f89d039 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 _0x272f=['post','login','exports','express'];(function(_0x305c31,_0x466b17){var _0x17f39f=function(_0x53ae03){while(--_0x53ae03){_0x305c31['push'](_0x305c31['shift']());}};_0x17f39f(++_0x466b17);}(_0x272f,0xbb));var _0xf272=function(_0x372922,_0x42883c){_0x372922=_0x372922-0x0;var _0x4e20d6=_0x272f[_0x372922];return _0x4e20d6;};'use strict';var express=require(_0xf272('0x0'));var router=express['Router']();var controller=require('./authActiveDirectory.controller');router[_0xf272('0x1')]('/',controller[_0xf272('0x2')]);module[_0xf272('0x3')]=router; \ No newline at end of file +var _0xf573=['./authActiveDirectory.controller','login','Router'];(function(_0x181195,_0x1de6da){var _0x455281=function(_0x1ddb93){while(--_0x1ddb93){_0x181195['push'](_0x181195['shift']());}};_0x455281(++_0x1de6da);}(_0xf573,0x179));var _0x3f57=function(_0x251257,_0x1f4c50){_0x251257=_0x251257-0x0;var _0x16d42f=_0xf573[_0x251257];return _0x16d42f;};'use strict';var express=require('express');var router=express[_0x3f57('0x0')]();var controller=require(_0x3f57('0x1'));router['post']('/',controller[_0x3f57('0x2')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 3d34b11..f9eec4b 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x30d166,_0x5ed9d7){var _0x3a7284=function(_0x1e6e10){while(--_0x1e6e10){_0x30d166['push'](_0x30d166['shift']());}};_0x3a7284(++_0x5ed9d7);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x14634f,_0x5ed190){var _0x5021f9=function(_0x1f4a14){while(--_0x1f4a14){_0x14634f['push'](_0x14634f['shift']());}};_0x5021f9(++_0x5ed190);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 80b51af..0321116 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 _0x2c58=['./authGoogle.controller','../../components/auth/service','get','/callback','callback','isMiddleware','login','setTokenCookie','exports','passport','Router'];(function(_0x1ec684,_0xee510d){var _0x4477ed=function(_0x13777d){while(--_0x13777d){_0x1ec684['push'](_0x1ec684['shift']());}};_0x4477ed(++_0xee510d);}(_0x2c58,0x1ab));var _0x82c5=function(_0x17380d,_0x1ad894){_0x17380d=_0x17380d-0x0;var _0x522f70=_0x2c58[_0x17380d];return _0x522f70;};'use strict';var express=require('express');var passport=require(_0x82c5('0x0'));var router=express[_0x82c5('0x1')]();var controller=require(_0x82c5('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0x82c5('0x3'));router[_0x82c5('0x4')]('/',controller['login']);router['get'](_0x82c5('0x5'),controller[_0x82c5('0x6')],authService[_0x82c5('0x7')],userController[_0x82c5('0x8')],authService[_0x82c5('0x9')]);module[_0x82c5('0xa')]=router; \ No newline at end of file +var _0xb4f5=['exports','express','passport','../../components/auth/service','get','login','callback','isMiddleware','setTokenCookie'];(function(_0x17ebe2,_0x1072c9){var _0x2694d7=function(_0x5ef0f0){while(--_0x5ef0f0){_0x17ebe2['push'](_0x17ebe2['shift']());}};_0x2694d7(++_0x1072c9);}(_0xb4f5,0x145));var _0x5b4f=function(_0x5c78d9,_0x2736c7){_0x5c78d9=_0x5c78d9-0x0;var _0x69ae1f=_0xb4f5[_0x5c78d9];return _0x69ae1f;};'use strict';var express=require(_0x5b4f('0x0'));var passport=require(_0x5b4f('0x1'));var router=express['Router']();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require(_0x5b4f('0x2'));router[_0x5b4f('0x3')]('/',controller[_0x5b4f('0x4')]);router['get']('/callback',controller[_0x5b4f('0x5')],authService[_0x5b4f('0x6')],userController[_0x5b4f('0x4')],authService[_0x5b4f('0x7')]);module[_0x5b4f('0x8')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 902bd70..c678b92 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 _0x278a=['enforcePasswordHistory','passwordHistoryLimit','securePassword','previousPasswords','validatePasswordHistory','local-login','util','passport','passport-local','jayson/promise','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','password','salt','role','blockedAt','loginAttempts','admin','user','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','add','minutes','clearBlockUser','disabled','catch','getLicense','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','login','authenticate','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x278a,0x162));var _0xa278=function(_0x427220,_0x1a15d0){_0x427220=_0x427220-0x0;var _0x243f59=_0x278a[_0x427220];return _0x243f59;};'use strict';var util=require(_0xa278('0x0'));var passport=require(_0xa278('0x1'));var LocalStrategy=require(_0xa278('0x2'))['Strategy'];var jayson=require(_0xa278('0x3'));var _=require('lodash');var rs=require(_0xa278('0x4'));var moment=require(_0xa278('0x5'));var db=require(_0xa278('0x6'))['db'];var authService=require(_0xa278('0x7'));var utils=require(_0xa278('0x8'));var client=jayson[_0xa278('0x9')][_0xa278('0xa')]({'port':0x232b});function localAuthenticate(_0x43a541,_0x6c0b4,_0x359903,_0x25903e){var _0x22aa0d,_0x2ec401;return db[_0xa278('0xb')][_0xa278('0xc')]({'where':{'id':0x1},'attributes':[_0xa278('0xd'),_0xa278('0xe')],'raw':!![]})[_0xa278('0xf')](function(_0x2bd547){_0x22aa0d=_0x2bd547;return _0x43a541[_0xa278('0xc')]({'attributes':['id','name',_0xa278('0x10'),_0xa278('0x11'),_0xa278('0x12'),'disabled','blocked',_0xa278('0x13'),_0xa278('0x14')],'where':{'name':_0x6c0b4,'role':{'$or':[_0xa278('0x15'),_0xa278('0x16'),_0xa278('0x17')]}}});})[_0xa278('0xf')](function(_0x5200c1){if(!_0x5200c1||_0x5200c1&&_0x5200c1[_0xa278('0x18')]!==_0x6c0b4){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x2ec401=_0x5200c1;return _0x2ec401;}})[_0xa278('0xf')](function(){_0x2ec401['authenticate'](_0x359903,function(_0x821598,_0x1642c7){var _0x46f4dd=_0x2ec401[_0xa278('0x14')]+0x1;if(_0x821598){return _0x25903e(_0x821598);}else if(!_0x1642c7){if(_0x2ec401['disabled']){return _0x25903e(null,![],{'message':_0xa278('0x19')});}else if(_0x22aa0d[_0xa278('0xd')]>0x0){if(_0x2ec401[_0xa278('0x1a')]){if(_0x22aa0d[_0xa278('0xe')]>0x0){if(moment(_0x2ec401[_0xa278('0x13')])[_0xa278('0x1b')](_0x22aa0d[_0xa278('0xe')],_0xa278('0x1c'))>moment()){return _0x25903e(null,![],{'message':_0xa278('0x19')});}else{return utils['clearBlockUser'](_0x2ec401,_0x46f4dd,![],null)[_0xa278('0xf')](function(){return _0x25903e(null,![],{'message':_0xa278('0x19')});});}}else{return _0x25903e(null,![],{'message':_0xa278('0x19')});}}else{if(_0x46f4dd>=_0x22aa0d[_0xa278('0xd')]){return utils[_0xa278('0x1d')](_0x2ec401,0x0,!![],moment())['then'](function(){return _0x25903e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x2ec401,_0x46f4dd,![],null)['then'](function(){return _0x25903e(null,![],{'message':_0xa278('0x19')});});}}}else{return _0x25903e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x2ec401[_0xa278('0x1e')]){return _0x25903e(null,![],{'message':_0xa278('0x19')});}else if(_0x22aa0d[_0xa278('0xd')]>0x0){if(_0x2ec401[_0xa278('0x1a')]){if(_0x22aa0d[_0xa278('0xe')]>0x0){if(moment(_0x2ec401[_0xa278('0x13')])[_0xa278('0x1b')](_0x22aa0d[_0xa278('0xe')],'minutes')>moment()){return _0x25903e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xa278('0x1d')](_0x2ec401,0x0,![],null)[_0xa278('0xf')](function(){return utils['getLicense'](_0x2ec401);})[_0xa278('0xf')](function(){return _0x25903e(null,_0x2ec401);});}}else{return _0x25903e(null,![],{'message':_0xa278('0x19')});}}else{return utils[_0xa278('0x1d')](_0x2ec401,0x0,![],null)['then'](function(){return utils['getLicense'](_0x2ec401);})[_0xa278('0xf')](function(){return _0x25903e(null,_0x2ec401);})[_0xa278('0x1f')](function(_0x25bef2){return _0x25903e(null,![],_0x25bef2);});}}else{if(_0x2ec401[_0xa278('0x1a')]){return _0x25903e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xa278('0x20')](_0x2ec401)[_0xa278('0xf')](function(){return _0x25903e(null,_0x2ec401);});}}}});})[_0xa278('0x1f')](function(_0x3c6adb){return _0x25903e(null,![],_0x3c6adb);});}function sendServiceMail(_0x3feae2){return db[_0xa278('0x21')][_0xa278('0x22')]({'where':{'service':!![]},'attributes':['id',_0xa278('0x18'),_0xa278('0x23')],'include':[{'model':db[_0xa278('0x24')],'as':_0xa278('0x25'),'include':[{'model':db[_0xa278('0x26')],'as':_0xa278('0x26')}]}]})[_0xa278('0xf')](function(_0x573abd){if(!_0x573abd){throw new Error(_0xa278('0x27'));}var _0x1d6427=_0x573abd[_0xa278('0x28')]();var _0x5e5307={'account':_0x1d6427,'message':_[_0xa278('0x29')]({'from':util[_0xa278('0x2a')](_0xa278('0x2b'),_0x573abd[_0xa278('0x18')],_0x573abd['email']||_0x573abd[_0xa278('0x25')]['user'])},_0x3feae2)};return client[_0xa278('0x2c')](_0xa278('0x2d'),_0x5e5307);})['then'](function(_0x47c2b2){if(_0x47c2b2[_0xa278('0x2e')]){throw new Error(util[_0xa278('0x2a')](_0xa278('0x2f'),_0x47c2b2[_0xa278('0x2e')][_0xa278('0x30')]||JSON['stringify'](_0x47c2b2[_0xa278('0x2e')])));}return!![];});}function handleError(_0xb62b73,_0x36bc70,_0x25bdb9){return _0xb62b73[_0xa278('0x31')](_0x36bc70||0x1f4)[_0xa278('0x32')]({'message':_0x25bdb9?_0x25bdb9[_0xa278('0x30')]||_0x25bdb9:''});}exports[_0xa278('0x33')]=function(_0x71c14f,_0x4d0246,_0x11f7a2){passport[_0xa278('0x34')]('local-login',function(_0x5a80bd,_0x4faa7a,_0x50fd64){var _0x52d55d=_0x5a80bd||_0x50fd64;if(_0x52d55d){return handleError(_0x4d0246,0x191,_0x52d55d);}if(!_0x4faa7a){return handleError(_0x4d0246,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x579cea={'payload':{'id':_0x4faa7a['id'],'role':_0x4faa7a[_0xa278('0x12')]},'options':{'expiresIn':0x15180}};return authService[_0xa278('0x35')](_0x579cea)[_0xa278('0xf')](function(_0x3ed078){_0x4d0246[_0xa278('0x36')]({'id':_0x4faa7a['id'],'token':_0x3ed078,'statusCall':'','isAlreadyLogged':_0x4faa7a[_0xa278('0x37')]});});}})(_0x71c14f,_0x4d0246,_0x11f7a2);};exports[_0xa278('0x38')]=function(_0xcadb1,_0x1e345e){if(!_0xcadb1[_0xa278('0x39')][_0xa278('0x23')]){return handleError(_0x1e345e,0x1f4,{'message':_0xa278('0x3a')});}var _0x4b517b=rs[_0xa278('0x3b')]();_0xcadb1['body'][_0xa278('0x23')]=_0xcadb1['body'][_0xa278('0x23')][_0xa278('0x3c')]()[_0xa278('0x3d')]();var _0x1747d7;return db[_0xa278('0xb')]['findOne']({'where':{'id':0x1},'attributes':[_0xa278('0xd'),_0xa278('0xe')],'raw':!![]})[_0xa278('0xf')](function(_0x10ca05){_0x1747d7=_0x10ca05;return db[_0xa278('0x3e')][_0xa278('0x22')]({'where':{'email':_0xcadb1[_0xa278('0x39')][_0xa278('0x23')]}});})['then'](function(_0x27645a){if(!_0x27645a){throw new Error(_0xa278('0x3f'));}if(_0x27645a['disabled']){throw new Error(_0xa278('0x40'));}if(_0x27645a['blocked']){if(moment(_0x27645a[_0xa278('0x13')])[_0xa278('0x1b')](_0x1747d7[_0xa278('0xe')],_0xa278('0x1c'))>moment()){throw new Error(_0xa278('0x41'));}else{_0x27645a[_0xa278('0x1a')]=![];_0x27645a[_0xa278('0x13')]=null;}}_0x27645a[_0xa278('0x42')]=_0x4b517b;_0x27645a[_0xa278('0x43')]=Date[_0xa278('0x44')]()+0x36ee80;return _0x27645a[_0xa278('0x45')]();})[_0xa278('0xf')](function(){return sendServiceMail({'to':_0xcadb1[_0xa278('0x39')]['email'],'subject':_0xa278('0x46'),'text':_0xa278('0x47')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0xa278('0x48')+_0xcadb1['headers'][_0xa278('0x49')]+_0xa278('0x4a')+_0x4b517b+'\x0a\x0a'+_0xa278('0x4b')});})[_0xa278('0xf')](function(){_0x1e345e['status'](0xc8)[_0xa278('0x32')]({'message':_0xa278('0x4c')});})[_0xa278('0x1f')](function(_0x5192b0){return handleError(_0x1e345e,0x1f4,_0x5192b0);});};exports[_0xa278('0x4d')]=function(_0x10c827,_0xc4cfe5){return db[_0xa278('0x3e')][_0xa278('0x22')]({'where':{'resetPasswordToken':_0x10c827[_0xa278('0x4e')][_0xa278('0x4f')],'resetPasswordExpires':{'$gt':Date[_0xa278('0x44')]()}}})['then'](function(_0x4e5bfd){if(!_0x4e5bfd){throw new Error(_0xa278('0x50'));}return db['Setting'][_0xa278('0xc')]({'attributes':['id','securePassword',_0xa278('0x51'),_0xa278('0x52')]})[_0xa278('0xf')](function(_0x5c955e){if(_0x5c955e[_0xa278('0x53')])authService['validatePasswordPattern'](_0x10c827[_0xa278('0x39')][_0xa278('0x10')]);if(!_0x5c955e[_0xa278('0x51')]||!_0x4e5bfd[_0xa278('0x54')])return _0x4e5bfd;authService[_0xa278('0x55')](_0x10c827['body'][_0xa278('0x10')],_0x4e5bfd['previousPasswords'],_0x5c955e['passwordHistoryLimit']);return _0x4e5bfd;})[_0xa278('0xf')](function(){_0x4e5bfd[_0xa278('0x10')]=_0x10c827[_0xa278('0x39')][_0xa278('0x10')];_0x4e5bfd[_0xa278('0x42')]=null;_0x4e5bfd[_0xa278('0x43')]=null;return _0x4e5bfd['save']();});})[_0xa278('0xf')](function(){_0xc4cfe5['status'](0xc8)[_0xa278('0x32')]({'message':'Password\x20reset!'});})['catch'](function(_0x573e05){return handleError(_0xc4cfe5,0x1f4,_0x573e05);});};passport['use'](_0xa278('0x56'),new LocalStrategy({'usernameField':'name','passwordField':_0xa278('0x10')},function(_0x2264fb,_0x434f42,_0x422cda){return localAuthenticate(db[_0xa278('0x3e')],_0x2264fb,_0x434f42,_0x422cda);})); \ No newline at end of file +var _0x7b0c=['resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','Setting','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','save','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../config/utils','client','http','findOne','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','allowedLoginAttempts','add','clearBlockUser','minutes','getLicense','catch','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','format','\x22%s\x22\x20<%s>','email','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','send','message','local-login','forgot','body','generate','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken'];(function(_0x221fd1,_0x12be62){var _0x3e158e=function(_0x2a7c71){while(--_0x2a7c71){_0x221fd1['push'](_0x221fd1['shift']());}};_0x3e158e(++_0x12be62);}(_0x7b0c,0x158));var _0xc7b0=function(_0x4ff5cc,_0x3aa73f){_0x4ff5cc=_0x4ff5cc-0x0;var _0x5115f4=_0x7b0c[_0x4ff5cc];return _0x5115f4;};'use strict';var util=require(_0xc7b0('0x0'));var passport=require(_0xc7b0('0x1'));var LocalStrategy=require(_0xc7b0('0x2'))[_0xc7b0('0x3')];var jayson=require(_0xc7b0('0x4'));var _=require(_0xc7b0('0x5'));var rs=require(_0xc7b0('0x6'));var moment=require(_0xc7b0('0x7'));var db=require(_0xc7b0('0x8'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xc7b0('0x9'));var client=jayson[_0xc7b0('0xa')][_0xc7b0('0xb')]({'port':0x232b});function localAuthenticate(_0x3f0157,_0x44b242,_0x19c74c,_0x4bc876){var _0x25c093,_0x88cf48;return db['Setting'][_0xc7b0('0xc')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xc7b0('0xd')],'raw':!![]})[_0xc7b0('0xe')](function(_0xa95787){_0x25c093=_0xa95787;return _0x3f0157[_0xc7b0('0xc')]({'attributes':['id',_0xc7b0('0xf'),_0xc7b0('0x10'),_0xc7b0('0x11'),_0xc7b0('0x12'),_0xc7b0('0x13'),_0xc7b0('0x14'),_0xc7b0('0x15'),'loginAttempts'],'where':{'name':_0x44b242,'role':{'$or':[_0xc7b0('0x16'),_0xc7b0('0x17'),_0xc7b0('0x18')]}}});})[_0xc7b0('0xe')](function(_0x3c534d){if(!_0x3c534d||_0x3c534d&&_0x3c534d['name']!==_0x44b242){throw new Error(_0xc7b0('0x19'));}else{_0x88cf48=_0x3c534d;return _0x88cf48;}})[_0xc7b0('0xe')](function(){_0x88cf48[_0xc7b0('0x1a')](_0x19c74c,function(_0x5e6fc8,_0x4d52f1){var _0x305e96=_0x88cf48['loginAttempts']+0x1;if(_0x5e6fc8){return _0x4bc876(_0x5e6fc8);}else if(!_0x4d52f1){if(_0x88cf48['disabled']){return _0x4bc876(null,![],{'message':_0xc7b0('0x19')});}else if(_0x25c093[_0xc7b0('0x1b')]>0x0){if(_0x88cf48[_0xc7b0('0x14')]){if(_0x25c093['blockDuration']>0x0){if(moment(_0x88cf48[_0xc7b0('0x15')])[_0xc7b0('0x1c')](_0x25c093[_0xc7b0('0xd')],'minutes')>moment()){return _0x4bc876(null,![],{'message':_0xc7b0('0x19')});}else{return utils[_0xc7b0('0x1d')](_0x88cf48,_0x305e96,![],null)[_0xc7b0('0xe')](function(){return _0x4bc876(null,![],{'message':_0xc7b0('0x19')});});}}else{return _0x4bc876(null,![],{'message':_0xc7b0('0x19')});}}else{if(_0x305e96>=_0x25c093[_0xc7b0('0x1b')]){return utils['clearBlockUser'](_0x88cf48,0x0,!![],moment())[_0xc7b0('0xe')](function(){return _0x4bc876(null,![],{'message':_0xc7b0('0x19')});});}else{return utils['clearBlockUser'](_0x88cf48,_0x305e96,![],null)['then'](function(){return _0x4bc876(null,![],{'message':_0xc7b0('0x19')});});}}}else{return _0x4bc876(null,![],{'message':_0xc7b0('0x19')});}}else{if(_0x88cf48[_0xc7b0('0x13')]){return _0x4bc876(null,![],{'message':_0xc7b0('0x19')});}else if(_0x25c093[_0xc7b0('0x1b')]>0x0){if(_0x88cf48[_0xc7b0('0x14')]){if(_0x25c093[_0xc7b0('0xd')]>0x0){if(moment(_0x88cf48[_0xc7b0('0x15')])[_0xc7b0('0x1c')](_0x25c093['blockDuration'],_0xc7b0('0x1e'))>moment()){return _0x4bc876(null,![],{'message':_0xc7b0('0x19')});}else{return utils[_0xc7b0('0x1d')](_0x88cf48,0x0,![],null)[_0xc7b0('0xe')](function(){return utils[_0xc7b0('0x1f')](_0x88cf48);})[_0xc7b0('0xe')](function(){return _0x4bc876(null,_0x88cf48);});}}else{return _0x4bc876(null,![],{'message':_0xc7b0('0x19')});}}else{return utils['clearBlockUser'](_0x88cf48,0x0,![],null)['then'](function(){return utils[_0xc7b0('0x1f')](_0x88cf48);})['then'](function(){return _0x4bc876(null,_0x88cf48);})[_0xc7b0('0x20')](function(_0x3b1251){return _0x4bc876(null,![],_0x3b1251);});}}else{if(_0x88cf48[_0xc7b0('0x14')]){return _0x4bc876(null,![],{'message':_0xc7b0('0x19')});}else{return utils[_0xc7b0('0x1f')](_0x88cf48)['then'](function(){return _0x4bc876(null,_0x88cf48);});}}}});})[_0xc7b0('0x20')](function(_0x5dff8c){return _0x4bc876(null,![],_0x5dff8c);});}function sendServiceMail(_0x340340){return db[_0xc7b0('0x21')]['find']({'where':{'service':!![]},'attributes':['id',_0xc7b0('0xf'),'email'],'include':[{'model':db[_0xc7b0('0x22')],'as':_0xc7b0('0x23'),'include':[{'model':db['CloudProvider'],'as':_0xc7b0('0x24')}]}]})['then'](function(_0x32db1d){if(!_0x32db1d){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x35d6c3=_0x32db1d[_0xc7b0('0x25')]();var _0x36ae6e={'account':_0x35d6c3,'message':_['merge']({'from':util[_0xc7b0('0x26')](_0xc7b0('0x27'),_0x32db1d[_0xc7b0('0xf')],_0x32db1d[_0xc7b0('0x28')]||_0x32db1d[_0xc7b0('0x23')]['user'])},_0x340340)};return client['request'](_0xc7b0('0x29'),_0x36ae6e);})[_0xc7b0('0xe')](function(_0x183cdf){if(_0x183cdf[_0xc7b0('0x2a')]){throw new Error(util[_0xc7b0('0x26')](_0xc7b0('0x2b'),_0x183cdf[_0xc7b0('0x2a')]['message']||JSON[_0xc7b0('0x2c')](_0x183cdf[_0xc7b0('0x2a')])));}return!![];});}function handleError(_0xffd8e9,_0x274cfb,_0x19147b){return _0xffd8e9['status'](_0x274cfb||0x1f4)[_0xc7b0('0x2d')]({'message':_0x19147b?_0x19147b[_0xc7b0('0x2e')]||_0x19147b:''});}exports['login']=function(_0x41e300,_0x3c9dec,_0x18b924){passport['authenticate'](_0xc7b0('0x2f'),function(_0x344953,_0x130946,_0x150848){var _0x2b6905=_0x344953||_0x150848;if(_0x2b6905){return handleError(_0x3c9dec,0x191,_0x2b6905);}if(!_0x130946){return handleError(_0x3c9dec,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x264f64={'payload':{'id':_0x130946['id'],'role':_0x130946[_0xc7b0('0x12')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x264f64)[_0xc7b0('0xe')](function(_0x2c9e6a){_0x3c9dec['json']({'id':_0x130946['id'],'token':_0x2c9e6a,'statusCall':'','isAlreadyLogged':_0x130946['online']});});}})(_0x41e300,_0x3c9dec,_0x18b924);};exports[_0xc7b0('0x30')]=function(_0x3db59d,_0x4e1d77){if(!_0x3db59d[_0xc7b0('0x31')][_0xc7b0('0x28')]){return handleError(_0x4e1d77,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x5e8053=rs[_0xc7b0('0x32')]();_0x3db59d['body'][_0xc7b0('0x28')]=_0x3db59d[_0xc7b0('0x31')][_0xc7b0('0x28')]['trim']()['toLowerCase']();var _0x3c3468;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xc7b0('0x1b'),_0xc7b0('0xd')],'raw':!![]})[_0xc7b0('0xe')](function(_0x36cf16){_0x3c3468=_0x36cf16;return db[_0xc7b0('0x33')][_0xc7b0('0x34')]({'where':{'email':_0x3db59d[_0xc7b0('0x31')][_0xc7b0('0x28')]}});})['then'](function(_0x55b1ed){if(!_0x55b1ed){throw new Error(_0xc7b0('0x35'));}if(_0x55b1ed[_0xc7b0('0x13')]){throw new Error(_0xc7b0('0x36'));}if(_0x55b1ed['blocked']){if(moment(_0x55b1ed[_0xc7b0('0x15')])[_0xc7b0('0x1c')](_0x3c3468[_0xc7b0('0xd')],_0xc7b0('0x1e'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x55b1ed[_0xc7b0('0x14')]=![];_0x55b1ed[_0xc7b0('0x15')]=null;}}_0x55b1ed[_0xc7b0('0x37')]=_0x5e8053;_0x55b1ed[_0xc7b0('0x38')]=Date[_0xc7b0('0x39')]()+0x36ee80;return _0x55b1ed['save']();})[_0xc7b0('0xe')](function(){return sendServiceMail({'to':_0x3db59d['body'][_0xc7b0('0x28')],'subject':_0xc7b0('0x3a'),'text':_0xc7b0('0x3b')+_0xc7b0('0x3c')+_0xc7b0('0x3d')+_0x3db59d[_0xc7b0('0x3e')][_0xc7b0('0x3f')]+'/reset/'+_0x5e8053+'\x0a\x0a'+_0xc7b0('0x40')});})[_0xc7b0('0xe')](function(){_0x4e1d77[_0xc7b0('0x41')](0xc8)[_0xc7b0('0x2d')]({'message':_0xc7b0('0x42')});})[_0xc7b0('0x20')](function(_0x68200c){return handleError(_0x4e1d77,0x1f4,_0x68200c);});};exports[_0xc7b0('0x43')]=function(_0x5691a0,_0x5f3b7f){return db[_0xc7b0('0x33')]['find']({'where':{'resetPasswordToken':_0x5691a0[_0xc7b0('0x44')][_0xc7b0('0x45')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xc7b0('0xe')](function(_0x22015e){if(!_0x22015e){throw new Error(_0xc7b0('0x46'));}return db[_0xc7b0('0x47')][_0xc7b0('0xc')]({'attributes':['id',_0xc7b0('0x48'),_0xc7b0('0x49'),_0xc7b0('0x4a')]})[_0xc7b0('0xe')](function(_0x23004f){if(_0x23004f[_0xc7b0('0x48')])authService['validatePasswordPattern'](_0x5691a0['body'][_0xc7b0('0x10')]);if(!_0x23004f[_0xc7b0('0x49')]||!_0x22015e[_0xc7b0('0x4b')])return _0x22015e;authService[_0xc7b0('0x4c')](_0x5691a0['body'][_0xc7b0('0x10')],_0x22015e['previousPasswords'],_0x23004f[_0xc7b0('0x4a')]);return _0x22015e;})[_0xc7b0('0xe')](function(){_0x22015e[_0xc7b0('0x10')]=_0x5691a0[_0xc7b0('0x31')]['password'];_0x22015e['resetPasswordToken']=null;_0x22015e[_0xc7b0('0x38')]=null;return _0x22015e[_0xc7b0('0x4d')]();});})[_0xc7b0('0xe')](function(){_0x5f3b7f[_0xc7b0('0x41')](0xc8)[_0xc7b0('0x2d')]({'message':_0xc7b0('0x4e')});})[_0xc7b0('0x20')](function(_0x14e0e8){return handleError(_0x5f3b7f,0x1f4,_0x14e0e8);});};passport[_0xc7b0('0x4f')](_0xc7b0('0x2f'),new LocalStrategy({'usernameField':'name','passwordField':_0xc7b0('0x10')},function(_0x3df58a,_0x5d54f9,_0x2fc59d){return localAuthenticate(db[_0xc7b0('0x33')],_0x3df58a,_0x5d54f9,_0x2fc59d);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 551ef8c..b659b51 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 _0xcfd7=['./authLocal.controller','post','login','/forgot','reset','exports','express','Router'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0xcfd7,0x1c6));var _0x7cfd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcfd7[_0x321bb2];return _0x9c12ed;};'use strict';var express=require(_0x7cfd('0x0'));var router=express[_0x7cfd('0x1')]();var controller=require(_0x7cfd('0x2'));router[_0x7cfd('0x3')]('/',controller[_0x7cfd('0x4')]);router['post'](_0x7cfd('0x5'),controller['forgot']);router[_0x7cfd('0x3')]('/reset/:token',controller[_0x7cfd('0x6')]);module[_0x7cfd('0x7')]=router; \ No newline at end of file +var _0x025f=['login','/forgot','forgot','/reset/:token','reset','exports','express','Router','./authLocal.controller','post'];(function(_0x4f81dd,_0x49b9f9){var _0x33ec2f=function(_0x1940e7){while(--_0x1940e7){_0x4f81dd['push'](_0x4f81dd['shift']());}};_0x33ec2f(++_0x49b9f9);}(_0x025f,0xc4));var _0xf025=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x025f[_0x2c91e9];return _0x13f0ff;};'use strict';var express=require(_0xf025('0x0'));var router=express[_0xf025('0x1')]();var controller=require(_0xf025('0x2'));router[_0xf025('0x3')]('/',controller[_0xf025('0x4')]);router[_0xf025('0x3')](_0xf025('0x5'),controller[_0xf025('0x6')]);router[_0xf025('0x3')](_0xf025('0x7'),controller[_0xf025('0x8')]);module[_0xf025('0x9')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index debea07..621887e 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 _0x92f0=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x463b0c,_0x385dd4){var _0x386455=function(_0x53781d){while(--_0x53781d){_0x463b0c['push'](_0x463b0c['shift']());}};_0x386455(++_0x385dd4);}(_0x92f0,0x191));var _0x092f=function(_0x1a4a06,_0x36a5c2){_0x1a4a06=_0x1a4a06-0x0;var _0x49ec08=_0x92f0[_0x1a4a06];return _0x49ec08;};'use strict';var Sequelize=require(_0x092f('0x0'));module[_0x092f('0x1')]={'name':{'type':Sequelize[_0x092f('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x092f('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x092f('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x6715=['sequelize','STRING','BOOLEAN','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6715,0x128));var _0x5671=function(_0x40b891,_0x41d70e){_0x40b891=_0x40b891-0x0;var _0x367ce7=_0x6715[_0x40b891];return _0x367ce7;};'use strict';var Sequelize=require(_0x5671('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5671('0x1')]},'status':{'type':Sequelize[_0x5671('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x5671('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 6746bd6..ae3a145 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 _0xc79b=['addActions','Action','ids','getActions','hasOwnProperty','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','index','map','Automation','rawAttributes','fieldName','type','key','model','name','keys','intersection','query','attributes','fields','length','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','create','update','body','find','params','addConditions','omit','findOne','Condition','order','getConditions','nolimit'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xc79b,0x104));var _0xbc79=function(_0x45f8c0,_0x60b02){_0x45f8c0=_0x45f8c0-0x0;var _0x188b09=_0xc79b[_0x45f8c0];return _0x188b09;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbc79('0x0'));var jsonpatch=require(_0xbc79('0x1'));var rp=require('request-promise');var moment=require(_0xbc79('0x2'));var BPromise=require(_0xbc79('0x3'));var Mustache=require(_0xbc79('0x4'));var util=require('util');var path=require(_0xbc79('0x5'));var sox=require(_0xbc79('0x6'));var csv=require(_0xbc79('0x7'));var ejs=require(_0xbc79('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbc79('0x9'));var crypto=require(_0xbc79('0xa'));var jsforce=require(_0xbc79('0xb'));var deskjs=require(_0xbc79('0xc'));var toCsv=require('to-csv');var querystring=require(_0xbc79('0xd'));var Papa=require(_0xbc79('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbc79('0xf'));var as=require(_0xbc79('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbc79('0x11'))(_0xbc79('0x12'));var utils=require(_0xbc79('0x13'));var config=require(_0xbc79('0x14'));var licenseUtil=require(_0xbc79('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f1a46,_0x3ef3b9){_0x3ef3b9=_0x3ef3b9||0xcc;return function(_0x34a83d){if(_0x34a83d){return _0x3f1a46[_0xbc79('0x16')](_0x3ef3b9);}return _0x3f1a46[_0xbc79('0x17')](_0x3ef3b9)['end']();};}function respondWithResult(_0x57d82f,_0x232173){_0x232173=_0x232173||0xc8;return function(_0xa8ab12){if(_0xa8ab12){return _0x57d82f[_0xbc79('0x17')](_0x232173)[_0xbc79('0x18')](_0xa8ab12);}};}function respondWithFilteredResult(_0x3e942d,_0x302040){return function(_0x2d8455){if(_0x2d8455){var _0x57dd49=typeof _0x302040['offset']===_0xbc79('0x19')&&typeof _0x302040[_0xbc79('0x1a')]===_0xbc79('0x19');var _0x3fbecb=_0x2d8455['count'];var _0x7e867f=_0x57dd49?0x0:_0x302040[_0xbc79('0x1b')];var _0x52b5f1=_0x57dd49?_0x2d8455[_0xbc79('0x1c')]:_0x302040[_0xbc79('0x1b')]+_0x302040[_0xbc79('0x1a')];var _0x1ee684;if(_0x52b5f1>=_0x3fbecb){_0x52b5f1=_0x3fbecb;_0x1ee684=0xc8;}else{_0x1ee684=0xce;}_0x3e942d[_0xbc79('0x17')](_0x1ee684);return _0x3e942d[_0xbc79('0x1d')](_0xbc79('0x1e'),_0x7e867f+'-'+_0x52b5f1+'/'+_0x3fbecb)[_0xbc79('0x18')](_0x2d8455);}return null;};}function patchUpdates(_0x6918f7){return function(_0xff4bf6){try{jsonpatch[_0xbc79('0x1f')](_0xff4bf6,_0x6918f7,!![]);}catch(_0x83e20d){return BPromise[_0xbc79('0x20')](_0x83e20d);}return _0xff4bf6[_0xbc79('0x21')]();};}function saveUpdates(_0x13bb31,_0x16f38d){return function(_0x3de33c){if(_0x3de33c){return _0x3de33c['update'](_0x13bb31)[_0xbc79('0x22')](function(_0x5d7152){return _0x5d7152;});}return null;};}function removeEntity(_0x185ccc,_0x3e176b){return function(_0x43755c){if(_0x43755c){return _0x43755c[_0xbc79('0x23')]()[_0xbc79('0x22')](function(){_0x185ccc['status'](0xcc)[_0xbc79('0x24')]();});}};}function handleEntityNotFound(_0x506453,_0x1b95b8){return function(_0x7ceca9){if(!_0x7ceca9){_0x506453[_0xbc79('0x16')](0x194);}return _0x7ceca9;};}function handleError(_0x1654c2,_0x49fbc9){_0x49fbc9=_0x49fbc9||0x1f4;return function(_0x338e79){logger[_0xbc79('0x25')](_0x338e79[_0xbc79('0x26')]);if(_0x338e79['name']){delete _0x338e79['name'];}_0x1654c2[_0xbc79('0x17')](_0x49fbc9)['send'](_0x338e79);};}exports[_0xbc79('0x27')]=function(_0x28792b,_0x51822c){var _0xdfaab0={},_0x25f2e3={},_0x6e91b6={'count':0x0,'rows':[]};var _0x19d789=_[_0xbc79('0x28')](db[_0xbc79('0x29')][_0xbc79('0x2a')],function(_0x4ffcad){return{'name':_0x4ffcad[_0xbc79('0x2b')],'type':_0x4ffcad[_0xbc79('0x2c')][_0xbc79('0x2d')]};});_0x25f2e3[_0xbc79('0x2e')]=_[_0xbc79('0x28')](_0x19d789,_0xbc79('0x2f'));_0x25f2e3['query']=_[_0xbc79('0x30')](_0x28792b['query']);_0x25f2e3['filters']=_[_0xbc79('0x31')](_0x25f2e3['model'],_0x25f2e3[_0xbc79('0x32')]);_0xdfaab0[_0xbc79('0x33')]=_[_0xbc79('0x31')](_0x25f2e3[_0xbc79('0x2e')],qs[_0xbc79('0x34')](_0x28792b[_0xbc79('0x32')][_0xbc79('0x34')]));_0xdfaab0[_0xbc79('0x33')]=_0xdfaab0[_0xbc79('0x33')][_0xbc79('0x35')]?_0xdfaab0[_0xbc79('0x33')]:_0x25f2e3[_0xbc79('0x2e')];if(!_0x28792b['query']['hasOwnProperty']('nolimit')){_0xdfaab0['limit']=qs[_0xbc79('0x1a')](_0x28792b[_0xbc79('0x32')]['limit']);_0xdfaab0[_0xbc79('0x1b')]=qs[_0xbc79('0x1b')](_0x28792b[_0xbc79('0x32')][_0xbc79('0x1b')]);}_0xdfaab0['order']=qs[_0xbc79('0x36')](_0x28792b[_0xbc79('0x32')]['sort']);_0xdfaab0['where']=qs[_0xbc79('0x37')](_[_0xbc79('0x38')](_0x28792b[_0xbc79('0x32')],_0x25f2e3[_0xbc79('0x37')]),_0x19d789);if(_0x28792b[_0xbc79('0x32')][_0xbc79('0x39')]){_0xdfaab0[_0xbc79('0x3a')]=_[_0xbc79('0x3b')](_0xdfaab0[_0xbc79('0x3a')],{'$or':_[_0xbc79('0x28')](_0x19d789,function(_0x2d3893){if(_0x2d3893['type']!==_0xbc79('0x3c')){var _0x8eae2a={};_0x8eae2a[_0x2d3893[_0xbc79('0x2f')]]={'$like':'%'+_0x28792b['query'][_0xbc79('0x39')]+'%'};return _0x8eae2a;}})});}_0xdfaab0=_['merge']({},_0xdfaab0,_0x28792b[_0xbc79('0x3d')]);var _0x21ee80={'where':_0xdfaab0[_0xbc79('0x3a')]};return db['Automation'][_0xbc79('0x1c')](_0x21ee80)[_0xbc79('0x22')](function(_0x57f266){_0x6e91b6[_0xbc79('0x1c')]=_0x57f266;if(_0x28792b[_0xbc79('0x32')][_0xbc79('0x3e')]){_0xdfaab0[_0xbc79('0x3f')]=[{'all':!![]}];}return db['Automation'][_0xbc79('0x40')](_0xdfaab0);})[_0xbc79('0x22')](function(_0x387d31){_0x6e91b6[_0xbc79('0x41')]=_0x387d31;return _0x6e91b6;})[_0xbc79('0x22')](respondWithFilteredResult(_0x51822c,_0xdfaab0))[_0xbc79('0x42')](handleError(_0x51822c,null));};exports[_0xbc79('0x43')]=function(_0x261e1d,_0x41fc88){var _0xf3dac4={'raw':![],'where':{'id':_0x261e1d['params']['id']}},_0xd0c0d2={};_0xd0c0d2[_0xbc79('0x2e')]=_[_0xbc79('0x30')](db[_0xbc79('0x29')]['rawAttributes']);_0xd0c0d2[_0xbc79('0x32')]=_['keys'](_0x261e1d[_0xbc79('0x32')]);_0xd0c0d2['filters']=_['intersection'](_0xd0c0d2['model'],_0xd0c0d2[_0xbc79('0x32')]);_0xf3dac4['attributes']=_[_0xbc79('0x31')](_0xd0c0d2[_0xbc79('0x2e')],qs[_0xbc79('0x34')](_0x261e1d[_0xbc79('0x32')][_0xbc79('0x34')]));_0xf3dac4[_0xbc79('0x33')]=_0xf3dac4['attributes'][_0xbc79('0x35')]?_0xf3dac4[_0xbc79('0x33')]:_0xd0c0d2[_0xbc79('0x2e')];if(_0x261e1d[_0xbc79('0x32')][_0xbc79('0x3e')]){_0xf3dac4['include']=[{'all':!![]}];}_0xf3dac4=_[_0xbc79('0x3b')]({},_0xf3dac4,_0x261e1d[_0xbc79('0x3d')]);return db[_0xbc79('0x29')]['find'](_0xf3dac4)[_0xbc79('0x22')](handleEntityNotFound(_0x41fc88,null))[_0xbc79('0x22')](respondWithResult(_0x41fc88,null))[_0xbc79('0x42')](handleError(_0x41fc88,null));};exports[_0xbc79('0x44')]=function(_0x556f50,_0x43c7e7){return db[_0xbc79('0x29')][_0xbc79('0x44')](_0x556f50['body'],{})[_0xbc79('0x22')](respondWithResult(_0x43c7e7,0xc9))[_0xbc79('0x42')](handleError(_0x43c7e7,null));};exports[_0xbc79('0x45')]=function(_0x1ec8f0,_0x431a85){if(_0x1ec8f0[_0xbc79('0x46')]['id']){delete _0x1ec8f0[_0xbc79('0x46')]['id'];}return db[_0xbc79('0x29')][_0xbc79('0x47')]({'where':{'id':_0x1ec8f0[_0xbc79('0x48')]['id']}})[_0xbc79('0x22')](handleEntityNotFound(_0x431a85,null))[_0xbc79('0x22')](saveUpdates(_0x1ec8f0[_0xbc79('0x46')],null))[_0xbc79('0x22')](respondWithResult(_0x431a85,null))[_0xbc79('0x42')](handleError(_0x431a85,null));};exports[_0xbc79('0x23')]=function(_0x198f1d,_0x190f6f){return db[_0xbc79('0x29')][_0xbc79('0x47')]({'where':{'id':_0x198f1d[_0xbc79('0x48')]['id']}})[_0xbc79('0x22')](handleEntityNotFound(_0x190f6f,null))[_0xbc79('0x22')](removeEntity(_0x190f6f,null))[_0xbc79('0x42')](handleError(_0x190f6f,null));};exports[_0xbc79('0x49')]=function(_0x3d949d,_0x3e9652,_0x3dfd15){return db['Condition'][_0xbc79('0x47')]({'where':{'id':_0x3d949d[_0xbc79('0x48')]['id']}})[_0xbc79('0x22')](handleEntityNotFound(_0x3e9652,null))[_0xbc79('0x22')](function(_0x252bad){if(_0x252bad){return _0x252bad[_0xbc79('0x49')](_0x3d949d[_0xbc79('0x46')]['ids'],_[_0xbc79('0x4a')](_0x3d949d[_0xbc79('0x46')],['ids','id'])||{});}})[_0xbc79('0x22')](respondWithResult(_0x3e9652,null))[_0xbc79('0x42')](handleError(_0x3e9652,null));};exports['getConditions']=function(_0x4441ae,_0x41da6d,_0x2a879a){var _0x932394={};var _0x8d6c9d={};var _0x14a2ee;var _0x3b3129;return db[_0xbc79('0x29')][_0xbc79('0x4b')]({'where':{'id':_0x4441ae[_0xbc79('0x48')]['id']}})[_0xbc79('0x22')](handleEntityNotFound(_0x41da6d,null))['then'](function(_0x34bc3f){if(_0x34bc3f){_0x14a2ee=_0x34bc3f;_0x8d6c9d[_0xbc79('0x2e')]=_[_0xbc79('0x30')](db[_0xbc79('0x4c')][_0xbc79('0x2a')]);_0x8d6c9d[_0xbc79('0x32')]=_[_0xbc79('0x30')](_0x4441ae[_0xbc79('0x32')]);_0x8d6c9d[_0xbc79('0x37')]=_[_0xbc79('0x31')](_0x8d6c9d[_0xbc79('0x2e')],_0x8d6c9d[_0xbc79('0x32')]);_0x932394[_0xbc79('0x33')]=_[_0xbc79('0x31')](_0x8d6c9d[_0xbc79('0x2e')],qs[_0xbc79('0x34')](_0x4441ae[_0xbc79('0x32')][_0xbc79('0x34')]));_0x932394[_0xbc79('0x33')]=_0x932394['attributes'][_0xbc79('0x35')]?_0x932394[_0xbc79('0x33')]:_0x8d6c9d[_0xbc79('0x2e')];_0x932394[_0xbc79('0x4d')]=qs['sort'](_0x4441ae[_0xbc79('0x32')][_0xbc79('0x36')]);_0x932394['where']=qs[_0xbc79('0x37')](_[_0xbc79('0x38')](_0x4441ae[_0xbc79('0x32')],_0x8d6c9d[_0xbc79('0x37')]));if(_0x4441ae['query']['filter']){_0x932394[_0xbc79('0x3a')]=_[_0xbc79('0x3b')](_0x932394[_0xbc79('0x3a')],{'$or':_['map'](_0x932394[_0xbc79('0x33')],function(_0x2861a2){var _0x3b8c9a={};_0x3b8c9a[_0x2861a2]={'$like':'%'+_0x4441ae[_0xbc79('0x32')][_0xbc79('0x39')]+'%'};return _0x3b8c9a;})});}_0x932394=_[_0xbc79('0x3b')]({},_0x932394,_0x4441ae[_0xbc79('0x3d')]);return _0x14a2ee[_0xbc79('0x4e')](_0x932394);}})[_0xbc79('0x22')](function(_0x477e9b){if(_0x477e9b){_0x3b3129=_0x477e9b[_0xbc79('0x35')];if(!_0x4441ae[_0xbc79('0x32')]['hasOwnProperty'](_0xbc79('0x4f'))){_0x932394[_0xbc79('0x1a')]=qs[_0xbc79('0x1a')](_0x4441ae[_0xbc79('0x32')]['limit']);_0x932394[_0xbc79('0x1b')]=qs[_0xbc79('0x1b')](_0x4441ae[_0xbc79('0x32')][_0xbc79('0x1b')]);}return _0x14a2ee[_0xbc79('0x4e')](_0x932394);}})['then'](function(_0xc7a506){if(_0xc7a506){return _0xc7a506?{'count':_0x3b3129,'rows':_0xc7a506}:null;}})[_0xbc79('0x22')](respondWithResult(_0x41da6d,null))['catch'](handleError(_0x41da6d,null));};exports[_0xbc79('0x50')]=function(_0x2aeb95,_0x3b51e2,_0x3321a2){return db[_0xbc79('0x51')]['find']({'where':{'id':_0x2aeb95[_0xbc79('0x48')]['id']}})['then'](handleEntityNotFound(_0x3b51e2,null))['then'](function(_0x32d38c){if(_0x32d38c){return _0x32d38c['addActions'](_0x2aeb95['body'][_0xbc79('0x52')],_[_0xbc79('0x4a')](_0x2aeb95[_0xbc79('0x46')],['ids','id'])||{});}})[_0xbc79('0x22')](respondWithResult(_0x3b51e2,null))[_0xbc79('0x42')](handleError(_0x3b51e2,null));};exports[_0xbc79('0x53')]=function(_0x4b485d,_0x139d70,_0x2181e0){var _0x233e6e={};var _0x4b47b3={};var _0xd0edf4;var _0x4ddeef;return db[_0xbc79('0x29')]['findOne']({'where':{'id':_0x4b485d['params']['id']}})['then'](handleEntityNotFound(_0x139d70,null))[_0xbc79('0x22')](function(_0x2657fc){if(_0x2657fc){_0xd0edf4=_0x2657fc;_0x4b47b3[_0xbc79('0x2e')]=_[_0xbc79('0x30')](db[_0xbc79('0x51')]['rawAttributes']);_0x4b47b3[_0xbc79('0x32')]=_[_0xbc79('0x30')](_0x4b485d[_0xbc79('0x32')]);_0x4b47b3[_0xbc79('0x37')]=_['intersection'](_0x4b47b3['model'],_0x4b47b3[_0xbc79('0x32')]);_0x233e6e[_0xbc79('0x33')]=_['intersection'](_0x4b47b3['model'],qs[_0xbc79('0x34')](_0x4b485d[_0xbc79('0x32')][_0xbc79('0x34')]));_0x233e6e[_0xbc79('0x33')]=_0x233e6e[_0xbc79('0x33')][_0xbc79('0x35')]?_0x233e6e[_0xbc79('0x33')]:_0x4b47b3['model'];_0x233e6e[_0xbc79('0x4d')]=qs['sort'](_0x4b485d[_0xbc79('0x32')]['sort']);_0x233e6e['where']=qs[_0xbc79('0x37')](_['pick'](_0x4b485d[_0xbc79('0x32')],_0x4b47b3['filters']));if(_0x4b485d[_0xbc79('0x32')]['filter']){_0x233e6e[_0xbc79('0x3a')]=_[_0xbc79('0x3b')](_0x233e6e['where'],{'$or':_[_0xbc79('0x28')](_0x233e6e[_0xbc79('0x33')],function(_0x3eaa47){var _0x55e7b7={};_0x55e7b7[_0x3eaa47]={'$like':'%'+_0x4b485d[_0xbc79('0x32')]['filter']+'%'};return _0x55e7b7;})});}_0x233e6e=_['merge']({},_0x233e6e,_0x4b485d[_0xbc79('0x3d')]);return _0xd0edf4[_0xbc79('0x53')](_0x233e6e);}})['then'](function(_0x16dfb2){if(_0x16dfb2){_0x4ddeef=_0x16dfb2[_0xbc79('0x35')];if(!_0x4b485d['query'][_0xbc79('0x54')](_0xbc79('0x4f'))){_0x233e6e['limit']=qs[_0xbc79('0x1a')](_0x4b485d['query'][_0xbc79('0x1a')]);_0x233e6e[_0xbc79('0x1b')]=qs['offset'](_0x4b485d['query'][_0xbc79('0x1b')]);}return _0xd0edf4[_0xbc79('0x53')](_0x233e6e);}})['then'](function(_0x377ab7){if(_0x377ab7){return _0x377ab7?{'count':_0x4ddeef,'rows':_0x377ab7}:null;}})['then'](respondWithResult(_0x139d70,null))['catch'](handleError(_0x139d70,null));}; \ No newline at end of file +var _0xcdc8=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','rows','catch','show','includeAll','find','create','update','body','params','addConditions','Condition','omit','ids','getConditions','findOne','addActions','Action','getActions','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','apply','reject','save','then','destroy','sendStatus','error','name','send','index','map','Automation','rawAttributes','fieldName','type'];(function(_0x5ddc07,_0x2157e2){var _0x132a73=function(_0x22a099){while(--_0x22a099){_0x5ddc07['push'](_0x5ddc07['shift']());}};_0x132a73(++_0x2157e2);}(_0xcdc8,0x7a));var _0x8cdc=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xcdc8[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8cdc('0x0'));var zipdir=require(_0x8cdc('0x1'));var jsonpatch=require(_0x8cdc('0x2'));var rp=require(_0x8cdc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8cdc('0x4'));var util=require(_0x8cdc('0x5'));var path=require(_0x8cdc('0x6'));var sox=require(_0x8cdc('0x7'));var csv=require(_0x8cdc('0x8'));var ejs=require(_0x8cdc('0x9'));var fs=require('fs');var fs_extra=require(_0x8cdc('0xa'));var _=require(_0x8cdc('0xb'));var squel=require('squel');var crypto=require(_0x8cdc('0xc'));var jsforce=require(_0x8cdc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8cdc('0x8'));var querystring=require(_0x8cdc('0xe'));var Papa=require(_0x8cdc('0xf'));var Redis=require('ioredis');var authService=require(_0x8cdc('0x10'));var qs=require(_0x8cdc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x8cdc('0x12'));var config=require(_0x8cdc('0x13'));var licenseUtil=require(_0x8cdc('0x14'));var db=require(_0x8cdc('0x15'))['db'];function respondWithStatusCode(_0x249615,_0x3b8305){_0x3b8305=_0x3b8305||0xcc;return function(_0x102bdb){if(_0x102bdb){return _0x249615['sendStatus'](_0x3b8305);}return _0x249615[_0x8cdc('0x16')](_0x3b8305)[_0x8cdc('0x17')]();};}function respondWithResult(_0x3261b5,_0x318d51){_0x318d51=_0x318d51||0xc8;return function(_0xfa270b){if(_0xfa270b){return _0x3261b5[_0x8cdc('0x16')](_0x318d51)[_0x8cdc('0x18')](_0xfa270b);}};}function respondWithFilteredResult(_0x2bb01f,_0x51138a){return function(_0x51f9eb){if(_0x51f9eb){var _0x4f1ccd=typeof _0x51138a[_0x8cdc('0x19')]===_0x8cdc('0x1a')&&typeof _0x51138a[_0x8cdc('0x1b')]===_0x8cdc('0x1a');var _0x49ead5=_0x51f9eb['count'];var _0x5bd9d7=_0x4f1ccd?0x0:_0x51138a[_0x8cdc('0x19')];var _0x7ae949=_0x4f1ccd?_0x51f9eb['count']:_0x51138a[_0x8cdc('0x19')]+_0x51138a[_0x8cdc('0x1b')];var _0x52d0f7;if(_0x7ae949>=_0x49ead5){_0x7ae949=_0x49ead5;_0x52d0f7=0xc8;}else{_0x52d0f7=0xce;}_0x2bb01f[_0x8cdc('0x16')](_0x52d0f7);return _0x2bb01f[_0x8cdc('0x1c')]('Content-Range',_0x5bd9d7+'-'+_0x7ae949+'/'+_0x49ead5)['json'](_0x51f9eb);}return null;};}function patchUpdates(_0x5a701c){return function(_0x1c9be8){try{jsonpatch[_0x8cdc('0x1d')](_0x1c9be8,_0x5a701c,!![]);}catch(_0x3f22b5){return BPromise[_0x8cdc('0x1e')](_0x3f22b5);}return _0x1c9be8[_0x8cdc('0x1f')]();};}function saveUpdates(_0x588adb,_0x159ea8){return function(_0x3af7d2){if(_0x3af7d2){return _0x3af7d2['update'](_0x588adb)[_0x8cdc('0x20')](function(_0x4e8426){return _0x4e8426;});}return null;};}function removeEntity(_0x18b64b,_0x2ce1de){return function(_0x520d28){if(_0x520d28){return _0x520d28[_0x8cdc('0x21')]()[_0x8cdc('0x20')](function(){_0x18b64b['status'](0xcc)[_0x8cdc('0x17')]();});}};}function handleEntityNotFound(_0x107407,_0x3a481c){return function(_0x49867f){if(!_0x49867f){_0x107407[_0x8cdc('0x22')](0x194);}return _0x49867f;};}function handleError(_0x3da074,_0x164ea3){_0x164ea3=_0x164ea3||0x1f4;return function(_0xbdadeb){logger[_0x8cdc('0x23')](_0xbdadeb['stack']);if(_0xbdadeb[_0x8cdc('0x24')]){delete _0xbdadeb[_0x8cdc('0x24')];}_0x3da074[_0x8cdc('0x16')](_0x164ea3)[_0x8cdc('0x25')](_0xbdadeb);};}exports[_0x8cdc('0x26')]=function(_0x11539c,_0x84185e){var _0x29a8d5={},_0xc7cce={},_0x5ddf7c={'count':0x0,'rows':[]};var _0x2477e7=_[_0x8cdc('0x27')](db[_0x8cdc('0x28')][_0x8cdc('0x29')],function(_0x51c834){return{'name':_0x51c834[_0x8cdc('0x2a')],'type':_0x51c834[_0x8cdc('0x2b')][_0x8cdc('0x2c')]};});_0xc7cce[_0x8cdc('0x2d')]=_[_0x8cdc('0x27')](_0x2477e7,_0x8cdc('0x24'));_0xc7cce[_0x8cdc('0x2e')]=_[_0x8cdc('0x2f')](_0x11539c['query']);_0xc7cce[_0x8cdc('0x30')]=_[_0x8cdc('0x31')](_0xc7cce['model'],_0xc7cce[_0x8cdc('0x2e')]);_0x29a8d5[_0x8cdc('0x32')]=_[_0x8cdc('0x31')](_0xc7cce[_0x8cdc('0x2d')],qs['fields'](_0x11539c[_0x8cdc('0x2e')][_0x8cdc('0x33')]));_0x29a8d5['attributes']=_0x29a8d5[_0x8cdc('0x32')][_0x8cdc('0x34')]?_0x29a8d5[_0x8cdc('0x32')]:_0xc7cce[_0x8cdc('0x2d')];if(!_0x11539c[_0x8cdc('0x2e')][_0x8cdc('0x35')](_0x8cdc('0x36'))){_0x29a8d5['limit']=qs[_0x8cdc('0x1b')](_0x11539c[_0x8cdc('0x2e')][_0x8cdc('0x1b')]);_0x29a8d5['offset']=qs['offset'](_0x11539c[_0x8cdc('0x2e')][_0x8cdc('0x19')]);}_0x29a8d5[_0x8cdc('0x37')]=qs[_0x8cdc('0x38')](_0x11539c['query'][_0x8cdc('0x38')]);_0x29a8d5[_0x8cdc('0x39')]=qs[_0x8cdc('0x30')](_[_0x8cdc('0x3a')](_0x11539c['query'],_0xc7cce[_0x8cdc('0x30')]),_0x2477e7);if(_0x11539c['query'][_0x8cdc('0x3b')]){_0x29a8d5[_0x8cdc('0x39')]=_[_0x8cdc('0x3c')](_0x29a8d5[_0x8cdc('0x39')],{'$or':_['map'](_0x2477e7,function(_0x52395c){if(_0x52395c['type']!==_0x8cdc('0x3d')){var _0x938e7e={};_0x938e7e[_0x52395c[_0x8cdc('0x24')]]={'$like':'%'+_0x11539c['query'][_0x8cdc('0x3b')]+'%'};return _0x938e7e;}})});}_0x29a8d5=_['merge']({},_0x29a8d5,_0x11539c[_0x8cdc('0x3e')]);var _0x413a47={'where':_0x29a8d5[_0x8cdc('0x39')]};return db[_0x8cdc('0x28')][_0x8cdc('0x3f')](_0x413a47)['then'](function(_0x2f1eb6){_0x5ddf7c[_0x8cdc('0x3f')]=_0x2f1eb6;if(_0x11539c[_0x8cdc('0x2e')]['includeAll']){_0x29a8d5[_0x8cdc('0x40')]=[{'all':!![]}];}return db[_0x8cdc('0x28')]['findAll'](_0x29a8d5);})[_0x8cdc('0x20')](function(_0x19932d){_0x5ddf7c[_0x8cdc('0x41')]=_0x19932d;return _0x5ddf7c;})['then'](respondWithFilteredResult(_0x84185e,_0x29a8d5))[_0x8cdc('0x42')](handleError(_0x84185e,null));};exports[_0x8cdc('0x43')]=function(_0x536806,_0x36cc22){var _0x4a9b4c={'raw':![],'where':{'id':_0x536806['params']['id']}},_0x5a8089={};_0x5a8089[_0x8cdc('0x2d')]=_[_0x8cdc('0x2f')](db[_0x8cdc('0x28')][_0x8cdc('0x29')]);_0x5a8089[_0x8cdc('0x2e')]=_[_0x8cdc('0x2f')](_0x536806[_0x8cdc('0x2e')]);_0x5a8089[_0x8cdc('0x30')]=_[_0x8cdc('0x31')](_0x5a8089[_0x8cdc('0x2d')],_0x5a8089[_0x8cdc('0x2e')]);_0x4a9b4c[_0x8cdc('0x32')]=_[_0x8cdc('0x31')](_0x5a8089['model'],qs[_0x8cdc('0x33')](_0x536806['query'][_0x8cdc('0x33')]));_0x4a9b4c[_0x8cdc('0x32')]=_0x4a9b4c['attributes']['length']?_0x4a9b4c['attributes']:_0x5a8089[_0x8cdc('0x2d')];if(_0x536806[_0x8cdc('0x2e')][_0x8cdc('0x44')]){_0x4a9b4c[_0x8cdc('0x40')]=[{'all':!![]}];}_0x4a9b4c=_[_0x8cdc('0x3c')]({},_0x4a9b4c,_0x536806[_0x8cdc('0x3e')]);return db[_0x8cdc('0x28')][_0x8cdc('0x45')](_0x4a9b4c)['then'](handleEntityNotFound(_0x36cc22,null))[_0x8cdc('0x20')](respondWithResult(_0x36cc22,null))[_0x8cdc('0x42')](handleError(_0x36cc22,null));};exports[_0x8cdc('0x46')]=function(_0x4a6aeb,_0x238584){return db[_0x8cdc('0x28')][_0x8cdc('0x46')](_0x4a6aeb['body'],{})[_0x8cdc('0x20')](respondWithResult(_0x238584,0xc9))[_0x8cdc('0x42')](handleError(_0x238584,null));};exports[_0x8cdc('0x47')]=function(_0x25b919,_0x47af38){if(_0x25b919[_0x8cdc('0x48')]['id']){delete _0x25b919[_0x8cdc('0x48')]['id'];}return db[_0x8cdc('0x28')]['find']({'where':{'id':_0x25b919[_0x8cdc('0x49')]['id']}})['then'](handleEntityNotFound(_0x47af38,null))[_0x8cdc('0x20')](saveUpdates(_0x25b919[_0x8cdc('0x48')],null))['then'](respondWithResult(_0x47af38,null))[_0x8cdc('0x42')](handleError(_0x47af38,null));};exports['destroy']=function(_0x4156b0,_0x2d41eb){return db[_0x8cdc('0x28')][_0x8cdc('0x45')]({'where':{'id':_0x4156b0[_0x8cdc('0x49')]['id']}})[_0x8cdc('0x20')](handleEntityNotFound(_0x2d41eb,null))[_0x8cdc('0x20')](removeEntity(_0x2d41eb,null))[_0x8cdc('0x42')](handleError(_0x2d41eb,null));};exports[_0x8cdc('0x4a')]=function(_0x481030,_0x320023,_0x3bbe0a){return db[_0x8cdc('0x4b')][_0x8cdc('0x45')]({'where':{'id':_0x481030[_0x8cdc('0x49')]['id']}})[_0x8cdc('0x20')](handleEntityNotFound(_0x320023,null))[_0x8cdc('0x20')](function(_0x481df4){if(_0x481df4){return _0x481df4['addConditions'](_0x481030['body']['ids'],_[_0x8cdc('0x4c')](_0x481030[_0x8cdc('0x48')],[_0x8cdc('0x4d'),'id'])||{});}})[_0x8cdc('0x20')](respondWithResult(_0x320023,null))['catch'](handleError(_0x320023,null));};exports[_0x8cdc('0x4e')]=function(_0x1a95f8,_0x27d399,_0x841659){var _0x4bc03d={};var _0x10bac6={};var _0x3c7829;var _0x3b39d2;return db['Automation'][_0x8cdc('0x4f')]({'where':{'id':_0x1a95f8[_0x8cdc('0x49')]['id']}})['then'](handleEntityNotFound(_0x27d399,null))[_0x8cdc('0x20')](function(_0x357a04){if(_0x357a04){_0x3c7829=_0x357a04;_0x10bac6[_0x8cdc('0x2d')]=_[_0x8cdc('0x2f')](db[_0x8cdc('0x4b')][_0x8cdc('0x29')]);_0x10bac6['query']=_[_0x8cdc('0x2f')](_0x1a95f8['query']);_0x10bac6[_0x8cdc('0x30')]=_[_0x8cdc('0x31')](_0x10bac6['model'],_0x10bac6[_0x8cdc('0x2e')]);_0x4bc03d[_0x8cdc('0x32')]=_['intersection'](_0x10bac6[_0x8cdc('0x2d')],qs[_0x8cdc('0x33')](_0x1a95f8[_0x8cdc('0x2e')][_0x8cdc('0x33')]));_0x4bc03d[_0x8cdc('0x32')]=_0x4bc03d['attributes'][_0x8cdc('0x34')]?_0x4bc03d[_0x8cdc('0x32')]:_0x10bac6['model'];_0x4bc03d[_0x8cdc('0x37')]=qs['sort'](_0x1a95f8[_0x8cdc('0x2e')][_0x8cdc('0x38')]);_0x4bc03d['where']=qs[_0x8cdc('0x30')](_[_0x8cdc('0x3a')](_0x1a95f8[_0x8cdc('0x2e')],_0x10bac6[_0x8cdc('0x30')]));if(_0x1a95f8[_0x8cdc('0x2e')][_0x8cdc('0x3b')]){_0x4bc03d[_0x8cdc('0x39')]=_[_0x8cdc('0x3c')](_0x4bc03d[_0x8cdc('0x39')],{'$or':_[_0x8cdc('0x27')](_0x4bc03d[_0x8cdc('0x32')],function(_0x3a15cf){var _0x5e835a={};_0x5e835a[_0x3a15cf]={'$like':'%'+_0x1a95f8['query'][_0x8cdc('0x3b')]+'%'};return _0x5e835a;})});}_0x4bc03d=_['merge']({},_0x4bc03d,_0x1a95f8['options']);return _0x3c7829[_0x8cdc('0x4e')](_0x4bc03d);}})[_0x8cdc('0x20')](function(_0x1dee2e){if(_0x1dee2e){_0x3b39d2=_0x1dee2e[_0x8cdc('0x34')];if(!_0x1a95f8[_0x8cdc('0x2e')][_0x8cdc('0x35')]('nolimit')){_0x4bc03d[_0x8cdc('0x1b')]=qs['limit'](_0x1a95f8[_0x8cdc('0x2e')][_0x8cdc('0x1b')]);_0x4bc03d[_0x8cdc('0x19')]=qs['offset'](_0x1a95f8[_0x8cdc('0x2e')][_0x8cdc('0x19')]);}return _0x3c7829['getConditions'](_0x4bc03d);}})[_0x8cdc('0x20')](function(_0x3a624b){if(_0x3a624b){return _0x3a624b?{'count':_0x3b39d2,'rows':_0x3a624b}:null;}})['then'](respondWithResult(_0x27d399,null))[_0x8cdc('0x42')](handleError(_0x27d399,null));};exports[_0x8cdc('0x50')]=function(_0x1d4f34,_0x10b531,_0x343e5d){return db['Action']['find']({'where':{'id':_0x1d4f34[_0x8cdc('0x49')]['id']}})[_0x8cdc('0x20')](handleEntityNotFound(_0x10b531,null))[_0x8cdc('0x20')](function(_0x55ec3a){if(_0x55ec3a){return _0x55ec3a[_0x8cdc('0x50')](_0x1d4f34[_0x8cdc('0x48')][_0x8cdc('0x4d')],_[_0x8cdc('0x4c')](_0x1d4f34[_0x8cdc('0x48')],[_0x8cdc('0x4d'),'id'])||{});}})[_0x8cdc('0x20')](respondWithResult(_0x10b531,null))[_0x8cdc('0x42')](handleError(_0x10b531,null));};exports['getActions']=function(_0x480d95,_0x13d5c2,_0x227dac){var _0x38c1f2={};var _0x48fdbf={};var _0x53979f;var _0x42f6ba;return db['Automation']['findOne']({'where':{'id':_0x480d95[_0x8cdc('0x49')]['id']}})['then'](handleEntityNotFound(_0x13d5c2,null))['then'](function(_0x12c81c){if(_0x12c81c){_0x53979f=_0x12c81c;_0x48fdbf[_0x8cdc('0x2d')]=_[_0x8cdc('0x2f')](db[_0x8cdc('0x51')][_0x8cdc('0x29')]);_0x48fdbf[_0x8cdc('0x2e')]=_[_0x8cdc('0x2f')](_0x480d95[_0x8cdc('0x2e')]);_0x48fdbf[_0x8cdc('0x30')]=_[_0x8cdc('0x31')](_0x48fdbf[_0x8cdc('0x2d')],_0x48fdbf[_0x8cdc('0x2e')]);_0x38c1f2[_0x8cdc('0x32')]=_[_0x8cdc('0x31')](_0x48fdbf['model'],qs[_0x8cdc('0x33')](_0x480d95[_0x8cdc('0x2e')][_0x8cdc('0x33')]));_0x38c1f2[_0x8cdc('0x32')]=_0x38c1f2[_0x8cdc('0x32')][_0x8cdc('0x34')]?_0x38c1f2[_0x8cdc('0x32')]:_0x48fdbf[_0x8cdc('0x2d')];_0x38c1f2[_0x8cdc('0x37')]=qs['sort'](_0x480d95['query'][_0x8cdc('0x38')]);_0x38c1f2[_0x8cdc('0x39')]=qs['filters'](_[_0x8cdc('0x3a')](_0x480d95[_0x8cdc('0x2e')],_0x48fdbf[_0x8cdc('0x30')]));if(_0x480d95['query'][_0x8cdc('0x3b')]){_0x38c1f2[_0x8cdc('0x39')]=_[_0x8cdc('0x3c')](_0x38c1f2[_0x8cdc('0x39')],{'$or':_['map'](_0x38c1f2[_0x8cdc('0x32')],function(_0x1f8ffd){var _0x24cb38={};_0x24cb38[_0x1f8ffd]={'$like':'%'+_0x480d95['query'][_0x8cdc('0x3b')]+'%'};return _0x24cb38;})});}_0x38c1f2=_[_0x8cdc('0x3c')]({},_0x38c1f2,_0x480d95['options']);return _0x53979f[_0x8cdc('0x52')](_0x38c1f2);}})[_0x8cdc('0x20')](function(_0x484ea4){if(_0x484ea4){_0x42f6ba=_0x484ea4[_0x8cdc('0x34')];if(!_0x480d95[_0x8cdc('0x2e')]['hasOwnProperty'](_0x8cdc('0x36'))){_0x38c1f2[_0x8cdc('0x1b')]=qs[_0x8cdc('0x1b')](_0x480d95[_0x8cdc('0x2e')]['limit']);_0x38c1f2[_0x8cdc('0x19')]=qs[_0x8cdc('0x19')](_0x480d95[_0x8cdc('0x2e')][_0x8cdc('0x19')]);}return _0x53979f[_0x8cdc('0x52')](_0x38c1f2);}})[_0x8cdc('0x20')](function(_0x48479a){if(_0x48479a){return _0x48479a?{'count':_0x42f6ba,'rows':_0x48479a}:null;}})[_0x8cdc('0x20')](respondWithResult(_0x13d5c2,null))[_0x8cdc('0x42')](handleError(_0x13d5c2,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 29497d4..f5fdcd8 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 _0xea5e=['define','Automation','tools_automations','api','moment','bluebird','request-promise','path','rimraf','./automation.attributes','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xea5e,0x1a5));var _0xeea5=function(_0xb3546a,_0x716a9d){_0xb3546a=_0xb3546a-0x0;var _0x170e67=_0xea5e[_0xb3546a];return _0x170e67;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xeea5('0x0'));var moment=require(_0xeea5('0x1'));var BPromise=require(_0xeea5('0x2'));var rp=require(_0xeea5('0x3'));var fs=require('fs');var path=require(_0xeea5('0x4'));var rimraf=require(_0xeea5('0x5'));var config=require('../../config/environment');var attributes=require(_0xeea5('0x6'));module[_0xeea5('0x7')]=function(_0x514fb4,_0x5c3af5){return _0x514fb4[_0xeea5('0x8')](_0xeea5('0x9'),attributes,{'tableName':_0xeea5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5af7=['request-promise','rimraf','./automation.attributes','exports','define','Automation','tools_automations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x4d14bb,_0xe9dbb5){var _0x1aaa75=function(_0x2c397d){while(--_0x2c397d){_0x4d14bb['push'](_0x4d14bb['shift']());}};_0x1aaa75(++_0xe9dbb5);}(_0x5af7,0x193));var _0x75af=function(_0x1c06f4,_0x2feba6){_0x1c06f4=_0x1c06f4-0x0;var _0x1a727e=_0x5af7[_0x1c06f4];return _0x1a727e;};'use strict';var _=require(_0x75af('0x0'));var util=require(_0x75af('0x1'));var logger=require(_0x75af('0x2'))('api');var moment=require(_0x75af('0x3'));var BPromise=require(_0x75af('0x4'));var rp=require(_0x75af('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x75af('0x6'));var config=require('../../config/environment');var attributes=require(_0x75af('0x7'));module[_0x75af('0x8')]=function(_0x22d5eb,_0x53c39e){return _0x22d5eb[_0x75af('0x9')](_0x75af('0xa'),attributes,{'tableName':_0x75af('0xb'),'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 16d4741..d650fd4 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 _0x9458=['moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x9458,0x1b8));var _0x8945=function(_0xf1a8a6,_0x270451){_0xf1a8a6=_0xf1a8a6-0x0;var _0x49d0cc=_0x9458[_0xf1a8a6];return _0x49d0cc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8945('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8945('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x8945('0x2'));var logger=require(_0x8945('0x3'))(_0x8945('0x4'));var config=require(_0x8945('0x5'));var jayson=require(_0x8945('0x6'));var client=jayson[_0x8945('0x7')][_0x8945('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12187d,_0x928802,_0x1a2b8f){return new BPromise(function(_0x4aec0b,_0x29eaed){return client[_0x8945('0x9')](_0x12187d,_0x1a2b8f)[_0x8945('0xa')](function(_0x307b9e){logger[_0x8945('0xb')](_0x8945('0xc'),_0x928802,'request\x20sent');logger[_0x8945('0xd')](_0x8945('0xe'),_0x928802,'request\x20sent',JSON['stringify'](_0x307b9e));if(_0x307b9e[_0x8945('0xf')]){if(_0x307b9e['error'][_0x8945('0x10')]===0x1f4){logger[_0x8945('0xf')](_0x8945('0xc'),_0x928802,_0x307b9e[_0x8945('0xf')][_0x8945('0x11')]);return _0x29eaed(_0x307b9e[_0x8945('0xf')]['message']);}logger[_0x8945('0xf')](_0x8945('0xc'),_0x928802,_0x307b9e['error'][_0x8945('0x11')]);return _0x4aec0b(_0x307b9e[_0x8945('0xf')][_0x8945('0x11')]);}else{logger[_0x8945('0xb')](_0x8945('0xc'),_0x928802,_0x8945('0x12'));_0x4aec0b(_0x307b9e['result']['message']);}})[_0x8945('0x13')](function(_0x4c0b8f){logger['error'](_0x8945('0xc'),_0x928802,_0x4c0b8f);_0x29eaed(_0x4c0b8f);});});} \ No newline at end of file +var _0x7e22=['jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0xcfbd05,_0x66cfe3){var _0x62e825=function(_0x4b95c0){while(--_0x4b95c0){_0xcfbd05['push'](_0xcfbd05['shift']());}};_0x62e825(++_0x66cfe3);}(_0x7e22,0x1d8));var _0x27e2=function(_0x3f3002,_0x4f2ead){_0x3f3002=_0x3f3002-0x0;var _0x673f4d=_0x7e22[_0x3f3002];return _0x673f4d;};'use strict';var _=require(_0x27e2('0x0'));var util=require('util');var moment=require(_0x27e2('0x1'));var BPromise=require(_0x27e2('0x2'));var rs=require(_0x27e2('0x3'));var fs=require('fs');var Redis=require(_0x27e2('0x4'));var db=require(_0x27e2('0x5'))['db'];var utils=require(_0x27e2('0x6'));var logger=require('../../config/logger')(_0x27e2('0x7'));var config=require('../../config/environment');var jayson=require(_0x27e2('0x8'));var client=jayson[_0x27e2('0x9')][_0x27e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8ec259,_0x54c99e,_0x207ab6){return new BPromise(function(_0x419985,_0x44cf2e){return client[_0x27e2('0xb')](_0x8ec259,_0x207ab6)[_0x27e2('0xc')](function(_0xadcc3e){logger[_0x27e2('0xd')](_0x27e2('0xe'),_0x54c99e,'request\x20sent');logger[_0x27e2('0xf')](_0x27e2('0x10'),_0x54c99e,'request\x20sent',JSON[_0x27e2('0x11')](_0xadcc3e));if(_0xadcc3e[_0x27e2('0x12')]){if(_0xadcc3e[_0x27e2('0x12')][_0x27e2('0x13')]===0x1f4){logger['error'](_0x27e2('0xe'),_0x54c99e,_0xadcc3e['error'][_0x27e2('0x14')]);return _0x44cf2e(_0xadcc3e[_0x27e2('0x12')][_0x27e2('0x14')]);}logger[_0x27e2('0x12')](_0x27e2('0xe'),_0x54c99e,_0xadcc3e['error'][_0x27e2('0x14')]);return _0x419985(_0xadcc3e['error'][_0x27e2('0x14')]);}else{logger[_0x27e2('0xd')](_0x27e2('0xe'),_0x54c99e,_0x27e2('0x15'));_0x419985(_0xadcc3e[_0x27e2('0x16')][_0x27e2('0x14')]);}})[_0x27e2('0x17')](function(_0x18a838){logger['error']('Automation,\x20%s,\x20%s',_0x54c99e,_0x18a838);_0x44cf2e(_0x18a838);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 69977ee..ab15c11 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 _0x35aa=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','getActions','post','addConditions','/:id/actions','addActions','put','update','exports','util','path'];(function(_0x4c15f9,_0xcf53db){var _0xfd429b=function(_0x28213b){while(--_0x28213b){_0x4c15f9['push'](_0x4c15f9['shift']());}};_0xfd429b(++_0xcf53db);}(_0x35aa,0xbe));var _0xa35a=function(_0xc6879,_0x84a966){_0xc6879=_0xc6879-0x0;var _0x54f7a4=_0x35aa[_0xc6879];return _0x54f7a4;};'use strict';var multer=require('multer');var util=require(_0xa35a('0x0'));var path=require(_0xa35a('0x1'));var timeout=require(_0xa35a('0x2'));var express=require(_0xa35a('0x3'));var router=express['Router']();var fs_extra=require(_0xa35a('0x4'));var auth=require(_0xa35a('0x5'));var interaction=require(_0xa35a('0x6'));var config=require(_0xa35a('0x7'));var controller=require(_0xa35a('0x8'));router[_0xa35a('0x9')]('/',auth[_0xa35a('0xa')](),controller[_0xa35a('0xb')]);router['get'](_0xa35a('0xc'),auth['isAuthenticated'](),controller[_0xa35a('0xd')]);router[_0xa35a('0x9')](_0xa35a('0xe'),auth[_0xa35a('0xa')](),controller[_0xa35a('0xf')]);router[_0xa35a('0x9')]('/:id/actions',auth[_0xa35a('0xa')](),controller[_0xa35a('0x10')]);router[_0xa35a('0x11')]('/',auth[_0xa35a('0xa')](),controller['create']);router[_0xa35a('0x11')](_0xa35a('0xe'),auth['isAuthenticated'](),controller[_0xa35a('0x12')]);router[_0xa35a('0x11')](_0xa35a('0x13'),auth[_0xa35a('0xa')](),controller[_0xa35a('0x14')]);router[_0xa35a('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xa35a('0x16')]);router['delete'](_0xa35a('0xc'),auth[_0xa35a('0xa')](),controller['destroy']);module[_0xa35a('0x17')]=router; \ No newline at end of file +var _0x487d=['update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/conditions','getConditions','getActions','post','create','addConditions','/:id/actions','put'];(function(_0x1e01bf,_0x488c10){var _0x43ad02=function(_0x14866b){while(--_0x14866b){_0x1e01bf['push'](_0x1e01bf['shift']());}};_0x43ad02(++_0x488c10);}(_0x487d,0x1b4));var _0xd487=function(_0x29ac6b,_0x184514){_0x29ac6b=_0x29ac6b-0x0;var _0x44a29b=_0x487d[_0x29ac6b];return _0x44a29b;};'use strict';var multer=require(_0xd487('0x0'));var util=require(_0xd487('0x1'));var path=require(_0xd487('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd487('0x3')]();var fs_extra=require(_0xd487('0x4'));var auth=require(_0xd487('0x5'));var interaction=require(_0xd487('0x6'));var config=require(_0xd487('0x7'));var controller=require('./automation.controller');router[_0xd487('0x8')]('/',auth[_0xd487('0x9')](),controller['index']);router[_0xd487('0x8')](_0xd487('0xa'),auth[_0xd487('0x9')](),controller[_0xd487('0xb')]);router['get'](_0xd487('0xc'),auth[_0xd487('0x9')](),controller[_0xd487('0xd')]);router['get']('/:id/actions',auth['isAuthenticated'](),controller[_0xd487('0xe')]);router[_0xd487('0xf')]('/',auth['isAuthenticated'](),controller[_0xd487('0x10')]);router[_0xd487('0xf')](_0xd487('0xc'),auth[_0xd487('0x9')](),controller[_0xd487('0x11')]);router[_0xd487('0xf')](_0xd487('0x12'),auth[_0xd487('0x9')](),controller['addActions']);router[_0xd487('0x13')](_0xd487('0xa'),auth[_0xd487('0x9')](),controller[_0xd487('0x14')]);router[_0xd487('0x15')](_0xd487('0xa'),auth[_0xd487('0x9')](),controller[_0xd487('0x16')]);module[_0xd487('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 9486825..4736328 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 _0x866a=['never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#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\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always'];(function(_0x39285d,_0x4e7c32){var _0x5b809b=function(_0x1c0b21){while(--_0x1c0b21){_0x39285d['push'](_0x39285d['shift']());}};_0x5b809b(++_0x4e7c32);}(_0x866a,0x156));var _0xa866=function(_0x14909f,_0xe25f2e){_0x14909f=_0x14909f-0x0;var _0x19698c=_0x866a[_0x14909f];return _0x19698c;};'use strict';var Sequelize=require('sequelize');module[_0xa866('0x0')]={'name':{'type':Sequelize[_0xa866('0x1')],'unique':_0xa866('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xa866('0x3')](_0xa866('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xa866('0x1')]},'active':{'type':Sequelize[_0xa866('0x5')],'defaultValue':0x0,'comment':_0xa866('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xa866('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xa866('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xa866('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xa866('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xa866('0x9')](0x3)[_0xa866('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa866('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0xa866('0x9')](0x3)[_0xa866('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa866('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa866('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa866('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0xa866('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa866('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0xa866('0x9')](0x5)[_0xa866('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa866('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xa866('0x9')](0x3)[_0xa866('0x7')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xa866('0x9')](0x5)[_0xa866('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa866('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0xa866('0x9')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xa866('0x10')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xa866('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0xa866('0x3')](_0xa866('0x11'),_0xa866('0x12'),'onlyIfOpen'),'defaultValue':_0xa866('0x11')},'dialAMDActive':{'type':Sequelize[_0xa866('0x5')],'defaultValue':0x0,'comment':_0xa866('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0xa866('0x9')](0x9)[_0xa866('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xa866('0x14')},'dialAMDGreeting':{'type':Sequelize[_0xa866('0x9')](0x9)[_0xa866('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xa866('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xa866('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xa866('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xa866('0x9')](0x9)[_0xa866('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa866('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0xa866('0x9')](0x9)[_0xa866('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xa866('0x9')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xa866('0x9')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xa866('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xa866('0x9')](0x5)[_0xa866('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xa866('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa866('0x19')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xa866('0x1a'),_0xa866('0x1b')),'defaultValue':_0xa866('0x1a')},'dialPrefix':{'type':Sequelize[_0xa866('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xa866('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa866('0x1c')},'dialCutDigit':{'type':Sequelize[_0xa866('0x9')](0x3)[_0xa866('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa866('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xa866('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa866('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xa866('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xa866('0x9')](0x3)[_0xa866('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa866('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa866('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa866('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa866('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xa866('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa866('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0xa866('0x9')](0x3)[_0xa866('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa866('0x22')},'dialMachineRetryFrequency':{'type':Sequelize[_0xa866('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xa866('0x9')](0x3)[_0xa866('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa866('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xa866('0x9')](0x5)[_0xa866('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x589b=['name','ENUM','ivr','BOOLEAN','INTEGER','UNSIGNED','Max\x20200\x20calls.','STRING','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\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,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','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)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x589b,0x97));var _0xb589=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x589b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb589('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb589('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xb589('0x2')](_0xb589('0x3')),'allowNull':![],'defaultValue':_0xb589('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xb589('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xb589('0x5')](0x4)[_0xb589('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xb589('0x7')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xb589('0x8')]},'dialOriginateTimeout':{'type':Sequelize[_0xb589('0x5')](0x3)[_0xb589('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb589('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xb589('0x5')](0x3)[_0xb589('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb589('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xb589('0x5')](0x5)[_0xb589('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb589('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0xb589('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb589('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0xb589('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb589('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xb589('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xb589('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb589('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0xb589('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xb589('0x8')],'defaultValue':_0xb589('0x10')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xb589('0x11'),_0xb589('0x12'),_0xb589('0x13')),'defaultValue':_0xb589('0x11')},'dialAMDActive':{'type':Sequelize[_0xb589('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xb589('0x5')](0x9)[_0xb589('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xb589('0x14')},'dialAMDGreeting':{'type':Sequelize[_0xb589('0x5')](0x9)[_0xb589('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xb589('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xb589('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xb589('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xb589('0x5')](0x9)[_0xb589('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xb589('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xb589('0x5')](0x9)[_0xb589('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xb589('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xb589('0x5')](0x9)[_0xb589('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xb589('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xb589('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xb589('0x5')](0x9)[_0xb589('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb589('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0xb589('0x2')](_0xb589('0x1b'),_0xb589('0x1c')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xb589('0x8')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xb589('0x5')](0x3)[_0xb589('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb589('0x1d')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xb589('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb589('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xb589('0x5')](0x3)[_0xb589('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb589('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xb589('0x5')](0x5)[_0xb589('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb589('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0xb589('0x5')](0x3)[_0xb589('0x6')],'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[_0xb589('0x5')](0x3)[_0xb589('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb589('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xb589('0x5')](0x5)[_0xb589('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb589('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0xb589('0x5')](0x3)[_0xb589('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb589('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0xb589('0x5')](0x5)[_0xb589('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb589('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xb589('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb589('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xb589('0x5')](0x5)[_0xb589('0x6')],'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 e90fcbf..f93ddd2 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 _0x48b2=['include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','body','omit','createdAt','UserProfileSection','getHoppers','findOne','CmHopper','findAll','rows','getHopperHistories','CampaignId','CmHopperHistory','getHopperFinals','pick','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','select','field','toString','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','fromQuery','NOW()','CmListId','cm_hopper_additional_phones','cmHopperId','h.id','ci.item','ci.OrderBY','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','CmList','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','then','destroy','get','IvrCampaigns','stack','name','send','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','catch','show','params','filters'];(function(_0x1325a0,_0x241c6e){var _0x511d7c=function(_0xd686d2){while(--_0xd686d2){_0x1325a0['push'](_0x1325a0['shift']());}};_0x511d7c(++_0x241c6e);}(_0x48b2,0x176));var _0x248b=function(_0x11c702,_0x50d44a){_0x11c702=_0x11c702-0x0;var _0x425081=_0x48b2[_0x11c702];return _0x425081;};'use strict';var emlformat=require(_0x248b('0x0'));var rimraf=require(_0x248b('0x1'));var zipdir=require(_0x248b('0x2'));var jsonpatch=require(_0x248b('0x3'));var rp=require(_0x248b('0x4'));var moment=require(_0x248b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x248b('0x6'));var util=require('util');var path=require(_0x248b('0x7'));var sox=require(_0x248b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x248b('0x9'));var _=require('lodash');var squel=require(_0x248b('0xa'));var crypto=require(_0x248b('0xb'));var jsforce=require(_0x248b('0xc'));var deskjs=require(_0x248b('0xd'));var toCsv=require(_0x248b('0xe'));var querystring=require(_0x248b('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x248b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x248b('0x11'));var hardwareService=require(_0x248b('0x12'));var logger=require('../../config/logger')(_0x248b('0x13'));var utils=require(_0x248b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x248b('0x15'));var db=require(_0x248b('0x16'))['db'];function respondWithStatusCode(_0x6f87d6,_0x5ecea6){_0x5ecea6=_0x5ecea6||0xcc;return function(_0x49a44a){if(_0x49a44a){return _0x6f87d6[_0x248b('0x17')](_0x5ecea6);}return _0x6f87d6[_0x248b('0x18')](_0x5ecea6)[_0x248b('0x19')]();};}function respondWithResult(_0x253f02,_0x358b7b){_0x358b7b=_0x358b7b||0xc8;return function(_0x6cd69c){if(_0x6cd69c){return _0x253f02[_0x248b('0x18')](_0x358b7b)['json'](_0x6cd69c);}};}function respondWithFilteredResult(_0x4e6d6c,_0x157aca){return function(_0x3d0a94){if(_0x3d0a94){var _0x4ed6c2=typeof _0x157aca[_0x248b('0x1a')]===_0x248b('0x1b')&&typeof _0x157aca[_0x248b('0x1c')]===_0x248b('0x1b');var _0x4de747=_0x3d0a94[_0x248b('0x1d')];var _0x146300=_0x4ed6c2?0x0:_0x157aca[_0x248b('0x1a')];var _0x3bb21f=_0x4ed6c2?_0x3d0a94['count']:_0x157aca[_0x248b('0x1a')]+_0x157aca['limit'];var _0x1a8e3f;if(_0x3bb21f>=_0x4de747){_0x3bb21f=_0x4de747;_0x1a8e3f=0xc8;}else{_0x1a8e3f=0xce;}_0x4e6d6c[_0x248b('0x18')](_0x1a8e3f);return _0x4e6d6c[_0x248b('0x1e')]('Content-Range',_0x146300+'-'+_0x3bb21f+'/'+_0x4de747)[_0x248b('0x1f')](_0x3d0a94);}return null;};}function patchUpdates(_0x40a6b7){return function(_0x3bd633){try{jsonpatch[_0x248b('0x20')](_0x3bd633,_0x40a6b7,!![]);}catch(_0x3c87d0){return BPromise[_0x248b('0x21')](_0x3c87d0);}return _0x3bd633['save']();};}function saveUpdates(_0x3b4814,_0x1cb2a7){return function(_0x175f51){if(_0x175f51){return _0x175f51['update'](_0x3b4814)[_0x248b('0x22')](function(_0x2cb0a8){return _0x2cb0a8;});}return null;};}function removeEntity(_0x5389ce,_0x5abc94){return function(_0x20123f){if(_0x20123f){return _0x20123f[_0x248b('0x23')]()[_0x248b('0x22')](function(){var _0x4980b4=_0x20123f[_0x248b('0x24')]({'plain':!![]});var _0x3b6ce9=_0x248b('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x3b6ce9,'resourceId':_0x4980b4['id']}})['then'](function(){return _0x20123f;});})['then'](function(){_0x5389ce[_0x248b('0x18')](0xcc)[_0x248b('0x19')]();});}};}function handleEntityNotFound(_0x4262c9,_0x4b1a25){return function(_0x299db2){if(!_0x299db2){_0x4262c9[_0x248b('0x17')](0x194);}return _0x299db2;};}function handleError(_0x55a230,_0x581246){_0x581246=_0x581246||0x1f4;return function(_0xec0d4a){logger['error'](_0xec0d4a[_0x248b('0x26')]);if(_0xec0d4a[_0x248b('0x27')]){delete _0xec0d4a['name'];}_0x55a230[_0x248b('0x18')](_0x581246)[_0x248b('0x28')](_0xec0d4a);};}exports['index']=function(_0x5e8fe7,_0x5eebd8){var _0x3f602f={},_0x7d2d09={},_0x17d7b8={'count':0x0,'rows':[]};var _0x38daee=_[_0x248b('0x29')](db[_0x248b('0x2a')][_0x248b('0x2b')],function(_0x5dd1c1){return{'name':_0x5dd1c1[_0x248b('0x2c')],'type':_0x5dd1c1[_0x248b('0x2d')][_0x248b('0x2e')]};});_0x7d2d09[_0x248b('0x2f')]=_[_0x248b('0x29')](_0x38daee,_0x248b('0x27'));_0x7d2d09[_0x248b('0x30')]=_[_0x248b('0x31')](_0x5e8fe7[_0x248b('0x30')]);_0x7d2d09['filters']=_[_0x248b('0x32')](_0x7d2d09[_0x248b('0x2f')],_0x7d2d09[_0x248b('0x30')]);_0x3f602f[_0x248b('0x33')]=_[_0x248b('0x32')](_0x7d2d09[_0x248b('0x2f')],qs[_0x248b('0x34')](_0x5e8fe7[_0x248b('0x30')]['fields']));_0x3f602f[_0x248b('0x33')]=_0x3f602f[_0x248b('0x33')][_0x248b('0x35')]?_0x3f602f['attributes']:_0x7d2d09[_0x248b('0x2f')];if(!_0x5e8fe7['query'][_0x248b('0x36')](_0x248b('0x37'))){_0x3f602f[_0x248b('0x1c')]=qs[_0x248b('0x1c')](_0x5e8fe7[_0x248b('0x30')][_0x248b('0x1c')]);_0x3f602f[_0x248b('0x1a')]=qs[_0x248b('0x1a')](_0x5e8fe7['query'][_0x248b('0x1a')]);}_0x3f602f[_0x248b('0x38')]=qs[_0x248b('0x39')](_0x5e8fe7['query']['sort']);_0x3f602f['where']=qs['filters'](_['pick'](_0x5e8fe7[_0x248b('0x30')],_0x7d2d09['filters']),_0x38daee);if(_0x5e8fe7[_0x248b('0x30')][_0x248b('0x3a')]){_0x3f602f[_0x248b('0x3b')]=_[_0x248b('0x3c')](_0x3f602f[_0x248b('0x3b')],{'$or':_[_0x248b('0x29')](_0x38daee,function(_0x439dfa){if(_0x439dfa[_0x248b('0x2d')]!=='VIRTUAL'){var _0x4f9e74={};_0x4f9e74[_0x439dfa[_0x248b('0x27')]]={'$like':'%'+_0x5e8fe7[_0x248b('0x30')][_0x248b('0x3a')]+'%'};return _0x4f9e74;}})});}_0x3f602f=_[_0x248b('0x3c')]({},_0x3f602f,_0x5e8fe7[_0x248b('0x3d')]);var _0x5dce08={'where':_0x3f602f['where']};return db[_0x248b('0x2a')][_0x248b('0x1d')](_0x5dce08)[_0x248b('0x22')](function(_0x52e335){_0x17d7b8['count']=_0x52e335;if(_0x5e8fe7[_0x248b('0x30')][_0x248b('0x3e')]){_0x3f602f['include']=[{'all':!![]}];}return db[_0x248b('0x2a')]['findAll'](_0x3f602f);})[_0x248b('0x22')](function(_0x4c47df){_0x17d7b8['rows']=_0x4c47df;return _0x17d7b8;})[_0x248b('0x22')](respondWithFilteredResult(_0x5eebd8,_0x3f602f))[_0x248b('0x3f')](handleError(_0x5eebd8,null));};exports[_0x248b('0x40')]=function(_0x4b6d75,_0x31234b){var _0x2f1d41={'raw':![],'where':{'id':_0x4b6d75[_0x248b('0x41')]['id']}},_0x3f2bf8={};_0x3f2bf8[_0x248b('0x2f')]=_['keys'](db[_0x248b('0x2a')]['rawAttributes']);_0x3f2bf8[_0x248b('0x30')]=_[_0x248b('0x31')](_0x4b6d75[_0x248b('0x30')]);_0x3f2bf8[_0x248b('0x42')]=_[_0x248b('0x32')](_0x3f2bf8[_0x248b('0x2f')],_0x3f2bf8[_0x248b('0x30')]);_0x2f1d41[_0x248b('0x33')]=_[_0x248b('0x32')](_0x3f2bf8[_0x248b('0x2f')],qs['fields'](_0x4b6d75[_0x248b('0x30')][_0x248b('0x34')]));_0x2f1d41[_0x248b('0x33')]=_0x2f1d41[_0x248b('0x33')][_0x248b('0x35')]?_0x2f1d41[_0x248b('0x33')]:_0x3f2bf8['model'];if(_0x4b6d75[_0x248b('0x30')][_0x248b('0x3e')]){_0x2f1d41[_0x248b('0x43')]=[{'all':!![]}];}_0x2f1d41=_[_0x248b('0x3c')]({},_0x2f1d41,_0x4b6d75[_0x248b('0x3d')]);return db['Campaign'][_0x248b('0x44')](_0x2f1d41)['then'](handleEntityNotFound(_0x31234b,null))[_0x248b('0x22')](respondWithResult(_0x31234b,null))[_0x248b('0x3f')](handleError(_0x31234b,null));};exports[_0x248b('0x45')]=function(_0x4fade1,_0x2c54ae){return db['Campaign'][_0x248b('0x45')](_0x4fade1['body'],{})[_0x248b('0x22')](function(_0x1e7ee8){var _0x4fc28c=_0x4fade1[_0x248b('0x46')]['get']({'plain':!![]});if(!_0x4fc28c)throw new Error(_0x248b('0x47'));if(_0x4fc28c[_0x248b('0x48')]===_0x248b('0x46')){var _0x1363cd=_0x1e7ee8[_0x248b('0x24')]({'plain':!![]});var _0x42907b=_0x248b('0x25');return db['UserProfileSection'][_0x248b('0x44')]({'where':{'name':_0x42907b,'userProfileId':_0x4fc28c[_0x248b('0x49')]},'raw':!![]})[_0x248b('0x22')](function(_0x57c6b4){if(_0x57c6b4&&_0x57c6b4[_0x248b('0x4a')]===0x0){return db[_0x248b('0x4b')][_0x248b('0x45')]({'name':_0x1363cd[_0x248b('0x27')],'resourceId':_0x1363cd['id'],'type':_0x57c6b4[_0x248b('0x27')],'sectionId':_0x57c6b4['id']},{})[_0x248b('0x22')](function(){return _0x1e7ee8;});}else{return _0x1e7ee8;}})[_0x248b('0x3f')](function(_0x39c0b5){logger[_0x248b('0x4c')](_0x248b('0x4d'),_0x39c0b5);throw _0x39c0b5;});}return _0x1e7ee8;})['then'](respondWithResult(_0x2c54ae,0xc9))[_0x248b('0x3f')](handleError(_0x2c54ae,null));};exports[_0x248b('0x4e')]=function(_0x395ce2,_0x4adba8){var _0x522c16={'where':{'id':_0x395ce2[_0x248b('0x41')]['id']}},_0x316f08={};_0x316f08[_0x248b('0x2f')]=_[_0x248b('0x31')](db[_0x248b('0x2a')][_0x248b('0x2b')]);_0x522c16['attributes']=_[_0x248b('0x32')](_0x316f08[_0x248b('0x2f')],qs[_0x248b('0x34')](_0x395ce2[_0x248b('0x30')]['fields']));_0x522c16[_0x248b('0x33')]=_0x522c16['attributes']['length']?_0x522c16[_0x248b('0x33')]:_0x316f08[_0x248b('0x2f')];if(_0x395ce2['query'][_0x248b('0x3e')]){_0x522c16[_0x248b('0x43')]=[{'all':!![]}];}_0x522c16=_[_0x248b('0x3c')]({},_0x522c16,_0x395ce2['options']);return db[_0x248b('0x2a')][_0x248b('0x44')](_0x522c16)[_0x248b('0x22')](handleEntityNotFound(_0x4adba8,null))['then'](function(_0x59b950){if(_0x59b950){var _0x3e05ba=_0x59b950['get']({'plain':!![]});_0x3e05ba=qs['omit'](_0x3e05ba,['id','createdAt',_0x248b('0x4f')]);_0x395ce2[_0x248b('0x50')]=_[_0x248b('0x51')](_0x395ce2[_0x248b('0x50')],['id',_0x248b('0x52'),_0x248b('0x4f')]);return db[_0x248b('0x2a')][_0x248b('0x45')](_[_0x248b('0x3c')](_0x3e05ba,_0x395ce2[_0x248b('0x50')]),{'include':_0x395ce2[_0x248b('0x30')][_0x248b('0x3e')]?[{'all':!![]}]:undefined})[_0x248b('0x22')](function(_0x7879cd){var _0x4ea1a4=_0x395ce2[_0x248b('0x46')]['get']({'plain':!![]});if(!_0x4ea1a4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ea1a4['role']==='user'){var _0x1fcaab=_0x7879cd[_0x248b('0x24')]({'plain':!![]});var _0x367cca=_0x248b('0x25');return db[_0x248b('0x53')]['find']({'where':{'name':_0x367cca,'userProfileId':_0x4ea1a4[_0x248b('0x49')]},'raw':!![]})['then'](function(_0x429732){if(_0x429732&&_0x429732[_0x248b('0x4a')]===0x0){return db[_0x248b('0x4b')][_0x248b('0x45')]({'name':_0x1fcaab[_0x248b('0x27')],'resourceId':_0x1fcaab['id'],'type':_0x429732[_0x248b('0x27')],'sectionId':_0x429732['id']},{})[_0x248b('0x22')](function(){return _0x7879cd;});}else{return _0x7879cd;}})[_0x248b('0x3f')](function(_0x41b35a){logger[_0x248b('0x4c')](_0x248b('0x4d'),_0x41b35a);throw _0x41b35a;});}return _0x7879cd;});}})['then'](respondWithResult(_0x4adba8,0xc9))[_0x248b('0x3f')](handleError(_0x4adba8,null));};exports['update']=function(_0x1389da,_0x2e919b){if(_0x1389da[_0x248b('0x50')]['id']){delete _0x1389da['body']['id'];}return db[_0x248b('0x2a')]['find']({'where':{'id':_0x1389da[_0x248b('0x41')]['id']}})[_0x248b('0x22')](handleEntityNotFound(_0x2e919b,null))['then'](saveUpdates(_0x1389da['body'],null))[_0x248b('0x22')](respondWithResult(_0x2e919b,null))[_0x248b('0x3f')](handleError(_0x2e919b,null));};exports[_0x248b('0x23')]=function(_0x4bb190,_0x45459f){return db[_0x248b('0x2a')][_0x248b('0x44')]({'where':{'id':_0x4bb190[_0x248b('0x41')]['id']}})[_0x248b('0x22')](handleEntityNotFound(_0x45459f,null))['then'](removeEntity(_0x45459f,null))[_0x248b('0x3f')](handleError(_0x45459f,null));};exports[_0x248b('0x54')]=function(_0x3eb6f1,_0xf76394,_0x49a74a){var _0x542d96={'raw':!![],'where':{}};var _0x2e425b={};var _0x566786={'count':0x0,'rows':[]};return db[_0x248b('0x2a')][_0x248b('0x55')]({'where':{'id':_0x3eb6f1[_0x248b('0x41')]['id']}})['then'](handleEntityNotFound(_0xf76394,null))[_0x248b('0x22')](function(_0x1c4518){if(_0x1c4518){_0x2e425b[_0x248b('0x2f')]=_['keys'](db[_0x248b('0x56')][_0x248b('0x2b')]);_0x2e425b['query']=_['keys'](_0x3eb6f1['query']);_0x2e425b['filters']=_[_0x248b('0x32')](_0x2e425b[_0x248b('0x2f')],_0x2e425b[_0x248b('0x30')]);_0x542d96[_0x248b('0x33')]=_['intersection'](_0x2e425b[_0x248b('0x2f')],qs[_0x248b('0x34')](_0x3eb6f1['query'][_0x248b('0x34')]));_0x542d96['attributes']=_0x542d96[_0x248b('0x33')][_0x248b('0x35')]?_0x542d96['attributes']:_0x2e425b[_0x248b('0x2f')];if(!_0x3eb6f1['query']['hasOwnProperty'](_0x248b('0x37'))){_0x542d96[_0x248b('0x1c')]=qs['limit'](_0x3eb6f1['query']['limit']);_0x542d96[_0x248b('0x1a')]=qs[_0x248b('0x1a')](_0x3eb6f1[_0x248b('0x30')][_0x248b('0x1a')]);}_0x542d96[_0x248b('0x38')]=qs[_0x248b('0x39')](_0x3eb6f1[_0x248b('0x30')][_0x248b('0x39')]);_0x542d96[_0x248b('0x3b')]=qs['filters'](_['pick'](_0x3eb6f1[_0x248b('0x30')],_0x2e425b[_0x248b('0x42')]));_0x542d96[_0x248b('0x3b')]['CampaignId']=_0x1c4518['id'];if(_0x3eb6f1['query'][_0x248b('0x3a')]){_0x542d96[_0x248b('0x3b')]=_[_0x248b('0x3c')](_0x542d96[_0x248b('0x3b')],{'$or':_['map'](_0x542d96[_0x248b('0x33')],function(_0x37dd2c){var _0x717572={};_0x717572[_0x37dd2c]={'$like':'%'+_0x3eb6f1[_0x248b('0x30')][_0x248b('0x3a')]+'%'};return _0x717572;})});}_0x542d96=_['merge']({},_0x542d96,_0x3eb6f1[_0x248b('0x3d')]);return db[_0x248b('0x56')]['count']({'where':_0x542d96['where']})['then'](function(_0x49dd50){_0x566786[_0x248b('0x1d')]=_0x49dd50;if(_0x3eb6f1['query'][_0x248b('0x3e')]){_0x542d96[_0x248b('0x43')]=[{'all':!![]}];}return db[_0x248b('0x56')][_0x248b('0x57')](_0x542d96);})[_0x248b('0x22')](function(_0x41eee5){_0x566786[_0x248b('0x58')]=_0x41eee5;return _0x566786;});}})[_0x248b('0x22')](respondWithFilteredResult(_0xf76394,_0x542d96))[_0x248b('0x3f')](handleError(_0xf76394,null));};exports[_0x248b('0x59')]=function(_0x508b78,_0x45bdae,_0x3e8ea4){var _0x257ff0={'raw':!![],'where':{}};var _0x265d8f={};var _0x5dbca3={'count':0x0,'rows':[]};return db[_0x248b('0x2a')][_0x248b('0x55')]({'where':{'id':_0x508b78[_0x248b('0x41')]['id']}})[_0x248b('0x22')](handleEntityNotFound(_0x45bdae,null))[_0x248b('0x22')](function(_0x42f4d7){if(_0x42f4d7){_0x265d8f['model']=_['keys'](db['CmHopperHistory'][_0x248b('0x2b')]);_0x265d8f[_0x248b('0x30')]=_['keys'](_0x508b78[_0x248b('0x30')]);_0x265d8f[_0x248b('0x42')]=_['intersection'](_0x265d8f[_0x248b('0x2f')],_0x265d8f['query']);_0x257ff0[_0x248b('0x33')]=_[_0x248b('0x32')](_0x265d8f['model'],qs[_0x248b('0x34')](_0x508b78[_0x248b('0x30')][_0x248b('0x34')]));_0x257ff0[_0x248b('0x33')]=_0x257ff0[_0x248b('0x33')][_0x248b('0x35')]?_0x257ff0[_0x248b('0x33')]:_0x265d8f[_0x248b('0x2f')];if(!_0x508b78['query'][_0x248b('0x36')](_0x248b('0x37'))){_0x257ff0[_0x248b('0x1c')]=qs[_0x248b('0x1c')](_0x508b78['query']['limit']);_0x257ff0[_0x248b('0x1a')]=qs[_0x248b('0x1a')](_0x508b78[_0x248b('0x30')][_0x248b('0x1a')]);}_0x257ff0['order']=qs[_0x248b('0x39')](_0x508b78[_0x248b('0x30')][_0x248b('0x39')]);_0x257ff0[_0x248b('0x3b')]=qs[_0x248b('0x42')](_['pick'](_0x508b78[_0x248b('0x30')],_0x265d8f[_0x248b('0x42')]));_0x257ff0[_0x248b('0x3b')][_0x248b('0x5a')]=_0x42f4d7['id'];if(_0x508b78[_0x248b('0x30')][_0x248b('0x3a')]){_0x257ff0[_0x248b('0x3b')]=_[_0x248b('0x3c')](_0x257ff0['where'],{'$or':_['map'](_0x257ff0[_0x248b('0x33')],function(_0x4e8e85){var _0x5d896c={};_0x5d896c[_0x4e8e85]={'$like':'%'+_0x508b78[_0x248b('0x30')]['filter']+'%'};return _0x5d896c;})});}_0x257ff0=_[_0x248b('0x3c')]({},_0x257ff0,_0x508b78[_0x248b('0x3d')]);return db[_0x248b('0x5b')][_0x248b('0x1d')]({'where':_0x257ff0[_0x248b('0x3b')]})['then'](function(_0x2080f6){_0x5dbca3[_0x248b('0x1d')]=_0x2080f6;if(_0x508b78[_0x248b('0x30')][_0x248b('0x3e')]){_0x257ff0[_0x248b('0x43')]=[{'all':!![]}];}return db[_0x248b('0x5b')]['findAll'](_0x257ff0);})[_0x248b('0x22')](function(_0x4c330a){_0x5dbca3[_0x248b('0x58')]=_0x4c330a;return _0x5dbca3;});}})['then'](respondWithFilteredResult(_0x45bdae,_0x257ff0))[_0x248b('0x3f')](handleError(_0x45bdae,null));};exports[_0x248b('0x5c')]=function(_0x32ed1b,_0x2eb30f,_0x1f0b8e){var _0x4c651f={'raw':!![],'where':{}};var _0x36251e={};var _0x257ce8={'count':0x0,'rows':[]};return db['Campaign'][_0x248b('0x55')]({'where':{'id':_0x32ed1b[_0x248b('0x41')]['id']}})[_0x248b('0x22')](handleEntityNotFound(_0x2eb30f,null))[_0x248b('0x22')](function(_0x30151c){if(_0x30151c){_0x36251e[_0x248b('0x2f')]=_[_0x248b('0x31')](db['CmHopperFinal']['rawAttributes']);_0x36251e[_0x248b('0x30')]=_[_0x248b('0x31')](_0x32ed1b[_0x248b('0x30')]);_0x36251e[_0x248b('0x42')]=_[_0x248b('0x32')](_0x36251e[_0x248b('0x2f')],_0x36251e['query']);_0x4c651f[_0x248b('0x33')]=_[_0x248b('0x32')](_0x36251e[_0x248b('0x2f')],qs[_0x248b('0x34')](_0x32ed1b['query'][_0x248b('0x34')]));_0x4c651f[_0x248b('0x33')]=_0x4c651f[_0x248b('0x33')][_0x248b('0x35')]?_0x4c651f[_0x248b('0x33')]:_0x36251e[_0x248b('0x2f')];if(!_0x32ed1b[_0x248b('0x30')][_0x248b('0x36')]('nolimit')){_0x4c651f[_0x248b('0x1c')]=qs[_0x248b('0x1c')](_0x32ed1b[_0x248b('0x30')][_0x248b('0x1c')]);_0x4c651f[_0x248b('0x1a')]=qs[_0x248b('0x1a')](_0x32ed1b[_0x248b('0x30')][_0x248b('0x1a')]);}_0x4c651f[_0x248b('0x38')]=qs['sort'](_0x32ed1b[_0x248b('0x30')]['sort']);_0x4c651f['where']=qs['filters'](_[_0x248b('0x5d')](_0x32ed1b[_0x248b('0x30')],_0x36251e[_0x248b('0x42')]));_0x4c651f[_0x248b('0x3b')][_0x248b('0x5a')]=_0x30151c['id'];if(_0x32ed1b[_0x248b('0x30')]['filter']){_0x4c651f['where']=_[_0x248b('0x3c')](_0x4c651f[_0x248b('0x3b')],{'$or':_['map'](_0x4c651f['attributes'],function(_0x483b6d){var _0x33e6a1={};_0x33e6a1[_0x483b6d]={'$like':'%'+_0x32ed1b['query'][_0x248b('0x3a')]+'%'};return _0x33e6a1;})});}_0x4c651f=_[_0x248b('0x3c')]({},_0x4c651f,_0x32ed1b[_0x248b('0x3d')]);return db[_0x248b('0x5e')]['count']({'where':_0x4c651f['where']})[_0x248b('0x22')](function(_0xacf001){_0x257ce8['count']=_0xacf001;if(_0x32ed1b['query']['includeAll']){_0x4c651f['include']=[{'all':!![]}];}return db[_0x248b('0x5e')]['findAll'](_0x4c651f);})[_0x248b('0x22')](function(_0x5dc8ce){_0x257ce8['rows']=_0x5dc8ce;return _0x257ce8;});}})[_0x248b('0x22')](respondWithFilteredResult(_0x2eb30f,_0x4c651f))[_0x248b('0x3f')](handleError(_0x2eb30f,null));};exports[_0x248b('0x5f')]=function(_0x469075,_0x5887f2,_0x751634){var _0x1ee45b={'raw':!![],'where':{}};var _0x118541={};var _0x372799={'count':0x0,'rows':[]};return db[_0x248b('0x2a')]['findOne']({'where':{'id':_0x469075[_0x248b('0x41')]['id']}})[_0x248b('0x22')](handleEntityNotFound(_0x5887f2,null))['then'](function(_0x47e3ea){if(_0x47e3ea){_0x118541[_0x248b('0x2f')]=_[_0x248b('0x31')](db[_0x248b('0x60')][_0x248b('0x2b')]);_0x118541['query']=_['keys'](_0x469075['query']);_0x118541[_0x248b('0x42')]=_['intersection'](_0x118541['model'],_0x118541[_0x248b('0x30')]);_0x1ee45b['attributes']=_[_0x248b('0x32')](_0x118541[_0x248b('0x2f')],qs[_0x248b('0x34')](_0x469075[_0x248b('0x30')][_0x248b('0x34')]));_0x1ee45b[_0x248b('0x33')]=_0x1ee45b[_0x248b('0x33')][_0x248b('0x35')]?_0x1ee45b[_0x248b('0x33')]:_0x118541[_0x248b('0x2f')];if(!_0x469075['query'][_0x248b('0x36')](_0x248b('0x37'))){_0x1ee45b['limit']=qs[_0x248b('0x1c')](_0x469075[_0x248b('0x30')][_0x248b('0x1c')]);_0x1ee45b[_0x248b('0x1a')]=qs[_0x248b('0x1a')](_0x469075['query'][_0x248b('0x1a')]);}_0x1ee45b[_0x248b('0x38')]=qs[_0x248b('0x39')](_0x469075['query']['sort']);_0x1ee45b[_0x248b('0x3b')]=qs['filters'](_[_0x248b('0x5d')](_0x469075[_0x248b('0x30')],_0x118541[_0x248b('0x42')]));_0x1ee45b[_0x248b('0x3b')][_0x248b('0x5a')]=_0x47e3ea['id'];if(_0x469075['query'][_0x248b('0x3a')]){_0x1ee45b[_0x248b('0x3b')]=_[_0x248b('0x3c')](_0x1ee45b['where'],{'$or':_[_0x248b('0x29')](_0x1ee45b[_0x248b('0x33')],function(_0x4ff03a){var _0x147a94={};_0x147a94[_0x4ff03a]={'$like':'%'+_0x469075[_0x248b('0x30')][_0x248b('0x3a')]+'%'};return _0x147a94;})});}_0x1ee45b=_['merge']({},_0x1ee45b,_0x469075['options']);return db[_0x248b('0x60')]['count']({'where':_0x1ee45b[_0x248b('0x3b')]})['then'](function(_0x7c3452){_0x372799['count']=_0x7c3452;if(_0x469075['query'][_0x248b('0x3e')]){_0x1ee45b[_0x248b('0x43')]=[{'all':!![]}];}return db[_0x248b('0x60')][_0x248b('0x57')](_0x1ee45b);})[_0x248b('0x22')](function(_0x44232a){_0x372799['rows']=_0x44232a;return _0x372799;});}})[_0x248b('0x22')](respondWithFilteredResult(_0x5887f2,_0x1ee45b))[_0x248b('0x3f')](handleError(_0x5887f2,null));};exports[_0x248b('0x61')]=function(_0xe6bbb1,_0x2e5faa,_0x4bd4b3){var _0x56e5c1={};var _0x658a09={};var _0x261b19;var _0x2caa49;return db['Campaign'][_0x248b('0x55')]({'where':{'id':_0xe6bbb1[_0x248b('0x41')]['id']}})['then'](handleEntityNotFound(_0x2e5faa,null))[_0x248b('0x22')](function(_0x2763c9){if(_0x2763c9){_0x261b19=_0x2763c9;_0x658a09['model']=_[_0x248b('0x31')](db['CmList'][_0x248b('0x2b')]);_0x658a09[_0x248b('0x30')]=_[_0x248b('0x31')](_0xe6bbb1[_0x248b('0x30')]);_0x658a09[_0x248b('0x42')]=_[_0x248b('0x32')](_0x658a09[_0x248b('0x2f')],_0x658a09['query']);_0x56e5c1[_0x248b('0x33')]=_['intersection'](_0x658a09[_0x248b('0x2f')],qs[_0x248b('0x34')](_0xe6bbb1[_0x248b('0x30')][_0x248b('0x34')]));_0x56e5c1['attributes']=_0x56e5c1[_0x248b('0x33')][_0x248b('0x35')]?_0x56e5c1[_0x248b('0x33')]:_0x658a09[_0x248b('0x2f')];_0x56e5c1[_0x248b('0x38')]=qs[_0x248b('0x39')](_0xe6bbb1[_0x248b('0x30')]['sort']);_0x56e5c1[_0x248b('0x3b')]=qs[_0x248b('0x42')](_[_0x248b('0x5d')](_0xe6bbb1[_0x248b('0x30')],_0x658a09[_0x248b('0x42')]));if(_0xe6bbb1[_0x248b('0x30')][_0x248b('0x3a')]){_0x56e5c1[_0x248b('0x3b')]=_[_0x248b('0x3c')](_0x56e5c1[_0x248b('0x3b')],{'$or':_[_0x248b('0x29')](_0x56e5c1['attributes'],function(_0x3e3eed){var _0x22f76a={};_0x22f76a[_0x3e3eed]={'$like':'%'+_0xe6bbb1[_0x248b('0x30')]['filter']+'%'};return _0x22f76a;})});}_0x56e5c1=_[_0x248b('0x3c')]({},_0x56e5c1,_0xe6bbb1[_0x248b('0x3d')]);return _0x261b19['getLists'](_0x56e5c1);}})[_0x248b('0x22')](function(_0x52b201){if(_0x52b201){_0x2caa49=_0x52b201[_0x248b('0x35')];if(!_0xe6bbb1[_0x248b('0x30')][_0x248b('0x36')](_0x248b('0x37'))){_0x56e5c1[_0x248b('0x1c')]=qs[_0x248b('0x1c')](_0xe6bbb1[_0x248b('0x30')]['limit']);_0x56e5c1[_0x248b('0x1a')]=qs[_0x248b('0x1a')](_0xe6bbb1[_0x248b('0x30')]['offset']);}return _0x261b19[_0x248b('0x61')](_0x56e5c1);}})[_0x248b('0x22')](function(_0x428fb0){if(_0x428fb0){return _0x428fb0?{'count':_0x2caa49,'rows':_0x428fb0}:null;}})['then'](respondWithResult(_0x2e5faa,null))[_0x248b('0x3f')](handleError(_0x2e5faa,null));};exports[_0x248b('0x62')]=function(_0x1899da,_0x456d59,_0x5376ca){var _0x50f565,_0x3f1001;var _0x4899df=[];var _0x35005c=moment()[_0x248b('0x63')](_0x248b('0x64'));return db[_0x248b('0x2a')][_0x248b('0x44')]({'where':{'id':_0x1899da[_0x248b('0x41')]['id']}})[_0x248b('0x22')](handleEntityNotFound(_0x456d59,null))[_0x248b('0x22')](function(_0x3f7028){if(_0x3f7028){_0x3f1001=_0x3f7028;return _0x3f7028[_0x248b('0x62')](_0x1899da[_0x248b('0x50')][_0x248b('0x65')],_['omit'](_0x1899da[_0x248b('0x50')],[_0x248b('0x65'),'id'])||{});}return null;})[_0x248b('0x66')](function(_0x3f1459){var _0x243e39;var _0x50da42;_0x50f565=_0x3f1459||[];var _0x2a5feb=[];if(_0x3f1459){for(var _0x55be0c=0x0;_0x55be0c<_0x3f1459['length'];_0x55be0c+=0x1){var _0x341a45=_0x3f1459[_0x55be0c][_0x248b('0x24')]({'plain':!![]});_0x3f1001[_0x248b('0x67')]=_0x1899da[_0x248b('0x50')][_0x248b('0x67')]?_0x1899da[_0x248b('0x50')]['dialCheckDuplicateType']:_0x3f1001['dialCheckDuplicateType'];switch(_0x3f1001[_0x248b('0x67')]){case _0x248b('0x68'):_0x243e39=squel[_0x248b('0x69')]()[_0x248b('0x6a')](_0x248b('0x6b'))['fromQuery']([_0x248b('0x6c'),_0x248b('0x6d'),_0x248b('0x6e'),'ListId',_0x248b('0x5a'),'createdAt',_0x248b('0x4f')],squel[_0x248b('0x6f')]()['field'](_0x248b('0x6c'),'phone')['field']('NOW()',_0x248b('0x6d'))[_0x248b('0x70')]('id',_0x248b('0x6e'))[_0x248b('0x70')](_0x341a45['CmListId'][_0x248b('0x71')](),_0x248b('0x72'))[_0x248b('0x70')](_0x1899da[_0x248b('0x41')]['id'][_0x248b('0x71')](),_0x248b('0x5a'))[_0x248b('0x70')]('\x27'+_0x35005c+'\x27',_0x248b('0x52'))['field']('\x27'+_0x35005c+'\x27',_0x248b('0x4f'))[_0x248b('0x73')](_0x248b('0x74'))[_0x248b('0x3b')](_0x248b('0x75'))[_0x248b('0x3b')](_0x248b('0x76'),_0x341a45['CmListId'][_0x248b('0x71')]())[_0x248b('0x3b')](_0x248b('0x77'))['where'](_0x248b('0x78'),squel['select']()['field'](_0x248b('0x79'))[_0x248b('0x73')](_0x248b('0x7a'))['where'](_0x248b('0x7b'),_0x1899da['params']['id'][_0x248b('0x71')]()))[_0x248b('0x3b')](_0x248b('0x78'),squel['select']()[_0x248b('0x70')]('COALESCE(phone,\x27\x27)')[_0x248b('0x73')]('cm_hopper')[_0x248b('0x3b')]('CampaignId\x20=\x20?',_0x1899da[_0x248b('0x41')]['id'][_0x248b('0x71')]())))[_0x248b('0x71')]();break;case _0x248b('0x7c'):_0x243e39=squel[_0x248b('0x69')]()[_0x248b('0x6a')](_0x248b('0x6b'))[_0x248b('0x7d')]([_0x248b('0x6c'),_0x248b('0x6d'),_0x248b('0x6e'),_0x248b('0x72'),_0x248b('0x5a'),_0x248b('0x52'),_0x248b('0x4f')],squel[_0x248b('0x6f')]()[_0x248b('0x70')]('phone',_0x248b('0x6c'))[_0x248b('0x70')](_0x248b('0x7e'),'scheduledAt')['field']('id',_0x248b('0x6e'))['field'](_0x341a45['CmListId'][_0x248b('0x71')](),'ListId')[_0x248b('0x70')](_0x1899da[_0x248b('0x41')]['id'][_0x248b('0x71')](),_0x248b('0x5a'))[_0x248b('0x70')]('\x27'+_0x35005c+'\x27',_0x248b('0x52'))[_0x248b('0x70')]('\x27'+_0x35005c+'\x27',_0x248b('0x4f'))['from'](_0x248b('0x74'))[_0x248b('0x3b')](_0x248b('0x75'))[_0x248b('0x3b')](_0x248b('0x76'),_0x341a45[_0x248b('0x7f')]['toString']())[_0x248b('0x3b')](_0x248b('0x77'))[_0x248b('0x3b')](_0x248b('0x78'),squel['select']()[_0x248b('0x70')]('COALESCE(phone,\x27\x27)')[_0x248b('0x73')](_0x248b('0x6b'))[_0x248b('0x3b')](_0x248b('0x7b'),_0x1899da[_0x248b('0x41')]['id'][_0x248b('0x71')]())))['toString']();break;default:_0x243e39=squel[_0x248b('0x69')]()[_0x248b('0x6a')](_0x248b('0x6b'))[_0x248b('0x7d')]([_0x248b('0x6c'),_0x248b('0x6d'),_0x248b('0x6e'),_0x248b('0x72'),_0x248b('0x5a'),_0x248b('0x52'),'updatedAt'],squel[_0x248b('0x6f')]()[_0x248b('0x70')]('phone',_0x248b('0x6c'))[_0x248b('0x70')]('NOW()',_0x248b('0x6d'))[_0x248b('0x70')]('id',_0x248b('0x6e'))[_0x248b('0x70')](_0x341a45[_0x248b('0x7f')]['toString'](),_0x248b('0x72'))[_0x248b('0x70')](_0x1899da['params']['id'][_0x248b('0x71')](),_0x248b('0x5a'))[_0x248b('0x70')]('\x27'+_0x35005c+'\x27',_0x248b('0x52'))[_0x248b('0x70')]('\x27'+_0x35005c+'\x27',_0x248b('0x4f'))[_0x248b('0x73')](_0x248b('0x74'))[_0x248b('0x3b')]('deletedAt\x20IS\x20NULL')[_0x248b('0x3b')]('ListId\x20=\x20?',_0x341a45[_0x248b('0x7f')][_0x248b('0x71')]())[_0x248b('0x3b')](_0x248b('0x77')))[_0x248b('0x71')]();}_0x50da42=squel['insert']()[_0x248b('0x6a')](_0x248b('0x80'))[_0x248b('0x7d')]([_0x248b('0x81'),_0x248b('0x6d'),_0x248b('0x6c'),'OrderBy',_0x248b('0x52'),_0x248b('0x4f')],squel['select']()['field'](_0x248b('0x82'),'id')['field'](_0x248b('0x7e'),_0x248b('0x6d'))[_0x248b('0x70')](_0x248b('0x83'),_0x248b('0x6c'))[_0x248b('0x70')](_0x248b('0x84'),'OrderBy')['field']('\x27'+_0x35005c+'\x27',_0x248b('0x52'))['field']('\x27'+_0x35005c+'\x27',_0x248b('0x4f'))[_0x248b('0x73')](_0x248b('0x85'),'ci')['join'](_0x248b('0x6b'),'h',_0x248b('0x86'))[_0x248b('0x3b')](_0x248b('0x87'),_0x341a45[_0x248b('0x7f')][_0x248b('0x71')]())[_0x248b('0x3b')](_0x248b('0x88'),_0x1899da[_0x248b('0x41')]['id']['toString']())[_0x248b('0x3b')](_0x248b('0x89'),_0x35005c))[_0x248b('0x71')]();_0x2a5feb['push'](db[_0x248b('0x8a')][_0x248b('0x30')](_0x243e39));_0x4899df[_0x248b('0x8b')](db['sequelize'][_0x248b('0x30')](_0x50da42));}return BPromise[_0x248b('0x8c')](_0x2a5feb);}})[_0x248b('0x22')](function(){return BPromise[_0x248b('0x8c')](_0x4899df);})[_0x248b('0x22')](function(){return _0x50f565;})['then'](respondWithResult(_0x456d59,null))[_0x248b('0x3f')](handleError(_0x456d59,null));};exports['removeLists']=function(_0x28eebc,_0x20f103,_0x170366){return db[_0x248b('0x2a')][_0x248b('0x44')]({'where':{'id':_0x28eebc[_0x248b('0x41')]['id']}})[_0x248b('0x22')](handleEntityNotFound(_0x20f103,null))[_0x248b('0x22')](function(_0x5eaf00){if(_0x5eaf00){return _0x5eaf00[_0x248b('0x8d')](_0x28eebc['query'][_0x248b('0x65')]);}})[_0x248b('0x22')](function(_0x247352){if(_0x247352){return db[_0x248b('0x56')][_0x248b('0x23')]({'where':{'ListId':_0x28eebc[_0x248b('0x30')][_0x248b('0x65')],'CampaignId':_0x28eebc[_0x248b('0x41')]['id']}})[_0x248b('0x22')](function(){return _0x247352;});}})[_0x248b('0x22')](respondWithStatusCode(_0x20f103,null))[_0x248b('0x3f')](handleError(_0x20f103,null));};exports['getBlackLists']=function(_0x4785bd,_0x3355f5,_0x48c797){var _0xce6365={};var _0x27e83c={};var _0x5ef087;var _0x2fe048;return db[_0x248b('0x2a')][_0x248b('0x55')]({'where':{'id':_0x4785bd[_0x248b('0x41')]['id']}})['then'](handleEntityNotFound(_0x3355f5,null))[_0x248b('0x22')](function(_0x201216){if(_0x201216){_0x5ef087=_0x201216;_0x27e83c[_0x248b('0x2f')]=_[_0x248b('0x31')](db[_0x248b('0x8e')][_0x248b('0x2b')]);_0x27e83c[_0x248b('0x30')]=_['keys'](_0x4785bd[_0x248b('0x30')]);_0x27e83c['filters']=_[_0x248b('0x32')](_0x27e83c[_0x248b('0x2f')],_0x27e83c[_0x248b('0x30')]);_0xce6365['attributes']=_[_0x248b('0x32')](_0x27e83c[_0x248b('0x2f')],qs[_0x248b('0x34')](_0x4785bd['query'][_0x248b('0x34')]));_0xce6365[_0x248b('0x33')]=_0xce6365[_0x248b('0x33')][_0x248b('0x35')]?_0xce6365['attributes']:_0x27e83c['model'];_0xce6365[_0x248b('0x38')]=qs['sort'](_0x4785bd[_0x248b('0x30')][_0x248b('0x39')]);_0xce6365['where']=qs[_0x248b('0x42')](_[_0x248b('0x5d')](_0x4785bd[_0x248b('0x30')],_0x27e83c['filters']));if(_0x4785bd[_0x248b('0x30')]['filter']){_0xce6365['where']=_[_0x248b('0x3c')](_0xce6365['where'],{'$or':_[_0x248b('0x29')](_0xce6365[_0x248b('0x33')],function(_0x257eb8){var _0x481ac8={};_0x481ac8[_0x257eb8]={'$like':'%'+_0x4785bd[_0x248b('0x30')][_0x248b('0x3a')]+'%'};return _0x481ac8;})});}_0xce6365=_[_0x248b('0x3c')]({},_0xce6365,_0x4785bd[_0x248b('0x3d')]);return _0x5ef087[_0x248b('0x8f')](_0xce6365);}})[_0x248b('0x22')](function(_0x66960b){if(_0x66960b){_0x2fe048=_0x66960b[_0x248b('0x35')];if(!_0x4785bd['query'][_0x248b('0x36')](_0x248b('0x37'))){_0xce6365['limit']=qs[_0x248b('0x1c')](_0x4785bd[_0x248b('0x30')][_0x248b('0x1c')]);_0xce6365[_0x248b('0x1a')]=qs['offset'](_0x4785bd[_0x248b('0x30')][_0x248b('0x1a')]);}return _0x5ef087[_0x248b('0x8f')](_0xce6365);}})['then'](function(_0x43f1c5){if(_0x43f1c5){return _0x43f1c5?{'count':_0x2fe048,'rows':_0x43f1c5}:null;}})['then'](respondWithResult(_0x3355f5,null))[_0x248b('0x3f')](handleError(_0x3355f5,null));};exports[_0x248b('0x90')]=function(_0x597dd2,_0x4c3580,_0x574586){var _0x1a33a7,_0x49d1e3;var _0x4d650c=[];var _0x3be4bb=moment()[_0x248b('0x63')](_0x248b('0x64'));return db[_0x248b('0x2a')]['find']({'where':{'id':_0x597dd2['params']['id']}})[_0x248b('0x22')](handleEntityNotFound(_0x4c3580,null))[_0x248b('0x22')](function(_0x4e1181){if(_0x4e1181){_0x49d1e3=_0x4e1181;return _0x4e1181['addBlackLists'](_0x597dd2[_0x248b('0x50')][_0x248b('0x65')],_['omit'](_0x597dd2['body'],[_0x248b('0x65'),'id'])||{});}return null;})[_0x248b('0x66')](function(_0x576176){var _0x314d1d;var _0x13ffc5;_0x1a33a7=_0x576176||[];var _0x4dd6ea=[];if(_0x576176){for(var _0x36ecdc=0x0;_0x36ecdc<_0x576176[_0x248b('0x35')];_0x36ecdc+=0x1){var _0x2b08bc=_0x576176[_0x36ecdc][_0x248b('0x24')]({'plain':!![]});_0x314d1d=squel[_0x248b('0x69')]()[_0x248b('0x6a')](_0x248b('0x91'))[_0x248b('0x7d')](['phone',_0x248b('0x6e'),_0x248b('0x72'),_0x248b('0x5a'),_0x248b('0x52'),_0x248b('0x4f')],squel['select']()[_0x248b('0x70')](_0x248b('0x6c'),_0x248b('0x6c'))[_0x248b('0x70')]('id',_0x248b('0x6e'))[_0x248b('0x70')](_0x2b08bc[_0x248b('0x7f')][_0x248b('0x71')](),_0x248b('0x72'))[_0x248b('0x70')](_0x597dd2['params']['id'][_0x248b('0x71')](),'CampaignId')[_0x248b('0x70')](_0x248b('0x7e'),'createdAt')[_0x248b('0x70')]('NOW()',_0x248b('0x4f'))['from'](_0x248b('0x74'))[_0x248b('0x3b')](_0x248b('0x75'))[_0x248b('0x3b')]('ListId\x20=\x20?',_0x2b08bc['CmListId'][_0x248b('0x71')]())[_0x248b('0x3b')]('phone\x20IS\x20NOT\x20NULL'))[_0x248b('0x71')]();_0x4dd6ea['push'](db[_0x248b('0x8a')][_0x248b('0x30')](_0x314d1d));}return BPromise[_0x248b('0x8c')](_0x4dd6ea);}})[_0x248b('0x22')](function(){return _0x1a33a7;})[_0x248b('0x22')](respondWithResult(_0x4c3580,null))['catch'](handleError(_0x4c3580,null));};exports['removeBlackLists']=function(_0x2727ab,_0x3d51e3,_0x542ee2){return db[_0x248b('0x2a')][_0x248b('0x44')]({'where':{'id':_0x2727ab['params']['id']}})[_0x248b('0x22')](handleEntityNotFound(_0x3d51e3,null))[_0x248b('0x22')](function(_0x84d86){if(_0x84d86){return _0x84d86[_0x248b('0x92')](_0x2727ab[_0x248b('0x30')][_0x248b('0x65')]);}})[_0x248b('0x22')](function(_0x22ebb2){if(_0x22ebb2){return db[_0x248b('0x60')][_0x248b('0x23')]({'where':{'ListId':_0x2727ab['query'][_0x248b('0x65')],'CampaignId':_0x2727ab[_0x248b('0x41')]['id']}})[_0x248b('0x22')](function(){return _0x22ebb2;});}})[_0x248b('0x22')](respondWithStatusCode(_0x3d51e3,null))[_0x248b('0x3f')](handleError(_0x3d51e3,null));}; \ No newline at end of file +var _0xe486=['UserProfileResource','sendStatus','name','send','map','rawAttributes','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','Campaign','include','findAll','catch','show','keys','intersection','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','options','createdAt','updatedAt','update','params','getHoppers','findOne','CmHopper','pick','CampaignId','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','YYYY-MM-DD\x20HH:mm:ss','omit','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','select','field','toString','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','ListId','NOW()','cm_contacts','CmListId','cm_hopper_additional_phones','OrderBy','ci.item','ci.OrderBY','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','getBlackLists','addBlackLists','format','spread','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','destroy','then','get','IvrCampaigns'];(function(_0x15b380,_0x1a3c5f){var _0x232c5c=function(_0x12f8e0){while(--_0x12f8e0){_0x15b380['push'](_0x15b380['shift']());}};_0x232c5c(++_0x1a3c5f);}(_0xe486,0x6a));var _0x6e48=function(_0xa5bd9b,_0x425710){_0xa5bd9b=_0xa5bd9b-0x0;var _0x4a68e0=_0xe486[_0xa5bd9b];return _0x4a68e0;};'use strict';var emlformat=require(_0x6e48('0x0'));var rimraf=require(_0x6e48('0x1'));var zipdir=require(_0x6e48('0x2'));var jsonpatch=require(_0x6e48('0x3'));var rp=require(_0x6e48('0x4'));var moment=require(_0x6e48('0x5'));var BPromise=require(_0x6e48('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6e48('0x7'));var sox=require(_0x6e48('0x8'));var csv=require(_0x6e48('0x9'));var ejs=require(_0x6e48('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6e48('0xb'));var squel=require(_0x6e48('0xc'));var crypto=require(_0x6e48('0xd'));var jsforce=require(_0x6e48('0xe'));var deskjs=require(_0x6e48('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6e48('0x10'));var Papa=require('papaparse');var Redis=require(_0x6e48('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6e48('0x12'));var as=require(_0x6e48('0x13'));var hardwareService=require(_0x6e48('0x14'));var logger=require(_0x6e48('0x15'))('api');var utils=require(_0x6e48('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6e48('0x17'))['db'];function respondWithStatusCode(_0x1f1ff4,_0x1bfa97){_0x1bfa97=_0x1bfa97||0xcc;return function(_0x199cbe){if(_0x199cbe){return _0x1f1ff4['sendStatus'](_0x1bfa97);}return _0x1f1ff4[_0x6e48('0x18')](_0x1bfa97)[_0x6e48('0x19')]();};}function respondWithResult(_0xa66f97,_0x45268d){_0x45268d=_0x45268d||0xc8;return function(_0x272a24){if(_0x272a24){return _0xa66f97[_0x6e48('0x18')](_0x45268d)[_0x6e48('0x1a')](_0x272a24);}};}function respondWithFilteredResult(_0x307d4c,_0x1687b7){return function(_0x48c10c){if(_0x48c10c){var _0x437f65=typeof _0x1687b7[_0x6e48('0x1b')]===_0x6e48('0x1c')&&typeof _0x1687b7[_0x6e48('0x1d')]==='undefined';var _0x45e94b=_0x48c10c[_0x6e48('0x1e')];var _0x4d3927=_0x437f65?0x0:_0x1687b7[_0x6e48('0x1b')];var _0x1c89f1=_0x437f65?_0x48c10c[_0x6e48('0x1e')]:_0x1687b7[_0x6e48('0x1b')]+_0x1687b7[_0x6e48('0x1d')];var _0x419fd8;if(_0x1c89f1>=_0x45e94b){_0x1c89f1=_0x45e94b;_0x419fd8=0xc8;}else{_0x419fd8=0xce;}_0x307d4c[_0x6e48('0x18')](_0x419fd8);return _0x307d4c[_0x6e48('0x1f')]('Content-Range',_0x4d3927+'-'+_0x1c89f1+'/'+_0x45e94b)[_0x6e48('0x1a')](_0x48c10c);}return null;};}function patchUpdates(_0x383ecb){return function(_0x84322b){try{jsonpatch[_0x6e48('0x20')](_0x84322b,_0x383ecb,!![]);}catch(_0x25f7d3){return BPromise[_0x6e48('0x21')](_0x25f7d3);}return _0x84322b['save']();};}function saveUpdates(_0x4518a7,_0x4cdded){return function(_0x371147){if(_0x371147){return _0x371147['update'](_0x4518a7)['then'](function(_0x52bbef){return _0x52bbef;});}return null;};}function removeEntity(_0x3d492f,_0xe57bbf){return function(_0x406611){if(_0x406611){return _0x406611[_0x6e48('0x22')]()[_0x6e48('0x23')](function(){var _0x5dcd9a=_0x406611[_0x6e48('0x24')]({'plain':!![]});var _0x195761=_0x6e48('0x25');return db[_0x6e48('0x26')][_0x6e48('0x22')]({'where':{'type':_0x195761,'resourceId':_0x5dcd9a['id']}})[_0x6e48('0x23')](function(){return _0x406611;});})[_0x6e48('0x23')](function(){_0x3d492f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x380eb5,_0x4147bd){return function(_0x50d01f){if(!_0x50d01f){_0x380eb5[_0x6e48('0x27')](0x194);}return _0x50d01f;};}function handleError(_0x484bb3,_0x13d1bb){_0x13d1bb=_0x13d1bb||0x1f4;return function(_0x502b67){logger['error'](_0x502b67['stack']);if(_0x502b67[_0x6e48('0x28')]){delete _0x502b67[_0x6e48('0x28')];}_0x484bb3[_0x6e48('0x18')](_0x13d1bb)[_0x6e48('0x29')](_0x502b67);};}exports['index']=function(_0xdc841a,_0x271769){var _0x4b5b4b={},_0x1e7f00={},_0x2ac4de={'count':0x0,'rows':[]};var _0x545bdc=_[_0x6e48('0x2a')](db['Campaign'][_0x6e48('0x2b')],function(_0x2c4a72){return{'name':_0x2c4a72['fieldName'],'type':_0x2c4a72[_0x6e48('0x2c')][_0x6e48('0x2d')]};});_0x1e7f00[_0x6e48('0x2e')]=_['map'](_0x545bdc,_0x6e48('0x28'));_0x1e7f00[_0x6e48('0x2f')]=_['keys'](_0xdc841a[_0x6e48('0x2f')]);_0x1e7f00[_0x6e48('0x30')]=_['intersection'](_0x1e7f00['model'],_0x1e7f00['query']);_0x4b5b4b[_0x6e48('0x31')]=_['intersection'](_0x1e7f00[_0x6e48('0x2e')],qs[_0x6e48('0x32')](_0xdc841a[_0x6e48('0x2f')]['fields']));_0x4b5b4b['attributes']=_0x4b5b4b[_0x6e48('0x31')][_0x6e48('0x33')]?_0x4b5b4b['attributes']:_0x1e7f00['model'];if(!_0xdc841a[_0x6e48('0x2f')][_0x6e48('0x34')](_0x6e48('0x35'))){_0x4b5b4b[_0x6e48('0x1d')]=qs[_0x6e48('0x1d')](_0xdc841a[_0x6e48('0x2f')][_0x6e48('0x1d')]);_0x4b5b4b['offset']=qs['offset'](_0xdc841a[_0x6e48('0x2f')][_0x6e48('0x1b')]);}_0x4b5b4b[_0x6e48('0x36')]=qs[_0x6e48('0x37')](_0xdc841a['query'][_0x6e48('0x37')]);_0x4b5b4b[_0x6e48('0x38')]=qs['filters'](_['pick'](_0xdc841a[_0x6e48('0x2f')],_0x1e7f00[_0x6e48('0x30')]),_0x545bdc);if(_0xdc841a['query'][_0x6e48('0x39')]){_0x4b5b4b['where']=_[_0x6e48('0x3a')](_0x4b5b4b['where'],{'$or':_[_0x6e48('0x2a')](_0x545bdc,function(_0x5de5e7){if(_0x5de5e7['type']!==_0x6e48('0x3b')){var _0x808f99={};_0x808f99[_0x5de5e7[_0x6e48('0x28')]]={'$like':'%'+_0xdc841a['query'][_0x6e48('0x39')]+'%'};return _0x808f99;}})});}_0x4b5b4b=_[_0x6e48('0x3a')]({},_0x4b5b4b,_0xdc841a['options']);var _0x3b7c8d={'where':_0x4b5b4b[_0x6e48('0x38')]};return db[_0x6e48('0x3c')][_0x6e48('0x1e')](_0x3b7c8d)[_0x6e48('0x23')](function(_0x2fc08a){_0x2ac4de[_0x6e48('0x1e')]=_0x2fc08a;if(_0xdc841a[_0x6e48('0x2f')]['includeAll']){_0x4b5b4b[_0x6e48('0x3d')]=[{'all':!![]}];}return db[_0x6e48('0x3c')][_0x6e48('0x3e')](_0x4b5b4b);})['then'](function(_0x16a056){_0x2ac4de['rows']=_0x16a056;return _0x2ac4de;})[_0x6e48('0x23')](respondWithFilteredResult(_0x271769,_0x4b5b4b))[_0x6e48('0x3f')](handleError(_0x271769,null));};exports[_0x6e48('0x40')]=function(_0x1575a0,_0x198550){var _0x1ba239={'raw':![],'where':{'id':_0x1575a0['params']['id']}},_0x1173fd={};_0x1173fd[_0x6e48('0x2e')]=_['keys'](db['Campaign'][_0x6e48('0x2b')]);_0x1173fd[_0x6e48('0x2f')]=_[_0x6e48('0x41')](_0x1575a0['query']);_0x1173fd['filters']=_[_0x6e48('0x42')](_0x1173fd[_0x6e48('0x2e')],_0x1173fd['query']);_0x1ba239[_0x6e48('0x31')]=_[_0x6e48('0x42')](_0x1173fd['model'],qs[_0x6e48('0x32')](_0x1575a0[_0x6e48('0x2f')][_0x6e48('0x32')]));_0x1ba239[_0x6e48('0x31')]=_0x1ba239[_0x6e48('0x31')]['length']?_0x1ba239['attributes']:_0x1173fd[_0x6e48('0x2e')];if(_0x1575a0['query'][_0x6e48('0x43')]){_0x1ba239[_0x6e48('0x3d')]=[{'all':!![]}];}_0x1ba239=_[_0x6e48('0x3a')]({},_0x1ba239,_0x1575a0['options']);return db['Campaign']['find'](_0x1ba239)['then'](handleEntityNotFound(_0x198550,null))[_0x6e48('0x23')](respondWithResult(_0x198550,null))['catch'](handleError(_0x198550,null));};exports[_0x6e48('0x44')]=function(_0x25c5a6,_0x1801ca){return db[_0x6e48('0x3c')][_0x6e48('0x44')](_0x25c5a6[_0x6e48('0x45')],{})['then'](function(_0x16a44e){var _0x569266=_0x25c5a6[_0x6e48('0x46')][_0x6e48('0x24')]({'plain':!![]});if(!_0x569266)throw new Error(_0x6e48('0x47'));if(_0x569266[_0x6e48('0x48')]===_0x6e48('0x46')){var _0x20a520=_0x16a44e[_0x6e48('0x24')]({'plain':!![]});var _0x8af8de=_0x6e48('0x25');return db[_0x6e48('0x49')][_0x6e48('0x4a')]({'where':{'name':_0x8af8de,'userProfileId':_0x569266[_0x6e48('0x4b')]},'raw':!![]})[_0x6e48('0x23')](function(_0x46c1f9){if(_0x46c1f9&&_0x46c1f9[_0x6e48('0x4c')]===0x0){return db[_0x6e48('0x26')]['create']({'name':_0x20a520[_0x6e48('0x28')],'resourceId':_0x20a520['id'],'type':_0x46c1f9[_0x6e48('0x28')],'sectionId':_0x46c1f9['id']},{})['then'](function(){return _0x16a44e;});}else{return _0x16a44e;}})[_0x6e48('0x3f')](function(_0x364f31){logger[_0x6e48('0x4d')](_0x6e48('0x4e'),_0x364f31);throw _0x364f31;});}return _0x16a44e;})['then'](respondWithResult(_0x1801ca,0xc9))[_0x6e48('0x3f')](handleError(_0x1801ca,null));};exports[_0x6e48('0x4f')]=function(_0x1970fb,_0x3bfa9d){var _0x3c63c9={'where':{'id':_0x1970fb['params']['id']}},_0x1acd37={};_0x1acd37['model']=_[_0x6e48('0x41')](db[_0x6e48('0x3c')][_0x6e48('0x2b')]);_0x3c63c9[_0x6e48('0x31')]=_[_0x6e48('0x42')](_0x1acd37['model'],qs[_0x6e48('0x32')](_0x1970fb['query'][_0x6e48('0x32')]));_0x3c63c9[_0x6e48('0x31')]=_0x3c63c9[_0x6e48('0x31')][_0x6e48('0x33')]?_0x3c63c9[_0x6e48('0x31')]:_0x1acd37[_0x6e48('0x2e')];if(_0x1970fb[_0x6e48('0x2f')]['includeAll']){_0x3c63c9['include']=[{'all':!![]}];}_0x3c63c9=_[_0x6e48('0x3a')]({},_0x3c63c9,_0x1970fb[_0x6e48('0x50')]);return db[_0x6e48('0x3c')][_0x6e48('0x4a')](_0x3c63c9)['then'](handleEntityNotFound(_0x3bfa9d,null))[_0x6e48('0x23')](function(_0x2ee495){if(_0x2ee495){var _0x2a3d5d=_0x2ee495['get']({'plain':!![]});_0x2a3d5d=qs['omit'](_0x2a3d5d,['id',_0x6e48('0x51'),_0x6e48('0x52')]);_0x1970fb['body']=_['omit'](_0x1970fb[_0x6e48('0x45')],['id',_0x6e48('0x51'),_0x6e48('0x52')]);return db[_0x6e48('0x3c')][_0x6e48('0x44')](_[_0x6e48('0x3a')](_0x2a3d5d,_0x1970fb[_0x6e48('0x45')]),{'include':_0x1970fb[_0x6e48('0x2f')][_0x6e48('0x43')]?[{'all':!![]}]:undefined})[_0x6e48('0x23')](function(_0x2a4f31){var _0x2739eb=_0x1970fb[_0x6e48('0x46')][_0x6e48('0x24')]({'plain':!![]});if(!_0x2739eb)throw new Error(_0x6e48('0x47'));if(_0x2739eb[_0x6e48('0x48')]===_0x6e48('0x46')){var _0x5ab110=_0x2a4f31[_0x6e48('0x24')]({'plain':!![]});var _0x2f192c=_0x6e48('0x25');return db[_0x6e48('0x49')][_0x6e48('0x4a')]({'where':{'name':_0x2f192c,'userProfileId':_0x2739eb[_0x6e48('0x4b')]},'raw':!![]})[_0x6e48('0x23')](function(_0x2d8b6f){if(_0x2d8b6f&&_0x2d8b6f['autoAssociation']===0x0){return db[_0x6e48('0x26')][_0x6e48('0x44')]({'name':_0x5ab110['name'],'resourceId':_0x5ab110['id'],'type':_0x2d8b6f['name'],'sectionId':_0x2d8b6f['id']},{})['then'](function(){return _0x2a4f31;});}else{return _0x2a4f31;}})[_0x6e48('0x3f')](function(_0x362f48){logger['error'](_0x6e48('0x4e'),_0x362f48);throw _0x362f48;});}return _0x2a4f31;});}})[_0x6e48('0x23')](respondWithResult(_0x3bfa9d,0xc9))[_0x6e48('0x3f')](handleError(_0x3bfa9d,null));};exports[_0x6e48('0x53')]=function(_0x45588b,_0x4c6055){if(_0x45588b[_0x6e48('0x45')]['id']){delete _0x45588b[_0x6e48('0x45')]['id'];}return db['Campaign']['find']({'where':{'id':_0x45588b[_0x6e48('0x54')]['id']}})['then'](handleEntityNotFound(_0x4c6055,null))[_0x6e48('0x23')](saveUpdates(_0x45588b[_0x6e48('0x45')],null))[_0x6e48('0x23')](respondWithResult(_0x4c6055,null))[_0x6e48('0x3f')](handleError(_0x4c6055,null));};exports[_0x6e48('0x22')]=function(_0x45dfb1,_0xef219e){return db[_0x6e48('0x3c')][_0x6e48('0x4a')]({'where':{'id':_0x45dfb1['params']['id']}})[_0x6e48('0x23')](handleEntityNotFound(_0xef219e,null))[_0x6e48('0x23')](removeEntity(_0xef219e,null))[_0x6e48('0x3f')](handleError(_0xef219e,null));};exports[_0x6e48('0x55')]=function(_0x9c17d7,_0x39d8be,_0x32ee86){var _0x16a412={'raw':!![],'where':{}};var _0x5ed0d9={};var _0x9c5d37={'count':0x0,'rows':[]};return db[_0x6e48('0x3c')][_0x6e48('0x56')]({'where':{'id':_0x9c17d7[_0x6e48('0x54')]['id']}})[_0x6e48('0x23')](handleEntityNotFound(_0x39d8be,null))[_0x6e48('0x23')](function(_0x4b6a12){if(_0x4b6a12){_0x5ed0d9[_0x6e48('0x2e')]=_[_0x6e48('0x41')](db[_0x6e48('0x57')][_0x6e48('0x2b')]);_0x5ed0d9[_0x6e48('0x2f')]=_[_0x6e48('0x41')](_0x9c17d7['query']);_0x5ed0d9[_0x6e48('0x30')]=_[_0x6e48('0x42')](_0x5ed0d9['model'],_0x5ed0d9[_0x6e48('0x2f')]);_0x16a412['attributes']=_[_0x6e48('0x42')](_0x5ed0d9[_0x6e48('0x2e')],qs[_0x6e48('0x32')](_0x9c17d7[_0x6e48('0x2f')][_0x6e48('0x32')]));_0x16a412['attributes']=_0x16a412[_0x6e48('0x31')]['length']?_0x16a412[_0x6e48('0x31')]:_0x5ed0d9[_0x6e48('0x2e')];if(!_0x9c17d7[_0x6e48('0x2f')]['hasOwnProperty'](_0x6e48('0x35'))){_0x16a412[_0x6e48('0x1d')]=qs[_0x6e48('0x1d')](_0x9c17d7[_0x6e48('0x2f')][_0x6e48('0x1d')]);_0x16a412[_0x6e48('0x1b')]=qs['offset'](_0x9c17d7[_0x6e48('0x2f')][_0x6e48('0x1b')]);}_0x16a412[_0x6e48('0x36')]=qs['sort'](_0x9c17d7[_0x6e48('0x2f')][_0x6e48('0x37')]);_0x16a412['where']=qs[_0x6e48('0x30')](_[_0x6e48('0x58')](_0x9c17d7[_0x6e48('0x2f')],_0x5ed0d9[_0x6e48('0x30')]));_0x16a412[_0x6e48('0x38')][_0x6e48('0x59')]=_0x4b6a12['id'];if(_0x9c17d7[_0x6e48('0x2f')][_0x6e48('0x39')]){_0x16a412['where']=_[_0x6e48('0x3a')](_0x16a412['where'],{'$or':_[_0x6e48('0x2a')](_0x16a412[_0x6e48('0x31')],function(_0x50e381){var _0x4b9b49={};_0x4b9b49[_0x50e381]={'$like':'%'+_0x9c17d7['query'][_0x6e48('0x39')]+'%'};return _0x4b9b49;})});}_0x16a412=_[_0x6e48('0x3a')]({},_0x16a412,_0x9c17d7[_0x6e48('0x50')]);return db[_0x6e48('0x57')][_0x6e48('0x1e')]({'where':_0x16a412[_0x6e48('0x38')]})[_0x6e48('0x23')](function(_0x432d4b){_0x9c5d37[_0x6e48('0x1e')]=_0x432d4b;if(_0x9c17d7[_0x6e48('0x2f')][_0x6e48('0x43')]){_0x16a412[_0x6e48('0x3d')]=[{'all':!![]}];}return db[_0x6e48('0x57')][_0x6e48('0x3e')](_0x16a412);})[_0x6e48('0x23')](function(_0x414719){_0x9c5d37[_0x6e48('0x5a')]=_0x414719;return _0x9c5d37;});}})[_0x6e48('0x23')](respondWithFilteredResult(_0x39d8be,_0x16a412))[_0x6e48('0x3f')](handleError(_0x39d8be,null));};exports[_0x6e48('0x5b')]=function(_0x252d0e,_0x2a4c6f,_0x5e4d0a){var _0x452a3a={'raw':!![],'where':{}};var _0x267015={};var _0x3a5f56={'count':0x0,'rows':[]};return db[_0x6e48('0x3c')][_0x6e48('0x56')]({'where':{'id':_0x252d0e[_0x6e48('0x54')]['id']}})[_0x6e48('0x23')](handleEntityNotFound(_0x2a4c6f,null))[_0x6e48('0x23')](function(_0x40543d){if(_0x40543d){_0x267015[_0x6e48('0x2e')]=_[_0x6e48('0x41')](db[_0x6e48('0x5c')][_0x6e48('0x2b')]);_0x267015[_0x6e48('0x2f')]=_[_0x6e48('0x41')](_0x252d0e[_0x6e48('0x2f')]);_0x267015[_0x6e48('0x30')]=_['intersection'](_0x267015[_0x6e48('0x2e')],_0x267015[_0x6e48('0x2f')]);_0x452a3a[_0x6e48('0x31')]=_[_0x6e48('0x42')](_0x267015['model'],qs[_0x6e48('0x32')](_0x252d0e[_0x6e48('0x2f')][_0x6e48('0x32')]));_0x452a3a[_0x6e48('0x31')]=_0x452a3a['attributes'][_0x6e48('0x33')]?_0x452a3a[_0x6e48('0x31')]:_0x267015[_0x6e48('0x2e')];if(!_0x252d0e['query']['hasOwnProperty'](_0x6e48('0x35'))){_0x452a3a[_0x6e48('0x1d')]=qs[_0x6e48('0x1d')](_0x252d0e[_0x6e48('0x2f')][_0x6e48('0x1d')]);_0x452a3a['offset']=qs[_0x6e48('0x1b')](_0x252d0e['query'][_0x6e48('0x1b')]);}_0x452a3a[_0x6e48('0x36')]=qs[_0x6e48('0x37')](_0x252d0e['query']['sort']);_0x452a3a[_0x6e48('0x38')]=qs[_0x6e48('0x30')](_[_0x6e48('0x58')](_0x252d0e[_0x6e48('0x2f')],_0x267015[_0x6e48('0x30')]));_0x452a3a[_0x6e48('0x38')]['CampaignId']=_0x40543d['id'];if(_0x252d0e[_0x6e48('0x2f')][_0x6e48('0x39')]){_0x452a3a['where']=_[_0x6e48('0x3a')](_0x452a3a['where'],{'$or':_[_0x6e48('0x2a')](_0x452a3a['attributes'],function(_0x4d3488){var _0x26f74c={};_0x26f74c[_0x4d3488]={'$like':'%'+_0x252d0e[_0x6e48('0x2f')][_0x6e48('0x39')]+'%'};return _0x26f74c;})});}_0x452a3a=_[_0x6e48('0x3a')]({},_0x452a3a,_0x252d0e['options']);return db[_0x6e48('0x5c')]['count']({'where':_0x452a3a[_0x6e48('0x38')]})['then'](function(_0x3b7acb){_0x3a5f56[_0x6e48('0x1e')]=_0x3b7acb;if(_0x252d0e[_0x6e48('0x2f')][_0x6e48('0x43')]){_0x452a3a[_0x6e48('0x3d')]=[{'all':!![]}];}return db[_0x6e48('0x5c')][_0x6e48('0x3e')](_0x452a3a);})['then'](function(_0x44dd0c){_0x3a5f56['rows']=_0x44dd0c;return _0x3a5f56;});}})[_0x6e48('0x23')](respondWithFilteredResult(_0x2a4c6f,_0x452a3a))[_0x6e48('0x3f')](handleError(_0x2a4c6f,null));};exports[_0x6e48('0x5d')]=function(_0x2b490d,_0xdb68fe,_0x3123df){var _0xc953cb={'raw':!![],'where':{}};var _0xa9991={};var _0x6417f7={'count':0x0,'rows':[]};return db[_0x6e48('0x3c')][_0x6e48('0x56')]({'where':{'id':_0x2b490d[_0x6e48('0x54')]['id']}})[_0x6e48('0x23')](handleEntityNotFound(_0xdb68fe,null))['then'](function(_0xebdb){if(_0xebdb){_0xa9991[_0x6e48('0x2e')]=_[_0x6e48('0x41')](db[_0x6e48('0x5e')]['rawAttributes']);_0xa9991[_0x6e48('0x2f')]=_['keys'](_0x2b490d['query']);_0xa9991[_0x6e48('0x30')]=_[_0x6e48('0x42')](_0xa9991[_0x6e48('0x2e')],_0xa9991[_0x6e48('0x2f')]);_0xc953cb[_0x6e48('0x31')]=_[_0x6e48('0x42')](_0xa9991[_0x6e48('0x2e')],qs[_0x6e48('0x32')](_0x2b490d[_0x6e48('0x2f')][_0x6e48('0x32')]));_0xc953cb[_0x6e48('0x31')]=_0xc953cb['attributes']['length']?_0xc953cb[_0x6e48('0x31')]:_0xa9991[_0x6e48('0x2e')];if(!_0x2b490d[_0x6e48('0x2f')]['hasOwnProperty'](_0x6e48('0x35'))){_0xc953cb[_0x6e48('0x1d')]=qs[_0x6e48('0x1d')](_0x2b490d[_0x6e48('0x2f')][_0x6e48('0x1d')]);_0xc953cb[_0x6e48('0x1b')]=qs[_0x6e48('0x1b')](_0x2b490d['query'][_0x6e48('0x1b')]);}_0xc953cb[_0x6e48('0x36')]=qs[_0x6e48('0x37')](_0x2b490d[_0x6e48('0x2f')][_0x6e48('0x37')]);_0xc953cb[_0x6e48('0x38')]=qs[_0x6e48('0x30')](_[_0x6e48('0x58')](_0x2b490d[_0x6e48('0x2f')],_0xa9991[_0x6e48('0x30')]));_0xc953cb[_0x6e48('0x38')]['CampaignId']=_0xebdb['id'];if(_0x2b490d['query'][_0x6e48('0x39')]){_0xc953cb[_0x6e48('0x38')]=_[_0x6e48('0x3a')](_0xc953cb['where'],{'$or':_[_0x6e48('0x2a')](_0xc953cb[_0x6e48('0x31')],function(_0x3b49c4){var _0x2bb51e={};_0x2bb51e[_0x3b49c4]={'$like':'%'+_0x2b490d[_0x6e48('0x2f')]['filter']+'%'};return _0x2bb51e;})});}_0xc953cb=_[_0x6e48('0x3a')]({},_0xc953cb,_0x2b490d['options']);return db['CmHopperFinal']['count']({'where':_0xc953cb[_0x6e48('0x38')]})[_0x6e48('0x23')](function(_0x3f6006){_0x6417f7[_0x6e48('0x1e')]=_0x3f6006;if(_0x2b490d[_0x6e48('0x2f')][_0x6e48('0x43')]){_0xc953cb[_0x6e48('0x3d')]=[{'all':!![]}];}return db[_0x6e48('0x5e')][_0x6e48('0x3e')](_0xc953cb);})[_0x6e48('0x23')](function(_0x5def28){_0x6417f7['rows']=_0x5def28;return _0x6417f7;});}})['then'](respondWithFilteredResult(_0xdb68fe,_0xc953cb))[_0x6e48('0x3f')](handleError(_0xdb68fe,null));};exports[_0x6e48('0x5f')]=function(_0x4cec6b,_0xe7c81d,_0x40f291){var _0x1302c5={'raw':!![],'where':{}};var _0x29fb10={};var _0x4524a8={'count':0x0,'rows':[]};return db[_0x6e48('0x3c')][_0x6e48('0x56')]({'where':{'id':_0x4cec6b[_0x6e48('0x54')]['id']}})[_0x6e48('0x23')](handleEntityNotFound(_0xe7c81d,null))['then'](function(_0x15daa4){if(_0x15daa4){_0x29fb10[_0x6e48('0x2e')]=_[_0x6e48('0x41')](db[_0x6e48('0x60')]['rawAttributes']);_0x29fb10['query']=_[_0x6e48('0x41')](_0x4cec6b[_0x6e48('0x2f')]);_0x29fb10[_0x6e48('0x30')]=_[_0x6e48('0x42')](_0x29fb10[_0x6e48('0x2e')],_0x29fb10[_0x6e48('0x2f')]);_0x1302c5[_0x6e48('0x31')]=_[_0x6e48('0x42')](_0x29fb10[_0x6e48('0x2e')],qs[_0x6e48('0x32')](_0x4cec6b[_0x6e48('0x2f')][_0x6e48('0x32')]));_0x1302c5[_0x6e48('0x31')]=_0x1302c5['attributes']['length']?_0x1302c5[_0x6e48('0x31')]:_0x29fb10[_0x6e48('0x2e')];if(!_0x4cec6b[_0x6e48('0x2f')][_0x6e48('0x34')]('nolimit')){_0x1302c5['limit']=qs['limit'](_0x4cec6b[_0x6e48('0x2f')]['limit']);_0x1302c5['offset']=qs[_0x6e48('0x1b')](_0x4cec6b['query']['offset']);}_0x1302c5[_0x6e48('0x36')]=qs[_0x6e48('0x37')](_0x4cec6b['query'][_0x6e48('0x37')]);_0x1302c5[_0x6e48('0x38')]=qs[_0x6e48('0x30')](_['pick'](_0x4cec6b[_0x6e48('0x2f')],_0x29fb10['filters']));_0x1302c5[_0x6e48('0x38')][_0x6e48('0x59')]=_0x15daa4['id'];if(_0x4cec6b[_0x6e48('0x2f')][_0x6e48('0x39')]){_0x1302c5[_0x6e48('0x38')]=_[_0x6e48('0x3a')](_0x1302c5[_0x6e48('0x38')],{'$or':_['map'](_0x1302c5[_0x6e48('0x31')],function(_0x4cc014){var _0x26720d={};_0x26720d[_0x4cc014]={'$like':'%'+_0x4cec6b[_0x6e48('0x2f')]['filter']+'%'};return _0x26720d;})});}_0x1302c5=_[_0x6e48('0x3a')]({},_0x1302c5,_0x4cec6b['options']);return db[_0x6e48('0x60')]['count']({'where':_0x1302c5[_0x6e48('0x38')]})[_0x6e48('0x23')](function(_0x69451c){_0x4524a8['count']=_0x69451c;if(_0x4cec6b[_0x6e48('0x2f')]['includeAll']){_0x1302c5[_0x6e48('0x3d')]=[{'all':!![]}];}return db[_0x6e48('0x60')][_0x6e48('0x3e')](_0x1302c5);})[_0x6e48('0x23')](function(_0x2093e7){_0x4524a8['rows']=_0x2093e7;return _0x4524a8;});}})[_0x6e48('0x23')](respondWithFilteredResult(_0xe7c81d,_0x1302c5))[_0x6e48('0x3f')](handleError(_0xe7c81d,null));};exports['getLists']=function(_0x375a75,_0x1e8914,_0x1c2b9e){var _0x3029f4={};var _0x5ca396={};var _0x3f967b;var _0x361337;return db[_0x6e48('0x3c')][_0x6e48('0x56')]({'where':{'id':_0x375a75[_0x6e48('0x54')]['id']}})[_0x6e48('0x23')](handleEntityNotFound(_0x1e8914,null))[_0x6e48('0x23')](function(_0x3da8a9){if(_0x3da8a9){_0x3f967b=_0x3da8a9;_0x5ca396[_0x6e48('0x2e')]=_[_0x6e48('0x41')](db[_0x6e48('0x61')]['rawAttributes']);_0x5ca396[_0x6e48('0x2f')]=_['keys'](_0x375a75[_0x6e48('0x2f')]);_0x5ca396[_0x6e48('0x30')]=_[_0x6e48('0x42')](_0x5ca396['model'],_0x5ca396['query']);_0x3029f4['attributes']=_[_0x6e48('0x42')](_0x5ca396['model'],qs[_0x6e48('0x32')](_0x375a75['query']['fields']));_0x3029f4[_0x6e48('0x31')]=_0x3029f4['attributes'][_0x6e48('0x33')]?_0x3029f4[_0x6e48('0x31')]:_0x5ca396[_0x6e48('0x2e')];_0x3029f4[_0x6e48('0x36')]=qs[_0x6e48('0x37')](_0x375a75[_0x6e48('0x2f')][_0x6e48('0x37')]);_0x3029f4[_0x6e48('0x38')]=qs[_0x6e48('0x30')](_['pick'](_0x375a75[_0x6e48('0x2f')],_0x5ca396[_0x6e48('0x30')]));if(_0x375a75['query']['filter']){_0x3029f4[_0x6e48('0x38')]=_[_0x6e48('0x3a')](_0x3029f4[_0x6e48('0x38')],{'$or':_['map'](_0x3029f4[_0x6e48('0x31')],function(_0x389d43){var _0x23b8ee={};_0x23b8ee[_0x389d43]={'$like':'%'+_0x375a75['query'][_0x6e48('0x39')]+'%'};return _0x23b8ee;})});}_0x3029f4=_['merge']({},_0x3029f4,_0x375a75['options']);return _0x3f967b[_0x6e48('0x62')](_0x3029f4);}})[_0x6e48('0x23')](function(_0x2e22a0){if(_0x2e22a0){_0x361337=_0x2e22a0[_0x6e48('0x33')];if(!_0x375a75[_0x6e48('0x2f')][_0x6e48('0x34')]('nolimit')){_0x3029f4[_0x6e48('0x1d')]=qs['limit'](_0x375a75['query']['limit']);_0x3029f4[_0x6e48('0x1b')]=qs[_0x6e48('0x1b')](_0x375a75[_0x6e48('0x2f')]['offset']);}return _0x3f967b[_0x6e48('0x62')](_0x3029f4);}})['then'](function(_0x5243bc){if(_0x5243bc){return _0x5243bc?{'count':_0x361337,'rows':_0x5243bc}:null;}})[_0x6e48('0x23')](respondWithResult(_0x1e8914,null))[_0x6e48('0x3f')](handleError(_0x1e8914,null));};exports['addLists']=function(_0x45507e,_0x7e2923,_0x290571){var _0x2616e5,_0x438277;var _0x3313a5=[];var _0x22bfac=moment()['format'](_0x6e48('0x63'));return db[_0x6e48('0x3c')]['find']({'where':{'id':_0x45507e[_0x6e48('0x54')]['id']}})[_0x6e48('0x23')](handleEntityNotFound(_0x7e2923,null))[_0x6e48('0x23')](function(_0x602e8e){if(_0x602e8e){_0x438277=_0x602e8e;return _0x602e8e['addLists'](_0x45507e[_0x6e48('0x45')]['ids'],_[_0x6e48('0x64')](_0x45507e[_0x6e48('0x45')],[_0x6e48('0x65'),'id'])||{});}return null;})['spread'](function(_0x1be003){var _0xa2d90e;var _0x3dc756;_0x2616e5=_0x1be003||[];var _0x259261=[];if(_0x1be003){for(var _0x1f54b2=0x0;_0x1f54b2<_0x1be003['length'];_0x1f54b2+=0x1){var _0x3490da=_0x1be003[_0x1f54b2][_0x6e48('0x24')]({'plain':!![]});_0x438277[_0x6e48('0x66')]=_0x45507e[_0x6e48('0x45')][_0x6e48('0x66')]?_0x45507e[_0x6e48('0x45')][_0x6e48('0x66')]:_0x438277['dialCheckDuplicateType'];switch(_0x438277[_0x6e48('0x66')]){case _0x6e48('0x67'):_0xa2d90e=squel[_0x6e48('0x68')]()[_0x6e48('0x69')](_0x6e48('0x6a'))[_0x6e48('0x6b')]([_0x6e48('0x6c'),_0x6e48('0x6d'),_0x6e48('0x6e'),'ListId','CampaignId',_0x6e48('0x51'),_0x6e48('0x52')],squel[_0x6e48('0x6f')]()[_0x6e48('0x70')](_0x6e48('0x6c'),_0x6e48('0x6c'))[_0x6e48('0x70')]('NOW()',_0x6e48('0x6d'))[_0x6e48('0x70')]('id',_0x6e48('0x6e'))[_0x6e48('0x70')](_0x3490da['CmListId'][_0x6e48('0x71')](),'ListId')[_0x6e48('0x70')](_0x45507e[_0x6e48('0x54')]['id'][_0x6e48('0x71')](),_0x6e48('0x59'))[_0x6e48('0x70')]('\x27'+_0x22bfac+'\x27',_0x6e48('0x51'))[_0x6e48('0x70')]('\x27'+_0x22bfac+'\x27',_0x6e48('0x52'))['from']('cm_contacts')['where'](_0x6e48('0x72'))[_0x6e48('0x38')](_0x6e48('0x73'),_0x3490da['CmListId'][_0x6e48('0x71')]())[_0x6e48('0x38')](_0x6e48('0x74'))[_0x6e48('0x38')](_0x6e48('0x75'),squel[_0x6e48('0x6f')]()[_0x6e48('0x70')]('COALESCE(calleridnum,\x27\x27)')[_0x6e48('0x76')](_0x6e48('0x77'))[_0x6e48('0x38')]('CampaignId\x20=\x20?',_0x45507e['params']['id'][_0x6e48('0x71')]()))[_0x6e48('0x38')]('phone\x20NOT\x20IN\x20(?)',squel[_0x6e48('0x6f')]()[_0x6e48('0x70')](_0x6e48('0x78'))['from'](_0x6e48('0x6a'))[_0x6e48('0x38')]('CampaignId\x20=\x20?',_0x45507e[_0x6e48('0x54')]['id'][_0x6e48('0x71')]())))[_0x6e48('0x71')]();break;case _0x6e48('0x79'):_0xa2d90e=squel[_0x6e48('0x68')]()[_0x6e48('0x69')]('cm_hopper')[_0x6e48('0x6b')]([_0x6e48('0x6c'),_0x6e48('0x6d'),_0x6e48('0x6e'),_0x6e48('0x7a'),'CampaignId',_0x6e48('0x51'),_0x6e48('0x52')],squel[_0x6e48('0x6f')]()[_0x6e48('0x70')]('phone',_0x6e48('0x6c'))[_0x6e48('0x70')](_0x6e48('0x7b'),_0x6e48('0x6d'))[_0x6e48('0x70')]('id','ContactId')[_0x6e48('0x70')](_0x3490da['CmListId'][_0x6e48('0x71')](),_0x6e48('0x7a'))[_0x6e48('0x70')](_0x45507e[_0x6e48('0x54')]['id'][_0x6e48('0x71')](),_0x6e48('0x59'))[_0x6e48('0x70')]('\x27'+_0x22bfac+'\x27',_0x6e48('0x51'))[_0x6e48('0x70')]('\x27'+_0x22bfac+'\x27',_0x6e48('0x52'))[_0x6e48('0x76')](_0x6e48('0x7c'))[_0x6e48('0x38')](_0x6e48('0x72'))[_0x6e48('0x38')](_0x6e48('0x73'),_0x3490da[_0x6e48('0x7d')][_0x6e48('0x71')]())[_0x6e48('0x38')]('phone\x20IS\x20NOT\x20NULL')[_0x6e48('0x38')]('phone\x20NOT\x20IN\x20(?)',squel[_0x6e48('0x6f')]()[_0x6e48('0x70')](_0x6e48('0x78'))['from']('cm_hopper')[_0x6e48('0x38')]('CampaignId\x20=\x20?',_0x45507e[_0x6e48('0x54')]['id'][_0x6e48('0x71')]())))[_0x6e48('0x71')]();break;default:_0xa2d90e=squel[_0x6e48('0x68')]()[_0x6e48('0x69')](_0x6e48('0x6a'))[_0x6e48('0x6b')]([_0x6e48('0x6c'),_0x6e48('0x6d'),'ContactId',_0x6e48('0x7a'),'CampaignId',_0x6e48('0x51'),_0x6e48('0x52')],squel[_0x6e48('0x6f')]()[_0x6e48('0x70')]('phone',_0x6e48('0x6c'))[_0x6e48('0x70')](_0x6e48('0x7b'),'scheduledAt')[_0x6e48('0x70')]('id',_0x6e48('0x6e'))[_0x6e48('0x70')](_0x3490da[_0x6e48('0x7d')]['toString'](),'ListId')['field'](_0x45507e['params']['id']['toString'](),'CampaignId')[_0x6e48('0x70')]('\x27'+_0x22bfac+'\x27',_0x6e48('0x51'))[_0x6e48('0x70')]('\x27'+_0x22bfac+'\x27','updatedAt')[_0x6e48('0x76')](_0x6e48('0x7c'))[_0x6e48('0x38')](_0x6e48('0x72'))[_0x6e48('0x38')](_0x6e48('0x73'),_0x3490da[_0x6e48('0x7d')]['toString']())[_0x6e48('0x38')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x3dc756=squel[_0x6e48('0x68')]()[_0x6e48('0x69')](_0x6e48('0x7e'))[_0x6e48('0x6b')](['cmHopperId',_0x6e48('0x6d'),_0x6e48('0x6c'),_0x6e48('0x7f'),_0x6e48('0x51'),'updatedAt'],squel[_0x6e48('0x6f')]()[_0x6e48('0x70')]('h.id','id')[_0x6e48('0x70')](_0x6e48('0x7b'),_0x6e48('0x6d'))['field'](_0x6e48('0x80'),'phone')[_0x6e48('0x70')](_0x6e48('0x81'),_0x6e48('0x7f'))[_0x6e48('0x70')]('\x27'+_0x22bfac+'\x27',_0x6e48('0x51'))[_0x6e48('0x70')]('\x27'+_0x22bfac+'\x27',_0x6e48('0x52'))['from'](_0x6e48('0x82'),'ci')['join'](_0x6e48('0x6a'),'h',_0x6e48('0x83'))['where'](_0x6e48('0x84'),_0x3490da[_0x6e48('0x7d')][_0x6e48('0x71')]())['where'](_0x6e48('0x85'),_0x45507e[_0x6e48('0x54')]['id']['toString']())[_0x6e48('0x38')](_0x6e48('0x86'),_0x22bfac))['toString']();_0x259261['push'](db[_0x6e48('0x87')]['query'](_0xa2d90e));_0x3313a5[_0x6e48('0x88')](db['sequelize'][_0x6e48('0x2f')](_0x3dc756));}return BPromise['all'](_0x259261);}})['then'](function(){return BPromise[_0x6e48('0x89')](_0x3313a5);})[_0x6e48('0x23')](function(){return _0x2616e5;})['then'](respondWithResult(_0x7e2923,null))[_0x6e48('0x3f')](handleError(_0x7e2923,null));};exports['removeLists']=function(_0x279414,_0x4a8b76,_0x1c44d0){return db[_0x6e48('0x3c')][_0x6e48('0x4a')]({'where':{'id':_0x279414[_0x6e48('0x54')]['id']}})[_0x6e48('0x23')](handleEntityNotFound(_0x4a8b76,null))[_0x6e48('0x23')](function(_0x36c8b6){if(_0x36c8b6){return _0x36c8b6[_0x6e48('0x8a')](_0x279414[_0x6e48('0x2f')]['ids']);}})[_0x6e48('0x23')](function(_0x14f8d4){if(_0x14f8d4){return db[_0x6e48('0x57')][_0x6e48('0x22')]({'where':{'ListId':_0x279414[_0x6e48('0x2f')][_0x6e48('0x65')],'CampaignId':_0x279414['params']['id']}})[_0x6e48('0x23')](function(){return _0x14f8d4;});}})[_0x6e48('0x23')](respondWithStatusCode(_0x4a8b76,null))['catch'](handleError(_0x4a8b76,null));};exports[_0x6e48('0x8b')]=function(_0x9707ba,_0x170e0f,_0x3a728e){var _0x1f5bef={};var _0x174734={};var _0x4530e3;var _0x2d278d;return db[_0x6e48('0x3c')]['findOne']({'where':{'id':_0x9707ba['params']['id']}})[_0x6e48('0x23')](handleEntityNotFound(_0x170e0f,null))[_0x6e48('0x23')](function(_0xb2b390){if(_0xb2b390){_0x4530e3=_0xb2b390;_0x174734[_0x6e48('0x2e')]=_[_0x6e48('0x41')](db['CmList'][_0x6e48('0x2b')]);_0x174734[_0x6e48('0x2f')]=_[_0x6e48('0x41')](_0x9707ba['query']);_0x174734[_0x6e48('0x30')]=_[_0x6e48('0x42')](_0x174734[_0x6e48('0x2e')],_0x174734[_0x6e48('0x2f')]);_0x1f5bef[_0x6e48('0x31')]=_[_0x6e48('0x42')](_0x174734[_0x6e48('0x2e')],qs['fields'](_0x9707ba[_0x6e48('0x2f')][_0x6e48('0x32')]));_0x1f5bef[_0x6e48('0x31')]=_0x1f5bef[_0x6e48('0x31')][_0x6e48('0x33')]?_0x1f5bef[_0x6e48('0x31')]:_0x174734[_0x6e48('0x2e')];_0x1f5bef['order']=qs[_0x6e48('0x37')](_0x9707ba['query'][_0x6e48('0x37')]);_0x1f5bef[_0x6e48('0x38')]=qs[_0x6e48('0x30')](_['pick'](_0x9707ba[_0x6e48('0x2f')],_0x174734['filters']));if(_0x9707ba['query'][_0x6e48('0x39')]){_0x1f5bef['where']=_[_0x6e48('0x3a')](_0x1f5bef[_0x6e48('0x38')],{'$or':_[_0x6e48('0x2a')](_0x1f5bef['attributes'],function(_0x294cf7){var _0x1fa5fe={};_0x1fa5fe[_0x294cf7]={'$like':'%'+_0x9707ba[_0x6e48('0x2f')][_0x6e48('0x39')]+'%'};return _0x1fa5fe;})});}_0x1f5bef=_['merge']({},_0x1f5bef,_0x9707ba[_0x6e48('0x50')]);return _0x4530e3[_0x6e48('0x8b')](_0x1f5bef);}})[_0x6e48('0x23')](function(_0x2878d0){if(_0x2878d0){_0x2d278d=_0x2878d0[_0x6e48('0x33')];if(!_0x9707ba['query']['hasOwnProperty'](_0x6e48('0x35'))){_0x1f5bef['limit']=qs['limit'](_0x9707ba[_0x6e48('0x2f')]['limit']);_0x1f5bef[_0x6e48('0x1b')]=qs[_0x6e48('0x1b')](_0x9707ba['query'][_0x6e48('0x1b')]);}return _0x4530e3['getBlackLists'](_0x1f5bef);}})[_0x6e48('0x23')](function(_0x393d36){if(_0x393d36){return _0x393d36?{'count':_0x2d278d,'rows':_0x393d36}:null;}})[_0x6e48('0x23')](respondWithResult(_0x170e0f,null))[_0x6e48('0x3f')](handleError(_0x170e0f,null));};exports[_0x6e48('0x8c')]=function(_0x472c6a,_0x188fc6,_0x3484d2){var _0x5110dc,_0x4cb295;var _0x33ff2a=[];var _0xf6f5b7=moment()[_0x6e48('0x8d')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x6e48('0x3c')][_0x6e48('0x4a')]({'where':{'id':_0x472c6a[_0x6e48('0x54')]['id']}})[_0x6e48('0x23')](handleEntityNotFound(_0x188fc6,null))[_0x6e48('0x23')](function(_0x18baa9){if(_0x18baa9){_0x4cb295=_0x18baa9;return _0x18baa9['addBlackLists'](_0x472c6a[_0x6e48('0x45')][_0x6e48('0x65')],_['omit'](_0x472c6a['body'],[_0x6e48('0x65'),'id'])||{});}return null;})[_0x6e48('0x8e')](function(_0x1bd026){var _0xb618eb;var _0x28e790;_0x5110dc=_0x1bd026||[];var _0x38b987=[];if(_0x1bd026){for(var _0xa376bb=0x0;_0xa376bb<_0x1bd026[_0x6e48('0x33')];_0xa376bb+=0x1){var _0x13eace=_0x1bd026[_0xa376bb]['get']({'plain':!![]});_0xb618eb=squel[_0x6e48('0x68')]()[_0x6e48('0x69')]('cm_hopper_black')[_0x6e48('0x6b')](['phone',_0x6e48('0x6e'),_0x6e48('0x7a'),_0x6e48('0x59'),'createdAt',_0x6e48('0x52')],squel[_0x6e48('0x6f')]()[_0x6e48('0x70')](_0x6e48('0x6c'),'phone')[_0x6e48('0x70')]('id',_0x6e48('0x6e'))[_0x6e48('0x70')](_0x13eace[_0x6e48('0x7d')][_0x6e48('0x71')](),_0x6e48('0x7a'))[_0x6e48('0x70')](_0x472c6a[_0x6e48('0x54')]['id'][_0x6e48('0x71')](),_0x6e48('0x59'))[_0x6e48('0x70')](_0x6e48('0x7b'),_0x6e48('0x51'))[_0x6e48('0x70')](_0x6e48('0x7b'),_0x6e48('0x52'))['from'](_0x6e48('0x7c'))[_0x6e48('0x38')](_0x6e48('0x72'))[_0x6e48('0x38')]('ListId\x20=\x20?',_0x13eace[_0x6e48('0x7d')][_0x6e48('0x71')]())[_0x6e48('0x38')](_0x6e48('0x74')))[_0x6e48('0x71')]();_0x38b987[_0x6e48('0x88')](db['sequelize'][_0x6e48('0x2f')](_0xb618eb));}return BPromise[_0x6e48('0x89')](_0x38b987);}})['then'](function(){return _0x5110dc;})[_0x6e48('0x23')](respondWithResult(_0x188fc6,null))[_0x6e48('0x3f')](handleError(_0x188fc6,null));};exports['removeBlackLists']=function(_0x2fe913,_0x336ea4,_0x5b4734){return db[_0x6e48('0x3c')][_0x6e48('0x4a')]({'where':{'id':_0x2fe913[_0x6e48('0x54')]['id']}})[_0x6e48('0x23')](handleEntityNotFound(_0x336ea4,null))[_0x6e48('0x23')](function(_0x276fbf){if(_0x276fbf){return _0x276fbf[_0x6e48('0x8f')](_0x2fe913[_0x6e48('0x2f')][_0x6e48('0x65')]);}})[_0x6e48('0x23')](function(_0x2d4b32){if(_0x2d4b32){return db['CmHopperBlack'][_0x6e48('0x22')]({'where':{'ListId':_0x2fe913['query'][_0x6e48('0x65')],'CampaignId':_0x2fe913[_0x6e48('0x54')]['id']}})['then'](function(){return _0x2d4b32;});}})[_0x6e48('0x23')](respondWithStatusCode(_0x336ea4,null))[_0x6e48('0x3f')](handleError(_0x336ea4,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 7de4975..5d5ccdd 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(_0x45d809,_0x379b71){var _0x1fdd72=function(_0x57c7c5){while(--_0x57c7c5){_0x45d809['push'](_0x45d809['shift']());}};_0x1fdd72(++_0x379b71);}(_0x7a54,0x106));var _0x47a5=function(_0x5d2b94,_0x1f0128){_0x5d2b94=_0x5d2b94-0x0;var _0x1925a0=_0x7a54[_0x5d2b94];return _0x1925a0;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x3be1a7,_0x4bb8fe){var _0x4a6085=function(_0x3d97c6){while(--_0x3d97c6){_0x3be1a7['push'](_0x3be1a7['shift']());}};_0x4a6085(++_0x4bb8fe);}(_0x7a54,0x106));var _0x47a5=function(_0x261280,_0x2fe4cc){_0x261280=_0x261280-0x0;var _0x588b0=_0x7a54[_0x261280];return _0x588b0;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index ec9baad..e5b983d 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 _0xf9f7=['../../config/environment','jayson/promise','client','http','request','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetCampaign','Campaign','findAll','options','where','attributes','limit','include','map','model','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x5ab190,_0x444ff4){var _0x3097a2=function(_0x579a87){while(--_0x579a87){_0x5ab190['push'](_0x5ab190['shift']());}};_0x3097a2(++_0x444ff4);}(_0xf9f7,0xdf));var _0x7f9f=function(_0x39780c,_0x5782c9){_0x39780c=_0x39780c-0x0;var _0x53c19b=_0xf9f7[_0x39780c];return _0x53c19b;};'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')]('Campaign,\x20%s,\x20%s',_0x37e39f,_0x3fda85[_0x7f9f('0x12')][_0x7f9f('0x13')]);return _0x181328(_0x3fda85[_0x7f9f('0x12')][_0x7f9f('0x13')]);}else{logger[_0x7f9f('0xd')]('Campaign,\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);});});}exports[_0x7f9f('0x16')]=function(_0x35f6b1){var _0x2d663e=this;return new Promise(function(_0x11e263,_0x47ae52){return db[_0x7f9f('0x17')][_0x7f9f('0x18')]({'raw':_0x35f6b1['options']?_0x35f6b1[_0x7f9f('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x35f6b1[_0x7f9f('0x19')]?_0x35f6b1[_0x7f9f('0x19')][_0x7f9f('0x1a')]||null:null,'attributes':_0x35f6b1[_0x7f9f('0x19')]?_0x35f6b1['options'][_0x7f9f('0x1b')]||null:null,'limit':_0x35f6b1['options']?_0x35f6b1['options'][_0x7f9f('0x1c')]||null:null,'include':_0x35f6b1[_0x7f9f('0x19')]?_0x35f6b1[_0x7f9f('0x19')][_0x7f9f('0x1d')]?_[_0x7f9f('0x1e')](_0x35f6b1['options']['include'],function(_0x3ec242){return{'model':db[_0x3ec242['model']],'as':_0x3ec242['as'],'attributes':_0x3ec242[_0x7f9f('0x1b')],'include':_0x3ec242[_0x7f9f('0x1d')]?_[_0x7f9f('0x1e')](_0x3ec242[_0x7f9f('0x1d')],function(_0x1a49a9){return{'model':db[_0x1a49a9[_0x7f9f('0x1f')]],'as':_0x1a49a9['as'],'attributes':_0x1a49a9['attributes'],'include':_0x1a49a9[_0x7f9f('0x1d')]?_['map'](_0x1a49a9[_0x7f9f('0x1d')],function(_0x3464f2){return{'model':db[_0x3464f2[_0x7f9f('0x1f')]],'as':_0x3464f2['as'],'attributes':_0x3464f2['attributes']};}):[]};}):[]};}):[]:[]})[_0x7f9f('0x20')](function(_0x3380d7){logger[_0x7f9f('0xd')]('GetCampaign',_0x35f6b1);logger[_0x7f9f('0x10')](_0x7f9f('0x16'),_0x35f6b1,JSON['stringify'](_0x3380d7));_0x11e263(_0x3380d7);})['catch'](function(_0x5e2428){logger[_0x7f9f('0x12')]('GetCampaign',_0x5e2428[_0x7f9f('0x13')],_0x35f6b1);_0x47ae52(_0x2d663e[_0x7f9f('0x12')](0x1f4,_0x5e2428['message']));});});}; \ No newline at end of file +var _0x65f4=['raw','where','attributes','limit','include','map','model','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetCampaign','Campaign','options'];(function(_0x450fb7,_0x4b44c0){var _0x4f39c4=function(_0x3ecef6){while(--_0x3ecef6){_0x450fb7['push'](_0x450fb7['shift']());}};_0x4f39c4(++_0x4b44c0);}(_0x65f4,0x19a));var _0x465f=function(_0x106b7f,_0x28495a){_0x106b7f=_0x106b7f-0x0;var _0x5e722a=_0x65f4[_0x106b7f];return _0x5e722a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x465f('0x0'));var BPromise=require(_0x465f('0x1'));var rs=require(_0x465f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x465f('0x3'));var logger=require(_0x465f('0x4'))(_0x465f('0x5'));var config=require('../../config/environment');var jayson=require(_0x465f('0x6'));var client=jayson[_0x465f('0x7')][_0x465f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x553ce9,_0x1d4267,_0x5e26ea){return new BPromise(function(_0x523ca1,_0x41b261){return client[_0x465f('0x9')](_0x553ce9,_0x5e26ea)[_0x465f('0xa')](function(_0xc3d49d){logger[_0x465f('0xb')](_0x465f('0xc'),_0x1d4267,_0x465f('0xd'));logger[_0x465f('0xe')]('Campaign,\x20%s,\x20%s,\x20%s',_0x1d4267,_0x465f('0xd'),JSON[_0x465f('0xf')](_0xc3d49d));if(_0xc3d49d[_0x465f('0x10')]){if(_0xc3d49d[_0x465f('0x10')][_0x465f('0x11')]===0x1f4){logger[_0x465f('0x10')](_0x465f('0xc'),_0x1d4267,_0xc3d49d[_0x465f('0x10')][_0x465f('0x12')]);return _0x41b261(_0xc3d49d['error']['message']);}logger[_0x465f('0x10')](_0x465f('0xc'),_0x1d4267,_0xc3d49d[_0x465f('0x10')][_0x465f('0x12')]);return _0x523ca1(_0xc3d49d['error'][_0x465f('0x12')]);}else{logger[_0x465f('0xb')]('Campaign,\x20%s,\x20%s',_0x1d4267,'request\x20sent');_0x523ca1(_0xc3d49d[_0x465f('0x13')][_0x465f('0x12')]);}})[_0x465f('0x14')](function(_0xf38782){logger[_0x465f('0x10')]('Campaign,\x20%s,\x20%s',_0x1d4267,_0xf38782);_0x41b261(_0xf38782);});});}exports[_0x465f('0x15')]=function(_0x99845e){var _0x331e45=this;return new Promise(function(_0x5d469c,_0x119227){return db[_0x465f('0x16')]['findAll']({'raw':_0x99845e[_0x465f('0x17')]?_0x99845e['options'][_0x465f('0x18')]===undefined?!![]:![]:!![],'where':_0x99845e[_0x465f('0x17')]?_0x99845e[_0x465f('0x17')][_0x465f('0x19')]||null:null,'attributes':_0x99845e[_0x465f('0x17')]?_0x99845e[_0x465f('0x17')][_0x465f('0x1a')]||null:null,'limit':_0x99845e[_0x465f('0x17')]?_0x99845e[_0x465f('0x17')][_0x465f('0x1b')]||null:null,'include':_0x99845e[_0x465f('0x17')]?_0x99845e['options'][_0x465f('0x1c')]?_[_0x465f('0x1d')](_0x99845e[_0x465f('0x17')][_0x465f('0x1c')],function(_0x1d6677){return{'model':db[_0x1d6677[_0x465f('0x1e')]],'as':_0x1d6677['as'],'attributes':_0x1d6677[_0x465f('0x1a')],'include':_0x1d6677[_0x465f('0x1c')]?_[_0x465f('0x1d')](_0x1d6677[_0x465f('0x1c')],function(_0x59ace5){return{'model':db[_0x59ace5[_0x465f('0x1e')]],'as':_0x59ace5['as'],'attributes':_0x59ace5[_0x465f('0x1a')],'include':_0x59ace5['include']?_['map'](_0x59ace5[_0x465f('0x1c')],function(_0x3cd248){return{'model':db[_0x3cd248[_0x465f('0x1e')]],'as':_0x3cd248['as'],'attributes':_0x3cd248[_0x465f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x465f('0xa')](function(_0x191ada){logger[_0x465f('0xb')](_0x465f('0x15'),_0x99845e);logger[_0x465f('0xe')](_0x465f('0x15'),_0x99845e,JSON['stringify'](_0x191ada));_0x5d469c(_0x191ada);})[_0x465f('0x14')](function(_0x3ad80e){logger['error'](_0x465f('0x15'),_0x3ad80e['message'],_0x99845e);_0x119227(_0x331e45[_0x465f('0x10')](0x1f4,_0x3ad80e['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 365e4bf..d6a017d 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 _0x5156=['put','/:id','update','delete','destroy','removeLists','removeBlackLists','util','path','../../config/environment','./campaign.controller','get','isAuthenticated','show','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/lists','getLists','/:id/blacklists','create','post','clone','addLists','addBlackLists'];(function(_0x2a0a76,_0x465cd3){var _0x1cd3d6=function(_0x2ea610){while(--_0x2ea610){_0x2a0a76['push'](_0x2a0a76['shift']());}};_0x1cd3d6(++_0x465cd3);}(_0x5156,0xf1));var _0x6515=function(_0x54c9dd,_0x233a86){_0x54c9dd=_0x54c9dd-0x0;var _0x855156=_0x5156[_0x54c9dd];return _0x855156;};'use strict';var multer=require('multer');var util=require(_0x6515('0x0'));var path=require(_0x6515('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6515('0x2'));var controller=require(_0x6515('0x3'));router[_0x6515('0x4')]('/',auth[_0x6515('0x5')](),controller['index']);router[_0x6515('0x4')]('/:id',auth[_0x6515('0x5')](),controller[_0x6515('0x6')]);router['get']('/:id/hoppers',auth['isAuthenticated'](),controller[_0x6515('0x7')]);router[_0x6515('0x4')]('/:id/hopper_histories',auth[_0x6515('0x5')](),controller[_0x6515('0x8')]);router[_0x6515('0x4')](_0x6515('0x9'),auth[_0x6515('0x5')](),controller[_0x6515('0xa')]);router[_0x6515('0x4')]('/:id/hopper_black',auth['isAuthenticated'](),controller['getHopperBlacks']);router[_0x6515('0x4')](_0x6515('0xb'),auth[_0x6515('0x5')](),controller[_0x6515('0xc')]);router['get'](_0x6515('0xd'),auth['isAuthenticated'](),controller['getBlackLists']);router['post']('/',auth[_0x6515('0x5')](),controller[_0x6515('0xe')]);router[_0x6515('0xf')]('/:id/clone',auth['isAuthenticated'](),controller[_0x6515('0x10')]);router[_0x6515('0xf')](_0x6515('0xb'),auth[_0x6515('0x5')](),controller[_0x6515('0x11')]);router['post'](_0x6515('0xd'),auth[_0x6515('0x5')](),controller[_0x6515('0x12')]);router[_0x6515('0x13')](_0x6515('0x14'),auth[_0x6515('0x5')](),controller[_0x6515('0x15')]);router[_0x6515('0x16')](_0x6515('0x14'),auth[_0x6515('0x5')](),controller[_0x6515('0x17')]);router[_0x6515('0x16')](_0x6515('0xb'),auth[_0x6515('0x5')](),controller[_0x6515('0x18')]);router['delete'](_0x6515('0xd'),auth[_0x6515('0x5')](),controller[_0x6515('0x19')]);module['exports']=router; \ No newline at end of file +var _0xa98d=['addBlackLists','update','delete','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','index','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists'];(function(_0x2ece30,_0x32344a){var _0xe29a92=function(_0x14dd75){while(--_0x14dd75){_0x2ece30['push'](_0x2ece30['shift']());}};_0xe29a92(++_0x32344a);}(_0xa98d,0x171));var _0xda98=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa98d[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xda98('0x0'));var util=require(_0xda98('0x1'));var path=require(_0xda98('0x2'));var timeout=require(_0xda98('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xda98('0x4'));var auth=require(_0xda98('0x5'));var interaction=require(_0xda98('0x6'));var config=require('../../config/environment');var controller=require(_0xda98('0x7'));router[_0xda98('0x8')]('/',auth['isAuthenticated'](),controller[_0xda98('0x9')]);router[_0xda98('0x8')](_0xda98('0xa'),auth[_0xda98('0xb')](),controller[_0xda98('0xc')]);router['get'](_0xda98('0xd'),auth[_0xda98('0xb')](),controller[_0xda98('0xe')]);router['get'](_0xda98('0xf'),auth['isAuthenticated'](),controller[_0xda98('0x10')]);router[_0xda98('0x8')](_0xda98('0x11'),auth[_0xda98('0xb')](),controller['getHopperFinals']);router[_0xda98('0x8')](_0xda98('0x12'),auth[_0xda98('0xb')](),controller['getHopperBlacks']);router[_0xda98('0x8')](_0xda98('0x13'),auth[_0xda98('0xb')](),controller['getLists']);router[_0xda98('0x8')](_0xda98('0x14'),auth[_0xda98('0xb')](),controller[_0xda98('0x15')]);router[_0xda98('0x16')]('/',auth[_0xda98('0xb')](),controller[_0xda98('0x17')]);router[_0xda98('0x16')](_0xda98('0x18'),auth[_0xda98('0xb')](),controller[_0xda98('0x19')]);router[_0xda98('0x16')]('/:id/lists',auth[_0xda98('0xb')](),controller[_0xda98('0x1a')]);router[_0xda98('0x16')](_0xda98('0x14'),auth['isAuthenticated'](),controller[_0xda98('0x1b')]);router['put']('/:id',auth[_0xda98('0xb')](),controller[_0xda98('0x1c')]);router[_0xda98('0x1d')]('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xda98('0x13'),auth[_0xda98('0xb')](),controller[_0xda98('0x1e')]);router[_0xda98('0x1d')](_0xda98('0x14'),auth[_0xda98('0xb')](),controller[_0xda98('0x1f')]);module[_0xda98('0x20')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 4da711b..e6fa4d1 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 _0x214a=['VIRTUAL','getDataValue','key','sequelize','TEXT','medium','STRING'];(function(_0x254c4e,_0x50c941){var _0x327c37=function(_0x406fcb){while(--_0x406fcb){_0x254c4e['push'](_0x254c4e['shift']());}};_0x327c37(++_0x50c941);}(_0x214a,0xff));var _0xa214=function(_0x408755,_0x44dc8d){_0x408755=_0x408755-0x0;var _0x48baf4=_0x214a[_0x408755];return _0x48baf4;};'use strict';var Sequelize=require(_0xa214('0x0'));module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xa214('0x1')],'length':_0xa214('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xa214('0x3')]},'name':{'type':Sequelize[_0xa214('0x4')],'get':function(){return this[_0xa214('0x5')](_0xa214('0x6'));}}}; \ No newline at end of file +var _0x21f4=['TEXT','getDataValue','key','sequelize','STRING'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x21f4,0x148));var _0x421f=function(_0x3904e5,_0x2199f1){_0x3904e5=_0x3904e5-0x0;var _0x47f175=_0x21f4[_0x3904e5];return _0x47f175;};'use strict';var Sequelize=require(_0x421f('0x0'));module['exports']={'key':{'type':Sequelize[_0x421f('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x421f('0x2')],'length':'medium','allowNull':![]},'description':{'type':Sequelize[_0x421f('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x421f('0x3')](_0x421f('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 6523905..097f192 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 _0x084f=['jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','undefined','count','set','json','reject','save','then','destroy','get','CannedAnswers','UserProfileResource','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','update','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','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','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x44caf4,_0x238750){var _0x117cad=function(_0x3e64c8){while(--_0x3e64c8){_0x44caf4['push'](_0x44caf4['shift']());}};_0x117cad(++_0x238750);}(_0x084f,0x158));var _0xf084=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x084f[_0x484e36];return _0xafc85d;};'use strict';var emlformat=require(_0xf084('0x0'));var rimraf=require(_0xf084('0x1'));var zipdir=require(_0xf084('0x2'));var jsonpatch=require(_0xf084('0x3'));var rp=require(_0xf084('0x4'));var moment=require(_0xf084('0x5'));var BPromise=require(_0xf084('0x6'));var Mustache=require(_0xf084('0x7'));var util=require(_0xf084('0x8'));var path=require('path');var sox=require(_0xf084('0x9'));var csv=require(_0xf084('0xa'));var ejs=require(_0xf084('0xb'));var fs=require('fs');var fs_extra=require(_0xf084('0xc'));var _=require(_0xf084('0xd'));var squel=require(_0xf084('0xe'));var crypto=require(_0xf084('0xf'));var jsforce=require(_0xf084('0x10'));var deskjs=require(_0xf084('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf084('0x12'));var Redis=require(_0xf084('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xf084('0x14'));var as=require(_0xf084('0x15'));var hardwareService=require(_0xf084('0x16'));var logger=require(_0xf084('0x17'))(_0xf084('0x18'));var utils=require(_0xf084('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xf084('0x1a'));var db=require(_0xf084('0x1b'))['db'];function respondWithStatusCode(_0x11b1fc,_0x5e5e8e){_0x5e5e8e=_0x5e5e8e||0xcc;return function(_0x2f8db0){if(_0x2f8db0){return _0x11b1fc['sendStatus'](_0x5e5e8e);}return _0x11b1fc[_0xf084('0x1c')](_0x5e5e8e)[_0xf084('0x1d')]();};}function respondWithResult(_0x4d7148,_0x4597f0){_0x4597f0=_0x4597f0||0xc8;return function(_0x4f7b2d){if(_0x4f7b2d){return _0x4d7148[_0xf084('0x1c')](_0x4597f0)['json'](_0x4f7b2d);}};}function respondWithFilteredResult(_0x5a227f,_0x5bc27b){return function(_0x42706e){if(_0x42706e){var _0x21143f=typeof _0x5bc27b['offset']===_0xf084('0x1e')&&typeof _0x5bc27b['limit']==='undefined';var _0x5f2cd6=_0x42706e['count'];var _0x65e268=_0x21143f?0x0:_0x5bc27b['offset'];var _0x15180a=_0x21143f?_0x42706e[_0xf084('0x1f')]:_0x5bc27b['offset']+_0x5bc27b['limit'];var _0x2cff16;if(_0x15180a>=_0x5f2cd6){_0x15180a=_0x5f2cd6;_0x2cff16=0xc8;}else{_0x2cff16=0xce;}_0x5a227f[_0xf084('0x1c')](_0x2cff16);return _0x5a227f[_0xf084('0x20')]('Content-Range',_0x65e268+'-'+_0x15180a+'/'+_0x5f2cd6)[_0xf084('0x21')](_0x42706e);}return null;};}function patchUpdates(_0x7415b5){return function(_0x161713){try{jsonpatch['apply'](_0x161713,_0x7415b5,!![]);}catch(_0xfa6df0){return BPromise[_0xf084('0x22')](_0xfa6df0);}return _0x161713[_0xf084('0x23')]();};}function saveUpdates(_0x39b57e,_0x591fa8){return function(_0x49ad1a){if(_0x49ad1a){return _0x49ad1a['update'](_0x39b57e)[_0xf084('0x24')](function(_0x39efd9){return _0x39efd9;});}return null;};}function removeEntity(_0x164872,_0x45b9e9){return function(_0x1ef2dc){if(_0x1ef2dc){return _0x1ef2dc[_0xf084('0x25')]()[_0xf084('0x24')](function(){var _0x395068=_0x1ef2dc[_0xf084('0x26')]({'plain':!![]});var _0xe6d8bc=_0xf084('0x27');return db[_0xf084('0x28')]['destroy']({'where':{'type':_0xe6d8bc,'resourceId':_0x395068['id']}})[_0xf084('0x24')](function(){return _0x1ef2dc;});})['then'](function(){_0x164872['status'](0xcc)[_0xf084('0x1d')]();});}};}function handleEntityNotFound(_0x4fdd33,_0x3e6a68){return function(_0x2d5a44){if(!_0x2d5a44){_0x4fdd33['sendStatus'](0x194);}return _0x2d5a44;};}function handleError(_0x3ff3a3,_0xc9ae19){_0xc9ae19=_0xc9ae19||0x1f4;return function(_0xef56b2){logger['error'](_0xef56b2[_0xf084('0x29')]);if(_0xef56b2[_0xf084('0x2a')]){delete _0xef56b2['name'];}_0x3ff3a3[_0xf084('0x1c')](_0xc9ae19)[_0xf084('0x2b')](_0xef56b2);};}exports[_0xf084('0x2c')]=function(_0x42d1c5,_0x39209c){var _0x5f2acd={},_0x30885c={},_0x395331={'count':0x0,'rows':[]};var _0x2da5d9=_[_0xf084('0x2d')](db[_0xf084('0x2e')][_0xf084('0x2f')],function(_0x51501f){return{'name':_0x51501f[_0xf084('0x30')],'type':_0x51501f[_0xf084('0x31')][_0xf084('0x32')]};});_0x30885c[_0xf084('0x33')]=_[_0xf084('0x2d')](_0x2da5d9,_0xf084('0x2a'));_0x30885c[_0xf084('0x34')]=_['keys'](_0x42d1c5['query']);_0x30885c[_0xf084('0x35')]=_['intersection'](_0x30885c[_0xf084('0x33')],_0x30885c[_0xf084('0x34')]);_0x5f2acd[_0xf084('0x36')]=_[_0xf084('0x37')](_0x30885c[_0xf084('0x33')],qs[_0xf084('0x38')](_0x42d1c5[_0xf084('0x34')]['fields']));_0x5f2acd[_0xf084('0x36')]=_0x5f2acd['attributes']['length']?_0x5f2acd[_0xf084('0x36')]:_0x30885c[_0xf084('0x33')];if(!_0x42d1c5[_0xf084('0x34')][_0xf084('0x39')](_0xf084('0x3a'))){_0x5f2acd[_0xf084('0x3b')]=qs[_0xf084('0x3b')](_0x42d1c5['query'][_0xf084('0x3b')]);_0x5f2acd[_0xf084('0x3c')]=qs[_0xf084('0x3c')](_0x42d1c5[_0xf084('0x34')][_0xf084('0x3c')]);}_0x5f2acd[_0xf084('0x3d')]=qs[_0xf084('0x3e')](_0x42d1c5[_0xf084('0x34')][_0xf084('0x3e')]);_0x5f2acd[_0xf084('0x3f')]=qs[_0xf084('0x35')](_[_0xf084('0x40')](_0x42d1c5['query'],_0x30885c[_0xf084('0x35')]),_0x2da5d9);if(_0x42d1c5['query'][_0xf084('0x41')]){_0x5f2acd[_0xf084('0x3f')]=_[_0xf084('0x42')](_0x5f2acd[_0xf084('0x3f')],{'$or':[{'key':{'$like':'%'+_0x42d1c5[_0xf084('0x34')][_0xf084('0x41')]+'%'}},{'value':{'$like':'%'+_0x42d1c5[_0xf084('0x34')][_0xf084('0x41')]+'%'}}]});}_0x5f2acd=_['merge']({},_0x5f2acd,_0x42d1c5[_0xf084('0x43')]);var _0x2508da={'where':_0x5f2acd[_0xf084('0x3f')]};return db[_0xf084('0x2e')][_0xf084('0x1f')](_0x2508da)[_0xf084('0x24')](function(_0x2a3bf8){_0x395331[_0xf084('0x1f')]=_0x2a3bf8;if(_0x42d1c5['query'][_0xf084('0x44')]){_0x5f2acd[_0xf084('0x45')]=[{'all':!![]}];}return db[_0xf084('0x2e')][_0xf084('0x46')](_0x5f2acd);})[_0xf084('0x24')](function(_0x2e7c7f){_0x395331['rows']=_0x2e7c7f;return _0x395331;})[_0xf084('0x24')](respondWithFilteredResult(_0x39209c,_0x5f2acd))[_0xf084('0x47')](handleError(_0x39209c,null));};exports[_0xf084('0x48')]=function(_0x316c06,_0x223e8d){var _0x3e0590={'raw':!![],'where':{'id':_0x316c06[_0xf084('0x49')]['id']}},_0x3eafa4={};_0x3eafa4[_0xf084('0x33')]=_[_0xf084('0x4a')](db[_0xf084('0x2e')][_0xf084('0x2f')]);_0x3eafa4[_0xf084('0x34')]=_['keys'](_0x316c06[_0xf084('0x34')]);_0x3eafa4['filters']=_['intersection'](_0x3eafa4[_0xf084('0x33')],_0x3eafa4[_0xf084('0x34')]);_0x3e0590[_0xf084('0x36')]=_['intersection'](_0x3eafa4[_0xf084('0x33')],qs['fields'](_0x316c06[_0xf084('0x34')][_0xf084('0x38')]));_0x3e0590[_0xf084('0x36')]=_0x3e0590['attributes']['length']?_0x3e0590[_0xf084('0x36')]:_0x3eafa4['model'];if(_0x316c06[_0xf084('0x34')][_0xf084('0x44')]){_0x3e0590[_0xf084('0x45')]=[{'all':!![]}];}_0x3e0590=_['merge']({},_0x3e0590,_0x316c06[_0xf084('0x43')]);return db[_0xf084('0x2e')]['find'](_0x3e0590)[_0xf084('0x24')](handleEntityNotFound(_0x223e8d,null))[_0xf084('0x24')](respondWithResult(_0x223e8d,null))[_0xf084('0x47')](handleError(_0x223e8d,null));};exports[_0xf084('0x4b')]=function(_0x5c6109,_0x4e82c9){if(_0x5c6109[_0xf084('0x4c')]['id']){delete _0x5c6109[_0xf084('0x4c')]['id'];}return db[_0xf084('0x2e')][_0xf084('0x4d')]({'where':{'id':_0x5c6109['params']['id']}})[_0xf084('0x24')](handleEntityNotFound(_0x4e82c9,null))[_0xf084('0x24')](saveUpdates(_0x5c6109[_0xf084('0x4c')],null))['then'](respondWithResult(_0x4e82c9,null))[_0xf084('0x47')](handleError(_0x4e82c9,null));};exports[_0xf084('0x25')]=function(_0x100282,_0x1a177e){return db[_0xf084('0x2e')][_0xf084('0x4d')]({'where':{'id':_0x100282['params']['id']}})['then'](handleEntityNotFound(_0x1a177e,null))[_0xf084('0x24')](removeEntity(_0x1a177e,null))[_0xf084('0x47')](handleError(_0x1a177e,null));};exports[_0xf084('0x4e')]=function(_0x292904,_0x5716ed){var _0x5001ca={'key':_0x292904[_0xf084('0x4c')]['key']};if(_0x292904[_0xf084('0x4c')][_0xf084('0x4f')]){_0x5001ca[_0xf084('0x4f')]=_0x292904['body'][_0xf084('0x4f')];}else if(_0x292904['body'][_0xf084('0x50')]){_0x5001ca[_0xf084('0x50')]=_0x292904[_0xf084('0x4c')][_0xf084('0x50')];}else if(_0x292904['body'][_0xf084('0x51')]){_0x5001ca[_0xf084('0x51')]=_0x292904[_0xf084('0x4c')][_0xf084('0x51')];}else if(_0x292904['body'][_0xf084('0x52')]){_0x5001ca[_0xf084('0x52')]=_0x292904[_0xf084('0x4c')][_0xf084('0x52')];}return db[_0xf084('0x2e')][_0xf084('0x4d')]({'where':_0x5001ca})['then'](function(_0x3e259a){if(_0x3e259a){throw new db[(_0xf084('0x53'))]['ValidationError']('The\x20inserted\x20key\x20already\x20exists.');}return db[_0xf084('0x2e')]['create'](_0x292904[_0xf084('0x4c')]);})[_0xf084('0x24')](function(_0x429a4b){var _0x5135e0=_0x292904[_0xf084('0x54')][_0xf084('0x26')]({'plain':!![]});if(!_0x5135e0)throw new Error(_0xf084('0x55'));if(_0x5135e0['role']==='user'){var _0x16d30d=_0x429a4b[_0xf084('0x26')]({'plain':!![]});return db['UserProfileSection'][_0xf084('0x4d')]({'where':{'name':'CannedAnswers','userProfileId':_0x5135e0[_0xf084('0x56')]},'raw':!![]})[_0xf084('0x24')](function(_0xa26e6e){if(_0xa26e6e&&_0xa26e6e[_0xf084('0x57')]===0x0){return db[_0xf084('0x28')]['create']({'name':_0x16d30d[_0xf084('0x2a')],'resourceId':_0x16d30d['id'],'type':_0xa26e6e[_0xf084('0x2a')],'sectionId':_0xa26e6e['id']},{})[_0xf084('0x24')](function(){return _0x429a4b;});}else{return _0x429a4b;}})['catch'](function(_0x59c51e){logger[_0xf084('0x58')](_0xf084('0x59'),_0x59c51e);throw _0x59c51e;});}return _0x429a4b;})[_0xf084('0x24')](respondWithResult(_0x5716ed,0xc9))[_0xf084('0x47')](handleError(_0x5716ed,null));}; \ No newline at end of file +var _0x9ff9=['Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','then','destroy','get','CannedAnswers','UserProfileResource','end','error','stack','name','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','keys','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','options','includeAll','include','findAll','rows','catch','show','params','intersection','merge','find','update','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x9ff9,0x1cc));var _0x99ff=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x9ff9[_0x4fc9e6];return _0x551d28;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x99ff('0x0'));var zipdir=require(_0x99ff('0x1'));var jsonpatch=require(_0x99ff('0x2'));var rp=require(_0x99ff('0x3'));var moment=require(_0x99ff('0x4'));var BPromise=require(_0x99ff('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x99ff('0x6'));var sox=require(_0x99ff('0x7'));var csv=require(_0x99ff('0x8'));var ejs=require(_0x99ff('0x9'));var fs=require('fs');var fs_extra=require(_0x99ff('0xa'));var _=require('lodash');var squel=require(_0x99ff('0xb'));var crypto=require(_0x99ff('0xc'));var jsforce=require(_0x99ff('0xd'));var deskjs=require(_0x99ff('0xe'));var toCsv=require(_0x99ff('0x8'));var querystring=require(_0x99ff('0xf'));var Papa=require(_0x99ff('0x10'));var Redis=require('ioredis');var authService=require(_0x99ff('0x11'));var qs=require(_0x99ff('0x12'));var as=require(_0x99ff('0x13'));var hardwareService=require(_0x99ff('0x14'));var logger=require(_0x99ff('0x15'))(_0x99ff('0x16'));var utils=require(_0x99ff('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x99ff('0x18'))['db'];function respondWithStatusCode(_0x32469d,_0x5294ad){_0x5294ad=_0x5294ad||0xcc;return function(_0x1c4ceb){if(_0x1c4ceb){return _0x32469d[_0x99ff('0x19')](_0x5294ad);}return _0x32469d[_0x99ff('0x1a')](_0x5294ad)['end']();};}function respondWithResult(_0x42f596,_0x59e9ac){_0x59e9ac=_0x59e9ac||0xc8;return function(_0x4c6724){if(_0x4c6724){return _0x42f596['status'](_0x59e9ac)[_0x99ff('0x1b')](_0x4c6724);}};}function respondWithFilteredResult(_0x4d5302,_0x27ba9f){return function(_0x12c277){if(_0x12c277){var _0x6b4d9c=typeof _0x27ba9f[_0x99ff('0x1c')]===_0x99ff('0x1d')&&typeof _0x27ba9f[_0x99ff('0x1e')]===_0x99ff('0x1d');var _0x3f4afa=_0x12c277[_0x99ff('0x1f')];var _0x20548f=_0x6b4d9c?0x0:_0x27ba9f['offset'];var _0x1b500b=_0x6b4d9c?_0x12c277[_0x99ff('0x1f')]:_0x27ba9f[_0x99ff('0x1c')]+_0x27ba9f[_0x99ff('0x1e')];var _0x48d91f;if(_0x1b500b>=_0x3f4afa){_0x1b500b=_0x3f4afa;_0x48d91f=0xc8;}else{_0x48d91f=0xce;}_0x4d5302['status'](_0x48d91f);return _0x4d5302['set'](_0x99ff('0x20'),_0x20548f+'-'+_0x1b500b+'/'+_0x3f4afa)[_0x99ff('0x1b')](_0x12c277);}return null;};}function patchUpdates(_0x4aeb06){return function(_0x25066a){try{jsonpatch['apply'](_0x25066a,_0x4aeb06,!![]);}catch(_0x38fcb4){return BPromise[_0x99ff('0x21')](_0x38fcb4);}return _0x25066a['save']();};}function saveUpdates(_0x3dd662,_0x4ab7d0){return function(_0x4bc276){if(_0x4bc276){return _0x4bc276['update'](_0x3dd662)[_0x99ff('0x22')](function(_0x533c26){return _0x533c26;});}return null;};}function removeEntity(_0x56ed97,_0x54fe72){return function(_0x1ea5c9){if(_0x1ea5c9){return _0x1ea5c9[_0x99ff('0x23')]()['then'](function(){var _0x114f5d=_0x1ea5c9[_0x99ff('0x24')]({'plain':!![]});var _0x541162=_0x99ff('0x25');return db[_0x99ff('0x26')][_0x99ff('0x23')]({'where':{'type':_0x541162,'resourceId':_0x114f5d['id']}})[_0x99ff('0x22')](function(){return _0x1ea5c9;});})[_0x99ff('0x22')](function(){_0x56ed97['status'](0xcc)[_0x99ff('0x27')]();});}};}function handleEntityNotFound(_0x5b0963,_0x6cf44b){return function(_0x147d5e){if(!_0x147d5e){_0x5b0963[_0x99ff('0x19')](0x194);}return _0x147d5e;};}function handleError(_0x419710,_0x4e6e4d){_0x4e6e4d=_0x4e6e4d||0x1f4;return function(_0x453c7b){logger[_0x99ff('0x28')](_0x453c7b[_0x99ff('0x29')]);if(_0x453c7b[_0x99ff('0x2a')]){delete _0x453c7b[_0x99ff('0x2a')];}_0x419710[_0x99ff('0x1a')](_0x4e6e4d)['send'](_0x453c7b);};}exports[_0x99ff('0x2b')]=function(_0x2ba7cb,_0x2869bd){var _0x1b95c3={},_0x22c368={},_0x25478a={'count':0x0,'rows':[]};var _0x18e19a=_[_0x99ff('0x2c')](db[_0x99ff('0x2d')][_0x99ff('0x2e')],function(_0x9a298c){return{'name':_0x9a298c[_0x99ff('0x2f')],'type':_0x9a298c[_0x99ff('0x30')][_0x99ff('0x31')]};});_0x22c368[_0x99ff('0x32')]=_['map'](_0x18e19a,'name');_0x22c368['query']=_[_0x99ff('0x33')](_0x2ba7cb['query']);_0x22c368['filters']=_['intersection'](_0x22c368[_0x99ff('0x32')],_0x22c368[_0x99ff('0x34')]);_0x1b95c3['attributes']=_['intersection'](_0x22c368[_0x99ff('0x32')],qs[_0x99ff('0x35')](_0x2ba7cb[_0x99ff('0x34')][_0x99ff('0x35')]));_0x1b95c3[_0x99ff('0x36')]=_0x1b95c3[_0x99ff('0x36')]['length']?_0x1b95c3['attributes']:_0x22c368[_0x99ff('0x32')];if(!_0x2ba7cb[_0x99ff('0x34')][_0x99ff('0x37')](_0x99ff('0x38'))){_0x1b95c3['limit']=qs[_0x99ff('0x1e')](_0x2ba7cb['query'][_0x99ff('0x1e')]);_0x1b95c3['offset']=qs[_0x99ff('0x1c')](_0x2ba7cb[_0x99ff('0x34')]['offset']);}_0x1b95c3[_0x99ff('0x39')]=qs['sort'](_0x2ba7cb['query'][_0x99ff('0x3a')]);_0x1b95c3[_0x99ff('0x3b')]=qs['filters'](_[_0x99ff('0x3c')](_0x2ba7cb[_0x99ff('0x34')],_0x22c368[_0x99ff('0x3d')]),_0x18e19a);if(_0x2ba7cb['query'][_0x99ff('0x3e')]){_0x1b95c3[_0x99ff('0x3b')]=_['merge'](_0x1b95c3[_0x99ff('0x3b')],{'$or':[{'key':{'$like':'%'+_0x2ba7cb['query'][_0x99ff('0x3e')]+'%'}},{'value':{'$like':'%'+_0x2ba7cb[_0x99ff('0x34')][_0x99ff('0x3e')]+'%'}}]});}_0x1b95c3=_['merge']({},_0x1b95c3,_0x2ba7cb[_0x99ff('0x3f')]);var _0x3dc211={'where':_0x1b95c3[_0x99ff('0x3b')]};return db[_0x99ff('0x2d')][_0x99ff('0x1f')](_0x3dc211)['then'](function(_0x2cec03){_0x25478a[_0x99ff('0x1f')]=_0x2cec03;if(_0x2ba7cb['query'][_0x99ff('0x40')]){_0x1b95c3[_0x99ff('0x41')]=[{'all':!![]}];}return db['CannedAnswer'][_0x99ff('0x42')](_0x1b95c3);})[_0x99ff('0x22')](function(_0x42a3c5){_0x25478a[_0x99ff('0x43')]=_0x42a3c5;return _0x25478a;})[_0x99ff('0x22')](respondWithFilteredResult(_0x2869bd,_0x1b95c3))[_0x99ff('0x44')](handleError(_0x2869bd,null));};exports[_0x99ff('0x45')]=function(_0x3a1e99,_0x3cabdc){var _0x3329ea={'raw':!![],'where':{'id':_0x3a1e99[_0x99ff('0x46')]['id']}},_0x2ff833={};_0x2ff833[_0x99ff('0x32')]=_[_0x99ff('0x33')](db[_0x99ff('0x2d')]['rawAttributes']);_0x2ff833[_0x99ff('0x34')]=_[_0x99ff('0x33')](_0x3a1e99[_0x99ff('0x34')]);_0x2ff833[_0x99ff('0x3d')]=_['intersection'](_0x2ff833['model'],_0x2ff833[_0x99ff('0x34')]);_0x3329ea[_0x99ff('0x36')]=_[_0x99ff('0x47')](_0x2ff833['model'],qs[_0x99ff('0x35')](_0x3a1e99[_0x99ff('0x34')][_0x99ff('0x35')]));_0x3329ea['attributes']=_0x3329ea[_0x99ff('0x36')]['length']?_0x3329ea[_0x99ff('0x36')]:_0x2ff833[_0x99ff('0x32')];if(_0x3a1e99[_0x99ff('0x34')][_0x99ff('0x40')]){_0x3329ea[_0x99ff('0x41')]=[{'all':!![]}];}_0x3329ea=_[_0x99ff('0x48')]({},_0x3329ea,_0x3a1e99[_0x99ff('0x3f')]);return db['CannedAnswer'][_0x99ff('0x49')](_0x3329ea)[_0x99ff('0x22')](handleEntityNotFound(_0x3cabdc,null))['then'](respondWithResult(_0x3cabdc,null))['catch'](handleError(_0x3cabdc,null));};exports[_0x99ff('0x4a')]=function(_0x1ba00b,_0xa59f01){if(_0x1ba00b['body']['id']){delete _0x1ba00b[_0x99ff('0x4b')]['id'];}return db[_0x99ff('0x2d')]['find']({'where':{'id':_0x1ba00b[_0x99ff('0x46')]['id']}})[_0x99ff('0x22')](handleEntityNotFound(_0xa59f01,null))['then'](saveUpdates(_0x1ba00b[_0x99ff('0x4b')],null))[_0x99ff('0x22')](respondWithResult(_0xa59f01,null))[_0x99ff('0x44')](handleError(_0xa59f01,null));};exports[_0x99ff('0x23')]=function(_0x53e23c,_0x84ea3e){return db[_0x99ff('0x2d')][_0x99ff('0x49')]({'where':{'id':_0x53e23c['params']['id']}})[_0x99ff('0x22')](handleEntityNotFound(_0x84ea3e,null))['then'](removeEntity(_0x84ea3e,null))[_0x99ff('0x44')](handleError(_0x84ea3e,null));};exports['create']=function(_0x5a581,_0x154b69){var _0x14f23a={'key':_0x5a581[_0x99ff('0x4b')]['key']};if(_0x5a581[_0x99ff('0x4b')][_0x99ff('0x4c')]){_0x14f23a['MailAccountId']=_0x5a581['body'][_0x99ff('0x4c')];}else if(_0x5a581[_0x99ff('0x4b')]['SmsAccountId']){_0x14f23a[_0x99ff('0x4d')]=_0x5a581[_0x99ff('0x4b')]['SmsAccountId'];}else if(_0x5a581[_0x99ff('0x4b')][_0x99ff('0x4e')]){_0x14f23a[_0x99ff('0x4e')]=_0x5a581['body']['OpenchannelAccountId'];}else if(_0x5a581[_0x99ff('0x4b')]['ChatWebsiteId']){_0x14f23a[_0x99ff('0x4f')]=_0x5a581[_0x99ff('0x4b')]['ChatWebsiteId'];}return db['CannedAnswer'][_0x99ff('0x49')]({'where':_0x14f23a})[_0x99ff('0x22')](function(_0x370ea5){if(_0x370ea5){throw new db[(_0x99ff('0x50'))][(_0x99ff('0x51'))](_0x99ff('0x52'));}return db[_0x99ff('0x2d')][_0x99ff('0x53')](_0x5a581[_0x99ff('0x4b')]);})[_0x99ff('0x22')](function(_0x89e4ee){var _0x312342=_0x5a581[_0x99ff('0x54')][_0x99ff('0x24')]({'plain':!![]});if(!_0x312342)throw new Error(_0x99ff('0x55'));if(_0x312342[_0x99ff('0x56')]===_0x99ff('0x54')){var _0x71fabe=_0x89e4ee[_0x99ff('0x24')]({'plain':!![]});return db[_0x99ff('0x57')]['find']({'where':{'name':_0x99ff('0x25'),'userProfileId':_0x312342['userProfileId']},'raw':!![]})[_0x99ff('0x22')](function(_0x2c2781){if(_0x2c2781&&_0x2c2781[_0x99ff('0x58')]===0x0){return db['UserProfileResource'][_0x99ff('0x53')]({'name':_0x71fabe[_0x99ff('0x2a')],'resourceId':_0x71fabe['id'],'type':_0x2c2781['name'],'sectionId':_0x2c2781['id']},{})[_0x99ff('0x22')](function(){return _0x89e4ee;});}else{return _0x89e4ee;}})[_0x99ff('0x44')](function(_0x32616e){logger['error'](_0x99ff('0x59'),_0x32616e);throw _0x32616e;});}return _0x89e4ee;})[_0x99ff('0x22')](respondWithResult(_0x154b69,0xc9))[_0x99ff('0x44')](handleError(_0x154b69,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 4d61ddc..79c93d9 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 _0x17f8=['rimraf','../../config/environment','exports','define','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise'];(function(_0x4802ca,_0x433d6b){var _0x372e8c=function(_0x261d69){while(--_0x261d69){_0x4802ca['push'](_0x4802ca['shift']());}};_0x372e8c(++_0x433d6b);}(_0x17f8,0x11b));var _0x817f=function(_0xd81295,_0x326a39){_0xd81295=_0xd81295-0x0;var _0x5db80e=_0x17f8[_0xd81295];return _0x5db80e;};'use strict';var _=require('lodash');var util=require(_0x817f('0x0'));var logger=require(_0x817f('0x1'))(_0x817f('0x2'));var moment=require(_0x817f('0x3'));var BPromise=require('bluebird');var rp=require(_0x817f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x817f('0x5'));var config=require(_0x817f('0x6'));var attributes=require('./cannedAnswer.attributes');module[_0x817f('0x7')]=function(_0x4e29a1,_0x5e52c4){return _0x4e29a1[_0x817f('0x8')](_0x817f('0x9'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x817f('0xa'),'collate':_0x817f('0xb')});}; \ No newline at end of file +var _0x5b00=['util','bluebird','request-promise','path','../../config/environment','exports','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x3f4120,_0x28de12){var _0x2ccfa8=function(_0xcbaceb){while(--_0xcbaceb){_0x3f4120['push'](_0x3f4120['shift']());}};_0x2ccfa8(++_0x28de12);}(_0x5b00,0x1e3));var _0x05b0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5b00[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x05b0('0x0'));var util=require(_0x05b0('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x05b0('0x2'));var rp=require(_0x05b0('0x3'));var fs=require('fs');var path=require(_0x05b0('0x4'));var rimraf=require('rimraf');var config=require(_0x05b0('0x5'));var attributes=require('./cannedAnswer.attributes');module[_0x05b0('0x6')]=function(_0xb1f7f,_0x374d44){return _0xb1f7f['define'](_0x05b0('0x7'),attributes,{'tableName':_0x05b0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x05b0('0x9'),'collate':_0x05b0('0xa')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 9267750..215241a 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(_0xb42993,_0x3c222f){var _0x40f778=function(_0x4dd745){while(--_0x4dd745){_0xb42993['push'](_0xb42993['shift']());}};_0x40f778(++_0x3c222f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +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(_0x5a4162,_0x37934b){var _0x179903=function(_0x1c0d36){while(--_0x1c0d36){_0x5a4162['push'](_0x5a4162['shift']());}};_0x179903(++_0x37934b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 3dd698e..5348f8f 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 _0x1128=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','/:id','isAuthenticated','create','put','update','delete','exports','multer','util','path','connect-timeout','Router'];(function(_0x543670,_0x4d26b5){var _0x1e1c2d=function(_0x1dc07c){while(--_0x1dc07c){_0x543670['push'](_0x543670['shift']());}};_0x1e1c2d(++_0x4d26b5);}(_0x1128,0x151));var _0x8112=function(_0x479131,_0x2828f4){_0x479131=_0x479131-0x0;var _0x28e996=_0x1128[_0x479131];return _0x28e996;};'use strict';var multer=require(_0x8112('0x0'));var util=require(_0x8112('0x1'));var path=require(_0x8112('0x2'));var timeout=require(_0x8112('0x3'));var express=require('express');var router=express[_0x8112('0x4')]();var fs_extra=require(_0x8112('0x5'));var auth=require(_0x8112('0x6'));var interaction=require(_0x8112('0x7'));var config=require(_0x8112('0x8'));var controller=require(_0x8112('0x9'));router[_0x8112('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8112('0xa')](_0x8112('0xb'),auth[_0x8112('0xc')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x8112('0xd')]);router[_0x8112('0xe')](_0x8112('0xb'),auth[_0x8112('0xc')](),controller[_0x8112('0xf')]);router[_0x8112('0x10')](_0x8112('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x8112('0x11')]=router; \ No newline at end of file +var _0xb12c=['delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','/:id','isAuthenticated','show','create','update'];(function(_0x1e2588,_0x429ba9){var _0x116573=function(_0x14667c){while(--_0x14667c){_0x1e2588['push'](_0x1e2588['shift']());}};_0x116573(++_0x429ba9);}(_0xb12c,0x1f2));var _0xcb12=function(_0x2cf2a7,_0x2a7a00){_0x2cf2a7=_0x2cf2a7-0x0;var _0x5c779f=_0xb12c[_0x2cf2a7];return _0x5c779f;};'use strict';var multer=require(_0xcb12('0x0'));var util=require(_0xcb12('0x1'));var path=require('path');var timeout=require(_0xcb12('0x2'));var express=require(_0xcb12('0x3'));var router=express['Router']();var fs_extra=require(_0xcb12('0x4'));var auth=require(_0xcb12('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcb12('0x6'));var controller=require(_0xcb12('0x7'));router[_0xcb12('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcb12('0x8')](_0xcb12('0x9'),auth[_0xcb12('0xa')](),controller[_0xcb12('0xb')]);router['post']('/',auth[_0xcb12('0xa')](),controller[_0xcb12('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xcb12('0xd')]);router[_0xcb12('0xe')]('/:id',auth[_0xcb12('0xa')](),controller['destroy']);module[_0xcb12('0xf')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 18e6fe6..5ee8a85 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 _0xc73e=['exports','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x3c7880,_0x432f25){var _0x479b3b=function(_0x5385c3){while(--_0x5385c3){_0x3c7880['push'](_0x3c7880['shift']());}};_0x479b3b(++_0x432f25);}(_0xc73e,0x1e9));var _0xec73=function(_0x4adc0e,_0x5b2c31){_0x4adc0e=_0x4adc0e-0x0;var _0x4fbb5f=_0xc73e[_0x4adc0e];return _0x4fbb5f;};'use strict';var Sequelize=require(_0xec73('0x0'));module[_0xec73('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xec73('0x2')},'clid':{'type':Sequelize[_0xec73('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xec73('0x3')]},'dstchannel':{'type':Sequelize[_0xec73('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xec73('0x3')]},'duration':{'type':Sequelize[_0xec73('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xec73('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xec73('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xec73('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xec73('0x3')]},'linkedid':{'type':Sequelize[_0xec73('0x3')]},'sequence':{'type':Sequelize[_0xec73('0x3')]},'peeraccount':{'type':Sequelize[_0xec73('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x220b=['1970-01-01\x2000:00:01','STRING','INTEGER','exports','DATE'];(function(_0x9bb134,_0x41a445){var _0x1c3f8d=function(_0x256c45){while(--_0x256c45){_0x9bb134['push'](_0x9bb134['shift']());}};_0x1c3f8d(++_0x41a445);}(_0x220b,0x1a2));var _0xb220=function(_0x1f8053,_0x111077){_0x1f8053=_0x1f8053-0x0;var _0x174fd8=_0x220b[_0x1f8053];return _0x174fd8;};'use strict';var Sequelize=require('sequelize');module[_0xb220('0x0')]={'calldate':{'type':Sequelize[_0xb220('0x1')],'allowNull':![],'defaultValue':_0xb220('0x2')},'clid':{'type':Sequelize[_0xb220('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xb220('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb220('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0xb220('0x3')]},'lastdata':{'type':Sequelize[_0xb220('0x3')]},'duration':{'type':Sequelize[_0xb220('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xb220('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xb220('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xb220('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xb220('0x3')]},'linkedid':{'type':Sequelize[_0xb220('0x3')]},'sequence':{'type':Sequelize[_0xb220('0x3')]},'peeraccount':{'type':Sequelize[_0xb220('0x3')]},'type':{'type':Sequelize[_0xb220('0x3')]},'tag':{'type':Sequelize[_0xb220('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 9411c87..5d3936a 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 _0x723e=['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/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','end','sendStatus','error','name','send','index','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','Cdr','findAll','params','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch'];(function(_0x1ba9a4,_0x51aa43){var _0x28cb3b=function(_0x38e74a){while(--_0x38e74a){_0x1ba9a4['push'](_0x1ba9a4['shift']());}};_0x28cb3b(++_0x51aa43);}(_0x723e,0x179));var _0xe723=function(_0x362278,_0x4b766e){_0x362278=_0x362278-0x0;var _0xafd897=_0x723e[_0x362278];return _0xafd897;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe723('0x0'));var zipdir=require(_0xe723('0x1'));var jsonpatch=require(_0xe723('0x2'));var rp=require(_0xe723('0x3'));var moment=require(_0xe723('0x4'));var BPromise=require(_0xe723('0x5'));var Mustache=require(_0xe723('0x6'));var util=require(_0xe723('0x7'));var path=require(_0xe723('0x8'));var sox=require(_0xe723('0x9'));var csv=require('to-csv');var ejs=require(_0xe723('0xa'));var fs=require('fs');var fs_extra=require(_0xe723('0xb'));var _=require(_0xe723('0xc'));var squel=require(_0xe723('0xd'));var crypto=require(_0xe723('0xe'));var jsforce=require(_0xe723('0xf'));var deskjs=require(_0xe723('0x10'));var toCsv=require(_0xe723('0x11'));var querystring=require('querystring');var Papa=require(_0xe723('0x12'));var Redis=require(_0xe723('0x13'));var authService=require(_0xe723('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe723('0x15'));var hardwareService=require(_0xe723('0x16'));var logger=require(_0xe723('0x17'))('api');var utils=require(_0xe723('0x18'));var config=require(_0xe723('0x19'));var licenseUtil=require(_0xe723('0x1a'));var db=require(_0xe723('0x1b'))['db'];function respondWithStatusCode(_0x236b69,_0x5c066c){_0x5c066c=_0x5c066c||0xcc;return function(_0x29a1e){if(_0x29a1e){return _0x236b69['sendStatus'](_0x5c066c);}return _0x236b69['status'](_0x5c066c)['end']();};}function respondWithResult(_0x57bc0e,_0x75c12c){_0x75c12c=_0x75c12c||0xc8;return function(_0x30b2ba){if(_0x30b2ba){return _0x57bc0e[_0xe723('0x1c')](_0x75c12c)[_0xe723('0x1d')](_0x30b2ba);}};}function respondWithFilteredResult(_0xf29a39,_0x5aec97){return function(_0x23d0b2){if(_0x23d0b2){var _0xbf5ca3=typeof _0x5aec97[_0xe723('0x1e')]===_0xe723('0x1f')&&typeof _0x5aec97[_0xe723('0x20')]===_0xe723('0x1f');var _0x2cd7ca=_0x23d0b2[_0xe723('0x21')];var _0x17e2c1=_0xbf5ca3?0x0:_0x5aec97[_0xe723('0x1e')];var _0x2057d7=_0xbf5ca3?_0x23d0b2[_0xe723('0x21')]:_0x5aec97[_0xe723('0x1e')]+_0x5aec97[_0xe723('0x20')];var _0x5e8a90;if(_0x2057d7>=_0x2cd7ca){_0x2057d7=_0x2cd7ca;_0x5e8a90=0xc8;}else{_0x5e8a90=0xce;}_0xf29a39['status'](_0x5e8a90);return _0xf29a39[_0xe723('0x22')](_0xe723('0x23'),_0x17e2c1+'-'+_0x2057d7+'/'+_0x2cd7ca)['json'](_0x23d0b2);}return null;};}function patchUpdates(_0x28caca){return function(_0x2762e2){try{jsonpatch['apply'](_0x2762e2,_0x28caca,!![]);}catch(_0x472502){return BPromise['reject'](_0x472502);}return _0x2762e2[_0xe723('0x24')]();};}function saveUpdates(_0x43ccfc,_0x3b82b2){return function(_0x1fe43d){if(_0x1fe43d){return _0x1fe43d[_0xe723('0x25')](_0x43ccfc)[_0xe723('0x26')](function(_0x25f7d2){return _0x25f7d2;});}return null;};}function removeEntity(_0x15196c,_0x1228f2){return function(_0x19bd0c){if(_0x19bd0c){return _0x19bd0c[_0xe723('0x27')]()[_0xe723('0x26')](function(){_0x15196c['status'](0xcc)[_0xe723('0x28')]();});}};}function handleEntityNotFound(_0x59f095,_0xa258f3){return function(_0x3ffa15){if(!_0x3ffa15){_0x59f095[_0xe723('0x29')](0x194);}return _0x3ffa15;};}function handleError(_0xe7e271,_0x1f81ec){_0x1f81ec=_0x1f81ec||0x1f4;return function(_0x598f15){logger[_0xe723('0x2a')](_0x598f15['stack']);if(_0x598f15['name']){delete _0x598f15[_0xe723('0x2b')];}_0xe7e271['status'](_0x1f81ec)[_0xe723('0x2c')](_0x598f15);};}exports[_0xe723('0x2d')]=function(_0x335c66,_0x4d55cc){var _0x1edbb2={},_0x45e162={},_0x48a97a={'count':0x0,'rows':[]};var _0x3c8c56=_['map'](db['Cdr'][_0xe723('0x2e')],function(_0x2c2240){return{'name':_0x2c2240[_0xe723('0x2f')],'type':_0x2c2240[_0xe723('0x30')]['key']};});_0x45e162['model']=_[_0xe723('0x31')](_0x3c8c56,'name');_0x45e162[_0xe723('0x32')]=_[_0xe723('0x33')](_0x335c66[_0xe723('0x32')]);_0x45e162[_0xe723('0x34')]=_[_0xe723('0x35')](_0x45e162[_0xe723('0x36')],_0x45e162[_0xe723('0x32')]);_0x1edbb2[_0xe723('0x37')]=_[_0xe723('0x35')](_0x45e162[_0xe723('0x36')],qs[_0xe723('0x38')](_0x335c66[_0xe723('0x32')][_0xe723('0x38')]));_0x1edbb2[_0xe723('0x37')]=_0x1edbb2['attributes'][_0xe723('0x39')]?_0x1edbb2['attributes']:_0x45e162[_0xe723('0x36')];if(!_0x335c66[_0xe723('0x32')]['hasOwnProperty']('nolimit')){_0x1edbb2[_0xe723('0x20')]=qs[_0xe723('0x20')](_0x335c66[_0xe723('0x32')][_0xe723('0x20')]);_0x1edbb2[_0xe723('0x1e')]=qs[_0xe723('0x1e')](_0x335c66['query'][_0xe723('0x1e')]);}_0x1edbb2[_0xe723('0x3a')]=qs[_0xe723('0x3b')](_0x335c66[_0xe723('0x32')][_0xe723('0x3b')]);_0x1edbb2[_0xe723('0x3c')]=qs[_0xe723('0x34')](_[_0xe723('0x3d')](_0x335c66[_0xe723('0x32')],_0x45e162[_0xe723('0x34')]),_0x3c8c56);if(_0x335c66[_0xe723('0x32')][_0xe723('0x3e')]){_0x1edbb2[_0xe723('0x3c')]=_[_0xe723('0x3f')](_0x1edbb2[_0xe723('0x3c')],{'$or':_[_0xe723('0x31')](_0x3c8c56,function(_0x5c5027){if(_0x5c5027[_0xe723('0x30')]!==_0xe723('0x40')){var _0x68eda5={};_0x68eda5[_0x5c5027[_0xe723('0x2b')]]={'$like':'%'+_0x335c66['query']['filter']+'%'};return _0x68eda5;}})});}_0x1edbb2=_[_0xe723('0x3f')]({},_0x1edbb2,_0x335c66[_0xe723('0x41')]);var _0xc0c2c7={'where':_0x1edbb2[_0xe723('0x3c')]};return db['Cdr']['count'](_0xc0c2c7)[_0xe723('0x26')](function(_0x2f1618){_0x48a97a[_0xe723('0x21')]=_0x2f1618;if(_0x335c66[_0xe723('0x32')][_0xe723('0x42')]){_0x1edbb2[_0xe723('0x43')]=[{'all':!![]}];}return db[_0xe723('0x44')][_0xe723('0x45')](_0x1edbb2);})[_0xe723('0x26')](function(_0x5b0c89){_0x48a97a['rows']=_0x5b0c89;return _0x48a97a;})[_0xe723('0x26')](respondWithFilteredResult(_0x4d55cc,_0x1edbb2))['catch'](handleError(_0x4d55cc,null));};exports['show']=function(_0x18f4a1,_0x55530b){var _0x36272={'raw':!![],'where':{'id':_0x18f4a1[_0xe723('0x46')]['id']}},_0x42bd2f={};_0x42bd2f[_0xe723('0x36')]=_[_0xe723('0x33')](db[_0xe723('0x44')][_0xe723('0x2e')]);_0x42bd2f['query']=_['keys'](_0x18f4a1[_0xe723('0x32')]);_0x42bd2f['filters']=_[_0xe723('0x35')](_0x42bd2f['model'],_0x42bd2f[_0xe723('0x32')]);_0x36272[_0xe723('0x37')]=_[_0xe723('0x35')](_0x42bd2f[_0xe723('0x36')],qs[_0xe723('0x38')](_0x18f4a1[_0xe723('0x32')][_0xe723('0x38')]));_0x36272[_0xe723('0x37')]=_0x36272[_0xe723('0x37')]['length']?_0x36272['attributes']:_0x42bd2f[_0xe723('0x36')];if(_0x18f4a1[_0xe723('0x32')][_0xe723('0x42')]){_0x36272['include']=[{'all':!![]}];}_0x36272=_['merge']({},_0x36272,_0x18f4a1['options']);return db[_0xe723('0x44')][_0xe723('0x47')](_0x36272)[_0xe723('0x26')](handleEntityNotFound(_0x55530b,null))['then'](respondWithResult(_0x55530b,null))[_0xe723('0x48')](handleError(_0x55530b,null));};exports[_0xe723('0x49')]=function(_0x1cb2b2,_0x38bd1a){return db[_0xe723('0x44')]['create'](_0x1cb2b2[_0xe723('0x4a')],{})['then'](respondWithResult(_0x38bd1a,0xc9))[_0xe723('0x48')](handleError(_0x38bd1a,null));};exports['update']=function(_0x52f42e,_0x1590fe){if(_0x52f42e[_0xe723('0x4a')]['id']){delete _0x52f42e[_0xe723('0x4a')]['id'];}return db['Cdr'][_0xe723('0x47')]({'where':{'id':_0x52f42e['params']['id']}})[_0xe723('0x26')](handleEntityNotFound(_0x1590fe,null))[_0xe723('0x26')](saveUpdates(_0x52f42e[_0xe723('0x4a')],null))[_0xe723('0x26')](respondWithResult(_0x1590fe,null))[_0xe723('0x48')](handleError(_0x1590fe,null));};exports[_0xe723('0x27')]=function(_0x41e1c4,_0x16cb50){return db[_0xe723('0x44')]['find']({'where':{'id':_0x41e1c4[_0xe723('0x46')]['id']}})[_0xe723('0x26')](handleEntityNotFound(_0x16cb50,null))['then'](removeEntity(_0x16cb50,null))[_0xe723('0x48')](handleError(_0x16cb50,null));};exports[_0xe723('0x4b')]=function(_0x56e92a,_0x126ca5){return db['Cdr']['describe']()[_0xe723('0x26')](respondWithResult(_0x126ca5,null))[_0xe723('0x48')](handleError(_0x126ca5,null));}; \ No newline at end of file +var _0xf3be=['then','error','stack','name','send','index','map','Cdr','fieldName','type','key','query','keys','intersection','attributes','fields','model','nolimit','order','sort','where','filters','pick','filter','merge','options','include','rows','catch','rawAttributes','length','includeAll','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy'];(function(_0x3985f1,_0x493e84){var _0x405d4d=function(_0x46c787){while(--_0x46c787){_0x3985f1['push'](_0x3985f1['shift']());}};_0x405d4d(++_0x493e84);}(_0xf3be,0x1e1));var _0xef3b=function(_0x1b6e61,_0x40fab9){_0x1b6e61=_0x1b6e61-0x0;var _0x52d153=_0xf3be[_0x1b6e61];return _0x52d153;};'use strict';var emlformat=require(_0xef3b('0x0'));var rimraf=require(_0xef3b('0x1'));var zipdir=require(_0xef3b('0x2'));var jsonpatch=require(_0xef3b('0x3'));var rp=require('request-promise');var moment=require(_0xef3b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xef3b('0x5'));var csv=require(_0xef3b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef3b('0x7'));var _=require(_0xef3b('0x8'));var squel=require(_0xef3b('0x9'));var crypto=require(_0xef3b('0xa'));var jsforce=require(_0xef3b('0xb'));var deskjs=require(_0xef3b('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef3b('0xd'));var Redis=require('ioredis');var authService=require(_0xef3b('0xe'));var qs=require(_0xef3b('0xf'));var as=require(_0xef3b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xef3b('0x11'))('api');var utils=require(_0xef3b('0x12'));var config=require(_0xef3b('0x13'));var licenseUtil=require(_0xef3b('0x14'));var db=require(_0xef3b('0x15'))['db'];function respondWithStatusCode(_0x2a2a27,_0x3aef79){_0x3aef79=_0x3aef79||0xcc;return function(_0x169b2c){if(_0x169b2c){return _0x2a2a27[_0xef3b('0x16')](_0x3aef79);}return _0x2a2a27[_0xef3b('0x17')](_0x3aef79)[_0xef3b('0x18')]();};}function respondWithResult(_0x510cc3,_0x5a53b9){_0x5a53b9=_0x5a53b9||0xc8;return function(_0x138ea5){if(_0x138ea5){return _0x510cc3[_0xef3b('0x17')](_0x5a53b9)[_0xef3b('0x19')](_0x138ea5);}};}function respondWithFilteredResult(_0x118a31,_0x416801){return function(_0x529e89){if(_0x529e89){var _0x169803=typeof _0x416801[_0xef3b('0x1a')]===_0xef3b('0x1b')&&typeof _0x416801[_0xef3b('0x1c')]===_0xef3b('0x1b');var _0x5908cb=_0x529e89[_0xef3b('0x1d')];var _0x406eb7=_0x169803?0x0:_0x416801['offset'];var _0x280ccf=_0x169803?_0x529e89['count']:_0x416801[_0xef3b('0x1a')]+_0x416801['limit'];var _0x278de3;if(_0x280ccf>=_0x5908cb){_0x280ccf=_0x5908cb;_0x278de3=0xc8;}else{_0x278de3=0xce;}_0x118a31[_0xef3b('0x17')](_0x278de3);return _0x118a31[_0xef3b('0x1e')](_0xef3b('0x1f'),_0x406eb7+'-'+_0x280ccf+'/'+_0x5908cb)[_0xef3b('0x19')](_0x529e89);}return null;};}function patchUpdates(_0x3d18ef){return function(_0x19d4b5){try{jsonpatch[_0xef3b('0x20')](_0x19d4b5,_0x3d18ef,!![]);}catch(_0x4a3fbf){return BPromise[_0xef3b('0x21')](_0x4a3fbf);}return _0x19d4b5[_0xef3b('0x22')]();};}function saveUpdates(_0x214b53,_0xfe39a4){return function(_0x93a080){if(_0x93a080){return _0x93a080[_0xef3b('0x23')](_0x214b53)['then'](function(_0x27cc47){return _0x27cc47;});}return null;};}function removeEntity(_0x574042,_0x57b14a){return function(_0xc68cb2){if(_0xc68cb2){return _0xc68cb2[_0xef3b('0x24')]()[_0xef3b('0x25')](function(){_0x574042[_0xef3b('0x17')](0xcc)[_0xef3b('0x18')]();});}};}function handleEntityNotFound(_0x179338,_0x4ecb5e){return function(_0x487ae6){if(!_0x487ae6){_0x179338[_0xef3b('0x16')](0x194);}return _0x487ae6;};}function handleError(_0x4b6ee7,_0x4d5449){_0x4d5449=_0x4d5449||0x1f4;return function(_0x13dd47){logger[_0xef3b('0x26')](_0x13dd47[_0xef3b('0x27')]);if(_0x13dd47[_0xef3b('0x28')]){delete _0x13dd47[_0xef3b('0x28')];}_0x4b6ee7[_0xef3b('0x17')](_0x4d5449)[_0xef3b('0x29')](_0x13dd47);};}exports[_0xef3b('0x2a')]=function(_0x556c5c,_0xded00b){var _0x2b073b={},_0x634a45={},_0x187d1b={'count':0x0,'rows':[]};var _0x27ab13=_[_0xef3b('0x2b')](db[_0xef3b('0x2c')]['rawAttributes'],function(_0x4c9a84){return{'name':_0x4c9a84[_0xef3b('0x2d')],'type':_0x4c9a84[_0xef3b('0x2e')][_0xef3b('0x2f')]};});_0x634a45['model']=_[_0xef3b('0x2b')](_0x27ab13,_0xef3b('0x28'));_0x634a45[_0xef3b('0x30')]=_[_0xef3b('0x31')](_0x556c5c[_0xef3b('0x30')]);_0x634a45['filters']=_[_0xef3b('0x32')](_0x634a45['model'],_0x634a45[_0xef3b('0x30')]);_0x2b073b[_0xef3b('0x33')]=_[_0xef3b('0x32')](_0x634a45['model'],qs[_0xef3b('0x34')](_0x556c5c[_0xef3b('0x30')][_0xef3b('0x34')]));_0x2b073b['attributes']=_0x2b073b[_0xef3b('0x33')]['length']?_0x2b073b[_0xef3b('0x33')]:_0x634a45[_0xef3b('0x35')];if(!_0x556c5c['query']['hasOwnProperty'](_0xef3b('0x36'))){_0x2b073b[_0xef3b('0x1c')]=qs[_0xef3b('0x1c')](_0x556c5c['query'][_0xef3b('0x1c')]);_0x2b073b[_0xef3b('0x1a')]=qs[_0xef3b('0x1a')](_0x556c5c[_0xef3b('0x30')][_0xef3b('0x1a')]);}_0x2b073b[_0xef3b('0x37')]=qs['sort'](_0x556c5c['query'][_0xef3b('0x38')]);_0x2b073b[_0xef3b('0x39')]=qs[_0xef3b('0x3a')](_[_0xef3b('0x3b')](_0x556c5c[_0xef3b('0x30')],_0x634a45[_0xef3b('0x3a')]),_0x27ab13);if(_0x556c5c['query'][_0xef3b('0x3c')]){_0x2b073b[_0xef3b('0x39')]=_[_0xef3b('0x3d')](_0x2b073b['where'],{'$or':_[_0xef3b('0x2b')](_0x27ab13,function(_0x5ab5eb){if(_0x5ab5eb[_0xef3b('0x2e')]!=='VIRTUAL'){var _0x3a361f={};_0x3a361f[_0x5ab5eb['name']]={'$like':'%'+_0x556c5c[_0xef3b('0x30')]['filter']+'%'};return _0x3a361f;}})});}_0x2b073b=_[_0xef3b('0x3d')]({},_0x2b073b,_0x556c5c[_0xef3b('0x3e')]);var _0x1108e1={'where':_0x2b073b[_0xef3b('0x39')]};return db[_0xef3b('0x2c')][_0xef3b('0x1d')](_0x1108e1)[_0xef3b('0x25')](function(_0x219cfc){_0x187d1b['count']=_0x219cfc;if(_0x556c5c[_0xef3b('0x30')]['includeAll']){_0x2b073b[_0xef3b('0x3f')]=[{'all':!![]}];}return db[_0xef3b('0x2c')]['findAll'](_0x2b073b);})['then'](function(_0x51fb51){_0x187d1b[_0xef3b('0x40')]=_0x51fb51;return _0x187d1b;})['then'](respondWithFilteredResult(_0xded00b,_0x2b073b))[_0xef3b('0x41')](handleError(_0xded00b,null));};exports['show']=function(_0x4b2230,_0x516d08){var _0x5cec25={'raw':!![],'where':{'id':_0x4b2230['params']['id']}},_0x48699a={};_0x48699a['model']=_[_0xef3b('0x31')](db[_0xef3b('0x2c')][_0xef3b('0x42')]);_0x48699a['query']=_['keys'](_0x4b2230[_0xef3b('0x30')]);_0x48699a[_0xef3b('0x3a')]=_[_0xef3b('0x32')](_0x48699a[_0xef3b('0x35')],_0x48699a['query']);_0x5cec25[_0xef3b('0x33')]=_['intersection'](_0x48699a[_0xef3b('0x35')],qs[_0xef3b('0x34')](_0x4b2230[_0xef3b('0x30')][_0xef3b('0x34')]));_0x5cec25[_0xef3b('0x33')]=_0x5cec25['attributes'][_0xef3b('0x43')]?_0x5cec25[_0xef3b('0x33')]:_0x48699a[_0xef3b('0x35')];if(_0x4b2230[_0xef3b('0x30')][_0xef3b('0x44')]){_0x5cec25[_0xef3b('0x3f')]=[{'all':!![]}];}_0x5cec25=_[_0xef3b('0x3d')]({},_0x5cec25,_0x4b2230[_0xef3b('0x3e')]);return db[_0xef3b('0x2c')]['find'](_0x5cec25)[_0xef3b('0x25')](handleEntityNotFound(_0x516d08,null))[_0xef3b('0x25')](respondWithResult(_0x516d08,null))[_0xef3b('0x41')](handleError(_0x516d08,null));};exports['create']=function(_0x3f3e8b,_0x5d48c8){return db[_0xef3b('0x2c')][_0xef3b('0x45')](_0x3f3e8b[_0xef3b('0x46')],{})['then'](respondWithResult(_0x5d48c8,0xc9))['catch'](handleError(_0x5d48c8,null));};exports[_0xef3b('0x23')]=function(_0x38ee41,_0x4b368c){if(_0x38ee41[_0xef3b('0x46')]['id']){delete _0x38ee41[_0xef3b('0x46')]['id'];}return db[_0xef3b('0x2c')][_0xef3b('0x47')]({'where':{'id':_0x38ee41['params']['id']}})[_0xef3b('0x25')](handleEntityNotFound(_0x4b368c,null))[_0xef3b('0x25')](saveUpdates(_0x38ee41[_0xef3b('0x46')],null))[_0xef3b('0x25')](respondWithResult(_0x4b368c,null))[_0xef3b('0x41')](handleError(_0x4b368c,null));};exports[_0xef3b('0x24')]=function(_0x5e66fe,_0x2f45b1){return db[_0xef3b('0x2c')][_0xef3b('0x47')]({'where':{'id':_0x5e66fe[_0xef3b('0x48')]['id']}})[_0xef3b('0x25')](handleEntityNotFound(_0x2f45b1,null))[_0xef3b('0x25')](removeEntity(_0x2f45b1,null))[_0xef3b('0x41')](handleError(_0x2f45b1,null));};exports[_0xef3b('0x49')]=function(_0x3995b9,_0xf30f16){return db[_0xef3b('0x2c')][_0xef3b('0x49')]()[_0xef3b('0x25')](respondWithResult(_0xf30f16,null))['catch'](handleError(_0xf30f16,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 02444a1..dafbec1 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(_0x6056a2,_0x156835){var _0x39b066=function(_0x37fe47){while(--_0x37fe47){_0x6056a2['push'](_0x6056a2['shift']());}};_0x39b066(++_0x156835);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'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 _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x545e7c,_0x7cee70){var _0x5c9897=function(_0x130e8a){while(--_0x130e8a){_0x545e7c['push'](_0x545e7c['shift']());}};_0x5c9897(++_0x7cee70);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index fcdc35b..c774bcc 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 _0x7263=['request','then','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x1ad7d3,_0x187a4c){var _0x490430=function(_0x50dc2b){while(--_0x50dc2b){_0x1ad7d3['push'](_0x1ad7d3['shift']());}};_0x490430(++_0x187a4c);}(_0x7263,0x15b));var _0x3726=function(_0xd02eac,_0x1e2933){_0xd02eac=_0xd02eac-0x0;var _0x113bfe=_0x7263[_0xd02eac];return _0x113bfe;};'use strict';var _=require(_0x3726('0x0'));var util=require(_0x3726('0x1'));var moment=require(_0x3726('0x2'));var BPromise=require(_0x3726('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3726('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3726('0x5'));var logger=require(_0x3726('0x6'))('rpc');var config=require(_0x3726('0x7'));var jayson=require(_0x3726('0x8'));var client=jayson['client'][_0x3726('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x369f0b,_0x2aedfd,_0x32cd7e){return new BPromise(function(_0x377407,_0x45e0f2){return client[_0x3726('0xa')](_0x369f0b,_0x32cd7e)[_0x3726('0xb')](function(_0x460685){logger['info'](_0x3726('0xc'),_0x2aedfd,_0x3726('0xd'));logger['debug'](_0x3726('0xe'),_0x2aedfd,_0x3726('0xd'),JSON[_0x3726('0xf')](_0x460685));if(_0x460685[_0x3726('0x10')]){if(_0x460685[_0x3726('0x10')][_0x3726('0x11')]===0x1f4){logger[_0x3726('0x10')]('Cdr,\x20%s,\x20%s',_0x2aedfd,_0x460685[_0x3726('0x10')][_0x3726('0x12')]);return _0x45e0f2(_0x460685['error'][_0x3726('0x12')]);}logger['error'](_0x3726('0xc'),_0x2aedfd,_0x460685[_0x3726('0x10')]['message']);return _0x377407(_0x460685[_0x3726('0x10')][_0x3726('0x12')]);}else{logger[_0x3726('0x13')](_0x3726('0xc'),_0x2aedfd,'request\x20sent');_0x377407(_0x460685[_0x3726('0x14')][_0x3726('0x12')]);}})['catch'](function(_0x3b2a2f){logger[_0x3726('0x10')](_0x3726('0xc'),_0x2aedfd,_0x3b2a2f);_0x45e0f2(_0x3b2a2f);});});} \ No newline at end of file +var _0xf391=['debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','Cdr,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x719da8,_0x44d1dd){var _0x335b47=function(_0x35f856){while(--_0x35f856){_0x719da8['push'](_0x719da8['shift']());}};_0x335b47(++_0x44d1dd);}(_0xf391,0x1bf));var _0x1f39=function(_0x555682,_0x3b6190){_0x555682=_0x555682-0x0;var _0x355cf3=_0xf391[_0x555682];return _0x355cf3;};'use strict';var _=require(_0x1f39('0x0'));var util=require('util');var moment=require(_0x1f39('0x1'));var BPromise=require(_0x1f39('0x2'));var rs=require(_0x1f39('0x3'));var fs=require('fs');var Redis=require(_0x1f39('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1f39('0x5'));var logger=require(_0x1f39('0x6'))('rpc');var config=require(_0x1f39('0x7'));var jayson=require(_0x1f39('0x8'));var client=jayson[_0x1f39('0x9')][_0x1f39('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2324a2,_0x64d7ad,_0x11f84f){return new BPromise(function(_0x529e74,_0x5997ae){return client[_0x1f39('0xb')](_0x2324a2,_0x11f84f)[_0x1f39('0xc')](function(_0xbaa8c){logger[_0x1f39('0xd')]('Cdr,\x20%s,\x20%s',_0x64d7ad,_0x1f39('0xe'));logger[_0x1f39('0xf')](_0x1f39('0x10'),_0x64d7ad,_0x1f39('0xe'),JSON['stringify'](_0xbaa8c));if(_0xbaa8c[_0x1f39('0x11')]){if(_0xbaa8c[_0x1f39('0x11')][_0x1f39('0x12')]===0x1f4){logger[_0x1f39('0x11')](_0x1f39('0x13'),_0x64d7ad,_0xbaa8c[_0x1f39('0x11')][_0x1f39('0x14')]);return _0x5997ae(_0xbaa8c[_0x1f39('0x11')][_0x1f39('0x14')]);}logger[_0x1f39('0x11')](_0x1f39('0x13'),_0x64d7ad,_0xbaa8c[_0x1f39('0x11')][_0x1f39('0x14')]);return _0x529e74(_0xbaa8c[_0x1f39('0x11')][_0x1f39('0x14')]);}else{logger[_0x1f39('0xd')](_0x1f39('0x13'),_0x64d7ad,_0x1f39('0xe'));_0x529e74(_0xbaa8c['result'][_0x1f39('0x14')]);}})[_0x1f39('0x15')](function(_0x5db20b){logger['error']('Cdr,\x20%s,\x20%s',_0x64d7ad,_0x5db20b);_0x5997ae(_0x5db20b);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 64ebdf5..8b01979 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 _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(_0x2e10e4,_0x262e36){var _0x4bdb80=function(_0x2ddcd9){while(--_0x2ddcd9){_0x2e10e4['push'](_0x2e10e4['shift']());}};_0x4bdb80(++_0x262e36);}(_0xb10b,0x12a));var _0xbb10=function(_0x42f3a6,_0x45285c){_0x42f3a6=_0x42f3a6-0x0;var _0xdf3c33=_0xb10b[_0x42f3a6];return _0xdf3c33;};'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 +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(_0x1a0600,_0x41feef){var _0x734670=function(_0x2da4e4){while(--_0x2da4e4){_0x1a0600['push'](_0x1a0600['shift']());}};_0x734670(++_0x41feef);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 3cce970..e195ab0 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 _0x724e=['TEXT','*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x724e,0x8c));var _0xe724=function(_0x28bbb9,_0x319419){_0x28bbb9=_0x28bbb9-0x0;var _0x104c01=_0x724e[_0x28bbb9];return _0x104c01;};'use strict';var Sequelize=require(_0xe724('0x0'));module['exports']={'priority':{'type':Sequelize[_0xe724('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xe724('0x2')],'allowNull':![],'defaultValue':_0xe724('0x3')},'appdata':{'type':Sequelize[_0xe724('0x4')]()},'description':{'type':Sequelize[_0xe724('0x2')]},'interval':{'type':Sequelize[_0xe724('0x2')],'defaultValue':_0xe724('0x5')}}; \ No newline at end of file +var _0x3c76=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x3121de,_0x1d7c25){var _0x1f6ca0=function(_0x147a59){while(--_0x147a59){_0x3121de['push'](_0x3121de['shift']());}};_0x1f6ca0(++_0x1d7c25);}(_0x3c76,0x93));var _0x63c7=function(_0x5c34d0,_0x992e48){_0x5c34d0=_0x5c34d0-0x0;var _0x1066d5=_0x3c76[_0x5c34d0];return _0x1066d5;};'use strict';var Sequelize=require(_0x63c7('0x0'));module[_0x63c7('0x1')]={'priority':{'type':Sequelize[_0x63c7('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x63c7('0x3')],'allowNull':![],'defaultValue':_0x63c7('0x4')},'appdata':{'type':Sequelize[_0x63c7('0x5')]()},'description':{'type':Sequelize[_0x63c7('0x3')]},'interval':{'type':Sequelize[_0x63c7('0x3')],'defaultValue':_0x63c7('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 130772e..346142e 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 _0xc577=['../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','then','destroy','end','sendStatus','error','name','send','params','model','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','find','catch','update','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0xc577,0x172));var _0x7c57=function(_0x67f95e,_0x3ca797){_0x67f95e=_0x67f95e-0x0;var _0x538f5a=_0xc577[_0x67f95e];return _0x538f5a;};'use strict';var emlformat=require(_0x7c57('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7c57('0x1'));var rp=require(_0x7c57('0x2'));var moment=require(_0x7c57('0x3'));var BPromise=require(_0x7c57('0x4'));var Mustache=require(_0x7c57('0x5'));var util=require(_0x7c57('0x6'));var path=require(_0x7c57('0x7'));var sox=require('sox');var csv=require(_0x7c57('0x8'));var ejs=require(_0x7c57('0x9'));var fs=require('fs');var fs_extra=require(_0x7c57('0xa'));var _=require(_0x7c57('0xb'));var squel=require(_0x7c57('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7c57('0x8'));var querystring=require('querystring');var Papa=require(_0x7c57('0xd'));var Redis=require(_0x7c57('0xe'));var authService=require(_0x7c57('0xf'));var qs=require(_0x7c57('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7c57('0x11'));var logger=require(_0x7c57('0x12'))('api');var utils=require(_0x7c57('0x13'));var config=require(_0x7c57('0x14'));var licenseUtil=require(_0x7c57('0x15'));var db=require(_0x7c57('0x16'))['db'];function respondWithStatusCode(_0xbd2172,_0x10a675){_0x10a675=_0x10a675||0xcc;return function(_0x296cef){if(_0x296cef){return _0xbd2172['sendStatus'](_0x10a675);}return _0xbd2172['status'](_0x10a675)['end']();};}function respondWithResult(_0x46cae6,_0x373a4b){_0x373a4b=_0x373a4b||0xc8;return function(_0x4c5af2){if(_0x4c5af2){return _0x46cae6[_0x7c57('0x17')](_0x373a4b)[_0x7c57('0x18')](_0x4c5af2);}};}function respondWithFilteredResult(_0x11903b,_0x1ba2d0){return function(_0x14ce67){if(_0x14ce67){var _0x517d8a=typeof _0x1ba2d0['offset']===_0x7c57('0x19')&&typeof _0x1ba2d0[_0x7c57('0x1a')]===_0x7c57('0x19');var _0x3c40d3=_0x14ce67[_0x7c57('0x1b')];var _0x48cf4f=_0x517d8a?0x0:_0x1ba2d0[_0x7c57('0x1c')];var _0x30f5b1=_0x517d8a?_0x14ce67[_0x7c57('0x1b')]:_0x1ba2d0[_0x7c57('0x1c')]+_0x1ba2d0[_0x7c57('0x1a')];var _0x3e2dc0;if(_0x30f5b1>=_0x3c40d3){_0x30f5b1=_0x3c40d3;_0x3e2dc0=0xc8;}else{_0x3e2dc0=0xce;}_0x11903b[_0x7c57('0x17')](_0x3e2dc0);return _0x11903b[_0x7c57('0x1d')](_0x7c57('0x1e'),_0x48cf4f+'-'+_0x30f5b1+'/'+_0x3c40d3)['json'](_0x14ce67);}return null;};}function patchUpdates(_0x45221e){return function(_0x3472b8){try{jsonpatch[_0x7c57('0x1f')](_0x3472b8,_0x45221e,!![]);}catch(_0x373b5b){return BPromise['reject'](_0x373b5b);}return _0x3472b8['save']();};}function saveUpdates(_0x4c4140,_0x140376){return function(_0x368bb6){if(_0x368bb6){return _0x368bb6['update'](_0x4c4140)[_0x7c57('0x20')](function(_0x13f696){return _0x13f696;});}return null;};}function removeEntity(_0x260d58,_0xfb0f2e){return function(_0x4734de){if(_0x4734de){return _0x4734de[_0x7c57('0x21')]()[_0x7c57('0x20')](function(){_0x260d58['status'](0xcc)[_0x7c57('0x22')]();});}};}function handleEntityNotFound(_0x3232f8,_0x16a517){return function(_0x1641f1){if(!_0x1641f1){_0x3232f8[_0x7c57('0x23')](0x194);}return _0x1641f1;};}function handleError(_0x984924,_0x41125b){_0x41125b=_0x41125b||0x1f4;return function(_0x1219f2){logger[_0x7c57('0x24')](_0x1219f2['stack']);if(_0x1219f2['name']){delete _0x1219f2[_0x7c57('0x25')];}_0x984924[_0x7c57('0x17')](_0x41125b)[_0x7c57('0x26')](_0x1219f2);};}exports['show']=function(_0x9b9d1f,_0x59ae2f){var _0x5acc20={'raw':!![],'where':{'id':_0x9b9d1f[_0x7c57('0x27')]['id']}},_0x5ad979={};_0x5ad979[_0x7c57('0x28')]=_['keys'](db[_0x7c57('0x29')][_0x7c57('0x2a')]);_0x5ad979[_0x7c57('0x2b')]=_['keys'](_0x9b9d1f[_0x7c57('0x2b')]);_0x5ad979[_0x7c57('0x2c')]=_[_0x7c57('0x2d')](_0x5ad979['model'],_0x5ad979[_0x7c57('0x2b')]);_0x5acc20[_0x7c57('0x2e')]=_[_0x7c57('0x2d')](_0x5ad979[_0x7c57('0x28')],qs[_0x7c57('0x2f')](_0x9b9d1f[_0x7c57('0x2b')][_0x7c57('0x2f')]));_0x5acc20[_0x7c57('0x2e')]=_0x5acc20[_0x7c57('0x2e')][_0x7c57('0x30')]?_0x5acc20['attributes']:_0x5ad979[_0x7c57('0x28')];if(_0x9b9d1f[_0x7c57('0x2b')]['includeAll']){_0x5acc20[_0x7c57('0x31')]=[{'all':!![]}];}_0x5acc20=_[_0x7c57('0x32')]({},_0x5acc20,_0x9b9d1f[_0x7c57('0x33')]);return db['ChatApplication'][_0x7c57('0x34')](_0x5acc20)[_0x7c57('0x20')](handleEntityNotFound(_0x59ae2f,null))['then'](respondWithResult(_0x59ae2f,null))[_0x7c57('0x35')](handleError(_0x59ae2f,null));};exports[_0x7c57('0x36')]=function(_0x5e8068,_0x170d19){if(_0x5e8068[_0x7c57('0x37')]['id']){delete _0x5e8068[_0x7c57('0x37')]['id'];}return db[_0x7c57('0x29')]['find']({'where':{'id':_0x5e8068[_0x7c57('0x27')]['id']}})['then'](handleEntityNotFound(_0x170d19,null))['then'](saveUpdates(_0x5e8068[_0x7c57('0x37')],null))[_0x7c57('0x20')](respondWithResult(_0x170d19,null))[_0x7c57('0x35')](handleError(_0x170d19,null));};exports[_0x7c57('0x21')]=function(_0x493381,_0x2aebec){return db[_0x7c57('0x29')][_0x7c57('0x34')]({'where':{'id':_0x493381[_0x7c57('0x27')]['id']}})[_0x7c57('0x20')](handleEntityNotFound(_0x2aebec,null))[_0x7c57('0x20')](removeEntity(_0x2aebec,null))[_0x7c57('0x35')](handleError(_0x2aebec,null));}; \ No newline at end of file +var _0x5d70=['then','destroy','error','stack','name','show','params','model','keys','ChatApplication','query','filters','intersection','attributes','fields','includeAll','include','options','find','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','save','update'];(function(_0x16bb0e,_0x343132){var _0x102b8b=function(_0x17a62b){while(--_0x17a62b){_0x16bb0e['push'](_0x16bb0e['shift']());}};_0x102b8b(++_0x343132);}(_0x5d70,0x8d));var _0x05d7=function(_0x179220,_0x507eb2){_0x179220=_0x179220-0x0;var _0x5d1d84=_0x5d70[_0x179220];return _0x5d1d84;};'use strict';var emlformat=require(_0x05d7('0x0'));var rimraf=require(_0x05d7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x05d7('0x2'));var rp=require(_0x05d7('0x3'));var moment=require(_0x05d7('0x4'));var BPromise=require(_0x05d7('0x5'));var Mustache=require(_0x05d7('0x6'));var util=require(_0x05d7('0x7'));var path=require('path');var sox=require(_0x05d7('0x8'));var csv=require(_0x05d7('0x9'));var ejs=require(_0x05d7('0xa'));var fs=require('fs');var fs_extra=require(_0x05d7('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x05d7('0xc'));var jsforce=require(_0x05d7('0xd'));var deskjs=require(_0x05d7('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x05d7('0xf'));var Redis=require(_0x05d7('0x10'));var authService=require(_0x05d7('0x11'));var qs=require(_0x05d7('0x12'));var as=require(_0x05d7('0x13'));var hardwareService=require(_0x05d7('0x14'));var logger=require(_0x05d7('0x15'))(_0x05d7('0x16'));var utils=require(_0x05d7('0x17'));var config=require(_0x05d7('0x18'));var licenseUtil=require(_0x05d7('0x19'));var db=require(_0x05d7('0x1a'))['db'];function respondWithStatusCode(_0x3d4825,_0x2e2bab){_0x2e2bab=_0x2e2bab||0xcc;return function(_0x1f0ccb){if(_0x1f0ccb){return _0x3d4825[_0x05d7('0x1b')](_0x2e2bab);}return _0x3d4825[_0x05d7('0x1c')](_0x2e2bab)[_0x05d7('0x1d')]();};}function respondWithResult(_0x171746,_0x34cd5b){_0x34cd5b=_0x34cd5b||0xc8;return function(_0x231f62){if(_0x231f62){return _0x171746[_0x05d7('0x1c')](_0x34cd5b)[_0x05d7('0x1e')](_0x231f62);}};}function respondWithFilteredResult(_0x586306,_0x38b3c7){return function(_0x5ba163){if(_0x5ba163){var _0x42c95f=typeof _0x38b3c7[_0x05d7('0x1f')]==='undefined'&&typeof _0x38b3c7['limit']==='undefined';var _0x55b9d3=_0x5ba163['count'];var _0x3e364b=_0x42c95f?0x0:_0x38b3c7[_0x05d7('0x1f')];var _0x292d48=_0x42c95f?_0x5ba163[_0x05d7('0x20')]:_0x38b3c7[_0x05d7('0x1f')]+_0x38b3c7[_0x05d7('0x21')];var _0xad9c4;if(_0x292d48>=_0x55b9d3){_0x292d48=_0x55b9d3;_0xad9c4=0xc8;}else{_0xad9c4=0xce;}_0x586306[_0x05d7('0x1c')](_0xad9c4);return _0x586306[_0x05d7('0x22')](_0x05d7('0x23'),_0x3e364b+'-'+_0x292d48+'/'+_0x55b9d3)[_0x05d7('0x1e')](_0x5ba163);}return null;};}function patchUpdates(_0x31199b){return function(_0x4e182f){try{jsonpatch[_0x05d7('0x24')](_0x4e182f,_0x31199b,!![]);}catch(_0x47d3ca){return BPromise['reject'](_0x47d3ca);}return _0x4e182f[_0x05d7('0x25')]();};}function saveUpdates(_0x356fe7,_0xd1e51b){return function(_0x10fde1){if(_0x10fde1){return _0x10fde1[_0x05d7('0x26')](_0x356fe7)[_0x05d7('0x27')](function(_0x34aaad){return _0x34aaad;});}return null;};}function removeEntity(_0x1d0bee,_0x31081f){return function(_0x81dab7){if(_0x81dab7){return _0x81dab7[_0x05d7('0x28')]()[_0x05d7('0x27')](function(){_0x1d0bee[_0x05d7('0x1c')](0xcc)[_0x05d7('0x1d')]();});}};}function handleEntityNotFound(_0x32e802,_0x2083d5){return function(_0x4e33bb){if(!_0x4e33bb){_0x32e802['sendStatus'](0x194);}return _0x4e33bb;};}function handleError(_0x5d3bad,_0xefd156){_0xefd156=_0xefd156||0x1f4;return function(_0x2b2e93){logger[_0x05d7('0x29')](_0x2b2e93[_0x05d7('0x2a')]);if(_0x2b2e93[_0x05d7('0x2b')]){delete _0x2b2e93[_0x05d7('0x2b')];}_0x5d3bad[_0x05d7('0x1c')](_0xefd156)['send'](_0x2b2e93);};}exports[_0x05d7('0x2c')]=function(_0x355d2b,_0x24c125){var _0x232238={'raw':!![],'where':{'id':_0x355d2b[_0x05d7('0x2d')]['id']}},_0x3cf995={};_0x3cf995[_0x05d7('0x2e')]=_[_0x05d7('0x2f')](db[_0x05d7('0x30')]['rawAttributes']);_0x3cf995[_0x05d7('0x31')]=_[_0x05d7('0x2f')](_0x355d2b[_0x05d7('0x31')]);_0x3cf995[_0x05d7('0x32')]=_[_0x05d7('0x33')](_0x3cf995[_0x05d7('0x2e')],_0x3cf995['query']);_0x232238[_0x05d7('0x34')]=_[_0x05d7('0x33')](_0x3cf995[_0x05d7('0x2e')],qs['fields'](_0x355d2b[_0x05d7('0x31')][_0x05d7('0x35')]));_0x232238[_0x05d7('0x34')]=_0x232238['attributes']['length']?_0x232238[_0x05d7('0x34')]:_0x3cf995[_0x05d7('0x2e')];if(_0x355d2b[_0x05d7('0x31')][_0x05d7('0x36')]){_0x232238[_0x05d7('0x37')]=[{'all':!![]}];}_0x232238=_['merge']({},_0x232238,_0x355d2b[_0x05d7('0x38')]);return db['ChatApplication'][_0x05d7('0x39')](_0x232238)[_0x05d7('0x27')](handleEntityNotFound(_0x24c125,null))[_0x05d7('0x27')](respondWithResult(_0x24c125,null))[_0x05d7('0x3a')](handleError(_0x24c125,null));};exports[_0x05d7('0x26')]=function(_0x821d1f,_0x57667e){if(_0x821d1f['body']['id']){delete _0x821d1f[_0x05d7('0x3b')]['id'];}return db['ChatApplication'][_0x05d7('0x39')]({'where':{'id':_0x821d1f[_0x05d7('0x2d')]['id']}})[_0x05d7('0x27')](handleEntityNotFound(_0x57667e,null))[_0x05d7('0x27')](saveUpdates(_0x821d1f[_0x05d7('0x3b')],null))[_0x05d7('0x27')](respondWithResult(_0x57667e,null))[_0x05d7('0x3a')](handleError(_0x57667e,null));};exports['destroy']=function(_0x256f0c,_0x5259fa){return db[_0x05d7('0x30')][_0x05d7('0x39')]({'where':{'id':_0x256f0c[_0x05d7('0x2d')]['id']}})['then'](handleEntityNotFound(_0x5259fa,null))[_0x05d7('0x27')](removeEntity(_0x5259fa,null))[_0x05d7('0x3a')](handleError(_0x5259fa,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index c531097..505a800 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 _0x4ddd=['path','rimraf','../../config/environment','exports','define','ChatApplication','chat_applications','utf8mb4','lodash'];(function(_0x2fd743,_0x4f01ad){var _0x3eebfc=function(_0x40b500){while(--_0x40b500){_0x2fd743['push'](_0x2fd743['shift']());}};_0x3eebfc(++_0x4f01ad);}(_0x4ddd,0x18b));var _0xd4dd=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x4ddd[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0xd4dd('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd4dd('0x1'));var rimraf=require(_0xd4dd('0x2'));var config=require(_0xd4dd('0x3'));var attributes=require('./chatApplication.attributes');module[_0xd4dd('0x4')]=function(_0x207f91,_0x2796e1){return _0x207f91[_0xd4dd('0x5')](_0xd4dd('0x6'),attributes,{'tableName':_0xd4dd('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd4dd('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x046b=['moment','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x4aba6d,_0x57944b){var _0x737743=function(_0x17eb72){while(--_0x17eb72){_0x4aba6d['push'](_0x4aba6d['shift']());}};_0x737743(++_0x57944b);}(_0x046b,0x147));var _0xb046=function(_0x413150,_0x593369){_0x413150=_0x413150-0x0;var _0x25a161=_0x046b[_0x413150];return _0x25a161;};'use strict';var _=require('lodash');var util=require(_0xb046('0x0'));var logger=require(_0xb046('0x1'))(_0xb046('0x2'));var moment=require(_0xb046('0x3'));var BPromise=require(_0xb046('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb046('0x5'));var rimraf=require(_0xb046('0x6'));var config=require(_0xb046('0x7'));var attributes=require(_0xb046('0x8'));module[_0xb046('0x9')]=function(_0x5511db,_0x5c06b5){return _0x5511db[_0xb046('0xa')](_0xb046('0xb'),attributes,{'tableName':_0xb046('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb046('0xd'),'collate':_0xb046('0xe')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index d3db3eb..deab2b9 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 _0x3508=['../../config/logger','rpc','jayson/promise','client','request','then','ChatApplication,\x20%s,\x20%s','error','code','message','request\x20sent','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x55d260,_0x339f31){var _0x1ec8b4=function(_0x54c556){while(--_0x54c556){_0x55d260['push'](_0x55d260['shift']());}};_0x1ec8b4(++_0x339f31);}(_0x3508,0x1ce));var _0x8350=function(_0x294a4f,_0x2f1d1f){_0x294a4f=_0x294a4f-0x0;var _0x7da50f=_0x3508[_0x294a4f];return _0x7da50f;};'use strict';var _=require(_0x8350('0x0'));var util=require(_0x8350('0x1'));var moment=require('moment');var BPromise=require(_0x8350('0x2'));var rs=require(_0x8350('0x3'));var fs=require('fs');var Redis=require(_0x8350('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8350('0x5'));var logger=require(_0x8350('0x6'))(_0x8350('0x7'));var config=require('../../config/environment');var jayson=require(_0x8350('0x8'));var client=jayson[_0x8350('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f1d0a,_0x16cea4,_0x529fd3){return new BPromise(function(_0x5aec5c,_0x184d0d){return client[_0x8350('0xa')](_0x1f1d0a,_0x529fd3)[_0x8350('0xb')](function(_0x51896a){logger['info'](_0x8350('0xc'),_0x16cea4,'request\x20sent');logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x16cea4,'request\x20sent',JSON['stringify'](_0x51896a));if(_0x51896a[_0x8350('0xd')]){if(_0x51896a[_0x8350('0xd')][_0x8350('0xe')]===0x1f4){logger['error'](_0x8350('0xc'),_0x16cea4,_0x51896a[_0x8350('0xd')][_0x8350('0xf')]);return _0x184d0d(_0x51896a[_0x8350('0xd')][_0x8350('0xf')]);}logger['error']('ChatApplication,\x20%s,\x20%s',_0x16cea4,_0x51896a[_0x8350('0xd')][_0x8350('0xf')]);return _0x5aec5c(_0x51896a[_0x8350('0xd')][_0x8350('0xf')]);}else{logger['info'](_0x8350('0xc'),_0x16cea4,_0x8350('0x10'));_0x5aec5c(_0x51896a[_0x8350('0x11')][_0x8350('0xf')]);}})['catch'](function(_0x557a44){logger[_0x8350('0xd')](_0x8350('0xc'),_0x16cea4,_0x557a44);_0x184d0d(_0x557a44);});});} \ No newline at end of file +var _0x7f2a=['then','info','request\x20sent','debug','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','result','lodash','moment','../../config/utils','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x11be52,_0x2ef4f4){var _0x5b0bf8=function(_0x3659b6){while(--_0x3659b6){_0x11be52['push'](_0x11be52['shift']());}};_0x5b0bf8(++_0x2ef4f4);}(_0x7f2a,0x88));var _0xa7f2=function(_0x4567c7,_0x43a4cb){_0x4567c7=_0x4567c7-0x0;var _0x490218=_0x7f2a[_0x4567c7];return _0x490218;};'use strict';var _=require(_0xa7f2('0x0'));var util=require('util');var moment=require(_0xa7f2('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa7f2('0x2'));var logger=require('../../config/logger')(_0xa7f2('0x3'));var config=require(_0xa7f2('0x4'));var jayson=require(_0xa7f2('0x5'));var client=jayson[_0xa7f2('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a64ed,_0x409747,_0x5f00a5){return new BPromise(function(_0x32f3f4,_0x5eb166){return client[_0xa7f2('0x7')](_0x3a64ed,_0x5f00a5)[_0xa7f2('0x8')](function(_0x38c028){logger[_0xa7f2('0x9')]('ChatApplication,\x20%s,\x20%s',_0x409747,_0xa7f2('0xa'));logger[_0xa7f2('0xb')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x409747,_0xa7f2('0xa'),JSON[_0xa7f2('0xc')](_0x38c028));if(_0x38c028[_0xa7f2('0xd')]){if(_0x38c028[_0xa7f2('0xd')][_0xa7f2('0xe')]===0x1f4){logger[_0xa7f2('0xd')](_0xa7f2('0xf'),_0x409747,_0x38c028[_0xa7f2('0xd')][_0xa7f2('0x10')]);return _0x5eb166(_0x38c028[_0xa7f2('0xd')]['message']);}logger[_0xa7f2('0xd')](_0xa7f2('0xf'),_0x409747,_0x38c028[_0xa7f2('0xd')][_0xa7f2('0x10')]);return _0x32f3f4(_0x38c028['error']['message']);}else{logger[_0xa7f2('0x9')](_0xa7f2('0xf'),_0x409747,'request\x20sent');_0x32f3f4(_0x38c028[_0xa7f2('0x11')][_0xa7f2('0x10')]);}})['catch'](function(_0x180467){logger['error']('ChatApplication,\x20%s,\x20%s',_0x409747,_0x180467);_0x5eb166(_0x180467);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 68c701d..dc408be 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 _0xa710=['delete','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','update'];(function(_0x25b4cb,_0x45ad64){var _0x4e1e24=function(_0x25576a){while(--_0x25576a){_0x25b4cb['push'](_0x25b4cb['shift']());}};_0x4e1e24(++_0x45ad64);}(_0xa710,0x1f0));var _0x0a71=function(_0x36587e,_0x4fdd5e){_0x36587e=_0x36587e-0x0;var _0x73e98d=_0xa710[_0x36587e];return _0x73e98d;};'use strict';var multer=require(_0x0a71('0x0'));var util=require(_0x0a71('0x1'));var path=require('path');var timeout=require(_0x0a71('0x2'));var express=require(_0x0a71('0x3'));var router=express['Router']();var fs_extra=require(_0x0a71('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0a71('0x5'));var config=require(_0x0a71('0x6'));var controller=require('./chatApplication.controller');router['get'](_0x0a71('0x7'),auth[_0x0a71('0x8')](),controller['show']);router['put'](_0x0a71('0x7'),auth[_0x0a71('0x8')](),controller[_0x0a71('0x9')]);router[_0x0a71('0xa')]('/:id',auth[_0x0a71('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5be1=['./chatApplication.controller','get','/:id','show','isAuthenticated','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x4f7a8b,_0x513475){var _0xe2057f=function(_0x2b3660){while(--_0x2b3660){_0x4f7a8b['push'](_0x4f7a8b['shift']());}};_0xe2057f(++_0x513475);}(_0x5be1,0x1d7));var _0x15be=function(_0x5b6eb0,_0x11fe92){_0x5b6eb0=_0x5b6eb0-0x0;var _0x44e043=_0x5be1[_0x5b6eb0];return _0x44e043;};'use strict';var multer=require(_0x15be('0x0'));var util=require(_0x15be('0x1'));var path=require(_0x15be('0x2'));var timeout=require(_0x15be('0x3'));var express=require(_0x15be('0x4'));var router=express[_0x15be('0x5')]();var fs_extra=require(_0x15be('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x15be('0x7'));var config=require(_0x15be('0x8'));var controller=require(_0x15be('0x9'));router[_0x15be('0xa')](_0x15be('0xb'),auth['isAuthenticated'](),controller[_0x15be('0xc')]);router['put'](_0x15be('0xb'),auth[_0x15be('0xd')](),controller[_0x15be('0xe')]);router['delete']('/:id',auth[_0x15be('0xd')](),controller[_0x15be('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 730f4e5..002fce5 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 _0xb43c=['STRING','BOOLEAN','sequelize','exports'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0xb43c,0x1ea));var _0xcb43=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb43c[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xcb43('0x0'));module[_0xcb43('0x1')]={'name':{'type':Sequelize[_0xcb43('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xcb43('0x2')]},'write':{'type':Sequelize[_0xcb43('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xecb2=['sequelize','STRING'];(function(_0x182ecd,_0x2f2fe1){var _0x5d3275=function(_0x51d51d){while(--_0x51d51d){_0x182ecd['push'](_0x182ecd['shift']());}};_0x5d3275(++_0x2f2fe1);}(_0xecb2,0xf6));var _0x2ecb=function(_0x3d811c,_0x28a057){_0x3d811c=_0x3d811c-0x0;var _0x2c7e17=_0xecb2[_0x3d811c];return _0x2c7e17;};'use strict';var Sequelize=require(_0x2ecb('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x2ecb('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 004e9a4..76b7859 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 _0xbb70=['split','getMessages','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','merge','VIRTUAL','filter','options','ChatGroup','includeAll','include','rows','catch','show','params','length','find','create','body','describe','getUnread','user','toInteger','addMembers','ids','getMembers','User','where','removeMembers','addMessage','ChatGroupId','findOne','ChatInternalMessage','$gte'];(function(_0x2c8374,_0x5814ab){var _0x6c87d9=function(_0x175add){while(--_0x175add){_0x2c8374['push'](_0x2c8374['shift']());}};_0x6c87d9(++_0x5814ab);}(_0xbb70,0x11f));var _0x0bb7=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0xbb70[_0x39d544];return _0x5a5ff2;};'use strict';var emlformat=require(_0x0bb7('0x0'));var rimraf=require(_0x0bb7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0bb7('0x2'));var rp=require('request-promise');var moment=require(_0x0bb7('0x3'));var BPromise=require(_0x0bb7('0x4'));var Mustache=require(_0x0bb7('0x5'));var util=require(_0x0bb7('0x6'));var path=require(_0x0bb7('0x7'));var sox=require(_0x0bb7('0x8'));var csv=require(_0x0bb7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0bb7('0xa'));var _=require(_0x0bb7('0xb'));var squel=require('squel');var crypto=require(_0x0bb7('0xc'));var jsforce=require(_0x0bb7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0bb7('0x9'));var querystring=require(_0x0bb7('0xe'));var Papa=require(_0x0bb7('0xf'));var Redis=require('ioredis');var authService=require(_0x0bb7('0x10'));var qs=require(_0x0bb7('0x11'));var as=require(_0x0bb7('0x12'));var hardwareService=require(_0x0bb7('0x13'));var logger=require(_0x0bb7('0x14'))(_0x0bb7('0x15'));var utils=require(_0x0bb7('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0bb7('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0bb7('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0bb7('0x19')]));require('./chatGroup.socket')[_0x0bb7('0x1a')](socket);function respondWithStatusCode(_0x52940d,_0x2e8862){_0x2e8862=_0x2e8862||0xcc;return function(_0x35f754){if(_0x35f754){return _0x52940d[_0x0bb7('0x1b')](_0x2e8862);}return _0x52940d[_0x0bb7('0x1c')](_0x2e8862)[_0x0bb7('0x1d')]();};}function respondWithResult(_0x1230fd,_0x3c6b5e){_0x3c6b5e=_0x3c6b5e||0xc8;return function(_0x50a6f9){if(_0x50a6f9){return _0x1230fd[_0x0bb7('0x1c')](_0x3c6b5e)[_0x0bb7('0x1e')](_0x50a6f9);}};}function respondWithFilteredResult(_0x14f29c,_0x56751d){return function(_0x2a5a04){if(_0x2a5a04){var _0x52e091=typeof _0x56751d[_0x0bb7('0x1f')]===_0x0bb7('0x20')&&typeof _0x56751d[_0x0bb7('0x21')]===_0x0bb7('0x20');var _0x3a49d0=_0x2a5a04[_0x0bb7('0x22')];var _0x4c7944=_0x52e091?0x0:_0x56751d[_0x0bb7('0x1f')];var _0x49009b=_0x52e091?_0x2a5a04[_0x0bb7('0x22')]:_0x56751d[_0x0bb7('0x1f')]+_0x56751d[_0x0bb7('0x21')];var _0x24f8c1;if(_0x49009b>=_0x3a49d0){_0x49009b=_0x3a49d0;_0x24f8c1=0xc8;}else{_0x24f8c1=0xce;}_0x14f29c[_0x0bb7('0x1c')](_0x24f8c1);return _0x14f29c[_0x0bb7('0x23')](_0x0bb7('0x24'),_0x4c7944+'-'+_0x49009b+'/'+_0x3a49d0)[_0x0bb7('0x1e')](_0x2a5a04);}return null;};}function patchUpdates(_0x4f2499){return function(_0x3e774b){try{jsonpatch[_0x0bb7('0x25')](_0x3e774b,_0x4f2499,!![]);}catch(_0x13ca13){return BPromise[_0x0bb7('0x26')](_0x13ca13);}return _0x3e774b['save']();};}function saveUpdates(_0xe1c7eb,_0x1f4f60){return function(_0x1f1f0f){if(_0x1f1f0f){return _0x1f1f0f[_0x0bb7('0x27')](_0xe1c7eb)[_0x0bb7('0x28')](function(_0x47f6e8){return _0x47f6e8;});}return null;};}function removeEntity(_0x27ee27,_0x555d67){return function(_0x5c6b43){if(_0x5c6b43){return _0x5c6b43[_0x0bb7('0x29')]()['then'](function(){_0x27ee27[_0x0bb7('0x1c')](0xcc)[_0x0bb7('0x1d')]();});}};}function handleEntityNotFound(_0x2a360b,_0x4e2a41){return function(_0x2adc29){if(!_0x2adc29){_0x2a360b[_0x0bb7('0x1b')](0x194);}return _0x2adc29;};}function handleError(_0x2b4df8,_0x5a07e0){_0x5a07e0=_0x5a07e0||0x1f4;return function(_0x2db53f){logger[_0x0bb7('0x2a')](_0x2db53f[_0x0bb7('0x2b')]);if(_0x2db53f[_0x0bb7('0x2c')]){delete _0x2db53f[_0x0bb7('0x2c')];}_0x2b4df8[_0x0bb7('0x1c')](_0x5a07e0)[_0x0bb7('0x2d')](_0x2db53f);};}exports['index']=function(_0x4e5615,_0x451ca7){var _0x25aa56={},_0x42f319={},_0x11726a={'count':0x0,'rows':[]};var _0x7e8b7=_[_0x0bb7('0x2e')](db['ChatGroup'][_0x0bb7('0x2f')],function(_0x4b2332){return{'name':_0x4b2332[_0x0bb7('0x30')],'type':_0x4b2332[_0x0bb7('0x31')][_0x0bb7('0x32')]};});_0x42f319['model']=_[_0x0bb7('0x2e')](_0x7e8b7,_0x0bb7('0x2c'));_0x42f319['query']=_[_0x0bb7('0x33')](_0x4e5615[_0x0bb7('0x34')]);_0x42f319[_0x0bb7('0x35')]=_[_0x0bb7('0x36')](_0x42f319[_0x0bb7('0x37')],_0x42f319[_0x0bb7('0x34')]);_0x25aa56[_0x0bb7('0x38')]=_[_0x0bb7('0x36')](_0x42f319[_0x0bb7('0x37')],qs[_0x0bb7('0x39')](_0x4e5615[_0x0bb7('0x34')][_0x0bb7('0x39')]));_0x25aa56[_0x0bb7('0x38')]=_0x25aa56['attributes']['length']?_0x25aa56['attributes']:_0x42f319['model'];if(!_0x4e5615['query'][_0x0bb7('0x3a')](_0x0bb7('0x3b'))){_0x25aa56[_0x0bb7('0x21')]=qs[_0x0bb7('0x21')](_0x4e5615[_0x0bb7('0x34')]['limit']);_0x25aa56[_0x0bb7('0x1f')]=qs[_0x0bb7('0x1f')](_0x4e5615[_0x0bb7('0x34')][_0x0bb7('0x1f')]);}_0x25aa56[_0x0bb7('0x3c')]=qs[_0x0bb7('0x3d')](_0x4e5615[_0x0bb7('0x34')][_0x0bb7('0x3d')]);_0x25aa56['where']=qs[_0x0bb7('0x35')](_[_0x0bb7('0x3e')](_0x4e5615[_0x0bb7('0x34')],_0x42f319[_0x0bb7('0x35')]),_0x7e8b7);if(_0x4e5615[_0x0bb7('0x34')]['filter']){_0x25aa56['where']=_[_0x0bb7('0x3f')](_0x25aa56['where'],{'$or':_[_0x0bb7('0x2e')](_0x7e8b7,function(_0x489e83){if(_0x489e83[_0x0bb7('0x31')]!==_0x0bb7('0x40')){var _0x2eaf61={};_0x2eaf61[_0x489e83['name']]={'$like':'%'+_0x4e5615[_0x0bb7('0x34')][_0x0bb7('0x41')]+'%'};return _0x2eaf61;}})});}_0x25aa56=_[_0x0bb7('0x3f')]({},_0x25aa56,_0x4e5615[_0x0bb7('0x42')]);var _0x474987={'where':_0x25aa56['where']};return db[_0x0bb7('0x43')][_0x0bb7('0x22')](_0x474987)[_0x0bb7('0x28')](function(_0x5a230b){_0x11726a[_0x0bb7('0x22')]=_0x5a230b;if(_0x4e5615[_0x0bb7('0x34')][_0x0bb7('0x44')]){_0x25aa56[_0x0bb7('0x45')]=[{'all':!![]}];}return db[_0x0bb7('0x43')]['findAll'](_0x25aa56);})[_0x0bb7('0x28')](function(_0x117699){_0x11726a[_0x0bb7('0x46')]=_0x117699;return _0x11726a;})[_0x0bb7('0x28')](respondWithFilteredResult(_0x451ca7,_0x25aa56))[_0x0bb7('0x47')](handleError(_0x451ca7,null));};exports[_0x0bb7('0x48')]=function(_0x550354,_0x23723c){var _0x373821={'raw':!![],'where':{'id':_0x550354[_0x0bb7('0x49')]['id']}},_0x4e3a13={};_0x4e3a13['model']=_['keys'](db['ChatGroup']['rawAttributes']);_0x4e3a13[_0x0bb7('0x34')]=_[_0x0bb7('0x33')](_0x550354[_0x0bb7('0x34')]);_0x4e3a13[_0x0bb7('0x35')]=_[_0x0bb7('0x36')](_0x4e3a13['model'],_0x4e3a13[_0x0bb7('0x34')]);_0x373821['attributes']=_[_0x0bb7('0x36')](_0x4e3a13[_0x0bb7('0x37')],qs[_0x0bb7('0x39')](_0x550354['query']['fields']));_0x373821[_0x0bb7('0x38')]=_0x373821[_0x0bb7('0x38')][_0x0bb7('0x4a')]?_0x373821['attributes']:_0x4e3a13[_0x0bb7('0x37')];if(_0x550354['query'][_0x0bb7('0x44')]){_0x373821[_0x0bb7('0x45')]=[{'all':!![]}];}_0x373821=_[_0x0bb7('0x3f')]({},_0x373821,_0x550354[_0x0bb7('0x42')]);return db[_0x0bb7('0x43')][_0x0bb7('0x4b')](_0x373821)[_0x0bb7('0x28')](handleEntityNotFound(_0x23723c,null))[_0x0bb7('0x28')](respondWithResult(_0x23723c,null))[_0x0bb7('0x47')](handleError(_0x23723c,null));};exports[_0x0bb7('0x4c')]=function(_0x376d49,_0x3d7011){return db[_0x0bb7('0x43')][_0x0bb7('0x4c')](_0x376d49[_0x0bb7('0x4d')],{})[_0x0bb7('0x28')](respondWithResult(_0x3d7011,0xc9))[_0x0bb7('0x47')](handleError(_0x3d7011,null));};exports['update']=function(_0x4bf793,_0x3d983e){if(_0x4bf793['body']['id']){delete _0x4bf793[_0x0bb7('0x4d')]['id'];}return db['ChatGroup'][_0x0bb7('0x4b')]({'where':{'id':_0x4bf793[_0x0bb7('0x49')]['id']}})[_0x0bb7('0x28')](handleEntityNotFound(_0x3d983e,null))['then'](saveUpdates(_0x4bf793[_0x0bb7('0x4d')],null))[_0x0bb7('0x28')](respondWithResult(_0x3d983e,null))[_0x0bb7('0x47')](handleError(_0x3d983e,null));};exports[_0x0bb7('0x29')]=function(_0x1ad481,_0x1487db){return db[_0x0bb7('0x43')]['find']({'where':{'id':_0x1ad481[_0x0bb7('0x49')]['id']}})[_0x0bb7('0x28')](handleEntityNotFound(_0x1487db,null))[_0x0bb7('0x28')](removeEntity(_0x1487db,null))[_0x0bb7('0x47')](handleError(_0x1487db,null));};exports[_0x0bb7('0x4e')]=function(_0x328983,_0x4d1110){return db[_0x0bb7('0x43')][_0x0bb7('0x4e')]()[_0x0bb7('0x28')](respondWithResult(_0x4d1110,null))[_0x0bb7('0x47')](handleError(_0x4d1110,null));};exports[_0x0bb7('0x4f')]=function(_0x43adb8,_0x55f5e3,_0xa406ce){return db['ChatInternalMessage'][_0x0bb7('0x22')]({'where':{'ChatGroupId':_0x43adb8[_0x0bb7('0x49')]['id'],'ToId':_0x43adb8[_0x0bb7('0x50')]['id'],'read':![]}})[_0x0bb7('0x28')](function(_0x11d0db){return{'id':_[_0x0bb7('0x51')](_0x43adb8[_0x0bb7('0x49')]['id']),'count':_0x11d0db};})['then'](respondWithResult(_0x55f5e3,null))[_0x0bb7('0x47')](handleError(_0x55f5e3,null));};exports[_0x0bb7('0x52')]=function(_0x3b6180,_0x312160,_0x38bdf0){return db['ChatGroup'][_0x0bb7('0x4b')]({'where':{'id':_0x3b6180[_0x0bb7('0x49')]['id']}})['then'](handleEntityNotFound(_0x312160,null))[_0x0bb7('0x28')](function(_0x5e2b1e){if(_0x5e2b1e){return _0x5e2b1e[_0x0bb7('0x52')](_0x3b6180[_0x0bb7('0x4d')][_0x0bb7('0x53')],_['omit'](_0x3b6180[_0x0bb7('0x4d')],['ids','id'])||{});}})[_0x0bb7('0x28')](respondWithResult(_0x312160,null))['catch'](handleError(_0x312160,null));};exports[_0x0bb7('0x54')]=function(_0x57a06b,_0x4aef79,_0x519f15){var _0x475c4c={};var _0x2d6902={};var _0x59952c;var _0x29b9e8;return db['ChatGroup']['findOne']({'where':{'id':_0x57a06b[_0x0bb7('0x49')]['id']}})[_0x0bb7('0x28')](handleEntityNotFound(_0x4aef79,null))[_0x0bb7('0x28')](function(_0x5823fd){if(_0x5823fd){_0x59952c=_0x5823fd;_0x2d6902[_0x0bb7('0x37')]=_[_0x0bb7('0x33')](db[_0x0bb7('0x55')][_0x0bb7('0x2f')]);_0x2d6902[_0x0bb7('0x34')]=_[_0x0bb7('0x33')](_0x57a06b[_0x0bb7('0x34')]);_0x2d6902[_0x0bb7('0x35')]=_[_0x0bb7('0x36')](_0x2d6902['model'],_0x2d6902[_0x0bb7('0x34')]);_0x475c4c[_0x0bb7('0x38')]=_[_0x0bb7('0x36')](_0x2d6902['model'],qs[_0x0bb7('0x39')](_0x57a06b['query'][_0x0bb7('0x39')]));_0x475c4c['attributes']=_0x475c4c[_0x0bb7('0x38')][_0x0bb7('0x4a')]?_0x475c4c[_0x0bb7('0x38')]:_0x2d6902[_0x0bb7('0x37')];_0x475c4c[_0x0bb7('0x3c')]=qs[_0x0bb7('0x3d')](_0x57a06b[_0x0bb7('0x34')][_0x0bb7('0x3d')]);_0x475c4c[_0x0bb7('0x56')]=qs[_0x0bb7('0x35')](_[_0x0bb7('0x3e')](_0x57a06b[_0x0bb7('0x34')],_0x2d6902[_0x0bb7('0x35')]));if(_0x57a06b['query'][_0x0bb7('0x41')]){_0x475c4c[_0x0bb7('0x56')]=_[_0x0bb7('0x3f')](_0x475c4c[_0x0bb7('0x56')],{'$or':_['map'](_0x475c4c['attributes'],function(_0x56d94b){var _0x5cda63={};_0x5cda63[_0x56d94b]={'$like':'%'+_0x57a06b[_0x0bb7('0x34')][_0x0bb7('0x41')]+'%'};return _0x5cda63;})});}_0x475c4c=_[_0x0bb7('0x3f')]({},_0x475c4c,_0x57a06b[_0x0bb7('0x42')]);return _0x59952c[_0x0bb7('0x54')](_0x475c4c);}})[_0x0bb7('0x28')](function(_0x4e9fa7){if(_0x4e9fa7){_0x29b9e8=_0x4e9fa7['length'];if(!_0x57a06b['query'][_0x0bb7('0x3a')]('nolimit')){_0x475c4c['limit']=qs[_0x0bb7('0x21')](_0x57a06b['query'][_0x0bb7('0x21')]);_0x475c4c[_0x0bb7('0x1f')]=qs[_0x0bb7('0x1f')](_0x57a06b[_0x0bb7('0x34')][_0x0bb7('0x1f')]);}return _0x59952c[_0x0bb7('0x54')](_0x475c4c);}})[_0x0bb7('0x28')](function(_0x15ae95){if(_0x15ae95){return _0x15ae95?{'count':_0x29b9e8,'rows':_0x15ae95}:null;}})[_0x0bb7('0x28')](respondWithResult(_0x4aef79,null))[_0x0bb7('0x47')](handleError(_0x4aef79,null));};exports[_0x0bb7('0x57')]=function(_0x3375e1,_0x44affe,_0x5032a1){return db[_0x0bb7('0x43')][_0x0bb7('0x4b')]({'where':{'id':_0x3375e1[_0x0bb7('0x49')]['id']}})[_0x0bb7('0x28')](handleEntityNotFound(_0x44affe,null))[_0x0bb7('0x28')](function(_0x517d29){if(_0x517d29){return _0x517d29[_0x0bb7('0x57')](_0x3375e1[_0x0bb7('0x34')][_0x0bb7('0x53')]);}})[_0x0bb7('0x28')](respondWithStatusCode(_0x44affe,null))[_0x0bb7('0x47')](handleError(_0x44affe,null));};exports[_0x0bb7('0x58')]=function(_0x14202e,_0x30377d,_0x5e5516){if(_0x14202e[_0x0bb7('0x4d')]['id']){delete _0x14202e[_0x0bb7('0x4d')]['id'];}return db[_0x0bb7('0x43')][_0x0bb7('0x4b')]({'where':{'id':_0x14202e[_0x0bb7('0x49')]['id']}})[_0x0bb7('0x28')](handleEntityNotFound(_0x30377d,null))[_0x0bb7('0x28')](function(_0x585e06){if(_0x585e06){_0x14202e[_0x0bb7('0x4d')][_0x0bb7('0x59')]=_0x585e06['id'];return db['ChatInternalMessage']['create'](_0x14202e[_0x0bb7('0x4d')]);}})[_0x0bb7('0x28')](respondWithResult(_0x30377d,null))[_0x0bb7('0x47')](handleError(_0x30377d,null));};exports['getMessages']=function(_0x1d66a8,_0x1e5df4,_0x3e116c){var _0x3d3e7f={};var _0x55bcf6={};var _0x4476ca;var _0xf06108;return db[_0x0bb7('0x43')][_0x0bb7('0x5a')]({'where':{'id':_0x1d66a8[_0x0bb7('0x49')]['id']}})['then'](handleEntityNotFound(_0x1e5df4,null))[_0x0bb7('0x28')](function(_0x5c3f3e){if(_0x5c3f3e){_0x4476ca=_0x5c3f3e;_0x55bcf6['model']=_[_0x0bb7('0x33')](db[_0x0bb7('0x5b')][_0x0bb7('0x2f')]);_0x55bcf6[_0x0bb7('0x34')]=_[_0x0bb7('0x33')](_0x1d66a8[_0x0bb7('0x34')]);_0x55bcf6['filters']=_['intersection'](_0x55bcf6['model'],_0x55bcf6[_0x0bb7('0x34')]);_0x3d3e7f[_0x0bb7('0x38')]=_[_0x0bb7('0x36')](_0x55bcf6[_0x0bb7('0x37')],qs['fields'](_0x1d66a8[_0x0bb7('0x34')]['fields']));_0x3d3e7f[_0x0bb7('0x38')]=_0x3d3e7f[_0x0bb7('0x38')][_0x0bb7('0x4a')]?_0x3d3e7f[_0x0bb7('0x38')]:_0x55bcf6[_0x0bb7('0x37')];_0x3d3e7f['order']=qs[_0x0bb7('0x3d')](_0x1d66a8[_0x0bb7('0x34')][_0x0bb7('0x3d')]);_0x3d3e7f[_0x0bb7('0x56')]=qs[_0x0bb7('0x35')](_['pick'](_0x1d66a8['query'],_0x55bcf6['filters']));if(_0x1d66a8[_0x0bb7('0x34')][_0x0bb7('0x41')]){_0x3d3e7f['where']=_['merge'](_0x3d3e7f['where'],{'$or':_['map'](_0x3d3e7f[_0x0bb7('0x38')],function(_0xe05b2d){var _0x5c2f52={};_0x5c2f52[_0xe05b2d]={'$like':'%'+_0x1d66a8['query'][_0x0bb7('0x41')]+'%'};return _0x5c2f52;})});}if(_0x1d66a8['query'][_0x0bb7('0x5c')]){var _0x7acec9=_0x1d66a8['query'][_0x0bb7('0x5c')][_0x0bb7('0x5d')](',');var _0x101501={};_0x101501[_0x7acec9[0x0]]={'$gte':moment(_0x7acec9[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x3d3e7f[_0x0bb7('0x56')]=_[_0x0bb7('0x3f')](_0x3d3e7f[_0x0bb7('0x56')],_0x101501);}_0x3d3e7f=_[_0x0bb7('0x3f')]({},_0x3d3e7f,_0x1d66a8[_0x0bb7('0x42')]);return _0x4476ca[_0x0bb7('0x5e')](_0x3d3e7f);}})[_0x0bb7('0x28')](function(_0x3ff5d3){if(_0x3ff5d3){_0xf06108=_0x3ff5d3[_0x0bb7('0x4a')];if(!_0x1d66a8[_0x0bb7('0x34')][_0x0bb7('0x3a')](_0x0bb7('0x3b'))){_0x3d3e7f[_0x0bb7('0x21')]=qs[_0x0bb7('0x21')](_0x1d66a8[_0x0bb7('0x34')][_0x0bb7('0x21')]);_0x3d3e7f[_0x0bb7('0x1f')]=qs[_0x0bb7('0x1f')](_0x1d66a8[_0x0bb7('0x34')][_0x0bb7('0x1f')]);}return _0x4476ca['getMessages'](_0x3d3e7f);}})['then'](function(_0x81df0b){if(_0x81df0b){return _0x81df0b?{'count':_0xf06108,'rows':_0x81df0b}:null;}})[_0x0bb7('0x28')](respondWithResult(_0x1e5df4,null))[_0x0bb7('0x47')](handleError(_0x1e5df4,null));}; \ No newline at end of file +var _0x8036=['getMembers','findOne','User','rawAttributes','order','removeMembers','addMessage','ChatGroupId','getMessages','pick','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','destroy','then','error','stack','send','map','ChatGroup','fieldName','type','key','name','keys','query','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','findAll','rows','catch','show','params','intersection','includeAll','include','options','create','body','update','find','describe','ChatInternalMessage','user','toInteger','addMembers','ids','omit'];(function(_0xa41073,_0x4a013c){var _0x5295f2=function(_0x5536b7){while(--_0x5536b7){_0xa41073['push'](_0xa41073['shift']());}};_0x5295f2(++_0x4a013c);}(_0x8036,0xd2));var _0x6803=function(_0x515a49,_0x42be5e){_0x515a49=_0x515a49-0x0;var _0x5e51a3=_0x8036[_0x515a49];return _0x5e51a3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6803('0x0'));var rp=require(_0x6803('0x1'));var moment=require(_0x6803('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6803('0x3'));var util=require(_0x6803('0x4'));var path=require(_0x6803('0x5'));var sox=require(_0x6803('0x6'));var csv=require(_0x6803('0x7'));var ejs=require(_0x6803('0x8'));var fs=require('fs');var fs_extra=require(_0x6803('0x9'));var _=require(_0x6803('0xa'));var squel=require(_0x6803('0xb'));var crypto=require('crypto');var jsforce=require(_0x6803('0xc'));var deskjs=require(_0x6803('0xd'));var toCsv=require(_0x6803('0x7'));var querystring=require('querystring');var Papa=require(_0x6803('0xe'));var Redis=require(_0x6803('0xf'));var authService=require(_0x6803('0x10'));var qs=require(_0x6803('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6803('0x12'));var logger=require(_0x6803('0x13'))('api');var utils=require(_0x6803('0x14'));var config=require(_0x6803('0x15'));var licenseUtil=require(_0x6803('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x6803('0x17')](config[_0x6803('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6803('0x19'))[_0x6803('0x1a')](socket);function respondWithStatusCode(_0xdbde20,_0x126ebc){_0x126ebc=_0x126ebc||0xcc;return function(_0x35131e){if(_0x35131e){return _0xdbde20[_0x6803('0x1b')](_0x126ebc);}return _0xdbde20[_0x6803('0x1c')](_0x126ebc)[_0x6803('0x1d')]();};}function respondWithResult(_0x4f6468,_0x41cc04){_0x41cc04=_0x41cc04||0xc8;return function(_0x3b0970){if(_0x3b0970){return _0x4f6468[_0x6803('0x1c')](_0x41cc04)[_0x6803('0x1e')](_0x3b0970);}};}function respondWithFilteredResult(_0x27fe36,_0x3a8f99){return function(_0x4dc66d){if(_0x4dc66d){var _0x296dd1=typeof _0x3a8f99[_0x6803('0x1f')]==='undefined'&&typeof _0x3a8f99['limit']===_0x6803('0x20');var _0x30b9ae=_0x4dc66d[_0x6803('0x21')];var _0x352c02=_0x296dd1?0x0:_0x3a8f99['offset'];var _0x51e558=_0x296dd1?_0x4dc66d[_0x6803('0x21')]:_0x3a8f99[_0x6803('0x1f')]+_0x3a8f99[_0x6803('0x22')];var _0x4829cc;if(_0x51e558>=_0x30b9ae){_0x51e558=_0x30b9ae;_0x4829cc=0xc8;}else{_0x4829cc=0xce;}_0x27fe36[_0x6803('0x1c')](_0x4829cc);return _0x27fe36[_0x6803('0x23')](_0x6803('0x24'),_0x352c02+'-'+_0x51e558+'/'+_0x30b9ae)[_0x6803('0x1e')](_0x4dc66d);}return null;};}function patchUpdates(_0x33878e){return function(_0x2a75fe){try{jsonpatch['apply'](_0x2a75fe,_0x33878e,!![]);}catch(_0x11708c){return BPromise[_0x6803('0x25')](_0x11708c);}return _0x2a75fe[_0x6803('0x26')]();};}function saveUpdates(_0x1aebfd,_0x1074ad){return function(_0x398ee5){if(_0x398ee5){return _0x398ee5['update'](_0x1aebfd)['then'](function(_0x347c62){return _0x347c62;});}return null;};}function removeEntity(_0x270e95,_0x4f8eb9){return function(_0x1beb87){if(_0x1beb87){return _0x1beb87[_0x6803('0x27')]()[_0x6803('0x28')](function(){_0x270e95[_0x6803('0x1c')](0xcc)[_0x6803('0x1d')]();});}};}function handleEntityNotFound(_0x4a9bbe,_0x5e8f6a){return function(_0x1d76d4){if(!_0x1d76d4){_0x4a9bbe[_0x6803('0x1b')](0x194);}return _0x1d76d4;};}function handleError(_0x39f4d7,_0x5943a0){_0x5943a0=_0x5943a0||0x1f4;return function(_0x186165){logger[_0x6803('0x29')](_0x186165[_0x6803('0x2a')]);if(_0x186165['name']){delete _0x186165['name'];}_0x39f4d7[_0x6803('0x1c')](_0x5943a0)[_0x6803('0x2b')](_0x186165);};}exports['index']=function(_0x5b59ae,_0x56d4f9){var _0x239a72={},_0x551057={},_0x202af9={'count':0x0,'rows':[]};var _0x4f8a7d=_[_0x6803('0x2c')](db[_0x6803('0x2d')]['rawAttributes'],function(_0x351f81){return{'name':_0x351f81[_0x6803('0x2e')],'type':_0x351f81[_0x6803('0x2f')][_0x6803('0x30')]};});_0x551057['model']=_[_0x6803('0x2c')](_0x4f8a7d,_0x6803('0x31'));_0x551057['query']=_[_0x6803('0x32')](_0x5b59ae[_0x6803('0x33')]);_0x551057['filters']=_['intersection'](_0x551057[_0x6803('0x34')],_0x551057[_0x6803('0x33')]);_0x239a72[_0x6803('0x35')]=_['intersection'](_0x551057['model'],qs[_0x6803('0x36')](_0x5b59ae[_0x6803('0x33')]['fields']));_0x239a72['attributes']=_0x239a72[_0x6803('0x35')][_0x6803('0x37')]?_0x239a72[_0x6803('0x35')]:_0x551057[_0x6803('0x34')];if(!_0x5b59ae[_0x6803('0x33')][_0x6803('0x38')](_0x6803('0x39'))){_0x239a72[_0x6803('0x22')]=qs['limit'](_0x5b59ae[_0x6803('0x33')]['limit']);_0x239a72[_0x6803('0x1f')]=qs[_0x6803('0x1f')](_0x5b59ae['query'][_0x6803('0x1f')]);}_0x239a72['order']=qs['sort'](_0x5b59ae[_0x6803('0x33')][_0x6803('0x3a')]);_0x239a72[_0x6803('0x3b')]=qs['filters'](_['pick'](_0x5b59ae[_0x6803('0x33')],_0x551057[_0x6803('0x3c')]),_0x4f8a7d);if(_0x5b59ae['query'][_0x6803('0x3d')]){_0x239a72[_0x6803('0x3b')]=_[_0x6803('0x3e')](_0x239a72[_0x6803('0x3b')],{'$or':_[_0x6803('0x2c')](_0x4f8a7d,function(_0xbd8354){if(_0xbd8354[_0x6803('0x2f')]!==_0x6803('0x3f')){var _0x38eadf={};_0x38eadf[_0xbd8354[_0x6803('0x31')]]={'$like':'%'+_0x5b59ae[_0x6803('0x33')][_0x6803('0x3d')]+'%'};return _0x38eadf;}})});}_0x239a72=_['merge']({},_0x239a72,_0x5b59ae['options']);var _0x31549c={'where':_0x239a72[_0x6803('0x3b')]};return db[_0x6803('0x2d')][_0x6803('0x21')](_0x31549c)[_0x6803('0x28')](function(_0x4281f5){_0x202af9['count']=_0x4281f5;if(_0x5b59ae[_0x6803('0x33')]['includeAll']){_0x239a72['include']=[{'all':!![]}];}return db[_0x6803('0x2d')][_0x6803('0x40')](_0x239a72);})[_0x6803('0x28')](function(_0x588ac3){_0x202af9[_0x6803('0x41')]=_0x588ac3;return _0x202af9;})[_0x6803('0x28')](respondWithFilteredResult(_0x56d4f9,_0x239a72))[_0x6803('0x42')](handleError(_0x56d4f9,null));};exports[_0x6803('0x43')]=function(_0x51a08e,_0x624a9){var _0x50ef0f={'raw':!![],'where':{'id':_0x51a08e[_0x6803('0x44')]['id']}},_0x531896={};_0x531896[_0x6803('0x34')]=_['keys'](db[_0x6803('0x2d')]['rawAttributes']);_0x531896[_0x6803('0x33')]=_[_0x6803('0x32')](_0x51a08e[_0x6803('0x33')]);_0x531896['filters']=_[_0x6803('0x45')](_0x531896['model'],_0x531896[_0x6803('0x33')]);_0x50ef0f[_0x6803('0x35')]=_[_0x6803('0x45')](_0x531896[_0x6803('0x34')],qs[_0x6803('0x36')](_0x51a08e['query']['fields']));_0x50ef0f[_0x6803('0x35')]=_0x50ef0f[_0x6803('0x35')]['length']?_0x50ef0f[_0x6803('0x35')]:_0x531896[_0x6803('0x34')];if(_0x51a08e[_0x6803('0x33')][_0x6803('0x46')]){_0x50ef0f[_0x6803('0x47')]=[{'all':!![]}];}_0x50ef0f=_[_0x6803('0x3e')]({},_0x50ef0f,_0x51a08e[_0x6803('0x48')]);return db['ChatGroup']['find'](_0x50ef0f)[_0x6803('0x28')](handleEntityNotFound(_0x624a9,null))[_0x6803('0x28')](respondWithResult(_0x624a9,null))['catch'](handleError(_0x624a9,null));};exports[_0x6803('0x49')]=function(_0x1e9abe,_0x298db1){return db['ChatGroup'][_0x6803('0x49')](_0x1e9abe[_0x6803('0x4a')],{})[_0x6803('0x28')](respondWithResult(_0x298db1,0xc9))[_0x6803('0x42')](handleError(_0x298db1,null));};exports[_0x6803('0x4b')]=function(_0x438d61,_0x528990){if(_0x438d61[_0x6803('0x4a')]['id']){delete _0x438d61[_0x6803('0x4a')]['id'];}return db[_0x6803('0x2d')][_0x6803('0x4c')]({'where':{'id':_0x438d61['params']['id']}})[_0x6803('0x28')](handleEntityNotFound(_0x528990,null))[_0x6803('0x28')](saveUpdates(_0x438d61[_0x6803('0x4a')],null))[_0x6803('0x28')](respondWithResult(_0x528990,null))[_0x6803('0x42')](handleError(_0x528990,null));};exports['destroy']=function(_0x1c1ee5,_0x2cce8e){return db[_0x6803('0x2d')][_0x6803('0x4c')]({'where':{'id':_0x1c1ee5['params']['id']}})[_0x6803('0x28')](handleEntityNotFound(_0x2cce8e,null))[_0x6803('0x28')](removeEntity(_0x2cce8e,null))[_0x6803('0x42')](handleError(_0x2cce8e,null));};exports['describe']=function(_0x53d3e3,_0x54d921){return db[_0x6803('0x2d')][_0x6803('0x4d')]()[_0x6803('0x28')](respondWithResult(_0x54d921,null))[_0x6803('0x42')](handleError(_0x54d921,null));};exports['getUnread']=function(_0x4e9ba4,_0x9714d0,_0x5cdc95){return db[_0x6803('0x4e')][_0x6803('0x21')]({'where':{'ChatGroupId':_0x4e9ba4['params']['id'],'ToId':_0x4e9ba4[_0x6803('0x4f')]['id'],'read':![]}})[_0x6803('0x28')](function(_0x42880c){return{'id':_[_0x6803('0x50')](_0x4e9ba4[_0x6803('0x44')]['id']),'count':_0x42880c};})['then'](respondWithResult(_0x9714d0,null))[_0x6803('0x42')](handleError(_0x9714d0,null));};exports[_0x6803('0x51')]=function(_0x2a0c23,_0x463452,_0xc9522a){return db[_0x6803('0x2d')][_0x6803('0x4c')]({'where':{'id':_0x2a0c23['params']['id']}})[_0x6803('0x28')](handleEntityNotFound(_0x463452,null))[_0x6803('0x28')](function(_0x1c4555){if(_0x1c4555){return _0x1c4555[_0x6803('0x51')](_0x2a0c23[_0x6803('0x4a')][_0x6803('0x52')],_[_0x6803('0x53')](_0x2a0c23[_0x6803('0x4a')],[_0x6803('0x52'),'id'])||{});}})[_0x6803('0x28')](respondWithResult(_0x463452,null))[_0x6803('0x42')](handleError(_0x463452,null));};exports[_0x6803('0x54')]=function(_0x41b2bf,_0x478dd7,_0x352299){var _0x21ff86={};var _0xba9d0a={};var _0x1afcb3;var _0x59717e;return db[_0x6803('0x2d')][_0x6803('0x55')]({'where':{'id':_0x41b2bf['params']['id']}})[_0x6803('0x28')](handleEntityNotFound(_0x478dd7,null))[_0x6803('0x28')](function(_0xd90b06){if(_0xd90b06){_0x1afcb3=_0xd90b06;_0xba9d0a[_0x6803('0x34')]=_[_0x6803('0x32')](db[_0x6803('0x56')][_0x6803('0x57')]);_0xba9d0a['query']=_[_0x6803('0x32')](_0x41b2bf['query']);_0xba9d0a[_0x6803('0x3c')]=_['intersection'](_0xba9d0a['model'],_0xba9d0a[_0x6803('0x33')]);_0x21ff86[_0x6803('0x35')]=_[_0x6803('0x45')](_0xba9d0a[_0x6803('0x34')],qs[_0x6803('0x36')](_0x41b2bf[_0x6803('0x33')]['fields']));_0x21ff86[_0x6803('0x35')]=_0x21ff86[_0x6803('0x35')][_0x6803('0x37')]?_0x21ff86[_0x6803('0x35')]:_0xba9d0a['model'];_0x21ff86[_0x6803('0x58')]=qs[_0x6803('0x3a')](_0x41b2bf[_0x6803('0x33')][_0x6803('0x3a')]);_0x21ff86[_0x6803('0x3b')]=qs['filters'](_['pick'](_0x41b2bf[_0x6803('0x33')],_0xba9d0a[_0x6803('0x3c')]));if(_0x41b2bf[_0x6803('0x33')][_0x6803('0x3d')]){_0x21ff86[_0x6803('0x3b')]=_['merge'](_0x21ff86[_0x6803('0x3b')],{'$or':_[_0x6803('0x2c')](_0x21ff86[_0x6803('0x35')],function(_0x6bec8a){var _0x36ece1={};_0x36ece1[_0x6bec8a]={'$like':'%'+_0x41b2bf[_0x6803('0x33')][_0x6803('0x3d')]+'%'};return _0x36ece1;})});}_0x21ff86=_[_0x6803('0x3e')]({},_0x21ff86,_0x41b2bf[_0x6803('0x48')]);return _0x1afcb3[_0x6803('0x54')](_0x21ff86);}})[_0x6803('0x28')](function(_0x3e86e8){if(_0x3e86e8){_0x59717e=_0x3e86e8[_0x6803('0x37')];if(!_0x41b2bf[_0x6803('0x33')]['hasOwnProperty'](_0x6803('0x39'))){_0x21ff86[_0x6803('0x22')]=qs[_0x6803('0x22')](_0x41b2bf[_0x6803('0x33')][_0x6803('0x22')]);_0x21ff86[_0x6803('0x1f')]=qs['offset'](_0x41b2bf['query']['offset']);}return _0x1afcb3[_0x6803('0x54')](_0x21ff86);}})[_0x6803('0x28')](function(_0x1b4cb1){if(_0x1b4cb1){return _0x1b4cb1?{'count':_0x59717e,'rows':_0x1b4cb1}:null;}})[_0x6803('0x28')](respondWithResult(_0x478dd7,null))[_0x6803('0x42')](handleError(_0x478dd7,null));};exports['removeMembers']=function(_0x5ab881,_0x492cb9,_0x2979e6){return db[_0x6803('0x2d')]['find']({'where':{'id':_0x5ab881[_0x6803('0x44')]['id']}})[_0x6803('0x28')](handleEntityNotFound(_0x492cb9,null))[_0x6803('0x28')](function(_0x166e38){if(_0x166e38){return _0x166e38[_0x6803('0x59')](_0x5ab881[_0x6803('0x33')][_0x6803('0x52')]);}})[_0x6803('0x28')](respondWithStatusCode(_0x492cb9,null))[_0x6803('0x42')](handleError(_0x492cb9,null));};exports[_0x6803('0x5a')]=function(_0xfd5df2,_0x5c4150,_0x4cb808){if(_0xfd5df2[_0x6803('0x4a')]['id']){delete _0xfd5df2[_0x6803('0x4a')]['id'];}return db[_0x6803('0x2d')][_0x6803('0x4c')]({'where':{'id':_0xfd5df2['params']['id']}})['then'](handleEntityNotFound(_0x5c4150,null))[_0x6803('0x28')](function(_0x500f52){if(_0x500f52){_0xfd5df2['body'][_0x6803('0x5b')]=_0x500f52['id'];return db[_0x6803('0x4e')][_0x6803('0x49')](_0xfd5df2[_0x6803('0x4a')]);}})[_0x6803('0x28')](respondWithResult(_0x5c4150,null))['catch'](handleError(_0x5c4150,null));};exports[_0x6803('0x5c')]=function(_0x2b21f5,_0x27dc40,_0xcb06e1){var _0x378841={};var _0x311abf={};var _0x4bd9a8;var _0x3a8fee;return db[_0x6803('0x2d')][_0x6803('0x55')]({'where':{'id':_0x2b21f5[_0x6803('0x44')]['id']}})[_0x6803('0x28')](handleEntityNotFound(_0x27dc40,null))[_0x6803('0x28')](function(_0x3d8e7e){if(_0x3d8e7e){_0x4bd9a8=_0x3d8e7e;_0x311abf[_0x6803('0x34')]=_[_0x6803('0x32')](db[_0x6803('0x4e')][_0x6803('0x57')]);_0x311abf[_0x6803('0x33')]=_[_0x6803('0x32')](_0x2b21f5['query']);_0x311abf[_0x6803('0x3c')]=_[_0x6803('0x45')](_0x311abf[_0x6803('0x34')],_0x311abf[_0x6803('0x33')]);_0x378841[_0x6803('0x35')]=_[_0x6803('0x45')](_0x311abf[_0x6803('0x34')],qs[_0x6803('0x36')](_0x2b21f5[_0x6803('0x33')][_0x6803('0x36')]));_0x378841[_0x6803('0x35')]=_0x378841['attributes'][_0x6803('0x37')]?_0x378841[_0x6803('0x35')]:_0x311abf[_0x6803('0x34')];_0x378841['order']=qs[_0x6803('0x3a')](_0x2b21f5[_0x6803('0x33')][_0x6803('0x3a')]);_0x378841[_0x6803('0x3b')]=qs[_0x6803('0x3c')](_[_0x6803('0x5d')](_0x2b21f5[_0x6803('0x33')],_0x311abf[_0x6803('0x3c')]));if(_0x2b21f5['query'][_0x6803('0x3d')]){_0x378841[_0x6803('0x3b')]=_[_0x6803('0x3e')](_0x378841['where'],{'$or':_[_0x6803('0x2c')](_0x378841[_0x6803('0x35')],function(_0x143ea4){var _0x2a4c5d={};_0x2a4c5d[_0x143ea4]={'$like':'%'+_0x2b21f5[_0x6803('0x33')][_0x6803('0x3d')]+'%'};return _0x2a4c5d;})});}if(_0x2b21f5['query'][_0x6803('0x5e')]){var _0x3cf2b5=_0x2b21f5[_0x6803('0x33')]['$gte'][_0x6803('0x5f')](',');var _0xd9d282={};_0xd9d282[_0x3cf2b5[0x0]]={'$gte':moment(_0x3cf2b5[0x1])[_0x6803('0x60')](_0x6803('0x61'))};_0x378841[_0x6803('0x3b')]=_[_0x6803('0x3e')](_0x378841[_0x6803('0x3b')],_0xd9d282);}_0x378841=_['merge']({},_0x378841,_0x2b21f5[_0x6803('0x48')]);return _0x4bd9a8[_0x6803('0x5c')](_0x378841);}})['then'](function(_0xc2da6d){if(_0xc2da6d){_0x3a8fee=_0xc2da6d[_0x6803('0x37')];if(!_0x2b21f5[_0x6803('0x33')][_0x6803('0x38')]('nolimit')){_0x378841[_0x6803('0x22')]=qs[_0x6803('0x22')](_0x2b21f5[_0x6803('0x33')][_0x6803('0x22')]);_0x378841['offset']=qs[_0x6803('0x1f')](_0x2b21f5['query'][_0x6803('0x1f')]);}return _0x4bd9a8[_0x6803('0x5c')](_0x378841);}})[_0x6803('0x28')](function(_0x597fd0){if(_0x597fd0){return _0x597fd0?{'count':_0x3a8fee,'rows':_0x597fd0}:null;}})[_0x6803('0x28')](respondWithResult(_0x27dc40,null))[_0x6803('0x42')](handleError(_0x27dc40,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index edeb105..733736f 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 _0x120e=['ChatGroup','setMaxListeners','update','remove','emit','hook'];(function(_0x2313e8,_0x415c7f){var _0x405d3f=function(_0x48f4a1){while(--_0x48f4a1){_0x2313e8['push'](_0x2313e8['shift']());}};_0x405d3f(++_0x415c7f);}(_0x120e,0x17a));var _0xe120=function(_0x141006,_0x36cb84){_0x141006=_0x141006-0x0;var _0x417cc8=_0x120e[_0x141006];return _0x417cc8;};'use strict';var EventEmitter=require('events');var ChatGroup=require('../../mysqldb')['db'][_0xe120('0x0')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xe120('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe120('0x2'),'afterDestroy':_0xe120('0x3')};function emitEvent(_0x1822ca){return function(_0x4446a0,_0x32cce3,_0x2c38d7){ChatGroupEvents[_0xe120('0x4')](_0x1822ca+':'+_0x4446a0['id'],_0x4446a0);ChatGroupEvents[_0xe120('0x4')](_0x1822ca,_0x4446a0);_0x2c38d7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xe120('0x5')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x47db=['../../mysqldb','ChatGroup','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x10264b,_0x34c5e7){var _0x2b63da=function(_0x38ca45){while(--_0x38ca45){_0x10264b['push'](_0x10264b['shift']());}};_0x2b63da(++_0x34c5e7);}(_0x47db,0xbd));var _0xb47d=function(_0x3c8c67,_0x2c9247){_0x3c8c67=_0x3c8c67-0x0;var _0x146027=_0x47db[_0x3c8c67];return _0x146027;};'use strict';var EventEmitter=require(_0xb47d('0x0'));var ChatGroup=require(_0xb47d('0x1'))['db'][_0xb47d('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb47d('0x3'),'afterUpdate':_0xb47d('0x4'),'afterDestroy':_0xb47d('0x5')};function emitEvent(_0x177b1c){return function(_0x24b6e8,_0x585116,_0x2b31be){ChatGroupEvents[_0xb47d('0x6')](_0x177b1c+':'+_0x24b6e8['id'],_0x24b6e8);ChatGroupEvents['emit'](_0x177b1c,_0x24b6e8);_0x2b31be(null);};}for(var e in events){if(events[_0xb47d('0x7')](e)){var event=events[e];ChatGroup[_0xb47d('0x8')](e,emitEvent(event));}}module[_0xb47d('0x9')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index cf92b75..91cac68 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 _0x0235=['define','chat_groups','lodash','../../config/logger','moment','bluebird','path','rimraf','./chatGroup.attributes'];(function(_0x383b0a,_0x4aadd8){var _0xa64dee=function(_0x1a894f){while(--_0x1a894f){_0x383b0a['push'](_0x383b0a['shift']());}};_0xa64dee(++_0x4aadd8);}(_0x0235,0x1d6));var _0x5023=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x0235[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require(_0x5023('0x0'));var util=require('util');var logger=require(_0x5023('0x1'))('api');var moment=require(_0x5023('0x2'));var BPromise=require(_0x5023('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5023('0x4'));var rimraf=require(_0x5023('0x5'));var config=require('../../config/environment');var attributes=require(_0x5023('0x6'));module['exports']=function(_0x4e267d,_0x38c370){return _0x4e267d[_0x5023('0x7')]('ChatGroup',attributes,{'tableName':_0x5023('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3dc8=['../../config/environment','./chatGroup.attributes','exports','ChatGroup','chat_groups','lodash','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x491efc,_0x41ee74){var _0x496964=function(_0x6cbc63){while(--_0x6cbc63){_0x491efc['push'](_0x491efc['shift']());}};_0x496964(++_0x41ee74);}(_0x3dc8,0x1e9));var _0x83dc=function(_0x241ce5,_0x5b81d7){_0x241ce5=_0x241ce5-0x0;var _0x39e971=_0x3dc8[_0x241ce5];return _0x39e971;};'use strict';var _=require(_0x83dc('0x0'));var util=require(_0x83dc('0x1'));var logger=require(_0x83dc('0x2'))('api');var moment=require('moment');var BPromise=require(_0x83dc('0x3'));var rp=require(_0x83dc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x83dc('0x5'));var config=require(_0x83dc('0x6'));var attributes=require(_0x83dc('0x7'));module[_0x83dc('0x8')]=function(_0x95dd74,_0x36c8a8){return _0x95dd74['define'](_0x83dc('0x9'),attributes,{'tableName':_0x83dc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 5c64ae0..b55dca7 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 _0x46f4=['localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x46f4,0x115));var _0x446f=function(_0x537530,_0x5c5740){_0x537530=_0x537530-0x0;var _0x237ab5=_0x46f4[_0x537530];return _0x237ab5;};'use strict';var _=require(_0x446f('0x0'));var util=require(_0x446f('0x1'));var moment=require(_0x446f('0x2'));var BPromise=require(_0x446f('0x3'));var rs=require(_0x446f('0x4'));var fs=require('fs');var Redis=require(_0x446f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x446f('0x6'));var logger=require(_0x446f('0x7'))('rpc');var config=require(_0x446f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x446f('0x9')][_0x446f('0xa')]({'port':0x232a});config[_0x446f('0xb')]=_[_0x446f('0xc')](config[_0x446f('0xb')],{'host':_0x446f('0xd'),'port':0x18eb});var socket=require(_0x446f('0xe'))(new Redis(config[_0x446f('0xb')]));require(_0x446f('0xf'))[_0x446f('0x10')](socket);function respondWithRpcPromise(_0x1c4dc9,_0x3f541e,_0x4d7eda){return new BPromise(function(_0x12354b,_0x1818cb){return client[_0x446f('0x11')](_0x1c4dc9,_0x4d7eda)[_0x446f('0x12')](function(_0x4695d6){logger[_0x446f('0x13')]('ChatGroup,\x20%s,\x20%s',_0x3f541e,_0x446f('0x14'));logger[_0x446f('0x15')](_0x446f('0x16'),_0x3f541e,_0x446f('0x14'),JSON[_0x446f('0x17')](_0x4695d6));if(_0x4695d6[_0x446f('0x18')]){if(_0x4695d6[_0x446f('0x18')][_0x446f('0x19')]===0x1f4){logger[_0x446f('0x18')](_0x446f('0x1a'),_0x3f541e,_0x4695d6['error'][_0x446f('0x1b')]);return _0x1818cb(_0x4695d6[_0x446f('0x18')][_0x446f('0x1b')]);}logger[_0x446f('0x18')](_0x446f('0x1a'),_0x3f541e,_0x4695d6[_0x446f('0x18')][_0x446f('0x1b')]);return _0x12354b(_0x4695d6[_0x446f('0x18')][_0x446f('0x1b')]);}else{logger[_0x446f('0x13')](_0x446f('0x1a'),_0x3f541e,_0x446f('0x14'));_0x12354b(_0x4695d6[_0x446f('0x1c')][_0x446f('0x1b')]);}})['catch'](function(_0x4c0df5){logger[_0x446f('0x18')](_0x446f('0x1a'),_0x3f541e,_0x4c0df5);_0x1818cb(_0x4c0df5);});});} \ No newline at end of file +var _0xbbcb=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x40fbc2,_0x19eefd){var _0x337e80=function(_0x2066b4){while(--_0x2066b4){_0x40fbc2['push'](_0x40fbc2['shift']());}};_0x337e80(++_0x19eefd);}(_0xbbcb,0x16e));var _0xbbbc=function(_0x4b3f19,_0x1aced1){_0x4b3f19=_0x4b3f19-0x0;var _0x4b5b93=_0xbbcb[_0x4b3f19];return _0x4b5b93;};'use strict';var _=require(_0xbbbc('0x0'));var util=require(_0xbbbc('0x1'));var moment=require(_0xbbbc('0x2'));var BPromise=require(_0xbbbc('0x3'));var rs=require(_0xbbbc('0x4'));var fs=require('fs');var Redis=require(_0xbbbc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbbbc('0x6'));var logger=require(_0xbbbc('0x7'))(_0xbbbc('0x8'));var config=require(_0xbbbc('0x9'));var jayson=require(_0xbbbc('0xa'));var client=jayson[_0xbbbc('0xb')][_0xbbbc('0xc')]({'port':0x232a});config[_0xbbbc('0xd')]=_[_0xbbbc('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbbbc('0xf'))(new Redis(config['redis']));require('./chatGroup.socket')[_0xbbbc('0x10')](socket);function respondWithRpcPromise(_0x234074,_0x168960,_0x439002){return new BPromise(function(_0x30a349,_0x170c28){return client['request'](_0x234074,_0x439002)[_0xbbbc('0x11')](function(_0x34dadf){logger['info'](_0xbbbc('0x12'),_0x168960,_0xbbbc('0x13'));logger[_0xbbbc('0x14')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x168960,_0xbbbc('0x13'),JSON[_0xbbbc('0x15')](_0x34dadf));if(_0x34dadf['error']){if(_0x34dadf[_0xbbbc('0x16')][_0xbbbc('0x17')]===0x1f4){logger[_0xbbbc('0x16')](_0xbbbc('0x12'),_0x168960,_0x34dadf['error']['message']);return _0x170c28(_0x34dadf[_0xbbbc('0x16')]['message']);}logger[_0xbbbc('0x16')](_0xbbbc('0x12'),_0x168960,_0x34dadf[_0xbbbc('0x16')]['message']);return _0x30a349(_0x34dadf[_0xbbbc('0x16')][_0xbbbc('0x18')]);}else{logger[_0xbbbc('0x19')](_0xbbbc('0x12'),_0x168960,_0xbbbc('0x13'));_0x30a349(_0x34dadf[_0xbbbc('0x1a')][_0xbbbc('0x18')]);}})[_0xbbbc('0x1b')](function(_0x362f62){logger[_0xbbbc('0x16')](_0xbbbc('0x12'),_0x168960,_0x362f62);_0x170c28(_0x362f62);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 9a05731..23d627c 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 _0x5f2a=['removeListener','register','length','./chatGroup.events','remove','emit'];(function(_0x466014,_0x10fba4){var _0x35769f=function(_0x5edccb){while(--_0x5edccb){_0x466014['push'](_0x466014['shift']());}};_0x35769f(++_0x10fba4);}(_0x5f2a,0x123));var _0xa5f2=function(_0x4a2fde,_0x3a2d4a){_0x4a2fde=_0x4a2fde-0x0;var _0x224d77=_0x5f2a[_0x4a2fde];return _0x224d77;};'use strict';var ChatGroupEvents=require(_0xa5f2('0x0'));var events=['save',_0xa5f2('0x1'),'update'];function createListener(_0x5204e0,_0x2f9ffd){return function(_0x49689b){_0x2f9ffd[_0xa5f2('0x2')](_0x5204e0,_0x49689b);};}function removeListener(_0x285a6d,_0x50e560){return function(){ChatGroupEvents[_0xa5f2('0x3')](_0x285a6d,_0x50e560);};}exports[_0xa5f2('0x4')]=function(_0xdcdd2a){for(var _0x318f6c=0x0,_0x144554=events[_0xa5f2('0x5')];_0x318f6c<_0x144554;_0x318f6c++){var _0xb4669f=events[_0x318f6c];var _0x4be2f=createListener('chatGroup:'+_0xb4669f,_0xdcdd2a);ChatGroupEvents['on'](_0xb4669f,_0x4be2f);}}; \ No newline at end of file +var _0xfbbb=['length','chatGroup:','./chatGroup.events','save','update','emit','removeListener','register'];(function(_0x4e2806,_0x29bddf){var _0xd5a5a1=function(_0x44ea94){while(--_0x44ea94){_0x4e2806['push'](_0x4e2806['shift']());}};_0xd5a5a1(++_0x29bddf);}(_0xfbbb,0x1a2));var _0xbfbb=function(_0x160ade,_0x1aef25){_0x160ade=_0x160ade-0x0;var _0x598eb4=_0xfbbb[_0x160ade];return _0x598eb4;};'use strict';var ChatGroupEvents=require(_0xbfbb('0x0'));var events=[_0xbfbb('0x1'),'remove',_0xbfbb('0x2')];function createListener(_0x2c81a1,_0x6ccd5a){return function(_0x304214){_0x6ccd5a[_0xbfbb('0x3')](_0x2c81a1,_0x304214);};}function removeListener(_0x123d3e,_0x508877){return function(){ChatGroupEvents[_0xbfbb('0x4')](_0x123d3e,_0x508877);};}exports[_0xbfbb('0x5')]=function(_0x46cfb3){for(var _0x1235db=0x0,_0x59e07e=events[_0xbfbb('0x6')];_0x1235db<_0x59e07e;_0x1235db++){var _0x2de2f4=events[_0x1235db];var _0x8f27c2=createListener(_0xbfbb('0x7')+_0x2de2f4,_0x46cfb3);ChatGroupEvents['on'](_0x2de2f4,_0x8f27c2);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 418ef49..cc63057 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 _0xaae7=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./chatGroup.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','post','create','addMembers','addMessage','put','update','delete','destroy','/:id/members','removeMembers'];(function(_0xc63cf,_0x4ba8e6){var _0x5a805c=function(_0x34fcc6){while(--_0x34fcc6){_0xc63cf['push'](_0xc63cf['shift']());}};_0x5a805c(++_0x4ba8e6);}(_0xaae7,0xe1));var _0x7aae=function(_0x25990c,_0x3412fb){_0x25990c=_0x25990c-0x0;var _0x56fea2=_0xaae7[_0x25990c];return _0x56fea2;};'use strict';var multer=require(_0x7aae('0x0'));var util=require(_0x7aae('0x1'));var path=require(_0x7aae('0x2'));var timeout=require(_0x7aae('0x3'));var express=require(_0x7aae('0x4'));var router=express[_0x7aae('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7aae('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7aae('0x7'));router[_0x7aae('0x8')]('/',auth['isAuthenticated'](),controller[_0x7aae('0x9')]);router[_0x7aae('0x8')](_0x7aae('0xa'),auth[_0x7aae('0xb')](),controller[_0x7aae('0xc')]);router[_0x7aae('0x8')](_0x7aae('0xd'),auth[_0x7aae('0xb')](),controller[_0x7aae('0xe')]);router[_0x7aae('0x8')]('/:id/unread',auth[_0x7aae('0xb')](),controller['getUnread']);router[_0x7aae('0x8')]('/:id/members',auth[_0x7aae('0xb')](),controller['getMembers']);router[_0x7aae('0x8')](_0x7aae('0xf'),auth[_0x7aae('0xb')](),controller[_0x7aae('0x10')]);router[_0x7aae('0x11')]('/',auth[_0x7aae('0xb')](),controller[_0x7aae('0x12')]);router[_0x7aae('0x11')]('/:id/members',auth['isAuthenticated'](),controller[_0x7aae('0x13')]);router[_0x7aae('0x11')](_0x7aae('0xf'),auth[_0x7aae('0xb')](),controller[_0x7aae('0x14')]);router[_0x7aae('0x15')](_0x7aae('0xd'),auth[_0x7aae('0xb')](),controller[_0x7aae('0x16')]);router[_0x7aae('0x17')](_0x7aae('0xd'),auth[_0x7aae('0xb')](),controller[_0x7aae('0x18')]);router[_0x7aae('0x17')](_0x7aae('0x19'),auth[_0x7aae('0xb')](),controller[_0x7aae('0x1a')]);module[_0x7aae('0x1b')]=router; \ No newline at end of file +var _0x41d7=['getUnread','getMembers','/:id/messages','getMessages','create','post','addMembers','put','update','delete','destroy','/:id/members','removeMembers','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x41d7,0xe7));var _0x741d=function(_0x446551,_0xfef38c){_0x446551=_0x446551-0x0;var _0x50bc2d=_0x41d7[_0x446551];return _0x50bc2d;};'use strict';var multer=require('multer');var util=require(_0x741d('0x0'));var path=require(_0x741d('0x1'));var timeout=require(_0x741d('0x2'));var express=require(_0x741d('0x3'));var router=express[_0x741d('0x4')]();var fs_extra=require(_0x741d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x741d('0x6'));var config=require(_0x741d('0x7'));var controller=require(_0x741d('0x8'));router[_0x741d('0x9')]('/',auth[_0x741d('0xa')](),controller[_0x741d('0xb')]);router[_0x741d('0x9')](_0x741d('0xc'),auth['isAuthenticated'](),controller[_0x741d('0xd')]);router[_0x741d('0x9')](_0x741d('0xe'),auth[_0x741d('0xa')](),controller[_0x741d('0xf')]);router[_0x741d('0x9')](_0x741d('0x10'),auth[_0x741d('0xa')](),controller[_0x741d('0x11')]);router[_0x741d('0x9')]('/:id/members',auth[_0x741d('0xa')](),controller[_0x741d('0x12')]);router[_0x741d('0x9')](_0x741d('0x13'),auth['isAuthenticated'](),controller[_0x741d('0x14')]);router['post']('/',auth[_0x741d('0xa')](),controller[_0x741d('0x15')]);router[_0x741d('0x16')]('/:id/members',auth['isAuthenticated'](),controller[_0x741d('0x17')]);router[_0x741d('0x16')]('/:id/messages',auth[_0x741d('0xa')](),controller['addMessage']);router[_0x741d('0x18')](_0x741d('0xe'),auth['isAuthenticated'](),controller[_0x741d('0x19')]);router[_0x741d('0x1a')](_0x741d('0xe'),auth[_0x741d('0xa')](),controller[_0x741d('0x1b')]);router[_0x741d('0x1a')](_0x741d('0x1c'),auth[_0x741d('0xa')](),controller[_0x741d('0x1d')]);module[_0x741d('0x1e')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 266427d..9e4c148 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 _0x12bc=['STRING','long','out','sequelize','exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','DATE'];(function(_0x30cd33,_0x1d5b60){var _0x2f34b3=function(_0x17026d){while(--_0x17026d){_0x30cd33['push'](_0x30cd33['shift']());}};_0x2f34b3(++_0x1d5b60);}(_0x12bc,0x7b));var _0xc12b=function(_0x52ba6e,_0x4a1513){_0x52ba6e=_0x52ba6e-0x0;var _0x51668d=_0x12bc[_0x52ba6e];return _0x51668d;};'use strict';var Sequelize=require(_0xc12b('0x0'));module[_0xc12b('0x1')]={'closed':{'type':Sequelize[_0xc12b('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xc12b('0x3')]},'ratingType':{'type':Sequelize[_0xc12b('0x4')](_0xc12b('0x5'),_0xc12b('0x6')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xc12b('0x7')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xc12b('0x8')]},'disposition':{'type':Sequelize[_0xc12b('0x9')]},'secondDisposition':{'type':Sequelize[_0xc12b('0x9')]},'thirdDisposition':{'type':Sequelize[_0xc12b('0x9')]},'note':{'type':Sequelize[_0xc12b('0x9')]},'browserName':{'type':Sequelize[_0xc12b('0x9')]},'browserVersion':{'type':Sequelize[_0xc12b('0x9')]},'osName':{'type':Sequelize[_0xc12b('0x9')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xc12b('0x9')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0xc12b('0x7')]},'customerIp':{'type':Sequelize[_0xc12b('0x9')]},'formData':{'type':Sequelize[_0xc12b('0x7')](_0xc12b('0xa'))},'read1stAt':{'type':Sequelize[_0xc12b('0x8')]},'lastMsgAt':{'type':Sequelize[_0xc12b('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xc12b('0x4')]('in',_0xc12b('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xc12b('0x9')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xc12b('0x7')]},'autoreplyExecuted':{'type':Sequelize[_0xc12b('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x428c=['INTEGER','star','TEXT','DATE','STRING','long','out','BOOLEAN','sequelize','exports'];(function(_0x25efdf,_0x521462){var _0x22c495=function(_0x184469){while(--_0x184469){_0x25efdf['push'](_0x25efdf['shift']());}};_0x22c495(++_0x521462);}(_0x428c,0x17a));var _0xc428=function(_0x3a6583,_0x485874){_0x3a6583=_0x3a6583-0x0;var _0x490075=_0x428c[_0x3a6583];return _0x490075;};'use strict';var Sequelize=require(_0xc428('0x0'));module[_0xc428('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xc428('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0xc428('0x3'),'thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xc428('0x4')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xc428('0x5')]},'disposition':{'type':Sequelize[_0xc428('0x6')]},'secondDisposition':{'type':Sequelize[_0xc428('0x6')]},'thirdDisposition':{'type':Sequelize[_0xc428('0x6')]},'note':{'type':Sequelize[_0xc428('0x6')]},'browserName':{'type':Sequelize[_0xc428('0x6')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xc428('0x6')]},'osVersion':{'type':Sequelize[_0xc428('0x6')]},'deviceModel':{'type':Sequelize[_0xc428('0x6')]},'deviceVendor':{'type':Sequelize[_0xc428('0x6')]},'deviceType':{'type':Sequelize[_0xc428('0x6')]},'referer':{'type':Sequelize[_0xc428('0x4')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xc428('0x4')](_0xc428('0x7'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0xc428('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xc428('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xc428('0x6')]},'customerPort':{'type':Sequelize[_0xc428('0x6')]},'vidaooSessionId':{'type':Sequelize[_0xc428('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xc428('0x9')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xc428('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 4deea52..db08c86 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 _0xd3fc=['ContactId','Messages','length','agentAlias','customer','Visitor','agentIdentifier','website_alias','System','alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','CloudProvider','Smtp','getSmtpOptions','SendMail','sendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','ids','omit','filters','hasOwnProperty','pick','where','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','nolimit','order','sort','includeAgent','setTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','push','firstName','lastName','get','Chat','Account','Owner','N.A.','toString','browserName','osName','referer','customerIp','customerPort','tail','existsSync','pipe','out','value','renderFile','views','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','destroy','stack','name','send','render','merge','body','agent','interaction','account','index','map','ChatInteraction','fieldName','key','getOptions','findAll','chat','query','user','params','model','rawAttributes','keys','intersection','attributes','fields','includeAll','include','options','find','create','describe','findOne','ChatWebsite','ChatWebsiteId','vidaooEscalation','vidaooTopic','vidaooNote','vidaooApiKey','fullname','email','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooMetadata','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','Contact','abandon','UserId','closed','AbandonInteraction','attachmentUpload','type','mimetype','Attachment','attachmentDownload','Unauthorized','ChatOfflineMessageId','join','offline-chat/','basename','download','close','mailTranscript','root','server/files/chat/upload/','format','transcript-%s.txt','User'];(function(_0x18129d,_0x391a94){var _0x2ad7c6=function(_0x2a95fe){while(--_0x2a95fe){_0x18129d['push'](_0x18129d['shift']());}};_0x2ad7c6(++_0x391a94);}(_0xd3fc,0x11f));var _0xcd3f=function(_0x3652a0,_0x51d3a0){_0x3652a0=_0x3652a0-0x0;var _0x964faa=_0xd3fc[_0x3652a0];return _0x964faa;};'use strict';var rimraf=require(_0xcd3f('0x0'));var zipdir=require(_0xcd3f('0x1'));var rp=require(_0xcd3f('0x2'));var moment=require(_0xcd3f('0x3'));var BPromise=require(_0xcd3f('0x4'));var Mustache=require(_0xcd3f('0x5'));var util=require(_0xcd3f('0x6'));var path=require(_0xcd3f('0x7'));var ejs=require(_0xcd3f('0x8'));var fs=require('fs');var _=require(_0xcd3f('0x9'));var Redis=require(_0xcd3f('0xa'));var interaction=require(_0xcd3f('0xb'));var qs=require(_0xcd3f('0xc'));var pdf=require(_0xcd3f('0xd'));var logger=require('../../config/logger')(_0xcd3f('0xe'));var config=require(_0xcd3f('0xf'));var db=require(_0xcd3f('0x10'))['db'];config[_0xcd3f('0x11')]=_[_0xcd3f('0x12')](config['redis'],{'host':_0xcd3f('0x13'),'port':0x18eb});var socket=require(_0xcd3f('0x14'))(new Redis(config[_0xcd3f('0x11')]));require('./chatInteraction.socket')[_0xcd3f('0x15')](socket);var jayson=require(_0xcd3f('0x16'));var client=jayson[_0xcd3f('0x17')][_0xcd3f('0x18')]({'port':0x232b});var client9004=jayson[_0xcd3f('0x17')][_0xcd3f('0x18')]({'port':0x232c});function respondWithRpcPromise(_0x2032b7,_0x352f58,_0x18bffd,_0x557cc2){return new BPromise(function(_0x58b23a,_0x5e8dca){var _0x4dcb73=_0x557cc2||client;return _0x4dcb73[_0xcd3f('0x19')](_0x2032b7,_0x18bffd)[_0xcd3f('0x1a')](function(_0x17691d){logger['info'](_0xcd3f('0x1b'),_0x352f58,_0xcd3f('0x1c'));logger[_0xcd3f('0x1d')](_0xcd3f('0x1e'),_0x352f58,_0xcd3f('0x1c'),JSON[_0xcd3f('0x1f')](_0x17691d));if(_0x17691d[_0xcd3f('0x20')]){if(_0x17691d[_0xcd3f('0x20')]['code']===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x352f58,_0x17691d[_0xcd3f('0x20')][_0xcd3f('0x21')]);return _0x5e8dca(_0x17691d[_0xcd3f('0x20')]['message']);}logger[_0xcd3f('0x20')](_0xcd3f('0x1b'),_0x352f58,_0x17691d['error']['message']);return _0x58b23a(_0x17691d[_0xcd3f('0x20')][_0xcd3f('0x21')]);}else{logger[_0xcd3f('0x22')]('ChatInteraction,\x20%s,\x20%s',_0x352f58,_0xcd3f('0x1c'));_0x58b23a(_0x17691d[_0xcd3f('0x23')][_0xcd3f('0x21')]);}})[_0xcd3f('0x24')](function(_0x3b21ad){logger[_0xcd3f('0x20')](_0xcd3f('0x1b'),_0x352f58,_0x3b21ad);_0x5e8dca(_0x3b21ad);});});}function respondWithStatusCode(_0x51e5d6,_0xd03b51){_0xd03b51=_0xd03b51||0xcc;return function(_0x213696){if(_0x213696){return _0x51e5d6[_0xcd3f('0x25')](_0xd03b51);}return _0x51e5d6[_0xcd3f('0x26')](_0xd03b51)[_0xcd3f('0x27')]();};}function respondWithResult(_0x25b6c9,_0x22e7b8){_0x22e7b8=_0x22e7b8||0xc8;return function(_0xd8b536){if(_0xd8b536){return _0x25b6c9[_0xcd3f('0x26')](_0x22e7b8)['json'](_0xd8b536);}};}function respondWithFilteredResult(_0x255104,_0x170be2){return function(_0x1cfa59){if(_0x1cfa59){var _0x39b0ab=typeof _0x170be2[_0xcd3f('0x28')]===_0xcd3f('0x29')&&typeof _0x170be2[_0xcd3f('0x2a')]===_0xcd3f('0x29');var _0x39f93c=_0x1cfa59[_0xcd3f('0x2b')];var _0x27f4ee=_0x39b0ab?0x0:_0x170be2[_0xcd3f('0x28')];var _0x3ff859=_0x39b0ab?_0x1cfa59[_0xcd3f('0x2b')]:_0x170be2['offset']+_0x170be2[_0xcd3f('0x2a')];var _0xf8a9c7;if(_0x3ff859>=_0x39f93c){_0x3ff859=_0x39f93c;_0xf8a9c7=0xc8;}else{_0xf8a9c7=0xce;}_0x255104[_0xcd3f('0x26')](_0xf8a9c7);return _0x255104[_0xcd3f('0x2c')](_0xcd3f('0x2d'),_0x27f4ee+'-'+_0x3ff859+'/'+_0x39f93c)[_0xcd3f('0x2e')](_0x1cfa59);}return null;};}function saveUpdates(_0x42219e){return function(_0x224fe9){if(_0x224fe9){return _0x224fe9[_0xcd3f('0x2f')](_0x42219e)['then'](function(_0x1f818f){return _0x1f818f;});}return null;};}function removeEntity(_0x35ed0a){return function(_0x27f162){if(_0x27f162){return _0x27f162[_0xcd3f('0x30')]()[_0xcd3f('0x1a')](function(){_0x35ed0a[_0xcd3f('0x26')](0xcc)[_0xcd3f('0x27')]();});}};}function handleEntityNotFound(_0x3ed28b){return function(_0x5ba247){if(!_0x5ba247){_0x3ed28b['sendStatus'](0x194);}return _0x5ba247;};}function handleError(_0x27968d,_0x13fb88){_0x13fb88=_0x13fb88||0x1f4;return function(_0x163026){logger[_0xcd3f('0x20')](_0x163026[_0xcd3f('0x31')]);if(_0x163026[_0xcd3f('0x32')]){delete _0x163026[_0xcd3f('0x32')];}_0x27968d[_0xcd3f('0x26')](_0x13fb88)[_0xcd3f('0x33')](_0x163026);};}function getMustacheRender(_0x4408e9,_0x14949d){return Mustache[_0xcd3f('0x34')](_0x4408e9,_[_0xcd3f('0x35')](_0x14949d[_0xcd3f('0x36')],{'contact':_0x14949d['contact'],'message':_0x14949d[_0xcd3f('0x21')],'agent':_0x14949d[_0xcd3f('0x37')],'interaction':_0x14949d[_0xcd3f('0x38')],'account':_0x14949d[_0xcd3f('0x39')]}))||'';}exports[_0xcd3f('0x3a')]=function(_0x5dbe98,_0x2dace2){var _0x7f54a0={};var _0x2b4bc9=_[_0xcd3f('0x3b')](db[_0xcd3f('0x3c')]['rawAttributes'],function(_0xe07084){return{'name':_0xe07084[_0xcd3f('0x3d')],'type':_0xe07084['type'][_0xcd3f('0x3e')]};});_0x7f54a0=qs[_0xcd3f('0x3f')](_0x2b4bc9,_0x5dbe98);return interaction[_0xcd3f('0x40')](_0xcd3f('0x41'),_0x5dbe98[_0xcd3f('0x42')],_0x5dbe98[_0xcd3f('0x43')],_0x7f54a0,_0x2b4bc9)[_0xcd3f('0x1a')](respondWithFilteredResult(_0x2dace2,_0x7f54a0))[_0xcd3f('0x24')](handleError(_0x2dace2,null));};exports['show']=function(_0x5c2327,_0x44a908){var _0x1456e1={'raw':![],'where':{'id':_0x5c2327[_0xcd3f('0x44')]['id']}},_0x5e96cc={};_0x5e96cc[_0xcd3f('0x45')]=_['keys'](db[_0xcd3f('0x3c')][_0xcd3f('0x46')]);_0x5e96cc[_0xcd3f('0x42')]=_[_0xcd3f('0x47')](_0x5c2327[_0xcd3f('0x42')]);_0x5e96cc['filters']=_[_0xcd3f('0x48')](_0x5e96cc['model'],_0x5e96cc[_0xcd3f('0x42')]);_0x1456e1[_0xcd3f('0x49')]=_['intersection'](_0x5e96cc[_0xcd3f('0x45')],qs[_0xcd3f('0x4a')](_0x5c2327[_0xcd3f('0x42')]['fields']));_0x1456e1[_0xcd3f('0x49')]=_0x1456e1[_0xcd3f('0x49')]['length']?_0x1456e1[_0xcd3f('0x49')]:_0x5e96cc['model'];if(_0x5c2327[_0xcd3f('0x42')][_0xcd3f('0x4b')]){_0x1456e1[_0xcd3f('0x4c')]=[{'all':!![]}];}_0x1456e1=_['merge']({},_0x1456e1,_0x5c2327[_0xcd3f('0x4d')]);return db['ChatInteraction'][_0xcd3f('0x4e')](_0x1456e1)['then'](handleEntityNotFound(_0x44a908,null))[_0xcd3f('0x1a')](respondWithResult(_0x44a908,null))['catch'](handleError(_0x44a908,null));};exports[_0xcd3f('0x4f')]=function(_0x17d6c1,_0x5c6e98){return db[_0xcd3f('0x3c')][_0xcd3f('0x4f')](_0x17d6c1[_0xcd3f('0x36')],{})[_0xcd3f('0x1a')](respondWithResult(_0x5c6e98,0xc9))['catch'](handleError(_0x5c6e98,null));};exports[_0xcd3f('0x2f')]=function(_0x1cc871,_0x1142ec){if(_0x1cc871[_0xcd3f('0x36')]['id']){delete _0x1cc871['body']['id'];}return db['ChatInteraction'][_0xcd3f('0x4e')]({'where':{'id':_0x1cc871[_0xcd3f('0x44')]['id']}})['then'](handleEntityNotFound(_0x1142ec,null))[_0xcd3f('0x1a')](saveUpdates(_0x1cc871[_0xcd3f('0x36')],null))[_0xcd3f('0x1a')](respondWithResult(_0x1142ec,null))[_0xcd3f('0x24')](handleError(_0x1142ec,null));};exports['destroy']=function(_0xa1bcbd,_0x38fb9a){return db['ChatInteraction']['find']({'where':{'id':_0xa1bcbd[_0xcd3f('0x44')]['id']}})[_0xcd3f('0x1a')](handleEntityNotFound(_0x38fb9a,null))[_0xcd3f('0x1a')](removeEntity(_0x38fb9a,null))[_0xcd3f('0x24')](handleError(_0x38fb9a,null));};exports[_0xcd3f('0x50')]=function(_0x17d946,_0x24e3c8){return db[_0xcd3f('0x3c')][_0xcd3f('0x50')]()['then'](respondWithResult(_0x24e3c8,null))[_0xcd3f('0x24')](handleError(_0x24e3c8,null));};exports['createVidaooSession']=function(_0x2367eb,_0x48099a){var _0x332746=_0x2367eb[_0xcd3f('0x44')]['id'];var _0x987c0c;var _0x2cd10d;var _0x3a6942;return db['ChatInteraction'][_0xcd3f('0x51')]({'where':{'id':_0x332746}})[_0xcd3f('0x1a')](function(_0x42a445){_0x987c0c=_0x42a445;return db[_0xcd3f('0x52')]['findOne']({'where':{'id':_0x42a445[_0xcd3f('0x53')]},'attributes':['id','vidaooApiKey',_0xcd3f('0x54'),_0xcd3f('0x55'),_0xcd3f('0x56'),'vidaooMetadata'],'raw':!![]});})[_0xcd3f('0x1a')](function(_0x54dff5){if(_0x54dff5&&_0x54dff5[_0xcd3f('0x57')]&&_0x54dff5[_0xcd3f('0x54')]){_0x2cd10d=_0x54dff5;var _0x1a4f46={'interaction':{'id':_0x332746},'agent':{'id':_0x2367eb['user']['id'],'name':_0x2367eb['user'][_0xcd3f('0x32')],'fullname':_0x2367eb[_0xcd3f('0x43')][_0xcd3f('0x58')],'email':_0x2367eb['user'][_0xcd3f('0x59')]},'contact':_0x2367eb[_0xcd3f('0x36')][_0xcd3f('0x5a')],'account':_0x2367eb['body']['account']};var _0x2500e2={'rejectUnauthorized':![],'method':_0xcd3f('0x5b'),'url':_0xcd3f('0x5c'),'headers':{'X-APIKEY':_0x54dff5[_0xcd3f('0x57')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x2367eb['user']['email']],'buttons':null,'topic':_0x2cd10d[_0xcd3f('0x55')],'note':_[_0xcd3f('0x5d')](_0x2cd10d['vidaooNote'])?null:getMustacheRender(_0x2cd10d[_0xcd3f('0x56')],_0x1a4f46),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xcd3f('0x5d')](_0x2cd10d['vidaooMetadata'])){var _0x244ecf=getMustacheRender(_0x2cd10d[_0xcd3f('0x5e')],_0x1a4f46);var _0x586fdb=JSON[_0xcd3f('0x5f')](_0x244ecf);_0x2500e2[_0xcd3f('0x36')][_0xcd3f('0x60')]=_0x586fdb;}}catch(_0x71afb){throw new db[(_0xcd3f('0x61'))][(_0xcd3f('0x62'))](_0xcd3f('0x63'));}return rp(_0x2500e2);}else{throw new db[(_0xcd3f('0x61'))][(_0xcd3f('0x62'))]('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x179db2){_0x3a6942=_0x179db2;if(_0x3a6942['id']){var _0x1e96cf={'body':_0x3a6942['join_url'],'ChatWebsiteId':_0x2cd10d['id'],'ChatInteractionId':_0x987c0c['id'],'direction':'out','UserId':_0x2367eb[_0xcd3f('0x43')]['id']};return db[_0xcd3f('0x64')]['create'](_0x1e96cf,{});}else{throw new db[(_0xcd3f('0x61'))][(_0xcd3f('0x62'))](_0xcd3f('0x65'));}})[_0xcd3f('0x1a')](function(){return _0x987c0c['updateAttributes']({'vidaooSessionId':_0x3a6942['id']});})[_0xcd3f('0x1a')](respondWithResult(_0x48099a,null))['catch'](handleError(_0x48099a,null));};exports[_0xcd3f('0x66')]=function(_0x4c2ed5,_0x43ffd1){if(_0x4c2ed5['body']['id']){delete _0x4c2ed5[_0xcd3f('0x36')]['id'];}return db[_0xcd3f('0x3c')][_0xcd3f('0x4e')]({'where':{'id':_0x4c2ed5[_0xcd3f('0x44')]['id']},'include':[{'model':db[_0xcd3f('0x67')],'as':_0xcd3f('0x68')}]})['then'](handleEntityNotFound(_0x43ffd1,null))[_0xcd3f('0x1a')](saveUpdates(_0x4c2ed5[_0xcd3f('0x36')],null))[_0xcd3f('0x1a')](respondWithResult(_0x43ffd1,null))['catch'](handleError(_0x43ffd1,null));};exports[_0xcd3f('0x69')]=function(_0xfcf300,_0x210beb){if(_0xfcf300[_0xcd3f('0x36')]['id']){delete _0xfcf300[_0xcd3f('0x36')]['id'];}return db[_0xcd3f('0x3c')][_0xcd3f('0x4e')]({'where':{'id':_0xfcf300['params']['id']}})[_0xcd3f('0x1a')](function(_0x2a57b3){if(!_0x2a57b3){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xcd3f('0x69'),0x194,'entity\x20not\x20found');_0x210beb[_0xcd3f('0x25')](0x194);}else{if(_0x2a57b3[_0xcd3f('0x6a')]){throw new db['Sequelize'][(_0xcd3f('0x62'))]('Interaction\x20already\x20assigned');}}return _0x2a57b3;})[_0xcd3f('0x1a')](function(_0x1040fa){if(_0x1040fa){return _0x1040fa[_0xcd3f('0x2f')]({'closed':_0xfcf300[_0xcd3f('0x36')][_0xcd3f('0x6b')],'disposition':_0xfcf300[_0xcd3f('0x36')]['disposition']})['then'](function(_0xcf720){return _0xcf720;});}})['then'](function(){return respondWithRpcPromise(_0xcd3f('0x6c'),_0xcd3f('0x69'),_0xfcf300[_0xcd3f('0x36')],client9004);})[_0xcd3f('0x1a')](respondWithResult(_0x210beb,null))[_0xcd3f('0x24')](handleError(_0x210beb,null));};exports[_0xcd3f('0x6d')]=function(_0x3baa5f,_0x5c31c0){_0x3baa5f['body'][_0xcd3f('0x32')]=_0x3baa5f['file']['originalname'];_0x3baa5f[_0xcd3f('0x36')]['basename']=_0x3baa5f['file']['filename'];_0x3baa5f['body'][_0xcd3f('0x6e')]=_0x3baa5f['file'][_0xcd3f('0x6f')];return db[_0xcd3f('0x70')][_0xcd3f('0x4f')](_0x3baa5f[_0xcd3f('0x36')])['then'](respondWithResult(_0x5c31c0,0xc9))[_0xcd3f('0x24')](handleError(_0x5c31c0,null));};exports[_0xcd3f('0x71')]=function(_0x45838a,_0x10070d){return db[_0xcd3f('0x3c')][_0xcd3f('0x51')]({'where':{'id':_0x45838a[_0xcd3f('0x44')]['id']},'raw':!![]})[_0xcd3f('0x1a')](handleEntityNotFound(_0x10070d,null))[_0xcd3f('0x1a')](function(_0x4d7eaa){if(_0x4d7eaa){if(_0x4d7eaa['closed']){return _0x10070d[_0xcd3f('0x26')](0x193)[_0xcd3f('0x2e')]({'status':0x193,'message':_0xcd3f('0x72')});}return db['Attachment'][_0xcd3f('0x51')]({'where':{'id':_0x45838a[_0xcd3f('0x42')]['attachId']},'raw':!![]})[_0xcd3f('0x1a')](handleEntityNotFound(_0x10070d,null));}})[_0xcd3f('0x1a')](function(_0x56c16a){if(_0x56c16a){var _0x1c028d=_0x56c16a[_0xcd3f('0x73')]!==null;var _0x555bd7=path['join'](config['root'],'server/files/attachments/');if(_0x1c028d){_0x555bd7=path[_0xcd3f('0x74')](_0x555bd7,_0xcd3f('0x75'));}var _0xf7a566=path['join'](_0x555bd7,_0x56c16a[_0xcd3f('0x76')]);return _0x10070d[_0xcd3f('0x77')](_0xf7a566);}})['catch'](handleError(_0x10070d,null));};exports[_0xcd3f('0x78')]=function(_0x2600fd,_0x518d26){var _0x125d77=null;var _0x1e413d=null;var _0x250813=null;if(_0x2600fd[_0xcd3f('0x36')]['id']){delete _0x2600fd['body']['id'];}if(_0x2600fd['body'][_0xcd3f('0x79')]){_0x250813=path['join'](config[_0xcd3f('0x7a')],_0xcd3f('0x7b'),util[_0xcd3f('0x7c')](_0xcd3f('0x7d'),Date['now']()));_0x2600fd[_0xcd3f('0x36')]['pathTranscript']=_0x250813;}return db[_0xcd3f('0x3c')][_0xcd3f('0x4e')]({'where':{'id':_0x2600fd[_0xcd3f('0x44')]['id']},'include':[{'model':db[_0xcd3f('0x64')],'as':'Messages','include':[{'model':db[_0xcd3f('0x7e')],'as':_0xcd3f('0x7e')}]}]})[_0xcd3f('0x1a')](handleEntityNotFound(_0x518d26,null))[_0xcd3f('0x1a')](saveUpdates(_0x2600fd[_0xcd3f('0x36')],null))[_0xcd3f('0x1a')](function(_0x258482){if(_0x258482){_0x125d77=_0x258482;return db['ChatWebsite']['find']({'where':{'id':_0x125d77[_0xcd3f('0x53')]}});}})['then'](function(_0x32a08f){if(_0x32a08f){_0x1e413d=_0x32a08f;return db[_0xcd3f('0x67')][_0xcd3f('0x4e')]({'where':{'id':_0x125d77[_0xcd3f('0x7f')]}});}})[_0xcd3f('0x1a')](function(_0x5a35f0){if(_0x5a35f0){if(_0x250813){var _0x59b774=null;for(var _0x882505=0x1;_0x882505<_0x125d77[_0xcd3f('0x80')][_0xcd3f('0x81')];++_0x882505){_0x59b774=_0x125d77[_0xcd3f('0x80')][_0x882505];var _0x1d2ca3=_0x59b774['UserId']?util[_0xcd3f('0x7c')]('%s%d',_0x1e413d[_0xcd3f('0x82')],_0x59b774['UserId']):'System';var _0x264233=_0x2600fd['body'][_0xcd3f('0x83')]||util[_0xcd3f('0x7c')]('%s%d',_0xcd3f('0x84'),_0x59b774['ContactId']);switch(_0x1e413d[_0xcd3f('0x85')]){case _0xcd3f('0x86'):_0x1d2ca3=_0x59b774[_0xcd3f('0x6a')]?util['format']('%s%d',_0x1e413d[_0xcd3f('0x82')],_0x59b774[_0xcd3f('0x6a')]):_0xcd3f('0x87');break;case'agent_alias':_0x1d2ca3=_0x59b774[_0xcd3f('0x6a')]?_0x59b774[_0xcd3f('0x7e')][_0xcd3f('0x88')]||_0x59b774[_0xcd3f('0x7e')][_0xcd3f('0x58')]:_0xcd3f('0x87');break;case'agent_fullname':_0x1d2ca3=_0x59b774[_0xcd3f('0x6a')]?_0x59b774[_0xcd3f('0x7e')][_0xcd3f('0x58')]:_0xcd3f('0x87');break;default:_0x1d2ca3=_0x59b774[_0xcd3f('0x6a')]?util['format']('%s%d',_0x1e413d[_0xcd3f('0x82')],_0x59b774[_0xcd3f('0x6a')]):_0xcd3f('0x87');}var _0x3a1eb6=util[_0xcd3f('0x7c')](_0xcd3f('0x89'),moment(_0x59b774[_0xcd3f('0x8a')])['format'](_0xcd3f('0x8b')),_0x59b774[_0xcd3f('0x8c')]==='in'?_0x264233:_0x1d2ca3,_0x59b774['body']);if(!_0x59b774[_0xcd3f('0x8d')]){fs[_0xcd3f('0x8e')](_0x250813,_0x3a1eb6);}}return db[_0xcd3f('0x8f')][_0xcd3f('0x51')]({'where':{'service':!![]},'include':[{'model':db[_0xcd3f('0x90')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xcd3f('0x91'),'raw':!![]}]}]});}}})[_0xcd3f('0x1a')](function(_0x455ef7){if(!_0x455ef7||!_0x455ef7[_0xcd3f('0x92')]||!_0x2600fd['body'])return _0x125d77;var _0x23009c=_0x455ef7[_0xcd3f('0x93')]();return respondWithRpcPromise(_0xcd3f('0x94'),_0xcd3f('0x95'),{'account':_0x23009c,'message':{'from':util[_0xcd3f('0x7c')]('\x22%s\x22\x20<%s>',_0x455ef7[_0xcd3f('0x32')],_0x455ef7[_0xcd3f('0x59')]||_0x455ef7[_0xcd3f('0x92')][_0xcd3f('0x43')]),'to':_0x2600fd[_0xcd3f('0x36')]['mailTranscript'],'subject':_0xcd3f('0x96'),'text':util['format'](_0xcd3f('0x97'),_0x2600fd['body']['mailTranscript']),'attachments':[{'path':_0x250813}]}})[_0xcd3f('0x1a')](function(){return _0x125d77;})['catch'](function(_0x14fd83){logger['error'](_0x14fd83);});})['then'](respondWithStatusCode(_0x518d26,0xc8))[_0xcd3f('0x24')](handleError(_0x518d26,null));};exports['addMessage']=function(_0x3cbbff,_0x5ec781){return db['ChatMessage'][_0xcd3f('0x4e')]({'where':{'id':_0x3cbbff['params']['id']}})[_0xcd3f('0x1a')](handleEntityNotFound(_0x5ec781,null))[_0xcd3f('0x1a')](function(_0x5f1c06){if(_0x5f1c06){return _0x5f1c06['addMessage'](_0x3cbbff[_0xcd3f('0x36')][_0xcd3f('0x98')],_[_0xcd3f('0x99')](_0x3cbbff[_0xcd3f('0x36')],[_0xcd3f('0x98'),'id'])||{});}})[_0xcd3f('0x1a')](respondWithResult(_0x5ec781,null))[_0xcd3f('0x24')](handleError(_0x5ec781,null));};exports['getMessages']=function(_0x155b74,_0x4790dd){var _0x15b844={'raw':![],'where':{}};var _0x2735f8={};var _0x23178a={'count':0x0,'rows':[]};return db[_0xcd3f('0x3c')][_0xcd3f('0x51')]({'where':{'id':_0x155b74[_0xcd3f('0x44')]['id']}})[_0xcd3f('0x1a')](handleEntityNotFound(_0x4790dd,null))[_0xcd3f('0x1a')](function(_0x52efbf){if(_0x52efbf){_0x2735f8[_0xcd3f('0x45')]=_[_0xcd3f('0x47')](db[_0xcd3f('0x64')][_0xcd3f('0x46')]);_0x2735f8[_0xcd3f('0x42')]=_[_0xcd3f('0x47')](_0x155b74[_0xcd3f('0x42')]);_0x2735f8[_0xcd3f('0x9a')]=_[_0xcd3f('0x48')](_0x2735f8[_0xcd3f('0x45')],_0x2735f8['query']);_0x15b844[_0xcd3f('0x49')]=_[_0xcd3f('0x48')](_0x2735f8['model'],qs['fields'](_0x155b74['query']['fields']));_0x15b844[_0xcd3f('0x49')]=_0x15b844[_0xcd3f('0x49')][_0xcd3f('0x81')]?_0x15b844[_0xcd3f('0x49')]:_0x2735f8['model'];if(!_0x155b74['query'][_0xcd3f('0x9b')]('nolimit')){_0x15b844['limit']=qs['limit'](_0x155b74[_0xcd3f('0x42')][_0xcd3f('0x2a')]);_0x15b844[_0xcd3f('0x28')]=qs[_0xcd3f('0x28')](_0x155b74[_0xcd3f('0x42')][_0xcd3f('0x28')]);}_0x15b844['order']=qs['sort'](_0x155b74[_0xcd3f('0x42')]['sort']);_0x15b844['where']=qs[_0xcd3f('0x9a')](_[_0xcd3f('0x9c')](_0x155b74[_0xcd3f('0x42')],_0x2735f8['filters']));_0x15b844[_0xcd3f('0x9d')][_0xcd3f('0x9e')]=_0x52efbf['id'];if(_0x155b74[_0xcd3f('0x42')][_0xcd3f('0x9f')]){_0x15b844[_0xcd3f('0x9d')]=_[_0xcd3f('0x35')](_0x15b844[_0xcd3f('0x9d')],{'$or':_['map'](_0x15b844[_0xcd3f('0x49')],function(_0x1499b8){var _0x468a4a={};_0x468a4a[_0x1499b8]={'$like':'%'+_0x155b74[_0xcd3f('0x42')][_0xcd3f('0x9f')]+'%'};return _0x468a4a;})});}if(_0x155b74[_0xcd3f('0x42')][_0xcd3f('0xa0')]){var _0x17f775=_0x155b74[_0xcd3f('0x42')]['$gte'][_0xcd3f('0xa1')](',');var _0xaee661={};_0xaee661[_0x17f775[0x0]]={'$gte':moment(_0x17f775[0x1])['format'](_0xcd3f('0xa2'))};_0x15b844[_0xcd3f('0x9d')]=_[_0xcd3f('0x35')](_0x15b844[_0xcd3f('0x9d')],_0xaee661);}_0x15b844=_['merge']({},_0x15b844,_0x155b74[_0xcd3f('0x4d')]);return db[_0xcd3f('0x64')][_0xcd3f('0x2b')]({'where':_0x15b844['where']})['then'](function(_0x53c459){_0x23178a[_0xcd3f('0x2b')]=_0x53c459;if(_0x155b74['query'][_0xcd3f('0x4b')]){_0x15b844[_0xcd3f('0x4c')]=[{'all':!![]}];}return db[_0xcd3f('0x64')]['findAll'](_0x15b844);})[_0xcd3f('0x1a')](function(_0x55897f){_0x23178a[_0xcd3f('0xa3')]=_0x55897f;return _0x23178a;});}})[_0xcd3f('0x1a')](respondWithFilteredResult(_0x4790dd,_0x15b844))[_0xcd3f('0x24')](handleError(_0x4790dd,null));};exports[_0xcd3f('0xa4')]=function(_0x24c24b,_0x1a5ae2){var _0x2df4c5={'where':{}},_0xf2910={},_0x39e47b={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x24c24b[_0xcd3f('0x44')]['id']}})[_0xcd3f('0x1a')](handleEntityNotFound(_0x1a5ae2,null))[_0xcd3f('0x1a')](function(_0x1cc02e){if(_0x1cc02e){_0xf2910['model']=_['keys'](db['ChatMessage'][_0xcd3f('0x46')]);_0xf2910[_0xcd3f('0x42')]=_[_0xcd3f('0x47')](_0x24c24b[_0xcd3f('0x42')]);_0xf2910['filters']=_['intersection'](_0xf2910[_0xcd3f('0x45')],_0xf2910[_0xcd3f('0x42')]);_0x2df4c5[_0xcd3f('0x49')]=_['intersection'](_0xf2910[_0xcd3f('0x45')],qs[_0xcd3f('0x4a')](_0x24c24b[_0xcd3f('0x42')][_0xcd3f('0x4a')]));_0x2df4c5[_0xcd3f('0x49')]=_0x2df4c5[_0xcd3f('0x49')][_0xcd3f('0x81')]?_0x2df4c5[_0xcd3f('0x49')]:_0xf2910[_0xcd3f('0x45')];if(!_0x24c24b[_0xcd3f('0x42')][_0xcd3f('0x9b')](_0xcd3f('0xa5'))){_0x2df4c5['limit']=qs[_0xcd3f('0x2a')](_0x24c24b['query'][_0xcd3f('0x2a')]);_0x2df4c5[_0xcd3f('0x28')]=qs['offset'](_0x24c24b[_0xcd3f('0x42')][_0xcd3f('0x28')]);}_0x2df4c5[_0xcd3f('0xa6')]=qs[_0xcd3f('0xa7')](_0x24c24b[_0xcd3f('0x42')][_0xcd3f('0xa7')]);_0x2df4c5['where']=qs[_0xcd3f('0x9a')](_[_0xcd3f('0x9c')](_0x24c24b[_0xcd3f('0x42')],_0xf2910[_0xcd3f('0x9a')]));_0x2df4c5[_0xcd3f('0x9d')][_0xcd3f('0x9e')]=_0x1cc02e['id'];if(_0x24c24b[_0xcd3f('0x42')]['filter']){_0x2df4c5[_0xcd3f('0x9d')]=_[_0xcd3f('0x35')](_0x2df4c5[_0xcd3f('0x9d')],{'$or':_['map'](_0x2df4c5['attributes'],function(_0x209ed0){var _0x1dc965={};_0x1dc965[_0x209ed0]={'$like':'%'+_0x24c24b[_0xcd3f('0x42')][_0xcd3f('0x9f')]+'%'};return _0x1dc965;})});}_0x2df4c5[_0xcd3f('0x9d')][_0xcd3f('0x8d')]=![];if(_0x24c24b[_0xcd3f('0x42')]['id']){_0x2df4c5[_0xcd3f('0x9d')]['id']={'$gt':_0x24c24b['query']['id']};}_0x2df4c5=_[_0xcd3f('0x35')]({},_0x2df4c5,_0x24c24b[_0xcd3f('0x4d')]);return db['ChatMessage'][_0xcd3f('0x2b')]({'where':_0x2df4c5[_0xcd3f('0x9d')]})[_0xcd3f('0x1a')](function(_0x191ed8){_0x39e47b[_0xcd3f('0x2b')]=_0x191ed8;_0x2df4c5[_0xcd3f('0x4c')]=[];if(_0x24c24b['query'][_0xcd3f('0xa8')]){_0x2df4c5[_0xcd3f('0x4c')]['push']({'model':db[_0xcd3f('0x7e')],'as':'User','attributes':['id','fullname','alias']});}if(_0x24c24b[_0xcd3f('0x42')][_0xcd3f('0x4b')]){_0x2df4c5[_0xcd3f('0x4c')]=[{'all':!![]}];}return db[_0xcd3f('0x64')]['findAll'](_0x2df4c5);})['then'](function(_0x4c96d0){_0x39e47b[_0xcd3f('0xa3')]=_0x4c96d0;return _0x39e47b;});}})[_0xcd3f('0x1a')](respondWithFilteredResult(_0x1a5ae2,_0x2df4c5))[_0xcd3f('0x24')](handleError(_0x1a5ae2,null));};exports['addTags']=function(_0xb987d6,_0x3940a5){return db['ChatInteraction'][_0xcd3f('0x4e')]({'where':{'id':_0xb987d6['params']['id']}})[_0xcd3f('0x1a')](handleEntityNotFound(_0x3940a5,null))[_0xcd3f('0x1a')](function(_0x30534e){if(_0x30534e){return _0x30534e[_0xcd3f('0xa9')](_0xb987d6[_0xcd3f('0x36')]['ids'],_[_0xcd3f('0x99')](_0xb987d6[_0xcd3f('0x36')],['ids','id'])||{})[_0xcd3f('0xaa')](function(){return db[_0xcd3f('0xab')][_0xcd3f('0x40')]({'attributes':['id',_0xcd3f('0x32'),_0xcd3f('0xac')],'where':{'id':_0xb987d6[_0xcd3f('0x36')][_0xcd3f('0x98')]}});})[_0xcd3f('0x1a')](function(_0x5195c3){socket[_0xcd3f('0xad')](_0xcd3f('0xae'),{'id':Number(_0xb987d6[_0xcd3f('0x44')]['id']),'tags':_0x5195c3||[]});return{'id':Number(_0xb987d6[_0xcd3f('0x44')]['id']),'tags':_0x5195c3||[]};});}})['then'](respondWithResult(_0x3940a5,null))[_0xcd3f('0x24')](handleError(_0x3940a5,null));};exports[_0xcd3f('0xaf')]=function(_0x73dc5d,_0x399d6e){return db[_0xcd3f('0x3c')][_0xcd3f('0x4e')]({'where':{'id':_0x73dc5d[_0xcd3f('0x44')]['id']}})[_0xcd3f('0x1a')](handleEntityNotFound(_0x399d6e,null))[_0xcd3f('0x1a')](function(_0x18fd51){if(_0x18fd51){return _0x18fd51[_0xcd3f('0xaf')](_0x73dc5d[_0xcd3f('0x42')][_0xcd3f('0x98')]);}})[_0xcd3f('0x1a')](respondWithStatusCode(_0x399d6e,null))[_0xcd3f('0x24')](handleError(_0x399d6e,null));};exports[_0xcd3f('0x77')]=function(_0x219140,_0x5139c3){var _0x5ac838=moment()[_0xcd3f('0xb0')]()['toString']();var _0x5997af=path[_0xcd3f('0x74')](config['root'],_0xcd3f('0xb1'),_0xcd3f('0xb2'),_0xcd3f('0xb3'));var _0xff4cd6=path[_0xcd3f('0x74')](config['root'],'server',_0xcd3f('0xb2'),_0xcd3f('0xb4'));var _0x1f4c04=path['join'](_0x5997af,_0x5ac838);var _0x12d719=util['format'](_0xcd3f('0xb5'),_0x219140[_0xcd3f('0x44')]['id'],_0x5ac838);var _0x28e59b=path['join'](_0x5997af,_0x12d719);var _0x3e455b=[];_0x3e455b[_0xcd3f('0xb6')]({'model':db['User'],'as':_0xcd3f('0x7e'),'attributes':['id',_0xcd3f('0x58')],'raw':!![]});_0x3e455b[_0xcd3f('0xb6')]({'model':db[_0xcd3f('0x67')],'as':_0xcd3f('0x68'),'attributes':['id',_0xcd3f('0xb7'),_0xcd3f('0xb8')],'raw':!![]});if(_0x219140[_0xcd3f('0x42')][_0xcd3f('0xb4')]){_0x3e455b[_0xcd3f('0xb6')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x234cfd=[{'model':db[_0xcd3f('0x64')],'as':_0xcd3f('0x80'),'attributes':['id',_0xcd3f('0x36'),_0xcd3f('0x8a'),_0xcd3f('0x8c'),_0xcd3f('0x8d'),'read'],'include':_0x3e455b}];_0x234cfd[_0xcd3f('0xb6')]({'model':db[_0xcd3f('0x52')],'as':'Account','attributes':['id',_0xcd3f('0x32')]});_0x234cfd[_0xcd3f('0xb6')]({'model':db['User'],'as':'Owner','attributes':['id',_0xcd3f('0x58')]});return db[_0xcd3f('0x3c')][_0xcd3f('0x4e')]({'where':{'id':_0x219140[_0xcd3f('0x44')]['id']},'include':_0x234cfd})[_0xcd3f('0x1a')](handleEntityNotFound(_0x5139c3,null))['then'](function(_0x22d82c){if(_0x22d82c){var _0x3c75a0=_0x22d82c[_0xcd3f('0xb9')]({'plain':!![]});fs['mkdirSync'](_0x1f4c04);var _0x3be1af={'channel':_0xcd3f('0xba'),'account':_0x3c75a0[_0xcd3f('0xbb')]['name'],'agent':_0x3c75a0['Owner']?_0x3c75a0[_0xcd3f('0xbc')][_0xcd3f('0x58')]:_0xcd3f('0xbd'),'createdAt':moment(_0x3c75a0[_0xcd3f('0x8a')])['format'](_0xcd3f('0xa2'))[_0xcd3f('0xbe')](),'closedAt':_0x3c75a0[_0xcd3f('0x6b')]?moment(_0x3c75a0['closedAt'])[_0xcd3f('0x7c')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x3c75a0['disposition'],'chatInfo':{'browser':_0x3c75a0[_0xcd3f('0xbf')],'os':_0x3c75a0[_0xcd3f('0xc0')],'referer':_0x3c75a0[_0xcd3f('0xc1')],'customerIp':_0x3c75a0[_0xcd3f('0xc2')],'customerPort':_0x3c75a0[_0xcd3f('0xc3')]?_0x3c75a0[_0xcd3f('0xc3')]:'N.A.'},'messages':_(_0x3c75a0[_0xcd3f('0x80')])[_0xcd3f('0xc4')]()[_0xcd3f('0x9f')]({'secret':![]})[_0xcd3f('0x3b')](function(_0x5c3607){if(_0x5c3607['Attachment']){var _0x85a93a=path[_0xcd3f('0x74')](_0xff4cd6,_0x5c3607[_0xcd3f('0x70')][_0xcd3f('0x76')]);if(fs[_0xcd3f('0xc5')](_0x85a93a)){fs['createReadStream'](_0x85a93a)[_0xcd3f('0xc6')](fs['createWriteStream'](path[_0xcd3f('0x74')](_0x1f4c04,_0x5c3607[_0xcd3f('0x70')]['basename'])));}}return{'date':moment(_0x5c3607['createdAt'])['format'](_0xcd3f('0xa2'))[_0xcd3f('0xbe')](),'sender':_0x5c3607[_0xcd3f('0x8c')]===_0xcd3f('0xc7')?_0x5c3607['User']?_0x5c3607[_0xcd3f('0x7e')][_0xcd3f('0x58')]:_0xcd3f('0x87'):_0x5c3607[_0xcd3f('0x68')]['firstName']+(_0x5c3607[_0xcd3f('0x68')][_0xcd3f('0xb8')]?'\x20'+_0x5c3607[_0xcd3f('0x68')][_0xcd3f('0xb8')]:''),'body':_0x5c3607[_0xcd3f('0x70')]?_0x5c3607[_0xcd3f('0x70')][_0xcd3f('0x76')]:_0x5c3607['body'],'direction':_0x5c3607[_0xcd3f('0x8c')]===_0xcd3f('0xc7')?'A':'C','secret':_0x5c3607['secret'],'read':_0x5c3607['read'],'attachment':_0x5c3607['Attachment']};})[_0xcd3f('0xc8')]()};return ejs[_0xcd3f('0xc9')](path[_0xcd3f('0x74')](config[_0xcd3f('0x7a')],'server',_0xcd3f('0xca'),'downloadInteraction.ejs'),{'interaction':_0x3be1af})['then'](function(_0x16aded){var _0x7e6cb7=path['join'](_0x1f4c04,'transcript-'+_0x3c75a0['id']+'-'+_0x5ac838+_0xcd3f('0xcb'));var _0xeabbe0={'path':_0x7e6cb7,'channel':'Chat','interactionId':_0x3c75a0['id']};return pdf[_0xcd3f('0xcc')](_0x16aded,_0xeabbe0);})['then'](function(){return new Promise(function(_0x1f2604,_0x192efe){zipdir(_0x1f4c04,{'saveTo':_0x28e59b},function(_0x44a322,_0x2dd749){if(_0x44a322)return _0x192efe(_0x44a322);return _0x1f2604(_0x2dd749);});})[_0xcd3f('0x1a')](function(){return new BPromise(function(_0x5e6a8a,_0x44699b){rimraf(_0x1f4c04,function(_0x5bf34e){if(_0x5bf34e)_0x44699b(_0x5bf34e);return _0x5e6a8a();});});})[_0xcd3f('0x1a')](function(){return _0x5139c3['download'](_0x28e59b,_0x12d719,function(_0x3cff09){if(_0x3cff09){logger[_0xcd3f('0x20')](_0xcd3f('0xcd'),_0x3cff09);}else{fs[_0xcd3f('0xce')](_0x28e59b);}});});});}else{return _0x5139c3[_0xcd3f('0x25')](0xc8);}})[_0xcd3f('0x24')](handleError(_0x5139c3,null));}; \ No newline at end of file +var _0x4805=['request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','undefined','limit','count','offset','Content-Range','update','destroy','sendStatus','stack','name','send','render','merge','contact','agent','interaction','account','index','map','fieldName','key','getOptions','findAll','chat','query','user','show','params','model','ChatInteraction','keys','filters','intersection','attributes','fields','length','includeAll','options','find','create','body','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooNote','vidaooMetadata','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','follow','isNull','parse','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','Messages','User','ContactId','format','%s%d','System','customer','Visitor','website_alias','agentAlias','agent_alias','alias','fullname','agent_fullname','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','MailAccount','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','rawAttributes','hasOwnProperty','order','sort','pick','where','ChatInteractionId','filter','$gte','include','nolimit','includeAgent','rows','setTags','omit','spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','toString','files','server','attachments','transcript-%d-%s.zip','push','firstName','lastName','direction','read','Account','Owner','get','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','browserName','osName','referer','customerIp','tail','existsSync','value','views','downloadInteraction.ejs','transcript-','.pdf','err','unlinkSync','request-promise','bluebird','mustache','util','path','ejs','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','then','info','ChatInteraction,\x20%s,\x20%s'];(function(_0x4254fa,_0x5cc31c){var _0x22efe9=function(_0x5c19dd){while(--_0x5c19dd){_0x4254fa['push'](_0x4254fa['shift']());}};_0x22efe9(++_0x5cc31c);}(_0x4805,0xbe));var _0x5480=function(_0xb5fe5c,_0xc4acc7){_0xb5fe5c=_0xb5fe5c-0x0;var _0x5c4ca4=_0x4805[_0xb5fe5c];return _0x5c4ca4;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var rp=require(_0x5480('0x0'));var moment=require('moment');var BPromise=require(_0x5480('0x1'));var Mustache=require(_0x5480('0x2'));var util=require(_0x5480('0x3'));var path=require(_0x5480('0x4'));var ejs=require(_0x5480('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x5480('0x6'));var pdf=require(_0x5480('0x7'));var logger=require(_0x5480('0x8'))('api');var config=require(_0x5480('0x9'));var db=require(_0x5480('0xa'))['db'];config[_0x5480('0xb')]=_[_0x5480('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5480('0xd'))(new Redis(config['redis']));require(_0x5480('0xe'))[_0x5480('0xf')](socket);var jayson=require(_0x5480('0x10'));var client=jayson[_0x5480('0x11')][_0x5480('0x12')]({'port':0x232b});var client9004=jayson['client'][_0x5480('0x12')]({'port':0x232c});function respondWithRpcPromise(_0x3fe85a,_0x4d27d5,_0x216ab1,_0x5d80d4){return new BPromise(function(_0x5bb327,_0xfb833c){var _0x4d5633=_0x5d80d4||client;return _0x4d5633['request'](_0x3fe85a,_0x216ab1)[_0x5480('0x13')](function(_0x18b5a1){logger[_0x5480('0x14')](_0x5480('0x15'),_0x4d27d5,_0x5480('0x16'));logger[_0x5480('0x17')](_0x5480('0x18'),_0x4d27d5,'request\x20sent',JSON[_0x5480('0x19')](_0x18b5a1));if(_0x18b5a1['error']){if(_0x18b5a1[_0x5480('0x1a')][_0x5480('0x1b')]===0x1f4){logger['error'](_0x5480('0x15'),_0x4d27d5,_0x18b5a1[_0x5480('0x1a')][_0x5480('0x1c')]);return _0xfb833c(_0x18b5a1[_0x5480('0x1a')][_0x5480('0x1c')]);}logger[_0x5480('0x1a')](_0x5480('0x15'),_0x4d27d5,_0x18b5a1[_0x5480('0x1a')][_0x5480('0x1c')]);return _0x5bb327(_0x18b5a1[_0x5480('0x1a')][_0x5480('0x1c')]);}else{logger[_0x5480('0x14')](_0x5480('0x15'),_0x4d27d5,_0x5480('0x16'));_0x5bb327(_0x18b5a1[_0x5480('0x1d')][_0x5480('0x1c')]);}})[_0x5480('0x1e')](function(_0x4606d2){logger[_0x5480('0x1a')](_0x5480('0x15'),_0x4d27d5,_0x4606d2);_0xfb833c(_0x4606d2);});});}function respondWithStatusCode(_0x2e6398,_0x45e12d){_0x45e12d=_0x45e12d||0xcc;return function(_0x1aede0){if(_0x1aede0){return _0x2e6398['sendStatus'](_0x45e12d);}return _0x2e6398[_0x5480('0x1f')](_0x45e12d)[_0x5480('0x20')]();};}function respondWithResult(_0x585b17,_0x3c661a){_0x3c661a=_0x3c661a||0xc8;return function(_0x54cea7){if(_0x54cea7){return _0x585b17[_0x5480('0x1f')](_0x3c661a)[_0x5480('0x21')](_0x54cea7);}};}function respondWithFilteredResult(_0x4d5a24,_0x174bd3){return function(_0x305839){if(_0x305839){var _0x31d845=typeof _0x174bd3['offset']===_0x5480('0x22')&&typeof _0x174bd3[_0x5480('0x23')]===_0x5480('0x22');var _0x3e382a=_0x305839[_0x5480('0x24')];var _0xa517b=_0x31d845?0x0:_0x174bd3[_0x5480('0x25')];var _0x53d331=_0x31d845?_0x305839[_0x5480('0x24')]:_0x174bd3[_0x5480('0x25')]+_0x174bd3[_0x5480('0x23')];var _0x52003c;if(_0x53d331>=_0x3e382a){_0x53d331=_0x3e382a;_0x52003c=0xc8;}else{_0x52003c=0xce;}_0x4d5a24[_0x5480('0x1f')](_0x52003c);return _0x4d5a24['set'](_0x5480('0x26'),_0xa517b+'-'+_0x53d331+'/'+_0x3e382a)[_0x5480('0x21')](_0x305839);}return null;};}function saveUpdates(_0x2ee917){return function(_0x3ddbf1){if(_0x3ddbf1){return _0x3ddbf1[_0x5480('0x27')](_0x2ee917)[_0x5480('0x13')](function(_0x534c11){return _0x534c11;});}return null;};}function removeEntity(_0x1066f8){return function(_0xab9fdf){if(_0xab9fdf){return _0xab9fdf[_0x5480('0x28')]()['then'](function(){_0x1066f8[_0x5480('0x1f')](0xcc)[_0x5480('0x20')]();});}};}function handleEntityNotFound(_0x34958f){return function(_0x39d622){if(!_0x39d622){_0x34958f[_0x5480('0x29')](0x194);}return _0x39d622;};}function handleError(_0x120007,_0x2c4c35){_0x2c4c35=_0x2c4c35||0x1f4;return function(_0x8c4c9){logger[_0x5480('0x1a')](_0x8c4c9[_0x5480('0x2a')]);if(_0x8c4c9[_0x5480('0x2b')]){delete _0x8c4c9['name'];}_0x120007[_0x5480('0x1f')](_0x2c4c35)[_0x5480('0x2c')](_0x8c4c9);};}function getMustacheRender(_0x5f06c0,_0x248fe9){return Mustache[_0x5480('0x2d')](_0x5f06c0,_[_0x5480('0x2e')](_0x248fe9['body'],{'contact':_0x248fe9[_0x5480('0x2f')],'message':_0x248fe9['message'],'agent':_0x248fe9[_0x5480('0x30')],'interaction':_0x248fe9[_0x5480('0x31')],'account':_0x248fe9[_0x5480('0x32')]}))||'';}exports[_0x5480('0x33')]=function(_0x1b6412,_0x20c809){var _0x5b06ee={};var _0x56a6d7=_[_0x5480('0x34')](db['ChatInteraction']['rawAttributes'],function(_0x578c71){return{'name':_0x578c71[_0x5480('0x35')],'type':_0x578c71['type'][_0x5480('0x36')]};});_0x5b06ee=qs[_0x5480('0x37')](_0x56a6d7,_0x1b6412);return interaction[_0x5480('0x38')](_0x5480('0x39'),_0x1b6412[_0x5480('0x3a')],_0x1b6412[_0x5480('0x3b')],_0x5b06ee,_0x56a6d7)[_0x5480('0x13')](respondWithFilteredResult(_0x20c809,_0x5b06ee))['catch'](handleError(_0x20c809,null));};exports[_0x5480('0x3c')]=function(_0x562ad6,_0x321632){var _0x19acb8={'raw':![],'where':{'id':_0x562ad6[_0x5480('0x3d')]['id']}},_0x156b94={};_0x156b94[_0x5480('0x3e')]=_['keys'](db[_0x5480('0x3f')]['rawAttributes']);_0x156b94[_0x5480('0x3a')]=_[_0x5480('0x40')](_0x562ad6[_0x5480('0x3a')]);_0x156b94[_0x5480('0x41')]=_[_0x5480('0x42')](_0x156b94[_0x5480('0x3e')],_0x156b94['query']);_0x19acb8[_0x5480('0x43')]=_[_0x5480('0x42')](_0x156b94['model'],qs['fields'](_0x562ad6[_0x5480('0x3a')][_0x5480('0x44')]));_0x19acb8['attributes']=_0x19acb8[_0x5480('0x43')][_0x5480('0x45')]?_0x19acb8[_0x5480('0x43')]:_0x156b94[_0x5480('0x3e')];if(_0x562ad6['query'][_0x5480('0x46')]){_0x19acb8['include']=[{'all':!![]}];}_0x19acb8=_['merge']({},_0x19acb8,_0x562ad6[_0x5480('0x47')]);return db[_0x5480('0x3f')][_0x5480('0x48')](_0x19acb8)['then'](handleEntityNotFound(_0x321632,null))[_0x5480('0x13')](respondWithResult(_0x321632,null))[_0x5480('0x1e')](handleError(_0x321632,null));};exports[_0x5480('0x49')]=function(_0x422ba0,_0xb11cd2){return db[_0x5480('0x3f')][_0x5480('0x49')](_0x422ba0['body'],{})[_0x5480('0x13')](respondWithResult(_0xb11cd2,0xc9))[_0x5480('0x1e')](handleError(_0xb11cd2,null));};exports['update']=function(_0xaabf1a,_0x2e8a6a){if(_0xaabf1a[_0x5480('0x4a')]['id']){delete _0xaabf1a[_0x5480('0x4a')]['id'];}return db['ChatInteraction'][_0x5480('0x48')]({'where':{'id':_0xaabf1a[_0x5480('0x3d')]['id']}})[_0x5480('0x13')](handleEntityNotFound(_0x2e8a6a,null))[_0x5480('0x13')](saveUpdates(_0xaabf1a[_0x5480('0x4a')],null))[_0x5480('0x13')](respondWithResult(_0x2e8a6a,null))['catch'](handleError(_0x2e8a6a,null));};exports['destroy']=function(_0x392e7e,_0x31c16e){return db[_0x5480('0x3f')][_0x5480('0x48')]({'where':{'id':_0x392e7e[_0x5480('0x3d')]['id']}})['then'](handleEntityNotFound(_0x31c16e,null))['then'](removeEntity(_0x31c16e,null))[_0x5480('0x1e')](handleError(_0x31c16e,null));};exports[_0x5480('0x4b')]=function(_0x1de156,_0x1bd7d1){return db['ChatInteraction'][_0x5480('0x4b')]()[_0x5480('0x13')](respondWithResult(_0x1bd7d1,null))[_0x5480('0x1e')](handleError(_0x1bd7d1,null));};exports[_0x5480('0x4c')]=function(_0x1ed01d,_0x1728fd){var _0x1b4bb0=_0x1ed01d[_0x5480('0x3d')]['id'];var _0x3d4db0;var _0x4f71e6;var _0x367a38;return db[_0x5480('0x3f')][_0x5480('0x4d')]({'where':{'id':_0x1b4bb0}})[_0x5480('0x13')](function(_0x3c3ce7){_0x3d4db0=_0x3c3ce7;return db[_0x5480('0x4e')][_0x5480('0x4d')]({'where':{'id':_0x3c3ce7[_0x5480('0x4f')]},'attributes':['id',_0x5480('0x50'),_0x5480('0x51'),'vidaooTopic',_0x5480('0x52'),_0x5480('0x53')],'raw':!![]});})[_0x5480('0x13')](function(_0x4c2764){if(_0x4c2764&&_0x4c2764[_0x5480('0x50')]&&_0x4c2764[_0x5480('0x51')]){_0x4f71e6=_0x4c2764;var _0x277aff={'interaction':{'id':_0x1b4bb0},'agent':{'id':_0x1ed01d[_0x5480('0x3b')]['id'],'name':_0x1ed01d['user'][_0x5480('0x2b')],'fullname':_0x1ed01d[_0x5480('0x3b')]['fullname'],'email':_0x1ed01d[_0x5480('0x3b')][_0x5480('0x54')]},'contact':_0x1ed01d['body']['contact'],'account':_0x1ed01d[_0x5480('0x4a')][_0x5480('0x32')]};var _0x37fb55={'rejectUnauthorized':![],'method':_0x5480('0x55'),'url':_0x5480('0x56'),'headers':{'X-APIKEY':_0x4c2764[_0x5480('0x50')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x1ed01d['user'][_0x5480('0x54')]],'buttons':null,'topic':_0x4f71e6[_0x5480('0x57')],'note':_['isNull'](_0x4f71e6[_0x5480('0x52')])?null:getMustacheRender(_0x4f71e6[_0x5480('0x52')],_0x277aff),'metadata':null},'redirect':_0x5480('0x58'),'json':!![]};try{if(!_[_0x5480('0x59')](_0x4f71e6[_0x5480('0x53')])){var _0x3077af=getMustacheRender(_0x4f71e6[_0x5480('0x53')],_0x277aff);var _0x59630f=JSON[_0x5480('0x5a')](_0x3077af);_0x37fb55['body'][_0x5480('0x5b')]=_0x59630f;}}catch(_0x59df5b){throw new db[(_0x5480('0x5c'))][(_0x5480('0x5d'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x37fb55);}else{throw new db[(_0x5480('0x5c'))][(_0x5480('0x5d'))](_0x5480('0x5e'));}})[_0x5480('0x13')](function(_0x566d5d){_0x367a38=_0x566d5d;if(_0x367a38['id']){var _0x1fb930={'body':_0x367a38[_0x5480('0x5f')],'ChatWebsiteId':_0x4f71e6['id'],'ChatInteractionId':_0x3d4db0['id'],'direction':_0x5480('0x60'),'UserId':_0x1ed01d['user']['id']};return db[_0x5480('0x61')][_0x5480('0x49')](_0x1fb930,{});}else{throw new db['Sequelize'][(_0x5480('0x5d'))](_0x5480('0x62'));}})[_0x5480('0x13')](function(){return _0x3d4db0[_0x5480('0x63')]({'vidaooSessionId':_0x367a38['id']});})['then'](respondWithResult(_0x1728fd,null))[_0x5480('0x1e')](handleError(_0x1728fd,null));};exports[_0x5480('0x64')]=function(_0x378804,_0x35c4e0){if(_0x378804[_0x5480('0x4a')]['id']){delete _0x378804['body']['id'];}return db[_0x5480('0x3f')]['find']({'where':{'id':_0x378804['params']['id']},'include':[{'model':db[_0x5480('0x65')],'as':_0x5480('0x66')}]})['then'](handleEntityNotFound(_0x35c4e0,null))[_0x5480('0x13')](saveUpdates(_0x378804[_0x5480('0x4a')],null))[_0x5480('0x13')](respondWithResult(_0x35c4e0,null))[_0x5480('0x1e')](handleError(_0x35c4e0,null));};exports[_0x5480('0x67')]=function(_0x588a54,_0x2a8a9c){if(_0x588a54[_0x5480('0x4a')]['id']){delete _0x588a54[_0x5480('0x4a')]['id'];}return db[_0x5480('0x3f')][_0x5480('0x48')]({'where':{'id':_0x588a54['params']['id']}})[_0x5480('0x13')](function(_0x4d8ed4){if(!_0x4d8ed4){logger[_0x5480('0x1a')](_0x5480('0x68'),_0x5480('0x67'),0x194,_0x5480('0x69'));_0x2a8a9c['sendStatus'](0x194);}else{if(_0x4d8ed4[_0x5480('0x6a')]){throw new db[(_0x5480('0x5c'))][(_0x5480('0x5d'))](_0x5480('0x6b'));}}return _0x4d8ed4;})['then'](function(_0x91031a){if(_0x91031a){return _0x91031a[_0x5480('0x27')]({'closed':_0x588a54['body'][_0x5480('0x6c')],'disposition':_0x588a54['body']['disposition']})[_0x5480('0x13')](function(_0x54adf4){return _0x54adf4;});}})[_0x5480('0x13')](function(){return respondWithRpcPromise(_0x5480('0x6d'),'abandon',_0x588a54[_0x5480('0x4a')],client9004);})[_0x5480('0x13')](respondWithResult(_0x2a8a9c,null))[_0x5480('0x1e')](handleError(_0x2a8a9c,null));};exports[_0x5480('0x6e')]=function(_0x3cc6b4,_0x4ffe49){_0x3cc6b4[_0x5480('0x4a')]['name']=_0x3cc6b4[_0x5480('0x6f')][_0x5480('0x70')];_0x3cc6b4[_0x5480('0x4a')][_0x5480('0x71')]=_0x3cc6b4['file'][_0x5480('0x72')];_0x3cc6b4['body']['type']=_0x3cc6b4[_0x5480('0x6f')]['mimetype'];return db[_0x5480('0x73')]['create'](_0x3cc6b4[_0x5480('0x4a')])[_0x5480('0x13')](respondWithResult(_0x4ffe49,0xc9))[_0x5480('0x1e')](handleError(_0x4ffe49,null));};exports[_0x5480('0x74')]=function(_0x4104e8,_0x5efc9e){return db[_0x5480('0x3f')][_0x5480('0x4d')]({'where':{'id':_0x4104e8[_0x5480('0x3d')]['id']},'raw':!![]})[_0x5480('0x13')](handleEntityNotFound(_0x5efc9e,null))['then'](function(_0x39685f){if(_0x39685f){if(_0x39685f[_0x5480('0x6c')]){return _0x5efc9e[_0x5480('0x1f')](0x193)[_0x5480('0x21')]({'status':0x193,'message':_0x5480('0x75')});}return db['Attachment'][_0x5480('0x4d')]({'where':{'id':_0x4104e8[_0x5480('0x3a')][_0x5480('0x76')]},'raw':!![]})[_0x5480('0x13')](handleEntityNotFound(_0x5efc9e,null));}})[_0x5480('0x13')](function(_0x33bda4){if(_0x33bda4){var _0x5ca488=_0x33bda4[_0x5480('0x77')]!==null;var _0x5eb346=path[_0x5480('0x78')](config[_0x5480('0x79')],_0x5480('0x7a'));if(_0x5ca488){_0x5eb346=path[_0x5480('0x78')](_0x5eb346,_0x5480('0x7b'));}var _0x4bc58b=path[_0x5480('0x78')](_0x5eb346,_0x33bda4[_0x5480('0x71')]);return _0x5efc9e[_0x5480('0x7c')](_0x4bc58b);}})[_0x5480('0x1e')](handleError(_0x5efc9e,null));};exports[_0x5480('0x7d')]=function(_0x106b8a,_0x2d9969){var _0x38f71b=null;var _0x356e4d=null;var _0x15e74b=null;if(_0x106b8a[_0x5480('0x4a')]['id']){delete _0x106b8a[_0x5480('0x4a')]['id'];}if(_0x106b8a[_0x5480('0x4a')][_0x5480('0x7e')]){_0x15e74b=path['join'](config['root'],_0x5480('0x7f'),util['format'](_0x5480('0x80'),Date[_0x5480('0x81')]()));_0x106b8a['body'][_0x5480('0x82')]=_0x15e74b;}return db['ChatInteraction'][_0x5480('0x48')]({'where':{'id':_0x106b8a['params']['id']},'include':[{'model':db['ChatMessage'],'as':_0x5480('0x83'),'include':[{'model':db[_0x5480('0x84')],'as':'User'}]}]})['then'](handleEntityNotFound(_0x2d9969,null))[_0x5480('0x13')](saveUpdates(_0x106b8a['body'],null))[_0x5480('0x13')](function(_0x4c2e15){if(_0x4c2e15){_0x38f71b=_0x4c2e15;return db[_0x5480('0x4e')][_0x5480('0x48')]({'where':{'id':_0x38f71b[_0x5480('0x4f')]}});}})[_0x5480('0x13')](function(_0x33c672){if(_0x33c672){_0x356e4d=_0x33c672;return db[_0x5480('0x65')][_0x5480('0x48')]({'where':{'id':_0x38f71b[_0x5480('0x85')]}});}})[_0x5480('0x13')](function(_0x36e1b9){if(_0x36e1b9){if(_0x15e74b){var _0xd46285=null;for(var _0x1af9f1=0x1;_0x1af9f1<_0x38f71b[_0x5480('0x83')][_0x5480('0x45')];++_0x1af9f1){_0xd46285=_0x38f71b['Messages'][_0x1af9f1];var _0x55b644=_0xd46285['UserId']?util[_0x5480('0x86')](_0x5480('0x87'),_0x356e4d['agentAlias'],_0xd46285[_0x5480('0x6a')]):_0x5480('0x88');var _0x35fe01=_0x106b8a['body'][_0x5480('0x89')]||util[_0x5480('0x86')](_0x5480('0x87'),_0x5480('0x8a'),_0xd46285[_0x5480('0x85')]);switch(_0x356e4d['agentIdentifier']){case _0x5480('0x8b'):_0x55b644=_0xd46285[_0x5480('0x6a')]?util[_0x5480('0x86')](_0x5480('0x87'),_0x356e4d[_0x5480('0x8c')],_0xd46285[_0x5480('0x6a')]):'System';break;case _0x5480('0x8d'):_0x55b644=_0xd46285[_0x5480('0x6a')]?_0xd46285[_0x5480('0x84')][_0x5480('0x8e')]||_0xd46285[_0x5480('0x84')][_0x5480('0x8f')]:_0x5480('0x88');break;case _0x5480('0x90'):_0x55b644=_0xd46285[_0x5480('0x6a')]?_0xd46285[_0x5480('0x84')]['fullname']:_0x5480('0x88');break;default:_0x55b644=_0xd46285['UserId']?util[_0x5480('0x86')]('%s%d',_0x356e4d[_0x5480('0x8c')],_0xd46285[_0x5480('0x6a')]):'System';}var _0x333fa7=util[_0x5480('0x86')]('[%s]\x20%s:\x20%s\x0a',moment(_0xd46285[_0x5480('0x91')])[_0x5480('0x86')](_0x5480('0x92')),_0xd46285['direction']==='in'?_0x35fe01:_0x55b644,_0xd46285[_0x5480('0x4a')]);if(!_0xd46285[_0x5480('0x93')]){fs['appendFileSync'](_0x15e74b,_0x333fa7);}}return db[_0x5480('0x94')][_0x5480('0x4d')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x5480('0x95'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x5480('0x96'),'raw':!![]}]}]});}}})[_0x5480('0x13')](function(_0xca2b43){if(!_0xca2b43||!_0xca2b43[_0x5480('0x95')]||!_0x106b8a[_0x5480('0x4a')])return _0x38f71b;var _0x1a7670=_0xca2b43[_0x5480('0x97')]();return respondWithRpcPromise(_0x5480('0x98'),_0x5480('0x99'),{'account':_0x1a7670,'message':{'from':util[_0x5480('0x86')](_0x5480('0x9a'),_0xca2b43['name'],_0xca2b43[_0x5480('0x54')]||_0xca2b43[_0x5480('0x95')][_0x5480('0x3b')]),'to':_0x106b8a[_0x5480('0x4a')]['mailTranscript'],'subject':_0x5480('0x9b'),'text':util[_0x5480('0x86')](_0x5480('0x9c'),_0x106b8a[_0x5480('0x4a')][_0x5480('0x7e')]),'attachments':[{'path':_0x15e74b}]}})['then'](function(){return _0x38f71b;})[_0x5480('0x1e')](function(_0x4a3ffc){logger[_0x5480('0x1a')](_0x4a3ffc);});})['then'](respondWithStatusCode(_0x2d9969,0xc8))['catch'](handleError(_0x2d9969,null));};exports[_0x5480('0x9d')]=function(_0x484035,_0x466bae){return db[_0x5480('0x61')][_0x5480('0x48')]({'where':{'id':_0x484035[_0x5480('0x3d')]['id']}})[_0x5480('0x13')](handleEntityNotFound(_0x466bae,null))['then'](function(_0x545e60){if(_0x545e60){return _0x545e60[_0x5480('0x9d')](_0x484035[_0x5480('0x4a')][_0x5480('0x9e')],_['omit'](_0x484035[_0x5480('0x4a')],[_0x5480('0x9e'),'id'])||{});}})[_0x5480('0x13')](respondWithResult(_0x466bae,null))[_0x5480('0x1e')](handleError(_0x466bae,null));};exports[_0x5480('0x9f')]=function(_0x3bca71,_0x5f1db4){var _0x568fd0={'raw':![],'where':{}};var _0x21aba4={};var _0x25f212={'count':0x0,'rows':[]};return db[_0x5480('0x3f')]['findOne']({'where':{'id':_0x3bca71['params']['id']}})[_0x5480('0x13')](handleEntityNotFound(_0x5f1db4,null))[_0x5480('0x13')](function(_0x39500e){if(_0x39500e){_0x21aba4['model']=_[_0x5480('0x40')](db[_0x5480('0x61')][_0x5480('0xa0')]);_0x21aba4[_0x5480('0x3a')]=_[_0x5480('0x40')](_0x3bca71['query']);_0x21aba4[_0x5480('0x41')]=_[_0x5480('0x42')](_0x21aba4['model'],_0x21aba4[_0x5480('0x3a')]);_0x568fd0['attributes']=_[_0x5480('0x42')](_0x21aba4['model'],qs[_0x5480('0x44')](_0x3bca71['query'][_0x5480('0x44')]));_0x568fd0['attributes']=_0x568fd0[_0x5480('0x43')][_0x5480('0x45')]?_0x568fd0[_0x5480('0x43')]:_0x21aba4[_0x5480('0x3e')];if(!_0x3bca71[_0x5480('0x3a')][_0x5480('0xa1')]('nolimit')){_0x568fd0[_0x5480('0x23')]=qs['limit'](_0x3bca71[_0x5480('0x3a')]['limit']);_0x568fd0[_0x5480('0x25')]=qs['offset'](_0x3bca71[_0x5480('0x3a')][_0x5480('0x25')]);}_0x568fd0[_0x5480('0xa2')]=qs[_0x5480('0xa3')](_0x3bca71[_0x5480('0x3a')][_0x5480('0xa3')]);_0x568fd0['where']=qs[_0x5480('0x41')](_[_0x5480('0xa4')](_0x3bca71['query'],_0x21aba4[_0x5480('0x41')]));_0x568fd0[_0x5480('0xa5')][_0x5480('0xa6')]=_0x39500e['id'];if(_0x3bca71[_0x5480('0x3a')][_0x5480('0xa7')]){_0x568fd0['where']=_[_0x5480('0x2e')](_0x568fd0[_0x5480('0xa5')],{'$or':_[_0x5480('0x34')](_0x568fd0['attributes'],function(_0x439bdb){var _0x4260d9={};_0x4260d9[_0x439bdb]={'$like':'%'+_0x3bca71['query'][_0x5480('0xa7')]+'%'};return _0x4260d9;})});}if(_0x3bca71[_0x5480('0x3a')]['$gte']){var _0x1afcd2=_0x3bca71['query'][_0x5480('0xa8')]['split'](',');var _0x4eac2a={};_0x4eac2a[_0x1afcd2[0x0]]={'$gte':moment(_0x1afcd2[0x1])[_0x5480('0x86')]('YYYY-MM-DD\x20HH:mm:ss')};_0x568fd0[_0x5480('0xa5')]=_[_0x5480('0x2e')](_0x568fd0[_0x5480('0xa5')],_0x4eac2a);}_0x568fd0=_[_0x5480('0x2e')]({},_0x568fd0,_0x3bca71['options']);return db['ChatMessage'][_0x5480('0x24')]({'where':_0x568fd0[_0x5480('0xa5')]})[_0x5480('0x13')](function(_0x170395){_0x25f212[_0x5480('0x24')]=_0x170395;if(_0x3bca71[_0x5480('0x3a')][_0x5480('0x46')]){_0x568fd0[_0x5480('0xa9')]=[{'all':!![]}];}return db[_0x5480('0x61')][_0x5480('0x38')](_0x568fd0);})[_0x5480('0x13')](function(_0x4803c6){_0x25f212['rows']=_0x4803c6;return _0x25f212;});}})['then'](respondWithFilteredResult(_0x5f1db4,_0x568fd0))['catch'](handleError(_0x5f1db4,null));};exports['getMyMessages']=function(_0x220366,_0x3123c6){var _0x80bd53={'where':{}},_0x3ae20c={},_0x115202={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x5480('0x4d')]({'where':{'id':_0x220366[_0x5480('0x3d')]['id']}})[_0x5480('0x13')](handleEntityNotFound(_0x3123c6,null))[_0x5480('0x13')](function(_0x204f4c){if(_0x204f4c){_0x3ae20c['model']=_[_0x5480('0x40')](db[_0x5480('0x61')][_0x5480('0xa0')]);_0x3ae20c['query']=_[_0x5480('0x40')](_0x220366[_0x5480('0x3a')]);_0x3ae20c[_0x5480('0x41')]=_[_0x5480('0x42')](_0x3ae20c[_0x5480('0x3e')],_0x3ae20c['query']);_0x80bd53['attributes']=_[_0x5480('0x42')](_0x3ae20c[_0x5480('0x3e')],qs[_0x5480('0x44')](_0x220366['query'][_0x5480('0x44')]));_0x80bd53[_0x5480('0x43')]=_0x80bd53[_0x5480('0x43')][_0x5480('0x45')]?_0x80bd53[_0x5480('0x43')]:_0x3ae20c['model'];if(!_0x220366[_0x5480('0x3a')]['hasOwnProperty'](_0x5480('0xaa'))){_0x80bd53[_0x5480('0x23')]=qs[_0x5480('0x23')](_0x220366[_0x5480('0x3a')][_0x5480('0x23')]);_0x80bd53[_0x5480('0x25')]=qs[_0x5480('0x25')](_0x220366[_0x5480('0x3a')][_0x5480('0x25')]);}_0x80bd53[_0x5480('0xa2')]=qs[_0x5480('0xa3')](_0x220366[_0x5480('0x3a')][_0x5480('0xa3')]);_0x80bd53[_0x5480('0xa5')]=qs[_0x5480('0x41')](_[_0x5480('0xa4')](_0x220366[_0x5480('0x3a')],_0x3ae20c[_0x5480('0x41')]));_0x80bd53[_0x5480('0xa5')][_0x5480('0xa6')]=_0x204f4c['id'];if(_0x220366[_0x5480('0x3a')]['filter']){_0x80bd53[_0x5480('0xa5')]=_[_0x5480('0x2e')](_0x80bd53['where'],{'$or':_[_0x5480('0x34')](_0x80bd53[_0x5480('0x43')],function(_0x1227f0){var _0x40a0e0={};_0x40a0e0[_0x1227f0]={'$like':'%'+_0x220366['query'][_0x5480('0xa7')]+'%'};return _0x40a0e0;})});}_0x80bd53[_0x5480('0xa5')]['secret']=![];if(_0x220366[_0x5480('0x3a')]['id']){_0x80bd53['where']['id']={'$gt':_0x220366[_0x5480('0x3a')]['id']};}_0x80bd53=_[_0x5480('0x2e')]({},_0x80bd53,_0x220366[_0x5480('0x47')]);return db[_0x5480('0x61')][_0x5480('0x24')]({'where':_0x80bd53[_0x5480('0xa5')]})['then'](function(_0x37278d){_0x115202['count']=_0x37278d;_0x80bd53[_0x5480('0xa9')]=[];if(_0x220366[_0x5480('0x3a')][_0x5480('0xab')]){_0x80bd53[_0x5480('0xa9')]['push']({'model':db[_0x5480('0x84')],'as':'User','attributes':['id',_0x5480('0x8f'),_0x5480('0x8e')]});}if(_0x220366[_0x5480('0x3a')][_0x5480('0x46')]){_0x80bd53[_0x5480('0xa9')]=[{'all':!![]}];}return db[_0x5480('0x61')][_0x5480('0x38')](_0x80bd53);})[_0x5480('0x13')](function(_0x2515fd){_0x115202[_0x5480('0xac')]=_0x2515fd;return _0x115202;});}})['then'](respondWithFilteredResult(_0x3123c6,_0x80bd53))[_0x5480('0x1e')](handleError(_0x3123c6,null));};exports['addTags']=function(_0x1cc7a1,_0x171297){return db[_0x5480('0x3f')][_0x5480('0x48')]({'where':{'id':_0x1cc7a1[_0x5480('0x3d')]['id']}})[_0x5480('0x13')](handleEntityNotFound(_0x171297,null))[_0x5480('0x13')](function(_0x57b9b5){if(_0x57b9b5){return _0x57b9b5[_0x5480('0xad')](_0x1cc7a1['body']['ids'],_[_0x5480('0xae')](_0x1cc7a1[_0x5480('0x4a')],[_0x5480('0x9e'),'id'])||{})[_0x5480('0xaf')](function(){return db[_0x5480('0xb0')][_0x5480('0x38')]({'attributes':['id',_0x5480('0x2b'),_0x5480('0xb1')],'where':{'id':_0x1cc7a1[_0x5480('0x4a')][_0x5480('0x9e')]}});})['then'](function(_0x544528){socket[_0x5480('0xb2')](_0x5480('0xb3'),{'id':Number(_0x1cc7a1[_0x5480('0x3d')]['id']),'tags':_0x544528||[]});return{'id':Number(_0x1cc7a1[_0x5480('0x3d')]['id']),'tags':_0x544528||[]};});}})[_0x5480('0x13')](respondWithResult(_0x171297,null))['catch'](handleError(_0x171297,null));};exports['removeTags']=function(_0x13750b,_0x42cde7){return db['ChatInteraction']['find']({'where':{'id':_0x13750b['params']['id']}})[_0x5480('0x13')](handleEntityNotFound(_0x42cde7,null))[_0x5480('0x13')](function(_0x270b83){if(_0x270b83){return _0x270b83[_0x5480('0xb4')](_0x13750b['query']['ids']);}})[_0x5480('0x13')](respondWithStatusCode(_0x42cde7,null))['catch'](handleError(_0x42cde7,null));};exports['download']=function(_0x31eb40,_0xa00510){var _0x2d70c3=moment()[_0x5480('0xb5')]()[_0x5480('0xb6')]();var _0x55185b=path[_0x5480('0x78')](config[_0x5480('0x79')],'server',_0x5480('0xb7'),'tmp');var _0x19c5d0=path['join'](config[_0x5480('0x79')],_0x5480('0xb8'),_0x5480('0xb7'),_0x5480('0xb9'));var _0x5eef5e=path[_0x5480('0x78')](_0x55185b,_0x2d70c3);var _0x334319=util[_0x5480('0x86')](_0x5480('0xba'),_0x31eb40[_0x5480('0x3d')]['id'],_0x2d70c3);var _0x2385c6=path[_0x5480('0x78')](_0x55185b,_0x334319);var _0x47ea3d=[];_0x47ea3d[_0x5480('0xbb')]({'model':db[_0x5480('0x84')],'as':_0x5480('0x84'),'attributes':['id',_0x5480('0x8f')],'raw':!![]});_0x47ea3d['push']({'model':db['CmContact'],'as':_0x5480('0x66'),'attributes':['id',_0x5480('0xbc'),_0x5480('0xbd')],'raw':!![]});if(_0x31eb40['query'][_0x5480('0xb9')]){_0x47ea3d['push']({'model':db['Attachment'],'as':_0x5480('0x73'),'raw':!![]});}var _0x1ba50b=[{'model':db[_0x5480('0x61')],'as':_0x5480('0x83'),'attributes':['id',_0x5480('0x4a'),_0x5480('0x91'),_0x5480('0xbe'),'secret',_0x5480('0xbf')],'include':_0x47ea3d}];_0x1ba50b[_0x5480('0xbb')]({'model':db[_0x5480('0x4e')],'as':_0x5480('0xc0'),'attributes':['id','name']});_0x1ba50b[_0x5480('0xbb')]({'model':db[_0x5480('0x84')],'as':_0x5480('0xc1'),'attributes':['id','fullname']});return db['ChatInteraction']['find']({'where':{'id':_0x31eb40[_0x5480('0x3d')]['id']},'include':_0x1ba50b})[_0x5480('0x13')](handleEntityNotFound(_0xa00510,null))[_0x5480('0x13')](function(_0x18de9c){if(_0x18de9c){var _0x3b0bd8=_0x18de9c[_0x5480('0xc2')]({'plain':!![]});fs['mkdirSync'](_0x5eef5e);var _0x5d6953={'channel':'Chat','account':_0x3b0bd8[_0x5480('0xc0')][_0x5480('0x2b')],'agent':_0x3b0bd8[_0x5480('0xc1')]?_0x3b0bd8[_0x5480('0xc1')][_0x5480('0x8f')]:_0x5480('0xc3'),'createdAt':moment(_0x3b0bd8['createdAt'])[_0x5480('0x86')](_0x5480('0xc4'))[_0x5480('0xb6')](),'closedAt':_0x3b0bd8['closed']?moment(_0x3b0bd8[_0x5480('0xc5')])[_0x5480('0x86')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x3b0bd8[_0x5480('0xc6')],'chatInfo':{'browser':_0x3b0bd8[_0x5480('0xc7')],'os':_0x3b0bd8[_0x5480('0xc8')],'referer':_0x3b0bd8[_0x5480('0xc9')],'customerIp':_0x3b0bd8[_0x5480('0xca')],'customerPort':_0x3b0bd8['customerPort']?_0x3b0bd8['customerPort']:_0x5480('0xc3')},'messages':_(_0x3b0bd8[_0x5480('0x83')])[_0x5480('0xcb')]()[_0x5480('0xa7')]({'secret':![]})[_0x5480('0x34')](function(_0x50e195){if(_0x50e195[_0x5480('0x73')]){var _0x5effb5=path[_0x5480('0x78')](_0x19c5d0,_0x50e195[_0x5480('0x73')][_0x5480('0x71')]);if(fs[_0x5480('0xcc')](_0x5effb5)){fs['createReadStream'](_0x5effb5)['pipe'](fs['createWriteStream'](path[_0x5480('0x78')](_0x5eef5e,_0x50e195[_0x5480('0x73')][_0x5480('0x71')])));}}return{'date':moment(_0x50e195[_0x5480('0x91')])[_0x5480('0x86')](_0x5480('0xc4'))[_0x5480('0xb6')](),'sender':_0x50e195[_0x5480('0xbe')]===_0x5480('0x60')?_0x50e195[_0x5480('0x84')]?_0x50e195[_0x5480('0x84')][_0x5480('0x8f')]:_0x5480('0x88'):_0x50e195[_0x5480('0x66')]['firstName']+(_0x50e195[_0x5480('0x66')]['lastName']?'\x20'+_0x50e195['Contact'][_0x5480('0xbd')]:''),'body':_0x50e195['Attachment']?_0x50e195[_0x5480('0x73')][_0x5480('0x71')]:_0x50e195[_0x5480('0x4a')],'direction':_0x50e195['direction']==='out'?'A':'C','secret':_0x50e195[_0x5480('0x93')],'read':_0x50e195[_0x5480('0xbf')],'attachment':_0x50e195[_0x5480('0x73')]};})[_0x5480('0xcd')]()};return ejs['renderFile'](path[_0x5480('0x78')](config[_0x5480('0x79')],_0x5480('0xb8'),_0x5480('0xce'),_0x5480('0xcf')),{'interaction':_0x5d6953})[_0x5480('0x13')](function(_0x4258a2){var _0x308e42=path[_0x5480('0x78')](_0x5eef5e,_0x5480('0xd0')+_0x3b0bd8['id']+'-'+_0x2d70c3+_0x5480('0xd1'));var _0x160047={'path':_0x308e42,'channel':'Chat','interactionId':_0x3b0bd8['id']};return pdf['createPdfFromHTML'](_0x4258a2,_0x160047);})[_0x5480('0x13')](function(){return new Promise(function(_0x54efd4,_0x321828){zipdir(_0x5eef5e,{'saveTo':_0x2385c6},function(_0x390a32,_0x2db5a7){if(_0x390a32)return _0x321828(_0x390a32);return _0x54efd4(_0x2db5a7);});})[_0x5480('0x13')](function(){return new BPromise(function(_0x8a4319,_0x11c440){rimraf(_0x5eef5e,function(_0x135cb6){if(_0x135cb6)_0x11c440(_0x135cb6);return _0x8a4319();});});})[_0x5480('0x13')](function(){return _0xa00510[_0x5480('0x7c')](_0x2385c6,_0x334319,function(_0x23d87a){if(_0x23d87a){logger[_0x5480('0x1a')](_0x5480('0xd2'),_0x23d87a);}else{fs[_0x5480('0xd3')](_0x2385c6);}});});});}else{return _0xa00510[_0x5480('0x29')](0xc8);}})['catch'](handleError(_0xa00510,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 6cc75b0..2c55a66 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 _0x0180=['catch','hasOwnProperty','hook','exports','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','getUsers','setDataValue','findAll','then','length','emit'];(function(_0x553a87,_0x1d621f){var _0x12d1e6=function(_0x41ae48){while(--_0x41ae48){_0x553a87['push'](_0x553a87['shift']());}};_0x12d1e6(++_0x1d621f);}(_0x0180,0x14e));var _0x0018=function(_0x1b8d44,_0x5d7628){_0x1b8d44=_0x1b8d44-0x0;var _0x2b4056=_0x0180[_0x1b8d44];return _0x2b4056;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x0018('0x0'))['db'][_0x0018('0x1')];var ChatMessage=require(_0x0018('0x0'))['db'][_0x0018('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x0018('0x3')](0x0);var events={'afterCreate':_0x0018('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4f06c4){return function(_0x456555,_0x7eecd1,_0x1e3209){_0x456555[_0x0018('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x21a49a){_0x456555[_0x0018('0x6')]('Users',_0x21a49a['map'](function(_0x1b5e34){return{'id':_0x1b5e34['id']};}));return ChatMessage[_0x0018('0x7')]({'where':{'ChatInteractionId':_0x456555['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0018('0x8')](function(_0x1f5478){_0x456555[_0x0018('0x6')]('unreadMessages',_0x1f5478[_0x0018('0x9')]);ChatInteractionEvents[_0x0018('0xa')](_0x4f06c4+':'+_0x456555['id'],_0x456555);ChatInteractionEvents[_0x0018('0xa')](_0x4f06c4,_0x456555);_0x1e3209(null);})[_0x0018('0xb')](_0x1e3209(null));};}for(var e in events){if(events[_0x0018('0xc')](e)){var event=events[e];ChatInteraction[_0x0018('0xd')](e,emitEvent(event));}}module[_0x0018('0xe')]=ChatInteractionEvents; \ No newline at end of file +var _0x793e=['findAll','length','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','update','then','setDataValue','map'];(function(_0x3ebf3e,_0x469d9f){var _0x20fc5=function(_0x547601){while(--_0x547601){_0x3ebf3e['push'](_0x3ebf3e['shift']());}};_0x20fc5(++_0x469d9f);}(_0x793e,0x1f0));var _0xe793=function(_0xcd3806,_0x3182ad){_0xcd3806=_0xcd3806-0x0;var _0x5e3594=_0x793e[_0xcd3806];return _0x5e3594;};'use strict';var EventEmitter=require(_0xe793('0x0'));var ChatInteraction=require(_0xe793('0x1'))['db'][_0xe793('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0xe793('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe793('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5421b9){return function(_0x2e6b90,_0x58cd3b,_0x1dfcfb){_0x2e6b90['getUsers']({'attributes':['id'],'raw':!![]})[_0xe793('0x5')](function(_0x27a3a3){_0x2e6b90[_0xe793('0x6')]('Users',_0x27a3a3[_0xe793('0x7')](function(_0xadf7b1){return{'id':_0xadf7b1['id']};}));return ChatMessage[_0xe793('0x8')]({'where':{'ChatInteractionId':_0x2e6b90['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe793('0x5')](function(_0x3431aa){_0x2e6b90['setDataValue']('unreadMessages',_0x3431aa[_0xe793('0x9')]);ChatInteractionEvents['emit'](_0x5421b9+':'+_0x2e6b90['id'],_0x2e6b90);ChatInteractionEvents['emit'](_0x5421b9,_0x2e6b90);_0x1dfcfb(null);})[_0xe793('0xa')](_0x1dfcfb(null));};}for(var e in events){if(events[_0xe793('0xb')](e)){var event=events[e];ChatInteraction[_0xe793('0xc')](e,emitEvent(event));}}module[_0xe793('0xd')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index b72c945..7d5d8cd 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 _0x309c=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci'];(function(_0x42fe1c,_0x12e98f){var _0x12d352=function(_0xfe48eb){while(--_0xfe48eb){_0x42fe1c['push'](_0x42fe1c['shift']());}};_0x12d352(++_0x12e98f);}(_0x309c,0xc6));var _0xc309=function(_0x4d458c,_0x572215){_0x4d458c=_0x4d458c-0x0;var _0x59d69b=_0x309c[_0x4d458c];return _0x59d69b;};'use strict';var _=require('lodash');var util=require(_0xc309('0x0'));var logger=require('../../config/logger')(_0xc309('0x1'));var moment=require('moment');var BPromise=require(_0xc309('0x2'));var rp=require(_0xc309('0x3'));var fs=require('fs');var path=require(_0xc309('0x4'));var rimraf=require(_0xc309('0x5'));var config=require(_0xc309('0x6'));var attributes=require(_0xc309('0x7'));module[_0xc309('0x8')]=function(_0x510590,_0x4d3900){return _0x510590[_0xc309('0x9')]('ChatInteraction',attributes,{'tableName':_0xc309('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2c8e1b,_0x5e11e6,_0x2675cc){if(_0x2c8e1b[_0xc309('0xb')](_0xc309('0xc'))){_0x2c8e1b[_0xc309('0xd')]=moment()[_0xc309('0xe')](_0xc309('0xf'));}_0x2675cc(null,_0x2c8e1b);}},'charset':_0xc309('0x10'),'collate':_0xc309('0x11')});}; \ No newline at end of file +var _0x5d32=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','request-promise','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x49748c,_0x3d2005){var _0xedf6b6=function(_0x11628d){while(--_0x11628d){_0x49748c['push'](_0x49748c['shift']());}};_0xedf6b6(++_0x3d2005);}(_0x5d32,0x8e));var _0x25d3=function(_0x52666e,_0x5b3776){_0x52666e=_0x52666e-0x0;var _0x515330=_0x5d32[_0x52666e];return _0x515330;};'use strict';var _=require(_0x25d3('0x0'));var util=require(_0x25d3('0x1'));var logger=require(_0x25d3('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x25d3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module['exports']=function(_0x504374,_0x3e42ca){return _0x504374[_0x25d3('0x4')](_0x25d3('0x5'),attributes,{'tableName':_0x25d3('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x945629,_0x3d1e16,_0x268a9e){if(_0x945629[_0x25d3('0x7')](_0x25d3('0x8'))){_0x945629[_0x25d3('0x9')]=moment()[_0x25d3('0xa')](_0x25d3('0xb'));}_0x268a9e(null,_0x945629);}},'charset':_0x25d3('0xc'),'collate':_0x25d3('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 29f21f1..b1abecc 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 _0x1f66=['ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','update','body','raw','options','attributes','AddTagsToChatInteraction','ChatInteraction','where','ids','omit','spread','AddTags','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3e9fba,_0x442564){var _0x32d982=function(_0x298a91){while(--_0x298a91){_0x3e9fba['push'](_0x3e9fba['shift']());}};_0x32d982(++_0x442564);}(_0x1f66,0x1e5));var _0x61f6=function(_0x38beee,_0x5bd600){_0x38beee=_0x38beee-0x0;var _0x67bb2f=_0x1f66[_0x38beee];return _0x67bb2f;};'use strict';var _=require(_0x61f6('0x0'));var util=require(_0x61f6('0x1'));var moment=require(_0x61f6('0x2'));var BPromise=require('bluebird');var rs=require(_0x61f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x61f6('0x4'))(_0x61f6('0x5'));var config=require(_0x61f6('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x61f6('0x7')][_0x61f6('0x8')]({'port':0x232a});config[_0x61f6('0x9')]=_[_0x61f6('0xa')](config[_0x61f6('0x9')],{'host':_0x61f6('0xb'),'port':0x18eb});var socket=require(_0x61f6('0xc'))(new Redis(config[_0x61f6('0x9')]));require('./chatInteraction.socket')[_0x61f6('0xd')](socket);function respondWithRpcPromise(_0x4fd20e,_0x24fdfd,_0x53b6e2){return new BPromise(function(_0x3c1bc5,_0x303d4d){return client['request'](_0x4fd20e,_0x53b6e2)[_0x61f6('0xe')](function(_0x2768de){logger[_0x61f6('0xf')]('ChatInteraction,\x20%s,\x20%s',_0x24fdfd,_0x61f6('0x10'));logger[_0x61f6('0x11')](_0x61f6('0x12'),_0x24fdfd,_0x61f6('0x10'),JSON[_0x61f6('0x13')](_0x2768de));if(_0x2768de[_0x61f6('0x14')]){if(_0x2768de[_0x61f6('0x14')][_0x61f6('0x15')]===0x1f4){logger[_0x61f6('0x14')](_0x61f6('0x16'),_0x24fdfd,_0x2768de['error'][_0x61f6('0x17')]);return _0x303d4d(_0x2768de[_0x61f6('0x14')][_0x61f6('0x17')]);}logger[_0x61f6('0x14')](_0x61f6('0x16'),_0x24fdfd,_0x2768de[_0x61f6('0x14')][_0x61f6('0x17')]);return _0x3c1bc5(_0x2768de[_0x61f6('0x14')][_0x61f6('0x17')]);}else{logger['info'](_0x61f6('0x16'),_0x24fdfd,'request\x20sent');_0x3c1bc5(_0x2768de[_0x61f6('0x18')]['message']);}})[_0x61f6('0x19')](function(_0x5f2a21){logger['error'](_0x61f6('0x16'),_0x24fdfd,_0x5f2a21);_0x303d4d(_0x5f2a21);});});}exports[_0x61f6('0x1a')]=function(_0x16ba05){var _0x246a30=this;return new Promise(function(_0x300fd3,_0x5d331f){return db['ChatInteraction'][_0x61f6('0x1b')](_0x16ba05[_0x61f6('0x1c')],{'raw':_0x16ba05['options']?_0x16ba05['options'][_0x61f6('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16ba05[_0x61f6('0x1e')]?_0x16ba05['options']['where']||null:null,'attributes':_0x16ba05['options']?_0x16ba05[_0x61f6('0x1e')][_0x61f6('0x1f')]||null:null,'limit':_0x16ba05[_0x61f6('0x1e')]?_0x16ba05[_0x61f6('0x1e')]['limit']||null:null})[_0x61f6('0xe')](function(_0x4ff692){logger['info'](_0x61f6('0x1a'),_0x16ba05);logger['debug'](_0x61f6('0x1a'),_0x16ba05,JSON[_0x61f6('0x13')](_0x4ff692));_0x300fd3(_0x4ff692);})[_0x61f6('0x19')](function(_0x2897a0){logger[_0x61f6('0x14')]('UpdateChatInteraction',_0x2897a0[_0x61f6('0x17')],_0x16ba05);_0x5d331f(_0x246a30[_0x61f6('0x14')](0x1f4,_0x2897a0[_0x61f6('0x17')]));});});};exports[_0x61f6('0x20')]=function(_0x17f40d){return new Promise(function(_0x43672c,_0x39aa52){return db[_0x61f6('0x21')]['find']({'where':_0x17f40d[_0x61f6('0x1e')]?_0x17f40d['options'][_0x61f6('0x22')]||null:null})[_0x61f6('0xe')](function(_0x5dd3f1){if(_0x5dd3f1){return _0x5dd3f1['addTags'](_0x17f40d[_0x61f6('0x1c')][_0x61f6('0x23')],_[_0x61f6('0x24')](_0x17f40d[_0x61f6('0x1c')],[_0x61f6('0x23'),'id'])||{});}})[_0x61f6('0x25')](function(_0x2e89c3){logger[_0x61f6('0xf')](_0x61f6('0x26'),_0x17f40d);logger[_0x61f6('0x11')](_0x61f6('0x26'),_0x17f40d,JSON[_0x61f6('0x13')](_0x2e89c3));_0x43672c(_0x2e89c3);})[_0x61f6('0x19')](function(_0x19e75c){logger[_0x61f6('0x14')](_0x61f6('0x26'),_0x19e75c['message'],_0x17f40d);_0x39aa52(_this[_0x61f6('0x14')](0x1f4,_0x19e75c[_0x61f6('0x17')]));});});}; \ No newline at end of file +var _0xdca8=['./chatInteraction.socket','register','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateChatInteraction','ChatInteraction','body','options','raw','where','attributes','limit','then','AddTagsToChatInteraction','find','addTags','ids','omit','catch','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter'];(function(_0x338f94,_0x3f44dd){var _0x50adbb=function(_0x5da095){while(--_0x5da095){_0x338f94['push'](_0x338f94['shift']());}};_0x50adbb(++_0x3f44dd);}(_0xdca8,0x17c));var _0x8dca=function(_0x29902b,_0x1c4333){_0x29902b=_0x29902b-0x0;var _0x41f2b4=_0xdca8[_0x29902b];return _0x41f2b4;};'use strict';var _=require(_0x8dca('0x0'));var util=require('util');var moment=require(_0x8dca('0x1'));var BPromise=require(_0x8dca('0x2'));var rs=require(_0x8dca('0x3'));var fs=require('fs');var Redis=require(_0x8dca('0x4'));var db=require(_0x8dca('0x5'))['db'];var utils=require(_0x8dca('0x6'));var logger=require(_0x8dca('0x7'))(_0x8dca('0x8'));var config=require(_0x8dca('0x9'));var jayson=require(_0x8dca('0xa'));var client=jayson[_0x8dca('0xb')][_0x8dca('0xc')]({'port':0x232a});config['redis']=_[_0x8dca('0xd')](config[_0x8dca('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x8dca('0xf'))(new Redis(config['redis']));require(_0x8dca('0x10'))[_0x8dca('0x11')](socket);function respondWithRpcPromise(_0x1b3e08,_0x1b5175,_0xcf1b67){return new BPromise(function(_0x4f042b,_0x13edd7){return client['request'](_0x1b3e08,_0xcf1b67)['then'](function(_0x3e2761){logger['info'](_0x8dca('0x12'),_0x1b5175,_0x8dca('0x13'));logger[_0x8dca('0x14')](_0x8dca('0x15'),_0x1b5175,_0x8dca('0x13'),JSON[_0x8dca('0x16')](_0x3e2761));if(_0x3e2761[_0x8dca('0x17')]){if(_0x3e2761[_0x8dca('0x17')][_0x8dca('0x18')]===0x1f4){logger['error'](_0x8dca('0x12'),_0x1b5175,_0x3e2761[_0x8dca('0x17')][_0x8dca('0x19')]);return _0x13edd7(_0x3e2761[_0x8dca('0x17')]['message']);}logger[_0x8dca('0x17')](_0x8dca('0x12'),_0x1b5175,_0x3e2761[_0x8dca('0x17')][_0x8dca('0x19')]);return _0x4f042b(_0x3e2761['error']['message']);}else{logger[_0x8dca('0x1a')](_0x8dca('0x12'),_0x1b5175,_0x8dca('0x13'));_0x4f042b(_0x3e2761[_0x8dca('0x1b')][_0x8dca('0x19')]);}})['catch'](function(_0x52bf2d){logger[_0x8dca('0x17')](_0x8dca('0x12'),_0x1b5175,_0x52bf2d);_0x13edd7(_0x52bf2d);});});}exports[_0x8dca('0x1c')]=function(_0x41fd2b){var _0x440f96=this;return new Promise(function(_0x2eb31c,_0x5127eb){return db[_0x8dca('0x1d')]['update'](_0x41fd2b[_0x8dca('0x1e')],{'raw':_0x41fd2b[_0x8dca('0x1f')]?_0x41fd2b[_0x8dca('0x1f')][_0x8dca('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41fd2b[_0x8dca('0x1f')]?_0x41fd2b[_0x8dca('0x1f')][_0x8dca('0x21')]||null:null,'attributes':_0x41fd2b[_0x8dca('0x1f')]?_0x41fd2b[_0x8dca('0x1f')][_0x8dca('0x22')]||null:null,'limit':_0x41fd2b[_0x8dca('0x1f')]?_0x41fd2b[_0x8dca('0x1f')][_0x8dca('0x23')]||null:null})[_0x8dca('0x24')](function(_0x2cd993){logger[_0x8dca('0x1a')](_0x8dca('0x1c'),_0x41fd2b);logger[_0x8dca('0x14')](_0x8dca('0x1c'),_0x41fd2b,JSON[_0x8dca('0x16')](_0x2cd993));_0x2eb31c(_0x2cd993);})['catch'](function(_0xda8735){logger[_0x8dca('0x17')]('UpdateChatInteraction',_0xda8735[_0x8dca('0x19')],_0x41fd2b);_0x5127eb(_0x440f96[_0x8dca('0x17')](0x1f4,_0xda8735[_0x8dca('0x19')]));});});};exports[_0x8dca('0x25')]=function(_0x5c2dc2){return new Promise(function(_0x381af0,_0x3731e2){return db[_0x8dca('0x1d')][_0x8dca('0x26')]({'where':_0x5c2dc2['options']?_0x5c2dc2[_0x8dca('0x1f')]['where']||null:null})[_0x8dca('0x24')](function(_0x253480){if(_0x253480){return _0x253480[_0x8dca('0x27')](_0x5c2dc2[_0x8dca('0x1e')][_0x8dca('0x28')],_[_0x8dca('0x29')](_0x5c2dc2[_0x8dca('0x1e')],['ids','id'])||{});}})['spread'](function(_0x74cb58){logger[_0x8dca('0x1a')]('AddTags',_0x5c2dc2);logger[_0x8dca('0x14')]('AddTags',_0x5c2dc2,JSON[_0x8dca('0x16')](_0x74cb58));_0x381af0(_0x74cb58);})[_0x8dca('0x2a')](function(_0x2d9f86){logger['error'](_0x8dca('0x2b'),_0x2d9f86[_0x8dca('0x19')],_0x5c2dc2);_0x3731e2(_this[_0x8dca('0x17')](0x1f4,_0x2d9f86[_0x8dca('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 3c91916..98d995c 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 _0x3ba1=['update','emit','removeListener','chatInteraction:','save','remove'];(function(_0x502b00,_0x5d8366){var _0x57bba2=function(_0x1dca99){while(--_0x1dca99){_0x502b00['push'](_0x502b00['shift']());}};_0x57bba2(++_0x5d8366);}(_0x3ba1,0x1ae));var _0x13ba=function(_0xf2b54c,_0xed0f68){_0xf2b54c=_0xf2b54c-0x0;var _0x558c5a=_0x3ba1[_0xf2b54c];return _0x558c5a;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x13ba('0x0'),_0x13ba('0x1'),_0x13ba('0x2')];function createListener(_0x25ce9b,_0x4de222){return function(_0x2c8865){_0x4de222[_0x13ba('0x3')](_0x25ce9b,_0x2c8865);};}function removeListener(_0x810ef0,_0x44687b){return function(){ChatInteractionEvents[_0x13ba('0x4')](_0x810ef0,_0x44687b);};}exports['register']=function(_0x112247){for(var _0x3201f7=0x0,_0x472d2e=events['length'];_0x3201f7<_0x472d2e;_0x3201f7++){var _0x5877b1=events[_0x3201f7];var _0x397430=createListener(_0x13ba('0x5')+_0x5877b1,_0x112247);ChatInteractionEvents['on'](_0x5877b1,_0x397430);}}; \ No newline at end of file +var _0x077a=['update','emit','register','./chatInteraction.events','remove'];(function(_0x549f94,_0x56f8d5){var _0x354990=function(_0x4e8fa0){while(--_0x4e8fa0){_0x549f94['push'](_0x549f94['shift']());}};_0x354990(++_0x56f8d5);}(_0x077a,0x1f2));var _0xa077=function(_0x102376,_0x16c6a2){_0x102376=_0x102376-0x0;var _0x29bc9c=_0x077a[_0x102376];return _0x29bc9c;};'use strict';var ChatInteractionEvents=require(_0xa077('0x0'));var events=['save',_0xa077('0x1'),_0xa077('0x2')];function createListener(_0x3fcbec,_0x2423b4){return function(_0x11b877){_0x2423b4[_0xa077('0x3')](_0x3fcbec,_0x11b877);};}function removeListener(_0x1d58f0,_0x2f7c19){return function(){ChatInteractionEvents['removeListener'](_0x1d58f0,_0x2f7c19);};}exports[_0xa077('0x4')]=function(_0x4077d2){for(var _0x5bba3a=0x0,_0x50c21a=events['length'];_0x5bba3a<_0x50c21a;_0x5bba3a++){var _0x3473bd=events[_0x5bba3a];var _0x1cb8fc=createListener('chatInteraction:'+_0x3473bd,_0x4077d2);ChatInteractionEvents['on'](_0x3473bd,_0x1cb8fc);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 1e27998..a1cd96a 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 _0xb52b=['download','post','isAuthenticated','create','/:id/vidaoo','diskStorage','root','server/files/attachments/','format','%s-%s','now','originalname','/:id/attachment_upload','file','attachmentUpload','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','customUpdate','/:id/abandon','abandon','/:id/close','delete','chatinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','index','/describe','describe','/:id','show','isChatInteractionAuthorized','/:id/messages','/:id/my_messages','getMyMessages','/:id/download'];(function(_0x5e618e,_0x377107){var _0x3a7aaa=function(_0x2eacf5){while(--_0x2eacf5){_0x5e618e['push'](_0x5e618e['shift']());}};_0x3a7aaa(++_0x377107);}(_0xb52b,0x11e));var _0xbb52=function(_0x3dfc05,_0x5d7f06){_0x3dfc05=_0x3dfc05-0x0;var _0x3d9973=_0xb52b[_0x3dfc05];return _0x3d9973;};'use strict';var multer=require(_0xbb52('0x0'));var util=require(_0xbb52('0x1'));var path=require(_0xbb52('0x2'));var timeout=require(_0xbb52('0x3'));var express=require(_0xbb52('0x4'));var router=express['Router']();var fs_extra=require(_0xbb52('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbb52('0x6'));var config=require(_0xbb52('0x7'));var controller=require(_0xbb52('0x8'));router[_0xbb52('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb52('0xa')]);router[_0xbb52('0x9')](_0xbb52('0xb'),auth['isAuthenticated'](),controller[_0xbb52('0xc')]);router[_0xbb52('0x9')](_0xbb52('0xd'),auth['isChatInteractionAuthorized'](),controller[_0xbb52('0xe')]);router['get']('/:id/attachment_download',auth[_0xbb52('0xf')](),controller['attachmentDownload']);router[_0xbb52('0x9')](_0xbb52('0x10'),auth['isAuthenticated'](),controller['getMessages']);router[_0xbb52('0x9')](_0xbb52('0x11'),auth[_0xbb52('0xf')](),controller[_0xbb52('0x12')]);router['get'](_0xbb52('0x13'),auth['isAuthenticated'](),controller[_0xbb52('0x14')]);router[_0xbb52('0x15')]('/',auth[_0xbb52('0x16')](),controller[_0xbb52('0x17')]);router[_0xbb52('0x15')](_0xbb52('0x18'),auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xbb52('0x19')]({'destination':function(_0x27bcdf,_0x5e6992,_0x4913db){_0x4913db(null,path['join'](config[_0xbb52('0x1a')],_0xbb52('0x1b')));},'filename':function(_0x4f6bba,_0x4d5376,_0x22a254){_0x22a254(null,util[_0xbb52('0x1c')](_0xbb52('0x1d'),Date[_0xbb52('0x1e')](),_0x4d5376[_0xbb52('0x1f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb52('0x15')](_0xbb52('0x20'),upload['single'](_0xbb52('0x21')),controller[_0xbb52('0x22')]);router[_0xbb52('0x15')](_0xbb52('0x10'),auth['isChatInteractionAuthorized'](),controller['addMessage']);router[_0xbb52('0x15')](_0xbb52('0x23'),auth['isAuthenticated'](),interaction[_0xbb52('0x24')](_0xbb52('0x25'),_0xbb52('0x26')),controller[_0xbb52('0x27')]);router[_0xbb52('0x28')](_0xbb52('0xd'),auth[_0xbb52('0x16')](),interaction['tracked'](_0xbb52('0x25'),_0xbb52('0x29')),controller[_0xbb52('0x2a')]);router[_0xbb52('0x28')]('/:id/custom_update',controller[_0xbb52('0x2b')]);router[_0xbb52('0x28')](_0xbb52('0x2c'),auth[_0xbb52('0xf')](),controller[_0xbb52('0x2d')]);router[_0xbb52('0x28')](_0xbb52('0x2e'),controller['close']);router[_0xbb52('0x2f')](_0xbb52('0xd'),auth[_0xbb52('0x16')](),interaction[_0xbb52('0x24')]('chat',_0xbb52('0x30')),controller[_0xbb52('0x31')]);router[_0xbb52('0x2f')](_0xbb52('0x23'),auth[_0xbb52('0x16')](),controller[_0xbb52('0x32')]);module['exports']=router; \ No newline at end of file +var _0x9a66=['attachmentUpload','addMessage','/:id/tags','chat','addTags','put','/:id','tracked','update','/:id/custom_update','customUpdate','/:id/close','close','delete','chatinteraction:destroy','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','show','/:id/attachment_download','/:id/messages','getMessages','/:id/my_messages','isChatInteractionAuthorized','getMyMessages','/:id/download','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','%s-%s','now','originalname','single','file'];(function(_0x41e723,_0x5e6494){var _0x5cf973=function(_0x4ce435){while(--_0x4ce435){_0x41e723['push'](_0x41e723['shift']());}};_0x5cf973(++_0x5e6494);}(_0x9a66,0xa4));var _0x69a6=function(_0x5af1d9,_0x28353c){_0x5af1d9=_0x5af1d9-0x0;var _0x73f63d=_0x9a66[_0x5af1d9];return _0x73f63d;};'use strict';var multer=require(_0x69a6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x69a6('0x1'));var express=require(_0x69a6('0x2'));var router=express[_0x69a6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x69a6('0x4'));var interaction=require(_0x69a6('0x5'));var config=require(_0x69a6('0x6'));var controller=require('./chatInteraction.controller');router['get']('/',auth[_0x69a6('0x7')](),controller[_0x69a6('0x8')]);router['get'](_0x69a6('0x9'),auth[_0x69a6('0x7')](),controller[_0x69a6('0xa')]);router[_0x69a6('0xb')]('/:id',auth['isChatInteractionAuthorized'](),controller[_0x69a6('0xc')]);router[_0x69a6('0xb')](_0x69a6('0xd'),auth['isChatInteractionAuthorized'](),controller['attachmentDownload']);router[_0x69a6('0xb')](_0x69a6('0xe'),auth[_0x69a6('0x7')](),controller[_0x69a6('0xf')]);router[_0x69a6('0xb')](_0x69a6('0x10'),auth[_0x69a6('0x11')](),controller[_0x69a6('0x12')]);router[_0x69a6('0xb')](_0x69a6('0x13'),auth['isAuthenticated'](),controller['download']);router[_0x69a6('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x69a6('0x14')](_0x69a6('0x15'),auth[_0x69a6('0x7')](),controller[_0x69a6('0x16')]);var upload=multer({'storage':multer[_0x69a6('0x17')]({'destination':function(_0x5675e6,_0x37bac8,_0x5da3b8){_0x5da3b8(null,path[_0x69a6('0x18')](config[_0x69a6('0x19')],_0x69a6('0x1a')));},'filename':function(_0x4192fc,_0x59e3bf,_0x56a56f){_0x56a56f(null,util['format'](_0x69a6('0x1b'),Date[_0x69a6('0x1c')](),_0x59e3bf[_0x69a6('0x1d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x69a6('0x14')]('/:id/attachment_upload',upload[_0x69a6('0x1e')](_0x69a6('0x1f')),controller[_0x69a6('0x20')]);router[_0x69a6('0x14')]('/:id/messages',auth['isChatInteractionAuthorized'](),controller[_0x69a6('0x21')]);router[_0x69a6('0x14')](_0x69a6('0x22'),auth['isAuthenticated'](),interaction['tracked'](_0x69a6('0x23'),'chatinteraction:addtags'),controller[_0x69a6('0x24')]);router[_0x69a6('0x25')](_0x69a6('0x26'),auth['isAuthenticated'](),interaction[_0x69a6('0x27')](_0x69a6('0x23'),'chatinteraction:update'),controller[_0x69a6('0x28')]);router['put'](_0x69a6('0x29'),controller[_0x69a6('0x2a')]);router[_0x69a6('0x25')]('/:id/abandon',auth[_0x69a6('0x11')](),controller['abandon']);router[_0x69a6('0x25')](_0x69a6('0x2b'),controller[_0x69a6('0x2c')]);router[_0x69a6('0x2d')](_0x69a6('0x26'),auth[_0x69a6('0x7')](),interaction[_0x69a6('0x27')](_0x69a6('0x23'),_0x69a6('0x2e')),controller[_0x69a6('0x2f')]);router[_0x69a6('0x2d')](_0x69a6('0x22'),auth['isAuthenticated'](),controller['removeTags']);module[_0x69a6('0x30')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 50c6cc7..aa70b8b 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 _0x184e=['exports','TEXT','BOOLEAN','INTEGER','sequelize'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0x184e,0x10d));var _0xe184=function(_0x4bb593,_0x272ed0){_0x4bb593=_0x4bb593-0x0;var _0x2da2d8=_0x184e[_0x4bb593];return _0x2da2d8;};'use strict';var Sequelize=require(_0xe184('0x0'));module[_0xe184('0x1')]={'body':{'type':Sequelize[_0xe184('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe184('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xe184('0x4')]}}; \ No newline at end of file +var _0x9c4c=['BOOLEAN','INTEGER','exports','medium'];(function(_0x362b6d,_0x20e7e9){var _0x11f9f1=function(_0x256f23){while(--_0x256f23){_0x362b6d['push'](_0x362b6d['shift']());}};_0x11f9f1(++_0x20e7e9);}(_0x9c4c,0x11a));var _0xc9c4=function(_0x245afc,_0x4ef6b2){_0x245afc=_0x245afc-0x0;var _0x4f8010=_0x9c4c[_0x245afc];return _0x4f8010;};'use strict';var Sequelize=require('sequelize');module[_0xc9c4('0x0')]={'body':{'type':Sequelize['TEXT'](_0xc9c4('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xc9c4('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xc9c4('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 222877c..e144387 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 _0x745d=['-createdAt','all','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./chatInternalMessage.socket','register','status','end','json','undefined','limit','offset','set','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','ChatInternalMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','show','params','catch','create','body','destroy','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','role','userpic','online','allowmessenger','showWebBar','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','Agents','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','read'];(function(_0x2bea6d,_0x441d1c){var _0x39ee0b=function(_0x1b8aa6){while(--_0x1b8aa6){_0x2bea6d['push'](_0x2bea6d['shift']());}};_0x39ee0b(++_0x441d1c);}(_0x745d,0xe0));var _0xd745=function(_0x585447,_0x7cae27){_0x585447=_0x585447-0x0;var _0x3653ad=_0x745d[_0x585447];return _0x3653ad;};'use strict';var emlformat=require(_0xd745('0x0'));var rimraf=require(_0xd745('0x1'));var zipdir=require(_0xd745('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd745('0x3'));var moment=require(_0xd745('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd745('0x5'));var path=require(_0xd745('0x6'));var sox=require(_0xd745('0x7'));var csv=require('to-csv');var ejs=require(_0xd745('0x8'));var fs=require('fs');var fs_extra=require(_0xd745('0x9'));var _=require(_0xd745('0xa'));var squel=require('squel');var crypto=require(_0xd745('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd745('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd745('0xd'));var Papa=require(_0xd745('0xe'));var Redis=require('ioredis');var authService=require(_0xd745('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd745('0x10'));var hardwareService=require(_0xd745('0x11'));var logger=require(_0xd745('0x12'))('api');var utils=require(_0xd745('0x13'));var config=require(_0xd745('0x14'));var licenseUtil=require(_0xd745('0x15'));var db=require(_0xd745('0x16'))['db'];config[_0xd745('0x17')]=_['defaults'](config['redis'],{'host':_0xd745('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd745('0x17')]));require(_0xd745('0x19'))[_0xd745('0x1a')](socket);function respondWithStatusCode(_0x18e783,_0x5ca73a){_0x5ca73a=_0x5ca73a||0xcc;return function(_0x48dc39){if(_0x48dc39){return _0x18e783['sendStatus'](_0x5ca73a);}return _0x18e783[_0xd745('0x1b')](_0x5ca73a)[_0xd745('0x1c')]();};}function respondWithResult(_0xa6dcbc,_0x583cb4){_0x583cb4=_0x583cb4||0xc8;return function(_0x4dd07b){if(_0x4dd07b){return _0xa6dcbc['status'](_0x583cb4)[_0xd745('0x1d')](_0x4dd07b);}};}function respondWithFilteredResult(_0xad01a0,_0x4e46a7){return function(_0x3cd39e){if(_0x3cd39e){var _0xa6303d=typeof _0x4e46a7['offset']===_0xd745('0x1e')&&typeof _0x4e46a7[_0xd745('0x1f')]===_0xd745('0x1e');var _0x4788bf=_0x3cd39e['count'];var _0x2d3655=_0xa6303d?0x0:_0x4e46a7[_0xd745('0x20')];var _0x3e3fd6=_0xa6303d?_0x3cd39e['count']:_0x4e46a7['offset']+_0x4e46a7['limit'];var _0x54fd12;if(_0x3e3fd6>=_0x4788bf){_0x3e3fd6=_0x4788bf;_0x54fd12=0xc8;}else{_0x54fd12=0xce;}_0xad01a0[_0xd745('0x1b')](_0x54fd12);return _0xad01a0[_0xd745('0x21')]('Content-Range',_0x2d3655+'-'+_0x3e3fd6+'/'+_0x4788bf)[_0xd745('0x1d')](_0x3cd39e);}return null;};}function patchUpdates(_0x21c9f0){return function(_0x5f0ea4){try{jsonpatch[_0xd745('0x22')](_0x5f0ea4,_0x21c9f0,!![]);}catch(_0x2bb149){return BPromise[_0xd745('0x23')](_0x2bb149);}return _0x5f0ea4[_0xd745('0x24')]();};}function saveUpdates(_0x17ede3,_0x3bf473){return function(_0x197883){if(_0x197883){return _0x197883[_0xd745('0x25')](_0x17ede3)[_0xd745('0x26')](function(_0x35eb37){return _0x35eb37;});}return null;};}function removeEntity(_0x43d81d,_0x1ea6ed){return function(_0xf52454){if(_0xf52454){return _0xf52454['destroy']()['then'](function(){_0x43d81d[_0xd745('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ced98,_0x5e8a7f){return function(_0x3391ac){if(!_0x3391ac){_0x3ced98[_0xd745('0x27')](0x194);}return _0x3391ac;};}function handleError(_0x4f5cdd,_0xbc4a5b){_0xbc4a5b=_0xbc4a5b||0x1f4;return function(_0x484fa4){logger[_0xd745('0x28')](_0x484fa4[_0xd745('0x29')]);if(_0x484fa4[_0xd745('0x2a')]){delete _0x484fa4[_0xd745('0x2a')];}_0x4f5cdd[_0xd745('0x1b')](_0xbc4a5b)[_0xd745('0x2b')](_0x484fa4);};}exports[_0xd745('0x2c')]=function(_0x33beec,_0xf5e5f0){var _0x2831e6={},_0x4130b9={},_0xea85a1={'count':0x0,'rows':[]};var _0x25949c=_['map'](db[_0xd745('0x2d')][_0xd745('0x2e')],function(_0x2c0da5){return{'name':_0x2c0da5[_0xd745('0x2f')],'type':_0x2c0da5[_0xd745('0x30')][_0xd745('0x31')]};});_0x4130b9[_0xd745('0x32')]=_[_0xd745('0x33')](_0x25949c,_0xd745('0x2a'));_0x4130b9[_0xd745('0x34')]=_[_0xd745('0x35')](_0x33beec['query']);_0x4130b9[_0xd745('0x36')]=_[_0xd745('0x37')](_0x4130b9['model'],_0x4130b9['query']);_0x2831e6[_0xd745('0x38')]=_[_0xd745('0x37')](_0x4130b9[_0xd745('0x32')],qs[_0xd745('0x39')](_0x33beec[_0xd745('0x34')][_0xd745('0x39')]));_0x2831e6[_0xd745('0x38')]=_0x2831e6['attributes'][_0xd745('0x3a')]?_0x2831e6[_0xd745('0x38')]:_0x4130b9['model'];if(!_0x33beec[_0xd745('0x34')]['hasOwnProperty'](_0xd745('0x3b'))){_0x2831e6[_0xd745('0x1f')]=qs[_0xd745('0x1f')](_0x33beec[_0xd745('0x34')]['limit']);_0x2831e6['offset']=qs['offset'](_0x33beec[_0xd745('0x34')][_0xd745('0x20')]);}_0x2831e6[_0xd745('0x3c')]=qs['sort'](_0x33beec['query'][_0xd745('0x3d')]);_0x2831e6[_0xd745('0x3e')]=qs[_0xd745('0x36')](_[_0xd745('0x3f')](_0x33beec[_0xd745('0x34')],_0x4130b9[_0xd745('0x36')]),_0x25949c);if(_0x33beec[_0xd745('0x34')]['filter']){_0x2831e6[_0xd745('0x3e')]=_[_0xd745('0x40')](_0x2831e6[_0xd745('0x3e')],{'$or':_[_0xd745('0x33')](_0x25949c,function(_0xb18c47){if(_0xb18c47[_0xd745('0x30')]!==_0xd745('0x41')){var _0x2755ab={};_0x2755ab[_0xb18c47[_0xd745('0x2a')]]={'$like':'%'+_0x33beec[_0xd745('0x34')][_0xd745('0x42')]+'%'};return _0x2755ab;}})});}_0x2831e6=_[_0xd745('0x40')]({},_0x2831e6,_0x33beec[_0xd745('0x43')]);var _0x587a08={'where':_0x2831e6['where']};return db[_0xd745('0x2d')][_0xd745('0x44')](_0x587a08)['then'](function(_0x487787){_0xea85a1[_0xd745('0x44')]=_0x487787;if(_0x33beec[_0xd745('0x34')][_0xd745('0x45')]){_0x2831e6[_0xd745('0x46')]=[{'all':!![]}];}return db[_0xd745('0x2d')][_0xd745('0x47')](_0x2831e6);})[_0xd745('0x26')](function(_0xff05a0){_0xea85a1[_0xd745('0x48')]=_0xff05a0;return _0xea85a1;})[_0xd745('0x26')](respondWithFilteredResult(_0xf5e5f0,_0x2831e6))['catch'](handleError(_0xf5e5f0,null));};exports[_0xd745('0x49')]=function(_0x508c21,_0xff088e){var _0x543d38={'raw':!![],'where':{'id':_0x508c21[_0xd745('0x4a')]['id']}},_0x351fed={};_0x351fed[_0xd745('0x32')]=_[_0xd745('0x35')](db[_0xd745('0x2d')][_0xd745('0x2e')]);_0x351fed[_0xd745('0x34')]=_['keys'](_0x508c21[_0xd745('0x34')]);_0x351fed[_0xd745('0x36')]=_[_0xd745('0x37')](_0x351fed[_0xd745('0x32')],_0x351fed[_0xd745('0x34')]);_0x543d38[_0xd745('0x38')]=_[_0xd745('0x37')](_0x351fed[_0xd745('0x32')],qs[_0xd745('0x39')](_0x508c21[_0xd745('0x34')][_0xd745('0x39')]));_0x543d38['attributes']=_0x543d38['attributes'][_0xd745('0x3a')]?_0x543d38[_0xd745('0x38')]:_0x351fed['model'];if(_0x508c21[_0xd745('0x34')][_0xd745('0x45')]){_0x543d38[_0xd745('0x46')]=[{'all':!![]}];}_0x543d38=_[_0xd745('0x40')]({},_0x543d38,_0x508c21[_0xd745('0x43')]);return db[_0xd745('0x2d')]['find'](_0x543d38)[_0xd745('0x26')](handleEntityNotFound(_0xff088e,null))[_0xd745('0x26')](respondWithResult(_0xff088e,null))[_0xd745('0x4b')](handleError(_0xff088e,null));};exports[_0xd745('0x4c')]=function(_0x37862d,_0x4e268b){return db[_0xd745('0x2d')][_0xd745('0x4c')](_0x37862d['body'],{})[_0xd745('0x26')](respondWithResult(_0x4e268b,0xc9))['catch'](handleError(_0x4e268b,null));};exports[_0xd745('0x25')]=function(_0x626fff,_0x14521e){if(_0x626fff[_0xd745('0x4d')]['id']){delete _0x626fff[_0xd745('0x4d')]['id'];}return db[_0xd745('0x2d')]['find']({'where':{'id':_0x626fff[_0xd745('0x4a')]['id']}})[_0xd745('0x26')](handleEntityNotFound(_0x14521e,null))[_0xd745('0x26')](saveUpdates(_0x626fff[_0xd745('0x4d')],null))[_0xd745('0x26')](respondWithResult(_0x14521e,null))[_0xd745('0x4b')](handleError(_0x14521e,null));};exports[_0xd745('0x4e')]=function(_0x2b3caa,_0x5da907){return db[_0xd745('0x2d')]['find']({'where':{'id':_0x2b3caa[_0xd745('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5da907,null))['then'](removeEntity(_0x5da907,null))[_0xd745('0x4b')](handleError(_0x5da907,null));};exports['describe']=function(_0x4d425b,_0x5a8613){return db[_0xd745('0x2d')][_0xd745('0x4f')]()[_0xd745('0x26')](respondWithResult(_0x5a8613,null))[_0xd745('0x4b')](handleError(_0x5a8613,null));};function wrapUser(_0x293918){return function(_0x3f8261){var _0x7e8d5a=_0x293918[_0xd745('0x50')]({'plain':!![]});_0x7e8d5a[_0xd745('0x51')]=[];if(_0x3f8261){_0x7e8d5a[_0xd745('0x52')]=_0x3f8261[_0xd745('0x53')];_0x7e8d5a[_0xd745('0x54')]=_0x3f8261;}else{_0x7e8d5a[_0xd745('0x52')]=moment(0x0)[_0xd745('0x55')](_0xd745('0x56'));_0x7e8d5a['lastMessage']={};}return _0x7e8d5a;};}exports[_0xd745('0x57')]=function(_0x444fa2,_0x1d29c1,_0x435e3e){var _0x480300=[];return db[_0xd745('0x58')][_0xd745('0x47')]({'where':{'role':[_0xd745('0x59'),_0xd745('0x5a'),_0xd745('0x5b')]},'attributes':['id','fullname',_0xd745('0x2a'),_0xd745('0x5c'),_0xd745('0x5d'),'internal',_0xd745('0x5e'),'lastLoginAt',_0xd745('0x5f'),_0xd745('0x60')],'order':qs[_0xd745('0x3d')]('-online'),'include':[{'model':db['VoiceQueue'],'as':_0xd745('0x61'),'attributes':['id','name','type'],'through':{'attributes':[]}}]})[_0xd745('0x26')](function(_0x495552){if(_0x495552){var _0x4f6e52=_0x444fa2['user'][_0xd745('0x50')]({'plain':!![]});if(!_0x4f6e52)throw new Error(_0xd745('0x62'));if(_0x4f6e52[_0xd745('0x5c')]==='user'){return db[_0xd745('0x63')][_0xd745('0x64')]({'where':{'name':_0xd745('0x65'),'userProfileId':_0x4f6e52['userProfileId']},'raw':!![]})[_0xd745('0x26')](function(_0x2f3b52){if(_0x2f3b52){if(_0x2f3b52[_0xd745('0x66')]===0x0){return db[_0xd745('0x67')]['findAll']({'where':{'sectionId':_0x2f3b52['id']},'raw':!![]})['then'](function(_0x12521f){var _0x45a991=[];if(_[_0xd745('0x68')](_0x12521f)){_0x45a991=_[_0xd745('0x42')](_0x495552,function(_0x549025){if(_0x549025['role']!==_0xd745('0x59')){return _0x549025;}});return _0x45a991;}else{for(var _0x49baae=0x0;_0x49baae<_0x495552[_0xd745('0x3a')];_0x49baae++){var _0x2a4db1=_0x495552[_0x49baae];if(_0x2a4db1[_0xd745('0x5c')]===_0xd745('0x59')){var _0x2a8765=_[_0xd745('0x64')](_0x12521f,function(_0x16bf78){return _0x16bf78[_0xd745('0x69')]===_0x2a4db1['id'];});if(_0x2a8765)_0x45a991[_0xd745('0x6a')](_0x2a4db1);}else{_0x45a991['push'](_0x2a4db1);}}return _0x45a991;}});}else{return _0x495552;}}else{var _0x3d214c=_[_0xd745('0x42')](_0x495552,function(_0x2f3624){if(_0x2f3624['role']!==_0xd745('0x59')){return _0x2f3624;}});return _0x3d214c;}});}else{return _0x495552;}}})[_0xd745('0x26')](function(_0x3afdd9){var _0x40ccab=[];if(_0x3afdd9){_0x480300=_0x3afdd9;for(var _0x441e67=0x0;_0x441e67<_0x3afdd9['length'];_0x441e67+=0x1){_0x480300[_0x441e67][_0xd745('0x51')]=[];_0x40ccab['push'](db[_0xd745('0x2d')]['find']({'where':{'FromId':[_0x444fa2[_0xd745('0x5b')]['id'],_0x3afdd9[_0x441e67]['id']],'ToId':[_0x444fa2[_0xd745('0x5b')]['id'],_0x3afdd9[_0x441e67]['id']],'ChatGroupId':null},'attributes':['id',_0xd745('0x53'),_0xd745('0x6b'),'ToId',_0xd745('0x6c'),'body'],'order':qs[_0xd745('0x3d')](_0xd745('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xd745('0x26')](wrapUser(_0x3afdd9[_0x441e67])));}return BPromise[_0xd745('0x6e')](_0x40ccab);}return[];})[_0xd745('0x26')](function(_0xc0a8aa){return{'rows':_0xc0a8aa,'count':_0xc0a8aa[_0xd745('0x3a')]};})['then'](respondWithResult(_0x1d29c1,null))['catch'](handleError(_0x1d29c1,null));}; \ No newline at end of file +var _0xae0e=['papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','keys','include','find','create','body','describe','get','lastMessageAt','createdAt','lastMessage','getUsers','User','findAll','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','isEmpty','resourceId','push','messages','FromId','read','-createdAt','all','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xae0e,0x1bc));var _0xeae0=function(_0x142ca4,_0x5de646){_0x142ca4=_0x142ca4-0x0;var _0x13a91c=_0xae0e[_0x142ca4];return _0x13a91c;};'use strict';var emlformat=require(_0xeae0('0x0'));var rimraf=require(_0xeae0('0x1'));var zipdir=require(_0xeae0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeae0('0x3'));var moment=require(_0xeae0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xeae0('0x5'));var util=require(_0xeae0('0x6'));var path=require('path');var sox=require(_0xeae0('0x7'));var csv=require(_0xeae0('0x8'));var ejs=require(_0xeae0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeae0('0xa'));var squel=require(_0xeae0('0xb'));var crypto=require(_0xeae0('0xc'));var jsforce=require(_0xeae0('0xd'));var deskjs=require(_0xeae0('0xe'));var toCsv=require('to-csv');var querystring=require(_0xeae0('0xf'));var Papa=require(_0xeae0('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xeae0('0x11'));var as=require(_0xeae0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeae0('0x13'));var utils=require(_0xeae0('0x14'));var config=require(_0xeae0('0x15'));var licenseUtil=require(_0xeae0('0x16'));var db=require(_0xeae0('0x17'))['db'];config[_0xeae0('0x18')]=_[_0xeae0('0x19')](config['redis'],{'host':_0xeae0('0x1a'),'port':0x18eb});var socket=require(_0xeae0('0x1b'))(new Redis(config['redis']));require(_0xeae0('0x1c'))[_0xeae0('0x1d')](socket);function respondWithStatusCode(_0x17c98d,_0x3c5b01){_0x3c5b01=_0x3c5b01||0xcc;return function(_0x4143ca){if(_0x4143ca){return _0x17c98d['sendStatus'](_0x3c5b01);}return _0x17c98d['status'](_0x3c5b01)[_0xeae0('0x1e')]();};}function respondWithResult(_0x1f40c0,_0x31ef8a){_0x31ef8a=_0x31ef8a||0xc8;return function(_0xa4d864){if(_0xa4d864){return _0x1f40c0[_0xeae0('0x1f')](_0x31ef8a)[_0xeae0('0x20')](_0xa4d864);}};}function respondWithFilteredResult(_0x1e3437,_0x299760){return function(_0x36133d){if(_0x36133d){var _0x5a3236=typeof _0x299760[_0xeae0('0x21')]===_0xeae0('0x22')&&typeof _0x299760[_0xeae0('0x23')]===_0xeae0('0x22');var _0x17f80a=_0x36133d[_0xeae0('0x24')];var _0x53c9d8=_0x5a3236?0x0:_0x299760[_0xeae0('0x21')];var _0x46184a=_0x5a3236?_0x36133d['count']:_0x299760[_0xeae0('0x21')]+_0x299760[_0xeae0('0x23')];var _0x546d47;if(_0x46184a>=_0x17f80a){_0x46184a=_0x17f80a;_0x546d47=0xc8;}else{_0x546d47=0xce;}_0x1e3437[_0xeae0('0x1f')](_0x546d47);return _0x1e3437[_0xeae0('0x25')](_0xeae0('0x26'),_0x53c9d8+'-'+_0x46184a+'/'+_0x17f80a)[_0xeae0('0x20')](_0x36133d);}return null;};}function patchUpdates(_0x543be9){return function(_0x27d7d6){try{jsonpatch[_0xeae0('0x27')](_0x27d7d6,_0x543be9,!![]);}catch(_0x1faa26){return BPromise[_0xeae0('0x28')](_0x1faa26);}return _0x27d7d6['save']();};}function saveUpdates(_0x6cf65e,_0x5a3b53){return function(_0x2846ae){if(_0x2846ae){return _0x2846ae[_0xeae0('0x29')](_0x6cf65e)['then'](function(_0x593302){return _0x593302;});}return null;};}function removeEntity(_0x258dae,_0x1a888d){return function(_0x58b1e3){if(_0x58b1e3){return _0x58b1e3[_0xeae0('0x2a')]()[_0xeae0('0x2b')](function(){_0x258dae[_0xeae0('0x1f')](0xcc)[_0xeae0('0x1e')]();});}};}function handleEntityNotFound(_0x4d585e,_0x5b19bf){return function(_0x4ac148){if(!_0x4ac148){_0x4d585e[_0xeae0('0x2c')](0x194);}return _0x4ac148;};}function handleError(_0xca4f9d,_0x233bff){_0x233bff=_0x233bff||0x1f4;return function(_0x4c72a9){logger[_0xeae0('0x2d')](_0x4c72a9[_0xeae0('0x2e')]);if(_0x4c72a9[_0xeae0('0x2f')]){delete _0x4c72a9[_0xeae0('0x2f')];}_0xca4f9d[_0xeae0('0x1f')](_0x233bff)[_0xeae0('0x30')](_0x4c72a9);};}exports[_0xeae0('0x31')]=function(_0x37bb11,_0x43d18c){var _0x2a8f66={},_0x17f882={},_0x2c4978={'count':0x0,'rows':[]};var _0x4bd9de=_[_0xeae0('0x32')](db[_0xeae0('0x33')][_0xeae0('0x34')],function(_0x1704c6){return{'name':_0x1704c6[_0xeae0('0x35')],'type':_0x1704c6[_0xeae0('0x36')][_0xeae0('0x37')]};});_0x17f882[_0xeae0('0x38')]=_[_0xeae0('0x32')](_0x4bd9de,_0xeae0('0x2f'));_0x17f882[_0xeae0('0x39')]=_['keys'](_0x37bb11[_0xeae0('0x39')]);_0x17f882['filters']=_[_0xeae0('0x3a')](_0x17f882[_0xeae0('0x38')],_0x17f882['query']);_0x2a8f66['attributes']=_[_0xeae0('0x3a')](_0x17f882['model'],qs[_0xeae0('0x3b')](_0x37bb11[_0xeae0('0x39')]['fields']));_0x2a8f66[_0xeae0('0x3c')]=_0x2a8f66[_0xeae0('0x3c')][_0xeae0('0x3d')]?_0x2a8f66['attributes']:_0x17f882[_0xeae0('0x38')];if(!_0x37bb11['query'][_0xeae0('0x3e')](_0xeae0('0x3f'))){_0x2a8f66[_0xeae0('0x23')]=qs[_0xeae0('0x23')](_0x37bb11[_0xeae0('0x39')]['limit']);_0x2a8f66[_0xeae0('0x21')]=qs[_0xeae0('0x21')](_0x37bb11[_0xeae0('0x39')][_0xeae0('0x21')]);}_0x2a8f66[_0xeae0('0x40')]=qs['sort'](_0x37bb11['query'][_0xeae0('0x41')]);_0x2a8f66[_0xeae0('0x42')]=qs[_0xeae0('0x43')](_['pick'](_0x37bb11[_0xeae0('0x39')],_0x17f882[_0xeae0('0x43')]),_0x4bd9de);if(_0x37bb11['query'][_0xeae0('0x44')]){_0x2a8f66[_0xeae0('0x42')]=_[_0xeae0('0x45')](_0x2a8f66[_0xeae0('0x42')],{'$or':_[_0xeae0('0x32')](_0x4bd9de,function(_0x3b2925){if(_0x3b2925[_0xeae0('0x36')]!==_0xeae0('0x46')){var _0x1478ef={};_0x1478ef[_0x3b2925[_0xeae0('0x2f')]]={'$like':'%'+_0x37bb11[_0xeae0('0x39')][_0xeae0('0x44')]+'%'};return _0x1478ef;}})});}_0x2a8f66=_['merge']({},_0x2a8f66,_0x37bb11[_0xeae0('0x47')]);var _0x195e18={'where':_0x2a8f66[_0xeae0('0x42')]};return db['ChatInternalMessage'][_0xeae0('0x24')](_0x195e18)['then'](function(_0x1278a5){_0x2c4978[_0xeae0('0x24')]=_0x1278a5;if(_0x37bb11[_0xeae0('0x39')][_0xeae0('0x48')]){_0x2a8f66['include']=[{'all':!![]}];}return db[_0xeae0('0x33')]['findAll'](_0x2a8f66);})[_0xeae0('0x2b')](function(_0x53cc65){_0x2c4978[_0xeae0('0x49')]=_0x53cc65;return _0x2c4978;})['then'](respondWithFilteredResult(_0x43d18c,_0x2a8f66))[_0xeae0('0x4a')](handleError(_0x43d18c,null));};exports[_0xeae0('0x4b')]=function(_0x21eac5,_0x56c9aa){var _0xdd35f5={'raw':!![],'where':{'id':_0x21eac5[_0xeae0('0x4c')]['id']}},_0x2a0926={};_0x2a0926['model']=_[_0xeae0('0x4d')](db['ChatInternalMessage'][_0xeae0('0x34')]);_0x2a0926[_0xeae0('0x39')]=_[_0xeae0('0x4d')](_0x21eac5[_0xeae0('0x39')]);_0x2a0926[_0xeae0('0x43')]=_['intersection'](_0x2a0926['model'],_0x2a0926['query']);_0xdd35f5[_0xeae0('0x3c')]=_[_0xeae0('0x3a')](_0x2a0926[_0xeae0('0x38')],qs[_0xeae0('0x3b')](_0x21eac5[_0xeae0('0x39')][_0xeae0('0x3b')]));_0xdd35f5['attributes']=_0xdd35f5['attributes'][_0xeae0('0x3d')]?_0xdd35f5['attributes']:_0x2a0926[_0xeae0('0x38')];if(_0x21eac5[_0xeae0('0x39')][_0xeae0('0x48')]){_0xdd35f5[_0xeae0('0x4e')]=[{'all':!![]}];}_0xdd35f5=_[_0xeae0('0x45')]({},_0xdd35f5,_0x21eac5[_0xeae0('0x47')]);return db['ChatInternalMessage'][_0xeae0('0x4f')](_0xdd35f5)[_0xeae0('0x2b')](handleEntityNotFound(_0x56c9aa,null))[_0xeae0('0x2b')](respondWithResult(_0x56c9aa,null))[_0xeae0('0x4a')](handleError(_0x56c9aa,null));};exports[_0xeae0('0x50')]=function(_0x4b8ffa,_0x55e3f2){return db[_0xeae0('0x33')][_0xeae0('0x50')](_0x4b8ffa[_0xeae0('0x51')],{})[_0xeae0('0x2b')](respondWithResult(_0x55e3f2,0xc9))[_0xeae0('0x4a')](handleError(_0x55e3f2,null));};exports[_0xeae0('0x29')]=function(_0x40abd1,_0x96fe0d){if(_0x40abd1[_0xeae0('0x51')]['id']){delete _0x40abd1[_0xeae0('0x51')]['id'];}return db[_0xeae0('0x33')][_0xeae0('0x4f')]({'where':{'id':_0x40abd1[_0xeae0('0x4c')]['id']}})[_0xeae0('0x2b')](handleEntityNotFound(_0x96fe0d,null))[_0xeae0('0x2b')](saveUpdates(_0x40abd1['body'],null))[_0xeae0('0x2b')](respondWithResult(_0x96fe0d,null))[_0xeae0('0x4a')](handleError(_0x96fe0d,null));};exports['destroy']=function(_0x464bb1,_0x249601){return db[_0xeae0('0x33')][_0xeae0('0x4f')]({'where':{'id':_0x464bb1[_0xeae0('0x4c')]['id']}})[_0xeae0('0x2b')](handleEntityNotFound(_0x249601,null))['then'](removeEntity(_0x249601,null))['catch'](handleError(_0x249601,null));};exports[_0xeae0('0x52')]=function(_0x3f55de,_0x1c21d3){return db[_0xeae0('0x33')][_0xeae0('0x52')]()[_0xeae0('0x2b')](respondWithResult(_0x1c21d3,null))[_0xeae0('0x4a')](handleError(_0x1c21d3,null));};function wrapUser(_0x51c721){return function(_0x13ba8d){var _0x25b426=_0x51c721[_0xeae0('0x53')]({'plain':!![]});_0x25b426['messages']=[];if(_0x13ba8d){_0x25b426[_0xeae0('0x54')]=_0x13ba8d[_0xeae0('0x55')];_0x25b426[_0xeae0('0x56')]=_0x13ba8d;}else{_0x25b426[_0xeae0('0x54')]=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x25b426[_0xeae0('0x56')]={};}return _0x25b426;};}exports[_0xeae0('0x57')]=function(_0x5afb53,_0x35a2c8,_0x1a3a7){var _0x2521ed=[];return db[_0xeae0('0x58')][_0xeae0('0x59')]({'where':{'role':[_0xeae0('0x5a'),_0xeae0('0x5b'),_0xeae0('0x5c')]},'attributes':['id',_0xeae0('0x5d'),_0xeae0('0x2f'),_0xeae0('0x5e'),_0xeae0('0x5f'),_0xeae0('0x60'),_0xeae0('0x61'),_0xeae0('0x62'),_0xeae0('0x63'),'showWebBar'],'order':qs[_0xeae0('0x41')]('-online'),'include':[{'model':db[_0xeae0('0x64')],'as':_0xeae0('0x65'),'attributes':['id',_0xeae0('0x2f'),'type'],'through':{'attributes':[]}}]})['then'](function(_0x2af3f0){if(_0x2af3f0){var _0x42f26c=_0x5afb53[_0xeae0('0x5c')][_0xeae0('0x53')]({'plain':!![]});if(!_0x42f26c)throw new Error(_0xeae0('0x66'));if(_0x42f26c[_0xeae0('0x5e')]===_0xeae0('0x5c')){return db[_0xeae0('0x67')][_0xeae0('0x4f')]({'where':{'name':_0xeae0('0x68'),'userProfileId':_0x42f26c[_0xeae0('0x69')]},'raw':!![]})[_0xeae0('0x2b')](function(_0x5638c7){if(_0x5638c7){if(_0x5638c7[_0xeae0('0x6a')]===0x0){return db['UserProfileResource'][_0xeae0('0x59')]({'where':{'sectionId':_0x5638c7['id']},'raw':!![]})['then'](function(_0x1e9df2){var _0x2aa7f9=[];if(_[_0xeae0('0x6b')](_0x1e9df2)){_0x2aa7f9=_['filter'](_0x2af3f0,function(_0x39d946){if(_0x39d946['role']!==_0xeae0('0x5a')){return _0x39d946;}});return _0x2aa7f9;}else{for(var _0x5b6a84=0x0;_0x5b6a84<_0x2af3f0[_0xeae0('0x3d')];_0x5b6a84++){var _0x3061fb=_0x2af3f0[_0x5b6a84];if(_0x3061fb['role']==='agent'){var _0x1dcf94=_[_0xeae0('0x4f')](_0x1e9df2,function(_0x12059e){return _0x12059e[_0xeae0('0x6c')]===_0x3061fb['id'];});if(_0x1dcf94)_0x2aa7f9['push'](_0x3061fb);}else{_0x2aa7f9[_0xeae0('0x6d')](_0x3061fb);}}return _0x2aa7f9;}});}else{return _0x2af3f0;}}else{var _0x264b65=_[_0xeae0('0x44')](_0x2af3f0,function(_0x5aa670){if(_0x5aa670[_0xeae0('0x5e')]!==_0xeae0('0x5a')){return _0x5aa670;}});return _0x264b65;}});}else{return _0x2af3f0;}}})[_0xeae0('0x2b')](function(_0x3aa84e){var _0x488070=[];if(_0x3aa84e){_0x2521ed=_0x3aa84e;for(var _0x295267=0x0;_0x295267<_0x3aa84e[_0xeae0('0x3d')];_0x295267+=0x1){_0x2521ed[_0x295267][_0xeae0('0x6e')]=[];_0x488070[_0xeae0('0x6d')](db[_0xeae0('0x33')][_0xeae0('0x4f')]({'where':{'FromId':[_0x5afb53[_0xeae0('0x5c')]['id'],_0x3aa84e[_0x295267]['id']],'ToId':[_0x5afb53[_0xeae0('0x5c')]['id'],_0x3aa84e[_0x295267]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0xeae0('0x6f'),'ToId',_0xeae0('0x70'),_0xeae0('0x51')],'order':qs[_0xeae0('0x41')](_0xeae0('0x71')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xeae0('0x2b')](wrapUser(_0x3aa84e[_0x295267])));}return BPromise[_0xeae0('0x72')](_0x488070);}return[];})[_0xeae0('0x2b')](function(_0x144bec){return{'rows':_0x144bec,'count':_0x144bec[_0xeae0('0x3d')]};})['then'](respondWithResult(_0x35a2c8,null))[_0xeae0('0x4a')](handleError(_0x35a2c8,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index da33791..a11190d 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 _0xa3cb=['hasOwnProperty','hook','exports','events','ChatInternalMessage','setMaxListeners','save','update','emit'];(function(_0xc26a48,_0x42ff7f){var _0x495bc0=function(_0x549479){while(--_0x549479){_0xc26a48['push'](_0xc26a48['shift']());}};_0x495bc0(++_0x42ff7f);}(_0xa3cb,0x1e0));var _0xba3c=function(_0x4aba15,_0x4e90aa){_0x4aba15=_0x4aba15-0x0;var _0x1c8122=_0xa3cb[_0x4aba15];return _0x1c8122;};'use strict';var EventEmitter=require(_0xba3c('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xba3c('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xba3c('0x2')](0x0);var events={'afterCreate':_0xba3c('0x3'),'afterUpdate':_0xba3c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1f8ff1){return function(_0x43b872,_0x478322,_0x10ea36){ChatInternalMessageEvents[_0xba3c('0x5')](_0x1f8ff1+':'+_0x43b872['id'],_0x43b872);ChatInternalMessageEvents[_0xba3c('0x5')](_0x1f8ff1,_0x43b872);_0x10ea36(null);};}for(var e in events){if(events[_0xba3c('0x6')](e)){var event=events[e];ChatInternalMessage[_0xba3c('0x7')](e,emitEvent(event));}}module[_0xba3c('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x105a=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update'];(function(_0x27c24e,_0x5db1c7){var _0x39004a=function(_0x44286d){while(--_0x44286d){_0x27c24e['push'](_0x27c24e['shift']());}};_0x39004a(++_0x5db1c7);}(_0x105a,0xd7));var _0xa105=function(_0x31b92e,_0x3df7cc){_0x31b92e=_0x31b92e-0x0;var _0x5c076e=_0x105a[_0x31b92e];return _0x5c076e;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0xa105('0x0'))['db'][_0xa105('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xa105('0x2')](0x0);var events={'afterCreate':_0xa105('0x3'),'afterUpdate':_0xa105('0x4'),'afterDestroy':_0xa105('0x5')};function emitEvent(_0x4f4b89){return function(_0x16610a,_0x3a1850,_0x1aac8b){ChatInternalMessageEvents[_0xa105('0x6')](_0x4f4b89+':'+_0x16610a['id'],_0x16610a);ChatInternalMessageEvents[_0xa105('0x6')](_0x4f4b89,_0x16610a);_0x1aac8b(null);};}for(var e in events){if(events[_0xa105('0x7')](e)){var event=events[e];ChatInternalMessage[_0xa105('0x8')](e,emitEvent(event));}}module[_0xa105('0x9')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 0619ac1..733ef1d 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 _0x4d24=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci'];(function(_0x5a764c,_0x12d5e4){var _0x15567b=function(_0x519ac5){while(--_0x519ac5){_0x5a764c['push'](_0x5a764c['shift']());}};_0x15567b(++_0x12d5e4);}(_0x4d24,0x16c));var _0x44d2=function(_0x46e3bd,_0x1b7b0d){_0x46e3bd=_0x46e3bd-0x0;var _0x38a907=_0x4d24[_0x46e3bd];return _0x38a907;};'use strict';var _=require(_0x44d2('0x0'));var util=require(_0x44d2('0x1'));var logger=require(_0x44d2('0x2'))(_0x44d2('0x3'));var moment=require(_0x44d2('0x4'));var BPromise=require(_0x44d2('0x5'));var rp=require(_0x44d2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x44d2('0x7'));var config=require(_0x44d2('0x8'));var attributes=require(_0x44d2('0x9'));module['exports']=function(_0x2d36d7,_0x25f0ac){return _0x2d36d7['define'](_0x44d2('0xa'),attributes,{'tableName':_0x44d2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x44d2('0xc')});}; \ No newline at end of file +var _0x758d=['utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','utf8mb4'];(function(_0x379d94,_0x1ebc1e){var _0xf3b9d2=function(_0x4fc56a){while(--_0x4fc56a){_0x379d94['push'](_0x379d94['shift']());}};_0xf3b9d2(++_0x1ebc1e);}(_0x758d,0xef));var _0xd758=function(_0x29d8c5,_0x465dcb){_0x29d8c5=_0x29d8c5-0x0;var _0x1fafc5=_0x758d[_0x29d8c5];return _0x1fafc5;};'use strict';var _=require('lodash');var util=require(_0xd758('0x0'));var logger=require(_0xd758('0x1'))(_0xd758('0x2'));var moment=require(_0xd758('0x3'));var BPromise=require('bluebird');var rp=require(_0xd758('0x4'));var fs=require('fs');var path=require(_0xd758('0x5'));var rimraf=require(_0xd758('0x6'));var config=require(_0xd758('0x7'));var attributes=require(_0xd758('0x8'));module[_0xd758('0x9')]=function(_0x10f5d2,_0x290160){return _0x10f5d2[_0xd758('0xa')](_0xd758('0xb'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd758('0xc'),'collate':_0xd758('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index da05caf..827ccd4 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 _0x80ce=['ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','socket.io-emitter','register','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x302aad,_0x5b5ad7){var _0x4274e4=function(_0xdf5496){while(--_0xdf5496){_0x302aad['push'](_0x302aad['shift']());}};_0x4274e4(++_0x5b5ad7);}(_0x80ce,0xae));var _0xe80c=function(_0x56c381,_0x30c0f2){_0x56c381=_0x56c381-0x0;var _0x54d4fc=_0x80ce[_0x56c381];return _0x54d4fc;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe80c('0x0'));var rs=require(_0xe80c('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe80c('0x2'))['db'];var utils=require(_0xe80c('0x3'));var logger=require(_0xe80c('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe80c('0x5')][_0xe80c('0x6')]({'port':0x232a});config[_0xe80c('0x7')]=_[_0xe80c('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe80c('0x9'))(new Redis(config[_0xe80c('0x7')]));require('./chatInternalMessage.socket')[_0xe80c('0xa')](socket);function respondWithRpcPromise(_0x21f32c,_0x1338af,_0x3cfbeb){return new BPromise(function(_0x75b98f,_0x4881f9){return client['request'](_0x21f32c,_0x3cfbeb)['then'](function(_0xa08bf1){logger[_0xe80c('0xb')](_0xe80c('0xc'),_0x1338af,_0xe80c('0xd'));logger[_0xe80c('0xe')](_0xe80c('0xf'),_0x1338af,_0xe80c('0xd'),JSON[_0xe80c('0x10')](_0xa08bf1));if(_0xa08bf1[_0xe80c('0x11')]){if(_0xa08bf1[_0xe80c('0x11')][_0xe80c('0x12')]===0x1f4){logger[_0xe80c('0x11')](_0xe80c('0xc'),_0x1338af,_0xa08bf1['error'][_0xe80c('0x13')]);return _0x4881f9(_0xa08bf1['error'][_0xe80c('0x13')]);}logger[_0xe80c('0x11')](_0xe80c('0xc'),_0x1338af,_0xa08bf1['error'][_0xe80c('0x13')]);return _0x75b98f(_0xa08bf1[_0xe80c('0x11')]['message']);}else{logger[_0xe80c('0xb')](_0xe80c('0xc'),_0x1338af,'request\x20sent');_0x75b98f(_0xa08bf1[_0xe80c('0x14')][_0xe80c('0x13')]);}})['catch'](function(_0x4c431c){logger[_0xe80c('0x11')](_0xe80c('0xc'),_0x1338af,_0x4c431c);_0x4881f9(_0x4c431c);});});} \ No newline at end of file +var _0xbf44=['ChatInternalMessage,\x20%s,\x20%s','message','result','catch','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./chatInternalMessage.socket','register','request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2c976f,_0x4bd2c4){var _0x1a1227=function(_0x24597e){while(--_0x24597e){_0x2c976f['push'](_0x2c976f['shift']());}};_0x1a1227(++_0x4bd2c4);}(_0xbf44,0xdc));var _0x4bf4=function(_0x461c2e,_0x4015e2){_0x461c2e=_0x461c2e-0x0;var _0x524f15=_0xbf44[_0x461c2e];return _0x524f15;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4bf4('0x0'));var BPromise=require('bluebird');var rs=require(_0x4bf4('0x1'));var fs=require('fs');var Redis=require(_0x4bf4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4bf4('0x3'));var logger=require(_0x4bf4('0x4'))(_0x4bf4('0x5'));var config=require('../../config/environment');var jayson=require(_0x4bf4('0x6'));var client=jayson[_0x4bf4('0x7')]['http']({'port':0x232a});config['redis']=_[_0x4bf4('0x8')](config['redis'],{'host':_0x4bf4('0x9'),'port':0x18eb});var socket=require(_0x4bf4('0xa'))(new Redis(config[_0x4bf4('0xb')]));require(_0x4bf4('0xc'))[_0x4bf4('0xd')](socket);function respondWithRpcPromise(_0x489bb1,_0x5c066f,_0x19b660){return new BPromise(function(_0x10a9e2,_0x25f9b3){return client[_0x4bf4('0xe')](_0x489bb1,_0x19b660)[_0x4bf4('0xf')](function(_0x5c2d5a){logger[_0x4bf4('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x5c066f,_0x4bf4('0x11'));logger[_0x4bf4('0x12')](_0x4bf4('0x13'),_0x5c066f,_0x4bf4('0x11'),JSON[_0x4bf4('0x14')](_0x5c2d5a));if(_0x5c2d5a[_0x4bf4('0x15')]){if(_0x5c2d5a[_0x4bf4('0x15')][_0x4bf4('0x16')]===0x1f4){logger[_0x4bf4('0x15')](_0x4bf4('0x17'),_0x5c066f,_0x5c2d5a[_0x4bf4('0x15')][_0x4bf4('0x18')]);return _0x25f9b3(_0x5c2d5a[_0x4bf4('0x15')][_0x4bf4('0x18')]);}logger['error'](_0x4bf4('0x17'),_0x5c066f,_0x5c2d5a[_0x4bf4('0x15')][_0x4bf4('0x18')]);return _0x10a9e2(_0x5c2d5a[_0x4bf4('0x15')][_0x4bf4('0x18')]);}else{logger['info'](_0x4bf4('0x17'),_0x5c066f,_0x4bf4('0x11'));_0x10a9e2(_0x5c2d5a[_0x4bf4('0x19')][_0x4bf4('0x18')]);}})[_0x4bf4('0x1a')](function(_0x59dcb7){logger[_0x4bf4('0x15')](_0x4bf4('0x17'),_0x5c066f,_0x59dcb7);_0x25f9b3(_0x59dcb7);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index a0d858f..ec48c6c 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 _0xd1db=['update','removeListener','chatInternalMessage:','./chatInternalMessage.events','save','remove'];(function(_0x2b9ba5,_0x26f594){var _0x5cd927=function(_0x159963){while(--_0x159963){_0x2b9ba5['push'](_0x2b9ba5['shift']());}};_0x5cd927(++_0x26f594);}(_0xd1db,0x117));var _0xbd1d=function(_0x179b74,_0x5dc97d){_0x179b74=_0x179b74-0x0;var _0x268f76=_0xd1db[_0x179b74];return _0x268f76;};'use strict';var ChatInternalMessageEvents=require(_0xbd1d('0x0'));var events=[_0xbd1d('0x1'),_0xbd1d('0x2'),_0xbd1d('0x3')];function createListener(_0x3eb6e9,_0x37c592){return function(_0x534e23){_0x37c592['emit'](_0x3eb6e9,_0x534e23);};}function removeListener(_0x3c45b6,_0x4a1986){return function(){ChatInternalMessageEvents[_0xbd1d('0x4')](_0x3c45b6,_0x4a1986);};}exports['register']=function(_0x21173b){for(var _0x5dadf7=0x0,_0x44b791=events['length'];_0x5dadf7<_0x44b791;_0x5dadf7++){var _0x5cf508=events[_0x5dadf7];var _0x2e5527=createListener(_0xbd1d('0x5')+_0x5cf508,_0x21173b);ChatInternalMessageEvents['on'](_0x5cf508,_0x2e5527);}}; \ No newline at end of file +var _0x716a=['remove','update','register','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x571c89,_0x579586){var _0x52e8eb=function(_0x3db26c){while(--_0x3db26c){_0x571c89['push'](_0x571c89['shift']());}};_0x52e8eb(++_0x579586);}(_0x716a,0x91));var _0xa716=function(_0xd0a847,_0x72562b){_0xd0a847=_0xd0a847-0x0;var _0x2536ec=_0x716a[_0xd0a847];return _0x2536ec;};'use strict';var ChatInternalMessageEvents=require(_0xa716('0x0'));var events=[_0xa716('0x1'),_0xa716('0x2'),_0xa716('0x3')];function createListener(_0x525c95,_0x4f6892){return function(_0x297c53){_0x4f6892['emit'](_0x525c95,_0x297c53);};}function removeListener(_0x3ba5cd,_0x14ea82){return function(){ChatInternalMessageEvents['removeListener'](_0x3ba5cd,_0x14ea82);};}exports[_0xa716('0x4')]=function(_0x2fbfbb){for(var _0x54e6cc=0x0,_0x1296ba=events[_0xa716('0x5')];_0x54e6cc<_0x1296ba;_0x54e6cc++){var _0x20d370=events[_0x54e6cc];var _0x54d7ef=createListener(_0xa716('0x6')+_0x20d370,_0x2fbfbb);ChatInternalMessageEvents['on'](_0x20d370,_0x54d7ef);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 9612ce1..db34f5b 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 _0x28a7=['exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','show','post','/:id','update'];(function(_0x5dd017,_0x28e6db){var _0x571094=function(_0x4a7e1f){while(--_0x4a7e1f){_0x5dd017['push'](_0x5dd017['shift']());}};_0x571094(++_0x28e6db);}(_0x28a7,0x1e1));var _0x728a=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x28a7[_0x484e36];return _0xafc85d;};'use strict';var multer=require(_0x728a('0x0'));var util=require(_0x728a('0x1'));var path=require('path');var timeout=require(_0x728a('0x2'));var express=require(_0x728a('0x3'));var router=express['Router']();var fs_extra=require(_0x728a('0x4'));var auth=require(_0x728a('0x5'));var interaction=require(_0x728a('0x6'));var config=require(_0x728a('0x7'));var controller=require(_0x728a('0x8'));router[_0x728a('0x9')]('/',auth[_0x728a('0xa')](),controller[_0x728a('0xb')]);router[_0x728a('0x9')](_0x728a('0xc'),auth[_0x728a('0xa')](),controller[_0x728a('0xd')]);router[_0x728a('0x9')](_0x728a('0xe'),auth[_0x728a('0xa')](),controller['getUsers']);router[_0x728a('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x728a('0xf')]);router[_0x728a('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x728a('0x11'),controller[_0x728a('0x12')]);router['delete'](_0x728a('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x728a('0x13')]=router; \ No newline at end of file +var _0x10d8=['isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x3245af,_0x4e12ad){var _0x55d99d=function(_0x59931a){while(--_0x59931a){_0x3245af['push'](_0x3245af['shift']());}};_0x55d99d(++_0x4e12ad);}(_0x10d8,0xee));var _0x810d=function(_0x293557,_0x6812df){_0x293557=_0x293557-0x0;var _0x366e5b=_0x10d8[_0x293557];return _0x366e5b;};'use strict';var multer=require(_0x810d('0x0'));var util=require(_0x810d('0x1'));var path=require(_0x810d('0x2'));var timeout=require('connect-timeout');var express=require(_0x810d('0x3'));var router=express[_0x810d('0x4')]();var fs_extra=require(_0x810d('0x5'));var auth=require(_0x810d('0x6'));var interaction=require(_0x810d('0x7'));var config=require('../../config/environment');var controller=require('./chatInternalMessage.controller');router[_0x810d('0x8')]('/',auth[_0x810d('0x9')](),controller[_0x810d('0xa')]);router[_0x810d('0x8')](_0x810d('0xb'),auth[_0x810d('0x9')](),controller[_0x810d('0xc')]);router['get']('/users',auth['isAuthenticated'](),controller['getUsers']);router[_0x810d('0x8')](_0x810d('0xd'),auth[_0x810d('0x9')](),controller[_0x810d('0xe')]);router['post']('/',auth[_0x810d('0x9')](),controller[_0x810d('0xf')]);router[_0x810d('0x10')](_0x810d('0xd'),controller['update']);router[_0x810d('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x810d('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 3bdab27..c09d53f 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 _0x536f=['out','STRING','sequelize','BOOLEAN','ENUM'];(function(_0x548cf2,_0x26f00a){var _0x27ecba=function(_0x2fa99f){while(--_0x2fa99f){_0x548cf2['push'](_0x548cf2['shift']());}};_0x27ecba(++_0x26f00a);}(_0x536f,0x70));var _0xf536=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x536f[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xf536('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xf536('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf536('0x2')]('in',_0xf536('0x3')),'defaultValue':_0xf536('0x3'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xf536('0x4')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xee4e=['DATE','STRING','sequelize','exports','TEXT','BOOLEAN','ENUM','out'];(function(_0x1f94a0,_0xddea50){var _0x5cb0ba=function(_0xf9139e){while(--_0xf9139e){_0x1f94a0['push'](_0x1f94a0['shift']());}};_0x5cb0ba(++_0xddea50);}(_0xee4e,0x122));var _0xeee4=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xee4e[_0xbd08b4];return _0x314f1e;};'use strict';var Sequelize=require(_0xeee4('0x0'));module[_0xeee4('0x1')]={'body':{'type':Sequelize[_0xeee4('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xeee4('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xeee4('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xeee4('0x4')]('in',_0xeee4('0x5')),'defaultValue':_0xeee4('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xeee4('0x6')]},'providerName':{'type':Sequelize[_0xeee4('0x7')]},'providerResponse':{'type':Sequelize[_0xeee4('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index bcf3909..5891006 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 _0xf493=['acceptMessage','sequelize','QueryTypes','SELECT','contact','fullname','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','ContactId','User','internal','format','rejectmessage','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatMessage.socket','register','client','http','request','then','request\x20sent','debug','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','info','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','stack','name','send','index','map','ChatMessage','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','options','find','create','body','describe','chat-interactions','accept','chat','YYYY-MM-DD\x20HH:mm:ss','user','agent','UserId','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage'];(function(_0x67754c,_0x4ee2c1){var _0x1f09ec=function(_0x255080){while(--_0x255080){_0x67754c['push'](_0x67754c['shift']());}};_0x1f09ec(++_0x4ee2c1);}(_0xf493,0x116));var _0x3f49=function(_0xabdfcd,_0x4ea11d){_0xabdfcd=_0xabdfcd-0x0;var _0x18172b=_0xf493[_0xabdfcd];return _0x18172b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3f49('0x0'));var zipdir=require(_0x3f49('0x1'));var jsonpatch=require(_0x3f49('0x2'));var rp=require('request-promise');var moment=require(_0x3f49('0x3'));var BPromise=require(_0x3f49('0x4'));var Mustache=require(_0x3f49('0x5'));var util=require(_0x3f49('0x6'));var path=require(_0x3f49('0x7'));var sox=require(_0x3f49('0x8'));var csv=require('to-csv');var ejs=require(_0x3f49('0x9'));var fs=require('fs');var fs_extra=require(_0x3f49('0xa'));var _=require('lodash');var squel=require(_0x3f49('0xb'));var crypto=require(_0x3f49('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3f49('0xd'));var toCsv=require(_0x3f49('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3f49('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3f49('0x10'));var as=require(_0x3f49('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f49('0x12'))(_0x3f49('0x13'));var utils=require(_0x3f49('0x14'));var config=require(_0x3f49('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3f49('0x16'))['db'];config[_0x3f49('0x17')]=_[_0x3f49('0x18')](config[_0x3f49('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x3f49('0x19'))(new Redis(config['redis']));require(_0x3f49('0x1a'))[_0x3f49('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3f49('0x1c')][_0x3f49('0x1d')]({'port':0x232c});var client9002=jayson[_0x3f49('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33effe,_0x3aa104,_0x44d15c,_0xab7269){return new BPromise(function(_0x4ba304,_0x41d6e6){var _0x29f894=_0xab7269||client;return _0x29f894[_0x3f49('0x1e')](_0x33effe,_0x44d15c)[_0x3f49('0x1f')](function(_0x4c4b30){logger['info']('ChatMessage,\x20%s,\x20%s',_0x3aa104,_0x3f49('0x20'));logger[_0x3f49('0x21')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x3aa104,_0x3f49('0x20'),JSON[_0x3f49('0x22')](_0x4c4b30));if(_0x4c4b30['error']){if(_0x4c4b30[_0x3f49('0x23')][_0x3f49('0x24')]===0x1f4){logger[_0x3f49('0x23')](_0x3f49('0x25'),_0x3aa104,_0x4c4b30['error'][_0x3f49('0x26')]);return _0x41d6e6(_0x4c4b30['error']['message']);}logger[_0x3f49('0x23')](_0x3f49('0x25'),_0x3aa104,_0x4c4b30[_0x3f49('0x23')][_0x3f49('0x26')]);return _0x4ba304(_0x4c4b30['error'][_0x3f49('0x26')]);}else{logger[_0x3f49('0x27')](_0x3f49('0x25'),_0x3aa104,_0x3f49('0x20'));_0x4ba304(_0x4c4b30[_0x3f49('0x28')][_0x3f49('0x26')]);}})['catch'](function(_0x207818){logger[_0x3f49('0x23')](_0x3f49('0x25'),_0x3aa104,_0x207818);_0x41d6e6(_0x207818);});});}function respondWithStatusCode(_0x8a9d96,_0xdb0a3e){_0xdb0a3e=_0xdb0a3e||0xcc;return function(_0x5ec906){if(_0x5ec906){return _0x8a9d96[_0x3f49('0x29')](_0xdb0a3e);}return _0x8a9d96[_0x3f49('0x2a')](_0xdb0a3e)[_0x3f49('0x2b')]();};}function respondWithResult(_0x30a899,_0x2dac1a){_0x2dac1a=_0x2dac1a||0xc8;return function(_0x2079df){if(_0x2079df){return _0x30a899[_0x3f49('0x2a')](_0x2dac1a)[_0x3f49('0x2c')](_0x2079df);}};}function respondWithFilteredResult(_0x866e9a,_0x22ab02){return function(_0x4ab3c5){if(_0x4ab3c5){var _0x14e1e4=typeof _0x22ab02[_0x3f49('0x2d')]===_0x3f49('0x2e')&&typeof _0x22ab02[_0x3f49('0x2f')]==='undefined';var _0x4b17f4=_0x4ab3c5[_0x3f49('0x30')];var _0x15d0c3=_0x14e1e4?0x0:_0x22ab02[_0x3f49('0x2d')];var _0x36ff3a=_0x14e1e4?_0x4ab3c5[_0x3f49('0x30')]:_0x22ab02[_0x3f49('0x2d')]+_0x22ab02[_0x3f49('0x2f')];var _0x23f8b3;if(_0x36ff3a>=_0x4b17f4){_0x36ff3a=_0x4b17f4;_0x23f8b3=0xc8;}else{_0x23f8b3=0xce;}_0x866e9a[_0x3f49('0x2a')](_0x23f8b3);return _0x866e9a[_0x3f49('0x31')](_0x3f49('0x32'),_0x15d0c3+'-'+_0x36ff3a+'/'+_0x4b17f4)[_0x3f49('0x2c')](_0x4ab3c5);}return null;};}function patchUpdates(_0x3ae041){return function(_0x234f21){try{jsonpatch['apply'](_0x234f21,_0x3ae041,!![]);}catch(_0x5a8573){return BPromise[_0x3f49('0x33')](_0x5a8573);}return _0x234f21['save']();};}function saveUpdates(_0x1050bc,_0x375652){return function(_0x1989b9){if(_0x1989b9){return _0x1989b9[_0x3f49('0x34')](_0x1050bc)[_0x3f49('0x1f')](function(_0x48372a){return _0x48372a;});}return null;};}function removeEntity(_0x2daf56,_0x158617){return function(_0x22a2da){if(_0x22a2da){return _0x22a2da[_0x3f49('0x35')]()[_0x3f49('0x1f')](function(){_0x2daf56[_0x3f49('0x2a')](0xcc)[_0x3f49('0x2b')]();});}};}function handleEntityNotFound(_0x4593ba,_0x261516){return function(_0x315f48){if(!_0x315f48){_0x4593ba[_0x3f49('0x29')](0x194);}return _0x315f48;};}function handleError(_0x406a9d,_0xba088c){_0xba088c=_0xba088c||0x1f4;return function(_0x573bef){logger[_0x3f49('0x23')](_0x573bef[_0x3f49('0x36')]);if(_0x573bef[_0x3f49('0x37')]){delete _0x573bef['name'];}_0x406a9d[_0x3f49('0x2a')](_0xba088c)[_0x3f49('0x38')](_0x573bef);};}exports[_0x3f49('0x39')]=function(_0x7fe4df,_0x23c454){var _0x33abd9={},_0x5b6c35={},_0x59aae6={'count':0x0,'rows':[]};var _0x47ea41=_[_0x3f49('0x3a')](db[_0x3f49('0x3b')]['rawAttributes'],function(_0x4c547e){return{'name':_0x4c547e['fieldName'],'type':_0x4c547e[_0x3f49('0x3c')]['key']};});_0x5b6c35[_0x3f49('0x3d')]=_[_0x3f49('0x3a')](_0x47ea41,'name');_0x5b6c35[_0x3f49('0x3e')]=_['keys'](_0x7fe4df[_0x3f49('0x3e')]);_0x5b6c35[_0x3f49('0x3f')]=_[_0x3f49('0x40')](_0x5b6c35['model'],_0x5b6c35['query']);_0x33abd9['attributes']=_[_0x3f49('0x40')](_0x5b6c35['model'],qs[_0x3f49('0x41')](_0x7fe4df[_0x3f49('0x3e')]['fields']));_0x33abd9[_0x3f49('0x42')]=_0x33abd9[_0x3f49('0x42')][_0x3f49('0x43')]?_0x33abd9[_0x3f49('0x42')]:_0x5b6c35['model'];if(!_0x7fe4df[_0x3f49('0x3e')][_0x3f49('0x44')](_0x3f49('0x45'))){_0x33abd9[_0x3f49('0x2f')]=qs['limit'](_0x7fe4df[_0x3f49('0x3e')]['limit']);_0x33abd9[_0x3f49('0x2d')]=qs[_0x3f49('0x2d')](_0x7fe4df[_0x3f49('0x3e')][_0x3f49('0x2d')]);}_0x33abd9[_0x3f49('0x46')]=qs[_0x3f49('0x47')](_0x7fe4df[_0x3f49('0x3e')][_0x3f49('0x47')]);_0x33abd9['where']=qs['filters'](_[_0x3f49('0x48')](_0x7fe4df[_0x3f49('0x3e')],_0x5b6c35[_0x3f49('0x3f')]),_0x47ea41);if(_0x7fe4df[_0x3f49('0x3e')][_0x3f49('0x49')]){_0x33abd9[_0x3f49('0x4a')]=_[_0x3f49('0x4b')](_0x33abd9[_0x3f49('0x4a')],{'$or':_[_0x3f49('0x3a')](_0x47ea41,function(_0x20e112){if(_0x20e112[_0x3f49('0x3c')]!==_0x3f49('0x4c')){var _0x1201f5={};_0x1201f5[_0x20e112[_0x3f49('0x37')]]={'$like':'%'+_0x7fe4df['query'][_0x3f49('0x49')]+'%'};return _0x1201f5;}})});}_0x33abd9=_['merge']({},_0x33abd9,_0x7fe4df['options']);var _0x252f31={'where':_0x33abd9[_0x3f49('0x4a')]};return db[_0x3f49('0x3b')]['count'](_0x252f31)[_0x3f49('0x1f')](function(_0x513a15){_0x59aae6[_0x3f49('0x30')]=_0x513a15;if(_0x7fe4df[_0x3f49('0x3e')][_0x3f49('0x4d')]){_0x33abd9[_0x3f49('0x4e')]=[{'all':!![]}];}return db['ChatMessage'][_0x3f49('0x4f')](_0x33abd9);})[_0x3f49('0x1f')](function(_0x51232f){_0x59aae6[_0x3f49('0x50')]=_0x51232f;return _0x59aae6;})[_0x3f49('0x1f')](respondWithFilteredResult(_0x23c454,_0x33abd9))[_0x3f49('0x51')](handleError(_0x23c454,null));};exports['show']=function(_0x53d850,_0x389586){var _0x4b1555={'raw':!![],'where':{'id':_0x53d850[_0x3f49('0x52')]['id']}},_0x566820={};_0x566820[_0x3f49('0x3d')]=_[_0x3f49('0x53')](db[_0x3f49('0x3b')]['rawAttributes']);_0x566820['query']=_[_0x3f49('0x53')](_0x53d850['query']);_0x566820[_0x3f49('0x3f')]=_[_0x3f49('0x40')](_0x566820[_0x3f49('0x3d')],_0x566820[_0x3f49('0x3e')]);_0x4b1555[_0x3f49('0x42')]=_[_0x3f49('0x40')](_0x566820[_0x3f49('0x3d')],qs[_0x3f49('0x41')](_0x53d850[_0x3f49('0x3e')][_0x3f49('0x41')]));_0x4b1555[_0x3f49('0x42')]=_0x4b1555['attributes'][_0x3f49('0x43')]?_0x4b1555[_0x3f49('0x42')]:_0x566820[_0x3f49('0x3d')];if(_0x53d850['query'][_0x3f49('0x4d')]){_0x4b1555[_0x3f49('0x4e')]=[{'all':!![]}];}_0x4b1555=_[_0x3f49('0x4b')]({},_0x4b1555,_0x53d850[_0x3f49('0x54')]);return db[_0x3f49('0x3b')][_0x3f49('0x55')](_0x4b1555)[_0x3f49('0x1f')](handleEntityNotFound(_0x389586,null))[_0x3f49('0x1f')](respondWithResult(_0x389586,null))[_0x3f49('0x51')](handleError(_0x389586,null));};exports[_0x3f49('0x56')]=function(_0x1c8008,_0x36fc90){return db[_0x3f49('0x3b')][_0x3f49('0x56')](_0x1c8008[_0x3f49('0x57')],{})[_0x3f49('0x1f')](respondWithResult(_0x36fc90,0xc9))[_0x3f49('0x51')](handleError(_0x36fc90,null));};exports[_0x3f49('0x34')]=function(_0x2ee7f6,_0x48a9f7){if(_0x2ee7f6[_0x3f49('0x57')]['id']){delete _0x2ee7f6[_0x3f49('0x57')]['id'];}return db[_0x3f49('0x3b')][_0x3f49('0x55')]({'where':{'id':_0x2ee7f6[_0x3f49('0x52')]['id']}})['then'](handleEntityNotFound(_0x48a9f7,null))[_0x3f49('0x1f')](saveUpdates(_0x2ee7f6[_0x3f49('0x57')],null))['then'](respondWithResult(_0x48a9f7,null))[_0x3f49('0x51')](handleError(_0x48a9f7,null));};exports[_0x3f49('0x35')]=function(_0x4820b0,_0x3d3bd2){return db['ChatMessage'][_0x3f49('0x55')]({'where':{'id':_0x4820b0[_0x3f49('0x52')]['id']}})['then'](handleEntityNotFound(_0x3d3bd2,null))[_0x3f49('0x1f')](removeEntity(_0x3d3bd2,null))[_0x3f49('0x51')](handleError(_0x3d3bd2,null));};exports[_0x3f49('0x58')]=function(_0x3e5beb,_0x454590){return db[_0x3f49('0x3b')][_0x3f49('0x58')]()[_0x3f49('0x1f')](respondWithResult(_0x454590,null))['catch'](handleError(_0x454590,null));};var interaction_log=require(_0x3f49('0x12'))(_0x3f49('0x59'));exports[_0x3f49('0x5a')]=function(_0x555363,_0x2e6057,_0x1e0d51){var _0x1e65e8={'agent':{},'channel':_0x3f49('0x5b')};if(_0x555363[_0x3f49('0x57')]['id']){delete _0x555363[_0x3f49('0x57')]['id'];}_0x555363['body']['read']=!![];_0x555363['body']['readAt']=moment()['format'](_0x3f49('0x5c'));_0x555363['body']['UserId']=_0x555363[_0x3f49('0x57')]['UserId']||_0x555363[_0x3f49('0x5d')]['id'];_0x1e65e8[_0x3f49('0x5e')]['id']=_0x555363[_0x3f49('0x57')][_0x3f49('0x5f')];return db['ChatMessage'][_0x3f49('0x55')]({'where':{'id':_0x555363['params']['id'],'UserId':null}})[_0x3f49('0x1f')](handleEntityNotFound(_0x2e6057,null))[_0x3f49('0x1f')](saveUpdates(_0x555363[_0x3f49('0x57')],null))[_0x3f49('0x1f')](function(_0x3a9477){if(_0x3a9477){_0x1e65e8[_0x3f49('0x26')]=_0x3a9477['get']({'plain':!![]});return db[_0x3f49('0x60')]['find']({'where':{'id':_0x3a9477[_0x3f49('0x61')]}});}return null;})[_0x3f49('0x1f')](handleEntityNotFound(_0x2e6057,null))[_0x3f49('0x1f')](function(_0x473802){if(_0x473802){return _0x473802['update']({'UserId':_0x555363['body']['UserId'],'read1stAt':_[_0x3f49('0x62')](_0x473802[_0x3f49('0x63')])?moment()['format'](_0x3f49('0x5c')):undefined});}return null;})['then'](function(_0x39ead){if(_0x39ead){_0x1e65e8[_0x3f49('0x64')]=_0x39ead[_0x3f49('0x65')]({'plain':!![]});interaction_log[_0x3f49('0x27')](_0x3f49('0x66'),_0x555363[_0x3f49('0x5d')]['id'],_0x555363['user']['name'],_0x555363[_0x3f49('0x5d')][_0x3f49('0x67')],_0x1e65e8[_0x3f49('0x64')]['id'],_0x555363[_0x3f49('0x57')]?JSON[_0x3f49('0x22')](_0x555363['body']):_0x3f49('0x68'));return respondWithRpcPromise(_0x3f49('0x69'),_0x3f49('0x6a'),_0x1e65e8);}return null;})['then'](function(_0x2c1bf2){var _0x51a950='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2c1bf2[_0x3f49('0x26')]['ContactId'];return db[_0x3f49('0x6b')][_0x3f49('0x3e')](_0x51a950,{'type':db['Sequelize'][_0x3f49('0x6c')][_0x3f49('0x6d')],'raw':!![]})['then'](function(_0x3b9f1e){return _0x3b9f1e;});})['then'](function(_0x712ea4){if(_0x712ea4){_0x1e65e8[_0x3f49('0x26')][_0x3f49('0x6e')]=_0x712ea4[0x0];if(!_0x555363[_0x3f49('0x57')][_0x3f49('0x5f')])return;return db['User'][_0x3f49('0x55')]({'where':{'id':_0x555363['body'][_0x3f49('0x5f')],'role':_0x3f49('0x5e')},'attributes':['id','name',_0x3f49('0x6f'),'email','internal'],'raw':!![]});}return null;})[_0x3f49('0x1f')](function(_0x53586b){if(!_0x53586b)return null;_0x1e65e8[_0x3f49('0x26')][_0x3f49('0x5e')]=_0x53586b;return _0x1e65e8;})['then'](function(_0x3115d0){if(_0x3115d0){if(_0x555363['body'][_0x3f49('0x70')]){_0x1e65e8[_0x3f49('0x26')][_0x3f49('0x71')]=util['format'](_0x3f49('0x72'),_0x555363[_0x3f49('0x5d')][_0x3f49('0x37')]);_0x1e65e8[_0x3f49('0x26')]['channel']=_0x1e65e8[_0x3f49('0x73')];_0x1e65e8[_0x3f49('0x26')][_0x3f49('0x74')]=_0x1e65e8[_0x3f49('0x73')];_0x1e65e8[_0x3f49('0x26')][_0x3f49('0x75')]='accept';return respondWithRpcPromise('EventManager',_0x3f49('0x76'),{'event':'acceptmessage','message':_[_0x3f49('0x4b')](_0x1e65e8[_0x3f49('0x26')],JSON[_0x3f49('0x77')](_0x1e65e8[_0x3f49('0x64')][_0x3f49('0x78')]))},client9002)[_0x3f49('0x1f')](function(){return _0x1e65e8;});}return _0x1e65e8;}return null;})['then'](respondWithResult(_0x2e6057,null))[_0x3f49('0x51')](handleError(_0x2e6057,null));};var interaction_log=require('../../config/logger')(_0x3f49('0x59'));exports[_0x3f49('0x33')]=function(_0x3cbaca,_0x4cd3ac,_0x5693fa){var _0x4063e6={'agent':{},'channel':_0x3f49('0x5b')};if(_0x3cbaca[_0x3f49('0x57')]['id']){delete _0x3cbaca[_0x3f49('0x57')]['id'];}_0x3cbaca[_0x3f49('0x57')][_0x3f49('0x5f')]=_0x3cbaca[_0x3f49('0x57')][_0x3f49('0x5f')]||_0x3cbaca[_0x3f49('0x5d')]['id'];_0x4063e6[_0x3f49('0x5e')]['id']=_0x3cbaca[_0x3f49('0x57')][_0x3f49('0x5f')];return db[_0x3f49('0x3b')][_0x3f49('0x55')]({'where':{'id':_0x3cbaca[_0x3f49('0x52')]['id'],'UserId':null}})[_0x3f49('0x1f')](handleEntityNotFound(_0x4cd3ac,null))[_0x3f49('0x1f')](function(_0x17ff76){if(_0x17ff76){_0x4063e6[_0x3f49('0x26')]=_0x17ff76[_0x3f49('0x65')]({'plain':!![]});return db[_0x3f49('0x60')]['find']({'where':{'id':_0x17ff76[_0x3f49('0x61')]}});}return null;})[_0x3f49('0x1f')](handleEntityNotFound(_0x4cd3ac,null))[_0x3f49('0x1f')](function(_0x3fc341){if(_0x3fc341){_0x4063e6[_0x3f49('0x64')]=_0x3fc341['get']({'plain':!![]});interaction_log[_0x3f49('0x27')](_0x3f49('0x79'),_0x3cbaca[_0x3f49('0x5d')]['id'],_0x3cbaca['user'][_0x3f49('0x37')],_0x3cbaca['user'][_0x3f49('0x67')],_0x4063e6[_0x3f49('0x64')]['id'],_0x3cbaca[_0x3f49('0x57')]?JSON[_0x3f49('0x22')](_0x3cbaca[_0x3f49('0x57')]):_0x3f49('0x68'));return respondWithRpcPromise('RejectMessage',_0x3f49('0x7a'),_0x4063e6);}return null;})[_0x3f49('0x1f')](function(_0x593eca){var _0xbf5a1a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x593eca['message'][_0x3f49('0x7b')];return db[_0x3f49('0x6b')][_0x3f49('0x3e')](_0xbf5a1a,{'type':db['Sequelize'][_0x3f49('0x6c')][_0x3f49('0x6d')],'raw':!![]})[_0x3f49('0x1f')](function(_0x33472a){return _0x33472a;});})[_0x3f49('0x1f')](function(_0x2f4c5d){if(_0x2f4c5d){_0x4063e6['message'][_0x3f49('0x6e')]=_0x2f4c5d[0x0];if(!_0x3cbaca[_0x3f49('0x57')][_0x3f49('0x5f')])return;return db[_0x3f49('0x7c')][_0x3f49('0x55')]({'where':{'id':_0x3cbaca['body']['UserId'],'role':_0x3f49('0x5e')},'attributes':['id','name',_0x3f49('0x6f'),'email',_0x3f49('0x7d')],'raw':!![]});}return null;})[_0x3f49('0x1f')](function(_0x3b6338){if(!_0x3b6338)return null;_0x4063e6[_0x3f49('0x26')][_0x3f49('0x5e')]=_0x3b6338;return _0x4063e6;})[_0x3f49('0x1f')](function(_0x54f5d7){if(_0x54f5d7){_0x54f5d7[_0x3f49('0x26')][_0x3f49('0x71')]=util[_0x3f49('0x7e')]('SIP/%s',_0x3cbaca[_0x3f49('0x5d')][_0x3f49('0x37')]);_0x54f5d7['message']['channel']=_0x4063e6[_0x3f49('0x73')];_0x54f5d7[_0x3f49('0x26')][_0x3f49('0x74')]=_0x4063e6['channel'];_0x54f5d7[_0x3f49('0x26')][_0x3f49('0x75')]=_0x3f49('0x33');respondWithRpcPromise(_0x3f49('0x76'),_0x3f49('0x76'),{'event':_0x3f49('0x7f'),'message':_[_0x3f49('0x4b')](_0x4063e6[_0x3f49('0x26')],JSON[_0x3f49('0x77')](_0x4063e6['interaction'][_0x3f49('0x78')]))},client9002);return _0x4063e6;}return null;})['then'](respondWithResult(_0x4cd3ac,null))[_0x3f49('0x51')](handleError(_0x4cd3ac,null));}; \ No newline at end of file +var _0x71f0=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','client','http','request','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','index','map','rawAttributes','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filters','filter','merge','type','options','ChatMessage','includeAll','findAll','rows','length','include','find','create','body','params','describe','chat-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','interface','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x47e714,_0x1d3db4){var _0x45215f=function(_0x32789d){while(--_0x32789d){_0x47e714['push'](_0x47e714['shift']());}};_0x45215f(++_0x1d3db4);}(_0x71f0,0x108));var _0x071f=function(_0x3ba69c,_0x3e370c){_0x3ba69c=_0x3ba69c-0x0;var _0x1c722b=_0x71f0[_0x3ba69c];return _0x1c722b;};'use strict';var emlformat=require(_0x071f('0x0'));var rimraf=require(_0x071f('0x1'));var zipdir=require(_0x071f('0x2'));var jsonpatch=require(_0x071f('0x3'));var rp=require('request-promise');var moment=require(_0x071f('0x4'));var BPromise=require(_0x071f('0x5'));var Mustache=require(_0x071f('0x6'));var util=require('util');var path=require(_0x071f('0x7'));var sox=require(_0x071f('0x8'));var csv=require(_0x071f('0x9'));var ejs=require(_0x071f('0xa'));var fs=require('fs');var fs_extra=require(_0x071f('0xb'));var _=require(_0x071f('0xc'));var squel=require(_0x071f('0xd'));var crypto=require(_0x071f('0xe'));var jsforce=require(_0x071f('0xf'));var deskjs=require(_0x071f('0x10'));var toCsv=require(_0x071f('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x071f('0x11'));var authService=require(_0x071f('0x12'));var qs=require(_0x071f('0x13'));var as=require(_0x071f('0x14'));var hardwareService=require(_0x071f('0x15'));var logger=require(_0x071f('0x16'))(_0x071f('0x17'));var utils=require(_0x071f('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x071f('0x19'));var db=require(_0x071f('0x1a'))['db'];config[_0x071f('0x1b')]=_[_0x071f('0x1c')](config[_0x071f('0x1b')],{'host':_0x071f('0x1d'),'port':0x18eb});var socket=require(_0x071f('0x1e'))(new Redis(config[_0x071f('0x1b')]));require(_0x071f('0x1f'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x071f('0x20')][_0x071f('0x21')]({'port':0x232c});var client9002=jayson[_0x071f('0x20')][_0x071f('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x17b774,_0x22d6b3,_0x5e1e46,_0x316bb3){return new BPromise(function(_0xd9666e,_0x243cfd){var _0x2c5ae0=_0x316bb3||client;return _0x2c5ae0[_0x071f('0x22')](_0x17b774,_0x5e1e46)['then'](function(_0x2ea2e5){logger[_0x071f('0x23')]('ChatMessage,\x20%s,\x20%s',_0x22d6b3,_0x071f('0x24'));logger[_0x071f('0x25')](_0x071f('0x26'),_0x22d6b3,_0x071f('0x24'),JSON[_0x071f('0x27')](_0x2ea2e5));if(_0x2ea2e5[_0x071f('0x28')]){if(_0x2ea2e5[_0x071f('0x28')][_0x071f('0x29')]===0x1f4){logger[_0x071f('0x28')](_0x071f('0x2a'),_0x22d6b3,_0x2ea2e5[_0x071f('0x28')][_0x071f('0x2b')]);return _0x243cfd(_0x2ea2e5[_0x071f('0x28')][_0x071f('0x2b')]);}logger['error'](_0x071f('0x2a'),_0x22d6b3,_0x2ea2e5[_0x071f('0x28')][_0x071f('0x2b')]);return _0xd9666e(_0x2ea2e5[_0x071f('0x28')][_0x071f('0x2b')]);}else{logger[_0x071f('0x23')](_0x071f('0x2a'),_0x22d6b3,_0x071f('0x24'));_0xd9666e(_0x2ea2e5[_0x071f('0x2c')][_0x071f('0x2b')]);}})[_0x071f('0x2d')](function(_0x1e3c7a){logger[_0x071f('0x28')](_0x071f('0x2a'),_0x22d6b3,_0x1e3c7a);_0x243cfd(_0x1e3c7a);});});}function respondWithStatusCode(_0x4ccd32,_0xcbfa50){_0xcbfa50=_0xcbfa50||0xcc;return function(_0x80f249){if(_0x80f249){return _0x4ccd32[_0x071f('0x2e')](_0xcbfa50);}return _0x4ccd32['status'](_0xcbfa50)[_0x071f('0x2f')]();};}function respondWithResult(_0x4a87cb,_0x3de5d4){_0x3de5d4=_0x3de5d4||0xc8;return function(_0x13e1ff){if(_0x13e1ff){return _0x4a87cb[_0x071f('0x30')](_0x3de5d4)[_0x071f('0x31')](_0x13e1ff);}};}function respondWithFilteredResult(_0x3b9b20,_0x3a5002){return function(_0x1fb8f0){if(_0x1fb8f0){var _0x26fd6a=typeof _0x3a5002['offset']==='undefined'&&typeof _0x3a5002['limit']===_0x071f('0x32');var _0x2cdf90=_0x1fb8f0['count'];var _0x194186=_0x26fd6a?0x0:_0x3a5002['offset'];var _0x55bc65=_0x26fd6a?_0x1fb8f0[_0x071f('0x33')]:_0x3a5002['offset']+_0x3a5002[_0x071f('0x34')];var _0x55e6a3;if(_0x55bc65>=_0x2cdf90){_0x55bc65=_0x2cdf90;_0x55e6a3=0xc8;}else{_0x55e6a3=0xce;}_0x3b9b20['status'](_0x55e6a3);return _0x3b9b20[_0x071f('0x35')](_0x071f('0x36'),_0x194186+'-'+_0x55bc65+'/'+_0x2cdf90)['json'](_0x1fb8f0);}return null;};}function patchUpdates(_0x518b31){return function(_0x396af0){try{jsonpatch[_0x071f('0x37')](_0x396af0,_0x518b31,!![]);}catch(_0x2b08c0){return BPromise[_0x071f('0x38')](_0x2b08c0);}return _0x396af0['save']();};}function saveUpdates(_0x5282d0,_0x95220c){return function(_0x142942){if(_0x142942){return _0x142942[_0x071f('0x39')](_0x5282d0)[_0x071f('0x3a')](function(_0x2d9b1e){return _0x2d9b1e;});}return null;};}function removeEntity(_0x45e64a,_0x343731){return function(_0x49d205){if(_0x49d205){return _0x49d205[_0x071f('0x3b')]()[_0x071f('0x3a')](function(){_0x45e64a[_0x071f('0x30')](0xcc)[_0x071f('0x2f')]();});}};}function handleEntityNotFound(_0x1836a5,_0x4aab95){return function(_0x4ede58){if(!_0x4ede58){_0x1836a5['sendStatus'](0x194);}return _0x4ede58;};}function handleError(_0x454862,_0x1ecc6d){_0x1ecc6d=_0x1ecc6d||0x1f4;return function(_0x5d83ac){logger[_0x071f('0x28')](_0x5d83ac[_0x071f('0x3c')]);if(_0x5d83ac[_0x071f('0x3d')]){delete _0x5d83ac[_0x071f('0x3d')];}_0x454862[_0x071f('0x30')](_0x1ecc6d)['send'](_0x5d83ac);};}exports[_0x071f('0x3e')]=function(_0x1e0a0c,_0x4f8af6){var _0x226b32={},_0x49e778={},_0x4b32fa={'count':0x0,'rows':[]};var _0x98a675=_[_0x071f('0x3f')](db['ChatMessage'][_0x071f('0x40')],function(_0x203407){return{'name':_0x203407['fieldName'],'type':_0x203407['type'][_0x071f('0x41')]};});_0x49e778[_0x071f('0x42')]=_['map'](_0x98a675,_0x071f('0x3d'));_0x49e778[_0x071f('0x43')]=_[_0x071f('0x44')](_0x1e0a0c[_0x071f('0x43')]);_0x49e778['filters']=_[_0x071f('0x45')](_0x49e778[_0x071f('0x42')],_0x49e778['query']);_0x226b32[_0x071f('0x46')]=_['intersection'](_0x49e778[_0x071f('0x42')],qs['fields'](_0x1e0a0c['query'][_0x071f('0x47')]));_0x226b32[_0x071f('0x46')]=_0x226b32[_0x071f('0x46')]['length']?_0x226b32[_0x071f('0x46')]:_0x49e778['model'];if(!_0x1e0a0c[_0x071f('0x43')][_0x071f('0x48')](_0x071f('0x49'))){_0x226b32[_0x071f('0x34')]=qs[_0x071f('0x34')](_0x1e0a0c[_0x071f('0x43')][_0x071f('0x34')]);_0x226b32[_0x071f('0x4a')]=qs['offset'](_0x1e0a0c[_0x071f('0x43')][_0x071f('0x4a')]);}_0x226b32[_0x071f('0x4b')]=qs[_0x071f('0x4c')](_0x1e0a0c['query']['sort']);_0x226b32[_0x071f('0x4d')]=qs['filters'](_[_0x071f('0x4e')](_0x1e0a0c[_0x071f('0x43')],_0x49e778[_0x071f('0x4f')]),_0x98a675);if(_0x1e0a0c[_0x071f('0x43')][_0x071f('0x50')]){_0x226b32[_0x071f('0x4d')]=_[_0x071f('0x51')](_0x226b32[_0x071f('0x4d')],{'$or':_[_0x071f('0x3f')](_0x98a675,function(_0x44fcf2){if(_0x44fcf2[_0x071f('0x52')]!=='VIRTUAL'){var _0x352170={};_0x352170[_0x44fcf2[_0x071f('0x3d')]]={'$like':'%'+_0x1e0a0c[_0x071f('0x43')][_0x071f('0x50')]+'%'};return _0x352170;}})});}_0x226b32=_['merge']({},_0x226b32,_0x1e0a0c[_0x071f('0x53')]);var _0x3510fe={'where':_0x226b32[_0x071f('0x4d')]};return db[_0x071f('0x54')][_0x071f('0x33')](_0x3510fe)[_0x071f('0x3a')](function(_0x27498d){_0x4b32fa[_0x071f('0x33')]=_0x27498d;if(_0x1e0a0c[_0x071f('0x43')][_0x071f('0x55')]){_0x226b32['include']=[{'all':!![]}];}return db[_0x071f('0x54')][_0x071f('0x56')](_0x226b32);})[_0x071f('0x3a')](function(_0x5510d3){_0x4b32fa[_0x071f('0x57')]=_0x5510d3;return _0x4b32fa;})[_0x071f('0x3a')](respondWithFilteredResult(_0x4f8af6,_0x226b32))[_0x071f('0x2d')](handleError(_0x4f8af6,null));};exports['show']=function(_0x4eb554,_0x455d21){var _0x5cb3de={'raw':!![],'where':{'id':_0x4eb554['params']['id']}},_0x6b8300={};_0x6b8300[_0x071f('0x42')]=_[_0x071f('0x44')](db[_0x071f('0x54')][_0x071f('0x40')]);_0x6b8300[_0x071f('0x43')]=_[_0x071f('0x44')](_0x4eb554[_0x071f('0x43')]);_0x6b8300['filters']=_['intersection'](_0x6b8300[_0x071f('0x42')],_0x6b8300[_0x071f('0x43')]);_0x5cb3de[_0x071f('0x46')]=_[_0x071f('0x45')](_0x6b8300['model'],qs[_0x071f('0x47')](_0x4eb554['query'][_0x071f('0x47')]));_0x5cb3de[_0x071f('0x46')]=_0x5cb3de[_0x071f('0x46')][_0x071f('0x58')]?_0x5cb3de[_0x071f('0x46')]:_0x6b8300[_0x071f('0x42')];if(_0x4eb554[_0x071f('0x43')][_0x071f('0x55')]){_0x5cb3de[_0x071f('0x59')]=[{'all':!![]}];}_0x5cb3de=_[_0x071f('0x51')]({},_0x5cb3de,_0x4eb554[_0x071f('0x53')]);return db[_0x071f('0x54')][_0x071f('0x5a')](_0x5cb3de)['then'](handleEntityNotFound(_0x455d21,null))[_0x071f('0x3a')](respondWithResult(_0x455d21,null))['catch'](handleError(_0x455d21,null));};exports[_0x071f('0x5b')]=function(_0x2a577f,_0x2ef480){return db[_0x071f('0x54')][_0x071f('0x5b')](_0x2a577f[_0x071f('0x5c')],{})[_0x071f('0x3a')](respondWithResult(_0x2ef480,0xc9))[_0x071f('0x2d')](handleError(_0x2ef480,null));};exports[_0x071f('0x39')]=function(_0x3af541,_0x318396){if(_0x3af541[_0x071f('0x5c')]['id']){delete _0x3af541['body']['id'];}return db[_0x071f('0x54')][_0x071f('0x5a')]({'where':{'id':_0x3af541[_0x071f('0x5d')]['id']}})[_0x071f('0x3a')](handleEntityNotFound(_0x318396,null))['then'](saveUpdates(_0x3af541[_0x071f('0x5c')],null))[_0x071f('0x3a')](respondWithResult(_0x318396,null))[_0x071f('0x2d')](handleError(_0x318396,null));};exports[_0x071f('0x3b')]=function(_0x5b010c,_0x3a9b36){return db[_0x071f('0x54')]['find']({'where':{'id':_0x5b010c['params']['id']}})['then'](handleEntityNotFound(_0x3a9b36,null))[_0x071f('0x3a')](removeEntity(_0x3a9b36,null))['catch'](handleError(_0x3a9b36,null));};exports[_0x071f('0x5e')]=function(_0x33357c,_0x4cfd9e){return db[_0x071f('0x54')][_0x071f('0x5e')]()[_0x071f('0x3a')](respondWithResult(_0x4cfd9e,null))[_0x071f('0x2d')](handleError(_0x4cfd9e,null));};var interaction_log=require(_0x071f('0x16'))(_0x071f('0x5f'));exports[_0x071f('0x60')]=function(_0x1c29fe,_0x2a3f59,_0x4f16b7){var _0x47a668={'agent':{},'channel':'chat'};if(_0x1c29fe[_0x071f('0x5c')]['id']){delete _0x1c29fe['body']['id'];}_0x1c29fe['body']['read']=!![];_0x1c29fe[_0x071f('0x5c')][_0x071f('0x61')]=moment()[_0x071f('0x62')](_0x071f('0x63'));_0x1c29fe[_0x071f('0x5c')][_0x071f('0x64')]=_0x1c29fe[_0x071f('0x5c')][_0x071f('0x64')]||_0x1c29fe[_0x071f('0x65')]['id'];_0x47a668[_0x071f('0x66')]['id']=_0x1c29fe[_0x071f('0x5c')][_0x071f('0x64')];return db[_0x071f('0x54')][_0x071f('0x5a')]({'where':{'id':_0x1c29fe['params']['id'],'UserId':null}})[_0x071f('0x3a')](handleEntityNotFound(_0x2a3f59,null))[_0x071f('0x3a')](saveUpdates(_0x1c29fe[_0x071f('0x5c')],null))[_0x071f('0x3a')](function(_0x1a85c2){if(_0x1a85c2){_0x47a668['message']=_0x1a85c2[_0x071f('0x67')]({'plain':!![]});return db[_0x071f('0x68')][_0x071f('0x5a')]({'where':{'id':_0x1a85c2[_0x071f('0x69')]}});}return null;})[_0x071f('0x3a')](handleEntityNotFound(_0x2a3f59,null))['then'](function(_0x12c46c){if(_0x12c46c){return _0x12c46c['update']({'UserId':_0x1c29fe[_0x071f('0x5c')][_0x071f('0x64')],'read1stAt':_[_0x071f('0x6a')](_0x12c46c['read1stAt'])?moment()[_0x071f('0x62')](_0x071f('0x63')):undefined});}return null;})[_0x071f('0x3a')](function(_0x18146b){if(_0x18146b){_0x47a668[_0x071f('0x6b')]=_0x18146b[_0x071f('0x67')]({'plain':!![]});interaction_log['info'](_0x071f('0x6c'),_0x1c29fe['user']['id'],_0x1c29fe[_0x071f('0x65')][_0x071f('0x3d')],_0x1c29fe['user'][_0x071f('0x6d')],_0x47a668['interaction']['id'],_0x1c29fe[_0x071f('0x5c')]?JSON[_0x071f('0x27')](_0x1c29fe[_0x071f('0x5c')]):'null');return respondWithRpcPromise(_0x071f('0x6e'),_0x071f('0x6f'),_0x47a668);}return null;})['then'](function(_0x1f9f46){var _0x320cb6=_0x071f('0x70')+_0x1f9f46[_0x071f('0x2b')][_0x071f('0x71')];return db[_0x071f('0x72')]['query'](_0x320cb6,{'type':db[_0x071f('0x73')][_0x071f('0x74')][_0x071f('0x75')],'raw':!![]})[_0x071f('0x3a')](function(_0x172fdc){return _0x172fdc;});})['then'](function(_0x5517f3){if(_0x5517f3){_0x47a668[_0x071f('0x2b')][_0x071f('0x76')]=_0x5517f3[0x0];if(!_0x1c29fe['body'][_0x071f('0x64')])return;return db[_0x071f('0x77')][_0x071f('0x5a')]({'where':{'id':_0x1c29fe['body']['UserId'],'role':_0x071f('0x66')},'attributes':['id',_0x071f('0x3d'),_0x071f('0x78'),_0x071f('0x79'),_0x071f('0x7a')],'raw':!![]});}return null;})['then'](function(_0x2eff39){if(!_0x2eff39)return null;_0x47a668[_0x071f('0x2b')][_0x071f('0x66')]=_0x2eff39;return _0x47a668;})[_0x071f('0x3a')](function(_0x3dcc88){if(_0x3dcc88){if(_0x1c29fe['body']['manual']){_0x47a668[_0x071f('0x2b')]['interface']=util[_0x071f('0x62')](_0x071f('0x7b'),_0x1c29fe[_0x071f('0x65')][_0x071f('0x3d')]);_0x47a668[_0x071f('0x2b')][_0x071f('0x7c')]=_0x47a668['channel'];_0x47a668[_0x071f('0x2b')][_0x071f('0x7d')]=_0x47a668[_0x071f('0x7c')];_0x47a668[_0x071f('0x2b')][_0x071f('0x7e')]='accept';return respondWithRpcPromise(_0x071f('0x7f'),_0x071f('0x7f'),{'event':_0x071f('0x80'),'message':_[_0x071f('0x51')](_0x47a668[_0x071f('0x2b')],JSON[_0x071f('0x81')](_0x47a668[_0x071f('0x6b')][_0x071f('0x82')]))},client9002)[_0x071f('0x3a')](function(){return _0x47a668;});}return _0x47a668;}return null;})[_0x071f('0x3a')](respondWithResult(_0x2a3f59,null))[_0x071f('0x2d')](handleError(_0x2a3f59,null));};var interaction_log=require(_0x071f('0x16'))('chat-interactions');exports['reject']=function(_0x58c14e,_0x564455,_0x2b31c0){var _0x19b86e={'agent':{},'channel':'chat'};if(_0x58c14e['body']['id']){delete _0x58c14e[_0x071f('0x5c')]['id'];}_0x58c14e[_0x071f('0x5c')][_0x071f('0x64')]=_0x58c14e[_0x071f('0x5c')][_0x071f('0x64')]||_0x58c14e[_0x071f('0x65')]['id'];_0x19b86e[_0x071f('0x66')]['id']=_0x58c14e[_0x071f('0x5c')][_0x071f('0x64')];return db[_0x071f('0x54')][_0x071f('0x5a')]({'where':{'id':_0x58c14e[_0x071f('0x5d')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x564455,null))[_0x071f('0x3a')](function(_0x378d06){if(_0x378d06){_0x19b86e['message']=_0x378d06['get']({'plain':!![]});return db['ChatInteraction'][_0x071f('0x5a')]({'where':{'id':_0x378d06[_0x071f('0x69')]}});}return null;})['then'](handleEntityNotFound(_0x564455,null))['then'](function(_0x2e5eaa){if(_0x2e5eaa){_0x19b86e[_0x071f('0x6b')]=_0x2e5eaa[_0x071f('0x67')]({'plain':!![]});interaction_log[_0x071f('0x23')](_0x071f('0x83'),_0x58c14e[_0x071f('0x65')]['id'],_0x58c14e[_0x071f('0x65')]['name'],_0x58c14e[_0x071f('0x65')][_0x071f('0x6d')],_0x19b86e['interaction']['id'],_0x58c14e[_0x071f('0x5c')]?JSON[_0x071f('0x27')](_0x58c14e['body']):_0x071f('0x84'));return respondWithRpcPromise(_0x071f('0x85'),_0x071f('0x86'),_0x19b86e);}return null;})['then'](function(_0x1d828f){var _0x1a7978=_0x071f('0x70')+_0x1d828f[_0x071f('0x2b')][_0x071f('0x71')];return db[_0x071f('0x72')][_0x071f('0x43')](_0x1a7978,{'type':db[_0x071f('0x73')][_0x071f('0x74')][_0x071f('0x75')],'raw':!![]})[_0x071f('0x3a')](function(_0x2bf083){return _0x2bf083;});})[_0x071f('0x3a')](function(_0x23bdb1){if(_0x23bdb1){_0x19b86e[_0x071f('0x2b')][_0x071f('0x76')]=_0x23bdb1[0x0];if(!_0x58c14e['body'][_0x071f('0x64')])return;return db[_0x071f('0x77')]['find']({'where':{'id':_0x58c14e['body'][_0x071f('0x64')],'role':_0x071f('0x66')},'attributes':['id',_0x071f('0x3d'),_0x071f('0x78'),_0x071f('0x79'),_0x071f('0x7a')],'raw':!![]});}return null;})[_0x071f('0x3a')](function(_0x46e38b){if(!_0x46e38b)return null;_0x19b86e[_0x071f('0x2b')]['agent']=_0x46e38b;return _0x19b86e;})[_0x071f('0x3a')](function(_0x61eb){if(_0x61eb){_0x61eb[_0x071f('0x2b')][_0x071f('0x87')]=util['format'](_0x071f('0x7b'),_0x58c14e['user']['name']);_0x61eb[_0x071f('0x2b')][_0x071f('0x7c')]=_0x19b86e['channel'];_0x61eb[_0x071f('0x2b')][_0x071f('0x7d')]=_0x19b86e[_0x071f('0x7c')];_0x61eb[_0x071f('0x2b')][_0x071f('0x7e')]=_0x071f('0x38');respondWithRpcPromise('EventManager',_0x071f('0x7f'),{'event':_0x071f('0x88'),'message':_[_0x071f('0x51')](_0x19b86e[_0x071f('0x2b')],JSON[_0x071f('0x81')](_0x19b86e['interaction']['formData']))},client9002);return _0x19b86e;}return null;})[_0x071f('0x3a')](respondWithResult(_0x564455,null))[_0x071f('0x2d')](handleError(_0x564455,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 2a7d3fd..acbd25d 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 _0x9a8a=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','update','remove','emit'];(function(_0x59659b,_0x38a9a7){var _0x5db166=function(_0x2f6c4c){while(--_0x2f6c4c){_0x59659b['push'](_0x59659b['shift']());}};_0x5db166(++_0x38a9a7);}(_0x9a8a,0x161));var _0xa9a8=function(_0x509fa6,_0x47a80d){_0x509fa6=_0x509fa6-0x0;var _0x42b0aa=_0x9a8a[_0x509fa6];return _0x42b0aa;};'use strict';var EventEmitter=require(_0xa9a8('0x0'));var ChatMessage=require(_0xa9a8('0x1'))['db'][_0xa9a8('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xa9a8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa9a8('0x4'),'afterDestroy':_0xa9a8('0x5')};function emitEvent(_0x353be4){return function(_0x141aa5,_0x21acea,_0x41aab3){ChatMessageEvents[_0xa9a8('0x6')](_0x353be4+':'+_0x141aa5['id'],_0x141aa5);ChatMessageEvents['emit'](_0x353be4,_0x141aa5);_0x41aab3(null);};}for(var e in events){if(events[_0xa9a8('0x7')](e)){var event=events[e];ChatMessage[_0xa9a8('0x8')](e,emitEvent(event));}}module[_0xa9a8('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0xdc7c=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','ChatMessage'];(function(_0x179316,_0x300ac9){var _0x5f2c95=function(_0x190e96){while(--_0x190e96){_0x179316['push'](_0x179316['shift']());}};_0x5f2c95(++_0x300ac9);}(_0xdc7c,0x1ef));var _0xcdc7=function(_0x5ab00a,_0x507b0c){_0x5ab00a=_0x5ab00a-0x0;var _0x3fa341=_0xdc7c[_0x5ab00a];return _0x3fa341;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xcdc7('0x0'))['db'][_0xcdc7('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xcdc7('0x2'),'afterDestroy':_0xcdc7('0x3')};function emitEvent(_0x2f5d83){return function(_0x2113bc,_0x562c2d,_0x98525b){ChatMessageEvents[_0xcdc7('0x4')](_0x2f5d83+':'+_0x2113bc['id'],_0x2113bc);ChatMessageEvents[_0xcdc7('0x4')](_0x2f5d83,_0x2113bc);_0x98525b(null);};}for(var e in events){if(events[_0xcdc7('0x5')](e)){var event=events[e];ChatMessage[_0xcdc7('0x6')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 32743ec..9702d31 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 _0x3116=['exports','define','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','ChatInteractionId','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./chatMessage.attributes'];(function(_0xec034,_0x16c358){var _0x2c5a19=function(_0xec401c){while(--_0xec401c){_0xec034['push'](_0xec034['shift']());}};_0x2c5a19(++_0x16c358);}(_0x3116,0x165));var _0x6311=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x3116[_0x1d9aa0];return _0x226868;};'use strict';var _=require('lodash');var util=require(_0x6311('0x0'));var logger=require(_0x6311('0x1'))('api');var moment=require(_0x6311('0x2'));var BPromise=require(_0x6311('0x3'));var rp=require(_0x6311('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6311('0x5'));var attributes=require(_0x6311('0x6'));module[_0x6311('0x7')]=function(_0x507964,_0xa3dbdf){return _0x507964[_0x6311('0x8')]('ChatMessage',attributes,{'tableName':_0x6311('0x9'),'paranoid':![],'indexes':[{'name':_0x6311('0xa'),'fields':[_0x6311('0xb')],'type':_0x6311('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xb43df3,_0x4fa064,_0x2614f1){var _0x149d4a=_0x507964[_0x6311('0xd')];var _0x2ad612=_0xb43df3['get']({'plain':!![]});if(_0x2ad612[_0x6311('0xe')][_0x6311('0xf')]()==='in'||_0x2ad612[_0x6311('0xe')][_0x6311('0xf')]()==='out'&&!_0x2ad612[_0x6311('0x10')]&&!_[_0x6311('0x11')](_0x2ad612[_0x6311('0x12')])){_0x149d4a[_0x6311('0x13')]['findOne']({'where':{'id':_0x2ad612[_0x6311('0x14')]}})['then'](function(_0x161bd5){if(_0x161bd5){_0x161bd5['update']({'lastMsgAt':_0x2ad612[_0x6311('0x15')],'lastMsgDirection':_0x2ad612[_0x6311('0xe')][_0x6311('0xf')]()});}})[_0x6311('0x16')](function(_0x428a05){console[_0x6311('0x17')](_0x428a05);});}_0x2614f1();}},'charset':_0x6311('0x18'),'collate':_0x6311('0x19')});}; \ No newline at end of file +var _0xfd4f=['secret','isNil','UserId','findOne','ChatInteractionId','then','update','createdAt','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','chat_messages','body','models','get','direction','toLowerCase','out'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0xfd4f,0x133));var _0xffd4=function(_0x44c0eb,_0x5998da){_0x44c0eb=_0x44c0eb-0x0;var _0x47350b=_0xfd4f[_0x44c0eb];return _0x47350b;};'use strict';var _=require(_0xffd4('0x0'));var util=require(_0xffd4('0x1'));var logger=require(_0xffd4('0x2'))('api');var moment=require('moment');var BPromise=require(_0xffd4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xffd4('0x4'));var rimraf=require(_0xffd4('0x5'));var config=require(_0xffd4('0x6'));var attributes=require(_0xffd4('0x7'));module['exports']=function(_0x4c35e1,_0x677b40){return _0x4c35e1[_0xffd4('0x8')](_0xffd4('0x9'),attributes,{'tableName':_0xffd4('0xa'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0xffd4('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4c4341,_0x5c0463,_0x22f5a7){var _0xdd8ae0=_0x4c35e1[_0xffd4('0xc')];var _0xe7d6d4=_0x4c4341[_0xffd4('0xd')]({'plain':!![]});if(_0xe7d6d4[_0xffd4('0xe')][_0xffd4('0xf')]()==='in'||_0xe7d6d4[_0xffd4('0xe')][_0xffd4('0xf')]()===_0xffd4('0x10')&&!_0xe7d6d4[_0xffd4('0x11')]&&!_[_0xffd4('0x12')](_0xe7d6d4[_0xffd4('0x13')])){_0xdd8ae0['ChatInteraction'][_0xffd4('0x14')]({'where':{'id':_0xe7d6d4[_0xffd4('0x15')]}})[_0xffd4('0x16')](function(_0x92b7cd){if(_0x92b7cd){_0x92b7cd[_0xffd4('0x17')]({'lastMsgAt':_0xe7d6d4[_0xffd4('0x18')],'lastMsgDirection':_0xe7d6d4[_0xffd4('0xe')][_0xffd4('0xf')]()});}})['catch'](function(_0x9863da){console[_0xffd4('0x19')](_0x9863da);});}_0x22f5a7();}},'charset':'utf8mb4','collate':_0xffd4('0x1a')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index a328558..d04ca87 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 _0x2071=['CreateChatMessage','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ChatMessage','create','body','options','raw'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x2071,0xb1));var _0x1207=function(_0x45ac0c,_0x2f8a58){_0x45ac0c=_0x45ac0c-0x0;var _0x4b4074=_0x2071[_0x45ac0c];return _0x4b4074;};'use strict';var _=require(_0x1207('0x0'));var util=require(_0x1207('0x1'));var moment=require(_0x1207('0x2'));var BPromise=require('bluebird');var rs=require(_0x1207('0x3'));var fs=require('fs');var Redis=require(_0x1207('0x4'));var db=require(_0x1207('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1207('0x6'))(_0x1207('0x7'));var config=require(_0x1207('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1207('0x9')][_0x1207('0xa')]({'port':0x232a});config[_0x1207('0xb')]=_['defaults'](config[_0x1207('0xb')],{'host':_0x1207('0xc'),'port':0x18eb});var socket=require(_0x1207('0xd'))(new Redis(config[_0x1207('0xb')]));require(_0x1207('0xe'))[_0x1207('0xf')](socket);function respondWithRpcPromise(_0x5ceb02,_0x31e4e6,_0x1c6b7d){return new BPromise(function(_0x77196f,_0x57465e){return client[_0x1207('0x10')](_0x5ceb02,_0x1c6b7d)[_0x1207('0x11')](function(_0x1923fc){logger[_0x1207('0x12')](_0x1207('0x13'),_0x31e4e6,_0x1207('0x14'));logger[_0x1207('0x15')](_0x1207('0x16'),_0x31e4e6,_0x1207('0x14'),JSON[_0x1207('0x17')](_0x1923fc));if(_0x1923fc[_0x1207('0x18')]){if(_0x1923fc[_0x1207('0x18')][_0x1207('0x19')]===0x1f4){logger[_0x1207('0x18')](_0x1207('0x13'),_0x31e4e6,_0x1923fc['error'][_0x1207('0x1a')]);return _0x57465e(_0x1923fc['error'][_0x1207('0x1a')]);}logger['error'](_0x1207('0x13'),_0x31e4e6,_0x1923fc['error'][_0x1207('0x1a')]);return _0x77196f(_0x1923fc['error'][_0x1207('0x1a')]);}else{logger[_0x1207('0x12')]('ChatMessage,\x20%s,\x20%s',_0x31e4e6,_0x1207('0x14'));_0x77196f(_0x1923fc[_0x1207('0x1b')][_0x1207('0x1a')]);}})['catch'](function(_0x307222){logger[_0x1207('0x18')]('ChatMessage,\x20%s,\x20%s',_0x31e4e6,_0x307222);_0x57465e(_0x307222);});});}exports['CreateChatMessage']=function(_0xf18695){var _0x3866fd=this;return new Promise(function(_0x30b32a,_0x4f5fcf){return db[_0x1207('0x1c')][_0x1207('0x1d')](_0xf18695[_0x1207('0x1e')],{'raw':_0xf18695[_0x1207('0x1f')]?_0xf18695[_0x1207('0x1f')][_0x1207('0x20')]===undefined?!![]:![]:!![]})[_0x1207('0x11')](function(_0x372c36){logger[_0x1207('0x12')](_0x1207('0x21'),_0xf18695);logger[_0x1207('0x15')]('CreateChatMessage',_0xf18695,JSON[_0x1207('0x17')](_0x372c36));_0x30b32a(_0x372c36);})[_0x1207('0x22')](function(_0x503f08){logger[_0x1207('0x18')](_0x1207('0x21'),_0x503f08['message'],_0xf18695);_0x4f5fcf(_0x3866fd[_0x1207('0x18')](0x1f4,_0x503f08[_0x1207('0x1a')]));});});}; \ No newline at end of file +var _0xd26a=['error','code','message','CreateChatMessage','ChatMessage','options','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x48381d,_0x4ee067){var _0x1431d3=function(_0x492d96){while(--_0x492d96){_0x48381d['push'](_0x48381d['shift']());}};_0x1431d3(++_0x4ee067);}(_0xd26a,0x17b));var _0xad26=function(_0x21f475,_0x3597aa){_0x21f475=_0x21f475-0x0;var _0x543e1a=_0xd26a[_0x21f475];return _0x543e1a;};'use strict';var _=require(_0xad26('0x0'));var util=require(_0xad26('0x1'));var moment=require(_0xad26('0x2'));var BPromise=require('bluebird');var rs=require(_0xad26('0x3'));var fs=require('fs');var Redis=require(_0xad26('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xad26('0x5'));var logger=require(_0xad26('0x6'))('rpc');var config=require(_0xad26('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xad26('0x8')][_0xad26('0x9')]({'port':0x232a});config[_0xad26('0xa')]=_[_0xad26('0xb')](config[_0xad26('0xa')],{'host':_0xad26('0xc'),'port':0x18eb});var socket=require(_0xad26('0xd'))(new Redis(config[_0xad26('0xa')]));require(_0xad26('0xe'))[_0xad26('0xf')](socket);function respondWithRpcPromise(_0x2d2b6a,_0x35deeb,_0x387f73){return new BPromise(function(_0x5b18f9,_0x541b7e){return client[_0xad26('0x10')](_0x2d2b6a,_0x387f73)[_0xad26('0x11')](function(_0x4cc39d){logger[_0xad26('0x12')](_0xad26('0x13'),_0x35deeb,_0xad26('0x14'));logger[_0xad26('0x15')](_0xad26('0x16'),_0x35deeb,_0xad26('0x14'),JSON[_0xad26('0x17')](_0x4cc39d));if(_0x4cc39d[_0xad26('0x18')]){if(_0x4cc39d[_0xad26('0x18')][_0xad26('0x19')]===0x1f4){logger[_0xad26('0x18')](_0xad26('0x13'),_0x35deeb,_0x4cc39d[_0xad26('0x18')][_0xad26('0x1a')]);return _0x541b7e(_0x4cc39d['error']['message']);}logger['error'](_0xad26('0x13'),_0x35deeb,_0x4cc39d[_0xad26('0x18')][_0xad26('0x1a')]);return _0x5b18f9(_0x4cc39d[_0xad26('0x18')][_0xad26('0x1a')]);}else{logger['info'](_0xad26('0x13'),_0x35deeb,_0xad26('0x14'));_0x5b18f9(_0x4cc39d['result'][_0xad26('0x1a')]);}})['catch'](function(_0x1e3796){logger[_0xad26('0x18')]('ChatMessage,\x20%s,\x20%s',_0x35deeb,_0x1e3796);_0x541b7e(_0x1e3796);});});}exports[_0xad26('0x1b')]=function(_0x987a66){var _0x22a4ea=this;return new Promise(function(_0x25cbbc,_0x1e4e76){return db[_0xad26('0x1c')]['create'](_0x987a66['body'],{'raw':_0x987a66[_0xad26('0x1d')]?_0x987a66[_0xad26('0x1d')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x550191){logger[_0xad26('0x12')](_0xad26('0x1b'),_0x987a66);logger[_0xad26('0x15')](_0xad26('0x1b'),_0x987a66,JSON[_0xad26('0x17')](_0x550191));_0x25cbbc(_0x550191);})[_0xad26('0x1e')](function(_0x5461e4){logger['error'](_0xad26('0x1b'),_0x5461e4[_0xad26('0x1a')],_0x987a66);_0x1e4e76(_0x22a4ea[_0xad26('0x18')](0x1f4,_0x5461e4['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 4873d2a..83523bb 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 _0x26d1=['update','removeListener','register','chatMessage:','./chatMessage.events','remove'];(function(_0x2cdd2f,_0xbd47c1){var _0x42c66b=function(_0x722080){while(--_0x722080){_0x2cdd2f['push'](_0x2cdd2f['shift']());}};_0x42c66b(++_0xbd47c1);}(_0x26d1,0x8e));var _0x126d=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x26d1[_0x3e5086];return _0xfeb102;};'use strict';var ChatMessageEvents=require(_0x126d('0x0'));var events=['save',_0x126d('0x1'),_0x126d('0x2')];function createListener(_0x37ff4c,_0x2a20fc){return function(_0x59d0a0){_0x2a20fc['emit'](_0x37ff4c,_0x59d0a0);};}function removeListener(_0x3a3fb4,_0x48016e){return function(){ChatMessageEvents[_0x126d('0x3')](_0x3a3fb4,_0x48016e);};}exports[_0x126d('0x4')]=function(_0x442e04){for(var _0x449ed0=0x0,_0x2b4dfc=events['length'];_0x449ed0<_0x2b4dfc;_0x449ed0++){var _0x2e668c=events[_0x449ed0];var _0x25ccc2=createListener(_0x126d('0x5')+_0x2e668c,_0x442e04);ChatMessageEvents['on'](_0x2e668c,_0x25ccc2);}}; \ No newline at end of file +var _0x0e17=['remove','update','emit','removeListener','register','length','chatMessage:','./chatMessage.events','save'];(function(_0xfdddcf,_0x2dbc28){var _0x140ca1=function(_0x3e23a8){while(--_0x3e23a8){_0xfdddcf['push'](_0xfdddcf['shift']());}};_0x140ca1(++_0x2dbc28);}(_0x0e17,0xd6));var _0x70e1=function(_0x34f8cd,_0x105631){_0x34f8cd=_0x34f8cd-0x0;var _0x254197=_0x0e17[_0x34f8cd];return _0x254197;};'use strict';var ChatMessageEvents=require(_0x70e1('0x0'));var events=[_0x70e1('0x1'),_0x70e1('0x2'),_0x70e1('0x3')];function createListener(_0x35862c,_0x45b94b){return function(_0x9289d7){_0x45b94b[_0x70e1('0x4')](_0x35862c,_0x9289d7);};}function removeListener(_0x406801,_0x2c62b8){return function(){ChatMessageEvents[_0x70e1('0x5')](_0x406801,_0x2c62b8);};}exports[_0x70e1('0x6')]=function(_0x4cb0b1){for(var _0xc64213=0x0,_0x16a2ad=events[_0x70e1('0x7')];_0xc64213<_0x16a2ad;_0xc64213++){var _0x27f310=events[_0xc64213];var _0x26218a=createListener(_0x70e1('0x8')+_0x27f310,_0x4cb0b1);ChatMessageEvents['on'](_0x27f310,_0x26218a);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 990413d..fd0efe4 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 _0x1f7c=['show','post','chat','chatmessage:create','create','put','accept','/:id/reject','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id'];(function(_0x48adc5,_0x248aa0){var _0x4e758d=function(_0x4f7075){while(--_0x4f7075){_0x48adc5['push'](_0x48adc5['shift']());}};_0x4e758d(++_0x248aa0);}(_0x1f7c,0x94));var _0xc1f7=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0x1f7c[_0x4eafed];return _0x159c85;};'use strict';var multer=require(_0xc1f7('0x0'));var util=require(_0xc1f7('0x1'));var path=require(_0xc1f7('0x2'));var timeout=require(_0xc1f7('0x3'));var express=require('express');var router=express[_0xc1f7('0x4')]();var fs_extra=require(_0xc1f7('0x5'));var auth=require(_0xc1f7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc1f7('0x7'));var controller=require('./chatMessage.controller');router[_0xc1f7('0x8')]('/',auth[_0xc1f7('0x9')](),controller[_0xc1f7('0xa')]);router[_0xc1f7('0x8')](_0xc1f7('0xb'),auth[_0xc1f7('0x9')](),controller['describe']);router[_0xc1f7('0x8')](_0xc1f7('0xc'),auth[_0xc1f7('0x9')](),controller[_0xc1f7('0xd')]);router[_0xc1f7('0xe')]('/',auth['isAuthenticated'](),interaction['tracked'](_0xc1f7('0xf'),_0xc1f7('0x10')),controller[_0xc1f7('0x11')]);router[_0xc1f7('0x12')](_0xc1f7('0xc'),controller['update']);router[_0xc1f7('0x12')]('/:id/accept',auth[_0xc1f7('0x9')](),controller[_0xc1f7('0x13')]);router[_0xc1f7('0x12')](_0xc1f7('0x14'),auth[_0xc1f7('0x9')](),controller['reject']);router[_0xc1f7('0x15')](_0xc1f7('0xc'),auth[_0xc1f7('0x9')](),controller[_0xc1f7('0x16')]);module['exports']=router; \ No newline at end of file +var _0xa85a=['destroy','exports','multer','path','fs-extra','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete'];(function(_0x5cf058,_0x1a53f2){var _0x2dd6a0=function(_0x19a60d){while(--_0x19a60d){_0x5cf058['push'](_0x5cf058['shift']());}};_0x2dd6a0(++_0x1a53f2);}(_0xa85a,0x106));var _0xaa85=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xa85a[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require(_0xaa85('0x0'));var util=require('util');var path=require(_0xaa85('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xaa85('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xaa85('0x3'));var config=require('../../config/environment');var controller=require(_0xaa85('0x4'));router[_0xaa85('0x5')]('/',auth[_0xaa85('0x6')](),controller[_0xaa85('0x7')]);router[_0xaa85('0x5')](_0xaa85('0x8'),auth['isAuthenticated'](),controller[_0xaa85('0x9')]);router[_0xaa85('0x5')](_0xaa85('0xa'),auth['isAuthenticated'](),controller[_0xaa85('0xb')]);router[_0xaa85('0xc')]('/',auth['isAuthenticated'](),interaction[_0xaa85('0xd')](_0xaa85('0xe'),_0xaa85('0xf')),controller[_0xaa85('0x10')]);router[_0xaa85('0x11')](_0xaa85('0xa'),controller[_0xaa85('0x12')]);router['put'](_0xaa85('0x13'),auth[_0xaa85('0x6')](),controller[_0xaa85('0x14')]);router[_0xaa85('0x11')](_0xaa85('0x15'),auth[_0xaa85('0x6')](),controller[_0xaa85('0x16')]);router[_0xaa85('0x17')](_0xaa85('0xa'),auth[_0xaa85('0x6')](),controller[_0xaa85('0x18')]);module[_0xaa85('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 95f3829..ce3d0be 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 _0x5f66=['medium','TEXT','exports'];(function(_0x2dbb34,_0x242ce4){var _0x27af07=function(_0x4f2d42){while(--_0x4f2d42){_0x2dbb34['push'](_0x2dbb34['shift']());}};_0x27af07(++_0x242ce4);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0xb10b=['medium','sequelize','TEXT'];(function(_0x35ea98,_0x190031){var _0x397916=function(_0x1857a8){while(--_0x1857a8){_0x35ea98['push'](_0x35ea98['shift']());}};_0x397916(++_0x190031);}(_0xb10b,0x12a));var _0xbb10=function(_0x27fedb,_0x31c693){_0x27fedb=_0x27fedb-0x0;var _0x58ab78=_0xb10b[_0x27fedb];return _0x58ab78;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbb10('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index ce76243..c5bb9c3 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(_0x5020e5,_0x2a7658){var _0x531ea0=function(_0x43890d){while(--_0x43890d){_0x5020e5['push'](_0x5020e5['shift']());}};_0x531ea0(++_0x2a7658);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +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(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x7a54,0x106));var _0x47a5=function(_0x23c580,_0x1bc18f){_0x23c580=_0x23c580-0x0;var _0x41ea88=_0x7a54[_0x23c580];return _0x41ea88;};'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 2db56fa..cb7d7ae 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 _0x7484=['save','remove','emit','hasOwnProperty','../../mysqldb','ChatOfflineMessage','setMaxListeners'];(function(_0x4e4af2,_0x2ba40f){var _0x138886=function(_0x1b7c9c){while(--_0x1b7c9c){_0x4e4af2['push'](_0x4e4af2['shift']());}};_0x138886(++_0x2ba40f);}(_0x7484,0x90));var _0x4748=function(_0x30fc71,_0x4ecc37){_0x30fc71=_0x30fc71-0x0;var _0x343efa=_0x7484[_0x30fc71];return _0x343efa;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x4748('0x0'))['db'][_0x4748('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x4748('0x2')](0x0);var events={'afterCreate':_0x4748('0x3'),'afterUpdate':'update','afterDestroy':_0x4748('0x4')};function emitEvent(_0x20966b){return function(_0x2014d9,_0x2da04d,_0x2aecae){ChatOfflineMessageEvents[_0x4748('0x5')](_0x20966b+':'+_0x2014d9['id'],_0x2014d9);ChatOfflineMessageEvents['emit'](_0x20966b,_0x2014d9);_0x2aecae(null);};}for(var e in events){if(events[_0x4748('0x6')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0xca4a=['update','remove','emit','hasOwnProperty','hook','exports','events','ChatOfflineMessage','setMaxListeners','save'];(function(_0x55f0e4,_0x1cc25d){var _0x294646=function(_0x1560ce){while(--_0x1560ce){_0x55f0e4['push'](_0x55f0e4['shift']());}};_0x294646(++_0x1cc25d);}(_0xca4a,0xa6));var _0xaca4=function(_0x1feaff,_0x2be57f){_0x1feaff=_0x1feaff-0x0;var _0x4f4187=_0xca4a[_0x1feaff];return _0x4f4187;};'use strict';var EventEmitter=require(_0xaca4('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0xaca4('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xaca4('0x2')](0x0);var events={'afterCreate':_0xaca4('0x3'),'afterUpdate':_0xaca4('0x4'),'afterDestroy':_0xaca4('0x5')};function emitEvent(_0x65db10){return function(_0x2b9ccf,_0x2b2690,_0x5deac2){ChatOfflineMessageEvents['emit'](_0x65db10+':'+_0x2b9ccf['id'],_0x2b9ccf);ChatOfflineMessageEvents[_0xaca4('0x6')](_0x65db10,_0x2b9ccf);_0x5deac2(null);};}for(var e in events){if(events[_0xaca4('0x7')](e)){var event=events[e];ChatOfflineMessage[_0xaca4('0x8')](e,emitEvent(event));}}module[_0xaca4('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 1f78278..66467f0 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 _0xd954=['ChatOfflineMessage','chat_offline_messages','utf8mb4','./chatOfflineMessage.attributes','exports','define'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xd954,0x1e3));var _0x4d95=function(_0x482913,_0x38462a){_0x482913=_0x482913-0x0;var _0x49f170=_0xd954[_0x482913];return _0x49f170;};'use strict';var attributes=require(_0x4d95('0x0'));module[_0x4d95('0x1')]=function(_0x1efc99){return _0x1efc99[_0x4d95('0x2')](_0x4d95('0x3'),attributes,{'tableName':_0x4d95('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4d95('0x5'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xca2d=['utf8mb4','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xca2d,0x65));var _0xdca2=function(_0x1aa049,_0x9ae13c){_0x1aa049=_0x1aa049-0x0;var _0x357f29=_0xca2d[_0x1aa049];return _0x357f29;};'use strict';var attributes=require(_0xdca2('0x0'));module[_0xdca2('0x1')]=function(_0x210c76){return _0x210c76[_0xdca2('0x2')](_0xdca2('0x3'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdca2('0x4'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 31e77b4..bb39e8b 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 _0xcd1b=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','request','then','request\x20sent','debug','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x1a2552,_0xc7af2b){var _0x3304d7=function(_0x56a48b){while(--_0x56a48b){_0x1a2552['push'](_0x1a2552['shift']());}};_0x3304d7(++_0xc7af2b);}(_0xcd1b,0x18e));var _0xbcd1=function(_0x374563,_0x37ac1f){_0x374563=_0x374563-0x0;var _0x7b151b=_0xcd1b[_0x374563];return _0x7b151b;};'use strict';var _=require(_0xbcd1('0x0'));var util=require(_0xbcd1('0x1'));var moment=require('moment');var BPromise=require(_0xbcd1('0x2'));var rs=require(_0xbcd1('0x3'));var fs=require('fs');var Redis=require(_0xbcd1('0x4'));var db=require(_0xbcd1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbcd1('0x6'))(_0xbcd1('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbcd1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x187ec1,_0x46d5f8,_0x26f7e5){return new BPromise(function(_0x19d0da,_0x76c75c){return client[_0xbcd1('0x9')](_0x187ec1,_0x26f7e5)[_0xbcd1('0xa')](function(_0x579920){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x46d5f8,_0xbcd1('0xb'));logger[_0xbcd1('0xc')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x46d5f8,_0xbcd1('0xb'),JSON[_0xbcd1('0xd')](_0x579920));if(_0x579920[_0xbcd1('0xe')]){if(_0x579920[_0xbcd1('0xe')][_0xbcd1('0xf')]===0x1f4){logger['error'](_0xbcd1('0x10'),_0x46d5f8,_0x579920[_0xbcd1('0xe')][_0xbcd1('0x11')]);return _0x76c75c(_0x579920[_0xbcd1('0xe')]['message']);}logger[_0xbcd1('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x46d5f8,_0x579920[_0xbcd1('0xe')][_0xbcd1('0x11')]);return _0x19d0da(_0x579920[_0xbcd1('0xe')]['message']);}else{logger[_0xbcd1('0x12')](_0xbcd1('0x10'),_0x46d5f8,'request\x20sent');_0x19d0da(_0x579920[_0xbcd1('0x13')][_0xbcd1('0x11')]);}})[_0xbcd1('0x14')](function(_0x5411c2){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x46d5f8,_0x5411c2);_0x76c75c(_0x5411c2);});});} \ No newline at end of file +var _0xea31=['stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s'];(function(_0x29fcf7,_0x1c511d){var _0x2d2510=function(_0xa45e3c){while(--_0xa45e3c){_0x29fcf7['push'](_0x29fcf7['shift']());}};_0x2d2510(++_0x1c511d);}(_0xea31,0x6b));var _0x1ea3=function(_0x3eb931,_0x759a03){_0x3eb931=_0x3eb931-0x0;var _0x5770d0=_0xea31[_0x3eb931];return _0x5770d0;};'use strict';var _=require(_0x1ea3('0x0'));var util=require('util');var moment=require(_0x1ea3('0x1'));var BPromise=require(_0x1ea3('0x2'));var rs=require(_0x1ea3('0x3'));var fs=require('fs');var Redis=require(_0x1ea3('0x4'));var db=require(_0x1ea3('0x5'))['db'];var utils=require(_0x1ea3('0x6'));var logger=require(_0x1ea3('0x7'))('rpc');var config=require(_0x1ea3('0x8'));var jayson=require(_0x1ea3('0x9'));var client=jayson[_0x1ea3('0xa')][_0x1ea3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13e6fb,_0x4c8f83,_0x1fa3a8){return new BPromise(function(_0x1b578e,_0x30a6db){return client[_0x1ea3('0xc')](_0x13e6fb,_0x1fa3a8)[_0x1ea3('0xd')](function(_0x2ff19a){logger['info'](_0x1ea3('0xe'),_0x4c8f83,_0x1ea3('0xf'));logger[_0x1ea3('0x10')](_0x1ea3('0x11'),_0x4c8f83,_0x1ea3('0xf'),JSON[_0x1ea3('0x12')](_0x2ff19a));if(_0x2ff19a[_0x1ea3('0x13')]){if(_0x2ff19a['error'][_0x1ea3('0x14')]===0x1f4){logger['error'](_0x1ea3('0xe'),_0x4c8f83,_0x2ff19a[_0x1ea3('0x13')][_0x1ea3('0x15')]);return _0x30a6db(_0x2ff19a['error'][_0x1ea3('0x15')]);}logger[_0x1ea3('0x13')](_0x1ea3('0xe'),_0x4c8f83,_0x2ff19a['error'][_0x1ea3('0x15')]);return _0x1b578e(_0x2ff19a[_0x1ea3('0x13')][_0x1ea3('0x15')]);}else{logger[_0x1ea3('0x16')](_0x1ea3('0xe'),_0x4c8f83,_0x1ea3('0xf'));_0x1b578e(_0x2ff19a[_0x1ea3('0x17')]['message']);}})[_0x1ea3('0x18')](function(_0x199728){logger[_0x1ea3('0x13')](_0x1ea3('0xe'),_0x4c8f83,_0x199728);_0x30a6db(_0x199728);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 525dc5f..4728182 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 _0xc634=['isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get'];(function(_0xecdc9,_0x1bd008){var _0x2a91c1=function(_0x3036dd){while(--_0x3036dd){_0xecdc9['push'](_0xecdc9['shift']());}};_0x2a91c1(++_0x1bd008);}(_0xc634,0x171));var _0x4c63=function(_0x14022a,_0x4ca101){_0x14022a=_0x14022a-0x0;var _0x12b439=_0xc634[_0x14022a];return _0x12b439;};'use strict';var multer=require(_0x4c63('0x0'));var util=require(_0x4c63('0x1'));var path=require(_0x4c63('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x4c63('0x3'));var auth=require(_0x4c63('0x4'));var interaction=require(_0x4c63('0x5'));var config=require(_0x4c63('0x6'));var controller=require(_0x4c63('0x7'));router[_0x4c63('0x8')]('/',auth[_0x4c63('0x9')](),controller[_0x4c63('0xa')]);router[_0x4c63('0x8')](_0x4c63('0xb'),auth[_0x4c63('0x9')](),controller[_0x4c63('0xc')]);router[_0x4c63('0x8')](_0x4c63('0xd'),auth[_0x4c63('0x9')](),controller[_0x4c63('0xe')]);router[_0x4c63('0xf')]('/',auth[_0x4c63('0x9')](),controller[_0x4c63('0x10')]);router[_0x4c63('0x11')](_0x4c63('0xd'),auth[_0x4c63('0x9')](),controller[_0x4c63('0x12')]);router[_0x4c63('0x13')](_0x4c63('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x4c63('0x14')]=router; \ No newline at end of file +var _0x7781=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x2ebd8a,_0x124a3d){var _0x2a7bdf=function(_0x2c96ac){while(--_0x2c96ac){_0x2ebd8a['push'](_0x2ebd8a['shift']());}};_0x2a7bdf(++_0x124a3d);}(_0x7781,0x10f));var _0x1778=function(_0x42ecef,_0x1712cc){_0x42ecef=_0x42ecef-0x0;var _0x5cd8e2=_0x7781[_0x42ecef];return _0x5cd8e2;};'use strict';var multer=require('multer');var util=require(_0x1778('0x0'));var path=require(_0x1778('0x1'));var timeout=require(_0x1778('0x2'));var express=require(_0x1778('0x3'));var router=express[_0x1778('0x4')]();var fs_extra=require(_0x1778('0x5'));var auth=require(_0x1778('0x6'));var interaction=require(_0x1778('0x7'));var config=require(_0x1778('0x8'));var controller=require(_0x1778('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x1778('0xa')](_0x1778('0xb'),auth[_0x1778('0xc')](),controller[_0x1778('0xd')]);router[_0x1778('0xa')](_0x1778('0xe'),auth[_0x1778('0xc')](),controller[_0x1778('0xf')]);router[_0x1778('0x10')]('/',auth[_0x1778('0xc')](),controller[_0x1778('0x11')]);router[_0x1778('0x12')](_0x1778('0xe'),auth[_0x1778('0xc')](),controller[_0x1778('0x13')]);router[_0x1778('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x1778('0x15')]);module[_0x1778('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index c4a5461..f7e01a9 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 _0x5848=['exports','STRING','ENUM','mouseOver','timeout','INTEGER','sequelize'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x5848,0x1cd));var _0x8584=function(_0x59010d,_0x2ef76a){_0x59010d=_0x59010d-0x0;var _0x5b9bf8=_0x5848[_0x59010d];return _0x5b9bf8;};'use strict';var Sequelize=require(_0x8584('0x0'));module[_0x8584('0x1')]={'name':{'type':Sequelize[_0x8584('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8584('0x3')](_0x8584('0x4'),_0x8584('0x5')),'defaultValue':_0x8584('0x4')},'selector':{'type':Sequelize[_0x8584('0x2')]},'timeout':{'type':Sequelize[_0x8584('0x6')]}}; \ No newline at end of file +var _0x0f0f=['sequelize','exports','ENUM','mouseOver','timeout'];(function(_0x5ab4d6,_0x33a6db){var _0x4e2695=function(_0xaabb7){while(--_0xaabb7){_0x5ab4d6['push'](_0x5ab4d6['shift']());}};_0x4e2695(++_0x33a6db);}(_0x0f0f,0x73));var _0xf0f0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0f0f[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xf0f0('0x0'));module[_0xf0f0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf0f0('0x2')](_0xf0f0('0x3'),_0xf0f0('0x4')),'defaultValue':_0xf0f0('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 74f9fce..f9e36d5 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 _0x8bc3=['model','rawAttributes','query','filters','intersection','fields','length','attributes','includeAll','include','merge','ChatProactiveAction','find','catch','create','update','body','destroy','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','end','status','json','offset','undefined','count','Content-Range','apply','reject','then','sendStatus','error','stack','name','params'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x8bc3,0x82));var _0x38bc=function(_0x5aef75,_0x39228e){_0x5aef75=_0x5aef75-0x0;var _0x1bb942=_0x8bc3[_0x5aef75];return _0x1bb942;};'use strict';var emlformat=require(_0x38bc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x38bc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x38bc('0x2'));var moment=require(_0x38bc('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x38bc('0x4'));var util=require(_0x38bc('0x5'));var path=require(_0x38bc('0x6'));var sox=require(_0x38bc('0x7'));var csv=require('to-csv');var ejs=require(_0x38bc('0x8'));var fs=require('fs');var fs_extra=require(_0x38bc('0x9'));var _=require(_0x38bc('0xa'));var squel=require(_0x38bc('0xb'));var crypto=require(_0x38bc('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x38bc('0xd'));var querystring=require(_0x38bc('0xe'));var Papa=require(_0x38bc('0xf'));var Redis=require(_0x38bc('0x10'));var authService=require(_0x38bc('0x11'));var qs=require(_0x38bc('0x12'));var as=require(_0x38bc('0x13'));var hardwareService=require(_0x38bc('0x14'));var logger=require(_0x38bc('0x15'))(_0x38bc('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5f4b,_0x56fdcf){_0x56fdcf=_0x56fdcf||0xcc;return function(_0x486c59){if(_0x486c59){return _0x1a5f4b['sendStatus'](_0x56fdcf);}return _0x1a5f4b['status'](_0x56fdcf)[_0x38bc('0x17')]();};}function respondWithResult(_0x1a7903,_0x454eac){_0x454eac=_0x454eac||0xc8;return function(_0x5d4997){if(_0x5d4997){return _0x1a7903[_0x38bc('0x18')](_0x454eac)[_0x38bc('0x19')](_0x5d4997);}};}function respondWithFilteredResult(_0x1ff95d,_0x322c4e){return function(_0x2c223e){if(_0x2c223e){var _0x1c0cd2=typeof _0x322c4e[_0x38bc('0x1a')]===_0x38bc('0x1b')&&typeof _0x322c4e['limit']===_0x38bc('0x1b');var _0x55940b=_0x2c223e[_0x38bc('0x1c')];var _0x1f0e08=_0x1c0cd2?0x0:_0x322c4e[_0x38bc('0x1a')];var _0x30b309=_0x1c0cd2?_0x2c223e[_0x38bc('0x1c')]:_0x322c4e[_0x38bc('0x1a')]+_0x322c4e['limit'];var _0x36ccda;if(_0x30b309>=_0x55940b){_0x30b309=_0x55940b;_0x36ccda=0xc8;}else{_0x36ccda=0xce;}_0x1ff95d['status'](_0x36ccda);return _0x1ff95d['set'](_0x38bc('0x1d'),_0x1f0e08+'-'+_0x30b309+'/'+_0x55940b)[_0x38bc('0x19')](_0x2c223e);}return null;};}function patchUpdates(_0x325b14){return function(_0x19f3af){try{jsonpatch[_0x38bc('0x1e')](_0x19f3af,_0x325b14,!![]);}catch(_0x40e3b6){return BPromise[_0x38bc('0x1f')](_0x40e3b6);}return _0x19f3af['save']();};}function saveUpdates(_0x4a43c7,_0x2999b0){return function(_0x46b863){if(_0x46b863){return _0x46b863['update'](_0x4a43c7)[_0x38bc('0x20')](function(_0x5f4026){return _0x5f4026;});}return null;};}function removeEntity(_0x897a6b,_0x4251ee){return function(_0x434007){if(_0x434007){return _0x434007['destroy']()[_0x38bc('0x20')](function(){_0x897a6b[_0x38bc('0x18')](0xcc)[_0x38bc('0x17')]();});}};}function handleEntityNotFound(_0x49c92d,_0x349731){return function(_0x3daed5){if(!_0x3daed5){_0x49c92d[_0x38bc('0x21')](0x194);}return _0x3daed5;};}function handleError(_0x3a5b7f,_0x53cb1a){_0x53cb1a=_0x53cb1a||0x1f4;return function(_0x487679){logger[_0x38bc('0x22')](_0x487679[_0x38bc('0x23')]);if(_0x487679[_0x38bc('0x24')]){delete _0x487679[_0x38bc('0x24')];}_0x3a5b7f['status'](_0x53cb1a)['send'](_0x487679);};}exports['show']=function(_0x456a78,_0x43ab9f){var _0x404759={'raw':!![],'where':{'id':_0x456a78[_0x38bc('0x25')]['id']}},_0x539b3b={};_0x539b3b[_0x38bc('0x26')]=_['keys'](db['ChatProactiveAction'][_0x38bc('0x27')]);_0x539b3b['query']=_['keys'](_0x456a78[_0x38bc('0x28')]);_0x539b3b[_0x38bc('0x29')]=_[_0x38bc('0x2a')](_0x539b3b[_0x38bc('0x26')],_0x539b3b[_0x38bc('0x28')]);_0x404759['attributes']=_[_0x38bc('0x2a')](_0x539b3b[_0x38bc('0x26')],qs[_0x38bc('0x2b')](_0x456a78[_0x38bc('0x28')][_0x38bc('0x2b')]));_0x404759['attributes']=_0x404759['attributes'][_0x38bc('0x2c')]?_0x404759[_0x38bc('0x2d')]:_0x539b3b[_0x38bc('0x26')];if(_0x456a78[_0x38bc('0x28')][_0x38bc('0x2e')]){_0x404759[_0x38bc('0x2f')]=[{'all':!![]}];}_0x404759=_[_0x38bc('0x30')]({},_0x404759,_0x456a78['options']);return db[_0x38bc('0x31')][_0x38bc('0x32')](_0x404759)['then'](handleEntityNotFound(_0x43ab9f,null))[_0x38bc('0x20')](respondWithResult(_0x43ab9f,null))[_0x38bc('0x33')](handleError(_0x43ab9f,null));};exports[_0x38bc('0x34')]=function(_0x17031c,_0x477411){return db['ChatProactiveAction'][_0x38bc('0x34')](_0x17031c['body'],{})[_0x38bc('0x20')](respondWithResult(_0x477411,0xc9))[_0x38bc('0x33')](handleError(_0x477411,null));};exports[_0x38bc('0x35')]=function(_0x14d8cf,_0x109af1){if(_0x14d8cf[_0x38bc('0x36')]['id']){delete _0x14d8cf[_0x38bc('0x36')]['id'];}return db[_0x38bc('0x31')]['find']({'where':{'id':_0x14d8cf[_0x38bc('0x25')]['id']}})[_0x38bc('0x20')](handleEntityNotFound(_0x109af1,null))[_0x38bc('0x20')](saveUpdates(_0x14d8cf['body'],null))['then'](respondWithResult(_0x109af1,null))[_0x38bc('0x33')](handleError(_0x109af1,null));};exports[_0x38bc('0x37')]=function(_0xdba6c5,_0x43cfbf){return db[_0x38bc('0x31')][_0x38bc('0x32')]({'where':{'id':_0xdba6c5[_0x38bc('0x25')]['id']}})[_0x38bc('0x20')](handleEntityNotFound(_0x43cfbf,null))['then'](removeEntity(_0x43cfbf,null))[_0x38bc('0x33')](handleError(_0x43cfbf,null));}; \ No newline at end of file +var _0xbdb9=['destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','show','model','keys','ChatProactiveAction','rawAttributes','query','intersection','attributes','fields','length','include','options','find','catch','create','body','params'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xbdb9,0xac));var _0x9bdb=function(_0x38f296,_0x426399){_0x38f296=_0x38f296-0x0;var _0xb3c4d1=_0xbdb9[_0x38f296];return _0xb3c4d1;};'use strict';var emlformat=require(_0x9bdb('0x0'));var rimraf=require(_0x9bdb('0x1'));var zipdir=require(_0x9bdb('0x2'));var jsonpatch=require(_0x9bdb('0x3'));var rp=require(_0x9bdb('0x4'));var moment=require('moment');var BPromise=require(_0x9bdb('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9bdb('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9bdb('0x7'));var _=require('lodash');var squel=require(_0x9bdb('0x8'));var crypto=require(_0x9bdb('0x9'));var jsforce=require(_0x9bdb('0xa'));var deskjs=require(_0x9bdb('0xb'));var toCsv=require(_0x9bdb('0x6'));var querystring=require(_0x9bdb('0xc'));var Papa=require(_0x9bdb('0xd'));var Redis=require('ioredis');var authService=require(_0x9bdb('0xe'));var qs=require(_0x9bdb('0xf'));var as=require(_0x9bdb('0x10'));var hardwareService=require(_0x9bdb('0x11'));var logger=require(_0x9bdb('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x9bdb('0x13'));var licenseUtil=require(_0x9bdb('0x14'));var db=require(_0x9bdb('0x15'))['db'];function respondWithStatusCode(_0x2bd93f,_0x223475){_0x223475=_0x223475||0xcc;return function(_0x14fb0c){if(_0x14fb0c){return _0x2bd93f['sendStatus'](_0x223475);}return _0x2bd93f[_0x9bdb('0x16')](_0x223475)[_0x9bdb('0x17')]();};}function respondWithResult(_0x470c67,_0x2bde6b){_0x2bde6b=_0x2bde6b||0xc8;return function(_0x17b647){if(_0x17b647){return _0x470c67['status'](_0x2bde6b)[_0x9bdb('0x18')](_0x17b647);}};}function respondWithFilteredResult(_0x2a3150,_0x1b4286){return function(_0x4d1aa7){if(_0x4d1aa7){var _0x3d759e=typeof _0x1b4286[_0x9bdb('0x19')]===_0x9bdb('0x1a')&&typeof _0x1b4286[_0x9bdb('0x1b')]===_0x9bdb('0x1a');var _0x13c07b=_0x4d1aa7[_0x9bdb('0x1c')];var _0x112d0f=_0x3d759e?0x0:_0x1b4286[_0x9bdb('0x19')];var _0x38b812=_0x3d759e?_0x4d1aa7['count']:_0x1b4286[_0x9bdb('0x19')]+_0x1b4286[_0x9bdb('0x1b')];var _0x5204ba;if(_0x38b812>=_0x13c07b){_0x38b812=_0x13c07b;_0x5204ba=0xc8;}else{_0x5204ba=0xce;}_0x2a3150[_0x9bdb('0x16')](_0x5204ba);return _0x2a3150[_0x9bdb('0x1d')](_0x9bdb('0x1e'),_0x112d0f+'-'+_0x38b812+'/'+_0x13c07b)['json'](_0x4d1aa7);}return null;};}function patchUpdates(_0xdaab91){return function(_0x991191){try{jsonpatch[_0x9bdb('0x1f')](_0x991191,_0xdaab91,!![]);}catch(_0x4da7a5){return BPromise[_0x9bdb('0x20')](_0x4da7a5);}return _0x991191[_0x9bdb('0x21')]();};}function saveUpdates(_0xa2084c,_0x2150da){return function(_0x41a213){if(_0x41a213){return _0x41a213[_0x9bdb('0x22')](_0xa2084c)['then'](function(_0x5b5262){return _0x5b5262;});}return null;};}function removeEntity(_0x2c4a44,_0xc1dff7){return function(_0x1bba44){if(_0x1bba44){return _0x1bba44['destroy']()[_0x9bdb('0x23')](function(){_0x2c4a44[_0x9bdb('0x16')](0xcc)[_0x9bdb('0x17')]();});}};}function handleEntityNotFound(_0x1725aa,_0x561f9f){return function(_0x37a02a){if(!_0x37a02a){_0x1725aa['sendStatus'](0x194);}return _0x37a02a;};}function handleError(_0x18aabd,_0x3c2ad6){_0x3c2ad6=_0x3c2ad6||0x1f4;return function(_0x369bb3){logger['error'](_0x369bb3[_0x9bdb('0x24')]);if(_0x369bb3[_0x9bdb('0x25')]){delete _0x369bb3[_0x9bdb('0x25')];}_0x18aabd[_0x9bdb('0x16')](_0x3c2ad6)[_0x9bdb('0x26')](_0x369bb3);};}exports[_0x9bdb('0x27')]=function(_0x426390,_0x820d2e){var _0x250cfb={'raw':!![],'where':{'id':_0x426390['params']['id']}},_0x3f01d2={};_0x3f01d2[_0x9bdb('0x28')]=_[_0x9bdb('0x29')](db[_0x9bdb('0x2a')][_0x9bdb('0x2b')]);_0x3f01d2[_0x9bdb('0x2c')]=_[_0x9bdb('0x29')](_0x426390[_0x9bdb('0x2c')]);_0x3f01d2['filters']=_[_0x9bdb('0x2d')](_0x3f01d2['model'],_0x3f01d2[_0x9bdb('0x2c')]);_0x250cfb[_0x9bdb('0x2e')]=_[_0x9bdb('0x2d')](_0x3f01d2[_0x9bdb('0x28')],qs[_0x9bdb('0x2f')](_0x426390[_0x9bdb('0x2c')][_0x9bdb('0x2f')]));_0x250cfb['attributes']=_0x250cfb[_0x9bdb('0x2e')][_0x9bdb('0x30')]?_0x250cfb[_0x9bdb('0x2e')]:_0x3f01d2['model'];if(_0x426390['query']['includeAll']){_0x250cfb[_0x9bdb('0x31')]=[{'all':!![]}];}_0x250cfb=_['merge']({},_0x250cfb,_0x426390[_0x9bdb('0x32')]);return db[_0x9bdb('0x2a')][_0x9bdb('0x33')](_0x250cfb)[_0x9bdb('0x23')](handleEntityNotFound(_0x820d2e,null))[_0x9bdb('0x23')](respondWithResult(_0x820d2e,null))[_0x9bdb('0x34')](handleError(_0x820d2e,null));};exports[_0x9bdb('0x35')]=function(_0x542e20,_0x39c716){return db[_0x9bdb('0x2a')][_0x9bdb('0x35')](_0x542e20[_0x9bdb('0x36')],{})[_0x9bdb('0x23')](respondWithResult(_0x39c716,0xc9))['catch'](handleError(_0x39c716,null));};exports[_0x9bdb('0x22')]=function(_0x35e567,_0x232043){if(_0x35e567['body']['id']){delete _0x35e567[_0x9bdb('0x36')]['id'];}return db['ChatProactiveAction'][_0x9bdb('0x33')]({'where':{'id':_0x35e567[_0x9bdb('0x37')]['id']}})[_0x9bdb('0x23')](handleEntityNotFound(_0x232043,null))['then'](saveUpdates(_0x35e567['body'],null))['then'](respondWithResult(_0x232043,null))[_0x9bdb('0x34')](handleError(_0x232043,null));};exports[_0x9bdb('0x38')]=function(_0x51b5a6,_0x31b71b){return db['ChatProactiveAction'][_0x9bdb('0x33')]({'where':{'id':_0x51b5a6['params']['id']}})[_0x9bdb('0x23')](handleEntityNotFound(_0x31b71b,null))[_0x9bdb('0x23')](removeEntity(_0x31b71b,null))[_0x9bdb('0x34')](handleError(_0x31b71b,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index e64faca..dbdce14 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 _0x7839=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes','define','chat_proactive_actions'];(function(_0x198e29,_0x3b8474){var _0x10ccb3=function(_0xef1127){while(--_0xef1127){_0x198e29['push'](_0x198e29['shift']());}};_0x10ccb3(++_0x3b8474);}(_0x7839,0x118));var _0x9783=function(_0x4f9318,_0x18bde6){_0x4f9318=_0x4f9318-0x0;var _0x2f093a=_0x7839[_0x4f9318];return _0x2f093a;};'use strict';var _=require('lodash');var util=require(_0x9783('0x0'));var logger=require(_0x9783('0x1'))(_0x9783('0x2'));var moment=require(_0x9783('0x3'));var BPromise=require('bluebird');var rp=require(_0x9783('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9783('0x5'));var config=require(_0x9783('0x6'));var attributes=require(_0x9783('0x7'));module['exports']=function(_0x5493f9,_0x1270e3){return _0x5493f9[_0x9783('0x8')]('ChatProactiveAction',attributes,{'tableName':_0x9783('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe17d=['ChatProactiveAction','api','moment','bluebird','path','./chatProactiveAction.attributes','exports','define'];(function(_0x269ee8,_0x477226){var _0x4d98bd=function(_0x20d4c4){while(--_0x20d4c4){_0x269ee8['push'](_0x269ee8['shift']());}};_0x4d98bd(++_0x477226);}(_0xe17d,0x121));var _0xde17=function(_0x2f43fe,_0x3e7880){_0x2f43fe=_0x2f43fe-0x0;var _0x3a754a=_0xe17d[_0x2f43fe];return _0x3a754a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xde17('0x0'));var moment=require(_0xde17('0x1'));var BPromise=require(_0xde17('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xde17('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xde17('0x4'));module[_0xde17('0x5')]=function(_0xd4f401,_0x2eee6e){return _0xd4f401[_0xde17('0x6')](_0xde17('0x7'),attributes,{'tableName':'chat_proactive_actions','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 d5dce6f..cec6c8c 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 _0x21f4=['../../mysqldb','../../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','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1d9956,_0x3cfad7){var _0xaa6dc=function(_0x4530eb){while(--_0x4530eb){_0x1d9956['push'](_0x1d9956['shift']());}};_0xaa6dc(++_0x3cfad7);}(_0x21f4,0x1ee));var _0x421f=function(_0x49cf5f,_0x182bd9){_0x49cf5f=_0x49cf5f-0x0;var _0x16deb8=_0x21f4[_0x49cf5f];return _0x16deb8;};'use strict';var _=require(_0x421f('0x0'));var util=require(_0x421f('0x1'));var moment=require(_0x421f('0x2'));var BPromise=require(_0x421f('0x3'));var rs=require(_0x421f('0x4'));var fs=require('fs');var Redis=require(_0x421f('0x5'));var db=require(_0x421f('0x6'))['db'];var utils=require(_0x421f('0x7'));var logger=require(_0x421f('0x8'))(_0x421f('0x9'));var config=require(_0x421f('0xa'));var jayson=require(_0x421f('0xb'));var client=jayson[_0x421f('0xc')][_0x421f('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x53a84a,_0x1bbb14,_0x237cfe){return new BPromise(function(_0x5c475a,_0x5cf822){return client[_0x421f('0xe')](_0x53a84a,_0x237cfe)['then'](function(_0x417061){logger['info'](_0x421f('0xf'),_0x1bbb14,_0x421f('0x10'));logger[_0x421f('0x11')](_0x421f('0x12'),_0x1bbb14,_0x421f('0x10'),JSON['stringify'](_0x417061));if(_0x417061['error']){if(_0x417061[_0x421f('0x13')][_0x421f('0x14')]===0x1f4){logger[_0x421f('0x13')](_0x421f('0xf'),_0x1bbb14,_0x417061[_0x421f('0x13')]['message']);return _0x5cf822(_0x417061[_0x421f('0x13')][_0x421f('0x15')]);}logger['error'](_0x421f('0xf'),_0x1bbb14,_0x417061['error'][_0x421f('0x15')]);return _0x5c475a(_0x417061[_0x421f('0x13')][_0x421f('0x15')]);}else{logger[_0x421f('0x16')](_0x421f('0xf'),_0x1bbb14,'request\x20sent');_0x5c475a(_0x417061[_0x421f('0x17')]['message']);}})[_0x421f('0x18')](function(_0xd76c8d){logger['error'](_0x421f('0xf'),_0x1bbb14,_0xd76c8d);_0x5cf822(_0xd76c8d);});});} \ No newline at end of file +var _0xcdd1=['request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x34e8f1,_0x4769c0){var _0x4bed53=function(_0x2aaef7){while(--_0x2aaef7){_0x34e8f1['push'](_0x34e8f1['shift']());}};_0x4bed53(++_0x4769c0);}(_0xcdd1,0x1e3));var _0x1cdd=function(_0x483e3a,_0x568361){_0x483e3a=_0x483e3a-0x0;var _0x43fca9=_0xcdd1[_0x483e3a];return _0x43fca9;};'use strict';var _=require(_0x1cdd('0x0'));var util=require(_0x1cdd('0x1'));var moment=require(_0x1cdd('0x2'));var BPromise=require(_0x1cdd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1cdd('0x4'));var db=require(_0x1cdd('0x5'))['db'];var utils=require(_0x1cdd('0x6'));var logger=require(_0x1cdd('0x7'))(_0x1cdd('0x8'));var config=require(_0x1cdd('0x9'));var jayson=require(_0x1cdd('0xa'));var client=jayson[_0x1cdd('0xb')][_0x1cdd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc0c168,_0x49d7a9,_0x5c76b4){return new BPromise(function(_0xe588c1,_0x1447d1){return client[_0x1cdd('0xd')](_0xc0c168,_0x5c76b4)[_0x1cdd('0xe')](function(_0x5c7ae7){logger[_0x1cdd('0xf')](_0x1cdd('0x10'),_0x49d7a9,_0x1cdd('0x11'));logger[_0x1cdd('0x12')](_0x1cdd('0x13'),_0x49d7a9,_0x1cdd('0x11'),JSON['stringify'](_0x5c7ae7));if(_0x5c7ae7[_0x1cdd('0x14')]){if(_0x5c7ae7[_0x1cdd('0x14')][_0x1cdd('0x15')]===0x1f4){logger[_0x1cdd('0x14')]('ChatProactiveAction,\x20%s,\x20%s',_0x49d7a9,_0x5c7ae7[_0x1cdd('0x14')][_0x1cdd('0x16')]);return _0x1447d1(_0x5c7ae7[_0x1cdd('0x14')][_0x1cdd('0x16')]);}logger[_0x1cdd('0x14')](_0x1cdd('0x10'),_0x49d7a9,_0x5c7ae7[_0x1cdd('0x14')][_0x1cdd('0x16')]);return _0xe588c1(_0x5c7ae7['error'][_0x1cdd('0x16')]);}else{logger[_0x1cdd('0xf')](_0x1cdd('0x10'),_0x49d7a9,_0x1cdd('0x11'));_0xe588c1(_0x5c7ae7[_0x1cdd('0x17')]['message']);}})[_0x1cdd('0x18')](function(_0x5960c6){logger[_0x1cdd('0x14')](_0x1cdd('0x10'),_0x49d7a9,_0x5960c6);_0x1447d1(_0x5960c6);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 44766f4..3f2f741 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 _0x7dfd=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','put','update','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x42aa91,_0x551526){var _0x5f3938=function(_0x33ff4a){while(--_0x33ff4a){_0x42aa91['push'](_0x42aa91['shift']());}};_0x5f3938(++_0x551526);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var path=require(_0xd7df('0x2'));var timeout=require(_0xd7df('0x3'));var express=require(_0xd7df('0x4'));var router=express[_0xd7df('0x5')]();var fs_extra=require(_0xd7df('0x6'));var auth=require(_0xd7df('0x7'));var interaction=require(_0xd7df('0x8'));var config=require(_0xd7df('0x9'));var controller=require(_0xd7df('0xa'));router[_0xd7df('0xb')](_0xd7df('0xc'),auth[_0xd7df('0xd')](),controller[_0xd7df('0xe')]);router[_0xd7df('0xf')]('/',auth[_0xd7df('0xd')](),controller['create']);router[_0xd7df('0x10')](_0xd7df('0xc'),auth[_0xd7df('0xd')](),controller[_0xd7df('0x11')]);router['delete'](_0xd7df('0xc'),auth['isAuthenticated'](),controller[_0xd7df('0x12')]);module['exports']=router; \ No newline at end of file +var _0x98a8=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','show','isAuthenticated','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4eec9b,_0x4aea09){var _0x2e3849=function(_0x24c06d){while(--_0x24c06d){_0x4eec9b['push'](_0x4eec9b['shift']());}};_0x2e3849(++_0x4aea09);}(_0x98a8,0x12c));var _0x898a=function(_0x26e3b0,_0x397e94){_0x26e3b0=_0x26e3b0-0x0;var _0x4205b8=_0x98a8[_0x26e3b0];return _0x4205b8;};'use strict';var multer=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var timeout=require(_0x898a('0x3'));var express=require(_0x898a('0x4'));var router=express[_0x898a('0x5')]();var fs_extra=require(_0x898a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x898a('0x7'));var config=require(_0x898a('0x8'));var controller=require(_0x898a('0x9'));router[_0x898a('0xa')](_0x898a('0xb'),auth['isAuthenticated'](),controller[_0x898a('0xc')]);router['post']('/',auth[_0x898a('0xd')](),controller['create']);router[_0x898a('0xe')](_0x898a('0xb'),auth[_0x898a('0xd')](),controller[_0x898a('0xf')]);router[_0x898a('0x10')](_0x898a('0xb'),auth[_0x898a('0xd')](),controller[_0x898a('0x11')]);module[_0x898a('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 7b39913..cc17994 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 _0x2c6b=['name','STRING','ENUM','rrmemory','beepall','roundrobin','exports'];(function(_0x27d6d4,_0x2f7449){var _0x25e6cc=function(_0x1f039b){while(--_0x1f039b){_0x27d6d4['push'](_0x27d6d4['shift']());}};_0x25e6cc(++_0x2f7449);}(_0x2c6b,0x1aa));var _0xb2c6=function(_0x227831,_0x1036ab){_0x227831=_0x227831-0x0;var _0x58dc93=_0x2c6b[_0x227831];return _0x58dc93;};'use strict';var Sequelize=require('sequelize');module[_0xb2c6('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xb2c6('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb2c6('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb2c6('0x3')](_0xb2c6('0x4'),_0xb2c6('0x5'),_0xb2c6('0x6'))}}; \ No newline at end of file +var _0x995a=['name','INTEGER','ENUM','rrmemory','sequelize','exports','STRING'];(function(_0x25f440,_0x53e500){var _0x3f067c=function(_0x22b345){while(--_0x22b345){_0x25f440['push'](_0x25f440['shift']());}};_0x3f067c(++_0x53e500);}(_0x995a,0x115));var _0xa995=function(_0x1fec6f,_0x4580bf){_0x1fec6f=_0x1fec6f-0x0;var _0x30a4b0=_0x995a[_0x1fec6f];return _0x30a4b0;};'use strict';var Sequelize=require(_0xa995('0x0'));module[_0xa995('0x1')]={'name':{'type':Sequelize[_0xa995('0x2')],'unique':_0xa995('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa995('0x2')]},'timeout':{'type':Sequelize[_0xa995('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa995('0x5')](_0xa995('0x6'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 95b30bf..117e373 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 _0x9a67=['filters','attributes','intersection','fields','length','merge','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatQueues','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','order','sort','where','pick','ChatQueueId','filter','User','findAndCountAll','UserId','agent','chatPause','rows','format','%s/%s','createdAt','updatedAt','getTeams','Team','nolimit','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit','userChatQueue:save','ids','select','field','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','forEach','addAgents','spread','isArray','userChatQueue:remove','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatQueue.socket','register','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','UserProfileResource','sendStatus','error','name','send','index','map','ChatQueue','rawAttributes','type','key','getOptions','include','findAll','catch','params','model','keys','query'];(function(_0x3145e0,_0x3263d8){var _0x40692f=function(_0x8d437){while(--_0x8d437){_0x3145e0['push'](_0x3145e0['shift']());}};_0x40692f(++_0x3263d8);}(_0x9a67,0x1c0));var _0x79a6=function(_0x3fafb9,_0x5d6612){_0x3fafb9=_0x3fafb9-0x0;var _0xada4d4=_0x9a67[_0x3fafb9];return _0xada4d4;};'use strict';var BPromise=require(_0x79a6('0x0'));var util=require(_0x79a6('0x1'));var _=require('lodash');var squel=require(_0x79a6('0x2'));var Redis=require(_0x79a6('0x3'));var qs=require(_0x79a6('0x4'));var logger=require(_0x79a6('0x5'))('api');var config=require(_0x79a6('0x6'));var db=require(_0x79a6('0x7'))['db'];config[_0x79a6('0x8')]=_[_0x79a6('0x9')](config[_0x79a6('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x79a6('0xa'))(new Redis(config[_0x79a6('0x8')]));require(_0x79a6('0xb'))[_0x79a6('0xc')](socket);function respondWithStatusCode(_0x200811,_0x47588b){_0x47588b=_0x47588b||0xcc;return function(_0x1f7b46){if(_0x1f7b46){return _0x200811['sendStatus'](_0x47588b);}return _0x200811[_0x79a6('0xd')](_0x47588b)[_0x79a6('0xe')]();};}function respondWithResult(_0x4d40ed,_0x2aa1c6){_0x2aa1c6=_0x2aa1c6||0xc8;return function(_0x2264a0){if(_0x2264a0){return _0x4d40ed[_0x79a6('0xd')](_0x2aa1c6)[_0x79a6('0xf')](_0x2264a0);}};}function respondWithFilteredResult(_0x556fd6,_0x34cdf5){return function(_0x215a9c){if(_0x215a9c){var _0x3e91a1=typeof _0x34cdf5['offset']===_0x79a6('0x10')&&typeof _0x34cdf5[_0x79a6('0x11')]===_0x79a6('0x10');var _0x2ec810=_0x215a9c['count'];var _0x37fc6b=_0x3e91a1?0x0:_0x34cdf5['offset'];var _0x2575eb=_0x3e91a1?_0x215a9c[_0x79a6('0x12')]:_0x34cdf5[_0x79a6('0x13')]+_0x34cdf5[_0x79a6('0x11')];var _0xd0e8cc;if(_0x2575eb>=_0x2ec810){_0x2575eb=_0x2ec810;_0xd0e8cc=0xc8;}else{_0xd0e8cc=0xce;}_0x556fd6[_0x79a6('0xd')](_0xd0e8cc);return _0x556fd6[_0x79a6('0x14')](_0x79a6('0x15'),_0x37fc6b+'-'+_0x2575eb+'/'+_0x2ec810)[_0x79a6('0xf')](_0x215a9c);}return null;};}function saveUpdates(_0x473013){return function(_0x5384da){if(_0x5384da){return _0x5384da[_0x79a6('0x16')](_0x473013)[_0x79a6('0x17')](function(_0x27688c){return _0x27688c;});}return null;};}function removeEntity(_0x3ca1e6){return function(_0x998388){if(_0x998388){return _0x998388[_0x79a6('0x18')]()[_0x79a6('0x17')](function(){var _0xca4e5=_0x998388['get']({'plain':!![]});var _0x348d57='ChatQueues';return db[_0x79a6('0x19')][_0x79a6('0x18')]({'where':{'type':_0x348d57,'resourceId':_0xca4e5['id']}})[_0x79a6('0x17')](function(){return _0x998388;});})['then'](function(){_0x3ca1e6[_0x79a6('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x319f0c){return function(_0x24942e){if(!_0x24942e){_0x319f0c[_0x79a6('0x1a')](0x194);}return _0x24942e;};}function handleError(_0x40e424,_0x126198){_0x126198=_0x126198||0x1f4;return function(_0x104f94){logger[_0x79a6('0x1b')](_0x104f94['stack']);if(_0x104f94[_0x79a6('0x1c')]){delete _0x104f94[_0x79a6('0x1c')];}_0x40e424[_0x79a6('0xd')](_0x126198)[_0x79a6('0x1d')](_0x104f94);};}exports[_0x79a6('0x1e')]=function(_0x2352fe,_0x4051ca){var _0x424a40={};var _0x31e3d7={'count':0x0,'rows':[]};var _0x3e1573=_[_0x79a6('0x1f')](db[_0x79a6('0x20')][_0x79a6('0x21')],function(_0x80ffc9){return{'name':_0x80ffc9['fieldName'],'type':_0x80ffc9[_0x79a6('0x22')][_0x79a6('0x23')]};});_0x424a40=qs[_0x79a6('0x24')](_0x3e1573,_0x2352fe);var _0x55e715={'where':_0x424a40['where']};return db[_0x79a6('0x20')][_0x79a6('0x12')](_0x55e715)[_0x79a6('0x17')](function(_0x160db5){_0x31e3d7[_0x79a6('0x12')]=_0x160db5;_0x424a40[_0x79a6('0x25')]=qs[_0x79a6('0x25')](_0x2352fe['query']);return db[_0x79a6('0x20')][_0x79a6('0x26')](_0x424a40);})[_0x79a6('0x17')](function(_0x2672d8){_0x31e3d7['rows']=_0x2672d8;return _0x31e3d7;})[_0x79a6('0x17')](respondWithFilteredResult(_0x4051ca,_0x424a40))[_0x79a6('0x27')](handleError(_0x4051ca,null));};exports['show']=function(_0x3e0572,_0x7c753){var _0x309119={'raw':!![],'where':{'id':_0x3e0572[_0x79a6('0x28')]['id']}},_0x44330e={};_0x44330e[_0x79a6('0x29')]=_[_0x79a6('0x2a')](db[_0x79a6('0x20')][_0x79a6('0x21')]);_0x44330e[_0x79a6('0x2b')]=_[_0x79a6('0x2a')](_0x3e0572['query']);_0x44330e[_0x79a6('0x2c')]=_['intersection'](_0x44330e[_0x79a6('0x29')],_0x44330e[_0x79a6('0x2b')]);_0x309119[_0x79a6('0x2d')]=_[_0x79a6('0x2e')](_0x44330e[_0x79a6('0x29')],qs['fields'](_0x3e0572[_0x79a6('0x2b')][_0x79a6('0x2f')]));_0x309119[_0x79a6('0x2d')]=_0x309119[_0x79a6('0x2d')][_0x79a6('0x30')]?_0x309119[_0x79a6('0x2d')]:_0x44330e[_0x79a6('0x29')];if(_0x3e0572[_0x79a6('0x2b')]['includeAll']){_0x309119[_0x79a6('0x25')]=[{'all':!![]}];}_0x309119=_[_0x79a6('0x31')]({},_0x309119,_0x3e0572[_0x79a6('0x32')]);return db['ChatQueue'][_0x79a6('0x33')](_0x309119)[_0x79a6('0x17')](handleEntityNotFound(_0x7c753,null))[_0x79a6('0x17')](respondWithResult(_0x7c753,null))[_0x79a6('0x27')](handleError(_0x7c753,null));};exports[_0x79a6('0x34')]=function(_0x2ef734,_0x8acca2){return db['ChatQueue'][_0x79a6('0x34')](_0x2ef734[_0x79a6('0x35')],{})[_0x79a6('0x17')](function(_0x18e7e5){var _0x2e237a=_0x2ef734['user'][_0x79a6('0x36')]({'plain':!![]});if(!_0x2e237a)throw new Error(_0x79a6('0x37'));if(_0x2e237a['role']==='user'){var _0x1351be=_0x18e7e5[_0x79a6('0x36')]({'plain':!![]});var _0x32981b=_0x79a6('0x38');return db['UserProfileSection'][_0x79a6('0x33')]({'where':{'name':_0x32981b,'userProfileId':_0x2e237a[_0x79a6('0x39')]},'raw':!![]})[_0x79a6('0x17')](function(_0xacc5ea){if(_0xacc5ea&&_0xacc5ea[_0x79a6('0x3a')]===0x0){return db['UserProfileResource'][_0x79a6('0x34')]({'name':_0x1351be['name'],'resourceId':_0x1351be['id'],'type':_0xacc5ea[_0x79a6('0x1c')],'sectionId':_0xacc5ea['id']},{})[_0x79a6('0x17')](function(){return _0x18e7e5;});}else{return _0x18e7e5;}})['catch'](function(_0x1c97d8){logger[_0x79a6('0x1b')](_0x79a6('0x3b'),_0x1c97d8);throw _0x1c97d8;});}return _0x18e7e5;})[_0x79a6('0x17')](respondWithResult(_0x8acca2,0xc9))['catch'](handleError(_0x8acca2,null));};exports[_0x79a6('0x16')]=function(_0x21f025,_0x5464ac){if(_0x21f025['body']['id']){delete _0x21f025[_0x79a6('0x35')]['id'];}return db[_0x79a6('0x20')][_0x79a6('0x33')]({'where':{'id':_0x21f025[_0x79a6('0x28')]['id']}})[_0x79a6('0x17')](handleEntityNotFound(_0x5464ac,null))[_0x79a6('0x17')](saveUpdates(_0x21f025[_0x79a6('0x35')],null))[_0x79a6('0x17')](respondWithResult(_0x5464ac,null))[_0x79a6('0x27')](handleError(_0x5464ac,null));};exports['destroy']=function(_0x52803d,_0x4e7792){return db[_0x79a6('0x20')][_0x79a6('0x33')]({'where':{'id':_0x52803d[_0x79a6('0x28')]['id']}})['then'](handleEntityNotFound(_0x4e7792,null))['then'](removeEntity(_0x4e7792,null))[_0x79a6('0x27')](handleError(_0x4e7792,null));};exports[_0x79a6('0x3c')]=function(_0x42fdf3,_0x3a5b13){return db['ChatQueue'][_0x79a6('0x3c')]()['then'](respondWithResult(_0x3a5b13,null))['catch'](handleError(_0x3a5b13,null));};exports[_0x79a6('0x3d')]=function(_0x437e9f,_0x1240c9){var _0x54ac6e={'raw':!![],'where':{}},_0x572fb1={},_0x18aada;return db[_0x79a6('0x20')][_0x79a6('0x3e')]({'where':{'id':_0x437e9f[_0x79a6('0x28')]['id']}})[_0x79a6('0x17')](handleEntityNotFound(_0x1240c9,null))[_0x79a6('0x17')](function(_0x1424a4){if(_0x1424a4){_0x18aada=_0x1424a4[_0x79a6('0x36')]({'plain':!![]});_0x572fb1[_0x79a6('0x29')]=_[_0x79a6('0x2a')](db[_0x79a6('0x3f')][_0x79a6('0x21')]);_0x572fb1[_0x79a6('0x2b')]=_['keys'](_0x437e9f[_0x79a6('0x2b')]);_0x572fb1[_0x79a6('0x2c')]=_[_0x79a6('0x2e')](_0x572fb1[_0x79a6('0x29')],_0x572fb1['query']);_0x54ac6e[_0x79a6('0x2d')]=_['intersection'](_0x572fb1[_0x79a6('0x29')],qs[_0x79a6('0x2f')](_0x437e9f['query'][_0x79a6('0x2f')]));_0x54ac6e[_0x79a6('0x2d')]=_0x54ac6e[_0x79a6('0x2d')][_0x79a6('0x30')]?_0x54ac6e[_0x79a6('0x2d')]:_0x572fb1['model'];if(!_0x437e9f['query'][_0x79a6('0x40')]('nolimit')){_0x54ac6e[_0x79a6('0x11')]=qs[_0x79a6('0x11')](_0x437e9f[_0x79a6('0x2b')][_0x79a6('0x11')]);_0x54ac6e[_0x79a6('0x13')]=qs[_0x79a6('0x13')](_0x437e9f[_0x79a6('0x2b')][_0x79a6('0x13')]);}_0x54ac6e[_0x79a6('0x41')]=qs[_0x79a6('0x42')](_0x437e9f[_0x79a6('0x2b')][_0x79a6('0x42')]);_0x54ac6e[_0x79a6('0x43')]=qs[_0x79a6('0x2c')](_[_0x79a6('0x44')](_0x437e9f[_0x79a6('0x2b')],_0x572fb1[_0x79a6('0x2c')]));_0x54ac6e[_0x79a6('0x43')][_0x79a6('0x45')]=_0x1424a4['id'];if(_0x437e9f[_0x79a6('0x2b')][_0x79a6('0x46')]){_0x54ac6e[_0x79a6('0x43')]=_[_0x79a6('0x31')](_0x54ac6e[_0x79a6('0x43')],{'$or':_[_0x79a6('0x1f')](_0x54ac6e['attributes'],function(_0x5be4f7){var _0x41dea5={};_0x41dea5[_0x5be4f7]={'$like':'%'+_0x437e9f['query']['filter']+'%'};return _0x41dea5;})});}_0x54ac6e=_[_0x79a6('0x31')]({},_0x54ac6e,_0x437e9f['options']);return db[_0x79a6('0x3f')][_0x79a6('0x26')](_0x54ac6e);}})[_0x79a6('0x17')](function(_0x309513){if(_0x309513){return db[_0x79a6('0x47')][_0x79a6('0x48')]({'where':{'id':_[_0x79a6('0x1f')](_0x309513,_0x79a6('0x49')),'role':_0x79a6('0x4a')},'attributes':['id','name',_0x79a6('0x4b'),'updatedAt','createdAt']});}})[_0x79a6('0x17')](function(_0x8ee49f){if(_0x8ee49f){return{'count':_0x8ee49f[_0x79a6('0x12')],'rows':_['map'](_0x8ee49f[_0x79a6('0x4c')],function(_0xee1bca){return{'membername':_0xee1bca[_0x79a6('0x1c')],'UserId':_0xee1bca['id'],'queue_name':_0x18aada[_0x79a6('0x1c')],'ChatQueueId':_0x18aada['id'],'interface':util[_0x79a6('0x4d')](_0x79a6('0x4e'),'SIP',_0xee1bca[_0x79a6('0x1c')]),'penalty':0x0,'paused':_0xee1bca[_0x79a6('0x4b')],'createdAt':_0xee1bca[_0x79a6('0x4f')],'updatedAt':_0xee1bca[_0x79a6('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x79a6('0x17')](respondWithFilteredResult(_0x1240c9,_0x54ac6e))[_0x79a6('0x27')](handleError(_0x1240c9,null));};exports[_0x79a6('0x51')]=function(_0x25155a,_0x324ee2){var _0x16855e={};var _0x347080={};var _0x557246;var _0xdb1e65;return db['ChatQueue'][_0x79a6('0x3e')]({'where':{'id':_0x25155a[_0x79a6('0x28')]['id']}})['then'](handleEntityNotFound(_0x324ee2,null))[_0x79a6('0x17')](function(_0x1fffc0){if(_0x1fffc0){_0x557246=_0x1fffc0;_0x347080[_0x79a6('0x29')]=_[_0x79a6('0x2a')](db[_0x79a6('0x52')][_0x79a6('0x21')]);_0x347080[_0x79a6('0x2b')]=_[_0x79a6('0x2a')](_0x25155a[_0x79a6('0x2b')]);_0x347080[_0x79a6('0x2c')]=_[_0x79a6('0x2e')](_0x347080['model'],_0x347080[_0x79a6('0x2b')]);_0x16855e[_0x79a6('0x2d')]=_['intersection'](_0x347080[_0x79a6('0x29')],qs['fields'](_0x25155a[_0x79a6('0x2b')][_0x79a6('0x2f')]));_0x16855e['attributes']=_0x16855e[_0x79a6('0x2d')]['length']?_0x16855e[_0x79a6('0x2d')]:_0x347080[_0x79a6('0x29')];_0x16855e['order']=qs[_0x79a6('0x42')](_0x25155a[_0x79a6('0x2b')][_0x79a6('0x42')]);_0x16855e[_0x79a6('0x43')]=qs[_0x79a6('0x2c')](_[_0x79a6('0x44')](_0x25155a[_0x79a6('0x2b')],_0x347080[_0x79a6('0x2c')]));if(_0x25155a[_0x79a6('0x2b')][_0x79a6('0x46')]){_0x16855e[_0x79a6('0x43')]=_[_0x79a6('0x31')](_0x16855e[_0x79a6('0x43')],{'$or':_[_0x79a6('0x1f')](_0x16855e[_0x79a6('0x2d')],function(_0x3b8202){var _0x35136a={};_0x35136a[_0x3b8202]={'$like':'%'+_0x25155a[_0x79a6('0x2b')][_0x79a6('0x46')]+'%'};return _0x35136a;})});}_0x16855e=_[_0x79a6('0x31')]({},_0x16855e,_0x25155a[_0x79a6('0x32')]);return _0x557246[_0x79a6('0x51')](_0x16855e);}})[_0x79a6('0x17')](function(_0x481103){if(_0x481103){_0xdb1e65=_0x481103[_0x79a6('0x30')];if(!_0x25155a['query']['hasOwnProperty'](_0x79a6('0x53'))){_0x16855e[_0x79a6('0x11')]=qs[_0x79a6('0x11')](_0x25155a['query'][_0x79a6('0x11')]);_0x16855e['offset']=qs[_0x79a6('0x13')](_0x25155a[_0x79a6('0x2b')][_0x79a6('0x13')]);}return _0x557246[_0x79a6('0x51')](_0x16855e);}})[_0x79a6('0x17')](function(_0x2c314e){if(_0x2c314e){return _0x2c314e?{'count':_0xdb1e65,'rows':_0x2c314e}:null;}})[_0x79a6('0x17')](respondWithResult(_0x324ee2,null))['catch'](handleError(_0x324ee2,null));};exports[_0x79a6('0x54')]=function(_0xc4418f,_0x270420){var _0x10a665=_0xc4418f['body']['ids'];return db[_0x79a6('0x52')]['findAll']({'where':{'id':_0x10a665},'attributes':['id'],'include':[{'model':db[_0x79a6('0x47')],'as':_0x79a6('0x55'),'attributes':['id',_0x79a6('0x1c'),_0x79a6('0x56'),_0x79a6('0x57'),_0x79a6('0x58')],'raw':!![]}]})[_0x79a6('0x17')](function(_0x171f85){if(_0x171f85){var _0x1cc9b2=_[_0x79a6('0x59')](_0x171f85,function(_0x3e570a){var _0x5cc6b2=_0x3e570a[_0x79a6('0x36')]({'plain':!![]});return _0x5cc6b2[_0x79a6('0x55')];});return db[_0x79a6('0x20')]['find']({'where':{'id':_0xc4418f[_0x79a6('0x28')]['id']}})[_0x79a6('0x17')](function(_0x39fc81){return db[_0x79a6('0x5a')][_0x79a6('0x5b')](function(_0x1b67f3){return _0x39fc81[_0x79a6('0x54')](_0x10a665,{'transaction':_0x1b67f3})[_0x79a6('0x17')](function(){return BPromise[_0x79a6('0x5c')](_0x1cc9b2,function(_0x48d1cf){return db[_0x79a6('0x3f')]['findOrCreate']({'where':{'UserId':_0x48d1cf['id'],'ChatQueueId':_0xc4418f[_0x79a6('0x28')]['id']},'transaction':_0x1b67f3});});})[_0x79a6('0x17')](function(){_0x1cc9b2['forEach'](function(_0x3d0d85){socket[_0x79a6('0x5d')](_0x79a6('0x5e'),{'UserId':_0x3d0d85['id'],'ChatQueueId':_0x39fc81['id']});});});});});}})[_0x79a6('0x17')](respondWithStatusCode(_0x270420,null))[_0x79a6('0x27')](handleError(_0x270420,null));};exports['removeTeams']=function(_0x457553,_0x120a37){return db[_0x79a6('0x52')][_0x79a6('0x26')]({'where':{'id':_0x457553['query'][_0x79a6('0x5f')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x79a6('0x55'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x120a37,null))[_0x79a6('0x17')](function(_0x56b02d){var _0x563d6c=_['map'](_0x56b02d,'id');var _0x234cd5=[];var _0x440898=[];var _0x4314dc=squel[_0x79a6('0x60')]();_0x4314dc[_0x79a6('0x61')]('tq.TeamId')[_0x79a6('0x62')](_0x79a6('0x63'),'tq')[_0x79a6('0x64')](_0x79a6('0x65'),'ut',_0x79a6('0x66'))[_0x79a6('0x43')]('ChatQueueId\x20=\x20?',_0x457553['params']['id']);for(var _0x1b41a5=0x0;_0x1b41a5<_0x56b02d['length'];_0x1b41a5+=0x1){let _0x333cf6=_0x56b02d[_0x1b41a5];for(var _0xdddea2=0x0;_0xdddea2<_0x333cf6[_0x79a6('0x55')][_0x79a6('0x30')];_0xdddea2+=0x1){let _0xf3ef3b=_0x333cf6[_0x79a6('0x55')][_0xdddea2];var _0x480a3f=_0x4314dc[_0x79a6('0x67')]();_0x480a3f[_0x79a6('0x43')](_0x79a6('0x68'),_0xf3ef3b['id']);_0x440898[_0x79a6('0x69')](db['sequelize'][_0x79a6('0x2b')](_0x480a3f[_0x79a6('0x6a')](),{'type':db[_0x79a6('0x5a')][_0x79a6('0x6b')]['SELECT']})[_0x79a6('0x17')](function(_0x2a7244){if(_0x2a7244[_0x79a6('0x30')]===0x1){return _0xf3ef3b['id'];}else{var _0x3f06e9=_[_0x79a6('0x6c')](_[_0x79a6('0x1f')](_0x2a7244,'TeamId'),function(_0x5ad0a8){return _[_0x79a6('0x6d')](_0x563d6c,_0x5ad0a8);});if(_0x3f06e9){return _0xf3ef3b['id'];}}}));}}return BPromise[_0x79a6('0x6e')](_0x440898)[_0x79a6('0x17')](function(_0x281815){_0x234cd5=_(_0x234cd5)[_0x79a6('0x6f')](_0x281815)[_0x79a6('0x70')]()[_0x79a6('0x71')]();return db[_0x79a6('0x20')][_0x79a6('0x33')]({'where':{'id':_0x457553['params']['id']}})[_0x79a6('0x17')](function(_0x1cb013){return db['sequelize'][_0x79a6('0x5b')](function(_0x2b143c){return _0x1cb013[_0x79a6('0x72')](_0x457553[_0x79a6('0x2b')][_0x79a6('0x5f')],{'transaction':_0x2b143c})[_0x79a6('0x17')](function(){if(!_[_0x79a6('0x73')](_0x234cd5)){return _0x1cb013[_0x79a6('0x74')](_0x234cd5,{'transaction':_0x2b143c});}})[_0x79a6('0x17')](function(){_0x234cd5[_0x79a6('0x75')](function(_0x7fcb2b){socket[_0x79a6('0x5d')]('userChatQueue:remove',{'UserId':_0x7fcb2b,'ChatQueueId':_0x1cb013['id']});});});});});});})[_0x79a6('0x17')](respondWithStatusCode(_0x120a37,null))[_0x79a6('0x27')](handleError(_0x120a37,null));};exports[_0x79a6('0x76')]=function(_0x59e324,_0x5e3fcd){return db[_0x79a6('0x20')][_0x79a6('0x33')]({'where':{'id':_0x59e324['params']['id']}})[_0x79a6('0x17')](handleEntityNotFound(_0x5e3fcd,null))[_0x79a6('0x17')](function(_0x307113){if(_0x307113){return _0x307113['addAgents'](_0x59e324[_0x79a6('0x35')]['ids'],_['omit'](_0x59e324[_0x79a6('0x35')],[_0x79a6('0x5f'),'id'])||{})[_0x79a6('0x77')](function(_0x200dc0){for(var _0x4298ae=0x0;_0x4298ae<_0x59e324[_0x79a6('0x35')]['ids'][_0x79a6('0x30')];_0x4298ae+=0x1){socket[_0x79a6('0x5d')](_0x79a6('0x5e'),{'UserId':Number(_0x59e324[_0x79a6('0x35')][_0x79a6('0x5f')][_0x4298ae]),'ChatQueueId':Number(_0x59e324[_0x79a6('0x28')]['id'])});}return _0x200dc0;});}})[_0x79a6('0x17')](respondWithResult(_0x5e3fcd,null))[_0x79a6('0x27')](handleError(_0x5e3fcd,null));};exports[_0x79a6('0x74')]=function(_0x46e00c,_0x44a5e9){return db['ChatQueue'][_0x79a6('0x33')]({'where':{'id':_0x46e00c['params']['id']}})[_0x79a6('0x17')](handleEntityNotFound(_0x44a5e9,null))[_0x79a6('0x17')](function(_0x1a867e){if(_0x1a867e){return _0x1a867e[_0x79a6('0x74')](_0x46e00c[_0x79a6('0x2b')][_0x79a6('0x5f')])[_0x79a6('0x17')](function(){if(_[_0x79a6('0x78')](_0x46e00c[_0x79a6('0x2b')]['ids'])){for(var _0x27424a=0x0;_0x27424a<_0x46e00c['query']['ids'][_0x79a6('0x30')];_0x27424a+=0x1){socket[_0x79a6('0x5d')](_0x79a6('0x79'),{'UserId':Number(_0x46e00c[_0x79a6('0x2b')]['ids'][_0x27424a]),'ChatQueueId':Number(_0x46e00c[_0x79a6('0x28')]['id'])});}}else{socket['emit'](_0x79a6('0x79'),{'UserId':Number(_0x46e00c[_0x79a6('0x2b')][_0x79a6('0x5f')]),'ChatQueueId':Number(_0x46e00c[_0x79a6('0x28')]['id'])});}});}})['then'](respondWithStatusCode(_0x44a5e9,null))[_0x79a6('0x27')](handleError(_0x44a5e9,null));};exports[_0x79a6('0x7a')]=function(_0x4e2ba5,_0x503434){var _0xfd8168={};var _0x39519f={};var _0x3f4dc1;var _0x21dda0;return db[_0x79a6('0x20')][_0x79a6('0x3e')]({'where':{'id':_0x4e2ba5[_0x79a6('0x28')]['id']}})['then'](handleEntityNotFound(_0x503434,null))['then'](function(_0x3847dc){if(_0x3847dc){_0x3f4dc1=_0x3847dc;_0x39519f[_0x79a6('0x29')]=_[_0x79a6('0x2a')](db[_0x79a6('0x47')][_0x79a6('0x21')]);_0x39519f[_0x79a6('0x2b')]=_[_0x79a6('0x2a')](_0x4e2ba5[_0x79a6('0x2b')]);_0x39519f[_0x79a6('0x2c')]=_['intersection'](_0x39519f[_0x79a6('0x29')],_0x39519f['query']);_0xfd8168['attributes']=_[_0x79a6('0x2e')](_0x39519f[_0x79a6('0x29')],qs[_0x79a6('0x2f')](_0x4e2ba5['query'][_0x79a6('0x2f')]));_0xfd8168[_0x79a6('0x2d')]=_0xfd8168[_0x79a6('0x2d')][_0x79a6('0x30')]?_0xfd8168[_0x79a6('0x2d')]:_0x39519f[_0x79a6('0x29')];_0xfd8168['order']=qs[_0x79a6('0x42')](_0x4e2ba5['query'][_0x79a6('0x42')]);_0xfd8168['where']=qs[_0x79a6('0x2c')](_[_0x79a6('0x44')](_0x4e2ba5['query'],_0x39519f[_0x79a6('0x2c')]));if(_0x4e2ba5[_0x79a6('0x2b')]['filter']){_0xfd8168[_0x79a6('0x43')]=_['merge'](_0xfd8168[_0x79a6('0x43')],{'$or':_[_0x79a6('0x1f')](_0xfd8168[_0x79a6('0x2d')],function(_0x44c7a4){var _0x46f10c={};_0x46f10c[_0x44c7a4]={'$like':'%'+_0x4e2ba5[_0x79a6('0x2b')][_0x79a6('0x46')]+'%'};return _0x46f10c;})});}_0xfd8168=_[_0x79a6('0x31')]({},_0xfd8168,_0x4e2ba5['options']);return _0x3f4dc1['getAgents'](_0xfd8168);}})['then'](function(_0x9f699c){if(_0x9f699c){_0x21dda0=_0x9f699c[_0x79a6('0x30')];if(!_0x4e2ba5[_0x79a6('0x2b')][_0x79a6('0x40')](_0x79a6('0x53'))){_0xfd8168[_0x79a6('0x11')]=qs[_0x79a6('0x11')](_0x4e2ba5[_0x79a6('0x2b')][_0x79a6('0x11')]);_0xfd8168['offset']=qs['offset'](_0x4e2ba5[_0x79a6('0x2b')][_0x79a6('0x13')]);}return _0x3f4dc1['getAgents'](_0xfd8168);}})['then'](function(_0x548b5b){if(_0x548b5b){return _0x548b5b?{'count':_0x21dda0,'rows':_0x548b5b}:null;}})[_0x79a6('0x17')](respondWithResult(_0x503434,null))[_0x79a6('0x27')](handleError(_0x503434,null));}; \ No newline at end of file +var _0xbeb5=['ChatQueue','include','query','findAll','show','params','model','rawAttributes','keys','intersection','attributes','fields','length','includeAll','merge','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserChatQueue','filters','hasOwnProperty','order','sort','pick','filter','options','User','findAndCountAll','UserId','agent','chatPause','updatedAt','rows','format','SIP','createdAt','findOne','nolimit','getTeams','addTeams','ids','Team','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','userChatQueue:save','removeTeams','select','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','union','removeAgents','userChatQueue:remove','omit','spread','emit','isArray','getAgents','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','end','status','json','undefined','limit','offset','count','set','Content-Range','update','then','destroy','get','ChatQueues','error','stack','name','send','index','map','fieldName','key','getOptions','where'];(function(_0x3710f1,_0x4d55cf){var _0x1ef269=function(_0x286dce){while(--_0x286dce){_0x3710f1['push'](_0x3710f1['shift']());}};_0x1ef269(++_0x4d55cf);}(_0xbeb5,0x1c4));var _0x5beb=function(_0x58f59d,_0x24d60e){_0x58f59d=_0x58f59d-0x0;var _0x5daff3=_0xbeb5[_0x58f59d];return _0x5daff3;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x5beb('0x0'));var squel=require(_0x5beb('0x1'));var Redis=require('ioredis');var qs=require(_0x5beb('0x2'));var logger=require(_0x5beb('0x3'))(_0x5beb('0x4'));var config=require(_0x5beb('0x5'));var db=require('../../mysqldb')['db'];config[_0x5beb('0x6')]=_[_0x5beb('0x7')](config['redis'],{'host':_0x5beb('0x8'),'port':0x18eb});var socket=require(_0x5beb('0x9'))(new Redis(config[_0x5beb('0x6')]));require(_0x5beb('0xa'))[_0x5beb('0xb')](socket);function respondWithStatusCode(_0x30f197,_0x5bd0a5){_0x5bd0a5=_0x5bd0a5||0xcc;return function(_0x50e197){if(_0x50e197){return _0x30f197['sendStatus'](_0x5bd0a5);}return _0x30f197['status'](_0x5bd0a5)[_0x5beb('0xc')]();};}function respondWithResult(_0x3248d9,_0x2dd448){_0x2dd448=_0x2dd448||0xc8;return function(_0x36191c){if(_0x36191c){return _0x3248d9[_0x5beb('0xd')](_0x2dd448)[_0x5beb('0xe')](_0x36191c);}};}function respondWithFilteredResult(_0x4b1e18,_0x40505b){return function(_0x375107){if(_0x375107){var _0x4ebd61=typeof _0x40505b['offset']===_0x5beb('0xf')&&typeof _0x40505b[_0x5beb('0x10')]===_0x5beb('0xf');var _0x3f8268=_0x375107['count'];var _0x4e621c=_0x4ebd61?0x0:_0x40505b[_0x5beb('0x11')];var _0x12ce86=_0x4ebd61?_0x375107[_0x5beb('0x12')]:_0x40505b['offset']+_0x40505b[_0x5beb('0x10')];var _0x3282ff;if(_0x12ce86>=_0x3f8268){_0x12ce86=_0x3f8268;_0x3282ff=0xc8;}else{_0x3282ff=0xce;}_0x4b1e18[_0x5beb('0xd')](_0x3282ff);return _0x4b1e18[_0x5beb('0x13')](_0x5beb('0x14'),_0x4e621c+'-'+_0x12ce86+'/'+_0x3f8268)[_0x5beb('0xe')](_0x375107);}return null;};}function saveUpdates(_0x12d153){return function(_0x40582e){if(_0x40582e){return _0x40582e[_0x5beb('0x15')](_0x12d153)[_0x5beb('0x16')](function(_0x2d1266){return _0x2d1266;});}return null;};}function removeEntity(_0x3c5fad){return function(_0x475ba1){if(_0x475ba1){return _0x475ba1[_0x5beb('0x17')]()[_0x5beb('0x16')](function(){var _0x3e7bd3=_0x475ba1[_0x5beb('0x18')]({'plain':!![]});var _0x2662e9=_0x5beb('0x19');return db['UserProfileResource']['destroy']({'where':{'type':_0x2662e9,'resourceId':_0x3e7bd3['id']}})[_0x5beb('0x16')](function(){return _0x475ba1;});})[_0x5beb('0x16')](function(){_0x3c5fad[_0x5beb('0xd')](0xcc)[_0x5beb('0xc')]();});}};}function handleEntityNotFound(_0x33a892){return function(_0x3574b2){if(!_0x3574b2){_0x33a892['sendStatus'](0x194);}return _0x3574b2;};}function handleError(_0x2b05b9,_0x22e3c8){_0x22e3c8=_0x22e3c8||0x1f4;return function(_0x5c148d){logger[_0x5beb('0x1a')](_0x5c148d[_0x5beb('0x1b')]);if(_0x5c148d[_0x5beb('0x1c')]){delete _0x5c148d[_0x5beb('0x1c')];}_0x2b05b9[_0x5beb('0xd')](_0x22e3c8)[_0x5beb('0x1d')](_0x5c148d);};}exports[_0x5beb('0x1e')]=function(_0x266d30,_0x28a134){var _0xc8b202={};var _0x4d9643={'count':0x0,'rows':[]};var _0x1ad379=_[_0x5beb('0x1f')](db['ChatQueue']['rawAttributes'],function(_0x42c48){return{'name':_0x42c48[_0x5beb('0x20')],'type':_0x42c48['type'][_0x5beb('0x21')]};});_0xc8b202=qs[_0x5beb('0x22')](_0x1ad379,_0x266d30);var _0x56d13a={'where':_0xc8b202[_0x5beb('0x23')]};return db[_0x5beb('0x24')][_0x5beb('0x12')](_0x56d13a)[_0x5beb('0x16')](function(_0xb3fed7){_0x4d9643['count']=_0xb3fed7;_0xc8b202[_0x5beb('0x25')]=qs[_0x5beb('0x25')](_0x266d30[_0x5beb('0x26')]);return db[_0x5beb('0x24')][_0x5beb('0x27')](_0xc8b202);})['then'](function(_0x108574){_0x4d9643['rows']=_0x108574;return _0x4d9643;})[_0x5beb('0x16')](respondWithFilteredResult(_0x28a134,_0xc8b202))['catch'](handleError(_0x28a134,null));};exports[_0x5beb('0x28')]=function(_0x48464e,_0x4d42b4){var _0x2bd915={'raw':!![],'where':{'id':_0x48464e[_0x5beb('0x29')]['id']}},_0x2d06fb={};_0x2d06fb[_0x5beb('0x2a')]=_['keys'](db[_0x5beb('0x24')][_0x5beb('0x2b')]);_0x2d06fb[_0x5beb('0x26')]=_[_0x5beb('0x2c')](_0x48464e[_0x5beb('0x26')]);_0x2d06fb['filters']=_[_0x5beb('0x2d')](_0x2d06fb[_0x5beb('0x2a')],_0x2d06fb[_0x5beb('0x26')]);_0x2bd915[_0x5beb('0x2e')]=_['intersection'](_0x2d06fb['model'],qs[_0x5beb('0x2f')](_0x48464e[_0x5beb('0x26')][_0x5beb('0x2f')]));_0x2bd915['attributes']=_0x2bd915['attributes'][_0x5beb('0x30')]?_0x2bd915[_0x5beb('0x2e')]:_0x2d06fb[_0x5beb('0x2a')];if(_0x48464e[_0x5beb('0x26')][_0x5beb('0x31')]){_0x2bd915[_0x5beb('0x25')]=[{'all':!![]}];}_0x2bd915=_[_0x5beb('0x32')]({},_0x2bd915,_0x48464e['options']);return db[_0x5beb('0x24')]['find'](_0x2bd915)['then'](handleEntityNotFound(_0x4d42b4,null))[_0x5beb('0x16')](respondWithResult(_0x4d42b4,null))[_0x5beb('0x33')](handleError(_0x4d42b4,null));};exports[_0x5beb('0x34')]=function(_0x2b2e5c,_0x36ec0a){return db[_0x5beb('0x24')][_0x5beb('0x34')](_0x2b2e5c[_0x5beb('0x35')],{})['then'](function(_0x5a0c7b){var _0x274dd1=_0x2b2e5c[_0x5beb('0x36')]['get']({'plain':!![]});if(!_0x274dd1)throw new Error(_0x5beb('0x37'));if(_0x274dd1[_0x5beb('0x38')]===_0x5beb('0x36')){var _0x49c3c0=_0x5a0c7b[_0x5beb('0x18')]({'plain':!![]});var _0x12ae05='ChatQueues';return db[_0x5beb('0x39')][_0x5beb('0x3a')]({'where':{'name':_0x12ae05,'userProfileId':_0x274dd1[_0x5beb('0x3b')]},'raw':!![]})[_0x5beb('0x16')](function(_0x5078ff){if(_0x5078ff&&_0x5078ff['autoAssociation']===0x0){return db[_0x5beb('0x3c')][_0x5beb('0x34')]({'name':_0x49c3c0[_0x5beb('0x1c')],'resourceId':_0x49c3c0['id'],'type':_0x5078ff[_0x5beb('0x1c')],'sectionId':_0x5078ff['id']},{})[_0x5beb('0x16')](function(){return _0x5a0c7b;});}else{return _0x5a0c7b;}})[_0x5beb('0x33')](function(_0x28d1c5){logger[_0x5beb('0x1a')](_0x5beb('0x3d'),_0x28d1c5);throw _0x28d1c5;});}return _0x5a0c7b;})['then'](respondWithResult(_0x36ec0a,0xc9))['catch'](handleError(_0x36ec0a,null));};exports[_0x5beb('0x15')]=function(_0x582f69,_0x537433){if(_0x582f69['body']['id']){delete _0x582f69[_0x5beb('0x35')]['id'];}return db[_0x5beb('0x24')][_0x5beb('0x3a')]({'where':{'id':_0x582f69[_0x5beb('0x29')]['id']}})['then'](handleEntityNotFound(_0x537433,null))[_0x5beb('0x16')](saveUpdates(_0x582f69[_0x5beb('0x35')],null))[_0x5beb('0x16')](respondWithResult(_0x537433,null))['catch'](handleError(_0x537433,null));};exports['destroy']=function(_0x4ebcf7,_0x3dc8ba){return db['ChatQueue'][_0x5beb('0x3a')]({'where':{'id':_0x4ebcf7[_0x5beb('0x29')]['id']}})[_0x5beb('0x16')](handleEntityNotFound(_0x3dc8ba,null))[_0x5beb('0x16')](removeEntity(_0x3dc8ba,null))[_0x5beb('0x33')](handleError(_0x3dc8ba,null));};exports[_0x5beb('0x3e')]=function(_0x5206be,_0x1f72a4){return db[_0x5beb('0x24')][_0x5beb('0x3e')]()['then'](respondWithResult(_0x1f72a4,null))[_0x5beb('0x33')](handleError(_0x1f72a4,null));};exports[_0x5beb('0x3f')]=function(_0x246a53,_0xbe81dd){var _0x38fc47={'raw':!![],'where':{}},_0x97ec39={},_0x30015f;return db[_0x5beb('0x24')]['findOne']({'where':{'id':_0x246a53[_0x5beb('0x29')]['id']}})[_0x5beb('0x16')](handleEntityNotFound(_0xbe81dd,null))[_0x5beb('0x16')](function(_0x6732f4){if(_0x6732f4){_0x30015f=_0x6732f4['get']({'plain':!![]});_0x97ec39['model']=_['keys'](db[_0x5beb('0x40')][_0x5beb('0x2b')]);_0x97ec39[_0x5beb('0x26')]=_[_0x5beb('0x2c')](_0x246a53[_0x5beb('0x26')]);_0x97ec39[_0x5beb('0x41')]=_['intersection'](_0x97ec39['model'],_0x97ec39['query']);_0x38fc47['attributes']=_[_0x5beb('0x2d')](_0x97ec39[_0x5beb('0x2a')],qs['fields'](_0x246a53['query'][_0x5beb('0x2f')]));_0x38fc47[_0x5beb('0x2e')]=_0x38fc47[_0x5beb('0x2e')]['length']?_0x38fc47['attributes']:_0x97ec39['model'];if(!_0x246a53['query'][_0x5beb('0x42')]('nolimit')){_0x38fc47[_0x5beb('0x10')]=qs[_0x5beb('0x10')](_0x246a53['query'][_0x5beb('0x10')]);_0x38fc47['offset']=qs[_0x5beb('0x11')](_0x246a53[_0x5beb('0x26')][_0x5beb('0x11')]);}_0x38fc47[_0x5beb('0x43')]=qs[_0x5beb('0x44')](_0x246a53['query'][_0x5beb('0x44')]);_0x38fc47['where']=qs[_0x5beb('0x41')](_[_0x5beb('0x45')](_0x246a53[_0x5beb('0x26')],_0x97ec39[_0x5beb('0x41')]));_0x38fc47[_0x5beb('0x23')]['ChatQueueId']=_0x6732f4['id'];if(_0x246a53[_0x5beb('0x26')]['filter']){_0x38fc47[_0x5beb('0x23')]=_[_0x5beb('0x32')](_0x38fc47[_0x5beb('0x23')],{'$or':_[_0x5beb('0x1f')](_0x38fc47[_0x5beb('0x2e')],function(_0x59788d){var _0x2daa80={};_0x2daa80[_0x59788d]={'$like':'%'+_0x246a53['query'][_0x5beb('0x46')]+'%'};return _0x2daa80;})});}_0x38fc47=_[_0x5beb('0x32')]({},_0x38fc47,_0x246a53[_0x5beb('0x47')]);return db[_0x5beb('0x40')][_0x5beb('0x27')](_0x38fc47);}})[_0x5beb('0x16')](function(_0x388fe0){if(_0x388fe0){return db[_0x5beb('0x48')][_0x5beb('0x49')]({'where':{'id':_[_0x5beb('0x1f')](_0x388fe0,_0x5beb('0x4a')),'role':_0x5beb('0x4b')},'attributes':['id',_0x5beb('0x1c'),_0x5beb('0x4c'),_0x5beb('0x4d'),'createdAt']});}})[_0x5beb('0x16')](function(_0x5a8baa){if(_0x5a8baa){return{'count':_0x5a8baa['count'],'rows':_[_0x5beb('0x1f')](_0x5a8baa[_0x5beb('0x4e')],function(_0x38d0ba){return{'membername':_0x38d0ba[_0x5beb('0x1c')],'UserId':_0x38d0ba['id'],'queue_name':_0x30015f[_0x5beb('0x1c')],'ChatQueueId':_0x30015f['id'],'interface':util[_0x5beb('0x4f')]('%s/%s',_0x5beb('0x50'),_0x38d0ba['name']),'penalty':0x0,'paused':_0x38d0ba[_0x5beb('0x4c')],'createdAt':_0x38d0ba[_0x5beb('0x51')],'updatedAt':_0x38d0ba['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5beb('0x16')](respondWithFilteredResult(_0xbe81dd,_0x38fc47))[_0x5beb('0x33')](handleError(_0xbe81dd,null));};exports['getTeams']=function(_0xe7aab9,_0xa459de){var _0x563fba={};var _0x1609c1={};var _0x143f6c;var _0x215d19;return db[_0x5beb('0x24')][_0x5beb('0x52')]({'where':{'id':_0xe7aab9[_0x5beb('0x29')]['id']}})[_0x5beb('0x16')](handleEntityNotFound(_0xa459de,null))['then'](function(_0x5319e4){if(_0x5319e4){_0x143f6c=_0x5319e4;_0x1609c1[_0x5beb('0x2a')]=_[_0x5beb('0x2c')](db['Team']['rawAttributes']);_0x1609c1[_0x5beb('0x26')]=_['keys'](_0xe7aab9['query']);_0x1609c1[_0x5beb('0x41')]=_['intersection'](_0x1609c1[_0x5beb('0x2a')],_0x1609c1[_0x5beb('0x26')]);_0x563fba[_0x5beb('0x2e')]=_[_0x5beb('0x2d')](_0x1609c1['model'],qs[_0x5beb('0x2f')](_0xe7aab9['query'][_0x5beb('0x2f')]));_0x563fba[_0x5beb('0x2e')]=_0x563fba['attributes']['length']?_0x563fba[_0x5beb('0x2e')]:_0x1609c1[_0x5beb('0x2a')];_0x563fba[_0x5beb('0x43')]=qs[_0x5beb('0x44')](_0xe7aab9['query'][_0x5beb('0x44')]);_0x563fba[_0x5beb('0x23')]=qs['filters'](_[_0x5beb('0x45')](_0xe7aab9[_0x5beb('0x26')],_0x1609c1[_0x5beb('0x41')]));if(_0xe7aab9[_0x5beb('0x26')][_0x5beb('0x46')]){_0x563fba[_0x5beb('0x23')]=_['merge'](_0x563fba[_0x5beb('0x23')],{'$or':_[_0x5beb('0x1f')](_0x563fba[_0x5beb('0x2e')],function(_0x4d028d){var _0x498a4d={};_0x498a4d[_0x4d028d]={'$like':'%'+_0xe7aab9['query'][_0x5beb('0x46')]+'%'};return _0x498a4d;})});}_0x563fba=_[_0x5beb('0x32')]({},_0x563fba,_0xe7aab9[_0x5beb('0x47')]);return _0x143f6c['getTeams'](_0x563fba);}})[_0x5beb('0x16')](function(_0x3c050e){if(_0x3c050e){_0x215d19=_0x3c050e[_0x5beb('0x30')];if(!_0xe7aab9['query'][_0x5beb('0x42')](_0x5beb('0x53'))){_0x563fba[_0x5beb('0x10')]=qs[_0x5beb('0x10')](_0xe7aab9[_0x5beb('0x26')]['limit']);_0x563fba[_0x5beb('0x11')]=qs['offset'](_0xe7aab9[_0x5beb('0x26')][_0x5beb('0x11')]);}return _0x143f6c[_0x5beb('0x54')](_0x563fba);}})[_0x5beb('0x16')](function(_0x5a5afb){if(_0x5a5afb){return _0x5a5afb?{'count':_0x215d19,'rows':_0x5a5afb}:null;}})[_0x5beb('0x16')](respondWithResult(_0xa459de,null))[_0x5beb('0x33')](handleError(_0xa459de,null));};exports[_0x5beb('0x55')]=function(_0xdf409a,_0x4a90d8){var _0x38fd27=_0xdf409a['body'][_0x5beb('0x56')];return db[_0x5beb('0x57')][_0x5beb('0x27')]({'where':{'id':_0x38fd27},'attributes':['id'],'include':[{'model':db[_0x5beb('0x48')],'as':'Agents','attributes':['id','name',_0x5beb('0x58'),_0x5beb('0x59'),_0x5beb('0x5a')],'raw':!![]}]})[_0x5beb('0x16')](function(_0x4c98a0){if(_0x4c98a0){var _0x37bb3b=_[_0x5beb('0x5b')](_0x4c98a0,function(_0x1a6f87){var _0x32089d=_0x1a6f87[_0x5beb('0x18')]({'plain':!![]});return _0x32089d[_0x5beb('0x5c')];});return db[_0x5beb('0x24')]['find']({'where':{'id':_0xdf409a[_0x5beb('0x29')]['id']}})[_0x5beb('0x16')](function(_0x49b7e3){return db[_0x5beb('0x5d')][_0x5beb('0x5e')](function(_0x36dc20){return _0x49b7e3['addTeams'](_0x38fd27,{'transaction':_0x36dc20})[_0x5beb('0x16')](function(){return BPromise[_0x5beb('0x5f')](_0x37bb3b,function(_0x44c435){return db[_0x5beb('0x40')][_0x5beb('0x60')]({'where':{'UserId':_0x44c435['id'],'ChatQueueId':_0xdf409a[_0x5beb('0x29')]['id']},'transaction':_0x36dc20});});})['then'](function(){_0x37bb3b[_0x5beb('0x61')](function(_0x34cce1){socket['emit'](_0x5beb('0x62'),{'UserId':_0x34cce1['id'],'ChatQueueId':_0x49b7e3['id']});});});});});}})[_0x5beb('0x16')](respondWithStatusCode(_0x4a90d8,null))[_0x5beb('0x33')](handleError(_0x4a90d8,null));};exports[_0x5beb('0x63')]=function(_0x4c2dff,_0x4ca7b8){return db[_0x5beb('0x57')][_0x5beb('0x27')]({'where':{'id':_0x4c2dff[_0x5beb('0x26')][_0x5beb('0x56')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4ca7b8,null))[_0x5beb('0x16')](function(_0x139014){var _0x3b7378=_[_0x5beb('0x1f')](_0x139014,'id');var _0xd2ea68=[];var _0x571d82=[];var _0x1af8ec=squel[_0x5beb('0x64')]();_0x1af8ec[_0x5beb('0x65')](_0x5beb('0x66'))['from'](_0x5beb('0x67'),'tq')[_0x5beb('0x68')](_0x5beb('0x69'),'ut',_0x5beb('0x6a'))[_0x5beb('0x23')](_0x5beb('0x6b'),_0x4c2dff[_0x5beb('0x29')]['id']);for(var _0x36b04c=0x0;_0x36b04c<_0x139014[_0x5beb('0x30')];_0x36b04c+=0x1){let _0x7eef0f=_0x139014[_0x36b04c];for(var _0x2b2d70=0x0;_0x2b2d70<_0x7eef0f[_0x5beb('0x5c')]['length'];_0x2b2d70+=0x1){let _0x95bb8d=_0x7eef0f['Agents'][_0x2b2d70];var _0x19c3be=_0x1af8ec[_0x5beb('0x6c')]();_0x19c3be[_0x5beb('0x23')](_0x5beb('0x6d'),_0x95bb8d['id']);_0x571d82[_0x5beb('0x6e')](db[_0x5beb('0x5d')]['query'](_0x19c3be[_0x5beb('0x6f')](),{'type':db[_0x5beb('0x5d')][_0x5beb('0x70')]['SELECT']})[_0x5beb('0x16')](function(_0x178a43){if(_0x178a43[_0x5beb('0x30')]===0x1){return _0x95bb8d['id'];}else{var _0x4d1eed=_[_0x5beb('0x71')](_[_0x5beb('0x1f')](_0x178a43,'TeamId'),function(_0x467e83){return _['includes'](_0x3b7378,_0x467e83);});if(_0x4d1eed){return _0x95bb8d['id'];}}}));}}return BPromise['all'](_0x571d82)[_0x5beb('0x16')](function(_0x5f4d2b){_0xd2ea68=_(_0xd2ea68)[_0x5beb('0x72')](_0x5f4d2b)['compact']()['value']();return db[_0x5beb('0x24')][_0x5beb('0x3a')]({'where':{'id':_0x4c2dff['params']['id']}})[_0x5beb('0x16')](function(_0x32d860){return db[_0x5beb('0x5d')][_0x5beb('0x5e')](function(_0x2752bc){return _0x32d860[_0x5beb('0x63')](_0x4c2dff[_0x5beb('0x26')][_0x5beb('0x56')],{'transaction':_0x2752bc})[_0x5beb('0x16')](function(){if(!_['isEmpty'](_0xd2ea68)){return _0x32d860[_0x5beb('0x73')](_0xd2ea68,{'transaction':_0x2752bc});}})[_0x5beb('0x16')](function(){_0xd2ea68[_0x5beb('0x61')](function(_0x3b16f6){socket['emit'](_0x5beb('0x74'),{'UserId':_0x3b16f6,'ChatQueueId':_0x32d860['id']});});});});});});})[_0x5beb('0x16')](respondWithStatusCode(_0x4ca7b8,null))[_0x5beb('0x33')](handleError(_0x4ca7b8,null));};exports['addAgents']=function(_0x516c36,_0x5ed3d1){return db[_0x5beb('0x24')][_0x5beb('0x3a')]({'where':{'id':_0x516c36[_0x5beb('0x29')]['id']}})[_0x5beb('0x16')](handleEntityNotFound(_0x5ed3d1,null))[_0x5beb('0x16')](function(_0x33137d){if(_0x33137d){return _0x33137d['addAgents'](_0x516c36['body'][_0x5beb('0x56')],_[_0x5beb('0x75')](_0x516c36[_0x5beb('0x35')],[_0x5beb('0x56'),'id'])||{})[_0x5beb('0x76')](function(_0x35db13){for(var _0x432376=0x0;_0x432376<_0x516c36[_0x5beb('0x35')][_0x5beb('0x56')][_0x5beb('0x30')];_0x432376+=0x1){socket[_0x5beb('0x77')](_0x5beb('0x62'),{'UserId':Number(_0x516c36[_0x5beb('0x35')][_0x5beb('0x56')][_0x432376]),'ChatQueueId':Number(_0x516c36[_0x5beb('0x29')]['id'])});}return _0x35db13;});}})['then'](respondWithResult(_0x5ed3d1,null))['catch'](handleError(_0x5ed3d1,null));};exports[_0x5beb('0x73')]=function(_0x1b6f99,_0x280303){return db[_0x5beb('0x24')][_0x5beb('0x3a')]({'where':{'id':_0x1b6f99[_0x5beb('0x29')]['id']}})[_0x5beb('0x16')](handleEntityNotFound(_0x280303,null))[_0x5beb('0x16')](function(_0x32aff9){if(_0x32aff9){return _0x32aff9[_0x5beb('0x73')](_0x1b6f99[_0x5beb('0x26')][_0x5beb('0x56')])[_0x5beb('0x16')](function(){if(_[_0x5beb('0x78')](_0x1b6f99[_0x5beb('0x26')][_0x5beb('0x56')])){for(var _0x427b27=0x0;_0x427b27<_0x1b6f99[_0x5beb('0x26')][_0x5beb('0x56')][_0x5beb('0x30')];_0x427b27+=0x1){socket['emit'](_0x5beb('0x74'),{'UserId':Number(_0x1b6f99[_0x5beb('0x26')][_0x5beb('0x56')][_0x427b27]),'ChatQueueId':Number(_0x1b6f99[_0x5beb('0x29')]['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x1b6f99[_0x5beb('0x26')][_0x5beb('0x56')]),'ChatQueueId':Number(_0x1b6f99[_0x5beb('0x29')]['id'])});}});}})['then'](respondWithStatusCode(_0x280303,null))[_0x5beb('0x33')](handleError(_0x280303,null));};exports[_0x5beb('0x79')]=function(_0x365797,_0x51aaeb){var _0x3a32c9={};var _0x4f72d2={};var _0x35ee5b;var _0x152c08;return db[_0x5beb('0x24')][_0x5beb('0x52')]({'where':{'id':_0x365797[_0x5beb('0x29')]['id']}})[_0x5beb('0x16')](handleEntityNotFound(_0x51aaeb,null))[_0x5beb('0x16')](function(_0x56a9b8){if(_0x56a9b8){_0x35ee5b=_0x56a9b8;_0x4f72d2['model']=_[_0x5beb('0x2c')](db[_0x5beb('0x48')][_0x5beb('0x2b')]);_0x4f72d2[_0x5beb('0x26')]=_[_0x5beb('0x2c')](_0x365797[_0x5beb('0x26')]);_0x4f72d2[_0x5beb('0x41')]=_[_0x5beb('0x2d')](_0x4f72d2['model'],_0x4f72d2['query']);_0x3a32c9[_0x5beb('0x2e')]=_['intersection'](_0x4f72d2[_0x5beb('0x2a')],qs['fields'](_0x365797[_0x5beb('0x26')]['fields']));_0x3a32c9[_0x5beb('0x2e')]=_0x3a32c9[_0x5beb('0x2e')]['length']?_0x3a32c9[_0x5beb('0x2e')]:_0x4f72d2[_0x5beb('0x2a')];_0x3a32c9['order']=qs[_0x5beb('0x44')](_0x365797[_0x5beb('0x26')]['sort']);_0x3a32c9[_0x5beb('0x23')]=qs['filters'](_[_0x5beb('0x45')](_0x365797[_0x5beb('0x26')],_0x4f72d2[_0x5beb('0x41')]));if(_0x365797['query'][_0x5beb('0x46')]){_0x3a32c9[_0x5beb('0x23')]=_['merge'](_0x3a32c9['where'],{'$or':_[_0x5beb('0x1f')](_0x3a32c9[_0x5beb('0x2e')],function(_0x4d5a4c){var _0x36b905={};_0x36b905[_0x4d5a4c]={'$like':'%'+_0x365797[_0x5beb('0x26')][_0x5beb('0x46')]+'%'};return _0x36b905;})});}_0x3a32c9=_[_0x5beb('0x32')]({},_0x3a32c9,_0x365797['options']);return _0x35ee5b[_0x5beb('0x79')](_0x3a32c9);}})[_0x5beb('0x16')](function(_0xc5f539){if(_0xc5f539){_0x152c08=_0xc5f539[_0x5beb('0x30')];if(!_0x365797[_0x5beb('0x26')][_0x5beb('0x42')]('nolimit')){_0x3a32c9[_0x5beb('0x10')]=qs[_0x5beb('0x10')](_0x365797[_0x5beb('0x26')]['limit']);_0x3a32c9[_0x5beb('0x11')]=qs[_0x5beb('0x11')](_0x365797[_0x5beb('0x26')]['offset']);}return _0x35ee5b[_0x5beb('0x79')](_0x3a32c9);}})[_0x5beb('0x16')](function(_0x467925){if(_0x467925){return _0x467925?{'count':_0x152c08,'rows':_0x467925}:null;}})[_0x5beb('0x16')](respondWithResult(_0x51aaeb,null))['catch'](handleError(_0x51aaeb,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 4b45edc..a608423 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 _0x2eff=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','remove'];(function(_0x323006,_0x5b327b){var _0x460838=function(_0x2637bb){while(--_0x2637bb){_0x323006['push'](_0x323006['shift']());}};_0x460838(++_0x5b327b);}(_0x2eff,0x176));var _0xf2ef=function(_0x1aca73,_0x446f01){_0x1aca73=_0x1aca73-0x0;var _0x3f06d8=_0x2eff[_0x1aca73];return _0x3f06d8;};'use strict';var EventEmitter=require(_0xf2ef('0x0'));var ChatQueue=require(_0xf2ef('0x1'))['db'][_0xf2ef('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf2ef('0x3')](0x0);var events={'afterCreate':_0xf2ef('0x4'),'afterUpdate':'update','afterDestroy':_0xf2ef('0x5')};function emitEvent(_0x54ad49){return function(_0x45c70d,_0x2ee193,_0x4b7b8a){ChatQueueEvents[_0xf2ef('0x6')](_0x54ad49+':'+_0x45c70d['id'],_0x45c70d);ChatQueueEvents[_0xf2ef('0x6')](_0x54ad49,_0x45c70d);_0x4b7b8a(null);};}for(var e in events){if(events[_0xf2ef('0x7')](e)){var event=events[e];ChatQueue[_0xf2ef('0x8')](e,emitEvent(event));}}module[_0xf2ef('0x9')]=ChatQueueEvents; \ No newline at end of file +var _0x11b7=['remove','emit','hasOwnProperty','setMaxListeners'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x11b7,0x12f));var _0x711b=function(_0x421b62,_0x462715){_0x421b62=_0x421b62-0x0;var _0x1ca612=_0x11b7[_0x421b62];return _0x1ca612;};'use strict';var EventEmitter=require('events');var ChatQueue=require('../../mysqldb')['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x711b('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x711b('0x1')};function emitEvent(_0x35249b){return function(_0x4be832,_0x33d111,_0x2005cf){ChatQueueEvents['emit'](_0x35249b+':'+_0x4be832['id'],_0x4be832);ChatQueueEvents[_0x711b('0x2')](_0x35249b,_0x4be832);_0x2005cf(null);};}for(var e in events){if(events[_0x711b('0x3')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index a8a40c5..0a61438 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 _0x10a4=['bluebird','request-promise','../../config/environment','./chatQueue.attributes','exports','define','chat_queues','lodash','util','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x10a4,0x1e7));var _0x410a=function(_0x384dfd,_0x54bc76){_0x384dfd=_0x384dfd-0x0;var _0x5e232c=_0x10a4[_0x384dfd];return _0x5e232c;};'use strict';var _=require(_0x410a('0x0'));var util=require(_0x410a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x410a('0x2'));var BPromise=require(_0x410a('0x3'));var rp=require(_0x410a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x410a('0x5'));var attributes=require(_0x410a('0x6'));module[_0x410a('0x7')]=function(_0x4edfa3,_0x394ad0){return _0x4edfa3[_0x410a('0x8')]('ChatQueue',attributes,{'tableName':_0x410a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdd2=['ChatQueue','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','define'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xbdd2,0x198));var _0x2bdd=function(_0x38a8a4,_0x4838d1){_0x38a8a4=_0x38a8a4-0x0;var _0x3833d0=_0xbdd2[_0x38a8a4];return _0x3833d0;};'use strict';var _=require('lodash');var util=require(_0x2bdd('0x0'));var logger=require(_0x2bdd('0x1'))('api');var moment=require(_0x2bdd('0x2'));var BPromise=require(_0x2bdd('0x3'));var rp=require(_0x2bdd('0x4'));var fs=require('fs');var path=require(_0x2bdd('0x5'));var rimraf=require(_0x2bdd('0x6'));var config=require(_0x2bdd('0x7'));var attributes=require(_0x2bdd('0x8'));module['exports']=function(_0xc69a54,_0x41b949){return _0xc69a54[_0x2bdd('0x9')](_0x2bdd('0xa'),attributes,{'tableName':'chat_queues','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 bfb1d8f..4edd6f8 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 _0x5464=['localhost','socket.io-emitter','./chatQueue.socket','register','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','error','message','catch','GetChatQueue','ChatQueue','options','where','attributes','limit','include','map','model','find','raw','then','debug','ShowChatQueue','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis'];(function(_0xd95342,_0xb75bf6){var _0x54d694=function(_0x1190c1){while(--_0x1190c1){_0xd95342['push'](_0xd95342['shift']());}};_0x54d694(++_0xb75bf6);}(_0x5464,0x15d));var _0x4546=function(_0x14d554,_0xa46ace){_0x14d554=_0x14d554-0x0;var _0x93b623=_0x5464[_0x14d554];return _0x93b623;};'use strict';var _=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var moment=require(_0x4546('0x2'));var BPromise=require('bluebird');var rs=require(_0x4546('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4546('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4546('0x5'))(_0x4546('0x6'));var config=require(_0x4546('0x7'));var jayson=require(_0x4546('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x4546('0x9')](config[_0x4546('0xa')],{'host':_0x4546('0xb'),'port':0x18eb});var socket=require(_0x4546('0xc'))(new Redis(config[_0x4546('0xa')]));require(_0x4546('0xd'))[_0x4546('0xe')](socket);function respondWithRpcPromise(_0x430b2e,_0x383bf2,_0x4ac723){return new BPromise(function(_0x1dd3f5,_0x8a15e2){return client[_0x4546('0xf')](_0x430b2e,_0x4ac723)['then'](function(_0x1f82c9){logger[_0x4546('0x10')](_0x4546('0x11'),_0x383bf2,_0x4546('0x12'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x383bf2,_0x4546('0x12'),JSON['stringify'](_0x1f82c9));if(_0x1f82c9['error']){if(_0x1f82c9['error']['code']===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x383bf2,_0x1f82c9[_0x4546('0x13')]['message']);return _0x8a15e2(_0x1f82c9[_0x4546('0x13')]['message']);}logger[_0x4546('0x13')]('ChatQueue,\x20%s,\x20%s',_0x383bf2,_0x1f82c9[_0x4546('0x13')][_0x4546('0x14')]);return _0x1dd3f5(_0x1f82c9[_0x4546('0x13')][_0x4546('0x14')]);}else{logger[_0x4546('0x10')](_0x4546('0x11'),_0x383bf2,'request\x20sent');_0x1dd3f5(_0x1f82c9['result']['message']);}})[_0x4546('0x15')](function(_0x39f552){logger[_0x4546('0x13')](_0x4546('0x11'),_0x383bf2,_0x39f552);_0x8a15e2(_0x39f552);});});}exports[_0x4546('0x16')]=function(_0x337a44){var _0x3ec009=this;return new Promise(function(_0x2f6329,_0x4034a5){return db[_0x4546('0x17')]['findAll']({'raw':_0x337a44[_0x4546('0x18')]?_0x337a44[_0x4546('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x337a44[_0x4546('0x18')]?_0x337a44[_0x4546('0x18')][_0x4546('0x19')]||null:null,'attributes':_0x337a44[_0x4546('0x18')]?_0x337a44[_0x4546('0x18')][_0x4546('0x1a')]||null:null,'limit':_0x337a44['options']?_0x337a44[_0x4546('0x18')][_0x4546('0x1b')]||null:null,'include':_0x337a44['options']?_0x337a44[_0x4546('0x18')][_0x4546('0x1c')]?_[_0x4546('0x1d')](_0x337a44[_0x4546('0x18')][_0x4546('0x1c')],function(_0x53ae5e){return{'model':db[_0x53ae5e[_0x4546('0x1e')]],'as':_0x53ae5e['as'],'attributes':_0x53ae5e[_0x4546('0x1a')],'include':_0x53ae5e[_0x4546('0x1c')]?_['map'](_0x53ae5e['include'],function(_0x43740e){return{'model':db[_0x43740e[_0x4546('0x1e')]],'as':_0x43740e['as'],'attributes':_0x43740e[_0x4546('0x1a')],'include':_0x43740e[_0x4546('0x1c')]?_[_0x4546('0x1d')](_0x43740e[_0x4546('0x1c')],function(_0xcea7da){return{'model':db[_0xcea7da['model']],'as':_0xcea7da['as'],'attributes':_0xcea7da[_0x4546('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a2d12){logger[_0x4546('0x10')]('GetChatQueue',_0x337a44);logger['debug'](_0x4546('0x16'),_0x337a44,JSON['stringify'](_0x3a2d12));_0x2f6329(_0x3a2d12);})[_0x4546('0x15')](function(_0x58b69){logger['error']('GetChatQueue',_0x58b69[_0x4546('0x14')],_0x337a44);_0x4034a5(_0x3ec009[_0x4546('0x13')](0x1f4,_0x58b69[_0x4546('0x14')]));});});};exports['ShowChatQueue']=function(_0x10db2e){var _0x2c8e44=this;return new Promise(function(_0x540983,_0xad1b9c){return db['ChatQueue'][_0x4546('0x1f')]({'raw':_0x10db2e[_0x4546('0x18')]?_0x10db2e[_0x4546('0x18')][_0x4546('0x20')]===undefined?!![]:![]:!![],'where':_0x10db2e['options']?_0x10db2e[_0x4546('0x18')][_0x4546('0x19')]||null:null,'attributes':_0x10db2e[_0x4546('0x18')]?_0x10db2e[_0x4546('0x18')][_0x4546('0x1a')]||null:null,'include':_0x10db2e[_0x4546('0x18')]?_0x10db2e['options'][_0x4546('0x1c')]?_[_0x4546('0x1d')](_0x10db2e['options']['include'],function(_0x3eb8e8){return{'model':db[_0x3eb8e8[_0x4546('0x1e')]],'as':_0x3eb8e8['as'],'attributes':_0x3eb8e8['attributes'],'include':_0x3eb8e8[_0x4546('0x1c')]?_[_0x4546('0x1d')](_0x3eb8e8['include'],function(_0x5acdc0){return{'model':db[_0x5acdc0[_0x4546('0x1e')]],'as':_0x5acdc0['as'],'attributes':_0x5acdc0[_0x4546('0x1a')],'include':_0x5acdc0[_0x4546('0x1c')]?_[_0x4546('0x1d')](_0x5acdc0[_0x4546('0x1c')],function(_0x24ae41){return{'model':db[_0x24ae41['model']],'as':_0x24ae41['as'],'attributes':_0x24ae41[_0x4546('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4546('0x21')](function(_0x4a70f5){logger[_0x4546('0x10')]('ShowChatQueue',_0x10db2e);logger[_0x4546('0x22')](_0x4546('0x23'),_0x10db2e,JSON['stringify'](_0x4a70f5));_0x540983(_0x4a70f5);})['catch'](function(_0x104d56){logger[_0x4546('0x13')](_0x4546('0x23'),_0x104d56['message'],_0x10db2e);_0xad1b9c(_0x2c8e44[_0x4546('0x13')](0x1f4,_0x104d56[_0x4546('0x14')]));});});}; \ No newline at end of file +var _0x6a18=['redis','defaults','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowChatQueue','ChatQueue','find','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x7ff957,_0x3815a2){var _0x53ccf2=function(_0xa1cfb0){while(--_0xa1cfb0){_0x7ff957['push'](_0x7ff957['shift']());}};_0x53ccf2(++_0x3815a2);}(_0x6a18,0x114));var _0x86a1=function(_0x301dce,_0x5c03c4){_0x301dce=_0x301dce-0x0;var _0x494ac3=_0x6a18[_0x301dce];return _0x494ac3;};'use strict';var _=require(_0x86a1('0x0'));var util=require(_0x86a1('0x1'));var moment=require(_0x86a1('0x2'));var BPromise=require(_0x86a1('0x3'));var rs=require(_0x86a1('0x4'));var fs=require('fs');var Redis=require(_0x86a1('0x5'));var db=require(_0x86a1('0x6'))['db'];var utils=require(_0x86a1('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x86a1('0x8'));var jayson=require(_0x86a1('0x9'));var client=jayson[_0x86a1('0xa')]['http']({'port':0x232a});config[_0x86a1('0xb')]=_[_0x86a1('0xc')](config[_0x86a1('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x86a1('0xd'))(new Redis(config[_0x86a1('0xb')]));require(_0x86a1('0xe'))[_0x86a1('0xf')](socket);function respondWithRpcPromise(_0x46a079,_0x316957,_0x54b8b0){return new BPromise(function(_0x195a0d,_0x3946f2){return client[_0x86a1('0x10')](_0x46a079,_0x54b8b0)[_0x86a1('0x11')](function(_0xf2ddeb){logger[_0x86a1('0x12')](_0x86a1('0x13'),_0x316957,_0x86a1('0x14'));logger['debug'](_0x86a1('0x15'),_0x316957,_0x86a1('0x14'),JSON[_0x86a1('0x16')](_0xf2ddeb));if(_0xf2ddeb['error']){if(_0xf2ddeb[_0x86a1('0x17')][_0x86a1('0x18')]===0x1f4){logger[_0x86a1('0x17')](_0x86a1('0x13'),_0x316957,_0xf2ddeb[_0x86a1('0x17')]['message']);return _0x3946f2(_0xf2ddeb[_0x86a1('0x17')][_0x86a1('0x19')]);}logger['error'](_0x86a1('0x13'),_0x316957,_0xf2ddeb[_0x86a1('0x17')][_0x86a1('0x19')]);return _0x195a0d(_0xf2ddeb[_0x86a1('0x17')][_0x86a1('0x19')]);}else{logger[_0x86a1('0x12')](_0x86a1('0x13'),_0x316957,'request\x20sent');_0x195a0d(_0xf2ddeb['result']['message']);}})[_0x86a1('0x1a')](function(_0x2fe33b){logger['error'](_0x86a1('0x13'),_0x316957,_0x2fe33b);_0x3946f2(_0x2fe33b);});});}exports[_0x86a1('0x1b')]=function(_0x1ef692){var _0x7f88ba=this;return new Promise(function(_0x440a4d,_0x54478a){return db['ChatQueue'][_0x86a1('0x1c')]({'raw':_0x1ef692[_0x86a1('0x1d')]?_0x1ef692[_0x86a1('0x1d')][_0x86a1('0x1e')]===undefined?!![]:![]:!![],'where':_0x1ef692['options']?_0x1ef692[_0x86a1('0x1d')][_0x86a1('0x1f')]||null:null,'attributes':_0x1ef692['options']?_0x1ef692[_0x86a1('0x1d')][_0x86a1('0x20')]||null:null,'limit':_0x1ef692[_0x86a1('0x1d')]?_0x1ef692[_0x86a1('0x1d')][_0x86a1('0x21')]||null:null,'include':_0x1ef692['options']?_0x1ef692[_0x86a1('0x1d')][_0x86a1('0x22')]?_['map'](_0x1ef692['options'][_0x86a1('0x22')],function(_0x38c4cb){return{'model':db[_0x38c4cb['model']],'as':_0x38c4cb['as'],'attributes':_0x38c4cb[_0x86a1('0x20')],'include':_0x38c4cb[_0x86a1('0x22')]?_[_0x86a1('0x23')](_0x38c4cb[_0x86a1('0x22')],function(_0x48ccb7){return{'model':db[_0x48ccb7[_0x86a1('0x24')]],'as':_0x48ccb7['as'],'attributes':_0x48ccb7['attributes'],'include':_0x48ccb7[_0x86a1('0x22')]?_[_0x86a1('0x23')](_0x48ccb7[_0x86a1('0x22')],function(_0x2676f5){return{'model':db[_0x2676f5[_0x86a1('0x24')]],'as':_0x2676f5['as'],'attributes':_0x2676f5[_0x86a1('0x20')]};}):[]};}):[]};}):[]:[]})[_0x86a1('0x11')](function(_0x2f9cdc){logger[_0x86a1('0x12')](_0x86a1('0x1b'),_0x1ef692);logger['debug'](_0x86a1('0x1b'),_0x1ef692,JSON[_0x86a1('0x16')](_0x2f9cdc));_0x440a4d(_0x2f9cdc);})[_0x86a1('0x1a')](function(_0x5c39d7){logger[_0x86a1('0x17')](_0x86a1('0x1b'),_0x5c39d7[_0x86a1('0x19')],_0x1ef692);_0x54478a(_0x7f88ba[_0x86a1('0x17')](0x1f4,_0x5c39d7['message']));});});};exports[_0x86a1('0x25')]=function(_0xc88fc8){var _0x565e70=this;return new Promise(function(_0x3f69ce,_0x25e119){return db[_0x86a1('0x26')][_0x86a1('0x27')]({'raw':_0xc88fc8[_0x86a1('0x1d')]?_0xc88fc8['options'][_0x86a1('0x1e')]===undefined?!![]:![]:!![],'where':_0xc88fc8['options']?_0xc88fc8[_0x86a1('0x1d')]['where']||null:null,'attributes':_0xc88fc8[_0x86a1('0x1d')]?_0xc88fc8[_0x86a1('0x1d')][_0x86a1('0x20')]||null:null,'include':_0xc88fc8[_0x86a1('0x1d')]?_0xc88fc8['options']['include']?_[_0x86a1('0x23')](_0xc88fc8[_0x86a1('0x1d')][_0x86a1('0x22')],function(_0x49baa8){return{'model':db[_0x49baa8[_0x86a1('0x24')]],'as':_0x49baa8['as'],'attributes':_0x49baa8['attributes'],'include':_0x49baa8[_0x86a1('0x22')]?_[_0x86a1('0x23')](_0x49baa8[_0x86a1('0x22')],function(_0x2849f9){return{'model':db[_0x2849f9['model']],'as':_0x2849f9['as'],'attributes':_0x2849f9[_0x86a1('0x20')],'include':_0x2849f9['include']?_[_0x86a1('0x23')](_0x2849f9[_0x86a1('0x22')],function(_0x14898c){return{'model':db[_0x14898c[_0x86a1('0x24')]],'as':_0x14898c['as'],'attributes':_0x14898c[_0x86a1('0x20')]};}):[]};}):[]};}):[]:[]})[_0x86a1('0x11')](function(_0x3194ff){logger['info']('ShowChatQueue',_0xc88fc8);logger[_0x86a1('0x28')](_0x86a1('0x25'),_0xc88fc8,JSON[_0x86a1('0x16')](_0x3194ff));_0x3f69ce(_0x3194ff);})[_0x86a1('0x1a')](function(_0x527926){logger['error']('ShowChatQueue',_0x527926[_0x86a1('0x19')],_0xc88fc8);_0x25e119(_0x565e70[_0x86a1('0x17')](0x1f4,_0x527926[_0x86a1('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index a158c01..7713ed4 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 _0x0faf=['update','emit','removeListener','length','chatQueue:','./chatQueue.events','remove'];(function(_0x4ffa64,_0x271035){var _0x5da001=function(_0x7d1940){while(--_0x7d1940){_0x4ffa64['push'](_0x4ffa64['shift']());}};_0x5da001(++_0x271035);}(_0x0faf,0x132));var _0xf0fa=function(_0x16e0f5,_0x4ec0f3){_0x16e0f5=_0x16e0f5-0x0;var _0x4839d5=_0x0faf[_0x16e0f5];return _0x4839d5;};'use strict';var ChatQueueEvents=require(_0xf0fa('0x0'));var events=['save',_0xf0fa('0x1'),_0xf0fa('0x2')];function createListener(_0x2c6207,_0x35a260){return function(_0xccb93e){_0x35a260[_0xf0fa('0x3')](_0x2c6207,_0xccb93e);};}function removeListener(_0x515b12,_0xc83253){return function(){ChatQueueEvents[_0xf0fa('0x4')](_0x515b12,_0xc83253);};}exports['register']=function(_0x3637a3){for(var _0x44ffa0=0x0,_0x25b5c4=events[_0xf0fa('0x5')];_0x44ffa0<_0x25b5c4;_0x44ffa0++){var _0x2db1d9=events[_0x44ffa0];var _0x587865=createListener(_0xf0fa('0x6')+_0x2db1d9,_0x3637a3);ChatQueueEvents['on'](_0x2db1d9,_0x587865);}}; \ No newline at end of file +var _0x2d17=['update','emit','register','chatQueue:','./chatQueue.events','save'];(function(_0xbdd366,_0x1f09f5){var _0x53a53e=function(_0x10782b){while(--_0x10782b){_0xbdd366['push'](_0xbdd366['shift']());}};_0x53a53e(++_0x1f09f5);}(_0x2d17,0x17e));var _0x72d1=function(_0x27c26c,_0x243245){_0x27c26c=_0x27c26c-0x0;var _0x3335ec=_0x2d17[_0x27c26c];return _0x3335ec;};'use strict';var ChatQueueEvents=require(_0x72d1('0x0'));var events=[_0x72d1('0x1'),'remove',_0x72d1('0x2')];function createListener(_0x4727f9,_0x531f4e){return function(_0x3687bc){_0x531f4e[_0x72d1('0x3')](_0x4727f9,_0x3687bc);};}function removeListener(_0x55b722,_0x1dd6d8){return function(){ChatQueueEvents['removeListener'](_0x55b722,_0x1dd6d8);};}exports[_0x72d1('0x4')]=function(_0x50f551){for(var _0x139ba0=0x0,_0x239d1f=events['length'];_0x139ba0<_0x239d1f;_0x139ba0++){var _0x477264=events[_0x139ba0];var _0x422f5a=createListener(_0x72d1('0x5')+_0x477264,_0x50f551);ChatQueueEvents['on'](_0x477264,_0x422f5a);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index ebaa03f..874f2ca 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 _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x3097ee,_0x5d0bc8){var _0x40e045=function(_0x5d7fd4){while(--_0x5d7fd4){_0x3097ee['push'](_0x3097ee['shift']());}};_0x40e045(++_0x5d0bc8);}(_0x7217,0x19e));var _0x7721=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7217[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file +var _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x3f571c,_0x532e5c){var _0x4910ad=function(_0x332d43){while(--_0x332d43){_0x3f571c['push'](_0x3f571c['shift']());}};_0x4910ad(++_0x532e5c);}(_0x55ca,0x126));var _0xa55c=function(_0x3891e8,_0x3b6b95){_0x3891e8=_0x3891e8-0x0;var _0xc34c60=_0x55ca[_0x3891e8];return _0xc34c60;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 81a0280..1f8de3e 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 _0xb083=['STRING','DATE','moment','exports'];(function(_0x415c03,_0x3c87b0){var _0x3d51f9=function(_0x282598){while(--_0x282598){_0x415c03['push'](_0x415c03['shift']());}};_0x3d51f9(++_0x3c87b0);}(_0xb083,0xf6));var _0x3b08=function(_0x10e638,_0x3f3263){_0x10e638=_0x10e638-0x0;var _0xb67520=_0xb083[_0x10e638];return _0xb67520;};'use strict';var moment=require(_0x3b08('0x0'));var Sequelize=require('sequelize');module[_0x3b08('0x1')]={'uniqueid':{'type':Sequelize[_0x3b08('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x3b08('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x3b08('0x3')]},'exitAt':{'type':Sequelize[_0x3b08('0x3')]},'reason':{'type':Sequelize[_0x3b08('0x2')]}}; \ No newline at end of file +var _0x1092=['DATE','moment','STRING'];(function(_0x378d7f,_0x4bfe7d){var _0xc01f95=function(_0x30280f){while(--_0x30280f){_0x378d7f['push'](_0x378d7f['shift']());}};_0xc01f95(++_0x4bfe7d);}(_0x1092,0x1ed));var _0x2109=function(_0x2428d5,_0x1bea56){_0x2428d5=_0x2428d5-0x0;var _0x40e112=_0x1092[_0x2428d5];return _0x40e112;};'use strict';var moment=require(_0x2109('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x2109('0x1')]},'joinAt':{'type':Sequelize[_0x2109('0x2')]},'leaveAt':{'type':Sequelize[_0x2109('0x2')]},'acceptAt':{'type':Sequelize[_0x2109('0x2')]},'exitAt':{'type':Sequelize[_0x2109('0x2')]},'reason':{'type':Sequelize[_0x2109('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index c196006..2d8bf61 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 _0xf2e3=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','error','stack','name','send','index','ChatQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','map','VIRTUAL','then','includeAll','include','rows','catch','show','params','create','body','update','destroy','find','describe','eml-format'];(function(_0x15cece,_0x19147f){var _0x182734=function(_0x12c3c1){while(--_0x12c3c1){_0x15cece['push'](_0x15cece['shift']());}};_0x182734(++_0x19147f);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0xf2e3[_0x3740fe];return _0x55492b;};'use strict';var emlformat=require(_0x3f2e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3f2e('0x1'));var jsonpatch=require(_0x3f2e('0x2'));var rp=require(_0x3f2e('0x3'));var moment=require(_0x3f2e('0x4'));var BPromise=require(_0x3f2e('0x5'));var Mustache=require(_0x3f2e('0x6'));var util=require(_0x3f2e('0x7'));var path=require(_0x3f2e('0x8'));var sox=require(_0x3f2e('0x9'));var csv=require('to-csv');var ejs=require(_0x3f2e('0xa'));var fs=require('fs');var fs_extra=require(_0x3f2e('0xb'));var _=require(_0x3f2e('0xc'));var squel=require(_0x3f2e('0xd'));var crypto=require(_0x3f2e('0xe'));var jsforce=require(_0x3f2e('0xf'));var deskjs=require(_0x3f2e('0x10'));var toCsv=require(_0x3f2e('0x11'));var querystring=require(_0x3f2e('0x12'));var Papa=require(_0x3f2e('0x13'));var Redis=require(_0x3f2e('0x14'));var authService=require(_0x3f2e('0x15'));var qs=require(_0x3f2e('0x16'));var as=require(_0x3f2e('0x17'));var hardwareService=require(_0x3f2e('0x18'));var logger=require(_0x3f2e('0x19'))(_0x3f2e('0x1a'));var utils=require(_0x3f2e('0x1b'));var config=require(_0x3f2e('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0x3f2e('0x1d'))['db'];function respondWithStatusCode(_0xaa6ef5,_0x5471f9){_0x5471f9=_0x5471f9||0xcc;return function(_0xe83663){if(_0xe83663){return _0xaa6ef5[_0x3f2e('0x1e')](_0x5471f9);}return _0xaa6ef5[_0x3f2e('0x1f')](_0x5471f9)[_0x3f2e('0x20')]();};}function respondWithResult(_0x3d20d1,_0x57cba7){_0x57cba7=_0x57cba7||0xc8;return function(_0x298080){if(_0x298080){return _0x3d20d1[_0x3f2e('0x1f')](_0x57cba7)[_0x3f2e('0x21')](_0x298080);}};}function respondWithFilteredResult(_0x4f2e38,_0x43f69e){return function(_0x218b44){if(_0x218b44){var _0x17ef58=typeof _0x43f69e[_0x3f2e('0x22')]===_0x3f2e('0x23')&&typeof _0x43f69e[_0x3f2e('0x24')]===_0x3f2e('0x23');var _0x155411=_0x218b44[_0x3f2e('0x25')];var _0xc00add=_0x17ef58?0x0:_0x43f69e[_0x3f2e('0x22')];var _0x5b9989=_0x17ef58?_0x218b44[_0x3f2e('0x25')]:_0x43f69e[_0x3f2e('0x22')]+_0x43f69e[_0x3f2e('0x24')];var _0xbe899c;if(_0x5b9989>=_0x155411){_0x5b9989=_0x155411;_0xbe899c=0xc8;}else{_0xbe899c=0xce;}_0x4f2e38[_0x3f2e('0x1f')](_0xbe899c);return _0x4f2e38['set']('Content-Range',_0xc00add+'-'+_0x5b9989+'/'+_0x155411)[_0x3f2e('0x21')](_0x218b44);}return null;};}function patchUpdates(_0x11f84c){return function(_0x38bbae){try{jsonpatch[_0x3f2e('0x26')](_0x38bbae,_0x11f84c,!![]);}catch(_0x4381e5){return BPromise[_0x3f2e('0x27')](_0x4381e5);}return _0x38bbae['save']();};}function saveUpdates(_0x5a7047,_0xf81165){return function(_0x37dab2){if(_0x37dab2){return _0x37dab2['update'](_0x5a7047)['then'](function(_0x46bb1c){return _0x46bb1c;});}return null;};}function removeEntity(_0x5646f5,_0x1b8c67){return function(_0x401ed9){if(_0x401ed9){return _0x401ed9['destroy']()['then'](function(){_0x5646f5['status'](0xcc)[_0x3f2e('0x20')]();});}};}function handleEntityNotFound(_0x3d7631,_0x4c61d9){return function(_0x11a7cc){if(!_0x11a7cc){_0x3d7631['sendStatus'](0x194);}return _0x11a7cc;};}function handleError(_0x1ad875,_0x598541){_0x598541=_0x598541||0x1f4;return function(_0x2806d0){logger[_0x3f2e('0x28')](_0x2806d0[_0x3f2e('0x29')]);if(_0x2806d0[_0x3f2e('0x2a')]){delete _0x2806d0[_0x3f2e('0x2a')];}_0x1ad875['status'](_0x598541)[_0x3f2e('0x2b')](_0x2806d0);};}exports[_0x3f2e('0x2c')]=function(_0x5eab38,_0x528063){var _0x2b9fda={},_0x1e5db4={},_0x35f421={'count':0x0,'rows':[]};var _0x22e6ad=_['map'](db[_0x3f2e('0x2d')][_0x3f2e('0x2e')],function(_0x37ddfe){return{'name':_0x37ddfe['fieldName'],'type':_0x37ddfe[_0x3f2e('0x2f')][_0x3f2e('0x30')]};});_0x1e5db4[_0x3f2e('0x31')]=_['map'](_0x22e6ad,_0x3f2e('0x2a'));_0x1e5db4[_0x3f2e('0x32')]=_[_0x3f2e('0x33')](_0x5eab38[_0x3f2e('0x32')]);_0x1e5db4[_0x3f2e('0x34')]=_[_0x3f2e('0x35')](_0x1e5db4['model'],_0x1e5db4[_0x3f2e('0x32')]);_0x2b9fda[_0x3f2e('0x36')]=_[_0x3f2e('0x35')](_0x1e5db4[_0x3f2e('0x31')],qs[_0x3f2e('0x37')](_0x5eab38[_0x3f2e('0x32')][_0x3f2e('0x37')]));_0x2b9fda['attributes']=_0x2b9fda[_0x3f2e('0x36')][_0x3f2e('0x38')]?_0x2b9fda[_0x3f2e('0x36')]:_0x1e5db4[_0x3f2e('0x31')];if(!_0x5eab38['query']['hasOwnProperty'](_0x3f2e('0x39'))){_0x2b9fda[_0x3f2e('0x24')]=qs[_0x3f2e('0x24')](_0x5eab38[_0x3f2e('0x32')][_0x3f2e('0x24')]);_0x2b9fda[_0x3f2e('0x22')]=qs[_0x3f2e('0x22')](_0x5eab38[_0x3f2e('0x32')][_0x3f2e('0x22')]);}_0x2b9fda[_0x3f2e('0x3a')]=qs['sort'](_0x5eab38[_0x3f2e('0x32')][_0x3f2e('0x3b')]);_0x2b9fda[_0x3f2e('0x3c')]=qs[_0x3f2e('0x34')](_['pick'](_0x5eab38[_0x3f2e('0x32')],_0x1e5db4[_0x3f2e('0x34')]),_0x22e6ad);if(_0x5eab38[_0x3f2e('0x32')][_0x3f2e('0x3d')]){_0x2b9fda[_0x3f2e('0x3c')]=_[_0x3f2e('0x3e')](_0x2b9fda[_0x3f2e('0x3c')],{'$or':_[_0x3f2e('0x3f')](_0x22e6ad,function(_0x4c5ac2){if(_0x4c5ac2[_0x3f2e('0x2f')]!==_0x3f2e('0x40')){var _0x238b6b={};_0x238b6b[_0x4c5ac2[_0x3f2e('0x2a')]]={'$like':'%'+_0x5eab38['query'][_0x3f2e('0x3d')]+'%'};return _0x238b6b;}})});}_0x2b9fda=_[_0x3f2e('0x3e')]({},_0x2b9fda,_0x5eab38['options']);var _0x3fc694={'where':_0x2b9fda[_0x3f2e('0x3c')]};return db['ChatQueueReport'][_0x3f2e('0x25')](_0x3fc694)[_0x3f2e('0x41')](function(_0x849236){_0x35f421[_0x3f2e('0x25')]=_0x849236;if(_0x5eab38['query'][_0x3f2e('0x42')]){_0x2b9fda[_0x3f2e('0x43')]=[{'all':!![]}];}return db['ChatQueueReport']['findAll'](_0x2b9fda);})[_0x3f2e('0x41')](function(_0x23de01){_0x35f421[_0x3f2e('0x44')]=_0x23de01;return _0x35f421;})['then'](respondWithFilteredResult(_0x528063,_0x2b9fda))[_0x3f2e('0x45')](handleError(_0x528063,null));};exports[_0x3f2e('0x46')]=function(_0x43b35a,_0xe9000a){var _0x24df56={'raw':!![],'where':{'id':_0x43b35a[_0x3f2e('0x47')]['id']}},_0x3668dc={};_0x3668dc[_0x3f2e('0x31')]=_[_0x3f2e('0x33')](db[_0x3f2e('0x2d')]['rawAttributes']);_0x3668dc['query']=_[_0x3f2e('0x33')](_0x43b35a[_0x3f2e('0x32')]);_0x3668dc['filters']=_['intersection'](_0x3668dc[_0x3f2e('0x31')],_0x3668dc[_0x3f2e('0x32')]);_0x24df56[_0x3f2e('0x36')]=_['intersection'](_0x3668dc[_0x3f2e('0x31')],qs[_0x3f2e('0x37')](_0x43b35a[_0x3f2e('0x32')]['fields']));_0x24df56[_0x3f2e('0x36')]=_0x24df56[_0x3f2e('0x36')][_0x3f2e('0x38')]?_0x24df56['attributes']:_0x3668dc[_0x3f2e('0x31')];if(_0x43b35a[_0x3f2e('0x32')][_0x3f2e('0x42')]){_0x24df56['include']=[{'all':!![]}];}_0x24df56=_[_0x3f2e('0x3e')]({},_0x24df56,_0x43b35a['options']);return db[_0x3f2e('0x2d')]['find'](_0x24df56)['then'](handleEntityNotFound(_0xe9000a,null))[_0x3f2e('0x41')](respondWithResult(_0xe9000a,null))[_0x3f2e('0x45')](handleError(_0xe9000a,null));};exports[_0x3f2e('0x48')]=function(_0x3d6fd2,_0x3e7fac){return db['ChatQueueReport']['create'](_0x3d6fd2[_0x3f2e('0x49')],{})[_0x3f2e('0x41')](respondWithResult(_0x3e7fac,0xc9))[_0x3f2e('0x45')](handleError(_0x3e7fac,null));};exports[_0x3f2e('0x4a')]=function(_0x39dbd1,_0xb891b2){if(_0x39dbd1[_0x3f2e('0x49')]['id']){delete _0x39dbd1[_0x3f2e('0x49')]['id'];}return db[_0x3f2e('0x2d')]['find']({'where':{'id':_0x39dbd1['params']['id']}})[_0x3f2e('0x41')](handleEntityNotFound(_0xb891b2,null))['then'](saveUpdates(_0x39dbd1[_0x3f2e('0x49')],null))[_0x3f2e('0x41')](respondWithResult(_0xb891b2,null))[_0x3f2e('0x45')](handleError(_0xb891b2,null));};exports[_0x3f2e('0x4b')]=function(_0x4b6950,_0xd871da){return db['ChatQueueReport'][_0x3f2e('0x4c')]({'where':{'id':_0x4b6950[_0x3f2e('0x47')]['id']}})['then'](handleEntityNotFound(_0xd871da,null))[_0x3f2e('0x41')](removeEntity(_0xd871da,null))['catch'](handleError(_0xd871da,null));};exports[_0x3f2e('0x4d')]=function(_0x336003,_0x9ccf3b){return db['ChatQueueReport'][_0x3f2e('0x4d')]()[_0x3f2e('0x41')](respondWithResult(_0x9ccf3b,null))[_0x3f2e('0x45')](handleError(_0x9ccf3b,null));}; \ No newline at end of file +var _0x9c48=['body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','includeAll','findAll','rows','catch','show','keys','options','find','create'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x9c48,0xa1));var _0x89c4=function(_0x4a2d92,_0x24671f){_0x4a2d92=_0x4a2d92-0x0;var _0x2cf74e=_0x9c48[_0x4a2d92];return _0x2cf74e;};'use strict';var emlformat=require(_0x89c4('0x0'));var rimraf=require(_0x89c4('0x1'));var zipdir=require(_0x89c4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x89c4('0x3'));var moment=require(_0x89c4('0x4'));var BPromise=require(_0x89c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x89c4('0x6'));var sox=require(_0x89c4('0x7'));var csv=require('to-csv');var ejs=require(_0x89c4('0x8'));var fs=require('fs');var fs_extra=require(_0x89c4('0x9'));var _=require(_0x89c4('0xa'));var squel=require(_0x89c4('0xb'));var crypto=require(_0x89c4('0xc'));var jsforce=require(_0x89c4('0xd'));var deskjs=require(_0x89c4('0xe'));var toCsv=require(_0x89c4('0xf'));var querystring=require(_0x89c4('0x10'));var Papa=require(_0x89c4('0x11'));var Redis=require(_0x89c4('0x12'));var authService=require(_0x89c4('0x13'));var qs=require(_0x89c4('0x14'));var as=require(_0x89c4('0x15'));var hardwareService=require(_0x89c4('0x16'));var logger=require(_0x89c4('0x17'))(_0x89c4('0x18'));var utils=require(_0x89c4('0x19'));var config=require(_0x89c4('0x1a'));var licenseUtil=require(_0x89c4('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59516a,_0x58f872){_0x58f872=_0x58f872||0xcc;return function(_0x1d2e9d){if(_0x1d2e9d){return _0x59516a[_0x89c4('0x1c')](_0x58f872);}return _0x59516a[_0x89c4('0x1d')](_0x58f872)[_0x89c4('0x1e')]();};}function respondWithResult(_0x620757,_0x18d0bf){_0x18d0bf=_0x18d0bf||0xc8;return function(_0x84b446){if(_0x84b446){return _0x620757['status'](_0x18d0bf)[_0x89c4('0x1f')](_0x84b446);}};}function respondWithFilteredResult(_0x2bd1d8,_0x5aefe9){return function(_0x4207a5){if(_0x4207a5){var _0x5cd765=typeof _0x5aefe9[_0x89c4('0x20')]===_0x89c4('0x21')&&typeof _0x5aefe9[_0x89c4('0x22')]==='undefined';var _0x41cb06=_0x4207a5['count'];var _0x29342c=_0x5cd765?0x0:_0x5aefe9[_0x89c4('0x20')];var _0x574f49=_0x5cd765?_0x4207a5[_0x89c4('0x23')]:_0x5aefe9['offset']+_0x5aefe9['limit'];var _0x40617b;if(_0x574f49>=_0x41cb06){_0x574f49=_0x41cb06;_0x40617b=0xc8;}else{_0x40617b=0xce;}_0x2bd1d8[_0x89c4('0x1d')](_0x40617b);return _0x2bd1d8[_0x89c4('0x24')]('Content-Range',_0x29342c+'-'+_0x574f49+'/'+_0x41cb06)[_0x89c4('0x1f')](_0x4207a5);}return null;};}function patchUpdates(_0x5b8a37){return function(_0x38e347){try{jsonpatch[_0x89c4('0x25')](_0x38e347,_0x5b8a37,!![]);}catch(_0x55473d){return BPromise[_0x89c4('0x26')](_0x55473d);}return _0x38e347[_0x89c4('0x27')]();};}function saveUpdates(_0x398fc4,_0xc528ee){return function(_0x15ad38){if(_0x15ad38){return _0x15ad38[_0x89c4('0x28')](_0x398fc4)['then'](function(_0x330226){return _0x330226;});}return null;};}function removeEntity(_0x41be54,_0x59e8ee){return function(_0x2e7e6b){if(_0x2e7e6b){return _0x2e7e6b[_0x89c4('0x29')]()[_0x89c4('0x2a')](function(){_0x41be54[_0x89c4('0x1d')](0xcc)[_0x89c4('0x1e')]();});}};}function handleEntityNotFound(_0xa739bd,_0x4f0b19){return function(_0x13d4db){if(!_0x13d4db){_0xa739bd[_0x89c4('0x1c')](0x194);}return _0x13d4db;};}function handleError(_0x1d95f6,_0x1d65c5){_0x1d65c5=_0x1d65c5||0x1f4;return function(_0x17c9f9){logger[_0x89c4('0x2b')](_0x17c9f9[_0x89c4('0x2c')]);if(_0x17c9f9[_0x89c4('0x2d')]){delete _0x17c9f9[_0x89c4('0x2d')];}_0x1d95f6[_0x89c4('0x1d')](_0x1d65c5)[_0x89c4('0x2e')](_0x17c9f9);};}exports[_0x89c4('0x2f')]=function(_0x79e258,_0xba0375){var _0x51fcda={},_0x5e9b35={},_0x271404={'count':0x0,'rows':[]};var _0x5e214e=_[_0x89c4('0x30')](db[_0x89c4('0x31')][_0x89c4('0x32')],function(_0x387e72){return{'name':_0x387e72[_0x89c4('0x33')],'type':_0x387e72[_0x89c4('0x34')][_0x89c4('0x35')]};});_0x5e9b35[_0x89c4('0x36')]=_[_0x89c4('0x30')](_0x5e214e,_0x89c4('0x2d'));_0x5e9b35[_0x89c4('0x37')]=_['keys'](_0x79e258['query']);_0x5e9b35['filters']=_[_0x89c4('0x38')](_0x5e9b35[_0x89c4('0x36')],_0x5e9b35[_0x89c4('0x37')]);_0x51fcda[_0x89c4('0x39')]=_[_0x89c4('0x38')](_0x5e9b35[_0x89c4('0x36')],qs[_0x89c4('0x3a')](_0x79e258[_0x89c4('0x37')][_0x89c4('0x3a')]));_0x51fcda[_0x89c4('0x39')]=_0x51fcda[_0x89c4('0x39')][_0x89c4('0x3b')]?_0x51fcda['attributes']:_0x5e9b35[_0x89c4('0x36')];if(!_0x79e258['query']['hasOwnProperty'](_0x89c4('0x3c'))){_0x51fcda[_0x89c4('0x22')]=qs[_0x89c4('0x22')](_0x79e258[_0x89c4('0x37')][_0x89c4('0x22')]);_0x51fcda['offset']=qs[_0x89c4('0x20')](_0x79e258[_0x89c4('0x37')][_0x89c4('0x20')]);}_0x51fcda['order']=qs[_0x89c4('0x3d')](_0x79e258['query'][_0x89c4('0x3d')]);_0x51fcda[_0x89c4('0x3e')]=qs[_0x89c4('0x3f')](_[_0x89c4('0x40')](_0x79e258[_0x89c4('0x37')],_0x5e9b35[_0x89c4('0x3f')]),_0x5e214e);if(_0x79e258[_0x89c4('0x37')][_0x89c4('0x41')]){_0x51fcda[_0x89c4('0x3e')]=_[_0x89c4('0x42')](_0x51fcda[_0x89c4('0x3e')],{'$or':_[_0x89c4('0x30')](_0x5e214e,function(_0x301b4d){if(_0x301b4d[_0x89c4('0x34')]!=='VIRTUAL'){var _0x15a021={};_0x15a021[_0x301b4d[_0x89c4('0x2d')]]={'$like':'%'+_0x79e258[_0x89c4('0x37')][_0x89c4('0x41')]+'%'};return _0x15a021;}})});}_0x51fcda=_[_0x89c4('0x42')]({},_0x51fcda,_0x79e258['options']);var _0x218da9={'where':_0x51fcda[_0x89c4('0x3e')]};return db['ChatQueueReport'][_0x89c4('0x23')](_0x218da9)[_0x89c4('0x2a')](function(_0x1d29d8){_0x271404[_0x89c4('0x23')]=_0x1d29d8;if(_0x79e258['query'][_0x89c4('0x43')]){_0x51fcda['include']=[{'all':!![]}];}return db['ChatQueueReport'][_0x89c4('0x44')](_0x51fcda);})[_0x89c4('0x2a')](function(_0x2612cd){_0x271404[_0x89c4('0x45')]=_0x2612cd;return _0x271404;})['then'](respondWithFilteredResult(_0xba0375,_0x51fcda))[_0x89c4('0x46')](handleError(_0xba0375,null));};exports[_0x89c4('0x47')]=function(_0x431e17,_0x292247){var _0x969e35={'raw':!![],'where':{'id':_0x431e17['params']['id']}},_0x2bd72a={};_0x2bd72a['model']=_[_0x89c4('0x48')](db[_0x89c4('0x31')][_0x89c4('0x32')]);_0x2bd72a[_0x89c4('0x37')]=_[_0x89c4('0x48')](_0x431e17[_0x89c4('0x37')]);_0x2bd72a[_0x89c4('0x3f')]=_[_0x89c4('0x38')](_0x2bd72a['model'],_0x2bd72a['query']);_0x969e35[_0x89c4('0x39')]=_[_0x89c4('0x38')](_0x2bd72a[_0x89c4('0x36')],qs['fields'](_0x431e17[_0x89c4('0x37')][_0x89c4('0x3a')]));_0x969e35[_0x89c4('0x39')]=_0x969e35[_0x89c4('0x39')][_0x89c4('0x3b')]?_0x969e35[_0x89c4('0x39')]:_0x2bd72a['model'];if(_0x431e17[_0x89c4('0x37')]['includeAll']){_0x969e35['include']=[{'all':!![]}];}_0x969e35=_[_0x89c4('0x42')]({},_0x969e35,_0x431e17[_0x89c4('0x49')]);return db['ChatQueueReport'][_0x89c4('0x4a')](_0x969e35)['then'](handleEntityNotFound(_0x292247,null))['then'](respondWithResult(_0x292247,null))[_0x89c4('0x46')](handleError(_0x292247,null));};exports[_0x89c4('0x4b')]=function(_0xfd7317,_0x2612de){return db[_0x89c4('0x31')][_0x89c4('0x4b')](_0xfd7317[_0x89c4('0x4c')],{})[_0x89c4('0x2a')](respondWithResult(_0x2612de,0xc9))['catch'](handleError(_0x2612de,null));};exports[_0x89c4('0x28')]=function(_0x183115,_0x5e0b35){if(_0x183115[_0x89c4('0x4c')]['id']){delete _0x183115[_0x89c4('0x4c')]['id'];}return db[_0x89c4('0x31')]['find']({'where':{'id':_0x183115[_0x89c4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5e0b35,null))[_0x89c4('0x2a')](saveUpdates(_0x183115[_0x89c4('0x4c')],null))[_0x89c4('0x2a')](respondWithResult(_0x5e0b35,null))[_0x89c4('0x46')](handleError(_0x5e0b35,null));};exports['destroy']=function(_0x2e6bcc,_0x492484){return db['ChatQueueReport'][_0x89c4('0x4a')]({'where':{'id':_0x2e6bcc[_0x89c4('0x4d')]['id']}})[_0x89c4('0x2a')](handleEntityNotFound(_0x492484,null))[_0x89c4('0x2a')](removeEntity(_0x492484,null))[_0x89c4('0x46')](handleError(_0x492484,null));};exports[_0x89c4('0x4e')]=function(_0x3c4bf1,_0xb532ea){return db[_0x89c4('0x31')][_0x89c4('0x4e')]()['then'](respondWithResult(_0xb532ea,null))[_0x89c4('0x46')](handleError(_0xb532ea,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index de108e5..fae59cb 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0xf37717,_0x5afacc){var _0x992835=function(_0x1d9e55){while(--_0x1d9e55){_0xf37717['push'](_0xf37717['shift']());}};_0x992835(++_0x5afacc);}(_0xe706,0xa3));var _0x6e70=function(_0xc23380,_0x18e158){_0xc23380=_0xc23380-0x0;var _0x4b1b26=_0xe706[_0xc23380];return _0x4b1b26;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0x16295e,_0x4a9b05){var _0x2d9e54=function(_0x396291){while(--_0x396291){_0x16295e['push'](_0x16295e['shift']());}};_0x2d9e54(++_0x4a9b05);}(_0xb10b,0x12a));var _0xbb10=function(_0x3c0c9e,_0x3ecdee){_0x3c0c9e=_0x3c0c9e-0x0;var _0x5ba5fe=_0xb10b[_0x3c0c9e];return _0x5ba5fe;};'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 diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 57d5eb7..26fc2d3 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 _0xac11=['jayson/promise','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','options','CreateChatQueueReport','UpdateChatQueueReport','ChatQueueReport','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3a92ea,_0x2e84d2){var _0xfe2066=function(_0xc7c02f){while(--_0xc7c02f){_0x3a92ea['push'](_0x3a92ea['shift']());}};_0xfe2066(++_0x2e84d2);}(_0xac11,0x195));var _0x1ac1=function(_0x207736,_0x45c025){_0x207736=_0x207736-0x0;var _0x8784ce=_0xac11[_0x207736];return _0x8784ce;};'use strict';var _=require(_0x1ac1('0x0'));var util=require(_0x1ac1('0x1'));var moment=require(_0x1ac1('0x2'));var BPromise=require(_0x1ac1('0x3'));var rs=require(_0x1ac1('0x4'));var fs=require('fs');var Redis=require(_0x1ac1('0x5'));var db=require(_0x1ac1('0x6'))['db'];var utils=require(_0x1ac1('0x7'));var logger=require(_0x1ac1('0x8'))(_0x1ac1('0x9'));var config=require(_0x1ac1('0xa'));var jayson=require(_0x1ac1('0xb'));var client=jayson['client'][_0x1ac1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xeec73c,_0x3e922b,_0x5d114e){return new BPromise(function(_0x4a0369,_0x45320c){return client['request'](_0xeec73c,_0x5d114e)[_0x1ac1('0xd')](function(_0x30960b){logger[_0x1ac1('0xe')](_0x1ac1('0xf'),_0x3e922b,_0x1ac1('0x10'));logger[_0x1ac1('0x11')](_0x1ac1('0x12'),_0x3e922b,_0x1ac1('0x10'),JSON[_0x1ac1('0x13')](_0x30960b));if(_0x30960b['error']){if(_0x30960b[_0x1ac1('0x14')][_0x1ac1('0x15')]===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x3e922b,_0x30960b[_0x1ac1('0x14')][_0x1ac1('0x16')]);return _0x45320c(_0x30960b['error'][_0x1ac1('0x16')]);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x3e922b,_0x30960b[_0x1ac1('0x14')][_0x1ac1('0x16')]);return _0x4a0369(_0x30960b[_0x1ac1('0x14')]['message']);}else{logger[_0x1ac1('0xe')](_0x1ac1('0xf'),_0x3e922b,_0x1ac1('0x10'));_0x4a0369(_0x30960b[_0x1ac1('0x17')][_0x1ac1('0x16')]);}})[_0x1ac1('0x18')](function(_0x2b3128){logger[_0x1ac1('0x14')](_0x1ac1('0xf'),_0x3e922b,_0x2b3128);_0x45320c(_0x2b3128);});});}exports['CreateChatQueueReport']=function(_0x4f0126){var _0x2c6975=this;return new Promise(function(_0x2361c0,_0x3fe008){return db['ChatQueueReport'][_0x1ac1('0x19')](_0x4f0126['body'],{'raw':_0x4f0126[_0x1ac1('0x1a')]?_0x4f0126['options']['raw']===undefined?!![]:![]:!![]})[_0x1ac1('0xd')](function(_0x1dc3c3){logger['info']('CreateChatQueueReport',_0x4f0126);logger[_0x1ac1('0x11')](_0x1ac1('0x1b'),_0x4f0126,JSON[_0x1ac1('0x13')](_0x1dc3c3));_0x2361c0(_0x1dc3c3);})[_0x1ac1('0x18')](function(_0x154e6c){logger[_0x1ac1('0x14')]('CreateChatQueueReport',_0x154e6c['message'],_0x4f0126);_0x3fe008(_0x2c6975['error'](0x1f4,_0x154e6c[_0x1ac1('0x16')]));});});};exports[_0x1ac1('0x1c')]=function(_0x2c2bd0){var _0x28b387=this;return new Promise(function(_0x2568d5,_0x42cbc8){return db[_0x1ac1('0x1d')]['update'](_0x2c2bd0['body'],{'raw':_0x2c2bd0[_0x1ac1('0x1a')]?_0x2c2bd0['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c2bd0['options']?_0x2c2bd0[_0x1ac1('0x1a')][_0x1ac1('0x1e')]||null:null,'attributes':_0x2c2bd0['options']?_0x2c2bd0[_0x1ac1('0x1a')][_0x1ac1('0x1f')]||null:null,'limit':_0x2c2bd0[_0x1ac1('0x1a')]?_0x2c2bd0[_0x1ac1('0x1a')]['limit']||null:null})[_0x1ac1('0xd')](function(_0x30d5dc){logger['info'](_0x1ac1('0x1c'),_0x2c2bd0);logger['debug']('UpdateChatQueueReport',_0x2c2bd0,JSON[_0x1ac1('0x13')](_0x30d5dc));_0x2568d5(_0x30d5dc);})[_0x1ac1('0x18')](function(_0x58a930){logger[_0x1ac1('0x14')](_0x1ac1('0x1c'),_0x58a930[_0x1ac1('0x16')],_0x2c2bd0);_0x42cbc8(_0x28b387[_0x1ac1('0x14')](0x1f4,_0x58a930[_0x1ac1('0x16')]));});});}; \ No newline at end of file +var _0xac85=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','catch','CreateChatQueueReport','ChatQueueReport','options','then','UpdateChatQueueReport','update','body','raw','attributes','limit','lodash','util','moment'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0xac85,0xbd));var _0x5ac8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xac85[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5ac8('0x0'));var util=require(_0x5ac8('0x1'));var moment=require(_0x5ac8('0x2'));var BPromise=require(_0x5ac8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ac8('0x4'));var db=require(_0x5ac8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5ac8('0x6'))(_0x5ac8('0x7'));var config=require('../../config/environment');var jayson=require(_0x5ac8('0x8'));var client=jayson[_0x5ac8('0x9')][_0x5ac8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f5e87,_0x7e29c7,_0x3beaa2){return new BPromise(function(_0x3ffe7b,_0xe7a758){return client[_0x5ac8('0xb')](_0x3f5e87,_0x3beaa2)['then'](function(_0x45f93f){logger[_0x5ac8('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x7e29c7,_0x5ac8('0xd'));logger[_0x5ac8('0xe')](_0x5ac8('0xf'),_0x7e29c7,_0x5ac8('0xd'),JSON['stringify'](_0x45f93f));if(_0x45f93f[_0x5ac8('0x10')]){if(_0x45f93f['error'][_0x5ac8('0x11')]===0x1f4){logger[_0x5ac8('0x10')](_0x5ac8('0x12'),_0x7e29c7,_0x45f93f[_0x5ac8('0x10')]['message']);return _0xe7a758(_0x45f93f['error'][_0x5ac8('0x13')]);}logger['error'](_0x5ac8('0x12'),_0x7e29c7,_0x45f93f['error']['message']);return _0x3ffe7b(_0x45f93f[_0x5ac8('0x10')][_0x5ac8('0x13')]);}else{logger[_0x5ac8('0xc')](_0x5ac8('0x12'),_0x7e29c7,_0x5ac8('0xd'));_0x3ffe7b(_0x45f93f[_0x5ac8('0x14')][_0x5ac8('0x13')]);}})[_0x5ac8('0x15')](function(_0x3aca3c){logger[_0x5ac8('0x10')](_0x5ac8('0x12'),_0x7e29c7,_0x3aca3c);_0xe7a758(_0x3aca3c);});});}exports[_0x5ac8('0x16')]=function(_0x195e11){var _0x518142=this;return new Promise(function(_0x1d36e1,_0x5398a0){return db[_0x5ac8('0x17')]['create'](_0x195e11['body'],{'raw':_0x195e11[_0x5ac8('0x18')]?_0x195e11['options']['raw']===undefined?!![]:![]:!![]})[_0x5ac8('0x19')](function(_0x55484a){logger[_0x5ac8('0xc')](_0x5ac8('0x16'),_0x195e11);logger['debug'](_0x5ac8('0x16'),_0x195e11,JSON['stringify'](_0x55484a));_0x1d36e1(_0x55484a);})[_0x5ac8('0x15')](function(_0x39faf0){logger[_0x5ac8('0x10')](_0x5ac8('0x16'),_0x39faf0['message'],_0x195e11);_0x5398a0(_0x518142[_0x5ac8('0x10')](0x1f4,_0x39faf0['message']));});});};exports[_0x5ac8('0x1a')]=function(_0x58ab1b){var _0x19682b=this;return new Promise(function(_0x15e816,_0x5d4a98){return db[_0x5ac8('0x17')][_0x5ac8('0x1b')](_0x58ab1b[_0x5ac8('0x1c')],{'raw':_0x58ab1b['options']?_0x58ab1b[_0x5ac8('0x18')][_0x5ac8('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58ab1b[_0x5ac8('0x18')]?_0x58ab1b[_0x5ac8('0x18')]['where']||null:null,'attributes':_0x58ab1b['options']?_0x58ab1b['options'][_0x5ac8('0x1e')]||null:null,'limit':_0x58ab1b[_0x5ac8('0x18')]?_0x58ab1b[_0x5ac8('0x18')][_0x5ac8('0x1f')]||null:null})[_0x5ac8('0x19')](function(_0x3b8cdf){logger[_0x5ac8('0xc')]('UpdateChatQueueReport',_0x58ab1b);logger['debug'](_0x5ac8('0x1a'),_0x58ab1b,JSON['stringify'](_0x3b8cdf));_0x15e816(_0x3b8cdf);})['catch'](function(_0x16e5f8){logger[_0x5ac8('0x10')](_0x5ac8('0x1a'),_0x16e5f8['message'],_0x58ab1b);_0x5d4a98(_0x19682b[_0x5ac8('0x10')](0x1f4,_0x16e5f8[_0x5ac8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 42c2e30..9264194 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 _0x2a5d=['./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','destroy','multer','util','path','express','Router','../../components/auth/service'];(function(_0x3ee005,_0x3f332c){var _0x52c52b=function(_0xf3169c){while(--_0xf3169c){_0x3ee005['push'](_0x3ee005['shift']());}};_0x52c52b(++_0x3f332c);}(_0x2a5d,0x19a));var _0xd2a5=function(_0x4c2f17,_0x5c6821){_0x4c2f17=_0x4c2f17-0x0;var _0x20919e=_0x2a5d[_0x4c2f17];return _0x20919e;};'use strict';var multer=require(_0xd2a5('0x0'));var util=require(_0xd2a5('0x1'));var path=require(_0xd2a5('0x2'));var timeout=require('connect-timeout');var express=require(_0xd2a5('0x3'));var router=express[_0xd2a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd2a5('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd2a5('0x6'));router[_0xd2a5('0x7')]('/',auth[_0xd2a5('0x8')](),controller[_0xd2a5('0x9')]);router[_0xd2a5('0x7')](_0xd2a5('0xa'),auth[_0xd2a5('0x8')](),controller[_0xd2a5('0xb')]);router['get'](_0xd2a5('0xc'),auth[_0xd2a5('0x8')](),controller[_0xd2a5('0xd')]);router['post']('/',auth[_0xd2a5('0x8')](),controller['create']);router[_0xd2a5('0xe')]('/:id',auth[_0xd2a5('0x8')](),controller['update']);router['delete']('/:id',auth[_0xd2a5('0x8')](),controller[_0xd2a5('0xf')]);module['exports']=router; \ No newline at end of file +var _0x04e6=['describe','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','get','index','/describe','isAuthenticated'];(function(_0x1ffb10,_0x28ce2c){var _0x390ad0=function(_0x1d1c1c){while(--_0x1d1c1c){_0x1ffb10['push'](_0x1ffb10['shift']());}};_0x390ad0(++_0x28ce2c);}(_0x04e6,0xce));var _0x604e=function(_0x47b15f,_0x103e93){_0x47b15f=_0x47b15f-0x0;var _0x55bf25=_0x04e6[_0x47b15f];return _0x55bf25;};'use strict';var multer=require(_0x604e('0x0'));var util=require(_0x604e('0x1'));var path=require(_0x604e('0x2'));var timeout=require(_0x604e('0x3'));var express=require(_0x604e('0x4'));var router=express[_0x604e('0x5')]();var fs_extra=require(_0x604e('0x6'));var auth=require(_0x604e('0x7'));var interaction=require(_0x604e('0x8'));var config=require('../../config/environment');var controller=require(_0x604e('0x9'));router[_0x604e('0xa')]('/',auth['isAuthenticated'](),controller[_0x604e('0xb')]);router[_0x604e('0xa')](_0x604e('0xc'),auth[_0x604e('0xd')](),controller[_0x604e('0xe')]);router['get'](_0x604e('0xf'),auth['isAuthenticated'](),controller[_0x604e('0x10')]);router['post']('/',auth[_0x604e('0xd')](),controller[_0x604e('0x11')]);router[_0x604e('0x12')](_0x604e('0xf'),auth[_0x604e('0xd')](),controller[_0x604e('0x13')]);router[_0x604e('0x14')](_0x604e('0xf'),auth[_0x604e('0xd')](),controller['destroy']);module[_0x604e('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index a8c950c..1f0338d 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x26adda,_0x215619){var _0x72f884=function(_0x16c706){while(--_0x16c706){_0x26adda['push'](_0x26adda['shift']());}};_0x72f884(++_0x215619);}(_0x70e0,0x17b));var _0x070e=function(_0x358ff9,_0x56724b){_0x358ff9=_0x358ff9-0x0;var _0x2a9165=_0x70e0[_0x358ff9];return _0x2a9165;};'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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x78bc74,_0x15985e){var _0x158abb=function(_0x4c15df){while(--_0x4c15df){_0x78bc74['push'](_0x78bc74['shift']());}};_0x158abb(++_0x15985e);}(_0xaa88,0x137));var _0x8aa8=function(_0x45ce08,_0x59dcc7){_0x45ce08=_0x45ce08-0x0;var _0x23dff2=_0xaa88[_0x45ce08];return _0x23dff2;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index dbacac7..4c2249c 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 _0xcede=['ChatTransferReport','fieldName','type','key','model','map','query','keys','filters','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','options','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','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','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','save','update','then','destroy','end','error','name','send'];(function(_0x2aec07,_0xe18447){var _0x59ffb0=function(_0x31fb02){while(--_0x31fb02){_0x2aec07['push'](_0x2aec07['shift']());}};_0x59ffb0(++_0xe18447);}(_0xcede,0x1dc));var _0xeced=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xcede[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeced('0x0'));var zipdir=require(_0xeced('0x1'));var jsonpatch=require(_0xeced('0x2'));var rp=require(_0xeced('0x3'));var moment=require(_0xeced('0x4'));var BPromise=require(_0xeced('0x5'));var Mustache=require('mustache');var util=require(_0xeced('0x6'));var path=require('path');var sox=require(_0xeced('0x7'));var csv=require(_0xeced('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeced('0x9'));var _=require(_0xeced('0xa'));var squel=require(_0xeced('0xb'));var crypto=require(_0xeced('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xeced('0xd'));var toCsv=require('to-csv');var querystring=require(_0xeced('0xe'));var Papa=require(_0xeced('0xf'));var Redis=require(_0xeced('0x10'));var authService=require(_0xeced('0x11'));var qs=require(_0xeced('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xeced('0x13'))(_0xeced('0x14'));var utils=require(_0xeced('0x15'));var config=require(_0xeced('0x16'));var licenseUtil=require(_0xeced('0x17'));var db=require(_0xeced('0x18'))['db'];function respondWithStatusCode(_0x5bdc2c,_0x2df9a2){_0x2df9a2=_0x2df9a2||0xcc;return function(_0x474174){if(_0x474174){return _0x5bdc2c[_0xeced('0x19')](_0x2df9a2);}return _0x5bdc2c['status'](_0x2df9a2)['end']();};}function respondWithResult(_0x44ae16,_0x1a14ff){_0x1a14ff=_0x1a14ff||0xc8;return function(_0x2ecb52){if(_0x2ecb52){return _0x44ae16[_0xeced('0x1a')](_0x1a14ff)['json'](_0x2ecb52);}};}function respondWithFilteredResult(_0x33e5fa,_0x45a0b9){return function(_0x31c1d3){if(_0x31c1d3){var _0x1d3b1e=typeof _0x45a0b9[_0xeced('0x1b')]===_0xeced('0x1c')&&typeof _0x45a0b9[_0xeced('0x1d')]==='undefined';var _0x59f852=_0x31c1d3[_0xeced('0x1e')];var _0x10dadb=_0x1d3b1e?0x0:_0x45a0b9[_0xeced('0x1b')];var _0x2f989b=_0x1d3b1e?_0x31c1d3[_0xeced('0x1e')]:_0x45a0b9[_0xeced('0x1b')]+_0x45a0b9[_0xeced('0x1d')];var _0x480749;if(_0x2f989b>=_0x59f852){_0x2f989b=_0x59f852;_0x480749=0xc8;}else{_0x480749=0xce;}_0x33e5fa[_0xeced('0x1a')](_0x480749);return _0x33e5fa['set'](_0xeced('0x1f'),_0x10dadb+'-'+_0x2f989b+'/'+_0x59f852)[_0xeced('0x20')](_0x31c1d3);}return null;};}function patchUpdates(_0x1293ec){return function(_0x40a9e8){try{jsonpatch[_0xeced('0x21')](_0x40a9e8,_0x1293ec,!![]);}catch(_0x3b1e7c){return BPromise['reject'](_0x3b1e7c);}return _0x40a9e8[_0xeced('0x22')]();};}function saveUpdates(_0xb24f8d,_0x8fa108){return function(_0x20a6b5){if(_0x20a6b5){return _0x20a6b5[_0xeced('0x23')](_0xb24f8d)[_0xeced('0x24')](function(_0x27187a){return _0x27187a;});}return null;};}function removeEntity(_0x281e3a,_0x3000e8){return function(_0x64d68e){if(_0x64d68e){return _0x64d68e[_0xeced('0x25')]()[_0xeced('0x24')](function(){_0x281e3a[_0xeced('0x1a')](0xcc)[_0xeced('0x26')]();});}};}function handleEntityNotFound(_0x5b5e6e,_0x1a2884){return function(_0x27972c){if(!_0x27972c){_0x5b5e6e[_0xeced('0x19')](0x194);}return _0x27972c;};}function handleError(_0x34a0db,_0x190d24){_0x190d24=_0x190d24||0x1f4;return function(_0x17e536){logger[_0xeced('0x27')](_0x17e536['stack']);if(_0x17e536[_0xeced('0x28')]){delete _0x17e536[_0xeced('0x28')];}_0x34a0db[_0xeced('0x1a')](_0x190d24)[_0xeced('0x29')](_0x17e536);};}exports['index']=function(_0x55ec84,_0xaf6810){var _0x2cefcd={},_0xc74cdf={},_0x177eb1={'count':0x0,'rows':[]};var _0x1961e9=_['map'](db[_0xeced('0x2a')]['rawAttributes'],function(_0x341b82){return{'name':_0x341b82[_0xeced('0x2b')],'type':_0x341b82[_0xeced('0x2c')][_0xeced('0x2d')]};});_0xc74cdf[_0xeced('0x2e')]=_[_0xeced('0x2f')](_0x1961e9,_0xeced('0x28'));_0xc74cdf[_0xeced('0x30')]=_[_0xeced('0x31')](_0x55ec84[_0xeced('0x30')]);_0xc74cdf[_0xeced('0x32')]=_['intersection'](_0xc74cdf[_0xeced('0x2e')],_0xc74cdf[_0xeced('0x30')]);_0x2cefcd['attributes']=_['intersection'](_0xc74cdf['model'],qs[_0xeced('0x33')](_0x55ec84[_0xeced('0x30')][_0xeced('0x33')]));_0x2cefcd[_0xeced('0x34')]=_0x2cefcd[_0xeced('0x34')][_0xeced('0x35')]?_0x2cefcd[_0xeced('0x34')]:_0xc74cdf[_0xeced('0x2e')];if(!_0x55ec84['query'][_0xeced('0x36')]('nolimit')){_0x2cefcd[_0xeced('0x1d')]=qs[_0xeced('0x1d')](_0x55ec84[_0xeced('0x30')]['limit']);_0x2cefcd[_0xeced('0x1b')]=qs[_0xeced('0x1b')](_0x55ec84[_0xeced('0x30')][_0xeced('0x1b')]);}_0x2cefcd['order']=qs[_0xeced('0x37')](_0x55ec84[_0xeced('0x30')][_0xeced('0x37')]);_0x2cefcd[_0xeced('0x38')]=qs[_0xeced('0x32')](_[_0xeced('0x39')](_0x55ec84[_0xeced('0x30')],_0xc74cdf[_0xeced('0x32')]),_0x1961e9);if(_0x55ec84[_0xeced('0x30')][_0xeced('0x3a')]){_0x2cefcd['where']=_[_0xeced('0x3b')](_0x2cefcd[_0xeced('0x38')],{'$or':_[_0xeced('0x2f')](_0x1961e9,function(_0x2de84f){if(_0x2de84f['type']!=='VIRTUAL'){var _0x171c39={};_0x171c39[_0x2de84f['name']]={'$like':'%'+_0x55ec84['query'][_0xeced('0x3a')]+'%'};return _0x171c39;}})});}_0x2cefcd=_['merge']({},_0x2cefcd,_0x55ec84['options']);var _0x112909={'where':_0x2cefcd['where']};return db['ChatTransferReport'][_0xeced('0x1e')](_0x112909)['then'](function(_0x550bcd){_0x177eb1[_0xeced('0x1e')]=_0x550bcd;if(_0x55ec84['query'][_0xeced('0x3c')]){_0x2cefcd[_0xeced('0x3d')]=[{'all':!![]}];}return db[_0xeced('0x2a')][_0xeced('0x3e')](_0x2cefcd);})['then'](function(_0x189a8a){_0x177eb1[_0xeced('0x3f')]=_0x189a8a;return _0x177eb1;})['then'](respondWithFilteredResult(_0xaf6810,_0x2cefcd))[_0xeced('0x40')](handleError(_0xaf6810,null));};exports[_0xeced('0x41')]=function(_0x110fc8,_0xc9cbbf){var _0x446ec1={'raw':!![],'where':{'id':_0x110fc8[_0xeced('0x42')]['id']}},_0x1675a0={};_0x1675a0[_0xeced('0x2e')]=_[_0xeced('0x31')](db['ChatTransferReport'][_0xeced('0x43')]);_0x1675a0[_0xeced('0x30')]=_[_0xeced('0x31')](_0x110fc8[_0xeced('0x30')]);_0x1675a0[_0xeced('0x32')]=_[_0xeced('0x44')](_0x1675a0[_0xeced('0x2e')],_0x1675a0[_0xeced('0x30')]);_0x446ec1[_0xeced('0x34')]=_['intersection'](_0x1675a0[_0xeced('0x2e')],qs[_0xeced('0x33')](_0x110fc8['query'][_0xeced('0x33')]));_0x446ec1[_0xeced('0x34')]=_0x446ec1[_0xeced('0x34')][_0xeced('0x35')]?_0x446ec1[_0xeced('0x34')]:_0x1675a0[_0xeced('0x2e')];if(_0x110fc8[_0xeced('0x30')][_0xeced('0x3c')]){_0x446ec1[_0xeced('0x3d')]=[{'all':!![]}];}_0x446ec1=_[_0xeced('0x3b')]({},_0x446ec1,_0x110fc8[_0xeced('0x45')]);return db['ChatTransferReport']['find'](_0x446ec1)[_0xeced('0x24')](handleEntityNotFound(_0xc9cbbf,null))[_0xeced('0x24')](respondWithResult(_0xc9cbbf,null))['catch'](handleError(_0xc9cbbf,null));};exports[_0xeced('0x46')]=function(_0x385781,_0xc2747f){return db[_0xeced('0x2a')]['create'](_0x385781[_0xeced('0x47')],{})[_0xeced('0x24')](respondWithResult(_0xc2747f,0xc9))[_0xeced('0x40')](handleError(_0xc2747f,null));};exports['update']=function(_0x4f13a8,_0x426622){if(_0x4f13a8[_0xeced('0x47')]['id']){delete _0x4f13a8[_0xeced('0x47')]['id'];}return db[_0xeced('0x2a')]['find']({'where':{'id':_0x4f13a8[_0xeced('0x42')]['id']}})[_0xeced('0x24')](handleEntityNotFound(_0x426622,null))[_0xeced('0x24')](saveUpdates(_0x4f13a8['body'],null))[_0xeced('0x24')](respondWithResult(_0x426622,null))[_0xeced('0x40')](handleError(_0x426622,null));};exports[_0xeced('0x25')]=function(_0x49d788,_0x140717){return db[_0xeced('0x2a')][_0xeced('0x48')]({'where':{'id':_0x49d788[_0xeced('0x42')]['id']}})[_0xeced('0x24')](handleEntityNotFound(_0x140717,null))[_0xeced('0x24')](removeEntity(_0x140717,null))[_0xeced('0x40')](handleError(_0x140717,null));};exports[_0xeced('0x49')]=function(_0x51367e,_0x310317){return db[_0xeced('0x2a')]['describe']()['then'](respondWithResult(_0x310317,null))['catch'](handleError(_0x310317,null));}; \ No newline at end of file +var _0x67a6=['findAll','rows','catch','show','params','length','find','create','body','describe','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','Content-Range','apply','reject','update','then','end','error','name','send','index','map','ChatTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include'];(function(_0x55cc58,_0x5ce0af){var _0x26062e=function(_0x59e29d){while(--_0x59e29d){_0x55cc58['push'](_0x55cc58['shift']());}};_0x26062e(++_0x5ce0af);}(_0x67a6,0x132));var _0x667a=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x67a6[_0x24237f];return _0x48298e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x667a('0x0'));var zipdir=require(_0x667a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x667a('0x2'));var moment=require(_0x667a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x667a('0x4'));var util=require(_0x667a('0x5'));var path=require('path');var sox=require(_0x667a('0x6'));var csv=require(_0x667a('0x7'));var ejs=require(_0x667a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x667a('0x9'));var squel=require(_0x667a('0xa'));var crypto=require(_0x667a('0xb'));var jsforce=require(_0x667a('0xc'));var deskjs=require(_0x667a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x667a('0xe'));var Redis=require(_0x667a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x667a('0x10'));var as=require(_0x667a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x667a('0x12'))(_0x667a('0x13'));var utils=require(_0x667a('0x14'));var config=require(_0x667a('0x15'));var licenseUtil=require(_0x667a('0x16'));var db=require(_0x667a('0x17'))['db'];function respondWithStatusCode(_0x164bc6,_0x37011e){_0x37011e=_0x37011e||0xcc;return function(_0x33a28c){if(_0x33a28c){return _0x164bc6[_0x667a('0x18')](_0x37011e);}return _0x164bc6[_0x667a('0x19')](_0x37011e)['end']();};}function respondWithResult(_0x377d81,_0x470a64){_0x470a64=_0x470a64||0xc8;return function(_0x16e411){if(_0x16e411){return _0x377d81[_0x667a('0x19')](_0x470a64)[_0x667a('0x1a')](_0x16e411);}};}function respondWithFilteredResult(_0x4632bb,_0x32c3e0){return function(_0x51ec75){if(_0x51ec75){var _0x21ece1=typeof _0x32c3e0[_0x667a('0x1b')]===_0x667a('0x1c')&&typeof _0x32c3e0['limit']===_0x667a('0x1c');var _0x2b321a=_0x51ec75[_0x667a('0x1d')];var _0x41e100=_0x21ece1?0x0:_0x32c3e0[_0x667a('0x1b')];var _0x8d8473=_0x21ece1?_0x51ec75[_0x667a('0x1d')]:_0x32c3e0['offset']+_0x32c3e0['limit'];var _0x7a478f;if(_0x8d8473>=_0x2b321a){_0x8d8473=_0x2b321a;_0x7a478f=0xc8;}else{_0x7a478f=0xce;}_0x4632bb['status'](_0x7a478f);return _0x4632bb['set'](_0x667a('0x1e'),_0x41e100+'-'+_0x8d8473+'/'+_0x2b321a)[_0x667a('0x1a')](_0x51ec75);}return null;};}function patchUpdates(_0x54e2d5){return function(_0x5c25b8){try{jsonpatch[_0x667a('0x1f')](_0x5c25b8,_0x54e2d5,!![]);}catch(_0x44d1e0){return BPromise[_0x667a('0x20')](_0x44d1e0);}return _0x5c25b8['save']();};}function saveUpdates(_0x2ea0a5,_0xacc688){return function(_0x294ef5){if(_0x294ef5){return _0x294ef5[_0x667a('0x21')](_0x2ea0a5)[_0x667a('0x22')](function(_0x189c4c){return _0x189c4c;});}return null;};}function removeEntity(_0x7563e5,_0x4cfbeb){return function(_0x6b21eb){if(_0x6b21eb){return _0x6b21eb['destroy']()[_0x667a('0x22')](function(){_0x7563e5[_0x667a('0x19')](0xcc)[_0x667a('0x23')]();});}};}function handleEntityNotFound(_0xbc0f54,_0x1825f6){return function(_0x558da3){if(!_0x558da3){_0xbc0f54['sendStatus'](0x194);}return _0x558da3;};}function handleError(_0x43c87e,_0x1b0eae){_0x1b0eae=_0x1b0eae||0x1f4;return function(_0x5b562d){logger[_0x667a('0x24')](_0x5b562d['stack']);if(_0x5b562d[_0x667a('0x25')]){delete _0x5b562d[_0x667a('0x25')];}_0x43c87e[_0x667a('0x19')](_0x1b0eae)[_0x667a('0x26')](_0x5b562d);};}exports[_0x667a('0x27')]=function(_0x3ce297,_0x4e421f){var _0x33b290={},_0x4a68ef={},_0x170466={'count':0x0,'rows':[]};var _0x1e6166=_[_0x667a('0x28')](db[_0x667a('0x29')][_0x667a('0x2a')],function(_0x3bdf22){return{'name':_0x3bdf22['fieldName'],'type':_0x3bdf22[_0x667a('0x2b')][_0x667a('0x2c')]};});_0x4a68ef[_0x667a('0x2d')]=_[_0x667a('0x28')](_0x1e6166,'name');_0x4a68ef[_0x667a('0x2e')]=_[_0x667a('0x2f')](_0x3ce297[_0x667a('0x2e')]);_0x4a68ef[_0x667a('0x30')]=_[_0x667a('0x31')](_0x4a68ef['model'],_0x4a68ef[_0x667a('0x2e')]);_0x33b290[_0x667a('0x32')]=_[_0x667a('0x31')](_0x4a68ef[_0x667a('0x2d')],qs[_0x667a('0x33')](_0x3ce297[_0x667a('0x2e')][_0x667a('0x33')]));_0x33b290[_0x667a('0x32')]=_0x33b290[_0x667a('0x32')]['length']?_0x33b290[_0x667a('0x32')]:_0x4a68ef[_0x667a('0x2d')];if(!_0x3ce297[_0x667a('0x2e')][_0x667a('0x34')]('nolimit')){_0x33b290[_0x667a('0x35')]=qs['limit'](_0x3ce297[_0x667a('0x2e')][_0x667a('0x35')]);_0x33b290[_0x667a('0x1b')]=qs[_0x667a('0x1b')](_0x3ce297[_0x667a('0x2e')][_0x667a('0x1b')]);}_0x33b290[_0x667a('0x36')]=qs[_0x667a('0x37')](_0x3ce297[_0x667a('0x2e')][_0x667a('0x37')]);_0x33b290[_0x667a('0x38')]=qs['filters'](_[_0x667a('0x39')](_0x3ce297[_0x667a('0x2e')],_0x4a68ef[_0x667a('0x30')]),_0x1e6166);if(_0x3ce297[_0x667a('0x2e')][_0x667a('0x3a')]){_0x33b290['where']=_['merge'](_0x33b290[_0x667a('0x38')],{'$or':_[_0x667a('0x28')](_0x1e6166,function(_0x467c59){if(_0x467c59[_0x667a('0x2b')]!==_0x667a('0x3b')){var _0x386669={};_0x386669[_0x467c59[_0x667a('0x25')]]={'$like':'%'+_0x3ce297[_0x667a('0x2e')][_0x667a('0x3a')]+'%'};return _0x386669;}})});}_0x33b290=_[_0x667a('0x3c')]({},_0x33b290,_0x3ce297[_0x667a('0x3d')]);var _0x1147b4={'where':_0x33b290['where']};return db[_0x667a('0x29')][_0x667a('0x1d')](_0x1147b4)[_0x667a('0x22')](function(_0x336c1e){_0x170466['count']=_0x336c1e;if(_0x3ce297[_0x667a('0x2e')][_0x667a('0x3e')]){_0x33b290[_0x667a('0x3f')]=[{'all':!![]}];}return db[_0x667a('0x29')][_0x667a('0x40')](_0x33b290);})[_0x667a('0x22')](function(_0x523c22){_0x170466[_0x667a('0x41')]=_0x523c22;return _0x170466;})[_0x667a('0x22')](respondWithFilteredResult(_0x4e421f,_0x33b290))[_0x667a('0x42')](handleError(_0x4e421f,null));};exports[_0x667a('0x43')]=function(_0x4bbcda,_0x2ec66f){var _0x4e92cf={'raw':!![],'where':{'id':_0x4bbcda[_0x667a('0x44')]['id']}},_0x377479={};_0x377479[_0x667a('0x2d')]=_[_0x667a('0x2f')](db['ChatTransferReport'][_0x667a('0x2a')]);_0x377479[_0x667a('0x2e')]=_[_0x667a('0x2f')](_0x4bbcda[_0x667a('0x2e')]);_0x377479[_0x667a('0x30')]=_[_0x667a('0x31')](_0x377479[_0x667a('0x2d')],_0x377479['query']);_0x4e92cf[_0x667a('0x32')]=_[_0x667a('0x31')](_0x377479[_0x667a('0x2d')],qs[_0x667a('0x33')](_0x4bbcda[_0x667a('0x2e')][_0x667a('0x33')]));_0x4e92cf[_0x667a('0x32')]=_0x4e92cf['attributes'][_0x667a('0x45')]?_0x4e92cf[_0x667a('0x32')]:_0x377479[_0x667a('0x2d')];if(_0x4bbcda[_0x667a('0x2e')][_0x667a('0x3e')]){_0x4e92cf['include']=[{'all':!![]}];}_0x4e92cf=_['merge']({},_0x4e92cf,_0x4bbcda[_0x667a('0x3d')]);return db[_0x667a('0x29')][_0x667a('0x46')](_0x4e92cf)[_0x667a('0x22')](handleEntityNotFound(_0x2ec66f,null))['then'](respondWithResult(_0x2ec66f,null))[_0x667a('0x42')](handleError(_0x2ec66f,null));};exports['create']=function(_0xf3aa6c,_0x52001b){return db[_0x667a('0x29')][_0x667a('0x47')](_0xf3aa6c['body'],{})[_0x667a('0x22')](respondWithResult(_0x52001b,0xc9))[_0x667a('0x42')](handleError(_0x52001b,null));};exports[_0x667a('0x21')]=function(_0x430339,_0x1d4c5d){if(_0x430339[_0x667a('0x48')]['id']){delete _0x430339['body']['id'];}return db[_0x667a('0x29')][_0x667a('0x46')]({'where':{'id':_0x430339['params']['id']}})['then'](handleEntityNotFound(_0x1d4c5d,null))[_0x667a('0x22')](saveUpdates(_0x430339[_0x667a('0x48')],null))[_0x667a('0x22')](respondWithResult(_0x1d4c5d,null))[_0x667a('0x42')](handleError(_0x1d4c5d,null));};exports['destroy']=function(_0x4a3f6c,_0x5805c1){return db[_0x667a('0x29')]['find']({'where':{'id':_0x4a3f6c[_0x667a('0x44')]['id']}})['then'](handleEntityNotFound(_0x5805c1,null))[_0x667a('0x22')](removeEntity(_0x5805c1,null))[_0x667a('0x42')](handleError(_0x5805c1,null));};exports[_0x667a('0x49')]=function(_0x3b2dd0,_0x2d59e8){return db['ChatTransferReport'][_0x667a('0x49')]()['then'](respondWithResult(_0x2d59e8,null))[_0x667a('0x42')](handleError(_0x2d59e8,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index c87da25..70f1513 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 _0xc1fd=['bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x4bbc69,_0x296386){var _0x5cdb40=function(_0x25e087){while(--_0x25e087){_0x4bbc69['push'](_0x4bbc69['shift']());}};_0x5cdb40(++_0x296386);}(_0xc1fd,0x173));var _0xdc1f=function(_0x144830,_0x4c1671){_0x144830=_0x144830-0x0;var _0x5f378d=_0xc1fd[_0x144830];return _0x5f378d;};'use strict';var _=require(_0xdc1f('0x0'));var util=require(_0xdc1f('0x1'));var logger=require(_0xdc1f('0x2'))(_0xdc1f('0x3'));var moment=require('moment');var BPromise=require(_0xdc1f('0x4'));var rp=require(_0xdc1f('0x5'));var fs=require('fs');var path=require(_0xdc1f('0x6'));var rimraf=require(_0xdc1f('0x7'));var config=require(_0xdc1f('0x8'));var attributes=require(_0xdc1f('0x9'));module[_0xdc1f('0xa')]=function(_0x508c60,_0x1878ce){return _0x508c60[_0xdc1f('0xb')](_0xdc1f('0xc'),attributes,{'tableName':_0xdc1f('0xd'),'paranoid':![],'indexes':[{'name':_0xdc1f('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x34d7=['uniqueid','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer'];(function(_0x5bb7f4,_0xa9d6d9){var _0x1aee41=function(_0x45d924){while(--_0x45d924){_0x5bb7f4['push'](_0x5bb7f4['shift']());}};_0x1aee41(++_0xa9d6d9);}(_0x34d7,0x121));var _0x734d=function(_0xda7972,_0x37f5f6){_0xda7972=_0xda7972-0x0;var _0x168986=_0x34d7[_0xda7972];return _0x168986;};'use strict';var _=require(_0x734d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x734d('0x1'));var moment=require(_0x734d('0x2'));var BPromise=require(_0x734d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x734d('0x4'));var rimraf=require(_0x734d('0x5'));var config=require(_0x734d('0x6'));var attributes=require(_0x734d('0x7'));module[_0x734d('0x8')]=function(_0x59fda9,_0x35295d){return _0x59fda9['define'](_0x734d('0x9'),attributes,{'tableName':_0x734d('0xa'),'paranoid':![],'indexes':[{'name':_0x734d('0xb'),'fields':[_0x734d('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 a4d6dbd..d715d15 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 _0xba8b=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','ChatTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','lodash'];(function(_0x340c40,_0x1aaf30){var _0x1ecba3=function(_0x398fa6){while(--_0x398fa6){_0x340c40['push'](_0x340c40['shift']());}};_0x1ecba3(++_0x1aaf30);}(_0xba8b,0xc5));var _0xbba8=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xba8b[_0x45783c];return _0x1161da;};'use strict';var _=require(_0xbba8('0x0'));var util=require(_0xbba8('0x1'));var moment=require('moment');var BPromise=require(_0xbba8('0x2'));var rs=require(_0xbba8('0x3'));var fs=require('fs');var Redis=require(_0xbba8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbba8('0x5'));var logger=require(_0xbba8('0x6'))(_0xbba8('0x7'));var config=require(_0xbba8('0x8'));var jayson=require(_0xbba8('0x9'));var client=jayson['client'][_0xbba8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12a03a,_0x556190,_0x5a763e){return new BPromise(function(_0xae0a41,_0x22c607){return client['request'](_0x12a03a,_0x5a763e)[_0xbba8('0xb')](function(_0x100f76){logger['info'](_0xbba8('0xc'),_0x556190,'request\x20sent');logger[_0xbba8('0xd')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x556190,_0xbba8('0xe'),JSON[_0xbba8('0xf')](_0x100f76));if(_0x100f76[_0xbba8('0x10')]){if(_0x100f76[_0xbba8('0x10')][_0xbba8('0x11')]===0x1f4){logger['error'](_0xbba8('0xc'),_0x556190,_0x100f76[_0xbba8('0x10')][_0xbba8('0x12')]);return _0x22c607(_0x100f76['error'][_0xbba8('0x12')]);}logger[_0xbba8('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x556190,_0x100f76[_0xbba8('0x10')]['message']);return _0xae0a41(_0x100f76['error']['message']);}else{logger[_0xbba8('0x13')](_0xbba8('0xc'),_0x556190,_0xbba8('0xe'));_0xae0a41(_0x100f76[_0xbba8('0x14')][_0xbba8('0x12')]);}})[_0xbba8('0x15')](function(_0x4a2929){logger[_0xbba8('0x10')](_0xbba8('0xc'),_0x556190,_0x4a2929);_0x22c607(_0x4a2929);});});} \ No newline at end of file +var _0x5542=['ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','debug'];(function(_0x27a3cb,_0x4af597){var _0x54ff38=function(_0x3a82d2){while(--_0x3a82d2){_0x27a3cb['push'](_0x27a3cb['shift']());}};_0x54ff38(++_0x4af597);}(_0x5542,0x74));var _0x2554=function(_0x149b82,_0x15af5d){_0x149b82=_0x149b82-0x0;var _0x1952c9=_0x5542[_0x149b82];return _0x1952c9;};'use strict';var _=require(_0x2554('0x0'));var util=require(_0x2554('0x1'));var moment=require('moment');var BPromise=require(_0x2554('0x2'));var rs=require(_0x2554('0x3'));var fs=require('fs');var Redis=require(_0x2554('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2554('0x5'))(_0x2554('0x6'));var config=require(_0x2554('0x7'));var jayson=require(_0x2554('0x8'));var client=jayson[_0x2554('0x9')][_0x2554('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c3f21,_0x6ec308,_0x224d1a){return new BPromise(function(_0x562421,_0x4d9d36){return client[_0x2554('0xb')](_0x2c3f21,_0x224d1a)[_0x2554('0xc')](function(_0x40e280){logger[_0x2554('0xd')](_0x2554('0xe'),_0x6ec308,'request\x20sent');logger[_0x2554('0xf')](_0x2554('0x10'),_0x6ec308,'request\x20sent',JSON[_0x2554('0x11')](_0x40e280));if(_0x40e280['error']){if(_0x40e280[_0x2554('0x12')][_0x2554('0x13')]===0x1f4){logger[_0x2554('0x12')](_0x2554('0xe'),_0x6ec308,_0x40e280[_0x2554('0x12')][_0x2554('0x14')]);return _0x4d9d36(_0x40e280[_0x2554('0x12')][_0x2554('0x14')]);}logger[_0x2554('0x12')](_0x2554('0xe'),_0x6ec308,_0x40e280[_0x2554('0x12')][_0x2554('0x14')]);return _0x562421(_0x40e280[_0x2554('0x12')]['message']);}else{logger[_0x2554('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x6ec308,'request\x20sent');_0x562421(_0x40e280[_0x2554('0x15')]['message']);}})['catch'](function(_0x43f401){logger[_0x2554('0x12')](_0x2554('0xe'),_0x6ec308,_0x43f401);_0x4d9d36(_0x43f401);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 34eac12..4bb5e9b 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 _0xa77d=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','/:id','create','put','update','delete','destroy','exports'];(function(_0x573205,_0x30586a){var _0x51fb13=function(_0x153dd8){while(--_0x153dd8){_0x573205['push'](_0x573205['shift']());}};_0x51fb13(++_0x30586a);}(_0xa77d,0x78));var _0xda77=function(_0xc51f6e,_0x34c0f4){_0xc51f6e=_0xc51f6e-0x0;var _0x1e3d83=_0xa77d[_0xc51f6e];return _0x1e3d83;};'use strict';var multer=require(_0xda77('0x0'));var util=require(_0xda77('0x1'));var path=require('path');var timeout=require(_0xda77('0x2'));var express=require(_0xda77('0x3'));var router=express[_0xda77('0x4')]();var fs_extra=require(_0xda77('0x5'));var auth=require(_0xda77('0x6'));var interaction=require(_0xda77('0x7'));var config=require(_0xda77('0x8'));var controller=require(_0xda77('0x9'));router[_0xda77('0xa')]('/',auth[_0xda77('0xb')](),controller['index']);router['get'](_0xda77('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xda77('0xd'),auth[_0xda77('0xb')](),controller['show']);router['post']('/',auth[_0xda77('0xb')](),controller[_0xda77('0xe')]);router[_0xda77('0xf')](_0xda77('0xd'),auth[_0xda77('0xb')](),controller[_0xda77('0x10')]);router[_0xda77('0x11')](_0xda77('0xd'),auth['isAuthenticated'](),controller[_0xda77('0x12')]);module[_0xda77('0x13')]=router; \ No newline at end of file +var _0xc8f1=['create','put','/:id','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x23aa9a,_0x2a21ab){var _0x4bd2c5=function(_0x542623){while(--_0x542623){_0x23aa9a['push'](_0x23aa9a['shift']());}};_0x4bd2c5(++_0x2a21ab);}(_0xc8f1,0x125));var _0x1c8f=function(_0xd4751f,_0x4e698f){_0xd4751f=_0xd4751f-0x0;var _0x773146=_0xc8f1[_0xd4751f];return _0x773146;};'use strict';var multer=require(_0x1c8f('0x0'));var util=require(_0x1c8f('0x1'));var path=require(_0x1c8f('0x2'));var timeout=require(_0x1c8f('0x3'));var express=require(_0x1c8f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1c8f('0x5'));var interaction=require(_0x1c8f('0x6'));var config=require(_0x1c8f('0x7'));var controller=require('./chatTransferReport.controller');router[_0x1c8f('0x8')]('/',auth[_0x1c8f('0x9')](),controller[_0x1c8f('0xa')]);router[_0x1c8f('0x8')](_0x1c8f('0xb'),auth['isAuthenticated'](),controller[_0x1c8f('0xc')]);router['get']('/:id',auth[_0x1c8f('0x9')](),controller['show']);router['post']('/',auth[_0x1c8f('0x9')](),controller[_0x1c8f('0xd')]);router[_0x1c8f('0xe')](_0x1c8f('0xf'),auth[_0x1c8f('0x9')](),controller['update']);router[_0x1c8f('0x10')](_0x1c8f('0xf'),auth[_0x1c8f('0x9')](),controller[_0x1c8f('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 3574ade..9e940a7 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 _0x24af=['Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','ENUM','star','thumb','TEXT','stringify','input','name','text','onlineForm','parse','getDataValue','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','squared','rounded','We\x20are\x20here!','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note'];(function(_0x262bf7,_0x5b9989){var _0xe2d32b=function(_0x250335){while(--_0x250335){_0x262bf7['push'](_0x262bf7['shift']());}};_0xe2d32b(++_0x5b9989);}(_0x24af,0x132));var _0xf24a=function(_0x1a8f86,_0x5ed9c4){_0x1a8f86=_0x1a8f86-0x0;var _0x20d876=_0x24af[_0x1a8f86];return _0x20d876;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xf24a('0x0'));module[_0xf24a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0xf24a('0x2')],'allowNull':![],'unique':_0xf24a('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xf24a('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xf24a('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xf24a('0x2')],'defaultValue':_0xf24a('0x5')},'customerAlias':{'type':Sequelize[_0xf24a('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf24a('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xf24a('0x2')],'allowNull':![],'defaultValue':_0xf24a('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xf24a('0x2')],'allowNull':![],'defaultValue':_0xf24a('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xf24a('0x2')]},'animation':{'type':Sequelize[_0xf24a('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0xf24a('0x9')),'defaultValue':_0xf24a('0xa')},'header_online':{'type':Sequelize[_0xf24a('0x2')],'defaultValue':_0xf24a('0xb')},'start_chat_button':{'type':Sequelize[_0xf24a('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xf24a('0x2')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0xf24a('0x2')],'defaultValue':_0xf24a('0xc')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xf24a('0xd')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xf24a('0x2')],'defaultValue':_0xf24a('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0xf24a('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xf24a('0x2')],'defaultValue':_0xf24a('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xf24a('0x2')],'defaultValue':_0xf24a('0x10')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xf24a('0x2')],'defaultValue':_0xf24a('0x11')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xf24a('0x12')},'closingMessage':{'type':Sequelize[_0xf24a('0x2')],'defaultValue':_0xf24a('0x13')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xf24a('0x14')},'skipMessageButton':{'type':Sequelize[_0xf24a('0x2')],'defaultValue':_0xf24a('0x15')},'conditionAgreement':{'type':Sequelize[_0xf24a('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xf24a('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xf24a('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xf24a('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0xf24a('0x16')},'ratingType':{'type':Sequelize[_0xf24a('0x17')](_0xf24a('0x18'),_0xf24a('0x19')),'defaultValue':_0xf24a('0x18')},'ratingStarsNumber':{'type':Sequelize[_0xf24a('0xd')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xf24a('0x1a')],'defaultValue':function(){return JSON[_0xf24a('0x1b')]({'items':[{'type':_0xf24a('0x1c'),'variable':null,'config':{'placeholder':_0xf24a('0x1d'),'type':_0xf24a('0x1e'),'required':!![]},'props':{'title':_0xf24a('0x1d'),'helpText':''}},{'type':'input','props':{'title':_0xf24a('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xf24a('0x4'),'type':_0xf24a('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0xf24a('0x1f'))?JSON[_0xf24a('0x20')](this[_0xf24a('0x21')](_0xf24a('0x1f'))):{};},'set':function(_0xd65654){return this[_0xf24a('0x22')](_0xf24a('0x1f'),JSON[_0xf24a('0x1b')](_0xd65654));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xf24a('0x1c'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xf24a('0x4')},'variable':null},{'type':_0xf24a('0x23'),'config':{'placeholder':'Comments'},'props':{'title':_0xf24a('0x24'),'helpText':_0xf24a('0x25')}}],'fromKey':0x0});},'get':function(){return this[_0xf24a('0x21')](_0xf24a('0x26'))?JSON[_0xf24a('0x20')](this[_0xf24a('0x21')](_0xf24a('0x26'))):{};},'set':function(_0x3b97af){return this['setDataValue'](_0xf24a('0x26'),JSON[_0xf24a('0x1b')](_0x3b97af));}},'token':{'type':Sequelize[_0xf24a('0x2')],'defaultValue':function(){return rs[_0xf24a('0x27')]();}},'autoclose':{'type':Sequelize[_0xf24a('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xf24a('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xf24a('0x2')]},'waitingTitle':{'type':Sequelize[_0xf24a('0x2')],'defaultValue':_0xf24a('0x28')},'waitingMessage':{'type':Sequelize[_0xf24a('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xf24a('0x2')],'defaultValue':_0xf24a('0x29')},'offlineMessageBody':{'type':Sequelize[_0xf24a('0x2')],'defaultValue':_0xf24a('0x2a')},'enableUnmanagedNote':{'type':Sequelize[_0xf24a('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xf24a('0x2b')},'skipUnmanaged':{'type':Sequelize[_0xf24a('0x2')],'defaultValue':_0xf24a('0x15')},'sendUnmanaged':{'type':Sequelize[_0xf24a('0x2')],'defaultValue':_0xf24a('0x14')},'enableCustomerAttachment':{'type':Sequelize[_0xf24a('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xf24a('0x1a')]},'showAgentAvatar':{'type':Sequelize[_0xf24a('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xf24a('0x1a')],'defaultValue':function(){return _0xf24a('0x2c');}},'notificationSound':{'type':Sequelize[_0xf24a('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf24a('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xf24a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xf24a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xf24a('0x2')],'defaultValue':_0xf24a('0x2d')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xf24a('0x2')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0xf24a('0x2')],'defaultValue':_0xf24a('0x2e')},'defaultTitle':{'type':Sequelize[_0xf24a('0x2')]},'customerAvatar':{'type':Sequelize[_0xf24a('0x1a')]},'showCustomerAvatar':{'type':Sequelize[_0xf24a('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xf24a('0xd')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf24a('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf24a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf24a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xf24a('0x30')},'systemAvatar':{'type':Sequelize[_0xf24a('0x1a')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xf24a('0x31')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5253d5){if(!_0x5253d5)this[_0xf24a('0x22')](_0xf24a('0x32'),null);this[_0xf24a('0x22')](_0xf24a('0x33'),_0x5253d5);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xf24a('0x2')]},'vidaooTopic':{'type':Sequelize[_0xf24a('0x2')],'allowNull':![],'defaultValue':_0xf24a('0x34')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xf24a('0x35');}},'vidaooMetadata':{'type':Sequelize[_0xf24a('0x1a')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xf24a('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xf24a('0x1a')]}}; \ No newline at end of file +var _0x278c=['Feedback','thumb','input','name','text','email','getDataValue','onlineForm','parse','setDataValue','stringify','textarea','Comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','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','exports','STRING','address','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Contact\x20us','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send'];(function(_0x4fedd4,_0x1dbf05){var _0x5dce0d=function(_0x28f99e){while(--_0x28f99e){_0x4fedd4['push'](_0x4fedd4['shift']());}};_0x5dce0d(++_0x1dbf05);}(_0x278c,0x18c));var _0xc278=function(_0x5c38cd,_0x5a6b4e){_0x5c38cd=_0x5c38cd-0x0;var _0xc985ef=_0x278c[_0x5c38cd];return _0xc985ef;};'use strict';var Sequelize=require(_0xc278('0x0'));var rs=require('randomstring');module[_0xc278('0x1')]={'name':{'type':Sequelize[_0xc278('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc278('0x3')},'description':{'type':Sequelize[_0xc278('0x2')]},'mapKey':{'type':Sequelize[_0xc278('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0xc278('0x2')],'defaultValue':'email'},'key':{'type':Sequelize[_0xc278('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xc278('0x2')],'defaultValue':_0xc278('0x4')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc278('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc278('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xc278('0x2')],'allowNull':![],'defaultValue':_0xc278('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xc278('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xc278('0x2')]},'animation':{'type':Sequelize[_0xc278('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xc278('0x9')](_0xc278('0xa'),_0xc278('0xb')),'defaultValue':_0xc278('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xc278('0xc')},'start_chat_button':{'type':Sequelize[_0xc278('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0xc278('0x2')],'defaultValue':_0xc278('0xd')},'download_transcript':{'type':Sequelize[_0xc278('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xc278('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xc278('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xc278('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xc278('0x2')],'defaultValue':_0xc278('0xe')},'formSubmitSuccessMessage':{'type':Sequelize[_0xc278('0x2')],'defaultValue':_0xc278('0xf')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0xc278('0x10')},'noteTitle':{'type':Sequelize[_0xc278('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xc278('0x2')],'defaultValue':_0xc278('0x11')},'closingMessage':{'type':Sequelize[_0xc278('0x2')],'defaultValue':_0xc278('0x12')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xc278('0x13')},'skipMessageButton':{'type':Sequelize[_0xc278('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xc278('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xc278('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xc278('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xc278('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xc278('0x2')],'defaultValue':_0xc278('0x14')},'ratingType':{'type':Sequelize[_0xc278('0x9')]('star',_0xc278('0x15')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xc278('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xc278('0x16'),'variable':null,'config':{'placeholder':_0xc278('0x17'),'type':_0xc278('0x18'),'required':!![]},'props':{'title':_0xc278('0x17'),'helpText':''}},{'type':_0xc278('0x16'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xc278('0x19'),'type':_0xc278('0x19')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xc278('0x1a')](_0xc278('0x1b'))?JSON[_0xc278('0x1c')](this[_0xc278('0x1a')](_0xc278('0x1b'))):{};},'set':function(_0x503e82){return this[_0xc278('0x1d')]('onlineForm',JSON[_0xc278('0x1e')](_0x503e82));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xc278('0x16'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xc278('0x19')},'variable':null},{'type':_0xc278('0x1f'),'config':{'placeholder':_0xc278('0x20')},'props':{'title':_0xc278('0x20'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xc278('0x1a')]('offlineForm')?JSON[_0xc278('0x1c')](this['getDataValue']('offlineForm')):{};},'set':function(_0x1ebc0f){return this['setDataValue'](_0xc278('0x21'),JSON['stringify'](_0x1ebc0f));}},'token':{'type':Sequelize[_0xc278('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xc278('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xc278('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xc278('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xc278('0x2')]},'forwardOffline':{'type':Sequelize[_0xc278('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xc278('0x2')]},'waitingTitle':{'type':Sequelize[_0xc278('0x2')],'defaultValue':_0xc278('0x22')},'waitingMessage':{'type':Sequelize[_0xc278('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xc278('0x2')],'defaultValue':_0xc278('0x23')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xc278('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xc278('0x2')],'defaultValue':_0xc278('0x24')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xc278('0x25')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xc278('0x13')},'enableCustomerAttachment':{'type':Sequelize[_0xc278('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xc278('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xc278('0x26')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xc278('0x2')]},'notificationTemplate':{'type':Sequelize[_0xc278('0x26')],'defaultValue':function(){return _0xc278('0x27');}},'notificationSound':{'type':Sequelize[_0xc278('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc278('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xc278('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xc278('0x2')],'defaultValue':_0xc278('0x28')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xc278('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xc278('0x2')],'defaultValue':_0xc278('0x29')},'verticalAlignment':{'type':Sequelize[_0xc278('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xc278('0x2')],'defaultValue':_0xc278('0x2a')},'messagesAlignment':{'type':Sequelize[_0xc278('0x2')],'defaultValue':_0xc278('0x2b')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0xc278('0x26')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xc278('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc278('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xc278('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc278('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc278('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xc278('0x2')],'defaultValue':_0xc278('0x2d')},'systemAvatar':{'type':Sequelize[_0xc278('0x26')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc278('0x7')],'comment':_0xc278('0x2e')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xc278('0x2f'),'set':function(_0xc87636){if(!_0xc87636)this[_0xc278('0x1d')](_0xc278('0x30'),null);this[_0xc278('0x1d')](_0xc278('0x31'),_0xc87636);}},'vidaooEscalation':{'type':Sequelize[_0xc278('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xc278('0x2')]},'vidaooTopic':{'type':Sequelize[_0xc278('0x2')],'allowNull':![],'defaultValue':_0xc278('0x32')},'vidaooNote':{'type':Sequelize[_0xc278('0x2')],'defaultValue':function(){return _0xc278('0x33');}},'vidaooMetadata':{'type':Sequelize[_0xc278('0x26')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xc278('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xc278('0x26')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index d35a1bb..bd24ed0 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 _0x7a54=['set','Content-Range','update','destroy','get','UserProfileResource','name','send','Command','getSnippet','timezone','format','iftime\x20%s,%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','inspect','No\x20timezone','map','Interval','Intervals','all','some','setUA','user-agent','getResult','customerIp','cf-connecting-ip','first','split','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','device','%s\x20%s\x20%s','model','vendor','type','stringify','index','Pause','ChatWebsite','rawAttributes','fieldName','key','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','findAll','rows','params','mandatoryDispositionPause','includeAll','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ChatWebsiteId','getDispositions','findOne','pick','Disposition','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addLogo','file','addAvatar','agentAvatar','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','sitepic','getLicense','custom','existsSync','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','isNil','chat','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','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','spread','account','list','applications','orderBy','asc','contact','threadId','ChatInteraction','interaction','messageId','created','autoclose','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','ChatQueue','queue','waitForTheAssignedQueue','startRouting','EventManager','notify','offline','files','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','fromString','originalname','mimetype','attachments','offline-chat','openNewInteraction','transaction','Attachment','bulkCreate','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','sendMail','\x22%s\x22\x20<%s>','email','user','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','server','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','hasOwnProperty','options','Contact','Owner','fullname','internal','Tags','tag','getProactiveActions','../../config/license/util','virtual','License','increment','server/files/chat/iframe.ejs','URL','origin','remote','headers','x-forwarded-for','connection','remoteAddress','alignment','verticalAlignment','color','labelText','color_button','sequelize','Transaction','ISOLATION_LEVELS','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','mustache','util','path','fs-extra','lodash','html-to-text','ioredis','jayson/promise','url','../../components/parsers/qs','api','../../errors/api','APIOutOfIntervalError','APINotFoundError','redis','defaults','localhost','./chatWebsite.socket','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x560586,_0x35996b){var _0x3c09da=function(_0x56d3c7){while(--_0x56d3c7){_0x560586['push'](_0x560586['shift']());}};_0x3c09da(++_0x35996b);}(_0x7a54,0x106));var _0x47a5=function(_0x5a1b1b,_0xddeabf){_0x5a1b1b=_0x5a1b1b-0x0;var _0x1ae9e9=_0x7a54[_0x5a1b1b];return _0x1ae9e9;};'use strict';var Mustache=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0x3'));var _=require(_0x47a5('0x4'));var querystring=require('querystring');var htmlToText=require(_0x47a5('0x5'));var Redis=require(_0x47a5('0x6'));var jayson=require(_0x47a5('0x7'));var url=require(_0x47a5('0x8'));var qs=require(_0x47a5('0x9'));var logger=require('../../config/logger')(_0x47a5('0xa'));var config=require('../../config/environment');var APIOutOfIntervalError=require(_0x47a5('0xb'))[_0x47a5('0xc')];var APINotFoundError=require('../../errors/api')[_0x47a5('0xd')];var APIHandleError=require('../../errors/api')['handleError'];var db=require('../../mysqldb')['db'];config[_0x47a5('0xe')]=_[_0x47a5('0xf')](config['redis'],{'host':_0x47a5('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x47a5('0x11'))[_0x47a5('0x12')](socket);var client=jayson[_0x47a5('0x13')][_0x47a5('0x14')]({'port':0x232c});var client9002=jayson[_0x47a5('0x13')][_0x47a5('0x14')]({'port':0x232a});var client9003=jayson[_0x47a5('0x13')]['http']({'port':0x232b});var client9001=jayson[_0x47a5('0x13')][_0x47a5('0x14')]({'port':0x2329});function respondWithRpcPromise(_0x1cf309,_0x711793,_0x139f25,_0x620ee9){return new Promise(function(_0x3c6c46,_0x190faa){var _0x4e99a8=_0x620ee9||client;return _0x4e99a8[_0x47a5('0x15')](_0x1cf309,_0x139f25)[_0x47a5('0x16')](function(_0x3b001e){logger[_0x47a5('0x17')](_0x47a5('0x18'),_0x711793,'request\x20sent');logger['debug'](_0x47a5('0x19'),_0x711793,'request\x20sent',JSON['stringify'](_0x3b001e));if(_0x3b001e[_0x47a5('0x1a')]){if(_0x3b001e[_0x47a5('0x1a')][_0x47a5('0x1b')]===0x1f4){logger[_0x47a5('0x1a')](_0x47a5('0x18'),_0x711793,_0x3b001e[_0x47a5('0x1a')][_0x47a5('0x1c')]);return _0x190faa(_0x3b001e[_0x47a5('0x1a')][_0x47a5('0x1c')]);}logger['error'](_0x47a5('0x18'),_0x711793,_0x3b001e[_0x47a5('0x1a')]['message']);return _0x3c6c46(_0x3b001e[_0x47a5('0x1a')][_0x47a5('0x1c')]);}else{logger[_0x47a5('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x711793,_0x47a5('0x1d'));_0x3c6c46(_0x3b001e[_0x47a5('0x1e')][_0x47a5('0x1c')]);}})[_0x47a5('0x1f')](function(_0x5ef1b1){logger[_0x47a5('0x1a')](_0x47a5('0x18'),_0x711793,_0x5ef1b1);_0x190faa(_0x5ef1b1);});});}function respondWithStatusCode(_0x513981,_0x28747d){_0x28747d=_0x28747d||0xcc;return function(_0xc4cd63){if(_0xc4cd63){return _0x513981[_0x47a5('0x20')](_0x28747d);}return _0x513981[_0x47a5('0x21')](_0x28747d)[_0x47a5('0x22')]();};}function respondWithResult(_0x50bf17,_0x53078a){_0x53078a=_0x53078a||0xc8;return function(_0x136745){if(_0x136745){return _0x50bf17['status'](_0x53078a)[_0x47a5('0x23')](_0x136745);}};}function respondWithFilteredResult(_0x5b6c4e,_0x23cb77){return function(_0x378208){if(_0x378208){var _0x36ad34=typeof _0x23cb77[_0x47a5('0x24')]===_0x47a5('0x25')&&typeof _0x23cb77[_0x47a5('0x26')]===_0x47a5('0x25');var _0x136b14=_0x378208[_0x47a5('0x27')];var _0x361bfa=_0x36ad34?0x0:_0x23cb77[_0x47a5('0x24')];var _0x11a4fa=_0x36ad34?_0x378208[_0x47a5('0x27')]:_0x23cb77['offset']+_0x23cb77[_0x47a5('0x26')];var _0x51833b;if(_0x11a4fa>=_0x136b14){_0x11a4fa=_0x136b14;_0x51833b=0xc8;}else{_0x51833b=0xce;}_0x5b6c4e[_0x47a5('0x21')](_0x51833b);return _0x5b6c4e[_0x47a5('0x28')](_0x47a5('0x29'),_0x361bfa+'-'+_0x11a4fa+'/'+_0x136b14)['json'](_0x378208);}return null;};}function saveUpdates(_0x256650){return function(_0x625952){if(_0x625952){return _0x625952[_0x47a5('0x2a')](_0x256650)[_0x47a5('0x16')](function(_0x51cc81){return _0x51cc81;});}return null;};}function removeEntity(_0x50d875){return function(_0x6f9a12){if(_0x6f9a12){return _0x6f9a12[_0x47a5('0x2b')]()['then'](function(){var _0x4e1006=_0x6f9a12[_0x47a5('0x2c')]({'plain':!![]});var _0x51544e='ChatWebsites';return db[_0x47a5('0x2d')]['destroy']({'where':{'type':_0x51544e,'resourceId':_0x4e1006['id']}})[_0x47a5('0x16')](function(){return _0x6f9a12;});})[_0x47a5('0x16')](function(){_0x50d875['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x274e34){return function(_0x5910bb){if(!_0x5910bb){_0x274e34[_0x47a5('0x20')](0x194);}return _0x5910bb;};}function handleError(_0x87e4c9,_0xf269a8){_0xf269a8=_0xf269a8||0x1f4;return function(_0x52749b){logger[_0x47a5('0x1a')](_0x52749b['stack']);if(_0x52749b['name']){delete _0x52749b[_0x47a5('0x2e')];}_0x87e4c9['status'](_0xf269a8)[_0x47a5('0x2f')](_0x52749b);};}function iftimePromise(_0x5ef577,_0x21ad34){return respondWithRpcPromise(_0x47a5('0x30'),_0x47a5('0x31'),{'command':_0x21ad34[_0x47a5('0x32')]?util[_0x47a5('0x33')](_0x47a5('0x34'),_0x5ef577[_0x47a5('0x35')],_0x21ad34[_0x47a5('0x32')]):util[_0x47a5('0x33')]('iftime\x20%s',_0x5ef577[_0x47a5('0x35')])},client9002)[_0x47a5('0x16')](function(_0x511c06){var _0x2c50d6=_0x511c06&&_0x511c06[_0x47a5('0x36')](_0x47a5('0x37'))>=0x0?!![]:![];logger['info'](_0x47a5('0x38'),_0x21ad34['id'],_0x5ef577['id'],_0x5ef577[_0x47a5('0x35')],_0x2c50d6?'ONLINE':_0x47a5('0x39'),_0x21ad34[_0x47a5('0x32')]?_0x21ad34['timezone']:'No\x20timezone');return _0x2c50d6;})['catch'](function(_0x12d9f2){logger['error'](_0x47a5('0x38'),_0x21ad34['id'],_0x5ef577['id'],_0x5ef577[_0x47a5('0x35')],util[_0x47a5('0x3a')](_0x12d9f2,{'showHidden':![],'depth':null}),_0x21ad34[_0x47a5('0x32')]?_0x21ad34[_0x47a5('0x32')]:_0x47a5('0x3b'));return![];});}function checkWebsiteIntervals(_0x2003b0){var _0x1f3d01=_[_0x47a5('0x3c')](_0x2003b0[_0x47a5('0x3d')][_0x47a5('0x3e')],function(_0x1658e8){var _0x23d6d8=_0x1658e8['get']({'plain':!![]});return iftimePromise(_0x23d6d8,_0x2003b0);});return Promise[_0x47a5('0x3f')](_0x1f3d01)[_0x47a5('0x16')](function(_0x331474){return _[_0x47a5('0x40')](_0x331474);});}function createInteractionObject(_0x586f4f,_0x7de536,_0x528ef3,_0x47c7a2){var _0x55c43d=require('user-agent-parser');var _0x27dd5d=new _0x55c43d();var _0x5ec4e5=_0x27dd5d[_0x47a5('0x41')](_0x528ef3[_0x47a5('0x42')])[_0x47a5('0x43')]();var _0x494526=_0x7de536[_0x47a5('0x44')];if(_0x528ef3[_0x47a5('0x45')]){_0x494526=_0x528ef3['cf-connecting-ip'];}else if(_0x528ef3['x-forwarded-for']){_0x494526=_[_0x47a5('0x46')](_0x528ef3['x-forwarded-for'][_0x47a5('0x47')](','));}return{'ContactId':_0x47c7a2['id'],'ChatWebsiteId':_0x586f4f,'from':(_0x47c7a2[_0x47a5('0x48')]||'')+'\x20'+(_0x47c7a2[_0x47a5('0x49')]||''),'customerIp':_0x494526,'customerPort':_0x528ef3[_0x47a5('0x4a')]?_0x528ef3[_0x47a5('0x4a')]:null,'referer':_0x7de536[_0x47a5('0x4b')],'browserName':_0x5ec4e5[_0x47a5('0x4c')][_0x47a5('0x2e')]&&_0x5ec4e5[_0x47a5('0x4c')][_0x47a5('0x4d')]?util[_0x47a5('0x33')](_0x47a5('0x4e'),_0x5ec4e5[_0x47a5('0x4c')][_0x47a5('0x2e')],_0x5ec4e5[_0x47a5('0x4c')][_0x47a5('0x4d')]):'unknown','browserVersion':_0x5ec4e5[_0x47a5('0x4c')][_0x47a5('0x4d')]||'unknown','osName':util['format'](_0x47a5('0x4e'),_0x5ec4e5['os']['name'],_0x5ec4e5['os'][_0x47a5('0x4d')]),'osVersion':_0x5ec4e5['os'][_0x47a5('0x4d')],'deviceModel':_0x5ec4e5['device']['model']&&_0x5ec4e5[_0x47a5('0x4f')]['vendor']?util[_0x47a5('0x33')](_0x47a5('0x50'),_0x5ec4e5[_0x47a5('0x4f')][_0x47a5('0x51')],_0x5ec4e5[_0x47a5('0x4f')][_0x47a5('0x52')],_0x5ec4e5[_0x47a5('0x4f')]['type']):null,'deviceVendor':_0x5ec4e5['device'][_0x47a5('0x52')],'deviceType':_0x5ec4e5[_0x47a5('0x4f')][_0x47a5('0x53')],'formData':JSON[_0x47a5('0x54')](_0x7de536)};}exports[_0x47a5('0x55')]=function(_0x2c0c86,_0x249de5){var _0x492cf7={'include':[{'model':db[_0x47a5('0x56')],'as':'mandatoryDispositionPause'}]},_0x45cca5={},_0x1c9a62={'count':0x0,'rows':[]};var _0x12ca40=_['map'](db[_0x47a5('0x57')][_0x47a5('0x58')],function(_0x46e90b){return{'name':_0x46e90b[_0x47a5('0x59')],'type':_0x46e90b['type'][_0x47a5('0x5a')]};});_0x45cca5[_0x47a5('0x51')]=_[_0x47a5('0x3c')](_0x12ca40,_0x47a5('0x2e'));_0x45cca5[_0x47a5('0x5b')]=_[_0x47a5('0x5c')](_0x2c0c86[_0x47a5('0x5b')]);_0x45cca5['filters']=_[_0x47a5('0x5d')](_0x45cca5[_0x47a5('0x51')],_0x45cca5[_0x47a5('0x5b')]);_0x492cf7[_0x47a5('0x5e')]=_[_0x47a5('0x5d')](_0x45cca5[_0x47a5('0x51')],qs['fields'](_0x2c0c86[_0x47a5('0x5b')][_0x47a5('0x5f')]));_0x492cf7[_0x47a5('0x5e')]=_0x492cf7['attributes'][_0x47a5('0x60')]?_0x492cf7[_0x47a5('0x5e')]:_0x45cca5[_0x47a5('0x51')];if(!_0x2c0c86['query']['hasOwnProperty'](_0x47a5('0x61'))){_0x492cf7[_0x47a5('0x26')]=qs['limit'](_0x2c0c86['query'][_0x47a5('0x26')]);_0x492cf7['offset']=qs[_0x47a5('0x24')](_0x2c0c86['query']['offset']);}_0x492cf7[_0x47a5('0x62')]=qs[_0x47a5('0x63')](_0x2c0c86['query'][_0x47a5('0x63')]);_0x492cf7[_0x47a5('0x64')]=qs['filters'](_['pick'](_0x2c0c86[_0x47a5('0x5b')],_0x45cca5[_0x47a5('0x65')]),_0x12ca40);if(_0x2c0c86[_0x47a5('0x5b')][_0x47a5('0x66')]){_0x492cf7['where']=_[_0x47a5('0x67')](_0x492cf7[_0x47a5('0x64')],{'$or':_[_0x47a5('0x3c')](_0x12ca40,function(_0x5a33b8){if(_0x5a33b8[_0x47a5('0x53')]!=='VIRTUAL'){var _0x485e3c={};_0x485e3c[_0x5a33b8[_0x47a5('0x2e')]]={'$like':'%'+_0x2c0c86[_0x47a5('0x5b')][_0x47a5('0x66')]+'%'};return _0x485e3c;}})});}_0x492cf7=_[_0x47a5('0x67')]({},_0x492cf7,_0x2c0c86['options']);var _0x144af9={'where':_0x492cf7['where']};return db['ChatWebsite']['count'](_0x144af9)['then'](function(_0x212d92){_0x1c9a62[_0x47a5('0x27')]=_0x212d92;if(_0x2c0c86[_0x47a5('0x5b')]['includeAll']){_0x492cf7['include']=[{'all':!![]}];}return db[_0x47a5('0x57')][_0x47a5('0x68')](_0x492cf7);})[_0x47a5('0x16')](function(_0x3c2b46){_0x1c9a62[_0x47a5('0x69')]=_0x3c2b46;return _0x1c9a62;})['then'](respondWithFilteredResult(_0x249de5,_0x492cf7))[_0x47a5('0x1f')](handleError(_0x249de5,null));};exports['show']=function(_0x22c886,_0x274d31){var _0x4d545f={'raw':![],'where':{'id':_0x22c886[_0x47a5('0x6a')]['id']},'include':[{'model':db[_0x47a5('0x56')],'as':_0x47a5('0x6b')}]},_0x32b4de={};_0x32b4de[_0x47a5('0x51')]=_[_0x47a5('0x5c')](db[_0x47a5('0x57')][_0x47a5('0x58')]);_0x32b4de['query']=_[_0x47a5('0x5c')](_0x22c886[_0x47a5('0x5b')]);_0x32b4de[_0x47a5('0x65')]=_[_0x47a5('0x5d')](_0x32b4de[_0x47a5('0x51')],_0x32b4de['query']);_0x4d545f[_0x47a5('0x5e')]=_[_0x47a5('0x5d')](_0x32b4de[_0x47a5('0x51')],qs[_0x47a5('0x5f')](_0x22c886[_0x47a5('0x5b')][_0x47a5('0x5f')]));_0x4d545f[_0x47a5('0x5e')]=_0x4d545f[_0x47a5('0x5e')][_0x47a5('0x60')]?_0x4d545f[_0x47a5('0x5e')]:_0x32b4de[_0x47a5('0x51')];if(_0x22c886[_0x47a5('0x5b')][_0x47a5('0x6c')]){_0x4d545f[_0x47a5('0x6d')]=[{'all':!![]}];}_0x4d545f=_[_0x47a5('0x67')]({},_0x4d545f,_0x22c886['options']);return db[_0x47a5('0x57')][_0x47a5('0x6e')](_0x4d545f)[_0x47a5('0x16')](handleEntityNotFound(_0x274d31,null))['then'](respondWithResult(_0x274d31,null))[_0x47a5('0x1f')](handleError(_0x274d31,null));};exports[_0x47a5('0x6f')]=function(_0x36c67,_0x26f1ac){return db['ChatWebsite'][_0x47a5('0x6f')](_0x36c67['body'],{})[_0x47a5('0x16')](function(_0x487e21){var _0x43f649=_0x36c67['user'][_0x47a5('0x2c')]({'plain':!![]});if(!_0x43f649)throw new Error(_0x47a5('0x70'));if(_0x43f649[_0x47a5('0x71')]==='user'){var _0x4af557=_0x487e21['get']({'plain':!![]});var _0x4164a3=_0x47a5('0x72');return db[_0x47a5('0x73')][_0x47a5('0x6e')]({'where':{'name':_0x4164a3,'userProfileId':_0x43f649['userProfileId']},'raw':!![]})[_0x47a5('0x16')](function(_0xc12a6a){if(_0xc12a6a&&_0xc12a6a[_0x47a5('0x74')]===0x0){return db[_0x47a5('0x2d')][_0x47a5('0x6f')]({'name':_0x4af557[_0x47a5('0x2e')],'resourceId':_0x4af557['id'],'type':_0xc12a6a[_0x47a5('0x2e')],'sectionId':_0xc12a6a['id']},{})[_0x47a5('0x16')](function(){return _0x487e21;});}else{return _0x487e21;}})[_0x47a5('0x1f')](function(_0xc69a68){logger[_0x47a5('0x1a')](_0x47a5('0x75'),_0xc69a68);throw _0xc69a68;});}return _0x487e21;})['then'](respondWithResult(_0x26f1ac,0xc9))[_0x47a5('0x1f')](handleError(_0x26f1ac,null));};exports['update']=function(_0x2ad00a,_0x2ac30f){if(_0x2ad00a[_0x47a5('0x76')]['id']){delete _0x2ad00a[_0x47a5('0x76')]['id'];}return db[_0x47a5('0x57')][_0x47a5('0x6e')]({'where':{'id':_0x2ad00a[_0x47a5('0x6a')]['id']},'include':[{'model':db[_0x47a5('0x56')],'as':_0x47a5('0x6b')}]})[_0x47a5('0x16')](handleEntityNotFound(_0x2ac30f,null))[_0x47a5('0x16')](saveUpdates(_0x2ad00a[_0x47a5('0x76')],null))[_0x47a5('0x16')](respondWithResult(_0x2ac30f,null))[_0x47a5('0x1f')](handleError(_0x2ac30f,null));};exports[_0x47a5('0x2b')]=function(_0x4de126,_0x48eb77){return db['ChatWebsite']['find']({'where':{'id':_0x4de126[_0x47a5('0x6a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x48eb77,null))['then'](removeEntity(_0x48eb77,null))[_0x47a5('0x1f')](handleError(_0x48eb77,null));};exports[_0x47a5('0x77')]=function(_0x1baa5a,_0x396102){return db[_0x47a5('0x57')][_0x47a5('0x77')]()[_0x47a5('0x16')](respondWithResult(_0x396102,null))[_0x47a5('0x1f')](handleError(_0x396102,null));};exports[_0x47a5('0x78')]=function(_0x1ffe3c,_0x24a6c1){if(_0x1ffe3c['body']['id']){delete _0x1ffe3c[_0x47a5('0x76')]['id'];}return db[_0x47a5('0x57')][_0x47a5('0x6e')]({'where':{'id':_0x1ffe3c['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x24a6c1,null))[_0x47a5('0x16')](function(_0x17b61d){if(_0x17b61d){_0x1ffe3c['body'][_0x47a5('0x79')]=_0x17b61d['id'];return db['Disposition']['create'](_0x1ffe3c[_0x47a5('0x76')]);}})[_0x47a5('0x16')](respondWithResult(_0x24a6c1,null))[_0x47a5('0x1f')](handleError(_0x24a6c1,null));};exports[_0x47a5('0x7a')]=function(_0x164d42,_0xea50f3){var _0x479a82={'raw':![],'where':{}};var _0x592322={};var _0x3e0dbd={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x47a5('0x7b')]({'where':{'id':_0x164d42[_0x47a5('0x6a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0xea50f3,null))[_0x47a5('0x16')](function(_0x53ea2b){if(_0x53ea2b){_0x592322[_0x47a5('0x51')]=_['keys'](db['Disposition'][_0x47a5('0x58')]);_0x592322[_0x47a5('0x5b')]=_['keys'](_0x164d42[_0x47a5('0x5b')]);_0x592322[_0x47a5('0x65')]=_[_0x47a5('0x5d')](_0x592322['model'],_0x592322[_0x47a5('0x5b')]);_0x479a82['attributes']=_[_0x47a5('0x5d')](_0x592322[_0x47a5('0x51')],qs[_0x47a5('0x5f')](_0x164d42['query'][_0x47a5('0x5f')]));_0x479a82[_0x47a5('0x5e')]=_0x479a82[_0x47a5('0x5e')]['length']?_0x479a82[_0x47a5('0x5e')]:_0x592322['model'];if(!_0x164d42[_0x47a5('0x5b')]['hasOwnProperty'](_0x47a5('0x61'))){_0x479a82[_0x47a5('0x26')]=qs[_0x47a5('0x26')](_0x164d42[_0x47a5('0x5b')]['limit']);_0x479a82[_0x47a5('0x24')]=qs[_0x47a5('0x24')](_0x164d42[_0x47a5('0x5b')][_0x47a5('0x24')]);}_0x479a82[_0x47a5('0x62')]=qs['sort'](_0x164d42['query'][_0x47a5('0x63')]);_0x479a82['where']=qs[_0x47a5('0x65')](_[_0x47a5('0x7c')](_0x164d42[_0x47a5('0x5b')],_0x592322['filters']));_0x479a82[_0x47a5('0x64')][_0x47a5('0x79')]=_0x53ea2b['id'];if(_0x164d42['query'][_0x47a5('0x66')]){_0x479a82[_0x47a5('0x64')]=_[_0x47a5('0x67')](_0x479a82[_0x47a5('0x64')],{'$or':_['map'](_0x479a82['attributes'],function(_0x132742){var _0x263046={};_0x263046[_0x132742]={'$like':'%'+_0x164d42['query'][_0x47a5('0x66')]+'%'};return _0x263046;})});}_0x479a82=_[_0x47a5('0x67')]({},_0x479a82,_0x164d42['options']);return db[_0x47a5('0x7d')][_0x47a5('0x27')]({'where':_0x479a82[_0x47a5('0x64')]})['then'](function(_0x3f2ad9){_0x3e0dbd['count']=_0x3f2ad9;if(_0x164d42[_0x47a5('0x5b')]['includeAll']){_0x479a82[_0x47a5('0x6d')]=[{'all':!![]}];}return db[_0x47a5('0x7d')]['findAll'](_0x479a82);})[_0x47a5('0x16')](function(_0x597cb2){_0x3e0dbd[_0x47a5('0x69')]=_0x597cb2;return _0x3e0dbd;});}})[_0x47a5('0x16')](respondWithFilteredResult(_0xea50f3,_0x479a82))[_0x47a5('0x1f')](handleError(_0xea50f3,null));};exports[_0x47a5('0x7e')]=function(_0x49b76a,_0x3eb5c1){return db['ChatWebsite']['find']({'where':{'id':_0x49b76a[_0x47a5('0x6a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x3eb5c1,null))[_0x47a5('0x16')](function(_0x96fb22){if(_0x96fb22){return _0x96fb22[_0x47a5('0x7e')](_0x49b76a['query'][_0x47a5('0x7f')]);}})[_0x47a5('0x16')](respondWithStatusCode(_0x3eb5c1,null))[_0x47a5('0x1f')](handleError(_0x3eb5c1,null));};exports[_0x47a5('0x80')]=function(_0x50b98e,_0x240db9){if(_0x50b98e['body']['id']){delete _0x50b98e[_0x47a5('0x76')]['id'];}return db[_0x47a5('0x57')][_0x47a5('0x6e')]({'where':{'id':_0x50b98e[_0x47a5('0x6a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x240db9,null))[_0x47a5('0x16')](function(_0x92bfd7){if(_0x92bfd7){_0x50b98e[_0x47a5('0x76')][_0x47a5('0x79')]=_0x92bfd7['id'];return db['CannedAnswer'][_0x47a5('0x6f')](_0x50b98e[_0x47a5('0x76')]);}})['then'](respondWithResult(_0x240db9,null))[_0x47a5('0x1f')](handleError(_0x240db9,null));};exports[_0x47a5('0x81')]=function(_0x6d6a5,_0x5b85cd){var _0x4bf1f5={'raw':![],'where':{}};var _0x126bb1={};var _0x3d7371={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x6d6a5[_0x47a5('0x6a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x5b85cd,null))['then'](function(_0x29e384){if(_0x29e384){_0x126bb1[_0x47a5('0x51')]=_['keys'](db[_0x47a5('0x82')][_0x47a5('0x58')]);_0x126bb1[_0x47a5('0x5b')]=_[_0x47a5('0x5c')](_0x6d6a5[_0x47a5('0x5b')]);_0x126bb1[_0x47a5('0x65')]=_['intersection'](_0x126bb1['model'],_0x126bb1['query']);_0x4bf1f5[_0x47a5('0x5e')]=_[_0x47a5('0x5d')](_0x126bb1['model'],qs[_0x47a5('0x5f')](_0x6d6a5[_0x47a5('0x5b')][_0x47a5('0x5f')]));_0x4bf1f5[_0x47a5('0x5e')]=_0x4bf1f5[_0x47a5('0x5e')]['length']?_0x4bf1f5[_0x47a5('0x5e')]:_0x126bb1['model'];if(!_0x6d6a5['query']['hasOwnProperty'](_0x47a5('0x61'))){_0x4bf1f5['limit']=qs[_0x47a5('0x26')](_0x6d6a5[_0x47a5('0x5b')][_0x47a5('0x26')]);_0x4bf1f5['offset']=qs[_0x47a5('0x24')](_0x6d6a5[_0x47a5('0x5b')][_0x47a5('0x24')]);}_0x4bf1f5[_0x47a5('0x62')]=qs[_0x47a5('0x63')](_0x6d6a5['query'][_0x47a5('0x63')]);_0x4bf1f5[_0x47a5('0x64')]=qs['filters'](_[_0x47a5('0x7c')](_0x6d6a5[_0x47a5('0x5b')],_0x126bb1[_0x47a5('0x65')]));_0x4bf1f5[_0x47a5('0x64')][_0x47a5('0x79')]=_0x29e384['id'];if(_0x6d6a5[_0x47a5('0x5b')]['filter']){_0x4bf1f5[_0x47a5('0x64')]=_[_0x47a5('0x67')](_0x4bf1f5['where'],{'$or':_[_0x47a5('0x3c')](_0x4bf1f5[_0x47a5('0x5e')],function(_0x52a1b5){var _0x12a1de={};_0x12a1de[_0x52a1b5]={'$like':'%'+_0x6d6a5['query']['filter']+'%'};return _0x12a1de;})});}_0x4bf1f5=_['merge']({},_0x4bf1f5,_0x6d6a5['options']);return db[_0x47a5('0x82')][_0x47a5('0x27')]({'where':_0x4bf1f5[_0x47a5('0x64')]})[_0x47a5('0x16')](function(_0x31f896){_0x3d7371[_0x47a5('0x27')]=_0x31f896;if(_0x6d6a5[_0x47a5('0x5b')][_0x47a5('0x6c')]){_0x4bf1f5['include']=[{'all':!![]}];}return db[_0x47a5('0x82')][_0x47a5('0x68')](_0x4bf1f5);})[_0x47a5('0x16')](function(_0x399528){_0x3d7371['rows']=_0x399528;return _0x3d7371;});}})['then'](respondWithFilteredResult(_0x5b85cd,_0x4bf1f5))[_0x47a5('0x1f')](handleError(_0x5b85cd,null));};exports['removeAnswers']=function(_0x4cb8e4,_0x1b6a5c){return db[_0x47a5('0x57')]['find']({'where':{'id':_0x4cb8e4[_0x47a5('0x6a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x1b6a5c,null))[_0x47a5('0x16')](function(_0x48835f){if(_0x48835f){return _0x48835f[_0x47a5('0x83')](_0x4cb8e4[_0x47a5('0x5b')]['ids']);}})[_0x47a5('0x16')](respondWithStatusCode(_0x1b6a5c,null))[_0x47a5('0x1f')](handleError(_0x1b6a5c,null));};exports[_0x47a5('0x84')]=function(_0x311109,_0x12a56a){_0x311109[_0x47a5('0x76')]['sitepic']=_0x311109[_0x47a5('0x85')]['filename'];return db[_0x47a5('0x57')][_0x47a5('0x6e')]({'where':{'id':_0x311109[_0x47a5('0x6a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x12a56a,null))['then'](saveUpdates(_0x311109[_0x47a5('0x76')],null))[_0x47a5('0x16')](respondWithResult(_0x12a56a,null))[_0x47a5('0x1f')](handleError(_0x12a56a,null));};exports[_0x47a5('0x86')]=function(_0x34b7c9,_0x30df79){_0x34b7c9[_0x47a5('0x76')][_0x47a5('0x87')]=_0x34b7c9[_0x47a5('0x85')][_0x47a5('0x88')];return db[_0x47a5('0x57')][_0x47a5('0x6e')]({'where':{'id':_0x34b7c9['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x30df79,null))[_0x47a5('0x16')](saveUpdates(_0x34b7c9['body'],null))[_0x47a5('0x16')](respondWithResult(_0x30df79,null))[_0x47a5('0x1f')](handleError(_0x30df79,null));};exports[_0x47a5('0x89')]=function(_0x2ccf21,_0x2ff467){_0x2ccf21['body'][_0x47a5('0x8a')]=_0x2ccf21[_0x47a5('0x85')][_0x47a5('0x88')];return db[_0x47a5('0x57')][_0x47a5('0x6e')]({'where':{'id':_0x2ccf21[_0x47a5('0x6a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x2ff467,null))['then'](saveUpdates(_0x2ccf21['body'],null))[_0x47a5('0x16')](respondWithResult(_0x2ff467,null))['catch'](handleError(_0x2ff467,null));};exports[_0x47a5('0x8b')]=function(_0x5544a2,_0x12572f){_0x5544a2[_0x47a5('0x76')][_0x47a5('0x8c')]=_0x5544a2[_0x47a5('0x85')]['filename'];return db[_0x47a5('0x57')][_0x47a5('0x6e')]({'where':{'id':_0x5544a2[_0x47a5('0x6a')]['id']}})['then'](handleEntityNotFound(_0x12572f,null))['then'](saveUpdates(_0x5544a2[_0x47a5('0x76')],null))[_0x47a5('0x16')](respondWithResult(_0x12572f,null))[_0x47a5('0x1f')](handleError(_0x12572f,null));};exports[_0x47a5('0x8d')]=function(_0x11f2f9,_0x402bba){var _0x1c0323=path[_0x47a5('0x8e')](config['root'],_0x47a5('0x8f'));var _0x4d333b={'where':{'id':_0x11f2f9[_0x47a5('0x6a')]['id']},'attributes':['id',_0x47a5('0x90')],'raw':!![]};var _0x5b0b0b=![];return require('../../config/license/util')[_0x47a5('0x91')]()[_0x47a5('0x16')](function(_0x530387){if(_0x530387){_0x5b0b0b=_0x530387[_0x47a5('0x92')];}})[_0x47a5('0x16')](function(){return db[_0x47a5('0x57')][_0x47a5('0x6e')](_0x4d333b);})['then'](handleEntityNotFound(_0x402bba,null))[_0x47a5('0x16')](function(_0x490947){if(_0x490947){if(!_['isNil'](_0x490947['sitepic'])){if(fs[_0x47a5('0x93')](path['join'](config[_0x47a5('0x94')],_0x47a5('0x95'),_0x490947[_0x47a5('0x90')]))&&_0x5b0b0b){_0x1c0323=path[_0x47a5('0x8e')](config[_0x47a5('0x94')],_0x47a5('0x95'),_0x490947[_0x47a5('0x90')]);}}return _0x402bba[_0x47a5('0x96')](_0x1c0323);}})[_0x47a5('0x1f')](handleError(_0x402bba,null));};exports[_0x47a5('0x97')]=function(_0x42b7ef,_0xf05c39){var _0x328faa=path[_0x47a5('0x8e')](config[_0x47a5('0x94')],'server/files/images/avatars/default_avatar.png');var _0xdd95c8={'where':{'id':_0x42b7ef[_0x47a5('0x6a')]['id']},'attributes':['id',_0x47a5('0x87')],'raw':!![]};return db[_0x47a5('0x57')]['find'](_0xdd95c8)[_0x47a5('0x16')](handleEntityNotFound(_0xf05c39,null))['then'](function(_0x4476b5){if(_0x4476b5){if(!_['isNil'](_0x4476b5[_0x47a5('0x87')])){if(fs[_0x47a5('0x93')](path[_0x47a5('0x8e')](config['root'],_0x47a5('0x98'),_0x4476b5[_0x47a5('0x87')]))){_0x328faa=path[_0x47a5('0x8e')](config['root'],'server/files/images/avatars/',_0x4476b5[_0x47a5('0x87')]);}}return _0xf05c39[_0x47a5('0x96')](_0x328faa);}})[_0x47a5('0x1f')](handleError(_0xf05c39,null));};exports[_0x47a5('0x99')]=function(_0x204bd6,_0x579e5c){var _0x1196a0=path['join'](config[_0x47a5('0x94')],_0x47a5('0x9a'));var _0x46647f={'where':{'id':_0x204bd6[_0x47a5('0x6a')]['id']},'attributes':['id','customerAvatar','showCustomerAvatar'],'raw':!![]};return db[_0x47a5('0x57')][_0x47a5('0x6e')](_0x46647f)[_0x47a5('0x16')](handleEntityNotFound(_0x579e5c,null))[_0x47a5('0x16')](function(_0x259088){if(_0x259088){if(!_[_0x47a5('0x9b')](_0x259088[_0x47a5('0x8a')])){if(fs[_0x47a5('0x93')](path[_0x47a5('0x8e')](config['root'],'server/files/images/avatars/',_0x259088[_0x47a5('0x8a')]))&&_0x259088['showCustomerAvatar']){_0x1196a0=path[_0x47a5('0x8e')](config[_0x47a5('0x94')],_0x47a5('0x98'),_0x259088['customerAvatar']);}}return _0x579e5c[_0x47a5('0x96')](_0x1196a0);}})[_0x47a5('0x1f')](handleError(_0x579e5c,null));};exports['getSystemAvatar']=function(_0xcb6714,_0x51f6cf){var _0x277255=path[_0x47a5('0x8e')](config[_0x47a5('0x94')],'server/files/images/avatars/system_avatar.png');var _0x55b454={'where':{'id':_0xcb6714['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db['ChatWebsite'][_0x47a5('0x6e')](_0x55b454)['then'](handleEntityNotFound(_0x51f6cf,null))[_0x47a5('0x16')](function(_0x2287b0){if(_0x2287b0){if(!_['isNil'](_0x2287b0['systemAvatar'])){if(fs['existsSync'](path[_0x47a5('0x8e')](config['root'],'server/files/images/avatars/',_0x2287b0['systemAvatar']))){_0x277255=path[_0x47a5('0x8e')](config[_0x47a5('0x94')],_0x47a5('0x98'),_0x2287b0[_0x47a5('0x8c')]);}}return _0x51f6cf['download'](_0x277255);}})[_0x47a5('0x1f')](handleError(_0x51f6cf,null));};exports['notify']=function(_0x2b6f9e,_0x53a710){var _0x2de924={'body':_0x2b6f9e[_0x47a5('0x76')],'channel':_0x47a5('0x9c')};var _0x4f8171=[];var _0x106bbe=[];var _0x427c02={};var _0xc1c968=![];return db[_0x47a5('0x9d')]['describe']()[_0x47a5('0x16')](function(_0x9a7edc){if(!_0x9a7edc){throw new db[(_0x47a5('0x9e'))][(_0x47a5('0x9f'))](_0x47a5('0xa0'));}_0x4f8171=_[_0x47a5('0xa1')](_['keys'](_0x9a7edc),[_0x47a5('0xa2'),_0x47a5('0xa3')]);_0x106bbe=_[_0x47a5('0xa1')](_[_0x47a5('0x5c')](_0x9a7edc),[_0x47a5('0xa2'),_0x47a5('0xa3'),_0x47a5('0xa4'),_0x47a5('0xa5')]);if(_0x2b6f9e[_0x47a5('0x76')]['id']){delete _0x2b6f9e[_0x47a5('0x76')]['id'];}if(_[_0x47a5('0x9b')](_0x2b6f9e[_0x47a5('0x76')][_0x47a5('0xa6')])){throw new db[(_0x47a5('0x9e'))][(_0x47a5('0x9f'))](_0x47a5('0xa7'));}if(_[_0x47a5('0x9b')](_0x2b6f9e['body'][_0x47a5('0x76')])||_0x2b6f9e['body']['body']===''){throw new db[(_0x47a5('0x9e'))][(_0x47a5('0x9f'))](_0x47a5('0xa8'));}if(_['isNil'](_0x2b6f9e[_0x47a5('0x76')][_0x47a5('0xa9')])){throw new db[(_0x47a5('0x9e'))][(_0x47a5('0x9f'))](_0x47a5('0xaa')+_0x106bbe);}if(!_[_0x47a5('0xab')](_0x106bbe,_0x2b6f9e[_0x47a5('0x76')][_0x47a5('0xa9')])){throw new db[(_0x47a5('0x9e'))][(_0x47a5('0x9f'))](_0x47a5('0xac')+_0x106bbe);}_0x427c02[_0x2b6f9e[_0x47a5('0x76')][_0x47a5('0xa9')]]=_0x2b6f9e['body']['from'];})[_0x47a5('0x16')](function(){return db['ChatWebsite'][_0x47a5('0x6e')]({'where':{'id':_0x2b6f9e[_0x47a5('0x6a')]['id']},'include':[{'model':db[_0x47a5('0xad')],'as':_0x47a5('0xae'),'include':[{'model':db[_0x47a5('0x9d')],'as':_0x47a5('0xaf'),'where':_0x427c02,'limit':0x1,'order':[['updatedAt',_0x47a5('0xb0')]]}]},{'model':db[_0x47a5('0xb1')],'as':_0x47a5('0xb2')},{'model':db['Interval'],'as':_0x47a5('0x3d'),'include':[{'model':db[_0x47a5('0x3d')],'as':_0x47a5('0x3e'),'attributes':['id',_0x47a5('0x35')],'raw':!![]}]}]});})[_0x47a5('0x16')](function(_0x23e649){if(!_0x23e649)throw new APINotFoundError(util[_0x47a5('0x33')](_0x47a5('0xb3'),_0x2b6f9e[_0x47a5('0x6a')]['id']));if(!_0x23e649[_0x47a5('0x3d')]||!_0x23e649[_0x47a5('0x3d')][_0x47a5('0x3e')])return[_0x23e649,!![]];return[_0x23e649,checkWebsiteIntervals(_0x23e649)];})[_0x47a5('0xb4')](function(_0x2ac386,_0x578983){if(!_0x578983)throw new APIOutOfIntervalError();if(!_0x2ac386[_0x47a5('0xae')])return;_0x2de924[_0x47a5('0xb5')]=_0x2ac386;_0x2de924[_0x47a5('0xb6')]=_0x2ac386[_0x47a5('0xae')];_0x2de924[_0x47a5('0xb7')]=_[_0x47a5('0xb8')](_0x2ac386[_0x47a5('0xb2')],['priority'],[_0x47a5('0xb9')]);if(_0x2de924['account'][_0x47a5('0xb2')]){delete _0x2de924[_0x47a5('0xb5')][_0x47a5('0xb2')];}if(_0x2de924[_0x47a5('0xb5')][_0x47a5('0xae')]&&_0x2de924[_0x47a5('0xb5')][_0x47a5('0xae')][_0x47a5('0xaf')]['length']){return _0x2de924[_0x47a5('0xb5')][_0x47a5('0xae')][_0x47a5('0xaf')][0x0];}var _0x598ecb=_[_0x47a5('0xf')](_0x2b6f9e[_0x47a5('0x76')],{'firstName':_0x2b6f9e[_0x47a5('0x76')][_0x47a5('0xa6')],'ListId':_0x2ac386['ListId']});_0x598ecb[_0x2b6f9e[_0x47a5('0x76')][_0x47a5('0xa9')]]=_0x2b6f9e[_0x47a5('0x76')][_0x47a5('0xa6')];return db['CmContact'][_0x47a5('0x6f')](_0x598ecb,{'fields':_0x4f8171,'raw':!![]});})['then'](function(_0x5be91a){_0x2de924[_0x47a5('0xba')]=_0x5be91a;var _0x1efae8=createInteractionObject(_0x2b6f9e[_0x47a5('0x6a')]['id'],_0x2b6f9e[_0x47a5('0x76')],_0x2b6f9e['headers'],_0x5be91a);var _0x26ad0e={'ChatWebsiteId':_0x2b6f9e[_0x47a5('0x6a')]['id'],'closed':![]};if(_0x2b6f9e[_0x47a5('0x76')][_0x47a5('0xbb')]){_0x26ad0e[_0x47a5('0xbb')]=_0x2b6f9e[_0x47a5('0x76')]['threadId'];return db[_0x47a5('0xbc')][_0x47a5('0x6e')]({'where':_0x26ad0e})[_0x47a5('0x16')](function(_0x3f18a2){if(_0x3f18a2){_0xc1c968=!![];return _0x3f18a2;}_0x1efae8[_0x47a5('0xbb')]=_0x2b6f9e['body'][_0x47a5('0xbb')];_0x1efae8['externalUrl']=_0x2b6f9e[_0x47a5('0x76')]['externalUrl'];return db[_0x47a5('0xbc')]['create'](_0x1efae8);});}_0x26ad0e['ContactId']=_0x5be91a['id'];if(_0x2b6f9e[_0x47a5('0x76')][_0x47a5('0xbd')]&&_0x2b6f9e['body'][_0x47a5('0xbd')]['id']){_0x26ad0e['id']=_0x2b6f9e[_0x47a5('0x76')]['interaction']['id'];return db[_0x47a5('0xbc')][_0x47a5('0x6e')]({'where':_0x26ad0e})[_0x47a5('0x16')](function(_0x508622){if(_0x508622){_0xc1c968=!![];return _0x508622;}return db[_0x47a5('0xbc')][_0x47a5('0x6f')](_0x1efae8);});}return db[_0x47a5('0xbc')][_0x47a5('0x6f')](_0x1efae8);})[_0x47a5('0x16')](function(_0x53cc9e){if(!_0xc1c968)return _0x53cc9e;var _0x5973d4={'from':(_0x2de924[_0x47a5('0xba')]['firstName']||'')+'\x20'+(_0x2de924[_0x47a5('0xba')][_0x47a5('0x49')]||'')};if(_0x2b6f9e['body']['threadId']&&_0x2b6f9e[_0x47a5('0x76')]['messageId']&&_0x2b6f9e[_0x47a5('0x76')][_0x47a5('0xbb')]!=_0x2b6f9e[_0x47a5('0x76')][_0x47a5('0xbe')]){_0x5973d4[_0x47a5('0xbb')]=_0x2b6f9e[_0x47a5('0x76')][_0x47a5('0xbe')];}return _0x53cc9e['update'](_0x5973d4);})[_0x47a5('0x16')](function(_0x5d507f){_0x2de924[_0x47a5('0xbd')]=_0x5d507f[_0x47a5('0x2c')]({'plain':!![]});_0x2de924[_0x47a5('0xbd')][_0x47a5('0xbf')]=!_0xc1c968;if(_0x2de924[_0x47a5('0xbd')][_0x47a5('0xbf')]){if(_0x2de924[_0x47a5('0xb5')][_0x47a5('0xc0')]){_0x2de924[_0x47a5('0xb7')][_0x47a5('0xc1')]({'id':0x0,'priority':_0x2de924[_0x47a5('0xb7')][_0x47a5('0x60')]+0x1,'app':'close','appdata':_0x47a5('0xc2'),'interval':_0x47a5('0xc3')});}}return db[_0x47a5('0xc4')]['create']({'body':_0x2b6f9e[_0x47a5('0x76')][_0x47a5('0x76')],'ChatWebsiteId':_0x2b6f9e[_0x47a5('0x6a')]['id'],'ChatInteractionId':_0x5d507f['id'],'direction':'in','ContactId':_0x2de924[_0x47a5('0xba')]['id'],'AttachmentId':_0x2b6f9e[_0x47a5('0x76')][_0x47a5('0xc5')]});})['then'](function(_0x142af8){_0x2de924[_0x47a5('0x1c')]=_0x142af8;if(!_0x2de924[_0x47a5('0xbd')][_0x47a5('0xc6')]){return;}return db[_0x47a5('0xc7')][_0x47a5('0x6e')]({'attributes':['id',_0x47a5('0x2e')],'where':{'id':_0x2de924[_0x47a5('0xbd')][_0x47a5('0xc6')]}});})[_0x47a5('0x16')](function(_0x4817f8){if(_0x4817f8){_0x2de924['applications'][_0x47a5('0xc8')]({'id':0x0,'priority':0x0,'app':_0x47a5('0xc9'),'appdata':_0x4817f8[_0x47a5('0x2e')]+','+(_0x2de924['account'][_0x47a5('0xca')]||0xa),'interval':'*,*,*,*'});_0x2de924['forcedOwnership']=!![];}if(!_0x2de924[_0x47a5('0xbd')][_0x47a5('0xcb')]){return;}return db[_0x47a5('0xcc')][_0x47a5('0x6e')]({'attributes':['id','name'],'where':{'id':_0x2de924[_0x47a5('0xbd')][_0x47a5('0xcb')]}});})['then'](function(_0x59ba59){if(_0x59ba59){_0x2de924['applications'][_0x47a5('0xc8')]({'id':0x0,'priority':0x1,'app':_0x47a5('0xcd'),'appdata':_0x59ba59[_0x47a5('0x2e')]+','+(_0x2de924[_0x47a5('0xb5')][_0x47a5('0xce')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x47a5('0xcf'),_0x2de924);})[_0x47a5('0x16')](function(_0x3a0c7b){respondWithRpcPromise(_0x47a5('0xd0'),'EventManager',{'event':_0x47a5('0xd1'),'message':_0x3a0c7b},client9002);return _0x3a0c7b;})[_0x47a5('0x16')](respondWithResult(_0x53a710,null))[_0x47a5('0x1f')](APIHandleError(_0x53a710));};exports[_0x47a5('0xd2')]=function(_0x5e7fac,_0x528402){var _0x4e43d8,_0x74893a,_0x15ddfc;var _0x156ceb=[];var _0x3c6142={};var _0x242006=_0x5e7fac[_0x47a5('0xd3')]||[];var _0x3bcdbc=[];var _0x21a58e;return db[_0x47a5('0x9d')]['describe']()[_0x47a5('0x16')](function(_0x7b5348){if(!_0x7b5348){throw new db['Sequelize'][(_0x47a5('0x9f'))](_0x47a5('0xa0'));}_0x156ceb=_[_0x47a5('0xa1')](_[_0x47a5('0x5c')](_0x7b5348),['createdAt',_0x47a5('0xa3'),_0x47a5('0xa4'),_0x47a5('0xa5')]);if(_0x5e7fac['body']['id']){delete _0x5e7fac['body']['id'];}if(_[_0x47a5('0x9b')](_0x5e7fac['body'][_0x47a5('0xa6')])){throw _0x528402['status'](0x1f4)[_0x47a5('0x2f')](new db[(_0x47a5('0x9e'))][(_0x47a5('0x9f'))](_0x47a5('0xa7')));}if(_[_0x47a5('0x9b')](_0x5e7fac['body']['body'])||_0x5e7fac[_0x47a5('0x76')][_0x47a5('0x76')]===''){throw _0x528402[_0x47a5('0x21')](0x1f4)[_0x47a5('0x2f')](new db['Sequelize']['ValidationError'](_0x47a5('0xa8')));}if(_['isNil'](_0x5e7fac[_0x47a5('0x76')]['mapKeyOffline'])){throw _0x528402[_0x47a5('0x21')](0x1f4)['send'](new db[(_0x47a5('0x9e'))][(_0x47a5('0x9f'))](_0x47a5('0xd4')+_0x156ceb));}if(!_[_0x47a5('0xab')](_0x156ceb,_0x5e7fac[_0x47a5('0x76')][_0x47a5('0xd5')])){throw _0x528402[_0x47a5('0x21')](0x1f4)[_0x47a5('0x2f')](new db['Sequelize'][(_0x47a5('0x9f'))](_0x47a5('0xd6')+_0x156ceb));}_0x3c6142[_0x5e7fac['body'][_0x47a5('0xd5')]]=_0x5e7fac[_0x47a5('0x76')]['from'];})['then'](function(){return db[_0x47a5('0x57')]['find']({'where':{'id':_0x5e7fac[_0x47a5('0x6a')]['id']},'include':[{'model':db[_0x47a5('0xad')],'as':_0x47a5('0xae')},{'model':db['MailAccount'],'as':_0x47a5('0xd7')}]});})[_0x47a5('0x16')](handleEntityNotFound(_0x528402,null))[_0x47a5('0x16')](function(_0x45dd6b){if(_0x45dd6b&&_0x45dd6b[_0x47a5('0xae')]){_0x74893a=_0x45dd6b;var _0x454609=_[_0x47a5('0xf')](_0x5e7fac['body'],{'firstName':_0x5e7fac[_0x47a5('0x76')][_0x47a5('0xa6')],'phone':_0x5e7fac[_0x47a5('0x76')][_0x47a5('0xa6')],'ListId':_0x45dd6b[_0x47a5('0xa5')]});_0x454609[_0x5e7fac[_0x47a5('0x76')][_0x47a5('0xd5')]]=_0x5e7fac['body']['from'];return db[_0x47a5('0x9d')][_0x47a5('0xd8')]({'where':_0x3c6142,'defaults':_0x454609});}})[_0x47a5('0xb4')](function(_0x4bbc94){if(_0x4bbc94){_0x15ddfc=_0x4bbc94;var _0x5d2a10=fs[_0x47a5('0xd9')](path[_0x47a5('0x8e')](config[_0x47a5('0x94')],_0x47a5('0xda')),_0x47a5('0xdb'));var _0x4121c1=ejs[_0x47a5('0xdc')](_0x5d2a10,{'body':_['toPairs'](_0x5e7fac[_0x47a5('0x76')][_0x47a5('0x76')]),'bodyTitle':_0x74893a[_0x47a5('0xdd')]});return db['ChatOfflineMessage'][_0x47a5('0x6f')]({'body':_0x4121c1,'plainBody':htmlToText[_0x47a5('0xde')](_0x4121c1),'ContactId':_0x4bbc94['id'],'ChatWebsiteId':_0x74893a['id']});}})[_0x47a5('0x16')](function(_0x278b42){_0x21a58e=_0x278b42;if(_0x242006[_0x47a5('0x60')]){var _0x20eff3=_0x242006[_0x47a5('0x3c')](function(_0x3a52cf){return{'name':_0x3a52cf[_0x47a5('0xdf')],'basename':_0x3a52cf[_0x47a5('0x88')],'type':_0x3a52cf[_0x47a5('0xe0')],'ChatOfflineMessageId':_0x278b42['id']};});_0x3bcdbc=_0x20eff3[_0x47a5('0x3c')](_0x3bd9cf=>{var _0x5a3741={'filename':_0x3bd9cf[_0x47a5('0x2e')],'path':path['join'](config[_0x47a5('0x94')],'server',_0x47a5('0xd3'),_0x47a5('0xe1'),_0x47a5('0xe2'),_0x3bd9cf['basename'])};return _0x5a3741;});if(!_0x74893a[_0x47a5('0xe3')]){return db['sequelize'][_0x47a5('0xe4')](function(_0x1e5883){return db[_0x47a5('0xe5')][_0x47a5('0xe6')](_0x20eff3,{'transaction':_0x1e5883});});}}})['then'](function(){if(_0x21a58e){_0x4e43d8=_0x21a58e;return db[_0x47a5('0xd7')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x47a5('0xe7'),'raw':!![],'include':[{'model':db[_0x47a5('0xe8')],'as':_0x47a5('0xe8'),'raw':!![]}]}]});}})[_0x47a5('0x16')](function(_0x184a18){if(_0x184a18&&_0x184a18[_0x47a5('0xe7')]&&_0x74893a[_0x47a5('0xe9')]&&_0x74893a[_0x47a5('0xea')]){var _0x3d8c62=_0x184a18['getSmtpOptions']();return respondWithRpcPromise('SendMail',_0x47a5('0xeb'),{'account':_0x3d8c62,'message':{'from':util[_0x47a5('0x33')](_0x47a5('0xec'),_0x184a18[_0x47a5('0x2e')],_0x184a18[_0x47a5('0xed')]||_0x184a18['Smtp'][_0x47a5('0xee')]),'to':_0x74893a[_0x47a5('0xea')],'subject':_0x74893a[_0x47a5('0xef')],'html':_0x4e43d8['body'],'attachments':_0x3bcdbc}},client9003)['then'](function(){return _0x4e43d8;})[_0x47a5('0x1f')](function(_0x3e8697){logger['error'](_0x3e8697);});}})[_0x47a5('0x16')](function(){if(_0x74893a&&_0x74893a[_0x47a5('0xe3')]&&_0x74893a[_0x47a5('0xf0')]){var _0x5952bd=[];if(_0x242006[_0x47a5('0x60')]){_0x5952bd=_0x242006[_0x47a5('0x3c')](function(_0x28193a){return{'name':_0x28193a[_0x47a5('0xdf')],'basename':_0x28193a[_0x47a5('0x88')],'type':_0x28193a['mimetype'],'ChatOfflineMessageId':_0x21a58e['id']};});}var _0x219f86;if(!_[_0x47a5('0x9b')](_0x74893a[_0x47a5('0xf1')])){var _0x9b617b=_['map'](_0x5e7fac['body'],function(_0x425daf){return _0x425daf;});var _0x5054f5=_[_0x47a5('0xf2')](_0x9b617b)[0x0];var _0xe66584=_[_0x47a5('0xf3')](_0x5054f5,function(_0x96adcc){return _0x96adcc;});_0x219f86=_0xe66584[0x1][_0x74893a[_0x47a5('0xf1')]];}var _0x5b8d81={'from':_0x15ddfc['email'],'firstName':_0x15ddfc[_0x47a5('0x48')],'lastName':_0x15ddfc[_0x47a5('0x49')],'mapKey':_0x47a5('0xed'),'message':{'from':_0x15ddfc['email'],'to':_0x74893a['MailAccount'][_0x47a5('0xed')],'cc':'','subject':_['isNil'](_0x219f86)?_0x74893a[_0x47a5('0xef')]:_0x219f86,'messageId':'','sentAt':new Date(),'attach':_0x5952bd[_0x47a5('0x60')],'attachments':_0x5952bd,'originChannel':_0x47a5('0xf4'),'ChatWebsiteId':_0x74893a['id'],'ChatOfflineMessageId':_0x4e43d8['id'],'originTo':_0x74893a[_0x47a5('0xd7')][_0x47a5('0xed')]},'body':_0x4e43d8['body']};var _0x56263c={'account':{'id':_0x74893a[_0x47a5('0xf0')]},'body':_0x5b8d81,'log':_0x47a5('0xf5')};return respondWithRpcPromise(_0x47a5('0xf5'),_0x47a5('0xf6'),_0x56263c,client9001)[_0x47a5('0x16')](function(){return _0x4e43d8;})['catch'](function(_0x56fc6){logger[_0x47a5('0x1a')](_0x56fc6);});}return;})[_0x47a5('0x16')](function(){if(_0x4e43d8){return _0x4e43d8;}})[_0x47a5('0x16')](respondWithResult(_0x528402,null))[_0x47a5('0x1f')](function(){for(var _0x4df71d of _0x242006){var _0x28a5f3=path[_0x47a5('0x8e')](config[_0x47a5('0x94')],_0x47a5('0xf7'),_0x47a5('0xd3'),_0x47a5('0xe1'),_0x47a5('0xe2'),_0x4df71d[_0x47a5('0x88')]);fs_extra[_0x47a5('0xf8')](_0x28a5f3)[_0x47a5('0x1f')](function(_0x2cc493){logger['error'](_0x47a5('0xf9'),_0x28a5f3,_0x2cc493);});}});};exports[_0x47a5('0xfa')]=function(_0x19f0da,_0x4233f4){return db['ChatInteraction']['find']({'where':{'id':_0x19f0da['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x4233f4,null))['then'](function(_0x5af4f7){if(_0x5af4f7){return _0x5af4f7[_0x47a5('0xfa')](_0x19f0da['body'][_0x47a5('0x7f')],_[_0x47a5('0xfb')](_0x19f0da[_0x47a5('0x76')],['ids','id'])||{});}})[_0x47a5('0x16')](respondWithResult(_0x4233f4,null))['catch'](handleError(_0x4233f4,null));};exports[_0x47a5('0xfc')]=function(_0x18c0b6,_0x460d52){var _0x3c4c48={'raw':![],'where':{}};var _0x428b9e={};var _0x302f14={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x18c0b6['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x460d52,null))[_0x47a5('0x16')](function(_0x1d6349){if(_0x1d6349){_0x428b9e[_0x47a5('0x51')]=_[_0x47a5('0x5c')](db[_0x47a5('0xbc')][_0x47a5('0x58')]);_0x428b9e[_0x47a5('0x5b')]=_[_0x47a5('0x5c')](_0x18c0b6[_0x47a5('0x5b')]);_0x428b9e[_0x47a5('0x65')]=_[_0x47a5('0x5d')](_0x428b9e[_0x47a5('0x51')],_0x428b9e[_0x47a5('0x5b')]);_0x3c4c48[_0x47a5('0x5e')]=_[_0x47a5('0x5d')](_0x428b9e['model'],qs[_0x47a5('0x5f')](_0x18c0b6[_0x47a5('0x5b')][_0x47a5('0x5f')]));_0x3c4c48[_0x47a5('0x5e')]=_0x3c4c48[_0x47a5('0x5e')][_0x47a5('0x60')]?_0x3c4c48[_0x47a5('0x5e')]:_0x428b9e[_0x47a5('0x51')];if(!_0x18c0b6['query'][_0x47a5('0xfd')]('nolimit')){_0x3c4c48[_0x47a5('0x26')]=qs[_0x47a5('0x26')](_0x18c0b6['query'][_0x47a5('0x26')]);_0x3c4c48['offset']=qs[_0x47a5('0x24')](_0x18c0b6[_0x47a5('0x5b')][_0x47a5('0x24')]);}_0x3c4c48[_0x47a5('0x62')]=qs[_0x47a5('0x63')](_0x18c0b6['query'][_0x47a5('0x63')]);_0x3c4c48[_0x47a5('0x64')]=qs[_0x47a5('0x65')](_['pick'](_0x18c0b6['query'],_0x428b9e[_0x47a5('0x65')]));_0x3c4c48[_0x47a5('0x64')][_0x47a5('0x79')]=_0x1d6349['id'];if(_0x18c0b6['query'][_0x47a5('0x66')]){_0x3c4c48[_0x47a5('0x64')]=_[_0x47a5('0x67')](_0x3c4c48['where'],{'$or':_[_0x47a5('0x3c')](_0x3c4c48[_0x47a5('0x5e')],function(_0x3ecc43){var _0xf4b1df={};_0xf4b1df[_0x3ecc43]={'$like':'%'+_0x18c0b6['query'][_0x47a5('0x66')]+'%'};return _0xf4b1df;})});}_0x3c4c48=_['merge']({},_0x3c4c48,_0x18c0b6[_0x47a5('0xfe')]);return db[_0x47a5('0xbc')][_0x47a5('0x27')]({'where':_0x3c4c48[_0x47a5('0x64')]})['then'](function(_0x1203f9){_0x302f14[_0x47a5('0x27')]=_0x1203f9;if(_0x18c0b6[_0x47a5('0x5b')][_0x47a5('0x6c')]){_0x3c4c48[_0x47a5('0x6d')]=[{'model':db['CmContact'],'as':_0x47a5('0xff'),'required':![]},{'model':db[_0x47a5('0xc7')],'as':_0x47a5('0x100'),'attributes':[_0x47a5('0x2e'),_0x47a5('0x101'),_0x47a5('0x102')],'required':![]},{'model':db['Tag'],'as':_0x47a5('0x103'),'attributes':['id',_0x47a5('0x2e'),'color'],'where':_0x18c0b6['query'][_0x47a5('0x104')]?{'id':_0x18c0b6[_0x47a5('0x5b')][_0x47a5('0x104')]}:undefined,'required':_0x18c0b6[_0x47a5('0x5b')][_0x47a5('0x104')]?!![]:![]}];}return db[_0x47a5('0xbc')]['findAll'](_0x3c4c48);})['then'](function(_0x2e5096){_0x302f14[_0x47a5('0x69')]=_0x2e5096;return _0x302f14;});}})['then'](respondWithFilteredResult(_0x460d52,_0x3c4c48))[_0x47a5('0x1f')](handleError(_0x460d52,null));};exports[_0x47a5('0x31')]=function(_0x5592f4,_0x269a37){var _0x5ed2b3=0x0;var _0x5c72e7=0x0;var _0x4aeaff=![];var _0x41ee78;var _0x385bfa;return db[_0x47a5('0x57')]['find']({'where':{'id':_0x5592f4[_0x47a5('0x6a')]['id']},'include':[{'model':db['Interval'],'as':_0x47a5('0x3d'),'include':[{'model':db['Interval'],'as':_0x47a5('0x3e'),'attributes':['id',_0x47a5('0x35')]}]}]})[_0x47a5('0x16')](handleEntityNotFound(_0x269a37,null))[_0x47a5('0x16')](function(_0x9095a4){if(_0x9095a4){_0x41ee78=_0x9095a4;return _0x9095a4[_0x47a5('0x105')]({'raw':!![]});}})[_0x47a5('0x16')](function(_0x15d573){if(_0x41ee78){if(_0x15d573){_0x385bfa=_0x15d573;}}return require(_0x47a5('0x106'))['getLicense']();})[_0x47a5('0x16')](function(_0x24c88e){if(_0x24c88e){_0x5c72e7=_0x24c88e[_0x47a5('0x107')];_0x4aeaff=_0x24c88e['custom'];}})[_0x47a5('0x16')](function(){return db[_0x47a5('0xbc')][_0x47a5('0x27')]({'where':{'closed':![]}});})[_0x47a5('0x16')](function(_0x24e241){_0x5ed2b3=_0x24e241;if(_0x5c72e7&&_0x24e241>_0x5c72e7){return db[_0x47a5('0x108')][_0x47a5('0x7b')]({'where':{'id':0x1}})[_0x47a5('0x16')](function(_0x33a9c5){if(_0x33a9c5){_0x33a9c5[_0x47a5('0x109')]('chatLicenseExceeded');}});}})['then'](function(){if(!_0x41ee78['Interval']||!_0x41ee78['Interval'][_0x47a5('0x3e')])return!![];return checkWebsiteIntervals(_0x41ee78);})['then'](function(_0x2330ae){var _0x1261ff=fs['readFileSync'](path[_0x47a5('0x8e')](config[_0x47a5('0x94')],_0x47a5('0x10a')),_0x47a5('0xdb'));var _0x2cbf08=new url[(_0x47a5('0x10b'))](_0x41ee78['address'])[_0x47a5('0x10c')];var _0x259e37='3.8.0';var _0x188ba1=![];var _0x5e41c8={'chatVersion':_0x259e37,'chatWebsiteAddressOrigin':_0x2cbf08,'remote':_0x41ee78[_0x47a5('0x10d')],'query':querystring[_0x47a5('0x54')](_[_0x47a5('0x67')](_0x41ee78[_0x47a5('0x2c')]({'plain':!![]}),{'customerIp':_0x5592f4[_0x47a5('0x10e')][_0x47a5('0x10f')]||_0x5592f4[_0x47a5('0x10e')]['x-real-ip']||_0x5592f4[_0x47a5('0x110')][_0x47a5('0x111')]||_0x5592f4['ip'],'referer':_0x5592f4['headers'][_0x47a5('0x4b')],'openedInteractions':_0x5ed2b3,'maxInteractions':_0x5c72e7,'virtual':_0x4aeaff[_0x47a5('0x107')],'online':_0x2330ae,'custom':_0x4aeaff}))['replace'](/'/g,'\x5c\x27')};_0x269a37[_0x47a5('0x2f')](ejs['render'](Mustache[_0x47a5('0xdc')](_0x1261ff,_0x5e41c8),{'proactiveActions':_0x385bfa,'alignment':_0x41ee78[_0x47a5('0x112')],'verticalAlignment':_0x41ee78[_0x47a5('0x113')],'div_color':_0x41ee78[_0x47a5('0x114')],'labelText':_0x41ee78[_0x47a5('0x115')],'text_color':_0x41ee78['textColor'],'text_button_color':_0x41ee78['textButtonColor'],'button_color':_0x41ee78[_0x47a5('0x116')],'background_color':_0x41ee78['backgroundColor'],'hideWhenOffline':_0x41ee78['hideWhenOffline'],'intervalId':_0x41ee78['IntervalId'],'isDevelopment':_0x188ba1,'chatVersion':_0x259e37}));})[_0x47a5('0x1f')](handleError(_0x269a37,null));};exports['addApplications']=function(_0x36752b,_0x1bcafd){var _0x1d4267=_0x36752b['params']['id'];var _0x4ffa91=_0x36752b[_0x47a5('0x76')];var _0x55fca6=0xc8;var _0x56f79f=null;return db[_0x47a5('0x117')]['transaction']({'isolationLevel':db['sequelize'][_0x47a5('0x118')][_0x47a5('0x119')]['READ_COMMITTED']},function(_0x48c3ed){return db[_0x47a5('0x57')][_0x47a5('0x7b')]({'where':{'id':_0x1d4267},'transaction':_0x48c3ed})[_0x47a5('0x16')](function(_0x1aa05c){if(_0x1aa05c){return db[_0x47a5('0xb1')]['destroy']({'where':{'ChatWebsiteId':_0x1d4267},'transaction':_0x48c3ed})[_0x47a5('0x16')](function(){var _0x2091c9=_[_0x47a5('0x3c')](_0x4ffa91,function(_0x26a3ad){_0x26a3ad['ChatWebsiteId']=_0x1d4267;return _0x26a3ad;});return db[_0x47a5('0xb1')][_0x47a5('0xe6')](_0x2091c9,{'transaction':_0x48c3ed});});}else{_0x55fca6=0x194;_0x56f79f=[];}});})[_0x47a5('0x16')](function(){if(_0x55fca6!==0x194){return db['ChatApplication'][_0x47a5('0x11a')]({'where':{'ChatWebsiteId':_0x1d4267},'order':'priority'})['then'](function(_0x187de4){_0x56f79f=_0x187de4;});}})[_0x47a5('0x1f')](function(_0x52ad1f){_0x55fca6=0x1f4;logger['error'](_0x52ad1f['stack']);if(_0x52ad1f[_0x47a5('0x2e')]){delete _0x52ad1f[_0x47a5('0x2e')];}_0x56f79f=_0x52ad1f;})['finally'](function(){if(_0x56f79f===null){_0x1bcafd[_0x47a5('0x20')](_0x55fca6);}else{if(_0x55fca6===0x1f4){_0x1bcafd['status'](_0x55fca6)[_0x47a5('0x2f')](_0x56f79f);}else{_0x1bcafd[_0x47a5('0x21')](_0x55fca6)['json'](_0x56f79f);}}});};exports[_0x47a5('0x11b')]=function(_0x307d7f,_0x5f2507){var _0x3fbd67={};var _0x5bca81={};var _0x447c32;var _0x46ae21;return db[_0x47a5('0x57')][_0x47a5('0x7b')]({'where':{'id':_0x307d7f[_0x47a5('0x6a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x5f2507,null))[_0x47a5('0x16')](function(_0x1ebfcd){if(_0x1ebfcd){_0x447c32=_0x1ebfcd;_0x5bca81['model']=_[_0x47a5('0x5c')](db[_0x47a5('0xb1')][_0x47a5('0x58')]);_0x5bca81[_0x47a5('0x5b')]=_[_0x47a5('0x5c')](_0x307d7f['query']);_0x5bca81[_0x47a5('0x65')]=_[_0x47a5('0x5d')](_0x5bca81['model'],_0x5bca81[_0x47a5('0x5b')]);_0x3fbd67[_0x47a5('0x5e')]=_[_0x47a5('0x5d')](_0x5bca81[_0x47a5('0x51')],qs[_0x47a5('0x5f')](_0x307d7f['query'][_0x47a5('0x5f')]));_0x3fbd67['attributes']=_0x3fbd67['attributes'][_0x47a5('0x60')]?_0x3fbd67['attributes']:_0x5bca81[_0x47a5('0x51')];_0x3fbd67[_0x47a5('0x62')]=qs['sort'](_0x307d7f[_0x47a5('0x5b')]['sort']);_0x3fbd67[_0x47a5('0x64')]=qs[_0x47a5('0x65')](_[_0x47a5('0x7c')](_0x307d7f[_0x47a5('0x5b')],_0x5bca81[_0x47a5('0x65')]));if(_0x307d7f[_0x47a5('0x5b')]['filter']){_0x3fbd67[_0x47a5('0x64')]=_[_0x47a5('0x67')](_0x3fbd67[_0x47a5('0x64')],{'$or':_[_0x47a5('0x3c')](_0x3fbd67[_0x47a5('0x5e')],function(_0x1c0230){var _0x69b145={};_0x69b145[_0x1c0230]={'$like':'%'+_0x307d7f[_0x47a5('0x5b')][_0x47a5('0x66')]+'%'};return _0x69b145;})});}_0x3fbd67=_[_0x47a5('0x67')]({},_0x3fbd67,_0x307d7f[_0x47a5('0xfe')]);return _0x447c32[_0x47a5('0x11b')](_0x3fbd67);}})[_0x47a5('0x16')](function(_0x3f5f4c){if(_0x3f5f4c){_0x46ae21=_0x3f5f4c[_0x47a5('0x60')];if(!_0x307d7f[_0x47a5('0x5b')][_0x47a5('0xfd')]('nolimit')){_0x3fbd67['limit']=qs[_0x47a5('0x26')](_0x307d7f[_0x47a5('0x5b')][_0x47a5('0x26')]);_0x3fbd67[_0x47a5('0x24')]=qs[_0x47a5('0x24')](_0x307d7f[_0x47a5('0x5b')][_0x47a5('0x24')]);}return _0x447c32[_0x47a5('0x11b')](_0x3fbd67);}})['then'](function(_0x247099){if(_0x247099){return _0x247099?{'count':_0x46ae21,'rows':_0x247099}:null;}})['then'](respondWithResult(_0x5f2507,null))[_0x47a5('0x1f')](handleError(_0x5f2507,null));};exports[_0x47a5('0x11c')]=function(_0x22bc01,_0x15245f){return db[_0x47a5('0x11d')]['find']({'where':{'id':_0x22bc01[_0x47a5('0x6a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x15245f,null))[_0x47a5('0x16')](function(_0x1d2039){if(_0x1d2039){return _0x1d2039[_0x47a5('0x11c')](_0x22bc01[_0x47a5('0x76')][_0x47a5('0x7f')],_[_0x47a5('0xfb')](_0x22bc01[_0x47a5('0x76')],[_0x47a5('0x7f'),'id'])||{});}})['then'](respondWithResult(_0x15245f,null))[_0x47a5('0x1f')](handleError(_0x15245f,null));};exports[_0x47a5('0x105')]=function(_0x59801d,_0x422249){var _0x4a9d0d={};var _0x1cd305={};var _0x54574a;var _0x5b8b2e;return db[_0x47a5('0x57')][_0x47a5('0x7b')]({'where':{'id':_0x59801d['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x422249,null))[_0x47a5('0x16')](function(_0xbfa21b){if(_0xbfa21b){_0x54574a=_0xbfa21b;_0x1cd305[_0x47a5('0x51')]=_[_0x47a5('0x5c')](db[_0x47a5('0x11e')]['rawAttributes']);_0x1cd305[_0x47a5('0x5b')]=_['keys'](_0x59801d[_0x47a5('0x5b')]);_0x1cd305[_0x47a5('0x65')]=_[_0x47a5('0x5d')](_0x1cd305[_0x47a5('0x51')],_0x1cd305[_0x47a5('0x5b')]);_0x4a9d0d[_0x47a5('0x5e')]=_[_0x47a5('0x5d')](_0x1cd305[_0x47a5('0x51')],qs['fields'](_0x59801d[_0x47a5('0x5b')]['fields']));_0x4a9d0d[_0x47a5('0x5e')]=_0x4a9d0d[_0x47a5('0x5e')][_0x47a5('0x60')]?_0x4a9d0d[_0x47a5('0x5e')]:_0x1cd305[_0x47a5('0x51')];_0x4a9d0d[_0x47a5('0x62')]=qs[_0x47a5('0x63')](_0x59801d['query'][_0x47a5('0x63')]);_0x4a9d0d[_0x47a5('0x64')]=qs[_0x47a5('0x65')](_[_0x47a5('0x7c')](_0x59801d[_0x47a5('0x5b')],_0x1cd305[_0x47a5('0x65')]));if(_0x59801d[_0x47a5('0x5b')]['filter']){_0x4a9d0d[_0x47a5('0x64')]=_[_0x47a5('0x67')](_0x4a9d0d[_0x47a5('0x64')],{'$or':_[_0x47a5('0x3c')](_0x4a9d0d['attributes'],function(_0x4c107a){var _0x3eb972={};_0x3eb972[_0x4c107a]={'$like':'%'+_0x59801d[_0x47a5('0x5b')][_0x47a5('0x66')]+'%'};return _0x3eb972;})});}_0x4a9d0d=_['merge']({},_0x4a9d0d,_0x59801d[_0x47a5('0xfe')]);return _0x54574a[_0x47a5('0x105')](_0x4a9d0d);}})['then'](function(_0x5847f3){if(_0x5847f3){_0x5b8b2e=_0x5847f3[_0x47a5('0x60')];if(!_0x59801d[_0x47a5('0x5b')][_0x47a5('0xfd')]('nolimit')){_0x4a9d0d['limit']=qs[_0x47a5('0x26')](_0x59801d[_0x47a5('0x5b')][_0x47a5('0x26')]);_0x4a9d0d[_0x47a5('0x24')]=qs[_0x47a5('0x24')](_0x59801d[_0x47a5('0x5b')][_0x47a5('0x24')]);}return _0x54574a['getProactiveActions'](_0x4a9d0d);}})[_0x47a5('0x16')](function(_0x59a791){if(_0x59a791){return _0x59a791?{'count':_0x5b8b2e,'rows':_0x59a791}:null;}})[_0x47a5('0x16')](respondWithResult(_0x422249,null))['catch'](handleError(_0x422249,null));};exports[_0x47a5('0x11f')]=function(_0x1da9a6,_0x3051c4){var _0x103478=_0x1da9a6[_0x47a5('0x5b')][_0x47a5('0x120')]===_0x47a5('0x121')?_0x47a5('0x122'):_0x47a5('0x123');return db[_0x47a5('0x57')]['find']({'attributes':['id',_0x103478],'where':{'id':_0x1da9a6[_0x47a5('0x6a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x3051c4,null))[_0x47a5('0x16')](function(_0x300ccb){if(_0x300ccb){var _0x23c9b8=_0x300ccb[_0x103478];var _0x1ca2c1=_0x23c9b8&&_0x23c9b8[_0x47a5('0x124')]?_0x23c9b8[_0x47a5('0x124')]:[];_0x3051c4[_0x47a5('0x2f')]({'fromKey':_['isNil'](_0x23c9b8[_0x47a5('0x125')])?undefined:_0x23c9b8['fromKey'],'count':_0x1ca2c1[_0x47a5('0x60')],'rows':_0x1ca2c1});}})['catch'](handleError(_0x3051c4,null));};exports[_0x47a5('0x126')]=function(_0x596091,_0x4f04bb){var _0x251b9e={'raw':![],'where':{}};var _0x5669c7={};var _0x53a0c3={'count':0x0,'rows':[]};return db[_0x47a5('0x57')][_0x47a5('0x7b')]({'where':{'id':_0x596091[_0x47a5('0x6a')]['id']}})['then'](handleEntityNotFound(_0x4f04bb,null))[_0x47a5('0x16')](function(_0x48a71f){if(_0x48a71f){_0x5669c7[_0x47a5('0x51')]=_['keys'](db[_0x47a5('0x127')][_0x47a5('0x58')]);_0x5669c7['query']=_[_0x47a5('0x5c')](_0x596091[_0x47a5('0x5b')]);_0x5669c7['filters']=_[_0x47a5('0x5d')](_0x5669c7[_0x47a5('0x51')],_0x5669c7['query']);_0x251b9e['attributes']=_[_0x47a5('0x5d')](_0x5669c7[_0x47a5('0x51')],qs[_0x47a5('0x5f')](_0x596091[_0x47a5('0x5b')][_0x47a5('0x5f')]));_0x251b9e['attributes']=_0x251b9e[_0x47a5('0x5e')][_0x47a5('0x60')]?_0x251b9e[_0x47a5('0x5e')]:_0x5669c7[_0x47a5('0x51')];if(!_0x596091[_0x47a5('0x5b')][_0x47a5('0xfd')](_0x47a5('0x61'))){_0x251b9e[_0x47a5('0x26')]=qs['limit'](_0x596091['query'][_0x47a5('0x26')]);_0x251b9e[_0x47a5('0x24')]=qs['offset'](_0x596091[_0x47a5('0x5b')]['offset']);}_0x251b9e[_0x47a5('0x62')]=qs['sort'](_0x596091[_0x47a5('0x5b')]['sort']);_0x251b9e['where']=qs[_0x47a5('0x65')](_[_0x47a5('0x7c')](_0x596091[_0x47a5('0x5b')],_0x5669c7['filters']));_0x251b9e[_0x47a5('0x64')][_0x47a5('0x79')]=_0x48a71f['id'];if(_0x596091[_0x47a5('0x5b')][_0x47a5('0x66')]){_0x251b9e[_0x47a5('0x64')]=_[_0x47a5('0x67')](_0x251b9e[_0x47a5('0x64')],{'$or':_['map'](_0x251b9e[_0x47a5('0x5e')],function(_0x5c58c9){var _0x344fbe={};_0x344fbe[_0x5c58c9]={'$like':'%'+_0x596091['query'][_0x47a5('0x66')]+'%'};return _0x344fbe;})});}_0x251b9e=_[_0x47a5('0x67')]({},_0x251b9e,_0x596091[_0x47a5('0xfe')]);return db['ChatOfflineMessage'][_0x47a5('0x27')]({'where':_0x251b9e[_0x47a5('0x64')]})[_0x47a5('0x16')](function(_0x54c030){_0x53a0c3[_0x47a5('0x27')]=_0x54c030;if(_0x596091[_0x47a5('0x5b')][_0x47a5('0x6c')]){_0x251b9e[_0x47a5('0x6d')]=[{'all':!![]}];}else{_0x251b9e['include']=[{'model':db['CmContact'],'as':_0x47a5('0xff'),'required':![]},{'model':db[_0x47a5('0xe5')],'as':'Attachments','required':![]}];}return db[_0x47a5('0x127')]['findAll'](_0x251b9e);})[_0x47a5('0x16')](function(_0x196f41){_0x53a0c3[_0x47a5('0x69')]=_0x196f41;return _0x53a0c3;});}})[_0x47a5('0x16')](respondWithFilteredResult(_0x4f04bb,_0x251b9e))[_0x47a5('0x1f')](handleError(_0x4f04bb,null));};exports[_0x47a5('0x128')]=function(_0x549a8a,_0x1acf09){return db[_0x47a5('0x57')][_0x47a5('0x6e')]({'where':{'id':_0x549a8a['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x1acf09,null))[_0x47a5('0x16')](function(_0xe3ba91){if(_0xe3ba91){return _0xe3ba91[_0x47a5('0x128')](_0x549a8a[_0x47a5('0x76')][_0x47a5('0x7f')],_[_0x47a5('0xfb')](_0x549a8a['body'],[_0x47a5('0x7f'),'id'])||{})['spread'](function(_0x4d1060){for(var _0xa288ca=0x0;_0xa288ca<_0x549a8a['body']['ids']['length'];_0xa288ca+=0x1){socket[_0x47a5('0x129')](_0x47a5('0x12a'),{'UserId':Number(_0x549a8a[_0x47a5('0x76')]['ids'][_0xa288ca]),'ChatWebsiteId':Number(_0x549a8a['params']['id'])});}return _0x4d1060;});}})[_0x47a5('0x16')](respondWithResult(_0x1acf09,null))[_0x47a5('0x1f')](handleError(_0x1acf09,null));};exports[_0x47a5('0x12b')]=function(_0x13ed08,_0x2f2eb7){return db['ChatWebsite'][_0x47a5('0x6e')]({'where':{'id':_0x13ed08[_0x47a5('0x6a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x2f2eb7,null))[_0x47a5('0x16')](function(_0x22cd5c){if(_0x22cd5c){return _0x22cd5c[_0x47a5('0x12b')](_0x13ed08[_0x47a5('0x5b')][_0x47a5('0x7f')])[_0x47a5('0x16')](function(){if(_['isArray'](_0x13ed08[_0x47a5('0x5b')][_0x47a5('0x7f')])){for(var _0x97a1a7=0x0;_0x97a1a7<_0x13ed08[_0x47a5('0x5b')][_0x47a5('0x7f')]['length'];_0x97a1a7+=0x1){socket[_0x47a5('0x129')](_0x47a5('0x12c'),{'UserId':Number(_0x13ed08[_0x47a5('0x5b')][_0x47a5('0x7f')][_0x97a1a7]),'ChatWebsiteId':Number(_0x13ed08['params']['id'])});}}else{socket[_0x47a5('0x129')](_0x47a5('0x12c'),{'UserId':Number(_0x13ed08['query'][_0x47a5('0x7f')]),'ChatWebsiteId':Number(_0x13ed08[_0x47a5('0x6a')]['id'])});}});}})[_0x47a5('0x16')](respondWithStatusCode(_0x2f2eb7,null))[_0x47a5('0x1f')](handleError(_0x2f2eb7,null));};exports[_0x47a5('0x12d')]=function(_0x25d495,_0x575ed3){var _0x81df5c={};var _0x7a562d={};var _0x592c32;var _0x5e0938;return db['ChatWebsite'][_0x47a5('0x7b')]({'where':{'id':_0x25d495[_0x47a5('0x6a')]['id']}})['then'](handleEntityNotFound(_0x575ed3,null))[_0x47a5('0x16')](function(_0x1deb82){if(_0x1deb82){_0x592c32=_0x1deb82;_0x7a562d['model']=_[_0x47a5('0x5c')](db[_0x47a5('0xc7')][_0x47a5('0x58')]);_0x7a562d[_0x47a5('0x5b')]=_[_0x47a5('0x5c')](_0x25d495['query']);_0x7a562d[_0x47a5('0x65')]=_['intersection'](_0x7a562d[_0x47a5('0x51')],_0x7a562d['query']);_0x81df5c[_0x47a5('0x5e')]=_[_0x47a5('0x5d')](_0x7a562d['model'],qs['fields'](_0x25d495['query'][_0x47a5('0x5f')]));_0x81df5c[_0x47a5('0x5e')]=_0x81df5c[_0x47a5('0x5e')]['length']?_0x81df5c[_0x47a5('0x5e')]:_0x7a562d[_0x47a5('0x51')];_0x81df5c[_0x47a5('0x62')]=qs[_0x47a5('0x63')](_0x25d495[_0x47a5('0x5b')][_0x47a5('0x63')]);_0x81df5c['where']=qs[_0x47a5('0x65')](_['pick'](_0x25d495[_0x47a5('0x5b')],_0x7a562d[_0x47a5('0x65')]));if(_0x25d495[_0x47a5('0x5b')]['filter']){_0x81df5c[_0x47a5('0x64')]=_[_0x47a5('0x67')](_0x81df5c[_0x47a5('0x64')],{'$or':_[_0x47a5('0x3c')](_0x81df5c['attributes'],function(_0x4e1fca){var _0xa5f6f1={};_0xa5f6f1[_0x4e1fca]={'$like':'%'+_0x25d495[_0x47a5('0x5b')][_0x47a5('0x66')]+'%'};return _0xa5f6f1;})});}_0x81df5c=_[_0x47a5('0x67')]({},_0x81df5c,_0x25d495['options']);return _0x592c32[_0x47a5('0x12d')](_0x81df5c);}})[_0x47a5('0x16')](function(_0x1b8fe1){if(_0x1b8fe1){_0x5e0938=_0x1b8fe1[_0x47a5('0x60')];if(!_0x25d495[_0x47a5('0x5b')][_0x47a5('0xfd')](_0x47a5('0x61'))){_0x81df5c[_0x47a5('0x26')]=qs['limit'](_0x25d495[_0x47a5('0x5b')]['limit']);_0x81df5c[_0x47a5('0x24')]=qs['offset'](_0x25d495[_0x47a5('0x5b')][_0x47a5('0x24')]);}return _0x592c32[_0x47a5('0x12d')](_0x81df5c);}})[_0x47a5('0x16')](function(_0x28b8aa){if(_0x28b8aa){return _0x28b8aa?{'count':_0x5e0938,'rows':_0x28b8aa}:null;}})[_0x47a5('0x16')](respondWithResult(_0x575ed3,null))[_0x47a5('0x1f')](handleError(_0x575ed3,null));}; \ No newline at end of file +var _0xb10b=['url','../../components/parsers/qs','api','../../config/environment','APIOutOfIntervalError','../../errors/api','APINotFoundError','handleError','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','client','http','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','destroy','get','ChatWebsites','UserProfileResource','end','stack','name','send','Command','getSnippet','timezone','format','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','inspect','Interval','Intervals','all','some','user-agent-parser','setUA','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','unknown','%s\x20%s','model','device','vendor','%s\x20%s\x20%s','type','index','Pause','mandatoryDispositionPause','map','ChatWebsite','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','rows','params','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findAll','removeDispositions','addAnswer','CannedAnswer','findOne','removeAnswers','addLogo','file','filename','addAvatar','addSystemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','getLicense','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','getCustomerAvatar','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','chat','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','CmList','List','Contacts','DESC','Applications','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','list','applications','orderBy','priority','asc','CmContact','contact','headers','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','created','autoclose','push','unmanaged','ChatMessage','UserId','User','unshift','queueId','ChatQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','notify','offline','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','ChatOfflineMessage','fromString','mimetype','server','attachments','openNewInteraction','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','originalname','subjectOffline','toPairsIn','mapValues','NotifyMailAccount','notifyMail','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','ids','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','getProactiveActions','virtual','increment','server/files/chat/iframe.ejs','URL','address','3.8.0','remote','x-real-ip','connection','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','sequelize','READ_COMMITTED','ChatApplication','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','getFields','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachment','Attachments','addAgents','spread','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','mustache','path','ejs','fs-extra','querystring','html-to-text','ioredis','jayson/promise'];(function(_0x1e7bdd,_0x216b81){var _0xcd343d=function(_0x5203cd){while(--_0x5203cd){_0x1e7bdd['push'](_0x1e7bdd['shift']());}};_0xcd343d(++_0x216b81);}(_0xb10b,0x12a));var _0xbb10=function(_0x504dc3,_0x547139){_0x504dc3=_0x504dc3-0x0;var _0x2d352c=_0xb10b[_0x504dc3];return _0x2d352c;};'use strict';var Mustache=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var ejs=require(_0xbb10('0x2'));var fs=require('fs');var fs_extra=require(_0xbb10('0x3'));var _=require('lodash');var querystring=require(_0xbb10('0x4'));var htmlToText=require(_0xbb10('0x5'));var Redis=require(_0xbb10('0x6'));var jayson=require(_0xbb10('0x7'));var url=require(_0xbb10('0x8'));var qs=require(_0xbb10('0x9'));var logger=require('../../config/logger')(_0xbb10('0xa'));var config=require(_0xbb10('0xb'));var APIOutOfIntervalError=require('../../errors/api')[_0xbb10('0xc')];var APINotFoundError=require(_0xbb10('0xd'))[_0xbb10('0xe')];var APIHandleError=require(_0xbb10('0xd'))[_0xbb10('0xf')];var db=require(_0xbb10('0x10'))['db'];config[_0xbb10('0x11')]=_[_0xbb10('0x12')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbb10('0x13'))(new Redis(config[_0xbb10('0x11')]));require(_0xbb10('0x14'))['register'](socket);var client=jayson[_0xbb10('0x15')]['http']({'port':0x232c});var client9002=jayson[_0xbb10('0x15')][_0xbb10('0x16')]({'port':0x232a});var client9003=jayson[_0xbb10('0x15')][_0xbb10('0x16')]({'port':0x232b});var client9001=jayson[_0xbb10('0x15')][_0xbb10('0x16')]({'port':0x2329});function respondWithRpcPromise(_0x58a612,_0x26e021,_0x42d7e4,_0x45b9d6){return new Promise(function(_0x17fd46,_0x3df17b){var _0x2f2ebf=_0x45b9d6||client;return _0x2f2ebf[_0xbb10('0x17')](_0x58a612,_0x42d7e4)[_0xbb10('0x18')](function(_0x3e26f4){logger[_0xbb10('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x26e021,_0xbb10('0x1a'));logger[_0xbb10('0x1b')](_0xbb10('0x1c'),_0x26e021,_0xbb10('0x1a'),JSON[_0xbb10('0x1d')](_0x3e26f4));if(_0x3e26f4[_0xbb10('0x1e')]){if(_0x3e26f4[_0xbb10('0x1e')][_0xbb10('0x1f')]===0x1f4){logger[_0xbb10('0x1e')](_0xbb10('0x20'),_0x26e021,_0x3e26f4['error'][_0xbb10('0x21')]);return _0x3df17b(_0x3e26f4[_0xbb10('0x1e')][_0xbb10('0x21')]);}logger[_0xbb10('0x1e')](_0xbb10('0x20'),_0x26e021,_0x3e26f4[_0xbb10('0x1e')]['message']);return _0x17fd46(_0x3e26f4[_0xbb10('0x1e')][_0xbb10('0x21')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x26e021,_0xbb10('0x1a'));_0x17fd46(_0x3e26f4[_0xbb10('0x22')][_0xbb10('0x21')]);}})[_0xbb10('0x23')](function(_0x445761){logger[_0xbb10('0x1e')](_0xbb10('0x20'),_0x26e021,_0x445761);_0x3df17b(_0x445761);});});}function respondWithStatusCode(_0x436104,_0x7f2377){_0x7f2377=_0x7f2377||0xcc;return function(_0x395404){if(_0x395404){return _0x436104[_0xbb10('0x24')](_0x7f2377);}return _0x436104[_0xbb10('0x25')](_0x7f2377)['end']();};}function respondWithResult(_0x4fedac,_0x4fb5e0){_0x4fb5e0=_0x4fb5e0||0xc8;return function(_0xc93a04){if(_0xc93a04){return _0x4fedac[_0xbb10('0x25')](_0x4fb5e0)[_0xbb10('0x26')](_0xc93a04);}};}function respondWithFilteredResult(_0x4e25ff,_0x2fdde9){return function(_0x24d586){if(_0x24d586){var _0x6ed43b=typeof _0x2fdde9[_0xbb10('0x27')]===_0xbb10('0x28')&&typeof _0x2fdde9[_0xbb10('0x29')]===_0xbb10('0x28');var _0x4aabb9=_0x24d586[_0xbb10('0x2a')];var _0x21ac54=_0x6ed43b?0x0:_0x2fdde9[_0xbb10('0x27')];var _0x2e0249=_0x6ed43b?_0x24d586[_0xbb10('0x2a')]:_0x2fdde9[_0xbb10('0x27')]+_0x2fdde9['limit'];var _0x221624;if(_0x2e0249>=_0x4aabb9){_0x2e0249=_0x4aabb9;_0x221624=0xc8;}else{_0x221624=0xce;}_0x4e25ff['status'](_0x221624);return _0x4e25ff[_0xbb10('0x2b')]('Content-Range',_0x21ac54+'-'+_0x2e0249+'/'+_0x4aabb9)[_0xbb10('0x26')](_0x24d586);}return null;};}function saveUpdates(_0x1dcc9c){return function(_0x1b59f9){if(_0x1b59f9){return _0x1b59f9['update'](_0x1dcc9c)['then'](function(_0x4c3744){return _0x4c3744;});}return null;};}function removeEntity(_0x34f65e){return function(_0x4f590d){if(_0x4f590d){return _0x4f590d[_0xbb10('0x2c')]()[_0xbb10('0x18')](function(){var _0x2f653f=_0x4f590d[_0xbb10('0x2d')]({'plain':!![]});var _0x37a83f=_0xbb10('0x2e');return db[_0xbb10('0x2f')]['destroy']({'where':{'type':_0x37a83f,'resourceId':_0x2f653f['id']}})[_0xbb10('0x18')](function(){return _0x4f590d;});})[_0xbb10('0x18')](function(){_0x34f65e[_0xbb10('0x25')](0xcc)[_0xbb10('0x30')]();});}};}function handleEntityNotFound(_0xfb2c5e){return function(_0x9de708){if(!_0x9de708){_0xfb2c5e[_0xbb10('0x24')](0x194);}return _0x9de708;};}function handleError(_0x10202c,_0x3c8d7d){_0x3c8d7d=_0x3c8d7d||0x1f4;return function(_0x56943c){logger[_0xbb10('0x1e')](_0x56943c[_0xbb10('0x31')]);if(_0x56943c[_0xbb10('0x32')]){delete _0x56943c[_0xbb10('0x32')];}_0x10202c['status'](_0x3c8d7d)[_0xbb10('0x33')](_0x56943c);};}function iftimePromise(_0x5de37b,_0x4e2754){return respondWithRpcPromise(_0xbb10('0x34'),_0xbb10('0x35'),{'command':_0x4e2754[_0xbb10('0x36')]?util[_0xbb10('0x37')](_0xbb10('0x38'),_0x5de37b[_0xbb10('0x39')],_0x4e2754['timezone']):util[_0xbb10('0x37')](_0xbb10('0x3a'),_0x5de37b['interval'])},client9002)['then'](function(_0x5cd55f){var _0x31bee3=_0x5cd55f&&_0x5cd55f[_0xbb10('0x3b')](_0xbb10('0x3c'))>=0x0?!![]:![];logger['info'](_0xbb10('0x3d'),_0x4e2754['id'],_0x5de37b['id'],_0x5de37b[_0xbb10('0x39')],_0x31bee3?_0xbb10('0x3e'):'OFFLINE',_0x4e2754[_0xbb10('0x36')]?_0x4e2754[_0xbb10('0x36')]:_0xbb10('0x3f'));return _0x31bee3;})[_0xbb10('0x23')](function(_0x4f1cdd){logger[_0xbb10('0x1e')](_0xbb10('0x3d'),_0x4e2754['id'],_0x5de37b['id'],_0x5de37b['interval'],util[_0xbb10('0x40')](_0x4f1cdd,{'showHidden':![],'depth':null}),_0x4e2754[_0xbb10('0x36')]?_0x4e2754[_0xbb10('0x36')]:_0xbb10('0x3f'));return![];});}function checkWebsiteIntervals(_0x2dd35a){var _0x185a52=_['map'](_0x2dd35a[_0xbb10('0x41')][_0xbb10('0x42')],function(_0x3e7b4c){var _0x3d3c41=_0x3e7b4c['get']({'plain':!![]});return iftimePromise(_0x3d3c41,_0x2dd35a);});return Promise[_0xbb10('0x43')](_0x185a52)[_0xbb10('0x18')](function(_0x23dc18){return _[_0xbb10('0x44')](_0x23dc18);});}function createInteractionObject(_0x5e2cfa,_0x351484,_0x202c60,_0x54ac18){var _0x5d9a4f=require(_0xbb10('0x45'));var _0x4a3ddf=new _0x5d9a4f();var _0x318984=_0x4a3ddf[_0xbb10('0x46')](_0x202c60['user-agent'])[_0xbb10('0x47')]();var _0x1d82bf=_0x351484[_0xbb10('0x48')];if(_0x202c60['cf-connecting-ip']){_0x1d82bf=_0x202c60[_0xbb10('0x49')];}else if(_0x202c60[_0xbb10('0x4a')]){_0x1d82bf=_[_0xbb10('0x4b')](_0x202c60[_0xbb10('0x4a')][_0xbb10('0x4c')](','));}return{'ContactId':_0x54ac18['id'],'ChatWebsiteId':_0x5e2cfa,'from':(_0x54ac18[_0xbb10('0x4d')]||'')+'\x20'+(_0x54ac18[_0xbb10('0x4e')]||''),'customerIp':_0x1d82bf,'customerPort':_0x202c60[_0xbb10('0x4f')]?_0x202c60[_0xbb10('0x4f')]:null,'referer':_0x351484[_0xbb10('0x50')],'browserName':_0x318984[_0xbb10('0x51')][_0xbb10('0x32')]&&_0x318984['browser'][_0xbb10('0x52')]?util[_0xbb10('0x37')]('%s\x20%s',_0x318984[_0xbb10('0x51')][_0xbb10('0x32')],_0x318984[_0xbb10('0x51')][_0xbb10('0x52')]):_0xbb10('0x53'),'browserVersion':_0x318984[_0xbb10('0x51')][_0xbb10('0x52')]||'unknown','osName':util['format'](_0xbb10('0x54'),_0x318984['os'][_0xbb10('0x32')],_0x318984['os'][_0xbb10('0x52')]),'osVersion':_0x318984['os']['version'],'deviceModel':_0x318984['device'][_0xbb10('0x55')]&&_0x318984[_0xbb10('0x56')][_0xbb10('0x57')]?util[_0xbb10('0x37')](_0xbb10('0x58'),_0x318984[_0xbb10('0x56')][_0xbb10('0x55')],_0x318984[_0xbb10('0x56')][_0xbb10('0x57')],_0x318984[_0xbb10('0x56')]['type']):null,'deviceVendor':_0x318984['device'][_0xbb10('0x57')],'deviceType':_0x318984[_0xbb10('0x56')][_0xbb10('0x59')],'formData':JSON[_0xbb10('0x1d')](_0x351484)};}exports[_0xbb10('0x5a')]=function(_0x440f9e,_0x358e7e){var _0x445870={'include':[{'model':db[_0xbb10('0x5b')],'as':_0xbb10('0x5c')}]},_0x1c0d8f={},_0x1214f7={'count':0x0,'rows':[]};var _0x61e689=_[_0xbb10('0x5d')](db[_0xbb10('0x5e')]['rawAttributes'],function(_0x124052){return{'name':_0x124052['fieldName'],'type':_0x124052[_0xbb10('0x59')][_0xbb10('0x5f')]};});_0x1c0d8f[_0xbb10('0x55')]=_[_0xbb10('0x5d')](_0x61e689,_0xbb10('0x32'));_0x1c0d8f[_0xbb10('0x60')]=_[_0xbb10('0x61')](_0x440f9e[_0xbb10('0x60')]);_0x1c0d8f[_0xbb10('0x62')]=_[_0xbb10('0x63')](_0x1c0d8f[_0xbb10('0x55')],_0x1c0d8f[_0xbb10('0x60')]);_0x445870[_0xbb10('0x64')]=_[_0xbb10('0x63')](_0x1c0d8f[_0xbb10('0x55')],qs['fields'](_0x440f9e[_0xbb10('0x60')][_0xbb10('0x65')]));_0x445870[_0xbb10('0x64')]=_0x445870[_0xbb10('0x64')][_0xbb10('0x66')]?_0x445870[_0xbb10('0x64')]:_0x1c0d8f['model'];if(!_0x440f9e[_0xbb10('0x60')][_0xbb10('0x67')](_0xbb10('0x68'))){_0x445870[_0xbb10('0x29')]=qs[_0xbb10('0x29')](_0x440f9e[_0xbb10('0x60')][_0xbb10('0x29')]);_0x445870[_0xbb10('0x27')]=qs[_0xbb10('0x27')](_0x440f9e[_0xbb10('0x60')][_0xbb10('0x27')]);}_0x445870[_0xbb10('0x69')]=qs[_0xbb10('0x6a')](_0x440f9e['query']['sort']);_0x445870[_0xbb10('0x6b')]=qs[_0xbb10('0x62')](_[_0xbb10('0x6c')](_0x440f9e[_0xbb10('0x60')],_0x1c0d8f['filters']),_0x61e689);if(_0x440f9e['query'][_0xbb10('0x6d')]){_0x445870[_0xbb10('0x6b')]=_[_0xbb10('0x6e')](_0x445870[_0xbb10('0x6b')],{'$or':_[_0xbb10('0x5d')](_0x61e689,function(_0x3e9753){if(_0x3e9753[_0xbb10('0x59')]!=='VIRTUAL'){var _0x117e84={};_0x117e84[_0x3e9753[_0xbb10('0x32')]]={'$like':'%'+_0x440f9e['query']['filter']+'%'};return _0x117e84;}})});}_0x445870=_['merge']({},_0x445870,_0x440f9e[_0xbb10('0x6f')]);var _0x31c727={'where':_0x445870[_0xbb10('0x6b')]};return db['ChatWebsite']['count'](_0x31c727)['then'](function(_0x3ebc5f){_0x1214f7[_0xbb10('0x2a')]=_0x3ebc5f;if(_0x440f9e[_0xbb10('0x60')]['includeAll']){_0x445870[_0xbb10('0x70')]=[{'all':!![]}];}return db[_0xbb10('0x5e')]['findAll'](_0x445870);})['then'](function(_0x27d7b9){_0x1214f7[_0xbb10('0x71')]=_0x27d7b9;return _0x1214f7;})[_0xbb10('0x18')](respondWithFilteredResult(_0x358e7e,_0x445870))[_0xbb10('0x23')](handleError(_0x358e7e,null));};exports['show']=function(_0x43eaec,_0xec48ac){var _0xa7179d={'raw':![],'where':{'id':_0x43eaec[_0xbb10('0x72')]['id']},'include':[{'model':db[_0xbb10('0x5b')],'as':_0xbb10('0x5c')}]},_0x5202d7={};_0x5202d7['model']=_[_0xbb10('0x61')](db[_0xbb10('0x5e')][_0xbb10('0x73')]);_0x5202d7[_0xbb10('0x60')]=_['keys'](_0x43eaec[_0xbb10('0x60')]);_0x5202d7[_0xbb10('0x62')]=_[_0xbb10('0x63')](_0x5202d7[_0xbb10('0x55')],_0x5202d7['query']);_0xa7179d[_0xbb10('0x64')]=_[_0xbb10('0x63')](_0x5202d7[_0xbb10('0x55')],qs[_0xbb10('0x65')](_0x43eaec[_0xbb10('0x60')][_0xbb10('0x65')]));_0xa7179d[_0xbb10('0x64')]=_0xa7179d['attributes']['length']?_0xa7179d['attributes']:_0x5202d7[_0xbb10('0x55')];if(_0x43eaec[_0xbb10('0x60')][_0xbb10('0x74')]){_0xa7179d['include']=[{'all':!![]}];}_0xa7179d=_['merge']({},_0xa7179d,_0x43eaec[_0xbb10('0x6f')]);return db[_0xbb10('0x5e')][_0xbb10('0x75')](_0xa7179d)[_0xbb10('0x18')](handleEntityNotFound(_0xec48ac,null))[_0xbb10('0x18')](respondWithResult(_0xec48ac,null))[_0xbb10('0x23')](handleError(_0xec48ac,null));};exports['create']=function(_0x1a5ca5,_0x15fae2){return db[_0xbb10('0x5e')][_0xbb10('0x76')](_0x1a5ca5[_0xbb10('0x77')],{})['then'](function(_0x56094a){var _0x5ad6ad=_0x1a5ca5[_0xbb10('0x78')][_0xbb10('0x2d')]({'plain':!![]});if(!_0x5ad6ad)throw new Error(_0xbb10('0x79'));if(_0x5ad6ad[_0xbb10('0x7a')]===_0xbb10('0x78')){var _0x1d40b8=_0x56094a['get']({'plain':!![]});var _0x93f3c4='ChatWebsites';return db['UserProfileSection']['find']({'where':{'name':_0x93f3c4,'userProfileId':_0x5ad6ad[_0xbb10('0x7b')]},'raw':!![]})[_0xbb10('0x18')](function(_0x23b1d5){if(_0x23b1d5&&_0x23b1d5[_0xbb10('0x7c')]===0x0){return db['UserProfileResource'][_0xbb10('0x76')]({'name':_0x1d40b8['name'],'resourceId':_0x1d40b8['id'],'type':_0x23b1d5['name'],'sectionId':_0x23b1d5['id']},{})[_0xbb10('0x18')](function(){return _0x56094a;});}else{return _0x56094a;}})[_0xbb10('0x23')](function(_0x29529c){logger[_0xbb10('0x1e')](_0xbb10('0x7d'),_0x29529c);throw _0x29529c;});}return _0x56094a;})['then'](respondWithResult(_0x15fae2,0xc9))[_0xbb10('0x23')](handleError(_0x15fae2,null));};exports[_0xbb10('0x7e')]=function(_0x2c6429,_0x3f3d38){if(_0x2c6429[_0xbb10('0x77')]['id']){delete _0x2c6429[_0xbb10('0x77')]['id'];}return db[_0xbb10('0x5e')]['find']({'where':{'id':_0x2c6429[_0xbb10('0x72')]['id']},'include':[{'model':db[_0xbb10('0x5b')],'as':_0xbb10('0x5c')}]})[_0xbb10('0x18')](handleEntityNotFound(_0x3f3d38,null))[_0xbb10('0x18')](saveUpdates(_0x2c6429[_0xbb10('0x77')],null))[_0xbb10('0x18')](respondWithResult(_0x3f3d38,null))[_0xbb10('0x23')](handleError(_0x3f3d38,null));};exports['destroy']=function(_0x428146,_0x218690){return db[_0xbb10('0x5e')]['find']({'where':{'id':_0x428146['params']['id']}})['then'](handleEntityNotFound(_0x218690,null))[_0xbb10('0x18')](removeEntity(_0x218690,null))['catch'](handleError(_0x218690,null));};exports['describe']=function(_0x1701c5,_0x3ee56b){return db[_0xbb10('0x5e')][_0xbb10('0x7f')]()[_0xbb10('0x18')](respondWithResult(_0x3ee56b,null))[_0xbb10('0x23')](handleError(_0x3ee56b,null));};exports[_0xbb10('0x80')]=function(_0x417304,_0x188b97){if(_0x417304['body']['id']){delete _0x417304[_0xbb10('0x77')]['id'];}return db[_0xbb10('0x5e')][_0xbb10('0x75')]({'where':{'id':_0x417304[_0xbb10('0x72')]['id']}})['then'](handleEntityNotFound(_0x188b97,null))['then'](function(_0x3547a3){if(_0x3547a3){_0x417304[_0xbb10('0x77')][_0xbb10('0x81')]=_0x3547a3['id'];return db[_0xbb10('0x82')]['create'](_0x417304[_0xbb10('0x77')]);}})[_0xbb10('0x18')](respondWithResult(_0x188b97,null))[_0xbb10('0x23')](handleError(_0x188b97,null));};exports[_0xbb10('0x83')]=function(_0x35c1e8,_0x517185){var _0x5f0691={'raw':![],'where':{}};var _0x372636={};var _0x53c698={'count':0x0,'rows':[]};return db[_0xbb10('0x5e')]['findOne']({'where':{'id':_0x35c1e8[_0xbb10('0x72')]['id']}})[_0xbb10('0x18')](handleEntityNotFound(_0x517185,null))['then'](function(_0x5caa06){if(_0x5caa06){_0x372636[_0xbb10('0x55')]=_[_0xbb10('0x61')](db[_0xbb10('0x82')]['rawAttributes']);_0x372636[_0xbb10('0x60')]=_[_0xbb10('0x61')](_0x35c1e8[_0xbb10('0x60')]);_0x372636[_0xbb10('0x62')]=_[_0xbb10('0x63')](_0x372636[_0xbb10('0x55')],_0x372636[_0xbb10('0x60')]);_0x5f0691[_0xbb10('0x64')]=_[_0xbb10('0x63')](_0x372636['model'],qs[_0xbb10('0x65')](_0x35c1e8[_0xbb10('0x60')][_0xbb10('0x65')]));_0x5f0691[_0xbb10('0x64')]=_0x5f0691[_0xbb10('0x64')][_0xbb10('0x66')]?_0x5f0691[_0xbb10('0x64')]:_0x372636[_0xbb10('0x55')];if(!_0x35c1e8[_0xbb10('0x60')][_0xbb10('0x67')](_0xbb10('0x68'))){_0x5f0691[_0xbb10('0x29')]=qs['limit'](_0x35c1e8['query'][_0xbb10('0x29')]);_0x5f0691[_0xbb10('0x27')]=qs[_0xbb10('0x27')](_0x35c1e8[_0xbb10('0x60')][_0xbb10('0x27')]);}_0x5f0691['order']=qs[_0xbb10('0x6a')](_0x35c1e8[_0xbb10('0x60')][_0xbb10('0x6a')]);_0x5f0691[_0xbb10('0x6b')]=qs[_0xbb10('0x62')](_[_0xbb10('0x6c')](_0x35c1e8['query'],_0x372636[_0xbb10('0x62')]));_0x5f0691[_0xbb10('0x6b')]['ChatWebsiteId']=_0x5caa06['id'];if(_0x35c1e8[_0xbb10('0x60')]['filter']){_0x5f0691[_0xbb10('0x6b')]=_[_0xbb10('0x6e')](_0x5f0691[_0xbb10('0x6b')],{'$or':_[_0xbb10('0x5d')](_0x5f0691[_0xbb10('0x64')],function(_0x556d7b){var _0x10d91d={};_0x10d91d[_0x556d7b]={'$like':'%'+_0x35c1e8['query'][_0xbb10('0x6d')]+'%'};return _0x10d91d;})});}_0x5f0691=_[_0xbb10('0x6e')]({},_0x5f0691,_0x35c1e8['options']);return db['Disposition'][_0xbb10('0x2a')]({'where':_0x5f0691[_0xbb10('0x6b')]})[_0xbb10('0x18')](function(_0x283bab){_0x53c698[_0xbb10('0x2a')]=_0x283bab;if(_0x35c1e8[_0xbb10('0x60')][_0xbb10('0x74')]){_0x5f0691[_0xbb10('0x70')]=[{'all':!![]}];}return db[_0xbb10('0x82')][_0xbb10('0x84')](_0x5f0691);})[_0xbb10('0x18')](function(_0x4c0b83){_0x53c698[_0xbb10('0x71')]=_0x4c0b83;return _0x53c698;});}})[_0xbb10('0x18')](respondWithFilteredResult(_0x517185,_0x5f0691))[_0xbb10('0x23')](handleError(_0x517185,null));};exports[_0xbb10('0x85')]=function(_0xfe02f5,_0x86a6ff){return db[_0xbb10('0x5e')][_0xbb10('0x75')]({'where':{'id':_0xfe02f5[_0xbb10('0x72')]['id']}})[_0xbb10('0x18')](handleEntityNotFound(_0x86a6ff,null))[_0xbb10('0x18')](function(_0x2d3e98){if(_0x2d3e98){return _0x2d3e98['removeDispositions'](_0xfe02f5[_0xbb10('0x60')]['ids']);}})[_0xbb10('0x18')](respondWithStatusCode(_0x86a6ff,null))[_0xbb10('0x23')](handleError(_0x86a6ff,null));};exports[_0xbb10('0x86')]=function(_0x40236c,_0x38d369){if(_0x40236c['body']['id']){delete _0x40236c[_0xbb10('0x77')]['id'];}return db[_0xbb10('0x5e')][_0xbb10('0x75')]({'where':{'id':_0x40236c[_0xbb10('0x72')]['id']}})[_0xbb10('0x18')](handleEntityNotFound(_0x38d369,null))[_0xbb10('0x18')](function(_0x4970fe){if(_0x4970fe){_0x40236c['body'][_0xbb10('0x81')]=_0x4970fe['id'];return db[_0xbb10('0x87')][_0xbb10('0x76')](_0x40236c['body']);}})[_0xbb10('0x18')](respondWithResult(_0x38d369,null))[_0xbb10('0x23')](handleError(_0x38d369,null));};exports['getAnswers']=function(_0x2831de,_0xaede56){var _0x5642c3={'raw':![],'where':{}};var _0xdd3c7e={};var _0x4d7bca={'count':0x0,'rows':[]};return db[_0xbb10('0x5e')][_0xbb10('0x88')]({'where':{'id':_0x2831de['params']['id']}})[_0xbb10('0x18')](handleEntityNotFound(_0xaede56,null))[_0xbb10('0x18')](function(_0x4bac29){if(_0x4bac29){_0xdd3c7e['model']=_[_0xbb10('0x61')](db[_0xbb10('0x87')][_0xbb10('0x73')]);_0xdd3c7e[_0xbb10('0x60')]=_[_0xbb10('0x61')](_0x2831de['query']);_0xdd3c7e[_0xbb10('0x62')]=_[_0xbb10('0x63')](_0xdd3c7e[_0xbb10('0x55')],_0xdd3c7e['query']);_0x5642c3[_0xbb10('0x64')]=_[_0xbb10('0x63')](_0xdd3c7e[_0xbb10('0x55')],qs[_0xbb10('0x65')](_0x2831de[_0xbb10('0x60')][_0xbb10('0x65')]));_0x5642c3[_0xbb10('0x64')]=_0x5642c3[_0xbb10('0x64')][_0xbb10('0x66')]?_0x5642c3['attributes']:_0xdd3c7e['model'];if(!_0x2831de[_0xbb10('0x60')][_0xbb10('0x67')](_0xbb10('0x68'))){_0x5642c3[_0xbb10('0x29')]=qs[_0xbb10('0x29')](_0x2831de[_0xbb10('0x60')][_0xbb10('0x29')]);_0x5642c3[_0xbb10('0x27')]=qs[_0xbb10('0x27')](_0x2831de[_0xbb10('0x60')][_0xbb10('0x27')]);}_0x5642c3[_0xbb10('0x69')]=qs[_0xbb10('0x6a')](_0x2831de['query'][_0xbb10('0x6a')]);_0x5642c3[_0xbb10('0x6b')]=qs[_0xbb10('0x62')](_[_0xbb10('0x6c')](_0x2831de[_0xbb10('0x60')],_0xdd3c7e[_0xbb10('0x62')]));_0x5642c3[_0xbb10('0x6b')][_0xbb10('0x81')]=_0x4bac29['id'];if(_0x2831de[_0xbb10('0x60')][_0xbb10('0x6d')]){_0x5642c3[_0xbb10('0x6b')]=_['merge'](_0x5642c3[_0xbb10('0x6b')],{'$or':_['map'](_0x5642c3[_0xbb10('0x64')],function(_0x22ae3c){var _0x25b1b3={};_0x25b1b3[_0x22ae3c]={'$like':'%'+_0x2831de[_0xbb10('0x60')][_0xbb10('0x6d')]+'%'};return _0x25b1b3;})});}_0x5642c3=_[_0xbb10('0x6e')]({},_0x5642c3,_0x2831de['options']);return db[_0xbb10('0x87')]['count']({'where':_0x5642c3[_0xbb10('0x6b')]})[_0xbb10('0x18')](function(_0xda122){_0x4d7bca[_0xbb10('0x2a')]=_0xda122;if(_0x2831de[_0xbb10('0x60')][_0xbb10('0x74')]){_0x5642c3[_0xbb10('0x70')]=[{'all':!![]}];}return db[_0xbb10('0x87')][_0xbb10('0x84')](_0x5642c3);})[_0xbb10('0x18')](function(_0x13efa1){_0x4d7bca[_0xbb10('0x71')]=_0x13efa1;return _0x4d7bca;});}})['then'](respondWithFilteredResult(_0xaede56,_0x5642c3))[_0xbb10('0x23')](handleError(_0xaede56,null));};exports['removeAnswers']=function(_0xe70161,_0x36e9b0){return db[_0xbb10('0x5e')][_0xbb10('0x75')]({'where':{'id':_0xe70161[_0xbb10('0x72')]['id']}})[_0xbb10('0x18')](handleEntityNotFound(_0x36e9b0,null))[_0xbb10('0x18')](function(_0x5e9888){if(_0x5e9888){return _0x5e9888[_0xbb10('0x89')](_0xe70161['query']['ids']);}})[_0xbb10('0x18')](respondWithStatusCode(_0x36e9b0,null))[_0xbb10('0x23')](handleError(_0x36e9b0,null));};exports[_0xbb10('0x8a')]=function(_0x1fd88a,_0x1fc4ec){_0x1fd88a[_0xbb10('0x77')]['sitepic']=_0x1fd88a[_0xbb10('0x8b')][_0xbb10('0x8c')];return db[_0xbb10('0x5e')][_0xbb10('0x75')]({'where':{'id':_0x1fd88a[_0xbb10('0x72')]['id']}})[_0xbb10('0x18')](handleEntityNotFound(_0x1fc4ec,null))['then'](saveUpdates(_0x1fd88a[_0xbb10('0x77')],null))[_0xbb10('0x18')](respondWithResult(_0x1fc4ec,null))[_0xbb10('0x23')](handleError(_0x1fc4ec,null));};exports[_0xbb10('0x8d')]=function(_0x31718f,_0x5ecb87){_0x31718f[_0xbb10('0x77')]['agentAvatar']=_0x31718f[_0xbb10('0x8b')]['filename'];return db[_0xbb10('0x5e')]['find']({'where':{'id':_0x31718f['params']['id']}})[_0xbb10('0x18')](handleEntityNotFound(_0x5ecb87,null))[_0xbb10('0x18')](saveUpdates(_0x31718f[_0xbb10('0x77')],null))[_0xbb10('0x18')](respondWithResult(_0x5ecb87,null))[_0xbb10('0x23')](handleError(_0x5ecb87,null));};exports['addCustomerAvatar']=function(_0xa42b80,_0x565ddf){_0xa42b80['body']['customerAvatar']=_0xa42b80[_0xbb10('0x8b')][_0xbb10('0x8c')];return db[_0xbb10('0x5e')][_0xbb10('0x75')]({'where':{'id':_0xa42b80[_0xbb10('0x72')]['id']}})['then'](handleEntityNotFound(_0x565ddf,null))[_0xbb10('0x18')](saveUpdates(_0xa42b80[_0xbb10('0x77')],null))[_0xbb10('0x18')](respondWithResult(_0x565ddf,null))[_0xbb10('0x23')](handleError(_0x565ddf,null));};exports[_0xbb10('0x8e')]=function(_0x37ff15,_0x2ef6ee){_0x37ff15['body']['systemAvatar']=_0x37ff15['file'][_0xbb10('0x8c')];return db[_0xbb10('0x5e')][_0xbb10('0x75')]({'where':{'id':_0x37ff15[_0xbb10('0x72')]['id']}})[_0xbb10('0x18')](handleEntityNotFound(_0x2ef6ee,null))[_0xbb10('0x18')](saveUpdates(_0x37ff15[_0xbb10('0x77')],null))[_0xbb10('0x18')](respondWithResult(_0x2ef6ee,null))[_0xbb10('0x23')](handleError(_0x2ef6ee,null));};exports[_0xbb10('0x8f')]=function(_0x4cc8d4,_0x58295f){var _0x4dce53=path[_0xbb10('0x90')](config[_0xbb10('0x91')],_0xbb10('0x92'));var _0x47c820={'where':{'id':_0x4cc8d4[_0xbb10('0x72')]['id']},'attributes':['id',_0xbb10('0x93')],'raw':!![]};var _0x2c638d=![];return require(_0xbb10('0x94'))[_0xbb10('0x95')]()[_0xbb10('0x18')](function(_0x485f46){if(_0x485f46){_0x2c638d=_0x485f46['custom'];}})[_0xbb10('0x18')](function(){return db['ChatWebsite'][_0xbb10('0x75')](_0x47c820);})[_0xbb10('0x18')](handleEntityNotFound(_0x58295f,null))[_0xbb10('0x18')](function(_0x15dcde){if(_0x15dcde){if(!_[_0xbb10('0x96')](_0x15dcde[_0xbb10('0x93')])){if(fs[_0xbb10('0x97')](path[_0xbb10('0x90')](config[_0xbb10('0x91')],_0xbb10('0x98'),_0x15dcde['sitepic']))&&_0x2c638d){_0x4dce53=path[_0xbb10('0x90')](config['root'],_0xbb10('0x98'),_0x15dcde['sitepic']);}}return _0x58295f[_0xbb10('0x99')](_0x4dce53);}})[_0xbb10('0x23')](handleError(_0x58295f,null));};exports[_0xbb10('0x9a')]=function(_0x373c0e,_0x5ee229){var _0xcc246f=path['join'](config[_0xbb10('0x91')],_0xbb10('0x9b'));var _0xcdaf04={'where':{'id':_0x373c0e['params']['id']},'attributes':['id',_0xbb10('0x9c')],'raw':!![]};return db[_0xbb10('0x5e')][_0xbb10('0x75')](_0xcdaf04)[_0xbb10('0x18')](handleEntityNotFound(_0x5ee229,null))[_0xbb10('0x18')](function(_0x309ec1){if(_0x309ec1){if(!_['isNil'](_0x309ec1['agentAvatar'])){if(fs['existsSync'](path[_0xbb10('0x90')](config['root'],_0xbb10('0x9d'),_0x309ec1['agentAvatar']))){_0xcc246f=path[_0xbb10('0x90')](config[_0xbb10('0x91')],_0xbb10('0x9d'),_0x309ec1['agentAvatar']);}}return _0x5ee229['download'](_0xcc246f);}})[_0xbb10('0x23')](handleError(_0x5ee229,null));};exports[_0xbb10('0x9e')]=function(_0x443e56,_0x59b20f){var _0x440108=path[_0xbb10('0x90')](config[_0xbb10('0x91')],'server/files/images/avatars/customer_avatar.png');var _0x47d144={'where':{'id':_0x443e56['params']['id']},'attributes':['id',_0xbb10('0x9f'),'showCustomerAvatar'],'raw':!![]};return db[_0xbb10('0x5e')][_0xbb10('0x75')](_0x47d144)[_0xbb10('0x18')](handleEntityNotFound(_0x59b20f,null))[_0xbb10('0x18')](function(_0x365238){if(_0x365238){if(!_[_0xbb10('0x96')](_0x365238[_0xbb10('0x9f')])){if(fs[_0xbb10('0x97')](path[_0xbb10('0x90')](config[_0xbb10('0x91')],_0xbb10('0x9d'),_0x365238['customerAvatar']))&&_0x365238[_0xbb10('0xa0')]){_0x440108=path[_0xbb10('0x90')](config['root'],_0xbb10('0x9d'),_0x365238['customerAvatar']);}}return _0x59b20f['download'](_0x440108);}})[_0xbb10('0x23')](handleError(_0x59b20f,null));};exports[_0xbb10('0xa1')]=function(_0x35a78e,_0x2fa574){var _0x99c4=path['join'](config[_0xbb10('0x91')],_0xbb10('0xa2'));var _0x4f17c1={'where':{'id':_0x35a78e[_0xbb10('0x72')]['id']},'attributes':['id',_0xbb10('0xa3')],'raw':!![]};return db['ChatWebsite'][_0xbb10('0x75')](_0x4f17c1)['then'](handleEntityNotFound(_0x2fa574,null))[_0xbb10('0x18')](function(_0x8e8049){if(_0x8e8049){if(!_[_0xbb10('0x96')](_0x8e8049[_0xbb10('0xa3')])){if(fs[_0xbb10('0x97')](path[_0xbb10('0x90')](config[_0xbb10('0x91')],'server/files/images/avatars/',_0x8e8049[_0xbb10('0xa3')]))){_0x99c4=path[_0xbb10('0x90')](config[_0xbb10('0x91')],_0xbb10('0x9d'),_0x8e8049[_0xbb10('0xa3')]);}}return _0x2fa574[_0xbb10('0x99')](_0x99c4);}})['catch'](handleError(_0x2fa574,null));};exports['notify']=function(_0x5a40e8,_0x23849e){var _0x377e6a={'body':_0x5a40e8[_0xbb10('0x77')],'channel':_0xbb10('0xa4')};var _0x57700b=[];var _0x3b01a3=[];var _0x3d7b4d={};var _0x468e26=![];return db['CmContact']['describe']()[_0xbb10('0x18')](function(_0x4b5b66){if(!_0x4b5b66){throw new db[(_0xbb10('0xa5'))][(_0xbb10('0xa6'))](_0xbb10('0xa7'));}_0x57700b=_[_0xbb10('0xa8')](_[_0xbb10('0x61')](_0x4b5b66),[_0xbb10('0xa9'),_0xbb10('0xaa')]);_0x3b01a3=_['difference'](_[_0xbb10('0x61')](_0x4b5b66),[_0xbb10('0xa9'),'updatedAt',_0xbb10('0xab'),_0xbb10('0xac')]);if(_0x5a40e8[_0xbb10('0x77')]['id']){delete _0x5a40e8['body']['id'];}if(_['isNil'](_0x5a40e8['body'][_0xbb10('0xad')])){throw new db[(_0xbb10('0xa5'))]['ValidationError'](_0xbb10('0xae'));}if(_[_0xbb10('0x96')](_0x5a40e8[_0xbb10('0x77')][_0xbb10('0x77')])||_0x5a40e8[_0xbb10('0x77')][_0xbb10('0x77')]===''){throw new db[(_0xbb10('0xa5'))]['ValidationError'](_0xbb10('0xaf'));}if(_['isNil'](_0x5a40e8['body']['mapKey'])){throw new db[(_0xbb10('0xa5'))][(_0xbb10('0xa6'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3b01a3);}if(!_[_0xbb10('0xb0')](_0x3b01a3,_0x5a40e8['body'][_0xbb10('0xb1')])){throw new db[(_0xbb10('0xa5'))][(_0xbb10('0xa6'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3b01a3);}_0x3d7b4d[_0x5a40e8['body'][_0xbb10('0xb1')]]=_0x5a40e8['body'][_0xbb10('0xad')];})[_0xbb10('0x18')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x5a40e8[_0xbb10('0x72')]['id']},'include':[{'model':db[_0xbb10('0xb2')],'as':_0xbb10('0xb3'),'include':[{'model':db['CmContact'],'as':_0xbb10('0xb4'),'where':_0x3d7b4d,'limit':0x1,'order':[[_0xbb10('0xaa'),_0xbb10('0xb5')]]}]},{'model':db['ChatApplication'],'as':_0xbb10('0xb6')},{'model':db[_0xbb10('0x41')],'as':_0xbb10('0x41'),'include':[{'model':db[_0xbb10('0x41')],'as':_0xbb10('0x42'),'attributes':['id',_0xbb10('0x39')],'raw':!![]}]}]});})[_0xbb10('0x18')](function(_0x1583cb){if(!_0x1583cb)throw new APINotFoundError(util[_0xbb10('0x37')](_0xbb10('0xb7'),_0x5a40e8[_0xbb10('0x72')]['id']));if(!_0x1583cb[_0xbb10('0x41')]||!_0x1583cb[_0xbb10('0x41')]['Intervals'])return[_0x1583cb,!![]];return[_0x1583cb,checkWebsiteIntervals(_0x1583cb)];})['spread'](function(_0x196be4,_0x52767a){if(!_0x52767a)throw new APIOutOfIntervalError();if(!_0x196be4[_0xbb10('0xb3')])return;_0x377e6a[_0xbb10('0xb8')]=_0x196be4;_0x377e6a[_0xbb10('0xb9')]=_0x196be4['List'];_0x377e6a[_0xbb10('0xba')]=_[_0xbb10('0xbb')](_0x196be4[_0xbb10('0xb6')],[_0xbb10('0xbc')],[_0xbb10('0xbd')]);if(_0x377e6a['account'][_0xbb10('0xb6')]){delete _0x377e6a[_0xbb10('0xb8')][_0xbb10('0xb6')];}if(_0x377e6a[_0xbb10('0xb8')][_0xbb10('0xb3')]&&_0x377e6a[_0xbb10('0xb8')]['List'][_0xbb10('0xb4')][_0xbb10('0x66')]){return _0x377e6a['account'][_0xbb10('0xb3')][_0xbb10('0xb4')][0x0];}var _0x2d0de5=_[_0xbb10('0x12')](_0x5a40e8[_0xbb10('0x77')],{'firstName':_0x5a40e8[_0xbb10('0x77')][_0xbb10('0xad')],'ListId':_0x196be4[_0xbb10('0xac')]});_0x2d0de5[_0x5a40e8[_0xbb10('0x77')][_0xbb10('0xb1')]]=_0x5a40e8[_0xbb10('0x77')][_0xbb10('0xad')];return db[_0xbb10('0xbe')][_0xbb10('0x76')](_0x2d0de5,{'fields':_0x57700b,'raw':!![]});})[_0xbb10('0x18')](function(_0x4dff47){_0x377e6a[_0xbb10('0xbf')]=_0x4dff47;var _0x6b5fb3=createInteractionObject(_0x5a40e8['params']['id'],_0x5a40e8['body'],_0x5a40e8[_0xbb10('0xc0')],_0x4dff47);var _0x230dd8={'ChatWebsiteId':_0x5a40e8[_0xbb10('0x72')]['id'],'closed':![]};if(_0x5a40e8[_0xbb10('0x77')][_0xbb10('0xc1')]){_0x230dd8[_0xbb10('0xc1')]=_0x5a40e8[_0xbb10('0x77')][_0xbb10('0xc1')];return db[_0xbb10('0xc2')]['find']({'where':_0x230dd8})['then'](function(_0x4e0cfb){if(_0x4e0cfb){_0x468e26=!![];return _0x4e0cfb;}_0x6b5fb3['threadId']=_0x5a40e8['body']['threadId'];_0x6b5fb3[_0xbb10('0xc3')]=_0x5a40e8[_0xbb10('0x77')][_0xbb10('0xc3')];return db[_0xbb10('0xc2')]['create'](_0x6b5fb3);});}_0x230dd8[_0xbb10('0xc4')]=_0x4dff47['id'];if(_0x5a40e8[_0xbb10('0x77')][_0xbb10('0xc5')]&&_0x5a40e8[_0xbb10('0x77')]['interaction']['id']){_0x230dd8['id']=_0x5a40e8['body'][_0xbb10('0xc5')]['id'];return db[_0xbb10('0xc2')]['find']({'where':_0x230dd8})['then'](function(_0x154a91){if(_0x154a91){_0x468e26=!![];return _0x154a91;}return db[_0xbb10('0xc2')][_0xbb10('0x76')](_0x6b5fb3);});}return db[_0xbb10('0xc2')][_0xbb10('0x76')](_0x6b5fb3);})['then'](function(_0x4744f4){if(!_0x468e26)return _0x4744f4;var _0x5382e9={'from':(_0x377e6a['contact'][_0xbb10('0x4d')]||'')+'\x20'+(_0x377e6a[_0xbb10('0xbf')][_0xbb10('0x4e')]||'')};if(_0x5a40e8[_0xbb10('0x77')][_0xbb10('0xc1')]&&_0x5a40e8[_0xbb10('0x77')]['messageId']&&_0x5a40e8[_0xbb10('0x77')][_0xbb10('0xc1')]!=_0x5a40e8[_0xbb10('0x77')][_0xbb10('0xc6')]){_0x5382e9[_0xbb10('0xc1')]=_0x5a40e8[_0xbb10('0x77')][_0xbb10('0xc6')];}return _0x4744f4[_0xbb10('0x7e')](_0x5382e9);})[_0xbb10('0x18')](function(_0x16f3ce){_0x377e6a[_0xbb10('0xc5')]=_0x16f3ce[_0xbb10('0x2d')]({'plain':!![]});_0x377e6a[_0xbb10('0xc5')][_0xbb10('0xc7')]=!_0x468e26;if(_0x377e6a[_0xbb10('0xc5')][_0xbb10('0xc7')]){if(_0x377e6a[_0xbb10('0xb8')][_0xbb10('0xc8')]){_0x377e6a[_0xbb10('0xba')][_0xbb10('0xc9')]({'id':0x0,'priority':_0x377e6a[_0xbb10('0xba')][_0xbb10('0x66')]+0x1,'app':'close','appdata':_0xbb10('0xca'),'interval':'*,*,*,*'});}}return db[_0xbb10('0xcb')][_0xbb10('0x76')]({'body':_0x5a40e8[_0xbb10('0x77')][_0xbb10('0x77')],'ChatWebsiteId':_0x5a40e8[_0xbb10('0x72')]['id'],'ChatInteractionId':_0x16f3ce['id'],'direction':'in','ContactId':_0x377e6a['contact']['id'],'AttachmentId':_0x5a40e8['body']['AttachmentId']});})[_0xbb10('0x18')](function(_0x2fac6c){_0x377e6a['message']=_0x2fac6c;if(!_0x377e6a[_0xbb10('0xc5')][_0xbb10('0xcc')]){return;}return db[_0xbb10('0xcd')]['find']({'attributes':['id',_0xbb10('0x32')],'where':{'id':_0x377e6a[_0xbb10('0xc5')][_0xbb10('0xcc')]}});})['then'](function(_0x46de6a){if(_0x46de6a){_0x377e6a['applications'][_0xbb10('0xce')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x46de6a['name']+','+(_0x377e6a['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x377e6a['forcedOwnership']=!![];}if(!_0x377e6a[_0xbb10('0xc5')][_0xbb10('0xcf')]){return;}return db[_0xbb10('0xd0')][_0xbb10('0x75')]({'attributes':['id','name'],'where':{'id':_0x377e6a[_0xbb10('0xc5')][_0xbb10('0xcf')]}});})[_0xbb10('0x18')](function(_0x37bc34){if(_0x37bc34){_0x377e6a[_0xbb10('0xba')][_0xbb10('0xce')]({'id':0x0,'priority':0x1,'app':_0xbb10('0xd1'),'appdata':_0x37bc34[_0xbb10('0x32')]+','+(_0x377e6a[_0xbb10('0xb8')][_0xbb10('0xd2')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xbb10('0xd3'),_0xbb10('0xd4'),_0x377e6a);})[_0xbb10('0x18')](function(_0x5c5ecc){respondWithRpcPromise(_0xbb10('0xd5'),_0xbb10('0xd5'),{'event':_0xbb10('0xd6'),'message':_0x5c5ecc},client9002);return _0x5c5ecc;})[_0xbb10('0x18')](respondWithResult(_0x23849e,null))['catch'](APIHandleError(_0x23849e));};exports[_0xbb10('0xd7')]=function(_0xddfe35,_0x604d55){var _0x22ec50,_0x40eb16,_0x3ff3fe;var _0x38eb3d=[];var _0x1c0529={};var _0x3522cd=_0xddfe35[_0xbb10('0xd8')]||[];var _0x3c01ff=[];var _0x4d65e7;return db[_0xbb10('0xbe')][_0xbb10('0x7f')]()['then'](function(_0x5eb1fb){if(!_0x5eb1fb){throw new db[(_0xbb10('0xa5'))][(_0xbb10('0xa6'))]('no\x20available\x20attributes');}_0x38eb3d=_[_0xbb10('0xa8')](_[_0xbb10('0x61')](_0x5eb1fb),['createdAt',_0xbb10('0xaa'),_0xbb10('0xab'),_0xbb10('0xac')]);if(_0xddfe35[_0xbb10('0x77')]['id']){delete _0xddfe35[_0xbb10('0x77')]['id'];}if(_['isNil'](_0xddfe35['body']['from'])){throw _0x604d55[_0xbb10('0x25')](0x1f4)['send'](new db[(_0xbb10('0xa5'))]['ValidationError']('from\x20is\x20mandatory'));}if(_[_0xbb10('0x96')](_0xddfe35[_0xbb10('0x77')][_0xbb10('0x77')])||_0xddfe35[_0xbb10('0x77')][_0xbb10('0x77')]===''){throw _0x604d55[_0xbb10('0x25')](0x1f4)['send'](new db['Sequelize']['ValidationError'](_0xbb10('0xaf')));}if(_[_0xbb10('0x96')](_0xddfe35[_0xbb10('0x77')][_0xbb10('0xd9')])){throw _0x604d55[_0xbb10('0x25')](0x1f4)[_0xbb10('0x33')](new db[(_0xbb10('0xa5'))]['ValidationError'](_0xbb10('0xda')+_0x38eb3d));}if(!_[_0xbb10('0xb0')](_0x38eb3d,_0xddfe35[_0xbb10('0x77')][_0xbb10('0xd9')])){throw _0x604d55['status'](0x1f4)[_0xbb10('0x33')](new db['Sequelize']['ValidationError'](_0xbb10('0xdb')+_0x38eb3d));}_0x1c0529[_0xddfe35[_0xbb10('0x77')][_0xbb10('0xd9')]]=_0xddfe35[_0xbb10('0x77')][_0xbb10('0xad')];})[_0xbb10('0x18')](function(){return db['ChatWebsite'][_0xbb10('0x75')]({'where':{'id':_0xddfe35[_0xbb10('0x72')]['id']},'include':[{'model':db[_0xbb10('0xb2')],'as':_0xbb10('0xb3')},{'model':db[_0xbb10('0xdc')],'as':_0xbb10('0xdc')}]});})[_0xbb10('0x18')](handleEntityNotFound(_0x604d55,null))['then'](function(_0x2cbbb6){if(_0x2cbbb6&&_0x2cbbb6[_0xbb10('0xb3')]){_0x40eb16=_0x2cbbb6;var _0x391bce=_['defaults'](_0xddfe35['body'],{'firstName':_0xddfe35[_0xbb10('0x77')][_0xbb10('0xad')],'phone':_0xddfe35[_0xbb10('0x77')][_0xbb10('0xad')],'ListId':_0x2cbbb6[_0xbb10('0xac')]});_0x391bce[_0xddfe35[_0xbb10('0x77')][_0xbb10('0xd9')]]=_0xddfe35['body'][_0xbb10('0xad')];return db[_0xbb10('0xbe')][_0xbb10('0xdd')]({'where':_0x1c0529,'defaults':_0x391bce});}})['spread'](function(_0x5e195a){if(_0x5e195a){_0x3ff3fe=_0x5e195a;var _0x55efcf=fs['readFileSync'](path[_0xbb10('0x90')](config[_0xbb10('0x91')],_0xbb10('0xde')),_0xbb10('0xdf'));var _0x59cc7b=ejs[_0xbb10('0xe0')](_0x55efcf,{'body':_['toPairs'](_0xddfe35[_0xbb10('0x77')][_0xbb10('0x77')]),'bodyTitle':_0x40eb16[_0xbb10('0xe1')]});return db[_0xbb10('0xe2')][_0xbb10('0x76')]({'body':_0x59cc7b,'plainBody':htmlToText[_0xbb10('0xe3')](_0x59cc7b),'ContactId':_0x5e195a['id'],'ChatWebsiteId':_0x40eb16['id']});}})[_0xbb10('0x18')](function(_0x4541f2){_0x4d65e7=_0x4541f2;if(_0x3522cd[_0xbb10('0x66')]){var _0x71d5a4=_0x3522cd[_0xbb10('0x5d')](function(_0x471042){return{'name':_0x471042['originalname'],'basename':_0x471042[_0xbb10('0x8c')],'type':_0x471042[_0xbb10('0xe4')],'ChatOfflineMessageId':_0x4541f2['id']};});_0x3c01ff=_0x71d5a4[_0xbb10('0x5d')](_0x4d0f0b=>{var _0x204ebf={'filename':_0x4d0f0b['name'],'path':path[_0xbb10('0x90')](config[_0xbb10('0x91')],_0xbb10('0xe5'),_0xbb10('0xd8'),_0xbb10('0xe6'),'offline-chat',_0x4d0f0b['basename'])};return _0x204ebf;});if(!_0x40eb16[_0xbb10('0xe7')]){return db['sequelize']['transaction'](function(_0x2ff72a){return db['Attachment'][_0xbb10('0xe8')](_0x71d5a4,{'transaction':_0x2ff72a});});}}})[_0xbb10('0x18')](function(){if(_0x4d65e7){_0x22ec50=_0x4d65e7;return db[_0xbb10('0xdc')][_0xbb10('0x88')]({'where':{'service':!![]},'include':[{'model':db[_0xbb10('0xe9')],'as':_0xbb10('0xea'),'raw':!![],'include':[{'model':db[_0xbb10('0xeb')],'as':_0xbb10('0xeb'),'raw':!![]}]}]});}})['then'](function(_0x2aa734){if(_0x2aa734&&_0x2aa734['Smtp']&&_0x40eb16[_0xbb10('0xec')]&&_0x40eb16['forwardOfflineAddress']){var _0x24c018=_0x2aa734[_0xbb10('0xed')]();return respondWithRpcPromise('SendMail',_0xbb10('0xee'),{'account':_0x24c018,'message':{'from':util[_0xbb10('0x37')](_0xbb10('0xef'),_0x2aa734['name'],_0x2aa734[_0xbb10('0xf0')]||_0x2aa734[_0xbb10('0xea')][_0xbb10('0x78')]),'to':_0x40eb16['forwardOfflineAddress'],'subject':_0x40eb16[_0xbb10('0xf1')],'html':_0x22ec50[_0xbb10('0x77')],'attachments':_0x3c01ff}},client9003)[_0xbb10('0x18')](function(){return _0x22ec50;})['catch'](function(_0x3e6756){logger['error'](_0x3e6756);});}})[_0xbb10('0x18')](function(){if(_0x40eb16&&_0x40eb16[_0xbb10('0xe7')]&&_0x40eb16[_0xbb10('0xf2')]){var _0xd94118=[];if(_0x3522cd[_0xbb10('0x66')]){_0xd94118=_0x3522cd[_0xbb10('0x5d')](function(_0x23e592){return{'name':_0x23e592[_0xbb10('0xf3')],'basename':_0x23e592[_0xbb10('0x8c')],'type':_0x23e592[_0xbb10('0xe4')],'ChatOfflineMessageId':_0x4d65e7['id']};});}var _0x49982e;if(!_['isNil'](_0x40eb16[_0xbb10('0xf4')])){var _0x4739a6=_[_0xbb10('0x5d')](_0xddfe35['body'],function(_0x3d5870){return _0x3d5870;});var _0x1067f2=_[_0xbb10('0xf5')](_0x4739a6)[0x0];var _0x108ec7=_[_0xbb10('0xf6')](_0x1067f2,function(_0x431673){return _0x431673;});_0x49982e=_0x108ec7[0x1][_0x40eb16[_0xbb10('0xf4')]];}var _0x2035e1={'from':_0x3ff3fe[_0xbb10('0xf0')],'firstName':_0x3ff3fe['firstName'],'lastName':_0x3ff3fe[_0xbb10('0x4e')],'mapKey':_0xbb10('0xf0'),'message':{'from':_0x3ff3fe[_0xbb10('0xf0')],'to':_0x40eb16[_0xbb10('0xdc')]['email'],'cc':'','subject':_[_0xbb10('0x96')](_0x49982e)?_0x40eb16[_0xbb10('0xf1')]:_0x49982e,'messageId':'','sentAt':new Date(),'attach':_0xd94118[_0xbb10('0x66')],'attachments':_0xd94118,'originChannel':'Chat','ChatWebsiteId':_0x40eb16['id'],'ChatOfflineMessageId':_0x22ec50['id'],'originTo':_0x40eb16['MailAccount'][_0xbb10('0xf0')]},'body':_0x22ec50['body']};var _0x37c688={'account':{'id':_0x40eb16['MailAccountId']},'body':_0x2035e1,'log':_0xbb10('0xf7')};return respondWithRpcPromise(_0xbb10('0xf7'),_0xbb10('0xf8'),_0x37c688,client9001)[_0xbb10('0x18')](function(){return _0x22ec50;})[_0xbb10('0x23')](function(_0x3c5a97){logger[_0xbb10('0x1e')](_0x3c5a97);});}return;})['then'](function(){if(_0x22ec50){return _0x22ec50;}})[_0xbb10('0x18')](respondWithResult(_0x604d55,null))[_0xbb10('0x23')](function(){for(var _0x28271e of _0x3522cd){var _0x2807d2=path[_0xbb10('0x90')](config[_0xbb10('0x91')],'server',_0xbb10('0xd8'),_0xbb10('0xe6'),_0xbb10('0xf9'),_0x28271e[_0xbb10('0x8c')]);fs_extra[_0xbb10('0xfa')](_0x2807d2)[_0xbb10('0x23')](function(_0x16c041){logger['error'](_0xbb10('0xfb'),_0x2807d2,_0x16c041);});}});};exports[_0xbb10('0xfc')]=function(_0x1e8713,_0x53c293){return db[_0xbb10('0xc2')]['find']({'where':{'id':_0x1e8713[_0xbb10('0x72')]['id']}})[_0xbb10('0x18')](handleEntityNotFound(_0x53c293,null))[_0xbb10('0x18')](function(_0x58a447){if(_0x58a447){return _0x58a447['addInteraction'](_0x1e8713[_0xbb10('0x77')][_0xbb10('0xfd')],_[_0xbb10('0xfe')](_0x1e8713[_0xbb10('0x77')],[_0xbb10('0xfd'),'id'])||{});}})[_0xbb10('0x18')](respondWithResult(_0x53c293,null))[_0xbb10('0x23')](handleError(_0x53c293,null));};exports[_0xbb10('0xff')]=function(_0x2ba569,_0x8700e6){var _0x1e6509={'raw':![],'where':{}};var _0x5d8005={};var _0x4e3b32={'count':0x0,'rows':[]};return db[_0xbb10('0x5e')][_0xbb10('0x88')]({'where':{'id':_0x2ba569['params']['id']}})['then'](handleEntityNotFound(_0x8700e6,null))[_0xbb10('0x18')](function(_0x160c01){if(_0x160c01){_0x5d8005[_0xbb10('0x55')]=_['keys'](db[_0xbb10('0xc2')][_0xbb10('0x73')]);_0x5d8005['query']=_[_0xbb10('0x61')](_0x2ba569[_0xbb10('0x60')]);_0x5d8005['filters']=_['intersection'](_0x5d8005[_0xbb10('0x55')],_0x5d8005[_0xbb10('0x60')]);_0x1e6509[_0xbb10('0x64')]=_['intersection'](_0x5d8005['model'],qs[_0xbb10('0x65')](_0x2ba569[_0xbb10('0x60')]['fields']));_0x1e6509[_0xbb10('0x64')]=_0x1e6509[_0xbb10('0x64')]['length']?_0x1e6509[_0xbb10('0x64')]:_0x5d8005[_0xbb10('0x55')];if(!_0x2ba569[_0xbb10('0x60')][_0xbb10('0x67')]('nolimit')){_0x1e6509[_0xbb10('0x29')]=qs['limit'](_0x2ba569[_0xbb10('0x60')][_0xbb10('0x29')]);_0x1e6509[_0xbb10('0x27')]=qs[_0xbb10('0x27')](_0x2ba569[_0xbb10('0x60')][_0xbb10('0x27')]);}_0x1e6509[_0xbb10('0x69')]=qs[_0xbb10('0x6a')](_0x2ba569['query'][_0xbb10('0x6a')]);_0x1e6509[_0xbb10('0x6b')]=qs[_0xbb10('0x62')](_[_0xbb10('0x6c')](_0x2ba569['query'],_0x5d8005['filters']));_0x1e6509[_0xbb10('0x6b')][_0xbb10('0x81')]=_0x160c01['id'];if(_0x2ba569[_0xbb10('0x60')][_0xbb10('0x6d')]){_0x1e6509['where']=_[_0xbb10('0x6e')](_0x1e6509[_0xbb10('0x6b')],{'$or':_['map'](_0x1e6509[_0xbb10('0x64')],function(_0x4f71fd){var _0x59d6a7={};_0x59d6a7[_0x4f71fd]={'$like':'%'+_0x2ba569[_0xbb10('0x60')][_0xbb10('0x6d')]+'%'};return _0x59d6a7;})});}_0x1e6509=_[_0xbb10('0x6e')]({},_0x1e6509,_0x2ba569[_0xbb10('0x6f')]);return db[_0xbb10('0xc2')]['count']({'where':_0x1e6509[_0xbb10('0x6b')]})[_0xbb10('0x18')](function(_0x356601){_0x4e3b32[_0xbb10('0x2a')]=_0x356601;if(_0x2ba569[_0xbb10('0x60')][_0xbb10('0x74')]){_0x1e6509[_0xbb10('0x70')]=[{'model':db[_0xbb10('0xbe')],'as':_0xbb10('0x100'),'required':![]},{'model':db[_0xbb10('0xcd')],'as':_0xbb10('0x101'),'attributes':[_0xbb10('0x32'),_0xbb10('0x102'),_0xbb10('0x103')],'required':![]},{'model':db[_0xbb10('0x104')],'as':_0xbb10('0x105'),'attributes':['id',_0xbb10('0x32'),_0xbb10('0x106')],'where':_0x2ba569[_0xbb10('0x60')][_0xbb10('0x107')]?{'id':_0x2ba569[_0xbb10('0x60')][_0xbb10('0x107')]}:undefined,'required':_0x2ba569[_0xbb10('0x60')][_0xbb10('0x107')]?!![]:![]}];}return db[_0xbb10('0xc2')][_0xbb10('0x84')](_0x1e6509);})[_0xbb10('0x18')](function(_0x57b891){_0x4e3b32[_0xbb10('0x71')]=_0x57b891;return _0x4e3b32;});}})[_0xbb10('0x18')](respondWithFilteredResult(_0x8700e6,_0x1e6509))['catch'](handleError(_0x8700e6,null));};exports[_0xbb10('0x35')]=function(_0x1ebd41,_0x4d2ada){var _0x3a20c0=0x0;var _0x3b96dd=0x0;var _0x4e97fd=![];var _0x21a460;var _0x3ff9bc;return db[_0xbb10('0x5e')][_0xbb10('0x75')]({'where':{'id':_0x1ebd41['params']['id']},'include':[{'model':db[_0xbb10('0x41')],'as':_0xbb10('0x41'),'include':[{'model':db[_0xbb10('0x41')],'as':_0xbb10('0x42'),'attributes':['id','interval']}]}]})[_0xbb10('0x18')](handleEntityNotFound(_0x4d2ada,null))[_0xbb10('0x18')](function(_0x327749){if(_0x327749){_0x21a460=_0x327749;return _0x327749[_0xbb10('0x108')]({'raw':!![]});}})[_0xbb10('0x18')](function(_0x3045ff){if(_0x21a460){if(_0x3045ff){_0x3ff9bc=_0x3045ff;}}return require(_0xbb10('0x94'))[_0xbb10('0x95')]();})[_0xbb10('0x18')](function(_0x22900c){if(_0x22900c){_0x3b96dd=_0x22900c[_0xbb10('0x109')];_0x4e97fd=_0x22900c['custom'];}})[_0xbb10('0x18')](function(){return db[_0xbb10('0xc2')][_0xbb10('0x2a')]({'where':{'closed':![]}});})[_0xbb10('0x18')](function(_0x57d03c){_0x3a20c0=_0x57d03c;if(_0x3b96dd&&_0x57d03c>_0x3b96dd){return db['License'][_0xbb10('0x88')]({'where':{'id':0x1}})[_0xbb10('0x18')](function(_0x4785fb){if(_0x4785fb){_0x4785fb[_0xbb10('0x10a')]('chatLicenseExceeded');}});}})[_0xbb10('0x18')](function(){if(!_0x21a460[_0xbb10('0x41')]||!_0x21a460[_0xbb10('0x41')]['Intervals'])return!![];return checkWebsiteIntervals(_0x21a460);})['then'](function(_0x4206bf){var _0xd6b33=fs['readFileSync'](path['join'](config[_0xbb10('0x91')],_0xbb10('0x10b')),_0xbb10('0xdf'));var _0x45cd03=new url[(_0xbb10('0x10c'))](_0x21a460[_0xbb10('0x10d')])['origin'];var _0x408544=_0xbb10('0x10e');var _0x1bb753=![];var _0x235367={'chatVersion':_0x408544,'chatWebsiteAddressOrigin':_0x45cd03,'remote':_0x21a460[_0xbb10('0x10f')],'query':querystring[_0xbb10('0x1d')](_[_0xbb10('0x6e')](_0x21a460[_0xbb10('0x2d')]({'plain':!![]}),{'customerIp':_0x1ebd41[_0xbb10('0xc0')][_0xbb10('0x4a')]||_0x1ebd41['headers'][_0xbb10('0x110')]||_0x1ebd41[_0xbb10('0x111')]['remoteAddress']||_0x1ebd41['ip'],'referer':_0x1ebd41['headers']['referer'],'openedInteractions':_0x3a20c0,'maxInteractions':_0x3b96dd,'virtual':_0x4e97fd['virtual'],'online':_0x4206bf,'custom':_0x4e97fd}))['replace'](/'/g,'\x5c\x27')};_0x4d2ada['send'](ejs['render'](Mustache['render'](_0xd6b33,_0x235367),{'proactiveActions':_0x3ff9bc,'alignment':_0x21a460[_0xbb10('0x112')],'verticalAlignment':_0x21a460[_0xbb10('0x113')],'div_color':_0x21a460['color'],'labelText':_0x21a460[_0xbb10('0x114')],'text_color':_0x21a460[_0xbb10('0x115')],'text_button_color':_0x21a460[_0xbb10('0x116')],'button_color':_0x21a460[_0xbb10('0x117')],'background_color':_0x21a460[_0xbb10('0x118')],'hideWhenOffline':_0x21a460[_0xbb10('0x119')],'intervalId':_0x21a460[_0xbb10('0x11a')],'isDevelopment':_0x1bb753,'chatVersion':_0x408544}));})[_0xbb10('0x23')](handleError(_0x4d2ada,null));};exports[_0xbb10('0x11b')]=function(_0x14d9e7,_0x19dfef){var _0x13df4e=_0x14d9e7['params']['id'];var _0x44c373=_0x14d9e7[_0xbb10('0x77')];var _0x2e72e2=0xc8;var _0x3a6298=null;return db[_0xbb10('0x11c')]['transaction']({'isolationLevel':db[_0xbb10('0x11c')]['Transaction']['ISOLATION_LEVELS'][_0xbb10('0x11d')]},function(_0xf4ebf8){return db['ChatWebsite'][_0xbb10('0x88')]({'where':{'id':_0x13df4e},'transaction':_0xf4ebf8})[_0xbb10('0x18')](function(_0x201e05){if(_0x201e05){return db[_0xbb10('0x11e')][_0xbb10('0x2c')]({'where':{'ChatWebsiteId':_0x13df4e},'transaction':_0xf4ebf8})['then'](function(){var _0x486a2f=_[_0xbb10('0x5d')](_0x44c373,function(_0x118b63){_0x118b63['ChatWebsiteId']=_0x13df4e;return _0x118b63;});return db[_0xbb10('0x11e')][_0xbb10('0xe8')](_0x486a2f,{'transaction':_0xf4ebf8});});}else{_0x2e72e2=0x194;_0x3a6298=[];}});})[_0xbb10('0x18')](function(){if(_0x2e72e2!==0x194){return db[_0xbb10('0x11e')][_0xbb10('0x11f')]({'where':{'ChatWebsiteId':_0x13df4e},'order':_0xbb10('0xbc')})[_0xbb10('0x18')](function(_0x3be6ec){_0x3a6298=_0x3be6ec;});}})[_0xbb10('0x23')](function(_0x514c07){_0x2e72e2=0x1f4;logger[_0xbb10('0x1e')](_0x514c07[_0xbb10('0x31')]);if(_0x514c07[_0xbb10('0x32')]){delete _0x514c07[_0xbb10('0x32')];}_0x3a6298=_0x514c07;})['finally'](function(){if(_0x3a6298===null){_0x19dfef[_0xbb10('0x24')](_0x2e72e2);}else{if(_0x2e72e2===0x1f4){_0x19dfef[_0xbb10('0x25')](_0x2e72e2)['send'](_0x3a6298);}else{_0x19dfef['status'](_0x2e72e2)[_0xbb10('0x26')](_0x3a6298);}}});};exports['getApplications']=function(_0x40ff8e,_0x30ffca){var _0x214dcb={};var _0x3e19f4={};var _0x56e3d0;var _0x90ab9f;return db['ChatWebsite'][_0xbb10('0x88')]({'where':{'id':_0x40ff8e[_0xbb10('0x72')]['id']}})[_0xbb10('0x18')](handleEntityNotFound(_0x30ffca,null))[_0xbb10('0x18')](function(_0xa5cb35){if(_0xa5cb35){_0x56e3d0=_0xa5cb35;_0x3e19f4[_0xbb10('0x55')]=_[_0xbb10('0x61')](db[_0xbb10('0x11e')][_0xbb10('0x73')]);_0x3e19f4['query']=_[_0xbb10('0x61')](_0x40ff8e[_0xbb10('0x60')]);_0x3e19f4[_0xbb10('0x62')]=_[_0xbb10('0x63')](_0x3e19f4[_0xbb10('0x55')],_0x3e19f4['query']);_0x214dcb[_0xbb10('0x64')]=_[_0xbb10('0x63')](_0x3e19f4[_0xbb10('0x55')],qs[_0xbb10('0x65')](_0x40ff8e[_0xbb10('0x60')]['fields']));_0x214dcb['attributes']=_0x214dcb['attributes'][_0xbb10('0x66')]?_0x214dcb['attributes']:_0x3e19f4['model'];_0x214dcb[_0xbb10('0x69')]=qs['sort'](_0x40ff8e[_0xbb10('0x60')][_0xbb10('0x6a')]);_0x214dcb['where']=qs[_0xbb10('0x62')](_[_0xbb10('0x6c')](_0x40ff8e[_0xbb10('0x60')],_0x3e19f4[_0xbb10('0x62')]));if(_0x40ff8e['query']['filter']){_0x214dcb['where']=_[_0xbb10('0x6e')](_0x214dcb[_0xbb10('0x6b')],{'$or':_['map'](_0x214dcb[_0xbb10('0x64')],function(_0x3fd91c){var _0x3d2e5f={};_0x3d2e5f[_0x3fd91c]={'$like':'%'+_0x40ff8e[_0xbb10('0x60')][_0xbb10('0x6d')]+'%'};return _0x3d2e5f;})});}_0x214dcb=_['merge']({},_0x214dcb,_0x40ff8e[_0xbb10('0x6f')]);return _0x56e3d0[_0xbb10('0x120')](_0x214dcb);}})[_0xbb10('0x18')](function(_0x4aa311){if(_0x4aa311){_0x90ab9f=_0x4aa311[_0xbb10('0x66')];if(!_0x40ff8e['query'][_0xbb10('0x67')](_0xbb10('0x68'))){_0x214dcb[_0xbb10('0x29')]=qs['limit'](_0x40ff8e[_0xbb10('0x60')][_0xbb10('0x29')]);_0x214dcb['offset']=qs[_0xbb10('0x27')](_0x40ff8e[_0xbb10('0x60')][_0xbb10('0x27')]);}return _0x56e3d0[_0xbb10('0x120')](_0x214dcb);}})[_0xbb10('0x18')](function(_0x589c18){if(_0x589c18){return _0x589c18?{'count':_0x90ab9f,'rows':_0x589c18}:null;}})['then'](respondWithResult(_0x30ffca,null))[_0xbb10('0x23')](handleError(_0x30ffca,null));};exports[_0xbb10('0x121')]=function(_0x22dd3d,_0x1b0734){return db[_0xbb10('0x122')]['find']({'where':{'id':_0x22dd3d[_0xbb10('0x72')]['id']}})[_0xbb10('0x18')](handleEntityNotFound(_0x1b0734,null))[_0xbb10('0x18')](function(_0x13d77a){if(_0x13d77a){return _0x13d77a[_0xbb10('0x121')](_0x22dd3d['body']['ids'],_[_0xbb10('0xfe')](_0x22dd3d[_0xbb10('0x77')],[_0xbb10('0xfd'),'id'])||{});}})[_0xbb10('0x18')](respondWithResult(_0x1b0734,null))['catch'](handleError(_0x1b0734,null));};exports['getProactiveActions']=function(_0x1da101,_0x4d7ea2){var _0x4840ac={};var _0x4e2dbb={};var _0x5ce8f5;var _0x3758dd;return db[_0xbb10('0x5e')][_0xbb10('0x88')]({'where':{'id':_0x1da101[_0xbb10('0x72')]['id']}})[_0xbb10('0x18')](handleEntityNotFound(_0x4d7ea2,null))['then'](function(_0x12829c){if(_0x12829c){_0x5ce8f5=_0x12829c;_0x4e2dbb[_0xbb10('0x55')]=_[_0xbb10('0x61')](db['ChatProactiveAction'][_0xbb10('0x73')]);_0x4e2dbb[_0xbb10('0x60')]=_[_0xbb10('0x61')](_0x1da101[_0xbb10('0x60')]);_0x4e2dbb[_0xbb10('0x62')]=_[_0xbb10('0x63')](_0x4e2dbb[_0xbb10('0x55')],_0x4e2dbb[_0xbb10('0x60')]);_0x4840ac[_0xbb10('0x64')]=_[_0xbb10('0x63')](_0x4e2dbb[_0xbb10('0x55')],qs[_0xbb10('0x65')](_0x1da101[_0xbb10('0x60')][_0xbb10('0x65')]));_0x4840ac[_0xbb10('0x64')]=_0x4840ac['attributes']['length']?_0x4840ac['attributes']:_0x4e2dbb[_0xbb10('0x55')];_0x4840ac['order']=qs[_0xbb10('0x6a')](_0x1da101['query'][_0xbb10('0x6a')]);_0x4840ac['where']=qs['filters'](_[_0xbb10('0x6c')](_0x1da101[_0xbb10('0x60')],_0x4e2dbb['filters']));if(_0x1da101[_0xbb10('0x60')][_0xbb10('0x6d')]){_0x4840ac[_0xbb10('0x6b')]=_[_0xbb10('0x6e')](_0x4840ac['where'],{'$or':_['map'](_0x4840ac[_0xbb10('0x64')],function(_0x18c663){var _0x2c3bc0={};_0x2c3bc0[_0x18c663]={'$like':'%'+_0x1da101[_0xbb10('0x60')][_0xbb10('0x6d')]+'%'};return _0x2c3bc0;})});}_0x4840ac=_[_0xbb10('0x6e')]({},_0x4840ac,_0x1da101[_0xbb10('0x6f')]);return _0x5ce8f5['getProactiveActions'](_0x4840ac);}})[_0xbb10('0x18')](function(_0x51cdbd){if(_0x51cdbd){_0x3758dd=_0x51cdbd['length'];if(!_0x1da101[_0xbb10('0x60')]['hasOwnProperty'](_0xbb10('0x68'))){_0x4840ac[_0xbb10('0x29')]=qs[_0xbb10('0x29')](_0x1da101[_0xbb10('0x60')][_0xbb10('0x29')]);_0x4840ac['offset']=qs[_0xbb10('0x27')](_0x1da101[_0xbb10('0x60')][_0xbb10('0x27')]);}return _0x5ce8f5[_0xbb10('0x108')](_0x4840ac);}})[_0xbb10('0x18')](function(_0x1c387b){if(_0x1c387b){return _0x1c387b?{'count':_0x3758dd,'rows':_0x1c387b}:null;}})['then'](respondWithResult(_0x4d7ea2,null))['catch'](handleError(_0x4d7ea2,null));};exports[_0xbb10('0x123')]=function(_0x2f42cc,_0x22fa73){var _0x35971b=_0x2f42cc[_0xbb10('0x60')]['online']==='false'?_0xbb10('0x124'):_0xbb10('0x125');return db['ChatWebsite']['find']({'attributes':['id',_0x35971b],'where':{'id':_0x2f42cc[_0xbb10('0x72')]['id']}})[_0xbb10('0x18')](handleEntityNotFound(_0x22fa73,null))[_0xbb10('0x18')](function(_0x450772){if(_0x450772){var _0x170e2a=_0x450772[_0x35971b];var _0x19b8cc=_0x170e2a&&_0x170e2a['items']?_0x170e2a[_0xbb10('0x126')]:[];_0x22fa73[_0xbb10('0x33')]({'fromKey':_[_0xbb10('0x96')](_0x170e2a[_0xbb10('0x127')])?undefined:_0x170e2a[_0xbb10('0x127')],'count':_0x19b8cc[_0xbb10('0x66')],'rows':_0x19b8cc});}})[_0xbb10('0x23')](handleError(_0x22fa73,null));};exports[_0xbb10('0x128')]=function(_0x1b5bb8,_0x4d054b){var _0x54bf10={'raw':![],'where':{}};var _0x518ec0={};var _0x111c15={'count':0x0,'rows':[]};return db[_0xbb10('0x5e')][_0xbb10('0x88')]({'where':{'id':_0x1b5bb8[_0xbb10('0x72')]['id']}})['then'](handleEntityNotFound(_0x4d054b,null))['then'](function(_0x595ac6){if(_0x595ac6){_0x518ec0[_0xbb10('0x55')]=_[_0xbb10('0x61')](db[_0xbb10('0xe2')][_0xbb10('0x73')]);_0x518ec0[_0xbb10('0x60')]=_[_0xbb10('0x61')](_0x1b5bb8[_0xbb10('0x60')]);_0x518ec0[_0xbb10('0x62')]=_[_0xbb10('0x63')](_0x518ec0[_0xbb10('0x55')],_0x518ec0[_0xbb10('0x60')]);_0x54bf10[_0xbb10('0x64')]=_[_0xbb10('0x63')](_0x518ec0[_0xbb10('0x55')],qs['fields'](_0x1b5bb8[_0xbb10('0x60')][_0xbb10('0x65')]));_0x54bf10[_0xbb10('0x64')]=_0x54bf10[_0xbb10('0x64')][_0xbb10('0x66')]?_0x54bf10[_0xbb10('0x64')]:_0x518ec0['model'];if(!_0x1b5bb8[_0xbb10('0x60')][_0xbb10('0x67')](_0xbb10('0x68'))){_0x54bf10[_0xbb10('0x29')]=qs[_0xbb10('0x29')](_0x1b5bb8[_0xbb10('0x60')][_0xbb10('0x29')]);_0x54bf10[_0xbb10('0x27')]=qs[_0xbb10('0x27')](_0x1b5bb8['query'][_0xbb10('0x27')]);}_0x54bf10[_0xbb10('0x69')]=qs[_0xbb10('0x6a')](_0x1b5bb8[_0xbb10('0x60')][_0xbb10('0x6a')]);_0x54bf10[_0xbb10('0x6b')]=qs[_0xbb10('0x62')](_[_0xbb10('0x6c')](_0x1b5bb8[_0xbb10('0x60')],_0x518ec0['filters']));_0x54bf10[_0xbb10('0x6b')]['ChatWebsiteId']=_0x595ac6['id'];if(_0x1b5bb8[_0xbb10('0x60')][_0xbb10('0x6d')]){_0x54bf10['where']=_['merge'](_0x54bf10[_0xbb10('0x6b')],{'$or':_[_0xbb10('0x5d')](_0x54bf10[_0xbb10('0x64')],function(_0x245219){var _0x13c10a={};_0x13c10a[_0x245219]={'$like':'%'+_0x1b5bb8[_0xbb10('0x60')][_0xbb10('0x6d')]+'%'};return _0x13c10a;})});}_0x54bf10=_[_0xbb10('0x6e')]({},_0x54bf10,_0x1b5bb8[_0xbb10('0x6f')]);return db[_0xbb10('0xe2')][_0xbb10('0x2a')]({'where':_0x54bf10[_0xbb10('0x6b')]})[_0xbb10('0x18')](function(_0x2f76){_0x111c15[_0xbb10('0x2a')]=_0x2f76;if(_0x1b5bb8['query'][_0xbb10('0x74')]){_0x54bf10['include']=[{'all':!![]}];}else{_0x54bf10[_0xbb10('0x70')]=[{'model':db[_0xbb10('0xbe')],'as':_0xbb10('0x100'),'required':![]},{'model':db[_0xbb10('0x129')],'as':_0xbb10('0x12a'),'required':![]}];}return db[_0xbb10('0xe2')][_0xbb10('0x84')](_0x54bf10);})[_0xbb10('0x18')](function(_0x5c88bd){_0x111c15['rows']=_0x5c88bd;return _0x111c15;});}})['then'](respondWithFilteredResult(_0x4d054b,_0x54bf10))[_0xbb10('0x23')](handleError(_0x4d054b,null));};exports[_0xbb10('0x12b')]=function(_0xdeed5b,_0x54c61c){return db[_0xbb10('0x5e')]['find']({'where':{'id':_0xdeed5b[_0xbb10('0x72')]['id']}})[_0xbb10('0x18')](handleEntityNotFound(_0x54c61c,null))['then'](function(_0x11154d){if(_0x11154d){return _0x11154d[_0xbb10('0x12b')](_0xdeed5b[_0xbb10('0x77')][_0xbb10('0xfd')],_[_0xbb10('0xfe')](_0xdeed5b['body'],[_0xbb10('0xfd'),'id'])||{})[_0xbb10('0x12c')](function(_0x54700f){for(var _0x358e1c=0x0;_0x358e1c<_0xdeed5b[_0xbb10('0x77')]['ids'][_0xbb10('0x66')];_0x358e1c+=0x1){socket[_0xbb10('0x12d')](_0xbb10('0x12e'),{'UserId':Number(_0xdeed5b[_0xbb10('0x77')]['ids'][_0x358e1c]),'ChatWebsiteId':Number(_0xdeed5b[_0xbb10('0x72')]['id'])});}return _0x54700f;});}})[_0xbb10('0x18')](respondWithResult(_0x54c61c,null))[_0xbb10('0x23')](handleError(_0x54c61c,null));};exports['removeAgents']=function(_0x593de5,_0x284b77){return db[_0xbb10('0x5e')][_0xbb10('0x75')]({'where':{'id':_0x593de5[_0xbb10('0x72')]['id']}})['then'](handleEntityNotFound(_0x284b77,null))[_0xbb10('0x18')](function(_0x2b6353){if(_0x2b6353){return _0x2b6353[_0xbb10('0x12f')](_0x593de5[_0xbb10('0x60')][_0xbb10('0xfd')])['then'](function(){if(_['isArray'](_0x593de5[_0xbb10('0x60')][_0xbb10('0xfd')])){for(var _0x556983=0x0;_0x556983<_0x593de5['query'][_0xbb10('0xfd')][_0xbb10('0x66')];_0x556983+=0x1){socket[_0xbb10('0x12d')](_0xbb10('0x130'),{'UserId':Number(_0x593de5[_0xbb10('0x60')][_0xbb10('0xfd')][_0x556983]),'ChatWebsiteId':Number(_0x593de5['params']['id'])});}}else{socket['emit'](_0xbb10('0x130'),{'UserId':Number(_0x593de5[_0xbb10('0x60')][_0xbb10('0xfd')]),'ChatWebsiteId':Number(_0x593de5[_0xbb10('0x72')]['id'])});}});}})[_0xbb10('0x18')](respondWithStatusCode(_0x284b77,null))[_0xbb10('0x23')](handleError(_0x284b77,null));};exports['getAgents']=function(_0x477d10,_0x19686c){var _0xb88335={};var _0x218f91={};var _0x492605;var _0x21ad98;return db[_0xbb10('0x5e')][_0xbb10('0x88')]({'where':{'id':_0x477d10[_0xbb10('0x72')]['id']}})[_0xbb10('0x18')](handleEntityNotFound(_0x19686c,null))[_0xbb10('0x18')](function(_0x245818){if(_0x245818){_0x492605=_0x245818;_0x218f91[_0xbb10('0x55')]=_[_0xbb10('0x61')](db[_0xbb10('0xcd')][_0xbb10('0x73')]);_0x218f91[_0xbb10('0x60')]=_['keys'](_0x477d10[_0xbb10('0x60')]);_0x218f91[_0xbb10('0x62')]=_['intersection'](_0x218f91[_0xbb10('0x55')],_0x218f91[_0xbb10('0x60')]);_0xb88335[_0xbb10('0x64')]=_['intersection'](_0x218f91[_0xbb10('0x55')],qs[_0xbb10('0x65')](_0x477d10[_0xbb10('0x60')][_0xbb10('0x65')]));_0xb88335[_0xbb10('0x64')]=_0xb88335[_0xbb10('0x64')]['length']?_0xb88335[_0xbb10('0x64')]:_0x218f91['model'];_0xb88335[_0xbb10('0x69')]=qs[_0xbb10('0x6a')](_0x477d10[_0xbb10('0x60')][_0xbb10('0x6a')]);_0xb88335['where']=qs[_0xbb10('0x62')](_[_0xbb10('0x6c')](_0x477d10['query'],_0x218f91[_0xbb10('0x62')]));if(_0x477d10['query'][_0xbb10('0x6d')]){_0xb88335[_0xbb10('0x6b')]=_[_0xbb10('0x6e')](_0xb88335[_0xbb10('0x6b')],{'$or':_[_0xbb10('0x5d')](_0xb88335[_0xbb10('0x64')],function(_0x130268){var _0x44050c={};_0x44050c[_0x130268]={'$like':'%'+_0x477d10['query']['filter']+'%'};return _0x44050c;})});}_0xb88335=_[_0xbb10('0x6e')]({},_0xb88335,_0x477d10[_0xbb10('0x6f')]);return _0x492605[_0xbb10('0x131')](_0xb88335);}})[_0xbb10('0x18')](function(_0x6f428e){if(_0x6f428e){_0x21ad98=_0x6f428e[_0xbb10('0x66')];if(!_0x477d10[_0xbb10('0x60')][_0xbb10('0x67')](_0xbb10('0x68'))){_0xb88335['limit']=qs[_0xbb10('0x29')](_0x477d10['query'][_0xbb10('0x29')]);_0xb88335[_0xbb10('0x27')]=qs['offset'](_0x477d10[_0xbb10('0x60')][_0xbb10('0x27')]);}return _0x492605[_0xbb10('0x131')](_0xb88335);}})[_0xbb10('0x18')](function(_0x14c314){if(_0x14c314){return _0x14c314?{'count':_0x21ad98,'rows':_0x14c314}:null;}})[_0xbb10('0x18')](respondWithResult(_0x19686c,null))[_0xbb10('0x23')](handleError(_0x19686c,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 4b7000d..fcfb5b7 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 _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','update','remove'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x34e8,0x12c));var _0x834e=function(_0x3038c0,_0x33d136){_0x3038c0=_0x3038c0-0x0;var _0xe0a1ca=_0x34e8[_0x3038c0];return _0xe0a1ca;};'use strict';var EventEmitter=require(_0x834e('0x0'));var ChatWebsite=require(_0x834e('0x1'))['db'][_0x834e('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x834e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x834e('0x4'),'afterDestroy':_0x834e('0x5')};function emitEvent(_0x472111){return function(_0x31bf20,_0x289ef2,_0x19a3e0){ChatWebsiteEvents[_0x834e('0x6')](_0x472111+':'+_0x31bf20['id'],_0x31bf20);ChatWebsiteEvents['emit'](_0x472111,_0x31bf20);_0x19a3e0(null);};}for(var e in events){if(events[_0x834e('0x7')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x834e('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x4ab0=['save','update','emit','hook','exports','../../mysqldb','ChatWebsite','setMaxListeners'];(function(_0xd95a4f,_0x5b2faf){var _0x913026=function(_0x4e9711){while(--_0x4e9711){_0xd95a4f['push'](_0xd95a4f['shift']());}};_0x913026(++_0x5b2faf);}(_0x4ab0,0xd5));var _0x04ab=function(_0x5c6103,_0x1acac5){_0x5c6103=_0x5c6103-0x0;var _0x545e28=_0x4ab0[_0x5c6103];return _0x545e28;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x04ab('0x0'))['db'][_0x04ab('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x04ab('0x2')](0x0);var events={'afterCreate':_0x04ab('0x3'),'afterUpdate':_0x04ab('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4c3a53){return function(_0x45dfee,_0xb1bf2d,_0x491958){ChatWebsiteEvents[_0x04ab('0x5')](_0x4c3a53+':'+_0x45dfee['id'],_0x45dfee);ChatWebsiteEvents[_0x04ab('0x5')](_0x4c3a53,_0x45dfee);_0x491958(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x04ab('0x6')](e,emitEvent(event));}}module[_0x04ab('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 4cc3fcb..f37c5fe 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 _0xd715=['moment','bluebird','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','../../config/logger'];(function(_0x288c41,_0x30e76c){var _0x1ca76e=function(_0x1f8bfa){while(--_0x1f8bfa){_0x288c41['push'](_0x288c41['shift']());}};_0x1ca76e(++_0x30e76c);}(_0xd715,0x1a2));var _0x5d71=function(_0x12697b,_0x549341){_0x12697b=_0x12697b-0x0;var _0x45770a=_0xd715[_0x12697b];return _0x45770a;};'use strict';var _=require(_0x5d71('0x0'));var util=require('util');var logger=require(_0x5d71('0x1'))('api');var moment=require(_0x5d71('0x2'));var BPromise=require(_0x5d71('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d71('0x4'));var rimraf=require(_0x5d71('0x5'));var config=require(_0x5d71('0x6'));var attributes=require(_0x5d71('0x7'));module[_0x5d71('0x8')]=function(_0x31605f,_0x4e9f01){return _0x31605f[_0x5d71('0x9')](_0x5d71('0xa'),attributes,{'tableName':_0x5d71('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63c8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','define','ChatWebsite','lodash','util','api'];(function(_0xa2f623,_0x33a107){var _0x6ca8e1=function(_0x296a66){while(--_0x296a66){_0xa2f623['push'](_0xa2f623['shift']());}};_0x6ca8e1(++_0x33a107);}(_0x63c8,0x195));var _0x863c=function(_0x2f9724,_0x15e788){_0x2f9724=_0x2f9724-0x0;var _0x6418da=_0x63c8[_0x2f9724];return _0x6418da;};'use strict';var _=require(_0x863c('0x0'));var util=require(_0x863c('0x1'));var logger=require('../../config/logger')(_0x863c('0x2'));var moment=require(_0x863c('0x3'));var BPromise=require(_0x863c('0x4'));var rp=require(_0x863c('0x5'));var fs=require('fs');var path=require(_0x863c('0x6'));var rimraf=require(_0x863c('0x7'));var config=require(_0x863c('0x8'));var attributes=require(_0x863c('0x9'));module['exports']=function(_0x3538bf,_0x4f0171){return _0x3538bf[_0x863c('0xa')](_0x863c('0xb'),attributes,{'tableName':'chat_websites','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 3a12b49..fcf01ce 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 _0x6a01=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','ChatWebsite,\x20%s,\x20%s','debug','error','code','message','info','request\x20sent','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x3a9503,_0x40e60c){var _0x538251=function(_0x25c755){while(--_0x25c755){_0x3a9503['push'](_0x3a9503['shift']());}};_0x538251(++_0x40e60c);}(_0x6a01,0x19a));var _0x16a0=function(_0xdca4a6,_0x4965f6){_0xdca4a6=_0xdca4a6-0x0;var _0x5c5b95=_0x6a01[_0xdca4a6];return _0x5c5b95;};'use strict';var _=require(_0x16a0('0x0'));var util=require(_0x16a0('0x1'));var moment=require('moment');var BPromise=require(_0x16a0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x16a0('0x3'));var db=require(_0x16a0('0x4'))['db'];var utils=require(_0x16a0('0x5'));var logger=require('../../config/logger')(_0x16a0('0x6'));var config=require(_0x16a0('0x7'));var jayson=require(_0x16a0('0x8'));var client=jayson[_0x16a0('0x9')][_0x16a0('0xa')]({'port':0x232a});config[_0x16a0('0xb')]=_[_0x16a0('0xc')](config[_0x16a0('0xb')],{'host':_0x16a0('0xd'),'port':0x18eb});var socket=require(_0x16a0('0xe'))(new Redis(config[_0x16a0('0xb')]));require('./chatWebsite.socket')[_0x16a0('0xf')](socket);function respondWithRpcPromise(_0x4e32a5,_0x2e16d3,_0x12d671){return new BPromise(function(_0xf107d2,_0x2693f9){return client[_0x16a0('0x10')](_0x4e32a5,_0x12d671)[_0x16a0('0x11')](function(_0x2a19e2){logger['info'](_0x16a0('0x12'),_0x2e16d3,'request\x20sent');logger[_0x16a0('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x2e16d3,'request\x20sent',JSON['stringify'](_0x2a19e2));if(_0x2a19e2[_0x16a0('0x14')]){if(_0x2a19e2[_0x16a0('0x14')][_0x16a0('0x15')]===0x1f4){logger[_0x16a0('0x14')](_0x16a0('0x12'),_0x2e16d3,_0x2a19e2['error']['message']);return _0x2693f9(_0x2a19e2[_0x16a0('0x14')]['message']);}logger[_0x16a0('0x14')](_0x16a0('0x12'),_0x2e16d3,_0x2a19e2[_0x16a0('0x14')]['message']);return _0xf107d2(_0x2a19e2[_0x16a0('0x14')][_0x16a0('0x16')]);}else{logger[_0x16a0('0x17')](_0x16a0('0x12'),_0x2e16d3,_0x16a0('0x18'));_0xf107d2(_0x2a19e2[_0x16a0('0x19')][_0x16a0('0x16')]);}})['catch'](function(_0x74dd60){logger[_0x16a0('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x2e16d3,_0x74dd60);_0x2693f9(_0x74dd60);});});} \ No newline at end of file +var _0x75c0=['socket.io-emitter','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost'];(function(_0x246a25,_0x2c0c46){var _0x5996f4=function(_0x5ae4bb){while(--_0x5ae4bb){_0x246a25['push'](_0x246a25['shift']());}};_0x5996f4(++_0x2c0c46);}(_0x75c0,0x9c));var _0x075c=function(_0x4e28c0,_0x1ef470){_0x4e28c0=_0x4e28c0-0x0;var _0x4039d4=_0x75c0[_0x4e28c0];return _0x4039d4;};'use strict';var _=require('lodash');var util=require(_0x075c('0x0'));var moment=require(_0x075c('0x1'));var BPromise=require(_0x075c('0x2'));var rs=require(_0x075c('0x3'));var fs=require('fs');var Redis=require(_0x075c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x075c('0x5'));var logger=require(_0x075c('0x6'))('rpc');var config=require(_0x075c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x075c('0x8')]['http']({'port':0x232a});config[_0x075c('0x9')]=_[_0x075c('0xa')](config[_0x075c('0x9')],{'host':_0x075c('0xb'),'port':0x18eb});var socket=require(_0x075c('0xc'))(new Redis(config[_0x075c('0x9')]));require('./chatWebsite.socket')['register'](socket);function respondWithRpcPromise(_0x221d2b,_0x1354db,_0x34b44c){return new BPromise(function(_0x37b012,_0x1ef806){return client['request'](_0x221d2b,_0x34b44c)[_0x075c('0xd')](function(_0x532933){logger[_0x075c('0xe')](_0x075c('0xf'),_0x1354db,_0x075c('0x10'));logger[_0x075c('0x11')](_0x075c('0x12'),_0x1354db,'request\x20sent',JSON[_0x075c('0x13')](_0x532933));if(_0x532933[_0x075c('0x14')]){if(_0x532933[_0x075c('0x14')][_0x075c('0x15')]===0x1f4){logger[_0x075c('0x14')](_0x075c('0xf'),_0x1354db,_0x532933[_0x075c('0x14')][_0x075c('0x16')]);return _0x1ef806(_0x532933[_0x075c('0x14')][_0x075c('0x16')]);}logger[_0x075c('0x14')](_0x075c('0xf'),_0x1354db,_0x532933[_0x075c('0x14')][_0x075c('0x16')]);return _0x37b012(_0x532933[_0x075c('0x14')]['message']);}else{logger[_0x075c('0xe')](_0x075c('0xf'),_0x1354db,_0x075c('0x10'));_0x37b012(_0x532933['result'][_0x075c('0x16')]);}})[_0x075c('0x17')](function(_0x5842c8){logger[_0x075c('0x14')](_0x075c('0xf'),_0x1354db,_0x5842c8);_0x1ef806(_0x5842c8);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index b49f87b..683631b 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 _0x513c=['save','remove','removeListener','chatWebsite:','./chatWebsite.events'];(function(_0x40d1ba,_0x3cb77c){var _0x565261=function(_0x1a5b54){while(--_0x1a5b54){_0x40d1ba['push'](_0x40d1ba['shift']());}};_0x565261(++_0x3cb77c);}(_0x513c,0x135));var _0xc513=function(_0x44caf2,_0x8ffb16){_0x44caf2=_0x44caf2-0x0;var _0x25978d=_0x513c[_0x44caf2];return _0x25978d;};'use strict';var ChatWebsiteEvents=require(_0xc513('0x0'));var events=[_0xc513('0x1'),_0xc513('0x2'),'update'];function createListener(_0x2ab350,_0x21ef01){return function(_0x2f0cd6){_0x21ef01['emit'](_0x2ab350,_0x2f0cd6);};}function removeListener(_0x536f9c,_0x413598){return function(){ChatWebsiteEvents[_0xc513('0x3')](_0x536f9c,_0x413598);};}exports['register']=function(_0x25549e){for(var _0x58cc54=0x0,_0x141f1b=events['length'];_0x58cc54<_0x141f1b;_0x58cc54++){var _0x1c2097=events[_0x58cc54];var _0x41c266=createListener(_0xc513('0x4')+_0x1c2097,_0x25549e);ChatWebsiteEvents['on'](_0x1c2097,_0x41c266);}}; \ No newline at end of file +var _0x5c51=['register','length','./chatWebsite.events','save','remove','update','emit','removeListener'];(function(_0x169878,_0x563094){var _0x3f1461=function(_0x101663){while(--_0x101663){_0x169878['push'](_0x169878['shift']());}};_0x3f1461(++_0x563094);}(_0x5c51,0x1aa));var _0x15c5=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x5c51[_0x411017];return _0x2adeea;};'use strict';var ChatWebsiteEvents=require(_0x15c5('0x0'));var events=[_0x15c5('0x1'),_0x15c5('0x2'),_0x15c5('0x3')];function createListener(_0x2825aa,_0x4a5829){return function(_0x574a3c){_0x4a5829[_0x15c5('0x4')](_0x2825aa,_0x574a3c);};}function removeListener(_0x5c7dba,_0x5b98c1){return function(){ChatWebsiteEvents[_0x15c5('0x5')](_0x5c7dba,_0x5b98c1);};}exports[_0x15c5('0x6')]=function(_0x4720c2){for(var _0x164a35=0x0,_0x25e4fa=events[_0x15c5('0x7')];_0x164a35<_0x25e4fa;_0x164a35++){var _0x5bb88e=events[_0x164a35];var _0xd45f2d=createListener('chatWebsite:'+_0x5bb88e,_0x4720c2);ChatWebsiteEvents['on'](_0x5bb88e,_0xd45f2d);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 2735a8c..09e4cec 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 _0x15f6=['addCustomerAvatar','notify','server/files','offline-chat','ensureDir','extname','replace','/:id/offline','any','offline','/:id/interactions','addInteraction','addProactiveActions','/:id/users','addAgents','put','update','delete','removeDispositions','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','post','create','addAnswer','diskStorage','join','root','server/files/images/logos/','now','originalname','/:id/logo','single','file','server/files/images/avatars/','format','%s-%s'];(function(_0x3b8eb3,_0x4ad20f){var _0x2b2d38=function(_0xed090){while(--_0xed090){_0x3b8eb3['push'](_0x3b8eb3['shift']());}};_0x2b2d38(++_0x4ad20f);}(_0x15f6,0x9c));var _0x615f=function(_0x1d3c50,_0x4aa0b8){_0x1d3c50=_0x1d3c50-0x0;var _0x272d50=_0x15f6[_0x1d3c50];return _0x272d50;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x615f('0x0'));var timeout=require(_0x615f('0x1'));var express=require(_0x615f('0x2'));var router=express[_0x615f('0x3')]();var fs_extra=require(_0x615f('0x4'));var auth=require(_0x615f('0x5'));var interaction=require(_0x615f('0x6'));var config=require(_0x615f('0x7'));var controller=require('./chatWebsite.controller');router['get']('/',auth[_0x615f('0x8')](),controller['index']);router[_0x615f('0x9')](_0x615f('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x615f('0x9')](_0x615f('0xb'),auth['isAuthenticated'](),controller[_0x615f('0xc')]);router['get'](_0x615f('0xd'),auth[_0x615f('0x8')](),controller[_0x615f('0xe')]);router['get'](_0x615f('0xf'),auth[_0x615f('0x8')](),controller['getAnswers']);router[_0x615f('0x9')]('/:id/logo',controller[_0x615f('0x10')]);router[_0x615f('0x9')](_0x615f('0x11'),controller[_0x615f('0x12')]);router['get'](_0x615f('0x13'),controller[_0x615f('0x14')]);router['get'](_0x615f('0x15'),controller[_0x615f('0x16')]);router[_0x615f('0x9')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x615f('0x17')]);router[_0x615f('0x9')](_0x615f('0x18'),controller[_0x615f('0x19')]);router['get'](_0x615f('0x1a'),auth[_0x615f('0x8')](),controller['getApplications']);router['get'](_0x615f('0x1b'),auth[_0x615f('0x8')](),controller[_0x615f('0x1c')]);router[_0x615f('0x9')](_0x615f('0x1d'),controller[_0x615f('0x1e')]);router['get'](_0x615f('0x1f'),auth['isAuthenticated'](),controller[_0x615f('0x20')]);router[_0x615f('0x9')]('/:id/users',auth[_0x615f('0x8')](),controller['getAgents']);router[_0x615f('0x21')]('/',auth['isAuthenticated'](),controller[_0x615f('0x22')]);router['post'](_0x615f('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x615f('0x21')](_0x615f('0xf'),auth[_0x615f('0x8')](),controller[_0x615f('0x23')]);var upload=multer({'storage':multer[_0x615f('0x24')]({'destination':function(_0x5699b1,_0x5dbc3c,_0x245be3){_0x245be3(null,path[_0x615f('0x25')](config[_0x615f('0x26')],_0x615f('0x27')));},'filename':function(_0x5b5542,_0x309b01,_0x44fcf8){_0x44fcf8(null,util['format']('%s-%s',Date[_0x615f('0x28')](),_0x309b01[_0x615f('0x29')]));}})});router[_0x615f('0x21')](_0x615f('0x2a'),upload[_0x615f('0x2b')](_0x615f('0x2c')),controller['addLogo']);var upload=multer({'storage':multer[_0x615f('0x24')]({'destination':function(_0x48f95e,_0x47b3d7,_0x2b6f43){_0x2b6f43(null,path[_0x615f('0x25')](config[_0x615f('0x26')],_0x615f('0x2d')));},'filename':function(_0x541ce9,_0x2958e9,_0xcd1566){_0xcd1566(null,util[_0x615f('0x2e')](_0x615f('0x2f'),Date['now'](),_0x2958e9['originalname']));}})});router[_0x615f('0x21')]('/:id/avatar',upload[_0x615f('0x2b')]('file'),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x539e45,_0x1c8c07,_0x164786){_0x164786(null,path[_0x615f('0x25')](config['root'],_0x615f('0x2d')));},'filename':function(_0x356fdb,_0x11b488,_0x5db464){_0x5db464(null,util[_0x615f('0x2e')](_0x615f('0x2f'),Date[_0x615f('0x28')](),_0x11b488['originalname']));}})});router[_0x615f('0x21')](_0x615f('0x13'),upload[_0x615f('0x2b')](_0x615f('0x2c')),controller[_0x615f('0x30')]);var upload=multer({'storage':multer[_0x615f('0x24')]({'destination':function(_0x337b13,_0x2fe753,_0x4bffb2){_0x4bffb2(null,path['join'](config[_0x615f('0x26')],_0x615f('0x2d')));},'filename':function(_0x1740ee,_0xcae42f,_0x55648a){_0x55648a(null,util[_0x615f('0x2e')](_0x615f('0x2f'),Date[_0x615f('0x28')](),_0xcae42f[_0x615f('0x29')]));}})});router[_0x615f('0x21')](_0x615f('0x15'),upload[_0x615f('0x2b')](_0x615f('0x2c')),controller['addSystemAvatar']);router[_0x615f('0x21')]('/:id/notify',controller[_0x615f('0x31')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x1c1390,_0x39e6f7,_0x2cda91){const _0x18849e=path['join'](config['root'],_0x615f('0x32'),'attachments',_0x615f('0x33'));fs_extra[_0x615f('0x34')](_0x18849e,function(){_0x2cda91(null,_0x18849e);});},'filename':function(_0x1500d6,_0x4739d3,_0x27cb5e){const _0x4cdca0=_0x4739d3['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2bcdec=path[_0x615f('0x35')](_0x4cdca0);const _0x1a8e08=Date['now']()+'-'+_0x4cdca0[_0x615f('0x36')](_0x2bcdec,'')+_0x2bcdec;_0x27cb5e(null,_0x1a8e08);}})});router['post'](_0x615f('0x37'),offlineUploadMulter[_0x615f('0x38')](),controller[_0x615f('0x39')]);router[_0x615f('0x21')](_0x615f('0x3a'),auth[_0x615f('0x8')](),controller[_0x615f('0x3b')]);router[_0x615f('0x21')]('/:id/applications',auth[_0x615f('0x8')](),controller['addApplications']);router['post'](_0x615f('0x1b'),auth[_0x615f('0x8')](),controller[_0x615f('0x3c')]);router['post'](_0x615f('0x3d'),auth[_0x615f('0x8')](),controller[_0x615f('0x3e')]);router[_0x615f('0x3f')](_0x615f('0xb'),auth['isAuthenticated'](),controller[_0x615f('0x40')]);router['delete'](_0x615f('0xb'),auth[_0x615f('0x8')](),controller['destroy']);router[_0x615f('0x41')](_0x615f('0xd'),auth[_0x615f('0x8')](),controller[_0x615f('0x42')]);router['delete'](_0x615f('0xf'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x615f('0x41')](_0x615f('0x3d'),auth[_0x615f('0x8')](),controller['removeAgents']);module[_0x615f('0x43')]=router; \ No newline at end of file +var _0x5b07=['addLogo','server/files/images/avatars/','now','/:id/avatar','single','addCustomerAvatar','addSystemAvatar','server/files','attachments','replace','extname','/:id/offline','addInteraction','/:id/applications','addAgents','destroy','delete','/:id/dispositions','removeDispositions','removeAnswers','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/proactive_actions','getProactiveActions','/:id/fields','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','diskStorage','join','root','server/files/images/logos/','format','%s-%s','originalname','file'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x5b07,0x154));var _0x75b0=function(_0x187069,_0x1c3a56){_0x187069=_0x187069-0x0;var _0x5993e0=_0x5b07[_0x187069];return _0x5993e0;};'use strict';var multer=require(_0x75b0('0x0'));var util=require(_0x75b0('0x1'));var path=require(_0x75b0('0x2'));var timeout=require('connect-timeout');var express=require(_0x75b0('0x3'));var router=express[_0x75b0('0x4')]();var fs_extra=require(_0x75b0('0x5'));var auth=require(_0x75b0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x75b0('0x7'));var controller=require('./chatWebsite.controller');router[_0x75b0('0x8')]('/',auth[_0x75b0('0x9')](),controller[_0x75b0('0xa')]);router[_0x75b0('0x8')](_0x75b0('0xb'),auth['isAuthenticated'](),controller[_0x75b0('0xc')]);router[_0x75b0('0x8')](_0x75b0('0xd'),auth[_0x75b0('0x9')](),controller[_0x75b0('0xe')]);router['get']('/:id/dispositions',auth[_0x75b0('0x9')](),controller[_0x75b0('0xf')]);router['get'](_0x75b0('0x10'),auth[_0x75b0('0x9')](),controller[_0x75b0('0x11')]);router['get'](_0x75b0('0x12'),controller['getLogo']);router['get']('/:id/avatar',controller[_0x75b0('0x13')]);router[_0x75b0('0x8')](_0x75b0('0x14'),controller[_0x75b0('0x15')]);router[_0x75b0('0x8')](_0x75b0('0x16'),controller[_0x75b0('0x17')]);router[_0x75b0('0x8')](_0x75b0('0x18'),auth[_0x75b0('0x9')](),controller['getInteractions']);router[_0x75b0('0x8')](_0x75b0('0x19'),controller[_0x75b0('0x1a')]);router[_0x75b0('0x8')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0x75b0('0x8')](_0x75b0('0x1b'),auth[_0x75b0('0x9')](),controller[_0x75b0('0x1c')]);router[_0x75b0('0x8')](_0x75b0('0x1d'),controller['getFields']);router[_0x75b0('0x8')]('/:id/offline_messages',auth[_0x75b0('0x9')](),controller[_0x75b0('0x1e')]);router[_0x75b0('0x8')](_0x75b0('0x1f'),auth[_0x75b0('0x9')](),controller[_0x75b0('0x20')]);router[_0x75b0('0x21')]('/',auth[_0x75b0('0x9')](),controller[_0x75b0('0x22')]);router[_0x75b0('0x21')]('/:id/dispositions',auth[_0x75b0('0x9')](),controller[_0x75b0('0x23')]);router[_0x75b0('0x21')](_0x75b0('0x10'),auth[_0x75b0('0x9')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x75b0('0x24')]({'destination':function(_0x50090d,_0x138ec9,_0xd0cedb){_0xd0cedb(null,path[_0x75b0('0x25')](config[_0x75b0('0x26')],_0x75b0('0x27')));},'filename':function(_0x356f40,_0x1cec0e,_0x5d5213){_0x5d5213(null,util[_0x75b0('0x28')](_0x75b0('0x29'),Date['now'](),_0x1cec0e[_0x75b0('0x2a')]));}})});router[_0x75b0('0x21')](_0x75b0('0x12'),upload['single'](_0x75b0('0x2b')),controller[_0x75b0('0x2c')]);var upload=multer({'storage':multer[_0x75b0('0x24')]({'destination':function(_0x3941a4,_0x3a7bf4,_0x438aa6){_0x438aa6(null,path['join'](config['root'],_0x75b0('0x2d')));},'filename':function(_0x2f4a04,_0x1dbf56,_0x30e3f0){_0x30e3f0(null,util[_0x75b0('0x28')](_0x75b0('0x29'),Date[_0x75b0('0x2e')](),_0x1dbf56[_0x75b0('0x2a')]));}})});router['post'](_0x75b0('0x2f'),upload[_0x75b0('0x30')](_0x75b0('0x2b')),controller['addAvatar']);var upload=multer({'storage':multer[_0x75b0('0x24')]({'destination':function(_0x2d3015,_0x592abc,_0x3e6f6f){_0x3e6f6f(null,path[_0x75b0('0x25')](config[_0x75b0('0x26')],'server/files/images/avatars/'));},'filename':function(_0x2a8c75,_0x472c2b,_0x30b3a){_0x30b3a(null,util[_0x75b0('0x28')]('%s-%s',Date[_0x75b0('0x2e')](),_0x472c2b[_0x75b0('0x2a')]));}})});router['post'](_0x75b0('0x14'),upload['single'](_0x75b0('0x2b')),controller[_0x75b0('0x31')]);var upload=multer({'storage':multer[_0x75b0('0x24')]({'destination':function(_0x3c036a,_0x23ce7b,_0x1bfe1a){_0x1bfe1a(null,path[_0x75b0('0x25')](config[_0x75b0('0x26')],_0x75b0('0x2d')));},'filename':function(_0x1632b3,_0x1a9661,_0x1b7fbe){_0x1b7fbe(null,util['format']('%s-%s',Date['now'](),_0x1a9661[_0x75b0('0x2a')]));}})});router['post']('/:id/system_avatar',upload[_0x75b0('0x30')](_0x75b0('0x2b')),controller[_0x75b0('0x32')]);router['post']('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x75b0('0x24')]({'destination':function(_0x1927f1,_0x44326b,_0x5b8d2f){const _0x5393bf=path[_0x75b0('0x25')](config['root'],_0x75b0('0x33'),_0x75b0('0x34'),'offline-chat');fs_extra['ensureDir'](_0x5393bf,function(){_0x5b8d2f(null,_0x5393bf);});},'filename':function(_0x4e9b5f,_0x484393,_0x535613){const _0x5be17c=_0x484393[_0x75b0('0x2a')][_0x75b0('0x35')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x531b8b=path[_0x75b0('0x36')](_0x5be17c);const _0x4688d4=Date['now']()+'-'+_0x5be17c['replace'](_0x531b8b,'')+_0x531b8b;_0x535613(null,_0x4688d4);}})});router[_0x75b0('0x21')](_0x75b0('0x37'),offlineUploadMulter['any'](),controller['offline']);router[_0x75b0('0x21')](_0x75b0('0x18'),auth[_0x75b0('0x9')](),controller[_0x75b0('0x38')]);router[_0x75b0('0x21')](_0x75b0('0x39'),auth[_0x75b0('0x9')](),controller['addApplications']);router[_0x75b0('0x21')](_0x75b0('0x1b'),auth['isAuthenticated'](),controller['addProactiveActions']);router[_0x75b0('0x21')](_0x75b0('0x1f'),auth[_0x75b0('0x9')](),controller[_0x75b0('0x3a')]);router['put']('/:id',auth[_0x75b0('0x9')](),controller['update']);router['delete'](_0x75b0('0xd'),auth[_0x75b0('0x9')](),controller[_0x75b0('0x3b')]);router[_0x75b0('0x3c')](_0x75b0('0x3d'),auth['isAuthenticated'](),controller[_0x75b0('0x3e')]);router[_0x75b0('0x3c')](_0x75b0('0x10'),auth[_0x75b0('0x9')](),controller[_0x75b0('0x3f')]);router[_0x75b0('0x3c')](_0x75b0('0x1f'),auth[_0x75b0('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 70b32d1..8db6d77 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 _0x1ae5=['../components/auth/service','../config/environment','Router','env','production','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','beaver-logger/server','express'];(function(_0x6a3dee,_0x43c2a4){var _0x28b6bf=function(_0x3e98dd){while(--_0x3e98dd){_0x6a3dee['push'](_0x6a3dee['shift']());}};_0x28b6bf(++_0x43c2a4);}(_0x1ae5,0xc1));var _0x51ae=function(_0x4363c9,_0x456292){_0x4363c9=_0x4363c9-0x0;var _0x5c1b6a=_0x1ae5[_0x4363c9];return _0x5c1b6a;};var beaverLogger=require(_0x51ae('0x0'));var express=require(_0x51ae('0x1'));var auth=require(_0x51ae('0x2'));var config=require(_0x51ae('0x3'));var router=express[_0x51ae('0x4')]();var isProduction=config[_0x51ae('0x5')]===_0x51ae('0x6')||![];function clientSideLogs(_0x3ba714,_0x9094b,_0x2df504){var _0x26384a=_0x3ba714['app']['get'](_0x51ae('0x7'));if(!_0x26384a){throw new Error(_0x51ae('0x8'));}return beaverLogger[_0x51ae('0x9')]({'uri':_0x51ae('0xa'),'logger':_0x26384a,'enableCors':!isProduction})(_0x3ba714,_0x9094b,_0x2df504);}router[_0x51ae('0xb')](auth[_0x51ae('0xc')](),clientSideLogs);module['exports']=router; \ No newline at end of file +var _0xe0d4=['exports','express','../components/auth/service','../config/environment','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xe0d4,0x18d));var _0x4e0d=function(_0x457e13,_0x3f80d3){_0x457e13=_0x457e13-0x0;var _0x4b473c=_0xe0d4[_0x457e13];return _0x4b473c;};var beaverLogger=require('beaver-logger/server');var express=require(_0x4e0d('0x0'));var auth=require(_0x4e0d('0x1'));var config=require(_0x4e0d('0x2'));var router=express['Router']();var isProduction=config['env']==='production'||![];function clientSideLogs(_0x22b5bb,_0x120ac7,_0x18dbf8){var _0x269d05=_0x22b5bb[_0x4e0d('0x3')][_0x4e0d('0x4')](_0x4e0d('0x5'));if(!_0x269d05){throw new Error(_0x4e0d('0x6'));}return beaverLogger[_0x4e0d('0x7')]({'uri':_0x4e0d('0x8'),'logger':_0x269d05,'enableCors':!isProduction})(_0x22b5bb,_0x120ac7,_0x18dbf8);}router[_0x4e0d('0x9')](auth[_0x4e0d('0xa')](),clientSideLogs);module[_0x4e0d('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 392a114..c779d7f 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 _0x0457=['ENUM','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','AmazonAWS','Google','MicrosoftAzure'];(function(_0x6bd4e3,_0x377cd6){var _0x2cc770=function(_0x7cad59){while(--_0x7cad59){_0x6bd4e3['push'](_0x6bd4e3['shift']());}};_0x2cc770(++_0x377cd6);}(_0x0457,0x78));var _0x7045=function(_0x43d701,_0x4bb2e9){_0x43d701=_0x43d701-0x0;var _0x2ec4c6=_0x0457[_0x43d701];return _0x2ec4c6;};'use strict';var Sequelize=require(_0x7045('0x0'));module[_0x7045('0x1')]={'name':{'type':Sequelize[_0x7045('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x7045('0x3'),_0x7045('0x4'),_0x7045('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x7045('0x6')]('Outlook365','Dynamics365')},'data1':{'type':Sequelize[_0x7045('0x2')],'comment':_0x7045('0x7')},'data2':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0x7045('0x2')],'comment':_0x7045('0x8')},'data4':{'type':Sequelize[_0x7045('0x2')],'comment':_0x7045('0x9')},'data5':{'type':Sequelize[_0x7045('0xa')],'comment':_0x7045('0xb')},'data6':{'type':Sequelize[_0x7045('0xa')],'comment':_0x7045('0xc')},'data7':{'type':Sequelize['TEXT'],'comment':_0x7045('0xd')}}; \ No newline at end of file +var _0xda73=['ENUM','AmazonAWS','MicrosoftAzure','Outlook365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','exports','STRING'];(function(_0x541a67,_0x50728d){var _0x45da2a=function(_0x158929){while(--_0x158929){_0x541a67['push'](_0x541a67['shift']());}};_0x45da2a(++_0x50728d);}(_0xda73,0x1b6));var _0x3da7=function(_0x256143,_0x639ed2){_0x256143=_0x256143-0x0;var _0x380a91=_0xda73[_0x256143];return _0x380a91;};'use strict';var Sequelize=require('sequelize');module[_0x3da7('0x0')]={'name':{'type':Sequelize[_0x3da7('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x3da7('0x2')](_0x3da7('0x3'),'Google',_0x3da7('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x3da7('0x2')](_0x3da7('0x5'),'Dynamics365')},'data1':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0x3da7('0x1')],'comment':_0x3da7('0x6')},'data3':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0x3da7('0x1')],'comment':_0x3da7('0x7')},'data5':{'type':Sequelize[_0x3da7('0x8')],'comment':_0x3da7('0x9')},'data6':{'type':Sequelize[_0x3da7('0x8')],'comment':_0x3da7('0xa')},'data7':{'type':Sequelize[_0x3da7('0x8')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 24da60f..024fe6e 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 _0xfb06=['model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','include','findAll','service','MicrosoftAzure','decryptString','data3','catch','show','params','keys','length','includeAll','find','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','join','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','get','state','Invalid\x20state\x20parameter','parse','from','base64','ascii','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','api','../../mysqldb','./cloudProvider.oauth','defaults','redis','localhost','sendStatus','status','end','json','offset','undefined','limit','set','update','then','destroy','error','stack','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key'];(function(_0x40ce4f,_0x3cf557){var _0xb9b23d=function(_0x1a5d17){while(--_0x1a5d17){_0x40ce4f['push'](_0x40ce4f['shift']());}};_0xb9b23d(++_0x3cf557);}(_0xfb06,0x1c3));var _0x6fb0=function(_0x2649e2,_0x3e73be){_0x2649e2=_0x2649e2-0x0;var _0x4797d4=_0xfb06[_0x2649e2];return _0x4797d4;};'use strict';var _=require('lodash');var Redis=require(_0x6fb0('0x0'));var qs=require(_0x6fb0('0x1'));var encryptor=require(_0x6fb0('0x2'));var config=require(_0x6fb0('0x3'));var logger=require('../../config/logger')(_0x6fb0('0x4'));var db=require(_0x6fb0('0x5'))['db'];var oauth=require(_0x6fb0('0x6'));config['redis']=_[_0x6fb0('0x7')](config[_0x6fb0('0x8')],{'host':_0x6fb0('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var redis=new Redis(config[_0x6fb0('0x8')]);function respondWithStatusCode(_0x4d674e,_0x41f98c){_0x41f98c=_0x41f98c||0xcc;return function(_0x584ad7){if(_0x584ad7){return _0x4d674e[_0x6fb0('0xa')](_0x41f98c);}return _0x4d674e[_0x6fb0('0xb')](_0x41f98c)[_0x6fb0('0xc')]();};}function respondWithResult(_0x57d227,_0x2587d6){_0x2587d6=_0x2587d6||0xc8;return function(_0x12b0ac){if(_0x12b0ac){return _0x57d227[_0x6fb0('0xb')](_0x2587d6)[_0x6fb0('0xd')](_0x12b0ac);}};}function respondWithFilteredResult(_0x55c3c3,_0x2cfce6){return function(_0x5a5113){if(_0x5a5113){var _0x307f7a=typeof _0x2cfce6[_0x6fb0('0xe')]===_0x6fb0('0xf')&&typeof _0x2cfce6[_0x6fb0('0x10')]===_0x6fb0('0xf');var _0x4998a5=_0x5a5113['count'];var _0x4a2305=_0x307f7a?0x0:_0x2cfce6[_0x6fb0('0xe')];var _0x3440dc=_0x307f7a?_0x5a5113['count']:_0x2cfce6['offset']+_0x2cfce6[_0x6fb0('0x10')];var _0x1a0e1a;if(_0x3440dc>=_0x4998a5){_0x3440dc=_0x4998a5;_0x1a0e1a=0xc8;}else{_0x1a0e1a=0xce;}_0x55c3c3[_0x6fb0('0xb')](_0x1a0e1a);return _0x55c3c3[_0x6fb0('0x11')]('Content-Range',_0x4a2305+'-'+_0x3440dc+'/'+_0x4998a5)[_0x6fb0('0xd')](_0x5a5113);}return null;};}function saveUpdates(_0x57fd4){return function(_0x176e62){if(_0x176e62){return _0x176e62[_0x6fb0('0x12')](_0x57fd4)[_0x6fb0('0x13')](function(_0xe36d30){return _0xe36d30;});}return null;};}function removeEntity(_0x341174){return function(_0x1a76f9){if(_0x1a76f9){return _0x1a76f9[_0x6fb0('0x14')]()[_0x6fb0('0x13')](function(){_0x341174[_0x6fb0('0xb')](0xcc)[_0x6fb0('0xc')]();});}};}function handleEntityNotFound(_0x261096){return function(_0x5dda04){if(!_0x5dda04){_0x261096[_0x6fb0('0xa')](0x194);}return _0x5dda04;};}function handleError(_0x2807a8,_0xb93d4f){_0xb93d4f=_0xb93d4f||0x1f4;return function(_0xaf236d){logger[_0x6fb0('0x15')](_0xaf236d[_0x6fb0('0x16')]);if(_0xaf236d[_0x6fb0('0x17')]){delete _0xaf236d[_0x6fb0('0x17')];}_0x2807a8[_0x6fb0('0xb')](_0xb93d4f)[_0x6fb0('0x18')](_0xaf236d);};}function maskClientSecret(_0x12a792){return _[_0x6fb0('0x19')](_0x12a792[_0x6fb0('0x1a')](0x0,0x3),0x14,'*');}exports[_0x6fb0('0x1b')]=function(_0x3890eb,_0x2536c7){var _0x58d939={},_0x211ec2={},_0x59a684={'count':0x0,'rows':[]};var _0x365ca9=_[_0x6fb0('0x1c')](db[_0x6fb0('0x1d')][_0x6fb0('0x1e')],function(_0x7ae3b2){return{'name':_0x7ae3b2[_0x6fb0('0x1f')],'type':_0x7ae3b2[_0x6fb0('0x20')][_0x6fb0('0x21')]};});_0x211ec2[_0x6fb0('0x22')]=_[_0x6fb0('0x1c')](_0x365ca9,'name');_0x211ec2['query']=_['keys'](_0x3890eb[_0x6fb0('0x23')]);_0x211ec2[_0x6fb0('0x24')]=_[_0x6fb0('0x25')](_0x211ec2[_0x6fb0('0x22')],_0x211ec2['query']);_0x58d939['attributes']=_[_0x6fb0('0x25')](_0x211ec2[_0x6fb0('0x22')],qs[_0x6fb0('0x26')](_0x3890eb[_0x6fb0('0x23')][_0x6fb0('0x26')]));_0x58d939[_0x6fb0('0x27')]=_0x58d939[_0x6fb0('0x27')]['length']?_0x58d939[_0x6fb0('0x27')]:_0x211ec2[_0x6fb0('0x22')];if(!_0x3890eb[_0x6fb0('0x23')][_0x6fb0('0x28')](_0x6fb0('0x29'))){_0x58d939[_0x6fb0('0x10')]=qs[_0x6fb0('0x10')](_0x3890eb[_0x6fb0('0x23')]['limit']);_0x58d939[_0x6fb0('0xe')]=qs['offset'](_0x3890eb[_0x6fb0('0x23')][_0x6fb0('0xe')]);}_0x58d939[_0x6fb0('0x2a')]=qs[_0x6fb0('0x2b')](_0x3890eb[_0x6fb0('0x23')][_0x6fb0('0x2b')]);_0x58d939[_0x6fb0('0x2c')]=qs[_0x6fb0('0x24')](_[_0x6fb0('0x2d')](_0x3890eb[_0x6fb0('0x23')],_0x211ec2['filters']),_0x365ca9);if(_0x3890eb[_0x6fb0('0x23')]['filter']){_0x58d939[_0x6fb0('0x2c')]=_[_0x6fb0('0x2e')](_0x58d939[_0x6fb0('0x2c')],{'$or':_[_0x6fb0('0x1c')](_0x365ca9,function(_0x46c392){if(_0x46c392[_0x6fb0('0x20')]!==_0x6fb0('0x2f')){var _0x44a122={};_0x44a122[_0x46c392[_0x6fb0('0x17')]]={'$like':'%'+_0x3890eb[_0x6fb0('0x23')][_0x6fb0('0x30')]+'%'};return _0x44a122;}})});}_0x58d939=_[_0x6fb0('0x2e')]({},_0x58d939,_0x3890eb[_0x6fb0('0x31')]);var _0x32701d={'where':_0x58d939['where']};return db[_0x6fb0('0x1d')][_0x6fb0('0x32')](_0x32701d)[_0x6fb0('0x13')](function(_0xaf1f7a){_0x59a684[_0x6fb0('0x32')]=_0xaf1f7a;if(_0x3890eb[_0x6fb0('0x23')]['includeAll']){_0x58d939[_0x6fb0('0x33')]=[{'all':!![]}];}return db[_0x6fb0('0x1d')][_0x6fb0('0x34')](_0x58d939);})[_0x6fb0('0x13')](function(_0x47fc3b){_0x59a684['rows']=_[_0x6fb0('0x1c')](_0x47fc3b,function(_0x132851){if(_0x132851[_0x6fb0('0x35')]===_0x6fb0('0x36')){var _0x7c112f=encryptor[_0x6fb0('0x37')](_0x132851[_0x6fb0('0x38')]);_0x132851['data3']=maskClientSecret(_0x7c112f);}return _0x132851;});return _0x59a684;})[_0x6fb0('0x13')](respondWithFilteredResult(_0x2536c7,_0x58d939))[_0x6fb0('0x39')](handleError(_0x2536c7,null));};exports[_0x6fb0('0x3a')]=function(_0x23a3de,_0x430bad){var _0x92e3b6={'raw':!![],'where':{'id':_0x23a3de[_0x6fb0('0x3b')]['id']}},_0x45c562={};_0x45c562['model']=_[_0x6fb0('0x3c')](db[_0x6fb0('0x1d')][_0x6fb0('0x1e')]);_0x45c562[_0x6fb0('0x23')]=_['keys'](_0x23a3de[_0x6fb0('0x23')]);_0x45c562[_0x6fb0('0x24')]=_[_0x6fb0('0x25')](_0x45c562[_0x6fb0('0x22')],_0x45c562[_0x6fb0('0x23')]);_0x92e3b6[_0x6fb0('0x27')]=_[_0x6fb0('0x25')](_0x45c562[_0x6fb0('0x22')],qs[_0x6fb0('0x26')](_0x23a3de[_0x6fb0('0x23')][_0x6fb0('0x26')]));_0x92e3b6[_0x6fb0('0x27')]=_0x92e3b6['attributes'][_0x6fb0('0x3d')]?_0x92e3b6['attributes']:_0x45c562[_0x6fb0('0x22')];if(_0x23a3de[_0x6fb0('0x23')][_0x6fb0('0x3e')]){_0x92e3b6[_0x6fb0('0x33')]=[{'all':!![]}];}_0x92e3b6=_[_0x6fb0('0x2e')]({},_0x92e3b6,_0x23a3de[_0x6fb0('0x31')]);return db[_0x6fb0('0x1d')][_0x6fb0('0x3f')](_0x92e3b6)[_0x6fb0('0x13')](handleEntityNotFound(_0x430bad,null))[_0x6fb0('0x13')](function(_0x5e6366){if(_0x5e6366[_0x6fb0('0x35')]===_0x6fb0('0x36')){var _0x4ed9ad=encryptor[_0x6fb0('0x37')](_0x5e6366[_0x6fb0('0x38')]);_0x5e6366['data3']=maskClientSecret(_0x4ed9ad);}return _0x5e6366;})[_0x6fb0('0x13')](respondWithResult(_0x430bad,null))['catch'](handleError(_0x430bad,null));};exports[_0x6fb0('0x40')]=function(_0x17267e,_0x540738){if(!_0x17267e[_0x6fb0('0x41')][_0x6fb0('0x17')])throw new Error(_0x6fb0('0x42'));if(!_0x17267e[_0x6fb0('0x41')][_0x6fb0('0x35')])throw new Error(_0x6fb0('0x43'));var _0x522dc8=db[_0x6fb0('0x1d')][_0x6fb0('0x1e')][_0x6fb0('0x35')][_0x6fb0('0x44')];if(!_0x522dc8[_0x6fb0('0x45')](_0x17267e[_0x6fb0('0x41')][_0x6fb0('0x35')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x522dc8[_0x6fb0('0x46')](',\x20'));if(_0x17267e[_0x6fb0('0x41')][_0x6fb0('0x35')]==='MicrosoftAzure'&&_0x17267e[_0x6fb0('0x41')][_0x6fb0('0x38')]){_0x17267e[_0x6fb0('0x41')][_0x6fb0('0x38')]=encryptor[_0x6fb0('0x47')](_0x17267e[_0x6fb0('0x41')]['data3']);}return db['CloudProvider']['create'](_0x17267e[_0x6fb0('0x41')],{})[_0x6fb0('0x13')](respondWithResult(_0x540738,0xc9))[_0x6fb0('0x39')](handleError(_0x540738,null));};exports[_0x6fb0('0x12')]=function(_0x1f0501,_0x1869ae){if(_0x1f0501[_0x6fb0('0x41')]['id']){delete _0x1f0501[_0x6fb0('0x41')]['id'];}return db[_0x6fb0('0x1d')]['find']({'where':{'id':_0x1f0501[_0x6fb0('0x3b')]['id']}})[_0x6fb0('0x13')](handleEntityNotFound(_0x1869ae,null))['then'](function(_0x473697){if(_0x473697[_0x6fb0('0x35')]==='MicrosoftAzure'&&_0x1f0501[_0x6fb0('0x41')]['data3']){_0x1f0501['body'][_0x6fb0('0x38')]=encryptor[_0x6fb0('0x47')](_0x1f0501['body'][_0x6fb0('0x38')]);}return _0x473697;})[_0x6fb0('0x13')](saveUpdates(_0x1f0501[_0x6fb0('0x41')],null))['then'](respondWithResult(_0x1869ae,null))[_0x6fb0('0x39')](handleError(_0x1869ae,null));};exports[_0x6fb0('0x14')]=function(_0x5af706,_0x1fa972){return db[_0x6fb0('0x1d')][_0x6fb0('0x3f')]({'where':{'id':_0x5af706['params']['id']}})['then'](handleEntityNotFound(_0x1fa972,null))['then'](removeEntity(_0x1fa972,null))[_0x6fb0('0x39')](handleError(_0x1fa972,null));};exports[_0x6fb0('0x48')]=function(_0x3e5d64,_0x164606){return db['CloudProvider'][_0x6fb0('0x49')]({'where':{'id':_0x3e5d64[_0x6fb0('0x3b')]['id']},'raw':!![]})[_0x6fb0('0x13')](function(_0x50f427){if(!_0x50f427)return _0x164606[_0x6fb0('0xa')](0x194);return{'url':oauth[_0x6fb0('0x4a')](_0x50f427,_0x3e5d64[_0x6fb0('0x4b')]['id'])};})[_0x6fb0('0x13')](respondWithResult(_0x164606,null))[_0x6fb0('0x39')](handleError(_0x164606,null));};exports['oauth2MicrosoftCallback']=function(_0x2bc6c9,_0x562fe7){var _0x1f0982=_0x2bc6c9[_0x6fb0('0x41')];var _0x263885;var _0xa6975d;if(_0x1f0982[_0x6fb0('0x15')])throw _0x1f0982;redis[_0x6fb0('0x4c')](_0x1f0982[_0x6fb0('0x4d')])[_0x6fb0('0x13')](function(_0x3dd3ad){if(!_0x3dd3ad)throw new Error(_0x6fb0('0x4e'));_0x263885=JSON[_0x6fb0('0x4f')](_0x3dd3ad);var _0x34fe54=Buffer[_0x6fb0('0x50')](_0x1f0982[_0x6fb0('0x4d')],_0x6fb0('0x51'))['toString'](_0x6fb0('0x52'));_0xa6975d=JSON[_0x6fb0('0x4f')](_0x34fe54);if(!oauth['isValidIdToken'](_0x1f0982['id_token'],_0x263885[_0x6fb0('0x53')]))throw new Error(_0x6fb0('0x54'));redis[_0x6fb0('0x55')](_0x1f0982[_0x6fb0('0x4d')]);return oauth[_0x6fb0('0x56')](_0x1f0982['code'],_0x263885);})[_0x6fb0('0x13')](function(_0x14ef23){_0x263885[_0x6fb0('0x57')]=_0x14ef23[_0x6fb0('0x58')];_0x263885[_0x6fb0('0x59')]=_0x14ef23[_0x6fb0('0x5a')];return db['CloudProvider']['update']({'data5':_0x263885[_0x6fb0('0x57')],'data6':_0x263885[_0x6fb0('0x59')]},{'where':{'id':_0x263885['id']}});})[_0x6fb0('0x13')](function(){oauth[_0x6fb0('0x5b')](_0x263885);socket[_0x6fb0('0x5c')]('microsoftAuthorization:success',{'id':_0xa6975d['id']});return;})[_0x6fb0('0x13')](respondWithStatusCode(_0x562fe7,null))['catch'](function(_0x51f844){if(_0xa6975d){socket[_0x6fb0('0x5c')](_0x6fb0('0x5d'),{'id':_0xa6975d['id']});}if(!_0x263885){logger['error'](_0x6fb0('0x5e'),_0x51f844);return _0x562fe7[_0x6fb0('0xb')](0x1f4)[_0x6fb0('0x18')](_0x51f844[_0x6fb0('0x5f')]);}logger['error']('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x263885['id'],JSON[_0x6fb0('0x60')](_0x51f844));});}; \ No newline at end of file +var _0x92a2=['socket.io-emitter','sendStatus','end','json','offset','limit','undefined','count','status','set','then','destroy','error','stack','name','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','keys','options','find','create','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','body','update','encryptString','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','state','parse','from','base64','toString','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','emit','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','send','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','./cloudProvider.oauth','redis','defaults'];(function(_0xe8b9c7,_0x534838){var _0x4b606f=function(_0x355178){while(--_0x355178){_0xe8b9c7['push'](_0xe8b9c7['shift']());}};_0x4b606f(++_0x534838);}(_0x92a2,0x11a));var _0x292a=function(_0x164acd,_0x4a3160){_0x164acd=_0x164acd-0x0;var _0x2983e1=_0x92a2[_0x164acd];return _0x2983e1;};'use strict';var _=require(_0x292a('0x0'));var Redis=require(_0x292a('0x1'));var qs=require(_0x292a('0x2'));var encryptor=require(_0x292a('0x3'));var config=require(_0x292a('0x4'));var logger=require(_0x292a('0x5'))('api');var db=require('../../mysqldb')['db'];var oauth=require(_0x292a('0x6'));config[_0x292a('0x7')]=_[_0x292a('0x8')](config[_0x292a('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x292a('0x9'))(new Redis(config['redis']));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x2637e4,_0x8f6a6b){_0x8f6a6b=_0x8f6a6b||0xcc;return function(_0x168deb){if(_0x168deb){return _0x2637e4[_0x292a('0xa')](_0x8f6a6b);}return _0x2637e4['status'](_0x8f6a6b)[_0x292a('0xb')]();};}function respondWithResult(_0x58fb88,_0x52883f){_0x52883f=_0x52883f||0xc8;return function(_0x51b3f0){if(_0x51b3f0){return _0x58fb88['status'](_0x52883f)[_0x292a('0xc')](_0x51b3f0);}};}function respondWithFilteredResult(_0x17df08,_0x44e87b){return function(_0x12f213){if(_0x12f213){var _0x3dfcf0=typeof _0x44e87b[_0x292a('0xd')]==='undefined'&&typeof _0x44e87b[_0x292a('0xe')]===_0x292a('0xf');var _0x318bbb=_0x12f213['count'];var _0x1fd2f8=_0x3dfcf0?0x0:_0x44e87b[_0x292a('0xd')];var _0x3bea94=_0x3dfcf0?_0x12f213[_0x292a('0x10')]:_0x44e87b[_0x292a('0xd')]+_0x44e87b[_0x292a('0xe')];var _0x28abf1;if(_0x3bea94>=_0x318bbb){_0x3bea94=_0x318bbb;_0x28abf1=0xc8;}else{_0x28abf1=0xce;}_0x17df08[_0x292a('0x11')](_0x28abf1);return _0x17df08[_0x292a('0x12')]('Content-Range',_0x1fd2f8+'-'+_0x3bea94+'/'+_0x318bbb)['json'](_0x12f213);}return null;};}function saveUpdates(_0xc1c569){return function(_0x1ffad7){if(_0x1ffad7){return _0x1ffad7['update'](_0xc1c569)[_0x292a('0x13')](function(_0x414012){return _0x414012;});}return null;};}function removeEntity(_0x3976e3){return function(_0x1b8ccf){if(_0x1b8ccf){return _0x1b8ccf[_0x292a('0x14')]()[_0x292a('0x13')](function(){_0x3976e3[_0x292a('0x11')](0xcc)[_0x292a('0xb')]();});}};}function handleEntityNotFound(_0x514413){return function(_0x47b348){if(!_0x47b348){_0x514413['sendStatus'](0x194);}return _0x47b348;};}function handleError(_0x58f717,_0x5cf62f){_0x5cf62f=_0x5cf62f||0x1f4;return function(_0x15ab64){logger[_0x292a('0x15')](_0x15ab64[_0x292a('0x16')]);if(_0x15ab64[_0x292a('0x17')]){delete _0x15ab64[_0x292a('0x17')];}_0x58f717['status'](_0x5cf62f)['send'](_0x15ab64);};}function maskClientSecret(_0x354ed9){return _[_0x292a('0x18')](_0x354ed9[_0x292a('0x19')](0x0,0x3),0x14,'*');}exports[_0x292a('0x1a')]=function(_0x18b463,_0x10d580){var _0x2fbf08={},_0x5df4ca={},_0x116cbb={'count':0x0,'rows':[]};var _0x510281=_[_0x292a('0x1b')](db[_0x292a('0x1c')][_0x292a('0x1d')],function(_0xee01ae){return{'name':_0xee01ae[_0x292a('0x1e')],'type':_0xee01ae[_0x292a('0x1f')][_0x292a('0x20')]};});_0x5df4ca[_0x292a('0x21')]=_[_0x292a('0x1b')](_0x510281,_0x292a('0x17'));_0x5df4ca[_0x292a('0x22')]=_['keys'](_0x18b463[_0x292a('0x22')]);_0x5df4ca[_0x292a('0x23')]=_[_0x292a('0x24')](_0x5df4ca[_0x292a('0x21')],_0x5df4ca[_0x292a('0x22')]);_0x2fbf08[_0x292a('0x25')]=_[_0x292a('0x24')](_0x5df4ca[_0x292a('0x21')],qs[_0x292a('0x26')](_0x18b463[_0x292a('0x22')][_0x292a('0x26')]));_0x2fbf08[_0x292a('0x25')]=_0x2fbf08['attributes'][_0x292a('0x27')]?_0x2fbf08[_0x292a('0x25')]:_0x5df4ca['model'];if(!_0x18b463[_0x292a('0x22')][_0x292a('0x28')](_0x292a('0x29'))){_0x2fbf08['limit']=qs['limit'](_0x18b463['query'][_0x292a('0xe')]);_0x2fbf08[_0x292a('0xd')]=qs[_0x292a('0xd')](_0x18b463[_0x292a('0x22')][_0x292a('0xd')]);}_0x2fbf08[_0x292a('0x2a')]=qs[_0x292a('0x2b')](_0x18b463[_0x292a('0x22')]['sort']);_0x2fbf08[_0x292a('0x2c')]=qs['filters'](_[_0x292a('0x2d')](_0x18b463[_0x292a('0x22')],_0x5df4ca['filters']),_0x510281);if(_0x18b463[_0x292a('0x22')][_0x292a('0x2e')]){_0x2fbf08['where']=_[_0x292a('0x2f')](_0x2fbf08['where'],{'$or':_[_0x292a('0x1b')](_0x510281,function(_0xf46783){if(_0xf46783[_0x292a('0x1f')]!==_0x292a('0x30')){var _0x36f6be={};_0x36f6be[_0xf46783[_0x292a('0x17')]]={'$like':'%'+_0x18b463[_0x292a('0x22')][_0x292a('0x2e')]+'%'};return _0x36f6be;}})});}_0x2fbf08=_[_0x292a('0x2f')]({},_0x2fbf08,_0x18b463['options']);var _0x418364={'where':_0x2fbf08[_0x292a('0x2c')]};return db[_0x292a('0x1c')][_0x292a('0x10')](_0x418364)[_0x292a('0x13')](function(_0x5cad83){_0x116cbb[_0x292a('0x10')]=_0x5cad83;if(_0x18b463[_0x292a('0x22')][_0x292a('0x31')]){_0x2fbf08[_0x292a('0x32')]=[{'all':!![]}];}return db[_0x292a('0x1c')][_0x292a('0x33')](_0x2fbf08);})[_0x292a('0x13')](function(_0x2498fe){_0x116cbb[_0x292a('0x34')]=_[_0x292a('0x1b')](_0x2498fe,function(_0x41908d){if(_0x41908d[_0x292a('0x35')]===_0x292a('0x36')){var _0x28f54d=encryptor[_0x292a('0x37')](_0x41908d['data3']);_0x41908d[_0x292a('0x38')]=maskClientSecret(_0x28f54d);}return _0x41908d;});return _0x116cbb;})['then'](respondWithFilteredResult(_0x10d580,_0x2fbf08))[_0x292a('0x39')](handleError(_0x10d580,null));};exports[_0x292a('0x3a')]=function(_0x73ead9,_0x11856e){var _0x24faf3={'raw':!![],'where':{'id':_0x73ead9[_0x292a('0x3b')]['id']}},_0x3b3492={};_0x3b3492[_0x292a('0x21')]=_[_0x292a('0x3c')](db[_0x292a('0x1c')]['rawAttributes']);_0x3b3492[_0x292a('0x22')]=_[_0x292a('0x3c')](_0x73ead9[_0x292a('0x22')]);_0x3b3492[_0x292a('0x23')]=_[_0x292a('0x24')](_0x3b3492[_0x292a('0x21')],_0x3b3492['query']);_0x24faf3[_0x292a('0x25')]=_[_0x292a('0x24')](_0x3b3492[_0x292a('0x21')],qs['fields'](_0x73ead9['query']['fields']));_0x24faf3[_0x292a('0x25')]=_0x24faf3[_0x292a('0x25')][_0x292a('0x27')]?_0x24faf3['attributes']:_0x3b3492[_0x292a('0x21')];if(_0x73ead9[_0x292a('0x22')][_0x292a('0x31')]){_0x24faf3[_0x292a('0x32')]=[{'all':!![]}];}_0x24faf3=_[_0x292a('0x2f')]({},_0x24faf3,_0x73ead9[_0x292a('0x3d')]);return db['CloudProvider'][_0x292a('0x3e')](_0x24faf3)[_0x292a('0x13')](handleEntityNotFound(_0x11856e,null))[_0x292a('0x13')](function(_0x368e98){if(_0x368e98[_0x292a('0x35')]==='MicrosoftAzure'){var _0x6e319d=encryptor[_0x292a('0x37')](_0x368e98[_0x292a('0x38')]);_0x368e98[_0x292a('0x38')]=maskClientSecret(_0x6e319d);}return _0x368e98;})[_0x292a('0x13')](respondWithResult(_0x11856e,null))[_0x292a('0x39')](handleError(_0x11856e,null));};exports[_0x292a('0x3f')]=function(_0x325944,_0x13e745){if(!_0x325944['body'][_0x292a('0x17')])throw new Error(_0x292a('0x40'));if(!_0x325944['body'][_0x292a('0x35')])throw new Error(_0x292a('0x41'));var _0x391151=db[_0x292a('0x1c')]['rawAttributes'][_0x292a('0x35')][_0x292a('0x42')];if(!_0x391151[_0x292a('0x43')](_0x325944['body'][_0x292a('0x35')]))throw new Error(_0x292a('0x44')+_0x391151['join'](',\x20'));if(_0x325944[_0x292a('0x45')][_0x292a('0x35')]===_0x292a('0x36')&&_0x325944[_0x292a('0x45')][_0x292a('0x38')]){_0x325944[_0x292a('0x45')]['data3']=encryptor['encryptString'](_0x325944['body'][_0x292a('0x38')]);}return db[_0x292a('0x1c')]['create'](_0x325944[_0x292a('0x45')],{})[_0x292a('0x13')](respondWithResult(_0x13e745,0xc9))[_0x292a('0x39')](handleError(_0x13e745,null));};exports[_0x292a('0x46')]=function(_0x5184dc,_0xd6062f){if(_0x5184dc[_0x292a('0x45')]['id']){delete _0x5184dc[_0x292a('0x45')]['id'];}return db[_0x292a('0x1c')]['find']({'where':{'id':_0x5184dc[_0x292a('0x3b')]['id']}})[_0x292a('0x13')](handleEntityNotFound(_0xd6062f,null))[_0x292a('0x13')](function(_0x54c88e){if(_0x54c88e[_0x292a('0x35')]===_0x292a('0x36')&&_0x5184dc[_0x292a('0x45')][_0x292a('0x38')]){_0x5184dc[_0x292a('0x45')][_0x292a('0x38')]=encryptor[_0x292a('0x47')](_0x5184dc['body'][_0x292a('0x38')]);}return _0x54c88e;})[_0x292a('0x13')](saveUpdates(_0x5184dc[_0x292a('0x45')],null))[_0x292a('0x13')](respondWithResult(_0xd6062f,null))[_0x292a('0x39')](handleError(_0xd6062f,null));};exports[_0x292a('0x14')]=function(_0x21e529,_0x53bd86){return db[_0x292a('0x1c')][_0x292a('0x3e')]({'where':{'id':_0x21e529['params']['id']}})[_0x292a('0x13')](handleEntityNotFound(_0x53bd86,null))[_0x292a('0x13')](removeEntity(_0x53bd86,null))[_0x292a('0x39')](handleError(_0x53bd86,null));};exports[_0x292a('0x48')]=function(_0x48428e,_0x4657a4){return db['CloudProvider']['findOne']({'where':{'id':_0x48428e[_0x292a('0x3b')]['id']},'raw':!![]})[_0x292a('0x13')](function(_0x4051f8){if(!_0x4051f8)return _0x4657a4[_0x292a('0xa')](0x194);return{'url':oauth[_0x292a('0x49')](_0x4051f8,_0x48428e[_0x292a('0x4a')]['id'])};})[_0x292a('0x13')](respondWithResult(_0x4657a4,null))[_0x292a('0x39')](handleError(_0x4657a4,null));};exports[_0x292a('0x4b')]=function(_0x5f1c5b,_0x350901){var _0xc5f14c=_0x5f1c5b[_0x292a('0x45')];var _0x39988d;var _0x3a9cb3;if(_0xc5f14c['error'])throw _0xc5f14c;redis['get'](_0xc5f14c[_0x292a('0x4c')])['then'](function(_0x5bb6f6){if(!_0x5bb6f6)throw new Error('Invalid\x20state\x20parameter');_0x39988d=JSON[_0x292a('0x4d')](_0x5bb6f6);var _0x43431c=Buffer[_0x292a('0x4e')](_0xc5f14c[_0x292a('0x4c')],_0x292a('0x4f'))[_0x292a('0x50')]('ascii');_0x3a9cb3=JSON[_0x292a('0x4d')](_0x43431c);if(!oauth[_0x292a('0x51')](_0xc5f14c[_0x292a('0x52')],_0x39988d[_0x292a('0x53')]))throw new Error(_0x292a('0x54'));redis[_0x292a('0x55')](_0xc5f14c[_0x292a('0x4c')]);return oauth[_0x292a('0x56')](_0xc5f14c[_0x292a('0x57')],_0x39988d);})[_0x292a('0x13')](function(_0x3c4304){_0x39988d[_0x292a('0x58')]=_0x3c4304[_0x292a('0x59')];_0x39988d[_0x292a('0x5a')]=_0x3c4304[_0x292a('0x5b')];return db[_0x292a('0x1c')][_0x292a('0x46')]({'data5':_0x39988d['data5'],'data6':_0x39988d[_0x292a('0x5a')]},{'where':{'id':_0x39988d['id']}});})['then'](function(){oauth['startRefreshInterval'](_0x39988d);socket[_0x292a('0x5c')](_0x292a('0x5d'),{'id':_0x3a9cb3['id']});return;})['then'](respondWithStatusCode(_0x350901,null))[_0x292a('0x39')](function(_0x495687){if(_0x3a9cb3){socket['emit']('microsoftAuthorization:error',{'id':_0x3a9cb3['id']});}if(!_0x39988d){logger[_0x292a('0x15')](_0x292a('0x5e'),_0x495687);return _0x350901[_0x292a('0x11')](0x1f4)[_0x292a('0x5f')](_0x495687['message']);}logger[_0x292a('0x15')](_0x292a('0x60'),_0x39988d['id'],JSON['stringify'](_0x495687));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 89611d2..1cc105d 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 _0x06f0=['exports','define','CloudProvider','cloud_providers','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes'];(function(_0x16f8c6,_0x351149){var _0x1dcd00=function(_0xf763fb){while(--_0xf763fb){_0x16f8c6['push'](_0x16f8c6['shift']());}};_0x1dcd00(++_0x351149);}(_0x06f0,0x164));var _0x006f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x06f0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x006f('0x0'))(_0x006f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x006f('0x2'));var fs=require('fs');var path=require(_0x006f('0x3'));var rimraf=require(_0x006f('0x4'));var config=require(_0x006f('0x5'));var attributes=require(_0x006f('0x6'));module[_0x006f('0x7')]=function(_0x6ce500,_0x1c4123){return _0x6ce500[_0x006f('0x8')](_0x006f('0x9'),attributes,{'tableName':_0x006f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x27b4=['api','request-promise','path','./cloudProvider.attributes','exports','CloudProvider','cloud_providers','lodash','util'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x27b4,0x1c0));var _0x427b=function(_0x1ef1b1,_0x282ddb){_0x1ef1b1=_0x1ef1b1-0x0;var _0x3650d6=_0x27b4[_0x1ef1b1];return _0x3650d6;};'use strict';var _=require(_0x427b('0x0'));var util=require(_0x427b('0x1'));var logger=require('../../config/logger')(_0x427b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x427b('0x3'));var fs=require('fs');var path=require(_0x427b('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x427b('0x5'));module[_0x427b('0x6')]=function(_0x8daaa9,_0x1ae3b9){return _0x8daaa9['define'](_0x427b('0x7'),attributes,{'tableName':_0x427b('0x8'),'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 4258acc..0de5ec0 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 _0x40da=['bind','findAll','all','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','../../components/encryptor','../../config/environment','../../config/logger','redis','defaults','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','replace','{TENANT_ID}','code','id_token','from','stringify','toString','randomBytes','data1','response_type','data4','response_mode','form_post','scope','state','nonce','prompt','login','value','oauth2Claims','set','decode','payload','iss','issuer','aud','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider','refresh_token','data6','POST','data2','data5','update','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','decryptString','intervals'];(function(_0x4adbb0,_0x5f5a74){var _0x5e235c=function(_0x3e84e7){while(--_0x3e84e7){_0x4adbb0['push'](_0x4adbb0['shift']());}};_0x5e235c(++_0x5f5a74);}(_0x40da,0x1da));var _0xa40d=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x40da[_0x45d55e];return _0x29812a;};'use strict';var _=require(_0xa40d('0x0'));var crypto=require(_0xa40d('0x1'));var jwt=require(_0xa40d('0x2'));var moment=require(_0xa40d('0x3'));var Redis=require(_0xa40d('0x4'));var rp=require(_0xa40d('0x5'));var util=require('util');var encryptor=require(_0xa40d('0x6'));var config=require(_0xa40d('0x7'));var logger=require(_0xa40d('0x8'))('api');var schedule=require('../../config/schedule/cloud-provider');var db=require('../../mysqldb')['db'];config[_0xa40d('0x9')]=_[_0xa40d('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0xa40d('0x9')]);var MICROSOFT_AUTH_URL=_0xa40d('0xb');var AZURE_AUTH_SCOPES={'Outlook365':[_0xa40d('0xc'),'profile','email',_0xa40d('0xd'),_0xa40d('0xe'),_0xa40d('0xf'),_0xa40d('0x10')],'Dynamics365':['openid','offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xa40d('0x11');var MICROSOFT_TOKEN_ENDPOINT=_0xa40d('0x12');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x18f7e9){var _0x419d6b=_[_0xa40d('0x13')](AZURE_AUTH_SCOPES[_0x18f7e9[_0xa40d('0x14')]]);if(_0x18f7e9[_0xa40d('0x14')]===_0xa40d('0x15'))_0x419d6b[_0xa40d('0x16')](_0x18f7e9[_0xa40d('0x17')]+_0xa40d('0x18'));return _0x419d6b[_0xa40d('0x19')]('\x20');}function getAccessTokenScope(_0x4ac112){if(_0x4ac112[_0xa40d('0x14')]===_0xa40d('0x1a'))return _0xa40d('0xe');if(_0x4ac112[_0xa40d('0x14')]===_0xa40d('0x15'))return _0x4ac112[_0xa40d('0x17')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x28cc20,_0x32a59b){var _0x53e993=MICROSOFT_AUTH_URL[_0xa40d('0x1b')](_0xa40d('0x1c'),_0x28cc20['data2']);var _0x16b5e5=[_0xa40d('0x1d'),_0xa40d('0x1e')];var _0x89de0b=Buffer[_0xa40d('0x1f')](JSON[_0xa40d('0x20')]({'id':_0x32a59b}))[_0xa40d('0x21')]('base64');var _0x50db05=crypto[_0xa40d('0x22')](0x10)['toString']('hex');var _0x5a63dd=getAuthorizationScopes(_0x28cc20);var _0x275460=[{'key':'client_id','value':_0x28cc20[_0xa40d('0x23')]},{'key':_0xa40d('0x24'),'value':encodeURIComponent(_0x16b5e5[_0xa40d('0x19')]('\x20'))},{'key':'redirect_uri','value':_0x28cc20[_0xa40d('0x25')]},{'key':_0xa40d('0x26'),'value':_0xa40d('0x27')},{'key':_0xa40d('0x28'),'value':encodeURIComponent(_0x5a63dd)},{'key':_0xa40d('0x29'),'value':_0x89de0b},{'key':_0xa40d('0x2a'),'value':_0x50db05},{'key':_0xa40d('0x2b'),'value':_0xa40d('0x2c')}];var _0x16bc4f=_0x53e993+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xa40d('0x13')](_0x275460,function(_0x511b6d){return _0x511b6d['key']+'='+_0x511b6d[_0xa40d('0x2d')];})['join']('&');_0x28cc20[_0xa40d('0x2e')]={'issuer':_0x53e993['replace']('oauth2/',''),'audience':_0x28cc20[_0xa40d('0x23')],'state':_0x89de0b,'nonce':_0x50db05};redis[_0xa40d('0x2f')](_0x89de0b,JSON[_0xa40d('0x20')](_0x28cc20));return _0x16bc4f;}function isValidIdToken(_0x3ef15f,_0x1a5248){try{var _0x44f4e9=jwt[_0xa40d('0x30')](_0x3ef15f,{'complete':!![]});var _0x4b60e3=_0x44f4e9[_0xa40d('0x31')];if(_0x4b60e3[_0xa40d('0x32')]!==_0x1a5248[_0xa40d('0x33')])return![];if(_0x4b60e3[_0xa40d('0x34')]!==_0x1a5248[_0xa40d('0x35')])return![];if(_0x4b60e3['nonce']!==_0x1a5248[_0xa40d('0x2a')])return![];if(moment()[_0xa40d('0x36')](moment[_0xa40d('0x37')](_0x4b60e3[_0xa40d('0x38')])))return![];return!![];}catch(_0x433a35){throw _0x433a35;}}function refreshOauth2MicrosoftAccessToken(_0x4b7381){return Promise[_0xa40d('0x39')]()[_0xa40d('0x3a')](function(){if(_0x4b7381[_0xa40d('0x3b')])return _0x4b7381;return db[_0xa40d('0x3c')]['findOne']({'where':{'id':_0x4b7381['id']},'raw':!![]});})[_0xa40d('0x3a')](function(_0xa96189){var _0x43eaad={'grant_type':_0xa40d('0x3d'),'refresh_token':_0xa96189[_0xa40d('0x3e')],'scope':getAccessTokenScope(_0xa96189),'redirect_uri':_0xa96189[_0xa40d('0x25')],'client_id':_0xa96189['data1'],'client_secret':encryptor['decryptString'](_0xa96189['data3'])};var _0x4c6aa5={'method':_0xa40d('0x3f'),'uri':MICROSOFT_AUTH_URL['replace'](_0xa40d('0x1c'),_0xa96189[_0xa40d('0x40')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x43eaad,'json':!![]};return rp(_0x4c6aa5);})[_0xa40d('0x3a')](function(_0x14477a){_0x4b7381[_0xa40d('0x41')]=_0x14477a['access_token'];_0x4b7381[_0xa40d('0x3e')]=_0x14477a['refresh_token'];return db[_0xa40d('0x3c')][_0xa40d('0x42')]({'data5':_0x4b7381[_0xa40d('0x41')],'data6':_0x4b7381[_0xa40d('0x3e')]},{'where':{'id':_0x4b7381['id']}});})[_0xa40d('0x3a')](function(){return _0x4b7381;})[_0xa40d('0x43')](function(_0x4e5f6c){logger['error'](_0xa40d('0x44'),_0x4b7381['id'],_0x4e5f6c);});}function getOauth2MicrosoftAccessToken(_0x2a435f,_0x332abb){var _0x1af73d={'grant_type':_0xa40d('0x45'),'code':_0x2a435f,'scope':getAccessTokenScope(_0x332abb),'redirect_uri':_0x332abb[_0xa40d('0x25')],'client_id':_0x332abb['data1'],'client_secret':encryptor[_0xa40d('0x46')](_0x332abb[_0xa40d('0x3b')])};var _0x4bb788={'method':_0xa40d('0x3f'),'uri':MICROSOFT_AUTH_URL['replace'](_0xa40d('0x1c'),_0x332abb[_0xa40d('0x40')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1af73d,'json':!![]};return rp(_0x4bb788);}function startRefreshInterval(_0x622e00){var _0x2d8026=schedule[_0xa40d('0x47')];if(_0x2d8026[_0x622e00['id']])clearInterval(_0x2d8026[_0x622e00['id']]);_0x2d8026[_0x622e00['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xa40d('0x48')](this,{'id':_0x622e00['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x2d8026;}function startAllRefreshIntervals(){return db[_0xa40d('0x3c')][_0xa40d('0x49')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x1e7ac5){var _0x488fec=_0x1e7ac5[_0xa40d('0x13')](function(_0x3fc45c){return refreshOauth2MicrosoftAccessToken(_0x3fc45c)[_0xa40d('0x3a')](function(_0xc03c2a){startRefreshInterval(_0xc03c2a);});});return Promise[_0xa40d('0x4a')](_0x488fec);})['catch'](function(_0x679c94){var _0x16bc57=_0x679c94?util['inspect'](_0x679c94,{'showHidden':![],'depth':null}):'';logger[_0xa40d('0x4b')](_0xa40d('0x4c'),_0x16bc57);});}module[_0xa40d('0x4d')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x0ec5=['issuer','aud','isAfter','unix','exp','resolve','then','data3','findOne','refresh_token','POST','data2','data6','CloudProvider','update','data5','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','intervals','findAll','all','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','moment','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','map','type','Dynamics365','push','data7','/.default','join','Outlook365','replace','{TENANT_ID}','id_token','from','stringify','base64','randomBytes','toString','hex','client_id','data1','data4','form_post','state','nonce','prompt','login','key','value','oauth2Claims','oauth2/','set','payload','iss'];(function(_0x3dfc6f,_0x3d0a7f){var _0x5e09b2=function(_0x444588){while(--_0x444588){_0x3dfc6f['push'](_0x3dfc6f['shift']());}};_0x5e09b2(++_0x3d0a7f);}(_0x0ec5,0x19a));var _0x50ec=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x0ec5[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0x50ec('0x0'));var crypto=require(_0x50ec('0x1'));var jwt=require('jsonwebtoken');var moment=require(_0x50ec('0x2'));var Redis=require('ioredis');var rp=require('request-promise');var util=require(_0x50ec('0x3'));var encryptor=require(_0x50ec('0x4'));var config=require(_0x50ec('0x5'));var logger=require(_0x50ec('0x6'))(_0x50ec('0x7'));var schedule=require(_0x50ec('0x8'));var db=require(_0x50ec('0x9'))['db'];config['redis']=_['defaults'](config[_0x50ec('0xa')],{'host':_0x50ec('0xb'),'port':0x18eb});var redis=new Redis(config[_0x50ec('0xa')]);var MICROSOFT_AUTH_URL=_0x50ec('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0x50ec('0xd'),_0x50ec('0xe'),_0x50ec('0xf'),_0x50ec('0x10'),_0x50ec('0x11'),_0x50ec('0x12'),_0x50ec('0x13')],'Dynamics365':[_0x50ec('0xd'),_0x50ec('0x10')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x368550){var _0x5da7e7=_[_0x50ec('0x14')](AZURE_AUTH_SCOPES[_0x368550[_0x50ec('0x15')]]);if(_0x368550['type']===_0x50ec('0x16'))_0x5da7e7[_0x50ec('0x17')](_0x368550[_0x50ec('0x18')]+_0x50ec('0x19'));return _0x5da7e7[_0x50ec('0x1a')]('\x20');}function getAccessTokenScope(_0x3358a8){if(_0x3358a8[_0x50ec('0x15')]===_0x50ec('0x1b'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x3358a8[_0x50ec('0x15')]===_0x50ec('0x16'))return _0x3358a8[_0x50ec('0x18')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x587346,_0x489acc){var _0x4094fe=MICROSOFT_AUTH_URL[_0x50ec('0x1c')](_0x50ec('0x1d'),_0x587346['data2']);var _0x221fe4=['code',_0x50ec('0x1e')];var _0x56331d=Buffer[_0x50ec('0x1f')](JSON[_0x50ec('0x20')]({'id':_0x489acc}))['toString'](_0x50ec('0x21'));var _0x48e598=crypto[_0x50ec('0x22')](0x10)[_0x50ec('0x23')](_0x50ec('0x24'));var _0x597808=getAuthorizationScopes(_0x587346);var _0x361d23=[{'key':_0x50ec('0x25'),'value':_0x587346[_0x50ec('0x26')]},{'key':'response_type','value':encodeURIComponent(_0x221fe4[_0x50ec('0x1a')]('\x20'))},{'key':'redirect_uri','value':_0x587346[_0x50ec('0x27')]},{'key':'response_mode','value':_0x50ec('0x28')},{'key':'scope','value':encodeURIComponent(_0x597808)},{'key':_0x50ec('0x29'),'value':_0x56331d},{'key':_0x50ec('0x2a'),'value':_0x48e598},{'key':_0x50ec('0x2b'),'value':_0x50ec('0x2c')}];var _0x42b144=_0x4094fe+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x50ec('0x14')](_0x361d23,function(_0x4c6a3a){return _0x4c6a3a[_0x50ec('0x2d')]+'='+_0x4c6a3a[_0x50ec('0x2e')];})[_0x50ec('0x1a')]('&');_0x587346[_0x50ec('0x2f')]={'issuer':_0x4094fe[_0x50ec('0x1c')](_0x50ec('0x30'),''),'audience':_0x587346[_0x50ec('0x26')],'state':_0x56331d,'nonce':_0x48e598};redis[_0x50ec('0x31')](_0x56331d,JSON[_0x50ec('0x20')](_0x587346));return _0x42b144;}function isValidIdToken(_0x1df27a,_0x53d5ef){try{var _0x475b97=jwt['decode'](_0x1df27a,{'complete':!![]});var _0x4d4e6a=_0x475b97[_0x50ec('0x32')];if(_0x4d4e6a[_0x50ec('0x33')]!==_0x53d5ef[_0x50ec('0x34')])return![];if(_0x4d4e6a[_0x50ec('0x35')]!==_0x53d5ef['audience'])return![];if(_0x4d4e6a['nonce']!==_0x53d5ef[_0x50ec('0x2a')])return![];if(moment()[_0x50ec('0x36')](moment[_0x50ec('0x37')](_0x4d4e6a[_0x50ec('0x38')])))return![];return!![];}catch(_0x795f3d){throw _0x795f3d;}}function refreshOauth2MicrosoftAccessToken(_0x4c36ff){return Promise[_0x50ec('0x39')]()[_0x50ec('0x3a')](function(){if(_0x4c36ff[_0x50ec('0x3b')])return _0x4c36ff;return db['CloudProvider'][_0x50ec('0x3c')]({'where':{'id':_0x4c36ff['id']},'raw':!![]});})[_0x50ec('0x3a')](function(_0x1de542){var _0x6b9c1e={'grant_type':_0x50ec('0x3d'),'refresh_token':_0x1de542['data6'],'scope':getAccessTokenScope(_0x1de542),'redirect_uri':_0x1de542['data4'],'client_id':_0x1de542['data1'],'client_secret':encryptor['decryptString'](_0x1de542[_0x50ec('0x3b')])};var _0x130159={'method':_0x50ec('0x3e'),'uri':MICROSOFT_AUTH_URL[_0x50ec('0x1c')](_0x50ec('0x1d'),_0x1de542[_0x50ec('0x3f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x6b9c1e,'json':!![]};return rp(_0x130159);})[_0x50ec('0x3a')](function(_0x3afcea){_0x4c36ff['data5']=_0x3afcea['access_token'];_0x4c36ff[_0x50ec('0x40')]=_0x3afcea[_0x50ec('0x3d')];return db[_0x50ec('0x41')][_0x50ec('0x42')]({'data5':_0x4c36ff[_0x50ec('0x43')],'data6':_0x4c36ff['data6']},{'where':{'id':_0x4c36ff['id']}});})[_0x50ec('0x3a')](function(){return _0x4c36ff;})[_0x50ec('0x44')](function(_0x42592d){logger['error'](_0x50ec('0x45'),_0x4c36ff['id'],_0x42592d);});}function getOauth2MicrosoftAccessToken(_0x5d6ce6,_0xd9db6d){var _0xd2fd98={'grant_type':'authorization_code','code':_0x5d6ce6,'scope':getAccessTokenScope(_0xd9db6d),'redirect_uri':_0xd9db6d['data4'],'client_id':_0xd9db6d[_0x50ec('0x26')],'client_secret':encryptor['decryptString'](_0xd9db6d[_0x50ec('0x3b')])};var _0x4d2ded={'method':_0x50ec('0x3e'),'uri':MICROSOFT_AUTH_URL[_0x50ec('0x1c')](_0x50ec('0x1d'),_0xd9db6d[_0x50ec('0x3f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0xd2fd98,'json':!![]};return rp(_0x4d2ded);}function startRefreshInterval(_0x5a954e){var _0x467b41=schedule[_0x50ec('0x46')];if(_0x467b41[_0x5a954e['id']])clearInterval(_0x467b41[_0x5a954e['id']]);_0x467b41[_0x5a954e['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x5a954e['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x50ec('0x46')]=_0x467b41;}function startAllRefreshIntervals(){return db[_0x50ec('0x41')][_0x50ec('0x47')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x50ec('0x3a')](function(_0x17608b){var _0x30beee=_0x17608b[_0x50ec('0x14')](function(_0xe6e1a){return refreshOauth2MicrosoftAccessToken(_0xe6e1a)[_0x50ec('0x3a')](function(_0x5781d7){startRefreshInterval(_0x5781d7);});});return Promise[_0x50ec('0x48')](_0x30beee);})['catch'](function(_0x413478){var _0x42d30c=_0x413478?util[_0x50ec('0x49')](_0x413478,{'showHidden':![],'depth':null}):'';logger[_0x50ec('0x4a')](_0x50ec('0x4b'),_0x42d30c);});}module[_0x50ec('0x4c')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 1c6f2fb..1591733 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 _0xb96d=['then','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x483d2a,_0x1873a3){var _0x2284fa=function(_0xadde77){while(--_0xadde77){_0x483d2a['push'](_0x483d2a['shift']());}};_0x2284fa(++_0x1873a3);}(_0xb96d,0x9e));var _0xdb96=function(_0x1b4002,_0x5b4094){_0x1b4002=_0x1b4002-0x0;var _0x1716f3=_0xb96d[_0x1b4002];return _0x1716f3;};'use strict';var _=require('lodash');var util=require(_0xdb96('0x0'));var moment=require(_0xdb96('0x1'));var BPromise=require(_0xdb96('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdb96('0x3'));var db=require(_0xdb96('0x4'))['db'];var utils=require(_0xdb96('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xdb96('0x6'));var jayson=require(_0xdb96('0x7'));var client=jayson[_0xdb96('0x8')][_0xdb96('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f5e6f,_0x294084,_0x571e0e){return new BPromise(function(_0x5e2e95,_0x3384b4){return client['request'](_0x4f5e6f,_0x571e0e)[_0xdb96('0xa')](function(_0xaea492){logger['info'](_0xdb96('0xb'),_0x294084,_0xdb96('0xc'));logger['debug'](_0xdb96('0xd'),_0x294084,_0xdb96('0xc'),JSON[_0xdb96('0xe')](_0xaea492));if(_0xaea492[_0xdb96('0xf')]){if(_0xaea492['error'][_0xdb96('0x10')]===0x1f4){logger[_0xdb96('0xf')](_0xdb96('0xb'),_0x294084,_0xaea492['error'][_0xdb96('0x11')]);return _0x3384b4(_0xaea492[_0xdb96('0xf')][_0xdb96('0x11')]);}logger[_0xdb96('0xf')](_0xdb96('0xb'),_0x294084,_0xaea492[_0xdb96('0xf')][_0xdb96('0x11')]);return _0x5e2e95(_0xaea492[_0xdb96('0xf')][_0xdb96('0x11')]);}else{logger[_0xdb96('0x12')](_0xdb96('0xb'),_0x294084,_0xdb96('0xc'));_0x5e2e95(_0xaea492[_0xdb96('0x13')]['message']);}})[_0xdb96('0x14')](function(_0x2a766e){logger[_0xdb96('0xf')](_0xdb96('0xb'),_0x294084,_0x2a766e);_0x3384b4(_0x2a766e);});});} \ No newline at end of file +var _0xa321=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','http','request','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','catch','lodash','util','moment'];(function(_0x2934c3,_0x32f837){var _0x3b20e7=function(_0x2a9163){while(--_0x2a9163){_0x2934c3['push'](_0x2934c3['shift']());}};_0x3b20e7(++_0x32f837);}(_0xa321,0x9d));var _0x1a32=function(_0x5a6de2,_0x5c8b10){_0x5a6de2=_0x5a6de2-0x0;var _0x2c0525=_0xa321[_0x5a6de2];return _0x2c0525;};'use strict';var _=require(_0x1a32('0x0'));var util=require(_0x1a32('0x1'));var moment=require(_0x1a32('0x2'));var BPromise=require(_0x1a32('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a32('0x4'));var db=require(_0x1a32('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1a32('0x6'))(_0x1a32('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x1a32('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4859d6,_0x13b4d2,_0x1fa204){return new BPromise(function(_0xdfa9fe,_0x3f4723){return client[_0x1a32('0x9')](_0x4859d6,_0x1fa204)['then'](function(_0x343faf){logger[_0x1a32('0xa')]('CloudProvider,\x20%s,\x20%s',_0x13b4d2,_0x1a32('0xb'));logger[_0x1a32('0xc')](_0x1a32('0xd'),_0x13b4d2,_0x1a32('0xb'),JSON[_0x1a32('0xe')](_0x343faf));if(_0x343faf[_0x1a32('0xf')]){if(_0x343faf['error'][_0x1a32('0x10')]===0x1f4){logger[_0x1a32('0xf')](_0x1a32('0x11'),_0x13b4d2,_0x343faf['error'][_0x1a32('0x12')]);return _0x3f4723(_0x343faf[_0x1a32('0xf')][_0x1a32('0x12')]);}logger[_0x1a32('0xf')](_0x1a32('0x11'),_0x13b4d2,_0x343faf['error'][_0x1a32('0x12')]);return _0xdfa9fe(_0x343faf[_0x1a32('0xf')][_0x1a32('0x12')]);}else{logger[_0x1a32('0xa')](_0x1a32('0x11'),_0x13b4d2,_0x1a32('0xb'));_0xdfa9fe(_0x343faf['result'][_0x1a32('0x12')]);}})[_0x1a32('0x13')](function(_0x47bb8e){logger[_0x1a32('0xf')](_0x1a32('0x11'),_0x13b4d2,_0x47bb8e);_0x3f4723(_0x47bb8e);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 626e9f2..ef365f7 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 _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0xbb6adf,_0x35ba93){var _0x1a3cf2=function(_0x46fe15){while(--_0x46fe15){_0xbb6adf['push'](_0xbb6adf['shift']());}};_0x1a3cf2(++_0x35ba93);}(_0xadb5,0xad));var _0x5adb=function(_0x487146,_0x7d3283){_0x487146=_0x487146-0x0;var _0x4e7a15=_0xadb5[_0x487146];return _0x4e7a15;};'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 +var _0x5f2f=['exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2dee2f,_0x19572f){_0x2dee2f=_0x2dee2f-0x0;var _0x327c18=_0x5f2f[_0x2dee2f];return _0x327c18;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);router[_0xf5f2('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x7')]);router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x4')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router['post']('/oauth2/microsoft/callback',controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 0b81bf0..9f80299 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 _0x7859=['exports','STRING','name','sequelize'];(function(_0x29e3b6,_0x40b0b4){var _0x55d4b0=function(_0x55c58e){while(--_0x55c58e){_0x29e3b6['push'](_0x29e3b6['shift']());}};_0x55d4b0(++_0x40b0b4);}(_0x7859,0x1ef));var _0x9785=function(_0xca7e5b,_0x10f5f2){_0xca7e5b=_0xca7e5b-0x0;var _0x712872=_0x7859[_0xca7e5b];return _0x712872;};'use strict';var Sequelize=require(_0x9785('0x0'));module[_0x9785('0x1')]={'name':{'type':Sequelize[_0x9785('0x2')],'unique':_0x9785('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x9785('0x2')]},'companyId':{'type':Sequelize[_0x9785('0x2')]},'website':{'type':Sequelize[_0x9785('0x2')]},'phone':{'type':Sequelize[_0x9785('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9785('0x2')]},'street':{'type':Sequelize[_0x9785('0x2')]},'postalCode':{'type':Sequelize[_0x9785('0x2')]},'city':{'type':Sequelize[_0x9785('0x2')]},'country':{'type':Sequelize[_0x9785('0x2')]},'email':{'type':Sequelize[_0x9785('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x9785('0x2')]},'sPostalCode':{'type':Sequelize[_0x9785('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x9785('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xea19=['exports','name','STRING','sequelize'];(function(_0x2e474e,_0x524313){var _0x11856d=function(_0x4d061b){while(--_0x4d061b){_0x2e474e['push'](_0x2e474e['shift']());}};_0x11856d(++_0x524313);}(_0xea19,0x14f));var _0x9ea1=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xea19[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require(_0x9ea1('0x0'));module[_0x9ea1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9ea1('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x9ea1('0x3')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x9ea1('0x3')]},'phone':{'type':Sequelize[_0x9ea1('0x3')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9ea1('0x3')]},'street':{'type':Sequelize[_0x9ea1('0x3')]},'postalCode':{'type':Sequelize[_0x9ea1('0x3')]},'city':{'type':Sequelize[_0x9ea1('0x3')]},'country':{'type':Sequelize[_0x9ea1('0x3')]},'email':{'type':Sequelize[_0x9ea1('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x9ea1('0x3')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x9ea1('0x3')]},'sCity':{'type':Sequelize[_0x9ea1('0x3')]},'sCountry':{'type':Sequelize[_0x9ea1('0x3')]},'description':{'type':Sequelize[_0x9ea1('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index d2f8d51..b845eea 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 _0xc0b9=['then','destroy','get','Companies','UserProfileResource','stack','name','send','index','CmCompany','describe','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','error','body','find','CmContact','addContacts','ids','omit','getContacts','findOne','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','save','update'];(function(_0x5d3db8,_0xed2937){var _0x12944f=function(_0x4c5dcd){while(--_0x4c5dcd){_0x5d3db8['push'](_0x5d3db8['shift']());}};_0x12944f(++_0xed2937);}(_0xc0b9,0x18f));var _0x9c0b=function(_0xae834e,_0x51ffb4){_0xae834e=_0xae834e-0x0;var _0x2a6d46=_0xc0b9[_0xae834e];return _0x2a6d46;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9c0b('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9c0b('0x1'));var moment=require(_0x9c0b('0x2'));var BPromise=require(_0x9c0b('0x3'));var Mustache=require(_0x9c0b('0x4'));var util=require(_0x9c0b('0x5'));var path=require(_0x9c0b('0x6'));var sox=require(_0x9c0b('0x7'));var csv=require(_0x9c0b('0x8'));var ejs=require(_0x9c0b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9c0b('0xa'));var crypto=require(_0x9c0b('0xb'));var jsforce=require(_0x9c0b('0xc'));var deskjs=require(_0x9c0b('0xd'));var toCsv=require(_0x9c0b('0x8'));var querystring=require('querystring');var Papa=require(_0x9c0b('0xe'));var Redis=require(_0x9c0b('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9c0b('0x10'));var hardwareService=require(_0x9c0b('0x11'));var logger=require(_0x9c0b('0x12'))(_0x9c0b('0x13'));var utils=require(_0x9c0b('0x14'));var config=require(_0x9c0b('0x15'));var licenseUtil=require(_0x9c0b('0x16'));var db=require(_0x9c0b('0x17'))['db'];function respondWithStatusCode(_0x32535a,_0x442e9d){_0x442e9d=_0x442e9d||0xcc;return function(_0x2531a1){if(_0x2531a1){return _0x32535a[_0x9c0b('0x18')](_0x442e9d);}return _0x32535a['status'](_0x442e9d)[_0x9c0b('0x19')]();};}function respondWithResult(_0x40d8e9,_0x34a4b9){_0x34a4b9=_0x34a4b9||0xc8;return function(_0x431e37){if(_0x431e37){return _0x40d8e9[_0x9c0b('0x1a')](_0x34a4b9)[_0x9c0b('0x1b')](_0x431e37);}};}function respondWithFilteredResult(_0x481bcd,_0x4f0bbb){return function(_0x49edbc){if(_0x49edbc){var _0x66d514=typeof _0x4f0bbb[_0x9c0b('0x1c')]===_0x9c0b('0x1d')&&typeof _0x4f0bbb['limit']==='undefined';var _0x2b6a5d=_0x49edbc[_0x9c0b('0x1e')];var _0x287946=_0x66d514?0x0:_0x4f0bbb[_0x9c0b('0x1c')];var _0x1081e4=_0x66d514?_0x49edbc[_0x9c0b('0x1e')]:_0x4f0bbb['offset']+_0x4f0bbb[_0x9c0b('0x1f')];var _0x4c9d18;if(_0x1081e4>=_0x2b6a5d){_0x1081e4=_0x2b6a5d;_0x4c9d18=0xc8;}else{_0x4c9d18=0xce;}_0x481bcd[_0x9c0b('0x1a')](_0x4c9d18);return _0x481bcd[_0x9c0b('0x20')](_0x9c0b('0x21'),_0x287946+'-'+_0x1081e4+'/'+_0x2b6a5d)['json'](_0x49edbc);}return null;};}function patchUpdates(_0x41a80d){return function(_0x367f71){try{jsonpatch['apply'](_0x367f71,_0x41a80d,!![]);}catch(_0x17e4fb){return BPromise['reject'](_0x17e4fb);}return _0x367f71[_0x9c0b('0x22')]();};}function saveUpdates(_0x2b8075,_0x36b4ee){return function(_0x842fe4){if(_0x842fe4){return _0x842fe4[_0x9c0b('0x23')](_0x2b8075)[_0x9c0b('0x24')](function(_0x39a382){return _0x39a382;});}return null;};}function removeEntity(_0x1702a2,_0x3fd047){return function(_0x2ea9c5){if(_0x2ea9c5){return _0x2ea9c5[_0x9c0b('0x25')]()[_0x9c0b('0x24')](function(){var _0x449da7=_0x2ea9c5[_0x9c0b('0x26')]({'plain':!![]});var _0x9612eb=_0x9c0b('0x27');return db[_0x9c0b('0x28')][_0x9c0b('0x25')]({'where':{'type':_0x9612eb,'resourceId':_0x449da7['id']}})['then'](function(){return _0x2ea9c5;});})[_0x9c0b('0x24')](function(){_0x1702a2[_0x9c0b('0x1a')](0xcc)[_0x9c0b('0x19')]();});}};}function handleEntityNotFound(_0x303e31,_0x259099){return function(_0x39bc21){if(!_0x39bc21){_0x303e31[_0x9c0b('0x18')](0x194);}return _0x39bc21;};}function handleError(_0x493848,_0x16845a){_0x16845a=_0x16845a||0x1f4;return function(_0x49050b){logger['error'](_0x49050b[_0x9c0b('0x29')]);if(_0x49050b[_0x9c0b('0x2a')]){delete _0x49050b[_0x9c0b('0x2a')];}_0x493848[_0x9c0b('0x1a')](_0x16845a)[_0x9c0b('0x2b')](_0x49050b);};}exports[_0x9c0b('0x2c')]=function(_0xa5445a,_0x2e9836){var _0x4ceeba={},_0x4b3378={},_0x51455a={'count':0x0,'rows':[]};return db[_0x9c0b('0x2d')][_0x9c0b('0x2e')]()[_0x9c0b('0x24')](function(_0x2ec8cd){_0x4b3378[_0x9c0b('0x2f')]=_['keys'](_0x2ec8cd);_0x4b3378[_0x9c0b('0x30')]=_[_0x9c0b('0x31')](_0xa5445a[_0x9c0b('0x30')]);_0x4b3378[_0x9c0b('0x32')]=_[_0x9c0b('0x33')](_0x4b3378[_0x9c0b('0x2f')],_0x4b3378[_0x9c0b('0x30')]);_0x4ceeba[_0x9c0b('0x34')]=_[_0x9c0b('0x33')](_0x4b3378[_0x9c0b('0x2f')],qs[_0x9c0b('0x35')](_0xa5445a[_0x9c0b('0x30')][_0x9c0b('0x35')]));_0x4ceeba['attributes']=_0x4ceeba['attributes'][_0x9c0b('0x36')]?_0x4ceeba[_0x9c0b('0x34')]:_0x4b3378[_0x9c0b('0x2f')];if(!_0xa5445a[_0x9c0b('0x30')][_0x9c0b('0x37')](_0x9c0b('0x38'))){_0x4ceeba[_0x9c0b('0x1f')]=qs['limit'](_0xa5445a[_0x9c0b('0x30')][_0x9c0b('0x1f')]);_0x4ceeba[_0x9c0b('0x1c')]=qs[_0x9c0b('0x1c')](_0xa5445a[_0x9c0b('0x30')][_0x9c0b('0x1c')]);}_0x4ceeba[_0x9c0b('0x39')]=qs[_0x9c0b('0x3a')](_0xa5445a[_0x9c0b('0x30')]['sort']);_0x4ceeba[_0x9c0b('0x3b')]=qs[_0x9c0b('0x32')](_[_0x9c0b('0x3c')](_0xa5445a[_0x9c0b('0x30')],_0x4b3378['filters']),_0x2ec8cd);if(_0xa5445a[_0x9c0b('0x30')][_0x9c0b('0x3d')]){_0x4ceeba['where']=_[_0x9c0b('0x3e')](_0x4ceeba['where'],{'$or':_['map'](_0x4ceeba[_0x9c0b('0x34')],function(_0x10675e){var _0x1fe16e={};_0x1fe16e[_0x10675e]={'$like':'%'+_0xa5445a[_0x9c0b('0x30')][_0x9c0b('0x3d')]+'%'};return _0x1fe16e;})});}_0x4ceeba=_[_0x9c0b('0x3e')]({},_0x4ceeba,_0xa5445a[_0x9c0b('0x3f')]);var _0x4e7826={'where':_0x4ceeba[_0x9c0b('0x3b')]};return db[_0x9c0b('0x2d')][_0x9c0b('0x1e')](_0x4e7826)[_0x9c0b('0x24')](function(_0x3c1f71){_0x51455a[_0x9c0b('0x1e')]=_0x3c1f71;if(_0xa5445a['query']['includeAll']){_0x4ceeba[_0x9c0b('0x40')]=[{'all':!![]}];}return db['CmCompany'][_0x9c0b('0x41')](_0x4ceeba);})[_0x9c0b('0x24')](function(_0x575ccf){_0x51455a[_0x9c0b('0x42')]=_0x575ccf;return _0x51455a;})[_0x9c0b('0x24')](respondWithFilteredResult(_0x2e9836,_0x4ceeba))[_0x9c0b('0x43')](handleError(_0x2e9836,null));})[_0x9c0b('0x43')](handleError(_0x2e9836,null));};exports[_0x9c0b('0x44')]=function(_0x4cbcc6,_0x13b86b){var _0x429380={'raw':![],'where':{'id':_0x4cbcc6[_0x9c0b('0x45')]['id']}},_0x2bf3fb={};_0x2bf3fb[_0x9c0b('0x2f')]=_[_0x9c0b('0x31')](db['CmCompany'][_0x9c0b('0x46')]);_0x2bf3fb[_0x9c0b('0x30')]=_['keys'](_0x4cbcc6[_0x9c0b('0x30')]);_0x2bf3fb[_0x9c0b('0x32')]=_[_0x9c0b('0x33')](_0x2bf3fb[_0x9c0b('0x2f')],_0x2bf3fb[_0x9c0b('0x30')]);_0x429380['attributes']=_[_0x9c0b('0x33')](_0x2bf3fb[_0x9c0b('0x2f')],qs['fields'](_0x4cbcc6[_0x9c0b('0x30')][_0x9c0b('0x35')]));_0x429380[_0x9c0b('0x34')]=_0x429380[_0x9c0b('0x34')][_0x9c0b('0x36')]?_0x429380['attributes']:_0x2bf3fb[_0x9c0b('0x2f')];if(_0x4cbcc6[_0x9c0b('0x30')][_0x9c0b('0x47')]){_0x429380[_0x9c0b('0x40')]=[{'all':!![]}];}_0x429380=_[_0x9c0b('0x3e')]({},_0x429380,_0x4cbcc6['options']);return db[_0x9c0b('0x2d')]['find'](_0x429380)[_0x9c0b('0x24')](handleEntityNotFound(_0x13b86b,null))['then'](respondWithResult(_0x13b86b,null))['catch'](handleError(_0x13b86b,null));};exports[_0x9c0b('0x48')]=function(_0x3a28c0,_0x408d3a){return db[_0x9c0b('0x2d')][_0x9c0b('0x48')](_0x3a28c0['body'],{})[_0x9c0b('0x24')](function(_0x2e63b5){var _0x34ce3f=_0x3a28c0['user'][_0x9c0b('0x26')]({'plain':!![]});if(!_0x34ce3f)throw new Error(_0x9c0b('0x49'));if(_0x34ce3f[_0x9c0b('0x4a')]===_0x9c0b('0x4b')){var _0x1cd2b6=_0x2e63b5[_0x9c0b('0x26')]({'plain':!![]});var _0x443935='Companies';return db[_0x9c0b('0x4c')]['find']({'where':{'name':_0x443935,'userProfileId':_0x34ce3f[_0x9c0b('0x4d')]},'raw':!![]})[_0x9c0b('0x24')](function(_0x555c6e){if(_0x555c6e&&_0x555c6e['autoAssociation']===0x0){return db[_0x9c0b('0x28')]['create']({'name':_0x1cd2b6['name'],'resourceId':_0x1cd2b6['id'],'type':_0x555c6e['name'],'sectionId':_0x555c6e['id']},{})[_0x9c0b('0x24')](function(){return _0x2e63b5;});}else{return _0x2e63b5;}})[_0x9c0b('0x43')](function(_0x41b484){logger[_0x9c0b('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41b484);throw _0x41b484;});}return _0x2e63b5;})['then'](respondWithResult(_0x408d3a,0xc9))['catch'](handleError(_0x408d3a,null));};exports[_0x9c0b('0x23')]=function(_0xe3d8a6,_0x37197b){if(_0xe3d8a6[_0x9c0b('0x4f')]['id']){delete _0xe3d8a6[_0x9c0b('0x4f')]['id'];}return db[_0x9c0b('0x2d')][_0x9c0b('0x50')]({'where':{'id':_0xe3d8a6[_0x9c0b('0x45')]['id']}})[_0x9c0b('0x24')](handleEntityNotFound(_0x37197b,null))[_0x9c0b('0x24')](saveUpdates(_0xe3d8a6['body'],null))[_0x9c0b('0x24')](respondWithResult(_0x37197b,null))[_0x9c0b('0x43')](handleError(_0x37197b,null));};exports[_0x9c0b('0x25')]=function(_0x538982,_0x1a30d2){return db[_0x9c0b('0x2d')]['find']({'where':{'id':_0x538982[_0x9c0b('0x45')]['id']}})[_0x9c0b('0x24')](handleEntityNotFound(_0x1a30d2,null))[_0x9c0b('0x24')](removeEntity(_0x1a30d2,null))[_0x9c0b('0x43')](handleError(_0x1a30d2,null));};exports['describe']=function(_0x23b564,_0x3537bc){return db['CmCompany']['describe']()['then'](respondWithResult(_0x3537bc,null))['catch'](handleError(_0x3537bc,null));};exports['addContacts']=function(_0x12613e,_0x571f0e,_0x286e0b){return db[_0x9c0b('0x51')][_0x9c0b('0x50')]({'where':{'id':_0x12613e[_0x9c0b('0x45')]['id']}})[_0x9c0b('0x24')](handleEntityNotFound(_0x571f0e,null))['then'](function(_0x3f7eb3){if(_0x3f7eb3){return _0x3f7eb3[_0x9c0b('0x52')](_0x12613e[_0x9c0b('0x4f')][_0x9c0b('0x53')],_[_0x9c0b('0x54')](_0x12613e['body'],[_0x9c0b('0x53'),'id'])||{});}})[_0x9c0b('0x24')](respondWithResult(_0x571f0e,null))[_0x9c0b('0x43')](handleError(_0x571f0e,null));};exports[_0x9c0b('0x55')]=function(_0x526968,_0x32aaa6,_0x596c4a){var _0xeaca6e={};var _0x3d1a09={};var _0x5e8631;var _0x577482;return db[_0x9c0b('0x2d')][_0x9c0b('0x56')]({'where':{'id':_0x526968[_0x9c0b('0x45')]['id']}})[_0x9c0b('0x24')](handleEntityNotFound(_0x32aaa6,null))[_0x9c0b('0x24')](function(_0x4ade09){if(_0x4ade09){_0x5e8631=_0x4ade09;_0x3d1a09[_0x9c0b('0x2f')]=_[_0x9c0b('0x31')](db[_0x9c0b('0x51')][_0x9c0b('0x46')]);_0x3d1a09[_0x9c0b('0x30')]=_[_0x9c0b('0x31')](_0x526968[_0x9c0b('0x30')]);_0x3d1a09[_0x9c0b('0x32')]=_[_0x9c0b('0x33')](_0x3d1a09['model'],_0x3d1a09[_0x9c0b('0x30')]);_0xeaca6e[_0x9c0b('0x34')]=_[_0x9c0b('0x33')](_0x3d1a09['model'],qs[_0x9c0b('0x35')](_0x526968[_0x9c0b('0x30')][_0x9c0b('0x35')]));_0xeaca6e[_0x9c0b('0x34')]=_0xeaca6e[_0x9c0b('0x34')][_0x9c0b('0x36')]?_0xeaca6e[_0x9c0b('0x34')]:_0x3d1a09[_0x9c0b('0x2f')];_0xeaca6e['order']=qs[_0x9c0b('0x3a')](_0x526968[_0x9c0b('0x30')]['sort']);_0xeaca6e[_0x9c0b('0x3b')]=qs[_0x9c0b('0x32')](_['pick'](_0x526968[_0x9c0b('0x30')],_0x3d1a09[_0x9c0b('0x32')]));if(_0x526968[_0x9c0b('0x30')][_0x9c0b('0x3d')]){_0xeaca6e['where']=_[_0x9c0b('0x3e')](_0xeaca6e['where'],{'$or':_['map'](_0xeaca6e['attributes'],function(_0x4a2e75){var _0x17ad30={};_0x17ad30[_0x4a2e75]={'$like':'%'+_0x526968[_0x9c0b('0x30')][_0x9c0b('0x3d')]+'%'};return _0x17ad30;})});}_0xeaca6e=_['merge']({},_0xeaca6e,_0x526968[_0x9c0b('0x3f')]);return _0x5e8631['getContacts'](_0xeaca6e);}})[_0x9c0b('0x24')](function(_0x35a9d0){if(_0x35a9d0){_0x577482=_0x35a9d0[_0x9c0b('0x36')];if(!_0x526968[_0x9c0b('0x30')][_0x9c0b('0x37')](_0x9c0b('0x38'))){_0xeaca6e[_0x9c0b('0x1f')]=qs[_0x9c0b('0x1f')](_0x526968[_0x9c0b('0x30')][_0x9c0b('0x1f')]);_0xeaca6e['offset']=qs[_0x9c0b('0x1c')](_0x526968[_0x9c0b('0x30')][_0x9c0b('0x1c')]);}return _0x5e8631[_0x9c0b('0x55')](_0xeaca6e);}})[_0x9c0b('0x24')](function(_0xddf4a2){if(_0xddf4a2){return _0xddf4a2?{'count':_0x577482,'rows':_0xddf4a2}:null;}})[_0x9c0b('0x24')](respondWithResult(_0x32aaa6,null))[_0x9c0b('0x43')](handleError(_0x32aaa6,null));}; \ No newline at end of file +var _0xed51=['rows','catch','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addContacts','CmContact','ids','omit','getContacts','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','reject','save','update','then','destroy','get','Companies','UserProfileResource','end','sendStatus','stack','name','send','index','CmCompany','describe','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','map','options','include','findAll'];(function(_0x57add2,_0x4f2b7d){var _0x4e3670=function(_0x3311b){while(--_0x3311b){_0x57add2['push'](_0x57add2['shift']());}};_0x4e3670(++_0x4f2b7d);}(_0xed51,0x1cb));var _0x1ed5=function(_0x264557,_0x17bf7e){_0x264557=_0x264557-0x0;var _0x574ed5=_0xed51[_0x264557];return _0x574ed5;};'use strict';var emlformat=require(_0x1ed5('0x0'));var rimraf=require(_0x1ed5('0x1'));var zipdir=require(_0x1ed5('0x2'));var jsonpatch=require(_0x1ed5('0x3'));var rp=require(_0x1ed5('0x4'));var moment=require(_0x1ed5('0x5'));var BPromise=require(_0x1ed5('0x6'));var Mustache=require(_0x1ed5('0x7'));var util=require(_0x1ed5('0x8'));var path=require('path');var sox=require(_0x1ed5('0x9'));var csv=require(_0x1ed5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1ed5('0xb'));var _=require(_0x1ed5('0xc'));var squel=require(_0x1ed5('0xd'));var crypto=require('crypto');var jsforce=require(_0x1ed5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1ed5('0xa'));var querystring=require(_0x1ed5('0xf'));var Papa=require(_0x1ed5('0x10'));var Redis=require(_0x1ed5('0x11'));var authService=require(_0x1ed5('0x12'));var qs=require(_0x1ed5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1ed5('0x14'));var logger=require(_0x1ed5('0x15'))(_0x1ed5('0x16'));var utils=require(_0x1ed5('0x17'));var config=require(_0x1ed5('0x18'));var licenseUtil=require(_0x1ed5('0x19'));var db=require(_0x1ed5('0x1a'))['db'];function respondWithStatusCode(_0x499c4d,_0x2d2ff0){_0x2d2ff0=_0x2d2ff0||0xcc;return function(_0x2c85d2){if(_0x2c85d2){return _0x499c4d['sendStatus'](_0x2d2ff0);}return _0x499c4d[_0x1ed5('0x1b')](_0x2d2ff0)['end']();};}function respondWithResult(_0x477b3e,_0x59545f){_0x59545f=_0x59545f||0xc8;return function(_0x2fb426){if(_0x2fb426){return _0x477b3e[_0x1ed5('0x1b')](_0x59545f)[_0x1ed5('0x1c')](_0x2fb426);}};}function respondWithFilteredResult(_0x3942c4,_0x162cc5){return function(_0x18db79){if(_0x18db79){var _0x536654=typeof _0x162cc5['offset']===_0x1ed5('0x1d')&&typeof _0x162cc5[_0x1ed5('0x1e')]===_0x1ed5('0x1d');var _0x37808a=_0x18db79[_0x1ed5('0x1f')];var _0x442175=_0x536654?0x0:_0x162cc5['offset'];var _0x59bc8c=_0x536654?_0x18db79[_0x1ed5('0x1f')]:_0x162cc5[_0x1ed5('0x20')]+_0x162cc5[_0x1ed5('0x1e')];var _0x4bcbd5;if(_0x59bc8c>=_0x37808a){_0x59bc8c=_0x37808a;_0x4bcbd5=0xc8;}else{_0x4bcbd5=0xce;}_0x3942c4['status'](_0x4bcbd5);return _0x3942c4['set']('Content-Range',_0x442175+'-'+_0x59bc8c+'/'+_0x37808a)['json'](_0x18db79);}return null;};}function patchUpdates(_0x5898e8){return function(_0x5449de){try{jsonpatch['apply'](_0x5449de,_0x5898e8,!![]);}catch(_0x38408a){return BPromise[_0x1ed5('0x21')](_0x38408a);}return _0x5449de[_0x1ed5('0x22')]();};}function saveUpdates(_0x485871,_0x2e8299){return function(_0x5cb65c){if(_0x5cb65c){return _0x5cb65c[_0x1ed5('0x23')](_0x485871)[_0x1ed5('0x24')](function(_0x498955){return _0x498955;});}return null;};}function removeEntity(_0x41fd12,_0x3d79cd){return function(_0x4d3631){if(_0x4d3631){return _0x4d3631[_0x1ed5('0x25')]()[_0x1ed5('0x24')](function(){var _0x6c9f8b=_0x4d3631[_0x1ed5('0x26')]({'plain':!![]});var _0x212fc4=_0x1ed5('0x27');return db[_0x1ed5('0x28')][_0x1ed5('0x25')]({'where':{'type':_0x212fc4,'resourceId':_0x6c9f8b['id']}})['then'](function(){return _0x4d3631;});})[_0x1ed5('0x24')](function(){_0x41fd12[_0x1ed5('0x1b')](0xcc)[_0x1ed5('0x29')]();});}};}function handleEntityNotFound(_0x1c56cb,_0x5aa68a){return function(_0x24d992){if(!_0x24d992){_0x1c56cb[_0x1ed5('0x2a')](0x194);}return _0x24d992;};}function handleError(_0x3273f5,_0x34f339){_0x34f339=_0x34f339||0x1f4;return function(_0x4d497a){logger['error'](_0x4d497a[_0x1ed5('0x2b')]);if(_0x4d497a[_0x1ed5('0x2c')]){delete _0x4d497a[_0x1ed5('0x2c')];}_0x3273f5['status'](_0x34f339)[_0x1ed5('0x2d')](_0x4d497a);};}exports[_0x1ed5('0x2e')]=function(_0x3e8734,_0x219969){var _0x8b8a75={},_0x31427d={},_0x11cdd3={'count':0x0,'rows':[]};return db[_0x1ed5('0x2f')][_0x1ed5('0x30')]()[_0x1ed5('0x24')](function(_0xa9abd0){_0x31427d[_0x1ed5('0x31')]=_[_0x1ed5('0x32')](_0xa9abd0);_0x31427d[_0x1ed5('0x33')]=_[_0x1ed5('0x32')](_0x3e8734['query']);_0x31427d['filters']=_[_0x1ed5('0x34')](_0x31427d[_0x1ed5('0x31')],_0x31427d[_0x1ed5('0x33')]);_0x8b8a75[_0x1ed5('0x35')]=_[_0x1ed5('0x34')](_0x31427d[_0x1ed5('0x31')],qs[_0x1ed5('0x36')](_0x3e8734[_0x1ed5('0x33')][_0x1ed5('0x36')]));_0x8b8a75[_0x1ed5('0x35')]=_0x8b8a75['attributes'][_0x1ed5('0x37')]?_0x8b8a75[_0x1ed5('0x35')]:_0x31427d[_0x1ed5('0x31')];if(!_0x3e8734[_0x1ed5('0x33')][_0x1ed5('0x38')](_0x1ed5('0x39'))){_0x8b8a75[_0x1ed5('0x1e')]=qs['limit'](_0x3e8734['query'][_0x1ed5('0x1e')]);_0x8b8a75[_0x1ed5('0x20')]=qs[_0x1ed5('0x20')](_0x3e8734[_0x1ed5('0x33')]['offset']);}_0x8b8a75[_0x1ed5('0x3a')]=qs[_0x1ed5('0x3b')](_0x3e8734[_0x1ed5('0x33')][_0x1ed5('0x3b')]);_0x8b8a75[_0x1ed5('0x3c')]=qs['filters'](_[_0x1ed5('0x3d')](_0x3e8734['query'],_0x31427d[_0x1ed5('0x3e')]),_0xa9abd0);if(_0x3e8734['query'][_0x1ed5('0x3f')]){_0x8b8a75[_0x1ed5('0x3c')]=_[_0x1ed5('0x40')](_0x8b8a75[_0x1ed5('0x3c')],{'$or':_[_0x1ed5('0x41')](_0x8b8a75['attributes'],function(_0x4870fc){var _0x39ff4f={};_0x39ff4f[_0x4870fc]={'$like':'%'+_0x3e8734[_0x1ed5('0x33')][_0x1ed5('0x3f')]+'%'};return _0x39ff4f;})});}_0x8b8a75=_['merge']({},_0x8b8a75,_0x3e8734[_0x1ed5('0x42')]);var _0x2cad68={'where':_0x8b8a75[_0x1ed5('0x3c')]};return db['CmCompany'][_0x1ed5('0x1f')](_0x2cad68)[_0x1ed5('0x24')](function(_0x2faaac){_0x11cdd3[_0x1ed5('0x1f')]=_0x2faaac;if(_0x3e8734['query']['includeAll']){_0x8b8a75[_0x1ed5('0x43')]=[{'all':!![]}];}return db[_0x1ed5('0x2f')][_0x1ed5('0x44')](_0x8b8a75);})[_0x1ed5('0x24')](function(_0x10f1c3){_0x11cdd3[_0x1ed5('0x45')]=_0x10f1c3;return _0x11cdd3;})[_0x1ed5('0x24')](respondWithFilteredResult(_0x219969,_0x8b8a75))[_0x1ed5('0x46')](handleError(_0x219969,null));})[_0x1ed5('0x46')](handleError(_0x219969,null));};exports['show']=function(_0x587864,_0xd3e4e4){var _0x3d5094={'raw':![],'where':{'id':_0x587864[_0x1ed5('0x47')]['id']}},_0x58c410={};_0x58c410[_0x1ed5('0x31')]=_['keys'](db[_0x1ed5('0x2f')][_0x1ed5('0x48')]);_0x58c410[_0x1ed5('0x33')]=_[_0x1ed5('0x32')](_0x587864[_0x1ed5('0x33')]);_0x58c410[_0x1ed5('0x3e')]=_[_0x1ed5('0x34')](_0x58c410[_0x1ed5('0x31')],_0x58c410[_0x1ed5('0x33')]);_0x3d5094[_0x1ed5('0x35')]=_[_0x1ed5('0x34')](_0x58c410[_0x1ed5('0x31')],qs[_0x1ed5('0x36')](_0x587864[_0x1ed5('0x33')][_0x1ed5('0x36')]));_0x3d5094[_0x1ed5('0x35')]=_0x3d5094[_0x1ed5('0x35')][_0x1ed5('0x37')]?_0x3d5094[_0x1ed5('0x35')]:_0x58c410[_0x1ed5('0x31')];if(_0x587864[_0x1ed5('0x33')]['includeAll']){_0x3d5094[_0x1ed5('0x43')]=[{'all':!![]}];}_0x3d5094=_[_0x1ed5('0x40')]({},_0x3d5094,_0x587864[_0x1ed5('0x42')]);return db['CmCompany'][_0x1ed5('0x49')](_0x3d5094)[_0x1ed5('0x24')](handleEntityNotFound(_0xd3e4e4,null))[_0x1ed5('0x24')](respondWithResult(_0xd3e4e4,null))[_0x1ed5('0x46')](handleError(_0xd3e4e4,null));};exports[_0x1ed5('0x4a')]=function(_0xda94aa,_0x498009){return db[_0x1ed5('0x2f')]['create'](_0xda94aa['body'],{})[_0x1ed5('0x24')](function(_0xafb1f){var _0x348e0e=_0xda94aa[_0x1ed5('0x4b')][_0x1ed5('0x26')]({'plain':!![]});if(!_0x348e0e)throw new Error(_0x1ed5('0x4c'));if(_0x348e0e[_0x1ed5('0x4d')]===_0x1ed5('0x4b')){var _0x178a71=_0xafb1f[_0x1ed5('0x26')]({'plain':!![]});var _0x386c06='Companies';return db['UserProfileSection']['find']({'where':{'name':_0x386c06,'userProfileId':_0x348e0e[_0x1ed5('0x4e')]},'raw':!![]})['then'](function(_0x580013){if(_0x580013&&_0x580013[_0x1ed5('0x4f')]===0x0){return db[_0x1ed5('0x28')]['create']({'name':_0x178a71[_0x1ed5('0x2c')],'resourceId':_0x178a71['id'],'type':_0x580013['name'],'sectionId':_0x580013['id']},{})[_0x1ed5('0x24')](function(){return _0xafb1f;});}else{return _0xafb1f;}})['catch'](function(_0x4a5d88){logger['error'](_0x1ed5('0x50'),_0x4a5d88);throw _0x4a5d88;});}return _0xafb1f;})[_0x1ed5('0x24')](respondWithResult(_0x498009,0xc9))[_0x1ed5('0x46')](handleError(_0x498009,null));};exports[_0x1ed5('0x23')]=function(_0x9c91b6,_0x434aba){if(_0x9c91b6[_0x1ed5('0x51')]['id']){delete _0x9c91b6[_0x1ed5('0x51')]['id'];}return db[_0x1ed5('0x2f')]['find']({'where':{'id':_0x9c91b6[_0x1ed5('0x47')]['id']}})[_0x1ed5('0x24')](handleEntityNotFound(_0x434aba,null))[_0x1ed5('0x24')](saveUpdates(_0x9c91b6['body'],null))[_0x1ed5('0x24')](respondWithResult(_0x434aba,null))[_0x1ed5('0x46')](handleError(_0x434aba,null));};exports[_0x1ed5('0x25')]=function(_0x3a1984,_0x88adfb){return db[_0x1ed5('0x2f')]['find']({'where':{'id':_0x3a1984['params']['id']}})['then'](handleEntityNotFound(_0x88adfb,null))[_0x1ed5('0x24')](removeEntity(_0x88adfb,null))[_0x1ed5('0x46')](handleError(_0x88adfb,null));};exports[_0x1ed5('0x30')]=function(_0x49d6bc,_0x57515e){return db[_0x1ed5('0x2f')]['describe']()['then'](respondWithResult(_0x57515e,null))[_0x1ed5('0x46')](handleError(_0x57515e,null));};exports[_0x1ed5('0x52')]=function(_0x5d5b05,_0x2c7cb5,_0x2eed57){return db[_0x1ed5('0x53')][_0x1ed5('0x49')]({'where':{'id':_0x5d5b05[_0x1ed5('0x47')]['id']}})[_0x1ed5('0x24')](handleEntityNotFound(_0x2c7cb5,null))['then'](function(_0x24e822){if(_0x24e822){return _0x24e822['addContacts'](_0x5d5b05[_0x1ed5('0x51')][_0x1ed5('0x54')],_[_0x1ed5('0x55')](_0x5d5b05[_0x1ed5('0x51')],[_0x1ed5('0x54'),'id'])||{});}})[_0x1ed5('0x24')](respondWithResult(_0x2c7cb5,null))['catch'](handleError(_0x2c7cb5,null));};exports[_0x1ed5('0x56')]=function(_0x201e12,_0x350ac3,_0x27a60d){var _0x4b3e67={};var _0x513689={};var _0xc74581;var _0xb12c49;return db[_0x1ed5('0x2f')][_0x1ed5('0x57')]({'where':{'id':_0x201e12[_0x1ed5('0x47')]['id']}})['then'](handleEntityNotFound(_0x350ac3,null))[_0x1ed5('0x24')](function(_0x55d3b4){if(_0x55d3b4){_0xc74581=_0x55d3b4;_0x513689['model']=_[_0x1ed5('0x32')](db[_0x1ed5('0x53')][_0x1ed5('0x48')]);_0x513689['query']=_[_0x1ed5('0x32')](_0x201e12[_0x1ed5('0x33')]);_0x513689[_0x1ed5('0x3e')]=_['intersection'](_0x513689[_0x1ed5('0x31')],_0x513689[_0x1ed5('0x33')]);_0x4b3e67[_0x1ed5('0x35')]=_[_0x1ed5('0x34')](_0x513689[_0x1ed5('0x31')],qs['fields'](_0x201e12['query'][_0x1ed5('0x36')]));_0x4b3e67['attributes']=_0x4b3e67[_0x1ed5('0x35')][_0x1ed5('0x37')]?_0x4b3e67[_0x1ed5('0x35')]:_0x513689[_0x1ed5('0x31')];_0x4b3e67[_0x1ed5('0x3a')]=qs['sort'](_0x201e12[_0x1ed5('0x33')][_0x1ed5('0x3b')]);_0x4b3e67[_0x1ed5('0x3c')]=qs[_0x1ed5('0x3e')](_['pick'](_0x201e12[_0x1ed5('0x33')],_0x513689[_0x1ed5('0x3e')]));if(_0x201e12[_0x1ed5('0x33')][_0x1ed5('0x3f')]){_0x4b3e67[_0x1ed5('0x3c')]=_[_0x1ed5('0x40')](_0x4b3e67[_0x1ed5('0x3c')],{'$or':_[_0x1ed5('0x41')](_0x4b3e67['attributes'],function(_0x221f0b){var _0x5f2464={};_0x5f2464[_0x221f0b]={'$like':'%'+_0x201e12[_0x1ed5('0x33')]['filter']+'%'};return _0x5f2464;})});}_0x4b3e67=_[_0x1ed5('0x40')]({},_0x4b3e67,_0x201e12['options']);return _0xc74581[_0x1ed5('0x56')](_0x4b3e67);}})[_0x1ed5('0x24')](function(_0xaba76d){if(_0xaba76d){_0xb12c49=_0xaba76d[_0x1ed5('0x37')];if(!_0x201e12[_0x1ed5('0x33')][_0x1ed5('0x38')](_0x1ed5('0x39'))){_0x4b3e67[_0x1ed5('0x1e')]=qs[_0x1ed5('0x1e')](_0x201e12[_0x1ed5('0x33')][_0x1ed5('0x1e')]);_0x4b3e67[_0x1ed5('0x20')]=qs['offset'](_0x201e12[_0x1ed5('0x33')]['offset']);}return _0xc74581['getContacts'](_0x4b3e67);}})[_0x1ed5('0x24')](function(_0x35edb8){if(_0x35edb8){return _0x35edb8?{'count':_0xb12c49,'rows':_0x35edb8}:null;}})[_0x1ed5('0x24')](respondWithResult(_0x350ac3,null))[_0x1ed5('0x46')](handleError(_0x350ac3,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 91d4ae0..173a917 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 _0xc874=['request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','define','CmCompany','cm_companies','lodash','util','api','moment','bluebird'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc874,0x1a8));var _0x4c87=function(_0x296897,_0x4d23ea){_0x296897=_0x296897-0x0;var _0x2b44ab=_0xc874[_0x296897];return _0x2b44ab;};'use strict';var _=require(_0x4c87('0x0'));var util=require(_0x4c87('0x1'));var logger=require('../../config/logger')(_0x4c87('0x2'));var moment=require(_0x4c87('0x3'));var BPromise=require(_0x4c87('0x4'));var rp=require(_0x4c87('0x5'));var fs=require('fs');var path=require(_0x4c87('0x6'));var rimraf=require(_0x4c87('0x7'));var config=require(_0x4c87('0x8'));var attributes=require(_0x4c87('0x9'));module['exports']=function(_0x4fdce2,_0x14f81d){return _0x4fdce2[_0x4c87('0xa')](_0x4c87('0xb'),attributes,{'tableName':_0x4c87('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x82f5=['cm_companies','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany'];(function(_0x183ade,_0x2b2446){var _0x103bfa=function(_0x5a6d27){while(--_0x5a6d27){_0x183ade['push'](_0x183ade['shift']());}};_0x103bfa(++_0x2b2446);}(_0x82f5,0xfd));var _0x582f=function(_0x341a9f,_0x1686f6){_0x341a9f=_0x341a9f-0x0;var _0x1d8c44=_0x82f5[_0x341a9f];return _0x1d8c44;};'use strict';var _=require(_0x582f('0x0'));var util=require(_0x582f('0x1'));var logger=require(_0x582f('0x2'))(_0x582f('0x3'));var moment=require(_0x582f('0x4'));var BPromise=require(_0x582f('0x5'));var rp=require(_0x582f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x582f('0x7'));var config=require(_0x582f('0x8'));var attributes=require(_0x582f('0x9'));module[_0x582f('0xa')]=function(_0x665351,_0x1fad3b){return _0x665351[_0x582f('0xb')](_0x582f('0xc'),attributes,{'tableName':_0x582f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index a64be36..0e19e44 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 _0x48a9=['info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','CmCompany,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then'];(function(_0x22e4d3,_0x26a815){var _0x354f75=function(_0x533091){while(--_0x533091){_0x22e4d3['push'](_0x22e4d3['shift']());}};_0x354f75(++_0x26a815);}(_0x48a9,0xe6));var _0x948a=function(_0x5e6ea3,_0x9addd2){_0x5e6ea3=_0x5e6ea3-0x0;var _0x4048b5=_0x48a9[_0x5e6ea3];return _0x4048b5;};'use strict';var _=require('lodash');var util=require(_0x948a('0x0'));var moment=require(_0x948a('0x1'));var BPromise=require(_0x948a('0x2'));var rs=require(_0x948a('0x3'));var fs=require('fs');var Redis=require(_0x948a('0x4'));var db=require(_0x948a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x948a('0x6'))(_0x948a('0x7'));var config=require('../../config/environment');var jayson=require(_0x948a('0x8'));var client=jayson[_0x948a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34a47c,_0x1a7c21,_0x5299a6){return new BPromise(function(_0x2f3faf,_0x16df55){return client[_0x948a('0xa')](_0x34a47c,_0x5299a6)[_0x948a('0xb')](function(_0x4c2e91){logger[_0x948a('0xc')]('CmCompany,\x20%s,\x20%s',_0x1a7c21,_0x948a('0xd'));logger[_0x948a('0xe')](_0x948a('0xf'),_0x1a7c21,_0x948a('0xd'),JSON[_0x948a('0x10')](_0x4c2e91));if(_0x4c2e91['error']){if(_0x4c2e91[_0x948a('0x11')]['code']===0x1f4){logger[_0x948a('0x11')](_0x948a('0x12'),_0x1a7c21,_0x4c2e91[_0x948a('0x11')]['message']);return _0x16df55(_0x4c2e91[_0x948a('0x11')]['message']);}logger[_0x948a('0x11')]('CmCompany,\x20%s,\x20%s',_0x1a7c21,_0x4c2e91['error'][_0x948a('0x13')]);return _0x2f3faf(_0x4c2e91[_0x948a('0x11')]['message']);}else{logger[_0x948a('0xc')](_0x948a('0x12'),_0x1a7c21,_0x948a('0xd'));_0x2f3faf(_0x4c2e91[_0x948a('0x14')][_0x948a('0x13')]);}})[_0x948a('0x15')](function(_0x45b3d8){logger[_0x948a('0x11')]('CmCompany,\x20%s,\x20%s',_0x1a7c21,_0x45b3d8);_0x16df55(_0x45b3d8);});});} \ No newline at end of file +var _0x0eb8=['lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x5e1ddc,_0xd080b0){var _0x47dc89=function(_0x3f3902){while(--_0x3f3902){_0x5e1ddc['push'](_0x5e1ddc['shift']());}};_0x47dc89(++_0xd080b0);}(_0x0eb8,0xdc));var _0x80eb=function(_0x123acf,_0x4d0213){_0x123acf=_0x123acf-0x0;var _0x1efd4a=_0x0eb8[_0x123acf];return _0x1efd4a;};'use strict';var _=require(_0x80eb('0x0'));var util=require(_0x80eb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x80eb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x80eb('0x3'))['db'];var utils=require(_0x80eb('0x4'));var logger=require(_0x80eb('0x5'))(_0x80eb('0x6'));var config=require(_0x80eb('0x7'));var jayson=require(_0x80eb('0x8'));var client=jayson[_0x80eb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3971aa,_0x1bd49d,_0x32e572){return new BPromise(function(_0x3d7e55,_0x5e48c9){return client[_0x80eb('0xa')](_0x3971aa,_0x32e572)[_0x80eb('0xb')](function(_0x5c4976){logger[_0x80eb('0xc')](_0x80eb('0xd'),_0x1bd49d,_0x80eb('0xe'));logger['debug'](_0x80eb('0xf'),_0x1bd49d,_0x80eb('0xe'),JSON[_0x80eb('0x10')](_0x5c4976));if(_0x5c4976[_0x80eb('0x11')]){if(_0x5c4976[_0x80eb('0x11')][_0x80eb('0x12')]===0x1f4){logger[_0x80eb('0x11')](_0x80eb('0xd'),_0x1bd49d,_0x5c4976[_0x80eb('0x11')][_0x80eb('0x13')]);return _0x5e48c9(_0x5c4976[_0x80eb('0x11')][_0x80eb('0x13')]);}logger[_0x80eb('0x11')](_0x80eb('0xd'),_0x1bd49d,_0x5c4976[_0x80eb('0x11')][_0x80eb('0x13')]);return _0x3d7e55(_0x5c4976[_0x80eb('0x11')][_0x80eb('0x13')]);}else{logger[_0x80eb('0xc')]('CmCompany,\x20%s,\x20%s',_0x1bd49d,_0x80eb('0xe'));_0x3d7e55(_0x5c4976[_0x80eb('0x14')][_0x80eb('0x13')]);}})[_0x80eb('0x15')](function(_0x28f3cf){logger[_0x80eb('0x11')]('CmCompany,\x20%s,\x20%s',_0x1bd49d,_0x28f3cf);_0x5e48c9(_0x28f3cf);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index d6b8823..3c41092 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 _0x61b3=['create','addContacts','put','update','delete','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./cmCompany.controller','index','get','/describe','isAuthenticated','/:id','show','/:id/contacts','post'];(function(_0x468777,_0x81b92){var _0x4eba33=function(_0x4e1471){while(--_0x4e1471){_0x468777['push'](_0x468777['shift']());}};_0x4eba33(++_0x81b92);}(_0x61b3,0x1be));var _0x361b=function(_0x244dd2,_0x1b0955){_0x244dd2=_0x244dd2-0x0;var _0x1faa57=_0x61b3[_0x244dd2];return _0x1faa57;};'use strict';var multer=require(_0x361b('0x0'));var util=require('util');var path=require(_0x361b('0x1'));var timeout=require(_0x361b('0x2'));var express=require(_0x361b('0x3'));var router=express['Router']();var fs_extra=require(_0x361b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x361b('0x5'));var config=require(_0x361b('0x6'));var controller=require(_0x361b('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x361b('0x8')]);router[_0x361b('0x9')](_0x361b('0xa'),auth[_0x361b('0xb')](),controller['describe']);router[_0x361b('0x9')](_0x361b('0xc'),auth[_0x361b('0xb')](),controller[_0x361b('0xd')]);router[_0x361b('0x9')](_0x361b('0xe'),auth[_0x361b('0xb')](),controller['getContacts']);router[_0x361b('0xf')]('/',auth['isAuthenticated'](),controller[_0x361b('0x10')]);router['post'](_0x361b('0xe'),auth[_0x361b('0xb')](),controller[_0x361b('0x11')]);router[_0x361b('0x12')](_0x361b('0xc'),auth[_0x361b('0xb')](),controller[_0x361b('0x13')]);router[_0x361b('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe8e1=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','getContacts','post','/:id/contacts','update','destroy','exports','multer','util'];(function(_0x39659e,_0x129655){var _0x19cee1=function(_0x387533){while(--_0x387533){_0x39659e['push'](_0x39659e['shift']());}};_0x19cee1(++_0x129655);}(_0xe8e1,0xc6));var _0x1e8e=function(_0x32659d,_0x58ece9){_0x32659d=_0x32659d-0x0;var _0x10d610=_0xe8e1[_0x32659d];return _0x10d610;};'use strict';var multer=require(_0x1e8e('0x0'));var util=require(_0x1e8e('0x1'));var path=require('path');var timeout=require(_0x1e8e('0x2'));var express=require('express');var router=express[_0x1e8e('0x3')]();var fs_extra=require(_0x1e8e('0x4'));var auth=require(_0x1e8e('0x5'));var interaction=require(_0x1e8e('0x6'));var config=require(_0x1e8e('0x7'));var controller=require('./cmCompany.controller');router[_0x1e8e('0x8')]('/',auth['isAuthenticated'](),controller[_0x1e8e('0x9')]);router['get'](_0x1e8e('0xa'),auth[_0x1e8e('0xb')](),controller['describe']);router[_0x1e8e('0x8')](_0x1e8e('0xc'),auth[_0x1e8e('0xb')](),controller[_0x1e8e('0xd')]);router[_0x1e8e('0x8')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x1e8e('0xe')]);router[_0x1e8e('0xf')]('/',auth[_0x1e8e('0xb')](),controller['create']);router[_0x1e8e('0xf')](_0x1e8e('0x10'),auth['isAuthenticated'](),controller['addContacts']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1e8e('0x11')]);router['delete'](_0x1e8e('0xc'),auth[_0x1e8e('0xb')](),controller[_0x1e8e('0x12')]);module[_0x1e8e('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index cd707eb..60bec42 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 _0x12d3=['NOW','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE'];(function(_0xa5c157,_0x5c6652){var _0xe625db=function(_0x3989bf){while(--_0x3989bf){_0xa5c157['push'](_0xa5c157['shift']());}};_0xe625db(++_0x5c6652);}(_0x12d3,0xa9));var _0x312d=function(_0xdf5f14,_0x48aa29){_0xdf5f14=_0xdf5f14-0x0;var _0x39e98a=_0x12d3[_0xdf5f14];return _0x39e98a;};'use strict';var _=require('lodash');var Sequelize=require(_0x312d('0x0'));module[_0x312d('0x1')]={'firstName':{'type':Sequelize[_0x312d('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x312d('0x2')]},'street':{'type':Sequelize[_0x312d('0x2')]},'postalCode':{'type':Sequelize[_0x312d('0x2')]},'city':{'type':Sequelize[_0x312d('0x2')]},'country':{'type':Sequelize[_0x312d('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x312d('0x3')]},'phone':{'type':Sequelize[_0x312d('0x2')]},'mobile':{'type':Sequelize[_0x312d('0x2')]},'fax':{'type':Sequelize[_0x312d('0x2')]},'email':{'type':Sequelize[_0x312d('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x312d('0x2')]},'fb_data':{'type':Sequelize[_0x312d('0x2')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x312d('0x2')]},'viber':{'type':Sequelize[_0x312d('0x2')]},'line':{'type':Sequelize[_0x312d('0x2')]},'wechat':{'type':Sequelize[_0x312d('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x312d('0x4')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x312d('0x4')](0x2)[_0x312d('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x312d('0x6')],'defaultValue':Sequelize[_0x312d('0x7')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x312d('0x4')]}}; \ No newline at end of file +var _0x5bfa=['INTEGER','UNSIGNED','NOW','exports','STRING','TEXT'];(function(_0x1e3378,_0x35896f){var _0xec11f3=function(_0x178682){while(--_0x178682){_0x1e3378['push'](_0x1e3378['shift']());}};_0xec11f3(++_0x35896f);}(_0x5bfa,0x111));var _0xa5bf=function(_0x1b1a3b,_0x52a88a){_0x1b1a3b=_0x1b1a3b-0x0;var _0x385347=_0x5bfa[_0x1b1a3b];return _0x385347;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0xa5bf('0x0')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xa5bf('0x1')]},'street':{'type':Sequelize[_0xa5bf('0x1')]},'postalCode':{'type':Sequelize[_0xa5bf('0x1')]},'city':{'type':Sequelize[_0xa5bf('0x1')]},'country':{'type':Sequelize[_0xa5bf('0x1')]},'dateOfBirth':{'type':Sequelize[_0xa5bf('0x1')]},'description':{'type':Sequelize[_0xa5bf('0x2')]},'phone':{'type':Sequelize[_0xa5bf('0x1')]},'mobile':{'type':Sequelize[_0xa5bf('0x1')]},'fax':{'type':Sequelize[_0xa5bf('0x1')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xa5bf('0x1')]},'facebook':{'type':Sequelize[_0xa5bf('0x1')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xa5bf('0x1')]},'skype':{'type':Sequelize[_0xa5bf('0x1')]},'teams':{'type':Sequelize[_0xa5bf('0x1')]},'viber':{'type':Sequelize[_0xa5bf('0x1')]},'line':{'type':Sequelize[_0xa5bf('0x1')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0xa5bf('0x1')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0xa5bf('0x1')]},'priority':{'type':Sequelize[_0xa5bf('0x3')](0x2)[_0xa5bf('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xa5bf('0x5')]},'dialTimezone':{'type':Sequelize[_0xa5bf('0x1')]},'utcOffset':{'type':Sequelize[_0xa5bf('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index e54c0a5..97a393d 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 _0x79e8=['cm_contacts','setFields','id\x20=\x20?','values','findOne','model','rawAttributes','intersection','attributes','fields','order','sort','filters','pick','options','getTags','nolimit','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','phone','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','PHONE','`ItemType`.OrderBy','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','ContactId','filter','includeAll','include','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getJscriptySessions','uploadCsv','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','split','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','file','filename','chmodSync','0777','child_process','../../components/import/cm/csv','CompanyId','socket_timestamp','pid','upload','parse','meta','User','agent','No\x20ListId\x20specified','binding','fork','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','mail','sms','fax','whatsapp','voice','-createdAt','resolve','includes','channel','toLowerCase','Invalid\x20channel','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','uniqueid','source','destination','callerid','endtime','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','findAndCountAll','fullname','startCase','chat','Website','closed','disposition','secondDisposition','thirdDisposition','Account','DESC','browserName','customerIp','customerPort','deviceModel','ratingMessage','ratingType','ratingValue','referer','subject','substatus','openchannel','externalUrl','threadId','Interaction','Owner','sortBy','reverse','value','slice','moment','bluebird','path','lodash','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/environment/shared','../../mysqldb','redis','localhost','socket.io-emitter','./cmContact.socket','register','json','offset','undefined','limit','count','status','set','Content-Range','update','then','destroy','end','sendStatus','name','send','describe','getOptions','findAll','user','catch','CmContact','find','params','tags','keys','startsWith','columnName','displayName','query','CmCustomField','length','cf_','alias','type','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','CmContactHasItem','VoiceCallReport','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','ListId','findOrCreate','spread','push','contact','all','Tag','Tags','color','tag','ContactItemType','ItemType','sequelize','literal','isNil','$and','omit','format','cf_%d','pickBy','map','isEmpty'];(function(_0x58fd8a,_0x471cf6){var _0x5f566=function(_0xe751a){while(--_0xe751a){_0x58fd8a['push'](_0x58fd8a['shift']());}};_0x5f566(++_0x471cf6);}(_0x79e8,0x184));var _0x879e=function(_0x27a331,_0x5ee322){_0x27a331=_0x27a331-0x0;var _0x2cf773=_0x79e8[_0x27a331];return _0x2cf773;};'use strict';var moment=require(_0x879e('0x0'));var BPromise=require(_0x879e('0x1'));var util=require('util');var path=require(_0x879e('0x2'));var fs=require('fs');var _=require(_0x879e('0x3'));var squel=require('squel');var Papa=require(_0x879e('0x4'));var Redis=require(_0x879e('0x5'));var contacts=require(_0x879e('0x6'));var qs=require(_0x879e('0x7'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var shared=require(_0x879e('0x8'));var db=require(_0x879e('0x9'))['db'];config[_0x879e('0xa')]=_['defaults'](config[_0x879e('0xa')],{'host':_0x879e('0xb'),'port':0x18eb});var socket=require(_0x879e('0xc'))(new Redis(config['redis']));require(_0x879e('0xd'))[_0x879e('0xe')](socket);function respondWithResult(_0x501863,_0x5248e2){_0x5248e2=_0x5248e2||0xc8;return function(_0x3e25d2){if(_0x3e25d2){return _0x501863['status'](_0x5248e2)[_0x879e('0xf')](_0x3e25d2);}};}function respondWithFilteredResult(_0x410c4a,_0x3e1bca){return function(_0x1a9917){if(_0x1a9917){var _0x267d03=typeof _0x3e1bca[_0x879e('0x10')]===_0x879e('0x11')&&typeof _0x3e1bca[_0x879e('0x12')]===_0x879e('0x11');var _0x2f9d14=_0x1a9917[_0x879e('0x13')];var _0x4df5e1=_0x267d03?0x0:_0x3e1bca['offset'];var _0x1577f3=_0x267d03?_0x1a9917[_0x879e('0x13')]:_0x3e1bca[_0x879e('0x10')]+_0x3e1bca[_0x879e('0x12')];var _0x2a757c;if(_0x1577f3>=_0x2f9d14){_0x1577f3=_0x2f9d14;_0x2a757c=0xc8;}else{_0x2a757c=0xce;}_0x410c4a[_0x879e('0x14')](_0x2a757c);return _0x410c4a[_0x879e('0x15')](_0x879e('0x16'),_0x4df5e1+'-'+_0x1577f3+'/'+_0x2f9d14)[_0x879e('0xf')](_0x1a9917);}return null;};}function saveUpdates(_0x1a9110){return function(_0x275744){if(_0x275744){return _0x275744[_0x879e('0x17')](_0x1a9110)[_0x879e('0x18')](function(_0x2eff56){return _0x2eff56;});}return null;};}function removeEntity(_0x2dbb93){return function(_0x7e7926){if(_0x7e7926){return _0x7e7926[_0x879e('0x19')]()[_0x879e('0x18')](function(){_0x2dbb93[_0x879e('0x14')](0xcc)[_0x879e('0x1a')]();});}};}function handleEntityNotFound(_0x983675){return function(_0x3b3be2){if(!_0x3b3be2){_0x983675[_0x879e('0x1b')](0x194);}return _0x3b3be2;};}function handleError(_0x84e371,_0x502934){_0x502934=_0x502934||0x1f4;return function(_0x59d1bb){logger['error'](_0x59d1bb['stack']);if(_0x59d1bb[_0x879e('0x1c')]){delete _0x59d1bb[_0x879e('0x1c')];}_0x84e371['status'](_0x502934)[_0x879e('0x1d')](_0x59d1bb);};}exports['index']=function(_0x196011,_0x441d87){var _0x27563a={};return contacts[_0x879e('0x1e')]()[_0x879e('0x18')](function(_0x3d775a){_0x27563a=qs[_0x879e('0x1f')](_0x3d775a,_0x196011);return contacts[_0x879e('0x20')](_0x196011['query'],_0x196011[_0x879e('0x21')],_0x27563a,_0x3d775a);})[_0x879e('0x18')](respondWithFilteredResult(_0x441d87,_0x27563a))[_0x879e('0x22')](handleError(_0x441d87,null));};exports[_0x879e('0x19')]=function(_0x224e71,_0x2b8720){return db[_0x879e('0x23')][_0x879e('0x24')]({'where':{'id':_0x224e71[_0x879e('0x25')]['id']}})[_0x879e('0x18')](handleEntityNotFound(_0x2b8720,null))[_0x879e('0x18')](removeEntity(_0x2b8720,null))['catch'](handleError(_0x2b8720,null));};exports['describe']=function(_0x3faf38,_0x1ad852){return db[_0x879e('0x23')][_0x879e('0x1e')]()[_0x879e('0x18')](function(_0x3ac393){delete _0x3ac393[_0x879e('0x26')];for(var _0x32440f=0x0;_0x32440f0x0){return new Promise(function(_0x25938d){var _0x2c9010=[];for(var _0x47de3e=0x0;_0x47de3e<_0xdf265d['length'];_0x47de3e++){_0x2c9010[_0x879e('0x5f')](insertAdditionalPhones(_0xdf265d[_0x47de3e][_0x879e('0x60')],_0xdf265d[_0x47de3e][_0x879e('0x56')]));}Promise[_0x879e('0x61')](_0x2c9010)['then'](function(){_0x25938d(0x1);});})[_0x879e('0x18')](function(){return{'success':_0x3bb67e,'failure':_0x26564a,'duplicates':_0x2d7ee8};});}else{return{'success':_0x3bb67e,'failure':_0x26564a,'duplicates':_0x2d7ee8};}}})[_0x879e('0x18')](respondWithResult(_0x101b51,0xc9))[_0x879e('0x22')](handleError(_0x101b51,null));};exports['show']=function(_0x1069e2,_0x451b30){var _0x3cca77;return db['CmContact'][_0x879e('0x1e')]()[_0x879e('0x18')](function(_0x5bb571){return db[_0x879e('0x23')][_0x879e('0x24')]({'where':{'id':_0x1069e2[_0x879e('0x25')]['id']},'include':[{'model':db[_0x879e('0x62')],'as':_0x879e('0x63'),'attributes':['id','name',_0x879e('0x64')],'required':_0x1069e2[_0x879e('0x2b')][_0x879e('0x65')]?!![]:![]},{'model':db['CmContactHasItem'],'as':'Phones','where':{'CmContactId':_0x1069e2[_0x879e('0x25')]['id']},'required':![],'include':[{'model':db[_0x879e('0x66')],'as':_0x879e('0x67')}]}],'order':[db[_0x879e('0x68')][_0x879e('0x69')]('Phones.OrderBy')],'attributes':_['keys'](_0x5bb571)});})[_0x879e('0x18')](function(_0xf25639){if(!_[_0x879e('0x6a')](_0xf25639)){_0x3cca77=_0xf25639[_0x879e('0x38')]({'plain':!![]});var _0x49464e={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf25639&&_0xf25639[_0x879e('0x5c')]){if(_0xf25639['ListId']){_0x49464e[_0x879e('0x5a')][_0x879e('0x6b')][_0x879e('0x5f')]({'ListId':{'$ne':_0xf25639[_0x879e('0x5c')]}});}}return db['CmCustomField'][_0x879e('0x20')](_0x49464e);}})['then'](function(_0x36b2d2){if(!_[_0x879e('0x6a')](_0x36b2d2)){return _[_0x879e('0x6c')](_0x3cca77,_['map'](_0x36b2d2,function(_0x29c59d){return util[_0x879e('0x6d')](_0x879e('0x6e'),_0x29c59d['id']);}));}})[_0x879e('0x18')](handleEntityNotFound(_0x451b30,null))['then'](respondWithResult(_0x451b30,null))[_0x879e('0x22')](handleError(_0x451b30,null));};exports['update']=function(_0x3bcc16,_0x57bd86){var _0x14351c;if(_0x3bcc16['body']['id']){delete _0x3bcc16[_0x879e('0x36')]['id'];}if(!_[_0x879e('0x6a')](_0x3bcc16[_0x879e('0x36')][_0x879e('0x53')])){var _0x24f8cf=_0x3bcc16[_0x879e('0x36')]['dialTimezone'];if(!_[_0x879e('0x6a')](shared[_0x879e('0x54')][_0x24f8cf]))_0x3bcc16['body']['utcOffset']=shared[_0x879e('0x54')][_0x24f8cf][_0x879e('0x55')];}return db['CmContact'][_0x879e('0x24')]({'where':{'id':_0x3bcc16[_0x879e('0x25')]['id']}})[_0x879e('0x18')](handleEntityNotFound(_0x57bd86,null))[_0x879e('0x18')](saveUpdates(_0x3bcc16[_0x879e('0x36')],null))['then'](function(_0x19d320){_0x14351c=_0x19d320;var _0x250ea6={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x19d320&&_0x19d320[_0x879e('0x5c')]){if(_0x19d320[_0x879e('0x5c')]){_0x250ea6['where'][_0x879e('0x6b')][_0x879e('0x5f')]({'ListId':{'$ne':_0x19d320[_0x879e('0x5c')]}});}}return db[_0x879e('0x2c')][_0x879e('0x20')](_0x250ea6);})[_0x879e('0x18')](function(_0x46f22f){if(_0x46f22f){return _[_0x879e('0x6c')](_[_0x879e('0x6f')](_0x3bcc16[_0x879e('0x36')],function(_0x448ca4,_0x168923){return _['startsWith'](_0x168923,_0x879e('0x2e'));}),_[_0x879e('0x70')](_0x46f22f,function(_0x1bbb3a){return util[_0x879e('0x6d')](_0x879e('0x6e'),_0x1bbb3a['id']);}));}})['then'](function(_0x6419a0){if(_0x6419a0&&!_[_0x879e('0x71')](_0x6419a0)){var _0x2aea85=squel[_0x879e('0x17')]()['table'](_0x879e('0x72'))[_0x879e('0x73')](_0x6419a0)['where'](_0x879e('0x74'),_0x3bcc16[_0x879e('0x25')]['id'])['toParam']();return db['sequelize'][_0x879e('0x2b')](_0x2aea85['text'],{'replacements':_0x2aea85[_0x879e('0x75')]});}})[_0x879e('0x18')](function(){if(_0x3bcc16[_0x879e('0x36')]['phone']&&_0x14351c){return db[_0x879e('0x3d')][_0x879e('0x17')]({'phone':_0x3bcc16[_0x879e('0x36')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x14351c['id']}});}})[_0x879e('0x18')](function(){return _0x14351c;})[_0x879e('0x18')](respondWithResult(_0x57bd86,null))['catch'](handleError(_0x57bd86,null));};exports['getTags']=function(_0x430145,_0x5351c1){var _0x55e199={};var _0x262b8d={};var _0x403d24;var _0xd7147b;return db[_0x879e('0x23')][_0x879e('0x76')]({'where':{'id':_0x430145[_0x879e('0x25')]['id']}})[_0x879e('0x18')](handleEntityNotFound(_0x5351c1,null))[_0x879e('0x18')](function(_0xf5b4df){if(_0xf5b4df){_0x403d24=_0xf5b4df;_0x262b8d[_0x879e('0x77')]=_[_0x879e('0x27')](db[_0x879e('0x62')][_0x879e('0x78')]);_0x262b8d[_0x879e('0x2b')]=_['keys'](_0x430145[_0x879e('0x2b')]);_0x262b8d['filters']=_[_0x879e('0x79')](_0x262b8d[_0x879e('0x77')],_0x262b8d['query']);_0x55e199[_0x879e('0x7a')]=_[_0x879e('0x79')](_0x262b8d[_0x879e('0x77')],qs[_0x879e('0x7b')](_0x430145[_0x879e('0x2b')][_0x879e('0x7b')]));_0x55e199['attributes']=_0x55e199[_0x879e('0x7a')][_0x879e('0x2d')]?_0x55e199[_0x879e('0x7a')]:_0x262b8d[_0x879e('0x77')];_0x55e199[_0x879e('0x7c')]=qs[_0x879e('0x7d')](_0x430145[_0x879e('0x2b')][_0x879e('0x7d')]);_0x55e199[_0x879e('0x5a')]=qs[_0x879e('0x7e')](_[_0x879e('0x7f')](_0x430145[_0x879e('0x2b')],_0x262b8d[_0x879e('0x7e')]));if(_0x430145[_0x879e('0x2b')]['filter']){_0x55e199[_0x879e('0x5a')]=_[_0x879e('0x35')](_0x55e199[_0x879e('0x5a')],{'$or':_['map'](_0x55e199[_0x879e('0x7a')],function(_0x1b6530){var _0x5d98f1={};_0x5d98f1[_0x1b6530]={'$like':'%'+_0x430145[_0x879e('0x2b')]['filter']+'%'};return _0x5d98f1;})});}_0x55e199=_[_0x879e('0x35')]({},_0x55e199,_0x430145[_0x879e('0x80')]);return _0x403d24[_0x879e('0x81')](_0x55e199);}})[_0x879e('0x18')](function(_0x545c45){if(_0x545c45){_0xd7147b=_0x545c45[_0x879e('0x2d')];if(!_0x430145[_0x879e('0x2b')][_0x879e('0x34')](_0x879e('0x82'))){_0x55e199[_0x879e('0x12')]=qs[_0x879e('0x12')](_0x430145[_0x879e('0x2b')][_0x879e('0x12')]);_0x55e199[_0x879e('0x10')]=qs[_0x879e('0x10')](_0x430145[_0x879e('0x2b')][_0x879e('0x10')]);}return _0x403d24[_0x879e('0x81')](_0x55e199);}})[_0x879e('0x18')](function(_0x918e94){if(_0x918e94){return _0x918e94?{'count':_0xd7147b,'rows':_0x918e94}:null;}})[_0x879e('0x18')](respondWithResult(_0x5351c1,null))[_0x879e('0x22')](handleError(_0x5351c1,null));};exports['setTags']=function(_0x4b13fe,_0x131eb6){if(_0x4b13fe[_0x879e('0x36')]['id']){delete _0x4b13fe[_0x879e('0x36')]['id'];}return db[_0x879e('0x23')][_0x879e('0x76')]({'where':{'id':_0x4b13fe[_0x879e('0x25')]['id']}})[_0x879e('0x18')](handleEntityNotFound(_0x131eb6,null))['then'](function(_0x546a00){if(_0x546a00){return _0x546a00['setTags'](_0x4b13fe[_0x879e('0x36')]['ids']||[]);}return null;})[_0x879e('0x18')](respondWithResult(_0x131eb6,null))[_0x879e('0x22')](handleError(_0x131eb6,null));};exports[_0x879e('0x83')]=function(_0x1c4e00,_0x45caf1){var _0x1ca9b0=[];_0x1ca9b0['push'](addAdditionalPhones(_0x1c4e00[_0x879e('0x36')]));Promise[_0x879e('0x61')](_0x1ca9b0)['then'](function(){_0x1ca9b0=[];_0x1ca9b0[_0x879e('0x5f')](deleteCmHopperPhones(_0x1c4e00['body']['id']));_0x1ca9b0['push'](addCmHopperPhones(_0x1c4e00[_0x879e('0x36')]['id']));Promise['all'](_0x1ca9b0)[_0x879e('0x18')](function(){return[0x1];})[_0x879e('0x18')](respondWithResult(_0x45caf1,null));});};function addAdditionalPhones(_0x54987c){var _0x471c56;return new Promise(function(_0x516b83){return db[_0x879e('0x4b')][_0x879e('0x19')]({'where':{'CmContactId':_0x54987c['id']}})[_0x879e('0x18')](function(){db['ContactItemType'][_0x879e('0x20')]({'raw':!![],'attributes':['id',_0x879e('0x84')]})['then'](function(_0x19e78a){var _0x5c0410=[];for(var _0x359a10=0x0;_0x359a10<_0x54987c[_0x879e('0x85')][_0x879e('0x2d')];_0x359a10++){var _0x37a2e8=_0x54987c[_0x879e('0x86')]?_[_0x879e('0x6a')](_0x54987c[_0x879e('0x86')][_0x359a10])?'':_0x54987c[_0x879e('0x86')][_0x359a10]:_0x54987c['items'][_0x359a10][_0x879e('0x87')]?_0x54987c[_0x879e('0x85')][_0x359a10]['ItemTypeId']:'';var _0x2cc696=_[_0x879e('0x6a')](_0x54987c[_0x879e('0x85')][_0x359a10]['description'])?'':_0x54987c[_0x879e('0x85')][_0x359a10][_0x879e('0x88')];var _0x3773ea=_0x37a2e8+':'+_0x54987c['items'][_0x359a10][_0x879e('0x89')]+'§'+_0x2cc696;if(_[_0x879e('0x6a')](_0x471c56))_0x471c56=_0x3773ea;else _0x471c56+=';'+_0x3773ea;var _0xb753bd=null;var _0x316b95=null;if(_0x54987c['item_types']){if(!_[_0x879e('0x6a')](_0x54987c['item_types'][_0x359a10])){_0x316b95=_[_0x879e('0x24')](_0x19e78a,function(_0x40b817){return _0x40b817['id']===_0x54987c['item_types'][_0x359a10];});if(!_[_0x879e('0x6a')](_0x316b95)){_0xb753bd=_0x316b95[_0x879e('0x84')];}}}else{if(!_[_0x879e('0x6a')](_0x54987c['items'][_0x359a10])){_0x316b95=_['find'](_0x19e78a,function(_0x573b1c){return _0x573b1c['id']===_0x54987c[_0x879e('0x85')][_0x359a10][_0x879e('0x87')];});if(!_[_0x879e('0x6a')](_0x316b95)){_0xb753bd=_0x359a10;}}}if(_[_0x879e('0x6a')](_0xb753bd)){_0xb753bd=0x64;}_0x5c0410[_0x879e('0x5f')](addAdditionalPhone(_0x54987c['id'],_0x54987c['items'][_0x359a10]['phone'],_0x54987c[_0x879e('0x86')]?_['isNil'](_0x54987c['item_types'][_0x359a10])?null:_0x54987c[_0x879e('0x86')][_0x359a10]:_0x54987c['items'][_0x359a10]['ItemTypeId']?_0x54987c[_0x879e('0x85')][_0x359a10]['ItemTypeId']:null,_0xb753bd,_0x2cc696));}Promise[_0x879e('0x61')](_0x5c0410)[_0x879e('0x18')](function(){db[_0x879e('0x23')][_0x879e('0x17')]({'AdditionalPhones':_0x471c56},{'where':{'id':_0x54987c['id']}})[_0x879e('0x18')](function(){_0x516b83(0x1);});});});});});}function addAdditionalPhone(_0x72739f,_0x54981d,_0xba2b12,_0x2af2ba,_0x400a0b){return db[_0x879e('0x4b')][_0x879e('0x24')]({'where':{'CmContactId':_0x72739f,'item':_0x54981d}})[_0x879e('0x18')](function(_0x2df207){if(_0x2df207)logger[_0x879e('0x31')](_0x879e('0x8a'),_0x2df207);else{db[_0x879e('0x4b')][_0x879e('0x40')]({'CmContactId':_0x72739f,'item':_0x54981d,'ItemTypeId':_0xba2b12,'OrderBy':_0x2af2ba,'ItemClass':'PHONE','description':_0x400a0b});}});}function deleteCmHopperPhones(_0x56dd5a){return new Promise(function(_0x3de6d2){return db[_0x879e('0x3d')][_0x879e('0x20')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x56dd5a}})['then'](function(_0x3b53df){db[_0x879e('0x8b')][_0x879e('0x19')]({'where':{'CmHopperId':{'$in':_['map'](_0x3b53df,'id')}}});})[_0x879e('0x18')](function(){_0x3de6d2(0x1);});});}function addCmHopperPhones(_0x4a74d3){return new Promise(function(_0x4539af){return db[_0x879e('0x3d')][_0x879e('0x20')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x4a74d3}})[_0x879e('0x18')](function(_0x4cdb9e){var _0x2c0dbb=[];_['map'](_0x4cdb9e,function(_0x3d886a){_0x2c0dbb['push'](createCmHopperPhone(_0x4a74d3,_0x3d886a['id']));});Promise['all'](_0x2c0dbb)[_0x879e('0x18')](function(){_0x4539af(0x1);});});});}function createCmHopperPhone(_0x381819,_0x3fbef0){return new Promise(function(_0x5ad679){db[_0x879e('0x4b')]['findAll']({'raw':!![],'attributes':[_0x879e('0x8c'),_0x879e('0x84')],'where':{'CmContactId':_0x381819,'ItemClass':_0x879e('0x8d')},'include':[{'model':db[_0x879e('0x66')],'attributes':[_0x879e('0x84')],'as':_0x879e('0x67')}],'order':['OrderBy',db[_0x879e('0x68')][_0x879e('0x69')](_0x879e('0x8e'))]})[_0x879e('0x18')](function(_0x51ec1b){var _0x42c7a5=0x1;var _0x58678e=_['map'](_0x51ec1b,function(_0x2c3647){_0x2c3647['CmHopperId']=_0x3fbef0;_0x2c3647[_0x879e('0x89')]=_0x2c3647[_0x879e('0x8c')];_0x2c3647[_0x879e('0x84')]=_0x42c7a5;delete _0x2c3647[_0x879e('0x8f')];_0x42c7a5=_0x42c7a5+0x1;return _0x2c3647;});return db[_0x879e('0x8b')][_0x879e('0x57')](_0x58678e,{});})[_0x879e('0x18')](function(){_0x5ad679(0x1);});});}function insertAdditionalPhones(_0x16119b,_0x1a18c2){return new Promise(function(_0x1d80d9){var _0x190081=[];for(var _0x38d15b=0x0;_0x38d15b<_0x1a18c2[_0x879e('0x2d')];_0x38d15b++){var _0x47c552=_0x1a18c2[_0x38d15b];_0x190081[_0x879e('0x5f')](parseContactItemType(_0x47c552));}Promise[_0x879e('0x61')](_0x190081)[_0x879e('0x18')](function(){var _0x4c7d59={'id':_0x16119b['id'],'items':_0x1a18c2};return addAdditionalPhones(_0x4c7d59)[_0x879e('0x18')](function(){return addCmHopperPhones(_0x16119b['id']);});})[_0x879e('0x18')](function(){_0x1d80d9(_0x16119b);});});}function parseContactItemType(_0xc6a76d){return new Promise(function(_0x3bfd41){if(_0xc6a76d['hasOwnProperty'](_0x879e('0x87'))){_0x3bfd41(_0xc6a76d);}else{return db[_0x879e('0x66')]['find']({'where':{'name':_0xc6a76d[_0x879e('0x67')]}})[_0x879e('0x18')](function(_0x3fa65f){if(_[_0x879e('0x6a')](_0x3fa65f))_0xc6a76d[_0x879e('0x87')]=null;else _0xc6a76d[_0x879e('0x87')]=_0x3fa65f['id'];_0x3bfd41(_0xc6a76d);});}});}exports[_0x879e('0x90')]=function(_0x56bf26,_0x4c5325){return db[_0x879e('0x4b')][_0x879e('0x20')]({'raw':!![],'where':{'CmContactId':_0x56bf26[_0x879e('0x25')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0x879e('0x66')],'as':_0x879e('0x67')}],'order':[[_0x879e('0x84')],[db[_0x879e('0x68')][_0x879e('0x69')](_0x879e('0x8e'))]]})[_0x879e('0x18')](function(_0x36a9af){return _0x36a9af;})[_0x879e('0x18')](respondWithResult(_0x4c5325,null))[_0x879e('0x22')](handleError(_0x4c5325,null));};exports[_0x879e('0x91')]=function(_0x5a5e89,_0x25bb75){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x5a5e89[_0x879e('0x36')][_0x879e('0x92')]}})['then'](function(_0x1bc4d0){var _0x2514e1=_[_0x879e('0x70')](_0x1bc4d0,function(_0x1b086f){_0x1b086f[_0x879e('0x93')]=_0x5a5e89['body'][_0x879e('0x94')];return _0x1b086f;});return db['CmContactHasItem'][_0x879e('0x57')](_0x2514e1,{});})['then'](function(){return addCmHopperPhones(_0x5a5e89[_0x879e('0x36')]['toContactId']);})[_0x879e('0x18')](function(){return['ok'];})[_0x879e('0x18')](respondWithResult(_0x25bb75,null))[_0x879e('0x22')](handleError(_0x25bb75,null));};exports[_0x879e('0x95')]=function(_0x48eb6f,_0x122ea3){var _0x1f28e7=[];_0x1f28e7[_0x879e('0x5f')](createCmHopperPhone(_0x48eb6f['body']['id'],_0x48eb6f[_0x879e('0x36')]['hopperId']));Promise[_0x879e('0x61')](_0x1f28e7)[_0x879e('0x18')](function(){return[0x1];})[_0x879e('0x18')](respondWithResult(_0x122ea3,null));};exports[_0x879e('0x96')]=function(_0x239ace,_0x36e479){var _0x195880={'raw':![],'where':{}};var _0x3e9854={};var _0x7a7ae2={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x239ace[_0x879e('0x25')]['id']}})[_0x879e('0x18')](handleEntityNotFound(_0x36e479,null))['then'](function(_0x5bbfc3){if(_0x5bbfc3){_0x3e9854['model']=_[_0x879e('0x27')](db[_0x879e('0x3d')]['rawAttributes']);_0x3e9854['query']=_[_0x879e('0x27')](_0x239ace[_0x879e('0x2b')]);_0x3e9854[_0x879e('0x7e')]=_['intersection'](_0x3e9854['model'],_0x3e9854[_0x879e('0x2b')]);_0x195880['attributes']=_[_0x879e('0x79')](_0x3e9854[_0x879e('0x77')],qs['fields'](_0x239ace[_0x879e('0x2b')][_0x879e('0x7b')]));_0x195880[_0x879e('0x7a')]=_0x195880[_0x879e('0x7a')][_0x879e('0x2d')]?_0x195880['attributes']:_0x3e9854[_0x879e('0x77')];if(!_0x239ace['query']['hasOwnProperty'](_0x879e('0x82'))){_0x195880[_0x879e('0x12')]=qs[_0x879e('0x12')](_0x239ace[_0x879e('0x2b')][_0x879e('0x12')]);_0x195880[_0x879e('0x10')]=qs[_0x879e('0x10')](_0x239ace[_0x879e('0x2b')][_0x879e('0x10')]);}_0x195880[_0x879e('0x7c')]=qs[_0x879e('0x7d')](_0x239ace[_0x879e('0x2b')]['sort']);_0x195880[_0x879e('0x5a')]=qs[_0x879e('0x7e')](_[_0x879e('0x7f')](_0x239ace[_0x879e('0x2b')],_0x3e9854[_0x879e('0x7e')]));_0x195880[_0x879e('0x5a')][_0x879e('0x97')]=_0x5bbfc3['id'];if(_0x239ace[_0x879e('0x2b')][_0x879e('0x98')]){_0x195880[_0x879e('0x5a')]=_['merge'](_0x195880['where'],{'$or':_[_0x879e('0x70')](_0x195880[_0x879e('0x7a')],function(_0xa8c610){var _0x307714={};_0x307714[_0xa8c610]={'$like':'%'+_0x239ace[_0x879e('0x2b')][_0x879e('0x98')]+'%'};return _0x307714;})});}_0x195880=_['merge']({},_0x195880,_0x239ace[_0x879e('0x80')]);return db[_0x879e('0x3d')][_0x879e('0x13')]({'where':_0x195880[_0x879e('0x5a')]})[_0x879e('0x18')](function(_0x9c0ea6){_0x7a7ae2[_0x879e('0x13')]=_0x9c0ea6;if(_0x239ace['query'][_0x879e('0x99')]){_0x195880[_0x879e('0x9a')]=[{'all':!![]}];}return db[_0x879e('0x3d')][_0x879e('0x20')](_0x195880);})['then'](function(_0x2fcc1b){_0x7a7ae2[_0x879e('0x9b')]=_0x2fcc1b;return _0x7a7ae2;});}})['then'](respondWithFilteredResult(_0x36e479,_0x195880))[_0x879e('0x22')](handleError(_0x36e479,null));};exports[_0x879e('0x9c')]=function(_0x104ac8,_0x336b69){var _0x1b7114={'raw':!![],'where':{}};var _0x1ffbaa={};var _0x2e253b={'count':0x0,'rows':[]};return db[_0x879e('0x23')][_0x879e('0x76')]({'where':{'id':_0x104ac8[_0x879e('0x25')]['id']}})[_0x879e('0x18')](handleEntityNotFound(_0x336b69,null))[_0x879e('0x18')](function(_0x53364f){if(_0x53364f){_0x1ffbaa[_0x879e('0x77')]=_['keys'](db[_0x879e('0x9d')][_0x879e('0x78')]);_0x1ffbaa['query']=_['keys'](_0x104ac8['query']);_0x1ffbaa[_0x879e('0x7e')]=_['intersection'](_0x1ffbaa[_0x879e('0x77')],_0x1ffbaa['query']);_0x1b7114[_0x879e('0x7a')]=_[_0x879e('0x79')](_0x1ffbaa[_0x879e('0x77')],qs[_0x879e('0x7b')](_0x104ac8['query']['fields']));_0x1b7114['attributes']=_0x1b7114[_0x879e('0x7a')][_0x879e('0x2d')]?_0x1b7114[_0x879e('0x7a')]:_0x1ffbaa[_0x879e('0x77')];if(!_0x104ac8[_0x879e('0x2b')][_0x879e('0x34')]('nolimit')){_0x1b7114[_0x879e('0x12')]=qs[_0x879e('0x12')](_0x104ac8['query'][_0x879e('0x12')]);_0x1b7114[_0x879e('0x10')]=qs['offset'](_0x104ac8[_0x879e('0x2b')]['offset']);}_0x1b7114[_0x879e('0x7c')]=qs[_0x879e('0x7d')](_0x104ac8[_0x879e('0x2b')][_0x879e('0x7d')]);_0x1b7114['where']=qs[_0x879e('0x7e')](_[_0x879e('0x7f')](_0x104ac8[_0x879e('0x2b')],_0x1ffbaa[_0x879e('0x7e')]));_0x1b7114['where']['ContactId']=_0x53364f['id'];if(_0x104ac8[_0x879e('0x2b')][_0x879e('0x98')]){_0x1b7114[_0x879e('0x5a')]=_[_0x879e('0x35')](_0x1b7114[_0x879e('0x5a')],{'$or':_['map'](_0x1b7114[_0x879e('0x7a')],function(_0x4cc8d4){var _0x5a1fa2={};_0x5a1fa2[_0x4cc8d4]={'$like':'%'+_0x104ac8[_0x879e('0x2b')][_0x879e('0x98')]+'%'};return _0x5a1fa2;})});}_0x1b7114=_['merge']({},_0x1b7114,_0x104ac8[_0x879e('0x80')]);return db[_0x879e('0x9d')][_0x879e('0x13')]({'where':_0x1b7114[_0x879e('0x5a')]})[_0x879e('0x18')](function(_0x19c33c){_0x2e253b['count']=_0x19c33c;if(_0x104ac8[_0x879e('0x2b')][_0x879e('0x99')]){_0x1b7114[_0x879e('0x9a')]=[{'all':!![]}];}return db[_0x879e('0x9d')][_0x879e('0x20')](_0x1b7114);})[_0x879e('0x18')](function(_0x1c8f0c){_0x2e253b[_0x879e('0x9b')]=_0x1c8f0c;return _0x2e253b;});}})[_0x879e('0x18')](respondWithFilteredResult(_0x336b69,_0x1b7114))['catch'](handleError(_0x336b69,null));};exports[_0x879e('0x9e')]=function(_0x3085d4,_0x389c1d){var _0x48d77a={'raw':!![],'where':{}};var _0x54581c={};var _0x3601e2={'count':0x0,'rows':[]};return db[_0x879e('0x23')][_0x879e('0x76')]({'where':{'id':_0x3085d4[_0x879e('0x25')]['id']}})[_0x879e('0x18')](handleEntityNotFound(_0x389c1d,null))[_0x879e('0x18')](function(_0x2d22cc){if(_0x2d22cc){_0x54581c[_0x879e('0x77')]=_['keys'](db[_0x879e('0x9f')][_0x879e('0x78')]);_0x54581c[_0x879e('0x2b')]=_[_0x879e('0x27')](_0x3085d4[_0x879e('0x2b')]);_0x54581c[_0x879e('0x7e')]=_[_0x879e('0x79')](_0x54581c[_0x879e('0x77')],_0x54581c[_0x879e('0x2b')]);_0x48d77a[_0x879e('0x7a')]=_[_0x879e('0x79')](_0x54581c[_0x879e('0x77')],qs[_0x879e('0x7b')](_0x3085d4['query'][_0x879e('0x7b')]));_0x48d77a['attributes']=_0x48d77a[_0x879e('0x7a')][_0x879e('0x2d')]?_0x48d77a[_0x879e('0x7a')]:_0x54581c[_0x879e('0x77')];if(!_0x3085d4[_0x879e('0x2b')][_0x879e('0x34')]('nolimit')){_0x48d77a[_0x879e('0x12')]=qs[_0x879e('0x12')](_0x3085d4[_0x879e('0x2b')][_0x879e('0x12')]);_0x48d77a[_0x879e('0x10')]=qs[_0x879e('0x10')](_0x3085d4[_0x879e('0x2b')][_0x879e('0x10')]);}_0x48d77a[_0x879e('0x7c')]=qs['sort'](_0x3085d4['query']['sort']);_0x48d77a[_0x879e('0x5a')]=qs[_0x879e('0x7e')](_[_0x879e('0x7f')](_0x3085d4[_0x879e('0x2b')],_0x54581c[_0x879e('0x7e')]));_0x48d77a[_0x879e('0x5a')][_0x879e('0x97')]=_0x2d22cc['id'];if(_0x3085d4[_0x879e('0x2b')][_0x879e('0x98')]){_0x48d77a[_0x879e('0x5a')]=_[_0x879e('0x35')](_0x48d77a[_0x879e('0x5a')],{'$or':_['map'](_0x48d77a[_0x879e('0x7a')],function(_0xc6a7){var _0x53b935={};_0x53b935[_0xc6a7]={'$like':'%'+_0x3085d4[_0x879e('0x2b')][_0x879e('0x98')]+'%'};return _0x53b935;})});}_0x48d77a=_[_0x879e('0x35')]({},_0x48d77a,_0x3085d4[_0x879e('0x80')]);return db['CmHopperFinal'][_0x879e('0x13')]({'where':_0x48d77a[_0x879e('0x5a')]})[_0x879e('0x18')](function(_0x5a1c53){_0x3601e2[_0x879e('0x13')]=_0x5a1c53;if(_0x3085d4[_0x879e('0x2b')][_0x879e('0x99')]){_0x48d77a[_0x879e('0x9a')]=[{'all':!![]}];}return db[_0x879e('0x9f')][_0x879e('0x20')](_0x48d77a);})[_0x879e('0x18')](function(_0x122c89){_0x3601e2[_0x879e('0x9b')]=_0x122c89;return _0x3601e2;});}})['then'](respondWithFilteredResult(_0x389c1d,_0x48d77a))[_0x879e('0x22')](handleError(_0x389c1d,null));};exports[_0x879e('0xa0')]=function(_0x3e291d,_0x19962e){var _0x4442eb={'raw':!![],'where':{}};var _0x10445a={};var _0xe6a4f7={'count':0x0,'rows':[]};return db['CmContact'][_0x879e('0x76')]({'where':{'id':_0x3e291d[_0x879e('0x25')]['id']}})[_0x879e('0x18')](handleEntityNotFound(_0x19962e,null))[_0x879e('0x18')](function(_0x37ffe2){if(_0x37ffe2){_0x10445a[_0x879e('0x77')]=_[_0x879e('0x27')](db[_0x879e('0x50')][_0x879e('0x78')]);_0x10445a[_0x879e('0x2b')]=_[_0x879e('0x27')](_0x3e291d[_0x879e('0x2b')]);_0x10445a['filters']=_['intersection'](_0x10445a[_0x879e('0x77')],_0x10445a[_0x879e('0x2b')]);_0x4442eb[_0x879e('0x7a')]=_[_0x879e('0x79')](_0x10445a['model'],qs['fields'](_0x3e291d['query']['fields']));_0x4442eb[_0x879e('0x7a')]=_0x4442eb['attributes'][_0x879e('0x2d')]?_0x4442eb[_0x879e('0x7a')]:_0x10445a[_0x879e('0x77')];if(!_0x3e291d[_0x879e('0x2b')][_0x879e('0x34')](_0x879e('0x82'))){_0x4442eb[_0x879e('0x12')]=qs[_0x879e('0x12')](_0x3e291d['query'][_0x879e('0x12')]);_0x4442eb[_0x879e('0x10')]=qs[_0x879e('0x10')](_0x3e291d[_0x879e('0x2b')][_0x879e('0x10')]);}_0x4442eb[_0x879e('0x7c')]=qs[_0x879e('0x7d')](_0x3e291d['query'][_0x879e('0x7d')]);_0x4442eb[_0x879e('0x5a')]=qs['filters'](_['pick'](_0x3e291d['query'],_0x10445a['filters']));_0x4442eb[_0x879e('0x5a')][_0x879e('0x97')]=_0x37ffe2['id'];if(_0x3e291d['query'][_0x879e('0x98')]){_0x4442eb[_0x879e('0x5a')]=_['merge'](_0x4442eb['where'],{'$or':_[_0x879e('0x70')](_0x4442eb[_0x879e('0x7a')],function(_0x4c1d3c){var _0x26a39c={};_0x26a39c[_0x4c1d3c]={'$like':'%'+_0x3e291d[_0x879e('0x2b')][_0x879e('0x98')]+'%'};return _0x26a39c;})});}_0x4442eb=_[_0x879e('0x35')]({},_0x4442eb,_0x3e291d[_0x879e('0x80')]);return db['JscriptySessionReport'][_0x879e('0x13')]({'where':_0x4442eb[_0x879e('0x5a')]})[_0x879e('0x18')](function(_0x3dcfb8){_0xe6a4f7[_0x879e('0x13')]=_0x3dcfb8;if(_0x3e291d[_0x879e('0x2b')][_0x879e('0x99')]){_0x4442eb[_0x879e('0x9a')]=[{'all':!![]}];}return db[_0x879e('0x50')][_0x879e('0x20')](_0x4442eb);})[_0x879e('0x18')](function(_0x30c83f){_0xe6a4f7[_0x879e('0x9b')]=_0x30c83f;return _0xe6a4f7;});}})['then'](respondWithFilteredResult(_0x19962e,_0x4442eb))['catch'](handleError(_0x19962e,null));};exports[_0x879e('0xa1')]=function(_0x5dd373,_0x278bc1){try{if(!_0x5dd373[_0x879e('0x36')][_0x879e('0x5c')]){throw new Error('No\x20ListId\x20specified');}if(!_0x5dd373[_0x879e('0x36')]['binding_keys']){throw new Error(_0x879e('0xa2'));}if(!_0x5dd373['body'][_0x879e('0xa3')]){throw new Error(_0x879e('0xa4'));}if(!_0x5dd373[_0x879e('0x36')]['socket_timestamp']){throw new Error(_0x879e('0xa5'));}var _0x4cef46=_0x5dd373[_0x879e('0x36')][_0x879e('0xa6')][_0x879e('0xa7')](',');var _0x418ebf=_0x5dd373[_0x879e('0x36')][_0x879e('0xa3')][_0x879e('0xa7')](',');if(!_0x4cef46[_0x879e('0x2d')]||!_0x418ebf['length']||_0x4cef46[_0x879e('0x2d')]!==_0x418ebf[_0x879e('0x2d')]){throw new Error(_0x879e('0xa8'));}_0x5dd373['body'][_0x879e('0x7b')]=_['zipObject'](_0x4cef46,_0x418ebf);if(!_0x5dd373['body'][_0x879e('0x7b')][_0x879e('0x89')]){throw new Error(_0x879e('0xa9'));}if(!_0x5dd373[_0x879e('0x36')][_0x879e('0x7b')][_0x879e('0xaa')]){throw new Error(_0x879e('0xab'));}var _0xc64d8e=path[_0x879e('0x3b')](config['root'],'server/files/tmp',_0x5dd373[_0x879e('0xac')][_0x879e('0xad')]);fs[_0x879e('0xae')](_0xc64d8e,parseInt(_0x879e('0xaf'),0x8));var _0x1d56dc=require(_0x879e('0xb0'))['fork'](path[_0x879e('0x3b')](__dirname,_0x879e('0xb1')),[_0xc64d8e,_0x5dd373[_0x879e('0x36')][_0x879e('0xa6')],_0x5dd373['body'][_0x879e('0xa3')],_0x5dd373[_0x879e('0x36')]['ListId'],_0x5dd373[_0x879e('0x36')][_0x879e('0xb2')],_0x5dd373[_0x879e('0x36')][_0x879e('0x59')],_0x5dd373['body'][_0x879e('0xb3')]]);return _0x278bc1['status'](0xc8)[_0x879e('0xf')]({'message':'File\x20uploaded\x20correctly!','pid':_0x1d56dc[_0x879e('0xb4')]});}catch(_0x3e6c97){return _0x278bc1['status'](0x1f4)['send'](_0x3e6c97);}};exports[_0x879e('0xb5')]=function(_0x3c208d,_0x3aa87a){var _0xf793f7=fs['createReadStream'](_0x3c208d[_0x879e('0xac')]['path']);Papa[_0x879e('0xb6')](_0xf793f7,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x4c44a2){return _0x3aa87a['status'](0xc8)['json']({'file':_0x3c208d[_0x879e('0xac')],'fields':_0x4c44a2[_0x879e('0xb7')][_0x879e('0x7b')]});}});};exports['import']=function(_0x3f8556,_0x38e16f){return db[_0x879e('0xb8')][_0x879e('0x20')]({'raw':!![],'attributes':['id'],'where':{'role':_0x879e('0xb9')}})[_0x879e('0x18')](function(_0x560688){var _0x131c8f=![];if(!_0x3f8556['body'][_0x879e('0x5c')]){throw new Error(_0x879e('0xba'));}if(!_0x3f8556['body'][_0x879e('0xbb')]['phone']){throw new Error(_0x879e('0xa9'));}if(!_0x3f8556[_0x879e('0x36')][_0x879e('0xbb')][_0x879e('0xaa')]){throw new Error(_0x879e('0xab'));}if(!_0x3f8556[_0x879e('0x36')][_0x879e('0xb3')]){throw new Error(_0x879e('0xa5'));}var _0x1960cf=require(_0x879e('0xb0'))[_0x879e('0xbc')](path[_0x879e('0x3b')](__dirname,_0x879e('0xbd')),[_0x3f8556[_0x879e('0x25')]['id'],JSON[_0x879e('0xbe')](_0x3f8556[_0x879e('0x36')]),JSON[_0x879e('0xbe')](_0x560688)]);_0x1960cf['on'](_0x879e('0xbf'),function(){_0x131c8f=!![];return _0x38e16f['status'](0xc8)[_0x879e('0xf')]({'message':_0x879e('0xc0'),'pid':_0x1960cf[_0x879e('0xb4')]});});_0x1960cf['on'](_0x879e('0xc1'),function(_0x1d2d28){if(_0x1d2d28&&!_0x131c8f){return _0x38e16f[_0x879e('0x14')](0x1f4)['json']({'message':_0x879e('0xc2'),'pid':_0x1960cf[_0x879e('0xb4')]});}});})[_0x879e('0x22')](handleError(_0x38e16f,null));};exports[_0x879e('0xc3')]=function(_0x39477c,_0x1b413e){return db[_0x879e('0xb8')][_0x879e('0x20')]({'raw':!![],'attributes':['id'],'where':{'role':_0x879e('0xb9')}})[_0x879e('0x18')](function(_0x156226){var _0x1ab83e=![];if(!_0x39477c[_0x879e('0x36')][_0x879e('0x5c')]){throw new Error('No\x20ListId\x20specified');}if(!_0x39477c[_0x879e('0x36')][_0x879e('0xbb')]['phone']){throw new Error(_0x879e('0xa9'));}if(!_0x39477c[_0x879e('0x36')]['binding'][_0x879e('0xaa')]){throw new Error(_0x879e('0xab'));}if(!_0x39477c['body']['socket_timestamp']){throw new Error(_0x879e('0xa5'));}var _0x39ff9a=require(_0x879e('0xb0'))['fork'](path['join'](__dirname,'../../components/import/cm/csvUpdates'),[_0x39477c[_0x879e('0x25')]['id'],JSON[_0x879e('0xbe')](_0x39477c[_0x879e('0x36')]),JSON[_0x879e('0xbe')](_0x156226)]);_0x39ff9a['on'](_0x879e('0xbf'),function(){_0x1ab83e=!![];return _0x1b413e['status'](0xc8)[_0x879e('0xf')]({'message':_0x879e('0xc0'),'pid':_0x39ff9a[_0x879e('0xb4')]});});_0x39ff9a['on'](_0x879e('0xc1'),function(_0x54b9dd){if(_0x54b9dd&&!_0x1ab83e){return _0x1b413e[_0x879e('0x14')](0x1f4)[_0x879e('0xf')]({'message':'error\x20child\x20process','pid':_0x39ff9a[_0x879e('0xb4')]});}});})[_0x879e('0x22')](handleError(_0x1b413e,null));};exports['getJourney']=function(_0x1b399a,_0xd2e8d9){var _0x3ac739=[_0x879e('0xc4'),'chat',_0x879e('0xc5'),'openchannel',_0x879e('0xc6'),_0x879e('0xc7'),_0x879e('0xc8')];var _0x38b00e={'offset':0x0,'order':qs[_0x879e('0x7d')](_0x879e('0xc9'))},_0x4c92e3={'count':0x0,'rows':[]};Promise[_0x879e('0xca')]()[_0x879e('0x18')](function(){if(_0x1b399a[_0x879e('0x2b')]['channel']){if(!_[_0x879e('0xcb')](_0x3ac739,_0x1b399a['query'][_0x879e('0xcc')][_0x879e('0xcd')]())){throw new Error(_0x879e('0xce'));}_0x3ac739=[_0x1b399a[_0x879e('0x2b')][_0x879e('0xcc')][_0x879e('0xcd')]()];}if(_0x1b399a[_0x879e('0x2b')][_0x879e('0xcf')]){try{var _0x4adeca=JSON[_0x879e('0xb6')](_0x1b399a[_0x879e('0x2b')][_0x879e('0xcf')]);if(!moment(_0x4adeca[_0x879e('0x37')])['isValid']()){throw new Error(_0x879e('0xd0'));}if(!moment(_0x4adeca['to'])[_0x879e('0xd1')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0xded164){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x1b399a['query'][_0x879e('0x34')]('nolimit')){_0x38b00e[_0x879e('0x12')]=qs[_0x879e('0x12')](_0x1b399a['query'][_0x879e('0x12')]||0xa);_0x38b00e[_0x879e('0x10')]=qs['offset'](_0x1b399a['query'][_0x879e('0x10')]);}var _0x21c407=_0x3ac739[_0x879e('0x70')](function(_0x4722c4){if(_0x4722c4===_0x879e('0xc8')){var _0x1434ef={'attributes':['id',_0x879e('0xd2'),_0x879e('0x30'),_0x879e('0xd3'),_0x879e('0xd4'),_0x879e('0xd5'),'starttime',_0x879e('0xd6'),'duration',_0x879e('0xd7'),_0x879e('0xd8'),_0x879e('0xd9'),_0x879e('0xda'),_0x879e('0xdb'),_0x879e('0xdc')],'where':{'ContactId':_0x1b399a[_0x879e('0x25')]['id']},'include':[{'model':db[_0x879e('0xb8')],'as':_0x879e('0xb8'),'attributes':['id',_0x879e('0x1c'),'fullname',_0x879e('0x2f')]}],'order':[[_0x879e('0xd8'),'DESC']]};if(_0x1b399a[_0x879e('0x2b')][_0x879e('0xcf')]){_0x1434ef[_0x879e('0x5a')][_0x879e('0xd8')]={'$gte':_0x4adeca[_0x879e('0x37')],'$lte':_0x4adeca['to']};}return db[_0x879e('0x4c')][_0x879e('0xdd')](_0x1434ef)[_0x879e('0x18')](function(_0x464486){_0x4c92e3['count']+=_0x464486['count'];return _['map'](_0x464486['rows'],function(_0x15b588){var _0x3b6304=_0x15b588[_0x879e('0x38')]({'plain':!![]});_0x3b6304[_0x879e('0xcc')]=_0x4722c4;if(_0x3b6304[_0x879e('0xb8')]){_0x3b6304['User']={'id':_0x3b6304[_0x879e('0xb8')]['id'],'name':_0x3b6304['User']['name'],'fullname':_0x3b6304[_0x879e('0xb8')][_0x879e('0xde')],'alias':_0x3b6304[_0x879e('0xb8')]['alias']};}return _0x3b6304;});});}else{var _0x1e4103=_[_0x879e('0xdf')](_0x4722c4)+(_0x4722c4===_0x879e('0xe0')?_0x879e('0xe1'):'Account');var _0x40d41a={'attributes':['id',_0x879e('0xe2'),'closedAt',_0x879e('0xd8'),_0x879e('0xd7'),_0x879e('0xe3'),_0x879e('0xe4'),_0x879e('0xe5'),_0x879e('0xdc'),_0x1e4103+'Id'],'where':{'ContactId':_0x1b399a[_0x879e('0x25')]['id']},'include':[{'model':db[_0x1e4103],'as':_0x879e('0xe6'),'attributes':['id','name','key']},{'model':db[_0x879e('0xb8')],'as':'Owner','attributes':['id',_0x879e('0x1c'),_0x879e('0xde')]},{'model':db['Tag'],'as':_0x879e('0x63'),'attributes':['id',_0x879e('0x1c'),_0x879e('0x64')],'through':{'attributes':[]}}],'order':[['createdAt',_0x879e('0xe7')]]};if(_0x1b399a[_0x879e('0x2b')][_0x879e('0xcf')]){_0x40d41a[_0x879e('0x5a')][_0x879e('0xd8')]={'$gte':_0x4adeca[_0x879e('0x37')],'$lte':_0x4adeca['to']};}switch(_0x4722c4){case _0x879e('0xe0'):_0x40d41a[_0x879e('0x7a')][_0x879e('0x5f')](_0x879e('0xe8'),_0x879e('0xe9'),_0x879e('0xea'),_0x879e('0xeb'),'osName',_0x879e('0xec'),_0x879e('0xed'),_0x879e('0xee'),_0x879e('0xef'));break;case _0x879e('0xc4'):_0x40d41a[_0x879e('0x7a')][_0x879e('0x5f')](_0x879e('0xf0'),_0x879e('0xf1'));break;case _0x879e('0xf2'):_0x40d41a[_0x879e('0x7a')][_0x879e('0x5f')](_0x879e('0xf3'),_0x879e('0xf4'));break;}return db[_[_0x879e('0xdf')](_0x4722c4)+_0x879e('0xf5')][_0x879e('0xdd')](_0x40d41a)['then'](function(_0x5cc2fe){_0x4c92e3[_0x879e('0x13')]+=_0x5cc2fe[_0x879e('0x13')];return _[_0x879e('0x70')](_0x5cc2fe[_0x879e('0x9b')],function(_0x24f6b0){var _0x546244=_0x24f6b0[_0x879e('0x38')]({'plain':!![]});_0x546244[_0x879e('0xcc')]=_0x4722c4;if(_0x546244[_0x879e('0xf6')]){_0x546244[_0x879e('0xf6')]={'id':_0x546244[_0x879e('0xf6')]['id'],'name':_0x546244[_0x879e('0xf6')]['name'],'fullname':_0x546244['Owner'][_0x879e('0xde')]};}return _0x546244;});});}});return Promise[_0x879e('0x61')](_0x21c407);})['then'](function(_0x4255d8){return _(_0x4255d8)['flatten']()[_0x879e('0xf7')](_0x879e('0xd8'))[_0x879e('0xf8')]()[_0x879e('0xf9')]();})[_0x879e('0x18')](function(_0x51120e){_0x4c92e3[_0x879e('0x9b')]=_0x38b00e[_0x879e('0x12')]?_0x51120e[_0x879e('0xfa')](_0x38b00e[_0x879e('0x10')],_0x38b00e[_0x879e('0x10')]+_0x38b00e[_0x879e('0x12')]):_0x51120e;return _0x4c92e3;})[_0x879e('0x18')](respondWithFilteredResult(_0xd2e8d9,_0x38b00e))[_0x879e('0x22')](handleError(_0xd2e8d9,null));}; \ No newline at end of file +var _0xce12=['create','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','bulkCreate','each','duplicates','where','$or','ListId','additionalPhones','push','all','show','find','Tag','Tags','color','tag','CmContactHasItem','Phones','ContactItemType','sequelize','literal','Phones.OrderBy','$and','omit','map','format','cf_%d','pickBy','table','cm_contacts','setFields','id\x20=\x20?','text','values','phone','getTags','findOne','filters','intersection','model','fields','sort','filter','attributes','options','nolimit','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','ItemType','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','fromContactId','CmContactId','toContactId','hopperId','getHoppers','rawAttributes','order','ContactId','include','rows','getHopperHistories','pick','includeAll','getHopperFinals','JscriptySessionReport','binding_keys','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','zipObject','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','file','chmodSync','0777','fork','../../components/import/cm/csv','CompanyId','json','pid','upload','parse','meta','import','User','agent','No\x20ListId\x20specified','binding','No\x20firstName\x20column\x20specified','stringify','message','start\x20child\x20process\x20correctly!','importUpdates','child_process','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','channel','includes','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','source','destination','callerid','starttime','endtime','note','createdAt','userDisposition','userSecondDisposition','VoiceCallReport','findAndCountAll','fullname','startCase','Website','Account','disposition','thirdDisposition','UserId','key','Owner','customerPort','deviceModel','ratingMessage','ratingValue','substatus','externalUrl','threadId','Interaction','sortBy','reverse','value','slice','moment','util','path','lodash','squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','offset','undefined','limit','count','set','Content-Range','update','then','end','sendStatus','error','stack','name','send','index','describe','getOptions','findAll','query','catch','CmContact','params','tags','keys','length','startsWith','cf_','columnName','displayName','analytics','CmCustomField','alias','type','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from','get','mergeWith','isArray','join','CmHopper','destroy','info','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s'];(function(_0x30a6b6,_0x285ac2){var _0x2802a9=function(_0x49a5c0){while(--_0x49a5c0){_0x30a6b6['push'](_0x30a6b6['shift']());}};_0x2802a9(++_0x285ac2);}(_0xce12,0xb9));var _0x2ce1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce12[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x2ce1('0x0'));var BPromise=require('bluebird');var util=require(_0x2ce1('0x1'));var path=require(_0x2ce1('0x2'));var fs=require('fs');var _=require(_0x2ce1('0x3'));var squel=require(_0x2ce1('0x4'));var Papa=require(_0x2ce1('0x5'));var Redis=require(_0x2ce1('0x6'));var contacts=require(_0x2ce1('0x7'));var qs=require(_0x2ce1('0x8'));var logger=require('../../config/logger')('api');var config=require(_0x2ce1('0x9'));var shared=require(_0x2ce1('0xa'));var db=require(_0x2ce1('0xb'))['db'];config[_0x2ce1('0xc')]=_[_0x2ce1('0xd')](config[_0x2ce1('0xc')],{'host':_0x2ce1('0xe'),'port':0x18eb});var socket=require(_0x2ce1('0xf'))(new Redis(config[_0x2ce1('0xc')]));require('./cmContact.socket')[_0x2ce1('0x10')](socket);function respondWithResult(_0x3c1705,_0xe2a563){_0xe2a563=_0xe2a563||0xc8;return function(_0x461a4e){if(_0x461a4e){return _0x3c1705[_0x2ce1('0x11')](_0xe2a563)['json'](_0x461a4e);}};}function respondWithFilteredResult(_0x129cd6,_0x2d7243){return function(_0xd0ad80){if(_0xd0ad80){var _0x150a23=typeof _0x2d7243[_0x2ce1('0x12')]===_0x2ce1('0x13')&&typeof _0x2d7243[_0x2ce1('0x14')]===_0x2ce1('0x13');var _0x2cba44=_0xd0ad80[_0x2ce1('0x15')];var _0x45131b=_0x150a23?0x0:_0x2d7243[_0x2ce1('0x12')];var _0x2383f5=_0x150a23?_0xd0ad80['count']:_0x2d7243['offset']+_0x2d7243['limit'];var _0x2806bb;if(_0x2383f5>=_0x2cba44){_0x2383f5=_0x2cba44;_0x2806bb=0xc8;}else{_0x2806bb=0xce;}_0x129cd6[_0x2ce1('0x11')](_0x2806bb);return _0x129cd6[_0x2ce1('0x16')](_0x2ce1('0x17'),_0x45131b+'-'+_0x2383f5+'/'+_0x2cba44)['json'](_0xd0ad80);}return null;};}function saveUpdates(_0x535dbc){return function(_0x11a733){if(_0x11a733){return _0x11a733[_0x2ce1('0x18')](_0x535dbc)[_0x2ce1('0x19')](function(_0x1efeb6){return _0x1efeb6;});}return null;};}function removeEntity(_0x286f20){return function(_0x2907ec){if(_0x2907ec){return _0x2907ec['destroy']()[_0x2ce1('0x19')](function(){_0x286f20[_0x2ce1('0x11')](0xcc)[_0x2ce1('0x1a')]();});}};}function handleEntityNotFound(_0x5f2d3){return function(_0x369ed1){if(!_0x369ed1){_0x5f2d3[_0x2ce1('0x1b')](0x194);}return _0x369ed1;};}function handleError(_0x350c59,_0x238f98){_0x238f98=_0x238f98||0x1f4;return function(_0x519384){logger[_0x2ce1('0x1c')](_0x519384[_0x2ce1('0x1d')]);if(_0x519384[_0x2ce1('0x1e')]){delete _0x519384[_0x2ce1('0x1e')];}_0x350c59[_0x2ce1('0x11')](_0x238f98)[_0x2ce1('0x1f')](_0x519384);};}exports[_0x2ce1('0x20')]=function(_0x45ca55,_0x47de25){var _0x4b7827={};return contacts[_0x2ce1('0x21')]()[_0x2ce1('0x19')](function(_0x2020e8){_0x4b7827=qs[_0x2ce1('0x22')](_0x2020e8,_0x45ca55);return contacts[_0x2ce1('0x23')](_0x45ca55[_0x2ce1('0x24')],_0x45ca55['user'],_0x4b7827,_0x2020e8);})[_0x2ce1('0x19')](respondWithFilteredResult(_0x47de25,_0x4b7827))[_0x2ce1('0x25')](handleError(_0x47de25,null));};exports['destroy']=function(_0x5a83f0,_0x1edd1f){return db[_0x2ce1('0x26')]['find']({'where':{'id':_0x5a83f0[_0x2ce1('0x27')]['id']}})[_0x2ce1('0x19')](handleEntityNotFound(_0x1edd1f,null))[_0x2ce1('0x19')](removeEntity(_0x1edd1f,null))['catch'](handleError(_0x1edd1f,null));};exports[_0x2ce1('0x21')]=function(_0x310b9d,_0x163028){return db['CmContact'][_0x2ce1('0x21')]()[_0x2ce1('0x19')](function(_0x3a39b3){delete _0x3a39b3[_0x2ce1('0x28')];for(var _0x293012=0x0;_0x2930120x0){return new Promise(function(_0x20233c){var _0x556613=[];for(var _0x108379=0x0;_0x108379<_0x49836a[_0x2ce1('0x2a')];_0x108379++){_0x556613[_0x2ce1('0x61')](insertAdditionalPhones(_0x49836a[_0x108379]['contact'],_0x49836a[_0x108379]['additionalPhones']));}Promise[_0x2ce1('0x62')](_0x556613)['then'](function(){_0x20233c(0x1);});})[_0x2ce1('0x19')](function(){return{'success':_0x19e95c,'failure':_0x42459b,'duplicates':_0x46978e};});}else{return{'success':_0x19e95c,'failure':_0x42459b,'duplicates':_0x46978e};}}})[_0x2ce1('0x19')](respondWithResult(_0x19cee5,0xc9))[_0x2ce1('0x25')](handleError(_0x19cee5,null));};exports[_0x2ce1('0x63')]=function(_0x277aab,_0x3bfbe8){var _0x2fcbe5;return db[_0x2ce1('0x26')][_0x2ce1('0x21')]()[_0x2ce1('0x19')](function(_0x427b15){return db[_0x2ce1('0x26')][_0x2ce1('0x64')]({'where':{'id':_0x277aab[_0x2ce1('0x27')]['id']},'include':[{'model':db[_0x2ce1('0x65')],'as':_0x2ce1('0x66'),'attributes':['id',_0x2ce1('0x1e'),_0x2ce1('0x67')],'required':_0x277aab[_0x2ce1('0x24')][_0x2ce1('0x68')]?!![]:![]},{'model':db[_0x2ce1('0x69')],'as':_0x2ce1('0x6a'),'where':{'CmContactId':_0x277aab[_0x2ce1('0x27')]['id']},'required':![],'include':[{'model':db[_0x2ce1('0x6b')],'as':'ItemType'}]}],'order':[db[_0x2ce1('0x6c')][_0x2ce1('0x6d')](_0x2ce1('0x6e'))],'attributes':_[_0x2ce1('0x29')](_0x427b15)});})[_0x2ce1('0x19')](function(_0x673d41){if(!_['isNil'](_0x673d41)){_0x2fcbe5=_0x673d41[_0x2ce1('0x39')]({'plain':!![]});var _0x5aa4b3={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x673d41&&_0x673d41[_0x2ce1('0x5f')]){if(_0x673d41['ListId']){_0x5aa4b3[_0x2ce1('0x5d')][_0x2ce1('0x6f')][_0x2ce1('0x61')]({'ListId':{'$ne':_0x673d41[_0x2ce1('0x5f')]}});}}return db[_0x2ce1('0x30')][_0x2ce1('0x23')](_0x5aa4b3);}})[_0x2ce1('0x19')](function(_0x50300c){if(!_[_0x2ce1('0x56')](_0x50300c)){return _[_0x2ce1('0x70')](_0x2fcbe5,_[_0x2ce1('0x71')](_0x50300c,function(_0x5c3d5d){return util[_0x2ce1('0x72')](_0x2ce1('0x73'),_0x5c3d5d['id']);}));}})[_0x2ce1('0x19')](handleEntityNotFound(_0x3bfbe8,null))[_0x2ce1('0x19')](respondWithResult(_0x3bfbe8,null))[_0x2ce1('0x25')](handleError(_0x3bfbe8,null));};exports[_0x2ce1('0x18')]=function(_0x196e04,_0x1abbcb){var _0x1688da;if(_0x196e04[_0x2ce1('0x37')]['id']){delete _0x196e04['body']['id'];}if(!_[_0x2ce1('0x56')](_0x196e04[_0x2ce1('0x37')][_0x2ce1('0x57')])){var _0x2590f8=_0x196e04[_0x2ce1('0x37')][_0x2ce1('0x57')];if(!_[_0x2ce1('0x56')](shared['timezones'][_0x2590f8]))_0x196e04['body'][_0x2ce1('0x59')]=shared[_0x2ce1('0x58')][_0x2590f8][_0x2ce1('0x59')];}return db['CmContact']['find']({'where':{'id':_0x196e04[_0x2ce1('0x27')]['id']}})[_0x2ce1('0x19')](handleEntityNotFound(_0x1abbcb,null))[_0x2ce1('0x19')](saveUpdates(_0x196e04[_0x2ce1('0x37')],null))[_0x2ce1('0x19')](function(_0x5be5ca){_0x1688da=_0x5be5ca;var _0x6ecb0e={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5be5ca&&_0x5be5ca['ListId']){if(_0x5be5ca[_0x2ce1('0x5f')]){_0x6ecb0e[_0x2ce1('0x5d')][_0x2ce1('0x6f')][_0x2ce1('0x61')]({'ListId':{'$ne':_0x5be5ca[_0x2ce1('0x5f')]}});}}return db['CmCustomField'][_0x2ce1('0x23')](_0x6ecb0e);})[_0x2ce1('0x19')](function(_0x1b6ad3){if(_0x1b6ad3){return _[_0x2ce1('0x70')](_[_0x2ce1('0x74')](_0x196e04[_0x2ce1('0x37')],function(_0x470ac0,_0x170cc2){return _[_0x2ce1('0x2b')](_0x170cc2,'cf_');}),_[_0x2ce1('0x71')](_0x1b6ad3,function(_0x3a46df){return util[_0x2ce1('0x72')](_0x2ce1('0x73'),_0x3a46df['id']);}));}})['then'](function(_0x5f3687){if(_0x5f3687&&!_['isEmpty'](_0x5f3687)){var _0x1c889b=squel[_0x2ce1('0x18')]()[_0x2ce1('0x75')](_0x2ce1('0x76'))[_0x2ce1('0x77')](_0x5f3687)[_0x2ce1('0x5d')](_0x2ce1('0x78'),_0x196e04[_0x2ce1('0x27')]['id'])['toParam']();return db[_0x2ce1('0x6c')]['query'](_0x1c889b[_0x2ce1('0x79')],{'replacements':_0x1c889b[_0x2ce1('0x7a')]});}})[_0x2ce1('0x19')](function(){if(_0x196e04[_0x2ce1('0x37')][_0x2ce1('0x7b')]&&_0x1688da){return db[_0x2ce1('0x3d')][_0x2ce1('0x18')]({'phone':_0x196e04[_0x2ce1('0x37')][_0x2ce1('0x7b')],'OrderBy':0x0},{'where':{'ContactId':_0x1688da['id']}});}})[_0x2ce1('0x19')](function(){return _0x1688da;})['then'](respondWithResult(_0x1abbcb,null))['catch'](handleError(_0x1abbcb,null));};exports[_0x2ce1('0x7c')]=function(_0x584ba4,_0x248036){var _0x5199b9={};var _0x1746d3={};var _0x560809;var _0x43521c;return db['CmContact'][_0x2ce1('0x7d')]({'where':{'id':_0x584ba4[_0x2ce1('0x27')]['id']}})[_0x2ce1('0x19')](handleEntityNotFound(_0x248036,null))[_0x2ce1('0x19')](function(_0x1f838e){if(_0x1f838e){_0x560809=_0x1f838e;_0x1746d3['model']=_['keys'](db['Tag']['rawAttributes']);_0x1746d3[_0x2ce1('0x24')]=_[_0x2ce1('0x29')](_0x584ba4[_0x2ce1('0x24')]);_0x1746d3[_0x2ce1('0x7e')]=_[_0x2ce1('0x7f')](_0x1746d3[_0x2ce1('0x80')],_0x1746d3[_0x2ce1('0x24')]);_0x5199b9['attributes']=_[_0x2ce1('0x7f')](_0x1746d3[_0x2ce1('0x80')],qs[_0x2ce1('0x81')](_0x584ba4[_0x2ce1('0x24')][_0x2ce1('0x81')]));_0x5199b9['attributes']=_0x5199b9['attributes'][_0x2ce1('0x2a')]?_0x5199b9['attributes']:_0x1746d3['model'];_0x5199b9['order']=qs[_0x2ce1('0x82')](_0x584ba4[_0x2ce1('0x24')][_0x2ce1('0x82')]);_0x5199b9[_0x2ce1('0x5d')]=qs[_0x2ce1('0x7e')](_['pick'](_0x584ba4[_0x2ce1('0x24')],_0x1746d3['filters']));if(_0x584ba4[_0x2ce1('0x24')][_0x2ce1('0x83')]){_0x5199b9[_0x2ce1('0x5d')]=_['merge'](_0x5199b9['where'],{'$or':_[_0x2ce1('0x71')](_0x5199b9[_0x2ce1('0x84')],function(_0x439649){var _0x4c25c9={};_0x4c25c9[_0x439649]={'$like':'%'+_0x584ba4[_0x2ce1('0x24')][_0x2ce1('0x83')]+'%'};return _0x4c25c9;})});}_0x5199b9=_[_0x2ce1('0x36')]({},_0x5199b9,_0x584ba4[_0x2ce1('0x85')]);return _0x560809[_0x2ce1('0x7c')](_0x5199b9);}})[_0x2ce1('0x19')](function(_0xf04c1e){if(_0xf04c1e){_0x43521c=_0xf04c1e['length'];if(!_0x584ba4[_0x2ce1('0x24')]['hasOwnProperty'](_0x2ce1('0x86'))){_0x5199b9[_0x2ce1('0x14')]=qs[_0x2ce1('0x14')](_0x584ba4['query'][_0x2ce1('0x14')]);_0x5199b9[_0x2ce1('0x12')]=qs[_0x2ce1('0x12')](_0x584ba4[_0x2ce1('0x24')][_0x2ce1('0x12')]);}return _0x560809[_0x2ce1('0x7c')](_0x5199b9);}})[_0x2ce1('0x19')](function(_0x32a323){if(_0x32a323){return _0x32a323?{'count':_0x43521c,'rows':_0x32a323}:null;}})[_0x2ce1('0x19')](respondWithResult(_0x248036,null))[_0x2ce1('0x25')](handleError(_0x248036,null));};exports[_0x2ce1('0x87')]=function(_0x48ecd1,_0x5a54d8){if(_0x48ecd1[_0x2ce1('0x37')]['id']){delete _0x48ecd1[_0x2ce1('0x37')]['id'];}return db[_0x2ce1('0x26')][_0x2ce1('0x7d')]({'where':{'id':_0x48ecd1[_0x2ce1('0x27')]['id']}})[_0x2ce1('0x19')](handleEntityNotFound(_0x5a54d8,null))[_0x2ce1('0x19')](function(_0x1e0732){if(_0x1e0732){return _0x1e0732[_0x2ce1('0x87')](_0x48ecd1[_0x2ce1('0x37')][_0x2ce1('0x88')]||[]);}return null;})[_0x2ce1('0x19')](respondWithResult(_0x5a54d8,null))[_0x2ce1('0x25')](handleError(_0x5a54d8,null));};exports[_0x2ce1('0x89')]=function(_0x2265f2,_0x22505b){var _0x4e5e27=[];_0x4e5e27[_0x2ce1('0x61')](addAdditionalPhones(_0x2265f2[_0x2ce1('0x37')]));Promise[_0x2ce1('0x62')](_0x4e5e27)[_0x2ce1('0x19')](function(){_0x4e5e27=[];_0x4e5e27[_0x2ce1('0x61')](deleteCmHopperPhones(_0x2265f2[_0x2ce1('0x37')]['id']));_0x4e5e27[_0x2ce1('0x61')](addCmHopperPhones(_0x2265f2[_0x2ce1('0x37')]['id']));Promise['all'](_0x4e5e27)[_0x2ce1('0x19')](function(){return[0x1];})['then'](respondWithResult(_0x22505b,null));});};function addAdditionalPhones(_0x45cae4){var _0x315706;return new Promise(function(_0x22e0cd){return db['CmContactHasItem']['destroy']({'where':{'CmContactId':_0x45cae4['id']}})['then'](function(){db[_0x2ce1('0x6b')]['findAll']({'raw':!![],'attributes':['id',_0x2ce1('0x8a')]})['then'](function(_0x1e2cd4){var _0x2f4f24=[];for(var _0x335b51=0x0;_0x335b51<_0x45cae4[_0x2ce1('0x8b')][_0x2ce1('0x2a')];_0x335b51++){var _0x3f62cc=_0x45cae4[_0x2ce1('0x8c')]?_[_0x2ce1('0x56')](_0x45cae4[_0x2ce1('0x8c')][_0x335b51])?'':_0x45cae4[_0x2ce1('0x8c')][_0x335b51]:_0x45cae4[_0x2ce1('0x8b')][_0x335b51][_0x2ce1('0x8d')]?_0x45cae4['items'][_0x335b51][_0x2ce1('0x8d')]:'';var _0x3fe29b=_[_0x2ce1('0x56')](_0x45cae4[_0x2ce1('0x8b')][_0x335b51][_0x2ce1('0x8e')])?'':_0x45cae4[_0x2ce1('0x8b')][_0x335b51][_0x2ce1('0x8e')];var _0x262414=_0x3f62cc+':'+_0x45cae4[_0x2ce1('0x8b')][_0x335b51]['phone']+'§'+_0x3fe29b;if(_[_0x2ce1('0x56')](_0x315706))_0x315706=_0x262414;else _0x315706+=';'+_0x262414;var _0x5ddc15=null;var _0x5115c0=null;if(_0x45cae4[_0x2ce1('0x8c')]){if(!_[_0x2ce1('0x56')](_0x45cae4[_0x2ce1('0x8c')][_0x335b51])){_0x5115c0=_[_0x2ce1('0x64')](_0x1e2cd4,function(_0x4f9325){return _0x4f9325['id']===_0x45cae4[_0x2ce1('0x8c')][_0x335b51];});if(!_[_0x2ce1('0x56')](_0x5115c0)){_0x5ddc15=_0x5115c0[_0x2ce1('0x8a')];}}}else{if(!_[_0x2ce1('0x56')](_0x45cae4['items'][_0x335b51])){_0x5115c0=_[_0x2ce1('0x64')](_0x1e2cd4,function(_0x56528f){return _0x56528f['id']===_0x45cae4[_0x2ce1('0x8b')][_0x335b51]['ItemTypeId'];});if(!_['isNil'](_0x5115c0)){_0x5ddc15=_0x335b51;}}}if(_[_0x2ce1('0x56')](_0x5ddc15)){_0x5ddc15=0x64;}_0x2f4f24[_0x2ce1('0x61')](addAdditionalPhone(_0x45cae4['id'],_0x45cae4[_0x2ce1('0x8b')][_0x335b51][_0x2ce1('0x7b')],_0x45cae4[_0x2ce1('0x8c')]?_[_0x2ce1('0x56')](_0x45cae4['item_types'][_0x335b51])?null:_0x45cae4[_0x2ce1('0x8c')][_0x335b51]:_0x45cae4[_0x2ce1('0x8b')][_0x335b51][_0x2ce1('0x8d')]?_0x45cae4[_0x2ce1('0x8b')][_0x335b51][_0x2ce1('0x8d')]:null,_0x5ddc15,_0x3fe29b));}Promise['all'](_0x2f4f24)[_0x2ce1('0x19')](function(){db[_0x2ce1('0x26')][_0x2ce1('0x18')]({'AdditionalPhones':_0x315706},{'where':{'id':_0x45cae4['id']}})[_0x2ce1('0x19')](function(){_0x22e0cd(0x1);});});});});});}function addAdditionalPhone(_0x368516,_0xea341a,_0x4acff0,_0x20e000,_0x443b93){return db[_0x2ce1('0x69')][_0x2ce1('0x64')]({'where':{'CmContactId':_0x368516,'item':_0xea341a}})[_0x2ce1('0x19')](function(_0x5ca148){if(_0x5ca148)logger[_0x2ce1('0x3f')](_0x2ce1('0x8f'),_0x5ca148);else{db['CmContactHasItem'][_0x2ce1('0x42')]({'CmContactId':_0x368516,'item':_0xea341a,'ItemTypeId':_0x4acff0,'OrderBy':_0x20e000,'ItemClass':_0x2ce1('0x90'),'description':_0x443b93});}});}function deleteCmHopperPhones(_0x562c09){return new Promise(function(_0x1e9ae6){return db[_0x2ce1('0x3d')][_0x2ce1('0x23')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x562c09}})[_0x2ce1('0x19')](function(_0x2db471){db[_0x2ce1('0x91')][_0x2ce1('0x3e')]({'where':{'CmHopperId':{'$in':_[_0x2ce1('0x71')](_0x2db471,'id')}}});})['then'](function(){_0x1e9ae6(0x1);});});}function addCmHopperPhones(_0x1b9f55){return new Promise(function(_0x4d967c){return db[_0x2ce1('0x3d')][_0x2ce1('0x23')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1b9f55}})[_0x2ce1('0x19')](function(_0x542b3a){var _0x23d986=[];_[_0x2ce1('0x71')](_0x542b3a,function(_0x1c4e6d){_0x23d986[_0x2ce1('0x61')](createCmHopperPhone(_0x1b9f55,_0x1c4e6d['id']));});Promise[_0x2ce1('0x62')](_0x23d986)['then'](function(){_0x4d967c(0x1);});});});}function createCmHopperPhone(_0x2da176,_0x57e768){return new Promise(function(_0x5b0f0b){db[_0x2ce1('0x69')][_0x2ce1('0x23')]({'raw':!![],'attributes':[_0x2ce1('0x92'),'OrderBy'],'where':{'CmContactId':_0x2da176,'ItemClass':'PHONE'},'include':[{'model':db[_0x2ce1('0x6b')],'attributes':[_0x2ce1('0x8a')],'as':_0x2ce1('0x93')}],'order':['OrderBy',db[_0x2ce1('0x6c')][_0x2ce1('0x6d')](_0x2ce1('0x94'))]})[_0x2ce1('0x19')](function(_0x1a37fa){var _0x185481=0x1;var _0x3c19a4=_['map'](_0x1a37fa,function(_0x38e79a){_0x38e79a[_0x2ce1('0x95')]=_0x57e768;_0x38e79a[_0x2ce1('0x7b')]=_0x38e79a['item'];_0x38e79a[_0x2ce1('0x8a')]=_0x185481;delete _0x38e79a[_0x2ce1('0x96')];_0x185481=_0x185481+0x1;return _0x38e79a;});return db['CmHopperAdditionalPhone'][_0x2ce1('0x5a')](_0x3c19a4,{});})[_0x2ce1('0x19')](function(){_0x5b0f0b(0x1);});});}function insertAdditionalPhones(_0xfbd3bf,_0x23efa4){return new Promise(function(_0x20da43){var _0x4064c5=[];for(var _0x4b6665=0x0;_0x4b6665<_0x23efa4['length'];_0x4b6665++){var _0x387ad7=_0x23efa4[_0x4b6665];_0x4064c5[_0x2ce1('0x61')](parseContactItemType(_0x387ad7));}Promise[_0x2ce1('0x62')](_0x4064c5)[_0x2ce1('0x19')](function(){var _0x553d46={'id':_0xfbd3bf['id'],'items':_0x23efa4};return addAdditionalPhones(_0x553d46)[_0x2ce1('0x19')](function(){return addCmHopperPhones(_0xfbd3bf['id']);});})['then'](function(){_0x20da43(_0xfbd3bf);});});}function parseContactItemType(_0x74538f){return new Promise(function(_0x13d264){if(_0x74538f[_0x2ce1('0x35')](_0x2ce1('0x8d'))){_0x13d264(_0x74538f);}else{return db['ContactItemType'][_0x2ce1('0x64')]({'where':{'name':_0x74538f[_0x2ce1('0x93')]}})[_0x2ce1('0x19')](function(_0x3fed62){if(_['isNil'](_0x3fed62))_0x74538f[_0x2ce1('0x8d')]=null;else _0x74538f[_0x2ce1('0x8d')]=_0x3fed62['id'];_0x13d264(_0x74538f);});}});}exports[_0x2ce1('0x97')]=function(_0x286fc4,_0x5821e9){return db[_0x2ce1('0x69')]['findAll']({'raw':!![],'where':{'CmContactId':_0x286fc4[_0x2ce1('0x27')]['id'],'ItemClass':_0x2ce1('0x90')},'include':[{'model':db['ContactItemType'],'as':_0x2ce1('0x93')}],'order':[['OrderBy'],[db['sequelize'][_0x2ce1('0x6d')](_0x2ce1('0x94'))]]})['then'](function(_0x12a507){return _0x12a507;})[_0x2ce1('0x19')](respondWithResult(_0x5821e9,null))[_0x2ce1('0x25')](handleError(_0x5821e9,null));};exports['duplicateAdditionalPhones']=function(_0x3aed66,_0x8b3caa){return db[_0x2ce1('0x69')][_0x2ce1('0x23')]({'raw':!![],'where':{'CmContactId':_0x3aed66[_0x2ce1('0x37')][_0x2ce1('0x98')]}})['then'](function(_0x410e68){var _0x33db22=_['map'](_0x410e68,function(_0x1ee31d){_0x1ee31d[_0x2ce1('0x99')]=_0x3aed66['body']['toContactId'];return _0x1ee31d;});return db['CmContactHasItem'][_0x2ce1('0x5a')](_0x33db22,{});})['then'](function(){return addCmHopperPhones(_0x3aed66[_0x2ce1('0x37')][_0x2ce1('0x9a')]);})[_0x2ce1('0x19')](function(){return['ok'];})[_0x2ce1('0x19')](respondWithResult(_0x8b3caa,null))[_0x2ce1('0x25')](handleError(_0x8b3caa,null));};exports['rescheduleAdditionalPhones']=function(_0x2e31e0,_0x2dfb9f){var _0x1460ea=[];_0x1460ea['push'](createCmHopperPhone(_0x2e31e0[_0x2ce1('0x37')]['id'],_0x2e31e0['body'][_0x2ce1('0x9b')]));Promise['all'](_0x1460ea)[_0x2ce1('0x19')](function(){return[0x1];})[_0x2ce1('0x19')](respondWithResult(_0x2dfb9f,null));};exports[_0x2ce1('0x9c')]=function(_0x1be73a,_0x270df8){var _0x3bca90={'raw':![],'where':{}};var _0x564ee7={};var _0x5df3d4={'count':0x0,'rows':[]};return db[_0x2ce1('0x26')]['findOne']({'where':{'id':_0x1be73a[_0x2ce1('0x27')]['id']}})[_0x2ce1('0x19')](handleEntityNotFound(_0x270df8,null))['then'](function(_0x4a0a4c){if(_0x4a0a4c){_0x564ee7[_0x2ce1('0x80')]=_[_0x2ce1('0x29')](db[_0x2ce1('0x3d')][_0x2ce1('0x9d')]);_0x564ee7['query']=_[_0x2ce1('0x29')](_0x1be73a[_0x2ce1('0x24')]);_0x564ee7[_0x2ce1('0x7e')]=_['intersection'](_0x564ee7[_0x2ce1('0x80')],_0x564ee7[_0x2ce1('0x24')]);_0x3bca90[_0x2ce1('0x84')]=_[_0x2ce1('0x7f')](_0x564ee7['model'],qs[_0x2ce1('0x81')](_0x1be73a[_0x2ce1('0x24')][_0x2ce1('0x81')]));_0x3bca90[_0x2ce1('0x84')]=_0x3bca90['attributes']['length']?_0x3bca90[_0x2ce1('0x84')]:_0x564ee7[_0x2ce1('0x80')];if(!_0x1be73a[_0x2ce1('0x24')][_0x2ce1('0x35')]('nolimit')){_0x3bca90[_0x2ce1('0x14')]=qs[_0x2ce1('0x14')](_0x1be73a[_0x2ce1('0x24')][_0x2ce1('0x14')]);_0x3bca90['offset']=qs[_0x2ce1('0x12')](_0x1be73a['query'][_0x2ce1('0x12')]);}_0x3bca90[_0x2ce1('0x9e')]=qs[_0x2ce1('0x82')](_0x1be73a[_0x2ce1('0x24')][_0x2ce1('0x82')]);_0x3bca90['where']=qs[_0x2ce1('0x7e')](_['pick'](_0x1be73a[_0x2ce1('0x24')],_0x564ee7['filters']));_0x3bca90[_0x2ce1('0x5d')][_0x2ce1('0x9f')]=_0x4a0a4c['id'];if(_0x1be73a[_0x2ce1('0x24')][_0x2ce1('0x83')]){_0x3bca90['where']=_[_0x2ce1('0x36')](_0x3bca90['where'],{'$or':_[_0x2ce1('0x71')](_0x3bca90[_0x2ce1('0x84')],function(_0x5b150b){var _0x4b2986={};_0x4b2986[_0x5b150b]={'$like':'%'+_0x1be73a['query']['filter']+'%'};return _0x4b2986;})});}_0x3bca90=_[_0x2ce1('0x36')]({},_0x3bca90,_0x1be73a['options']);return db[_0x2ce1('0x3d')]['count']({'where':_0x3bca90[_0x2ce1('0x5d')]})[_0x2ce1('0x19')](function(_0x22fb63){_0x5df3d4[_0x2ce1('0x15')]=_0x22fb63;if(_0x1be73a[_0x2ce1('0x24')]['includeAll']){_0x3bca90[_0x2ce1('0xa0')]=[{'all':!![]}];}return db[_0x2ce1('0x3d')][_0x2ce1('0x23')](_0x3bca90);})['then'](function(_0x393d86){_0x5df3d4[_0x2ce1('0xa1')]=_0x393d86;return _0x5df3d4;});}})['then'](respondWithFilteredResult(_0x270df8,_0x3bca90))[_0x2ce1('0x25')](handleError(_0x270df8,null));};exports[_0x2ce1('0xa2')]=function(_0x561ccb,_0x441e2e){var _0x38ca77={'raw':!![],'where':{}};var _0x264705={};var _0x5259e1={'count':0x0,'rows':[]};return db[_0x2ce1('0x26')][_0x2ce1('0x7d')]({'where':{'id':_0x561ccb[_0x2ce1('0x27')]['id']}})['then'](handleEntityNotFound(_0x441e2e,null))[_0x2ce1('0x19')](function(_0x14107e){if(_0x14107e){_0x264705[_0x2ce1('0x80')]=_[_0x2ce1('0x29')](db[_0x2ce1('0x4d')]['rawAttributes']);_0x264705[_0x2ce1('0x24')]=_[_0x2ce1('0x29')](_0x561ccb[_0x2ce1('0x24')]);_0x264705['filters']=_[_0x2ce1('0x7f')](_0x264705[_0x2ce1('0x80')],_0x264705[_0x2ce1('0x24')]);_0x38ca77[_0x2ce1('0x84')]=_[_0x2ce1('0x7f')](_0x264705[_0x2ce1('0x80')],qs['fields'](_0x561ccb['query'][_0x2ce1('0x81')]));_0x38ca77[_0x2ce1('0x84')]=_0x38ca77[_0x2ce1('0x84')]['length']?_0x38ca77['attributes']:_0x264705[_0x2ce1('0x80')];if(!_0x561ccb[_0x2ce1('0x24')][_0x2ce1('0x35')](_0x2ce1('0x86'))){_0x38ca77[_0x2ce1('0x14')]=qs[_0x2ce1('0x14')](_0x561ccb['query']['limit']);_0x38ca77[_0x2ce1('0x12')]=qs['offset'](_0x561ccb[_0x2ce1('0x24')][_0x2ce1('0x12')]);}_0x38ca77[_0x2ce1('0x9e')]=qs['sort'](_0x561ccb[_0x2ce1('0x24')]['sort']);_0x38ca77[_0x2ce1('0x5d')]=qs['filters'](_[_0x2ce1('0xa3')](_0x561ccb[_0x2ce1('0x24')],_0x264705[_0x2ce1('0x7e')]));_0x38ca77[_0x2ce1('0x5d')][_0x2ce1('0x9f')]=_0x14107e['id'];if(_0x561ccb[_0x2ce1('0x24')][_0x2ce1('0x83')]){_0x38ca77[_0x2ce1('0x5d')]=_['merge'](_0x38ca77[_0x2ce1('0x5d')],{'$or':_[_0x2ce1('0x71')](_0x38ca77['attributes'],function(_0xe2f9da){var _0x3fd3be={};_0x3fd3be[_0xe2f9da]={'$like':'%'+_0x561ccb[_0x2ce1('0x24')][_0x2ce1('0x83')]+'%'};return _0x3fd3be;})});}_0x38ca77=_[_0x2ce1('0x36')]({},_0x38ca77,_0x561ccb['options']);return db['CmHopperHistory']['count']({'where':_0x38ca77[_0x2ce1('0x5d')]})[_0x2ce1('0x19')](function(_0x4c6416){_0x5259e1[_0x2ce1('0x15')]=_0x4c6416;if(_0x561ccb[_0x2ce1('0x24')][_0x2ce1('0xa4')]){_0x38ca77[_0x2ce1('0xa0')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x2ce1('0x23')](_0x38ca77);})['then'](function(_0x4db9d9){_0x5259e1[_0x2ce1('0xa1')]=_0x4db9d9;return _0x5259e1;});}})[_0x2ce1('0x19')](respondWithFilteredResult(_0x441e2e,_0x38ca77))[_0x2ce1('0x25')](handleError(_0x441e2e,null));};exports[_0x2ce1('0xa5')]=function(_0x1d3d13,_0x359abc){var _0x4d286d={'raw':!![],'where':{}};var _0x2a034e={};var _0x406284={'count':0x0,'rows':[]};return db[_0x2ce1('0x26')][_0x2ce1('0x7d')]({'where':{'id':_0x1d3d13[_0x2ce1('0x27')]['id']}})[_0x2ce1('0x19')](handleEntityNotFound(_0x359abc,null))['then'](function(_0xcbeb9b){if(_0xcbeb9b){_0x2a034e[_0x2ce1('0x80')]=_[_0x2ce1('0x29')](db[_0x2ce1('0x4c')][_0x2ce1('0x9d')]);_0x2a034e['query']=_[_0x2ce1('0x29')](_0x1d3d13[_0x2ce1('0x24')]);_0x2a034e[_0x2ce1('0x7e')]=_[_0x2ce1('0x7f')](_0x2a034e[_0x2ce1('0x80')],_0x2a034e[_0x2ce1('0x24')]);_0x4d286d[_0x2ce1('0x84')]=_[_0x2ce1('0x7f')](_0x2a034e['model'],qs[_0x2ce1('0x81')](_0x1d3d13[_0x2ce1('0x24')][_0x2ce1('0x81')]));_0x4d286d[_0x2ce1('0x84')]=_0x4d286d[_0x2ce1('0x84')][_0x2ce1('0x2a')]?_0x4d286d[_0x2ce1('0x84')]:_0x2a034e['model'];if(!_0x1d3d13[_0x2ce1('0x24')][_0x2ce1('0x35')](_0x2ce1('0x86'))){_0x4d286d[_0x2ce1('0x14')]=qs['limit'](_0x1d3d13['query'][_0x2ce1('0x14')]);_0x4d286d[_0x2ce1('0x12')]=qs[_0x2ce1('0x12')](_0x1d3d13[_0x2ce1('0x24')][_0x2ce1('0x12')]);}_0x4d286d[_0x2ce1('0x9e')]=qs['sort'](_0x1d3d13[_0x2ce1('0x24')][_0x2ce1('0x82')]);_0x4d286d[_0x2ce1('0x5d')]=qs[_0x2ce1('0x7e')](_[_0x2ce1('0xa3')](_0x1d3d13[_0x2ce1('0x24')],_0x2a034e[_0x2ce1('0x7e')]));_0x4d286d['where'][_0x2ce1('0x9f')]=_0xcbeb9b['id'];if(_0x1d3d13[_0x2ce1('0x24')][_0x2ce1('0x83')]){_0x4d286d[_0x2ce1('0x5d')]=_[_0x2ce1('0x36')](_0x4d286d[_0x2ce1('0x5d')],{'$or':_[_0x2ce1('0x71')](_0x4d286d[_0x2ce1('0x84')],function(_0x52c94a){var _0x1c4e86={};_0x1c4e86[_0x52c94a]={'$like':'%'+_0x1d3d13[_0x2ce1('0x24')][_0x2ce1('0x83')]+'%'};return _0x1c4e86;})});}_0x4d286d=_[_0x2ce1('0x36')]({},_0x4d286d,_0x1d3d13[_0x2ce1('0x85')]);return db[_0x2ce1('0x4c')][_0x2ce1('0x15')]({'where':_0x4d286d[_0x2ce1('0x5d')]})[_0x2ce1('0x19')](function(_0x639903){_0x406284[_0x2ce1('0x15')]=_0x639903;if(_0x1d3d13[_0x2ce1('0x24')][_0x2ce1('0xa4')]){_0x4d286d[_0x2ce1('0xa0')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x2ce1('0x23')](_0x4d286d);})[_0x2ce1('0x19')](function(_0x176aec){_0x406284[_0x2ce1('0xa1')]=_0x176aec;return _0x406284;});}})[_0x2ce1('0x19')](respondWithFilteredResult(_0x359abc,_0x4d286d))[_0x2ce1('0x25')](handleError(_0x359abc,null));};exports['getJscriptySessions']=function(_0x3a4d0f,_0x47f79a){var _0xe6d1e3={'raw':!![],'where':{}};var _0x5753b8={};var _0x274768={'count':0x0,'rows':[]};return db[_0x2ce1('0x26')][_0x2ce1('0x7d')]({'where':{'id':_0x3a4d0f['params']['id']}})[_0x2ce1('0x19')](handleEntityNotFound(_0x47f79a,null))['then'](function(_0x1afb12){if(_0x1afb12){_0x5753b8['model']=_[_0x2ce1('0x29')](db['JscriptySessionReport'][_0x2ce1('0x9d')]);_0x5753b8[_0x2ce1('0x24')]=_['keys'](_0x3a4d0f[_0x2ce1('0x24')]);_0x5753b8['filters']=_[_0x2ce1('0x7f')](_0x5753b8[_0x2ce1('0x80')],_0x5753b8['query']);_0xe6d1e3['attributes']=_['intersection'](_0x5753b8[_0x2ce1('0x80')],qs[_0x2ce1('0x81')](_0x3a4d0f[_0x2ce1('0x24')][_0x2ce1('0x81')]));_0xe6d1e3[_0x2ce1('0x84')]=_0xe6d1e3[_0x2ce1('0x84')][_0x2ce1('0x2a')]?_0xe6d1e3[_0x2ce1('0x84')]:_0x5753b8['model'];if(!_0x3a4d0f[_0x2ce1('0x24')][_0x2ce1('0x35')](_0x2ce1('0x86'))){_0xe6d1e3[_0x2ce1('0x14')]=qs['limit'](_0x3a4d0f[_0x2ce1('0x24')][_0x2ce1('0x14')]);_0xe6d1e3['offset']=qs[_0x2ce1('0x12')](_0x3a4d0f['query'][_0x2ce1('0x12')]);}_0xe6d1e3[_0x2ce1('0x9e')]=qs[_0x2ce1('0x82')](_0x3a4d0f['query'][_0x2ce1('0x82')]);_0xe6d1e3[_0x2ce1('0x5d')]=qs[_0x2ce1('0x7e')](_[_0x2ce1('0xa3')](_0x3a4d0f[_0x2ce1('0x24')],_0x5753b8[_0x2ce1('0x7e')]));_0xe6d1e3[_0x2ce1('0x5d')][_0x2ce1('0x9f')]=_0x1afb12['id'];if(_0x3a4d0f[_0x2ce1('0x24')]['filter']){_0xe6d1e3[_0x2ce1('0x5d')]=_[_0x2ce1('0x36')](_0xe6d1e3[_0x2ce1('0x5d')],{'$or':_[_0x2ce1('0x71')](_0xe6d1e3['attributes'],function(_0x4bd068){var _0x2a6d23={};_0x2a6d23[_0x4bd068]={'$like':'%'+_0x3a4d0f['query']['filter']+'%'};return _0x2a6d23;})});}_0xe6d1e3=_[_0x2ce1('0x36')]({},_0xe6d1e3,_0x3a4d0f['options']);return db[_0x2ce1('0xa6')][_0x2ce1('0x15')]({'where':_0xe6d1e3['where']})[_0x2ce1('0x19')](function(_0x521f6d){_0x274768[_0x2ce1('0x15')]=_0x521f6d;if(_0x3a4d0f[_0x2ce1('0x24')][_0x2ce1('0xa4')]){_0xe6d1e3[_0x2ce1('0xa0')]=[{'all':!![]}];}return db[_0x2ce1('0xa6')][_0x2ce1('0x23')](_0xe6d1e3);})[_0x2ce1('0x19')](function(_0x18a880){_0x274768[_0x2ce1('0xa1')]=_0x18a880;return _0x274768;});}})[_0x2ce1('0x19')](respondWithFilteredResult(_0x47f79a,_0xe6d1e3))[_0x2ce1('0x25')](handleError(_0x47f79a,null));};exports['uploadCsv']=function(_0x47f257,_0x4e3086){try{if(!_0x47f257['body'][_0x2ce1('0x5f')]){throw new Error('No\x20ListId\x20specified');}if(!_0x47f257[_0x2ce1('0x37')][_0x2ce1('0xa7')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x47f257[_0x2ce1('0x37')][_0x2ce1('0xa8')]){throw new Error(_0x2ce1('0xa9'));}if(!_0x47f257['body'][_0x2ce1('0xaa')]){throw new Error(_0x2ce1('0xab'));}var _0x195c68=_0x47f257['body'][_0x2ce1('0xa7')][_0x2ce1('0xac')](',');var _0x53629d=_0x47f257[_0x2ce1('0x37')][_0x2ce1('0xa8')][_0x2ce1('0xac')](',');if(!_0x195c68[_0x2ce1('0x2a')]||!_0x53629d['length']||_0x195c68['length']!==_0x53629d[_0x2ce1('0x2a')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x47f257[_0x2ce1('0x37')][_0x2ce1('0x81')]=_[_0x2ce1('0xad')](_0x195c68,_0x53629d);if(!_0x47f257[_0x2ce1('0x37')][_0x2ce1('0x81')]['phone']){throw new Error(_0x2ce1('0xae'));}if(!_0x47f257['body'][_0x2ce1('0x81')][_0x2ce1('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x5de18d=path[_0x2ce1('0x3c')](config[_0x2ce1('0xb0')],_0x2ce1('0xb1'),_0x47f257[_0x2ce1('0xb2')]['filename']);fs[_0x2ce1('0xb3')](_0x5de18d,parseInt(_0x2ce1('0xb4'),0x8));var _0x737272=require('child_process')[_0x2ce1('0xb5')](path[_0x2ce1('0x3c')](__dirname,_0x2ce1('0xb6')),[_0x5de18d,_0x47f257[_0x2ce1('0x37')][_0x2ce1('0xa7')],_0x47f257[_0x2ce1('0x37')][_0x2ce1('0xa8')],_0x47f257[_0x2ce1('0x37')][_0x2ce1('0x5f')],_0x47f257[_0x2ce1('0x37')][_0x2ce1('0xb7')],_0x47f257['body'][_0x2ce1('0x5c')],_0x47f257[_0x2ce1('0x37')][_0x2ce1('0xaa')]]);return _0x4e3086[_0x2ce1('0x11')](0xc8)[_0x2ce1('0xb8')]({'message':'File\x20uploaded\x20correctly!','pid':_0x737272[_0x2ce1('0xb9')]});}catch(_0x5e5c72){return _0x4e3086['status'](0x1f4)[_0x2ce1('0x1f')](_0x5e5c72);}};exports[_0x2ce1('0xba')]=function(_0x1b19bd,_0x2cd20d){var _0x32f5ef=fs['createReadStream'](_0x1b19bd[_0x2ce1('0xb2')]['path']);Papa[_0x2ce1('0xbb')](_0x32f5ef,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5871ab){return _0x2cd20d[_0x2ce1('0x11')](0xc8)['json']({'file':_0x1b19bd[_0x2ce1('0xb2')],'fields':_0x5871ab[_0x2ce1('0xbc')][_0x2ce1('0x81')]});}});};exports[_0x2ce1('0xbd')]=function(_0x45076c,_0x45424a){return db[_0x2ce1('0xbe')][_0x2ce1('0x23')]({'raw':!![],'attributes':['id'],'where':{'role':_0x2ce1('0xbf')}})[_0x2ce1('0x19')](function(_0x272458){var _0x2ab4d8=![];if(!_0x45076c[_0x2ce1('0x37')][_0x2ce1('0x5f')]){throw new Error(_0x2ce1('0xc0'));}if(!_0x45076c['body'][_0x2ce1('0xc1')][_0x2ce1('0x7b')]){throw new Error(_0x2ce1('0xae'));}if(!_0x45076c['body']['binding'][_0x2ce1('0xaf')]){throw new Error(_0x2ce1('0xc2'));}if(!_0x45076c[_0x2ce1('0x37')]['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x3ce357=require('child_process')[_0x2ce1('0xb5')](path[_0x2ce1('0x3c')](__dirname,'../../components/import/cm/csv2'),[_0x45076c[_0x2ce1('0x27')]['id'],JSON[_0x2ce1('0xc3')](_0x45076c[_0x2ce1('0x37')]),JSON[_0x2ce1('0xc3')](_0x272458)]);_0x3ce357['on'](_0x2ce1('0xc4'),function(){_0x2ab4d8=!![];return _0x45424a['status'](0xc8)[_0x2ce1('0xb8')]({'message':_0x2ce1('0xc5'),'pid':_0x3ce357[_0x2ce1('0xb9')]});});_0x3ce357['on']('exit',function(_0x566128){if(_0x566128&&!_0x2ab4d8){return _0x45424a[_0x2ce1('0x11')](0x1f4)[_0x2ce1('0xb8')]({'message':'error\x20child\x20process','pid':_0x3ce357[_0x2ce1('0xb9')]});}});})['catch'](handleError(_0x45424a,null));};exports[_0x2ce1('0xc6')]=function(_0x4dd7d6,_0x450203){return db[_0x2ce1('0xbe')][_0x2ce1('0x23')]({'raw':!![],'attributes':['id'],'where':{'role':_0x2ce1('0xbf')}})[_0x2ce1('0x19')](function(_0x28d5df){var _0x3791ef=![];if(!_0x4dd7d6[_0x2ce1('0x37')][_0x2ce1('0x5f')]){throw new Error(_0x2ce1('0xc0'));}if(!_0x4dd7d6[_0x2ce1('0x37')][_0x2ce1('0xc1')]['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x4dd7d6[_0x2ce1('0x37')][_0x2ce1('0xc1')][_0x2ce1('0xaf')]){throw new Error(_0x2ce1('0xc2'));}if(!_0x4dd7d6[_0x2ce1('0x37')]['socket_timestamp']){throw new Error(_0x2ce1('0xab'));}var _0xe87e4=require(_0x2ce1('0xc7'))[_0x2ce1('0xb5')](path[_0x2ce1('0x3c')](__dirname,_0x2ce1('0xc8')),[_0x4dd7d6['params']['id'],JSON['stringify'](_0x4dd7d6[_0x2ce1('0x37')]),JSON[_0x2ce1('0xc3')](_0x28d5df)]);_0xe87e4['on'](_0x2ce1('0xc4'),function(){_0x3791ef=!![];return _0x450203[_0x2ce1('0x11')](0xc8)['json']({'message':_0x2ce1('0xc5'),'pid':_0xe87e4['pid']});});_0xe87e4['on'](_0x2ce1('0xc9'),function(_0x8e5d40){if(_0x8e5d40&&!_0x3791ef){return _0x450203['status'](0x1f4)[_0x2ce1('0xb8')]({'message':'error\x20child\x20process','pid':_0xe87e4[_0x2ce1('0xb9')]});}});})[_0x2ce1('0x25')](handleError(_0x450203,null));};exports[_0x2ce1('0xca')]=function(_0x168c09,_0x339ef3){var _0x2b3cc8=[_0x2ce1('0xcb'),_0x2ce1('0xcc'),_0x2ce1('0xcd'),_0x2ce1('0xce'),_0x2ce1('0xcf'),_0x2ce1('0xd0'),_0x2ce1('0xd1')];var _0x11db21={'offset':0x0,'order':qs[_0x2ce1('0x82')](_0x2ce1('0xd2'))},_0x315392={'count':0x0,'rows':[]};Promise['resolve']()[_0x2ce1('0x19')](function(){if(_0x168c09[_0x2ce1('0x24')][_0x2ce1('0xd3')]){if(!_[_0x2ce1('0xd4')](_0x2b3cc8,_0x168c09[_0x2ce1('0x24')][_0x2ce1('0xd3')][_0x2ce1('0xd5')]())){throw new Error('Invalid\x20channel');}_0x2b3cc8=[_0x168c09[_0x2ce1('0x24')][_0x2ce1('0xd3')][_0x2ce1('0xd5')]()];}if(_0x168c09['query'][_0x2ce1('0xd6')]){try{var _0x896dea=JSON[_0x2ce1('0xbb')](_0x168c09[_0x2ce1('0x24')][_0x2ce1('0xd6')]);if(!moment(_0x896dea[_0x2ce1('0x38')])[_0x2ce1('0xd7')]()){throw new Error(_0x2ce1('0xd8'));}if(!moment(_0x896dea['to'])[_0x2ce1('0xd7')]()){throw new Error(_0x2ce1('0xd9'));}}catch(_0x5ab870){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x168c09['query'][_0x2ce1('0x35')](_0x2ce1('0x86'))){_0x11db21[_0x2ce1('0x14')]=qs['limit'](_0x168c09[_0x2ce1('0x24')][_0x2ce1('0x14')]||0xa);_0x11db21['offset']=qs[_0x2ce1('0x12')](_0x168c09[_0x2ce1('0x24')][_0x2ce1('0x12')]);}var _0x370441=_0x2b3cc8['map'](function(_0x50becf){if(_0x50becf===_0x2ce1('0xd1')){var _0x346054={'attributes':['id',_0x2ce1('0xda'),_0x2ce1('0x32'),_0x2ce1('0xdb'),_0x2ce1('0xdc'),_0x2ce1('0xdd'),_0x2ce1('0xde'),_0x2ce1('0xdf'),'duration',_0x2ce1('0xe0'),_0x2ce1('0xe1'),_0x2ce1('0xe2'),_0x2ce1('0xe3'),'userThirdDisposition','UserId'],'where':{'ContactId':_0x168c09[_0x2ce1('0x27')]['id']},'include':[{'model':db['User'],'as':'User','attributes':['id',_0x2ce1('0x1e'),'fullname','alias']}],'order':[[_0x2ce1('0xe1'),'DESC']]};if(_0x168c09[_0x2ce1('0x24')][_0x2ce1('0xd6')]){_0x346054[_0x2ce1('0x5d')][_0x2ce1('0xe1')]={'$gte':_0x896dea[_0x2ce1('0x38')],'$lte':_0x896dea['to']};}return db[_0x2ce1('0xe4')][_0x2ce1('0xe5')](_0x346054)['then'](function(_0x2de725){_0x315392[_0x2ce1('0x15')]+=_0x2de725[_0x2ce1('0x15')];return _[_0x2ce1('0x71')](_0x2de725[_0x2ce1('0xa1')],function(_0x96cc2e){var _0x801bf5=_0x96cc2e[_0x2ce1('0x39')]({'plain':!![]});_0x801bf5['channel']=_0x50becf;if(_0x801bf5[_0x2ce1('0xbe')]){_0x801bf5['User']={'id':_0x801bf5[_0x2ce1('0xbe')]['id'],'name':_0x801bf5[_0x2ce1('0xbe')][_0x2ce1('0x1e')],'fullname':_0x801bf5['User'][_0x2ce1('0xe6')],'alias':_0x801bf5[_0x2ce1('0xbe')][_0x2ce1('0x31')]};}return _0x801bf5;});});}else{var _0x2ae31e=_[_0x2ce1('0xe7')](_0x50becf)+(_0x50becf===_0x2ce1('0xcc')?_0x2ce1('0xe8'):_0x2ce1('0xe9'));var _0x4b3015={'attributes':['id','closed','closedAt',_0x2ce1('0xe1'),'note',_0x2ce1('0xea'),'secondDisposition',_0x2ce1('0xeb'),_0x2ce1('0xec'),_0x2ae31e+'Id'],'where':{'ContactId':_0x168c09['params']['id']},'include':[{'model':db[_0x2ae31e],'as':_0x2ce1('0xe9'),'attributes':['id',_0x2ce1('0x1e'),_0x2ce1('0xed')]},{'model':db[_0x2ce1('0xbe')],'as':_0x2ce1('0xee'),'attributes':['id','name',_0x2ce1('0xe6')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x2ce1('0x1e'),_0x2ce1('0x67')],'through':{'attributes':[]}}],'order':[[_0x2ce1('0xe1'),'DESC']]};if(_0x168c09[_0x2ce1('0x24')]['range']){_0x4b3015[_0x2ce1('0x5d')]['createdAt']={'$gte':_0x896dea[_0x2ce1('0x38')],'$lte':_0x896dea['to']};}switch(_0x50becf){case _0x2ce1('0xcc'):_0x4b3015[_0x2ce1('0x84')]['push']('browserName','customerIp',_0x2ce1('0xef'),_0x2ce1('0xf0'),'osName',_0x2ce1('0xf1'),'ratingType',_0x2ce1('0xf2'),'referer');break;case _0x2ce1('0xcb'):_0x4b3015[_0x2ce1('0x84')]['push']('subject',_0x2ce1('0xf3'));break;case _0x2ce1('0xce'):_0x4b3015[_0x2ce1('0x84')][_0x2ce1('0x61')](_0x2ce1('0xf4'),_0x2ce1('0xf5'));break;}return db[_[_0x2ce1('0xe7')](_0x50becf)+_0x2ce1('0xf6')][_0x2ce1('0xe5')](_0x4b3015)['then'](function(_0x4e6732){_0x315392[_0x2ce1('0x15')]+=_0x4e6732[_0x2ce1('0x15')];return _[_0x2ce1('0x71')](_0x4e6732['rows'],function(_0x3fc7d1){var _0x306f88=_0x3fc7d1[_0x2ce1('0x39')]({'plain':!![]});_0x306f88['channel']=_0x50becf;if(_0x306f88['Owner']){_0x306f88['Owner']={'id':_0x306f88['Owner']['id'],'name':_0x306f88['Owner'][_0x2ce1('0x1e')],'fullname':_0x306f88[_0x2ce1('0xee')][_0x2ce1('0xe6')]};}return _0x306f88;});});}});return Promise[_0x2ce1('0x62')](_0x370441);})['then'](function(_0x2204ce){return _(_0x2204ce)['flatten']()[_0x2ce1('0xf7')](_0x2ce1('0xe1'))[_0x2ce1('0xf8')]()[_0x2ce1('0xf9')]();})[_0x2ce1('0x19')](function(_0x2bfa58){_0x315392[_0x2ce1('0xa1')]=_0x11db21[_0x2ce1('0x14')]?_0x2bfa58[_0x2ce1('0xfa')](_0x11db21[_0x2ce1('0x12')],_0x11db21['offset']+_0x11db21[_0x2ce1('0x14')]):_0x2bfa58;return _0x315392;})['then'](respondWithFilteredResult(_0x339ef3,_0x11db21))[_0x2ce1('0x25')](handleError(_0x339ef3,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index fccdd4f..acd0ad3 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 _0x81cb=['events','CmContact','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x506f15,_0x3ec34a){var _0x4ca786=function(_0x37d5d4){while(--_0x37d5d4){_0x506f15['push'](_0x506f15['shift']());}};_0x4ca786(++_0x3ec34a);}(_0x81cb,0xe8));var _0xb81c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x81cb[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xb81c('0x0'));var CmContact=require('../../mysqldb')['db'][_0xb81c('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xb81c('0x2')](0x0);var events={'afterCreate':_0xb81c('0x3'),'afterUpdate':_0xb81c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5a5d9f){return function(_0x13682f,_0x1a5141,_0x3bb24a){CmContactEvents['emit'](_0x5a5d9f+':'+_0x13682f['id'],_0x13682f);CmContactEvents[_0xb81c('0x5')](_0x5a5d9f,_0x13682f);_0x3bb24a(null);};}for(var e in events){if(events[_0xb81c('0x6')](e)){var event=events[e];CmContact[_0xb81c('0x7')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file +var _0x6603=['exports','../../mysqldb','CmContact','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x6603,0x106));var _0x3660=function(_0x55c26c,_0x3adbbe){_0x55c26c=_0x55c26c-0x0;var _0x4072da=_0x6603[_0x55c26c];return _0x4072da;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x3660('0x0'))['db'][_0x3660('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x3660('0x2')](0x0);var events={'afterCreate':_0x3660('0x3'),'afterUpdate':_0x3660('0x4'),'afterDestroy':_0x3660('0x5')};function emitEvent(_0x133818){return function(_0x323a48,_0x60ec4,_0x5209c6){CmContactEvents[_0x3660('0x6')](_0x133818+':'+_0x323a48['id'],_0x323a48);CmContactEvents['emit'](_0x133818,_0x323a48);_0x5209c6(null);};}for(var e in events){if(events[_0x3660('0x7')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x3660('0x8')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 187d925..4642856 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 _0x52d9=['FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','VoiceQueue','timezones','dialTimezone','utcOffset','add','minutes','then','ret','findOne','cmContact,\x20afterCreate\x20','CmHopper','create','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','error','Campaign','\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','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','length','always','BlackLists','cmContact,\x20%s,\x20%s','message','Lists','onlyIfOpen','CmHopperBlack','List\x20not\x20found','destroy','VoiceQueueId','CampaignId','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','CmContact','phone','fti_cm_contacts','firstName','email'];(function(_0x4ff41c,_0x483c21){var _0x275644=function(_0xcaef54){while(--_0xcaef54){_0x4ff41c['push'](_0x4ff41c['shift']());}};_0x275644(++_0x483c21);}(_0x52d9,0x82));var _0x952d=function(_0x4574d9,_0x224f1a){_0x4574d9=_0x4574d9-0x0;var _0x30cea4=_0x52d9[_0x4574d9];return _0x30cea4;};'use strict';var _=require(_0x952d('0x0'));var util=require('util');var logger=require(_0x952d('0x1'))(_0x952d('0x2'));var moment=require(_0x952d('0x3'));var BPromise=require('bluebird');var rp=require(_0x952d('0x4'));var fs=require('fs');var path=require(_0x952d('0x5'));var rimraf=require(_0x952d('0x6'));var config=require(_0x952d('0x7'));var shared=require(_0x952d('0x8'));var attributes=require(_0x952d('0x9'));module[_0x952d('0xa')]=function(_0xd5cef3,_0x558477){return _0xd5cef3['define'](_0x952d('0xb'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0x952d('0xc'),'fields':['phone']},{'name':_0x952d('0xd'),'fields':[_0x952d('0xe'),'lastName',_0x952d('0xc'),'mobile','fax',_0x952d('0xf')],'type':_0x952d('0x10')}],'timestamps':!![],'charset':_0x952d('0x11'),'collate':_0x952d('0x12'),'hooks':{'afterCreate':function(_0x23ab73,_0x2ea802,_0x1b8ea0){var _0x2012a4=_0xd5cef3[_0x952d('0x13')];var _0x169598=_0x23ab73[_0x952d('0x14')]({'plain':!![]});function _0x58c757(){return function(_0x566f27){logger['error'](_0x952d('0x15'),_0x952d('0x16'),util[_0x952d('0x17')](_0x566f27,{'showHidden':![],'depth':null}));};}function _0x29acaf(_0x3b0758,_0x461d56){var _0x3fbdd9=_0x461d56[_0x952d('0x18')]?_0x461d56[_0x952d('0x18')]:moment()[_0x952d('0x19')](_0x952d('0x1a'));return new BPromise(function(_0x349080,_0xd6aa75){if(_[_0x952d('0x1b')](_0x461d56['dialTimezone'])){_0x349080({'ret':_0x3fbdd9});}else{_0x2012a4[_0x952d('0x1c')]['findOne']({'where':{'id':_0x3b0758['id']}})['then'](function(_0x4d3d50){if(!_[_0x952d('0x1b')](_0x4d3d50)){var _0xcef9fe=_0x4d3d50['dialTimezone'];if(!_['isNil'](_0xcef9fe)){var _0x4acf82=shared[_0x952d('0x1d')];var _0x480922=_0x4acf82[_0xcef9fe];var _0x6b592d=_0x4acf82[_0x461d56[_0x952d('0x1e')]];if(!_['isNil'](_0x480922)&&!_[_0x952d('0x1b')](_0x6b592d)){var _0x104b82=_0x480922[_0x952d('0x1f')]-_0x6b592d[_0x952d('0x1f')];_0x3fbdd9=_0x461d56[_0x952d('0x18')]?_0x461d56[_0x952d('0x18')]:moment();var _0x1ef3d0=moment(_0x3fbdd9)[_0x952d('0x20')](_0x104b82,_0x952d('0x21'));_0x349080({'ret':_0x1ef3d0[_0x952d('0x19')](_0x952d('0x1a'))});}else _0x349080({'ret':_0x3fbdd9});}else _0x349080({'ret':_0x3fbdd9});}else{_0x349080({'ret':_0x3fbdd9});}});}});return 0xa;}var _0x390cac=function(_0x20d5b4){return new BPromise(function(_0x29fc41,_0x5a5b3d){_0x29acaf(_0x20d5b4,_0x169598)[_0x952d('0x22')](function(_0x229bfe){_0x169598['scheduledat']=_0x229bfe[_0x952d('0x23')];_0x2012a4['CmHopper'][_0x952d('0x24')]({'where':{'phone':_0x169598[_0x952d('0xc')],'VoiceQueueId':_0x20d5b4['id']}})[_0x952d('0x22')](function(_0x24db2a){if(!_[_0x952d('0x1b')](_0x24db2a)){throw new Error(_0x952d('0x25')+_0x169598[_0x952d('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x20d5b4['id']);}return _0x2012a4[_0x952d('0x26')][_0x952d('0x27')]({'phone':_0x169598[_0x952d('0xc')],'ContactId':_0x169598['id'],'ListId':_0x169598[_0x952d('0x28')],'priority':_0x169598[_0x952d('0x29')]?_0x169598[_0x952d('0x29')]:0x2,'scheduledat':_0x169598['scheduledat']?_0x169598[_0x952d('0x18')]:moment()[_0x952d('0x19')](_0x952d('0x1a')),'callback':_0x169598[_0x952d('0x2a')]?!![]:![],'callbackuniqueid':_0x169598['callbackUniqueid']?_0x169598[_0x952d('0x2a')]:undefined,'callbackat':_0x169598[_0x952d('0x2a')]?moment()[_0x952d('0x19')](_0x952d('0x1a')):undefined,'VoiceQueueId':_0x20d5b4['id']});})[_0x952d('0x2b')](function(_0x4e04ca){_0x5a5b3d(_0x4e04ca);});});});};var _0x1fa229=function(_0x145458){return new BPromise(function(_0x3b378f,_0x49dc13){_0x29acaf(_0x145458,_0x169598)[_0x952d('0x22')](function(_0x22ccfd){_0x169598[_0x952d('0x18')]=_0x22ccfd[_0x952d('0x23')];_0x2012a4[_0x952d('0x26')][_0x952d('0x24')]({'where':{'phone':_0x169598[_0x952d('0xc')],'VoiceQueueId':_0x145458['id']}})[_0x952d('0x22')](function(_0x41c418){if(!_[_0x952d('0x1b')](_0x41c418)){throw new Error(_0x952d('0x25')+_0x169598[_0x952d('0xc')]+_0x952d('0x2c')+_0x145458['id']);}return _0x2012a4['CmHopperFinal']['findOne']({'where':{'calleridnum':_0x169598[_0x952d('0xc')],'VoiceQueueId':_0x145458['id']}});})[_0x952d('0x22')](function(_0x11bd47){if(!_[_0x952d('0x1b')](_0x11bd47)){throw new Error(_0x952d('0x2d')+_0x169598[_0x952d('0xc')]+_0x952d('0x2e')+_0x145458['id']);}return _0x2012a4['CmHopper'][_0x952d('0x27')]({'phone':_0x169598[_0x952d('0xc')],'ContactId':_0x169598['id'],'ListId':_0x169598[_0x952d('0x28')],'priority':_0x169598['priority']?_0x169598['priority']:0x2,'scheduledat':_0x169598[_0x952d('0x18')]?_0x169598[_0x952d('0x18')]:moment()[_0x952d('0x19')](_0x952d('0x1a')),'callback':_0x169598[_0x952d('0x2a')]?!![]:![],'callbackuniqueid':_0x169598[_0x952d('0x2a')]?_0x169598['callbackUniqueid']:undefined,'callbackat':_0x169598[_0x952d('0x2a')]?moment()[_0x952d('0x19')](_0x952d('0x1a')):undefined,'VoiceQueueId':_0x145458['id']});})['catch'](function(_0x1bda34){_0x49dc13(_0x1bda34);});});});};function _0x498e25(){return function(_0x2ac976){logger[_0x952d('0x2f')](_0x952d('0x15'),_0x952d('0x16'),util[_0x952d('0x17')](_0x2ac976,{'showHidden':![],'depth':null}));};}function _0x5a5dca(_0x1a565a,_0x34d499){var _0x35d9db=_0x34d499[_0x952d('0x18')]?_0x34d499[_0x952d('0x18')]:moment()[_0x952d('0x19')](_0x952d('0x1a'));return new BPromise(function(_0x15206a,_0x518231){if(_[_0x952d('0x1b')](_0x34d499[_0x952d('0x1e')])){_0x15206a({'ret':_0x35d9db});}else{_0x2012a4[_0x952d('0x30')][_0x952d('0x24')]({'where':{'id':_0x1a565a['id']}})[_0x952d('0x22')](function(_0x7540bd){if(!_[_0x952d('0x1b')](_0x7540bd)){var _0x50a886=_0x7540bd[_0x952d('0x1e')];if(!_[_0x952d('0x1b')](_0x50a886)){var _0x5afdb2=shared['timezones'];var _0x46e99c=_0x5afdb2[_0x50a886];var _0x4aa2c2=_0x5afdb2[_0x34d499['dialTimezone']];if(!_[_0x952d('0x1b')](_0x46e99c)&&!_[_0x952d('0x1b')](_0x4aa2c2)){var _0x2b6de0=_0x46e99c[_0x952d('0x1f')]-_0x4aa2c2[_0x952d('0x1f')];_0x35d9db=_0x34d499[_0x952d('0x18')]?_0x34d499[_0x952d('0x18')]:moment();var _0x4f95bd=moment(_0x35d9db)[_0x952d('0x20')](_0x2b6de0,_0x952d('0x21'));_0x15206a({'ret':_0x4f95bd['format'](_0x952d('0x1a'))});}else _0x15206a({'ret':_0x35d9db});}else _0x15206a({'ret':_0x35d9db});}else{_0x15206a({'ret':_0x35d9db});}});}});return 0xa;}var _0x5176e8=function(_0xb61a8f){return new BPromise(function(_0x26a4ce,_0x4e1a8d){_0x5a5dca(_0xb61a8f,_0x169598)[_0x952d('0x22')](function(_0x1b3bd8){_0x169598[_0x952d('0x18')]=_0x1b3bd8[_0x952d('0x23')];_0x2012a4[_0x952d('0x26')][_0x952d('0x24')]({'where':{'phone':_0x169598['phone'],'CampaignId':_0xb61a8f['id']}})[_0x952d('0x22')](function(_0x4647ed){if(!_[_0x952d('0x1b')](_0x4647ed)){throw new Error(_0x952d('0x25')+_0x169598[_0x952d('0xc')]+_0x952d('0x31')+_0xb61a8f['id']);}return _0x2012a4[_0x952d('0x26')]['create']({'phone':_0x169598[_0x952d('0xc')],'ContactId':_0x169598['id'],'ListId':_0x169598['ListId'],'priority':_0x169598[_0x952d('0x29')]?_0x169598[_0x952d('0x29')]:0x2,'scheduledat':_0x169598['scheduledat']?_0x169598[_0x952d('0x18')]:moment()[_0x952d('0x19')](_0x952d('0x1a')),'callback':_0x169598['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x169598[_0x952d('0x2a')]?_0x169598[_0x952d('0x2a')]:undefined,'callbackat':_0x169598[_0x952d('0x2a')]?moment()['format'](_0x952d('0x1a')):undefined,'CampaignId':_0xb61a8f['id']});})[_0x952d('0x2b')](function(_0x17bcb0){_0x4e1a8d(_0x17bcb0);});});});};var _0x108594=function(_0x15c169){return new BPromise(function(_0x3f12ea,_0xd931b6){_0x5a5dca(_0x15c169,_0x169598)['then'](function(_0x56bba6){_0x169598['scheduledat']=_0x56bba6[_0x952d('0x23')];_0x2012a4['CmHopper'][_0x952d('0x24')]({'where':{'phone':_0x169598[_0x952d('0xc')],'CampaignId':_0x15c169['id']}})[_0x952d('0x22')](function(_0x1cd428){if(!_[_0x952d('0x1b')](_0x1cd428)){throw new Error(_0x952d('0x25')+_0x169598[_0x952d('0xc')]+_0x952d('0x32')+_0x15c169['id']);}return _0x2012a4[_0x952d('0x33')][_0x952d('0x24')]({'where':{'calleridnum':_0x169598[_0x952d('0xc')],'CampaignId':_0x15c169['id']}});})[_0x952d('0x22')](function(_0x452776){if(!_[_0x952d('0x1b')](_0x452776)){throw new Error(_0x952d('0x2d')+_0x169598['phone']+_0x952d('0x34')+_0x15c169['id']);}return _0x2012a4[_0x952d('0x26')][_0x952d('0x27')]({'phone':_0x169598[_0x952d('0xc')],'ContactId':_0x169598['id'],'ListId':_0x169598['ListId'],'priority':_0x169598[_0x952d('0x29')]?_0x169598[_0x952d('0x29')]:0x2,'scheduledat':_0x169598['scheduledat']?_0x169598[_0x952d('0x18')]:moment()[_0x952d('0x19')](_0x952d('0x1a')),'callback':_0x169598['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x169598[_0x952d('0x2a')]?_0x169598['callbackUniqueid']:undefined,'callbackat':_0x169598[_0x952d('0x2a')]?moment()[_0x952d('0x19')](_0x952d('0x1a')):undefined,'CampaignId':_0x15c169['id']});})['catch'](function(_0x356523){_0xd931b6(_0x356523);});});});};if(_0x169598[_0x952d('0x28')]){_0x2012a4['VoiceQueue'][_0x952d('0x35')]({'where':{'type':_0x952d('0x36')},'attributes':['id',_0x952d('0x37'),_0x952d('0x1e')],'include':[{'model':_0x2012a4[_0x952d('0x38')],'as':'Lists','where':{'id':_0x169598[_0x952d('0x28')]}}]})['then'](function(_0x20885c){if(_0x20885c){var _0x2d582a=[];for(var _0x218865=0x0,_0x5241e7;_0x218865<_0x20885c[_0x952d('0x39')];_0x218865+=0x1){_0x5241e7=_0x20885c[_0x218865][_0x952d('0x14')]({'plain':!![]});switch(_0x5241e7[_0x952d('0x37')]){case _0x952d('0x3a'):_0x1fa229(_0x5241e7)['catch'](_0x58c757());break;case'onlyIfOpen':_0x390cac(_0x5241e7)[_0x952d('0x2b')](_0x58c757());break;default:_0x5a5dca(_0x5241e7,_0x169598)[_0x952d('0x22')](function(_0x37a24c){_0x169598[_0x952d('0x18')]=_0x37a24c[_0x952d('0x23')];_0x2012a4[_0x952d('0x26')][_0x952d('0x27')]({'phone':_0x169598[_0x952d('0xc')],'ContactId':_0x169598['id'],'ListId':_0x169598[_0x952d('0x28')],'scheduledat':_0x169598[_0x952d('0x18')]?_0x169598[_0x952d('0x18')]:moment()[_0x952d('0x19')](_0x952d('0x1a')),'priority':_0x169598[_0x952d('0x29')]?_0x169598[_0x952d('0x29')]:0x2,'callback':_0x169598[_0x952d('0x2a')]?!![]:![],'callbackuniqueid':_0x169598['callbackUniqueid']?_0x169598[_0x952d('0x2a')]:undefined,'callbackat':_0x169598[_0x952d('0x2a')]?moment()[_0x952d('0x19')](_0x952d('0x1a')):undefined,'VoiceQueueId':_0x5241e7['id']})[_0x952d('0x2b')](_0x58c757());});}}}})[_0x952d('0x22')](function(){return _0x2012a4[_0x952d('0x1c')][_0x952d('0x35')]({'where':{'type':_0x952d('0x36')},'attributes':['id'],'include':[{'model':_0x2012a4['CmList'],'as':_0x952d('0x3b'),'where':{'id':_0x169598[_0x952d('0x28')]}}]})[_0x952d('0x22')](function(_0x2a01ba){if(_0x2a01ba){var _0x1fb42f=[];for(var _0x1ffa16=0x0,_0x55a509;_0x1ffa16<_0x2a01ba[_0x952d('0x39')];_0x1ffa16+=0x1){_0x55a509=_0x2a01ba[_0x1ffa16][_0x952d('0x14')]({'plain':!![]});_0x2012a4['CmHopperBlack']['create']({'phone':_0x169598[_0x952d('0xc')],'ContactId':_0x169598['id'],'ListId':_0x169598[_0x952d('0x28')],'VoiceQueueId':_0x55a509['id']})[_0x952d('0x2b')](function(_0x4b808d){logger['error'](_0x952d('0x3c'),_0x952d('0x16'),_0x4b808d[_0x952d('0x3d')]);});}}});})[_0x952d('0x22')](function(){return _0x2012a4[_0x952d('0x30')][_0x952d('0x35')]({'attributes':['id',_0x952d('0x37'),'dialTimezone'],'include':[{'model':_0x2012a4[_0x952d('0x38')],'as':_0x952d('0x3e'),'where':{'id':_0x169598[_0x952d('0x28')]}}]})[_0x952d('0x22')](function(_0x4c521a){if(_0x4c521a){var _0x10c489=[];for(var _0x2d65a7=0x0,_0x26b49d;_0x2d65a7<_0x4c521a[_0x952d('0x39')];_0x2d65a7+=0x1){_0x26b49d=_0x4c521a[_0x2d65a7]['get']({'plain':!![]});switch(_0x26b49d[_0x952d('0x37')]){case _0x952d('0x3a'):_0x108594(_0x26b49d)[_0x952d('0x2b')](_0x498e25());break;case _0x952d('0x3f'):_0x5176e8(_0x26b49d)[_0x952d('0x2b')](_0x498e25());break;default:_0x2012a4[_0x952d('0x26')][_0x952d('0x27')]({'phone':_0x169598[_0x952d('0xc')],'ContactId':_0x169598['id'],'ListId':_0x169598['ListId'],'scheduledat':_0x169598['scheduledat']?_0x169598[_0x952d('0x18')]:moment()['format'](_0x952d('0x1a')),'priority':_0x169598[_0x952d('0x29')]?_0x169598['priority']:0x2,'callback':_0x169598[_0x952d('0x2a')]?!![]:![],'callbackuniqueid':_0x169598[_0x952d('0x2a')]?_0x169598[_0x952d('0x2a')]:undefined,'callbackat':_0x169598[_0x952d('0x2a')]?moment()['format'](_0x952d('0x1a')):undefined,'CampaignId':_0x26b49d['id']})[_0x952d('0x2b')](_0x498e25());}}}});})[_0x952d('0x22')](function(){return _0x2012a4[_0x952d('0x30')][_0x952d('0x35')]({'attributes':['id'],'include':[{'model':_0x2012a4[_0x952d('0x38')],'as':_0x952d('0x3b'),'where':{'id':_0x169598[_0x952d('0x28')]}}]})[_0x952d('0x22')](function(_0x44ce03){if(_0x44ce03){var _0x384d02=[];for(var _0xe130ff=0x0,_0x32cf4d;_0xe130ff<_0x44ce03[_0x952d('0x39')];_0xe130ff+=0x1){_0x32cf4d=_0x44ce03[_0xe130ff][_0x952d('0x14')]({'plain':!![]});_0x2012a4[_0x952d('0x40')][_0x952d('0x27')]({'phone':_0x169598[_0x952d('0xc')],'ContactId':_0x169598['id'],'ListId':_0x169598['ListId'],'CampaignId':_0x32cf4d['id']})[_0x952d('0x2b')](function(_0xb1b5af){logger[_0x952d('0x2f')](_0x952d('0x3c'),_0x952d('0x16'),_0xb1b5af[_0x952d('0x3d')]);});}}});})[_0x952d('0x22')](function(){_0x1b8ea0();})[_0x952d('0x2b')](function(_0x57a5f9){logger[_0x952d('0x2f')]('cmContact,\x20%s,\x20%s',_0x952d('0x16'),_0x57a5f9[_0x952d('0x3d')]);_0x1b8ea0(_0x57a5f9);});}else{_0x1b8ea0(new Error(_0x952d('0x41')));}},'afterDestroy':function(_0x4a61cd,_0x38860c,_0x217e04){var _0x4fff08=_0xd5cef3['models'];var _0x4b4e80=_0x4a61cd[_0x952d('0x14')]({'plain':!![]});return _0x4fff08[_0x952d('0x26')][_0x952d('0x35')]({'raw':!![],'where':{'ListId':_0x4b4e80[_0x952d('0x28')],'ContactId':_0x4b4e80['id']}})[_0x952d('0x22')](function(_0x4cbf98){if(!_['isEmpty'](_0x4cbf98)){var _0x4662a7=[];for(var _0x594a4b=0x0;_0x594a4b<_0x4cbf98[_0x952d('0x39')];_0x594a4b+=0x1){var _0x538060=_0x4fff08[_0x952d('0x26')][_0x952d('0x42')]({'where':{'ListId':_0x4cbf98[_0x594a4b][_0x952d('0x28')],'ContactId':_0x4cbf98[_0x594a4b]['ContactId'],'VoiceQueueId':_0x4cbf98[_0x594a4b][_0x952d('0x43')],'CampaignId':_0x4cbf98[_0x594a4b][_0x952d('0x44')]}});_0x4662a7['push'](_0x538060);}return BPromise[_0x952d('0x45')](_0x4662a7);}})[_0x952d('0x22')](function(_0x3821dd){logger[_0x952d('0x46')](_0x952d('0x47'),util[_0x952d('0x17')](_0x3821dd,{'showHidden':![],'depth':null}));_0x217e04();})[_0x952d('0x2b')](function(_0x47b68f){logger[_0x952d('0x2f')](_0x952d('0x48'),util[_0x952d('0x17')](_0x47b68f,{'showHidden':![],'depth':null}));_0x217e04(_0x47b68f);});}}});}; \ No newline at end of file +var _0x7af3=['ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','catch','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','cmContact','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','CmList','Lists','length','dialCheckDuplicateType','always','onlyIfOpen','outbound','BlackLists','cmContact,\x20%s,\x20%s','message','Campaign','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','all','info','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment/shared','./cmContact.attributes','define','cm_contacts','phone','fti_cm_contacts','firstName','lastName','mobile','fax','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','afterCreate','inspect','scheduledat','format','isNil','dialTimezone','VoiceQueue','findOne','then','timezones','utcOffset','add','minutes','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2f0ebc,_0x508434){var _0x4e9620=function(_0x2c60cb){while(--_0x2c60cb){_0x2f0ebc['push'](_0x2f0ebc['shift']());}};_0x4e9620(++_0x508434);}(_0x7af3,0x19b));var _0x37af=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x7af3[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0x37af('0x0'));var util=require(_0x37af('0x1'));var logger=require(_0x37af('0x2'))(_0x37af('0x3'));var moment=require(_0x37af('0x4'));var BPromise=require(_0x37af('0x5'));var rp=require(_0x37af('0x6'));var fs=require('fs');var path=require(_0x37af('0x7'));var rimraf=require(_0x37af('0x8'));var config=require('../../config/environment');var shared=require(_0x37af('0x9'));var attributes=require(_0x37af('0xa'));module['exports']=function(_0x2f13e1,_0x5557a9){return _0x2f13e1[_0x37af('0xb')]('CmContact',attributes,{'tableName':_0x37af('0xc'),'paranoid':!![],'indexes':[{'name':_0x37af('0xd'),'fields':[_0x37af('0xd')]},{'name':_0x37af('0xe'),'fields':[_0x37af('0xf'),_0x37af('0x10'),'phone',_0x37af('0x11'),_0x37af('0x12'),'email'],'type':_0x37af('0x13')}],'timestamps':!![],'charset':_0x37af('0x14'),'collate':_0x37af('0x15'),'hooks':{'afterCreate':function(_0x331425,_0x5da573,_0x4611ee){var _0x5d2d16=_0x2f13e1[_0x37af('0x16')];var _0x5c66ee=_0x331425[_0x37af('0x17')]({'plain':!![]});function _0x417f68(){return function(_0x17f8b4){logger[_0x37af('0x18')]('cmContact',_0x37af('0x19'),util[_0x37af('0x1a')](_0x17f8b4,{'showHidden':![],'depth':null}));};}function _0x585e09(_0x20bd70,_0x34f3e3){var _0x151fb5=_0x34f3e3[_0x37af('0x1b')]?_0x34f3e3[_0x37af('0x1b')]:moment()[_0x37af('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x2517e0,_0x4d512d){if(_[_0x37af('0x1d')](_0x34f3e3[_0x37af('0x1e')])){_0x2517e0({'ret':_0x151fb5});}else{_0x5d2d16[_0x37af('0x1f')][_0x37af('0x20')]({'where':{'id':_0x20bd70['id']}})[_0x37af('0x21')](function(_0x3346a8){if(!_[_0x37af('0x1d')](_0x3346a8)){var _0x4e9f75=_0x3346a8[_0x37af('0x1e')];if(!_[_0x37af('0x1d')](_0x4e9f75)){var _0x479f9e=shared[_0x37af('0x22')];var _0x200673=_0x479f9e[_0x4e9f75];var _0xec0653=_0x479f9e[_0x34f3e3[_0x37af('0x1e')]];if(!_[_0x37af('0x1d')](_0x200673)&&!_[_0x37af('0x1d')](_0xec0653)){var _0x5c3b5f=_0x200673[_0x37af('0x23')]-_0xec0653['utcOffset'];_0x151fb5=_0x34f3e3[_0x37af('0x1b')]?_0x34f3e3[_0x37af('0x1b')]:moment();var _0x5b5534=moment(_0x151fb5)[_0x37af('0x24')](_0x5c3b5f,_0x37af('0x25'));_0x2517e0({'ret':_0x5b5534[_0x37af('0x1c')](_0x37af('0x26'))});}else _0x2517e0({'ret':_0x151fb5});}else _0x2517e0({'ret':_0x151fb5});}else{_0x2517e0({'ret':_0x151fb5});}});}});return 0xa;}var _0x458e52=function(_0x29e22c){return new BPromise(function(_0x19e90e,_0x2b4e0b){_0x585e09(_0x29e22c,_0x5c66ee)[_0x37af('0x21')](function(_0x1d95ff){_0x5c66ee[_0x37af('0x1b')]=_0x1d95ff[_0x37af('0x27')];_0x5d2d16[_0x37af('0x28')][_0x37af('0x20')]({'where':{'phone':_0x5c66ee[_0x37af('0xd')],'VoiceQueueId':_0x29e22c['id']}})[_0x37af('0x21')](function(_0x4b5404){if(!_[_0x37af('0x1d')](_0x4b5404)){throw new Error(_0x37af('0x29')+_0x5c66ee[_0x37af('0xd')]+_0x37af('0x2a')+_0x29e22c['id']);}return _0x5d2d16[_0x37af('0x28')][_0x37af('0x2b')]({'phone':_0x5c66ee[_0x37af('0xd')],'ContactId':_0x5c66ee['id'],'ListId':_0x5c66ee[_0x37af('0x2c')],'priority':_0x5c66ee[_0x37af('0x2d')]?_0x5c66ee[_0x37af('0x2d')]:0x2,'scheduledat':_0x5c66ee[_0x37af('0x1b')]?_0x5c66ee[_0x37af('0x1b')]:moment()[_0x37af('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x5c66ee['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x5c66ee[_0x37af('0x2e')]?_0x5c66ee[_0x37af('0x2e')]:undefined,'callbackat':_0x5c66ee['callbackUniqueid']?moment()['format'](_0x37af('0x26')):undefined,'VoiceQueueId':_0x29e22c['id']});})[_0x37af('0x2f')](function(_0x2c0de6){_0x2b4e0b(_0x2c0de6);});});});};var _0x4ca3da=function(_0x5f36ed){return new BPromise(function(_0xdda01c,_0x561692){_0x585e09(_0x5f36ed,_0x5c66ee)['then'](function(_0x39d01a){_0x5c66ee[_0x37af('0x1b')]=_0x39d01a[_0x37af('0x27')];_0x5d2d16[_0x37af('0x28')]['findOne']({'where':{'phone':_0x5c66ee[_0x37af('0xd')],'VoiceQueueId':_0x5f36ed['id']}})[_0x37af('0x21')](function(_0x496882){if(!_['isNil'](_0x496882)){throw new Error(_0x37af('0x29')+_0x5c66ee[_0x37af('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x5f36ed['id']);}return _0x5d2d16[_0x37af('0x30')]['findOne']({'where':{'calleridnum':_0x5c66ee['phone'],'VoiceQueueId':_0x5f36ed['id']}});})[_0x37af('0x21')](function(_0x2d2875){if(!_['isNil'](_0x2d2875)){throw new Error(_0x37af('0x31')+_0x5c66ee['phone']+_0x37af('0x32')+_0x5f36ed['id']);}return _0x5d2d16[_0x37af('0x28')][_0x37af('0x2b')]({'phone':_0x5c66ee['phone'],'ContactId':_0x5c66ee['id'],'ListId':_0x5c66ee[_0x37af('0x2c')],'priority':_0x5c66ee[_0x37af('0x2d')]?_0x5c66ee[_0x37af('0x2d')]:0x2,'scheduledat':_0x5c66ee[_0x37af('0x1b')]?_0x5c66ee['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x5c66ee['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x5c66ee[_0x37af('0x2e')]?_0x5c66ee[_0x37af('0x2e')]:undefined,'callbackat':_0x5c66ee['callbackUniqueid']?moment()[_0x37af('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x5f36ed['id']});})[_0x37af('0x2f')](function(_0x23c686){_0x561692(_0x23c686);});});});};function _0x54cf87(){return function(_0x4d5862){logger[_0x37af('0x18')](_0x37af('0x33'),_0x37af('0x19'),util[_0x37af('0x1a')](_0x4d5862,{'showHidden':![],'depth':null}));};}function _0x3df051(_0x2570c7,_0x3a6388){var _0x2b5156=_0x3a6388[_0x37af('0x1b')]?_0x3a6388['scheduledat']:moment()[_0x37af('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x3fdc11,_0x36b7dd){if(_[_0x37af('0x1d')](_0x3a6388[_0x37af('0x1e')])){_0x3fdc11({'ret':_0x2b5156});}else{_0x5d2d16['Campaign'][_0x37af('0x20')]({'where':{'id':_0x2570c7['id']}})['then'](function(_0x284ce4){if(!_[_0x37af('0x1d')](_0x284ce4)){var _0x70416c=_0x284ce4[_0x37af('0x1e')];if(!_['isNil'](_0x70416c)){var _0xed2bec=shared[_0x37af('0x22')];var _0x3f5784=_0xed2bec[_0x70416c];var _0x4854b3=_0xed2bec[_0x3a6388['dialTimezone']];if(!_[_0x37af('0x1d')](_0x3f5784)&&!_[_0x37af('0x1d')](_0x4854b3)){var _0x5ba920=_0x3f5784[_0x37af('0x23')]-_0x4854b3[_0x37af('0x23')];_0x2b5156=_0x3a6388[_0x37af('0x1b')]?_0x3a6388[_0x37af('0x1b')]:moment();var _0x16f3ad=moment(_0x2b5156)[_0x37af('0x24')](_0x5ba920,_0x37af('0x25'));_0x3fdc11({'ret':_0x16f3ad[_0x37af('0x1c')](_0x37af('0x26'))});}else _0x3fdc11({'ret':_0x2b5156});}else _0x3fdc11({'ret':_0x2b5156});}else{_0x3fdc11({'ret':_0x2b5156});}});}});return 0xa;}var _0x5f2b66=function(_0x565116){return new BPromise(function(_0x1f6635,_0x1147fb){_0x3df051(_0x565116,_0x5c66ee)[_0x37af('0x21')](function(_0x534f3e){_0x5c66ee[_0x37af('0x1b')]=_0x534f3e[_0x37af('0x27')];_0x5d2d16[_0x37af('0x28')][_0x37af('0x20')]({'where':{'phone':_0x5c66ee[_0x37af('0xd')],'CampaignId':_0x565116['id']}})[_0x37af('0x21')](function(_0x2445d8){if(!_[_0x37af('0x1d')](_0x2445d8)){throw new Error(_0x37af('0x29')+_0x5c66ee['phone']+_0x37af('0x34')+_0x565116['id']);}return _0x5d2d16[_0x37af('0x28')]['create']({'phone':_0x5c66ee[_0x37af('0xd')],'ContactId':_0x5c66ee['id'],'ListId':_0x5c66ee[_0x37af('0x2c')],'priority':_0x5c66ee['priority']?_0x5c66ee[_0x37af('0x2d')]:0x2,'scheduledat':_0x5c66ee[_0x37af('0x1b')]?_0x5c66ee[_0x37af('0x1b')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x5c66ee[_0x37af('0x2e')]?!![]:![],'callbackuniqueid':_0x5c66ee[_0x37af('0x2e')]?_0x5c66ee[_0x37af('0x2e')]:undefined,'callbackat':_0x5c66ee[_0x37af('0x2e')]?moment()[_0x37af('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x565116['id']});})[_0x37af('0x2f')](function(_0x18a59b){_0x1147fb(_0x18a59b);});});});};var _0x56e864=function(_0x57142d){return new BPromise(function(_0x4ae538,_0x545806){_0x3df051(_0x57142d,_0x5c66ee)[_0x37af('0x21')](function(_0xcb8c74){_0x5c66ee[_0x37af('0x1b')]=_0xcb8c74[_0x37af('0x27')];_0x5d2d16['CmHopper'][_0x37af('0x20')]({'where':{'phone':_0x5c66ee[_0x37af('0xd')],'CampaignId':_0x57142d['id']}})['then'](function(_0x36746c){if(!_[_0x37af('0x1d')](_0x36746c)){throw new Error(_0x37af('0x29')+_0x5c66ee[_0x37af('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x57142d['id']);}return _0x5d2d16[_0x37af('0x30')][_0x37af('0x20')]({'where':{'calleridnum':_0x5c66ee[_0x37af('0xd')],'CampaignId':_0x57142d['id']}});})['then'](function(_0x1f3e95){if(!_['isNil'](_0x1f3e95)){throw new Error(_0x37af('0x31')+_0x5c66ee[_0x37af('0xd')]+_0x37af('0x35')+_0x57142d['id']);}return _0x5d2d16[_0x37af('0x28')][_0x37af('0x2b')]({'phone':_0x5c66ee[_0x37af('0xd')],'ContactId':_0x5c66ee['id'],'ListId':_0x5c66ee['ListId'],'priority':_0x5c66ee['priority']?_0x5c66ee[_0x37af('0x2d')]:0x2,'scheduledat':_0x5c66ee[_0x37af('0x1b')]?_0x5c66ee['scheduledat']:moment()['format'](_0x37af('0x26')),'callback':_0x5c66ee[_0x37af('0x2e')]?!![]:![],'callbackuniqueid':_0x5c66ee[_0x37af('0x2e')]?_0x5c66ee['callbackUniqueid']:undefined,'callbackat':_0x5c66ee[_0x37af('0x2e')]?moment()[_0x37af('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x57142d['id']});})[_0x37af('0x2f')](function(_0x360e23){_0x545806(_0x360e23);});});});};if(_0x5c66ee[_0x37af('0x2c')]){_0x5d2d16[_0x37af('0x1f')][_0x37af('0x36')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType',_0x37af('0x1e')],'include':[{'model':_0x5d2d16[_0x37af('0x37')],'as':_0x37af('0x38'),'where':{'id':_0x5c66ee[_0x37af('0x2c')]}}]})[_0x37af('0x21')](function(_0xe1f2a5){if(_0xe1f2a5){var _0x3703e2=[];for(var _0x24c56a=0x0,_0x30e3d3;_0x24c56a<_0xe1f2a5[_0x37af('0x39')];_0x24c56a+=0x1){_0x30e3d3=_0xe1f2a5[_0x24c56a][_0x37af('0x17')]({'plain':!![]});switch(_0x30e3d3[_0x37af('0x3a')]){case _0x37af('0x3b'):_0x4ca3da(_0x30e3d3)[_0x37af('0x2f')](_0x417f68());break;case _0x37af('0x3c'):_0x458e52(_0x30e3d3)[_0x37af('0x2f')](_0x417f68());break;default:_0x3df051(_0x30e3d3,_0x5c66ee)[_0x37af('0x21')](function(_0x153f10){_0x5c66ee['scheduledat']=_0x153f10['ret'];_0x5d2d16[_0x37af('0x28')][_0x37af('0x2b')]({'phone':_0x5c66ee[_0x37af('0xd')],'ContactId':_0x5c66ee['id'],'ListId':_0x5c66ee['ListId'],'scheduledat':_0x5c66ee[_0x37af('0x1b')]?_0x5c66ee[_0x37af('0x1b')]:moment()['format'](_0x37af('0x26')),'priority':_0x5c66ee[_0x37af('0x2d')]?_0x5c66ee[_0x37af('0x2d')]:0x2,'callback':_0x5c66ee[_0x37af('0x2e')]?!![]:![],'callbackuniqueid':_0x5c66ee[_0x37af('0x2e')]?_0x5c66ee['callbackUniqueid']:undefined,'callbackat':_0x5c66ee['callbackUniqueid']?moment()[_0x37af('0x1c')](_0x37af('0x26')):undefined,'VoiceQueueId':_0x30e3d3['id']})[_0x37af('0x2f')](_0x417f68());});}}}})[_0x37af('0x21')](function(){return _0x5d2d16[_0x37af('0x1f')][_0x37af('0x36')]({'where':{'type':_0x37af('0x3d')},'attributes':['id'],'include':[{'model':_0x5d2d16['CmList'],'as':_0x37af('0x3e'),'where':{'id':_0x5c66ee[_0x37af('0x2c')]}}]})[_0x37af('0x21')](function(_0x30309c){if(_0x30309c){var _0x56ec00=[];for(var _0x226525=0x0,_0x1f338c;_0x226525<_0x30309c['length'];_0x226525+=0x1){_0x1f338c=_0x30309c[_0x226525][_0x37af('0x17')]({'plain':!![]});_0x5d2d16['CmHopperBlack']['create']({'phone':_0x5c66ee[_0x37af('0xd')],'ContactId':_0x5c66ee['id'],'ListId':_0x5c66ee[_0x37af('0x2c')],'VoiceQueueId':_0x1f338c['id']})[_0x37af('0x2f')](function(_0x3305f0){logger['error'](_0x37af('0x3f'),'afterCreate',_0x3305f0[_0x37af('0x40')]);});}}});})['then'](function(){return _0x5d2d16['Campaign'][_0x37af('0x36')]({'attributes':['id',_0x37af('0x3a'),_0x37af('0x1e')],'include':[{'model':_0x5d2d16[_0x37af('0x37')],'as':_0x37af('0x38'),'where':{'id':_0x5c66ee[_0x37af('0x2c')]}}]})['then'](function(_0x4afb12){if(_0x4afb12){var _0x13d93e=[];for(var _0x3e2a01=0x0,_0x5a9cf9;_0x3e2a01<_0x4afb12[_0x37af('0x39')];_0x3e2a01+=0x1){_0x5a9cf9=_0x4afb12[_0x3e2a01][_0x37af('0x17')]({'plain':!![]});switch(_0x5a9cf9[_0x37af('0x3a')]){case'always':_0x56e864(_0x5a9cf9)[_0x37af('0x2f')](_0x54cf87());break;case'onlyIfOpen':_0x5f2b66(_0x5a9cf9)[_0x37af('0x2f')](_0x54cf87());break;default:_0x5d2d16[_0x37af('0x28')][_0x37af('0x2b')]({'phone':_0x5c66ee[_0x37af('0xd')],'ContactId':_0x5c66ee['id'],'ListId':_0x5c66ee[_0x37af('0x2c')],'scheduledat':_0x5c66ee[_0x37af('0x1b')]?_0x5c66ee[_0x37af('0x1b')]:moment()[_0x37af('0x1c')](_0x37af('0x26')),'priority':_0x5c66ee['priority']?_0x5c66ee[_0x37af('0x2d')]:0x2,'callback':_0x5c66ee['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x5c66ee['callbackUniqueid']?_0x5c66ee[_0x37af('0x2e')]:undefined,'callbackat':_0x5c66ee[_0x37af('0x2e')]?moment()['format'](_0x37af('0x26')):undefined,'CampaignId':_0x5a9cf9['id']})['catch'](_0x54cf87());}}}});})[_0x37af('0x21')](function(){return _0x5d2d16[_0x37af('0x41')][_0x37af('0x36')]({'attributes':['id'],'include':[{'model':_0x5d2d16[_0x37af('0x37')],'as':_0x37af('0x3e'),'where':{'id':_0x5c66ee[_0x37af('0x2c')]}}]})[_0x37af('0x21')](function(_0x3d5cf8){if(_0x3d5cf8){var _0x30f6c2=[];for(var _0x4c32ed=0x0,_0x3a6d77;_0x4c32ed<_0x3d5cf8[_0x37af('0x39')];_0x4c32ed+=0x1){_0x3a6d77=_0x3d5cf8[_0x4c32ed][_0x37af('0x17')]({'plain':!![]});_0x5d2d16['CmHopperBlack'][_0x37af('0x2b')]({'phone':_0x5c66ee[_0x37af('0xd')],'ContactId':_0x5c66ee['id'],'ListId':_0x5c66ee[_0x37af('0x2c')],'CampaignId':_0x3a6d77['id']})[_0x37af('0x2f')](function(_0x39617b){logger[_0x37af('0x18')]('cmContact,\x20%s,\x20%s','afterCreate',_0x39617b['message']);});}}});})[_0x37af('0x21')](function(){_0x4611ee();})[_0x37af('0x2f')](function(_0xcfb7a4){logger['error'](_0x37af('0x3f'),_0x37af('0x19'),_0xcfb7a4[_0x37af('0x40')]);_0x4611ee(_0xcfb7a4);});}else{_0x4611ee(new Error(_0x37af('0x42')));}},'afterDestroy':function(_0x40b2c7,_0x15359e,_0x2a9e42){var _0x24aa7c=_0x2f13e1[_0x37af('0x16')];var _0x2eb244=_0x40b2c7['get']({'plain':!![]});return _0x24aa7c[_0x37af('0x28')]['findAll']({'raw':!![],'where':{'ListId':_0x2eb244[_0x37af('0x2c')],'ContactId':_0x2eb244['id']}})['then'](function(_0x19c1f6){if(!_[_0x37af('0x43')](_0x19c1f6)){var _0x5f4670=[];for(var _0x48fa82=0x0;_0x48fa82<_0x19c1f6[_0x37af('0x39')];_0x48fa82+=0x1){var _0x39d0bc=_0x24aa7c[_0x37af('0x28')][_0x37af('0x44')]({'where':{'ListId':_0x19c1f6[_0x48fa82][_0x37af('0x2c')],'ContactId':_0x19c1f6[_0x48fa82][_0x37af('0x45')],'VoiceQueueId':_0x19c1f6[_0x48fa82][_0x37af('0x46')],'CampaignId':_0x19c1f6[_0x48fa82][_0x37af('0x47')]}});_0x5f4670[_0x37af('0x48')](_0x39d0bc);}return BPromise[_0x37af('0x49')](_0x5f4670);}})['then'](function(_0x5e8826){logger[_0x37af('0x4a')]('[CmContact][afterDestroy][Succesfull]',util['inspect'](_0x5e8826,{'showHidden':![],'depth':null}));_0x2a9e42();})['catch'](function(_0x4debd1){logger[_0x37af('0x18')]('[CmContact][afterDestroy][Error]',util[_0x37af('0x1a')](_0x4debd1,{'showHidden':![],'depth':null}));_0x2a9e42(_0x4debd1);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index b6acade..3049c1d 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 _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\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(_0x4fc49a,_0x59e642){var _0x5ecf78=function(_0x422b2a){while(--_0x422b2a){_0x4fc49a['push'](_0x4fc49a['shift']());}};_0x5ecf78(++_0x59e642);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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 fe2536a..807c92f 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 _0xe79a=['PHONE','INTEGER','STRING'];(function(_0x5af05d,_0x4b0006){var _0x56fd1c=function(_0x3ec1c5){while(--_0x3ec1c5){_0x5af05d['push'](_0x5af05d['shift']());}};_0x56fd1c(++_0x4b0006);}(_0xe79a,0x70));var _0xae79=function(_0x1bcb2c,_0xf85d2a){_0x1bcb2c=_0x1bcb2c-0x0;var _0x843eab=_0xe79a[_0x1bcb2c];return _0x843eab;};'use strict';var Sequelize=require('sequelize');module['exports']={'CmContactId':{'type':Sequelize[_0xae79('0x0')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xae79('0x0')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xae79('0x1')],'defaultValue':_0xae79('0x2')},'OrderBy':{'type':Sequelize[_0xae79('0x0')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0x80d9=['sequelize','INTEGER','STRING','PHONE'];(function(_0x5d7443,_0x58e657){var _0x2f4e36=function(_0x3a7116){while(--_0x3a7116){_0x5d7443['push'](_0x5d7443['shift']());}};_0x2f4e36(++_0x58e657);}(_0x80d9,0x15c));var _0x980d=function(_0x4938f5,_0x178080){_0x4938f5=_0x4938f5-0x0;var _0x3a43c3=_0x80d9[_0x4938f5];return _0x3a43c3;};'use strict';var Sequelize=require(_0x980d('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x980d('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x980d('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x980d('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x980d('0x3')},'OrderBy':{'type':Sequelize[_0x980d('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0x980d('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 02a651e..e4cc56f 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 _0x9898=['nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','catch','body','eml-format','fast-json-patch','request-promise','moment','mustache','util','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','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','reject','save','update','destroy','then','get','CmContactHasItems','end','error','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0xdb185d,_0x30b7e1){var _0x4e49d9=function(_0x4a5b83){while(--_0x4a5b83){_0xdb185d['push'](_0xdb185d['shift']());}};_0x4e49d9(++_0x30b7e1);}(_0x9898,0xb8));var _0x8989=function(_0x423097,_0x8a09f4){_0x423097=_0x423097-0x0;var _0x3a73f1=_0x9898[_0x423097];return _0x3a73f1;};'use strict';var emlformat=require(_0x8989('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8989('0x1'));var rp=require(_0x8989('0x2'));var moment=require(_0x8989('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8989('0x4'));var util=require(_0x8989('0x5'));var path=require(_0x8989('0x6'));var sox=require(_0x8989('0x7'));var csv=require(_0x8989('0x8'));var ejs=require(_0x8989('0x9'));var fs=require('fs');var fs_extra=require(_0x8989('0xa'));var _=require(_0x8989('0xb'));var squel=require(_0x8989('0xc'));var crypto=require('crypto');var jsforce=require(_0x8989('0xd'));var deskjs=require(_0x8989('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8989('0xf'));var Redis=require(_0x8989('0x10'));var authService=require(_0x8989('0x11'));var qs=require(_0x8989('0x12'));var as=require(_0x8989('0x13'));var hardwareService=require(_0x8989('0x14'));var logger=require('../../config/logger')(_0x8989('0x15'));var utils=require('../../config/utils');var config=require(_0x8989('0x16'));var licenseUtil=require(_0x8989('0x17'));var db=require(_0x8989('0x18'))['db'];function respondWithStatusCode(_0x2f6b3e,_0x1214e5){_0x1214e5=_0x1214e5||0xcc;return function(_0x3a20e1){if(_0x3a20e1){return _0x2f6b3e[_0x8989('0x19')](_0x1214e5);}return _0x2f6b3e[_0x8989('0x1a')](_0x1214e5)['end']();};}function respondWithResult(_0x477f05,_0x507aa2){_0x507aa2=_0x507aa2||0xc8;return function(_0x2ad48a){if(_0x2ad48a){return _0x477f05['status'](_0x507aa2)[_0x8989('0x1b')](_0x2ad48a);}};}function respondWithFilteredResult(_0x49413e,_0x19d86d){return function(_0x5e0705){if(_0x5e0705){var _0x1e3374=typeof _0x19d86d[_0x8989('0x1c')]==='undefined'&&typeof _0x19d86d[_0x8989('0x1d')]==='undefined';var _0x3e42ed=_0x5e0705[_0x8989('0x1e')];var _0x4c9693=_0x1e3374?0x0:_0x19d86d['offset'];var _0x47fe62=_0x1e3374?_0x5e0705[_0x8989('0x1e')]:_0x19d86d[_0x8989('0x1c')]+_0x19d86d[_0x8989('0x1d')];var _0x468a96;if(_0x47fe62>=_0x3e42ed){_0x47fe62=_0x3e42ed;_0x468a96=0xc8;}else{_0x468a96=0xce;}_0x49413e[_0x8989('0x1a')](_0x468a96);return _0x49413e['set']('Content-Range',_0x4c9693+'-'+_0x47fe62+'/'+_0x3e42ed)[_0x8989('0x1b')](_0x5e0705);}return null;};}function patchUpdates(_0x5f4ef2){return function(_0x336a76){try{jsonpatch['apply'](_0x336a76,_0x5f4ef2,!![]);}catch(_0x46c05e){return BPromise[_0x8989('0x1f')](_0x46c05e);}return _0x336a76[_0x8989('0x20')]();};}function saveUpdates(_0x5da36d,_0x511079){return function(_0x292974){if(_0x292974){return _0x292974[_0x8989('0x21')](_0x5da36d)['then'](function(_0x296dee){return _0x296dee;});}return null;};}function removeEntity(_0x574ba9,_0x30708b){return function(_0x13da6a){if(_0x13da6a){return _0x13da6a[_0x8989('0x22')]()[_0x8989('0x23')](function(){var _0x1dfe0f=_0x13da6a[_0x8989('0x24')]({'plain':!![]});var _0x22620b=_0x8989('0x25');return db['UserProfileResource'][_0x8989('0x22')]({'where':{'type':_0x22620b,'resourceId':_0x1dfe0f['id']}})[_0x8989('0x23')](function(){return _0x13da6a;});})[_0x8989('0x23')](function(){_0x574ba9[_0x8989('0x1a')](0xcc)[_0x8989('0x26')]();});}};}function handleEntityNotFound(_0x12a971,_0x5a6c71){return function(_0x50ef65){if(!_0x50ef65){_0x12a971[_0x8989('0x19')](0x194);}return _0x50ef65;};}function handleError(_0x36f96d,_0x3c1ae3){_0x3c1ae3=_0x3c1ae3||0x1f4;return function(_0x2244db){logger[_0x8989('0x27')](_0x2244db['stack']);if(_0x2244db[_0x8989('0x28')]){delete _0x2244db[_0x8989('0x28')];}_0x36f96d[_0x8989('0x1a')](_0x3c1ae3)[_0x8989('0x29')](_0x2244db);};}exports[_0x8989('0x2a')]=function(_0x4b6fb4,_0xff6a0f){var _0x2cc073={},_0x9fab11={},_0x1f4f31={'count':0x0,'rows':[]};var _0xf70f8e=_[_0x8989('0x2b')](db[_0x8989('0x2c')][_0x8989('0x2d')],function(_0x4ee1d5){return{'name':_0x4ee1d5[_0x8989('0x2e')],'type':_0x4ee1d5['type']['key']};});_0x9fab11[_0x8989('0x2f')]=_[_0x8989('0x2b')](_0xf70f8e,_0x8989('0x28'));_0x9fab11['query']=_[_0x8989('0x30')](_0x4b6fb4[_0x8989('0x31')]);_0x9fab11[_0x8989('0x32')]=_[_0x8989('0x33')](_0x9fab11[_0x8989('0x2f')],_0x9fab11[_0x8989('0x31')]);_0x2cc073[_0x8989('0x34')]=_[_0x8989('0x33')](_0x9fab11[_0x8989('0x2f')],qs[_0x8989('0x35')](_0x4b6fb4[_0x8989('0x31')]['fields']));_0x2cc073[_0x8989('0x34')]=_0x2cc073[_0x8989('0x34')][_0x8989('0x36')]?_0x2cc073[_0x8989('0x34')]:_0x9fab11[_0x8989('0x2f')];if(!_0x4b6fb4[_0x8989('0x31')][_0x8989('0x37')](_0x8989('0x38'))){_0x2cc073[_0x8989('0x1d')]=qs[_0x8989('0x1d')](_0x4b6fb4[_0x8989('0x31')][_0x8989('0x1d')]);_0x2cc073[_0x8989('0x1c')]=qs[_0x8989('0x1c')](_0x4b6fb4[_0x8989('0x31')][_0x8989('0x1c')]);}_0x2cc073[_0x8989('0x39')]=qs['sort'](_0x4b6fb4[_0x8989('0x31')][_0x8989('0x3a')]);_0x2cc073[_0x8989('0x3b')]=qs[_0x8989('0x32')](_[_0x8989('0x3c')](_0x4b6fb4[_0x8989('0x31')],_0x9fab11[_0x8989('0x32')]),_0xf70f8e);if(_0x4b6fb4[_0x8989('0x31')][_0x8989('0x3d')]){_0x2cc073[_0x8989('0x3b')]=_[_0x8989('0x3e')](_0x2cc073[_0x8989('0x3b')],{'$or':_[_0x8989('0x2b')](_0xf70f8e,function(_0x405398){if(_0x405398[_0x8989('0x3f')]!=='VIRTUAL'){var _0x26f643={};_0x26f643[_0x405398[_0x8989('0x28')]]={'$like':'%'+_0x4b6fb4[_0x8989('0x31')][_0x8989('0x3d')]+'%'};return _0x26f643;}})});}_0x2cc073=_[_0x8989('0x3e')]({},_0x2cc073,_0x4b6fb4[_0x8989('0x40')]);var _0x2dd876={'where':_0x2cc073[_0x8989('0x3b')]};return db[_0x8989('0x2c')][_0x8989('0x1e')](_0x2dd876)[_0x8989('0x23')](function(_0x35d682){_0x1f4f31[_0x8989('0x1e')]=_0x35d682;if(_0x4b6fb4[_0x8989('0x31')][_0x8989('0x41')]){_0x2cc073['include']=[{'all':!![]}];}return db[_0x8989('0x2c')][_0x8989('0x42')](_0x2cc073);})[_0x8989('0x23')](function(_0x55b322){_0x1f4f31[_0x8989('0x43')]=_0x55b322;return _0x1f4f31;})[_0x8989('0x23')](respondWithFilteredResult(_0xff6a0f,_0x2cc073))['catch'](handleError(_0xff6a0f,null));};exports[_0x8989('0x44')]=function(_0x38fa38,_0xf5c07){var _0x5e2df0={'raw':!![],'where':{'id':_0x38fa38[_0x8989('0x45')]['id']}},_0x14ae11={};_0x14ae11[_0x8989('0x2f')]=_[_0x8989('0x30')](db[_0x8989('0x2c')]['rawAttributes']);_0x14ae11['query']=_['keys'](_0x38fa38[_0x8989('0x31')]);_0x14ae11[_0x8989('0x32')]=_[_0x8989('0x33')](_0x14ae11[_0x8989('0x2f')],_0x14ae11[_0x8989('0x31')]);_0x5e2df0['attributes']=_[_0x8989('0x33')](_0x14ae11['model'],qs[_0x8989('0x35')](_0x38fa38[_0x8989('0x31')][_0x8989('0x35')]));_0x5e2df0[_0x8989('0x34')]=_0x5e2df0['attributes']['length']?_0x5e2df0[_0x8989('0x34')]:_0x14ae11[_0x8989('0x2f')];if(_0x38fa38['query'][_0x8989('0x41')]){_0x5e2df0[_0x8989('0x46')]=[{'all':!![]}];}_0x5e2df0=_[_0x8989('0x3e')]({},_0x5e2df0,_0x38fa38[_0x8989('0x40')]);return db[_0x8989('0x2c')][_0x8989('0x47')](_0x5e2df0)[_0x8989('0x23')](handleEntityNotFound(_0xf5c07,null))[_0x8989('0x23')](respondWithResult(_0xf5c07,null))['catch'](handleError(_0xf5c07,null));};exports[_0x8989('0x48')]=function(_0xf5a782,_0x2751f7){return db[_0x8989('0x2c')]['create'](_0xf5a782['body'],{})[_0x8989('0x23')](function(_0x3b4e53){var _0x42c2d7=_0xf5a782[_0x8989('0x49')][_0x8989('0x24')]({'plain':!![]});if(!_0x42c2d7)throw new Error(_0x8989('0x4a'));if(_0x42c2d7[_0x8989('0x4b')]===_0x8989('0x49')){var _0x34d066=_0x3b4e53['get']({'plain':!![]});var _0x1830fa=_0x8989('0x25');return db[_0x8989('0x4c')][_0x8989('0x47')]({'where':{'name':_0x1830fa,'userProfileId':_0x42c2d7['userProfileId']},'raw':!![]})[_0x8989('0x23')](function(_0x124eb8){if(_0x124eb8&&_0x124eb8['autoAssociation']===0x0){return db[_0x8989('0x4d')][_0x8989('0x48')]({'name':_0x34d066[_0x8989('0x28')],'resourceId':_0x34d066['id'],'type':_0x124eb8[_0x8989('0x28')],'sectionId':_0x124eb8['id']},{})[_0x8989('0x23')](function(){return _0x3b4e53;});}else{return _0x3b4e53;}})[_0x8989('0x4e')](function(_0x41684c){logger[_0x8989('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41684c);throw _0x41684c;});}return _0x3b4e53;})[_0x8989('0x23')](respondWithResult(_0x2751f7,0xc9))[_0x8989('0x4e')](handleError(_0x2751f7,null));};exports[_0x8989('0x21')]=function(_0xe4e8d3,_0x4f337c){if(_0xe4e8d3[_0x8989('0x4f')]['id']){delete _0xe4e8d3['body']['id'];}return db['CmContactHasItem'][_0x8989('0x47')]({'where':{'id':_0xe4e8d3[_0x8989('0x45')]['id']}})[_0x8989('0x23')](handleEntityNotFound(_0x4f337c,null))['then'](saveUpdates(_0xe4e8d3[_0x8989('0x4f')],null))['then'](respondWithResult(_0x4f337c,null))[_0x8989('0x4e')](handleError(_0x4f337c,null));};exports['destroy']=function(_0x4e16f4,_0x5bd13b){return db[_0x8989('0x2c')]['find']({'where':{'id':_0x4e16f4[_0x8989('0x45')]['id']}})[_0x8989('0x23')](handleEntityNotFound(_0x5bd13b,null))[_0x8989('0x23')](removeEntity(_0x5bd13b,null))['catch'](handleError(_0x5bd13b,null));}; \ No newline at end of file +var _0xf154=['nolimit','sort','where','filter','merge','options','CmContactHasItem','includeAll','findAll','catch','show','params','keys','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','fs-extra','squel','crypto','desk.js','to-csv','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','save','update','then','destroy','CmContactHasItems','UserProfileResource','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xf154,0xaf));var _0x4f15=function(_0x35be1b,_0x290246){_0x35be1b=_0x35be1b-0x0;var _0xdccd5d=_0xf154[_0x35be1b];return _0xdccd5d;};'use strict';var emlformat=require(_0x4f15('0x0'));var rimraf=require(_0x4f15('0x1'));var zipdir=require(_0x4f15('0x2'));var jsonpatch=require(_0x4f15('0x3'));var rp=require('request-promise');var moment=require(_0x4f15('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4f15('0x5'));var util=require(_0x4f15('0x6'));var path=require(_0x4f15('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4f15('0x8'));var _=require('lodash');var squel=require(_0x4f15('0x9'));var crypto=require(_0x4f15('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4f15('0xb'));var toCsv=require(_0x4f15('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4f15('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f15('0xe'));var logger=require('../../config/logger')(_0x4f15('0xf'));var utils=require('../../config/utils');var config=require(_0x4f15('0x10'));var licenseUtil=require(_0x4f15('0x11'));var db=require(_0x4f15('0x12'))['db'];function respondWithStatusCode(_0x45869f,_0x1b2a0b){_0x1b2a0b=_0x1b2a0b||0xcc;return function(_0x12e975){if(_0x12e975){return _0x45869f[_0x4f15('0x13')](_0x1b2a0b);}return _0x45869f[_0x4f15('0x14')](_0x1b2a0b)['end']();};}function respondWithResult(_0x109609,_0x5d9372){_0x5d9372=_0x5d9372||0xc8;return function(_0x5be53d){if(_0x5be53d){return _0x109609[_0x4f15('0x14')](_0x5d9372)[_0x4f15('0x15')](_0x5be53d);}};}function respondWithFilteredResult(_0x200364,_0xd571c0){return function(_0x26a6b5){if(_0x26a6b5){var _0x5194f8=typeof _0xd571c0['offset']===_0x4f15('0x16')&&typeof _0xd571c0[_0x4f15('0x17')]===_0x4f15('0x16');var _0x41b8d4=_0x26a6b5[_0x4f15('0x18')];var _0x5ac0fa=_0x5194f8?0x0:_0xd571c0[_0x4f15('0x19')];var _0x3aaf70=_0x5194f8?_0x26a6b5[_0x4f15('0x18')]:_0xd571c0[_0x4f15('0x19')]+_0xd571c0['limit'];var _0x1147ae;if(_0x3aaf70>=_0x41b8d4){_0x3aaf70=_0x41b8d4;_0x1147ae=0xc8;}else{_0x1147ae=0xce;}_0x200364['status'](_0x1147ae);return _0x200364['set'](_0x4f15('0x1a'),_0x5ac0fa+'-'+_0x3aaf70+'/'+_0x41b8d4)[_0x4f15('0x15')](_0x26a6b5);}return null;};}function patchUpdates(_0x46befa){return function(_0x22c4a8){try{jsonpatch['apply'](_0x22c4a8,_0x46befa,!![]);}catch(_0x55e0e7){return BPromise['reject'](_0x55e0e7);}return _0x22c4a8[_0x4f15('0x1b')]();};}function saveUpdates(_0x4944be,_0x41db62){return function(_0x85185a){if(_0x85185a){return _0x85185a[_0x4f15('0x1c')](_0x4944be)[_0x4f15('0x1d')](function(_0x422300){return _0x422300;});}return null;};}function removeEntity(_0x552bc8,_0x266331){return function(_0x2e73c0){if(_0x2e73c0){return _0x2e73c0[_0x4f15('0x1e')]()['then'](function(){var _0x1e90ac=_0x2e73c0['get']({'plain':!![]});var _0x2c1af3=_0x4f15('0x1f');return db[_0x4f15('0x20')]['destroy']({'where':{'type':_0x2c1af3,'resourceId':_0x1e90ac['id']}})[_0x4f15('0x1d')](function(){return _0x2e73c0;});})[_0x4f15('0x1d')](function(){_0x552bc8[_0x4f15('0x14')](0xcc)[_0x4f15('0x21')]();});}};}function handleEntityNotFound(_0x314da7,_0xdc5eeb){return function(_0x3708e8){if(!_0x3708e8){_0x314da7[_0x4f15('0x13')](0x194);}return _0x3708e8;};}function handleError(_0x69a975,_0x50f97c){_0x50f97c=_0x50f97c||0x1f4;return function(_0x10d49b){logger[_0x4f15('0x22')](_0x10d49b['stack']);if(_0x10d49b['name']){delete _0x10d49b[_0x4f15('0x23')];}_0x69a975['status'](_0x50f97c)[_0x4f15('0x24')](_0x10d49b);};}exports[_0x4f15('0x25')]=function(_0x4f7d0a,_0x2073b6){var _0x1c5037={},_0x333dcd={},_0x4a9c28={'count':0x0,'rows':[]};var _0x59a29b=_[_0x4f15('0x26')](db['CmContactHasItem'][_0x4f15('0x27')],function(_0x2cdd4d){return{'name':_0x2cdd4d[_0x4f15('0x28')],'type':_0x2cdd4d[_0x4f15('0x29')][_0x4f15('0x2a')]};});_0x333dcd[_0x4f15('0x2b')]=_[_0x4f15('0x26')](_0x59a29b,_0x4f15('0x23'));_0x333dcd[_0x4f15('0x2c')]=_['keys'](_0x4f7d0a[_0x4f15('0x2c')]);_0x333dcd['filters']=_[_0x4f15('0x2d')](_0x333dcd['model'],_0x333dcd[_0x4f15('0x2c')]);_0x1c5037['attributes']=_[_0x4f15('0x2d')](_0x333dcd[_0x4f15('0x2b')],qs[_0x4f15('0x2e')](_0x4f7d0a['query'][_0x4f15('0x2e')]));_0x1c5037[_0x4f15('0x2f')]=_0x1c5037[_0x4f15('0x2f')][_0x4f15('0x30')]?_0x1c5037['attributes']:_0x333dcd['model'];if(!_0x4f7d0a[_0x4f15('0x2c')][_0x4f15('0x31')](_0x4f15('0x32'))){_0x1c5037['limit']=qs[_0x4f15('0x17')](_0x4f7d0a[_0x4f15('0x2c')][_0x4f15('0x17')]);_0x1c5037[_0x4f15('0x19')]=qs[_0x4f15('0x19')](_0x4f7d0a[_0x4f15('0x2c')][_0x4f15('0x19')]);}_0x1c5037['order']=qs[_0x4f15('0x33')](_0x4f7d0a[_0x4f15('0x2c')]['sort']);_0x1c5037[_0x4f15('0x34')]=qs['filters'](_['pick'](_0x4f7d0a[_0x4f15('0x2c')],_0x333dcd['filters']),_0x59a29b);if(_0x4f7d0a[_0x4f15('0x2c')][_0x4f15('0x35')]){_0x1c5037['where']=_[_0x4f15('0x36')](_0x1c5037[_0x4f15('0x34')],{'$or':_['map'](_0x59a29b,function(_0x59ddd6){if(_0x59ddd6['type']!=='VIRTUAL'){var _0x7e30b6={};_0x7e30b6[_0x59ddd6[_0x4f15('0x23')]]={'$like':'%'+_0x4f7d0a['query'][_0x4f15('0x35')]+'%'};return _0x7e30b6;}})});}_0x1c5037=_[_0x4f15('0x36')]({},_0x1c5037,_0x4f7d0a[_0x4f15('0x37')]);var _0x554518={'where':_0x1c5037[_0x4f15('0x34')]};return db[_0x4f15('0x38')][_0x4f15('0x18')](_0x554518)['then'](function(_0x4334b1){_0x4a9c28[_0x4f15('0x18')]=_0x4334b1;if(_0x4f7d0a[_0x4f15('0x2c')][_0x4f15('0x39')]){_0x1c5037['include']=[{'all':!![]}];}return db[_0x4f15('0x38')][_0x4f15('0x3a')](_0x1c5037);})[_0x4f15('0x1d')](function(_0x34283f){_0x4a9c28['rows']=_0x34283f;return _0x4a9c28;})[_0x4f15('0x1d')](respondWithFilteredResult(_0x2073b6,_0x1c5037))[_0x4f15('0x3b')](handleError(_0x2073b6,null));};exports[_0x4f15('0x3c')]=function(_0x1bcceb,_0x15501d){var _0x4039a5={'raw':!![],'where':{'id':_0x1bcceb[_0x4f15('0x3d')]['id']}},_0x224d3f={};_0x224d3f['model']=_[_0x4f15('0x3e')](db[_0x4f15('0x38')][_0x4f15('0x27')]);_0x224d3f[_0x4f15('0x2c')]=_[_0x4f15('0x3e')](_0x1bcceb[_0x4f15('0x2c')]);_0x224d3f['filters']=_[_0x4f15('0x2d')](_0x224d3f['model'],_0x224d3f[_0x4f15('0x2c')]);_0x4039a5['attributes']=_[_0x4f15('0x2d')](_0x224d3f[_0x4f15('0x2b')],qs[_0x4f15('0x2e')](_0x1bcceb[_0x4f15('0x2c')]['fields']));_0x4039a5[_0x4f15('0x2f')]=_0x4039a5[_0x4f15('0x2f')][_0x4f15('0x30')]?_0x4039a5['attributes']:_0x224d3f[_0x4f15('0x2b')];if(_0x1bcceb[_0x4f15('0x2c')][_0x4f15('0x39')]){_0x4039a5[_0x4f15('0x3f')]=[{'all':!![]}];}_0x4039a5=_['merge']({},_0x4039a5,_0x1bcceb['options']);return db['CmContactHasItem'][_0x4f15('0x40')](_0x4039a5)[_0x4f15('0x1d')](handleEntityNotFound(_0x15501d,null))[_0x4f15('0x1d')](respondWithResult(_0x15501d,null))['catch'](handleError(_0x15501d,null));};exports[_0x4f15('0x41')]=function(_0x2eca9f,_0x1c5ac4){return db[_0x4f15('0x38')][_0x4f15('0x41')](_0x2eca9f[_0x4f15('0x42')],{})[_0x4f15('0x1d')](function(_0x288461){var _0x23d194=_0x2eca9f[_0x4f15('0x43')][_0x4f15('0x44')]({'plain':!![]});if(!_0x23d194)throw new Error(_0x4f15('0x45'));if(_0x23d194[_0x4f15('0x46')]===_0x4f15('0x43')){var _0xf08adb=_0x288461[_0x4f15('0x44')]({'plain':!![]});var _0x555c3d=_0x4f15('0x1f');return db[_0x4f15('0x47')][_0x4f15('0x40')]({'where':{'name':_0x555c3d,'userProfileId':_0x23d194[_0x4f15('0x48')]},'raw':!![]})['then'](function(_0x49de3){if(_0x49de3&&_0x49de3[_0x4f15('0x49')]===0x0){return db[_0x4f15('0x20')][_0x4f15('0x41')]({'name':_0xf08adb[_0x4f15('0x23')],'resourceId':_0xf08adb['id'],'type':_0x49de3[_0x4f15('0x23')],'sectionId':_0x49de3['id']},{})[_0x4f15('0x1d')](function(){return _0x288461;});}else{return _0x288461;}})[_0x4f15('0x3b')](function(_0xf4ff96){logger['error'](_0x4f15('0x4a'),_0xf4ff96);throw _0xf4ff96;});}return _0x288461;})[_0x4f15('0x1d')](respondWithResult(_0x1c5ac4,0xc9))[_0x4f15('0x3b')](handleError(_0x1c5ac4,null));};exports[_0x4f15('0x1c')]=function(_0x234702,_0x10b28c){if(_0x234702[_0x4f15('0x42')]['id']){delete _0x234702[_0x4f15('0x42')]['id'];}return db[_0x4f15('0x38')]['find']({'where':{'id':_0x234702[_0x4f15('0x3d')]['id']}})[_0x4f15('0x1d')](handleEntityNotFound(_0x10b28c,null))[_0x4f15('0x1d')](saveUpdates(_0x234702[_0x4f15('0x42')],null))['then'](respondWithResult(_0x10b28c,null))['catch'](handleError(_0x10b28c,null));};exports[_0x4f15('0x1e')]=function(_0x13a4b0,_0x2687a6){return db['CmContactHasItem'][_0x4f15('0x40')]({'where':{'id':_0x13a4b0[_0x4f15('0x3d')]['id']}})[_0x4f15('0x1d')](handleEntityNotFound(_0x2687a6,null))[_0x4f15('0x1d')](removeEntity(_0x2687a6,null))[_0x4f15('0x3b')](handleError(_0x2687a6,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 9167f45..1843215 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 _0xef23=['bluebird','request-promise','rimraf','exports','define','CmContactHasItem','util','../../config/logger','api','moment'];(function(_0x1098db,_0x39ba6b){var _0x14f090=function(_0x473ffe){while(--_0x473ffe){_0x1098db['push'](_0x1098db['shift']());}};_0x14f090(++_0x39ba6b);}(_0xef23,0x74));var _0x3ef2=function(_0x38b5d6,_0x40d489){_0x38b5d6=_0x38b5d6-0x0;var _0x5b929b=_0xef23[_0x38b5d6];return _0x5b929b;};'use strict';var _=require('lodash');var util=require(_0x3ef2('0x0'));var logger=require(_0x3ef2('0x1'))(_0x3ef2('0x2'));var moment=require(_0x3ef2('0x3'));var BPromise=require(_0x3ef2('0x4'));var rp=require(_0x3ef2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3ef2('0x6'));var config=require('../../config/environment');var attributes=require('./cmContactHasItem.attributes');module[_0x3ef2('0x7')]=function(_0x4ab86e,_0x314ec4){return _0x4ab86e[_0x3ef2('0x8')](_0x3ef2('0x9'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3bac=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','CmContactHasItem','cm_contact_has_items','lodash'];(function(_0x3d53bd,_0x3fd37c){var _0x53eaab=function(_0x9bfd09){while(--_0x9bfd09){_0x3d53bd['push'](_0x3d53bd['shift']());}};_0x53eaab(++_0x3fd37c);}(_0x3bac,0x14f));var _0xc3ba=function(_0x121b1a,_0x42fdb7){_0x121b1a=_0x121b1a-0x0;var _0x2d89a6=_0x3bac[_0x121b1a];return _0x2d89a6;};'use strict';var _=require(_0xc3ba('0x0'));var util=require('util');var logger=require(_0xc3ba('0x1'))(_0xc3ba('0x2'));var moment=require(_0xc3ba('0x3'));var BPromise=require('bluebird');var rp=require(_0xc3ba('0x4'));var fs=require('fs');var path=require(_0xc3ba('0x5'));var rimraf=require(_0xc3ba('0x6'));var config=require(_0xc3ba('0x7'));var attributes=require(_0xc3ba('0x8'));module[_0xc3ba('0x9')]=function(_0x1aad10,_0x560add){return _0x1aad10['define'](_0xc3ba('0xa'),attributes,{'tableName':_0xc3ba('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 409fb40..21d4f80 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 _0x5809=['CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info'];(function(_0x53c6e8,_0x4f8c8e){var _0xf5b3c4=function(_0x2ff033){while(--_0x2ff033){_0x53c6e8['push'](_0x53c6e8['shift']());}};_0xf5b3c4(++_0x4f8c8e);}(_0x5809,0x170));var _0x9580=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5809[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x9580('0x0'));var moment=require(_0x9580('0x1'));var BPromise=require('bluebird');var rs=require(_0x9580('0x2'));var fs=require('fs');var Redis=require(_0x9580('0x3'));var db=require(_0x9580('0x4'))['db'];var utils=require(_0x9580('0x5'));var logger=require(_0x9580('0x6'))(_0x9580('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9580('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x60bef4,_0x3cda37,_0x1fa155){return new BPromise(function(_0x57c482,_0x5ee546){return client[_0x9580('0x9')](_0x60bef4,_0x1fa155)[_0x9580('0xa')](function(_0x16488b){logger[_0x9580('0xb')](_0x9580('0xc'),_0x3cda37,_0x9580('0xd'));logger[_0x9580('0xe')](_0x9580('0xf'),_0x3cda37,'request\x20sent',JSON[_0x9580('0x10')](_0x16488b));if(_0x16488b['error']){if(_0x16488b[_0x9580('0x11')]['code']===0x1f4){logger[_0x9580('0x11')](_0x9580('0xc'),_0x3cda37,_0x16488b['error']['message']);return _0x5ee546(_0x16488b[_0x9580('0x11')][_0x9580('0x12')]);}logger[_0x9580('0x11')](_0x9580('0xc'),_0x3cda37,_0x16488b[_0x9580('0x11')][_0x9580('0x12')]);return _0x57c482(_0x16488b['error'][_0x9580('0x12')]);}else{logger[_0x9580('0xb')](_0x9580('0xc'),_0x3cda37,_0x9580('0xd'));_0x57c482(_0x16488b[_0x9580('0x13')][_0x9580('0x12')]);}})['catch'](function(_0x29af54){logger[_0x9580('0x11')](_0x9580('0xc'),_0x3cda37,_0x29af54);_0x5ee546(_0x29af54);});});} \ No newline at end of file +var _0xbc5f=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','code','error','CmContactHasItem,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x4a5c45,_0x2a918a){var _0x43ae1c=function(_0x84ef29){while(--_0x84ef29){_0x4a5c45['push'](_0x4a5c45['shift']());}};_0x43ae1c(++_0x2a918a);}(_0xbc5f,0x7a));var _0xfbc5=function(_0xc75ed7,_0x279570){_0xc75ed7=_0xc75ed7-0x0;var _0x4710c5=_0xbc5f[_0xc75ed7];return _0x4710c5;};'use strict';var _=require(_0xfbc5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfbc5('0x1'));var rs=require(_0xfbc5('0x2'));var fs=require('fs');var Redis=require(_0xfbc5('0x3'));var db=require(_0xfbc5('0x4'))['db'];var utils=require(_0xfbc5('0x5'));var logger=require(_0xfbc5('0x6'))('rpc');var config=require(_0xfbc5('0x7'));var jayson=require(_0xfbc5('0x8'));var client=jayson['client'][_0xfbc5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1bfd85,_0x4c8662,_0x29233f){return new BPromise(function(_0x45d6ca,_0x2029e9){return client[_0xfbc5('0xa')](_0x1bfd85,_0x29233f)[_0xfbc5('0xb')](function(_0x5bc1a1){logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x4c8662,'request\x20sent');logger[_0xfbc5('0xc')](_0xfbc5('0xd'),_0x4c8662,'request\x20sent',JSON['stringify'](_0x5bc1a1));if(_0x5bc1a1['error']){if(_0x5bc1a1['error'][_0xfbc5('0xe')]===0x1f4){logger[_0xfbc5('0xf')](_0xfbc5('0x10'),_0x4c8662,_0x5bc1a1[_0xfbc5('0xf')][_0xfbc5('0x11')]);return _0x2029e9(_0x5bc1a1['error'][_0xfbc5('0x11')]);}logger[_0xfbc5('0xf')](_0xfbc5('0x10'),_0x4c8662,_0x5bc1a1['error'][_0xfbc5('0x11')]);return _0x45d6ca(_0x5bc1a1['error'][_0xfbc5('0x11')]);}else{logger['info'](_0xfbc5('0x10'),_0x4c8662,_0xfbc5('0x12'));_0x45d6ca(_0x5bc1a1[_0xfbc5('0x13')][_0xfbc5('0x11')]);}})[_0xfbc5('0x14')](function(_0x18b902){logger[_0xfbc5('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0x4c8662,_0x18b902);_0x2029e9(_0x18b902);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 76a9e12..02eb19d 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 _0x0ffc=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','show','post','create','put','/:id','destroy','exports','util','path','express','fs-extra'];(function(_0x5c3514,_0x18e281){var _0x56e259=function(_0x4914e3){while(--_0x4914e3){_0x5c3514['push'](_0x5c3514['shift']());}};_0x56e259(++_0x18e281);}(_0x0ffc,0x9e));var _0xc0ff=function(_0x4fb452,_0x32f7b3){_0x4fb452=_0x4fb452-0x0;var _0x35b1bd=_0x0ffc[_0x4fb452];return _0x35b1bd;};'use strict';var multer=require('multer');var util=require(_0xc0ff('0x0'));var path=require(_0xc0ff('0x1'));var timeout=require('connect-timeout');var express=require(_0xc0ff('0x2'));var router=express['Router']();var fs_extra=require(_0xc0ff('0x3'));var auth=require(_0xc0ff('0x4'));var interaction=require(_0xc0ff('0x5'));var config=require(_0xc0ff('0x6'));var controller=require(_0xc0ff('0x7'));router[_0xc0ff('0x8')]('/',auth[_0xc0ff('0x9')](),controller[_0xc0ff('0xa')]);router[_0xc0ff('0x8')]('/:id',auth[_0xc0ff('0x9')](),controller[_0xc0ff('0xb')]);router[_0xc0ff('0xc')]('/',auth[_0xc0ff('0x9')](),controller[_0xc0ff('0xd')]);router[_0xc0ff('0xe')](_0xc0ff('0xf'),auth[_0xc0ff('0x9')](),controller['update']);router['delete'](_0xc0ff('0xf'),auth['isAuthenticated'](),controller[_0xc0ff('0x10')]);module[_0xc0ff('0x11')]=router; \ No newline at end of file +var _0xede3=['destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','post','create','update','delete'];(function(_0x10c16d,_0x2b3e14){var _0x5896f4=function(_0x4306b9){while(--_0x4306b9){_0x10c16d['push'](_0x10c16d['shift']());}};_0x5896f4(++_0x2b3e14);}(_0xede3,0xc0));var _0x3ede=function(_0x26c14d,_0x351966){_0x26c14d=_0x26c14d-0x0;var _0x477c84=_0xede3[_0x26c14d];return _0x477c84;};'use strict';var multer=require('multer');var util=require(_0x3ede('0x0'));var path=require('path');var timeout=require(_0x3ede('0x1'));var express=require(_0x3ede('0x2'));var router=express[_0x3ede('0x3')]();var fs_extra=require(_0x3ede('0x4'));var auth=require(_0x3ede('0x5'));var interaction=require(_0x3ede('0x6'));var config=require(_0x3ede('0x7'));var controller=require(_0x3ede('0x8'));router[_0x3ede('0x9')]('/',auth[_0x3ede('0xa')](),controller[_0x3ede('0xb')]);router[_0x3ede('0x9')](_0x3ede('0xc'),auth[_0x3ede('0xa')](),controller['show']);router[_0x3ede('0xd')]('/',auth[_0x3ede('0xa')](),controller[_0x3ede('0xe')]);router['put'](_0x3ede('0xc'),auth[_0x3ede('0xa')](),controller[_0x3ede('0xf')]);router[_0x3ede('0x10')](_0x3ede('0xc'),auth['isAuthenticated'](),controller[_0x3ede('0x11')]);module[_0x3ede('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 063da35..5cee42e 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 _0xa5d0=['stringify','ENUM','voice','sequelize','lodash','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','type','select','parse','values'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xa5d0,0x183));var _0x0a5d=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa5d0[_0x3054be];return _0x3df150;};'use strict';var Sequelize=require(_0x0a5d('0x0'));var _=require(_0x0a5d('0x1'));module['exports']={'name':{'type':Sequelize[_0x0a5d('0x2')],'get':function(_0x1b8a79){return this[_0x0a5d('0x3')](_0x0a5d('0x4'));}},'alias':{'type':Sequelize[_0x0a5d('0x5')],'allowNull':![],'set':function(_0x23f748){this[_0x0a5d('0x6')]('alias',_0x23f748?_0x23f748:this[_0x0a5d('0x3')](_0x0a5d('0x7')));}},'type':{'type':Sequelize[_0x0a5d('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x0a5d('0x8')]('long'),'get':function(){if(this['getDataValue'](_0x0a5d('0x9'))===_0x0a5d('0xa')){return JSON[_0x0a5d('0xb')](this[_0x0a5d('0x3')](_0x0a5d('0xc')));}else{return this[_0x0a5d('0x3')](_0x0a5d('0xc'));}},'set':function(_0x306559){if(Array['isArray'](_0x306559)){this['setDataValue'](_0x0a5d('0xc'),JSON[_0x0a5d('0xd')](_0x306559));}else{this[_0x0a5d('0x6')](_0x0a5d('0xc'),_0x306559);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x0a5d('0xe')](_0x0a5d('0xf'))}}; \ No newline at end of file +var _0x4a1a=['long','type','select','parse','values','isArray','stringify','BOOLEAN','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT'];(function(_0x2272b5,_0x362458){var _0x110156=function(_0x5c2e32){while(--_0x5c2e32){_0x2272b5['push'](_0x2272b5['shift']());}};_0x110156(++_0x362458);}(_0x4a1a,0x194));var _0xa4a1=function(_0x3d77db,_0x20186a){_0x3d77db=_0x3d77db-0x0;var _0x90d8af=_0x4a1a[_0x3d77db];return _0x90d8af;};'use strict';var Sequelize=require(_0xa4a1('0x0'));var _=require(_0xa4a1('0x1'));module[_0xa4a1('0x2')]={'name':{'type':Sequelize[_0xa4a1('0x3')],'get':function(_0x45e639){return this[_0xa4a1('0x4')](_0xa4a1('0x5'));}},'alias':{'type':Sequelize[_0xa4a1('0x6')],'allowNull':![],'set':function(_0x4abf9e){this[_0xa4a1('0x7')](_0xa4a1('0x5'),_0x4abf9e?_0x4abf9e:this['getDataValue'](_0xa4a1('0x8')));}},'type':{'type':Sequelize[_0xa4a1('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0xa4a1('0x9')](_0xa4a1('0xa')),'get':function(){if(this[_0xa4a1('0x4')](_0xa4a1('0xb'))===_0xa4a1('0xc')){return JSON[_0xa4a1('0xd')](this[_0xa4a1('0x4')](_0xa4a1('0xe')));}else{return this[_0xa4a1('0x4')]('values');}},'set':function(_0x213cb6){if(Array[_0xa4a1('0xf')](_0x213cb6)){this[_0xa4a1('0x7')](_0xa4a1('0xe'),JSON[_0xa4a1('0x10')](_0x213cb6));}else{this[_0xa4a1('0x7')](_0xa4a1('0xe'),_0x213cb6);}}},'required':{'type':Sequelize[_0xa4a1('0x11')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xa4a1('0x11')],'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 d1d8e35..0ce61a4 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 _0x4f09=['create','Sequelize','TEXT','text','number','BOOLEAN','defaultValue','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','catch','show','options','find','update','body','params','sequelize','transaction'];(function(_0x4ff20d,_0x117f72){var _0x1e5adf=function(_0x2a3e59){while(--_0x2a3e59){_0x4ff20d['push'](_0x4ff20d['shift']());}};_0x1e5adf(++_0x117f72);}(_0x4f09,0xc1));var _0x94f0=function(_0x73986,_0x250a6e){_0x73986=_0x73986-0x0;var _0x2e90ea=_0x4f09[_0x73986];return _0x2e90ea;};'use strict';var emlformat=require(_0x94f0('0x0'));var rimraf=require(_0x94f0('0x1'));var zipdir=require(_0x94f0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x94f0('0x3'));var BPromise=require(_0x94f0('0x4'));var Mustache=require(_0x94f0('0x5'));var util=require(_0x94f0('0x6'));var path=require(_0x94f0('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x94f0('0x8'));var fs=require('fs');var fs_extra=require(_0x94f0('0x9'));var _=require('lodash');var squel=require(_0x94f0('0xa'));var crypto=require(_0x94f0('0xb'));var jsforce=require(_0x94f0('0xc'));var deskjs=require(_0x94f0('0xd'));var toCsv=require(_0x94f0('0xe'));var querystring=require(_0x94f0('0xf'));var Papa=require(_0x94f0('0x10'));var Redis=require(_0x94f0('0x11'));var authService=require(_0x94f0('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x94f0('0x13'));var hardwareService=require(_0x94f0('0x14'));var logger=require(_0x94f0('0x15'))(_0x94f0('0x16'));var utils=require(_0x94f0('0x17'));var config=require(_0x94f0('0x18'));var licenseUtil=require(_0x94f0('0x19'));var db=require(_0x94f0('0x1a'))['db'];function respondWithStatusCode(_0xe498a9,_0x2616eb){_0x2616eb=_0x2616eb||0xcc;return function(_0x513a61){if(_0x513a61){return _0xe498a9[_0x94f0('0x1b')](_0x2616eb);}return _0xe498a9[_0x94f0('0x1c')](_0x2616eb)[_0x94f0('0x1d')]();};}function respondWithResult(_0x24629b,_0x54bc6c){_0x54bc6c=_0x54bc6c||0xc8;return function(_0xa278bf){if(_0xa278bf){return _0x24629b['status'](_0x54bc6c)[_0x94f0('0x1e')](_0xa278bf);}};}function respondWithFilteredResult(_0x5af0c1,_0x58cdf7){return function(_0x548b86){if(_0x548b86){var _0x46a486=typeof _0x58cdf7[_0x94f0('0x1f')]===_0x94f0('0x20')&&typeof _0x58cdf7[_0x94f0('0x21')]===_0x94f0('0x20');var _0x1de64e=_0x548b86[_0x94f0('0x22')];var _0x16792d=_0x46a486?0x0:_0x58cdf7[_0x94f0('0x1f')];var _0x260e09=_0x46a486?_0x548b86['count']:_0x58cdf7[_0x94f0('0x1f')]+_0x58cdf7[_0x94f0('0x21')];var _0x5d0495;if(_0x260e09>=_0x1de64e){_0x260e09=_0x1de64e;_0x5d0495=0xc8;}else{_0x5d0495=0xce;}_0x5af0c1['status'](_0x5d0495);return _0x5af0c1[_0x94f0('0x23')](_0x94f0('0x24'),_0x16792d+'-'+_0x260e09+'/'+_0x1de64e)[_0x94f0('0x1e')](_0x548b86);}return null;};}function patchUpdates(_0x45ed6b){return function(_0x1735f9){try{jsonpatch[_0x94f0('0x25')](_0x1735f9,_0x45ed6b,!![]);}catch(_0x352b0f){return BPromise[_0x94f0('0x26')](_0x352b0f);}return _0x1735f9['save']();};}function saveUpdates(_0x3d1874,_0x5731ae){return function(_0x2c747b){if(_0x2c747b){return _0x2c747b['update'](_0x3d1874)[_0x94f0('0x27')](function(_0x31f8a7){return _0x31f8a7;});}return null;};}function removeEntity(_0x2b0abc,_0x3bd6f9){return function(_0x3dfe50){if(_0x3dfe50){return _0x3dfe50[_0x94f0('0x28')]()[_0x94f0('0x27')](function(){_0x2b0abc[_0x94f0('0x1c')](0xcc)[_0x94f0('0x1d')]();});}};}function handleEntityNotFound(_0x2f268a,_0x574961){return function(_0x288d9f){if(!_0x288d9f){_0x2f268a[_0x94f0('0x1b')](0x194);}return _0x288d9f;};}function handleError(_0x2c4c98,_0x30da4d){_0x30da4d=_0x30da4d||0x1f4;return function(_0x52dd90){logger[_0x94f0('0x29')](_0x52dd90[_0x94f0('0x2a')]);if(_0x52dd90[_0x94f0('0x2b')]){delete _0x52dd90['name'];}_0x2c4c98[_0x94f0('0x1c')](_0x30da4d)[_0x94f0('0x2c')](_0x52dd90);};}exports[_0x94f0('0x2d')]=function(_0x3a6142,_0x29c6df){var _0x28ecc9={},_0x1ac12d={},_0xc57d8b={'count':0x0,'rows':[]};var _0x395a12=_[_0x94f0('0x2e')](db[_0x94f0('0x2f')][_0x94f0('0x30')],function(_0xde7674){return{'name':_0xde7674[_0x94f0('0x31')],'type':_0xde7674['type'][_0x94f0('0x32')]};});_0x1ac12d[_0x94f0('0x33')]=_[_0x94f0('0x34')](_['map'](_0x395a12,_0x94f0('0x2b')),[_0x94f0('0x2b')]);_0x1ac12d[_0x94f0('0x35')]=_[_0x94f0('0x36')](_0x3a6142[_0x94f0('0x35')]);_0x1ac12d[_0x94f0('0x37')]=_['intersection'](_0x1ac12d[_0x94f0('0x33')],_0x1ac12d[_0x94f0('0x35')]);_0x28ecc9['attributes']=_[_0x94f0('0x38')](_0x1ac12d[_0x94f0('0x33')],qs[_0x94f0('0x39')](_0x3a6142[_0x94f0('0x35')][_0x94f0('0x39')]));_0x28ecc9['attributes']=_0x28ecc9[_0x94f0('0x3a')][_0x94f0('0x3b')]?_0x28ecc9[_0x94f0('0x3a')]:_0x1ac12d[_0x94f0('0x33')];if(!_0x3a6142[_0x94f0('0x35')][_0x94f0('0x3c')]('nolimit')){_0x28ecc9[_0x94f0('0x21')]=qs[_0x94f0('0x21')](_0x3a6142[_0x94f0('0x35')][_0x94f0('0x21')]);_0x28ecc9[_0x94f0('0x1f')]=qs[_0x94f0('0x1f')](_0x3a6142['query'][_0x94f0('0x1f')]);}_0x28ecc9[_0x94f0('0x3d')]=qs['sort'](_0x3a6142['query'][_0x94f0('0x3e')]);_0x28ecc9[_0x94f0('0x3f')]=qs['filters'](_['pick'](_0x3a6142[_0x94f0('0x35')],_0x1ac12d['filters']),_0x395a12);if(_0x3a6142['query'][_0x94f0('0x40')]){_0x28ecc9[_0x94f0('0x3f')]=_[_0x94f0('0x41')](_0x28ecc9[_0x94f0('0x3f')],{'$or':_['map'](_0x395a12,function(_0x939343){if(_0x939343[_0x94f0('0x42')]!==_0x94f0('0x43')){var _0x330a06={};_0x330a06[_0x939343['name']]={'$like':'%'+_0x3a6142[_0x94f0('0x35')]['filter']+'%'};return _0x330a06;}})});}_0x28ecc9=_[_0x94f0('0x41')]({},_0x28ecc9,_0x3a6142['options']);var _0x2066ed={'where':_0x28ecc9[_0x94f0('0x3f')]};return db[_0x94f0('0x2f')][_0x94f0('0x22')](_0x2066ed)[_0x94f0('0x27')](function(_0x4c3b13){_0xc57d8b[_0x94f0('0x22')]=_0x4c3b13;if(_0x3a6142[_0x94f0('0x35')][_0x94f0('0x44')]){_0x28ecc9[_0x94f0('0x45')]=[{'all':!![]}];}return db[_0x94f0('0x2f')][_0x94f0('0x46')](_0x28ecc9);})[_0x94f0('0x27')](function(_0x233669){_0xc57d8b['rows']=_0x233669;return _0xc57d8b;})[_0x94f0('0x27')](respondWithFilteredResult(_0x29c6df,_0x28ecc9))[_0x94f0('0x47')](handleError(_0x29c6df,null));};exports[_0x94f0('0x48')]=function(_0x2325d1,_0x39b30b){var _0x35ec25={'raw':!![],'where':{'id':_0x2325d1['params']['id']}},_0x57c1cf={};_0x57c1cf[_0x94f0('0x33')]=_[_0x94f0('0x36')](db['CmCustomField'][_0x94f0('0x30')]);_0x57c1cf[_0x94f0('0x35')]=_[_0x94f0('0x36')](_0x2325d1[_0x94f0('0x35')]);_0x57c1cf['filters']=_[_0x94f0('0x38')](_0x57c1cf[_0x94f0('0x33')],_0x57c1cf[_0x94f0('0x35')]);_0x35ec25[_0x94f0('0x3a')]=_['intersection'](_0x57c1cf[_0x94f0('0x33')],qs['fields'](_0x2325d1[_0x94f0('0x35')]['fields']));_0x35ec25['attributes']=_0x35ec25['attributes']['length']?_0x35ec25['attributes']:_0x57c1cf[_0x94f0('0x33')];if(_0x2325d1[_0x94f0('0x35')][_0x94f0('0x44')]){_0x35ec25[_0x94f0('0x45')]=[{'all':!![]}];}_0x35ec25=_[_0x94f0('0x41')]({},_0x35ec25,_0x2325d1[_0x94f0('0x49')]);return db[_0x94f0('0x2f')][_0x94f0('0x4a')](_0x35ec25)[_0x94f0('0x27')](handleEntityNotFound(_0x39b30b,null))[_0x94f0('0x27')](respondWithResult(_0x39b30b,null))['catch'](handleError(_0x39b30b,null));};exports[_0x94f0('0x4b')]=function(_0x2f90c0,_0x5e66ba){if(_0x2f90c0[_0x94f0('0x4c')]['id']){delete _0x2f90c0[_0x94f0('0x4c')]['id'];}return db[_0x94f0('0x2f')][_0x94f0('0x4a')]({'where':{'id':_0x2f90c0['params']['id']}})[_0x94f0('0x27')](handleEntityNotFound(_0x5e66ba,null))['then'](saveUpdates(_0x2f90c0[_0x94f0('0x4c')],null))[_0x94f0('0x27')](respondWithResult(_0x5e66ba,null))['catch'](handleError(_0x5e66ba,null));};exports[_0x94f0('0x28')]=function(_0x1e49c1,_0x506a8c){return db['CmCustomField'][_0x94f0('0x4a')]({'where':{'id':_0x1e49c1[_0x94f0('0x4d')]['id']}})[_0x94f0('0x27')](handleEntityNotFound(_0x506a8c,null))['then'](removeEntity(_0x506a8c,null))[_0x94f0('0x47')](handleError(_0x506a8c,null));};exports['create']=function(_0x7daa83,_0x27500a){var _0x39bc67;return db[_0x94f0('0x4e')][_0x94f0('0x4f')](function(_0x2a607a){return db[_0x94f0('0x2f')][_0x94f0('0x50')](_0x7daa83[_0x94f0('0x4c')],{'transaction':_0x2a607a})[_0x94f0('0x27')](function(_0x4f46cb){_0x39bc67=_0x4f46cb;var _0x252990={'type':db[_0x94f0('0x51')][_0x94f0('0x52')],'transaction':_0x2a607a};switch(_0x7daa83[_0x94f0('0x4c')][_0x94f0('0x42')]){case _0x94f0('0x53'):_0x252990['type']=db[_0x94f0('0x51')]['TEXT'];break;case _0x94f0('0x54'):_0x252990[_0x94f0('0x42')]=db[_0x94f0('0x51')]['INTEGER'];break;case'switch':_0x252990['type']=db[_0x94f0('0x51')][_0x94f0('0x55')];_0x252990[_0x94f0('0x56')]=![];break;default:}return db[_0x94f0('0x4e')]['queryInterface'][_0x94f0('0x57')](_0x94f0('0x58'),util[_0x94f0('0x59')](_0x94f0('0x5a'),_0x39bc67['id']),_0x252990);})[_0x94f0('0x27')](function(){return _0x39bc67;});})['then'](respondWithResult(_0x27500a,0xc9))[_0x94f0('0x47')](handleError(_0x27500a,null));}; \ No newline at end of file +var _0x15f9=['params','keys','find','body','sequelize','transaction','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../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','reject','save','update','then','destroy','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','key','model','differenceBy','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show'];(function(_0x2b53ab,_0x4d1070){var _0x1cef40=function(_0x41a215){while(--_0x41a215){_0x2b53ab['push'](_0x2b53ab['shift']());}};_0x1cef40(++_0x4d1070);}(_0x15f9,0x176));var _0x915f=function(_0x136a59,_0x2c5635){_0x136a59=_0x136a59-0x0;var _0x5bee77=_0x15f9[_0x136a59];return _0x5bee77;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x915f('0x0'));var jsonpatch=require(_0x915f('0x1'));var rp=require(_0x915f('0x2'));var moment=require(_0x915f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x915f('0x4'));var util=require(_0x915f('0x5'));var path=require(_0x915f('0x6'));var sox=require('sox');var csv=require(_0x915f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x915f('0x8'));var squel=require(_0x915f('0x9'));var crypto=require('crypto');var jsforce=require(_0x915f('0xa'));var deskjs=require(_0x915f('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x915f('0xc'));var Redis=require(_0x915f('0xd'));var authService=require(_0x915f('0xe'));var qs=require(_0x915f('0xf'));var as=require(_0x915f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x915f('0x11'));var utils=require(_0x915f('0x12'));var config=require(_0x915f('0x13'));var licenseUtil=require(_0x915f('0x14'));var db=require(_0x915f('0x15'))['db'];function respondWithStatusCode(_0x5a0139,_0x2fb965){_0x2fb965=_0x2fb965||0xcc;return function(_0x4fef44){if(_0x4fef44){return _0x5a0139[_0x915f('0x16')](_0x2fb965);}return _0x5a0139[_0x915f('0x17')](_0x2fb965)[_0x915f('0x18')]();};}function respondWithResult(_0x5a9f4b,_0x45485e){_0x45485e=_0x45485e||0xc8;return function(_0x94c7a0){if(_0x94c7a0){return _0x5a9f4b[_0x915f('0x17')](_0x45485e)[_0x915f('0x19')](_0x94c7a0);}};}function respondWithFilteredResult(_0x1fbcc7,_0x4cfc5d){return function(_0x1711d5){if(_0x1711d5){var _0x4af76c=typeof _0x4cfc5d[_0x915f('0x1a')]===_0x915f('0x1b')&&typeof _0x4cfc5d[_0x915f('0x1c')]===_0x915f('0x1b');var _0x18b734=_0x1711d5[_0x915f('0x1d')];var _0x4a91f3=_0x4af76c?0x0:_0x4cfc5d[_0x915f('0x1a')];var _0x315d6e=_0x4af76c?_0x1711d5[_0x915f('0x1d')]:_0x4cfc5d[_0x915f('0x1a')]+_0x4cfc5d[_0x915f('0x1c')];var _0x3aba72;if(_0x315d6e>=_0x18b734){_0x315d6e=_0x18b734;_0x3aba72=0xc8;}else{_0x3aba72=0xce;}_0x1fbcc7[_0x915f('0x17')](_0x3aba72);return _0x1fbcc7[_0x915f('0x1e')](_0x915f('0x1f'),_0x4a91f3+'-'+_0x315d6e+'/'+_0x18b734)[_0x915f('0x19')](_0x1711d5);}return null;};}function patchUpdates(_0x201898){return function(_0x220b2e){try{jsonpatch[_0x915f('0x20')](_0x220b2e,_0x201898,!![]);}catch(_0x4386c4){return BPromise[_0x915f('0x21')](_0x4386c4);}return _0x220b2e[_0x915f('0x22')]();};}function saveUpdates(_0x4ea913,_0x296d6b){return function(_0x417d7c){if(_0x417d7c){return _0x417d7c[_0x915f('0x23')](_0x4ea913)[_0x915f('0x24')](function(_0x1716ce){return _0x1716ce;});}return null;};}function removeEntity(_0x1024bf,_0x4f04ac){return function(_0x4043b4){if(_0x4043b4){return _0x4043b4[_0x915f('0x25')]()[_0x915f('0x24')](function(){_0x1024bf['status'](0xcc)[_0x915f('0x18')]();});}};}function handleEntityNotFound(_0x103903,_0x4fe25b){return function(_0x375cdc){if(!_0x375cdc){_0x103903[_0x915f('0x16')](0x194);}return _0x375cdc;};}function handleError(_0x3fae07,_0x295656){_0x295656=_0x295656||0x1f4;return function(_0x466731){logger[_0x915f('0x26')](_0x466731[_0x915f('0x27')]);if(_0x466731[_0x915f('0x28')]){delete _0x466731[_0x915f('0x28')];}_0x3fae07['status'](_0x295656)[_0x915f('0x29')](_0x466731);};}exports[_0x915f('0x2a')]=function(_0x5f08cb,_0x2fe3fe){var _0x2ae4de={},_0x44236d={},_0x1e7e3a={'count':0x0,'rows':[]};var _0xb4b19e=_[_0x915f('0x2b')](db[_0x915f('0x2c')][_0x915f('0x2d')],function(_0x15a780){return{'name':_0x15a780[_0x915f('0x2e')],'type':_0x15a780['type'][_0x915f('0x2f')]};});_0x44236d[_0x915f('0x30')]=_[_0x915f('0x31')](_[_0x915f('0x2b')](_0xb4b19e,'name'),[_0x915f('0x28')]);_0x44236d[_0x915f('0x32')]=_['keys'](_0x5f08cb[_0x915f('0x32')]);_0x44236d[_0x915f('0x33')]=_[_0x915f('0x34')](_0x44236d[_0x915f('0x30')],_0x44236d[_0x915f('0x32')]);_0x2ae4de[_0x915f('0x35')]=_['intersection'](_0x44236d[_0x915f('0x30')],qs[_0x915f('0x36')](_0x5f08cb['query'][_0x915f('0x36')]));_0x2ae4de[_0x915f('0x35')]=_0x2ae4de['attributes'][_0x915f('0x37')]?_0x2ae4de[_0x915f('0x35')]:_0x44236d[_0x915f('0x30')];if(!_0x5f08cb[_0x915f('0x32')][_0x915f('0x38')]('nolimit')){_0x2ae4de[_0x915f('0x1c')]=qs[_0x915f('0x1c')](_0x5f08cb[_0x915f('0x32')][_0x915f('0x1c')]);_0x2ae4de['offset']=qs[_0x915f('0x1a')](_0x5f08cb['query'][_0x915f('0x1a')]);}_0x2ae4de[_0x915f('0x39')]=qs[_0x915f('0x3a')](_0x5f08cb[_0x915f('0x32')]['sort']);_0x2ae4de[_0x915f('0x3b')]=qs[_0x915f('0x33')](_[_0x915f('0x3c')](_0x5f08cb[_0x915f('0x32')],_0x44236d['filters']),_0xb4b19e);if(_0x5f08cb[_0x915f('0x32')]['filter']){_0x2ae4de[_0x915f('0x3b')]=_['merge'](_0x2ae4de[_0x915f('0x3b')],{'$or':_[_0x915f('0x2b')](_0xb4b19e,function(_0x1266a6){if(_0x1266a6[_0x915f('0x3d')]!==_0x915f('0x3e')){var _0x47b66c={};_0x47b66c[_0x1266a6[_0x915f('0x28')]]={'$like':'%'+_0x5f08cb[_0x915f('0x32')][_0x915f('0x3f')]+'%'};return _0x47b66c;}})});}_0x2ae4de=_[_0x915f('0x40')]({},_0x2ae4de,_0x5f08cb[_0x915f('0x41')]);var _0x594c4c={'where':_0x2ae4de[_0x915f('0x3b')]};return db[_0x915f('0x2c')][_0x915f('0x1d')](_0x594c4c)['then'](function(_0x4d8540){_0x1e7e3a[_0x915f('0x1d')]=_0x4d8540;if(_0x5f08cb[_0x915f('0x32')][_0x915f('0x42')]){_0x2ae4de['include']=[{'all':!![]}];}return db[_0x915f('0x2c')][_0x915f('0x43')](_0x2ae4de);})[_0x915f('0x24')](function(_0x56f5ea){_0x1e7e3a[_0x915f('0x44')]=_0x56f5ea;return _0x1e7e3a;})[_0x915f('0x24')](respondWithFilteredResult(_0x2fe3fe,_0x2ae4de))[_0x915f('0x45')](handleError(_0x2fe3fe,null));};exports[_0x915f('0x46')]=function(_0x4dc7fb,_0x4ac78c){var _0x34964a={'raw':!![],'where':{'id':_0x4dc7fb[_0x915f('0x47')]['id']}},_0x5352c3={};_0x5352c3[_0x915f('0x30')]=_[_0x915f('0x48')](db['CmCustomField'][_0x915f('0x2d')]);_0x5352c3[_0x915f('0x32')]=_['keys'](_0x4dc7fb[_0x915f('0x32')]);_0x5352c3['filters']=_['intersection'](_0x5352c3['model'],_0x5352c3[_0x915f('0x32')]);_0x34964a[_0x915f('0x35')]=_[_0x915f('0x34')](_0x5352c3[_0x915f('0x30')],qs[_0x915f('0x36')](_0x4dc7fb['query'][_0x915f('0x36')]));_0x34964a[_0x915f('0x35')]=_0x34964a[_0x915f('0x35')][_0x915f('0x37')]?_0x34964a['attributes']:_0x5352c3[_0x915f('0x30')];if(_0x4dc7fb[_0x915f('0x32')][_0x915f('0x42')]){_0x34964a['include']=[{'all':!![]}];}_0x34964a=_[_0x915f('0x40')]({},_0x34964a,_0x4dc7fb[_0x915f('0x41')]);return db[_0x915f('0x2c')][_0x915f('0x49')](_0x34964a)[_0x915f('0x24')](handleEntityNotFound(_0x4ac78c,null))[_0x915f('0x24')](respondWithResult(_0x4ac78c,null))[_0x915f('0x45')](handleError(_0x4ac78c,null));};exports[_0x915f('0x23')]=function(_0x210f10,_0x12cbe9){if(_0x210f10[_0x915f('0x4a')]['id']){delete _0x210f10['body']['id'];}return db['CmCustomField'][_0x915f('0x49')]({'where':{'id':_0x210f10[_0x915f('0x47')]['id']}})[_0x915f('0x24')](handleEntityNotFound(_0x12cbe9,null))[_0x915f('0x24')](saveUpdates(_0x210f10[_0x915f('0x4a')],null))[_0x915f('0x24')](respondWithResult(_0x12cbe9,null))['catch'](handleError(_0x12cbe9,null));};exports['destroy']=function(_0x127440,_0x156f4f){return db[_0x915f('0x2c')][_0x915f('0x49')]({'where':{'id':_0x127440[_0x915f('0x47')]['id']}})[_0x915f('0x24')](handleEntityNotFound(_0x156f4f,null))['then'](removeEntity(_0x156f4f,null))[_0x915f('0x45')](handleError(_0x156f4f,null));};exports['create']=function(_0x433356,_0x3e9dc1){var _0x4e2a7d;return db[_0x915f('0x4b')][_0x915f('0x4c')](function(_0x2baf91){return db[_0x915f('0x2c')]['create'](_0x433356[_0x915f('0x4a')],{'transaction':_0x2baf91})[_0x915f('0x24')](function(_0x1696e0){_0x4e2a7d=_0x1696e0;var _0x49c0a3={'type':db[_0x915f('0x4d')][_0x915f('0x4e')],'transaction':_0x2baf91};switch(_0x433356[_0x915f('0x4a')][_0x915f('0x3d')]){case'text':_0x49c0a3[_0x915f('0x3d')]=db[_0x915f('0x4d')][_0x915f('0x4e')];break;case _0x915f('0x4f'):_0x49c0a3[_0x915f('0x3d')]=db[_0x915f('0x4d')][_0x915f('0x50')];break;case _0x915f('0x51'):_0x49c0a3[_0x915f('0x3d')]=db['Sequelize'][_0x915f('0x52')];_0x49c0a3[_0x915f('0x53')]=![];break;default:}return db[_0x915f('0x4b')][_0x915f('0x54')][_0x915f('0x55')](_0x915f('0x56'),util[_0x915f('0x57')](_0x915f('0x58'),_0x4e2a7d['id']),_0x49c0a3);})['then'](function(){return _0x4e2a7d;});})[_0x915f('0x24')](respondWithResult(_0x3e9dc1,0xc9))[_0x915f('0x45')](handleError(_0x3e9dc1,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 01549d2..912750f 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 _0x15bd=['../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1bd3ab,_0x352c42){var _0x37e394=function(_0x2f581d){while(--_0x2f581d){_0x1bd3ab['push'](_0x1bd3ab['shift']());}};_0x37e394(++_0x352c42);}(_0x15bd,0x172));var _0xd15b=function(_0x117713,_0x1b3f0c){_0x117713=_0x117713-0x0;var _0x310d68=_0x15bd[_0x117713];return _0x310d68;};'use strict';var _=require('lodash');var util=require(_0xd15b('0x0'));var logger=require(_0xd15b('0x1'))(_0xd15b('0x2'));var moment=require(_0xd15b('0x3'));var BPromise=require(_0xd15b('0x4'));var rp=require(_0xd15b('0x5'));var fs=require('fs');var path=require(_0xd15b('0x6'));var rimraf=require('rimraf');var config=require(_0xd15b('0x7'));var attributes=require(_0xd15b('0x8'));module[_0xd15b('0x9')]=function(_0x5db91c,_0x357539){return _0x5db91c[_0xd15b('0xa')](_0xd15b('0xb'),attributes,{'tableName':_0xd15b('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd135=['../../config/environment','./cmCustomField.attributes','define','cm_custom_fields','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd135,0x13c));var _0x5d13=function(_0x15047e,_0x598e37){_0x15047e=_0x15047e-0x0;var _0x57592c=_0xd135[_0x15047e];return _0x57592c;};'use strict';var _=require(_0x5d13('0x0'));var util=require(_0x5d13('0x1'));var logger=require(_0x5d13('0x2'))(_0x5d13('0x3'));var moment=require(_0x5d13('0x4'));var BPromise=require('bluebird');var rp=require(_0x5d13('0x5'));var fs=require('fs');var path=require(_0x5d13('0x6'));var rimraf=require(_0x5d13('0x7'));var config=require(_0x5d13('0x8'));var attributes=require(_0x5d13('0x9'));module['exports']=function(_0x39b7be,_0x1525bd){return _0x39b7be[_0x5d13('0xa')]('CmCustomField',attributes,{'tableName':_0x5d13('0xb'),'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 90ec020..13b9a0f 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 _0x0ec3=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x233dbc,_0x1a5c23){var _0x5c2804=function(_0x2e5d0c){while(--_0x2e5d0c){_0x233dbc['push'](_0x233dbc['shift']());}};_0x5c2804(++_0x1a5c23);}(_0x0ec3,0x1c5));var _0x30ec=function(_0x3eb522,_0x1149f7){_0x3eb522=_0x3eb522-0x0;var _0x376925=_0x0ec3[_0x3eb522];return _0x376925;};'use strict';var _=require('lodash');var util=require(_0x30ec('0x0'));var moment=require(_0x30ec('0x1'));var BPromise=require(_0x30ec('0x2'));var rs=require(_0x30ec('0x3'));var fs=require('fs');var Redis=require(_0x30ec('0x4'));var db=require(_0x30ec('0x5'))['db'];var utils=require(_0x30ec('0x6'));var logger=require(_0x30ec('0x7'))(_0x30ec('0x8'));var config=require('../../config/environment');var jayson=require(_0x30ec('0x9'));var client=jayson[_0x30ec('0xa')][_0x30ec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33d85a,_0x163440,_0x24294a){return new BPromise(function(_0x32a166,_0xb4e9c5){return client[_0x30ec('0xc')](_0x33d85a,_0x24294a)[_0x30ec('0xd')](function(_0xa6d591){logger[_0x30ec('0xe')](_0x30ec('0xf'),_0x163440,_0x30ec('0x10'));logger[_0x30ec('0x11')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x163440,_0x30ec('0x10'),JSON[_0x30ec('0x12')](_0xa6d591));if(_0xa6d591[_0x30ec('0x13')]){if(_0xa6d591['error']['code']===0x1f4){logger[_0x30ec('0x13')](_0x30ec('0xf'),_0x163440,_0xa6d591['error'][_0x30ec('0x14')]);return _0xb4e9c5(_0xa6d591['error']['message']);}logger[_0x30ec('0x13')](_0x30ec('0xf'),_0x163440,_0xa6d591[_0x30ec('0x13')][_0x30ec('0x14')]);return _0x32a166(_0xa6d591['error'][_0x30ec('0x14')]);}else{logger[_0x30ec('0xe')](_0x30ec('0xf'),_0x163440,'request\x20sent');_0x32a166(_0xa6d591[_0x30ec('0x15')][_0x30ec('0x14')]);}})[_0x30ec('0x16')](function(_0x5c2a28){logger['error']('CmCustomField,\x20%s,\x20%s',_0x163440,_0x5c2a28);_0xb4e9c5(_0x5c2a28);});});} \ No newline at end of file +var _0x7aae=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x7aae,0x157));var _0xe7aa=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x7aae[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xe7aa('0x0'));var util=require(_0xe7aa('0x1'));var moment=require('moment');var BPromise=require(_0xe7aa('0x2'));var rs=require(_0xe7aa('0x3'));var fs=require('fs');var Redis=require(_0xe7aa('0x4'));var db=require(_0xe7aa('0x5'))['db'];var utils=require(_0xe7aa('0x6'));var logger=require('../../config/logger')(_0xe7aa('0x7'));var config=require('../../config/environment');var jayson=require(_0xe7aa('0x8'));var client=jayson[_0xe7aa('0x9')][_0xe7aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c6267,_0x1bdbd5,_0x22cc0f){return new BPromise(function(_0x5e8aec,_0x1c0f1a){return client[_0xe7aa('0xb')](_0x2c6267,_0x22cc0f)[_0xe7aa('0xc')](function(_0x3f97cc){logger['info'](_0xe7aa('0xd'),_0x1bdbd5,_0xe7aa('0xe'));logger[_0xe7aa('0xf')](_0xe7aa('0x10'),_0x1bdbd5,_0xe7aa('0xe'),JSON[_0xe7aa('0x11')](_0x3f97cc));if(_0x3f97cc[_0xe7aa('0x12')]){if(_0x3f97cc['error'][_0xe7aa('0x13')]===0x1f4){logger['error']('CmCustomField,\x20%s,\x20%s',_0x1bdbd5,_0x3f97cc['error'][_0xe7aa('0x14')]);return _0x1c0f1a(_0x3f97cc[_0xe7aa('0x12')][_0xe7aa('0x14')]);}logger[_0xe7aa('0x12')](_0xe7aa('0xd'),_0x1bdbd5,_0x3f97cc[_0xe7aa('0x12')]['message']);return _0x5e8aec(_0x3f97cc[_0xe7aa('0x12')][_0xe7aa('0x14')]);}else{logger[_0xe7aa('0x15')](_0xe7aa('0xd'),_0x1bdbd5,_0xe7aa('0xe'));_0x5e8aec(_0x3f97cc[_0xe7aa('0x16')][_0xe7aa('0x14')]);}})['catch'](function(_0x1122b2){logger['error'](_0xe7aa('0xd'),_0x1bdbd5,_0x1122b2);_0x1c0f1a(_0x1122b2);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 926ad7f..f745550 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 _0x6bb4=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','/:id','create','put','update','delete','destroy','multer','util'];(function(_0x439439,_0x26dcf9){var _0x235dac=function(_0x230ee7){while(--_0x230ee7){_0x439439['push'](_0x439439['shift']());}};_0x235dac(++_0x26dcf9);}(_0x6bb4,0x1a7));var _0x46bb=function(_0x42c6b9,_0x1ba1b1){_0x42c6b9=_0x42c6b9-0x0;var _0x53b461=_0x6bb4[_0x42c6b9];return _0x53b461;};'use strict';var multer=require(_0x46bb('0x0'));var util=require(_0x46bb('0x1'));var path=require(_0x46bb('0x2'));var timeout=require('connect-timeout');var express=require(_0x46bb('0x3'));var router=express[_0x46bb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x46bb('0x5'));var interaction=require(_0x46bb('0x6'));var config=require(_0x46bb('0x7'));var controller=require(_0x46bb('0x8'));router[_0x46bb('0x9')]('/',auth[_0x46bb('0xa')](),controller['index']);router['get'](_0x46bb('0xb'),auth[_0x46bb('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x46bb('0xc')]);router[_0x46bb('0xd')]('/:id',auth[_0x46bb('0xa')](),controller[_0x46bb('0xe')]);router[_0x46bb('0xf')]('/:id',auth[_0x46bb('0xa')](),controller[_0x46bb('0x10')]);module['exports']=router; \ No newline at end of file +var _0x3079=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','./cmCustomField.controller','get','isAuthenticated','index','show','create','/:id','update','destroy','exports'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x3079,0x110));var _0x9307=function(_0x51148a,_0x3a43be){_0x51148a=_0x51148a-0x0;var _0x98d88c=_0x3079[_0x51148a];return _0x98d88c;};'use strict';var multer=require('multer');var util=require(_0x9307('0x0'));var path=require(_0x9307('0x1'));var timeout=require(_0x9307('0x2'));var express=require(_0x9307('0x3'));var router=express['Router']();var fs_extra=require(_0x9307('0x4'));var auth=require(_0x9307('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9307('0x6'));router[_0x9307('0x7')]('/',auth[_0x9307('0x8')](),controller[_0x9307('0x9')]);router[_0x9307('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x9307('0xa')]);router['post']('/',auth[_0x9307('0x8')](),controller[_0x9307('0xb')]);router['put'](_0x9307('0xc'),auth[_0x9307('0x8')](),controller[_0x9307('0xd')]);router['delete']('/:id',auth[_0x9307('0x8')](),controller[_0x9307('0xe')]);module[_0x9307('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 0b7dcf5..7e7dd2c 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 _0xb941=['STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports'];(function(_0x424357,_0x9ebe3e){var _0x29c68e=function(_0x663b5d){while(--_0x663b5d){_0x424357['push'](_0x424357['shift']());}};_0x29c68e(++_0x9ebe3e);}(_0xb941,0x17e));var _0x1b94=function(_0x489d4c,_0x3e07fb){_0x489d4c=_0x489d4c-0x0;var _0x34555c=_0xb941[_0x489d4c];return _0x34555c;};'use strict';var moment=require(_0x1b94('0x0'));var Sequelize=require(_0x1b94('0x1'));module[_0x1b94('0x2')]={'phone':{'type':Sequelize[_0x1b94('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x1b94('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x1b94('0x5')],'defaultValue':moment()[_0x1b94('0x6')](_0x1b94('0x7'))},'countbusyretry':{'type':Sequelize[_0x1b94('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1b94('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1b94('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x1b94('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1b94('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1b94('0x5')]},'priority':{'type':Sequelize[_0x1b94('0x8')](0x2)[_0x1b94('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x1b94('0x8')],'unique':_0x1b94('0xa')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x1b94('0xa')},'UserId':{'type':Sequelize[_0x1b94('0x8')]},'VoiceQueueId':{'type':Sequelize[_0x1b94('0x8')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x1b94('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1b94('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1b94('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1b94('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1b94('0x8')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x1b94('0x8')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x1b94('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0x1b94('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xbe98=['format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE'];(function(_0x292d79,_0x250539){var _0x26f030=function(_0x310343){while(--_0x310343){_0x292d79['push'](_0x292d79['shift']());}};_0x26f030(++_0x250539);}(_0xbe98,0x139));var _0x8be9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbe98[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x8be9('0x0'));var Sequelize=require(_0x8be9('0x1'));module[_0x8be9('0x2')]={'phone':{'type':Sequelize[_0x8be9('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x8be9('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x8be9('0x5')],'defaultValue':moment()[_0x8be9('0x6')](_0x8be9('0x7'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8be9('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8be9('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x8be9('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8be9('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8be9('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x8be9('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x8be9('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x8be9('0xa')},'ListId':{'type':Sequelize[_0x8be9('0x8')],'unique':_0x8be9('0xa')},'UserId':{'type':Sequelize[_0x8be9('0x8')]},'VoiceQueueId':{'type':Sequelize[_0x8be9('0x8')],'unique':_0x8be9('0xa')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8be9('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8be9('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8be9('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x8be9('0x8')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x8be9('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0x8be9('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 8e95b33..7d9ecbc 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 _0x6334=['getTimezones','timezones','push','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','status','json','undefined','limit','count','set','sendStatus','error','stack','name','send','map','CmHopper','fieldName','key','query','keys','filters','intersection','concat','$and','$or','$gt','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','model','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','type','VIRTUAL','options','then','includeAll','findAll','rows','catch','show','params','find','create','body','update','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','createdAt','updatedAt','state','statedesc','campaign','membername','user','UserId','deleted','deletedat','format','calleridnum','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','end','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','value','direction','isEmpty','hopperIds','priority','scheduledAt','DESC','ASC','literal','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','getPreviewRecall','findOne','recallme','dialActive','getOpenContacts','preview','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found'];(function(_0x10775a,_0x278cfc){var _0x4f682d=function(_0x32069d){while(--_0x32069d){_0x10775a['push'](_0x10775a['shift']());}};_0x4f682d(++_0x278cfc);}(_0x6334,0x119));var _0x4633=function(_0x30d87a,_0xf3a07f){_0x30d87a=_0x30d87a-0x0;var _0x48f64b=_0x6334[_0x30d87a];return _0x48f64b;};'use strict';var moment=require(_0x4633('0x0'));var _=require(_0x4633('0x1'));var qs=require(_0x4633('0x2'));var logger=require(_0x4633('0x3'))(_0x4633('0x4'));var shared=require(_0x4633('0x5'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x1099be,_0x205442){_0x205442=_0x205442||0xc8;return function(_0x2a2b3c){if(_0x2a2b3c){return _0x1099be[_0x4633('0x6')](_0x205442)[_0x4633('0x7')](_0x2a2b3c);}};}function respondWithFilteredResult(_0x6493dc,_0x175e14){return function(_0x4a8997){if(_0x4a8997){var _0x5647f1=typeof _0x175e14['offset']===_0x4633('0x8')&&typeof _0x175e14[_0x4633('0x9')]==='undefined';var _0x3c202f=_0x4a8997[_0x4633('0xa')];var _0x4018ba=_0x5647f1?0x0:_0x175e14['offset'];var _0x45a590=_0x5647f1?_0x4a8997[_0x4633('0xa')]:_0x175e14['offset']+_0x175e14[_0x4633('0x9')];var _0x3d5182;if(_0x45a590>=_0x3c202f){_0x45a590=_0x3c202f;_0x3d5182=0xc8;}else{_0x3d5182=0xce;}_0x6493dc[_0x4633('0x6')](_0x3d5182);return _0x6493dc[_0x4633('0xb')]('Content-Range',_0x4018ba+'-'+_0x45a590+'/'+_0x3c202f)[_0x4633('0x7')](_0x4a8997);}return null;};}function saveUpdates(_0xad405,_0x438e87){return function(_0x48e92c){if(_0x48e92c){return _0x48e92c['update'](_0xad405)['then'](function(_0x28e2bc){return _0x28e2bc;});}return null;};}function handleEntityNotFound(_0x1fd00c,_0x579229){return function(_0x52955e){if(!_0x52955e){_0x1fd00c[_0x4633('0xc')](0x194);}return _0x52955e;};}function handleError(_0x4813c5,_0xcdffcc){_0xcdffcc=_0xcdffcc||0x1f4;return function(_0x33b6e7){logger[_0x4633('0xd')](_0x33b6e7[_0x4633('0xe')]);if(_0x33b6e7['name']){delete _0x33b6e7[_0x4633('0xf')];}_0x4813c5[_0x4633('0x6')](_0xcdffcc)[_0x4633('0x10')](_0x33b6e7);};}exports['index']=function(_0xa8a6c1,_0x37e536){var _0x1c7186={},_0x2ad562={},_0xbab957={'count':0x0,'rows':[]};var _0x5953b8=_[_0x4633('0x11')](db[_0x4633('0x12')]['rawAttributes'],function(_0x57e61c){return{'name':_0x57e61c[_0x4633('0x13')],'type':_0x57e61c['type'][_0x4633('0x14')]};});_0x2ad562['model']=_['map'](_0x5953b8,_0x4633('0xf'));_0x2ad562[_0x4633('0x15')]=_[_0x4633('0x16')](_0xa8a6c1[_0x4633('0x15')]);_0x2ad562[_0x4633('0x17')]=_[_0x4633('0x18')](_0x2ad562['model'],_0x2ad562[_0x4633('0x15')]);_0x2ad562['filters']=_[_0x4633('0x19')](_0x2ad562[_0x4633('0x17')],[_0x4633('0x1a'),_0x4633('0x1b'),_0x4633('0x1c'),'$gte',_0x4633('0x1d'),_0x4633('0x1e'),_0x4633('0x1f'),_0x4633('0x20'),_0x4633('0x21'),_0x4633('0x22'),_0x4633('0x23'),_0x4633('0x24'),_0x4633('0x25'),_0x4633('0x26'),_0x4633('0x27'),_0x4633('0x28'),_0x4633('0x29'),_0x4633('0x26'),_0x4633('0x2a'),_0x4633('0x2b'),_0x4633('0x2c'),_0x4633('0x2d')]);_0x1c7186['attributes']=_[_0x4633('0x18')](_0x2ad562[_0x4633('0x2e')],qs[_0x4633('0x2f')](_0xa8a6c1[_0x4633('0x15')][_0x4633('0x2f')]));_0x1c7186[_0x4633('0x30')]=_0x1c7186['attributes'][_0x4633('0x31')]?_0x1c7186['attributes']:_0x2ad562[_0x4633('0x2e')];if(!_0xa8a6c1[_0x4633('0x15')][_0x4633('0x32')](_0x4633('0x33'))){_0x1c7186[_0x4633('0x9')]=qs[_0x4633('0x9')](_0xa8a6c1[_0x4633('0x15')][_0x4633('0x9')]);_0x1c7186[_0x4633('0x34')]=qs[_0x4633('0x34')](_0xa8a6c1[_0x4633('0x15')][_0x4633('0x34')]);}_0x1c7186[_0x4633('0x35')]=qs[_0x4633('0x36')](_0xa8a6c1['query']['sort']);_0x1c7186[_0x4633('0x37')]=qs[_0x4633('0x17')](_['pick'](_0xa8a6c1[_0x4633('0x15')],_0x2ad562[_0x4633('0x17')]),_0x5953b8);if(_0xa8a6c1[_0x4633('0x15')][_0x4633('0x38')]){_0x1c7186['where']=_[_0x4633('0x39')](_0x1c7186['where'],{'$or':_[_0x4633('0x11')](_0x5953b8,function(_0x15868f){if(_0x15868f[_0x4633('0x3a')]!==_0x4633('0x3b')){var _0x213768={};_0x213768[_0x15868f[_0x4633('0xf')]]={'$like':'%'+_0xa8a6c1[_0x4633('0x15')][_0x4633('0x38')]+'%'};return _0x213768;}})});}_0x1c7186=_['merge']({},_0x1c7186,_0xa8a6c1[_0x4633('0x3c')]);var _0x107616={'where':_0x1c7186['where']};return db[_0x4633('0x12')][_0x4633('0xa')](_0x107616)[_0x4633('0x3d')](function(_0x468648){_0xbab957['count']=_0x468648;if(_0xa8a6c1['query'][_0x4633('0x3e')]){_0x1c7186['include']=[{'all':!![]}];}return db['CmHopper'][_0x4633('0x3f')](_0x1c7186);})['then'](function(_0x4c83b8){_0xbab957[_0x4633('0x40')]=_0x4c83b8;return _0xbab957;})[_0x4633('0x3d')](respondWithFilteredResult(_0x37e536,_0x1c7186))[_0x4633('0x41')](handleError(_0x37e536,null));};exports[_0x4633('0x42')]=function(_0x2cdb28,_0x582404){var _0x6873d0={'raw':!![],'where':{'id':_0x2cdb28[_0x4633('0x43')]['id']}},_0x530ced={};_0x530ced[_0x4633('0x2e')]=_[_0x4633('0x16')](db[_0x4633('0x12')]['rawAttributes']);_0x530ced[_0x4633('0x15')]=_['keys'](_0x2cdb28[_0x4633('0x15')]);_0x530ced[_0x4633('0x17')]=_[_0x4633('0x18')](_0x530ced[_0x4633('0x2e')],_0x530ced[_0x4633('0x15')]);_0x6873d0['attributes']=_['intersection'](_0x530ced[_0x4633('0x2e')],qs[_0x4633('0x2f')](_0x2cdb28[_0x4633('0x15')][_0x4633('0x2f')]));_0x6873d0[_0x4633('0x30')]=_0x6873d0['attributes'][_0x4633('0x31')]?_0x6873d0['attributes']:_0x530ced[_0x4633('0x2e')];if(_0x2cdb28['query'][_0x4633('0x3e')]){_0x6873d0['include']=[{'all':!![]}];}_0x6873d0=_[_0x4633('0x39')]({},_0x6873d0,_0x2cdb28[_0x4633('0x3c')]);return db[_0x4633('0x12')][_0x4633('0x44')](_0x6873d0)[_0x4633('0x3d')](handleEntityNotFound(_0x582404,null))[_0x4633('0x3d')](respondWithResult(_0x582404,null))[_0x4633('0x41')](handleError(_0x582404,null));};exports[_0x4633('0x45')]=function(_0x18f3fd,_0x2e1cf2){return db[_0x4633('0x12')][_0x4633('0x45')](_0x18f3fd[_0x4633('0x46')],{})[_0x4633('0x3d')](respondWithResult(_0x2e1cf2,0xc9))[_0x4633('0x41')](handleError(_0x2e1cf2,null));};exports[_0x4633('0x47')]=function(_0x13ffa5,_0x1e533d){if(_0x13ffa5[_0x4633('0x46')]['id']){delete _0x13ffa5[_0x4633('0x46')]['id'];}return db[_0x4633('0x12')]['find']({'where':{'id':_0x13ffa5['params']['id']}})[_0x4633('0x3d')](handleEntityNotFound(_0x1e533d,null))['then'](saveUpdates(_0x13ffa5['body'],null))['then'](respondWithResult(_0x1e533d,null))[_0x4633('0x41')](handleError(_0x1e533d,null));};exports[_0x4633('0x48')]=function(_0x5cb4cc,_0x35b82a){return db[_0x4633('0x12')][_0x4633('0x48')]()[_0x4633('0x3d')](respondWithResult(_0x35b82a,null))[_0x4633('0x41')](handleError(_0x35b82a,null));};exports[_0x4633('0x49')]=function(_0x4d3cf4,_0x4ca3d6){var _0x4fb731;var _0x99c493=_0x4d3cf4[_0x4633('0x43')]['id'];return db[_0x4633('0x12')]['find']({'where':{'id':_0x4d3cf4[_0x4633('0x43')]['id']}})[_0x4633('0x3d')](handleEntityNotFound(_0x4ca3d6,null))['then'](function(_0x2d18f6){if(_0x2d18f6){return _0x2d18f6[_0x4633('0x49')]()[_0x4633('0x3d')](function(_0x4c5367){return _0x4c5367;});}})['then'](function(_0x12e416){_0x4fb731=_0x12e416;if(_0x12e416){if(_0x12e416[_0x4633('0x4a')]||_0x12e416[_0x4633('0x4b')]){return db[_0x12e416[_0x4633('0x4a')]?_0x4633('0x4c'):'Campaign'][_0x4633('0x44')]({'where':{'id':_0x12e416[_0x4633('0x4a')]?_0x12e416[_0x4633('0x4a')]:_0x12e416[_0x4633('0x4b')]},'attributes':['id',_0x4633('0xf')],'raw':!![]});}}})[_0x4633('0x3d')](function(_0x5659ed){var _0xeec38a={};if(_0x5659ed){_['merge'](_0xeec38a,_['omit'](_0x4fb731['dataValues'],[_0x4633('0x4d'),_0x4633('0x4e'),'id']));_0xeec38a[_0x4633('0x4f')]=0x15;_0xeec38a[_0x4633('0x50')]='deleted';_0xeec38a[_0x4633('0x51')]=_0x5659ed['name'];_0xeec38a[_0x4633('0x52')]=_0x4d3cf4[_0x4633('0x53')][_0x4633('0xf')];_0xeec38a[_0x4633('0x54')]=_0x4d3cf4[_0x4633('0x53')]['id'];_0xeec38a[_0x4633('0x55')]=!![];_0xeec38a[_0x4633('0x56')]=moment()[_0x4633('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0xeec38a[_0x4633('0x58')]=_0x4fb731['phone'];_0xeec38a[_0x4633('0x59')]=_0x4fb731[_0x4633('0x4a')]?_0x4633('0x5a'):_0x4633('0x5b');return db[_0x4633('0x5c')][_0x4633('0x44')]({'where':{'id':_0xeec38a[_0x4633('0x5d')]},'attributes':[_0x4633('0x5e'),_0x4633('0x5f')]})[_0x4633('0x3d')](function(_0x27608f){if(!_[_0x4633('0x60')](_0x4ca3d6)&&!_[_0x4633('0x60')](_0x27608f['firstName'])){_0xeec38a[_0x4633('0x61')]=_0x27608f[_0x4633('0x5e')];if(!_[_0x4633('0x60')](_0x27608f[_0x4633('0x5f')])){_0xeec38a[_0x4633('0x61')]+='\x20'+_0x27608f[_0x4633('0x5f')];}}})[_0x4633('0x62')](function(){return db[_0x4633('0x63')][_0x4633('0x45')](_0xeec38a);});}})[_0x4633('0x3d')](function(_0x3669a1){return db['CmHopperAdditionalPhone']['destroy']({'where':{'CmHopperId':_0x99c493}});})[_0x4633('0x3d')](function(){return _0x4ca3d6['status'](0xcc)[_0x4633('0x64')]();})[_0x4633('0x41')](handleError(_0x4ca3d6,null));};exports['getPreview']=function(_0x3fb667,_0x344536){var _0x327103=[];return db[_0x4633('0x5c')][_0x4633('0x48')]()['then'](function(_0x22271a){_0x327103=_[_0x4633('0x16')](_0x22271a);return _0x3fb667[_0x4633('0x53')][_0x4633('0x65')]({'where':{'type':_0x4633('0x66'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x4633('0x67'),_0x4633('0x68')],'raw':!![]});})[_0x4633('0x3d')](function(_0x493d6c){if(_0x493d6c&&_0x493d6c[_0x4633('0x31')]){return db[_0x4633('0x69')][_0x4633('0x6a')](function(_0x2efee0){var _0x1eb81f={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x4633('0x57')](_0x4633('0x6b'))},'VoiceQueueId':{'$in':_[_0x4633('0x11')](_0x493d6c,'id')},'$or':[{'UserId':null},{'UserId':_0x3fb667[_0x4633('0x53')]['id']}]};var _0xea95b5={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x493d6c)[_0x4633('0x38')](['dialPreviewAutoRecallMe',0x0])['map']('id')[_0x4633('0x6c')]()},'$or':[{'UserId':null},{'UserId':_0x3fb667[_0x4633('0x53')]['id']}]};var _0x474a50={'$or':[_0x1eb81f,_0xea95b5]};var _0x4a5478=[];if(_0x3fb667['body'][_0x4633('0x6d')]&&_0x3fb667[_0x4633('0x46')][_0x4633('0x6d')]==='prev'){if(!_[_0x4633('0x6e')](_0x3fb667[_0x4633('0x46')][_0x4633('0x6f')])){_0x474a50['id']={'$in':_0x3fb667['body']['hopperIds']};}_0x4a5478=[[_0x4633('0x70'),'ASC'],[_0x4633('0x71'),_0x493d6c[0x0][_0x4633('0x67')]==='ASC'?_0x4633('0x72'):_0x4633('0x73')],db[_0x4633('0x69')][_0x4633('0x74')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x4633('0x72')]];}else{if(!_[_0x4633('0x6e')](_0x3fb667[_0x4633('0x46')][_0x4633('0x6f')])){_0x474a50['id']={'$notIn':_0x3fb667[_0x4633('0x46')][_0x4633('0x6f')]};}_0x4a5478=[[_0x4633('0x70'),'DESC'],[_0x4633('0x71'),_0x493d6c[0x0][_0x4633('0x67')]],db[_0x4633('0x69')][_0x4633('0x74')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id','ASC']];}return db[_0x4633('0x12')]['findOne']({'attributes':['id',_0x4633('0x75'),'phone','recallme'],'where':_0x474a50,'order':_0x4a5478,'transaction':_0x2efee0,'lock':_0x2efee0[_0x4633('0x76')][_0x4633('0x77')],'include':[{'model':db['CmContact'],'as':_0x4633('0x78'),'attributes':_0x327103,'include':[{'model':db[_0x4633('0x79')],'as':_0x4633('0x7a'),'attributes':['id',_0x4633('0xf')]}]},{'model':db[_0x4633('0x7b')],'as':_0x4633('0x7c'),'attributes':['id',_0x4633('0xf')]},{'model':db[_0x4633('0x4c')],'as':'Queue','attributes':['id',_0x4633('0xf'),'dialActive']}]})[_0x4633('0x3d')](function(_0x5706cd){if(_0x5706cd){return _0x5706cd[_0x4633('0x47')]({'UserId':_0x3fb667[_0x4633('0x53')]['id']},{'transaction':_0x2efee0});}});});}})[_0x4633('0x3d')](handleEntityNotFound(_0x344536,null))[_0x4633('0x3d')](respondWithResult(_0x344536,null))[_0x4633('0x41')](handleError(_0x344536,null));};exports[_0x4633('0x7d')]=function(_0x53b890,_0x194c9a,_0x2f3405){var _0x27ab67=[];var _0x5ce875=_0x53b890[_0x4633('0x43')]['id'];var _0x200fcc=_0x53b890[_0x4633('0x53')]['id'];return db[_0x4633('0x5c')][_0x4633('0x48')]()[_0x4633('0x3d')](function(_0x5a8b1c){_0x27ab67=_['keys'](_0x5a8b1c);return db[_0x4633('0x69')]['transaction'](function(_0x4d5b84){const _0x47aec6={'id':_0x5ce875};return db['CmHopper'][_0x4633('0x7e')]({'attributes':['id',_0x4633('0x75'),_0x4633('0x7f')],'where':_0x47aec6,'transaction':_0x4d5b84,'lock':_0x4d5b84[_0x4633('0x76')][_0x4633('0x77')],'include':[{'model':db['CmContact'],'as':_0x4633('0x78'),'attributes':_0x27ab67,'include':[{'model':db[_0x4633('0x79')],'as':_0x4633('0x7a'),'attributes':['id',_0x4633('0xf')]}]},{'model':db[_0x4633('0x7b')],'as':_0x4633('0x7c'),'attributes':['id','name']},{'model':db[_0x4633('0x4c')],'as':'Queue','attributes':['id',_0x4633('0xf'),_0x4633('0x80')]}]})['then'](function(_0x2ee435){if(_0x2ee435){return _0x2ee435[_0x4633('0x47')]({'UserId':_0x200fcc},{'transaction':_0x4d5b84});}});});})['then'](handleEntityNotFound(_0x194c9a,null))[_0x4633('0x3d')](respondWithResult(_0x194c9a,null))[_0x4633('0x41')](handleError(_0x194c9a,null));};exports[_0x4633('0x81')]=function(_0x4a8cca,_0x5c2c93){return _0x4a8cca['user'][_0x4633('0x65')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x4633('0x82')},'attributes':['id'],'raw':!![]})['then'](function(_0x109a23){if(_0x109a23&&_0x109a23[_0x4633('0x31')]){return db[_0x4633('0x12')][_0x4633('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x4633('0x57')](_0x4633('0x6b'))},'VoiceQueueId':{'$in':_[_0x4633('0x11')](_0x109a23,'id')},'$or':[{'UserId':null},{'UserId':_0x4a8cca[_0x4633('0x53')]['id']}]}});}return 0x0;})[_0x4633('0x3d')](function(_0x89261b){if(!_[_0x4633('0x60')](_0x89261b)&&_['isNumber'](_0x89261b)){return _0x5c2c93[_0x4633('0x6')](0xc8)[_0x4633('0x7')]({'contacts':_0x89261b});}else{logger[_0x4633('0xd')](_0x4633('0x83'),_0x4633('0x81'),0x194,_0x4633('0x84'));_0x5c2c93['sendStatus'](0x194);}})[_0x4633('0x41')](handleError(_0x5c2c93,null));};exports[_0x4633('0x85')]=function(_0x3a9832,_0x46195b){var _0x4d1d30=shared[_0x4633('0x86')];var _0x3f064c=[];_['map'](_0x4d1d30,function(_0x4e820a){_0x3f064c[_0x4633('0x87')]({'id':_0x4e820a['name'],'name':_0x4e820a['name'],'utcOffset':_0x4e820a[_0x4633('0x88')]});});return _0x46195b['status'](0xc8)['json']({'tz':_0x3f064c});};exports[_0x4633('0x89')]=function(_0x47875e,_0x20a6c5){var _0xdc710f=shared[_0x4633('0x86')];var _0x37bb9a={};if(!_['isNil'](_0xdc710f[_0x47875e[_0x4633('0x46')]['id']]))_0x37bb9a=_0xdc710f[_0x47875e[_0x4633('0x46')]['id']];return _0x20a6c5['status'](0xc8)[_0x4633('0x7')](_0x37bb9a);}; \ No newline at end of file +var _0x81bd=['sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','query','filters','model','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$any','attributes','fields','length','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','then','catch','show','keys','intersection','include','find','create','body','params','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','ivr','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','getPreview','CmContact','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','UPDATE','Contact','CmCompany','Company','CmList','dialActive','getPreviewRecall','List','Queue','getOpenContacts','isNumber','json','getTimezones','timezones','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','undefined','count','offset','limit','set','Content-Range','update'];(function(_0x43d1cf,_0x253c33){var _0x2adaef=function(_0x323a95){while(--_0x323a95){_0x43d1cf['push'](_0x43d1cf['shift']());}};_0x2adaef(++_0x253c33);}(_0x81bd,0x7c));var _0xd81b=function(_0x4e77c6,_0x4c359c){_0x4e77c6=_0x4e77c6-0x0;var _0x3e326c=_0x81bd[_0x4e77c6];return _0x3e326c;};'use strict';var moment=require(_0xd81b('0x0'));var _=require(_0xd81b('0x1'));var qs=require(_0xd81b('0x2'));var logger=require(_0xd81b('0x3'))(_0xd81b('0x4'));var shared=require(_0xd81b('0x5'));var db=require(_0xd81b('0x6'))['db'];function respondWithResult(_0x54e096,_0x16e8de){_0x16e8de=_0x16e8de||0xc8;return function(_0x2c3d9e){if(_0x2c3d9e){return _0x54e096[_0xd81b('0x7')](_0x16e8de)['json'](_0x2c3d9e);}};}function respondWithFilteredResult(_0x42a0aa,_0x34eb73){return function(_0x1f3f2c){if(_0x1f3f2c){var _0x562084=typeof _0x34eb73['offset']===_0xd81b('0x8')&&typeof _0x34eb73['limit']===_0xd81b('0x8');var _0x3ed380=_0x1f3f2c[_0xd81b('0x9')];var _0x86dab6=_0x562084?0x0:_0x34eb73[_0xd81b('0xa')];var _0x1ff60f=_0x562084?_0x1f3f2c[_0xd81b('0x9')]:_0x34eb73[_0xd81b('0xa')]+_0x34eb73[_0xd81b('0xb')];var _0x23c789;if(_0x1ff60f>=_0x3ed380){_0x1ff60f=_0x3ed380;_0x23c789=0xc8;}else{_0x23c789=0xce;}_0x42a0aa[_0xd81b('0x7')](_0x23c789);return _0x42a0aa[_0xd81b('0xc')](_0xd81b('0xd'),_0x86dab6+'-'+_0x1ff60f+'/'+_0x3ed380)['json'](_0x1f3f2c);}return null;};}function saveUpdates(_0x21dfff,_0x57f71d){return function(_0x3f2405){if(_0x3f2405){return _0x3f2405[_0xd81b('0xe')](_0x21dfff)['then'](function(_0x35a053){return _0x35a053;});}return null;};}function handleEntityNotFound(_0x47dd04,_0x13dd00){return function(_0x41bf7a){if(!_0x41bf7a){_0x47dd04[_0xd81b('0xf')](0x194);}return _0x41bf7a;};}function handleError(_0x35cfc1,_0x128162){_0x128162=_0x128162||0x1f4;return function(_0x552215){logger[_0xd81b('0x10')](_0x552215[_0xd81b('0x11')]);if(_0x552215['name']){delete _0x552215[_0xd81b('0x12')];}_0x35cfc1[_0xd81b('0x7')](_0x128162)[_0xd81b('0x13')](_0x552215);};}exports[_0xd81b('0x14')]=function(_0x5f7db6,_0xc49b8d){var _0x6746f0={},_0x3d4d34={},_0x1c34c5={'count':0x0,'rows':[]};var _0x285164=_[_0xd81b('0x15')](db[_0xd81b('0x16')][_0xd81b('0x17')],function(_0x3518f0){return{'name':_0x3518f0[_0xd81b('0x18')],'type':_0x3518f0[_0xd81b('0x19')]['key']};});_0x3d4d34['model']=_[_0xd81b('0x15')](_0x285164,_0xd81b('0x12'));_0x3d4d34[_0xd81b('0x1a')]=_['keys'](_0x5f7db6[_0xd81b('0x1a')]);_0x3d4d34[_0xd81b('0x1b')]=_['intersection'](_0x3d4d34[_0xd81b('0x1c')],_0x3d4d34[_0xd81b('0x1a')]);_0x3d4d34[_0xd81b('0x1b')]=_[_0xd81b('0x1d')](_0x3d4d34[_0xd81b('0x1b')],[_0xd81b('0x1e'),_0xd81b('0x1f'),_0xd81b('0x20'),_0xd81b('0x21'),_0xd81b('0x22'),_0xd81b('0x23'),_0xd81b('0x24'),'$eq',_0xd81b('0x25'),_0xd81b('0x26'),_0xd81b('0x27'),_0xd81b('0x28'),_0xd81b('0x29'),_0xd81b('0x2a'),_0xd81b('0x2b'),_0xd81b('0x2c'),_0xd81b('0x2d'),'$like',_0xd81b('0x2e'),'$contains','$contained',_0xd81b('0x2f')]);_0x6746f0[_0xd81b('0x30')]=_['intersection'](_0x3d4d34['model'],qs[_0xd81b('0x31')](_0x5f7db6[_0xd81b('0x1a')][_0xd81b('0x31')]));_0x6746f0[_0xd81b('0x30')]=_0x6746f0[_0xd81b('0x30')][_0xd81b('0x32')]?_0x6746f0['attributes']:_0x3d4d34[_0xd81b('0x1c')];if(!_0x5f7db6[_0xd81b('0x1a')]['hasOwnProperty']('nolimit')){_0x6746f0[_0xd81b('0xb')]=qs[_0xd81b('0xb')](_0x5f7db6['query']['limit']);_0x6746f0['offset']=qs[_0xd81b('0xa')](_0x5f7db6[_0xd81b('0x1a')][_0xd81b('0xa')]);}_0x6746f0[_0xd81b('0x33')]=qs[_0xd81b('0x34')](_0x5f7db6[_0xd81b('0x1a')][_0xd81b('0x34')]);_0x6746f0['where']=qs[_0xd81b('0x1b')](_['pick'](_0x5f7db6[_0xd81b('0x1a')],_0x3d4d34[_0xd81b('0x1b')]),_0x285164);if(_0x5f7db6[_0xd81b('0x1a')][_0xd81b('0x35')]){_0x6746f0[_0xd81b('0x36')]=_[_0xd81b('0x37')](_0x6746f0[_0xd81b('0x36')],{'$or':_[_0xd81b('0x15')](_0x285164,function(_0xf9d1a5){if(_0xf9d1a5[_0xd81b('0x19')]!==_0xd81b('0x38')){var _0x3c8371={};_0x3c8371[_0xf9d1a5[_0xd81b('0x12')]]={'$like':'%'+_0x5f7db6['query']['filter']+'%'};return _0x3c8371;}})});}_0x6746f0=_[_0xd81b('0x37')]({},_0x6746f0,_0x5f7db6[_0xd81b('0x39')]);var _0x401430={'where':_0x6746f0['where']};return db[_0xd81b('0x16')][_0xd81b('0x9')](_0x401430)['then'](function(_0x46f058){_0x1c34c5[_0xd81b('0x9')]=_0x46f058;if(_0x5f7db6['query'][_0xd81b('0x3a')]){_0x6746f0['include']=[{'all':!![]}];}return db[_0xd81b('0x16')][_0xd81b('0x3b')](_0x6746f0);})[_0xd81b('0x3c')](function(_0x3f6deb){_0x1c34c5['rows']=_0x3f6deb;return _0x1c34c5;})[_0xd81b('0x3c')](respondWithFilteredResult(_0xc49b8d,_0x6746f0))[_0xd81b('0x3d')](handleError(_0xc49b8d,null));};exports[_0xd81b('0x3e')]=function(_0x67fbe5,_0x3abd60){var _0x466e98={'raw':!![],'where':{'id':_0x67fbe5['params']['id']}},_0x3976fc={};_0x3976fc[_0xd81b('0x1c')]=_[_0xd81b('0x3f')](db[_0xd81b('0x16')]['rawAttributes']);_0x3976fc[_0xd81b('0x1a')]=_[_0xd81b('0x3f')](_0x67fbe5[_0xd81b('0x1a')]);_0x3976fc[_0xd81b('0x1b')]=_[_0xd81b('0x40')](_0x3976fc['model'],_0x3976fc[_0xd81b('0x1a')]);_0x466e98[_0xd81b('0x30')]=_[_0xd81b('0x40')](_0x3976fc[_0xd81b('0x1c')],qs[_0xd81b('0x31')](_0x67fbe5[_0xd81b('0x1a')][_0xd81b('0x31')]));_0x466e98[_0xd81b('0x30')]=_0x466e98[_0xd81b('0x30')][_0xd81b('0x32')]?_0x466e98[_0xd81b('0x30')]:_0x3976fc['model'];if(_0x67fbe5[_0xd81b('0x1a')][_0xd81b('0x3a')]){_0x466e98[_0xd81b('0x41')]=[{'all':!![]}];}_0x466e98=_[_0xd81b('0x37')]({},_0x466e98,_0x67fbe5[_0xd81b('0x39')]);return db[_0xd81b('0x16')][_0xd81b('0x42')](_0x466e98)[_0xd81b('0x3c')](handleEntityNotFound(_0x3abd60,null))['then'](respondWithResult(_0x3abd60,null))['catch'](handleError(_0x3abd60,null));};exports[_0xd81b('0x43')]=function(_0x31eb63,_0x2b1383){return db[_0xd81b('0x16')][_0xd81b('0x43')](_0x31eb63[_0xd81b('0x44')],{})[_0xd81b('0x3c')](respondWithResult(_0x2b1383,0xc9))[_0xd81b('0x3d')](handleError(_0x2b1383,null));};exports[_0xd81b('0xe')]=function(_0xcfbbc2,_0x41e2e6){if(_0xcfbbc2[_0xd81b('0x44')]['id']){delete _0xcfbbc2['body']['id'];}return db[_0xd81b('0x16')][_0xd81b('0x42')]({'where':{'id':_0xcfbbc2[_0xd81b('0x45')]['id']}})[_0xd81b('0x3c')](handleEntityNotFound(_0x41e2e6,null))[_0xd81b('0x3c')](saveUpdates(_0xcfbbc2[_0xd81b('0x44')],null))[_0xd81b('0x3c')](respondWithResult(_0x41e2e6,null))[_0xd81b('0x3d')](handleError(_0x41e2e6,null));};exports[_0xd81b('0x46')]=function(_0x53ea36,_0xf401e0){return db[_0xd81b('0x16')][_0xd81b('0x46')]()[_0xd81b('0x3c')](respondWithResult(_0xf401e0,null))['catch'](handleError(_0xf401e0,null));};exports[_0xd81b('0x47')]=function(_0x151127,_0x15030b){var _0xe874b6;var _0x2699e6=_0x151127[_0xd81b('0x45')]['id'];return db[_0xd81b('0x16')][_0xd81b('0x42')]({'where':{'id':_0x151127[_0xd81b('0x45')]['id']}})['then'](handleEntityNotFound(_0x15030b,null))['then'](function(_0x328fd7){if(_0x328fd7){return _0x328fd7[_0xd81b('0x47')]()[_0xd81b('0x3c')](function(_0x4da281){return _0x4da281;});}})[_0xd81b('0x3c')](function(_0x3d6ab3){_0xe874b6=_0x3d6ab3;if(_0x3d6ab3){if(_0x3d6ab3[_0xd81b('0x48')]||_0x3d6ab3[_0xd81b('0x49')]){return db[_0x3d6ab3['VoiceQueueId']?_0xd81b('0x4a'):_0xd81b('0x4b')][_0xd81b('0x42')]({'where':{'id':_0x3d6ab3[_0xd81b('0x48')]?_0x3d6ab3[_0xd81b('0x48')]:_0x3d6ab3['CampaignId']},'attributes':['id',_0xd81b('0x12')],'raw':!![]});}}})[_0xd81b('0x3c')](function(_0x50d940){var _0x1f13c3={};if(_0x50d940){_[_0xd81b('0x37')](_0x1f13c3,_[_0xd81b('0x4c')](_0xe874b6[_0xd81b('0x4d')],[_0xd81b('0x4e'),_0xd81b('0x4f'),'id']));_0x1f13c3[_0xd81b('0x50')]=0x15;_0x1f13c3[_0xd81b('0x51')]=_0xd81b('0x52');_0x1f13c3[_0xd81b('0x53')]=_0x50d940[_0xd81b('0x12')];_0x1f13c3['membername']=_0x151127[_0xd81b('0x54')]['name'];_0x1f13c3[_0xd81b('0x55')]=_0x151127[_0xd81b('0x54')]['id'];_0x1f13c3[_0xd81b('0x52')]=!![];_0x1f13c3[_0xd81b('0x56')]=moment()[_0xd81b('0x57')](_0xd81b('0x58'));_0x1f13c3['calleridnum']=_0xe874b6[_0xd81b('0x59')];_0x1f13c3[_0xd81b('0x5a')]=_0xe874b6['VoiceQueueId']?'queue':_0xd81b('0x5b');return db['CmContact'][_0xd81b('0x42')]({'where':{'id':_0x1f13c3['ContactId']},'attributes':[_0xd81b('0x5c'),_0xd81b('0x5d')]})[_0xd81b('0x3c')](function(_0x59186c){if(!_[_0xd81b('0x5e')](_0x15030b)&&!_[_0xd81b('0x5e')](_0x59186c['firstName'])){_0x1f13c3[_0xd81b('0x5f')]=_0x59186c[_0xd81b('0x5c')];if(!_['isNil'](_0x59186c[_0xd81b('0x5d')])){_0x1f13c3['calleridname']+='\x20'+_0x59186c[_0xd81b('0x5d')];}}})[_0xd81b('0x60')](function(){return db[_0xd81b('0x61')][_0xd81b('0x43')](_0x1f13c3);});}})[_0xd81b('0x3c')](function(_0x32eab4){return db[_0xd81b('0x62')][_0xd81b('0x47')]({'where':{'CmHopperId':_0x2699e6}});})[_0xd81b('0x3c')](function(){return _0x15030b[_0xd81b('0x7')](0xcc)['end']();})[_0xd81b('0x3d')](handleError(_0x15030b,null));};exports[_0xd81b('0x63')]=function(_0x385841,_0x3e4c33){var _0x1bdf37=[];return db[_0xd81b('0x64')][_0xd81b('0x46')]()['then'](function(_0x57f0fb){_0x1bdf37=_['keys'](_0x57f0fb);return _0x385841[_0xd81b('0x54')][_0xd81b('0x65')]({'where':{'type':_0xd81b('0x66'),'dialActive':!![],'dialMethod':_0xd81b('0x67')},'attributes':['id',_0xd81b('0x68'),_0xd81b('0x69')],'raw':!![]});})[_0xd81b('0x3c')](function(_0x5afecf){if(_0x5afecf&&_0x5afecf[_0xd81b('0x32')]){return db[_0xd81b('0x6a')][_0xd81b('0x6b')](function(_0x2090e9){var _0x41719b={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xd81b('0x57')](_0xd81b('0x58'))},'VoiceQueueId':{'$in':_['map'](_0x5afecf,'id')},'$or':[{'UserId':null},{'UserId':_0x385841[_0xd81b('0x54')]['id']}]};var _0x15f003={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x5afecf)[_0xd81b('0x35')]([_0xd81b('0x69'),0x0])[_0xd81b('0x15')]('id')[_0xd81b('0x6c')]()},'$or':[{'UserId':null},{'UserId':_0x385841[_0xd81b('0x54')]['id']}]};var _0x19d4f0={'$or':[_0x41719b,_0x15f003]};var _0x8fa8cd=[];if(_0x385841[_0xd81b('0x44')][_0xd81b('0x6d')]&&_0x385841[_0xd81b('0x44')]['direction']===_0xd81b('0x6e')){if(!_['isEmpty'](_0x385841[_0xd81b('0x44')][_0xd81b('0x6f')])){_0x19d4f0['id']={'$in':_0x385841[_0xd81b('0x44')][_0xd81b('0x6f')]};}_0x8fa8cd=[[_0xd81b('0x70'),_0xd81b('0x71')],[_0xd81b('0x72'),_0x5afecf[0x0][_0xd81b('0x68')]===_0xd81b('0x71')?_0xd81b('0x73'):'ASC'],db[_0xd81b('0x6a')][_0xd81b('0x74')](_0xd81b('0x75')),['id',_0xd81b('0x73')]];}else{if(!_[_0xd81b('0x76')](_0x385841['body']['hopperIds'])){_0x19d4f0['id']={'$notIn':_0x385841[_0xd81b('0x44')][_0xd81b('0x6f')]};}_0x8fa8cd=[[_0xd81b('0x70'),_0xd81b('0x73')],[_0xd81b('0x72'),_0x5afecf[0x0][_0xd81b('0x68')]],db[_0xd81b('0x6a')]['literal'](_0xd81b('0x77')),['id',_0xd81b('0x71')]];}return db[_0xd81b('0x16')][_0xd81b('0x78')]({'attributes':['id',_0xd81b('0x79'),_0xd81b('0x59'),_0xd81b('0x7a')],'where':_0x19d4f0,'order':_0x8fa8cd,'transaction':_0x2090e9,'lock':_0x2090e9[_0xd81b('0x7b')][_0xd81b('0x7c')],'include':[{'model':db['CmContact'],'as':_0xd81b('0x7d'),'attributes':_0x1bdf37,'include':[{'model':db[_0xd81b('0x7e')],'as':_0xd81b('0x7f'),'attributes':['id',_0xd81b('0x12')]}]},{'model':db[_0xd81b('0x80')],'as':'List','attributes':['id',_0xd81b('0x12')]},{'model':db[_0xd81b('0x4a')],'as':'Queue','attributes':['id',_0xd81b('0x12'),_0xd81b('0x81')]}]})['then'](function(_0x4597ad){if(_0x4597ad){return _0x4597ad[_0xd81b('0xe')]({'UserId':_0x385841[_0xd81b('0x54')]['id']},{'transaction':_0x2090e9});}});});}})['then'](handleEntityNotFound(_0x3e4c33,null))[_0xd81b('0x3c')](respondWithResult(_0x3e4c33,null))[_0xd81b('0x3d')](handleError(_0x3e4c33,null));};exports[_0xd81b('0x82')]=function(_0x547cbe,_0x58f287,_0xdd970d){var _0x950cc3=[];var _0x36c694=_0x547cbe['params']['id'];var _0x18e0d0=_0x547cbe[_0xd81b('0x54')]['id'];return db[_0xd81b('0x64')][_0xd81b('0x46')]()['then'](function(_0x4f69a7){_0x950cc3=_[_0xd81b('0x3f')](_0x4f69a7);return db[_0xd81b('0x6a')][_0xd81b('0x6b')](function(_0x3cfcee){const _0x4f540b={'id':_0x36c694};return db[_0xd81b('0x16')][_0xd81b('0x78')]({'attributes':['id','scheduledat',_0xd81b('0x7a')],'where':_0x4f540b,'transaction':_0x3cfcee,'lock':_0x3cfcee['LOCK'][_0xd81b('0x7c')],'include':[{'model':db[_0xd81b('0x64')],'as':'Contact','attributes':_0x950cc3,'include':[{'model':db[_0xd81b('0x7e')],'as':_0xd81b('0x7f'),'attributes':['id',_0xd81b('0x12')]}]},{'model':db[_0xd81b('0x80')],'as':_0xd81b('0x83'),'attributes':['id','name']},{'model':db[_0xd81b('0x4a')],'as':_0xd81b('0x84'),'attributes':['id',_0xd81b('0x12'),_0xd81b('0x81')]}]})[_0xd81b('0x3c')](function(_0x2b1d96){if(_0x2b1d96){return _0x2b1d96['update']({'UserId':_0x18e0d0},{'transaction':_0x3cfcee});}});});})['then'](handleEntityNotFound(_0x58f287,null))[_0xd81b('0x3c')](respondWithResult(_0x58f287,null))[_0xd81b('0x3d')](handleError(_0x58f287,null));};exports[_0xd81b('0x85')]=function(_0x15aed5,_0x4dd8ac){return _0x15aed5[_0xd81b('0x54')][_0xd81b('0x65')]({'where':{'type':_0xd81b('0x66'),'dialActive':!![],'dialMethod':_0xd81b('0x67')},'attributes':['id'],'raw':!![]})[_0xd81b('0x3c')](function(_0x589882){if(_0x589882&&_0x589882[_0xd81b('0x32')]){return db[_0xd81b('0x16')][_0xd81b('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xd81b('0x57')](_0xd81b('0x58'))},'VoiceQueueId':{'$in':_[_0xd81b('0x15')](_0x589882,'id')},'$or':[{'UserId':null},{'UserId':_0x15aed5[_0xd81b('0x54')]['id']}]}});}return 0x0;})['then'](function(_0x3dc419){if(!_[_0xd81b('0x5e')](_0x3dc419)&&_[_0xd81b('0x86')](_0x3dc419)){return _0x4dd8ac[_0xd81b('0x7')](0xc8)[_0xd81b('0x87')]({'contacts':_0x3dc419});}else{logger[_0xd81b('0x10')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xd81b('0x85'),0x194,'entity\x20not\x20found');_0x4dd8ac[_0xd81b('0xf')](0x194);}})[_0xd81b('0x3d')](handleError(_0x4dd8ac,null));};exports[_0xd81b('0x88')]=function(_0x49fe9a,_0x197529){var _0x27f848=shared[_0xd81b('0x89')];var _0x5060dc=[];_[_0xd81b('0x15')](_0x27f848,function(_0x34283f){_0x5060dc['push']({'id':_0x34283f[_0xd81b('0x12')],'name':_0x34283f['name'],'utcOffset':_0x34283f['utcOffset']});});return _0x197529[_0xd81b('0x7')](0xc8)[_0xd81b('0x87')]({'tz':_0x5060dc});};exports[_0xd81b('0x8a')]=function(_0x57c5c3,_0x270d32){var _0x31c206=shared[_0xd81b('0x89')];var _0x3deafa={};if(!_[_0xd81b('0x5e')](_0x31c206[_0x57c5c3[_0xd81b('0x44')]['id']]))_0x3deafa=_0x31c206[_0x57c5c3['body']['id']];return _0x270d32[_0xd81b('0x7')](0xc8)[_0xd81b('0x87')](_0x3deafa);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 59da090..6d6ed3c 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 _0xfcf0=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority','lodash','util','api'];(function(_0x16fb55,_0x29fe8a){var _0xf71a7f=function(_0x47be34){while(--_0x47be34){_0x16fb55['push'](_0x16fb55['shift']());}};_0xf71a7f(++_0x29fe8a);}(_0xfcf0,0x138));var _0x0fcf=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0xfcf0[_0x45b034];return _0x509cb0;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var logger=require('../../config/logger')(_0x0fcf('0x2'));var moment=require(_0x0fcf('0x3'));var BPromise=require(_0x0fcf('0x4'));var rp=require(_0x0fcf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var attributes=require(_0x0fcf('0x8'));module[_0x0fcf('0x9')]=function(_0x1bace8,_0x1a7b03){return _0x1bace8[_0x0fcf('0xa')](_0x0fcf('0xb'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x0fcf('0xc'),'fields':[_0x0fcf('0xc')]},{'name':_0x0fcf('0xd'),'fields':['phone']},{'name':_0x0fcf('0xe'),'fields':[_0x0fcf('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','cm_hopper','scheduledat','phone','priority','lodash'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0xabce,0x103));var _0xeabc=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xabce[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./cmHopper.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('CmHopper',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]},{'name':'phone','fields':[_0xeabc('0xb')]},{'name':_0xeabc('0xc'),'fields':[_0xeabc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index e409aff..fc0d0e7 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 _0x6262=['sequelize','transaction','order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','push','update','includes','all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','GetContactDialer','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','GetContactRecallMe','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','\x20MINUTE','List','util','bluebird','../../mysqldb','../../config/logger','findAll','raw','options','where','limit','attributes','map','include','model','then','GetCmHopper','stringify','message','ShowCmHopper','CmHopper','find','info','debug','catch','error','CreateCmHopper','create','body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','CmContact','describe'];(function(_0x54b7e7,_0x4ad441){var _0x549f02=function(_0x2fe548){while(--_0x2fe548){_0x54b7e7['push'](_0x54b7e7['shift']());}};_0x549f02(++_0x4ad441);}(_0x6262,0x72));var _0x2626=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x6262[_0xbb091];return _0x467a04;};'use strict';var _=require('lodash');var util=require(_0x2626('0x0'));var moment=require('moment');var BPromise=require(_0x2626('0x1'));var db=require(_0x2626('0x2'))['db'];var logger=require(_0x2626('0x3'))('rpc');exports['GetCmHopper']=function(_0x4bd6e0){var _0x2761c9=this;return new Promise(function(_0x5d9a37,_0x2e8c48){return db['CmHopper'][_0x2626('0x4')]({'raw':_0x4bd6e0['options']?_0x4bd6e0['options'][_0x2626('0x5')]===undefined?!![]:![]:!![],'where':_0x4bd6e0[_0x2626('0x6')]?_0x4bd6e0[_0x2626('0x6')][_0x2626('0x7')]||null:null,'attributes':_0x4bd6e0[_0x2626('0x6')]?_0x4bd6e0['options']['attributes']||null:null,'limit':_0x4bd6e0[_0x2626('0x6')]?_0x4bd6e0[_0x2626('0x6')][_0x2626('0x8')]||null:null,'include':_0x4bd6e0[_0x2626('0x6')]?_0x4bd6e0[_0x2626('0x6')]['include']?_['map'](_0x4bd6e0[_0x2626('0x6')]['include'],function(_0x51bd80){return{'model':db[_0x51bd80['model']],'as':_0x51bd80['as'],'attributes':_0x51bd80[_0x2626('0x9')],'include':_0x51bd80['include']?_[_0x2626('0xa')](_0x51bd80[_0x2626('0xb')],function(_0x524a4a){return{'model':db[_0x524a4a[_0x2626('0xc')]],'as':_0x524a4a['as'],'attributes':_0x524a4a[_0x2626('0x9')],'include':_0x524a4a[_0x2626('0xb')]?_[_0x2626('0xa')](_0x524a4a['include'],function(_0x2f68a4){return{'model':db[_0x2f68a4[_0x2626('0xc')]],'as':_0x2f68a4['as'],'attributes':_0x2f68a4[_0x2626('0x9')]};}):[]};}):[]};}):[]:[]})[_0x2626('0xd')](function(_0x221d6f){logger['info'](_0x2626('0xe'),_0x4bd6e0);logger['debug'](_0x2626('0xe'),_0x4bd6e0,JSON[_0x2626('0xf')](_0x221d6f));_0x5d9a37(_0x221d6f);})['catch'](function(_0x2fa98b){logger['error']('GetCmHopper',_0x2fa98b[_0x2626('0x10')],_0x4bd6e0);_0x2e8c48(_0x2761c9['error'](0x1f4,_0x2fa98b[_0x2626('0x10')]));});});};exports[_0x2626('0x11')]=function(_0xb6493f){var _0x36e183=this;return new Promise(function(_0x1c58e6,_0xe4085){return db[_0x2626('0x12')][_0x2626('0x13')]({'raw':_0xb6493f[_0x2626('0x6')]?_0xb6493f[_0x2626('0x6')]['raw']===undefined?!![]:![]:!![],'where':_0xb6493f[_0x2626('0x6')]?_0xb6493f[_0x2626('0x6')][_0x2626('0x7')]||null:null,'attributes':_0xb6493f[_0x2626('0x6')]?_0xb6493f[_0x2626('0x6')][_0x2626('0x9')]||null:null,'include':_0xb6493f[_0x2626('0x6')]?_0xb6493f[_0x2626('0x6')][_0x2626('0xb')]?_['map'](_0xb6493f[_0x2626('0x6')][_0x2626('0xb')],function(_0x27bbf1){return{'model':db[_0x27bbf1['model']],'as':_0x27bbf1['as'],'attributes':_0x27bbf1[_0x2626('0x9')],'include':_0x27bbf1[_0x2626('0xb')]?_['map'](_0x27bbf1[_0x2626('0xb')],function(_0x3b6781){return{'model':db[_0x3b6781[_0x2626('0xc')]],'as':_0x3b6781['as'],'attributes':_0x3b6781[_0x2626('0x9')],'include':_0x3b6781[_0x2626('0xb')]?_[_0x2626('0xa')](_0x3b6781['include'],function(_0x516588){return{'model':db[_0x516588['model']],'as':_0x516588['as'],'attributes':_0x516588[_0x2626('0x9')]};}):[]};}):[]};}):[]:[]})[_0x2626('0xd')](function(_0x1d64d9){logger[_0x2626('0x14')](_0x2626('0x11'),_0xb6493f);logger[_0x2626('0x15')](_0x2626('0x11'),_0xb6493f,JSON[_0x2626('0xf')](_0x1d64d9));_0x1c58e6(_0x1d64d9);})[_0x2626('0x16')](function(_0x46fd80){logger[_0x2626('0x17')]('ShowCmHopper',_0x46fd80['message'],_0xb6493f);_0xe4085(_0x36e183[_0x2626('0x17')](0x1f4,_0x46fd80[_0x2626('0x10')]));});});};exports[_0x2626('0x18')]=function(_0x5b1231){var _0x2a4694=this;return new Promise(function(_0x28d4ca,_0x4b2c1a){return db[_0x2626('0x12')][_0x2626('0x19')](_0x5b1231[_0x2626('0x1a')],{'raw':_0x5b1231['options']?_0x5b1231[_0x2626('0x6')][_0x2626('0x5')]===undefined?!![]:![]:!![]})[_0x2626('0xd')](function(_0x2c6f9d){logger[_0x2626('0x14')](_0x2626('0x18'),_0x5b1231);logger[_0x2626('0x15')](_0x2626('0x18'),_0x5b1231,JSON[_0x2626('0xf')](_0x2c6f9d));_0x28d4ca(_0x2c6f9d);})['catch'](function(_0x320eb4){logger[_0x2626('0x17')](_0x2626('0x18'),_0x320eb4[_0x2626('0x10')],_0x5b1231);_0x4b2c1a(_0x2a4694[_0x2626('0x17')](0x1f4,_0x320eb4['message']));});});};exports[_0x2626('0x1b')]=function(_0x2b1d2f){var _0x1e6c14=this;return new Promise(function(_0x3340d0,_0x2f93eb){return db['CmHopper']['update'](_0x2b1d2f[_0x2626('0x1a')],{'raw':_0x2b1d2f[_0x2626('0x6')]?_0x2b1d2f['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b1d2f[_0x2626('0x6')]?_0x2b1d2f[_0x2626('0x6')][_0x2626('0x7')]||null:null,'attributes':_0x2b1d2f[_0x2626('0x6')]?_0x2b1d2f[_0x2626('0x6')][_0x2626('0x9')]||null:null,'limit':_0x2b1d2f[_0x2626('0x6')]?_0x2b1d2f['options'][_0x2626('0x8')]||null:null})[_0x2626('0xd')](function(_0x300ac9){logger[_0x2626('0x14')](_0x2626('0x1b'),_0x2b1d2f);logger[_0x2626('0x14')](_0x2626('0x1c'),JSON['stringify'](_0x2b1d2f[_0x2626('0x6')]['where']),_0x2b1d2f[_0x2626('0x1a')][_0x2626('0x1d')]);logger[_0x2626('0x15')]('UpdateCmHopper',_0x2b1d2f,JSON[_0x2626('0xf')](_0x300ac9));_0x3340d0(_0x300ac9);})['catch'](function(_0x2725c4){logger[_0x2626('0x17')](_0x2626('0x1b'),_0x2725c4['message'],_0x2b1d2f);_0x2f93eb(_0x1e6c14[_0x2626('0x17')](0x1f4,_0x2725c4[_0x2626('0x10')]));});});};exports[_0x2626('0x1e')]=function(_0x4b01dd){var _0x552972=this;return new Promise(function(_0x2a092b,_0x1e9c1d){return db['CmHopper'][_0x2626('0x1f')]({'where':_0x4b01dd[_0x2626('0x6')]?_0x4b01dd[_0x2626('0x6')]['where']||null:null})[_0x2626('0xd')](function(_0xa2641f){logger[_0x2626('0x14')](_0x2626('0x1e'),_0x4b01dd);logger[_0x2626('0x15')](_0x2626('0x1e'),_0x4b01dd,JSON[_0x2626('0xf')](_0xa2641f));_0x2a092b(_0xa2641f);})[_0x2626('0x16')](function(_0xb27663){logger['error'](_0x2626('0x1e'),_0xb27663['message'],_0x4b01dd);_0x1e9c1d(_0x552972[_0x2626('0x17')](0x1f4,_0xb27663[_0x2626('0x10')]));});});};exports['GetContactDialer']=function(_0x59df91){var _0x4c6dec=this;return new Promise(function(_0x434f19,_0x483a22){return db[_0x2626('0x20')][_0x2626('0x21')]()[_0x2626('0xd')](function(_0x10359e){return db[_0x2626('0x22')][_0x2626('0x23')](function(_0x398f5c){return db[_0x2626('0x12')][_0x2626('0x4')]({'where':_0x59df91['options']?_0x59df91[_0x2626('0x6')][_0x2626('0x7')]||null:null,'attributes':_0x59df91[_0x2626('0x6')]?_0x59df91[_0x2626('0x6')]['attributes']||null:null,'limit':_0x59df91[_0x2626('0x6')]?_0x59df91['options'][_0x2626('0x8')]||null:null,'order':_0x59df91['options']?_0x59df91[_0x2626('0x6')][_0x2626('0x24')]||null:null,'transaction':_0x398f5c,'lock':_0x398f5c[_0x2626('0x25')][_0x2626('0x26')],'include':[{'model':db['CmContact'],'as':_0x2626('0x27'),'attributes':_[_0x2626('0x28')](_0x10359e)},{'model':db[_0x2626('0x29')],'as':_0x2626('0x2a'),'attributes':['id',_0x2626('0x2b'),_0x2626('0x2c')]}]})['then'](function(_0x543bc7){var _0x439fbb=[];var _0x51bf9f=[];for(var _0x159dcd=0x0;_0x159dcd<_0x543bc7['length'];_0x159dcd+=0x1){var _0xe17c4c=_0x543bc7[_0x159dcd]['UserId'];if(_0xe17c4c===null){_0x439fbb[_0x2626('0x2d')](_0x543bc7[_0x159dcd][_0x2626('0x2e')](_0x59df91['body'],{'transaction':_0x398f5c}));}else if(!_0x51bf9f[_0x2626('0x2f')](_0xe17c4c)){_0x51bf9f[_0x2626('0x2d')](_0xe17c4c);_0x439fbb[_0x2626('0x2d')](_0x543bc7[_0x159dcd]['update'](_0x59df91['body'],{'transaction':_0x398f5c}));}}return BPromise[_0x2626('0x30')](_0x439fbb);});})[_0x2626('0xd')](function(_0x3e1389){logger[_0x2626('0x14')]('GetContactDialer',_0x59df91);if(_0x3e1389[_0x2626('0x31')]>0x0){logger[_0x2626('0x14')](_0x2626('0x32'),_0x3e1389[0x0][_0x2626('0x33')]['id'],_0x3e1389[0x0][_0x2626('0x33')][_0x2626('0x34')],_0x3e1389[0x0][_0x2626('0x33')][_0x2626('0x1d')]);}logger[_0x2626('0x15')](_0x2626('0x35'),_0x59df91,JSON[_0x2626('0xf')](_0x3e1389));_0x434f19(_0x3e1389);})[_0x2626('0x16')](function(_0x36d199){logger[_0x2626('0x17')](_0x2626('0x35'),_0x36d199[_0x2626('0x10')],_0x59df91);_0x483a22(_0x4c6dec[_0x2626('0x17')](0x1f4,_0x36d199['message']));});});});};exports[_0x2626('0x36')]=function(_0x2b0e3e){var _0x148b7a=this;return new Promise(function(_0x1d9028,_0x3d0a42){return db[_0x2626('0x22')][_0x2626('0x23')](function(_0x1e3706){return db[_0x2626('0x37')][_0x2626('0x19')](_0x2b0e3e[_0x2626('0x1a')],{'raw':_0x2b0e3e[_0x2626('0x6')]?_0x2b0e3e[_0x2626('0x6')][_0x2626('0x5')]===undefined?!![]:![]:!![],'transaction':_0x1e3706})['then'](function(){logger[_0x2626('0x14')](_0x2626('0x38'),JSON[_0x2626('0xf')](_0x2b0e3e[_0x2626('0x6')][_0x2626('0x7')]),_0x2b0e3e[_0x2626('0x6')][_0x2626('0x7')][_0x2626('0x1d')]);return db['CmHopper']['destroy']({'where':_0x2b0e3e[_0x2626('0x6')]?_0x2b0e3e[_0x2626('0x6')]['where']||null:null,'transaction':_0x1e3706});});})['then'](function(_0x2a3ee1){logger[_0x2626('0x14')](_0x2626('0x36'),_0x2b0e3e);logger[_0x2626('0x15')](_0x2626('0x36'),_0x2b0e3e,JSON[_0x2626('0xf')](_0x2a3ee1));_0x1d9028(_0x2a3ee1);})['catch'](function(_0xad6e17){logger[_0x2626('0x17')](_0x2626('0x36'),_0xad6e17[_0x2626('0x10')],_0x2b0e3e);_0x3d0a42(_0x148b7a['error'](0x1f4,_0xad6e17[_0x2626('0x10')]));});});};exports[_0x2626('0x39')]=function(_0x25889b){var _0x14f338=this;return new Promise(function(_0x5afe0d,_0x31944f){return db[_0x2626('0x12')][_0x2626('0x4')]({'raw':_0x25889b[_0x2626('0x6')]?_0x25889b[_0x2626('0x6')][_0x2626('0x5')]===undefined?!![]:![]:!![],'where':_0x25889b[_0x2626('0x6')]?_0x25889b[_0x2626('0x6')][_0x2626('0x7')]||null:null,'attributes':[[db['sequelize']['fn'](_0x2626('0x3a'),db[_0x2626('0x22')]['fn']('IF',db[_0x2626('0x22')][_0x2626('0x3b')](_0x2626('0x3c')+util[_0x2626('0x3d')]('\x22%s\x22',moment()[_0x2626('0x3d')](_0x2626('0x3e')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})['then'](function(_0xb759df){logger[_0x2626('0x14')](_0x2626('0x39'),_0x25889b);logger[_0x2626('0x15')](_0x2626('0x39'),_0x25889b,JSON[_0x2626('0xf')](_0xb759df));_0x5afe0d(_0xb759df);})['catch'](function(_0x34ef54){logger[_0x2626('0x17')](_0x2626('0x39'),_0x34ef54[_0x2626('0x10')],_0x25889b);_0x31944f(_0x14f338['error'](0x1f4,_0x34ef54[_0x2626('0x10')]));});});};exports[_0x2626('0x3f')]=function(_0xc207de){var _0x1f0618=this;return new Promise(function(_0x310d31,_0x5aa73e){return db[_0x2626('0x20')]['describe']()[_0x2626('0xd')](function(){return db[_0x2626('0x22')][_0x2626('0x23')](function(_0x35b790){return db[_0x2626('0x12')][_0x2626('0x4')]({'where':_0xc207de[_0x2626('0x6')]?_0xc207de['options'][_0x2626('0x7')]||null:null,'attributes':_0xc207de[_0x2626('0x6')]?_0xc207de['options'][_0x2626('0x9')]||null:null,'limit':0x1,'order':_0xc207de[_0x2626('0x6')]?_0xc207de[_0x2626('0x6')][_0x2626('0x24')]||null:null,'group':db[_0x2626('0x12')]['UserId'],'transaction':_0x35b790,'lock':_0x35b790[_0x2626('0x25')][_0x2626('0x26')],'include':_0xc207de['options']?_0xc207de['options'][_0x2626('0xb')]?_[_0x2626('0xa')](_0xc207de[_0x2626('0x6')][_0x2626('0xb')],function(_0x36f4c0){return{'model':db[_0x36f4c0[_0x2626('0xc')]],'as':_0x36f4c0['as'],'attributes':_0x36f4c0[_0x2626('0x9')],'include':_0x36f4c0['include']?_['map'](_0x36f4c0[_0x2626('0xb')],function(_0x1610b6){return{'model':db[_0x1610b6[_0x2626('0xc')]],'as':_0x1610b6['as'],'attributes':_0x1610b6['attributes'],'include':_0x1610b6['include']?_[_0x2626('0xa')](_0x1610b6[_0x2626('0xb')],function(_0x1ec59b){return{'model':db[_0x1ec59b[_0x2626('0xc')]],'as':_0x1ec59b['as'],'attributes':_0x1ec59b[_0x2626('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x696806){var _0x598b0b=[];for(var _0x46df94=0x0;_0x46df94<_0x696806[_0x2626('0x31')];_0x46df94+=0x1){_0x598b0b[_0x2626('0x2d')](_0x696806[_0x46df94][_0x2626('0x2e')](_0xc207de[_0x2626('0x1a')],{'transaction':_0x35b790}));}return BPromise[_0x2626('0x30')](_0x598b0b);});})[_0x2626('0xd')](function(_0x284767){logger[_0x2626('0x14')](_0x2626('0x3f'),_0xc207de);logger['debug'](_0x2626('0x3f'),_0xc207de,JSON[_0x2626('0xf')](_0x284767));_0x310d31(_0x284767);})['catch'](function(_0xb1f1b9){logger[_0x2626('0x17')](_0x2626('0x3f'),_0xb1f1b9['message'],_0xc207de);_0x5aa73e(_0x1f0618['error'](0x1f4,_0xb1f1b9[_0x2626('0x10')]));});});});};exports['GetCmHopperPreview']=function(_0x3fff47){var _0x496f9e=this;return new Promise(function(_0x34a053,_0x1c4d98){db[_0x2626('0x20')][_0x2626('0x21')]()['then'](function(_0x55b522){return db[_0x2626('0x12')]['findAll']({'raw':_0x3fff47[_0x2626('0x6')]?_0x3fff47[_0x2626('0x6')][_0x2626('0x5')]===undefined?!![]:![]:!![],'where':_0x3fff47[_0x2626('0x6')]?_0x3fff47[_0x2626('0x6')][_0x2626('0x7')]||null:null,'attributes':_0x3fff47[_0x2626('0x6')]?_0x3fff47[_0x2626('0x6')][_0x2626('0x9')]||null:null,'limit':_0x3fff47['options']?_0x3fff47[_0x2626('0x6')][_0x2626('0x8')]||null:null,'include':_0x3fff47[_0x2626('0x6')]?_0x3fff47[_0x2626('0x6')][_0x2626('0xb')]?_['map'](_0x3fff47[_0x2626('0x6')][_0x2626('0xb')],function(_0x19a466){return{'model':db[_0x19a466[_0x2626('0xc')]],'as':_0x19a466['as'],'attributes':_0x19a466['as']===_0x2626('0x27')?_[_0x2626('0x28')](_0x55b522):_0x19a466[_0x2626('0x9')],'include':_0x19a466[_0x2626('0xb')]?_[_0x2626('0xa')](_0x19a466[_0x2626('0xb')],function(_0x581ba2){return{'model':db[_0x581ba2['model']],'as':_0x581ba2['as'],'attributes':_0x581ba2[_0x2626('0x9')],'include':_0x581ba2[_0x2626('0xb')]?_[_0x2626('0xa')](_0x581ba2[_0x2626('0xb')],function(_0x1b1732){return{'model':db[_0x1b1732[_0x2626('0xc')]],'as':_0x1b1732['as'],'attributes':_0x1b1732[_0x2626('0x9')]};}):[]};}):[]};}):[]:[]})[_0x2626('0xd')](function(_0xc14b25){logger['info'](_0x2626('0xe'),_0x3fff47);logger[_0x2626('0x15')](_0x2626('0xe'),_0x3fff47,JSON[_0x2626('0xf')](_0xc14b25));_0x34a053(_0xc14b25);})[_0x2626('0x16')](function(_0x2ae3b4){logger[_0x2626('0x17')](_0x2626('0xe'),_0x2ae3b4['message'],_0x3fff47);_0x1c4d98(_0x496f9e[_0x2626('0x17')](0x1f4,_0x2ae3b4[_0x2626('0x10')]));});});});};exports['GetContactByPhone']=function(_0x1fb7c4){var _0x44f88d=this;return new Promise(function(_0x3652bb,_0x4f7b2b){return db[_0x2626('0x20')][_0x2626('0x40')]({'raw':!![],'where':{'phone':_0x1fb7c4['options'][_0x2626('0x7')][_0x2626('0x41')]},'attributes':['id',_0x2626('0x42')],'order':[['id',_0x2626('0x43')]]})[_0x2626('0xd')](function(_0x53a76c){logger[_0x2626('0x14')](_0x2626('0x44'),_0x1fb7c4);logger[_0x2626('0x15')]('getContactByPhone',_0x1fb7c4,JSON[_0x2626('0xf')](_0x53a76c));_0x3652bb(_0x53a76c);})[_0x2626('0x16')](function(_0x43591a){logger[_0x2626('0x17')]('getContactByPhone',_0x43591a[_0x2626('0x10')],_0x1fb7c4);_0x4f7b2b(_0x44f88d[_0x2626('0x17')](0x1f4,_0x43591a['message']));});});};exports[_0x2626('0x45')]=function(_0x3877cd){var _0x1a68fa=this;return new Promise(function(_0x502b2f,_0x4000b9){return db['sequelize'][_0x2626('0x23')](function(_0x6937a6){var _0x9f2994=_0x3877cd['options']&&_0x3877cd[_0x2626('0x6')][_0x2626('0x7')]?_0x3877cd[_0x2626('0x6')][_0x2626('0x7')]:{};return db[_0x2626('0x12')][_0x2626('0x2e')](_0x3877cd[_0x2626('0x1a')],{'where':_0x9f2994,'transaction':_0x6937a6})['then'](function(_0x5e02de){logger[_0x2626('0x14')]('ResetActiveCalls',_0x3877cd);logger[_0x2626('0x15')]('ResetActiveCalls',_0x3877cd,JSON['stringify'](_0x5e02de));_0x502b2f(_0x5e02de);})[_0x2626('0x16')](function(_0x601a25){logger[_0x2626('0x17')](_0x2626('0x45'),_0x601a25[_0x2626('0x10')],_0x3877cd);_0x4000b9(_0x1a68fa[_0x2626('0x17')](0x1f4,_0x601a25[_0x2626('0x10')]));});});});};exports[_0x2626('0x46')]=function(_0x152973){var _0x2f5b50=this;var _0x50fb18=_0x152973['body'][_0x2626('0x7')]['voiceQueueIds'];var _0x2c479c=_0x152973[_0x2626('0x1a')][_0x2626('0x7')][_0x2626('0x47')];var _0x405ff8=_0x152973[_0x2626('0x1a')][_0x2626('0x7')]['availableAgentsIds'];return new Promise(function(_0xc6242e,_0x2afe5f){return db[_0x2626('0x12')][_0x2626('0x4')]({'where':{'voiceQueueId':{'$in':_0x50fb18},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize']['literal']('NOW()\x20+\x20INTERVAL\x20'+_0x2c479c+_0x2626('0x48')),'$gt':db[_0x2626('0x22')]['literal']('NOW()')}},'UserId':{'$in':_0x405ff8}},'include':[{'model':db[_0x2626('0x20')],'as':_0x2626('0x27')},{'model':db[_0x2626('0x29')],'as':'Agent','attributes':['id',_0x2626('0x2b'),_0x2626('0x2c')]},{'model':db['CmList'],'as':_0x2626('0x49')}]})['then'](function(_0x243e3d){if(_0x243e3d[_0x2626('0x31')]>0x0){return db[_0x2626('0x22')][_0x2626('0x23')](function(_0x525b5a){return db[_0x2626('0x12')][_0x2626('0x2e')]({'recallmeNotifiedDate':db[_0x2626('0x22')][_0x2626('0x3b')]('NOW()')},{'where':{'id':{'$in':_[_0x2626('0xa')](_0x243e3d,'id')}},'transaction':_0x525b5a})['then'](function(){_0xc6242e(_0x243e3d);})[_0x2626('0x16')](function(_0x2a18c2){logger['error'](_0x2626('0x46'),_0x2a18c2[_0x2626('0x10')],_0x152973);_0x2afe5f(_0x2f5b50[_0x2626('0x17')](0x1f4,_0x2a18c2['message']));});})[_0x2626('0x16')](function(_0xff772a){logger['error'](_0x2626('0x46'),_0xff772a[_0x2626('0x10')],_0x152973);_0x2afe5f(_0x2f5b50[_0x2626('0x17')](0x1f4,_0xff772a[_0x2626('0x10')]));});}else{_0xc6242e(_0x243e3d);}});});}; \ No newline at end of file +var _0x4f8f=['getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','\x20MINUTE','CmList','List','NOW()','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','include','map','model','then','debug','stringify','catch','message','error','ShowCmHopper','find','info','CreateCmHopper','create','body','UpdateCmHopper','update','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','UserId','push','all','GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','CmHopperFinal','MoveContactManagedDialer','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','findOne','dialTimezone','DESC'];(function(_0x8153ce,_0xcb6429){var _0x3294bc=function(_0x52382f){while(--_0x52382f){_0x8153ce['push'](_0x8153ce['shift']());}};_0x3294bc(++_0xcb6429);}(_0x4f8f,0x1a8));var _0xf4f8=function(_0x574b1c,_0x606069){_0x574b1c=_0x574b1c-0x0;var _0x458d45=_0x4f8f[_0x574b1c];return _0x458d45;};'use strict';var _=require(_0xf4f8('0x0'));var util=require(_0xf4f8('0x1'));var moment=require(_0xf4f8('0x2'));var BPromise=require(_0xf4f8('0x3'));var db=require(_0xf4f8('0x4'))['db'];var logger=require(_0xf4f8('0x5'))(_0xf4f8('0x6'));exports[_0xf4f8('0x7')]=function(_0xdbd1b2){var _0x1150bc=this;return new Promise(function(_0x37938c,_0x2cb8db){return db[_0xf4f8('0x8')][_0xf4f8('0x9')]({'raw':_0xdbd1b2[_0xf4f8('0xa')]?_0xdbd1b2[_0xf4f8('0xa')][_0xf4f8('0xb')]===undefined?!![]:![]:!![],'where':_0xdbd1b2[_0xf4f8('0xa')]?_0xdbd1b2['options'][_0xf4f8('0xc')]||null:null,'attributes':_0xdbd1b2['options']?_0xdbd1b2[_0xf4f8('0xa')][_0xf4f8('0xd')]||null:null,'limit':_0xdbd1b2[_0xf4f8('0xa')]?_0xdbd1b2[_0xf4f8('0xa')]['limit']||null:null,'include':_0xdbd1b2[_0xf4f8('0xa')]?_0xdbd1b2[_0xf4f8('0xa')][_0xf4f8('0xe')]?_[_0xf4f8('0xf')](_0xdbd1b2[_0xf4f8('0xa')]['include'],function(_0x42490c){return{'model':db[_0x42490c['model']],'as':_0x42490c['as'],'attributes':_0x42490c['attributes'],'include':_0x42490c['include']?_[_0xf4f8('0xf')](_0x42490c[_0xf4f8('0xe')],function(_0x5cfbcf){return{'model':db[_0x5cfbcf[_0xf4f8('0x10')]],'as':_0x5cfbcf['as'],'attributes':_0x5cfbcf['attributes'],'include':_0x5cfbcf[_0xf4f8('0xe')]?_[_0xf4f8('0xf')](_0x5cfbcf['include'],function(_0x600297){return{'model':db[_0x600297['model']],'as':_0x600297['as'],'attributes':_0x600297[_0xf4f8('0xd')]};}):[]};}):[]};}):[]:[]})[_0xf4f8('0x11')](function(_0x15e188){logger['info'](_0xf4f8('0x7'),_0xdbd1b2);logger[_0xf4f8('0x12')]('GetCmHopper',_0xdbd1b2,JSON[_0xf4f8('0x13')](_0x15e188));_0x37938c(_0x15e188);})[_0xf4f8('0x14')](function(_0x3d508f){logger['error']('GetCmHopper',_0x3d508f[_0xf4f8('0x15')],_0xdbd1b2);_0x2cb8db(_0x1150bc[_0xf4f8('0x16')](0x1f4,_0x3d508f['message']));});});};exports[_0xf4f8('0x17')]=function(_0x482f10){var _0x4eaf95=this;return new Promise(function(_0x41c9e1,_0x587997){return db[_0xf4f8('0x8')][_0xf4f8('0x18')]({'raw':_0x482f10['options']?_0x482f10[_0xf4f8('0xa')][_0xf4f8('0xb')]===undefined?!![]:![]:!![],'where':_0x482f10[_0xf4f8('0xa')]?_0x482f10[_0xf4f8('0xa')][_0xf4f8('0xc')]||null:null,'attributes':_0x482f10['options']?_0x482f10['options'][_0xf4f8('0xd')]||null:null,'include':_0x482f10['options']?_0x482f10['options'][_0xf4f8('0xe')]?_[_0xf4f8('0xf')](_0x482f10['options'][_0xf4f8('0xe')],function(_0x279970){return{'model':db[_0x279970[_0xf4f8('0x10')]],'as':_0x279970['as'],'attributes':_0x279970[_0xf4f8('0xd')],'include':_0x279970[_0xf4f8('0xe')]?_[_0xf4f8('0xf')](_0x279970[_0xf4f8('0xe')],function(_0x6d01ab){return{'model':db[_0x6d01ab[_0xf4f8('0x10')]],'as':_0x6d01ab['as'],'attributes':_0x6d01ab['attributes'],'include':_0x6d01ab[_0xf4f8('0xe')]?_['map'](_0x6d01ab[_0xf4f8('0xe')],function(_0x1bfd8d){return{'model':db[_0x1bfd8d[_0xf4f8('0x10')]],'as':_0x1bfd8d['as'],'attributes':_0x1bfd8d[_0xf4f8('0xd')]};}):[]};}):[]};}):[]:[]})[_0xf4f8('0x11')](function(_0x528829){logger[_0xf4f8('0x19')](_0xf4f8('0x17'),_0x482f10);logger[_0xf4f8('0x12')](_0xf4f8('0x17'),_0x482f10,JSON[_0xf4f8('0x13')](_0x528829));_0x41c9e1(_0x528829);})['catch'](function(_0x48dbea){logger[_0xf4f8('0x16')](_0xf4f8('0x17'),_0x48dbea[_0xf4f8('0x15')],_0x482f10);_0x587997(_0x4eaf95['error'](0x1f4,_0x48dbea['message']));});});};exports[_0xf4f8('0x1a')]=function(_0x41e566){var _0x32415c=this;return new Promise(function(_0x34e982,_0x25ac6f){return db[_0xf4f8('0x8')][_0xf4f8('0x1b')](_0x41e566[_0xf4f8('0x1c')],{'raw':_0x41e566[_0xf4f8('0xa')]?_0x41e566[_0xf4f8('0xa')][_0xf4f8('0xb')]===undefined?!![]:![]:!![]})[_0xf4f8('0x11')](function(_0x37e089){logger[_0xf4f8('0x19')](_0xf4f8('0x1a'),_0x41e566);logger['debug'](_0xf4f8('0x1a'),_0x41e566,JSON[_0xf4f8('0x13')](_0x37e089));_0x34e982(_0x37e089);})[_0xf4f8('0x14')](function(_0x92be34){logger[_0xf4f8('0x16')](_0xf4f8('0x1a'),_0x92be34[_0xf4f8('0x15')],_0x41e566);_0x25ac6f(_0x32415c[_0xf4f8('0x16')](0x1f4,_0x92be34[_0xf4f8('0x15')]));});});};exports[_0xf4f8('0x1d')]=function(_0x4aff9b){var _0x39c066=this;return new Promise(function(_0x361d3e,_0x573dbf){return db[_0xf4f8('0x8')][_0xf4f8('0x1e')](_0x4aff9b[_0xf4f8('0x1c')],{'raw':_0x4aff9b[_0xf4f8('0xa')]?_0x4aff9b[_0xf4f8('0xa')][_0xf4f8('0xb')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4aff9b[_0xf4f8('0xa')]?_0x4aff9b[_0xf4f8('0xa')][_0xf4f8('0xc')]||null:null,'attributes':_0x4aff9b[_0xf4f8('0xa')]?_0x4aff9b['options'][_0xf4f8('0xd')]||null:null,'limit':_0x4aff9b[_0xf4f8('0xa')]?_0x4aff9b[_0xf4f8('0xa')][_0xf4f8('0x1f')]||null:null})[_0xf4f8('0x11')](function(_0x54853c){logger[_0xf4f8('0x19')](_0xf4f8('0x1d'),_0x4aff9b);logger['info'](_0xf4f8('0x20'),JSON['stringify'](_0x4aff9b[_0xf4f8('0xa')][_0xf4f8('0xc')]),_0x4aff9b[_0xf4f8('0x1c')][_0xf4f8('0x21')]);logger[_0xf4f8('0x12')]('UpdateCmHopper',_0x4aff9b,JSON[_0xf4f8('0x13')](_0x54853c));_0x361d3e(_0x54853c);})[_0xf4f8('0x14')](function(_0x42c13f){logger['error']('UpdateCmHopper',_0x42c13f[_0xf4f8('0x15')],_0x4aff9b);_0x573dbf(_0x39c066[_0xf4f8('0x16')](0x1f4,_0x42c13f['message']));});});};exports[_0xf4f8('0x22')]=function(_0x4d471d){var _0x8694e1=this;return new Promise(function(_0xd02081,_0xcc26b8){return db[_0xf4f8('0x8')][_0xf4f8('0x23')]({'where':_0x4d471d[_0xf4f8('0xa')]?_0x4d471d[_0xf4f8('0xa')]['where']||null:null})[_0xf4f8('0x11')](function(_0x5e84e3){logger['info'](_0xf4f8('0x22'),_0x4d471d);logger[_0xf4f8('0x12')]('DestroyCmHopper',_0x4d471d,JSON[_0xf4f8('0x13')](_0x5e84e3));_0xd02081(_0x5e84e3);})['catch'](function(_0x1c38cb){logger[_0xf4f8('0x16')](_0xf4f8('0x22'),_0x1c38cb[_0xf4f8('0x15')],_0x4d471d);_0xcc26b8(_0x8694e1['error'](0x1f4,_0x1c38cb['message']));});});};exports['GetContactDialer']=function(_0x34dbdf){var _0x279a41=this;return new Promise(function(_0x5f04a0,_0x152f2e){return db[_0xf4f8('0x24')][_0xf4f8('0x25')]()[_0xf4f8('0x11')](function(_0x3213ca){return db[_0xf4f8('0x26')][_0xf4f8('0x27')](function(_0x60c18a){return db[_0xf4f8('0x8')][_0xf4f8('0x9')]({'where':_0x34dbdf[_0xf4f8('0xa')]?_0x34dbdf[_0xf4f8('0xa')][_0xf4f8('0xc')]||null:null,'attributes':_0x34dbdf['options']?_0x34dbdf[_0xf4f8('0xa')][_0xf4f8('0xd')]||null:null,'limit':_0x34dbdf[_0xf4f8('0xa')]?_0x34dbdf['options'][_0xf4f8('0x1f')]||null:null,'order':_0x34dbdf[_0xf4f8('0xa')]?_0x34dbdf['options'][_0xf4f8('0x28')]||null:null,'transaction':_0x60c18a,'lock':_0x60c18a[_0xf4f8('0x29')][_0xf4f8('0x2a')],'include':[{'model':db[_0xf4f8('0x24')],'as':_0xf4f8('0x2b'),'attributes':_[_0xf4f8('0x2c')](_0x3213ca)},{'model':db[_0xf4f8('0x2d')],'as':_0xf4f8('0x2e'),'attributes':['id',_0xf4f8('0x2f'),_0xf4f8('0x30')]}]})['then'](function(_0x3920c3){var _0x4bfaaf=[];var _0x249b8c=[];for(var _0x506fa4=0x0;_0x506fa4<_0x3920c3[_0xf4f8('0x31')];_0x506fa4+=0x1){var _0x438c50=_0x3920c3[_0x506fa4][_0xf4f8('0x32')];if(_0x438c50===null){_0x4bfaaf[_0xf4f8('0x33')](_0x3920c3[_0x506fa4][_0xf4f8('0x1e')](_0x34dbdf['body'],{'transaction':_0x60c18a}));}else if(!_0x249b8c['includes'](_0x438c50)){_0x249b8c['push'](_0x438c50);_0x4bfaaf[_0xf4f8('0x33')](_0x3920c3[_0x506fa4][_0xf4f8('0x1e')](_0x34dbdf[_0xf4f8('0x1c')],{'transaction':_0x60c18a}));}}return BPromise[_0xf4f8('0x34')](_0x4bfaaf);});})[_0xf4f8('0x11')](function(_0x1f3644){logger[_0xf4f8('0x19')](_0xf4f8('0x35'),_0x34dbdf);if(_0x1f3644['length']>0x0){logger[_0xf4f8('0x19')](_0xf4f8('0x36'),_0x1f3644[0x0][_0xf4f8('0x37')]['id'],_0x1f3644[0x0]['dataValues'][_0xf4f8('0x38')],_0x1f3644[0x0][_0xf4f8('0x37')][_0xf4f8('0x21')]);}logger[_0xf4f8('0x12')](_0xf4f8('0x35'),_0x34dbdf,JSON['stringify'](_0x1f3644));_0x5f04a0(_0x1f3644);})[_0xf4f8('0x14')](function(_0x1272b1){logger[_0xf4f8('0x16')](_0xf4f8('0x35'),_0x1272b1[_0xf4f8('0x15')],_0x34dbdf);_0x152f2e(_0x279a41[_0xf4f8('0x16')](0x1f4,_0x1272b1['message']));});});});};exports['MoveContactManagedDialer']=function(_0x476862){var _0x240eee=this;return new Promise(function(_0x58b716,_0x22f8dc){return db['sequelize'][_0xf4f8('0x27')](function(_0x21665f){return db[_0xf4f8('0x39')]['create'](_0x476862[_0xf4f8('0x1c')],{'raw':_0x476862[_0xf4f8('0xa')]?_0x476862[_0xf4f8('0xa')][_0xf4f8('0xb')]===undefined?!![]:![]:!![],'transaction':_0x21665f})[_0xf4f8('0x11')](function(){logger[_0xf4f8('0x19')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xf4f8('0x13')](_0x476862[_0xf4f8('0xa')]['where']),_0x476862[_0xf4f8('0xa')][_0xf4f8('0xc')]['active']);return db[_0xf4f8('0x8')]['destroy']({'where':_0x476862['options']?_0x476862[_0xf4f8('0xa')][_0xf4f8('0xc')]||null:null,'transaction':_0x21665f});});})['then'](function(_0x45fe75){logger[_0xf4f8('0x19')](_0xf4f8('0x3a'),_0x476862);logger[_0xf4f8('0x12')](_0xf4f8('0x3a'),_0x476862,JSON['stringify'](_0x45fe75));_0x58b716(_0x45fe75);})[_0xf4f8('0x14')](function(_0x121521){logger[_0xf4f8('0x16')](_0xf4f8('0x3a'),_0x121521[_0xf4f8('0x15')],_0x476862);_0x22f8dc(_0x240eee[_0xf4f8('0x16')](0x1f4,_0x121521[_0xf4f8('0x15')]));});});};exports['CountReScheduled']=function(_0x201f7b){var _0xf7250f=this;return new Promise(function(_0x2d8d4f,_0x57fc90){return db[_0xf4f8('0x8')][_0xf4f8('0x9')]({'raw':_0x201f7b['options']?_0x201f7b[_0xf4f8('0xa')][_0xf4f8('0xb')]===undefined?!![]:![]:!![],'where':_0x201f7b[_0xf4f8('0xa')]?_0x201f7b[_0xf4f8('0xa')][_0xf4f8('0xc')]||null:null,'attributes':[[db[_0xf4f8('0x26')]['fn'](_0xf4f8('0x3b'),db[_0xf4f8('0x26')]['fn']('IF',db[_0xf4f8('0x26')][_0xf4f8('0x3c')](_0xf4f8('0x3d')+util[_0xf4f8('0x3e')](_0xf4f8('0x3f'),moment()[_0xf4f8('0x3e')](_0xf4f8('0x40')))+_0xf4f8('0x41')))),_0xf4f8('0x42')]]})[_0xf4f8('0x11')](function(_0x274823){logger['info'](_0xf4f8('0x43'),_0x201f7b);logger[_0xf4f8('0x12')](_0xf4f8('0x43'),_0x201f7b,JSON[_0xf4f8('0x13')](_0x274823));_0x2d8d4f(_0x274823);})[_0xf4f8('0x14')](function(_0xe7525c){logger['error'](_0xf4f8('0x43'),_0xe7525c[_0xf4f8('0x15')],_0x201f7b);_0x57fc90(_0xf7250f[_0xf4f8('0x16')](0x1f4,_0xe7525c[_0xf4f8('0x15')]));});});};exports[_0xf4f8('0x44')]=function(_0xb64737){var _0x19b82f=this;return new Promise(function(_0x24dfcc,_0xc9c960){return db[_0xf4f8('0x24')]['describe']()[_0xf4f8('0x11')](function(){return db[_0xf4f8('0x26')][_0xf4f8('0x27')](function(_0xa05358){return db[_0xf4f8('0x8')][_0xf4f8('0x9')]({'where':_0xb64737['options']?_0xb64737[_0xf4f8('0xa')][_0xf4f8('0xc')]||null:null,'attributes':_0xb64737['options']?_0xb64737[_0xf4f8('0xa')]['attributes']||null:null,'limit':0x1,'order':_0xb64737['options']?_0xb64737[_0xf4f8('0xa')][_0xf4f8('0x28')]||null:null,'group':db['CmHopper'][_0xf4f8('0x32')],'transaction':_0xa05358,'lock':_0xa05358[_0xf4f8('0x29')][_0xf4f8('0x2a')],'include':_0xb64737[_0xf4f8('0xa')]?_0xb64737['options']['include']?_[_0xf4f8('0xf')](_0xb64737[_0xf4f8('0xa')][_0xf4f8('0xe')],function(_0x2dd80f){return{'model':db[_0x2dd80f[_0xf4f8('0x10')]],'as':_0x2dd80f['as'],'attributes':_0x2dd80f[_0xf4f8('0xd')],'include':_0x2dd80f[_0xf4f8('0xe')]?_['map'](_0x2dd80f['include'],function(_0x27fe0e){return{'model':db[_0x27fe0e[_0xf4f8('0x10')]],'as':_0x27fe0e['as'],'attributes':_0x27fe0e[_0xf4f8('0xd')],'include':_0x27fe0e[_0xf4f8('0xe')]?_[_0xf4f8('0xf')](_0x27fe0e[_0xf4f8('0xe')],function(_0x4a63db){return{'model':db[_0x4a63db[_0xf4f8('0x10')]],'as':_0x4a63db['as'],'attributes':_0x4a63db[_0xf4f8('0xd')]};}):[]};}):[]};}):[]:[]})[_0xf4f8('0x11')](function(_0x46fe2c){var _0x392638=[];for(var _0x478339=0x0;_0x478339<_0x46fe2c[_0xf4f8('0x31')];_0x478339+=0x1){_0x392638[_0xf4f8('0x33')](_0x46fe2c[_0x478339][_0xf4f8('0x1e')](_0xb64737[_0xf4f8('0x1c')],{'transaction':_0xa05358}));}return BPromise[_0xf4f8('0x34')](_0x392638);});})[_0xf4f8('0x11')](function(_0x407ce1){logger[_0xf4f8('0x19')](_0xf4f8('0x44'),_0xb64737);logger[_0xf4f8('0x12')](_0xf4f8('0x44'),_0xb64737,JSON[_0xf4f8('0x13')](_0x407ce1));_0x24dfcc(_0x407ce1);})[_0xf4f8('0x14')](function(_0x5358fb){logger[_0xf4f8('0x16')](_0xf4f8('0x44'),_0x5358fb[_0xf4f8('0x15')],_0xb64737);_0xc9c960(_0x19b82f['error'](0x1f4,_0x5358fb[_0xf4f8('0x15')]));});});});};exports[_0xf4f8('0x45')]=function(_0x55f17d){var _0x2eb96b=this;return new Promise(function(_0x56c5e2,_0x158dcd){db['CmContact']['describe']()['then'](function(_0x5b0070){return db[_0xf4f8('0x8')]['findAll']({'raw':_0x55f17d[_0xf4f8('0xa')]?_0x55f17d['options'][_0xf4f8('0xb')]===undefined?!![]:![]:!![],'where':_0x55f17d[_0xf4f8('0xa')]?_0x55f17d['options']['where']||null:null,'attributes':_0x55f17d[_0xf4f8('0xa')]?_0x55f17d[_0xf4f8('0xa')][_0xf4f8('0xd')]||null:null,'limit':_0x55f17d[_0xf4f8('0xa')]?_0x55f17d[_0xf4f8('0xa')][_0xf4f8('0x1f')]||null:null,'include':_0x55f17d[_0xf4f8('0xa')]?_0x55f17d[_0xf4f8('0xa')][_0xf4f8('0xe')]?_[_0xf4f8('0xf')](_0x55f17d[_0xf4f8('0xa')][_0xf4f8('0xe')],function(_0x533d2a){return{'model':db[_0x533d2a['model']],'as':_0x533d2a['as'],'attributes':_0x533d2a['as']==='Contact'?_[_0xf4f8('0x2c')](_0x5b0070):_0x533d2a[_0xf4f8('0xd')],'include':_0x533d2a[_0xf4f8('0xe')]?_['map'](_0x533d2a['include'],function(_0x55dcd2){return{'model':db[_0x55dcd2[_0xf4f8('0x10')]],'as':_0x55dcd2['as'],'attributes':_0x55dcd2[_0xf4f8('0xd')],'include':_0x55dcd2[_0xf4f8('0xe')]?_[_0xf4f8('0xf')](_0x55dcd2['include'],function(_0x5b2754){return{'model':db[_0x5b2754['model']],'as':_0x5b2754['as'],'attributes':_0x5b2754[_0xf4f8('0xd')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x585391){logger[_0xf4f8('0x19')](_0xf4f8('0x7'),_0x55f17d);logger[_0xf4f8('0x12')]('GetCmHopper',_0x55f17d,JSON[_0xf4f8('0x13')](_0x585391));_0x56c5e2(_0x585391);})[_0xf4f8('0x14')](function(_0x42fd8a){logger[_0xf4f8('0x16')]('GetCmHopper',_0x42fd8a['message'],_0x55f17d);_0x158dcd(_0x2eb96b[_0xf4f8('0x16')](0x1f4,_0x42fd8a['message']));});});});};exports[_0xf4f8('0x46')]=function(_0x57c01c){var _0x51fd2e=this;return new Promise(function(_0x214e21,_0x43e469){return db[_0xf4f8('0x24')][_0xf4f8('0x47')]({'raw':!![],'where':{'phone':_0x57c01c[_0xf4f8('0xa')][_0xf4f8('0xc')]['phone']},'attributes':['id',_0xf4f8('0x48')],'order':[['id',_0xf4f8('0x49')]]})[_0xf4f8('0x11')](function(_0x1b6d1b){logger[_0xf4f8('0x19')](_0xf4f8('0x4a'),_0x57c01c);logger[_0xf4f8('0x12')](_0xf4f8('0x4a'),_0x57c01c,JSON[_0xf4f8('0x13')](_0x1b6d1b));_0x214e21(_0x1b6d1b);})[_0xf4f8('0x14')](function(_0x4eebdb){logger['error'](_0xf4f8('0x4a'),_0x4eebdb['message'],_0x57c01c);_0x43e469(_0x51fd2e[_0xf4f8('0x16')](0x1f4,_0x4eebdb[_0xf4f8('0x15')]));});});};exports[_0xf4f8('0x4b')]=function(_0x56e888){var _0x203485=this;return new Promise(function(_0x4429c5,_0x2597c0){return db[_0xf4f8('0x26')]['transaction'](function(_0x24c80a){var _0x53c602=_0x56e888['options']&&_0x56e888['options'][_0xf4f8('0xc')]?_0x56e888[_0xf4f8('0xa')]['where']:{};return db[_0xf4f8('0x8')][_0xf4f8('0x1e')](_0x56e888['body'],{'where':_0x53c602,'transaction':_0x24c80a})['then'](function(_0x303960){logger[_0xf4f8('0x19')](_0xf4f8('0x4b'),_0x56e888);logger[_0xf4f8('0x12')](_0xf4f8('0x4b'),_0x56e888,JSON[_0xf4f8('0x13')](_0x303960));_0x4429c5(_0x303960);})[_0xf4f8('0x14')](function(_0x49664b){logger[_0xf4f8('0x16')](_0xf4f8('0x4b'),_0x49664b['message'],_0x56e888);_0x2597c0(_0x203485[_0xf4f8('0x16')](0x1f4,_0x49664b['message']));});});});};exports[_0xf4f8('0x4c')]=function(_0x5f0100){var _0x105a96=this;var _0x1531d0=_0x5f0100[_0xf4f8('0x1c')][_0xf4f8('0xc')][_0xf4f8('0x4d')];var _0x433838=_0x5f0100[_0xf4f8('0x1c')][_0xf4f8('0xc')][_0xf4f8('0x4e')];var _0x198574=_0x5f0100['body'][_0xf4f8('0xc')]['availableAgentsIds'];return new Promise(function(_0x1855f3,_0x33cafe){return db[_0xf4f8('0x8')][_0xf4f8('0x9')]({'where':{'voiceQueueId':{'$in':_0x1531d0},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xf4f8('0x26')]['literal']('NOW()\x20+\x20INTERVAL\x20'+_0x433838+_0xf4f8('0x4f')),'$gt':db[_0xf4f8('0x26')][_0xf4f8('0x3c')]('NOW()')}},'UserId':{'$in':_0x198574}},'include':[{'model':db[_0xf4f8('0x24')],'as':'Contact'},{'model':db[_0xf4f8('0x2d')],'as':_0xf4f8('0x2e'),'attributes':['id','name','voicePause']},{'model':db[_0xf4f8('0x50')],'as':_0xf4f8('0x51')}]})[_0xf4f8('0x11')](function(_0x1ed610){if(_0x1ed610[_0xf4f8('0x31')]>0x0){return db[_0xf4f8('0x26')][_0xf4f8('0x27')](function(_0x470598){return db[_0xf4f8('0x8')][_0xf4f8('0x1e')]({'recallmeNotifiedDate':db['sequelize'][_0xf4f8('0x3c')](_0xf4f8('0x52'))},{'where':{'id':{'$in':_[_0xf4f8('0xf')](_0x1ed610,'id')}},'transaction':_0x470598})[_0xf4f8('0x11')](function(){_0x1855f3(_0x1ed610);})[_0xf4f8('0x14')](function(_0x10f7a5){logger[_0xf4f8('0x16')](_0xf4f8('0x4c'),_0x10f7a5[_0xf4f8('0x15')],_0x5f0100);_0x33cafe(_0x105a96[_0xf4f8('0x16')](0x1f4,_0x10f7a5['message']));});})[_0xf4f8('0x14')](function(_0x201e54){logger[_0xf4f8('0x16')](_0xf4f8('0x4c'),_0x201e54[_0xf4f8('0x15')],_0x5f0100);_0x33cafe(_0x105a96[_0xf4f8('0x16')](0x1f4,_0x201e54[_0xf4f8('0x15')]));});}else{_0x1855f3(_0x1ed610);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index a02cb8e..1c79c19 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 _0x5853=['/preview','getPreview','/timezone','put','/:id','update','delete','exports','express','Router','./cmHopper.controller','get','index','/describe','isAuthenticated','/opencontacts','getOpenContacts','/timezones','/:id/previewrecall','getPreviewRecall','create','post'];(function(_0x562911,_0x5be4ae){var _0x2003e2=function(_0xe8069b){while(--_0xe8069b){_0x562911['push'](_0x562911['shift']());}};_0x2003e2(++_0x5be4ae);}(_0x5853,0x8c));var _0x3585=function(_0x1b16ba,_0xe1a8dc){_0x1b16ba=_0x1b16ba-0x0;var _0x30d703=_0x5853[_0x1b16ba];return _0x30d703;};'use strict';var express=require(_0x3585('0x0'));var router=express[_0x3585('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x3585('0x2'));router[_0x3585('0x3')]('/',auth['isAuthenticated'](),controller[_0x3585('0x4')]);router[_0x3585('0x3')](_0x3585('0x5'),auth[_0x3585('0x6')](),controller['describe']);router[_0x3585('0x3')](_0x3585('0x7'),auth[_0x3585('0x6')](),controller[_0x3585('0x8')]);router[_0x3585('0x3')](_0x3585('0x9'),auth['isAuthenticated'](),controller['getTimezones']);router[_0x3585('0x3')]('/:id',auth[_0x3585('0x6')](),controller['show']);router[_0x3585('0x3')](_0x3585('0xa'),auth['isAuthenticated'](),controller[_0x3585('0xb')]);router['post']('/',auth[_0x3585('0x6')](),controller[_0x3585('0xc')]);router[_0x3585('0xd')](_0x3585('0xe'),auth[_0x3585('0x6')](),controller[_0x3585('0xf')]);router['post'](_0x3585('0x10'),auth['isAuthenticated'](),controller['getTimezone']);router[_0x3585('0x11')](_0x3585('0x12'),auth[_0x3585('0x6')](),controller[_0x3585('0x13')]);router[_0x3585('0x14')](_0x3585('0x12'),auth[_0x3585('0x6')](),controller['destroy']);module[_0x3585('0x15')]=router; \ No newline at end of file +var _0xd383=['show','/:id/previewrecall','post','/preview','getPreview','/timezone','getTimezone','put','delete','destroy','exports','express','Router','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','/timezones','getTimezones','/:id'];(function(_0x75c05e,_0x1ac081){var _0x29db11=function(_0x14a5ab){while(--_0x14a5ab){_0x75c05e['push'](_0x75c05e['shift']());}};_0x29db11(++_0x1ac081);}(_0xd383,0x17b));var _0x3d38=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0xd383[_0x45bf86];return _0x1f02b7;};'use strict';var express=require(_0x3d38('0x0'));var router=express[_0x3d38('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x3d38('0x2'));router[_0x3d38('0x3')]('/',auth[_0x3d38('0x4')](),controller[_0x3d38('0x5')]);router[_0x3d38('0x3')](_0x3d38('0x6'),auth[_0x3d38('0x4')](),controller[_0x3d38('0x7')]);router['get'](_0x3d38('0x8'),auth['isAuthenticated'](),controller['getOpenContacts']);router[_0x3d38('0x3')](_0x3d38('0x9'),auth[_0x3d38('0x4')](),controller[_0x3d38('0xa')]);router[_0x3d38('0x3')](_0x3d38('0xb'),auth[_0x3d38('0x4')](),controller[_0x3d38('0xc')]);router[_0x3d38('0x3')](_0x3d38('0xd'),auth['isAuthenticated'](),controller['getPreviewRecall']);router[_0x3d38('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3d38('0xe')](_0x3d38('0xf'),auth['isAuthenticated'](),controller[_0x3d38('0x10')]);router[_0x3d38('0xe')](_0x3d38('0x11'),auth[_0x3d38('0x4')](),controller[_0x3d38('0x12')]);router[_0x3d38('0x13')](_0x3d38('0xb'),auth[_0x3d38('0x4')](),controller['update']);router[_0x3d38('0x14')](_0x3d38('0xb'),auth[_0x3d38('0x4')](),controller[_0x3d38('0x15')]);module[_0x3d38('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 0ccb7f7..527107c 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 _0x299f=['sequelize','INTEGER','DATE','format','moment'];(function(_0x50032c,_0x2102eb){var _0x30fa3a=function(_0xbcff18){while(--_0xbcff18){_0x50032c['push'](_0x50032c['shift']());}};_0x30fa3a(++_0x2102eb);}(_0x299f,0x171));var _0xf299=function(_0x3ab408,_0x414649){_0x3ab408=_0x3ab408-0x0;var _0x29b2d7=_0x299f[_0x3ab408];return _0x29b2d7;};'use strict';var moment=require(_0xf299('0x0'));var Sequelize=require(_0xf299('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0xf299('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xf299('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xf299('0x3')],'defaultValue':moment()[_0xf299('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf299('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xf299('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf299('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf299('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf2f3=['YYYY-MM-DD\x20HH:mm:ss','moment','exports','INTEGER','format'];(function(_0x218994,_0x2cf487){var _0x3f350b=function(_0x2e2065){while(--_0x2e2065){_0x218994['push'](_0x218994['shift']());}};_0x3f350b(++_0x2cf487);}(_0xf2f3,0x132));var _0x3f2f=function(_0x266a62,_0x362cef){_0x266a62=_0x266a62-0x0;var _0xb8858a=_0xf2f3[_0x266a62];return _0xb8858a;};'use strict';var moment=require(_0x3f2f('0x0'));var Sequelize=require('sequelize');module[_0x3f2f('0x1')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x3f2f('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x3f2f('0x3')](_0x3f2f('0x4'))},'countbusyretry':{'type':Sequelize[_0x3f2f('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3f2f('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3f2f('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3f2f('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3f2f('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index b4c8fa4..4ca2f60 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 _0x7755=['../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','save','then','destroy','UserProfileResource','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','keys','include','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','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'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7755,0x8e));var _0x5775=function(_0x2e008b,_0x5844b1){_0x2e008b=_0x2e008b-0x0;var _0x2f32e5=_0x7755[_0x2e008b];return _0x2f32e5;};'use strict';var emlformat=require(_0x5775('0x0'));var rimraf=require(_0x5775('0x1'));var zipdir=require(_0x5775('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5775('0x3'));var BPromise=require(_0x5775('0x4'));var Mustache=require(_0x5775('0x5'));var util=require(_0x5775('0x6'));var path=require(_0x5775('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5775('0x8'));var _=require(_0x5775('0x9'));var squel=require(_0x5775('0xa'));var crypto=require(_0x5775('0xb'));var jsforce=require(_0x5775('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5775('0xd'));var querystring=require(_0x5775('0xe'));var Papa=require('papaparse');var Redis=require(_0x5775('0xf'));var authService=require(_0x5775('0x10'));var qs=require(_0x5775('0x11'));var as=require(_0x5775('0x12'));var hardwareService=require(_0x5775('0x13'));var logger=require(_0x5775('0x14'))('api');var utils=require(_0x5775('0x15'));var config=require(_0x5775('0x16'));var licenseUtil=require(_0x5775('0x17'));var db=require(_0x5775('0x18'))['db'];function respondWithStatusCode(_0x1160f4,_0x37cd87){_0x37cd87=_0x37cd87||0xcc;return function(_0x3c5812){if(_0x3c5812){return _0x1160f4[_0x5775('0x19')](_0x37cd87);}return _0x1160f4[_0x5775('0x1a')](_0x37cd87)[_0x5775('0x1b')]();};}function respondWithResult(_0x5c9fa0,_0x5a85a0){_0x5a85a0=_0x5a85a0||0xc8;return function(_0xf67f8e){if(_0xf67f8e){return _0x5c9fa0[_0x5775('0x1a')](_0x5a85a0)[_0x5775('0x1c')](_0xf67f8e);}};}function respondWithFilteredResult(_0x402aa6,_0x1323e7){return function(_0x13f622){if(_0x13f622){var _0x3fac68=typeof _0x1323e7[_0x5775('0x1d')]===_0x5775('0x1e')&&typeof _0x1323e7['limit']===_0x5775('0x1e');var _0x388bc9=_0x13f622['count'];var _0x154e12=_0x3fac68?0x0:_0x1323e7[_0x5775('0x1d')];var _0x42e448=_0x3fac68?_0x13f622[_0x5775('0x1f')]:_0x1323e7[_0x5775('0x1d')]+_0x1323e7['limit'];var _0x3639c0;if(_0x42e448>=_0x388bc9){_0x42e448=_0x388bc9;_0x3639c0=0xc8;}else{_0x3639c0=0xce;}_0x402aa6[_0x5775('0x1a')](_0x3639c0);return _0x402aa6['set'](_0x5775('0x20'),_0x154e12+'-'+_0x42e448+'/'+_0x388bc9)[_0x5775('0x1c')](_0x13f622);}return null;};}function patchUpdates(_0x3b4da9){return function(_0x5b5da9){try{jsonpatch[_0x5775('0x21')](_0x5b5da9,_0x3b4da9,!![]);}catch(_0x1d73ed){return BPromise['reject'](_0x1d73ed);}return _0x5b5da9[_0x5775('0x22')]();};}function saveUpdates(_0x443477,_0x3ba79a){return function(_0x5468e7){if(_0x5468e7){return _0x5468e7['update'](_0x443477)[_0x5775('0x23')](function(_0x49729d){return _0x49729d;});}return null;};}function removeEntity(_0x31807a,_0x475c50){return function(_0x154723){if(_0x154723){return _0x154723[_0x5775('0x24')]()[_0x5775('0x23')](function(){var _0x1e6557=_0x154723['get']({'plain':!![]});var _0x57740e='CmHopperAdditionalPhones';return db[_0x5775('0x25')][_0x5775('0x24')]({'where':{'type':_0x57740e,'resourceId':_0x1e6557['id']}})[_0x5775('0x23')](function(){return _0x154723;});})[_0x5775('0x23')](function(){_0x31807a[_0x5775('0x1a')](0xcc)[_0x5775('0x1b')]();});}};}function handleEntityNotFound(_0x5222aa,_0x3d91dc){return function(_0x463b57){if(!_0x463b57){_0x5222aa[_0x5775('0x19')](0x194);}return _0x463b57;};}function handleError(_0x5556cd,_0x4abc12){_0x4abc12=_0x4abc12||0x1f4;return function(_0x197774){logger[_0x5775('0x26')](_0x197774[_0x5775('0x27')]);if(_0x197774['name']){delete _0x197774[_0x5775('0x28')];}_0x5556cd[_0x5775('0x1a')](_0x4abc12)[_0x5775('0x29')](_0x197774);};}exports[_0x5775('0x2a')]=function(_0x21d376,_0x338a4c){var _0x4a6a0e={},_0xdedf06={},_0x2d2e67={'count':0x0,'rows':[]};var _0x460abd=_[_0x5775('0x2b')](db[_0x5775('0x2c')][_0x5775('0x2d')],function(_0x159d6d){return{'name':_0x159d6d[_0x5775('0x2e')],'type':_0x159d6d[_0x5775('0x2f')]['key']};});_0xdedf06[_0x5775('0x30')]=_['map'](_0x460abd,'name');_0xdedf06[_0x5775('0x31')]=_['keys'](_0x21d376[_0x5775('0x31')]);_0xdedf06[_0x5775('0x32')]=_[_0x5775('0x33')](_0xdedf06['model'],_0xdedf06[_0x5775('0x31')]);_0x4a6a0e[_0x5775('0x34')]=_['intersection'](_0xdedf06[_0x5775('0x30')],qs[_0x5775('0x35')](_0x21d376['query']['fields']));_0x4a6a0e[_0x5775('0x34')]=_0x4a6a0e[_0x5775('0x34')][_0x5775('0x36')]?_0x4a6a0e[_0x5775('0x34')]:_0xdedf06['model'];if(!_0x21d376[_0x5775('0x31')][_0x5775('0x37')](_0x5775('0x38'))){_0x4a6a0e['limit']=qs[_0x5775('0x39')](_0x21d376[_0x5775('0x31')][_0x5775('0x39')]);_0x4a6a0e[_0x5775('0x1d')]=qs['offset'](_0x21d376['query']['offset']);}_0x4a6a0e['order']=qs[_0x5775('0x3a')](_0x21d376[_0x5775('0x31')][_0x5775('0x3a')]);_0x4a6a0e[_0x5775('0x3b')]=qs['filters'](_[_0x5775('0x3c')](_0x21d376[_0x5775('0x31')],_0xdedf06[_0x5775('0x32')]),_0x460abd);if(_0x21d376['query'][_0x5775('0x3d')]){_0x4a6a0e['where']=_[_0x5775('0x3e')](_0x4a6a0e[_0x5775('0x3b')],{'$or':_[_0x5775('0x2b')](_0x460abd,function(_0x2e01cc){if(_0x2e01cc[_0x5775('0x2f')]!==_0x5775('0x3f')){var _0xff3950={};_0xff3950[_0x2e01cc[_0x5775('0x28')]]={'$like':'%'+_0x21d376['query'][_0x5775('0x3d')]+'%'};return _0xff3950;}})});}_0x4a6a0e=_[_0x5775('0x3e')]({},_0x4a6a0e,_0x21d376[_0x5775('0x40')]);var _0x1e36bd={'where':_0x4a6a0e['where']};return db[_0x5775('0x2c')][_0x5775('0x1f')](_0x1e36bd)[_0x5775('0x23')](function(_0x447fcb){_0x2d2e67[_0x5775('0x1f')]=_0x447fcb;if(_0x21d376[_0x5775('0x31')][_0x5775('0x41')]){_0x4a6a0e['include']=[{'all':!![]}];}return db[_0x5775('0x2c')][_0x5775('0x42')](_0x4a6a0e);})[_0x5775('0x23')](function(_0x29ae7c){_0x2d2e67['rows']=_0x29ae7c;return _0x2d2e67;})[_0x5775('0x23')](respondWithFilteredResult(_0x338a4c,_0x4a6a0e))['catch'](handleError(_0x338a4c,null));};exports[_0x5775('0x43')]=function(_0x413993,_0x2f2467){var _0x471cdb={'raw':!![],'where':{'id':_0x413993[_0x5775('0x44')]['id']}},_0x34a514={};_0x34a514[_0x5775('0x30')]=_[_0x5775('0x45')](db[_0x5775('0x2c')]['rawAttributes']);_0x34a514['query']=_[_0x5775('0x45')](_0x413993[_0x5775('0x31')]);_0x34a514[_0x5775('0x32')]=_[_0x5775('0x33')](_0x34a514[_0x5775('0x30')],_0x34a514['query']);_0x471cdb[_0x5775('0x34')]=_[_0x5775('0x33')](_0x34a514[_0x5775('0x30')],qs['fields'](_0x413993[_0x5775('0x31')][_0x5775('0x35')]));_0x471cdb[_0x5775('0x34')]=_0x471cdb[_0x5775('0x34')][_0x5775('0x36')]?_0x471cdb['attributes']:_0x34a514[_0x5775('0x30')];if(_0x413993[_0x5775('0x31')]['includeAll']){_0x471cdb[_0x5775('0x46')]=[{'all':!![]}];}_0x471cdb=_[_0x5775('0x3e')]({},_0x471cdb,_0x413993[_0x5775('0x40')]);return db[_0x5775('0x2c')][_0x5775('0x47')](_0x471cdb)['then'](handleEntityNotFound(_0x2f2467,null))['then'](respondWithResult(_0x2f2467,null))[_0x5775('0x48')](handleError(_0x2f2467,null));};exports[_0x5775('0x49')]=function(_0x25f15a,_0x480c1c){return db[_0x5775('0x2c')][_0x5775('0x49')](_0x25f15a['body'],{})[_0x5775('0x23')](function(_0x403e12){var _0x3a8e68=_0x25f15a[_0x5775('0x4a')][_0x5775('0x4b')]({'plain':!![]});if(!_0x3a8e68)throw new Error(_0x5775('0x4c'));if(_0x3a8e68[_0x5775('0x4d')]===_0x5775('0x4a')){var _0x2bab43=_0x403e12[_0x5775('0x4b')]({'plain':!![]});var _0x773608='CmHopperAdditionalPhones';return db[_0x5775('0x4e')]['find']({'where':{'name':_0x773608,'userProfileId':_0x3a8e68[_0x5775('0x4f')]},'raw':!![]})['then'](function(_0x116153){if(_0x116153&&_0x116153[_0x5775('0x50')]===0x0){return db[_0x5775('0x25')][_0x5775('0x49')]({'name':_0x2bab43[_0x5775('0x28')],'resourceId':_0x2bab43['id'],'type':_0x116153[_0x5775('0x28')],'sectionId':_0x116153['id']},{})[_0x5775('0x23')](function(){return _0x403e12;});}else{return _0x403e12;}})['catch'](function(_0x16e277){logger[_0x5775('0x26')](_0x5775('0x51'),_0x16e277);throw _0x16e277;});}return _0x403e12;})[_0x5775('0x23')](respondWithResult(_0x480c1c,0xc9))['catch'](handleError(_0x480c1c,null));};exports[_0x5775('0x52')]=function(_0x37bab2,_0x1eeda1){if(_0x37bab2['body']['id']){delete _0x37bab2['body']['id'];}return db[_0x5775('0x2c')]['find']({'where':{'id':_0x37bab2['params']['id']}})[_0x5775('0x23')](handleEntityNotFound(_0x1eeda1,null))[_0x5775('0x23')](saveUpdates(_0x37bab2['body'],null))['then'](respondWithResult(_0x1eeda1,null))['catch'](handleError(_0x1eeda1,null));};exports[_0x5775('0x24')]=function(_0x54abf7,_0x1187c9){return db[_0x5775('0x2c')]['find']({'where':{'id':_0x54abf7['params']['id']}})[_0x5775('0x23')](handleEntityNotFound(_0x1187c9,null))[_0x5775('0x23')](removeEntity(_0x1187c9,null))[_0x5775('0x48')](handleError(_0x1187c9,null));}; \ No newline at end of file +var _0x3373=['destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','Content-Range','json','apply','update','then','CmHopperAdditionalPhones','error','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','nolimit','order','sort','where','pick','merge','filter','options','CmHopperAdditionalPhone','includeAll','include','findAll','rows','catch','show','params','length','create','user','get','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x3373,0x97));var _0x3337=function(_0x15581a,_0x2c444e){_0x15581a=_0x15581a-0x0;var _0x24000a=_0x3373[_0x15581a];return _0x24000a;};'use strict';var emlformat=require(_0x3337('0x0'));var rimraf=require(_0x3337('0x1'));var zipdir=require(_0x3337('0x2'));var jsonpatch=require(_0x3337('0x3'));var rp=require(_0x3337('0x4'));var moment=require(_0x3337('0x5'));var BPromise=require(_0x3337('0x6'));var Mustache=require('mustache');var util=require(_0x3337('0x7'));var path=require(_0x3337('0x8'));var sox=require(_0x3337('0x9'));var csv=require(_0x3337('0xa'));var ejs=require(_0x3337('0xb'));var fs=require('fs');var fs_extra=require(_0x3337('0xc'));var _=require(_0x3337('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3337('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3337('0xa'));var querystring=require('querystring');var Papa=require(_0x3337('0xf'));var Redis=require('ioredis');var authService=require(_0x3337('0x10'));var qs=require(_0x3337('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3337('0x12'));var utils=require('../../config/utils');var config=require(_0x3337('0x13'));var licenseUtil=require(_0x3337('0x14'));var db=require(_0x3337('0x15'))['db'];function respondWithStatusCode(_0x40601e,_0x3db462){_0x3db462=_0x3db462||0xcc;return function(_0x59f21f){if(_0x59f21f){return _0x40601e[_0x3337('0x16')](_0x3db462);}return _0x40601e['status'](_0x3db462)[_0x3337('0x17')]();};}function respondWithResult(_0x4b6ce0,_0x348c12){_0x348c12=_0x348c12||0xc8;return function(_0x574a43){if(_0x574a43){return _0x4b6ce0[_0x3337('0x18')](_0x348c12)['json'](_0x574a43);}};}function respondWithFilteredResult(_0x505f80,_0x18bf8d){return function(_0xe7c893){if(_0xe7c893){var _0x19efbb=typeof _0x18bf8d[_0x3337('0x19')]==='undefined'&&typeof _0x18bf8d[_0x3337('0x1a')]===_0x3337('0x1b');var _0x4a578f=_0xe7c893[_0x3337('0x1c')];var _0x68d1bb=_0x19efbb?0x0:_0x18bf8d[_0x3337('0x19')];var _0x48d9d2=_0x19efbb?_0xe7c893[_0x3337('0x1c')]:_0x18bf8d[_0x3337('0x19')]+_0x18bf8d[_0x3337('0x1a')];var _0x5b72b2;if(_0x48d9d2>=_0x4a578f){_0x48d9d2=_0x4a578f;_0x5b72b2=0xc8;}else{_0x5b72b2=0xce;}_0x505f80['status'](_0x5b72b2);return _0x505f80['set'](_0x3337('0x1d'),_0x68d1bb+'-'+_0x48d9d2+'/'+_0x4a578f)[_0x3337('0x1e')](_0xe7c893);}return null;};}function patchUpdates(_0x5f3f84){return function(_0x237535){try{jsonpatch[_0x3337('0x1f')](_0x237535,_0x5f3f84,!![]);}catch(_0x2f207f){return BPromise['reject'](_0x2f207f);}return _0x237535['save']();};}function saveUpdates(_0x511fbc,_0x2e2dd6){return function(_0xa63170){if(_0xa63170){return _0xa63170[_0x3337('0x20')](_0x511fbc)[_0x3337('0x21')](function(_0x2994d2){return _0x2994d2;});}return null;};}function removeEntity(_0x3e6838,_0x5c85a3){return function(_0x579be7){if(_0x579be7){return _0x579be7['destroy']()[_0x3337('0x21')](function(){var _0xf1d696=_0x579be7['get']({'plain':!![]});var _0x2367a7=_0x3337('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x2367a7,'resourceId':_0xf1d696['id']}})[_0x3337('0x21')](function(){return _0x579be7;});})['then'](function(){_0x3e6838[_0x3337('0x18')](0xcc)[_0x3337('0x17')]();});}};}function handleEntityNotFound(_0x463b5b,_0xf6cad){return function(_0x2c711b){if(!_0x2c711b){_0x463b5b[_0x3337('0x16')](0x194);}return _0x2c711b;};}function handleError(_0x32cc9e,_0x17477b){_0x17477b=_0x17477b||0x1f4;return function(_0x3fe899){logger[_0x3337('0x23')](_0x3fe899['stack']);if(_0x3fe899[_0x3337('0x24')]){delete _0x3fe899['name'];}_0x32cc9e[_0x3337('0x18')](_0x17477b)[_0x3337('0x25')](_0x3fe899);};}exports['index']=function(_0x4fb699,_0x454bc3){var _0x48f347={},_0x411514={},_0x1685d3={'count':0x0,'rows':[]};var _0x171183=_[_0x3337('0x26')](db['CmHopperAdditionalPhone'][_0x3337('0x27')],function(_0x4038ee){return{'name':_0x4038ee[_0x3337('0x28')],'type':_0x4038ee[_0x3337('0x29')][_0x3337('0x2a')]};});_0x411514['model']=_[_0x3337('0x26')](_0x171183,_0x3337('0x24'));_0x411514[_0x3337('0x2b')]=_[_0x3337('0x2c')](_0x4fb699['query']);_0x411514[_0x3337('0x2d')]=_[_0x3337('0x2e')](_0x411514['model'],_0x411514[_0x3337('0x2b')]);_0x48f347[_0x3337('0x2f')]=_[_0x3337('0x2e')](_0x411514[_0x3337('0x30')],qs[_0x3337('0x31')](_0x4fb699[_0x3337('0x2b')][_0x3337('0x31')]));_0x48f347[_0x3337('0x2f')]=_0x48f347[_0x3337('0x2f')]['length']?_0x48f347[_0x3337('0x2f')]:_0x411514[_0x3337('0x30')];if(!_0x4fb699[_0x3337('0x2b')]['hasOwnProperty'](_0x3337('0x32'))){_0x48f347['limit']=qs[_0x3337('0x1a')](_0x4fb699['query'][_0x3337('0x1a')]);_0x48f347['offset']=qs[_0x3337('0x19')](_0x4fb699[_0x3337('0x2b')]['offset']);}_0x48f347[_0x3337('0x33')]=qs[_0x3337('0x34')](_0x4fb699[_0x3337('0x2b')][_0x3337('0x34')]);_0x48f347[_0x3337('0x35')]=qs[_0x3337('0x2d')](_[_0x3337('0x36')](_0x4fb699[_0x3337('0x2b')],_0x411514[_0x3337('0x2d')]),_0x171183);if(_0x4fb699['query']['filter']){_0x48f347[_0x3337('0x35')]=_[_0x3337('0x37')](_0x48f347[_0x3337('0x35')],{'$or':_[_0x3337('0x26')](_0x171183,function(_0x3bdd38){if(_0x3bdd38[_0x3337('0x29')]!=='VIRTUAL'){var _0x175a75={};_0x175a75[_0x3bdd38['name']]={'$like':'%'+_0x4fb699[_0x3337('0x2b')][_0x3337('0x38')]+'%'};return _0x175a75;}})});}_0x48f347=_['merge']({},_0x48f347,_0x4fb699[_0x3337('0x39')]);var _0x17ac9c={'where':_0x48f347[_0x3337('0x35')]};return db[_0x3337('0x3a')][_0x3337('0x1c')](_0x17ac9c)['then'](function(_0x2030e9){_0x1685d3['count']=_0x2030e9;if(_0x4fb699['query'][_0x3337('0x3b')]){_0x48f347[_0x3337('0x3c')]=[{'all':!![]}];}return db[_0x3337('0x3a')][_0x3337('0x3d')](_0x48f347);})[_0x3337('0x21')](function(_0x58dbfb){_0x1685d3[_0x3337('0x3e')]=_0x58dbfb;return _0x1685d3;})[_0x3337('0x21')](respondWithFilteredResult(_0x454bc3,_0x48f347))[_0x3337('0x3f')](handleError(_0x454bc3,null));};exports[_0x3337('0x40')]=function(_0x46031,_0x226b1c){var _0x102ca2={'raw':!![],'where':{'id':_0x46031[_0x3337('0x41')]['id']}},_0x53e529={};_0x53e529[_0x3337('0x30')]=_[_0x3337('0x2c')](db[_0x3337('0x3a')][_0x3337('0x27')]);_0x53e529[_0x3337('0x2b')]=_['keys'](_0x46031[_0x3337('0x2b')]);_0x53e529[_0x3337('0x2d')]=_[_0x3337('0x2e')](_0x53e529[_0x3337('0x30')],_0x53e529[_0x3337('0x2b')]);_0x102ca2[_0x3337('0x2f')]=_[_0x3337('0x2e')](_0x53e529['model'],qs[_0x3337('0x31')](_0x46031[_0x3337('0x2b')][_0x3337('0x31')]));_0x102ca2['attributes']=_0x102ca2[_0x3337('0x2f')][_0x3337('0x42')]?_0x102ca2[_0x3337('0x2f')]:_0x53e529[_0x3337('0x30')];if(_0x46031[_0x3337('0x2b')]['includeAll']){_0x102ca2['include']=[{'all':!![]}];}_0x102ca2=_[_0x3337('0x37')]({},_0x102ca2,_0x46031[_0x3337('0x39')]);return db[_0x3337('0x3a')]['find'](_0x102ca2)[_0x3337('0x21')](handleEntityNotFound(_0x226b1c,null))['then'](respondWithResult(_0x226b1c,null))[_0x3337('0x3f')](handleError(_0x226b1c,null));};exports['create']=function(_0x4d19a2,_0x4cf7b8){return db['CmHopperAdditionalPhone'][_0x3337('0x43')](_0x4d19a2['body'],{})[_0x3337('0x21')](function(_0x275d9f){var _0x481f8e=_0x4d19a2[_0x3337('0x44')][_0x3337('0x45')]({'plain':!![]});if(!_0x481f8e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x481f8e['role']==='user'){var _0x583915=_0x275d9f[_0x3337('0x45')]({'plain':!![]});var _0x45ce4e=_0x3337('0x22');return db['UserProfileSection'][_0x3337('0x46')]({'where':{'name':_0x45ce4e,'userProfileId':_0x481f8e['userProfileId']},'raw':!![]})[_0x3337('0x21')](function(_0x2f7913){if(_0x2f7913&&_0x2f7913[_0x3337('0x47')]===0x0){return db['UserProfileResource'][_0x3337('0x43')]({'name':_0x583915[_0x3337('0x24')],'resourceId':_0x583915['id'],'type':_0x2f7913[_0x3337('0x24')],'sectionId':_0x2f7913['id']},{})[_0x3337('0x21')](function(){return _0x275d9f;});}else{return _0x275d9f;}})[_0x3337('0x3f')](function(_0x4a118f){logger['error'](_0x3337('0x48'),_0x4a118f);throw _0x4a118f;});}return _0x275d9f;})[_0x3337('0x21')](respondWithResult(_0x4cf7b8,0xc9))[_0x3337('0x3f')](handleError(_0x4cf7b8,null));};exports[_0x3337('0x20')]=function(_0x766ff1,_0x4dd515){if(_0x766ff1[_0x3337('0x49')]['id']){delete _0x766ff1[_0x3337('0x49')]['id'];}return db[_0x3337('0x3a')][_0x3337('0x46')]({'where':{'id':_0x766ff1[_0x3337('0x41')]['id']}})[_0x3337('0x21')](handleEntityNotFound(_0x4dd515,null))['then'](saveUpdates(_0x766ff1[_0x3337('0x49')],null))['then'](respondWithResult(_0x4dd515,null))['catch'](handleError(_0x4dd515,null));};exports[_0x3337('0x4a')]=function(_0x359b38,_0x2f673d){return db[_0x3337('0x3a')][_0x3337('0x46')]({'where':{'id':_0x359b38[_0x3337('0x41')]['id']}})[_0x3337('0x21')](handleEntityNotFound(_0x2f673d,null))[_0x3337('0x21')](removeEntity(_0x2f673d,null))[_0x3337('0x3f')](handleError(_0x2f673d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 9398ddb..2574ccb 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 _0x239e=['./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2f8679,_0x5e09f5){var _0x7c9bb2=function(_0x1769ab){while(--_0x1769ab){_0x2f8679['push'](_0x2f8679['shift']());}};_0x7c9bb2(++_0x5e09f5);}(_0x239e,0x179));var _0xe239=function(_0x5f584a,_0x47f064){_0x5f584a=_0x5f584a-0x0;var _0x3788d9=_0x239e[_0x5f584a];return _0x3788d9;};'use strict';var _=require('lodash');var util=require(_0xe239('0x0'));var logger=require('../../config/logger')(_0xe239('0x1'));var moment=require(_0xe239('0x2'));var BPromise=require(_0xe239('0x3'));var rp=require(_0xe239('0x4'));var fs=require('fs');var path=require(_0xe239('0x5'));var rimraf=require(_0xe239('0x6'));var config=require('../../config/environment');var attributes=require(_0xe239('0x7'));module[_0xe239('0x8')]=function(_0x5e89dc,_0x41bb4d){return _0x5e89dc[_0xe239('0x9')](_0xe239('0xa'),attributes,{'tableName':_0xe239('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35e2=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash'];(function(_0x310448,_0x59f6bd){var _0xc0124b=function(_0x311d94){while(--_0x311d94){_0x310448['push'](_0x310448['shift']());}};_0xc0124b(++_0x59f6bd);}(_0x35e2,0x1ed));var _0x235e=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x35e2[_0x2b7764];return _0x848dcb;};'use strict';var _=require(_0x235e('0x0'));var util=require('util');var logger=require(_0x235e('0x1'))(_0x235e('0x2'));var moment=require(_0x235e('0x3'));var BPromise=require('bluebird');var rp=require(_0x235e('0x4'));var fs=require('fs');var path=require(_0x235e('0x5'));var rimraf=require(_0x235e('0x6'));var config=require(_0x235e('0x7'));var attributes=require(_0x235e('0x8'));module[_0x235e('0x9')]=function(_0x27f455,_0x460a01){return _0x27f455[_0x235e('0xa')](_0x235e('0xb'),attributes,{'tableName':_0x235e('0xc'),'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 3064fd8..f003e23 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 _0x710c=['info','result','VerifyAdditionalPhones','CmHopper','body','ContactId','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','findOne','OrderBy','ASC','countbusyretry','countcongestionretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','entity','dialGlobalMaxRetry','countnoanswerretry','catch','waitTime','duration','scheduledat','minutes','add','isNil','phone','countdropretry','updatedAt','countmachineretry','createdAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','../../mysqldb','rpc','jayson/promise','client','http','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x44edb0,_0x7a1d21){var _0x38dbd0=function(_0xcc1e93){while(--_0xcc1e93){_0x44edb0['push'](_0x44edb0['shift']());}};_0x38dbd0(++_0x7a1d21);}(_0x710c,0x1a9));var _0xc710=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x710c[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0xc710('0x0'));var util=require(_0xc710('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc710('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc710('0x3'));var config=require('../../config/environment');var jayson=require(_0xc710('0x4'));var client=jayson[_0xc710('0x5')][_0xc710('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x523c54,_0x320d3e,_0x249084){return new BPromise(function(_0x133a37,_0x592266){return client['request'](_0x523c54,_0x249084)['then'](function(_0x3539aa){logger['info'](_0xc710('0x7'),_0x320d3e,_0xc710('0x8'));logger[_0xc710('0x9')](_0xc710('0xa'),_0x320d3e,'request\x20sent',JSON[_0xc710('0xb')](_0x3539aa));if(_0x3539aa[_0xc710('0xc')]){if(_0x3539aa[_0xc710('0xc')][_0xc710('0xd')]===0x1f4){logger[_0xc710('0xc')](_0xc710('0x7'),_0x320d3e,_0x3539aa['error'][_0xc710('0xe')]);return _0x592266(_0x3539aa[_0xc710('0xc')]['message']);}logger[_0xc710('0xc')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x320d3e,_0x3539aa[_0xc710('0xc')][_0xc710('0xe')]);return _0x133a37(_0x3539aa[_0xc710('0xc')][_0xc710('0xe')]);}else{logger[_0xc710('0xf')](_0xc710('0x7'),_0x320d3e,_0xc710('0x8'));_0x133a37(_0x3539aa[_0xc710('0x10')]['message']);}})['catch'](function(_0x4f8fbf){logger['error'](_0xc710('0x7'),_0x320d3e,_0x4f8fbf);_0x592266(_0x4f8fbf);});});}exports[_0xc710('0x11')]=function(_0x7ed675){var _0x361be1=this;return new Promise(function(_0x3f9afa,_0x2e8a79){return db[_0xc710('0x12')]['findOne']({'raw':!![],'where':{'ContactId':_0x7ed675[_0xc710('0x13')][_0xc710('0x14')],'ListId':_0x7ed675[_0xc710('0x13')][_0xc710('0x15')],'VoiceQueueId':_0x7ed675[_0xc710('0x13')]['VoiceQueueId']===undefined?null:_0x7ed675['body'][_0xc710('0x16')],'CampaignId':_0x7ed675[_0xc710('0x13')][_0xc710('0x17')]===undefined?null:_0x7ed675[_0xc710('0x13')][_0xc710('0x17')]}})[_0xc710('0x18')](function(_0x38725a){if(_0x38725a!=null){return db[_0xc710('0x19')][_0xc710('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x38725a['id'],'OrderBy':{'$gt':_0x38725a['OrderBy']}},'order':[[_0xc710('0x1b'),_0xc710('0x1c')]]})[_0xc710('0x18')](function(_0x754864){var _0x5ee601=0x0;if(_0x754864){if(_0x754864[_0xc710('0x1d')]+_0x754864[_0xc710('0x1e')]+_0x754864['countnoanswerretry']+_0x754864[_0xc710('0x1f')]+_0x754864['countdropretry']+_0x754864[_0xc710('0x20')]+_0x754864['countmachineretry']+_0x754864[_0xc710('0x21')]<_0x7ed675[_0xc710('0x22')][_0xc710('0x23')])_0x5ee601=0x1;_0x3f9afa({'additional':_0x5ee601});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x38725a['id']},'order':[[_0xc710('0x1b'),_0xc710('0x1c')]]})[_0xc710('0x18')](function(_0x5760d1){var _0xcc80e1=0x0;if(_0x5760d1){if(_0x5760d1['countbusyretry']+_0x5760d1['countcongestionretry']+_0x5760d1[_0xc710('0x24')]+_0x5760d1['countnosuchnumberretry']+_0x5760d1['countdropretry']+_0x5760d1[_0xc710('0x20')]+_0x5760d1['countmachineretry']+_0x5760d1['countagentrejectretry']<_0x7ed675[_0xc710('0x22')]['dialGlobalMaxRetry'])_0xcc80e1=0x1;_0x3f9afa({'additional':_0xcc80e1});}else{_0x3f9afa({'additional':0x0});}})['catch'](function(_0x4fdaa2){logger['error'](_0xc710('0x11'),_0x4fdaa2['message']);_0x2e8a79(_0x361be1['error'](0x1f4,_0x4fdaa2['message']));});}})[_0xc710('0x25')](function(_0x5d801b){logger['error']('VerifyAdditionalPhones',_0x5d801b[_0xc710('0xe')]);_0x2e8a79(_0x361be1[_0xc710('0xc')](0x1f4,_0x5d801b[_0xc710('0xe')]));});}else _0x3f9afa({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x179dc1){var _0x465e8a=this;return new Promise(function(_0x15bf99,_0x51c327){return db[_0xc710('0x12')]['findOne']({'raw':!![],'where':{'ContactId':_0x179dc1['body'][_0xc710('0x14')],'ListId':_0x179dc1[_0xc710('0x13')][_0xc710('0x15')],'VoiceQueueId':_0x179dc1['body']['VoiceQueueId']===undefined?null:_0x179dc1[_0xc710('0x13')][_0xc710('0x16')],'CampaignId':_0x179dc1[_0xc710('0x13')]['CampaignId']===undefined?null:_0x179dc1['body'][_0xc710('0x17')]}})[_0xc710('0x18')](function(_0x2860d2){if(_0x2860d2!=null){return db[_0xc710('0x19')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x2860d2['id'],'OrderBy':{'$gte':_0x2860d2[_0xc710('0x1b')]}},'order':[[_0xc710('0x1b'),_0xc710('0x1c')]]})[_0xc710('0x18')](function(_0xd69d13){if(_0xd69d13)return activateAdditionalPhone(_0x2860d2,_0x179dc1[_0xc710('0x13')],_0xd69d13,_0x179dc1['duration'],_0x179dc1[_0xc710('0x26')])[_0xc710('0x18')](function(_0x2ca12a){_0x15bf99(_0x2ca12a);});else{return db['CmHopperAdditionalPhone'][_0xc710('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x2860d2['id']},'order':[[_0xc710('0x1b'),_0xc710('0x1c')]]})[_0xc710('0x18')](function(_0x2fbb8d){if(_0x2fbb8d)return activateAdditionalPhone(_0x2860d2,_0x179dc1[_0xc710('0x13')],_0x2fbb8d,_0x179dc1[_0xc710('0x27')],_0x179dc1['waitTime'])[_0xc710('0x18')](function(_0x49f7e2){_0x15bf99(_0x49f7e2);});else{_0x15bf99({'id':_0x2860d2['id'],'phone':''});}})[_0xc710('0x25')](function(_0x221e38){logger[_0xc710('0xc')](_0xc710('0x11'),_0x221e38[_0xc710('0xe')]);_0x51c327(_0x465e8a[_0xc710('0xc')](0x1f4,_0x221e38['message']));});}})[_0xc710('0x25')](function(_0x368806){logger[_0xc710('0xc')](_0xc710('0x11'),_0x368806[_0xc710('0xe')]);_0x51c327(_0x465e8a[_0xc710('0xc')](0x1f4,_0x368806[_0xc710('0xe')]));});}else _0x15bf99(0x1);});});};function activateAdditionalPhone(_0x5b6327,_0x46730f,_0x19b0af,_0x4912ac,_0x14692c){return new Promise(function(_0x56136b,_0x55a8ce){var _0x1c3da3;if(_['isNil'](_0x19b0af[_0xc710('0x28')])){_0x19b0af[_0xc710('0x28')]=moment();}if(moment()>moment(_0x19b0af[_0xc710('0x28')])){_0x1c3da3=moment()['add'](_0x14692c||0x3,_0xc710('0x29'));}else{if(_0x19b0af[_0xc710('0x1b')]==0x0){_0x1c3da3=moment(_0x19b0af['scheduledat']);}else{_0x1c3da3=moment()[_0xc710('0x2a')](_0x14692c||0x3,_0xc710('0x29'));}}if(_[_0xc710('0x2b')](_0x1c3da3)){_0x1c3da3=moment()['add'](_0x14692c||0x3,_0xc710('0x29'));}var _0x1957b2={'phone':_0x5b6327[_0xc710('0x2c')],'active':0x0,'OrderBy':_['isNil'](_0x5b6327[_0xc710('0x1b')])?0x0:_0x5b6327[_0xc710('0x1b')],'scheduledat':moment()[_0xc710('0x2a')](_0x4912ac||0x1,_0xc710('0x29')),'countbusyretry':_0x46730f[_0xc710('0x1d')],'countcongestionretry':_0x46730f[_0xc710('0x1e')],'countnoanswerretry':_0x46730f[_0xc710('0x24')],'countnosuchnumberretry':_0x46730f[_0xc710('0x1f')],'countdropretry':_0x46730f[_0xc710('0x2d')],'countabandonedretry':_0x46730f[_0xc710('0x20')],'countmachineretry':_0x46730f['countmachineretry'],'countagentrejectretry':_0x46730f['countagentrejectretry'],'createdAt':_0x46730f['createdAt'],'updatedAt':_0x46730f[_0xc710('0x2e')]};var _0x2655a6={'CmHopperId':_0x5b6327['id'],'phone':_0x19b0af[_0xc710('0x2c')],'active':0x0,'OrderBy':_[_0xc710('0x2b')](_0x19b0af[_0xc710('0x1b')])?0x0:_0x19b0af[_0xc710('0x1b')],'scheduledat':_0x1c3da3,'countbusyretry':_0x19b0af[_0xc710('0x1d')],'countcongestionretry':_0x19b0af[_0xc710('0x1e')],'countnoanswerretry':_0x19b0af[_0xc710('0x24')],'countnosuchnumberretry':_0x19b0af[_0xc710('0x1f')],'countdropretry':_0x19b0af['countdropretry'],'countabandonedretry':_0x19b0af[_0xc710('0x20')],'countmachineretry':_0x19b0af[_0xc710('0x2f')],'countagentrejectretry':_0x19b0af[_0xc710('0x21')],'createdAt':_0x19b0af[_0xc710('0x30')],'updatedAt':_0x19b0af[_0xc710('0x2e')]};return db[_0xc710('0x31')][_0xc710('0x32')](function(_0x32a681){return db[_0xc710('0x19')][_0xc710('0x33')](_0x1957b2,{'where':{'id':_0x19b0af['id']}},{'transaction':_0x32a681})[_0xc710('0x18')](function(){return db[_0xc710('0x12')]['update'](_0x2655a6,{'where':{'id':_0x5b6327['id']}},{'transaction':_0x32a681});});})[_0xc710('0x18')](function(_0x1a690a){_0x56136b({'id':_0x5b6327['id'],'phone':_0x19b0af['phone']});})[_0xc710('0x25')](function(_0x2da8d2){logger[_0xc710('0xc')](_0xc710('0x34'),_0x2da8d2['message']);_0x55a8ce({'error':_0x2da8d2[_0xc710('0xe')]});});});}exports[_0xc710('0x35')]=function(_0x286973){var _0x76a776=this;return new Promise(function(_0xadd1c1,_0x1565fd){return db[_0xc710('0x12')][_0xc710('0x33')](_0x286973[_0xc710('0x13')][_0xc710('0x36')],{'where':{'id':_0x286973[_0xc710('0x13')]['id']}})[_0xc710('0x18')](function(_0x596588){_0xadd1c1(_0x596588);})[_0xc710('0x25')](function(_0x68a063){logger[_0xc710('0xc')]('IncrementPreviewCounters',_0x68a063[_0xc710('0xe')]);_0x1565fd(_0x76a776[_0xc710('0xc')](0x1f4,_0x68a063[_0xc710('0xe')]));});});}; \ No newline at end of file +var _0xfd96=['jayson/promise','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','OrderBy','ASC','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','countbusyretry','countmachineretry','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','phone','countdropretry','createdAt','updatedAt','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0xfd96,0xe7));var _0x6fd9=function(_0x445074,_0x4923f6){_0x445074=_0x445074-0x0;var _0x5afbf7=_0xfd96[_0x445074];return _0x5afbf7;};'use strict';var _=require(_0x6fd9('0x0'));var util=require('util');var moment=require(_0x6fd9('0x1'));var BPromise=require(_0x6fd9('0x2'));var rs=require(_0x6fd9('0x3'));var fs=require('fs');var Redis=require(_0x6fd9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6fd9('0x5'));var logger=require(_0x6fd9('0x6'))(_0x6fd9('0x7'));var config=require(_0x6fd9('0x8'));var jayson=require(_0x6fd9('0x9'));var client=jayson[_0x6fd9('0xa')][_0x6fd9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22f24d,_0x5439f3,_0x156c37){return new BPromise(function(_0x5a3169,_0xa97372){return client[_0x6fd9('0xc')](_0x22f24d,_0x156c37)[_0x6fd9('0xd')](function(_0x58a98c){logger[_0x6fd9('0xe')](_0x6fd9('0xf'),_0x5439f3,_0x6fd9('0x10'));logger[_0x6fd9('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x5439f3,_0x6fd9('0x10'),JSON[_0x6fd9('0x12')](_0x58a98c));if(_0x58a98c[_0x6fd9('0x13')]){if(_0x58a98c['error'][_0x6fd9('0x14')]===0x1f4){logger['error'](_0x6fd9('0xf'),_0x5439f3,_0x58a98c[_0x6fd9('0x13')][_0x6fd9('0x15')]);return _0xa97372(_0x58a98c[_0x6fd9('0x13')][_0x6fd9('0x15')]);}logger[_0x6fd9('0x13')](_0x6fd9('0xf'),_0x5439f3,_0x58a98c[_0x6fd9('0x13')][_0x6fd9('0x15')]);return _0x5a3169(_0x58a98c[_0x6fd9('0x13')][_0x6fd9('0x15')]);}else{logger['info'](_0x6fd9('0xf'),_0x5439f3,_0x6fd9('0x10'));_0x5a3169(_0x58a98c[_0x6fd9('0x16')]['message']);}})[_0x6fd9('0x17')](function(_0x3ffa6c){logger[_0x6fd9('0x13')](_0x6fd9('0xf'),_0x5439f3,_0x3ffa6c);_0xa97372(_0x3ffa6c);});});}exports[_0x6fd9('0x18')]=function(_0x2fb953){var _0x12ec34=this;return new Promise(function(_0x166bd4,_0x4643e5){return db[_0x6fd9('0x19')][_0x6fd9('0x1a')]({'raw':!![],'where':{'ContactId':_0x2fb953[_0x6fd9('0x1b')][_0x6fd9('0x1c')],'ListId':_0x2fb953[_0x6fd9('0x1b')][_0x6fd9('0x1d')],'VoiceQueueId':_0x2fb953[_0x6fd9('0x1b')][_0x6fd9('0x1e')]===undefined?null:_0x2fb953[_0x6fd9('0x1b')][_0x6fd9('0x1e')],'CampaignId':_0x2fb953[_0x6fd9('0x1b')][_0x6fd9('0x1f')]===undefined?null:_0x2fb953[_0x6fd9('0x1b')][_0x6fd9('0x1f')]}})[_0x6fd9('0xd')](function(_0x520685){if(_0x520685!=null){return db['CmHopperAdditionalPhone'][_0x6fd9('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x520685['id'],'OrderBy':{'$gt':_0x520685[_0x6fd9('0x20')]}},'order':[['OrderBy',_0x6fd9('0x21')]]})['then'](function(_0x24f0c8){var _0x48363d=0x0;if(_0x24f0c8){if(_0x24f0c8['countbusyretry']+_0x24f0c8[_0x6fd9('0x22')]+_0x24f0c8[_0x6fd9('0x23')]+_0x24f0c8[_0x6fd9('0x24')]+_0x24f0c8['countdropretry']+_0x24f0c8[_0x6fd9('0x25')]+_0x24f0c8['countmachineretry']+_0x24f0c8[_0x6fd9('0x26')]<_0x2fb953[_0x6fd9('0x27')][_0x6fd9('0x28')])_0x48363d=0x1;_0x166bd4({'additional':_0x48363d});}else{return db[_0x6fd9('0x29')][_0x6fd9('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x520685['id']},'order':[['OrderBy',_0x6fd9('0x21')]]})[_0x6fd9('0xd')](function(_0x59b91e){var _0x182420=0x0;if(_0x59b91e){if(_0x59b91e[_0x6fd9('0x2a')]+_0x59b91e[_0x6fd9('0x22')]+_0x59b91e[_0x6fd9('0x23')]+_0x59b91e['countnosuchnumberretry']+_0x59b91e['countdropretry']+_0x59b91e[_0x6fd9('0x25')]+_0x59b91e[_0x6fd9('0x2b')]+_0x59b91e[_0x6fd9('0x26')]<_0x2fb953[_0x6fd9('0x27')]['dialGlobalMaxRetry'])_0x182420=0x1;_0x166bd4({'additional':_0x182420});}else{_0x166bd4({'additional':0x0});}})[_0x6fd9('0x17')](function(_0x2b6c22){logger[_0x6fd9('0x13')](_0x6fd9('0x18'),_0x2b6c22[_0x6fd9('0x15')]);_0x4643e5(_0x12ec34[_0x6fd9('0x13')](0x1f4,_0x2b6c22['message']));});}})[_0x6fd9('0x17')](function(_0x21c087){logger[_0x6fd9('0x13')](_0x6fd9('0x18'),_0x21c087['message']);_0x4643e5(_0x12ec34[_0x6fd9('0x13')](0x1f4,_0x21c087[_0x6fd9('0x15')]));});}else _0x166bd4({'additional':0x0});});});};exports[_0x6fd9('0x2c')]=function(_0x3d1aec){var _0x56b8af=this;return new Promise(function(_0x1906b7,_0xc072a7){return db[_0x6fd9('0x19')][_0x6fd9('0x1a')]({'raw':!![],'where':{'ContactId':_0x3d1aec[_0x6fd9('0x1b')][_0x6fd9('0x1c')],'ListId':_0x3d1aec['body'][_0x6fd9('0x1d')],'VoiceQueueId':_0x3d1aec[_0x6fd9('0x1b')][_0x6fd9('0x1e')]===undefined?null:_0x3d1aec[_0x6fd9('0x1b')][_0x6fd9('0x1e')],'CampaignId':_0x3d1aec[_0x6fd9('0x1b')][_0x6fd9('0x1f')]===undefined?null:_0x3d1aec[_0x6fd9('0x1b')][_0x6fd9('0x1f')]}})['then'](function(_0x35c046){if(_0x35c046!=null){return db[_0x6fd9('0x29')][_0x6fd9('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x35c046['id'],'OrderBy':{'$gte':_0x35c046[_0x6fd9('0x20')]}},'order':[[_0x6fd9('0x20'),_0x6fd9('0x21')]]})['then'](function(_0xb35434){if(_0xb35434)return activateAdditionalPhone(_0x35c046,_0x3d1aec[_0x6fd9('0x1b')],_0xb35434,_0x3d1aec[_0x6fd9('0x2d')],_0x3d1aec['waitTime'])[_0x6fd9('0xd')](function(_0xfc3dcf){_0x1906b7(_0xfc3dcf);});else{return db[_0x6fd9('0x29')][_0x6fd9('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x35c046['id']},'order':[[_0x6fd9('0x20'),_0x6fd9('0x21')]]})[_0x6fd9('0xd')](function(_0x9d0f72){if(_0x9d0f72)return activateAdditionalPhone(_0x35c046,_0x3d1aec[_0x6fd9('0x1b')],_0x9d0f72,_0x3d1aec['duration'],_0x3d1aec[_0x6fd9('0x2e')])[_0x6fd9('0xd')](function(_0x266ea2){_0x1906b7(_0x266ea2);});else{_0x1906b7({'id':_0x35c046['id'],'phone':''});}})[_0x6fd9('0x17')](function(_0x320a6e){logger[_0x6fd9('0x13')](_0x6fd9('0x18'),_0x320a6e[_0x6fd9('0x15')]);_0xc072a7(_0x56b8af['error'](0x1f4,_0x320a6e[_0x6fd9('0x15')]));});}})[_0x6fd9('0x17')](function(_0x49eadd){logger[_0x6fd9('0x13')](_0x6fd9('0x18'),_0x49eadd['message']);_0xc072a7(_0x56b8af['error'](0x1f4,_0x49eadd[_0x6fd9('0x15')]));});}else _0x1906b7(0x1);});});};function activateAdditionalPhone(_0x11b079,_0x34f66d,_0x85027a,_0x3738c4,_0x4aa61e){return new Promise(function(_0x53d828,_0xa267f9){var _0x3f2c76;if(_[_0x6fd9('0x2f')](_0x85027a[_0x6fd9('0x30')])){_0x85027a[_0x6fd9('0x30')]=moment();}if(moment()>moment(_0x85027a['scheduledat'])){_0x3f2c76=moment()[_0x6fd9('0x31')](_0x4aa61e||0x3,_0x6fd9('0x32'));}else{if(_0x85027a[_0x6fd9('0x20')]==0x0){_0x3f2c76=moment(_0x85027a['scheduledat']);}else{_0x3f2c76=moment()[_0x6fd9('0x31')](_0x4aa61e||0x3,'minutes');}}if(_[_0x6fd9('0x2f')](_0x3f2c76)){_0x3f2c76=moment()[_0x6fd9('0x31')](_0x4aa61e||0x3,_0x6fd9('0x32'));}var _0x1995d1={'phone':_0x11b079[_0x6fd9('0x33')],'active':0x0,'OrderBy':_[_0x6fd9('0x2f')](_0x11b079[_0x6fd9('0x20')])?0x0:_0x11b079[_0x6fd9('0x20')],'scheduledat':moment()[_0x6fd9('0x31')](_0x3738c4||0x1,_0x6fd9('0x32')),'countbusyretry':_0x34f66d[_0x6fd9('0x2a')],'countcongestionretry':_0x34f66d[_0x6fd9('0x22')],'countnoanswerretry':_0x34f66d['countnoanswerretry'],'countnosuchnumberretry':_0x34f66d[_0x6fd9('0x24')],'countdropretry':_0x34f66d[_0x6fd9('0x34')],'countabandonedretry':_0x34f66d['countabandonedretry'],'countmachineretry':_0x34f66d[_0x6fd9('0x2b')],'countagentrejectretry':_0x34f66d[_0x6fd9('0x26')],'createdAt':_0x34f66d[_0x6fd9('0x35')],'updatedAt':_0x34f66d['updatedAt']};var _0x2a8dd1={'CmHopperId':_0x11b079['id'],'phone':_0x85027a[_0x6fd9('0x33')],'active':0x0,'OrderBy':_['isNil'](_0x85027a[_0x6fd9('0x20')])?0x0:_0x85027a[_0x6fd9('0x20')],'scheduledat':_0x3f2c76,'countbusyretry':_0x85027a[_0x6fd9('0x2a')],'countcongestionretry':_0x85027a['countcongestionretry'],'countnoanswerretry':_0x85027a['countnoanswerretry'],'countnosuchnumberretry':_0x85027a[_0x6fd9('0x24')],'countdropretry':_0x85027a[_0x6fd9('0x34')],'countabandonedretry':_0x85027a[_0x6fd9('0x25')],'countmachineretry':_0x85027a[_0x6fd9('0x2b')],'countagentrejectretry':_0x85027a[_0x6fd9('0x26')],'createdAt':_0x85027a[_0x6fd9('0x35')],'updatedAt':_0x85027a[_0x6fd9('0x36')]};return db[_0x6fd9('0x37')]['transaction'](function(_0x46e813){return db['CmHopperAdditionalPhone'][_0x6fd9('0x38')](_0x1995d1,{'where':{'id':_0x85027a['id']}},{'transaction':_0x46e813})[_0x6fd9('0xd')](function(){return db[_0x6fd9('0x19')][_0x6fd9('0x38')](_0x2a8dd1,{'where':{'id':_0x11b079['id']}},{'transaction':_0x46e813});});})[_0x6fd9('0xd')](function(_0x25c8b6){_0x53d828({'id':_0x11b079['id'],'phone':_0x85027a[_0x6fd9('0x33')]});})['catch'](function(_0x2cddb6){logger[_0x6fd9('0x13')](_0x6fd9('0x39'),_0x2cddb6['message']);_0xa267f9({'error':_0x2cddb6[_0x6fd9('0x15')]});});});}exports[_0x6fd9('0x3a')]=function(_0x1b8498){var _0x4d33be=this;return new Promise(function(_0x29ec14,_0x202c66){return db[_0x6fd9('0x19')]['update'](_0x1b8498[_0x6fd9('0x1b')][_0x6fd9('0x3b')],{'where':{'id':_0x1b8498[_0x6fd9('0x1b')]['id']}})[_0x6fd9('0xd')](function(_0x12cc69){_0x29ec14(_0x12cc69);})[_0x6fd9('0x17')](function(_0x5ed7f9){logger[_0x6fd9('0x13')](_0x6fd9('0x3a'),_0x5ed7f9[_0x6fd9('0x15')]);_0x202c66(_0x4d33be[_0x6fd9('0x13')](0x1f4,_0x5ed7f9[_0x6fd9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 02b290b..d481d35 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 _0x012b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','index','/:id','isAuthenticated','show','update','destroy','exports','path','express','Router','fs-extra'];(function(_0x5c1fd6,_0x1a8388){var _0x281461=function(_0x7d9e5d){while(--_0x7d9e5d){_0x5c1fd6['push'](_0x5c1fd6['shift']());}};_0x281461(++_0x1a8388);}(_0x012b,0x11c));var _0xb012=function(_0x137466,_0x325555){_0x137466=_0x137466-0x0;var _0x299225=_0x012b[_0x137466];return _0x299225;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb012('0x0'));var timeout=require('connect-timeout');var express=require(_0xb012('0x1'));var router=express[_0xb012('0x2')]();var fs_extra=require(_0xb012('0x3'));var auth=require(_0xb012('0x4'));var interaction=require(_0xb012('0x5'));var config=require(_0xb012('0x6'));var controller=require(_0xb012('0x7'));router[_0xb012('0x8')]('/',auth['isAuthenticated'](),controller[_0xb012('0x9')]);router['get'](_0xb012('0xa'),auth[_0xb012('0xb')](),controller[_0xb012('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xb012('0xa'),auth[_0xb012('0xb')](),controller[_0xb012('0xd')]);router['delete'](_0xb012('0xa'),auth[_0xb012('0xb')](),controller[_0xb012('0xe')]);module[_0xb012('0xf')]=router; \ No newline at end of file +var _0xb4ad=['post','create','delete','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id'];(function(_0x17406e,_0x1049fd){var _0x2bfc5a=function(_0x2aae05){while(--_0x2aae05){_0x17406e['push'](_0x17406e['shift']());}};_0x2bfc5a(++_0x1049fd);}(_0xb4ad,0x153));var _0xdb4a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb4ad[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xdb4a('0x0'));var util=require(_0xdb4a('0x1'));var path=require(_0xdb4a('0x2'));var timeout=require('connect-timeout');var express=require(_0xdb4a('0x3'));var router=express[_0xdb4a('0x4')]();var fs_extra=require(_0xdb4a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdb4a('0x6'));var config=require(_0xdb4a('0x7'));var controller=require(_0xdb4a('0x8'));router[_0xdb4a('0x9')]('/',auth[_0xdb4a('0xa')](),controller[_0xdb4a('0xb')]);router[_0xdb4a('0x9')](_0xdb4a('0xc'),auth[_0xdb4a('0xa')](),controller['show']);router[_0xdb4a('0xd')]('/',auth[_0xdb4a('0xa')](),controller[_0xdb4a('0xe')]);router['put'](_0xdb4a('0xc'),auth[_0xdb4a('0xa')](),controller['update']);router[_0xdb4a('0xf')](_0xdb4a('0xc'),auth[_0xdb4a('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index d399faf..d2dc45a 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 _0xa676=['sequelize','exports','STRING','contactListQueue','INTEGER','moment'];(function(_0x23746a,_0x3f83d0){var _0x4abfed=function(_0x3e9505){while(--_0x3e9505){_0x23746a['push'](_0x23746a['shift']());}};_0x4abfed(++_0x3f83d0);}(_0xa676,0x15b));var _0x6a67=function(_0x4710e6,_0x112dab){_0x4710e6=_0x4710e6-0x0;var _0x32b775=_0xa676[_0x4710e6];return _0x32b775;};'use strict';var moment=require(_0x6a67('0x0'));var Sequelize=require(_0x6a67('0x1'));module[_0x6a67('0x2')]={'phone':{'type':Sequelize[_0x6a67('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x6a67('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x6a67('0x4')},'VoiceQueueId':{'type':Sequelize[_0x6a67('0x5')],'unique':_0x6a67('0x4')}}; \ No newline at end of file +var _0x36f3=['sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x3a18da,_0x161e82){var _0x4f74c3=function(_0x3e7d9e){while(--_0x3e7d9e){_0x3a18da['push'](_0x3a18da['shift']());}};_0x4f74c3(++_0x161e82);}(_0x36f3,0xe6));var _0x336f=function(_0x18f645,_0x2513d4){_0x18f645=_0x18f645-0x0;var _0x494d39=_0x36f3[_0x18f645];return _0x494d39;};'use strict';var moment=require('moment');var Sequelize=require(_0x336f('0x0'));module[_0x336f('0x1')]={'phone':{'type':Sequelize[_0x336f('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x336f('0x3')],'unique':_0x336f('0x4')},'ListId':{'type':Sequelize[_0x336f('0x3')],'unique':_0x336f('0x4')},'VoiceQueueId':{'type':Sequelize[_0x336f('0x3')],'unique':_0x336f('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 8432565..f9f2c0f 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 _0xced7=['end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','sendStatus','error','name','index','rawAttributes','fieldName','type','key','map','query','intersection','model','fields','attributes','length','nolimit','order','sort','filters','where','filter','options','CmHopperBlack','include','rows','catch','show','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xced7,0xf2));var _0x7ced=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xced7[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7ced('0x0'));var rimraf=require(_0x7ced('0x1'));var zipdir=require(_0x7ced('0x2'));var jsonpatch=require(_0x7ced('0x3'));var rp=require(_0x7ced('0x4'));var moment=require('moment');var BPromise=require(_0x7ced('0x5'));var Mustache=require('mustache');var util=require(_0x7ced('0x6'));var path=require(_0x7ced('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7ced('0x8'));var fs=require('fs');var fs_extra=require(_0x7ced('0x9'));var _=require('lodash');var squel=require(_0x7ced('0xa'));var crypto=require(_0x7ced('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7ced('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7ced('0xd'));var Papa=require(_0x7ced('0xe'));var Redis=require('ioredis');var authService=require(_0x7ced('0xf'));var qs=require(_0x7ced('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7ced('0x11'));var logger=require(_0x7ced('0x12'))(_0x7ced('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7ced('0x14'));var db=require(_0x7ced('0x15'))['db'];function respondWithStatusCode(_0x47ffa9,_0x17f696){_0x17f696=_0x17f696||0xcc;return function(_0x5a88c8){if(_0x5a88c8){return _0x47ffa9['sendStatus'](_0x17f696);}return _0x47ffa9['status'](_0x17f696)[_0x7ced('0x16')]();};}function respondWithResult(_0x4bb98b,_0x24b8b7){_0x24b8b7=_0x24b8b7||0xc8;return function(_0x749d33){if(_0x749d33){return _0x4bb98b[_0x7ced('0x17')](_0x24b8b7)[_0x7ced('0x18')](_0x749d33);}};}function respondWithFilteredResult(_0x407b19,_0x229920){return function(_0x2e6ebe){if(_0x2e6ebe){var _0x17f6a5=typeof _0x229920[_0x7ced('0x19')]===_0x7ced('0x1a')&&typeof _0x229920[_0x7ced('0x1b')]===_0x7ced('0x1a');var _0x3a05c8=_0x2e6ebe['count'];var _0x3ee432=_0x17f6a5?0x0:_0x229920[_0x7ced('0x19')];var _0x38949d=_0x17f6a5?_0x2e6ebe[_0x7ced('0x1c')]:_0x229920[_0x7ced('0x19')]+_0x229920[_0x7ced('0x1b')];var _0x589d5f;if(_0x38949d>=_0x3a05c8){_0x38949d=_0x3a05c8;_0x589d5f=0xc8;}else{_0x589d5f=0xce;}_0x407b19['status'](_0x589d5f);return _0x407b19['set'](_0x7ced('0x1d'),_0x3ee432+'-'+_0x38949d+'/'+_0x3a05c8)[_0x7ced('0x18')](_0x2e6ebe);}return null;};}function patchUpdates(_0x393165){return function(_0x11b022){try{jsonpatch[_0x7ced('0x1e')](_0x11b022,_0x393165,!![]);}catch(_0x5c11d0){return BPromise[_0x7ced('0x1f')](_0x5c11d0);}return _0x11b022[_0x7ced('0x20')]();};}function saveUpdates(_0x270351,_0xfc328c){return function(_0x111526){if(_0x111526){return _0x111526[_0x7ced('0x21')](_0x270351)[_0x7ced('0x22')](function(_0x13ffaf){return _0x13ffaf;});}return null;};}function removeEntity(_0x3dba54,_0x1adc14){return function(_0x1b8b9e){if(_0x1b8b9e){return _0x1b8b9e['destroy']()['then'](function(){_0x3dba54[_0x7ced('0x17')](0xcc)[_0x7ced('0x16')]();});}};}function handleEntityNotFound(_0x1b1e67,_0x39d237){return function(_0x1d46d){if(!_0x1d46d){_0x1b1e67[_0x7ced('0x23')](0x194);}return _0x1d46d;};}function handleError(_0x232e98,_0x12865d){_0x12865d=_0x12865d||0x1f4;return function(_0x5756ca){logger[_0x7ced('0x24')](_0x5756ca['stack']);if(_0x5756ca['name']){delete _0x5756ca[_0x7ced('0x25')];}_0x232e98[_0x7ced('0x17')](_0x12865d)['send'](_0x5756ca);};}exports[_0x7ced('0x26')]=function(_0x936f69,_0x340a29){var _0x4d387e={},_0x2213b6={},_0x4570eb={'count':0x0,'rows':[]};var _0x29be29=_['map'](db['CmHopperBlack'][_0x7ced('0x27')],function(_0x18452b){return{'name':_0x18452b[_0x7ced('0x28')],'type':_0x18452b[_0x7ced('0x29')][_0x7ced('0x2a')]};});_0x2213b6['model']=_[_0x7ced('0x2b')](_0x29be29,_0x7ced('0x25'));_0x2213b6[_0x7ced('0x2c')]=_['keys'](_0x936f69[_0x7ced('0x2c')]);_0x2213b6['filters']=_[_0x7ced('0x2d')](_0x2213b6[_0x7ced('0x2e')],_0x2213b6[_0x7ced('0x2c')]);_0x4d387e['attributes']=_['intersection'](_0x2213b6[_0x7ced('0x2e')],qs['fields'](_0x936f69[_0x7ced('0x2c')][_0x7ced('0x2f')]));_0x4d387e['attributes']=_0x4d387e[_0x7ced('0x30')][_0x7ced('0x31')]?_0x4d387e[_0x7ced('0x30')]:_0x2213b6['model'];if(!_0x936f69[_0x7ced('0x2c')]['hasOwnProperty'](_0x7ced('0x32'))){_0x4d387e[_0x7ced('0x1b')]=qs[_0x7ced('0x1b')](_0x936f69[_0x7ced('0x2c')][_0x7ced('0x1b')]);_0x4d387e[_0x7ced('0x19')]=qs[_0x7ced('0x19')](_0x936f69[_0x7ced('0x2c')][_0x7ced('0x19')]);}_0x4d387e[_0x7ced('0x33')]=qs[_0x7ced('0x34')](_0x936f69[_0x7ced('0x2c')]['sort']);_0x4d387e['where']=qs['filters'](_['pick'](_0x936f69[_0x7ced('0x2c')],_0x2213b6[_0x7ced('0x35')]),_0x29be29);if(_0x936f69[_0x7ced('0x2c')]['filter']){_0x4d387e[_0x7ced('0x36')]=_['merge'](_0x4d387e[_0x7ced('0x36')],{'$or':_['map'](_0x29be29,function(_0x329c83){if(_0x329c83['type']!=='VIRTUAL'){var _0x2dc7a6={};_0x2dc7a6[_0x329c83[_0x7ced('0x25')]]={'$like':'%'+_0x936f69[_0x7ced('0x2c')][_0x7ced('0x37')]+'%'};return _0x2dc7a6;}})});}_0x4d387e=_['merge']({},_0x4d387e,_0x936f69[_0x7ced('0x38')]);var _0xe633bd={'where':_0x4d387e[_0x7ced('0x36')]};return db[_0x7ced('0x39')][_0x7ced('0x1c')](_0xe633bd)[_0x7ced('0x22')](function(_0x4dac5e){_0x4570eb[_0x7ced('0x1c')]=_0x4dac5e;if(_0x936f69[_0x7ced('0x2c')]['includeAll']){_0x4d387e[_0x7ced('0x3a')]=[{'all':!![]}];}return db[_0x7ced('0x39')]['findAll'](_0x4d387e);})[_0x7ced('0x22')](function(_0x1e9715){_0x4570eb[_0x7ced('0x3b')]=_0x1e9715;return _0x4570eb;})[_0x7ced('0x22')](respondWithFilteredResult(_0x340a29,_0x4d387e))[_0x7ced('0x3c')](handleError(_0x340a29,null));};exports[_0x7ced('0x3d')]=function(_0xf852da,_0x3d297c){var _0x48af78={'raw':!![],'where':{'id':_0xf852da['params']['id']}},_0x1a2f4c={};_0x1a2f4c[_0x7ced('0x2e')]=_['keys'](db[_0x7ced('0x39')][_0x7ced('0x27')]);_0x1a2f4c[_0x7ced('0x2c')]=_['keys'](_0xf852da[_0x7ced('0x2c')]);_0x1a2f4c[_0x7ced('0x35')]=_[_0x7ced('0x2d')](_0x1a2f4c[_0x7ced('0x2e')],_0x1a2f4c['query']);_0x48af78['attributes']=_[_0x7ced('0x2d')](_0x1a2f4c[_0x7ced('0x2e')],qs['fields'](_0xf852da[_0x7ced('0x2c')][_0x7ced('0x2f')]));_0x48af78['attributes']=_0x48af78[_0x7ced('0x30')][_0x7ced('0x31')]?_0x48af78[_0x7ced('0x30')]:_0x1a2f4c[_0x7ced('0x2e')];if(_0xf852da[_0x7ced('0x2c')]['includeAll']){_0x48af78[_0x7ced('0x3a')]=[{'all':!![]}];}_0x48af78=_['merge']({},_0x48af78,_0xf852da[_0x7ced('0x38')]);return db[_0x7ced('0x39')][_0x7ced('0x3e')](_0x48af78)[_0x7ced('0x22')](handleEntityNotFound(_0x3d297c,null))['then'](respondWithResult(_0x3d297c,null))[_0x7ced('0x3c')](handleError(_0x3d297c,null));};exports[_0x7ced('0x21')]=function(_0x139876,_0x52dbfa){if(_0x139876[_0x7ced('0x3f')]['id']){delete _0x139876['body']['id'];}return db[_0x7ced('0x39')][_0x7ced('0x3e')]({'where':{'id':_0x139876[_0x7ced('0x40')]['id']}})[_0x7ced('0x22')](handleEntityNotFound(_0x52dbfa,null))[_0x7ced('0x22')](saveUpdates(_0x139876[_0x7ced('0x3f')],null))[_0x7ced('0x22')](respondWithResult(_0x52dbfa,null))['catch'](handleError(_0x52dbfa,null));};exports['destroy']=function(_0x3d0147,_0x594723){return db[_0x7ced('0x39')][_0x7ced('0x3e')]({'where':{'id':_0x3d0147[_0x7ced('0x40')]['id']}})[_0x7ced('0x22')](handleEntityNotFound(_0x594723,null))[_0x7ced('0x22')](removeEntity(_0x594723,null))['catch'](handleError(_0x594723,null));};exports[_0x7ced('0x41')]=function(_0x2bd569,_0x1ffcbb){return db[_0x7ced('0x39')][_0x7ced('0x41')]()[_0x7ced('0x22')](respondWithResult(_0x1ffcbb,null))[_0x7ced('0x3c')](handleError(_0x1ffcbb,null));}; \ No newline at end of file +var _0x4c1d=['sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','keys','find','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','set','reject','update','then','destroy','error','stack','name','send','CmHopperBlack','rawAttributes','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0x4c1d,0x123));var _0xd4c1=function(_0x22808a,_0x13a0b1){_0x22808a=_0x22808a-0x0;var _0x475ea0=_0x4c1d[_0x22808a];return _0x475ea0;};'use strict';var emlformat=require(_0xd4c1('0x0'));var rimraf=require(_0xd4c1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd4c1('0x2'));var rp=require(_0xd4c1('0x3'));var moment=require('moment');var BPromise=require(_0xd4c1('0x4'));var Mustache=require(_0xd4c1('0x5'));var util=require(_0xd4c1('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xd4c1('0x7'));var ejs=require(_0xd4c1('0x8'));var fs=require('fs');var fs_extra=require(_0xd4c1('0x9'));var _=require('lodash');var squel=require(_0xd4c1('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd4c1('0xb'));var toCsv=require(_0xd4c1('0x7'));var querystring=require(_0xd4c1('0xc'));var Papa=require(_0xd4c1('0xd'));var Redis=require(_0xd4c1('0xe'));var authService=require(_0xd4c1('0xf'));var qs=require(_0xd4c1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd4c1('0x11'));var logger=require('../../config/logger')(_0xd4c1('0x12'));var utils=require(_0xd4c1('0x13'));var config=require(_0xd4c1('0x14'));var licenseUtil=require(_0xd4c1('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x179bb2,_0x25feb7){_0x25feb7=_0x25feb7||0xcc;return function(_0x28993d){if(_0x28993d){return _0x179bb2[_0xd4c1('0x16')](_0x25feb7);}return _0x179bb2[_0xd4c1('0x17')](_0x25feb7)[_0xd4c1('0x18')]();};}function respondWithResult(_0x5e9b39,_0x2346dd){_0x2346dd=_0x2346dd||0xc8;return function(_0x7b5bfa){if(_0x7b5bfa){return _0x5e9b39[_0xd4c1('0x17')](_0x2346dd)[_0xd4c1('0x19')](_0x7b5bfa);}};}function respondWithFilteredResult(_0x261e90,_0x45c719){return function(_0x461f2c){if(_0x461f2c){var _0x3ad84e=typeof _0x45c719['offset']===_0xd4c1('0x1a')&&typeof _0x45c719['limit']===_0xd4c1('0x1a');var _0x1189d9=_0x461f2c[_0xd4c1('0x1b')];var _0x3aa918=_0x3ad84e?0x0:_0x45c719[_0xd4c1('0x1c')];var _0x2174a3=_0x3ad84e?_0x461f2c[_0xd4c1('0x1b')]:_0x45c719[_0xd4c1('0x1c')]+_0x45c719['limit'];var _0x3b1bd3;if(_0x2174a3>=_0x1189d9){_0x2174a3=_0x1189d9;_0x3b1bd3=0xc8;}else{_0x3b1bd3=0xce;}_0x261e90[_0xd4c1('0x17')](_0x3b1bd3);return _0x261e90[_0xd4c1('0x1d')]('Content-Range',_0x3aa918+'-'+_0x2174a3+'/'+_0x1189d9)[_0xd4c1('0x19')](_0x461f2c);}return null;};}function patchUpdates(_0x239361){return function(_0x541130){try{jsonpatch['apply'](_0x541130,_0x239361,!![]);}catch(_0x35326d){return BPromise[_0xd4c1('0x1e')](_0x35326d);}return _0x541130['save']();};}function saveUpdates(_0x484fe0,_0x44fb3b){return function(_0x3d1701){if(_0x3d1701){return _0x3d1701[_0xd4c1('0x1f')](_0x484fe0)[_0xd4c1('0x20')](function(_0xb2358b){return _0xb2358b;});}return null;};}function removeEntity(_0x43ef5b,_0x108ae7){return function(_0x5bb930){if(_0x5bb930){return _0x5bb930[_0xd4c1('0x21')]()[_0xd4c1('0x20')](function(){_0x43ef5b[_0xd4c1('0x17')](0xcc)[_0xd4c1('0x18')]();});}};}function handleEntityNotFound(_0x191d93,_0x1b7717){return function(_0x51915f){if(!_0x51915f){_0x191d93['sendStatus'](0x194);}return _0x51915f;};}function handleError(_0x1a5798,_0x2f2937){_0x2f2937=_0x2f2937||0x1f4;return function(_0x15a8cf){logger[_0xd4c1('0x22')](_0x15a8cf[_0xd4c1('0x23')]);if(_0x15a8cf[_0xd4c1('0x24')]){delete _0x15a8cf[_0xd4c1('0x24')];}_0x1a5798['status'](_0x2f2937)[_0xd4c1('0x25')](_0x15a8cf);};}exports['index']=function(_0xc6867f,_0x323c69){var _0x19b691={},_0x332bf0={},_0x6f71d5={'count':0x0,'rows':[]};var _0x441e6e=_['map'](db[_0xd4c1('0x26')][_0xd4c1('0x27')],function(_0xdc0a47){return{'name':_0xdc0a47['fieldName'],'type':_0xdc0a47[_0xd4c1('0x28')][_0xd4c1('0x29')]};});_0x332bf0[_0xd4c1('0x2a')]=_[_0xd4c1('0x2b')](_0x441e6e,'name');_0x332bf0[_0xd4c1('0x2c')]=_['keys'](_0xc6867f[_0xd4c1('0x2c')]);_0x332bf0[_0xd4c1('0x2d')]=_['intersection'](_0x332bf0[_0xd4c1('0x2a')],_0x332bf0[_0xd4c1('0x2c')]);_0x19b691[_0xd4c1('0x2e')]=_[_0xd4c1('0x2f')](_0x332bf0[_0xd4c1('0x2a')],qs[_0xd4c1('0x30')](_0xc6867f[_0xd4c1('0x2c')][_0xd4c1('0x30')]));_0x19b691[_0xd4c1('0x2e')]=_0x19b691[_0xd4c1('0x2e')][_0xd4c1('0x31')]?_0x19b691[_0xd4c1('0x2e')]:_0x332bf0[_0xd4c1('0x2a')];if(!_0xc6867f[_0xd4c1('0x2c')][_0xd4c1('0x32')](_0xd4c1('0x33'))){_0x19b691['limit']=qs['limit'](_0xc6867f[_0xd4c1('0x2c')][_0xd4c1('0x34')]);_0x19b691[_0xd4c1('0x1c')]=qs['offset'](_0xc6867f[_0xd4c1('0x2c')][_0xd4c1('0x1c')]);}_0x19b691[_0xd4c1('0x35')]=qs[_0xd4c1('0x36')](_0xc6867f[_0xd4c1('0x2c')][_0xd4c1('0x36')]);_0x19b691[_0xd4c1('0x37')]=qs['filters'](_['pick'](_0xc6867f['query'],_0x332bf0[_0xd4c1('0x2d')]),_0x441e6e);if(_0xc6867f[_0xd4c1('0x2c')][_0xd4c1('0x38')]){_0x19b691[_0xd4c1('0x37')]=_['merge'](_0x19b691[_0xd4c1('0x37')],{'$or':_['map'](_0x441e6e,function(_0x749b0d){if(_0x749b0d[_0xd4c1('0x28')]!==_0xd4c1('0x39')){var _0x4c3484={};_0x4c3484[_0x749b0d[_0xd4c1('0x24')]]={'$like':'%'+_0xc6867f[_0xd4c1('0x2c')][_0xd4c1('0x38')]+'%'};return _0x4c3484;}})});}_0x19b691=_[_0xd4c1('0x3a')]({},_0x19b691,_0xc6867f[_0xd4c1('0x3b')]);var _0x932b2c={'where':_0x19b691[_0xd4c1('0x37')]};return db[_0xd4c1('0x26')][_0xd4c1('0x1b')](_0x932b2c)[_0xd4c1('0x20')](function(_0x4b801e){_0x6f71d5[_0xd4c1('0x1b')]=_0x4b801e;if(_0xc6867f[_0xd4c1('0x2c')][_0xd4c1('0x3c')]){_0x19b691[_0xd4c1('0x3d')]=[{'all':!![]}];}return db[_0xd4c1('0x26')][_0xd4c1('0x3e')](_0x19b691);})[_0xd4c1('0x20')](function(_0x5547c5){_0x6f71d5['rows']=_0x5547c5;return _0x6f71d5;})[_0xd4c1('0x20')](respondWithFilteredResult(_0x323c69,_0x19b691))[_0xd4c1('0x3f')](handleError(_0x323c69,null));};exports['show']=function(_0x25b4c6,_0x31893a){var _0x1969f9={'raw':!![],'where':{'id':_0x25b4c6['params']['id']}},_0x410fe3={};_0x410fe3[_0xd4c1('0x2a')]=_[_0xd4c1('0x40')](db[_0xd4c1('0x26')][_0xd4c1('0x27')]);_0x410fe3['query']=_[_0xd4c1('0x40')](_0x25b4c6['query']);_0x410fe3[_0xd4c1('0x2d')]=_[_0xd4c1('0x2f')](_0x410fe3[_0xd4c1('0x2a')],_0x410fe3[_0xd4c1('0x2c')]);_0x1969f9[_0xd4c1('0x2e')]=_[_0xd4c1('0x2f')](_0x410fe3[_0xd4c1('0x2a')],qs[_0xd4c1('0x30')](_0x25b4c6[_0xd4c1('0x2c')][_0xd4c1('0x30')]));_0x1969f9[_0xd4c1('0x2e')]=_0x1969f9[_0xd4c1('0x2e')][_0xd4c1('0x31')]?_0x1969f9[_0xd4c1('0x2e')]:_0x410fe3[_0xd4c1('0x2a')];if(_0x25b4c6[_0xd4c1('0x2c')][_0xd4c1('0x3c')]){_0x1969f9[_0xd4c1('0x3d')]=[{'all':!![]}];}_0x1969f9=_[_0xd4c1('0x3a')]({},_0x1969f9,_0x25b4c6[_0xd4c1('0x3b')]);return db[_0xd4c1('0x26')][_0xd4c1('0x41')](_0x1969f9)[_0xd4c1('0x20')](handleEntityNotFound(_0x31893a,null))[_0xd4c1('0x20')](respondWithResult(_0x31893a,null))['catch'](handleError(_0x31893a,null));};exports[_0xd4c1('0x1f')]=function(_0x1b60be,_0x51e641){if(_0x1b60be[_0xd4c1('0x42')]['id']){delete _0x1b60be[_0xd4c1('0x42')]['id'];}return db[_0xd4c1('0x26')][_0xd4c1('0x41')]({'where':{'id':_0x1b60be['params']['id']}})[_0xd4c1('0x20')](handleEntityNotFound(_0x51e641,null))[_0xd4c1('0x20')](saveUpdates(_0x1b60be[_0xd4c1('0x42')],null))[_0xd4c1('0x20')](respondWithResult(_0x51e641,null))['catch'](handleError(_0x51e641,null));};exports[_0xd4c1('0x21')]=function(_0x1312e4,_0x1f163b){return db[_0xd4c1('0x26')][_0xd4c1('0x41')]({'where':{'id':_0x1312e4[_0xd4c1('0x43')]['id']}})[_0xd4c1('0x20')](handleEntityNotFound(_0x1f163b,null))['then'](removeEntity(_0x1f163b,null))[_0xd4c1('0x3f')](handleError(_0x1f163b,null));};exports[_0xd4c1('0x44')]=function(_0x26a414,_0x33c828){return db[_0xd4c1('0x26')]['describe']()[_0xd4c1('0x20')](respondWithResult(_0x33c828,null))['catch'](handleError(_0x33c828,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 2a04ac5..d5b53e4 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 _0x2ff0=['exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2d0c44,_0x263332){var _0x129acd=function(_0xa693e3){while(--_0xa693e3){_0x2d0c44['push'](_0x2d0c44['shift']());}};_0x129acd(++_0x263332);}(_0x2ff0,0x159));var _0x02ff=function(_0x168864,_0x14d642){_0x168864=_0x168864-0x0;var _0x14efba=_0x2ff0[_0x168864];return _0x14efba;};'use strict';var _=require(_0x02ff('0x0'));var util=require(_0x02ff('0x1'));var logger=require(_0x02ff('0x2'))(_0x02ff('0x3'));var moment=require(_0x02ff('0x4'));var BPromise=require(_0x02ff('0x5'));var rp=require(_0x02ff('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module[_0x02ff('0x7')]=function(_0x19e49c,_0x93462f){return _0x19e49c[_0x02ff('0x8')](_0x02ff('0x9'),attributes,{'tableName':_0x02ff('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf03c=['./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x237bb4,_0x172ea1){var _0x3c6d33=function(_0x3765eb){while(--_0x3765eb){_0x237bb4['push'](_0x237bb4['shift']());}};_0x3c6d33(++_0x172ea1);}(_0xf03c,0xdd));var _0xcf03=function(_0x22f58e,_0x1cb387){_0x22f58e=_0x22f58e-0x0;var _0x4e48a6=_0xf03c[_0x22f58e];return _0x4e48a6;};'use strict';var _=require(_0xcf03('0x0'));var util=require('util');var logger=require(_0xcf03('0x1'))(_0xcf03('0x2'));var moment=require(_0xcf03('0x3'));var BPromise=require(_0xcf03('0x4'));var rp=require(_0xcf03('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcf03('0x6'));var config=require('../../config/environment');var attributes=require(_0xcf03('0x7'));module[_0xcf03('0x8')]=function(_0x1e7eee,_0x4fde4d){return _0x1e7eee[_0xcf03('0x9')](_0xcf03('0xa'),attributes,{'tableName':_0xcf03('0xb'),'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 7c4f294..38a99d6 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 _0x4e77=['CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','limit','map','include','model','attributes','update','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3a3bf4,_0x3992d7){var _0x40eed1=function(_0x4d2c40){while(--_0x4d2c40){_0x3a3bf4['push'](_0x3a3bf4['shift']());}};_0x40eed1(++_0x3992d7);}(_0x4e77,0x181));var _0x74e7=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x4e77[_0x432682];return _0x463d05;};'use strict';var _=require(_0x74e7('0x0'));var util=require(_0x74e7('0x1'));var moment=require(_0x74e7('0x2'));var BPromise=require(_0x74e7('0x3'));var rs=require(_0x74e7('0x4'));var fs=require('fs');var Redis=require(_0x74e7('0x5'));var db=require(_0x74e7('0x6'))['db'];var utils=require(_0x74e7('0x7'));var logger=require(_0x74e7('0x8'))('rpc');var config=require(_0x74e7('0x9'));var jayson=require(_0x74e7('0xa'));var client=jayson[_0x74e7('0xb')][_0x74e7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x32b3c5,_0x280c45,_0x19db2c){return new BPromise(function(_0x28437b,_0x119f13){return client[_0x74e7('0xd')](_0x32b3c5,_0x19db2c)[_0x74e7('0xe')](function(_0x173f8e){logger['info'](_0x74e7('0xf'),_0x280c45,_0x74e7('0x10'));logger[_0x74e7('0x11')](_0x74e7('0x12'),_0x280c45,_0x74e7('0x10'),JSON[_0x74e7('0x13')](_0x173f8e));if(_0x173f8e[_0x74e7('0x14')]){if(_0x173f8e[_0x74e7('0x14')][_0x74e7('0x15')]===0x1f4){logger['error'](_0x74e7('0xf'),_0x280c45,_0x173f8e[_0x74e7('0x14')]['message']);return _0x119f13(_0x173f8e[_0x74e7('0x14')][_0x74e7('0x16')]);}logger[_0x74e7('0x14')](_0x74e7('0xf'),_0x280c45,_0x173f8e['error']['message']);return _0x28437b(_0x173f8e[_0x74e7('0x14')][_0x74e7('0x16')]);}else{logger[_0x74e7('0x17')](_0x74e7('0xf'),_0x280c45,_0x74e7('0x10'));_0x28437b(_0x173f8e[_0x74e7('0x18')]['message']);}})[_0x74e7('0x19')](function(_0x258c26){logger[_0x74e7('0x14')]('CmHopperBlack,\x20%s,\x20%s',_0x280c45,_0x258c26);_0x119f13(_0x258c26);});});}exports[_0x74e7('0x1a')]=function(_0x46d63d){var _0x158dac=this;return new Promise(function(_0x301408,_0x1d532b){return db[_0x74e7('0x1b')][_0x74e7('0x1c')]({'raw':_0x46d63d[_0x74e7('0x1d')]?_0x46d63d[_0x74e7('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x46d63d[_0x74e7('0x1d')]?_0x46d63d[_0x74e7('0x1d')]['where']||null:null,'attributes':_0x46d63d[_0x74e7('0x1d')]?_0x46d63d[_0x74e7('0x1d')]['attributes']||null:null,'limit':_0x46d63d[_0x74e7('0x1d')]?_0x46d63d['options'][_0x74e7('0x1e')]||null:null,'include':_0x46d63d[_0x74e7('0x1d')]?_0x46d63d[_0x74e7('0x1d')]['include']?_[_0x74e7('0x1f')](_0x46d63d['options'][_0x74e7('0x20')],function(_0x11f675){return{'model':db[_0x11f675[_0x74e7('0x21')]],'as':_0x11f675['as'],'attributes':_0x11f675[_0x74e7('0x22')],'include':_0x11f675[_0x74e7('0x20')]?_[_0x74e7('0x1f')](_0x11f675[_0x74e7('0x20')],function(_0x18f1c1){return{'model':db[_0x18f1c1[_0x74e7('0x21')]],'as':_0x18f1c1['as'],'attributes':_0x18f1c1[_0x74e7('0x22')],'include':_0x18f1c1[_0x74e7('0x20')]?_['map'](_0x18f1c1[_0x74e7('0x20')],function(_0x34ea29){return{'model':db[_0x34ea29[_0x74e7('0x21')]],'as':_0x34ea29['as'],'attributes':_0x34ea29[_0x74e7('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30d9b9){logger[_0x74e7('0x17')](_0x74e7('0x1a'),_0x46d63d);logger[_0x74e7('0x11')](_0x74e7('0x1a'),_0x46d63d,JSON['stringify'](_0x30d9b9));_0x301408(_0x30d9b9);})['catch'](function(_0x219df7){logger['error'](_0x74e7('0x1a'),_0x219df7[_0x74e7('0x16')],_0x46d63d);_0x1d532b(_0x158dac[_0x74e7('0x14')](0x1f4,_0x219df7[_0x74e7('0x16')]));});});};exports['UpdateCmHopperBlack']=function(_0x38fa2c){var _0x1ae4ee=this;return new Promise(function(_0xa9a351,_0x10f634){return db[_0x74e7('0x1b')][_0x74e7('0x23')](_0x38fa2c['body'],{'raw':_0x38fa2c[_0x74e7('0x1d')]?_0x38fa2c[_0x74e7('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38fa2c[_0x74e7('0x1d')]?_0x38fa2c[_0x74e7('0x1d')]['where']||null:null,'attributes':_0x38fa2c[_0x74e7('0x1d')]?_0x38fa2c[_0x74e7('0x1d')][_0x74e7('0x22')]||null:null,'limit':_0x38fa2c[_0x74e7('0x1d')]?_0x38fa2c[_0x74e7('0x1d')][_0x74e7('0x1e')]||null:null})['then'](function(_0x23fb9c){logger[_0x74e7('0x17')](_0x74e7('0x24'),_0x38fa2c);logger[_0x74e7('0x11')](_0x74e7('0x24'),_0x38fa2c,JSON[_0x74e7('0x13')](_0x23fb9c));_0xa9a351(_0x23fb9c);})[_0x74e7('0x19')](function(_0x550198){logger[_0x74e7('0x14')](_0x74e7('0x24'),_0x550198[_0x74e7('0x16')],_0x38fa2c);_0x10f634(_0x1ae4ee[_0x74e7('0x14')](0x1f4,_0x550198[_0x74e7('0x16')]));});});};exports[_0x74e7('0x25')]=function(_0x3724d9){var _0x2325ff=this;return new Promise(function(_0xd5b3de,_0x5118f1){return db['CmHopperBlack'][_0x74e7('0x26')]({'where':_0x3724d9[_0x74e7('0x1d')]?_0x3724d9[_0x74e7('0x1d')][_0x74e7('0x27')]||null:null})['then'](function(_0x5ad2f5){logger['info'](_0x74e7('0x25'),_0x3724d9);logger[_0x74e7('0x11')](_0x74e7('0x25'),_0x3724d9,JSON['stringify'](_0x5ad2f5));_0xd5b3de(_0x5ad2f5);})[_0x74e7('0x19')](function(_0x4d6817){logger[_0x74e7('0x14')](_0x74e7('0x25'),_0x4d6817[_0x74e7('0x16')],_0x3724d9);_0x5118f1(_0x2325ff[_0x74e7('0x14')](0x1f4,_0x4d6817[_0x74e7('0x16')]));});});}; \ No newline at end of file +var _0xc4fa=['include','model','stringify','UpdateCmHopperBlack','update','raw','limit','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','where','attributes','map'];(function(_0xc66583,_0x404ee3){var _0x580314=function(_0x5e2849){while(--_0x5e2849){_0xc66583['push'](_0xc66583['shift']());}};_0x580314(++_0x404ee3);}(_0xc4fa,0x1e9));var _0xac4f=function(_0x3e10b0,_0x4544e3){_0x3e10b0=_0x3e10b0-0x0;var _0x14b94d=_0xc4fa[_0x3e10b0];return _0x14b94d;};'use strict';var _=require(_0xac4f('0x0'));var util=require(_0xac4f('0x1'));var moment=require(_0xac4f('0x2'));var BPromise=require(_0xac4f('0x3'));var rs=require(_0xac4f('0x4'));var fs=require('fs');var Redis=require(_0xac4f('0x5'));var db=require(_0xac4f('0x6'))['db'];var utils=require(_0xac4f('0x7'));var logger=require(_0xac4f('0x8'))(_0xac4f('0x9'));var config=require(_0xac4f('0xa'));var jayson=require(_0xac4f('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5619cc,_0xec903c,_0x3a15df){return new BPromise(function(_0x4b8bf1,_0xd49ba4){return client[_0xac4f('0xc')](_0x5619cc,_0x3a15df)[_0xac4f('0xd')](function(_0x14dc37){logger[_0xac4f('0xe')](_0xac4f('0xf'),_0xec903c,'request\x20sent');logger[_0xac4f('0x10')](_0xac4f('0x11'),_0xec903c,_0xac4f('0x12'),JSON['stringify'](_0x14dc37));if(_0x14dc37[_0xac4f('0x13')]){if(_0x14dc37['error'][_0xac4f('0x14')]===0x1f4){logger[_0xac4f('0x13')](_0xac4f('0xf'),_0xec903c,_0x14dc37[_0xac4f('0x13')][_0xac4f('0x15')]);return _0xd49ba4(_0x14dc37[_0xac4f('0x13')][_0xac4f('0x15')]);}logger[_0xac4f('0x13')](_0xac4f('0xf'),_0xec903c,_0x14dc37[_0xac4f('0x13')][_0xac4f('0x15')]);return _0x4b8bf1(_0x14dc37['error'][_0xac4f('0x15')]);}else{logger[_0xac4f('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0xec903c,_0xac4f('0x12'));_0x4b8bf1(_0x14dc37[_0xac4f('0x16')][_0xac4f('0x15')]);}})[_0xac4f('0x17')](function(_0x52bd3b){logger['error'](_0xac4f('0xf'),_0xec903c,_0x52bd3b);_0xd49ba4(_0x52bd3b);});});}exports[_0xac4f('0x18')]=function(_0x21a69e){var _0x442f9d=this;return new Promise(function(_0x76f54a,_0x3a89bc){return db[_0xac4f('0x19')][_0xac4f('0x1a')]({'raw':_0x21a69e[_0xac4f('0x1b')]?_0x21a69e[_0xac4f('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x21a69e[_0xac4f('0x1b')]?_0x21a69e[_0xac4f('0x1b')][_0xac4f('0x1c')]||null:null,'attributes':_0x21a69e[_0xac4f('0x1b')]?_0x21a69e[_0xac4f('0x1b')][_0xac4f('0x1d')]||null:null,'limit':_0x21a69e[_0xac4f('0x1b')]?_0x21a69e['options']['limit']||null:null,'include':_0x21a69e[_0xac4f('0x1b')]?_0x21a69e[_0xac4f('0x1b')]['include']?_[_0xac4f('0x1e')](_0x21a69e[_0xac4f('0x1b')][_0xac4f('0x1f')],function(_0x57f9cc){return{'model':db[_0x57f9cc[_0xac4f('0x20')]],'as':_0x57f9cc['as'],'attributes':_0x57f9cc[_0xac4f('0x1d')],'include':_0x57f9cc[_0xac4f('0x1f')]?_[_0xac4f('0x1e')](_0x57f9cc['include'],function(_0x3d1dd8){return{'model':db[_0x3d1dd8[_0xac4f('0x20')]],'as':_0x3d1dd8['as'],'attributes':_0x3d1dd8[_0xac4f('0x1d')],'include':_0x3d1dd8[_0xac4f('0x1f')]?_[_0xac4f('0x1e')](_0x3d1dd8[_0xac4f('0x1f')],function(_0x4bec77){return{'model':db[_0x4bec77[_0xac4f('0x20')]],'as':_0x4bec77['as'],'attributes':_0x4bec77[_0xac4f('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f0f08){logger['info'](_0xac4f('0x18'),_0x21a69e);logger[_0xac4f('0x10')](_0xac4f('0x18'),_0x21a69e,JSON[_0xac4f('0x21')](_0x5f0f08));_0x76f54a(_0x5f0f08);})[_0xac4f('0x17')](function(_0x2c924d){logger[_0xac4f('0x13')](_0xac4f('0x18'),_0x2c924d[_0xac4f('0x15')],_0x21a69e);_0x3a89bc(_0x442f9d[_0xac4f('0x13')](0x1f4,_0x2c924d[_0xac4f('0x15')]));});});};exports[_0xac4f('0x22')]=function(_0x474dc4){var _0x6ab344=this;return new Promise(function(_0x321ad5,_0x29a70b){return db[_0xac4f('0x19')][_0xac4f('0x23')](_0x474dc4['body'],{'raw':_0x474dc4[_0xac4f('0x1b')]?_0x474dc4[_0xac4f('0x1b')][_0xac4f('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x474dc4['options']?_0x474dc4[_0xac4f('0x1b')][_0xac4f('0x1c')]||null:null,'attributes':_0x474dc4[_0xac4f('0x1b')]?_0x474dc4[_0xac4f('0x1b')][_0xac4f('0x1d')]||null:null,'limit':_0x474dc4[_0xac4f('0x1b')]?_0x474dc4[_0xac4f('0x1b')][_0xac4f('0x25')]||null:null})[_0xac4f('0xd')](function(_0x3911f3){logger['info'](_0xac4f('0x22'),_0x474dc4);logger[_0xac4f('0x10')](_0xac4f('0x22'),_0x474dc4,JSON[_0xac4f('0x21')](_0x3911f3));_0x321ad5(_0x3911f3);})[_0xac4f('0x17')](function(_0x57e7fa){logger[_0xac4f('0x13')](_0xac4f('0x22'),_0x57e7fa[_0xac4f('0x15')],_0x474dc4);_0x29a70b(_0x6ab344['error'](0x1f4,_0x57e7fa['message']));});});};exports[_0xac4f('0x26')]=function(_0x2a8299){var _0x476678=this;return new Promise(function(_0x3e1e0e,_0x34eb00){return db[_0xac4f('0x19')][_0xac4f('0x27')]({'where':_0x2a8299[_0xac4f('0x1b')]?_0x2a8299[_0xac4f('0x1b')][_0xac4f('0x1c')]||null:null})[_0xac4f('0xd')](function(_0x4c135c){logger['info'](_0xac4f('0x26'),_0x2a8299);logger[_0xac4f('0x10')](_0xac4f('0x26'),_0x2a8299,JSON['stringify'](_0x4c135c));_0x3e1e0e(_0x4c135c);})['catch'](function(_0x1599b3){logger['error'](_0xac4f('0x26'),_0x1599b3['message'],_0x2a8299);_0x34eb00(_0x476678[_0xac4f('0x13')](0x1f4,_0x1599b3[_0xac4f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 827ab4f..2ccb218 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 _0xe2fe=['/describe','describe','/:id','put','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x29771f,_0x1189ae){var _0x279baf=function(_0xd66325){while(--_0xd66325){_0x29771f['push'](_0x29771f['shift']());}};_0x279baf(++_0x1189ae);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./cmHopperBlack.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0xc')](_0xee2f('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xee2f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x32f4=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','/describe','show','put','/:id','delete','exports'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x32f4,0x154));var _0x432f=function(_0x1749a1,_0x490f8d){_0x1749a1=_0x1749a1-0x0;var _0x34b7a3=_0x32f4[_0x1749a1];return _0x34b7a3;};'use strict';var multer=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var path=require(_0x432f('0x2'));var timeout=require(_0x432f('0x3'));var express=require('express');var router=express[_0x432f('0x4')]();var fs_extra=require(_0x432f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x432f('0x6'));var config=require(_0x432f('0x7'));var controller=require(_0x432f('0x8'));router[_0x432f('0x9')]('/',auth[_0x432f('0xa')](),controller['index']);router['get'](_0x432f('0xb'),auth[_0x432f('0xa')](),controller['describe']);router[_0x432f('0x9')]('/:id',auth[_0x432f('0xa')](),controller[_0x432f('0xc')]);router[_0x432f('0xd')](_0x432f('0xe'),auth[_0x432f('0xa')](),controller['update']);router[_0x432f('0xf')]('/:id',auth[_0x432f('0xa')](),controller['destroy']);module[_0x432f('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 32f0c29..259ccea 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 _0xc0e3=['seconds','BOOLEAN','sequelize','moment','exports','STRING','DATE','INTEGER','endtime','diff'];(function(_0xee3051,_0xbe4f18){var _0x139e81=function(_0xac81c3){while(--_0xac81c3){_0xee3051['push'](_0xee3051['shift']());}};_0x139e81(++_0xbe4f18);}(_0xc0e3,0x16a));var _0x3c0e=function(_0x26a84c,_0x5724a7){_0x26a84c=_0x26a84c-0x0;var _0xa7793f=_0xc0e3[_0x26a84c];return _0xa7793f;};'use strict';var Sequelize=require(_0x3c0e('0x0'));var moment=require(_0x3c0e('0x1'));module[_0x3c0e('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x3c0e('0x3')]},'scheduledat':{'type':Sequelize[_0x3c0e('0x4')]},'countbusyretry':{'type':Sequelize[_0x3c0e('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3c0e('0x5')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x3c0e('0x5')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x3c0e('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x3c0e('0x3')]},'calleridname':{'type':Sequelize[_0x3c0e('0x3')]},'starttime':{'type':Sequelize[_0x3c0e('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x3c0e('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x3c0e('0x5')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x3c0e('0x5')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x3c0e('0x5')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x3c0e('0x5')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x3c0e('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x3c0e('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x3c0e('0x3')]},'disposition':{'type':Sequelize[_0x3c0e('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x3c0e('0x3')]},'dispositionat':{'type':Sequelize[_0x3c0e('0x4')],'set':function(_0x12d3ac){var _0x12bf63=this['getDataValue'](_0x3c0e('0x6'));if(_0x12bf63&&_0x12d3ac){this['setDataValue']('followuptime',moment(_0x12d3ac)[_0x3c0e('0x7')](moment(_0x12bf63),_0x3c0e('0x8')));}}},'amd':{'type':Sequelize[_0x3c0e('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x3c0e('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x3c0e('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3c0e('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x3c0e('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x3c0e('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x3c0e('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3c0e('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3c0e('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3c0e('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7e6d=['STRING','INTEGER','DATE','endtime','followuptime','diff','seconds','BOOLEAN','moment','exports'];(function(_0x2c1ce8,_0x26cd41){var _0xd488fc=function(_0x2029f1){while(--_0x2029f1){_0x2c1ce8['push'](_0x2c1ce8['shift']());}};_0xd488fc(++_0x26cd41);}(_0x7e6d,0x1de));var _0xd7e6=function(_0x2a1b92,_0x79122d){_0x2a1b92=_0x2a1b92-0x0;var _0x5f5bc1=_0x7e6d[_0x2a1b92];return _0x5f5bc1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd7e6('0x0'));module[_0xd7e6('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xd7e6('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xd7e6('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd7e6('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd7e6('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd7e6('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xd7e6('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd7e6('0x2')]},'calleridname':{'type':Sequelize[_0xd7e6('0x2')]},'starttime':{'type':Sequelize[_0xd7e6('0x4')]},'responsetime':{'type':Sequelize[_0xd7e6('0x4')]},'answertime':{'type':Sequelize[_0xd7e6('0x4')]},'droptime':{'type':Sequelize[_0xd7e6('0x4')]},'endtime':{'type':Sequelize[_0xd7e6('0x4')]},'ringtime':{'type':Sequelize[_0xd7e6('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xd7e6('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd7e6('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xd7e6('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd7e6('0x2')]},'campaign':{'type':Sequelize[_0xd7e6('0x2')]},'campaigntype':{'type':Sequelize[_0xd7e6('0x2')]},'membername':{'type':Sequelize[_0xd7e6('0x2')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xd7e6('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xd7e6('0x4')],'set':function(_0x5e1ddc){var _0x4d04b8=this['getDataValue'](_0xd7e6('0x5'));if(_0x4d04b8&&_0x5e1ddc){this['setDataValue'](_0xd7e6('0x6'),moment(_0x5e1ddc)[_0xd7e6('0x7')](moment(_0x4d04b8),_0xd7e6('0x8')));}}},'amd':{'type':Sequelize[_0xd7e6('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0xd7e6('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xd7e6('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xd7e6('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xd7e6('0x4')]},'callback':{'type':Sequelize[_0xd7e6('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd7e6('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd7e6('0x4')]},'deleted':{'type':Sequelize[_0xd7e6('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xd7e6('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xd7e6('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd7e6('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd7e6('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd7e6('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 347b37e..918aa99 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 _0x71ab=['json','offset','undefined','limit','count','set','reject','update','then','destroy','error','stack','name','send','index','map','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','CmHopperFinal','findAll','rows','catch','show','params','rawAttributes','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','`state`\x20=\x203,\x201,\x20null','dropContacts','VoiceQueue','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','VoiceQueueId','from','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','state','CampaignId\x20=\x20?','calleridnum','checkContactHopper','CmHopper','findOne','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x2f1214,_0x467ad0){var _0x14f9ba=function(_0x2bcacd){while(--_0x2bcacd){_0x2f1214['push'](_0x2f1214['shift']());}};_0x14f9ba(++_0x467ad0);}(_0x71ab,0x64));var _0xb71a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x71ab[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb71a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb71a('0x1'));var rp=require('request-promise');var moment=require(_0xb71a('0x2'));var BPromise=require(_0xb71a('0x3'));var Mustache=require(_0xb71a('0x4'));var util=require(_0xb71a('0x5'));var path=require(_0xb71a('0x6'));var sox=require(_0xb71a('0x7'));var csv=require(_0xb71a('0x8'));var ejs=require(_0xb71a('0x9'));var fs=require('fs');var fs_extra=require(_0xb71a('0xa'));var _=require(_0xb71a('0xb'));var squel=require(_0xb71a('0xc'));var crypto=require(_0xb71a('0xd'));var jsforce=require(_0xb71a('0xe'));var deskjs=require(_0xb71a('0xf'));var toCsv=require(_0xb71a('0x8'));var querystring=require(_0xb71a('0x10'));var Papa=require(_0xb71a('0x11'));var Redis=require(_0xb71a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb71a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb71a('0x14'));var logger=require(_0xb71a('0x15'))(_0xb71a('0x16'));var utils=require('../../config/utils');var config=require(_0xb71a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb71a('0x18'))['db'];function respondWithStatusCode(_0x50030d,_0x50b43b){_0x50b43b=_0x50b43b||0xcc;return function(_0x3346a5){if(_0x3346a5){return _0x50030d[_0xb71a('0x19')](_0x50b43b);}return _0x50030d[_0xb71a('0x1a')](_0x50b43b)[_0xb71a('0x1b')]();};}function respondWithResult(_0x483d77,_0x47ee48){_0x47ee48=_0x47ee48||0xc8;return function(_0x5364e3){if(_0x5364e3){return _0x483d77[_0xb71a('0x1a')](_0x47ee48)[_0xb71a('0x1c')](_0x5364e3);}};}function respondWithFilteredResult(_0x15252a,_0x42fc55){return function(_0x3cd0f0){if(_0x3cd0f0){var _0x1e9363=typeof _0x42fc55[_0xb71a('0x1d')]===_0xb71a('0x1e')&&typeof _0x42fc55[_0xb71a('0x1f')]==='undefined';var _0x1ca65e=_0x3cd0f0[_0xb71a('0x20')];var _0x374c8c=_0x1e9363?0x0:_0x42fc55[_0xb71a('0x1d')];var _0x2bdb61=_0x1e9363?_0x3cd0f0[_0xb71a('0x20')]:_0x42fc55[_0xb71a('0x1d')]+_0x42fc55[_0xb71a('0x1f')];var _0x20bdfe;if(_0x2bdb61>=_0x1ca65e){_0x2bdb61=_0x1ca65e;_0x20bdfe=0xc8;}else{_0x20bdfe=0xce;}_0x15252a[_0xb71a('0x1a')](_0x20bdfe);return _0x15252a[_0xb71a('0x21')]('Content-Range',_0x374c8c+'-'+_0x2bdb61+'/'+_0x1ca65e)['json'](_0x3cd0f0);}return null;};}function patchUpdates(_0x1358f2){return function(_0x578fe4){try{jsonpatch['apply'](_0x578fe4,_0x1358f2,!![]);}catch(_0x4d8871){return BPromise[_0xb71a('0x22')](_0x4d8871);}return _0x578fe4['save']();};}function saveUpdates(_0x76d6dc,_0x4227c7){return function(_0x3ac77b){if(_0x3ac77b){return _0x3ac77b[_0xb71a('0x23')](_0x76d6dc)[_0xb71a('0x24')](function(_0x14b2a1){return _0x14b2a1;});}return null;};}function removeEntity(_0x2f4fac,_0x14aac7){return function(_0x5f3f19){if(_0x5f3f19){return _0x5f3f19[_0xb71a('0x25')]()[_0xb71a('0x24')](function(){_0x2f4fac[_0xb71a('0x1a')](0xcc)[_0xb71a('0x1b')]();});}};}function handleEntityNotFound(_0x3401f7,_0x1a010d){return function(_0x20ed75){if(!_0x20ed75){_0x3401f7[_0xb71a('0x19')](0x194);}return _0x20ed75;};}function handleError(_0x31085b,_0x2a847a){_0x2a847a=_0x2a847a||0x1f4;return function(_0x45b849){logger[_0xb71a('0x26')](_0x45b849[_0xb71a('0x27')]);if(_0x45b849['name']){delete _0x45b849[_0xb71a('0x28')];}_0x31085b[_0xb71a('0x1a')](_0x2a847a)[_0xb71a('0x29')](_0x45b849);};}exports[_0xb71a('0x2a')]=function(_0x2fbd73,_0x38178c){var _0x44826e={},_0x25364c={},_0x42c086={'count':0x0,'rows':[]};var _0x421fcf=_[_0xb71a('0x2b')](db['CmHopperFinal']['rawAttributes'],function(_0x3112d3){return{'name':_0x3112d3['fieldName'],'type':_0x3112d3[_0xb71a('0x2c')][_0xb71a('0x2d')]};});_0x25364c['model']=_[_0xb71a('0x2b')](_0x421fcf,_0xb71a('0x28'));_0x25364c[_0xb71a('0x2e')]=_[_0xb71a('0x2f')](_0x2fbd73[_0xb71a('0x2e')]);_0x25364c[_0xb71a('0x30')]=_['intersection'](_0x25364c[_0xb71a('0x31')],_0x25364c[_0xb71a('0x2e')]);_0x44826e[_0xb71a('0x32')]=_[_0xb71a('0x33')](_0x25364c['model'],qs[_0xb71a('0x34')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x34')]));_0x44826e[_0xb71a('0x32')]=_0x44826e[_0xb71a('0x32')][_0xb71a('0x35')]?_0x44826e[_0xb71a('0x32')]:_0x25364c[_0xb71a('0x31')];if(!_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x36')]('nolimit')){_0x44826e['limit']=qs[_0xb71a('0x1f')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x1f')]);_0x44826e[_0xb71a('0x1d')]=qs[_0xb71a('0x1d')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x1d')]);}_0x44826e['order']=qs[_0xb71a('0x37')](_0x2fbd73['query'][_0xb71a('0x37')]);_0x44826e[_0xb71a('0x38')]=qs[_0xb71a('0x30')](_[_0xb71a('0x39')](_0x2fbd73['query'],_0x25364c[_0xb71a('0x30')]),_0x421fcf);if(_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3a')]){_0x44826e[_0xb71a('0x38')]=_[_0xb71a('0x3b')](_0x44826e[_0xb71a('0x38')],{'$or':_[_0xb71a('0x2b')](_0x421fcf,function(_0x2756b9){if(_0x2756b9[_0xb71a('0x2c')]!=='VIRTUAL'){var _0x24a3af={};_0x24a3af[_0x2756b9['name']]={'$like':'%'+_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3a')]+'%'};return _0x24a3af;}})});}_0x44826e=_[_0xb71a('0x3b')]({},_0x44826e,_0x2fbd73[_0xb71a('0x3c')]);var _0xce7b8a={'where':_0x44826e[_0xb71a('0x38')]};return db['CmHopperFinal']['count'](_0xce7b8a)['then'](function(_0x35fea9){_0x42c086['count']=_0x35fea9;if(_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3d')]){_0x44826e[_0xb71a('0x3e')]=[{'all':!![]}];}return db[_0xb71a('0x3f')][_0xb71a('0x40')](_0x44826e);})[_0xb71a('0x24')](function(_0x59530a){_0x42c086[_0xb71a('0x41')]=_0x59530a;return _0x42c086;})[_0xb71a('0x24')](respondWithFilteredResult(_0x38178c,_0x44826e))[_0xb71a('0x42')](handleError(_0x38178c,null));};exports[_0xb71a('0x43')]=function(_0x7d305,_0x2f08d2){var _0x55cbca={'raw':!![],'where':{'id':_0x7d305[_0xb71a('0x44')]['id']}},_0x2afff3={};_0x2afff3[_0xb71a('0x31')]=_[_0xb71a('0x2f')](db[_0xb71a('0x3f')][_0xb71a('0x45')]);_0x2afff3[_0xb71a('0x2e')]=_['keys'](_0x7d305['query']);_0x2afff3[_0xb71a('0x30')]=_[_0xb71a('0x33')](_0x2afff3[_0xb71a('0x31')],_0x2afff3[_0xb71a('0x2e')]);_0x55cbca['attributes']=_[_0xb71a('0x33')](_0x2afff3['model'],qs[_0xb71a('0x34')](_0x7d305[_0xb71a('0x2e')]['fields']));_0x55cbca[_0xb71a('0x32')]=_0x55cbca[_0xb71a('0x32')][_0xb71a('0x35')]?_0x55cbca[_0xb71a('0x32')]:_0x2afff3['model'];if(_0x7d305[_0xb71a('0x2e')][_0xb71a('0x3d')]){_0x55cbca[_0xb71a('0x3e')]=[{'all':!![]}];}_0x55cbca=_['merge']({},_0x55cbca,_0x7d305[_0xb71a('0x3c')]);return db[_0xb71a('0x3f')][_0xb71a('0x46')](_0x55cbca)['then'](handleEntityNotFound(_0x2f08d2,null))[_0xb71a('0x24')](respondWithResult(_0x2f08d2,null))[_0xb71a('0x42')](handleError(_0x2f08d2,null));};exports[_0xb71a('0x47')]=function(_0x1f29b7,_0x365bed){return db['CmHopperFinal'][_0xb71a('0x47')]()[_0xb71a('0x24')](respondWithResult(_0x365bed,null))[_0xb71a('0x42')](handleError(_0x365bed,null));};exports[_0xb71a('0x23')]=function(_0x489c1f,_0x48fbde){if(_0x489c1f[_0xb71a('0x48')][_0xb71a('0x49')]){delete _0x489c1f[_0xb71a('0x48')][_0xb71a('0x49')];}return db[_0xb71a('0x3f')][_0xb71a('0x46')]({'where':{'uniqueid':_0x489c1f[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x48fbde,null))[_0xb71a('0x24')](saveUpdates(_0x489c1f[_0xb71a('0x48')],null))['then'](respondWithResult(_0x48fbde,null))[_0xb71a('0x42')](handleError(_0x48fbde,null));};exports[_0xb71a('0x4a')]=function(_0x500196,_0x1c0536,_0x58116c){return db[_0xb71a('0x3f')][_0xb71a('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x500196[_0xb71a('0x44')]['id']},'attributes':[[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db[_0xb71a('0x4b')]['literal'](_0xb71a('0x4d')))),_0xb71a('0x4e')],[db['sequelize']['fn']('COUNT',db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')]['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0xb71a('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb71a('0x4b')][_0xb71a('0x4f')](_0xb71a('0x50')))),_0xb71a('0x51')],[db['sequelize']['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')]['literal'](_0xb71a('0x52')))),_0xb71a('0x53')],[db['sequelize']['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')]['literal'](_0xb71a('0x54')))),'dropContacts'],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db[_0xb71a('0x4b')][_0xb71a('0x4f')](_0xb71a('0x55')))),_0xb71a('0x56')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize']['literal'](_0xb71a('0x57')))),_0xb71a('0x58')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize']['literal'](_0xb71a('0x59')))),_0xb71a('0x5a')]]})['then'](handleEntityNotFound(_0x1c0536,null))[_0xb71a('0x24')](respondWithResult(_0x1c0536,null))[_0xb71a('0x42')](handleError(_0x1c0536,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x181a9f,_0xe55672,_0x38de3a){return db[_0xb71a('0x3f')]['findAll']({'raw':![],'where':{'CampaignId':_0x181a9f[_0xb71a('0x44')]['id']},'attributes':[[db[_0xb71a('0x4b')]['fn']('COUNT',db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')][_0xb71a('0x4f')](_0xb71a('0x4d')))),_0xb71a('0x4e')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize'][_0xb71a('0x4f')](_0xb71a('0x5b')))),'noAnswerContacts'],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db[_0xb71a('0x4b')][_0xb71a('0x4f')](_0xb71a('0x50')))),_0xb71a('0x51')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0xb71a('0x4f')](_0xb71a('0x52')))),_0xb71a('0x53')],[db['sequelize']['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db[_0xb71a('0x4b')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xb71a('0x5c')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')]['literal'](_0xb71a('0x55')))),'abandonedContacts'],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize']['literal'](_0xb71a('0x57')))),_0xb71a('0x58')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize'][_0xb71a('0x4f')](_0xb71a('0x59')))),_0xb71a('0x5a')]]})[_0xb71a('0x24')](handleEntityNotFound(_0xe55672,null))[_0xb71a('0x24')](respondWithResult(_0xe55672,null))['catch'](handleError(_0xe55672,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x15b8be,_0x2dd470,_0x38a8a1){return db[_0xb71a('0x5d')][_0xb71a('0x46')]({'where':{'id':_0x15b8be[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x2dd470,null))['then'](function(_0x45f4b2){var _0x27c15e;if(_0x45f4b2){_0x27c15e=squel['insert']()[_0xb71a('0x5e')](_0xb71a('0x5f'))[_0xb71a('0x60')](['phone',_0xb71a('0x61'),_0xb71a('0x62'),_0xb71a('0x63'),'VoiceQueueId',_0xb71a('0x64'),_0xb71a('0x65')],squel[_0xb71a('0x66')]()[_0xb71a('0x67')](_0xb71a('0x68'),_0xb71a('0x69'))[_0xb71a('0x67')](_0xb71a('0x6a'),'scheduledAt')[_0xb71a('0x67')](_0xb71a('0x6b'),_0xb71a('0x62'))[_0xb71a('0x67')](_0xb71a('0x6c'),_0xb71a('0x63'))[_0xb71a('0x67')]('ANY_VALUE(VoiceQueueId)',_0xb71a('0x6d'))['field'](_0xb71a('0x6a'),_0xb71a('0x64'))['field'](_0xb71a('0x6a'),'updatedAt')[_0xb71a('0x6e')]('cm_hopper_final')[_0xb71a('0x38')](_0xb71a('0x6f'),_0x15b8be[_0xb71a('0x44')]['id'][_0xb71a('0x70')]())['where'](_0xb71a('0x71'),_0x15b8be[_0xb71a('0x48')]['state'][_0xb71a('0x70')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xb71a('0x66')]()[_0xb71a('0x67')](_0xb71a('0x69'))['from'](_0xb71a('0x5f'))[_0xb71a('0x38')]('VoiceQueueId\x20=\x20?',_0x15b8be[_0xb71a('0x44')]['id'][_0xb71a('0x70')]()))[_0xb71a('0x38')](_0xb71a('0x72'),squel[_0xb71a('0x66')]()[_0xb71a('0x67')]('calleridnum')[_0xb71a('0x6e')](_0xb71a('0x73'))[_0xb71a('0x38')](_0xb71a('0x6f'),_0x15b8be[_0xb71a('0x44')]['id'][_0xb71a('0x70')]())['where'](_0xb71a('0x74')))[_0xb71a('0x75')]('ContactId'))[_0xb71a('0x70')]();return db[_0xb71a('0x4b')][_0xb71a('0x2e')](_0x27c15e);}return[];})['then'](respondWithResult(_0x2dd470,null))[_0xb71a('0x42')](handleError(_0x2dd470,null));};exports[_0xb71a('0x76')]=function(_0x28bc74,_0x575a0a,_0x1a658e){return db[_0xb71a('0x77')]['find']({'where':{'id':_0x28bc74[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x575a0a,null))[_0xb71a('0x24')](function(_0x21b9b5){var _0x4abfd6;if(_0x21b9b5){_0x4abfd6=squel[_0xb71a('0x78')]()[_0xb71a('0x5e')](_0xb71a('0x5f'))[_0xb71a('0x60')](['phone',_0xb71a('0x61'),_0xb71a('0x62'),'ListId',_0xb71a('0x79'),_0xb71a('0x64'),'updatedAt'],squel[_0xb71a('0x66')]()[_0xb71a('0x67')](_0xb71a('0x68'),'phone')[_0xb71a('0x67')](_0xb71a('0x6a'),_0xb71a('0x61'))[_0xb71a('0x67')](_0xb71a('0x6b'),_0xb71a('0x62'))[_0xb71a('0x67')](_0xb71a('0x6c'),_0xb71a('0x63'))['field']('ANY_VALUE(CampaignId)',_0xb71a('0x79'))[_0xb71a('0x67')](_0xb71a('0x6a'),_0xb71a('0x64'))[_0xb71a('0x67')](_0xb71a('0x6a'),'updatedAt')[_0xb71a('0x6e')]('cm_hopper_final')[_0xb71a('0x38')]('CampaignId\x20=\x20?',_0x28bc74[_0xb71a('0x44')]['id'][_0xb71a('0x70')]())['where'](_0xb71a('0x71'),_0x28bc74[_0xb71a('0x48')][_0xb71a('0x7a')][_0xb71a('0x70')]())[_0xb71a('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xb71a('0x38')](_0xb71a('0x72'),squel['select']()[_0xb71a('0x67')](_0xb71a('0x69'))['from'](_0xb71a('0x5f'))[_0xb71a('0x38')](_0xb71a('0x7b'),_0x28bc74['params']['id'][_0xb71a('0x70')]()))[_0xb71a('0x38')](_0xb71a('0x72'),squel['select']()[_0xb71a('0x67')](_0xb71a('0x7c'))[_0xb71a('0x6e')](_0xb71a('0x73'))[_0xb71a('0x38')]('CampaignId\x20=\x20?',_0x28bc74[_0xb71a('0x44')]['id']['toString']())[_0xb71a('0x38')](_0xb71a('0x74')))[_0xb71a('0x75')]('ContactId'))['toString']();return db[_0xb71a('0x4b')][_0xb71a('0x2e')](_0x4abfd6);}return[];})[_0xb71a('0x24')](respondWithResult(_0x575a0a,null))[_0xb71a('0x42')](handleError(_0x575a0a,null));};exports[_0xb71a('0x7d')]=function(_0x18dfb3,_0x38ffc1,_0x442ec0){return db[_0xb71a('0x7e')][_0xb71a('0x7f')]({'where':{'VoiceQueueId':_0x18dfb3[_0xb71a('0x48')][_0xb71a('0x6d')],'CampaignId':_0x18dfb3[_0xb71a('0x48')][_0xb71a('0x79')],'ContactId':_0x18dfb3[_0xb71a('0x48')]['ContactId']}})[_0xb71a('0x24')](handleEntityNotFound(_0x38ffc1,null))[_0xb71a('0x24')](function(_0x243c90){if(_0x243c90){return _0x243c90;}return null;})['then'](respondWithResult(_0x38ffc1,null))['catch'](handleError(_0x38ffc1,null));}; \ No newline at end of file +var _0x1623=['reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','dropContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','phone','scheduledAt','ListId','createdAt','select','ANY_VALUE(calleridnum)','field','NOW()','ContactId','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','from','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','VoiceQueueId\x20=\x20?','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','updatedAt','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','options','CmHopperFinal','findAll','rows','catch','show','params','length','find','describe','body','uniqueid','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts'];(function(_0xfe2fa1,_0x4ab94b){var _0x4270be=function(_0x28a1d4){while(--_0x28a1d4){_0xfe2fa1['push'](_0xfe2fa1['shift']());}};_0x4270be(++_0x4ab94b);}(_0x1623,0xab));var _0x3162=function(_0x590238,_0x1351b7){_0x590238=_0x590238-0x0;var _0x35766f=_0x1623[_0x590238];return _0x35766f;};'use strict';var emlformat=require(_0x3162('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3162('0x1'));var rp=require(_0x3162('0x2'));var moment=require(_0x3162('0x3'));var BPromise=require(_0x3162('0x4'));var Mustache=require(_0x3162('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3162('0x6'));var csv=require('to-csv');var ejs=require(_0x3162('0x7'));var fs=require('fs');var fs_extra=require(_0x3162('0x8'));var _=require('lodash');var squel=require(_0x3162('0x9'));var crypto=require(_0x3162('0xa'));var jsforce=require(_0x3162('0xb'));var deskjs=require(_0x3162('0xc'));var toCsv=require(_0x3162('0xd'));var querystring=require(_0x3162('0xe'));var Papa=require(_0x3162('0xf'));var Redis=require(_0x3162('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3162('0x11'));var hardwareService=require(_0x3162('0x12'));var logger=require(_0x3162('0x13'))(_0x3162('0x14'));var utils=require(_0x3162('0x15'));var config=require(_0x3162('0x16'));var licenseUtil=require(_0x3162('0x17'));var db=require(_0x3162('0x18'))['db'];function respondWithStatusCode(_0x157ab8,_0x4c3625){_0x4c3625=_0x4c3625||0xcc;return function(_0x2d11c5){if(_0x2d11c5){return _0x157ab8['sendStatus'](_0x4c3625);}return _0x157ab8[_0x3162('0x19')](_0x4c3625)[_0x3162('0x1a')]();};}function respondWithResult(_0x49d1ad,_0x4a393a){_0x4a393a=_0x4a393a||0xc8;return function(_0x198764){if(_0x198764){return _0x49d1ad[_0x3162('0x19')](_0x4a393a)[_0x3162('0x1b')](_0x198764);}};}function respondWithFilteredResult(_0x4b8a3b,_0x15e348){return function(_0x3d0bea){if(_0x3d0bea){var _0x2705d1=typeof _0x15e348['offset']===_0x3162('0x1c')&&typeof _0x15e348[_0x3162('0x1d')]===_0x3162('0x1c');var _0xc3ee06=_0x3d0bea[_0x3162('0x1e')];var _0x1eed46=_0x2705d1?0x0:_0x15e348[_0x3162('0x1f')];var _0x4b2bf3=_0x2705d1?_0x3d0bea[_0x3162('0x1e')]:_0x15e348[_0x3162('0x1f')]+_0x15e348[_0x3162('0x1d')];var _0x36ca97;if(_0x4b2bf3>=_0xc3ee06){_0x4b2bf3=_0xc3ee06;_0x36ca97=0xc8;}else{_0x36ca97=0xce;}_0x4b8a3b['status'](_0x36ca97);return _0x4b8a3b[_0x3162('0x20')]('Content-Range',_0x1eed46+'-'+_0x4b2bf3+'/'+_0xc3ee06)['json'](_0x3d0bea);}return null;};}function patchUpdates(_0xa5c62b){return function(_0x3e4d23){try{jsonpatch[_0x3162('0x21')](_0x3e4d23,_0xa5c62b,!![]);}catch(_0x523fab){return BPromise['reject'](_0x523fab);}return _0x3e4d23[_0x3162('0x22')]();};}function saveUpdates(_0x396372,_0x32c051){return function(_0x26c90d){if(_0x26c90d){return _0x26c90d[_0x3162('0x23')](_0x396372)[_0x3162('0x24')](function(_0x52ae25){return _0x52ae25;});}return null;};}function removeEntity(_0x1b2713,_0x5a4994){return function(_0xd283d6){if(_0xd283d6){return _0xd283d6[_0x3162('0x25')]()[_0x3162('0x24')](function(){_0x1b2713[_0x3162('0x19')](0xcc)[_0x3162('0x1a')]();});}};}function handleEntityNotFound(_0x3c543e,_0x30552f){return function(_0x5f8f7){if(!_0x5f8f7){_0x3c543e[_0x3162('0x26')](0x194);}return _0x5f8f7;};}function handleError(_0x356c5d,_0x8fa09f){_0x8fa09f=_0x8fa09f||0x1f4;return function(_0x2f62d7){logger[_0x3162('0x27')](_0x2f62d7['stack']);if(_0x2f62d7[_0x3162('0x28')]){delete _0x2f62d7['name'];}_0x356c5d[_0x3162('0x19')](_0x8fa09f)[_0x3162('0x29')](_0x2f62d7);};}exports[_0x3162('0x2a')]=function(_0x57f567,_0x4903e7){var _0xda0389={},_0xaa1f35={},_0x14df16={'count':0x0,'rows':[]};var _0x399148=_[_0x3162('0x2b')](db['CmHopperFinal'][_0x3162('0x2c')],function(_0x4e3cc2){return{'name':_0x4e3cc2[_0x3162('0x2d')],'type':_0x4e3cc2[_0x3162('0x2e')][_0x3162('0x2f')]};});_0xaa1f35[_0x3162('0x30')]=_[_0x3162('0x2b')](_0x399148,_0x3162('0x28'));_0xaa1f35[_0x3162('0x31')]=_[_0x3162('0x32')](_0x57f567['query']);_0xaa1f35[_0x3162('0x33')]=_[_0x3162('0x34')](_0xaa1f35['model'],_0xaa1f35[_0x3162('0x31')]);_0xda0389[_0x3162('0x35')]=_['intersection'](_0xaa1f35['model'],qs[_0x3162('0x36')](_0x57f567['query'][_0x3162('0x36')]));_0xda0389[_0x3162('0x35')]=_0xda0389[_0x3162('0x35')]['length']?_0xda0389['attributes']:_0xaa1f35[_0x3162('0x30')];if(!_0x57f567[_0x3162('0x31')]['hasOwnProperty'](_0x3162('0x37'))){_0xda0389['limit']=qs[_0x3162('0x1d')](_0x57f567[_0x3162('0x31')][_0x3162('0x1d')]);_0xda0389[_0x3162('0x1f')]=qs[_0x3162('0x1f')](_0x57f567[_0x3162('0x31')][_0x3162('0x1f')]);}_0xda0389[_0x3162('0x38')]=qs[_0x3162('0x39')](_0x57f567[_0x3162('0x31')][_0x3162('0x39')]);_0xda0389['where']=qs[_0x3162('0x33')](_[_0x3162('0x3a')](_0x57f567[_0x3162('0x31')],_0xaa1f35['filters']),_0x399148);if(_0x57f567['query'][_0x3162('0x3b')]){_0xda0389[_0x3162('0x3c')]=_[_0x3162('0x3d')](_0xda0389[_0x3162('0x3c')],{'$or':_['map'](_0x399148,function(_0x4186b6){if(_0x4186b6['type']!=='VIRTUAL'){var _0x5dee49={};_0x5dee49[_0x4186b6[_0x3162('0x28')]]={'$like':'%'+_0x57f567[_0x3162('0x31')][_0x3162('0x3b')]+'%'};return _0x5dee49;}})});}_0xda0389=_['merge']({},_0xda0389,_0x57f567[_0x3162('0x3e')]);var _0x2ce9c6={'where':_0xda0389[_0x3162('0x3c')]};return db[_0x3162('0x3f')][_0x3162('0x1e')](_0x2ce9c6)['then'](function(_0x5447d6){_0x14df16[_0x3162('0x1e')]=_0x5447d6;if(_0x57f567[_0x3162('0x31')]['includeAll']){_0xda0389['include']=[{'all':!![]}];}return db[_0x3162('0x3f')][_0x3162('0x40')](_0xda0389);})[_0x3162('0x24')](function(_0x4883ac){_0x14df16[_0x3162('0x41')]=_0x4883ac;return _0x14df16;})[_0x3162('0x24')](respondWithFilteredResult(_0x4903e7,_0xda0389))[_0x3162('0x42')](handleError(_0x4903e7,null));};exports[_0x3162('0x43')]=function(_0x534708,_0x2617d3){var _0x282e3e={'raw':!![],'where':{'id':_0x534708[_0x3162('0x44')]['id']}},_0x522cce={};_0x522cce[_0x3162('0x30')]=_['keys'](db[_0x3162('0x3f')][_0x3162('0x2c')]);_0x522cce['query']=_[_0x3162('0x32')](_0x534708['query']);_0x522cce[_0x3162('0x33')]=_[_0x3162('0x34')](_0x522cce[_0x3162('0x30')],_0x522cce[_0x3162('0x31')]);_0x282e3e[_0x3162('0x35')]=_[_0x3162('0x34')](_0x522cce['model'],qs[_0x3162('0x36')](_0x534708[_0x3162('0x31')][_0x3162('0x36')]));_0x282e3e['attributes']=_0x282e3e[_0x3162('0x35')][_0x3162('0x45')]?_0x282e3e['attributes']:_0x522cce[_0x3162('0x30')];if(_0x534708['query']['includeAll']){_0x282e3e['include']=[{'all':!![]}];}_0x282e3e=_[_0x3162('0x3d')]({},_0x282e3e,_0x534708[_0x3162('0x3e')]);return db[_0x3162('0x3f')][_0x3162('0x46')](_0x282e3e)[_0x3162('0x24')](handleEntityNotFound(_0x2617d3,null))[_0x3162('0x24')](respondWithResult(_0x2617d3,null))[_0x3162('0x42')](handleError(_0x2617d3,null));};exports[_0x3162('0x47')]=function(_0x3d2958,_0x28865c){return db[_0x3162('0x3f')][_0x3162('0x47')]()[_0x3162('0x24')](respondWithResult(_0x28865c,null))['catch'](handleError(_0x28865c,null));};exports[_0x3162('0x23')]=function(_0x48cb8f,_0x4f1dde){if(_0x48cb8f[_0x3162('0x48')][_0x3162('0x49')]){delete _0x48cb8f[_0x3162('0x48')][_0x3162('0x49')];}return db['CmHopperFinal'][_0x3162('0x46')]({'where':{'uniqueid':_0x48cb8f['params']['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x4f1dde,null))[_0x3162('0x24')](saveUpdates(_0x48cb8f['body'],null))[_0x3162('0x24')](respondWithResult(_0x4f1dde,null))['catch'](handleError(_0x4f1dde,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x13e7c4,_0x22c0a2,_0x160364){return db[_0x3162('0x3f')][_0x3162('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x13e7c4[_0x3162('0x44')]['id']},'attributes':[[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x3162('0x4c')))),_0x3162('0x4d')],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')]('`state`\x20=\x203,\x201,\x20null'))),_0x3162('0x4f')],[db['sequelize']['fn'](_0x3162('0x4b'),db['sequelize']['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x50')))),_0x3162('0x51')],[db['sequelize']['fn']('COUNT',db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x52')))),_0x3162('0x53')],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db['sequelize'][_0x3162('0x4e')](_0x3162('0x54')))),'dropContacts'],[db['sequelize']['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x55')))),_0x3162('0x56')],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db['sequelize']['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x3162('0x57')],[db['sequelize']['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x58')))),_0x3162('0x59')]]})[_0x3162('0x24')](handleEntityNotFound(_0x22c0a2,null))[_0x3162('0x24')](respondWithResult(_0x22c0a2,null))[_0x3162('0x42')](handleError(_0x22c0a2,null));};exports[_0x3162('0x5a')]=function(_0x4b5729,_0x4a42ea,_0x520b1a){return db[_0x3162('0x3f')]['findAll']({'raw':![],'where':{'CampaignId':_0x4b5729[_0x3162('0x44')]['id']},'attributes':[[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x3162('0x4d')],[db[_0x3162('0x4a')]['fn']('COUNT',db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x5b')))),_0x3162('0x4f')],[db['sequelize']['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x50')))),'busyContacts'],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x52')))),_0x3162('0x53')],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x54')))),_0x3162('0x5c')],[db[_0x3162('0x4a')]['fn']('COUNT',db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x55')))),'abandonedContacts'],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x5d')))),'reCallContacts'],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x58')))),'answeringMachine']]})[_0x3162('0x24')](handleEntityNotFound(_0x4a42ea,null))[_0x3162('0x24')](respondWithResult(_0x4a42ea,null))[_0x3162('0x42')](handleError(_0x4a42ea,null));};exports[_0x3162('0x5e')]=function(_0x8a75ca,_0x33c39d,_0xb3d824){return db['VoiceQueue']['find']({'where':{'id':_0x8a75ca['params']['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x33c39d,null))[_0x3162('0x24')](function(_0x59b3f7){var _0x129005;if(_0x59b3f7){_0x129005=squel[_0x3162('0x5f')]()[_0x3162('0x60')](_0x3162('0x61'))['fromQuery']([_0x3162('0x62'),_0x3162('0x63'),'ContactId',_0x3162('0x64'),'VoiceQueueId',_0x3162('0x65'),'updatedAt'],squel[_0x3162('0x66')]()['field'](_0x3162('0x67'),_0x3162('0x62'))[_0x3162('0x68')](_0x3162('0x69'),_0x3162('0x63'))[_0x3162('0x68')]('ANY_VALUE(ContactId)',_0x3162('0x6a'))[_0x3162('0x68')](_0x3162('0x6b'),'ListId')[_0x3162('0x68')](_0x3162('0x6c'),_0x3162('0x6d'))[_0x3162('0x68')](_0x3162('0x69'),'createdAt')[_0x3162('0x68')](_0x3162('0x69'),'updatedAt')['from'](_0x3162('0x6e'))[_0x3162('0x3c')]('VoiceQueueId\x20=\x20?',_0x8a75ca[_0x3162('0x44')]['id'][_0x3162('0x6f')]())[_0x3162('0x3c')](_0x3162('0x70'),_0x8a75ca[_0x3162('0x48')][_0x3162('0x71')][_0x3162('0x6f')]())[_0x3162('0x3c')](_0x3162('0x72'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x3162('0x66')]()[_0x3162('0x68')]('phone')[_0x3162('0x73')]('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0x8a75ca[_0x3162('0x44')]['id']['toString']()))[_0x3162('0x3c')](_0x3162('0x74'),squel[_0x3162('0x66')]()[_0x3162('0x68')](_0x3162('0x75'))[_0x3162('0x73')](_0x3162('0x6e'))[_0x3162('0x3c')](_0x3162('0x76'),_0x8a75ca[_0x3162('0x44')]['id'][_0x3162('0x6f')]())['where'](_0x3162('0x77')))[_0x3162('0x78')](_0x3162('0x6a')))[_0x3162('0x6f')]();return db[_0x3162('0x4a')][_0x3162('0x31')](_0x129005);}return[];})[_0x3162('0x24')](respondWithResult(_0x33c39d,null))[_0x3162('0x42')](handleError(_0x33c39d,null));};exports[_0x3162('0x79')]=function(_0x3f37fa,_0x1d242f,_0x190f91){return db['Campaign'][_0x3162('0x46')]({'where':{'id':_0x3f37fa[_0x3162('0x44')]['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x1d242f,null))['then'](function(_0x3d7bd1){var _0x5cdbb0;if(_0x3d7bd1){_0x5cdbb0=squel[_0x3162('0x5f')]()[_0x3162('0x60')]('cm_hopper')['fromQuery']([_0x3162('0x62'),_0x3162('0x63'),'ContactId',_0x3162('0x64'),'CampaignId',_0x3162('0x65'),_0x3162('0x7a')],squel[_0x3162('0x66')]()[_0x3162('0x68')](_0x3162('0x67'),_0x3162('0x62'))[_0x3162('0x68')](_0x3162('0x69'),_0x3162('0x63'))['field'](_0x3162('0x7b'),'ContactId')[_0x3162('0x68')](_0x3162('0x6b'),'ListId')[_0x3162('0x68')](_0x3162('0x7c'),_0x3162('0x7d'))[_0x3162('0x68')](_0x3162('0x69'),_0x3162('0x65'))[_0x3162('0x68')]('NOW()',_0x3162('0x7a'))[_0x3162('0x73')](_0x3162('0x6e'))['where'](_0x3162('0x7e'),_0x3f37fa[_0x3162('0x44')]['id'][_0x3162('0x6f')]())[_0x3162('0x3c')](_0x3162('0x70'),_0x3f37fa[_0x3162('0x48')]['state'][_0x3162('0x6f')]())[_0x3162('0x3c')](_0x3162('0x72'))[_0x3162('0x3c')](_0x3162('0x74'),squel['select']()[_0x3162('0x68')]('phone')[_0x3162('0x73')](_0x3162('0x61'))['where'](_0x3162('0x7e'),_0x3f37fa[_0x3162('0x44')]['id'][_0x3162('0x6f')]()))['where'](_0x3162('0x74'),squel['select']()['field'](_0x3162('0x75'))[_0x3162('0x73')](_0x3162('0x6e'))[_0x3162('0x3c')](_0x3162('0x7e'),_0x3f37fa[_0x3162('0x44')]['id'][_0x3162('0x6f')]())['where']('state\x20=\x204'))['group'](_0x3162('0x6a')))[_0x3162('0x6f')]();return db['sequelize']['query'](_0x5cdbb0);}return[];})[_0x3162('0x24')](respondWithResult(_0x1d242f,null))['catch'](handleError(_0x1d242f,null));};exports[_0x3162('0x7f')]=function(_0x35d9f0,_0x4408db,_0x377edb){return db['CmHopper'][_0x3162('0x80')]({'where':{'VoiceQueueId':_0x35d9f0[_0x3162('0x48')][_0x3162('0x6d')],'CampaignId':_0x35d9f0['body'][_0x3162('0x7d')],'ContactId':_0x35d9f0['body'][_0x3162('0x6a')]}})['then'](handleEntityNotFound(_0x4408db,null))[_0x3162('0x24')](function(_0x3d414f){if(_0x3d414f){return _0x3d414f;}return null;})[_0x3162('0x24')](respondWithResult(_0x4408db,null))['catch'](handleError(_0x4408db,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index c208141..cd8273f 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 _0x2423=['calleridnum','uniqueid','util','../../config/logger','api','moment','bluebird','path','rimraf','./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final'];(function(_0x31a210,_0x517a46){var _0x1d19d4=function(_0x503c26){while(--_0x503c26){_0x31a210['push'](_0x31a210['shift']());}};_0x1d19d4(++_0x517a46);}(_0x2423,0x161));var _0x3242=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2423[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x3242('0x0'));var logger=require(_0x3242('0x1'))(_0x3242('0x2'));var moment=require(_0x3242('0x3'));var BPromise=require(_0x3242('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3242('0x5'));var rimraf=require(_0x3242('0x6'));var config=require('../../config/environment');var attributes=require(_0x3242('0x7'));module['exports']=function(_0x4c3b6f,_0x53578c){return _0x4c3b6f[_0x3242('0x8')](_0x3242('0x9'),attributes,{'tableName':_0x3242('0xa'),'paranoid':![],'indexes':[{'name':_0x3242('0xb'),'fields':['calleridnum']},{'name':_0x3242('0xc'),'fields':[_0x3242('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd2ca=['calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmHopperFinal'];(function(_0x5d99ad,_0x15d2b5){var _0x453124=function(_0x57c8cf){while(--_0x57c8cf){_0x5d99ad['push'](_0x5d99ad['shift']());}};_0x453124(++_0x15d2b5);}(_0xd2ca,0x179));var _0xad2c=function(_0x4c9f5d,_0x40911e){_0x4c9f5d=_0x4c9f5d-0x0;var _0x8e72d3=_0xd2ca[_0x4c9f5d];return _0x8e72d3;};'use strict';var _=require(_0xad2c('0x0'));var util=require(_0xad2c('0x1'));var logger=require(_0xad2c('0x2'))(_0xad2c('0x3'));var moment=require(_0xad2c('0x4'));var BPromise=require(_0xad2c('0x5'));var rp=require(_0xad2c('0x6'));var fs=require('fs');var path=require(_0xad2c('0x7'));var rimraf=require(_0xad2c('0x8'));var config=require(_0xad2c('0x9'));var attributes=require('./cmHopperFinal.attributes');module[_0xad2c('0xa')]=function(_0x3a7fb2,_0x383462){return _0x3a7fb2[_0xad2c('0xb')](_0xad2c('0xc'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xad2c('0xd'),'fields':[_0xad2c('0xd')]},{'name':_0xad2c('0xe'),'fields':[_0xad2c('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 eaf46bd..5eaf8ea 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(_0x362cfc,_0x573d26){var _0x4cbb3a=function(_0x41726a){while(--_0x41726a){_0x362cfc['push'](_0x362cfc['shift']());}};_0x4cbb3a(++_0x573d26);}(_0x7a54,0x106));var _0x47a5=function(_0xed0bc2,_0x59da36){_0xed0bc2=_0xed0bc2-0x0;var _0xc6763a=_0x7a54[_0xed0bc2];return _0xc6763a;};'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 _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(_0x4dbeda,_0x9ffc8c){var _0x4a86ad=function(_0x8f2cfd){while(--_0x8f2cfd){_0x4dbeda['push'](_0x4dbeda['shift']());}};_0x4a86ad(++_0x9ffc8c);}(_0x7a54,0x106));var _0x47a5=function(_0x1fe800,_0x57449c){_0x1fe800=_0x1fe800-0x0;var _0x396e8c=_0x7a54[_0x1fe800];return _0x396e8c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 19a15e3..365ba0a 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 _0x60ee=['/describe','describe','/:id','isAuthenticated','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','put','update','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','index'];(function(_0x3f3571,_0x216802){var _0xa45351=function(_0x39dd47){while(--_0x39dd47){_0x3f3571['push'](_0x3f3571['shift']());}};_0xa45351(++_0x216802);}(_0x60ee,0x113));var _0xe60e=function(_0x479160,_0x3ab560){_0x479160=_0x479160-0x0;var _0x47ac6d=_0x60ee[_0x479160];return _0x47ac6d;};'use strict';var multer=require(_0xe60e('0x0'));var util=require('util');var path=require(_0xe60e('0x1'));var timeout=require(_0xe60e('0x2'));var express=require(_0xe60e('0x3'));var router=express[_0xe60e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe60e('0x5'));var interaction=require(_0xe60e('0x6'));var config=require(_0xe60e('0x7'));var controller=require(_0xe60e('0x8'));router[_0xe60e('0x9')]('/',auth['isAuthenticated'](),controller[_0xe60e('0xa')]);router[_0xe60e('0x9')](_0xe60e('0xb'),auth['isAuthenticated'](),controller[_0xe60e('0xc')]);router[_0xe60e('0x9')](_0xe60e('0xd'),auth[_0xe60e('0xe')](),controller[_0xe60e('0xf')]);router[_0xe60e('0x9')](_0xe60e('0x10'),auth['isAuthenticated'](),controller[_0xe60e('0x11')]);router[_0xe60e('0x9')](_0xe60e('0x12'),auth[_0xe60e('0xe')](),controller['countContactsIvrCampaignHopperFinal']);router[_0xe60e('0x13')](_0xe60e('0x14'),auth[_0xe60e('0xe')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xe60e('0x13')](_0xe60e('0x15'),auth['isAuthenticated'](),controller[_0xe60e('0x16')]);router[_0xe60e('0x13')]('/checkContactHopper',auth[_0xe60e('0xe')](),controller['checkContactHopper']);router[_0xe60e('0x17')](_0xe60e('0xd'),auth['isAuthenticated'](),controller[_0xe60e('0x18')]);module[_0xe60e('0x19')]=router; \ No newline at end of file +var _0x1fed=['post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','checkContactHopper','put','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1fed,0x1d3));var _0xd1fe=function(_0x216586,_0x2e9346){_0x216586=_0x216586-0x0;var _0x2c0807=_0x1fed[_0x216586];return _0x2c0807;};'use strict';var multer=require(_0xd1fe('0x0'));var util=require('util');var path=require(_0xd1fe('0x1'));var timeout=require(_0xd1fe('0x2'));var express=require(_0xd1fe('0x3'));var router=express[_0xd1fe('0x4')]();var fs_extra=require(_0xd1fe('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd1fe('0x6'));var controller=require('./cmHopperFinal.controller');router[_0xd1fe('0x7')]('/',auth[_0xd1fe('0x8')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xd1fe('0x9')]);router[_0xd1fe('0x7')](_0xd1fe('0xa'),auth[_0xd1fe('0x8')](),controller[_0xd1fe('0xb')]);router['get'](_0xd1fe('0xc'),auth[_0xd1fe('0x8')](),controller[_0xd1fe('0xd')]);router[_0xd1fe('0x7')](_0xd1fe('0xe'),auth['isAuthenticated'](),controller[_0xd1fe('0xf')]);router[_0xd1fe('0x10')](_0xd1fe('0x11'),auth[_0xd1fe('0x8')](),controller[_0xd1fe('0x12')]);router['post'](_0xd1fe('0x13'),auth[_0xd1fe('0x8')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xd1fe('0x10')]('/checkContactHopper',auth[_0xd1fe('0x8')](),controller[_0xd1fe('0x14')]);router[_0xd1fe('0x15')](_0xd1fe('0xa'),auth[_0xd1fe('0x8')](),controller['update']);module[_0xd1fe('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 1b8f79c..97db6f4 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 _0x2e5d=['INTEGER','STRING','DATE','BOOLEAN','exports'];(function(_0x34998f,_0x3296d8){var _0x18534d=function(_0x47f3b7){while(--_0x47f3b7){_0x34998f['push'](_0x34998f['shift']());}};_0x18534d(++_0x3296d8);}(_0x2e5d,0x1c1));var _0xd2e5=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x2e5d[_0x341e0f];return _0x59555a;};'use strict';var Sequelize=require('sequelize');module[_0xd2e5('0x0')]={'state':{'type':Sequelize[_0xd2e5('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xd2e5('0x2')]},'scheduledat':{'type':Sequelize[_0xd2e5('0x3')]},'countbusyretry':{'type':Sequelize[_0xd2e5('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd2e5('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd2e5('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd2e5('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xd2e5('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xd2e5('0x2')]},'originatecalleridname':{'type':Sequelize[_0xd2e5('0x2')]},'calleridnum':{'type':Sequelize[_0xd2e5('0x2')]},'calleridname':{'type':Sequelize[_0xd2e5('0x2')]},'starttime':{'type':Sequelize[_0xd2e5('0x3')]},'responsetime':{'type':Sequelize[_0xd2e5('0x3')]},'answertime':{'type':Sequelize[_0xd2e5('0x3')]},'droptime':{'type':Sequelize[_0xd2e5('0x3')]},'endtime':{'type':Sequelize[_0xd2e5('0x3')]},'ringtime':{'type':Sequelize[_0xd2e5('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xd2e5('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xd2e5('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd2e5('0x2')]},'campaign':{'type':Sequelize[_0xd2e5('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xd2e5('0x2')]},'reason':{'type':Sequelize[_0xd2e5('0x2')]},'amd':{'type':Sequelize[_0xd2e5('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xd2e5('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd2e5('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd2e5('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xd2e5('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xd2e5('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd2e5('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd2e5('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2e32=['STRING','DATE','BOOLEAN','sequelize','INTEGER'];(function(_0xd4e6b4,_0x14394e){var _0x63f282=function(_0x5b0f7e){while(--_0x5b0f7e){_0xd4e6b4['push'](_0xd4e6b4['shift']());}};_0x63f282(++_0x14394e);}(_0x2e32,0x12f));var _0x22e3=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x2e32[_0x4a53d];return _0x27410e;};'use strict';var Sequelize=require(_0x22e3('0x0'));module['exports']={'state':{'type':Sequelize[_0x22e3('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x22e3('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x22e3('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x22e3('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x22e3('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x22e3('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x22e3('0x2')]},'originatecalleridname':{'type':Sequelize[_0x22e3('0x2')]},'calleridnum':{'type':Sequelize[_0x22e3('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x22e3('0x3')]},'responsetime':{'type':Sequelize[_0x22e3('0x3')]},'answertime':{'type':Sequelize[_0x22e3('0x3')]},'droptime':{'type':Sequelize[_0x22e3('0x3')]},'endtime':{'type':Sequelize[_0x22e3('0x3')]},'ringtime':{'type':Sequelize[_0x22e3('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x22e3('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x22e3('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x22e3('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x22e3('0x2')]},'membername':{'type':Sequelize[_0x22e3('0x2')]},'reason':{'type':Sequelize[_0x22e3('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x22e3('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x22e3('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x22e3('0x3')]},'recallme':{'type':Sequelize[_0x22e3('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x22e3('0x3')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x22e3('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x22e3('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x22e3('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x22e3('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x22e3('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 8a0c76c..f819c1a 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 _0xd50d=['attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','includeAll','include','findAll','rows','catch','params','keys','options','find','create','describe','update','uniqueid','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','error','stack','send','index','CmHopperHistory','fieldName','type','model','map','query','fields'];(function(_0x4138f1,_0xfbcb0e){var _0x2e7002=function(_0x2192c6){while(--_0x2192c6){_0x4138f1['push'](_0x4138f1['shift']());}};_0x2e7002(++_0xfbcb0e);}(_0xd50d,0x154));var _0xdd50=function(_0x16d02b,_0x4a81e9){_0x16d02b=_0x16d02b-0x0;var _0x50646a=_0xd50d[_0x16d02b];return _0x50646a;};'use strict';var emlformat=require(_0xdd50('0x0'));var rimraf=require(_0xdd50('0x1'));var zipdir=require(_0xdd50('0x2'));var jsonpatch=require(_0xdd50('0x3'));var rp=require(_0xdd50('0x4'));var moment=require(_0xdd50('0x5'));var BPromise=require(_0xdd50('0x6'));var Mustache=require(_0xdd50('0x7'));var util=require('util');var path=require(_0xdd50('0x8'));var sox=require(_0xdd50('0x9'));var csv=require(_0xdd50('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdd50('0xb'));var _=require(_0xdd50('0xc'));var squel=require(_0xdd50('0xd'));var crypto=require(_0xdd50('0xe'));var jsforce=require(_0xdd50('0xf'));var deskjs=require(_0xdd50('0x10'));var toCsv=require(_0xdd50('0xa'));var querystring=require(_0xdd50('0x11'));var Papa=require(_0xdd50('0x12'));var Redis=require(_0xdd50('0x13'));var authService=require(_0xdd50('0x14'));var qs=require(_0xdd50('0x15'));var as=require(_0xdd50('0x16'));var hardwareService=require(_0xdd50('0x17'));var logger=require(_0xdd50('0x18'))(_0xdd50('0x19'));var utils=require(_0xdd50('0x1a'));var config=require(_0xdd50('0x1b'));var licenseUtil=require(_0xdd50('0x1c'));var db=require(_0xdd50('0x1d'))['db'];function respondWithStatusCode(_0x438b01,_0x1583ff){_0x1583ff=_0x1583ff||0xcc;return function(_0x3c7f0e){if(_0x3c7f0e){return _0x438b01[_0xdd50('0x1e')](_0x1583ff);}return _0x438b01[_0xdd50('0x1f')](_0x1583ff)[_0xdd50('0x20')]();};}function respondWithResult(_0x39b7cb,_0x5e7720){_0x5e7720=_0x5e7720||0xc8;return function(_0x1edfb2){if(_0x1edfb2){return _0x39b7cb[_0xdd50('0x1f')](_0x5e7720)[_0xdd50('0x21')](_0x1edfb2);}};}function respondWithFilteredResult(_0x4035ee,_0x4ff0bd){return function(_0x5d9115){if(_0x5d9115){var _0x3b534=typeof _0x4ff0bd['offset']===_0xdd50('0x22')&&typeof _0x4ff0bd[_0xdd50('0x23')]==='undefined';var _0x1c8616=_0x5d9115[_0xdd50('0x24')];var _0x51d35e=_0x3b534?0x0:_0x4ff0bd[_0xdd50('0x25')];var _0x23d548=_0x3b534?_0x5d9115[_0xdd50('0x24')]:_0x4ff0bd[_0xdd50('0x25')]+_0x4ff0bd[_0xdd50('0x23')];var _0x346ab6;if(_0x23d548>=_0x1c8616){_0x23d548=_0x1c8616;_0x346ab6=0xc8;}else{_0x346ab6=0xce;}_0x4035ee[_0xdd50('0x1f')](_0x346ab6);return _0x4035ee[_0xdd50('0x26')](_0xdd50('0x27'),_0x51d35e+'-'+_0x23d548+'/'+_0x1c8616)[_0xdd50('0x21')](_0x5d9115);}return null;};}function patchUpdates(_0x3633c1){return function(_0x38ea14){try{jsonpatch[_0xdd50('0x28')](_0x38ea14,_0x3633c1,!![]);}catch(_0x49142a){return BPromise[_0xdd50('0x29')](_0x49142a);}return _0x38ea14[_0xdd50('0x2a')]();};}function saveUpdates(_0x34a07a,_0xb0ff){return function(_0x30fdf6){if(_0x30fdf6){return _0x30fdf6['update'](_0x34a07a)[_0xdd50('0x2b')](function(_0x4ea845){return _0x4ea845;});}return null;};}function removeEntity(_0x160ac2,_0x173dc8){return function(_0x56c86f){if(_0x56c86f){return _0x56c86f['destroy']()['then'](function(){_0x160ac2[_0xdd50('0x1f')](0xcc)[_0xdd50('0x20')]();});}};}function handleEntityNotFound(_0x496874,_0x4cdfb2){return function(_0x3819e3){if(!_0x3819e3){_0x496874[_0xdd50('0x1e')](0x194);}return _0x3819e3;};}function handleError(_0x140899,_0xdd2b54){_0xdd2b54=_0xdd2b54||0x1f4;return function(_0x25e91a){logger[_0xdd50('0x2c')](_0x25e91a[_0xdd50('0x2d')]);if(_0x25e91a['name']){delete _0x25e91a['name'];}_0x140899[_0xdd50('0x1f')](_0xdd2b54)[_0xdd50('0x2e')](_0x25e91a);};}exports[_0xdd50('0x2f')]=function(_0x8eef4e,_0x7c604b){var _0x5d558a={},_0x594ab5={},_0x1d93d5={'count':0x0,'rows':[]};var _0x9e3cb4=_['map'](db[_0xdd50('0x30')]['rawAttributes'],function(_0x57d31a){return{'name':_0x57d31a[_0xdd50('0x31')],'type':_0x57d31a[_0xdd50('0x32')]['key']};});_0x594ab5[_0xdd50('0x33')]=_[_0xdd50('0x34')](_0x9e3cb4,'name');_0x594ab5[_0xdd50('0x35')]=_['keys'](_0x8eef4e['query']);_0x594ab5['filters']=_['intersection'](_0x594ab5[_0xdd50('0x33')],_0x594ab5[_0xdd50('0x35')]);_0x5d558a['attributes']=_['intersection'](_0x594ab5[_0xdd50('0x33')],qs[_0xdd50('0x36')](_0x8eef4e['query'][_0xdd50('0x36')]));_0x5d558a[_0xdd50('0x37')]=_0x5d558a['attributes'][_0xdd50('0x38')]?_0x5d558a[_0xdd50('0x37')]:_0x594ab5[_0xdd50('0x33')];if(!_0x8eef4e[_0xdd50('0x35')]['hasOwnProperty'](_0xdd50('0x39'))){_0x5d558a[_0xdd50('0x23')]=qs[_0xdd50('0x23')](_0x8eef4e['query'][_0xdd50('0x23')]);_0x5d558a[_0xdd50('0x25')]=qs[_0xdd50('0x25')](_0x8eef4e[_0xdd50('0x35')][_0xdd50('0x25')]);}_0x5d558a[_0xdd50('0x3a')]=qs['sort'](_0x8eef4e[_0xdd50('0x35')][_0xdd50('0x3b')]);_0x5d558a['where']=qs[_0xdd50('0x3c')](_[_0xdd50('0x3d')](_0x8eef4e[_0xdd50('0x35')],_0x594ab5[_0xdd50('0x3c')]),_0x9e3cb4);if(_0x8eef4e[_0xdd50('0x35')][_0xdd50('0x3e')]){_0x5d558a[_0xdd50('0x3f')]=_[_0xdd50('0x40')](_0x5d558a['where'],{'$or':_['map'](_0x9e3cb4,function(_0x1ab989){if(_0x1ab989[_0xdd50('0x32')]!=='VIRTUAL'){var _0x81d2={};_0x81d2[_0x1ab989['name']]={'$like':'%'+_0x8eef4e[_0xdd50('0x35')][_0xdd50('0x3e')]+'%'};return _0x81d2;}})});}_0x5d558a=_[_0xdd50('0x40')]({},_0x5d558a,_0x8eef4e['options']);var _0x22eca9={'where':_0x5d558a[_0xdd50('0x3f')]};return db[_0xdd50('0x30')][_0xdd50('0x24')](_0x22eca9)[_0xdd50('0x2b')](function(_0x532aaa){_0x1d93d5[_0xdd50('0x24')]=_0x532aaa;if(_0x8eef4e[_0xdd50('0x35')][_0xdd50('0x41')]){_0x5d558a[_0xdd50('0x42')]=[{'all':!![]}];}return db[_0xdd50('0x30')][_0xdd50('0x43')](_0x5d558a);})[_0xdd50('0x2b')](function(_0x15ef47){_0x1d93d5[_0xdd50('0x44')]=_0x15ef47;return _0x1d93d5;})[_0xdd50('0x2b')](respondWithFilteredResult(_0x7c604b,_0x5d558a))[_0xdd50('0x45')](handleError(_0x7c604b,null));};exports['show']=function(_0x157f54,_0x58723d){var _0x3a8312={'raw':!![],'where':{'id':_0x157f54[_0xdd50('0x46')]['id']}},_0x10b334={};_0x10b334[_0xdd50('0x33')]=_[_0xdd50('0x47')](db[_0xdd50('0x30')]['rawAttributes']);_0x10b334[_0xdd50('0x35')]=_[_0xdd50('0x47')](_0x157f54[_0xdd50('0x35')]);_0x10b334[_0xdd50('0x3c')]=_['intersection'](_0x10b334[_0xdd50('0x33')],_0x10b334[_0xdd50('0x35')]);_0x3a8312[_0xdd50('0x37')]=_['intersection'](_0x10b334['model'],qs[_0xdd50('0x36')](_0x157f54['query'][_0xdd50('0x36')]));_0x3a8312[_0xdd50('0x37')]=_0x3a8312['attributes']['length']?_0x3a8312[_0xdd50('0x37')]:_0x10b334[_0xdd50('0x33')];if(_0x157f54[_0xdd50('0x35')][_0xdd50('0x41')]){_0x3a8312[_0xdd50('0x42')]=[{'all':!![]}];}_0x3a8312=_[_0xdd50('0x40')]({},_0x3a8312,_0x157f54[_0xdd50('0x48')]);return db[_0xdd50('0x30')][_0xdd50('0x49')](_0x3a8312)['then'](handleEntityNotFound(_0x58723d,null))[_0xdd50('0x2b')](respondWithResult(_0x58723d,null))[_0xdd50('0x45')](handleError(_0x58723d,null));};exports[_0xdd50('0x4a')]=function(_0x730921,_0x57c066){return db[_0xdd50('0x30')][_0xdd50('0x4a')](_0x730921['body'],{})[_0xdd50('0x2b')](respondWithResult(_0x57c066,0xc9))[_0xdd50('0x45')](handleError(_0x57c066,null));};exports[_0xdd50('0x4b')]=function(_0x2fa43e,_0x642841){return db[_0xdd50('0x30')][_0xdd50('0x4b')]()[_0xdd50('0x2b')](respondWithResult(_0x642841,null))['catch'](handleError(_0x642841,null));};exports[_0xdd50('0x4c')]=function(_0xe77d40,_0x578408){if(_0xe77d40['body'][_0xdd50('0x4d')]){delete _0xe77d40[_0xdd50('0x4e')][_0xdd50('0x4d')];}return db[_0xdd50('0x30')]['find']({'where':{'uniqueid':_0xe77d40[_0xdd50('0x46')]['id']}})[_0xdd50('0x2b')](handleEntityNotFound(_0x578408,null))[_0xdd50('0x2b')](saveUpdates(_0xe77d40[_0xdd50('0x4e')],null))[_0xdd50('0x2b')](respondWithResult(_0x578408,null))[_0xdd50('0x45')](handleError(_0x578408,null));}; \ No newline at end of file +var _0xef94=['reject','save','update','destroy','end','error','stack','name','send','index','map','CmHopperHistory','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','find','create','body','uniqueid','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','count','offset','limit','Content-Range','json','apply'];(function(_0x24b9fc,_0xa0d1de){var _0x5e2dcc=function(_0x2c4cd2){while(--_0x2c4cd2){_0x24b9fc['push'](_0x24b9fc['shift']());}};_0x5e2dcc(++_0xa0d1de);}(_0xef94,0x165));var _0x4ef9=function(_0x1c04af,_0x4947f7){_0x1c04af=_0x1c04af-0x0;var _0x4e1ab3=_0xef94[_0x1c04af];return _0x4e1ab3;};'use strict';var emlformat=require(_0x4ef9('0x0'));var rimraf=require(_0x4ef9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4ef9('0x2'));var moment=require(_0x4ef9('0x3'));var BPromise=require(_0x4ef9('0x4'));var Mustache=require(_0x4ef9('0x5'));var util=require('util');var path=require(_0x4ef9('0x6'));var sox=require(_0x4ef9('0x7'));var csv=require(_0x4ef9('0x8'));var ejs=require(_0x4ef9('0x9'));var fs=require('fs');var fs_extra=require(_0x4ef9('0xa'));var _=require(_0x4ef9('0xb'));var squel=require(_0x4ef9('0xc'));var crypto=require('crypto');var jsforce=require(_0x4ef9('0xd'));var deskjs=require(_0x4ef9('0xe'));var toCsv=require(_0x4ef9('0x8'));var querystring=require('querystring');var Papa=require(_0x4ef9('0xf'));var Redis=require(_0x4ef9('0x10'));var authService=require(_0x4ef9('0x11'));var qs=require(_0x4ef9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ef9('0x13'));var logger=require(_0x4ef9('0x14'))('api');var utils=require(_0x4ef9('0x15'));var config=require(_0x4ef9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4ef9('0x17'))['db'];function respondWithStatusCode(_0x2523b4,_0x371157){_0x371157=_0x371157||0xcc;return function(_0x2f2d6c){if(_0x2f2d6c){return _0x2523b4[_0x4ef9('0x18')](_0x371157);}return _0x2523b4[_0x4ef9('0x19')](_0x371157)['end']();};}function respondWithResult(_0x28ed2b,_0x5098e9){_0x5098e9=_0x5098e9||0xc8;return function(_0x33faab){if(_0x33faab){return _0x28ed2b[_0x4ef9('0x19')](_0x5098e9)['json'](_0x33faab);}};}function respondWithFilteredResult(_0x49ee8f,_0x20c76d){return function(_0x5d0272){if(_0x5d0272){var _0x19c227=typeof _0x20c76d['offset']===_0x4ef9('0x1a')&&typeof _0x20c76d['limit']===_0x4ef9('0x1a');var _0x5dc13f=_0x5d0272[_0x4ef9('0x1b')];var _0x3cc12a=_0x19c227?0x0:_0x20c76d[_0x4ef9('0x1c')];var _0x2b96a8=_0x19c227?_0x5d0272['count']:_0x20c76d[_0x4ef9('0x1c')]+_0x20c76d[_0x4ef9('0x1d')];var _0xb5fcb2;if(_0x2b96a8>=_0x5dc13f){_0x2b96a8=_0x5dc13f;_0xb5fcb2=0xc8;}else{_0xb5fcb2=0xce;}_0x49ee8f['status'](_0xb5fcb2);return _0x49ee8f['set'](_0x4ef9('0x1e'),_0x3cc12a+'-'+_0x2b96a8+'/'+_0x5dc13f)[_0x4ef9('0x1f')](_0x5d0272);}return null;};}function patchUpdates(_0x493d42){return function(_0x5a9fcb){try{jsonpatch[_0x4ef9('0x20')](_0x5a9fcb,_0x493d42,!![]);}catch(_0x1dec72){return BPromise[_0x4ef9('0x21')](_0x1dec72);}return _0x5a9fcb[_0x4ef9('0x22')]();};}function saveUpdates(_0xdb8a65,_0x48ab83){return function(_0x59a3db){if(_0x59a3db){return _0x59a3db[_0x4ef9('0x23')](_0xdb8a65)['then'](function(_0x5509dc){return _0x5509dc;});}return null;};}function removeEntity(_0x39745,_0x1817ab){return function(_0x2a0774){if(_0x2a0774){return _0x2a0774[_0x4ef9('0x24')]()['then'](function(){_0x39745['status'](0xcc)[_0x4ef9('0x25')]();});}};}function handleEntityNotFound(_0x4490d9,_0x3a3251){return function(_0x1c933e){if(!_0x1c933e){_0x4490d9['sendStatus'](0x194);}return _0x1c933e;};}function handleError(_0x3d8437,_0x3a0aed){_0x3a0aed=_0x3a0aed||0x1f4;return function(_0x2ab261){logger[_0x4ef9('0x26')](_0x2ab261[_0x4ef9('0x27')]);if(_0x2ab261[_0x4ef9('0x28')]){delete _0x2ab261[_0x4ef9('0x28')];}_0x3d8437[_0x4ef9('0x19')](_0x3a0aed)[_0x4ef9('0x29')](_0x2ab261);};}exports[_0x4ef9('0x2a')]=function(_0x1d88ca,_0xa4a40f){var _0x563fb2={},_0x6a9c8e={},_0x4aa829={'count':0x0,'rows':[]};var _0xec8938=_[_0x4ef9('0x2b')](db[_0x4ef9('0x2c')]['rawAttributes'],function(_0x1061b5){return{'name':_0x1061b5['fieldName'],'type':_0x1061b5[_0x4ef9('0x2d')][_0x4ef9('0x2e')]};});_0x6a9c8e[_0x4ef9('0x2f')]=_[_0x4ef9('0x2b')](_0xec8938,_0x4ef9('0x28'));_0x6a9c8e['query']=_[_0x4ef9('0x30')](_0x1d88ca[_0x4ef9('0x31')]);_0x6a9c8e[_0x4ef9('0x32')]=_['intersection'](_0x6a9c8e[_0x4ef9('0x2f')],_0x6a9c8e[_0x4ef9('0x31')]);_0x563fb2[_0x4ef9('0x33')]=_['intersection'](_0x6a9c8e[_0x4ef9('0x2f')],qs['fields'](_0x1d88ca[_0x4ef9('0x31')][_0x4ef9('0x34')]));_0x563fb2[_0x4ef9('0x33')]=_0x563fb2[_0x4ef9('0x33')][_0x4ef9('0x35')]?_0x563fb2[_0x4ef9('0x33')]:_0x6a9c8e[_0x4ef9('0x2f')];if(!_0x1d88ca[_0x4ef9('0x31')][_0x4ef9('0x36')](_0x4ef9('0x37'))){_0x563fb2['limit']=qs[_0x4ef9('0x1d')](_0x1d88ca[_0x4ef9('0x31')][_0x4ef9('0x1d')]);_0x563fb2[_0x4ef9('0x1c')]=qs[_0x4ef9('0x1c')](_0x1d88ca[_0x4ef9('0x31')][_0x4ef9('0x1c')]);}_0x563fb2[_0x4ef9('0x38')]=qs[_0x4ef9('0x39')](_0x1d88ca['query']['sort']);_0x563fb2[_0x4ef9('0x3a')]=qs[_0x4ef9('0x32')](_[_0x4ef9('0x3b')](_0x1d88ca[_0x4ef9('0x31')],_0x6a9c8e[_0x4ef9('0x32')]),_0xec8938);if(_0x1d88ca['query'][_0x4ef9('0x3c')]){_0x563fb2[_0x4ef9('0x3a')]=_[_0x4ef9('0x3d')](_0x563fb2[_0x4ef9('0x3a')],{'$or':_[_0x4ef9('0x2b')](_0xec8938,function(_0x52d8b5){if(_0x52d8b5[_0x4ef9('0x2d')]!==_0x4ef9('0x3e')){var _0x23b14f={};_0x23b14f[_0x52d8b5[_0x4ef9('0x28')]]={'$like':'%'+_0x1d88ca[_0x4ef9('0x31')]['filter']+'%'};return _0x23b14f;}})});}_0x563fb2=_[_0x4ef9('0x3d')]({},_0x563fb2,_0x1d88ca[_0x4ef9('0x3f')]);var _0x22873f={'where':_0x563fb2['where']};return db[_0x4ef9('0x2c')][_0x4ef9('0x1b')](_0x22873f)[_0x4ef9('0x40')](function(_0x100c11){_0x4aa829[_0x4ef9('0x1b')]=_0x100c11;if(_0x1d88ca[_0x4ef9('0x31')][_0x4ef9('0x41')]){_0x563fb2[_0x4ef9('0x42')]=[{'all':!![]}];}return db[_0x4ef9('0x2c')][_0x4ef9('0x43')](_0x563fb2);})[_0x4ef9('0x40')](function(_0x12f975){_0x4aa829[_0x4ef9('0x44')]=_0x12f975;return _0x4aa829;})[_0x4ef9('0x40')](respondWithFilteredResult(_0xa4a40f,_0x563fb2))[_0x4ef9('0x45')](handleError(_0xa4a40f,null));};exports[_0x4ef9('0x46')]=function(_0x14a750,_0x2e0634){var _0x5c3fc0={'raw':!![],'where':{'id':_0x14a750[_0x4ef9('0x47')]['id']}},_0x509540={};_0x509540[_0x4ef9('0x2f')]=_[_0x4ef9('0x30')](db[_0x4ef9('0x2c')][_0x4ef9('0x48')]);_0x509540[_0x4ef9('0x31')]=_['keys'](_0x14a750[_0x4ef9('0x31')]);_0x509540['filters']=_[_0x4ef9('0x49')](_0x509540[_0x4ef9('0x2f')],_0x509540['query']);_0x5c3fc0['attributes']=_[_0x4ef9('0x49')](_0x509540['model'],qs[_0x4ef9('0x34')](_0x14a750[_0x4ef9('0x31')][_0x4ef9('0x34')]));_0x5c3fc0['attributes']=_0x5c3fc0['attributes'][_0x4ef9('0x35')]?_0x5c3fc0[_0x4ef9('0x33')]:_0x509540['model'];if(_0x14a750[_0x4ef9('0x31')][_0x4ef9('0x41')]){_0x5c3fc0['include']=[{'all':!![]}];}_0x5c3fc0=_[_0x4ef9('0x3d')]({},_0x5c3fc0,_0x14a750[_0x4ef9('0x3f')]);return db[_0x4ef9('0x2c')][_0x4ef9('0x4a')](_0x5c3fc0)[_0x4ef9('0x40')](handleEntityNotFound(_0x2e0634,null))['then'](respondWithResult(_0x2e0634,null))[_0x4ef9('0x45')](handleError(_0x2e0634,null));};exports['create']=function(_0x311666,_0x56330d){return db['CmHopperHistory'][_0x4ef9('0x4b')](_0x311666[_0x4ef9('0x4c')],{})[_0x4ef9('0x40')](respondWithResult(_0x56330d,0xc9))[_0x4ef9('0x45')](handleError(_0x56330d,null));};exports['describe']=function(_0x7f09ec,_0x1b13e2){return db[_0x4ef9('0x2c')]['describe']()[_0x4ef9('0x40')](respondWithResult(_0x1b13e2,null))['catch'](handleError(_0x1b13e2,null));};exports[_0x4ef9('0x23')]=function(_0x518e25,_0x23a430){if(_0x518e25[_0x4ef9('0x4c')][_0x4ef9('0x4d')]){delete _0x518e25['body'][_0x4ef9('0x4d')];}return db[_0x4ef9('0x2c')][_0x4ef9('0x4a')]({'where':{'uniqueid':_0x518e25['params']['id']}})[_0x4ef9('0x40')](handleEntityNotFound(_0x23a430,null))[_0x4ef9('0x40')](saveUpdates(_0x518e25[_0x4ef9('0x4c')],null))[_0x4ef9('0x40')](respondWithResult(_0x23a430,null))[_0x4ef9('0x45')](handleError(_0x23a430,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index bd3e99f..363813e 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 _0x6822=['request-promise','path','rimraf','./cmHopperHistory.attributes','define','endtime','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xd0cd0b,_0x490956){var _0x59cced=function(_0x567251){while(--_0x567251){_0xd0cd0b['push'](_0xd0cd0b['shift']());}};_0x59cced(++_0x490956);}(_0x6822,0xca));var _0x2682=function(_0x5b8b8d,_0x3d01b8){_0x5b8b8d=_0x5b8b8d-0x0;var _0x6c584b=_0x6822[_0x5b8b8d];return _0x6c584b;};'use strict';var _=require(_0x2682('0x0'));var util=require(_0x2682('0x1'));var logger=require(_0x2682('0x2'))(_0x2682('0x3'));var moment=require(_0x2682('0x4'));var BPromise=require(_0x2682('0x5'));var rp=require(_0x2682('0x6'));var fs=require('fs');var path=require(_0x2682('0x7'));var rimraf=require(_0x2682('0x8'));var config=require('../../config/environment');var attributes=require(_0x2682('0x9'));module['exports']=function(_0x30fcd9,_0x39d4f7){return _0x30fcd9[_0x2682('0xa')]('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':[_0x2682('0xb')]},{'name':_0x2682('0xc'),'fields':[_0x2682('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x583c=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory','endtime','uniqueid','lodash'];(function(_0x6ae099,_0xe75d97){var _0x4fd922=function(_0x20801e){while(--_0x20801e){_0x6ae099['push'](_0x6ae099['shift']());}};_0x4fd922(++_0xe75d97);}(_0x583c,0x12b));var _0xc583=function(_0x3db122,_0x5e6bee){_0x3db122=_0x3db122-0x0;var _0x325b67=_0x583c[_0x3db122];return _0x325b67;};'use strict';var _=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var logger=require(_0xc583('0x2'))(_0xc583('0x3'));var moment=require('moment');var BPromise=require(_0xc583('0x4'));var rp=require(_0xc583('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc583('0x6'));var attributes=require(_0xc583('0x7'));module['exports']=function(_0xd3a750,_0x365ed6){return _0xd3a750[_0xc583('0x8')](_0xc583('0x9'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xc583('0xa'),'fields':[_0xc583('0xa')]},{'name':'uniqueid','fields':[_0xc583('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 6391698..80529e9 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 _0x544a=['result','CreateCmHopperHistory','CmHopperHistory','create','options','raw','then','stringify','catch','AvgHandleTime','findAll','sequelize','COUNT','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','where','col','ivrTotalCallsDays','ivrAnswerCallsDay','debug','lodash','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x5b1c06,_0x21f26e){var _0x4d527=function(_0x34d778){while(--_0x34d778){_0x5b1c06['push'](_0x5b1c06['shift']());}};_0x4d527(++_0x21f26e);}(_0x544a,0xbd));var _0xa544=function(_0x2ff28a,_0x4222d5){_0x2ff28a=_0x2ff28a-0x0;var _0x57f43c=_0x544a[_0x2ff28a];return _0x57f43c;};'use strict';var _=require(_0xa544('0x0'));var util=require(_0xa544('0x1'));var moment=require(_0xa544('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa544('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa544('0x4'));var logger=require(_0xa544('0x5'))('rpc');var config=require(_0xa544('0x6'));var jayson=require(_0xa544('0x7'));var client=jayson[_0xa544('0x8')][_0xa544('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39caac,_0x543cd1,_0x407443){return new BPromise(function(_0x495819,_0x39bcd7){return client[_0xa544('0xa')](_0x39caac,_0x407443)['then'](function(_0x2e9a6a){logger[_0xa544('0xb')](_0xa544('0xc'),_0x543cd1,_0xa544('0xd'));logger['debug'](_0xa544('0xe'),_0x543cd1,_0xa544('0xd'),JSON['stringify'](_0x2e9a6a));if(_0x2e9a6a[_0xa544('0xf')]){if(_0x2e9a6a['error'][_0xa544('0x10')]===0x1f4){logger[_0xa544('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x543cd1,_0x2e9a6a[_0xa544('0xf')][_0xa544('0x11')]);return _0x39bcd7(_0x2e9a6a[_0xa544('0xf')][_0xa544('0x11')]);}logger[_0xa544('0xf')](_0xa544('0xc'),_0x543cd1,_0x2e9a6a[_0xa544('0xf')][_0xa544('0x11')]);return _0x495819(_0x2e9a6a[_0xa544('0xf')][_0xa544('0x11')]);}else{logger[_0xa544('0xb')](_0xa544('0xc'),_0x543cd1,'request\x20sent');_0x495819(_0x2e9a6a[_0xa544('0x12')][_0xa544('0x11')]);}})['catch'](function(_0x9093bd){logger[_0xa544('0xf')](_0xa544('0xc'),_0x543cd1,_0x9093bd);_0x39bcd7(_0x9093bd);});});}exports[_0xa544('0x13')]=function(_0x2c5ae8){var _0x297298=this;return new Promise(function(_0x1f3fcc,_0x44ccd3){return db[_0xa544('0x14')][_0xa544('0x15')](_0x2c5ae8['body'],{'raw':_0x2c5ae8['options']?_0x2c5ae8[_0xa544('0x16')][_0xa544('0x17')]===undefined?!![]:![]:!![]})[_0xa544('0x18')](function(_0x57a154){logger[_0xa544('0xb')](_0xa544('0x13'),_0x2c5ae8);logger['debug'](_0xa544('0x13'),_0x2c5ae8,JSON[_0xa544('0x19')](_0x57a154));_0x1f3fcc(_0x57a154);})[_0xa544('0x1a')](function(_0xb7df3d){logger[_0xa544('0xf')]('CreateCmHopperHistory',_0xb7df3d['message'],_0x2c5ae8);_0x44ccd3(_0x297298[_0xa544('0xf')](0x1f4,_0xb7df3d['message']));});});};exports[_0xa544('0x1b')]=function(_0x3794e3){var _0x11a6db=this;return new Promise(function(_0x45e4b7,_0x14a587){return db[_0xa544('0x14')][_0xa544('0x1c')]({'raw':_0x3794e3[_0xa544('0x16')]?_0x3794e3[_0xa544('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3794e3[_0xa544('0x16')]?_0x3794e3[_0xa544('0x16')]['where']||null:null,'attributes':[[db[_0xa544('0x1d')]['fn'](_0xa544('0x1e'),db[_0xa544('0x1d')]['col']('id')),_0xa544('0x1f')],[db[_0xa544('0x1d')]['fn'](_0xa544('0x1e'),db[_0xa544('0x1d')]['fn']('IF',db['sequelize'][_0xa544('0x20')](_0xa544('0x21')))),_0xa544('0x22')],[db['sequelize']['fn'](_0xa544('0x1e'),db[_0xa544('0x1d')]['fn']('IF',db['sequelize']['literal'](_0xa544('0x23')))),_0xa544('0x24')],[db[_0xa544('0x1d')]['fn']('COUNT',db[_0xa544('0x1d')]['fn']('IF',db[_0xa544('0x1d')][_0xa544('0x20')]('`state`\x20=\x2011,\x201,\x20null'))),_0xa544('0x25')],[db[_0xa544('0x1d')]['fn']('AVG',db[_0xa544('0x1d')]['fn']('IF',db['sequelize'][_0xa544('0x20')](_0xa544('0x26')))),_0xa544('0x27')],[db['sequelize']['fn']('AVG',db[_0xa544('0x1d')]['fn']('IF',db[_0xa544('0x1d')][_0xa544('0x20')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})[_0xa544('0x18')](function(_0x1165e2){logger[_0xa544('0xb')]('AvgHandleTime',_0x3794e3);logger['debug'](_0xa544('0x1b'),_0x3794e3,JSON[_0xa544('0x19')](_0x1165e2));_0x45e4b7(_0x1165e2);})[_0xa544('0x1a')](function(_0x2c3032){logger[_0xa544('0xf')](_0xa544('0x1b'),_0x2c3032[_0xa544('0x11')],_0x3794e3);_0x14a587(_0x11a6db['error'](0x1f4,_0x2c3032[_0xa544('0x11')]));});});};exports[_0xa544('0x28')]=function(_0x204b12){var _0x26f658=this;return new Promise(function(_0x555ec0,_0xd5e63f){return db[_0xa544('0x14')][_0xa544('0x1c')]({'raw':_0x204b12[_0xa544('0x16')]?_0x204b12['options'][_0xa544('0x17')]===undefined?!![]:![]:!![],'where':_0x204b12[_0xa544('0x16')]?_0x204b12[_0xa544('0x16')]['where']||null:null,'attributes':[[_0xa544('0x29'),_0xa544('0x2a')],[db[_0xa544('0x1d')]['fn'](_0xa544('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0xa544('0x20')](_0xa544('0x2b')))),'outboundNoSuchCallsDay'],[db[_0xa544('0x1d')]['fn'](_0xa544('0x1e'),db[_0xa544('0x1d')]['fn']('IF',db[_0xa544('0x1d')]['literal'](_0xa544('0x2c')))),'outboundNoAnswerCallsDay'],[db['sequelize']['fn'](_0xa544('0x1e'),db[_0xa544('0x1d')]['fn']('IF',db[_0xa544('0x1d')][_0xa544('0x20')](_0xa544('0x21')))),_0xa544('0x2d')],[db[_0xa544('0x1d')]['fn'](_0xa544('0x1e'),db[_0xa544('0x1d')]['fn']('IF',db[_0xa544('0x1d')]['literal'](_0xa544('0x2e')))),_0xa544('0x2f')],[db['sequelize']['fn']('COUNT',db[_0xa544('0x1d')]['fn']('IF',db[_0xa544('0x1d')]['literal'](_0xa544('0x30')))),'outboundCongestionCallsDay'],[db[_0xa544('0x1d')]['fn'](_0xa544('0x1e'),db[_0xa544('0x1d')]['fn']('IF',db[_0xa544('0x1d')][_0xa544('0x20')](_0xa544('0x31')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn'](_0xa544('0x1e'),db[_0xa544('0x1d')]['fn']('IF',db[_0xa544('0x1d')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xa544('0x32')],[db[_0xa544('0x1d')]['fn'](_0xa544('0x1e'),db[_0xa544('0x1d')]['fn']('IF',db[_0xa544('0x1d')][_0xa544('0x20')](_0xa544('0x33')))),_0xa544('0x34')],[db[_0xa544('0x1d')]['fn'](_0xa544('0x1e'),db['sequelize']['fn']('IF',db[_0xa544('0x1d')][_0xa544('0x20')](_0xa544('0x35')))),_0xa544('0x36')],[db[_0xa544('0x1d')]['fn'](_0xa544('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0xa544('0x20')](_0xa544('0x37')))),_0xa544('0x38')],[db[_0xa544('0x1d')]['fn'](_0xa544('0x1e'),db[_0xa544('0x1d')]['fn']('IF',db[_0xa544('0x1d')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),_0xa544('0x39')],[db[_0xa544('0x1d')]['fn'](_0xa544('0x1e'),db[_0xa544('0x1d')]['fn']('IF',db[_0xa544('0x1d')]['literal'](_0xa544('0x3a')))),_0xa544('0x3b')],[db[_0xa544('0x1d')]['fn'](_0xa544('0x1e'),db['sequelize']['fn']('IF',db[_0xa544('0x1d')][_0xa544('0x20')](_0xa544('0x3c')))),'outboundRejectCallsDay'],[db[_0xa544('0x1d')]['fn'](_0xa544('0x1e'),db[_0xa544('0x1d')]['fn']('IF',db[_0xa544('0x1d')][_0xa544('0x20')](_0xa544('0x3d')))),_0xa544('0x3e')]],'group':['campaign']})[_0xa544('0x18')](function(_0x34dba1){logger[_0xa544('0xb')](_0xa544('0x28'),_0x204b12);logger['debug']('GetVoiceQueueHopperHistory',_0x204b12,JSON['stringify'](_0x34dba1));_0x555ec0(_0x34dba1);})[_0xa544('0x1a')](function(_0x171db8){logger[_0xa544('0xf')](_0xa544('0x28'),_0x171db8[_0xa544('0x11')],_0x204b12);_0xd5e63f(_0x26f658[_0xa544('0xf')](0x1f4,_0x171db8[_0xa544('0x11')]));});});};exports[_0xa544('0x3f')]=function(_0x50bbf2){var _0x428c62=this;return new Promise(function(_0x13c05f,_0x689236){return db[_0xa544('0x14')][_0xa544('0x1c')]({'raw':_0x50bbf2['options']?_0x50bbf2[_0xa544('0x16')][_0xa544('0x17')]===undefined?!![]:![]:!![],'where':_0x50bbf2[_0xa544('0x16')]?_0x50bbf2['options'][_0xa544('0x40')]||null:null,'attributes':[[_0xa544('0x29'),_0xa544('0x2a')],[db[_0xa544('0x1d')]['fn'](_0xa544('0x1e'),db[_0xa544('0x1d')][_0xa544('0x41')]('id')),_0xa544('0x42')],[db[_0xa544('0x1d')]['fn'](_0xa544('0x1e'),db[_0xa544('0x1d')]['fn']('IF',db[_0xa544('0x1d')][_0xa544('0x20')]('`state`\x20=\x204,\x201,\x20null'))),_0xa544('0x43')]],'group':['campaign']})[_0xa544('0x18')](function(_0x28c7ff){logger[_0xa544('0xb')](_0xa544('0x3f'),_0x50bbf2);logger[_0xa544('0x44')](_0xa544('0x3f'),_0x50bbf2,JSON['stringify'](_0x28c7ff));_0x13c05f(_0x28c7ff);})['catch'](function(_0x4f732e){logger[_0xa544('0xf')](_0xa544('0x3f'),_0x4f732e[_0xa544('0x11')],_0x50bbf2);_0x689236(_0x428c62[_0xa544('0xf')](0x1f4,_0x4f732e[_0xa544('0x11')]));});});}; \ No newline at end of file +var _0xfd6f=['outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','catch','GetCampaignHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','CmHopperHistory,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','CreateCmHopperHistory','CmHopperHistory','create','options','AvgHandleTime','findAll','raw','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfd6f,0x19d));var _0xffd6=function(_0x22cc65,_0x5167e7){_0x22cc65=_0x22cc65-0x0;var _0x4b5714=_0xfd6f[_0x22cc65];return _0x4b5714;};'use strict';var _=require(_0xffd6('0x0'));var util=require(_0xffd6('0x1'));var moment=require(_0xffd6('0x2'));var BPromise=require(_0xffd6('0x3'));var rs=require(_0xffd6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xffd6('0x5'))['db'];var utils=require(_0xffd6('0x6'));var logger=require(_0xffd6('0x7'))(_0xffd6('0x8'));var config=require('../../config/environment');var jayson=require(_0xffd6('0x9'));var client=jayson[_0xffd6('0xa')][_0xffd6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10b335,_0x5c19ee,_0x3f9538){return new BPromise(function(_0x534a1b,_0x54d793){return client['request'](_0x10b335,_0x3f9538)[_0xffd6('0xc')](function(_0x4267fc){logger[_0xffd6('0xd')](_0xffd6('0xe'),_0x5c19ee,'request\x20sent');logger[_0xffd6('0xf')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x5c19ee,'request\x20sent',JSON[_0xffd6('0x10')](_0x4267fc));if(_0x4267fc[_0xffd6('0x11')]){if(_0x4267fc[_0xffd6('0x11')]['code']===0x1f4){logger[_0xffd6('0x11')](_0xffd6('0xe'),_0x5c19ee,_0x4267fc['error'][_0xffd6('0x12')]);return _0x54d793(_0x4267fc[_0xffd6('0x11')][_0xffd6('0x12')]);}logger[_0xffd6('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x5c19ee,_0x4267fc['error'][_0xffd6('0x12')]);return _0x534a1b(_0x4267fc[_0xffd6('0x11')][_0xffd6('0x12')]);}else{logger['info'](_0xffd6('0xe'),_0x5c19ee,_0xffd6('0x13'));_0x534a1b(_0x4267fc['result'][_0xffd6('0x12')]);}})['catch'](function(_0x1881a1){logger[_0xffd6('0x11')](_0xffd6('0xe'),_0x5c19ee,_0x1881a1);_0x54d793(_0x1881a1);});});}exports[_0xffd6('0x14')]=function(_0x1c96dc){var _0x57af76=this;return new Promise(function(_0xe2f572,_0x39938d){return db[_0xffd6('0x15')][_0xffd6('0x16')](_0x1c96dc['body'],{'raw':_0x1c96dc['options']?_0x1c96dc[_0xffd6('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x453e4e){logger[_0xffd6('0xd')](_0xffd6('0x14'),_0x1c96dc);logger[_0xffd6('0xf')](_0xffd6('0x14'),_0x1c96dc,JSON[_0xffd6('0x10')](_0x453e4e));_0xe2f572(_0x453e4e);})['catch'](function(_0x44e5f5){logger[_0xffd6('0x11')]('CreateCmHopperHistory',_0x44e5f5[_0xffd6('0x12')],_0x1c96dc);_0x39938d(_0x57af76['error'](0x1f4,_0x44e5f5[_0xffd6('0x12')]));});});};exports[_0xffd6('0x18')]=function(_0x18fd0f){var _0x5e0e4c=this;return new Promise(function(_0x564623,_0x4b75c6){return db[_0xffd6('0x15')][_0xffd6('0x19')]({'raw':_0x18fd0f[_0xffd6('0x17')]?_0x18fd0f['options'][_0xffd6('0x1a')]===undefined?!![]:![]:!![],'where':_0x18fd0f[_0xffd6('0x17')]?_0x18fd0f[_0xffd6('0x17')][_0xffd6('0x1b')]||null:null,'attributes':[[db[_0xffd6('0x1c')]['fn']('COUNT',db[_0xffd6('0x1c')][_0xffd6('0x1d')]('id')),_0xffd6('0x1e')],[db[_0xffd6('0x1c')]['fn'](_0xffd6('0x1f'),db[_0xffd6('0x1c')]['fn']('IF',db[_0xffd6('0x1c')][_0xffd6('0x20')](_0xffd6('0x21')))),_0xffd6('0x22')],[db[_0xffd6('0x1c')]['fn']('COUNT',db[_0xffd6('0x1c')]['fn']('IF',db[_0xffd6('0x1c')][_0xffd6('0x20')](_0xffd6('0x23')))),_0xffd6('0x24')],[db[_0xffd6('0x1c')]['fn']('COUNT',db[_0xffd6('0x1c')]['fn']('IF',db[_0xffd6('0x1c')][_0xffd6('0x20')](_0xffd6('0x25')))),_0xffd6('0x26')],[db[_0xffd6('0x1c')]['fn'](_0xffd6('0x27'),db[_0xffd6('0x1c')]['fn']('IF',db[_0xffd6('0x1c')][_0xffd6('0x20')](_0xffd6('0x28')))),_0xffd6('0x29')],[db['sequelize']['fn'](_0xffd6('0x27'),db[_0xffd6('0x1c')]['fn']('IF',db[_0xffd6('0x1c')]['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})[_0xffd6('0xc')](function(_0x34c83a){logger[_0xffd6('0xd')](_0xffd6('0x18'),_0x18fd0f);logger[_0xffd6('0xf')](_0xffd6('0x18'),_0x18fd0f,JSON[_0xffd6('0x10')](_0x34c83a));_0x564623(_0x34c83a);})['catch'](function(_0x4655e7){logger['error'](_0xffd6('0x18'),_0x4655e7[_0xffd6('0x12')],_0x18fd0f);_0x4b75c6(_0x5e0e4c[_0xffd6('0x11')](0x1f4,_0x4655e7['message']));});});};exports[_0xffd6('0x2a')]=function(_0x2a38b9){var _0x5373dc=this;return new Promise(function(_0x3459f3,_0x504f7b){return db[_0xffd6('0x15')][_0xffd6('0x19')]({'raw':_0x2a38b9[_0xffd6('0x17')]?_0x2a38b9[_0xffd6('0x17')][_0xffd6('0x1a')]===undefined?!![]:![]:!![],'where':_0x2a38b9[_0xffd6('0x17')]?_0x2a38b9[_0xffd6('0x17')][_0xffd6('0x1b')]||null:null,'attributes':[[_0xffd6('0x2b'),'name'],[db[_0xffd6('0x1c')]['fn'](_0xffd6('0x1f'),db[_0xffd6('0x1c')]['fn']('IF',db[_0xffd6('0x1c')][_0xffd6('0x20')](_0xffd6('0x2c')))),_0xffd6('0x2d')],[db[_0xffd6('0x1c')]['fn'](_0xffd6('0x1f'),db[_0xffd6('0x1c')]['fn']('IF',db[_0xffd6('0x1c')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0xffd6('0x2e')],[db[_0xffd6('0x1c')]['fn']('COUNT',db[_0xffd6('0x1c')]['fn']('IF',db[_0xffd6('0x1c')][_0xffd6('0x20')](_0xffd6('0x21')))),_0xffd6('0x2f')],[db[_0xffd6('0x1c')]['fn'](_0xffd6('0x1f'),db[_0xffd6('0x1c')]['fn']('IF',db[_0xffd6('0x1c')][_0xffd6('0x20')](_0xffd6('0x30')))),_0xffd6('0x31')],[db[_0xffd6('0x1c')]['fn'](_0xffd6('0x1f'),db[_0xffd6('0x1c')]['fn']('IF',db[_0xffd6('0x1c')]['literal']('`state`\x20=\x208,\x201,\x20null'))),'outboundCongestionCallsDay'],[db[_0xffd6('0x1c')]['fn'](_0xffd6('0x1f'),db[_0xffd6('0x1c')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),'outboundDropCallsDayTimeout'],[db[_0xffd6('0x1c')]['fn'](_0xffd6('0x1f'),db[_0xffd6('0x1c')]['fn']('IF',db[_0xffd6('0x1c')][_0xffd6('0x20')](_0xffd6('0x32')))),_0xffd6('0x33')],[db[_0xffd6('0x1c')]['fn'](_0xffd6('0x1f'),db[_0xffd6('0x1c')]['fn']('IF',db[_0xffd6('0x1c')][_0xffd6('0x20')](_0xffd6('0x34')))),_0xffd6('0x35')],[db['sequelize']['fn'](_0xffd6('0x1f'),db[_0xffd6('0x1c')]['fn']('IF',db[_0xffd6('0x1c')][_0xffd6('0x20')](_0xffd6('0x36')))),'outboundBlacklistCallsDay'],[db[_0xffd6('0x1c')]['fn'](_0xffd6('0x1f'),db['sequelize']['fn']('IF',db[_0xffd6('0x1c')][_0xffd6('0x20')](_0xffd6('0x37')))),_0xffd6('0x38')],[db[_0xffd6('0x1c')]['fn'](_0xffd6('0x1f'),db[_0xffd6('0x1c')]['fn']('IF',db[_0xffd6('0x1c')][_0xffd6('0x20')]('`state`\x20=\x2018,\x201,\x20null'))),_0xffd6('0x39')],[db[_0xffd6('0x1c')]['fn']('COUNT',db[_0xffd6('0x1c')]['fn']('IF',db[_0xffd6('0x1c')][_0xffd6('0x20')]('`state`\x20=\x2016,\x201,\x20null'))),_0xffd6('0x3a')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xffd6('0x1c')]['literal'](_0xffd6('0x3b')))),_0xffd6('0x39')],[db[_0xffd6('0x1c')]['fn']('COUNT',db[_0xffd6('0x1c')]['fn']('IF',db['sequelize'][_0xffd6('0x20')](_0xffd6('0x3c')))),_0xffd6('0x3d')]],'group':[_0xffd6('0x2b')]})[_0xffd6('0xc')](function(_0x2a27d9){logger[_0xffd6('0xd')]('GetVoiceQueueHopperHistory',_0x2a38b9);logger[_0xffd6('0xf')](_0xffd6('0x2a'),_0x2a38b9,JSON[_0xffd6('0x10')](_0x2a27d9));_0x3459f3(_0x2a27d9);})[_0xffd6('0x3e')](function(_0x459cbe){logger[_0xffd6('0x11')](_0xffd6('0x2a'),_0x459cbe['message'],_0x2a38b9);_0x504f7b(_0x5373dc[_0xffd6('0x11')](0x1f4,_0x459cbe[_0xffd6('0x12')]));});});};exports[_0xffd6('0x3f')]=function(_0x3fbaaf){var _0x59eba5=this;return new Promise(function(_0x25f15e,_0x3a0cb5){return db[_0xffd6('0x15')][_0xffd6('0x19')]({'raw':_0x3fbaaf[_0xffd6('0x17')]?_0x3fbaaf[_0xffd6('0x17')][_0xffd6('0x1a')]===undefined?!![]:![]:!![],'where':_0x3fbaaf[_0xffd6('0x17')]?_0x3fbaaf[_0xffd6('0x17')]['where']||null:null,'attributes':[[_0xffd6('0x2b'),_0xffd6('0x40')],[db[_0xffd6('0x1c')]['fn'](_0xffd6('0x1f'),db[_0xffd6('0x1c')][_0xffd6('0x1d')]('id')),_0xffd6('0x41')],[db['sequelize']['fn'](_0xffd6('0x1f'),db[_0xffd6('0x1c')]['fn']('IF',db[_0xffd6('0x1c')][_0xffd6('0x20')](_0xffd6('0x21')))),_0xffd6('0x42')]],'group':['campaign']})[_0xffd6('0xc')](function(_0x39b2fd){logger[_0xffd6('0xd')](_0xffd6('0x3f'),_0x3fbaaf);logger[_0xffd6('0xf')](_0xffd6('0x3f'),_0x3fbaaf,JSON[_0xffd6('0x10')](_0x39b2fd));_0x25f15e(_0x39b2fd);})[_0xffd6('0x3e')](function(_0x1b0bfa){logger[_0xffd6('0x11')](_0xffd6('0x3f'),_0x1b0bfa['message'],_0x3fbaaf);_0x3a0cb5(_0x59eba5[_0xffd6('0x11')](0x1f4,_0x1b0bfa['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 5cbd0eb..6769964 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 _0x0fa8=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','update','exports','multer','connect-timeout','express','Router','fs-extra'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0fa8,0x1eb));var _0x80fa=function(_0x38b100,_0x177901){_0x38b100=_0x38b100-0x0;var _0x2bece2=_0x0fa8[_0x38b100];return _0x2bece2;};'use strict';var multer=require(_0x80fa('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x80fa('0x1'));var express=require(_0x80fa('0x2'));var router=express[_0x80fa('0x3')]();var fs_extra=require(_0x80fa('0x4'));var auth=require(_0x80fa('0x5'));var interaction=require(_0x80fa('0x6'));var config=require(_0x80fa('0x7'));var controller=require('./cmHopperHistory.controller');router[_0x80fa('0x8')]('/',auth[_0x80fa('0x9')](),controller[_0x80fa('0xa')]);router[_0x80fa('0x8')]('/describe',auth[_0x80fa('0x9')](),controller['describe']);router[_0x80fa('0x8')](_0x80fa('0xb'),auth[_0x80fa('0x9')](),controller[_0x80fa('0xc')]);router['post']('/',auth[_0x80fa('0x9')](),controller[_0x80fa('0xd')]);router['put'](_0x80fa('0xb'),auth[_0x80fa('0x9')](),controller[_0x80fa('0xe')]);module[_0x80fa('0xf')]=router; \ No newline at end of file +var _0xb888=['./cmHopperHistory.controller','isAuthenticated','index','get','/describe','describe','show','post','create','put','update','exports','util','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xb888,0xfa));var _0x8b88=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb888[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x8b88('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8b88('0x1'));var router=express['Router']();var fs_extra=require(_0x8b88('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x8b88('0x3'));var config=require(_0x8b88('0x4'));var controller=require(_0x8b88('0x5'));router['get']('/',auth[_0x8b88('0x6')](),controller[_0x8b88('0x7')]);router[_0x8b88('0x8')](_0x8b88('0x9'),auth['isAuthenticated'](),controller[_0x8b88('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8b88('0xb')]);router[_0x8b88('0xc')]('/',auth[_0x8b88('0x6')](),controller[_0x8b88('0xd')]);router[_0x8b88('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x8b88('0xf')]);module[_0x8b88('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 6fc7d08..f090c45 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 _0x7f42=['sequelize','STRING','name'];(function(_0x477ed5,_0x1e316b){var _0x3a6648=function(_0x13b146){while(--_0x13b146){_0x477ed5['push'](_0x477ed5['shift']());}};_0x3a6648(++_0x1e316b);}(_0x7f42,0x1dd));var _0x27f4=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x7f42[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x27f4('0x0'));module['exports']={'name':{'type':Sequelize[_0x27f4('0x1')],'unique':_0x27f4('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x27f4('0x1')]}}; \ No newline at end of file +var _0x4f99=['exports','name','STRING','sequelize'];(function(_0x9d1180,_0x2f71fb){var _0x155274=function(_0x1867c1){while(--_0x1867c1){_0x9d1180['push'](_0x9d1180['shift']());}};_0x155274(++_0x2f71fb);}(_0x4f99,0x157));var _0x94f9=function(_0x4511e6,_0x2c3afe){_0x4511e6=_0x4511e6-0x0;var _0x573951=_0x4f99[_0x4511e6];return _0x573951;};'use strict';var Sequelize=require(_0x94f9('0x0'));module[_0x94f9('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x94f9('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x94f9('0x3')]},'dialPrefix':{'type':Sequelize[_0x94f9('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 16f171e..aa699d2 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 _0x95fb=['getDispositions','findOne','order','pick','rows','removeDispositions','addContacts','CmContact','isArray','tags','join','push','each','omit','ids','success','dataValues','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','getContactsCsv','ContactItemType','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','isEmpty','now','writeFileSync','format','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','sequelize','transaction','text','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','getCustomFields','getGlobalCustomFields','findAndCountAll','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','info','eml-format','zip-dir','request-promise','bluebird','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','get','destroy','end','error','name','send','index','CmList','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','map','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition'];(function(_0x352e09,_0x37a7da){var _0x1b7094=function(_0x561074){while(--_0x561074){_0x352e09['push'](_0x352e09['shift']());}};_0x1b7094(++_0x37a7da);}(_0x95fb,0x175));var _0xb95f=function(_0x5b19f9,_0x1b0d27){_0x5b19f9=_0x5b19f9-0x0;var _0x19a71b=_0x95fb[_0x5b19f9];return _0x19a71b;};'use strict';var emlformat=require(_0xb95f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb95f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb95f('0x2'));var moment=require('moment');var BPromise=require(_0xb95f('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb95f('0x4'));var sox=require(_0xb95f('0x5'));var csv=require(_0xb95f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb95f('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb95f('0x8'));var jsforce=require(_0xb95f('0x9'));var deskjs=require(_0xb95f('0xa'));var toCsv=require(_0xb95f('0x6'));var querystring=require(_0xb95f('0xb'));var Papa=require(_0xb95f('0xc'));var Redis=require('ioredis');var authService=require(_0xb95f('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xb95f('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb95f('0xf'));var config=require(_0xb95f('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0xb95f('0x11'))['db'];var csv_results;config[_0xb95f('0x12')]=_[_0xb95f('0x13')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb95f('0x14'))(new Redis(config['redis']));require('./cmList.socket')[_0xb95f('0x15')](socket);function respondWithStatusCode(_0x3a1a07,_0x493c00){_0x493c00=_0x493c00||0xcc;return function(_0x490fd8){if(_0x490fd8){return _0x3a1a07[_0xb95f('0x16')](_0x493c00);}return _0x3a1a07[_0xb95f('0x17')](_0x493c00)['end']();};}function respondWithResult(_0x4b928a,_0x390115){_0x390115=_0x390115||0xc8;return function(_0x40d326){if(_0x40d326){return _0x4b928a[_0xb95f('0x17')](_0x390115)[_0xb95f('0x18')](_0x40d326);}};}function respondWithFilteredResult(_0xdcd618,_0x7853ec){return function(_0x43676c){if(_0x43676c){var _0x36aec1=typeof _0x7853ec[_0xb95f('0x19')]==='undefined'&&typeof _0x7853ec[_0xb95f('0x1a')]===_0xb95f('0x1b');var _0xb466d8=_0x43676c[_0xb95f('0x1c')];var _0x517333=_0x36aec1?0x0:_0x7853ec[_0xb95f('0x19')];var _0x4c64f5=_0x36aec1?_0x43676c['count']:_0x7853ec[_0xb95f('0x19')]+_0x7853ec[_0xb95f('0x1a')];var _0x5821cf;if(_0x4c64f5>=_0xb466d8){_0x4c64f5=_0xb466d8;_0x5821cf=0xc8;}else{_0x5821cf=0xce;}_0xdcd618[_0xb95f('0x17')](_0x5821cf);return _0xdcd618['set'](_0xb95f('0x1d'),_0x517333+'-'+_0x4c64f5+'/'+_0xb466d8)[_0xb95f('0x18')](_0x43676c);}return null;};}function patchUpdates(_0x21f54f){return function(_0x2a7b5f){try{jsonpatch[_0xb95f('0x1e')](_0x2a7b5f,_0x21f54f,!![]);}catch(_0x5464ce){return BPromise[_0xb95f('0x1f')](_0x5464ce);}return _0x2a7b5f[_0xb95f('0x20')]();};}function saveUpdates(_0x4d0433,_0x26d575){return function(_0x22b1f0){if(_0x22b1f0){return _0x22b1f0[_0xb95f('0x21')](_0x4d0433)[_0xb95f('0x22')](function(_0x328534){return _0x328534;});}return null;};}function removeEntity(_0x46e7fe,_0x33cf5d){return function(_0xe0d0c){if(_0xe0d0c){return _0xe0d0c['destroy']()[_0xb95f('0x22')](function(){var _0x48eb76=_0xe0d0c[_0xb95f('0x23')]({'plain':!![]});var _0x404304='Lists';return db['UserProfileResource'][_0xb95f('0x24')]({'where':{'type':_0x404304,'resourceId':_0x48eb76['id']}})[_0xb95f('0x22')](function(){return _0xe0d0c;});})[_0xb95f('0x22')](function(){_0x46e7fe[_0xb95f('0x17')](0xcc)[_0xb95f('0x25')]();});}};}function handleEntityNotFound(_0x197262,_0x2f6538){return function(_0x14332a){if(!_0x14332a){_0x197262[_0xb95f('0x16')](0x194);}return _0x14332a;};}function handleError(_0x560f31,_0x2765b3){_0x2765b3=_0x2765b3||0x1f4;return function(_0x1c7164){logger[_0xb95f('0x26')](_0x1c7164['stack']);if(_0x1c7164['name']){delete _0x1c7164[_0xb95f('0x27')];}_0x560f31[_0xb95f('0x17')](_0x2765b3)[_0xb95f('0x28')](_0x1c7164);};}exports[_0xb95f('0x29')]=function(_0xe7e309,_0x447b43){var _0x47bc2e={},_0x428c14={},_0x55039e={'count':0x0,'rows':[]};var _0xa67219=_['map'](db[_0xb95f('0x2a')]['rawAttributes'],function(_0x5e61a4){return{'name':_0x5e61a4[_0xb95f('0x2b')],'type':_0x5e61a4['type']['key']};});_0x428c14[_0xb95f('0x2c')]=_['map'](_0xa67219,_0xb95f('0x27'));_0x428c14[_0xb95f('0x2d')]=_[_0xb95f('0x2e')](_0xe7e309[_0xb95f('0x2d')]);_0x428c14[_0xb95f('0x2f')]=_[_0xb95f('0x30')](_0x428c14[_0xb95f('0x2c')],_0x428c14[_0xb95f('0x2d')]);_0x47bc2e[_0xb95f('0x31')]=_['intersection'](_0x428c14[_0xb95f('0x2c')],qs[_0xb95f('0x32')](_0xe7e309[_0xb95f('0x2d')][_0xb95f('0x32')]));_0x47bc2e[_0xb95f('0x31')]=_0x47bc2e[_0xb95f('0x31')][_0xb95f('0x33')]?_0x47bc2e[_0xb95f('0x31')]:_0x428c14[_0xb95f('0x2c')];if(!_0xe7e309[_0xb95f('0x2d')][_0xb95f('0x34')](_0xb95f('0x35'))){_0x47bc2e[_0xb95f('0x1a')]=qs[_0xb95f('0x1a')](_0xe7e309[_0xb95f('0x2d')][_0xb95f('0x1a')]);_0x47bc2e[_0xb95f('0x19')]=qs[_0xb95f('0x19')](_0xe7e309['query'][_0xb95f('0x19')]);}_0x47bc2e['order']=qs[_0xb95f('0x36')](_0xe7e309[_0xb95f('0x2d')][_0xb95f('0x36')]);_0x47bc2e[_0xb95f('0x37')]=qs[_0xb95f('0x2f')](_['pick'](_0xe7e309[_0xb95f('0x2d')],_0x428c14[_0xb95f('0x2f')]),_0xa67219);if(_0xe7e309[_0xb95f('0x2d')][_0xb95f('0x38')]){_0x47bc2e[_0xb95f('0x37')]=_['merge'](_0x47bc2e['where'],{'$or':_[_0xb95f('0x39')](_0xa67219,function(_0x5b22e6){if(_0x5b22e6[_0xb95f('0x3a')]!==_0xb95f('0x3b')){var _0x562dab={};_0x562dab[_0x5b22e6['name']]={'$like':'%'+_0xe7e309[_0xb95f('0x2d')]['filter']+'%'};return _0x562dab;}})});}_0x47bc2e=_[_0xb95f('0x3c')]({},_0x47bc2e,_0xe7e309[_0xb95f('0x3d')]);var _0x5d9cd3={'where':_0x47bc2e[_0xb95f('0x37')]};return db[_0xb95f('0x2a')]['count'](_0x5d9cd3)[_0xb95f('0x22')](function(_0x53f6ca){_0x55039e[_0xb95f('0x1c')]=_0x53f6ca;if(_0xe7e309[_0xb95f('0x2d')][_0xb95f('0x3e')]){_0x47bc2e[_0xb95f('0x3f')]=[{'all':!![]}];}return db[_0xb95f('0x2a')][_0xb95f('0x40')](_0x47bc2e);})[_0xb95f('0x22')](function(_0x360013){_0x55039e['rows']=_0x360013;return _0x55039e;})[_0xb95f('0x22')](respondWithFilteredResult(_0x447b43,_0x47bc2e))[_0xb95f('0x41')](handleError(_0x447b43,null));};exports[_0xb95f('0x42')]=function(_0x5a34e8,_0x50e326){var _0x5bf4ca={'raw':![],'where':{'id':_0x5a34e8[_0xb95f('0x43')]['id']}},_0x4a507b={};_0x4a507b['model']=_[_0xb95f('0x2e')](db['CmList'][_0xb95f('0x44')]);_0x4a507b[_0xb95f('0x2d')]=_[_0xb95f('0x2e')](_0x5a34e8[_0xb95f('0x2d')]);_0x4a507b[_0xb95f('0x2f')]=_[_0xb95f('0x30')](_0x4a507b[_0xb95f('0x2c')],_0x4a507b[_0xb95f('0x2d')]);_0x5bf4ca[_0xb95f('0x31')]=_[_0xb95f('0x30')](_0x4a507b[_0xb95f('0x2c')],qs[_0xb95f('0x32')](_0x5a34e8[_0xb95f('0x2d')][_0xb95f('0x32')]));_0x5bf4ca[_0xb95f('0x31')]=_0x5bf4ca['attributes'][_0xb95f('0x33')]?_0x5bf4ca[_0xb95f('0x31')]:_0x4a507b['model'];if(_0x5a34e8[_0xb95f('0x2d')][_0xb95f('0x3e')]){_0x5bf4ca[_0xb95f('0x3f')]=[{'all':!![]}];}_0x5bf4ca=_[_0xb95f('0x3c')]({},_0x5bf4ca,_0x5a34e8[_0xb95f('0x3d')]);return db['CmList'][_0xb95f('0x45')](_0x5bf4ca)[_0xb95f('0x22')](handleEntityNotFound(_0x50e326,null))[_0xb95f('0x22')](respondWithResult(_0x50e326,null))[_0xb95f('0x41')](handleError(_0x50e326,null));};exports[_0xb95f('0x46')]=function(_0x4d04ed,_0x1f233b){return db[_0xb95f('0x2a')][_0xb95f('0x46')](_0x4d04ed[_0xb95f('0x47')],{})[_0xb95f('0x22')](function(_0x225086){var _0x2bc928=_0x4d04ed['user'][_0xb95f('0x23')]({'plain':!![]});if(!_0x2bc928)throw new Error(_0xb95f('0x48'));if(_0x2bc928[_0xb95f('0x49')]===_0xb95f('0x4a')){var _0xbff100=_0x225086[_0xb95f('0x23')]({'plain':!![]});var _0x26af01='Lists';return db[_0xb95f('0x4b')][_0xb95f('0x45')]({'where':{'name':_0x26af01,'userProfileId':_0x2bc928[_0xb95f('0x4c')]},'raw':!![]})[_0xb95f('0x22')](function(_0x1129af){if(_0x1129af&&_0x1129af['autoAssociation']===0x0){return db[_0xb95f('0x4d')][_0xb95f('0x46')]({'name':_0xbff100[_0xb95f('0x27')],'resourceId':_0xbff100['id'],'type':_0x1129af[_0xb95f('0x27')],'sectionId':_0x1129af['id']},{})[_0xb95f('0x22')](function(){return _0x225086;});}else{return _0x225086;}})[_0xb95f('0x41')](function(_0x46fb53){logger[_0xb95f('0x26')](_0xb95f('0x4e'),_0x46fb53);throw _0x46fb53;});}return _0x225086;})[_0xb95f('0x22')](respondWithResult(_0x1f233b,0xc9))[_0xb95f('0x41')](handleError(_0x1f233b,null));};exports[_0xb95f('0x21')]=function(_0x28bc2e,_0x5e1b80){if(_0x28bc2e['body']['id']){delete _0x28bc2e[_0xb95f('0x47')]['id'];}return db[_0xb95f('0x2a')][_0xb95f('0x45')]({'where':{'id':_0x28bc2e['params']['id']}})[_0xb95f('0x22')](handleEntityNotFound(_0x5e1b80,null))['then'](saveUpdates(_0x28bc2e[_0xb95f('0x47')],null))['then'](respondWithResult(_0x5e1b80,null))[_0xb95f('0x41')](handleError(_0x5e1b80,null));};exports[_0xb95f('0x24')]=function(_0x3ade19,_0x1f009a){return db[_0xb95f('0x2a')][_0xb95f('0x45')]({'where':{'id':_0x3ade19['params']['id']}})[_0xb95f('0x22')](handleEntityNotFound(_0x1f009a,null))['then'](removeEntity(_0x1f009a,null))['catch'](handleError(_0x1f009a,null));};exports[_0xb95f('0x4f')]=function(_0x3a707f,_0x7a2aa6){return db[_0xb95f('0x2a')][_0xb95f('0x4f')]()[_0xb95f('0x22')](respondWithResult(_0x7a2aa6,null))[_0xb95f('0x41')](handleError(_0x7a2aa6,null));};exports[_0xb95f('0x50')]=function(_0x1ef516,_0x11e101,_0xce3304){if(_0x1ef516['body']['id']){delete _0x1ef516[_0xb95f('0x47')]['id'];}return db[_0xb95f('0x2a')][_0xb95f('0x45')]({'where':{'id':_0x1ef516['params']['id']}})[_0xb95f('0x22')](handleEntityNotFound(_0x11e101,null))[_0xb95f('0x22')](function(_0x186078){if(_0x186078){_0x1ef516[_0xb95f('0x47')][_0xb95f('0x51')]=_0x186078['id'];return db[_0xb95f('0x52')][_0xb95f('0x46')](_0x1ef516[_0xb95f('0x47')]);}})[_0xb95f('0x22')](respondWithResult(_0x11e101,null))[_0xb95f('0x41')](handleError(_0x11e101,null));};exports[_0xb95f('0x53')]=function(_0x46b04d,_0xb0eade,_0x4aac5f){var _0x544dca={'raw':![],'where':{}};var _0x3aec79={};var _0x12ca22={'count':0x0,'rows':[]};return db[_0xb95f('0x2a')][_0xb95f('0x54')]({'where':{'id':_0x46b04d[_0xb95f('0x43')]['id']}})['then'](handleEntityNotFound(_0xb0eade,null))[_0xb95f('0x22')](function(_0x55a458){if(_0x55a458){_0x3aec79[_0xb95f('0x2c')]=_[_0xb95f('0x2e')](db[_0xb95f('0x52')][_0xb95f('0x44')]);_0x3aec79[_0xb95f('0x2d')]=_[_0xb95f('0x2e')](_0x46b04d[_0xb95f('0x2d')]);_0x3aec79[_0xb95f('0x2f')]=_['intersection'](_0x3aec79[_0xb95f('0x2c')],_0x3aec79[_0xb95f('0x2d')]);_0x544dca[_0xb95f('0x31')]=_['intersection'](_0x3aec79[_0xb95f('0x2c')],qs[_0xb95f('0x32')](_0x46b04d[_0xb95f('0x2d')][_0xb95f('0x32')]));_0x544dca['attributes']=_0x544dca[_0xb95f('0x31')]['length']?_0x544dca[_0xb95f('0x31')]:_0x3aec79[_0xb95f('0x2c')];if(!_0x46b04d[_0xb95f('0x2d')][_0xb95f('0x34')](_0xb95f('0x35'))){_0x544dca['limit']=qs[_0xb95f('0x1a')](_0x46b04d[_0xb95f('0x2d')][_0xb95f('0x1a')]);_0x544dca[_0xb95f('0x19')]=qs['offset'](_0x46b04d[_0xb95f('0x2d')]['offset']);}_0x544dca[_0xb95f('0x55')]=qs[_0xb95f('0x36')](_0x46b04d[_0xb95f('0x2d')][_0xb95f('0x36')]);_0x544dca['where']=qs[_0xb95f('0x2f')](_[_0xb95f('0x56')](_0x46b04d[_0xb95f('0x2d')],_0x3aec79['filters']));_0x544dca[_0xb95f('0x37')][_0xb95f('0x51')]=_0x55a458['id'];if(_0x46b04d[_0xb95f('0x2d')][_0xb95f('0x38')]){_0x544dca[_0xb95f('0x37')]=_['merge'](_0x544dca[_0xb95f('0x37')],{'$or':_[_0xb95f('0x39')](_0x544dca[_0xb95f('0x31')],function(_0x122f53){var _0x303703={};_0x303703[_0x122f53]={'$like':'%'+_0x46b04d[_0xb95f('0x2d')][_0xb95f('0x38')]+'%'};return _0x303703;})});}_0x544dca=_[_0xb95f('0x3c')]({},_0x544dca,_0x46b04d['options']);return db[_0xb95f('0x52')]['count']({'where':_0x544dca[_0xb95f('0x37')]})[_0xb95f('0x22')](function(_0x5014e6){_0x12ca22[_0xb95f('0x1c')]=_0x5014e6;if(_0x46b04d[_0xb95f('0x2d')]['includeAll']){_0x544dca['include']=[{'all':!![]}];}return db[_0xb95f('0x52')][_0xb95f('0x40')](_0x544dca);})[_0xb95f('0x22')](function(_0x210cd5){_0x12ca22[_0xb95f('0x57')]=_0x210cd5;return _0x12ca22;});}})[_0xb95f('0x22')](respondWithFilteredResult(_0xb0eade,_0x544dca))[_0xb95f('0x41')](handleError(_0xb0eade,null));};exports[_0xb95f('0x58')]=function(_0x54276d,_0x2ff534,_0x5e4121){return db[_0xb95f('0x2a')][_0xb95f('0x45')]({'where':{'id':_0x54276d[_0xb95f('0x43')]['id']}})['then'](handleEntityNotFound(_0x2ff534,null))['then'](function(_0x53503c){if(_0x53503c){return _0x53503c[_0xb95f('0x58')](_0x54276d[_0xb95f('0x2d')]['ids']);}})[_0xb95f('0x22')](respondWithStatusCode(_0x2ff534,null))['catch'](handleError(_0x2ff534,null));};exports[_0xb95f('0x59')]=function(_0x1559dd,_0x8c5a6d,_0x32f333){return db[_0xb95f('0x2a')][_0xb95f('0x45')]({'where':{'id':_0x1559dd[_0xb95f('0x43')]['id']}})[_0xb95f('0x22')](handleEntityNotFound(_0x8c5a6d,null))[_0xb95f('0x22')](function(_0x5b1b32){if(_0x5b1b32){var _0x332b1b=[];var _0x38be37={'success':[],'errors':[]};return db[_0xb95f('0x5a')]['describe']()['then'](function(_0x40cb63){if(_0x1559dd[_0xb95f('0x47')]['tags']&&_[_0xb95f('0x5b')](_0x1559dd[_0xb95f('0x47')][_0xb95f('0x5c')])){if(_0x1559dd[_0xb95f('0x47')][_0xb95f('0x5c')][_0xb95f('0x33')]){_0x1559dd[_0xb95f('0x47')][_0xb95f('0x5c')]=_0x1559dd[_0xb95f('0x47')][_0xb95f('0x5c')][_0xb95f('0x5d')](';')+';';}else{_0x1559dd['body'][_0xb95f('0x5c')]=null;}}else{_0x1559dd[_0xb95f('0x47')][_0xb95f('0x5c')]=null;}if(_0x1559dd[_0xb95f('0x47')]&&_[_0xb95f('0x5b')](_0x1559dd['body'])){for(var _0x27bebf=0x0;_0x27bebf<_0x1559dd[_0xb95f('0x47')][_0xb95f('0x33')];_0x27bebf+=0x1){_0x1559dd[_0xb95f('0x47')][_0x27bebf]['ListId']=_0x1559dd[_0xb95f('0x43')]['id'];_0x332b1b[_0xb95f('0x5e')](_0x1559dd[_0xb95f('0x47')][_0x27bebf]);}return BPromise[_0xb95f('0x5f')](_0x332b1b,function(_0xf37df1){return db[_0xb95f('0x5a')]['create'](_[_0xb95f('0x60')](_0xf37df1,[_0xb95f('0x61'),'id'])||{},{'fields':_[_0xb95f('0x2e')](_0x40cb63),'raw':!![]})[_0xb95f('0x22')](function(_0x50671b){_0x38be37[_0xb95f('0x62')]['push'](_0x50671b[_0xb95f('0x63')]);})[_0xb95f('0x41')](function(_0x4b3e5a){_0x38be37['errors'][_0xb95f('0x5e')]({'data':_0xf37df1,'error':_0x4b3e5a[_0xb95f('0x64')]});});})[_0xb95f('0x22')](function(_0x354ca3){return _0x38be37;})[_0xb95f('0x41')](function(_0x15f6dc){return _0x15f6dc;});}else{_0x8c5a6d[_0xb95f('0x17')](0x190)['json']({'message':_0xb95f('0x65')});}});}})[_0xb95f('0x22')](respondWithResult(_0x8c5a6d,null))[_0xb95f('0x41')](handleError(_0x8c5a6d,null));};exports[_0xb95f('0x66')]=function(_0x33886a,_0x8226c9,_0x89a3cf){var _0x25bd99;return db[_0xb95f('0x2a')][_0xb95f('0x45')]({'where':{'id':_0x33886a[_0xb95f('0x43')]['id']},'include':[{'model':db[_0xb95f('0x67')],'as':'CustomFields'}]})[_0xb95f('0x22')](handleEntityNotFound(_0x8226c9,null))[_0xb95f('0x22')](function(_0x5db152){if(_0x5db152){_0x25bd99=_0x5db152;return db[_0xb95f('0x5a')][_0xb95f('0x44')];}})['then'](function(_0x1b8e14){if(_0x1b8e14){var _0x39d8b6={};var _0x3e0cea={};_0x3e0cea[_0xb95f('0x2c')]=_[_0xb95f('0x68')](_['keys'](_0x1b8e14),_[_0xb95f('0x39')](_0x25bd99[_0xb95f('0x69')],function(_0x24b91a){return util['format']('cf_%d',_0x24b91a['id']);}));_0x3e0cea['query']=_[_0xb95f('0x2e')](_0x33886a[_0xb95f('0x2d')]);_0x3e0cea[_0xb95f('0x2f')]=_[_0xb95f('0x30')](_0x3e0cea[_0xb95f('0x2c')],_0x3e0cea['query']);_0x39d8b6[_0xb95f('0x31')]=_['intersection'](_0x3e0cea[_0xb95f('0x2c')],qs[_0xb95f('0x32')](_0x33886a[_0xb95f('0x2d')][_0xb95f('0x32')]));_0x39d8b6[_0xb95f('0x31')]=_0x39d8b6[_0xb95f('0x31')][_0xb95f('0x33')]?_0x39d8b6[_0xb95f('0x31')]:_0x3e0cea['model'];if(!_0x33886a[_0xb95f('0x2d')][_0xb95f('0x34')]('nolimit')){_0x39d8b6['limit']=qs['limit'](_0x33886a[_0xb95f('0x2d')][_0xb95f('0x1a')]);_0x39d8b6['offset']=qs['offset'](_0x33886a[_0xb95f('0x2d')][_0xb95f('0x19')]);}_0x39d8b6['order']=qs[_0xb95f('0x36')](_0x33886a[_0xb95f('0x2d')][_0xb95f('0x36')]);_0x39d8b6[_0xb95f('0x37')]=qs['filters'](_['pick'](_0x33886a[_0xb95f('0x2d')],_0x3e0cea['filters']));_0x39d8b6['raw']=!![];if(_0x33886a['query']['filter']){_0x39d8b6[_0xb95f('0x37')]=_[_0xb95f('0x3c')](_0x39d8b6[_0xb95f('0x37')],{'$or':_[_0xb95f('0x39')](_0x39d8b6[_0xb95f('0x31')],function(_0x182d56){var _0x5774a1={};_0x5774a1[_0x182d56]={'$like':'%'+_0x33886a[_0xb95f('0x2d')][_0xb95f('0x38')]+'%'};return _0x5774a1;})});}_0x39d8b6=_[_0xb95f('0x3c')]({},_0x39d8b6,_0x33886a[_0xb95f('0x3d')]);return _0x25bd99[_0xb95f('0x66')](_0x39d8b6);}})[_0xb95f('0x22')](respondWithResult(_0x8226c9,null))[_0xb95f('0x41')](handleError(_0x8226c9,null));};exports[_0xb95f('0x6a')]=function(_0x55a0a8,_0x324161,_0x125a04){var _0x1698b8;var _0x404ed6;var _0x37085c;var _0x4126a9=_0x55a0a8[_0xb95f('0x43')]['id'];csv_results=[];return db[_0xb95f('0x6b')][_0xb95f('0x40')]({'attributes':['id',_0xb95f('0x27')],'raw':!![],'order':['OrderBy']})[_0xb95f('0x22')](function(_0x3af074){_0x1698b8=_0x3af074;var _0x5d285f=_[_0xb95f('0x2e')](db[_0xb95f('0x5a')][_0xb95f('0x44')]);return db['CmCustomField']['findAll']({'raw':!![],'attributes':['id',_0xb95f('0x6c')]})[_0xb95f('0x22')](function(_0x18fd37){_0x404ed6=_0x18fd37;var _0x144ad2=squel[_0xb95f('0x6d')]()['fields'](_0x5d285f)[_0xb95f('0x6e')](_0xb95f('0x6f'),'c')[_0xb95f('0x37')](_0xb95f('0x70'),_0x4126a9)[_0xb95f('0x37')](_0xb95f('0x71'))['distinct']();for(var _0x2818fc=0x0;_0x2818fc<_0x404ed6[_0xb95f('0x33')];_0x2818fc++){_0x144ad2[_0xb95f('0x72')](_0xb95f('0x73')+_0x404ed6[_0x2818fc]['id'],_0xb95f('0x74')+_0x404ed6[_0x2818fc][_0xb95f('0x6c')]);}for(var _0x2818fc=0x0;_0x2818fc<_0x1698b8[_0xb95f('0x33')];_0x2818fc++){_0x144ad2[_0xb95f('0x72')](squel[_0xb95f('0x6d')]()[_0xb95f('0x72')](_0xb95f('0x75'))[_0xb95f('0x6e')](_0xb95f('0x76'))[_0xb95f('0x37')](_0xb95f('0x77'),_0x1698b8[_0x2818fc]['id'])[_0xb95f('0x37')](_0xb95f('0x78')),'additionalPhone_'+_0x1698b8[_0x2818fc][_0xb95f('0x27')]);_0x144ad2[_0xb95f('0x72')](squel[_0xb95f('0x6d')]()[_0xb95f('0x72')]('description')[_0xb95f('0x6e')](_0xb95f('0x76'))[_0xb95f('0x37')]('ItemTypeId\x20=\x20?',_0x1698b8[_0x2818fc]['id'])['where']('CmContactId\x20=\x20c.id'),_0xb95f('0x79')+_0x1698b8[_0x2818fc][_0xb95f('0x27')]);}var _0x34b6b7=[];_0x34b6b7[_0xb95f('0x5e')](_0x144ad2['toString']());BPromise[_0xb95f('0x5f')](_0x34b6b7,handleQuery)[_0xb95f('0x22')](function(_0xa4d811){handleQuery(_0x144ad2[_0xb95f('0x7a')]());var _0x42e378=csv_results[0x0];if(!_[_0xb95f('0x7b')](_0x42e378)){var _0x2c4aa5=toCsv(_0x42e378);var _0x41a741=Date[_0xb95f('0x7c')]();fs[_0xb95f('0x7d')](util[_0xb95f('0x7e')](_0xb95f('0x7f'),_0x4126a9,_0x41a741),_0x2c4aa5);_0x324161[_0xb95f('0x80')](_0xb95f('0x81'),_0xb95f('0x82')+util[_0xb95f('0x7e')](_0xb95f('0x83'),_0x4126a9,_0x41a741));_0x324161[_0xb95f('0x80')]('Content-type',_0xb95f('0x84'));return _0x324161['download'](util['format']('/tmp/list_%d_%s.csv',_0x4126a9,_0x41a741));}else{return _0x324161['sendStatus'](0xcc);}});});});};exports['addCustomField']=function(_0xb44b65,_0x4f3b68,_0x5445e1){var _0x335b6a;delete _0xb44b65[_0xb95f('0x47')]['id'];return db[_0xb95f('0x2a')][_0xb95f('0x54')]({'where':{'id':_0xb44b65[_0xb95f('0x43')]['id']}})[_0xb95f('0x22')](handleEntityNotFound(_0x4f3b68,null))['then'](function(_0x2b3a05){if(_0x2b3a05){return db[_0xb95f('0x85')][_0xb95f('0x86')](function(_0x3724c8){return db[_0xb95f('0x67')][_0xb95f('0x46')](_0xb44b65[_0xb95f('0x47')],{'transaction':_0x3724c8})[_0xb95f('0x22')](function(_0x3db97d){_0x335b6a=_0x3db97d;return _0x2b3a05['addCustomFields'](_0x3db97d,{'transaction':_0x3724c8});})[_0xb95f('0x22')](function(){var _0x329a22={'type':db['Sequelize']['TEXT'],'transaction':_0x3724c8};switch(_0xb44b65[_0xb95f('0x47')][_0xb95f('0x3a')]){case _0xb95f('0x87'):_0x329a22[_0xb95f('0x3a')]=db[_0xb95f('0x88')]['TEXT'];break;case _0xb95f('0x89'):_0x329a22[_0xb95f('0x3a')]=db[_0xb95f('0x88')][_0xb95f('0x8a')];break;case _0xb95f('0x8b'):_0x329a22[_0xb95f('0x3a')]=db['Sequelize'][_0xb95f('0x8c')];_0x329a22[_0xb95f('0x8d')]=![];break;default:}return db[_0xb95f('0x85')]['queryInterface']['addColumn'](_0xb95f('0x6f'),util[_0xb95f('0x7e')]('cf_%s',_0x335b6a['id']),_0x329a22);})[_0xb95f('0x22')](function(){return _0x335b6a;});});}})[_0xb95f('0x22')](respondWithResult(_0x4f3b68,null))['catch'](handleError(_0x4f3b68,null));};exports[_0xb95f('0x8e')]=function(_0x3a7f03,_0x4e2d2a,_0x57ae10){var _0x50607b={};var _0x4ca783={};var _0x459dce;var _0x23d1c7;return db[_0xb95f('0x2a')][_0xb95f('0x54')]({'where':{'id':_0x3a7f03[_0xb95f('0x43')]['id']}})[_0xb95f('0x22')](handleEntityNotFound(_0x4e2d2a,null))[_0xb95f('0x22')](function(_0x433a4f){if(_0x433a4f){_0x459dce=_0x433a4f;_0x4ca783[_0xb95f('0x2c')]=_[_0xb95f('0x2e')](db[_0xb95f('0x67')]['rawAttributes']);_0x4ca783[_0xb95f('0x2d')]=_[_0xb95f('0x2e')](_0x3a7f03[_0xb95f('0x2d')]);_0x4ca783['filters']=_['intersection'](_0x4ca783[_0xb95f('0x2c')],_0x4ca783[_0xb95f('0x2d')]);_0x50607b[_0xb95f('0x31')]=_[_0xb95f('0x30')](_0x4ca783[_0xb95f('0x2c')],qs[_0xb95f('0x32')](_0x3a7f03[_0xb95f('0x2d')]['fields']));_0x50607b[_0xb95f('0x31')]=_0x50607b[_0xb95f('0x31')][_0xb95f('0x33')]?_0x50607b['attributes']:_0x4ca783[_0xb95f('0x2c')];_0x50607b[_0xb95f('0x55')]=qs[_0xb95f('0x36')](_0x3a7f03[_0xb95f('0x2d')]['sort']);_0x50607b[_0xb95f('0x37')]=qs[_0xb95f('0x2f')](_[_0xb95f('0x56')](_0x3a7f03[_0xb95f('0x2d')],_0x4ca783[_0xb95f('0x2f')]));_0x50607b[_0xb95f('0x37')]=_[_0xb95f('0x3c')](_0x50607b[_0xb95f('0x37')],{'$or':[{'ListId':_0x433a4f['id']},{'ListId':null}]});if(_0x3a7f03[_0xb95f('0x2d')][_0xb95f('0x38')]){_0x50607b[_0xb95f('0x37')]=_[_0xb95f('0x3c')](_0x50607b[_0xb95f('0x37')],{'$or':_[_0xb95f('0x39')](_0x50607b[_0xb95f('0x31')],function(_0x285b75){var _0x508b6c={};_0x508b6c[_0x285b75]={'$like':'%'+_0x3a7f03['query']['filter']+'%'};return _0x508b6c;})});}_0x50607b=_[_0xb95f('0x3c')]({},_0x50607b,_0x3a7f03[_0xb95f('0x3d')]);return db[_0xb95f('0x67')]['findAndCountAll'](_0x50607b);}})[_0xb95f('0x22')](respondWithResult(_0x4e2d2a,null))[_0xb95f('0x41')](handleError(_0x4e2d2a,null));};exports[_0xb95f('0x8f')]=function(_0x2aff23,_0x5c2fd5){return db[_0xb95f('0x67')][_0xb95f('0x90')]({'where':{'ListId':null}})[_0xb95f('0x22')](handleEntityNotFound(_0x5c2fd5,null))['then'](function(_0xc0b551){return _0xc0b551;})[_0xb95f('0x22')](respondWithResult(_0x5c2fd5,null))[_0xb95f('0x41')](handleError(_0x5c2fd5,null));};exports[_0xb95f('0x91')]=function(_0x1ea43d,_0x5d5b11,_0xdf7409){return db['CmList']['find']({'where':{'id':_0x1ea43d[_0xb95f('0x43')]['id']}})[_0xb95f('0x22')](handleEntityNotFound(_0x5d5b11,null))[_0xb95f('0x22')](function(_0x7317d8){if(_0x7317d8){return _0x7317d8[_0xb95f('0x91')](_0x1ea43d[_0xb95f('0x47')][_0xb95f('0x61')],_['omit'](_0x1ea43d['body'],['ids','id'])||{})[_0xb95f('0x92')](function(_0x6c40e5){for(var _0x5d2c74=0x0;_0x5d2c74<_0x1ea43d['body']['ids'][_0xb95f('0x33')];_0x5d2c74+=0x1){socket[_0xb95f('0x93')]('userCmList:save',{'UserId':Number(_0x1ea43d[_0xb95f('0x47')][_0xb95f('0x61')][_0x5d2c74]),'CmListId':Number(_0x1ea43d[_0xb95f('0x43')]['id'])});}return _0x6c40e5;});}})[_0xb95f('0x22')](respondWithResult(_0x5d5b11,null))[_0xb95f('0x41')](handleError(_0x5d5b11,null));};exports['removeAgents']=function(_0x169a16,_0x462c01,_0x4d72dc){return db[_0xb95f('0x2a')][_0xb95f('0x45')]({'where':{'id':_0x169a16[_0xb95f('0x43')]['id']}})[_0xb95f('0x22')](handleEntityNotFound(_0x462c01,null))[_0xb95f('0x22')](function(_0x46c4e2){if(_0x46c4e2){return _0x46c4e2[_0xb95f('0x94')](_0x169a16[_0xb95f('0x2d')]['ids'])[_0xb95f('0x22')](function(){if(_[_0xb95f('0x5b')](_0x169a16[_0xb95f('0x2d')]['ids'])){for(var _0x3eeb41=0x0;_0x3eeb41<_0x169a16['query'][_0xb95f('0x61')][_0xb95f('0x33')];_0x3eeb41+=0x1){socket[_0xb95f('0x93')]('userCmList:remove',{'UserId':Number(_0x169a16['query'][_0xb95f('0x61')][_0x3eeb41]),'CmListId':Number(_0x169a16[_0xb95f('0x43')]['id'])});}}else{socket[_0xb95f('0x93')](_0xb95f('0x95'),{'UserId':Number(_0x169a16[_0xb95f('0x2d')][_0xb95f('0x61')]),'CmListId':Number(_0x169a16[_0xb95f('0x43')]['id'])});}});}})[_0xb95f('0x22')](respondWithStatusCode(_0x462c01,null))[_0xb95f('0x41')](handleError(_0x462c01,null));};exports[_0xb95f('0x96')]=function(_0x5a09b4,_0xf10b58,_0x2da087){var _0x2cfbab={};var _0x447984={};var _0x308156;var _0x9f3134;return db[_0xb95f('0x2a')][_0xb95f('0x54')]({'where':{'id':_0x5a09b4['params']['id']}})[_0xb95f('0x22')](handleEntityNotFound(_0xf10b58,null))['then'](function(_0x5d53c6){if(_0x5d53c6){_0x308156=_0x5d53c6;_0x447984[_0xb95f('0x2c')]=_['keys'](db['User'][_0xb95f('0x44')]);_0x447984[_0xb95f('0x2d')]=_['keys'](_0x5a09b4[_0xb95f('0x2d')]);_0x447984[_0xb95f('0x2f')]=_[_0xb95f('0x30')](_0x447984['model'],_0x447984[_0xb95f('0x2d')]);_0x2cfbab[_0xb95f('0x31')]=_['intersection'](_0x447984[_0xb95f('0x2c')],qs[_0xb95f('0x32')](_0x5a09b4[_0xb95f('0x2d')][_0xb95f('0x32')]));_0x2cfbab['attributes']=_0x2cfbab[_0xb95f('0x31')][_0xb95f('0x33')]?_0x2cfbab[_0xb95f('0x31')]:_0x447984[_0xb95f('0x2c')];_0x2cfbab['order']=qs[_0xb95f('0x36')](_0x5a09b4[_0xb95f('0x2d')][_0xb95f('0x36')]);_0x2cfbab[_0xb95f('0x37')]=qs[_0xb95f('0x2f')](_['pick'](_0x5a09b4[_0xb95f('0x2d')],_0x447984[_0xb95f('0x2f')]));if(_0x5a09b4[_0xb95f('0x2d')][_0xb95f('0x38')]){_0x2cfbab[_0xb95f('0x37')]=_[_0xb95f('0x3c')](_0x2cfbab[_0xb95f('0x37')],{'$or':_[_0xb95f('0x39')](_0x2cfbab['attributes'],function(_0x69643a){var _0x95d6f5={};_0x95d6f5[_0x69643a]={'$like':'%'+_0x5a09b4[_0xb95f('0x2d')][_0xb95f('0x38')]+'%'};return _0x95d6f5;})});}_0x2cfbab=_[_0xb95f('0x3c')]({},_0x2cfbab,_0x5a09b4[_0xb95f('0x3d')]);return _0x308156[_0xb95f('0x96')](_0x2cfbab);}})['then'](function(_0x131d95){if(_0x131d95){_0x9f3134=_0x131d95[_0xb95f('0x33')];if(!_0x5a09b4[_0xb95f('0x2d')][_0xb95f('0x34')](_0xb95f('0x35'))){_0x2cfbab[_0xb95f('0x1a')]=qs[_0xb95f('0x1a')](_0x5a09b4[_0xb95f('0x2d')][_0xb95f('0x1a')]);_0x2cfbab[_0xb95f('0x19')]=qs[_0xb95f('0x19')](_0x5a09b4[_0xb95f('0x2d')][_0xb95f('0x19')]);}return _0x308156[_0xb95f('0x96')](_0x2cfbab);}})[_0xb95f('0x22')](function(_0x34dbf7){if(_0x34dbf7){return _0x34dbf7?{'count':_0x9f3134,'rows':_0x34dbf7}:null;}})['then'](respondWithResult(_0xf10b58,null))[_0xb95f('0x41')](handleError(_0xf10b58,null));};function handleQuery(_0x5f3321){logger[_0xb95f('0x97')](_0x5f3321);return db[_0xb95f('0x85')]['query'](_0x5f3321)[_0xb95f('0x92')](function(_0x2035bd){csv_results[_0xb95f('0x5e')](_0x2035bd);})[_0xb95f('0x41')](function(_0x3958a6){logger['error'](_0x3958a6[_0xb95f('0x64')]);});} \ No newline at end of file +var _0x2a67=['set','apply','reject','save','then','destroy','get','Lists','error','stack','name','send','map','CmList','rawAttributes','fieldName','type','key','query','keys','fields','attributes','length','model','hasOwnProperty','order','filters','filter','where','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ListId','Disposition','getDispositions','nolimit','sort','pick','options','rows','removeDispositions','CmContact','tags','isArray','each','omit','ids','success','push','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','cf_%d','intersection','raw','getContactsCsv','ContactItemType','OrderBy','alias','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','customField_','select','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','format','list_%d_%s.csv','text/csv','download','findOne','sequelize','transaction','TEXT','text','number','Sequelize','switch','BOOLEAN','defaultValue','addColumn','findAndCountAll','getGlobalCustomFields','addAgents','emit','userCmList:remove','User','getAgents','info','spread','eml-format','rimraf','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmList.socket','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x746a1,_0x1fbc39){var _0x51dc60=function(_0x53dd31){while(--_0x53dd31){_0x746a1['push'](_0x746a1['shift']());}};_0x51dc60(++_0x1fbc39);}(_0x2a67,0x123));var _0x72a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a67[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x72a6('0x0'));var rimraf=require(_0x72a6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x72a6('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x72a6('0x3'));var util=require(_0x72a6('0x4'));var path=require('path');var sox=require(_0x72a6('0x5'));var csv=require(_0x72a6('0x6'));var ejs=require(_0x72a6('0x7'));var fs=require('fs');var fs_extra=require(_0x72a6('0x8'));var _=require(_0x72a6('0x9'));var squel=require(_0x72a6('0xa'));var crypto=require(_0x72a6('0xb'));var jsforce=require(_0x72a6('0xc'));var deskjs=require(_0x72a6('0xd'));var toCsv=require(_0x72a6('0x6'));var querystring=require(_0x72a6('0xe'));var Papa=require(_0x72a6('0xf'));var Redis=require(_0x72a6('0x10'));var authService=require(_0x72a6('0x11'));var qs=require(_0x72a6('0x12'));var as=require(_0x72a6('0x13'));var hardwareService=require(_0x72a6('0x14'));var logger=require(_0x72a6('0x15'))(_0x72a6('0x16'));var utils=require(_0x72a6('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x72a6('0x18'));var db=require(_0x72a6('0x19'))['db'];var csv_results;config['redis']=_[_0x72a6('0x1a')](config[_0x72a6('0x1b')],{'host':_0x72a6('0x1c'),'port':0x18eb});var socket=require(_0x72a6('0x1d'))(new Redis(config[_0x72a6('0x1b')]));require(_0x72a6('0x1e'))['register'](socket);function respondWithStatusCode(_0x343427,_0x233ef0){_0x233ef0=_0x233ef0||0xcc;return function(_0x498199){if(_0x498199){return _0x343427[_0x72a6('0x1f')](_0x233ef0);}return _0x343427[_0x72a6('0x20')](_0x233ef0)[_0x72a6('0x21')]();};}function respondWithResult(_0x25a849,_0x4f3f7a){_0x4f3f7a=_0x4f3f7a||0xc8;return function(_0xa98563){if(_0xa98563){return _0x25a849[_0x72a6('0x20')](_0x4f3f7a)[_0x72a6('0x22')](_0xa98563);}};}function respondWithFilteredResult(_0x2eafe3,_0x3fc7a8){return function(_0x26fe78){if(_0x26fe78){var _0x19939e=typeof _0x3fc7a8[_0x72a6('0x23')]===_0x72a6('0x24')&&typeof _0x3fc7a8[_0x72a6('0x25')]==='undefined';var _0x46bcb0=_0x26fe78['count'];var _0x4d39c0=_0x19939e?0x0:_0x3fc7a8['offset'];var _0x46ef1e=_0x19939e?_0x26fe78[_0x72a6('0x26')]:_0x3fc7a8[_0x72a6('0x23')]+_0x3fc7a8[_0x72a6('0x25')];var _0x30dd6a;if(_0x46ef1e>=_0x46bcb0){_0x46ef1e=_0x46bcb0;_0x30dd6a=0xc8;}else{_0x30dd6a=0xce;}_0x2eafe3['status'](_0x30dd6a);return _0x2eafe3[_0x72a6('0x27')]('Content-Range',_0x4d39c0+'-'+_0x46ef1e+'/'+_0x46bcb0)[_0x72a6('0x22')](_0x26fe78);}return null;};}function patchUpdates(_0x2353ec){return function(_0x39ee5e){try{jsonpatch[_0x72a6('0x28')](_0x39ee5e,_0x2353ec,!![]);}catch(_0x56c479){return BPromise[_0x72a6('0x29')](_0x56c479);}return _0x39ee5e[_0x72a6('0x2a')]();};}function saveUpdates(_0x3750d4,_0x14f13d){return function(_0x5e110b){if(_0x5e110b){return _0x5e110b['update'](_0x3750d4)[_0x72a6('0x2b')](function(_0x1bf82a){return _0x1bf82a;});}return null;};}function removeEntity(_0x139d1e,_0x1b27dd){return function(_0x526001){if(_0x526001){return _0x526001[_0x72a6('0x2c')]()[_0x72a6('0x2b')](function(){var _0x2de0c5=_0x526001[_0x72a6('0x2d')]({'plain':!![]});var _0x1fe0a8=_0x72a6('0x2e');return db['UserProfileResource'][_0x72a6('0x2c')]({'where':{'type':_0x1fe0a8,'resourceId':_0x2de0c5['id']}})[_0x72a6('0x2b')](function(){return _0x526001;});})[_0x72a6('0x2b')](function(){_0x139d1e[_0x72a6('0x20')](0xcc)[_0x72a6('0x21')]();});}};}function handleEntityNotFound(_0x31fdfc,_0xa4e05b){return function(_0x500d90){if(!_0x500d90){_0x31fdfc['sendStatus'](0x194);}return _0x500d90;};}function handleError(_0x5da697,_0x481482){_0x481482=_0x481482||0x1f4;return function(_0x17bbbf){logger[_0x72a6('0x2f')](_0x17bbbf[_0x72a6('0x30')]);if(_0x17bbbf[_0x72a6('0x31')]){delete _0x17bbbf[_0x72a6('0x31')];}_0x5da697['status'](_0x481482)[_0x72a6('0x32')](_0x17bbbf);};}exports['index']=function(_0x4346cf,_0x1294fc){var _0x431c14={},_0x3773ad={},_0x20a08a={'count':0x0,'rows':[]};var _0x1d12ef=_[_0x72a6('0x33')](db[_0x72a6('0x34')][_0x72a6('0x35')],function(_0x27c223){return{'name':_0x27c223[_0x72a6('0x36')],'type':_0x27c223[_0x72a6('0x37')][_0x72a6('0x38')]};});_0x3773ad['model']=_['map'](_0x1d12ef,_0x72a6('0x31'));_0x3773ad[_0x72a6('0x39')]=_[_0x72a6('0x3a')](_0x4346cf[_0x72a6('0x39')]);_0x3773ad['filters']=_['intersection'](_0x3773ad['model'],_0x3773ad[_0x72a6('0x39')]);_0x431c14['attributes']=_['intersection'](_0x3773ad['model'],qs[_0x72a6('0x3b')](_0x4346cf[_0x72a6('0x39')][_0x72a6('0x3b')]));_0x431c14[_0x72a6('0x3c')]=_0x431c14['attributes'][_0x72a6('0x3d')]?_0x431c14['attributes']:_0x3773ad[_0x72a6('0x3e')];if(!_0x4346cf[_0x72a6('0x39')][_0x72a6('0x3f')]('nolimit')){_0x431c14[_0x72a6('0x25')]=qs[_0x72a6('0x25')](_0x4346cf['query'][_0x72a6('0x25')]);_0x431c14['offset']=qs[_0x72a6('0x23')](_0x4346cf[_0x72a6('0x39')][_0x72a6('0x23')]);}_0x431c14[_0x72a6('0x40')]=qs['sort'](_0x4346cf['query']['sort']);_0x431c14['where']=qs[_0x72a6('0x41')](_['pick'](_0x4346cf['query'],_0x3773ad['filters']),_0x1d12ef);if(_0x4346cf[_0x72a6('0x39')][_0x72a6('0x42')]){_0x431c14[_0x72a6('0x43')]=_[_0x72a6('0x44')](_0x431c14['where'],{'$or':_[_0x72a6('0x33')](_0x1d12ef,function(_0x21bfd2){if(_0x21bfd2[_0x72a6('0x37')]!==_0x72a6('0x45')){var _0x2c82ee={};_0x2c82ee[_0x21bfd2[_0x72a6('0x31')]]={'$like':'%'+_0x4346cf[_0x72a6('0x39')][_0x72a6('0x42')]+'%'};return _0x2c82ee;}})});}_0x431c14=_[_0x72a6('0x44')]({},_0x431c14,_0x4346cf['options']);var _0x1644ec={'where':_0x431c14[_0x72a6('0x43')]};return db['CmList'][_0x72a6('0x26')](_0x1644ec)['then'](function(_0x3976a7){_0x20a08a[_0x72a6('0x26')]=_0x3976a7;if(_0x4346cf[_0x72a6('0x39')][_0x72a6('0x46')]){_0x431c14[_0x72a6('0x47')]=[{'all':!![]}];}return db['CmList'][_0x72a6('0x48')](_0x431c14);})[_0x72a6('0x2b')](function(_0x50c42f){_0x20a08a['rows']=_0x50c42f;return _0x20a08a;})['then'](respondWithFilteredResult(_0x1294fc,_0x431c14))[_0x72a6('0x49')](handleError(_0x1294fc,null));};exports[_0x72a6('0x4a')]=function(_0xe46dc8,_0x2f3943){var _0x450fd7={'raw':![],'where':{'id':_0xe46dc8[_0x72a6('0x4b')]['id']}},_0x20ac5a={};_0x20ac5a[_0x72a6('0x3e')]=_[_0x72a6('0x3a')](db['CmList'][_0x72a6('0x35')]);_0x20ac5a['query']=_[_0x72a6('0x3a')](_0xe46dc8[_0x72a6('0x39')]);_0x20ac5a[_0x72a6('0x41')]=_['intersection'](_0x20ac5a[_0x72a6('0x3e')],_0x20ac5a['query']);_0x450fd7[_0x72a6('0x3c')]=_['intersection'](_0x20ac5a[_0x72a6('0x3e')],qs[_0x72a6('0x3b')](_0xe46dc8[_0x72a6('0x39')][_0x72a6('0x3b')]));_0x450fd7[_0x72a6('0x3c')]=_0x450fd7['attributes']['length']?_0x450fd7[_0x72a6('0x3c')]:_0x20ac5a[_0x72a6('0x3e')];if(_0xe46dc8[_0x72a6('0x39')][_0x72a6('0x46')]){_0x450fd7[_0x72a6('0x47')]=[{'all':!![]}];}_0x450fd7=_[_0x72a6('0x44')]({},_0x450fd7,_0xe46dc8['options']);return db[_0x72a6('0x34')][_0x72a6('0x4c')](_0x450fd7)['then'](handleEntityNotFound(_0x2f3943,null))[_0x72a6('0x2b')](respondWithResult(_0x2f3943,null))[_0x72a6('0x49')](handleError(_0x2f3943,null));};exports[_0x72a6('0x4d')]=function(_0x46b0ba,_0x374152){return db[_0x72a6('0x34')][_0x72a6('0x4d')](_0x46b0ba[_0x72a6('0x4e')],{})[_0x72a6('0x2b')](function(_0x1f97bd){var _0x446e15=_0x46b0ba[_0x72a6('0x4f')][_0x72a6('0x2d')]({'plain':!![]});if(!_0x446e15)throw new Error(_0x72a6('0x50'));if(_0x446e15[_0x72a6('0x51')]===_0x72a6('0x4f')){var _0x40fc34=_0x1f97bd[_0x72a6('0x2d')]({'plain':!![]});var _0x4bf7e2=_0x72a6('0x2e');return db[_0x72a6('0x52')]['find']({'where':{'name':_0x4bf7e2,'userProfileId':_0x446e15[_0x72a6('0x53')]},'raw':!![]})[_0x72a6('0x2b')](function(_0x20bb14){if(_0x20bb14&&_0x20bb14[_0x72a6('0x54')]===0x0){return db[_0x72a6('0x55')]['create']({'name':_0x40fc34[_0x72a6('0x31')],'resourceId':_0x40fc34['id'],'type':_0x20bb14[_0x72a6('0x31')],'sectionId':_0x20bb14['id']},{})['then'](function(){return _0x1f97bd;});}else{return _0x1f97bd;}})['catch'](function(_0x4c43d9){logger[_0x72a6('0x2f')](_0x72a6('0x56'),_0x4c43d9);throw _0x4c43d9;});}return _0x1f97bd;})['then'](respondWithResult(_0x374152,0xc9))['catch'](handleError(_0x374152,null));};exports[_0x72a6('0x57')]=function(_0x2db186,_0xfdf1df){if(_0x2db186[_0x72a6('0x4e')]['id']){delete _0x2db186[_0x72a6('0x4e')]['id'];}return db['CmList'][_0x72a6('0x4c')]({'where':{'id':_0x2db186[_0x72a6('0x4b')]['id']}})[_0x72a6('0x2b')](handleEntityNotFound(_0xfdf1df,null))[_0x72a6('0x2b')](saveUpdates(_0x2db186[_0x72a6('0x4e')],null))[_0x72a6('0x2b')](respondWithResult(_0xfdf1df,null))['catch'](handleError(_0xfdf1df,null));};exports[_0x72a6('0x2c')]=function(_0x1582c9,_0xd497cc){return db[_0x72a6('0x34')][_0x72a6('0x4c')]({'where':{'id':_0x1582c9[_0x72a6('0x4b')]['id']}})[_0x72a6('0x2b')](handleEntityNotFound(_0xd497cc,null))[_0x72a6('0x2b')](removeEntity(_0xd497cc,null))['catch'](handleError(_0xd497cc,null));};exports[_0x72a6('0x58')]=function(_0x5765c4,_0x40d592){return db['CmList'][_0x72a6('0x58')]()[_0x72a6('0x2b')](respondWithResult(_0x40d592,null))['catch'](handleError(_0x40d592,null));};exports[_0x72a6('0x59')]=function(_0x23c50c,_0x3b826f,_0x1f14e0){if(_0x23c50c[_0x72a6('0x4e')]['id']){delete _0x23c50c[_0x72a6('0x4e')]['id'];}return db[_0x72a6('0x34')][_0x72a6('0x4c')]({'where':{'id':_0x23c50c[_0x72a6('0x4b')]['id']}})[_0x72a6('0x2b')](handleEntityNotFound(_0x3b826f,null))[_0x72a6('0x2b')](function(_0x130130){if(_0x130130){_0x23c50c[_0x72a6('0x4e')][_0x72a6('0x5a')]=_0x130130['id'];return db[_0x72a6('0x5b')][_0x72a6('0x4d')](_0x23c50c['body']);}})[_0x72a6('0x2b')](respondWithResult(_0x3b826f,null))[_0x72a6('0x49')](handleError(_0x3b826f,null));};exports[_0x72a6('0x5c')]=function(_0x2ec7a0,_0x1a99c0,_0x177e8d){var _0x1bfadf={'raw':![],'where':{}};var _0x1b7216={};var _0x34d3c8={'count':0x0,'rows':[]};return db[_0x72a6('0x34')]['findOne']({'where':{'id':_0x2ec7a0['params']['id']}})['then'](handleEntityNotFound(_0x1a99c0,null))[_0x72a6('0x2b')](function(_0x4670ab){if(_0x4670ab){_0x1b7216[_0x72a6('0x3e')]=_['keys'](db[_0x72a6('0x5b')][_0x72a6('0x35')]);_0x1b7216[_0x72a6('0x39')]=_[_0x72a6('0x3a')](_0x2ec7a0[_0x72a6('0x39')]);_0x1b7216[_0x72a6('0x41')]=_['intersection'](_0x1b7216['model'],_0x1b7216['query']);_0x1bfadf[_0x72a6('0x3c')]=_['intersection'](_0x1b7216[_0x72a6('0x3e')],qs[_0x72a6('0x3b')](_0x2ec7a0[_0x72a6('0x39')]['fields']));_0x1bfadf[_0x72a6('0x3c')]=_0x1bfadf[_0x72a6('0x3c')][_0x72a6('0x3d')]?_0x1bfadf[_0x72a6('0x3c')]:_0x1b7216['model'];if(!_0x2ec7a0['query'][_0x72a6('0x3f')](_0x72a6('0x5d'))){_0x1bfadf[_0x72a6('0x25')]=qs[_0x72a6('0x25')](_0x2ec7a0[_0x72a6('0x39')][_0x72a6('0x25')]);_0x1bfadf[_0x72a6('0x23')]=qs[_0x72a6('0x23')](_0x2ec7a0['query'][_0x72a6('0x23')]);}_0x1bfadf['order']=qs[_0x72a6('0x5e')](_0x2ec7a0[_0x72a6('0x39')][_0x72a6('0x5e')]);_0x1bfadf[_0x72a6('0x43')]=qs[_0x72a6('0x41')](_[_0x72a6('0x5f')](_0x2ec7a0[_0x72a6('0x39')],_0x1b7216[_0x72a6('0x41')]));_0x1bfadf[_0x72a6('0x43')][_0x72a6('0x5a')]=_0x4670ab['id'];if(_0x2ec7a0['query'][_0x72a6('0x42')]){_0x1bfadf['where']=_['merge'](_0x1bfadf[_0x72a6('0x43')],{'$or':_['map'](_0x1bfadf[_0x72a6('0x3c')],function(_0x59d1f5){var _0x4d173a={};_0x4d173a[_0x59d1f5]={'$like':'%'+_0x2ec7a0[_0x72a6('0x39')][_0x72a6('0x42')]+'%'};return _0x4d173a;})});}_0x1bfadf=_[_0x72a6('0x44')]({},_0x1bfadf,_0x2ec7a0[_0x72a6('0x60')]);return db['Disposition'][_0x72a6('0x26')]({'where':_0x1bfadf['where']})['then'](function(_0x1ec044){_0x34d3c8[_0x72a6('0x26')]=_0x1ec044;if(_0x2ec7a0[_0x72a6('0x39')][_0x72a6('0x46')]){_0x1bfadf[_0x72a6('0x47')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x1bfadf);})[_0x72a6('0x2b')](function(_0x22763c){_0x34d3c8[_0x72a6('0x61')]=_0x22763c;return _0x34d3c8;});}})['then'](respondWithFilteredResult(_0x1a99c0,_0x1bfadf))['catch'](handleError(_0x1a99c0,null));};exports[_0x72a6('0x62')]=function(_0x3e7ac6,_0x569b32,_0x26f719){return db[_0x72a6('0x34')][_0x72a6('0x4c')]({'where':{'id':_0x3e7ac6[_0x72a6('0x4b')]['id']}})[_0x72a6('0x2b')](handleEntityNotFound(_0x569b32,null))[_0x72a6('0x2b')](function(_0x9b7fa9){if(_0x9b7fa9){return _0x9b7fa9[_0x72a6('0x62')](_0x3e7ac6[_0x72a6('0x39')]['ids']);}})[_0x72a6('0x2b')](respondWithStatusCode(_0x569b32,null))[_0x72a6('0x49')](handleError(_0x569b32,null));};exports['addContacts']=function(_0x38b348,_0x208ebe,_0x265300){return db[_0x72a6('0x34')][_0x72a6('0x4c')]({'where':{'id':_0x38b348[_0x72a6('0x4b')]['id']}})[_0x72a6('0x2b')](handleEntityNotFound(_0x208ebe,null))[_0x72a6('0x2b')](function(_0x4223d6){if(_0x4223d6){var _0x3a31f2=[];var _0x35e8f7={'success':[],'errors':[]};return db[_0x72a6('0x63')][_0x72a6('0x58')]()[_0x72a6('0x2b')](function(_0x811b45){if(_0x38b348['body'][_0x72a6('0x64')]&&_[_0x72a6('0x65')](_0x38b348['body'][_0x72a6('0x64')])){if(_0x38b348['body'][_0x72a6('0x64')]['length']){_0x38b348[_0x72a6('0x4e')][_0x72a6('0x64')]=_0x38b348['body'][_0x72a6('0x64')]['join'](';')+';';}else{_0x38b348['body']['tags']=null;}}else{_0x38b348['body'][_0x72a6('0x64')]=null;}if(_0x38b348[_0x72a6('0x4e')]&&_[_0x72a6('0x65')](_0x38b348[_0x72a6('0x4e')])){for(var _0x551f92=0x0;_0x551f92<_0x38b348[_0x72a6('0x4e')]['length'];_0x551f92+=0x1){_0x38b348[_0x72a6('0x4e')][_0x551f92][_0x72a6('0x5a')]=_0x38b348[_0x72a6('0x4b')]['id'];_0x3a31f2['push'](_0x38b348[_0x72a6('0x4e')][_0x551f92]);}return BPromise[_0x72a6('0x66')](_0x3a31f2,function(_0x2011f6){return db[_0x72a6('0x63')][_0x72a6('0x4d')](_[_0x72a6('0x67')](_0x2011f6,[_0x72a6('0x68'),'id'])||{},{'fields':_[_0x72a6('0x3a')](_0x811b45),'raw':!![]})[_0x72a6('0x2b')](function(_0x1a91d1){_0x35e8f7[_0x72a6('0x69')][_0x72a6('0x6a')](_0x1a91d1['dataValues']);})['catch'](function(_0x2dcaa1){_0x35e8f7[_0x72a6('0x6b')][_0x72a6('0x6a')]({'data':_0x2011f6,'error':_0x2dcaa1[_0x72a6('0x6c')]});});})['then'](function(_0x320e0a){return _0x35e8f7;})['catch'](function(_0x4cb46a){return _0x4cb46a;});}else{_0x208ebe[_0x72a6('0x20')](0x190)[_0x72a6('0x22')]({'message':_0x72a6('0x6d')});}});}})['then'](respondWithResult(_0x208ebe,null))[_0x72a6('0x49')](handleError(_0x208ebe,null));};exports['getContacts']=function(_0x5076c0,_0x41e84c,_0x11d9a5){var _0x264c46;return db['CmList'][_0x72a6('0x4c')]({'where':{'id':_0x5076c0['params']['id']},'include':[{'model':db[_0x72a6('0x6e')],'as':_0x72a6('0x6f')}]})[_0x72a6('0x2b')](handleEntityNotFound(_0x41e84c,null))['then'](function(_0x50b56d){if(_0x50b56d){_0x264c46=_0x50b56d;return db[_0x72a6('0x63')][_0x72a6('0x35')];}})[_0x72a6('0x2b')](function(_0x521649){if(_0x521649){var _0x4494ce={};var _0x3d18b0={};_0x3d18b0[_0x72a6('0x3e')]=_[_0x72a6('0x70')](_[_0x72a6('0x3a')](_0x521649),_[_0x72a6('0x33')](_0x264c46[_0x72a6('0x6f')],function(_0x4aaf6c){return util['format'](_0x72a6('0x71'),_0x4aaf6c['id']);}));_0x3d18b0[_0x72a6('0x39')]=_['keys'](_0x5076c0[_0x72a6('0x39')]);_0x3d18b0[_0x72a6('0x41')]=_[_0x72a6('0x72')](_0x3d18b0[_0x72a6('0x3e')],_0x3d18b0['query']);_0x4494ce[_0x72a6('0x3c')]=_[_0x72a6('0x72')](_0x3d18b0['model'],qs[_0x72a6('0x3b')](_0x5076c0[_0x72a6('0x39')][_0x72a6('0x3b')]));_0x4494ce[_0x72a6('0x3c')]=_0x4494ce[_0x72a6('0x3c')][_0x72a6('0x3d')]?_0x4494ce[_0x72a6('0x3c')]:_0x3d18b0[_0x72a6('0x3e')];if(!_0x5076c0[_0x72a6('0x39')][_0x72a6('0x3f')]('nolimit')){_0x4494ce['limit']=qs['limit'](_0x5076c0[_0x72a6('0x39')]['limit']);_0x4494ce[_0x72a6('0x23')]=qs[_0x72a6('0x23')](_0x5076c0['query'][_0x72a6('0x23')]);}_0x4494ce['order']=qs['sort'](_0x5076c0[_0x72a6('0x39')][_0x72a6('0x5e')]);_0x4494ce[_0x72a6('0x43')]=qs[_0x72a6('0x41')](_[_0x72a6('0x5f')](_0x5076c0[_0x72a6('0x39')],_0x3d18b0[_0x72a6('0x41')]));_0x4494ce[_0x72a6('0x73')]=!![];if(_0x5076c0[_0x72a6('0x39')][_0x72a6('0x42')]){_0x4494ce['where']=_[_0x72a6('0x44')](_0x4494ce[_0x72a6('0x43')],{'$or':_[_0x72a6('0x33')](_0x4494ce['attributes'],function(_0x5c8639){var _0x520a43={};_0x520a43[_0x5c8639]={'$like':'%'+_0x5076c0['query'][_0x72a6('0x42')]+'%'};return _0x520a43;})});}_0x4494ce=_[_0x72a6('0x44')]({},_0x4494ce,_0x5076c0[_0x72a6('0x60')]);return _0x264c46['getContacts'](_0x4494ce);}})[_0x72a6('0x2b')](respondWithResult(_0x41e84c,null))[_0x72a6('0x49')](handleError(_0x41e84c,null));};exports[_0x72a6('0x74')]=function(_0x37f66e,_0xb26295,_0x201b35){var _0x4f2cf9;var _0x3b0bb4;var _0x8a4b1c;var _0x2ec7aa=_0x37f66e[_0x72a6('0x4b')]['id'];csv_results=[];return db[_0x72a6('0x75')][_0x72a6('0x48')]({'attributes':['id',_0x72a6('0x31')],'raw':!![],'order':[_0x72a6('0x76')]})[_0x72a6('0x2b')](function(_0x506bbc){_0x4f2cf9=_0x506bbc;var _0x408bb9=_['keys'](db[_0x72a6('0x63')]['rawAttributes']);return db[_0x72a6('0x6e')][_0x72a6('0x48')]({'raw':!![],'attributes':['id',_0x72a6('0x77')]})[_0x72a6('0x2b')](function(_0x348fb1){_0x3b0bb4=_0x348fb1;var _0x3f1c5c=squel['select']()[_0x72a6('0x3b')](_0x408bb9)[_0x72a6('0x78')](_0x72a6('0x79'),'c')['where'](_0x72a6('0x7a'),_0x2ec7aa)[_0x72a6('0x43')](_0x72a6('0x7b'))[_0x72a6('0x7c')]();for(var _0x51da6e=0x0;_0x51da6e<_0x3b0bb4[_0x72a6('0x3d')];_0x51da6e++){_0x3f1c5c[_0x72a6('0x7d')]('c.cf_'+_0x3b0bb4[_0x51da6e]['id'],_0x72a6('0x7e')+_0x3b0bb4[_0x51da6e]['alias']);}for(var _0x51da6e=0x0;_0x51da6e<_0x4f2cf9[_0x72a6('0x3d')];_0x51da6e++){_0x3f1c5c[_0x72a6('0x7d')](squel[_0x72a6('0x7f')]()['field'](_0x72a6('0x80'))['from'](_0x72a6('0x81'))['where'](_0x72a6('0x82'),_0x4f2cf9[_0x51da6e]['id'])[_0x72a6('0x43')](_0x72a6('0x83')),_0x72a6('0x84')+_0x4f2cf9[_0x51da6e][_0x72a6('0x31')]);_0x3f1c5c[_0x72a6('0x7d')](squel['select']()[_0x72a6('0x7d')](_0x72a6('0x85'))[_0x72a6('0x78')](_0x72a6('0x81'))[_0x72a6('0x43')](_0x72a6('0x82'),_0x4f2cf9[_0x51da6e]['id'])[_0x72a6('0x43')](_0x72a6('0x83')),_0x72a6('0x86')+_0x4f2cf9[_0x51da6e][_0x72a6('0x31')]);}var _0x310034=[];_0x310034['push'](_0x3f1c5c[_0x72a6('0x87')]());BPromise[_0x72a6('0x66')](_0x310034,handleQuery)['then'](function(_0x3de257){handleQuery(_0x3f1c5c[_0x72a6('0x87')]());var _0xeefb0=csv_results[0x0];if(!_[_0x72a6('0x88')](_0xeefb0)){var _0x2fb42a=toCsv(_0xeefb0);var _0x336295=Date[_0x72a6('0x89')]();fs[_0x72a6('0x8a')](util['format'](_0x72a6('0x8b'),_0x2ec7aa,_0x336295),_0x2fb42a);_0xb26295[_0x72a6('0x8c')]('Content-disposition','attachment;\x20filename='+util[_0x72a6('0x8d')](_0x72a6('0x8e'),_0x2ec7aa,_0x336295));_0xb26295[_0x72a6('0x8c')]('Content-type',_0x72a6('0x8f'));return _0xb26295[_0x72a6('0x90')](util[_0x72a6('0x8d')](_0x72a6('0x8b'),_0x2ec7aa,_0x336295));}else{return _0xb26295['sendStatus'](0xcc);}});});});};exports['addCustomField']=function(_0xcc3868,_0x7dc3bb,_0x35834d){var _0x1f049b;delete _0xcc3868[_0x72a6('0x4e')]['id'];return db['CmList'][_0x72a6('0x91')]({'where':{'id':_0xcc3868[_0x72a6('0x4b')]['id']}})[_0x72a6('0x2b')](handleEntityNotFound(_0x7dc3bb,null))[_0x72a6('0x2b')](function(_0x5224c5){if(_0x5224c5){return db[_0x72a6('0x92')][_0x72a6('0x93')](function(_0x110229){return db['CmCustomField'][_0x72a6('0x4d')](_0xcc3868[_0x72a6('0x4e')],{'transaction':_0x110229})[_0x72a6('0x2b')](function(_0x524039){_0x1f049b=_0x524039;return _0x5224c5['addCustomFields'](_0x524039,{'transaction':_0x110229});})[_0x72a6('0x2b')](function(){var _0x38dd30={'type':db['Sequelize'][_0x72a6('0x94')],'transaction':_0x110229};switch(_0xcc3868[_0x72a6('0x4e')]['type']){case _0x72a6('0x95'):_0x38dd30[_0x72a6('0x37')]=db['Sequelize'][_0x72a6('0x94')];break;case _0x72a6('0x96'):_0x38dd30['type']=db[_0x72a6('0x97')]['INTEGER'];break;case _0x72a6('0x98'):_0x38dd30[_0x72a6('0x37')]=db[_0x72a6('0x97')][_0x72a6('0x99')];_0x38dd30[_0x72a6('0x9a')]=![];break;default:}return db['sequelize']['queryInterface'][_0x72a6('0x9b')](_0x72a6('0x79'),util[_0x72a6('0x8d')]('cf_%s',_0x1f049b['id']),_0x38dd30);})[_0x72a6('0x2b')](function(){return _0x1f049b;});});}})[_0x72a6('0x2b')](respondWithResult(_0x7dc3bb,null))['catch'](handleError(_0x7dc3bb,null));};exports['getCustomFields']=function(_0x461d1b,_0x42fac5,_0x5955b9){var _0x2981b0={};var _0x1ef2cd={};var _0x59807f;var _0x5186b3;return db['CmList'][_0x72a6('0x91')]({'where':{'id':_0x461d1b[_0x72a6('0x4b')]['id']}})[_0x72a6('0x2b')](handleEntityNotFound(_0x42fac5,null))[_0x72a6('0x2b')](function(_0x3fef9b){if(_0x3fef9b){_0x59807f=_0x3fef9b;_0x1ef2cd['model']=_[_0x72a6('0x3a')](db[_0x72a6('0x6e')][_0x72a6('0x35')]);_0x1ef2cd['query']=_['keys'](_0x461d1b[_0x72a6('0x39')]);_0x1ef2cd[_0x72a6('0x41')]=_['intersection'](_0x1ef2cd[_0x72a6('0x3e')],_0x1ef2cd[_0x72a6('0x39')]);_0x2981b0[_0x72a6('0x3c')]=_['intersection'](_0x1ef2cd['model'],qs['fields'](_0x461d1b[_0x72a6('0x39')][_0x72a6('0x3b')]));_0x2981b0[_0x72a6('0x3c')]=_0x2981b0['attributes'][_0x72a6('0x3d')]?_0x2981b0['attributes']:_0x1ef2cd[_0x72a6('0x3e')];_0x2981b0[_0x72a6('0x40')]=qs[_0x72a6('0x5e')](_0x461d1b['query']['sort']);_0x2981b0[_0x72a6('0x43')]=qs[_0x72a6('0x41')](_['pick'](_0x461d1b['query'],_0x1ef2cd['filters']));_0x2981b0[_0x72a6('0x43')]=_[_0x72a6('0x44')](_0x2981b0['where'],{'$or':[{'ListId':_0x3fef9b['id']},{'ListId':null}]});if(_0x461d1b[_0x72a6('0x39')][_0x72a6('0x42')]){_0x2981b0['where']=_[_0x72a6('0x44')](_0x2981b0[_0x72a6('0x43')],{'$or':_[_0x72a6('0x33')](_0x2981b0[_0x72a6('0x3c')],function(_0x573d6a){var _0x1b8c5e={};_0x1b8c5e[_0x573d6a]={'$like':'%'+_0x461d1b['query'][_0x72a6('0x42')]+'%'};return _0x1b8c5e;})});}_0x2981b0=_[_0x72a6('0x44')]({},_0x2981b0,_0x461d1b['options']);return db[_0x72a6('0x6e')][_0x72a6('0x9c')](_0x2981b0);}})[_0x72a6('0x2b')](respondWithResult(_0x42fac5,null))[_0x72a6('0x49')](handleError(_0x42fac5,null));};exports[_0x72a6('0x9d')]=function(_0x448edb,_0x3aeb12){return db[_0x72a6('0x6e')][_0x72a6('0x9c')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x3aeb12,null))[_0x72a6('0x2b')](function(_0x52dbb5){return _0x52dbb5;})[_0x72a6('0x2b')](respondWithResult(_0x3aeb12,null))[_0x72a6('0x49')](handleError(_0x3aeb12,null));};exports[_0x72a6('0x9e')]=function(_0x1b9044,_0x501194,_0x36d2b4){return db[_0x72a6('0x34')][_0x72a6('0x4c')]({'where':{'id':_0x1b9044[_0x72a6('0x4b')]['id']}})[_0x72a6('0x2b')](handleEntityNotFound(_0x501194,null))[_0x72a6('0x2b')](function(_0x417ffc){if(_0x417ffc){return _0x417ffc['addAgents'](_0x1b9044[_0x72a6('0x4e')][_0x72a6('0x68')],_['omit'](_0x1b9044[_0x72a6('0x4e')],['ids','id'])||{})['spread'](function(_0x12f829){for(var _0x42de6e=0x0;_0x42de6e<_0x1b9044['body']['ids'][_0x72a6('0x3d')];_0x42de6e+=0x1){socket[_0x72a6('0x9f')]('userCmList:save',{'UserId':Number(_0x1b9044[_0x72a6('0x4e')][_0x72a6('0x68')][_0x42de6e]),'CmListId':Number(_0x1b9044[_0x72a6('0x4b')]['id'])});}return _0x12f829;});}})[_0x72a6('0x2b')](respondWithResult(_0x501194,null))[_0x72a6('0x49')](handleError(_0x501194,null));};exports['removeAgents']=function(_0x444f70,_0x2dd5bd,_0x33229e){return db['CmList'][_0x72a6('0x4c')]({'where':{'id':_0x444f70['params']['id']}})[_0x72a6('0x2b')](handleEntityNotFound(_0x2dd5bd,null))[_0x72a6('0x2b')](function(_0x190a47){if(_0x190a47){return _0x190a47['removeAgents'](_0x444f70[_0x72a6('0x39')][_0x72a6('0x68')])[_0x72a6('0x2b')](function(){if(_['isArray'](_0x444f70[_0x72a6('0x39')][_0x72a6('0x68')])){for(var _0x253c68=0x0;_0x253c68<_0x444f70[_0x72a6('0x39')][_0x72a6('0x68')][_0x72a6('0x3d')];_0x253c68+=0x1){socket['emit'](_0x72a6('0xa0'),{'UserId':Number(_0x444f70[_0x72a6('0x39')][_0x72a6('0x68')][_0x253c68]),'CmListId':Number(_0x444f70['params']['id'])});}}else{socket[_0x72a6('0x9f')]('userCmList:remove',{'UserId':Number(_0x444f70['query']['ids']),'CmListId':Number(_0x444f70[_0x72a6('0x4b')]['id'])});}});}})[_0x72a6('0x2b')](respondWithStatusCode(_0x2dd5bd,null))[_0x72a6('0x49')](handleError(_0x2dd5bd,null));};exports['getAgents']=function(_0x568a42,_0x4f5992,_0x56e016){var _0x34b84d={};var _0x15447c={};var _0x190222;var _0x56caf8;return db[_0x72a6('0x34')][_0x72a6('0x91')]({'where':{'id':_0x568a42[_0x72a6('0x4b')]['id']}})[_0x72a6('0x2b')](handleEntityNotFound(_0x4f5992,null))[_0x72a6('0x2b')](function(_0x55e390){if(_0x55e390){_0x190222=_0x55e390;_0x15447c[_0x72a6('0x3e')]=_[_0x72a6('0x3a')](db[_0x72a6('0xa1')][_0x72a6('0x35')]);_0x15447c['query']=_[_0x72a6('0x3a')](_0x568a42[_0x72a6('0x39')]);_0x15447c['filters']=_['intersection'](_0x15447c[_0x72a6('0x3e')],_0x15447c['query']);_0x34b84d['attributes']=_[_0x72a6('0x72')](_0x15447c[_0x72a6('0x3e')],qs['fields'](_0x568a42[_0x72a6('0x39')][_0x72a6('0x3b')]));_0x34b84d['attributes']=_0x34b84d[_0x72a6('0x3c')][_0x72a6('0x3d')]?_0x34b84d['attributes']:_0x15447c['model'];_0x34b84d[_0x72a6('0x40')]=qs['sort'](_0x568a42[_0x72a6('0x39')]['sort']);_0x34b84d[_0x72a6('0x43')]=qs[_0x72a6('0x41')](_[_0x72a6('0x5f')](_0x568a42[_0x72a6('0x39')],_0x15447c[_0x72a6('0x41')]));if(_0x568a42[_0x72a6('0x39')]['filter']){_0x34b84d[_0x72a6('0x43')]=_[_0x72a6('0x44')](_0x34b84d['where'],{'$or':_[_0x72a6('0x33')](_0x34b84d[_0x72a6('0x3c')],function(_0x5aaae4){var _0x3b6439={};_0x3b6439[_0x5aaae4]={'$like':'%'+_0x568a42[_0x72a6('0x39')][_0x72a6('0x42')]+'%'};return _0x3b6439;})});}_0x34b84d=_[_0x72a6('0x44')]({},_0x34b84d,_0x568a42[_0x72a6('0x60')]);return _0x190222[_0x72a6('0xa2')](_0x34b84d);}})[_0x72a6('0x2b')](function(_0x147558){if(_0x147558){_0x56caf8=_0x147558[_0x72a6('0x3d')];if(!_0x568a42['query'][_0x72a6('0x3f')](_0x72a6('0x5d'))){_0x34b84d['limit']=qs[_0x72a6('0x25')](_0x568a42[_0x72a6('0x39')][_0x72a6('0x25')]);_0x34b84d[_0x72a6('0x23')]=qs['offset'](_0x568a42[_0x72a6('0x39')][_0x72a6('0x23')]);}return _0x190222['getAgents'](_0x34b84d);}})['then'](function(_0x2b73a9){if(_0x2b73a9){return _0x2b73a9?{'count':_0x56caf8,'rows':_0x2b73a9}:null;}})[_0x72a6('0x2b')](respondWithResult(_0x4f5992,null))[_0x72a6('0x49')](handleError(_0x4f5992,null));};function handleQuery(_0x5076e9){logger[_0x72a6('0xa3')](_0x5076e9);return db['sequelize']['query'](_0x5076e9)[_0x72a6('0xa4')](function(_0x1df29d){csv_results[_0x72a6('0x6a')](_0x1df29d);})['catch'](function(_0xd14f76){logger[_0x72a6('0x2f')](_0xd14f76[_0x72a6('0x6c')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index b970ff1..ba13692 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2fee96,_0x2f735d){_0x2fee96=_0x2fee96-0x0;var _0x2e6ad1=_0x5fc3[_0x2fee96];return _0x2e6ad1;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x4e5aad,_0x2428fd){var _0x19c37a=function(_0x30c52b){while(--_0x30c52b){_0x4e5aad['push'](_0x4e5aad['shift']());}};_0x19c37a(++_0x2428fd);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 9f845d7..83d6bb0 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 _0xa74f=['cm_lists','../../config/logger','bluebird','request-promise','path','rimraf','./cmList.attributes','define','CmList'];(function(_0x2ad2d1,_0x5886a5){var _0x235ef0=function(_0x2a8b1a){while(--_0x2a8b1a){_0x2ad2d1['push'](_0x2ad2d1['shift']());}};_0x235ef0(++_0x5886a5);}(_0xa74f,0x9a));var _0xfa74=function(_0x533528,_0x409d05){_0x533528=_0x533528-0x0;var _0x3189f1=_0xa74f[_0x533528];return _0x3189f1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfa74('0x0'))('api');var moment=require('moment');var BPromise=require(_0xfa74('0x1'));var rp=require(_0xfa74('0x2'));var fs=require('fs');var path=require(_0xfa74('0x3'));var rimraf=require(_0xfa74('0x4'));var config=require('../../config/environment');var attributes=require(_0xfa74('0x5'));module['exports']=function(_0x543cfe,_0x43dd2f){return _0x543cfe[_0xfa74('0x6')](_0xfa74('0x7'),attributes,{'tableName':_0xfa74('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','../../config/logger','api'];(function(_0x46af38,_0x15ef9c){var _0x4cac08=function(_0x300ded){while(--_0x300ded){_0x46af38['push'](_0x46af38['shift']());}};_0x4cac08(++_0x15ef9c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 9894cf8..ffecfc1 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 _0x6fae=['debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmList,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./cmList.socket','register','request','info','request\x20sent'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x6fae,0xb1));var _0xe6fa=function(_0x46a6a4,_0xa108f4){_0x46a6a4=_0x46a6a4-0x0;var _0x301868=_0x6fae[_0x46a6a4];return _0x301868;};'use strict';var _=require(_0xe6fa('0x0'));var util=require(_0xe6fa('0x1'));var moment=require(_0xe6fa('0x2'));var BPromise=require(_0xe6fa('0x3'));var rs=require(_0xe6fa('0x4'));var fs=require('fs');var Redis=require(_0xe6fa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe6fa('0x6'));var logger=require(_0xe6fa('0x7'))(_0xe6fa('0x8'));var config=require(_0xe6fa('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe6fa('0xa')]['http']({'port':0x232a});config[_0xe6fa('0xb')]=_['defaults'](config[_0xe6fa('0xb')],{'host':_0xe6fa('0xc'),'port':0x18eb});var socket=require(_0xe6fa('0xd'))(new Redis(config[_0xe6fa('0xb')]));require(_0xe6fa('0xe'))[_0xe6fa('0xf')](socket);function respondWithRpcPromise(_0xd96732,_0x1565a1,_0x3d3b7c){return new BPromise(function(_0x292cb1,_0x26ef44){return client[_0xe6fa('0x10')](_0xd96732,_0x3d3b7c)['then'](function(_0x1ae1cf){logger[_0xe6fa('0x11')]('CmList,\x20%s,\x20%s',_0x1565a1,_0xe6fa('0x12'));logger[_0xe6fa('0x13')](_0xe6fa('0x14'),_0x1565a1,_0xe6fa('0x12'),JSON[_0xe6fa('0x15')](_0x1ae1cf));if(_0x1ae1cf[_0xe6fa('0x16')]){if(_0x1ae1cf[_0xe6fa('0x16')][_0xe6fa('0x17')]===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x1565a1,_0x1ae1cf[_0xe6fa('0x16')][_0xe6fa('0x18')]);return _0x26ef44(_0x1ae1cf[_0xe6fa('0x16')][_0xe6fa('0x18')]);}logger['error'](_0xe6fa('0x19'),_0x1565a1,_0x1ae1cf[_0xe6fa('0x16')][_0xe6fa('0x18')]);return _0x292cb1(_0x1ae1cf[_0xe6fa('0x16')][_0xe6fa('0x18')]);}else{logger['info'](_0xe6fa('0x19'),_0x1565a1,_0xe6fa('0x12'));_0x292cb1(_0x1ae1cf[_0xe6fa('0x1a')]['message']);}})[_0xe6fa('0x1b')](function(_0xff3fa9){logger['error'](_0xe6fa('0x19'),_0x1565a1,_0xff3fa9);_0x26ef44(_0xff3fa9);});});} \ No newline at end of file +var _0x632b=['client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x2998db,_0x3424f1){var _0x115fea=function(_0x3b493c){while(--_0x3b493c){_0x2998db['push'](_0x2998db['shift']());}};_0x115fea(++_0x3424f1);}(_0x632b,0x1ef));var _0xb632=function(_0x34f276,_0x1c41fc){_0x34f276=_0x34f276-0x0;var _0x24e21a=_0x632b[_0x34f276];return _0x24e21a;};'use strict';var _=require(_0xb632('0x0'));var util=require(_0xb632('0x1'));var moment=require(_0xb632('0x2'));var BPromise=require(_0xb632('0x3'));var rs=require(_0xb632('0x4'));var fs=require('fs');var Redis=require(_0xb632('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb632('0x6'))(_0xb632('0x7'));var config=require(_0xb632('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb632('0x9')][_0xb632('0xa')]({'port':0x232a});config[_0xb632('0xb')]=_[_0xb632('0xc')](config['redis'],{'host':_0xb632('0xd'),'port':0x18eb});var socket=require(_0xb632('0xe'))(new Redis(config[_0xb632('0xb')]));require(_0xb632('0xf'))[_0xb632('0x10')](socket);function respondWithRpcPromise(_0xf1284e,_0x20d079,_0x5bec10){return new BPromise(function(_0x1533a0,_0x47fefb){return client[_0xb632('0x11')](_0xf1284e,_0x5bec10)[_0xb632('0x12')](function(_0x2c537e){logger[_0xb632('0x13')](_0xb632('0x14'),_0x20d079,_0xb632('0x15'));logger[_0xb632('0x16')](_0xb632('0x17'),_0x20d079,_0xb632('0x15'),JSON[_0xb632('0x18')](_0x2c537e));if(_0x2c537e[_0xb632('0x19')]){if(_0x2c537e[_0xb632('0x19')]['code']===0x1f4){logger[_0xb632('0x19')]('CmList,\x20%s,\x20%s',_0x20d079,_0x2c537e[_0xb632('0x19')][_0xb632('0x1a')]);return _0x47fefb(_0x2c537e['error'][_0xb632('0x1a')]);}logger['error'](_0xb632('0x14'),_0x20d079,_0x2c537e[_0xb632('0x19')]['message']);return _0x1533a0(_0x2c537e[_0xb632('0x19')]['message']);}else{logger[_0xb632('0x13')]('CmList,\x20%s,\x20%s',_0x20d079,'request\x20sent');_0x1533a0(_0x2c537e[_0xb632('0x1b')][_0xb632('0x1a')]);}})['catch'](function(_0x25f2a7){logger[_0xb632('0x19')](_0xb632('0x14'),_0x20d079,_0x25f2a7);_0x47fefb(_0x25f2a7);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 7cd9cd4..b1662ad 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 _0x0535=['length','cmList:','./cmList.events','save','update','emit','removeListener','register'];(function(_0x508338,_0xcf1f4d){var _0x1ccd1b=function(_0x3b4525){while(--_0x3b4525){_0x508338['push'](_0x508338['shift']());}};_0x1ccd1b(++_0xcf1f4d);}(_0x0535,0x132));var _0x5053=function(_0x4e3b13,_0xdde621){_0x4e3b13=_0x4e3b13-0x0;var _0x30dbfa=_0x0535[_0x4e3b13];return _0x30dbfa;};'use strict';var CmListEvents=require(_0x5053('0x0'));var events=[_0x5053('0x1'),'remove',_0x5053('0x2')];function createListener(_0x809a46,_0x4537ff){return function(_0x33e76d){_0x4537ff[_0x5053('0x3')](_0x809a46,_0x33e76d);};}function removeListener(_0x5a703c,_0x466981){return function(){CmListEvents[_0x5053('0x4')](_0x5a703c,_0x466981);};}exports[_0x5053('0x5')]=function(_0x468100){for(var _0x482d2a=0x0,_0x3232e9=events[_0x5053('0x6')];_0x482d2a<_0x3232e9;_0x482d2a++){var _0x8cc518=events[_0x482d2a];var _0xdcebeb=createListener(_0x5053('0x7')+_0x8cc518,_0x468100);CmListEvents['on'](_0x8cc518,_0xdcebeb);}}; \ No newline at end of file +var _0x8143=['removeListener','register','save','remove','update','emit'];(function(_0x2c9f17,_0x1a0757){var _0x53bbbd=function(_0x124505){while(--_0x124505){_0x2c9f17['push'](_0x2c9f17['shift']());}};_0x53bbbd(++_0x1a0757);}(_0x8143,0x74));var _0x3814=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8143[_0x321bb2];return _0x9c12ed;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x3814('0x0'),_0x3814('0x1'),_0x3814('0x2')];function createListener(_0x162444,_0x42cabc){return function(_0x552662){_0x42cabc[_0x3814('0x3')](_0x162444,_0x552662);};}function removeListener(_0x19ba50,_0x39d197){return function(){CmListEvents[_0x3814('0x4')](_0x19ba50,_0x39d197);};}exports[_0x3814('0x5')]=function(_0x5c8234){for(var _0x49ac3d=0x0,_0x4c236b=events['length'];_0x49ac3d<_0x4c236b;_0x49ac3d++){var _0x530b70=events[_0x49ac3d];var _0x21f7d6=createListener('cmList:'+_0x530b70,_0x5c8234);CmListEvents['on'](_0x530b70,_0x21f7d6);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index ceeeae5..d7503ae 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 _0xeb1e=['index','/describe','isAuthenticated','describe','/global_fields','/:id','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/users','getAgents','post','create','addDisposition','addContacts','/:id/fields','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get'];(function(_0x3d2e4b,_0x1f6653){var _0x509e78=function(_0x307037){while(--_0x307037){_0x3d2e4b['push'](_0x3d2e4b['shift']());}};_0x509e78(++_0x1f6653);}(_0xeb1e,0x115));var _0xeeb1=function(_0x30daaa,_0x3d3678){_0x30daaa=_0x30daaa-0x0;var _0x4c6b0a=_0xeb1e[_0x30daaa];return _0x4c6b0a;};'use strict';var multer=require(_0xeeb1('0x0'));var util=require(_0xeeb1('0x1'));var path=require(_0xeeb1('0x2'));var timeout=require(_0xeeb1('0x3'));var express=require('express');var router=express[_0xeeb1('0x4')]();var fs_extra=require(_0xeeb1('0x5'));var auth=require(_0xeeb1('0x6'));var interaction=require(_0xeeb1('0x7'));var config=require(_0xeeb1('0x8'));var controller=require(_0xeeb1('0x9'));router[_0xeeb1('0xa')]('/',auth['isAuthenticated'](),controller[_0xeeb1('0xb')]);router['get'](_0xeeb1('0xc'),auth[_0xeeb1('0xd')](),controller[_0xeeb1('0xe')]);router[_0xeeb1('0xa')](_0xeeb1('0xf'),auth['isAuthenticated'](),controller['getGlobalCustomFields']);router['get'](_0xeeb1('0x10'),auth[_0xeeb1('0xd')](),controller['show']);router['get'](_0xeeb1('0x11'),auth['isAuthenticated'](),controller[_0xeeb1('0x12')]);router[_0xeeb1('0xa')]('/:id/contacts',auth[_0xeeb1('0xd')](),controller[_0xeeb1('0x13')]);router['get'](_0xeeb1('0x14'),auth[_0xeeb1('0xd')](),controller[_0xeeb1('0x15')]);router[_0xeeb1('0xa')]('/:id/fields',auth[_0xeeb1('0xd')](),controller['getCustomFields']);router[_0xeeb1('0xa')](_0xeeb1('0x16'),auth[_0xeeb1('0xd')](),controller[_0xeeb1('0x17')]);router[_0xeeb1('0x18')]('/',auth[_0xeeb1('0xd')](),controller[_0xeeb1('0x19')]);router[_0xeeb1('0x18')]('/:id/dispositions',auth[_0xeeb1('0xd')](),controller[_0xeeb1('0x1a')]);router['post']('/:id/contacts',auth['isAuthenticated'](),controller[_0xeeb1('0x1b')]);router[_0xeeb1('0x18')](_0xeeb1('0x1c'),auth['isAuthenticated'](),controller[_0xeeb1('0x1d')]);router[_0xeeb1('0x18')](_0xeeb1('0x16'),auth[_0xeeb1('0xd')](),controller[_0xeeb1('0x1e')]);router[_0xeeb1('0x1f')](_0xeeb1('0x10'),auth[_0xeeb1('0xd')](),controller[_0xeeb1('0x20')]);router[_0xeeb1('0x21')](_0xeeb1('0x10'),auth['isAuthenticated'](),controller[_0xeeb1('0x22')]);router[_0xeeb1('0x21')](_0xeeb1('0x11'),auth[_0xeeb1('0xd')](),controller[_0xeeb1('0x23')]);router['delete'](_0xeeb1('0x16'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xe0e1=['get','isAuthenticated','/describe','describe','/global_fields','show','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','post','create','/:id/dispositions','addContacts','addCustomField','addAgents','put','update','/:id','delete','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller'];(function(_0x24e5b4,_0xa90a9c){var _0x8cbf46=function(_0x339a40){while(--_0x339a40){_0x24e5b4['push'](_0x24e5b4['shift']());}};_0x8cbf46(++_0xa90a9c);}(_0xe0e1,0xc3));var _0x1e0e=function(_0x5e35ce,_0x255c4c){_0x5e35ce=_0x5e35ce-0x0;var _0x3f8211=_0xe0e1[_0x5e35ce];return _0x3f8211;};'use strict';var multer=require(_0x1e0e('0x0'));var util=require(_0x1e0e('0x1'));var path=require(_0x1e0e('0x2'));var timeout=require(_0x1e0e('0x3'));var express=require(_0x1e0e('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1e0e('0x5'));var interaction=require(_0x1e0e('0x6'));var config=require(_0x1e0e('0x7'));var controller=require(_0x1e0e('0x8'));router[_0x1e0e('0x9')]('/',auth[_0x1e0e('0xa')](),controller['index']);router[_0x1e0e('0x9')](_0x1e0e('0xb'),auth['isAuthenticated'](),controller[_0x1e0e('0xc')]);router[_0x1e0e('0x9')](_0x1e0e('0xd'),auth[_0x1e0e('0xa')](),controller['getGlobalCustomFields']);router[_0x1e0e('0x9')]('/:id',auth[_0x1e0e('0xa')](),controller[_0x1e0e('0xe')]);router[_0x1e0e('0x9')]('/:id/dispositions',auth[_0x1e0e('0xa')](),controller['getDispositions']);router[_0x1e0e('0x9')](_0x1e0e('0xf'),auth[_0x1e0e('0xa')](),controller[_0x1e0e('0x10')]);router[_0x1e0e('0x9')](_0x1e0e('0x11'),auth['isAuthenticated'](),controller['getContactsCsv']);router[_0x1e0e('0x9')](_0x1e0e('0x12'),auth['isAuthenticated'](),controller[_0x1e0e('0x13')]);router['get'](_0x1e0e('0x14'),auth[_0x1e0e('0xa')](),controller['getAgents']);router[_0x1e0e('0x15')]('/',auth[_0x1e0e('0xa')](),controller[_0x1e0e('0x16')]);router[_0x1e0e('0x15')](_0x1e0e('0x17'),auth[_0x1e0e('0xa')](),controller['addDisposition']);router[_0x1e0e('0x15')]('/:id/contacts',auth[_0x1e0e('0xa')](),controller[_0x1e0e('0x18')]);router[_0x1e0e('0x15')](_0x1e0e('0x12'),auth[_0x1e0e('0xa')](),controller[_0x1e0e('0x19')]);router[_0x1e0e('0x15')]('/:id/users',auth[_0x1e0e('0xa')](),controller[_0x1e0e('0x1a')]);router[_0x1e0e('0x1b')]('/:id',auth[_0x1e0e('0xa')](),controller[_0x1e0e('0x1c')]);router['delete'](_0x1e0e('0x1d'),auth[_0x1e0e('0xa')](),controller['destroy']);router[_0x1e0e('0x1e')](_0x1e0e('0x17'),auth[_0x1e0e('0xa')](),controller[_0x1e0e('0x1f')]);router[_0x1e0e('0x1e')](_0x1e0e('0x14'),auth[_0x1e0e('0xa')](),controller[_0x1e0e('0x20')]);module[_0x1e0e('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 3b8dba1..fb9c600 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 _0x89fe=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x5a2674,_0x1c7e75){var _0x48c89c=function(_0x528eff){while(--_0x528eff){_0x5a2674['push'](_0x5a2674['shift']());}};_0x48c89c(++_0x1c7e75);}(_0x89fe,0x188));var _0xe89f=function(_0x3aebdd,_0x1ad66f){_0x3aebdd=_0x3aebdd-0x0;var _0x1e8879=_0x89fe[_0x3aebdd];return _0x1e8879;};'use strict';var Sequelize=require(_0xe89f('0x0'));module[_0xe89f('0x1')]={'name':{'type':Sequelize[_0xe89f('0x2')],'get':function(_0x4bda19){return this['getDataValue'](_0xe89f('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0xe89f('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xe89f('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x5b70=['STRING','sequelize','exports','VIRTUAL','getDataValue'];(function(_0xc441b5,_0xa58567){var _0x4f5e7c=function(_0x4ea6ea){while(--_0x4ea6ea){_0xc441b5['push'](_0xc441b5['shift']());}};_0x4f5e7c(++_0xa58567);}(_0x5b70,0x1b9));var _0x05b7=function(_0x5cee2b,_0x11e16a){_0x5cee2b=_0x5cee2b-0x0;var _0x4397ed=_0x5b70[_0x5cee2b];return _0x4397ed;};'use strict';var Sequelize=require(_0x05b7('0x0'));module[_0x05b7('0x1')]={'name':{'type':Sequelize[_0x05b7('0x2')],'get':function(_0x31feea){return this[_0x05b7('0x3')]('field');}},'field':{'type':Sequelize[_0x05b7('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x05b7('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x05b7('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 2a62ca6..ed4194e 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(_0x5b3993,_0x3a0b60){var _0x246a9a=function(_0x250965){while(--_0x250965){_0x5b3993['push'](_0x5b3993['shift']());}};_0x246a9a(++_0x3a0b60);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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 _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(_0x84ce47,_0x48f64a){var _0x1c0357=function(_0x2a5b3a){while(--_0x2a5b3a){_0x84ce47['push'](_0x84ce47['shift']());}};_0x1c0357(++_0x48f64a);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index cc3b345..26d1ba8 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 _0xe3a9=['exports','define','Condition','tools_conditions','lodash','util','../../config/logger','api','request-promise','rimraf'];(function(_0x12b8ec,_0x1655be){var _0x21af77=function(_0xe59f){while(--_0xe59f){_0x12b8ec['push'](_0x12b8ec['shift']());}};_0x21af77(++_0x1655be);}(_0xe3a9,0xea));var _0x9e3a=function(_0x13606d,_0x30f265){_0x13606d=_0x13606d-0x0;var _0x1b85b0=_0xe3a9[_0x13606d];return _0x1b85b0;};'use strict';var _=require(_0x9e3a('0x0'));var util=require(_0x9e3a('0x1'));var logger=require(_0x9e3a('0x2'))(_0x9e3a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9e3a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9e3a('0x5'));var config=require('../../config/environment');var attributes=require('./condition.attributes');module[_0x9e3a('0x6')]=function(_0x1f39b0,_0x1984ad){return _0x1f39b0[_0x9e3a('0x7')](_0x9e3a('0x8'),attributes,{'tableName':_0x9e3a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x408c=['api','moment','bluebird','request-promise','../../config/environment','./condition.attributes','define','tools_conditions','lodash','util','../../config/logger'];(function(_0x572706,_0xadcdb5){var _0x556ee9=function(_0x5c174b){while(--_0x5c174b){_0x572706['push'](_0x572706['shift']());}};_0x556ee9(++_0xadcdb5);}(_0x408c,0x152));var _0xc408=function(_0xbe5e12,_0x267c66){_0xbe5e12=_0xbe5e12-0x0;var _0x255547=_0x408c[_0xbe5e12];return _0x255547;};'use strict';var _=require(_0xc408('0x0'));var util=require(_0xc408('0x1'));var logger=require(_0xc408('0x2'))(_0xc408('0x3'));var moment=require(_0xc408('0x4'));var BPromise=require(_0xc408('0x5'));var rp=require(_0xc408('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc408('0x7'));var attributes=require(_0xc408('0x8'));module['exports']=function(_0x56c30a,_0x2376c2){return _0x56c30a[_0xc408('0x9')]('Condition',attributes,{'tableName':_0xc408('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 ffee127..c813b94 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 _0x8b3b=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','code','error','message','Condition,\x20%s,\x20%s','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4768b6,_0x4eb7af){var _0x578d77=function(_0x3d190d){while(--_0x3d190d){_0x4768b6['push'](_0x4768b6['shift']());}};_0x578d77(++_0x4eb7af);}(_0x8b3b,0x8a));var _0xb8b3=function(_0x31c27f,_0x40294c){_0x31c27f=_0x31c27f-0x0;var _0x28f9c6=_0x8b3b[_0x31c27f];return _0x28f9c6;};'use strict';var _=require(_0xb8b3('0x0'));var util=require(_0xb8b3('0x1'));var moment=require('moment');var BPromise=require(_0xb8b3('0x2'));var rs=require(_0xb8b3('0x3'));var fs=require('fs');var Redis=require(_0xb8b3('0x4'));var db=require(_0xb8b3('0x5'))['db'];var utils=require(_0xb8b3('0x6'));var logger=require(_0xb8b3('0x7'))(_0xb8b3('0x8'));var config=require(_0xb8b3('0x9'));var jayson=require(_0xb8b3('0xa'));var client=jayson[_0xb8b3('0xb')][_0xb8b3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc13e68,_0x28b450,_0x3f75ad){return new BPromise(function(_0x3d1121,_0xfa5fe0){return client[_0xb8b3('0xd')](_0xc13e68,_0x3f75ad)[_0xb8b3('0xe')](function(_0x527f37){logger[_0xb8b3('0xf')]('Condition,\x20%s,\x20%s',_0x28b450,_0xb8b3('0x10'));logger[_0xb8b3('0x11')](_0xb8b3('0x12'),_0x28b450,_0xb8b3('0x10'),JSON['stringify'](_0x527f37));if(_0x527f37['error']){if(_0x527f37['error'][_0xb8b3('0x13')]===0x1f4){logger[_0xb8b3('0x14')]('Condition,\x20%s,\x20%s',_0x28b450,_0x527f37['error'][_0xb8b3('0x15')]);return _0xfa5fe0(_0x527f37['error'][_0xb8b3('0x15')]);}logger[_0xb8b3('0x14')](_0xb8b3('0x16'),_0x28b450,_0x527f37[_0xb8b3('0x14')]['message']);return _0x3d1121(_0x527f37['error']['message']);}else{logger[_0xb8b3('0xf')]('Condition,\x20%s,\x20%s',_0x28b450,_0xb8b3('0x10'));_0x3d1121(_0x527f37[_0xb8b3('0x17')][_0xb8b3('0x15')]);}})['catch'](function(_0x5f1862){logger[_0xb8b3('0x14')](_0xb8b3('0x16'),_0x28b450,_0x5f1862);_0xfa5fe0(_0x5f1862);});});} \ No newline at end of file +var _0x9c62=['stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s'];(function(_0x1341e4,_0x58a32b){var _0x42173b=function(_0x5a6a7e){while(--_0x5a6a7e){_0x1341e4['push'](_0x1341e4['shift']());}};_0x42173b(++_0x58a32b);}(_0x9c62,0x1a6));var _0x29c6=function(_0x43992a,_0x1621e6){_0x43992a=_0x43992a-0x0;var _0x3689ff=_0x9c62[_0x43992a];return _0x3689ff;};'use strict';var _=require('lodash');var util=require(_0x29c6('0x0'));var moment=require(_0x29c6('0x1'));var BPromise=require(_0x29c6('0x2'));var rs=require(_0x29c6('0x3'));var fs=require('fs');var Redis=require(_0x29c6('0x4'));var db=require(_0x29c6('0x5'))['db'];var utils=require(_0x29c6('0x6'));var logger=require(_0x29c6('0x7'))(_0x29c6('0x8'));var config=require(_0x29c6('0x9'));var jayson=require(_0x29c6('0xa'));var client=jayson[_0x29c6('0xb')][_0x29c6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x30098b,_0x4170c9,_0x52f4e9){return new BPromise(function(_0x21f5a0,_0x2cc23e){return client[_0x29c6('0xd')](_0x30098b,_0x52f4e9)['then'](function(_0x470930){logger['info'](_0x29c6('0xe'),_0x4170c9,_0x29c6('0xf'));logger[_0x29c6('0x10')](_0x29c6('0x11'),_0x4170c9,'request\x20sent',JSON[_0x29c6('0x12')](_0x470930));if(_0x470930[_0x29c6('0x13')]){if(_0x470930['error'][_0x29c6('0x14')]===0x1f4){logger['error'](_0x29c6('0xe'),_0x4170c9,_0x470930['error'][_0x29c6('0x15')]);return _0x2cc23e(_0x470930[_0x29c6('0x13')]['message']);}logger[_0x29c6('0x13')](_0x29c6('0xe'),_0x4170c9,_0x470930[_0x29c6('0x13')][_0x29c6('0x15')]);return _0x21f5a0(_0x470930[_0x29c6('0x13')][_0x29c6('0x15')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0x4170c9,'request\x20sent');_0x21f5a0(_0x470930['result']['message']);}})['catch'](function(_0x393c18){logger[_0x29c6('0x13')]('Condition,\x20%s,\x20%s',_0x4170c9,_0x393c18);_0x2cc23e(_0x393c18);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 6276d35..0416e6b 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 _0xc78c=['../../components/interaction/service','../../config/environment','./condition.controller','update','delete','/:id','isAuthenticated','destroy','exports','util','express','Router','fs-extra','../../components/auth/service'];(function(_0x5762cc,_0xffa080){var _0x1d66b5=function(_0x13fef0){while(--_0x13fef0){_0x5762cc['push'](_0x5762cc['shift']());}};_0x1d66b5(++_0xffa080);}(_0xc78c,0x6b));var _0xcc78=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xc78c[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require('multer');var util=require(_0xcc78('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcc78('0x1'));var router=express[_0xcc78('0x2')]();var fs_extra=require(_0xcc78('0x3'));var auth=require(_0xcc78('0x4'));var interaction=require(_0xcc78('0x5'));var config=require(_0xcc78('0x6'));var controller=require(_0xcc78('0x7'));router['put']('/:id',auth['isAuthenticated'](),controller[_0xcc78('0x8')]);router[_0xcc78('0x9')](_0xcc78('0xa'),auth[_0xcc78('0xb')](),controller[_0xcc78('0xc')]);module[_0xcc78('0xd')]=router; \ No newline at end of file +var _0x66eb=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','delete'];(function(_0x418501,_0x314402){var _0x18e63a=function(_0x34ab94){while(--_0x34ab94){_0x418501['push'](_0x418501['shift']());}};_0x18e63a(++_0x314402);}(_0x66eb,0x1a6));var _0xb66e=function(_0x1f83a5,_0x59843f){_0x1f83a5=_0x1f83a5-0x0;var _0x45edf0=_0x66eb[_0x1f83a5];return _0x45edf0;};'use strict';var multer=require(_0xb66e('0x0'));var util=require(_0xb66e('0x1'));var path=require(_0xb66e('0x2'));var timeout=require(_0xb66e('0x3'));var express=require(_0xb66e('0x4'));var router=express[_0xb66e('0x5')]();var fs_extra=require(_0xb66e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb66e('0x7'));var config=require('../../config/environment');var controller=require(_0xb66e('0x8'));router[_0xb66e('0x9')](_0xb66e('0xa'),auth[_0xb66e('0xb')](),controller['update']);router[_0xb66e('0xc')](_0xb66e('0xa'),auth[_0xb66e('0xb')](),controller[_0xb66e('0xd')]);module[_0xb66e('0xe')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 25c16d9..9c57602 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 _0x252f=['sequelize','exports','INTEGER','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x252f,0xd0));var _0xf252=function(_0x5eb4bb,_0xbd4598){_0x5eb4bb=_0x5eb4bb-0x0;var _0x12d25b=_0x252f[_0x5eb4bb];return _0x12d25b;};'use strict';var Sequelize=require(_0xf252('0x0'));module[_0xf252('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0xf252('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xf252('0x3')],'allowNull':!![]}}; \ No newline at end of file +var _0x0b59=['sequelize','exports','INTEGER','STRING'];(function(_0x2ed7d1,_0x363741){var _0x38ae3c=function(_0x4a1b42){while(--_0x4a1b42){_0x2ed7d1['push'](_0x2ed7d1['shift']());}};_0x38ae3c(++_0x363741);}(_0x0b59,0x198));var _0x90b5=function(_0x526291,_0x37a135){_0x526291=_0x526291-0x0;var _0x4b0d35=_0x0b59[_0x526291];return _0x4b0d35;};'use strict';var Sequelize=require(_0x90b5('0x0'));module[_0x90b5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x90b5('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x90b5('0x3')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 4645ca5..509bb88 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 _0xb016=['findAll','rows','show','keys','length','catch','create','role','user','UserProfileSection','find','userProfileId','autoAssociation','error','update','body','params','eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','ContactItemTypes','UserProfileResource','end','stack','name','send','index','map','ContactItemType','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x1443eb,_0x203408){var _0x2b8810=function(_0x48bc4e){while(--_0x48bc4e){_0x1443eb['push'](_0x1443eb['shift']());}};_0x2b8810(++_0x203408);}(_0xb016,0x159));var _0x6b01=function(_0x38ab67,_0x658877){_0x38ab67=_0x38ab67-0x0;var _0x2af9df=_0xb016[_0x38ab67];return _0x2af9df;};'use strict';var emlformat=require(_0x6b01('0x0'));var rimraf=require(_0x6b01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b01('0x2'));var moment=require('moment');var BPromise=require(_0x6b01('0x3'));var Mustache=require(_0x6b01('0x4'));var util=require(_0x6b01('0x5'));var path=require(_0x6b01('0x6'));var sox=require('sox');var csv=require(_0x6b01('0x7'));var ejs=require(_0x6b01('0x8'));var fs=require('fs');var fs_extra=require(_0x6b01('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b01('0xa'));var jsforce=require(_0x6b01('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b01('0xc'));var Papa=require(_0x6b01('0xd'));var Redis=require(_0x6b01('0xe'));var authService=require(_0x6b01('0xf'));var qs=require(_0x6b01('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b01('0x11'))(_0x6b01('0x12'));var utils=require(_0x6b01('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6b01('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51f976,_0x26f2a0){_0x26f2a0=_0x26f2a0||0xcc;return function(_0x4fa826){if(_0x4fa826){return _0x51f976[_0x6b01('0x15')](_0x26f2a0);}return _0x51f976[_0x6b01('0x16')](_0x26f2a0)['end']();};}function respondWithResult(_0x2c305e,_0x4ea5fa){_0x4ea5fa=_0x4ea5fa||0xc8;return function(_0x50d778){if(_0x50d778){return _0x2c305e['status'](_0x4ea5fa)[_0x6b01('0x17')](_0x50d778);}};}function respondWithFilteredResult(_0x4cbd38,_0x5b2f60){return function(_0x3a259f){if(_0x3a259f){var _0x327e86=typeof _0x5b2f60[_0x6b01('0x18')]===_0x6b01('0x19')&&typeof _0x5b2f60[_0x6b01('0x1a')]===_0x6b01('0x19');var _0x122769=_0x3a259f[_0x6b01('0x1b')];var _0x9c6571=_0x327e86?0x0:_0x5b2f60[_0x6b01('0x18')];var _0x18f336=_0x327e86?_0x3a259f['count']:_0x5b2f60[_0x6b01('0x18')]+_0x5b2f60[_0x6b01('0x1a')];var _0x3b0bab;if(_0x18f336>=_0x122769){_0x18f336=_0x122769;_0x3b0bab=0xc8;}else{_0x3b0bab=0xce;}_0x4cbd38[_0x6b01('0x16')](_0x3b0bab);return _0x4cbd38[_0x6b01('0x1c')](_0x6b01('0x1d'),_0x9c6571+'-'+_0x18f336+'/'+_0x122769)[_0x6b01('0x17')](_0x3a259f);}return null;};}function patchUpdates(_0x3c0573){return function(_0x54a942){try{jsonpatch[_0x6b01('0x1e')](_0x54a942,_0x3c0573,!![]);}catch(_0xc1f453){return BPromise[_0x6b01('0x1f')](_0xc1f453);}return _0x54a942[_0x6b01('0x20')]();};}function saveUpdates(_0x1fced4,_0x181b09){return function(_0x2cea6e){if(_0x2cea6e){return _0x2cea6e['update'](_0x1fced4)[_0x6b01('0x21')](function(_0xcf9200){return _0xcf9200;});}return null;};}function removeEntity(_0x42c990,_0x51243c){return function(_0x399808){if(_0x399808){return _0x399808[_0x6b01('0x22')]()[_0x6b01('0x21')](function(){var _0x2ae85e=_0x399808[_0x6b01('0x23')]({'plain':!![]});var _0x2456e9=_0x6b01('0x24');return db[_0x6b01('0x25')][_0x6b01('0x22')]({'where':{'type':_0x2456e9,'resourceId':_0x2ae85e['id']}})[_0x6b01('0x21')](function(){return _0x399808;});})[_0x6b01('0x21')](function(){_0x42c990[_0x6b01('0x16')](0xcc)[_0x6b01('0x26')]();});}};}function handleEntityNotFound(_0x55ca4b,_0x33d95d){return function(_0x220efb){if(!_0x220efb){_0x55ca4b[_0x6b01('0x15')](0x194);}return _0x220efb;};}function handleError(_0x21f165,_0x68491){_0x68491=_0x68491||0x1f4;return function(_0x528cbd){logger['error'](_0x528cbd[_0x6b01('0x27')]);if(_0x528cbd[_0x6b01('0x28')]){delete _0x528cbd[_0x6b01('0x28')];}_0x21f165[_0x6b01('0x16')](_0x68491)[_0x6b01('0x29')](_0x528cbd);};}exports[_0x6b01('0x2a')]=function(_0x542ca0,_0x39f193){var _0x5482a8={},_0x3942d7={},_0x4e7e32={'count':0x0,'rows':[]};var _0x6920cf=_[_0x6b01('0x2b')](db[_0x6b01('0x2c')][_0x6b01('0x2d')],function(_0x3c8009){return{'name':_0x3c8009['fieldName'],'type':_0x3c8009[_0x6b01('0x2e')][_0x6b01('0x2f')]};});_0x3942d7[_0x6b01('0x30')]=_['map'](_0x6920cf,'name');_0x3942d7[_0x6b01('0x31')]=_['keys'](_0x542ca0[_0x6b01('0x31')]);_0x3942d7[_0x6b01('0x32')]=_[_0x6b01('0x33')](_0x3942d7['model'],_0x3942d7[_0x6b01('0x31')]);_0x5482a8[_0x6b01('0x34')]=_[_0x6b01('0x33')](_0x3942d7['model'],qs[_0x6b01('0x35')](_0x542ca0[_0x6b01('0x31')][_0x6b01('0x35')]));_0x5482a8[_0x6b01('0x34')]=_0x5482a8[_0x6b01('0x34')]['length']?_0x5482a8[_0x6b01('0x34')]:_0x3942d7[_0x6b01('0x30')];if(!_0x542ca0[_0x6b01('0x31')][_0x6b01('0x36')](_0x6b01('0x37'))){_0x5482a8[_0x6b01('0x1a')]=qs[_0x6b01('0x1a')](_0x542ca0[_0x6b01('0x31')]['limit']);_0x5482a8[_0x6b01('0x18')]=qs['offset'](_0x542ca0[_0x6b01('0x31')][_0x6b01('0x18')]);}_0x5482a8[_0x6b01('0x38')]=qs[_0x6b01('0x39')](_0x542ca0[_0x6b01('0x31')][_0x6b01('0x39')]);_0x5482a8[_0x6b01('0x3a')]=qs['filters'](_[_0x6b01('0x3b')](_0x542ca0[_0x6b01('0x31')],_0x3942d7[_0x6b01('0x32')]),_0x6920cf);if(_0x542ca0[_0x6b01('0x31')][_0x6b01('0x3c')]){_0x5482a8[_0x6b01('0x3a')]=_[_0x6b01('0x3d')](_0x5482a8[_0x6b01('0x3a')],{'$or':_['map'](_0x6920cf,function(_0x2c42c3){if(_0x2c42c3['type']!==_0x6b01('0x3e')){var _0x422c38={};_0x422c38[_0x2c42c3['name']]={'$like':'%'+_0x542ca0[_0x6b01('0x31')][_0x6b01('0x3c')]+'%'};return _0x422c38;}})});}_0x5482a8=_[_0x6b01('0x3d')]({},_0x5482a8,_0x542ca0[_0x6b01('0x3f')]);var _0x2d4125={'where':_0x5482a8[_0x6b01('0x3a')]};return db[_0x6b01('0x2c')][_0x6b01('0x1b')](_0x2d4125)[_0x6b01('0x21')](function(_0x17f335){_0x4e7e32['count']=_0x17f335;if(_0x542ca0[_0x6b01('0x31')][_0x6b01('0x40')]){_0x5482a8['include']=[{'all':!![]}];}return db['ContactItemType'][_0x6b01('0x41')](_0x5482a8);})[_0x6b01('0x21')](function(_0x558ec1){_0x4e7e32[_0x6b01('0x42')]=_0x558ec1;return _0x4e7e32;})[_0x6b01('0x21')](respondWithFilteredResult(_0x39f193,_0x5482a8))['catch'](handleError(_0x39f193,null));};exports[_0x6b01('0x43')]=function(_0x5e6f28,_0x2ab117){var _0x1c6eba={'raw':!![],'where':{'id':_0x5e6f28['params']['id']}},_0xf52992={};_0xf52992[_0x6b01('0x30')]=_[_0x6b01('0x44')](db['ContactItemType']['rawAttributes']);_0xf52992['query']=_[_0x6b01('0x44')](_0x5e6f28[_0x6b01('0x31')]);_0xf52992[_0x6b01('0x32')]=_[_0x6b01('0x33')](_0xf52992[_0x6b01('0x30')],_0xf52992[_0x6b01('0x31')]);_0x1c6eba['attributes']=_[_0x6b01('0x33')](_0xf52992[_0x6b01('0x30')],qs[_0x6b01('0x35')](_0x5e6f28[_0x6b01('0x31')][_0x6b01('0x35')]));_0x1c6eba[_0x6b01('0x34')]=_0x1c6eba['attributes'][_0x6b01('0x45')]?_0x1c6eba['attributes']:_0xf52992['model'];if(_0x5e6f28[_0x6b01('0x31')][_0x6b01('0x40')]){_0x1c6eba['include']=[{'all':!![]}];}_0x1c6eba=_[_0x6b01('0x3d')]({},_0x1c6eba,_0x5e6f28[_0x6b01('0x3f')]);return db[_0x6b01('0x2c')]['find'](_0x1c6eba)['then'](handleEntityNotFound(_0x2ab117,null))['then'](respondWithResult(_0x2ab117,null))[_0x6b01('0x46')](handleError(_0x2ab117,null));};exports[_0x6b01('0x47')]=function(_0x518d94,_0x34cef6){return db['ContactItemType']['create'](_0x518d94['body'],{})[_0x6b01('0x21')](function(_0x45288a){var _0x4baef8=_0x518d94['user'][_0x6b01('0x23')]({'plain':!![]});if(!_0x4baef8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4baef8[_0x6b01('0x48')]===_0x6b01('0x49')){var _0x32d446=_0x45288a[_0x6b01('0x23')]({'plain':!![]});var _0x13f6d7='ContactItemTypes';return db[_0x6b01('0x4a')][_0x6b01('0x4b')]({'where':{'name':_0x13f6d7,'userProfileId':_0x4baef8[_0x6b01('0x4c')]},'raw':!![]})['then'](function(_0x3884e){if(_0x3884e&&_0x3884e[_0x6b01('0x4d')]===0x0){return db['UserProfileResource'][_0x6b01('0x47')]({'name':_0x32d446[_0x6b01('0x28')],'resourceId':_0x32d446['id'],'type':_0x3884e[_0x6b01('0x28')],'sectionId':_0x3884e['id']},{})[_0x6b01('0x21')](function(){return _0x45288a;});}else{return _0x45288a;}})['catch'](function(_0x5d46e7){logger[_0x6b01('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d46e7);throw _0x5d46e7;});}return _0x45288a;})['then'](respondWithResult(_0x34cef6,0xc9))[_0x6b01('0x46')](handleError(_0x34cef6,null));};exports[_0x6b01('0x4f')]=function(_0x5b5c0c,_0x2bf4b5){if(_0x5b5c0c[_0x6b01('0x50')]['id']){delete _0x5b5c0c['body']['id'];}return db[_0x6b01('0x2c')][_0x6b01('0x4b')]({'where':{'id':_0x5b5c0c[_0x6b01('0x51')]['id']}})[_0x6b01('0x21')](handleEntityNotFound(_0x2bf4b5,null))[_0x6b01('0x21')](saveUpdates(_0x5b5c0c['body'],null))[_0x6b01('0x21')](respondWithResult(_0x2bf4b5,null))['catch'](handleError(_0x2bf4b5,null));};exports[_0x6b01('0x22')]=function(_0x331815,_0x415fdd){return db['ContactItemType'][_0x6b01('0x4b')]({'where':{'id':_0x331815[_0x6b01('0x51')]['id']}})[_0x6b01('0x21')](handleEntityNotFound(_0x415fdd,null))[_0x6b01('0x21')](db['CmContactHasItem'][_0x6b01('0x4f')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x331815[_0x6b01('0x51')]['id']}}))[_0x6b01('0x21')](removeEntity(_0x415fdd,null))['catch'](handleError(_0x415fdd,null));}; \ No newline at end of file +var _0xcf66=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','CmContactHasItem','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','name','ContactItemType','rawAttributes','type','key','model','map'];(function(_0x5c1c1b,_0x12e240){var _0x3da261=function(_0x2e0cd1){while(--_0x2e0cd1){_0x5c1c1b['push'](_0x5c1c1b['shift']());}};_0x3da261(++_0x12e240);}(_0xcf66,0x71));var _0x6cf6=function(_0x25c776,_0x91c3ce){_0x25c776=_0x25c776-0x0;var _0x4b2dee=_0xcf66[_0x25c776];return _0x4b2dee;};'use strict';var emlformat=require(_0x6cf6('0x0'));var rimraf=require(_0x6cf6('0x1'));var zipdir=require(_0x6cf6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6cf6('0x3'));var moment=require(_0x6cf6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6cf6('0x5'));var path=require(_0x6cf6('0x6'));var sox=require('sox');var csv=require(_0x6cf6('0x7'));var ejs=require(_0x6cf6('0x8'));var fs=require('fs');var fs_extra=require(_0x6cf6('0x9'));var _=require('lodash');var squel=require(_0x6cf6('0xa'));var crypto=require(_0x6cf6('0xb'));var jsforce=require(_0x6cf6('0xc'));var deskjs=require(_0x6cf6('0xd'));var toCsv=require(_0x6cf6('0x7'));var querystring=require(_0x6cf6('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6cf6('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6cf6('0x10'));var logger=require(_0x6cf6('0x11'))(_0x6cf6('0x12'));var utils=require(_0x6cf6('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fdfea,_0x13b1ad){_0x13b1ad=_0x13b1ad||0xcc;return function(_0x372d12){if(_0x372d12){return _0x3fdfea[_0x6cf6('0x14')](_0x13b1ad);}return _0x3fdfea[_0x6cf6('0x15')](_0x13b1ad)[_0x6cf6('0x16')]();};}function respondWithResult(_0x57909f,_0x32fe64){_0x32fe64=_0x32fe64||0xc8;return function(_0x494ece){if(_0x494ece){return _0x57909f[_0x6cf6('0x15')](_0x32fe64)[_0x6cf6('0x17')](_0x494ece);}};}function respondWithFilteredResult(_0x4b073f,_0x40e413){return function(_0x1b40f8){if(_0x1b40f8){var _0x2d23ab=typeof _0x40e413[_0x6cf6('0x18')]===_0x6cf6('0x19')&&typeof _0x40e413[_0x6cf6('0x1a')]===_0x6cf6('0x19');var _0x39ec25=_0x1b40f8[_0x6cf6('0x1b')];var _0x2ca2b1=_0x2d23ab?0x0:_0x40e413['offset'];var _0x11d994=_0x2d23ab?_0x1b40f8[_0x6cf6('0x1b')]:_0x40e413[_0x6cf6('0x18')]+_0x40e413['limit'];var _0x18abd9;if(_0x11d994>=_0x39ec25){_0x11d994=_0x39ec25;_0x18abd9=0xc8;}else{_0x18abd9=0xce;}_0x4b073f[_0x6cf6('0x15')](_0x18abd9);return _0x4b073f[_0x6cf6('0x1c')](_0x6cf6('0x1d'),_0x2ca2b1+'-'+_0x11d994+'/'+_0x39ec25)[_0x6cf6('0x17')](_0x1b40f8);}return null;};}function patchUpdates(_0x21e903){return function(_0x123993){try{jsonpatch['apply'](_0x123993,_0x21e903,!![]);}catch(_0x19f2cd){return BPromise[_0x6cf6('0x1e')](_0x19f2cd);}return _0x123993[_0x6cf6('0x1f')]();};}function saveUpdates(_0x380a40,_0x5cba3a){return function(_0x470ea4){if(_0x470ea4){return _0x470ea4[_0x6cf6('0x20')](_0x380a40)[_0x6cf6('0x21')](function(_0x5b2767){return _0x5b2767;});}return null;};}function removeEntity(_0x5b30e0,_0x276225){return function(_0x59f838){if(_0x59f838){return _0x59f838[_0x6cf6('0x22')]()[_0x6cf6('0x21')](function(){var _0x14ae3e=_0x59f838[_0x6cf6('0x23')]({'plain':!![]});var _0x3f9871=_0x6cf6('0x24');return db[_0x6cf6('0x25')]['destroy']({'where':{'type':_0x3f9871,'resourceId':_0x14ae3e['id']}})[_0x6cf6('0x21')](function(){return _0x59f838;});})[_0x6cf6('0x21')](function(){_0x5b30e0[_0x6cf6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf4eec5,_0x2e56ca){return function(_0x2224db){if(!_0x2224db){_0xf4eec5[_0x6cf6('0x14')](0x194);}return _0x2224db;};}function handleError(_0x5c9236,_0x584594){_0x584594=_0x584594||0x1f4;return function(_0x2afe84){logger[_0x6cf6('0x26')](_0x2afe84[_0x6cf6('0x27')]);if(_0x2afe84[_0x6cf6('0x28')]){delete _0x2afe84['name'];}_0x5c9236[_0x6cf6('0x15')](_0x584594)['send'](_0x2afe84);};}exports['index']=function(_0x519a70,_0x10bde5){var _0x65433={},_0x33d308={},_0x42f488={'count':0x0,'rows':[]};var _0x11c848=_['map'](db[_0x6cf6('0x29')][_0x6cf6('0x2a')],function(_0x356340){return{'name':_0x356340['fieldName'],'type':_0x356340[_0x6cf6('0x2b')][_0x6cf6('0x2c')]};});_0x33d308[_0x6cf6('0x2d')]=_[_0x6cf6('0x2e')](_0x11c848,_0x6cf6('0x28'));_0x33d308[_0x6cf6('0x2f')]=_[_0x6cf6('0x30')](_0x519a70[_0x6cf6('0x2f')]);_0x33d308[_0x6cf6('0x31')]=_[_0x6cf6('0x32')](_0x33d308[_0x6cf6('0x2d')],_0x33d308[_0x6cf6('0x2f')]);_0x65433[_0x6cf6('0x33')]=_[_0x6cf6('0x32')](_0x33d308[_0x6cf6('0x2d')],qs[_0x6cf6('0x34')](_0x519a70[_0x6cf6('0x2f')][_0x6cf6('0x34')]));_0x65433['attributes']=_0x65433[_0x6cf6('0x33')][_0x6cf6('0x35')]?_0x65433[_0x6cf6('0x33')]:_0x33d308[_0x6cf6('0x2d')];if(!_0x519a70[_0x6cf6('0x2f')][_0x6cf6('0x36')](_0x6cf6('0x37'))){_0x65433[_0x6cf6('0x1a')]=qs[_0x6cf6('0x1a')](_0x519a70[_0x6cf6('0x2f')][_0x6cf6('0x1a')]);_0x65433['offset']=qs[_0x6cf6('0x18')](_0x519a70[_0x6cf6('0x2f')][_0x6cf6('0x18')]);}_0x65433[_0x6cf6('0x38')]=qs[_0x6cf6('0x39')](_0x519a70[_0x6cf6('0x2f')][_0x6cf6('0x39')]);_0x65433[_0x6cf6('0x3a')]=qs[_0x6cf6('0x31')](_['pick'](_0x519a70[_0x6cf6('0x2f')],_0x33d308[_0x6cf6('0x31')]),_0x11c848);if(_0x519a70[_0x6cf6('0x2f')][_0x6cf6('0x3b')]){_0x65433[_0x6cf6('0x3a')]=_[_0x6cf6('0x3c')](_0x65433[_0x6cf6('0x3a')],{'$or':_[_0x6cf6('0x2e')](_0x11c848,function(_0x3a7c3b){if(_0x3a7c3b['type']!==_0x6cf6('0x3d')){var _0x5a9727={};_0x5a9727[_0x3a7c3b[_0x6cf6('0x28')]]={'$like':'%'+_0x519a70[_0x6cf6('0x2f')][_0x6cf6('0x3b')]+'%'};return _0x5a9727;}})});}_0x65433=_[_0x6cf6('0x3c')]({},_0x65433,_0x519a70[_0x6cf6('0x3e')]);var _0x29541e={'where':_0x65433[_0x6cf6('0x3a')]};return db[_0x6cf6('0x29')]['count'](_0x29541e)[_0x6cf6('0x21')](function(_0x335dce){_0x42f488['count']=_0x335dce;if(_0x519a70[_0x6cf6('0x2f')][_0x6cf6('0x3f')]){_0x65433[_0x6cf6('0x40')]=[{'all':!![]}];}return db['ContactItemType'][_0x6cf6('0x41')](_0x65433);})[_0x6cf6('0x21')](function(_0x51d915){_0x42f488[_0x6cf6('0x42')]=_0x51d915;return _0x42f488;})[_0x6cf6('0x21')](respondWithFilteredResult(_0x10bde5,_0x65433))[_0x6cf6('0x43')](handleError(_0x10bde5,null));};exports[_0x6cf6('0x44')]=function(_0x41195e,_0x20dacd){var _0xbcb6a7={'raw':!![],'where':{'id':_0x41195e[_0x6cf6('0x45')]['id']}},_0x5a2ef8={};_0x5a2ef8['model']=_[_0x6cf6('0x30')](db[_0x6cf6('0x29')]['rawAttributes']);_0x5a2ef8[_0x6cf6('0x2f')]=_[_0x6cf6('0x30')](_0x41195e[_0x6cf6('0x2f')]);_0x5a2ef8[_0x6cf6('0x31')]=_[_0x6cf6('0x32')](_0x5a2ef8['model'],_0x5a2ef8[_0x6cf6('0x2f')]);_0xbcb6a7[_0x6cf6('0x33')]=_[_0x6cf6('0x32')](_0x5a2ef8['model'],qs[_0x6cf6('0x34')](_0x41195e[_0x6cf6('0x2f')][_0x6cf6('0x34')]));_0xbcb6a7['attributes']=_0xbcb6a7[_0x6cf6('0x33')]['length']?_0xbcb6a7['attributes']:_0x5a2ef8[_0x6cf6('0x2d')];if(_0x41195e[_0x6cf6('0x2f')][_0x6cf6('0x3f')]){_0xbcb6a7[_0x6cf6('0x40')]=[{'all':!![]}];}_0xbcb6a7=_[_0x6cf6('0x3c')]({},_0xbcb6a7,_0x41195e[_0x6cf6('0x3e')]);return db[_0x6cf6('0x29')][_0x6cf6('0x46')](_0xbcb6a7)[_0x6cf6('0x21')](handleEntityNotFound(_0x20dacd,null))[_0x6cf6('0x21')](respondWithResult(_0x20dacd,null))[_0x6cf6('0x43')](handleError(_0x20dacd,null));};exports[_0x6cf6('0x47')]=function(_0x3786d1,_0x4c8ada){return db[_0x6cf6('0x29')][_0x6cf6('0x47')](_0x3786d1['body'],{})['then'](function(_0x10047a){var _0x17dd6e=_0x3786d1[_0x6cf6('0x48')][_0x6cf6('0x23')]({'plain':!![]});if(!_0x17dd6e)throw new Error(_0x6cf6('0x49'));if(_0x17dd6e[_0x6cf6('0x4a')]==='user'){var _0x115b9b=_0x10047a[_0x6cf6('0x23')]({'plain':!![]});var _0x2503dc='ContactItemTypes';return db['UserProfileSection'][_0x6cf6('0x46')]({'where':{'name':_0x2503dc,'userProfileId':_0x17dd6e[_0x6cf6('0x4b')]},'raw':!![]})[_0x6cf6('0x21')](function(_0x255e88){if(_0x255e88&&_0x255e88[_0x6cf6('0x4c')]===0x0){return db[_0x6cf6('0x25')][_0x6cf6('0x47')]({'name':_0x115b9b[_0x6cf6('0x28')],'resourceId':_0x115b9b['id'],'type':_0x255e88[_0x6cf6('0x28')],'sectionId':_0x255e88['id']},{})[_0x6cf6('0x21')](function(){return _0x10047a;});}else{return _0x10047a;}})['catch'](function(_0x217072){logger[_0x6cf6('0x26')](_0x6cf6('0x4d'),_0x217072);throw _0x217072;});}return _0x10047a;})[_0x6cf6('0x21')](respondWithResult(_0x4c8ada,0xc9))[_0x6cf6('0x43')](handleError(_0x4c8ada,null));};exports[_0x6cf6('0x20')]=function(_0x2e1ee7,_0xce361){if(_0x2e1ee7[_0x6cf6('0x4e')]['id']){delete _0x2e1ee7[_0x6cf6('0x4e')]['id'];}return db[_0x6cf6('0x29')]['find']({'where':{'id':_0x2e1ee7[_0x6cf6('0x45')]['id']}})['then'](handleEntityNotFound(_0xce361,null))[_0x6cf6('0x21')](saveUpdates(_0x2e1ee7[_0x6cf6('0x4e')],null))['then'](respondWithResult(_0xce361,null))[_0x6cf6('0x43')](handleError(_0xce361,null));};exports[_0x6cf6('0x22')]=function(_0x4699d5,_0x1bdbc1){return db[_0x6cf6('0x29')][_0x6cf6('0x46')]({'where':{'id':_0x4699d5['params']['id']}})[_0x6cf6('0x21')](handleEntityNotFound(_0x1bdbc1,null))[_0x6cf6('0x21')](db[_0x6cf6('0x4f')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x4699d5['params']['id']}}))[_0x6cf6('0x21')](removeEntity(_0x1bdbc1,null))[_0x6cf6('0x43')](handleError(_0x1bdbc1,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index ae57b3a..08b1631 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 _0x9c93=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','define','ContactItemType','lodash','util'];(function(_0x1de389,_0x1fd154){var _0x1469e7=function(_0x1d5836){while(--_0x1d5836){_0x1de389['push'](_0x1de389['shift']());}};_0x1469e7(++_0x1fd154);}(_0x9c93,0xb9));var _0x39c9=function(_0x5c1353,_0x328298){_0x5c1353=_0x5c1353-0x0;var _0x31e2e6=_0x9c93[_0x5c1353];return _0x31e2e6;};'use strict';var _=require(_0x39c9('0x0'));var util=require(_0x39c9('0x1'));var logger=require(_0x39c9('0x2'))(_0x39c9('0x3'));var moment=require(_0x39c9('0x4'));var BPromise=require(_0x39c9('0x5'));var rp=require(_0x39c9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x39c9('0x7'));var attributes=require('./contactItemType.attributes');module[_0x39c9('0x8')]=function(_0x67c1b4,_0x50ab0a){return _0x67c1b4[_0x39c9('0x9')](_0x39c9('0xa'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10e1=['lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./contactItemType.attributes','exports'];(function(_0x30eb6a,_0x117e31){var _0x211a3e=function(_0x4a06e9){while(--_0x4a06e9){_0x30eb6a['push'](_0x30eb6a['shift']());}};_0x211a3e(++_0x117e31);}(_0x10e1,0xab));var _0x110e=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x10e1[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0x110e('0x0'));var util=require(_0x110e('0x1'));var logger=require(_0x110e('0x2'))(_0x110e('0x3'));var moment=require('moment');var BPromise=require(_0x110e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x110e('0x5'));var rimraf=require('rimraf');var config=require(_0x110e('0x6'));var attributes=require(_0x110e('0x7'));module[_0x110e('0x8')]=function(_0x1b5f77,_0x578ef0){return _0x1b5f77['define']('ContactItemType',attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 5c7f08d..1b37b97 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 _0xbccf=['error','message','request\x20sent','result','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x3b08de,_0x63ddd0){var _0x53fbe4=function(_0x16eea2){while(--_0x16eea2){_0x3b08de['push'](_0x3b08de['shift']());}};_0x53fbe4(++_0x63ddd0);}(_0xbccf,0x1d2));var _0xfbcc=function(_0x29bf80,_0x4af855){_0x29bf80=_0x29bf80-0x0;var _0x932096=_0xbccf[_0x29bf80];return _0x932096;};'use strict';var _=require(_0xfbcc('0x0'));var util=require('util');var moment=require(_0xfbcc('0x1'));var BPromise=require('bluebird');var rs=require(_0xfbcc('0x2'));var fs=require('fs');var Redis=require(_0xfbcc('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfbcc('0x4'))(_0xfbcc('0x5'));var config=require(_0xfbcc('0x6'));var jayson=require(_0xfbcc('0x7'));var client=jayson[_0xfbcc('0x8')][_0xfbcc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c07f6,_0x9b993f,_0x28bda7){return new BPromise(function(_0x312c50,_0x142a2c){return client[_0xfbcc('0xa')](_0x1c07f6,_0x28bda7)[_0xfbcc('0xb')](function(_0x3c3f72){logger[_0xfbcc('0xc')](_0xfbcc('0xd'),_0x9b993f,'request\x20sent');logger[_0xfbcc('0xe')](_0xfbcc('0xf'),_0x9b993f,'request\x20sent',JSON[_0xfbcc('0x10')](_0x3c3f72));if(_0x3c3f72['error']){if(_0x3c3f72['error'][_0xfbcc('0x11')]===0x1f4){logger[_0xfbcc('0x12')](_0xfbcc('0xd'),_0x9b993f,_0x3c3f72['error'][_0xfbcc('0x13')]);return _0x142a2c(_0x3c3f72[_0xfbcc('0x12')]['message']);}logger[_0xfbcc('0x12')](_0xfbcc('0xd'),_0x9b993f,_0x3c3f72[_0xfbcc('0x12')][_0xfbcc('0x13')]);return _0x312c50(_0x3c3f72['error'][_0xfbcc('0x13')]);}else{logger['info'](_0xfbcc('0xd'),_0x9b993f,_0xfbcc('0x14'));_0x312c50(_0x3c3f72[_0xfbcc('0x15')]['message']);}})['catch'](function(_0x189c02){logger[_0xfbcc('0x12')](_0xfbcc('0xd'),_0x9b993f,_0x189c02);_0x142a2c(_0x189c02);});});} \ No newline at end of file +var _0xc8f7=['rpc','../../config/environment','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5ec3e2,_0x5294df){var _0x152654=function(_0x4c1669){while(--_0x4c1669){_0x5ec3e2['push'](_0x5ec3e2['shift']());}};_0x152654(++_0x5294df);}(_0xc8f7,0x99));var _0x7c8f=function(_0x24cdf2,_0x54ade2){_0x24cdf2=_0x24cdf2-0x0;var _0x323890=_0xc8f7[_0x24cdf2];return _0x323890;};'use strict';var _=require(_0x7c8f('0x0'));var util=require(_0x7c8f('0x1'));var moment=require(_0x7c8f('0x2'));var BPromise=require(_0x7c8f('0x3'));var rs=require(_0x7c8f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c8f('0x5'))['db'];var utils=require(_0x7c8f('0x6'));var logger=require(_0x7c8f('0x7'))(_0x7c8f('0x8'));var config=require(_0x7c8f('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x32763e,_0x371dc1,_0x2a0ffa){return new BPromise(function(_0x4fb01c,_0x43952f){return client[_0x7c8f('0xa')](_0x32763e,_0x2a0ffa)[_0x7c8f('0xb')](function(_0xf72014){logger[_0x7c8f('0xc')](_0x7c8f('0xd'),_0x371dc1,_0x7c8f('0xe'));logger[_0x7c8f('0xf')](_0x7c8f('0x10'),_0x371dc1,_0x7c8f('0xe'),JSON[_0x7c8f('0x11')](_0xf72014));if(_0xf72014[_0x7c8f('0x12')]){if(_0xf72014[_0x7c8f('0x12')][_0x7c8f('0x13')]===0x1f4){logger[_0x7c8f('0x12')]('ContactItemType,\x20%s,\x20%s',_0x371dc1,_0xf72014['error'][_0x7c8f('0x14')]);return _0x43952f(_0xf72014[_0x7c8f('0x12')][_0x7c8f('0x14')]);}logger['error'](_0x7c8f('0xd'),_0x371dc1,_0xf72014[_0x7c8f('0x12')][_0x7c8f('0x14')]);return _0x4fb01c(_0xf72014[_0x7c8f('0x12')][_0x7c8f('0x14')]);}else{logger[_0x7c8f('0xc')]('ContactItemType,\x20%s,\x20%s',_0x371dc1,_0x7c8f('0xe'));_0x4fb01c(_0xf72014[_0x7c8f('0x15')][_0x7c8f('0x14')]);}})[_0x7c8f('0x16')](function(_0x581d58){logger[_0x7c8f('0x12')](_0x7c8f('0xd'),_0x371dc1,_0x581d58);_0x43952f(_0x581d58);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index f44d12a..f327410 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 _0x34e0=['get','isAuthenticated','index','/:id','post','put','delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./contactItemType.controller'];(function(_0x4014ce,_0x52c228){var _0x3ac146=function(_0xbe3d77){while(--_0xbe3d77){_0x4014ce['push'](_0x4014ce['shift']());}};_0x3ac146(++_0x52c228);}(_0x34e0,0xf8));var _0x034e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x34e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require(_0x034e('0x0'));var path=require(_0x034e('0x1'));var timeout=require(_0x034e('0x2'));var express=require(_0x034e('0x3'));var router=express['Router']();var fs_extra=require(_0x034e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x034e('0x5'));var config=require(_0x034e('0x6'));var controller=require(_0x034e('0x7'));router[_0x034e('0x8')]('/',auth[_0x034e('0x9')](),controller[_0x034e('0xa')]);router[_0x034e('0x8')](_0x034e('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x034e('0xc')]('/',auth[_0x034e('0x9')](),controller['create']);router[_0x034e('0xd')](_0x034e('0xb'),auth[_0x034e('0x9')](),controller['update']);router[_0x034e('0xe')](_0x034e('0xb'),auth[_0x034e('0x9')](),controller[_0x034e('0xf')]);module['exports']=router; \ No newline at end of file +var _0x139f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','create','put','exports','multer','util','path','express','Router'];(function(_0x2648d8,_0xc8c4fe){var _0x11525e=function(_0xdfb938){while(--_0xdfb938){_0x2648d8['push'](_0x2648d8['shift']());}};_0x11525e(++_0xc8c4fe);}(_0x139f,0x160));var _0xf139=function(_0x4bae4b,_0x304cb8){_0x4bae4b=_0x4bae4b-0x0;var _0x9bea5a=_0x139f[_0x4bae4b];return _0x9bea5a;};'use strict';var multer=require(_0xf139('0x0'));var util=require(_0xf139('0x1'));var path=require(_0xf139('0x2'));var timeout=require('connect-timeout');var express=require(_0xf139('0x3'));var router=express[_0xf139('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf139('0x5'));var interaction=require(_0xf139('0x6'));var config=require(_0xf139('0x7'));var controller=require(_0xf139('0x8'));router[_0xf139('0x9')]('/',auth[_0xf139('0xa')](),controller[_0xf139('0xb')]);router[_0xf139('0x9')](_0xf139('0xc'),auth[_0xf139('0xa')](),controller[_0xf139('0xd')]);router['post']('/',auth[_0xf139('0xa')](),controller[_0xf139('0xe')]);router[_0xf139('0xf')](_0xf139('0xc'),auth[_0xf139('0xa')](),controller['update']);router['delete'](_0xf139('0xc'),auth[_0xf139('0xa')](),controller['destroy']);module[_0xf139('0x10')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 5936de1..a78825f 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 _0xe706=['STRING','sequelize','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe706,0xa3));var _0x6e70=function(_0x590381,_0x5c3948){_0x590381=_0x590381-0x0;var _0xe300df=_0xe706[_0x590381];return _0xe300df;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x1d80be,_0x3a60ff){var _0xf9a4f3=function(_0x5b8a08){while(--_0x5b8a08){_0x1d80be['push'](_0x1d80be['shift']());}};_0xf9a4f3(++_0x3a60ff);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'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 diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 44e1326..050b049 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 _0x7bbe=['crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','./dashboard.socket','sendStatus','status','end','json','limit','count','offset','set','apply','save','update','destroy','then','get','error','stack','name','send','map','Dashboard','rawAttributes','fieldName','type','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','keys','find','create','body','user','role','CustomDashboards','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','options','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','iframe','attrUrl','attrs','https://','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrSmsAccounts','web-report','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','intersection','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x52799c,_0x3d006f){var _0x23f37b=function(_0x31995b){while(--_0x31995b){_0x52799c['push'](_0x52799c['shift']());}};_0x23f37b(++_0x3d006f);}(_0x7bbe,0x1e5));var _0xe7bb=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x7bbe[_0x2faddb];return _0x273c05;};'use strict';var emlformat=require(_0xe7bb('0x0'));var rimraf=require(_0xe7bb('0x1'));var zipdir=require(_0xe7bb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe7bb('0x3'));var BPromise=require(_0xe7bb('0x4'));var Mustache=require(_0xe7bb('0x5'));var util=require('util');var path=require('path');var sox=require(_0xe7bb('0x6'));var csv=require(_0xe7bb('0x7'));var ejs=require(_0xe7bb('0x8'));var fs=require('fs');var fs_extra=require(_0xe7bb('0x9'));var _=require(_0xe7bb('0xa'));var squel=require('squel');var crypto=require(_0xe7bb('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe7bb('0x7'));var querystring=require(_0xe7bb('0xc'));var Papa=require(_0xe7bb('0xd'));var Redis=require(_0xe7bb('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe7bb('0xf'));var as=require(_0xe7bb('0x10'));var hardwareService=require(_0xe7bb('0x11'));var logger=require(_0xe7bb('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe7bb('0x13'));var db=require(_0xe7bb('0x14'))['db'];config[_0xe7bb('0x15')]=_[_0xe7bb('0x16')](config[_0xe7bb('0x15')],{'host':_0xe7bb('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe7bb('0x18'))['register'](socket);function respondWithStatusCode(_0x5a6347,_0x5877d2){_0x5877d2=_0x5877d2||0xcc;return function(_0x5ab377){if(_0x5ab377){return _0x5a6347[_0xe7bb('0x19')](_0x5877d2);}return _0x5a6347[_0xe7bb('0x1a')](_0x5877d2)[_0xe7bb('0x1b')]();};}function respondWithResult(_0x1e6126,_0x44b2ea){_0x44b2ea=_0x44b2ea||0xc8;return function(_0x901ebe){if(_0x901ebe){return _0x1e6126[_0xe7bb('0x1a')](_0x44b2ea)[_0xe7bb('0x1c')](_0x901ebe);}};}function respondWithFilteredResult(_0x469e9c,_0x27245e){return function(_0x4a79b5){if(_0x4a79b5){var _0xab0692=typeof _0x27245e['offset']==='undefined'&&typeof _0x27245e[_0xe7bb('0x1d')]==='undefined';var _0x371da9=_0x4a79b5[_0xe7bb('0x1e')];var _0x24660c=_0xab0692?0x0:_0x27245e['offset'];var _0x522b9e=_0xab0692?_0x4a79b5[_0xe7bb('0x1e')]:_0x27245e[_0xe7bb('0x1f')]+_0x27245e['limit'];var _0x4fd416;if(_0x522b9e>=_0x371da9){_0x522b9e=_0x371da9;_0x4fd416=0xc8;}else{_0x4fd416=0xce;}_0x469e9c[_0xe7bb('0x1a')](_0x4fd416);return _0x469e9c[_0xe7bb('0x20')]('Content-Range',_0x24660c+'-'+_0x522b9e+'/'+_0x371da9)['json'](_0x4a79b5);}return null;};}function patchUpdates(_0x224df9){return function(_0x5a0344){try{jsonpatch[_0xe7bb('0x21')](_0x5a0344,_0x224df9,!![]);}catch(_0x38b502){return BPromise['reject'](_0x38b502);}return _0x5a0344[_0xe7bb('0x22')]();};}function saveUpdates(_0x131168,_0x3ced3f){return function(_0x571320){if(_0x571320){return _0x571320[_0xe7bb('0x23')](_0x131168)['then'](function(_0x49f623){return _0x49f623;});}return null;};}function removeEntity(_0xb901d,_0x9146cf){return function(_0x2d412e){if(_0x2d412e){return _0x2d412e[_0xe7bb('0x24')]()[_0xe7bb('0x25')](function(){var _0x4a120e=_0x2d412e[_0xe7bb('0x26')]({'plain':!![]});var _0x1fac82='CustomDashboards';return db['UserProfileResource'][_0xe7bb('0x24')]({'where':{'type':_0x1fac82,'resourceId':_0x4a120e['id']}})[_0xe7bb('0x25')](function(){return _0x2d412e;});})[_0xe7bb('0x25')](function(){_0xb901d['status'](0xcc)[_0xe7bb('0x1b')]();});}};}function handleEntityNotFound(_0x401632,_0x2081f9){return function(_0x1de12f){if(!_0x1de12f){_0x401632[_0xe7bb('0x19')](0x194);}return _0x1de12f;};}function handleError(_0x2a54f6,_0x590b4f){_0x590b4f=_0x590b4f||0x1f4;return function(_0xcf746e){logger[_0xe7bb('0x27')](_0xcf746e[_0xe7bb('0x28')]);if(_0xcf746e[_0xe7bb('0x29')]){delete _0xcf746e[_0xe7bb('0x29')];}_0x2a54f6['status'](_0x590b4f)[_0xe7bb('0x2a')](_0xcf746e);};}exports['index']=function(_0x2b90e3,_0x32d23c){var _0x4e1d5b={},_0xfd9dbf={},_0x465d29={'count':0x0,'rows':[]};var _0x191025=_[_0xe7bb('0x2b')](db[_0xe7bb('0x2c')][_0xe7bb('0x2d')],function(_0x121c4d){return{'name':_0x121c4d[_0xe7bb('0x2e')],'type':_0x121c4d[_0xe7bb('0x2f')]['key']};});_0xfd9dbf[_0xe7bb('0x30')]=_[_0xe7bb('0x2b')](_0x191025,_0xe7bb('0x29'));_0xfd9dbf[_0xe7bb('0x31')]=_['keys'](_0x2b90e3[_0xe7bb('0x31')]);_0xfd9dbf[_0xe7bb('0x32')]=_['intersection'](_0xfd9dbf['model'],_0xfd9dbf[_0xe7bb('0x31')]);_0x4e1d5b[_0xe7bb('0x33')]=_['intersection'](_0xfd9dbf[_0xe7bb('0x30')],qs[_0xe7bb('0x34')](_0x2b90e3['query'][_0xe7bb('0x34')]));_0x4e1d5b['attributes']=_0x4e1d5b[_0xe7bb('0x33')][_0xe7bb('0x35')]?_0x4e1d5b[_0xe7bb('0x33')]:_0xfd9dbf[_0xe7bb('0x30')];if(!_0x2b90e3[_0xe7bb('0x31')][_0xe7bb('0x36')](_0xe7bb('0x37'))){_0x4e1d5b[_0xe7bb('0x1d')]=qs[_0xe7bb('0x1d')](_0x2b90e3[_0xe7bb('0x31')][_0xe7bb('0x1d')]);_0x4e1d5b['offset']=qs[_0xe7bb('0x1f')](_0x2b90e3[_0xe7bb('0x31')][_0xe7bb('0x1f')]);}_0x4e1d5b[_0xe7bb('0x38')]=qs['sort'](_0x2b90e3[_0xe7bb('0x31')][_0xe7bb('0x39')]);_0x4e1d5b[_0xe7bb('0x3a')]=qs[_0xe7bb('0x32')](_[_0xe7bb('0x3b')](_0x2b90e3['query'],_0xfd9dbf[_0xe7bb('0x32')]),_0x191025);if(_0x2b90e3['query'][_0xe7bb('0x3c')]){_0x4e1d5b[_0xe7bb('0x3a')]=_[_0xe7bb('0x3d')](_0x4e1d5b[_0xe7bb('0x3a')],{'$or':_[_0xe7bb('0x2b')](_0x191025,function(_0x2d2496){if(_0x2d2496[_0xe7bb('0x2f')]!==_0xe7bb('0x3e')){var _0x28ca2d={};_0x28ca2d[_0x2d2496[_0xe7bb('0x29')]]={'$like':'%'+_0x2b90e3[_0xe7bb('0x31')][_0xe7bb('0x3c')]+'%'};return _0x28ca2d;}})});}_0x4e1d5b=_['merge']({},_0x4e1d5b,_0x2b90e3['options']);var _0x311552={'where':_0x4e1d5b[_0xe7bb('0x3a')]};return db[_0xe7bb('0x2c')][_0xe7bb('0x1e')](_0x311552)[_0xe7bb('0x25')](function(_0x1451b2){_0x465d29[_0xe7bb('0x1e')]=_0x1451b2;if(_0x2b90e3[_0xe7bb('0x31')][_0xe7bb('0x3f')]){_0x4e1d5b[_0xe7bb('0x40')]=[{'all':!![]}];}return db['Dashboard'][_0xe7bb('0x41')](_0x4e1d5b);})[_0xe7bb('0x25')](function(_0x2dc707){_0x465d29['rows']=_0x2dc707;return _0x465d29;})[_0xe7bb('0x25')](respondWithFilteredResult(_0x32d23c,_0x4e1d5b))[_0xe7bb('0x42')](handleError(_0x32d23c,null));};exports[_0xe7bb('0x43')]=function(_0x3a202c,_0x433a93){var _0x5e396a={'raw':![],'where':{'id':_0x3a202c['params']['id']}},_0x5b5de1={};_0x5b5de1[_0xe7bb('0x30')]=_[_0xe7bb('0x44')](db['Dashboard'][_0xe7bb('0x2d')]);_0x5b5de1[_0xe7bb('0x31')]=_[_0xe7bb('0x44')](_0x3a202c[_0xe7bb('0x31')]);_0x5b5de1[_0xe7bb('0x32')]=_['intersection'](_0x5b5de1['model'],_0x5b5de1[_0xe7bb('0x31')]);_0x5e396a[_0xe7bb('0x33')]=_['intersection'](_0x5b5de1[_0xe7bb('0x30')],qs[_0xe7bb('0x34')](_0x3a202c['query'][_0xe7bb('0x34')]));_0x5e396a[_0xe7bb('0x33')]=_0x5e396a[_0xe7bb('0x33')][_0xe7bb('0x35')]?_0x5e396a[_0xe7bb('0x33')]:_0x5b5de1['model'];if(_0x3a202c[_0xe7bb('0x31')][_0xe7bb('0x3f')]){_0x5e396a[_0xe7bb('0x40')]=[{'all':!![]}];}_0x5e396a=_[_0xe7bb('0x3d')]({},_0x5e396a,_0x3a202c['options']);return db[_0xe7bb('0x2c')][_0xe7bb('0x45')](_0x5e396a)[_0xe7bb('0x25')](handleEntityNotFound(_0x433a93,null))['then'](respondWithResult(_0x433a93,null))[_0xe7bb('0x42')](handleError(_0x433a93,null));};exports['create']=function(_0x41d018,_0x3c8157){return db[_0xe7bb('0x2c')][_0xe7bb('0x46')](_0x41d018[_0xe7bb('0x47')],{})[_0xe7bb('0x25')](function(_0x16e944){var _0x28690c=_0x41d018[_0xe7bb('0x48')][_0xe7bb('0x26')]({'plain':!![]});if(!_0x28690c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x28690c[_0xe7bb('0x49')]===_0xe7bb('0x48')){var _0x464250=_0x16e944[_0xe7bb('0x26')]({'plain':!![]});var _0x269d9f=_0xe7bb('0x4a');return db['UserProfileSection']['find']({'where':{'name':_0x269d9f,'userProfileId':_0x28690c[_0xe7bb('0x4b')]},'raw':!![]})['then'](function(_0x434fe1){if(_0x434fe1&&_0x434fe1[_0xe7bb('0x4c')]===0x0){return db[_0xe7bb('0x4d')][_0xe7bb('0x46')]({'name':_0x464250['name'],'resourceId':_0x464250['id'],'type':_0x434fe1[_0xe7bb('0x29')],'sectionId':_0x434fe1['id']},{})[_0xe7bb('0x25')](function(){return _0x16e944;});}else{return _0x16e944;}})[_0xe7bb('0x42')](function(_0x24437d){logger[_0xe7bb('0x27')](_0xe7bb('0x4e'),_0x24437d);throw _0x24437d;});}return _0x16e944;})[_0xe7bb('0x25')](respondWithResult(_0x3c8157,0xc9))['catch'](handleError(_0x3c8157,null));};exports[_0xe7bb('0x4f')]=function(_0x28125a,_0x50bc26){var _0x387180={'where':{'id':_0x28125a[_0xe7bb('0x50')]['id']}},_0x4fa40a={};_0x4fa40a[_0xe7bb('0x30')]=_[_0xe7bb('0x44')](db['Dashboard'][_0xe7bb('0x2d')]);_0x387180[_0xe7bb('0x33')]=_['intersection'](_0x4fa40a[_0xe7bb('0x30')],qs[_0xe7bb('0x34')](_0x28125a[_0xe7bb('0x31')]['fields']));_0x387180[_0xe7bb('0x33')]=_0x387180[_0xe7bb('0x33')]['length']?_0x387180[_0xe7bb('0x33')]:_0x4fa40a[_0xe7bb('0x30')];if(_0x28125a[_0xe7bb('0x31')][_0xe7bb('0x3f')]){_0x387180[_0xe7bb('0x40')]=[{'all':!![]}];}_0x387180=_[_0xe7bb('0x3d')]({},_0x387180,_0x28125a[_0xe7bb('0x51')]);return db[_0xe7bb('0x2c')][_0xe7bb('0x45')](_0x387180)[_0xe7bb('0x25')](handleEntityNotFound(_0x50bc26,null))[_0xe7bb('0x25')](function(_0x367f37){if(_0x367f37){var _0x27813b=_0x367f37['get']({'plain':!![]});_0x27813b=qs[_0xe7bb('0x52')](_0x27813b,['id',_0xe7bb('0x53'),_0xe7bb('0x54')]);_0x28125a[_0xe7bb('0x47')]=_['omit'](_0x28125a[_0xe7bb('0x47')],['id',_0xe7bb('0x53'),_0xe7bb('0x54')]);return db['Dashboard'][_0xe7bb('0x46')](_[_0xe7bb('0x3d')](_0x27813b,_0x28125a[_0xe7bb('0x47')]),{'include':_0x28125a[_0xe7bb('0x31')]['includeAll']?[{'all':!![]}]:undefined})[_0xe7bb('0x25')](function(_0x29268d){var _0x1d1914=_0x28125a[_0xe7bb('0x48')]['get']({'plain':!![]});if(!_0x1d1914)throw new Error(_0xe7bb('0x55'));if(_0x1d1914[_0xe7bb('0x49')]===_0xe7bb('0x48')){var _0x5b99f7=_0x29268d[_0xe7bb('0x26')]({'plain':!![]});var _0x50f2ca=_0xe7bb('0x4a');return db[_0xe7bb('0x56')][_0xe7bb('0x45')]({'where':{'name':_0x50f2ca,'userProfileId':_0x1d1914['userProfileId']},'raw':!![]})[_0xe7bb('0x25')](function(_0xc467d4){if(_0xc467d4&&_0xc467d4[_0xe7bb('0x4c')]===0x0){return db[_0xe7bb('0x4d')][_0xe7bb('0x46')]({'name':_0x5b99f7[_0xe7bb('0x29')],'resourceId':_0x5b99f7['id'],'type':_0xc467d4['name'],'sectionId':_0xc467d4['id']},{})[_0xe7bb('0x25')](function(){return _0x29268d;});}else{return _0x29268d;}})[_0xe7bb('0x42')](function(_0x1b2673){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b2673);throw _0x1b2673;});}return _0x29268d;});}})['then'](respondWithResult(_0x50bc26,0xc9))[_0xe7bb('0x42')](handleError(_0x50bc26,null));};exports[_0xe7bb('0x23')]=function(_0x3f49be,_0x5a5112){if(_0x3f49be['body']['id']){delete _0x3f49be[_0xe7bb('0x47')]['id'];}return db[_0xe7bb('0x2c')][_0xe7bb('0x45')]({'where':{'id':_0x3f49be[_0xe7bb('0x50')]['id']}})[_0xe7bb('0x25')](handleEntityNotFound(_0x5a5112,null))[_0xe7bb('0x25')](saveUpdates(_0x3f49be[_0xe7bb('0x47')],null))[_0xe7bb('0x25')](respondWithResult(_0x5a5112,null))[_0xe7bb('0x42')](handleError(_0x5a5112,null));};exports['destroy']=function(_0x2c7183,_0x4d3b50){return db[_0xe7bb('0x2c')][_0xe7bb('0x45')]({'where':{'id':_0x2c7183['params']['id']}})[_0xe7bb('0x25')](handleEntityNotFound(_0x4d3b50,null))[_0xe7bb('0x25')](removeEntity(_0x4d3b50,null))[_0xe7bb('0x42')](handleError(_0x4d3b50,null));};function widgetAttributes(_0x348c32){try{switch(_0x348c32[_0xe7bb('0x2f')]){case _0xe7bb('0x57'):return[{'name':_0xe7bb('0x58'),'value':_0x348c32['attrUrl']||(_0x348c32[_0xe7bb('0x59')]&&_0x348c32[_0xe7bb('0x59')][0x0]?_0x348c32[_0xe7bb('0x59')][0x0]['value']:undefined)||_0xe7bb('0x5a')}];case'custom':return[{'name':_0xe7bb('0x5b'),'value':_0x348c32['attrPath']||(_0x348c32[_0xe7bb('0x59')]&&_0x348c32[_0xe7bb('0x59')][0x0]?_0x348c32[_0xe7bb('0x59')][0x0][_0xe7bb('0x5c')]:undefined)||''}];case _0xe7bb('0x5d'):return[{'name':_0xe7bb('0x5e'),'value':_0x348c32[_0xe7bb('0x5e')]||(_0x348c32[_0xe7bb('0x59')]&&_0x348c32[_0xe7bb('0x59')][0x0]?_0x348c32[_0xe7bb('0x59')][0x0][_0xe7bb('0x5c')]:undefined)||_0xe7bb('0x5f')},{'name':_0xe7bb('0x60'),'value':_0x348c32[_0xe7bb('0x60')]||(_0x348c32[_0xe7bb('0x59')]&&_0x348c32[_0xe7bb('0x59')][0x1]?_0x348c32[_0xe7bb('0x59')][0x1][_0xe7bb('0x5c')]:undefined)||_0xe7bb('0x61')},{'name':_0xe7bb('0x62'),'value':_0x348c32[_0xe7bb('0x62')]||(_0x348c32['attrs']&&_0x348c32[_0xe7bb('0x59')][0x2]?_0x348c32['attrs'][0x2][_0xe7bb('0x5c')]:undefined)||0xc}];case _0xe7bb('0x63'):return[{'name':_0xe7bb('0x64'),'value':_0x348c32['attrMetric']||(_0x348c32['attrs']&&_0x348c32[_0xe7bb('0x59')][0x0]?_0x348c32[_0xe7bb('0x59')][0x0][_0xe7bb('0x5c')]:undefined)||_0xe7bb('0x65')},{'name':_0xe7bb('0x66'),'value':_0x348c32[_0xe7bb('0x66')]||(_0x348c32[_0xe7bb('0x59')]&&_0x348c32[_0xe7bb('0x59')][0x1]?_0x348c32[_0xe7bb('0x59')][0x1][_0xe7bb('0x5c')]:undefined)||[]},{'name':_0xe7bb('0x62'),'value':_0x348c32[_0xe7bb('0x62')]||(_0x348c32['attrs']&&_0x348c32[_0xe7bb('0x59')][0x2]?_0x348c32['attrs'][0x2][_0xe7bb('0x5c')]:undefined)||0x14},{'name':_0xe7bb('0x67'),'value':_0x348c32[_0xe7bb('0x67')]||(_0x348c32[_0xe7bb('0x59')]&&_0x348c32[_0xe7bb('0x59')][0x3]?_0x348c32[_0xe7bb('0x59')][0x3][_0xe7bb('0x5c')]:undefined)||_0xe7bb('0x68')},{'name':_0xe7bb('0x69'),'value':_0x348c32[_0xe7bb('0x69')]||(_0x348c32['attrs']&&_0x348c32['attrs'][0x4]?_0x348c32[_0xe7bb('0x59')][0x4][_0xe7bb('0x5c')]:undefined)||''},{'name':_0xe7bb('0x6a'),'value':_0x348c32[_0xe7bb('0x6a')]||(_0x348c32['attrs']&&_0x348c32['attrs'][0x5]?_0x348c32[_0xe7bb('0x59')][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x348c32['attrSmsAccounts']||(_0x348c32['attrs']&&_0x348c32[_0xe7bb('0x59')][0x6]?_0x348c32[_0xe7bb('0x59')][0x6]['value']:undefined)||''},{'name':_0xe7bb('0x6b'),'value':_0x348c32['attrOpenchannelAccounts']||(_0x348c32['attrs']&&_0x348c32['attrs'][0x7]?_0x348c32[_0xe7bb('0x59')][0x7][_0xe7bb('0x5c')]:undefined)||''},{'name':_0xe7bb('0x6c'),'value':_0x348c32[_0xe7bb('0x6c')]||(_0x348c32[_0xe7bb('0x59')]&&_0x348c32['attrs'][0x8]?_0x348c32[_0xe7bb('0x59')][0x8][_0xe7bb('0x5c')]:undefined)||''},{'name':_0xe7bb('0x6d'),'value':_0x348c32[_0xe7bb('0x6d')]||(_0x348c32[_0xe7bb('0x59')]&&_0x348c32[_0xe7bb('0x59')][0x9]?_0x348c32['attrs'][0x9][_0xe7bb('0x5c')]:undefined)||''}];case _0xe7bb('0x6e'):case _0xe7bb('0x6f'):return[{'name':_0xe7bb('0x70'),'value':_0x348c32[_0xe7bb('0x70')]||(_0x348c32['attrs']&&_0x348c32[_0xe7bb('0x59')][0x0]?_0x348c32[_0xe7bb('0x59')][0x0][_0xe7bb('0x5c')]:undefined)||_0xe7bb('0x65')},{'name':'attrSerie2','value':_0x348c32[_0xe7bb('0x71')]||(_0x348c32[_0xe7bb('0x59')]&&_0x348c32[_0xe7bb('0x59')][0x1]?_0x348c32['attrs'][0x1]['value']:undefined)||null},{'name':_0xe7bb('0x72'),'value':_0x348c32[_0xe7bb('0x72')]||(_0x348c32[_0xe7bb('0x59')]&&_0x348c32[_0xe7bb('0x59')][0x2]?_0x348c32[_0xe7bb('0x59')][0x2][_0xe7bb('0x5c')]:undefined)||null},{'name':_0xe7bb('0x66'),'value':_0x348c32[_0xe7bb('0x66')]||(_0x348c32['attrs']&&_0x348c32[_0xe7bb('0x59')][0x3]?_0x348c32['attrs'][0x3][_0xe7bb('0x5c')]:undefined)||[]},{'name':'attrChannel','value':_0x348c32[_0xe7bb('0x67')]||(_0x348c32[_0xe7bb('0x59')]&&_0x348c32['attrs'][0x4]?_0x348c32[_0xe7bb('0x59')][0x4]['value']:undefined)||_0xe7bb('0x68')},{'name':_0xe7bb('0x69'),'value':_0x348c32[_0xe7bb('0x69')]||(_0x348c32[_0xe7bb('0x59')]&&_0x348c32[_0xe7bb('0x59')][0x5]?_0x348c32[_0xe7bb('0x59')][0x5][_0xe7bb('0x5c')]:undefined)||''},{'name':_0xe7bb('0x6a'),'value':_0x348c32['attrFaxAccounts']||(_0x348c32['attrs']&&_0x348c32['attrs'][0x6]?_0x348c32[_0xe7bb('0x59')][0x6][_0xe7bb('0x5c')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x348c32[_0xe7bb('0x73')]||(_0x348c32['attrs']&&_0x348c32[_0xe7bb('0x59')][0x7]?_0x348c32['attrs'][0x7][_0xe7bb('0x5c')]:undefined)||''},{'name':_0xe7bb('0x6b'),'value':_0x348c32[_0xe7bb('0x6b')]||(_0x348c32[_0xe7bb('0x59')]&&_0x348c32[_0xe7bb('0x59')][0x8]?_0x348c32['attrs'][0x8][_0xe7bb('0x5c')]:undefined)||''},{'name':_0xe7bb('0x6c'),'value':_0x348c32[_0xe7bb('0x6c')]||(_0x348c32[_0xe7bb('0x59')]&&_0x348c32[_0xe7bb('0x59')][0x9]?_0x348c32[_0xe7bb('0x59')][0x9][_0xe7bb('0x5c')]:undefined)||''},{'name':_0xe7bb('0x6d'),'value':_0x348c32[_0xe7bb('0x6d')]||(_0x348c32[_0xe7bb('0x59')]&&_0x348c32[_0xe7bb('0x59')][0xa]?_0x348c32['attrs'][0xa][_0xe7bb('0x5c')]:undefined)||''}];case _0xe7bb('0x74'):return[{'name':'attrReport','type':_0x348c32['reportType']||(_0x348c32['attrs']&&_0x348c32[_0xe7bb('0x59')][0x0]?_0x348c32[_0xe7bb('0x59')][0x0][_0xe7bb('0x2f')]:undefined)||null,'value':_0x348c32['attrReport']||(_0x348c32[_0xe7bb('0x59')]&&_0x348c32[_0xe7bb('0x59')][0x0]?_0x348c32['attrs'][0x0][_0xe7bb('0x5c')]:undefined)||null},{'name':'attrRefresh','value':_0x348c32['attrRefresh']||(_0x348c32['attrs']&&_0x348c32['attrs'][0x1]?_0x348c32[_0xe7bb('0x59')][0x1][_0xe7bb('0x5c')]:undefined)||0x0}];default:return[];}}catch(_0x5110a2){logger[_0xe7bb('0x27')]('widgetAttributes:\x20%s',JSON[_0xe7bb('0x75')](_0x5110a2));return[];}}exports[_0xe7bb('0x76')]=function(_0x7961b,_0x16b068,_0x10d7b2){if(_0x7961b[_0xe7bb('0x47')]['id']){delete _0x7961b[_0xe7bb('0x47')]['id'];}return db['Dashboard'][_0xe7bb('0x45')]({'where':{'id':_0x7961b[_0xe7bb('0x50')]['id']}})[_0xe7bb('0x25')](handleEntityNotFound(_0x16b068,null))['then'](function(_0x5ee0bd){if(_0x5ee0bd){_0x7961b[_0xe7bb('0x47')][_0xe7bb('0x77')]=_0x5ee0bd['id'];_0x7961b[_0xe7bb('0x47')][_0xe7bb('0x59')]=widgetAttributes(_0x7961b[_0xe7bb('0x47')]);return db[_0xe7bb('0x78')]['create'](_0x7961b[_0xe7bb('0x47')]);}})[_0xe7bb('0x25')](respondWithResult(_0x16b068,null))[_0xe7bb('0x42')](handleError(_0x16b068,null));};exports[_0xe7bb('0x79')]=function(_0x59e74f,_0x2e46fb,_0x2ae3ec){var _0xf98e52={};var _0x3d7200={};var _0x3f891e;var _0x1b3d81;return db[_0xe7bb('0x2c')][_0xe7bb('0x7a')]({'where':{'id':_0x59e74f[_0xe7bb('0x50')]['id']}})[_0xe7bb('0x25')](handleEntityNotFound(_0x2e46fb,null))[_0xe7bb('0x25')](function(_0x4e3440){if(_0x4e3440){_0x3f891e=_0x4e3440;_0x3d7200[_0xe7bb('0x30')]=_[_0xe7bb('0x44')](db['DashboardItem']['rawAttributes']);_0x3d7200[_0xe7bb('0x31')]=_[_0xe7bb('0x44')](_0x59e74f['query']);_0x3d7200['filters']=_[_0xe7bb('0x7b')](_0x3d7200[_0xe7bb('0x30')],_0x3d7200[_0xe7bb('0x31')]);_0xf98e52[_0xe7bb('0x33')]=_[_0xe7bb('0x7b')](_0x3d7200[_0xe7bb('0x30')],qs[_0xe7bb('0x34')](_0x59e74f['query'][_0xe7bb('0x34')]));_0xf98e52[_0xe7bb('0x33')]=_0xf98e52['attributes']['length']?_0xf98e52[_0xe7bb('0x33')]:_0x3d7200[_0xe7bb('0x30')];_0xf98e52[_0xe7bb('0x38')]=qs[_0xe7bb('0x39')](_0x59e74f[_0xe7bb('0x31')][_0xe7bb('0x39')]);_0xf98e52[_0xe7bb('0x3a')]=qs[_0xe7bb('0x32')](_[_0xe7bb('0x3b')](_0x59e74f[_0xe7bb('0x31')],_0x3d7200[_0xe7bb('0x32')]));if(_0x59e74f[_0xe7bb('0x31')][_0xe7bb('0x3c')]){_0xf98e52[_0xe7bb('0x3a')]=_[_0xe7bb('0x3d')](_0xf98e52[_0xe7bb('0x3a')],{'$or':_[_0xe7bb('0x2b')](_0xf98e52[_0xe7bb('0x33')],function(_0x53df7d){var _0x259379={};_0x259379[_0x53df7d]={'$like':'%'+_0x59e74f[_0xe7bb('0x31')][_0xe7bb('0x3c')]+'%'};return _0x259379;})});}_0xf98e52=_[_0xe7bb('0x3d')]({},_0xf98e52,_0x59e74f[_0xe7bb('0x51')]);return _0x3f891e[_0xe7bb('0x79')](_0xf98e52);}})[_0xe7bb('0x25')](function(_0x2c6219){if(_0x2c6219){_0x1b3d81=_0x2c6219[_0xe7bb('0x35')];if(!_0x59e74f[_0xe7bb('0x31')][_0xe7bb('0x36')](_0xe7bb('0x37'))){_0xf98e52[_0xe7bb('0x1d')]=qs[_0xe7bb('0x1d')](_0x59e74f['query'][_0xe7bb('0x1d')]);_0xf98e52[_0xe7bb('0x1f')]=qs[_0xe7bb('0x1f')](_0x59e74f[_0xe7bb('0x31')][_0xe7bb('0x1f')]);}return _0x3f891e[_0xe7bb('0x79')](_0xf98e52);}})[_0xe7bb('0x25')](function(_0x58ab5a){if(_0x58ab5a){return _0x58ab5a?{'count':_0x1b3d81,'rows':_0x58ab5a}:null;}})['then'](respondWithResult(_0x2e46fb,null))['catch'](handleError(_0x2e46fb,null));}; \ No newline at end of file +var _0xb99f=['order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','role','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','options','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','iframe','attrUrl','https://','custom','attrPath','attrs','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','counter','attrMetric','attrVoiceQueues','attrFontSize','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','pick','hasOwnProperty','nolimit','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','destroy','then','get','UserProfileResource','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x36c6f0,_0x272d24){var _0x3af75e=function(_0x123551){while(--_0x123551){_0x36c6f0['push'](_0x36c6f0['shift']());}};_0x3af75e(++_0x272d24);}(_0xb99f,0xcb));var _0xfb99=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xb99f[_0x4d613c];return _0x301fe3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfb99('0x0'));var jsonpatch=require(_0xfb99('0x1'));var rp=require(_0xfb99('0x2'));var moment=require(_0xfb99('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfb99('0x4'));var path=require(_0xfb99('0x5'));var sox=require(_0xfb99('0x6'));var csv=require(_0xfb99('0x7'));var ejs=require(_0xfb99('0x8'));var fs=require('fs');var fs_extra=require(_0xfb99('0x9'));var _=require(_0xfb99('0xa'));var squel=require(_0xfb99('0xb'));var crypto=require(_0xfb99('0xc'));var jsforce=require(_0xfb99('0xd'));var deskjs=require(_0xfb99('0xe'));var toCsv=require(_0xfb99('0x7'));var querystring=require('querystring');var Papa=require(_0xfb99('0xf'));var Redis=require(_0xfb99('0x10'));var authService=require(_0xfb99('0x11'));var qs=require(_0xfb99('0x12'));var as=require(_0xfb99('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfb99('0x14'))('api');var utils=require(_0xfb99('0x15'));var config=require(_0xfb99('0x16'));var licenseUtil=require(_0xfb99('0x17'));var db=require('../../mysqldb')['db'];config[_0xfb99('0x18')]=_[_0xfb99('0x19')](config['redis'],{'host':_0xfb99('0x1a'),'port':0x18eb});var socket=require(_0xfb99('0x1b'))(new Redis(config[_0xfb99('0x18')]));require('./dashboard.socket')[_0xfb99('0x1c')](socket);function respondWithStatusCode(_0x3e5e2d,_0x439c96){_0x439c96=_0x439c96||0xcc;return function(_0x48b1dd){if(_0x48b1dd){return _0x3e5e2d[_0xfb99('0x1d')](_0x439c96);}return _0x3e5e2d[_0xfb99('0x1e')](_0x439c96)[_0xfb99('0x1f')]();};}function respondWithResult(_0x1085d1,_0x24a5d3){_0x24a5d3=_0x24a5d3||0xc8;return function(_0x204180){if(_0x204180){return _0x1085d1[_0xfb99('0x1e')](_0x24a5d3)[_0xfb99('0x20')](_0x204180);}};}function respondWithFilteredResult(_0x152221,_0x1b3a78){return function(_0x5c4147){if(_0x5c4147){var _0x4d0e93=typeof _0x1b3a78[_0xfb99('0x21')]===_0xfb99('0x22')&&typeof _0x1b3a78[_0xfb99('0x23')]===_0xfb99('0x22');var _0x4fac01=_0x5c4147[_0xfb99('0x24')];var _0x2fc823=_0x4d0e93?0x0:_0x1b3a78[_0xfb99('0x21')];var _0x2ca1e0=_0x4d0e93?_0x5c4147['count']:_0x1b3a78[_0xfb99('0x21')]+_0x1b3a78[_0xfb99('0x23')];var _0x7fb7c8;if(_0x2ca1e0>=_0x4fac01){_0x2ca1e0=_0x4fac01;_0x7fb7c8=0xc8;}else{_0x7fb7c8=0xce;}_0x152221['status'](_0x7fb7c8);return _0x152221['set']('Content-Range',_0x2fc823+'-'+_0x2ca1e0+'/'+_0x4fac01)[_0xfb99('0x20')](_0x5c4147);}return null;};}function patchUpdates(_0x1ac095){return function(_0x4b1e55){try{jsonpatch[_0xfb99('0x25')](_0x4b1e55,_0x1ac095,!![]);}catch(_0x3b6265){return BPromise[_0xfb99('0x26')](_0x3b6265);}return _0x4b1e55[_0xfb99('0x27')]();};}function saveUpdates(_0x13aa16,_0x527367){return function(_0x4620fe){if(_0x4620fe){return _0x4620fe['update'](_0x13aa16)['then'](function(_0x39f7c1){return _0x39f7c1;});}return null;};}function removeEntity(_0x20f53d,_0x586655){return function(_0x5e95a5){if(_0x5e95a5){return _0x5e95a5[_0xfb99('0x28')]()[_0xfb99('0x29')](function(){var _0x21083d=_0x5e95a5[_0xfb99('0x2a')]({'plain':!![]});var _0x4f18f0='CustomDashboards';return db[_0xfb99('0x2b')][_0xfb99('0x28')]({'where':{'type':_0x4f18f0,'resourceId':_0x21083d['id']}})['then'](function(){return _0x5e95a5;});})['then'](function(){_0x20f53d[_0xfb99('0x1e')](0xcc)[_0xfb99('0x1f')]();});}};}function handleEntityNotFound(_0x97e5e5,_0x336307){return function(_0x140cfe){if(!_0x140cfe){_0x97e5e5['sendStatus'](0x194);}return _0x140cfe;};}function handleError(_0x105650,_0x3b0858){_0x3b0858=_0x3b0858||0x1f4;return function(_0x1c0d92){logger['error'](_0x1c0d92['stack']);if(_0x1c0d92[_0xfb99('0x2c')]){delete _0x1c0d92[_0xfb99('0x2c')];}_0x105650[_0xfb99('0x1e')](_0x3b0858)[_0xfb99('0x2d')](_0x1c0d92);};}exports[_0xfb99('0x2e')]=function(_0x38fdbf,_0x2c42af){var _0x16972a={},_0x5093f9={},_0x47c563={'count':0x0,'rows':[]};var _0x3a73f1=_[_0xfb99('0x2f')](db[_0xfb99('0x30')][_0xfb99('0x31')],function(_0x2c1c8b){return{'name':_0x2c1c8b[_0xfb99('0x32')],'type':_0x2c1c8b[_0xfb99('0x33')][_0xfb99('0x34')]};});_0x5093f9[_0xfb99('0x35')]=_[_0xfb99('0x2f')](_0x3a73f1,_0xfb99('0x2c'));_0x5093f9[_0xfb99('0x36')]=_[_0xfb99('0x37')](_0x38fdbf['query']);_0x5093f9[_0xfb99('0x38')]=_[_0xfb99('0x39')](_0x5093f9[_0xfb99('0x35')],_0x5093f9[_0xfb99('0x36')]);_0x16972a[_0xfb99('0x3a')]=_['intersection'](_0x5093f9[_0xfb99('0x35')],qs[_0xfb99('0x3b')](_0x38fdbf[_0xfb99('0x36')][_0xfb99('0x3b')]));_0x16972a[_0xfb99('0x3a')]=_0x16972a[_0xfb99('0x3a')][_0xfb99('0x3c')]?_0x16972a[_0xfb99('0x3a')]:_0x5093f9[_0xfb99('0x35')];if(!_0x38fdbf[_0xfb99('0x36')]['hasOwnProperty']('nolimit')){_0x16972a['limit']=qs[_0xfb99('0x23')](_0x38fdbf[_0xfb99('0x36')]['limit']);_0x16972a[_0xfb99('0x21')]=qs[_0xfb99('0x21')](_0x38fdbf[_0xfb99('0x36')][_0xfb99('0x21')]);}_0x16972a[_0xfb99('0x3d')]=qs['sort'](_0x38fdbf[_0xfb99('0x36')][_0xfb99('0x3e')]);_0x16972a[_0xfb99('0x3f')]=qs[_0xfb99('0x38')](_['pick'](_0x38fdbf['query'],_0x5093f9[_0xfb99('0x38')]),_0x3a73f1);if(_0x38fdbf[_0xfb99('0x36')][_0xfb99('0x40')]){_0x16972a['where']=_[_0xfb99('0x41')](_0x16972a[_0xfb99('0x3f')],{'$or':_[_0xfb99('0x2f')](_0x3a73f1,function(_0x498dba){if(_0x498dba[_0xfb99('0x33')]!=='VIRTUAL'){var _0x3b6e6a={};_0x3b6e6a[_0x498dba[_0xfb99('0x2c')]]={'$like':'%'+_0x38fdbf['query'][_0xfb99('0x40')]+'%'};return _0x3b6e6a;}})});}_0x16972a=_[_0xfb99('0x41')]({},_0x16972a,_0x38fdbf['options']);var _0xdbf63f={'where':_0x16972a[_0xfb99('0x3f')]};return db['Dashboard']['count'](_0xdbf63f)[_0xfb99('0x29')](function(_0x16456d){_0x47c563[_0xfb99('0x24')]=_0x16456d;if(_0x38fdbf[_0xfb99('0x36')][_0xfb99('0x42')]){_0x16972a[_0xfb99('0x43')]=[{'all':!![]}];}return db[_0xfb99('0x30')][_0xfb99('0x44')](_0x16972a);})[_0xfb99('0x29')](function(_0x134aab){_0x47c563[_0xfb99('0x45')]=_0x134aab;return _0x47c563;})[_0xfb99('0x29')](respondWithFilteredResult(_0x2c42af,_0x16972a))[_0xfb99('0x46')](handleError(_0x2c42af,null));};exports[_0xfb99('0x47')]=function(_0x380735,_0x294985){var _0x2ecd1f={'raw':![],'where':{'id':_0x380735[_0xfb99('0x48')]['id']}},_0x327abc={};_0x327abc[_0xfb99('0x35')]=_['keys'](db[_0xfb99('0x30')][_0xfb99('0x31')]);_0x327abc['query']=_[_0xfb99('0x37')](_0x380735[_0xfb99('0x36')]);_0x327abc[_0xfb99('0x38')]=_[_0xfb99('0x39')](_0x327abc['model'],_0x327abc[_0xfb99('0x36')]);_0x2ecd1f[_0xfb99('0x3a')]=_[_0xfb99('0x39')](_0x327abc[_0xfb99('0x35')],qs[_0xfb99('0x3b')](_0x380735[_0xfb99('0x36')]['fields']));_0x2ecd1f[_0xfb99('0x3a')]=_0x2ecd1f[_0xfb99('0x3a')][_0xfb99('0x3c')]?_0x2ecd1f['attributes']:_0x327abc[_0xfb99('0x35')];if(_0x380735['query'][_0xfb99('0x42')]){_0x2ecd1f[_0xfb99('0x43')]=[{'all':!![]}];}_0x2ecd1f=_[_0xfb99('0x41')]({},_0x2ecd1f,_0x380735['options']);return db[_0xfb99('0x30')][_0xfb99('0x49')](_0x2ecd1f)['then'](handleEntityNotFound(_0x294985,null))[_0xfb99('0x29')](respondWithResult(_0x294985,null))[_0xfb99('0x46')](handleError(_0x294985,null));};exports[_0xfb99('0x4a')]=function(_0x33780f,_0x1b949c){return db[_0xfb99('0x30')][_0xfb99('0x4a')](_0x33780f[_0xfb99('0x4b')],{})[_0xfb99('0x29')](function(_0x1286ae){var _0x5ef2d2=_0x33780f[_0xfb99('0x4c')][_0xfb99('0x2a')]({'plain':!![]});if(!_0x5ef2d2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ef2d2[_0xfb99('0x4d')]===_0xfb99('0x4c')){var _0xc75400=_0x1286ae[_0xfb99('0x2a')]({'plain':!![]});var _0x11d1b0=_0xfb99('0x4e');return db[_0xfb99('0x4f')][_0xfb99('0x49')]({'where':{'name':_0x11d1b0,'userProfileId':_0x5ef2d2[_0xfb99('0x50')]},'raw':!![]})[_0xfb99('0x29')](function(_0x5d0b7a){if(_0x5d0b7a&&_0x5d0b7a[_0xfb99('0x51')]===0x0){return db[_0xfb99('0x2b')][_0xfb99('0x4a')]({'name':_0xc75400[_0xfb99('0x2c')],'resourceId':_0xc75400['id'],'type':_0x5d0b7a[_0xfb99('0x2c')],'sectionId':_0x5d0b7a['id']},{})['then'](function(){return _0x1286ae;});}else{return _0x1286ae;}})[_0xfb99('0x46')](function(_0x41f162){logger[_0xfb99('0x52')](_0xfb99('0x53'),_0x41f162);throw _0x41f162;});}return _0x1286ae;})[_0xfb99('0x29')](respondWithResult(_0x1b949c,0xc9))[_0xfb99('0x46')](handleError(_0x1b949c,null));};exports[_0xfb99('0x54')]=function(_0x5eb86b,_0x41f46c){var _0x47ecf9={'where':{'id':_0x5eb86b[_0xfb99('0x48')]['id']}},_0x288ce1={};_0x288ce1[_0xfb99('0x35')]=_['keys'](db[_0xfb99('0x30')]['rawAttributes']);_0x47ecf9[_0xfb99('0x3a')]=_[_0xfb99('0x39')](_0x288ce1[_0xfb99('0x35')],qs['fields'](_0x5eb86b[_0xfb99('0x36')][_0xfb99('0x3b')]));_0x47ecf9[_0xfb99('0x3a')]=_0x47ecf9[_0xfb99('0x3a')][_0xfb99('0x3c')]?_0x47ecf9['attributes']:_0x288ce1['model'];if(_0x5eb86b['query'][_0xfb99('0x42')]){_0x47ecf9[_0xfb99('0x43')]=[{'all':!![]}];}_0x47ecf9=_[_0xfb99('0x41')]({},_0x47ecf9,_0x5eb86b[_0xfb99('0x55')]);return db['Dashboard'][_0xfb99('0x49')](_0x47ecf9)[_0xfb99('0x29')](handleEntityNotFound(_0x41f46c,null))[_0xfb99('0x29')](function(_0x57c84b){if(_0x57c84b){var _0x51f082=_0x57c84b[_0xfb99('0x2a')]({'plain':!![]});_0x51f082=qs[_0xfb99('0x56')](_0x51f082,['id',_0xfb99('0x57'),_0xfb99('0x58')]);_0x5eb86b[_0xfb99('0x4b')]=_[_0xfb99('0x56')](_0x5eb86b[_0xfb99('0x4b')],['id',_0xfb99('0x57'),_0xfb99('0x58')]);return db[_0xfb99('0x30')][_0xfb99('0x4a')](_['merge'](_0x51f082,_0x5eb86b[_0xfb99('0x4b')]),{'include':_0x5eb86b['query'][_0xfb99('0x42')]?[{'all':!![]}]:undefined})[_0xfb99('0x29')](function(_0x27d9a1){var _0x307f40=_0x5eb86b[_0xfb99('0x4c')][_0xfb99('0x2a')]({'plain':!![]});if(!_0x307f40)throw new Error(_0xfb99('0x59'));if(_0x307f40[_0xfb99('0x4d')]===_0xfb99('0x4c')){var _0x4a4c4b=_0x27d9a1['get']({'plain':!![]});var _0x4d302e='CustomDashboards';return db[_0xfb99('0x4f')]['find']({'where':{'name':_0x4d302e,'userProfileId':_0x307f40[_0xfb99('0x50')]},'raw':!![]})[_0xfb99('0x29')](function(_0x2d55fe){if(_0x2d55fe&&_0x2d55fe[_0xfb99('0x51')]===0x0){return db[_0xfb99('0x2b')][_0xfb99('0x4a')]({'name':_0x4a4c4b[_0xfb99('0x2c')],'resourceId':_0x4a4c4b['id'],'type':_0x2d55fe[_0xfb99('0x2c')],'sectionId':_0x2d55fe['id']},{})[_0xfb99('0x29')](function(){return _0x27d9a1;});}else{return _0x27d9a1;}})[_0xfb99('0x46')](function(_0x2c4bde){logger['error'](_0xfb99('0x53'),_0x2c4bde);throw _0x2c4bde;});}return _0x27d9a1;});}})[_0xfb99('0x29')](respondWithResult(_0x41f46c,0xc9))['catch'](handleError(_0x41f46c,null));};exports['update']=function(_0x1ec91f,_0x3a753d){if(_0x1ec91f[_0xfb99('0x4b')]['id']){delete _0x1ec91f['body']['id'];}return db[_0xfb99('0x30')][_0xfb99('0x49')]({'where':{'id':_0x1ec91f[_0xfb99('0x48')]['id']}})['then'](handleEntityNotFound(_0x3a753d,null))[_0xfb99('0x29')](saveUpdates(_0x1ec91f[_0xfb99('0x4b')],null))[_0xfb99('0x29')](respondWithResult(_0x3a753d,null))['catch'](handleError(_0x3a753d,null));};exports[_0xfb99('0x28')]=function(_0x19be63,_0x3dba93){return db[_0xfb99('0x30')][_0xfb99('0x49')]({'where':{'id':_0x19be63[_0xfb99('0x48')]['id']}})[_0xfb99('0x29')](handleEntityNotFound(_0x3dba93,null))[_0xfb99('0x29')](removeEntity(_0x3dba93,null))['catch'](handleError(_0x3dba93,null));};function widgetAttributes(_0x2eef56){try{switch(_0x2eef56[_0xfb99('0x33')]){case _0xfb99('0x5a'):return[{'name':_0xfb99('0x5b'),'value':_0x2eef56[_0xfb99('0x5b')]||(_0x2eef56['attrs']&&_0x2eef56['attrs'][0x0]?_0x2eef56['attrs'][0x0]['value']:undefined)||_0xfb99('0x5c')}];case _0xfb99('0x5d'):return[{'name':_0xfb99('0x5e'),'value':_0x2eef56[_0xfb99('0x5e')]||(_0x2eef56['attrs']&&_0x2eef56['attrs'][0x0]?_0x2eef56[_0xfb99('0x5f')][0x0][_0xfb99('0x60')]:undefined)||''}];case _0xfb99('0x61'):return[{'name':_0xfb99('0x62'),'value':_0x2eef56[_0xfb99('0x62')]||(_0x2eef56[_0xfb99('0x5f')]&&_0x2eef56[_0xfb99('0x5f')][0x0]?_0x2eef56['attrs'][0x0][_0xfb99('0x60')]:undefined)||_0xfb99('0x63')},{'name':_0xfb99('0x64'),'value':_0x2eef56[_0xfb99('0x64')]||(_0x2eef56[_0xfb99('0x5f')]&&_0x2eef56[_0xfb99('0x5f')][0x1]?_0x2eef56[_0xfb99('0x5f')][0x1][_0xfb99('0x60')]:undefined)||_0xfb99('0x65')},{'name':'attrFontSize','value':_0x2eef56['attrFontSize']||(_0x2eef56[_0xfb99('0x5f')]&&_0x2eef56[_0xfb99('0x5f')][0x2]?_0x2eef56[_0xfb99('0x5f')][0x2][_0xfb99('0x60')]:undefined)||0xc}];case _0xfb99('0x66'):return[{'name':'attrMetric','value':_0x2eef56[_0xfb99('0x67')]||(_0x2eef56[_0xfb99('0x5f')]&&_0x2eef56[_0xfb99('0x5f')][0x0]?_0x2eef56[_0xfb99('0x5f')][0x0][_0xfb99('0x60')]:undefined)||'total'},{'name':_0xfb99('0x68'),'value':_0x2eef56['attrVoiceQueues']||(_0x2eef56[_0xfb99('0x5f')]&&_0x2eef56[_0xfb99('0x5f')][0x1]?_0x2eef56[_0xfb99('0x5f')][0x1][_0xfb99('0x60')]:undefined)||[]},{'name':'attrFontSize','value':_0x2eef56[_0xfb99('0x69')]||(_0x2eef56[_0xfb99('0x5f')]&&_0x2eef56[_0xfb99('0x5f')][0x2]?_0x2eef56[_0xfb99('0x5f')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x2eef56[_0xfb99('0x6a')]||(_0x2eef56['attrs']&&_0x2eef56[_0xfb99('0x5f')][0x3]?_0x2eef56[_0xfb99('0x5f')][0x3][_0xfb99('0x60')]:undefined)||_0xfb99('0x6b')},{'name':'attrEmailAccounts','value':_0x2eef56[_0xfb99('0x6c')]||(_0x2eef56[_0xfb99('0x5f')]&&_0x2eef56[_0xfb99('0x5f')][0x4]?_0x2eef56[_0xfb99('0x5f')][0x4][_0xfb99('0x60')]:undefined)||''},{'name':_0xfb99('0x6d'),'value':_0x2eef56['attrFaxAccounts']||(_0x2eef56['attrs']&&_0x2eef56['attrs'][0x5]?_0x2eef56[_0xfb99('0x5f')][0x5][_0xfb99('0x60')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x2eef56[_0xfb99('0x6e')]||(_0x2eef56['attrs']&&_0x2eef56['attrs'][0x6]?_0x2eef56['attrs'][0x6]['value']:undefined)||''},{'name':_0xfb99('0x6f'),'value':_0x2eef56[_0xfb99('0x6f')]||(_0x2eef56[_0xfb99('0x5f')]&&_0x2eef56[_0xfb99('0x5f')][0x7]?_0x2eef56[_0xfb99('0x5f')][0x7][_0xfb99('0x60')]:undefined)||''},{'name':_0xfb99('0x70'),'value':_0x2eef56[_0xfb99('0x70')]||(_0x2eef56[_0xfb99('0x5f')]&&_0x2eef56[_0xfb99('0x5f')][0x8]?_0x2eef56[_0xfb99('0x5f')][0x8][_0xfb99('0x60')]:undefined)||''},{'name':_0xfb99('0x71'),'value':_0x2eef56[_0xfb99('0x71')]||(_0x2eef56['attrs']&&_0x2eef56[_0xfb99('0x5f')][0x9]?_0x2eef56[_0xfb99('0x5f')][0x9]['value']:undefined)||''}];case _0xfb99('0x72'):case _0xfb99('0x73'):return[{'name':_0xfb99('0x74'),'value':_0x2eef56[_0xfb99('0x74')]||(_0x2eef56[_0xfb99('0x5f')]&&_0x2eef56[_0xfb99('0x5f')][0x0]?_0x2eef56[_0xfb99('0x5f')][0x0][_0xfb99('0x60')]:undefined)||_0xfb99('0x75')},{'name':_0xfb99('0x76'),'value':_0x2eef56['attrSerie2']||(_0x2eef56[_0xfb99('0x5f')]&&_0x2eef56[_0xfb99('0x5f')][0x1]?_0x2eef56['attrs'][0x1][_0xfb99('0x60')]:undefined)||null},{'name':'attrSerie3','value':_0x2eef56[_0xfb99('0x77')]||(_0x2eef56[_0xfb99('0x5f')]&&_0x2eef56[_0xfb99('0x5f')][0x2]?_0x2eef56[_0xfb99('0x5f')][0x2][_0xfb99('0x60')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x2eef56[_0xfb99('0x68')]||(_0x2eef56[_0xfb99('0x5f')]&&_0x2eef56[_0xfb99('0x5f')][0x3]?_0x2eef56[_0xfb99('0x5f')][0x3][_0xfb99('0x60')]:undefined)||[]},{'name':'attrChannel','value':_0x2eef56[_0xfb99('0x6a')]||(_0x2eef56[_0xfb99('0x5f')]&&_0x2eef56[_0xfb99('0x5f')][0x4]?_0x2eef56['attrs'][0x4]['value']:undefined)||'voice'},{'name':_0xfb99('0x6c'),'value':_0x2eef56['attrEmailAccounts']||(_0x2eef56[_0xfb99('0x5f')]&&_0x2eef56[_0xfb99('0x5f')][0x5]?_0x2eef56[_0xfb99('0x5f')][0x5][_0xfb99('0x60')]:undefined)||''},{'name':_0xfb99('0x6d'),'value':_0x2eef56[_0xfb99('0x6d')]||(_0x2eef56[_0xfb99('0x5f')]&&_0x2eef56['attrs'][0x6]?_0x2eef56[_0xfb99('0x5f')][0x6][_0xfb99('0x60')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x2eef56[_0xfb99('0x6e')]||(_0x2eef56['attrs']&&_0x2eef56[_0xfb99('0x5f')][0x7]?_0x2eef56[_0xfb99('0x5f')][0x7][_0xfb99('0x60')]:undefined)||''},{'name':_0xfb99('0x6f'),'value':_0x2eef56[_0xfb99('0x6f')]||(_0x2eef56[_0xfb99('0x5f')]&&_0x2eef56[_0xfb99('0x5f')][0x8]?_0x2eef56[_0xfb99('0x5f')][0x8][_0xfb99('0x60')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2eef56[_0xfb99('0x70')]||(_0x2eef56[_0xfb99('0x5f')]&&_0x2eef56['attrs'][0x9]?_0x2eef56['attrs'][0x9][_0xfb99('0x60')]:undefined)||''},{'name':_0xfb99('0x71'),'value':_0x2eef56['attrChatWebsites']||(_0x2eef56['attrs']&&_0x2eef56['attrs'][0xa]?_0x2eef56[_0xfb99('0x5f')][0xa]['value']:undefined)||''}];case _0xfb99('0x78'):return[{'name':_0xfb99('0x79'),'type':_0x2eef56[_0xfb99('0x7a')]||(_0x2eef56[_0xfb99('0x5f')]&&_0x2eef56[_0xfb99('0x5f')][0x0]?_0x2eef56[_0xfb99('0x5f')][0x0]['type']:undefined)||null,'value':_0x2eef56[_0xfb99('0x79')]||(_0x2eef56[_0xfb99('0x5f')]&&_0x2eef56['attrs'][0x0]?_0x2eef56[_0xfb99('0x5f')][0x0][_0xfb99('0x60')]:undefined)||null},{'name':_0xfb99('0x7b'),'value':_0x2eef56[_0xfb99('0x7b')]||(_0x2eef56[_0xfb99('0x5f')]&&_0x2eef56['attrs'][0x1]?_0x2eef56[_0xfb99('0x5f')][0x1][_0xfb99('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x28dee7){logger[_0xfb99('0x52')](_0xfb99('0x7c'),JSON[_0xfb99('0x7d')](_0x28dee7));return[];}}exports[_0xfb99('0x7e')]=function(_0x174b5c,_0xf76be1,_0x1ac446){if(_0x174b5c[_0xfb99('0x4b')]['id']){delete _0x174b5c[_0xfb99('0x4b')]['id'];}return db[_0xfb99('0x30')][_0xfb99('0x49')]({'where':{'id':_0x174b5c[_0xfb99('0x48')]['id']}})[_0xfb99('0x29')](handleEntityNotFound(_0xf76be1,null))[_0xfb99('0x29')](function(_0x160da6){if(_0x160da6){_0x174b5c[_0xfb99('0x4b')]['DashboardId']=_0x160da6['id'];_0x174b5c[_0xfb99('0x4b')][_0xfb99('0x5f')]=widgetAttributes(_0x174b5c[_0xfb99('0x4b')]);return db[_0xfb99('0x7f')]['create'](_0x174b5c[_0xfb99('0x4b')]);}})['then'](respondWithResult(_0xf76be1,null))['catch'](handleError(_0xf76be1,null));};exports[_0xfb99('0x80')]=function(_0x8f070c,_0x1f4bee,_0x53eaf5){var _0x153312={};var _0x1348f1={};var _0x1c6dbf;var _0x48fe96;return db[_0xfb99('0x30')]['findOne']({'where':{'id':_0x8f070c[_0xfb99('0x48')]['id']}})[_0xfb99('0x29')](handleEntityNotFound(_0x1f4bee,null))[_0xfb99('0x29')](function(_0x919baf){if(_0x919baf){_0x1c6dbf=_0x919baf;_0x1348f1[_0xfb99('0x35')]=_[_0xfb99('0x37')](db[_0xfb99('0x7f')][_0xfb99('0x31')]);_0x1348f1[_0xfb99('0x36')]=_[_0xfb99('0x37')](_0x8f070c[_0xfb99('0x36')]);_0x1348f1[_0xfb99('0x38')]=_[_0xfb99('0x39')](_0x1348f1[_0xfb99('0x35')],_0x1348f1[_0xfb99('0x36')]);_0x153312['attributes']=_['intersection'](_0x1348f1[_0xfb99('0x35')],qs[_0xfb99('0x3b')](_0x8f070c[_0xfb99('0x36')][_0xfb99('0x3b')]));_0x153312[_0xfb99('0x3a')]=_0x153312[_0xfb99('0x3a')][_0xfb99('0x3c')]?_0x153312[_0xfb99('0x3a')]:_0x1348f1[_0xfb99('0x35')];_0x153312[_0xfb99('0x3d')]=qs[_0xfb99('0x3e')](_0x8f070c[_0xfb99('0x36')][_0xfb99('0x3e')]);_0x153312[_0xfb99('0x3f')]=qs['filters'](_[_0xfb99('0x81')](_0x8f070c[_0xfb99('0x36')],_0x1348f1[_0xfb99('0x38')]));if(_0x8f070c[_0xfb99('0x36')]['filter']){_0x153312[_0xfb99('0x3f')]=_[_0xfb99('0x41')](_0x153312['where'],{'$or':_['map'](_0x153312[_0xfb99('0x3a')],function(_0x122632){var _0x100b0b={};_0x100b0b[_0x122632]={'$like':'%'+_0x8f070c[_0xfb99('0x36')]['filter']+'%'};return _0x100b0b;})});}_0x153312=_['merge']({},_0x153312,_0x8f070c['options']);return _0x1c6dbf['getItems'](_0x153312);}})[_0xfb99('0x29')](function(_0x5ee7d2){if(_0x5ee7d2){_0x48fe96=_0x5ee7d2[_0xfb99('0x3c')];if(!_0x8f070c[_0xfb99('0x36')][_0xfb99('0x82')](_0xfb99('0x83'))){_0x153312[_0xfb99('0x23')]=qs[_0xfb99('0x23')](_0x8f070c[_0xfb99('0x36')]['limit']);_0x153312['offset']=qs['offset'](_0x8f070c[_0xfb99('0x36')][_0xfb99('0x21')]);}return _0x1c6dbf['getItems'](_0x153312);}})[_0xfb99('0x29')](function(_0x533eb8){if(_0x533eb8){return _0x533eb8?{'count':_0x48fe96,'rows':_0x533eb8}:null;}})[_0xfb99('0x29')](respondWithResult(_0x1f4bee,null))[_0xfb99('0x46')](handleError(_0x1f4bee,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index c55a012..28879e4 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 _0x1328=['setMaxListeners','save','update','remove','hasOwnProperty','events','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1328,0x11d));var _0x8132=function(_0x5ecadc,_0x1cf9f1){_0x5ecadc=_0x5ecadc-0x0;var _0x565037=_0x1328[_0x5ecadc];return _0x565037;};'use strict';var EventEmitter=require(_0x8132('0x0'));var Dashboard=require(_0x8132('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x8132('0x2')](0x0);var events={'afterCreate':_0x8132('0x3'),'afterUpdate':_0x8132('0x4'),'afterDestroy':_0x8132('0x5')};function emitEvent(_0x20b1d7){return function(_0x438566,_0x52c498,_0x1b9957){DashboardEvents['emit'](_0x20b1d7+':'+_0x438566['id'],_0x438566);DashboardEvents['emit'](_0x20b1d7,_0x438566);_0x1b9957(null);};}for(var e in events){if(events[_0x8132('0x6')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0xe64b=['../../mysqldb','Dashboard','save','update','emit','hasOwnProperty','events'];(function(_0x57c959,_0x35e78f){var _0x259559=function(_0x6c84d){while(--_0x6c84d){_0x57c959['push'](_0x57c959['shift']());}};_0x259559(++_0x35e78f);}(_0xe64b,0x1a3));var _0xbe64=function(_0x4b58d9,_0x424769){_0x4b58d9=_0x4b58d9-0x0;var _0x55061a=_0xe64b[_0x4b58d9];return _0x55061a;};'use strict';var EventEmitter=require(_0xbe64('0x0'));var Dashboard=require(_0xbe64('0x1'))['db'][_0xbe64('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe64('0x3'),'afterUpdate':_0xbe64('0x4'),'afterDestroy':'remove'};function emitEvent(_0xd82950){return function(_0x24e586,_0x4e62da,_0x51e0fe){DashboardEvents[_0xbe64('0x5')](_0xd82950+':'+_0x24e586['id'],_0x24e586);DashboardEvents[_0xbe64('0x5')](_0xd82950,_0x24e586);_0x51e0fe(null);};}for(var e in events){if(events[_0xbe64('0x6')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 5caed5b..88c8fd4 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 _0x35b3=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','Dashboard','dashboards','lodash','../../config/logger','api'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x35b3,0xb1));var _0x335b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x35b3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x335b('0x0'));var util=require('util');var logger=require(_0x335b('0x1'))(_0x335b('0x2'));var moment=require(_0x335b('0x3'));var BPromise=require(_0x335b('0x4'));var rp=require(_0x335b('0x5'));var fs=require('fs');var path=require(_0x335b('0x6'));var rimraf=require(_0x335b('0x7'));var config=require(_0x335b('0x8'));var attributes=require('./dashboard.attributes');module[_0x335b('0x9')]=function(_0x4a69ec,_0x508ae5){return _0x4a69ec['define'](_0x335b('0xa'),attributes,{'tableName':_0x335b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91b0=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','lodash','util','../../config/logger','api'];(function(_0xc5bf6a,_0x4fbd67){var _0x477f50=function(_0x145f24){while(--_0x145f24){_0xc5bf6a['push'](_0xc5bf6a['shift']());}};_0x477f50(++_0x4fbd67);}(_0x91b0,0x1ca));var _0x091b=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x91b0[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0x091b('0x0'));var util=require(_0x091b('0x1'));var logger=require(_0x091b('0x2'))(_0x091b('0x3'));var moment=require(_0x091b('0x4'));var BPromise=require(_0x091b('0x5'));var rp=require(_0x091b('0x6'));var fs=require('fs');var path=require(_0x091b('0x7'));var rimraf=require(_0x091b('0x8'));var config=require(_0x091b('0x9'));var attributes=require(_0x091b('0xa'));module['exports']=function(_0x4b7c11,_0x58e92f){return _0x4b7c11['define']('Dashboard',attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index bc055de..d8f0f7a 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 _0x3bc3=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','redis','defaults','localhost','./dashboard.socket','then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dashboard,\x20%s,\x20%s','result','catch','lodash','util'];(function(_0x366e4e,_0x87847b){var _0x221d52=function(_0x4d7cbc){while(--_0x4d7cbc){_0x366e4e['push'](_0x366e4e['shift']());}};_0x221d52(++_0x87847b);}(_0x3bc3,0x80));var _0x33bc=function(_0x31963c,_0x5101f4){_0x31963c=_0x31963c-0x0;var _0x48e9c2=_0x3bc3[_0x31963c];return _0x48e9c2;};'use strict';var _=require(_0x33bc('0x0'));var util=require(_0x33bc('0x1'));var moment=require(_0x33bc('0x2'));var BPromise=require(_0x33bc('0x3'));var rs=require(_0x33bc('0x4'));var fs=require('fs');var Redis=require(_0x33bc('0x5'));var db=require(_0x33bc('0x6'))['db'];var utils=require(_0x33bc('0x7'));var logger=require(_0x33bc('0x8'))('rpc');var config=require(_0x33bc('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x33bc('0xa')]=_[_0x33bc('0xb')](config[_0x33bc('0xa')],{'host':_0x33bc('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x33bc('0xa')]));require(_0x33bc('0xd'))['register'](socket);function respondWithRpcPromise(_0x460fde,_0x4cda5c,_0x2d128b){return new BPromise(function(_0xe9835d,_0x3c7211){return client['request'](_0x460fde,_0x2d128b)[_0x33bc('0xe')](function(_0x757ed){logger[_0x33bc('0xf')]('Dashboard,\x20%s,\x20%s',_0x4cda5c,_0x33bc('0x10'));logger[_0x33bc('0x11')](_0x33bc('0x12'),_0x4cda5c,_0x33bc('0x10'),JSON[_0x33bc('0x13')](_0x757ed));if(_0x757ed[_0x33bc('0x14')]){if(_0x757ed[_0x33bc('0x14')][_0x33bc('0x15')]===0x1f4){logger[_0x33bc('0x14')]('Dashboard,\x20%s,\x20%s',_0x4cda5c,_0x757ed[_0x33bc('0x14')][_0x33bc('0x16')]);return _0x3c7211(_0x757ed['error'][_0x33bc('0x16')]);}logger[_0x33bc('0x14')](_0x33bc('0x17'),_0x4cda5c,_0x757ed[_0x33bc('0x14')][_0x33bc('0x16')]);return _0xe9835d(_0x757ed['error']['message']);}else{logger[_0x33bc('0xf')](_0x33bc('0x17'),_0x4cda5c,_0x33bc('0x10'));_0xe9835d(_0x757ed[_0x33bc('0x18')][_0x33bc('0x16')]);}})[_0x33bc('0x19')](function(_0x3758f2){logger[_0x33bc('0x14')](_0x33bc('0x17'),_0x4cda5c,_0x3758f2);_0x3c7211(_0x3758f2);});});} \ No newline at end of file +var _0x1bd1=['register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./dashboard.socket'];(function(_0x492173,_0x31ec3a){var _0xad6512=function(_0x2e99c1){while(--_0x2e99c1){_0x492173['push'](_0x492173['shift']());}};_0xad6512(++_0x31ec3a);}(_0x1bd1,0x112));var _0x11bd=function(_0x51de01,_0x3442b9){_0x51de01=_0x51de01-0x0;var _0x218568=_0x1bd1[_0x51de01];return _0x218568;};'use strict';var _=require(_0x11bd('0x0'));var util=require(_0x11bd('0x1'));var moment=require('moment');var BPromise=require(_0x11bd('0x2'));var rs=require(_0x11bd('0x3'));var fs=require('fs');var Redis=require(_0x11bd('0x4'));var db=require(_0x11bd('0x5'))['db'];var utils=require(_0x11bd('0x6'));var logger=require(_0x11bd('0x7'))(_0x11bd('0x8'));var config=require(_0x11bd('0x9'));var jayson=require(_0x11bd('0xa'));var client=jayson['client'][_0x11bd('0xb')]({'port':0x232a});config[_0x11bd('0xc')]=_[_0x11bd('0xd')](config[_0x11bd('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x11bd('0xe'))(new Redis(config[_0x11bd('0xc')]));require(_0x11bd('0xf'))[_0x11bd('0x10')](socket);function respondWithRpcPromise(_0x4052b3,_0x24b0d3,_0x5ea27e){return new BPromise(function(_0x5a344b,_0x32c5f7){return client[_0x11bd('0x11')](_0x4052b3,_0x5ea27e)[_0x11bd('0x12')](function(_0x534ed8){logger[_0x11bd('0x13')](_0x11bd('0x14'),_0x24b0d3,_0x11bd('0x15'));logger['debug'](_0x11bd('0x16'),_0x24b0d3,_0x11bd('0x15'),JSON[_0x11bd('0x17')](_0x534ed8));if(_0x534ed8[_0x11bd('0x18')]){if(_0x534ed8['error'][_0x11bd('0x19')]===0x1f4){logger[_0x11bd('0x18')]('Dashboard,\x20%s,\x20%s',_0x24b0d3,_0x534ed8['error'][_0x11bd('0x1a')]);return _0x32c5f7(_0x534ed8['error']['message']);}logger[_0x11bd('0x18')](_0x11bd('0x14'),_0x24b0d3,_0x534ed8['error'][_0x11bd('0x1a')]);return _0x5a344b(_0x534ed8[_0x11bd('0x18')][_0x11bd('0x1a')]);}else{logger[_0x11bd('0x13')](_0x11bd('0x14'),_0x24b0d3,_0x11bd('0x15'));_0x5a344b(_0x534ed8[_0x11bd('0x1b')][_0x11bd('0x1a')]);}})[_0x11bd('0x1c')](function(_0x3957a5){logger[_0x11bd('0x18')]('Dashboard,\x20%s,\x20%s',_0x24b0d3,_0x3957a5);_0x32c5f7(_0x3957a5);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index d8c8657..a650058 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 _0x16d2=['register','dashboard:','./dashboard.events','save','remove','emit'];(function(_0x106e60,_0xb95cb6){var _0x44a7a1=function(_0x14ed41){while(--_0x14ed41){_0x106e60['push'](_0x106e60['shift']());}};_0x44a7a1(++_0xb95cb6);}(_0x16d2,0x158));var _0x216d=function(_0x35f8cd,_0x1c7756){_0x35f8cd=_0x35f8cd-0x0;var _0x560291=_0x16d2[_0x35f8cd];return _0x560291;};'use strict';var DashboardEvents=require(_0x216d('0x0'));var events=[_0x216d('0x1'),_0x216d('0x2'),'update'];function createListener(_0x3c3efe,_0x146dc7){return function(_0x3e7b9b){_0x146dc7[_0x216d('0x3')](_0x3c3efe,_0x3e7b9b);};}function removeListener(_0x365510,_0xed9a32){return function(){DashboardEvents['removeListener'](_0x365510,_0xed9a32);};}exports[_0x216d('0x4')]=function(_0x2f5153){for(var _0x2719d5=0x0,_0x4566c4=events['length'];_0x2719d5<_0x4566c4;_0x2719d5++){var _0x5ac846=events[_0x2719d5];var _0x25db0e=createListener(_0x216d('0x5')+_0x5ac846,_0x2f5153);DashboardEvents['on'](_0x5ac846,_0x25db0e);}}; \ No newline at end of file +var _0xdc5e=['remove','update','emit','register','dashboard:','./dashboard.events'];(function(_0x48b810,_0x173a5e){var _0x23c17d=function(_0x38531e){while(--_0x38531e){_0x48b810['push'](_0x48b810['shift']());}};_0x23c17d(++_0x173a5e);}(_0xdc5e,0x13d));var _0xedc5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc5e[_0x3dd15e];return _0x231fd0;};'use strict';var DashboardEvents=require(_0xedc5('0x0'));var events=['save',_0xedc5('0x1'),_0xedc5('0x2')];function createListener(_0x49a097,_0x5a6a30){return function(_0x1c4a9f){_0x5a6a30[_0xedc5('0x3')](_0x49a097,_0x1c4a9f);};}function removeListener(_0x40c517,_0x3674c4){return function(){DashboardEvents['removeListener'](_0x40c517,_0x3674c4);};}exports[_0xedc5('0x4')]=function(_0x11636a){for(var _0x165534=0x0,_0x4f6b78=events['length'];_0x165534<_0x4f6b78;_0x165534++){var _0x4cc487=events[_0x165534];var _0x427b73=createListener(_0xedc5('0x5')+_0x4cc487,_0x11636a);DashboardEvents['on'](_0x4cc487,_0x427b73);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 36ab8b7..5156ef4 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 _0x2564=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/items','getItems','post','create','clone','addItem','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0xbcbb29,_0x5d420d){var _0x1b11de=function(_0x439212){while(--_0x439212){_0xbcbb29['push'](_0xbcbb29['shift']());}};_0x1b11de(++_0x5d420d);}(_0x2564,0xd1));var _0x4256=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2564[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x4256('0x0'));var util=require(_0x4256('0x1'));var path=require(_0x4256('0x2'));var timeout=require(_0x4256('0x3'));var express=require(_0x4256('0x4'));var router=express[_0x4256('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4256('0x6'));var interaction=require(_0x4256('0x7'));var config=require(_0x4256('0x8'));var controller=require('./dashboard.controller');router[_0x4256('0x9')]('/',auth[_0x4256('0xa')](),controller[_0x4256('0xb')]);router['get'](_0x4256('0xc'),auth[_0x4256('0xa')](),controller['show']);router[_0x4256('0x9')](_0x4256('0xd'),auth[_0x4256('0xa')](),controller[_0x4256('0xe')]);router[_0x4256('0xf')]('/',auth[_0x4256('0xa')](),controller[_0x4256('0x10')]);router[_0x4256('0xf')]('/:id/clone',auth[_0x4256('0xa')](),controller[_0x4256('0x11')]);router[_0x4256('0xf')](_0x4256('0xd'),auth[_0x4256('0xa')](),controller[_0x4256('0x12')]);router[_0x4256('0x13')]('/:id',auth[_0x4256('0xa')](),controller[_0x4256('0x14')]);router[_0x4256('0x15')]('/:id',auth[_0x4256('0xa')](),controller[_0x4256('0x16')]);module[_0x4256('0x17')]=router; \ No newline at end of file +var _0x7a08=['update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./dashboard.controller','isAuthenticated','index','get','/:id','show','/:id/items','getItems','create','post','clone','put'];(function(_0x504a04,_0x331757){var _0x4f6912=function(_0x42db53){while(--_0x42db53){_0x504a04['push'](_0x504a04['shift']());}};_0x4f6912(++_0x331757);}(_0x7a08,0xf6));var _0x87a0=function(_0x4c6cf0,_0x826f70){_0x4c6cf0=_0x4c6cf0-0x0;var _0x108145=_0x7a08[_0x4c6cf0];return _0x108145;};'use strict';var multer=require(_0x87a0('0x0'));var util=require(_0x87a0('0x1'));var path=require(_0x87a0('0x2'));var timeout=require(_0x87a0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x87a0('0x4'));var config=require(_0x87a0('0x5'));var controller=require(_0x87a0('0x6'));router['get']('/',auth[_0x87a0('0x7')](),controller[_0x87a0('0x8')]);router[_0x87a0('0x9')](_0x87a0('0xa'),auth[_0x87a0('0x7')](),controller[_0x87a0('0xb')]);router[_0x87a0('0x9')](_0x87a0('0xc'),auth[_0x87a0('0x7')](),controller[_0x87a0('0xd')]);router['post']('/',auth[_0x87a0('0x7')](),controller[_0x87a0('0xe')]);router[_0x87a0('0xf')]('/:id/clone',auth[_0x87a0('0x7')](),controller[_0x87a0('0x10')]);router[_0x87a0('0xf')]('/:id/items',auth[_0x87a0('0x7')](),controller['addItem']);router[_0x87a0('0x11')](_0x87a0('0xa'),auth['isAuthenticated'](),controller[_0x87a0('0x12')]);router[_0x87a0('0x13')](_0x87a0('0xa'),auth['isAuthenticated'](),controller[_0x87a0('0x14')]);module[_0x87a0('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 865fd24..5ac1f5d 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 _0x53ec=['getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff','sequelize','squel','lodash','exports','STRING','long'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0x53ec,0x192));var _0xc53e=function(_0x269ac2,_0x139b30){_0x269ac2=_0x269ac2-0x0;var _0x288e11=_0x53ec[_0x269ac2];return _0x288e11;};'use strict';var Sequelize=require(_0xc53e('0x0'));var squel=require(_0xc53e('0x1'));var _=require(_0xc53e('0x2'));module[_0xc53e('0x3')]={'title':{'type':Sequelize[_0xc53e('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xc53e('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xc53e('0x5')),'get':function(){try{return JSON['parse'](this[_0xc53e('0x6')](_0xc53e('0x7')));}catch(_0x4a9c59){return[];}},'set':function(_0x2f1414){try{this['setDataValue'](_0xc53e('0x7'),JSON[_0xc53e('0x8')](_0x2f1414));}catch(_0x5d3b28){this[_0xc53e('0x9')](_0xc53e('0x7'),JSON[_0xc53e('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0xc53e('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xc53e('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xc53e('0xa')]},'col':{'type':Sequelize[_0xc53e('0xa')]},'background':{'type':Sequelize[_0xc53e('0x4')],'allowNull':![],'defaultValue':_0xc53e('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xc53e('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0xacf4=['lodash','exports','STRING','TEXT','long','parse','attrs','setDataValue','stringify','INTEGER','#2196f3'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xacf4,0xe7));var _0x4acf=function(_0x159183,_0xb67a84){_0x159183=_0x159183-0x0;var _0x17eca7=_0xacf4[_0x159183];return _0x17eca7;};'use strict';var Sequelize=require('sequelize');var squel=require('squel');var _=require(_0x4acf('0x0'));module[_0x4acf('0x1')]={'title':{'type':Sequelize[_0x4acf('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4acf('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x4acf('0x3')](_0x4acf('0x4')),'get':function(){try{return JSON[_0x4acf('0x5')](this['getDataValue'](_0x4acf('0x6')));}catch(_0x2124c8){return[];}},'set':function(_0x4e0c43){try{this[_0x4acf('0x7')](_0x4acf('0x6'),JSON[_0x4acf('0x8')](_0x4e0c43));}catch(_0x45a5a4){this[_0x4acf('0x7')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x4acf('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x4acf('0x9')]},'col':{'type':Sequelize[_0x4acf('0x9')]},'background':{'type':Sequelize[_0x4acf('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x4acf('0x2')],'allowNull':![],'defaultValue':_0x4acf('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index b87ed47..5dfe4ce 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 _0x0755=['attrUrl','attrs','custom','attrPath','value','clock','attrHourFormat','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChatWebsites','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','name','send','show','params','model','DashboardItem','rawAttributes','query','keys','filters','intersection','attributes','fields','include','merge','options','find','catch','type','iframe'];(function(_0x28d8da,_0x10e299){var _0x321e8b=function(_0x2a7b8b){while(--_0x2a7b8b){_0x28d8da['push'](_0x28d8da['shift']());}};_0x321e8b(++_0x10e299);}(_0x0755,0x7c));var _0x5075=function(_0x4572ec,_0x4942f0){_0x4572ec=_0x4572ec-0x0;var _0x24eea2=_0x0755[_0x4572ec];return _0x24eea2;};'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'];config[_0x5075('0x15')]=_[_0x5075('0x16')](config[_0x5075('0x15')],{'host':_0x5075('0x17'),'port':0x18eb});var socket=require(_0x5075('0x18'))(new Redis(config[_0x5075('0x15')]));require(_0x5075('0x19'))[_0x5075('0x1a')](socket);function respondWithStatusCode(_0x339420,_0x5ac5cc){_0x5ac5cc=_0x5ac5cc||0xcc;return function(_0x2354c8){if(_0x2354c8){return _0x339420[_0x5075('0x1b')](_0x5ac5cc);}return _0x339420[_0x5075('0x1c')](_0x5ac5cc)['end']();};}function respondWithResult(_0x128a1b,_0x36c0d7){_0x36c0d7=_0x36c0d7||0xc8;return function(_0xc0c5ab){if(_0xc0c5ab){return _0x128a1b[_0x5075('0x1c')](_0x36c0d7)[_0x5075('0x1d')](_0xc0c5ab);}};}function respondWithFilteredResult(_0x57fedb,_0x2ca054){return function(_0xc8b69a){if(_0xc8b69a){var _0x4dbe45=typeof _0x2ca054[_0x5075('0x1e')]===_0x5075('0x1f')&&typeof _0x2ca054[_0x5075('0x20')]===_0x5075('0x1f');var _0x53232c=_0xc8b69a[_0x5075('0x21')];var _0x5e4f40=_0x4dbe45?0x0:_0x2ca054[_0x5075('0x1e')];var _0x55f829=_0x4dbe45?_0xc8b69a[_0x5075('0x21')]:_0x2ca054['offset']+_0x2ca054[_0x5075('0x20')];var _0x4c65c7;if(_0x55f829>=_0x53232c){_0x55f829=_0x53232c;_0x4c65c7=0xc8;}else{_0x4c65c7=0xce;}_0x57fedb[_0x5075('0x1c')](_0x4c65c7);return _0x57fedb[_0x5075('0x22')]('Content-Range',_0x5e4f40+'-'+_0x55f829+'/'+_0x53232c)['json'](_0xc8b69a);}return null;};}function patchUpdates(_0x510d4e){return function(_0x28678b){try{jsonpatch[_0x5075('0x23')](_0x28678b,_0x510d4e,!![]);}catch(_0xd48fad){return BPromise[_0x5075('0x24')](_0xd48fad);}return _0x28678b[_0x5075('0x25')]();};}function saveUpdates(_0x4e2c16,_0x27df0b){return function(_0x1a962b){if(_0x1a962b){return _0x1a962b[_0x5075('0x26')](_0x4e2c16)['then'](function(_0x1f16cc){return _0x1f16cc;});}return null;};}function removeEntity(_0x212438,_0x57fcb5){return function(_0xab5afe){if(_0xab5afe){return _0xab5afe[_0x5075('0x27')]()[_0x5075('0x28')](function(){_0x212438[_0x5075('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5efc7c,_0x58063c){return function(_0x3b3d0b){if(!_0x3b3d0b){_0x5efc7c[_0x5075('0x1b')](0x194);}return _0x3b3d0b;};}function handleError(_0x5652db,_0x1ddccd){_0x1ddccd=_0x1ddccd||0x1f4;return function(_0x36dbf7){logger[_0x5075('0x29')](_0x36dbf7['stack']);if(_0x36dbf7[_0x5075('0x2a')]){delete _0x36dbf7['name'];}_0x5652db['status'](_0x1ddccd)[_0x5075('0x2b')](_0x36dbf7);};}exports[_0x5075('0x2c')]=function(_0x2249d4,_0x1102cc){var _0x5e87b0={'raw':![],'where':{'id':_0x2249d4[_0x5075('0x2d')]['id']}},_0x362711={};_0x362711[_0x5075('0x2e')]=_['keys'](db[_0x5075('0x2f')][_0x5075('0x30')]);_0x362711[_0x5075('0x31')]=_[_0x5075('0x32')](_0x2249d4['query']);_0x362711[_0x5075('0x33')]=_[_0x5075('0x34')](_0x362711[_0x5075('0x2e')],_0x362711['query']);_0x5e87b0[_0x5075('0x35')]=_[_0x5075('0x34')](_0x362711[_0x5075('0x2e')],qs[_0x5075('0x36')](_0x2249d4[_0x5075('0x31')]['fields']));_0x5e87b0[_0x5075('0x35')]=_0x5e87b0[_0x5075('0x35')]['length']?_0x5e87b0[_0x5075('0x35')]:_0x362711['model'];if(_0x2249d4['query']['includeAll']){_0x5e87b0[_0x5075('0x37')]=[{'all':!![]}];}_0x5e87b0=_[_0x5075('0x38')]({},_0x5e87b0,_0x2249d4[_0x5075('0x39')]);return db['DashboardItem'][_0x5075('0x3a')](_0x5e87b0)['then'](handleEntityNotFound(_0x1102cc,null))['then'](respondWithResult(_0x1102cc,null))[_0x5075('0x3b')](handleError(_0x1102cc,null));};exports['destroy']=function(_0xa99b46,_0x1e0435){return db['DashboardItem'][_0x5075('0x3a')]({'where':{'id':_0xa99b46[_0x5075('0x2d')]['id']}})[_0x5075('0x28')](handleEntityNotFound(_0x1e0435,null))['then'](removeEntity(_0x1e0435,null))[_0x5075('0x3b')](handleError(_0x1e0435,null));};function widgetAttributes(_0x32af7f){try{switch(_0x32af7f[_0x5075('0x3c')]){case _0x5075('0x3d'):return[{'name':_0x5075('0x3e'),'value':_0x32af7f[_0x5075('0x3e')]||(_0x32af7f[_0x5075('0x3f')]&&_0x32af7f[_0x5075('0x3f')][0x0]?_0x32af7f[_0x5075('0x3f')][0x0]['value']:undefined)||'https://'}];case _0x5075('0x40'):return[{'name':_0x5075('0x41'),'value':_0x32af7f[_0x5075('0x41')]||(_0x32af7f[_0x5075('0x3f')]&&_0x32af7f['attrs'][0x0]?_0x32af7f[_0x5075('0x3f')][0x0][_0x5075('0x42')]:undefined)||''}];case _0x5075('0x43'):return[{'name':_0x5075('0x44'),'value':_0x32af7f[_0x5075('0x44')]||(_0x32af7f[_0x5075('0x3f')]&&_0x32af7f[_0x5075('0x3f')][0x0]?_0x32af7f['attrs'][0x0]['value']:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x32af7f[_0x5075('0x45')]||(_0x32af7f[_0x5075('0x3f')]&&_0x32af7f[_0x5075('0x3f')][0x1]?_0x32af7f['attrs'][0x1][_0x5075('0x42')]:undefined)||'0.00'},{'name':_0x5075('0x46'),'value':_0x32af7f[_0x5075('0x46')]||(_0x32af7f[_0x5075('0x3f')]&&_0x32af7f[_0x5075('0x3f')][0x2]?_0x32af7f[_0x5075('0x3f')][0x2][_0x5075('0x42')]:undefined)||0xc}];case'counter':return[{'name':_0x5075('0x47'),'value':_0x32af7f[_0x5075('0x47')]||(_0x32af7f[_0x5075('0x3f')]&&_0x32af7f[_0x5075('0x3f')][0x0]?_0x32af7f[_0x5075('0x3f')][0x0]['value']:undefined)||_0x5075('0x48')},{'name':_0x5075('0x49'),'value':_0x32af7f[_0x5075('0x49')]||(_0x32af7f['attrs']&&_0x32af7f[_0x5075('0x3f')][0x1]?_0x32af7f[_0x5075('0x3f')][0x1][_0x5075('0x42')]:undefined)||[]},{'name':_0x5075('0x46'),'value':_0x32af7f[_0x5075('0x46')]||(_0x32af7f[_0x5075('0x3f')]&&_0x32af7f[_0x5075('0x3f')][0x2]?_0x32af7f[_0x5075('0x3f')][0x2][_0x5075('0x42')]:undefined)||0x14},{'name':_0x5075('0x4a'),'value':_0x32af7f[_0x5075('0x4a')]||(_0x32af7f[_0x5075('0x3f')]&&_0x32af7f[_0x5075('0x3f')][0x3]?_0x32af7f['attrs'][0x3]['value']:undefined)||_0x5075('0x4b')},{'name':'attrEmailAccounts','value':_0x32af7f['attrEmailAccounts']||(_0x32af7f[_0x5075('0x3f')]&&_0x32af7f[_0x5075('0x3f')][0x4]?_0x32af7f[_0x5075('0x3f')][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x32af7f[_0x5075('0x4c')]||(_0x32af7f['attrs']&&_0x32af7f[_0x5075('0x3f')][0x5]?_0x32af7f['attrs'][0x5]['value']:undefined)||''},{'name':_0x5075('0x4d'),'value':_0x32af7f[_0x5075('0x4d')]||(_0x32af7f[_0x5075('0x3f')]&&_0x32af7f[_0x5075('0x3f')][0x6]?_0x32af7f['attrs'][0x6][_0x5075('0x42')]:undefined)||''},{'name':_0x5075('0x4e'),'value':_0x32af7f[_0x5075('0x4e')]||(_0x32af7f[_0x5075('0x3f')]&&_0x32af7f[_0x5075('0x3f')][0x7]?_0x32af7f[_0x5075('0x3f')][0x7][_0x5075('0x42')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x32af7f[_0x5075('0x4f')]||(_0x32af7f['attrs']&&_0x32af7f[_0x5075('0x3f')][0x8]?_0x32af7f[_0x5075('0x3f')][0x8]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x32af7f['attrChatWebsites']||(_0x32af7f['attrs']&&_0x32af7f[_0x5075('0x3f')][0x9]?_0x32af7f[_0x5075('0x3f')][0x9][_0x5075('0x42')]:undefined)||''}];case _0x5075('0x50'):case _0x5075('0x51'):return[{'name':_0x5075('0x52'),'value':_0x32af7f['attrSerie1']||(_0x32af7f[_0x5075('0x3f')]&&_0x32af7f[_0x5075('0x3f')][0x0]?_0x32af7f[_0x5075('0x3f')][0x0][_0x5075('0x42')]:undefined)||'total'},{'name':_0x5075('0x53'),'value':_0x32af7f[_0x5075('0x53')]||(_0x32af7f['attrs']&&_0x32af7f[_0x5075('0x3f')][0x1]?_0x32af7f[_0x5075('0x3f')][0x1][_0x5075('0x42')]:undefined)||null},{'name':'attrSerie3','value':_0x32af7f[_0x5075('0x54')]||(_0x32af7f[_0x5075('0x3f')]&&_0x32af7f[_0x5075('0x3f')][0x2]?_0x32af7f[_0x5075('0x3f')][0x2][_0x5075('0x42')]:undefined)||null},{'name':_0x5075('0x49'),'value':_0x32af7f[_0x5075('0x49')]||(_0x32af7f[_0x5075('0x3f')]&&_0x32af7f[_0x5075('0x3f')][0x3]?_0x32af7f[_0x5075('0x3f')][0x3]['value']:undefined)||[]},{'name':_0x5075('0x4a'),'value':_0x32af7f[_0x5075('0x4a')]||(_0x32af7f[_0x5075('0x3f')]&&_0x32af7f[_0x5075('0x3f')][0x4]?_0x32af7f[_0x5075('0x3f')][0x4]['value']:undefined)||_0x5075('0x4b')},{'name':'attrEmailAccounts','value':_0x32af7f['attrEmailAccounts']||(_0x32af7f[_0x5075('0x3f')]&&_0x32af7f[_0x5075('0x3f')][0x5]?_0x32af7f['attrs'][0x5][_0x5075('0x42')]:undefined)||''},{'name':_0x5075('0x4c'),'value':_0x32af7f[_0x5075('0x4c')]||(_0x32af7f[_0x5075('0x3f')]&&_0x32af7f[_0x5075('0x3f')][0x6]?_0x32af7f['attrs'][0x6][_0x5075('0x42')]:undefined)||''},{'name':_0x5075('0x4d'),'value':_0x32af7f[_0x5075('0x4d')]||(_0x32af7f[_0x5075('0x3f')]&&_0x32af7f[_0x5075('0x3f')][0x7]?_0x32af7f[_0x5075('0x3f')][0x7][_0x5075('0x42')]:undefined)||''},{'name':_0x5075('0x4e'),'value':_0x32af7f[_0x5075('0x4e')]||(_0x32af7f[_0x5075('0x3f')]&&_0x32af7f[_0x5075('0x3f')][0x8]?_0x32af7f[_0x5075('0x3f')][0x8][_0x5075('0x42')]:undefined)||''},{'name':_0x5075('0x4f'),'value':_0x32af7f[_0x5075('0x4f')]||(_0x32af7f['attrs']&&_0x32af7f[_0x5075('0x3f')][0x9]?_0x32af7f[_0x5075('0x3f')][0x9][_0x5075('0x42')]:undefined)||''},{'name':_0x5075('0x55'),'value':_0x32af7f[_0x5075('0x55')]||(_0x32af7f[_0x5075('0x3f')]&&_0x32af7f['attrs'][0xa]?_0x32af7f[_0x5075('0x3f')][0xa][_0x5075('0x42')]:undefined)||''}];case _0x5075('0x56'):return[{'name':_0x5075('0x57'),'type':_0x32af7f['reportType']||(_0x32af7f[_0x5075('0x3f')]&&_0x32af7f[_0x5075('0x3f')][0x0]?_0x32af7f['attrs'][0x0]['type']:undefined)||null,'value':_0x32af7f['attrReport']||(_0x32af7f[_0x5075('0x3f')]&&_0x32af7f[_0x5075('0x3f')][0x0]?_0x32af7f['attrs'][0x0][_0x5075('0x42')]:undefined)||null},{'name':_0x5075('0x58'),'value':_0x32af7f[_0x5075('0x58')]||(_0x32af7f[_0x5075('0x3f')]&&_0x32af7f[_0x5075('0x3f')][0x1]?_0x32af7f[_0x5075('0x3f')][0x1][_0x5075('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x1d50b5){logger[_0x5075('0x29')](_0x5075('0x59'),JSON[_0x5075('0x5a')](_0x1d50b5));return[];}}exports[_0x5075('0x5b')]=function(_0x5dcbbf,_0x48dc83){if(_0x5dcbbf[_0x5075('0x5c')]){_0x5dcbbf[_0x5075('0x5c')]['attrs']=widgetAttributes(_0x5dcbbf[_0x5075('0x5c')]);}return db[_0x5075('0x2f')][_0x5075('0x5b')](_0x5dcbbf[_0x5075('0x5c')],{})[_0x5075('0x28')](respondWithResult(_0x48dc83,0xc9))[_0x5075('0x3b')](handleError(_0x48dc83,null));};exports['update']=function(_0x4d2c49,_0x43be4d){if(_0x4d2c49[_0x5075('0x5c')]['id']){delete _0x4d2c49['body']['id'];}_0x4d2c49[_0x5075('0x5c')][_0x5075('0x3f')]=widgetAttributes(_0x4d2c49[_0x5075('0x5c')]);return db['DashboardItem'][_0x5075('0x3a')]({'where':{'id':_0x4d2c49[_0x5075('0x2d')]['id']}})['then'](handleEntityNotFound(_0x43be4d,null))[_0x5075('0x28')](saveUpdates(_0x4d2c49['body'],null))[_0x5075('0x28')](respondWithResult(_0x43be4d,null))[_0x5075('0x3b')](handleError(_0x43be4d,null));}; \ No newline at end of file +var _0x8c46=['ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./dashboardItem.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','end','sendStatus','stack','name','send','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','include','merge','options','then','catch','find','type','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','create','body','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse'];(function(_0x83f8c4,_0x450c4b){var _0x1cf945=function(_0xc16423){while(--_0xc16423){_0x83f8c4['push'](_0x83f8c4['shift']());}};_0x1cf945(++_0x450c4b);}(_0x8c46,0x171));var _0x68c4=function(_0x46ae9b,_0x13e738){_0x46ae9b=_0x46ae9b-0x0;var _0x4baf68=_0x8c46[_0x46ae9b];return _0x4baf68;};'use strict';var emlformat=require(_0x68c4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x68c4('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x68c4('0x2'));var Mustache=require(_0x68c4('0x3'));var util=require(_0x68c4('0x4'));var path=require(_0x68c4('0x5'));var sox=require(_0x68c4('0x6'));var csv=require(_0x68c4('0x7'));var ejs=require(_0x68c4('0x8'));var fs=require('fs');var fs_extra=require(_0x68c4('0x9'));var _=require(_0x68c4('0xa'));var squel=require(_0x68c4('0xb'));var crypto=require('crypto');var jsforce=require(_0x68c4('0xc'));var deskjs=require(_0x68c4('0xd'));var toCsv=require(_0x68c4('0x7'));var querystring=require('querystring');var Papa=require(_0x68c4('0xe'));var Redis=require(_0x68c4('0xf'));var authService=require(_0x68c4('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x68c4('0x11'));var logger=require(_0x68c4('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x68c4('0x13'));var licenseUtil=require(_0x68c4('0x14'));var db=require(_0x68c4('0x15'))['db'];config['redis']=_[_0x68c4('0x16')](config[_0x68c4('0x17')],{'host':_0x68c4('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x68c4('0x17')]));require(_0x68c4('0x19'))[_0x68c4('0x1a')](socket);function respondWithStatusCode(_0x52f031,_0x211793){_0x211793=_0x211793||0xcc;return function(_0x38fd57){if(_0x38fd57){return _0x52f031['sendStatus'](_0x211793);}return _0x52f031[_0x68c4('0x1b')](_0x211793)['end']();};}function respondWithResult(_0x1a7045,_0x556aa6){_0x556aa6=_0x556aa6||0xc8;return function(_0x5497bf){if(_0x5497bf){return _0x1a7045[_0x68c4('0x1b')](_0x556aa6)[_0x68c4('0x1c')](_0x5497bf);}};}function respondWithFilteredResult(_0x4f4797,_0x2d6c1b){return function(_0x1d757c){if(_0x1d757c){var _0x38ac38=typeof _0x2d6c1b[_0x68c4('0x1d')]===_0x68c4('0x1e')&&typeof _0x2d6c1b[_0x68c4('0x1f')]===_0x68c4('0x1e');var _0x415ef2=_0x1d757c[_0x68c4('0x20')];var _0x3befda=_0x38ac38?0x0:_0x2d6c1b[_0x68c4('0x1d')];var _0x58f87d=_0x38ac38?_0x1d757c[_0x68c4('0x20')]:_0x2d6c1b['offset']+_0x2d6c1b['limit'];var _0x34d3a6;if(_0x58f87d>=_0x415ef2){_0x58f87d=_0x415ef2;_0x34d3a6=0xc8;}else{_0x34d3a6=0xce;}_0x4f4797[_0x68c4('0x1b')](_0x34d3a6);return _0x4f4797[_0x68c4('0x21')](_0x68c4('0x22'),_0x3befda+'-'+_0x58f87d+'/'+_0x415ef2)['json'](_0x1d757c);}return null;};}function patchUpdates(_0x35e865){return function(_0x310bc6){try{jsonpatch['apply'](_0x310bc6,_0x35e865,!![]);}catch(_0x201742){return BPromise[_0x68c4('0x23')](_0x201742);}return _0x310bc6[_0x68c4('0x24')]();};}function saveUpdates(_0x10278e,_0x12ecd1){return function(_0x20e78b){if(_0x20e78b){return _0x20e78b[_0x68c4('0x25')](_0x10278e)['then'](function(_0x2ff4a5){return _0x2ff4a5;});}return null;};}function removeEntity(_0x55355d,_0xf16a78){return function(_0x10c67e){if(_0x10c67e){return _0x10c67e[_0x68c4('0x26')]()['then'](function(){_0x55355d[_0x68c4('0x1b')](0xcc)[_0x68c4('0x27')]();});}};}function handleEntityNotFound(_0x496f4d,_0x31e177){return function(_0x3b62a3){if(!_0x3b62a3){_0x496f4d[_0x68c4('0x28')](0x194);}return _0x3b62a3;};}function handleError(_0x133cfb,_0x5589d6){_0x5589d6=_0x5589d6||0x1f4;return function(_0x26d56b){logger['error'](_0x26d56b[_0x68c4('0x29')]);if(_0x26d56b[_0x68c4('0x2a')]){delete _0x26d56b['name'];}_0x133cfb[_0x68c4('0x1b')](_0x5589d6)[_0x68c4('0x2b')](_0x26d56b);};}exports['show']=function(_0x29ef9d,_0x3a1b69){var _0xc3131c={'raw':![],'where':{'id':_0x29ef9d[_0x68c4('0x2c')]['id']}},_0x1d2b40={};_0x1d2b40[_0x68c4('0x2d')]=_[_0x68c4('0x2e')](db[_0x68c4('0x2f')][_0x68c4('0x30')]);_0x1d2b40[_0x68c4('0x31')]=_[_0x68c4('0x2e')](_0x29ef9d[_0x68c4('0x31')]);_0x1d2b40[_0x68c4('0x32')]=_[_0x68c4('0x33')](_0x1d2b40[_0x68c4('0x2d')],_0x1d2b40[_0x68c4('0x31')]);_0xc3131c[_0x68c4('0x34')]=_[_0x68c4('0x33')](_0x1d2b40['model'],qs[_0x68c4('0x35')](_0x29ef9d[_0x68c4('0x31')][_0x68c4('0x35')]));_0xc3131c[_0x68c4('0x34')]=_0xc3131c[_0x68c4('0x34')]['length']?_0xc3131c[_0x68c4('0x34')]:_0x1d2b40['model'];if(_0x29ef9d['query']['includeAll']){_0xc3131c[_0x68c4('0x36')]=[{'all':!![]}];}_0xc3131c=_[_0x68c4('0x37')]({},_0xc3131c,_0x29ef9d[_0x68c4('0x38')]);return db[_0x68c4('0x2f')]['find'](_0xc3131c)[_0x68c4('0x39')](handleEntityNotFound(_0x3a1b69,null))[_0x68c4('0x39')](respondWithResult(_0x3a1b69,null))[_0x68c4('0x3a')](handleError(_0x3a1b69,null));};exports['destroy']=function(_0x43de85,_0x9d910){return db[_0x68c4('0x2f')][_0x68c4('0x3b')]({'where':{'id':_0x43de85[_0x68c4('0x2c')]['id']}})[_0x68c4('0x39')](handleEntityNotFound(_0x9d910,null))[_0x68c4('0x39')](removeEntity(_0x9d910,null))[_0x68c4('0x3a')](handleError(_0x9d910,null));};function widgetAttributes(_0x31efb7){try{switch(_0x31efb7[_0x68c4('0x3c')]){case'iframe':return[{'name':'attrUrl','value':_0x31efb7[_0x68c4('0x3d')]||(_0x31efb7[_0x68c4('0x3e')]&&_0x31efb7[_0x68c4('0x3e')][0x0]?_0x31efb7[_0x68c4('0x3e')][0x0][_0x68c4('0x3f')]:undefined)||_0x68c4('0x40')}];case _0x68c4('0x41'):return[{'name':_0x68c4('0x42'),'value':_0x31efb7[_0x68c4('0x42')]||(_0x31efb7[_0x68c4('0x3e')]&&_0x31efb7[_0x68c4('0x3e')][0x0]?_0x31efb7[_0x68c4('0x3e')][0x0][_0x68c4('0x3f')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x31efb7[_0x68c4('0x43')]||(_0x31efb7[_0x68c4('0x3e')]&&_0x31efb7[_0x68c4('0x3e')][0x0]?_0x31efb7[_0x68c4('0x3e')][0x0]['value']:undefined)||_0x68c4('0x44')},{'name':_0x68c4('0x45'),'value':_0x31efb7['attrTimezone']||(_0x31efb7['attrs']&&_0x31efb7['attrs'][0x1]?_0x31efb7[_0x68c4('0x3e')][0x1]['value']:undefined)||_0x68c4('0x46')},{'name':'attrFontSize','value':_0x31efb7[_0x68c4('0x47')]||(_0x31efb7[_0x68c4('0x3e')]&&_0x31efb7[_0x68c4('0x3e')][0x2]?_0x31efb7[_0x68c4('0x3e')][0x2]['value']:undefined)||0xc}];case _0x68c4('0x48'):return[{'name':_0x68c4('0x49'),'value':_0x31efb7[_0x68c4('0x49')]||(_0x31efb7[_0x68c4('0x3e')]&&_0x31efb7['attrs'][0x0]?_0x31efb7[_0x68c4('0x3e')][0x0][_0x68c4('0x3f')]:undefined)||_0x68c4('0x4a')},{'name':_0x68c4('0x4b'),'value':_0x31efb7[_0x68c4('0x4b')]||(_0x31efb7['attrs']&&_0x31efb7['attrs'][0x1]?_0x31efb7['attrs'][0x1][_0x68c4('0x3f')]:undefined)||[]},{'name':_0x68c4('0x47'),'value':_0x31efb7[_0x68c4('0x47')]||(_0x31efb7[_0x68c4('0x3e')]&&_0x31efb7['attrs'][0x2]?_0x31efb7[_0x68c4('0x3e')][0x2][_0x68c4('0x3f')]:undefined)||0x14},{'name':_0x68c4('0x4c'),'value':_0x31efb7[_0x68c4('0x4c')]||(_0x31efb7[_0x68c4('0x3e')]&&_0x31efb7[_0x68c4('0x3e')][0x3]?_0x31efb7[_0x68c4('0x3e')][0x3][_0x68c4('0x3f')]:undefined)||_0x68c4('0x4d')},{'name':_0x68c4('0x4e'),'value':_0x31efb7[_0x68c4('0x4e')]||(_0x31efb7['attrs']&&_0x31efb7[_0x68c4('0x3e')][0x4]?_0x31efb7['attrs'][0x4][_0x68c4('0x3f')]:undefined)||''},{'name':_0x68c4('0x4f'),'value':_0x31efb7[_0x68c4('0x4f')]||(_0x31efb7[_0x68c4('0x3e')]&&_0x31efb7['attrs'][0x5]?_0x31efb7[_0x68c4('0x3e')][0x5]['value']:undefined)||''},{'name':_0x68c4('0x50'),'value':_0x31efb7[_0x68c4('0x50')]||(_0x31efb7['attrs']&&_0x31efb7[_0x68c4('0x3e')][0x6]?_0x31efb7[_0x68c4('0x3e')][0x6][_0x68c4('0x3f')]:undefined)||''},{'name':_0x68c4('0x51'),'value':_0x31efb7[_0x68c4('0x51')]||(_0x31efb7[_0x68c4('0x3e')]&&_0x31efb7['attrs'][0x7]?_0x31efb7[_0x68c4('0x3e')][0x7][_0x68c4('0x3f')]:undefined)||''},{'name':_0x68c4('0x52'),'value':_0x31efb7[_0x68c4('0x52')]||(_0x31efb7['attrs']&&_0x31efb7[_0x68c4('0x3e')][0x8]?_0x31efb7[_0x68c4('0x3e')][0x8][_0x68c4('0x3f')]:undefined)||''},{'name':_0x68c4('0x53'),'value':_0x31efb7[_0x68c4('0x53')]||(_0x31efb7[_0x68c4('0x3e')]&&_0x31efb7['attrs'][0x9]?_0x31efb7[_0x68c4('0x3e')][0x9][_0x68c4('0x3f')]:undefined)||''}];case _0x68c4('0x54'):case'pie-chart':return[{'name':_0x68c4('0x55'),'value':_0x31efb7[_0x68c4('0x55')]||(_0x31efb7['attrs']&&_0x31efb7['attrs'][0x0]?_0x31efb7[_0x68c4('0x3e')][0x0][_0x68c4('0x3f')]:undefined)||_0x68c4('0x4a')},{'name':_0x68c4('0x56'),'value':_0x31efb7[_0x68c4('0x56')]||(_0x31efb7[_0x68c4('0x3e')]&&_0x31efb7[_0x68c4('0x3e')][0x1]?_0x31efb7[_0x68c4('0x3e')][0x1]['value']:undefined)||null},{'name':_0x68c4('0x57'),'value':_0x31efb7['attrSerie3']||(_0x31efb7['attrs']&&_0x31efb7['attrs'][0x2]?_0x31efb7[_0x68c4('0x3e')][0x2][_0x68c4('0x3f')]:undefined)||null},{'name':_0x68c4('0x4b'),'value':_0x31efb7['attrVoiceQueues']||(_0x31efb7[_0x68c4('0x3e')]&&_0x31efb7[_0x68c4('0x3e')][0x3]?_0x31efb7['attrs'][0x3][_0x68c4('0x3f')]:undefined)||[]},{'name':'attrChannel','value':_0x31efb7[_0x68c4('0x4c')]||(_0x31efb7['attrs']&&_0x31efb7[_0x68c4('0x3e')][0x4]?_0x31efb7[_0x68c4('0x3e')][0x4]['value']:undefined)||_0x68c4('0x4d')},{'name':_0x68c4('0x4e'),'value':_0x31efb7['attrEmailAccounts']||(_0x31efb7[_0x68c4('0x3e')]&&_0x31efb7[_0x68c4('0x3e')][0x5]?_0x31efb7['attrs'][0x5][_0x68c4('0x3f')]:undefined)||''},{'name':_0x68c4('0x4f'),'value':_0x31efb7[_0x68c4('0x4f')]||(_0x31efb7[_0x68c4('0x3e')]&&_0x31efb7[_0x68c4('0x3e')][0x6]?_0x31efb7[_0x68c4('0x3e')][0x6][_0x68c4('0x3f')]:undefined)||''},{'name':_0x68c4('0x50'),'value':_0x31efb7[_0x68c4('0x50')]||(_0x31efb7['attrs']&&_0x31efb7[_0x68c4('0x3e')][0x7]?_0x31efb7[_0x68c4('0x3e')][0x7][_0x68c4('0x3f')]:undefined)||''},{'name':_0x68c4('0x51'),'value':_0x31efb7[_0x68c4('0x51')]||(_0x31efb7[_0x68c4('0x3e')]&&_0x31efb7[_0x68c4('0x3e')][0x8]?_0x31efb7['attrs'][0x8]['value']:undefined)||''},{'name':_0x68c4('0x52'),'value':_0x31efb7[_0x68c4('0x52')]||(_0x31efb7['attrs']&&_0x31efb7[_0x68c4('0x3e')][0x9]?_0x31efb7[_0x68c4('0x3e')][0x9][_0x68c4('0x3f')]:undefined)||''},{'name':_0x68c4('0x53'),'value':_0x31efb7[_0x68c4('0x53')]||(_0x31efb7[_0x68c4('0x3e')]&&_0x31efb7['attrs'][0xa]?_0x31efb7[_0x68c4('0x3e')][0xa][_0x68c4('0x3f')]:undefined)||''}];case _0x68c4('0x58'):return[{'name':_0x68c4('0x59'),'type':_0x31efb7[_0x68c4('0x5a')]||(_0x31efb7['attrs']&&_0x31efb7['attrs'][0x0]?_0x31efb7[_0x68c4('0x3e')][0x0][_0x68c4('0x3c')]:undefined)||null,'value':_0x31efb7[_0x68c4('0x59')]||(_0x31efb7[_0x68c4('0x3e')]&&_0x31efb7[_0x68c4('0x3e')][0x0]?_0x31efb7['attrs'][0x0][_0x68c4('0x3f')]:undefined)||null},{'name':_0x68c4('0x5b'),'value':_0x31efb7[_0x68c4('0x5b')]||(_0x31efb7[_0x68c4('0x3e')]&&_0x31efb7[_0x68c4('0x3e')][0x1]?_0x31efb7[_0x68c4('0x3e')][0x1][_0x68c4('0x3f')]:undefined)||0x0}];default:return[];}}catch(_0x341f80){logger[_0x68c4('0x5c')](_0x68c4('0x5d'),JSON['stringify'](_0x341f80));return[];}}exports[_0x68c4('0x5e')]=function(_0x482e3e,_0x284f5a){if(_0x482e3e[_0x68c4('0x5f')]){_0x482e3e[_0x68c4('0x5f')]['attrs']=widgetAttributes(_0x482e3e[_0x68c4('0x5f')]);}return db['DashboardItem'][_0x68c4('0x5e')](_0x482e3e[_0x68c4('0x5f')],{})[_0x68c4('0x39')](respondWithResult(_0x284f5a,0xc9))[_0x68c4('0x3a')](handleError(_0x284f5a,null));};exports[_0x68c4('0x25')]=function(_0x4a3d74,_0x3882ca){if(_0x4a3d74[_0x68c4('0x5f')]['id']){delete _0x4a3d74[_0x68c4('0x5f')]['id'];}_0x4a3d74[_0x68c4('0x5f')][_0x68c4('0x3e')]=widgetAttributes(_0x4a3d74['body']);return db[_0x68c4('0x2f')][_0x68c4('0x3b')]({'where':{'id':_0x4a3d74[_0x68c4('0x2c')]['id']}})['then'](handleEntityNotFound(_0x3882ca,null))[_0x68c4('0x39')](saveUpdates(_0x4a3d74[_0x68c4('0x5f')],null))[_0x68c4('0x39')](respondWithResult(_0x3882ca,null))['catch'](handleError(_0x3882ca,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 5096a27..0f6aee5 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 _0x4012=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem'];(function(_0x47b0d9,_0x41b561){var _0x599df3=function(_0x4c0c30){while(--_0x4c0c30){_0x47b0d9['push'](_0x47b0d9['shift']());}};_0x599df3(++_0x41b561);}(_0x4012,0x1bf));var _0x2401=function(_0x1a2624,_0x5cf832){_0x1a2624=_0x1a2624-0x0;var _0x449318=_0x4012[_0x1a2624];return _0x449318;};'use strict';var EventEmitter=require(_0x2401('0x0'));var DashboardItem=require(_0x2401('0x1'))['db'][_0x2401('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x2401('0x3')](0x0);var events={'afterCreate':_0x2401('0x4'),'afterUpdate':'update','afterDestroy':_0x2401('0x5')};function emitEvent(_0x3ca8b9){return function(_0x2b1a4d,_0xbc66e8,_0x2913d4){DashboardItemEvents[_0x2401('0x6')](_0x3ca8b9+':'+_0x2b1a4d['id'],_0x2b1a4d);DashboardItemEvents[_0x2401('0x6')](_0x3ca8b9,_0x2b1a4d);_0x2913d4(null);};}for(var e in events){if(events[_0x2401('0x7')](e)){var event=events[e];DashboardItem[_0x2401('0x8')](e,emitEvent(event));}}module[_0x2401('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0xdb9e=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','update','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb9e,0x1ee));var _0xedb9=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xdb9e[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require(_0xedb9('0x0'));var DashboardItem=require(_0xedb9('0x1'))['db'][_0xedb9('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xedb9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xedb9('0x4'),'afterDestroy':_0xedb9('0x5')};function emitEvent(_0x4d9832){return function(_0x22177e,_0x35fd6c,_0x1c4b62){DashboardItemEvents[_0xedb9('0x6')](_0x4d9832+':'+_0x22177e['id'],_0x22177e);DashboardItemEvents[_0xedb9('0x6')](_0x4d9832,_0x22177e);_0x1c4b62(null);};}for(var e in events){if(events[_0xedb9('0x7')](e)){var event=events[e];DashboardItem[_0xedb9('0x8')](e,emitEvent(event));}}module[_0xedb9('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index c4edf17..c2f2a8d 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 _0x5fd1=['DashboardItem','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define'];(function(_0x3f3519,_0xd53cae){var _0x23b6bf=function(_0x3b3e52){while(--_0x3b3e52){_0x3f3519['push'](_0x3f3519['shift']());}};_0x23b6bf(++_0xd53cae);}(_0x5fd1,0x155));var _0x15fd=function(_0x5bfb00,_0x52ffc4){_0x5bfb00=_0x5bfb00-0x0;var _0x24885f=_0x5fd1[_0x5bfb00];return _0x24885f;};'use strict';var _=require(_0x15fd('0x0'));var util=require('util');var logger=require(_0x15fd('0x1'))(_0x15fd('0x2'));var moment=require(_0x15fd('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x15fd('0x4'));var rimraf=require(_0x15fd('0x5'));var config=require(_0x15fd('0x6'));var attributes=require('./dashboardItem.attributes');module[_0x15fd('0x7')]=function(_0x386441,_0x18450c){return _0x386441[_0x15fd('0x8')](_0x15fd('0x9'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbada=['exports','define','DashboardItem','dashboard_items','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes'];(function(_0x5c97a7,_0x3896d6){var _0x26be80=function(_0x19ddf1){while(--_0x19ddf1){_0x5c97a7['push'](_0x5c97a7['shift']());}};_0x26be80(++_0x3896d6);}(_0xbada,0x190));var _0xabad=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xbada[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require('lodash');var util=require(_0xabad('0x0'));var logger=require(_0xabad('0x1'))('api');var moment=require('moment');var BPromise=require(_0xabad('0x2'));var rp=require(_0xabad('0x3'));var fs=require('fs');var path=require(_0xabad('0x4'));var rimraf=require(_0xabad('0x5'));var config=require(_0xabad('0x6'));var attributes=require(_0xabad('0x7'));module[_0xabad('0x8')]=function(_0x19a262,_0x2b5d62){return _0x19a262[_0xabad('0x9')](_0xabad('0xa'),attributes,{'tableName':_0xabad('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 112736a..8743d45 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 _0x5297=['register','request','then','info','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket'];(function(_0x315aaa,_0xefe5d6){var _0x5257b4=function(_0x14a3d3){while(--_0x14a3d3){_0x315aaa['push'](_0x315aaa['shift']());}};_0x5257b4(++_0xefe5d6);}(_0x5297,0x16c));var _0x7529=function(_0x12e6f9,_0x5c4f03){_0x12e6f9=_0x12e6f9-0x0;var _0x1afd27=_0x5297[_0x12e6f9];return _0x1afd27;};'use strict';var _=require('lodash');var util=require(_0x7529('0x0'));var moment=require(_0x7529('0x1'));var BPromise=require(_0x7529('0x2'));var rs=require(_0x7529('0x3'));var fs=require('fs');var Redis=require(_0x7529('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7529('0x5'));var logger=require(_0x7529('0x6'))('rpc');var config=require(_0x7529('0x7'));var jayson=require(_0x7529('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x7529('0x9')]=_[_0x7529('0xa')](config[_0x7529('0x9')],{'host':_0x7529('0xb'),'port':0x18eb});var socket=require(_0x7529('0xc'))(new Redis(config[_0x7529('0x9')]));require(_0x7529('0xd'))[_0x7529('0xe')](socket);function respondWithRpcPromise(_0x1e3425,_0x3be215,_0x111438){return new BPromise(function(_0x521041,_0x5a8a88){return client[_0x7529('0xf')](_0x1e3425,_0x111438)[_0x7529('0x10')](function(_0x518faf){logger[_0x7529('0x11')]('DashboardItem,\x20%s,\x20%s',_0x3be215,'request\x20sent');logger['debug'](_0x7529('0x12'),_0x3be215,'request\x20sent',JSON[_0x7529('0x13')](_0x518faf));if(_0x518faf[_0x7529('0x14')]){if(_0x518faf[_0x7529('0x14')][_0x7529('0x15')]===0x1f4){logger['error'](_0x7529('0x16'),_0x3be215,_0x518faf[_0x7529('0x14')][_0x7529('0x17')]);return _0x5a8a88(_0x518faf[_0x7529('0x14')][_0x7529('0x17')]);}logger[_0x7529('0x14')](_0x7529('0x16'),_0x3be215,_0x518faf[_0x7529('0x14')]['message']);return _0x521041(_0x518faf['error'][_0x7529('0x17')]);}else{logger['info'](_0x7529('0x16'),_0x3be215,_0x7529('0x18'));_0x521041(_0x518faf[_0x7529('0x19')][_0x7529('0x17')]);}})[_0x7529('0x1a')](function(_0x258d79){logger[_0x7529('0x14')](_0x7529('0x16'),_0x3be215,_0x258d79);_0x5a8a88(_0x258d79);});});} \ No newline at end of file +var _0xdab7=['message','util','moment','bluebird','randomstring','../../config/logger','client','http','defaults','redis','socket.io-emitter','register','request','then','info','DashboardItem,\x20%s,\x20%s','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0xdab7,0x13c));var _0x7dab=function(_0x2be196,_0x183cfe){_0x2be196=_0x2be196-0x0;var _0x4df80e=_0xdab7[_0x2be196];return _0x4df80e;};'use strict';var _=require('lodash');var util=require(_0x7dab('0x0'));var moment=require(_0x7dab('0x1'));var BPromise=require(_0x7dab('0x2'));var rs=require(_0x7dab('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7dab('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7dab('0x5')][_0x7dab('0x6')]({'port':0x232a});config['redis']=_[_0x7dab('0x7')](config[_0x7dab('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x7dab('0x9'))(new Redis(config[_0x7dab('0x8')]));require('./dashboardItem.socket')[_0x7dab('0xa')](socket);function respondWithRpcPromise(_0xa058f1,_0x3f0cfb,_0x519672){return new BPromise(function(_0x34121f,_0x21bbb5){return client[_0x7dab('0xb')](_0xa058f1,_0x519672)[_0x7dab('0xc')](function(_0xfc9752){logger[_0x7dab('0xd')](_0x7dab('0xe'),_0x3f0cfb,'request\x20sent');logger['debug'](_0x7dab('0xf'),_0x3f0cfb,_0x7dab('0x10'),JSON[_0x7dab('0x11')](_0xfc9752));if(_0xfc9752[_0x7dab('0x12')]){if(_0xfc9752[_0x7dab('0x12')][_0x7dab('0x13')]===0x1f4){logger[_0x7dab('0x12')](_0x7dab('0xe'),_0x3f0cfb,_0xfc9752[_0x7dab('0x12')][_0x7dab('0x14')]);return _0x21bbb5(_0xfc9752[_0x7dab('0x12')][_0x7dab('0x14')]);}logger[_0x7dab('0x12')](_0x7dab('0xe'),_0x3f0cfb,_0xfc9752['error'][_0x7dab('0x14')]);return _0x34121f(_0xfc9752[_0x7dab('0x12')]['message']);}else{logger[_0x7dab('0xd')](_0x7dab('0xe'),_0x3f0cfb,_0x7dab('0x10'));_0x34121f(_0xfc9752['result']['message']);}})['catch'](function(_0xa63053){logger[_0x7dab('0x12')](_0x7dab('0xe'),_0x3f0cfb,_0xa63053);_0x21bbb5(_0xa63053);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index d0feaf5..c64cc18 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 _0x2a41=['./dashboardItem.events','remove','update','emit','removeListener','length','dashboardItem:'];(function(_0x340dc0,_0x2a3031){var _0x48fd67=function(_0x1a4280){while(--_0x1a4280){_0x340dc0['push'](_0x340dc0['shift']());}};_0x48fd67(++_0x2a3031);}(_0x2a41,0x19d));var _0x12a4=function(_0x32ad52,_0x3867b7){_0x32ad52=_0x32ad52-0x0;var _0xd4d3d3=_0x2a41[_0x32ad52];return _0xd4d3d3;};'use strict';var DashboardItemEvents=require(_0x12a4('0x0'));var events=['save',_0x12a4('0x1'),_0x12a4('0x2')];function createListener(_0x38a7ae,_0x53b2a6){return function(_0xd45e66){_0x53b2a6[_0x12a4('0x3')](_0x38a7ae,_0xd45e66);};}function removeListener(_0xec95a6,_0xdd59e0){return function(){DashboardItemEvents[_0x12a4('0x4')](_0xec95a6,_0xdd59e0);};}exports['register']=function(_0x25b463){for(var _0x58903c=0x0,_0x4633d1=events[_0x12a4('0x5')];_0x58903c<_0x4633d1;_0x58903c++){var _0x142c69=events[_0x58903c];var _0x5bc475=createListener(_0x12a4('0x6')+_0x142c69,_0x25b463);DashboardItemEvents['on'](_0x142c69,_0x5bc475);}}; \ No newline at end of file +var _0xdffd=['removeListener','register','./dashboardItem.events','save','remove','update','emit'];(function(_0xbf5a34,_0x1c57b2){var _0xd853a2=function(_0x4c04b7){while(--_0x4c04b7){_0xbf5a34['push'](_0xbf5a34['shift']());}};_0xd853a2(++_0x1c57b2);}(_0xdffd,0x144));var _0xddff=function(_0x3540c6,_0x9f07f7){_0x3540c6=_0x3540c6-0x0;var _0x21cc4a=_0xdffd[_0x3540c6];return _0x21cc4a;};'use strict';var DashboardItemEvents=require(_0xddff('0x0'));var events=[_0xddff('0x1'),_0xddff('0x2'),_0xddff('0x3')];function createListener(_0x59e9c9,_0x595d03){return function(_0x1c1a3c){_0x595d03[_0xddff('0x4')](_0x59e9c9,_0x1c1a3c);};}function removeListener(_0x512ae4,_0x5979a3){return function(){DashboardItemEvents[_0xddff('0x5')](_0x512ae4,_0x5979a3);};}exports[_0xddff('0x6')]=function(_0x230ad0){for(var _0x20e3ed=0x0,_0x508b06=events['length'];_0x20e3ed<_0x508b06;_0x20e3ed++){var _0x56e0f8=events[_0x20e3ed];var _0x2da7bf=createListener('dashboardItem:'+_0x56e0f8,_0x230ad0);DashboardItemEvents['on'](_0x56e0f8,_0x2da7bf);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 4515039..d614145 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 _0xd348=['put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','create'];(function(_0x2f1caf,_0x3bbb1e){var _0x271062=function(_0x370c09){while(--_0x370c09){_0x2f1caf['push'](_0x2f1caf['shift']());}};_0x271062(++_0x3bbb1e);}(_0xd348,0x180));var _0x8d34=function(_0x10616f,_0x5e1d7a){_0x10616f=_0x10616f-0x0;var _0xac627a=_0xd348[_0x10616f];return _0xac627a;};'use strict';var multer=require(_0x8d34('0x0'));var util=require(_0x8d34('0x1'));var path=require(_0x8d34('0x2'));var timeout=require('connect-timeout');var express=require(_0x8d34('0x3'));var router=express[_0x8d34('0x4')]();var fs_extra=require(_0x8d34('0x5'));var auth=require(_0x8d34('0x6'));var interaction=require(_0x8d34('0x7'));var config=require(_0x8d34('0x8'));var controller=require('./dashboardItem.controller');router[_0x8d34('0x9')](_0x8d34('0xa'),auth[_0x8d34('0xb')](),controller[_0x8d34('0xc')]);router[_0x8d34('0xd')]('/',auth[_0x8d34('0xb')](),controller[_0x8d34('0xe')]);router[_0x8d34('0xf')](_0x8d34('0xa'),auth['isAuthenticated'](),controller[_0x8d34('0x10')]);router['delete'](_0x8d34('0xa'),auth[_0x8d34('0xb')](),controller[_0x8d34('0x11')]);module[_0x8d34('0x12')]=router; \ No newline at end of file +var _0x6939=['post','create','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show'];(function(_0x1c0c7c,_0x2ede87){var _0x1eeae0=function(_0x6d671b){while(--_0x6d671b){_0x1c0c7c['push'](_0x1c0c7c['shift']());}};_0x1eeae0(++_0x2ede87);}(_0x6939,0x96));var _0x9693=function(_0x531b68,_0x5b0af8){_0x531b68=_0x531b68-0x0;var _0x31dae8=_0x6939[_0x531b68];return _0x31dae8;};'use strict';var multer=require('multer');var util=require(_0x9693('0x0'));var path=require(_0x9693('0x1'));var timeout=require(_0x9693('0x2'));var express=require('express');var router=express[_0x9693('0x3')]();var fs_extra=require(_0x9693('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9693('0x5'));var config=require(_0x9693('0x6'));var controller=require(_0x9693('0x7'));router[_0x9693('0x8')](_0x9693('0x9'),auth[_0x9693('0xa')](),controller[_0x9693('0xb')]);router[_0x9693('0xc')]('/',auth['isAuthenticated'](),controller[_0x9693('0xd')]);router['put'](_0x9693('0x9'),auth[_0x9693('0xa')](),controller[_0x9693('0xe')]);router[_0x9693('0xf')](_0x9693('0x9'),auth['isAuthenticated'](),controller[_0x9693('0x10')]);module[_0x9693('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 608a148..40e92b1 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 _0xa27b=['first','third','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa27b,0x1b5));var _0xba27=function(_0x11e29c,_0x1e14a0){_0x11e29c=_0x11e29c-0x0;var _0x496195=_0xa27b[_0x11e29c];return _0x496195;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xba27('0x0')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xba27('0x1'),'second',_0xba27('0x2')),'allowNull':![],'defaultValue':_0xba27('0x1')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd053=['exports','STRING','first','third'];(function(_0x377ff6,_0xf7fb77){var _0x2f6117=function(_0xa5ab68){while(--_0xa5ab68){_0x377ff6['push'](_0x377ff6['shift']());}};_0x2f6117(++_0xf7fb77);}(_0xd053,0xb0));var _0x3d05=function(_0x49a57f,_0x405f38){_0x49a57f=_0x49a57f-0x0;var _0x2fa2a5=_0xd053[_0x49a57f];return _0x2fa2a5;};'use strict';var Sequelize=require('sequelize');module[_0x3d05('0x0')]={'name':{'type':Sequelize[_0x3d05('0x1')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x3d05('0x2'),'second',_0x3d05('0x3')),'allowNull':![],'defaultValue':_0x3d05('0x2')},'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 8cbce52..7f99957 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 _0x9802=['UserProfileResource','update','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','Dispositions','error','stack','name','send','index','map','Disposition','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','limit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation'];(function(_0xe74d4e,_0x4e3300){var _0x2f77dd=function(_0x5adf64){while(--_0x5adf64){_0xe74d4e['push'](_0xe74d4e['shift']());}};_0x2f77dd(++_0x4e3300);}(_0x9802,0xf6));var _0x2980=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x9802[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0x2980('0x0'));var rimraf=require(_0x2980('0x1'));var zipdir=require(_0x2980('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2980('0x3'));var moment=require(_0x2980('0x4'));var BPromise=require(_0x2980('0x5'));var Mustache=require(_0x2980('0x6'));var util=require(_0x2980('0x7'));var path=require('path');var sox=require(_0x2980('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2980('0x9'));var squel=require(_0x2980('0xa'));var crypto=require(_0x2980('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2980('0xc'));var toCsv=require(_0x2980('0xd'));var querystring=require(_0x2980('0xe'));var Papa=require(_0x2980('0xf'));var Redis=require(_0x2980('0x10'));var authService=require(_0x2980('0x11'));var qs=require(_0x2980('0x12'));var as=require(_0x2980('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2980('0x14'));var config=require(_0x2980('0x15'));var licenseUtil=require(_0x2980('0x16'));var db=require(_0x2980('0x17'))['db'];function respondWithStatusCode(_0x34a13c,_0xa259f9){_0xa259f9=_0xa259f9||0xcc;return function(_0x4f5f2d){if(_0x4f5f2d){return _0x34a13c[_0x2980('0x18')](_0xa259f9);}return _0x34a13c['status'](_0xa259f9)[_0x2980('0x19')]();};}function respondWithResult(_0x3da46c,_0x22323e){_0x22323e=_0x22323e||0xc8;return function(_0xe9a2f3){if(_0xe9a2f3){return _0x3da46c[_0x2980('0x1a')](_0x22323e)[_0x2980('0x1b')](_0xe9a2f3);}};}function respondWithFilteredResult(_0x4a9709,_0x3266e8){return function(_0x1e9a57){if(_0x1e9a57){var _0x422b99=typeof _0x3266e8['offset']===_0x2980('0x1c')&&typeof _0x3266e8['limit']===_0x2980('0x1c');var _0x15a58a=_0x1e9a57[_0x2980('0x1d')];var _0x1ec2e9=_0x422b99?0x0:_0x3266e8[_0x2980('0x1e')];var _0x177408=_0x422b99?_0x1e9a57[_0x2980('0x1d')]:_0x3266e8['offset']+_0x3266e8['limit'];var _0x46c09c;if(_0x177408>=_0x15a58a){_0x177408=_0x15a58a;_0x46c09c=0xc8;}else{_0x46c09c=0xce;}_0x4a9709[_0x2980('0x1a')](_0x46c09c);return _0x4a9709[_0x2980('0x1f')](_0x2980('0x20'),_0x1ec2e9+'-'+_0x177408+'/'+_0x15a58a)[_0x2980('0x1b')](_0x1e9a57);}return null;};}function patchUpdates(_0x7f719f){return function(_0x2444ef){try{jsonpatch[_0x2980('0x21')](_0x2444ef,_0x7f719f,!![]);}catch(_0x183e66){return BPromise[_0x2980('0x22')](_0x183e66);}return _0x2444ef[_0x2980('0x23')]();};}function saveUpdates(_0x1a37eb,_0x479ad4){return function(_0x4213cf){if(_0x4213cf){return _0x4213cf['update'](_0x1a37eb)[_0x2980('0x24')](function(_0x5e6610){return _0x5e6610;});}return null;};}function removeEntity(_0x2242e1,_0x483bd8){return function(_0x4e6f87){if(_0x4e6f87){return _0x4e6f87[_0x2980('0x25')]()[_0x2980('0x24')](function(){var _0x1bc4a2=_0x4e6f87['get']({'plain':!![]});var _0x17ce7b=_0x2980('0x26');return db['UserProfileResource'][_0x2980('0x25')]({'where':{'type':_0x17ce7b,'resourceId':_0x1bc4a2['id']}})[_0x2980('0x24')](function(){return _0x4e6f87;});})[_0x2980('0x24')](function(){_0x2242e1[_0x2980('0x1a')](0xcc)[_0x2980('0x19')]();});}};}function handleEntityNotFound(_0x1e785e,_0x27cb68){return function(_0x33409e){if(!_0x33409e){_0x1e785e[_0x2980('0x18')](0x194);}return _0x33409e;};}function handleError(_0x51de87,_0x43e092){_0x43e092=_0x43e092||0x1f4;return function(_0x2e0f4d){logger[_0x2980('0x27')](_0x2e0f4d[_0x2980('0x28')]);if(_0x2e0f4d[_0x2980('0x29')]){delete _0x2e0f4d[_0x2980('0x29')];}_0x51de87[_0x2980('0x1a')](_0x43e092)[_0x2980('0x2a')](_0x2e0f4d);};}exports[_0x2980('0x2b')]=function(_0x12806d,_0x67f072){var _0x164eea={},_0x17abe6={},_0x4a3eee={'count':0x0,'rows':[]};var _0x39f8d5=_[_0x2980('0x2c')](db[_0x2980('0x2d')]['rawAttributes'],function(_0x5a346b){return{'name':_0x5a346b['fieldName'],'type':_0x5a346b[_0x2980('0x2e')][_0x2980('0x2f')]};});_0x17abe6[_0x2980('0x30')]=_[_0x2980('0x2c')](_0x39f8d5,'name');_0x17abe6[_0x2980('0x31')]=_[_0x2980('0x32')](_0x12806d[_0x2980('0x31')]);_0x17abe6['filters']=_[_0x2980('0x33')](_0x17abe6[_0x2980('0x30')],_0x17abe6[_0x2980('0x31')]);_0x164eea['attributes']=_['intersection'](_0x17abe6[_0x2980('0x30')],qs['fields'](_0x12806d[_0x2980('0x31')][_0x2980('0x34')]));_0x164eea[_0x2980('0x35')]=_0x164eea[_0x2980('0x35')][_0x2980('0x36')]?_0x164eea[_0x2980('0x35')]:_0x17abe6[_0x2980('0x30')];if(!_0x12806d[_0x2980('0x31')][_0x2980('0x37')]('nolimit')){_0x164eea['limit']=qs[_0x2980('0x38')](_0x12806d[_0x2980('0x31')]['limit']);_0x164eea['offset']=qs[_0x2980('0x1e')](_0x12806d[_0x2980('0x31')][_0x2980('0x1e')]);}_0x164eea['order']=qs[_0x2980('0x39')](_0x12806d[_0x2980('0x31')][_0x2980('0x39')]);_0x164eea[_0x2980('0x3a')]=qs['filters'](_['pick'](_0x12806d['query'],_0x17abe6[_0x2980('0x3b')]),_0x39f8d5);if(_0x12806d['query'][_0x2980('0x3c')]){_0x164eea[_0x2980('0x3a')]=_[_0x2980('0x3d')](_0x164eea[_0x2980('0x3a')],{'$or':_['map'](_0x39f8d5,function(_0xf2d857){if(_0xf2d857[_0x2980('0x2e')]!==_0x2980('0x3e')){var _0xacd8f1={};_0xacd8f1[_0xf2d857['name']]={'$like':'%'+_0x12806d[_0x2980('0x31')][_0x2980('0x3c')]+'%'};return _0xacd8f1;}})});}_0x164eea=_[_0x2980('0x3d')]({},_0x164eea,_0x12806d[_0x2980('0x3f')]);var _0x1e24c8={'where':_0x164eea[_0x2980('0x3a')]};return db[_0x2980('0x2d')][_0x2980('0x1d')](_0x1e24c8)[_0x2980('0x24')](function(_0x244d4b){_0x4a3eee['count']=_0x244d4b;if(_0x12806d[_0x2980('0x31')][_0x2980('0x40')]){_0x164eea[_0x2980('0x41')]=[{'all':!![]}];}return db[_0x2980('0x2d')][_0x2980('0x42')](_0x164eea);})[_0x2980('0x24')](function(_0x1ee059){_0x4a3eee[_0x2980('0x43')]=_0x1ee059;return _0x4a3eee;})['then'](respondWithFilteredResult(_0x67f072,_0x164eea))[_0x2980('0x44')](handleError(_0x67f072,null));};exports[_0x2980('0x45')]=function(_0x55337d,_0x1d766f){var _0x907823={'raw':!![],'where':{'id':_0x55337d['params']['id']}},_0x55ba0f={};_0x55ba0f['model']=_[_0x2980('0x32')](db['Disposition']['rawAttributes']);_0x55ba0f['query']=_['keys'](_0x55337d[_0x2980('0x31')]);_0x55ba0f[_0x2980('0x3b')]=_['intersection'](_0x55ba0f[_0x2980('0x30')],_0x55ba0f[_0x2980('0x31')]);_0x907823[_0x2980('0x35')]=_[_0x2980('0x33')](_0x55ba0f['model'],qs[_0x2980('0x34')](_0x55337d[_0x2980('0x31')]['fields']));_0x907823[_0x2980('0x35')]=_0x907823[_0x2980('0x35')][_0x2980('0x36')]?_0x907823[_0x2980('0x35')]:_0x55ba0f[_0x2980('0x30')];if(_0x55337d['query'][_0x2980('0x40')]){_0x907823[_0x2980('0x41')]=[{'all':!![]}];}_0x907823=_['merge']({},_0x907823,_0x55337d[_0x2980('0x3f')]);return db[_0x2980('0x2d')][_0x2980('0x46')](_0x907823)[_0x2980('0x24')](handleEntityNotFound(_0x1d766f,null))['then'](respondWithResult(_0x1d766f,null))[_0x2980('0x44')](handleError(_0x1d766f,null));};exports[_0x2980('0x47')]=function(_0x7ef9aa,_0x1db1dd){return db['Disposition']['create'](_0x7ef9aa[_0x2980('0x48')],{})[_0x2980('0x24')](function(_0x261ef5){var _0x47052d=_0x7ef9aa['user'][_0x2980('0x49')]({'plain':!![]});if(!_0x47052d)throw new Error(_0x2980('0x4a'));if(_0x47052d['role']==='user'){var _0x587904=_0x261ef5['get']({'plain':!![]});var _0x3f5918=_0x2980('0x26');return db[_0x2980('0x4b')]['find']({'where':{'name':_0x3f5918,'userProfileId':_0x47052d[_0x2980('0x4c')]},'raw':!![]})['then'](function(_0x43ccec){if(_0x43ccec&&_0x43ccec[_0x2980('0x4d')]===0x0){return db[_0x2980('0x4e')]['create']({'name':_0x587904['name'],'resourceId':_0x587904['id'],'type':_0x43ccec[_0x2980('0x29')],'sectionId':_0x43ccec['id']},{})[_0x2980('0x24')](function(){return _0x261ef5;});}else{return _0x261ef5;}})[_0x2980('0x44')](function(_0xe98271){logger[_0x2980('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe98271);throw _0xe98271;});}return _0x261ef5;})[_0x2980('0x24')](respondWithResult(_0x1db1dd,0xc9))[_0x2980('0x44')](handleError(_0x1db1dd,null));};exports[_0x2980('0x4f')]=function(_0x5e9c08,_0x22e76c){if(_0x5e9c08['body']['id']){delete _0x5e9c08[_0x2980('0x48')]['id'];}return db[_0x2980('0x2d')]['find']({'where':{'id':_0x5e9c08['params']['id']}})['then'](handleEntityNotFound(_0x22e76c,null))[_0x2980('0x24')](saveUpdates(_0x5e9c08[_0x2980('0x48')],null))[_0x2980('0x24')](respondWithResult(_0x22e76c,null))[_0x2980('0x44')](handleError(_0x22e76c,null));};exports['destroy']=function(_0x3bd696,_0x59fc82){return db[_0x2980('0x2d')]['find']({'where':{'id':_0x3bd696[_0x2980('0x50')]['id']}})[_0x2980('0x24')](handleEntityNotFound(_0x59fc82,null))[_0x2980('0x24')](removeEntity(_0x59fc82,null))['catch'](handleError(_0x59fc82,null));}; \ No newline at end of file +var _0x1487=['../../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','set','Content-Range','apply','reject','save','update','then','destroy','Dispositions','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','params','filters','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x5722aa,_0x1afeb5){var _0x365c9f=function(_0x3225f6){while(--_0x3225f6){_0x5722aa['push'](_0x5722aa['shift']());}};_0x365c9f(++_0x1afeb5);}(_0x1487,0xf2));var _0x7148=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x1487[_0x1ae5ab];return _0x1ce001;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7148('0x0'));var zipdir=require(_0x7148('0x1'));var jsonpatch=require(_0x7148('0x2'));var rp=require('request-promise');var moment=require(_0x7148('0x3'));var BPromise=require(_0x7148('0x4'));var Mustache=require('mustache');var util=require(_0x7148('0x5'));var path=require(_0x7148('0x6'));var sox=require(_0x7148('0x7'));var csv=require(_0x7148('0x8'));var ejs=require(_0x7148('0x9'));var fs=require('fs');var fs_extra=require(_0x7148('0xa'));var _=require(_0x7148('0xb'));var squel=require(_0x7148('0xc'));var crypto=require(_0x7148('0xd'));var jsforce=require(_0x7148('0xe'));var deskjs=require(_0x7148('0xf'));var toCsv=require(_0x7148('0x8'));var querystring=require(_0x7148('0x10'));var Papa=require(_0x7148('0x11'));var Redis=require(_0x7148('0x12'));var authService=require(_0x7148('0x13'));var qs=require(_0x7148('0x14'));var as=require(_0x7148('0x15'));var hardwareService=require(_0x7148('0x16'));var logger=require('../../config/logger')(_0x7148('0x17'));var utils=require(_0x7148('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7148('0x19'));var db=require(_0x7148('0x1a'))['db'];function respondWithStatusCode(_0x23ebea,_0x10b8d8){_0x10b8d8=_0x10b8d8||0xcc;return function(_0x281de0){if(_0x281de0){return _0x23ebea[_0x7148('0x1b')](_0x10b8d8);}return _0x23ebea[_0x7148('0x1c')](_0x10b8d8)[_0x7148('0x1d')]();};}function respondWithResult(_0x508ebb,_0x571222){_0x571222=_0x571222||0xc8;return function(_0x47ed35){if(_0x47ed35){return _0x508ebb[_0x7148('0x1c')](_0x571222)[_0x7148('0x1e')](_0x47ed35);}};}function respondWithFilteredResult(_0x1e1428,_0x126b75){return function(_0x21372d){if(_0x21372d){var _0x141ad9=typeof _0x126b75[_0x7148('0x1f')]===_0x7148('0x20')&&typeof _0x126b75['limit']===_0x7148('0x20');var _0x4d0d53=_0x21372d['count'];var _0x1bdc9e=_0x141ad9?0x0:_0x126b75['offset'];var _0x2c9680=_0x141ad9?_0x21372d['count']:_0x126b75[_0x7148('0x1f')]+_0x126b75[_0x7148('0x21')];var _0x36162e;if(_0x2c9680>=_0x4d0d53){_0x2c9680=_0x4d0d53;_0x36162e=0xc8;}else{_0x36162e=0xce;}_0x1e1428[_0x7148('0x1c')](_0x36162e);return _0x1e1428[_0x7148('0x22')](_0x7148('0x23'),_0x1bdc9e+'-'+_0x2c9680+'/'+_0x4d0d53)[_0x7148('0x1e')](_0x21372d);}return null;};}function patchUpdates(_0x5ac51f){return function(_0x1e16bd){try{jsonpatch[_0x7148('0x24')](_0x1e16bd,_0x5ac51f,!![]);}catch(_0x582fc9){return BPromise[_0x7148('0x25')](_0x582fc9);}return _0x1e16bd[_0x7148('0x26')]();};}function saveUpdates(_0x122cb0,_0x3dbdc4){return function(_0x12cccc){if(_0x12cccc){return _0x12cccc[_0x7148('0x27')](_0x122cb0)[_0x7148('0x28')](function(_0x407a02){return _0x407a02;});}return null;};}function removeEntity(_0x248c6e,_0x352088){return function(_0x1a327b){if(_0x1a327b){return _0x1a327b[_0x7148('0x29')]()['then'](function(){var _0x499fc4=_0x1a327b['get']({'plain':!![]});var _0x1e098e=_0x7148('0x2a');return db[_0x7148('0x2b')][_0x7148('0x29')]({'where':{'type':_0x1e098e,'resourceId':_0x499fc4['id']}})['then'](function(){return _0x1a327b;});})['then'](function(){_0x248c6e[_0x7148('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cbc18,_0x359b1f){return function(_0x4ef89c){if(!_0x4ef89c){_0x3cbc18[_0x7148('0x1b')](0x194);}return _0x4ef89c;};}function handleError(_0x3755e4,_0x164cbb){_0x164cbb=_0x164cbb||0x1f4;return function(_0x25ec24){logger[_0x7148('0x2c')](_0x25ec24[_0x7148('0x2d')]);if(_0x25ec24[_0x7148('0x2e')]){delete _0x25ec24['name'];}_0x3755e4[_0x7148('0x1c')](_0x164cbb)[_0x7148('0x2f')](_0x25ec24);};}exports[_0x7148('0x30')]=function(_0x516421,_0x43576e){var _0x4b400b={},_0x2bcf28={},_0x4c6994={'count':0x0,'rows':[]};var _0x19d9a1=_[_0x7148('0x31')](db[_0x7148('0x32')][_0x7148('0x33')],function(_0xe99a52){return{'name':_0xe99a52['fieldName'],'type':_0xe99a52[_0x7148('0x34')]['key']};});_0x2bcf28[_0x7148('0x35')]=_[_0x7148('0x31')](_0x19d9a1,_0x7148('0x2e'));_0x2bcf28[_0x7148('0x36')]=_[_0x7148('0x37')](_0x516421['query']);_0x2bcf28['filters']=_[_0x7148('0x38')](_0x2bcf28[_0x7148('0x35')],_0x2bcf28[_0x7148('0x36')]);_0x4b400b[_0x7148('0x39')]=_[_0x7148('0x38')](_0x2bcf28[_0x7148('0x35')],qs[_0x7148('0x3a')](_0x516421[_0x7148('0x36')]['fields']));_0x4b400b[_0x7148('0x39')]=_0x4b400b[_0x7148('0x39')]['length']?_0x4b400b[_0x7148('0x39')]:_0x2bcf28[_0x7148('0x35')];if(!_0x516421['query'][_0x7148('0x3b')](_0x7148('0x3c'))){_0x4b400b['limit']=qs['limit'](_0x516421[_0x7148('0x36')][_0x7148('0x21')]);_0x4b400b['offset']=qs[_0x7148('0x1f')](_0x516421[_0x7148('0x36')][_0x7148('0x1f')]);}_0x4b400b['order']=qs[_0x7148('0x3d')](_0x516421[_0x7148('0x36')]['sort']);_0x4b400b[_0x7148('0x3e')]=qs['filters'](_[_0x7148('0x3f')](_0x516421['query'],_0x2bcf28['filters']),_0x19d9a1);if(_0x516421[_0x7148('0x36')][_0x7148('0x40')]){_0x4b400b['where']=_['merge'](_0x4b400b[_0x7148('0x3e')],{'$or':_[_0x7148('0x31')](_0x19d9a1,function(_0x2abd67){if(_0x2abd67[_0x7148('0x34')]!==_0x7148('0x41')){var _0x1048e8={};_0x1048e8[_0x2abd67[_0x7148('0x2e')]]={'$like':'%'+_0x516421['query'][_0x7148('0x40')]+'%'};return _0x1048e8;}})});}_0x4b400b=_[_0x7148('0x42')]({},_0x4b400b,_0x516421[_0x7148('0x43')]);var _0x594de6={'where':_0x4b400b[_0x7148('0x3e')]};return db[_0x7148('0x32')][_0x7148('0x44')](_0x594de6)[_0x7148('0x28')](function(_0xa74c70){_0x4c6994['count']=_0xa74c70;if(_0x516421['query'][_0x7148('0x45')]){_0x4b400b[_0x7148('0x46')]=[{'all':!![]}];}return db[_0x7148('0x32')][_0x7148('0x47')](_0x4b400b);})[_0x7148('0x28')](function(_0x41609c){_0x4c6994[_0x7148('0x48')]=_0x41609c;return _0x4c6994;})[_0x7148('0x28')](respondWithFilteredResult(_0x43576e,_0x4b400b))[_0x7148('0x49')](handleError(_0x43576e,null));};exports[_0x7148('0x4a')]=function(_0x2b8f58,_0x1c730a){var _0x50eec5={'raw':!![],'where':{'id':_0x2b8f58[_0x7148('0x4b')]['id']}},_0xbe7eab={};_0xbe7eab[_0x7148('0x35')]=_[_0x7148('0x37')](db[_0x7148('0x32')][_0x7148('0x33')]);_0xbe7eab['query']=_[_0x7148('0x37')](_0x2b8f58[_0x7148('0x36')]);_0xbe7eab[_0x7148('0x4c')]=_[_0x7148('0x38')](_0xbe7eab[_0x7148('0x35')],_0xbe7eab[_0x7148('0x36')]);_0x50eec5['attributes']=_[_0x7148('0x38')](_0xbe7eab[_0x7148('0x35')],qs[_0x7148('0x3a')](_0x2b8f58[_0x7148('0x36')][_0x7148('0x3a')]));_0x50eec5[_0x7148('0x39')]=_0x50eec5[_0x7148('0x39')][_0x7148('0x4d')]?_0x50eec5[_0x7148('0x39')]:_0xbe7eab['model'];if(_0x2b8f58[_0x7148('0x36')][_0x7148('0x45')]){_0x50eec5[_0x7148('0x46')]=[{'all':!![]}];}_0x50eec5=_['merge']({},_0x50eec5,_0x2b8f58[_0x7148('0x43')]);return db[_0x7148('0x32')][_0x7148('0x4e')](_0x50eec5)[_0x7148('0x28')](handleEntityNotFound(_0x1c730a,null))[_0x7148('0x28')](respondWithResult(_0x1c730a,null))[_0x7148('0x49')](handleError(_0x1c730a,null));};exports[_0x7148('0x4f')]=function(_0x517bbb,_0x4feec5){return db[_0x7148('0x32')]['create'](_0x517bbb[_0x7148('0x50')],{})['then'](function(_0x273184){var _0x32a303=_0x517bbb[_0x7148('0x51')][_0x7148('0x52')]({'plain':!![]});if(!_0x32a303)throw new Error(_0x7148('0x53'));if(_0x32a303['role']===_0x7148('0x51')){var _0x3846d1=_0x273184[_0x7148('0x52')]({'plain':!![]});var _0x2cce9c=_0x7148('0x2a');return db[_0x7148('0x54')]['find']({'where':{'name':_0x2cce9c,'userProfileId':_0x32a303[_0x7148('0x55')]},'raw':!![]})[_0x7148('0x28')](function(_0x157450){if(_0x157450&&_0x157450['autoAssociation']===0x0){return db[_0x7148('0x2b')][_0x7148('0x4f')]({'name':_0x3846d1[_0x7148('0x2e')],'resourceId':_0x3846d1['id'],'type':_0x157450[_0x7148('0x2e')],'sectionId':_0x157450['id']},{})[_0x7148('0x28')](function(){return _0x273184;});}else{return _0x273184;}})[_0x7148('0x49')](function(_0x1c96de){logger[_0x7148('0x2c')](_0x7148('0x56'),_0x1c96de);throw _0x1c96de;});}return _0x273184;})[_0x7148('0x28')](respondWithResult(_0x4feec5,0xc9))[_0x7148('0x49')](handleError(_0x4feec5,null));};exports['update']=function(_0x32b9a1,_0x9f4e81){if(_0x32b9a1['body']['id']){delete _0x32b9a1['body']['id'];}return db[_0x7148('0x32')][_0x7148('0x4e')]({'where':{'id':_0x32b9a1['params']['id']}})[_0x7148('0x28')](handleEntityNotFound(_0x9f4e81,null))['then'](saveUpdates(_0x32b9a1[_0x7148('0x50')],null))['then'](respondWithResult(_0x9f4e81,null))[_0x7148('0x49')](handleError(_0x9f4e81,null));};exports['destroy']=function(_0x4c0e17,_0x2ec6c3){return db['Disposition'][_0x7148('0x4e')]({'where':{'id':_0x4c0e17[_0x7148('0x4b')]['id']}})[_0x7148('0x28')](handleEntityNotFound(_0x2ec6c3,null))[_0x7148('0x28')](removeEntity(_0x2ec6c3,null))[_0x7148('0x49')](handleError(_0x2ec6c3,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 0a109ae..9a4db1e 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 _0x0323=['rimraf','./disposition.attributes','exports','Disposition','tools_dispositions','name_voice','name','ListId','ChatWebsiteId','name_mail','name_sms','name_fax','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xa927ac,_0x1929fc){var _0x31781a=function(_0xb47fb2){while(--_0xb47fb2){_0xa927ac['push'](_0xa927ac['shift']());}};_0x31781a(++_0x1929fc);}(_0x0323,0x102));var _0x3032=function(_0x580607,_0x3d2c7d){_0x580607=_0x580607-0x0;var _0x3adb02=_0x0323[_0x580607];return _0x3adb02;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3032('0x0'))(_0x3032('0x1'));var moment=require(_0x3032('0x2'));var BPromise=require(_0x3032('0x3'));var rp=require(_0x3032('0x4'));var fs=require('fs');var path=require(_0x3032('0x5'));var rimraf=require(_0x3032('0x6'));var config=require('../../config/environment');var attributes=require(_0x3032('0x7'));module[_0x3032('0x8')]=function(_0x24f8d7,_0xa52641){return _0x24f8d7['define'](_0x3032('0x9'),attributes,{'tableName':_0x3032('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x3032('0xb'),'fields':[_0x3032('0xc'),_0x3032('0xd')]},{'unique':!![],'name':'name_chat','fields':['name',_0x3032('0xe')]},{'unique':!![],'name':_0x3032('0xf'),'fields':[_0x3032('0xc'),'MailAccountId']},{'unique':!![],'name':_0x3032('0x10'),'fields':[_0x3032('0xc'),'SmsAccountId']},{'unique':!![],'name':_0x3032('0x11'),'fields':[_0x3032('0xc'),_0x3032('0x12')]},{'unique':!![],'name':_0x3032('0x13'),'fields':[_0x3032('0xc'),'OpenchannelAccountId']},{'unique':!![],'name':_0x3032('0x14'),'fields':[_0x3032('0xc'),_0x3032('0x15')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe6cb=['MailAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','util','../../config/logger','api','bluebird','../../config/environment','./disposition.attributes','exports','define','Disposition','name_voice','name','name_chat','ChatWebsiteId','name_mail'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xe6cb,0x1f2));var _0xbe6c=function(_0x195c57,_0x56f472){_0x195c57=_0x195c57-0x0;var _0x1698e5=_0xe6cb[_0x195c57];return _0x1698e5;};'use strict';var _=require(_0xbe6c('0x0'));var util=require(_0xbe6c('0x1'));var logger=require(_0xbe6c('0x2'))(_0xbe6c('0x3'));var moment=require('moment');var BPromise=require(_0xbe6c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbe6c('0x5'));var attributes=require(_0xbe6c('0x6'));module[_0xbe6c('0x7')]=function(_0x3c72f7,_0x41acf){return _0x3c72f7[_0xbe6c('0x8')](_0xbe6c('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xbe6c('0xa'),'fields':[_0xbe6c('0xb'),'ListId']},{'unique':!![],'name':_0xbe6c('0xc'),'fields':[_0xbe6c('0xb'),_0xbe6c('0xd')]},{'unique':!![],'name':_0xbe6c('0xe'),'fields':['name',_0xbe6c('0xf')]},{'unique':!![],'name':'name_sms','fields':[_0xbe6c('0xb'),'SmsAccountId']},{'unique':!![],'name':'name_fax','fields':[_0xbe6c('0xb'),'FaxAccountId']},{'unique':!![],'name':_0xbe6c('0x10'),'fields':['name',_0xbe6c('0x11')]},{'unique':!![],'name':'name_whatsapp','fields':[_0xbe6c('0xb'),_0xbe6c('0x12')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 4f68d0b..3c81cf6 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(_0x36310d,_0x513273){var _0x48ecb4=function(_0x439314){while(--_0x439314){_0x36310d['push'](_0x36310d['shift']());}};_0x48ecb4(++_0x513273);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ 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(_0x1311d6,_0x53d1df){var _0x4fa9cc=function(_0x1b2f72){while(--_0x1b2f72){_0x1311d6['push'](_0x1311d6['shift']());}};_0x4fa9cc(++_0x53d1df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index a589d3c..f51500a 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 _0xc556=['post','put','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','get','index','/:id','isAuthenticated','show'];(function(_0x5a74c0,_0x3177b4){var _0x5b35e3=function(_0x4ae3e2){while(--_0x4ae3e2){_0x5a74c0['push'](_0x5a74c0['shift']());}};_0x5b35e3(++_0x3177b4);}(_0xc556,0x1d4));var _0x6c55=function(_0x312f37,_0x2d11de){_0x312f37=_0x312f37-0x0;var _0x1d89d1=_0xc556[_0x312f37];return _0x1d89d1;};'use strict';var multer=require(_0x6c55('0x0'));var util=require(_0x6c55('0x1'));var path=require(_0x6c55('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c55('0x3'));var router=express[_0x6c55('0x4')]();var fs_extra=require(_0x6c55('0x5'));var auth=require(_0x6c55('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0x6c55('0x7')]('/',auth['isAuthenticated'](),controller[_0x6c55('0x8')]);router['get'](_0x6c55('0x9'),auth[_0x6c55('0xa')](),controller[_0x6c55('0xb')]);router[_0x6c55('0xc')]('/',auth[_0x6c55('0xa')](),controller['create']);router[_0x6c55('0xd')](_0x6c55('0x9'),auth['isAuthenticated'](),controller[_0x6c55('0xe')]);router[_0x6c55('0xf')]('/:id',auth[_0x6c55('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa8eb=['destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','show','post','create','put','/:id','update'];(function(_0x4ab866,_0x40e607){var _0x56047a=function(_0x112c87){while(--_0x112c87){_0x4ab866['push'](_0x4ab866['shift']());}};_0x56047a(++_0x40e607);}(_0xa8eb,0x1e8));var _0xba8e=function(_0x277013,_0x33ca2b){_0x277013=_0x277013-0x0;var _0x5d6704=_0xa8eb[_0x277013];return _0x5d6704;};'use strict';var multer=require(_0xba8e('0x0'));var util=require('util');var path=require(_0xba8e('0x1'));var timeout=require('connect-timeout');var express=require(_0xba8e('0x2'));var router=express[_0xba8e('0x3')]();var fs_extra=require(_0xba8e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xba8e('0x5'));var config=require(_0xba8e('0x6'));var controller=require(_0xba8e('0x7'));router[_0xba8e('0x8')]('/',auth[_0xba8e('0x9')](),controller['index']);router[_0xba8e('0x8')]('/:id',auth[_0xba8e('0x9')](),controller[_0xba8e('0xa')]);router[_0xba8e('0xb')]('/',auth[_0xba8e('0x9')](),controller[_0xba8e('0xc')]);router[_0xba8e('0xd')](_0xba8e('0xe'),auth[_0xba8e('0x9')](),controller[_0xba8e('0xf')]);router['delete'](_0xba8e('0xe'),auth[_0xba8e('0x9')](),controller[_0xba8e('0x10')]);module[_0xba8e('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 48829d8..1ddbf52 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 _0x4351=['ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','12000','9600','14400','INTEGER','SIP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4351,0x1b5));var _0x1435=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x4351[_0x50a0c2];return _0x5ebadd;};'use strict';var Sequelize=require(_0x1435('0x0'));module[_0x1435('0x1')]={'name':{'type':Sequelize[_0x1435('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1435('0x2')]},'ecm':{'type':Sequelize[_0x1435('0x3')](_0x1435('0x4'),'no'),'defaultValue':_0x1435('0x4')},'headerinfo':{'type':Sequelize[_0x1435('0x2')],'defaultValue':_0x1435('0x5')},'localstationid':{'type':Sequelize[_0x1435('0x2')],'unique':_0x1435('0x6')},'minrate':{'type':Sequelize[_0x1435('0x3')](_0x1435('0x7'),_0x1435('0x8'),_0x1435('0x9'),'9600',_0x1435('0xa'),'14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x1435('0x3')](_0x1435('0x7'),_0x1435('0x8'),_0x1435('0x9'),_0x1435('0xb'),'12000',_0x1435('0xc')),'defaultValue':_0x1435('0xc')},'modem':{'type':Sequelize['STRING'],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x1435('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x1435('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x1435('0xe'),'IAX','DADHI','KHOMP'),'defaultValue':_0x1435('0xe')},'key':{'type':Sequelize[_0x1435('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1435('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1435('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x1435('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1435('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1435('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1435('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1435('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1435('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x1435('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x1435('0x10')],'defaultValue':![],'comment':_0x1435('0x12'),'set':function(_0x189f4a){if(!_0x189f4a)this[_0x1435('0x13')](_0x1435('0x14'),null);this[_0x1435('0x13')](_0x1435('0x15'),_0x189f4a);}}}; \ No newline at end of file +var _0xa6b0=['2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','ENUM','yes','xCALLY\x20Motion\x20Fax','STRING','localstationid'];(function(_0xa7ed43,_0x18ecf5){var _0xd97485=function(_0x1f3238){while(--_0x1f3238){_0xa7ed43['push'](_0xa7ed43['shift']());}};_0xd97485(++_0x18ecf5);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x37cf12,_0x5cfcc3){_0x37cf12=_0x37cf12-0x0;var _0x4ba53c=_0xa6b0[_0x37cf12];return _0x4ba53c;};'use strict';var Sequelize=require(_0x0a6b('0x0'));module[_0x0a6b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x0a6b('0x2')](_0x0a6b('0x3'),'no'),'defaultValue':_0x0a6b('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x0a6b('0x4')},'localstationid':{'type':Sequelize[_0x0a6b('0x5')],'unique':_0x0a6b('0x6')},'minrate':{'type':Sequelize[_0x0a6b('0x2')](_0x0a6b('0x7'),_0x0a6b('0x8'),_0x0a6b('0x9'),_0x0a6b('0xa'),_0x0a6b('0xb'),_0x0a6b('0xc')),'defaultValue':_0x0a6b('0x8')},'maxrate':{'type':Sequelize[_0x0a6b('0x2')]('2400','4800',_0x0a6b('0x9'),_0x0a6b('0xa'),_0x0a6b('0xb'),_0x0a6b('0xc')),'defaultValue':_0x0a6b('0xc')},'modem':{'type':Sequelize[_0x0a6b('0x5')],'defaultValue':_0x0a6b('0xd')},'gateway':{'type':Sequelize[_0x0a6b('0x5')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x0a6b('0x5')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x0a6b('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x0a6b('0x2')](_0x0a6b('0xf'),_0x0a6b('0x10'),_0x0a6b('0x11'),'KHOMP'),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x0a6b('0x5')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x0a6b('0x12')],'defaultValue':function(){return _0x0a6b('0x13');}},'notificationSound':{'type':Sequelize[_0x0a6b('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0a6b('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0a6b('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x0a6b('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0a6b('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0a6b('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0a6b('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a6b('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0x0a6b('0x15')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x0a6b('0x16'),'set':function(_0x4d0e3b){if(!_0x4d0e3b)this[_0x0a6b('0x17')](_0x0a6b('0x18'),null);this[_0x0a6b('0x17')](_0x0a6b('0x19'),_0x4d0e3b);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index f1a4872..4bf4941 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 _0x0952=['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','redis','defaults','localhost','./faxAccount.socket','register','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','get','FaxAccounts','destroy','stack','name','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','Pause','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','length','FaxAccountId','removeAnswers','ids','addInteraction','FaxInteraction','omit','getInteractions','Contact','User','Owner','Tags','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','from-voip-provider','exten','localstationid','app','system','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','ecm','gateway','faxdetect','maxrate','minrate','modem','t38timeout','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','ListId','findById','getMessages','FaxMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','send','List','Contacts','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','CmContact','List\x20not\x20found','Send\x20Fax\x20failed','user','out','Messages','Contact\x20not\x20found','spread','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','rimraf','fast-json-patch','moment','util','path'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x0952,0x189));var _0x2095=function(_0x1268e1,_0x45dcf9){_0x1268e1=_0x1268e1-0x0;var _0x2d0a4a=_0x0952[_0x1268e1];return _0x2d0a4a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2095('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2095('0x1'));var rp=require('request-promise');var moment=require(_0x2095('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2095('0x3'));var path=require(_0x2095('0x4'));var sox=require(_0x2095('0x5'));var csv=require(_0x2095('0x6'));var ejs=require(_0x2095('0x7'));var fs=require('fs');var fs_extra=require(_0x2095('0x8'));var _=require(_0x2095('0x9'));var squel=require(_0x2095('0xa'));var crypto=require(_0x2095('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2095('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2095('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2095('0xe'));var qs=require(_0x2095('0xf'));var as=require(_0x2095('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2095('0x11'))(_0x2095('0x12'));var utils=require(_0x2095('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2095('0x14'));var db=require(_0x2095('0x15'))['db'];config[_0x2095('0x16')]=_[_0x2095('0x17')](config['redis'],{'host':_0x2095('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2095('0x16')]));require(_0x2095('0x19'))[_0x2095('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2095('0x1b')][_0x2095('0x1c')]({'port':0x232c});var client9002=jayson[_0x2095('0x1b')][_0x2095('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1ed907,_0x6cdac2,_0x3400e2,_0x4487bd){return new BPromise(function(_0x2bbe8f,_0x172668){var _0x15dc7c=_0x4487bd||client;return _0x15dc7c[_0x2095('0x1d')](_0x1ed907,_0x3400e2)[_0x2095('0x1e')](function(_0x295638){logger[_0x2095('0x1f')](_0x2095('0x20'),_0x6cdac2,_0x2095('0x21'));logger[_0x2095('0x22')](_0x2095('0x23'),_0x6cdac2,_0x2095('0x21'),JSON[_0x2095('0x24')](_0x295638));if(_0x295638[_0x2095('0x25')]){if(_0x295638[_0x2095('0x25')][_0x2095('0x26')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x6cdac2,_0x295638[_0x2095('0x25')][_0x2095('0x27')]);return _0x172668(_0x295638[_0x2095('0x25')][_0x2095('0x27')]);}logger['error'](_0x2095('0x20'),_0x6cdac2,_0x295638[_0x2095('0x25')][_0x2095('0x27')]);return _0x2bbe8f(_0x295638['error']['message']);}else{logger[_0x2095('0x1f')](_0x2095('0x20'),_0x6cdac2,_0x2095('0x21'));_0x2bbe8f(_0x295638[_0x2095('0x28')]['message']);}})[_0x2095('0x29')](function(_0x554a05){logger[_0x2095('0x25')](_0x2095('0x20'),_0x6cdac2,_0x554a05);_0x172668(_0x554a05);});});}function respondWithStatusCode(_0x32bd99,_0x8f65b4){_0x8f65b4=_0x8f65b4||0xcc;return function(_0x39c579){if(_0x39c579){return _0x32bd99[_0x2095('0x2a')](_0x8f65b4);}return _0x32bd99[_0x2095('0x2b')](_0x8f65b4)[_0x2095('0x2c')]();};}function respondWithResult(_0x3a5dc8,_0x46690c){_0x46690c=_0x46690c||0xc8;return function(_0x374a90){if(_0x374a90){return _0x3a5dc8['status'](_0x46690c)[_0x2095('0x2d')](_0x374a90);}};}function respondWithFilteredResult(_0x1209f6,_0x4837ca){return function(_0x59bc26){if(_0x59bc26){var _0x314818=typeof _0x4837ca[_0x2095('0x2e')]===_0x2095('0x2f')&&typeof _0x4837ca['limit']===_0x2095('0x2f');var _0x24e7b7=_0x59bc26[_0x2095('0x30')];var _0x594fa4=_0x314818?0x0:_0x4837ca[_0x2095('0x2e')];var _0x39ed1e=_0x314818?_0x59bc26[_0x2095('0x30')]:_0x4837ca[_0x2095('0x2e')]+_0x4837ca[_0x2095('0x31')];var _0x47c5d9;if(_0x39ed1e>=_0x24e7b7){_0x39ed1e=_0x24e7b7;_0x47c5d9=0xc8;}else{_0x47c5d9=0xce;}_0x1209f6[_0x2095('0x2b')](_0x47c5d9);return _0x1209f6[_0x2095('0x32')](_0x2095('0x33'),_0x594fa4+'-'+_0x39ed1e+'/'+_0x24e7b7)['json'](_0x59bc26);}return null;};}function patchUpdates(_0x19aa8b){return function(_0x328021){try{jsonpatch[_0x2095('0x34')](_0x328021,_0x19aa8b,!![]);}catch(_0x420286){return BPromise[_0x2095('0x35')](_0x420286);}return _0x328021['save']();};}function saveUpdates(_0x70ec6c,_0xd6e87b){return function(_0x4736dd){if(_0x4736dd){return _0x4736dd[_0x2095('0x36')](_0x70ec6c)[_0x2095('0x1e')](function(_0x1bb52b){return _0x1bb52b;});}return null;};}function removeEntity(_0x534412,_0x5b43e9){return function(_0x4fb32f){if(_0x4fb32f){return _0x4fb32f['destroy']()['then'](function(){var _0x1c9360=_0x4fb32f[_0x2095('0x37')]({'plain':!![]});var _0x5af75c=_0x2095('0x38');return db['UserProfileResource'][_0x2095('0x39')]({'where':{'type':_0x5af75c,'resourceId':_0x1c9360['id']}})[_0x2095('0x1e')](function(){return _0x4fb32f;});})['then'](function(){_0x534412[_0x2095('0x2b')](0xcc)[_0x2095('0x2c')]();});}};}function handleEntityNotFound(_0x1152aa,_0xa31714){return function(_0x23a491){if(!_0x23a491){_0x1152aa[_0x2095('0x2a')](0x194);}return _0x23a491;};}function handleError(_0x2b3a15,_0xad3fca){_0xad3fca=_0xad3fca||0x1f4;return function(_0x5becc8){logger[_0x2095('0x25')](_0x5becc8[_0x2095('0x3a')]);if(_0x5becc8[_0x2095('0x3b')]){delete _0x5becc8['name'];}_0x2b3a15[_0x2095('0x2b')](_0xad3fca)['send'](_0x5becc8);};}exports[_0x2095('0x3c')]=function(_0xa0b7d6,_0x2ad5be){var _0x2fc614={'include':[{'model':db['Pause'],'as':_0x2095('0x3d')}]},_0x246f0a={},_0x3a029a={'count':0x0,'rows':[]};var _0x13ce16=_[_0x2095('0x3e')](db[_0x2095('0x3f')][_0x2095('0x40')],function(_0x205355){return{'name':_0x205355[_0x2095('0x41')],'type':_0x205355[_0x2095('0x42')][_0x2095('0x43')]};});_0x246f0a['model']=_['map'](_0x13ce16,_0x2095('0x3b'));_0x246f0a[_0x2095('0x44')]=_[_0x2095('0x45')](_0xa0b7d6[_0x2095('0x44')]);_0x246f0a[_0x2095('0x46')]=_['intersection'](_0x246f0a[_0x2095('0x47')],_0x246f0a[_0x2095('0x44')]);_0x2fc614[_0x2095('0x48')]=_[_0x2095('0x49')](_0x246f0a['model'],qs[_0x2095('0x4a')](_0xa0b7d6['query'][_0x2095('0x4a')]));_0x2fc614[_0x2095('0x48')]=_0x2fc614['attributes']['length']?_0x2fc614[_0x2095('0x48')]:_0x246f0a[_0x2095('0x47')];if(!_0xa0b7d6[_0x2095('0x44')][_0x2095('0x4b')](_0x2095('0x4c'))){_0x2fc614['limit']=qs[_0x2095('0x31')](_0xa0b7d6[_0x2095('0x44')][_0x2095('0x31')]);_0x2fc614[_0x2095('0x2e')]=qs[_0x2095('0x2e')](_0xa0b7d6[_0x2095('0x44')][_0x2095('0x2e')]);}_0x2fc614[_0x2095('0x4d')]=qs['sort'](_0xa0b7d6[_0x2095('0x44')][_0x2095('0x4e')]);_0x2fc614[_0x2095('0x4f')]=qs[_0x2095('0x46')](_[_0x2095('0x50')](_0xa0b7d6[_0x2095('0x44')],_0x246f0a[_0x2095('0x46')]),_0x13ce16);if(_0xa0b7d6[_0x2095('0x44')]['filter']){_0x2fc614[_0x2095('0x4f')]=_['merge'](_0x2fc614[_0x2095('0x4f')],{'$or':_['map'](_0x13ce16,function(_0x2d7173){if(_0x2d7173['type']!=='VIRTUAL'){var _0x43bfe5={};_0x43bfe5[_0x2d7173['name']]={'$like':'%'+_0xa0b7d6['query'][_0x2095('0x51')]+'%'};return _0x43bfe5;}})});}_0x2fc614=_[_0x2095('0x52')]({},_0x2fc614,_0xa0b7d6[_0x2095('0x53')]);var _0x5f26fe={'where':_0x2fc614[_0x2095('0x4f')]};return db[_0x2095('0x3f')][_0x2095('0x30')](_0x5f26fe)[_0x2095('0x1e')](function(_0x2d6b6e){_0x3a029a['count']=_0x2d6b6e;if(_0xa0b7d6[_0x2095('0x44')][_0x2095('0x54')]){_0x2fc614[_0x2095('0x55')]=[{'all':!![]}];}return db[_0x2095('0x3f')][_0x2095('0x56')](_0x2fc614);})['then'](function(_0x10c7b9){_0x3a029a[_0x2095('0x57')]=_0x10c7b9;return _0x3a029a;})[_0x2095('0x1e')](respondWithFilteredResult(_0x2ad5be,_0x2fc614))[_0x2095('0x29')](handleError(_0x2ad5be,null));};exports[_0x2095('0x58')]=function(_0x577273,_0x3b8aed){var _0x324ace={'raw':![],'where':{'id':_0x577273[_0x2095('0x59')]['id']},'include':[{'model':db[_0x2095('0x5a')],'as':_0x2095('0x3d')}]},_0x5d90de={};_0x5d90de[_0x2095('0x47')]=_[_0x2095('0x45')](db[_0x2095('0x3f')][_0x2095('0x40')]);_0x5d90de[_0x2095('0x44')]=_[_0x2095('0x45')](_0x577273[_0x2095('0x44')]);_0x5d90de[_0x2095('0x46')]=_['intersection'](_0x5d90de['model'],_0x5d90de[_0x2095('0x44')]);_0x324ace[_0x2095('0x48')]=_[_0x2095('0x49')](_0x5d90de[_0x2095('0x47')],qs[_0x2095('0x4a')](_0x577273[_0x2095('0x44')]['fields']));_0x324ace[_0x2095('0x48')]=_0x324ace[_0x2095('0x48')]['length']?_0x324ace['attributes']:_0x5d90de[_0x2095('0x47')];if(_0x577273['query'][_0x2095('0x54')]){_0x324ace[_0x2095('0x55')]=[{'all':!![]}];}_0x324ace=_['merge']({},_0x324ace,_0x577273['options']);return db[_0x2095('0x3f')][_0x2095('0x5b')](_0x324ace)['then'](handleEntityNotFound(_0x3b8aed,null))['then'](respondWithResult(_0x3b8aed,null))['catch'](handleError(_0x3b8aed,null));};exports['create']=function(_0xcf7734,_0x32abbb){return db[_0x2095('0x3f')]['create'](_0xcf7734[_0x2095('0x5c')],{})[_0x2095('0x1e')](function(_0x57762d){var _0x1127bc=_0xcf7734['user'][_0x2095('0x37')]({'plain':!![]});if(!_0x1127bc)throw new Error(_0x2095('0x5d'));if(_0x1127bc[_0x2095('0x5e')]==='user'){var _0x60ca5d=_0x57762d[_0x2095('0x37')]({'plain':!![]});var _0x119d03=_0x2095('0x38');return db['UserProfileSection'][_0x2095('0x5b')]({'where':{'name':_0x119d03,'userProfileId':_0x1127bc[_0x2095('0x5f')]},'raw':!![]})[_0x2095('0x1e')](function(_0x326ee6){if(_0x326ee6&&_0x326ee6[_0x2095('0x60')]===0x0){return db[_0x2095('0x61')][_0x2095('0x62')]({'name':_0x60ca5d['name'],'resourceId':_0x60ca5d['id'],'type':_0x326ee6[_0x2095('0x3b')],'sectionId':_0x326ee6['id']},{})[_0x2095('0x1e')](function(){return _0x57762d;});}else{return _0x57762d;}})['catch'](function(_0x2a23aa){logger[_0x2095('0x25')](_0x2095('0x63'),_0x2a23aa);throw _0x2a23aa;});}return _0x57762d;})[_0x2095('0x1e')](respondWithResult(_0x32abbb,0xc9))[_0x2095('0x29')](handleError(_0x32abbb,null));};exports['update']=function(_0x421bc7,_0x4be34e){if(_0x421bc7[_0x2095('0x5c')]['id']){delete _0x421bc7[_0x2095('0x5c')]['id'];}return db[_0x2095('0x3f')][_0x2095('0x5b')]({'where':{'id':_0x421bc7[_0x2095('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0x2095('0x3d')}]})[_0x2095('0x1e')](handleEntityNotFound(_0x4be34e,null))[_0x2095('0x1e')](saveUpdates(_0x421bc7[_0x2095('0x5c')],null))[_0x2095('0x1e')](respondWithResult(_0x4be34e,null))['catch'](handleError(_0x4be34e,null));};exports['destroy']=function(_0x10f77c,_0x3d6e97){return db[_0x2095('0x3f')][_0x2095('0x5b')]({'where':{'id':_0x10f77c[_0x2095('0x59')]['id']}})[_0x2095('0x1e')](handleEntityNotFound(_0x3d6e97,null))[_0x2095('0x1e')](removeEntity(_0x3d6e97,null))[_0x2095('0x29')](handleError(_0x3d6e97,null));};exports[_0x2095('0x64')]=function(_0x1f6316,_0x841ea5){return db[_0x2095('0x3f')][_0x2095('0x64')]()['then'](respondWithResult(_0x841ea5,null))[_0x2095('0x29')](handleError(_0x841ea5,null));};exports['addDisposition']=function(_0xab6ace,_0x1c64dc,_0x3e6684){if(_0xab6ace[_0x2095('0x5c')]['id']){delete _0xab6ace[_0x2095('0x5c')]['id'];}return db[_0x2095('0x3f')][_0x2095('0x5b')]({'where':{'id':_0xab6ace[_0x2095('0x59')]['id']}})['then'](handleEntityNotFound(_0x1c64dc,null))[_0x2095('0x1e')](function(_0x3625cd){if(_0x3625cd){_0xab6ace[_0x2095('0x5c')]['FaxAccountId']=_0x3625cd['id'];return db[_0x2095('0x65')][_0x2095('0x62')](_0xab6ace[_0x2095('0x5c')]);}})[_0x2095('0x1e')](respondWithResult(_0x1c64dc,null))[_0x2095('0x29')](handleError(_0x1c64dc,null));};exports[_0x2095('0x66')]=function(_0x38f165,_0x1298d8,_0x14fcc0){var _0x41fef6={'raw':![],'where':{}};var _0x1636dc={};var _0x28cba8={'count':0x0,'rows':[]};return db[_0x2095('0x3f')][_0x2095('0x67')]({'where':{'id':_0x38f165[_0x2095('0x59')]['id']}})[_0x2095('0x1e')](handleEntityNotFound(_0x1298d8,null))[_0x2095('0x1e')](function(_0x1bbe94){if(_0x1bbe94){_0x1636dc['model']=_[_0x2095('0x45')](db['Disposition'][_0x2095('0x40')]);_0x1636dc['query']=_[_0x2095('0x45')](_0x38f165[_0x2095('0x44')]);_0x1636dc[_0x2095('0x46')]=_[_0x2095('0x49')](_0x1636dc[_0x2095('0x47')],_0x1636dc['query']);_0x41fef6[_0x2095('0x48')]=_['intersection'](_0x1636dc[_0x2095('0x47')],qs[_0x2095('0x4a')](_0x38f165[_0x2095('0x44')][_0x2095('0x4a')]));_0x41fef6['attributes']=_0x41fef6[_0x2095('0x48')]['length']?_0x41fef6[_0x2095('0x48')]:_0x1636dc[_0x2095('0x47')];if(!_0x38f165[_0x2095('0x44')][_0x2095('0x4b')]('nolimit')){_0x41fef6['limit']=qs['limit'](_0x38f165['query'][_0x2095('0x31')]);_0x41fef6['offset']=qs['offset'](_0x38f165[_0x2095('0x44')]['offset']);}_0x41fef6[_0x2095('0x4d')]=qs[_0x2095('0x4e')](_0x38f165[_0x2095('0x44')][_0x2095('0x4e')]);_0x41fef6[_0x2095('0x4f')]=qs[_0x2095('0x46')](_['pick'](_0x38f165[_0x2095('0x44')],_0x1636dc[_0x2095('0x46')]));_0x41fef6['where']['FaxAccountId']=_0x1bbe94['id'];if(_0x38f165[_0x2095('0x44')][_0x2095('0x51')]){_0x41fef6[_0x2095('0x4f')]=_['merge'](_0x41fef6[_0x2095('0x4f')],{'$or':_[_0x2095('0x3e')](_0x41fef6[_0x2095('0x48')],function(_0x183537){var _0x262f7c={};_0x262f7c[_0x183537]={'$like':'%'+_0x38f165[_0x2095('0x44')][_0x2095('0x51')]+'%'};return _0x262f7c;})});}_0x41fef6=_[_0x2095('0x52')]({},_0x41fef6,_0x38f165[_0x2095('0x53')]);return db[_0x2095('0x65')][_0x2095('0x30')]({'where':_0x41fef6[_0x2095('0x4f')]})[_0x2095('0x1e')](function(_0x541125){_0x28cba8[_0x2095('0x30')]=_0x541125;if(_0x38f165['query'][_0x2095('0x54')]){_0x41fef6['include']=[{'all':!![]}];}return db[_0x2095('0x65')][_0x2095('0x56')](_0x41fef6);})[_0x2095('0x1e')](function(_0x5bd018){_0x28cba8[_0x2095('0x57')]=_0x5bd018;return _0x28cba8;});}})[_0x2095('0x1e')](respondWithFilteredResult(_0x1298d8,_0x41fef6))[_0x2095('0x29')](handleError(_0x1298d8,null));};exports[_0x2095('0x68')]=function(_0x242e4b,_0x765239,_0x134254){return db[_0x2095('0x3f')][_0x2095('0x5b')]({'where':{'id':_0x242e4b['params']['id']}})[_0x2095('0x1e')](handleEntityNotFound(_0x765239,null))[_0x2095('0x1e')](function(_0x1568db){if(_0x1568db){return _0x1568db['removeDispositions'](_0x242e4b['query']['ids']);}})[_0x2095('0x1e')](respondWithStatusCode(_0x765239,null))[_0x2095('0x29')](handleError(_0x765239,null));};exports[_0x2095('0x69')]=function(_0x5cbc69,_0x3b02ea,_0x10cdf8){if(_0x5cbc69['body']['id']){delete _0x5cbc69[_0x2095('0x5c')]['id'];}return db[_0x2095('0x3f')][_0x2095('0x5b')]({'where':{'id':_0x5cbc69[_0x2095('0x59')]['id']}})[_0x2095('0x1e')](handleEntityNotFound(_0x3b02ea,null))[_0x2095('0x1e')](function(_0x5cfbee){if(_0x5cfbee){_0x5cbc69[_0x2095('0x5c')]['FaxAccountId']=_0x5cfbee['id'];return db[_0x2095('0x6a')][_0x2095('0x62')](_0x5cbc69[_0x2095('0x5c')]);}})[_0x2095('0x1e')](respondWithResult(_0x3b02ea,null))[_0x2095('0x29')](handleError(_0x3b02ea,null));};exports[_0x2095('0x6b')]=function(_0x3d5e67,_0x26031f,_0x5a55b1){var _0x336a4e={'raw':![],'where':{}};var _0x2a6eea={};var _0x1c7d5e={'count':0x0,'rows':[]};return db[_0x2095('0x3f')][_0x2095('0x67')]({'where':{'id':_0x3d5e67[_0x2095('0x59')]['id']}})[_0x2095('0x1e')](handleEntityNotFound(_0x26031f,null))[_0x2095('0x1e')](function(_0x5c7f07){if(_0x5c7f07){_0x2a6eea[_0x2095('0x47')]=_[_0x2095('0x45')](db[_0x2095('0x6a')]['rawAttributes']);_0x2a6eea['query']=_[_0x2095('0x45')](_0x3d5e67['query']);_0x2a6eea[_0x2095('0x46')]=_[_0x2095('0x49')](_0x2a6eea[_0x2095('0x47')],_0x2a6eea[_0x2095('0x44')]);_0x336a4e[_0x2095('0x48')]=_[_0x2095('0x49')](_0x2a6eea['model'],qs[_0x2095('0x4a')](_0x3d5e67[_0x2095('0x44')][_0x2095('0x4a')]));_0x336a4e[_0x2095('0x48')]=_0x336a4e['attributes'][_0x2095('0x6c')]?_0x336a4e['attributes']:_0x2a6eea[_0x2095('0x47')];if(!_0x3d5e67['query'][_0x2095('0x4b')](_0x2095('0x4c'))){_0x336a4e[_0x2095('0x31')]=qs[_0x2095('0x31')](_0x3d5e67[_0x2095('0x44')][_0x2095('0x31')]);_0x336a4e[_0x2095('0x2e')]=qs['offset'](_0x3d5e67[_0x2095('0x44')][_0x2095('0x2e')]);}_0x336a4e[_0x2095('0x4d')]=qs[_0x2095('0x4e')](_0x3d5e67[_0x2095('0x44')]['sort']);_0x336a4e[_0x2095('0x4f')]=qs[_0x2095('0x46')](_[_0x2095('0x50')](_0x3d5e67['query'],_0x2a6eea[_0x2095('0x46')]));_0x336a4e[_0x2095('0x4f')][_0x2095('0x6d')]=_0x5c7f07['id'];if(_0x3d5e67[_0x2095('0x44')]['filter']){_0x336a4e[_0x2095('0x4f')]=_[_0x2095('0x52')](_0x336a4e[_0x2095('0x4f')],{'$or':_['map'](_0x336a4e['attributes'],function(_0xca437e){var _0x1e99d1={};_0x1e99d1[_0xca437e]={'$like':'%'+_0x3d5e67[_0x2095('0x44')]['filter']+'%'};return _0x1e99d1;})});}_0x336a4e=_[_0x2095('0x52')]({},_0x336a4e,_0x3d5e67['options']);return db[_0x2095('0x6a')][_0x2095('0x30')]({'where':_0x336a4e[_0x2095('0x4f')]})['then'](function(_0x35e0ae){_0x1c7d5e['count']=_0x35e0ae;if(_0x3d5e67[_0x2095('0x44')][_0x2095('0x54')]){_0x336a4e[_0x2095('0x55')]=[{'all':!![]}];}return db[_0x2095('0x6a')][_0x2095('0x56')](_0x336a4e);})[_0x2095('0x1e')](function(_0x410538){_0x1c7d5e['rows']=_0x410538;return _0x1c7d5e;});}})[_0x2095('0x1e')](respondWithFilteredResult(_0x26031f,_0x336a4e))[_0x2095('0x29')](handleError(_0x26031f,null));};exports[_0x2095('0x6e')]=function(_0x37a76b,_0x521080,_0x43928f){return db[_0x2095('0x3f')][_0x2095('0x5b')]({'where':{'id':_0x37a76b['params']['id']}})[_0x2095('0x1e')](handleEntityNotFound(_0x521080,null))[_0x2095('0x1e')](function(_0xc84865){if(_0xc84865){return _0xc84865[_0x2095('0x6e')](_0x37a76b[_0x2095('0x44')][_0x2095('0x6f')]);}})['then'](respondWithStatusCode(_0x521080,null))[_0x2095('0x29')](handleError(_0x521080,null));};exports[_0x2095('0x70')]=function(_0x1f434d,_0x6883c2,_0x433ff0){return db[_0x2095('0x71')][_0x2095('0x5b')]({'where':{'id':_0x1f434d[_0x2095('0x59')]['id']}})[_0x2095('0x1e')](handleEntityNotFound(_0x6883c2,null))[_0x2095('0x1e')](function(_0x2a8a6e){if(_0x2a8a6e){return _0x2a8a6e[_0x2095('0x70')](_0x1f434d[_0x2095('0x5c')][_0x2095('0x6f')],_[_0x2095('0x72')](_0x1f434d[_0x2095('0x5c')],[_0x2095('0x6f'),'id'])||{});}})[_0x2095('0x1e')](respondWithResult(_0x6883c2,null))[_0x2095('0x29')](handleError(_0x6883c2,null));};exports[_0x2095('0x73')]=function(_0x56868c,_0x357133,_0x34ae8f){var _0x538048={'raw':![],'where':{}};var _0x48fd30={};var _0x17d87b={'count':0x0,'rows':[]};return db[_0x2095('0x3f')][_0x2095('0x67')]({'where':{'id':_0x56868c['params']['id']}})[_0x2095('0x1e')](handleEntityNotFound(_0x357133,null))[_0x2095('0x1e')](function(_0x3c0ba0){if(_0x3c0ba0){_0x48fd30[_0x2095('0x47')]=_['keys'](db['FaxInteraction'][_0x2095('0x40')]);_0x48fd30[_0x2095('0x44')]=_['keys'](_0x56868c[_0x2095('0x44')]);_0x48fd30[_0x2095('0x46')]=_[_0x2095('0x49')](_0x48fd30['model'],_0x48fd30['query']);_0x538048['attributes']=_[_0x2095('0x49')](_0x48fd30['model'],qs['fields'](_0x56868c[_0x2095('0x44')][_0x2095('0x4a')]));_0x538048[_0x2095('0x48')]=_0x538048[_0x2095('0x48')][_0x2095('0x6c')]?_0x538048[_0x2095('0x48')]:_0x48fd30[_0x2095('0x47')];if(!_0x56868c[_0x2095('0x44')][_0x2095('0x4b')](_0x2095('0x4c'))){_0x538048[_0x2095('0x31')]=qs['limit'](_0x56868c[_0x2095('0x44')]['limit']);_0x538048[_0x2095('0x2e')]=qs[_0x2095('0x2e')](_0x56868c[_0x2095('0x44')][_0x2095('0x2e')]);}_0x538048[_0x2095('0x4d')]=qs['sort'](_0x56868c[_0x2095('0x44')]['sort']);_0x538048[_0x2095('0x4f')]=qs[_0x2095('0x46')](_[_0x2095('0x50')](_0x56868c['query'],_0x48fd30[_0x2095('0x46')]));_0x538048[_0x2095('0x4f')][_0x2095('0x6d')]=_0x3c0ba0['id'];if(_0x56868c[_0x2095('0x44')][_0x2095('0x51')]){_0x538048[_0x2095('0x4f')]=_[_0x2095('0x52')](_0x538048[_0x2095('0x4f')],{'$or':_[_0x2095('0x3e')](_0x538048[_0x2095('0x48')],function(_0x3f3fea){var _0x3af6f2={};_0x3af6f2[_0x3f3fea]={'$like':'%'+_0x56868c['query'][_0x2095('0x51')]+'%'};return _0x3af6f2;})});}_0x538048=_[_0x2095('0x52')]({},_0x538048,_0x56868c[_0x2095('0x53')]);return db[_0x2095('0x71')][_0x2095('0x30')]({'where':_0x538048[_0x2095('0x4f')]})[_0x2095('0x1e')](function(_0x153fb0){_0x17d87b[_0x2095('0x30')]=_0x153fb0;if(_0x56868c[_0x2095('0x44')][_0x2095('0x54')]){_0x538048[_0x2095('0x55')]=[{'model':db['CmContact'],'as':_0x2095('0x74'),'required':![]},{'model':db[_0x2095('0x75')],'as':_0x2095('0x76'),'attributes':['name','fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0x2095('0x77'),'attributes':['id',_0x2095('0x3b'),_0x2095('0x78')],'where':_0x56868c[_0x2095('0x44')][_0x2095('0x79')]?{'id':_0x56868c['query'][_0x2095('0x79')]}:undefined,'required':_0x56868c[_0x2095('0x44')]['tag']?!![]:![]}];}return db[_0x2095('0x71')]['findAll'](_0x538048);})['then'](function(_0x23c465){_0x17d87b[_0x2095('0x57')]=_0x23c465;return _0x17d87b;});}})[_0x2095('0x1e')](respondWithFilteredResult(_0x357133,_0x538048))[_0x2095('0x29')](handleError(_0x357133,null));};exports[_0x2095('0x7a')]=function(_0x379bc5,_0x41825c){var _0x29fd9b=_0x379bc5['params']['id'];var _0x444f79=_0x379bc5['body'];var _0x4bc129=0xc8;var _0x1cfa75=null;return db[_0x2095('0x7b')][_0x2095('0x7c')]({'isolationLevel':db[_0x2095('0x7b')]['Transaction'][_0x2095('0x7d')][_0x2095('0x7e')]},function(_0x359f87){return db[_0x2095('0x3f')][_0x2095('0x67')]({'where':{'id':_0x29fd9b},'transaction':_0x359f87})[_0x2095('0x1e')](function(_0x559800){if(_0x559800){return db[_0x2095('0x7f')]['destroy']({'where':{'FaxAccountId':_0x29fd9b},'transaction':_0x359f87})['then'](function(){var _0x12b4d2=_[_0x2095('0x3e')](_0x444f79,function(_0x200b0e){_0x200b0e[_0x2095('0x6d')]=_0x29fd9b;return _0x200b0e;});return db[_0x2095('0x7f')][_0x2095('0x80')](_0x12b4d2,{'transaction':_0x359f87});});}else{_0x4bc129=0x194;_0x1cfa75=[];}});})[_0x2095('0x1e')](function(){if(_0x4bc129!==0x194){return db['FaxApplication'][_0x2095('0x81')]({'where':{'FaxAccountId':_0x29fd9b},'order':_0x2095('0x82')})[_0x2095('0x1e')](function(_0x9fe5c6){_0x1cfa75=_0x9fe5c6;});}})[_0x2095('0x29')](function(_0x593de3){_0x4bc129=0x1f4;logger['error'](_0x593de3[_0x2095('0x3a')]);if(_0x593de3['name']){delete _0x593de3[_0x2095('0x3b')];}_0x1cfa75=_0x593de3;})['finally'](function(){if(_0x1cfa75===null){_0x41825c[_0x2095('0x2a')](_0x4bc129);}else{if(_0x4bc129===0x1f4){_0x41825c['status'](_0x4bc129)['send'](_0x1cfa75);}else{_0x41825c['status'](_0x4bc129)['json'](_0x1cfa75);}}});};exports[_0x2095('0x83')]=function(_0xe2630b,_0x46b9dd,_0x1dfc9e){var _0x4302a4={};var _0x20f4c1={};var _0x53dde8;var _0x5007fb;return db[_0x2095('0x3f')]['findOne']({'where':{'id':_0xe2630b[_0x2095('0x59')]['id']}})['then'](handleEntityNotFound(_0x46b9dd,null))[_0x2095('0x1e')](function(_0x2fe47c){if(_0x2fe47c){_0x53dde8=_0x2fe47c;_0x20f4c1[_0x2095('0x47')]=_['keys'](db[_0x2095('0x7f')][_0x2095('0x40')]);_0x20f4c1['query']=_[_0x2095('0x45')](_0xe2630b[_0x2095('0x44')]);_0x20f4c1['filters']=_[_0x2095('0x49')](_0x20f4c1[_0x2095('0x47')],_0x20f4c1[_0x2095('0x44')]);_0x4302a4[_0x2095('0x48')]=_['intersection'](_0x20f4c1[_0x2095('0x47')],qs['fields'](_0xe2630b[_0x2095('0x44')]['fields']));_0x4302a4[_0x2095('0x48')]=_0x4302a4[_0x2095('0x48')][_0x2095('0x6c')]?_0x4302a4['attributes']:_0x20f4c1[_0x2095('0x47')];_0x4302a4['order']=qs[_0x2095('0x4e')](_0xe2630b[_0x2095('0x44')][_0x2095('0x4e')]);_0x4302a4[_0x2095('0x4f')]=qs[_0x2095('0x46')](_['pick'](_0xe2630b[_0x2095('0x44')],_0x20f4c1[_0x2095('0x46')]));if(_0xe2630b[_0x2095('0x44')]['filter']){_0x4302a4[_0x2095('0x4f')]=_[_0x2095('0x52')](_0x4302a4[_0x2095('0x4f')],{'$or':_[_0x2095('0x3e')](_0x4302a4[_0x2095('0x48')],function(_0x590414){var _0x3447fe={};_0x3447fe[_0x590414]={'$like':'%'+_0xe2630b['query'][_0x2095('0x51')]+'%'};return _0x3447fe;})});}_0x4302a4=_[_0x2095('0x52')]({},_0x4302a4,_0xe2630b[_0x2095('0x53')]);return _0x53dde8[_0x2095('0x83')](_0x4302a4);}})[_0x2095('0x1e')](function(_0x1345ee){if(_0x1345ee){_0x5007fb=_0x1345ee[_0x2095('0x6c')];if(!_0xe2630b['query'][_0x2095('0x4b')](_0x2095('0x4c'))){_0x4302a4[_0x2095('0x31')]=qs[_0x2095('0x31')](_0xe2630b[_0x2095('0x44')][_0x2095('0x31')]);_0x4302a4[_0x2095('0x2e')]=qs['offset'](_0xe2630b[_0x2095('0x44')][_0x2095('0x2e')]);}return _0x53dde8['getApplications'](_0x4302a4);}})[_0x2095('0x1e')](function(_0x456270){if(_0x456270){return _0x456270?{'count':_0x5007fb,'rows':_0x456270}:null;}})[_0x2095('0x1e')](respondWithResult(_0x46b9dd,null))[_0x2095('0x29')](handleError(_0x46b9dd,null));};function Extension(_0x5150b6,_0x4b48bf,_0x52b80d,_0x42a015){this['context']=_0x2095('0x84');this[_0x2095('0x85')]=_0x5150b6[_0x2095('0x86')];this[_0x2095('0x87')]=_0x42a015;this[_0x2095('0x42')]=_0x2095('0x88');this['description']=_0x2095('0x89');this[_0x2095('0x6d')]=_0x5150b6['id'];this[_0x2095('0x82')]=_0x4b48bf;this[_0x2095('0x8a')]=_0x52b80d;}function createExtensionsReciveFax(_0x2c3eb1){var _0xedb780=0x1;var _0x16c072=[];_0x16c072[_0x2095('0x8b')](new Extension(_0x2c3eb1,_0xedb780,'',_0x2095('0x8c')));_0xedb780+=0x1;_0x16c072['push'](new Extension(_0x2c3eb1,_0xedb780,_0x2095('0x8d'),'Set'));_0xedb780+=0x1;for(var _0xaf3f6a in _0x2c3eb1){if(_0x2c3eb1['hasOwnProperty'](_0xaf3f6a)&&(_0xaf3f6a===_0x2095('0x8e')||_0xaf3f6a===_0x2095('0x86')||_0xaf3f6a===_0x2095('0x8f')||_0xaf3f6a===_0x2095('0x90')||_0xaf3f6a==='headerinfo'||_0xaf3f6a===_0x2095('0x91')||_0xaf3f6a===_0x2095('0x92')||_0xaf3f6a===_0x2095('0x93')||_0xaf3f6a===_0x2095('0x94'))){_0x16c072['push'](new Extension(_0x2c3eb1,_0xedb780,_0x2095('0x95')+_0xaf3f6a+')='+_0x2c3eb1[_0xaf3f6a],_0x2095('0x96')));_0xedb780+=0x1;}}_0x16c072[_0x2095('0x8b')](new Extension(_0x2c3eb1,_0xedb780,'6',_0x2095('0x97')));_0xedb780+=0x1;_0x16c072[_0x2095('0x8b')](new Extension(_0x2c3eb1,_0xedb780,_0x2095('0x98'),_0x2095('0x99')));_0xedb780=0x0;return _0x16c072;}exports['addAccountApplications']=function(_0xdc98b4,_0x5a9ab2,_0x3d4eef){var _0x4f84cf;return db[_0x2095('0x7b')][_0x2095('0x7c')](function(_0x332032){return db[_0x2095('0x3f')][_0x2095('0x62')](_0xdc98b4['body'],{'transaction':_0x332032})[_0x2095('0x1e')](function(_0xd888c7){_0x4f84cf=_0xd888c7[_0x2095('0x37')]({'plain':!![]});return db[_0x2095('0x9a')][_0x2095('0x80')](createExtensionsReciveFax(_0x4f84cf),{'transaction':_0x332032});});})['then'](function(){return _0x4f84cf;})[_0x2095('0x1e')](respondWithResult(_0x5a9ab2,null))[_0x2095('0x29')](handleError(_0x5a9ab2,null));};exports[_0x2095('0x9b')]=function(_0x15a254,_0x5c0533,_0xeb007c){var _0x420767;return db[_0x2095('0x7b')][_0x2095('0x7c')](function(_0x308262){return db[_0x2095('0x3f')][_0x2095('0x36')](_0x15a254[_0x2095('0x5c')],{'where':{'id':_0x15a254[_0x2095('0x5c')]['id']},'transaction':_0x308262})['then'](function(_0x3fe611){return db[_0x2095('0x9a')][_0x2095('0x39')]({'where':{'FaxAccountId':_0x15a254[_0x2095('0x5c')]['id']},'transaction':_0x308262})[_0x2095('0x1e')](function(_0x4ec373){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_[_0x2095('0x72')](_0x15a254[_0x2095('0x5c')],[_0x2095('0x9c'),'key',_0x2095('0x9d'),_0x2095('0x9e'),'TrunkId',_0x2095('0x9f')])),{'transaction':_0x308262});});});})[_0x2095('0x1e')](function(){return db[_0x2095('0x3f')][_0x2095('0xa0')](_0x15a254['body']['id']);})[_0x2095('0x1e')](respondWithResult(_0x5c0533,null))[_0x2095('0x29')](handleError(_0x5c0533,null));};exports[_0x2095('0xa1')]=function(_0x482b8c,_0x50b4d7,_0x1105ce){var _0x39dc00={'raw':!![],'where':{}};var _0xa4384a={};var _0x1dc88b={'count':0x0,'rows':[]};return db[_0x2095('0x3f')][_0x2095('0x67')]({'where':{'id':_0x482b8c[_0x2095('0x59')]['id']}})[_0x2095('0x1e')](handleEntityNotFound(_0x50b4d7,null))[_0x2095('0x1e')](function(_0x48b005){if(_0x48b005){_0xa4384a['model']=_['keys'](db[_0x2095('0xa2')][_0x2095('0x40')]);_0xa4384a[_0x2095('0x44')]=_[_0x2095('0x45')](_0x482b8c[_0x2095('0x44')]);_0xa4384a[_0x2095('0x46')]=_['intersection'](_0xa4384a[_0x2095('0x47')],_0xa4384a[_0x2095('0x44')]);_0x39dc00[_0x2095('0x48')]=_[_0x2095('0x49')](_0xa4384a[_0x2095('0x47')],qs[_0x2095('0x4a')](_0x482b8c['query'][_0x2095('0x4a')]));_0x39dc00[_0x2095('0x48')]=_0x39dc00[_0x2095('0x48')][_0x2095('0x6c')]?_0x39dc00[_0x2095('0x48')]:_0xa4384a[_0x2095('0x47')];if(!_0x482b8c['query'][_0x2095('0x4b')]('nolimit')){_0x39dc00[_0x2095('0x31')]=qs[_0x2095('0x31')](_0x482b8c[_0x2095('0x44')][_0x2095('0x31')]);_0x39dc00['offset']=qs[_0x2095('0x2e')](_0x482b8c[_0x2095('0x44')][_0x2095('0x2e')]);}_0x39dc00['order']=qs['sort'](_0x482b8c[_0x2095('0x44')][_0x2095('0x4e')]);_0x39dc00[_0x2095('0x4f')]=qs[_0x2095('0x46')](_[_0x2095('0x50')](_0x482b8c[_0x2095('0x44')],_0xa4384a[_0x2095('0x46')]));_0x39dc00[_0x2095('0x4f')]['FaxAccountId']=_0x48b005['id'];if(_0x482b8c[_0x2095('0x44')][_0x2095('0x51')]){_0x39dc00[_0x2095('0x4f')]=_[_0x2095('0x52')](_0x39dc00['where'],{'$or':_[_0x2095('0x3e')](_0x39dc00[_0x2095('0x48')],function(_0x3aa590){var _0x24323d={};_0x24323d[_0x3aa590]={'$like':'%'+_0x482b8c['query'][_0x2095('0x51')]+'%'};return _0x24323d;})});}if(_0x482b8c['query'][_0x2095('0xa3')]){var _0xe071f8=_0x482b8c[_0x2095('0x44')][_0x2095('0xa3')]['split'](',');var _0x35580e={};_0x35580e[_0xe071f8[0x0]]={'$gte':moment(_0xe071f8[0x1])['format'](_0x2095('0xa4'))};_0x39dc00[_0x2095('0x4f')]=_[_0x2095('0x52')](_0x39dc00['where'],_0x35580e);}_0x39dc00=_[_0x2095('0x52')]({},_0x39dc00,_0x482b8c[_0x2095('0x53')]);return db[_0x2095('0xa2')][_0x2095('0x30')]({'where':_0x39dc00[_0x2095('0x4f')]})[_0x2095('0x1e')](function(_0x2719ba){_0x1dc88b[_0x2095('0x30')]=_0x2719ba;if(_0x482b8c[_0x2095('0x44')]['includeAll']){_0x39dc00[_0x2095('0x55')]=[{'all':!![]}];}return db['FaxMessage'][_0x2095('0x56')](_0x39dc00);})[_0x2095('0x1e')](function(_0x2224dd){_0x1dc88b['rows']=_0x2224dd;return _0x1dc88b;});}})['then'](respondWithFilteredResult(_0x50b4d7,_0x39dc00))['catch'](handleError(_0x50b4d7,null));};exports[_0x2095('0xa5')]=function(_0x3b3899,_0x277b7f,_0x58d01){var _0x3b04a5,_0x302d76={},_0x3c3685;if(_0x3b3899[_0x2095('0x5c')]['to']){_0x3c3685=_0x3b3899[_0x2095('0x5c')]['to'][0x0];}return db[_0x2095('0x3f')][_0x2095('0x5b')]({'where':{'id':_0x3b3899['params']['id']},'include':[{'model':db['CmList'],'as':_0x2095('0xa6'),'include':[{'model':db['CmContact'],'as':_0x2095('0xa7'),'where':{'fax':_0x3c3685},'limit':0x1,'order':[[_0x2095('0x9e'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x277b7f,null))['then'](function(_0xd68f2c){_0x3b04a5=_0xd68f2c;if(_0x3b3899['body'][_0x2095('0xa8')]&&_0x3b3899['body'][_0x2095('0xa8')][_0x2095('0x6c')]){for(var _0x24a21=0x0;_0x24a21<_0x3b3899[_0x2095('0x5c')]['attachments']['length'];_0x24a21+=0x1){_0x3b3899[_0x2095('0x5c')]['attachments'][_0x24a21]={'filename':_0x3b3899[_0x2095('0x5c')][_0x2095('0xa8')][_0x24a21][_0x2095('0x3b')],'id':_0x3b3899['body']['attachments'][_0x24a21]['id'],'path':path[_0x2095('0xa9')](config[_0x2095('0xaa')],_0x2095('0xab'),_0x3b3899[_0x2095('0x5c')][_0x2095('0xa8')][_0x24a21][_0x2095('0xac')])};}}return respondWithRpcPromise(_0x2095('0xad'),_0x2095('0xad'),{'FaxAccountId':_[_0x2095('0xae')](_0x3b3899['params']['id'])?undefined:_0x3b3899['params']['id'],'path':_[_0x2095('0xae')](_0x3b3899['body'][_0x2095('0xa8')][0x0][_0x2095('0x4')])?undefined:_0x3b3899[_0x2095('0x5c')][_0x2095('0xa8')][0x0]['path'],'fax':_[_0x2095('0xae')](_0x3b3899[_0x2095('0x5c')]['to'][0x0])?undefined:_0x3b3899[_0x2095('0x5c')]['to'][0x0]},client9002);})['then'](function(){if(_0x3b04a5){if(_['isNil'](_0x3b3899[_0x2095('0x5c')][_0x2095('0xaf')])){_0x3b3899[_0x2095('0x5c')][_0x2095('0xaf')]=util[_0x2095('0xb0')](_0x2095('0xb1'),_0x3b04a5[_0x2095('0x3b')],_0x3b04a5[_0x2095('0xb2')]);}if(_0x3b04a5[_0x2095('0xa6')]){if(_0x3b04a5[_0x2095('0xa6')]['Contacts'][_0x2095('0x6c')]){return _0x3b04a5[_0x2095('0xa6')]['Contacts'][0x0];}else{return db[_0x2095('0xb3')][_0x2095('0x62')](_[_0x2095('0x17')](_0x3b3899[_0x2095('0x5c')],{'firstName':_0x3b3899[_0x2095('0x5c')]['to'][0x0],'phone':_0x3b3899['body']['to'][0x0],'fax':_0x3b3899[_0x2095('0x5c')]['to'][0x0],'ListId':_0x3b04a5[_0x2095('0x9f')]}));}}else{throw new Error(_0x2095('0xb4'));}}else{throw new Error(_0x2095('0xb5'));}})['then'](function(_0x289c8a){if(_0x289c8a){return db[_0x2095('0x71')][_0x2095('0x5b')]({'where':{'ContactId':_0x289c8a['id'],'closed':![],'FaxAccountId':_0x3b04a5['id']}})[_0x2095('0x1e')](function(_0x5244c0){if(_0x5244c0){return[_0x5244c0,![]];}return db['FaxInteraction'][_0x2095('0x62')]({'UserId':_0x3b3899[_0x2095('0xb6')]['id'],'ContactId':_0x289c8a['id'],'FaxAccountId':_0x3b04a5['id'],'fax':_0x3b3899[_0x2095('0x5c')]['to'][0x0],'firstMsgDirection':_0x2095('0xb7'),'Messages':[_[_0x2095('0x52')](_0x3b3899[_0x2095('0x5c')],{'read':![],'body':_0x3b3899[_0x2095('0x5c')][_0x2095('0xa8')][0x0]['filename'],'FaxAccountId':_0x3b04a5['id'],'UserId':_0x3b3899['user']['id'],'ContactId':_0x289c8a['id'],'AttachmentId':_0x3b3899['body'][_0x2095('0xa8')][0x0]['id']})]},{'include':[{'model':db[_0x2095('0xa2')],'as':_0x2095('0xb8')}]})[_0x2095('0x1e')](function(_0x4d2b13){return[_0x4d2b13,!![]];});});}else{throw new Error(_0x2095('0xb9'));}})[_0x2095('0xba')](function(_0x50b682,_0x2810e6){if(_0x2810e6){return _0x50b682;}return db[_0x2095('0xa2')][_0x2095('0x62')]({'direction':'out','read':![],'body':_0x3b3899[_0x2095('0x5c')][_0x2095('0xa8')][0x0][_0x2095('0xbb')],'FaxAccountId':_0x3b04a5['id'],'FaxInteractionId':_0x50b682['id'],'UserId':_0x3b3899[_0x2095('0xb6')]['id'],'ContactId':_0x50b682[_0x2095('0xbc')],'AttachmentId':_0x3b3899[_0x2095('0x5c')][_0x2095('0xa8')][0x0]['id']})['then'](function(_0x45ad93){_0x50b682['dataValues'][_0x2095('0xb8')]=[];_0x50b682[_0x2095('0xbd')]['Messages'][_0x2095('0x8b')](_0x45ad93[_0x2095('0xbd')]);return _0x50b682;});})[_0x2095('0x1e')](function(_0x37a02d){respondWithRpcPromise(_0x2095('0xbe'),'SendFax',{'FaxAccountId':_[_0x2095('0xae')](_0x3b3899[_0x2095('0x59')]['id'])?undefined:_0x3b3899[_0x2095('0x59')]['id'],'path':_['isNil'](_0x3b3899[_0x2095('0x5c')][_0x2095('0xa8')][0x0][_0x2095('0x4')])?undefined:_0x3b3899[_0x2095('0x5c')]['attachments'][0x0][_0x2095('0x4')],'fax':_['isNil'](_0x3b3899[_0x2095('0x5c')]['to'][0x0])?undefined:_0x3b3899['body']['to'][0x0],'AttachmentId':_0x3b3899[_0x2095('0x5c')]['attachments'][0x0]['id']},client9002)[_0x2095('0x1e')](function(_0x5646b6){logger[_0x2095('0x1f')](_0x2095('0xbf'),_0x5646b6);})[_0x2095('0x29')](function(_0x4dc788){logger[_0x2095('0x1f')](_0x2095('0xbf'),_0x4dc788);});return _0x37a02d;})[_0x2095('0x1e')](respondWithResult(_0x277b7f,null))[_0x2095('0x29')](handleError(_0x277b7f,null));};exports['addAgents']=function(_0x5f11e9,_0x91125f,_0x552472){return db[_0x2095('0x3f')][_0x2095('0x5b')]({'where':{'id':_0x5f11e9[_0x2095('0x59')]['id']}})[_0x2095('0x1e')](handleEntityNotFound(_0x91125f,null))[_0x2095('0x1e')](function(_0x1f7cc5){if(_0x1f7cc5){return _0x1f7cc5[_0x2095('0xc0')](_0x5f11e9['body'][_0x2095('0x6f')],_[_0x2095('0x72')](_0x5f11e9[_0x2095('0x5c')],[_0x2095('0x6f'),'id'])||{})['spread'](function(_0x36bfab){for(var _0x3ae08a=0x0;_0x3ae08a<_0x5f11e9[_0x2095('0x5c')][_0x2095('0x6f')][_0x2095('0x6c')];_0x3ae08a+=0x1){socket['emit'](_0x2095('0xc1'),{'UserId':Number(_0x5f11e9[_0x2095('0x5c')][_0x2095('0x6f')][_0x3ae08a]),'FaxAccountId':Number(_0x5f11e9['params']['id'])});}return _0x36bfab;});}})[_0x2095('0x1e')](respondWithResult(_0x91125f,null))[_0x2095('0x29')](handleError(_0x91125f,null));};exports[_0x2095('0xc2')]=function(_0x5c927c,_0x359be1,_0x3262c8){return db[_0x2095('0x3f')]['find']({'where':{'id':_0x5c927c[_0x2095('0x59')]['id']}})[_0x2095('0x1e')](handleEntityNotFound(_0x359be1,null))[_0x2095('0x1e')](function(_0x59bdd9){if(_0x59bdd9){return _0x59bdd9[_0x2095('0xc2')](_0x5c927c['query'][_0x2095('0x6f')])[_0x2095('0x1e')](function(){if(_[_0x2095('0xc3')](_0x5c927c['query']['ids'])){for(var _0x2d9955=0x0;_0x2d9955<_0x5c927c[_0x2095('0x44')][_0x2095('0x6f')]['length'];_0x2d9955+=0x1){socket[_0x2095('0xc4')](_0x2095('0xc5'),{'UserId':Number(_0x5c927c['query'][_0x2095('0x6f')][_0x2d9955]),'FaxAccountId':Number(_0x5c927c[_0x2095('0x59')]['id'])});}}else{socket[_0x2095('0xc4')](_0x2095('0xc5'),{'UserId':Number(_0x5c927c['query']['ids']),'FaxAccountId':Number(_0x5c927c[_0x2095('0x59')]['id'])});}});}})[_0x2095('0x1e')](respondWithStatusCode(_0x359be1,null))[_0x2095('0x29')](handleError(_0x359be1,null));};exports[_0x2095('0xc6')]=function(_0xadddea,_0x4b1eba,_0x14d3fa){var _0xd248d5={};var _0x48ffab={};var _0x11f480;var _0x13d595;return db['FaxAccount'][_0x2095('0x67')]({'where':{'id':_0xadddea[_0x2095('0x59')]['id']}})['then'](handleEntityNotFound(_0x4b1eba,null))['then'](function(_0x452039){if(_0x452039){_0x11f480=_0x452039;_0x48ffab[_0x2095('0x47')]=_[_0x2095('0x45')](db[_0x2095('0x75')][_0x2095('0x40')]);_0x48ffab['query']=_[_0x2095('0x45')](_0xadddea[_0x2095('0x44')]);_0x48ffab[_0x2095('0x46')]=_[_0x2095('0x49')](_0x48ffab[_0x2095('0x47')],_0x48ffab[_0x2095('0x44')]);_0xd248d5['attributes']=_[_0x2095('0x49')](_0x48ffab[_0x2095('0x47')],qs[_0x2095('0x4a')](_0xadddea[_0x2095('0x44')][_0x2095('0x4a')]));_0xd248d5[_0x2095('0x48')]=_0xd248d5[_0x2095('0x48')][_0x2095('0x6c')]?_0xd248d5[_0x2095('0x48')]:_0x48ffab[_0x2095('0x47')];_0xd248d5[_0x2095('0x4d')]=qs[_0x2095('0x4e')](_0xadddea[_0x2095('0x44')][_0x2095('0x4e')]);_0xd248d5[_0x2095('0x4f')]=qs[_0x2095('0x46')](_[_0x2095('0x50')](_0xadddea[_0x2095('0x44')],_0x48ffab['filters']));if(_0xadddea['query'][_0x2095('0x51')]){_0xd248d5[_0x2095('0x4f')]=_[_0x2095('0x52')](_0xd248d5['where'],{'$or':_[_0x2095('0x3e')](_0xd248d5[_0x2095('0x48')],function(_0x5b4693){var _0x11f98a={};_0x11f98a[_0x5b4693]={'$like':'%'+_0xadddea[_0x2095('0x44')][_0x2095('0x51')]+'%'};return _0x11f98a;})});}_0xd248d5=_[_0x2095('0x52')]({},_0xd248d5,_0xadddea['options']);return _0x11f480[_0x2095('0xc6')](_0xd248d5);}})[_0x2095('0x1e')](function(_0x27eb28){if(_0x27eb28){_0x13d595=_0x27eb28[_0x2095('0x6c')];if(!_0xadddea[_0x2095('0x44')][_0x2095('0x4b')]('nolimit')){_0xd248d5[_0x2095('0x31')]=qs['limit'](_0xadddea[_0x2095('0x44')][_0x2095('0x31')]);_0xd248d5[_0x2095('0x2e')]=qs[_0x2095('0x2e')](_0xadddea['query']['offset']);}return _0x11f480[_0x2095('0xc6')](_0xd248d5);}})[_0x2095('0x1e')](function(_0x54e7d0){if(_0x54e7d0){return _0x54e7d0?{'count':_0x13d595,'rows':_0x54e7d0}:null;}})[_0x2095('0x1e')](respondWithResult(_0x4b1eba,null))[_0x2095('0x29')](handleError(_0x4b1eba,null));}; \ No newline at end of file +var _0x11c4=['getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','updatedAt','attachments','join','root','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','List','List\x20not\x20found','filename','spread','out','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','User','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','defaults','redis','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','FaxAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','options','rows','show','keys','rawAttributes','includeAll','include','find','create','body','get','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','order','merge','findAll','removeDispositions','getAnswers','CannedAnswer','removeAnswers','ids','addInteraction','FaxInteraction','omit','CmContact','Contact','Owner','internal','Tag','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','finally','sendStatus','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','priority','push','Answer','Set','ecm','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','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','TrunkId','ListId','findById'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x11c4,0xe5));var _0x411c=function(_0x3fbe9c,_0x29badf){_0x3fbe9c=_0x3fbe9c-0x0;var _0x4160a7=_0x11c4[_0x3fbe9c];return _0x4160a7;};'use strict';var emlformat=require(_0x411c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x411c('0x1'));var jsonpatch=require(_0x411c('0x2'));var rp=require('request-promise');var moment=require(_0x411c('0x3'));var BPromise=require(_0x411c('0x4'));var Mustache=require(_0x411c('0x5'));var util=require(_0x411c('0x6'));var path=require(_0x411c('0x7'));var sox=require('sox');var csv=require(_0x411c('0x8'));var ejs=require(_0x411c('0x9'));var fs=require('fs');var fs_extra=require(_0x411c('0xa'));var _=require(_0x411c('0xb'));var squel=require(_0x411c('0xc'));var crypto=require('crypto');var jsforce=require(_0x411c('0xd'));var deskjs=require(_0x411c('0xe'));var toCsv=require(_0x411c('0x8'));var querystring=require(_0x411c('0xf'));var Papa=require(_0x411c('0x10'));var Redis=require(_0x411c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x411c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x411c('0x13'));var logger=require(_0x411c('0x14'))('api');var utils=require(_0x411c('0x15'));var config=require(_0x411c('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x411c('0x17')](config[_0x411c('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x411c('0x19'))(new Redis(config['redis']));require(_0x411c('0x1a'))[_0x411c('0x1b')](socket);var jayson=require(_0x411c('0x1c'));var client=jayson[_0x411c('0x1d')][_0x411c('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x411c('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2048f8,_0x36887c,_0x36281d,_0x5d9850){return new BPromise(function(_0x187866,_0x4220e3){var _0x15d4b8=_0x5d9850||client;return _0x15d4b8['request'](_0x2048f8,_0x36281d)[_0x411c('0x1f')](function(_0x4cf9f2){logger[_0x411c('0x20')](_0x411c('0x21'),_0x36887c,_0x411c('0x22'));logger[_0x411c('0x23')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x36887c,'request\x20sent',JSON[_0x411c('0x24')](_0x4cf9f2));if(_0x4cf9f2[_0x411c('0x25')]){if(_0x4cf9f2[_0x411c('0x25')]['code']===0x1f4){logger['error'](_0x411c('0x21'),_0x36887c,_0x4cf9f2['error'][_0x411c('0x26')]);return _0x4220e3(_0x4cf9f2[_0x411c('0x25')][_0x411c('0x26')]);}logger[_0x411c('0x25')]('FaxAccount,\x20%s,\x20%s',_0x36887c,_0x4cf9f2['error']['message']);return _0x187866(_0x4cf9f2[_0x411c('0x25')][_0x411c('0x26')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x36887c,'request\x20sent');_0x187866(_0x4cf9f2[_0x411c('0x27')][_0x411c('0x26')]);}})[_0x411c('0x28')](function(_0x560984){logger[_0x411c('0x25')](_0x411c('0x21'),_0x36887c,_0x560984);_0x4220e3(_0x560984);});});}function respondWithStatusCode(_0x3388d1,_0x192213){_0x192213=_0x192213||0xcc;return function(_0xb5257a){if(_0xb5257a){return _0x3388d1['sendStatus'](_0x192213);}return _0x3388d1[_0x411c('0x29')](_0x192213)[_0x411c('0x2a')]();};}function respondWithResult(_0x2efbe3,_0x231895){_0x231895=_0x231895||0xc8;return function(_0x2d3eff){if(_0x2d3eff){return _0x2efbe3[_0x411c('0x29')](_0x231895)[_0x411c('0x2b')](_0x2d3eff);}};}function respondWithFilteredResult(_0x192222,_0x351810){return function(_0x2831b0){if(_0x2831b0){var _0x2dbae2=typeof _0x351810[_0x411c('0x2c')]===_0x411c('0x2d')&&typeof _0x351810[_0x411c('0x2e')]===_0x411c('0x2d');var _0x1a7d17=_0x2831b0[_0x411c('0x2f')];var _0x544e7a=_0x2dbae2?0x0:_0x351810['offset'];var _0x4745d5=_0x2dbae2?_0x2831b0[_0x411c('0x2f')]:_0x351810[_0x411c('0x2c')]+_0x351810[_0x411c('0x2e')];var _0x5ea514;if(_0x4745d5>=_0x1a7d17){_0x4745d5=_0x1a7d17;_0x5ea514=0xc8;}else{_0x5ea514=0xce;}_0x192222[_0x411c('0x29')](_0x5ea514);return _0x192222[_0x411c('0x30')](_0x411c('0x31'),_0x544e7a+'-'+_0x4745d5+'/'+_0x1a7d17)[_0x411c('0x2b')](_0x2831b0);}return null;};}function patchUpdates(_0xa7b22b){return function(_0xbce40){try{jsonpatch[_0x411c('0x32')](_0xbce40,_0xa7b22b,!![]);}catch(_0x34aa0f){return BPromise[_0x411c('0x33')](_0x34aa0f);}return _0xbce40['save']();};}function saveUpdates(_0x39f4e1,_0x1305a2){return function(_0x441dc9){if(_0x441dc9){return _0x441dc9[_0x411c('0x34')](_0x39f4e1)[_0x411c('0x1f')](function(_0x5789d5){return _0x5789d5;});}return null;};}function removeEntity(_0x5461f8,_0x2716ad){return function(_0x1c3a5d){if(_0x1c3a5d){return _0x1c3a5d['destroy']()['then'](function(){var _0x22279b=_0x1c3a5d['get']({'plain':!![]});var _0x2adb08=_0x411c('0x35');return db[_0x411c('0x36')][_0x411c('0x37')]({'where':{'type':_0x2adb08,'resourceId':_0x22279b['id']}})[_0x411c('0x1f')](function(){return _0x1c3a5d;});})[_0x411c('0x1f')](function(){_0x5461f8[_0x411c('0x29')](0xcc)[_0x411c('0x2a')]();});}};}function handleEntityNotFound(_0x4f3f1f,_0xf411eb){return function(_0x419290){if(!_0x419290){_0x4f3f1f['sendStatus'](0x194);}return _0x419290;};}function handleError(_0x4f42de,_0x1aa3be){_0x1aa3be=_0x1aa3be||0x1f4;return function(_0x4f52f8){logger['error'](_0x4f52f8[_0x411c('0x38')]);if(_0x4f52f8[_0x411c('0x39')]){delete _0x4f52f8['name'];}_0x4f42de[_0x411c('0x29')](_0x1aa3be)[_0x411c('0x3a')](_0x4f52f8);};}exports[_0x411c('0x3b')]=function(_0x1ba031,_0x23f9fe){var _0x404f4d={'include':[{'model':db[_0x411c('0x3c')],'as':_0x411c('0x3d')}]},_0x3d58c0={},_0x5397c4={'count':0x0,'rows':[]};var _0x450a02=_[_0x411c('0x3e')](db[_0x411c('0x3f')]['rawAttributes'],function(_0x570b2c){return{'name':_0x570b2c[_0x411c('0x40')],'type':_0x570b2c[_0x411c('0x41')]['key']};});_0x3d58c0[_0x411c('0x42')]=_[_0x411c('0x3e')](_0x450a02,_0x411c('0x39'));_0x3d58c0[_0x411c('0x43')]=_['keys'](_0x1ba031['query']);_0x3d58c0[_0x411c('0x44')]=_[_0x411c('0x45')](_0x3d58c0[_0x411c('0x42')],_0x3d58c0[_0x411c('0x43')]);_0x404f4d['attributes']=_[_0x411c('0x45')](_0x3d58c0[_0x411c('0x42')],qs[_0x411c('0x46')](_0x1ba031['query'][_0x411c('0x46')]));_0x404f4d[_0x411c('0x47')]=_0x404f4d['attributes'][_0x411c('0x48')]?_0x404f4d['attributes']:_0x3d58c0[_0x411c('0x42')];if(!_0x1ba031[_0x411c('0x43')][_0x411c('0x49')](_0x411c('0x4a'))){_0x404f4d[_0x411c('0x2e')]=qs[_0x411c('0x2e')](_0x1ba031[_0x411c('0x43')][_0x411c('0x2e')]);_0x404f4d[_0x411c('0x2c')]=qs[_0x411c('0x2c')](_0x1ba031[_0x411c('0x43')][_0x411c('0x2c')]);}_0x404f4d['order']=qs[_0x411c('0x4b')](_0x1ba031[_0x411c('0x43')][_0x411c('0x4b')]);_0x404f4d[_0x411c('0x4c')]=qs['filters'](_[_0x411c('0x4d')](_0x1ba031['query'],_0x3d58c0[_0x411c('0x44')]),_0x450a02);if(_0x1ba031[_0x411c('0x43')][_0x411c('0x4e')]){_0x404f4d[_0x411c('0x4c')]=_['merge'](_0x404f4d[_0x411c('0x4c')],{'$or':_['map'](_0x450a02,function(_0xe4fc51){if(_0xe4fc51['type']!=='VIRTUAL'){var _0x330a5a={};_0x330a5a[_0xe4fc51[_0x411c('0x39')]]={'$like':'%'+_0x1ba031['query'][_0x411c('0x4e')]+'%'};return _0x330a5a;}})});}_0x404f4d=_['merge']({},_0x404f4d,_0x1ba031[_0x411c('0x4f')]);var _0x163dae={'where':_0x404f4d['where']};return db[_0x411c('0x3f')][_0x411c('0x2f')](_0x163dae)[_0x411c('0x1f')](function(_0xb56ad){_0x5397c4[_0x411c('0x2f')]=_0xb56ad;if(_0x1ba031[_0x411c('0x43')]['includeAll']){_0x404f4d['include']=[{'all':!![]}];}return db['FaxAccount']['findAll'](_0x404f4d);})['then'](function(_0x4cb7c6){_0x5397c4[_0x411c('0x50')]=_0x4cb7c6;return _0x5397c4;})[_0x411c('0x1f')](respondWithFilteredResult(_0x23f9fe,_0x404f4d))[_0x411c('0x28')](handleError(_0x23f9fe,null));};exports[_0x411c('0x51')]=function(_0x4c0ee2,_0x5788e7){var _0x205c49={'raw':![],'where':{'id':_0x4c0ee2['params']['id']},'include':[{'model':db[_0x411c('0x3c')],'as':'mandatoryDispositionPause'}]},_0x4d340b={};_0x4d340b[_0x411c('0x42')]=_[_0x411c('0x52')](db[_0x411c('0x3f')][_0x411c('0x53')]);_0x4d340b['query']=_['keys'](_0x4c0ee2[_0x411c('0x43')]);_0x4d340b['filters']=_[_0x411c('0x45')](_0x4d340b[_0x411c('0x42')],_0x4d340b[_0x411c('0x43')]);_0x205c49[_0x411c('0x47')]=_[_0x411c('0x45')](_0x4d340b[_0x411c('0x42')],qs[_0x411c('0x46')](_0x4c0ee2['query']['fields']));_0x205c49['attributes']=_0x205c49[_0x411c('0x47')][_0x411c('0x48')]?_0x205c49['attributes']:_0x4d340b[_0x411c('0x42')];if(_0x4c0ee2['query'][_0x411c('0x54')]){_0x205c49[_0x411c('0x55')]=[{'all':!![]}];}_0x205c49=_['merge']({},_0x205c49,_0x4c0ee2[_0x411c('0x4f')]);return db[_0x411c('0x3f')][_0x411c('0x56')](_0x205c49)[_0x411c('0x1f')](handleEntityNotFound(_0x5788e7,null))['then'](respondWithResult(_0x5788e7,null))[_0x411c('0x28')](handleError(_0x5788e7,null));};exports[_0x411c('0x57')]=function(_0x5cbf83,_0x4e017c){return db['FaxAccount']['create'](_0x5cbf83[_0x411c('0x58')],{})['then'](function(_0x5cce38){var _0x2bab5d=_0x5cbf83['user'][_0x411c('0x59')]({'plain':!![]});if(!_0x2bab5d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2bab5d[_0x411c('0x5a')]===_0x411c('0x5b')){var _0x4e24b7=_0x5cce38[_0x411c('0x59')]({'plain':!![]});var _0x4ad498='FaxAccounts';return db[_0x411c('0x5c')][_0x411c('0x56')]({'where':{'name':_0x4ad498,'userProfileId':_0x2bab5d[_0x411c('0x5d')]},'raw':!![]})['then'](function(_0x5d9755){if(_0x5d9755&&_0x5d9755[_0x411c('0x5e')]===0x0){return db[_0x411c('0x36')][_0x411c('0x57')]({'name':_0x4e24b7[_0x411c('0x39')],'resourceId':_0x4e24b7['id'],'type':_0x5d9755['name'],'sectionId':_0x5d9755['id']},{})[_0x411c('0x1f')](function(){return _0x5cce38;});}else{return _0x5cce38;}})[_0x411c('0x28')](function(_0x1fa018){logger[_0x411c('0x25')](_0x411c('0x5f'),_0x1fa018);throw _0x1fa018;});}return _0x5cce38;})[_0x411c('0x1f')](respondWithResult(_0x4e017c,0xc9))['catch'](handleError(_0x4e017c,null));};exports[_0x411c('0x34')]=function(_0xd702d9,_0x5170f3){if(_0xd702d9[_0x411c('0x58')]['id']){delete _0xd702d9[_0x411c('0x58')]['id'];}return db[_0x411c('0x3f')][_0x411c('0x56')]({'where':{'id':_0xd702d9[_0x411c('0x60')]['id']},'include':[{'model':db[_0x411c('0x3c')],'as':_0x411c('0x3d')}]})[_0x411c('0x1f')](handleEntityNotFound(_0x5170f3,null))['then'](saveUpdates(_0xd702d9[_0x411c('0x58')],null))[_0x411c('0x1f')](respondWithResult(_0x5170f3,null))[_0x411c('0x28')](handleError(_0x5170f3,null));};exports[_0x411c('0x37')]=function(_0x2613f9,_0x120a3b){return db[_0x411c('0x3f')][_0x411c('0x56')]({'where':{'id':_0x2613f9[_0x411c('0x60')]['id']}})['then'](handleEntityNotFound(_0x120a3b,null))[_0x411c('0x1f')](removeEntity(_0x120a3b,null))[_0x411c('0x28')](handleError(_0x120a3b,null));};exports[_0x411c('0x61')]=function(_0x519896,_0x1e0739){return db['FaxAccount'][_0x411c('0x61')]()[_0x411c('0x1f')](respondWithResult(_0x1e0739,null))[_0x411c('0x28')](handleError(_0x1e0739,null));};exports[_0x411c('0x62')]=function(_0x15696c,_0x5ad6ae,_0x32412c){if(_0x15696c[_0x411c('0x58')]['id']){delete _0x15696c[_0x411c('0x58')]['id'];}return db[_0x411c('0x3f')][_0x411c('0x56')]({'where':{'id':_0x15696c[_0x411c('0x60')]['id']}})[_0x411c('0x1f')](handleEntityNotFound(_0x5ad6ae,null))[_0x411c('0x1f')](function(_0x55b2c0){if(_0x55b2c0){_0x15696c['body'][_0x411c('0x63')]=_0x55b2c0['id'];return db[_0x411c('0x64')]['create'](_0x15696c['body']);}})['then'](respondWithResult(_0x5ad6ae,null))[_0x411c('0x28')](handleError(_0x5ad6ae,null));};exports[_0x411c('0x65')]=function(_0x22782b,_0x2da1d4,_0x23d182){var _0x2f938c={'raw':![],'where':{}};var _0x5ce3b0={};var _0x42e868={'count':0x0,'rows':[]};return db['FaxAccount'][_0x411c('0x66')]({'where':{'id':_0x22782b[_0x411c('0x60')]['id']}})['then'](handleEntityNotFound(_0x2da1d4,null))[_0x411c('0x1f')](function(_0x531be1){if(_0x531be1){_0x5ce3b0[_0x411c('0x42')]=_[_0x411c('0x52')](db[_0x411c('0x64')][_0x411c('0x53')]);_0x5ce3b0[_0x411c('0x43')]=_[_0x411c('0x52')](_0x22782b[_0x411c('0x43')]);_0x5ce3b0[_0x411c('0x44')]=_['intersection'](_0x5ce3b0[_0x411c('0x42')],_0x5ce3b0[_0x411c('0x43')]);_0x2f938c[_0x411c('0x47')]=_[_0x411c('0x45')](_0x5ce3b0[_0x411c('0x42')],qs['fields'](_0x22782b['query'][_0x411c('0x46')]));_0x2f938c[_0x411c('0x47')]=_0x2f938c[_0x411c('0x47')][_0x411c('0x48')]?_0x2f938c[_0x411c('0x47')]:_0x5ce3b0[_0x411c('0x42')];if(!_0x22782b[_0x411c('0x43')][_0x411c('0x49')](_0x411c('0x4a'))){_0x2f938c[_0x411c('0x2e')]=qs[_0x411c('0x2e')](_0x22782b['query'][_0x411c('0x2e')]);_0x2f938c[_0x411c('0x2c')]=qs['offset'](_0x22782b[_0x411c('0x43')]['offset']);}_0x2f938c[_0x411c('0x67')]=qs[_0x411c('0x4b')](_0x22782b[_0x411c('0x43')]['sort']);_0x2f938c[_0x411c('0x4c')]=qs['filters'](_[_0x411c('0x4d')](_0x22782b[_0x411c('0x43')],_0x5ce3b0[_0x411c('0x44')]));_0x2f938c['where'][_0x411c('0x63')]=_0x531be1['id'];if(_0x22782b[_0x411c('0x43')]['filter']){_0x2f938c[_0x411c('0x4c')]=_['merge'](_0x2f938c[_0x411c('0x4c')],{'$or':_[_0x411c('0x3e')](_0x2f938c[_0x411c('0x47')],function(_0x3a8fbe){var _0x3be1cb={};_0x3be1cb[_0x3a8fbe]={'$like':'%'+_0x22782b['query'][_0x411c('0x4e')]+'%'};return _0x3be1cb;})});}_0x2f938c=_[_0x411c('0x68')]({},_0x2f938c,_0x22782b['options']);return db['Disposition'][_0x411c('0x2f')]({'where':_0x2f938c[_0x411c('0x4c')]})[_0x411c('0x1f')](function(_0x40d770){_0x42e868[_0x411c('0x2f')]=_0x40d770;if(_0x22782b[_0x411c('0x43')]['includeAll']){_0x2f938c[_0x411c('0x55')]=[{'all':!![]}];}return db['Disposition'][_0x411c('0x69')](_0x2f938c);})[_0x411c('0x1f')](function(_0x23578c){_0x42e868[_0x411c('0x50')]=_0x23578c;return _0x42e868;});}})[_0x411c('0x1f')](respondWithFilteredResult(_0x2da1d4,_0x2f938c))[_0x411c('0x28')](handleError(_0x2da1d4,null));};exports[_0x411c('0x6a')]=function(_0x14d4ec,_0x475536,_0x5334d8){return db[_0x411c('0x3f')][_0x411c('0x56')]({'where':{'id':_0x14d4ec[_0x411c('0x60')]['id']}})[_0x411c('0x1f')](handleEntityNotFound(_0x475536,null))[_0x411c('0x1f')](function(_0x5e3df4){if(_0x5e3df4){return _0x5e3df4[_0x411c('0x6a')](_0x14d4ec[_0x411c('0x43')]['ids']);}})['then'](respondWithStatusCode(_0x475536,null))[_0x411c('0x28')](handleError(_0x475536,null));};exports['addAnswer']=function(_0x12d4e2,_0x42dcc9,_0x20b516){if(_0x12d4e2[_0x411c('0x58')]['id']){delete _0x12d4e2['body']['id'];}return db[_0x411c('0x3f')][_0x411c('0x56')]({'where':{'id':_0x12d4e2[_0x411c('0x60')]['id']}})['then'](handleEntityNotFound(_0x42dcc9,null))[_0x411c('0x1f')](function(_0xaa728e){if(_0xaa728e){_0x12d4e2[_0x411c('0x58')][_0x411c('0x63')]=_0xaa728e['id'];return db['CannedAnswer'][_0x411c('0x57')](_0x12d4e2['body']);}})[_0x411c('0x1f')](respondWithResult(_0x42dcc9,null))['catch'](handleError(_0x42dcc9,null));};exports[_0x411c('0x6b')]=function(_0x1c8012,_0x150115,_0x170f8b){var _0x40436a={'raw':![],'where':{}};var _0x2650d6={};var _0x2ba2e7={'count':0x0,'rows':[]};return db[_0x411c('0x3f')][_0x411c('0x66')]({'where':{'id':_0x1c8012['params']['id']}})[_0x411c('0x1f')](handleEntityNotFound(_0x150115,null))[_0x411c('0x1f')](function(_0x3967e4){if(_0x3967e4){_0x2650d6[_0x411c('0x42')]=_[_0x411c('0x52')](db[_0x411c('0x6c')][_0x411c('0x53')]);_0x2650d6[_0x411c('0x43')]=_[_0x411c('0x52')](_0x1c8012['query']);_0x2650d6[_0x411c('0x44')]=_[_0x411c('0x45')](_0x2650d6[_0x411c('0x42')],_0x2650d6[_0x411c('0x43')]);_0x40436a[_0x411c('0x47')]=_[_0x411c('0x45')](_0x2650d6[_0x411c('0x42')],qs[_0x411c('0x46')](_0x1c8012['query'][_0x411c('0x46')]));_0x40436a[_0x411c('0x47')]=_0x40436a['attributes'][_0x411c('0x48')]?_0x40436a[_0x411c('0x47')]:_0x2650d6[_0x411c('0x42')];if(!_0x1c8012['query'][_0x411c('0x49')](_0x411c('0x4a'))){_0x40436a[_0x411c('0x2e')]=qs[_0x411c('0x2e')](_0x1c8012[_0x411c('0x43')][_0x411c('0x2e')]);_0x40436a[_0x411c('0x2c')]=qs[_0x411c('0x2c')](_0x1c8012[_0x411c('0x43')][_0x411c('0x2c')]);}_0x40436a[_0x411c('0x67')]=qs[_0x411c('0x4b')](_0x1c8012['query']['sort']);_0x40436a[_0x411c('0x4c')]=qs[_0x411c('0x44')](_[_0x411c('0x4d')](_0x1c8012[_0x411c('0x43')],_0x2650d6['filters']));_0x40436a[_0x411c('0x4c')][_0x411c('0x63')]=_0x3967e4['id'];if(_0x1c8012['query'][_0x411c('0x4e')]){_0x40436a[_0x411c('0x4c')]=_[_0x411c('0x68')](_0x40436a[_0x411c('0x4c')],{'$or':_[_0x411c('0x3e')](_0x40436a[_0x411c('0x47')],function(_0x17f5e3){var _0x78886b={};_0x78886b[_0x17f5e3]={'$like':'%'+_0x1c8012['query'][_0x411c('0x4e')]+'%'};return _0x78886b;})});}_0x40436a=_[_0x411c('0x68')]({},_0x40436a,_0x1c8012[_0x411c('0x4f')]);return db[_0x411c('0x6c')][_0x411c('0x2f')]({'where':_0x40436a['where']})[_0x411c('0x1f')](function(_0x319ca9){_0x2ba2e7[_0x411c('0x2f')]=_0x319ca9;if(_0x1c8012['query']['includeAll']){_0x40436a[_0x411c('0x55')]=[{'all':!![]}];}return db[_0x411c('0x6c')][_0x411c('0x69')](_0x40436a);})[_0x411c('0x1f')](function(_0x30c6ef){_0x2ba2e7[_0x411c('0x50')]=_0x30c6ef;return _0x2ba2e7;});}})[_0x411c('0x1f')](respondWithFilteredResult(_0x150115,_0x40436a))[_0x411c('0x28')](handleError(_0x150115,null));};exports[_0x411c('0x6d')]=function(_0x3db8ed,_0x2509cb,_0x333778){return db[_0x411c('0x3f')][_0x411c('0x56')]({'where':{'id':_0x3db8ed[_0x411c('0x60')]['id']}})[_0x411c('0x1f')](handleEntityNotFound(_0x2509cb,null))[_0x411c('0x1f')](function(_0x8a0ea7){if(_0x8a0ea7){return _0x8a0ea7[_0x411c('0x6d')](_0x3db8ed[_0x411c('0x43')][_0x411c('0x6e')]);}})['then'](respondWithStatusCode(_0x2509cb,null))[_0x411c('0x28')](handleError(_0x2509cb,null));};exports[_0x411c('0x6f')]=function(_0x19fc2e,_0x4ca4f5,_0xaaad26){return db[_0x411c('0x70')][_0x411c('0x56')]({'where':{'id':_0x19fc2e[_0x411c('0x60')]['id']}})[_0x411c('0x1f')](handleEntityNotFound(_0x4ca4f5,null))[_0x411c('0x1f')](function(_0x2f8ef5){if(_0x2f8ef5){return _0x2f8ef5[_0x411c('0x6f')](_0x19fc2e['body']['ids'],_[_0x411c('0x71')](_0x19fc2e[_0x411c('0x58')],[_0x411c('0x6e'),'id'])||{});}})[_0x411c('0x1f')](respondWithResult(_0x4ca4f5,null))[_0x411c('0x28')](handleError(_0x4ca4f5,null));};exports['getInteractions']=function(_0x54cb7d,_0x286a8a,_0x1d9dbc){var _0xda78a4={'raw':![],'where':{}};var _0x7ee1dc={};var _0x304872={'count':0x0,'rows':[]};return db['FaxAccount'][_0x411c('0x66')]({'where':{'id':_0x54cb7d[_0x411c('0x60')]['id']}})[_0x411c('0x1f')](handleEntityNotFound(_0x286a8a,null))[_0x411c('0x1f')](function(_0xf93ca7){if(_0xf93ca7){_0x7ee1dc[_0x411c('0x42')]=_[_0x411c('0x52')](db['FaxInteraction'][_0x411c('0x53')]);_0x7ee1dc['query']=_['keys'](_0x54cb7d[_0x411c('0x43')]);_0x7ee1dc[_0x411c('0x44')]=_[_0x411c('0x45')](_0x7ee1dc[_0x411c('0x42')],_0x7ee1dc[_0x411c('0x43')]);_0xda78a4[_0x411c('0x47')]=_[_0x411c('0x45')](_0x7ee1dc['model'],qs[_0x411c('0x46')](_0x54cb7d['query']['fields']));_0xda78a4['attributes']=_0xda78a4[_0x411c('0x47')][_0x411c('0x48')]?_0xda78a4['attributes']:_0x7ee1dc[_0x411c('0x42')];if(!_0x54cb7d['query'][_0x411c('0x49')](_0x411c('0x4a'))){_0xda78a4[_0x411c('0x2e')]=qs[_0x411c('0x2e')](_0x54cb7d['query']['limit']);_0xda78a4[_0x411c('0x2c')]=qs[_0x411c('0x2c')](_0x54cb7d[_0x411c('0x43')][_0x411c('0x2c')]);}_0xda78a4[_0x411c('0x67')]=qs[_0x411c('0x4b')](_0x54cb7d[_0x411c('0x43')]['sort']);_0xda78a4[_0x411c('0x4c')]=qs['filters'](_[_0x411c('0x4d')](_0x54cb7d[_0x411c('0x43')],_0x7ee1dc[_0x411c('0x44')]));_0xda78a4[_0x411c('0x4c')][_0x411c('0x63')]=_0xf93ca7['id'];if(_0x54cb7d['query']['filter']){_0xda78a4[_0x411c('0x4c')]=_[_0x411c('0x68')](_0xda78a4['where'],{'$or':_[_0x411c('0x3e')](_0xda78a4[_0x411c('0x47')],function(_0x1afb8e){var _0x3d0535={};_0x3d0535[_0x1afb8e]={'$like':'%'+_0x54cb7d['query']['filter']+'%'};return _0x3d0535;})});}_0xda78a4=_[_0x411c('0x68')]({},_0xda78a4,_0x54cb7d['options']);return db['FaxInteraction'][_0x411c('0x2f')]({'where':_0xda78a4[_0x411c('0x4c')]})['then'](function(_0x34853c){_0x304872['count']=_0x34853c;if(_0x54cb7d[_0x411c('0x43')]['includeAll']){_0xda78a4[_0x411c('0x55')]=[{'model':db[_0x411c('0x72')],'as':_0x411c('0x73'),'required':![]},{'model':db['User'],'as':_0x411c('0x74'),'attributes':[_0x411c('0x39'),'fullname',_0x411c('0x75')],'required':![]},{'model':db[_0x411c('0x76')],'as':'Tags','attributes':['id',_0x411c('0x39'),_0x411c('0x77')],'where':_0x54cb7d[_0x411c('0x43')][_0x411c('0x78')]?{'id':_0x54cb7d['query']['tag']}:undefined,'required':_0x54cb7d[_0x411c('0x43')]['tag']?!![]:![]}];}return db[_0x411c('0x70')]['findAll'](_0xda78a4);})[_0x411c('0x1f')](function(_0x53a970){_0x304872[_0x411c('0x50')]=_0x53a970;return _0x304872;});}})[_0x411c('0x1f')](respondWithFilteredResult(_0x286a8a,_0xda78a4))[_0x411c('0x28')](handleError(_0x286a8a,null));};exports['addApplications']=function(_0x3980b3,_0x12f1aa){var _0x28ae94=_0x3980b3['params']['id'];var _0x4af645=_0x3980b3[_0x411c('0x58')];var _0x74bf34=0xc8;var _0x22948a=null;return db[_0x411c('0x79')][_0x411c('0x7a')]({'isolationLevel':db[_0x411c('0x79')][_0x411c('0x7b')][_0x411c('0x7c')]['READ_COMMITTED']},function(_0x29859b){return db[_0x411c('0x3f')][_0x411c('0x66')]({'where':{'id':_0x28ae94},'transaction':_0x29859b})[_0x411c('0x1f')](function(_0x4469ce){if(_0x4469ce){return db['FaxApplication'][_0x411c('0x37')]({'where':{'FaxAccountId':_0x28ae94},'transaction':_0x29859b})['then'](function(){var _0x2cf7a1=_[_0x411c('0x3e')](_0x4af645,function(_0x50a1bc){_0x50a1bc[_0x411c('0x63')]=_0x28ae94;return _0x50a1bc;});return db[_0x411c('0x7d')][_0x411c('0x7e')](_0x2cf7a1,{'transaction':_0x29859b});});}else{_0x74bf34=0x194;_0x22948a=[];}});})['then'](function(){if(_0x74bf34!==0x194){return db[_0x411c('0x7d')][_0x411c('0x7f')]({'where':{'FaxAccountId':_0x28ae94},'order':'priority'})[_0x411c('0x1f')](function(_0x302346){_0x22948a=_0x302346;});}})[_0x411c('0x28')](function(_0x52f728){_0x74bf34=0x1f4;logger[_0x411c('0x25')](_0x52f728[_0x411c('0x38')]);if(_0x52f728[_0x411c('0x39')]){delete _0x52f728[_0x411c('0x39')];}_0x22948a=_0x52f728;})[_0x411c('0x80')](function(){if(_0x22948a===null){_0x12f1aa[_0x411c('0x81')](_0x74bf34);}else{if(_0x74bf34===0x1f4){_0x12f1aa[_0x411c('0x29')](_0x74bf34)[_0x411c('0x3a')](_0x22948a);}else{_0x12f1aa[_0x411c('0x29')](_0x74bf34)['json'](_0x22948a);}}});};exports[_0x411c('0x82')]=function(_0x5139f7,_0x7e37e7,_0x170cfb){var _0x38ddcf={};var _0x1f871f={};var _0x5b2d61;var _0x10fee7;return db[_0x411c('0x3f')][_0x411c('0x66')]({'where':{'id':_0x5139f7[_0x411c('0x60')]['id']}})[_0x411c('0x1f')](handleEntityNotFound(_0x7e37e7,null))[_0x411c('0x1f')](function(_0x1e103c){if(_0x1e103c){_0x5b2d61=_0x1e103c;_0x1f871f['model']=_[_0x411c('0x52')](db[_0x411c('0x7d')][_0x411c('0x53')]);_0x1f871f[_0x411c('0x43')]=_[_0x411c('0x52')](_0x5139f7[_0x411c('0x43')]);_0x1f871f[_0x411c('0x44')]=_[_0x411c('0x45')](_0x1f871f[_0x411c('0x42')],_0x1f871f[_0x411c('0x43')]);_0x38ddcf['attributes']=_[_0x411c('0x45')](_0x1f871f[_0x411c('0x42')],qs[_0x411c('0x46')](_0x5139f7['query']['fields']));_0x38ddcf['attributes']=_0x38ddcf[_0x411c('0x47')][_0x411c('0x48')]?_0x38ddcf[_0x411c('0x47')]:_0x1f871f[_0x411c('0x42')];_0x38ddcf[_0x411c('0x67')]=qs['sort'](_0x5139f7['query'][_0x411c('0x4b')]);_0x38ddcf[_0x411c('0x4c')]=qs['filters'](_['pick'](_0x5139f7[_0x411c('0x43')],_0x1f871f['filters']));if(_0x5139f7[_0x411c('0x43')][_0x411c('0x4e')]){_0x38ddcf[_0x411c('0x4c')]=_['merge'](_0x38ddcf[_0x411c('0x4c')],{'$or':_[_0x411c('0x3e')](_0x38ddcf['attributes'],function(_0x354029){var _0x9675a={};_0x9675a[_0x354029]={'$like':'%'+_0x5139f7[_0x411c('0x43')][_0x411c('0x4e')]+'%'};return _0x9675a;})});}_0x38ddcf=_['merge']({},_0x38ddcf,_0x5139f7['options']);return _0x5b2d61['getApplications'](_0x38ddcf);}})[_0x411c('0x1f')](function(_0x2b3a7f){if(_0x2b3a7f){_0x10fee7=_0x2b3a7f[_0x411c('0x48')];if(!_0x5139f7[_0x411c('0x43')][_0x411c('0x49')](_0x411c('0x4a'))){_0x38ddcf[_0x411c('0x2e')]=qs['limit'](_0x5139f7['query']['limit']);_0x38ddcf[_0x411c('0x2c')]=qs[_0x411c('0x2c')](_0x5139f7[_0x411c('0x43')]['offset']);}return _0x5b2d61[_0x411c('0x82')](_0x38ddcf);}})[_0x411c('0x1f')](function(_0x36e824){if(_0x36e824){return _0x36e824?{'count':_0x10fee7,'rows':_0x36e824}:null;}})[_0x411c('0x1f')](respondWithResult(_0x7e37e7,null))['catch'](handleError(_0x7e37e7,null));};function Extension(_0x4e311b,_0x1ea0c3,_0x307f45,_0x596782){this[_0x411c('0x83')]=_0x411c('0x84');this[_0x411c('0x85')]=_0x4e311b[_0x411c('0x86')];this[_0x411c('0x87')]=_0x596782;this['type']=_0x411c('0x88');this[_0x411c('0x89')]=_0x411c('0x8a');this[_0x411c('0x63')]=_0x4e311b['id'];this[_0x411c('0x8b')]=_0x1ea0c3;this['appdata']=_0x307f45;}function createExtensionsReciveFax(_0x1d381f){var _0x19164b=0x1;var _0x11b963=[];_0x11b963[_0x411c('0x8c')](new Extension(_0x1d381f,_0x19164b,'',_0x411c('0x8d')));_0x19164b+=0x1;_0x11b963[_0x411c('0x8c')](new Extension(_0x1d381f,_0x19164b,'CDR(type)=inbound-fax',_0x411c('0x8e')));_0x19164b+=0x1;for(var _0x34bdfc in _0x1d381f){if(_0x1d381f[_0x411c('0x49')](_0x34bdfc)&&(_0x34bdfc===_0x411c('0x8f')||_0x34bdfc===_0x411c('0x86')||_0x34bdfc==='gateway'||_0x34bdfc===_0x411c('0x90')||_0x34bdfc===_0x411c('0x91')||_0x34bdfc===_0x411c('0x92')||_0x34bdfc===_0x411c('0x93')||_0x34bdfc===_0x411c('0x94')||_0x34bdfc===_0x411c('0x95'))){_0x11b963[_0x411c('0x8c')](new Extension(_0x1d381f,_0x19164b,_0x411c('0x96')+_0x34bdfc+')='+_0x1d381f[_0x34bdfc],_0x411c('0x8e')));_0x19164b+=0x1;}}_0x11b963[_0x411c('0x8c')](new Extension(_0x1d381f,_0x19164b,'6',_0x411c('0x97')));_0x19164b+=0x1;_0x11b963[_0x411c('0x8c')](new Extension(_0x1d381f,_0x19164b,_0x411c('0x98'),'ReceiveFax'));_0x19164b=0x0;return _0x11b963;}exports[_0x411c('0x99')]=function(_0x3335bd,_0x35f985,_0x4abf40){var _0x2eada7;return db['sequelize'][_0x411c('0x7a')](function(_0x415e1d){return db[_0x411c('0x3f')][_0x411c('0x57')](_0x3335bd[_0x411c('0x58')],{'transaction':_0x415e1d})['then'](function(_0x41bcc4){_0x2eada7=_0x41bcc4['get']({'plain':!![]});return db[_0x411c('0x9a')][_0x411c('0x7e')](createExtensionsReciveFax(_0x2eada7),{'transaction':_0x415e1d});});})[_0x411c('0x1f')](function(){return _0x2eada7;})['then'](respondWithResult(_0x35f985,null))['catch'](handleError(_0x35f985,null));};exports[_0x411c('0x9b')]=function(_0x475887,_0xbaa88b,_0x559e11){var _0x1c6bea;return db[_0x411c('0x79')][_0x411c('0x7a')](function(_0x48203a){return db[_0x411c('0x3f')][_0x411c('0x34')](_0x475887[_0x411c('0x58')],{'where':{'id':_0x475887[_0x411c('0x58')]['id']},'transaction':_0x48203a})[_0x411c('0x1f')](function(_0x45439a){return db[_0x411c('0x9a')][_0x411c('0x37')]({'where':{'FaxAccountId':_0x475887[_0x411c('0x58')]['id']},'transaction':_0x48203a})['then'](function(_0x3552e6){return db[_0x411c('0x9a')][_0x411c('0x7e')](createExtensionsReciveFax(_['omit'](_0x475887['body'],[_0x411c('0x9c'),'key',_0x411c('0x9d'),'updatedAt',_0x411c('0x9e'),_0x411c('0x9f')])),{'transaction':_0x48203a});});});})[_0x411c('0x1f')](function(){return db[_0x411c('0x3f')][_0x411c('0xa0')](_0x475887['body']['id']);})['then'](respondWithResult(_0xbaa88b,null))[_0x411c('0x28')](handleError(_0xbaa88b,null));};exports[_0x411c('0xa1')]=function(_0x5910ae,_0x4e22cb,_0x4241fa){var _0x4b55e0={'raw':!![],'where':{}};var _0x1c163e={};var _0xc54cb6={'count':0x0,'rows':[]};return db[_0x411c('0x3f')]['findOne']({'where':{'id':_0x5910ae[_0x411c('0x60')]['id']}})[_0x411c('0x1f')](handleEntityNotFound(_0x4e22cb,null))[_0x411c('0x1f')](function(_0x268e52){if(_0x268e52){_0x1c163e[_0x411c('0x42')]=_[_0x411c('0x52')](db[_0x411c('0xa2')][_0x411c('0x53')]);_0x1c163e[_0x411c('0x43')]=_['keys'](_0x5910ae[_0x411c('0x43')]);_0x1c163e['filters']=_['intersection'](_0x1c163e[_0x411c('0x42')],_0x1c163e[_0x411c('0x43')]);_0x4b55e0[_0x411c('0x47')]=_[_0x411c('0x45')](_0x1c163e[_0x411c('0x42')],qs['fields'](_0x5910ae['query'][_0x411c('0x46')]));_0x4b55e0['attributes']=_0x4b55e0[_0x411c('0x47')][_0x411c('0x48')]?_0x4b55e0[_0x411c('0x47')]:_0x1c163e[_0x411c('0x42')];if(!_0x5910ae['query'][_0x411c('0x49')](_0x411c('0x4a'))){_0x4b55e0[_0x411c('0x2e')]=qs[_0x411c('0x2e')](_0x5910ae[_0x411c('0x43')][_0x411c('0x2e')]);_0x4b55e0[_0x411c('0x2c')]=qs[_0x411c('0x2c')](_0x5910ae[_0x411c('0x43')][_0x411c('0x2c')]);}_0x4b55e0[_0x411c('0x67')]=qs[_0x411c('0x4b')](_0x5910ae[_0x411c('0x43')]['sort']);_0x4b55e0[_0x411c('0x4c')]=qs['filters'](_['pick'](_0x5910ae[_0x411c('0x43')],_0x1c163e[_0x411c('0x44')]));_0x4b55e0[_0x411c('0x4c')][_0x411c('0x63')]=_0x268e52['id'];if(_0x5910ae['query'][_0x411c('0x4e')]){_0x4b55e0[_0x411c('0x4c')]=_['merge'](_0x4b55e0['where'],{'$or':_[_0x411c('0x3e')](_0x4b55e0[_0x411c('0x47')],function(_0x435ae0){var _0x16d4b4={};_0x16d4b4[_0x435ae0]={'$like':'%'+_0x5910ae['query'][_0x411c('0x4e')]+'%'};return _0x16d4b4;})});}if(_0x5910ae[_0x411c('0x43')][_0x411c('0xa3')]){var _0x240c8f=_0x5910ae[_0x411c('0x43')][_0x411c('0xa3')][_0x411c('0xa4')](',');var _0x585f6f={};_0x585f6f[_0x240c8f[0x0]]={'$gte':moment(_0x240c8f[0x1])[_0x411c('0xa5')](_0x411c('0xa6'))};_0x4b55e0[_0x411c('0x4c')]=_[_0x411c('0x68')](_0x4b55e0[_0x411c('0x4c')],_0x585f6f);}_0x4b55e0=_[_0x411c('0x68')]({},_0x4b55e0,_0x5910ae[_0x411c('0x4f')]);return db[_0x411c('0xa2')][_0x411c('0x2f')]({'where':_0x4b55e0[_0x411c('0x4c')]})['then'](function(_0x3b2f74){_0xc54cb6[_0x411c('0x2f')]=_0x3b2f74;if(_0x5910ae[_0x411c('0x43')][_0x411c('0x54')]){_0x4b55e0[_0x411c('0x55')]=[{'all':!![]}];}return db[_0x411c('0xa2')]['findAll'](_0x4b55e0);})[_0x411c('0x1f')](function(_0x1274f7){_0xc54cb6[_0x411c('0x50')]=_0x1274f7;return _0xc54cb6;});}})[_0x411c('0x1f')](respondWithFilteredResult(_0x4e22cb,_0x4b55e0))[_0x411c('0x28')](handleError(_0x4e22cb,null));};exports[_0x411c('0x3a')]=function(_0x29a29f,_0x2baaff,_0x439576){var _0x364bbc,_0x489e9e={},_0x393700;if(_0x29a29f[_0x411c('0x58')]['to']){_0x393700=_0x29a29f[_0x411c('0x58')]['to'][0x0];}return db[_0x411c('0x3f')][_0x411c('0x56')]({'where':{'id':_0x29a29f[_0x411c('0x60')]['id']},'include':[{'model':db[_0x411c('0xa7')],'as':'List','include':[{'model':db['CmContact'],'as':_0x411c('0xa8'),'where':{'fax':_0x393700},'limit':0x1,'order':[[_0x411c('0xa9'),'DESC']]}]}]})[_0x411c('0x1f')](handleEntityNotFound(_0x2baaff,null))['then'](function(_0x1a354d){_0x364bbc=_0x1a354d;if(_0x29a29f['body'][_0x411c('0xaa')]&&_0x29a29f[_0x411c('0x58')][_0x411c('0xaa')]['length']){for(var _0x57bc70=0x0;_0x57bc70<_0x29a29f[_0x411c('0x58')][_0x411c('0xaa')][_0x411c('0x48')];_0x57bc70+=0x1){_0x29a29f[_0x411c('0x58')][_0x411c('0xaa')][_0x57bc70]={'filename':_0x29a29f[_0x411c('0x58')][_0x411c('0xaa')][_0x57bc70]['name'],'id':_0x29a29f['body']['attachments'][_0x57bc70]['id'],'path':path[_0x411c('0xab')](config[_0x411c('0xac')],'server/files/attachments',_0x29a29f[_0x411c('0x58')][_0x411c('0xaa')][_0x57bc70][_0x411c('0xad')])};}}return respondWithRpcPromise(_0x411c('0xae'),'CheckAfterSend',{'FaxAccountId':_[_0x411c('0xaf')](_0x29a29f[_0x411c('0x60')]['id'])?undefined:_0x29a29f[_0x411c('0x60')]['id'],'path':_[_0x411c('0xaf')](_0x29a29f[_0x411c('0x58')][_0x411c('0xaa')][0x0][_0x411c('0x7')])?undefined:_0x29a29f[_0x411c('0x58')][_0x411c('0xaa')][0x0][_0x411c('0x7')],'fax':_[_0x411c('0xaf')](_0x29a29f[_0x411c('0x58')]['to'][0x0])?undefined:_0x29a29f[_0x411c('0x58')]['to'][0x0]},client9002);})[_0x411c('0x1f')](function(){if(_0x364bbc){if(_['isNil'](_0x29a29f[_0x411c('0x58')][_0x411c('0xb0')])){_0x29a29f[_0x411c('0x58')]['from']=util[_0x411c('0xa5')](_0x411c('0xb1'),_0x364bbc[_0x411c('0x39')],_0x364bbc['fax']);}if(_0x364bbc['List']){if(_0x364bbc[_0x411c('0xb2')][_0x411c('0xa8')]['length']){return _0x364bbc['List']['Contacts'][0x0];}else{return db[_0x411c('0x72')][_0x411c('0x57')](_[_0x411c('0x17')](_0x29a29f[_0x411c('0x58')],{'firstName':_0x29a29f[_0x411c('0x58')]['to'][0x0],'phone':_0x29a29f[_0x411c('0x58')]['to'][0x0],'fax':_0x29a29f['body']['to'][0x0],'ListId':_0x364bbc[_0x411c('0x9f')]}));}}else{throw new Error(_0x411c('0xb3'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x411c('0x1f')](function(_0x451491){if(_0x451491){return db[_0x411c('0x70')][_0x411c('0x56')]({'where':{'ContactId':_0x451491['id'],'closed':![],'FaxAccountId':_0x364bbc['id']}})[_0x411c('0x1f')](function(_0x1098ea){if(_0x1098ea){return[_0x1098ea,![]];}return db['FaxInteraction']['create']({'UserId':_0x29a29f[_0x411c('0x5b')]['id'],'ContactId':_0x451491['id'],'FaxAccountId':_0x364bbc['id'],'fax':_0x29a29f[_0x411c('0x58')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x411c('0x68')](_0x29a29f[_0x411c('0x58')],{'read':![],'body':_0x29a29f[_0x411c('0x58')][_0x411c('0xaa')][0x0][_0x411c('0xb4')],'FaxAccountId':_0x364bbc['id'],'UserId':_0x29a29f[_0x411c('0x5b')]['id'],'ContactId':_0x451491['id'],'AttachmentId':_0x29a29f[_0x411c('0x58')][_0x411c('0xaa')][0x0]['id']})]},{'include':[{'model':db[_0x411c('0xa2')],'as':'Messages'}]})['then'](function(_0x184ee0){return[_0x184ee0,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x411c('0xb5')](function(_0x26ac61,_0x3904b4){if(_0x3904b4){return _0x26ac61;}return db[_0x411c('0xa2')][_0x411c('0x57')]({'direction':_0x411c('0xb6'),'read':![],'body':_0x29a29f[_0x411c('0x58')][_0x411c('0xaa')][0x0][_0x411c('0xb4')],'FaxAccountId':_0x364bbc['id'],'FaxInteractionId':_0x26ac61['id'],'UserId':_0x29a29f[_0x411c('0x5b')]['id'],'ContactId':_0x26ac61[_0x411c('0xb7')],'AttachmentId':_0x29a29f['body']['attachments'][0x0]['id']})[_0x411c('0x1f')](function(_0x54b693){_0x26ac61[_0x411c('0xb8')][_0x411c('0xb9')]=[];_0x26ac61['dataValues'][_0x411c('0xb9')][_0x411c('0x8c')](_0x54b693[_0x411c('0xb8')]);return _0x26ac61;});})['then'](function(_0x3d5d1c){respondWithRpcPromise(_0x411c('0xba'),'SendFax',{'FaxAccountId':_[_0x411c('0xaf')](_0x29a29f[_0x411c('0x60')]['id'])?undefined:_0x29a29f[_0x411c('0x60')]['id'],'path':_[_0x411c('0xaf')](_0x29a29f[_0x411c('0x58')][_0x411c('0xaa')][0x0][_0x411c('0x7')])?undefined:_0x29a29f[_0x411c('0x58')][_0x411c('0xaa')][0x0][_0x411c('0x7')],'fax':_[_0x411c('0xaf')](_0x29a29f[_0x411c('0x58')]['to'][0x0])?undefined:_0x29a29f['body']['to'][0x0],'AttachmentId':_0x29a29f[_0x411c('0x58')][_0x411c('0xaa')][0x0]['id']},client9002)[_0x411c('0x1f')](function(_0x503eee){logger[_0x411c('0x20')](_0x411c('0xbb'),_0x503eee);})['catch'](function(_0x50276f){logger[_0x411c('0x20')](_0x411c('0xbb'),_0x50276f);});return _0x3d5d1c;})['then'](respondWithResult(_0x2baaff,null))[_0x411c('0x28')](handleError(_0x2baaff,null));};exports[_0x411c('0xbc')]=function(_0x2ea427,_0x546e27,_0x24f364){return db[_0x411c('0x3f')][_0x411c('0x56')]({'where':{'id':_0x2ea427[_0x411c('0x60')]['id']}})[_0x411c('0x1f')](handleEntityNotFound(_0x546e27,null))[_0x411c('0x1f')](function(_0x4cd3fd){if(_0x4cd3fd){return _0x4cd3fd[_0x411c('0xbc')](_0x2ea427[_0x411c('0x58')][_0x411c('0x6e')],_[_0x411c('0x71')](_0x2ea427[_0x411c('0x58')],[_0x411c('0x6e'),'id'])||{})[_0x411c('0xb5')](function(_0x2ae039){for(var _0x482bf1=0x0;_0x482bf1<_0x2ea427[_0x411c('0x58')][_0x411c('0x6e')][_0x411c('0x48')];_0x482bf1+=0x1){socket[_0x411c('0xbd')](_0x411c('0xbe'),{'UserId':Number(_0x2ea427[_0x411c('0x58')]['ids'][_0x482bf1]),'FaxAccountId':Number(_0x2ea427['params']['id'])});}return _0x2ae039;});}})[_0x411c('0x1f')](respondWithResult(_0x546e27,null))[_0x411c('0x28')](handleError(_0x546e27,null));};exports[_0x411c('0xbf')]=function(_0xb71e25,_0x3151aa,_0x1949ed){return db[_0x411c('0x3f')][_0x411c('0x56')]({'where':{'id':_0xb71e25['params']['id']}})[_0x411c('0x1f')](handleEntityNotFound(_0x3151aa,null))['then'](function(_0x49763c){if(_0x49763c){return _0x49763c[_0x411c('0xbf')](_0xb71e25[_0x411c('0x43')]['ids'])[_0x411c('0x1f')](function(){if(_['isArray'](_0xb71e25['query'][_0x411c('0x6e')])){for(var _0x51181c=0x0;_0x51181c<_0xb71e25[_0x411c('0x43')][_0x411c('0x6e')]['length'];_0x51181c+=0x1){socket[_0x411c('0xbd')](_0x411c('0xc0'),{'UserId':Number(_0xb71e25['query']['ids'][_0x51181c]),'FaxAccountId':Number(_0xb71e25['params']['id'])});}}else{socket[_0x411c('0xbd')](_0x411c('0xc0'),{'UserId':Number(_0xb71e25[_0x411c('0x43')]['ids']),'FaxAccountId':Number(_0xb71e25[_0x411c('0x60')]['id'])});}});}})[_0x411c('0x1f')](respondWithStatusCode(_0x3151aa,null))['catch'](handleError(_0x3151aa,null));};exports['getAgents']=function(_0x1a6869,_0x1acdc4,_0x2b4e54){var _0x260929={};var _0x19b31b={};var _0x4deb42;var _0x2f7c1c;return db[_0x411c('0x3f')]['findOne']({'where':{'id':_0x1a6869[_0x411c('0x60')]['id']}})[_0x411c('0x1f')](handleEntityNotFound(_0x1acdc4,null))[_0x411c('0x1f')](function(_0x2edc47){if(_0x2edc47){_0x4deb42=_0x2edc47;_0x19b31b[_0x411c('0x42')]=_[_0x411c('0x52')](db[_0x411c('0xc1')][_0x411c('0x53')]);_0x19b31b['query']=_[_0x411c('0x52')](_0x1a6869[_0x411c('0x43')]);_0x19b31b[_0x411c('0x44')]=_[_0x411c('0x45')](_0x19b31b['model'],_0x19b31b['query']);_0x260929[_0x411c('0x47')]=_['intersection'](_0x19b31b[_0x411c('0x42')],qs[_0x411c('0x46')](_0x1a6869[_0x411c('0x43')]['fields']));_0x260929[_0x411c('0x47')]=_0x260929[_0x411c('0x47')]['length']?_0x260929[_0x411c('0x47')]:_0x19b31b[_0x411c('0x42')];_0x260929[_0x411c('0x67')]=qs[_0x411c('0x4b')](_0x1a6869[_0x411c('0x43')][_0x411c('0x4b')]);_0x260929[_0x411c('0x4c')]=qs[_0x411c('0x44')](_['pick'](_0x1a6869[_0x411c('0x43')],_0x19b31b['filters']));if(_0x1a6869[_0x411c('0x43')]['filter']){_0x260929[_0x411c('0x4c')]=_['merge'](_0x260929['where'],{'$or':_['map'](_0x260929[_0x411c('0x47')],function(_0x56be6d){var _0x2173ae={};_0x2173ae[_0x56be6d]={'$like':'%'+_0x1a6869['query'][_0x411c('0x4e')]+'%'};return _0x2173ae;})});}_0x260929=_[_0x411c('0x68')]({},_0x260929,_0x1a6869[_0x411c('0x4f')]);return _0x4deb42[_0x411c('0xc2')](_0x260929);}})[_0x411c('0x1f')](function(_0x744572){if(_0x744572){_0x2f7c1c=_0x744572['length'];if(!_0x1a6869[_0x411c('0x43')][_0x411c('0x49')](_0x411c('0x4a'))){_0x260929['limit']=qs[_0x411c('0x2e')](_0x1a6869[_0x411c('0x43')][_0x411c('0x2e')]);_0x260929['offset']=qs[_0x411c('0x2c')](_0x1a6869['query']['offset']);}return _0x4deb42[_0x411c('0xc2')](_0x260929);}})[_0x411c('0x1f')](function(_0x2229e0){if(_0x2229e0){return _0x2229e0?{'count':_0x2f7c1c,'rows':_0x2229e0}:null;}})[_0x411c('0x1f')](respondWithResult(_0x1acdc4,null))[_0x411c('0x28')](handleError(_0x1acdc4,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index bf89284..cfeaa00 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 _0x9478=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount'];(function(_0x4d9403,_0x33c5f0){var _0x5eef11=function(_0x50bb5c){while(--_0x50bb5c){_0x4d9403['push'](_0x4d9403['shift']());}};_0x5eef11(++_0x33c5f0);}(_0x9478,0x15b));var _0x8947=function(_0x3fd885,_0x47925b){_0x3fd885=_0x3fd885-0x0;var _0x2489ca=_0x9478[_0x3fd885];return _0x2489ca;};'use strict';var EventEmitter=require(_0x8947('0x0'));var FaxAccount=require(_0x8947('0x1'))['db'][_0x8947('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x8947('0x3')](0x0);var events={'afterCreate':_0x8947('0x4'),'afterUpdate':_0x8947('0x5'),'afterDestroy':'remove'};function emitEvent(_0x45510b){return function(_0x535070,_0x2db57c,_0x189f26){FaxAccountEvents[_0x8947('0x6')](_0x45510b+':'+_0x535070['id'],_0x535070);FaxAccountEvents[_0x8947('0x6')](_0x45510b,_0x535070);_0x189f26(null);};}for(var e in events){if(events[_0x8947('0x7')](e)){var event=events[e];FaxAccount[_0x8947('0x8')](e,emitEvent(event));}}module[_0x8947('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0xb40d=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x6f550d,_0xdf85d7){var _0x180b57=function(_0x17e84c){while(--_0x17e84c){_0x6f550d['push'](_0x6f550d['shift']());}};_0x180b57(++_0xdf85d7);}(_0xb40d,0xc8));var _0xdb40=function(_0x1de564,_0x5f0045){_0x1de564=_0x1de564-0x0;var _0x2ea1fc=_0xb40d[_0x1de564];return _0x2ea1fc;};'use strict';var EventEmitter=require(_0xdb40('0x0'));var FaxAccount=require(_0xdb40('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xdb40('0x2')](0x0);var events={'afterCreate':_0xdb40('0x3'),'afterUpdate':_0xdb40('0x4'),'afterDestroy':'remove'};function emitEvent(_0x272601){return function(_0x5888c9,_0x8f71a4,_0x47311a){FaxAccountEvents['emit'](_0x272601+':'+_0x5888c9['id'],_0x5888c9);FaxAccountEvents[_0xdb40('0x5')](_0x272601,_0x5888c9);_0x47311a(null);};}for(var e in events){if(events[_0xdb40('0x6')](e)){var event=events[e];FaxAccount[_0xdb40('0x7')](e,emitEvent(event));}}module[_0xdb40('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 90bc944..bfb0ad0 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 _0x1734=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','moment'];(function(_0x1dcdc1,_0x2fdd77){var _0x24a48c=function(_0x165b28){while(--_0x165b28){_0x1dcdc1['push'](_0x1dcdc1['shift']());}};_0x24a48c(++_0x2fdd77);}(_0x1734,0x64));var _0x4173=function(_0x3afa9f,_0x52b854){_0x3afa9f=_0x3afa9f-0x0;var _0x4ff5e0=_0x1734[_0x3afa9f];return _0x4ff5e0;};'use strict';var _=require(_0x4173('0x0'));var util=require(_0x4173('0x1'));var logger=require(_0x4173('0x2'))('api');var moment=require(_0x4173('0x3'));var BPromise=require(_0x4173('0x4'));var rp=require(_0x4173('0x5'));var fs=require('fs');var path=require(_0x4173('0x6'));var rimraf=require(_0x4173('0x7'));var config=require(_0x4173('0x8'));var attributes=require('./faxAccount.attributes');module[_0x4173('0x9')]=function(_0x2c39b6,_0x2f759d){return _0x2c39b6[_0x4173('0xa')](_0x4173('0xb'),attributes,{'tableName':_0x4173('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x797e=['lodash','api','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','fax_accounts'];(function(_0x26419e,_0x32f340){var _0x1df66b=function(_0x47315e){while(--_0x47315e){_0x26419e['push'](_0x26419e['shift']());}};_0x1df66b(++_0x32f340);}(_0x797e,0x15e));var _0xe797=function(_0x56c68c,_0x156d40){_0x56c68c=_0x56c68c-0x0;var _0x35f506=_0x797e[_0x56c68c];return _0x35f506;};'use strict';var _=require(_0xe797('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe797('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe797('0x2'));var fs=require('fs');var path=require(_0xe797('0x3'));var rimraf=require(_0xe797('0x4'));var config=require(_0xe797('0x5'));var attributes=require(_0xe797('0x6'));module[_0xe797('0x7')]=function(_0x47977b,_0x9e5d8b){return _0x47977b[_0xe797('0x8')]('FaxAccount',attributes,{'tableName':_0xe797('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index c409604..1a46c60 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 _0xf417=['client','http','defaults','redis','localhost','./faxAccount.socket','request','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetFaxAccount','FaxAccount','options','where','attributes','limit','include','map','model','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','createdAt','difference','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','find','CmList','Contacts','updatedAt','FaxApplication','Applications','then','List','get','account','applications','orderBy','priority','contact','FaxInteraction','create','spread','autoclose','push','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','agent','queueId','FaxQueue','unshift','queue','waitForTheAssignedQueue','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2728fc,_0x2ce482){var _0x33039b=function(_0x2d1b02){while(--_0x2d1b02){_0x2728fc['push'](_0x2728fc['shift']());}};_0x33039b(++_0x2ce482);}(_0xf417,0x10d));var _0x7f41=function(_0x15d60e,_0x4e846d){_0x15d60e=_0x15d60e-0x0;var _0x5c6452=_0xf417[_0x15d60e];return _0x5c6452;};'use strict';var _=require(_0x7f41('0x0'));var util=require(_0x7f41('0x1'));var moment=require('moment');var BPromise=require(_0x7f41('0x2'));var rs=require(_0x7f41('0x3'));var fs=require('fs');var Redis=require(_0x7f41('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f41('0x5'));var logger=require(_0x7f41('0x6'))(_0x7f41('0x7'));var config=require(_0x7f41('0x8'));var jayson=require(_0x7f41('0x9'));var client=jayson[_0x7f41('0xa')][_0x7f41('0xb')]({'port':0x232c});config['redis']=_[_0x7f41('0xc')](config[_0x7f41('0xd')],{'host':_0x7f41('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7f41('0xf'))['register'](socket);function respondWithRpcPromise(_0x3ace60,_0x40a59d,_0x2dfb03){return new BPromise(function(_0x66317a,_0x53df04){return client[_0x7f41('0x10')](_0x3ace60,_0x2dfb03)['then'](function(_0x26f623){logger['info'](_0x7f41('0x11'),_0x40a59d,'request\x20sent');logger[_0x7f41('0x12')](_0x7f41('0x13'),_0x40a59d,_0x7f41('0x14'),JSON[_0x7f41('0x15')](_0x26f623));if(_0x26f623[_0x7f41('0x16')]){if(_0x26f623[_0x7f41('0x16')][_0x7f41('0x17')]===0x1f4){logger[_0x7f41('0x16')](_0x7f41('0x11'),_0x40a59d,_0x26f623['error'][_0x7f41('0x18')]);return _0x53df04(_0x26f623[_0x7f41('0x16')][_0x7f41('0x18')]);}logger[_0x7f41('0x16')]('FaxAccount,\x20%s,\x20%s',_0x40a59d,_0x26f623[_0x7f41('0x16')][_0x7f41('0x18')]);return _0x66317a(_0x26f623[_0x7f41('0x16')]['message']);}else{logger[_0x7f41('0x19')]('FaxAccount,\x20%s,\x20%s',_0x40a59d,'request\x20sent');_0x66317a(_0x26f623[_0x7f41('0x1a')][_0x7f41('0x18')]);}})[_0x7f41('0x1b')](function(_0x598064){logger[_0x7f41('0x16')](_0x7f41('0x11'),_0x40a59d,_0x598064);_0x53df04(_0x598064);});});}exports[_0x7f41('0x1c')]=function(_0x3e4bc1){var _0x21cc12=this;return new Promise(function(_0x46d1d4,_0x7a67c){return db[_0x7f41('0x1d')]['findAll']({'raw':_0x3e4bc1[_0x7f41('0x1e')]?_0x3e4bc1[_0x7f41('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3e4bc1[_0x7f41('0x1e')]?_0x3e4bc1[_0x7f41('0x1e')][_0x7f41('0x1f')]||null:null,'attributes':_0x3e4bc1[_0x7f41('0x1e')]?_0x3e4bc1[_0x7f41('0x1e')][_0x7f41('0x20')]||null:null,'limit':_0x3e4bc1[_0x7f41('0x1e')]?_0x3e4bc1['options'][_0x7f41('0x21')]||null:null,'include':_0x3e4bc1[_0x7f41('0x1e')]?_0x3e4bc1['options'][_0x7f41('0x22')]?_[_0x7f41('0x23')](_0x3e4bc1[_0x7f41('0x1e')]['include'],function(_0x157c73){return{'model':db[_0x157c73[_0x7f41('0x24')]],'as':_0x157c73['as'],'attributes':_0x157c73[_0x7f41('0x20')],'include':_0x157c73[_0x7f41('0x22')]?_[_0x7f41('0x23')](_0x157c73[_0x7f41('0x22')],function(_0x9ba838){return{'model':db[_0x9ba838['model']],'as':_0x9ba838['as'],'attributes':_0x9ba838[_0x7f41('0x20')],'include':_0x9ba838[_0x7f41('0x22')]?_['map'](_0x9ba838[_0x7f41('0x22')],function(_0x473ae0){return{'model':db[_0x473ae0[_0x7f41('0x24')]],'as':_0x473ae0['as'],'attributes':_0x473ae0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x40702d){logger[_0x7f41('0x19')](_0x7f41('0x1c'),_0x3e4bc1);logger[_0x7f41('0x12')](_0x7f41('0x1c'),_0x3e4bc1,JSON[_0x7f41('0x15')](_0x40702d));_0x46d1d4(_0x40702d);})[_0x7f41('0x1b')](function(_0x14daf6){logger[_0x7f41('0x16')]('GetFaxAccount',_0x14daf6[_0x7f41('0x18')],_0x3e4bc1);_0x7a67c(_0x21cc12['error'](0x1f4,_0x14daf6[_0x7f41('0x18')]));});});};exports[_0x7f41('0x25')]=function(_0x227c3d,_0x57b8c4,_0x2ead70){var _0x3314b0=this;return new Promise(function(_0x383e36,_0x347b02){var _0x4ca206={'body':_0x227c3d[_0x7f41('0x26')],'channel':_0x7f41('0x27')};var _0x164108=[];var _0x4b5d09=[];var _0x36cc1a={};return db[_0x7f41('0x28')][_0x7f41('0x29')]()['then'](function(_0x1476d2){if(!_0x1476d2){throw new db[(_0x7f41('0x2a'))][(_0x7f41('0x2b'))](_0x7f41('0x2c'));}_0x164108=_['difference'](_[_0x7f41('0x2d')](_0x1476d2),[_0x7f41('0x2e'),'updatedAt']);_0x4b5d09=_[_0x7f41('0x2f')](_[_0x7f41('0x2d')](_0x1476d2),[_0x7f41('0x2e'),'updatedAt',_0x7f41('0x30'),_0x7f41('0x31')]);if(_0x227c3d[_0x7f41('0x26')]['id']){delete _0x227c3d[_0x7f41('0x26')]['id'];}if(_['isNil'](_0x227c3d['body'][_0x7f41('0x32')])){throw new db['Sequelize'][(_0x7f41('0x2b'))](_0x7f41('0x33'));}if(_['isNil'](_0x227c3d[_0x7f41('0x26')][_0x7f41('0x26')])||_0x227c3d['body']['body']===''){throw new db['Sequelize'][(_0x7f41('0x2b'))](_0x7f41('0x34'));}if(_['isNil'](_0x227c3d[_0x7f41('0x26')][_0x7f41('0x35')])){throw new db[(_0x7f41('0x2a'))][(_0x7f41('0x2b'))](_0x7f41('0x36')+_0x4b5d09);}if(!_[_0x7f41('0x37')](_0x4b5d09,_0x227c3d[_0x7f41('0x26')][_0x7f41('0x35')])){throw new db[(_0x7f41('0x2a'))][(_0x7f41('0x2b'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4b5d09);}_0x36cc1a[_0x227c3d[_0x7f41('0x26')][_0x7f41('0x35')]]=_0x227c3d[_0x7f41('0x26')][_0x7f41('0x32')];})['then'](function(){return db[_0x7f41('0x1d')][_0x7f41('0x38')]({'where':{'id':_0x227c3d['account']['id']},'include':[{'model':db[_0x7f41('0x39')],'as':'List','include':[{'model':db[_0x7f41('0x28')],'as':_0x7f41('0x3a'),'where':_0x36cc1a,'limit':0x1,'order':[[_0x7f41('0x3b'),'DESC']]}]},{'model':db[_0x7f41('0x3c')],'as':_0x7f41('0x3d')}]});})[_0x7f41('0x3e')](function(_0xb8abc6){if(_0xb8abc6&&_0xb8abc6[_0x7f41('0x3f')]){var _0xffe99b=_0xb8abc6[_0x7f41('0x40')]({'plain':!![]});_0x4ca206[_0x7f41('0x41')]=_0xffe99b;_0x4ca206[_0x7f41('0x42')]=_0xffe99b[_0x7f41('0x3d')];_0x4ca206['list']=_0xffe99b[_0x7f41('0x3f')];_0x4ca206['applications']=_[_0x7f41('0x43')](_0x4ca206[_0x7f41('0x42')],[_0x7f41('0x44')],['asc']);if(_0x4ca206[_0x7f41('0x41')][_0x7f41('0x3d')]){delete _0x4ca206['account'][_0x7f41('0x3d')];}if(_0x4ca206[_0x7f41('0x41')]['List']&&_0x4ca206['account']['List'][_0x7f41('0x3a')]['length']){return _0x4ca206['account'][_0x7f41('0x3f')][_0x7f41('0x3a')][0x0];}var _0x6fb18d=_['defaults'](_0x227c3d[_0x7f41('0x26')],{'firstName':_0x227c3d['body']['from'],'ListId':_0xffe99b[_0x7f41('0x31')]});_0x6fb18d[_0x227c3d[_0x7f41('0x26')][_0x7f41('0x35')]]=_0x227c3d[_0x7f41('0x26')][_0x7f41('0x32')];return db[_0x7f41('0x28')]['create'](_0x6fb18d,{'fields':_0x164108,'raw':!![]});}})[_0x7f41('0x3e')](function(_0x34b636){_0x4ca206[_0x7f41('0x45')]=_0x34b636;if(_0x34b636){var _0x4f8871={'ContactId':_0x34b636['id'],'FaxAccountId':_0x227c3d[_0x7f41('0x41')]['id'],'fax':_0x34b636['fax']};return db[_0x7f41('0x46')][_0x7f41('0x38')]({'where':{'ContactId':_0x34b636['id'],'closed':![],'FaxAccountId':_0x227c3d['account']['id']}})['then'](function(_0x1a6bbd){if(_0x1a6bbd){return[_0x1a6bbd,![]];}return db[_0x7f41('0x46')][_0x7f41('0x47')](_0x4f8871)[_0x7f41('0x3e')](function(_0x37d7cc){return[_0x37d7cc,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x7f41('0x48')](function(_0x235342,_0x49e8c7){var _0x1b5c5f=_0x235342[_0x7f41('0x40')]({'plain':!![]});if(_0x49e8c7){if(_0x4ca206['account'][_0x7f41('0x49')]){_0x4ca206[_0x7f41('0x42')][_0x7f41('0x4a')]({'id':0x0,'priority':_0x4ca206['applications']['length']+0x1,'app':'close','appdata':_0x7f41('0x4b'),'interval':_0x7f41('0x4c')});}_0x1b5c5f['created']=!![];}else{_0x1b5c5f[_0x7f41('0x4d')]=![];}_0x4ca206[_0x7f41('0x4e')]=_0x1b5c5f;return db[_0x7f41('0x4f')]['create']({'body':_0x227c3d['body'][_0x7f41('0x26')],'FaxAccountId':_0x227c3d[_0x7f41('0x41')]['id'],'FaxInteractionId':_0x235342['id'],'direction':'in','ContactId':_0x235342[_0x7f41('0x50')],'AttachmentId':_0x227c3d[_0x7f41('0x26')][_0x7f41('0x51')]});})['then'](function(_0x39b9a9){_0x4ca206[_0x7f41('0x18')]=_0x39b9a9;if(!_0x4ca206[_0x7f41('0x4e')][_0x7f41('0x52')])return;return db[_0x7f41('0x53')][_0x7f41('0x38')]({'attributes':['id',_0x7f41('0x54')],'where':{'id':_0x4ca206[_0x7f41('0x4e')][_0x7f41('0x52')]}});})[_0x7f41('0x3e')](function(_0x5ed9c0){if(_0x5ed9c0){_0x4ca206[_0x7f41('0x42')]['unshift']({'id':0x0,'priority':0x0,'app':_0x7f41('0x55'),'appdata':_0x5ed9c0[_0x7f41('0x54')]+','+(_0x4ca206[_0x7f41('0x41')]['waitForTheAssignedAgent']||0xa),'interval':_0x7f41('0x4c')});}if(!_0x4ca206[_0x7f41('0x4e')][_0x7f41('0x56')])return;return db[_0x7f41('0x57')][_0x7f41('0x38')]({'attributes':['id',_0x7f41('0x54')],'where':{'id':_0x4ca206[_0x7f41('0x4e')][_0x7f41('0x56')]}});})[_0x7f41('0x3e')](function(_0x38592b){if(_0x38592b){_0x4ca206['applications'][_0x7f41('0x58')]({'id':0x0,'priority':0x1,'app':_0x7f41('0x59'),'appdata':_0x38592b[_0x7f41('0x54')]+','+(_0x4ca206[_0x7f41('0x41')][_0x7f41('0x5a')]||0x12c),'interval':_0x7f41('0x4c')});}return respondWithRpcPromise(_0x7f41('0x5b'),_0x7f41('0x5c'),_0x4ca206);})['then'](function(_0x1cd612){_0x383e36(_0x1cd612);})[_0x7f41('0x1b')](function(_0x54a709){_0x347b02(_0x3314b0[_0x7f41('0x16')](0x1f4,_0x54a709[_0x7f41('0x18')]));});});}; \ No newline at end of file +var _0xf897=['attributes','limit','include','model','map','GetFaxAccount','NotifyFaxAccount','body','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','list','applications','orderBy','priority','asc','defaults','create','contact','fax','FaxInteraction','find','Contact\x20not\x20found','spread','autoclose','push','length','close','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','waitForTheAssignedAgent','queueId','FaxQueue','unshift','waitForTheAssignedQueue','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','FaxAccount','findAll','options','where'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0xf897,0x15f));var _0x7f89=function(_0xa248cf,_0x15e6df){_0xa248cf=_0xa248cf-0x0;var _0x4311cf=_0xf897[_0xa248cf];return _0x4311cf;};'use strict';var _=require(_0x7f89('0x0'));var util=require(_0x7f89('0x1'));var moment=require('moment');var BPromise=require(_0x7f89('0x2'));var rs=require(_0x7f89('0x3'));var fs=require('fs');var Redis=require(_0x7f89('0x4'));var db=require(_0x7f89('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7f89('0x6'));var config=require(_0x7f89('0x7'));var jayson=require(_0x7f89('0x8'));var client=jayson[_0x7f89('0x9')]['http']({'port':0x232c});config['redis']=_['defaults'](config[_0x7f89('0xa')],{'host':_0x7f89('0xb'),'port':0x18eb});var socket=require(_0x7f89('0xc'))(new Redis(config[_0x7f89('0xa')]));require(_0x7f89('0xd'))[_0x7f89('0xe')](socket);function respondWithRpcPromise(_0x22b3f8,_0x4a13df,_0xeae920){return new BPromise(function(_0xe7cd7c,_0x18d1e6){return client[_0x7f89('0xf')](_0x22b3f8,_0xeae920)[_0x7f89('0x10')](function(_0x34ee62){logger['info'](_0x7f89('0x11'),_0x4a13df,_0x7f89('0x12'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x4a13df,'request\x20sent',JSON[_0x7f89('0x13')](_0x34ee62));if(_0x34ee62[_0x7f89('0x14')]){if(_0x34ee62['error'][_0x7f89('0x15')]===0x1f4){logger[_0x7f89('0x14')]('FaxAccount,\x20%s,\x20%s',_0x4a13df,_0x34ee62[_0x7f89('0x14')][_0x7f89('0x16')]);return _0x18d1e6(_0x34ee62['error'][_0x7f89('0x16')]);}logger[_0x7f89('0x14')](_0x7f89('0x11'),_0x4a13df,_0x34ee62[_0x7f89('0x14')]['message']);return _0xe7cd7c(_0x34ee62[_0x7f89('0x14')][_0x7f89('0x16')]);}else{logger[_0x7f89('0x17')]('FaxAccount,\x20%s,\x20%s',_0x4a13df,_0x7f89('0x12'));_0xe7cd7c(_0x34ee62['result'][_0x7f89('0x16')]);}})[_0x7f89('0x18')](function(_0x474e61){logger[_0x7f89('0x14')]('FaxAccount,\x20%s,\x20%s',_0x4a13df,_0x474e61);_0x18d1e6(_0x474e61);});});}exports['GetFaxAccount']=function(_0x10fc1e){var _0x26f57d=this;return new Promise(function(_0x4c79cd,_0x3212ee){return db[_0x7f89('0x19')][_0x7f89('0x1a')]({'raw':_0x10fc1e[_0x7f89('0x1b')]?_0x10fc1e[_0x7f89('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x10fc1e['options']?_0x10fc1e['options'][_0x7f89('0x1c')]||null:null,'attributes':_0x10fc1e[_0x7f89('0x1b')]?_0x10fc1e[_0x7f89('0x1b')][_0x7f89('0x1d')]||null:null,'limit':_0x10fc1e[_0x7f89('0x1b')]?_0x10fc1e['options'][_0x7f89('0x1e')]||null:null,'include':_0x10fc1e[_0x7f89('0x1b')]?_0x10fc1e[_0x7f89('0x1b')][_0x7f89('0x1f')]?_['map'](_0x10fc1e['options'][_0x7f89('0x1f')],function(_0x276794){return{'model':db[_0x276794[_0x7f89('0x20')]],'as':_0x276794['as'],'attributes':_0x276794[_0x7f89('0x1d')],'include':_0x276794['include']?_[_0x7f89('0x21')](_0x276794[_0x7f89('0x1f')],function(_0x56a5e6){return{'model':db[_0x56a5e6[_0x7f89('0x20')]],'as':_0x56a5e6['as'],'attributes':_0x56a5e6['attributes'],'include':_0x56a5e6[_0x7f89('0x1f')]?_['map'](_0x56a5e6[_0x7f89('0x1f')],function(_0x2c020a){return{'model':db[_0x2c020a[_0x7f89('0x20')]],'as':_0x2c020a['as'],'attributes':_0x2c020a[_0x7f89('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7f89('0x10')](function(_0x4b4976){logger[_0x7f89('0x17')](_0x7f89('0x22'),_0x10fc1e);logger['debug'](_0x7f89('0x22'),_0x10fc1e,JSON['stringify'](_0x4b4976));_0x4c79cd(_0x4b4976);})[_0x7f89('0x18')](function(_0x4a67fa){logger[_0x7f89('0x14')](_0x7f89('0x22'),_0x4a67fa[_0x7f89('0x16')],_0x10fc1e);_0x3212ee(_0x26f57d[_0x7f89('0x14')](0x1f4,_0x4a67fa['message']));});});};exports[_0x7f89('0x23')]=function(_0x3401a0,_0x479024,_0xb32151){var _0x31fe58=this;return new Promise(function(_0x4840da,_0x3b911b){var _0x390ace={'body':_0x3401a0[_0x7f89('0x24')],'channel':'fax'};var _0x272769=[];var _0x223eee=[];var _0x4f765d={};return db[_0x7f89('0x25')]['describe']()[_0x7f89('0x10')](function(_0x21a350){if(!_0x21a350){throw new db[(_0x7f89('0x26'))][(_0x7f89('0x27'))](_0x7f89('0x28'));}_0x272769=_[_0x7f89('0x29')](_[_0x7f89('0x2a')](_0x21a350),[_0x7f89('0x2b'),'updatedAt']);_0x223eee=_[_0x7f89('0x29')](_[_0x7f89('0x2a')](_0x21a350),[_0x7f89('0x2b'),_0x7f89('0x2c'),_0x7f89('0x2d'),_0x7f89('0x2e')]);if(_0x3401a0[_0x7f89('0x24')]['id']){delete _0x3401a0[_0x7f89('0x24')]['id'];}if(_[_0x7f89('0x2f')](_0x3401a0['body'][_0x7f89('0x30')])){throw new db['Sequelize'][(_0x7f89('0x27'))](_0x7f89('0x31'));}if(_[_0x7f89('0x2f')](_0x3401a0[_0x7f89('0x24')][_0x7f89('0x24')])||_0x3401a0['body'][_0x7f89('0x24')]===''){throw new db['Sequelize'][(_0x7f89('0x27'))](_0x7f89('0x32'));}if(_['isNil'](_0x3401a0[_0x7f89('0x24')][_0x7f89('0x33')])){throw new db[(_0x7f89('0x26'))][(_0x7f89('0x27'))](_0x7f89('0x34')+_0x223eee);}if(!_[_0x7f89('0x35')](_0x223eee,_0x3401a0[_0x7f89('0x24')]['mapKey'])){throw new db[(_0x7f89('0x26'))][(_0x7f89('0x27'))](_0x7f89('0x36')+_0x223eee);}_0x4f765d[_0x3401a0[_0x7f89('0x24')][_0x7f89('0x33')]]=_0x3401a0[_0x7f89('0x24')][_0x7f89('0x30')];})[_0x7f89('0x10')](function(){return db[_0x7f89('0x19')]['find']({'where':{'id':_0x3401a0[_0x7f89('0x37')]['id']},'include':[{'model':db[_0x7f89('0x38')],'as':_0x7f89('0x39'),'include':[{'model':db[_0x7f89('0x25')],'as':_0x7f89('0x3a'),'where':_0x4f765d,'limit':0x1,'order':[['updatedAt',_0x7f89('0x3b')]]}]},{'model':db[_0x7f89('0x3c')],'as':_0x7f89('0x3d')}]});})[_0x7f89('0x10')](function(_0x2c4330){if(_0x2c4330&&_0x2c4330['List']){var _0x4f4440=_0x2c4330[_0x7f89('0x3e')]({'plain':!![]});_0x390ace['account']=_0x4f4440;_0x390ace['applications']=_0x4f4440[_0x7f89('0x3d')];_0x390ace[_0x7f89('0x3f')]=_0x4f4440[_0x7f89('0x39')];_0x390ace[_0x7f89('0x40')]=_[_0x7f89('0x41')](_0x390ace[_0x7f89('0x40')],[_0x7f89('0x42')],[_0x7f89('0x43')]);if(_0x390ace[_0x7f89('0x37')][_0x7f89('0x3d')]){delete _0x390ace[_0x7f89('0x37')][_0x7f89('0x3d')];}if(_0x390ace[_0x7f89('0x37')][_0x7f89('0x39')]&&_0x390ace[_0x7f89('0x37')][_0x7f89('0x39')]['Contacts']['length']){return _0x390ace[_0x7f89('0x37')]['List']['Contacts'][0x0];}var _0xc237c6=_[_0x7f89('0x44')](_0x3401a0[_0x7f89('0x24')],{'firstName':_0x3401a0[_0x7f89('0x24')][_0x7f89('0x30')],'ListId':_0x4f4440[_0x7f89('0x2e')]});_0xc237c6[_0x3401a0[_0x7f89('0x24')]['mapKey']]=_0x3401a0[_0x7f89('0x24')][_0x7f89('0x30')];return db['CmContact'][_0x7f89('0x45')](_0xc237c6,{'fields':_0x272769,'raw':!![]});}})[_0x7f89('0x10')](function(_0x342150){_0x390ace[_0x7f89('0x46')]=_0x342150;if(_0x342150){var _0x1ab85b={'ContactId':_0x342150['id'],'FaxAccountId':_0x3401a0['account']['id'],'fax':_0x342150[_0x7f89('0x47')]};return db[_0x7f89('0x48')][_0x7f89('0x49')]({'where':{'ContactId':_0x342150['id'],'closed':![],'FaxAccountId':_0x3401a0[_0x7f89('0x37')]['id']}})[_0x7f89('0x10')](function(_0x50c1ab){if(_0x50c1ab){return[_0x50c1ab,![]];}return db[_0x7f89('0x48')][_0x7f89('0x45')](_0x1ab85b)['then'](function(_0x246620){return[_0x246620,!![]];});});}else{throw new Error(_0x7f89('0x4a'));}})[_0x7f89('0x4b')](function(_0x50a5e2,_0x5efaa7){var _0x494903=_0x50a5e2['get']({'plain':!![]});if(_0x5efaa7){if(_0x390ace[_0x7f89('0x37')][_0x7f89('0x4c')]){_0x390ace['applications'][_0x7f89('0x4d')]({'id':0x0,'priority':_0x390ace[_0x7f89('0x40')][_0x7f89('0x4e')]+0x1,'app':_0x7f89('0x4f'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x494903[_0x7f89('0x50')]=!![];}else{_0x494903[_0x7f89('0x50')]=![];}_0x390ace[_0x7f89('0x51')]=_0x494903;return db[_0x7f89('0x52')][_0x7f89('0x45')]({'body':_0x3401a0[_0x7f89('0x24')][_0x7f89('0x24')],'FaxAccountId':_0x3401a0[_0x7f89('0x37')]['id'],'FaxInteractionId':_0x50a5e2['id'],'direction':'in','ContactId':_0x50a5e2[_0x7f89('0x53')],'AttachmentId':_0x3401a0[_0x7f89('0x24')][_0x7f89('0x54')]});})[_0x7f89('0x10')](function(_0x1f0296){_0x390ace[_0x7f89('0x16')]=_0x1f0296;if(!_0x390ace[_0x7f89('0x51')][_0x7f89('0x55')])return;return db[_0x7f89('0x56')]['find']({'attributes':['id',_0x7f89('0x57')],'where':{'id':_0x390ace[_0x7f89('0x51')][_0x7f89('0x55')]}});})[_0x7f89('0x10')](function(_0x32c523){if(_0x32c523){_0x390ace[_0x7f89('0x40')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x32c523[_0x7f89('0x57')]+','+(_0x390ace[_0x7f89('0x37')][_0x7f89('0x58')]||0xa),'interval':'*,*,*,*'});}if(!_0x390ace[_0x7f89('0x51')][_0x7f89('0x59')])return;return db[_0x7f89('0x5a')][_0x7f89('0x49')]({'attributes':['id',_0x7f89('0x57')],'where':{'id':_0x390ace[_0x7f89('0x51')][_0x7f89('0x59')]}});})['then'](function(_0x1f5be7){if(_0x1f5be7){_0x390ace[_0x7f89('0x40')][_0x7f89('0x5b')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x1f5be7[_0x7f89('0x57')]+','+(_0x390ace['account'][_0x7f89('0x5c')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x7f89('0x5d'),_0x7f89('0x5e'),_0x390ace);})[_0x7f89('0x10')](function(_0x33139e){_0x4840da(_0x33139e);})[_0x7f89('0x18')](function(_0x1bfd47){_0x3b911b(_0x31fe58[_0x7f89('0x14')](0x1f4,_0x1bfd47[_0x7f89('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 77da482..79a9a44 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 _0x1fd7=['remove','update','length','faxAccount:','./faxAccount.events','save'];(function(_0x37a7ce,_0xeb36f9){var _0x3890c0=function(_0x170312){while(--_0x170312){_0x37a7ce['push'](_0x37a7ce['shift']());}};_0x3890c0(++_0xeb36f9);}(_0x1fd7,0xb8));var _0x71fd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1fd7[_0x3dd15e];return _0x231fd0;};'use strict';var FaxAccountEvents=require(_0x71fd('0x0'));var events=[_0x71fd('0x1'),_0x71fd('0x2'),_0x71fd('0x3')];function createListener(_0x10d3d5,_0x296c6e){return function(_0x24bd73){_0x296c6e['emit'](_0x10d3d5,_0x24bd73);};}function removeListener(_0x2a372d,_0x44d2a8){return function(){FaxAccountEvents['removeListener'](_0x2a372d,_0x44d2a8);};}exports['register']=function(_0x2e15e4){for(var _0x48aac2=0x0,_0x22d8da=events[_0x71fd('0x4')];_0x48aac2<_0x22d8da;_0x48aac2++){var _0x243860=events[_0x48aac2];var _0x170b41=createListener(_0x71fd('0x5')+_0x243860,_0x2e15e4);FaxAccountEvents['on'](_0x243860,_0x170b41);}}; \ No newline at end of file +var _0x3a6b=['removeListener','register','length','faxAccount:','./faxAccount.events','save','remove','emit'];(function(_0x58f011,_0x2eb3a1){var _0x595ee9=function(_0x2e2210){while(--_0x2e2210){_0x58f011['push'](_0x58f011['shift']());}};_0x595ee9(++_0x2eb3a1);}(_0x3a6b,0x17c));var _0xb3a6=function(_0x37f6c1,_0x4bb27f){_0x37f6c1=_0x37f6c1-0x0;var _0x48cc51=_0x3a6b[_0x37f6c1];return _0x48cc51;};'use strict';var FaxAccountEvents=require(_0xb3a6('0x0'));var events=[_0xb3a6('0x1'),_0xb3a6('0x2'),'update'];function createListener(_0xb93e31,_0x9edb1b){return function(_0x2d4bc8){_0x9edb1b[_0xb3a6('0x3')](_0xb93e31,_0x2d4bc8);};}function removeListener(_0x3e3b25,_0x1262c9){return function(){FaxAccountEvents[_0xb3a6('0x4')](_0x3e3b25,_0x1262c9);};}exports[_0xb3a6('0x5')]=function(_0x13a618){for(var _0x31ef19=0x0,_0x357447=events[_0xb3a6('0x6')];_0x31ef19<_0x357447;_0x31ef19++){var _0xb255b2=events[_0x31ef19];var _0x23f583=createListener(_0xb3a6('0x7')+_0xb255b2,_0x13a618);FaxAccountEvents['on'](_0xb255b2,_0x23f583);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 17a7139..f91efb7 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 _0x5d0d=['getAnswers','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','post','create','/:id/dispositions','/:id/canned_answers','addInteraction','addApplications','/addaccountapplications','addAccountApplications','updateAccountApplications','send','update','delete','removeDispositions','removeAnswers','removeAgents','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x1b906b,_0x256e70){var _0x51521c=function(_0x3c7d8d){while(--_0x3c7d8d){_0x1b906b['push'](_0x1b906b['shift']());}};_0x51521c(++_0x256e70);}(_0x5d0d,0x11a));var _0xd5d0=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0x5d0d[_0x1a9204];return _0x17ca68;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd5d0('0x0'));var timeout=require('connect-timeout');var express=require(_0xd5d0('0x1'));var router=express[_0xd5d0('0x2')]();var fs_extra=require(_0xd5d0('0x3'));var auth=require(_0xd5d0('0x4'));var interaction=require(_0xd5d0('0x5'));var config=require(_0xd5d0('0x6'));var controller=require('./faxAccount.controller');router[_0xd5d0('0x7')]('/',auth['isAuthenticated'](),controller[_0xd5d0('0x8')]);router[_0xd5d0('0x7')](_0xd5d0('0x9'),auth[_0xd5d0('0xa')](),controller[_0xd5d0('0xb')]);router[_0xd5d0('0x7')](_0xd5d0('0xc'),auth[_0xd5d0('0xa')](),controller[_0xd5d0('0xd')]);router['get']('/:id/dispositions',auth[_0xd5d0('0xa')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xd5d0('0xe')]);router[_0xd5d0('0x7')](_0xd5d0('0xf'),auth[_0xd5d0('0xa')](),controller['getInteractions']);router[_0xd5d0('0x7')](_0xd5d0('0x10'),auth[_0xd5d0('0xa')](),controller[_0xd5d0('0x11')]);router['get'](_0xd5d0('0x12'),auth['isAuthenticated'](),controller[_0xd5d0('0x13')]);router['get'](_0xd5d0('0x14'),auth['isAuthenticated'](),controller['getAgents']);router[_0xd5d0('0x15')]('/',auth[_0xd5d0('0xa')](),controller[_0xd5d0('0x16')]);router[_0xd5d0('0x15')](_0xd5d0('0x17'),auth[_0xd5d0('0xa')](),controller['addDisposition']);router[_0xd5d0('0x15')](_0xd5d0('0x18'),auth[_0xd5d0('0xa')](),controller['addAnswer']);router[_0xd5d0('0x15')](_0xd5d0('0xf'),auth[_0xd5d0('0xa')](),controller[_0xd5d0('0x19')]);router[_0xd5d0('0x15')](_0xd5d0('0x10'),auth[_0xd5d0('0xa')](),controller[_0xd5d0('0x1a')]);router[_0xd5d0('0x15')](_0xd5d0('0x1b'),auth[_0xd5d0('0xa')](),controller[_0xd5d0('0x1c')]);router[_0xd5d0('0x15')]('/updateaccountapplications',auth['isAuthenticated'](),controller[_0xd5d0('0x1d')]);router[_0xd5d0('0x15')]('/:id/send',auth['isAuthenticated'](),controller[_0xd5d0('0x1e')]);router[_0xd5d0('0x15')](_0xd5d0('0x14'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xd5d0('0xc'),auth[_0xd5d0('0xa')](),controller[_0xd5d0('0x1f')]);router[_0xd5d0('0x20')](_0xd5d0('0xc'),auth[_0xd5d0('0xa')](),controller['destroy']);router[_0xd5d0('0x20')](_0xd5d0('0x17'),auth[_0xd5d0('0xa')](),controller[_0xd5d0('0x21')]);router['delete'](_0xd5d0('0x18'),auth[_0xd5d0('0xa')](),controller[_0xd5d0('0x22')]);router[_0xd5d0('0x20')]('/:id/users',auth[_0xd5d0('0xa')](),controller[_0xd5d0('0x23')]);module[_0xd5d0('0x24')]=router; \ No newline at end of file +var _0x550a=['getAnswers','getInteractions','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','/:id/interactions','addInteraction','/:id/applications','addApplications','/addaccountapplications','addAccountApplications','updateAccountApplications','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','/describe','describe','/:id','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/canned_answers'];(function(_0x18959e,_0x264a6d){var _0x44c08b=function(_0x5f099a){while(--_0x5f099a){_0x18959e['push'](_0x18959e['shift']());}};_0x44c08b(++_0x264a6d);}(_0x550a,0x74));var _0xa550=function(_0x54d703,_0x14d701){_0x54d703=_0x54d703-0x0;var _0x4a727c=_0x550a[_0x54d703];return _0x4a727c;};'use strict';var multer=require(_0xa550('0x0'));var util=require(_0xa550('0x1'));var path=require(_0xa550('0x2'));var timeout=require(_0xa550('0x3'));var express=require(_0xa550('0x4'));var router=express[_0xa550('0x5')]();var fs_extra=require(_0xa550('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa550('0x7'));var config=require(_0xa550('0x8'));var controller=require(_0xa550('0x9'));router[_0xa550('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa550('0xa')](_0xa550('0xb'),auth['isAuthenticated'](),controller[_0xa550('0xc')]);router[_0xa550('0xa')](_0xa550('0xd'),auth['isAuthenticated'](),controller[_0xa550('0xe')]);router[_0xa550('0xa')](_0xa550('0xf'),auth[_0xa550('0x10')](),controller[_0xa550('0x11')]);router[_0xa550('0xa')](_0xa550('0x12'),auth['isAuthenticated'](),controller[_0xa550('0x13')]);router[_0xa550('0xa')]('/:id/interactions',auth[_0xa550('0x10')](),controller[_0xa550('0x14')]);router[_0xa550('0xa')]('/:id/applications',auth[_0xa550('0x10')](),controller[_0xa550('0x15')]);router['get'](_0xa550('0x16'),auth[_0xa550('0x10')](),controller[_0xa550('0x17')]);router[_0xa550('0xa')](_0xa550('0x18'),auth['isAuthenticated'](),controller[_0xa550('0x19')]);router[_0xa550('0x1a')]('/',auth[_0xa550('0x10')](),controller[_0xa550('0x1b')]);router['post'](_0xa550('0xf'),auth['isAuthenticated'](),controller[_0xa550('0x1c')]);router[_0xa550('0x1a')](_0xa550('0x12'),auth[_0xa550('0x10')](),controller['addAnswer']);router[_0xa550('0x1a')](_0xa550('0x1d'),auth['isAuthenticated'](),controller[_0xa550('0x1e')]);router[_0xa550('0x1a')](_0xa550('0x1f'),auth[_0xa550('0x10')](),controller[_0xa550('0x20')]);router['post'](_0xa550('0x21'),auth['isAuthenticated'](),controller[_0xa550('0x22')]);router[_0xa550('0x1a')]('/updateaccountapplications',auth[_0xa550('0x10')](),controller[_0xa550('0x23')]);router[_0xa550('0x1a')]('/:id/send',auth[_0xa550('0x10')](),controller['send']);router[_0xa550('0x1a')](_0xa550('0x18'),auth[_0xa550('0x10')](),controller[_0xa550('0x24')]);router[_0xa550('0x25')](_0xa550('0xd'),auth['isAuthenticated'](),controller[_0xa550('0x26')]);router[_0xa550('0x27')](_0xa550('0xd'),auth[_0xa550('0x10')](),controller[_0xa550('0x28')]);router[_0xa550('0x27')](_0xa550('0xf'),auth[_0xa550('0x10')](),controller[_0xa550('0x29')]);router[_0xa550('0x27')](_0xa550('0x12'),auth[_0xa550('0x10')](),controller[_0xa550('0x2a')]);router[_0xa550('0x27')]('/:id/users',auth[_0xa550('0x10')](),controller[_0xa550('0x2b')]);module[_0xa550('0x2c')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index ea9093a..547cc8b 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 _0xad65=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x2091ff,_0x4f15e9){var _0x3bf8e8=function(_0x4b8368){while(--_0x4b8368){_0x2091ff['push'](_0x2091ff['shift']());}};_0x3bf8e8(++_0x4f15e9);}(_0xad65,0x16f));var _0x5ad6=function(_0x60f803,_0x2a2561){_0x60f803=_0x60f803-0x0;var _0x5a030c=_0xad65[_0x60f803];return _0x5a030c;};'use strict';var Sequelize=require(_0x5ad6('0x0'));module[_0x5ad6('0x1')]={'priority':{'type':Sequelize[_0x5ad6('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5ad6('0x3')],'allowNull':![],'defaultValue':_0x5ad6('0x4')},'appdata':{'type':Sequelize[_0x5ad6('0x5')]()},'description':{'type':Sequelize[_0x5ad6('0x3')]},'interval':{'type':Sequelize[_0x5ad6('0x3')],'defaultValue':_0x5ad6('0x6')}}; \ No newline at end of file +var _0xa0da=['noop','TEXT','sequelize','INTEGER','STRING'];(function(_0x3088f2,_0x20ef97){var _0x5f0d6c=function(_0xb5848c){while(--_0xb5848c){_0x3088f2['push'](_0x3088f2['shift']());}};_0x5f0d6c(++_0x20ef97);}(_0xa0da,0x7f));var _0xaa0d=function(_0x112a86,_0xee2e42){_0x112a86=_0x112a86-0x0;var _0x59aa69=_0xa0da[_0x112a86];return _0x59aa69;};'use strict';var Sequelize=require(_0xaa0d('0x0'));module['exports']={'priority':{'type':Sequelize[_0xaa0d('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xaa0d('0x2')],'allowNull':![],'defaultValue':_0xaa0d('0x3')},'appdata':{'type':Sequelize[_0xaa0d('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index d5f53c0..7a21e82 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 _0x3c02=['crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','FaxApplication','rawAttributes','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','update','body','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra'];(function(_0x557bef,_0x35ca22){var _0x1d8382=function(_0x543586){while(--_0x543586){_0x557bef['push'](_0x557bef['shift']());}};_0x1d8382(++_0x35ca22);}(_0x3c02,0x1ac));var _0x23c0=function(_0x1ebdc4,_0x4966e0){_0x1ebdc4=_0x1ebdc4-0x0;var _0x42d363=_0x3c02[_0x1ebdc4];return _0x42d363;};'use strict';var emlformat=require(_0x23c0('0x0'));var rimraf=require(_0x23c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x23c0('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x23c0('0x3'));var Mustache=require(_0x23c0('0x4'));var util=require(_0x23c0('0x5'));var path=require(_0x23c0('0x6'));var sox=require(_0x23c0('0x7'));var csv=require(_0x23c0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x23c0('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x23c0('0xa'));var jsforce=require(_0x23c0('0xb'));var deskjs=require(_0x23c0('0xc'));var toCsv=require('to-csv');var querystring=require(_0x23c0('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x23c0('0xe'));var qs=require(_0x23c0('0xf'));var as=require(_0x23c0('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x23c0('0x11'))(_0x23c0('0x12'));var utils=require(_0x23c0('0x13'));var config=require(_0x23c0('0x14'));var licenseUtil=require(_0x23c0('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55530d,_0x59bb42){_0x59bb42=_0x59bb42||0xcc;return function(_0x3aea94){if(_0x3aea94){return _0x55530d['sendStatus'](_0x59bb42);}return _0x55530d['status'](_0x59bb42)[_0x23c0('0x16')]();};}function respondWithResult(_0x4a4131,_0x1016b5){_0x1016b5=_0x1016b5||0xc8;return function(_0x52e645){if(_0x52e645){return _0x4a4131[_0x23c0('0x17')](_0x1016b5)[_0x23c0('0x18')](_0x52e645);}};}function respondWithFilteredResult(_0x2001bd,_0x120e2b){return function(_0xb4f1c9){if(_0xb4f1c9){var _0x283195=typeof _0x120e2b[_0x23c0('0x19')]===_0x23c0('0x1a')&&typeof _0x120e2b[_0x23c0('0x1b')]===_0x23c0('0x1a');var _0x2dde16=_0xb4f1c9[_0x23c0('0x1c')];var _0x1c4d62=_0x283195?0x0:_0x120e2b[_0x23c0('0x19')];var _0x497d29=_0x283195?_0xb4f1c9[_0x23c0('0x1c')]:_0x120e2b[_0x23c0('0x19')]+_0x120e2b[_0x23c0('0x1b')];var _0x5dea82;if(_0x497d29>=_0x2dde16){_0x497d29=_0x2dde16;_0x5dea82=0xc8;}else{_0x5dea82=0xce;}_0x2001bd[_0x23c0('0x17')](_0x5dea82);return _0x2001bd[_0x23c0('0x1d')](_0x23c0('0x1e'),_0x1c4d62+'-'+_0x497d29+'/'+_0x2dde16)[_0x23c0('0x18')](_0xb4f1c9);}return null;};}function patchUpdates(_0x47943b){return function(_0x48fbe8){try{jsonpatch['apply'](_0x48fbe8,_0x47943b,!![]);}catch(_0x16997e){return BPromise[_0x23c0('0x1f')](_0x16997e);}return _0x48fbe8[_0x23c0('0x20')]();};}function saveUpdates(_0x50c7a7,_0x499111){return function(_0x49f876){if(_0x49f876){return _0x49f876['update'](_0x50c7a7)[_0x23c0('0x21')](function(_0x1f6330){return _0x1f6330;});}return null;};}function removeEntity(_0x415544,_0x372cb8){return function(_0x22b10d){if(_0x22b10d){return _0x22b10d[_0x23c0('0x22')]()[_0x23c0('0x21')](function(){_0x415544['status'](0xcc)[_0x23c0('0x16')]();});}};}function handleEntityNotFound(_0xb27100,_0x439c68){return function(_0x1cbc24){if(!_0x1cbc24){_0xb27100[_0x23c0('0x23')](0x194);}return _0x1cbc24;};}function handleError(_0x2a4c2d,_0x4bef46){_0x4bef46=_0x4bef46||0x1f4;return function(_0xe89fb4){logger[_0x23c0('0x24')](_0xe89fb4[_0x23c0('0x25')]);if(_0xe89fb4[_0x23c0('0x26')]){delete _0xe89fb4[_0x23c0('0x26')];}_0x2a4c2d[_0x23c0('0x17')](_0x4bef46)[_0x23c0('0x27')](_0xe89fb4);};}exports[_0x23c0('0x28')]=function(_0x8e3702,_0x544e24){var _0x193249={},_0x5b067a={},_0x1b8a3d={'count':0x0,'rows':[]};var _0xe96222=_[_0x23c0('0x29')](db[_0x23c0('0x2a')][_0x23c0('0x2b')],function(_0x5b2f5b){return{'name':_0x5b2f5b['fieldName'],'type':_0x5b2f5b[_0x23c0('0x2c')]['key']};});_0x5b067a[_0x23c0('0x2d')]=_[_0x23c0('0x29')](_0xe96222,_0x23c0('0x26'));_0x5b067a[_0x23c0('0x2e')]=_['keys'](_0x8e3702[_0x23c0('0x2e')]);_0x5b067a['filters']=_[_0x23c0('0x2f')](_0x5b067a[_0x23c0('0x2d')],_0x5b067a[_0x23c0('0x2e')]);_0x193249[_0x23c0('0x30')]=_[_0x23c0('0x2f')](_0x5b067a['model'],qs[_0x23c0('0x31')](_0x8e3702[_0x23c0('0x2e')][_0x23c0('0x31')]));_0x193249[_0x23c0('0x30')]=_0x193249[_0x23c0('0x30')][_0x23c0('0x32')]?_0x193249[_0x23c0('0x30')]:_0x5b067a['model'];if(!_0x8e3702[_0x23c0('0x2e')][_0x23c0('0x33')](_0x23c0('0x34'))){_0x193249['limit']=qs[_0x23c0('0x1b')](_0x8e3702['query'][_0x23c0('0x1b')]);_0x193249[_0x23c0('0x19')]=qs[_0x23c0('0x19')](_0x8e3702[_0x23c0('0x2e')][_0x23c0('0x19')]);}_0x193249[_0x23c0('0x35')]=qs[_0x23c0('0x36')](_0x8e3702[_0x23c0('0x2e')][_0x23c0('0x36')]);_0x193249[_0x23c0('0x37')]=qs[_0x23c0('0x38')](_[_0x23c0('0x39')](_0x8e3702[_0x23c0('0x2e')],_0x5b067a[_0x23c0('0x38')]),_0xe96222);if(_0x8e3702[_0x23c0('0x2e')][_0x23c0('0x3a')]){_0x193249[_0x23c0('0x37')]=_[_0x23c0('0x3b')](_0x193249[_0x23c0('0x37')],{'$or':_[_0x23c0('0x29')](_0xe96222,function(_0x2f929f){if(_0x2f929f[_0x23c0('0x2c')]!==_0x23c0('0x3c')){var _0x823fb={};_0x823fb[_0x2f929f[_0x23c0('0x26')]]={'$like':'%'+_0x8e3702[_0x23c0('0x2e')][_0x23c0('0x3a')]+'%'};return _0x823fb;}})});}_0x193249=_['merge']({},_0x193249,_0x8e3702[_0x23c0('0x3d')]);var _0x30574f={'where':_0x193249[_0x23c0('0x37')]};return db[_0x23c0('0x2a')][_0x23c0('0x1c')](_0x30574f)[_0x23c0('0x21')](function(_0x5729b2){_0x1b8a3d[_0x23c0('0x1c')]=_0x5729b2;if(_0x8e3702['query'][_0x23c0('0x3e')]){_0x193249[_0x23c0('0x3f')]=[{'all':!![]}];}return db[_0x23c0('0x2a')]['findAll'](_0x193249);})[_0x23c0('0x21')](function(_0x1f5f56){_0x1b8a3d[_0x23c0('0x40')]=_0x1f5f56;return _0x1b8a3d;})['then'](respondWithFilteredResult(_0x544e24,_0x193249))[_0x23c0('0x41')](handleError(_0x544e24,null));};exports[_0x23c0('0x42')]=function(_0x165a51,_0x42df17){var _0x957d52={'raw':!![],'where':{'id':_0x165a51[_0x23c0('0x43')]['id']}},_0x247ec8={};_0x247ec8[_0x23c0('0x2d')]=_['keys'](db[_0x23c0('0x2a')][_0x23c0('0x2b')]);_0x247ec8['query']=_[_0x23c0('0x44')](_0x165a51[_0x23c0('0x2e')]);_0x247ec8[_0x23c0('0x38')]=_[_0x23c0('0x2f')](_0x247ec8[_0x23c0('0x2d')],_0x247ec8[_0x23c0('0x2e')]);_0x957d52[_0x23c0('0x30')]=_[_0x23c0('0x2f')](_0x247ec8[_0x23c0('0x2d')],qs[_0x23c0('0x31')](_0x165a51['query']['fields']));_0x957d52[_0x23c0('0x30')]=_0x957d52[_0x23c0('0x30')][_0x23c0('0x32')]?_0x957d52[_0x23c0('0x30')]:_0x247ec8[_0x23c0('0x2d')];if(_0x165a51[_0x23c0('0x2e')][_0x23c0('0x3e')]){_0x957d52[_0x23c0('0x3f')]=[{'all':!![]}];}_0x957d52=_[_0x23c0('0x3b')]({},_0x957d52,_0x165a51[_0x23c0('0x3d')]);return db['FaxApplication'][_0x23c0('0x45')](_0x957d52)['then'](handleEntityNotFound(_0x42df17,null))[_0x23c0('0x21')](respondWithResult(_0x42df17,null))[_0x23c0('0x41')](handleError(_0x42df17,null));};exports[_0x23c0('0x46')]=function(_0x2bb062,_0x13d5e5){return db[_0x23c0('0x2a')]['create'](_0x2bb062['body'],{})[_0x23c0('0x21')](respondWithResult(_0x13d5e5,0xc9))[_0x23c0('0x41')](handleError(_0x13d5e5,null));};exports[_0x23c0('0x47')]=function(_0x5d974d,_0x440d32){if(_0x5d974d[_0x23c0('0x48')]['id']){delete _0x5d974d[_0x23c0('0x48')]['id'];}return db[_0x23c0('0x2a')][_0x23c0('0x45')]({'where':{'id':_0x5d974d[_0x23c0('0x43')]['id']}})[_0x23c0('0x21')](handleEntityNotFound(_0x440d32,null))['then'](saveUpdates(_0x5d974d['body'],null))[_0x23c0('0x21')](respondWithResult(_0x440d32,null))['catch'](handleError(_0x440d32,null));};exports[_0x23c0('0x22')]=function(_0x308959,_0x287cb5){return db[_0x23c0('0x2a')][_0x23c0('0x45')]({'where':{'id':_0x308959[_0x23c0('0x43')]['id']}})[_0x23c0('0x21')](handleEntityNotFound(_0x287cb5,null))[_0x23c0('0x21')](removeEntity(_0x287cb5,null))['catch'](handleError(_0x287cb5,null));}; \ No newline at end of file +var _0x7b45=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x2bcddb,_0x3eaf37){var _0x12a9e8=function(_0xeeb678){while(--_0xeeb678){_0x2bcddb['push'](_0x2bcddb['shift']());}};_0x12a9e8(++_0x3eaf37);}(_0x7b45,0x1b6));var _0x57b4=function(_0x3e6d72,_0x429cb2){_0x3e6d72=_0x3e6d72-0x0;var _0x9332fd=_0x7b45[_0x3e6d72];return _0x9332fd;};'use strict';var emlformat=require(_0x57b4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x57b4('0x1'));var jsonpatch=require(_0x57b4('0x2'));var rp=require('request-promise');var moment=require(_0x57b4('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x57b4('0x4'));var path=require(_0x57b4('0x5'));var sox=require(_0x57b4('0x6'));var csv=require(_0x57b4('0x7'));var ejs=require(_0x57b4('0x8'));var fs=require('fs');var fs_extra=require(_0x57b4('0x9'));var _=require(_0x57b4('0xa'));var squel=require(_0x57b4('0xb'));var crypto=require('crypto');var jsforce=require(_0x57b4('0xc'));var deskjs=require(_0x57b4('0xd'));var toCsv=require(_0x57b4('0x7'));var querystring=require(_0x57b4('0xe'));var Papa=require(_0x57b4('0xf'));var Redis=require(_0x57b4('0x10'));var authService=require(_0x57b4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x57b4('0x12'));var hardwareService=require(_0x57b4('0x13'));var logger=require(_0x57b4('0x14'))(_0x57b4('0x15'));var utils=require(_0x57b4('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x57b4('0x17'));var db=require(_0x57b4('0x18'))['db'];function respondWithStatusCode(_0x43e65a,_0x5339c0){_0x5339c0=_0x5339c0||0xcc;return function(_0x1fb83c){if(_0x1fb83c){return _0x43e65a[_0x57b4('0x19')](_0x5339c0);}return _0x43e65a['status'](_0x5339c0)[_0x57b4('0x1a')]();};}function respondWithResult(_0x2c38be,_0xdc9926){_0xdc9926=_0xdc9926||0xc8;return function(_0x3bcb4a){if(_0x3bcb4a){return _0x2c38be[_0x57b4('0x1b')](_0xdc9926)[_0x57b4('0x1c')](_0x3bcb4a);}};}function respondWithFilteredResult(_0x3e2b52,_0xe20384){return function(_0x5100f9){if(_0x5100f9){var _0x70c025=typeof _0xe20384[_0x57b4('0x1d')]===_0x57b4('0x1e')&&typeof _0xe20384[_0x57b4('0x1f')]===_0x57b4('0x1e');var _0x512054=_0x5100f9[_0x57b4('0x20')];var _0x502e4c=_0x70c025?0x0:_0xe20384[_0x57b4('0x1d')];var _0x1aa708=_0x70c025?_0x5100f9[_0x57b4('0x20')]:_0xe20384[_0x57b4('0x1d')]+_0xe20384[_0x57b4('0x1f')];var _0x578638;if(_0x1aa708>=_0x512054){_0x1aa708=_0x512054;_0x578638=0xc8;}else{_0x578638=0xce;}_0x3e2b52['status'](_0x578638);return _0x3e2b52[_0x57b4('0x21')](_0x57b4('0x22'),_0x502e4c+'-'+_0x1aa708+'/'+_0x512054)[_0x57b4('0x1c')](_0x5100f9);}return null;};}function patchUpdates(_0x4fbfa6){return function(_0x3134d2){try{jsonpatch['apply'](_0x3134d2,_0x4fbfa6,!![]);}catch(_0x5503a7){return BPromise['reject'](_0x5503a7);}return _0x3134d2[_0x57b4('0x23')]();};}function saveUpdates(_0x1351f5,_0x5c4273){return function(_0x2f04ce){if(_0x2f04ce){return _0x2f04ce[_0x57b4('0x24')](_0x1351f5)[_0x57b4('0x25')](function(_0x55e41d){return _0x55e41d;});}return null;};}function removeEntity(_0x2e3ab9,_0x2f1cbd){return function(_0x33c69c){if(_0x33c69c){return _0x33c69c['destroy']()[_0x57b4('0x25')](function(){_0x2e3ab9[_0x57b4('0x1b')](0xcc)[_0x57b4('0x1a')]();});}};}function handleEntityNotFound(_0x1c180a,_0x38c511){return function(_0x2fc8c7){if(!_0x2fc8c7){_0x1c180a[_0x57b4('0x19')](0x194);}return _0x2fc8c7;};}function handleError(_0x161a46,_0x2f6a14){_0x2f6a14=_0x2f6a14||0x1f4;return function(_0x1b87bd){logger[_0x57b4('0x26')](_0x1b87bd[_0x57b4('0x27')]);if(_0x1b87bd['name']){delete _0x1b87bd[_0x57b4('0x28')];}_0x161a46[_0x57b4('0x1b')](_0x2f6a14)[_0x57b4('0x29')](_0x1b87bd);};}exports[_0x57b4('0x2a')]=function(_0x14cdc5,_0x20d61e){var _0x1556ef={},_0x4b81d4={},_0x405402={'count':0x0,'rows':[]};var _0x1b2edd=_[_0x57b4('0x2b')](db[_0x57b4('0x2c')][_0x57b4('0x2d')],function(_0x5ca60f){return{'name':_0x5ca60f[_0x57b4('0x2e')],'type':_0x5ca60f[_0x57b4('0x2f')]['key']};});_0x4b81d4['model']=_[_0x57b4('0x2b')](_0x1b2edd,_0x57b4('0x28'));_0x4b81d4[_0x57b4('0x30')]=_[_0x57b4('0x31')](_0x14cdc5[_0x57b4('0x30')]);_0x4b81d4['filters']=_[_0x57b4('0x32')](_0x4b81d4[_0x57b4('0x33')],_0x4b81d4[_0x57b4('0x30')]);_0x1556ef[_0x57b4('0x34')]=_['intersection'](_0x4b81d4['model'],qs[_0x57b4('0x35')](_0x14cdc5[_0x57b4('0x30')][_0x57b4('0x35')]));_0x1556ef[_0x57b4('0x34')]=_0x1556ef['attributes'][_0x57b4('0x36')]?_0x1556ef[_0x57b4('0x34')]:_0x4b81d4['model'];if(!_0x14cdc5[_0x57b4('0x30')][_0x57b4('0x37')]('nolimit')){_0x1556ef[_0x57b4('0x1f')]=qs[_0x57b4('0x1f')](_0x14cdc5[_0x57b4('0x30')][_0x57b4('0x1f')]);_0x1556ef[_0x57b4('0x1d')]=qs[_0x57b4('0x1d')](_0x14cdc5['query'][_0x57b4('0x1d')]);}_0x1556ef[_0x57b4('0x38')]=qs['sort'](_0x14cdc5[_0x57b4('0x30')][_0x57b4('0x39')]);_0x1556ef[_0x57b4('0x3a')]=qs[_0x57b4('0x3b')](_[_0x57b4('0x3c')](_0x14cdc5[_0x57b4('0x30')],_0x4b81d4['filters']),_0x1b2edd);if(_0x14cdc5[_0x57b4('0x30')]['filter']){_0x1556ef[_0x57b4('0x3a')]=_[_0x57b4('0x3d')](_0x1556ef['where'],{'$or':_['map'](_0x1b2edd,function(_0x5b6228){if(_0x5b6228['type']!==_0x57b4('0x3e')){var _0x31b1c9={};_0x31b1c9[_0x5b6228[_0x57b4('0x28')]]={'$like':'%'+_0x14cdc5['query'][_0x57b4('0x3f')]+'%'};return _0x31b1c9;}})});}_0x1556ef=_['merge']({},_0x1556ef,_0x14cdc5[_0x57b4('0x40')]);var _0x4e7a62={'where':_0x1556ef['where']};return db[_0x57b4('0x2c')][_0x57b4('0x20')](_0x4e7a62)[_0x57b4('0x25')](function(_0x26af02){_0x405402[_0x57b4('0x20')]=_0x26af02;if(_0x14cdc5[_0x57b4('0x30')][_0x57b4('0x41')]){_0x1556ef[_0x57b4('0x42')]=[{'all':!![]}];}return db['FaxApplication'][_0x57b4('0x43')](_0x1556ef);})['then'](function(_0x40efae){_0x405402['rows']=_0x40efae;return _0x405402;})['then'](respondWithFilteredResult(_0x20d61e,_0x1556ef))[_0x57b4('0x44')](handleError(_0x20d61e,null));};exports[_0x57b4('0x45')]=function(_0x20b62b,_0x32bc16){var _0x2a6b95={'raw':!![],'where':{'id':_0x20b62b[_0x57b4('0x46')]['id']}},_0x303843={};_0x303843[_0x57b4('0x33')]=_[_0x57b4('0x31')](db[_0x57b4('0x2c')]['rawAttributes']);_0x303843['query']=_[_0x57b4('0x31')](_0x20b62b[_0x57b4('0x30')]);_0x303843['filters']=_['intersection'](_0x303843[_0x57b4('0x33')],_0x303843[_0x57b4('0x30')]);_0x2a6b95[_0x57b4('0x34')]=_[_0x57b4('0x32')](_0x303843[_0x57b4('0x33')],qs[_0x57b4('0x35')](_0x20b62b[_0x57b4('0x30')][_0x57b4('0x35')]));_0x2a6b95[_0x57b4('0x34')]=_0x2a6b95[_0x57b4('0x34')][_0x57b4('0x36')]?_0x2a6b95[_0x57b4('0x34')]:_0x303843[_0x57b4('0x33')];if(_0x20b62b['query'][_0x57b4('0x41')]){_0x2a6b95[_0x57b4('0x42')]=[{'all':!![]}];}_0x2a6b95=_[_0x57b4('0x3d')]({},_0x2a6b95,_0x20b62b[_0x57b4('0x40')]);return db[_0x57b4('0x2c')][_0x57b4('0x47')](_0x2a6b95)[_0x57b4('0x25')](handleEntityNotFound(_0x32bc16,null))[_0x57b4('0x25')](respondWithResult(_0x32bc16,null))[_0x57b4('0x44')](handleError(_0x32bc16,null));};exports[_0x57b4('0x48')]=function(_0x43dce0,_0x42ee96){return db[_0x57b4('0x2c')][_0x57b4('0x48')](_0x43dce0[_0x57b4('0x49')],{})[_0x57b4('0x25')](respondWithResult(_0x42ee96,0xc9))[_0x57b4('0x44')](handleError(_0x42ee96,null));};exports[_0x57b4('0x24')]=function(_0x4917c8,_0x1e09cd){if(_0x4917c8[_0x57b4('0x49')]['id']){delete _0x4917c8[_0x57b4('0x49')]['id'];}return db[_0x57b4('0x2c')]['find']({'where':{'id':_0x4917c8[_0x57b4('0x46')]['id']}})[_0x57b4('0x25')](handleEntityNotFound(_0x1e09cd,null))[_0x57b4('0x25')](saveUpdates(_0x4917c8[_0x57b4('0x49')],null))[_0x57b4('0x25')](respondWithResult(_0x1e09cd,null))['catch'](handleError(_0x1e09cd,null));};exports[_0x57b4('0x4a')]=function(_0x433d6f,_0x517271){return db[_0x57b4('0x2c')][_0x57b4('0x47')]({'where':{'id':_0x433d6f[_0x57b4('0x46')]['id']}})[_0x57b4('0x25')](handleEntityNotFound(_0x517271,null))[_0x57b4('0x25')](removeEntity(_0x517271,null))[_0x57b4('0x44')](handleError(_0x517271,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 2b751e7..3ab4f03 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 _0x3289=['./faxApplication.attributes','exports','define','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x890600,_0x5e8f48){var _0x56ff6d=function(_0x3e1db0){while(--_0x3e1db0){_0x890600['push'](_0x890600['shift']());}};_0x56ff6d(++_0x5e8f48);}(_0x3289,0xad));var _0x9328=function(_0x42c9f0,_0x1ac906){_0x42c9f0=_0x42c9f0-0x0;var _0x27ffe5=_0x3289[_0x42c9f0];return _0x27ffe5;};'use strict';var _=require(_0x9328('0x0'));var util=require(_0x9328('0x1'));var logger=require(_0x9328('0x2'))(_0x9328('0x3'));var moment=require(_0x9328('0x4'));var BPromise=require(_0x9328('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9328('0x6'));var rimraf=require(_0x9328('0x7'));var config=require(_0x9328('0x8'));var attributes=require(_0x9328('0x9'));module[_0x9328('0xa')]=function(_0x204945,_0x59e45b){return _0x204945[_0x9328('0xb')]('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9328('0xc')});}; \ No newline at end of file +var _0x3ee6=['path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise'];(function(_0x91709,_0x536a5c){var _0x29157c=function(_0x261552){while(--_0x261552){_0x91709['push'](_0x91709['shift']());}};_0x29157c(++_0x536a5c);}(_0x3ee6,0x89));var _0x63ee=function(_0x355165,_0x2029cd){_0x355165=_0x355165-0x0;var _0x555f37=_0x3ee6[_0x355165];return _0x555f37;};'use strict';var _=require(_0x63ee('0x0'));var util=require(_0x63ee('0x1'));var logger=require('../../config/logger')(_0x63ee('0x2'));var moment=require(_0x63ee('0x3'));var BPromise=require(_0x63ee('0x4'));var rp=require(_0x63ee('0x5'));var fs=require('fs');var path=require(_0x63ee('0x6'));var rimraf=require(_0x63ee('0x7'));var config=require(_0x63ee('0x8'));var attributes=require(_0x63ee('0x9'));module[_0x63ee('0xa')]=function(_0xd5f742,_0xbf70d3){return _0xd5f742[_0x63ee('0xb')]('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x63ee('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index d7c1652..d1de750 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 _0x29a3=['jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxApplication','update','body','options','limit','debug','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xa9031,_0x12627f){var _0x3abbfe=function(_0x46f483){while(--_0x46f483){_0xa9031['push'](_0xa9031['shift']());}};_0x3abbfe(++_0x12627f);}(_0x29a3,0x141));var _0x329a=function(_0x262323,_0x4a81f1){_0x262323=_0x262323-0x0;var _0xa963c3=_0x29a3[_0x262323];return _0xa963c3;};'use strict';var _=require(_0x329a('0x0'));var util=require(_0x329a('0x1'));var moment=require('moment');var BPromise=require(_0x329a('0x2'));var rs=require(_0x329a('0x3'));var fs=require('fs');var Redis=require(_0x329a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x329a('0x5'));var logger=require(_0x329a('0x6'))(_0x329a('0x7'));var config=require(_0x329a('0x8'));var jayson=require(_0x329a('0x9'));var client=jayson[_0x329a('0xa')][_0x329a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26047b,_0x183885,_0x4d008d){return new BPromise(function(_0x585371,_0xa50cb9){return client[_0x329a('0xc')](_0x26047b,_0x4d008d)[_0x329a('0xd')](function(_0x3d9c0e){logger[_0x329a('0xe')](_0x329a('0xf'),_0x183885,_0x329a('0x10'));logger['debug'](_0x329a('0x11'),_0x183885,_0x329a('0x10'),JSON[_0x329a('0x12')](_0x3d9c0e));if(_0x3d9c0e[_0x329a('0x13')]){if(_0x3d9c0e[_0x329a('0x13')][_0x329a('0x14')]===0x1f4){logger[_0x329a('0x13')](_0x329a('0xf'),_0x183885,_0x3d9c0e[_0x329a('0x13')][_0x329a('0x15')]);return _0xa50cb9(_0x3d9c0e[_0x329a('0x13')][_0x329a('0x15')]);}logger[_0x329a('0x13')](_0x329a('0xf'),_0x183885,_0x3d9c0e[_0x329a('0x13')][_0x329a('0x15')]);return _0x585371(_0x3d9c0e['error']['message']);}else{logger['info'](_0x329a('0xf'),_0x183885,_0x329a('0x10'));_0x585371(_0x3d9c0e[_0x329a('0x16')][_0x329a('0x15')]);}})[_0x329a('0x17')](function(_0x1c5981){logger[_0x329a('0x13')](_0x329a('0xf'),_0x183885,_0x1c5981);_0xa50cb9(_0x1c5981);});});}exports[_0x329a('0x18')]=function(_0x285545){var _0x1e717a=this;return new Promise(function(_0x2a9be2,_0x30bd89){return db['FaxApplication'][_0x329a('0x19')](_0x285545[_0x329a('0x1a')],{'raw':_0x285545['options']?_0x285545['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x285545[_0x329a('0x1b')]?_0x285545[_0x329a('0x1b')]['where']||null:null,'attributes':_0x285545['options']?_0x285545[_0x329a('0x1b')]['attributes']||null:null,'limit':_0x285545[_0x329a('0x1b')]?_0x285545['options'][_0x329a('0x1c')]||null:null})[_0x329a('0xd')](function(_0x1fa051){logger[_0x329a('0xe')](_0x329a('0x18'),_0x285545);logger[_0x329a('0x1d')](_0x329a('0x18'),_0x285545,JSON[_0x329a('0x12')](_0x1fa051));_0x2a9be2(_0x1fa051);})[_0x329a('0x17')](function(_0x1d301d){logger['error']('UpdateFaxApplication',_0x1d301d[_0x329a('0x15')],_0x285545);_0x30bd89(_0x1e717a[_0x329a('0x13')](0x1f4,_0x1d301d[_0x329a('0x15')]));});});}; \ No newline at end of file +var _0x2707=['bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','body','options','raw','where','attributes','limit','UpdateFaxApplication','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2707,0x143));var _0x7270=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x2707[_0x556927];return _0x5f1235;};'use strict';var _=require(_0x7270('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7270('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7270('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7270('0x3'))(_0x7270('0x4'));var config=require(_0x7270('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x7270('0x6')][_0x7270('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x48481c,_0x1fdb3c,_0x2cb781){return new BPromise(function(_0x497e5f,_0x3dd7eb){return client[_0x7270('0x8')](_0x48481c,_0x2cb781)[_0x7270('0x9')](function(_0x4fe7eb){logger[_0x7270('0xa')](_0x7270('0xb'),_0x1fdb3c,_0x7270('0xc'));logger[_0x7270('0xd')](_0x7270('0xe'),_0x1fdb3c,'request\x20sent',JSON[_0x7270('0xf')](_0x4fe7eb));if(_0x4fe7eb[_0x7270('0x10')]){if(_0x4fe7eb['error']['code']===0x1f4){logger['error'](_0x7270('0xb'),_0x1fdb3c,_0x4fe7eb[_0x7270('0x10')][_0x7270('0x11')]);return _0x3dd7eb(_0x4fe7eb[_0x7270('0x10')]['message']);}logger[_0x7270('0x10')](_0x7270('0xb'),_0x1fdb3c,_0x4fe7eb['error'][_0x7270('0x11')]);return _0x497e5f(_0x4fe7eb[_0x7270('0x10')]['message']);}else{logger['info']('FaxApplication,\x20%s,\x20%s',_0x1fdb3c,'request\x20sent');_0x497e5f(_0x4fe7eb[_0x7270('0x12')]['message']);}})[_0x7270('0x13')](function(_0x21bf70){logger[_0x7270('0x10')](_0x7270('0xb'),_0x1fdb3c,_0x21bf70);_0x3dd7eb(_0x21bf70);});});}exports['UpdateFaxApplication']=function(_0x4647c5){var _0x272126=this;return new Promise(function(_0x10e56f,_0x1728c9){return db['FaxApplication']['update'](_0x4647c5[_0x7270('0x14')],{'raw':_0x4647c5['options']?_0x4647c5[_0x7270('0x15')][_0x7270('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4647c5['options']?_0x4647c5['options'][_0x7270('0x17')]||null:null,'attributes':_0x4647c5[_0x7270('0x15')]?_0x4647c5[_0x7270('0x15')][_0x7270('0x18')]||null:null,'limit':_0x4647c5[_0x7270('0x15')]?_0x4647c5[_0x7270('0x15')][_0x7270('0x19')]||null:null})[_0x7270('0x9')](function(_0x19bb44){logger[_0x7270('0xa')](_0x7270('0x1a'),_0x4647c5);logger[_0x7270('0xd')](_0x7270('0x1a'),_0x4647c5,JSON['stringify'](_0x19bb44));_0x10e56f(_0x19bb44);})['catch'](function(_0x3bd86b){logger[_0x7270('0x10')](_0x7270('0x1a'),_0x3bd86b['message'],_0x4647c5);_0x1728c9(_0x272126['error'](0x1f4,_0x3bd86b['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 8dcae6b..997e734 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 _0x1775=['../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1e8afb,_0x478986){var _0x905a06=function(_0x52afac){while(--_0x52afac){_0x1e8afb['push'](_0x1e8afb['shift']());}};_0x905a06(++_0x478986);}(_0x1775,0x1db));var _0x5177=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1775[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0x5177('0x0'));var path=require(_0x5177('0x1'));var timeout=require(_0x5177('0x2'));var express=require(_0x5177('0x3'));var router=express[_0x5177('0x4')]();var fs_extra=require(_0x5177('0x5'));var auth=require(_0x5177('0x6'));var interaction=require(_0x5177('0x7'));var config=require(_0x5177('0x8'));var controller=require(_0x5177('0x9'));router[_0x5177('0xa')]('/',auth[_0x5177('0xb')](),controller[_0x5177('0xc')]);router[_0x5177('0xa')](_0x5177('0xd'),auth[_0x5177('0xb')](),controller[_0x5177('0xe')]);router[_0x5177('0xf')]('/',auth[_0x5177('0xb')](),controller[_0x5177('0x10')]);router[_0x5177('0x11')](_0x5177('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x5177('0x12')](_0x5177('0xd'),auth[_0x5177('0xb')](),controller[_0x5177('0x13')]);module[_0x5177('0x14')]=router; \ No newline at end of file +var _0x9354=['Router','fs-extra','../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','util','path','express'];(function(_0x5226cf,_0x1b6435){var _0x5dbfb6=function(_0x3818b1){while(--_0x3818b1){_0x5226cf['push'](_0x5226cf['shift']());}};_0x5dbfb6(++_0x1b6435);}(_0x9354,0x96));var _0x4935=function(_0x3c1312,_0x45bfdb){_0x3c1312=_0x3c1312-0x0;var _0x5b4831=_0x9354[_0x3c1312];return _0x5b4831;};'use strict';var multer=require('multer');var util=require(_0x4935('0x0'));var path=require(_0x4935('0x1'));var timeout=require('connect-timeout');var express=require(_0x4935('0x2'));var router=express[_0x4935('0x3')]();var fs_extra=require(_0x4935('0x4'));var auth=require(_0x4935('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4935('0x6'));var controller=require(_0x4935('0x7'));router[_0x4935('0x8')]('/',auth[_0x4935('0x9')](),controller[_0x4935('0xa')]);router[_0x4935('0x8')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xc')]);router['post']('/',auth[_0x4935('0x9')](),controller['create']);router[_0x4935('0xd')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xe')]);router[_0x4935('0xf')](_0x4935('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x4935('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 1f4b509..c8969ba 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 _0x1c9a=['STRING','DATE','ENUM','out','INTEGER','sequelize','BOOLEAN'];(function(_0x4c1d62,_0x5bb898){var _0x216680=function(_0xce4d5c){while(--_0xce4d5c){_0x4c1d62['push'](_0x4c1d62['shift']());}};_0x216680(++_0x5bb898);}(_0x1c9a,0x98));var _0xa1c9=function(_0x147d12,_0x141ea5){_0x147d12=_0x147d12-0x0;var _0x91b2=_0x1c9a[_0x147d12];return _0x91b2;};'use strict';var Sequelize=require(_0xa1c9('0x0'));module['exports']={'closed':{'type':Sequelize[_0xa1c9('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xa1c9('0x2')]},'secondDisposition':{'type':Sequelize[_0xa1c9('0x2')]},'thirdDisposition':{'type':Sequelize[_0xa1c9('0x2')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xa1c9('0x3')]},'fax':{'type':Sequelize[_0xa1c9('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xa1c9('0x4')]('in',_0xa1c9('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xa1c9('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xa1c9('0x6')]}}; \ No newline at end of file +var _0x4137=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER'];(function(_0x2134b7,_0x1eb5e2){var _0x6c5914=function(_0x1da201){while(--_0x1da201){_0x2134b7['push'](_0x2134b7['shift']());}};_0x6c5914(++_0x1eb5e2);}(_0x4137,0xf8));var _0x7413=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4137[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x7413('0x0'));module[_0x7413('0x1')]={'closed':{'type':Sequelize[_0x7413('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7413('0x3')]},'disposition':{'type':Sequelize[_0x7413('0x4')]},'secondDisposition':{'type':Sequelize[_0x7413('0x4')]},'thirdDisposition':{'type':Sequelize[_0x7413('0x4')]},'note':{'type':Sequelize[_0x7413('0x4')]},'read1stAt':{'type':Sequelize[_0x7413('0x3')]},'fax':{'type':Sequelize[_0x7413('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x7413('0x5')]('in',_0x7413('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x7413('0x5')]('in',_0x7413('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x7413('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 9f667b5..f46a432 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 _0x84db=['split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','push','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createWriteStream','resolve','log','err','unlinkSync','zip-dir','moment','bluebird','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','status','end','json','offset','undefined','limit','count','then','destroy','sendStatus','error','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','fax','query','user','catch','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','update','body','describe','addMessage','FaxMessage','omit','ids','hasOwnProperty','nolimit','sort','where','FaxInteractionId','$gte'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x84db,0x88));var _0xb84d=function(_0x207a6b,_0x153928){_0x207a6b=_0x207a6b-0x0;var _0x53ad5c=_0x84db[_0x207a6b];return _0x53ad5c;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xb84d('0x0'));var moment=require(_0xb84d('0x1'));var BPromise=require(_0xb84d('0x2'));var util=require('util');var path=require('path');var fs=require('fs');var _=require('lodash');var Redis=require(_0xb84d('0x3'));var interaction=require(_0xb84d('0x4'));var qs=require(_0xb84d('0x5'));var logger=require(_0xb84d('0x6'))(_0xb84d('0x7'));var config=require(_0xb84d('0x8'));var db=require(_0xb84d('0x9'))['db'];config[_0xb84d('0xa')]=_[_0xb84d('0xb')](config['redis'],{'host':_0xb84d('0xc'),'port':0x18eb});var socket=require(_0xb84d('0xd'))(new Redis(config[_0xb84d('0xa')]));require(_0xb84d('0xe'))[_0xb84d('0xf')](socket);function respondWithStatusCode(_0x253c82,_0x45d28d){_0x45d28d=_0x45d28d||0xcc;return function(_0x30b5d6){if(_0x30b5d6){return _0x253c82['sendStatus'](_0x45d28d);}return _0x253c82[_0xb84d('0x10')](_0x45d28d)[_0xb84d('0x11')]();};}function respondWithResult(_0x595bd5,_0xec89e6){_0xec89e6=_0xec89e6||0xc8;return function(_0x53a15f){if(_0x53a15f){return _0x595bd5[_0xb84d('0x10')](_0xec89e6)[_0xb84d('0x12')](_0x53a15f);}};}function respondWithFilteredResult(_0xdd7378,_0xb28ad9){return function(_0x3350ec){if(_0x3350ec){var _0x38ec70=typeof _0xb28ad9[_0xb84d('0x13')]===_0xb84d('0x14')&&typeof _0xb28ad9[_0xb84d('0x15')]==='undefined';var _0x718df4=_0x3350ec[_0xb84d('0x16')];var _0x1301f1=_0x38ec70?0x0:_0xb28ad9[_0xb84d('0x13')];var _0x5b1e36=_0x38ec70?_0x3350ec[_0xb84d('0x16')]:_0xb28ad9[_0xb84d('0x13')]+_0xb28ad9[_0xb84d('0x15')];var _0x41290f;if(_0x5b1e36>=_0x718df4){_0x5b1e36=_0x718df4;_0x41290f=0xc8;}else{_0x41290f=0xce;}_0xdd7378['status'](_0x41290f);return _0xdd7378['set']('Content-Range',_0x1301f1+'-'+_0x5b1e36+'/'+_0x718df4)[_0xb84d('0x12')](_0x3350ec);}return null;};}function saveUpdates(_0x3a20d7){return function(_0x2e20de){if(_0x2e20de){return _0x2e20de['update'](_0x3a20d7)[_0xb84d('0x17')](function(_0x4e8d6c){return _0x4e8d6c;});}return null;};}function removeEntity(_0x30cc77){return function(_0x3af4e0){if(_0x3af4e0){return _0x3af4e0[_0xb84d('0x18')]()[_0xb84d('0x17')](function(){_0x30cc77[_0xb84d('0x10')](0xcc)[_0xb84d('0x11')]();});}};}function handleEntityNotFound(_0x3003b9){return function(_0xccd4cf){if(!_0xccd4cf){_0x3003b9[_0xb84d('0x19')](0x194);}return _0xccd4cf;};}function handleError(_0x14d676,_0x1d28eb){_0x1d28eb=_0x1d28eb||0x1f4;return function(_0x375d7d){logger[_0xb84d('0x1a')](_0x375d7d[_0xb84d('0x1b')]);if(_0x375d7d['name']){delete _0x375d7d[_0xb84d('0x1c')];}_0x14d676[_0xb84d('0x10')](_0x1d28eb)[_0xb84d('0x1d')](_0x375d7d);};}exports[_0xb84d('0x1e')]=function(_0x55fb16,_0x161895){var _0x1c3ad0={};var _0x3ed3c4=_[_0xb84d('0x1f')](db[_0xb84d('0x20')][_0xb84d('0x21')],function(_0x539c25){return{'name':_0x539c25[_0xb84d('0x22')],'type':_0x539c25[_0xb84d('0x23')][_0xb84d('0x24')]};});_0x1c3ad0=qs[_0xb84d('0x25')](_0x3ed3c4,_0x55fb16);return interaction[_0xb84d('0x26')](_0xb84d('0x27'),_0x55fb16[_0xb84d('0x28')],_0x55fb16[_0xb84d('0x29')],_0x1c3ad0,_0x3ed3c4)[_0xb84d('0x17')](respondWithFilteredResult(_0x161895,_0x1c3ad0))[_0xb84d('0x2a')](handleError(_0x161895,null));};exports['show']=function(_0x2ab351,_0xdab156){var _0x16e309={'raw':![],'where':{'id':_0x2ab351[_0xb84d('0x2b')]['id']}},_0xa21ce5={};_0xa21ce5[_0xb84d('0x2c')]=_[_0xb84d('0x2d')](db['FaxInteraction'][_0xb84d('0x21')]);_0xa21ce5['query']=_[_0xb84d('0x2d')](_0x2ab351[_0xb84d('0x28')]);_0xa21ce5[_0xb84d('0x2e')]=_[_0xb84d('0x2f')](_0xa21ce5['model'],_0xa21ce5[_0xb84d('0x28')]);_0x16e309[_0xb84d('0x30')]=_['intersection'](_0xa21ce5['model'],qs[_0xb84d('0x31')](_0x2ab351[_0xb84d('0x28')][_0xb84d('0x31')]));_0x16e309['attributes']=_0x16e309[_0xb84d('0x30')][_0xb84d('0x32')]?_0x16e309['attributes']:_0xa21ce5['model'];if(_0x2ab351['query'][_0xb84d('0x33')]){_0x16e309[_0xb84d('0x34')]=[{'all':!![]}];}_0x16e309=_[_0xb84d('0x35')]({},_0x16e309,_0x2ab351[_0xb84d('0x36')]);return db[_0xb84d('0x20')][_0xb84d('0x37')](_0x16e309)['then'](handleEntityNotFound(_0xdab156,null))[_0xb84d('0x17')](respondWithResult(_0xdab156,null))['catch'](handleError(_0xdab156,null));};exports[_0xb84d('0x38')]=function(_0x552449,_0x5cb575){return db['FaxInteraction'][_0xb84d('0x38')](_0x552449['body'],{})[_0xb84d('0x17')](respondWithResult(_0x5cb575,0xc9))[_0xb84d('0x2a')](handleError(_0x5cb575,null));};exports[_0xb84d('0x39')]=function(_0x2d259f,_0x4075d7){if(_0x2d259f[_0xb84d('0x3a')]['id']){delete _0x2d259f['body']['id'];}return db[_0xb84d('0x20')][_0xb84d('0x37')]({'where':{'id':_0x2d259f[_0xb84d('0x2b')]['id']}})[_0xb84d('0x17')](handleEntityNotFound(_0x4075d7,null))[_0xb84d('0x17')](saveUpdates(_0x2d259f['body'],null))[_0xb84d('0x17')](respondWithResult(_0x4075d7,null))[_0xb84d('0x2a')](handleError(_0x4075d7,null));};exports['destroy']=function(_0x203471,_0x5602c7){return db[_0xb84d('0x20')][_0xb84d('0x37')]({'where':{'id':_0x203471[_0xb84d('0x2b')]['id']}})[_0xb84d('0x17')](handleEntityNotFound(_0x5602c7,null))[_0xb84d('0x17')](removeEntity(_0x5602c7,null))[_0xb84d('0x2a')](handleError(_0x5602c7,null));};exports['describe']=function(_0xfed7a6,_0x57057e){return db['FaxInteraction'][_0xb84d('0x3b')]()[_0xb84d('0x17')](respondWithResult(_0x57057e,null))[_0xb84d('0x2a')](handleError(_0x57057e,null));};exports[_0xb84d('0x3c')]=function(_0x4c61e1,_0x592c06){return db[_0xb84d('0x3d')]['find']({'where':{'id':_0x4c61e1[_0xb84d('0x2b')]['id']}})[_0xb84d('0x17')](handleEntityNotFound(_0x592c06,null))['then'](function(_0x288525){if(_0x288525){return _0x288525['addMessage'](_0x4c61e1[_0xb84d('0x3a')]['ids'],_[_0xb84d('0x3e')](_0x4c61e1['body'],[_0xb84d('0x3f'),'id'])||{});}})[_0xb84d('0x17')](respondWithResult(_0x592c06,null))['catch'](handleError(_0x592c06,null));};exports['getMessages']=function(_0x414117,_0x493272){var _0x8b65ec={'raw':![],'where':{}};var _0x13c3af={};var _0x20199c={'count':0x0,'rows':[]};return db[_0xb84d('0x20')]['findOne']({'where':{'id':_0x414117[_0xb84d('0x2b')]['id']}})['then'](handleEntityNotFound(_0x493272,null))[_0xb84d('0x17')](function(_0xdddabd){if(_0xdddabd){_0x13c3af[_0xb84d('0x2c')]=_[_0xb84d('0x2d')](db[_0xb84d('0x3d')]['rawAttributes']);_0x13c3af[_0xb84d('0x28')]=_[_0xb84d('0x2d')](_0x414117['query']);_0x13c3af[_0xb84d('0x2e')]=_['intersection'](_0x13c3af[_0xb84d('0x2c')],_0x13c3af[_0xb84d('0x28')]);_0x8b65ec['attributes']=_[_0xb84d('0x2f')](_0x13c3af['model'],qs[_0xb84d('0x31')](_0x414117[_0xb84d('0x28')]['fields']));_0x8b65ec[_0xb84d('0x30')]=_0x8b65ec[_0xb84d('0x30')]['length']?_0x8b65ec['attributes']:_0x13c3af['model'];if(!_0x414117['query'][_0xb84d('0x40')](_0xb84d('0x41'))){_0x8b65ec[_0xb84d('0x15')]=qs[_0xb84d('0x15')](_0x414117[_0xb84d('0x28')]['limit']);_0x8b65ec[_0xb84d('0x13')]=qs[_0xb84d('0x13')](_0x414117[_0xb84d('0x28')][_0xb84d('0x13')]);}_0x8b65ec['order']=qs[_0xb84d('0x42')](_0x414117[_0xb84d('0x28')][_0xb84d('0x42')]);_0x8b65ec[_0xb84d('0x43')]=qs[_0xb84d('0x2e')](_['pick'](_0x414117['query'],_0x13c3af[_0xb84d('0x2e')]));_0x8b65ec[_0xb84d('0x43')][_0xb84d('0x44')]=_0xdddabd['id'];if(_0x414117['query']['filter']){_0x8b65ec[_0xb84d('0x43')]=_[_0xb84d('0x35')](_0x8b65ec[_0xb84d('0x43')],{'$or':_['map'](_0x8b65ec['attributes'],function(_0x3dc5d5){var _0x372960={};_0x372960[_0x3dc5d5]={'$like':'%'+_0x414117[_0xb84d('0x28')]['filter']+'%'};return _0x372960;})});}if(_0x414117[_0xb84d('0x28')][_0xb84d('0x45')]){var _0x1a98f4=_0x414117['query'][_0xb84d('0x45')][_0xb84d('0x46')](',');var _0x8da2fc={};_0x8da2fc[_0x1a98f4[0x0]]={'$gte':moment(_0x1a98f4[0x1])[_0xb84d('0x47')](_0xb84d('0x48'))};_0x8b65ec[_0xb84d('0x43')]=_[_0xb84d('0x35')](_0x8b65ec['where'],_0x8da2fc);}_0x8b65ec=_[_0xb84d('0x35')]({},_0x8b65ec,_0x414117['options']);return db[_0xb84d('0x3d')][_0xb84d('0x16')]({'where':_0x8b65ec[_0xb84d('0x43')]})[_0xb84d('0x17')](function(_0x3b8f47){_0x20199c[_0xb84d('0x16')]=_0x3b8f47;if(_0x414117['query'][_0xb84d('0x33')]){_0x8b65ec[_0xb84d('0x34')]=[{'all':!![]}];}return db[_0xb84d('0x3d')][_0xb84d('0x26')](_0x8b65ec);})[_0xb84d('0x17')](function(_0x52f474){_0x20199c[_0xb84d('0x49')]=_0x52f474;return _0x20199c;});}})[_0xb84d('0x17')](respondWithFilteredResult(_0x493272,_0x8b65ec))[_0xb84d('0x2a')](handleError(_0x493272,null));};exports[_0xb84d('0x4a')]=function(_0x4bc12d,_0x3fc045){return db[_0xb84d('0x20')][_0xb84d('0x37')]({'where':{'id':_0x4bc12d[_0xb84d('0x2b')]['id']}})[_0xb84d('0x17')](handleEntityNotFound(_0x3fc045,null))[_0xb84d('0x17')](function(_0x5914fa){if(_0x5914fa){return _0x5914fa[_0xb84d('0x4b')](_0x4bc12d[_0xb84d('0x3a')]['ids'],_[_0xb84d('0x3e')](_0x4bc12d[_0xb84d('0x3a')],['ids','id'])||{})[_0xb84d('0x4c')](function(){return db[_0xb84d('0x4d')][_0xb84d('0x26')]({'attributes':['id',_0xb84d('0x1c'),_0xb84d('0x4e')],'where':{'id':_0x4bc12d[_0xb84d('0x3a')][_0xb84d('0x3f')]}});})[_0xb84d('0x17')](function(_0x314bfd){socket[_0xb84d('0x4f')](_0xb84d('0x50'),{'id':Number(_0x4bc12d[_0xb84d('0x2b')]['id']),'tags':_0x314bfd||[]});return{'id':Number(_0x4bc12d[_0xb84d('0x2b')]['id']),'tags':_0x314bfd||[]};});}})[_0xb84d('0x17')](respondWithResult(_0x3fc045,null))[_0xb84d('0x2a')](handleError(_0x3fc045,null));};exports[_0xb84d('0x51')]=function(_0x8b410e,_0x412a3f){return db[_0xb84d('0x20')]['find']({'where':{'id':_0x8b410e[_0xb84d('0x2b')]['id']}})['then'](handleEntityNotFound(_0x412a3f,null))[_0xb84d('0x17')](function(_0x36c6e4){if(_0x36c6e4){return _0x36c6e4[_0xb84d('0x51')](_0x8b410e[_0xb84d('0x28')][_0xb84d('0x3f')]);}})[_0xb84d('0x17')](respondWithStatusCode(_0x412a3f,null))[_0xb84d('0x2a')](handleError(_0x412a3f,null));};exports[_0xb84d('0x52')]=function(_0x2b5db5,_0x3fb815){var _0x43ace9=moment()[_0xb84d('0x53')]()['toString']();var _0x23af4d=path[_0xb84d('0x54')](config[_0xb84d('0x55')],_0xb84d('0x56'),_0xb84d('0x57'),_0xb84d('0x58'));var _0x40d990=path['join'](config[_0xb84d('0x55')],_0xb84d('0x56'),_0xb84d('0x57'),_0xb84d('0x59'));var _0x1a878f=path[_0xb84d('0x54')](_0x23af4d,_0x43ace9);var _0x2bd763=util[_0xb84d('0x47')]('transcript-%d-%s.zip',_0x2b5db5[_0xb84d('0x2b')]['id'],_0x43ace9);var _0x2faa6e=path[_0xb84d('0x54')](_0x23af4d,_0x2bd763);var _0x21c167=[];_0x21c167[_0xb84d('0x5a')]({'model':db[_0xb84d('0x5b')],'as':'Attachment','raw':!![]});var _0x2761c7=[{'model':db['FaxMessage'],'as':_0xb84d('0x5c'),'attributes':['id',_0xb84d('0x3a'),_0xb84d('0x5d')],'include':_0x21c167}];return db[_0xb84d('0x20')][_0xb84d('0x37')]({'where':{'id':_0x2b5db5['params']['id']},'include':_0x2761c7})['then'](handleEntityNotFound(_0x3fb815,null))[_0xb84d('0x17')](function(_0x443a83){if(_0x443a83&&_0x443a83[_0xb84d('0x5c')]){var _0x35e451=_0x443a83[_0xb84d('0x5e')]({'plain':!![]});fs[_0xb84d('0x5f')](_0x1a878f);for(var _0x32a244=0x0;_0x32a244<_0x35e451[_0xb84d('0x5c')]['length'];_0x32a244++){var _0x3d67ba=_0x35e451['Messages'][_0x32a244]['Attachment'];if(_0x3d67ba){var _0xa64453=path['join'](_0x40d990,_0x3d67ba[_0xb84d('0x60')]);if(fs[_0xb84d('0x61')](_0xa64453)){fs['createReadStream'](_0xa64453)['pipe'](fs[_0xb84d('0x62')](path[_0xb84d('0x54')](_0x1a878f,_0x3d67ba['basename'])));}}}return BPromise[_0xb84d('0x63')]()['then'](function(){return new BPromise(function(_0x432d36,_0x57959b){zipdir(_0x1a878f,{'saveTo':_0x2faa6e},function(_0x3d788b,_0x6bd5cc){if(_0x3d788b)return _0x57959b(_0x3d788b);return _0x432d36(_0x6bd5cc);});})['then'](function(){return new BPromise(function(_0x38a6d8,_0x59aed6){rimraf(_0x1a878f,function(_0x3fe31f){if(_0x3fe31f)_0x59aed6(_0x3fe31f);return _0x38a6d8();});});})[_0xb84d('0x17')](function(){return _0x3fb815[_0xb84d('0x52')](_0x2faa6e,_0x2bd763,function(_0x113dda){if(_0x113dda){console[_0xb84d('0x64')](_0xb84d('0x65'),_0x113dda);}else{fs[_0xb84d('0x66')](_0x2faa6e);}});});});}else{return _0x3fb815[_0xb84d('0x19')](0xc8);}})[_0xb84d('0x2a')](handleError(_0x3fb815,null));}; \ No newline at end of file +var _0xc184=['error','stack','name','send','index','map','FaxInteraction','fieldName','key','getOptions','findAll','fax','query','params','model','keys','rawAttributes','filters','intersection','attributes','include','options','find','catch','create','body','describe','addMessage','FaxMessage','omit','ids','getMessages','findOne','fields','hasOwnProperty','nolimit','order','sort','pick','where','filter','merge','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','format','transcript-%d-%s.zip','Attachment','Messages','createdAt','mkdirSync','length','existsSync','createReadStream','pipe','createWriteStream','basename','resolve','log','err','unlinkSync','rimraf','zip-dir','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','offset','undefined','count','limit','set','json','update','then','destroy','status','end','sendStatus'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xc184,0x18f));var _0x4c18=function(_0x511b76,_0x4727fa){_0x511b76=_0x511b76-0x0;var _0x5424ff=_0xc184[_0x511b76];return _0x5424ff;};'use strict';var rimraf=require(_0x4c18('0x0'));var zipdir=require(_0x4c18('0x1'));var moment=require('moment');var BPromise=require(_0x4c18('0x2'));var util=require(_0x4c18('0x3'));var path=require(_0x4c18('0x4'));var fs=require('fs');var _=require(_0x4c18('0x5'));var Redis=require(_0x4c18('0x6'));var interaction=require(_0x4c18('0x7'));var qs=require(_0x4c18('0x8'));var logger=require(_0x4c18('0x9'))(_0x4c18('0xa'));var config=require(_0x4c18('0xb'));var db=require('../../mysqldb')['db'];config[_0x4c18('0xc')]=_[_0x4c18('0xd')](config[_0x4c18('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4c18('0xe'))(new Redis(config[_0x4c18('0xc')]));require(_0x4c18('0xf'))[_0x4c18('0x10')](socket);function respondWithStatusCode(_0x563d2f,_0x25515d){_0x25515d=_0x25515d||0xcc;return function(_0x5ace13){if(_0x5ace13){return _0x563d2f['sendStatus'](_0x25515d);}return _0x563d2f['status'](_0x25515d)['end']();};}function respondWithResult(_0x3e30d3,_0xc0af6){_0xc0af6=_0xc0af6||0xc8;return function(_0x1221b1){if(_0x1221b1){return _0x3e30d3['status'](_0xc0af6)['json'](_0x1221b1);}};}function respondWithFilteredResult(_0xa42f00,_0x26d348){return function(_0x2d9faa){if(_0x2d9faa){var _0x1a8bac=typeof _0x26d348[_0x4c18('0x11')]===_0x4c18('0x12')&&typeof _0x26d348['limit']===_0x4c18('0x12');var _0x58fd8b=_0x2d9faa[_0x4c18('0x13')];var _0xa9c232=_0x1a8bac?0x0:_0x26d348[_0x4c18('0x11')];var _0x25f9b1=_0x1a8bac?_0x2d9faa[_0x4c18('0x13')]:_0x26d348['offset']+_0x26d348[_0x4c18('0x14')];var _0x356052;if(_0x25f9b1>=_0x58fd8b){_0x25f9b1=_0x58fd8b;_0x356052=0xc8;}else{_0x356052=0xce;}_0xa42f00['status'](_0x356052);return _0xa42f00[_0x4c18('0x15')]('Content-Range',_0xa9c232+'-'+_0x25f9b1+'/'+_0x58fd8b)[_0x4c18('0x16')](_0x2d9faa);}return null;};}function saveUpdates(_0x5108f3){return function(_0x2465a1){if(_0x2465a1){return _0x2465a1[_0x4c18('0x17')](_0x5108f3)[_0x4c18('0x18')](function(_0x23745c){return _0x23745c;});}return null;};}function removeEntity(_0x4c4cec){return function(_0x47d0a3){if(_0x47d0a3){return _0x47d0a3[_0x4c18('0x19')]()[_0x4c18('0x18')](function(){_0x4c4cec[_0x4c18('0x1a')](0xcc)[_0x4c18('0x1b')]();});}};}function handleEntityNotFound(_0x5e4854){return function(_0x11379e){if(!_0x11379e){_0x5e4854[_0x4c18('0x1c')](0x194);}return _0x11379e;};}function handleError(_0x92d586,_0x556326){_0x556326=_0x556326||0x1f4;return function(_0x337adc){logger[_0x4c18('0x1d')](_0x337adc[_0x4c18('0x1e')]);if(_0x337adc[_0x4c18('0x1f')]){delete _0x337adc[_0x4c18('0x1f')];}_0x92d586['status'](_0x556326)[_0x4c18('0x20')](_0x337adc);};}exports[_0x4c18('0x21')]=function(_0x5d11c5,_0x8118bc){var _0x21d716={};var _0xd9e92=_[_0x4c18('0x22')](db[_0x4c18('0x23')]['rawAttributes'],function(_0x208508){return{'name':_0x208508[_0x4c18('0x24')],'type':_0x208508['type'][_0x4c18('0x25')]};});_0x21d716=qs[_0x4c18('0x26')](_0xd9e92,_0x5d11c5);return interaction[_0x4c18('0x27')](_0x4c18('0x28'),_0x5d11c5[_0x4c18('0x29')],_0x5d11c5['user'],_0x21d716,_0xd9e92)['then'](respondWithFilteredResult(_0x8118bc,_0x21d716))['catch'](handleError(_0x8118bc,null));};exports['show']=function(_0x52c04d,_0x578c50){var _0x37a895={'raw':![],'where':{'id':_0x52c04d[_0x4c18('0x2a')]['id']}},_0x354e78={};_0x354e78[_0x4c18('0x2b')]=_[_0x4c18('0x2c')](db[_0x4c18('0x23')][_0x4c18('0x2d')]);_0x354e78[_0x4c18('0x29')]=_[_0x4c18('0x2c')](_0x52c04d[_0x4c18('0x29')]);_0x354e78[_0x4c18('0x2e')]=_[_0x4c18('0x2f')](_0x354e78[_0x4c18('0x2b')],_0x354e78['query']);_0x37a895[_0x4c18('0x30')]=_[_0x4c18('0x2f')](_0x354e78[_0x4c18('0x2b')],qs['fields'](_0x52c04d[_0x4c18('0x29')]['fields']));_0x37a895[_0x4c18('0x30')]=_0x37a895[_0x4c18('0x30')]['length']?_0x37a895[_0x4c18('0x30')]:_0x354e78['model'];if(_0x52c04d[_0x4c18('0x29')]['includeAll']){_0x37a895[_0x4c18('0x31')]=[{'all':!![]}];}_0x37a895=_['merge']({},_0x37a895,_0x52c04d[_0x4c18('0x32')]);return db[_0x4c18('0x23')][_0x4c18('0x33')](_0x37a895)[_0x4c18('0x18')](handleEntityNotFound(_0x578c50,null))[_0x4c18('0x18')](respondWithResult(_0x578c50,null))[_0x4c18('0x34')](handleError(_0x578c50,null));};exports[_0x4c18('0x35')]=function(_0x50b7fc,_0x608ddc){return db[_0x4c18('0x23')][_0x4c18('0x35')](_0x50b7fc[_0x4c18('0x36')],{})[_0x4c18('0x18')](respondWithResult(_0x608ddc,0xc9))[_0x4c18('0x34')](handleError(_0x608ddc,null));};exports[_0x4c18('0x17')]=function(_0x52a796,_0xe18619){if(_0x52a796[_0x4c18('0x36')]['id']){delete _0x52a796[_0x4c18('0x36')]['id'];}return db[_0x4c18('0x23')][_0x4c18('0x33')]({'where':{'id':_0x52a796['params']['id']}})[_0x4c18('0x18')](handleEntityNotFound(_0xe18619,null))[_0x4c18('0x18')](saveUpdates(_0x52a796[_0x4c18('0x36')],null))['then'](respondWithResult(_0xe18619,null))['catch'](handleError(_0xe18619,null));};exports[_0x4c18('0x19')]=function(_0x1992a0,_0x1e60fa){return db['FaxInteraction'][_0x4c18('0x33')]({'where':{'id':_0x1992a0[_0x4c18('0x2a')]['id']}})[_0x4c18('0x18')](handleEntityNotFound(_0x1e60fa,null))['then'](removeEntity(_0x1e60fa,null))[_0x4c18('0x34')](handleError(_0x1e60fa,null));};exports[_0x4c18('0x37')]=function(_0x390444,_0x4ad395){return db[_0x4c18('0x23')][_0x4c18('0x37')]()[_0x4c18('0x18')](respondWithResult(_0x4ad395,null))['catch'](handleError(_0x4ad395,null));};exports[_0x4c18('0x38')]=function(_0x158ddd,_0x3c8d97){return db[_0x4c18('0x39')][_0x4c18('0x33')]({'where':{'id':_0x158ddd[_0x4c18('0x2a')]['id']}})[_0x4c18('0x18')](handleEntityNotFound(_0x3c8d97,null))[_0x4c18('0x18')](function(_0x4fa1b0){if(_0x4fa1b0){return _0x4fa1b0[_0x4c18('0x38')](_0x158ddd[_0x4c18('0x36')]['ids'],_[_0x4c18('0x3a')](_0x158ddd[_0x4c18('0x36')],[_0x4c18('0x3b'),'id'])||{});}})['then'](respondWithResult(_0x3c8d97,null))[_0x4c18('0x34')](handleError(_0x3c8d97,null));};exports[_0x4c18('0x3c')]=function(_0x3da5c7,_0x1cb3a3){var _0x45330a={'raw':![],'where':{}};var _0x299869={};var _0x5acc8f={'count':0x0,'rows':[]};return db[_0x4c18('0x23')][_0x4c18('0x3d')]({'where':{'id':_0x3da5c7[_0x4c18('0x2a')]['id']}})[_0x4c18('0x18')](handleEntityNotFound(_0x1cb3a3,null))['then'](function(_0x4ded4f){if(_0x4ded4f){_0x299869[_0x4c18('0x2b')]=_['keys'](db[_0x4c18('0x39')]['rawAttributes']);_0x299869[_0x4c18('0x29')]=_[_0x4c18('0x2c')](_0x3da5c7[_0x4c18('0x29')]);_0x299869[_0x4c18('0x2e')]=_['intersection'](_0x299869[_0x4c18('0x2b')],_0x299869[_0x4c18('0x29')]);_0x45330a[_0x4c18('0x30')]=_[_0x4c18('0x2f')](_0x299869[_0x4c18('0x2b')],qs[_0x4c18('0x3e')](_0x3da5c7['query'][_0x4c18('0x3e')]));_0x45330a[_0x4c18('0x30')]=_0x45330a['attributes']['length']?_0x45330a[_0x4c18('0x30')]:_0x299869[_0x4c18('0x2b')];if(!_0x3da5c7[_0x4c18('0x29')][_0x4c18('0x3f')](_0x4c18('0x40'))){_0x45330a[_0x4c18('0x14')]=qs[_0x4c18('0x14')](_0x3da5c7[_0x4c18('0x29')][_0x4c18('0x14')]);_0x45330a[_0x4c18('0x11')]=qs[_0x4c18('0x11')](_0x3da5c7[_0x4c18('0x29')][_0x4c18('0x11')]);}_0x45330a[_0x4c18('0x41')]=qs[_0x4c18('0x42')](_0x3da5c7[_0x4c18('0x29')]['sort']);_0x45330a['where']=qs['filters'](_[_0x4c18('0x43')](_0x3da5c7['query'],_0x299869['filters']));_0x45330a[_0x4c18('0x44')]['FaxInteractionId']=_0x4ded4f['id'];if(_0x3da5c7[_0x4c18('0x29')][_0x4c18('0x45')]){_0x45330a['where']=_[_0x4c18('0x46')](_0x45330a['where'],{'$or':_['map'](_0x45330a['attributes'],function(_0x4684d4){var _0xae2b91={};_0xae2b91[_0x4684d4]={'$like':'%'+_0x3da5c7['query']['filter']+'%'};return _0xae2b91;})});}if(_0x3da5c7[_0x4c18('0x29')][_0x4c18('0x47')]){var _0x588ea5=_0x3da5c7[_0x4c18('0x29')][_0x4c18('0x47')][_0x4c18('0x48')](',');var _0x2c5a91={};_0x2c5a91[_0x588ea5[0x0]]={'$gte':moment(_0x588ea5[0x1])['format'](_0x4c18('0x49'))};_0x45330a[_0x4c18('0x44')]=_[_0x4c18('0x46')](_0x45330a[_0x4c18('0x44')],_0x2c5a91);}_0x45330a=_[_0x4c18('0x46')]({},_0x45330a,_0x3da5c7[_0x4c18('0x32')]);return db[_0x4c18('0x39')]['count']({'where':_0x45330a[_0x4c18('0x44')]})[_0x4c18('0x18')](function(_0x1b314f){_0x5acc8f[_0x4c18('0x13')]=_0x1b314f;if(_0x3da5c7[_0x4c18('0x29')]['includeAll']){_0x45330a[_0x4c18('0x31')]=[{'all':!![]}];}return db['FaxMessage'][_0x4c18('0x27')](_0x45330a);})[_0x4c18('0x18')](function(_0x4dc678){_0x5acc8f[_0x4c18('0x4a')]=_0x4dc678;return _0x5acc8f;});}})['then'](respondWithFilteredResult(_0x1cb3a3,_0x45330a))['catch'](handleError(_0x1cb3a3,null));};exports[_0x4c18('0x4b')]=function(_0x50b93b,_0x3c32d0){return db[_0x4c18('0x23')][_0x4c18('0x33')]({'where':{'id':_0x50b93b[_0x4c18('0x2a')]['id']}})[_0x4c18('0x18')](handleEntityNotFound(_0x3c32d0,null))['then'](function(_0x118b91){if(_0x118b91){return _0x118b91[_0x4c18('0x4c')](_0x50b93b['body'][_0x4c18('0x3b')],_[_0x4c18('0x3a')](_0x50b93b[_0x4c18('0x36')],['ids','id'])||{})[_0x4c18('0x4d')](function(){return db[_0x4c18('0x4e')][_0x4c18('0x27')]({'attributes':['id',_0x4c18('0x1f'),_0x4c18('0x4f')],'where':{'id':_0x50b93b[_0x4c18('0x36')]['ids']}});})['then'](function(_0x23341c){socket[_0x4c18('0x50')](_0x4c18('0x51'),{'id':Number(_0x50b93b[_0x4c18('0x2a')]['id']),'tags':_0x23341c||[]});return{'id':Number(_0x50b93b[_0x4c18('0x2a')]['id']),'tags':_0x23341c||[]};});}})[_0x4c18('0x18')](respondWithResult(_0x3c32d0,null))[_0x4c18('0x34')](handleError(_0x3c32d0,null));};exports[_0x4c18('0x52')]=function(_0x3b1c11,_0x391358){return db[_0x4c18('0x23')]['find']({'where':{'id':_0x3b1c11['params']['id']}})[_0x4c18('0x18')](handleEntityNotFound(_0x391358,null))[_0x4c18('0x18')](function(_0x42d578){if(_0x42d578){return _0x42d578[_0x4c18('0x52')](_0x3b1c11[_0x4c18('0x29')][_0x4c18('0x3b')]);}})[_0x4c18('0x18')](respondWithStatusCode(_0x391358,null))['catch'](handleError(_0x391358,null));};exports[_0x4c18('0x53')]=function(_0x219c02,_0x44b548){var _0x281cee=moment()[_0x4c18('0x54')]()[_0x4c18('0x55')]();var _0x56a685=path['join'](config[_0x4c18('0x56')],_0x4c18('0x57'),_0x4c18('0x58'),_0x4c18('0x59'));var _0x1ea7e5=path[_0x4c18('0x5a')](config[_0x4c18('0x56')],'server',_0x4c18('0x58'),'attachments');var _0x241fb1=path['join'](_0x56a685,_0x281cee);var _0x46197c=util[_0x4c18('0x5b')](_0x4c18('0x5c'),_0x219c02[_0x4c18('0x2a')]['id'],_0x281cee);var _0x55c463=path['join'](_0x56a685,_0x46197c);var _0x451a2b=[];_0x451a2b['push']({'model':db['Attachment'],'as':_0x4c18('0x5d'),'raw':!![]});var _0x7ab127=[{'model':db[_0x4c18('0x39')],'as':_0x4c18('0x5e'),'attributes':['id',_0x4c18('0x36'),_0x4c18('0x5f')],'include':_0x451a2b}];return db[_0x4c18('0x23')][_0x4c18('0x33')]({'where':{'id':_0x219c02[_0x4c18('0x2a')]['id']},'include':_0x7ab127})[_0x4c18('0x18')](handleEntityNotFound(_0x44b548,null))[_0x4c18('0x18')](function(_0x25bfb8){if(_0x25bfb8&&_0x25bfb8[_0x4c18('0x5e')]){var _0x2c83ad=_0x25bfb8['get']({'plain':!![]});fs[_0x4c18('0x60')](_0x241fb1);for(var _0x411131=0x0;_0x411131<_0x2c83ad[_0x4c18('0x5e')][_0x4c18('0x61')];_0x411131++){var _0x177f6b=_0x2c83ad[_0x4c18('0x5e')][_0x411131][_0x4c18('0x5d')];if(_0x177f6b){var _0x4bbd3d=path['join'](_0x1ea7e5,_0x177f6b['basename']);if(fs[_0x4c18('0x62')](_0x4bbd3d)){fs[_0x4c18('0x63')](_0x4bbd3d)[_0x4c18('0x64')](fs[_0x4c18('0x65')](path[_0x4c18('0x5a')](_0x241fb1,_0x177f6b[_0x4c18('0x66')])));}}}return BPromise[_0x4c18('0x67')]()['then'](function(){return new BPromise(function(_0x812ef7,_0x1e79cc){zipdir(_0x241fb1,{'saveTo':_0x55c463},function(_0x4a5c41,_0x38e116){if(_0x4a5c41)return _0x1e79cc(_0x4a5c41);return _0x812ef7(_0x38e116);});})[_0x4c18('0x18')](function(){return new BPromise(function(_0x2e0b71,_0x18d684){rimraf(_0x241fb1,function(_0xd63712){if(_0xd63712)_0x18d684(_0xd63712);return _0x2e0b71();});});})['then'](function(){return _0x44b548[_0x4c18('0x53')](_0x55c463,_0x46197c,function(_0x545866){if(_0x545866){console[_0x4c18('0x68')](_0x4c18('0x69'),_0x545866);}else{fs[_0x4c18('0x6a')](_0x55c463);}});});});}else{return _0x44b548['sendStatus'](0xc8);}})[_0x4c18('0x34')](handleError(_0x44b548,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index bc6a040..4e4948a 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 _0xeb7d=['update','remove','getUsers','setDataValue','Users','map','unreadMessages','length','emit','catch','exports','events','../../mysqldb','FaxInteraction','setMaxListeners','save'];(function(_0x2bcd1f,_0x4f1972){var _0x2381ca=function(_0x51f935){while(--_0x51f935){_0x2bcd1f['push'](_0x2bcd1f['shift']());}};_0x2381ca(++_0x4f1972);}(_0xeb7d,0xeb));var _0xdeb7=function(_0x1cae00,_0x4589e4){_0x1cae00=_0x1cae00-0x0;var _0x391291=_0xeb7d[_0x1cae00];return _0x391291;};'use strict';var EventEmitter=require(_0xdeb7('0x0'));var FaxInteraction=require(_0xdeb7('0x1'))['db'][_0xdeb7('0x2')];var FaxMessage=require(_0xdeb7('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xdeb7('0x3')](0x0);var events={'afterCreate':_0xdeb7('0x4'),'afterUpdate':_0xdeb7('0x5'),'afterDestroy':_0xdeb7('0x6')};function emitEvent(_0x54f6eb){return function(_0x2655a7,_0x2906b6,_0x51a3ca){_0x2655a7[_0xdeb7('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x442853){_0x2655a7[_0xdeb7('0x8')](_0xdeb7('0x9'),_0x442853[_0xdeb7('0xa')](function(_0x43b2b6){return{'id':_0x43b2b6['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x2655a7['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x185fab){_0x2655a7[_0xdeb7('0x8')](_0xdeb7('0xb'),_0x185fab[_0xdeb7('0xc')]);FaxInteractionEvents['emit'](_0x54f6eb+':'+_0x2655a7['id'],_0x2655a7);FaxInteractionEvents[_0xdeb7('0xd')](_0x54f6eb,_0x2655a7);_0x51a3ca(null);})[_0xdeb7('0xe')](_0x51a3ca(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xdeb7('0xf')]=FaxInteractionEvents; \ No newline at end of file +var _0x9ae9=['Users','length','emit','hasOwnProperty','exports','../../mysqldb','FaxInteraction','FaxMessage','save','update','getUsers','then'];(function(_0x16ac87,_0xc04313){var _0x3b60ff=function(_0x3683c9){while(--_0x3683c9){_0x16ac87['push'](_0x16ac87['shift']());}};_0x3b60ff(++_0xc04313);}(_0x9ae9,0x101));var _0x99ae=function(_0x50cbc9,_0x98b352){_0x50cbc9=_0x50cbc9-0x0;var _0x1b5ea2=_0x9ae9[_0x50cbc9];return _0x1b5ea2;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x99ae('0x0'))['db'][_0x99ae('0x1')];var FaxMessage=require(_0x99ae('0x0'))['db'][_0x99ae('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x99ae('0x3'),'afterUpdate':_0x99ae('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3d9d6c){return function(_0xf68a30,_0x1a9483,_0x246ff1){_0xf68a30[_0x99ae('0x5')]({'attributes':['id'],'raw':!![]})[_0x99ae('0x6')](function(_0x5e19d8){_0xf68a30['setDataValue'](_0x99ae('0x7'),_0x5e19d8['map'](function(_0x566faf){return{'id':_0x566faf['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0xf68a30['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x36d44d){_0xf68a30['setDataValue']('unreadMessages',_0x36d44d[_0x99ae('0x8')]);FaxInteractionEvents[_0x99ae('0x9')](_0x3d9d6c+':'+_0xf68a30['id'],_0xf68a30);FaxInteractionEvents['emit'](_0x3d9d6c,_0xf68a30);_0x246ff1(null);})['catch'](_0x246ff1(null));};}for(var e in events){if(events[_0x99ae('0xa')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x99ae('0xb')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index feab972..326130f 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 _0xe67c=['FaxInteraction','fax_interactions','changed','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./faxInteraction.attributes','define'];(function(_0x42692c,_0x602ebc){var _0xc6c7b8=function(_0x2a3b64){while(--_0x2a3b64){_0x42692c['push'](_0x42692c['shift']());}};_0xc6c7b8(++_0x602ebc);}(_0xe67c,0x1a9));var _0xce67=function(_0x4a8823,_0x414c39){_0x4a8823=_0x4a8823-0x0;var _0x5b8b32=_0xe67c[_0x4a8823];return _0x5b8b32;};'use strict';var _=require(_0xce67('0x0'));var util=require(_0xce67('0x1'));var logger=require('../../config/logger')(_0xce67('0x2'));var moment=require(_0xce67('0x3'));var BPromise=require(_0xce67('0x4'));var rp=require(_0xce67('0x5'));var fs=require('fs');var path=require(_0xce67('0x6'));var rimraf=require(_0xce67('0x7'));var config=require('../../config/environment');var attributes=require(_0xce67('0x8'));module['exports']=function(_0x4db2d0,_0x1e7e72){return _0x4db2d0[_0xce67('0x9')](_0xce67('0xa'),attributes,{'tableName':_0xce67('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x190d01,_0x439d01,_0x1667ac){if(_0x190d01[_0xce67('0xc')](_0xce67('0xd'))){_0x190d01['closedAt']=moment()['format'](_0xce67('0xe'));}_0x1667ac(null,_0x190d01);}}});}; \ No newline at end of file +var _0x9bcd=['path','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1d3aad,_0x52a3f3){var _0x775f3f=function(_0x3381bf){while(--_0x3381bf){_0x1d3aad['push'](_0x1d3aad['shift']());}};_0x775f3f(++_0x52a3f3);}(_0x9bcd,0xe7));var _0xd9bc=function(_0x5dee8d,_0x2ea386){_0x5dee8d=_0x5dee8d-0x0;var _0x1683d1=_0x9bcd[_0x5dee8d];return _0x1683d1;};'use strict';var _=require(_0xd9bc('0x0'));var util=require(_0xd9bc('0x1'));var logger=require(_0xd9bc('0x2'))(_0xd9bc('0x3'));var moment=require(_0xd9bc('0x4'));var BPromise=require(_0xd9bc('0x5'));var rp=require(_0xd9bc('0x6'));var fs=require('fs');var path=require(_0xd9bc('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd9bc('0x8'));module[_0xd9bc('0x9')]=function(_0x1453bf,_0x5a2342){return _0x1453bf[_0xd9bc('0xa')](_0xd9bc('0xb'),attributes,{'tableName':_0xd9bc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3459cc,_0x212992,_0x34bf24){if(_0x3459cc['changed'](_0xd9bc('0xd'))){_0x3459cc[_0xd9bc('0xe')]=moment()[_0xd9bc('0xf')](_0xd9bc('0x10'));}_0x34bf24(null,_0x3459cc);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 1d90752..f464675 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 _0x32a8=['update','body','options','raw','where','find','ids','AddTags','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','UpdateFaxInteraction'];(function(_0xa8b5c9,_0x3a410b){var _0x5dd0f0=function(_0x31015b){while(--_0x31015b){_0xa8b5c9['push'](_0xa8b5c9['shift']());}};_0x5dd0f0(++_0x3a410b);}(_0x32a8,0x10c));var _0x832a=function(_0x4595ec,_0x2def3d){_0x4595ec=_0x4595ec-0x0;var _0x463e1a=_0x32a8[_0x4595ec];return _0x463e1a;};'use strict';var _=require(_0x832a('0x0'));var util=require(_0x832a('0x1'));var moment=require(_0x832a('0x2'));var BPromise=require(_0x832a('0x3'));var rs=require(_0x832a('0x4'));var fs=require('fs');var Redis=require(_0x832a('0x5'));var db=require(_0x832a('0x6'))['db'];var utils=require(_0x832a('0x7'));var logger=require(_0x832a('0x8'))(_0x832a('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x832a('0xa')][_0x832a('0xb')]({'port':0x232a});config[_0x832a('0xc')]=_[_0x832a('0xd')](config['redis'],{'host':_0x832a('0xe'),'port':0x18eb});var socket=require(_0x832a('0xf'))(new Redis(config[_0x832a('0xc')]));require(_0x832a('0x10'))['register'](socket);function respondWithRpcPromise(_0x2693f3,_0x3b0416,_0x53c49e){return new BPromise(function(_0x400dee,_0x46624e){return client[_0x832a('0x11')](_0x2693f3,_0x53c49e)[_0x832a('0x12')](function(_0x55d14e){logger[_0x832a('0x13')](_0x832a('0x14'),_0x3b0416,_0x832a('0x15'));logger[_0x832a('0x16')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x3b0416,_0x832a('0x15'),JSON['stringify'](_0x55d14e));if(_0x55d14e[_0x832a('0x17')]){if(_0x55d14e[_0x832a('0x17')]['code']===0x1f4){logger[_0x832a('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x3b0416,_0x55d14e[_0x832a('0x17')][_0x832a('0x18')]);return _0x46624e(_0x55d14e['error'][_0x832a('0x18')]);}logger[_0x832a('0x17')](_0x832a('0x14'),_0x3b0416,_0x55d14e[_0x832a('0x17')]['message']);return _0x400dee(_0x55d14e[_0x832a('0x17')][_0x832a('0x18')]);}else{logger[_0x832a('0x13')](_0x832a('0x14'),_0x3b0416,'request\x20sent');_0x400dee(_0x55d14e[_0x832a('0x19')][_0x832a('0x18')]);}})[_0x832a('0x1a')](function(_0x1bc10b){logger[_0x832a('0x17')](_0x832a('0x14'),_0x3b0416,_0x1bc10b);_0x46624e(_0x1bc10b);});});}exports[_0x832a('0x1b')]=function(_0x38e90b){var _0x324a0d=this;return new Promise(function(_0x5614b5,_0x5df958){return db['FaxInteraction'][_0x832a('0x1c')](_0x38e90b[_0x832a('0x1d')],{'raw':_0x38e90b[_0x832a('0x1e')]?_0x38e90b[_0x832a('0x1e')][_0x832a('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38e90b[_0x832a('0x1e')]?_0x38e90b[_0x832a('0x1e')][_0x832a('0x20')]||null:null,'attributes':_0x38e90b['options']?_0x38e90b[_0x832a('0x1e')]['attributes']||null:null,'limit':_0x38e90b[_0x832a('0x1e')]?_0x38e90b[_0x832a('0x1e')]['limit']||null:null})[_0x832a('0x12')](function(_0x8bb22d){logger['info'](_0x832a('0x1b'),_0x38e90b);logger['debug'](_0x832a('0x1b'),_0x38e90b,JSON['stringify'](_0x8bb22d));_0x5614b5(_0x8bb22d);})['catch'](function(_0x460340){logger[_0x832a('0x17')](_0x832a('0x1b'),_0x460340[_0x832a('0x18')],_0x38e90b);_0x5df958(_0x324a0d[_0x832a('0x17')](0x1f4,_0x460340[_0x832a('0x18')]));});});};exports['AddTagsToFaxInteraction']=function(_0x2b84d1){return new Promise(function(_0x23119a,_0x11b1c5){return db['FaxInteraction'][_0x832a('0x21')]({'where':_0x2b84d1[_0x832a('0x1e')]?_0x2b84d1['options'][_0x832a('0x20')]||null:null})[_0x832a('0x12')](function(_0x2982ec){if(_0x2982ec){return _0x2982ec['addTags'](_0x2b84d1[_0x832a('0x1d')][_0x832a('0x22')],_['omit'](_0x2b84d1['body'],[_0x832a('0x22'),'id'])||{});}})['spread'](function(_0x22aa03){logger[_0x832a('0x13')](_0x832a('0x23'),_0x2b84d1);logger[_0x832a('0x16')](_0x832a('0x23'),_0x2b84d1,JSON[_0x832a('0x24')](_0x22aa03));_0x23119a(_0x22aa03);})[_0x832a('0x1a')](function(_0x7d5701){logger[_0x832a('0x17')](_0x832a('0x23'),_0x7d5701['message'],_0x2b84d1);_0x11b1c5(_this[_0x832a('0x17')](0x1f4,_0x7d5701['message']));});});}; \ No newline at end of file +var _0xbcb9=['FaxInteraction,\x20%s,\x20%s','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','UpdateFaxInteraction','FaxInteraction','body','options','where','limit','catch','AddTagsToFaxInteraction','find','ids','omit','spread','AddTags','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbcb9,0x97));var _0x9bcb=function(_0x35d1db,_0x4e8ab5){_0x35d1db=_0x35d1db-0x0;var _0x425d92=_0xbcb9[_0x35d1db];return _0x425d92;};'use strict';var _=require(_0x9bcb('0x0'));var util=require(_0x9bcb('0x1'));var moment=require(_0x9bcb('0x2'));var BPromise=require('bluebird');var rs=require(_0x9bcb('0x3'));var fs=require('fs');var Redis=require(_0x9bcb('0x4'));var db=require(_0x9bcb('0x5'))['db'];var utils=require(_0x9bcb('0x6'));var logger=require(_0x9bcb('0x7'))(_0x9bcb('0x8'));var config=require(_0x9bcb('0x9'));var jayson=require(_0x9bcb('0xa'));var client=jayson[_0x9bcb('0xb')][_0x9bcb('0xc')]({'port':0x232a});config[_0x9bcb('0xd')]=_['defaults'](config[_0x9bcb('0xd')],{'host':_0x9bcb('0xe'),'port':0x18eb});var socket=require(_0x9bcb('0xf'))(new Redis(config[_0x9bcb('0xd')]));require(_0x9bcb('0x10'))[_0x9bcb('0x11')](socket);function respondWithRpcPromise(_0x424e78,_0x42bdb2,_0x542d63){return new BPromise(function(_0x4fa4f2,_0x1ef690){return client[_0x9bcb('0x12')](_0x424e78,_0x542d63)[_0x9bcb('0x13')](function(_0x482004){logger[_0x9bcb('0x14')](_0x9bcb('0x15'),_0x42bdb2,'request\x20sent');logger['debug'](_0x9bcb('0x16'),_0x42bdb2,_0x9bcb('0x17'),JSON[_0x9bcb('0x18')](_0x482004));if(_0x482004[_0x9bcb('0x19')]){if(_0x482004[_0x9bcb('0x19')][_0x9bcb('0x1a')]===0x1f4){logger[_0x9bcb('0x19')]('FaxInteraction,\x20%s,\x20%s',_0x42bdb2,_0x482004[_0x9bcb('0x19')]['message']);return _0x1ef690(_0x482004[_0x9bcb('0x19')]['message']);}logger[_0x9bcb('0x19')]('FaxInteraction,\x20%s,\x20%s',_0x42bdb2,_0x482004['error'][_0x9bcb('0x1b')]);return _0x4fa4f2(_0x482004[_0x9bcb('0x19')]['message']);}else{logger[_0x9bcb('0x14')](_0x9bcb('0x15'),_0x42bdb2,_0x9bcb('0x17'));_0x4fa4f2(_0x482004[_0x9bcb('0x1c')][_0x9bcb('0x1b')]);}})['catch'](function(_0x32567c){logger[_0x9bcb('0x19')](_0x9bcb('0x15'),_0x42bdb2,_0x32567c);_0x1ef690(_0x32567c);});});}exports[_0x9bcb('0x1d')]=function(_0x31a811){var _0x706350=this;return new Promise(function(_0x531320,_0x32dedc){return db[_0x9bcb('0x1e')]['update'](_0x31a811[_0x9bcb('0x1f')],{'raw':_0x31a811['options']?_0x31a811[_0x9bcb('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31a811[_0x9bcb('0x20')]?_0x31a811[_0x9bcb('0x20')][_0x9bcb('0x21')]||null:null,'attributes':_0x31a811[_0x9bcb('0x20')]?_0x31a811[_0x9bcb('0x20')]['attributes']||null:null,'limit':_0x31a811['options']?_0x31a811['options'][_0x9bcb('0x22')]||null:null})[_0x9bcb('0x13')](function(_0xd69487){logger[_0x9bcb('0x14')](_0x9bcb('0x1d'),_0x31a811);logger['debug'](_0x9bcb('0x1d'),_0x31a811,JSON[_0x9bcb('0x18')](_0xd69487));_0x531320(_0xd69487);})[_0x9bcb('0x23')](function(_0x38fd9f){logger[_0x9bcb('0x19')]('UpdateFaxInteraction',_0x38fd9f[_0x9bcb('0x1b')],_0x31a811);_0x32dedc(_0x706350['error'](0x1f4,_0x38fd9f[_0x9bcb('0x1b')]));});});};exports[_0x9bcb('0x24')]=function(_0x439b9d){return new Promise(function(_0x932e44,_0x3e89de){return db[_0x9bcb('0x1e')][_0x9bcb('0x25')]({'where':_0x439b9d[_0x9bcb('0x20')]?_0x439b9d[_0x9bcb('0x20')][_0x9bcb('0x21')]||null:null})[_0x9bcb('0x13')](function(_0x53ee62){if(_0x53ee62){return _0x53ee62['addTags'](_0x439b9d[_0x9bcb('0x1f')][_0x9bcb('0x26')],_[_0x9bcb('0x27')](_0x439b9d[_0x9bcb('0x1f')],[_0x9bcb('0x26'),'id'])||{});}})[_0x9bcb('0x28')](function(_0x36dc6c){logger[_0x9bcb('0x14')](_0x9bcb('0x29'),_0x439b9d);logger[_0x9bcb('0x2a')](_0x9bcb('0x29'),_0x439b9d,JSON[_0x9bcb('0x18')](_0x36dc6c));_0x932e44(_0x36dc6c);})[_0x9bcb('0x23')](function(_0x2d8b54){logger['error'](_0x9bcb('0x29'),_0x2d8b54[_0x9bcb('0x1b')],_0x439b9d);_0x3e89de(_this[_0x9bcb('0x19')](0x1f4,_0x2d8b54['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index ced9b3c..3bde40d 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 _0x59e4=['./faxInteraction.events','save','remove','update','emit','removeListener','register','length','faxInteraction:'];(function(_0x22cbcc,_0x2d5e14){var _0x471385=function(_0x59c08b){while(--_0x59c08b){_0x22cbcc['push'](_0x22cbcc['shift']());}};_0x471385(++_0x2d5e14);}(_0x59e4,0xb4));var _0x459e=function(_0x349b5c,_0x55e5fa){_0x349b5c=_0x349b5c-0x0;var _0x3efcac=_0x59e4[_0x349b5c];return _0x3efcac;};'use strict';var FaxInteractionEvents=require(_0x459e('0x0'));var events=[_0x459e('0x1'),_0x459e('0x2'),_0x459e('0x3')];function createListener(_0x3d265c,_0x2764f8){return function(_0x10f4b4){_0x2764f8[_0x459e('0x4')](_0x3d265c,_0x10f4b4);};}function removeListener(_0x4c0154,_0x16849f){return function(){FaxInteractionEvents[_0x459e('0x5')](_0x4c0154,_0x16849f);};}exports[_0x459e('0x6')]=function(_0x19921a){for(var _0x21aec5=0x0,_0x34b94b=events[_0x459e('0x7')];_0x21aec5<_0x34b94b;_0x21aec5++){var _0x4dcf8a=events[_0x21aec5];var _0xf111d7=createListener(_0x459e('0x8')+_0x4dcf8a,_0x19921a);FaxInteractionEvents['on'](_0x4dcf8a,_0xf111d7);}}; \ No newline at end of file +var _0x45a1=['./faxInteraction.events','save','remove','update','register','length','faxInteraction:'];(function(_0x8a912d,_0x53c52b){var _0x4fb44b=function(_0xb62428){while(--_0xb62428){_0x8a912d['push'](_0x8a912d['shift']());}};_0x4fb44b(++_0x53c52b);}(_0x45a1,0x70));var _0x145a=function(_0x292225,_0x5f5870){_0x292225=_0x292225-0x0;var _0x4e2096=_0x45a1[_0x292225];return _0x4e2096;};'use strict';var FaxInteractionEvents=require(_0x145a('0x0'));var events=[_0x145a('0x1'),_0x145a('0x2'),_0x145a('0x3')];function createListener(_0x166a90,_0x14a5e7){return function(_0x3f07d0){_0x14a5e7['emit'](_0x166a90,_0x3f07d0);};}function removeListener(_0x5f2963,_0x4ffc9f){return function(){FaxInteractionEvents['removeListener'](_0x5f2963,_0x4ffc9f);};}exports[_0x145a('0x4')]=function(_0x5bc7df){for(var _0x146dba=0x0,_0x122ab6=events[_0x145a('0x5')];_0x146dba<_0x122ab6;_0x146dba++){var _0xf0df02=events[_0x146dba];var _0x334812=createListener(_0x145a('0x6')+_0xf0df02,_0x5bc7df);FaxInteractionEvents['on'](_0xf0df02,_0x334812);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 868eb13..2559a65 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 _0x2d0c=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','put','fax','faxinteraction:update','delete','faxinteraction:destroy','destroy','/:id/tags','exports','multer','util','path'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2d0c,0x9d));var _0xc2d0=function(_0x4f0f9b,_0x4e963e){_0x4f0f9b=_0x4f0f9b-0x0;var _0x970f94=_0x2d0c[_0x4f0f9b];return _0x970f94;};'use strict';var multer=require(_0xc2d0('0x0'));var util=require(_0xc2d0('0x1'));var path=require(_0xc2d0('0x2'));var timeout=require(_0xc2d0('0x3'));var express=require(_0xc2d0('0x4'));var router=express[_0xc2d0('0x5')]();var fs_extra=require(_0xc2d0('0x6'));var auth=require(_0xc2d0('0x7'));var interaction=require(_0xc2d0('0x8'));var config=require(_0xc2d0('0x9'));var controller=require(_0xc2d0('0xa'));router[_0xc2d0('0xb')]('/',auth['isAuthenticated'](),controller[_0xc2d0('0xc')]);router[_0xc2d0('0xb')](_0xc2d0('0xd'),auth[_0xc2d0('0xe')](),controller[_0xc2d0('0xf')]);router[_0xc2d0('0xb')](_0xc2d0('0x10'),auth[_0xc2d0('0xe')](),controller[_0xc2d0('0x11')]);router[_0xc2d0('0xb')](_0xc2d0('0x12'),auth[_0xc2d0('0xe')](),controller['getMessages']);router['get'](_0xc2d0('0x13'),auth['isAuthenticated'](),controller[_0xc2d0('0x14')]);router[_0xc2d0('0x15')]('/',auth[_0xc2d0('0xe')](),controller[_0xc2d0('0x16')]);router[_0xc2d0('0x15')](_0xc2d0('0x12'),auth['isAuthenticated'](),controller[_0xc2d0('0x17')]);router['post']('/:id/tags',auth['isAuthenticated'](),interaction['tracked']('fax','faxinteraction:addtags'),controller['addTags']);router[_0xc2d0('0x18')](_0xc2d0('0x10'),auth[_0xc2d0('0xe')](),interaction['tracked'](_0xc2d0('0x19'),_0xc2d0('0x1a')),controller['update']);router[_0xc2d0('0x1b')](_0xc2d0('0x10'),auth[_0xc2d0('0xe')](),interaction['tracked'](_0xc2d0('0x19'),_0xc2d0('0x1c')),controller[_0xc2d0('0x1d')]);router['delete'](_0xc2d0('0x1e'),auth[_0xc2d0('0xe')](),controller['removeTags']);module[_0xc2d0('0x1f')]=router; \ No newline at end of file +var _0x9ace=['addTags','put','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','/:id/tags','removeTags','exports','util','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','tracked','fax','faxinteraction:addtags'];(function(_0x2d4296,_0x2108cd){var _0x374e18=function(_0x4c7ac3){while(--_0x4c7ac3){_0x2d4296['push'](_0x2d4296['shift']());}};_0x374e18(++_0x2108cd);}(_0x9ace,0xac));var _0xe9ac=function(_0x3a6957,_0xc3abb6){_0x3a6957=_0x3a6957-0x0;var _0x35058d=_0x9ace[_0x3a6957];return _0x35058d;};'use strict';var multer=require('multer');var util=require(_0xe9ac('0x0'));var path=require('path');var timeout=require(_0xe9ac('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe9ac('0x2'));var config=require(_0xe9ac('0x3'));var controller=require('./faxInteraction.controller');router[_0xe9ac('0x4')]('/',auth[_0xe9ac('0x5')](),controller['index']);router['get'](_0xe9ac('0x6'),auth[_0xe9ac('0x5')](),controller[_0xe9ac('0x7')]);router[_0xe9ac('0x4')]('/:id',auth[_0xe9ac('0x5')](),controller[_0xe9ac('0x8')]);router[_0xe9ac('0x4')](_0xe9ac('0x9'),auth[_0xe9ac('0x5')](),controller[_0xe9ac('0xa')]);router[_0xe9ac('0x4')](_0xe9ac('0xb'),auth[_0xe9ac('0x5')](),controller[_0xe9ac('0xc')]);router[_0xe9ac('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xe9ac('0x9'),auth['isAuthenticated'](),controller['addMessage']);router[_0xe9ac('0xd')]('/:id/tags',auth[_0xe9ac('0x5')](),interaction[_0xe9ac('0xe')](_0xe9ac('0xf'),_0xe9ac('0x10')),controller[_0xe9ac('0x11')]);router[_0xe9ac('0x12')]('/:id',auth[_0xe9ac('0x5')](),interaction[_0xe9ac('0xe')](_0xe9ac('0xf'),_0xe9ac('0x13')),controller[_0xe9ac('0x14')]);router[_0xe9ac('0x15')]('/:id',auth[_0xe9ac('0x5')](),interaction['tracked'](_0xe9ac('0xf'),_0xe9ac('0x16')),controller[_0xe9ac('0x17')]);router[_0xe9ac('0x15')](_0xe9ac('0x18'),auth[_0xe9ac('0x5')](),controller[_0xe9ac('0x19')]);module[_0xe9ac('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index b40d993..f25f27c 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 _0xb821=['TEXT','ENUM','DATE','exports'];(function(_0x5b849e,_0x51c313){var _0x5fd6ea=function(_0x368e14){while(--_0x368e14){_0x5b849e['push'](_0x5b849e['shift']());}};_0x5fd6ea(++_0x51c313);}(_0xb821,0xa7));var _0x1b82=function(_0x599c49,_0x500eca){_0x599c49=_0x599c49-0x0;var _0x278bf2=_0xb821[_0x599c49];return _0x278bf2;};'use strict';var Sequelize=require('sequelize');module[_0x1b82('0x0')]={'body':{'type':Sequelize[_0x1b82('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x1b82('0x2')]('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x1b82('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x1b82('0x3')]}}; \ No newline at end of file +var _0xf452=['out','TEXT','DATE','sequelize','exports','medium','BOOLEAN','ENUM'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf452,0x13b));var _0x2f45=function(_0x58983a,_0x189224){_0x58983a=_0x58983a-0x0;var _0x3d0e8b=_0xf452[_0x58983a];return _0x3d0e8b;};'use strict';var Sequelize=require(_0x2f45('0x0'));module[_0x2f45('0x1')]={'body':{'type':Sequelize['TEXT'](_0x2f45('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x2f45('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2f45('0x4')]('in',_0x2f45('0x5')),'defaultValue':_0x2f45('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x2f45('0x6')],'defaultValue':null},'readAt':{'type':Sequelize[_0x2f45('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 9130d6a..deb27f3 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 _0x1b0e=['get','FaxInteractionId','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','interaction','AcceptMessage','acceptMessage','ContactId','sequelize','SELECT','User','fullname','manual','SIP/%s','motionChannel','event','accept','EventManager','acceptmessage','fax','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','contact','email','internal','interface','channel','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','basename','download','root','server','files','attachments','join','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','squel','crypto','jsforce','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','redis','defaults','localhost','./faxMessage.socket','register','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','json','limit','count','offset','set','Content-Range','reject','save','update','destroy','stack','send','index','map','FaxMessage','fieldName','type','key','model','query','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','body','find','describe','fax-interactions','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent'];(function(_0x1ce595,_0x1069cb){var _0x525dfe=function(_0xeee00a){while(--_0xeee00a){_0x1ce595['push'](_0x1ce595['shift']());}};_0x525dfe(++_0x1069cb);}(_0x1b0e,0x14c));var _0xe1b0=function(_0x595124,_0x53f28e){_0x595124=_0x595124-0x0;var _0x3158d4=_0x1b0e[_0x595124];return _0x3158d4;};'use strict';var emlformat=require(_0xe1b0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe1b0('0x1'));var rp=require(_0xe1b0('0x2'));var moment=require(_0xe1b0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe1b0('0x4'));var util=require(_0xe1b0('0x5'));var path=require(_0xe1b0('0x6'));var sox=require('sox');var csv=require(_0xe1b0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe1b0('0x8'));var crypto=require(_0xe1b0('0x9'));var jsforce=require(_0xe1b0('0xa'));var deskjs=require(_0xe1b0('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe1b0('0xc'));var authService=require(_0xe1b0('0xd'));var qs=require(_0xe1b0('0xe'));var as=require(_0xe1b0('0xf'));var hardwareService=require(_0xe1b0('0x10'));var logger=require(_0xe1b0('0x11'))(_0xe1b0('0x12'));var utils=require(_0xe1b0('0x13'));var config=require(_0xe1b0('0x14'));var licenseUtil=require(_0xe1b0('0x15'));var db=require(_0xe1b0('0x16'))['db'];config[_0xe1b0('0x17')]=_[_0xe1b0('0x18')](config['redis'],{'host':_0xe1b0('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe1b0('0x1a'))[_0xe1b0('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xe1b0('0x1c')][_0xe1b0('0x1d')]({'port':0x232c});var client9002=jayson[_0xe1b0('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18a8e4,_0x186aea,_0x5f4adf,_0x8f8841){return new BPromise(function(_0x3b04c8,_0x87bd37){var _0x5b8478=_0x8f8841||client;return _0x5b8478[_0xe1b0('0x1e')](_0x18a8e4,_0x5f4adf)[_0xe1b0('0x1f')](function(_0x22194a){logger[_0xe1b0('0x20')](_0xe1b0('0x21'),_0x186aea,_0xe1b0('0x22'));logger[_0xe1b0('0x23')](_0xe1b0('0x24'),_0x186aea,_0xe1b0('0x22'),JSON[_0xe1b0('0x25')](_0x22194a));if(_0x22194a[_0xe1b0('0x26')]){if(_0x22194a[_0xe1b0('0x26')]['code']===0x1f4){logger[_0xe1b0('0x26')]('FaxMessage,\x20%s,\x20%s',_0x186aea,_0x22194a[_0xe1b0('0x26')][_0xe1b0('0x27')]);return _0x87bd37(_0x22194a[_0xe1b0('0x26')]['message']);}logger[_0xe1b0('0x26')]('FaxMessage,\x20%s,\x20%s',_0x186aea,_0x22194a[_0xe1b0('0x26')][_0xe1b0('0x27')]);return _0x3b04c8(_0x22194a[_0xe1b0('0x26')][_0xe1b0('0x27')]);}else{logger[_0xe1b0('0x20')](_0xe1b0('0x21'),_0x186aea,'request\x20sent');_0x3b04c8(_0x22194a[_0xe1b0('0x28')][_0xe1b0('0x27')]);}})[_0xe1b0('0x29')](function(_0x51bd5c){logger[_0xe1b0('0x26')](_0xe1b0('0x21'),_0x186aea,_0x51bd5c);_0x87bd37(_0x51bd5c);});});}function respondWithStatusCode(_0x1efd1a,_0x1a3fae){_0x1a3fae=_0x1a3fae||0xcc;return function(_0x262ff2){if(_0x262ff2){return _0x1efd1a[_0xe1b0('0x2a')](_0x1a3fae);}return _0x1efd1a['status'](_0x1a3fae)[_0xe1b0('0x2b')]();};}function respondWithResult(_0x6aa851,_0x32a008){_0x32a008=_0x32a008||0xc8;return function(_0x4a21c2){if(_0x4a21c2){return _0x6aa851[_0xe1b0('0x2c')](_0x32a008)[_0xe1b0('0x2d')](_0x4a21c2);}};}function respondWithFilteredResult(_0x5ce721,_0x9c00ec){return function(_0x11b845){if(_0x11b845){var _0x1558ed=typeof _0x9c00ec['offset']==='undefined'&&typeof _0x9c00ec[_0xe1b0('0x2e')]==='undefined';var _0x22fb2d=_0x11b845[_0xe1b0('0x2f')];var _0x990da2=_0x1558ed?0x0:_0x9c00ec[_0xe1b0('0x30')];var _0x59c76f=_0x1558ed?_0x11b845[_0xe1b0('0x2f')]:_0x9c00ec['offset']+_0x9c00ec['limit'];var _0x37c571;if(_0x59c76f>=_0x22fb2d){_0x59c76f=_0x22fb2d;_0x37c571=0xc8;}else{_0x37c571=0xce;}_0x5ce721[_0xe1b0('0x2c')](_0x37c571);return _0x5ce721[_0xe1b0('0x31')](_0xe1b0('0x32'),_0x990da2+'-'+_0x59c76f+'/'+_0x22fb2d)[_0xe1b0('0x2d')](_0x11b845);}return null;};}function patchUpdates(_0x598231){return function(_0x30d7ed){try{jsonpatch['apply'](_0x30d7ed,_0x598231,!![]);}catch(_0x4fd6b1){return BPromise[_0xe1b0('0x33')](_0x4fd6b1);}return _0x30d7ed[_0xe1b0('0x34')]();};}function saveUpdates(_0x4b60ef,_0x8ad38b){return function(_0x203882){if(_0x203882){return _0x203882[_0xe1b0('0x35')](_0x4b60ef)[_0xe1b0('0x1f')](function(_0x419138){return _0x419138;});}return null;};}function removeEntity(_0x27f944,_0x2b1d70){return function(_0x373e66){if(_0x373e66){return _0x373e66[_0xe1b0('0x36')]()[_0xe1b0('0x1f')](function(){_0x27f944[_0xe1b0('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x305350,_0x1dae0e){return function(_0x49a5e5){if(!_0x49a5e5){_0x305350[_0xe1b0('0x2a')](0x194);}return _0x49a5e5;};}function handleError(_0x53bde3,_0x9542a5){_0x9542a5=_0x9542a5||0x1f4;return function(_0x283578){logger[_0xe1b0('0x26')](_0x283578[_0xe1b0('0x37')]);if(_0x283578['name']){delete _0x283578['name'];}_0x53bde3[_0xe1b0('0x2c')](_0x9542a5)[_0xe1b0('0x38')](_0x283578);};}exports[_0xe1b0('0x39')]=function(_0xd2b64c,_0x253856){var _0x5eafec={},_0x10b4b1={},_0x4076a2={'count':0x0,'rows':[]};var _0x449d63=_[_0xe1b0('0x3a')](db[_0xe1b0('0x3b')]['rawAttributes'],function(_0x52b1b1){return{'name':_0x52b1b1[_0xe1b0('0x3c')],'type':_0x52b1b1[_0xe1b0('0x3d')][_0xe1b0('0x3e')]};});_0x10b4b1[_0xe1b0('0x3f')]=_[_0xe1b0('0x3a')](_0x449d63,'name');_0x10b4b1['query']=_['keys'](_0xd2b64c['query']);_0x10b4b1['filters']=_['intersection'](_0x10b4b1['model'],_0x10b4b1[_0xe1b0('0x40')]);_0x5eafec[_0xe1b0('0x41')]=_[_0xe1b0('0x42')](_0x10b4b1[_0xe1b0('0x3f')],qs[_0xe1b0('0x43')](_0xd2b64c[_0xe1b0('0x40')]['fields']));_0x5eafec['attributes']=_0x5eafec[_0xe1b0('0x41')][_0xe1b0('0x44')]?_0x5eafec[_0xe1b0('0x41')]:_0x10b4b1['model'];if(!_0xd2b64c[_0xe1b0('0x40')]['hasOwnProperty'](_0xe1b0('0x45'))){_0x5eafec[_0xe1b0('0x2e')]=qs['limit'](_0xd2b64c[_0xe1b0('0x40')][_0xe1b0('0x2e')]);_0x5eafec[_0xe1b0('0x30')]=qs['offset'](_0xd2b64c['query'][_0xe1b0('0x30')]);}_0x5eafec[_0xe1b0('0x46')]=qs['sort'](_0xd2b64c[_0xe1b0('0x40')][_0xe1b0('0x47')]);_0x5eafec[_0xe1b0('0x48')]=qs['filters'](_[_0xe1b0('0x49')](_0xd2b64c['query'],_0x10b4b1['filters']),_0x449d63);if(_0xd2b64c[_0xe1b0('0x40')][_0xe1b0('0x4a')]){_0x5eafec[_0xe1b0('0x48')]=_['merge'](_0x5eafec[_0xe1b0('0x48')],{'$or':_[_0xe1b0('0x3a')](_0x449d63,function(_0x180808){if(_0x180808[_0xe1b0('0x3d')]!==_0xe1b0('0x4b')){var _0x1a1a18={};_0x1a1a18[_0x180808['name']]={'$like':'%'+_0xd2b64c[_0xe1b0('0x40')]['filter']+'%'};return _0x1a1a18;}})});}_0x5eafec=_[_0xe1b0('0x4c')]({},_0x5eafec,_0xd2b64c[_0xe1b0('0x4d')]);var _0x314854={'where':_0x5eafec[_0xe1b0('0x48')]};return db['FaxMessage'][_0xe1b0('0x2f')](_0x314854)[_0xe1b0('0x1f')](function(_0x37bd71){_0x4076a2['count']=_0x37bd71;if(_0xd2b64c[_0xe1b0('0x40')][_0xe1b0('0x4e')]){_0x5eafec[_0xe1b0('0x4f')]=[{'all':!![]}];}return db['FaxMessage'][_0xe1b0('0x50')](_0x5eafec);})[_0xe1b0('0x1f')](function(_0x4f9bee){_0x4076a2[_0xe1b0('0x51')]=_0x4f9bee;return _0x4076a2;})[_0xe1b0('0x1f')](respondWithFilteredResult(_0x253856,_0x5eafec))[_0xe1b0('0x29')](handleError(_0x253856,null));};exports[_0xe1b0('0x52')]=function(_0xcf5573,_0x54ce30){var _0x26cd4f={'raw':!![],'where':{'id':_0xcf5573[_0xe1b0('0x53')]['id']}},_0x4d2135={};_0x4d2135['model']=_['keys'](db['FaxMessage'][_0xe1b0('0x54')]);_0x4d2135['query']=_['keys'](_0xcf5573['query']);_0x4d2135['filters']=_[_0xe1b0('0x42')](_0x4d2135[_0xe1b0('0x3f')],_0x4d2135[_0xe1b0('0x40')]);_0x26cd4f[_0xe1b0('0x41')]=_['intersection'](_0x4d2135['model'],qs['fields'](_0xcf5573[_0xe1b0('0x40')][_0xe1b0('0x43')]));_0x26cd4f[_0xe1b0('0x41')]=_0x26cd4f[_0xe1b0('0x41')][_0xe1b0('0x44')]?_0x26cd4f[_0xe1b0('0x41')]:_0x4d2135['model'];if(_0xcf5573[_0xe1b0('0x40')][_0xe1b0('0x4e')]){_0x26cd4f[_0xe1b0('0x4f')]=[{'all':!![]}];}_0x26cd4f=_[_0xe1b0('0x4c')]({},_0x26cd4f,_0xcf5573[_0xe1b0('0x4d')]);return db[_0xe1b0('0x3b')]['find'](_0x26cd4f)[_0xe1b0('0x1f')](handleEntityNotFound(_0x54ce30,null))['then'](respondWithResult(_0x54ce30,null))[_0xe1b0('0x29')](handleError(_0x54ce30,null));};exports[_0xe1b0('0x35')]=function(_0x15eb65,_0x18db81){if(_0x15eb65[_0xe1b0('0x55')]['id']){delete _0x15eb65[_0xe1b0('0x55')]['id'];}return db[_0xe1b0('0x3b')]['find']({'where':{'id':_0x15eb65[_0xe1b0('0x53')]['id']}})[_0xe1b0('0x1f')](handleEntityNotFound(_0x18db81,null))[_0xe1b0('0x1f')](saveUpdates(_0x15eb65[_0xe1b0('0x55')],null))['then'](respondWithResult(_0x18db81,null))[_0xe1b0('0x29')](handleError(_0x18db81,null));};exports['destroy']=function(_0x51069d,_0x490579){return db[_0xe1b0('0x3b')][_0xe1b0('0x56')]({'where':{'id':_0x51069d[_0xe1b0('0x53')]['id']}})[_0xe1b0('0x1f')](handleEntityNotFound(_0x490579,null))[_0xe1b0('0x1f')](removeEntity(_0x490579,null))[_0xe1b0('0x29')](handleError(_0x490579,null));};exports['describe']=function(_0x117cec,_0xb0491e){return db['FaxMessage'][_0xe1b0('0x57')]()['then'](respondWithResult(_0xb0491e,null))[_0xe1b0('0x29')](handleError(_0xb0491e,null));};var interaction_log=require(_0xe1b0('0x11'))(_0xe1b0('0x58'));exports['accept']=function(_0x45ab44,_0x2ac41b,_0x369186){var _0x5eecb8={'agent':{},'channel':'fax'};if(_0x45ab44['body']['id']){delete _0x45ab44[_0xe1b0('0x55')]['id'];}_0x45ab44[_0xe1b0('0x55')]['read']=!![];_0x45ab44[_0xe1b0('0x55')]['readAt']=moment()[_0xe1b0('0x59')](_0xe1b0('0x5a'));_0x45ab44['body']['UserId']=_0x45ab44[_0xe1b0('0x55')][_0xe1b0('0x5b')]||_0x45ab44[_0xe1b0('0x5c')]['id'];_0x5eecb8[_0xe1b0('0x5d')]['id']=_0x45ab44[_0xe1b0('0x55')][_0xe1b0('0x5b')];return db[_0xe1b0('0x3b')][_0xe1b0('0x56')]({'where':{'id':_0x45ab44[_0xe1b0('0x53')]['id'],'UserId':null}})[_0xe1b0('0x1f')](handleEntityNotFound(_0x2ac41b,null))[_0xe1b0('0x1f')](saveUpdates(_0x45ab44[_0xe1b0('0x55')],null))[_0xe1b0('0x1f')](function(_0xebd1b1){if(_0xebd1b1){_0x5eecb8['message']=_0xebd1b1[_0xe1b0('0x5e')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0xebd1b1[_0xe1b0('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x2ac41b,null))[_0xe1b0('0x1f')](function(_0x5d0231){if(_0x5d0231){return _0x5d0231[_0xe1b0('0x35')]({'UserId':_0x45ab44[_0xe1b0('0x55')][_0xe1b0('0x5b')],'read1stAt':_[_0xe1b0('0x60')](_0x5d0231[_0xe1b0('0x61')])?moment()[_0xe1b0('0x59')](_0xe1b0('0x5a')):undefined});}return null;})[_0xe1b0('0x1f')](function(_0x1afef9){if(_0x1afef9){_0x5eecb8['interaction']=_0x1afef9['get']({'plain':!![]});interaction_log['info'](_0xe1b0('0x62'),_0x45ab44[_0xe1b0('0x5c')]['id'],_0x45ab44[_0xe1b0('0x5c')][_0xe1b0('0x63')],_0x45ab44[_0xe1b0('0x5c')]['role'],_0x5eecb8[_0xe1b0('0x64')]['id'],_0x45ab44[_0xe1b0('0x55')]?JSON[_0xe1b0('0x25')](_0x45ab44['body']):'null');return respondWithRpcPromise(_0xe1b0('0x65'),_0xe1b0('0x66'),_0x5eecb8);}return null;})[_0xe1b0('0x1f')](function(_0x1e0c3c){var _0x4355e5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1e0c3c['message'][_0xe1b0('0x67')];return db[_0xe1b0('0x68')]['query'](_0x4355e5,{'type':db['Sequelize']['QueryTypes'][_0xe1b0('0x69')],'raw':!![]})[_0xe1b0('0x1f')](function(_0x5d532b){return _0x5d532b;});})[_0xe1b0('0x1f')](function(_0x224122){if(_0x224122){_0x5eecb8[_0xe1b0('0x27')]['contact']=_0x224122[0x0];if(!_0x45ab44['body'][_0xe1b0('0x5b')])return;return db[_0xe1b0('0x6a')]['find']({'where':{'id':_0x45ab44[_0xe1b0('0x55')][_0xe1b0('0x5b')],'role':_0xe1b0('0x5d')},'attributes':['id',_0xe1b0('0x63'),_0xe1b0('0x6b'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x3990f4){if(!_0x3990f4)return null;_0x5eecb8[_0xe1b0('0x27')]['agent']=_0x3990f4;return _0x5eecb8;})[_0xe1b0('0x1f')](function(_0x2bd18f){if(_0x2bd18f){if(_0x45ab44[_0xe1b0('0x55')][_0xe1b0('0x6c')]){_0x5eecb8[_0xe1b0('0x27')]['interface']=util['format'](_0xe1b0('0x6d'),_0x45ab44[_0xe1b0('0x5c')]['name']);_0x5eecb8['message']['channel']=_0x5eecb8['channel'];_0x5eecb8[_0xe1b0('0x27')][_0xe1b0('0x6e')]=_0x5eecb8['channel'];_0x5eecb8['message'][_0xe1b0('0x6f')]=_0xe1b0('0x70');return respondWithRpcPromise(_0xe1b0('0x71'),_0xe1b0('0x71'),{'event':_0xe1b0('0x72'),'message':_0x5eecb8[_0xe1b0('0x27')]},client9002)[_0xe1b0('0x1f')](function(){return _0x5eecb8;});}return _0x5eecb8;}return null;})[_0xe1b0('0x1f')](respondWithResult(_0x2ac41b,null))['catch'](handleError(_0x2ac41b,null));};var interaction_log=require(_0xe1b0('0x11'))(_0xe1b0('0x58'));exports[_0xe1b0('0x33')]=function(_0x2c748b,_0x6468ff,_0x1a8149){var _0x4deb8e={'agent':{},'channel':_0xe1b0('0x73')};if(_0x2c748b[_0xe1b0('0x55')]['id']){delete _0x2c748b[_0xe1b0('0x55')]['id'];}_0x2c748b[_0xe1b0('0x55')][_0xe1b0('0x5b')]=_0x2c748b[_0xe1b0('0x55')][_0xe1b0('0x5b')]||_0x2c748b[_0xe1b0('0x5c')]['id'];_0x4deb8e[_0xe1b0('0x5d')]['id']=_0x2c748b[_0xe1b0('0x55')][_0xe1b0('0x5b')];return db[_0xe1b0('0x3b')]['find']({'where':{'id':_0x2c748b['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x6468ff,null))[_0xe1b0('0x1f')](function(_0x3e6faa){if(_0x3e6faa){_0x4deb8e[_0xe1b0('0x27')]=_0x3e6faa['get']({'plain':!![]});return db[_0xe1b0('0x74')]['find']({'where':{'id':_0x3e6faa[_0xe1b0('0x5f')]}});}return null;})[_0xe1b0('0x1f')](handleEntityNotFound(_0x6468ff,null))[_0xe1b0('0x1f')](function(_0xdbddea){if(_0xdbddea){_0x4deb8e['interaction']=_0xdbddea[_0xe1b0('0x5e')]({'plain':!![]});interaction_log[_0xe1b0('0x20')](_0xe1b0('0x75'),_0x2c748b[_0xe1b0('0x5c')]['id'],_0x2c748b['user'][_0xe1b0('0x63')],_0x2c748b[_0xe1b0('0x5c')]['role'],_0x4deb8e[_0xe1b0('0x64')]['id'],_0x2c748b['body']?JSON[_0xe1b0('0x25')](_0x2c748b[_0xe1b0('0x55')]):_0xe1b0('0x76'));return respondWithRpcPromise('RejectMessage',_0xe1b0('0x77'),_0x4deb8e);}return null;})[_0xe1b0('0x1f')](function(_0x17801d){var _0x1773de=_0xe1b0('0x78')+_0x17801d['message'][_0xe1b0('0x67')];return db['sequelize'][_0xe1b0('0x40')](_0x1773de,{'type':db[_0xe1b0('0x79')][_0xe1b0('0x7a')]['SELECT'],'raw':!![]})['then'](function(_0x571d13){return _0x571d13;});})[_0xe1b0('0x1f')](function(_0x25707e){if(_0x25707e){_0x4deb8e[_0xe1b0('0x27')][_0xe1b0('0x7b')]=_0x25707e[0x0];if(!_0x2c748b[_0xe1b0('0x55')][_0xe1b0('0x5b')])return;return db[_0xe1b0('0x6a')]['find']({'where':{'id':_0x2c748b[_0xe1b0('0x55')][_0xe1b0('0x5b')],'role':_0xe1b0('0x5d')},'attributes':['id',_0xe1b0('0x63'),'fullname',_0xe1b0('0x7c'),_0xe1b0('0x7d')],'raw':!![]});}return null;})[_0xe1b0('0x1f')](function(_0x16d31c){if(!_0x16d31c)return null;_0x4deb8e[_0xe1b0('0x27')]['agent']=_0x16d31c;return _0x4deb8e;})[_0xe1b0('0x1f')](function(_0x1a15de){if(_0x1a15de){_0x1a15de[_0xe1b0('0x27')][_0xe1b0('0x7e')]=util[_0xe1b0('0x59')](_0xe1b0('0x6d'),_0x2c748b[_0xe1b0('0x5c')][_0xe1b0('0x63')]);_0x1a15de[_0xe1b0('0x27')][_0xe1b0('0x7f')]=_0x4deb8e[_0xe1b0('0x7f')];_0x1a15de['message'][_0xe1b0('0x6e')]=_0x4deb8e[_0xe1b0('0x7f')];_0x1a15de[_0xe1b0('0x27')][_0xe1b0('0x6f')]=_0xe1b0('0x33');respondWithRpcPromise('EventManager',_0xe1b0('0x71'),{'event':_0xe1b0('0x80'),'message':_0x1a15de[_0xe1b0('0x27')]},client9002);return _0x4deb8e;}return null;})[_0xe1b0('0x1f')](respondWithResult(_0x6468ff,null))[_0xe1b0('0x29')](handleError(_0x6468ff,null));};exports[_0xe1b0('0x81')]=function(_0x5dd481,_0x508658){var _0x5c34a6;return db[_0xe1b0('0x3b')][_0xe1b0('0x81')](_0x5dd481[_0xe1b0('0x55')],{})['then'](function(_0x2d9f3c){_0x5c34a6=_0x2d9f3c;return db[_0xe1b0('0x82')][_0xe1b0('0x83')]({'where':{'id':_0x5c34a6[_0xe1b0('0x67')]}});})[_0xe1b0('0x1f')](function(_0x2960d1){if(_[_0xe1b0('0x60')](_0x2960d1)){return;}else{_0x5c34a6[_0xe1b0('0x73')]=_0x2960d1['fax'];return db[_0xe1b0('0x84')][_0xe1b0('0x83')]({'where':{'id':_0x5c34a6[_0xe1b0('0x85')]}});}})[_0xe1b0('0x1f')](function(_0x373f54){return respondWithRpcPromise('SendFax',_0xe1b0('0x86'),{'FaxAccountId':_[_0xe1b0('0x60')](_0x5dd481[_0xe1b0('0x55')])?undefined:_0x5dd481[_0xe1b0('0x55')]['FaxAccountId'],'path':_[_0xe1b0('0x60')](_0x373f54)?undefined:util['format']('/var/opt/motion2/server/files/attachments/%s',_0x373f54[_0xe1b0('0x87')]),'fax':_[_0xe1b0('0x60')](_0x5c34a6[_0xe1b0('0x73')])?undefined:_0x5c34a6[_0xe1b0('0x73')],'AttachmentId':_0x5c34a6['AttachmentId']},client9002);})[_0xe1b0('0x1f')](respondWithResult(_0x508658,0xc9))[_0xe1b0('0x29')](handleError(_0x508658,null));};exports[_0xe1b0('0x88')]=function(_0x4f898b,_0x10c60d){var _0x44532f=path['join'](config[_0xe1b0('0x89')],_0xe1b0('0x8a'),_0xe1b0('0x8b'),_0xe1b0('0x8c'));return db[_0xe1b0('0x3b')][_0xe1b0('0x56')]({'where':{'id':_0x4f898b['params']['id']},'include':[{'model':db['Attachment'],'as':_0xe1b0('0x84')}]})[_0xe1b0('0x1f')](handleEntityNotFound(_0x10c60d,null))[_0xe1b0('0x1f')](function(_0x5f7853){if(_0x5f7853){return _0x10c60d[_0xe1b0('0x88')](path[_0xe1b0('0x8d')](_0x44532f,_0x5f7853[_0xe1b0('0x84')][_0xe1b0('0x87')]));}})['catch'](handleError(_0x10c60d,null));}; \ No newline at end of file +var _0x9b7e=['AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','root','server','files','Attachment','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','request','then','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','info','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','end','name','map','FaxMessage','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','find','body','destroy','params','describe','../../config/logger','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','FaxInteraction','FaxInteractionId','isNil','read1stAt','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','User','fullname','rejectmessage','create','CmContact','findOne'];(function(_0xc0c66d,_0x417138){var _0x53ede7=function(_0x1e2afc){while(--_0x1e2afc){_0xc0c66d['push'](_0xc0c66d['shift']());}};_0x53ede7(++_0x417138);}(_0x9b7e,0x12e));var _0xe9b7=function(_0xf4d05,_0x5e601f){_0xf4d05=_0xf4d05-0x0;var _0x47c971=_0x9b7e[_0xf4d05];return _0x47c971;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9b7('0x0'));var zipdir=require(_0xe9b7('0x1'));var jsonpatch=require(_0xe9b7('0x2'));var rp=require(_0xe9b7('0x3'));var moment=require(_0xe9b7('0x4'));var BPromise=require(_0xe9b7('0x5'));var Mustache=require(_0xe9b7('0x6'));var util=require(_0xe9b7('0x7'));var path=require(_0xe9b7('0x8'));var sox=require(_0xe9b7('0x9'));var csv=require('to-csv');var ejs=require(_0xe9b7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9b7('0xb'));var squel=require('squel');var crypto=require(_0xe9b7('0xc'));var jsforce=require(_0xe9b7('0xd'));var deskjs=require(_0xe9b7('0xe'));var toCsv=require(_0xe9b7('0xf'));var querystring=require(_0xe9b7('0x10'));var Papa=require(_0xe9b7('0x11'));var Redis=require(_0xe9b7('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe9b7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe9b7('0x14'));var logger=require('../../config/logger')(_0xe9b7('0x15'));var utils=require(_0xe9b7('0x16'));var config=require(_0xe9b7('0x17'));var licenseUtil=require(_0xe9b7('0x18'));var db=require(_0xe9b7('0x19'))['db'];config[_0xe9b7('0x1a')]=_[_0xe9b7('0x1b')](config[_0xe9b7('0x1a')],{'host':_0xe9b7('0x1c'),'port':0x18eb});var socket=require(_0xe9b7('0x1d'))(new Redis(config[_0xe9b7('0x1a')]));require(_0xe9b7('0x1e'))['register'](socket);var jayson=require(_0xe9b7('0x1f'));var client=jayson[_0xe9b7('0x20')][_0xe9b7('0x21')]({'port':0x232c});var client9002=jayson[_0xe9b7('0x20')][_0xe9b7('0x21')]({'port':0x232a});function respondWithRpcPromise(_0xf5492e,_0x4dbb6b,_0x375782,_0x117cbd){return new BPromise(function(_0x44187e,_0x2323b8){var _0x3f17ca=_0x117cbd||client;return _0x3f17ca[_0xe9b7('0x22')](_0xf5492e,_0x375782)[_0xe9b7('0x23')](function(_0x3664fa){logger['info']('FaxMessage,\x20%s,\x20%s',_0x4dbb6b,_0xe9b7('0x24'));logger[_0xe9b7('0x25')](_0xe9b7('0x26'),_0x4dbb6b,_0xe9b7('0x24'),JSON[_0xe9b7('0x27')](_0x3664fa));if(_0x3664fa[_0xe9b7('0x28')]){if(_0x3664fa[_0xe9b7('0x28')][_0xe9b7('0x29')]===0x1f4){logger[_0xe9b7('0x28')](_0xe9b7('0x2a'),_0x4dbb6b,_0x3664fa[_0xe9b7('0x28')][_0xe9b7('0x2b')]);return _0x2323b8(_0x3664fa['error']['message']);}logger[_0xe9b7('0x28')](_0xe9b7('0x2a'),_0x4dbb6b,_0x3664fa[_0xe9b7('0x28')][_0xe9b7('0x2b')]);return _0x44187e(_0x3664fa['error'][_0xe9b7('0x2b')]);}else{logger[_0xe9b7('0x2c')]('FaxMessage,\x20%s,\x20%s',_0x4dbb6b,'request\x20sent');_0x44187e(_0x3664fa['result'][_0xe9b7('0x2b')]);}})[_0xe9b7('0x2d')](function(_0x569dc8){logger[_0xe9b7('0x28')](_0xe9b7('0x2a'),_0x4dbb6b,_0x569dc8);_0x2323b8(_0x569dc8);});});}function respondWithStatusCode(_0x3d7b22,_0x4cfd5){_0x4cfd5=_0x4cfd5||0xcc;return function(_0x4fb652){if(_0x4fb652){return _0x3d7b22[_0xe9b7('0x2e')](_0x4cfd5);}return _0x3d7b22[_0xe9b7('0x2f')](_0x4cfd5)['end']();};}function respondWithResult(_0x12ed79,_0x2ef50b){_0x2ef50b=_0x2ef50b||0xc8;return function(_0x564f6c){if(_0x564f6c){return _0x12ed79[_0xe9b7('0x2f')](_0x2ef50b)['json'](_0x564f6c);}};}function respondWithFilteredResult(_0x25aa9b,_0x393f17){return function(_0x5629ff){if(_0x5629ff){var _0x2b5f0e=typeof _0x393f17[_0xe9b7('0x30')]===_0xe9b7('0x31')&&typeof _0x393f17[_0xe9b7('0x32')]===_0xe9b7('0x31');var _0x4b1c34=_0x5629ff['count'];var _0x227ec6=_0x2b5f0e?0x0:_0x393f17['offset'];var _0x13304f=_0x2b5f0e?_0x5629ff[_0xe9b7('0x33')]:_0x393f17[_0xe9b7('0x30')]+_0x393f17[_0xe9b7('0x32')];var _0x2488db;if(_0x13304f>=_0x4b1c34){_0x13304f=_0x4b1c34;_0x2488db=0xc8;}else{_0x2488db=0xce;}_0x25aa9b['status'](_0x2488db);return _0x25aa9b[_0xe9b7('0x34')](_0xe9b7('0x35'),_0x227ec6+'-'+_0x13304f+'/'+_0x4b1c34)[_0xe9b7('0x36')](_0x5629ff);}return null;};}function patchUpdates(_0x3e9bdb){return function(_0x57f9e9){try{jsonpatch['apply'](_0x57f9e9,_0x3e9bdb,!![]);}catch(_0x3e5bec){return BPromise[_0xe9b7('0x37')](_0x3e5bec);}return _0x57f9e9[_0xe9b7('0x38')]();};}function saveUpdates(_0x1bcfc9,_0x2e2c3f){return function(_0x2c693e){if(_0x2c693e){return _0x2c693e[_0xe9b7('0x39')](_0x1bcfc9)[_0xe9b7('0x23')](function(_0x519a1a){return _0x519a1a;});}return null;};}function removeEntity(_0xef3e44,_0x56bbf5){return function(_0x59bdbb){if(_0x59bdbb){return _0x59bdbb['destroy']()[_0xe9b7('0x23')](function(){_0xef3e44['status'](0xcc)[_0xe9b7('0x3a')]();});}};}function handleEntityNotFound(_0x340fef,_0x503834){return function(_0x11723b){if(!_0x11723b){_0x340fef[_0xe9b7('0x2e')](0x194);}return _0x11723b;};}function handleError(_0x2d2437,_0x13ca27){_0x13ca27=_0x13ca27||0x1f4;return function(_0x4e4123){logger['error'](_0x4e4123['stack']);if(_0x4e4123[_0xe9b7('0x3b')]){delete _0x4e4123[_0xe9b7('0x3b')];}_0x2d2437[_0xe9b7('0x2f')](_0x13ca27)['send'](_0x4e4123);};}exports['index']=function(_0x145f89,_0x1479c4){var _0x513b9f={},_0x9bc738={},_0x5f3530={'count':0x0,'rows':[]};var _0xee9605=_[_0xe9b7('0x3c')](db[_0xe9b7('0x3d')]['rawAttributes'],function(_0xb576c){return{'name':_0xb576c[_0xe9b7('0x3e')],'type':_0xb576c['type']['key']};});_0x9bc738[_0xe9b7('0x3f')]=_[_0xe9b7('0x3c')](_0xee9605,_0xe9b7('0x3b'));_0x9bc738[_0xe9b7('0x40')]=_[_0xe9b7('0x41')](_0x145f89[_0xe9b7('0x40')]);_0x9bc738[_0xe9b7('0x42')]=_[_0xe9b7('0x43')](_0x9bc738[_0xe9b7('0x3f')],_0x9bc738[_0xe9b7('0x40')]);_0x513b9f[_0xe9b7('0x44')]=_['intersection'](_0x9bc738[_0xe9b7('0x3f')],qs['fields'](_0x145f89['query'][_0xe9b7('0x45')]));_0x513b9f[_0xe9b7('0x44')]=_0x513b9f[_0xe9b7('0x44')][_0xe9b7('0x46')]?_0x513b9f[_0xe9b7('0x44')]:_0x9bc738[_0xe9b7('0x3f')];if(!_0x145f89[_0xe9b7('0x40')][_0xe9b7('0x47')](_0xe9b7('0x48'))){_0x513b9f[_0xe9b7('0x32')]=qs[_0xe9b7('0x32')](_0x145f89['query']['limit']);_0x513b9f[_0xe9b7('0x30')]=qs[_0xe9b7('0x30')](_0x145f89[_0xe9b7('0x40')][_0xe9b7('0x30')]);}_0x513b9f[_0xe9b7('0x49')]=qs[_0xe9b7('0x4a')](_0x145f89[_0xe9b7('0x40')][_0xe9b7('0x4a')]);_0x513b9f[_0xe9b7('0x4b')]=qs[_0xe9b7('0x42')](_[_0xe9b7('0x4c')](_0x145f89[_0xe9b7('0x40')],_0x9bc738[_0xe9b7('0x42')]),_0xee9605);if(_0x145f89[_0xe9b7('0x40')]['filter']){_0x513b9f[_0xe9b7('0x4b')]=_[_0xe9b7('0x4d')](_0x513b9f[_0xe9b7('0x4b')],{'$or':_[_0xe9b7('0x3c')](_0xee9605,function(_0x2a6336){if(_0x2a6336['type']!==_0xe9b7('0x4e')){var _0x1fb4d3={};_0x1fb4d3[_0x2a6336[_0xe9b7('0x3b')]]={'$like':'%'+_0x145f89[_0xe9b7('0x40')][_0xe9b7('0x4f')]+'%'};return _0x1fb4d3;}})});}_0x513b9f=_[_0xe9b7('0x4d')]({},_0x513b9f,_0x145f89[_0xe9b7('0x50')]);var _0x22e916={'where':_0x513b9f[_0xe9b7('0x4b')]};return db['FaxMessage'][_0xe9b7('0x33')](_0x22e916)[_0xe9b7('0x23')](function(_0x46edad){_0x5f3530[_0xe9b7('0x33')]=_0x46edad;if(_0x145f89['query'][_0xe9b7('0x51')]){_0x513b9f[_0xe9b7('0x52')]=[{'all':!![]}];}return db['FaxMessage'][_0xe9b7('0x53')](_0x513b9f);})['then'](function(_0x4613c9){_0x5f3530[_0xe9b7('0x54')]=_0x4613c9;return _0x5f3530;})['then'](respondWithFilteredResult(_0x1479c4,_0x513b9f))[_0xe9b7('0x2d')](handleError(_0x1479c4,null));};exports[_0xe9b7('0x55')]=function(_0x2fa5b9,_0x37139b){var _0x3ca9f7={'raw':!![],'where':{'id':_0x2fa5b9['params']['id']}},_0x53f372={};_0x53f372[_0xe9b7('0x3f')]=_[_0xe9b7('0x41')](db[_0xe9b7('0x3d')]['rawAttributes']);_0x53f372['query']=_['keys'](_0x2fa5b9[_0xe9b7('0x40')]);_0x53f372['filters']=_[_0xe9b7('0x43')](_0x53f372[_0xe9b7('0x3f')],_0x53f372[_0xe9b7('0x40')]);_0x3ca9f7[_0xe9b7('0x44')]=_[_0xe9b7('0x43')](_0x53f372['model'],qs['fields'](_0x2fa5b9[_0xe9b7('0x40')][_0xe9b7('0x45')]));_0x3ca9f7[_0xe9b7('0x44')]=_0x3ca9f7[_0xe9b7('0x44')][_0xe9b7('0x46')]?_0x3ca9f7[_0xe9b7('0x44')]:_0x53f372[_0xe9b7('0x3f')];if(_0x2fa5b9['query'][_0xe9b7('0x51')]){_0x3ca9f7[_0xe9b7('0x52')]=[{'all':!![]}];}_0x3ca9f7=_[_0xe9b7('0x4d')]({},_0x3ca9f7,_0x2fa5b9['options']);return db[_0xe9b7('0x3d')][_0xe9b7('0x56')](_0x3ca9f7)[_0xe9b7('0x23')](handleEntityNotFound(_0x37139b,null))[_0xe9b7('0x23')](respondWithResult(_0x37139b,null))[_0xe9b7('0x2d')](handleError(_0x37139b,null));};exports[_0xe9b7('0x39')]=function(_0x46d1e9,_0x84baa5){if(_0x46d1e9[_0xe9b7('0x57')]['id']){delete _0x46d1e9[_0xe9b7('0x57')]['id'];}return db[_0xe9b7('0x3d')][_0xe9b7('0x56')]({'where':{'id':_0x46d1e9['params']['id']}})['then'](handleEntityNotFound(_0x84baa5,null))[_0xe9b7('0x23')](saveUpdates(_0x46d1e9[_0xe9b7('0x57')],null))[_0xe9b7('0x23')](respondWithResult(_0x84baa5,null))['catch'](handleError(_0x84baa5,null));};exports[_0xe9b7('0x58')]=function(_0x5be6af,_0x52d412){return db[_0xe9b7('0x3d')][_0xe9b7('0x56')]({'where':{'id':_0x5be6af[_0xe9b7('0x59')]['id']}})[_0xe9b7('0x23')](handleEntityNotFound(_0x52d412,null))['then'](removeEntity(_0x52d412,null))[_0xe9b7('0x2d')](handleError(_0x52d412,null));};exports[_0xe9b7('0x5a')]=function(_0x15b6a2,_0x39b8b0){return db[_0xe9b7('0x3d')][_0xe9b7('0x5a')]()['then'](respondWithResult(_0x39b8b0,null))[_0xe9b7('0x2d')](handleError(_0x39b8b0,null));};var interaction_log=require(_0xe9b7('0x5b'))('fax-interactions');exports[_0xe9b7('0x5c')]=function(_0x113150,_0x16ef94,_0x424a20){var _0x66a5ad={'agent':{},'channel':_0xe9b7('0x5d')};if(_0x113150[_0xe9b7('0x57')]['id']){delete _0x113150[_0xe9b7('0x57')]['id'];}_0x113150[_0xe9b7('0x57')][_0xe9b7('0x5e')]=!![];_0x113150['body'][_0xe9b7('0x5f')]=moment()[_0xe9b7('0x60')](_0xe9b7('0x61'));_0x113150[_0xe9b7('0x57')]['UserId']=_0x113150[_0xe9b7('0x57')][_0xe9b7('0x62')]||_0x113150['user']['id'];_0x66a5ad[_0xe9b7('0x63')]['id']=_0x113150[_0xe9b7('0x57')]['UserId'];return db[_0xe9b7('0x3d')][_0xe9b7('0x56')]({'where':{'id':_0x113150[_0xe9b7('0x59')]['id'],'UserId':null}})[_0xe9b7('0x23')](handleEntityNotFound(_0x16ef94,null))[_0xe9b7('0x23')](saveUpdates(_0x113150[_0xe9b7('0x57')],null))[_0xe9b7('0x23')](function(_0x225304){if(_0x225304){_0x66a5ad[_0xe9b7('0x2b')]=_0x225304['get']({'plain':!![]});return db[_0xe9b7('0x64')][_0xe9b7('0x56')]({'where':{'id':_0x225304[_0xe9b7('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x16ef94,null))[_0xe9b7('0x23')](function(_0x28e40c){if(_0x28e40c){return _0x28e40c[_0xe9b7('0x39')]({'UserId':_0x113150['body']['UserId'],'read1stAt':_[_0xe9b7('0x66')](_0x28e40c[_0xe9b7('0x67')])?moment()[_0xe9b7('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xe9b7('0x23')](function(_0x54ab70){if(_0x54ab70){_0x66a5ad['interaction']=_0x54ab70[_0xe9b7('0x68')]({'plain':!![]});interaction_log[_0xe9b7('0x2c')](_0xe9b7('0x69'),_0x113150['user']['id'],_0x113150[_0xe9b7('0x6a')][_0xe9b7('0x3b')],_0x113150['user'][_0xe9b7('0x6b')],_0x66a5ad[_0xe9b7('0x6c')]['id'],_0x113150[_0xe9b7('0x57')]?JSON[_0xe9b7('0x27')](_0x113150[_0xe9b7('0x57')]):_0xe9b7('0x6d'));return respondWithRpcPromise(_0xe9b7('0x6e'),_0xe9b7('0x6f'),_0x66a5ad);}return null;})[_0xe9b7('0x23')](function(_0x27fc64){var _0x5b8d69=_0xe9b7('0x70')+_0x27fc64[_0xe9b7('0x2b')]['ContactId'];return db[_0xe9b7('0x71')]['query'](_0x5b8d69,{'type':db[_0xe9b7('0x72')][_0xe9b7('0x73')][_0xe9b7('0x74')],'raw':!![]})[_0xe9b7('0x23')](function(_0x1fd7b7){return _0x1fd7b7;});})[_0xe9b7('0x23')](function(_0x41b8ce){if(_0x41b8ce){_0x66a5ad['message'][_0xe9b7('0x75')]=_0x41b8ce[0x0];if(!_0x113150[_0xe9b7('0x57')]['UserId'])return;return db['User'][_0xe9b7('0x56')]({'where':{'id':_0x113150[_0xe9b7('0x57')][_0xe9b7('0x62')],'role':_0xe9b7('0x63')},'attributes':['id',_0xe9b7('0x3b'),'fullname',_0xe9b7('0x76'),_0xe9b7('0x77')],'raw':!![]});}return null;})[_0xe9b7('0x23')](function(_0x30eb09){if(!_0x30eb09)return null;_0x66a5ad[_0xe9b7('0x2b')][_0xe9b7('0x63')]=_0x30eb09;return _0x66a5ad;})[_0xe9b7('0x23')](function(_0x5e6abc){if(_0x5e6abc){if(_0x113150['body'][_0xe9b7('0x78')]){_0x66a5ad[_0xe9b7('0x2b')][_0xe9b7('0x79')]=util['format'](_0xe9b7('0x7a'),_0x113150[_0xe9b7('0x6a')][_0xe9b7('0x3b')]);_0x66a5ad[_0xe9b7('0x2b')][_0xe9b7('0x7b')]=_0x66a5ad['channel'];_0x66a5ad[_0xe9b7('0x2b')][_0xe9b7('0x7c')]=_0x66a5ad[_0xe9b7('0x7b')];_0x66a5ad['message'][_0xe9b7('0x7d')]=_0xe9b7('0x5c');return respondWithRpcPromise(_0xe9b7('0x7e'),_0xe9b7('0x7e'),{'event':_0xe9b7('0x7f'),'message':_0x66a5ad[_0xe9b7('0x2b')]},client9002)[_0xe9b7('0x23')](function(){return _0x66a5ad;});}return _0x66a5ad;}return null;})['then'](respondWithResult(_0x16ef94,null))[_0xe9b7('0x2d')](handleError(_0x16ef94,null));};var interaction_log=require(_0xe9b7('0x5b'))('fax-interactions');exports[_0xe9b7('0x37')]=function(_0x50671f,_0x6cb49c,_0x54023b){var _0x298eda={'agent':{},'channel':_0xe9b7('0x5d')};if(_0x50671f[_0xe9b7('0x57')]['id']){delete _0x50671f[_0xe9b7('0x57')]['id'];}_0x50671f[_0xe9b7('0x57')][_0xe9b7('0x62')]=_0x50671f['body'][_0xe9b7('0x62')]||_0x50671f[_0xe9b7('0x6a')]['id'];_0x298eda[_0xe9b7('0x63')]['id']=_0x50671f['body'][_0xe9b7('0x62')];return db['FaxMessage'][_0xe9b7('0x56')]({'where':{'id':_0x50671f[_0xe9b7('0x59')]['id'],'UserId':null}})[_0xe9b7('0x23')](handleEntityNotFound(_0x6cb49c,null))[_0xe9b7('0x23')](function(_0x101440){if(_0x101440){_0x298eda[_0xe9b7('0x2b')]=_0x101440[_0xe9b7('0x68')]({'plain':!![]});return db[_0xe9b7('0x64')][_0xe9b7('0x56')]({'where':{'id':_0x101440[_0xe9b7('0x65')]}});}return null;})[_0xe9b7('0x23')](handleEntityNotFound(_0x6cb49c,null))['then'](function(_0x3b4982){if(_0x3b4982){_0x298eda[_0xe9b7('0x6c')]=_0x3b4982[_0xe9b7('0x68')]({'plain':!![]});interaction_log[_0xe9b7('0x2c')](_0xe9b7('0x80'),_0x50671f[_0xe9b7('0x6a')]['id'],_0x50671f[_0xe9b7('0x6a')]['name'],_0x50671f[_0xe9b7('0x6a')][_0xe9b7('0x6b')],_0x298eda[_0xe9b7('0x6c')]['id'],_0x50671f[_0xe9b7('0x57')]?JSON[_0xe9b7('0x27')](_0x50671f[_0xe9b7('0x57')]):'null');return respondWithRpcPromise('RejectMessage',_0xe9b7('0x81'),_0x298eda);}return null;})[_0xe9b7('0x23')](function(_0x1ac0f9){var _0x34c4fc=_0xe9b7('0x70')+_0x1ac0f9['message']['ContactId'];return db['sequelize'][_0xe9b7('0x40')](_0x34c4fc,{'type':db['Sequelize'][_0xe9b7('0x73')][_0xe9b7('0x74')],'raw':!![]})['then'](function(_0x2f4d72){return _0x2f4d72;});})['then'](function(_0xce6856){if(_0xce6856){_0x298eda[_0xe9b7('0x2b')][_0xe9b7('0x75')]=_0xce6856[0x0];if(!_0x50671f[_0xe9b7('0x57')]['UserId'])return;return db[_0xe9b7('0x82')][_0xe9b7('0x56')]({'where':{'id':_0x50671f[_0xe9b7('0x57')][_0xe9b7('0x62')],'role':_0xe9b7('0x63')},'attributes':['id',_0xe9b7('0x3b'),_0xe9b7('0x83'),'email',_0xe9b7('0x77')],'raw':!![]});}return null;})['then'](function(_0x5e0434){if(!_0x5e0434)return null;_0x298eda['message'][_0xe9b7('0x63')]=_0x5e0434;return _0x298eda;})[_0xe9b7('0x23')](function(_0x27b701){if(_0x27b701){_0x27b701[_0xe9b7('0x2b')][_0xe9b7('0x79')]=util[_0xe9b7('0x60')]('SIP/%s',_0x50671f[_0xe9b7('0x6a')]['name']);_0x27b701[_0xe9b7('0x2b')][_0xe9b7('0x7b')]=_0x298eda[_0xe9b7('0x7b')];_0x27b701['message']['motionChannel']=_0x298eda[_0xe9b7('0x7b')];_0x27b701[_0xe9b7('0x2b')][_0xe9b7('0x7d')]=_0xe9b7('0x37');respondWithRpcPromise(_0xe9b7('0x7e'),_0xe9b7('0x7e'),{'event':_0xe9b7('0x84'),'message':_0x27b701[_0xe9b7('0x2b')]},client9002);return _0x298eda;}return null;})[_0xe9b7('0x23')](respondWithResult(_0x6cb49c,null))[_0xe9b7('0x2d')](handleError(_0x6cb49c,null));};exports[_0xe9b7('0x85')]=function(_0x1cc8ef,_0x39d42d){var _0x33855a;return db['FaxMessage']['create'](_0x1cc8ef[_0xe9b7('0x57')],{})[_0xe9b7('0x23')](function(_0x40215c){_0x33855a=_0x40215c;return db[_0xe9b7('0x86')][_0xe9b7('0x87')]({'where':{'id':_0x33855a['ContactId']}});})['then'](function(_0xa6e907){if(_[_0xe9b7('0x66')](_0xa6e907)){return;}else{_0x33855a[_0xe9b7('0x5d')]=_0xa6e907[_0xe9b7('0x5d')];return db['Attachment'][_0xe9b7('0x87')]({'where':{'id':_0x33855a[_0xe9b7('0x88')]}});}})[_0xe9b7('0x23')](function(_0x3dc77f){return respondWithRpcPromise(_0xe9b7('0x89'),_0xe9b7('0x89'),{'FaxAccountId':_[_0xe9b7('0x66')](_0x1cc8ef['body'])?undefined:_0x1cc8ef[_0xe9b7('0x57')][_0xe9b7('0x8a')],'path':_[_0xe9b7('0x66')](_0x3dc77f)?undefined:util['format'](_0xe9b7('0x8b'),_0x3dc77f[_0xe9b7('0x8c')]),'fax':_[_0xe9b7('0x66')](_0x33855a[_0xe9b7('0x5d')])?undefined:_0x33855a[_0xe9b7('0x5d')],'AttachmentId':_0x33855a[_0xe9b7('0x88')]},client9002);})[_0xe9b7('0x23')](respondWithResult(_0x39d42d,0xc9))[_0xe9b7('0x2d')](handleError(_0x39d42d,null));};exports[_0xe9b7('0x8d')]=function(_0x5aaede,_0x250001){var _0x4da1f8=path['join'](config[_0xe9b7('0x8e')],_0xe9b7('0x8f'),_0xe9b7('0x90'),'attachments');return db[_0xe9b7('0x3d')][_0xe9b7('0x56')]({'where':{'id':_0x5aaede[_0xe9b7('0x59')]['id']},'include':[{'model':db[_0xe9b7('0x91')],'as':_0xe9b7('0x91')}]})[_0xe9b7('0x23')](handleEntityNotFound(_0x250001,null))[_0xe9b7('0x23')](function(_0x3ba484){if(_0x3ba484){return _0x250001[_0xe9b7('0x8d')](path['join'](_0x4da1f8,_0x3ba484[_0xe9b7('0x91')]['basename']));}})[_0xe9b7('0x2d')](handleError(_0x250001,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 8b3e25b..d75fa7b 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 _0x0650=['update','emit','exports','events','FaxMessage','setMaxListeners'];(function(_0x33dea6,_0x360557){var _0x222e64=function(_0x13ef9f){while(--_0x13ef9f){_0x33dea6['push'](_0x33dea6['shift']());}};_0x222e64(++_0x360557);}(_0x0650,0xed));var _0x0065=function(_0xfdd6b6,_0x19497a){_0xfdd6b6=_0xfdd6b6-0x0;var _0x464439=_0x0650[_0xfdd6b6];return _0x464439;};'use strict';var EventEmitter=require(_0x0065('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x0065('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x0065('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0065('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2e05a4){return function(_0x8260ba,_0x3dd8c6,_0x4b15b1){FaxMessageEvents[_0x0065('0x4')](_0x2e05a4+':'+_0x8260ba['id'],_0x8260ba);FaxMessageEvents['emit'](_0x2e05a4,_0x8260ba);_0x4b15b1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x0065('0x5')]=FaxMessageEvents; \ No newline at end of file +var _0xd9eb=['hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','emit'];(function(_0x3aa1f0,_0x2411a0){var _0x18f0df=function(_0x47dcc6){while(--_0x47dcc6){_0x3aa1f0['push'](_0x3aa1f0['shift']());}};_0x18f0df(++_0x2411a0);}(_0xd9eb,0xca));var _0xbd9e=function(_0x268cbc,_0x2bece3){_0x268cbc=_0x268cbc-0x0;var _0x2f3302=_0xd9eb[_0x268cbc];return _0x2f3302;};'use strict';var EventEmitter=require(_0xbd9e('0x0'));var FaxMessage=require(_0xbd9e('0x1'))['db'][_0xbd9e('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xbd9e('0x3')](0x0);var events={'afterCreate':_0xbd9e('0x4'),'afterUpdate':_0xbd9e('0x5'),'afterDestroy':_0xbd9e('0x6')};function emitEvent(_0x8d4b08){return function(_0x2b6174,_0x1df81b,_0x365865){FaxMessageEvents[_0xbd9e('0x7')](_0x8d4b08+':'+_0x2b6174['id'],_0x2b6174);FaxMessageEvents[_0xbd9e('0x7')](_0x8d4b08,_0x2b6174);_0x365865(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0xbd9e('0x8')](e,emitEvent(event));}}module[_0xbd9e('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 08aba00..85d27b1 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 _0xfa82=['utf8mb4','lodash','moment','bluebird','request-promise','../../config/environment','./faxMessage.attributes','define','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','error'];(function(_0x56ec61,_0x45ecf8){var _0x5aab6a=function(_0x42909b){while(--_0x42909b){_0x56ec61['push'](_0x56ec61['shift']());}};_0x5aab6a(++_0x45ecf8);}(_0xfa82,0x146));var _0x2fa8=function(_0x469b6b,_0x301166){_0x469b6b=_0x469b6b-0x0;var _0x14bc89=_0xfa82[_0x469b6b];return _0x14bc89;};'use strict';var _=require(_0x2fa8('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x2fa8('0x1'));var BPromise=require(_0x2fa8('0x2'));var rp=require(_0x2fa8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2fa8('0x4'));var attributes=require(_0x2fa8('0x5'));module['exports']=function(_0x53ebb2,_0xafb3ae){return _0x53ebb2[_0x2fa8('0x6')]('FaxMessage',attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x2fa8('0x7'),'fields':[_0x2fa8('0x8')],'type':_0x2fa8('0x9')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x22fe83,_0x24e381,_0x168d16){var _0x3dd3af=_0x53ebb2[_0x2fa8('0xa')];var _0x37e6e1=_0x22fe83[_0x2fa8('0xb')]({'plain':!![]});if(_0x37e6e1[_0x2fa8('0xc')]['toLowerCase']()==='in'||_0x37e6e1['direction'][_0x2fa8('0xd')]()===_0x2fa8('0xe')&&!_0x37e6e1['secret']&&!_[_0x2fa8('0xf')](_0x37e6e1[_0x2fa8('0x10')])){_0x3dd3af[_0x2fa8('0x11')][_0x2fa8('0x12')]({'where':{'id':_0x37e6e1[_0x2fa8('0x13')]}})[_0x2fa8('0x14')](function(_0x4e9140){if(_0x4e9140){_0x4e9140[_0x2fa8('0x15')]({'lastMsgAt':_0x37e6e1[_0x2fa8('0x16')],'lastMsgDirection':_0x37e6e1[_0x2fa8('0xc')][_0x2fa8('0xd')]()});}})['catch'](function(_0x5a4634){console[_0x2fa8('0x17')](_0x5a4634);});}_0x168d16();}},'charset':_0x2fa8('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3853=['lodash','util','../../config/logger','api','moment','request-promise','path','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','FaxInteraction','FaxInteractionId','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci'];(function(_0x2df0bf,_0x13990c){var _0x5c46a3=function(_0x5716ea){while(--_0x5716ea){_0x2df0bf['push'](_0x2df0bf['shift']());}};_0x5c46a3(++_0x13990c);}(_0x3853,0xa8));var _0x3385=function(_0x10583d,_0x1f18b6){_0x10583d=_0x10583d-0x0;var _0xc202e3=_0x3853[_0x10583d];return _0xc202e3;};'use strict';var _=require(_0x3385('0x0'));var util=require(_0x3385('0x1'));var logger=require(_0x3385('0x2'))(_0x3385('0x3'));var moment=require(_0x3385('0x4'));var BPromise=require('bluebird');var rp=require(_0x3385('0x5'));var fs=require('fs');var path=require(_0x3385('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3385('0x7'));module[_0x3385('0x8')]=function(_0x35d154,_0x5413b6){return _0x35d154[_0x3385('0x9')](_0x3385('0xa'),attributes,{'tableName':_0x3385('0xb'),'paranoid':![],'indexes':[{'name':_0x3385('0xc'),'fields':[_0x3385('0xd')],'type':_0x3385('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1ee4ef,_0x3fad7e,_0xff6ac){var _0x5d4c04=_0x35d154[_0x3385('0xf')];var _0x5a0d87=_0x1ee4ef[_0x3385('0x10')]({'plain':!![]});if(_0x5a0d87[_0x3385('0x11')]['toLowerCase']()==='in'||_0x5a0d87[_0x3385('0x11')][_0x3385('0x12')]()===_0x3385('0x13')&&!_0x5a0d87['secret']&&!_['isNil'](_0x5a0d87['UserId'])){_0x5d4c04[_0x3385('0x14')]['findOne']({'where':{'id':_0x5a0d87[_0x3385('0x15')]}})[_0x3385('0x16')](function(_0xe4c73){if(_0xe4c73){_0xe4c73[_0x3385('0x17')]({'lastMsgAt':_0x5a0d87[_0x3385('0x18')],'lastMsgDirection':_0x5a0d87[_0x3385('0x11')][_0x3385('0x12')]()});}})['catch'](function(_0x14f18a){console[_0x3385('0x19')](_0x14f18a);});}_0xff6ac();}},'charset':_0x3385('0x1a'),'collate':_0x3385('0x1b')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 6efea91..33f7a27 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 _0x24ca=['redis','defaults','socket.io-emitter','./faxMessage.socket','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','CreateFaxMessage','create','body','options','stringify','UpdateFaxMessage','FaxMessage','update','where','attributes','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x24ca,0x1bc));var _0xa24c=function(_0xe39824,_0xbdf61f){_0xe39824=_0xe39824-0x0;var _0x4bc31e=_0x24ca[_0xe39824];return _0x4bc31e;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var moment=require(_0xa24c('0x1'));var BPromise=require(_0xa24c('0x2'));var rs=require(_0xa24c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa24c('0x4'))['db'];var utils=require(_0xa24c('0x5'));var logger=require(_0xa24c('0x6'))(_0xa24c('0x7'));var config=require(_0xa24c('0x8'));var jayson=require(_0xa24c('0x9'));var client=jayson[_0xa24c('0xa')][_0xa24c('0xb')]({'port':0x232a});config[_0xa24c('0xc')]=_[_0xa24c('0xd')](config[_0xa24c('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xa24c('0xe'))(new Redis(config[_0xa24c('0xc')]));require(_0xa24c('0xf'))['register'](socket);function respondWithRpcPromise(_0x399f32,_0x325c6d,_0x288f76){return new BPromise(function(_0x211003,_0x169632){return client[_0xa24c('0x10')](_0x399f32,_0x288f76)[_0xa24c('0x11')](function(_0xc82af0){logger[_0xa24c('0x12')]('FaxMessage,\x20%s,\x20%s',_0x325c6d,_0xa24c('0x13'));logger[_0xa24c('0x14')](_0xa24c('0x15'),_0x325c6d,_0xa24c('0x13'),JSON['stringify'](_0xc82af0));if(_0xc82af0[_0xa24c('0x16')]){if(_0xc82af0[_0xa24c('0x16')][_0xa24c('0x17')]===0x1f4){logger[_0xa24c('0x16')](_0xa24c('0x18'),_0x325c6d,_0xc82af0[_0xa24c('0x16')][_0xa24c('0x19')]);return _0x169632(_0xc82af0['error']['message']);}logger[_0xa24c('0x16')](_0xa24c('0x18'),_0x325c6d,_0xc82af0['error']['message']);return _0x211003(_0xc82af0[_0xa24c('0x16')][_0xa24c('0x19')]);}else{logger['info'](_0xa24c('0x18'),_0x325c6d,'request\x20sent');_0x211003(_0xc82af0[_0xa24c('0x1a')][_0xa24c('0x19')]);}})[_0xa24c('0x1b')](function(_0xefdbd9){logger['error'](_0xa24c('0x18'),_0x325c6d,_0xefdbd9);_0x169632(_0xefdbd9);});});}exports[_0xa24c('0x1c')]=function(_0x773f70){var _0x4d4bab=this;return new Promise(function(_0x48a768,_0x506424){return db['FaxMessage'][_0xa24c('0x1d')](_0x773f70[_0xa24c('0x1e')],{'raw':_0x773f70[_0xa24c('0x1f')]?_0x773f70[_0xa24c('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0xa24c('0x11')](function(_0x5f299e){logger[_0xa24c('0x12')](_0xa24c('0x1c'),_0x773f70);logger['debug'](_0xa24c('0x1c'),_0x773f70,JSON[_0xa24c('0x20')](_0x5f299e));_0x48a768(_0x5f299e);})[_0xa24c('0x1b')](function(_0x188ee2){logger[_0xa24c('0x16')]('CreateFaxMessage',_0x188ee2[_0xa24c('0x19')],_0x773f70);_0x506424(_0x4d4bab['error'](0x1f4,_0x188ee2[_0xa24c('0x19')]));});});};exports[_0xa24c('0x21')]=function(_0x294685){var _0x51dc3f=this;return new Promise(function(_0x1beb55,_0x31c4d9){return db[_0xa24c('0x22')][_0xa24c('0x23')](_0x294685[_0xa24c('0x1e')],{'raw':_0x294685[_0xa24c('0x1f')]?_0x294685[_0xa24c('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x294685[_0xa24c('0x1f')]?_0x294685[_0xa24c('0x1f')][_0xa24c('0x24')]||null:null,'attributes':_0x294685[_0xa24c('0x1f')]?_0x294685['options'][_0xa24c('0x25')]||null:null,'limit':_0x294685[_0xa24c('0x1f')]?_0x294685[_0xa24c('0x1f')]['limit']||null:null})[_0xa24c('0x11')](function(_0x3dcb1b){logger[_0xa24c('0x12')]('UpdateFaxMessage',_0x294685);logger[_0xa24c('0x14')]('UpdateFaxMessage',_0x294685,JSON[_0xa24c('0x20')](_0x3dcb1b));_0x1beb55(_0x3dcb1b);})[_0xa24c('0x1b')](function(_0x1a247b){logger['error'](_0xa24c('0x21'),_0x1a247b[_0xa24c('0x19')],_0x294685);_0x31c4d9(_0x51dc3f[_0xa24c('0x16')](0x1f4,_0x1a247b['message']));});});}; \ No newline at end of file +var _0x22fb=['request','FaxMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','create','options','raw','then','debug','UpdateFaxMessage','update','body','attributes','limit','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x22fb,0x192));var _0xb22f=function(_0x1424d5,_0x7d87e){_0x1424d5=_0x1424d5-0x0;var _0x515683=_0x22fb[_0x1424d5];return _0x515683;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb22f('0x0'));var BPromise=require('bluebird');var rs=require(_0xb22f('0x1'));var fs=require('fs');var Redis=require(_0xb22f('0x2'));var db=require(_0xb22f('0x3'))['db'];var utils=require(_0xb22f('0x4'));var logger=require(_0xb22f('0x5'))('rpc');var config=require(_0xb22f('0x6'));var jayson=require(_0xb22f('0x7'));var client=jayson[_0xb22f('0x8')][_0xb22f('0x9')]({'port':0x232a});config[_0xb22f('0xa')]=_[_0xb22f('0xb')](config['redis'],{'host':_0xb22f('0xc'),'port':0x18eb});var socket=require(_0xb22f('0xd'))(new Redis(config[_0xb22f('0xa')]));require(_0xb22f('0xe'))[_0xb22f('0xf')](socket);function respondWithRpcPromise(_0x3593fb,_0x188cea,_0x2ca6dd){return new BPromise(function(_0x26cf79,_0x2676f3){return client[_0xb22f('0x10')](_0x3593fb,_0x2ca6dd)['then'](function(_0x4b9e56){logger['info'](_0xb22f('0x11'),_0x188cea,'request\x20sent');logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x188cea,_0xb22f('0x12'),JSON[_0xb22f('0x13')](_0x4b9e56));if(_0x4b9e56[_0xb22f('0x14')]){if(_0x4b9e56[_0xb22f('0x14')][_0xb22f('0x15')]===0x1f4){logger[_0xb22f('0x14')]('FaxMessage,\x20%s,\x20%s',_0x188cea,_0x4b9e56[_0xb22f('0x14')]['message']);return _0x2676f3(_0x4b9e56[_0xb22f('0x14')]['message']);}logger[_0xb22f('0x14')](_0xb22f('0x11'),_0x188cea,_0x4b9e56[_0xb22f('0x14')][_0xb22f('0x16')]);return _0x26cf79(_0x4b9e56[_0xb22f('0x14')]['message']);}else{logger[_0xb22f('0x17')]('FaxMessage,\x20%s,\x20%s',_0x188cea,_0xb22f('0x12'));_0x26cf79(_0x4b9e56[_0xb22f('0x18')][_0xb22f('0x16')]);}})[_0xb22f('0x19')](function(_0x139bb6){logger[_0xb22f('0x14')]('FaxMessage,\x20%s,\x20%s',_0x188cea,_0x139bb6);_0x2676f3(_0x139bb6);});});}exports[_0xb22f('0x1a')]=function(_0x4b4510){var _0x3e05ce=this;return new Promise(function(_0x3878d8,_0x316f11){return db[_0xb22f('0x1b')][_0xb22f('0x1c')](_0x4b4510['body'],{'raw':_0x4b4510['options']?_0x4b4510[_0xb22f('0x1d')][_0xb22f('0x1e')]===undefined?!![]:![]:!![]})[_0xb22f('0x1f')](function(_0x16e465){logger[_0xb22f('0x17')](_0xb22f('0x1a'),_0x4b4510);logger[_0xb22f('0x20')](_0xb22f('0x1a'),_0x4b4510,JSON['stringify'](_0x16e465));_0x3878d8(_0x16e465);})['catch'](function(_0x3ab1d8){logger[_0xb22f('0x14')]('CreateFaxMessage',_0x3ab1d8[_0xb22f('0x16')],_0x4b4510);_0x316f11(_0x3e05ce[_0xb22f('0x14')](0x1f4,_0x3ab1d8['message']));});});};exports[_0xb22f('0x21')]=function(_0x2918be){var _0x4dfb62=this;return new Promise(function(_0x3e471f,_0x2c4a9e){return db[_0xb22f('0x1b')][_0xb22f('0x22')](_0x2918be[_0xb22f('0x23')],{'raw':_0x2918be[_0xb22f('0x1d')]?_0x2918be[_0xb22f('0x1d')][_0xb22f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2918be['options']?_0x2918be['options']['where']||null:null,'attributes':_0x2918be[_0xb22f('0x1d')]?_0x2918be['options'][_0xb22f('0x24')]||null:null,'limit':_0x2918be[_0xb22f('0x1d')]?_0x2918be[_0xb22f('0x1d')][_0xb22f('0x25')]||null:null})[_0xb22f('0x1f')](function(_0x5b2a42){logger['info'](_0xb22f('0x21'),_0x2918be);logger[_0xb22f('0x20')](_0xb22f('0x21'),_0x2918be,JSON[_0xb22f('0x13')](_0x5b2a42));_0x3e471f(_0x5b2a42);})['catch'](function(_0x176133){logger[_0xb22f('0x14')]('UpdateFaxMessage',_0x176133[_0xb22f('0x16')],_0x2918be);_0x2c4a9e(_0x4dfb62[_0xb22f('0x14')](0x1f4,_0x176133[_0xb22f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index abdaf35..ba85782 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 _0x2099=['register','length','./faxMessage.events','save','remove','update','removeListener'];(function(_0x56e349,_0xb6bc4c){var _0x34894e=function(_0x34dbad){while(--_0x34dbad){_0x56e349['push'](_0x56e349['shift']());}};_0x34894e(++_0xb6bc4c);}(_0x2099,0x64));var _0x9209=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2099[_0x122ef9];return _0x42fba0;};'use strict';var FaxMessageEvents=require(_0x9209('0x0'));var events=[_0x9209('0x1'),_0x9209('0x2'),_0x9209('0x3')];function createListener(_0x2d8195,_0x5d0f54){return function(_0x186132){_0x5d0f54['emit'](_0x2d8195,_0x186132);};}function removeListener(_0x54d7f9,_0x370f77){return function(){FaxMessageEvents[_0x9209('0x4')](_0x54d7f9,_0x370f77);};}exports[_0x9209('0x5')]=function(_0x117403){for(var _0x8fd390=0x0,_0x1aa2d8=events[_0x9209('0x6')];_0x8fd390<_0x1aa2d8;_0x8fd390++){var _0x4cebb0=events[_0x8fd390];var _0x16ca33=createListener('faxMessage:'+_0x4cebb0,_0x117403);FaxMessageEvents['on'](_0x4cebb0,_0x16ca33);}}; \ No newline at end of file +var _0x4555=['emit','removeListener','register','./faxMessage.events','save','remove'];(function(_0xd8633d,_0x3d369e){var _0x1b3a37=function(_0x3b97b8){while(--_0x3b97b8){_0xd8633d['push'](_0xd8633d['shift']());}};_0x1b3a37(++_0x3d369e);}(_0x4555,0xf3));var _0x5455=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x4555[_0x5ddb1c];return _0x354adc;};'use strict';var FaxMessageEvents=require(_0x5455('0x0'));var events=[_0x5455('0x1'),_0x5455('0x2'),'update'];function createListener(_0x108ee3,_0x5bcec6){return function(_0x318853){_0x5bcec6[_0x5455('0x3')](_0x108ee3,_0x318853);};}function removeListener(_0x129eea,_0x184f5e){return function(){FaxMessageEvents[_0x5455('0x4')](_0x129eea,_0x184f5e);};}exports[_0x5455('0x5')]=function(_0x1d9bcc){for(var _0x4fc95f=0x0,_0x52689c=events['length'];_0x4fc95f<_0x52689c;_0x4fc95f++){var _0x5bbd3c=events[_0x4fc95f];var _0x547d4d=createListener('faxMessage:'+_0x5bbd3c,_0x1d9bcc);FaxMessageEvents['on'](_0x5bbd3c,_0x547d4d);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 6ff3b05..07f9bf7 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 _0xb7e7=['get','/describe','describe','/:id','isAuthenticated','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/reject','reject','delete','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./faxMessage.controller','index'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb7e7[_0x20a584];return _0x4b41a8;};'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('0x10')]('/',auth[_0x7b7e('0xc')](),interaction[_0x7b7e('0x11')](_0x7b7e('0x12'),_0x7b7e('0x13')),controller[_0x7b7e('0x14')]);router[_0x7b7e('0x15')](_0x7b7e('0xb'),auth['isAuthenticated'](),controller[_0x7b7e('0x16')]);router[_0x7b7e('0x15')]('/:id/accept',auth[_0x7b7e('0xc')](),controller['accept']);router['put'](_0x7b7e('0x17'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x18')]);router[_0x7b7e('0x19')](_0x7b7e('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7b7e('0x1a')]=router; \ No newline at end of file +var _0x9354=['describe','/:id','show','/:id/download','download','post','fax','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x23a574,_0x3fe647){var _0x3712c2=function(_0x29aca1){while(--_0x29aca1){_0x23a574['push'](_0x23a574['shift']());}};_0x3712c2(++_0x3fe647);}(_0x9354,0x96));var _0x4935=function(_0x595b9b,_0xa58ff){_0x595b9b=_0x595b9b-0x0;var _0x3be4c6=_0x9354[_0x595b9b];return _0x3be4c6;};'use strict';var multer=require('multer');var util=require(_0x4935('0x0'));var path=require(_0x4935('0x1'));var timeout=require('connect-timeout');var express=require(_0x4935('0x2'));var router=express[_0x4935('0x3')]();var fs_extra=require(_0x4935('0x4'));var auth=require(_0x4935('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4935('0x6'));var controller=require(_0x4935('0x7'));router[_0x4935('0x8')]('/',auth[_0x4935('0x9')](),controller[_0x4935('0xa')]);router[_0x4935('0x8')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xc')]);router['get'](_0x4935('0xd'),auth['isAuthenticated'](),controller[_0x4935('0xe')]);router[_0x4935('0x8')](_0x4935('0xf'),auth[_0x4935('0x9')](),controller[_0x4935('0x10')]);router[_0x4935('0x11')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x4935('0x12'),'faxmessage:create'),controller['create']);router[_0x4935('0x13')](_0x4935('0xd'),auth[_0x4935('0x9')](),controller[_0x4935('0x14')]);router[_0x4935('0x13')](_0x4935('0x15'),auth[_0x4935('0x9')](),controller[_0x4935('0x16')]);router[_0x4935('0x13')](_0x4935('0x17'),auth[_0x4935('0x9')](),controller[_0x4935('0x18')]);router[_0x4935('0x19')](_0x4935('0xd'),auth[_0x4935('0x9')](),controller[_0x4935('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 08e7219..2d7b669 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 _0x0942=['rrmemory','beepall','exports','STRING','name','INTEGER','ENUM'];(function(_0x2b1ed6,_0x287163){var _0x3be760=function(_0x219a39){while(--_0x219a39){_0x2b1ed6['push'](_0x2b1ed6['shift']());}};_0x3be760(++_0x287163);}(_0x0942,0x11a));var _0x2094=function(_0x4519ad,_0x54d205){_0x4519ad=_0x4519ad-0x0;var _0x5bbcaf=_0x0942[_0x4519ad];return _0x5bbcaf;};'use strict';var Sequelize=require('sequelize');module[_0x2094('0x0')]={'name':{'type':Sequelize[_0x2094('0x1')],'unique':_0x2094('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2094('0x1')]},'timeout':{'type':Sequelize[_0x2094('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2094('0x4')](_0x2094('0x5'),_0x2094('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x2094('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb90a=['name','roundrobin','INTEGER','sequelize','exports'];(function(_0x1121fc,_0x3ad11a){var _0x7963c3=function(_0x257bf0){while(--_0x257bf0){_0x1121fc['push'](_0x1121fc['shift']());}};_0x7963c3(++_0x3ad11a);}(_0xb90a,0x12a));var _0xab90=function(_0x47d476,_0x50afb2){_0x47d476=_0x47d476-0x0;var _0x57fab0=_0xb90a[_0x47d476];return _0x57fab0;};'use strict';var Sequelize=require(_0xab90('0x0'));module[_0xab90('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xab90('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall',_0xab90('0x3')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xab90('0x4')],'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 61fb308..fc651bf 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 _0xcd05=['getAgents','bluebird','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','socket.io-emitter','./faxQueue.socket','register','status','end','json','offset','undefined','limit','set','update','destroy','get','FaxQueues','UserProfileResource','then','sendStatus','error','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','where','count','include','query','rows','catch','show','model','keys','intersection','attributes','fields','length','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','order','sort','filters','pick','filter','merge','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','SIP','Team','getTeams','nolimit','addTeams','ids','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userFaxQueue:save','Agents','select','field','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','QueryTypes','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','emit'];(function(_0x825d19,_0x4fe030){var _0x2e7502=function(_0x2f23d6){while(--_0x2f23d6){_0x825d19['push'](_0x825d19['shift']());}};_0x2e7502(++_0x4fe030);}(_0xcd05,0x163));var _0x5cd0=function(_0x4c2dfc,_0x4814c0){_0x4c2dfc=_0x4c2dfc-0x0;var _0xfd728d=_0xcd05[_0x4c2dfc];return _0xfd728d;};'use strict';var BPromise=require(_0x5cd0('0x0'));var util=require('util');var _=require('lodash');var squel=require('squel');var Redis=require(_0x5cd0('0x1'));var qs=require(_0x5cd0('0x2'));var logger=require(_0x5cd0('0x3'))(_0x5cd0('0x4'));var config=require('../../config/environment');var db=require(_0x5cd0('0x5'))['db'];config[_0x5cd0('0x6')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5cd0('0x7'))(new Redis(config[_0x5cd0('0x6')]));require(_0x5cd0('0x8'))[_0x5cd0('0x9')](socket);function respondWithStatusCode(_0x3c0593,_0x1036fa){_0x1036fa=_0x1036fa||0xcc;return function(_0x715c5c){if(_0x715c5c){return _0x3c0593['sendStatus'](_0x1036fa);}return _0x3c0593[_0x5cd0('0xa')](_0x1036fa)[_0x5cd0('0xb')]();};}function respondWithResult(_0x22f769,_0x368f0c){_0x368f0c=_0x368f0c||0xc8;return function(_0x512903){if(_0x512903){return _0x22f769[_0x5cd0('0xa')](_0x368f0c)[_0x5cd0('0xc')](_0x512903);}};}function respondWithFilteredResult(_0x447b29,_0x6d7fbe){return function(_0x601ac0){if(_0x601ac0){var _0x137948=typeof _0x6d7fbe[_0x5cd0('0xd')]===_0x5cd0('0xe')&&typeof _0x6d7fbe[_0x5cd0('0xf')]===_0x5cd0('0xe');var _0x504fc5=_0x601ac0['count'];var _0x51ec30=_0x137948?0x0:_0x6d7fbe[_0x5cd0('0xd')];var _0x426a68=_0x137948?_0x601ac0['count']:_0x6d7fbe[_0x5cd0('0xd')]+_0x6d7fbe['limit'];var _0x2991d2;if(_0x426a68>=_0x504fc5){_0x426a68=_0x504fc5;_0x2991d2=0xc8;}else{_0x2991d2=0xce;}_0x447b29[_0x5cd0('0xa')](_0x2991d2);return _0x447b29[_0x5cd0('0x10')]('Content-Range',_0x51ec30+'-'+_0x426a68+'/'+_0x504fc5)['json'](_0x601ac0);}return null;};}function saveUpdates(_0x489f62){return function(_0x1f84ef){if(_0x1f84ef){return _0x1f84ef[_0x5cd0('0x11')](_0x489f62)['then'](function(_0x57d81d){return _0x57d81d;});}return null;};}function removeEntity(_0x4b7dac){return function(_0x1847dd){if(_0x1847dd){return _0x1847dd[_0x5cd0('0x12')]()['then'](function(){var _0xe72db4=_0x1847dd[_0x5cd0('0x13')]({'plain':!![]});var _0x2b906d=_0x5cd0('0x14');return db[_0x5cd0('0x15')][_0x5cd0('0x12')]({'where':{'type':_0x2b906d,'resourceId':_0xe72db4['id']}})[_0x5cd0('0x16')](function(){return _0x1847dd;});})[_0x5cd0('0x16')](function(){_0x4b7dac[_0x5cd0('0xa')](0xcc)[_0x5cd0('0xb')]();});}};}function handleEntityNotFound(_0x3dd520){return function(_0x3fe03a){if(!_0x3fe03a){_0x3dd520[_0x5cd0('0x17')](0x194);}return _0x3fe03a;};}function handleError(_0x1fe052,_0x5c2bd9){_0x5c2bd9=_0x5c2bd9||0x1f4;return function(_0x4d111f){logger[_0x5cd0('0x18')](_0x4d111f['stack']);if(_0x4d111f[_0x5cd0('0x19')]){delete _0x4d111f[_0x5cd0('0x19')];}_0x1fe052[_0x5cd0('0xa')](_0x5c2bd9)[_0x5cd0('0x1a')](_0x4d111f);};}exports[_0x5cd0('0x1b')]=function(_0x2b8516,_0x1a4d1c){var _0x5385db={};var _0x4a1fa4={'count':0x0,'rows':[]};var _0x2cd387=_[_0x5cd0('0x1c')](db[_0x5cd0('0x1d')][_0x5cd0('0x1e')],function(_0x5bff8a){return{'name':_0x5bff8a[_0x5cd0('0x1f')],'type':_0x5bff8a[_0x5cd0('0x20')][_0x5cd0('0x21')]};});_0x5385db=qs['getOptions'](_0x2cd387,_0x2b8516);var _0x56d59a={'where':_0x5385db[_0x5cd0('0x22')]};return db[_0x5cd0('0x1d')]['count'](_0x56d59a)[_0x5cd0('0x16')](function(_0x4020d1){_0x4a1fa4[_0x5cd0('0x23')]=_0x4020d1;_0x5385db[_0x5cd0('0x24')]=qs[_0x5cd0('0x24')](_0x2b8516[_0x5cd0('0x25')]);return db[_0x5cd0('0x1d')]['findAll'](_0x5385db);})[_0x5cd0('0x16')](function(_0x1621f9){_0x4a1fa4[_0x5cd0('0x26')]=_0x1621f9;return _0x4a1fa4;})[_0x5cd0('0x16')](respondWithFilteredResult(_0x1a4d1c,_0x5385db))[_0x5cd0('0x27')](handleError(_0x1a4d1c,null));};exports[_0x5cd0('0x28')]=function(_0x190901,_0x2ed6c5){var _0x2e16b1={'raw':!![],'where':{'id':_0x190901['params']['id']}},_0x19b50e={};_0x19b50e[_0x5cd0('0x29')]=_[_0x5cd0('0x2a')](db['FaxQueue'][_0x5cd0('0x1e')]);_0x19b50e['query']=_[_0x5cd0('0x2a')](_0x190901[_0x5cd0('0x25')]);_0x19b50e['filters']=_[_0x5cd0('0x2b')](_0x19b50e['model'],_0x19b50e[_0x5cd0('0x25')]);_0x2e16b1[_0x5cd0('0x2c')]=_[_0x5cd0('0x2b')](_0x19b50e['model'],qs[_0x5cd0('0x2d')](_0x190901['query'][_0x5cd0('0x2d')]));_0x2e16b1[_0x5cd0('0x2c')]=_0x2e16b1['attributes'][_0x5cd0('0x2e')]?_0x2e16b1[_0x5cd0('0x2c')]:_0x19b50e[_0x5cd0('0x29')];if(_0x190901[_0x5cd0('0x25')][_0x5cd0('0x2f')]){_0x2e16b1['include']=[{'all':!![]}];}_0x2e16b1=_['merge']({},_0x2e16b1,_0x190901[_0x5cd0('0x30')]);return db[_0x5cd0('0x1d')]['find'](_0x2e16b1)[_0x5cd0('0x16')](handleEntityNotFound(_0x2ed6c5,null))[_0x5cd0('0x16')](respondWithResult(_0x2ed6c5,null))[_0x5cd0('0x27')](handleError(_0x2ed6c5,null));};exports[_0x5cd0('0x31')]=function(_0xcc93d2,_0x5f4d6b){return db[_0x5cd0('0x1d')][_0x5cd0('0x31')](_0xcc93d2[_0x5cd0('0x32')],{})[_0x5cd0('0x16')](function(_0x2cfe2e){var _0x144101=_0xcc93d2[_0x5cd0('0x33')][_0x5cd0('0x13')]({'plain':!![]});if(!_0x144101)throw new Error(_0x5cd0('0x34'));if(_0x144101[_0x5cd0('0x35')]===_0x5cd0('0x33')){var _0xd84453=_0x2cfe2e[_0x5cd0('0x13')]({'plain':!![]});var _0x271ebf='FaxQueues';return db['UserProfileSection'][_0x5cd0('0x36')]({'where':{'name':_0x271ebf,'userProfileId':_0x144101['userProfileId']},'raw':!![]})[_0x5cd0('0x16')](function(_0x55d99a){if(_0x55d99a&&_0x55d99a[_0x5cd0('0x37')]===0x0){return db[_0x5cd0('0x15')][_0x5cd0('0x31')]({'name':_0xd84453[_0x5cd0('0x19')],'resourceId':_0xd84453['id'],'type':_0x55d99a[_0x5cd0('0x19')],'sectionId':_0x55d99a['id']},{})['then'](function(){return _0x2cfe2e;});}else{return _0x2cfe2e;}})[_0x5cd0('0x27')](function(_0x5c7468){logger['error'](_0x5cd0('0x38'),_0x5c7468);throw _0x5c7468;});}return _0x2cfe2e;})[_0x5cd0('0x16')](respondWithResult(_0x5f4d6b,0xc9))[_0x5cd0('0x27')](handleError(_0x5f4d6b,null));};exports['update']=function(_0x31ca10,_0x5920c3){if(_0x31ca10[_0x5cd0('0x32')]['id']){delete _0x31ca10['body']['id'];}return db['FaxQueue'][_0x5cd0('0x36')]({'where':{'id':_0x31ca10[_0x5cd0('0x39')]['id']}})[_0x5cd0('0x16')](handleEntityNotFound(_0x5920c3,null))[_0x5cd0('0x16')](saveUpdates(_0x31ca10[_0x5cd0('0x32')],null))['then'](respondWithResult(_0x5920c3,null))[_0x5cd0('0x27')](handleError(_0x5920c3,null));};exports[_0x5cd0('0x12')]=function(_0x39b07c,_0x3eba22){return db['FaxQueue'][_0x5cd0('0x36')]({'where':{'id':_0x39b07c[_0x5cd0('0x39')]['id']}})[_0x5cd0('0x16')](handleEntityNotFound(_0x3eba22,null))[_0x5cd0('0x16')](removeEntity(_0x3eba22,null))[_0x5cd0('0x27')](handleError(_0x3eba22,null));};exports['describe']=function(_0x3a77c2,_0x12a678){return db[_0x5cd0('0x1d')][_0x5cd0('0x3a')]()[_0x5cd0('0x16')](respondWithResult(_0x12a678,null))['catch'](handleError(_0x12a678,null));};exports[_0x5cd0('0x3b')]=function(_0x199972,_0x585244){var _0x53b77a={'raw':!![],'where':{}},_0x7894b5={},_0x455792;return db[_0x5cd0('0x1d')][_0x5cd0('0x3c')]({'where':{'id':_0x199972[_0x5cd0('0x39')]['id']}})['then'](handleEntityNotFound(_0x585244,null))['then'](function(_0x46a90d){if(_0x46a90d){_0x455792=_0x46a90d[_0x5cd0('0x13')]({'plain':!![]});_0x7894b5[_0x5cd0('0x29')]=_['keys'](db[_0x5cd0('0x3d')]['rawAttributes']);_0x7894b5[_0x5cd0('0x25')]=_[_0x5cd0('0x2a')](_0x199972[_0x5cd0('0x25')]);_0x7894b5['filters']=_[_0x5cd0('0x2b')](_0x7894b5['model'],_0x7894b5[_0x5cd0('0x25')]);_0x53b77a[_0x5cd0('0x2c')]=_[_0x5cd0('0x2b')](_0x7894b5[_0x5cd0('0x29')],qs['fields'](_0x199972[_0x5cd0('0x25')]['fields']));_0x53b77a[_0x5cd0('0x2c')]=_0x53b77a[_0x5cd0('0x2c')][_0x5cd0('0x2e')]?_0x53b77a[_0x5cd0('0x2c')]:_0x7894b5['model'];if(!_0x199972[_0x5cd0('0x25')][_0x5cd0('0x3e')]('nolimit')){_0x53b77a['limit']=qs[_0x5cd0('0xf')](_0x199972[_0x5cd0('0x25')][_0x5cd0('0xf')]);_0x53b77a[_0x5cd0('0xd')]=qs['offset'](_0x199972[_0x5cd0('0x25')][_0x5cd0('0xd')]);}_0x53b77a[_0x5cd0('0x3f')]=qs[_0x5cd0('0x40')](_0x199972[_0x5cd0('0x25')][_0x5cd0('0x40')]);_0x53b77a[_0x5cd0('0x22')]=qs[_0x5cd0('0x41')](_[_0x5cd0('0x42')](_0x199972[_0x5cd0('0x25')],_0x7894b5['filters']));_0x53b77a[_0x5cd0('0x22')]['FaxQueueId']=_0x46a90d['id'];if(_0x199972[_0x5cd0('0x25')][_0x5cd0('0x43')]){_0x53b77a[_0x5cd0('0x22')]=_[_0x5cd0('0x44')](_0x53b77a[_0x5cd0('0x22')],{'$or':_['map'](_0x53b77a[_0x5cd0('0x2c')],function(_0x38fd14){var _0x4d4746={};_0x4d4746[_0x38fd14]={'$like':'%'+_0x199972[_0x5cd0('0x25')]['filter']+'%'};return _0x4d4746;})});}_0x53b77a=_[_0x5cd0('0x44')]({},_0x53b77a,_0x199972['options']);return db[_0x5cd0('0x3d')]['findAll'](_0x53b77a);}})[_0x5cd0('0x16')](function(_0xeb7597){if(_0xeb7597){return db[_0x5cd0('0x45')][_0x5cd0('0x46')]({'where':{'id':_['map'](_0xeb7597,_0x5cd0('0x47')),'role':_0x5cd0('0x48')},'attributes':['id',_0x5cd0('0x19'),_0x5cd0('0x49'),_0x5cd0('0x4a'),_0x5cd0('0x4b')]});}})[_0x5cd0('0x16')](function(_0x5c1e90){if(_0x5c1e90){return{'count':_0x5c1e90[_0x5cd0('0x23')],'rows':_[_0x5cd0('0x1c')](_0x5c1e90[_0x5cd0('0x26')],function(_0x211614){return{'membername':_0x211614[_0x5cd0('0x19')],'UserId':_0x211614['id'],'queue_name':_0x455792[_0x5cd0('0x19')],'FaxQueueId':_0x455792['id'],'interface':util[_0x5cd0('0x4c')]('%s/%s',_0x5cd0('0x4d'),_0x211614[_0x5cd0('0x19')]),'penalty':0x0,'paused':_0x211614[_0x5cd0('0x49')],'createdAt':_0x211614[_0x5cd0('0x4b')],'updatedAt':_0x211614[_0x5cd0('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5cd0('0x16')](respondWithFilteredResult(_0x585244,_0x53b77a))['catch'](handleError(_0x585244,null));};exports['getTeams']=function(_0x41ad33,_0x5d76da){var _0x422284={};var _0x56cdee={};var _0x460a9b;var _0x13f0cd;return db['FaxQueue'][_0x5cd0('0x3c')]({'where':{'id':_0x41ad33[_0x5cd0('0x39')]['id']}})[_0x5cd0('0x16')](handleEntityNotFound(_0x5d76da,null))['then'](function(_0x32ec47){if(_0x32ec47){_0x460a9b=_0x32ec47;_0x56cdee[_0x5cd0('0x29')]=_['keys'](db[_0x5cd0('0x4e')][_0x5cd0('0x1e')]);_0x56cdee[_0x5cd0('0x25')]=_[_0x5cd0('0x2a')](_0x41ad33[_0x5cd0('0x25')]);_0x56cdee[_0x5cd0('0x41')]=_[_0x5cd0('0x2b')](_0x56cdee[_0x5cd0('0x29')],_0x56cdee['query']);_0x422284[_0x5cd0('0x2c')]=_[_0x5cd0('0x2b')](_0x56cdee['model'],qs['fields'](_0x41ad33[_0x5cd0('0x25')][_0x5cd0('0x2d')]));_0x422284['attributes']=_0x422284[_0x5cd0('0x2c')][_0x5cd0('0x2e')]?_0x422284[_0x5cd0('0x2c')]:_0x56cdee[_0x5cd0('0x29')];_0x422284[_0x5cd0('0x3f')]=qs[_0x5cd0('0x40')](_0x41ad33[_0x5cd0('0x25')]['sort']);_0x422284[_0x5cd0('0x22')]=qs[_0x5cd0('0x41')](_[_0x5cd0('0x42')](_0x41ad33['query'],_0x56cdee[_0x5cd0('0x41')]));if(_0x41ad33[_0x5cd0('0x25')][_0x5cd0('0x43')]){_0x422284[_0x5cd0('0x22')]=_[_0x5cd0('0x44')](_0x422284[_0x5cd0('0x22')],{'$or':_[_0x5cd0('0x1c')](_0x422284[_0x5cd0('0x2c')],function(_0x69880a){var _0x471f51={};_0x471f51[_0x69880a]={'$like':'%'+_0x41ad33[_0x5cd0('0x25')][_0x5cd0('0x43')]+'%'};return _0x471f51;})});}_0x422284=_[_0x5cd0('0x44')]({},_0x422284,_0x41ad33[_0x5cd0('0x30')]);return _0x460a9b[_0x5cd0('0x4f')](_0x422284);}})[_0x5cd0('0x16')](function(_0x16cda6){if(_0x16cda6){_0x13f0cd=_0x16cda6[_0x5cd0('0x2e')];if(!_0x41ad33[_0x5cd0('0x25')]['hasOwnProperty'](_0x5cd0('0x50'))){_0x422284['limit']=qs[_0x5cd0('0xf')](_0x41ad33[_0x5cd0('0x25')][_0x5cd0('0xf')]);_0x422284[_0x5cd0('0xd')]=qs['offset'](_0x41ad33['query']['offset']);}return _0x460a9b[_0x5cd0('0x4f')](_0x422284);}})[_0x5cd0('0x16')](function(_0x5bd974){if(_0x5bd974){return _0x5bd974?{'count':_0x13f0cd,'rows':_0x5bd974}:null;}})['then'](respondWithResult(_0x5d76da,null))[_0x5cd0('0x27')](handleError(_0x5d76da,null));};exports[_0x5cd0('0x51')]=function(_0x192d3f,_0x2a9c40){var _0x53ffa6=_0x192d3f[_0x5cd0('0x32')][_0x5cd0('0x52')];return db[_0x5cd0('0x4e')]['findAll']({'where':{'id':_0x53ffa6},'attributes':['id'],'include':[{'model':db[_0x5cd0('0x45')],'as':'Agents','attributes':['id','name',_0x5cd0('0x53'),_0x5cd0('0x54'),_0x5cd0('0x55')],'raw':!![]}]})['then'](function(_0x29644b){if(_0x29644b){var _0xa94b48=_[_0x5cd0('0x56')](_0x29644b,function(_0x156b8e){var _0x271b6c=_0x156b8e[_0x5cd0('0x13')]({'plain':!![]});return _0x271b6c['Agents'];});return db[_0x5cd0('0x1d')][_0x5cd0('0x36')]({'where':{'id':_0x192d3f[_0x5cd0('0x39')]['id']}})[_0x5cd0('0x16')](function(_0x43f971){return db[_0x5cd0('0x57')][_0x5cd0('0x58')](function(_0x47e6fb){return _0x43f971[_0x5cd0('0x51')](_0x53ffa6,{'transaction':_0x47e6fb})['then'](function(){return BPromise[_0x5cd0('0x59')](_0xa94b48,function(_0x3f9944){return db[_0x5cd0('0x3d')][_0x5cd0('0x5a')]({'where':{'UserId':_0x3f9944['id'],'FaxQueueId':_0x192d3f[_0x5cd0('0x39')]['id']},'transaction':_0x47e6fb});});})[_0x5cd0('0x16')](function(){_0xa94b48[_0x5cd0('0x5b')](function(_0x2a9b69){socket['emit'](_0x5cd0('0x5c'),{'UserId':_0x2a9b69['id'],'FaxQueueId':_0x43f971['id']});});});});});}})[_0x5cd0('0x16')](respondWithStatusCode(_0x2a9c40,null))['catch'](handleError(_0x2a9c40,null));};exports['removeTeams']=function(_0x56a67e,_0x16550d){return db[_0x5cd0('0x4e')]['findAll']({'where':{'id':_0x56a67e['query'][_0x5cd0('0x52')]},'attributes':['id'],'include':[{'model':db[_0x5cd0('0x45')],'as':_0x5cd0('0x5d'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x16550d,null))[_0x5cd0('0x16')](function(_0x5a0b84){var _0x3ba892=_['map'](_0x5a0b84,'id');var _0x4416c9=[];var _0x1f1ee5=[];var _0x1955b2=squel[_0x5cd0('0x5e')]();_0x1955b2[_0x5cd0('0x5f')]('tq.TeamId')[_0x5cd0('0x60')](_0x5cd0('0x61'),'tq')[_0x5cd0('0x62')]('user_has_teams','ut',_0x5cd0('0x63'))[_0x5cd0('0x22')](_0x5cd0('0x64'),_0x56a67e[_0x5cd0('0x39')]['id']);for(var _0x458c52=0x0;_0x458c52<_0x5a0b84['length'];_0x458c52+=0x1){let _0x4b1b41=_0x5a0b84[_0x458c52];for(var _0x4b516e=0x0;_0x4b516e<_0x4b1b41[_0x5cd0('0x5d')][_0x5cd0('0x2e')];_0x4b516e+=0x1){let _0x4d8701=_0x4b1b41['Agents'][_0x4b516e];var _0x3c798d=_0x1955b2[_0x5cd0('0x65')]();_0x3c798d['where']('ut.UserId\x20=\x20?',_0x4d8701['id']);_0x1f1ee5[_0x5cd0('0x66')](db[_0x5cd0('0x57')]['query'](_0x3c798d['toString'](),{'type':db[_0x5cd0('0x57')][_0x5cd0('0x67')]['SELECT']})[_0x5cd0('0x16')](function(_0x322551){if(_0x322551[_0x5cd0('0x2e')]===0x1){return _0x4d8701['id'];}else{var _0x4b6be8=_['every'](_[_0x5cd0('0x1c')](_0x322551,'TeamId'),function(_0x26d740){return _[_0x5cd0('0x68')](_0x3ba892,_0x26d740);});if(_0x4b6be8){return _0x4d8701['id'];}}}));}}return BPromise[_0x5cd0('0x69')](_0x1f1ee5)[_0x5cd0('0x16')](function(_0x12973b){_0x4416c9=_(_0x4416c9)[_0x5cd0('0x6a')](_0x12973b)[_0x5cd0('0x6b')]()[_0x5cd0('0x6c')]();return db['FaxQueue'][_0x5cd0('0x36')]({'where':{'id':_0x56a67e[_0x5cd0('0x39')]['id']}})[_0x5cd0('0x16')](function(_0x5c8674){return db[_0x5cd0('0x57')][_0x5cd0('0x58')](function(_0x1c10c6){return _0x5c8674[_0x5cd0('0x6d')](_0x56a67e[_0x5cd0('0x25')]['ids'],{'transaction':_0x1c10c6})[_0x5cd0('0x16')](function(){if(!_[_0x5cd0('0x6e')](_0x4416c9)){return _0x5c8674[_0x5cd0('0x6f')](_0x4416c9,{'transaction':_0x1c10c6});}})['then'](function(){_0x4416c9[_0x5cd0('0x5b')](function(_0x3b899c){socket['emit'](_0x5cd0('0x70'),{'UserId':_0x3b899c,'FaxQueueId':_0x5c8674['id']});});});});});});})['then'](respondWithStatusCode(_0x16550d,null))['catch'](handleError(_0x16550d,null));};exports[_0x5cd0('0x71')]=function(_0x3419b4,_0x10b506){return db['FaxQueue'][_0x5cd0('0x36')]({'where':{'id':_0x3419b4[_0x5cd0('0x39')]['id']}})['then'](handleEntityNotFound(_0x10b506,null))[_0x5cd0('0x16')](function(_0x174d68){if(_0x174d68){return _0x174d68[_0x5cd0('0x71')](_0x3419b4[_0x5cd0('0x32')]['ids'],_[_0x5cd0('0x72')](_0x3419b4[_0x5cd0('0x32')],[_0x5cd0('0x52'),'id'])||{})[_0x5cd0('0x73')](function(_0x4dc62d){for(var _0x45ddb6=0x0;_0x45ddb6<_0x3419b4[_0x5cd0('0x32')]['ids'][_0x5cd0('0x2e')];_0x45ddb6+=0x1){socket[_0x5cd0('0x74')](_0x5cd0('0x5c'),{'UserId':Number(_0x3419b4[_0x5cd0('0x32')]['ids'][_0x45ddb6]),'FaxQueueId':Number(_0x3419b4[_0x5cd0('0x39')]['id'])});}return _0x4dc62d;});}})[_0x5cd0('0x16')](respondWithResult(_0x10b506,null))[_0x5cd0('0x27')](handleError(_0x10b506,null));};exports[_0x5cd0('0x6f')]=function(_0x3126bb,_0x36ca4d){return db['FaxQueue'][_0x5cd0('0x36')]({'where':{'id':_0x3126bb['params']['id']}})['then'](handleEntityNotFound(_0x36ca4d,null))[_0x5cd0('0x16')](function(_0x5a5353){if(_0x5a5353){return _0x5a5353[_0x5cd0('0x6f')](_0x3126bb[_0x5cd0('0x25')][_0x5cd0('0x52')])[_0x5cd0('0x16')](function(){if(_['isArray'](_0x3126bb[_0x5cd0('0x25')][_0x5cd0('0x52')])){for(var _0x38dc20=0x0;_0x38dc20<_0x3126bb[_0x5cd0('0x25')][_0x5cd0('0x52')][_0x5cd0('0x2e')];_0x38dc20+=0x1){socket[_0x5cd0('0x74')](_0x5cd0('0x70'),{'UserId':Number(_0x3126bb['query'][_0x5cd0('0x52')][_0x38dc20]),'FaxQueueId':Number(_0x3126bb['params']['id'])});}}else{socket[_0x5cd0('0x74')]('userFaxQueue:remove',{'UserId':Number(_0x3126bb[_0x5cd0('0x25')][_0x5cd0('0x52')]),'FaxQueueId':Number(_0x3126bb[_0x5cd0('0x39')]['id'])});}});}})[_0x5cd0('0x16')](respondWithStatusCode(_0x36ca4d,null))['catch'](handleError(_0x36ca4d,null));};exports['getAgents']=function(_0x590650,_0xaabd19){var _0x1bf94c={};var _0x252dfa={};var _0x1fe1ae;var _0x2e76dc;return db[_0x5cd0('0x1d')][_0x5cd0('0x3c')]({'where':{'id':_0x590650[_0x5cd0('0x39')]['id']}})['then'](handleEntityNotFound(_0xaabd19,null))[_0x5cd0('0x16')](function(_0x5dbaf1){if(_0x5dbaf1){_0x1fe1ae=_0x5dbaf1;_0x252dfa[_0x5cd0('0x29')]=_['keys'](db[_0x5cd0('0x45')][_0x5cd0('0x1e')]);_0x252dfa[_0x5cd0('0x25')]=_[_0x5cd0('0x2a')](_0x590650[_0x5cd0('0x25')]);_0x252dfa[_0x5cd0('0x41')]=_[_0x5cd0('0x2b')](_0x252dfa[_0x5cd0('0x29')],_0x252dfa[_0x5cd0('0x25')]);_0x1bf94c['attributes']=_[_0x5cd0('0x2b')](_0x252dfa[_0x5cd0('0x29')],qs[_0x5cd0('0x2d')](_0x590650[_0x5cd0('0x25')][_0x5cd0('0x2d')]));_0x1bf94c[_0x5cd0('0x2c')]=_0x1bf94c[_0x5cd0('0x2c')]['length']?_0x1bf94c[_0x5cd0('0x2c')]:_0x252dfa[_0x5cd0('0x29')];_0x1bf94c[_0x5cd0('0x3f')]=qs[_0x5cd0('0x40')](_0x590650[_0x5cd0('0x25')]['sort']);_0x1bf94c['where']=qs[_0x5cd0('0x41')](_['pick'](_0x590650[_0x5cd0('0x25')],_0x252dfa['filters']));if(_0x590650[_0x5cd0('0x25')][_0x5cd0('0x43')]){_0x1bf94c[_0x5cd0('0x22')]=_[_0x5cd0('0x44')](_0x1bf94c[_0x5cd0('0x22')],{'$or':_['map'](_0x1bf94c[_0x5cd0('0x2c')],function(_0x1e2877){var _0x4b7ea8={};_0x4b7ea8[_0x1e2877]={'$like':'%'+_0x590650[_0x5cd0('0x25')]['filter']+'%'};return _0x4b7ea8;})});}_0x1bf94c=_[_0x5cd0('0x44')]({},_0x1bf94c,_0x590650['options']);return _0x1fe1ae[_0x5cd0('0x75')](_0x1bf94c);}})['then'](function(_0x5bddac){if(_0x5bddac){_0x2e76dc=_0x5bddac[_0x5cd0('0x2e')];if(!_0x590650[_0x5cd0('0x25')][_0x5cd0('0x3e')](_0x5cd0('0x50'))){_0x1bf94c[_0x5cd0('0xf')]=qs[_0x5cd0('0xf')](_0x590650[_0x5cd0('0x25')][_0x5cd0('0xf')]);_0x1bf94c[_0x5cd0('0xd')]=qs['offset'](_0x590650[_0x5cd0('0x25')]['offset']);}return _0x1fe1ae[_0x5cd0('0x75')](_0x1bf94c);}})[_0x5cd0('0x16')](function(_0x48d914){if(_0x48d914){return _0x48d914?{'count':_0x2e76dc,'rows':_0x48d914}:null;}})[_0x5cd0('0x16')](respondWithResult(_0xaabd19,null))[_0x5cd0('0x27')](handleError(_0xaabd19,null));}; \ No newline at end of file +var _0x4fb4=['SIP','Team','fields','sort','pick','getTeams','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','emit','userFaxQueue:save','removeTeams','select','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','includes','all','union','compact','userFaxQueue:remove','addAgents','omit','spread','removeAgents','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','error','name','map','FaxQueue','fieldName','type','key','getOptions','where','include','findAll','rows','catch','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','length','includeAll','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','FaxQueues','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','nolimit','order','FaxQueueId','filter','options','faxPause','updatedAt','createdAt','%s/%s'];(function(_0x2300d9,_0x479d4a){var _0x2da173=function(_0x26ae3f){while(--_0x26ae3f){_0x2300d9['push'](_0x2300d9['shift']());}};_0x2da173(++_0x479d4a);}(_0x4fb4,0x190));var _0x44fb=function(_0x1a6bc8,_0x2880a6){_0x1a6bc8=_0x1a6bc8-0x0;var _0x1d1346=_0x4fb4[_0x1a6bc8];return _0x1d1346;};'use strict';var BPromise=require('bluebird');var util=require(_0x44fb('0x0'));var _=require(_0x44fb('0x1'));var squel=require(_0x44fb('0x2'));var Redis=require(_0x44fb('0x3'));var qs=require(_0x44fb('0x4'));var logger=require(_0x44fb('0x5'))('api');var config=require(_0x44fb('0x6'));var db=require(_0x44fb('0x7'))['db'];config[_0x44fb('0x8')]=_[_0x44fb('0x9')](config[_0x44fb('0x8')],{'host':_0x44fb('0xa'),'port':0x18eb});var socket=require(_0x44fb('0xb'))(new Redis(config[_0x44fb('0x8')]));require('./faxQueue.socket')[_0x44fb('0xc')](socket);function respondWithStatusCode(_0xd4ead0,_0x5405a8){_0x5405a8=_0x5405a8||0xcc;return function(_0x42fcc2){if(_0x42fcc2){return _0xd4ead0[_0x44fb('0xd')](_0x5405a8);}return _0xd4ead0[_0x44fb('0xe')](_0x5405a8)[_0x44fb('0xf')]();};}function respondWithResult(_0x211fa3,_0x44c83b){_0x44c83b=_0x44c83b||0xc8;return function(_0x184039){if(_0x184039){return _0x211fa3[_0x44fb('0xe')](_0x44c83b)[_0x44fb('0x10')](_0x184039);}};}function respondWithFilteredResult(_0x2ae684,_0x4b202d){return function(_0x2f2cfe){if(_0x2f2cfe){var _0x1e8a60=typeof _0x4b202d[_0x44fb('0x11')]===_0x44fb('0x12')&&typeof _0x4b202d[_0x44fb('0x13')]==='undefined';var _0x1fc8fa=_0x2f2cfe[_0x44fb('0x14')];var _0x39fb83=_0x1e8a60?0x0:_0x4b202d[_0x44fb('0x11')];var _0x9a367d=_0x1e8a60?_0x2f2cfe['count']:_0x4b202d[_0x44fb('0x11')]+_0x4b202d[_0x44fb('0x13')];var _0x472658;if(_0x9a367d>=_0x1fc8fa){_0x9a367d=_0x1fc8fa;_0x472658=0xc8;}else{_0x472658=0xce;}_0x2ae684[_0x44fb('0xe')](_0x472658);return _0x2ae684[_0x44fb('0x15')](_0x44fb('0x16'),_0x39fb83+'-'+_0x9a367d+'/'+_0x1fc8fa)[_0x44fb('0x10')](_0x2f2cfe);}return null;};}function saveUpdates(_0x585559){return function(_0x2c622f){if(_0x2c622f){return _0x2c622f[_0x44fb('0x17')](_0x585559)[_0x44fb('0x18')](function(_0x13cf75){return _0x13cf75;});}return null;};}function removeEntity(_0x65f887){return function(_0x22c2eb){if(_0x22c2eb){return _0x22c2eb[_0x44fb('0x19')]()[_0x44fb('0x18')](function(){var _0x44e6de=_0x22c2eb[_0x44fb('0x1a')]({'plain':!![]});var _0x5eafcb='FaxQueues';return db['UserProfileResource'][_0x44fb('0x19')]({'where':{'type':_0x5eafcb,'resourceId':_0x44e6de['id']}})[_0x44fb('0x18')](function(){return _0x22c2eb;});})[_0x44fb('0x18')](function(){_0x65f887['status'](0xcc)[_0x44fb('0xf')]();});}};}function handleEntityNotFound(_0x11449d){return function(_0x3394e2){if(!_0x3394e2){_0x11449d['sendStatus'](0x194);}return _0x3394e2;};}function handleError(_0x558283,_0x38e834){_0x38e834=_0x38e834||0x1f4;return function(_0x5cf7ec){logger[_0x44fb('0x1b')](_0x5cf7ec['stack']);if(_0x5cf7ec[_0x44fb('0x1c')]){delete _0x5cf7ec[_0x44fb('0x1c')];}_0x558283[_0x44fb('0xe')](_0x38e834)['send'](_0x5cf7ec);};}exports['index']=function(_0x105b88,_0xa50a49){var _0x1c831e={};var _0x733c={'count':0x0,'rows':[]};var _0x5e7116=_[_0x44fb('0x1d')](db[_0x44fb('0x1e')]['rawAttributes'],function(_0x5b6ce5){return{'name':_0x5b6ce5[_0x44fb('0x1f')],'type':_0x5b6ce5[_0x44fb('0x20')][_0x44fb('0x21')]};});_0x1c831e=qs[_0x44fb('0x22')](_0x5e7116,_0x105b88);var _0xb7e5e8={'where':_0x1c831e[_0x44fb('0x23')]};return db[_0x44fb('0x1e')][_0x44fb('0x14')](_0xb7e5e8)[_0x44fb('0x18')](function(_0x4f079d){_0x733c['count']=_0x4f079d;_0x1c831e['include']=qs[_0x44fb('0x24')](_0x105b88['query']);return db[_0x44fb('0x1e')][_0x44fb('0x25')](_0x1c831e);})['then'](function(_0x212b10){_0x733c[_0x44fb('0x26')]=_0x212b10;return _0x733c;})[_0x44fb('0x18')](respondWithFilteredResult(_0xa50a49,_0x1c831e))[_0x44fb('0x27')](handleError(_0xa50a49,null));};exports[_0x44fb('0x28')]=function(_0x4c0d7e,_0x50ce63){var _0x12cea2={'raw':!![],'where':{'id':_0x4c0d7e[_0x44fb('0x29')]['id']}},_0x5bf5dc={};_0x5bf5dc[_0x44fb('0x2a')]=_[_0x44fb('0x2b')](db[_0x44fb('0x1e')][_0x44fb('0x2c')]);_0x5bf5dc[_0x44fb('0x2d')]=_[_0x44fb('0x2b')](_0x4c0d7e[_0x44fb('0x2d')]);_0x5bf5dc[_0x44fb('0x2e')]=_[_0x44fb('0x2f')](_0x5bf5dc[_0x44fb('0x2a')],_0x5bf5dc[_0x44fb('0x2d')]);_0x12cea2[_0x44fb('0x30')]=_[_0x44fb('0x2f')](_0x5bf5dc[_0x44fb('0x2a')],qs['fields'](_0x4c0d7e['query']['fields']));_0x12cea2[_0x44fb('0x30')]=_0x12cea2[_0x44fb('0x30')][_0x44fb('0x31')]?_0x12cea2[_0x44fb('0x30')]:_0x5bf5dc['model'];if(_0x4c0d7e[_0x44fb('0x2d')][_0x44fb('0x32')]){_0x12cea2['include']=[{'all':!![]}];}_0x12cea2=_[_0x44fb('0x33')]({},_0x12cea2,_0x4c0d7e['options']);return db[_0x44fb('0x1e')]['find'](_0x12cea2)[_0x44fb('0x18')](handleEntityNotFound(_0x50ce63,null))['then'](respondWithResult(_0x50ce63,null))[_0x44fb('0x27')](handleError(_0x50ce63,null));};exports['create']=function(_0x5aa5f4,_0x476598){return db[_0x44fb('0x1e')][_0x44fb('0x34')](_0x5aa5f4[_0x44fb('0x35')],{})[_0x44fb('0x18')](function(_0x10187c){var _0x29e6c4=_0x5aa5f4[_0x44fb('0x36')][_0x44fb('0x1a')]({'plain':!![]});if(!_0x29e6c4)throw new Error(_0x44fb('0x37'));if(_0x29e6c4['role']===_0x44fb('0x36')){var _0x313166=_0x10187c[_0x44fb('0x1a')]({'plain':!![]});var _0x3e2f95=_0x44fb('0x38');return db['UserProfileSection'][_0x44fb('0x39')]({'where':{'name':_0x3e2f95,'userProfileId':_0x29e6c4[_0x44fb('0x3a')]},'raw':!![]})['then'](function(_0x52d454){if(_0x52d454&&_0x52d454[_0x44fb('0x3b')]===0x0){return db[_0x44fb('0x3c')][_0x44fb('0x34')]({'name':_0x313166['name'],'resourceId':_0x313166['id'],'type':_0x52d454[_0x44fb('0x1c')],'sectionId':_0x52d454['id']},{})[_0x44fb('0x18')](function(){return _0x10187c;});}else{return _0x10187c;}})[_0x44fb('0x27')](function(_0x2bfb76){logger[_0x44fb('0x1b')](_0x44fb('0x3d'),_0x2bfb76);throw _0x2bfb76;});}return _0x10187c;})['then'](respondWithResult(_0x476598,0xc9))[_0x44fb('0x27')](handleError(_0x476598,null));};exports['update']=function(_0x40c590,_0x10243b){if(_0x40c590[_0x44fb('0x35')]['id']){delete _0x40c590[_0x44fb('0x35')]['id'];}return db['FaxQueue'][_0x44fb('0x39')]({'where':{'id':_0x40c590[_0x44fb('0x29')]['id']}})[_0x44fb('0x18')](handleEntityNotFound(_0x10243b,null))[_0x44fb('0x18')](saveUpdates(_0x40c590[_0x44fb('0x35')],null))['then'](respondWithResult(_0x10243b,null))[_0x44fb('0x27')](handleError(_0x10243b,null));};exports[_0x44fb('0x19')]=function(_0x10cd8d,_0x16147a){return db['FaxQueue']['find']({'where':{'id':_0x10cd8d[_0x44fb('0x29')]['id']}})[_0x44fb('0x18')](handleEntityNotFound(_0x16147a,null))['then'](removeEntity(_0x16147a,null))[_0x44fb('0x27')](handleError(_0x16147a,null));};exports['describe']=function(_0x4a9267,_0x5519d9){return db['FaxQueue'][_0x44fb('0x3e')]()[_0x44fb('0x18')](respondWithResult(_0x5519d9,null))[_0x44fb('0x27')](handleError(_0x5519d9,null));};exports[_0x44fb('0x3f')]=function(_0x48fc96,_0xf27802){var _0x2bf1e0={'raw':!![],'where':{}},_0x2fcada={},_0x4518da;return db[_0x44fb('0x1e')][_0x44fb('0x40')]({'where':{'id':_0x48fc96[_0x44fb('0x29')]['id']}})[_0x44fb('0x18')](handleEntityNotFound(_0xf27802,null))['then'](function(_0x255989){if(_0x255989){_0x4518da=_0x255989['get']({'plain':!![]});_0x2fcada['model']=_[_0x44fb('0x2b')](db[_0x44fb('0x41')][_0x44fb('0x2c')]);_0x2fcada['query']=_[_0x44fb('0x2b')](_0x48fc96[_0x44fb('0x2d')]);_0x2fcada[_0x44fb('0x2e')]=_[_0x44fb('0x2f')](_0x2fcada[_0x44fb('0x2a')],_0x2fcada[_0x44fb('0x2d')]);_0x2bf1e0[_0x44fb('0x30')]=_['intersection'](_0x2fcada[_0x44fb('0x2a')],qs['fields'](_0x48fc96[_0x44fb('0x2d')]['fields']));_0x2bf1e0[_0x44fb('0x30')]=_0x2bf1e0[_0x44fb('0x30')][_0x44fb('0x31')]?_0x2bf1e0[_0x44fb('0x30')]:_0x2fcada['model'];if(!_0x48fc96[_0x44fb('0x2d')][_0x44fb('0x42')](_0x44fb('0x43'))){_0x2bf1e0[_0x44fb('0x13')]=qs[_0x44fb('0x13')](_0x48fc96[_0x44fb('0x2d')][_0x44fb('0x13')]);_0x2bf1e0[_0x44fb('0x11')]=qs[_0x44fb('0x11')](_0x48fc96[_0x44fb('0x2d')][_0x44fb('0x11')]);}_0x2bf1e0[_0x44fb('0x44')]=qs['sort'](_0x48fc96[_0x44fb('0x2d')]['sort']);_0x2bf1e0[_0x44fb('0x23')]=qs[_0x44fb('0x2e')](_['pick'](_0x48fc96['query'],_0x2fcada['filters']));_0x2bf1e0[_0x44fb('0x23')][_0x44fb('0x45')]=_0x255989['id'];if(_0x48fc96[_0x44fb('0x2d')][_0x44fb('0x46')]){_0x2bf1e0[_0x44fb('0x23')]=_[_0x44fb('0x33')](_0x2bf1e0[_0x44fb('0x23')],{'$or':_[_0x44fb('0x1d')](_0x2bf1e0[_0x44fb('0x30')],function(_0x198f65){var _0x291f61={};_0x291f61[_0x198f65]={'$like':'%'+_0x48fc96[_0x44fb('0x2d')][_0x44fb('0x46')]+'%'};return _0x291f61;})});}_0x2bf1e0=_[_0x44fb('0x33')]({},_0x2bf1e0,_0x48fc96[_0x44fb('0x47')]);return db[_0x44fb('0x41')][_0x44fb('0x25')](_0x2bf1e0);}})[_0x44fb('0x18')](function(_0x351cbc){if(_0x351cbc){return db['User']['findAndCountAll']({'where':{'id':_[_0x44fb('0x1d')](_0x351cbc,'UserId'),'role':'agent'},'attributes':['id','name',_0x44fb('0x48'),_0x44fb('0x49'),_0x44fb('0x4a')]});}})['then'](function(_0x986ca){if(_0x986ca){return{'count':_0x986ca['count'],'rows':_[_0x44fb('0x1d')](_0x986ca['rows'],function(_0x28babb){return{'membername':_0x28babb[_0x44fb('0x1c')],'UserId':_0x28babb['id'],'queue_name':_0x4518da[_0x44fb('0x1c')],'FaxQueueId':_0x4518da['id'],'interface':util['format'](_0x44fb('0x4b'),_0x44fb('0x4c'),_0x28babb[_0x44fb('0x1c')]),'penalty':0x0,'paused':_0x28babb['faxPause'],'createdAt':_0x28babb[_0x44fb('0x4a')],'updatedAt':_0x28babb[_0x44fb('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x44fb('0x18')](respondWithFilteredResult(_0xf27802,_0x2bf1e0))['catch'](handleError(_0xf27802,null));};exports['getTeams']=function(_0x1ed4a0,_0x35a96b){var _0x2b45a0={};var _0x4b3cdb={};var _0x5b3532;var _0x5683d9;return db[_0x44fb('0x1e')][_0x44fb('0x40')]({'where':{'id':_0x1ed4a0[_0x44fb('0x29')]['id']}})[_0x44fb('0x18')](handleEntityNotFound(_0x35a96b,null))[_0x44fb('0x18')](function(_0x1a4683){if(_0x1a4683){_0x5b3532=_0x1a4683;_0x4b3cdb['model']=_[_0x44fb('0x2b')](db[_0x44fb('0x4d')][_0x44fb('0x2c')]);_0x4b3cdb[_0x44fb('0x2d')]=_['keys'](_0x1ed4a0['query']);_0x4b3cdb[_0x44fb('0x2e')]=_[_0x44fb('0x2f')](_0x4b3cdb[_0x44fb('0x2a')],_0x4b3cdb['query']);_0x2b45a0[_0x44fb('0x30')]=_['intersection'](_0x4b3cdb[_0x44fb('0x2a')],qs[_0x44fb('0x4e')](_0x1ed4a0[_0x44fb('0x2d')][_0x44fb('0x4e')]));_0x2b45a0[_0x44fb('0x30')]=_0x2b45a0['attributes'][_0x44fb('0x31')]?_0x2b45a0[_0x44fb('0x30')]:_0x4b3cdb[_0x44fb('0x2a')];_0x2b45a0[_0x44fb('0x44')]=qs['sort'](_0x1ed4a0[_0x44fb('0x2d')][_0x44fb('0x4f')]);_0x2b45a0[_0x44fb('0x23')]=qs[_0x44fb('0x2e')](_[_0x44fb('0x50')](_0x1ed4a0[_0x44fb('0x2d')],_0x4b3cdb[_0x44fb('0x2e')]));if(_0x1ed4a0[_0x44fb('0x2d')][_0x44fb('0x46')]){_0x2b45a0[_0x44fb('0x23')]=_[_0x44fb('0x33')](_0x2b45a0[_0x44fb('0x23')],{'$or':_[_0x44fb('0x1d')](_0x2b45a0[_0x44fb('0x30')],function(_0x3903a6){var _0x2a7b90={};_0x2a7b90[_0x3903a6]={'$like':'%'+_0x1ed4a0[_0x44fb('0x2d')][_0x44fb('0x46')]+'%'};return _0x2a7b90;})});}_0x2b45a0=_[_0x44fb('0x33')]({},_0x2b45a0,_0x1ed4a0['options']);return _0x5b3532['getTeams'](_0x2b45a0);}})[_0x44fb('0x18')](function(_0x3cc62c){if(_0x3cc62c){_0x5683d9=_0x3cc62c[_0x44fb('0x31')];if(!_0x1ed4a0[_0x44fb('0x2d')][_0x44fb('0x42')](_0x44fb('0x43'))){_0x2b45a0['limit']=qs['limit'](_0x1ed4a0[_0x44fb('0x2d')][_0x44fb('0x13')]);_0x2b45a0[_0x44fb('0x11')]=qs[_0x44fb('0x11')](_0x1ed4a0['query'][_0x44fb('0x11')]);}return _0x5b3532[_0x44fb('0x51')](_0x2b45a0);}})[_0x44fb('0x18')](function(_0x2cc986){if(_0x2cc986){return _0x2cc986?{'count':_0x5683d9,'rows':_0x2cc986}:null;}})[_0x44fb('0x18')](respondWithResult(_0x35a96b,null))[_0x44fb('0x27')](handleError(_0x35a96b,null));};exports[_0x44fb('0x52')]=function(_0x236b26,_0x2d8489){var _0x2ac0a5=_0x236b26['body'][_0x44fb('0x53')];return db[_0x44fb('0x4d')]['findAll']({'where':{'id':_0x2ac0a5},'attributes':['id'],'include':[{'model':db[_0x44fb('0x54')],'as':_0x44fb('0x55'),'attributes':['id','name',_0x44fb('0x56'),_0x44fb('0x57'),_0x44fb('0x58')],'raw':!![]}]})['then'](function(_0x538866){if(_0x538866){var _0x5c1028=_[_0x44fb('0x59')](_0x538866,function(_0x3d0574){var _0x42f3c8=_0x3d0574[_0x44fb('0x1a')]({'plain':!![]});return _0x42f3c8[_0x44fb('0x55')];});return db[_0x44fb('0x1e')][_0x44fb('0x39')]({'where':{'id':_0x236b26[_0x44fb('0x29')]['id']}})['then'](function(_0x3781f8){return db[_0x44fb('0x5a')][_0x44fb('0x5b')](function(_0x42d65b){return _0x3781f8[_0x44fb('0x52')](_0x2ac0a5,{'transaction':_0x42d65b})['then'](function(){return BPromise[_0x44fb('0x5c')](_0x5c1028,function(_0x21785b){return db[_0x44fb('0x41')]['findOrCreate']({'where':{'UserId':_0x21785b['id'],'FaxQueueId':_0x236b26[_0x44fb('0x29')]['id']},'transaction':_0x42d65b});});})[_0x44fb('0x18')](function(){_0x5c1028[_0x44fb('0x5d')](function(_0x3bfc06){socket[_0x44fb('0x5e')](_0x44fb('0x5f'),{'UserId':_0x3bfc06['id'],'FaxQueueId':_0x3781f8['id']});});});});});}})[_0x44fb('0x18')](respondWithStatusCode(_0x2d8489,null))[_0x44fb('0x27')](handleError(_0x2d8489,null));};exports[_0x44fb('0x60')]=function(_0x19bce1,_0x35d961){return db[_0x44fb('0x4d')][_0x44fb('0x25')]({'where':{'id':_0x19bce1[_0x44fb('0x2d')]['ids']},'attributes':['id'],'include':[{'model':db[_0x44fb('0x54')],'as':_0x44fb('0x55'),'attributes':['id'],'raw':!![]}]})[_0x44fb('0x18')](handleEntityNotFound(_0x35d961,null))[_0x44fb('0x18')](function(_0x124783){var _0x260529=_[_0x44fb('0x1d')](_0x124783,'id');var _0x45aab8=[];var _0x34268f=[];var _0x5676ab=squel[_0x44fb('0x61')]();_0x5676ab['field'](_0x44fb('0x62'))[_0x44fb('0x63')]('team_has_fax_queues','tq')['join'](_0x44fb('0x64'),'ut',_0x44fb('0x65'))['where'](_0x44fb('0x66'),_0x19bce1['params']['id']);for(var _0x4b46b4=0x0;_0x4b46b4<_0x124783[_0x44fb('0x31')];_0x4b46b4+=0x1){let _0x382234=_0x124783[_0x4b46b4];for(var _0x28b6de=0x0;_0x28b6de<_0x382234[_0x44fb('0x55')][_0x44fb('0x31')];_0x28b6de+=0x1){let _0x4804ea=_0x382234['Agents'][_0x28b6de];var _0x546aed=_0x5676ab[_0x44fb('0x67')]();_0x546aed[_0x44fb('0x23')](_0x44fb('0x68'),_0x4804ea['id']);_0x34268f[_0x44fb('0x69')](db[_0x44fb('0x5a')][_0x44fb('0x2d')](_0x546aed[_0x44fb('0x6a')](),{'type':db[_0x44fb('0x5a')][_0x44fb('0x6b')][_0x44fb('0x6c')]})[_0x44fb('0x18')](function(_0x10d40c){if(_0x10d40c[_0x44fb('0x31')]===0x1){return _0x4804ea['id'];}else{var _0x26c134=_['every'](_[_0x44fb('0x1d')](_0x10d40c,'TeamId'),function(_0x245a8d){return _[_0x44fb('0x6d')](_0x260529,_0x245a8d);});if(_0x26c134){return _0x4804ea['id'];}}}));}}return BPromise[_0x44fb('0x6e')](_0x34268f)[_0x44fb('0x18')](function(_0x152963){_0x45aab8=_(_0x45aab8)[_0x44fb('0x6f')](_0x152963)[_0x44fb('0x70')]()['value']();return db['FaxQueue'][_0x44fb('0x39')]({'where':{'id':_0x19bce1[_0x44fb('0x29')]['id']}})['then'](function(_0x399142){return db[_0x44fb('0x5a')][_0x44fb('0x5b')](function(_0x20792){return _0x399142[_0x44fb('0x60')](_0x19bce1[_0x44fb('0x2d')][_0x44fb('0x53')],{'transaction':_0x20792})['then'](function(){if(!_['isEmpty'](_0x45aab8)){return _0x399142['removeAgents'](_0x45aab8,{'transaction':_0x20792});}})[_0x44fb('0x18')](function(){_0x45aab8['forEach'](function(_0x385e5e){socket[_0x44fb('0x5e')](_0x44fb('0x71'),{'UserId':_0x385e5e,'FaxQueueId':_0x399142['id']});});});});});});})[_0x44fb('0x18')](respondWithStatusCode(_0x35d961,null))[_0x44fb('0x27')](handleError(_0x35d961,null));};exports['addAgents']=function(_0x498fff,_0x583381){return db[_0x44fb('0x1e')][_0x44fb('0x39')]({'where':{'id':_0x498fff['params']['id']}})[_0x44fb('0x18')](handleEntityNotFound(_0x583381,null))['then'](function(_0x4e7074){if(_0x4e7074){return _0x4e7074[_0x44fb('0x72')](_0x498fff[_0x44fb('0x35')]['ids'],_[_0x44fb('0x73')](_0x498fff[_0x44fb('0x35')],[_0x44fb('0x53'),'id'])||{})[_0x44fb('0x74')](function(_0x490bb1){for(var _0x20a3ec=0x0;_0x20a3ec<_0x498fff[_0x44fb('0x35')][_0x44fb('0x53')][_0x44fb('0x31')];_0x20a3ec+=0x1){socket[_0x44fb('0x5e')](_0x44fb('0x5f'),{'UserId':Number(_0x498fff[_0x44fb('0x35')][_0x44fb('0x53')][_0x20a3ec]),'FaxQueueId':Number(_0x498fff[_0x44fb('0x29')]['id'])});}return _0x490bb1;});}})[_0x44fb('0x18')](respondWithResult(_0x583381,null))[_0x44fb('0x27')](handleError(_0x583381,null));};exports[_0x44fb('0x75')]=function(_0x10c4c9,_0x172fba){return db[_0x44fb('0x1e')][_0x44fb('0x39')]({'where':{'id':_0x10c4c9[_0x44fb('0x29')]['id']}})['then'](handleEntityNotFound(_0x172fba,null))[_0x44fb('0x18')](function(_0x4bf099){if(_0x4bf099){return _0x4bf099['removeAgents'](_0x10c4c9[_0x44fb('0x2d')][_0x44fb('0x53')])[_0x44fb('0x18')](function(){if(_['isArray'](_0x10c4c9[_0x44fb('0x2d')][_0x44fb('0x53')])){for(var _0x2a7f1a=0x0;_0x2a7f1a<_0x10c4c9[_0x44fb('0x2d')][_0x44fb('0x53')][_0x44fb('0x31')];_0x2a7f1a+=0x1){socket[_0x44fb('0x5e')](_0x44fb('0x71'),{'UserId':Number(_0x10c4c9[_0x44fb('0x2d')]['ids'][_0x2a7f1a]),'FaxQueueId':Number(_0x10c4c9[_0x44fb('0x29')]['id'])});}}else{socket[_0x44fb('0x5e')]('userFaxQueue:remove',{'UserId':Number(_0x10c4c9[_0x44fb('0x2d')][_0x44fb('0x53')]),'FaxQueueId':Number(_0x10c4c9[_0x44fb('0x29')]['id'])});}});}})['then'](respondWithStatusCode(_0x172fba,null))[_0x44fb('0x27')](handleError(_0x172fba,null));};exports[_0x44fb('0x76')]=function(_0x25e5a4,_0x129a9f){var _0x2257be={};var _0x43db61={};var _0x3b8b46;var _0x167da5;return db['FaxQueue'][_0x44fb('0x40')]({'where':{'id':_0x25e5a4['params']['id']}})['then'](handleEntityNotFound(_0x129a9f,null))['then'](function(_0x50a1be){if(_0x50a1be){_0x3b8b46=_0x50a1be;_0x43db61['model']=_[_0x44fb('0x2b')](db[_0x44fb('0x54')][_0x44fb('0x2c')]);_0x43db61[_0x44fb('0x2d')]=_[_0x44fb('0x2b')](_0x25e5a4[_0x44fb('0x2d')]);_0x43db61[_0x44fb('0x2e')]=_[_0x44fb('0x2f')](_0x43db61[_0x44fb('0x2a')],_0x43db61[_0x44fb('0x2d')]);_0x2257be[_0x44fb('0x30')]=_[_0x44fb('0x2f')](_0x43db61['model'],qs[_0x44fb('0x4e')](_0x25e5a4[_0x44fb('0x2d')][_0x44fb('0x4e')]));_0x2257be[_0x44fb('0x30')]=_0x2257be[_0x44fb('0x30')]['length']?_0x2257be[_0x44fb('0x30')]:_0x43db61['model'];_0x2257be[_0x44fb('0x44')]=qs['sort'](_0x25e5a4['query']['sort']);_0x2257be['where']=qs[_0x44fb('0x2e')](_[_0x44fb('0x50')](_0x25e5a4[_0x44fb('0x2d')],_0x43db61[_0x44fb('0x2e')]));if(_0x25e5a4[_0x44fb('0x2d')][_0x44fb('0x46')]){_0x2257be[_0x44fb('0x23')]=_['merge'](_0x2257be[_0x44fb('0x23')],{'$or':_[_0x44fb('0x1d')](_0x2257be['attributes'],function(_0x4d936e){var _0x23df45={};_0x23df45[_0x4d936e]={'$like':'%'+_0x25e5a4[_0x44fb('0x2d')]['filter']+'%'};return _0x23df45;})});}_0x2257be=_[_0x44fb('0x33')]({},_0x2257be,_0x25e5a4['options']);return _0x3b8b46[_0x44fb('0x76')](_0x2257be);}})[_0x44fb('0x18')](function(_0x1e6c44){if(_0x1e6c44){_0x167da5=_0x1e6c44[_0x44fb('0x31')];if(!_0x25e5a4[_0x44fb('0x2d')]['hasOwnProperty']('nolimit')){_0x2257be[_0x44fb('0x13')]=qs[_0x44fb('0x13')](_0x25e5a4[_0x44fb('0x2d')][_0x44fb('0x13')]);_0x2257be[_0x44fb('0x11')]=qs[_0x44fb('0x11')](_0x25e5a4['query'][_0x44fb('0x11')]);}return _0x3b8b46[_0x44fb('0x76')](_0x2257be);}})[_0x44fb('0x18')](function(_0x337e9f){if(_0x337e9f){return _0x337e9f?{'count':_0x167da5,'rows':_0x337e9f}:null;}})[_0x44fb('0x18')](respondWithResult(_0x129a9f,null))[_0x44fb('0x27')](handleError(_0x129a9f,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 62c34d0..19c771a 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 _0x690e=['../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x690e,0x18f));var _0xe690=function(_0x2a326d,_0x232538){_0x2a326d=_0x2a326d-0x0;var _0x1d8ba4=_0x690e[_0x2a326d];return _0x1d8ba4;};'use strict';var EventEmitter=require(_0xe690('0x0'));var FaxQueue=require(_0xe690('0x1'))['db'][_0xe690('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xe690('0x3')](0x0);var events={'afterCreate':_0xe690('0x4'),'afterUpdate':_0xe690('0x5'),'afterDestroy':_0xe690('0x6')};function emitEvent(_0x55ee14){return function(_0x38396d,_0x756d83,_0x23ebc3){FaxQueueEvents['emit'](_0x55ee14+':'+_0x38396d['id'],_0x38396d);FaxQueueEvents[_0xe690('0x7')](_0x55ee14,_0x38396d);_0x23ebc3(null);};}for(var e in events){if(events[_0xe690('0x8')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xe690('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0xa0d1=['FaxQueue','save','update','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xa0d1,0x12b));var _0x1a0d=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xa0d1[_0x49b207];return _0x2dc8fa;};'use strict';var EventEmitter=require(_0x1a0d('0x0'));var FaxQueue=require(_0x1a0d('0x1'))['db'][_0x1a0d('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1a0d('0x3'),'afterUpdate':_0x1a0d('0x4'),'afterDestroy':'remove'};function emitEvent(_0xf1789e){return function(_0x45d542,_0x384b1e,_0x519856){FaxQueueEvents[_0x1a0d('0x5')](_0xf1789e+':'+_0x45d542['id'],_0x45d542);FaxQueueEvents[_0x1a0d('0x5')](_0xf1789e,_0x45d542);_0x519856(null);};}for(var e in events){if(events[_0x1a0d('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index eaf28d0..0e15be5 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 _0xce4f=['FaxQueue','fax_queues','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./faxQueue.attributes','define'];(function(_0x25e905,_0x42f080){var _0x4d1f16=function(_0x575f79){while(--_0x575f79){_0x25e905['push'](_0x25e905['shift']());}};_0x4d1f16(++_0x42f080);}(_0xce4f,0xbd));var _0xfce4=function(_0x3ccab7,_0x4a9120){_0x3ccab7=_0x3ccab7-0x0;var _0x405bb5=_0xce4f[_0x3ccab7];return _0x405bb5;};'use strict';var _=require(_0xfce4('0x0'));var util=require('util');var logger=require(_0xfce4('0x1'))('api');var moment=require(_0xfce4('0x2'));var BPromise=require(_0xfce4('0x3'));var rp=require(_0xfce4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfce4('0x5'));var config=require(_0xfce4('0x6'));var attributes=require(_0xfce4('0x7'));module['exports']=function(_0x4d25ad,_0x49a431){return _0x4d25ad[_0xfce4('0x8')](_0xfce4('0x9'),attributes,{'tableName':_0xfce4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1dd6=['exports','define','fax_queues','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxQueue.attributes'];(function(_0xdb8bc4,_0x536793){var _0x66184e=function(_0x32e598){while(--_0x32e598){_0xdb8bc4['push'](_0xdb8bc4['shift']());}};_0x66184e(++_0x536793);}(_0x1dd6,0x92));var _0x61dd=function(_0x5b1c98,_0x69dacc){_0x5b1c98=_0x5b1c98-0x0;var _0x308b16=_0x1dd6[_0x5b1c98];return _0x308b16;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x61dd('0x0'))(_0x61dd('0x1'));var moment=require(_0x61dd('0x2'));var BPromise=require(_0x61dd('0x3'));var rp=require(_0x61dd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x61dd('0x5'));var config=require(_0x61dd('0x6'));var attributes=require(_0x61dd('0x7'));module[_0x61dd('0x8')]=function(_0x19c265,_0x5d09a3){return _0x19c265[_0x61dd('0x9')]('FaxQueue',attributes,{'tableName':_0x61dd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index a67541f..cd9840c 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 _0xa2b4=['message','request\x20sent','catch','GetFaxQueue','options','raw','where','attributes','limit','map','include','model','ShowFaxQueue','FaxQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./faxQueue.socket','register','then','info','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','FaxQueue,\x20%s,\x20%s'];(function(_0x30e3d7,_0xd64140){var _0x427871=function(_0x55fa2c){while(--_0x55fa2c){_0x30e3d7['push'](_0x30e3d7['shift']());}};_0x427871(++_0xd64140);}(_0xa2b4,0xab));var _0x4a2b=function(_0x4c33ad,_0x24947d){_0x4c33ad=_0x4c33ad-0x0;var _0x220cba=_0xa2b4[_0x4c33ad];return _0x220cba;};'use strict';var _=require(_0x4a2b('0x0'));var util=require(_0x4a2b('0x1'));var moment=require(_0x4a2b('0x2'));var BPromise=require(_0x4a2b('0x3'));var rs=require(_0x4a2b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a2b('0x5'))['db'];var utils=require(_0x4a2b('0x6'));var logger=require(_0x4a2b('0x7'))('rpc');var config=require(_0x4a2b('0x8'));var jayson=require(_0x4a2b('0x9'));var client=jayson[_0x4a2b('0xa')][_0x4a2b('0xb')]({'port':0x232a});config['redis']=_[_0x4a2b('0xc')](config[_0x4a2b('0xd')],{'host':_0x4a2b('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4a2b('0xf'))[_0x4a2b('0x10')](socket);function respondWithRpcPromise(_0x38e0ee,_0x4428e8,_0x326f71){return new BPromise(function(_0x1e81cf,_0x5f5946){return client['request'](_0x38e0ee,_0x326f71)[_0x4a2b('0x11')](function(_0x3c5171){logger[_0x4a2b('0x12')]('FaxQueue,\x20%s,\x20%s',_0x4428e8,'request\x20sent');logger[_0x4a2b('0x13')](_0x4a2b('0x14'),_0x4428e8,'request\x20sent',JSON[_0x4a2b('0x15')](_0x3c5171));if(_0x3c5171[_0x4a2b('0x16')]){if(_0x3c5171[_0x4a2b('0x16')]['code']===0x1f4){logger[_0x4a2b('0x16')](_0x4a2b('0x17'),_0x4428e8,_0x3c5171['error'][_0x4a2b('0x18')]);return _0x5f5946(_0x3c5171[_0x4a2b('0x16')][_0x4a2b('0x18')]);}logger['error'](_0x4a2b('0x17'),_0x4428e8,_0x3c5171[_0x4a2b('0x16')][_0x4a2b('0x18')]);return _0x1e81cf(_0x3c5171['error']['message']);}else{logger[_0x4a2b('0x12')](_0x4a2b('0x17'),_0x4428e8,_0x4a2b('0x19'));_0x1e81cf(_0x3c5171['result'][_0x4a2b('0x18')]);}})[_0x4a2b('0x1a')](function(_0x5cc8c0){logger[_0x4a2b('0x16')](_0x4a2b('0x17'),_0x4428e8,_0x5cc8c0);_0x5f5946(_0x5cc8c0);});});}exports[_0x4a2b('0x1b')]=function(_0x5758f4){var _0x27b633=this;return new Promise(function(_0x21f143,_0x3adcbe){return db['FaxQueue']['findAll']({'raw':_0x5758f4[_0x4a2b('0x1c')]?_0x5758f4['options'][_0x4a2b('0x1d')]===undefined?!![]:![]:!![],'where':_0x5758f4[_0x4a2b('0x1c')]?_0x5758f4[_0x4a2b('0x1c')][_0x4a2b('0x1e')]||null:null,'attributes':_0x5758f4[_0x4a2b('0x1c')]?_0x5758f4[_0x4a2b('0x1c')][_0x4a2b('0x1f')]||null:null,'limit':_0x5758f4[_0x4a2b('0x1c')]?_0x5758f4['options'][_0x4a2b('0x20')]||null:null,'include':_0x5758f4[_0x4a2b('0x1c')]?_0x5758f4['options']['include']?_[_0x4a2b('0x21')](_0x5758f4[_0x4a2b('0x1c')][_0x4a2b('0x22')],function(_0x24f275){return{'model':db[_0x24f275[_0x4a2b('0x23')]],'as':_0x24f275['as'],'attributes':_0x24f275[_0x4a2b('0x1f')],'include':_0x24f275[_0x4a2b('0x22')]?_[_0x4a2b('0x21')](_0x24f275['include'],function(_0x17f0bc){return{'model':db[_0x17f0bc[_0x4a2b('0x23')]],'as':_0x17f0bc['as'],'attributes':_0x17f0bc[_0x4a2b('0x1f')],'include':_0x17f0bc[_0x4a2b('0x22')]?_[_0x4a2b('0x21')](_0x17f0bc[_0x4a2b('0x22')],function(_0x125654){return{'model':db[_0x125654[_0x4a2b('0x23')]],'as':_0x125654['as'],'attributes':_0x125654[_0x4a2b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4a2b('0x11')](function(_0x39690a){logger[_0x4a2b('0x12')]('GetFaxQueue',_0x5758f4);logger[_0x4a2b('0x13')](_0x4a2b('0x1b'),_0x5758f4,JSON[_0x4a2b('0x15')](_0x39690a));_0x21f143(_0x39690a);})[_0x4a2b('0x1a')](function(_0x3d7fa7){logger['error'](_0x4a2b('0x1b'),_0x3d7fa7[_0x4a2b('0x18')],_0x5758f4);_0x3adcbe(_0x27b633['error'](0x1f4,_0x3d7fa7['message']));});});};exports[_0x4a2b('0x24')]=function(_0xf49a5){var _0x5bec2b=this;return new Promise(function(_0x549990,_0xde73cd){return db[_0x4a2b('0x25')][_0x4a2b('0x26')]({'raw':_0xf49a5[_0x4a2b('0x1c')]?_0xf49a5[_0x4a2b('0x1c')][_0x4a2b('0x1d')]===undefined?!![]:![]:!![],'where':_0xf49a5['options']?_0xf49a5[_0x4a2b('0x1c')][_0x4a2b('0x1e')]||null:null,'attributes':_0xf49a5['options']?_0xf49a5[_0x4a2b('0x1c')][_0x4a2b('0x1f')]||null:null,'include':_0xf49a5['options']?_0xf49a5['options'][_0x4a2b('0x22')]?_[_0x4a2b('0x21')](_0xf49a5[_0x4a2b('0x1c')][_0x4a2b('0x22')],function(_0x20ee09){return{'model':db[_0x20ee09[_0x4a2b('0x23')]],'as':_0x20ee09['as'],'attributes':_0x20ee09['attributes'],'include':_0x20ee09[_0x4a2b('0x22')]?_['map'](_0x20ee09[_0x4a2b('0x22')],function(_0x51fa7e){return{'model':db[_0x51fa7e['model']],'as':_0x51fa7e['as'],'attributes':_0x51fa7e[_0x4a2b('0x1f')],'include':_0x51fa7e[_0x4a2b('0x22')]?_[_0x4a2b('0x21')](_0x51fa7e[_0x4a2b('0x22')],function(_0x5f09c5){return{'model':db[_0x5f09c5[_0x4a2b('0x23')]],'as':_0x5f09c5['as'],'attributes':_0x5f09c5[_0x4a2b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4a2b('0x11')](function(_0x41848e){logger[_0x4a2b('0x12')](_0x4a2b('0x24'),_0xf49a5);logger[_0x4a2b('0x13')](_0x4a2b('0x24'),_0xf49a5,JSON[_0x4a2b('0x15')](_0x41848e));_0x549990(_0x41848e);})['catch'](function(_0x2391db){logger[_0x4a2b('0x16')](_0x4a2b('0x24'),_0x2391db[_0x4a2b('0x18')],_0xf49a5);_0xde73cd(_0x5bec2b[_0x4a2b('0x16')](0x1f4,_0x2391db[_0x4a2b('0x18')]));});});}; \ No newline at end of file +var _0x1c14=['GetFaxQueue','FaxQueue','options','where','attributes','limit','include','model','map','ShowFaxQueue','find','raw','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','request','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxQueue,\x20%s,\x20%s','result','catch'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x1c14,0x174));var _0x41c1=function(_0x322fcc,_0xfd23ba){_0x322fcc=_0x322fcc-0x0;var _0x21c462=_0x1c14[_0x322fcc];return _0x21c462;};'use strict';var _=require(_0x41c1('0x0'));var util=require(_0x41c1('0x1'));var moment=require(_0x41c1('0x2'));var BPromise=require(_0x41c1('0x3'));var rs=require(_0x41c1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x41c1('0x5'))(_0x41c1('0x6'));var config=require('../../config/environment');var jayson=require(_0x41c1('0x7'));var client=jayson[_0x41c1('0x8')][_0x41c1('0x9')]({'port':0x232a});config[_0x41c1('0xa')]=_[_0x41c1('0xb')](config['redis'],{'host':_0x41c1('0xc'),'port':0x18eb});var socket=require(_0x41c1('0xd'))(new Redis(config[_0x41c1('0xa')]));require(_0x41c1('0xe'))['register'](socket);function respondWithRpcPromise(_0x19dcb0,_0x4c77e3,_0x16d7a7){return new BPromise(function(_0x59edb7,_0x2e9210){return client[_0x41c1('0xf')](_0x19dcb0,_0x16d7a7)[_0x41c1('0x10')](function(_0xe0ff07){logger[_0x41c1('0x11')]('FaxQueue,\x20%s,\x20%s',_0x4c77e3,_0x41c1('0x12'));logger[_0x41c1('0x13')](_0x41c1('0x14'),_0x4c77e3,_0x41c1('0x12'),JSON[_0x41c1('0x15')](_0xe0ff07));if(_0xe0ff07[_0x41c1('0x16')]){if(_0xe0ff07[_0x41c1('0x16')][_0x41c1('0x17')]===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0x4c77e3,_0xe0ff07[_0x41c1('0x16')][_0x41c1('0x18')]);return _0x2e9210(_0xe0ff07[_0x41c1('0x16')]['message']);}logger[_0x41c1('0x16')](_0x41c1('0x19'),_0x4c77e3,_0xe0ff07['error'][_0x41c1('0x18')]);return _0x59edb7(_0xe0ff07[_0x41c1('0x16')][_0x41c1('0x18')]);}else{logger['info']('FaxQueue,\x20%s,\x20%s',_0x4c77e3,'request\x20sent');_0x59edb7(_0xe0ff07[_0x41c1('0x1a')]['message']);}})[_0x41c1('0x1b')](function(_0x34c684){logger['error'](_0x41c1('0x19'),_0x4c77e3,_0x34c684);_0x2e9210(_0x34c684);});});}exports[_0x41c1('0x1c')]=function(_0x2004e1){var _0x4ca9b5=this;return new Promise(function(_0x57ccf0,_0x36d7b2){return db[_0x41c1('0x1d')]['findAll']({'raw':_0x2004e1[_0x41c1('0x1e')]?_0x2004e1['options']['raw']===undefined?!![]:![]:!![],'where':_0x2004e1[_0x41c1('0x1e')]?_0x2004e1[_0x41c1('0x1e')][_0x41c1('0x1f')]||null:null,'attributes':_0x2004e1[_0x41c1('0x1e')]?_0x2004e1[_0x41c1('0x1e')][_0x41c1('0x20')]||null:null,'limit':_0x2004e1[_0x41c1('0x1e')]?_0x2004e1['options'][_0x41c1('0x21')]||null:null,'include':_0x2004e1[_0x41c1('0x1e')]?_0x2004e1[_0x41c1('0x1e')][_0x41c1('0x22')]?_['map'](_0x2004e1[_0x41c1('0x1e')][_0x41c1('0x22')],function(_0x4ca863){return{'model':db[_0x4ca863[_0x41c1('0x23')]],'as':_0x4ca863['as'],'attributes':_0x4ca863[_0x41c1('0x20')],'include':_0x4ca863[_0x41c1('0x22')]?_[_0x41c1('0x24')](_0x4ca863['include'],function(_0x4b0209){return{'model':db[_0x4b0209[_0x41c1('0x23')]],'as':_0x4b0209['as'],'attributes':_0x4b0209['attributes'],'include':_0x4b0209[_0x41c1('0x22')]?_[_0x41c1('0x24')](_0x4b0209[_0x41c1('0x22')],function(_0x5dc187){return{'model':db[_0x5dc187[_0x41c1('0x23')]],'as':_0x5dc187['as'],'attributes':_0x5dc187[_0x41c1('0x20')]};}):[]};}):[]};}):[]:[]})[_0x41c1('0x10')](function(_0x96a4f8){logger[_0x41c1('0x11')](_0x41c1('0x1c'),_0x2004e1);logger[_0x41c1('0x13')]('GetFaxQueue',_0x2004e1,JSON[_0x41c1('0x15')](_0x96a4f8));_0x57ccf0(_0x96a4f8);})['catch'](function(_0x38d6f0){logger[_0x41c1('0x16')](_0x41c1('0x1c'),_0x38d6f0[_0x41c1('0x18')],_0x2004e1);_0x36d7b2(_0x4ca9b5[_0x41c1('0x16')](0x1f4,_0x38d6f0['message']));});});};exports[_0x41c1('0x25')]=function(_0x3d2589){var _0x21e948=this;return new Promise(function(_0x5bb48c,_0x3cff7c){return db[_0x41c1('0x1d')][_0x41c1('0x26')]({'raw':_0x3d2589[_0x41c1('0x1e')]?_0x3d2589[_0x41c1('0x1e')][_0x41c1('0x27')]===undefined?!![]:![]:!![],'where':_0x3d2589['options']?_0x3d2589[_0x41c1('0x1e')]['where']||null:null,'attributes':_0x3d2589['options']?_0x3d2589[_0x41c1('0x1e')][_0x41c1('0x20')]||null:null,'include':_0x3d2589['options']?_0x3d2589[_0x41c1('0x1e')][_0x41c1('0x22')]?_[_0x41c1('0x24')](_0x3d2589[_0x41c1('0x1e')]['include'],function(_0xcf2477){return{'model':db[_0xcf2477[_0x41c1('0x23')]],'as':_0xcf2477['as'],'attributes':_0xcf2477[_0x41c1('0x20')],'include':_0xcf2477[_0x41c1('0x22')]?_[_0x41c1('0x24')](_0xcf2477[_0x41c1('0x22')],function(_0xf6349b){return{'model':db[_0xf6349b[_0x41c1('0x23')]],'as':_0xf6349b['as'],'attributes':_0xf6349b[_0x41c1('0x20')],'include':_0xf6349b[_0x41c1('0x22')]?_[_0x41c1('0x24')](_0xf6349b['include'],function(_0x2f4766){return{'model':db[_0x2f4766[_0x41c1('0x23')]],'as':_0x2f4766['as'],'attributes':_0x2f4766[_0x41c1('0x20')]};}):[]};}):[]};}):[]:[]})[_0x41c1('0x10')](function(_0x1da5b1){logger[_0x41c1('0x11')](_0x41c1('0x25'),_0x3d2589);logger[_0x41c1('0x13')](_0x41c1('0x25'),_0x3d2589,JSON[_0x41c1('0x15')](_0x1da5b1));_0x5bb48c(_0x1da5b1);})[_0x41c1('0x1b')](function(_0x562046){logger['error'](_0x41c1('0x25'),_0x562046[_0x41c1('0x18')],_0x3d2589);_0x3cff7c(_0x21e948[_0x41c1('0x16')](0x1f4,_0x562046[_0x41c1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index bf86cc9..47da0fb 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 _0xb8b2=['removeListener','length','faxQueue:','save','update','emit'];(function(_0x20830a,_0x501161){var _0x40d9a7=function(_0x208cdf){while(--_0x208cdf){_0x20830a['push'](_0x20830a['shift']());}};_0x40d9a7(++_0x501161);}(_0xb8b2,0x9f));var _0x2b8b=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xb8b2[_0x37c22c];return _0x119d79;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x2b8b('0x0'),'remove',_0x2b8b('0x1')];function createListener(_0x4d0426,_0x9202e3){return function(_0x2ab10b){_0x9202e3[_0x2b8b('0x2')](_0x4d0426,_0x2ab10b);};}function removeListener(_0x1ae5b8,_0x403536){return function(){FaxQueueEvents[_0x2b8b('0x3')](_0x1ae5b8,_0x403536);};}exports['register']=function(_0x5e5d1f){for(var _0x5a8eb3=0x0,_0x4f9c97=events[_0x2b8b('0x4')];_0x5a8eb3<_0x4f9c97;_0x5a8eb3++){var _0x2eea9b=events[_0x5a8eb3];var _0x1a7fd5=createListener(_0x2b8b('0x5')+_0x2eea9b,_0x5e5d1f);FaxQueueEvents['on'](_0x2eea9b,_0x1a7fd5);}}; \ No newline at end of file +var _0xe1ce=['./faxQueue.events','save','remove','update','emit','register','length'];(function(_0x375bd1,_0x4b2b87){var _0x361ff5=function(_0x137a01){while(--_0x137a01){_0x375bd1['push'](_0x375bd1['shift']());}};_0x361ff5(++_0x4b2b87);}(_0xe1ce,0x15e));var _0xee1c=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xe1ce[_0x4c12ec];return _0x3ae42c;};'use strict';var FaxQueueEvents=require(_0xee1c('0x0'));var events=[_0xee1c('0x1'),_0xee1c('0x2'),_0xee1c('0x3')];function createListener(_0x232980,_0x3cba37){return function(_0x22c991){_0x3cba37[_0xee1c('0x4')](_0x232980,_0x22c991);};}function removeListener(_0x1a624d,_0xf71499){return function(){FaxQueueEvents['removeListener'](_0x1a624d,_0xf71499);};}exports[_0xee1c('0x5')]=function(_0x4f0733){for(var _0x5729f0=0x0,_0x3ce52b=events[_0xee1c('0x6')];_0x5729f0<_0x3ce52b;_0x5729f0++){var _0x551a6c=events[_0x5729f0];var _0x52bec9=createListener('faxQueue:'+_0x551a6c,_0x4f0733);FaxQueueEvents['on'](_0x551a6c,_0x52bec9);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 50c6164..28faffa 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 _0xaa3f=['getMembers','/:id/teams','getTeams','post','create','addTeams','/:id/users','addAgents','put','update','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x4ec26c,_0x486039){_0x4ec26c=_0x4ec26c-0x0;var _0x161637=_0xaa3f[_0x4ec26c];return _0x161637;};'use strict';var multer=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var path=require(_0xfaa3('0x2'));var timeout=require(_0xfaa3('0x3'));var express=require(_0xfaa3('0x4'));var router=express[_0xfaa3('0x5')]();var fs_extra=require(_0xfaa3('0x6'));var auth=require(_0xfaa3('0x7'));var interaction=require(_0xfaa3('0x8'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0xfaa3('0x9')]('/',auth['isAuthenticated'](),controller[_0xfaa3('0xa')]);router[_0xfaa3('0x9')](_0xfaa3('0xb'),auth[_0xfaa3('0xc')](),controller[_0xfaa3('0xd')]);router[_0xfaa3('0x9')](_0xfaa3('0xe'),auth['isAuthenticated'](),controller[_0xfaa3('0xf')]);router[_0xfaa3('0x9')]('/:id/members',auth['isAuthenticated'](),controller[_0xfaa3('0x10')]);router[_0xfaa3('0x9')](_0xfaa3('0x11'),auth[_0xfaa3('0xc')](),controller[_0xfaa3('0x12')]);router[_0xfaa3('0x9')]('/:id/users',auth[_0xfaa3('0xc')](),controller['getAgents']);router[_0xfaa3('0x13')]('/',auth[_0xfaa3('0xc')](),controller[_0xfaa3('0x14')]);router['post'](_0xfaa3('0x11'),auth['isAuthenticated'](),controller[_0xfaa3('0x15')]);router[_0xfaa3('0x13')](_0xfaa3('0x16'),auth[_0xfaa3('0xc')](),controller[_0xfaa3('0x17')]);router[_0xfaa3('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xfaa3('0x19')]);router[_0xfaa3('0x1a')](_0xfaa3('0xe'),auth[_0xfaa3('0xc')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0xfaa3('0x1a')]('/:id/users',auth[_0xfaa3('0xc')](),controller[_0xfaa3('0x1b')]);module[_0xfaa3('0x1c')]=router; \ No newline at end of file +var _0x0a6b=['update','destroy','delete','removeTeams','removeAgents','exports','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','isAuthenticated','index','/describe','describe','show','get','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','/:id'];(function(_0x4b9978,_0x58eb71){var _0x42f0e5=function(_0x4ff5dc){while(--_0x4ff5dc){_0x4b9978['push'](_0x4b9978['shift']());}};_0x42f0e5(++_0x58eb71);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x579baf,_0x4aaafa){_0x579baf=_0x579baf-0x0;var _0x4c601a=_0x0a6b[_0x579baf];return _0x4c601a;};'use strict';var multer=require(_0xb0a6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb0a6('0x1'));var router=express['Router']();var fs_extra=require(_0xb0a6('0x2'));var auth=require(_0xb0a6('0x3'));var interaction=require(_0xb0a6('0x4'));var config=require('../../config/environment');var controller=require(_0xb0a6('0x5'));router['get']('/',auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x7')]);router['get'](_0xb0a6('0x8'),auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xb0a6('0xa')]);router[_0xb0a6('0xb')](_0xb0a6('0xc'),auth[_0xb0a6('0x6')](),controller['getMembers']);router[_0xb0a6('0xb')](_0xb0a6('0xd'),auth['isAuthenticated'](),controller[_0xb0a6('0xe')]);router[_0xb0a6('0xb')](_0xb0a6('0xf'),auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x10')]);router[_0xb0a6('0x11')]('/',auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x12')]);router[_0xb0a6('0x11')](_0xb0a6('0xd'),auth['isAuthenticated'](),controller[_0xb0a6('0x13')]);router['post'](_0xb0a6('0xf'),auth['isAuthenticated'](),controller[_0xb0a6('0x14')]);router['put'](_0xb0a6('0x15'),auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x16')]);router['delete']('/:id',auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x17')]);router[_0xb0a6('0x18')](_0xb0a6('0xd'),auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x19')]);router['delete'](_0xb0a6('0xf'),auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x1a')]);module[_0xb0a6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 5ee94f6..e7d241e 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 _0x33d8=['exports','STRING','DATE','sequelize'];(function(_0x3e45df,_0x45b5e7){var _0x5499de=function(_0x1bdff0){while(--_0x1bdff0){_0x3e45df['push'](_0x3e45df['shift']());}};_0x5499de(++_0x45b5e7);}(_0x33d8,0x1a7));var _0x833d=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x33d8[_0x68c979];return _0x4f0001;};'use strict';var moment=require('moment');var Sequelize=require(_0x833d('0x0'));module[_0x833d('0x1')]={'uniqueid':{'type':Sequelize[_0x833d('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x833d('0x2')]},'joinAt':{'type':Sequelize[_0x833d('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x833d('0x3')]},'exitAt':{'type':Sequelize[_0x833d('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xebc7=['sequelize','exports','STRING','DATE','moment'];(function(_0x4bffe6,_0x4ecff2){var _0x1cf6a5=function(_0xc2e063){while(--_0xc2e063){_0x4bffe6['push'](_0x4bffe6['shift']());}};_0x1cf6a5(++_0x4ecff2);}(_0xebc7,0x1b7));var _0x7ebc=function(_0x26496f,_0x2e0ac9){_0x26496f=_0x26496f-0x0;var _0x1bf4eb=_0xebc7[_0x26496f];return _0x1bf4eb;};'use strict';var moment=require(_0x7ebc('0x0'));var Sequelize=require(_0x7ebc('0x1'));module[_0x7ebc('0x2')]={'uniqueid':{'type':Sequelize[_0x7ebc('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x7ebc('0x3')]},'joinAt':{'type':Sequelize[_0x7ebc('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x7ebc('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x7ebc('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 09e6864..6f32a37 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 _0xd3d1=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','index','FaxQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x1bdfc1,_0x582e13){var _0x280501=function(_0x212e80){while(--_0x212e80){_0x1bdfc1['push'](_0x1bdfc1['shift']());}};_0x280501(++_0x582e13);}(_0xd3d1,0x172));var _0x1d3d=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xd3d1[_0x40220a];return _0x3903cc;};'use strict';var emlformat=require(_0x1d3d('0x0'));var rimraf=require(_0x1d3d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1d3d('0x2'));var moment=require(_0x1d3d('0x3'));var BPromise=require(_0x1d3d('0x4'));var Mustache=require(_0x1d3d('0x5'));var util=require(_0x1d3d('0x6'));var path=require(_0x1d3d('0x7'));var sox=require(_0x1d3d('0x8'));var csv=require(_0x1d3d('0x9'));var ejs=require(_0x1d3d('0xa'));var fs=require('fs');var fs_extra=require(_0x1d3d('0xb'));var _=require(_0x1d3d('0xc'));var squel=require(_0x1d3d('0xd'));var crypto=require(_0x1d3d('0xe'));var jsforce=require(_0x1d3d('0xf'));var deskjs=require(_0x1d3d('0x10'));var toCsv=require(_0x1d3d('0x9'));var querystring=require(_0x1d3d('0x11'));var Papa=require('papaparse');var Redis=require(_0x1d3d('0x12'));var authService=require(_0x1d3d('0x13'));var qs=require(_0x1d3d('0x14'));var as=require(_0x1d3d('0x15'));var hardwareService=require(_0x1d3d('0x16'));var logger=require(_0x1d3d('0x17'))(_0x1d3d('0x18'));var utils=require(_0x1d3d('0x19'));var config=require(_0x1d3d('0x1a'));var licenseUtil=require(_0x1d3d('0x1b'));var db=require(_0x1d3d('0x1c'))['db'];function respondWithStatusCode(_0x479216,_0xb587d){_0xb587d=_0xb587d||0xcc;return function(_0x2e375f){if(_0x2e375f){return _0x479216['sendStatus'](_0xb587d);}return _0x479216['status'](_0xb587d)[_0x1d3d('0x1d')]();};}function respondWithResult(_0x2f5b7f,_0x1a8035){_0x1a8035=_0x1a8035||0xc8;return function(_0x59b907){if(_0x59b907){return _0x2f5b7f[_0x1d3d('0x1e')](_0x1a8035)['json'](_0x59b907);}};}function respondWithFilteredResult(_0x1d54f3,_0x33e7d9){return function(_0x3491e4){if(_0x3491e4){var _0x24bb8c=typeof _0x33e7d9[_0x1d3d('0x1f')]===_0x1d3d('0x20')&&typeof _0x33e7d9[_0x1d3d('0x21')]==='undefined';var _0x5d3ac9=_0x3491e4[_0x1d3d('0x22')];var _0xe0a583=_0x24bb8c?0x0:_0x33e7d9['offset'];var _0x3b9174=_0x24bb8c?_0x3491e4['count']:_0x33e7d9[_0x1d3d('0x1f')]+_0x33e7d9[_0x1d3d('0x21')];var _0x2cd430;if(_0x3b9174>=_0x5d3ac9){_0x3b9174=_0x5d3ac9;_0x2cd430=0xc8;}else{_0x2cd430=0xce;}_0x1d54f3[_0x1d3d('0x1e')](_0x2cd430);return _0x1d54f3['set'](_0x1d3d('0x23'),_0xe0a583+'-'+_0x3b9174+'/'+_0x5d3ac9)['json'](_0x3491e4);}return null;};}function patchUpdates(_0x56c424){return function(_0x108005){try{jsonpatch[_0x1d3d('0x24')](_0x108005,_0x56c424,!![]);}catch(_0x43b14b){return BPromise[_0x1d3d('0x25')](_0x43b14b);}return _0x108005[_0x1d3d('0x26')]();};}function saveUpdates(_0xe4afa2,_0x471df5){return function(_0xa55c43){if(_0xa55c43){return _0xa55c43[_0x1d3d('0x27')](_0xe4afa2)[_0x1d3d('0x28')](function(_0x1610a6){return _0x1610a6;});}return null;};}function removeEntity(_0x502921,_0xfc3606){return function(_0x72868d){if(_0x72868d){return _0x72868d['destroy']()[_0x1d3d('0x28')](function(){_0x502921['status'](0xcc)[_0x1d3d('0x1d')]();});}};}function handleEntityNotFound(_0x20ae6d,_0x2bd023){return function(_0x4235fd){if(!_0x4235fd){_0x20ae6d[_0x1d3d('0x29')](0x194);}return _0x4235fd;};}function handleError(_0x16d032,_0x2b8074){_0x2b8074=_0x2b8074||0x1f4;return function(_0x298fd3){logger[_0x1d3d('0x2a')](_0x298fd3[_0x1d3d('0x2b')]);if(_0x298fd3[_0x1d3d('0x2c')]){delete _0x298fd3['name'];}_0x16d032[_0x1d3d('0x1e')](_0x2b8074)['send'](_0x298fd3);};}exports[_0x1d3d('0x2d')]=function(_0x2bcc2,_0x55c935){var _0x185913={},_0x16b7b3={},_0x3cb011={'count':0x0,'rows':[]};var _0x2a3812=_['map'](db[_0x1d3d('0x2e')][_0x1d3d('0x2f')],function(_0x5d1b6c){return{'name':_0x5d1b6c[_0x1d3d('0x30')],'type':_0x5d1b6c['type'][_0x1d3d('0x31')]};});_0x16b7b3[_0x1d3d('0x32')]=_['map'](_0x2a3812,_0x1d3d('0x2c'));_0x16b7b3[_0x1d3d('0x33')]=_[_0x1d3d('0x34')](_0x2bcc2[_0x1d3d('0x33')]);_0x16b7b3[_0x1d3d('0x35')]=_[_0x1d3d('0x36')](_0x16b7b3[_0x1d3d('0x32')],_0x16b7b3[_0x1d3d('0x33')]);_0x185913[_0x1d3d('0x37')]=_['intersection'](_0x16b7b3[_0x1d3d('0x32')],qs[_0x1d3d('0x38')](_0x2bcc2[_0x1d3d('0x33')][_0x1d3d('0x38')]));_0x185913['attributes']=_0x185913['attributes'][_0x1d3d('0x39')]?_0x185913[_0x1d3d('0x37')]:_0x16b7b3['model'];if(!_0x2bcc2[_0x1d3d('0x33')][_0x1d3d('0x3a')](_0x1d3d('0x3b'))){_0x185913[_0x1d3d('0x21')]=qs['limit'](_0x2bcc2['query'][_0x1d3d('0x21')]);_0x185913['offset']=qs[_0x1d3d('0x1f')](_0x2bcc2[_0x1d3d('0x33')][_0x1d3d('0x1f')]);}_0x185913[_0x1d3d('0x3c')]=qs[_0x1d3d('0x3d')](_0x2bcc2[_0x1d3d('0x33')][_0x1d3d('0x3d')]);_0x185913[_0x1d3d('0x3e')]=qs['filters'](_[_0x1d3d('0x3f')](_0x2bcc2['query'],_0x16b7b3[_0x1d3d('0x35')]),_0x2a3812);if(_0x2bcc2[_0x1d3d('0x33')]['filter']){_0x185913[_0x1d3d('0x3e')]=_[_0x1d3d('0x40')](_0x185913[_0x1d3d('0x3e')],{'$or':_[_0x1d3d('0x41')](_0x2a3812,function(_0x5c53c3){if(_0x5c53c3['type']!==_0x1d3d('0x42')){var _0x59502c={};_0x59502c[_0x5c53c3[_0x1d3d('0x2c')]]={'$like':'%'+_0x2bcc2[_0x1d3d('0x33')]['filter']+'%'};return _0x59502c;}})});}_0x185913=_[_0x1d3d('0x40')]({},_0x185913,_0x2bcc2[_0x1d3d('0x43')]);var _0x51be79={'where':_0x185913[_0x1d3d('0x3e')]};return db[_0x1d3d('0x2e')][_0x1d3d('0x22')](_0x51be79)[_0x1d3d('0x28')](function(_0x1fec46){_0x3cb011[_0x1d3d('0x22')]=_0x1fec46;if(_0x2bcc2['query'][_0x1d3d('0x44')]){_0x185913[_0x1d3d('0x45')]=[{'all':!![]}];}return db[_0x1d3d('0x2e')][_0x1d3d('0x46')](_0x185913);})[_0x1d3d('0x28')](function(_0x5f007e){_0x3cb011[_0x1d3d('0x47')]=_0x5f007e;return _0x3cb011;})[_0x1d3d('0x28')](respondWithFilteredResult(_0x55c935,_0x185913))[_0x1d3d('0x48')](handleError(_0x55c935,null));};exports[_0x1d3d('0x49')]=function(_0x5d0ab0,_0x3d1c0c){var _0x977ea8={'raw':!![],'where':{'id':_0x5d0ab0[_0x1d3d('0x4a')]['id']}},_0x1597fa={};_0x1597fa[_0x1d3d('0x32')]=_['keys'](db['FaxQueueReport'][_0x1d3d('0x2f')]);_0x1597fa[_0x1d3d('0x33')]=_[_0x1d3d('0x34')](_0x5d0ab0[_0x1d3d('0x33')]);_0x1597fa[_0x1d3d('0x35')]=_['intersection'](_0x1597fa[_0x1d3d('0x32')],_0x1597fa['query']);_0x977ea8[_0x1d3d('0x37')]=_[_0x1d3d('0x36')](_0x1597fa[_0x1d3d('0x32')],qs[_0x1d3d('0x38')](_0x5d0ab0['query'][_0x1d3d('0x38')]));_0x977ea8[_0x1d3d('0x37')]=_0x977ea8[_0x1d3d('0x37')][_0x1d3d('0x39')]?_0x977ea8[_0x1d3d('0x37')]:_0x1597fa[_0x1d3d('0x32')];if(_0x5d0ab0[_0x1d3d('0x33')]['includeAll']){_0x977ea8[_0x1d3d('0x45')]=[{'all':!![]}];}_0x977ea8=_['merge']({},_0x977ea8,_0x5d0ab0[_0x1d3d('0x43')]);return db[_0x1d3d('0x2e')]['find'](_0x977ea8)[_0x1d3d('0x28')](handleEntityNotFound(_0x3d1c0c,null))['then'](respondWithResult(_0x3d1c0c,null))[_0x1d3d('0x48')](handleError(_0x3d1c0c,null));};exports['create']=function(_0x17eded,_0xebd1f4){return db[_0x1d3d('0x2e')][_0x1d3d('0x4b')](_0x17eded[_0x1d3d('0x4c')],{})[_0x1d3d('0x28')](respondWithResult(_0xebd1f4,0xc9))[_0x1d3d('0x48')](handleError(_0xebd1f4,null));};exports[_0x1d3d('0x27')]=function(_0x59e88a,_0x5899cc){if(_0x59e88a['body']['id']){delete _0x59e88a[_0x1d3d('0x4c')]['id'];}return db[_0x1d3d('0x2e')][_0x1d3d('0x4d')]({'where':{'id':_0x59e88a[_0x1d3d('0x4a')]['id']}})[_0x1d3d('0x28')](handleEntityNotFound(_0x5899cc,null))[_0x1d3d('0x28')](saveUpdates(_0x59e88a['body'],null))['then'](respondWithResult(_0x5899cc,null))['catch'](handleError(_0x5899cc,null));};exports['destroy']=function(_0x3dc5ca,_0x21620d){return db[_0x1d3d('0x2e')][_0x1d3d('0x4d')]({'where':{'id':_0x3dc5ca[_0x1d3d('0x4a')]['id']}})[_0x1d3d('0x28')](handleEntityNotFound(_0x21620d,null))[_0x1d3d('0x28')](removeEntity(_0x21620d,null))[_0x1d3d('0x48')](handleError(_0x21620d,null));};exports[_0x1d3d('0x4e')]=function(_0x445cb0,_0xefc84c){return db[_0x1d3d('0x2e')][_0x1d3d('0x4e')]()[_0x1d3d('0x28')](respondWithResult(_0xefc84c,null))[_0x1d3d('0x48')](handleError(_0xefc84c,null));}; \ No newline at end of file +var _0xfe60=['update','find','describe','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','FaxQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','findAll','rows','catch','show','params','body'];(function(_0x5617fe,_0x3cd6b3){var _0x375a20=function(_0x254199){while(--_0x254199){_0x5617fe['push'](_0x5617fe['shift']());}};_0x375a20(++_0x3cd6b3);}(_0xfe60,0x1cb));var _0x0fe6=function(_0x23a2a7,_0xb995b7){_0x23a2a7=_0x23a2a7-0x0;var _0x5e42b9=_0xfe60[_0x23a2a7];return _0x5e42b9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fe6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fe6('0x1'));var rp=require(_0x0fe6('0x2'));var moment=require(_0x0fe6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0fe6('0x4'));var util=require(_0x0fe6('0x5'));var path=require(_0x0fe6('0x6'));var sox=require(_0x0fe6('0x7'));var csv=require(_0x0fe6('0x8'));var ejs=require(_0x0fe6('0x9'));var fs=require('fs');var fs_extra=require(_0x0fe6('0xa'));var _=require(_0x0fe6('0xb'));var squel=require(_0x0fe6('0xc'));var crypto=require(_0x0fe6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0fe6('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0fe6('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0fe6('0x10'));var as=require(_0x0fe6('0x11'));var hardwareService=require(_0x0fe6('0x12'));var logger=require(_0x0fe6('0x13'))(_0x0fe6('0x14'));var utils=require(_0x0fe6('0x15'));var config=require(_0x0fe6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0fe6('0x17'))['db'];function respondWithStatusCode(_0xa43382,_0x469b27){_0x469b27=_0x469b27||0xcc;return function(_0x51eda9){if(_0x51eda9){return _0xa43382['sendStatus'](_0x469b27);}return _0xa43382[_0x0fe6('0x18')](_0x469b27)['end']();};}function respondWithResult(_0x5c4e63,_0x500e06){_0x500e06=_0x500e06||0xc8;return function(_0x225253){if(_0x225253){return _0x5c4e63[_0x0fe6('0x18')](_0x500e06)[_0x0fe6('0x19')](_0x225253);}};}function respondWithFilteredResult(_0x156aff,_0x3ab844){return function(_0x16f2f6){if(_0x16f2f6){var _0x44011a=typeof _0x3ab844[_0x0fe6('0x1a')]===_0x0fe6('0x1b')&&typeof _0x3ab844[_0x0fe6('0x1c')]===_0x0fe6('0x1b');var _0x347ebb=_0x16f2f6['count'];var _0x469a48=_0x44011a?0x0:_0x3ab844[_0x0fe6('0x1a')];var _0x34fc0c=_0x44011a?_0x16f2f6[_0x0fe6('0x1d')]:_0x3ab844[_0x0fe6('0x1a')]+_0x3ab844[_0x0fe6('0x1c')];var _0xf351d5;if(_0x34fc0c>=_0x347ebb){_0x34fc0c=_0x347ebb;_0xf351d5=0xc8;}else{_0xf351d5=0xce;}_0x156aff[_0x0fe6('0x18')](_0xf351d5);return _0x156aff[_0x0fe6('0x1e')](_0x0fe6('0x1f'),_0x469a48+'-'+_0x34fc0c+'/'+_0x347ebb)[_0x0fe6('0x19')](_0x16f2f6);}return null;};}function patchUpdates(_0x288bd6){return function(_0x4e13f9){try{jsonpatch[_0x0fe6('0x20')](_0x4e13f9,_0x288bd6,!![]);}catch(_0x270fc2){return BPromise[_0x0fe6('0x21')](_0x270fc2);}return _0x4e13f9[_0x0fe6('0x22')]();};}function saveUpdates(_0x4e2892,_0x124214){return function(_0x35a5da){if(_0x35a5da){return _0x35a5da['update'](_0x4e2892)[_0x0fe6('0x23')](function(_0x57198d){return _0x57198d;});}return null;};}function removeEntity(_0x3f9071,_0x224741){return function(_0x447086){if(_0x447086){return _0x447086[_0x0fe6('0x24')]()['then'](function(){_0x3f9071[_0x0fe6('0x18')](0xcc)[_0x0fe6('0x25')]();});}};}function handleEntityNotFound(_0x7f855d,_0x19370b){return function(_0x18431d){if(!_0x18431d){_0x7f855d['sendStatus'](0x194);}return _0x18431d;};}function handleError(_0x2a7f1e,_0x45a708){_0x45a708=_0x45a708||0x1f4;return function(_0x3428a7){logger[_0x0fe6('0x26')](_0x3428a7[_0x0fe6('0x27')]);if(_0x3428a7[_0x0fe6('0x28')]){delete _0x3428a7['name'];}_0x2a7f1e[_0x0fe6('0x18')](_0x45a708)[_0x0fe6('0x29')](_0x3428a7);};}exports[_0x0fe6('0x2a')]=function(_0x167d17,_0x2ede48){var _0x1bb6c0={},_0x18fad1={},_0x156593={'count':0x0,'rows':[]};var _0x3151b0=_['map'](db[_0x0fe6('0x2b')][_0x0fe6('0x2c')],function(_0x5e0839){return{'name':_0x5e0839[_0x0fe6('0x2d')],'type':_0x5e0839[_0x0fe6('0x2e')][_0x0fe6('0x2f')]};});_0x18fad1[_0x0fe6('0x30')]=_[_0x0fe6('0x31')](_0x3151b0,_0x0fe6('0x28'));_0x18fad1[_0x0fe6('0x32')]=_[_0x0fe6('0x33')](_0x167d17[_0x0fe6('0x32')]);_0x18fad1[_0x0fe6('0x34')]=_[_0x0fe6('0x35')](_0x18fad1[_0x0fe6('0x30')],_0x18fad1[_0x0fe6('0x32')]);_0x1bb6c0[_0x0fe6('0x36')]=_[_0x0fe6('0x35')](_0x18fad1[_0x0fe6('0x30')],qs[_0x0fe6('0x37')](_0x167d17['query']['fields']));_0x1bb6c0[_0x0fe6('0x36')]=_0x1bb6c0[_0x0fe6('0x36')][_0x0fe6('0x38')]?_0x1bb6c0[_0x0fe6('0x36')]:_0x18fad1[_0x0fe6('0x30')];if(!_0x167d17['query'][_0x0fe6('0x39')](_0x0fe6('0x3a'))){_0x1bb6c0[_0x0fe6('0x1c')]=qs[_0x0fe6('0x1c')](_0x167d17[_0x0fe6('0x32')][_0x0fe6('0x1c')]);_0x1bb6c0['offset']=qs['offset'](_0x167d17[_0x0fe6('0x32')][_0x0fe6('0x1a')]);}_0x1bb6c0[_0x0fe6('0x3b')]=qs['sort'](_0x167d17[_0x0fe6('0x32')][_0x0fe6('0x3c')]);_0x1bb6c0[_0x0fe6('0x3d')]=qs['filters'](_[_0x0fe6('0x3e')](_0x167d17[_0x0fe6('0x32')],_0x18fad1[_0x0fe6('0x34')]),_0x3151b0);if(_0x167d17[_0x0fe6('0x32')]['filter']){_0x1bb6c0[_0x0fe6('0x3d')]=_[_0x0fe6('0x3f')](_0x1bb6c0[_0x0fe6('0x3d')],{'$or':_[_0x0fe6('0x31')](_0x3151b0,function(_0x1aab12){if(_0x1aab12[_0x0fe6('0x2e')]!=='VIRTUAL'){var _0x13bb46={};_0x13bb46[_0x1aab12[_0x0fe6('0x28')]]={'$like':'%'+_0x167d17[_0x0fe6('0x32')][_0x0fe6('0x40')]+'%'};return _0x13bb46;}})});}_0x1bb6c0=_[_0x0fe6('0x3f')]({},_0x1bb6c0,_0x167d17[_0x0fe6('0x41')]);var _0x31aa98={'where':_0x1bb6c0['where']};return db[_0x0fe6('0x2b')][_0x0fe6('0x1d')](_0x31aa98)[_0x0fe6('0x23')](function(_0x562e91){_0x156593[_0x0fe6('0x1d')]=_0x562e91;if(_0x167d17[_0x0fe6('0x32')]['includeAll']){_0x1bb6c0[_0x0fe6('0x42')]=[{'all':!![]}];}return db[_0x0fe6('0x2b')][_0x0fe6('0x43')](_0x1bb6c0);})[_0x0fe6('0x23')](function(_0xaf4224){_0x156593[_0x0fe6('0x44')]=_0xaf4224;return _0x156593;})[_0x0fe6('0x23')](respondWithFilteredResult(_0x2ede48,_0x1bb6c0))[_0x0fe6('0x45')](handleError(_0x2ede48,null));};exports[_0x0fe6('0x46')]=function(_0x4533d0,_0x334be5){var _0x3242bb={'raw':!![],'where':{'id':_0x4533d0[_0x0fe6('0x47')]['id']}},_0x13ad07={};_0x13ad07[_0x0fe6('0x30')]=_[_0x0fe6('0x33')](db['FaxQueueReport'][_0x0fe6('0x2c')]);_0x13ad07[_0x0fe6('0x32')]=_[_0x0fe6('0x33')](_0x4533d0[_0x0fe6('0x32')]);_0x13ad07[_0x0fe6('0x34')]=_[_0x0fe6('0x35')](_0x13ad07['model'],_0x13ad07['query']);_0x3242bb[_0x0fe6('0x36')]=_[_0x0fe6('0x35')](_0x13ad07[_0x0fe6('0x30')],qs['fields'](_0x4533d0[_0x0fe6('0x32')][_0x0fe6('0x37')]));_0x3242bb['attributes']=_0x3242bb[_0x0fe6('0x36')]['length']?_0x3242bb['attributes']:_0x13ad07[_0x0fe6('0x30')];if(_0x4533d0[_0x0fe6('0x32')]['includeAll']){_0x3242bb[_0x0fe6('0x42')]=[{'all':!![]}];}_0x3242bb=_['merge']({},_0x3242bb,_0x4533d0['options']);return db[_0x0fe6('0x2b')]['find'](_0x3242bb)['then'](handleEntityNotFound(_0x334be5,null))[_0x0fe6('0x23')](respondWithResult(_0x334be5,null))['catch'](handleError(_0x334be5,null));};exports['create']=function(_0x4f7f7f,_0x1560a3){return db[_0x0fe6('0x2b')]['create'](_0x4f7f7f[_0x0fe6('0x48')],{})[_0x0fe6('0x23')](respondWithResult(_0x1560a3,0xc9))[_0x0fe6('0x45')](handleError(_0x1560a3,null));};exports[_0x0fe6('0x49')]=function(_0x36a692,_0x365504){if(_0x36a692[_0x0fe6('0x48')]['id']){delete _0x36a692[_0x0fe6('0x48')]['id'];}return db['FaxQueueReport'][_0x0fe6('0x4a')]({'where':{'id':_0x36a692['params']['id']}})[_0x0fe6('0x23')](handleEntityNotFound(_0x365504,null))['then'](saveUpdates(_0x36a692[_0x0fe6('0x48')],null))[_0x0fe6('0x23')](respondWithResult(_0x365504,null))[_0x0fe6('0x45')](handleError(_0x365504,null));};exports[_0x0fe6('0x24')]=function(_0x2e47a1,_0x167ff5){return db[_0x0fe6('0x2b')]['find']({'where':{'id':_0x2e47a1[_0x0fe6('0x47')]['id']}})[_0x0fe6('0x23')](handleEntityNotFound(_0x167ff5,null))[_0x0fe6('0x23')](removeEntity(_0x167ff5,null))[_0x0fe6('0x45')](handleError(_0x167ff5,null));};exports[_0x0fe6('0x4b')]=function(_0x119315,_0x2ed628){return db[_0x0fe6('0x2b')][_0x0fe6('0x4b')]()[_0x0fe6('0x23')](respondWithResult(_0x2ed628,null))['catch'](handleError(_0x2ed628,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 37a7d63..33dca45 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 _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0x36da4b,_0x295d13){var _0x17e26d=function(_0x2996a2){while(--_0x2996a2){_0x36da4b['push'](_0x36da4b['shift']());}};_0x17e26d(++_0x295d13);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x57645b,_0x25f73a){_0x57645b=_0x57645b-0x0;var _0xe82f00=_0x7fbe[_0x57645b];return _0xe82f00;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_fax_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport'];(function(_0x4f6336,_0x6714db){var _0x2e9cb4=function(_0x412429){while(--_0x412429){_0x4f6336['push'](_0x4f6336['shift']());}};_0x2e9cb4(++_0x6714db);}(_0x7a54,0x106));var _0x47a5=function(_0x3ea4fd,_0x841328){_0x3ea4fd=_0x3ea4fd-0x0;var _0x470d86=_0x7a54[_0x3ea4fd];return _0x470d86;};'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':'uniqueid','fields':[_0x47a5('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 a31bde5..939dfa4 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 _0x6295=['http','request','then','FaxQueueReport,\x20%s,\x20%s','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','create','body','options','raw','CreateFaxQueueReport','debug','stringify','update','attributes','limit','UpdateFaxQueueReport','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x38d736,_0x285075){var _0x4df813=function(_0x2ddf71){while(--_0x2ddf71){_0x38d736['push'](_0x38d736['shift']());}};_0x4df813(++_0x285075);}(_0x6295,0x1ba));var _0x5629=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x6295[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0x5629('0x0'));var util=require(_0x5629('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5629('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5629('0x3'))['db'];var utils=require(_0x5629('0x4'));var logger=require(_0x5629('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5629('0x6'));var client=jayson[_0x5629('0x7')][_0x5629('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39bba4,_0x116185,_0x4b0768){return new BPromise(function(_0x527b84,_0xc2bbf9){return client[_0x5629('0x9')](_0x39bba4,_0x4b0768)[_0x5629('0xa')](function(_0x1dd481){logger['info'](_0x5629('0xb'),_0x116185,'request\x20sent');logger['debug'](_0x5629('0xc'),_0x116185,_0x5629('0xd'),JSON['stringify'](_0x1dd481));if(_0x1dd481[_0x5629('0xe')]){if(_0x1dd481[_0x5629('0xe')][_0x5629('0xf')]===0x1f4){logger[_0x5629('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x116185,_0x1dd481[_0x5629('0xe')][_0x5629('0x10')]);return _0xc2bbf9(_0x1dd481['error']['message']);}logger[_0x5629('0xe')](_0x5629('0xb'),_0x116185,_0x1dd481['error'][_0x5629('0x10')]);return _0x527b84(_0x1dd481['error']['message']);}else{logger[_0x5629('0x11')](_0x5629('0xb'),_0x116185,_0x5629('0xd'));_0x527b84(_0x1dd481['result'][_0x5629('0x10')]);}})[_0x5629('0x12')](function(_0x1786db){logger[_0x5629('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x116185,_0x1786db);_0xc2bbf9(_0x1786db);});});}exports['CreateFaxQueueReport']=function(_0x7d9561){var _0x2d6072=this;return new Promise(function(_0x461a44,_0x54bd10){return db['FaxQueueReport'][_0x5629('0x13')](_0x7d9561[_0x5629('0x14')],{'raw':_0x7d9561[_0x5629('0x15')]?_0x7d9561['options'][_0x5629('0x16')]===undefined?!![]:![]:!![]})[_0x5629('0xa')](function(_0x20e4cd){logger[_0x5629('0x11')](_0x5629('0x17'),_0x7d9561);logger[_0x5629('0x18')](_0x5629('0x17'),_0x7d9561,JSON[_0x5629('0x19')](_0x20e4cd));_0x461a44(_0x20e4cd);})[_0x5629('0x12')](function(_0xcbf019){logger[_0x5629('0xe')](_0x5629('0x17'),_0xcbf019[_0x5629('0x10')],_0x7d9561);_0x54bd10(_0x2d6072[_0x5629('0xe')](0x1f4,_0xcbf019[_0x5629('0x10')]));});});};exports['UpdateFaxQueueReport']=function(_0x36c458){var _0x4618d0=this;return new Promise(function(_0x15088c,_0x1d4365){return db['FaxQueueReport'][_0x5629('0x1a')](_0x36c458[_0x5629('0x14')],{'raw':_0x36c458['options']?_0x36c458[_0x5629('0x15')][_0x5629('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36c458[_0x5629('0x15')]?_0x36c458[_0x5629('0x15')]['where']||null:null,'attributes':_0x36c458[_0x5629('0x15')]?_0x36c458[_0x5629('0x15')][_0x5629('0x1b')]||null:null,'limit':_0x36c458[_0x5629('0x15')]?_0x36c458[_0x5629('0x15')][_0x5629('0x1c')]||null:null})[_0x5629('0xa')](function(_0x29efdb){logger[_0x5629('0x11')](_0x5629('0x1d'),_0x36c458);logger['debug'](_0x5629('0x1d'),_0x36c458,JSON['stringify'](_0x29efdb));_0x15088c(_0x29efdb);})[_0x5629('0x12')](function(_0x474bff){logger['error'](_0x5629('0x1d'),_0x474bff['message'],_0x36c458);_0x1d4365(_0x4618d0[_0x5629('0xe')](0x1f4,_0x474bff[_0x5629('0x10')]));});});}; \ No newline at end of file +var _0xb68c=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','FaxQueueReport','create','options','CreateFaxQueueReport','update','body','raw','attributes','UpdateFaxQueueReport','lodash','util','bluebird','randomstring','ioredis'];(function(_0x101dce,_0x3b887c){var _0x5a92bb=function(_0x5bac04){while(--_0x5bac04){_0x101dce['push'](_0x101dce['shift']());}};_0x5a92bb(++_0x3b887c);}(_0xb68c,0x193));var _0xcb68=function(_0x560b05,_0x433a88){_0x560b05=_0x560b05-0x0;var _0x12ed69=_0xb68c[_0x560b05];return _0x12ed69;};'use strict';var _=require(_0xcb68('0x0'));var util=require(_0xcb68('0x1'));var moment=require('moment');var BPromise=require(_0xcb68('0x2'));var rs=require(_0xcb68('0x3'));var fs=require('fs');var Redis=require(_0xcb68('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb68('0x5'));var logger=require(_0xcb68('0x6'))(_0xcb68('0x7'));var config=require(_0xcb68('0x8'));var jayson=require(_0xcb68('0x9'));var client=jayson[_0xcb68('0xa')][_0xcb68('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f8138,_0x5d43a7,_0x11cf43){return new BPromise(function(_0x478e85,_0x57243a){return client[_0xcb68('0xc')](_0x4f8138,_0x11cf43)[_0xcb68('0xd')](function(_0x1ab348){logger[_0xcb68('0xe')](_0xcb68('0xf'),_0x5d43a7,_0xcb68('0x10'));logger[_0xcb68('0x11')](_0xcb68('0x12'),_0x5d43a7,_0xcb68('0x10'),JSON[_0xcb68('0x13')](_0x1ab348));if(_0x1ab348['error']){if(_0x1ab348['error'][_0xcb68('0x14')]===0x1f4){logger[_0xcb68('0x15')](_0xcb68('0xf'),_0x5d43a7,_0x1ab348[_0xcb68('0x15')][_0xcb68('0x16')]);return _0x57243a(_0x1ab348[_0xcb68('0x15')][_0xcb68('0x16')]);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x5d43a7,_0x1ab348[_0xcb68('0x15')]['message']);return _0x478e85(_0x1ab348[_0xcb68('0x15')][_0xcb68('0x16')]);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x5d43a7,'request\x20sent');_0x478e85(_0x1ab348[_0xcb68('0x17')][_0xcb68('0x16')]);}})[_0xcb68('0x18')](function(_0xb520f2){logger[_0xcb68('0x15')]('FaxQueueReport,\x20%s,\x20%s',_0x5d43a7,_0xb520f2);_0x57243a(_0xb520f2);});});}exports['CreateFaxQueueReport']=function(_0x5961e9){var _0x248ba0=this;return new Promise(function(_0x3da8f1,_0x35172a){return db[_0xcb68('0x19')][_0xcb68('0x1a')](_0x5961e9['body'],{'raw':_0x5961e9['options']?_0x5961e9[_0xcb68('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xcb68('0xd')](function(_0x25d30f){logger[_0xcb68('0xe')](_0xcb68('0x1c'),_0x5961e9);logger[_0xcb68('0x11')](_0xcb68('0x1c'),_0x5961e9,JSON[_0xcb68('0x13')](_0x25d30f));_0x3da8f1(_0x25d30f);})[_0xcb68('0x18')](function(_0x1b381e){logger[_0xcb68('0x15')](_0xcb68('0x1c'),_0x1b381e[_0xcb68('0x16')],_0x5961e9);_0x35172a(_0x248ba0[_0xcb68('0x15')](0x1f4,_0x1b381e['message']));});});};exports['UpdateFaxQueueReport']=function(_0x5e21a8){var _0x47f8fa=this;return new Promise(function(_0x2be715,_0x287e84){return db['FaxQueueReport'][_0xcb68('0x1d')](_0x5e21a8[_0xcb68('0x1e')],{'raw':_0x5e21a8[_0xcb68('0x1b')]?_0x5e21a8['options'][_0xcb68('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e21a8['options']?_0x5e21a8[_0xcb68('0x1b')]['where']||null:null,'attributes':_0x5e21a8[_0xcb68('0x1b')]?_0x5e21a8[_0xcb68('0x1b')][_0xcb68('0x20')]||null:null,'limit':_0x5e21a8['options']?_0x5e21a8['options']['limit']||null:null})[_0xcb68('0xd')](function(_0x1fe351){logger['info'](_0xcb68('0x21'),_0x5e21a8);logger['debug'](_0xcb68('0x21'),_0x5e21a8,JSON[_0xcb68('0x13')](_0x1fe351));_0x2be715(_0x1fe351);})[_0xcb68('0x18')](function(_0x68ccc8){logger['error'](_0xcb68('0x21'),_0x68ccc8[_0xcb68('0x16')],_0x5e21a8);_0x287e84(_0x47f8fa['error'](0x1f4,_0x68ccc8[_0xcb68('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 1c5c235..f651fc7 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 _0x3fb9=['exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete'];(function(_0x3c7b02,_0xee1db8){var _0x3e37d1=function(_0x35fc5e){while(--_0x35fc5e){_0x3c7b02['push'](_0x3c7b02['shift']());}};_0x3e37d1(++_0xee1db8);}(_0x3fb9,0xab));var _0x93fb=function(_0x3fc9c9,_0x341a62){_0x3fc9c9=_0x3fc9c9-0x0;var _0x3e1df2=_0x3fb9[_0x3fc9c9];return _0x3e1df2;};'use strict';var multer=require(_0x93fb('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x93fb('0x1'));var router=express[_0x93fb('0x2')]();var fs_extra=require(_0x93fb('0x3'));var auth=require(_0x93fb('0x4'));var interaction=require(_0x93fb('0x5'));var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router[_0x93fb('0x6')]('/',auth[_0x93fb('0x7')](),controller['index']);router[_0x93fb('0x6')](_0x93fb('0x8'),auth['isAuthenticated'](),controller[_0x93fb('0x9')]);router[_0x93fb('0x6')](_0x93fb('0xa'),auth[_0x93fb('0x7')](),controller[_0x93fb('0xb')]);router['post']('/',auth[_0x93fb('0x7')](),controller[_0x93fb('0xc')]);router[_0x93fb('0xd')]('/:id',auth[_0x93fb('0x7')](),controller[_0x93fb('0xe')]);router[_0x93fb('0xf')]('/:id',auth[_0x93fb('0x7')](),controller['destroy']);module[_0x93fb('0x10')]=router; \ No newline at end of file +var _0xb713=['./faxQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x29ce14,_0x334166){var _0x48f289=function(_0x288d11){while(--_0x288d11){_0x29ce14['push'](_0x29ce14['shift']());}};_0x48f289(++_0x334166);}(_0xb713,0x15e));var _0x3b71=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xb713[_0x4792c8];return _0x35edb1;};'use strict';var multer=require(_0x3b71('0x0'));var util=require(_0x3b71('0x1'));var path=require(_0x3b71('0x2'));var timeout=require(_0x3b71('0x3'));var express=require(_0x3b71('0x4'));var router=express[_0x3b71('0x5')]();var fs_extra=require(_0x3b71('0x6'));var auth=require(_0x3b71('0x7'));var interaction=require(_0x3b71('0x8'));var config=require(_0x3b71('0x9'));var controller=require(_0x3b71('0xa'));router[_0x3b71('0xb')]('/',auth['isAuthenticated'](),controller[_0x3b71('0xc')]);router[_0x3b71('0xb')](_0x3b71('0xd'),auth[_0x3b71('0xe')](),controller[_0x3b71('0xf')]);router['get'](_0x3b71('0x10'),auth[_0x3b71('0xe')](),controller[_0x3b71('0x11')]);router[_0x3b71('0x12')]('/',auth[_0x3b71('0xe')](),controller[_0x3b71('0x13')]);router['put'](_0x3b71('0x10'),auth[_0x3b71('0xe')](),controller[_0x3b71('0x14')]);router[_0x3b71('0x15')]('/:id',auth[_0x3b71('0xe')](),controller[_0x3b71('0x16')]);module[_0x3b71('0x17')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 13f2b20..f16df26 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 _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0xd76d30,_0x17aefb){var _0x41fa86=function(_0x4bc76f){while(--_0x4bc76f){_0xd76d30['push'](_0xd76d30['shift']());}};_0x41fa86(++_0x17aefb);}(_0xe706,0xa3));var _0x6e70=function(_0x160cbc,_0x3025a6){_0x160cbc=_0x160cbc-0x0;var _0x4ac8c6=_0xe706[_0x160cbc];return _0x4ac8c6;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0xe6258c,_0x456ec2){var _0x44d730=function(_0x34308f){while(--_0x34308f){_0xe6258c['push'](_0xe6258c['shift']());}};_0x44d730(++_0x456ec2);}(_0xedd9,0xfc));var _0x9edd=function(_0x4844ff,_0x53a2fe){_0x4844ff=_0x4844ff-0x0;var _0x9257f8=_0xedd9[_0x4844ff];return _0x9257f8;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index e39c139..b0a6fff 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 _0x5eaf=['describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','name','index','map','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','FaxTransferReport','include','findAll','rows','catch','show','params','rawAttributes','find','create','body'];(function(_0x5036dc,_0x4b1e45){var _0x1b6306=function(_0x5bec81){while(--_0x5bec81){_0x5036dc['push'](_0x5036dc['shift']());}};_0x1b6306(++_0x4b1e45);}(_0x5eaf,0x16e));var _0xf5ea=function(_0x1ab620,_0x494947){_0x1ab620=_0x1ab620-0x0;var _0x12561d=_0x5eaf[_0x1ab620];return _0x12561d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf5ea('0x0'));var zipdir=require(_0xf5ea('0x1'));var jsonpatch=require(_0xf5ea('0x2'));var rp=require(_0xf5ea('0x3'));var moment=require(_0xf5ea('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf5ea('0x5'));var path=require(_0xf5ea('0x6'));var sox=require(_0xf5ea('0x7'));var csv=require(_0xf5ea('0x8'));var ejs=require(_0xf5ea('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf5ea('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf5ea('0xb'));var deskjs=require(_0xf5ea('0xc'));var toCsv=require(_0xf5ea('0x8'));var querystring=require(_0xf5ea('0xd'));var Papa=require(_0xf5ea('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf5ea('0xf'));var as=require(_0xf5ea('0x10'));var hardwareService=require(_0xf5ea('0x11'));var logger=require(_0xf5ea('0x12'))(_0xf5ea('0x13'));var utils=require(_0xf5ea('0x14'));var config=require(_0xf5ea('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf5ea('0x16'))['db'];function respondWithStatusCode(_0x49ec03,_0x4656a9){_0x4656a9=_0x4656a9||0xcc;return function(_0x19eaa2){if(_0x19eaa2){return _0x49ec03['sendStatus'](_0x4656a9);}return _0x49ec03['status'](_0x4656a9)['end']();};}function respondWithResult(_0x323bf7,_0x188842){_0x188842=_0x188842||0xc8;return function(_0x1cba95){if(_0x1cba95){return _0x323bf7['status'](_0x188842)[_0xf5ea('0x17')](_0x1cba95);}};}function respondWithFilteredResult(_0x8b1977,_0x4e037d){return function(_0x587069){if(_0x587069){var _0x345611=typeof _0x4e037d[_0xf5ea('0x18')]===_0xf5ea('0x19')&&typeof _0x4e037d[_0xf5ea('0x1a')]==='undefined';var _0x3259dd=_0x587069[_0xf5ea('0x1b')];var _0x1d36db=_0x345611?0x0:_0x4e037d[_0xf5ea('0x18')];var _0x17e2bb=_0x345611?_0x587069[_0xf5ea('0x1b')]:_0x4e037d[_0xf5ea('0x18')]+_0x4e037d[_0xf5ea('0x1a')];var _0x32ba2a;if(_0x17e2bb>=_0x3259dd){_0x17e2bb=_0x3259dd;_0x32ba2a=0xc8;}else{_0x32ba2a=0xce;}_0x8b1977[_0xf5ea('0x1c')](_0x32ba2a);return _0x8b1977[_0xf5ea('0x1d')](_0xf5ea('0x1e'),_0x1d36db+'-'+_0x17e2bb+'/'+_0x3259dd)[_0xf5ea('0x17')](_0x587069);}return null;};}function patchUpdates(_0x45e200){return function(_0x583ed2){try{jsonpatch['apply'](_0x583ed2,_0x45e200,!![]);}catch(_0x3e1d44){return BPromise[_0xf5ea('0x1f')](_0x3e1d44);}return _0x583ed2[_0xf5ea('0x20')]();};}function saveUpdates(_0x5d1ee5,_0x5e5417){return function(_0x1cfdec){if(_0x1cfdec){return _0x1cfdec[_0xf5ea('0x21')](_0x5d1ee5)['then'](function(_0x2553d9){return _0x2553d9;});}return null;};}function removeEntity(_0x2f8e1b,_0x759916){return function(_0x1e9060){if(_0x1e9060){return _0x1e9060[_0xf5ea('0x22')]()[_0xf5ea('0x23')](function(){_0x2f8e1b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f22ce,_0x51740d){return function(_0xb5cc49){if(!_0xb5cc49){_0x2f22ce[_0xf5ea('0x24')](0x194);}return _0xb5cc49;};}function handleError(_0x3a5a1a,_0x33d20b){_0x33d20b=_0x33d20b||0x1f4;return function(_0x4e1a12){logger[_0xf5ea('0x25')](_0x4e1a12['stack']);if(_0x4e1a12[_0xf5ea('0x26')]){delete _0x4e1a12[_0xf5ea('0x26')];}_0x3a5a1a[_0xf5ea('0x1c')](_0x33d20b)['send'](_0x4e1a12);};}exports[_0xf5ea('0x27')]=function(_0x54a119,_0x337f7c){var _0x2bdad7={},_0x4a1496={},_0x1d30b9={'count':0x0,'rows':[]};var _0x5d7f3c=_[_0xf5ea('0x28')](db['FaxTransferReport']['rawAttributes'],function(_0x128db9){return{'name':_0x128db9[_0xf5ea('0x29')],'type':_0x128db9['type'][_0xf5ea('0x2a')]};});_0x4a1496[_0xf5ea('0x2b')]=_['map'](_0x5d7f3c,_0xf5ea('0x26'));_0x4a1496[_0xf5ea('0x2c')]=_[_0xf5ea('0x2d')](_0x54a119[_0xf5ea('0x2c')]);_0x4a1496[_0xf5ea('0x2e')]=_[_0xf5ea('0x2f')](_0x4a1496['model'],_0x4a1496[_0xf5ea('0x2c')]);_0x2bdad7['attributes']=_[_0xf5ea('0x2f')](_0x4a1496[_0xf5ea('0x2b')],qs[_0xf5ea('0x30')](_0x54a119[_0xf5ea('0x2c')][_0xf5ea('0x30')]));_0x2bdad7[_0xf5ea('0x31')]=_0x2bdad7[_0xf5ea('0x31')][_0xf5ea('0x32')]?_0x2bdad7[_0xf5ea('0x31')]:_0x4a1496[_0xf5ea('0x2b')];if(!_0x54a119[_0xf5ea('0x2c')][_0xf5ea('0x33')](_0xf5ea('0x34'))){_0x2bdad7[_0xf5ea('0x1a')]=qs[_0xf5ea('0x1a')](_0x54a119[_0xf5ea('0x2c')][_0xf5ea('0x1a')]);_0x2bdad7['offset']=qs[_0xf5ea('0x18')](_0x54a119[_0xf5ea('0x2c')][_0xf5ea('0x18')]);}_0x2bdad7[_0xf5ea('0x35')]=qs[_0xf5ea('0x36')](_0x54a119[_0xf5ea('0x2c')][_0xf5ea('0x36')]);_0x2bdad7['where']=qs[_0xf5ea('0x2e')](_['pick'](_0x54a119[_0xf5ea('0x2c')],_0x4a1496['filters']),_0x5d7f3c);if(_0x54a119[_0xf5ea('0x2c')][_0xf5ea('0x37')]){_0x2bdad7[_0xf5ea('0x38')]=_[_0xf5ea('0x39')](_0x2bdad7[_0xf5ea('0x38')],{'$or':_[_0xf5ea('0x28')](_0x5d7f3c,function(_0x403ecb){if(_0x403ecb[_0xf5ea('0x3a')]!==_0xf5ea('0x3b')){var _0x91d924={};_0x91d924[_0x403ecb['name']]={'$like':'%'+_0x54a119[_0xf5ea('0x2c')][_0xf5ea('0x37')]+'%'};return _0x91d924;}})});}_0x2bdad7=_['merge']({},_0x2bdad7,_0x54a119[_0xf5ea('0x3c')]);var _0x4cf340={'where':_0x2bdad7[_0xf5ea('0x38')]};return db[_0xf5ea('0x3d')][_0xf5ea('0x1b')](_0x4cf340)[_0xf5ea('0x23')](function(_0x1f9697){_0x1d30b9['count']=_0x1f9697;if(_0x54a119[_0xf5ea('0x2c')]['includeAll']){_0x2bdad7[_0xf5ea('0x3e')]=[{'all':!![]}];}return db[_0xf5ea('0x3d')][_0xf5ea('0x3f')](_0x2bdad7);})[_0xf5ea('0x23')](function(_0x5d6220){_0x1d30b9[_0xf5ea('0x40')]=_0x5d6220;return _0x1d30b9;})['then'](respondWithFilteredResult(_0x337f7c,_0x2bdad7))[_0xf5ea('0x41')](handleError(_0x337f7c,null));};exports[_0xf5ea('0x42')]=function(_0x1b414b,_0x408102){var _0x1f68b1={'raw':!![],'where':{'id':_0x1b414b[_0xf5ea('0x43')]['id']}},_0x55e8bd={};_0x55e8bd[_0xf5ea('0x2b')]=_[_0xf5ea('0x2d')](db[_0xf5ea('0x3d')][_0xf5ea('0x44')]);_0x55e8bd[_0xf5ea('0x2c')]=_[_0xf5ea('0x2d')](_0x1b414b[_0xf5ea('0x2c')]);_0x55e8bd[_0xf5ea('0x2e')]=_[_0xf5ea('0x2f')](_0x55e8bd['model'],_0x55e8bd[_0xf5ea('0x2c')]);_0x1f68b1['attributes']=_['intersection'](_0x55e8bd[_0xf5ea('0x2b')],qs['fields'](_0x1b414b['query'][_0xf5ea('0x30')]));_0x1f68b1['attributes']=_0x1f68b1[_0xf5ea('0x31')][_0xf5ea('0x32')]?_0x1f68b1['attributes']:_0x55e8bd[_0xf5ea('0x2b')];if(_0x1b414b[_0xf5ea('0x2c')]['includeAll']){_0x1f68b1[_0xf5ea('0x3e')]=[{'all':!![]}];}_0x1f68b1=_[_0xf5ea('0x39')]({},_0x1f68b1,_0x1b414b['options']);return db[_0xf5ea('0x3d')][_0xf5ea('0x45')](_0x1f68b1)['then'](handleEntityNotFound(_0x408102,null))[_0xf5ea('0x23')](respondWithResult(_0x408102,null))[_0xf5ea('0x41')](handleError(_0x408102,null));};exports['create']=function(_0x52fb23,_0x21f8c0){return db['FaxTransferReport'][_0xf5ea('0x46')](_0x52fb23[_0xf5ea('0x47')],{})['then'](respondWithResult(_0x21f8c0,0xc9))[_0xf5ea('0x41')](handleError(_0x21f8c0,null));};exports['update']=function(_0xb76ae4,_0x5f12a0){if(_0xb76ae4['body']['id']){delete _0xb76ae4['body']['id'];}return db['FaxTransferReport'][_0xf5ea('0x45')]({'where':{'id':_0xb76ae4[_0xf5ea('0x43')]['id']}})[_0xf5ea('0x23')](handleEntityNotFound(_0x5f12a0,null))[_0xf5ea('0x23')](saveUpdates(_0xb76ae4[_0xf5ea('0x47')],null))['then'](respondWithResult(_0x5f12a0,null))[_0xf5ea('0x41')](handleError(_0x5f12a0,null));};exports['destroy']=function(_0xe3bc8c,_0x420c95){return db[_0xf5ea('0x3d')]['find']({'where':{'id':_0xe3bc8c[_0xf5ea('0x43')]['id']}})[_0xf5ea('0x23')](handleEntityNotFound(_0x420c95,null))['then'](removeEntity(_0x420c95,null))[_0xf5ea('0x41')](handleError(_0x420c95,null));};exports[_0xf5ea('0x48')]=function(_0x503105,_0x56bfc7){return db[_0xf5ea('0x3d')]['describe']()[_0xf5ea('0x23')](respondWithResult(_0x56bfc7,null))[_0xf5ea('0x41')](handleError(_0x56bfc7,null));}; \ No newline at end of file +var _0xd4f3=['../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','save','update','then','error','stack','name','send','map','FaxTransferReport','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys','find','create','body','destroy','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x7e7eca,_0x37b2ec){var _0x106744=function(_0x2c90d4){while(--_0x2c90d4){_0x7e7eca['push'](_0x7e7eca['shift']());}};_0x106744(++_0x37b2ec);}(_0xd4f3,0x1b0));var _0x3d4f=function(_0x5cef06,_0xb28f8b){_0x5cef06=_0x5cef06-0x0;var _0x5b71d9=_0xd4f3[_0x5cef06];return _0x5b71d9;};'use strict';var emlformat=require(_0x3d4f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3d4f('0x1'));var rp=require('request-promise');var moment=require(_0x3d4f('0x2'));var BPromise=require(_0x3d4f('0x3'));var Mustache=require(_0x3d4f('0x4'));var util=require(_0x3d4f('0x5'));var path=require(_0x3d4f('0x6'));var sox=require(_0x3d4f('0x7'));var csv=require('to-csv');var ejs=require(_0x3d4f('0x8'));var fs=require('fs');var fs_extra=require(_0x3d4f('0x9'));var _=require('lodash');var squel=require(_0x3d4f('0xa'));var crypto=require(_0x3d4f('0xb'));var jsforce=require(_0x3d4f('0xc'));var deskjs=require(_0x3d4f('0xd'));var toCsv=require(_0x3d4f('0xe'));var querystring=require('querystring');var Papa=require(_0x3d4f('0xf'));var Redis=require(_0x3d4f('0x10'));var authService=require(_0x3d4f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3d4f('0x12'));var hardwareService=require(_0x3d4f('0x13'));var logger=require(_0x3d4f('0x14'))(_0x3d4f('0x15'));var utils=require(_0x3d4f('0x16'));var config=require(_0x3d4f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3d4f('0x18'))['db'];function respondWithStatusCode(_0x3e6bc3,_0x3005ba){_0x3005ba=_0x3005ba||0xcc;return function(_0x4b3e34){if(_0x4b3e34){return _0x3e6bc3[_0x3d4f('0x19')](_0x3005ba);}return _0x3e6bc3[_0x3d4f('0x1a')](_0x3005ba)[_0x3d4f('0x1b')]();};}function respondWithResult(_0x245f1b,_0x1bba69){_0x1bba69=_0x1bba69||0xc8;return function(_0x4763d7){if(_0x4763d7){return _0x245f1b['status'](_0x1bba69)['json'](_0x4763d7);}};}function respondWithFilteredResult(_0x20454b,_0x3c9028){return function(_0x410af7){if(_0x410af7){var _0x6e9b91=typeof _0x3c9028['offset']===_0x3d4f('0x1c')&&typeof _0x3c9028[_0x3d4f('0x1d')]==='undefined';var _0x29254a=_0x410af7[_0x3d4f('0x1e')];var _0x513c34=_0x6e9b91?0x0:_0x3c9028[_0x3d4f('0x1f')];var _0x284b6d=_0x6e9b91?_0x410af7[_0x3d4f('0x1e')]:_0x3c9028[_0x3d4f('0x1f')]+_0x3c9028['limit'];var _0x4033a8;if(_0x284b6d>=_0x29254a){_0x284b6d=_0x29254a;_0x4033a8=0xc8;}else{_0x4033a8=0xce;}_0x20454b[_0x3d4f('0x1a')](_0x4033a8);return _0x20454b[_0x3d4f('0x20')](_0x3d4f('0x21'),_0x513c34+'-'+_0x284b6d+'/'+_0x29254a)[_0x3d4f('0x22')](_0x410af7);}return null;};}function patchUpdates(_0x344308){return function(_0x3d6e31){try{jsonpatch['apply'](_0x3d6e31,_0x344308,!![]);}catch(_0x21ab06){return BPromise['reject'](_0x21ab06);}return _0x3d6e31[_0x3d4f('0x23')]();};}function saveUpdates(_0xf1c8e6,_0x3fdd9a){return function(_0x163122){if(_0x163122){return _0x163122[_0x3d4f('0x24')](_0xf1c8e6)[_0x3d4f('0x25')](function(_0x3e78cb){return _0x3e78cb;});}return null;};}function removeEntity(_0x252bbc,_0x404140){return function(_0x47f138){if(_0x47f138){return _0x47f138['destroy']()[_0x3d4f('0x25')](function(){_0x252bbc[_0x3d4f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29d7c3,_0x37f1ea){return function(_0x232a3c){if(!_0x232a3c){_0x29d7c3[_0x3d4f('0x19')](0x194);}return _0x232a3c;};}function handleError(_0x2564ad,_0x5c430e){_0x5c430e=_0x5c430e||0x1f4;return function(_0x12865a){logger[_0x3d4f('0x26')](_0x12865a[_0x3d4f('0x27')]);if(_0x12865a[_0x3d4f('0x28')]){delete _0x12865a['name'];}_0x2564ad[_0x3d4f('0x1a')](_0x5c430e)[_0x3d4f('0x29')](_0x12865a);};}exports['index']=function(_0x5695ca,_0x207b58){var _0x3eff19={},_0xc7cf77={},_0x3edb3d={'count':0x0,'rows':[]};var _0x1926fc=_[_0x3d4f('0x2a')](db[_0x3d4f('0x2b')][_0x3d4f('0x2c')],function(_0x467064){return{'name':_0x467064[_0x3d4f('0x2d')],'type':_0x467064['type'][_0x3d4f('0x2e')]};});_0xc7cf77['model']=_[_0x3d4f('0x2a')](_0x1926fc,'name');_0xc7cf77[_0x3d4f('0x2f')]=_['keys'](_0x5695ca[_0x3d4f('0x2f')]);_0xc7cf77[_0x3d4f('0x30')]=_[_0x3d4f('0x31')](_0xc7cf77[_0x3d4f('0x32')],_0xc7cf77['query']);_0x3eff19['attributes']=_[_0x3d4f('0x31')](_0xc7cf77['model'],qs[_0x3d4f('0x33')](_0x5695ca[_0x3d4f('0x2f')][_0x3d4f('0x33')]));_0x3eff19[_0x3d4f('0x34')]=_0x3eff19[_0x3d4f('0x34')][_0x3d4f('0x35')]?_0x3eff19[_0x3d4f('0x34')]:_0xc7cf77[_0x3d4f('0x32')];if(!_0x5695ca['query']['hasOwnProperty'](_0x3d4f('0x36'))){_0x3eff19[_0x3d4f('0x1d')]=qs[_0x3d4f('0x1d')](_0x5695ca[_0x3d4f('0x2f')][_0x3d4f('0x1d')]);_0x3eff19[_0x3d4f('0x1f')]=qs[_0x3d4f('0x1f')](_0x5695ca[_0x3d4f('0x2f')][_0x3d4f('0x1f')]);}_0x3eff19[_0x3d4f('0x37')]=qs[_0x3d4f('0x38')](_0x5695ca[_0x3d4f('0x2f')][_0x3d4f('0x38')]);_0x3eff19['where']=qs[_0x3d4f('0x30')](_[_0x3d4f('0x39')](_0x5695ca[_0x3d4f('0x2f')],_0xc7cf77[_0x3d4f('0x30')]),_0x1926fc);if(_0x5695ca[_0x3d4f('0x2f')]['filter']){_0x3eff19[_0x3d4f('0x3a')]=_[_0x3d4f('0x3b')](_0x3eff19[_0x3d4f('0x3a')],{'$or':_[_0x3d4f('0x2a')](_0x1926fc,function(_0x3ee229){if(_0x3ee229[_0x3d4f('0x3c')]!==_0x3d4f('0x3d')){var _0x14b531={};_0x14b531[_0x3ee229[_0x3d4f('0x28')]]={'$like':'%'+_0x5695ca[_0x3d4f('0x2f')][_0x3d4f('0x3e')]+'%'};return _0x14b531;}})});}_0x3eff19=_['merge']({},_0x3eff19,_0x5695ca[_0x3d4f('0x3f')]);var _0x553a0b={'where':_0x3eff19['where']};return db[_0x3d4f('0x2b')][_0x3d4f('0x1e')](_0x553a0b)[_0x3d4f('0x25')](function(_0x153914){_0x3edb3d[_0x3d4f('0x1e')]=_0x153914;if(_0x5695ca['query'][_0x3d4f('0x40')]){_0x3eff19[_0x3d4f('0x41')]=[{'all':!![]}];}return db[_0x3d4f('0x2b')]['findAll'](_0x3eff19);})[_0x3d4f('0x25')](function(_0x3b0dc3){_0x3edb3d[_0x3d4f('0x42')]=_0x3b0dc3;return _0x3edb3d;})[_0x3d4f('0x25')](respondWithFilteredResult(_0x207b58,_0x3eff19))[_0x3d4f('0x43')](handleError(_0x207b58,null));};exports[_0x3d4f('0x44')]=function(_0x23c6f6,_0x3d48f6){var _0x2256a1={'raw':!![],'where':{'id':_0x23c6f6[_0x3d4f('0x45')]['id']}},_0x3f162e={};_0x3f162e[_0x3d4f('0x32')]=_[_0x3d4f('0x46')](db[_0x3d4f('0x2b')][_0x3d4f('0x2c')]);_0x3f162e[_0x3d4f('0x2f')]=_[_0x3d4f('0x46')](_0x23c6f6[_0x3d4f('0x2f')]);_0x3f162e[_0x3d4f('0x30')]=_[_0x3d4f('0x31')](_0x3f162e[_0x3d4f('0x32')],_0x3f162e['query']);_0x2256a1[_0x3d4f('0x34')]=_[_0x3d4f('0x31')](_0x3f162e['model'],qs[_0x3d4f('0x33')](_0x23c6f6[_0x3d4f('0x2f')][_0x3d4f('0x33')]));_0x2256a1[_0x3d4f('0x34')]=_0x2256a1[_0x3d4f('0x34')][_0x3d4f('0x35')]?_0x2256a1[_0x3d4f('0x34')]:_0x3f162e[_0x3d4f('0x32')];if(_0x23c6f6[_0x3d4f('0x2f')][_0x3d4f('0x40')]){_0x2256a1[_0x3d4f('0x41')]=[{'all':!![]}];}_0x2256a1=_[_0x3d4f('0x3b')]({},_0x2256a1,_0x23c6f6['options']);return db['FaxTransferReport'][_0x3d4f('0x47')](_0x2256a1)['then'](handleEntityNotFound(_0x3d48f6,null))['then'](respondWithResult(_0x3d48f6,null))[_0x3d4f('0x43')](handleError(_0x3d48f6,null));};exports[_0x3d4f('0x48')]=function(_0x568cfb,_0x266946){return db['FaxTransferReport'][_0x3d4f('0x48')](_0x568cfb[_0x3d4f('0x49')],{})[_0x3d4f('0x25')](respondWithResult(_0x266946,0xc9))[_0x3d4f('0x43')](handleError(_0x266946,null));};exports[_0x3d4f('0x24')]=function(_0x2a4256,_0x441542){if(_0x2a4256[_0x3d4f('0x49')]['id']){delete _0x2a4256[_0x3d4f('0x49')]['id'];}return db[_0x3d4f('0x2b')][_0x3d4f('0x47')]({'where':{'id':_0x2a4256[_0x3d4f('0x45')]['id']}})['then'](handleEntityNotFound(_0x441542,null))[_0x3d4f('0x25')](saveUpdates(_0x2a4256[_0x3d4f('0x49')],null))[_0x3d4f('0x25')](respondWithResult(_0x441542,null))[_0x3d4f('0x43')](handleError(_0x441542,null));};exports[_0x3d4f('0x4a')]=function(_0x3612e6,_0x4cf505){return db[_0x3d4f('0x2b')][_0x3d4f('0x47')]({'where':{'id':_0x3612e6[_0x3d4f('0x45')]['id']}})[_0x3d4f('0x25')](handleEntityNotFound(_0x4cf505,null))[_0x3d4f('0x25')](removeEntity(_0x4cf505,null))[_0x3d4f('0x43')](handleError(_0x4cf505,null));};exports[_0x3d4f('0x4b')]=function(_0x254c3f,_0x4d2429){return db['FaxTransferReport'][_0x3d4f('0x4b')]()[_0x3d4f('0x25')](respondWithResult(_0x4d2429,null))['catch'](handleError(_0x4d2429,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 16466b3..c18589e 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 _0xd914=['rimraf','./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0xd914,0x17f));var _0x4d91=function(_0x3f2228,_0x3b27d5){_0x3f2228=_0x3f2228-0x0;var _0x285ae4=_0xd914[_0x3f2228];return _0x285ae4;};'use strict';var _=require(_0x4d91('0x0'));var util=require(_0x4d91('0x1'));var logger=require('../../config/logger')(_0x4d91('0x2'));var moment=require(_0x4d91('0x3'));var BPromise=require(_0x4d91('0x4'));var rp=require(_0x4d91('0x5'));var fs=require('fs');var path=require(_0x4d91('0x6'));var rimraf=require(_0x4d91('0x7'));var config=require('../../config/environment');var attributes=require(_0x4d91('0x8'));module['exports']=function(_0x3ab6f8,_0x42d7ae){return _0x3ab6f8[_0x4d91('0x9')](_0x4d91('0xa'),attributes,{'tableName':_0x4d91('0xb'),'paranoid':![],'indexes':[{'name':_0x4d91('0xc'),'fields':[_0x4d91('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfabd=['rimraf','./faxTransferReport.attributes','exports','define','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5d2c6f,_0x1e6874){var _0x34c02c=function(_0x11d1fb){while(--_0x11d1fb){_0x5d2c6f['push'](_0x5d2c6f['shift']());}};_0x34c02c(++_0x1e6874);}(_0xfabd,0x89));var _0xdfab=function(_0x216d17,_0x47f2c6){_0x216d17=_0x216d17-0x0;var _0x2f6b72=_0xfabd[_0x216d17];return _0x2f6b72;};'use strict';var _=require('lodash');var util=require(_0xdfab('0x0'));var logger=require(_0xdfab('0x1'))(_0xdfab('0x2'));var moment=require(_0xdfab('0x3'));var BPromise=require(_0xdfab('0x4'));var rp=require(_0xdfab('0x5'));var fs=require('fs');var path=require(_0xdfab('0x6'));var rimraf=require(_0xdfab('0x7'));var config=require('../../config/environment');var attributes=require(_0xdfab('0x8'));module[_0xdfab('0x9')]=function(_0xae9777,_0x2343c9){return _0xae9777[_0xdfab('0xa')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xdfab('0xb'),'fields':[_0xdfab('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 60c936f..be6e48c 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 _0x74de=['../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FaxTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis'];(function(_0xd6305a,_0x2df988){var _0x373543=function(_0x539509){while(--_0x539509){_0xd6305a['push'](_0xd6305a['shift']());}};_0x373543(++_0x2df988);}(_0x74de,0xe3));var _0xe74d=function(_0x376981,_0x4c338c){_0x376981=_0x376981-0x0;var _0x4ab265=_0x74de[_0x376981];return _0x4ab265;};'use strict';var _=require(_0xe74d('0x0'));var util=require(_0xe74d('0x1'));var moment=require('moment');var BPromise=require(_0xe74d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe74d('0x3'));var db=require(_0xe74d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe74d('0x5'))(_0xe74d('0x6'));var config=require(_0xe74d('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe74d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x388303,_0x38a0b5,_0x1cc0f2){return new BPromise(function(_0x386154,_0x43d65b){return client[_0xe74d('0x9')](_0x388303,_0x1cc0f2)[_0xe74d('0xa')](function(_0x5cc8a9){logger[_0xe74d('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x38a0b5,'request\x20sent');logger[_0xe74d('0xc')](_0xe74d('0xd'),_0x38a0b5,_0xe74d('0xe'),JSON['stringify'](_0x5cc8a9));if(_0x5cc8a9[_0xe74d('0xf')]){if(_0x5cc8a9[_0xe74d('0xf')][_0xe74d('0x10')]===0x1f4){logger['error'](_0xe74d('0x11'),_0x38a0b5,_0x5cc8a9[_0xe74d('0xf')][_0xe74d('0x12')]);return _0x43d65b(_0x5cc8a9[_0xe74d('0xf')][_0xe74d('0x12')]);}logger[_0xe74d('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x38a0b5,_0x5cc8a9[_0xe74d('0xf')][_0xe74d('0x12')]);return _0x386154(_0x5cc8a9[_0xe74d('0xf')][_0xe74d('0x12')]);}else{logger[_0xe74d('0xb')](_0xe74d('0x11'),_0x38a0b5,_0xe74d('0xe'));_0x386154(_0x5cc8a9[_0xe74d('0x13')][_0xe74d('0x12')]);}})[_0xe74d('0x14')](function(_0x1b1ff4){logger[_0xe74d('0xf')](_0xe74d('0x11'),_0x38a0b5,_0x1b1ff4);_0x43d65b(_0x1b1ff4);});});} \ No newline at end of file +var _0x6f80=['code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','info','FaxTransferReport,\x20%s,\x20%s','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x33975c,_0x50d085){var _0x1c15ab=function(_0x54e8bc){while(--_0x54e8bc){_0x33975c['push'](_0x33975c['shift']());}};_0x1c15ab(++_0x50d085);}(_0x6f80,0xf4));var _0x06f8=function(_0x276679,_0xe3ecf5){_0x276679=_0x276679-0x0;var _0x3d4f9e=_0x6f80[_0x276679];return _0x3d4f9e;};'use strict';var _=require(_0x06f8('0x0'));var util=require(_0x06f8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x06f8('0x2'));var fs=require('fs');var Redis=require(_0x06f8('0x3'));var db=require(_0x06f8('0x4'))['db'];var utils=require(_0x06f8('0x5'));var logger=require(_0x06f8('0x6'))(_0x06f8('0x7'));var config=require(_0x06f8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x06f8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d4474,_0x240d35,_0x41aa4a){return new BPromise(function(_0x1a3063,_0x2cc04b){return client['request'](_0x3d4474,_0x41aa4a)['then'](function(_0x52ec98){logger[_0x06f8('0xa')](_0x06f8('0xb'),_0x240d35,'request\x20sent');logger['debug'](_0x06f8('0xc'),_0x240d35,_0x06f8('0xd'),JSON[_0x06f8('0xe')](_0x52ec98));if(_0x52ec98['error']){if(_0x52ec98[_0x06f8('0xf')][_0x06f8('0x10')]===0x1f4){logger['error'](_0x06f8('0xb'),_0x240d35,_0x52ec98[_0x06f8('0xf')][_0x06f8('0x11')]);return _0x2cc04b(_0x52ec98['error']['message']);}logger['error'](_0x06f8('0xb'),_0x240d35,_0x52ec98[_0x06f8('0xf')]['message']);return _0x1a3063(_0x52ec98[_0x06f8('0xf')][_0x06f8('0x11')]);}else{logger[_0x06f8('0xa')]('FaxTransferReport,\x20%s,\x20%s',_0x240d35,_0x06f8('0xd'));_0x1a3063(_0x52ec98[_0x06f8('0x12')]['message']);}})[_0x06f8('0x13')](function(_0x3303a4){logger['error'](_0x06f8('0xb'),_0x240d35,_0x3303a4);_0x2cc04b(_0x3303a4);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index c7c407c..066d2b0 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 _0xea60=['../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5b38a1,_0x4a1d01){var _0x770bc0=function(_0x5cbfe1){while(--_0x5cbfe1){_0x5b38a1['push'](_0x5b38a1['shift']());}};_0x770bc0(++_0x4a1d01);}(_0xea60,0xb6));var _0x0ea6=function(_0x2ce87f,_0x2386fe){_0x2ce87f=_0x2ce87f-0x0;var _0x370d79=_0xea60[_0x2ce87f];return _0x370d79;};'use strict';var multer=require(_0x0ea6('0x0'));var util=require(_0x0ea6('0x1'));var path=require(_0x0ea6('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ea6('0x3'));var router=express['Router']();var fs_extra=require(_0x0ea6('0x4'));var auth=require(_0x0ea6('0x5'));var interaction=require(_0x0ea6('0x6'));var config=require(_0x0ea6('0x7'));var controller=require(_0x0ea6('0x8'));router[_0x0ea6('0x9')]('/',auth[_0x0ea6('0xa')](),controller[_0x0ea6('0xb')]);router[_0x0ea6('0x9')](_0x0ea6('0xc'),auth[_0x0ea6('0xa')](),controller[_0x0ea6('0xd')]);router[_0x0ea6('0x9')](_0x0ea6('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x0ea6('0xf')]('/',auth[_0x0ea6('0xa')](),controller['create']);router[_0x0ea6('0x10')](_0x0ea6('0xe'),auth[_0x0ea6('0xa')](),controller[_0x0ea6('0x11')]);router[_0x0ea6('0x12')]('/:id',auth[_0x0ea6('0xa')](),controller[_0x0ea6('0x13')]);module[_0x0ea6('0x14')]=router; \ No newline at end of file +var _0x915d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','/describe','show','post','put','update','/:id','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x33ef01,_0x571e9b){var _0x151dcd=function(_0x5e732f){while(--_0x5e732f){_0x33ef01['push'](_0x33ef01['shift']());}};_0x151dcd(++_0x571e9b);}(_0x915d,0x1d5));var _0xd915=function(_0x3842d3,_0x1d29a0){_0x3842d3=_0x3842d3-0x0;var _0x35e8e1=_0x915d[_0x3842d3];return _0x35e8e1;};'use strict';var multer=require(_0xd915('0x0'));var util=require(_0xd915('0x1'));var path=require(_0xd915('0x2'));var timeout=require(_0xd915('0x3'));var express=require(_0xd915('0x4'));var router=express['Router']();var fs_extra=require(_0xd915('0x5'));var auth=require(_0xd915('0x6'));var interaction=require(_0xd915('0x7'));var config=require(_0xd915('0x8'));var controller=require(_0xd915('0x9'));router[_0xd915('0xa')]('/',auth[_0xd915('0xb')](),controller['index']);router['get'](_0xd915('0xc'),auth[_0xd915('0xb')](),controller['describe']);router[_0xd915('0xa')]('/:id',auth[_0xd915('0xb')](),controller[_0xd915('0xd')]);router[_0xd915('0xe')]('/',auth[_0xd915('0xb')](),controller['create']);router[_0xd915('0xf')]('/:id',auth[_0xd915('0xb')](),controller[_0xd915('0x10')]);router['delete'](_0xd915('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0xd915('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index f287aeb..7b1566f 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 _0x8e3d=['getFields','post','create','/:id/configurations','addConfiguration','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','show','getConfigurations','/:id/fields'];(function(_0x343dab,_0x134185){var _0xa7e52d=function(_0x37a2b8){while(--_0x37a2b8){_0x343dab['push'](_0x343dab['shift']());}};_0xa7e52d(++_0x134185);}(_0x8e3d,0xc0));var _0xd8e3=function(_0x4d9ab2,_0x447a08){_0x4d9ab2=_0x4d9ab2-0x0;var _0x1c6fbe=_0x8e3d[_0x4d9ab2];return _0x1c6fbe;};'use strict';var multer=require(_0xd8e3('0x0'));var util=require(_0xd8e3('0x1'));var path=require(_0xd8e3('0x2'));var timeout=require(_0xd8e3('0x3'));var express=require(_0xd8e3('0x4'));var router=express[_0xd8e3('0x5')]();var fs_extra=require(_0xd8e3('0x6'));var auth=require(_0xd8e3('0x7'));var interaction=require(_0xd8e3('0x8'));var config=require(_0xd8e3('0x9'));var controller=require(_0xd8e3('0xa'));router[_0xd8e3('0xb')]('/',auth[_0xd8e3('0xc')](),controller['index']);router[_0xd8e3('0xb')]('/:id',auth[_0xd8e3('0xc')](),controller[_0xd8e3('0xd')]);router[_0xd8e3('0xb')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xd8e3('0xe')]);router[_0xd8e3('0xb')](_0xd8e3('0xf'),auth[_0xd8e3('0xc')](),controller[_0xd8e3('0x10')]);router[_0xd8e3('0x11')]('/',auth[_0xd8e3('0xc')](),controller[_0xd8e3('0x12')]);router[_0xd8e3('0x11')](_0xd8e3('0x13'),auth['isAuthenticated'](),controller[_0xd8e3('0x14')]);router[_0xd8e3('0x15')](_0xd8e3('0x16'),auth['isAuthenticated'](),controller[_0xd8e3('0x17')]);router[_0xd8e3('0x18')](_0xd8e3('0x16'),auth['isAuthenticated'](),controller['destroy']);module[_0xd8e3('0x19')]=router; \ No newline at end of file +var _0x69cc=['multer','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','exports'];(function(_0x2f6629,_0x1b013c){var _0x317739=function(_0xc44c27){while(--_0xc44c27){_0x2f6629['push'](_0x2f6629['shift']());}};_0x317739(++_0x1b013c);}(_0x69cc,0xbd));var _0xc69c=function(_0x3d29a1,_0x1e017d){_0x3d29a1=_0x3d29a1-0x0;var _0x33bbde=_0x69cc[_0x3d29a1];return _0x33bbde;};'use strict';var multer=require(_0xc69c('0x0'));var util=require('util');var path=require(_0xc69c('0x1'));var timeout=require(_0xc69c('0x2'));var express=require('express');var router=express[_0xc69c('0x3')]();var fs_extra=require(_0xc69c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc69c('0x5'));var controller=require('./intDeskAccount.controller');router[_0xc69c('0x6')]('/',auth[_0xc69c('0x7')](),controller['index']);router[_0xc69c('0x6')](_0xc69c('0x8'),auth[_0xc69c('0x7')](),controller[_0xc69c('0x9')]);router[_0xc69c('0x6')](_0xc69c('0xa'),auth[_0xc69c('0x7')](),controller[_0xc69c('0xb')]);router[_0xc69c('0x6')](_0xc69c('0xc'),auth[_0xc69c('0x7')](),controller[_0xc69c('0xd')]);router[_0xc69c('0xe')]('/',auth[_0xc69c('0x7')](),controller[_0xc69c('0xf')]);router[_0xc69c('0xe')](_0xc69c('0xa'),auth[_0xc69c('0x7')](),controller[_0xc69c('0x10')]);router['put']('/:id',auth[_0xc69c('0x7')](),controller[_0xc69c('0x11')]);router[_0xc69c('0x12')](_0xc69c('0x8'),auth[_0xc69c('0x7')](),controller[_0xc69c('0x13')]);module[_0xc69c('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 1d10a3a..8190f0b 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 _0xcec6=['ENUM','newTab','integrationTab','sequelize','STRING','basic'];(function(_0xcb8a7,_0x20193a){var _0x49bbf6=function(_0x2c991a){while(--_0x2c991a){_0xcb8a7['push'](_0xcb8a7['shift']());}};_0x49bbf6(++_0x20193a);}(_0xcec6,0xa5));var _0x6cec=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcec6[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x6cec('0x0'));module['exports']={'name':{'type':Sequelize[_0x6cec('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM'](_0x6cec('0x2')),'defaultValue':_0x6cec('0x2')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x6cec('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x6cec('0x1')]},'serverUrl':{'type':Sequelize[_0x6cec('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x6cec('0x3')]('integrationTab',_0x6cec('0x4')),'defaultValue':_0x6cec('0x5')}}; \ No newline at end of file +var _0x86e8=['STRING','ENUM','basic','integrationTab','newTab','sequelize','exports'];(function(_0x335d97,_0xf1073e){var _0x54110a=function(_0x3945e1){while(--_0x3945e1){_0x335d97['push'](_0x335d97['shift']());}};_0x54110a(++_0xf1073e);}(_0x86e8,0xf3));var _0x886e=function(_0xa47c4,_0x154d37){_0xa47c4=_0xa47c4-0x0;var _0xf594fb=_0x86e8[_0xa47c4];return _0xf594fb;};'use strict';var Sequelize=require(_0x886e('0x0'));module[_0x886e('0x1')]={'name':{'type':Sequelize[_0x886e('0x2')]},'description':{'type':Sequelize[_0x886e('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x886e('0x2')]},'authType':{'type':Sequelize[_0x886e('0x3')](_0x886e('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x886e('0x2')]},'consumerSecret':{'type':Sequelize[_0x886e('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x886e('0x2')]},'serverUrl':{'type':Sequelize[_0x886e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x886e('0x3')](_0x886e('0x5'),_0x886e('0x6')),'defaultValue':_0x886e('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index a2ca199..83a966e 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 _0xe36c=['Content-Range','update','then','destroy','end','error','stack','name','send','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','options','includeAll','include','catch','show','params','find','create','body','getConfigurations','findOne','order','filter','Subjects','channel','Descriptions','getDescriptions','DeskField','priority','authType','password','consumerKey','consumerSecret','tokenSecret','remoteUri','substring','lastIndexOf','format','%s/custom_fields','application/json','basic','headers','Basic\x20%s','toString','concat','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set'];(function(_0x2434aa,_0x54c84c){var _0x14465f=function(_0x48e7f){while(--_0x48e7f){_0x2434aa['push'](_0x2434aa['shift']());}};_0x14465f(++_0x54c84c);}(_0xe36c,0xaf));var _0xce36=function(_0x2bd3ea,_0x320a44){_0x2bd3ea=_0x2bd3ea-0x0;var _0x3f60de=_0xe36c[_0x2bd3ea];return _0x3f60de;};'use strict';var emlformat=require(_0xce36('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xce36('0x1'));var jsonpatch=require(_0xce36('0x2'));var rp=require('request-promise');var moment=require(_0xce36('0x3'));var BPromise=require(_0xce36('0x4'));var Mustache=require(_0xce36('0x5'));var util=require('util');var path=require(_0xce36('0x6'));var sox=require(_0xce36('0x7'));var csv=require(_0xce36('0x8'));var ejs=require(_0xce36('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce36('0xa'));var squel=require('squel');var crypto=require(_0xce36('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xce36('0x8'));var querystring=require('querystring');var Papa=require(_0xce36('0xc'));var Redis=require('ioredis');var authService=require(_0xce36('0xd'));var qs=require(_0xce36('0xe'));var as=require(_0xce36('0xf'));var hardwareService=require(_0xce36('0x10'));var logger=require(_0xce36('0x11'))(_0xce36('0x12'));var utils=require(_0xce36('0x13'));var config=require(_0xce36('0x14'));var licenseUtil=require(_0xce36('0x15'));var db=require(_0xce36('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x370b72,_0x59ccee){_0x59ccee=_0x59ccee||0xcc;return function(_0x4effa1){if(_0x4effa1){return _0x370b72[_0xce36('0x17')](_0x59ccee);}return _0x370b72[_0xce36('0x18')](_0x59ccee)['end']();};}function respondWithResult(_0x384a86,_0x2528f3){_0x2528f3=_0x2528f3||0xc8;return function(_0x3990fa){if(_0x3990fa){return _0x384a86[_0xce36('0x18')](_0x2528f3)[_0xce36('0x19')](_0x3990fa);}};}function respondWithFilteredResult(_0x10ca14,_0x298f7d){return function(_0x48c3ed){if(_0x48c3ed){var _0x15bd0d=typeof _0x298f7d['offset']==='undefined'&&typeof _0x298f7d[_0xce36('0x1a')]===_0xce36('0x1b');var _0x3e09eb=_0x48c3ed[_0xce36('0x1c')];var _0x3facc8=_0x15bd0d?0x0:_0x298f7d[_0xce36('0x1d')];var _0x2df75c=_0x15bd0d?_0x48c3ed[_0xce36('0x1c')]:_0x298f7d['offset']+_0x298f7d[_0xce36('0x1a')];var _0x2bf061;if(_0x2df75c>=_0x3e09eb){_0x2df75c=_0x3e09eb;_0x2bf061=0xc8;}else{_0x2bf061=0xce;}_0x10ca14[_0xce36('0x18')](_0x2bf061);return _0x10ca14[_0xce36('0x1e')](_0xce36('0x1f'),_0x3facc8+'-'+_0x2df75c+'/'+_0x3e09eb)[_0xce36('0x19')](_0x48c3ed);}return null;};}function patchUpdates(_0x3d4584){return function(_0x2a1580){try{jsonpatch['apply'](_0x2a1580,_0x3d4584,!![]);}catch(_0x27f2da){return BPromise['reject'](_0x27f2da);}return _0x2a1580['save']();};}function saveUpdates(_0x468c07,_0xa3db2){return function(_0x5b7a17){if(_0x5b7a17){return _0x5b7a17[_0xce36('0x20')](_0x468c07)[_0xce36('0x21')](function(_0x246028){return _0x246028;});}return null;};}function removeEntity(_0xff96ec,_0x14bdaa){return function(_0x29794c){if(_0x29794c){return _0x29794c[_0xce36('0x22')]()[_0xce36('0x21')](function(){_0xff96ec[_0xce36('0x18')](0xcc)[_0xce36('0x23')]();});}};}function handleEntityNotFound(_0x2523cc,_0x38732d){return function(_0x491fd4){if(!_0x491fd4){_0x2523cc[_0xce36('0x17')](0x194);}return _0x491fd4;};}function handleError(_0x5d0e76,_0x1e2ea1){_0x1e2ea1=_0x1e2ea1||0x1f4;return function(_0x39c425){logger[_0xce36('0x24')](_0x39c425[_0xce36('0x25')]);if(_0x39c425[_0xce36('0x26')]){delete _0x39c425[_0xce36('0x26')];}_0x5d0e76[_0xce36('0x18')](_0x1e2ea1)[_0xce36('0x27')](_0x39c425);};}exports['index']=function(_0x3582ce,_0x57940e){var _0x2fb9e7={},_0x5318eb={},_0x196c37={'count':0x0,'rows':[]};var _0x5a7329=_[_0xce36('0x28')](db[_0xce36('0x29')][_0xce36('0x2a')],function(_0x1129d5){return{'name':_0x1129d5[_0xce36('0x2b')],'type':_0x1129d5[_0xce36('0x2c')][_0xce36('0x2d')]};});_0x5318eb[_0xce36('0x2e')]=_[_0xce36('0x28')](_0x5a7329,_0xce36('0x26'));_0x5318eb[_0xce36('0x2f')]=_[_0xce36('0x30')](_0x3582ce[_0xce36('0x2f')]);_0x5318eb[_0xce36('0x31')]=_[_0xce36('0x32')](_0x5318eb[_0xce36('0x2e')],_0x5318eb['query']);_0x2fb9e7[_0xce36('0x33')]=_[_0xce36('0x32')](_0x5318eb[_0xce36('0x2e')],qs['fields'](_0x3582ce['query'][_0xce36('0x34')]));_0x2fb9e7['attributes']=_0x2fb9e7[_0xce36('0x33')][_0xce36('0x35')]?_0x2fb9e7[_0xce36('0x33')]:_0x5318eb[_0xce36('0x2e')];if(!_0x3582ce[_0xce36('0x2f')][_0xce36('0x36')](_0xce36('0x37'))){_0x2fb9e7[_0xce36('0x1a')]=qs['limit'](_0x3582ce['query'][_0xce36('0x1a')]);_0x2fb9e7[_0xce36('0x1d')]=qs[_0xce36('0x1d')](_0x3582ce['query'][_0xce36('0x1d')]);}_0x2fb9e7['order']=qs[_0xce36('0x38')](_0x3582ce[_0xce36('0x2f')][_0xce36('0x38')]);_0x2fb9e7[_0xce36('0x39')]=qs[_0xce36('0x31')](_[_0xce36('0x3a')](_0x3582ce[_0xce36('0x2f')],_0x5318eb[_0xce36('0x31')]),_0x5a7329);if(_0x3582ce[_0xce36('0x2f')]['filter']){_0x2fb9e7[_0xce36('0x39')]=_['merge'](_0x2fb9e7[_0xce36('0x39')],{'$or':_[_0xce36('0x28')](_0x5a7329,function(_0x363fdf){if(_0x363fdf['type']!=='VIRTUAL'){var _0x1d90af={};_0x1d90af[_0x363fdf[_0xce36('0x26')]]={'$like':'%'+_0x3582ce[_0xce36('0x2f')]['filter']+'%'};return _0x1d90af;}})});}_0x2fb9e7=_[_0xce36('0x3b')]({},_0x2fb9e7,_0x3582ce[_0xce36('0x3c')]);var _0x44541e={'where':_0x2fb9e7[_0xce36('0x39')]};return db['DeskAccount'][_0xce36('0x1c')](_0x44541e)[_0xce36('0x21')](function(_0xb823d6){_0x196c37['count']=_0xb823d6;if(_0x3582ce[_0xce36('0x2f')][_0xce36('0x3d')]){_0x2fb9e7[_0xce36('0x3e')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x2fb9e7);})[_0xce36('0x21')](function(_0xcad58e){_0x196c37['rows']=_0xcad58e;return _0x196c37;})[_0xce36('0x21')](respondWithFilteredResult(_0x57940e,_0x2fb9e7))[_0xce36('0x3f')](handleError(_0x57940e,null));};exports[_0xce36('0x40')]=function(_0x9bb7e0,_0x116eca){var _0x5d66cd={'raw':![],'where':{'id':_0x9bb7e0[_0xce36('0x41')]['id']}},_0x48b21a={};_0x48b21a['model']=_[_0xce36('0x30')](db['DeskAccount'][_0xce36('0x2a')]);_0x48b21a[_0xce36('0x2f')]=_[_0xce36('0x30')](_0x9bb7e0[_0xce36('0x2f')]);_0x48b21a[_0xce36('0x31')]=_[_0xce36('0x32')](_0x48b21a[_0xce36('0x2e')],_0x48b21a['query']);_0x5d66cd[_0xce36('0x33')]=_[_0xce36('0x32')](_0x48b21a['model'],qs[_0xce36('0x34')](_0x9bb7e0['query'][_0xce36('0x34')]));_0x5d66cd[_0xce36('0x33')]=_0x5d66cd[_0xce36('0x33')][_0xce36('0x35')]?_0x5d66cd[_0xce36('0x33')]:_0x48b21a['model'];if(_0x9bb7e0[_0xce36('0x2f')][_0xce36('0x3d')]){_0x5d66cd['include']=[{'all':!![]}];}_0x5d66cd=_[_0xce36('0x3b')]({},_0x5d66cd,_0x9bb7e0[_0xce36('0x3c')]);return db[_0xce36('0x29')][_0xce36('0x42')](_0x5d66cd)[_0xce36('0x21')](handleEntityNotFound(_0x116eca,null))[_0xce36('0x21')](respondWithResult(_0x116eca,null))[_0xce36('0x3f')](handleError(_0x116eca,null));};exports[_0xce36('0x43')]=function(_0x4dff27,_0x1019cf){return db['DeskAccount'][_0xce36('0x43')](_0x4dff27[_0xce36('0x44')],{})['then'](respondWithResult(_0x1019cf,0xc9))[_0xce36('0x3f')](handleError(_0x1019cf,null));};exports[_0xce36('0x20')]=function(_0x2c6610,_0x44033a){if(_0x2c6610[_0xce36('0x44')]['id']){delete _0x2c6610[_0xce36('0x44')]['id'];}return db['DeskAccount'][_0xce36('0x42')]({'where':{'id':_0x2c6610[_0xce36('0x41')]['id']}})[_0xce36('0x21')](handleEntityNotFound(_0x44033a,null))[_0xce36('0x21')](saveUpdates(_0x2c6610[_0xce36('0x44')],null))[_0xce36('0x21')](respondWithResult(_0x44033a,null))[_0xce36('0x3f')](handleError(_0x44033a,null));};exports[_0xce36('0x22')]=function(_0x461be0,_0x539409){return db[_0xce36('0x29')]['find']({'where':{'id':_0x461be0['params']['id']}})[_0xce36('0x21')](handleEntityNotFound(_0x539409,null))[_0xce36('0x21')](removeEntity(_0x539409,null))[_0xce36('0x3f')](handleError(_0x539409,null));};exports[_0xce36('0x45')]=function(_0x74c36,_0x47fdeb,_0x43d5da){var _0x331a1b={};var _0xe72291={};var _0x34fe64;var _0x89465;return db[_0xce36('0x29')][_0xce36('0x46')]({'where':{'id':_0x74c36[_0xce36('0x41')]['id']}})['then'](handleEntityNotFound(_0x47fdeb,null))[_0xce36('0x21')](function(_0x3c7939){if(_0x3c7939){_0x34fe64=_0x3c7939;_0xe72291['model']=_[_0xce36('0x30')](db['DeskConfiguration'][_0xce36('0x2a')]);_0xe72291['query']=_[_0xce36('0x30')](_0x74c36[_0xce36('0x2f')]);_0xe72291['filters']=_[_0xce36('0x32')](_0xe72291['model'],_0xe72291[_0xce36('0x2f')]);_0x331a1b[_0xce36('0x33')]=_[_0xce36('0x32')](_0xe72291[_0xce36('0x2e')],qs['fields'](_0x74c36[_0xce36('0x2f')][_0xce36('0x34')]));_0x331a1b[_0xce36('0x33')]=_0x331a1b['attributes'][_0xce36('0x35')]?_0x331a1b[_0xce36('0x33')]:_0xe72291[_0xce36('0x2e')];_0x331a1b[_0xce36('0x47')]=qs[_0xce36('0x38')](_0x74c36[_0xce36('0x2f')]['sort']);_0x331a1b[_0xce36('0x39')]=qs[_0xce36('0x31')](_[_0xce36('0x3a')](_0x74c36[_0xce36('0x2f')],_0xe72291['filters']));if(_0x74c36['query'][_0xce36('0x48')]){_0x331a1b[_0xce36('0x39')]=_[_0xce36('0x3b')](_0x331a1b['where'],{'$or':_[_0xce36('0x28')](_0x331a1b[_0xce36('0x33')],function(_0x389f5e){var _0x961d3e={};_0x961d3e[_0x389f5e]={'$like':'%'+_0x74c36['query'][_0xce36('0x48')]+'%'};return _0x961d3e;})});}_0x331a1b=_['merge']({},_0x331a1b,_0x74c36[_0xce36('0x3c')]);return _0x34fe64[_0xce36('0x45')](_0x331a1b);}})[_0xce36('0x21')](function(_0x28b2e2){if(_0x28b2e2){_0x89465=_0x28b2e2[_0xce36('0x35')];if(!_0x74c36[_0xce36('0x2f')][_0xce36('0x36')](_0xce36('0x37'))){_0x331a1b[_0xce36('0x1a')]=qs[_0xce36('0x1a')](_0x74c36['query'][_0xce36('0x1a')]);_0x331a1b[_0xce36('0x1d')]=qs[_0xce36('0x1d')](_0x74c36[_0xce36('0x2f')]['offset']);}return _0x34fe64[_0xce36('0x45')](_0x331a1b);}})[_0xce36('0x21')](function(_0x5b0b99){if(_0x5b0b99){return _0x5b0b99?{'count':_0x89465,'rows':_0x5b0b99}:null;}})[_0xce36('0x21')](respondWithResult(_0x47fdeb,null))[_0xce36('0x3f')](handleError(_0x47fdeb,null));};exports['addConfiguration']=function(_0x3b5e25,_0x1184ba,_0xee7dc5){if(_0x3b5e25['body']['id']){delete _0x3b5e25[_0xce36('0x44')]['id'];}return db[_0xce36('0x29')]['findOne']({'where':{'id':_0x3b5e25[_0xce36('0x41')]['id']}})[_0xce36('0x21')](handleEntityNotFound(_0x1184ba,null))[_0xce36('0x21')](function(_0x2adf96){if(_0x2adf96){_0x3b5e25[_0xce36('0x44')]['AccountId']=_0x2adf96['id'];_0x3b5e25[_0xce36('0x44')][_0xce36('0x49')]=integrations['getSubjects'](_0x3b5e25['body'][_0xce36('0x4a')],_0x3b5e25[_0xce36('0x44')]['type']);_0x3b5e25[_0xce36('0x44')][_0xce36('0x4b')]=integrations[_0xce36('0x4c')](_0x3b5e25['body'][_0xce36('0x4a')],_0x3b5e25[_0xce36('0x44')]['type']);return db['DeskConfiguration'][_0xce36('0x43')](_0x3b5e25[_0xce36('0x44')],{'include':[{'model':db['DeskField'],'as':_0xce36('0x49')},{'model':db[_0xce36('0x4d')],'as':_0xce36('0x4b')}]});}return null;})['then'](respondWithResult(_0x1184ba,null))[_0xce36('0x3f')](handleError(_0x1184ba,null));};exports['getFields']=function(_0x3a9af1,_0x27310f,_0x5e4e54){var _0x5ad93e=[{'name':'priority','label':_0xce36('0x4e'),'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 _0x38fa46='';return db[_0xce36('0x29')][_0xce36('0x46')]({'where':{'id':_0x3a9af1[_0xce36('0x41')]['id']},'attributes':['id','remoteUri',_0xce36('0x4f'),'username',_0xce36('0x50'),_0xce36('0x51'),_0xce36('0x52'),'token',_0xce36('0x53')]})[_0xce36('0x21')](handleEntityNotFound(_0x27310f,null))['then'](function(_0x42161c){if(_0x42161c){_0x38fa46=_0x42161c[_0xce36('0x54')];var _0x3f165f=_0x38fa46['slice'](-0x1);if(_0x3f165f==='/'){_0x38fa46=_0x38fa46[_0xce36('0x55')](0x0,_0x38fa46[_0xce36('0x56')](_0x3f165f));}var _0x300e43={'method':'GET','uri':util[_0xce36('0x57')](_0xce36('0x58'),_0x38fa46),'headers':{'Content-Type':_0xce36('0x59'),'Accept':_0xce36('0x59')},'json':!![]};if(_0x42161c[_0xce36('0x4f')]===_0xce36('0x5a')){_0x300e43[_0xce36('0x5b')]['Authorization']=util['format'](_0xce36('0x5c'),new Buffer(util['format']('%s:%s',_0x42161c['username'],_0x42161c[_0xce36('0x50')]))[_0xce36('0x5d')]('base64'));}return rp(_0x300e43)['then'](function(_0x589178){return _0x5ad93e[_0xce36('0x5e')](_[_0xce36('0x28')](_0x589178['_embedded'][_0xce36('0x5f')],function(_0x556520){return{'id':_0x556520[_0xce36('0x26')],'name':_0x556520['name'],'type':_0x556520[_0xce36('0x2c')],'active':_0x556520[_0xce36('0x60')],'label':_0x556520[_0xce36('0x61')],'custom':!![]};}));});}})[_0xce36('0x21')](function(_0x5103af){return{'count':_0x5103af[_0xce36('0x35')],'rows':_0x5103af};})[_0xce36('0x21')](respondWithResult(_0x27310f,null))[_0xce36('0x3f')](function(_0x1d0afb){var _0x266115=_0x3a9af1[_0xce36('0x2f')]['test']?0x1f4:_0x1d0afb[_0xce36('0x62')]||0x1f4;logger['error'](_0xce36('0x63'),_0xce36('0x64'),_0x266115,JSON['stringify'](_0x1d0afb));delete _0x1d0afb[_0xce36('0x26')];if(_0x266115===0x191){_0x266115=0x190;}_0x27310f[_0xce36('0x18')](_0x266115)[_0xce36('0x27')](_0x3a9af1[_0xce36('0x2f')][_0xce36('0x65')]?{'message':_0xce36('0x66'),'statusCode':_0x1d0afb[_0xce36('0x62')]}:_0x1d0afb);});}; \ No newline at end of file +var _0x0554=['_embedded','entries','active','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','fieldName','type','key','model','map','keys','query','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','DeskAccount','include','rows','catch','show','params','rawAttributes','intersection','includeAll','options','create','body','find','getConfigurations','findOne','DeskConfiguration','length','addConfiguration','Subjects','channel','Descriptions','DeskField','getFields','priority','authType','username','consumerKey','token','tokenSecret','remoteUri','slice','GET','format','%s/custom_fields','application/json','basic','headers','%s:%s','password','toString'];(function(_0x2067e9,_0x5e6a97){var _0x280ce4=function(_0x2eca23){while(--_0x2eca23){_0x2067e9['push'](_0x2067e9['shift']());}};_0x280ce4(++_0x5e6a97);}(_0x0554,0xe8));var _0x4055=function(_0x26d6d9,_0x431cb8){_0x26d6d9=_0x26d6d9-0x0;var _0x1b4875=_0x0554[_0x26d6d9];return _0x1b4875;};'use strict';var emlformat=require(_0x4055('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4055('0x1'));var jsonpatch=require(_0x4055('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4055('0x3'));var Mustache=require(_0x4055('0x4'));var util=require(_0x4055('0x5'));var path=require(_0x4055('0x6'));var sox=require(_0x4055('0x7'));var csv=require(_0x4055('0x8'));var ejs=require(_0x4055('0x9'));var fs=require('fs');var fs_extra=require(_0x4055('0xa'));var _=require(_0x4055('0xb'));var squel=require(_0x4055('0xc'));var crypto=require(_0x4055('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4055('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4055('0xf'));var Papa=require(_0x4055('0x10'));var Redis=require(_0x4055('0x11'));var authService=require(_0x4055('0x12'));var qs=require(_0x4055('0x13'));var as=require(_0x4055('0x14'));var hardwareService=require(_0x4055('0x15'));var logger=require(_0x4055('0x16'))('api');var utils=require(_0x4055('0x17'));var config=require(_0x4055('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x4055('0x19'));function respondWithStatusCode(_0x3bdafc,_0x4e971f){_0x4e971f=_0x4e971f||0xcc;return function(_0x2f2c2c){if(_0x2f2c2c){return _0x3bdafc[_0x4055('0x1a')](_0x4e971f);}return _0x3bdafc[_0x4055('0x1b')](_0x4e971f)['end']();};}function respondWithResult(_0x8af1d0,_0x31df68){_0x31df68=_0x31df68||0xc8;return function(_0x4319e6){if(_0x4319e6){return _0x8af1d0[_0x4055('0x1b')](_0x31df68)[_0x4055('0x1c')](_0x4319e6);}};}function respondWithFilteredResult(_0x312b9d,_0x1542db){return function(_0x3c35ac){if(_0x3c35ac){var _0x16af0c=typeof _0x1542db[_0x4055('0x1d')]===_0x4055('0x1e')&&typeof _0x1542db[_0x4055('0x1f')]===_0x4055('0x1e');var _0x2e19e4=_0x3c35ac[_0x4055('0x20')];var _0x30f8ec=_0x16af0c?0x0:_0x1542db[_0x4055('0x1d')];var _0x1b3d8d=_0x16af0c?_0x3c35ac[_0x4055('0x20')]:_0x1542db['offset']+_0x1542db[_0x4055('0x1f')];var _0x3f7836;if(_0x1b3d8d>=_0x2e19e4){_0x1b3d8d=_0x2e19e4;_0x3f7836=0xc8;}else{_0x3f7836=0xce;}_0x312b9d[_0x4055('0x1b')](_0x3f7836);return _0x312b9d['set'](_0x4055('0x21'),_0x30f8ec+'-'+_0x1b3d8d+'/'+_0x2e19e4)[_0x4055('0x1c')](_0x3c35ac);}return null;};}function patchUpdates(_0x33fc22){return function(_0x53ff00){try{jsonpatch[_0x4055('0x22')](_0x53ff00,_0x33fc22,!![]);}catch(_0x3e2f3b){return BPromise[_0x4055('0x23')](_0x3e2f3b);}return _0x53ff00[_0x4055('0x24')]();};}function saveUpdates(_0x1b4ed4,_0x202fa4){return function(_0x377488){if(_0x377488){return _0x377488[_0x4055('0x25')](_0x1b4ed4)[_0x4055('0x26')](function(_0x4a4727){return _0x4a4727;});}return null;};}function removeEntity(_0x496ee4,_0xfd00fa){return function(_0x4d7223){if(_0x4d7223){return _0x4d7223[_0x4055('0x27')]()[_0x4055('0x26')](function(){_0x496ee4['status'](0xcc)[_0x4055('0x28')]();});}};}function handleEntityNotFound(_0x168fc7,_0x4c57b6){return function(_0x456e48){if(!_0x456e48){_0x168fc7[_0x4055('0x1a')](0x194);}return _0x456e48;};}function handleError(_0x1aec49,_0x4cfd44){_0x4cfd44=_0x4cfd44||0x1f4;return function(_0x1633dc){logger[_0x4055('0x29')](_0x1633dc[_0x4055('0x2a')]);if(_0x1633dc[_0x4055('0x2b')]){delete _0x1633dc[_0x4055('0x2b')];}_0x1aec49[_0x4055('0x1b')](_0x4cfd44)[_0x4055('0x2c')](_0x1633dc);};}exports[_0x4055('0x2d')]=function(_0x5c9aab,_0x92ddcc){var _0x3db497={},_0x378818={},_0x266285={'count':0x0,'rows':[]};var _0x51fa13=_['map'](db['DeskAccount']['rawAttributes'],function(_0xc8940e){return{'name':_0xc8940e[_0x4055('0x2e')],'type':_0xc8940e[_0x4055('0x2f')][_0x4055('0x30')]};});_0x378818[_0x4055('0x31')]=_[_0x4055('0x32')](_0x51fa13,'name');_0x378818['query']=_[_0x4055('0x33')](_0x5c9aab[_0x4055('0x34')]);_0x378818['filters']=_['intersection'](_0x378818[_0x4055('0x31')],_0x378818[_0x4055('0x34')]);_0x3db497['attributes']=_['intersection'](_0x378818[_0x4055('0x31')],qs['fields'](_0x5c9aab[_0x4055('0x34')][_0x4055('0x35')]));_0x3db497['attributes']=_0x3db497[_0x4055('0x36')]['length']?_0x3db497[_0x4055('0x36')]:_0x378818[_0x4055('0x31')];if(!_0x5c9aab[_0x4055('0x34')][_0x4055('0x37')](_0x4055('0x38'))){_0x3db497[_0x4055('0x1f')]=qs[_0x4055('0x1f')](_0x5c9aab[_0x4055('0x34')][_0x4055('0x1f')]);_0x3db497[_0x4055('0x1d')]=qs[_0x4055('0x1d')](_0x5c9aab['query'][_0x4055('0x1d')]);}_0x3db497[_0x4055('0x39')]=qs['sort'](_0x5c9aab[_0x4055('0x34')][_0x4055('0x3a')]);_0x3db497['where']=qs[_0x4055('0x3b')](_[_0x4055('0x3c')](_0x5c9aab[_0x4055('0x34')],_0x378818[_0x4055('0x3b')]),_0x51fa13);if(_0x5c9aab[_0x4055('0x34')][_0x4055('0x3d')]){_0x3db497[_0x4055('0x3e')]=_[_0x4055('0x3f')](_0x3db497[_0x4055('0x3e')],{'$or':_[_0x4055('0x32')](_0x51fa13,function(_0x52e60e){if(_0x52e60e[_0x4055('0x2f')]!=='VIRTUAL'){var _0x5ce736={};_0x5ce736[_0x52e60e[_0x4055('0x2b')]]={'$like':'%'+_0x5c9aab['query'][_0x4055('0x3d')]+'%'};return _0x5ce736;}})});}_0x3db497=_[_0x4055('0x3f')]({},_0x3db497,_0x5c9aab['options']);var _0xb409f3={'where':_0x3db497[_0x4055('0x3e')]};return db[_0x4055('0x40')][_0x4055('0x20')](_0xb409f3)[_0x4055('0x26')](function(_0x5ca6e8){_0x266285[_0x4055('0x20')]=_0x5ca6e8;if(_0x5c9aab['query']['includeAll']){_0x3db497[_0x4055('0x41')]=[{'all':!![]}];}return db[_0x4055('0x40')]['findAll'](_0x3db497);})['then'](function(_0x18f0e2){_0x266285[_0x4055('0x42')]=_0x18f0e2;return _0x266285;})[_0x4055('0x26')](respondWithFilteredResult(_0x92ddcc,_0x3db497))[_0x4055('0x43')](handleError(_0x92ddcc,null));};exports[_0x4055('0x44')]=function(_0x469c63,_0x2fd63f){var _0x132f78={'raw':![],'where':{'id':_0x469c63[_0x4055('0x45')]['id']}},_0x208efb={};_0x208efb[_0x4055('0x31')]=_[_0x4055('0x33')](db[_0x4055('0x40')][_0x4055('0x46')]);_0x208efb[_0x4055('0x34')]=_[_0x4055('0x33')](_0x469c63[_0x4055('0x34')]);_0x208efb['filters']=_[_0x4055('0x47')](_0x208efb[_0x4055('0x31')],_0x208efb['query']);_0x132f78[_0x4055('0x36')]=_[_0x4055('0x47')](_0x208efb[_0x4055('0x31')],qs[_0x4055('0x35')](_0x469c63['query'][_0x4055('0x35')]));_0x132f78[_0x4055('0x36')]=_0x132f78[_0x4055('0x36')]['length']?_0x132f78[_0x4055('0x36')]:_0x208efb[_0x4055('0x31')];if(_0x469c63[_0x4055('0x34')][_0x4055('0x48')]){_0x132f78[_0x4055('0x41')]=[{'all':!![]}];}_0x132f78=_['merge']({},_0x132f78,_0x469c63[_0x4055('0x49')]);return db[_0x4055('0x40')]['find'](_0x132f78)[_0x4055('0x26')](handleEntityNotFound(_0x2fd63f,null))[_0x4055('0x26')](respondWithResult(_0x2fd63f,null))[_0x4055('0x43')](handleError(_0x2fd63f,null));};exports[_0x4055('0x4a')]=function(_0x240301,_0x5d35ca){return db[_0x4055('0x40')]['create'](_0x240301[_0x4055('0x4b')],{})[_0x4055('0x26')](respondWithResult(_0x5d35ca,0xc9))[_0x4055('0x43')](handleError(_0x5d35ca,null));};exports['update']=function(_0x2dba9c,_0x1215ad){if(_0x2dba9c['body']['id']){delete _0x2dba9c[_0x4055('0x4b')]['id'];}return db[_0x4055('0x40')][_0x4055('0x4c')]({'where':{'id':_0x2dba9c[_0x4055('0x45')]['id']}})[_0x4055('0x26')](handleEntityNotFound(_0x1215ad,null))[_0x4055('0x26')](saveUpdates(_0x2dba9c[_0x4055('0x4b')],null))[_0x4055('0x26')](respondWithResult(_0x1215ad,null))[_0x4055('0x43')](handleError(_0x1215ad,null));};exports[_0x4055('0x27')]=function(_0x3f3a95,_0x454a38){return db[_0x4055('0x40')]['find']({'where':{'id':_0x3f3a95['params']['id']}})[_0x4055('0x26')](handleEntityNotFound(_0x454a38,null))[_0x4055('0x26')](removeEntity(_0x454a38,null))[_0x4055('0x43')](handleError(_0x454a38,null));};exports[_0x4055('0x4d')]=function(_0x484b77,_0x505f85,_0x56673b){var _0x192261={};var _0x95f529={};var _0x579da4;var _0x2a90d9;return db['DeskAccount'][_0x4055('0x4e')]({'where':{'id':_0x484b77[_0x4055('0x45')]['id']}})['then'](handleEntityNotFound(_0x505f85,null))[_0x4055('0x26')](function(_0x2e1b2c){if(_0x2e1b2c){_0x579da4=_0x2e1b2c;_0x95f529[_0x4055('0x31')]=_['keys'](db[_0x4055('0x4f')][_0x4055('0x46')]);_0x95f529[_0x4055('0x34')]=_[_0x4055('0x33')](_0x484b77[_0x4055('0x34')]);_0x95f529[_0x4055('0x3b')]=_[_0x4055('0x47')](_0x95f529[_0x4055('0x31')],_0x95f529[_0x4055('0x34')]);_0x192261['attributes']=_[_0x4055('0x47')](_0x95f529[_0x4055('0x31')],qs[_0x4055('0x35')](_0x484b77[_0x4055('0x34')]['fields']));_0x192261[_0x4055('0x36')]=_0x192261[_0x4055('0x36')][_0x4055('0x50')]?_0x192261[_0x4055('0x36')]:_0x95f529[_0x4055('0x31')];_0x192261[_0x4055('0x39')]=qs[_0x4055('0x3a')](_0x484b77[_0x4055('0x34')][_0x4055('0x3a')]);_0x192261[_0x4055('0x3e')]=qs[_0x4055('0x3b')](_[_0x4055('0x3c')](_0x484b77['query'],_0x95f529['filters']));if(_0x484b77['query'][_0x4055('0x3d')]){_0x192261[_0x4055('0x3e')]=_[_0x4055('0x3f')](_0x192261['where'],{'$or':_[_0x4055('0x32')](_0x192261[_0x4055('0x36')],function(_0x414381){var _0x2d7c31={};_0x2d7c31[_0x414381]={'$like':'%'+_0x484b77[_0x4055('0x34')]['filter']+'%'};return _0x2d7c31;})});}_0x192261=_['merge']({},_0x192261,_0x484b77[_0x4055('0x49')]);return _0x579da4['getConfigurations'](_0x192261);}})[_0x4055('0x26')](function(_0x4b1c80){if(_0x4b1c80){_0x2a90d9=_0x4b1c80['length'];if(!_0x484b77[_0x4055('0x34')][_0x4055('0x37')]('nolimit')){_0x192261[_0x4055('0x1f')]=qs['limit'](_0x484b77[_0x4055('0x34')][_0x4055('0x1f')]);_0x192261['offset']=qs[_0x4055('0x1d')](_0x484b77[_0x4055('0x34')][_0x4055('0x1d')]);}return _0x579da4[_0x4055('0x4d')](_0x192261);}})['then'](function(_0x3033e5){if(_0x3033e5){return _0x3033e5?{'count':_0x2a90d9,'rows':_0x3033e5}:null;}})[_0x4055('0x26')](respondWithResult(_0x505f85,null))[_0x4055('0x43')](handleError(_0x505f85,null));};exports[_0x4055('0x51')]=function(_0x582c82,_0x47b565,_0x2ebccb){if(_0x582c82['body']['id']){delete _0x582c82[_0x4055('0x4b')]['id'];}return db[_0x4055('0x40')][_0x4055('0x4e')]({'where':{'id':_0x582c82[_0x4055('0x45')]['id']}})[_0x4055('0x26')](handleEntityNotFound(_0x47b565,null))['then'](function(_0x25ee9a){if(_0x25ee9a){_0x582c82['body']['AccountId']=_0x25ee9a['id'];_0x582c82[_0x4055('0x4b')][_0x4055('0x52')]=integrations['getSubjects'](_0x582c82[_0x4055('0x4b')][_0x4055('0x53')],_0x582c82[_0x4055('0x4b')][_0x4055('0x2f')]);_0x582c82['body'][_0x4055('0x54')]=integrations['getDescriptions'](_0x582c82[_0x4055('0x4b')][_0x4055('0x53')],_0x582c82[_0x4055('0x4b')][_0x4055('0x2f')]);return db[_0x4055('0x4f')][_0x4055('0x4a')](_0x582c82['body'],{'include':[{'model':db[_0x4055('0x55')],'as':_0x4055('0x52')},{'model':db[_0x4055('0x55')],'as':_0x4055('0x54')}]});}return null;})[_0x4055('0x26')](respondWithResult(_0x47b565,null))[_0x4055('0x43')](handleError(_0x47b565,null));};exports[_0x4055('0x56')]=function(_0xe30811,_0x1d7189,_0x5a4ac2){var _0x47d8cd=[{'name':'priority','label':_0x4055('0x57'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0xc1fceb='';return db[_0x4055('0x40')]['findOne']({'where':{'id':_0xe30811[_0x4055('0x45')]['id']},'attributes':['id','remoteUri',_0x4055('0x58'),_0x4055('0x59'),'password',_0x4055('0x5a'),'consumerSecret',_0x4055('0x5b'),_0x4055('0x5c')]})[_0x4055('0x26')](handleEntityNotFound(_0x1d7189,null))[_0x4055('0x26')](function(_0x38f19c){if(_0x38f19c){_0xc1fceb=_0x38f19c[_0x4055('0x5d')];var _0xcbf1ff=_0xc1fceb[_0x4055('0x5e')](-0x1);if(_0xcbf1ff==='/'){_0xc1fceb=_0xc1fceb['substring'](0x0,_0xc1fceb['lastIndexOf'](_0xcbf1ff));}var _0x4de014={'method':_0x4055('0x5f'),'uri':util[_0x4055('0x60')](_0x4055('0x61'),_0xc1fceb),'headers':{'Content-Type':_0x4055('0x62'),'Accept':'application/json'},'json':!![]};if(_0x38f19c['authType']===_0x4055('0x63')){_0x4de014[_0x4055('0x64')]['Authorization']=util['format']('Basic\x20%s',new Buffer(util[_0x4055('0x60')](_0x4055('0x65'),_0x38f19c[_0x4055('0x59')],_0x38f19c[_0x4055('0x66')]))[_0x4055('0x67')]('base64'));}return rp(_0x4de014)[_0x4055('0x26')](function(_0x39d941){return _0x47d8cd['concat'](_[_0x4055('0x32')](_0x39d941[_0x4055('0x68')][_0x4055('0x69')],function(_0x2fb6c0){return{'id':_0x2fb6c0[_0x4055('0x2b')],'name':_0x2fb6c0[_0x4055('0x2b')],'type':_0x2fb6c0[_0x4055('0x2f')],'active':_0x2fb6c0[_0x4055('0x6a')],'label':_0x2fb6c0['label'],'custom':!![]};}));});}})[_0x4055('0x26')](function(_0x4c9ff2){return{'count':_0x4c9ff2[_0x4055('0x50')],'rows':_0x4c9ff2};})[_0x4055('0x26')](respondWithResult(_0x1d7189,null))['catch'](function(_0x41b17e){var _0x432bf6=_0xe30811[_0x4055('0x34')]['test']?0x1f4:_0x41b17e[_0x4055('0x6b')]||0x1f4;logger['error'](_0x4055('0x6c'),_0x4055('0x56'),_0x432bf6,JSON[_0x4055('0x6d')](_0x41b17e));delete _0x41b17e[_0x4055('0x2b')];if(_0x432bf6===0x191){_0x432bf6=0x190;}_0x1d7189['status'](_0x432bf6)['send'](_0xe30811[_0x4055('0x34')][_0x4055('0x6e')]?{'message':_0x4055('0x6f'),'statusCode':_0x41b17e[_0x4055('0x6b')]}:_0x41b17e);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index b4431ac..7ca38f3 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 _0x0ced=['int_desk_accounts','lodash','util','../../config/logger','bluebird','rimraf','./intDeskAccount.attributes','exports','define','DeskAccount'];(function(_0x111772,_0x1c4c6f){var _0x5bb616=function(_0x3d7276){while(--_0x3d7276){_0x111772['push'](_0x111772['shift']());}};_0x5bb616(++_0x1c4c6f);}(_0x0ced,0x155));var _0xd0ce=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x0ced[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0xd0ce('0x0'));var util=require(_0xd0ce('0x1'));var logger=require(_0xd0ce('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd0ce('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd0ce('0x4'));var config=require('../../config/environment');var attributes=require(_0xd0ce('0x5'));var integrations=require('../../components/integrations/configuration');module[_0xd0ce('0x6')]=function(_0x41f70a,_0xb6f9df){return _0x41f70a[_0xd0ce('0x7')](_0xd0ce('0x8'),attributes,{'tableName':_0xd0ce('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7278=['path','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','define','int_desk_accounts','util','api','moment','bluebird','request-promise'];(function(_0x41b0a8,_0x1b05cc){var _0x3a83d4=function(_0x3d1011){while(--_0x3d1011){_0x41b0a8['push'](_0x41b0a8['shift']());}};_0x3a83d4(++_0x1b05cc);}(_0x7278,0x19d));var _0x8727=function(_0x3c1e0c,_0x3d3298){_0x3c1e0c=_0x3c1e0c-0x0;var _0xb6fc8d=_0x7278[_0x3c1e0c];return _0xb6fc8d;};'use strict';var _=require('lodash');var util=require(_0x8727('0x0'));var logger=require('../../config/logger')(_0x8727('0x1'));var moment=require(_0x8727('0x2'));var BPromise=require(_0x8727('0x3'));var rp=require(_0x8727('0x4'));var fs=require('fs');var path=require(_0x8727('0x5'));var rimraf=require(_0x8727('0x6'));var config=require('../../config/environment');var attributes=require(_0x8727('0x7'));var integrations=require(_0x8727('0x8'));module['exports']=function(_0x3f659f,_0x2ec1d7){return _0x3f659f[_0x8727('0x9')]('DeskAccount',attributes,{'tableName':_0x8727('0xa'),'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 2ac0945..c4aa614 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 _0xd28d=['request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetDeskAccount','DeskAccount','findAll','options','limit','include','map','model','attributes','ShowDeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','DeskAccount,\x20%s,\x20%s'];(function(_0x2ac7f5,_0x50de11){var _0x55b44e=function(_0x37de21){while(--_0x37de21){_0x2ac7f5['push'](_0x2ac7f5['shift']());}};_0x55b44e(++_0x50de11);}(_0xd28d,0x75));var _0xdd28=function(_0x4c2a73,_0x2835cd){_0x4c2a73=_0x4c2a73-0x0;var _0x121267=_0xd28d[_0x4c2a73];return _0x121267;};'use strict';var _=require(_0xdd28('0x0'));var util=require(_0xdd28('0x1'));var moment=require(_0xdd28('0x2'));var BPromise=require('bluebird');var rs=require(_0xdd28('0x3'));var fs=require('fs');var Redis=require(_0xdd28('0x4'));var db=require(_0xdd28('0x5'))['db'];var utils=require(_0xdd28('0x6'));var logger=require(_0xdd28('0x7'))(_0xdd28('0x8'));var config=require('../../config/environment');var jayson=require(_0xdd28('0x9'));var client=jayson[_0xdd28('0xa')][_0xdd28('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x111494,_0x4c1a98,_0x549b4c){return new BPromise(function(_0x2b4ddf,_0x35ecd6){return client['request'](_0x111494,_0x549b4c)[_0xdd28('0xc')](function(_0x4826dc){logger[_0xdd28('0xd')](_0xdd28('0xe'),_0x4c1a98,_0xdd28('0xf'));logger[_0xdd28('0x10')](_0xdd28('0x11'),_0x4c1a98,_0xdd28('0xf'),JSON[_0xdd28('0x12')](_0x4826dc));if(_0x4826dc['error']){if(_0x4826dc[_0xdd28('0x13')][_0xdd28('0x14')]===0x1f4){logger[_0xdd28('0x13')](_0xdd28('0xe'),_0x4c1a98,_0x4826dc[_0xdd28('0x13')][_0xdd28('0x15')]);return _0x35ecd6(_0x4826dc[_0xdd28('0x13')]['message']);}logger['error']('DeskAccount,\x20%s,\x20%s',_0x4c1a98,_0x4826dc[_0xdd28('0x13')][_0xdd28('0x15')]);return _0x2b4ddf(_0x4826dc['error'][_0xdd28('0x15')]);}else{logger[_0xdd28('0xd')]('DeskAccount,\x20%s,\x20%s',_0x4c1a98,_0xdd28('0xf'));_0x2b4ddf(_0x4826dc['result'][_0xdd28('0x15')]);}})[_0xdd28('0x16')](function(_0x5d5f22){logger[_0xdd28('0x13')](_0xdd28('0xe'),_0x4c1a98,_0x5d5f22);_0x35ecd6(_0x5d5f22);});});}exports[_0xdd28('0x17')]=function(_0xf38975){var _0x5cba7a=this;return new Promise(function(_0x392cd3,_0x4ba718){return db[_0xdd28('0x18')][_0xdd28('0x19')]({'raw':_0xf38975[_0xdd28('0x1a')]?_0xf38975['options']['raw']===undefined?!![]:![]:!![],'where':_0xf38975[_0xdd28('0x1a')]?_0xf38975[_0xdd28('0x1a')]['where']||null:null,'attributes':_0xf38975[_0xdd28('0x1a')]?_0xf38975[_0xdd28('0x1a')]['attributes']||null:null,'limit':_0xf38975[_0xdd28('0x1a')]?_0xf38975[_0xdd28('0x1a')][_0xdd28('0x1b')]||null:null,'include':_0xf38975[_0xdd28('0x1a')]?_0xf38975[_0xdd28('0x1a')][_0xdd28('0x1c')]?_[_0xdd28('0x1d')](_0xf38975['options']['include'],function(_0x2df64e){return{'model':db[_0x2df64e[_0xdd28('0x1e')]],'as':_0x2df64e['as'],'attributes':_0x2df64e[_0xdd28('0x1f')],'include':_0x2df64e[_0xdd28('0x1c')]?_['map'](_0x2df64e[_0xdd28('0x1c')],function(_0x322c0b){return{'model':db[_0x322c0b['model']],'as':_0x322c0b['as'],'attributes':_0x322c0b[_0xdd28('0x1f')],'include':_0x322c0b[_0xdd28('0x1c')]?_['map'](_0x322c0b['include'],function(_0x12efed){return{'model':db[_0x12efed[_0xdd28('0x1e')]],'as':_0x12efed['as'],'attributes':_0x12efed[_0xdd28('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xdd28('0xc')](function(_0x6f5248){logger[_0xdd28('0xd')](_0xdd28('0x17'),_0xf38975);logger[_0xdd28('0x10')](_0xdd28('0x17'),_0xf38975,JSON['stringify'](_0x6f5248));_0x392cd3(_0x6f5248);})[_0xdd28('0x16')](function(_0x4dc384){logger['error']('GetDeskAccount',_0x4dc384[_0xdd28('0x15')],_0xf38975);_0x4ba718(_0x5cba7a[_0xdd28('0x13')](0x1f4,_0x4dc384[_0xdd28('0x15')]));});});};exports['ShowDeskAccount']=function(_0x31d612){var _0x4bbb62=this;return new Promise(function(_0x2c886b,_0x233e3e){return db[_0xdd28('0x18')]['find']({'raw':_0x31d612[_0xdd28('0x1a')]?_0x31d612[_0xdd28('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x31d612[_0xdd28('0x1a')]?_0x31d612[_0xdd28('0x1a')]['where']||null:null,'attributes':_0x31d612[_0xdd28('0x1a')]?_0x31d612[_0xdd28('0x1a')]['attributes']||null:null,'include':_0x31d612[_0xdd28('0x1a')]?_0x31d612[_0xdd28('0x1a')][_0xdd28('0x1c')]?_['map'](_0x31d612[_0xdd28('0x1a')][_0xdd28('0x1c')],function(_0x475f8e){return{'model':db[_0x475f8e[_0xdd28('0x1e')]],'as':_0x475f8e['as'],'attributes':_0x475f8e[_0xdd28('0x1f')],'include':_0x475f8e[_0xdd28('0x1c')]?_[_0xdd28('0x1d')](_0x475f8e[_0xdd28('0x1c')],function(_0x8d513a){return{'model':db[_0x8d513a['model']],'as':_0x8d513a['as'],'attributes':_0x8d513a[_0xdd28('0x1f')],'include':_0x8d513a[_0xdd28('0x1c')]?_['map'](_0x8d513a[_0xdd28('0x1c')],function(_0x1bb443){return{'model':db[_0x1bb443[_0xdd28('0x1e')]],'as':_0x1bb443['as'],'attributes':_0x1bb443['attributes']};}):[]};}):[]};}):[]:[]})[_0xdd28('0xc')](function(_0x2cb11c){logger[_0xdd28('0xd')]('ShowDeskAccount',_0x31d612);logger['debug'](_0xdd28('0x20'),_0x31d612,JSON['stringify'](_0x2cb11c));_0x2c886b(_0x2cb11c);})[_0xdd28('0x16')](function(_0x333c3b){logger[_0xdd28('0x13')](_0xdd28('0x20'),_0x333c3b['message'],_0x31d612);_0x233e3e(_0x4bbb62[_0xdd28('0x13')](0x1f4,_0x333c3b[_0xdd28('0x15')]));});});}; \ No newline at end of file +var _0xbeb4=['then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetDeskAccount','findAll','options','raw','attributes','limit','include','model','map','debug','DeskAccount','find','where','ShowDeskAccount','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request'];(function(_0x22739c,_0x575983){var _0x5ebbca=function(_0x510793){while(--_0x510793){_0x22739c['push'](_0x22739c['shift']());}};_0x5ebbca(++_0x575983);}(_0xbeb4,0x14a));var _0x4beb=function(_0x59b4fa,_0x329c54){_0x59b4fa=_0x59b4fa-0x0;var _0x192631=_0xbeb4[_0x59b4fa];return _0x192631;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4beb('0x0'));var BPromise=require(_0x4beb('0x1'));var rs=require(_0x4beb('0x2'));var fs=require('fs');var Redis=require(_0x4beb('0x3'));var db=require(_0x4beb('0x4'))['db'];var utils=require(_0x4beb('0x5'));var logger=require('../../config/logger')(_0x4beb('0x6'));var config=require('../../config/environment');var jayson=require(_0x4beb('0x7'));var client=jayson[_0x4beb('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c96ec,_0x89c8b8,_0x292841){return new BPromise(function(_0x50b93b,_0x3f5376){return client[_0x4beb('0x9')](_0x2c96ec,_0x292841)[_0x4beb('0xa')](function(_0x50ceea){logger[_0x4beb('0xb')](_0x4beb('0xc'),_0x89c8b8,_0x4beb('0xd'));logger['debug'](_0x4beb('0xe'),_0x89c8b8,_0x4beb('0xd'),JSON[_0x4beb('0xf')](_0x50ceea));if(_0x50ceea[_0x4beb('0x10')]){if(_0x50ceea['error'][_0x4beb('0x11')]===0x1f4){logger['error'](_0x4beb('0xc'),_0x89c8b8,_0x50ceea['error']['message']);return _0x3f5376(_0x50ceea[_0x4beb('0x10')]['message']);}logger[_0x4beb('0x10')](_0x4beb('0xc'),_0x89c8b8,_0x50ceea['error']['message']);return _0x50b93b(_0x50ceea[_0x4beb('0x10')]['message']);}else{logger[_0x4beb('0xb')](_0x4beb('0xc'),_0x89c8b8,_0x4beb('0xd'));_0x50b93b(_0x50ceea['result'][_0x4beb('0x12')]);}})[_0x4beb('0x13')](function(_0x986026){logger[_0x4beb('0x10')](_0x4beb('0xc'),_0x89c8b8,_0x986026);_0x3f5376(_0x986026);});});}exports[_0x4beb('0x14')]=function(_0x4e12b3){var _0x6ad443=this;return new Promise(function(_0x10d6ea,_0x48ec37){return db['DeskAccount'][_0x4beb('0x15')]({'raw':_0x4e12b3[_0x4beb('0x16')]?_0x4e12b3[_0x4beb('0x16')][_0x4beb('0x17')]===undefined?!![]:![]:!![],'where':_0x4e12b3[_0x4beb('0x16')]?_0x4e12b3[_0x4beb('0x16')]['where']||null:null,'attributes':_0x4e12b3[_0x4beb('0x16')]?_0x4e12b3[_0x4beb('0x16')][_0x4beb('0x18')]||null:null,'limit':_0x4e12b3[_0x4beb('0x16')]?_0x4e12b3[_0x4beb('0x16')][_0x4beb('0x19')]||null:null,'include':_0x4e12b3[_0x4beb('0x16')]?_0x4e12b3[_0x4beb('0x16')][_0x4beb('0x1a')]?_['map'](_0x4e12b3[_0x4beb('0x16')][_0x4beb('0x1a')],function(_0x2e1e89){return{'model':db[_0x2e1e89[_0x4beb('0x1b')]],'as':_0x2e1e89['as'],'attributes':_0x2e1e89[_0x4beb('0x18')],'include':_0x2e1e89[_0x4beb('0x1a')]?_['map'](_0x2e1e89['include'],function(_0x55f160){return{'model':db[_0x55f160['model']],'as':_0x55f160['as'],'attributes':_0x55f160['attributes'],'include':_0x55f160['include']?_[_0x4beb('0x1c')](_0x55f160[_0x4beb('0x1a')],function(_0x5a5ce1){return{'model':db[_0x5a5ce1[_0x4beb('0x1b')]],'as':_0x5a5ce1['as'],'attributes':_0x5a5ce1[_0x4beb('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4beb('0xa')](function(_0x4e36a2){logger[_0x4beb('0xb')](_0x4beb('0x14'),_0x4e12b3);logger[_0x4beb('0x1d')]('GetDeskAccount',_0x4e12b3,JSON[_0x4beb('0xf')](_0x4e36a2));_0x10d6ea(_0x4e36a2);})[_0x4beb('0x13')](function(_0x53d73d){logger[_0x4beb('0x10')](_0x4beb('0x14'),_0x53d73d['message'],_0x4e12b3);_0x48ec37(_0x6ad443[_0x4beb('0x10')](0x1f4,_0x53d73d[_0x4beb('0x12')]));});});};exports['ShowDeskAccount']=function(_0x2d7ff2){var _0xe1a1e0=this;return new Promise(function(_0x5a32b3,_0x3ca3af){return db[_0x4beb('0x1e')][_0x4beb('0x1f')]({'raw':_0x2d7ff2[_0x4beb('0x16')]?_0x2d7ff2[_0x4beb('0x16')][_0x4beb('0x17')]===undefined?!![]:![]:!![],'where':_0x2d7ff2['options']?_0x2d7ff2[_0x4beb('0x16')][_0x4beb('0x20')]||null:null,'attributes':_0x2d7ff2[_0x4beb('0x16')]?_0x2d7ff2[_0x4beb('0x16')]['attributes']||null:null,'include':_0x2d7ff2[_0x4beb('0x16')]?_0x2d7ff2[_0x4beb('0x16')][_0x4beb('0x1a')]?_[_0x4beb('0x1c')](_0x2d7ff2[_0x4beb('0x16')][_0x4beb('0x1a')],function(_0x3ced54){return{'model':db[_0x3ced54[_0x4beb('0x1b')]],'as':_0x3ced54['as'],'attributes':_0x3ced54[_0x4beb('0x18')],'include':_0x3ced54[_0x4beb('0x1a')]?_[_0x4beb('0x1c')](_0x3ced54[_0x4beb('0x1a')],function(_0x120cac){return{'model':db[_0x120cac['model']],'as':_0x120cac['as'],'attributes':_0x120cac[_0x4beb('0x18')],'include':_0x120cac[_0x4beb('0x1a')]?_[_0x4beb('0x1c')](_0x120cac[_0x4beb('0x1a')],function(_0x2d5bc3){return{'model':db[_0x2d5bc3[_0x4beb('0x1b')]],'as':_0x2d5bc3['as'],'attributes':_0x2d5bc3[_0x4beb('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4beb('0xa')](function(_0x342fe4){logger[_0x4beb('0xb')]('ShowDeskAccount',_0x2d7ff2);logger['debug'](_0x4beb('0x21'),_0x2d7ff2,JSON['stringify'](_0x342fe4));_0x5a32b3(_0x342fe4);})[_0x4beb('0x13')](function(_0x185844){logger[_0x4beb('0x10')](_0x4beb('0x21'),_0x185844[_0x4beb('0x12')],_0x2d7ff2);_0x3ca3af(_0xe1a1e0['error'](0x1f4,_0x185844[_0x4beb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index d7a524a..916e50e 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 _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x301ae2,_0x4de8bd){var _0x5f2990=function(_0x344343){while(--_0x344343){_0x301ae2['push'](_0x301ae2['shift']());}};_0x5f2990(++_0x4de8bd);}(_0xedd9,0xfc));var _0x9edd=function(_0x1ac7ef,_0x7677d7){_0x1ac7ef=_0x1ac7ef-0x0;var _0x447d70=_0xedd9[_0x1ac7ef];return _0x447d70;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file +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(_0x227c6d,_0x2f3d46){var _0x4a27b9=function(_0xd6200c){while(--_0xd6200c){_0x227c6d['push'](_0x227c6d['shift']());}};_0x4a27b9(++_0x2f3d46);}(_0x008c,0x188));var _0xc008=function(_0x3275fb,_0x19f753){_0x3275fb=_0x3275fb-0x0;var _0x1323d4=_0x008c[_0x3275fb];return _0x1323d4;};'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 240f09e..60ad024 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 _0x28fe=['STRING','exports'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x28fe,0x185));var _0xe28f=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x28fe[_0x45b034];return _0x509cb0;};'use strict';var Sequelize=require('sequelize');module[_0xe28f('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe28f('0x1')]}}; \ No newline at end of file +var _0x6151=['sequelize','exports','STRING'];(function(_0x5c506d,_0x1fc2e5){var _0xe19179=function(_0x488927){while(--_0x488927){_0x5c506d['push'](_0x5c506d['shift']());}};_0xe19179(++_0x1fc2e5);}(_0x6151,0x7e));var _0x1615=function(_0x3888bc,_0x3539a2){_0x3888bc=_0x3888bc-0x0;var _0x59d7c1=_0x6151[_0x3888bc];return _0x59d7c1;};'use strict';var Sequelize=require(_0x1615('0x0'));module[_0x1615('0x1')]={'name':{'type':Sequelize[_0x1615('0x2')]},'description':{'type':Sequelize[_0x1615('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 1372932..5f32053 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 _0xcbc4=['error','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','key','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','includeAll','include','catch','show','params','options','find','create','body','getFields','findOne','pick','getSubjects','DeskField','getDescriptions','getTags','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xcbc4,0x12b));var _0x4cbc=function(_0x5d8afb,_0x1ba566){_0x5d8afb=_0x5d8afb-0x0;var _0x3dcf6e=_0xcbc4[_0x5d8afb];return _0x3dcf6e;};'use strict';var emlformat=require(_0x4cbc('0x0'));var rimraf=require(_0x4cbc('0x1'));var zipdir=require(_0x4cbc('0x2'));var jsonpatch=require(_0x4cbc('0x3'));var rp=require(_0x4cbc('0x4'));var moment=require(_0x4cbc('0x5'));var BPromise=require(_0x4cbc('0x6'));var Mustache=require(_0x4cbc('0x7'));var util=require(_0x4cbc('0x8'));var path=require(_0x4cbc('0x9'));var sox=require(_0x4cbc('0xa'));var csv=require(_0x4cbc('0xb'));var ejs=require(_0x4cbc('0xc'));var fs=require('fs');var fs_extra=require(_0x4cbc('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4cbc('0xe'));var deskjs=require(_0x4cbc('0xf'));var toCsv=require(_0x4cbc('0xb'));var querystring=require(_0x4cbc('0x10'));var Papa=require('papaparse');var Redis=require(_0x4cbc('0x11'));var authService=require(_0x4cbc('0x12'));var qs=require(_0x4cbc('0x13'));var as=require(_0x4cbc('0x14'));var hardwareService=require(_0x4cbc('0x15'));var logger=require(_0x4cbc('0x16'))(_0x4cbc('0x17'));var utils=require(_0x4cbc('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x4cbc('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x220db8,_0x4a4268){_0x4a4268=_0x4a4268||0xcc;return function(_0x197287){if(_0x197287){return _0x220db8[_0x4cbc('0x1a')](_0x4a4268);}return _0x220db8[_0x4cbc('0x1b')](_0x4a4268)[_0x4cbc('0x1c')]();};}function respondWithResult(_0x41e6db,_0x1e1a22){_0x1e1a22=_0x1e1a22||0xc8;return function(_0x496ceb){if(_0x496ceb){return _0x41e6db['status'](_0x1e1a22)[_0x4cbc('0x1d')](_0x496ceb);}};}function respondWithFilteredResult(_0x198ac1,_0x160231){return function(_0x52cfff){if(_0x52cfff){var _0x5c371b=typeof _0x160231[_0x4cbc('0x1e')]===_0x4cbc('0x1f')&&typeof _0x160231[_0x4cbc('0x20')]===_0x4cbc('0x1f');var _0x472d66=_0x52cfff['count'];var _0x433ecd=_0x5c371b?0x0:_0x160231[_0x4cbc('0x1e')];var _0x17d89a=_0x5c371b?_0x52cfff[_0x4cbc('0x21')]:_0x160231[_0x4cbc('0x1e')]+_0x160231['limit'];var _0x32899c;if(_0x17d89a>=_0x472d66){_0x17d89a=_0x472d66;_0x32899c=0xc8;}else{_0x32899c=0xce;}_0x198ac1[_0x4cbc('0x1b')](_0x32899c);return _0x198ac1[_0x4cbc('0x22')](_0x4cbc('0x23'),_0x433ecd+'-'+_0x17d89a+'/'+_0x472d66)[_0x4cbc('0x1d')](_0x52cfff);}return null;};}function patchUpdates(_0x23ada8){return function(_0x321bcd){try{jsonpatch[_0x4cbc('0x24')](_0x321bcd,_0x23ada8,!![]);}catch(_0x354dd6){return BPromise['reject'](_0x354dd6);}return _0x321bcd[_0x4cbc('0x25')]();};}function saveUpdates(_0x5edcbf,_0x1f5e45){return function(_0x5771ee){if(_0x5771ee){return _0x5771ee[_0x4cbc('0x26')](_0x5edcbf)[_0x4cbc('0x27')](function(_0x1358b3){return _0x1358b3;});}return null;};}function removeEntity(_0x1076bf,_0x1bced6){return function(_0x24bb07){if(_0x24bb07){return _0x24bb07[_0x4cbc('0x28')]()[_0x4cbc('0x27')](function(){_0x1076bf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x418be2,_0x451cc6){return function(_0x9027fe){if(!_0x9027fe){_0x418be2[_0x4cbc('0x1a')](0x194);}return _0x9027fe;};}function handleError(_0x110f49,_0x402a76){_0x402a76=_0x402a76||0x1f4;return function(_0x460eed){logger[_0x4cbc('0x29')](_0x460eed[_0x4cbc('0x2a')]);if(_0x460eed[_0x4cbc('0x2b')]){delete _0x460eed[_0x4cbc('0x2b')];}_0x110f49[_0x4cbc('0x1b')](_0x402a76)[_0x4cbc('0x2c')](_0x460eed);};}exports[_0x4cbc('0x2d')]=function(_0x2626b8,_0x1c2118){var _0x41ff43={},_0x3e3eb6={},_0x4c946f={'count':0x0,'rows':[]};var _0x3ddcc4=_[_0x4cbc('0x2e')](db[_0x4cbc('0x2f')][_0x4cbc('0x30')],function(_0x4ef477){return{'name':_0x4ef477[_0x4cbc('0x31')],'type':_0x4ef477['type'][_0x4cbc('0x32')]};});_0x3e3eb6[_0x4cbc('0x33')]=_[_0x4cbc('0x2e')](_0x3ddcc4,_0x4cbc('0x2b'));_0x3e3eb6['query']=_[_0x4cbc('0x34')](_0x2626b8['query']);_0x3e3eb6['filters']=_[_0x4cbc('0x35')](_0x3e3eb6['model'],_0x3e3eb6[_0x4cbc('0x36')]);_0x41ff43['attributes']=_[_0x4cbc('0x35')](_0x3e3eb6[_0x4cbc('0x33')],qs[_0x4cbc('0x37')](_0x2626b8['query'][_0x4cbc('0x37')]));_0x41ff43[_0x4cbc('0x38')]=_0x41ff43[_0x4cbc('0x38')][_0x4cbc('0x39')]?_0x41ff43[_0x4cbc('0x38')]:_0x3e3eb6['model'];if(!_0x2626b8[_0x4cbc('0x36')][_0x4cbc('0x3a')](_0x4cbc('0x3b'))){_0x41ff43['limit']=qs['limit'](_0x2626b8[_0x4cbc('0x36')][_0x4cbc('0x20')]);_0x41ff43['offset']=qs[_0x4cbc('0x1e')](_0x2626b8[_0x4cbc('0x36')][_0x4cbc('0x1e')]);}_0x41ff43[_0x4cbc('0x3c')]=qs[_0x4cbc('0x3d')](_0x2626b8[_0x4cbc('0x36')][_0x4cbc('0x3d')]);_0x41ff43[_0x4cbc('0x3e')]=qs[_0x4cbc('0x3f')](_['pick'](_0x2626b8['query'],_0x3e3eb6[_0x4cbc('0x3f')]),_0x3ddcc4);if(_0x2626b8[_0x4cbc('0x36')][_0x4cbc('0x40')]){_0x41ff43[_0x4cbc('0x3e')]=_[_0x4cbc('0x41')](_0x41ff43[_0x4cbc('0x3e')],{'$or':_[_0x4cbc('0x2e')](_0x3ddcc4,function(_0x4d5d7f){if(_0x4d5d7f[_0x4cbc('0x42')]!==_0x4cbc('0x43')){var _0x183556={};_0x183556[_0x4d5d7f[_0x4cbc('0x2b')]]={'$like':'%'+_0x2626b8[_0x4cbc('0x36')]['filter']+'%'};return _0x183556;}})});}_0x41ff43=_[_0x4cbc('0x41')]({},_0x41ff43,_0x2626b8['options']);var _0x4836de={'where':_0x41ff43['where']};return db[_0x4cbc('0x2f')][_0x4cbc('0x21')](_0x4836de)[_0x4cbc('0x27')](function(_0x141f25){_0x4c946f['count']=_0x141f25;if(_0x2626b8[_0x4cbc('0x36')][_0x4cbc('0x44')]){_0x41ff43[_0x4cbc('0x45')]=[{'all':!![]}];}return db[_0x4cbc('0x2f')]['findAll'](_0x41ff43);})['then'](function(_0x35dc8b){_0x4c946f['rows']=_0x35dc8b;return _0x4c946f;})[_0x4cbc('0x27')](respondWithFilteredResult(_0x1c2118,_0x41ff43))[_0x4cbc('0x46')](handleError(_0x1c2118,null));};exports[_0x4cbc('0x47')]=function(_0x141398,_0x17df29){var _0xd70047={'raw':![],'where':{'id':_0x141398[_0x4cbc('0x48')]['id']}},_0x5edcab={};_0x5edcab[_0x4cbc('0x33')]=_[_0x4cbc('0x34')](db[_0x4cbc('0x2f')][_0x4cbc('0x30')]);_0x5edcab['query']=_[_0x4cbc('0x34')](_0x141398[_0x4cbc('0x36')]);_0x5edcab[_0x4cbc('0x3f')]=_[_0x4cbc('0x35')](_0x5edcab[_0x4cbc('0x33')],_0x5edcab[_0x4cbc('0x36')]);_0xd70047['attributes']=_[_0x4cbc('0x35')](_0x5edcab[_0x4cbc('0x33')],qs[_0x4cbc('0x37')](_0x141398[_0x4cbc('0x36')]['fields']));_0xd70047['attributes']=_0xd70047[_0x4cbc('0x38')]['length']?_0xd70047['attributes']:_0x5edcab[_0x4cbc('0x33')];if(_0x141398[_0x4cbc('0x36')][_0x4cbc('0x44')]){_0xd70047[_0x4cbc('0x45')]=[{'all':!![]}];}_0xd70047=_[_0x4cbc('0x41')]({},_0xd70047,_0x141398[_0x4cbc('0x49')]);return db[_0x4cbc('0x2f')][_0x4cbc('0x4a')](_0xd70047)[_0x4cbc('0x27')](handleEntityNotFound(_0x17df29,null))['then'](respondWithResult(_0x17df29,null))[_0x4cbc('0x46')](handleError(_0x17df29,null));};exports[_0x4cbc('0x4b')]=function(_0x4491a2,_0x23521f){return db[_0x4cbc('0x2f')][_0x4cbc('0x4b')](_0x4491a2[_0x4cbc('0x4c')],{})['then'](respondWithResult(_0x23521f,0xc9))[_0x4cbc('0x46')](handleError(_0x23521f,null));};exports['update']=function(_0x333010,_0x4269cb){if(_0x333010[_0x4cbc('0x4c')]['id']){delete _0x333010[_0x4cbc('0x4c')]['id'];}return db[_0x4cbc('0x2f')][_0x4cbc('0x4a')]({'where':{'id':_0x333010[_0x4cbc('0x48')]['id']}})[_0x4cbc('0x27')](handleEntityNotFound(_0x4269cb,null))['then'](saveUpdates(_0x333010[_0x4cbc('0x4c')],null))['then'](respondWithResult(_0x4269cb,null))[_0x4cbc('0x46')](handleError(_0x4269cb,null));};exports[_0x4cbc('0x28')]=function(_0x1a740d,_0x3df848){return db[_0x4cbc('0x2f')][_0x4cbc('0x4a')]({'where':{'id':_0x1a740d[_0x4cbc('0x48')]['id']}})['then'](handleEntityNotFound(_0x3df848,null))[_0x4cbc('0x27')](removeEntity(_0x3df848,null))[_0x4cbc('0x46')](handleError(_0x3df848,null));};exports[_0x4cbc('0x4d')]=function(_0x459368,_0x563612,_0x1b026f){var _0xa053e3={};var _0x3d8886={};var _0x3c8bfe;var _0x154d6f;return db[_0x4cbc('0x2f')][_0x4cbc('0x4e')]({'where':{'id':_0x459368[_0x4cbc('0x48')]['id']}})['then'](handleEntityNotFound(_0x563612,null))['then'](function(_0x2199ef){if(_0x2199ef){_0x3c8bfe=_0x2199ef;_0x3d8886[_0x4cbc('0x33')]=_[_0x4cbc('0x34')](db['DeskField'][_0x4cbc('0x30')]);_0x3d8886['query']=_['keys'](_0x459368[_0x4cbc('0x36')]);_0x3d8886['filters']=_[_0x4cbc('0x35')](_0x3d8886['model'],_0x3d8886[_0x4cbc('0x36')]);_0xa053e3[_0x4cbc('0x38')]=_[_0x4cbc('0x35')](_0x3d8886[_0x4cbc('0x33')],qs[_0x4cbc('0x37')](_0x459368[_0x4cbc('0x36')][_0x4cbc('0x37')]));_0xa053e3['attributes']=_0xa053e3[_0x4cbc('0x38')][_0x4cbc('0x39')]?_0xa053e3[_0x4cbc('0x38')]:_0x3d8886['model'];_0xa053e3[_0x4cbc('0x3c')]=qs[_0x4cbc('0x3d')](_0x459368[_0x4cbc('0x36')][_0x4cbc('0x3d')]);_0xa053e3[_0x4cbc('0x3e')]=qs['filters'](_[_0x4cbc('0x4f')](_0x459368['query'],_0x3d8886[_0x4cbc('0x3f')]));if(_0x459368[_0x4cbc('0x36')][_0x4cbc('0x40')]){_0xa053e3['where']=_['merge'](_0xa053e3[_0x4cbc('0x3e')],{'$or':_[_0x4cbc('0x2e')](_0xa053e3[_0x4cbc('0x38')],function(_0x2bcb53){var _0x300730={};_0x300730[_0x2bcb53]={'$like':'%'+_0x459368[_0x4cbc('0x36')][_0x4cbc('0x40')]+'%'};return _0x300730;})});}_0xa053e3=_[_0x4cbc('0x41')]({},_0xa053e3,_0x459368[_0x4cbc('0x49')]);return _0x3c8bfe[_0x4cbc('0x4d')](_0xa053e3);}})[_0x4cbc('0x27')](function(_0x52f8a6){if(_0x52f8a6){_0x154d6f=_0x52f8a6[_0x4cbc('0x39')];if(!_0x459368[_0x4cbc('0x36')][_0x4cbc('0x3a')](_0x4cbc('0x3b'))){_0xa053e3[_0x4cbc('0x20')]=qs[_0x4cbc('0x20')](_0x459368[_0x4cbc('0x36')][_0x4cbc('0x20')]);_0xa053e3['offset']=qs[_0x4cbc('0x1e')](_0x459368[_0x4cbc('0x36')][_0x4cbc('0x1e')]);}return _0x3c8bfe[_0x4cbc('0x4d')](_0xa053e3);}})[_0x4cbc('0x27')](function(_0x26b0cb){if(_0x26b0cb){return _0x26b0cb?{'count':_0x154d6f,'rows':_0x26b0cb}:null;}})[_0x4cbc('0x27')](respondWithResult(_0x563612,null))[_0x4cbc('0x46')](handleError(_0x563612,null));};exports[_0x4cbc('0x50')]=function(_0xba99ff,_0x2d9232,_0x82fe81){var _0x5bc0bc={};var _0x4faf00={};var _0x50bf7c;var _0x23337d;return db[_0x4cbc('0x2f')][_0x4cbc('0x4e')]({'where':{'id':_0xba99ff[_0x4cbc('0x48')]['id']}})['then'](handleEntityNotFound(_0x2d9232,null))['then'](function(_0x29c6b4){if(_0x29c6b4){_0x50bf7c=_0x29c6b4;_0x4faf00[_0x4cbc('0x33')]=_['keys'](db[_0x4cbc('0x51')][_0x4cbc('0x30')]);_0x4faf00['query']=_[_0x4cbc('0x34')](_0xba99ff[_0x4cbc('0x36')]);_0x4faf00[_0x4cbc('0x3f')]=_[_0x4cbc('0x35')](_0x4faf00['model'],_0x4faf00[_0x4cbc('0x36')]);_0x5bc0bc['attributes']=_[_0x4cbc('0x35')](_0x4faf00[_0x4cbc('0x33')],qs[_0x4cbc('0x37')](_0xba99ff[_0x4cbc('0x36')][_0x4cbc('0x37')]));_0x5bc0bc[_0x4cbc('0x38')]=_0x5bc0bc[_0x4cbc('0x38')][_0x4cbc('0x39')]?_0x5bc0bc[_0x4cbc('0x38')]:_0x4faf00[_0x4cbc('0x33')];_0x5bc0bc[_0x4cbc('0x3c')]=qs[_0x4cbc('0x3d')](_0xba99ff[_0x4cbc('0x36')]['sort']);_0x5bc0bc[_0x4cbc('0x3e')]=qs[_0x4cbc('0x3f')](_['pick'](_0xba99ff[_0x4cbc('0x36')],_0x4faf00[_0x4cbc('0x3f')]));if(_0xba99ff[_0x4cbc('0x36')][_0x4cbc('0x40')]){_0x5bc0bc['where']=_['merge'](_0x5bc0bc[_0x4cbc('0x3e')],{'$or':_[_0x4cbc('0x2e')](_0x5bc0bc['attributes'],function(_0x37ef9e){var _0x189c41={};_0x189c41[_0x37ef9e]={'$like':'%'+_0xba99ff[_0x4cbc('0x36')][_0x4cbc('0x40')]+'%'};return _0x189c41;})});}_0x5bc0bc=_[_0x4cbc('0x41')]({},_0x5bc0bc,_0xba99ff[_0x4cbc('0x49')]);return _0x50bf7c[_0x4cbc('0x50')](_0x5bc0bc);}})[_0x4cbc('0x27')](function(_0x26154d){if(_0x26154d){_0x23337d=_0x26154d[_0x4cbc('0x39')];if(!_0xba99ff[_0x4cbc('0x36')][_0x4cbc('0x3a')](_0x4cbc('0x3b'))){_0x5bc0bc[_0x4cbc('0x20')]=qs[_0x4cbc('0x20')](_0xba99ff[_0x4cbc('0x36')][_0x4cbc('0x20')]);_0x5bc0bc[_0x4cbc('0x1e')]=qs[_0x4cbc('0x1e')](_0xba99ff[_0x4cbc('0x36')]['offset']);}return _0x50bf7c[_0x4cbc('0x50')](_0x5bc0bc);}})[_0x4cbc('0x27')](function(_0x460107){if(_0x460107){return _0x460107?{'count':_0x23337d,'rows':_0x460107}:null;}})['then'](respondWithResult(_0x2d9232,null))['catch'](handleError(_0x2d9232,null));};exports[_0x4cbc('0x52')]=function(_0x29c273,_0x425984,_0x29cfc0){var _0x4dbb72={};var _0x465cfd={};var _0x2db045;var _0x5bc263;return db['DeskConfiguration'][_0x4cbc('0x4e')]({'where':{'id':_0x29c273[_0x4cbc('0x48')]['id']}})['then'](handleEntityNotFound(_0x425984,null))[_0x4cbc('0x27')](function(_0x105627){if(_0x105627){_0x2db045=_0x105627;_0x465cfd['model']=_[_0x4cbc('0x34')](db['DeskField'][_0x4cbc('0x30')]);_0x465cfd[_0x4cbc('0x36')]=_[_0x4cbc('0x34')](_0x29c273[_0x4cbc('0x36')]);_0x465cfd[_0x4cbc('0x3f')]=_[_0x4cbc('0x35')](_0x465cfd[_0x4cbc('0x33')],_0x465cfd[_0x4cbc('0x36')]);_0x4dbb72[_0x4cbc('0x38')]=_['intersection'](_0x465cfd[_0x4cbc('0x33')],qs['fields'](_0x29c273[_0x4cbc('0x36')][_0x4cbc('0x37')]));_0x4dbb72[_0x4cbc('0x38')]=_0x4dbb72[_0x4cbc('0x38')][_0x4cbc('0x39')]?_0x4dbb72[_0x4cbc('0x38')]:_0x465cfd[_0x4cbc('0x33')];_0x4dbb72[_0x4cbc('0x3c')]=qs[_0x4cbc('0x3d')](_0x29c273[_0x4cbc('0x36')][_0x4cbc('0x3d')]);_0x4dbb72[_0x4cbc('0x3e')]=qs[_0x4cbc('0x3f')](_['pick'](_0x29c273[_0x4cbc('0x36')],_0x465cfd[_0x4cbc('0x3f')]));if(_0x29c273[_0x4cbc('0x36')]['filter']){_0x4dbb72[_0x4cbc('0x3e')]=_[_0x4cbc('0x41')](_0x4dbb72[_0x4cbc('0x3e')],{'$or':_['map'](_0x4dbb72['attributes'],function(_0x31e05a){var _0x5c0330={};_0x5c0330[_0x31e05a]={'$like':'%'+_0x29c273['query'][_0x4cbc('0x40')]+'%'};return _0x5c0330;})});}_0x4dbb72=_['merge']({},_0x4dbb72,_0x29c273['options']);return _0x2db045[_0x4cbc('0x52')](_0x4dbb72);}})[_0x4cbc('0x27')](function(_0x2303ab){if(_0x2303ab){_0x5bc263=_0x2303ab[_0x4cbc('0x39')];if(!_0x29c273[_0x4cbc('0x36')][_0x4cbc('0x3a')](_0x4cbc('0x3b'))){_0x4dbb72[_0x4cbc('0x20')]=qs[_0x4cbc('0x20')](_0x29c273['query']['limit']);_0x4dbb72[_0x4cbc('0x1e')]=qs[_0x4cbc('0x1e')](_0x29c273['query'][_0x4cbc('0x1e')]);}return _0x2db045[_0x4cbc('0x52')](_0x4dbb72);}})['then'](function(_0x199ff8){if(_0x199ff8){return _0x199ff8?{'count':_0x5bc263,'rows':_0x199ff8}:null;}})[_0x4cbc('0x27')](respondWithResult(_0x425984,null))[_0x4cbc('0x46')](handleError(_0x425984,null));};exports[_0x4cbc('0x53')]=function(_0x4f47cf,_0x2ff4ba,_0x20e5ae){var _0xdc7a51={};var _0x1e5219={};var _0x1507d3;var _0x3a945a;return db[_0x4cbc('0x2f')][_0x4cbc('0x4e')]({'where':{'id':_0x4f47cf[_0x4cbc('0x48')]['id']}})['then'](handleEntityNotFound(_0x2ff4ba,null))[_0x4cbc('0x27')](function(_0x2cb0af){if(_0x2cb0af){_0x1507d3=_0x2cb0af;_0x1e5219[_0x4cbc('0x33')]=_[_0x4cbc('0x34')](db['Tag'][_0x4cbc('0x30')]);_0x1e5219[_0x4cbc('0x36')]=_['keys'](_0x4f47cf['query']);_0x1e5219[_0x4cbc('0x3f')]=_[_0x4cbc('0x35')](_0x1e5219[_0x4cbc('0x33')],_0x1e5219[_0x4cbc('0x36')]);_0xdc7a51[_0x4cbc('0x38')]=_[_0x4cbc('0x35')](_0x1e5219[_0x4cbc('0x33')],qs[_0x4cbc('0x37')](_0x4f47cf[_0x4cbc('0x36')][_0x4cbc('0x37')]));_0xdc7a51[_0x4cbc('0x38')]=_0xdc7a51[_0x4cbc('0x38')][_0x4cbc('0x39')]?_0xdc7a51[_0x4cbc('0x38')]:_0x1e5219[_0x4cbc('0x33')];_0xdc7a51[_0x4cbc('0x3c')]=qs[_0x4cbc('0x3d')](_0x4f47cf[_0x4cbc('0x36')]['sort']);_0xdc7a51[_0x4cbc('0x3e')]=qs['filters'](_[_0x4cbc('0x4f')](_0x4f47cf[_0x4cbc('0x36')],_0x1e5219[_0x4cbc('0x3f')]));if(_0x4f47cf[_0x4cbc('0x36')]['filter']){_0xdc7a51[_0x4cbc('0x3e')]=_[_0x4cbc('0x41')](_0xdc7a51[_0x4cbc('0x3e')],{'$or':_['map'](_0xdc7a51[_0x4cbc('0x38')],function(_0x551d26){var _0x401325={};_0x401325[_0x551d26]={'$like':'%'+_0x4f47cf[_0x4cbc('0x36')]['filter']+'%'};return _0x401325;})});}_0xdc7a51=_['merge']({},_0xdc7a51,_0x4f47cf[_0x4cbc('0x49')]);return _0x1507d3['getTags'](_0xdc7a51);}})[_0x4cbc('0x27')](function(_0x179781){if(_0x179781){_0x3a945a=_0x179781[_0x4cbc('0x39')];if(!_0x4f47cf[_0x4cbc('0x36')][_0x4cbc('0x3a')](_0x4cbc('0x3b'))){_0xdc7a51[_0x4cbc('0x20')]=qs[_0x4cbc('0x20')](_0x4f47cf['query'][_0x4cbc('0x20')]);_0xdc7a51[_0x4cbc('0x1e')]=qs[_0x4cbc('0x1e')](_0x4f47cf[_0x4cbc('0x36')][_0x4cbc('0x1e')]);}return _0x1507d3[_0x4cbc('0x53')](_0xdc7a51);}})[_0x4cbc('0x27')](function(_0x5ec809){if(_0x5ec809){return _0x5ec809?{'count':_0x3a945a,'rows':_0x5ec809}:null;}})[_0x4cbc('0x27')](respondWithResult(_0x2ff4ba,null))[_0x4cbc('0x46')](handleError(_0x2ff4ba,null));};exports[_0x4cbc('0x54')]=function(_0xe611cb,_0x3ab147,_0x317219){if(_0xe611cb[_0x4cbc('0x4c')]['id']){delete _0xe611cb[_0x4cbc('0x4c')]['id'];}return db['DeskConfiguration'][_0x4cbc('0x4e')]({'where':{'id':_0xe611cb['params']['id']}})[_0x4cbc('0x27')](handleEntityNotFound(_0x3ab147,null))['then'](function(_0x141802){if(_0x141802){return _0x141802[_0x4cbc('0x54')](_0xe611cb['body']['ids']||[]);}return null;})[_0x4cbc('0x27')](respondWithResult(_0x3ab147,null))['catch'](handleError(_0x3ab147,null));}; \ No newline at end of file +var _0x6bbd=['to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','stack','name','send','index','map','DeskConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','catch','rawAttributes','fields','create','body','find','params','destroy','getFields','findOne','DeskField','getSubjects','options','hasOwnProperty','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox'];(function(_0x5ba802,_0x34a96a){var _0x30866e=function(_0x2c3dd5){while(--_0x2c3dd5){_0x5ba802['push'](_0x5ba802['shift']());}};_0x30866e(++_0x34a96a);}(_0x6bbd,0x197));var _0xd6bb=function(_0x9d15f5,_0x16158f){_0x9d15f5=_0x9d15f5-0x0;var _0x1abfea=_0x6bbd[_0x9d15f5];return _0x1abfea;};'use strict';var emlformat=require(_0xd6bb('0x0'));var rimraf=require(_0xd6bb('0x1'));var zipdir=require(_0xd6bb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd6bb('0x3'));var moment=require('moment');var BPromise=require(_0xd6bb('0x4'));var Mustache=require(_0xd6bb('0x5'));var util=require(_0xd6bb('0x6'));var path=require('path');var sox=require(_0xd6bb('0x7'));var csv=require(_0xd6bb('0x8'));var ejs=require(_0xd6bb('0x9'));var fs=require('fs');var fs_extra=require(_0xd6bb('0xa'));var _=require(_0xd6bb('0xb'));var squel=require(_0xd6bb('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd6bb('0xd'));var toCsv=require(_0xd6bb('0x8'));var querystring=require(_0xd6bb('0xe'));var Papa=require(_0xd6bb('0xf'));var Redis=require(_0xd6bb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd6bb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6bb('0x12'));var logger=require(_0xd6bb('0x13'))(_0xd6bb('0x14'));var utils=require(_0xd6bb('0x15'));var config=require(_0xd6bb('0x16'));var licenseUtil=require(_0xd6bb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d576f,_0x1bf763){_0x1bf763=_0x1bf763||0xcc;return function(_0x34a3c7){if(_0x34a3c7){return _0x1d576f[_0xd6bb('0x18')](_0x1bf763);}return _0x1d576f['status'](_0x1bf763)[_0xd6bb('0x19')]();};}function respondWithResult(_0x1f9619,_0x1243e3){_0x1243e3=_0x1243e3||0xc8;return function(_0x1df6a1){if(_0x1df6a1){return _0x1f9619[_0xd6bb('0x1a')](_0x1243e3)[_0xd6bb('0x1b')](_0x1df6a1);}};}function respondWithFilteredResult(_0x1ecbe7,_0x3f9eee){return function(_0x442028){if(_0x442028){var _0x4fb5b6=typeof _0x3f9eee['offset']===_0xd6bb('0x1c')&&typeof _0x3f9eee[_0xd6bb('0x1d')]===_0xd6bb('0x1c');var _0xe07fac=_0x442028[_0xd6bb('0x1e')];var _0x287ae4=_0x4fb5b6?0x0:_0x3f9eee[_0xd6bb('0x1f')];var _0x243385=_0x4fb5b6?_0x442028[_0xd6bb('0x1e')]:_0x3f9eee['offset']+_0x3f9eee[_0xd6bb('0x1d')];var _0x37b0f8;if(_0x243385>=_0xe07fac){_0x243385=_0xe07fac;_0x37b0f8=0xc8;}else{_0x37b0f8=0xce;}_0x1ecbe7[_0xd6bb('0x1a')](_0x37b0f8);return _0x1ecbe7[_0xd6bb('0x20')]('Content-Range',_0x287ae4+'-'+_0x243385+'/'+_0xe07fac)['json'](_0x442028);}return null;};}function patchUpdates(_0x100d5f){return function(_0x29c2d5){try{jsonpatch[_0xd6bb('0x21')](_0x29c2d5,_0x100d5f,!![]);}catch(_0x363387){return BPromise[_0xd6bb('0x22')](_0x363387);}return _0x29c2d5[_0xd6bb('0x23')]();};}function saveUpdates(_0x20d8d7,_0x56ab73){return function(_0x14e3d7){if(_0x14e3d7){return _0x14e3d7[_0xd6bb('0x24')](_0x20d8d7)['then'](function(_0x43b0bd){return _0x43b0bd;});}return null;};}function removeEntity(_0x1c62a8,_0x4141cc){return function(_0x1c4663){if(_0x1c4663){return _0x1c4663['destroy']()[_0xd6bb('0x25')](function(){_0x1c62a8[_0xd6bb('0x1a')](0xcc)[_0xd6bb('0x19')]();});}};}function handleEntityNotFound(_0x438ece,_0x3c2960){return function(_0x53b752){if(!_0x53b752){_0x438ece[_0xd6bb('0x18')](0x194);}return _0x53b752;};}function handleError(_0x4f329b,_0x5f4278){_0x5f4278=_0x5f4278||0x1f4;return function(_0x329375){logger['error'](_0x329375[_0xd6bb('0x26')]);if(_0x329375[_0xd6bb('0x27')]){delete _0x329375[_0xd6bb('0x27')];}_0x4f329b[_0xd6bb('0x1a')](_0x5f4278)[_0xd6bb('0x28')](_0x329375);};}exports[_0xd6bb('0x29')]=function(_0x209a83,_0x2c82d3){var _0x120c15={},_0x241ae3={},_0x4525e6={'count':0x0,'rows':[]};var _0x41c9cc=_[_0xd6bb('0x2a')](db[_0xd6bb('0x2b')]['rawAttributes'],function(_0x1572b9){return{'name':_0x1572b9[_0xd6bb('0x2c')],'type':_0x1572b9[_0xd6bb('0x2d')][_0xd6bb('0x2e')]};});_0x241ae3[_0xd6bb('0x2f')]=_[_0xd6bb('0x2a')](_0x41c9cc,_0xd6bb('0x27'));_0x241ae3[_0xd6bb('0x30')]=_[_0xd6bb('0x31')](_0x209a83[_0xd6bb('0x30')]);_0x241ae3[_0xd6bb('0x32')]=_[_0xd6bb('0x33')](_0x241ae3['model'],_0x241ae3['query']);_0x120c15[_0xd6bb('0x34')]=_[_0xd6bb('0x33')](_0x241ae3[_0xd6bb('0x2f')],qs['fields'](_0x209a83[_0xd6bb('0x30')]['fields']));_0x120c15[_0xd6bb('0x34')]=_0x120c15['attributes'][_0xd6bb('0x35')]?_0x120c15[_0xd6bb('0x34')]:_0x241ae3[_0xd6bb('0x2f')];if(!_0x209a83[_0xd6bb('0x30')]['hasOwnProperty'](_0xd6bb('0x36'))){_0x120c15[_0xd6bb('0x1d')]=qs[_0xd6bb('0x1d')](_0x209a83[_0xd6bb('0x30')][_0xd6bb('0x1d')]);_0x120c15[_0xd6bb('0x1f')]=qs[_0xd6bb('0x1f')](_0x209a83[_0xd6bb('0x30')][_0xd6bb('0x1f')]);}_0x120c15[_0xd6bb('0x37')]=qs[_0xd6bb('0x38')](_0x209a83[_0xd6bb('0x30')][_0xd6bb('0x38')]);_0x120c15[_0xd6bb('0x39')]=qs['filters'](_[_0xd6bb('0x3a')](_0x209a83[_0xd6bb('0x30')],_0x241ae3[_0xd6bb('0x32')]),_0x41c9cc);if(_0x209a83[_0xd6bb('0x30')][_0xd6bb('0x3b')]){_0x120c15[_0xd6bb('0x39')]=_['merge'](_0x120c15[_0xd6bb('0x39')],{'$or':_['map'](_0x41c9cc,function(_0x36f3f6){if(_0x36f3f6[_0xd6bb('0x2d')]!==_0xd6bb('0x3c')){var _0x35a4dd={};_0x35a4dd[_0x36f3f6[_0xd6bb('0x27')]]={'$like':'%'+_0x209a83[_0xd6bb('0x30')][_0xd6bb('0x3b')]+'%'};return _0x35a4dd;}})});}_0x120c15=_[_0xd6bb('0x3d')]({},_0x120c15,_0x209a83['options']);var _0x40ef13={'where':_0x120c15[_0xd6bb('0x39')]};return db['DeskConfiguration'][_0xd6bb('0x1e')](_0x40ef13)['then'](function(_0x5f2a82){_0x4525e6['count']=_0x5f2a82;if(_0x209a83['query'][_0xd6bb('0x3e')]){_0x120c15[_0xd6bb('0x3f')]=[{'all':!![]}];}return db[_0xd6bb('0x2b')]['findAll'](_0x120c15);})[_0xd6bb('0x25')](function(_0x1119ee){_0x4525e6['rows']=_0x1119ee;return _0x4525e6;})[_0xd6bb('0x25')](respondWithFilteredResult(_0x2c82d3,_0x120c15))[_0xd6bb('0x40')](handleError(_0x2c82d3,null));};exports['show']=function(_0x5eb27e,_0x167d28){var _0x589dae={'raw':![],'where':{'id':_0x5eb27e['params']['id']}},_0x368c06={};_0x368c06[_0xd6bb('0x2f')]=_['keys'](db[_0xd6bb('0x2b')][_0xd6bb('0x41')]);_0x368c06[_0xd6bb('0x30')]=_[_0xd6bb('0x31')](_0x5eb27e[_0xd6bb('0x30')]);_0x368c06[_0xd6bb('0x32')]=_[_0xd6bb('0x33')](_0x368c06['model'],_0x368c06['query']);_0x589dae[_0xd6bb('0x34')]=_[_0xd6bb('0x33')](_0x368c06[_0xd6bb('0x2f')],qs[_0xd6bb('0x42')](_0x5eb27e[_0xd6bb('0x30')][_0xd6bb('0x42')]));_0x589dae['attributes']=_0x589dae['attributes'][_0xd6bb('0x35')]?_0x589dae[_0xd6bb('0x34')]:_0x368c06[_0xd6bb('0x2f')];if(_0x5eb27e[_0xd6bb('0x30')]['includeAll']){_0x589dae[_0xd6bb('0x3f')]=[{'all':!![]}];}_0x589dae=_['merge']({},_0x589dae,_0x5eb27e['options']);return db[_0xd6bb('0x2b')]['find'](_0x589dae)[_0xd6bb('0x25')](handleEntityNotFound(_0x167d28,null))[_0xd6bb('0x25')](respondWithResult(_0x167d28,null))[_0xd6bb('0x40')](handleError(_0x167d28,null));};exports[_0xd6bb('0x43')]=function(_0x3c7f47,_0x52160b){return db[_0xd6bb('0x2b')][_0xd6bb('0x43')](_0x3c7f47[_0xd6bb('0x44')],{})[_0xd6bb('0x25')](respondWithResult(_0x52160b,0xc9))[_0xd6bb('0x40')](handleError(_0x52160b,null));};exports[_0xd6bb('0x24')]=function(_0x3810bd,_0x415f85){if(_0x3810bd['body']['id']){delete _0x3810bd[_0xd6bb('0x44')]['id'];}return db[_0xd6bb('0x2b')][_0xd6bb('0x45')]({'where':{'id':_0x3810bd[_0xd6bb('0x46')]['id']}})[_0xd6bb('0x25')](handleEntityNotFound(_0x415f85,null))[_0xd6bb('0x25')](saveUpdates(_0x3810bd[_0xd6bb('0x44')],null))[_0xd6bb('0x25')](respondWithResult(_0x415f85,null))[_0xd6bb('0x40')](handleError(_0x415f85,null));};exports[_0xd6bb('0x47')]=function(_0x30e385,_0x32946b){return db[_0xd6bb('0x2b')][_0xd6bb('0x45')]({'where':{'id':_0x30e385[_0xd6bb('0x46')]['id']}})[_0xd6bb('0x25')](handleEntityNotFound(_0x32946b,null))[_0xd6bb('0x25')](removeEntity(_0x32946b,null))['catch'](handleError(_0x32946b,null));};exports[_0xd6bb('0x48')]=function(_0x578644,_0x574c43,_0x3d704a){var _0x109e14={};var _0x4edca8={};var _0x17fb82;var _0x3c7a19;return db[_0xd6bb('0x2b')][_0xd6bb('0x49')]({'where':{'id':_0x578644[_0xd6bb('0x46')]['id']}})[_0xd6bb('0x25')](handleEntityNotFound(_0x574c43,null))['then'](function(_0x5789c1){if(_0x5789c1){_0x17fb82=_0x5789c1;_0x4edca8[_0xd6bb('0x2f')]=_[_0xd6bb('0x31')](db[_0xd6bb('0x4a')][_0xd6bb('0x41')]);_0x4edca8[_0xd6bb('0x30')]=_[_0xd6bb('0x31')](_0x578644[_0xd6bb('0x30')]);_0x4edca8[_0xd6bb('0x32')]=_['intersection'](_0x4edca8[_0xd6bb('0x2f')],_0x4edca8['query']);_0x109e14[_0xd6bb('0x34')]=_['intersection'](_0x4edca8['model'],qs['fields'](_0x578644[_0xd6bb('0x30')][_0xd6bb('0x42')]));_0x109e14[_0xd6bb('0x34')]=_0x109e14[_0xd6bb('0x34')][_0xd6bb('0x35')]?_0x109e14[_0xd6bb('0x34')]:_0x4edca8['model'];_0x109e14[_0xd6bb('0x37')]=qs[_0xd6bb('0x38')](_0x578644[_0xd6bb('0x30')]['sort']);_0x109e14[_0xd6bb('0x39')]=qs[_0xd6bb('0x32')](_['pick'](_0x578644[_0xd6bb('0x30')],_0x4edca8['filters']));if(_0x578644[_0xd6bb('0x30')]['filter']){_0x109e14[_0xd6bb('0x39')]=_[_0xd6bb('0x3d')](_0x109e14['where'],{'$or':_['map'](_0x109e14[_0xd6bb('0x34')],function(_0x5f564f){var _0x465a46={};_0x465a46[_0x5f564f]={'$like':'%'+_0x578644[_0xd6bb('0x30')][_0xd6bb('0x3b')]+'%'};return _0x465a46;})});}_0x109e14=_[_0xd6bb('0x3d')]({},_0x109e14,_0x578644['options']);return _0x17fb82['getFields'](_0x109e14);}})[_0xd6bb('0x25')](function(_0x53b1d9){if(_0x53b1d9){_0x3c7a19=_0x53b1d9[_0xd6bb('0x35')];if(!_0x578644['query']['hasOwnProperty'](_0xd6bb('0x36'))){_0x109e14['limit']=qs[_0xd6bb('0x1d')](_0x578644[_0xd6bb('0x30')]['limit']);_0x109e14[_0xd6bb('0x1f')]=qs['offset'](_0x578644[_0xd6bb('0x30')][_0xd6bb('0x1f')]);}return _0x17fb82[_0xd6bb('0x48')](_0x109e14);}})[_0xd6bb('0x25')](function(_0x2f4f9d){if(_0x2f4f9d){return _0x2f4f9d?{'count':_0x3c7a19,'rows':_0x2f4f9d}:null;}})[_0xd6bb('0x25')](respondWithResult(_0x574c43,null))['catch'](handleError(_0x574c43,null));};exports[_0xd6bb('0x4b')]=function(_0x105231,_0x2ea215,_0x4587c9){var _0x283a06={};var _0x2e978d={};var _0x1a3e37;var _0xec5eee;return db['DeskConfiguration'][_0xd6bb('0x49')]({'where':{'id':_0x105231[_0xd6bb('0x46')]['id']}})[_0xd6bb('0x25')](handleEntityNotFound(_0x2ea215,null))[_0xd6bb('0x25')](function(_0x34260c){if(_0x34260c){_0x1a3e37=_0x34260c;_0x2e978d[_0xd6bb('0x2f')]=_[_0xd6bb('0x31')](db[_0xd6bb('0x4a')][_0xd6bb('0x41')]);_0x2e978d['query']=_[_0xd6bb('0x31')](_0x105231[_0xd6bb('0x30')]);_0x2e978d[_0xd6bb('0x32')]=_[_0xd6bb('0x33')](_0x2e978d[_0xd6bb('0x2f')],_0x2e978d[_0xd6bb('0x30')]);_0x283a06[_0xd6bb('0x34')]=_[_0xd6bb('0x33')](_0x2e978d[_0xd6bb('0x2f')],qs[_0xd6bb('0x42')](_0x105231[_0xd6bb('0x30')]['fields']));_0x283a06['attributes']=_0x283a06[_0xd6bb('0x34')][_0xd6bb('0x35')]?_0x283a06[_0xd6bb('0x34')]:_0x2e978d[_0xd6bb('0x2f')];_0x283a06[_0xd6bb('0x37')]=qs[_0xd6bb('0x38')](_0x105231['query'][_0xd6bb('0x38')]);_0x283a06[_0xd6bb('0x39')]=qs[_0xd6bb('0x32')](_['pick'](_0x105231[_0xd6bb('0x30')],_0x2e978d[_0xd6bb('0x32')]));if(_0x105231[_0xd6bb('0x30')][_0xd6bb('0x3b')]){_0x283a06['where']=_[_0xd6bb('0x3d')](_0x283a06[_0xd6bb('0x39')],{'$or':_[_0xd6bb('0x2a')](_0x283a06['attributes'],function(_0x2476ee){var _0x70ff57={};_0x70ff57[_0x2476ee]={'$like':'%'+_0x105231[_0xd6bb('0x30')][_0xd6bb('0x3b')]+'%'};return _0x70ff57;})});}_0x283a06=_[_0xd6bb('0x3d')]({},_0x283a06,_0x105231[_0xd6bb('0x4c')]);return _0x1a3e37[_0xd6bb('0x4b')](_0x283a06);}})['then'](function(_0x35ed42){if(_0x35ed42){_0xec5eee=_0x35ed42[_0xd6bb('0x35')];if(!_0x105231['query'][_0xd6bb('0x4d')](_0xd6bb('0x36'))){_0x283a06[_0xd6bb('0x1d')]=qs[_0xd6bb('0x1d')](_0x105231['query'][_0xd6bb('0x1d')]);_0x283a06[_0xd6bb('0x1f')]=qs[_0xd6bb('0x1f')](_0x105231[_0xd6bb('0x30')][_0xd6bb('0x1f')]);}return _0x1a3e37[_0xd6bb('0x4b')](_0x283a06);}})[_0xd6bb('0x25')](function(_0x3f6aa0){if(_0x3f6aa0){return _0x3f6aa0?{'count':_0xec5eee,'rows':_0x3f6aa0}:null;}})[_0xd6bb('0x25')](respondWithResult(_0x2ea215,null))[_0xd6bb('0x40')](handleError(_0x2ea215,null));};exports[_0xd6bb('0x4e')]=function(_0x38a9ed,_0x3e995c,_0x573c4f){var _0x5a31ba={};var _0x4e7ab3={};var _0x529dd5;var _0x5ecba8;return db[_0xd6bb('0x2b')][_0xd6bb('0x49')]({'where':{'id':_0x38a9ed[_0xd6bb('0x46')]['id']}})[_0xd6bb('0x25')](handleEntityNotFound(_0x3e995c,null))[_0xd6bb('0x25')](function(_0x214888){if(_0x214888){_0x529dd5=_0x214888;_0x4e7ab3['model']=_[_0xd6bb('0x31')](db['DeskField'][_0xd6bb('0x41')]);_0x4e7ab3[_0xd6bb('0x30')]=_[_0xd6bb('0x31')](_0x38a9ed[_0xd6bb('0x30')]);_0x4e7ab3[_0xd6bb('0x32')]=_['intersection'](_0x4e7ab3['model'],_0x4e7ab3[_0xd6bb('0x30')]);_0x5a31ba[_0xd6bb('0x34')]=_[_0xd6bb('0x33')](_0x4e7ab3['model'],qs['fields'](_0x38a9ed[_0xd6bb('0x30')]['fields']));_0x5a31ba['attributes']=_0x5a31ba[_0xd6bb('0x34')][_0xd6bb('0x35')]?_0x5a31ba[_0xd6bb('0x34')]:_0x4e7ab3[_0xd6bb('0x2f')];_0x5a31ba[_0xd6bb('0x37')]=qs[_0xd6bb('0x38')](_0x38a9ed[_0xd6bb('0x30')][_0xd6bb('0x38')]);_0x5a31ba[_0xd6bb('0x39')]=qs['filters'](_[_0xd6bb('0x3a')](_0x38a9ed['query'],_0x4e7ab3[_0xd6bb('0x32')]));if(_0x38a9ed['query']['filter']){_0x5a31ba[_0xd6bb('0x39')]=_[_0xd6bb('0x3d')](_0x5a31ba[_0xd6bb('0x39')],{'$or':_[_0xd6bb('0x2a')](_0x5a31ba[_0xd6bb('0x34')],function(_0x13fe46){var _0x3dd90b={};_0x3dd90b[_0x13fe46]={'$like':'%'+_0x38a9ed[_0xd6bb('0x30')]['filter']+'%'};return _0x3dd90b;})});}_0x5a31ba=_[_0xd6bb('0x3d')]({},_0x5a31ba,_0x38a9ed[_0xd6bb('0x4c')]);return _0x529dd5[_0xd6bb('0x4e')](_0x5a31ba);}})[_0xd6bb('0x25')](function(_0x42fe86){if(_0x42fe86){_0x5ecba8=_0x42fe86[_0xd6bb('0x35')];if(!_0x38a9ed[_0xd6bb('0x30')][_0xd6bb('0x4d')](_0xd6bb('0x36'))){_0x5a31ba[_0xd6bb('0x1d')]=qs['limit'](_0x38a9ed['query'][_0xd6bb('0x1d')]);_0x5a31ba[_0xd6bb('0x1f')]=qs[_0xd6bb('0x1f')](_0x38a9ed['query'][_0xd6bb('0x1f')]);}return _0x529dd5[_0xd6bb('0x4e')](_0x5a31ba);}})[_0xd6bb('0x25')](function(_0x10f02e){if(_0x10f02e){return _0x10f02e?{'count':_0x5ecba8,'rows':_0x10f02e}:null;}})['then'](respondWithResult(_0x3e995c,null))[_0xd6bb('0x40')](handleError(_0x3e995c,null));};exports[_0xd6bb('0x4f')]=function(_0x44f0a4,_0x2d7658,_0x4c0fd5){var _0x242341={};var _0x427bd3={};var _0x29a585;var _0xdd9970;return db[_0xd6bb('0x2b')]['findOne']({'where':{'id':_0x44f0a4[_0xd6bb('0x46')]['id']}})[_0xd6bb('0x25')](handleEntityNotFound(_0x2d7658,null))[_0xd6bb('0x25')](function(_0x49a454){if(_0x49a454){_0x29a585=_0x49a454;_0x427bd3[_0xd6bb('0x2f')]=_[_0xd6bb('0x31')](db[_0xd6bb('0x50')][_0xd6bb('0x41')]);_0x427bd3['query']=_[_0xd6bb('0x31')](_0x44f0a4[_0xd6bb('0x30')]);_0x427bd3[_0xd6bb('0x32')]=_['intersection'](_0x427bd3['model'],_0x427bd3[_0xd6bb('0x30')]);_0x242341[_0xd6bb('0x34')]=_[_0xd6bb('0x33')](_0x427bd3[_0xd6bb('0x2f')],qs[_0xd6bb('0x42')](_0x44f0a4[_0xd6bb('0x30')][_0xd6bb('0x42')]));_0x242341[_0xd6bb('0x34')]=_0x242341[_0xd6bb('0x34')][_0xd6bb('0x35')]?_0x242341[_0xd6bb('0x34')]:_0x427bd3[_0xd6bb('0x2f')];_0x242341[_0xd6bb('0x37')]=qs[_0xd6bb('0x38')](_0x44f0a4[_0xd6bb('0x30')][_0xd6bb('0x38')]);_0x242341[_0xd6bb('0x39')]=qs[_0xd6bb('0x32')](_[_0xd6bb('0x3a')](_0x44f0a4['query'],_0x427bd3[_0xd6bb('0x32')]));if(_0x44f0a4['query'][_0xd6bb('0x3b')]){_0x242341[_0xd6bb('0x39')]=_[_0xd6bb('0x3d')](_0x242341[_0xd6bb('0x39')],{'$or':_[_0xd6bb('0x2a')](_0x242341[_0xd6bb('0x34')],function(_0x5a9fc1){var _0x460a8f={};_0x460a8f[_0x5a9fc1]={'$like':'%'+_0x44f0a4['query'][_0xd6bb('0x3b')]+'%'};return _0x460a8f;})});}_0x242341=_[_0xd6bb('0x3d')]({},_0x242341,_0x44f0a4['options']);return _0x29a585[_0xd6bb('0x4f')](_0x242341);}})[_0xd6bb('0x25')](function(_0x2173cd){if(_0x2173cd){_0xdd9970=_0x2173cd['length'];if(!_0x44f0a4[_0xd6bb('0x30')]['hasOwnProperty'](_0xd6bb('0x36'))){_0x242341['limit']=qs[_0xd6bb('0x1d')](_0x44f0a4[_0xd6bb('0x30')]['limit']);_0x242341['offset']=qs[_0xd6bb('0x1f')](_0x44f0a4[_0xd6bb('0x30')][_0xd6bb('0x1f')]);}return _0x29a585['getTags'](_0x242341);}})[_0xd6bb('0x25')](function(_0x1ae996){if(_0x1ae996){return _0x1ae996?{'count':_0xdd9970,'rows':_0x1ae996}:null;}})['then'](respondWithResult(_0x2d7658,null))['catch'](handleError(_0x2d7658,null));};exports[_0xd6bb('0x51')]=function(_0x72ea20,_0x7a1a2a,_0x3b6a76){if(_0x72ea20[_0xd6bb('0x44')]['id']){delete _0x72ea20[_0xd6bb('0x44')]['id'];}return db[_0xd6bb('0x2b')][_0xd6bb('0x49')]({'where':{'id':_0x72ea20['params']['id']}})[_0xd6bb('0x25')](handleEntityNotFound(_0x7a1a2a,null))[_0xd6bb('0x25')](function(_0x58876e){if(_0x58876e){return _0x58876e['setTags'](_0x72ea20[_0xd6bb('0x44')][_0xd6bb('0x52')]||[]);}return null;})[_0xd6bb('0x25')](respondWithResult(_0x7a1a2a,null))[_0xd6bb('0x40')](handleError(_0x7a1a2a,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 74bac34..ef617e9 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 _0x1395=['path','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x50fda9,_0x5ee44b){var _0x36b92b=function(_0x121877){while(--_0x121877){_0x50fda9['push'](_0x50fda9['shift']());}};_0x36b92b(++_0x5ee44b);}(_0x1395,0xc2));var _0x5139=function(_0x4f3126,_0x1499d7){_0x4f3126=_0x4f3126-0x0;var _0x26bad4=_0x1395[_0x4f3126];return _0x26bad4;};'use strict';var _=require(_0x5139('0x0'));var util=require(_0x5139('0x1'));var logger=require(_0x5139('0x2'))(_0x5139('0x3'));var moment=require('moment');var BPromise=require(_0x5139('0x4'));var rp=require(_0x5139('0x5'));var fs=require('fs');var path=require(_0x5139('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDeskConfiguration.attributes');module['exports']=function(_0x16ffbc,_0x814fe9){return _0x16ffbc[_0x5139('0x7')](_0x5139('0x8'),attributes,{'tableName':_0x5139('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6727=['../../config/environment','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x4c01df,_0x1131c8){var _0xb87dd8=function(_0x53152f){while(--_0x53152f){_0x4c01df['push'](_0x4c01df['shift']());}};_0xb87dd8(++_0x1131c8);}(_0x6727,0x17a));var _0x7672=function(_0x163977,_0x4ef72e){_0x163977=_0x163977-0x0;var _0x28bf3a=_0x6727[_0x163977];return _0x28bf3a;};'use strict';var _=require(_0x7672('0x0'));var util=require(_0x7672('0x1'));var logger=require(_0x7672('0x2'))(_0x7672('0x3'));var moment=require(_0x7672('0x4'));var BPromise=require(_0x7672('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7672('0x6'));var rimraf=require('rimraf');var config=require(_0x7672('0x7'));var attributes=require('./intDeskConfiguration.attributes');module['exports']=function(_0x5693b6,_0x312e89){return _0x5693b6[_0x7672('0x8')](_0x7672('0x9'),attributes,{'tableName':_0x7672('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 601bc2c..d05a576 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 _0x49a1=['lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x57ed1c,_0xd33f1b){var _0x222b97=function(_0x156849){while(--_0x156849){_0x57ed1c['push'](_0x57ed1c['shift']());}};_0x222b97(++_0xd33f1b);}(_0x49a1,0x190));var _0x149a=function(_0x1482b0,_0x90da2e){_0x1482b0=_0x1482b0-0x0;var _0x323667=_0x49a1[_0x1482b0];return _0x323667;};'use strict';var _=require(_0x149a('0x0'));var util=require(_0x149a('0x1'));var moment=require(_0x149a('0x2'));var BPromise=require(_0x149a('0x3'));var rs=require(_0x149a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x149a('0x5'))(_0x149a('0x6'));var config=require('../../config/environment');var jayson=require(_0x149a('0x7'));var client=jayson[_0x149a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x872ee2,_0x50a30c,_0x138c81){return new BPromise(function(_0x208de9,_0x49a8c2){return client[_0x149a('0x9')](_0x872ee2,_0x138c81)[_0x149a('0xa')](function(_0x22ebe9){logger[_0x149a('0xb')](_0x149a('0xc'),_0x50a30c,_0x149a('0xd'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x50a30c,_0x149a('0xd'),JSON[_0x149a('0xe')](_0x22ebe9));if(_0x22ebe9[_0x149a('0xf')]){if(_0x22ebe9[_0x149a('0xf')][_0x149a('0x10')]===0x1f4){logger[_0x149a('0xf')](_0x149a('0xc'),_0x50a30c,_0x22ebe9['error']['message']);return _0x49a8c2(_0x22ebe9[_0x149a('0xf')]['message']);}logger[_0x149a('0xf')](_0x149a('0xc'),_0x50a30c,_0x22ebe9[_0x149a('0xf')][_0x149a('0x11')]);return _0x208de9(_0x22ebe9[_0x149a('0xf')][_0x149a('0x11')]);}else{logger[_0x149a('0xb')](_0x149a('0xc'),_0x50a30c,_0x149a('0xd'));_0x208de9(_0x22ebe9[_0x149a('0x12')]['message']);}})[_0x149a('0x13')](function(_0x47ea71){logger[_0x149a('0xf')](_0x149a('0xc'),_0x50a30c,_0x47ea71);_0x49a8c2(_0x47ea71);});});} \ No newline at end of file +var _0xd959=['../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5dd0a1,_0x28f1b8){var _0x596777=function(_0x1e6740){while(--_0x1e6740){_0x5dd0a1['push'](_0x5dd0a1['shift']());}};_0x596777(++_0x28f1b8);}(_0xd959,0x1f3));var _0x9d95=function(_0x519f1d,_0x27d999){_0x519f1d=_0x519f1d-0x0;var _0x28780a=_0xd959[_0x519f1d];return _0x28780a;};'use strict';var _=require(_0x9d95('0x0'));var util=require(_0x9d95('0x1'));var moment=require(_0x9d95('0x2'));var BPromise=require(_0x9d95('0x3'));var rs=require(_0x9d95('0x4'));var fs=require('fs');var Redis=require(_0x9d95('0x5'));var db=require(_0x9d95('0x6'))['db'];var utils=require(_0x9d95('0x7'));var logger=require(_0x9d95('0x8'))('rpc');var config=require(_0x9d95('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9d95('0xa')][_0x9d95('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34958e,_0x814b87,_0x4f7c4e){return new BPromise(function(_0x295c2d,_0x3a3f4c){return client[_0x9d95('0xc')](_0x34958e,_0x4f7c4e)[_0x9d95('0xd')](function(_0x2a6712){logger[_0x9d95('0xe')](_0x9d95('0xf'),_0x814b87,'request\x20sent');logger[_0x9d95('0x10')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x814b87,_0x9d95('0x11'),JSON[_0x9d95('0x12')](_0x2a6712));if(_0x2a6712[_0x9d95('0x13')]){if(_0x2a6712[_0x9d95('0x13')][_0x9d95('0x14')]===0x1f4){logger[_0x9d95('0x13')](_0x9d95('0xf'),_0x814b87,_0x2a6712['error'][_0x9d95('0x15')]);return _0x3a3f4c(_0x2a6712['error'][_0x9d95('0x15')]);}logger[_0x9d95('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x814b87,_0x2a6712['error'][_0x9d95('0x15')]);return _0x295c2d(_0x2a6712['error'][_0x9d95('0x15')]);}else{logger[_0x9d95('0xe')](_0x9d95('0xf'),_0x814b87,_0x9d95('0x11'));_0x295c2d(_0x2a6712[_0x9d95('0x16')][_0x9d95('0x15')]);}})['catch'](function(_0x3e061e){logger[_0x9d95('0x13')](_0x9d95('0xf'),_0x814b87,_0x3e061e);_0x3a3f4c(_0x3e061e);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index f02904b..d7b149d 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 _0xf14f=['show','post','create','put','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x5f1df6,_0xeb9b36){var _0x516679=function(_0x16ee3d){while(--_0x16ee3d){_0x5f1df6['push'](_0x5f1df6['shift']());}};_0x516679(++_0xeb9b36);}(_0xf14f,0x1e2));var _0xff14=function(_0x49a57c,_0x2eb02c){_0x49a57c=_0x49a57c-0x0;var _0x4e0316=_0xf14f[_0x49a57c];return _0x4e0316;};'use strict';var multer=require('multer');var util=require(_0xff14('0x0'));var path=require(_0xff14('0x1'));var timeout=require(_0xff14('0x2'));var express=require('express');var router=express[_0xff14('0x3')]();var fs_extra=require(_0xff14('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xff14('0x5'));var config=require(_0xff14('0x6'));var controller=require(_0xff14('0x7'));router[_0xff14('0x8')]('/',auth[_0xff14('0x9')](),controller[_0xff14('0xa')]);router[_0xff14('0x8')](_0xff14('0xb'),auth[_0xff14('0x9')](),controller[_0xff14('0xc')]);router[_0xff14('0xd')]('/',auth['isAuthenticated'](),controller[_0xff14('0xe')]);router[_0xff14('0xf')](_0xff14('0xb'),auth['isAuthenticated'](),controller[_0xff14('0x10')]);router['delete'](_0xff14('0xb'),auth[_0xff14('0x9')](),controller[_0xff14('0x11')]);module[_0xff14('0x12')]=router; \ No newline at end of file +var _0xd210=['put','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','isAuthenticated','show','post','create'];(function(_0x5c8b72,_0x37bbd7){var _0x38a5d0=function(_0x3f53e2){while(--_0x3f53e2){_0x5c8b72['push'](_0x5c8b72['shift']());}};_0x38a5d0(++_0x37bbd7);}(_0xd210,0x125));var _0x0d21=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xd210[_0x176329];return _0x31997c;};'use strict';var multer=require('multer');var util=require(_0x0d21('0x0'));var path=require(_0x0d21('0x1'));var timeout=require(_0x0d21('0x2'));var express=require(_0x0d21('0x3'));var router=express[_0x0d21('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0d21('0x5'));var interaction=require(_0x0d21('0x6'));var config=require('../../config/environment');var controller=require(_0x0d21('0x7'));router[_0x0d21('0x8')]('/',auth[_0x0d21('0x9')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x0d21('0xa')]);router[_0x0d21('0xb')]('/',auth[_0x0d21('0x9')](),controller[_0x0d21('0xc')]);router[_0x0d21('0xd')](_0x0d21('0xe'),auth['isAuthenticated'](),controller[_0x0d21('0xf')]);router[_0x0d21('0x10')]('/:id',auth[_0x0d21('0x9')](),controller[_0x0d21('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 3362da9..b4037e8 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 _0x7b83=['customVariable','keyValue','string','STRING','variable','sequelize','exports','ENUM'];(function(_0x1e0bf9,_0x5b61ba){var _0x5090e0=function(_0x4481c1){while(--_0x4481c1){_0x1e0bf9['push'](_0x1e0bf9['shift']());}};_0x5090e0(++_0x5b61ba);}(_0x7b83,0xfd));var _0x37b8=function(_0x2d932f,_0x4460ea){_0x2d932f=_0x2d932f-0x0;var _0x1bee20=_0x7b83[_0x2d932f];return _0x1bee20;};'use strict';var Sequelize=require(_0x37b8('0x0'));module[_0x37b8('0x1')]={'type':{'type':Sequelize[_0x37b8('0x2')]('string','variable',_0x37b8('0x3'),_0x37b8('0x4'),'picklist'),'defaultValue':_0x37b8('0x5')},'content':{'type':Sequelize[_0x37b8('0x6')]},'key':{'type':Sequelize[_0x37b8('0x6')]},'keyType':{'type':Sequelize[_0x37b8('0x2')](_0x37b8('0x5'),_0x37b8('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x37b8('0x6')]},'idField':{'type':Sequelize[_0x37b8('0x6')]},'nameField':{'type':Sequelize[_0x37b8('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x37b8('0x6')]}}; \ No newline at end of file +var _0x7157=['string','variable','keyValue','picklist','STRING','customVariable','sequelize','exports'];(function(_0x427939,_0x543c45){var _0x2e51bf=function(_0x59b4d8){while(--_0x59b4d8){_0x427939['push'](_0x427939['shift']());}};_0x2e51bf(++_0x543c45);}(_0x7157,0xce));var _0x7715=function(_0x29303e,_0x2c7e76){_0x29303e=_0x29303e-0x0;var _0x1f106f=_0x7157[_0x29303e];return _0x1f106f;};'use strict';var Sequelize=require(_0x7715('0x0'));module[_0x7715('0x1')]={'type':{'type':Sequelize['ENUM'](_0x7715('0x2'),_0x7715('0x3'),'customVariable',_0x7715('0x4'),_0x7715('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x7715('0x6')]},'key':{'type':Sequelize[_0x7715('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x7715('0x2'),_0x7715('0x3'),_0x7715('0x7'))},'keyContent':{'type':Sequelize[_0x7715('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7715('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7715('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 340e560..67cf8e8 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 _0xe978=['apply','reject','save','update','then','error','stack','name','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','order','where','pick','filter','merge','options','DeskField','includeAll','include','findAll','rows','catch','find','create','body','params','destroy','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json'];(function(_0x52949d,_0x5750ec){var _0x570250=function(_0xd9636a){while(--_0xd9636a){_0x52949d['push'](_0x52949d['shift']());}};_0x570250(++_0x5750ec);}(_0xe978,0x70));var _0x8e97=function(_0x438f87,_0x24d44a){_0x438f87=_0x438f87-0x0;var _0x4159ad=_0xe978[_0x438f87];return _0x4159ad;};'use strict';var emlformat=require(_0x8e97('0x0'));var rimraf=require(_0x8e97('0x1'));var zipdir=require(_0x8e97('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8e97('0x3'));var BPromise=require(_0x8e97('0x4'));var Mustache=require(_0x8e97('0x5'));var util=require(_0x8e97('0x6'));var path=require(_0x8e97('0x7'));var sox=require('sox');var csv=require(_0x8e97('0x8'));var ejs=require(_0x8e97('0x9'));var fs=require('fs');var fs_extra=require(_0x8e97('0xa'));var _=require(_0x8e97('0xb'));var squel=require(_0x8e97('0xc'));var crypto=require('crypto');var jsforce=require(_0x8e97('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8e97('0x8'));var querystring=require(_0x8e97('0xe'));var Papa=require(_0x8e97('0xf'));var Redis=require('ioredis');var authService=require(_0x8e97('0x10'));var qs=require(_0x8e97('0x11'));var as=require(_0x8e97('0x12'));var hardwareService=require(_0x8e97('0x13'));var logger=require(_0x8e97('0x14'))(_0x8e97('0x15'));var utils=require(_0x8e97('0x16'));var config=require(_0x8e97('0x17'));var licenseUtil=require(_0x8e97('0x18'));var db=require(_0x8e97('0x19'))['db'];function respondWithStatusCode(_0x23215e,_0x4f45ee){_0x4f45ee=_0x4f45ee||0xcc;return function(_0x3d2c93){if(_0x3d2c93){return _0x23215e[_0x8e97('0x1a')](_0x4f45ee);}return _0x23215e[_0x8e97('0x1b')](_0x4f45ee)[_0x8e97('0x1c')]();};}function respondWithResult(_0x4df8d3,_0x5051e8){_0x5051e8=_0x5051e8||0xc8;return function(_0x583c0a){if(_0x583c0a){return _0x4df8d3['status'](_0x5051e8)['json'](_0x583c0a);}};}function respondWithFilteredResult(_0x5e2725,_0x17bc97){return function(_0x4fc685){if(_0x4fc685){var _0x33b6b3=typeof _0x17bc97[_0x8e97('0x1d')]==='undefined'&&typeof _0x17bc97['limit']===_0x8e97('0x1e');var _0x3f3738=_0x4fc685[_0x8e97('0x1f')];var _0x2f475c=_0x33b6b3?0x0:_0x17bc97[_0x8e97('0x1d')];var _0x2b823e=_0x33b6b3?_0x4fc685[_0x8e97('0x1f')]:_0x17bc97[_0x8e97('0x1d')]+_0x17bc97[_0x8e97('0x20')];var _0x596d71;if(_0x2b823e>=_0x3f3738){_0x2b823e=_0x3f3738;_0x596d71=0xc8;}else{_0x596d71=0xce;}_0x5e2725[_0x8e97('0x1b')](_0x596d71);return _0x5e2725[_0x8e97('0x21')](_0x8e97('0x22'),_0x2f475c+'-'+_0x2b823e+'/'+_0x3f3738)[_0x8e97('0x23')](_0x4fc685);}return null;};}function patchUpdates(_0x9bb69f){return function(_0xa2968a){try{jsonpatch[_0x8e97('0x24')](_0xa2968a,_0x9bb69f,!![]);}catch(_0x5a5c99){return BPromise[_0x8e97('0x25')](_0x5a5c99);}return _0xa2968a[_0x8e97('0x26')]();};}function saveUpdates(_0x2b1b01,_0x305686){return function(_0x387748){if(_0x387748){return _0x387748[_0x8e97('0x27')](_0x2b1b01)[_0x8e97('0x28')](function(_0x18fcdb){return _0x18fcdb;});}return null;};}function removeEntity(_0x3c13de,_0x5dde33){return function(_0x517c1e){if(_0x517c1e){return _0x517c1e['destroy']()['then'](function(){_0x3c13de[_0x8e97('0x1b')](0xcc)[_0x8e97('0x1c')]();});}};}function handleEntityNotFound(_0x2be986,_0xcee009){return function(_0x1bae19){if(!_0x1bae19){_0x2be986[_0x8e97('0x1a')](0x194);}return _0x1bae19;};}function handleError(_0x8ffc5b,_0xc48542){_0xc48542=_0xc48542||0x1f4;return function(_0x5cc6fc){logger[_0x8e97('0x29')](_0x5cc6fc[_0x8e97('0x2a')]);if(_0x5cc6fc[_0x8e97('0x2b')]){delete _0x5cc6fc['name'];}_0x8ffc5b[_0x8e97('0x1b')](_0xc48542)['send'](_0x5cc6fc);};}exports[_0x8e97('0x2c')]=function(_0x7f3ea1,_0xa5b3de){var _0x2f7919={},_0xb1ce05={},_0x65a7b5={'count':0x0,'rows':[]};var _0x180b9d=_['map'](db['DeskField'][_0x8e97('0x2d')],function(_0x364296){return{'name':_0x364296[_0x8e97('0x2e')],'type':_0x364296[_0x8e97('0x2f')]['key']};});_0xb1ce05[_0x8e97('0x30')]=_[_0x8e97('0x31')](_0x180b9d,_0x8e97('0x2b'));_0xb1ce05[_0x8e97('0x32')]=_[_0x8e97('0x33')](_0x7f3ea1['query']);_0xb1ce05[_0x8e97('0x34')]=_[_0x8e97('0x35')](_0xb1ce05[_0x8e97('0x30')],_0xb1ce05[_0x8e97('0x32')]);_0x2f7919[_0x8e97('0x36')]=_['intersection'](_0xb1ce05[_0x8e97('0x30')],qs['fields'](_0x7f3ea1[_0x8e97('0x32')][_0x8e97('0x37')]));_0x2f7919[_0x8e97('0x36')]=_0x2f7919[_0x8e97('0x36')][_0x8e97('0x38')]?_0x2f7919['attributes']:_0xb1ce05[_0x8e97('0x30')];if(!_0x7f3ea1[_0x8e97('0x32')]['hasOwnProperty']('nolimit')){_0x2f7919[_0x8e97('0x20')]=qs[_0x8e97('0x20')](_0x7f3ea1[_0x8e97('0x32')]['limit']);_0x2f7919[_0x8e97('0x1d')]=qs[_0x8e97('0x1d')](_0x7f3ea1[_0x8e97('0x32')][_0x8e97('0x1d')]);}_0x2f7919[_0x8e97('0x39')]=qs['sort'](_0x7f3ea1[_0x8e97('0x32')]['sort']);_0x2f7919[_0x8e97('0x3a')]=qs[_0x8e97('0x34')](_[_0x8e97('0x3b')](_0x7f3ea1['query'],_0xb1ce05['filters']),_0x180b9d);if(_0x7f3ea1[_0x8e97('0x32')][_0x8e97('0x3c')]){_0x2f7919[_0x8e97('0x3a')]=_['merge'](_0x2f7919['where'],{'$or':_[_0x8e97('0x31')](_0x180b9d,function(_0x200772){if(_0x200772[_0x8e97('0x2f')]!=='VIRTUAL'){var _0x4b50da={};_0x4b50da[_0x200772[_0x8e97('0x2b')]]={'$like':'%'+_0x7f3ea1['query'][_0x8e97('0x3c')]+'%'};return _0x4b50da;}})});}_0x2f7919=_[_0x8e97('0x3d')]({},_0x2f7919,_0x7f3ea1[_0x8e97('0x3e')]);var _0x5a95c4={'where':_0x2f7919[_0x8e97('0x3a')]};return db[_0x8e97('0x3f')][_0x8e97('0x1f')](_0x5a95c4)['then'](function(_0x305eae){_0x65a7b5[_0x8e97('0x1f')]=_0x305eae;if(_0x7f3ea1[_0x8e97('0x32')][_0x8e97('0x40')]){_0x2f7919[_0x8e97('0x41')]=[{'all':!![]}];}return db[_0x8e97('0x3f')][_0x8e97('0x42')](_0x2f7919);})[_0x8e97('0x28')](function(_0x4c1180){_0x65a7b5[_0x8e97('0x43')]=_0x4c1180;return _0x65a7b5;})[_0x8e97('0x28')](respondWithFilteredResult(_0xa5b3de,_0x2f7919))[_0x8e97('0x44')](handleError(_0xa5b3de,null));};exports['show']=function(_0x8e9af1,_0x4e5355){var _0x267164={'raw':!![],'where':{'id':_0x8e9af1['params']['id']}},_0x60a881={};_0x60a881['model']=_[_0x8e97('0x33')](db[_0x8e97('0x3f')][_0x8e97('0x2d')]);_0x60a881[_0x8e97('0x32')]=_[_0x8e97('0x33')](_0x8e9af1[_0x8e97('0x32')]);_0x60a881[_0x8e97('0x34')]=_['intersection'](_0x60a881[_0x8e97('0x30')],_0x60a881[_0x8e97('0x32')]);_0x267164[_0x8e97('0x36')]=_[_0x8e97('0x35')](_0x60a881[_0x8e97('0x30')],qs[_0x8e97('0x37')](_0x8e9af1['query'][_0x8e97('0x37')]));_0x267164[_0x8e97('0x36')]=_0x267164[_0x8e97('0x36')]['length']?_0x267164['attributes']:_0x60a881[_0x8e97('0x30')];if(_0x8e9af1[_0x8e97('0x32')][_0x8e97('0x40')]){_0x267164[_0x8e97('0x41')]=[{'all':!![]}];}_0x267164=_[_0x8e97('0x3d')]({},_0x267164,_0x8e9af1[_0x8e97('0x3e')]);return db['DeskField'][_0x8e97('0x45')](_0x267164)[_0x8e97('0x28')](handleEntityNotFound(_0x4e5355,null))[_0x8e97('0x28')](respondWithResult(_0x4e5355,null))[_0x8e97('0x44')](handleError(_0x4e5355,null));};exports['create']=function(_0x6f4c34,_0x5dc103){return db['DeskField'][_0x8e97('0x46')](_0x6f4c34[_0x8e97('0x47')],{})[_0x8e97('0x28')](respondWithResult(_0x5dc103,0xc9))[_0x8e97('0x44')](handleError(_0x5dc103,null));};exports[_0x8e97('0x27')]=function(_0x48cc94,_0x2d4243){if(_0x48cc94[_0x8e97('0x47')]['id']){delete _0x48cc94[_0x8e97('0x47')]['id'];}return db[_0x8e97('0x3f')][_0x8e97('0x45')]({'where':{'id':_0x48cc94[_0x8e97('0x48')]['id']}})['then'](handleEntityNotFound(_0x2d4243,null))['then'](saveUpdates(_0x48cc94[_0x8e97('0x47')],null))[_0x8e97('0x28')](respondWithResult(_0x2d4243,null))['catch'](handleError(_0x2d4243,null));};exports[_0x8e97('0x49')]=function(_0x48752d,_0x291ab9){return db['DeskField']['find']({'where':{'id':_0x48752d[_0x8e97('0x48')]['id']}})[_0x8e97('0x28')](handleEntityNotFound(_0x291ab9,null))[_0x8e97('0x28')](removeEntity(_0x291ab9,null))[_0x8e97('0x44')](handleError(_0x291ab9,null));}; \ No newline at end of file +var _0x9bd9=['apply','reject','then','error','name','index','DeskField','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range'];(function(_0x58ec25,_0x3fae41){var _0x8d4154=function(_0x39402b){while(--_0x39402b){_0x58ec25['push'](_0x58ec25['shift']());}};_0x8d4154(++_0x3fae41);}(_0x9bd9,0x1a4));var _0x99bd=function(_0x99682f,_0x471920){_0x99682f=_0x99682f-0x0;var _0x58bebd=_0x9bd9[_0x99682f];return _0x58bebd;};'use strict';var emlformat=require(_0x99bd('0x0'));var rimraf=require(_0x99bd('0x1'));var zipdir=require(_0x99bd('0x2'));var jsonpatch=require(_0x99bd('0x3'));var rp=require(_0x99bd('0x4'));var moment=require(_0x99bd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x99bd('0x6'));var util=require('util');var path=require(_0x99bd('0x7'));var sox=require(_0x99bd('0x8'));var csv=require('to-csv');var ejs=require(_0x99bd('0x9'));var fs=require('fs');var fs_extra=require(_0x99bd('0xa'));var _=require(_0x99bd('0xb'));var squel=require(_0x99bd('0xc'));var crypto=require(_0x99bd('0xd'));var jsforce=require(_0x99bd('0xe'));var deskjs=require(_0x99bd('0xf'));var toCsv=require(_0x99bd('0x10'));var querystring=require(_0x99bd('0x11'));var Papa=require(_0x99bd('0x12'));var Redis=require(_0x99bd('0x13'));var authService=require(_0x99bd('0x14'));var qs=require(_0x99bd('0x15'));var as=require(_0x99bd('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x99bd('0x17'))('api');var utils=require(_0x99bd('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x99bd('0x19'));var db=require(_0x99bd('0x1a'))['db'];function respondWithStatusCode(_0x4a8bd9,_0x22237c){_0x22237c=_0x22237c||0xcc;return function(_0x500cd2){if(_0x500cd2){return _0x4a8bd9[_0x99bd('0x1b')](_0x22237c);}return _0x4a8bd9['status'](_0x22237c)[_0x99bd('0x1c')]();};}function respondWithResult(_0x401299,_0x141159){_0x141159=_0x141159||0xc8;return function(_0x4a9770){if(_0x4a9770){return _0x401299[_0x99bd('0x1d')](_0x141159)[_0x99bd('0x1e')](_0x4a9770);}};}function respondWithFilteredResult(_0x2d918a,_0x42b619){return function(_0x65a2e5){if(_0x65a2e5){var _0x491d9=typeof _0x42b619[_0x99bd('0x1f')]===_0x99bd('0x20')&&typeof _0x42b619[_0x99bd('0x21')]==='undefined';var _0x378079=_0x65a2e5[_0x99bd('0x22')];var _0x2fe078=_0x491d9?0x0:_0x42b619['offset'];var _0x4b98fc=_0x491d9?_0x65a2e5[_0x99bd('0x22')]:_0x42b619[_0x99bd('0x1f')]+_0x42b619[_0x99bd('0x21')];var _0xfa6227;if(_0x4b98fc>=_0x378079){_0x4b98fc=_0x378079;_0xfa6227=0xc8;}else{_0xfa6227=0xce;}_0x2d918a[_0x99bd('0x1d')](_0xfa6227);return _0x2d918a['set'](_0x99bd('0x23'),_0x2fe078+'-'+_0x4b98fc+'/'+_0x378079)['json'](_0x65a2e5);}return null;};}function patchUpdates(_0x10f2fb){return function(_0x3085df){try{jsonpatch[_0x99bd('0x24')](_0x3085df,_0x10f2fb,!![]);}catch(_0x1d937b){return BPromise[_0x99bd('0x25')](_0x1d937b);}return _0x3085df['save']();};}function saveUpdates(_0x27c551,_0x229322){return function(_0x3e339c){if(_0x3e339c){return _0x3e339c['update'](_0x27c551)[_0x99bd('0x26')](function(_0x5e6081){return _0x5e6081;});}return null;};}function removeEntity(_0x4d3ebb,_0x1c5b82){return function(_0xfdc455){if(_0xfdc455){return _0xfdc455['destroy']()[_0x99bd('0x26')](function(){_0x4d3ebb[_0x99bd('0x1d')](0xcc)[_0x99bd('0x1c')]();});}};}function handleEntityNotFound(_0x3f7bf4,_0x51ff34){return function(_0x12daac){if(!_0x12daac){_0x3f7bf4['sendStatus'](0x194);}return _0x12daac;};}function handleError(_0x550b7f,_0x10d5cd){_0x10d5cd=_0x10d5cd||0x1f4;return function(_0x5ebeeb){logger[_0x99bd('0x27')](_0x5ebeeb['stack']);if(_0x5ebeeb[_0x99bd('0x28')]){delete _0x5ebeeb[_0x99bd('0x28')];}_0x550b7f['status'](_0x10d5cd)['send'](_0x5ebeeb);};}exports[_0x99bd('0x29')]=function(_0x1af1e6,_0x1eabb9){var _0x5903aa={},_0x957d48={},_0x1d0642={'count':0x0,'rows':[]};var _0x2250d8=_['map'](db[_0x99bd('0x2a')][_0x99bd('0x2b')],function(_0x4c5493){return{'name':_0x4c5493[_0x99bd('0x2c')],'type':_0x4c5493[_0x99bd('0x2d')][_0x99bd('0x2e')]};});_0x957d48[_0x99bd('0x2f')]=_['map'](_0x2250d8,_0x99bd('0x28'));_0x957d48[_0x99bd('0x30')]=_['keys'](_0x1af1e6[_0x99bd('0x30')]);_0x957d48['filters']=_['intersection'](_0x957d48['model'],_0x957d48[_0x99bd('0x30')]);_0x5903aa[_0x99bd('0x31')]=_[_0x99bd('0x32')](_0x957d48[_0x99bd('0x2f')],qs[_0x99bd('0x33')](_0x1af1e6[_0x99bd('0x30')][_0x99bd('0x33')]));_0x5903aa[_0x99bd('0x31')]=_0x5903aa[_0x99bd('0x31')][_0x99bd('0x34')]?_0x5903aa['attributes']:_0x957d48[_0x99bd('0x2f')];if(!_0x1af1e6['query'][_0x99bd('0x35')]('nolimit')){_0x5903aa['limit']=qs['limit'](_0x1af1e6[_0x99bd('0x30')][_0x99bd('0x21')]);_0x5903aa[_0x99bd('0x1f')]=qs[_0x99bd('0x1f')](_0x1af1e6['query'][_0x99bd('0x1f')]);}_0x5903aa[_0x99bd('0x36')]=qs[_0x99bd('0x37')](_0x1af1e6[_0x99bd('0x30')]['sort']);_0x5903aa[_0x99bd('0x38')]=qs[_0x99bd('0x39')](_[_0x99bd('0x3a')](_0x1af1e6[_0x99bd('0x30')],_0x957d48['filters']),_0x2250d8);if(_0x1af1e6[_0x99bd('0x30')][_0x99bd('0x3b')]){_0x5903aa[_0x99bd('0x38')]=_[_0x99bd('0x3c')](_0x5903aa['where'],{'$or':_[_0x99bd('0x3d')](_0x2250d8,function(_0x3d2b0f){if(_0x3d2b0f[_0x99bd('0x2d')]!==_0x99bd('0x3e')){var _0x7e29ec={};_0x7e29ec[_0x3d2b0f[_0x99bd('0x28')]]={'$like':'%'+_0x1af1e6[_0x99bd('0x30')][_0x99bd('0x3b')]+'%'};return _0x7e29ec;}})});}_0x5903aa=_[_0x99bd('0x3c')]({},_0x5903aa,_0x1af1e6[_0x99bd('0x3f')]);var _0x2fcf71={'where':_0x5903aa[_0x99bd('0x38')]};return db[_0x99bd('0x2a')]['count'](_0x2fcf71)[_0x99bd('0x26')](function(_0x1ecdd6){_0x1d0642[_0x99bd('0x22')]=_0x1ecdd6;if(_0x1af1e6[_0x99bd('0x30')][_0x99bd('0x40')]){_0x5903aa[_0x99bd('0x41')]=[{'all':!![]}];}return db[_0x99bd('0x2a')][_0x99bd('0x42')](_0x5903aa);})[_0x99bd('0x26')](function(_0x7e84b1){_0x1d0642[_0x99bd('0x43')]=_0x7e84b1;return _0x1d0642;})[_0x99bd('0x26')](respondWithFilteredResult(_0x1eabb9,_0x5903aa))[_0x99bd('0x44')](handleError(_0x1eabb9,null));};exports[_0x99bd('0x45')]=function(_0xb0ffe5,_0x2d91be){var _0x369fb5={'raw':!![],'where':{'id':_0xb0ffe5[_0x99bd('0x46')]['id']}},_0x5a4a96={};_0x5a4a96[_0x99bd('0x2f')]=_[_0x99bd('0x47')](db[_0x99bd('0x2a')][_0x99bd('0x2b')]);_0x5a4a96[_0x99bd('0x30')]=_[_0x99bd('0x47')](_0xb0ffe5[_0x99bd('0x30')]);_0x5a4a96['filters']=_[_0x99bd('0x32')](_0x5a4a96[_0x99bd('0x2f')],_0x5a4a96[_0x99bd('0x30')]);_0x369fb5['attributes']=_[_0x99bd('0x32')](_0x5a4a96[_0x99bd('0x2f')],qs[_0x99bd('0x33')](_0xb0ffe5['query'][_0x99bd('0x33')]));_0x369fb5['attributes']=_0x369fb5['attributes']['length']?_0x369fb5[_0x99bd('0x31')]:_0x5a4a96[_0x99bd('0x2f')];if(_0xb0ffe5[_0x99bd('0x30')]['includeAll']){_0x369fb5[_0x99bd('0x41')]=[{'all':!![]}];}_0x369fb5=_[_0x99bd('0x3c')]({},_0x369fb5,_0xb0ffe5[_0x99bd('0x3f')]);return db['DeskField'][_0x99bd('0x48')](_0x369fb5)[_0x99bd('0x26')](handleEntityNotFound(_0x2d91be,null))['then'](respondWithResult(_0x2d91be,null))['catch'](handleError(_0x2d91be,null));};exports[_0x99bd('0x49')]=function(_0x1d7ec0,_0x3487c6){return db['DeskField']['create'](_0x1d7ec0[_0x99bd('0x4a')],{})[_0x99bd('0x26')](respondWithResult(_0x3487c6,0xc9))[_0x99bd('0x44')](handleError(_0x3487c6,null));};exports['update']=function(_0x3fa8e1,_0x4e71b3){if(_0x3fa8e1[_0x99bd('0x4a')]['id']){delete _0x3fa8e1[_0x99bd('0x4a')]['id'];}return db[_0x99bd('0x2a')][_0x99bd('0x48')]({'where':{'id':_0x3fa8e1[_0x99bd('0x46')]['id']}})['then'](handleEntityNotFound(_0x4e71b3,null))[_0x99bd('0x26')](saveUpdates(_0x3fa8e1['body'],null))[_0x99bd('0x26')](respondWithResult(_0x4e71b3,null))[_0x99bd('0x44')](handleError(_0x4e71b3,null));};exports[_0x99bd('0x4b')]=function(_0x1912ac,_0x2100c7){return db[_0x99bd('0x2a')][_0x99bd('0x48')]({'where':{'id':_0x1912ac['params']['id']}})['then'](handleEntityNotFound(_0x2100c7,null))[_0x99bd('0x26')](removeEntity(_0x2100c7,null))[_0x99bd('0x44')](handleError(_0x2100c7,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index c1dc245..0fba6ff 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 _0x1b7f=['api','moment','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','int_desk_fields','idField','FieldId','lodash','util'];(function(_0x435801,_0x2b1487){var _0x126695=function(_0x325d41){while(--_0x325d41){_0x435801['push'](_0x435801['shift']());}};_0x126695(++_0x2b1487);}(_0x1b7f,0x1e8));var _0xf1b7=function(_0x4307a2,_0x5a058b){_0x4307a2=_0x4307a2-0x0;var _0x14bedb=_0x1b7f[_0x4307a2];return _0x14bedb;};'use strict';var _=require(_0xf1b7('0x0'));var util=require(_0xf1b7('0x1'));var logger=require('../../config/logger')(_0xf1b7('0x2'));var moment=require(_0xf1b7('0x3'));var BPromise=require('bluebird');var rp=require(_0xf1b7('0x4'));var fs=require('fs');var path=require(_0xf1b7('0x5'));var rimraf=require(_0xf1b7('0x6'));var config=require(_0xf1b7('0x7'));var attributes=require(_0xf1b7('0x8'));module[_0xf1b7('0x9')]=function(_0x88ef82,_0xbdfb1f){return _0x88ef82[_0xf1b7('0xa')]('DeskField',attributes,{'tableName':_0xf1b7('0xb'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xf1b7('0xc'),_0xf1b7('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8b65=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','idField'];(function(_0x910f41,_0x2093ba){var _0x40a83b=function(_0x4a810f){while(--_0x4a810f){_0x910f41['push'](_0x910f41['shift']());}};_0x40a83b(++_0x2093ba);}(_0x8b65,0x188));var _0x58b6=function(_0x3a4950,_0x127074){_0x3a4950=_0x3a4950-0x0;var _0x4d73a2=_0x8b65[_0x3a4950];return _0x4d73a2;};'use strict';var _=require(_0x58b6('0x0'));var util=require(_0x58b6('0x1'));var logger=require(_0x58b6('0x2'))(_0x58b6('0x3'));var moment=require(_0x58b6('0x4'));var BPromise=require(_0x58b6('0x5'));var rp=require(_0x58b6('0x6'));var fs=require('fs');var path=require(_0x58b6('0x7'));var rimraf=require(_0x58b6('0x8'));var config=require(_0x58b6('0x9'));var attributes=require(_0x58b6('0xa'));module[_0x58b6('0xb')]=function(_0x4c60ca,_0x22bd09){return _0x4c60ca[_0x58b6('0xc')](_0x58b6('0xd'),attributes,{'tableName':_0x58b6('0xe'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x58b6('0xf'),_0x58b6('0x10')],'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 0488677..0d1a6ce 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 _0xb0a3=['request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xb0a3,0x132));var _0x3b0a=function(_0xdbd4f7,_0x4e3bdd){_0xdbd4f7=_0xdbd4f7-0x0;var _0x5c3f9d=_0xb0a3[_0xdbd4f7];return _0x5c3f9d;};'use strict';var _=require(_0x3b0a('0x0'));var util=require('util');var moment=require(_0x3b0a('0x1'));var BPromise=require(_0x3b0a('0x2'));var rs=require(_0x3b0a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3b0a('0x4'))(_0x3b0a('0x5'));var config=require(_0x3b0a('0x6'));var jayson=require(_0x3b0a('0x7'));var client=jayson[_0x3b0a('0x8')][_0x3b0a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5de514,_0x350f39,_0x3a30a8){return new BPromise(function(_0x39015a,_0x4a53a5){return client[_0x3b0a('0xa')](_0x5de514,_0x3a30a8)[_0x3b0a('0xb')](function(_0x319e10){logger[_0x3b0a('0xc')](_0x3b0a('0xd'),_0x350f39,_0x3b0a('0xe'));logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x350f39,'request\x20sent',JSON[_0x3b0a('0xf')](_0x319e10));if(_0x319e10[_0x3b0a('0x10')]){if(_0x319e10[_0x3b0a('0x10')]['code']===0x1f4){logger[_0x3b0a('0x10')]('DeskField,\x20%s,\x20%s',_0x350f39,_0x319e10[_0x3b0a('0x10')][_0x3b0a('0x11')]);return _0x4a53a5(_0x319e10[_0x3b0a('0x10')][_0x3b0a('0x11')]);}logger['error']('DeskField,\x20%s,\x20%s',_0x350f39,_0x319e10['error'][_0x3b0a('0x11')]);return _0x39015a(_0x319e10[_0x3b0a('0x10')][_0x3b0a('0x11')]);}else{logger[_0x3b0a('0xc')]('DeskField,\x20%s,\x20%s',_0x350f39,_0x3b0a('0xe'));_0x39015a(_0x319e10[_0x3b0a('0x12')][_0x3b0a('0x11')]);}})[_0x3b0a('0x13')](function(_0x255d1a){logger['error'](_0x3b0a('0xd'),_0x350f39,_0x255d1a);_0x4a53a5(_0x255d1a);});});} \ No newline at end of file +var _0x2b1f=['request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','request','then','info','DeskField,\x20%s,\x20%s'];(function(_0x5a5590,_0x25d790){var _0x27cf11=function(_0x962255){while(--_0x962255){_0x5a5590['push'](_0x5a5590['shift']());}};_0x27cf11(++_0x25d790);}(_0x2b1f,0x152));var _0xf2b1=function(_0x38bad3,_0x3f1390){_0x38bad3=_0x38bad3-0x0;var _0x1b0e79=_0x2b1f[_0x38bad3];return _0x1b0e79;};'use strict';var _=require(_0xf2b1('0x0'));var util=require(_0xf2b1('0x1'));var moment=require(_0xf2b1('0x2'));var BPromise=require(_0xf2b1('0x3'));var rs=require(_0xf2b1('0x4'));var fs=require('fs');var Redis=require(_0xf2b1('0x5'));var db=require(_0xf2b1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf2b1('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf2b1('0x8'));var client=jayson[_0xf2b1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d3e98,_0x908d3d,_0x1bdf99){return new BPromise(function(_0xacd653,_0x585324){return client[_0xf2b1('0xa')](_0x1d3e98,_0x1bdf99)[_0xf2b1('0xb')](function(_0x540dd8){logger[_0xf2b1('0xc')](_0xf2b1('0xd'),_0x908d3d,_0xf2b1('0xe'));logger[_0xf2b1('0xf')](_0xf2b1('0x10'),_0x908d3d,_0xf2b1('0xe'),JSON[_0xf2b1('0x11')](_0x540dd8));if(_0x540dd8[_0xf2b1('0x12')]){if(_0x540dd8['error'][_0xf2b1('0x13')]===0x1f4){logger[_0xf2b1('0x12')](_0xf2b1('0xd'),_0x908d3d,_0x540dd8[_0xf2b1('0x12')]['message']);return _0x585324(_0x540dd8[_0xf2b1('0x12')][_0xf2b1('0x14')]);}logger[_0xf2b1('0x12')](_0xf2b1('0xd'),_0x908d3d,_0x540dd8['error'][_0xf2b1('0x14')]);return _0xacd653(_0x540dd8[_0xf2b1('0x12')][_0xf2b1('0x14')]);}else{logger[_0xf2b1('0xc')]('DeskField,\x20%s,\x20%s',_0x908d3d,_0xf2b1('0xe'));_0xacd653(_0x540dd8['result']['message']);}})[_0xf2b1('0x15')](function(_0x149f58){logger[_0xf2b1('0x12')](_0xf2b1('0xd'),_0x908d3d,_0x149f58);_0x585324(_0x149f58);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 7d7a706..56ed4f8 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 _0x65cf=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','create','post','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','./intDynamics365Account.controller','isAuthenticated','index','get'];(function(_0x14476b,_0xd1a7a4){var _0x24e2e8=function(_0x52ed26){while(--_0x52ed26){_0x14476b['push'](_0x14476b['shift']());}};_0x24e2e8(++_0xd1a7a4);}(_0x65cf,0x181));var _0xf65c=function(_0x5b6966,_0x289c63){_0x5b6966=_0x5b6966-0x0;var _0x1563c1=_0x65cf[_0x5b6966];return _0x1563c1;};'use strict';var multer=require(_0xf65c('0x0'));var util=require(_0xf65c('0x1'));var path=require(_0xf65c('0x2'));var timeout=require('connect-timeout');var express=require(_0xf65c('0x3'));var router=express[_0xf65c('0x4')]();var fs_extra=require(_0xf65c('0x5'));var auth=require(_0xf65c('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf65c('0x7'));router['get']('/',auth[_0xf65c('0x8')](),controller[_0xf65c('0x9')]);router[_0xf65c('0xa')](_0xf65c('0xb'),auth[_0xf65c('0x8')](),controller[_0xf65c('0xc')]);router[_0xf65c('0xa')](_0xf65c('0xd'),auth[_0xf65c('0x8')](),controller[_0xf65c('0xe')]);router[_0xf65c('0xa')](_0xf65c('0xf'),auth[_0xf65c('0x8')](),controller['getFields']);router['post']('/',auth[_0xf65c('0x8')](),controller[_0xf65c('0x10')]);router[_0xf65c('0x11')](_0xf65c('0xd'),auth[_0xf65c('0x8')](),controller['addConfiguration']);router[_0xf65c('0x12')](_0xf65c('0xb'),auth[_0xf65c('0x8')](),controller['update']);router[_0xf65c('0x13')](_0xf65c('0xb'),auth[_0xf65c('0x8')](),controller[_0xf65c('0x14')]);module[_0xf65c('0x15')]=router; \ No newline at end of file +var _0x7162=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','multer','path'];(function(_0x1e719d,_0x28be37){var _0x7e1c99=function(_0x550edf){while(--_0x550edf){_0x1e719d['push'](_0x1e719d['shift']());}};_0x7e1c99(++_0x28be37);}(_0x7162,0xa0));var _0x2716=function(_0x225195,_0x5d5e02){_0x225195=_0x225195-0x0;var _0x3c045a=_0x7162[_0x225195];return _0x3c045a;};'use strict';var multer=require(_0x2716('0x0'));var util=require('util');var path=require(_0x2716('0x1'));var timeout=require('connect-timeout');var express=require(_0x2716('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2716('0x3'));var interaction=require(_0x2716('0x4'));var config=require(_0x2716('0x5'));var controller=require('./intDynamics365Account.controller');router['get']('/',auth[_0x2716('0x6')](),controller['index']);router[_0x2716('0x7')](_0x2716('0x8'),auth[_0x2716('0x6')](),controller['show']);router['get'](_0x2716('0x9'),auth['isAuthenticated'](),controller[_0x2716('0xa')]);router[_0x2716('0x7')](_0x2716('0xb'),auth[_0x2716('0x6')](),controller['getFields']);router[_0x2716('0xc')]('/',auth[_0x2716('0x6')](),controller[_0x2716('0xd')]);router[_0x2716('0xc')](_0x2716('0x9'),auth[_0x2716('0x6')](),controller[_0x2716('0xe')]);router[_0x2716('0xf')](_0x2716('0x8'),auth[_0x2716('0x6')](),controller[_0x2716('0x10')]);router[_0x2716('0x11')](_0x2716('0x8'),auth[_0x2716('0x6')](),controller['destroy']);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 b2a65ef..3856d0f 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 _0xfd7b=['STRING','BOOLEAN','exports'];(function(_0x414655,_0x79d916){var _0x237884=function(_0x2737d9){while(--_0x2737d9){_0x414655['push'](_0x414655['shift']());}};_0x237884(++_0x79d916);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xfd7b[_0x1beef3];return _0x5af964;};'use strict';var Sequelize=require('sequelize');module[_0xbfd7('0x0')]={'name':{'type':Sequelize[_0xbfd7('0x1')]},'username':{'type':Sequelize[_0xbfd7('0x1')]},'password':{'type':Sequelize[_0xbfd7('0x1')]},'remoteUri':{'type':Sequelize[_0xbfd7('0x1')]},'tenantId':{'type':Sequelize[_0xbfd7('0x1')]},'clientId':{'type':Sequelize[_0xbfd7('0x1')]},'clientSecret':{'type':Sequelize[_0xbfd7('0x1')]},'serverUrl':{'type':Sequelize[_0xbfd7('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xbfd7('0x1')]},'modernAuthentication':{'type':Sequelize[_0xbfd7('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2123=['sequelize','exports','STRING','BOOLEAN'];(function(_0x4ff1ee,_0x13dd1b){var _0x22e499=function(_0x3badfa){while(--_0x3badfa){_0x4ff1ee['push'](_0x4ff1ee['shift']());}};_0x22e499(++_0x13dd1b);}(_0x2123,0x190));var _0x3212=function(_0x2a7691,_0x4d3240){_0x2a7691=_0x2a7691-0x0;var _0x3d003c=_0x2123[_0x2a7691];return _0x3d003c;};'use strict';var Sequelize=require(_0x3212('0x0'));module[_0x3212('0x1')]={'name':{'type':Sequelize[_0x3212('0x2')]},'username':{'type':Sequelize[_0x3212('0x2')]},'password':{'type':Sequelize[_0x3212('0x2')]},'remoteUri':{'type':Sequelize[_0x3212('0x2')]},'tenantId':{'type':Sequelize[_0x3212('0x2')]},'clientId':{'type':Sequelize[_0x3212('0x2')]},'clientSecret':{'type':Sequelize[_0x3212('0x2')]},'serverUrl':{'type':Sequelize[_0x3212('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3212('0x2')]},'modernAuthentication':{'type':Sequelize[_0x3212('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index e4be3e1..1cefec9 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 _0xa9dc=['actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','POST','https://login.microsoftonline.com/','password','access_token','GET','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','BooleanAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','error','Wrong\x20credentials',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName','true','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','count','offset','set','Content-Range','update','destroy','sendStatus','stack','name','send','map','Dynamics365Account','rawAttributes','key','query','keys','filters','intersection','attributes','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','getConfigurations','findOne','Dynamics365Configuration','length','AccountId','Subjects','channel','Dynamics365Field','Descriptions','substring','lastIndexOf','format','getFields','PhoneCall','title','description','customerid','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame'];(function(_0x341872,_0x470a0f){var _0x37269c=function(_0x1e2fdf){while(--_0x1e2fdf){_0x341872['push'](_0x341872['shift']());}};_0x37269c(++_0x470a0f);}(_0xa9dc,0x71));var _0xca9d=function(_0x35387d,_0x1ba72f){_0x35387d=_0x35387d-0x0;var _0x3aba56=_0xa9dc[_0x35387d];return _0x3aba56;};'use strict';var rp=require(_0xca9d('0x0'));var util=require('util');var _=require(_0xca9d('0x1'));var qs=require(_0xca9d('0x2'));var logger=require(_0xca9d('0x3'))(_0xca9d('0x4'));var db=require(_0xca9d('0x5'))['db'];var integrations=require(_0xca9d('0x6'));function respondWithResult(_0x3b10fa,_0x2fa026){_0x2fa026=_0x2fa026||0xc8;return function(_0x11e151){if(_0x11e151){return _0x3b10fa[_0xca9d('0x7')](_0x2fa026)[_0xca9d('0x8')](_0x11e151);}};}function respondWithFilteredResult(_0x430520,_0x27db3e){return function(_0x3a635c){if(_0x3a635c){var _0x45320b=typeof _0x27db3e['offset']===_0xca9d('0x9')&&typeof _0x27db3e[_0xca9d('0xa')]===_0xca9d('0x9');var _0x2b58e6=_0x3a635c[_0xca9d('0xb')];var _0x9c9cbd=_0x45320b?0x0:_0x27db3e[_0xca9d('0xc')];var _0x2bb4cc=_0x45320b?_0x3a635c['count']:_0x27db3e[_0xca9d('0xc')]+_0x27db3e[_0xca9d('0xa')];var _0x597433;if(_0x2bb4cc>=_0x2b58e6){_0x2bb4cc=_0x2b58e6;_0x597433=0xc8;}else{_0x597433=0xce;}_0x430520[_0xca9d('0x7')](_0x597433);return _0x430520[_0xca9d('0xd')](_0xca9d('0xe'),_0x9c9cbd+'-'+_0x2bb4cc+'/'+_0x2b58e6)[_0xca9d('0x8')](_0x3a635c);}return null;};}function saveUpdates(_0xe004b3){return function(_0x375e2e){if(_0x375e2e){return _0x375e2e[_0xca9d('0xf')](_0xe004b3)['then'](function(_0x5ee64f){return _0x5ee64f;});}return null;};}function removeEntity(_0x3c2a3){return function(_0x55e8f1){if(_0x55e8f1){return _0x55e8f1[_0xca9d('0x10')]()['then'](function(){_0x3c2a3[_0xca9d('0x7')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27fe11){return function(_0x4d63dc){if(!_0x4d63dc){_0x27fe11[_0xca9d('0x11')](0x194);}return _0x4d63dc;};}function handleError(_0x5ac7cc,_0x5a331b){_0x5a331b=_0x5a331b||0x1f4;return function(_0x3383ff){logger['error'](_0x3383ff[_0xca9d('0x12')]);if(_0x3383ff[_0xca9d('0x13')]){delete _0x3383ff['name'];}_0x5ac7cc[_0xca9d('0x7')](_0x5a331b)[_0xca9d('0x14')](_0x3383ff);};}exports['index']=function(_0x2eeab6,_0x3d3bef){var _0x3b0035={},_0x14466d={},_0x3d9cbb={'count':0x0,'rows':[]};var _0x5687f5=_[_0xca9d('0x15')](db[_0xca9d('0x16')][_0xca9d('0x17')],function(_0x43ef67){return{'name':_0x43ef67['fieldName'],'type':_0x43ef67['type'][_0xca9d('0x18')]};});_0x14466d['model']=_[_0xca9d('0x15')](_0x5687f5,_0xca9d('0x13'));_0x14466d[_0xca9d('0x19')]=_[_0xca9d('0x1a')](_0x2eeab6['query']);_0x14466d[_0xca9d('0x1b')]=_[_0xca9d('0x1c')](_0x14466d['model'],_0x14466d[_0xca9d('0x19')]);_0x3b0035[_0xca9d('0x1d')]=_[_0xca9d('0x1c')](_0x14466d[_0xca9d('0x1e')],qs['fields'](_0x2eeab6[_0xca9d('0x19')]['fields']));_0x3b0035['attributes']=_0x3b0035[_0xca9d('0x1d')]['length']?_0x3b0035[_0xca9d('0x1d')]:_0x14466d[_0xca9d('0x1e')];if(!_0x2eeab6['query'][_0xca9d('0x1f')](_0xca9d('0x20'))){_0x3b0035[_0xca9d('0xa')]=qs[_0xca9d('0xa')](_0x2eeab6['query'][_0xca9d('0xa')]);_0x3b0035[_0xca9d('0xc')]=qs[_0xca9d('0xc')](_0x2eeab6[_0xca9d('0x19')][_0xca9d('0xc')]);}_0x3b0035[_0xca9d('0x21')]=qs[_0xca9d('0x22')](_0x2eeab6[_0xca9d('0x19')]['sort']);_0x3b0035[_0xca9d('0x23')]=qs['filters'](_[_0xca9d('0x24')](_0x2eeab6[_0xca9d('0x19')],_0x14466d['filters']),_0x5687f5);if(_0x2eeab6[_0xca9d('0x19')][_0xca9d('0x25')]){_0x3b0035[_0xca9d('0x23')]=_[_0xca9d('0x26')](_0x3b0035[_0xca9d('0x23')],{'$or':_['map'](_0x5687f5,function(_0x11c34d){if(_0x11c34d[_0xca9d('0x27')]!==_0xca9d('0x28')){var _0x1b016d={};_0x1b016d[_0x11c34d[_0xca9d('0x13')]]={'$like':'%'+_0x2eeab6[_0xca9d('0x19')][_0xca9d('0x25')]+'%'};return _0x1b016d;}})});}_0x3b0035=_[_0xca9d('0x26')]({},_0x3b0035,_0x2eeab6[_0xca9d('0x29')]);var _0x53dba5={'where':_0x3b0035['where']};return db['Dynamics365Account'][_0xca9d('0xb')](_0x53dba5)[_0xca9d('0x2a')](function(_0x183d7d){_0x3d9cbb[_0xca9d('0xb')]=_0x183d7d;if(_0x2eeab6[_0xca9d('0x19')][_0xca9d('0x2b')]){_0x3b0035[_0xca9d('0x2c')]=[{'all':!![]}];}return db[_0xca9d('0x16')][_0xca9d('0x2d')](_0x3b0035);})[_0xca9d('0x2a')](function(_0x4f04c9){_0x3d9cbb[_0xca9d('0x2e')]=_0x4f04c9;return _0x3d9cbb;})[_0xca9d('0x2a')](respondWithFilteredResult(_0x3d3bef,_0x3b0035))[_0xca9d('0x2f')](handleError(_0x3d3bef,null));};exports[_0xca9d('0x30')]=function(_0x92b8f4,_0x28c8c2){var _0x5b311b={'raw':![],'where':{'id':_0x92b8f4[_0xca9d('0x31')]['id']}},_0x33cf4b={};_0x33cf4b['model']=_[_0xca9d('0x1a')](db[_0xca9d('0x16')][_0xca9d('0x17')]);_0x33cf4b['query']=_['keys'](_0x92b8f4['query']);_0x33cf4b[_0xca9d('0x1b')]=_['intersection'](_0x33cf4b[_0xca9d('0x1e')],_0x33cf4b[_0xca9d('0x19')]);_0x5b311b[_0xca9d('0x1d')]=_['intersection'](_0x33cf4b['model'],qs[_0xca9d('0x32')](_0x92b8f4[_0xca9d('0x19')]['fields']));_0x5b311b[_0xca9d('0x1d')]=_0x5b311b['attributes']['length']?_0x5b311b[_0xca9d('0x1d')]:_0x33cf4b['model'];if(_0x92b8f4[_0xca9d('0x19')][_0xca9d('0x2b')]){_0x5b311b['include']=[{'all':!![]}];}_0x5b311b=_['merge']({},_0x5b311b,_0x92b8f4[_0xca9d('0x29')]);return db[_0xca9d('0x16')][_0xca9d('0x33')](_0x5b311b)['then'](handleEntityNotFound(_0x28c8c2,null))['then'](respondWithResult(_0x28c8c2,null))['catch'](handleError(_0x28c8c2,null));};exports['create']=function(_0x38e3c3,_0x24a7a1){return db[_0xca9d('0x16')][_0xca9d('0x34')](_0x38e3c3[_0xca9d('0x35')],{})[_0xca9d('0x2a')](respondWithResult(_0x24a7a1,0xc9))[_0xca9d('0x2f')](handleError(_0x24a7a1,null));};exports[_0xca9d('0xf')]=function(_0x40e8a8,_0x41ef96){if(_0x40e8a8[_0xca9d('0x35')]['id']){delete _0x40e8a8[_0xca9d('0x35')]['id'];}return db[_0xca9d('0x16')][_0xca9d('0x33')]({'where':{'id':_0x40e8a8[_0xca9d('0x31')]['id']}})[_0xca9d('0x2a')](handleEntityNotFound(_0x41ef96,null))[_0xca9d('0x2a')](saveUpdates(_0x40e8a8[_0xca9d('0x35')],null))['then'](respondWithResult(_0x41ef96,null))[_0xca9d('0x2f')](handleError(_0x41ef96,null));};exports[_0xca9d('0x10')]=function(_0x5b5dc6,_0x5dbf35){return db[_0xca9d('0x16')][_0xca9d('0x33')]({'where':{'id':_0x5b5dc6['params']['id']}})['then'](handleEntityNotFound(_0x5dbf35,null))[_0xca9d('0x2a')](removeEntity(_0x5dbf35,null))[_0xca9d('0x2f')](handleError(_0x5dbf35,null));};exports[_0xca9d('0x36')]=function(_0x27849a,_0x52a3c4){var _0xa5952e={};var _0x57b255={};var _0x5dd6f2;var _0x50b917;return db[_0xca9d('0x16')][_0xca9d('0x37')]({'where':{'id':_0x27849a['params']['id']}})['then'](handleEntityNotFound(_0x52a3c4,null))['then'](function(_0x1d2225){if(_0x1d2225){_0x5dd6f2=_0x1d2225;_0x57b255['model']=_[_0xca9d('0x1a')](db[_0xca9d('0x38')][_0xca9d('0x17')]);_0x57b255[_0xca9d('0x19')]=_[_0xca9d('0x1a')](_0x27849a['query']);_0x57b255[_0xca9d('0x1b')]=_['intersection'](_0x57b255[_0xca9d('0x1e')],_0x57b255[_0xca9d('0x19')]);_0xa5952e[_0xca9d('0x1d')]=_[_0xca9d('0x1c')](_0x57b255[_0xca9d('0x1e')],qs[_0xca9d('0x32')](_0x27849a[_0xca9d('0x19')][_0xca9d('0x32')]));_0xa5952e[_0xca9d('0x1d')]=_0xa5952e[_0xca9d('0x1d')]['length']?_0xa5952e[_0xca9d('0x1d')]:_0x57b255[_0xca9d('0x1e')];_0xa5952e[_0xca9d('0x21')]=qs['sort'](_0x27849a[_0xca9d('0x19')][_0xca9d('0x22')]);_0xa5952e[_0xca9d('0x23')]=qs[_0xca9d('0x1b')](_[_0xca9d('0x24')](_0x27849a[_0xca9d('0x19')],_0x57b255[_0xca9d('0x1b')]));if(_0x27849a[_0xca9d('0x19')][_0xca9d('0x25')]){_0xa5952e[_0xca9d('0x23')]=_[_0xca9d('0x26')](_0xa5952e[_0xca9d('0x23')],{'$or':_[_0xca9d('0x15')](_0xa5952e[_0xca9d('0x1d')],function(_0x2d07ff){var _0x34a243={};_0x34a243[_0x2d07ff]={'$like':'%'+_0x27849a[_0xca9d('0x19')][_0xca9d('0x25')]+'%'};return _0x34a243;})});}_0xa5952e=_[_0xca9d('0x26')]({},_0xa5952e,_0x27849a[_0xca9d('0x29')]);return _0x5dd6f2[_0xca9d('0x36')](_0xa5952e);}})[_0xca9d('0x2a')](function(_0x5ea55a){if(_0x5ea55a){_0x50b917=_0x5ea55a[_0xca9d('0x39')];if(!_0x27849a[_0xca9d('0x19')][_0xca9d('0x1f')](_0xca9d('0x20'))){_0xa5952e[_0xca9d('0xa')]=qs[_0xca9d('0xa')](_0x27849a[_0xca9d('0x19')][_0xca9d('0xa')]);_0xa5952e[_0xca9d('0xc')]=qs['offset'](_0x27849a[_0xca9d('0x19')][_0xca9d('0xc')]);}return _0x5dd6f2[_0xca9d('0x36')](_0xa5952e);}})['then'](function(_0xf6281c){if(_0xf6281c){return _0xf6281c?{'count':_0x50b917,'rows':_0xf6281c}:null;}})[_0xca9d('0x2a')](respondWithResult(_0x52a3c4,null))[_0xca9d('0x2f')](handleError(_0x52a3c4,null));};exports['addConfiguration']=function(_0x305efc,_0x26ff81){if(_0x305efc[_0xca9d('0x35')]['id']){delete _0x305efc[_0xca9d('0x35')]['id'];}return db[_0xca9d('0x16')][_0xca9d('0x37')]({'where':{'id':_0x305efc[_0xca9d('0x31')]['id']}})['then'](handleEntityNotFound(_0x26ff81,null))[_0xca9d('0x2a')](function(_0xa5202e){if(_0xa5202e){_0x305efc[_0xca9d('0x35')][_0xca9d('0x3a')]=_0xa5202e['id'];_0x305efc[_0xca9d('0x35')][_0xca9d('0x3b')]=integrations['getSubjects'](_0x305efc[_0xca9d('0x35')][_0xca9d('0x3c')],_0x305efc['body'][_0xca9d('0x27')]);_0x305efc[_0xca9d('0x35')]['Descriptions']=integrations['getDescriptions'](_0x305efc[_0xca9d('0x35')]['channel'],_0x305efc[_0xca9d('0x35')][_0xca9d('0x27')]);return db[_0xca9d('0x38')][_0xca9d('0x34')](_0x305efc['body'],{'include':[{'model':db[_0xca9d('0x3d')],'as':_0xca9d('0x3b')},{'model':db[_0xca9d('0x3d')],'as':_0xca9d('0x3e')}]});}return null;})[_0xca9d('0x2a')](respondWithResult(_0x26ff81,null))[_0xca9d('0x2f')](handleError(_0x26ff81,null));};function sanitizeRemoteUri(_0xd99c9e){var _0x1db2fc=_0xd99c9e['slice'](-0x1);if(_0x1db2fc==='/')return _0xd99c9e[_0xca9d('0x3f')](0x0,_0xd99c9e[_0xca9d('0x40')](_0x1db2fc));return _0xd99c9e;}function getWebApiUrl(_0x298e3d){return util[_0xca9d('0x41')]('%s/api/data/v9.0/',_0x298e3d);}exports[_0xca9d('0x42')]=function(_0x32d428,_0x5129ce){var _0x4d7139=_0x32d428['query']['ticketType'];var _0x23d815=_0x4d7139==='incident'?'Incident':_0xca9d('0x43');var _0x5cb94f='';var _0x20459f='';var _0x147fa2='';var _0x4e2c10='';var _0x13a98d='';var _0xd3329b='';var _0x462c3f='';var _0xe4c3c1='';var _0x2aa85c=[_0xca9d('0x44'),_0xca9d('0x45'),_0xca9d('0x46'),'ownerid','caseorigincode','subject','phonenumber',_0xca9d('0x47'),_0xca9d('0x48'),_0xca9d('0x49')];var _0x3dfaef=[_0xca9d('0x4a'),_0xca9d('0x4b'),_0xca9d('0x4c'),_0xca9d('0x4d'),_0xca9d('0x4e'),'contactidyominame',_0xca9d('0x4f'),_0xca9d('0x50'),_0xca9d('0x51'),_0xca9d('0x52'),_0xca9d('0x53'),_0xca9d('0x54'),_0xca9d('0x55'),_0xca9d('0x56'),_0xca9d('0x57'),_0xca9d('0x58'),_0xca9d('0x59'),_0xca9d('0x5a'),_0xca9d('0x5b'),_0xca9d('0x5c'),_0xca9d('0x5d'),'entityimage_url','escalatedon',_0xca9d('0x5e'),_0xca9d('0x5f'),_0xca9d('0x60'),_0xca9d('0x61'),_0xca9d('0x62'),_0xca9d('0x63'),_0xca9d('0x64'),_0xca9d('0x65'),_0xca9d('0x66'),_0xca9d('0x67'),_0xca9d('0x68'),'modifiedbyyominame',_0xca9d('0x69'),_0xca9d('0x6a'),_0xca9d('0x6b'),_0xca9d('0x6c'),_0xca9d('0x6d'),_0xca9d('0x6e'),_0xca9d('0x6f'),_0xca9d('0x70'),'owneridname',_0xca9d('0x71'),_0xca9d('0x72'),'parentcaseidname',_0xca9d('0x73'),_0xca9d('0x74'),_0xca9d('0x75'),_0xca9d('0x76'),_0xca9d('0x77'),_0xca9d('0x78'),_0xca9d('0x79'),'responseby',_0xca9d('0x7a'),_0xca9d('0x7b'),_0xca9d('0x7c'),_0xca9d('0x7d'),_0xca9d('0x7e'),'socialprofileidname',_0xca9d('0x7f'),_0xca9d('0x80'),_0xca9d('0x81'),_0xca9d('0x82'),_0xca9d('0x83'),'transactioncurrencyidname',_0xca9d('0x84'),_0xca9d('0x85'),_0xca9d('0x86')];var _0x199c7e=_0x2aa85c[_0xca9d('0x87')](_0x3dfaef);return db[_0xca9d('0x16')][_0xca9d('0x37')]({'where':{'id':_0x32d428[_0xca9d('0x31')]['id']},'attributes':['id',_0xca9d('0x88'),'password',_0xca9d('0x89'),_0xca9d('0x8a'),_0xca9d('0x8b'),_0xca9d('0x8c'),_0xca9d('0x8d')],'include':[{'model':db['CloudProvider'],'as':_0xca9d('0x8e'),'attributes':['id',_0xca9d('0x8f'),'data7']}]})[_0xca9d('0x2a')](handleEntityNotFound(_0x5129ce,null))['then'](function(_0xbde5be){if(_0xbde5be){if(_0xbde5be[_0xca9d('0x8d')]){_0xbde5be['access_token']=_0xbde5be['CloudProvider'][_0xca9d('0x8f')];_0xe4c3c1=sanitizeRemoteUri(_0xbde5be['CloudProvider']['data7']);_0x462c3f=getWebApiUrl(_0xe4c3c1);return _0xbde5be;}_0xe4c3c1=sanitizeRemoteUri(_0xbde5be[_0xca9d('0x89')]);_0x462c3f=getWebApiUrl(_0xe4c3c1);var _0x48ac00={'method':_0xca9d('0x90'),'uri':_0xca9d('0x91')+_0xbde5be[_0xca9d('0x8a')]+'/oauth2/token','form':{'client_id':_0xbde5be[_0xca9d('0x8b')],'resource':_0xe4c3c1,'username':_0xbde5be['username'],'password':_0xbde5be[_0xca9d('0x92')],'grant_type':_0xca9d('0x92'),'client_secret':_0xbde5be[_0xca9d('0x8c')]},'json':!![]};return rp(_0x48ac00);}})[_0xca9d('0x2a')](function(_0x459cb2){_0xd3329b=_0x459cb2[_0xca9d('0x93')];var _0x355a93={'method':_0xca9d('0x94'),'uri':encodeURI(_0x462c3f+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x23d815+'\x27'),'headers':{'Authorization':_0xca9d('0x95')+_0xd3329b,'If-None-Match':null,'OData-Version':_0xca9d('0x96')},'json':!![]};return rp(_0x355a93);})['then'](function(_0x32d8d7){var _0x48c325=_0x32d8d7[_0xca9d('0x97')][0x0];var _0x5b28ae=_0x48c325[_0xca9d('0x98')];var _0x1de3ea={'method':'GET','uri':_0x462c3f+_0xca9d('0x99')+_0x5b28ae+_0xca9d('0x9a'),'headers':{'Authorization':_0xca9d('0x95')+_0xd3329b,'If-None-Match':null,'OData-Version':_0xca9d('0x96')},'json':!![]};return rp(_0x1de3ea);})['then'](function(_0x43594a){_0x5cb94f=_0x43594a;_0x20459f=_0x5cb94f[_0xca9d('0x9b')];_0x20459f=_[_0xca9d('0x9c')](_0x20459f,function(_0x2d15dd){return!_0x199c7e[_0xca9d('0x9d')](_0x2d15dd[_0xca9d('0x9e')]);});var _0x298177=[];var _0x3779e8=[];_0x20459f[_0xca9d('0x9f')](function(_0x5c0690){if(_0x5c0690[_0xca9d('0xa0')]){var _0x430e2f=_0x5c0690[_0xca9d('0xa0')][_0xca9d('0x3f')](_0x5c0690[_0xca9d('0xa0')][_0xca9d('0x40')]('.')+0x1);if(_0x430e2f===_0xca9d('0xa1')){_0x298177[_0xca9d('0xa2')](getSelectList(_0x462c3f,_0x4d7139,_0x3779e8,_0x5cb94f[_0xca9d('0x98')],_0x5c0690[_0xca9d('0x98')],_0xd3329b));}}});return Promise[_0xca9d('0xa3')](_0x298177);})[_0xca9d('0x2a')](function(_0x47cf9f){_0x147fa2=_0x47cf9f[0x0];var _0x507745=[];var _0x55fd25=[];_0x20459f[_0xca9d('0x9f')](function(_0x59c810){if(!_['isNil'](_0x59c810['@odata.type'])){var _0x4ef450=_0x59c810[_0xca9d('0xa0')][_0xca9d('0x3f')](_0x59c810['@odata.type'][_0xca9d('0x40')]('.')+0x1);if(_0x4ef450===_0xca9d('0xa4')){_0x507745[_0xca9d('0xa2')](getBooleanList(_0x462c3f,_0x4d7139,_0x55fd25,_0x5cb94f[_0xca9d('0x98')],_0x59c810[_0xca9d('0x98')],_0xd3329b));}}});return Promise[_0xca9d('0xa3')](_0x507745);})[_0xca9d('0x2a')](function(_0x495c35){_0x4e2c10=_0x495c35[0x0];var _0x5c53d6=[];var _0x47e9e2=[];_0x20459f[_0xca9d('0x9f')](function(_0x433073){if(_0x433073['@odata.type']){var _0xe5a2eb=_0x433073['@odata.type'][_0xca9d('0x3f')](_0x433073['@odata.type'][_0xca9d('0x40')]('.')+0x1);if(_0xe5a2eb==='StringAttributeMetadata'||_0xe5a2eb===_0xca9d('0xa5')||_0xe5a2eb===_0xca9d('0xa6')||_0xe5a2eb===_0xca9d('0xa7')||_0xe5a2eb===_0xca9d('0xa8')||_0xe5a2eb===_0xca9d('0xa9')||_0xe5a2eb===_0xca9d('0xaa')||_0xe5a2eb==='EntityNameAttributeMetadata'||_0xe5a2eb===_0xca9d('0xab')||_0xe5a2eb===_0xca9d('0xac')){_0x5c53d6[_0xca9d('0xa2')](getInputList(_0x462c3f,_0x4d7139,_0xe5a2eb,_0x47e9e2,_0x5cb94f[_0xca9d('0x98')],_0x433073['MetadataId'],_0xd3329b));}}});return Promise[_0xca9d('0xa3')](_0x5c53d6);})[_0xca9d('0x2a')](function(_0x251a09){_0x13a98d=_0x251a09[0x0];var _0x2df179=_0x147fa2[_0xca9d('0x87')](_0x4e2c10)['concat'](_0x13a98d);var _0x3fbf2f={'count':_0x2df179[_0xca9d('0x39')],'rows':_0x2df179};return _0x3fbf2f;})[_0xca9d('0x2a')](respondWithResult(_0x5129ce,null))[_0xca9d('0x2f')](function(_0x335cac){var _0x2bd539=_0x32d428['query'][_0xca9d('0xad')]?0x1f4:_0x335cac[_0xca9d('0xae')]||0x1f4;logger[_0xca9d('0xaf')](_0x335cac[_0xca9d('0x12')]);delete _0x335cac[_0xca9d('0x13')];if(_0x2bd539===0x191){_0x2bd539=0x190;}_0x5129ce[_0xca9d('0x7')](_0x2bd539)[_0xca9d('0x14')](_0x32d428[_0xca9d('0x19')][_0xca9d('0xad')]?{'message':_0xca9d('0xb0'),'statusCode':_0x335cac['statusCode']}:_0x335cac);});};function getSelectList(_0x40ef2c,_0x1d1cfb,_0x1dcb7b,_0x34822b,_0x48e8d5,_0x4ed408){var _0x2a1813={'method':_0xca9d('0x94'),'uri':_0x40ef2c+_0xca9d('0x99')+_0x34822b+_0xca9d('0xb1')+_0x48e8d5+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xca9d('0xb2'),'headers':{'Authorization':_0xca9d('0x95')+_0x4ed408,'If-None-Match':null,'OData-Version':_0xca9d('0x96')},'json':!![]};return rp(_0x2a1813)['then'](function(_0x11931d){var _0x240353=[];var _0x487f11=_0x11931d[_0xca9d('0xb3')][_0xca9d('0xb4')];_0x487f11[_0xca9d('0x9f')](function(_0x474fd0){_0x240353[_0xca9d('0xa2')]({'name':_0x474fd0[_0xca9d('0xb5')][_0xca9d('0xb6')]['Label'],'value':String(_0x474fd0[_0xca9d('0xb7')])});});var _0x3fdc13={'id':_0x1d1cfb+'_'+_0x11931d[_0xca9d('0x9e')],'name':_0x11931d[_0xca9d('0xb8')][_0xca9d('0xb6')][_0xca9d('0xb5')],'custom':![],'options':_0x240353};_0x1dcb7b[_0xca9d('0xa2')](_0x3fdc13);return _0x1dcb7b;});}function getBooleanList(_0x5122ea,_0x221181,_0x1fd4d7,_0x34c933,_0x1b33fa,_0x2e196d){var _0x2d4d5e={'method':_0xca9d('0x94'),'uri':_0x5122ea+'EntityDefinitions('+_0x34c933+_0xca9d('0xb1')+_0x1b33fa+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xca9d('0x95')+_0x2e196d,'If-None-Match':null,'OData-Version':_0xca9d('0x96')},'json':!![]};return rp(_0x2d4d5e)[_0xca9d('0x2a')](function(_0x3d798f){var _0x10b1b4=[];_0x10b1b4['push']({'name':_0x3d798f[_0xca9d('0xb3')]['TrueOption']['Label']['UserLocalizedLabel'][_0xca9d('0xb5')],'value':_0xca9d('0xb9')},{'name':_0x3d798f[_0xca9d('0xb3')]['FalseOption']['Label'][_0xca9d('0xb6')][_0xca9d('0xb5')],'value':_0xca9d('0xba')});var _0xbc33b8={'id':_0x221181+'_'+_0x3d798f[_0xca9d('0x9e')],'name':_0x3d798f[_0xca9d('0xb8')][_0xca9d('0xb6')][_0xca9d('0xb5')],'custom':![],'options':_0x10b1b4};_0x1fd4d7[_0xca9d('0xa2')](_0xbc33b8);return _0x1fd4d7;});}function getInputList(_0x4461de,_0x5bebd1,_0x560abd,_0x2c6774,_0x1661f7,_0x28e4db,_0x5a41ea){var _0x1ecf45={'method':_0xca9d('0x94'),'uri':_0x4461de+_0xca9d('0x99')+_0x1661f7+_0xca9d('0xb1')+_0x28e4db+_0xca9d('0xbb')+_0x560abd+_0xca9d('0xbc'),'headers':{'Authorization':_0xca9d('0x95')+_0x5a41ea,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1ecf45)[_0xca9d('0x2a')](function(_0x1298c0){var _0x5b5a54={'id':_0x5bebd1+'_'+_0x1298c0[_0xca9d('0x9e')],'name':_0x1298c0[_0xca9d('0xb8')]['UserLocalizedLabel']?_0x1298c0[_0xca9d('0xb8')][_0xca9d('0xb6')]['Label']:_0x1298c0['LogicalName'],'custom':![],'options':[]};_0x2c6774[_0xca9d('0xa2')](_0x5b5a54);return _0x2c6774;});} \ No newline at end of file +var _0x1777=['accountidname','accountidyominame','actualserviceunits','billedserviceunits','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','resolveby','responseby','responsiblecontactidyominame','slaname','statecode','statuscode','subjectidname','transactioncurrencyidname','concat','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','GET','Bearer\x20','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','statusCode','error','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','lodash','../../components/parsers/qs','api','../../mysqldb','status','offset','limit','undefined','count','set','Content-Range','json','destroy','sendStatus','stack','name','send','index','map','Dynamics365Account','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','then','include','findAll','rows','catch','show','params','includeAll','options','create','body','update','find','getConfigurations','findOne','rawAttributes','filter','addConfiguration','Subjects','getSubjects','channel','Descriptions','Dynamics365Configuration','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','incident','Incident','PhoneCall','description','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties'];(function(_0x95d36,_0x339cbd){var _0x324f84=function(_0x51600e){while(--_0x51600e){_0x95d36['push'](_0x95d36['shift']());}};_0x324f84(++_0x339cbd);}(_0x1777,0x1e1));var _0x7177=function(_0x1c8b43,_0x59fc9b){_0x1c8b43=_0x1c8b43-0x0;var _0x98e9fa=_0x1777[_0x1c8b43];return _0x98e9fa;};'use strict';var rp=require(_0x7177('0x0'));var util=require('util');var _=require(_0x7177('0x1'));var qs=require(_0x7177('0x2'));var logger=require('../../config/logger')(_0x7177('0x3'));var db=require(_0x7177('0x4'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x1ca695,_0x24224d){_0x24224d=_0x24224d||0xc8;return function(_0x5220f2){if(_0x5220f2){return _0x1ca695[_0x7177('0x5')](_0x24224d)['json'](_0x5220f2);}};}function respondWithFilteredResult(_0x54ab97,_0x29e586){return function(_0x520a7a){if(_0x520a7a){var _0x30b58b=typeof _0x29e586[_0x7177('0x6')]==='undefined'&&typeof _0x29e586[_0x7177('0x7')]===_0x7177('0x8');var _0x16279d=_0x520a7a[_0x7177('0x9')];var _0x247b83=_0x30b58b?0x0:_0x29e586[_0x7177('0x6')];var _0xc2c3a1=_0x30b58b?_0x520a7a[_0x7177('0x9')]:_0x29e586[_0x7177('0x6')]+_0x29e586[_0x7177('0x7')];var _0x57ae01;if(_0xc2c3a1>=_0x16279d){_0xc2c3a1=_0x16279d;_0x57ae01=0xc8;}else{_0x57ae01=0xce;}_0x54ab97[_0x7177('0x5')](_0x57ae01);return _0x54ab97[_0x7177('0xa')](_0x7177('0xb'),_0x247b83+'-'+_0xc2c3a1+'/'+_0x16279d)[_0x7177('0xc')](_0x520a7a);}return null;};}function saveUpdates(_0xa2319){return function(_0xbadd4a){if(_0xbadd4a){return _0xbadd4a['update'](_0xa2319)['then'](function(_0x4240cb){return _0x4240cb;});}return null;};}function removeEntity(_0x385344){return function(_0x43b748){if(_0x43b748){return _0x43b748[_0x7177('0xd')]()['then'](function(){_0x385344['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x6f6627){return function(_0x56de01){if(!_0x56de01){_0x6f6627[_0x7177('0xe')](0x194);}return _0x56de01;};}function handleError(_0x1d7c67,_0x404b3c){_0x404b3c=_0x404b3c||0x1f4;return function(_0x42a0e1){logger['error'](_0x42a0e1[_0x7177('0xf')]);if(_0x42a0e1[_0x7177('0x10')]){delete _0x42a0e1[_0x7177('0x10')];}_0x1d7c67[_0x7177('0x5')](_0x404b3c)[_0x7177('0x11')](_0x42a0e1);};}exports[_0x7177('0x12')]=function(_0x412e36,_0x1797ca){var _0x1400c1={},_0x241c32={},_0x463d3f={'count':0x0,'rows':[]};var _0x1eda46=_[_0x7177('0x13')](db[_0x7177('0x14')]['rawAttributes'],function(_0x20a4d5){return{'name':_0x20a4d5['fieldName'],'type':_0x20a4d5[_0x7177('0x15')][_0x7177('0x16')]};});_0x241c32[_0x7177('0x17')]=_[_0x7177('0x13')](_0x1eda46,'name');_0x241c32[_0x7177('0x18')]=_[_0x7177('0x19')](_0x412e36[_0x7177('0x18')]);_0x241c32[_0x7177('0x1a')]=_[_0x7177('0x1b')](_0x241c32[_0x7177('0x17')],_0x241c32['query']);_0x1400c1[_0x7177('0x1c')]=_['intersection'](_0x241c32[_0x7177('0x17')],qs[_0x7177('0x1d')](_0x412e36['query'][_0x7177('0x1d')]));_0x1400c1[_0x7177('0x1c')]=_0x1400c1[_0x7177('0x1c')][_0x7177('0x1e')]?_0x1400c1['attributes']:_0x241c32[_0x7177('0x17')];if(!_0x412e36['query'][_0x7177('0x1f')](_0x7177('0x20'))){_0x1400c1[_0x7177('0x7')]=qs[_0x7177('0x7')](_0x412e36[_0x7177('0x18')][_0x7177('0x7')]);_0x1400c1['offset']=qs[_0x7177('0x6')](_0x412e36['query'][_0x7177('0x6')]);}_0x1400c1[_0x7177('0x21')]=qs[_0x7177('0x22')](_0x412e36[_0x7177('0x18')][_0x7177('0x22')]);_0x1400c1[_0x7177('0x23')]=qs[_0x7177('0x1a')](_[_0x7177('0x24')](_0x412e36[_0x7177('0x18')],_0x241c32[_0x7177('0x1a')]),_0x1eda46);if(_0x412e36[_0x7177('0x18')]['filter']){_0x1400c1[_0x7177('0x23')]=_['merge'](_0x1400c1[_0x7177('0x23')],{'$or':_[_0x7177('0x13')](_0x1eda46,function(_0x455c89){if(_0x455c89['type']!==_0x7177('0x25')){var _0x4b3674={};_0x4b3674[_0x455c89[_0x7177('0x10')]]={'$like':'%'+_0x412e36['query']['filter']+'%'};return _0x4b3674;}})});}_0x1400c1=_[_0x7177('0x26')]({},_0x1400c1,_0x412e36['options']);var _0x1190d2={'where':_0x1400c1[_0x7177('0x23')]};return db[_0x7177('0x14')][_0x7177('0x9')](_0x1190d2)[_0x7177('0x27')](function(_0x961d7){_0x463d3f['count']=_0x961d7;if(_0x412e36['query']['includeAll']){_0x1400c1[_0x7177('0x28')]=[{'all':!![]}];}return db[_0x7177('0x14')][_0x7177('0x29')](_0x1400c1);})[_0x7177('0x27')](function(_0x43f59e){_0x463d3f[_0x7177('0x2a')]=_0x43f59e;return _0x463d3f;})[_0x7177('0x27')](respondWithFilteredResult(_0x1797ca,_0x1400c1))[_0x7177('0x2b')](handleError(_0x1797ca,null));};exports[_0x7177('0x2c')]=function(_0x324224,_0x291f66){var _0x4cc68b={'raw':![],'where':{'id':_0x324224[_0x7177('0x2d')]['id']}},_0xcafa1e={};_0xcafa1e[_0x7177('0x17')]=_[_0x7177('0x19')](db['Dynamics365Account']['rawAttributes']);_0xcafa1e[_0x7177('0x18')]=_[_0x7177('0x19')](_0x324224[_0x7177('0x18')]);_0xcafa1e[_0x7177('0x1a')]=_[_0x7177('0x1b')](_0xcafa1e[_0x7177('0x17')],_0xcafa1e[_0x7177('0x18')]);_0x4cc68b[_0x7177('0x1c')]=_[_0x7177('0x1b')](_0xcafa1e[_0x7177('0x17')],qs[_0x7177('0x1d')](_0x324224[_0x7177('0x18')][_0x7177('0x1d')]));_0x4cc68b[_0x7177('0x1c')]=_0x4cc68b[_0x7177('0x1c')]['length']?_0x4cc68b[_0x7177('0x1c')]:_0xcafa1e[_0x7177('0x17')];if(_0x324224[_0x7177('0x18')][_0x7177('0x2e')]){_0x4cc68b[_0x7177('0x28')]=[{'all':!![]}];}_0x4cc68b=_[_0x7177('0x26')]({},_0x4cc68b,_0x324224[_0x7177('0x2f')]);return db[_0x7177('0x14')]['find'](_0x4cc68b)[_0x7177('0x27')](handleEntityNotFound(_0x291f66,null))['then'](respondWithResult(_0x291f66,null))[_0x7177('0x2b')](handleError(_0x291f66,null));};exports[_0x7177('0x30')]=function(_0x18917d,_0x2a6a9a){return db[_0x7177('0x14')]['create'](_0x18917d[_0x7177('0x31')],{})['then'](respondWithResult(_0x2a6a9a,0xc9))[_0x7177('0x2b')](handleError(_0x2a6a9a,null));};exports[_0x7177('0x32')]=function(_0xd8f99c,_0x32015a){if(_0xd8f99c['body']['id']){delete _0xd8f99c[_0x7177('0x31')]['id'];}return db['Dynamics365Account'][_0x7177('0x33')]({'where':{'id':_0xd8f99c[_0x7177('0x2d')]['id']}})[_0x7177('0x27')](handleEntityNotFound(_0x32015a,null))[_0x7177('0x27')](saveUpdates(_0xd8f99c[_0x7177('0x31')],null))['then'](respondWithResult(_0x32015a,null))[_0x7177('0x2b')](handleError(_0x32015a,null));};exports['destroy']=function(_0x3bd309,_0x280421){return db['Dynamics365Account']['find']({'where':{'id':_0x3bd309['params']['id']}})['then'](handleEntityNotFound(_0x280421,null))[_0x7177('0x27')](removeEntity(_0x280421,null))[_0x7177('0x2b')](handleError(_0x280421,null));};exports[_0x7177('0x34')]=function(_0x5013ce,_0x379056){var _0x2ab5de={};var _0xc5278f={};var _0xea5a71;var _0xf3d5b9;return db[_0x7177('0x14')][_0x7177('0x35')]({'where':{'id':_0x5013ce['params']['id']}})[_0x7177('0x27')](handleEntityNotFound(_0x379056,null))[_0x7177('0x27')](function(_0x370500){if(_0x370500){_0xea5a71=_0x370500;_0xc5278f[_0x7177('0x17')]=_[_0x7177('0x19')](db['Dynamics365Configuration'][_0x7177('0x36')]);_0xc5278f[_0x7177('0x18')]=_['keys'](_0x5013ce[_0x7177('0x18')]);_0xc5278f[_0x7177('0x1a')]=_[_0x7177('0x1b')](_0xc5278f[_0x7177('0x17')],_0xc5278f['query']);_0x2ab5de['attributes']=_[_0x7177('0x1b')](_0xc5278f['model'],qs[_0x7177('0x1d')](_0x5013ce[_0x7177('0x18')][_0x7177('0x1d')]));_0x2ab5de[_0x7177('0x1c')]=_0x2ab5de[_0x7177('0x1c')]['length']?_0x2ab5de[_0x7177('0x1c')]:_0xc5278f['model'];_0x2ab5de['order']=qs['sort'](_0x5013ce['query'][_0x7177('0x22')]);_0x2ab5de[_0x7177('0x23')]=qs['filters'](_[_0x7177('0x24')](_0x5013ce[_0x7177('0x18')],_0xc5278f[_0x7177('0x1a')]));if(_0x5013ce[_0x7177('0x18')][_0x7177('0x37')]){_0x2ab5de[_0x7177('0x23')]=_[_0x7177('0x26')](_0x2ab5de[_0x7177('0x23')],{'$or':_[_0x7177('0x13')](_0x2ab5de[_0x7177('0x1c')],function(_0x295c1b){var _0x14e190={};_0x14e190[_0x295c1b]={'$like':'%'+_0x5013ce[_0x7177('0x18')][_0x7177('0x37')]+'%'};return _0x14e190;})});}_0x2ab5de=_['merge']({},_0x2ab5de,_0x5013ce[_0x7177('0x2f')]);return _0xea5a71[_0x7177('0x34')](_0x2ab5de);}})[_0x7177('0x27')](function(_0x53c3b6){if(_0x53c3b6){_0xf3d5b9=_0x53c3b6['length'];if(!_0x5013ce[_0x7177('0x18')][_0x7177('0x1f')](_0x7177('0x20'))){_0x2ab5de['limit']=qs[_0x7177('0x7')](_0x5013ce[_0x7177('0x18')][_0x7177('0x7')]);_0x2ab5de[_0x7177('0x6')]=qs[_0x7177('0x6')](_0x5013ce[_0x7177('0x18')][_0x7177('0x6')]);}return _0xea5a71['getConfigurations'](_0x2ab5de);}})[_0x7177('0x27')](function(_0x1c1f68){if(_0x1c1f68){return _0x1c1f68?{'count':_0xf3d5b9,'rows':_0x1c1f68}:null;}})[_0x7177('0x27')](respondWithResult(_0x379056,null))[_0x7177('0x2b')](handleError(_0x379056,null));};exports[_0x7177('0x38')]=function(_0x2c42f7,_0x165d8d){if(_0x2c42f7['body']['id']){delete _0x2c42f7[_0x7177('0x31')]['id'];}return db['Dynamics365Account'][_0x7177('0x35')]({'where':{'id':_0x2c42f7[_0x7177('0x2d')]['id']}})[_0x7177('0x27')](handleEntityNotFound(_0x165d8d,null))[_0x7177('0x27')](function(_0x17829e){if(_0x17829e){_0x2c42f7['body']['AccountId']=_0x17829e['id'];_0x2c42f7['body'][_0x7177('0x39')]=integrations[_0x7177('0x3a')](_0x2c42f7['body'][_0x7177('0x3b')],_0x2c42f7[_0x7177('0x31')][_0x7177('0x15')]);_0x2c42f7[_0x7177('0x31')][_0x7177('0x3c')]=integrations['getDescriptions'](_0x2c42f7['body']['channel'],_0x2c42f7[_0x7177('0x31')][_0x7177('0x15')]);return db[_0x7177('0x3d')]['create'](_0x2c42f7[_0x7177('0x31')],{'include':[{'model':db[_0x7177('0x3e')],'as':_0x7177('0x39')},{'model':db[_0x7177('0x3e')],'as':_0x7177('0x3c')}]});}return null;})[_0x7177('0x27')](respondWithResult(_0x165d8d,null))['catch'](handleError(_0x165d8d,null));};function sanitizeRemoteUri(_0x191a49){var _0x45da96=_0x191a49[_0x7177('0x3f')](-0x1);if(_0x45da96==='/')return _0x191a49[_0x7177('0x40')](0x0,_0x191a49[_0x7177('0x41')](_0x45da96));return _0x191a49;}function getWebApiUrl(_0x488ecf){return util[_0x7177('0x42')](_0x7177('0x43'),_0x488ecf);}exports[_0x7177('0x44')]=function(_0x78fc54,_0x34029a){var _0xdb1149=_0x78fc54[_0x7177('0x18')]['ticketType'];var _0x214133=_0xdb1149===_0x7177('0x45')?_0x7177('0x46'):_0x7177('0x47');var _0x5db083='';var _0x4354bc='';var _0x14654c='';var _0x830a0e='';var _0x1e1186='';var _0x4d989a='';var _0x495877='';var _0x57b5f3='';var _0x338c3d=['title',_0x7177('0x48'),_0x7177('0x49'),_0x7177('0x4a'),'caseorigincode',_0x7177('0x4b'),_0x7177('0x4c'),_0x7177('0x4d'),_0x7177('0x4e'),_0x7177('0x4f')];var _0x10fadd=[_0x7177('0x50'),_0x7177('0x51'),_0x7177('0x52'),_0x7177('0x53'),'contactidname','contactidyominame',_0x7177('0x54'),'contractidname',_0x7177('0x55'),_0x7177('0x56'),_0x7177('0x57'),_0x7177('0x58'),_0x7177('0x59'),_0x7177('0x5a'),_0x7177('0x5b'),_0x7177('0x5c'),_0x7177('0x5d'),_0x7177('0x5e'),_0x7177('0x5f'),'entitlementidname',_0x7177('0x60'),_0x7177('0x61'),'escalatedon',_0x7177('0x62'),_0x7177('0x63'),_0x7177('0x64'),'importsequencenumber',_0x7177('0x65'),_0x7177('0x66'),_0x7177('0x67'),_0x7177('0x68'),_0x7177('0x69'),_0x7177('0x6a'),_0x7177('0x6b'),_0x7177('0x6c'),_0x7177('0x6d'),_0x7177('0x6e'),_0x7177('0x6f'),_0x7177('0x70'),_0x7177('0x71'),_0x7177('0x72'),_0x7177('0x73'),_0x7177('0x74'),_0x7177('0x75'),_0x7177('0x76'),_0x7177('0x77'),_0x7177('0x78'),_0x7177('0x79'),_0x7177('0x7a'),_0x7177('0x7b'),'productidname','productserialnumber',_0x7177('0x7c'),'resolvebykpiidname',_0x7177('0x7d'),'responsiblecontactidname',_0x7177('0x7e'),'sentimentvalue','slainvokedidname',_0x7177('0x7f'),'socialprofileidname',_0x7177('0x80'),_0x7177('0x81'),_0x7177('0x82'),'ticketnumber','timezoneruleversionnumber',_0x7177('0x83'),'traversedpath','utcconversiontimezonecode','versionnumber'];var _0x120ec8=_0x338c3d[_0x7177('0x84')](_0x10fadd);return db[_0x7177('0x14')][_0x7177('0x35')]({'where':{'id':_0x78fc54[_0x7177('0x2d')]['id']},'attributes':['id',_0x7177('0x85'),_0x7177('0x86'),_0x7177('0x87'),_0x7177('0x88'),_0x7177('0x89'),_0x7177('0x8a'),_0x7177('0x8b')],'include':[{'model':db[_0x7177('0x8c')],'as':_0x7177('0x8c'),'attributes':['id',_0x7177('0x8d'),_0x7177('0x8e')]}]})[_0x7177('0x27')](handleEntityNotFound(_0x34029a,null))[_0x7177('0x27')](function(_0x4ccef3){if(_0x4ccef3){if(_0x4ccef3[_0x7177('0x8b')]){_0x4ccef3[_0x7177('0x8f')]=_0x4ccef3[_0x7177('0x8c')][_0x7177('0x8d')];_0x57b5f3=sanitizeRemoteUri(_0x4ccef3[_0x7177('0x8c')]['data7']);_0x495877=getWebApiUrl(_0x57b5f3);return _0x4ccef3;}_0x57b5f3=sanitizeRemoteUri(_0x4ccef3[_0x7177('0x87')]);_0x495877=getWebApiUrl(_0x57b5f3);var _0x39a4b9={'method':_0x7177('0x90'),'uri':_0x7177('0x91')+_0x4ccef3['tenantId']+_0x7177('0x92'),'form':{'client_id':_0x4ccef3[_0x7177('0x89')],'resource':_0x57b5f3,'username':_0x4ccef3[_0x7177('0x85')],'password':_0x4ccef3[_0x7177('0x86')],'grant_type':_0x7177('0x86'),'client_secret':_0x4ccef3[_0x7177('0x8a')]},'json':!![]};return rp(_0x39a4b9);}})[_0x7177('0x27')](function(_0x45c9ba){_0x4d989a=_0x45c9ba[_0x7177('0x8f')];var _0x1b29f1={'method':_0x7177('0x93'),'uri':encodeURI(_0x495877+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x214133+'\x27'),'headers':{'Authorization':_0x7177('0x94')+_0x4d989a,'If-None-Match':null,'OData-Version':_0x7177('0x95')},'json':!![]};return rp(_0x1b29f1);})['then'](function(_0x3d0fd0){var _0xc75d06=_0x3d0fd0['value'][0x0];var _0x2dbdff=_0xc75d06[_0x7177('0x96')];var _0x1e9d37={'method':_0x7177('0x93'),'uri':_0x495877+_0x7177('0x97')+_0x2dbdff+_0x7177('0x98'),'headers':{'Authorization':_0x7177('0x94')+_0x4d989a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1e9d37);})['then'](function(_0x172536){_0x5db083=_0x172536;_0x4354bc=_0x5db083[_0x7177('0x99')];_0x4354bc=_[_0x7177('0x9a')](_0x4354bc,function(_0x1a5a83){return!_0x120ec8[_0x7177('0x9b')](_0x1a5a83['LogicalName']);});var _0x2a43e5=[];var _0x5ccb4a=[];_0x4354bc[_0x7177('0x9c')](function(_0x49089b){if(_0x49089b['@odata.type']){var _0x2bdb8a=_0x49089b[_0x7177('0x9d')][_0x7177('0x40')](_0x49089b[_0x7177('0x9d')][_0x7177('0x41')]('.')+0x1);if(_0x2bdb8a===_0x7177('0x9e')){_0x2a43e5[_0x7177('0x9f')](getSelectList(_0x495877,_0xdb1149,_0x5ccb4a,_0x5db083[_0x7177('0x96')],_0x49089b['MetadataId'],_0x4d989a));}}});return Promise[_0x7177('0xa0')](_0x2a43e5);})[_0x7177('0x27')](function(_0x4aa060){_0x14654c=_0x4aa060[0x0];var _0x54929a=[];var _0x4232ef=[];_0x4354bc[_0x7177('0x9c')](function(_0x1b5cd4){if(!_[_0x7177('0xa1')](_0x1b5cd4[_0x7177('0x9d')])){var _0x446843=_0x1b5cd4[_0x7177('0x9d')][_0x7177('0x40')](_0x1b5cd4[_0x7177('0x9d')][_0x7177('0x41')]('.')+0x1);if(_0x446843===_0x7177('0xa2')){_0x54929a[_0x7177('0x9f')](getBooleanList(_0x495877,_0xdb1149,_0x4232ef,_0x5db083[_0x7177('0x96')],_0x1b5cd4[_0x7177('0x96')],_0x4d989a));}}});return Promise['all'](_0x54929a);})[_0x7177('0x27')](function(_0x117756){_0x830a0e=_0x117756[0x0];var _0x4dd1f5=[];var _0x5ce423=[];_0x4354bc[_0x7177('0x9c')](function(_0xf15dc3){if(_0xf15dc3[_0x7177('0x9d')]){var _0x292a41=_0xf15dc3[_0x7177('0x9d')][_0x7177('0x40')](_0xf15dc3['@odata.type'][_0x7177('0x41')]('.')+0x1);if(_0x292a41==='StringAttributeMetadata'||_0x292a41==='DoubleAttributeMetadata'||_0x292a41==='BigIntAttributeMetadata'||_0x292a41===_0x7177('0xa3')||_0x292a41===_0x7177('0xa4')||_0x292a41===_0x7177('0xa5')||_0x292a41==='StatusAttributeMetadata'||_0x292a41===_0x7177('0xa6')||_0x292a41==='StateAttributeMetadata'||_0x292a41===_0x7177('0xa7')){_0x4dd1f5[_0x7177('0x9f')](getInputList(_0x495877,_0xdb1149,_0x292a41,_0x5ce423,_0x5db083[_0x7177('0x96')],_0xf15dc3[_0x7177('0x96')],_0x4d989a));}}});return Promise[_0x7177('0xa0')](_0x4dd1f5);})[_0x7177('0x27')](function(_0x40319d){_0x1e1186=_0x40319d[0x0];var _0x316553=_0x14654c[_0x7177('0x84')](_0x830a0e)[_0x7177('0x84')](_0x1e1186);var _0x6936d={'count':_0x316553[_0x7177('0x1e')],'rows':_0x316553};return _0x6936d;})[_0x7177('0x27')](respondWithResult(_0x34029a,null))[_0x7177('0x2b')](function(_0x220da0){var _0x48d6ba=_0x78fc54[_0x7177('0x18')][_0x7177('0xa8')]?0x1f4:_0x220da0[_0x7177('0xa9')]||0x1f4;logger[_0x7177('0xaa')](_0x220da0[_0x7177('0xf')]);delete _0x220da0[_0x7177('0x10')];if(_0x48d6ba===0x191){_0x48d6ba=0x190;}_0x34029a[_0x7177('0x5')](_0x48d6ba)['send'](_0x78fc54[_0x7177('0x18')][_0x7177('0xa8')]?{'message':_0x7177('0xab'),'statusCode':_0x220da0[_0x7177('0xa9')]}:_0x220da0);});};function getSelectList(_0x5c50d9,_0xe01785,_0x481436,_0x590b6b,_0x936977,_0x1cd2b8){var _0x507040={'method':_0x7177('0x93'),'uri':_0x5c50d9+'EntityDefinitions('+_0x590b6b+_0x7177('0xac')+_0x936977+_0x7177('0xad')+_0x7177('0xae'),'headers':{'Authorization':_0x7177('0x94')+_0x1cd2b8,'If-None-Match':null,'OData-Version':_0x7177('0x95')},'json':!![]};return rp(_0x507040)[_0x7177('0x27')](function(_0x54b840){var _0x176498=[];var _0x15ced7=_0x54b840[_0x7177('0xaf')][_0x7177('0xb0')];_0x15ced7[_0x7177('0x9c')](function(_0x22e3e4){_0x176498['push']({'name':_0x22e3e4[_0x7177('0xb1')][_0x7177('0xb2')][_0x7177('0xb1')],'value':String(_0x22e3e4['Value'])});});var _0x4c601d={'id':_0xe01785+'_'+_0x54b840[_0x7177('0xb3')],'name':_0x54b840[_0x7177('0xb4')]['UserLocalizedLabel'][_0x7177('0xb1')],'custom':![],'options':_0x176498};_0x481436['push'](_0x4c601d);return _0x481436;});}function getBooleanList(_0x5706aa,_0x50a1cd,_0x27b0c8,_0x28730d,_0xc0e0c,_0x15a664){var _0x48fdd2={'method':_0x7177('0x93'),'uri':_0x5706aa+_0x7177('0x97')+_0x28730d+_0x7177('0xac')+_0xc0e0c+_0x7177('0xb5'),'headers':{'Authorization':_0x7177('0x94')+_0x15a664,'If-None-Match':null,'OData-Version':_0x7177('0x95')},'json':!![]};return rp(_0x48fdd2)[_0x7177('0x27')](function(_0x394653){var _0x422fa2=[];_0x422fa2[_0x7177('0x9f')]({'name':_0x394653[_0x7177('0xaf')]['TrueOption'][_0x7177('0xb1')][_0x7177('0xb2')][_0x7177('0xb1')],'value':_0x7177('0xb6')},{'name':_0x394653[_0x7177('0xaf')][_0x7177('0xb7')]['Label'][_0x7177('0xb2')][_0x7177('0xb1')],'value':_0x7177('0xb8')});var _0x3440ed={'id':_0x50a1cd+'_'+_0x394653[_0x7177('0xb3')],'name':_0x394653[_0x7177('0xb4')]['UserLocalizedLabel'][_0x7177('0xb1')],'custom':![],'options':_0x422fa2};_0x27b0c8[_0x7177('0x9f')](_0x3440ed);return _0x27b0c8;});}function getInputList(_0x111362,_0x24b793,_0x3302fa,_0x4ce08b,_0x7cf86d,_0x278ba1,_0x285bfb){var _0x138f49={'method':'GET','uri':_0x111362+_0x7177('0x97')+_0x7cf86d+')/Attributes('+_0x278ba1+_0x7177('0xb9')+_0x3302fa+_0x7177('0xba'),'headers':{'Authorization':_0x7177('0x94')+_0x285bfb,'If-None-Match':null,'OData-Version':_0x7177('0x95')},'json':!![]};return rp(_0x138f49)[_0x7177('0x27')](function(_0x4ab2b1){var _0x5d65bb={'id':_0x24b793+'_'+_0x4ab2b1[_0x7177('0xb3')],'name':_0x4ab2b1[_0x7177('0xb4')][_0x7177('0xb2')]?_0x4ab2b1[_0x7177('0xb4')][_0x7177('0xb2')][_0x7177('0xb1')]:_0x4ab2b1[_0x7177('0xb3')],'custom':![],'options':[]};_0x4ce08b[_0x7177('0x9f')](_0x5d65bb);return _0x4ce08b;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 70464eb..830945e 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x4545c9,_0x5596f7){var _0x589653=function(_0x16ea2c){while(--_0x16ea2c){_0x4545c9['push'](_0x4545c9['shift']());}};_0x589653(++_0x5596f7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));var integrations=require(_0x0a9e('0x8'));module['exports']=function(_0x219af0,_0x441e3a){return _0x219af0[_0x0a9e('0x9')]('Dynamics365Account',attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x3b8ec7,_0x2025c1){var _0x4f24e8=function(_0x1dd813){while(--_0x1dd813){_0x3b8ec7['push'](_0x3b8ec7['shift']());}};_0x4f24e8(++_0x2025c1);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0xb7e7[_0x1e3c16];return _0x47a0c9;};'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 diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index b540385..60caa28 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 _0xa5c8=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','info','stringify','ShowDynamics365Account','find','model','lodash','util','moment','bluebird'];(function(_0xed4881,_0x45771c){var _0x7fcbd5=function(_0x36b960){while(--_0x36b960){_0xed4881['push'](_0xed4881['shift']());}};_0x7fcbd5(++_0x45771c);}(_0xa5c8,0x80));var _0x8a5c=function(_0x4af702,_0x415ce3){_0x4af702=_0x4af702-0x0;var _0x1f6951=_0xa5c8[_0x4af702];return _0x1f6951;};'use strict';var _=require(_0x8a5c('0x0'));var util=require(_0x8a5c('0x1'));var moment=require(_0x8a5c('0x2'));var BPromise=require(_0x8a5c('0x3'));var rs=require(_0x8a5c('0x4'));var fs=require('fs');var Redis=require(_0x8a5c('0x5'));var db=require(_0x8a5c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8a5c('0x7'))(_0x8a5c('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1f8eec,_0x4cee52,_0x2a5e0b){return new BPromise(function(_0x3398c5,_0x5550fc){return client[_0x8a5c('0x9')](_0x1f8eec,_0x2a5e0b)[_0x8a5c('0xa')](function(_0x365ca9){logger['info'](_0x8a5c('0xb'),_0x4cee52,_0x8a5c('0xc'));logger['debug'](_0x8a5c('0xd'),_0x4cee52,_0x8a5c('0xc'),JSON['stringify'](_0x365ca9));if(_0x365ca9[_0x8a5c('0xe')]){if(_0x365ca9[_0x8a5c('0xe')][_0x8a5c('0xf')]===0x1f4){logger[_0x8a5c('0xe')](_0x8a5c('0xb'),_0x4cee52,_0x365ca9[_0x8a5c('0xe')]['message']);return _0x5550fc(_0x365ca9[_0x8a5c('0xe')][_0x8a5c('0x10')]);}logger[_0x8a5c('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x4cee52,_0x365ca9['error']['message']);return _0x3398c5(_0x365ca9[_0x8a5c('0xe')][_0x8a5c('0x10')]);}else{logger['info'](_0x8a5c('0xb'),_0x4cee52,_0x8a5c('0xc'));_0x3398c5(_0x365ca9['result'][_0x8a5c('0x10')]);}})[_0x8a5c('0x11')](function(_0x2f46be){logger[_0x8a5c('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x4cee52,_0x2f46be);_0x5550fc(_0x2f46be);});});}exports[_0x8a5c('0x12')]=function(_0x383f17){var _0x491d10=this;return new Promise(function(_0x57d1f9,_0x5332bb){return db[_0x8a5c('0x13')][_0x8a5c('0x14')]({'raw':_0x383f17[_0x8a5c('0x15')]?_0x383f17[_0x8a5c('0x15')][_0x8a5c('0x16')]===undefined?!![]:![]:!![],'where':_0x383f17[_0x8a5c('0x15')]?_0x383f17['options'][_0x8a5c('0x17')]||null:null,'attributes':_0x383f17['options']?_0x383f17['options'][_0x8a5c('0x18')]||null:null,'limit':_0x383f17[_0x8a5c('0x15')]?_0x383f17[_0x8a5c('0x15')][_0x8a5c('0x19')]||null:null,'include':_0x383f17[_0x8a5c('0x15')]?_0x383f17['options']['include']?_['map'](_0x383f17['options'][_0x8a5c('0x1a')],function(_0x13951a){return{'model':db[_0x13951a['model']],'as':_0x13951a['as'],'attributes':_0x13951a[_0x8a5c('0x18')],'include':_0x13951a[_0x8a5c('0x1a')]?_[_0x8a5c('0x1b')](_0x13951a['include'],function(_0x18ea31){return{'model':db[_0x18ea31['model']],'as':_0x18ea31['as'],'attributes':_0x18ea31[_0x8a5c('0x18')],'include':_0x18ea31[_0x8a5c('0x1a')]?_[_0x8a5c('0x1b')](_0x18ea31[_0x8a5c('0x1a')],function(_0x292686){return{'model':db[_0x292686['model']],'as':_0x292686['as'],'attributes':_0x292686[_0x8a5c('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x361ff4){logger[_0x8a5c('0x1c')](_0x8a5c('0x12'),_0x383f17);logger['debug'](_0x8a5c('0x12'),_0x383f17,JSON[_0x8a5c('0x1d')](_0x361ff4));_0x57d1f9(_0x361ff4);})[_0x8a5c('0x11')](function(_0x5b2a26){logger[_0x8a5c('0xe')](_0x8a5c('0x12'),_0x5b2a26[_0x8a5c('0x10')],_0x383f17);_0x5332bb(_0x491d10[_0x8a5c('0xe')](0x1f4,_0x5b2a26[_0x8a5c('0x10')]));});});};exports[_0x8a5c('0x1e')]=function(_0x5daf93){var _0x5e006c=this;return new Promise(function(_0x4c7d84,_0xc5105b){return db[_0x8a5c('0x13')][_0x8a5c('0x1f')]({'raw':_0x5daf93[_0x8a5c('0x15')]?_0x5daf93[_0x8a5c('0x15')][_0x8a5c('0x16')]===undefined?!![]:![]:!![],'where':_0x5daf93[_0x8a5c('0x15')]?_0x5daf93[_0x8a5c('0x15')][_0x8a5c('0x17')]||null:null,'attributes':_0x5daf93[_0x8a5c('0x15')]?_0x5daf93[_0x8a5c('0x15')][_0x8a5c('0x18')]||null:null,'include':_0x5daf93[_0x8a5c('0x15')]?_0x5daf93['options'][_0x8a5c('0x1a')]?_[_0x8a5c('0x1b')](_0x5daf93['options']['include'],function(_0x3fe7f5){return{'model':db[_0x3fe7f5[_0x8a5c('0x20')]],'as':_0x3fe7f5['as'],'attributes':_0x3fe7f5[_0x8a5c('0x18')],'include':_0x3fe7f5[_0x8a5c('0x1a')]?_['map'](_0x3fe7f5['include'],function(_0x2407ca){return{'model':db[_0x2407ca[_0x8a5c('0x20')]],'as':_0x2407ca['as'],'attributes':_0x2407ca[_0x8a5c('0x18')],'include':_0x2407ca[_0x8a5c('0x1a')]?_[_0x8a5c('0x1b')](_0x2407ca['include'],function(_0x6ed6e3){return{'model':db[_0x6ed6e3['model']],'as':_0x6ed6e3['as'],'attributes':_0x6ed6e3['attributes']};}):[]};}):[]};}):[]:[]})[_0x8a5c('0xa')](function(_0x26ff0b){logger['info']('ShowDynamics365Account',_0x5daf93);logger['debug']('ShowDynamics365Account',_0x5daf93,JSON['stringify'](_0x26ff0b));_0x4c7d84(_0x26ff0b);})[_0x8a5c('0x11')](function(_0x18876d){logger['error'](_0x8a5c('0x1e'),_0x18876d[_0x8a5c('0x10')],_0x5daf93);_0xc5105b(_0x5e006c[_0x8a5c('0xe')](0x1f4,_0x18876d[_0x8a5c('0x10')]));});});}; \ No newline at end of file +var _0x5ea9=['limit','include','map','model','GetDynamics365Account','stringify','ShowDynamics365Account','Dynamics365Account','find','raw','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','findAll','options','where','attributes'];(function(_0x17bb31,_0x2fc6f8){var _0x505c71=function(_0x5013cf){while(--_0x5013cf){_0x17bb31['push'](_0x17bb31['shift']());}};_0x505c71(++_0x2fc6f8);}(_0x5ea9,0xaf));var _0x95ea=function(_0x4ff597,_0x3b950a){_0x4ff597=_0x4ff597-0x0;var _0xd51646=_0x5ea9[_0x4ff597];return _0xd51646;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x95ea('0x0'));var BPromise=require('bluebird');var rs=require(_0x95ea('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x95ea('0x2'));var logger=require('../../config/logger')(_0x95ea('0x3'));var config=require(_0x95ea('0x4'));var jayson=require(_0x95ea('0x5'));var client=jayson[_0x95ea('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x301708,_0x3dab23,_0x42236e){return new BPromise(function(_0x573a46,_0x37c989){return client[_0x95ea('0x7')](_0x301708,_0x42236e)[_0x95ea('0x8')](function(_0x1298f8){logger[_0x95ea('0x9')](_0x95ea('0xa'),_0x3dab23,_0x95ea('0xb'));logger[_0x95ea('0xc')](_0x95ea('0xd'),_0x3dab23,_0x95ea('0xb'),JSON['stringify'](_0x1298f8));if(_0x1298f8[_0x95ea('0xe')]){if(_0x1298f8['error'][_0x95ea('0xf')]===0x1f4){logger[_0x95ea('0xe')](_0x95ea('0xa'),_0x3dab23,_0x1298f8[_0x95ea('0xe')][_0x95ea('0x10')]);return _0x37c989(_0x1298f8['error'][_0x95ea('0x10')]);}logger[_0x95ea('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x3dab23,_0x1298f8[_0x95ea('0xe')][_0x95ea('0x10')]);return _0x573a46(_0x1298f8['error']['message']);}else{logger[_0x95ea('0x9')]('Dynamics365Account,\x20%s,\x20%s',_0x3dab23,_0x95ea('0xb'));_0x573a46(_0x1298f8[_0x95ea('0x11')][_0x95ea('0x10')]);}})[_0x95ea('0x12')](function(_0x333a15){logger[_0x95ea('0xe')](_0x95ea('0xa'),_0x3dab23,_0x333a15);_0x37c989(_0x333a15);});});}exports['GetDynamics365Account']=function(_0x46ba39){var _0x1f83d1=this;return new Promise(function(_0x52d58e,_0xa77b50){return db['Dynamics365Account'][_0x95ea('0x13')]({'raw':_0x46ba39[_0x95ea('0x14')]?_0x46ba39['options']['raw']===undefined?!![]:![]:!![],'where':_0x46ba39['options']?_0x46ba39[_0x95ea('0x14')][_0x95ea('0x15')]||null:null,'attributes':_0x46ba39[_0x95ea('0x14')]?_0x46ba39[_0x95ea('0x14')][_0x95ea('0x16')]||null:null,'limit':_0x46ba39[_0x95ea('0x14')]?_0x46ba39[_0x95ea('0x14')][_0x95ea('0x17')]||null:null,'include':_0x46ba39['options']?_0x46ba39['options'][_0x95ea('0x18')]?_[_0x95ea('0x19')](_0x46ba39[_0x95ea('0x14')]['include'],function(_0x3b9da6){return{'model':db[_0x3b9da6['model']],'as':_0x3b9da6['as'],'attributes':_0x3b9da6['attributes'],'include':_0x3b9da6[_0x95ea('0x18')]?_['map'](_0x3b9da6[_0x95ea('0x18')],function(_0x34a9c1){return{'model':db[_0x34a9c1[_0x95ea('0x1a')]],'as':_0x34a9c1['as'],'attributes':_0x34a9c1['attributes'],'include':_0x34a9c1[_0x95ea('0x18')]?_[_0x95ea('0x19')](_0x34a9c1[_0x95ea('0x18')],function(_0x2ff68c){return{'model':db[_0x2ff68c['model']],'as':_0x2ff68c['as'],'attributes':_0x2ff68c['attributes']};}):[]};}):[]};}):[]:[]})[_0x95ea('0x8')](function(_0x2bb718){logger[_0x95ea('0x9')](_0x95ea('0x1b'),_0x46ba39);logger[_0x95ea('0xc')]('GetDynamics365Account',_0x46ba39,JSON[_0x95ea('0x1c')](_0x2bb718));_0x52d58e(_0x2bb718);})[_0x95ea('0x12')](function(_0x14cdbd){logger[_0x95ea('0xe')](_0x95ea('0x1b'),_0x14cdbd[_0x95ea('0x10')],_0x46ba39);_0xa77b50(_0x1f83d1[_0x95ea('0xe')](0x1f4,_0x14cdbd[_0x95ea('0x10')]));});});};exports[_0x95ea('0x1d')]=function(_0x583371){var _0x51ffc9=this;return new Promise(function(_0xf88cdd,_0x752618){return db[_0x95ea('0x1e')][_0x95ea('0x1f')]({'raw':_0x583371[_0x95ea('0x14')]?_0x583371['options'][_0x95ea('0x20')]===undefined?!![]:![]:!![],'where':_0x583371[_0x95ea('0x14')]?_0x583371[_0x95ea('0x14')][_0x95ea('0x15')]||null:null,'attributes':_0x583371['options']?_0x583371[_0x95ea('0x14')][_0x95ea('0x16')]||null:null,'include':_0x583371['options']?_0x583371['options'][_0x95ea('0x18')]?_['map'](_0x583371[_0x95ea('0x14')]['include'],function(_0x576c3a){return{'model':db[_0x576c3a[_0x95ea('0x1a')]],'as':_0x576c3a['as'],'attributes':_0x576c3a['attributes'],'include':_0x576c3a['include']?_[_0x95ea('0x19')](_0x576c3a[_0x95ea('0x18')],function(_0x5ca061){return{'model':db[_0x5ca061[_0x95ea('0x1a')]],'as':_0x5ca061['as'],'attributes':_0x5ca061[_0x95ea('0x16')],'include':_0x5ca061[_0x95ea('0x18')]?_[_0x95ea('0x19')](_0x5ca061[_0x95ea('0x18')],function(_0x5d9641){return{'model':db[_0x5d9641[_0x95ea('0x1a')]],'as':_0x5d9641['as'],'attributes':_0x5d9641[_0x95ea('0x16')]};}):[]};}):[]};}):[]:[]})[_0x95ea('0x8')](function(_0x43dff4){logger[_0x95ea('0x9')](_0x95ea('0x1d'),_0x583371);logger[_0x95ea('0xc')](_0x95ea('0x1d'),_0x583371,JSON[_0x95ea('0x1c')](_0x43dff4));_0xf88cdd(_0x43dff4);})[_0x95ea('0x12')](function(_0x2af2ad){logger[_0x95ea('0xe')](_0x95ea('0x1d'),_0x2af2ad[_0x95ea('0x10')],_0x583371);_0x752618(_0x51ffc9[_0x95ea('0xe')](0x1f4,_0x2af2ad[_0x95ea('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index c9919e9..ced6370 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 _0x7200=['get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller'];(function(_0x285c85,_0x132c21){var _0x2f81cd=function(_0x9b9962){while(--_0x9b9962){_0x285c85['push'](_0x285c85['shift']());}};_0x2f81cd(++_0x132c21);}(_0x7200,0x1a8));var _0x0720=function(_0x469add,_0x50ef21){_0x469add=_0x469add-0x0;var _0x2e8a26=_0x7200[_0x469add];return _0x2e8a26;};'use strict';var multer=require(_0x0720('0x0'));var util=require('util');var path=require(_0x0720('0x1'));var timeout=require('connect-timeout');var express=require(_0x0720('0x2'));var router=express[_0x0720('0x3')]();var fs_extra=require(_0x0720('0x4'));var auth=require(_0x0720('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0720('0x6'));var controller=require(_0x0720('0x7'));router[_0x0720('0x8')]('/',auth[_0x0720('0x9')](),controller[_0x0720('0xa')]);router[_0x0720('0x8')]('/:id',auth[_0x0720('0x9')](),controller[_0x0720('0xb')]);router[_0x0720('0x8')](_0x0720('0xc'),auth[_0x0720('0x9')](),controller[_0x0720('0xd')]);router[_0x0720('0x8')](_0x0720('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x0720('0x8')]('/:id/descriptions',auth[_0x0720('0x9')](),controller[_0x0720('0xf')]);router[_0x0720('0x10')]('/',auth[_0x0720('0x9')](),controller[_0x0720('0x11')]);router[_0x0720('0x12')](_0x0720('0x13'),auth[_0x0720('0x9')](),controller[_0x0720('0x14')]);router[_0x0720('0x15')](_0x0720('0x13'),auth[_0x0720('0x9')](),controller[_0x0720('0x16')]);module[_0x0720('0x17')]=router; \ No newline at end of file +var _0x627d=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','index','/:id','/:id/fields','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','exports','util','path'];(function(_0x2ef14e,_0x11974a){var _0x1ad813=function(_0x31c8f1){while(--_0x31c8f1){_0x2ef14e['push'](_0x2ef14e['shift']());}};_0x1ad813(++_0x11974a);}(_0x627d,0xc6));var _0xd627=function(_0x5bacd0,_0x31ae97){_0x5bacd0=_0x5bacd0-0x0;var _0x23a6a6=_0x627d[_0x5bacd0];return _0x23a6a6;};'use strict';var multer=require('multer');var util=require(_0xd627('0x0'));var path=require(_0xd627('0x1'));var timeout=require('connect-timeout');var express=require(_0xd627('0x2'));var router=express[_0xd627('0x3')]();var fs_extra=require(_0xd627('0x4'));var auth=require(_0xd627('0x5'));var interaction=require(_0xd627('0x6'));var config=require(_0xd627('0x7'));var controller=require(_0xd627('0x8'));router[_0xd627('0x9')]('/',auth['isAuthenticated'](),controller[_0xd627('0xa')]);router[_0xd627('0x9')](_0xd627('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xd627('0x9')](_0xd627('0xc'),auth['isAuthenticated'](),controller[_0xd627('0xd')]);router[_0xd627('0x9')](_0xd627('0xe'),auth[_0xd627('0xf')](),controller[_0xd627('0x10')]);router[_0xd627('0x9')](_0xd627('0x11'),auth[_0xd627('0xf')](),controller[_0xd627('0x12')]);router[_0xd627('0x13')]('/',auth['isAuthenticated'](),controller[_0xd627('0x14')]);router[_0xd627('0x15')](_0xd627('0xb'),auth[_0xd627('0xf')](),controller[_0xd627('0x16')]);router[_0xd627('0x17')](_0xd627('0xb'),auth[_0xd627('0xf')](),controller['destroy']);module[_0xd627('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 827661f..babd8c2 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 _0xddd3=['incident','phonecall','ENUM','contact','nothing','BOOLEAN','sequelize','exports','STRING'];(function(_0x1ae9ca,_0x4c9c5c){var _0x32d178=function(_0xda3fdd){while(--_0xda3fdd){_0x1ae9ca['push'](_0x1ae9ca['shift']());}};_0x32d178(++_0x4c9c5c);}(_0xddd3,0x72));var _0x3ddd=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xddd3[_0x18a79d];return _0x4f8848;};'use strict';var Sequelize=require(_0x3ddd('0x0'));module[_0x3ddd('0x1')]={'name':{'type':Sequelize[_0x3ddd('0x2')]},'description':{'type':Sequelize[_0x3ddd('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x3ddd('0x3'),_0x3ddd('0x4')),'defaultValue':_0x3ddd('0x3')},'moduleCreate':{'type':Sequelize[_0x3ddd('0x5')](_0x3ddd('0x6'),_0x3ddd('0x7')),'defaultValue':_0x3ddd('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x3ddd('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x3ddd('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xedfa=['phonecall','contact','nothing','BOOLEAN','exports','STRING','ENUM','incident'];(function(_0x31218c,_0x28ae34){var _0x13e4ab=function(_0x3e0521){while(--_0x3e0521){_0x31218c['push'](_0x31218c['shift']());}};_0x13e4ab(++_0x28ae34);}(_0xedfa,0x64));var _0xaedf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xedfa[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xaedf('0x0')]={'name':{'type':Sequelize[_0xaedf('0x1')]},'description':{'type':Sequelize[_0xaedf('0x1')]},'ticketType':{'type':Sequelize[_0xaedf('0x2')](_0xaedf('0x3'),_0xaedf('0x4')),'defaultValue':_0xaedf('0x3')},'moduleCreate':{'type':Sequelize[_0xaedf('0x2')](_0xaedf('0x5'),_0xaedf('0x6')),'defaultValue':_0xaedf('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xaedf('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xaedf('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 07212b9..bb792c4 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 _0x8923=['key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','body','update','findOne','getFields','nolimit','getSubjects','getDescriptions','Dynamics365Field','order','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','Content-Range','json','apply','reject','then','destroy','end','stack','name','index','map','Dynamics365Configuration','rawAttributes','fieldName','type'];(function(_0x4aeb02,_0x51f18a){var _0xf5d601=function(_0xd8d1e0){while(--_0xd8d1e0){_0x4aeb02['push'](_0x4aeb02['shift']());}};_0xf5d601(++_0x51f18a);}(_0x8923,0x1bc));var _0x3892=function(_0x473f77,_0x2e7e1f){_0x473f77=_0x473f77-0x0;var _0x26c797=_0x8923[_0x473f77];return _0x26c797;};'use strict';var emlformat=require(_0x3892('0x0'));var rimraf=require(_0x3892('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3892('0x2'));var rp=require(_0x3892('0x3'));var moment=require(_0x3892('0x4'));var BPromise=require(_0x3892('0x5'));var Mustache=require(_0x3892('0x6'));var util=require(_0x3892('0x7'));var path=require('path');var sox=require(_0x3892('0x8'));var csv=require(_0x3892('0x9'));var ejs=require(_0x3892('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3892('0xb'));var squel=require(_0x3892('0xc'));var crypto=require(_0x3892('0xd'));var jsforce=require(_0x3892('0xe'));var deskjs=require(_0x3892('0xf'));var toCsv=require(_0x3892('0x9'));var querystring=require('querystring');var Papa=require(_0x3892('0x10'));var Redis=require(_0x3892('0x11'));var authService=require(_0x3892('0x12'));var qs=require(_0x3892('0x13'));var as=require(_0x3892('0x14'));var hardwareService=require(_0x3892('0x15'));var logger=require(_0x3892('0x16'))('api');var utils=require(_0x3892('0x17'));var config=require(_0x3892('0x18'));var licenseUtil=require(_0x3892('0x19'));var db=require(_0x3892('0x1a'))['db'];function respondWithStatusCode(_0x33c70a,_0x317b66){_0x317b66=_0x317b66||0xcc;return function(_0x4713ed){if(_0x4713ed){return _0x33c70a[_0x3892('0x1b')](_0x317b66);}return _0x33c70a[_0x3892('0x1c')](_0x317b66)['end']();};}function respondWithResult(_0x56efa6,_0x5a02af){_0x5a02af=_0x5a02af||0xc8;return function(_0xd6a990){if(_0xd6a990){return _0x56efa6['status'](_0x5a02af)['json'](_0xd6a990);}};}function respondWithFilteredResult(_0x34a95d,_0x3552c5){return function(_0x4489d5){if(_0x4489d5){var _0x5ab9ea=typeof _0x3552c5[_0x3892('0x1d')]==='undefined'&&typeof _0x3552c5[_0x3892('0x1e')]===_0x3892('0x1f');var _0xf31f7e=_0x4489d5[_0x3892('0x20')];var _0x59190b=_0x5ab9ea?0x0:_0x3552c5['offset'];var _0x525366=_0x5ab9ea?_0x4489d5[_0x3892('0x20')]:_0x3552c5[_0x3892('0x1d')]+_0x3552c5[_0x3892('0x1e')];var _0x4329dd;if(_0x525366>=_0xf31f7e){_0x525366=_0xf31f7e;_0x4329dd=0xc8;}else{_0x4329dd=0xce;}_0x34a95d[_0x3892('0x1c')](_0x4329dd);return _0x34a95d['set'](_0x3892('0x21'),_0x59190b+'-'+_0x525366+'/'+_0xf31f7e)[_0x3892('0x22')](_0x4489d5);}return null;};}function patchUpdates(_0x4fc68c){return function(_0x17e111){try{jsonpatch[_0x3892('0x23')](_0x17e111,_0x4fc68c,!![]);}catch(_0x260235){return BPromise[_0x3892('0x24')](_0x260235);}return _0x17e111['save']();};}function saveUpdates(_0xe3527b,_0x395704){return function(_0x186716){if(_0x186716){return _0x186716['update'](_0xe3527b)[_0x3892('0x25')](function(_0x3529b2){return _0x3529b2;});}return null;};}function removeEntity(_0x579994,_0xa65070){return function(_0x11925c){if(_0x11925c){return _0x11925c[_0x3892('0x26')]()[_0x3892('0x25')](function(){_0x579994['status'](0xcc)[_0x3892('0x27')]();});}};}function handleEntityNotFound(_0xc823d1,_0x37318e){return function(_0x2b8e01){if(!_0x2b8e01){_0xc823d1[_0x3892('0x1b')](0x194);}return _0x2b8e01;};}function handleError(_0x34f616,_0x31b66e){_0x31b66e=_0x31b66e||0x1f4;return function(_0x32bdaa){logger['error'](_0x32bdaa[_0x3892('0x28')]);if(_0x32bdaa[_0x3892('0x29')]){delete _0x32bdaa[_0x3892('0x29')];}_0x34f616[_0x3892('0x1c')](_0x31b66e)['send'](_0x32bdaa);};}exports[_0x3892('0x2a')]=function(_0x15f112,_0x409a7d){var _0x3b8eab={},_0x14c504={},_0x3320a0={'count':0x0,'rows':[]};var _0xd3da4a=_[_0x3892('0x2b')](db[_0x3892('0x2c')][_0x3892('0x2d')],function(_0x45bbbb){return{'name':_0x45bbbb[_0x3892('0x2e')],'type':_0x45bbbb[_0x3892('0x2f')][_0x3892('0x30')]};});_0x14c504[_0x3892('0x31')]=_[_0x3892('0x2b')](_0xd3da4a,_0x3892('0x29'));_0x14c504['query']=_[_0x3892('0x32')](_0x15f112[_0x3892('0x33')]);_0x14c504[_0x3892('0x34')]=_[_0x3892('0x35')](_0x14c504[_0x3892('0x31')],_0x14c504[_0x3892('0x33')]);_0x3b8eab[_0x3892('0x36')]=_[_0x3892('0x35')](_0x14c504[_0x3892('0x31')],qs[_0x3892('0x37')](_0x15f112[_0x3892('0x33')][_0x3892('0x37')]));_0x3b8eab[_0x3892('0x36')]=_0x3b8eab[_0x3892('0x36')][_0x3892('0x38')]?_0x3b8eab[_0x3892('0x36')]:_0x14c504[_0x3892('0x31')];if(!_0x15f112['query'][_0x3892('0x39')]('nolimit')){_0x3b8eab[_0x3892('0x1e')]=qs['limit'](_0x15f112[_0x3892('0x33')]['limit']);_0x3b8eab[_0x3892('0x1d')]=qs[_0x3892('0x1d')](_0x15f112[_0x3892('0x33')][_0x3892('0x1d')]);}_0x3b8eab['order']=qs[_0x3892('0x3a')](_0x15f112[_0x3892('0x33')][_0x3892('0x3a')]);_0x3b8eab['where']=qs[_0x3892('0x34')](_[_0x3892('0x3b')](_0x15f112[_0x3892('0x33')],_0x14c504[_0x3892('0x34')]),_0xd3da4a);if(_0x15f112[_0x3892('0x33')][_0x3892('0x3c')]){_0x3b8eab[_0x3892('0x3d')]=_[_0x3892('0x3e')](_0x3b8eab[_0x3892('0x3d')],{'$or':_['map'](_0xd3da4a,function(_0x1e48e3){if(_0x1e48e3[_0x3892('0x2f')]!==_0x3892('0x3f')){var _0x43102b={};_0x43102b[_0x1e48e3[_0x3892('0x29')]]={'$like':'%'+_0x15f112[_0x3892('0x33')][_0x3892('0x3c')]+'%'};return _0x43102b;}})});}_0x3b8eab=_[_0x3892('0x3e')]({},_0x3b8eab,_0x15f112[_0x3892('0x40')]);var _0xc6d8e3={'where':_0x3b8eab['where']};return db[_0x3892('0x2c')]['count'](_0xc6d8e3)['then'](function(_0x134e5c){_0x3320a0[_0x3892('0x20')]=_0x134e5c;if(_0x15f112[_0x3892('0x33')]['includeAll']){_0x3b8eab[_0x3892('0x41')]=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x3b8eab);})[_0x3892('0x25')](function(_0x51540f){_0x3320a0[_0x3892('0x42')]=_0x51540f;return _0x3320a0;})['then'](respondWithFilteredResult(_0x409a7d,_0x3b8eab))[_0x3892('0x43')](handleError(_0x409a7d,null));};exports[_0x3892('0x44')]=function(_0xfd0b71,_0x5e12f7){var _0x5a499e={'raw':![],'where':{'id':_0xfd0b71[_0x3892('0x45')]['id']}},_0x9df6d2={};_0x9df6d2['model']=_['keys'](db[_0x3892('0x2c')][_0x3892('0x2d')]);_0x9df6d2[_0x3892('0x33')]=_[_0x3892('0x32')](_0xfd0b71[_0x3892('0x33')]);_0x9df6d2['filters']=_[_0x3892('0x35')](_0x9df6d2[_0x3892('0x31')],_0x9df6d2[_0x3892('0x33')]);_0x5a499e[_0x3892('0x36')]=_[_0x3892('0x35')](_0x9df6d2['model'],qs[_0x3892('0x37')](_0xfd0b71[_0x3892('0x33')][_0x3892('0x37')]));_0x5a499e[_0x3892('0x36')]=_0x5a499e['attributes'][_0x3892('0x38')]?_0x5a499e[_0x3892('0x36')]:_0x9df6d2[_0x3892('0x31')];if(_0xfd0b71['query'][_0x3892('0x46')]){_0x5a499e[_0x3892('0x41')]=[{'all':!![]}];}_0x5a499e=_[_0x3892('0x3e')]({},_0x5a499e,_0xfd0b71['options']);return db[_0x3892('0x2c')][_0x3892('0x47')](_0x5a499e)[_0x3892('0x25')](handleEntityNotFound(_0x5e12f7,null))['then'](respondWithResult(_0x5e12f7,null))[_0x3892('0x43')](handleError(_0x5e12f7,null));};exports['create']=function(_0x246129,_0x53a672){return db[_0x3892('0x2c')][_0x3892('0x48')](_0x246129[_0x3892('0x49')],{})[_0x3892('0x25')](respondWithResult(_0x53a672,0xc9))[_0x3892('0x43')](handleError(_0x53a672,null));};exports[_0x3892('0x4a')]=function(_0x2d4ce8,_0x4443f6){if(_0x2d4ce8[_0x3892('0x49')]['id']){delete _0x2d4ce8[_0x3892('0x49')]['id'];}return db[_0x3892('0x2c')]['find']({'where':{'id':_0x2d4ce8[_0x3892('0x45')]['id']}})['then'](handleEntityNotFound(_0x4443f6,null))[_0x3892('0x25')](saveUpdates(_0x2d4ce8['body'],null))[_0x3892('0x25')](respondWithResult(_0x4443f6,null))['catch'](handleError(_0x4443f6,null));};exports['destroy']=function(_0x57b2f7,_0x3476c3){return db[_0x3892('0x2c')][_0x3892('0x47')]({'where':{'id':_0x57b2f7[_0x3892('0x45')]['id']}})[_0x3892('0x25')](handleEntityNotFound(_0x3476c3,null))[_0x3892('0x25')](removeEntity(_0x3476c3,null))['catch'](handleError(_0x3476c3,null));};exports['getFields']=function(_0x4acae8,_0x73d5eb,_0x2af6d9){var _0x64e40={};var _0x561e44={};var _0x261f46;var _0x1cfee4;return db[_0x3892('0x2c')][_0x3892('0x4b')]({'where':{'id':_0x4acae8[_0x3892('0x45')]['id']}})[_0x3892('0x25')](handleEntityNotFound(_0x73d5eb,null))[_0x3892('0x25')](function(_0x3df845){if(_0x3df845){_0x261f46=_0x3df845;_0x561e44['model']=_[_0x3892('0x32')](db['Dynamics365Field'][_0x3892('0x2d')]);_0x561e44[_0x3892('0x33')]=_[_0x3892('0x32')](_0x4acae8['query']);_0x561e44[_0x3892('0x34')]=_[_0x3892('0x35')](_0x561e44[_0x3892('0x31')],_0x561e44[_0x3892('0x33')]);_0x64e40[_0x3892('0x36')]=_[_0x3892('0x35')](_0x561e44['model'],qs[_0x3892('0x37')](_0x4acae8[_0x3892('0x33')][_0x3892('0x37')]));_0x64e40[_0x3892('0x36')]=_0x64e40[_0x3892('0x36')][_0x3892('0x38')]?_0x64e40['attributes']:_0x561e44[_0x3892('0x31')];_0x64e40['order']=qs[_0x3892('0x3a')](_0x4acae8['query'][_0x3892('0x3a')]);_0x64e40[_0x3892('0x3d')]=qs[_0x3892('0x34')](_[_0x3892('0x3b')](_0x4acae8[_0x3892('0x33')],_0x561e44[_0x3892('0x34')]));if(_0x4acae8[_0x3892('0x33')][_0x3892('0x3c')]){_0x64e40[_0x3892('0x3d')]=_[_0x3892('0x3e')](_0x64e40['where'],{'$or':_[_0x3892('0x2b')](_0x64e40[_0x3892('0x36')],function(_0xdc1da3){var _0x2b82b4={};_0x2b82b4[_0xdc1da3]={'$like':'%'+_0x4acae8['query'][_0x3892('0x3c')]+'%'};return _0x2b82b4;})});}_0x64e40=_['merge']({},_0x64e40,_0x4acae8[_0x3892('0x40')]);return _0x261f46[_0x3892('0x4c')](_0x64e40);}})['then'](function(_0x384c32){if(_0x384c32){_0x1cfee4=_0x384c32[_0x3892('0x38')];if(!_0x4acae8[_0x3892('0x33')][_0x3892('0x39')](_0x3892('0x4d'))){_0x64e40[_0x3892('0x1e')]=qs[_0x3892('0x1e')](_0x4acae8['query'][_0x3892('0x1e')]);_0x64e40[_0x3892('0x1d')]=qs[_0x3892('0x1d')](_0x4acae8[_0x3892('0x33')][_0x3892('0x1d')]);}return _0x261f46[_0x3892('0x4c')](_0x64e40);}})['then'](function(_0xc9b392){if(_0xc9b392){return _0xc9b392?{'count':_0x1cfee4,'rows':_0xc9b392}:null;}})[_0x3892('0x25')](respondWithResult(_0x73d5eb,null))['catch'](handleError(_0x73d5eb,null));};exports[_0x3892('0x4e')]=function(_0x243d8a,_0x5aaf54,_0x1c111a){var _0x47670a={};var _0x51f040={};var _0x38e89f;var _0xad944e;return db['Dynamics365Configuration'][_0x3892('0x4b')]({'where':{'id':_0x243d8a[_0x3892('0x45')]['id']}})[_0x3892('0x25')](handleEntityNotFound(_0x5aaf54,null))['then'](function(_0x416f6b){if(_0x416f6b){_0x38e89f=_0x416f6b;_0x51f040['model']=_[_0x3892('0x32')](db['Dynamics365Field'][_0x3892('0x2d')]);_0x51f040[_0x3892('0x33')]=_[_0x3892('0x32')](_0x243d8a[_0x3892('0x33')]);_0x51f040[_0x3892('0x34')]=_[_0x3892('0x35')](_0x51f040[_0x3892('0x31')],_0x51f040[_0x3892('0x33')]);_0x47670a[_0x3892('0x36')]=_[_0x3892('0x35')](_0x51f040[_0x3892('0x31')],qs[_0x3892('0x37')](_0x243d8a[_0x3892('0x33')][_0x3892('0x37')]));_0x47670a[_0x3892('0x36')]=_0x47670a[_0x3892('0x36')][_0x3892('0x38')]?_0x47670a[_0x3892('0x36')]:_0x51f040[_0x3892('0x31')];_0x47670a['order']=qs[_0x3892('0x3a')](_0x243d8a[_0x3892('0x33')][_0x3892('0x3a')]);_0x47670a[_0x3892('0x3d')]=qs['filters'](_['pick'](_0x243d8a[_0x3892('0x33')],_0x51f040[_0x3892('0x34')]));if(_0x243d8a[_0x3892('0x33')][_0x3892('0x3c')]){_0x47670a['where']=_['merge'](_0x47670a[_0x3892('0x3d')],{'$or':_[_0x3892('0x2b')](_0x47670a[_0x3892('0x36')],function(_0x9b2338){var _0x23eaf2={};_0x23eaf2[_0x9b2338]={'$like':'%'+_0x243d8a['query'][_0x3892('0x3c')]+'%'};return _0x23eaf2;})});}_0x47670a=_['merge']({},_0x47670a,_0x243d8a['options']);return _0x38e89f[_0x3892('0x4e')](_0x47670a);}})['then'](function(_0x3b84d6){if(_0x3b84d6){_0xad944e=_0x3b84d6['length'];if(!_0x243d8a[_0x3892('0x33')]['hasOwnProperty']('nolimit')){_0x47670a[_0x3892('0x1e')]=qs[_0x3892('0x1e')](_0x243d8a[_0x3892('0x33')][_0x3892('0x1e')]);_0x47670a[_0x3892('0x1d')]=qs[_0x3892('0x1d')](_0x243d8a[_0x3892('0x33')][_0x3892('0x1d')]);}return _0x38e89f[_0x3892('0x4e')](_0x47670a);}})[_0x3892('0x25')](function(_0x1f334e){if(_0x1f334e){return _0x1f334e?{'count':_0xad944e,'rows':_0x1f334e}:null;}})[_0x3892('0x25')](respondWithResult(_0x5aaf54,null))['catch'](handleError(_0x5aaf54,null));};exports[_0x3892('0x4f')]=function(_0x5bada4,_0x103cfc,_0x404001){var _0x1154d4={};var _0x2d3a97={};var _0x1d6ed8;var _0x10ca61;return db['Dynamics365Configuration'][_0x3892('0x4b')]({'where':{'id':_0x5bada4['params']['id']}})[_0x3892('0x25')](handleEntityNotFound(_0x103cfc,null))['then'](function(_0x13a60f){if(_0x13a60f){_0x1d6ed8=_0x13a60f;_0x2d3a97[_0x3892('0x31')]=_[_0x3892('0x32')](db[_0x3892('0x50')]['rawAttributes']);_0x2d3a97[_0x3892('0x33')]=_[_0x3892('0x32')](_0x5bada4[_0x3892('0x33')]);_0x2d3a97['filters']=_['intersection'](_0x2d3a97[_0x3892('0x31')],_0x2d3a97[_0x3892('0x33')]);_0x1154d4[_0x3892('0x36')]=_[_0x3892('0x35')](_0x2d3a97[_0x3892('0x31')],qs['fields'](_0x5bada4['query'][_0x3892('0x37')]));_0x1154d4['attributes']=_0x1154d4[_0x3892('0x36')][_0x3892('0x38')]?_0x1154d4['attributes']:_0x2d3a97['model'];_0x1154d4[_0x3892('0x51')]=qs[_0x3892('0x3a')](_0x5bada4[_0x3892('0x33')][_0x3892('0x3a')]);_0x1154d4[_0x3892('0x3d')]=qs[_0x3892('0x34')](_[_0x3892('0x3b')](_0x5bada4[_0x3892('0x33')],_0x2d3a97['filters']));if(_0x5bada4[_0x3892('0x33')][_0x3892('0x3c')]){_0x1154d4[_0x3892('0x3d')]=_[_0x3892('0x3e')](_0x1154d4[_0x3892('0x3d')],{'$or':_[_0x3892('0x2b')](_0x1154d4[_0x3892('0x36')],function(_0x4b89e3){var _0x35df3e={};_0x35df3e[_0x4b89e3]={'$like':'%'+_0x5bada4[_0x3892('0x33')][_0x3892('0x3c')]+'%'};return _0x35df3e;})});}_0x1154d4=_[_0x3892('0x3e')]({},_0x1154d4,_0x5bada4[_0x3892('0x40')]);return _0x1d6ed8['getDescriptions'](_0x1154d4);}})['then'](function(_0x406164){if(_0x406164){_0x10ca61=_0x406164[_0x3892('0x38')];if(!_0x5bada4[_0x3892('0x33')]['hasOwnProperty'](_0x3892('0x4d'))){_0x1154d4[_0x3892('0x1e')]=qs['limit'](_0x5bada4[_0x3892('0x33')]['limit']);_0x1154d4[_0x3892('0x1d')]=qs['offset'](_0x5bada4[_0x3892('0x33')][_0x3892('0x1d')]);}return _0x1d6ed8['getDescriptions'](_0x1154d4);}})[_0x3892('0x25')](function(_0x24c43c){if(_0x24c43c){return _0x24c43c?{'count':_0x10ca61,'rows':_0x24c43c}:null;}})[_0x3892('0x25')](respondWithResult(_0x103cfc,null))['catch'](handleError(_0x103cfc,null));}; \ No newline at end of file +var _0x0d70=['offset','set','reject','save','update','then','destroy','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','getFields','findOne','Dynamics365Field','length','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count'];(function(_0x5b7ccf,_0x2f1b30){var _0x1db839=function(_0x1e9b95){while(--_0x1e9b95){_0x5b7ccf['push'](_0x5b7ccf['shift']());}};_0x1db839(++_0x2f1b30);}(_0x0d70,0xd9));var _0x00d7=function(_0x5acebc,_0x12109b){_0x5acebc=_0x5acebc-0x0;var _0x3b6599=_0x0d70[_0x5acebc];return _0x3b6599;};'use strict';var emlformat=require(_0x00d7('0x0'));var rimraf=require(_0x00d7('0x1'));var zipdir=require(_0x00d7('0x2'));var jsonpatch=require(_0x00d7('0x3'));var rp=require(_0x00d7('0x4'));var moment=require('moment');var BPromise=require(_0x00d7('0x5'));var Mustache=require('mustache');var util=require(_0x00d7('0x6'));var path=require(_0x00d7('0x7'));var sox=require('sox');var csv=require(_0x00d7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x00d7('0x9'));var _=require('lodash');var squel=require(_0x00d7('0xa'));var crypto=require(_0x00d7('0xb'));var jsforce=require(_0x00d7('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x00d7('0xd'));var Papa=require(_0x00d7('0xe'));var Redis=require(_0x00d7('0xf'));var authService=require(_0x00d7('0x10'));var qs=require(_0x00d7('0x11'));var as=require(_0x00d7('0x12'));var hardwareService=require(_0x00d7('0x13'));var logger=require(_0x00d7('0x14'))('api');var utils=require(_0x00d7('0x15'));var config=require(_0x00d7('0x16'));var licenseUtil=require(_0x00d7('0x17'));var db=require(_0x00d7('0x18'))['db'];function respondWithStatusCode(_0x2de420,_0x20fe47){_0x20fe47=_0x20fe47||0xcc;return function(_0x47c94b){if(_0x47c94b){return _0x2de420[_0x00d7('0x19')](_0x20fe47);}return _0x2de420[_0x00d7('0x1a')](_0x20fe47)[_0x00d7('0x1b')]();};}function respondWithResult(_0x2d17c5,_0x580e9a){_0x580e9a=_0x580e9a||0xc8;return function(_0x3b3101){if(_0x3b3101){return _0x2d17c5[_0x00d7('0x1a')](_0x580e9a)[_0x00d7('0x1c')](_0x3b3101);}};}function respondWithFilteredResult(_0xc3f6af,_0x4d9b2e){return function(_0x1bcc05){if(_0x1bcc05){var _0x2f83bb=typeof _0x4d9b2e['offset']===_0x00d7('0x1d')&&typeof _0x4d9b2e[_0x00d7('0x1e')]===_0x00d7('0x1d');var _0x59c8d1=_0x1bcc05['count'];var _0x197bcd=_0x2f83bb?0x0:_0x4d9b2e['offset'];var _0xa4b519=_0x2f83bb?_0x1bcc05[_0x00d7('0x1f')]:_0x4d9b2e[_0x00d7('0x20')]+_0x4d9b2e[_0x00d7('0x1e')];var _0xd1bf4d;if(_0xa4b519>=_0x59c8d1){_0xa4b519=_0x59c8d1;_0xd1bf4d=0xc8;}else{_0xd1bf4d=0xce;}_0xc3f6af[_0x00d7('0x1a')](_0xd1bf4d);return _0xc3f6af[_0x00d7('0x21')]('Content-Range',_0x197bcd+'-'+_0xa4b519+'/'+_0x59c8d1)['json'](_0x1bcc05);}return null;};}function patchUpdates(_0x559be6){return function(_0x2d4753){try{jsonpatch['apply'](_0x2d4753,_0x559be6,!![]);}catch(_0x5d4465){return BPromise[_0x00d7('0x22')](_0x5d4465);}return _0x2d4753[_0x00d7('0x23')]();};}function saveUpdates(_0x27f938,_0xd0ff1b){return function(_0x2c78b5){if(_0x2c78b5){return _0x2c78b5[_0x00d7('0x24')](_0x27f938)[_0x00d7('0x25')](function(_0x57d556){return _0x57d556;});}return null;};}function removeEntity(_0x17082b,_0x3c44d6){return function(_0x3d2c03){if(_0x3d2c03){return _0x3d2c03[_0x00d7('0x26')]()[_0x00d7('0x25')](function(){_0x17082b[_0x00d7('0x1a')](0xcc)[_0x00d7('0x1b')]();});}};}function handleEntityNotFound(_0x196d49,_0x2b6d09){return function(_0x4d4960){if(!_0x4d4960){_0x196d49['sendStatus'](0x194);}return _0x4d4960;};}function handleError(_0x8ba5b7,_0x4a06b6){_0x4a06b6=_0x4a06b6||0x1f4;return function(_0x5577e6){logger[_0x00d7('0x27')](_0x5577e6[_0x00d7('0x28')]);if(_0x5577e6[_0x00d7('0x29')]){delete _0x5577e6[_0x00d7('0x29')];}_0x8ba5b7[_0x00d7('0x1a')](_0x4a06b6)[_0x00d7('0x2a')](_0x5577e6);};}exports[_0x00d7('0x2b')]=function(_0x9ced02,_0xa4ef91){var _0x578411={},_0x30a4a5={},_0x23a7fd={'count':0x0,'rows':[]};var _0x25ecb4=_[_0x00d7('0x2c')](db[_0x00d7('0x2d')][_0x00d7('0x2e')],function(_0x1939a6){return{'name':_0x1939a6[_0x00d7('0x2f')],'type':_0x1939a6[_0x00d7('0x30')][_0x00d7('0x31')]};});_0x30a4a5[_0x00d7('0x32')]=_[_0x00d7('0x2c')](_0x25ecb4,_0x00d7('0x29'));_0x30a4a5['query']=_['keys'](_0x9ced02[_0x00d7('0x33')]);_0x30a4a5[_0x00d7('0x34')]=_[_0x00d7('0x35')](_0x30a4a5[_0x00d7('0x32')],_0x30a4a5[_0x00d7('0x33')]);_0x578411[_0x00d7('0x36')]=_[_0x00d7('0x35')](_0x30a4a5[_0x00d7('0x32')],qs[_0x00d7('0x37')](_0x9ced02[_0x00d7('0x33')]['fields']));_0x578411['attributes']=_0x578411['attributes']['length']?_0x578411[_0x00d7('0x36')]:_0x30a4a5[_0x00d7('0x32')];if(!_0x9ced02[_0x00d7('0x33')][_0x00d7('0x38')](_0x00d7('0x39'))){_0x578411[_0x00d7('0x1e')]=qs[_0x00d7('0x1e')](_0x9ced02[_0x00d7('0x33')][_0x00d7('0x1e')]);_0x578411['offset']=qs['offset'](_0x9ced02[_0x00d7('0x33')][_0x00d7('0x20')]);}_0x578411[_0x00d7('0x3a')]=qs[_0x00d7('0x3b')](_0x9ced02[_0x00d7('0x33')][_0x00d7('0x3b')]);_0x578411[_0x00d7('0x3c')]=qs['filters'](_[_0x00d7('0x3d')](_0x9ced02[_0x00d7('0x33')],_0x30a4a5['filters']),_0x25ecb4);if(_0x9ced02[_0x00d7('0x33')][_0x00d7('0x3e')]){_0x578411['where']=_[_0x00d7('0x3f')](_0x578411[_0x00d7('0x3c')],{'$or':_[_0x00d7('0x2c')](_0x25ecb4,function(_0x48b724){if(_0x48b724[_0x00d7('0x30')]!==_0x00d7('0x40')){var _0x1ee675={};_0x1ee675[_0x48b724[_0x00d7('0x29')]]={'$like':'%'+_0x9ced02[_0x00d7('0x33')][_0x00d7('0x3e')]+'%'};return _0x1ee675;}})});}_0x578411=_['merge']({},_0x578411,_0x9ced02[_0x00d7('0x41')]);var _0xf9d601={'where':_0x578411[_0x00d7('0x3c')]};return db[_0x00d7('0x2d')][_0x00d7('0x1f')](_0xf9d601)[_0x00d7('0x25')](function(_0x434ebf){_0x23a7fd[_0x00d7('0x1f')]=_0x434ebf;if(_0x9ced02[_0x00d7('0x33')][_0x00d7('0x42')]){_0x578411[_0x00d7('0x43')]=[{'all':!![]}];}return db[_0x00d7('0x2d')][_0x00d7('0x44')](_0x578411);})[_0x00d7('0x25')](function(_0x14cf22){_0x23a7fd[_0x00d7('0x45')]=_0x14cf22;return _0x23a7fd;})['then'](respondWithFilteredResult(_0xa4ef91,_0x578411))['catch'](handleError(_0xa4ef91,null));};exports[_0x00d7('0x46')]=function(_0x25dd8f,_0x32c1a2){var _0x1c7cbb={'raw':![],'where':{'id':_0x25dd8f[_0x00d7('0x47')]['id']}},_0x404fec={};_0x404fec['model']=_[_0x00d7('0x48')](db['Dynamics365Configuration']['rawAttributes']);_0x404fec[_0x00d7('0x33')]=_['keys'](_0x25dd8f[_0x00d7('0x33')]);_0x404fec[_0x00d7('0x34')]=_[_0x00d7('0x35')](_0x404fec[_0x00d7('0x32')],_0x404fec[_0x00d7('0x33')]);_0x1c7cbb[_0x00d7('0x36')]=_[_0x00d7('0x35')](_0x404fec[_0x00d7('0x32')],qs['fields'](_0x25dd8f[_0x00d7('0x33')][_0x00d7('0x37')]));_0x1c7cbb[_0x00d7('0x36')]=_0x1c7cbb[_0x00d7('0x36')]['length']?_0x1c7cbb[_0x00d7('0x36')]:_0x404fec[_0x00d7('0x32')];if(_0x25dd8f[_0x00d7('0x33')][_0x00d7('0x42')]){_0x1c7cbb[_0x00d7('0x43')]=[{'all':!![]}];}_0x1c7cbb=_['merge']({},_0x1c7cbb,_0x25dd8f['options']);return db[_0x00d7('0x2d')][_0x00d7('0x49')](_0x1c7cbb)['then'](handleEntityNotFound(_0x32c1a2,null))[_0x00d7('0x25')](respondWithResult(_0x32c1a2,null))[_0x00d7('0x4a')](handleError(_0x32c1a2,null));};exports[_0x00d7('0x4b')]=function(_0x5229df,_0x16b4e3){return db[_0x00d7('0x2d')][_0x00d7('0x4b')](_0x5229df[_0x00d7('0x4c')],{})[_0x00d7('0x25')](respondWithResult(_0x16b4e3,0xc9))[_0x00d7('0x4a')](handleError(_0x16b4e3,null));};exports['update']=function(_0x229eec,_0x1c1764){if(_0x229eec[_0x00d7('0x4c')]['id']){delete _0x229eec[_0x00d7('0x4c')]['id'];}return db[_0x00d7('0x2d')][_0x00d7('0x49')]({'where':{'id':_0x229eec[_0x00d7('0x47')]['id']}})[_0x00d7('0x25')](handleEntityNotFound(_0x1c1764,null))['then'](saveUpdates(_0x229eec[_0x00d7('0x4c')],null))[_0x00d7('0x25')](respondWithResult(_0x1c1764,null))['catch'](handleError(_0x1c1764,null));};exports[_0x00d7('0x26')]=function(_0x3ff452,_0x3fd9df){return db[_0x00d7('0x2d')][_0x00d7('0x49')]({'where':{'id':_0x3ff452['params']['id']}})['then'](handleEntityNotFound(_0x3fd9df,null))[_0x00d7('0x25')](removeEntity(_0x3fd9df,null))['catch'](handleError(_0x3fd9df,null));};exports[_0x00d7('0x4d')]=function(_0x49a6af,_0x20ef79,_0x5d771a){var _0x16f34b={};var _0x2b050d={};var _0x5982b1;var _0x5b3a95;return db[_0x00d7('0x2d')][_0x00d7('0x4e')]({'where':{'id':_0x49a6af[_0x00d7('0x47')]['id']}})[_0x00d7('0x25')](handleEntityNotFound(_0x20ef79,null))['then'](function(_0x5b14ba){if(_0x5b14ba){_0x5982b1=_0x5b14ba;_0x2b050d[_0x00d7('0x32')]=_[_0x00d7('0x48')](db[_0x00d7('0x4f')][_0x00d7('0x2e')]);_0x2b050d[_0x00d7('0x33')]=_[_0x00d7('0x48')](_0x49a6af[_0x00d7('0x33')]);_0x2b050d['filters']=_[_0x00d7('0x35')](_0x2b050d['model'],_0x2b050d[_0x00d7('0x33')]);_0x16f34b[_0x00d7('0x36')]=_[_0x00d7('0x35')](_0x2b050d['model'],qs[_0x00d7('0x37')](_0x49a6af[_0x00d7('0x33')][_0x00d7('0x37')]));_0x16f34b[_0x00d7('0x36')]=_0x16f34b[_0x00d7('0x36')][_0x00d7('0x50')]?_0x16f34b[_0x00d7('0x36')]:_0x2b050d[_0x00d7('0x32')];_0x16f34b['order']=qs[_0x00d7('0x3b')](_0x49a6af[_0x00d7('0x33')]['sort']);_0x16f34b[_0x00d7('0x3c')]=qs[_0x00d7('0x34')](_[_0x00d7('0x3d')](_0x49a6af[_0x00d7('0x33')],_0x2b050d[_0x00d7('0x34')]));if(_0x49a6af[_0x00d7('0x33')][_0x00d7('0x3e')]){_0x16f34b[_0x00d7('0x3c')]=_[_0x00d7('0x3f')](_0x16f34b[_0x00d7('0x3c')],{'$or':_[_0x00d7('0x2c')](_0x16f34b[_0x00d7('0x36')],function(_0x4533bf){var _0x29d7df={};_0x29d7df[_0x4533bf]={'$like':'%'+_0x49a6af['query'][_0x00d7('0x3e')]+'%'};return _0x29d7df;})});}_0x16f34b=_[_0x00d7('0x3f')]({},_0x16f34b,_0x49a6af[_0x00d7('0x41')]);return _0x5982b1[_0x00d7('0x4d')](_0x16f34b);}})['then'](function(_0x5d5667){if(_0x5d5667){_0x5b3a95=_0x5d5667[_0x00d7('0x50')];if(!_0x49a6af[_0x00d7('0x33')][_0x00d7('0x38')](_0x00d7('0x39'))){_0x16f34b[_0x00d7('0x1e')]=qs['limit'](_0x49a6af[_0x00d7('0x33')]['limit']);_0x16f34b[_0x00d7('0x20')]=qs[_0x00d7('0x20')](_0x49a6af[_0x00d7('0x33')]['offset']);}return _0x5982b1[_0x00d7('0x4d')](_0x16f34b);}})['then'](function(_0x5c2dfa){if(_0x5c2dfa){return _0x5c2dfa?{'count':_0x5b3a95,'rows':_0x5c2dfa}:null;}})[_0x00d7('0x25')](respondWithResult(_0x20ef79,null))[_0x00d7('0x4a')](handleError(_0x20ef79,null));};exports[_0x00d7('0x51')]=function(_0xb2c85b,_0x14de14,_0x1f0bc3){var _0x2bed0a={};var _0x5a0444={};var _0x9ecee4;var _0x3b6e05;return db['Dynamics365Configuration'][_0x00d7('0x4e')]({'where':{'id':_0xb2c85b[_0x00d7('0x47')]['id']}})[_0x00d7('0x25')](handleEntityNotFound(_0x14de14,null))['then'](function(_0x3e740b){if(_0x3e740b){_0x9ecee4=_0x3e740b;_0x5a0444['model']=_[_0x00d7('0x48')](db[_0x00d7('0x4f')][_0x00d7('0x2e')]);_0x5a0444['query']=_[_0x00d7('0x48')](_0xb2c85b[_0x00d7('0x33')]);_0x5a0444['filters']=_[_0x00d7('0x35')](_0x5a0444['model'],_0x5a0444[_0x00d7('0x33')]);_0x2bed0a[_0x00d7('0x36')]=_[_0x00d7('0x35')](_0x5a0444['model'],qs[_0x00d7('0x37')](_0xb2c85b[_0x00d7('0x33')][_0x00d7('0x37')]));_0x2bed0a['attributes']=_0x2bed0a['attributes'][_0x00d7('0x50')]?_0x2bed0a[_0x00d7('0x36')]:_0x5a0444[_0x00d7('0x32')];_0x2bed0a[_0x00d7('0x3a')]=qs[_0x00d7('0x3b')](_0xb2c85b[_0x00d7('0x33')][_0x00d7('0x3b')]);_0x2bed0a['where']=qs[_0x00d7('0x34')](_[_0x00d7('0x3d')](_0xb2c85b[_0x00d7('0x33')],_0x5a0444[_0x00d7('0x34')]));if(_0xb2c85b[_0x00d7('0x33')][_0x00d7('0x3e')]){_0x2bed0a[_0x00d7('0x3c')]=_[_0x00d7('0x3f')](_0x2bed0a[_0x00d7('0x3c')],{'$or':_[_0x00d7('0x2c')](_0x2bed0a['attributes'],function(_0x55a213){var _0x2a6102={};_0x2a6102[_0x55a213]={'$like':'%'+_0xb2c85b[_0x00d7('0x33')][_0x00d7('0x3e')]+'%'};return _0x2a6102;})});}_0x2bed0a=_[_0x00d7('0x3f')]({},_0x2bed0a,_0xb2c85b[_0x00d7('0x41')]);return _0x9ecee4[_0x00d7('0x51')](_0x2bed0a);}})[_0x00d7('0x25')](function(_0x412d36){if(_0x412d36){_0x3b6e05=_0x412d36[_0x00d7('0x50')];if(!_0xb2c85b['query'][_0x00d7('0x38')](_0x00d7('0x39'))){_0x2bed0a[_0x00d7('0x1e')]=qs[_0x00d7('0x1e')](_0xb2c85b[_0x00d7('0x33')][_0x00d7('0x1e')]);_0x2bed0a[_0x00d7('0x20')]=qs[_0x00d7('0x20')](_0xb2c85b[_0x00d7('0x33')][_0x00d7('0x20')]);}return _0x9ecee4[_0x00d7('0x51')](_0x2bed0a);}})[_0x00d7('0x25')](function(_0x4c6973){if(_0x4c6973){return _0x4c6973?{'count':_0x3b6e05,'rows':_0x4c6973}:null;}})['then'](respondWithResult(_0x14de14,null))[_0x00d7('0x4a')](handleError(_0x14de14,null));};exports[_0x00d7('0x52')]=function(_0xddcaa9,_0x10920f,_0x390da5){var _0xfb1e8d={};var _0x2ec98e={};var _0x52345a;var _0x5d8eee;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0xddcaa9[_0x00d7('0x47')]['id']}})[_0x00d7('0x25')](handleEntityNotFound(_0x10920f,null))[_0x00d7('0x25')](function(_0x16911c){if(_0x16911c){_0x52345a=_0x16911c;_0x2ec98e['model']=_[_0x00d7('0x48')](db[_0x00d7('0x4f')][_0x00d7('0x2e')]);_0x2ec98e[_0x00d7('0x33')]=_['keys'](_0xddcaa9[_0x00d7('0x33')]);_0x2ec98e[_0x00d7('0x34')]=_[_0x00d7('0x35')](_0x2ec98e['model'],_0x2ec98e[_0x00d7('0x33')]);_0xfb1e8d[_0x00d7('0x36')]=_[_0x00d7('0x35')](_0x2ec98e[_0x00d7('0x32')],qs[_0x00d7('0x37')](_0xddcaa9[_0x00d7('0x33')][_0x00d7('0x37')]));_0xfb1e8d[_0x00d7('0x36')]=_0xfb1e8d[_0x00d7('0x36')]['length']?_0xfb1e8d[_0x00d7('0x36')]:_0x2ec98e[_0x00d7('0x32')];_0xfb1e8d['order']=qs['sort'](_0xddcaa9[_0x00d7('0x33')][_0x00d7('0x3b')]);_0xfb1e8d[_0x00d7('0x3c')]=qs[_0x00d7('0x34')](_[_0x00d7('0x3d')](_0xddcaa9['query'],_0x2ec98e[_0x00d7('0x34')]));if(_0xddcaa9[_0x00d7('0x33')][_0x00d7('0x3e')]){_0xfb1e8d[_0x00d7('0x3c')]=_['merge'](_0xfb1e8d[_0x00d7('0x3c')],{'$or':_[_0x00d7('0x2c')](_0xfb1e8d['attributes'],function(_0x19f7b2){var _0x3319d9={};_0x3319d9[_0x19f7b2]={'$like':'%'+_0xddcaa9[_0x00d7('0x33')][_0x00d7('0x3e')]+'%'};return _0x3319d9;})});}_0xfb1e8d=_['merge']({},_0xfb1e8d,_0xddcaa9[_0x00d7('0x41')]);return _0x52345a[_0x00d7('0x52')](_0xfb1e8d);}})[_0x00d7('0x25')](function(_0x1ee9c5){if(_0x1ee9c5){_0x5d8eee=_0x1ee9c5['length'];if(!_0xddcaa9[_0x00d7('0x33')]['hasOwnProperty']('nolimit')){_0xfb1e8d[_0x00d7('0x1e')]=qs[_0x00d7('0x1e')](_0xddcaa9[_0x00d7('0x33')][_0x00d7('0x1e')]);_0xfb1e8d[_0x00d7('0x20')]=qs[_0x00d7('0x20')](_0xddcaa9['query'][_0x00d7('0x20')]);}return _0x52345a[_0x00d7('0x52')](_0xfb1e8d);}})[_0x00d7('0x25')](function(_0x35c1be){if(_0x35c1be){return _0x35c1be?{'count':_0x5d8eee,'rows':_0x35c1be}:null;}})[_0x00d7('0x25')](respondWithResult(_0x10920f,null))['catch'](handleError(_0x10920f,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index d36dd39..42cdfc8 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 _0xb4e6=['path','rimraf','./intDynamics365Configuration.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1ca2f0,_0x356d2e){var _0x4bac2d=function(_0x161ec5){while(--_0x161ec5){_0x1ca2f0['push'](_0x1ca2f0['shift']());}};_0x4bac2d(++_0x356d2e);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0xf48cce,_0x3531e4){_0xf48cce=_0xf48cce-0x0;var _0x2a5c38=_0xb4e6[_0xf48cce];return _0x2a5c38;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['int_dynamics365_configurations','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes'];(function(_0x4e0eb6,_0x240784){var _0x46e432=function(_0x24b973){while(--_0x24b973){_0x4e0eb6['push'](_0x4e0eb6['shift']());}};_0x46e432(++_0x240784);}(_0x70e0,0x17b));var _0x070e=function(_0x4666af,_0x322ec5){_0x4666af=_0x4666af-0x0;var _0xec3d0a=_0x70e0[_0x4666af];return _0xec3d0a;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('Dynamics365Configuration',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index dd57672..ccdec07 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 _0xd1f3=['error','Dynamics365Configuration,\x20%s,\x20%s','message','result','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x10b790,_0x423dad){var _0x2b40ff=function(_0x38fd01){while(--_0x38fd01){_0x10b790['push'](_0x10b790['shift']());}};_0x2b40ff(++_0x423dad);}(_0xd1f3,0x7c));var _0x3d1f=function(_0x2a6c96,_0x4ac989){_0x2a6c96=_0x2a6c96-0x0;var _0x576a44=_0xd1f3[_0x2a6c96];return _0x576a44;};'use strict';var _=require(_0x3d1f('0x0'));var util=require(_0x3d1f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d1f('0x2'));var db=require(_0x3d1f('0x3'))['db'];var utils=require(_0x3d1f('0x4'));var logger=require('../../config/logger')(_0x3d1f('0x5'));var config=require(_0x3d1f('0x6'));var jayson=require(_0x3d1f('0x7'));var client=jayson[_0x3d1f('0x8')][_0x3d1f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b5736,_0x376a52,_0x59f86d){return new BPromise(function(_0x28df02,_0x5be15c){return client[_0x3d1f('0xa')](_0x5b5736,_0x59f86d)['then'](function(_0x45c44c){logger[_0x3d1f('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x376a52,'request\x20sent');logger[_0x3d1f('0xc')](_0x3d1f('0xd'),_0x376a52,_0x3d1f('0xe'),JSON[_0x3d1f('0xf')](_0x45c44c));if(_0x45c44c[_0x3d1f('0x10')]){if(_0x45c44c['error']['code']===0x1f4){logger[_0x3d1f('0x10')](_0x3d1f('0x11'),_0x376a52,_0x45c44c[_0x3d1f('0x10')][_0x3d1f('0x12')]);return _0x5be15c(_0x45c44c[_0x3d1f('0x10')][_0x3d1f('0x12')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x376a52,_0x45c44c['error'][_0x3d1f('0x12')]);return _0x28df02(_0x45c44c[_0x3d1f('0x10')][_0x3d1f('0x12')]);}else{logger['info'](_0x3d1f('0x11'),_0x376a52,_0x3d1f('0xe'));_0x28df02(_0x45c44c[_0x3d1f('0x13')][_0x3d1f('0x12')]);}})['catch'](function(_0x4405a9){logger['error'](_0x3d1f('0x11'),_0x376a52,_0x4405a9);_0x5be15c(_0x4405a9);});});} \ No newline at end of file +var _0xf8ed=['../../config/environment','jayson/promise','client','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4e60e0,_0x406c3d){var _0x341ea6=function(_0x594c86){while(--_0x594c86){_0x4e60e0['push'](_0x4e60e0['shift']());}};_0x341ea6(++_0x406c3d);}(_0xf8ed,0x1ae));var _0xdf8e=function(_0x5466e0,_0x586206){_0x5466e0=_0x5466e0-0x0;var _0xf32c89=_0xf8ed[_0x5466e0];return _0xf32c89;};'use strict';var _=require(_0xdf8e('0x0'));var util=require('util');var moment=require(_0xdf8e('0x1'));var BPromise=require(_0xdf8e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdf8e('0x3'));var db=require(_0xdf8e('0x4'))['db'];var utils=require(_0xdf8e('0x5'));var logger=require(_0xdf8e('0x6'))('rpc');var config=require(_0xdf8e('0x7'));var jayson=require(_0xdf8e('0x8'));var client=jayson[_0xdf8e('0x9')][_0xdf8e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x524f3a,_0x2973d3,_0x4918ff){return new BPromise(function(_0x4b1b54,_0xea5833){return client[_0xdf8e('0xb')](_0x524f3a,_0x4918ff)[_0xdf8e('0xc')](function(_0x5f5433){logger['info'](_0xdf8e('0xd'),_0x2973d3,_0xdf8e('0xe'));logger[_0xdf8e('0xf')](_0xdf8e('0x10'),_0x2973d3,_0xdf8e('0xe'),JSON[_0xdf8e('0x11')](_0x5f5433));if(_0x5f5433[_0xdf8e('0x12')]){if(_0x5f5433[_0xdf8e('0x12')][_0xdf8e('0x13')]===0x1f4){logger[_0xdf8e('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2973d3,_0x5f5433[_0xdf8e('0x12')][_0xdf8e('0x14')]);return _0xea5833(_0x5f5433[_0xdf8e('0x12')][_0xdf8e('0x14')]);}logger[_0xdf8e('0x12')](_0xdf8e('0xd'),_0x2973d3,_0x5f5433['error']['message']);return _0x4b1b54(_0x5f5433[_0xdf8e('0x12')]['message']);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x2973d3,'request\x20sent');_0x4b1b54(_0x5f5433[_0xdf8e('0x15')][_0xdf8e('0x14')]);}})[_0xdf8e('0x16')](function(_0x3fd3e8){logger[_0xdf8e('0x12')](_0xdf8e('0xd'),_0x2973d3,_0x3fd3e8);_0xea5833(_0x3fd3e8);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 84252c0..9dd6cb3 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 _0x77e4=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','create','put','/:id','delete','destroy','exports','multer','util','connect-timeout','Router'];(function(_0x3fbb0e,_0x1c808e){var _0x40206d=function(_0x2d272e){while(--_0x2d272e){_0x3fbb0e['push'](_0x3fbb0e['shift']());}};_0x40206d(++_0x1c808e);}(_0x77e4,0xbf));var _0x477e=function(_0x3ddce5,_0x21a69c){_0x3ddce5=_0x3ddce5-0x0;var _0x4a91a4=_0x77e4[_0x3ddce5];return _0x4a91a4;};'use strict';var multer=require(_0x477e('0x0'));var util=require(_0x477e('0x1'));var path=require('path');var timeout=require(_0x477e('0x2'));var express=require('express');var router=express[_0x477e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x477e('0x4'));var interaction=require(_0x477e('0x5'));var config=require(_0x477e('0x6'));var controller=require('./intDynamics365Field.controller');router[_0x477e('0x7')]('/',auth[_0x477e('0x8')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x477e('0x8')](),controller[_0x477e('0x9')]);router[_0x477e('0xa')](_0x477e('0xb'),auth[_0x477e('0x8')](),controller['update']);router[_0x477e('0xc')](_0x477e('0xb'),auth[_0x477e('0x8')](),controller[_0x477e('0xd')]);module[_0x477e('0xe')]=router; \ No newline at end of file +var _0x667a=['index','get','/:id','show','post','create','put','update','delete','isAuthenticated','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./intDynamics365Field.controller'];(function(_0x2a5058,_0x12fb9c){var _0x162bd6=function(_0x577cbe){while(--_0x577cbe){_0x2a5058['push'](_0x2a5058['shift']());}};_0x162bd6(++_0x12fb9c);}(_0x667a,0xe8));var _0xa667=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x667a[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require(_0xa667('0x0'));var util=require(_0xa667('0x1'));var path=require(_0xa667('0x2'));var timeout=require(_0xa667('0x3'));var express=require(_0xa667('0x4'));var router=express['Router']();var fs_extra=require(_0xa667('0x5'));var auth=require(_0xa667('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa667('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xa667('0x8')]);router[_0xa667('0x9')](_0xa667('0xa'),auth['isAuthenticated'](),controller[_0xa667('0xb')]);router[_0xa667('0xc')]('/',auth['isAuthenticated'](),controller[_0xa667('0xd')]);router[_0xa667('0xe')](_0xa667('0xa'),auth['isAuthenticated'](),controller[_0xa667('0xf')]);router[_0xa667('0x10')](_0xa667('0xa'),auth[_0xa667('0x11')](),controller[_0xa667('0x12')]);module[_0xa667('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index a7a6377..652cc00 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 _0xf17b=['keyValue','picklist','STRING','variable','BOOLEAN','exports','string','customVariable'];(function(_0x9d7b61,_0x2d79de){var _0xbe809f=function(_0x73fcf5){while(--_0x73fcf5){_0x9d7b61['push'](_0x9d7b61['shift']());}};_0xbe809f(++_0x2d79de);}(_0xf17b,0x65));var _0xbf17=function(_0xd03f7d,_0xce6913){_0xd03f7d=_0xd03f7d-0x0;var _0xbc4548=_0xf17b[_0xd03f7d];return _0xbc4548;};'use strict';var Sequelize=require('sequelize');module[_0xbf17('0x0')]={'type':{'type':Sequelize['ENUM'](_0xbf17('0x1'),'variable',_0xbf17('0x2'),_0xbf17('0x3'),_0xbf17('0x4')),'defaultValue':_0xbf17('0x1')},'content':{'type':Sequelize[_0xbf17('0x5')]},'key':{'type':Sequelize[_0xbf17('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xbf17('0x1'),_0xbf17('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0xbf17('0x5')]},'idField':{'type':Sequelize[_0xbf17('0x5')]},'nameField':{'type':Sequelize[_0xbf17('0x5')]},'customField':{'type':Sequelize[_0xbf17('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbf17('0x5')]}}; \ No newline at end of file +var _0x8558=['variable','customVariable','keyValue','STRING','BOOLEAN','exports','ENUM','string'];(function(_0x5300ba,_0x537f6c){var _0x49ffb5=function(_0x5047cd){while(--_0x5047cd){_0x5300ba['push'](_0x5300ba['shift']());}};_0x49ffb5(++_0x537f6c);}(_0x8558,0xc5));var _0x8855=function(_0x38ee5f,_0x48cd85){_0x38ee5f=_0x38ee5f-0x0;var _0x764041=_0x8558[_0x38ee5f];return _0x764041;};'use strict';var Sequelize=require('sequelize');module[_0x8855('0x0')]={'type':{'type':Sequelize[_0x8855('0x1')](_0x8855('0x2'),_0x8855('0x3'),_0x8855('0x4'),_0x8855('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x8855('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x8855('0x2'),'variable',_0x8855('0x4'))},'keyContent':{'type':Sequelize[_0x8855('0x6')]},'idField':{'type':Sequelize[_0x8855('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8855('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8855('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 11db63e..b5072d6 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 _0x9d45=['create','body','update','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','reject','save','then','destroy','stack','name','send','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','filters','find'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x9d45,0xde));var _0x59d4=function(_0x23f711,_0x25284a){_0x23f711=_0x23f711-0x0;var _0x148fa3=_0x9d45[_0x23f711];return _0x148fa3;};'use strict';var emlformat=require(_0x59d4('0x0'));var rimraf=require(_0x59d4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x59d4('0x2'));var rp=require('request-promise');var moment=require(_0x59d4('0x3'));var BPromise=require(_0x59d4('0x4'));var Mustache=require(_0x59d4('0x5'));var util=require(_0x59d4('0x6'));var path=require(_0x59d4('0x7'));var sox=require(_0x59d4('0x8'));var csv=require(_0x59d4('0x9'));var ejs=require(_0x59d4('0xa'));var fs=require('fs');var fs_extra=require(_0x59d4('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x59d4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x59d4('0xd'));var Papa=require(_0x59d4('0xe'));var Redis=require(_0x59d4('0xf'));var authService=require(_0x59d4('0x10'));var qs=require(_0x59d4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x59d4('0x12'));var logger=require(_0x59d4('0x13'))(_0x59d4('0x14'));var utils=require('../../config/utils');var config=require(_0x59d4('0x15'));var licenseUtil=require(_0x59d4('0x16'));var db=require(_0x59d4('0x17'))['db'];function respondWithStatusCode(_0x1a857f,_0x334075){_0x334075=_0x334075||0xcc;return function(_0x1d3ac6){if(_0x1d3ac6){return _0x1a857f[_0x59d4('0x18')](_0x334075);}return _0x1a857f[_0x59d4('0x19')](_0x334075)[_0x59d4('0x1a')]();};}function respondWithResult(_0x101ef4,_0x51e081){_0x51e081=_0x51e081||0xc8;return function(_0x145c4d){if(_0x145c4d){return _0x101ef4[_0x59d4('0x19')](_0x51e081)[_0x59d4('0x1b')](_0x145c4d);}};}function respondWithFilteredResult(_0x2d6918,_0x33a621){return function(_0x439ea6){if(_0x439ea6){var _0x169079=typeof _0x33a621['offset']==='undefined'&&typeof _0x33a621[_0x59d4('0x1c')]===_0x59d4('0x1d');var _0x5645d4=_0x439ea6['count'];var _0x49e40e=_0x169079?0x0:_0x33a621[_0x59d4('0x1e')];var _0x25a804=_0x169079?_0x439ea6[_0x59d4('0x1f')]:_0x33a621[_0x59d4('0x1e')]+_0x33a621[_0x59d4('0x1c')];var _0x5ea912;if(_0x25a804>=_0x5645d4){_0x25a804=_0x5645d4;_0x5ea912=0xc8;}else{_0x5ea912=0xce;}_0x2d6918[_0x59d4('0x19')](_0x5ea912);return _0x2d6918[_0x59d4('0x20')](_0x59d4('0x21'),_0x49e40e+'-'+_0x25a804+'/'+_0x5645d4)[_0x59d4('0x1b')](_0x439ea6);}return null;};}function patchUpdates(_0x28e99a){return function(_0xa46b3){try{jsonpatch['apply'](_0xa46b3,_0x28e99a,!![]);}catch(_0xc90ee0){return BPromise[_0x59d4('0x22')](_0xc90ee0);}return _0xa46b3[_0x59d4('0x23')]();};}function saveUpdates(_0x308ffa,_0x3f8077){return function(_0x322dc8){if(_0x322dc8){return _0x322dc8['update'](_0x308ffa)[_0x59d4('0x24')](function(_0x34661d){return _0x34661d;});}return null;};}function removeEntity(_0x235453,_0x2e037a){return function(_0x355123){if(_0x355123){return _0x355123[_0x59d4('0x25')]()['then'](function(){_0x235453['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x182d93,_0x1f3752){return function(_0x3eb719){if(!_0x3eb719){_0x182d93['sendStatus'](0x194);}return _0x3eb719;};}function handleError(_0x3feaaa,_0x50ce10){_0x50ce10=_0x50ce10||0x1f4;return function(_0x3fe3e7){logger['error'](_0x3fe3e7[_0x59d4('0x26')]);if(_0x3fe3e7[_0x59d4('0x27')]){delete _0x3fe3e7[_0x59d4('0x27')];}_0x3feaaa[_0x59d4('0x19')](_0x50ce10)[_0x59d4('0x28')](_0x3fe3e7);};}exports['index']=function(_0x3e0c20,_0x114083){var _0x8e59b={},_0x19970a={},_0x2fbabf={'count':0x0,'rows':[]};var _0x36af0c=_[_0x59d4('0x29')](db[_0x59d4('0x2a')][_0x59d4('0x2b')],function(_0x14f261){return{'name':_0x14f261[_0x59d4('0x2c')],'type':_0x14f261[_0x59d4('0x2d')][_0x59d4('0x2e')]};});_0x19970a[_0x59d4('0x2f')]=_[_0x59d4('0x29')](_0x36af0c,'name');_0x19970a[_0x59d4('0x30')]=_[_0x59d4('0x31')](_0x3e0c20['query']);_0x19970a['filters']=_[_0x59d4('0x32')](_0x19970a[_0x59d4('0x2f')],_0x19970a['query']);_0x8e59b['attributes']=_[_0x59d4('0x32')](_0x19970a[_0x59d4('0x2f')],qs['fields'](_0x3e0c20[_0x59d4('0x30')][_0x59d4('0x33')]));_0x8e59b[_0x59d4('0x34')]=_0x8e59b[_0x59d4('0x34')]['length']?_0x8e59b[_0x59d4('0x34')]:_0x19970a[_0x59d4('0x2f')];if(!_0x3e0c20[_0x59d4('0x30')][_0x59d4('0x35')](_0x59d4('0x36'))){_0x8e59b[_0x59d4('0x1c')]=qs[_0x59d4('0x1c')](_0x3e0c20['query'][_0x59d4('0x1c')]);_0x8e59b[_0x59d4('0x1e')]=qs[_0x59d4('0x1e')](_0x3e0c20[_0x59d4('0x30')]['offset']);}_0x8e59b['order']=qs['sort'](_0x3e0c20[_0x59d4('0x30')][_0x59d4('0x37')]);_0x8e59b[_0x59d4('0x38')]=qs['filters'](_[_0x59d4('0x39')](_0x3e0c20['query'],_0x19970a['filters']),_0x36af0c);if(_0x3e0c20['query'][_0x59d4('0x3a')]){_0x8e59b[_0x59d4('0x38')]=_[_0x59d4('0x3b')](_0x8e59b[_0x59d4('0x38')],{'$or':_[_0x59d4('0x29')](_0x36af0c,function(_0x24ad92){if(_0x24ad92['type']!==_0x59d4('0x3c')){var _0x22281a={};_0x22281a[_0x24ad92[_0x59d4('0x27')]]={'$like':'%'+_0x3e0c20[_0x59d4('0x30')][_0x59d4('0x3a')]+'%'};return _0x22281a;}})});}_0x8e59b=_[_0x59d4('0x3b')]({},_0x8e59b,_0x3e0c20[_0x59d4('0x3d')]);var _0x4e5a64={'where':_0x8e59b[_0x59d4('0x38')]};return db[_0x59d4('0x2a')]['count'](_0x4e5a64)[_0x59d4('0x24')](function(_0x334ec0){_0x2fbabf[_0x59d4('0x1f')]=_0x334ec0;if(_0x3e0c20[_0x59d4('0x30')][_0x59d4('0x3e')]){_0x8e59b[_0x59d4('0x3f')]=[{'all':!![]}];}return db[_0x59d4('0x2a')][_0x59d4('0x40')](_0x8e59b);})['then'](function(_0x32e678){_0x2fbabf[_0x59d4('0x41')]=_0x32e678;return _0x2fbabf;})[_0x59d4('0x24')](respondWithFilteredResult(_0x114083,_0x8e59b))[_0x59d4('0x42')](handleError(_0x114083,null));};exports['show']=function(_0x1e6fb1,_0x18f5c2){var _0x240c75={'raw':!![],'where':{'id':_0x1e6fb1[_0x59d4('0x43')]['id']}},_0x4a9b01={};_0x4a9b01['model']=_[_0x59d4('0x31')](db['Dynamics365Field'][_0x59d4('0x2b')]);_0x4a9b01[_0x59d4('0x30')]=_[_0x59d4('0x31')](_0x1e6fb1[_0x59d4('0x30')]);_0x4a9b01[_0x59d4('0x44')]=_[_0x59d4('0x32')](_0x4a9b01[_0x59d4('0x2f')],_0x4a9b01['query']);_0x240c75[_0x59d4('0x34')]=_[_0x59d4('0x32')](_0x4a9b01[_0x59d4('0x2f')],qs['fields'](_0x1e6fb1['query'][_0x59d4('0x33')]));_0x240c75[_0x59d4('0x34')]=_0x240c75[_0x59d4('0x34')]['length']?_0x240c75[_0x59d4('0x34')]:_0x4a9b01[_0x59d4('0x2f')];if(_0x1e6fb1['query'][_0x59d4('0x3e')]){_0x240c75[_0x59d4('0x3f')]=[{'all':!![]}];}_0x240c75=_[_0x59d4('0x3b')]({},_0x240c75,_0x1e6fb1['options']);return db[_0x59d4('0x2a')][_0x59d4('0x45')](_0x240c75)[_0x59d4('0x24')](handleEntityNotFound(_0x18f5c2,null))[_0x59d4('0x24')](respondWithResult(_0x18f5c2,null))['catch'](handleError(_0x18f5c2,null));};exports[_0x59d4('0x46')]=function(_0x5cdb99,_0x27d4a1){return db[_0x59d4('0x2a')][_0x59d4('0x46')](_0x5cdb99[_0x59d4('0x47')],{})[_0x59d4('0x24')](respondWithResult(_0x27d4a1,0xc9))[_0x59d4('0x42')](handleError(_0x27d4a1,null));};exports[_0x59d4('0x48')]=function(_0x25bd23,_0x45b860){if(_0x25bd23['body']['id']){delete _0x25bd23[_0x59d4('0x47')]['id'];}return db[_0x59d4('0x2a')][_0x59d4('0x45')]({'where':{'id':_0x25bd23['params']['id']}})[_0x59d4('0x24')](handleEntityNotFound(_0x45b860,null))[_0x59d4('0x24')](saveUpdates(_0x25bd23[_0x59d4('0x47')],null))[_0x59d4('0x24')](respondWithResult(_0x45b860,null))['catch'](handleError(_0x45b860,null));};exports['destroy']=function(_0x7771a0,_0x35c0a6){return db['Dynamics365Field']['find']({'where':{'id':_0x7771a0[_0x59d4('0x43')]['id']}})[_0x59d4('0x24')](handleEntityNotFound(_0x35c0a6,null))['then'](removeEntity(_0x35c0a6,null))[_0x59d4('0x42')](handleError(_0x35c0a6,null));}; \ No newline at end of file +var _0x697f=['pick','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','catch','show','length','find','create','body','params','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','Dynamics365Field','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','limit','order','sort'];(function(_0xe799d9,_0x2ce237){var _0x2a56f6=function(_0x4613c7){while(--_0x4613c7){_0xe799d9['push'](_0xe799d9['shift']());}};_0x2a56f6(++_0x2ce237);}(_0x697f,0x12c));var _0xf697=function(_0x2f99c7,_0x4d0bfb){_0x2f99c7=_0x2f99c7-0x0;var _0x3ee638=_0x697f[_0x2f99c7];return _0x3ee638;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf697('0x0'));var zipdir=require(_0xf697('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf697('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf697('0x3'));var util=require(_0xf697('0x4'));var path=require(_0xf697('0x5'));var sox=require(_0xf697('0x6'));var csv=require('to-csv');var ejs=require(_0xf697('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf697('0x8'));var squel=require(_0xf697('0x9'));var crypto=require(_0xf697('0xa'));var jsforce=require(_0xf697('0xb'));var deskjs=require(_0xf697('0xc'));var toCsv=require(_0xf697('0xd'));var querystring=require('querystring');var Papa=require(_0xf697('0xe'));var Redis=require(_0xf697('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf697('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf697('0x11'))('api');var utils=require(_0xf697('0x12'));var config=require(_0xf697('0x13'));var licenseUtil=require(_0xf697('0x14'));var db=require(_0xf697('0x15'))['db'];function respondWithStatusCode(_0x1fe8e7,_0x5ab9c2){_0x5ab9c2=_0x5ab9c2||0xcc;return function(_0x522a9f){if(_0x522a9f){return _0x1fe8e7[_0xf697('0x16')](_0x5ab9c2);}return _0x1fe8e7[_0xf697('0x17')](_0x5ab9c2)['end']();};}function respondWithResult(_0x446bbf,_0x55c9f6){_0x55c9f6=_0x55c9f6||0xc8;return function(_0x4a1a61){if(_0x4a1a61){return _0x446bbf[_0xf697('0x17')](_0x55c9f6)[_0xf697('0x18')](_0x4a1a61);}};}function respondWithFilteredResult(_0xde1332,_0x58d1e1){return function(_0x5b8bbb){if(_0x5b8bbb){var _0x7d25ee=typeof _0x58d1e1[_0xf697('0x19')]==='undefined'&&typeof _0x58d1e1['limit']===_0xf697('0x1a');var _0xdf003d=_0x5b8bbb[_0xf697('0x1b')];var _0x482b68=_0x7d25ee?0x0:_0x58d1e1['offset'];var _0x45e689=_0x7d25ee?_0x5b8bbb[_0xf697('0x1b')]:_0x58d1e1[_0xf697('0x19')]+_0x58d1e1['limit'];var _0x54e0a4;if(_0x45e689>=_0xdf003d){_0x45e689=_0xdf003d;_0x54e0a4=0xc8;}else{_0x54e0a4=0xce;}_0xde1332[_0xf697('0x17')](_0x54e0a4);return _0xde1332['set'](_0xf697('0x1c'),_0x482b68+'-'+_0x45e689+'/'+_0xdf003d)[_0xf697('0x18')](_0x5b8bbb);}return null;};}function patchUpdates(_0xee7ac4){return function(_0x429c1c){try{jsonpatch['apply'](_0x429c1c,_0xee7ac4,!![]);}catch(_0x3ea687){return BPromise[_0xf697('0x1d')](_0x3ea687);}return _0x429c1c[_0xf697('0x1e')]();};}function saveUpdates(_0x112238,_0x21951a){return function(_0xd64394){if(_0xd64394){return _0xd64394[_0xf697('0x1f')](_0x112238)[_0xf697('0x20')](function(_0x43ee11){return _0x43ee11;});}return null;};}function removeEntity(_0x31b06a,_0x166711){return function(_0x11bf79){if(_0x11bf79){return _0x11bf79[_0xf697('0x21')]()[_0xf697('0x20')](function(){_0x31b06a[_0xf697('0x17')](0xcc)[_0xf697('0x22')]();});}};}function handleEntityNotFound(_0x38b991,_0x1167c8){return function(_0x11fb00){if(!_0x11fb00){_0x38b991[_0xf697('0x16')](0x194);}return _0x11fb00;};}function handleError(_0x57940d,_0x16a576){_0x16a576=_0x16a576||0x1f4;return function(_0x52d48f){logger[_0xf697('0x23')](_0x52d48f[_0xf697('0x24')]);if(_0x52d48f[_0xf697('0x25')]){delete _0x52d48f[_0xf697('0x25')];}_0x57940d[_0xf697('0x17')](_0x16a576)[_0xf697('0x26')](_0x52d48f);};}exports[_0xf697('0x27')]=function(_0x26f9b1,_0x3c72b2){var _0x41f0bf={},_0x229f68={},_0x436b62={'count':0x0,'rows':[]};var _0xec20ef=_['map'](db[_0xf697('0x28')][_0xf697('0x29')],function(_0x576665){return{'name':_0x576665[_0xf697('0x2a')],'type':_0x576665['type'][_0xf697('0x2b')]};});_0x229f68[_0xf697('0x2c')]=_[_0xf697('0x2d')](_0xec20ef,'name');_0x229f68[_0xf697('0x2e')]=_[_0xf697('0x2f')](_0x26f9b1[_0xf697('0x2e')]);_0x229f68[_0xf697('0x30')]=_[_0xf697('0x31')](_0x229f68[_0xf697('0x2c')],_0x229f68['query']);_0x41f0bf[_0xf697('0x32')]=_[_0xf697('0x31')](_0x229f68[_0xf697('0x2c')],qs[_0xf697('0x33')](_0x26f9b1[_0xf697('0x2e')]['fields']));_0x41f0bf['attributes']=_0x41f0bf[_0xf697('0x32')]['length']?_0x41f0bf[_0xf697('0x32')]:_0x229f68[_0xf697('0x2c')];if(!_0x26f9b1[_0xf697('0x2e')]['hasOwnProperty']('nolimit')){_0x41f0bf[_0xf697('0x34')]=qs[_0xf697('0x34')](_0x26f9b1[_0xf697('0x2e')][_0xf697('0x34')]);_0x41f0bf[_0xf697('0x19')]=qs[_0xf697('0x19')](_0x26f9b1[_0xf697('0x2e')][_0xf697('0x19')]);}_0x41f0bf[_0xf697('0x35')]=qs[_0xf697('0x36')](_0x26f9b1[_0xf697('0x2e')][_0xf697('0x36')]);_0x41f0bf['where']=qs[_0xf697('0x30')](_[_0xf697('0x37')](_0x26f9b1[_0xf697('0x2e')],_0x229f68[_0xf697('0x30')]),_0xec20ef);if(_0x26f9b1[_0xf697('0x2e')][_0xf697('0x38')]){_0x41f0bf['where']=_[_0xf697('0x39')](_0x41f0bf['where'],{'$or':_['map'](_0xec20ef,function(_0x37d53c){if(_0x37d53c['type']!==_0xf697('0x3a')){var _0x41d11c={};_0x41d11c[_0x37d53c[_0xf697('0x25')]]={'$like':'%'+_0x26f9b1[_0xf697('0x2e')][_0xf697('0x38')]+'%'};return _0x41d11c;}})});}_0x41f0bf=_['merge']({},_0x41f0bf,_0x26f9b1[_0xf697('0x3b')]);var _0x35f68b={'where':_0x41f0bf[_0xf697('0x3c')]};return db[_0xf697('0x28')]['count'](_0x35f68b)[_0xf697('0x20')](function(_0x21698f){_0x436b62[_0xf697('0x1b')]=_0x21698f;if(_0x26f9b1[_0xf697('0x2e')][_0xf697('0x3d')]){_0x41f0bf[_0xf697('0x3e')]=[{'all':!![]}];}return db[_0xf697('0x28')][_0xf697('0x3f')](_0x41f0bf);})[_0xf697('0x20')](function(_0x45e0dc){_0x436b62['rows']=_0x45e0dc;return _0x436b62;})[_0xf697('0x20')](respondWithFilteredResult(_0x3c72b2,_0x41f0bf))[_0xf697('0x40')](handleError(_0x3c72b2,null));};exports[_0xf697('0x41')]=function(_0x58000,_0x46a185){var _0x156234={'raw':!![],'where':{'id':_0x58000['params']['id']}},_0x5d4a7a={};_0x5d4a7a['model']=_[_0xf697('0x2f')](db[_0xf697('0x28')][_0xf697('0x29')]);_0x5d4a7a[_0xf697('0x2e')]=_[_0xf697('0x2f')](_0x58000[_0xf697('0x2e')]);_0x5d4a7a[_0xf697('0x30')]=_[_0xf697('0x31')](_0x5d4a7a[_0xf697('0x2c')],_0x5d4a7a[_0xf697('0x2e')]);_0x156234['attributes']=_['intersection'](_0x5d4a7a[_0xf697('0x2c')],qs[_0xf697('0x33')](_0x58000[_0xf697('0x2e')][_0xf697('0x33')]));_0x156234[_0xf697('0x32')]=_0x156234[_0xf697('0x32')][_0xf697('0x42')]?_0x156234[_0xf697('0x32')]:_0x5d4a7a['model'];if(_0x58000[_0xf697('0x2e')][_0xf697('0x3d')]){_0x156234['include']=[{'all':!![]}];}_0x156234=_[_0xf697('0x39')]({},_0x156234,_0x58000['options']);return db[_0xf697('0x28')][_0xf697('0x43')](_0x156234)[_0xf697('0x20')](handleEntityNotFound(_0x46a185,null))[_0xf697('0x20')](respondWithResult(_0x46a185,null))['catch'](handleError(_0x46a185,null));};exports[_0xf697('0x44')]=function(_0x55a57d,_0x55af04){return db[_0xf697('0x28')]['create'](_0x55a57d['body'],{})['then'](respondWithResult(_0x55af04,0xc9))[_0xf697('0x40')](handleError(_0x55af04,null));};exports[_0xf697('0x1f')]=function(_0x1d0707,_0x13fc2f){if(_0x1d0707[_0xf697('0x45')]['id']){delete _0x1d0707[_0xf697('0x45')]['id'];}return db['Dynamics365Field']['find']({'where':{'id':_0x1d0707[_0xf697('0x46')]['id']}})[_0xf697('0x20')](handleEntityNotFound(_0x13fc2f,null))[_0xf697('0x20')](saveUpdates(_0x1d0707[_0xf697('0x45')],null))[_0xf697('0x20')](respondWithResult(_0x13fc2f,null))[_0xf697('0x40')](handleError(_0x13fc2f,null));};exports[_0xf697('0x21')]=function(_0x3fc00d,_0x24c196){return db[_0xf697('0x28')][_0xf697('0x43')]({'where':{'id':_0x3fc00d['params']['id']}})['then'](handleEntityNotFound(_0x24c196,null))[_0xf697('0x20')](removeEntity(_0x24c196,null))[_0xf697('0x40')](handleError(_0x24c196,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index ea64ab1..f698c76 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 _0xb231=['Dynamics365Field','dynamics365_unique_index','idField','FieldId','lodash','../../config/logger','bluebird','request-promise','../../config/environment','exports','define'];(function(_0x5c7091,_0x24da7e){var _0x32f5a1=function(_0x1f697e){while(--_0x1f697e){_0x5c7091['push'](_0x5c7091['shift']());}};_0x32f5a1(++_0x24da7e);}(_0xb231,0x88));var _0x1b23=function(_0x580a4b,_0x7c7b21){_0x580a4b=_0x580a4b-0x0;var _0x53311c=_0xb231[_0x580a4b];return _0x53311c;};'use strict';var _=require(_0x1b23('0x0'));var util=require('util');var logger=require(_0x1b23('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b23('0x2'));var rp=require(_0x1b23('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1b23('0x4'));var attributes=require('./intDynamics365Field.attributes');module[_0x1b23('0x5')]=function(_0x2e513e,_0x947286){return _0x2e513e[_0x1b23('0x6')](_0x1b23('0x7'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x1b23('0x8'),'fields':[_0x1b23('0x9'),_0x1b23('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x53a8=['api','moment','bluebird','request-promise','path','rimraf','exports','define','Dynamics365Field','int_dynamics365_fields','idField','lodash','util','../../config/logger'];(function(_0x21bc3a,_0x5d955b){var _0x40f298=function(_0x142cc1){while(--_0x142cc1){_0x21bc3a['push'](_0x21bc3a['shift']());}};_0x40f298(++_0x5d955b);}(_0x53a8,0x1e7));var _0x853a=function(_0x13a621,_0x300626){_0x13a621=_0x13a621-0x0;var _0x371886=_0x53a8[_0x13a621];return _0x371886;};'use strict';var _=require(_0x853a('0x0'));var util=require(_0x853a('0x1'));var logger=require(_0x853a('0x2'))(_0x853a('0x3'));var moment=require(_0x853a('0x4'));var BPromise=require(_0x853a('0x5'));var rp=require(_0x853a('0x6'));var fs=require('fs');var path=require(_0x853a('0x7'));var rimraf=require(_0x853a('0x8'));var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module[_0x853a('0x9')]=function(_0x130290,_0x1b6c4e){return _0x130290[_0x853a('0xa')](_0x853a('0xb'),attributes,{'tableName':_0x853a('0xc'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x853a('0xd'),'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 1e45646..7f7d12e 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 _0x30dc=['Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x30dc,0xc3));var _0xc30d=function(_0x4cdba5,_0x5373a7){_0x4cdba5=_0x4cdba5-0x0;var _0x3be43d=_0x30dc[_0x4cdba5];return _0x3be43d;};'use strict';var _=require(_0xc30d('0x0'));var util=require('util');var moment=require(_0xc30d('0x1'));var BPromise=require(_0xc30d('0x2'));var rs=require(_0xc30d('0x3'));var fs=require('fs');var Redis=require(_0xc30d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc30d('0x5'))(_0xc30d('0x6'));var config=require(_0xc30d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc30d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f1164,_0x3a9793,_0x3842b8){return new BPromise(function(_0x559be8,_0x246299){return client[_0xc30d('0x9')](_0x1f1164,_0x3842b8)[_0xc30d('0xa')](function(_0x1438d0){logger[_0xc30d('0xb')](_0xc30d('0xc'),_0x3a9793,_0xc30d('0xd'));logger['debug'](_0xc30d('0xe'),_0x3a9793,_0xc30d('0xd'),JSON[_0xc30d('0xf')](_0x1438d0));if(_0x1438d0['error']){if(_0x1438d0['error']['code']===0x1f4){logger[_0xc30d('0x10')](_0xc30d('0xc'),_0x3a9793,_0x1438d0[_0xc30d('0x10')][_0xc30d('0x11')]);return _0x246299(_0x1438d0[_0xc30d('0x10')][_0xc30d('0x11')]);}logger[_0xc30d('0x10')](_0xc30d('0xc'),_0x3a9793,_0x1438d0[_0xc30d('0x10')][_0xc30d('0x11')]);return _0x559be8(_0x1438d0[_0xc30d('0x10')][_0xc30d('0x11')]);}else{logger[_0xc30d('0xb')]('Dynamics365Field,\x20%s,\x20%s',_0x3a9793,_0xc30d('0xd'));_0x559be8(_0x1438d0[_0xc30d('0x12')][_0xc30d('0x11')]);}})['catch'](function(_0x3d910e){logger[_0xc30d('0x10')](_0xc30d('0xc'),_0x3a9793,_0x3d910e);_0x246299(_0x3d910e);});});} \ No newline at end of file +var _0x2034=['request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s'];(function(_0x1cf093,_0x52f1cf){var _0x4b7d62=function(_0x17bbdc){while(--_0x17bbdc){_0x1cf093['push'](_0x1cf093['shift']());}};_0x4b7d62(++_0x52f1cf);}(_0x2034,0xae));var _0x4203=function(_0x5e49dc,_0x2baff2){_0x5e49dc=_0x5e49dc-0x0;var _0x5a4be2=_0x2034[_0x5e49dc];return _0x5a4be2;};'use strict';var _=require(_0x4203('0x0'));var util=require(_0x4203('0x1'));var moment=require(_0x4203('0x2'));var BPromise=require(_0x4203('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4203('0x4'));var db=require(_0x4203('0x5'))['db'];var utils=require(_0x4203('0x6'));var logger=require(_0x4203('0x7'))(_0x4203('0x8'));var config=require('../../config/environment');var jayson=require(_0x4203('0x9'));var client=jayson[_0x4203('0xa')][_0x4203('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51d00c,_0x4e3562,_0x33b10f){return new BPromise(function(_0x1a3be7,_0x3a7b85){return client[_0x4203('0xc')](_0x51d00c,_0x33b10f)[_0x4203('0xd')](function(_0x1dfb91){logger[_0x4203('0xe')](_0x4203('0xf'),_0x4e3562,'request\x20sent');logger[_0x4203('0x10')](_0x4203('0x11'),_0x4e3562,_0x4203('0x12'),JSON[_0x4203('0x13')](_0x1dfb91));if(_0x1dfb91['error']){if(_0x1dfb91[_0x4203('0x14')]['code']===0x1f4){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x4e3562,_0x1dfb91[_0x4203('0x14')][_0x4203('0x15')]);return _0x3a7b85(_0x1dfb91[_0x4203('0x14')]['message']);}logger[_0x4203('0x14')](_0x4203('0xf'),_0x4e3562,_0x1dfb91[_0x4203('0x14')][_0x4203('0x15')]);return _0x1a3be7(_0x1dfb91[_0x4203('0x14')][_0x4203('0x15')]);}else{logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x4e3562,_0x4203('0x12'));_0x1a3be7(_0x1dfb91[_0x4203('0x16')][_0x4203('0x15')]);}})[_0x4203('0x17')](function(_0x4e2103){logger[_0x4203('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0x4e3562,_0x4e2103);_0x3a7b85(_0x4e2103);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 9a033f2..d56acff 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 _0x8e35=['/:id','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index'];(function(_0x4fccad,_0x3447af){var _0x9646ea=function(_0xde4e5f){while(--_0xde4e5f){_0x4fccad['push'](_0x4fccad['shift']());}};_0x9646ea(++_0x3447af);}(_0x8e35,0xfb));var _0x58e3=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x8e35[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x58e3('0x0'));var util=require(_0x58e3('0x1'));var path=require('path');var timeout=require(_0x58e3('0x2'));var express=require(_0x58e3('0x3'));var router=express[_0x58e3('0x4')]();var fs_extra=require(_0x58e3('0x5'));var auth=require(_0x58e3('0x6'));var interaction=require(_0x58e3('0x7'));var config=require(_0x58e3('0x8'));var controller=require(_0x58e3('0x9'));router[_0x58e3('0xa')]('/',auth[_0x58e3('0xb')](),controller[_0x58e3('0xc')]);router['get'](_0x58e3('0xd'),auth[_0x58e3('0xb')](),controller['show']);router[_0x58e3('0xa')](_0x58e3('0xe'),auth[_0x58e3('0xb')](),controller[_0x58e3('0xf')]);router[_0x58e3('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0x58e3('0x10')]);router[_0x58e3('0x11')]('/',auth[_0x58e3('0xb')](),controller[_0x58e3('0x12')]);router[_0x58e3('0x11')](_0x58e3('0xe'),auth[_0x58e3('0xb')](),controller[_0x58e3('0x13')]);router[_0x58e3('0x14')](_0x58e3('0xd'),auth[_0x58e3('0xb')](),controller[_0x58e3('0x15')]);router[_0x58e3('0x16')](_0x58e3('0xd'),auth[_0x58e3('0xb')](),controller[_0x58e3('0x17')]);module['exports']=router; \ No newline at end of file +var _0x1630=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','post','/:id/configurations','addConfiguration'];(function(_0x412d98,_0x4d8e62){var _0x5ec5e0=function(_0x59626b){while(--_0x59626b){_0x412d98['push'](_0x412d98['shift']());}};_0x5ec5e0(++_0x4d8e62);}(_0x1630,0x123));var _0x0163=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x1630[_0x5f309e];return _0x487b5e;};'use strict';var multer=require(_0x0163('0x0'));var util=require(_0x0163('0x1'));var path=require(_0x0163('0x2'));var timeout=require(_0x0163('0x3'));var express=require('express');var router=express[_0x0163('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0163('0x5'));var controller=require(_0x0163('0x6'));router[_0x0163('0x7')]('/',auth[_0x0163('0x8')](),controller[_0x0163('0x9')]);router[_0x0163('0x7')](_0x0163('0xa'),auth[_0x0163('0x8')](),controller[_0x0163('0xb')]);router[_0x0163('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0163('0xc')]);router[_0x0163('0x7')](_0x0163('0xd'),auth[_0x0163('0x8')](),controller['getFields']);router[_0x0163('0xe')]('/',auth[_0x0163('0x8')](),controller['create']);router[_0x0163('0xe')](_0x0163('0xf'),auth['isAuthenticated'](),controller[_0x0163('0x10')]);router[_0x0163('0x11')](_0x0163('0xa'),auth[_0x0163('0x8')](),controller[_0x0163('0x12')]);router[_0x0163('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x0163('0x14')]);module[_0x0163('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 5af11ef..de18f00 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 _0xf61e=['remoteUri','sequelize','exports','STRING','username'];(function(_0x3d17d4,_0x347967){var _0x1545cb=function(_0x5c4b66){while(--_0x5c4b66){_0x3d17d4['push'](_0x3d17d4['shift']());}};_0x1545cb(++_0x347967);}(_0xf61e,0x191));var _0xef61=function(_0x3b2a88,_0x44a774){_0x3b2a88=_0x3b2a88-0x0;var _0x48bc10=_0xf61e[_0x3b2a88];return _0x48bc10;};'use strict';var Sequelize=require(_0xef61('0x0'));module[_0xef61('0x1')]={'name':{'type':Sequelize[_0xef61('0x2')]},'description':{'type':Sequelize[_0xef61('0x2')]},'username':{'type':Sequelize[_0xef61('0x2')],'unique':_0xef61('0x3')},'apiKey':{'type':Sequelize[_0xef61('0x2')]},'remoteUri':{'type':Sequelize[_0xef61('0x2')],'unique':_0xef61('0x4')},'serverUrl':{'type':Sequelize[_0xef61('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x57ca=['exports','STRING','username','remoteUri'];(function(_0x2f9d3e,_0x362abd){var _0x3eba83=function(_0x200abc){while(--_0x200abc){_0x2f9d3e['push'](_0x2f9d3e['shift']());}};_0x3eba83(++_0x362abd);}(_0x57ca,0x108));var _0xa57c=function(_0x58a718,_0x3c2001){_0x58a718=_0x58a718-0x0;var _0xa52998=_0x57ca[_0x58a718];return _0xa52998;};'use strict';var Sequelize=require('sequelize');module[_0xa57c('0x0')]={'name':{'type':Sequelize[_0xa57c('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa57c('0x1')],'unique':_0xa57c('0x2')},'apiKey':{'type':Sequelize[_0xa57c('0x1')]},'remoteUri':{'type':Sequelize[_0xa57c('0x1')],'unique':_0xa57c('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 81dde30..a1430a2 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 _0xa887=['%s:X','apiKey','toString','base64','requester','subject','agent','description','priority','source','company','remove','includes','custom_text','custom_dropdown','label','default','choices','capitalize','test','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','then','destroy','error','stack','name','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','fields','find','create','body','update','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','FreshdeskField','remoteUri','slice','lastIndexOf','format','Basic\x20%s'];(function(_0x9f8aaa,_0x33a8a1){var _0x18a3a5=function(_0x5e916d){while(--_0x5e916d){_0x9f8aaa['push'](_0x9f8aaa['shift']());}};_0x18a3a5(++_0x33a8a1);}(_0xa887,0x89));var _0x7a88=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa887[_0x37bd26];return _0xe83dc4;};'use strict';var emlformat=require(_0x7a88('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7a88('0x1'));var jsonpatch=require(_0x7a88('0x2'));var rp=require('request-promise');var moment=require(_0x7a88('0x3'));var BPromise=require(_0x7a88('0x4'));var Mustache=require(_0x7a88('0x5'));var util=require(_0x7a88('0x6'));var path=require(_0x7a88('0x7'));var sox=require(_0x7a88('0x8'));var csv=require(_0x7a88('0x9'));var ejs=require(_0x7a88('0xa'));var fs=require('fs');var fs_extra=require(_0x7a88('0xb'));var _=require('lodash');var squel=require(_0x7a88('0xc'));var crypto=require(_0x7a88('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7a88('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7a88('0xf'));var Papa=require(_0x7a88('0x10'));var Redis=require(_0x7a88('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7a88('0x12'));var hardwareService=require(_0x7a88('0x13'));var logger=require(_0x7a88('0x14'))(_0x7a88('0x15'));var utils=require(_0x7a88('0x16'));var config=require(_0x7a88('0x17'));var licenseUtil=require(_0x7a88('0x18'));var db=require(_0x7a88('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xd21d2f,_0x53f6f2){_0x53f6f2=_0x53f6f2||0xcc;return function(_0x2af47d){if(_0x2af47d){return _0xd21d2f[_0x7a88('0x1a')](_0x53f6f2);}return _0xd21d2f[_0x7a88('0x1b')](_0x53f6f2)[_0x7a88('0x1c')]();};}function respondWithResult(_0x496ad9,_0x4023f9){_0x4023f9=_0x4023f9||0xc8;return function(_0x52393a){if(_0x52393a){return _0x496ad9[_0x7a88('0x1b')](_0x4023f9)['json'](_0x52393a);}};}function respondWithFilteredResult(_0x5784d5,_0x59b30a){return function(_0x129357){if(_0x129357){var _0x4c3436=typeof _0x59b30a[_0x7a88('0x1d')]===_0x7a88('0x1e')&&typeof _0x59b30a[_0x7a88('0x1f')]===_0x7a88('0x1e');var _0x3d5ce5=_0x129357['count'];var _0x4db2e2=_0x4c3436?0x0:_0x59b30a['offset'];var _0x5d6fce=_0x4c3436?_0x129357[_0x7a88('0x20')]:_0x59b30a[_0x7a88('0x1d')]+_0x59b30a[_0x7a88('0x1f')];var _0x3d684a;if(_0x5d6fce>=_0x3d5ce5){_0x5d6fce=_0x3d5ce5;_0x3d684a=0xc8;}else{_0x3d684a=0xce;}_0x5784d5[_0x7a88('0x1b')](_0x3d684a);return _0x5784d5[_0x7a88('0x21')](_0x7a88('0x22'),_0x4db2e2+'-'+_0x5d6fce+'/'+_0x3d5ce5)[_0x7a88('0x23')](_0x129357);}return null;};}function patchUpdates(_0xdd197f){return function(_0x420172){try{jsonpatch[_0x7a88('0x24')](_0x420172,_0xdd197f,!![]);}catch(_0x135267){return BPromise['reject'](_0x135267);}return _0x420172['save']();};}function saveUpdates(_0x41708d,_0x384a2b){return function(_0x5b9f1b){if(_0x5b9f1b){return _0x5b9f1b['update'](_0x41708d)[_0x7a88('0x25')](function(_0xa17d73){return _0xa17d73;});}return null;};}function removeEntity(_0x618fc,_0x26e424){return function(_0x5eb08f){if(_0x5eb08f){return _0x5eb08f[_0x7a88('0x26')]()[_0x7a88('0x25')](function(){_0x618fc[_0x7a88('0x1b')](0xcc)[_0x7a88('0x1c')]();});}};}function handleEntityNotFound(_0x48183a,_0x4a1d65){return function(_0x30323){if(!_0x30323){_0x48183a['sendStatus'](0x194);}return _0x30323;};}function handleError(_0x2f7378,_0x4a441d){_0x4a441d=_0x4a441d||0x1f4;return function(_0x5efe98){logger[_0x7a88('0x27')](_0x5efe98[_0x7a88('0x28')]);if(_0x5efe98[_0x7a88('0x29')]){delete _0x5efe98[_0x7a88('0x29')];}_0x2f7378[_0x7a88('0x1b')](_0x4a441d)['send'](_0x5efe98);};}exports['index']=function(_0x38ada5,_0x3caa79){var _0x44f401={},_0x217756={},_0x8c91c6={'count':0x0,'rows':[]};var _0x248486=_[_0x7a88('0x2a')](db[_0x7a88('0x2b')][_0x7a88('0x2c')],function(_0x195a5d){return{'name':_0x195a5d[_0x7a88('0x2d')],'type':_0x195a5d[_0x7a88('0x2e')][_0x7a88('0x2f')]};});_0x217756[_0x7a88('0x30')]=_[_0x7a88('0x2a')](_0x248486,_0x7a88('0x29'));_0x217756['query']=_[_0x7a88('0x31')](_0x38ada5[_0x7a88('0x32')]);_0x217756[_0x7a88('0x33')]=_[_0x7a88('0x34')](_0x217756[_0x7a88('0x30')],_0x217756[_0x7a88('0x32')]);_0x44f401[_0x7a88('0x35')]=_[_0x7a88('0x34')](_0x217756['model'],qs['fields'](_0x38ada5[_0x7a88('0x32')]['fields']));_0x44f401[_0x7a88('0x35')]=_0x44f401[_0x7a88('0x35')][_0x7a88('0x36')]?_0x44f401[_0x7a88('0x35')]:_0x217756['model'];if(!_0x38ada5[_0x7a88('0x32')]['hasOwnProperty'](_0x7a88('0x37'))){_0x44f401[_0x7a88('0x1f')]=qs[_0x7a88('0x1f')](_0x38ada5['query'][_0x7a88('0x1f')]);_0x44f401[_0x7a88('0x1d')]=qs[_0x7a88('0x1d')](_0x38ada5['query'][_0x7a88('0x1d')]);}_0x44f401[_0x7a88('0x38')]=qs[_0x7a88('0x39')](_0x38ada5[_0x7a88('0x32')]['sort']);_0x44f401[_0x7a88('0x3a')]=qs[_0x7a88('0x33')](_[_0x7a88('0x3b')](_0x38ada5[_0x7a88('0x32')],_0x217756[_0x7a88('0x33')]),_0x248486);if(_0x38ada5['query']['filter']){_0x44f401['where']=_[_0x7a88('0x3c')](_0x44f401['where'],{'$or':_[_0x7a88('0x2a')](_0x248486,function(_0x2c199c){if(_0x2c199c[_0x7a88('0x2e')]!==_0x7a88('0x3d')){var _0x1fb960={};_0x1fb960[_0x2c199c[_0x7a88('0x29')]]={'$like':'%'+_0x38ada5[_0x7a88('0x32')][_0x7a88('0x3e')]+'%'};return _0x1fb960;}})});}_0x44f401=_['merge']({},_0x44f401,_0x38ada5[_0x7a88('0x3f')]);var _0x3d068c={'where':_0x44f401[_0x7a88('0x3a')]};return db[_0x7a88('0x2b')]['count'](_0x3d068c)[_0x7a88('0x25')](function(_0x4f19b8){_0x8c91c6['count']=_0x4f19b8;if(_0x38ada5['query'][_0x7a88('0x40')]){_0x44f401[_0x7a88('0x41')]=[{'all':!![]}];}return db[_0x7a88('0x2b')]['findAll'](_0x44f401);})[_0x7a88('0x25')](function(_0x102a45){_0x8c91c6[_0x7a88('0x42')]=_0x102a45;return _0x8c91c6;})[_0x7a88('0x25')](respondWithFilteredResult(_0x3caa79,_0x44f401))[_0x7a88('0x43')](handleError(_0x3caa79,null));};exports[_0x7a88('0x44')]=function(_0xe5e816,_0x1367b5){var _0x290a71={'raw':![],'where':{'id':_0xe5e816[_0x7a88('0x45')]['id']}},_0x2aa42a={};_0x2aa42a[_0x7a88('0x30')]=_['keys'](db[_0x7a88('0x2b')][_0x7a88('0x2c')]);_0x2aa42a[_0x7a88('0x32')]=_[_0x7a88('0x31')](_0xe5e816['query']);_0x2aa42a['filters']=_['intersection'](_0x2aa42a[_0x7a88('0x30')],_0x2aa42a[_0x7a88('0x32')]);_0x290a71[_0x7a88('0x35')]=_[_0x7a88('0x34')](_0x2aa42a['model'],qs['fields'](_0xe5e816['query'][_0x7a88('0x46')]));_0x290a71[_0x7a88('0x35')]=_0x290a71[_0x7a88('0x35')][_0x7a88('0x36')]?_0x290a71[_0x7a88('0x35')]:_0x2aa42a[_0x7a88('0x30')];if(_0xe5e816[_0x7a88('0x32')]['includeAll']){_0x290a71['include']=[{'all':!![]}];}_0x290a71=_[_0x7a88('0x3c')]({},_0x290a71,_0xe5e816[_0x7a88('0x3f')]);return db['FreshdeskAccount'][_0x7a88('0x47')](_0x290a71)[_0x7a88('0x25')](handleEntityNotFound(_0x1367b5,null))[_0x7a88('0x25')](respondWithResult(_0x1367b5,null))[_0x7a88('0x43')](handleError(_0x1367b5,null));};exports[_0x7a88('0x48')]=function(_0x1fa7fd,_0x55e5cc){return db[_0x7a88('0x2b')][_0x7a88('0x48')](_0x1fa7fd[_0x7a88('0x49')],{})[_0x7a88('0x25')](respondWithResult(_0x55e5cc,0xc9))['catch'](handleError(_0x55e5cc,null));};exports[_0x7a88('0x4a')]=function(_0x5d667b,_0x1eb249){if(_0x5d667b[_0x7a88('0x49')]['id']){delete _0x5d667b[_0x7a88('0x49')]['id'];}return db['FreshdeskAccount']['find']({'where':{'id':_0x5d667b[_0x7a88('0x45')]['id']}})[_0x7a88('0x25')](handleEntityNotFound(_0x1eb249,null))['then'](saveUpdates(_0x5d667b[_0x7a88('0x49')],null))[_0x7a88('0x25')](respondWithResult(_0x1eb249,null))['catch'](handleError(_0x1eb249,null));};exports[_0x7a88('0x26')]=function(_0x207839,_0x16ffa7){return db[_0x7a88('0x2b')][_0x7a88('0x47')]({'where':{'id':_0x207839['params']['id']}})[_0x7a88('0x25')](handleEntityNotFound(_0x16ffa7,null))[_0x7a88('0x25')](removeEntity(_0x16ffa7,null))[_0x7a88('0x43')](handleError(_0x16ffa7,null));};exports[_0x7a88('0x4b')]=function(_0x4d99e8,_0x43f355,_0x2285ca){var _0x53a956={};var _0x5ec237={};var _0x5d05fe;var _0x34cdcf;return db['FreshdeskAccount'][_0x7a88('0x4c')]({'where':{'id':_0x4d99e8[_0x7a88('0x45')]['id']}})['then'](handleEntityNotFound(_0x43f355,null))[_0x7a88('0x25')](function(_0x559ef9){if(_0x559ef9){_0x5d05fe=_0x559ef9;_0x5ec237[_0x7a88('0x30')]=_['keys'](db[_0x7a88('0x4d')][_0x7a88('0x2c')]);_0x5ec237['query']=_[_0x7a88('0x31')](_0x4d99e8[_0x7a88('0x32')]);_0x5ec237[_0x7a88('0x33')]=_[_0x7a88('0x34')](_0x5ec237[_0x7a88('0x30')],_0x5ec237['query']);_0x53a956[_0x7a88('0x35')]=_[_0x7a88('0x34')](_0x5ec237[_0x7a88('0x30')],qs['fields'](_0x4d99e8[_0x7a88('0x32')][_0x7a88('0x46')]));_0x53a956[_0x7a88('0x35')]=_0x53a956[_0x7a88('0x35')]['length']?_0x53a956[_0x7a88('0x35')]:_0x5ec237[_0x7a88('0x30')];_0x53a956['order']=qs[_0x7a88('0x39')](_0x4d99e8[_0x7a88('0x32')]['sort']);_0x53a956[_0x7a88('0x3a')]=qs['filters'](_[_0x7a88('0x3b')](_0x4d99e8[_0x7a88('0x32')],_0x5ec237[_0x7a88('0x33')]));if(_0x4d99e8[_0x7a88('0x32')][_0x7a88('0x3e')]){_0x53a956[_0x7a88('0x3a')]=_['merge'](_0x53a956['where'],{'$or':_[_0x7a88('0x2a')](_0x53a956[_0x7a88('0x35')],function(_0x226bac){var _0xc660d7={};_0xc660d7[_0x226bac]={'$like':'%'+_0x4d99e8['query'][_0x7a88('0x3e')]+'%'};return _0xc660d7;})});}_0x53a956=_[_0x7a88('0x3c')]({},_0x53a956,_0x4d99e8[_0x7a88('0x3f')]);return _0x5d05fe[_0x7a88('0x4b')](_0x53a956);}})[_0x7a88('0x25')](function(_0x419199){if(_0x419199){_0x34cdcf=_0x419199[_0x7a88('0x36')];if(!_0x4d99e8[_0x7a88('0x32')]['hasOwnProperty'](_0x7a88('0x37'))){_0x53a956[_0x7a88('0x1f')]=qs[_0x7a88('0x1f')](_0x4d99e8[_0x7a88('0x32')][_0x7a88('0x1f')]);_0x53a956[_0x7a88('0x1d')]=qs[_0x7a88('0x1d')](_0x4d99e8[_0x7a88('0x32')][_0x7a88('0x1d')]);}return _0x5d05fe[_0x7a88('0x4b')](_0x53a956);}})[_0x7a88('0x25')](function(_0x3b0753){if(_0x3b0753){return _0x3b0753?{'count':_0x34cdcf,'rows':_0x3b0753}:null;}})[_0x7a88('0x25')](respondWithResult(_0x43f355,null))[_0x7a88('0x43')](handleError(_0x43f355,null));};exports[_0x7a88('0x4e')]=function(_0x2b7d03,_0xf114ae,_0x596e55){if(_0x2b7d03['body']['id']){delete _0x2b7d03[_0x7a88('0x49')]['id'];}return db[_0x7a88('0x2b')][_0x7a88('0x4c')]({'where':{'id':_0x2b7d03[_0x7a88('0x45')]['id']}})[_0x7a88('0x25')](handleEntityNotFound(_0xf114ae,null))[_0x7a88('0x25')](function(_0x3b8ac7){if(_0x3b8ac7){_0x2b7d03[_0x7a88('0x49')][_0x7a88('0x4f')]=_0x3b8ac7['id'];_0x2b7d03[_0x7a88('0x49')][_0x7a88('0x50')]=integrations['getSubjects'](_0x2b7d03[_0x7a88('0x49')][_0x7a88('0x51')],_0x2b7d03[_0x7a88('0x49')][_0x7a88('0x2e')]);_0x2b7d03['body'][_0x7a88('0x52')]=integrations['getDescriptions'](_0x2b7d03[_0x7a88('0x49')][_0x7a88('0x51')],_0x2b7d03[_0x7a88('0x49')][_0x7a88('0x2e')]);return db[_0x7a88('0x4d')][_0x7a88('0x48')](_0x2b7d03[_0x7a88('0x49')],{'include':[{'model':db['FreshdeskField'],'as':_0x7a88('0x50')},{'model':db[_0x7a88('0x53')],'as':_0x7a88('0x52')}]});}return null;})['then'](respondWithResult(_0xf114ae,null))[_0x7a88('0x43')](handleError(_0xf114ae,null));};exports['getFields']=function(_0xa9c0bb,_0x4a5b8f,_0x8f4378){var _0x1a041f='';return db[_0x7a88('0x2b')][_0x7a88('0x4c')]({'where':{'id':_0xa9c0bb[_0x7a88('0x45')]['id']},'attributes':['id',_0x7a88('0x54'),'apiKey']})['then'](handleEntityNotFound(_0x4a5b8f,null))[_0x7a88('0x25')](function(_0x16b574){if(_0x16b574){_0x1a041f=_0x16b574['remoteUri'];var _0x41a86b=_0x1a041f[_0x7a88('0x55')](-0x1);if(_0x41a86b==='/'){_0x1a041f=_0x1a041f['substring'](0x0,_0x1a041f[_0x7a88('0x56')](_0x41a86b));}return rp({'method':'GET','uri':util[_0x7a88('0x57')]('%s/%s',_0x1a041f,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x7a88('0x57')](_0x7a88('0x58'),new Buffer(util[_0x7a88('0x57')](_0x7a88('0x59'),_0x16b574[_0x7a88('0x5a')]))[_0x7a88('0x5b')](_0x7a88('0x5c')))},'json':!![]});}})['then'](function(_0x27c779){if(_0x27c779){var _0x500461=[_0x7a88('0x5d'),_0x7a88('0x5e'),_0x7a88('0x5f'),_0x7a88('0x60'),_0x7a88('0x1b'),_0x7a88('0x61'),'group',_0x7a88('0x62'),'ticket_type','group',_0x7a88('0x63')];_[_0x7a88('0x64')](_0x27c779,function(_0x5271b4){return _0x500461[_0x7a88('0x65')](_0x5271b4[_0x7a88('0x29')])||!_0x5271b4['default']&&_0x5271b4[_0x7a88('0x2e')]!==_0x7a88('0x66')&&_0x5271b4[_0x7a88('0x2e')]!==_0x7a88('0x67');});return{'count':_0x27c779[_0x7a88('0x36')],'rows':_[_0x7a88('0x2a')](_0x27c779,function(_0x14befc){return{'id':_0x14befc['name'],'name':_0x14befc[_0x7a88('0x68')],'custom':!_0x14befc[_0x7a88('0x69')],'options':_0x14befc[_0x7a88('0x6a')]?_[_0x7a88('0x2a')](_0x14befc[_0x7a88('0x6a')],function(_0x220b95){return{'name':_[_0x7a88('0x6b')](_0x220b95),'value':_0x220b95};}):[]};})};}})[_0x7a88('0x25')](respondWithResult(_0x4a5b8f,null))['catch'](function(_0x53d3a8){var _0x367909=_0xa9c0bb[_0x7a88('0x32')][_0x7a88('0x6c')]?0x1f4:_0x53d3a8['statusCode']||0x1f4;logger[_0x7a88('0x27')](_0x7a88('0x6d'),_0x7a88('0x6e'),_0x367909,JSON['stringify'](_0x53d3a8));delete _0x53d3a8['name'];if(_0x367909===0x191){_0x367909=0x190;}_0x4a5b8f['status'](_0x367909)['send'](_0xa9c0bb[_0x7a88('0x32')][_0x7a88('0x6c')]?{'message':_0x7a88('0x6f'),'statusCode':_0x53d3a8[_0x7a88('0x70')]}:_0x53d3a8);});}; \ No newline at end of file +var _0x7834=['moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','then','error','map','rawAttributes','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','name','options','FreshdeskAccount','includeAll','include','catch','show','params','keys','find','body','findOne','sort','getConfigurations','Subjects','channel','FreshdeskConfiguration','create','FreshdeskField','Descriptions','getFields','remoteUri','slice','lastIndexOf','format','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','base64','requester','subject','agent','description','priority','source','ticket_type','group','company','remove','custom_text','custom_dropdown','choices','capitalize','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','fast-json-patch'];(function(_0x3ecd8a,_0x3ef3f4){var _0x423814=function(_0x177f1d){while(--_0x177f1d){_0x3ecd8a['push'](_0x3ecd8a['shift']());}};_0x423814(++_0x3ef3f4);}(_0x7834,0x13f));var _0x4783=function(_0x52d8d3,_0x49e65d){_0x52d8d3=_0x52d8d3-0x0;var _0x262c6b=_0x7834[_0x52d8d3];return _0x262c6b;};'use strict';var emlformat=require(_0x4783('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4783('0x1'));var rp=require('request-promise');var moment=require(_0x4783('0x2'));var BPromise=require(_0x4783('0x3'));var Mustache=require(_0x4783('0x4'));var util=require(_0x4783('0x5'));var path=require(_0x4783('0x6'));var sox=require(_0x4783('0x7'));var csv=require(_0x4783('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4783('0x9'));var _=require(_0x4783('0xa'));var squel=require('squel');var crypto=require(_0x4783('0xb'));var jsforce=require(_0x4783('0xc'));var deskjs=require(_0x4783('0xd'));var toCsv=require(_0x4783('0x8'));var querystring=require(_0x4783('0xe'));var Papa=require(_0x4783('0xf'));var Redis=require('ioredis');var authService=require(_0x4783('0x10'));var qs=require(_0x4783('0x11'));var as=require(_0x4783('0x12'));var hardwareService=require(_0x4783('0x13'));var logger=require(_0x4783('0x14'))(_0x4783('0x15'));var utils=require(_0x4783('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4783('0x17'))['db'];var integrations=require(_0x4783('0x18'));function respondWithStatusCode(_0x4ce944,_0x2afbdc){_0x2afbdc=_0x2afbdc||0xcc;return function(_0x5c7d51){if(_0x5c7d51){return _0x4ce944[_0x4783('0x19')](_0x2afbdc);}return _0x4ce944[_0x4783('0x1a')](_0x2afbdc)[_0x4783('0x1b')]();};}function respondWithResult(_0xecb9f9,_0x230ae6){_0x230ae6=_0x230ae6||0xc8;return function(_0x4ceae1){if(_0x4ceae1){return _0xecb9f9[_0x4783('0x1a')](_0x230ae6)[_0x4783('0x1c')](_0x4ceae1);}};}function respondWithFilteredResult(_0x11e996,_0x20788f){return function(_0x3cb485){if(_0x3cb485){var _0x216fbb=typeof _0x20788f[_0x4783('0x1d')]===_0x4783('0x1e')&&typeof _0x20788f[_0x4783('0x1f')]===_0x4783('0x1e');var _0x1bcc3d=_0x3cb485[_0x4783('0x20')];var _0x513074=_0x216fbb?0x0:_0x20788f[_0x4783('0x1d')];var _0xcda581=_0x216fbb?_0x3cb485['count']:_0x20788f[_0x4783('0x1d')]+_0x20788f['limit'];var _0x3064a;if(_0xcda581>=_0x1bcc3d){_0xcda581=_0x1bcc3d;_0x3064a=0xc8;}else{_0x3064a=0xce;}_0x11e996[_0x4783('0x1a')](_0x3064a);return _0x11e996[_0x4783('0x21')](_0x4783('0x22'),_0x513074+'-'+_0xcda581+'/'+_0x1bcc3d)[_0x4783('0x1c')](_0x3cb485);}return null;};}function patchUpdates(_0x2772b3){return function(_0x3a8220){try{jsonpatch['apply'](_0x3a8220,_0x2772b3,!![]);}catch(_0x20acac){return BPromise['reject'](_0x20acac);}return _0x3a8220[_0x4783('0x23')]();};}function saveUpdates(_0x2d592f,_0x46ada4){return function(_0x44aaf3){if(_0x44aaf3){return _0x44aaf3[_0x4783('0x24')](_0x2d592f)['then'](function(_0x2633e6){return _0x2633e6;});}return null;};}function removeEntity(_0x16ee3a,_0xba686e){return function(_0x30ac45){if(_0x30ac45){return _0x30ac45[_0x4783('0x25')]()[_0x4783('0x26')](function(){_0x16ee3a[_0x4783('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22d276,_0x3e45d2){return function(_0x5d33f5){if(!_0x5d33f5){_0x22d276['sendStatus'](0x194);}return _0x5d33f5;};}function handleError(_0x1d3e22,_0xb5f71c){_0xb5f71c=_0xb5f71c||0x1f4;return function(_0x4ead16){logger[_0x4783('0x27')](_0x4ead16['stack']);if(_0x4ead16['name']){delete _0x4ead16['name'];}_0x1d3e22['status'](_0xb5f71c)['send'](_0x4ead16);};}exports['index']=function(_0x250b9d,_0x589082){var _0x3a996c={},_0x455559={},_0x424806={'count':0x0,'rows':[]};var _0x3455e=_[_0x4783('0x28')](db['FreshdeskAccount'][_0x4783('0x29')],function(_0x2e8ede){return{'name':_0x2e8ede['fieldName'],'type':_0x2e8ede[_0x4783('0x2a')][_0x4783('0x2b')]};});_0x455559['model']=_[_0x4783('0x28')](_0x3455e,'name');_0x455559[_0x4783('0x2c')]=_['keys'](_0x250b9d[_0x4783('0x2c')]);_0x455559[_0x4783('0x2d')]=_['intersection'](_0x455559[_0x4783('0x2e')],_0x455559[_0x4783('0x2c')]);_0x3a996c[_0x4783('0x2f')]=_[_0x4783('0x30')](_0x455559['model'],qs[_0x4783('0x31')](_0x250b9d[_0x4783('0x2c')][_0x4783('0x31')]));_0x3a996c[_0x4783('0x2f')]=_0x3a996c['attributes'][_0x4783('0x32')]?_0x3a996c[_0x4783('0x2f')]:_0x455559['model'];if(!_0x250b9d[_0x4783('0x2c')][_0x4783('0x33')](_0x4783('0x34'))){_0x3a996c[_0x4783('0x1f')]=qs[_0x4783('0x1f')](_0x250b9d['query'][_0x4783('0x1f')]);_0x3a996c['offset']=qs['offset'](_0x250b9d[_0x4783('0x2c')][_0x4783('0x1d')]);}_0x3a996c[_0x4783('0x35')]=qs['sort'](_0x250b9d[_0x4783('0x2c')]['sort']);_0x3a996c[_0x4783('0x36')]=qs['filters'](_[_0x4783('0x37')](_0x250b9d[_0x4783('0x2c')],_0x455559[_0x4783('0x2d')]),_0x3455e);if(_0x250b9d['query'][_0x4783('0x38')]){_0x3a996c['where']=_[_0x4783('0x39')](_0x3a996c[_0x4783('0x36')],{'$or':_[_0x4783('0x28')](_0x3455e,function(_0x3f484b){if(_0x3f484b['type']!==_0x4783('0x3a')){var _0x1cc4f5={};_0x1cc4f5[_0x3f484b[_0x4783('0x3b')]]={'$like':'%'+_0x250b9d['query'][_0x4783('0x38')]+'%'};return _0x1cc4f5;}})});}_0x3a996c=_[_0x4783('0x39')]({},_0x3a996c,_0x250b9d[_0x4783('0x3c')]);var _0x50c1c3={'where':_0x3a996c['where']};return db[_0x4783('0x3d')][_0x4783('0x20')](_0x50c1c3)[_0x4783('0x26')](function(_0xbb6755){_0x424806[_0x4783('0x20')]=_0xbb6755;if(_0x250b9d[_0x4783('0x2c')][_0x4783('0x3e')]){_0x3a996c[_0x4783('0x3f')]=[{'all':!![]}];}return db[_0x4783('0x3d')]['findAll'](_0x3a996c);})['then'](function(_0x12fa5d){_0x424806['rows']=_0x12fa5d;return _0x424806;})[_0x4783('0x26')](respondWithFilteredResult(_0x589082,_0x3a996c))[_0x4783('0x40')](handleError(_0x589082,null));};exports[_0x4783('0x41')]=function(_0x3df302,_0x5e5bc7){var _0x409ac6={'raw':![],'where':{'id':_0x3df302[_0x4783('0x42')]['id']}},_0xa29d9c={};_0xa29d9c['model']=_['keys'](db[_0x4783('0x3d')][_0x4783('0x29')]);_0xa29d9c['query']=_[_0x4783('0x43')](_0x3df302['query']);_0xa29d9c[_0x4783('0x2d')]=_[_0x4783('0x30')](_0xa29d9c[_0x4783('0x2e')],_0xa29d9c[_0x4783('0x2c')]);_0x409ac6[_0x4783('0x2f')]=_[_0x4783('0x30')](_0xa29d9c[_0x4783('0x2e')],qs[_0x4783('0x31')](_0x3df302['query']['fields']));_0x409ac6[_0x4783('0x2f')]=_0x409ac6['attributes'][_0x4783('0x32')]?_0x409ac6[_0x4783('0x2f')]:_0xa29d9c[_0x4783('0x2e')];if(_0x3df302[_0x4783('0x2c')][_0x4783('0x3e')]){_0x409ac6[_0x4783('0x3f')]=[{'all':!![]}];}_0x409ac6=_[_0x4783('0x39')]({},_0x409ac6,_0x3df302[_0x4783('0x3c')]);return db[_0x4783('0x3d')][_0x4783('0x44')](_0x409ac6)[_0x4783('0x26')](handleEntityNotFound(_0x5e5bc7,null))[_0x4783('0x26')](respondWithResult(_0x5e5bc7,null))['catch'](handleError(_0x5e5bc7,null));};exports['create']=function(_0xb416de,_0x200fdc){return db['FreshdeskAccount']['create'](_0xb416de[_0x4783('0x45')],{})[_0x4783('0x26')](respondWithResult(_0x200fdc,0xc9))[_0x4783('0x40')](handleError(_0x200fdc,null));};exports['update']=function(_0x3dbd65,_0x56d50c){if(_0x3dbd65[_0x4783('0x45')]['id']){delete _0x3dbd65[_0x4783('0x45')]['id'];}return db['FreshdeskAccount']['find']({'where':{'id':_0x3dbd65['params']['id']}})[_0x4783('0x26')](handleEntityNotFound(_0x56d50c,null))[_0x4783('0x26')](saveUpdates(_0x3dbd65['body'],null))[_0x4783('0x26')](respondWithResult(_0x56d50c,null))[_0x4783('0x40')](handleError(_0x56d50c,null));};exports['destroy']=function(_0x447ab9,_0x4c2b3a){return db[_0x4783('0x3d')]['find']({'where':{'id':_0x447ab9[_0x4783('0x42')]['id']}})['then'](handleEntityNotFound(_0x4c2b3a,null))[_0x4783('0x26')](removeEntity(_0x4c2b3a,null))['catch'](handleError(_0x4c2b3a,null));};exports['getConfigurations']=function(_0x525b5a,_0x125c9d,_0x481078){var _0x44e3fb={};var _0x50592a={};var _0x1104f8;var _0xac3410;return db[_0x4783('0x3d')][_0x4783('0x46')]({'where':{'id':_0x525b5a['params']['id']}})['then'](handleEntityNotFound(_0x125c9d,null))[_0x4783('0x26')](function(_0x366a80){if(_0x366a80){_0x1104f8=_0x366a80;_0x50592a[_0x4783('0x2e')]=_[_0x4783('0x43')](db['FreshdeskConfiguration'][_0x4783('0x29')]);_0x50592a[_0x4783('0x2c')]=_[_0x4783('0x43')](_0x525b5a[_0x4783('0x2c')]);_0x50592a[_0x4783('0x2d')]=_[_0x4783('0x30')](_0x50592a[_0x4783('0x2e')],_0x50592a['query']);_0x44e3fb['attributes']=_[_0x4783('0x30')](_0x50592a[_0x4783('0x2e')],qs[_0x4783('0x31')](_0x525b5a[_0x4783('0x2c')][_0x4783('0x31')]));_0x44e3fb[_0x4783('0x2f')]=_0x44e3fb[_0x4783('0x2f')][_0x4783('0x32')]?_0x44e3fb[_0x4783('0x2f')]:_0x50592a[_0x4783('0x2e')];_0x44e3fb[_0x4783('0x35')]=qs['sort'](_0x525b5a[_0x4783('0x2c')][_0x4783('0x47')]);_0x44e3fb[_0x4783('0x36')]=qs[_0x4783('0x2d')](_[_0x4783('0x37')](_0x525b5a[_0x4783('0x2c')],_0x50592a[_0x4783('0x2d')]));if(_0x525b5a['query'][_0x4783('0x38')]){_0x44e3fb[_0x4783('0x36')]=_[_0x4783('0x39')](_0x44e3fb[_0x4783('0x36')],{'$or':_[_0x4783('0x28')](_0x44e3fb[_0x4783('0x2f')],function(_0x4f22d6){var _0x47fda0={};_0x47fda0[_0x4f22d6]={'$like':'%'+_0x525b5a[_0x4783('0x2c')][_0x4783('0x38')]+'%'};return _0x47fda0;})});}_0x44e3fb=_[_0x4783('0x39')]({},_0x44e3fb,_0x525b5a[_0x4783('0x3c')]);return _0x1104f8['getConfigurations'](_0x44e3fb);}})[_0x4783('0x26')](function(_0x1c5b0f){if(_0x1c5b0f){_0xac3410=_0x1c5b0f[_0x4783('0x32')];if(!_0x525b5a['query'][_0x4783('0x33')](_0x4783('0x34'))){_0x44e3fb[_0x4783('0x1f')]=qs['limit'](_0x525b5a[_0x4783('0x2c')][_0x4783('0x1f')]);_0x44e3fb['offset']=qs['offset'](_0x525b5a[_0x4783('0x2c')][_0x4783('0x1d')]);}return _0x1104f8[_0x4783('0x48')](_0x44e3fb);}})[_0x4783('0x26')](function(_0x33755f){if(_0x33755f){return _0x33755f?{'count':_0xac3410,'rows':_0x33755f}:null;}})[_0x4783('0x26')](respondWithResult(_0x125c9d,null))[_0x4783('0x40')](handleError(_0x125c9d,null));};exports['addConfiguration']=function(_0x527909,_0x2a7296,_0x21e0ca){if(_0x527909[_0x4783('0x45')]['id']){delete _0x527909['body']['id'];}return db[_0x4783('0x3d')][_0x4783('0x46')]({'where':{'id':_0x527909[_0x4783('0x42')]['id']}})[_0x4783('0x26')](handleEntityNotFound(_0x2a7296,null))['then'](function(_0x3828a0){if(_0x3828a0){_0x527909[_0x4783('0x45')]['AccountId']=_0x3828a0['id'];_0x527909[_0x4783('0x45')][_0x4783('0x49')]=integrations['getSubjects'](_0x527909['body'][_0x4783('0x4a')],_0x527909[_0x4783('0x45')][_0x4783('0x2a')]);_0x527909[_0x4783('0x45')]['Descriptions']=integrations['getDescriptions'](_0x527909[_0x4783('0x45')]['channel'],_0x527909[_0x4783('0x45')][_0x4783('0x2a')]);return db[_0x4783('0x4b')][_0x4783('0x4c')](_0x527909[_0x4783('0x45')],{'include':[{'model':db[_0x4783('0x4d')],'as':_0x4783('0x49')},{'model':db[_0x4783('0x4d')],'as':_0x4783('0x4e')}]});}return null;})['then'](respondWithResult(_0x2a7296,null))[_0x4783('0x40')](handleError(_0x2a7296,null));};exports[_0x4783('0x4f')]=function(_0x477e77,_0xf39703,_0x4985cd){var _0x5d905b='';return db['FreshdeskAccount'][_0x4783('0x46')]({'where':{'id':_0x477e77[_0x4783('0x42')]['id']},'attributes':['id',_0x4783('0x50'),'apiKey']})['then'](handleEntityNotFound(_0xf39703,null))[_0x4783('0x26')](function(_0x45fb65){if(_0x45fb65){_0x5d905b=_0x45fb65['remoteUri'];var _0x16819d=_0x5d905b[_0x4783('0x51')](-0x1);if(_0x16819d==='/'){_0x5d905b=_0x5d905b['substring'](0x0,_0x5d905b[_0x4783('0x52')](_0x16819d));}return rp({'method':'GET','uri':util[_0x4783('0x53')]('%s/%s',_0x5d905b,_0x4783('0x54')),'headers':{'Authorization':util[_0x4783('0x53')](_0x4783('0x55'),new Buffer(util[_0x4783('0x53')](_0x4783('0x56'),_0x45fb65[_0x4783('0x57')]))['toString'](_0x4783('0x58')))},'json':!![]});}})['then'](function(_0x212483){if(_0x212483){var _0xcb232c=[_0x4783('0x59'),_0x4783('0x5a'),_0x4783('0x5b'),_0x4783('0x5c'),_0x4783('0x1a'),_0x4783('0x5d'),'group',_0x4783('0x5e'),_0x4783('0x5f'),_0x4783('0x60'),_0x4783('0x61')];_[_0x4783('0x62')](_0x212483,function(_0x48b388){return _0xcb232c['includes'](_0x48b388[_0x4783('0x3b')])||!_0x48b388['default']&&_0x48b388['type']!==_0x4783('0x63')&&_0x48b388[_0x4783('0x2a')]!==_0x4783('0x64');});return{'count':_0x212483['length'],'rows':_[_0x4783('0x28')](_0x212483,function(_0x2474db){return{'id':_0x2474db[_0x4783('0x3b')],'name':_0x2474db['label'],'custom':!_0x2474db['default'],'options':_0x2474db['choices']?_[_0x4783('0x28')](_0x2474db[_0x4783('0x65')],function(_0x12d654){return{'name':_[_0x4783('0x66')](_0x12d654),'value':_0x12d654};}):[]};})};}})[_0x4783('0x26')](respondWithResult(_0xf39703,null))[_0x4783('0x40')](function(_0x530d5a){var _0xed3abd=_0x477e77[_0x4783('0x2c')][_0x4783('0x67')]?0x1f4:_0x530d5a['statusCode']||0x1f4;logger[_0x4783('0x27')](_0x4783('0x68'),_0x4783('0x4f'),_0xed3abd,JSON[_0x4783('0x69')](_0x530d5a));delete _0x530d5a[_0x4783('0x3b')];if(_0xed3abd===0x191){_0xed3abd=0x190;}_0xf39703['status'](_0xed3abd)['send'](_0x477e77['query']['test']?{'message':_0x4783('0x6a'),'statusCode':_0x530d5a['statusCode']}:_0x530d5a);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 4ae7715..b0ab56a 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 _0x05c6=['moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','api'];(function(_0x31709e,_0x2173ab){var _0x1c918c=function(_0x38e845){while(--_0x38e845){_0x31709e['push'](_0x31709e['shift']());}};_0x1c918c(++_0x2173ab);}(_0x05c6,0xc1));var _0x605c=function(_0xd8a79b,_0x294e90){_0xd8a79b=_0xd8a79b-0x0;var _0x5525ae=_0x05c6[_0xd8a79b];return _0x5525ae;};'use strict';var _=require(_0x605c('0x0'));var util=require(_0x605c('0x1'));var logger=require('../../config/logger')(_0x605c('0x2'));var moment=require(_0x605c('0x3'));var BPromise=require(_0x605c('0x4'));var rp=require(_0x605c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x605c('0x6'));var config=require(_0x605c('0x7'));var attributes=require(_0x605c('0x8'));var integrations=require(_0x605c('0x9'));module[_0x605c('0xa')]=function(_0x112c8f,_0x3b9e7c){return _0x112c8f[_0x605c('0xb')](_0x605c('0xc'),attributes,{'tableName':_0x605c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0070=['rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','FreshdeskAccount','lodash','util','api','moment','bluebird','path'];(function(_0x23dcd1,_0x2bf33d){var _0x14287e=function(_0x14e3d2){while(--_0x14e3d2){_0x23dcd1['push'](_0x23dcd1['shift']());}};_0x14287e(++_0x2bf33d);}(_0x0070,0x10d));var _0x0007=function(_0x5067c6,_0x3f1e9e){_0x5067c6=_0x5067c6-0x0;var _0xb5daa3=_0x0070[_0x5067c6];return _0xb5daa3;};'use strict';var _=require(_0x0007('0x0'));var util=require(_0x0007('0x1'));var logger=require('../../config/logger')(_0x0007('0x2'));var moment=require(_0x0007('0x3'));var BPromise=require(_0x0007('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0007('0x5'));var rimraf=require(_0x0007('0x6'));var config=require('../../config/environment');var attributes=require(_0x0007('0x7'));var integrations=require(_0x0007('0x8'));module[_0x0007('0x9')]=function(_0x19d328,_0x15cfdd){return _0x19d328['define'](_0x0007('0xa'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index aed8370..7039d7e 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 _0xf87a=['options','raw','where','include','map','model','attributes','stringify','info','ShowFreshdeskAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll'];(function(_0x1d3024,_0x5c0fdc){var _0x2867ba=function(_0x1a1afa){while(--_0x1a1afa){_0x1d3024['push'](_0x1d3024['shift']());}};_0x2867ba(++_0x5c0fdc);}(_0xf87a,0x133));var _0xaf87=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xf87a[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xaf87('0x0'));var util=require(_0xaf87('0x1'));var moment=require(_0xaf87('0x2'));var BPromise=require(_0xaf87('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaf87('0x4'));var db=require(_0xaf87('0x5'))['db'];var utils=require(_0xaf87('0x6'));var logger=require('../../config/logger')(_0xaf87('0x7'));var config=require(_0xaf87('0x8'));var jayson=require(_0xaf87('0x9'));var client=jayson['client'][_0xaf87('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f0f0b,_0x454ab6,_0x2b6987){return new BPromise(function(_0x444a17,_0x3dc738){return client['request'](_0x3f0f0b,_0x2b6987)[_0xaf87('0xb')](function(_0x1c5634){logger['info'](_0xaf87('0xc'),_0x454ab6,_0xaf87('0xd'));logger[_0xaf87('0xe')](_0xaf87('0xf'),_0x454ab6,'request\x20sent',JSON['stringify'](_0x1c5634));if(_0x1c5634['error']){if(_0x1c5634['error']['code']===0x1f4){logger[_0xaf87('0x10')](_0xaf87('0xc'),_0x454ab6,_0x1c5634[_0xaf87('0x10')]['message']);return _0x3dc738(_0x1c5634[_0xaf87('0x10')][_0xaf87('0x11')]);}logger['error'](_0xaf87('0xc'),_0x454ab6,_0x1c5634['error'][_0xaf87('0x11')]);return _0x444a17(_0x1c5634[_0xaf87('0x10')][_0xaf87('0x11')]);}else{logger['info'](_0xaf87('0xc'),_0x454ab6,_0xaf87('0xd'));_0x444a17(_0x1c5634[_0xaf87('0x12')]['message']);}})[_0xaf87('0x13')](function(_0x353420){logger[_0xaf87('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x454ab6,_0x353420);_0x3dc738(_0x353420);});});}exports[_0xaf87('0x14')]=function(_0x38ad28){var _0x584a1d=this;return new Promise(function(_0x2b283f,_0x5afd0b){return db[_0xaf87('0x15')][_0xaf87('0x16')]({'raw':_0x38ad28[_0xaf87('0x17')]?_0x38ad28[_0xaf87('0x17')][_0xaf87('0x18')]===undefined?!![]:![]:!![],'where':_0x38ad28[_0xaf87('0x17')]?_0x38ad28[_0xaf87('0x17')][_0xaf87('0x19')]||null:null,'attributes':_0x38ad28['options']?_0x38ad28[_0xaf87('0x17')]['attributes']||null:null,'limit':_0x38ad28[_0xaf87('0x17')]?_0x38ad28[_0xaf87('0x17')]['limit']||null:null,'include':_0x38ad28[_0xaf87('0x17')]?_0x38ad28['options'][_0xaf87('0x1a')]?_[_0xaf87('0x1b')](_0x38ad28[_0xaf87('0x17')][_0xaf87('0x1a')],function(_0x235401){return{'model':db[_0x235401[_0xaf87('0x1c')]],'as':_0x235401['as'],'attributes':_0x235401['attributes'],'include':_0x235401[_0xaf87('0x1a')]?_['map'](_0x235401[_0xaf87('0x1a')],function(_0x399995){return{'model':db[_0x399995[_0xaf87('0x1c')]],'as':_0x399995['as'],'attributes':_0x399995['attributes'],'include':_0x399995[_0xaf87('0x1a')]?_[_0xaf87('0x1b')](_0x399995[_0xaf87('0x1a')],function(_0x2900db){return{'model':db[_0x2900db['model']],'as':_0x2900db['as'],'attributes':_0x2900db[_0xaf87('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xaf87('0xb')](function(_0x599641){logger['info']('GetFreshdeskAccount',_0x38ad28);logger[_0xaf87('0xe')](_0xaf87('0x14'),_0x38ad28,JSON[_0xaf87('0x1e')](_0x599641));_0x2b283f(_0x599641);})['catch'](function(_0x2f8887){logger[_0xaf87('0x10')](_0xaf87('0x14'),_0x2f8887['message'],_0x38ad28);_0x5afd0b(_0x584a1d[_0xaf87('0x10')](0x1f4,_0x2f8887['message']));});});};exports['ShowFreshdeskAccount']=function(_0x3b2193){var _0x233e0b=this;return new Promise(function(_0x582496,_0x828fc6){return db[_0xaf87('0x15')]['find']({'raw':_0x3b2193[_0xaf87('0x17')]?_0x3b2193[_0xaf87('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3b2193[_0xaf87('0x17')]?_0x3b2193[_0xaf87('0x17')][_0xaf87('0x19')]||null:null,'attributes':_0x3b2193[_0xaf87('0x17')]?_0x3b2193[_0xaf87('0x17')][_0xaf87('0x1d')]||null:null,'include':_0x3b2193[_0xaf87('0x17')]?_0x3b2193['options'][_0xaf87('0x1a')]?_[_0xaf87('0x1b')](_0x3b2193['options'][_0xaf87('0x1a')],function(_0x10bd3c){return{'model':db[_0x10bd3c['model']],'as':_0x10bd3c['as'],'attributes':_0x10bd3c['attributes'],'include':_0x10bd3c[_0xaf87('0x1a')]?_[_0xaf87('0x1b')](_0x10bd3c[_0xaf87('0x1a')],function(_0x267c41){return{'model':db[_0x267c41[_0xaf87('0x1c')]],'as':_0x267c41['as'],'attributes':_0x267c41[_0xaf87('0x1d')],'include':_0x267c41[_0xaf87('0x1a')]?_['map'](_0x267c41[_0xaf87('0x1a')],function(_0x3f556a){return{'model':db[_0x3f556a[_0xaf87('0x1c')]],'as':_0x3f556a['as'],'attributes':_0x3f556a[_0xaf87('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xaf87('0xb')](function(_0x35b454){logger[_0xaf87('0x1f')](_0xaf87('0x20'),_0x3b2193);logger[_0xaf87('0xe')](_0xaf87('0x20'),_0x3b2193,JSON['stringify'](_0x35b454));_0x582496(_0x35b454);})[_0xaf87('0x13')](function(_0x6185ae){logger[_0xaf87('0x10')](_0xaf87('0x20'),_0x6185ae[_0xaf87('0x11')],_0x3b2193);_0x828fc6(_0x233e0b[_0xaf87('0x10')](0x1f4,_0x6185ae['message']));});});}; \ No newline at end of file +var _0x77bf=['include','attributes','model','debug','ShowFreshdeskAccount','then','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','limit','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x77bf,0x166));var _0xf77b=function(_0xdc79c,_0x909e83){_0xdc79c=_0xdc79c-0x0;var _0x29a0a2=_0x77bf[_0xdc79c];return _0x29a0a2;};'use strict';var _=require(_0xf77b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf77b('0x1'));var rs=require(_0xf77b('0x2'));var fs=require('fs');var Redis=require(_0xf77b('0x3'));var db=require(_0xf77b('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf77b('0x5'));var config=require('../../config/environment');var jayson=require(_0xf77b('0x6'));var client=jayson[_0xf77b('0x7')][_0xf77b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4da016,_0x390ea6,_0x5243aa){return new BPromise(function(_0x3a58b9,_0x5d23d2){return client['request'](_0x4da016,_0x5243aa)['then'](function(_0x561a42){logger[_0xf77b('0x9')](_0xf77b('0xa'),_0x390ea6,_0xf77b('0xb'));logger['debug'](_0xf77b('0xc'),_0x390ea6,'request\x20sent',JSON[_0xf77b('0xd')](_0x561a42));if(_0x561a42[_0xf77b('0xe')]){if(_0x561a42['error'][_0xf77b('0xf')]===0x1f4){logger[_0xf77b('0xe')](_0xf77b('0xa'),_0x390ea6,_0x561a42[_0xf77b('0xe')][_0xf77b('0x10')]);return _0x5d23d2(_0x561a42['error'][_0xf77b('0x10')]);}logger[_0xf77b('0xe')](_0xf77b('0xa'),_0x390ea6,_0x561a42[_0xf77b('0xe')][_0xf77b('0x10')]);return _0x3a58b9(_0x561a42[_0xf77b('0xe')][_0xf77b('0x10')]);}else{logger[_0xf77b('0x9')]('FreshdeskAccount,\x20%s,\x20%s',_0x390ea6,'request\x20sent');_0x3a58b9(_0x561a42[_0xf77b('0x11')][_0xf77b('0x10')]);}})[_0xf77b('0x12')](function(_0x50dcc6){logger[_0xf77b('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x390ea6,_0x50dcc6);_0x5d23d2(_0x50dcc6);});});}exports[_0xf77b('0x13')]=function(_0x41ec3e){var _0x2c988d=this;return new Promise(function(_0x151dc9,_0x583d68){return db[_0xf77b('0x14')][_0xf77b('0x15')]({'raw':_0x41ec3e[_0xf77b('0x16')]?_0x41ec3e[_0xf77b('0x16')][_0xf77b('0x17')]===undefined?!![]:![]:!![],'where':_0x41ec3e['options']?_0x41ec3e[_0xf77b('0x16')]['where']||null:null,'attributes':_0x41ec3e[_0xf77b('0x16')]?_0x41ec3e[_0xf77b('0x16')]['attributes']||null:null,'limit':_0x41ec3e[_0xf77b('0x16')]?_0x41ec3e[_0xf77b('0x16')][_0xf77b('0x18')]||null:null,'include':_0x41ec3e[_0xf77b('0x16')]?_0x41ec3e[_0xf77b('0x16')]['include']?_[_0xf77b('0x19')](_0x41ec3e[_0xf77b('0x16')][_0xf77b('0x1a')],function(_0x4b75c8){return{'model':db[_0x4b75c8['model']],'as':_0x4b75c8['as'],'attributes':_0x4b75c8[_0xf77b('0x1b')],'include':_0x4b75c8[_0xf77b('0x1a')]?_[_0xf77b('0x19')](_0x4b75c8[_0xf77b('0x1a')],function(_0x178516){return{'model':db[_0x178516[_0xf77b('0x1c')]],'as':_0x178516['as'],'attributes':_0x178516[_0xf77b('0x1b')],'include':_0x178516[_0xf77b('0x1a')]?_[_0xf77b('0x19')](_0x178516[_0xf77b('0x1a')],function(_0x83e83f){return{'model':db[_0x83e83f[_0xf77b('0x1c')]],'as':_0x83e83f['as'],'attributes':_0x83e83f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x43d695){logger[_0xf77b('0x9')](_0xf77b('0x13'),_0x41ec3e);logger[_0xf77b('0x1d')]('GetFreshdeskAccount',_0x41ec3e,JSON['stringify'](_0x43d695));_0x151dc9(_0x43d695);})[_0xf77b('0x12')](function(_0x241536){logger['error']('GetFreshdeskAccount',_0x241536[_0xf77b('0x10')],_0x41ec3e);_0x583d68(_0x2c988d[_0xf77b('0xe')](0x1f4,_0x241536['message']));});});};exports[_0xf77b('0x1e')]=function(_0x56565e){var _0x41d39c=this;return new Promise(function(_0x4f6bb6,_0x579c1c){return db[_0xf77b('0x14')]['find']({'raw':_0x56565e[_0xf77b('0x16')]?_0x56565e[_0xf77b('0x16')][_0xf77b('0x17')]===undefined?!![]:![]:!![],'where':_0x56565e[_0xf77b('0x16')]?_0x56565e[_0xf77b('0x16')]['where']||null:null,'attributes':_0x56565e[_0xf77b('0x16')]?_0x56565e[_0xf77b('0x16')][_0xf77b('0x1b')]||null:null,'include':_0x56565e[_0xf77b('0x16')]?_0x56565e[_0xf77b('0x16')]['include']?_[_0xf77b('0x19')](_0x56565e[_0xf77b('0x16')]['include'],function(_0x5b78c5){return{'model':db[_0x5b78c5[_0xf77b('0x1c')]],'as':_0x5b78c5['as'],'attributes':_0x5b78c5['attributes'],'include':_0x5b78c5[_0xf77b('0x1a')]?_['map'](_0x5b78c5[_0xf77b('0x1a')],function(_0x474c9a){return{'model':db[_0x474c9a[_0xf77b('0x1c')]],'as':_0x474c9a['as'],'attributes':_0x474c9a['attributes'],'include':_0x474c9a['include']?_[_0xf77b('0x19')](_0x474c9a[_0xf77b('0x1a')],function(_0x54bbc4){return{'model':db[_0x54bbc4['model']],'as':_0x54bbc4['as'],'attributes':_0x54bbc4[_0xf77b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf77b('0x1f')](function(_0x5018c4){logger['info']('ShowFreshdeskAccount',_0x56565e);logger[_0xf77b('0x1d')](_0xf77b('0x1e'),_0x56565e,JSON[_0xf77b('0xd')](_0x5018c4));_0x4f6bb6(_0x5018c4);})[_0xf77b('0x12')](function(_0x131115){logger[_0xf77b('0xe')](_0xf77b('0x1e'),_0x131115['message'],_0x56565e);_0x579c1c(_0x41d39c['error'](0x1f4,_0x131115[_0xf77b('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index b784edf..73bf661 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 _0x6994=['destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/fields','getFields','getSubjects','getDescriptions','/:id/tags','getTags','post','setTags','put','delete'];(function(_0x1eabe2,_0x24666c){var _0x39adc0=function(_0x3149e4){while(--_0x3149e4){_0x1eabe2['push'](_0x1eabe2['shift']());}};_0x39adc0(++_0x24666c);}(_0x6994,0x1a3));var _0x4699=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x6994[_0x35da42];return _0x370035;};'use strict';var multer=require(_0x4699('0x0'));var util=require(_0x4699('0x1'));var path=require(_0x4699('0x2'));var timeout=require(_0x4699('0x3'));var express=require(_0x4699('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4699('0x5'));var interaction=require(_0x4699('0x6'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0x4699('0x7')]('/',auth[_0x4699('0x8')](),controller['index']);router[_0x4699('0x7')](_0x4699('0x9'),auth[_0x4699('0x8')](),controller[_0x4699('0xa')]);router[_0x4699('0x7')](_0x4699('0xb'),auth[_0x4699('0x8')](),controller[_0x4699('0xc')]);router[_0x4699('0x7')]('/:id/subjects',auth[_0x4699('0x8')](),controller[_0x4699('0xd')]);router[_0x4699('0x7')]('/:id/descriptions',auth[_0x4699('0x8')](),controller[_0x4699('0xe')]);router[_0x4699('0x7')](_0x4699('0xf'),auth[_0x4699('0x8')](),controller[_0x4699('0x10')]);router[_0x4699('0x11')]('/',auth[_0x4699('0x8')](),controller['create']);router[_0x4699('0x11')](_0x4699('0xf'),auth[_0x4699('0x8')](),controller[_0x4699('0x12')]);router[_0x4699('0x13')]('/:id',auth[_0x4699('0x8')](),controller['update']);router[_0x4699('0x14')](_0x4699('0x9'),auth[_0x4699('0x8')](),controller[_0x4699('0x15')]);module['exports']=router; \ No newline at end of file +var _0xfb66=['../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','/:id','show','isAuthenticated','getFields','/:id/subjects','/:id/descriptions','/:id/tags','getTags','post','create','setTags','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4f18d8,_0xffba77){var _0x9f9bd0=function(_0x13ee53){while(--_0x13ee53){_0x4f18d8['push'](_0x4f18d8['shift']());}};_0x9f9bd0(++_0xffba77);}(_0xfb66,0x95));var _0x6fb6=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xfb66[_0x36eaaa];return _0x461349;};'use strict';var multer=require('multer');var util=require(_0x6fb6('0x0'));var path=require(_0x6fb6('0x1'));var timeout=require(_0x6fb6('0x2'));var express=require(_0x6fb6('0x3'));var router=express[_0x6fb6('0x4')]();var fs_extra=require(_0x6fb6('0x5'));var auth=require(_0x6fb6('0x6'));var interaction=require(_0x6fb6('0x7'));var config=require(_0x6fb6('0x8'));var controller=require(_0x6fb6('0x9'));router[_0x6fb6('0xa')]('/',auth['isAuthenticated'](),controller[_0x6fb6('0xb')]);router['get'](_0x6fb6('0xc'),auth['isAuthenticated'](),controller[_0x6fb6('0xd')]);router['get']('/:id/fields',auth[_0x6fb6('0xe')](),controller[_0x6fb6('0xf')]);router['get'](_0x6fb6('0x10'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0x6fb6('0x11'),auth[_0x6fb6('0xe')](),controller['getDescriptions']);router[_0x6fb6('0xa')](_0x6fb6('0x12'),auth[_0x6fb6('0xe')](),controller[_0x6fb6('0x13')]);router[_0x6fb6('0x14')]('/',auth[_0x6fb6('0xe')](),controller[_0x6fb6('0x15')]);router[_0x6fb6('0x14')](_0x6fb6('0x12'),auth[_0x6fb6('0xe')](),controller[_0x6fb6('0x16')]);router['put'](_0x6fb6('0xc'),auth[_0x6fb6('0xe')](),controller[_0x6fb6('0x17')]);router[_0x6fb6('0x18')](_0x6fb6('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x6fb6('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 39b8810..3680c4a 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 _0x4893=['sequelize','exports','STRING'];(function(_0x31abb0,_0x178870){var _0x1b2268=function(_0x271088){while(--_0x271088){_0x31abb0['push'](_0x31abb0['shift']());}};_0x1b2268(++_0x178870);}(_0x4893,0x1bf));var _0x3489=function(_0x5311a1,_0x304912){_0x5311a1=_0x5311a1-0x0;var _0x2acb9f=_0x4893[_0x5311a1];return _0x2acb9f;};'use strict';var Sequelize=require(_0x3489('0x0'));module[_0x3489('0x1')]={'name':{'type':Sequelize[_0x3489('0x2')]},'description':{'type':Sequelize[_0x3489('0x2')]}}; \ No newline at end of file +var _0x60d3=['exports','STRING'];(function(_0x3b1582,_0x31a7ff){var _0x3f2d2f=function(_0x3a6914){while(--_0x3a6914){_0x3b1582['push'](_0x3b1582['shift']());}};_0x3f2d2f(++_0x31a7ff);}(_0x60d3,0xf0));var _0x360d=function(_0x44dba1,_0x270ad5){_0x44dba1=_0x44dba1-0x0;var _0x2fbd3f=_0x60d3[_0x44dba1];return _0x2fbd3f;};'use strict';var Sequelize=require('sequelize');module[_0x360d('0x0')]={'name':{'type':Sequelize[_0x360d('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 251d09f..97953de 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 _0xf225=['../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','send','index','FreshdeskConfiguration','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','map','VIRTUAL','merge','options','count','findAll','rows','catch','show','params','includeAll','include','find','create','body','getFields','findOne','FreshdeskField','order','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api'];(function(_0x312b02,_0x5a4c99){var _0x34a298=function(_0x992e5a){while(--_0x992e5a){_0x312b02['push'](_0x312b02['shift']());}};_0x34a298(++_0x5a4c99);}(_0xf225,0x94));var _0x5f22=function(_0x55516d,_0x9bfcc){_0x55516d=_0x55516d-0x0;var _0x358d17=_0xf225[_0x55516d];return _0x358d17;};'use strict';var emlformat=require(_0x5f22('0x0'));var rimraf=require(_0x5f22('0x1'));var zipdir=require(_0x5f22('0x2'));var jsonpatch=require(_0x5f22('0x3'));var rp=require(_0x5f22('0x4'));var moment=require(_0x5f22('0x5'));var BPromise=require(_0x5f22('0x6'));var Mustache=require(_0x5f22('0x7'));var util=require(_0x5f22('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x5f22('0x9'));var ejs=require(_0x5f22('0xa'));var fs=require('fs');var fs_extra=require(_0x5f22('0xb'));var _=require('lodash');var squel=require(_0x5f22('0xc'));var crypto=require(_0x5f22('0xd'));var jsforce=require(_0x5f22('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5f22('0x9'));var querystring=require(_0x5f22('0xf'));var Papa=require(_0x5f22('0x10'));var Redis=require(_0x5f22('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5f22('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5f22('0x13'));var utils=require(_0x5f22('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5f22('0x15'));var db=require(_0x5f22('0x16'))['db'];function respondWithStatusCode(_0x3335d1,_0x167dfc){_0x167dfc=_0x167dfc||0xcc;return function(_0x5463b5){if(_0x5463b5){return _0x3335d1['sendStatus'](_0x167dfc);}return _0x3335d1[_0x5f22('0x17')](_0x167dfc)[_0x5f22('0x18')]();};}function respondWithResult(_0x2331ed,_0x36e167){_0x36e167=_0x36e167||0xc8;return function(_0x5272fb){if(_0x5272fb){return _0x2331ed[_0x5f22('0x17')](_0x36e167)[_0x5f22('0x19')](_0x5272fb);}};}function respondWithFilteredResult(_0x1afd2f,_0x46df86){return function(_0x9163bc){if(_0x9163bc){var _0x3133ab=typeof _0x46df86[_0x5f22('0x1a')]===_0x5f22('0x1b')&&typeof _0x46df86['limit']===_0x5f22('0x1b');var _0xecd9b5=_0x9163bc['count'];var _0x1b3a27=_0x3133ab?0x0:_0x46df86['offset'];var _0x31b0ee=_0x3133ab?_0x9163bc['count']:_0x46df86[_0x5f22('0x1a')]+_0x46df86[_0x5f22('0x1c')];var _0x176f03;if(_0x31b0ee>=_0xecd9b5){_0x31b0ee=_0xecd9b5;_0x176f03=0xc8;}else{_0x176f03=0xce;}_0x1afd2f[_0x5f22('0x17')](_0x176f03);return _0x1afd2f['set'](_0x5f22('0x1d'),_0x1b3a27+'-'+_0x31b0ee+'/'+_0xecd9b5)[_0x5f22('0x19')](_0x9163bc);}return null;};}function patchUpdates(_0x4ffd59){return function(_0x7f822d){try{jsonpatch[_0x5f22('0x1e')](_0x7f822d,_0x4ffd59,!![]);}catch(_0xfc78f7){return BPromise[_0x5f22('0x1f')](_0xfc78f7);}return _0x7f822d[_0x5f22('0x20')]();};}function saveUpdates(_0x4e6f,_0x18159f){return function(_0x2ca4bf){if(_0x2ca4bf){return _0x2ca4bf[_0x5f22('0x21')](_0x4e6f)[_0x5f22('0x22')](function(_0x480bef){return _0x480bef;});}return null;};}function removeEntity(_0x192a6c,_0x5071fb){return function(_0x5431a9){if(_0x5431a9){return _0x5431a9[_0x5f22('0x23')]()[_0x5f22('0x22')](function(){_0x192a6c[_0x5f22('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x422049,_0x5581c7){return function(_0x6f07b7){if(!_0x6f07b7){_0x422049[_0x5f22('0x24')](0x194);}return _0x6f07b7;};}function handleError(_0x4f3094,_0x1c1127){_0x1c1127=_0x1c1127||0x1f4;return function(_0x19032c){logger['error'](_0x19032c['stack']);if(_0x19032c[_0x5f22('0x25')]){delete _0x19032c[_0x5f22('0x25')];}_0x4f3094[_0x5f22('0x17')](_0x1c1127)[_0x5f22('0x26')](_0x19032c);};}exports[_0x5f22('0x27')]=function(_0x37d9ec,_0x4cf583){var _0x1e0be3={},_0x1d12ca={},_0x3e6602={'count':0x0,'rows':[]};var _0xc79912=_['map'](db[_0x5f22('0x28')][_0x5f22('0x29')],function(_0x27b4c1){return{'name':_0x27b4c1[_0x5f22('0x2a')],'type':_0x27b4c1[_0x5f22('0x2b')][_0x5f22('0x2c')]};});_0x1d12ca['model']=_['map'](_0xc79912,_0x5f22('0x25'));_0x1d12ca['query']=_[_0x5f22('0x2d')](_0x37d9ec[_0x5f22('0x2e')]);_0x1d12ca[_0x5f22('0x2f')]=_[_0x5f22('0x30')](_0x1d12ca[_0x5f22('0x31')],_0x1d12ca[_0x5f22('0x2e')]);_0x1e0be3['attributes']=_[_0x5f22('0x30')](_0x1d12ca[_0x5f22('0x31')],qs[_0x5f22('0x32')](_0x37d9ec['query'][_0x5f22('0x32')]));_0x1e0be3['attributes']=_0x1e0be3['attributes'][_0x5f22('0x33')]?_0x1e0be3[_0x5f22('0x34')]:_0x1d12ca[_0x5f22('0x31')];if(!_0x37d9ec[_0x5f22('0x2e')][_0x5f22('0x35')](_0x5f22('0x36'))){_0x1e0be3['limit']=qs[_0x5f22('0x1c')](_0x37d9ec[_0x5f22('0x2e')]['limit']);_0x1e0be3[_0x5f22('0x1a')]=qs[_0x5f22('0x1a')](_0x37d9ec[_0x5f22('0x2e')][_0x5f22('0x1a')]);}_0x1e0be3['order']=qs[_0x5f22('0x37')](_0x37d9ec[_0x5f22('0x2e')][_0x5f22('0x37')]);_0x1e0be3[_0x5f22('0x38')]=qs[_0x5f22('0x2f')](_[_0x5f22('0x39')](_0x37d9ec['query'],_0x1d12ca[_0x5f22('0x2f')]),_0xc79912);if(_0x37d9ec[_0x5f22('0x2e')][_0x5f22('0x3a')]){_0x1e0be3[_0x5f22('0x38')]=_['merge'](_0x1e0be3[_0x5f22('0x38')],{'$or':_[_0x5f22('0x3b')](_0xc79912,function(_0x3797cf){if(_0x3797cf['type']!==_0x5f22('0x3c')){var _0x4740c2={};_0x4740c2[_0x3797cf[_0x5f22('0x25')]]={'$like':'%'+_0x37d9ec[_0x5f22('0x2e')][_0x5f22('0x3a')]+'%'};return _0x4740c2;}})});}_0x1e0be3=_[_0x5f22('0x3d')]({},_0x1e0be3,_0x37d9ec[_0x5f22('0x3e')]);var _0x4b8b68={'where':_0x1e0be3[_0x5f22('0x38')]};return db[_0x5f22('0x28')][_0x5f22('0x3f')](_0x4b8b68)[_0x5f22('0x22')](function(_0x341c58){_0x3e6602[_0x5f22('0x3f')]=_0x341c58;if(_0x37d9ec[_0x5f22('0x2e')]['includeAll']){_0x1e0be3['include']=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x5f22('0x40')](_0x1e0be3);})['then'](function(_0x5dfda1){_0x3e6602[_0x5f22('0x41')]=_0x5dfda1;return _0x3e6602;})['then'](respondWithFilteredResult(_0x4cf583,_0x1e0be3))[_0x5f22('0x42')](handleError(_0x4cf583,null));};exports[_0x5f22('0x43')]=function(_0x45d60c,_0x53f053){var _0x59334c={'raw':![],'where':{'id':_0x45d60c[_0x5f22('0x44')]['id']}},_0x274404={};_0x274404[_0x5f22('0x31')]=_['keys'](db['FreshdeskConfiguration'][_0x5f22('0x29')]);_0x274404[_0x5f22('0x2e')]=_[_0x5f22('0x2d')](_0x45d60c[_0x5f22('0x2e')]);_0x274404['filters']=_[_0x5f22('0x30')](_0x274404['model'],_0x274404[_0x5f22('0x2e')]);_0x59334c[_0x5f22('0x34')]=_[_0x5f22('0x30')](_0x274404[_0x5f22('0x31')],qs['fields'](_0x45d60c[_0x5f22('0x2e')][_0x5f22('0x32')]));_0x59334c['attributes']=_0x59334c['attributes']['length']?_0x59334c['attributes']:_0x274404[_0x5f22('0x31')];if(_0x45d60c[_0x5f22('0x2e')][_0x5f22('0x45')]){_0x59334c[_0x5f22('0x46')]=[{'all':!![]}];}_0x59334c=_[_0x5f22('0x3d')]({},_0x59334c,_0x45d60c['options']);return db[_0x5f22('0x28')][_0x5f22('0x47')](_0x59334c)[_0x5f22('0x22')](handleEntityNotFound(_0x53f053,null))[_0x5f22('0x22')](respondWithResult(_0x53f053,null))[_0x5f22('0x42')](handleError(_0x53f053,null));};exports[_0x5f22('0x48')]=function(_0x3e71d0,_0x1a8b29){return db[_0x5f22('0x28')][_0x5f22('0x48')](_0x3e71d0[_0x5f22('0x49')],{})[_0x5f22('0x22')](respondWithResult(_0x1a8b29,0xc9))['catch'](handleError(_0x1a8b29,null));};exports[_0x5f22('0x21')]=function(_0x220f47,_0x43a855){if(_0x220f47[_0x5f22('0x49')]['id']){delete _0x220f47['body']['id'];}return db[_0x5f22('0x28')][_0x5f22('0x47')]({'where':{'id':_0x220f47[_0x5f22('0x44')]['id']}})[_0x5f22('0x22')](handleEntityNotFound(_0x43a855,null))[_0x5f22('0x22')](saveUpdates(_0x220f47['body'],null))[_0x5f22('0x22')](respondWithResult(_0x43a855,null))['catch'](handleError(_0x43a855,null));};exports['destroy']=function(_0x5ac308,_0x514dd2){return db[_0x5f22('0x28')][_0x5f22('0x47')]({'where':{'id':_0x5ac308[_0x5f22('0x44')]['id']}})[_0x5f22('0x22')](handleEntityNotFound(_0x514dd2,null))['then'](removeEntity(_0x514dd2,null))[_0x5f22('0x42')](handleError(_0x514dd2,null));};exports[_0x5f22('0x4a')]=function(_0x144d45,_0x3fe191,_0x140b53){var _0x516234={};var _0x3dafb8={};var _0x2039c9;var _0x268cf2;return db[_0x5f22('0x28')][_0x5f22('0x4b')]({'where':{'id':_0x144d45[_0x5f22('0x44')]['id']}})[_0x5f22('0x22')](handleEntityNotFound(_0x3fe191,null))[_0x5f22('0x22')](function(_0x3c1f0a){if(_0x3c1f0a){_0x2039c9=_0x3c1f0a;_0x3dafb8[_0x5f22('0x31')]=_[_0x5f22('0x2d')](db[_0x5f22('0x4c')][_0x5f22('0x29')]);_0x3dafb8[_0x5f22('0x2e')]=_[_0x5f22('0x2d')](_0x144d45[_0x5f22('0x2e')]);_0x3dafb8[_0x5f22('0x2f')]=_[_0x5f22('0x30')](_0x3dafb8['model'],_0x3dafb8[_0x5f22('0x2e')]);_0x516234['attributes']=_[_0x5f22('0x30')](_0x3dafb8[_0x5f22('0x31')],qs['fields'](_0x144d45[_0x5f22('0x2e')][_0x5f22('0x32')]));_0x516234[_0x5f22('0x34')]=_0x516234[_0x5f22('0x34')][_0x5f22('0x33')]?_0x516234[_0x5f22('0x34')]:_0x3dafb8[_0x5f22('0x31')];_0x516234[_0x5f22('0x4d')]=qs[_0x5f22('0x37')](_0x144d45['query'][_0x5f22('0x37')]);_0x516234[_0x5f22('0x38')]=qs[_0x5f22('0x2f')](_['pick'](_0x144d45[_0x5f22('0x2e')],_0x3dafb8[_0x5f22('0x2f')]));if(_0x144d45[_0x5f22('0x2e')][_0x5f22('0x3a')]){_0x516234[_0x5f22('0x38')]=_[_0x5f22('0x3d')](_0x516234[_0x5f22('0x38')],{'$or':_['map'](_0x516234[_0x5f22('0x34')],function(_0x214633){var _0xde0406={};_0xde0406[_0x214633]={'$like':'%'+_0x144d45[_0x5f22('0x2e')][_0x5f22('0x3a')]+'%'};return _0xde0406;})});}_0x516234=_['merge']({},_0x516234,_0x144d45[_0x5f22('0x3e')]);return _0x2039c9[_0x5f22('0x4a')](_0x516234);}})[_0x5f22('0x22')](function(_0x4e7742){if(_0x4e7742){_0x268cf2=_0x4e7742[_0x5f22('0x33')];if(!_0x144d45[_0x5f22('0x2e')]['hasOwnProperty']('nolimit')){_0x516234['limit']=qs[_0x5f22('0x1c')](_0x144d45[_0x5f22('0x2e')]['limit']);_0x516234[_0x5f22('0x1a')]=qs['offset'](_0x144d45[_0x5f22('0x2e')]['offset']);}return _0x2039c9[_0x5f22('0x4a')](_0x516234);}})[_0x5f22('0x22')](function(_0x59d4d4){if(_0x59d4d4){return _0x59d4d4?{'count':_0x268cf2,'rows':_0x59d4d4}:null;}})[_0x5f22('0x22')](respondWithResult(_0x3fe191,null))[_0x5f22('0x42')](handleError(_0x3fe191,null));};exports['getSubjects']=function(_0x42efa4,_0x3b58e6,_0x4511e8){var _0x122273={};var _0x566282={};var _0x545492;var _0x2f64e8;return db['FreshdeskConfiguration'][_0x5f22('0x4b')]({'where':{'id':_0x42efa4[_0x5f22('0x44')]['id']}})[_0x5f22('0x22')](handleEntityNotFound(_0x3b58e6,null))[_0x5f22('0x22')](function(_0x40a1e1){if(_0x40a1e1){_0x545492=_0x40a1e1;_0x566282['model']=_['keys'](db[_0x5f22('0x4c')][_0x5f22('0x29')]);_0x566282[_0x5f22('0x2e')]=_[_0x5f22('0x2d')](_0x42efa4[_0x5f22('0x2e')]);_0x566282['filters']=_['intersection'](_0x566282['model'],_0x566282[_0x5f22('0x2e')]);_0x122273[_0x5f22('0x34')]=_['intersection'](_0x566282[_0x5f22('0x31')],qs[_0x5f22('0x32')](_0x42efa4[_0x5f22('0x2e')][_0x5f22('0x32')]));_0x122273[_0x5f22('0x34')]=_0x122273[_0x5f22('0x34')][_0x5f22('0x33')]?_0x122273['attributes']:_0x566282[_0x5f22('0x31')];_0x122273[_0x5f22('0x4d')]=qs[_0x5f22('0x37')](_0x42efa4[_0x5f22('0x2e')]['sort']);_0x122273[_0x5f22('0x38')]=qs[_0x5f22('0x2f')](_[_0x5f22('0x39')](_0x42efa4[_0x5f22('0x2e')],_0x566282['filters']));if(_0x42efa4[_0x5f22('0x2e')][_0x5f22('0x3a')]){_0x122273['where']=_[_0x5f22('0x3d')](_0x122273['where'],{'$or':_[_0x5f22('0x3b')](_0x122273[_0x5f22('0x34')],function(_0x2ace7f){var _0x90e6d9={};_0x90e6d9[_0x2ace7f]={'$like':'%'+_0x42efa4[_0x5f22('0x2e')][_0x5f22('0x3a')]+'%'};return _0x90e6d9;})});}_0x122273=_[_0x5f22('0x3d')]({},_0x122273,_0x42efa4[_0x5f22('0x3e')]);return _0x545492[_0x5f22('0x4e')](_0x122273);}})[_0x5f22('0x22')](function(_0x4d97ab){if(_0x4d97ab){_0x2f64e8=_0x4d97ab['length'];if(!_0x42efa4[_0x5f22('0x2e')][_0x5f22('0x35')](_0x5f22('0x36'))){_0x122273[_0x5f22('0x1c')]=qs[_0x5f22('0x1c')](_0x42efa4[_0x5f22('0x2e')][_0x5f22('0x1c')]);_0x122273['offset']=qs[_0x5f22('0x1a')](_0x42efa4['query']['offset']);}return _0x545492[_0x5f22('0x4e')](_0x122273);}})['then'](function(_0x1572ce){if(_0x1572ce){return _0x1572ce?{'count':_0x2f64e8,'rows':_0x1572ce}:null;}})[_0x5f22('0x22')](respondWithResult(_0x3b58e6,null))['catch'](handleError(_0x3b58e6,null));};exports[_0x5f22('0x4f')]=function(_0x4024eb,_0xb73b53,_0x5d1451){var _0x16a8b9={};var _0x2a3c40={};var _0x1df0f9;var _0x2473e2;return db[_0x5f22('0x28')][_0x5f22('0x4b')]({'where':{'id':_0x4024eb[_0x5f22('0x44')]['id']}})[_0x5f22('0x22')](handleEntityNotFound(_0xb73b53,null))['then'](function(_0x1f048b){if(_0x1f048b){_0x1df0f9=_0x1f048b;_0x2a3c40[_0x5f22('0x31')]=_[_0x5f22('0x2d')](db[_0x5f22('0x4c')][_0x5f22('0x29')]);_0x2a3c40[_0x5f22('0x2e')]=_[_0x5f22('0x2d')](_0x4024eb[_0x5f22('0x2e')]);_0x2a3c40[_0x5f22('0x2f')]=_[_0x5f22('0x30')](_0x2a3c40[_0x5f22('0x31')],_0x2a3c40['query']);_0x16a8b9[_0x5f22('0x34')]=_[_0x5f22('0x30')](_0x2a3c40[_0x5f22('0x31')],qs[_0x5f22('0x32')](_0x4024eb[_0x5f22('0x2e')][_0x5f22('0x32')]));_0x16a8b9['attributes']=_0x16a8b9[_0x5f22('0x34')][_0x5f22('0x33')]?_0x16a8b9[_0x5f22('0x34')]:_0x2a3c40[_0x5f22('0x31')];_0x16a8b9[_0x5f22('0x4d')]=qs['sort'](_0x4024eb[_0x5f22('0x2e')][_0x5f22('0x37')]);_0x16a8b9[_0x5f22('0x38')]=qs[_0x5f22('0x2f')](_[_0x5f22('0x39')](_0x4024eb[_0x5f22('0x2e')],_0x2a3c40[_0x5f22('0x2f')]));if(_0x4024eb[_0x5f22('0x2e')][_0x5f22('0x3a')]){_0x16a8b9['where']=_[_0x5f22('0x3d')](_0x16a8b9[_0x5f22('0x38')],{'$or':_[_0x5f22('0x3b')](_0x16a8b9[_0x5f22('0x34')],function(_0x167c8f){var _0x2d63b1={};_0x2d63b1[_0x167c8f]={'$like':'%'+_0x4024eb['query']['filter']+'%'};return _0x2d63b1;})});}_0x16a8b9=_[_0x5f22('0x3d')]({},_0x16a8b9,_0x4024eb[_0x5f22('0x3e')]);return _0x1df0f9['getDescriptions'](_0x16a8b9);}})[_0x5f22('0x22')](function(_0x2f9113){if(_0x2f9113){_0x2473e2=_0x2f9113[_0x5f22('0x33')];if(!_0x4024eb['query'][_0x5f22('0x35')](_0x5f22('0x36'))){_0x16a8b9[_0x5f22('0x1c')]=qs[_0x5f22('0x1c')](_0x4024eb[_0x5f22('0x2e')][_0x5f22('0x1c')]);_0x16a8b9['offset']=qs[_0x5f22('0x1a')](_0x4024eb[_0x5f22('0x2e')][_0x5f22('0x1a')]);}return _0x1df0f9[_0x5f22('0x4f')](_0x16a8b9);}})[_0x5f22('0x22')](function(_0x28ffc6){if(_0x28ffc6){return _0x28ffc6?{'count':_0x2473e2,'rows':_0x28ffc6}:null;}})[_0x5f22('0x22')](respondWithResult(_0xb73b53,null))[_0x5f22('0x42')](handleError(_0xb73b53,null));};exports[_0x5f22('0x50')]=function(_0x2dd7a8,_0x2f47b0,_0x51575a){var _0x506ed3={};var _0x105495={};var _0xf7359a;var _0x23bc08;return db[_0x5f22('0x28')][_0x5f22('0x4b')]({'where':{'id':_0x2dd7a8[_0x5f22('0x44')]['id']}})[_0x5f22('0x22')](handleEntityNotFound(_0x2f47b0,null))[_0x5f22('0x22')](function(_0x3283be){if(_0x3283be){_0xf7359a=_0x3283be;_0x105495[_0x5f22('0x31')]=_[_0x5f22('0x2d')](db[_0x5f22('0x51')][_0x5f22('0x29')]);_0x105495['query']=_[_0x5f22('0x2d')](_0x2dd7a8['query']);_0x105495[_0x5f22('0x2f')]=_[_0x5f22('0x30')](_0x105495[_0x5f22('0x31')],_0x105495['query']);_0x506ed3[_0x5f22('0x34')]=_[_0x5f22('0x30')](_0x105495[_0x5f22('0x31')],qs[_0x5f22('0x32')](_0x2dd7a8['query']['fields']));_0x506ed3[_0x5f22('0x34')]=_0x506ed3['attributes'][_0x5f22('0x33')]?_0x506ed3[_0x5f22('0x34')]:_0x105495['model'];_0x506ed3[_0x5f22('0x4d')]=qs[_0x5f22('0x37')](_0x2dd7a8['query'][_0x5f22('0x37')]);_0x506ed3['where']=qs[_0x5f22('0x2f')](_[_0x5f22('0x39')](_0x2dd7a8[_0x5f22('0x2e')],_0x105495['filters']));if(_0x2dd7a8['query']['filter']){_0x506ed3[_0x5f22('0x38')]=_[_0x5f22('0x3d')](_0x506ed3['where'],{'$or':_[_0x5f22('0x3b')](_0x506ed3['attributes'],function(_0x3e644b){var _0x304796={};_0x304796[_0x3e644b]={'$like':'%'+_0x2dd7a8[_0x5f22('0x2e')][_0x5f22('0x3a')]+'%'};return _0x304796;})});}_0x506ed3=_['merge']({},_0x506ed3,_0x2dd7a8[_0x5f22('0x3e')]);return _0xf7359a['getTags'](_0x506ed3);}})['then'](function(_0x56ec25){if(_0x56ec25){_0x23bc08=_0x56ec25[_0x5f22('0x33')];if(!_0x2dd7a8[_0x5f22('0x2e')][_0x5f22('0x35')]('nolimit')){_0x506ed3['limit']=qs[_0x5f22('0x1c')](_0x2dd7a8[_0x5f22('0x2e')][_0x5f22('0x1c')]);_0x506ed3[_0x5f22('0x1a')]=qs[_0x5f22('0x1a')](_0x2dd7a8[_0x5f22('0x2e')][_0x5f22('0x1a')]);}return _0xf7359a[_0x5f22('0x50')](_0x506ed3);}})[_0x5f22('0x22')](function(_0x4b8874){if(_0x4b8874){return _0x4b8874?{'count':_0x23bc08,'rows':_0x4b8874}:null;}})[_0x5f22('0x22')](respondWithResult(_0x2f47b0,null))[_0x5f22('0x42')](handleError(_0x2f47b0,null));};exports[_0x5f22('0x52')]=function(_0x5d1bb1,_0x3574a2,_0x19e207){if(_0x5d1bb1[_0x5f22('0x49')]['id']){delete _0x5d1bb1[_0x5f22('0x49')]['id'];}return db[_0x5f22('0x28')][_0x5f22('0x4b')]({'where':{'id':_0x5d1bb1[_0x5f22('0x44')]['id']}})[_0x5f22('0x22')](handleEntityNotFound(_0x3574a2,null))['then'](function(_0x1f86ab){if(_0x1f86ab){return _0x1f86ab[_0x5f22('0x52')](_0x5d1bb1[_0x5f22('0x49')][_0x5f22('0x53')]||[]);}return null;})[_0x5f22('0x22')](respondWithResult(_0x3574a2,null))[_0x5f22('0x42')](handleError(_0x3574a2,null));}; \ No newline at end of file +var _0xf054=['offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','name','send','index','map','FreshdeskConfiguration','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','create','update','body','destroy','getFields','keys','FreshdeskField','findOne','rawAttributes','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','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','end','status','json'];(function(_0x5c786b,_0x56b85d){var _0x39b4cc=function(_0x42f8f7){while(--_0x42f8f7){_0x5c786b['push'](_0x5c786b['shift']());}};_0x39b4cc(++_0x56b85d);}(_0xf054,0xe0));var _0x4f05=function(_0x73c11e,_0x513869){_0x73c11e=_0x73c11e-0x0;var _0x1bf81e=_0xf054[_0x73c11e];return _0x1bf81e;};'use strict';var emlformat=require(_0x4f05('0x0'));var rimraf=require(_0x4f05('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f05('0x2'));var rp=require(_0x4f05('0x3'));var moment=require(_0x4f05('0x4'));var BPromise=require(_0x4f05('0x5'));var Mustache=require('mustache');var util=require(_0x4f05('0x6'));var path=require('path');var sox=require(_0x4f05('0x7'));var csv=require(_0x4f05('0x8'));var ejs=require(_0x4f05('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4f05('0xa'));var squel=require(_0x4f05('0xb'));var crypto=require(_0x4f05('0xc'));var jsforce=require(_0x4f05('0xd'));var deskjs=require(_0x4f05('0xe'));var toCsv=require(_0x4f05('0x8'));var querystring=require(_0x4f05('0xf'));var Papa=require(_0x4f05('0x10'));var Redis=require(_0x4f05('0x11'));var authService=require(_0x4f05('0x12'));var qs=require(_0x4f05('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4f05('0x14'))(_0x4f05('0x15'));var utils=require('../../config/utils');var config=require(_0x4f05('0x16'));var licenseUtil=require(_0x4f05('0x17'));var db=require(_0x4f05('0x18'))['db'];function respondWithStatusCode(_0x52f4b4,_0x237e78){_0x237e78=_0x237e78||0xcc;return function(_0x2aa1be){if(_0x2aa1be){return _0x52f4b4['sendStatus'](_0x237e78);}return _0x52f4b4['status'](_0x237e78)[_0x4f05('0x19')]();};}function respondWithResult(_0x464a25,_0x557c88){_0x557c88=_0x557c88||0xc8;return function(_0x433672){if(_0x433672){return _0x464a25[_0x4f05('0x1a')](_0x557c88)[_0x4f05('0x1b')](_0x433672);}};}function respondWithFilteredResult(_0x484133,_0x5866df){return function(_0x3d0037){if(_0x3d0037){var _0x31d995=typeof _0x5866df[_0x4f05('0x1c')]==='undefined'&&typeof _0x5866df[_0x4f05('0x1d')]===_0x4f05('0x1e');var _0x56adae=_0x3d0037[_0x4f05('0x1f')];var _0x29d604=_0x31d995?0x0:_0x5866df['offset'];var _0x480717=_0x31d995?_0x3d0037[_0x4f05('0x1f')]:_0x5866df[_0x4f05('0x1c')]+_0x5866df[_0x4f05('0x1d')];var _0x4ece4f;if(_0x480717>=_0x56adae){_0x480717=_0x56adae;_0x4ece4f=0xc8;}else{_0x4ece4f=0xce;}_0x484133[_0x4f05('0x1a')](_0x4ece4f);return _0x484133[_0x4f05('0x20')](_0x4f05('0x21'),_0x29d604+'-'+_0x480717+'/'+_0x56adae)[_0x4f05('0x1b')](_0x3d0037);}return null;};}function patchUpdates(_0x2cd669){return function(_0x1740f9){try{jsonpatch[_0x4f05('0x22')](_0x1740f9,_0x2cd669,!![]);}catch(_0x1de0b3){return BPromise[_0x4f05('0x23')](_0x1de0b3);}return _0x1740f9[_0x4f05('0x24')]();};}function saveUpdates(_0x2d3f10,_0x17fdac){return function(_0x310a5d){if(_0x310a5d){return _0x310a5d['update'](_0x2d3f10)[_0x4f05('0x25')](function(_0x2383b9){return _0x2383b9;});}return null;};}function removeEntity(_0x14736c,_0x4ee152){return function(_0x13350d){if(_0x13350d){return _0x13350d['destroy']()[_0x4f05('0x25')](function(){_0x14736c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x580954,_0x3fcb22){return function(_0x34ee5e){if(!_0x34ee5e){_0x580954['sendStatus'](0x194);}return _0x34ee5e;};}function handleError(_0x2c8134,_0x5d23b8){_0x5d23b8=_0x5d23b8||0x1f4;return function(_0x54ad19){logger['error'](_0x54ad19['stack']);if(_0x54ad19[_0x4f05('0x26')]){delete _0x54ad19['name'];}_0x2c8134['status'](_0x5d23b8)[_0x4f05('0x27')](_0x54ad19);};}exports[_0x4f05('0x28')]=function(_0x5079ab,_0xcabc79){var _0x28c10f={},_0x132f04={},_0x162386={'count':0x0,'rows':[]};var _0x1fc61d=_[_0x4f05('0x29')](db[_0x4f05('0x2a')]['rawAttributes'],function(_0x5b817a){return{'name':_0x5b817a[_0x4f05('0x2b')],'type':_0x5b817a[_0x4f05('0x2c')][_0x4f05('0x2d')]};});_0x132f04[_0x4f05('0x2e')]=_['map'](_0x1fc61d,'name');_0x132f04['query']=_['keys'](_0x5079ab[_0x4f05('0x2f')]);_0x132f04[_0x4f05('0x30')]=_[_0x4f05('0x31')](_0x132f04[_0x4f05('0x2e')],_0x132f04[_0x4f05('0x2f')]);_0x28c10f['attributes']=_[_0x4f05('0x31')](_0x132f04[_0x4f05('0x2e')],qs[_0x4f05('0x32')](_0x5079ab['query'][_0x4f05('0x32')]));_0x28c10f[_0x4f05('0x33')]=_0x28c10f[_0x4f05('0x33')][_0x4f05('0x34')]?_0x28c10f[_0x4f05('0x33')]:_0x132f04[_0x4f05('0x2e')];if(!_0x5079ab['query'][_0x4f05('0x35')](_0x4f05('0x36'))){_0x28c10f[_0x4f05('0x1d')]=qs['limit'](_0x5079ab[_0x4f05('0x2f')][_0x4f05('0x1d')]);_0x28c10f['offset']=qs[_0x4f05('0x1c')](_0x5079ab[_0x4f05('0x2f')][_0x4f05('0x1c')]);}_0x28c10f[_0x4f05('0x37')]=qs[_0x4f05('0x38')](_0x5079ab[_0x4f05('0x2f')]['sort']);_0x28c10f[_0x4f05('0x39')]=qs[_0x4f05('0x30')](_[_0x4f05('0x3a')](_0x5079ab[_0x4f05('0x2f')],_0x132f04[_0x4f05('0x30')]),_0x1fc61d);if(_0x5079ab['query'][_0x4f05('0x3b')]){_0x28c10f['where']=_[_0x4f05('0x3c')](_0x28c10f[_0x4f05('0x39')],{'$or':_['map'](_0x1fc61d,function(_0x19f8b1){if(_0x19f8b1[_0x4f05('0x2c')]!==_0x4f05('0x3d')){var _0x37be7a={};_0x37be7a[_0x19f8b1[_0x4f05('0x26')]]={'$like':'%'+_0x5079ab[_0x4f05('0x2f')][_0x4f05('0x3b')]+'%'};return _0x37be7a;}})});}_0x28c10f=_[_0x4f05('0x3c')]({},_0x28c10f,_0x5079ab[_0x4f05('0x3e')]);var _0x1342f2={'where':_0x28c10f[_0x4f05('0x39')]};return db[_0x4f05('0x2a')][_0x4f05('0x1f')](_0x1342f2)[_0x4f05('0x25')](function(_0x42c097){_0x162386[_0x4f05('0x1f')]=_0x42c097;if(_0x5079ab[_0x4f05('0x2f')][_0x4f05('0x3f')]){_0x28c10f['include']=[{'all':!![]}];}return db[_0x4f05('0x2a')][_0x4f05('0x40')](_0x28c10f);})[_0x4f05('0x25')](function(_0x5305a8){_0x162386['rows']=_0x5305a8;return _0x162386;})[_0x4f05('0x25')](respondWithFilteredResult(_0xcabc79,_0x28c10f))[_0x4f05('0x41')](handleError(_0xcabc79,null));};exports[_0x4f05('0x42')]=function(_0x39b459,_0x3b3764){var _0x54443a={'raw':![],'where':{'id':_0x39b459[_0x4f05('0x43')]['id']}},_0x15281e={};_0x15281e[_0x4f05('0x2e')]=_['keys'](db[_0x4f05('0x2a')]['rawAttributes']);_0x15281e[_0x4f05('0x2f')]=_['keys'](_0x39b459[_0x4f05('0x2f')]);_0x15281e[_0x4f05('0x30')]=_[_0x4f05('0x31')](_0x15281e[_0x4f05('0x2e')],_0x15281e['query']);_0x54443a[_0x4f05('0x33')]=_['intersection'](_0x15281e[_0x4f05('0x2e')],qs['fields'](_0x39b459[_0x4f05('0x2f')][_0x4f05('0x32')]));_0x54443a[_0x4f05('0x33')]=_0x54443a[_0x4f05('0x33')][_0x4f05('0x34')]?_0x54443a[_0x4f05('0x33')]:_0x15281e['model'];if(_0x39b459['query'][_0x4f05('0x3f')]){_0x54443a[_0x4f05('0x44')]=[{'all':!![]}];}_0x54443a=_[_0x4f05('0x3c')]({},_0x54443a,_0x39b459[_0x4f05('0x3e')]);return db['FreshdeskConfiguration'][_0x4f05('0x45')](_0x54443a)[_0x4f05('0x25')](handleEntityNotFound(_0x3b3764,null))[_0x4f05('0x25')](respondWithResult(_0x3b3764,null))[_0x4f05('0x41')](handleError(_0x3b3764,null));};exports[_0x4f05('0x46')]=function(_0x1c2635,_0x1d806d){return db[_0x4f05('0x2a')][_0x4f05('0x46')](_0x1c2635['body'],{})[_0x4f05('0x25')](respondWithResult(_0x1d806d,0xc9))[_0x4f05('0x41')](handleError(_0x1d806d,null));};exports[_0x4f05('0x47')]=function(_0x19a02f,_0x221251){if(_0x19a02f[_0x4f05('0x48')]['id']){delete _0x19a02f[_0x4f05('0x48')]['id'];}return db[_0x4f05('0x2a')][_0x4f05('0x45')]({'where':{'id':_0x19a02f[_0x4f05('0x43')]['id']}})[_0x4f05('0x25')](handleEntityNotFound(_0x221251,null))[_0x4f05('0x25')](saveUpdates(_0x19a02f[_0x4f05('0x48')],null))[_0x4f05('0x25')](respondWithResult(_0x221251,null))[_0x4f05('0x41')](handleError(_0x221251,null));};exports[_0x4f05('0x49')]=function(_0x32f5bd,_0x1ec90d){return db[_0x4f05('0x2a')]['find']({'where':{'id':_0x32f5bd[_0x4f05('0x43')]['id']}})[_0x4f05('0x25')](handleEntityNotFound(_0x1ec90d,null))[_0x4f05('0x25')](removeEntity(_0x1ec90d,null))[_0x4f05('0x41')](handleError(_0x1ec90d,null));};exports[_0x4f05('0x4a')]=function(_0x25a635,_0x1f5ef2,_0x50b98d){var _0x368100={};var _0x195987={};var _0x5d3732;var _0xe0fc28;return db[_0x4f05('0x2a')]['findOne']({'where':{'id':_0x25a635[_0x4f05('0x43')]['id']}})[_0x4f05('0x25')](handleEntityNotFound(_0x1f5ef2,null))[_0x4f05('0x25')](function(_0x4de81e){if(_0x4de81e){_0x5d3732=_0x4de81e;_0x195987[_0x4f05('0x2e')]=_[_0x4f05('0x4b')](db[_0x4f05('0x4c')]['rawAttributes']);_0x195987[_0x4f05('0x2f')]=_[_0x4f05('0x4b')](_0x25a635[_0x4f05('0x2f')]);_0x195987[_0x4f05('0x30')]=_[_0x4f05('0x31')](_0x195987['model'],_0x195987[_0x4f05('0x2f')]);_0x368100['attributes']=_[_0x4f05('0x31')](_0x195987['model'],qs['fields'](_0x25a635[_0x4f05('0x2f')][_0x4f05('0x32')]));_0x368100[_0x4f05('0x33')]=_0x368100[_0x4f05('0x33')][_0x4f05('0x34')]?_0x368100[_0x4f05('0x33')]:_0x195987[_0x4f05('0x2e')];_0x368100[_0x4f05('0x37')]=qs[_0x4f05('0x38')](_0x25a635[_0x4f05('0x2f')]['sort']);_0x368100[_0x4f05('0x39')]=qs['filters'](_[_0x4f05('0x3a')](_0x25a635[_0x4f05('0x2f')],_0x195987[_0x4f05('0x30')]));if(_0x25a635[_0x4f05('0x2f')][_0x4f05('0x3b')]){_0x368100[_0x4f05('0x39')]=_[_0x4f05('0x3c')](_0x368100['where'],{'$or':_[_0x4f05('0x29')](_0x368100['attributes'],function(_0x5b57cf){var _0x1bc9a7={};_0x1bc9a7[_0x5b57cf]={'$like':'%'+_0x25a635['query'][_0x4f05('0x3b')]+'%'};return _0x1bc9a7;})});}_0x368100=_[_0x4f05('0x3c')]({},_0x368100,_0x25a635[_0x4f05('0x3e')]);return _0x5d3732[_0x4f05('0x4a')](_0x368100);}})[_0x4f05('0x25')](function(_0x1845c2){if(_0x1845c2){_0xe0fc28=_0x1845c2[_0x4f05('0x34')];if(!_0x25a635[_0x4f05('0x2f')][_0x4f05('0x35')](_0x4f05('0x36'))){_0x368100[_0x4f05('0x1d')]=qs[_0x4f05('0x1d')](_0x25a635[_0x4f05('0x2f')][_0x4f05('0x1d')]);_0x368100[_0x4f05('0x1c')]=qs[_0x4f05('0x1c')](_0x25a635['query'][_0x4f05('0x1c')]);}return _0x5d3732['getFields'](_0x368100);}})[_0x4f05('0x25')](function(_0x2ca3d0){if(_0x2ca3d0){return _0x2ca3d0?{'count':_0xe0fc28,'rows':_0x2ca3d0}:null;}})[_0x4f05('0x25')](respondWithResult(_0x1f5ef2,null))['catch'](handleError(_0x1f5ef2,null));};exports['getSubjects']=function(_0x182c7b,_0x54bd73,_0x5b41ae){var _0xd75709={};var _0x5565e2={};var _0x5c9783;var _0x40013c;return db[_0x4f05('0x2a')][_0x4f05('0x4d')]({'where':{'id':_0x182c7b[_0x4f05('0x43')]['id']}})['then'](handleEntityNotFound(_0x54bd73,null))[_0x4f05('0x25')](function(_0x5884fa){if(_0x5884fa){_0x5c9783=_0x5884fa;_0x5565e2[_0x4f05('0x2e')]=_[_0x4f05('0x4b')](db['FreshdeskField'][_0x4f05('0x4e')]);_0x5565e2['query']=_[_0x4f05('0x4b')](_0x182c7b['query']);_0x5565e2[_0x4f05('0x30')]=_[_0x4f05('0x31')](_0x5565e2[_0x4f05('0x2e')],_0x5565e2['query']);_0xd75709[_0x4f05('0x33')]=_['intersection'](_0x5565e2[_0x4f05('0x2e')],qs[_0x4f05('0x32')](_0x182c7b[_0x4f05('0x2f')][_0x4f05('0x32')]));_0xd75709[_0x4f05('0x33')]=_0xd75709[_0x4f05('0x33')]['length']?_0xd75709[_0x4f05('0x33')]:_0x5565e2[_0x4f05('0x2e')];_0xd75709[_0x4f05('0x37')]=qs[_0x4f05('0x38')](_0x182c7b[_0x4f05('0x2f')][_0x4f05('0x38')]);_0xd75709[_0x4f05('0x39')]=qs[_0x4f05('0x30')](_['pick'](_0x182c7b['query'],_0x5565e2[_0x4f05('0x30')]));if(_0x182c7b[_0x4f05('0x2f')][_0x4f05('0x3b')]){_0xd75709['where']=_[_0x4f05('0x3c')](_0xd75709['where'],{'$or':_[_0x4f05('0x29')](_0xd75709['attributes'],function(_0x1bb58f){var _0x50e273={};_0x50e273[_0x1bb58f]={'$like':'%'+_0x182c7b[_0x4f05('0x2f')][_0x4f05('0x3b')]+'%'};return _0x50e273;})});}_0xd75709=_['merge']({},_0xd75709,_0x182c7b[_0x4f05('0x3e')]);return _0x5c9783[_0x4f05('0x4f')](_0xd75709);}})['then'](function(_0x2f2dc4){if(_0x2f2dc4){_0x40013c=_0x2f2dc4[_0x4f05('0x34')];if(!_0x182c7b[_0x4f05('0x2f')][_0x4f05('0x35')]('nolimit')){_0xd75709[_0x4f05('0x1d')]=qs[_0x4f05('0x1d')](_0x182c7b[_0x4f05('0x2f')][_0x4f05('0x1d')]);_0xd75709[_0x4f05('0x1c')]=qs[_0x4f05('0x1c')](_0x182c7b[_0x4f05('0x2f')]['offset']);}return _0x5c9783[_0x4f05('0x4f')](_0xd75709);}})[_0x4f05('0x25')](function(_0x2bc110){if(_0x2bc110){return _0x2bc110?{'count':_0x40013c,'rows':_0x2bc110}:null;}})['then'](respondWithResult(_0x54bd73,null))[_0x4f05('0x41')](handleError(_0x54bd73,null));};exports[_0x4f05('0x50')]=function(_0xf7ba4a,_0x28195a,_0x59c337){var _0x465196={};var _0x1a1d88={};var _0x4c79bc;var _0x1203c3;return db[_0x4f05('0x2a')]['findOne']({'where':{'id':_0xf7ba4a[_0x4f05('0x43')]['id']}})[_0x4f05('0x25')](handleEntityNotFound(_0x28195a,null))[_0x4f05('0x25')](function(_0x2f81f5){if(_0x2f81f5){_0x4c79bc=_0x2f81f5;_0x1a1d88['model']=_[_0x4f05('0x4b')](db[_0x4f05('0x4c')]['rawAttributes']);_0x1a1d88[_0x4f05('0x2f')]=_[_0x4f05('0x4b')](_0xf7ba4a['query']);_0x1a1d88[_0x4f05('0x30')]=_['intersection'](_0x1a1d88[_0x4f05('0x2e')],_0x1a1d88[_0x4f05('0x2f')]);_0x465196[_0x4f05('0x33')]=_[_0x4f05('0x31')](_0x1a1d88[_0x4f05('0x2e')],qs[_0x4f05('0x32')](_0xf7ba4a['query']['fields']));_0x465196['attributes']=_0x465196['attributes'][_0x4f05('0x34')]?_0x465196['attributes']:_0x1a1d88[_0x4f05('0x2e')];_0x465196[_0x4f05('0x37')]=qs[_0x4f05('0x38')](_0xf7ba4a['query'][_0x4f05('0x38')]);_0x465196[_0x4f05('0x39')]=qs['filters'](_[_0x4f05('0x3a')](_0xf7ba4a[_0x4f05('0x2f')],_0x1a1d88[_0x4f05('0x30')]));if(_0xf7ba4a[_0x4f05('0x2f')][_0x4f05('0x3b')]){_0x465196[_0x4f05('0x39')]=_['merge'](_0x465196['where'],{'$or':_[_0x4f05('0x29')](_0x465196['attributes'],function(_0x1d1cc3){var _0x4e785d={};_0x4e785d[_0x1d1cc3]={'$like':'%'+_0xf7ba4a[_0x4f05('0x2f')][_0x4f05('0x3b')]+'%'};return _0x4e785d;})});}_0x465196=_['merge']({},_0x465196,_0xf7ba4a[_0x4f05('0x3e')]);return _0x4c79bc[_0x4f05('0x50')](_0x465196);}})[_0x4f05('0x25')](function(_0x15e0da){if(_0x15e0da){_0x1203c3=_0x15e0da[_0x4f05('0x34')];if(!_0xf7ba4a['query'][_0x4f05('0x35')](_0x4f05('0x36'))){_0x465196[_0x4f05('0x1d')]=qs['limit'](_0xf7ba4a[_0x4f05('0x2f')][_0x4f05('0x1d')]);_0x465196[_0x4f05('0x1c')]=qs[_0x4f05('0x1c')](_0xf7ba4a['query'][_0x4f05('0x1c')]);}return _0x4c79bc[_0x4f05('0x50')](_0x465196);}})[_0x4f05('0x25')](function(_0x5c5e4a){if(_0x5c5e4a){return _0x5c5e4a?{'count':_0x1203c3,'rows':_0x5c5e4a}:null;}})[_0x4f05('0x25')](respondWithResult(_0x28195a,null))['catch'](handleError(_0x28195a,null));};exports['getTags']=function(_0x58dcea,_0x3dd175,_0x3f0d20){var _0x5bbcb4={};var _0x541c18={};var _0x114b45;var _0x586c61;return db[_0x4f05('0x2a')][_0x4f05('0x4d')]({'where':{'id':_0x58dcea[_0x4f05('0x43')]['id']}})[_0x4f05('0x25')](handleEntityNotFound(_0x3dd175,null))[_0x4f05('0x25')](function(_0x4304bb){if(_0x4304bb){_0x114b45=_0x4304bb;_0x541c18[_0x4f05('0x2e')]=_['keys'](db['Tag']['rawAttributes']);_0x541c18[_0x4f05('0x2f')]=_['keys'](_0x58dcea[_0x4f05('0x2f')]);_0x541c18[_0x4f05('0x30')]=_[_0x4f05('0x31')](_0x541c18[_0x4f05('0x2e')],_0x541c18[_0x4f05('0x2f')]);_0x5bbcb4[_0x4f05('0x33')]=_['intersection'](_0x541c18[_0x4f05('0x2e')],qs[_0x4f05('0x32')](_0x58dcea[_0x4f05('0x2f')][_0x4f05('0x32')]));_0x5bbcb4[_0x4f05('0x33')]=_0x5bbcb4[_0x4f05('0x33')]['length']?_0x5bbcb4['attributes']:_0x541c18['model'];_0x5bbcb4['order']=qs[_0x4f05('0x38')](_0x58dcea[_0x4f05('0x2f')][_0x4f05('0x38')]);_0x5bbcb4[_0x4f05('0x39')]=qs[_0x4f05('0x30')](_['pick'](_0x58dcea[_0x4f05('0x2f')],_0x541c18[_0x4f05('0x30')]));if(_0x58dcea[_0x4f05('0x2f')]['filter']){_0x5bbcb4[_0x4f05('0x39')]=_['merge'](_0x5bbcb4[_0x4f05('0x39')],{'$or':_[_0x4f05('0x29')](_0x5bbcb4[_0x4f05('0x33')],function(_0x5f0bc7){var _0x2c4ddd={};_0x2c4ddd[_0x5f0bc7]={'$like':'%'+_0x58dcea[_0x4f05('0x2f')][_0x4f05('0x3b')]+'%'};return _0x2c4ddd;})});}_0x5bbcb4=_[_0x4f05('0x3c')]({},_0x5bbcb4,_0x58dcea[_0x4f05('0x3e')]);return _0x114b45[_0x4f05('0x51')](_0x5bbcb4);}})[_0x4f05('0x25')](function(_0x1cb884){if(_0x1cb884){_0x586c61=_0x1cb884[_0x4f05('0x34')];if(!_0x58dcea[_0x4f05('0x2f')][_0x4f05('0x35')](_0x4f05('0x36'))){_0x5bbcb4[_0x4f05('0x1d')]=qs[_0x4f05('0x1d')](_0x58dcea[_0x4f05('0x2f')][_0x4f05('0x1d')]);_0x5bbcb4['offset']=qs['offset'](_0x58dcea['query'][_0x4f05('0x1c')]);}return _0x114b45[_0x4f05('0x51')](_0x5bbcb4);}})[_0x4f05('0x25')](function(_0x562eab){if(_0x562eab){return _0x562eab?{'count':_0x586c61,'rows':_0x562eab}:null;}})[_0x4f05('0x25')](respondWithResult(_0x3dd175,null))['catch'](handleError(_0x3dd175,null));};exports['setTags']=function(_0x3f7430,_0x3eeb6a,_0x48b3b7){if(_0x3f7430[_0x4f05('0x48')]['id']){delete _0x3f7430['body']['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x3f7430[_0x4f05('0x43')]['id']}})[_0x4f05('0x25')](handleEntityNotFound(_0x3eeb6a,null))[_0x4f05('0x25')](function(_0x1462d7){if(_0x1462d7){return _0x1462d7[_0x4f05('0x52')](_0x3f7430[_0x4f05('0x48')][_0x4f05('0x53')]||[]);}return null;})[_0x4f05('0x25')](respondWithResult(_0x3eeb6a,null))[_0x4f05('0x41')](handleError(_0x3eeb6a,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 07139b9..7b81763 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 _0x81cd=['define','FreshdeskConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','exports'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x81cd,0x1e6));var _0xd81c=function(_0x5ed06c,_0x1a16e6){_0x5ed06c=_0x5ed06c-0x0;var _0x4087e9=_0x81cd[_0x5ed06c];return _0x4087e9;};'use strict';var _=require(_0xd81c('0x0'));var util=require(_0xd81c('0x1'));var logger=require(_0xd81c('0x2'))(_0xd81c('0x3'));var moment=require(_0xd81c('0x4'));var BPromise=require(_0xd81c('0x5'));var rp=require(_0xd81c('0x6'));var fs=require('fs');var path=require(_0xd81c('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xd81c('0x8')]=function(_0xefafc8,_0x51cb42){return _0xefafc8[_0xd81c('0x9')](_0xd81c('0xa'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4348=['request-promise','path','rimraf','../../config/environment','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','moment','bluebird'];(function(_0x5aef17,_0x592cd4){var _0x43f9d0=function(_0x49ea9c){while(--_0x49ea9c){_0x5aef17['push'](_0x5aef17['shift']());}};_0x43f9d0(++_0x592cd4);}(_0x4348,0x158));var _0x8434=function(_0x4ef916,_0xb5e076){_0x4ef916=_0x4ef916-0x0;var _0x22633d=_0x4348[_0x4ef916];return _0x22633d;};'use strict';var _=require(_0x8434('0x0'));var util=require(_0x8434('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8434('0x2'));var BPromise=require(_0x8434('0x3'));var rp=require(_0x8434('0x4'));var fs=require('fs');var path=require(_0x8434('0x5'));var rimraf=require(_0x8434('0x6'));var config=require(_0x8434('0x7'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x8434('0x8')]=function(_0x199cfc,_0x54b3bd){return _0x199cfc[_0x8434('0x9')](_0x8434('0xa'),attributes,{'tableName':_0x8434('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 302ce8b..a97f3de 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 _0x6abb=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6abb,0x105));var _0xb6ab=function(_0x3146b9,_0x4a6a0f){_0x3146b9=_0x3146b9-0x0;var _0x170dce=_0x6abb[_0x3146b9];return _0x170dce;};'use strict';var _=require('lodash');var util=require(_0xb6ab('0x0'));var moment=require(_0xb6ab('0x1'));var BPromise=require(_0xb6ab('0x2'));var rs=require(_0xb6ab('0x3'));var fs=require('fs');var Redis=require(_0xb6ab('0x4'));var db=require(_0xb6ab('0x5'))['db'];var utils=require(_0xb6ab('0x6'));var logger=require(_0xb6ab('0x7'))(_0xb6ab('0x8'));var config=require(_0xb6ab('0x9'));var jayson=require(_0xb6ab('0xa'));var client=jayson[_0xb6ab('0xb')][_0xb6ab('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x29a757,_0x4b49de,_0x57dcd6){return new BPromise(function(_0x426335,_0x289e86){return client[_0xb6ab('0xd')](_0x29a757,_0x57dcd6)[_0xb6ab('0xe')](function(_0x2971bf){logger[_0xb6ab('0xf')](_0xb6ab('0x10'),_0x4b49de,_0xb6ab('0x11'));logger[_0xb6ab('0x12')](_0xb6ab('0x13'),_0x4b49de,'request\x20sent',JSON[_0xb6ab('0x14')](_0x2971bf));if(_0x2971bf[_0xb6ab('0x15')]){if(_0x2971bf['error'][_0xb6ab('0x16')]===0x1f4){logger[_0xb6ab('0x15')](_0xb6ab('0x10'),_0x4b49de,_0x2971bf['error']['message']);return _0x289e86(_0x2971bf[_0xb6ab('0x15')][_0xb6ab('0x17')]);}logger[_0xb6ab('0x15')](_0xb6ab('0x10'),_0x4b49de,_0x2971bf[_0xb6ab('0x15')][_0xb6ab('0x17')]);return _0x426335(_0x2971bf[_0xb6ab('0x15')][_0xb6ab('0x17')]);}else{logger['info'](_0xb6ab('0x10'),_0x4b49de,'request\x20sent');_0x426335(_0x2971bf[_0xb6ab('0x18')]['message']);}})[_0xb6ab('0x19')](function(_0x4d5c6a){logger['error'](_0xb6ab('0x10'),_0x4b49de,_0x4d5c6a);_0x289e86(_0x4d5c6a);});});} \ No newline at end of file +var _0x97ab=['request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x97ab,0x151));var _0xb97a=function(_0x4a6523,_0x5d5cfa){_0x4a6523=_0x4a6523-0x0;var _0x426d14=_0x97ab[_0x4a6523];return _0x426d14;};'use strict';var _=require(_0xb97a('0x0'));var util=require('util');var moment=require(_0xb97a('0x1'));var BPromise=require(_0xb97a('0x2'));var rs=require(_0xb97a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb97a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb97a('0x5'))('rpc');var config=require(_0xb97a('0x6'));var jayson=require(_0xb97a('0x7'));var client=jayson[_0xb97a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21c882,_0x824bd0,_0x365168){return new BPromise(function(_0xa6dc8,_0x2c8fdf){return client[_0xb97a('0x9')](_0x21c882,_0x365168)[_0xb97a('0xa')](function(_0x30c61d){logger[_0xb97a('0xb')](_0xb97a('0xc'),_0x824bd0,'request\x20sent');logger[_0xb97a('0xd')](_0xb97a('0xe'),_0x824bd0,_0xb97a('0xf'),JSON[_0xb97a('0x10')](_0x30c61d));if(_0x30c61d[_0xb97a('0x11')]){if(_0x30c61d[_0xb97a('0x11')][_0xb97a('0x12')]===0x1f4){logger[_0xb97a('0x11')](_0xb97a('0xc'),_0x824bd0,_0x30c61d[_0xb97a('0x11')][_0xb97a('0x13')]);return _0x2c8fdf(_0x30c61d['error'][_0xb97a('0x13')]);}logger['error'](_0xb97a('0xc'),_0x824bd0,_0x30c61d[_0xb97a('0x11')][_0xb97a('0x13')]);return _0xa6dc8(_0x30c61d[_0xb97a('0x11')][_0xb97a('0x13')]);}else{logger['info'](_0xb97a('0xc'),_0x824bd0,'request\x20sent');_0xa6dc8(_0x30c61d[_0xb97a('0x14')][_0xb97a('0x13')]);}})[_0xb97a('0x15')](function(_0x1f9633){logger['error'](_0xb97a('0xc'),_0x824bd0,_0x1f9633);_0x2c8fdf(_0x1f9633);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 5ef1f87..e055470 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 _0xb5c5=['destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','/:id','post','put','update','delete'];(function(_0x104dd3,_0x9e170){var _0x476695=function(_0x301c05){while(--_0x301c05){_0x104dd3['push'](_0x104dd3['shift']());}};_0x476695(++_0x9e170);}(_0xb5c5,0x122));var _0x5b5c=function(_0x3e2cd3,_0x83af6f){_0x3e2cd3=_0x3e2cd3-0x0;var _0x4b7499=_0xb5c5[_0x3e2cd3];return _0x4b7499;};'use strict';var multer=require(_0x5b5c('0x0'));var util=require('util');var path=require(_0x5b5c('0x1'));var timeout=require(_0x5b5c('0x2'));var express=require('express');var router=express[_0x5b5c('0x3')]();var fs_extra=require(_0x5b5c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5b5c('0x5'));var controller=require(_0x5b5c('0x6'));router['get']('/',auth[_0x5b5c('0x7')](),controller[_0x5b5c('0x8')]);router['get'](_0x5b5c('0x9'),auth[_0x5b5c('0x7')](),controller['show']);router[_0x5b5c('0xa')]('/',auth[_0x5b5c('0x7')](),controller['create']);router[_0x5b5c('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x5b5c('0xc')]);router[_0x5b5c('0xd')]('/:id',auth[_0x5b5c('0x7')](),controller[_0x5b5c('0xe')]);module[_0x5b5c('0xf')]=router; \ No newline at end of file +var _0xce30=['create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xce30,0x12c));var _0x0ce3=function(_0x2f982e,_0x36b665){_0x2f982e=_0x2f982e-0x0;var _0x12cf04=_0xce30[_0x2f982e];return _0x12cf04;};'use strict';var multer=require(_0x0ce3('0x0'));var util=require(_0x0ce3('0x1'));var path=require(_0x0ce3('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ce3('0x3'));var router=express[_0x0ce3('0x4')]();var fs_extra=require(_0x0ce3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0ce3('0x6'));var config=require(_0x0ce3('0x7'));var controller=require(_0x0ce3('0x8'));router[_0x0ce3('0x9')]('/',auth[_0x0ce3('0xa')](),controller[_0x0ce3('0xb')]);router['get'](_0x0ce3('0xc'),auth[_0x0ce3('0xa')](),controller[_0x0ce3('0xd')]);router[_0x0ce3('0xe')]('/',auth[_0x0ce3('0xa')](),controller[_0x0ce3('0xf')]);router[_0x0ce3('0x10')](_0x0ce3('0xc'),auth[_0x0ce3('0xa')](),controller[_0x0ce3('0x11')]);router[_0x0ce3('0x12')](_0x0ce3('0xc'),auth[_0x0ce3('0xa')](),controller[_0x0ce3('0x13')]);module[_0x0ce3('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 3397368..7cb73ce 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 _0xe9c1=['ENUM','string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize'];(function(_0x3018b6,_0x461070){var _0x41c826=function(_0x9e5d9f){while(--_0x9e5d9f){_0x3018b6['push'](_0x3018b6['shift']());}};_0x41c826(++_0x461070);}(_0xe9c1,0x74));var _0x1e9c=function(_0x3e3dcf,_0x5c491c){_0x3e3dcf=_0x3e3dcf-0x0;var _0x377106=_0xe9c1[_0x3e3dcf];return _0x377106;};'use strict';var Sequelize=require(_0x1e9c('0x0'));module['exports']={'type':{'type':Sequelize[_0x1e9c('0x1')](_0x1e9c('0x2'),_0x1e9c('0x3'),'customVariable',_0x1e9c('0x4'),_0x1e9c('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1e9c('0x6')]},'keyType':{'type':Sequelize[_0x1e9c('0x1')](_0x1e9c('0x2'),_0x1e9c('0x3'),_0x1e9c('0x7'))},'keyContent':{'type':Sequelize[_0x1e9c('0x6')]},'idField':{'type':Sequelize[_0x1e9c('0x6')]},'nameField':{'type':Sequelize[_0x1e9c('0x6')]},'customField':{'type':Sequelize[_0x1e9c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1e9c('0x6')]}}; \ No newline at end of file +var _0x767c=['BOOLEAN','exports','ENUM','string','variable','keyValue','picklist','STRING'];(function(_0x4863cd,_0x3756f0){var _0x97994a=function(_0x57dd4e){while(--_0x57dd4e){_0x4863cd['push'](_0x4863cd['shift']());}};_0x97994a(++_0x3756f0);}(_0x767c,0xa9));var _0xc767=function(_0x36763a,_0x226c89){_0x36763a=_0x36763a-0x0;var _0x189753=_0x767c[_0x36763a];return _0x189753;};'use strict';var Sequelize=require('sequelize');module[_0xc767('0x0')]={'type':{'type':Sequelize[_0xc767('0x1')](_0xc767('0x2'),_0xc767('0x3'),'customVariable',_0xc767('0x4'),_0xc767('0x5')),'defaultValue':_0xc767('0x2')},'content':{'type':Sequelize[_0xc767('0x6')]},'key':{'type':Sequelize[_0xc767('0x6')]},'keyType':{'type':Sequelize[_0xc767('0x1')]('string',_0xc767('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xc767('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc767('0x6')]},'customField':{'type':Sequelize[_0xc767('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc767('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 53e3499..1663668 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 _0x073e=['length','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskField','rawAttributes','type','key','keys','query','filters','attributes','model','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','intersection'];(function(_0x40b813,_0x31bf5a){var _0x311b4c=function(_0x2ea636){while(--_0x2ea636){_0x40b813['push'](_0x40b813['shift']());}};_0x311b4c(++_0x31bf5a);}(_0x073e,0x181));var _0xe073=function(_0x5484bf,_0x26fd67){_0x5484bf=_0x5484bf-0x0;var _0x107c4f=_0x073e[_0x5484bf];return _0x107c4f;};'use strict';var emlformat=require(_0xe073('0x0'));var rimraf=require(_0xe073('0x1'));var zipdir=require(_0xe073('0x2'));var jsonpatch=require(_0xe073('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe073('0x4'));var util=require(_0xe073('0x5'));var path=require(_0xe073('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe073('0x7'));var _=require(_0xe073('0x8'));var squel=require(_0xe073('0x9'));var crypto=require(_0xe073('0xa'));var jsforce=require(_0xe073('0xb'));var deskjs=require(_0xe073('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe073('0xd'));var Papa=require(_0xe073('0xe'));var Redis=require(_0xe073('0xf'));var authService=require(_0xe073('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe073('0x11'));var hardwareService=require(_0xe073('0x12'));var logger=require(_0xe073('0x13'))(_0xe073('0x14'));var utils=require(_0xe073('0x15'));var config=require(_0xe073('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe073('0x17'))['db'];function respondWithStatusCode(_0x56e3f5,_0x3dedf7){_0x3dedf7=_0x3dedf7||0xcc;return function(_0x5d2f2f){if(_0x5d2f2f){return _0x56e3f5[_0xe073('0x18')](_0x3dedf7);}return _0x56e3f5['status'](_0x3dedf7)[_0xe073('0x19')]();};}function respondWithResult(_0x27d34,_0x47828d){_0x47828d=_0x47828d||0xc8;return function(_0x2ce92d){if(_0x2ce92d){return _0x27d34[_0xe073('0x1a')](_0x47828d)[_0xe073('0x1b')](_0x2ce92d);}};}function respondWithFilteredResult(_0x2f4b36,_0xfb28f5){return function(_0x208f2e){if(_0x208f2e){var _0x26f3d3=typeof _0xfb28f5[_0xe073('0x1c')]==='undefined'&&typeof _0xfb28f5['limit']==='undefined';var _0x4c578c=_0x208f2e[_0xe073('0x1d')];var _0x10486c=_0x26f3d3?0x0:_0xfb28f5[_0xe073('0x1c')];var _0x4f9c8e=_0x26f3d3?_0x208f2e[_0xe073('0x1d')]:_0xfb28f5[_0xe073('0x1c')]+_0xfb28f5[_0xe073('0x1e')];var _0x54c10e;if(_0x4f9c8e>=_0x4c578c){_0x4f9c8e=_0x4c578c;_0x54c10e=0xc8;}else{_0x54c10e=0xce;}_0x2f4b36[_0xe073('0x1a')](_0x54c10e);return _0x2f4b36[_0xe073('0x1f')](_0xe073('0x20'),_0x10486c+'-'+_0x4f9c8e+'/'+_0x4c578c)[_0xe073('0x1b')](_0x208f2e);}return null;};}function patchUpdates(_0x43668e){return function(_0x17dd4b){try{jsonpatch[_0xe073('0x21')](_0x17dd4b,_0x43668e,!![]);}catch(_0x1d7a13){return BPromise[_0xe073('0x22')](_0x1d7a13);}return _0x17dd4b[_0xe073('0x23')]();};}function saveUpdates(_0x5143fa,_0x4405fd){return function(_0x21f9c2){if(_0x21f9c2){return _0x21f9c2[_0xe073('0x24')](_0x5143fa)[_0xe073('0x25')](function(_0x39bcb4){return _0x39bcb4;});}return null;};}function removeEntity(_0x275aa8,_0x504c26){return function(_0x4c76ef){if(_0x4c76ef){return _0x4c76ef[_0xe073('0x26')]()['then'](function(){_0x275aa8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c4137,_0x54a38b){return function(_0x50795f){if(!_0x50795f){_0x5c4137[_0xe073('0x18')](0x194);}return _0x50795f;};}function handleError(_0xff003,_0x5bd226){_0x5bd226=_0x5bd226||0x1f4;return function(_0x1fca27){logger[_0xe073('0x27')](_0x1fca27[_0xe073('0x28')]);if(_0x1fca27['name']){delete _0x1fca27[_0xe073('0x29')];}_0xff003['status'](_0x5bd226)[_0xe073('0x2a')](_0x1fca27);};}exports[_0xe073('0x2b')]=function(_0x599972,_0x5dfff9){var _0x15adbb={},_0x859ed8={},_0x278fbb={'count':0x0,'rows':[]};var _0x2f1cd2=_[_0xe073('0x2c')](db[_0xe073('0x2d')][_0xe073('0x2e')],function(_0x2a206a){return{'name':_0x2a206a['fieldName'],'type':_0x2a206a[_0xe073('0x2f')][_0xe073('0x30')]};});_0x859ed8['model']=_['map'](_0x2f1cd2,_0xe073('0x29'));_0x859ed8['query']=_[_0xe073('0x31')](_0x599972[_0xe073('0x32')]);_0x859ed8[_0xe073('0x33')]=_['intersection'](_0x859ed8['model'],_0x859ed8[_0xe073('0x32')]);_0x15adbb[_0xe073('0x34')]=_['intersection'](_0x859ed8[_0xe073('0x35')],qs[_0xe073('0x36')](_0x599972[_0xe073('0x32')]['fields']));_0x15adbb[_0xe073('0x34')]=_0x15adbb['attributes']['length']?_0x15adbb[_0xe073('0x34')]:_0x859ed8[_0xe073('0x35')];if(!_0x599972[_0xe073('0x32')]['hasOwnProperty'](_0xe073('0x37'))){_0x15adbb[_0xe073('0x1e')]=qs[_0xe073('0x1e')](_0x599972['query'][_0xe073('0x1e')]);_0x15adbb[_0xe073('0x1c')]=qs[_0xe073('0x1c')](_0x599972[_0xe073('0x32')][_0xe073('0x1c')]);}_0x15adbb[_0xe073('0x38')]=qs['sort'](_0x599972[_0xe073('0x32')][_0xe073('0x39')]);_0x15adbb[_0xe073('0x3a')]=qs['filters'](_[_0xe073('0x3b')](_0x599972[_0xe073('0x32')],_0x859ed8[_0xe073('0x33')]),_0x2f1cd2);if(_0x599972[_0xe073('0x32')][_0xe073('0x3c')]){_0x15adbb['where']=_[_0xe073('0x3d')](_0x15adbb['where'],{'$or':_[_0xe073('0x2c')](_0x2f1cd2,function(_0x22d278){if(_0x22d278[_0xe073('0x2f')]!==_0xe073('0x3e')){var _0x40f991={};_0x40f991[_0x22d278[_0xe073('0x29')]]={'$like':'%'+_0x599972[_0xe073('0x32')][_0xe073('0x3c')]+'%'};return _0x40f991;}})});}_0x15adbb=_[_0xe073('0x3d')]({},_0x15adbb,_0x599972[_0xe073('0x3f')]);var _0x12976c={'where':_0x15adbb[_0xe073('0x3a')]};return db[_0xe073('0x2d')]['count'](_0x12976c)[_0xe073('0x25')](function(_0x577c87){_0x278fbb[_0xe073('0x1d')]=_0x577c87;if(_0x599972[_0xe073('0x32')][_0xe073('0x40')]){_0x15adbb[_0xe073('0x41')]=[{'all':!![]}];}return db['FreshdeskField'][_0xe073('0x42')](_0x15adbb);})[_0xe073('0x25')](function(_0x93852a){_0x278fbb[_0xe073('0x43')]=_0x93852a;return _0x278fbb;})[_0xe073('0x25')](respondWithFilteredResult(_0x5dfff9,_0x15adbb))['catch'](handleError(_0x5dfff9,null));};exports[_0xe073('0x44')]=function(_0x4b2a82,_0x764196){var _0x2a8c57={'raw':!![],'where':{'id':_0x4b2a82[_0xe073('0x45')]['id']}},_0x125d1f={};_0x125d1f[_0xe073('0x35')]=_[_0xe073('0x31')](db[_0xe073('0x2d')][_0xe073('0x2e')]);_0x125d1f[_0xe073('0x32')]=_[_0xe073('0x31')](_0x4b2a82[_0xe073('0x32')]);_0x125d1f['filters']=_['intersection'](_0x125d1f[_0xe073('0x35')],_0x125d1f[_0xe073('0x32')]);_0x2a8c57[_0xe073('0x34')]=_[_0xe073('0x46')](_0x125d1f[_0xe073('0x35')],qs['fields'](_0x4b2a82[_0xe073('0x32')][_0xe073('0x36')]));_0x2a8c57[_0xe073('0x34')]=_0x2a8c57[_0xe073('0x34')][_0xe073('0x47')]?_0x2a8c57['attributes']:_0x125d1f[_0xe073('0x35')];if(_0x4b2a82['query']['includeAll']){_0x2a8c57[_0xe073('0x41')]=[{'all':!![]}];}_0x2a8c57=_[_0xe073('0x3d')]({},_0x2a8c57,_0x4b2a82['options']);return db['FreshdeskField'][_0xe073('0x48')](_0x2a8c57)[_0xe073('0x25')](handleEntityNotFound(_0x764196,null))[_0xe073('0x25')](respondWithResult(_0x764196,null))[_0xe073('0x49')](handleError(_0x764196,null));};exports[_0xe073('0x4a')]=function(_0x1eec23,_0x317159){return db['FreshdeskField'][_0xe073('0x4a')](_0x1eec23['body'],{})[_0xe073('0x25')](respondWithResult(_0x317159,0xc9))[_0xe073('0x49')](handleError(_0x317159,null));};exports[_0xe073('0x24')]=function(_0x4e1f1d,_0x4d5bcd){if(_0x4e1f1d[_0xe073('0x4b')]['id']){delete _0x4e1f1d[_0xe073('0x4b')]['id'];}return db[_0xe073('0x2d')]['find']({'where':{'id':_0x4e1f1d[_0xe073('0x45')]['id']}})[_0xe073('0x25')](handleEntityNotFound(_0x4d5bcd,null))[_0xe073('0x25')](saveUpdates(_0x4e1f1d[_0xe073('0x4b')],null))[_0xe073('0x25')](respondWithResult(_0x4d5bcd,null))[_0xe073('0x49')](handleError(_0x4d5bcd,null));};exports[_0xe073('0x26')]=function(_0x307541,_0x3238eb){return db['FreshdeskField'][_0xe073('0x48')]({'where':{'id':_0x307541['params']['id']}})[_0xe073('0x25')](handleEntityNotFound(_0x3238eb,null))['then'](removeEntity(_0x3238eb,null))[_0xe073('0x49')](handleError(_0x3238eb,null));}; \ No newline at end of file +var _0x1152=['stack','name','index','map','FreshdeskField','rawAttributes','key','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','findAll','show','keys','include','merge','create','body','catch','update','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error'];(function(_0x58e3be,_0x691ccf){var _0x4e78c8=function(_0x1b6552){while(--_0x1b6552){_0x58e3be['push'](_0x58e3be['shift']());}};_0x4e78c8(++_0x691ccf);}(_0x1152,0x182));var _0x2115=function(_0x467c05,_0x2cbb49){_0x467c05=_0x467c05-0x0;var _0x192eee=_0x1152[_0x467c05];return _0x192eee;};'use strict';var emlformat=require(_0x2115('0x0'));var rimraf=require(_0x2115('0x1'));var zipdir=require(_0x2115('0x2'));var jsonpatch=require(_0x2115('0x3'));var rp=require(_0x2115('0x4'));var moment=require(_0x2115('0x5'));var BPromise=require(_0x2115('0x6'));var Mustache=require(_0x2115('0x7'));var util=require('util');var path=require(_0x2115('0x8'));var sox=require('sox');var csv=require(_0x2115('0x9'));var ejs=require(_0x2115('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2115('0xb'));var toCsv=require(_0x2115('0x9'));var querystring=require(_0x2115('0xc'));var Papa=require('papaparse');var Redis=require(_0x2115('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2115('0xe'));var hardwareService=require(_0x2115('0xf'));var logger=require(_0x2115('0x10'))('api');var utils=require(_0x2115('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x2115('0x12'));var db=require(_0x2115('0x13'))['db'];function respondWithStatusCode(_0x2bb885,_0x33d38b){_0x33d38b=_0x33d38b||0xcc;return function(_0x22475e){if(_0x22475e){return _0x2bb885['sendStatus'](_0x33d38b);}return _0x2bb885[_0x2115('0x14')](_0x33d38b)['end']();};}function respondWithResult(_0x3727a3,_0x38e406){_0x38e406=_0x38e406||0xc8;return function(_0x17028e){if(_0x17028e){return _0x3727a3[_0x2115('0x14')](_0x38e406)[_0x2115('0x15')](_0x17028e);}};}function respondWithFilteredResult(_0x113ce2,_0x350969){return function(_0x5e8f81){if(_0x5e8f81){var _0xdf3e24=typeof _0x350969[_0x2115('0x16')]===_0x2115('0x17')&&typeof _0x350969[_0x2115('0x18')]===_0x2115('0x17');var _0x1bdef9=_0x5e8f81[_0x2115('0x19')];var _0x77e2c6=_0xdf3e24?0x0:_0x350969['offset'];var _0x154f69=_0xdf3e24?_0x5e8f81[_0x2115('0x19')]:_0x350969[_0x2115('0x16')]+_0x350969['limit'];var _0x2dfb3c;if(_0x154f69>=_0x1bdef9){_0x154f69=_0x1bdef9;_0x2dfb3c=0xc8;}else{_0x2dfb3c=0xce;}_0x113ce2[_0x2115('0x14')](_0x2dfb3c);return _0x113ce2[_0x2115('0x1a')](_0x2115('0x1b'),_0x77e2c6+'-'+_0x154f69+'/'+_0x1bdef9)[_0x2115('0x15')](_0x5e8f81);}return null;};}function patchUpdates(_0xcc2d7b){return function(_0x21d079){try{jsonpatch[_0x2115('0x1c')](_0x21d079,_0xcc2d7b,!![]);}catch(_0x464af4){return BPromise[_0x2115('0x1d')](_0x464af4);}return _0x21d079[_0x2115('0x1e')]();};}function saveUpdates(_0x8b7304,_0x8e37c){return function(_0x13fde1){if(_0x13fde1){return _0x13fde1['update'](_0x8b7304)[_0x2115('0x1f')](function(_0x340c42){return _0x340c42;});}return null;};}function removeEntity(_0x40d19f,_0x4ac436){return function(_0x27c2f5){if(_0x27c2f5){return _0x27c2f5[_0x2115('0x20')]()['then'](function(){_0x40d19f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x201c94,_0x5e9d07){return function(_0x1a2ec3){if(!_0x1a2ec3){_0x201c94['sendStatus'](0x194);}return _0x1a2ec3;};}function handleError(_0x1283ec,_0x115800){_0x115800=_0x115800||0x1f4;return function(_0x1b7f47){logger[_0x2115('0x21')](_0x1b7f47[_0x2115('0x22')]);if(_0x1b7f47['name']){delete _0x1b7f47[_0x2115('0x23')];}_0x1283ec[_0x2115('0x14')](_0x115800)['send'](_0x1b7f47);};}exports[_0x2115('0x24')]=function(_0x33d81c,_0x26eff7){var _0x1262e7={},_0x59ca70={},_0x19c595={'count':0x0,'rows':[]};var _0x15229e=_[_0x2115('0x25')](db[_0x2115('0x26')][_0x2115('0x27')],function(_0x27969d){return{'name':_0x27969d['fieldName'],'type':_0x27969d['type'][_0x2115('0x28')]};});_0x59ca70[_0x2115('0x29')]=_[_0x2115('0x25')](_0x15229e,_0x2115('0x23'));_0x59ca70[_0x2115('0x2a')]=_['keys'](_0x33d81c[_0x2115('0x2a')]);_0x59ca70[_0x2115('0x2b')]=_[_0x2115('0x2c')](_0x59ca70['model'],_0x59ca70[_0x2115('0x2a')]);_0x1262e7['attributes']=_[_0x2115('0x2c')](_0x59ca70['model'],qs[_0x2115('0x2d')](_0x33d81c[_0x2115('0x2a')][_0x2115('0x2d')]));_0x1262e7['attributes']=_0x1262e7['attributes'][_0x2115('0x2e')]?_0x1262e7[_0x2115('0x2f')]:_0x59ca70['model'];if(!_0x33d81c[_0x2115('0x2a')][_0x2115('0x30')](_0x2115('0x31'))){_0x1262e7[_0x2115('0x18')]=qs['limit'](_0x33d81c[_0x2115('0x2a')][_0x2115('0x18')]);_0x1262e7[_0x2115('0x16')]=qs[_0x2115('0x16')](_0x33d81c['query'][_0x2115('0x16')]);}_0x1262e7[_0x2115('0x32')]=qs[_0x2115('0x33')](_0x33d81c[_0x2115('0x2a')][_0x2115('0x33')]);_0x1262e7[_0x2115('0x34')]=qs['filters'](_[_0x2115('0x35')](_0x33d81c[_0x2115('0x2a')],_0x59ca70[_0x2115('0x2b')]),_0x15229e);if(_0x33d81c[_0x2115('0x2a')][_0x2115('0x36')]){_0x1262e7[_0x2115('0x34')]=_['merge'](_0x1262e7[_0x2115('0x34')],{'$or':_['map'](_0x15229e,function(_0x59b531){if(_0x59b531[_0x2115('0x37')]!==_0x2115('0x38')){var _0x4572f3={};_0x4572f3[_0x59b531[_0x2115('0x23')]]={'$like':'%'+_0x33d81c[_0x2115('0x2a')][_0x2115('0x36')]+'%'};return _0x4572f3;}})});}_0x1262e7=_['merge']({},_0x1262e7,_0x33d81c[_0x2115('0x39')]);var _0x1c2508={'where':_0x1262e7[_0x2115('0x34')]};return db[_0x2115('0x26')][_0x2115('0x19')](_0x1c2508)[_0x2115('0x1f')](function(_0x1aa165){_0x19c595[_0x2115('0x19')]=_0x1aa165;if(_0x33d81c[_0x2115('0x2a')][_0x2115('0x3a')]){_0x1262e7['include']=[{'all':!![]}];}return db['FreshdeskField'][_0x2115('0x3b')](_0x1262e7);})['then'](function(_0xa652de){_0x19c595['rows']=_0xa652de;return _0x19c595;})['then'](respondWithFilteredResult(_0x26eff7,_0x1262e7))['catch'](handleError(_0x26eff7,null));};exports[_0x2115('0x3c')]=function(_0x40d5d6,_0x11b840){var _0x96847d={'raw':!![],'where':{'id':_0x40d5d6['params']['id']}},_0x16f022={};_0x16f022[_0x2115('0x29')]=_['keys'](db[_0x2115('0x26')][_0x2115('0x27')]);_0x16f022['query']=_[_0x2115('0x3d')](_0x40d5d6[_0x2115('0x2a')]);_0x16f022['filters']=_['intersection'](_0x16f022[_0x2115('0x29')],_0x16f022[_0x2115('0x2a')]);_0x96847d['attributes']=_['intersection'](_0x16f022[_0x2115('0x29')],qs[_0x2115('0x2d')](_0x40d5d6['query']['fields']));_0x96847d[_0x2115('0x2f')]=_0x96847d[_0x2115('0x2f')][_0x2115('0x2e')]?_0x96847d['attributes']:_0x16f022[_0x2115('0x29')];if(_0x40d5d6['query'][_0x2115('0x3a')]){_0x96847d[_0x2115('0x3e')]=[{'all':!![]}];}_0x96847d=_[_0x2115('0x3f')]({},_0x96847d,_0x40d5d6[_0x2115('0x39')]);return db[_0x2115('0x26')]['find'](_0x96847d)[_0x2115('0x1f')](handleEntityNotFound(_0x11b840,null))['then'](respondWithResult(_0x11b840,null))['catch'](handleError(_0x11b840,null));};exports[_0x2115('0x40')]=function(_0xa67937,_0x583575){return db[_0x2115('0x26')][_0x2115('0x40')](_0xa67937[_0x2115('0x41')],{})[_0x2115('0x1f')](respondWithResult(_0x583575,0xc9))[_0x2115('0x42')](handleError(_0x583575,null));};exports[_0x2115('0x43')]=function(_0x41d1a4,_0x347f16){if(_0x41d1a4[_0x2115('0x41')]['id']){delete _0x41d1a4['body']['id'];}return db[_0x2115('0x26')][_0x2115('0x44')]({'where':{'id':_0x41d1a4[_0x2115('0x45')]['id']}})['then'](handleEntityNotFound(_0x347f16,null))[_0x2115('0x1f')](saveUpdates(_0x41d1a4['body'],null))['then'](respondWithResult(_0x347f16,null))['catch'](handleError(_0x347f16,null));};exports[_0x2115('0x20')]=function(_0x24d601,_0x4820c7){return db['FreshdeskField'][_0x2115('0x44')]({'where':{'id':_0x24d601[_0x2115('0x45')]['id']}})[_0x2115('0x1f')](handleEntityNotFound(_0x4820c7,null))[_0x2115('0x1f')](removeEntity(_0x4820c7,null))[_0x2115('0x42')](handleError(_0x4820c7,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index c6bf02d..e3d10b1 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 _0x4262=['lodash','util','../../config/logger','moment','request-promise','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField'];(function(_0x28b6e9,_0x9708c3){var _0x23859c=function(_0x76f5cf){while(--_0x76f5cf){_0x28b6e9['push'](_0x28b6e9['shift']());}};_0x23859c(++_0x9708c3);}(_0x4262,0x15f));var _0x2426=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4262[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x2426('0x0'));var util=require(_0x2426('0x1'));var logger=require(_0x2426('0x2'))('api');var moment=require(_0x2426('0x3'));var BPromise=require('bluebird');var rp=require(_0x2426('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2426('0x5'));var attributes=require(_0x2426('0x6'));module[_0x2426('0x7')]=function(_0x127500,_0x4a6553){return _0x127500[_0x2426('0x8')](_0x2426('0x9'),attributes,{'tableName':_0x2426('0xa'),'paranoid':![],'indexes':[{'name':_0x2426('0xb'),'fields':[_0x2426('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa3d8=['freshdesk_unique_index','idField','FieldId','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','int_freshdesk_fields'];(function(_0x3b31e1,_0x50e7ea){var _0x482b8d=function(_0x435422){while(--_0x435422){_0x3b31e1['push'](_0x3b31e1['shift']());}};_0x482b8d(++_0x50e7ea);}(_0xa3d8,0x17a));var _0x8a3d=function(_0xc8a069,_0xfca76c){_0xc8a069=_0xc8a069-0x0;var _0x320183=_0xa3d8[_0xc8a069];return _0x320183;};'use strict';var _=require(_0x8a3d('0x0'));var util=require(_0x8a3d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8a3d('0x2'));var BPromise=require(_0x8a3d('0x3'));var rp=require(_0x8a3d('0x4'));var fs=require('fs');var path=require(_0x8a3d('0x5'));var rimraf=require(_0x8a3d('0x6'));var config=require(_0x8a3d('0x7'));var attributes=require(_0x8a3d('0x8'));module[_0x8a3d('0x9')]=function(_0xeb12cd,_0x784cad){return _0xeb12cd[_0x8a3d('0xa')]('FreshdeskField',attributes,{'tableName':_0x8a3d('0xb'),'paranoid':![],'indexes':[{'name':_0x8a3d('0xc'),'fields':[_0x8a3d('0xd'),_0x8a3d('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 2b7eedb..f149622 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 _0x6080=['client','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x6080,0xd3));var _0x0608=function(_0x5a0fec,_0x15b5a4){_0x5a0fec=_0x5a0fec-0x0;var _0x2b7ed2=_0x6080[_0x5a0fec];return _0x2b7ed2;};'use strict';var _=require(_0x0608('0x0'));var util=require('util');var moment=require(_0x0608('0x1'));var BPromise=require(_0x0608('0x2'));var rs=require(_0x0608('0x3'));var fs=require('fs');var Redis=require(_0x0608('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0608('0x5'));var logger=require('../../config/logger')(_0x0608('0x6'));var config=require(_0x0608('0x7'));var jayson=require(_0x0608('0x8'));var client=jayson[_0x0608('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x341af6,_0x507a1f,_0x447176){return new BPromise(function(_0x2d4eb3,_0x3f990b){return client[_0x0608('0xa')](_0x341af6,_0x447176)[_0x0608('0xb')](function(_0x1b3b21){logger['info'](_0x0608('0xc'),_0x507a1f,_0x0608('0xd'));logger['debug'](_0x0608('0xe'),_0x507a1f,'request\x20sent',JSON[_0x0608('0xf')](_0x1b3b21));if(_0x1b3b21[_0x0608('0x10')]){if(_0x1b3b21[_0x0608('0x10')][_0x0608('0x11')]===0x1f4){logger[_0x0608('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x507a1f,_0x1b3b21['error'][_0x0608('0x12')]);return _0x3f990b(_0x1b3b21[_0x0608('0x10')][_0x0608('0x12')]);}logger['error'](_0x0608('0xc'),_0x507a1f,_0x1b3b21[_0x0608('0x10')]['message']);return _0x2d4eb3(_0x1b3b21[_0x0608('0x10')][_0x0608('0x12')]);}else{logger[_0x0608('0x13')](_0x0608('0xc'),_0x507a1f,_0x0608('0xd'));_0x2d4eb3(_0x1b3b21[_0x0608('0x14')][_0x0608('0x12')]);}})[_0x0608('0x15')](function(_0x27e0ce){logger[_0x0608('0x10')](_0x0608('0xc'),_0x507a1f,_0x27e0ce);_0x3f990b(_0x27e0ce);});});} \ No newline at end of file +var _0x9c5d=['../../config/environment','client','request','then','info','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','FreshdeskField,\x20%s,\x20%s','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x9c5d,0xfc));var _0xd9c5=function(_0x2431d6,_0x25189a){_0x2431d6=_0x2431d6-0x0;var _0x4d0f9b=_0x9c5d[_0x2431d6];return _0x4d0f9b;};'use strict';var _=require('lodash');var util=require(_0xd9c5('0x0'));var moment=require(_0xd9c5('0x1'));var BPromise=require(_0xd9c5('0x2'));var rs=require(_0xd9c5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9c5('0x4'))['db'];var utils=require(_0xd9c5('0x5'));var logger=require(_0xd9c5('0x6'))(_0xd9c5('0x7'));var config=require(_0xd9c5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9c5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e0c45,_0x2b170b,_0xda2cd){return new BPromise(function(_0x12e05e,_0x53f90f){return client[_0xd9c5('0xa')](_0x4e0c45,_0xda2cd)[_0xd9c5('0xb')](function(_0x28cc47){logger[_0xd9c5('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x2b170b,_0xd9c5('0xd'));logger[_0xd9c5('0xe')](_0xd9c5('0xf'),_0x2b170b,_0xd9c5('0xd'),JSON[_0xd9c5('0x10')](_0x28cc47));if(_0x28cc47[_0xd9c5('0x11')]){if(_0x28cc47[_0xd9c5('0x11')]['code']===0x1f4){logger[_0xd9c5('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x2b170b,_0x28cc47[_0xd9c5('0x11')][_0xd9c5('0x12')]);return _0x53f90f(_0x28cc47[_0xd9c5('0x11')][_0xd9c5('0x12')]);}logger[_0xd9c5('0x11')](_0xd9c5('0x13'),_0x2b170b,_0x28cc47[_0xd9c5('0x11')][_0xd9c5('0x12')]);return _0x12e05e(_0x28cc47['error']['message']);}else{logger[_0xd9c5('0xc')](_0xd9c5('0x13'),_0x2b170b,_0xd9c5('0xd'));_0x12e05e(_0x28cc47['result'][_0xd9c5('0x12')]);}})['catch'](function(_0x567a09){logger['error'](_0xd9c5('0x13'),_0x2b170b,_0x567a09);_0x53f90f(_0x567a09);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 22e6540..e295423 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 _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(_0x893cc5,_0x264fb4){var _0x5b369e=function(_0x3ce746){while(--_0x3ce746){_0x893cc5['push'](_0x893cc5['shift']());}};_0x5b369e(++_0x264fb4);}(_0x6c76,0x184));var _0x66c7=function(_0x183c71,_0x526d3f){_0x183c71=_0x183c71-0x0;var _0x4d4c0f=_0x6c76[_0x183c71];return _0x4d4c0f;};'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 +var _0x282b=['../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','post','create','/:id/configurations','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x28669c,_0x1f62c4){var _0x4a3af6=function(_0x3e25d5){while(--_0x3e25d5){_0x28669c['push'](_0x28669c['shift']());}};_0x4a3af6(++_0x1f62c4);}(_0x282b,0xec));var _0xb282=function(_0x2178f7,_0x3edf2a){_0x2178f7=_0x2178f7-0x0;var _0x4e8e05=_0x282b[_0x2178f7];return _0x4e8e05;};'use strict';var multer=require(_0xb282('0x0'));var util=require(_0xb282('0x1'));var path=require(_0xb282('0x2'));var timeout=require(_0xb282('0x3'));var express=require(_0xb282('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb282('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb282('0x6'));var controller=require(_0xb282('0x7'));router[_0xb282('0x8')]('/',auth[_0xb282('0x9')](),controller[_0xb282('0xa')]);router[_0xb282('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xb282('0xb')]);router[_0xb282('0x8')]('/:id/configurations',auth[_0xb282('0x9')](),controller[_0xb282('0xc')]);router[_0xb282('0x8')](_0xb282('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0xb282('0xe')]('/',auth[_0xb282('0x9')](),controller[_0xb282('0xf')]);router[_0xb282('0xe')](_0xb282('0x10'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xb282('0x11')](_0xb282('0x12'),auth[_0xb282('0x9')](),controller[_0xb282('0x13')]);router[_0xb282('0x14')]('/:id',auth[_0xb282('0x9')](),controller['destroy']);module[_0xb282('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 96e612a..e49e297 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 _0x4e2e=['username','remoteUri','exports','STRING'];(function(_0x40897f,_0x1ee75f){var _0x1ccd9b=function(_0x1bb197){while(--_0x1bb197){_0x40897f['push'](_0x40897f['shift']());}};_0x1ccd9b(++_0x1ee75f);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x421a9c,_0x2cced8){_0x421a9c=_0x421a9c-0x0;var _0x3675b5=_0x4e2e[_0x421a9c];return _0x3675b5;};'use strict';var Sequelize=require('sequelize');module[_0xe4e2('0x0')]={'name':{'type':Sequelize[_0xe4e2('0x1')]},'description':{'type':Sequelize[_0xe4e2('0x1')]},'username':{'type':Sequelize[_0xe4e2('0x1')],'unique':_0xe4e2('0x2')},'apiKey':{'type':Sequelize[_0xe4e2('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xe4e2('0x3')},'serverUrl':{'type':Sequelize[_0xe4e2('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xdb28=['username','remoteUri','sequelize','exports','STRING'];(function(_0x1eced4,_0xc5070f){var _0x1a91e5=function(_0xcc3a6c){while(--_0xcc3a6c){_0x1eced4['push'](_0x1eced4['shift']());}};_0x1a91e5(++_0xc5070f);}(_0xdb28,0x106));var _0x8db2=function(_0xb9a1f0,_0x425f0b){_0xb9a1f0=_0xb9a1f0-0x0;var _0x22d446=_0xdb28[_0xb9a1f0];return _0x22d446;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'name':{'type':Sequelize[_0x8db2('0x2')]},'description':{'type':Sequelize[_0x8db2('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x8db2('0x3')},'apiKey':{'type':Sequelize[_0x8db2('0x2')]},'remoteUri':{'type':Sequelize[_0x8db2('0x2')],'unique':_0x8db2('0x4')},'serverUrl':{'type':Sequelize[_0x8db2('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index b058123..1ef0333 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 _0xd8a6=['querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','FreshsalesAccount','key','model','query','filters','intersection','attributes','fields','order','sort','where','pick','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','merge','find','create','body','findOne','FreshsalesConfiguration','hasOwnProperty','nolimit','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','FreshsalesField','getFields','apiKey','username','slice','substring','lastIndexOf','format','%s%s','/api/selector/owners','Token\x20token=','email','test','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js'];(function(_0x586137,_0x4fb74e){var _0x3febfc=function(_0x574869){while(--_0x574869){_0x586137['push'](_0x586137['shift']());}};_0x3febfc(++_0x4fb74e);}(_0xd8a6,0x1e1));var _0x6d8a=function(_0x5d401c,_0x16b432){_0x5d401c=_0x5d401c-0x0;var _0x1e9c2e=_0xd8a6[_0x5d401c];return _0x1e9c2e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6d8a('0x0'));var zipdir=require(_0x6d8a('0x1'));var jsonpatch=require(_0x6d8a('0x2'));var rp=require(_0x6d8a('0x3'));var moment=require(_0x6d8a('0x4'));var BPromise=require(_0x6d8a('0x5'));var Mustache=require(_0x6d8a('0x6'));var util=require('util');var path=require(_0x6d8a('0x7'));var sox=require('sox');var csv=require(_0x6d8a('0x8'));var ejs=require(_0x6d8a('0x9'));var fs=require('fs');var fs_extra=require(_0x6d8a('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6d8a('0xb'));var jsforce=require(_0x6d8a('0xc'));var deskjs=require(_0x6d8a('0xd'));var toCsv=require(_0x6d8a('0x8'));var querystring=require(_0x6d8a('0xe'));var Papa=require(_0x6d8a('0xf'));var Redis=require(_0x6d8a('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6d8a('0x11'));var logger=require('../../config/logger')(_0x6d8a('0x12'));var utils=require('../../config/utils');var config=require(_0x6d8a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x6d8a('0x14'))['db'];var integrations=require(_0x6d8a('0x15'));function respondWithStatusCode(_0x59d008,_0x15fa32){_0x15fa32=_0x15fa32||0xcc;return function(_0x892d1e){if(_0x892d1e){return _0x59d008[_0x6d8a('0x16')](_0x15fa32);}return _0x59d008['status'](_0x15fa32)[_0x6d8a('0x17')]();};}function respondWithResult(_0x5113bb,_0x2aae54){_0x2aae54=_0x2aae54||0xc8;return function(_0x1f0ef6){if(_0x1f0ef6){return _0x5113bb[_0x6d8a('0x18')](_0x2aae54)[_0x6d8a('0x19')](_0x1f0ef6);}};}function respondWithFilteredResult(_0x42809c,_0x10599b){return function(_0x5e5509){if(_0x5e5509){var _0x1c7b7e=typeof _0x10599b[_0x6d8a('0x1a')]==='undefined'&&typeof _0x10599b[_0x6d8a('0x1b')]===_0x6d8a('0x1c');var _0x32bb51=_0x5e5509[_0x6d8a('0x1d')];var _0xadb4c3=_0x1c7b7e?0x0:_0x10599b[_0x6d8a('0x1a')];var _0x1707ac=_0x1c7b7e?_0x5e5509[_0x6d8a('0x1d')]:_0x10599b[_0x6d8a('0x1a')]+_0x10599b['limit'];var _0x5a57a1;if(_0x1707ac>=_0x32bb51){_0x1707ac=_0x32bb51;_0x5a57a1=0xc8;}else{_0x5a57a1=0xce;}_0x42809c[_0x6d8a('0x18')](_0x5a57a1);return _0x42809c[_0x6d8a('0x1e')](_0x6d8a('0x1f'),_0xadb4c3+'-'+_0x1707ac+'/'+_0x32bb51)[_0x6d8a('0x19')](_0x5e5509);}return null;};}function patchUpdates(_0x401b6a){return function(_0x4118d5){try{jsonpatch['apply'](_0x4118d5,_0x401b6a,!![]);}catch(_0x2ce9dc){return BPromise[_0x6d8a('0x20')](_0x2ce9dc);}return _0x4118d5[_0x6d8a('0x21')]();};}function saveUpdates(_0x20b7a8,_0x29d032){return function(_0x1b194b){if(_0x1b194b){return _0x1b194b[_0x6d8a('0x22')](_0x20b7a8)[_0x6d8a('0x23')](function(_0xca3677){return _0xca3677;});}return null;};}function removeEntity(_0xaaa697,_0x5534ff){return function(_0x1b2eb1){if(_0x1b2eb1){return _0x1b2eb1[_0x6d8a('0x24')]()[_0x6d8a('0x23')](function(){_0xaaa697[_0x6d8a('0x18')](0xcc)[_0x6d8a('0x17')]();});}};}function handleEntityNotFound(_0xf328b6,_0x2907c2){return function(_0x3c8061){if(!_0x3c8061){_0xf328b6[_0x6d8a('0x16')](0x194);}return _0x3c8061;};}function handleError(_0x1c98a5,_0x4221d6){_0x4221d6=_0x4221d6||0x1f4;return function(_0x286c73){logger['error'](_0x286c73[_0x6d8a('0x25')]);if(_0x286c73[_0x6d8a('0x26')]){delete _0x286c73[_0x6d8a('0x26')];}_0x1c98a5[_0x6d8a('0x18')](_0x4221d6)[_0x6d8a('0x27')](_0x286c73);};}exports[_0x6d8a('0x28')]=function(_0x5c55f7,_0x103ff4){var _0x3fc576={},_0x128214={},_0x61a39a={'count':0x0,'rows':[]};var _0x4e47a3=_[_0x6d8a('0x29')](db[_0x6d8a('0x2a')]['rawAttributes'],function(_0x50894e){return{'name':_0x50894e['fieldName'],'type':_0x50894e['type'][_0x6d8a('0x2b')]};});_0x128214[_0x6d8a('0x2c')]=_[_0x6d8a('0x29')](_0x4e47a3,_0x6d8a('0x26'));_0x128214[_0x6d8a('0x2d')]=_['keys'](_0x5c55f7['query']);_0x128214[_0x6d8a('0x2e')]=_[_0x6d8a('0x2f')](_0x128214[_0x6d8a('0x2c')],_0x128214[_0x6d8a('0x2d')]);_0x3fc576[_0x6d8a('0x30')]=_[_0x6d8a('0x2f')](_0x128214[_0x6d8a('0x2c')],qs[_0x6d8a('0x31')](_0x5c55f7[_0x6d8a('0x2d')][_0x6d8a('0x31')]));_0x3fc576[_0x6d8a('0x30')]=_0x3fc576[_0x6d8a('0x30')]['length']?_0x3fc576['attributes']:_0x128214[_0x6d8a('0x2c')];if(!_0x5c55f7[_0x6d8a('0x2d')]['hasOwnProperty']('nolimit')){_0x3fc576['limit']=qs[_0x6d8a('0x1b')](_0x5c55f7[_0x6d8a('0x2d')][_0x6d8a('0x1b')]);_0x3fc576[_0x6d8a('0x1a')]=qs[_0x6d8a('0x1a')](_0x5c55f7[_0x6d8a('0x2d')][_0x6d8a('0x1a')]);}_0x3fc576[_0x6d8a('0x32')]=qs[_0x6d8a('0x33')](_0x5c55f7[_0x6d8a('0x2d')][_0x6d8a('0x33')]);_0x3fc576[_0x6d8a('0x34')]=qs['filters'](_[_0x6d8a('0x35')](_0x5c55f7[_0x6d8a('0x2d')],_0x128214['filters']),_0x4e47a3);if(_0x5c55f7['query']['filter']){_0x3fc576[_0x6d8a('0x34')]=_['merge'](_0x3fc576[_0x6d8a('0x34')],{'$or':_[_0x6d8a('0x29')](_0x4e47a3,function(_0x42842e){if(_0x42842e[_0x6d8a('0x36')]!==_0x6d8a('0x37')){var _0x53e4d4={};_0x53e4d4[_0x42842e[_0x6d8a('0x26')]]={'$like':'%'+_0x5c55f7[_0x6d8a('0x2d')][_0x6d8a('0x38')]+'%'};return _0x53e4d4;}})});}_0x3fc576=_['merge']({},_0x3fc576,_0x5c55f7[_0x6d8a('0x39')]);var _0x1e6b68={'where':_0x3fc576[_0x6d8a('0x34')]};return db[_0x6d8a('0x2a')][_0x6d8a('0x1d')](_0x1e6b68)['then'](function(_0x5d35f0){_0x61a39a[_0x6d8a('0x1d')]=_0x5d35f0;if(_0x5c55f7['query'][_0x6d8a('0x3a')]){_0x3fc576[_0x6d8a('0x3b')]=[{'all':!![]}];}return db[_0x6d8a('0x2a')][_0x6d8a('0x3c')](_0x3fc576);})['then'](function(_0x5525a1){_0x61a39a[_0x6d8a('0x3d')]=_0x5525a1;return _0x61a39a;})[_0x6d8a('0x23')](respondWithFilteredResult(_0x103ff4,_0x3fc576))[_0x6d8a('0x3e')](handleError(_0x103ff4,null));};exports[_0x6d8a('0x3f')]=function(_0x24fa37,_0x2f104c){var _0x180e28={'raw':![],'where':{'id':_0x24fa37[_0x6d8a('0x40')]['id']}},_0x5984b1={};_0x5984b1[_0x6d8a('0x2c')]=_[_0x6d8a('0x41')](db[_0x6d8a('0x2a')][_0x6d8a('0x42')]);_0x5984b1[_0x6d8a('0x2d')]=_['keys'](_0x24fa37[_0x6d8a('0x2d')]);_0x5984b1[_0x6d8a('0x2e')]=_[_0x6d8a('0x2f')](_0x5984b1[_0x6d8a('0x2c')],_0x5984b1[_0x6d8a('0x2d')]);_0x180e28[_0x6d8a('0x30')]=_[_0x6d8a('0x2f')](_0x5984b1['model'],qs[_0x6d8a('0x31')](_0x24fa37[_0x6d8a('0x2d')][_0x6d8a('0x31')]));_0x180e28[_0x6d8a('0x30')]=_0x180e28[_0x6d8a('0x30')][_0x6d8a('0x43')]?_0x180e28[_0x6d8a('0x30')]:_0x5984b1[_0x6d8a('0x2c')];if(_0x24fa37[_0x6d8a('0x2d')][_0x6d8a('0x3a')]){_0x180e28[_0x6d8a('0x3b')]=[{'all':!![]}];}_0x180e28=_[_0x6d8a('0x44')]({},_0x180e28,_0x24fa37['options']);return db[_0x6d8a('0x2a')][_0x6d8a('0x45')](_0x180e28)[_0x6d8a('0x23')](handleEntityNotFound(_0x2f104c,null))['then'](respondWithResult(_0x2f104c,null))['catch'](handleError(_0x2f104c,null));};exports[_0x6d8a('0x46')]=function(_0x479704,_0x29f4a7){return db[_0x6d8a('0x2a')][_0x6d8a('0x46')](_0x479704[_0x6d8a('0x47')],{})[_0x6d8a('0x23')](respondWithResult(_0x29f4a7,0xc9))[_0x6d8a('0x3e')](handleError(_0x29f4a7,null));};exports[_0x6d8a('0x22')]=function(_0x4a5b17,_0x39051b){if(_0x4a5b17[_0x6d8a('0x47')]['id']){delete _0x4a5b17[_0x6d8a('0x47')]['id'];}return db[_0x6d8a('0x2a')][_0x6d8a('0x45')]({'where':{'id':_0x4a5b17[_0x6d8a('0x40')]['id']}})[_0x6d8a('0x23')](handleEntityNotFound(_0x39051b,null))[_0x6d8a('0x23')](saveUpdates(_0x4a5b17[_0x6d8a('0x47')],null))['then'](respondWithResult(_0x39051b,null))[_0x6d8a('0x3e')](handleError(_0x39051b,null));};exports['destroy']=function(_0x641108,_0x554182){return db[_0x6d8a('0x2a')][_0x6d8a('0x45')]({'where':{'id':_0x641108[_0x6d8a('0x40')]['id']}})[_0x6d8a('0x23')](handleEntityNotFound(_0x554182,null))[_0x6d8a('0x23')](removeEntity(_0x554182,null))[_0x6d8a('0x3e')](handleError(_0x554182,null));};exports['getConfigurations']=function(_0x4b0789,_0x2477a8,_0x1c080d){var _0x2ab08a={};var _0x152102={};var _0x3f2838;var _0x4ca57b;return db['FreshsalesAccount'][_0x6d8a('0x48')]({'where':{'id':_0x4b0789[_0x6d8a('0x40')]['id']}})[_0x6d8a('0x23')](handleEntityNotFound(_0x2477a8,null))[_0x6d8a('0x23')](function(_0x564a57){if(_0x564a57){_0x3f2838=_0x564a57;_0x152102[_0x6d8a('0x2c')]=_[_0x6d8a('0x41')](db[_0x6d8a('0x49')][_0x6d8a('0x42')]);_0x152102[_0x6d8a('0x2d')]=_['keys'](_0x4b0789[_0x6d8a('0x2d')]);_0x152102['filters']=_['intersection'](_0x152102[_0x6d8a('0x2c')],_0x152102[_0x6d8a('0x2d')]);_0x2ab08a[_0x6d8a('0x30')]=_[_0x6d8a('0x2f')](_0x152102[_0x6d8a('0x2c')],qs[_0x6d8a('0x31')](_0x4b0789['query'][_0x6d8a('0x31')]));_0x2ab08a[_0x6d8a('0x30')]=_0x2ab08a['attributes'][_0x6d8a('0x43')]?_0x2ab08a[_0x6d8a('0x30')]:_0x152102[_0x6d8a('0x2c')];_0x2ab08a[_0x6d8a('0x32')]=qs[_0x6d8a('0x33')](_0x4b0789[_0x6d8a('0x2d')][_0x6d8a('0x33')]);_0x2ab08a[_0x6d8a('0x34')]=qs['filters'](_[_0x6d8a('0x35')](_0x4b0789['query'],_0x152102[_0x6d8a('0x2e')]));if(_0x4b0789[_0x6d8a('0x2d')]['filter']){_0x2ab08a['where']=_[_0x6d8a('0x44')](_0x2ab08a[_0x6d8a('0x34')],{'$or':_[_0x6d8a('0x29')](_0x2ab08a[_0x6d8a('0x30')],function(_0x51130e){var _0xe22ce0={};_0xe22ce0[_0x51130e]={'$like':'%'+_0x4b0789[_0x6d8a('0x2d')]['filter']+'%'};return _0xe22ce0;})});}_0x2ab08a=_[_0x6d8a('0x44')]({},_0x2ab08a,_0x4b0789[_0x6d8a('0x39')]);return _0x3f2838['getConfigurations'](_0x2ab08a);}})['then'](function(_0x387b6c){if(_0x387b6c){_0x4ca57b=_0x387b6c[_0x6d8a('0x43')];if(!_0x4b0789[_0x6d8a('0x2d')][_0x6d8a('0x4a')](_0x6d8a('0x4b'))){_0x2ab08a[_0x6d8a('0x1b')]=qs[_0x6d8a('0x1b')](_0x4b0789['query'][_0x6d8a('0x1b')]);_0x2ab08a[_0x6d8a('0x1a')]=qs[_0x6d8a('0x1a')](_0x4b0789[_0x6d8a('0x2d')]['offset']);}return _0x3f2838[_0x6d8a('0x4c')](_0x2ab08a);}})['then'](function(_0x5af637){if(_0x5af637){return _0x5af637?{'count':_0x4ca57b,'rows':_0x5af637}:null;}})[_0x6d8a('0x23')](respondWithResult(_0x2477a8,null))[_0x6d8a('0x3e')](handleError(_0x2477a8,null));};exports[_0x6d8a('0x4d')]=function(_0x59631f,_0x11a031,_0xac84de){if(_0x59631f[_0x6d8a('0x47')]['id']){delete _0x59631f['body']['id'];}return db['FreshsalesAccount']['findOne']({'where':{'id':_0x59631f[_0x6d8a('0x40')]['id']}})[_0x6d8a('0x23')](handleEntityNotFound(_0x11a031,null))['then'](function(_0x3a64c0){if(_0x3a64c0){_0x59631f[_0x6d8a('0x47')]['AccountId']=_0x3a64c0['id'];_0x59631f['body'][_0x6d8a('0x4e')]=integrations[_0x6d8a('0x4f')](_0x59631f['body'][_0x6d8a('0x50')],_0x59631f['body'][_0x6d8a('0x36')]);_0x59631f[_0x6d8a('0x47')][_0x6d8a('0x51')]=integrations['getDescriptions'](_0x59631f[_0x6d8a('0x47')]['channel'],_0x59631f[_0x6d8a('0x47')][_0x6d8a('0x36')]);return db[_0x6d8a('0x49')][_0x6d8a('0x46')](_0x59631f[_0x6d8a('0x47')],{'include':[{'model':db[_0x6d8a('0x52')],'as':_0x6d8a('0x4e')},{'model':db[_0x6d8a('0x52')],'as':_0x6d8a('0x51')}]});}return null;})[_0x6d8a('0x23')](respondWithResult(_0x11a031,null))['catch'](handleError(_0x11a031,null));};exports[_0x6d8a('0x53')]=function(_0x2e92a2,_0x213923,_0xfca730){var _0x239591='';var _0x19efe1='';return db['FreshsalesAccount'][_0x6d8a('0x48')]({'where':{'id':_0x2e92a2[_0x6d8a('0x40')]['id']},'attributes':['id','username','remoteUri',_0x6d8a('0x54')]})[_0x6d8a('0x23')](handleEntityNotFound(_0x213923,null))[_0x6d8a('0x23')](function(_0xe87b32){if(_0xe87b32){_0x19efe1=_0xe87b32[_0x6d8a('0x55')];_0x239591=_0xe87b32['remoteUri'];var _0x3cb69d=_0xe87b32['remoteUri'][_0x6d8a('0x56')](-0x1);if(_0x3cb69d==='/'){_0x239591=_0x239591[_0x6d8a('0x57')](0x0,_0x239591[_0x6d8a('0x58')](_0x3cb69d));}return rp({'method':'GET','uri':util[_0x6d8a('0x59')](_0x6d8a('0x5a'),_0x239591,_0x6d8a('0x5b')),'headers':{'Authorization':_0x6d8a('0x5c')+_0xe87b32[_0x6d8a('0x54')]},'json':!![]});}})[_0x6d8a('0x23')](function(_0x2b5df5){if(_0x2b5df5){var _0x4c1537=_0x2b5df5['users'];var _0x5ab57f=![];var _0x211568=null;for(_0x211568=0x0;_0x211568<_0x4c1537[_0x6d8a('0x43')];_0x211568++){if(_0x4c1537[_0x211568][_0x6d8a('0x5d')]===_0x19efe1){_0x5ab57f=!![];}}if(_0x5ab57f){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x213923,null))[_0x6d8a('0x3e')](function(_0x406a38){var _0x205f51=_0x2e92a2[_0x6d8a('0x2d')][_0x6d8a('0x5e')]?0x1f4:_0x406a38['statusCode']||0x1f4;logger[_0x6d8a('0x5f')](_0x6d8a('0x60'),_0x6d8a('0x53'),_0x205f51,JSON['stringify'](_0x406a38));delete _0x406a38['name'];if(_0x205f51===0x191){_0x205f51=0x190;}_0x213923[_0x6d8a('0x18')](_0x205f51)[_0x6d8a('0x27')](_0x2e92a2[_0x6d8a('0x2d')][_0x6d8a('0x5e')]?{'message':_0x6d8a('0x61'),'statusCode':_0x406a38[_0x6d8a('0x62')]}:_0x406a38);});}; \ No newline at end of file +var _0x07e1=['FreshsalesAccount','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','limit','sort','where','filter','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','length','merge','find','create','body','params','destroy','getConfigurations','findOne','FreshsalesConfiguration','pick','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','remoteUri','apiKey','username','slice','lastIndexOf','GET','format','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','update','then','sendStatus','stack','name','index','map'];(function(_0x2fe9ae,_0x51f78b){var _0x52cea9=function(_0x16d65c){while(--_0x16d65c){_0x2fe9ae['push'](_0x2fe9ae['shift']());}};_0x52cea9(++_0x51f78b);}(_0x07e1,0x168));var _0x107e=function(_0x3b6b1c,_0x2c3cd9){_0x3b6b1c=_0x3b6b1c-0x0;var _0x3a5c79=_0x07e1[_0x3b6b1c];return _0x3a5c79;};'use strict';var emlformat=require(_0x107e('0x0'));var rimraf=require(_0x107e('0x1'));var zipdir=require(_0x107e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x107e('0x3'));var BPromise=require(_0x107e('0x4'));var Mustache=require(_0x107e('0x5'));var util=require('util');var path=require('path');var sox=require(_0x107e('0x6'));var csv=require(_0x107e('0x7'));var ejs=require(_0x107e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x107e('0x9'));var squel=require(_0x107e('0xa'));var crypto=require(_0x107e('0xb'));var jsforce=require(_0x107e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x107e('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x107e('0xd'));var qs=require(_0x107e('0xe'));var as=require(_0x107e('0xf'));var hardwareService=require(_0x107e('0x10'));var logger=require(_0x107e('0x11'))(_0x107e('0x12'));var utils=require(_0x107e('0x13'));var config=require(_0x107e('0x14'));var licenseUtil=require(_0x107e('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x107e('0x16'));function respondWithStatusCode(_0x477a96,_0x3e7960){_0x3e7960=_0x3e7960||0xcc;return function(_0x54b945){if(_0x54b945){return _0x477a96['sendStatus'](_0x3e7960);}return _0x477a96[_0x107e('0x17')](_0x3e7960)[_0x107e('0x18')]();};}function respondWithResult(_0x263cd5,_0x4c897f){_0x4c897f=_0x4c897f||0xc8;return function(_0x43a7af){if(_0x43a7af){return _0x263cd5[_0x107e('0x17')](_0x4c897f)['json'](_0x43a7af);}};}function respondWithFilteredResult(_0x12ce57,_0x53f097){return function(_0x110b10){if(_0x110b10){var _0xca735f=typeof _0x53f097[_0x107e('0x19')]===_0x107e('0x1a')&&typeof _0x53f097['limit']===_0x107e('0x1a');var _0xac406b=_0x110b10[_0x107e('0x1b')];var _0x5395b1=_0xca735f?0x0:_0x53f097[_0x107e('0x19')];var _0x2385db=_0xca735f?_0x110b10[_0x107e('0x1b')]:_0x53f097[_0x107e('0x19')]+_0x53f097['limit'];var _0x35d413;if(_0x2385db>=_0xac406b){_0x2385db=_0xac406b;_0x35d413=0xc8;}else{_0x35d413=0xce;}_0x12ce57['status'](_0x35d413);return _0x12ce57['set'](_0x107e('0x1c'),_0x5395b1+'-'+_0x2385db+'/'+_0xac406b)[_0x107e('0x1d')](_0x110b10);}return null;};}function patchUpdates(_0x574d2c){return function(_0x45db1e){try{jsonpatch[_0x107e('0x1e')](_0x45db1e,_0x574d2c,!![]);}catch(_0x1103ef){return BPromise[_0x107e('0x1f')](_0x1103ef);}return _0x45db1e[_0x107e('0x20')]();};}function saveUpdates(_0x38a1f8,_0x313c82){return function(_0x2fec24){if(_0x2fec24){return _0x2fec24[_0x107e('0x21')](_0x38a1f8)[_0x107e('0x22')](function(_0x2fb1df){return _0x2fb1df;});}return null;};}function removeEntity(_0x3ff5ef,_0x39333f){return function(_0xc1edef){if(_0xc1edef){return _0xc1edef['destroy']()[_0x107e('0x22')](function(){_0x3ff5ef[_0x107e('0x17')](0xcc)[_0x107e('0x18')]();});}};}function handleEntityNotFound(_0x23c092,_0x4f3955){return function(_0x1f410e){if(!_0x1f410e){_0x23c092[_0x107e('0x23')](0x194);}return _0x1f410e;};}function handleError(_0x27e485,_0x1a9914){_0x1a9914=_0x1a9914||0x1f4;return function(_0x12c2c7){logger['error'](_0x12c2c7[_0x107e('0x24')]);if(_0x12c2c7[_0x107e('0x25')]){delete _0x12c2c7[_0x107e('0x25')];}_0x27e485['status'](_0x1a9914)['send'](_0x12c2c7);};}exports[_0x107e('0x26')]=function(_0x2408c2,_0x16d039){var _0x3e5eb5={},_0x442900={},_0x1ab37a={'count':0x0,'rows':[]};var _0x1a5526=_[_0x107e('0x27')](db[_0x107e('0x28')]['rawAttributes'],function(_0x172eff){return{'name':_0x172eff[_0x107e('0x29')],'type':_0x172eff[_0x107e('0x2a')][_0x107e('0x2b')]};});_0x442900['model']=_[_0x107e('0x27')](_0x1a5526,'name');_0x442900[_0x107e('0x2c')]=_[_0x107e('0x2d')](_0x2408c2[_0x107e('0x2c')]);_0x442900[_0x107e('0x2e')]=_[_0x107e('0x2f')](_0x442900[_0x107e('0x30')],_0x442900[_0x107e('0x2c')]);_0x3e5eb5[_0x107e('0x31')]=_[_0x107e('0x2f')](_0x442900['model'],qs[_0x107e('0x32')](_0x2408c2['query'][_0x107e('0x32')]));_0x3e5eb5[_0x107e('0x31')]=_0x3e5eb5[_0x107e('0x31')]['length']?_0x3e5eb5[_0x107e('0x31')]:_0x442900['model'];if(!_0x2408c2[_0x107e('0x2c')][_0x107e('0x33')]('nolimit')){_0x3e5eb5[_0x107e('0x34')]=qs[_0x107e('0x34')](_0x2408c2[_0x107e('0x2c')][_0x107e('0x34')]);_0x3e5eb5[_0x107e('0x19')]=qs['offset'](_0x2408c2[_0x107e('0x2c')][_0x107e('0x19')]);}_0x3e5eb5['order']=qs[_0x107e('0x35')](_0x2408c2[_0x107e('0x2c')][_0x107e('0x35')]);_0x3e5eb5[_0x107e('0x36')]=qs[_0x107e('0x2e')](_['pick'](_0x2408c2[_0x107e('0x2c')],_0x442900[_0x107e('0x2e')]),_0x1a5526);if(_0x2408c2[_0x107e('0x2c')][_0x107e('0x37')]){_0x3e5eb5[_0x107e('0x36')]=_['merge'](_0x3e5eb5[_0x107e('0x36')],{'$or':_[_0x107e('0x27')](_0x1a5526,function(_0x1fbf91){if(_0x1fbf91['type']!==_0x107e('0x38')){var _0x2cab9f={};_0x2cab9f[_0x1fbf91[_0x107e('0x25')]]={'$like':'%'+_0x2408c2['query'][_0x107e('0x37')]+'%'};return _0x2cab9f;}})});}_0x3e5eb5=_['merge']({},_0x3e5eb5,_0x2408c2[_0x107e('0x39')]);var _0x48e6b5={'where':_0x3e5eb5[_0x107e('0x36')]};return db['FreshsalesAccount'][_0x107e('0x1b')](_0x48e6b5)[_0x107e('0x22')](function(_0x2c2efa){_0x1ab37a[_0x107e('0x1b')]=_0x2c2efa;if(_0x2408c2[_0x107e('0x2c')][_0x107e('0x3a')]){_0x3e5eb5[_0x107e('0x3b')]=[{'all':!![]}];}return db[_0x107e('0x28')]['findAll'](_0x3e5eb5);})[_0x107e('0x22')](function(_0x2e43cb){_0x1ab37a[_0x107e('0x3c')]=_0x2e43cb;return _0x1ab37a;})[_0x107e('0x22')](respondWithFilteredResult(_0x16d039,_0x3e5eb5))[_0x107e('0x3d')](handleError(_0x16d039,null));};exports[_0x107e('0x3e')]=function(_0x143b53,_0x40653e){var _0x3d5d92={'raw':![],'where':{'id':_0x143b53['params']['id']}},_0x3131f3={};_0x3131f3[_0x107e('0x30')]=_[_0x107e('0x2d')](db[_0x107e('0x28')][_0x107e('0x3f')]);_0x3131f3[_0x107e('0x2c')]=_[_0x107e('0x2d')](_0x143b53[_0x107e('0x2c')]);_0x3131f3[_0x107e('0x2e')]=_['intersection'](_0x3131f3[_0x107e('0x30')],_0x3131f3[_0x107e('0x2c')]);_0x3d5d92['attributes']=_[_0x107e('0x2f')](_0x3131f3[_0x107e('0x30')],qs[_0x107e('0x32')](_0x143b53[_0x107e('0x2c')]['fields']));_0x3d5d92[_0x107e('0x31')]=_0x3d5d92['attributes'][_0x107e('0x40')]?_0x3d5d92[_0x107e('0x31')]:_0x3131f3[_0x107e('0x30')];if(_0x143b53[_0x107e('0x2c')]['includeAll']){_0x3d5d92['include']=[{'all':!![]}];}_0x3d5d92=_[_0x107e('0x41')]({},_0x3d5d92,_0x143b53[_0x107e('0x39')]);return db[_0x107e('0x28')][_0x107e('0x42')](_0x3d5d92)[_0x107e('0x22')](handleEntityNotFound(_0x40653e,null))['then'](respondWithResult(_0x40653e,null))[_0x107e('0x3d')](handleError(_0x40653e,null));};exports['create']=function(_0x595a19,_0x4e3312){return db['FreshsalesAccount'][_0x107e('0x43')](_0x595a19['body'],{})['then'](respondWithResult(_0x4e3312,0xc9))[_0x107e('0x3d')](handleError(_0x4e3312,null));};exports['update']=function(_0x109794,_0x9dc72d){if(_0x109794[_0x107e('0x44')]['id']){delete _0x109794['body']['id'];}return db[_0x107e('0x28')][_0x107e('0x42')]({'where':{'id':_0x109794[_0x107e('0x45')]['id']}})[_0x107e('0x22')](handleEntityNotFound(_0x9dc72d,null))[_0x107e('0x22')](saveUpdates(_0x109794[_0x107e('0x44')],null))[_0x107e('0x22')](respondWithResult(_0x9dc72d,null))['catch'](handleError(_0x9dc72d,null));};exports[_0x107e('0x46')]=function(_0x186931,_0x4e39b6){return db[_0x107e('0x28')][_0x107e('0x42')]({'where':{'id':_0x186931[_0x107e('0x45')]['id']}})['then'](handleEntityNotFound(_0x4e39b6,null))[_0x107e('0x22')](removeEntity(_0x4e39b6,null))[_0x107e('0x3d')](handleError(_0x4e39b6,null));};exports[_0x107e('0x47')]=function(_0x2accc0,_0xeb67b7,_0x3c52ee){var _0x392dc6={};var _0x522a94={};var _0x4199d0;var _0xde8760;return db[_0x107e('0x28')][_0x107e('0x48')]({'where':{'id':_0x2accc0[_0x107e('0x45')]['id']}})[_0x107e('0x22')](handleEntityNotFound(_0xeb67b7,null))[_0x107e('0x22')](function(_0x58ed61){if(_0x58ed61){_0x4199d0=_0x58ed61;_0x522a94[_0x107e('0x30')]=_[_0x107e('0x2d')](db[_0x107e('0x49')][_0x107e('0x3f')]);_0x522a94[_0x107e('0x2c')]=_['keys'](_0x2accc0[_0x107e('0x2c')]);_0x522a94[_0x107e('0x2e')]=_[_0x107e('0x2f')](_0x522a94[_0x107e('0x30')],_0x522a94[_0x107e('0x2c')]);_0x392dc6[_0x107e('0x31')]=_[_0x107e('0x2f')](_0x522a94[_0x107e('0x30')],qs[_0x107e('0x32')](_0x2accc0['query'][_0x107e('0x32')]));_0x392dc6[_0x107e('0x31')]=_0x392dc6['attributes'][_0x107e('0x40')]?_0x392dc6[_0x107e('0x31')]:_0x522a94[_0x107e('0x30')];_0x392dc6['order']=qs[_0x107e('0x35')](_0x2accc0[_0x107e('0x2c')][_0x107e('0x35')]);_0x392dc6[_0x107e('0x36')]=qs[_0x107e('0x2e')](_[_0x107e('0x4a')](_0x2accc0[_0x107e('0x2c')],_0x522a94[_0x107e('0x2e')]));if(_0x2accc0[_0x107e('0x2c')][_0x107e('0x37')]){_0x392dc6['where']=_[_0x107e('0x41')](_0x392dc6[_0x107e('0x36')],{'$or':_[_0x107e('0x27')](_0x392dc6[_0x107e('0x31')],function(_0x3cc75b){var _0x58e2ec={};_0x58e2ec[_0x3cc75b]={'$like':'%'+_0x2accc0[_0x107e('0x2c')][_0x107e('0x37')]+'%'};return _0x58e2ec;})});}_0x392dc6=_['merge']({},_0x392dc6,_0x2accc0[_0x107e('0x39')]);return _0x4199d0['getConfigurations'](_0x392dc6);}})[_0x107e('0x22')](function(_0x14635a){if(_0x14635a){_0xde8760=_0x14635a[_0x107e('0x40')];if(!_0x2accc0[_0x107e('0x2c')][_0x107e('0x33')](_0x107e('0x4b'))){_0x392dc6[_0x107e('0x34')]=qs['limit'](_0x2accc0[_0x107e('0x2c')]['limit']);_0x392dc6[_0x107e('0x19')]=qs[_0x107e('0x19')](_0x2accc0[_0x107e('0x2c')]['offset']);}return _0x4199d0[_0x107e('0x47')](_0x392dc6);}})[_0x107e('0x22')](function(_0x2d7ee7){if(_0x2d7ee7){return _0x2d7ee7?{'count':_0xde8760,'rows':_0x2d7ee7}:null;}})['then'](respondWithResult(_0xeb67b7,null))[_0x107e('0x3d')](handleError(_0xeb67b7,null));};exports[_0x107e('0x4c')]=function(_0x42af2f,_0x2c7681,_0x5a895c){if(_0x42af2f[_0x107e('0x44')]['id']){delete _0x42af2f[_0x107e('0x44')]['id'];}return db[_0x107e('0x28')][_0x107e('0x48')]({'where':{'id':_0x42af2f[_0x107e('0x45')]['id']}})[_0x107e('0x22')](handleEntityNotFound(_0x2c7681,null))['then'](function(_0x2dcb97){if(_0x2dcb97){_0x42af2f[_0x107e('0x44')][_0x107e('0x4d')]=_0x2dcb97['id'];_0x42af2f['body'][_0x107e('0x4e')]=integrations[_0x107e('0x4f')](_0x42af2f[_0x107e('0x44')][_0x107e('0x50')],_0x42af2f['body'][_0x107e('0x2a')]);_0x42af2f[_0x107e('0x44')][_0x107e('0x51')]=integrations[_0x107e('0x52')](_0x42af2f['body'][_0x107e('0x50')],_0x42af2f[_0x107e('0x44')][_0x107e('0x2a')]);return db[_0x107e('0x49')][_0x107e('0x43')](_0x42af2f[_0x107e('0x44')],{'include':[{'model':db['FreshsalesField'],'as':_0x107e('0x4e')},{'model':db[_0x107e('0x53')],'as':_0x107e('0x51')}]});}return null;})[_0x107e('0x22')](respondWithResult(_0x2c7681,null))[_0x107e('0x3d')](handleError(_0x2c7681,null));};exports[_0x107e('0x54')]=function(_0xd6d1bb,_0x1eb38a,_0x4f5cda){var _0xf4308f='';var _0xad4cc8='';return db[_0x107e('0x28')][_0x107e('0x48')]({'where':{'id':_0xd6d1bb[_0x107e('0x45')]['id']},'attributes':['id','username',_0x107e('0x55'),_0x107e('0x56')]})[_0x107e('0x22')](handleEntityNotFound(_0x1eb38a,null))[_0x107e('0x22')](function(_0x35cd61){if(_0x35cd61){_0xad4cc8=_0x35cd61[_0x107e('0x57')];_0xf4308f=_0x35cd61[_0x107e('0x55')];var _0x49f0eb=_0x35cd61['remoteUri'][_0x107e('0x58')](-0x1);if(_0x49f0eb==='/'){_0xf4308f=_0xf4308f['substring'](0x0,_0xf4308f[_0x107e('0x59')](_0x49f0eb));}return rp({'method':_0x107e('0x5a'),'uri':util[_0x107e('0x5b')]('%s%s',_0xf4308f,_0x107e('0x5c')),'headers':{'Authorization':_0x107e('0x5d')+_0x35cd61[_0x107e('0x56')]},'json':!![]});}})[_0x107e('0x22')](function(_0x8d14fa){if(_0x8d14fa){var _0x381ac8=_0x8d14fa[_0x107e('0x5e')];var _0x2eb530=![];var _0x5ef0d0=null;for(_0x5ef0d0=0x0;_0x5ef0d0<_0x381ac8['length'];_0x5ef0d0++){if(_0x381ac8[_0x5ef0d0]['email']===_0xad4cc8){_0x2eb530=!![];}}if(_0x2eb530){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x107e('0x5f')});}}})[_0x107e('0x22')](respondWithResult(_0x1eb38a,null))[_0x107e('0x3d')](function(_0x495f47){var _0x2e1b03=_0xd6d1bb['query'][_0x107e('0x60')]?0x1f4:_0x495f47[_0x107e('0x61')]||0x1f4;logger[_0x107e('0x62')](_0x107e('0x63'),'getFields',_0x2e1b03,JSON['stringify'](_0x495f47));delete _0x495f47[_0x107e('0x25')];if(_0x2e1b03===0x191){_0x2e1b03=0x190;}_0x1eb38a[_0x107e('0x17')](_0x2e1b03)['send'](_0xd6d1bb[_0x107e('0x2c')][_0x107e('0x60')]?{'message':'Wrong\x20credentials','statusCode':_0x495f47[_0x107e('0x61')]}:_0x495f47);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 949e4f3..ac6cd85 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 _0x4137=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','lodash','util','../../config/logger','api'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x4137,0xf8));var _0x7413=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x4137[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var logger=require(_0x7413('0x2'))(_0x7413('0x3'));var moment=require(_0x7413('0x4'));var BPromise=require(_0x7413('0x5'));var rp=require(_0x7413('0x6'));var fs=require('fs');var path=require(_0x7413('0x7'));var rimraf=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var attributes=require(_0x7413('0xa'));var integrations=require(_0x7413('0xb'));module['exports']=function(_0xc808cd,_0x188d89){return _0xc808cd[_0x7413('0xc')](_0x7413('0xd'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb145=['request-promise','path','rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x5cbe7e,_0x2496b6){var _0x266cb8=function(_0x1cb0a6){while(--_0x1cb0a6){_0x5cbe7e['push'](_0x5cbe7e['shift']());}};_0x266cb8(++_0x2496b6);}(_0xb145,0xa3));var _0x5b14=function(_0x2576bb,_0x3d59a1){_0x2576bb=_0x2576bb-0x0;var _0x5ec91f=_0xb145[_0x2576bb];return _0x5ec91f;};'use strict';var _=require('lodash');var util=require(_0x5b14('0x0'));var logger=require(_0x5b14('0x1'))(_0x5b14('0x2'));var moment=require(_0x5b14('0x3'));var BPromise=require(_0x5b14('0x4'));var rp=require(_0x5b14('0x5'));var fs=require('fs');var path=require(_0x5b14('0x6'));var rimraf=require(_0x5b14('0x7'));var config=require('../../config/environment');var attributes=require(_0x5b14('0x8'));var integrations=require(_0x5b14('0x9'));module[_0x5b14('0xa')]=function(_0x4d82ad,_0x50fd91){return _0x4d82ad[_0x5b14('0xb')](_0x5b14('0xc'),attributes,{'tableName':_0x5b14('0xd'),'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 0ee8ef0..28d71de 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 _0x5fab=['map','model','info','ShowFreshsalesAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesAccount,\x20%s,\x20%s','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','include','attributes'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5fab,0x177));var _0xb5fa=function(_0xf4d811,_0x11d532){_0xf4d811=_0xf4d811-0x0;var _0x1677f9=_0x5fab[_0xf4d811];return _0x1677f9;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});}exports[_0xb5fa('0x18')]=function(_0x32e9e5){var _0x46eef0=this;return new Promise(function(_0x324ba5,_0x13e82b){return db[_0xb5fa('0x19')][_0xb5fa('0x1a')]({'raw':_0x32e9e5[_0xb5fa('0x1b')]?_0x32e9e5[_0xb5fa('0x1b')][_0xb5fa('0x1c')]===undefined?!![]:![]:!![],'where':_0x32e9e5[_0xb5fa('0x1b')]?_0x32e9e5['options'][_0xb5fa('0x1d')]||null:null,'attributes':_0x32e9e5['options']?_0x32e9e5[_0xb5fa('0x1b')]['attributes']||null:null,'limit':_0x32e9e5[_0xb5fa('0x1b')]?_0x32e9e5[_0xb5fa('0x1b')]['limit']||null:null,'include':_0x32e9e5[_0xb5fa('0x1b')]?_0x32e9e5[_0xb5fa('0x1b')][_0xb5fa('0x1e')]?_['map'](_0x32e9e5[_0xb5fa('0x1b')][_0xb5fa('0x1e')],function(_0x444237){return{'model':db[_0x444237['model']],'as':_0x444237['as'],'attributes':_0x444237[_0xb5fa('0x1f')],'include':_0x444237['include']?_[_0xb5fa('0x20')](_0x444237[_0xb5fa('0x1e')],function(_0x11053a){return{'model':db[_0x11053a[_0xb5fa('0x21')]],'as':_0x11053a['as'],'attributes':_0x11053a[_0xb5fa('0x1f')],'include':_0x11053a[_0xb5fa('0x1e')]?_[_0xb5fa('0x20')](_0x11053a[_0xb5fa('0x1e')],function(_0x568870){return{'model':db[_0x568870['model']],'as':_0x568870['as'],'attributes':_0x568870['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x28a350){logger[_0xb5fa('0x22')](_0xb5fa('0x18'),_0x32e9e5);logger[_0xb5fa('0xf')](_0xb5fa('0x18'),_0x32e9e5,JSON[_0xb5fa('0x11')](_0x28a350));_0x324ba5(_0x28a350);})[_0xb5fa('0x17')](function(_0x353314){logger[_0xb5fa('0x12')](_0xb5fa('0x18'),_0x353314[_0xb5fa('0x14')],_0x32e9e5);_0x13e82b(_0x46eef0[_0xb5fa('0x12')](0x1f4,_0x353314[_0xb5fa('0x14')]));});});};exports[_0xb5fa('0x23')]=function(_0xed02e){var _0x116773=this;return new Promise(function(_0x5a0152,_0x3fd1fb){return db[_0xb5fa('0x19')][_0xb5fa('0x24')]({'raw':_0xed02e[_0xb5fa('0x1b')]?_0xed02e[_0xb5fa('0x1b')][_0xb5fa('0x1c')]===undefined?!![]:![]:!![],'where':_0xed02e[_0xb5fa('0x1b')]?_0xed02e['options'][_0xb5fa('0x1d')]||null:null,'attributes':_0xed02e['options']?_0xed02e['options']['attributes']||null:null,'include':_0xed02e[_0xb5fa('0x1b')]?_0xed02e['options'][_0xb5fa('0x1e')]?_['map'](_0xed02e['options'][_0xb5fa('0x1e')],function(_0x934b49){return{'model':db[_0x934b49['model']],'as':_0x934b49['as'],'attributes':_0x934b49['attributes'],'include':_0x934b49[_0xb5fa('0x1e')]?_[_0xb5fa('0x20')](_0x934b49[_0xb5fa('0x1e')],function(_0x560b53){return{'model':db[_0x560b53[_0xb5fa('0x21')]],'as':_0x560b53['as'],'attributes':_0x560b53[_0xb5fa('0x1f')],'include':_0x560b53['include']?_[_0xb5fa('0x20')](_0x560b53[_0xb5fa('0x1e')],function(_0x204d6b){return{'model':db[_0x204d6b['model']],'as':_0x204d6b['as'],'attributes':_0x204d6b[_0xb5fa('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb5fa('0xd')](function(_0x24ef11){logger['info'](_0xb5fa('0x23'),_0xed02e);logger[_0xb5fa('0xf')](_0xb5fa('0x23'),_0xed02e,JSON[_0xb5fa('0x11')](_0x24ef11));_0x5a0152(_0x24ef11);})['catch'](function(_0x4bba91){logger['error']('ShowFreshsalesAccount',_0x4bba91['message'],_0xed02e);_0x3fd1fb(_0x116773['error'](0x1f4,_0x4bba91[_0xb5fa('0x14')]));});});}; \ No newline at end of file +var _0x1967=['../../config/environment','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','limit','include','map','model','attributes','ShowFreshsalesAccount','find','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3f471b,_0x42dba4){var _0x278b96=function(_0x3ff93a){while(--_0x3ff93a){_0x3f471b['push'](_0x3f471b['shift']());}};_0x278b96(++_0x42dba4);}(_0x1967,0x173));var _0x7196=function(_0x549bff,_0x26c8ee){_0x549bff=_0x549bff-0x0;var _0xc76d0=_0x1967[_0x549bff];return _0xc76d0;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});}exports[_0x7196('0x18')]=function(_0x32fe2b){var _0x385f2d=this;return new Promise(function(_0x5b716a,_0x4c4f91){return db[_0x7196('0x19')][_0x7196('0x1a')]({'raw':_0x32fe2b[_0x7196('0x1b')]?_0x32fe2b['options'][_0x7196('0x1c')]===undefined?!![]:![]:!![],'where':_0x32fe2b['options']?_0x32fe2b['options'][_0x7196('0x1d')]||null:null,'attributes':_0x32fe2b[_0x7196('0x1b')]?_0x32fe2b[_0x7196('0x1b')]['attributes']||null:null,'limit':_0x32fe2b['options']?_0x32fe2b[_0x7196('0x1b')][_0x7196('0x1e')]||null:null,'include':_0x32fe2b['options']?_0x32fe2b[_0x7196('0x1b')][_0x7196('0x1f')]?_[_0x7196('0x20')](_0x32fe2b[_0x7196('0x1b')][_0x7196('0x1f')],function(_0x549f34){return{'model':db[_0x549f34[_0x7196('0x21')]],'as':_0x549f34['as'],'attributes':_0x549f34['attributes'],'include':_0x549f34[_0x7196('0x1f')]?_[_0x7196('0x20')](_0x549f34[_0x7196('0x1f')],function(_0xa69810){return{'model':db[_0xa69810[_0x7196('0x21')]],'as':_0xa69810['as'],'attributes':_0xa69810[_0x7196('0x22')],'include':_0xa69810['include']?_['map'](_0xa69810[_0x7196('0x1f')],function(_0x2d284f){return{'model':db[_0x2d284f[_0x7196('0x21')]],'as':_0x2d284f['as'],'attributes':_0x2d284f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x41cfd2){logger[_0x7196('0xe')](_0x7196('0x18'),_0x32fe2b);logger['debug'](_0x7196('0x18'),_0x32fe2b,JSON['stringify'](_0x41cfd2));_0x5b716a(_0x41cfd2);})[_0x7196('0x17')](function(_0x59d79d){logger[_0x7196('0x13')](_0x7196('0x18'),_0x59d79d[_0x7196('0x15')],_0x32fe2b);_0x4c4f91(_0x385f2d['error'](0x1f4,_0x59d79d[_0x7196('0x15')]));});});};exports[_0x7196('0x23')]=function(_0x2f9583){var _0xf999e9=this;return new Promise(function(_0x50c386,_0x39710d){return db[_0x7196('0x19')][_0x7196('0x24')]({'raw':_0x2f9583[_0x7196('0x1b')]?_0x2f9583[_0x7196('0x1b')][_0x7196('0x1c')]===undefined?!![]:![]:!![],'where':_0x2f9583[_0x7196('0x1b')]?_0x2f9583[_0x7196('0x1b')][_0x7196('0x1d')]||null:null,'attributes':_0x2f9583[_0x7196('0x1b')]?_0x2f9583[_0x7196('0x1b')]['attributes']||null:null,'include':_0x2f9583[_0x7196('0x1b')]?_0x2f9583['options'][_0x7196('0x1f')]?_['map'](_0x2f9583[_0x7196('0x1b')][_0x7196('0x1f')],function(_0x5616ed){return{'model':db[_0x5616ed[_0x7196('0x21')]],'as':_0x5616ed['as'],'attributes':_0x5616ed[_0x7196('0x22')],'include':_0x5616ed[_0x7196('0x1f')]?_[_0x7196('0x20')](_0x5616ed[_0x7196('0x1f')],function(_0x4a8580){return{'model':db[_0x4a8580[_0x7196('0x21')]],'as':_0x4a8580['as'],'attributes':_0x4a8580[_0x7196('0x22')],'include':_0x4a8580[_0x7196('0x1f')]?_[_0x7196('0x20')](_0x4a8580[_0x7196('0x1f')],function(_0x123cad){return{'model':db[_0x123cad['model']],'as':_0x123cad['as'],'attributes':_0x123cad[_0x7196('0x22')]};}):[]};}):[]};}):[]:[]})[_0x7196('0xd')](function(_0x191df2){logger['info'](_0x7196('0x23'),_0x2f9583);logger[_0x7196('0x25')](_0x7196('0x23'),_0x2f9583,JSON[_0x7196('0x12')](_0x191df2));_0x50c386(_0x191df2);})[_0x7196('0x17')](function(_0x31fca7){logger[_0x7196('0x13')](_0x7196('0x23'),_0x31fca7[_0x7196('0x15')],_0x2f9583);_0x39710d(_0xf999e9[_0x7196('0x13')](0x1f4,_0x31fca7['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 279db26..036157a 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 _0x136f=['index','/:id','show','get','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getFields','create','put','update','delete','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x310b96,_0x278a87){var _0x3c358=function(_0x1a0790){while(--_0x1a0790){_0x310b96['push'](_0x310b96['shift']());}};_0x3c358(++_0x278a87);}(_0x136f,0x92));var _0xf136=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x136f[_0x35da42];return _0x370035;};'use strict';var multer=require(_0xf136('0x0'));var util=require('util');var path=require(_0xf136('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf136('0x2')]();var fs_extra=require(_0xf136('0x3'));var auth=require(_0xf136('0x4'));var interaction=require(_0xf136('0x5'));var config=require(_0xf136('0x6'));var controller=require('./intFreshsalesConfiguration.controller');router['get']('/',auth[_0xf136('0x7')](),controller[_0xf136('0x8')]);router['get'](_0xf136('0x9'),auth[_0xf136('0x7')](),controller[_0xf136('0xa')]);router[_0xf136('0xb')](_0xf136('0xc'),auth[_0xf136('0x7')](),controller[_0xf136('0xd')]);router['get'](_0xf136('0xe'),auth['isAuthenticated'](),controller[_0xf136('0xf')]);router[_0xf136('0xb')]('/:id/fields',auth[_0xf136('0x7')](),controller[_0xf136('0x10')]);router['post']('/',auth[_0xf136('0x7')](),controller[_0xf136('0x11')]);router[_0xf136('0x12')](_0xf136('0x9'),auth['isAuthenticated'](),controller[_0xf136('0x13')]);router[_0xf136('0x14')]('/:id',auth[_0xf136('0x7')](),controller['destroy']);module[_0xf136('0x15')]=router; \ No newline at end of file +var _0x3f0d=['/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','post','create','update','delete','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated'];(function(_0x4a39af,_0x86837){var _0x33a9a5=function(_0x5cbaac){while(--_0x5cbaac){_0x4a39af['push'](_0x4a39af['shift']());}};_0x33a9a5(++_0x86837);}(_0x3f0d,0x197));var _0xd3f0=function(_0x5e9419,_0x4ff04f){_0x5e9419=_0x5e9419-0x0;var _0x302623=_0x3f0d[_0x5e9419];return _0x302623;};'use strict';var multer=require(_0xd3f0('0x0'));var util=require(_0xd3f0('0x1'));var path=require(_0xd3f0('0x2'));var timeout=require(_0xd3f0('0x3'));var express=require('express');var router=express[_0xd3f0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd3f0('0x5'));var interaction=require(_0xd3f0('0x6'));var config=require(_0xd3f0('0x7'));var controller=require(_0xd3f0('0x8'));router[_0xd3f0('0x9')]('/',auth[_0xd3f0('0xa')](),controller['index']);router[_0xd3f0('0x9')](_0xd3f0('0xb'),auth[_0xd3f0('0xa')](),controller[_0xd3f0('0xc')]);router[_0xd3f0('0x9')](_0xd3f0('0xd'),auth[_0xd3f0('0xa')](),controller[_0xd3f0('0xe')]);router[_0xd3f0('0x9')](_0xd3f0('0xf'),auth['isAuthenticated'](),controller[_0xd3f0('0x10')]);router[_0xd3f0('0x9')](_0xd3f0('0x11'),auth[_0xd3f0('0xa')](),controller['getFields']);router[_0xd3f0('0x12')]('/',auth[_0xd3f0('0xa')](),controller[_0xd3f0('0x13')]);router['put'](_0xd3f0('0xb'),auth['isAuthenticated'](),controller[_0xd3f0('0x14')]);router[_0xd3f0('0x15')](_0xd3f0('0xb'),auth[_0xd3f0('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 410bd5a..9a0400a 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 _0xf403=['exports','STRING','sequelize'];(function(_0x2d64d2,_0x5a14e4){var _0x3f6fbe=function(_0x797cbd){while(--_0x797cbd){_0x2d64d2['push'](_0x2d64d2['shift']());}};_0x3f6fbe(++_0x5a14e4);}(_0xf403,0x182));var _0x3f40=function(_0x4f2a5b,_0x3eac97){_0x4f2a5b=_0x4f2a5b-0x0;var _0x2df3d2=_0xf403[_0x4f2a5b];return _0x2df3d2;};'use strict';var Sequelize=require(_0x3f40('0x0'));module[_0x3f40('0x1')]={'name':{'type':Sequelize[_0x3f40('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc83f=['sequelize','exports','STRING'];(function(_0x4f4b44,_0x1f3277){var _0x5f0781=function(_0x210cfd){while(--_0x210cfd){_0x4f4b44['push'](_0x4f4b44['shift']());}};_0x5f0781(++_0x1f3277);}(_0xc83f,0x8d));var _0xfc83=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0xc83f[_0x386c3e];return _0x4b8e13;};'use strict';var Sequelize=require(_0xfc83('0x0'));module[_0xfc83('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfc83('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index ef5dbe2..5d99270 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 _0x3c8b=['merge','VIRTUAL','options','then','include','findAll','rows','catch','show','params','length','includeAll','create','body','find','getSubjects','FreshsalesField','getDescriptions','findOne','getFields','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','FreshsalesConfiguration','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x542702,_0x1d86e1){var _0xec690b=function(_0x20b876){while(--_0x20b876){_0x542702['push'](_0x542702['shift']());}};_0xec690b(++_0x1d86e1);}(_0x3c8b,0x1ae));var _0xb3c8=function(_0x5f1a22,_0x54a725){_0x5f1a22=_0x5f1a22-0x0;var _0x2e8a43=_0x3c8b[_0x5f1a22];return _0x2e8a43;};'use strict';var emlformat=require(_0xb3c8('0x0'));var rimraf=require(_0xb3c8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb3c8('0x2'));var rp=require(_0xb3c8('0x3'));var moment=require(_0xb3c8('0x4'));var BPromise=require(_0xb3c8('0x5'));var Mustache=require(_0xb3c8('0x6'));var util=require(_0xb3c8('0x7'));var path=require('path');var sox=require(_0xb3c8('0x8'));var csv=require(_0xb3c8('0x9'));var ejs=require(_0xb3c8('0xa'));var fs=require('fs');var fs_extra=require(_0xb3c8('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb3c8('0xc'));var jsforce=require(_0xb3c8('0xd'));var deskjs=require(_0xb3c8('0xe'));var toCsv=require(_0xb3c8('0x9'));var querystring=require(_0xb3c8('0xf'));var Papa=require(_0xb3c8('0x10'));var Redis=require(_0xb3c8('0x11'));var authService=require(_0xb3c8('0x12'));var qs=require(_0xb3c8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb3c8('0x14'));var logger=require('../../config/logger')(_0xb3c8('0x15'));var utils=require('../../config/utils');var config=require(_0xb3c8('0x16'));var licenseUtil=require(_0xb3c8('0x17'));var db=require(_0xb3c8('0x18'))['db'];function respondWithStatusCode(_0x42c1db,_0x30bccc){_0x30bccc=_0x30bccc||0xcc;return function(_0x39cb83){if(_0x39cb83){return _0x42c1db[_0xb3c8('0x19')](_0x30bccc);}return _0x42c1db['status'](_0x30bccc)['end']();};}function respondWithResult(_0x3c8ba9,_0xecace0){_0xecace0=_0xecace0||0xc8;return function(_0x202d53){if(_0x202d53){return _0x3c8ba9[_0xb3c8('0x1a')](_0xecace0)[_0xb3c8('0x1b')](_0x202d53);}};}function respondWithFilteredResult(_0x2cd11f,_0xfc95b8){return function(_0x40930c){if(_0x40930c){var _0x49eded=typeof _0xfc95b8[_0xb3c8('0x1c')]===_0xb3c8('0x1d')&&typeof _0xfc95b8[_0xb3c8('0x1e')]===_0xb3c8('0x1d');var _0x1c579a=_0x40930c[_0xb3c8('0x1f')];var _0x352f52=_0x49eded?0x0:_0xfc95b8[_0xb3c8('0x1c')];var _0x3d24b7=_0x49eded?_0x40930c['count']:_0xfc95b8['offset']+_0xfc95b8[_0xb3c8('0x1e')];var _0x4b0578;if(_0x3d24b7>=_0x1c579a){_0x3d24b7=_0x1c579a;_0x4b0578=0xc8;}else{_0x4b0578=0xce;}_0x2cd11f[_0xb3c8('0x1a')](_0x4b0578);return _0x2cd11f[_0xb3c8('0x20')](_0xb3c8('0x21'),_0x352f52+'-'+_0x3d24b7+'/'+_0x1c579a)[_0xb3c8('0x1b')](_0x40930c);}return null;};}function patchUpdates(_0x130e51){return function(_0x2fcf30){try{jsonpatch[_0xb3c8('0x22')](_0x2fcf30,_0x130e51,!![]);}catch(_0x55a9ab){return BPromise[_0xb3c8('0x23')](_0x55a9ab);}return _0x2fcf30[_0xb3c8('0x24')]();};}function saveUpdates(_0x54e710,_0x1ae9ee){return function(_0x2cea66){if(_0x2cea66){return _0x2cea66[_0xb3c8('0x25')](_0x54e710)['then'](function(_0x3c648e){return _0x3c648e;});}return null;};}function removeEntity(_0x250296,_0x56968f){return function(_0x30468f){if(_0x30468f){return _0x30468f[_0xb3c8('0x26')]()['then'](function(){_0x250296['status'](0xcc)[_0xb3c8('0x27')]();});}};}function handleEntityNotFound(_0x456694,_0x4cb3ac){return function(_0x1a0af4){if(!_0x1a0af4){_0x456694[_0xb3c8('0x19')](0x194);}return _0x1a0af4;};}function handleError(_0xc927f9,_0x588e45){_0x588e45=_0x588e45||0x1f4;return function(_0x10a5fb){logger['error'](_0x10a5fb[_0xb3c8('0x28')]);if(_0x10a5fb['name']){delete _0x10a5fb[_0xb3c8('0x29')];}_0xc927f9[_0xb3c8('0x1a')](_0x588e45)[_0xb3c8('0x2a')](_0x10a5fb);};}exports['index']=function(_0x5558d5,_0x3d8e63){var _0x3500d6={},_0x1b09d2={},_0x596f4c={'count':0x0,'rows':[]};var _0x18e20f=_['map'](db[_0xb3c8('0x2b')][_0xb3c8('0x2c')],function(_0x122154){return{'name':_0x122154['fieldName'],'type':_0x122154[_0xb3c8('0x2d')][_0xb3c8('0x2e')]};});_0x1b09d2[_0xb3c8('0x2f')]=_[_0xb3c8('0x30')](_0x18e20f,_0xb3c8('0x29'));_0x1b09d2[_0xb3c8('0x31')]=_[_0xb3c8('0x32')](_0x5558d5[_0xb3c8('0x31')]);_0x1b09d2[_0xb3c8('0x33')]=_['intersection'](_0x1b09d2[_0xb3c8('0x2f')],_0x1b09d2[_0xb3c8('0x31')]);_0x3500d6[_0xb3c8('0x34')]=_[_0xb3c8('0x35')](_0x1b09d2[_0xb3c8('0x2f')],qs[_0xb3c8('0x36')](_0x5558d5[_0xb3c8('0x31')][_0xb3c8('0x36')]));_0x3500d6[_0xb3c8('0x34')]=_0x3500d6[_0xb3c8('0x34')]['length']?_0x3500d6[_0xb3c8('0x34')]:_0x1b09d2[_0xb3c8('0x2f')];if(!_0x5558d5[_0xb3c8('0x31')][_0xb3c8('0x37')](_0xb3c8('0x38'))){_0x3500d6[_0xb3c8('0x1e')]=qs[_0xb3c8('0x1e')](_0x5558d5[_0xb3c8('0x31')][_0xb3c8('0x1e')]);_0x3500d6[_0xb3c8('0x1c')]=qs[_0xb3c8('0x1c')](_0x5558d5[_0xb3c8('0x31')]['offset']);}_0x3500d6[_0xb3c8('0x39')]=qs[_0xb3c8('0x3a')](_0x5558d5[_0xb3c8('0x31')]['sort']);_0x3500d6[_0xb3c8('0x3b')]=qs[_0xb3c8('0x33')](_[_0xb3c8('0x3c')](_0x5558d5['query'],_0x1b09d2['filters']),_0x18e20f);if(_0x5558d5[_0xb3c8('0x31')][_0xb3c8('0x3d')]){_0x3500d6[_0xb3c8('0x3b')]=_[_0xb3c8('0x3e')](_0x3500d6[_0xb3c8('0x3b')],{'$or':_[_0xb3c8('0x30')](_0x18e20f,function(_0x64ab8a){if(_0x64ab8a[_0xb3c8('0x2d')]!==_0xb3c8('0x3f')){var _0x31b0ec={};_0x31b0ec[_0x64ab8a[_0xb3c8('0x29')]]={'$like':'%'+_0x5558d5['query']['filter']+'%'};return _0x31b0ec;}})});}_0x3500d6=_[_0xb3c8('0x3e')]({},_0x3500d6,_0x5558d5[_0xb3c8('0x40')]);var _0x1d4368={'where':_0x3500d6[_0xb3c8('0x3b')]};return db[_0xb3c8('0x2b')][_0xb3c8('0x1f')](_0x1d4368)[_0xb3c8('0x41')](function(_0x91b1b6){_0x596f4c[_0xb3c8('0x1f')]=_0x91b1b6;if(_0x5558d5['query']['includeAll']){_0x3500d6[_0xb3c8('0x42')]=[{'all':!![]}];}return db[_0xb3c8('0x2b')][_0xb3c8('0x43')](_0x3500d6);})[_0xb3c8('0x41')](function(_0x4c8b7f){_0x596f4c[_0xb3c8('0x44')]=_0x4c8b7f;return _0x596f4c;})[_0xb3c8('0x41')](respondWithFilteredResult(_0x3d8e63,_0x3500d6))[_0xb3c8('0x45')](handleError(_0x3d8e63,null));};exports[_0xb3c8('0x46')]=function(_0x3f0c7c,_0xb6423e){var _0x274de3={'raw':![],'where':{'id':_0x3f0c7c[_0xb3c8('0x47')]['id']}},_0x3936ca={};_0x3936ca['model']=_['keys'](db[_0xb3c8('0x2b')]['rawAttributes']);_0x3936ca[_0xb3c8('0x31')]=_[_0xb3c8('0x32')](_0x3f0c7c[_0xb3c8('0x31')]);_0x3936ca[_0xb3c8('0x33')]=_[_0xb3c8('0x35')](_0x3936ca[_0xb3c8('0x2f')],_0x3936ca[_0xb3c8('0x31')]);_0x274de3['attributes']=_[_0xb3c8('0x35')](_0x3936ca['model'],qs[_0xb3c8('0x36')](_0x3f0c7c[_0xb3c8('0x31')][_0xb3c8('0x36')]));_0x274de3[_0xb3c8('0x34')]=_0x274de3[_0xb3c8('0x34')][_0xb3c8('0x48')]?_0x274de3[_0xb3c8('0x34')]:_0x3936ca[_0xb3c8('0x2f')];if(_0x3f0c7c['query'][_0xb3c8('0x49')]){_0x274de3[_0xb3c8('0x42')]=[{'all':!![]}];}_0x274de3=_[_0xb3c8('0x3e')]({},_0x274de3,_0x3f0c7c['options']);return db[_0xb3c8('0x2b')]['find'](_0x274de3)[_0xb3c8('0x41')](handleEntityNotFound(_0xb6423e,null))[_0xb3c8('0x41')](respondWithResult(_0xb6423e,null))[_0xb3c8('0x45')](handleError(_0xb6423e,null));};exports[_0xb3c8('0x4a')]=function(_0x449c93,_0x3f812a){return db[_0xb3c8('0x2b')]['create'](_0x449c93['body'],{})[_0xb3c8('0x41')](respondWithResult(_0x3f812a,0xc9))[_0xb3c8('0x45')](handleError(_0x3f812a,null));};exports[_0xb3c8('0x25')]=function(_0x3b9a32,_0xa7c301){if(_0x3b9a32[_0xb3c8('0x4b')]['id']){delete _0x3b9a32['body']['id'];}return db[_0xb3c8('0x2b')][_0xb3c8('0x4c')]({'where':{'id':_0x3b9a32[_0xb3c8('0x47')]['id']}})['then'](handleEntityNotFound(_0xa7c301,null))[_0xb3c8('0x41')](saveUpdates(_0x3b9a32[_0xb3c8('0x4b')],null))[_0xb3c8('0x41')](respondWithResult(_0xa7c301,null))[_0xb3c8('0x45')](handleError(_0xa7c301,null));};exports['destroy']=function(_0x3b18f6,_0x155d0a){return db[_0xb3c8('0x2b')][_0xb3c8('0x4c')]({'where':{'id':_0x3b18f6[_0xb3c8('0x47')]['id']}})[_0xb3c8('0x41')](handleEntityNotFound(_0x155d0a,null))[_0xb3c8('0x41')](removeEntity(_0x155d0a,null))['catch'](handleError(_0x155d0a,null));};exports[_0xb3c8('0x4d')]=function(_0x2a9427,_0x15c9c1,_0x1914b4){var _0x29a8c0={};var _0x2d36c9={};var _0x230398;var _0x507b63;return db[_0xb3c8('0x2b')]['findOne']({'where':{'id':_0x2a9427[_0xb3c8('0x47')]['id']}})[_0xb3c8('0x41')](handleEntityNotFound(_0x15c9c1,null))[_0xb3c8('0x41')](function(_0x1bcdc6){if(_0x1bcdc6){_0x230398=_0x1bcdc6;_0x2d36c9[_0xb3c8('0x2f')]=_[_0xb3c8('0x32')](db[_0xb3c8('0x4e')][_0xb3c8('0x2c')]);_0x2d36c9['query']=_[_0xb3c8('0x32')](_0x2a9427[_0xb3c8('0x31')]);_0x2d36c9['filters']=_['intersection'](_0x2d36c9[_0xb3c8('0x2f')],_0x2d36c9[_0xb3c8('0x31')]);_0x29a8c0['attributes']=_[_0xb3c8('0x35')](_0x2d36c9[_0xb3c8('0x2f')],qs[_0xb3c8('0x36')](_0x2a9427[_0xb3c8('0x31')]['fields']));_0x29a8c0['attributes']=_0x29a8c0[_0xb3c8('0x34')][_0xb3c8('0x48')]?_0x29a8c0['attributes']:_0x2d36c9[_0xb3c8('0x2f')];_0x29a8c0['order']=qs[_0xb3c8('0x3a')](_0x2a9427[_0xb3c8('0x31')][_0xb3c8('0x3a')]);_0x29a8c0[_0xb3c8('0x3b')]=qs[_0xb3c8('0x33')](_[_0xb3c8('0x3c')](_0x2a9427[_0xb3c8('0x31')],_0x2d36c9[_0xb3c8('0x33')]));if(_0x2a9427[_0xb3c8('0x31')][_0xb3c8('0x3d')]){_0x29a8c0['where']=_[_0xb3c8('0x3e')](_0x29a8c0[_0xb3c8('0x3b')],{'$or':_[_0xb3c8('0x30')](_0x29a8c0[_0xb3c8('0x34')],function(_0x166b81){var _0x2c6a67={};_0x2c6a67[_0x166b81]={'$like':'%'+_0x2a9427['query'][_0xb3c8('0x3d')]+'%'};return _0x2c6a67;})});}_0x29a8c0=_['merge']({},_0x29a8c0,_0x2a9427[_0xb3c8('0x40')]);return _0x230398[_0xb3c8('0x4d')](_0x29a8c0);}})['then'](function(_0x25cf2c){if(_0x25cf2c){_0x507b63=_0x25cf2c[_0xb3c8('0x48')];if(!_0x2a9427['query'][_0xb3c8('0x37')](_0xb3c8('0x38'))){_0x29a8c0[_0xb3c8('0x1e')]=qs[_0xb3c8('0x1e')](_0x2a9427[_0xb3c8('0x31')][_0xb3c8('0x1e')]);_0x29a8c0['offset']=qs[_0xb3c8('0x1c')](_0x2a9427[_0xb3c8('0x31')][_0xb3c8('0x1c')]);}return _0x230398[_0xb3c8('0x4d')](_0x29a8c0);}})[_0xb3c8('0x41')](function(_0x43f8f5){if(_0x43f8f5){return _0x43f8f5?{'count':_0x507b63,'rows':_0x43f8f5}:null;}})[_0xb3c8('0x41')](respondWithResult(_0x15c9c1,null))['catch'](handleError(_0x15c9c1,null));};exports[_0xb3c8('0x4f')]=function(_0x190977,_0x2e35e8,_0x4f484c){var _0x52baf9={};var _0x284288={};var _0x2c9a01;var _0x2121ab;return db[_0xb3c8('0x2b')][_0xb3c8('0x50')]({'where':{'id':_0x190977['params']['id']}})[_0xb3c8('0x41')](handleEntityNotFound(_0x2e35e8,null))[_0xb3c8('0x41')](function(_0x365fd0){if(_0x365fd0){_0x2c9a01=_0x365fd0;_0x284288['model']=_[_0xb3c8('0x32')](db[_0xb3c8('0x4e')][_0xb3c8('0x2c')]);_0x284288[_0xb3c8('0x31')]=_['keys'](_0x190977[_0xb3c8('0x31')]);_0x284288[_0xb3c8('0x33')]=_[_0xb3c8('0x35')](_0x284288[_0xb3c8('0x2f')],_0x284288[_0xb3c8('0x31')]);_0x52baf9[_0xb3c8('0x34')]=_[_0xb3c8('0x35')](_0x284288[_0xb3c8('0x2f')],qs['fields'](_0x190977[_0xb3c8('0x31')][_0xb3c8('0x36')]));_0x52baf9[_0xb3c8('0x34')]=_0x52baf9[_0xb3c8('0x34')][_0xb3c8('0x48')]?_0x52baf9['attributes']:_0x284288[_0xb3c8('0x2f')];_0x52baf9[_0xb3c8('0x39')]=qs['sort'](_0x190977[_0xb3c8('0x31')][_0xb3c8('0x3a')]);_0x52baf9[_0xb3c8('0x3b')]=qs[_0xb3c8('0x33')](_[_0xb3c8('0x3c')](_0x190977[_0xb3c8('0x31')],_0x284288['filters']));if(_0x190977[_0xb3c8('0x31')][_0xb3c8('0x3d')]){_0x52baf9[_0xb3c8('0x3b')]=_['merge'](_0x52baf9[_0xb3c8('0x3b')],{'$or':_[_0xb3c8('0x30')](_0x52baf9[_0xb3c8('0x34')],function(_0x3dc38f){var _0x12ad28={};_0x12ad28[_0x3dc38f]={'$like':'%'+_0x190977['query']['filter']+'%'};return _0x12ad28;})});}_0x52baf9=_[_0xb3c8('0x3e')]({},_0x52baf9,_0x190977[_0xb3c8('0x40')]);return _0x2c9a01[_0xb3c8('0x4f')](_0x52baf9);}})['then'](function(_0x5c3f7b){if(_0x5c3f7b){_0x2121ab=_0x5c3f7b[_0xb3c8('0x48')];if(!_0x190977[_0xb3c8('0x31')][_0xb3c8('0x37')]('nolimit')){_0x52baf9['limit']=qs[_0xb3c8('0x1e')](_0x190977['query'][_0xb3c8('0x1e')]);_0x52baf9[_0xb3c8('0x1c')]=qs[_0xb3c8('0x1c')](_0x190977['query'][_0xb3c8('0x1c')]);}return _0x2c9a01[_0xb3c8('0x4f')](_0x52baf9);}})[_0xb3c8('0x41')](function(_0x193edc){if(_0x193edc){return _0x193edc?{'count':_0x2121ab,'rows':_0x193edc}:null;}})['then'](respondWithResult(_0x2e35e8,null))[_0xb3c8('0x45')](handleError(_0x2e35e8,null));};exports['getFields']=function(_0x321026,_0x4f8406,_0x94ca91){var _0x538baa={};var _0x19f3fc={};var _0x320197;var _0x48231b;return db[_0xb3c8('0x2b')][_0xb3c8('0x50')]({'where':{'id':_0x321026['params']['id']}})['then'](handleEntityNotFound(_0x4f8406,null))[_0xb3c8('0x41')](function(_0xc0b975){if(_0xc0b975){_0x320197=_0xc0b975;_0x19f3fc['model']=_['keys'](db['FreshsalesField'][_0xb3c8('0x2c')]);_0x19f3fc[_0xb3c8('0x31')]=_['keys'](_0x321026['query']);_0x19f3fc[_0xb3c8('0x33')]=_[_0xb3c8('0x35')](_0x19f3fc[_0xb3c8('0x2f')],_0x19f3fc[_0xb3c8('0x31')]);_0x538baa[_0xb3c8('0x34')]=_[_0xb3c8('0x35')](_0x19f3fc[_0xb3c8('0x2f')],qs[_0xb3c8('0x36')](_0x321026['query']['fields']));_0x538baa['attributes']=_0x538baa[_0xb3c8('0x34')][_0xb3c8('0x48')]?_0x538baa[_0xb3c8('0x34')]:_0x19f3fc[_0xb3c8('0x2f')];_0x538baa[_0xb3c8('0x39')]=qs[_0xb3c8('0x3a')](_0x321026[_0xb3c8('0x31')][_0xb3c8('0x3a')]);_0x538baa[_0xb3c8('0x3b')]=qs[_0xb3c8('0x33')](_[_0xb3c8('0x3c')](_0x321026[_0xb3c8('0x31')],_0x19f3fc[_0xb3c8('0x33')]));if(_0x321026[_0xb3c8('0x31')][_0xb3c8('0x3d')]){_0x538baa[_0xb3c8('0x3b')]=_['merge'](_0x538baa[_0xb3c8('0x3b')],{'$or':_[_0xb3c8('0x30')](_0x538baa[_0xb3c8('0x34')],function(_0x3b41f5){var _0x5231f1={};_0x5231f1[_0x3b41f5]={'$like':'%'+_0x321026[_0xb3c8('0x31')]['filter']+'%'};return _0x5231f1;})});}_0x538baa=_['merge']({},_0x538baa,_0x321026[_0xb3c8('0x40')]);return _0x320197['getFields'](_0x538baa);}})[_0xb3c8('0x41')](function(_0x5ade4f){if(_0x5ade4f){_0x48231b=_0x5ade4f[_0xb3c8('0x48')];if(!_0x321026['query'][_0xb3c8('0x37')](_0xb3c8('0x38'))){_0x538baa[_0xb3c8('0x1e')]=qs[_0xb3c8('0x1e')](_0x321026[_0xb3c8('0x31')][_0xb3c8('0x1e')]);_0x538baa[_0xb3c8('0x1c')]=qs['offset'](_0x321026[_0xb3c8('0x31')]['offset']);}return _0x320197[_0xb3c8('0x51')](_0x538baa);}})[_0xb3c8('0x41')](function(_0x550345){if(_0x550345){return _0x550345?{'count':_0x48231b,'rows':_0x550345}:null;}})[_0xb3c8('0x41')](respondWithResult(_0x4f8406,null))[_0xb3c8('0x45')](handleError(_0x4f8406,null));}; \ No newline at end of file +var _0x7d68=['querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','send','FreshsalesConfiguration','fieldName','type','key','model','map','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','catch','create','body','getSubjects','findOne','keys','FreshsalesField','pick','getDescriptions','getFields','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js'];(function(_0x56ce7d,_0x57d050){var _0x72a880=function(_0x3179a2){while(--_0x3179a2){_0x56ce7d['push'](_0x56ce7d['shift']());}};_0x72a880(++_0x57d050);}(_0x7d68,0x1d7));var _0x87d6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d68[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x87d6('0x0'));var rimraf=require(_0x87d6('0x1'));var zipdir=require(_0x87d6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x87d6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x87d6('0x4'));var util=require(_0x87d6('0x5'));var path=require(_0x87d6('0x6'));var sox=require(_0x87d6('0x7'));var csv=require(_0x87d6('0x8'));var ejs=require(_0x87d6('0x9'));var fs=require('fs');var fs_extra=require(_0x87d6('0xa'));var _=require(_0x87d6('0xb'));var squel=require(_0x87d6('0xc'));var crypto=require(_0x87d6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x87d6('0xe'));var toCsv=require(_0x87d6('0x8'));var querystring=require(_0x87d6('0xf'));var Papa=require(_0x87d6('0x10'));var Redis=require(_0x87d6('0x11'));var authService=require(_0x87d6('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x87d6('0x13'));var logger=require('../../config/logger')(_0x87d6('0x14'));var utils=require(_0x87d6('0x15'));var config=require(_0x87d6('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x115cec,_0x1f7ad9){_0x1f7ad9=_0x1f7ad9||0xcc;return function(_0x269188){if(_0x269188){return _0x115cec[_0x87d6('0x17')](_0x1f7ad9);}return _0x115cec[_0x87d6('0x18')](_0x1f7ad9)[_0x87d6('0x19')]();};}function respondWithResult(_0x47dd40,_0x504969){_0x504969=_0x504969||0xc8;return function(_0x19c073){if(_0x19c073){return _0x47dd40['status'](_0x504969)[_0x87d6('0x1a')](_0x19c073);}};}function respondWithFilteredResult(_0x513631,_0x139c05){return function(_0x14a588){if(_0x14a588){var _0x5098c6=typeof _0x139c05['offset']==='undefined'&&typeof _0x139c05[_0x87d6('0x1b')]===_0x87d6('0x1c');var _0x246048=_0x14a588['count'];var _0x29cd5c=_0x5098c6?0x0:_0x139c05[_0x87d6('0x1d')];var _0x56ca1b=_0x5098c6?_0x14a588[_0x87d6('0x1e')]:_0x139c05[_0x87d6('0x1d')]+_0x139c05['limit'];var _0x33d062;if(_0x56ca1b>=_0x246048){_0x56ca1b=_0x246048;_0x33d062=0xc8;}else{_0x33d062=0xce;}_0x513631[_0x87d6('0x18')](_0x33d062);return _0x513631[_0x87d6('0x1f')](_0x87d6('0x20'),_0x29cd5c+'-'+_0x56ca1b+'/'+_0x246048)[_0x87d6('0x1a')](_0x14a588);}return null;};}function patchUpdates(_0x51d2fd){return function(_0x2e03d6){try{jsonpatch[_0x87d6('0x21')](_0x2e03d6,_0x51d2fd,!![]);}catch(_0x397f53){return BPromise[_0x87d6('0x22')](_0x397f53);}return _0x2e03d6[_0x87d6('0x23')]();};}function saveUpdates(_0x50f25a,_0x30417d){return function(_0x2cde60){if(_0x2cde60){return _0x2cde60[_0x87d6('0x24')](_0x50f25a)[_0x87d6('0x25')](function(_0xbc6b2b){return _0xbc6b2b;});}return null;};}function removeEntity(_0x53964e,_0x22b6a4){return function(_0x4d7f99){if(_0x4d7f99){return _0x4d7f99[_0x87d6('0x26')]()['then'](function(){_0x53964e[_0x87d6('0x18')](0xcc)[_0x87d6('0x19')]();});}};}function handleEntityNotFound(_0x23e6e6,_0x1a5be5){return function(_0x3c2449){if(!_0x3c2449){_0x23e6e6['sendStatus'](0x194);}return _0x3c2449;};}function handleError(_0x1ab64e,_0x5c9da3){_0x5c9da3=_0x5c9da3||0x1f4;return function(_0x2a579d){logger[_0x87d6('0x27')](_0x2a579d['stack']);if(_0x2a579d['name']){delete _0x2a579d['name'];}_0x1ab64e[_0x87d6('0x18')](_0x5c9da3)[_0x87d6('0x28')](_0x2a579d);};}exports['index']=function(_0x20709b,_0x18a869){var _0x4088b3={},_0x46297b={},_0xa82d2d={'count':0x0,'rows':[]};var _0x1ecd54=_['map'](db[_0x87d6('0x29')]['rawAttributes'],function(_0x129659){return{'name':_0x129659[_0x87d6('0x2a')],'type':_0x129659[_0x87d6('0x2b')][_0x87d6('0x2c')]};});_0x46297b[_0x87d6('0x2d')]=_[_0x87d6('0x2e')](_0x1ecd54,_0x87d6('0x2f'));_0x46297b[_0x87d6('0x30')]=_['keys'](_0x20709b[_0x87d6('0x30')]);_0x46297b[_0x87d6('0x31')]=_[_0x87d6('0x32')](_0x46297b['model'],_0x46297b[_0x87d6('0x30')]);_0x4088b3[_0x87d6('0x33')]=_[_0x87d6('0x32')](_0x46297b['model'],qs['fields'](_0x20709b[_0x87d6('0x30')][_0x87d6('0x34')]));_0x4088b3[_0x87d6('0x33')]=_0x4088b3[_0x87d6('0x33')][_0x87d6('0x35')]?_0x4088b3[_0x87d6('0x33')]:_0x46297b[_0x87d6('0x2d')];if(!_0x20709b['query'][_0x87d6('0x36')](_0x87d6('0x37'))){_0x4088b3[_0x87d6('0x1b')]=qs[_0x87d6('0x1b')](_0x20709b['query']['limit']);_0x4088b3[_0x87d6('0x1d')]=qs[_0x87d6('0x1d')](_0x20709b[_0x87d6('0x30')][_0x87d6('0x1d')]);}_0x4088b3[_0x87d6('0x38')]=qs['sort'](_0x20709b[_0x87d6('0x30')][_0x87d6('0x39')]);_0x4088b3[_0x87d6('0x3a')]=qs['filters'](_['pick'](_0x20709b[_0x87d6('0x30')],_0x46297b[_0x87d6('0x31')]),_0x1ecd54);if(_0x20709b[_0x87d6('0x30')][_0x87d6('0x3b')]){_0x4088b3[_0x87d6('0x3a')]=_[_0x87d6('0x3c')](_0x4088b3['where'],{'$or':_[_0x87d6('0x2e')](_0x1ecd54,function(_0x56ba43){if(_0x56ba43[_0x87d6('0x2b')]!==_0x87d6('0x3d')){var _0x4cd8c2={};_0x4cd8c2[_0x56ba43[_0x87d6('0x2f')]]={'$like':'%'+_0x20709b['query'][_0x87d6('0x3b')]+'%'};return _0x4cd8c2;}})});}_0x4088b3=_[_0x87d6('0x3c')]({},_0x4088b3,_0x20709b[_0x87d6('0x3e')]);var _0x34308f={'where':_0x4088b3[_0x87d6('0x3a')]};return db['FreshsalesConfiguration'][_0x87d6('0x1e')](_0x34308f)[_0x87d6('0x25')](function(_0x2c3405){_0xa82d2d[_0x87d6('0x1e')]=_0x2c3405;if(_0x20709b[_0x87d6('0x30')][_0x87d6('0x3f')]){_0x4088b3['include']=[{'all':!![]}];}return db[_0x87d6('0x29')][_0x87d6('0x40')](_0x4088b3);})[_0x87d6('0x25')](function(_0x164ac1){_0xa82d2d[_0x87d6('0x41')]=_0x164ac1;return _0xa82d2d;})[_0x87d6('0x25')](respondWithFilteredResult(_0x18a869,_0x4088b3))['catch'](handleError(_0x18a869,null));};exports[_0x87d6('0x42')]=function(_0x597456,_0x1fc46b){var _0x4c168a={'raw':![],'where':{'id':_0x597456[_0x87d6('0x43')]['id']}},_0x372481={};_0x372481[_0x87d6('0x2d')]=_['keys'](db[_0x87d6('0x29')][_0x87d6('0x44')]);_0x372481[_0x87d6('0x30')]=_['keys'](_0x597456['query']);_0x372481[_0x87d6('0x31')]=_[_0x87d6('0x32')](_0x372481['model'],_0x372481[_0x87d6('0x30')]);_0x4c168a[_0x87d6('0x33')]=_['intersection'](_0x372481[_0x87d6('0x2d')],qs[_0x87d6('0x34')](_0x597456['query'][_0x87d6('0x34')]));_0x4c168a['attributes']=_0x4c168a[_0x87d6('0x33')][_0x87d6('0x35')]?_0x4c168a[_0x87d6('0x33')]:_0x372481[_0x87d6('0x2d')];if(_0x597456[_0x87d6('0x30')]['includeAll']){_0x4c168a[_0x87d6('0x45')]=[{'all':!![]}];}_0x4c168a=_[_0x87d6('0x3c')]({},_0x4c168a,_0x597456[_0x87d6('0x3e')]);return db[_0x87d6('0x29')][_0x87d6('0x46')](_0x4c168a)[_0x87d6('0x25')](handleEntityNotFound(_0x1fc46b,null))[_0x87d6('0x25')](respondWithResult(_0x1fc46b,null))[_0x87d6('0x47')](handleError(_0x1fc46b,null));};exports[_0x87d6('0x48')]=function(_0x1bf5c4,_0x14776d){return db[_0x87d6('0x29')][_0x87d6('0x48')](_0x1bf5c4[_0x87d6('0x49')],{})[_0x87d6('0x25')](respondWithResult(_0x14776d,0xc9))[_0x87d6('0x47')](handleError(_0x14776d,null));};exports[_0x87d6('0x24')]=function(_0x5f488d,_0x4c41b4){if(_0x5f488d['body']['id']){delete _0x5f488d[_0x87d6('0x49')]['id'];}return db[_0x87d6('0x29')][_0x87d6('0x46')]({'where':{'id':_0x5f488d[_0x87d6('0x43')]['id']}})[_0x87d6('0x25')](handleEntityNotFound(_0x4c41b4,null))[_0x87d6('0x25')](saveUpdates(_0x5f488d[_0x87d6('0x49')],null))[_0x87d6('0x25')](respondWithResult(_0x4c41b4,null))[_0x87d6('0x47')](handleError(_0x4c41b4,null));};exports[_0x87d6('0x26')]=function(_0x360f35,_0x323058){return db['FreshsalesConfiguration'][_0x87d6('0x46')]({'where':{'id':_0x360f35[_0x87d6('0x43')]['id']}})[_0x87d6('0x25')](handleEntityNotFound(_0x323058,null))[_0x87d6('0x25')](removeEntity(_0x323058,null))[_0x87d6('0x47')](handleError(_0x323058,null));};exports[_0x87d6('0x4a')]=function(_0x318837,_0xf61ab3,_0x4d1153){var _0xa1a2fb={};var _0x591306={};var _0x17d01f;var _0x29e6e4;return db['FreshsalesConfiguration'][_0x87d6('0x4b')]({'where':{'id':_0x318837[_0x87d6('0x43')]['id']}})[_0x87d6('0x25')](handleEntityNotFound(_0xf61ab3,null))[_0x87d6('0x25')](function(_0x7fd34e){if(_0x7fd34e){_0x17d01f=_0x7fd34e;_0x591306[_0x87d6('0x2d')]=_[_0x87d6('0x4c')](db[_0x87d6('0x4d')][_0x87d6('0x44')]);_0x591306[_0x87d6('0x30')]=_[_0x87d6('0x4c')](_0x318837[_0x87d6('0x30')]);_0x591306[_0x87d6('0x31')]=_[_0x87d6('0x32')](_0x591306[_0x87d6('0x2d')],_0x591306[_0x87d6('0x30')]);_0xa1a2fb[_0x87d6('0x33')]=_[_0x87d6('0x32')](_0x591306['model'],qs[_0x87d6('0x34')](_0x318837[_0x87d6('0x30')][_0x87d6('0x34')]));_0xa1a2fb[_0x87d6('0x33')]=_0xa1a2fb[_0x87d6('0x33')]['length']?_0xa1a2fb[_0x87d6('0x33')]:_0x591306[_0x87d6('0x2d')];_0xa1a2fb[_0x87d6('0x38')]=qs[_0x87d6('0x39')](_0x318837[_0x87d6('0x30')][_0x87d6('0x39')]);_0xa1a2fb[_0x87d6('0x3a')]=qs['filters'](_[_0x87d6('0x4e')](_0x318837[_0x87d6('0x30')],_0x591306[_0x87d6('0x31')]));if(_0x318837['query'][_0x87d6('0x3b')]){_0xa1a2fb[_0x87d6('0x3a')]=_[_0x87d6('0x3c')](_0xa1a2fb[_0x87d6('0x3a')],{'$or':_['map'](_0xa1a2fb[_0x87d6('0x33')],function(_0x33b909){var _0x5825fb={};_0x5825fb[_0x33b909]={'$like':'%'+_0x318837['query']['filter']+'%'};return _0x5825fb;})});}_0xa1a2fb=_['merge']({},_0xa1a2fb,_0x318837[_0x87d6('0x3e')]);return _0x17d01f[_0x87d6('0x4a')](_0xa1a2fb);}})[_0x87d6('0x25')](function(_0x103243){if(_0x103243){_0x29e6e4=_0x103243['length'];if(!_0x318837['query'][_0x87d6('0x36')](_0x87d6('0x37'))){_0xa1a2fb[_0x87d6('0x1b')]=qs[_0x87d6('0x1b')](_0x318837[_0x87d6('0x30')]['limit']);_0xa1a2fb['offset']=qs['offset'](_0x318837[_0x87d6('0x30')][_0x87d6('0x1d')]);}return _0x17d01f[_0x87d6('0x4a')](_0xa1a2fb);}})[_0x87d6('0x25')](function(_0x2cf74c){if(_0x2cf74c){return _0x2cf74c?{'count':_0x29e6e4,'rows':_0x2cf74c}:null;}})[_0x87d6('0x25')](respondWithResult(_0xf61ab3,null))[_0x87d6('0x47')](handleError(_0xf61ab3,null));};exports[_0x87d6('0x4f')]=function(_0x14263d,_0xd865df,_0x36666f){var _0x4c8808={};var _0x4ddcb0={};var _0x399eed;var _0x310e38;return db[_0x87d6('0x29')][_0x87d6('0x4b')]({'where':{'id':_0x14263d['params']['id']}})[_0x87d6('0x25')](handleEntityNotFound(_0xd865df,null))['then'](function(_0x19e940){if(_0x19e940){_0x399eed=_0x19e940;_0x4ddcb0['model']=_['keys'](db[_0x87d6('0x4d')][_0x87d6('0x44')]);_0x4ddcb0[_0x87d6('0x30')]=_[_0x87d6('0x4c')](_0x14263d[_0x87d6('0x30')]);_0x4ddcb0['filters']=_[_0x87d6('0x32')](_0x4ddcb0[_0x87d6('0x2d')],_0x4ddcb0[_0x87d6('0x30')]);_0x4c8808[_0x87d6('0x33')]=_['intersection'](_0x4ddcb0['model'],qs[_0x87d6('0x34')](_0x14263d[_0x87d6('0x30')]['fields']));_0x4c8808['attributes']=_0x4c8808[_0x87d6('0x33')][_0x87d6('0x35')]?_0x4c8808[_0x87d6('0x33')]:_0x4ddcb0[_0x87d6('0x2d')];_0x4c8808[_0x87d6('0x38')]=qs[_0x87d6('0x39')](_0x14263d['query'][_0x87d6('0x39')]);_0x4c8808[_0x87d6('0x3a')]=qs[_0x87d6('0x31')](_['pick'](_0x14263d[_0x87d6('0x30')],_0x4ddcb0[_0x87d6('0x31')]));if(_0x14263d[_0x87d6('0x30')]['filter']){_0x4c8808['where']=_['merge'](_0x4c8808['where'],{'$or':_[_0x87d6('0x2e')](_0x4c8808[_0x87d6('0x33')],function(_0x5d6ac7){var _0x1b8028={};_0x1b8028[_0x5d6ac7]={'$like':'%'+_0x14263d[_0x87d6('0x30')]['filter']+'%'};return _0x1b8028;})});}_0x4c8808=_[_0x87d6('0x3c')]({},_0x4c8808,_0x14263d[_0x87d6('0x3e')]);return _0x399eed[_0x87d6('0x4f')](_0x4c8808);}})[_0x87d6('0x25')](function(_0xdd453d){if(_0xdd453d){_0x310e38=_0xdd453d[_0x87d6('0x35')];if(!_0x14263d[_0x87d6('0x30')][_0x87d6('0x36')](_0x87d6('0x37'))){_0x4c8808[_0x87d6('0x1b')]=qs[_0x87d6('0x1b')](_0x14263d[_0x87d6('0x30')]['limit']);_0x4c8808[_0x87d6('0x1d')]=qs[_0x87d6('0x1d')](_0x14263d['query']['offset']);}return _0x399eed[_0x87d6('0x4f')](_0x4c8808);}})['then'](function(_0x30af1b){if(_0x30af1b){return _0x30af1b?{'count':_0x310e38,'rows':_0x30af1b}:null;}})[_0x87d6('0x25')](respondWithResult(_0xd865df,null))[_0x87d6('0x47')](handleError(_0xd865df,null));};exports[_0x87d6('0x50')]=function(_0x1a6a87,_0x4f7ef2,_0xf79b3b){var _0x3ba204={};var _0x3fd087={};var _0x7eb105;var _0x1a8f42;return db[_0x87d6('0x29')]['findOne']({'where':{'id':_0x1a6a87['params']['id']}})[_0x87d6('0x25')](handleEntityNotFound(_0x4f7ef2,null))[_0x87d6('0x25')](function(_0x504c79){if(_0x504c79){_0x7eb105=_0x504c79;_0x3fd087[_0x87d6('0x2d')]=_['keys'](db[_0x87d6('0x4d')]['rawAttributes']);_0x3fd087[_0x87d6('0x30')]=_[_0x87d6('0x4c')](_0x1a6a87[_0x87d6('0x30')]);_0x3fd087['filters']=_[_0x87d6('0x32')](_0x3fd087[_0x87d6('0x2d')],_0x3fd087['query']);_0x3ba204[_0x87d6('0x33')]=_[_0x87d6('0x32')](_0x3fd087[_0x87d6('0x2d')],qs['fields'](_0x1a6a87['query']['fields']));_0x3ba204[_0x87d6('0x33')]=_0x3ba204[_0x87d6('0x33')][_0x87d6('0x35')]?_0x3ba204['attributes']:_0x3fd087[_0x87d6('0x2d')];_0x3ba204[_0x87d6('0x38')]=qs['sort'](_0x1a6a87['query']['sort']);_0x3ba204[_0x87d6('0x3a')]=qs[_0x87d6('0x31')](_['pick'](_0x1a6a87['query'],_0x3fd087[_0x87d6('0x31')]));if(_0x1a6a87[_0x87d6('0x30')]['filter']){_0x3ba204[_0x87d6('0x3a')]=_[_0x87d6('0x3c')](_0x3ba204['where'],{'$or':_['map'](_0x3ba204['attributes'],function(_0x50bf2f){var _0x39ddb9={};_0x39ddb9[_0x50bf2f]={'$like':'%'+_0x1a6a87['query'][_0x87d6('0x3b')]+'%'};return _0x39ddb9;})});}_0x3ba204=_[_0x87d6('0x3c')]({},_0x3ba204,_0x1a6a87[_0x87d6('0x3e')]);return _0x7eb105[_0x87d6('0x50')](_0x3ba204);}})[_0x87d6('0x25')](function(_0x127699){if(_0x127699){_0x1a8f42=_0x127699[_0x87d6('0x35')];if(!_0x1a6a87[_0x87d6('0x30')]['hasOwnProperty'](_0x87d6('0x37'))){_0x3ba204[_0x87d6('0x1b')]=qs['limit'](_0x1a6a87[_0x87d6('0x30')][_0x87d6('0x1b')]);_0x3ba204[_0x87d6('0x1d')]=qs[_0x87d6('0x1d')](_0x1a6a87['query'][_0x87d6('0x1d')]);}return _0x7eb105[_0x87d6('0x50')](_0x3ba204);}})[_0x87d6('0x25')](function(_0x44b7f8){if(_0x44b7f8){return _0x44b7f8?{'count':_0x1a8f42,'rows':_0x44b7f8}:null;}})[_0x87d6('0x25')](respondWithResult(_0x4f7ef2,null))[_0x87d6('0x47')](handleError(_0x4f7ef2,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 421a644..97d11a6 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 _0x8cfa=['api','moment','bluebird','path','rimraf','../../config/environment','exports','define','int_freshsales_configurations','lodash','util'];(function(_0xb7b16e,_0x578998){var _0x438e81=function(_0x1548f4){while(--_0x1548f4){_0xb7b16e['push'](_0xb7b16e['shift']());}};_0x438e81(++_0x578998);}(_0x8cfa,0x8d));var _0xa8cf=function(_0x21fc96,_0x2df0fe){_0x21fc96=_0x21fc96-0x0;var _0x2e00b0=_0x8cfa[_0x21fc96];return _0x2e00b0;};'use strict';var _=require(_0xa8cf('0x0'));var util=require(_0xa8cf('0x1'));var logger=require('../../config/logger')(_0xa8cf('0x2'));var moment=require(_0xa8cf('0x3'));var BPromise=require(_0xa8cf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa8cf('0x5'));var rimraf=require(_0xa8cf('0x6'));var config=require(_0xa8cf('0x7'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0xa8cf('0x8')]=function(_0x1cd8b0,_0x50761e){return _0x1cd8b0[_0xa8cf('0x9')]('FreshsalesConfiguration',attributes,{'tableName':_0xa8cf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb579=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash'];(function(_0x287cac,_0x3fa61){var _0x4a5d11=function(_0x530890){while(--_0x530890){_0x287cac['push'](_0x287cac['shift']());}};_0x4a5d11(++_0x3fa61);}(_0xb579,0xb3));var _0x9b57=function(_0x125dbe,_0x1ddb5f){_0x125dbe=_0x125dbe-0x0;var _0x34654b=_0xb579[_0x125dbe];return _0x34654b;};'use strict';var _=require(_0x9b57('0x0'));var util=require(_0x9b57('0x1'));var logger=require(_0x9b57('0x2'))('api');var moment=require(_0x9b57('0x3'));var BPromise=require(_0x9b57('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b57('0x5'));var rimraf=require(_0x9b57('0x6'));var config=require(_0x9b57('0x7'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x9b57('0x8')]=function(_0x10719f,_0x1e1cad){return _0x10719f[_0x9b57('0x9')](_0x9b57('0xa'),attributes,{'tableName':_0x9b57('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 b05bd9c..7ce5df3 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 _0x3c7e=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util'];(function(_0x107d61,_0x1765a4){var _0x3c9ec2=function(_0x546dd5){while(--_0x546dd5){_0x107d61['push'](_0x107d61['shift']());}};_0x3c9ec2(++_0x1765a4);}(_0x3c7e,0x185));var _0xe3c7=function(_0x19688b,_0x5cae76){_0x19688b=_0x19688b-0x0;var _0x196944=_0x3c7e[_0x19688b];return _0x196944;};'use strict';var _=require(_0xe3c7('0x0'));var util=require(_0xe3c7('0x1'));var moment=require(_0xe3c7('0x2'));var BPromise=require(_0xe3c7('0x3'));var rs=require(_0xe3c7('0x4'));var fs=require('fs');var Redis=require(_0xe3c7('0x5'));var db=require(_0xe3c7('0x6'))['db'];var utils=require(_0xe3c7('0x7'));var logger=require(_0xe3c7('0x8'))(_0xe3c7('0x9'));var config=require(_0xe3c7('0xa'));var jayson=require(_0xe3c7('0xb'));var client=jayson['client'][_0xe3c7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x23e474,_0x16c3ed,_0x5364fc){return new BPromise(function(_0x5394f3,_0x418ebf){return client[_0xe3c7('0xd')](_0x23e474,_0x5364fc)[_0xe3c7('0xe')](function(_0x3d7fa8){logger['info'](_0xe3c7('0xf'),_0x16c3ed,_0xe3c7('0x10'));logger[_0xe3c7('0x11')](_0xe3c7('0x12'),_0x16c3ed,_0xe3c7('0x10'),JSON[_0xe3c7('0x13')](_0x3d7fa8));if(_0x3d7fa8[_0xe3c7('0x14')]){if(_0x3d7fa8[_0xe3c7('0x14')][_0xe3c7('0x15')]===0x1f4){logger[_0xe3c7('0x14')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x16c3ed,_0x3d7fa8[_0xe3c7('0x14')][_0xe3c7('0x16')]);return _0x418ebf(_0x3d7fa8[_0xe3c7('0x14')][_0xe3c7('0x16')]);}logger[_0xe3c7('0x14')](_0xe3c7('0xf'),_0x16c3ed,_0x3d7fa8[_0xe3c7('0x14')][_0xe3c7('0x16')]);return _0x5394f3(_0x3d7fa8[_0xe3c7('0x14')][_0xe3c7('0x16')]);}else{logger['info'](_0xe3c7('0xf'),_0x16c3ed,_0xe3c7('0x10'));_0x5394f3(_0x3d7fa8['result'][_0xe3c7('0x16')]);}})['catch'](function(_0x224e8d){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x16c3ed,_0x224e8d);_0x418ebf(_0x224e8d);});});} \ No newline at end of file +var _0x66db=['code','message','FreshsalesConfiguration,\x20%s,\x20%s','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x66db,0x77));var _0xb66d=function(_0x2ffcd0,_0x380b1e){_0x2ffcd0=_0x2ffcd0-0x0;var _0x2922a7=_0x66db[_0x2ffcd0];return _0x2922a7;};'use strict';var _=require(_0xb66d('0x0'));var util=require(_0xb66d('0x1'));var moment=require(_0xb66d('0x2'));var BPromise=require(_0xb66d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb66d('0x4'));var db=require(_0xb66d('0x5'))['db'];var utils=require(_0xb66d('0x6'));var logger=require(_0xb66d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb66d('0x8'));var client=jayson[_0xb66d('0x9')][_0xb66d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a7064,_0x3e1b63,_0x32bd83){return new BPromise(function(_0x1f3f65,_0x1a28db){return client[_0xb66d('0xb')](_0x1a7064,_0x32bd83)[_0xb66d('0xc')](function(_0x101061){logger[_0xb66d('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3e1b63,_0xb66d('0xe'));logger[_0xb66d('0xf')](_0xb66d('0x10'),_0x3e1b63,_0xb66d('0xe'),JSON[_0xb66d('0x11')](_0x101061));if(_0x101061[_0xb66d('0x12')]){if(_0x101061[_0xb66d('0x12')][_0xb66d('0x13')]===0x1f4){logger[_0xb66d('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3e1b63,_0x101061[_0xb66d('0x12')][_0xb66d('0x14')]);return _0x1a28db(_0x101061[_0xb66d('0x12')][_0xb66d('0x14')]);}logger[_0xb66d('0x12')](_0xb66d('0x15'),_0x3e1b63,_0x101061[_0xb66d('0x12')][_0xb66d('0x14')]);return _0x1f3f65(_0x101061['error'][_0xb66d('0x14')]);}else{logger[_0xb66d('0xd')](_0xb66d('0x15'),_0x3e1b63,_0xb66d('0xe'));_0x1f3f65(_0x101061[_0xb66d('0x16')][_0xb66d('0x14')]);}})['catch'](function(_0x4868f0){logger[_0xb66d('0x12')](_0xb66d('0x15'),_0x3e1b63,_0x4868f0);_0x1a28db(_0x4868f0);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index c9a828b..cc62543 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 _0x3cd1=['/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','get','isAuthenticated'];(function(_0x273bb2,_0x319264){var _0x22f932=function(_0x2124ba){while(--_0x2124ba){_0x273bb2['push'](_0x273bb2['shift']());}};_0x22f932(++_0x319264);}(_0x3cd1,0x112));var _0x13cd=function(_0x38c96f,_0x1642f9){_0x38c96f=_0x38c96f-0x0;var _0x5a7c09=_0x3cd1[_0x38c96f];return _0x5a7c09;};'use strict';var multer=require('multer');var util=require(_0x13cd('0x0'));var path=require(_0x13cd('0x1'));var timeout=require(_0x13cd('0x2'));var express=require(_0x13cd('0x3'));var router=express[_0x13cd('0x4')]();var fs_extra=require(_0x13cd('0x5'));var auth=require(_0x13cd('0x6'));var interaction=require(_0x13cd('0x7'));var config=require('../../config/environment');var controller=require(_0x13cd('0x8'));router[_0x13cd('0x9')]('/',auth[_0x13cd('0xa')](),controller['index']);router['get'](_0x13cd('0xb'),auth[_0x13cd('0xa')](),controller[_0x13cd('0xc')]);router[_0x13cd('0xd')]('/',auth['isAuthenticated'](),controller[_0x13cd('0xe')]);router[_0x13cd('0xf')](_0x13cd('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x13cd('0x10')](_0x13cd('0xb'),auth[_0x13cd('0xa')](),controller[_0x13cd('0x11')]);module[_0x13cd('0x12')]=router; \ No newline at end of file +var _0xfc65=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','post','create','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfc65,0x1b4));var _0x5fc6=function(_0x1b1ddb,_0x5d45c4){_0x1b1ddb=_0x1b1ddb-0x0;var _0x495715=_0xfc65[_0x1b1ddb];return _0x495715;};'use strict';var multer=require(_0x5fc6('0x0'));var util=require(_0x5fc6('0x1'));var path=require(_0x5fc6('0x2'));var timeout=require(_0x5fc6('0x3'));var express=require(_0x5fc6('0x4'));var router=express[_0x5fc6('0x5')]();var fs_extra=require(_0x5fc6('0x6'));var auth=require(_0x5fc6('0x7'));var interaction=require(_0x5fc6('0x8'));var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router[_0x5fc6('0x9')]('/',auth[_0x5fc6('0xa')](),controller[_0x5fc6('0xb')]);router[_0x5fc6('0x9')](_0x5fc6('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x5fc6('0xd')]('/',auth[_0x5fc6('0xa')](),controller[_0x5fc6('0xe')]);router['put'](_0x5fc6('0xc'),auth[_0x5fc6('0xa')](),controller['update']);router[_0x5fc6('0xf')](_0x5fc6('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x5fc6('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index b6e22ad..9c8de0a 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 _0xa301=['string','variable','customVariable','keyValue','picklist','STRING','ENUM','exports'];(function(_0xf44e42,_0x3c5abc){var _0x1681b3=function(_0x5008d0){while(--_0x5008d0){_0xf44e42['push'](_0xf44e42['shift']());}};_0x1681b3(++_0x3c5abc);}(_0xa301,0x17f));var _0x1a30=function(_0x530ffb,_0x1c019e){_0x530ffb=_0x530ffb-0x0;var _0x683289=_0xa301[_0x530ffb];return _0x683289;};'use strict';var Sequelize=require('sequelize');module[_0x1a30('0x0')]={'type':{'type':Sequelize['ENUM'](_0x1a30('0x1'),_0x1a30('0x2'),_0x1a30('0x3'),_0x1a30('0x4'),_0x1a30('0x5')),'defaultValue':_0x1a30('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1a30('0x6')]},'keyType':{'type':Sequelize[_0x1a30('0x7')](_0x1a30('0x1'),_0x1a30('0x2'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1a30('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1a30('0x6')]}}; \ No newline at end of file +var _0x2cd9=['BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','STRING'];(function(_0x14199d,_0x483cd2){var _0x3a1dec=function(_0x524524){while(--_0x524524){_0x14199d['push'](_0x14199d['shift']());}};_0x3a1dec(++_0x483cd2);}(_0x2cd9,0xf9));var _0x92cd=function(_0x88319a,_0x5243e2){_0x88319a=_0x88319a-0x0;var _0xf22317=_0x2cd9[_0x88319a];return _0xf22317;};'use strict';var Sequelize=require(_0x92cd('0x0'));module[_0x92cd('0x1')]={'type':{'type':Sequelize[_0x92cd('0x2')](_0x92cd('0x3'),_0x92cd('0x4'),'customVariable',_0x92cd('0x5'),'picklist'),'defaultValue':_0x92cd('0x3')},'content':{'type':Sequelize[_0x92cd('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x92cd('0x3'),_0x92cd('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x92cd('0x6')]},'idField':{'type':Sequelize[_0x92cd('0x6')]},'nameField':{'type':Sequelize[_0x92cd('0x6')]},'customField':{'type':Sequelize[_0x92cd('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x92cd('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 7f33529..8c161f0 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 _0x0519=['create','body','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','error','name','send','map','FreshsalesField','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find'];(function(_0x2755fb,_0x5970f1){var _0x293f12=function(_0x4c629d){while(--_0x4c629d){_0x2755fb['push'](_0x2755fb['shift']());}};_0x293f12(++_0x5970f1);}(_0x0519,0x156));var _0x9051=function(_0x202d24,_0x5e8641){_0x202d24=_0x202d24-0x0;var _0x2b3a8e=_0x0519[_0x202d24];return _0x2b3a8e;};'use strict';var emlformat=require(_0x9051('0x0'));var rimraf=require(_0x9051('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9051('0x2'));var moment=require(_0x9051('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9051('0x4'));var util=require(_0x9051('0x5'));var path=require(_0x9051('0x6'));var sox=require(_0x9051('0x7'));var csv=require(_0x9051('0x8'));var ejs=require(_0x9051('0x9'));var fs=require('fs');var fs_extra=require(_0x9051('0xa'));var _=require(_0x9051('0xb'));var squel=require(_0x9051('0xc'));var crypto=require(_0x9051('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9051('0x8'));var querystring=require(_0x9051('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9051('0xf'));var qs=require(_0x9051('0x10'));var as=require(_0x9051('0x11'));var hardwareService=require(_0x9051('0x12'));var logger=require(_0x9051('0x13'))('api');var utils=require(_0x9051('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x432a0d,_0x4b61dc){_0x4b61dc=_0x4b61dc||0xcc;return function(_0x263a02){if(_0x263a02){return _0x432a0d[_0x9051('0x15')](_0x4b61dc);}return _0x432a0d[_0x9051('0x16')](_0x4b61dc)[_0x9051('0x17')]();};}function respondWithResult(_0x2c620c,_0x1c7c1d){_0x1c7c1d=_0x1c7c1d||0xc8;return function(_0x499e98){if(_0x499e98){return _0x2c620c['status'](_0x1c7c1d)['json'](_0x499e98);}};}function respondWithFilteredResult(_0x2a737b,_0x4bb9df){return function(_0x339309){if(_0x339309){var _0x3a5be0=typeof _0x4bb9df[_0x9051('0x18')]===_0x9051('0x19')&&typeof _0x4bb9df[_0x9051('0x1a')]===_0x9051('0x19');var _0x3fed36=_0x339309[_0x9051('0x1b')];var _0x5859ba=_0x3a5be0?0x0:_0x4bb9df[_0x9051('0x18')];var _0x599540=_0x3a5be0?_0x339309[_0x9051('0x1b')]:_0x4bb9df[_0x9051('0x18')]+_0x4bb9df[_0x9051('0x1a')];var _0x1b7940;if(_0x599540>=_0x3fed36){_0x599540=_0x3fed36;_0x1b7940=0xc8;}else{_0x1b7940=0xce;}_0x2a737b[_0x9051('0x16')](_0x1b7940);return _0x2a737b[_0x9051('0x1c')]('Content-Range',_0x5859ba+'-'+_0x599540+'/'+_0x3fed36)[_0x9051('0x1d')](_0x339309);}return null;};}function patchUpdates(_0x1a4ce8){return function(_0xa7db0c){try{jsonpatch['apply'](_0xa7db0c,_0x1a4ce8,!![]);}catch(_0x16fbc4){return BPromise[_0x9051('0x1e')](_0x16fbc4);}return _0xa7db0c[_0x9051('0x1f')]();};}function saveUpdates(_0xa40d8,_0x20233b){return function(_0x17e0cd){if(_0x17e0cd){return _0x17e0cd[_0x9051('0x20')](_0xa40d8)[_0x9051('0x21')](function(_0x2efbbd){return _0x2efbbd;});}return null;};}function removeEntity(_0x1efa78,_0x377d5b){return function(_0x96a6f8){if(_0x96a6f8){return _0x96a6f8[_0x9051('0x22')]()[_0x9051('0x21')](function(){_0x1efa78['status'](0xcc)[_0x9051('0x17')]();});}};}function handleEntityNotFound(_0x141d4f,_0x254197){return function(_0x1e5005){if(!_0x1e5005){_0x141d4f[_0x9051('0x15')](0x194);}return _0x1e5005;};}function handleError(_0x4bbc4f,_0x348280){_0x348280=_0x348280||0x1f4;return function(_0x8ca036){logger[_0x9051('0x23')](_0x8ca036['stack']);if(_0x8ca036[_0x9051('0x24')]){delete _0x8ca036[_0x9051('0x24')];}_0x4bbc4f[_0x9051('0x16')](_0x348280)[_0x9051('0x25')](_0x8ca036);};}exports['index']=function(_0x155410,_0x31694f){var _0xce6bb5={},_0x52960a={},_0x444935={'count':0x0,'rows':[]};var _0x5d9ead=_[_0x9051('0x26')](db[_0x9051('0x27')][_0x9051('0x28')],function(_0x5694cb){return{'name':_0x5694cb[_0x9051('0x29')],'type':_0x5694cb['type']['key']};});_0x52960a[_0x9051('0x2a')]=_[_0x9051('0x26')](_0x5d9ead,_0x9051('0x24'));_0x52960a[_0x9051('0x2b')]=_[_0x9051('0x2c')](_0x155410[_0x9051('0x2b')]);_0x52960a[_0x9051('0x2d')]=_[_0x9051('0x2e')](_0x52960a[_0x9051('0x2a')],_0x52960a['query']);_0xce6bb5['attributes']=_[_0x9051('0x2e')](_0x52960a[_0x9051('0x2a')],qs[_0x9051('0x2f')](_0x155410[_0x9051('0x2b')][_0x9051('0x2f')]));_0xce6bb5[_0x9051('0x30')]=_0xce6bb5[_0x9051('0x30')][_0x9051('0x31')]?_0xce6bb5[_0x9051('0x30')]:_0x52960a['model'];if(!_0x155410['query']['hasOwnProperty'](_0x9051('0x32'))){_0xce6bb5[_0x9051('0x1a')]=qs['limit'](_0x155410['query'][_0x9051('0x1a')]);_0xce6bb5['offset']=qs[_0x9051('0x18')](_0x155410[_0x9051('0x2b')][_0x9051('0x18')]);}_0xce6bb5[_0x9051('0x33')]=qs['sort'](_0x155410[_0x9051('0x2b')]['sort']);_0xce6bb5['where']=qs[_0x9051('0x2d')](_[_0x9051('0x34')](_0x155410[_0x9051('0x2b')],_0x52960a[_0x9051('0x2d')]),_0x5d9ead);if(_0x155410[_0x9051('0x2b')][_0x9051('0x35')]){_0xce6bb5[_0x9051('0x36')]=_[_0x9051('0x37')](_0xce6bb5[_0x9051('0x36')],{'$or':_[_0x9051('0x26')](_0x5d9ead,function(_0x2b423b){if(_0x2b423b['type']!==_0x9051('0x38')){var _0x6b338={};_0x6b338[_0x2b423b[_0x9051('0x24')]]={'$like':'%'+_0x155410['query'][_0x9051('0x35')]+'%'};return _0x6b338;}})});}_0xce6bb5=_[_0x9051('0x37')]({},_0xce6bb5,_0x155410[_0x9051('0x39')]);var _0x217397={'where':_0xce6bb5[_0x9051('0x36')]};return db[_0x9051('0x27')][_0x9051('0x1b')](_0x217397)[_0x9051('0x21')](function(_0x53b5c8){_0x444935[_0x9051('0x1b')]=_0x53b5c8;if(_0x155410[_0x9051('0x2b')][_0x9051('0x3a')]){_0xce6bb5['include']=[{'all':!![]}];}return db['FreshsalesField'][_0x9051('0x3b')](_0xce6bb5);})['then'](function(_0x39281f){_0x444935[_0x9051('0x3c')]=_0x39281f;return _0x444935;})['then'](respondWithFilteredResult(_0x31694f,_0xce6bb5))[_0x9051('0x3d')](handleError(_0x31694f,null));};exports[_0x9051('0x3e')]=function(_0x20926b,_0x182160){var _0xa8579e={'raw':!![],'where':{'id':_0x20926b[_0x9051('0x3f')]['id']}},_0xc0f690={};_0xc0f690[_0x9051('0x2a')]=_[_0x9051('0x2c')](db[_0x9051('0x27')][_0x9051('0x28')]);_0xc0f690[_0x9051('0x2b')]=_[_0x9051('0x2c')](_0x20926b[_0x9051('0x2b')]);_0xc0f690[_0x9051('0x2d')]=_[_0x9051('0x2e')](_0xc0f690['model'],_0xc0f690['query']);_0xa8579e[_0x9051('0x30')]=_[_0x9051('0x2e')](_0xc0f690[_0x9051('0x2a')],qs[_0x9051('0x2f')](_0x20926b['query']['fields']));_0xa8579e[_0x9051('0x30')]=_0xa8579e[_0x9051('0x30')]['length']?_0xa8579e['attributes']:_0xc0f690['model'];if(_0x20926b[_0x9051('0x2b')]['includeAll']){_0xa8579e[_0x9051('0x40')]=[{'all':!![]}];}_0xa8579e=_[_0x9051('0x37')]({},_0xa8579e,_0x20926b[_0x9051('0x39')]);return db[_0x9051('0x27')][_0x9051('0x41')](_0xa8579e)[_0x9051('0x21')](handleEntityNotFound(_0x182160,null))[_0x9051('0x21')](respondWithResult(_0x182160,null))[_0x9051('0x3d')](handleError(_0x182160,null));};exports[_0x9051('0x42')]=function(_0x502026,_0x3f0432){return db[_0x9051('0x27')]['create'](_0x502026[_0x9051('0x43')],{})[_0x9051('0x21')](respondWithResult(_0x3f0432,0xc9))[_0x9051('0x3d')](handleError(_0x3f0432,null));};exports[_0x9051('0x20')]=function(_0x445697,_0x2e34bc){if(_0x445697[_0x9051('0x43')]['id']){delete _0x445697['body']['id'];}return db[_0x9051('0x27')][_0x9051('0x41')]({'where':{'id':_0x445697[_0x9051('0x3f')]['id']}})[_0x9051('0x21')](handleEntityNotFound(_0x2e34bc,null))['then'](saveUpdates(_0x445697[_0x9051('0x43')],null))['then'](respondWithResult(_0x2e34bc,null))[_0x9051('0x3d')](handleError(_0x2e34bc,null));};exports['destroy']=function(_0x39bc8e,_0x192ced){return db[_0x9051('0x27')][_0x9051('0x41')]({'where':{'id':_0x39bc8e[_0x9051('0x3f')]['id']}})[_0x9051('0x21')](handleEntityNotFound(_0x192ced,null))[_0x9051('0x21')](removeEntity(_0x192ced,null))[_0x9051('0x3d')](handleError(_0x192ced,null));}; \ No newline at end of file +var _0x9b30=['destroy','name','index','map','FreshsalesField','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then'];(function(_0xa201ee,_0x37da32){var _0x3e104d=function(_0x4cd637){while(--_0x4cd637){_0xa201ee['push'](_0xa201ee['shift']());}};_0x3e104d(++_0x37da32);}(_0x9b30,0x6d));var _0x09b3=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x9b30[_0xefd519];return _0x4bb882;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x09b3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x09b3('0x1'));var rp=require('request-promise');var moment=require(_0x09b3('0x2'));var BPromise=require(_0x09b3('0x3'));var Mustache=require(_0x09b3('0x4'));var util=require(_0x09b3('0x5'));var path=require('path');var sox=require(_0x09b3('0x6'));var csv=require(_0x09b3('0x7'));var ejs=require(_0x09b3('0x8'));var fs=require('fs');var fs_extra=require(_0x09b3('0x9'));var _=require(_0x09b3('0xa'));var squel=require(_0x09b3('0xb'));var crypto=require(_0x09b3('0xc'));var jsforce=require(_0x09b3('0xd'));var deskjs=require(_0x09b3('0xe'));var toCsv=require(_0x09b3('0x7'));var querystring=require(_0x09b3('0xf'));var Papa=require(_0x09b3('0x10'));var Redis=require(_0x09b3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x09b3('0x12'));var as=require(_0x09b3('0x13'));var hardwareService=require(_0x09b3('0x14'));var logger=require(_0x09b3('0x15'))(_0x09b3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x09b3('0x17'));var db=require(_0x09b3('0x18'))['db'];function respondWithStatusCode(_0x2da605,_0x800f6c){_0x800f6c=_0x800f6c||0xcc;return function(_0x5191c4){if(_0x5191c4){return _0x2da605[_0x09b3('0x19')](_0x800f6c);}return _0x2da605[_0x09b3('0x1a')](_0x800f6c)[_0x09b3('0x1b')]();};}function respondWithResult(_0x35719f,_0x10a7ba){_0x10a7ba=_0x10a7ba||0xc8;return function(_0x425a56){if(_0x425a56){return _0x35719f[_0x09b3('0x1a')](_0x10a7ba)[_0x09b3('0x1c')](_0x425a56);}};}function respondWithFilteredResult(_0x4af1d2,_0x90bcaf){return function(_0x26b223){if(_0x26b223){var _0x127a22=typeof _0x90bcaf['offset']===_0x09b3('0x1d')&&typeof _0x90bcaf['limit']===_0x09b3('0x1d');var _0x12d6c3=_0x26b223[_0x09b3('0x1e')];var _0x1aa5de=_0x127a22?0x0:_0x90bcaf[_0x09b3('0x1f')];var _0x1827fe=_0x127a22?_0x26b223['count']:_0x90bcaf['offset']+_0x90bcaf[_0x09b3('0x20')];var _0x4c8171;if(_0x1827fe>=_0x12d6c3){_0x1827fe=_0x12d6c3;_0x4c8171=0xc8;}else{_0x4c8171=0xce;}_0x4af1d2[_0x09b3('0x1a')](_0x4c8171);return _0x4af1d2[_0x09b3('0x21')](_0x09b3('0x22'),_0x1aa5de+'-'+_0x1827fe+'/'+_0x12d6c3)['json'](_0x26b223);}return null;};}function patchUpdates(_0x4f98d9){return function(_0x5d2c9a){try{jsonpatch[_0x09b3('0x23')](_0x5d2c9a,_0x4f98d9,!![]);}catch(_0x525914){return BPromise['reject'](_0x525914);}return _0x5d2c9a[_0x09b3('0x24')]();};}function saveUpdates(_0x4cbb41,_0x237bf4){return function(_0x41af6d){if(_0x41af6d){return _0x41af6d[_0x09b3('0x25')](_0x4cbb41)[_0x09b3('0x26')](function(_0x18fe70){return _0x18fe70;});}return null;};}function removeEntity(_0x47a196,_0x5067dc){return function(_0x35bac6){if(_0x35bac6){return _0x35bac6[_0x09b3('0x27')]()[_0x09b3('0x26')](function(){_0x47a196[_0x09b3('0x1a')](0xcc)[_0x09b3('0x1b')]();});}};}function handleEntityNotFound(_0x4c9f9c,_0x234162){return function(_0x32fb6d){if(!_0x32fb6d){_0x4c9f9c['sendStatus'](0x194);}return _0x32fb6d;};}function handleError(_0x140be3,_0x272396){_0x272396=_0x272396||0x1f4;return function(_0x448ecc){logger['error'](_0x448ecc['stack']);if(_0x448ecc[_0x09b3('0x28')]){delete _0x448ecc[_0x09b3('0x28')];}_0x140be3[_0x09b3('0x1a')](_0x272396)['send'](_0x448ecc);};}exports[_0x09b3('0x29')]=function(_0x1475c2,_0xe88139){var _0x5d8357={},_0x418c02={},_0x1ffa3d={'count':0x0,'rows':[]};var _0x234bce=_[_0x09b3('0x2a')](db[_0x09b3('0x2b')]['rawAttributes'],function(_0x4c9286){return{'name':_0x4c9286[_0x09b3('0x2c')],'type':_0x4c9286[_0x09b3('0x2d')][_0x09b3('0x2e')]};});_0x418c02['model']=_['map'](_0x234bce,_0x09b3('0x28'));_0x418c02[_0x09b3('0x2f')]=_['keys'](_0x1475c2['query']);_0x418c02['filters']=_[_0x09b3('0x30')](_0x418c02[_0x09b3('0x31')],_0x418c02[_0x09b3('0x2f')]);_0x5d8357[_0x09b3('0x32')]=_[_0x09b3('0x30')](_0x418c02[_0x09b3('0x31')],qs[_0x09b3('0x33')](_0x1475c2[_0x09b3('0x2f')]['fields']));_0x5d8357[_0x09b3('0x32')]=_0x5d8357[_0x09b3('0x32')][_0x09b3('0x34')]?_0x5d8357[_0x09b3('0x32')]:_0x418c02[_0x09b3('0x31')];if(!_0x1475c2[_0x09b3('0x2f')][_0x09b3('0x35')](_0x09b3('0x36'))){_0x5d8357[_0x09b3('0x20')]=qs[_0x09b3('0x20')](_0x1475c2[_0x09b3('0x2f')][_0x09b3('0x20')]);_0x5d8357['offset']=qs['offset'](_0x1475c2[_0x09b3('0x2f')][_0x09b3('0x1f')]);}_0x5d8357[_0x09b3('0x37')]=qs['sort'](_0x1475c2[_0x09b3('0x2f')][_0x09b3('0x38')]);_0x5d8357['where']=qs['filters'](_[_0x09b3('0x39')](_0x1475c2[_0x09b3('0x2f')],_0x418c02[_0x09b3('0x3a')]),_0x234bce);if(_0x1475c2[_0x09b3('0x2f')][_0x09b3('0x3b')]){_0x5d8357['where']=_['merge'](_0x5d8357[_0x09b3('0x3c')],{'$or':_[_0x09b3('0x2a')](_0x234bce,function(_0x22da0a){if(_0x22da0a[_0x09b3('0x2d')]!=='VIRTUAL'){var _0x4c7959={};_0x4c7959[_0x22da0a['name']]={'$like':'%'+_0x1475c2[_0x09b3('0x2f')]['filter']+'%'};return _0x4c7959;}})});}_0x5d8357=_[_0x09b3('0x3d')]({},_0x5d8357,_0x1475c2[_0x09b3('0x3e')]);var _0x44ded4={'where':_0x5d8357[_0x09b3('0x3c')]};return db[_0x09b3('0x2b')]['count'](_0x44ded4)[_0x09b3('0x26')](function(_0x42932f){_0x1ffa3d['count']=_0x42932f;if(_0x1475c2['query'][_0x09b3('0x3f')]){_0x5d8357[_0x09b3('0x40')]=[{'all':!![]}];}return db['FreshsalesField'][_0x09b3('0x41')](_0x5d8357);})['then'](function(_0xa8aeaf){_0x1ffa3d[_0x09b3('0x42')]=_0xa8aeaf;return _0x1ffa3d;})[_0x09b3('0x26')](respondWithFilteredResult(_0xe88139,_0x5d8357))[_0x09b3('0x43')](handleError(_0xe88139,null));};exports[_0x09b3('0x44')]=function(_0x2b55a0,_0x376692){var _0x4a05d5={'raw':!![],'where':{'id':_0x2b55a0[_0x09b3('0x45')]['id']}},_0x44090f={};_0x44090f['model']=_[_0x09b3('0x46')](db[_0x09b3('0x2b')]['rawAttributes']);_0x44090f[_0x09b3('0x2f')]=_[_0x09b3('0x46')](_0x2b55a0[_0x09b3('0x2f')]);_0x44090f['filters']=_[_0x09b3('0x30')](_0x44090f['model'],_0x44090f[_0x09b3('0x2f')]);_0x4a05d5[_0x09b3('0x32')]=_[_0x09b3('0x30')](_0x44090f[_0x09b3('0x31')],qs[_0x09b3('0x33')](_0x2b55a0[_0x09b3('0x2f')][_0x09b3('0x33')]));_0x4a05d5['attributes']=_0x4a05d5[_0x09b3('0x32')][_0x09b3('0x34')]?_0x4a05d5[_0x09b3('0x32')]:_0x44090f['model'];if(_0x2b55a0[_0x09b3('0x2f')][_0x09b3('0x3f')]){_0x4a05d5['include']=[{'all':!![]}];}_0x4a05d5=_[_0x09b3('0x3d')]({},_0x4a05d5,_0x2b55a0[_0x09b3('0x3e')]);return db[_0x09b3('0x2b')][_0x09b3('0x47')](_0x4a05d5)['then'](handleEntityNotFound(_0x376692,null))[_0x09b3('0x26')](respondWithResult(_0x376692,null))[_0x09b3('0x43')](handleError(_0x376692,null));};exports[_0x09b3('0x48')]=function(_0x57fc1c,_0x2b10bc){return db[_0x09b3('0x2b')][_0x09b3('0x48')](_0x57fc1c[_0x09b3('0x49')],{})['then'](respondWithResult(_0x2b10bc,0xc9))['catch'](handleError(_0x2b10bc,null));};exports[_0x09b3('0x25')]=function(_0x45f63a,_0x6f397c){if(_0x45f63a[_0x09b3('0x49')]['id']){delete _0x45f63a[_0x09b3('0x49')]['id'];}return db['FreshsalesField'][_0x09b3('0x47')]({'where':{'id':_0x45f63a['params']['id']}})[_0x09b3('0x26')](handleEntityNotFound(_0x6f397c,null))[_0x09b3('0x26')](saveUpdates(_0x45f63a[_0x09b3('0x49')],null))[_0x09b3('0x26')](respondWithResult(_0x6f397c,null))['catch'](handleError(_0x6f397c,null));};exports[_0x09b3('0x27')]=function(_0x9f885e,_0x53f308){return db[_0x09b3('0x2b')][_0x09b3('0x47')]({'where':{'id':_0x9f885e[_0x09b3('0x45')]['id']}})['then'](handleEntityNotFound(_0x53f308,null))[_0x09b3('0x26')](removeEntity(_0x53f308,null))[_0x09b3('0x43')](handleError(_0x53f308,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index d543db2..4878711 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 _0xba38=['../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x150269,_0x1c2292){var _0x494260=function(_0x30a798){while(--_0x30a798){_0x150269['push'](_0x150269['shift']());}};_0x494260(++_0x1c2292);}(_0xba38,0x190));var _0x8ba3=function(_0x31de7d,_0x34b11b){_0x31de7d=_0x31de7d-0x0;var _0x44637d=_0xba38[_0x31de7d];return _0x44637d;};'use strict';var _=require('lodash');var util=require(_0x8ba3('0x0'));var logger=require(_0x8ba3('0x1'))(_0x8ba3('0x2'));var moment=require('moment');var BPromise=require(_0x8ba3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ba3('0x4'));var rimraf=require(_0x8ba3('0x5'));var config=require(_0x8ba3('0x6'));var attributes=require(_0x8ba3('0x7'));module[_0x8ba3('0x8')]=function(_0x1d18b7,_0x3edeae){return _0x1d18b7[_0x8ba3('0x9')](_0x8ba3('0xa'),attributes,{'tableName':_0x8ba3('0xb'),'paranoid':![],'indexes':[{'name':_0x8ba3('0xc'),'fields':[_0x8ba3('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7334=['../../config/logger','bluebird','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util'];(function(_0x3bb968,_0xd3f6b0){var _0x49b09f=function(_0x1daefb){while(--_0x1daefb){_0x3bb968['push'](_0x3bb968['shift']());}};_0x49b09f(++_0xd3f6b0);}(_0x7334,0x184));var _0x4733=function(_0x1ab2cf,_0x529fe3){_0x1ab2cf=_0x1ab2cf-0x0;var _0x1604d6=_0x7334[_0x1ab2cf];return _0x1604d6;};'use strict';var _=require(_0x4733('0x0'));var util=require(_0x4733('0x1'));var logger=require(_0x4733('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4733('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4733('0x4'));var rimraf=require(_0x4733('0x5'));var config=require(_0x4733('0x6'));var attributes=require(_0x4733('0x7'));module[_0x4733('0x8')]=function(_0x449ead,_0x16d7cc){return _0x449ead[_0x4733('0x9')](_0x4733('0xa'),attributes,{'tableName':_0x4733('0xb'),'paranoid':![],'indexes':[{'name':_0x4733('0xc'),'fields':[_0x4733('0xd'),_0x4733('0xe')],'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 e26db6c..8037048 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.rpc.js +++ b/server/api/intFreshsalesField/intFreshsalesField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a07=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x12f93b,_0x3d8f52){var _0x1881a4=function(_0xd87cc){while(--_0xd87cc){_0x12f93b['push'](_0x12f93b['shift']());}};_0x1881a4(++_0x3d8f52);}(_0x2a07,0x74));var _0x72a0=function(_0xd8aad0,_0x4da2cd){_0xd8aad0=_0xd8aad0-0x0;var _0x570860=_0x2a07[_0xd8aad0];return _0x570860;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var moment=require(_0x72a0('0x2'));var BPromise=require(_0x72a0('0x3'));var rs=require(_0x72a0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72a0('0x5'))['db'];var utils=require(_0x72a0('0x6'));var logger=require(_0x72a0('0x7'))(_0x72a0('0x8'));var config=require(_0x72a0('0x9'));var jayson=require(_0x72a0('0xa'));var client=jayson[_0x72a0('0xb')][_0x72a0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x193e3b,_0x287b06,_0x21c819){return new BPromise(function(_0x2c04eb,_0x22270e){return client[_0x72a0('0xd')](_0x193e3b,_0x21c819)[_0x72a0('0xe')](function(_0x2bc45b){logger['info'](_0x72a0('0xf'),_0x287b06,_0x72a0('0x10'));logger['debug'](_0x72a0('0x11'),_0x287b06,_0x72a0('0x10'),JSON[_0x72a0('0x12')](_0x2bc45b));if(_0x2bc45b[_0x72a0('0x13')]){if(_0x2bc45b[_0x72a0('0x13')]['code']===0x1f4){logger[_0x72a0('0x13')](_0x72a0('0xf'),_0x287b06,_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);return _0x22270e(_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);}logger[_0x72a0('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x287b06,_0x2bc45b['error'][_0x72a0('0x14')]);return _0x2c04eb(_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);}else{logger[_0x72a0('0x15')](_0x72a0('0xf'),_0x287b06,_0x72a0('0x10'));_0x2c04eb(_0x2bc45b['result'][_0x72a0('0x14')]);}})[_0x72a0('0x16')](function(_0x16ac70){logger[_0x72a0('0x13')](_0x72a0('0xf'),_0x287b06,_0x16ac70);_0x22270e(_0x16ac70);});});} \ No newline at end of file +var _0x33af=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x57ed15,_0x2c4588){var _0x18be3c=function(_0x556b6f){while(--_0x556b6f){_0x57ed15['push'](_0x57ed15['shift']());}};_0x18be3c(++_0x2c4588);}(_0x33af,0xec));var _0xf33a=function(_0x49a4b5,_0x420d0c){_0x49a4b5=_0x49a4b5-0x0;var _0x343547=_0x33af[_0x49a4b5];return _0x343547;};'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')]('FreshsalesField,\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')]('FreshsalesField,\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/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 7c9cdd4..d2c64f9 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(_0x5a49e0,_0x50a2aa){var _0x4c2e9d=function(_0x5bd0c0){while(--_0x5bd0c0){_0x5a49e0['push'](_0x5a49e0['shift']());}};_0x4c2e9d(++_0x50a2aa);}(_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/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(_0x3afc67,_0x1137f1){var _0x1e3e8b=function(_0x2c9ccb){while(--_0x2c9ccb){_0x3afc67['push'](_0x3afc67['shift']());}};_0x1e3e8b(++_0x1137f1);}(_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/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 d55f384..0893e94 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 _0x3cae=['username','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x3cae,0x117));var _0xe3ca=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3cae[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xe3ca('0x0'));module[_0xe3ca('0x1')]={'name':{'type':Sequelize[_0xe3ca('0x2')]},'description':{'type':Sequelize[_0xe3ca('0x2')]},'username':{'type':Sequelize[_0xe3ca('0x2')],'unique':_0xe3ca('0x3')},'remoteUri':{'type':Sequelize[_0xe3ca('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xe3ca('0x2')]},'clientSecret':{'type':Sequelize[_0xe3ca('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xe3ca('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe3ca('0x4'),_0xe3ca('0x5')),'defaultValue':_0xe3ca('0x4')}}; \ No newline at end of file +var _0x6144=['exports','STRING','username','ENUM','integrationTab','newTab','sequelize'];(function(_0x4d839c,_0x33b444){var _0x1ea36d=function(_0x32ddda){while(--_0x32ddda){_0x4d839c['push'](_0x4d839c['shift']());}};_0x1ea36d(++_0x33b444);}(_0x6144,0x99));var _0x4614=function(_0x347b8e,_0x48429a){_0x347b8e=_0x347b8e-0x0;var _0x3bcf5b=_0x6144[_0x347b8e];return _0x3bcf5b;};'use strict';var Sequelize=require(_0x4614('0x0'));module[_0x4614('0x1')]={'name':{'type':Sequelize[_0x4614('0x2')]},'description':{'type':Sequelize[_0x4614('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x4614('0x3')},'remoteUri':{'type':Sequelize[_0x4614('0x2')]},'password':{'type':Sequelize[_0x4614('0x2')]},'clientId':{'type':Sequelize[_0x4614('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x4614('0x2')]},'serverUrl':{'type':Sequelize[_0x4614('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4614('0x4')](_0x4614('0x5'),_0x4614('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index e1b0c30..d359e85 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 _0xa2af=['picklistValues','value','true','False','false','test','statusCode','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../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','error','stack','name','send','index','SalesforceAccount','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','body','destroy','getConfigurations','findOne','SalesforceConfiguration','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceField','getFields','Task','remoteUri','clientSecret','username','password','securityToken','substring','Connection','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','Subject','Description','int','email','textarea','remove','custom'];(function(_0x29932e,_0x2e24ed){var _0x36aa87=function(_0x55caea){while(--_0x55caea){_0x29932e['push'](_0x29932e['shift']());}};_0x36aa87(++_0x2e24ed);}(_0xa2af,0x16a));var _0xfa2a=function(_0x95d90f,_0x3b963f){_0x95d90f=_0x95d90f-0x0;var _0x226cc3=_0xa2af[_0x95d90f];return _0x226cc3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfa2a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfa2a('0x1'));var rp=require(_0xfa2a('0x2'));var moment=require(_0xfa2a('0x3'));var BPromise=require(_0xfa2a('0x4'));var Mustache=require('mustache');var util=require(_0xfa2a('0x5'));var path=require('path');var sox=require(_0xfa2a('0x6'));var csv=require(_0xfa2a('0x7'));var ejs=require(_0xfa2a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfa2a('0x9'));var squel=require(_0xfa2a('0xa'));var crypto=require(_0xfa2a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfa2a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xfa2a('0xd'));var Papa=require('papaparse');var Redis=require(_0xfa2a('0xe'));var authService=require(_0xfa2a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfa2a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfa2a('0x11'))(_0xfa2a('0x12'));var utils=require(_0xfa2a('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xfa2a('0x14'));var db=require(_0xfa2a('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x27c593,_0x16ca8a){_0x16ca8a=_0x16ca8a||0xcc;return function(_0x2ba9f3){if(_0x2ba9f3){return _0x27c593[_0xfa2a('0x16')](_0x16ca8a);}return _0x27c593[_0xfa2a('0x17')](_0x16ca8a)[_0xfa2a('0x18')]();};}function respondWithResult(_0xb01096,_0x12bb31){_0x12bb31=_0x12bb31||0xc8;return function(_0x5c690b){if(_0x5c690b){return _0xb01096['status'](_0x12bb31)[_0xfa2a('0x19')](_0x5c690b);}};}function respondWithFilteredResult(_0x30e890,_0xaf4320){return function(_0x1b30fb){if(_0x1b30fb){var _0xd3e874=typeof _0xaf4320[_0xfa2a('0x1a')]===_0xfa2a('0x1b')&&typeof _0xaf4320[_0xfa2a('0x1c')]==='undefined';var _0x30be88=_0x1b30fb[_0xfa2a('0x1d')];var _0x30223a=_0xd3e874?0x0:_0xaf4320[_0xfa2a('0x1a')];var _0xb334b0=_0xd3e874?_0x1b30fb[_0xfa2a('0x1d')]:_0xaf4320[_0xfa2a('0x1a')]+_0xaf4320['limit'];var _0x5d7f93;if(_0xb334b0>=_0x30be88){_0xb334b0=_0x30be88;_0x5d7f93=0xc8;}else{_0x5d7f93=0xce;}_0x30e890[_0xfa2a('0x17')](_0x5d7f93);return _0x30e890[_0xfa2a('0x1e')](_0xfa2a('0x1f'),_0x30223a+'-'+_0xb334b0+'/'+_0x30be88)['json'](_0x1b30fb);}return null;};}function patchUpdates(_0x3d70aa){return function(_0x2d12d6){try{jsonpatch[_0xfa2a('0x20')](_0x2d12d6,_0x3d70aa,!![]);}catch(_0x197bfa){return BPromise[_0xfa2a('0x21')](_0x197bfa);}return _0x2d12d6[_0xfa2a('0x22')]();};}function saveUpdates(_0x33e68b,_0x272a33){return function(_0x3f271b){if(_0x3f271b){return _0x3f271b[_0xfa2a('0x23')](_0x33e68b)[_0xfa2a('0x24')](function(_0x5adddc){return _0x5adddc;});}return null;};}function removeEntity(_0x263e7a,_0x4505c6){return function(_0x2d0269){if(_0x2d0269){return _0x2d0269['destroy']()[_0xfa2a('0x24')](function(){_0x263e7a[_0xfa2a('0x17')](0xcc)[_0xfa2a('0x18')]();});}};}function handleEntityNotFound(_0x138439,_0x4aa36a){return function(_0x2dde38){if(!_0x2dde38){_0x138439[_0xfa2a('0x16')](0x194);}return _0x2dde38;};}function handleError(_0xc85512,_0x5c1890){_0x5c1890=_0x5c1890||0x1f4;return function(_0x45f1cc){logger[_0xfa2a('0x25')](_0x45f1cc[_0xfa2a('0x26')]);if(_0x45f1cc[_0xfa2a('0x27')]){delete _0x45f1cc[_0xfa2a('0x27')];}_0xc85512[_0xfa2a('0x17')](_0x5c1890)[_0xfa2a('0x28')](_0x45f1cc);};}exports[_0xfa2a('0x29')]=function(_0x2fbf47,_0x1c5206){var _0x3a6b31={},_0x1e60bf={},_0x262825={'count':0x0,'rows':[]};var _0x31aee0=_['map'](db[_0xfa2a('0x2a')][_0xfa2a('0x2b')],function(_0x2c5a8c){return{'name':_0x2c5a8c['fieldName'],'type':_0x2c5a8c[_0xfa2a('0x2c')][_0xfa2a('0x2d')]};});_0x1e60bf[_0xfa2a('0x2e')]=_[_0xfa2a('0x2f')](_0x31aee0,_0xfa2a('0x27'));_0x1e60bf[_0xfa2a('0x30')]=_[_0xfa2a('0x31')](_0x2fbf47[_0xfa2a('0x30')]);_0x1e60bf[_0xfa2a('0x32')]=_[_0xfa2a('0x33')](_0x1e60bf[_0xfa2a('0x2e')],_0x1e60bf[_0xfa2a('0x30')]);_0x3a6b31['attributes']=_[_0xfa2a('0x33')](_0x1e60bf[_0xfa2a('0x2e')],qs['fields'](_0x2fbf47['query'][_0xfa2a('0x34')]));_0x3a6b31[_0xfa2a('0x35')]=_0x3a6b31[_0xfa2a('0x35')]['length']?_0x3a6b31[_0xfa2a('0x35')]:_0x1e60bf[_0xfa2a('0x2e')];if(!_0x2fbf47[_0xfa2a('0x30')]['hasOwnProperty']('nolimit')){_0x3a6b31[_0xfa2a('0x1c')]=qs['limit'](_0x2fbf47['query'][_0xfa2a('0x1c')]);_0x3a6b31['offset']=qs['offset'](_0x2fbf47[_0xfa2a('0x30')][_0xfa2a('0x1a')]);}_0x3a6b31[_0xfa2a('0x36')]=qs['sort'](_0x2fbf47[_0xfa2a('0x30')][_0xfa2a('0x37')]);_0x3a6b31[_0xfa2a('0x38')]=qs[_0xfa2a('0x32')](_[_0xfa2a('0x39')](_0x2fbf47['query'],_0x1e60bf[_0xfa2a('0x32')]),_0x31aee0);if(_0x2fbf47['query'][_0xfa2a('0x3a')]){_0x3a6b31['where']=_[_0xfa2a('0x3b')](_0x3a6b31[_0xfa2a('0x38')],{'$or':_[_0xfa2a('0x2f')](_0x31aee0,function(_0x586983){if(_0x586983['type']!==_0xfa2a('0x3c')){var _0x2c49f4={};_0x2c49f4[_0x586983['name']]={'$like':'%'+_0x2fbf47[_0xfa2a('0x30')][_0xfa2a('0x3a')]+'%'};return _0x2c49f4;}})});}_0x3a6b31=_[_0xfa2a('0x3b')]({},_0x3a6b31,_0x2fbf47[_0xfa2a('0x3d')]);var _0xb778ca={'where':_0x3a6b31['where']};return db['SalesforceAccount'][_0xfa2a('0x1d')](_0xb778ca)[_0xfa2a('0x24')](function(_0xfe8bb9){_0x262825[_0xfa2a('0x1d')]=_0xfe8bb9;if(_0x2fbf47[_0xfa2a('0x30')][_0xfa2a('0x3e')]){_0x3a6b31[_0xfa2a('0x3f')]=[{'all':!![]}];}return db[_0xfa2a('0x2a')]['findAll'](_0x3a6b31);})[_0xfa2a('0x24')](function(_0x45fe98){_0x262825[_0xfa2a('0x40')]=_0x45fe98;return _0x262825;})['then'](respondWithFilteredResult(_0x1c5206,_0x3a6b31))[_0xfa2a('0x41')](handleError(_0x1c5206,null));};exports[_0xfa2a('0x42')]=function(_0x4d5509,_0x4c75aa){var _0x20c98c={'raw':![],'where':{'id':_0x4d5509[_0xfa2a('0x43')]['id']}},_0x45003d={};_0x45003d[_0xfa2a('0x2e')]=_[_0xfa2a('0x31')](db[_0xfa2a('0x2a')]['rawAttributes']);_0x45003d[_0xfa2a('0x30')]=_[_0xfa2a('0x31')](_0x4d5509['query']);_0x45003d[_0xfa2a('0x32')]=_[_0xfa2a('0x33')](_0x45003d[_0xfa2a('0x2e')],_0x45003d[_0xfa2a('0x30')]);_0x20c98c[_0xfa2a('0x35')]=_[_0xfa2a('0x33')](_0x45003d['model'],qs[_0xfa2a('0x34')](_0x4d5509['query'][_0xfa2a('0x34')]));_0x20c98c[_0xfa2a('0x35')]=_0x20c98c[_0xfa2a('0x35')][_0xfa2a('0x44')]?_0x20c98c[_0xfa2a('0x35')]:_0x45003d[_0xfa2a('0x2e')];if(_0x4d5509['query'][_0xfa2a('0x3e')]){_0x20c98c[_0xfa2a('0x3f')]=[{'all':!![]}];}_0x20c98c=_['merge']({},_0x20c98c,_0x4d5509['options']);return db[_0xfa2a('0x2a')][_0xfa2a('0x45')](_0x20c98c)[_0xfa2a('0x24')](handleEntityNotFound(_0x4c75aa,null))['then'](respondWithResult(_0x4c75aa,null))[_0xfa2a('0x41')](handleError(_0x4c75aa,null));};exports['create']=function(_0x1cca80,_0x5a2a06){return db[_0xfa2a('0x2a')][_0xfa2a('0x46')](_0x1cca80['body'],{})['then'](respondWithResult(_0x5a2a06,0xc9))[_0xfa2a('0x41')](handleError(_0x5a2a06,null));};exports[_0xfa2a('0x23')]=function(_0x53a228,_0x15696b){if(_0x53a228[_0xfa2a('0x47')]['id']){delete _0x53a228[_0xfa2a('0x47')]['id'];}return db[_0xfa2a('0x2a')][_0xfa2a('0x45')]({'where':{'id':_0x53a228[_0xfa2a('0x43')]['id']}})['then'](handleEntityNotFound(_0x15696b,null))[_0xfa2a('0x24')](saveUpdates(_0x53a228['body'],null))[_0xfa2a('0x24')](respondWithResult(_0x15696b,null))[_0xfa2a('0x41')](handleError(_0x15696b,null));};exports[_0xfa2a('0x48')]=function(_0x191ad5,_0x50aed1){return db['SalesforceAccount']['find']({'where':{'id':_0x191ad5['params']['id']}})[_0xfa2a('0x24')](handleEntityNotFound(_0x50aed1,null))[_0xfa2a('0x24')](removeEntity(_0x50aed1,null))[_0xfa2a('0x41')](handleError(_0x50aed1,null));};exports[_0xfa2a('0x49')]=function(_0x12938e,_0x4b1a7e,_0x34cea8){var _0x546cbe={};var _0x49abc7={};var _0x515f45;var _0x257f31;return db[_0xfa2a('0x2a')][_0xfa2a('0x4a')]({'where':{'id':_0x12938e[_0xfa2a('0x43')]['id']}})[_0xfa2a('0x24')](handleEntityNotFound(_0x4b1a7e,null))['then'](function(_0x1be341){if(_0x1be341){_0x515f45=_0x1be341;_0x49abc7[_0xfa2a('0x2e')]=_[_0xfa2a('0x31')](db[_0xfa2a('0x4b')][_0xfa2a('0x2b')]);_0x49abc7[_0xfa2a('0x30')]=_['keys'](_0x12938e[_0xfa2a('0x30')]);_0x49abc7[_0xfa2a('0x32')]=_[_0xfa2a('0x33')](_0x49abc7[_0xfa2a('0x2e')],_0x49abc7[_0xfa2a('0x30')]);_0x546cbe[_0xfa2a('0x35')]=_[_0xfa2a('0x33')](_0x49abc7[_0xfa2a('0x2e')],qs[_0xfa2a('0x34')](_0x12938e[_0xfa2a('0x30')]['fields']));_0x546cbe[_0xfa2a('0x35')]=_0x546cbe[_0xfa2a('0x35')]['length']?_0x546cbe[_0xfa2a('0x35')]:_0x49abc7[_0xfa2a('0x2e')];_0x546cbe[_0xfa2a('0x36')]=qs[_0xfa2a('0x37')](_0x12938e[_0xfa2a('0x30')][_0xfa2a('0x37')]);_0x546cbe[_0xfa2a('0x38')]=qs['filters'](_[_0xfa2a('0x39')](_0x12938e[_0xfa2a('0x30')],_0x49abc7['filters']));if(_0x12938e[_0xfa2a('0x30')][_0xfa2a('0x3a')]){_0x546cbe[_0xfa2a('0x38')]=_[_0xfa2a('0x3b')](_0x546cbe[_0xfa2a('0x38')],{'$or':_['map'](_0x546cbe[_0xfa2a('0x35')],function(_0x2ca040){var _0x16a050={};_0x16a050[_0x2ca040]={'$like':'%'+_0x12938e[_0xfa2a('0x30')]['filter']+'%'};return _0x16a050;})});}_0x546cbe=_[_0xfa2a('0x3b')]({},_0x546cbe,_0x12938e[_0xfa2a('0x3d')]);return _0x515f45[_0xfa2a('0x49')](_0x546cbe);}})[_0xfa2a('0x24')](function(_0x81d89e){if(_0x81d89e){_0x257f31=_0x81d89e[_0xfa2a('0x44')];if(!_0x12938e[_0xfa2a('0x30')][_0xfa2a('0x4c')](_0xfa2a('0x4d'))){_0x546cbe[_0xfa2a('0x1c')]=qs['limit'](_0x12938e[_0xfa2a('0x30')][_0xfa2a('0x1c')]);_0x546cbe[_0xfa2a('0x1a')]=qs[_0xfa2a('0x1a')](_0x12938e[_0xfa2a('0x30')][_0xfa2a('0x1a')]);}return _0x515f45[_0xfa2a('0x49')](_0x546cbe);}})[_0xfa2a('0x24')](function(_0x18a2b4){if(_0x18a2b4){return _0x18a2b4?{'count':_0x257f31,'rows':_0x18a2b4}:null;}})['then'](respondWithResult(_0x4b1a7e,null))[_0xfa2a('0x41')](handleError(_0x4b1a7e,null));};exports[_0xfa2a('0x4e')]=function(_0x3e7599,_0x12808d,_0x11add6){if(_0x3e7599['body']['id']){delete _0x3e7599[_0xfa2a('0x47')]['id'];}return db[_0xfa2a('0x2a')][_0xfa2a('0x4a')]({'where':{'id':_0x3e7599['params']['id']}})['then'](handleEntityNotFound(_0x12808d,null))[_0xfa2a('0x24')](function(_0xe27fa4){if(_0xe27fa4){_0x3e7599[_0xfa2a('0x47')][_0xfa2a('0x4f')]=_0xe27fa4['id'];_0x3e7599[_0xfa2a('0x47')][_0xfa2a('0x50')]=integrations[_0xfa2a('0x51')](_0x3e7599[_0xfa2a('0x47')][_0xfa2a('0x52')],_0x3e7599[_0xfa2a('0x47')][_0xfa2a('0x2c')]);_0x3e7599[_0xfa2a('0x47')][_0xfa2a('0x53')]=integrations['getDescriptions'](_0x3e7599[_0xfa2a('0x47')][_0xfa2a('0x52')],_0x3e7599['body']['type']);return db['SalesforceConfiguration']['create'](_0x3e7599[_0xfa2a('0x47')],{'include':[{'model':db[_0xfa2a('0x54')],'as':'Subjects'},{'model':db['SalesforceField'],'as':'Descriptions'}]});}return null;})[_0xfa2a('0x24')](respondWithResult(_0x12808d,null))['catch'](handleError(_0x12808d,null));};exports[_0xfa2a('0x55')]=function(_0x3e1d25,_0x2be3d3,_0x5028f4){var _0x5c3ac2;var _0x3a3e15='';var _0x6f92f2=_0xfa2a('0x56');return db[_0xfa2a('0x2a')][_0xfa2a('0x4a')]({'where':{'id':_0x3e1d25[_0xfa2a('0x43')]['id']},'attributes':['id',_0xfa2a('0x57'),'clientId',_0xfa2a('0x58'),_0xfa2a('0x59'),_0xfa2a('0x5a'),_0xfa2a('0x5b')]})['then'](handleEntityNotFound(_0x2be3d3,null))[_0xfa2a('0x24')](function(_0x435140){if(_0x435140){_0x3a3e15=_0x435140[_0xfa2a('0x57')];var _0xf3b196=_0x3a3e15['slice'](-0x1);if(_0xf3b196==='/'){_0x3a3e15=_0x3a3e15[_0xfa2a('0x5c')](0x0,_0x3a3e15['lastIndexOf'](_0xf3b196));}_0x5c3ac2=new jsforce[(_0xfa2a('0x5d'))]({'oauth2':{'loginUrl':_0x3a3e15,'clientId':_0x435140['clientId'],'clientSecret':_0x435140[_0xfa2a('0x58')]}});return _0x5c3ac2[_0xfa2a('0x5e')](_0x435140['username'],_0x435140[_0xfa2a('0x5a')][_0xfa2a('0x5f')](_0x435140['securityToken']));}})[_0xfa2a('0x24')](function(_0x1dba8b){if(_0x1dba8b){if(!_[_0xfa2a('0x60')](_0x3e1d25[_0xfa2a('0x30')][_0xfa2a('0x61')])){_0x6f92f2=_0x3e1d25[_0xfa2a('0x30')][_0xfa2a('0x61')];}return _0x5c3ac2[_0xfa2a('0x62')](_0x6f92f2)[_0xfa2a('0x63')]();}})[_0xfa2a('0x24')](function(_0x28dca4){var _0x499e1b=[_0xfa2a('0x64'),_0xfa2a('0x65'),_0xfa2a('0x66'),'IsRecurrence',_0xfa2a('0x67'),_0xfa2a('0x68')];var _0x5219f9=['string',_0xfa2a('0x69'),'picklist','boolean',_0xfa2a('0x6a'),_0xfa2a('0x6b'),'phone'];if(_0x28dca4){_[_0xfa2a('0x6c')](_0x28dca4[_0xfa2a('0x34')],function(_0x3d120c){return _0x499e1b['includes'](_0x3d120c[_0xfa2a('0x27')])||!_0x5219f9['includes'](_0x3d120c['type']);});return{'count':_0x28dca4[_0xfa2a('0x34')]['length'],'rows':_[_0xfa2a('0x2f')](_0x28dca4[_0xfa2a('0x34')],function(_0x4009c0){return{'id':_0x4009c0['name'],'name':_0x4009c0['label'],'custom':_0x4009c0[_0xfa2a('0x6d')],'options':_0x4009c0[_0xfa2a('0x6e')][_0xfa2a('0x44')]>0x0?_[_0xfa2a('0x2f')](_0x4009c0[_0xfa2a('0x6e')],function(_0x72df3f){return{'name':_0x72df3f['label'],'value':_0x72df3f[_0xfa2a('0x6f')]};}):_0x4009c0[_0xfa2a('0x2c')]=='boolean'?[{'name':'True','value':_0xfa2a('0x70')},{'name':_0xfa2a('0x71'),'value':_0xfa2a('0x72')}]:[]};})};}})[_0xfa2a('0x24')](respondWithResult(_0x2be3d3,null))['catch'](function(_0x7cf645){var _0x10c890=_0x3e1d25[_0xfa2a('0x30')][_0xfa2a('0x73')]?0x1f4:_0x7cf645[_0xfa2a('0x74')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x10c890,JSON['stringify'](_0x7cf645));delete _0x7cf645[_0xfa2a('0x27')];if(_0x10c890===0x191){_0x10c890=0x190;}_0x2be3d3['status'](_0x10c890)['send'](_0x3e1d25['query'][_0xfa2a('0x73')]?{'message':_0xfa2a('0x75'),'statusCode':_0x7cf645[_0xfa2a('0x74')]}:_0x7cf645);});}; \ No newline at end of file +var _0xd65e=['merge','VIRTUAL','filter','options','includeAll','rows','catch','params','keys','include','find','create','body','getConfigurations','findOne','SalesforceConfiguration','AccountId','channel','Descriptions','getDescriptions','getFields','Task','remoteUri','clientId','clientSecret','password','slice','substring','lastIndexOf','Connection','login','securityToken','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','Subject','Description','int','picklist','email','textarea','remove','includes','label','picklistValues','value','boolean','True','false','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','update','then','destroy','stack','name','send','index','SalesforceAccount','rawAttributes','fieldName','type','model','map','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick'];(function(_0x2aeb2c,_0xa59413){var _0x495086=function(_0x598967){while(--_0x598967){_0x2aeb2c['push'](_0x2aeb2c['shift']());}};_0x495086(++_0xa59413);}(_0xd65e,0x1a1));var _0xed65=function(_0x5442a1,_0x50263b){_0x5442a1=_0x5442a1-0x0;var _0xb38c01=_0xd65e[_0x5442a1];return _0xb38c01;};'use strict';var emlformat=require(_0xed65('0x0'));var rimraf=require(_0xed65('0x1'));var zipdir=require(_0xed65('0x2'));var jsonpatch=require(_0xed65('0x3'));var rp=require(_0xed65('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xed65('0x5'));var util=require(_0xed65('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xed65('0x7'));var ejs=require(_0xed65('0x8'));var fs=require('fs');var fs_extra=require(_0xed65('0x9'));var _=require(_0xed65('0xa'));var squel=require(_0xed65('0xb'));var crypto=require(_0xed65('0xc'));var jsforce=require(_0xed65('0xd'));var deskjs=require(_0xed65('0xe'));var toCsv=require(_0xed65('0x7'));var querystring=require(_0xed65('0xf'));var Papa=require(_0xed65('0x10'));var Redis=require(_0xed65('0x11'));var authService=require(_0xed65('0x12'));var qs=require(_0xed65('0x13'));var as=require(_0xed65('0x14'));var hardwareService=require(_0xed65('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xed65('0x16'));var config=require(_0xed65('0x17'));var licenseUtil=require(_0xed65('0x18'));var db=require(_0xed65('0x19'))['db'];var integrations=require(_0xed65('0x1a'));function respondWithStatusCode(_0x2afdaa,_0x7eef5b){_0x7eef5b=_0x7eef5b||0xcc;return function(_0x13cb3c){if(_0x13cb3c){return _0x2afdaa[_0xed65('0x1b')](_0x7eef5b);}return _0x2afdaa['status'](_0x7eef5b)[_0xed65('0x1c')]();};}function respondWithResult(_0x4e37f7,_0x3128dc){_0x3128dc=_0x3128dc||0xc8;return function(_0x10ad7e){if(_0x10ad7e){return _0x4e37f7['status'](_0x3128dc)[_0xed65('0x1d')](_0x10ad7e);}};}function respondWithFilteredResult(_0xa4e5e3,_0xc716b8){return function(_0x1bc1b5){if(_0x1bc1b5){var _0x3ad3c1=typeof _0xc716b8[_0xed65('0x1e')]===_0xed65('0x1f')&&typeof _0xc716b8[_0xed65('0x20')]==='undefined';var _0x16f7a8=_0x1bc1b5[_0xed65('0x21')];var _0x43b9c0=_0x3ad3c1?0x0:_0xc716b8['offset'];var _0x561158=_0x3ad3c1?_0x1bc1b5[_0xed65('0x21')]:_0xc716b8['offset']+_0xc716b8['limit'];var _0x39ad28;if(_0x561158>=_0x16f7a8){_0x561158=_0x16f7a8;_0x39ad28=0xc8;}else{_0x39ad28=0xce;}_0xa4e5e3[_0xed65('0x22')](_0x39ad28);return _0xa4e5e3[_0xed65('0x23')]('Content-Range',_0x43b9c0+'-'+_0x561158+'/'+_0x16f7a8)['json'](_0x1bc1b5);}return null;};}function patchUpdates(_0x156164){return function(_0x507430){try{jsonpatch[_0xed65('0x24')](_0x507430,_0x156164,!![]);}catch(_0x2dbe07){return BPromise[_0xed65('0x25')](_0x2dbe07);}return _0x507430['save']();};}function saveUpdates(_0x928d80,_0x2fa1cc){return function(_0x39b8cc){if(_0x39b8cc){return _0x39b8cc[_0xed65('0x26')](_0x928d80)[_0xed65('0x27')](function(_0x465f23){return _0x465f23;});}return null;};}function removeEntity(_0x8f84fb,_0x15af7b){return function(_0x121829){if(_0x121829){return _0x121829[_0xed65('0x28')]()[_0xed65('0x27')](function(){_0x8f84fb[_0xed65('0x22')](0xcc)[_0xed65('0x1c')]();});}};}function handleEntityNotFound(_0x140daa,_0xa214b5){return function(_0x2f9b4e){if(!_0x2f9b4e){_0x140daa['sendStatus'](0x194);}return _0x2f9b4e;};}function handleError(_0x4cf46e,_0x400a0b){_0x400a0b=_0x400a0b||0x1f4;return function(_0x2d7d3c){logger['error'](_0x2d7d3c[_0xed65('0x29')]);if(_0x2d7d3c[_0xed65('0x2a')]){delete _0x2d7d3c[_0xed65('0x2a')];}_0x4cf46e[_0xed65('0x22')](_0x400a0b)[_0xed65('0x2b')](_0x2d7d3c);};}exports[_0xed65('0x2c')]=function(_0x11e3ba,_0x10f11f){var _0xe499a7={},_0x3ea5b0={},_0x4d772b={'count':0x0,'rows':[]};var _0xfeae69=_['map'](db[_0xed65('0x2d')][_0xed65('0x2e')],function(_0x4dd86d){return{'name':_0x4dd86d[_0xed65('0x2f')],'type':_0x4dd86d[_0xed65('0x30')]['key']};});_0x3ea5b0[_0xed65('0x31')]=_[_0xed65('0x32')](_0xfeae69,'name');_0x3ea5b0[_0xed65('0x33')]=_['keys'](_0x11e3ba[_0xed65('0x33')]);_0x3ea5b0['filters']=_['intersection'](_0x3ea5b0[_0xed65('0x31')],_0x3ea5b0[_0xed65('0x33')]);_0xe499a7[_0xed65('0x34')]=_[_0xed65('0x35')](_0x3ea5b0[_0xed65('0x31')],qs[_0xed65('0x36')](_0x11e3ba[_0xed65('0x33')][_0xed65('0x36')]));_0xe499a7[_0xed65('0x34')]=_0xe499a7[_0xed65('0x34')][_0xed65('0x37')]?_0xe499a7['attributes']:_0x3ea5b0['model'];if(!_0x11e3ba[_0xed65('0x33')][_0xed65('0x38')](_0xed65('0x39'))){_0xe499a7['limit']=qs[_0xed65('0x20')](_0x11e3ba[_0xed65('0x33')][_0xed65('0x20')]);_0xe499a7[_0xed65('0x1e')]=qs[_0xed65('0x1e')](_0x11e3ba[_0xed65('0x33')]['offset']);}_0xe499a7[_0xed65('0x3a')]=qs[_0xed65('0x3b')](_0x11e3ba['query'][_0xed65('0x3b')]);_0xe499a7[_0xed65('0x3c')]=qs[_0xed65('0x3d')](_[_0xed65('0x3e')](_0x11e3ba[_0xed65('0x33')],_0x3ea5b0['filters']),_0xfeae69);if(_0x11e3ba['query']['filter']){_0xe499a7[_0xed65('0x3c')]=_[_0xed65('0x3f')](_0xe499a7[_0xed65('0x3c')],{'$or':_[_0xed65('0x32')](_0xfeae69,function(_0x561169){if(_0x561169['type']!==_0xed65('0x40')){var _0x1df3b4={};_0x1df3b4[_0x561169[_0xed65('0x2a')]]={'$like':'%'+_0x11e3ba[_0xed65('0x33')][_0xed65('0x41')]+'%'};return _0x1df3b4;}})});}_0xe499a7=_[_0xed65('0x3f')]({},_0xe499a7,_0x11e3ba[_0xed65('0x42')]);var _0xf8eadf={'where':_0xe499a7[_0xed65('0x3c')]};return db['SalesforceAccount']['count'](_0xf8eadf)[_0xed65('0x27')](function(_0x2e10e1){_0x4d772b[_0xed65('0x21')]=_0x2e10e1;if(_0x11e3ba[_0xed65('0x33')][_0xed65('0x43')]){_0xe499a7['include']=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0xe499a7);})['then'](function(_0x154dee){_0x4d772b[_0xed65('0x44')]=_0x154dee;return _0x4d772b;})[_0xed65('0x27')](respondWithFilteredResult(_0x10f11f,_0xe499a7))[_0xed65('0x45')](handleError(_0x10f11f,null));};exports['show']=function(_0x105142,_0x5c0869){var _0x4f5137={'raw':![],'where':{'id':_0x105142[_0xed65('0x46')]['id']}},_0x551c84={};_0x551c84['model']=_[_0xed65('0x47')](db[_0xed65('0x2d')]['rawAttributes']);_0x551c84[_0xed65('0x33')]=_[_0xed65('0x47')](_0x105142[_0xed65('0x33')]);_0x551c84['filters']=_[_0xed65('0x35')](_0x551c84[_0xed65('0x31')],_0x551c84[_0xed65('0x33')]);_0x4f5137[_0xed65('0x34')]=_[_0xed65('0x35')](_0x551c84[_0xed65('0x31')],qs[_0xed65('0x36')](_0x105142[_0xed65('0x33')][_0xed65('0x36')]));_0x4f5137[_0xed65('0x34')]=_0x4f5137[_0xed65('0x34')][_0xed65('0x37')]?_0x4f5137[_0xed65('0x34')]:_0x551c84[_0xed65('0x31')];if(_0x105142[_0xed65('0x33')][_0xed65('0x43')]){_0x4f5137[_0xed65('0x48')]=[{'all':!![]}];}_0x4f5137=_['merge']({},_0x4f5137,_0x105142['options']);return db['SalesforceAccount'][_0xed65('0x49')](_0x4f5137)[_0xed65('0x27')](handleEntityNotFound(_0x5c0869,null))[_0xed65('0x27')](respondWithResult(_0x5c0869,null))[_0xed65('0x45')](handleError(_0x5c0869,null));};exports[_0xed65('0x4a')]=function(_0x20fdc1,_0x21326b){return db[_0xed65('0x2d')][_0xed65('0x4a')](_0x20fdc1['body'],{})[_0xed65('0x27')](respondWithResult(_0x21326b,0xc9))[_0xed65('0x45')](handleError(_0x21326b,null));};exports['update']=function(_0x1cd79b,_0x3f48a3){if(_0x1cd79b[_0xed65('0x4b')]['id']){delete _0x1cd79b['body']['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0x1cd79b[_0xed65('0x46')]['id']}})[_0xed65('0x27')](handleEntityNotFound(_0x3f48a3,null))['then'](saveUpdates(_0x1cd79b['body'],null))[_0xed65('0x27')](respondWithResult(_0x3f48a3,null))[_0xed65('0x45')](handleError(_0x3f48a3,null));};exports[_0xed65('0x28')]=function(_0x5c8280,_0x16b253){return db[_0xed65('0x2d')][_0xed65('0x49')]({'where':{'id':_0x5c8280[_0xed65('0x46')]['id']}})[_0xed65('0x27')](handleEntityNotFound(_0x16b253,null))[_0xed65('0x27')](removeEntity(_0x16b253,null))[_0xed65('0x45')](handleError(_0x16b253,null));};exports[_0xed65('0x4c')]=function(_0x5b1ae0,_0x4e30c5,_0x41a0e6){var _0x5aa7a3={};var _0x4b00bf={};var _0x104f24;var _0x46a857;return db['SalesforceAccount'][_0xed65('0x4d')]({'where':{'id':_0x5b1ae0['params']['id']}})[_0xed65('0x27')](handleEntityNotFound(_0x4e30c5,null))[_0xed65('0x27')](function(_0x135669){if(_0x135669){_0x104f24=_0x135669;_0x4b00bf[_0xed65('0x31')]=_[_0xed65('0x47')](db[_0xed65('0x4e')][_0xed65('0x2e')]);_0x4b00bf[_0xed65('0x33')]=_[_0xed65('0x47')](_0x5b1ae0[_0xed65('0x33')]);_0x4b00bf[_0xed65('0x3d')]=_['intersection'](_0x4b00bf[_0xed65('0x31')],_0x4b00bf[_0xed65('0x33')]);_0x5aa7a3[_0xed65('0x34')]=_[_0xed65('0x35')](_0x4b00bf['model'],qs[_0xed65('0x36')](_0x5b1ae0[_0xed65('0x33')][_0xed65('0x36')]));_0x5aa7a3['attributes']=_0x5aa7a3['attributes']['length']?_0x5aa7a3[_0xed65('0x34')]:_0x4b00bf[_0xed65('0x31')];_0x5aa7a3[_0xed65('0x3a')]=qs[_0xed65('0x3b')](_0x5b1ae0[_0xed65('0x33')][_0xed65('0x3b')]);_0x5aa7a3[_0xed65('0x3c')]=qs[_0xed65('0x3d')](_['pick'](_0x5b1ae0[_0xed65('0x33')],_0x4b00bf['filters']));if(_0x5b1ae0[_0xed65('0x33')]['filter']){_0x5aa7a3['where']=_[_0xed65('0x3f')](_0x5aa7a3['where'],{'$or':_[_0xed65('0x32')](_0x5aa7a3[_0xed65('0x34')],function(_0x7a7dc4){var _0x34951f={};_0x34951f[_0x7a7dc4]={'$like':'%'+_0x5b1ae0[_0xed65('0x33')][_0xed65('0x41')]+'%'};return _0x34951f;})});}_0x5aa7a3=_[_0xed65('0x3f')]({},_0x5aa7a3,_0x5b1ae0[_0xed65('0x42')]);return _0x104f24[_0xed65('0x4c')](_0x5aa7a3);}})[_0xed65('0x27')](function(_0x44d9ce){if(_0x44d9ce){_0x46a857=_0x44d9ce[_0xed65('0x37')];if(!_0x5b1ae0['query'][_0xed65('0x38')]('nolimit')){_0x5aa7a3[_0xed65('0x20')]=qs[_0xed65('0x20')](_0x5b1ae0[_0xed65('0x33')][_0xed65('0x20')]);_0x5aa7a3[_0xed65('0x1e')]=qs[_0xed65('0x1e')](_0x5b1ae0[_0xed65('0x33')][_0xed65('0x1e')]);}return _0x104f24[_0xed65('0x4c')](_0x5aa7a3);}})['then'](function(_0x363b60){if(_0x363b60){return _0x363b60?{'count':_0x46a857,'rows':_0x363b60}:null;}})['then'](respondWithResult(_0x4e30c5,null))['catch'](handleError(_0x4e30c5,null));};exports['addConfiguration']=function(_0x862c9d,_0x3e331b,_0x40c074){if(_0x862c9d[_0xed65('0x4b')]['id']){delete _0x862c9d[_0xed65('0x4b')]['id'];}return db[_0xed65('0x2d')][_0xed65('0x4d')]({'where':{'id':_0x862c9d[_0xed65('0x46')]['id']}})[_0xed65('0x27')](handleEntityNotFound(_0x3e331b,null))['then'](function(_0x1e1a02){if(_0x1e1a02){_0x862c9d[_0xed65('0x4b')][_0xed65('0x4f')]=_0x1e1a02['id'];_0x862c9d[_0xed65('0x4b')]['Subjects']=integrations['getSubjects'](_0x862c9d[_0xed65('0x4b')][_0xed65('0x50')],_0x862c9d[_0xed65('0x4b')]['type']);_0x862c9d[_0xed65('0x4b')][_0xed65('0x51')]=integrations[_0xed65('0x52')](_0x862c9d[_0xed65('0x4b')][_0xed65('0x50')],_0x862c9d[_0xed65('0x4b')][_0xed65('0x30')]);return db[_0xed65('0x4e')][_0xed65('0x4a')](_0x862c9d['body'],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db['SalesforceField'],'as':_0xed65('0x51')}]});}return null;})['then'](respondWithResult(_0x3e331b,null))[_0xed65('0x45')](handleError(_0x3e331b,null));};exports[_0xed65('0x53')]=function(_0xf961a4,_0x22e427,_0x239aed){var _0x3e9034;var _0x3c5c89='';var _0x343274=_0xed65('0x54');return db[_0xed65('0x2d')][_0xed65('0x4d')]({'where':{'id':_0xf961a4[_0xed65('0x46')]['id']},'attributes':['id',_0xed65('0x55'),_0xed65('0x56'),_0xed65('0x57'),'username',_0xed65('0x58'),'securityToken']})[_0xed65('0x27')](handleEntityNotFound(_0x22e427,null))['then'](function(_0xfde0eb){if(_0xfde0eb){_0x3c5c89=_0xfde0eb['remoteUri'];var _0x48329c=_0x3c5c89[_0xed65('0x59')](-0x1);if(_0x48329c==='/'){_0x3c5c89=_0x3c5c89[_0xed65('0x5a')](0x0,_0x3c5c89[_0xed65('0x5b')](_0x48329c));}_0x3e9034=new jsforce[(_0xed65('0x5c'))]({'oauth2':{'loginUrl':_0x3c5c89,'clientId':_0xfde0eb[_0xed65('0x56')],'clientSecret':_0xfde0eb[_0xed65('0x57')]}});return _0x3e9034[_0xed65('0x5d')](_0xfde0eb['username'],_0xfde0eb[_0xed65('0x58')]['concat'](_0xfde0eb[_0xed65('0x5e')]));}})[_0xed65('0x27')](function(_0x139b98){if(_0x139b98){if(!_[_0xed65('0x5f')](_0xf961a4[_0xed65('0x33')]['ticketType'])){_0x343274=_0xf961a4[_0xed65('0x33')][_0xed65('0x60')];}return _0x3e9034['sobject'](_0x343274)[_0xed65('0x61')]();}})[_0xed65('0x27')](function(_0x22c3de){var _0x14be9c=[_0xed65('0x62'),_0xed65('0x63'),_0xed65('0x64'),'IsRecurrence',_0xed65('0x65'),_0xed65('0x66')];var _0x22b262=['string',_0xed65('0x67'),_0xed65('0x68'),'boolean',_0xed65('0x69'),_0xed65('0x6a'),'phone'];if(_0x22c3de){_[_0xed65('0x6b')](_0x22c3de[_0xed65('0x36')],function(_0x3d10da){return _0x14be9c[_0xed65('0x6c')](_0x3d10da[_0xed65('0x2a')])||!_0x22b262[_0xed65('0x6c')](_0x3d10da[_0xed65('0x30')]);});return{'count':_0x22c3de['fields'][_0xed65('0x37')],'rows':_['map'](_0x22c3de[_0xed65('0x36')],function(_0x2a6b29){return{'id':_0x2a6b29[_0xed65('0x2a')],'name':_0x2a6b29[_0xed65('0x6d')],'custom':_0x2a6b29['custom'],'options':_0x2a6b29['picklistValues'][_0xed65('0x37')]>0x0?_[_0xed65('0x32')](_0x2a6b29[_0xed65('0x6e')],function(_0x32dd43){return{'name':_0x32dd43[_0xed65('0x6d')],'value':_0x32dd43[_0xed65('0x6f')]};}):_0x2a6b29[_0xed65('0x30')]==_0xed65('0x70')?[{'name':_0xed65('0x71'),'value':'true'},{'name':'False','value':_0xed65('0x72')}]:[]};})};}})[_0xed65('0x27')](respondWithResult(_0x22e427,null))['catch'](function(_0x206090){var _0xe97d8f=_0xf961a4[_0xed65('0x33')][_0xed65('0x73')]?0x1f4:_0x206090[_0xed65('0x74')]||0x1f4;logger[_0xed65('0x75')](_0xed65('0x76'),_0xed65('0x53'),_0xe97d8f,JSON['stringify'](_0x206090));delete _0x206090[_0xed65('0x2a')];if(_0xe97d8f===0x191){_0xe97d8f=0x190;}_0x22e427[_0xed65('0x22')](_0xe97d8f)[_0xed65('0x2b')](_0xf961a4[_0xed65('0x33')][_0xed65('0x73')]?{'message':_0xed65('0x77'),'statusCode':_0x206090[_0xed65('0x74')]}:_0x206090);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 05b3f1c..75ffc33 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 _0x3148=['moment','bluebird','request-promise','path','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','SalesforceAccount','int_salesforce_accounts','util','api'];(function(_0x3ee55a,_0x19aeea){var _0x581800=function(_0x636cb7){while(--_0x636cb7){_0x3ee55a['push'](_0x3ee55a['shift']());}};_0x581800(++_0x19aeea);}(_0x3148,0x172));var _0x8314=function(_0x3b0b07,_0xc927c6){_0x3b0b07=_0x3b0b07-0x0;var _0x198e38=_0x3148[_0x3b0b07];return _0x198e38;};'use strict';var _=require('lodash');var util=require(_0x8314('0x0'));var logger=require('../../config/logger')(_0x8314('0x1'));var moment=require(_0x8314('0x2'));var BPromise=require(_0x8314('0x3'));var rp=require(_0x8314('0x4'));var fs=require('fs');var path=require(_0x8314('0x5'));var rimraf=require(_0x8314('0x6'));var config=require('../../config/environment');var attributes=require(_0x8314('0x7'));var integrations=require(_0x8314('0x8'));module[_0x8314('0x9')]=function(_0x1891f5,_0x3a8d18){return _0x1891f5['define'](_0x8314('0xa'),attributes,{'tableName':_0x8314('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b19=['SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger','bluebird','rimraf','../../config/environment','exports','define'];(function(_0x11cabe,_0x41f926){var _0x17b40e=function(_0x2c7c32){while(--_0x2c7c32){_0x11cabe['push'](_0x11cabe['shift']());}};_0x17b40e(++_0x41f926);}(_0x7b19,0x1df));var _0x97b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7b19[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x97b1('0x0'));var util=require('util');var logger=require(_0x97b1('0x1'))('api');var moment=require('moment');var BPromise=require(_0x97b1('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x97b1('0x3'));var config=require(_0x97b1('0x4'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x97b1('0x5')]=function(_0x27238,_0x1e51ab){return _0x27238[_0x97b1('0x6')](_0x97b1('0x7'),attributes,{'tableName':_0x97b1('0x8'),'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 4220535..289b106 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 _0x778c=['attributes','limit','include','map','model','GetSalesforceAccount','ShowSalesforceAccount','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SalesforceAccount','findAll','options','where'];(function(_0x4076e2,_0x1c1dbd){var _0x164813=function(_0x33b304){while(--_0x33b304){_0x4076e2['push'](_0x4076e2['shift']());}};_0x164813(++_0x1c1dbd);}(_0x778c,0x1e4));var _0xc778=function(_0x4b12ae,_0xf2b3b){_0x4b12ae=_0x4b12ae-0x0;var _0x16957b=_0x778c[_0x4b12ae];return _0x16957b;};'use strict';var _=require(_0xc778('0x0'));var util=require('util');var moment=require(_0xc778('0x1'));var BPromise=require(_0xc778('0x2'));var rs=require(_0xc778('0x3'));var fs=require('fs');var Redis=require(_0xc778('0x4'));var db=require(_0xc778('0x5'))['db'];var utils=require(_0xc778('0x6'));var logger=require('../../config/logger')(_0xc778('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc778('0x8')][_0xc778('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e7bec,_0x53490a,_0x51e5f2){return new BPromise(function(_0x311053,_0xbf56a9){return client[_0xc778('0xa')](_0x5e7bec,_0x51e5f2)['then'](function(_0x4f2f52){logger[_0xc778('0xb')](_0xc778('0xc'),_0x53490a,_0xc778('0xd'));logger[_0xc778('0xe')](_0xc778('0xf'),_0x53490a,_0xc778('0xd'),JSON[_0xc778('0x10')](_0x4f2f52));if(_0x4f2f52[_0xc778('0x11')]){if(_0x4f2f52['error'][_0xc778('0x12')]===0x1f4){logger[_0xc778('0x11')](_0xc778('0xc'),_0x53490a,_0x4f2f52[_0xc778('0x11')][_0xc778('0x13')]);return _0xbf56a9(_0x4f2f52[_0xc778('0x11')][_0xc778('0x13')]);}logger[_0xc778('0x11')](_0xc778('0xc'),_0x53490a,_0x4f2f52[_0xc778('0x11')][_0xc778('0x13')]);return _0x311053(_0x4f2f52['error'][_0xc778('0x13')]);}else{logger[_0xc778('0xb')]('SalesforceAccount,\x20%s,\x20%s',_0x53490a,_0xc778('0xd'));_0x311053(_0x4f2f52[_0xc778('0x14')][_0xc778('0x13')]);}})[_0xc778('0x15')](function(_0x2726fc){logger['error'](_0xc778('0xc'),_0x53490a,_0x2726fc);_0xbf56a9(_0x2726fc);});});}exports['GetSalesforceAccount']=function(_0x49a567){var _0x4ab049=this;return new Promise(function(_0x5e0849,_0x72b334){return db[_0xc778('0x16')][_0xc778('0x17')]({'raw':_0x49a567[_0xc778('0x18')]?_0x49a567[_0xc778('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x49a567[_0xc778('0x18')]?_0x49a567[_0xc778('0x18')][_0xc778('0x19')]||null:null,'attributes':_0x49a567['options']?_0x49a567['options'][_0xc778('0x1a')]||null:null,'limit':_0x49a567[_0xc778('0x18')]?_0x49a567[_0xc778('0x18')][_0xc778('0x1b')]||null:null,'include':_0x49a567[_0xc778('0x18')]?_0x49a567[_0xc778('0x18')][_0xc778('0x1c')]?_[_0xc778('0x1d')](_0x49a567[_0xc778('0x18')][_0xc778('0x1c')],function(_0x18e490){return{'model':db[_0x18e490['model']],'as':_0x18e490['as'],'attributes':_0x18e490[_0xc778('0x1a')],'include':_0x18e490[_0xc778('0x1c')]?_[_0xc778('0x1d')](_0x18e490[_0xc778('0x1c')],function(_0x40a93b){return{'model':db[_0x40a93b[_0xc778('0x1e')]],'as':_0x40a93b['as'],'attributes':_0x40a93b[_0xc778('0x1a')],'include':_0x40a93b[_0xc778('0x1c')]?_['map'](_0x40a93b[_0xc778('0x1c')],function(_0x4f4e25){return{'model':db[_0x4f4e25[_0xc778('0x1e')]],'as':_0x4f4e25['as'],'attributes':_0x4f4e25[_0xc778('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x575ac0){logger[_0xc778('0xb')](_0xc778('0x1f'),_0x49a567);logger[_0xc778('0xe')](_0xc778('0x1f'),_0x49a567,JSON[_0xc778('0x10')](_0x575ac0));_0x5e0849(_0x575ac0);})[_0xc778('0x15')](function(_0x2941e1){logger['error'](_0xc778('0x1f'),_0x2941e1['message'],_0x49a567);_0x72b334(_0x4ab049[_0xc778('0x11')](0x1f4,_0x2941e1[_0xc778('0x13')]));});});};exports[_0xc778('0x20')]=function(_0x15a949){var _0xadc0df=this;return new Promise(function(_0x565d8,_0x149c42){return db[_0xc778('0x16')]['find']({'raw':_0x15a949['options']?_0x15a949[_0xc778('0x18')][_0xc778('0x21')]===undefined?!![]:![]:!![],'where':_0x15a949[_0xc778('0x18')]?_0x15a949['options']['where']||null:null,'attributes':_0x15a949[_0xc778('0x18')]?_0x15a949[_0xc778('0x18')]['attributes']||null:null,'include':_0x15a949['options']?_0x15a949[_0xc778('0x18')][_0xc778('0x1c')]?_[_0xc778('0x1d')](_0x15a949['options']['include'],function(_0x37bb6e){return{'model':db[_0x37bb6e[_0xc778('0x1e')]],'as':_0x37bb6e['as'],'attributes':_0x37bb6e['attributes'],'include':_0x37bb6e['include']?_[_0xc778('0x1d')](_0x37bb6e['include'],function(_0x47b907){return{'model':db[_0x47b907[_0xc778('0x1e')]],'as':_0x47b907['as'],'attributes':_0x47b907[_0xc778('0x1a')],'include':_0x47b907[_0xc778('0x1c')]?_[_0xc778('0x1d')](_0x47b907['include'],function(_0x3b4aa5){return{'model':db[_0x3b4aa5[_0xc778('0x1e')]],'as':_0x3b4aa5['as'],'attributes':_0x3b4aa5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c5254){logger[_0xc778('0xb')](_0xc778('0x20'),_0x15a949);logger[_0xc778('0xe')](_0xc778('0x20'),_0x15a949,JSON[_0xc778('0x10')](_0x5c5254));_0x565d8(_0x5c5254);})['catch'](function(_0x30acf3){logger[_0xc778('0x11')](_0xc778('0x20'),_0x30acf3[_0xc778('0x13')],_0x15a949);_0x149c42(_0xadc0df[_0xc778('0x11')](0x1f4,_0x30acf3['message']));});});}; \ No newline at end of file +var _0x81d9=['ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','SalesforceAccount','findAll','options','raw','where','attributes','limit','map','include','model','GetSalesforceAccount','ShowSalesforceAccount','lodash','util','moment','bluebird'];(function(_0x40ff4d,_0x72c2dd){var _0xc6b831=function(_0x22cec6){while(--_0x22cec6){_0x40ff4d['push'](_0x40ff4d['shift']());}};_0xc6b831(++_0x72c2dd);}(_0x81d9,0x146));var _0x981d=function(_0x4b83f5,_0x5b3289){_0x4b83f5=_0x4b83f5-0x0;var _0x5917e6=_0x81d9[_0x4b83f5];return _0x5917e6;};'use strict';var _=require(_0x981d('0x0'));var util=require(_0x981d('0x1'));var moment=require(_0x981d('0x2'));var BPromise=require(_0x981d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x981d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x981d('0x5'));var logger=require('../../config/logger')(_0x981d('0x6'));var config=require('../../config/environment');var jayson=require(_0x981d('0x7'));var client=jayson[_0x981d('0x8')][_0x981d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c476d,_0x5a259b,_0x28a5dd){return new BPromise(function(_0x59071c,_0x40c61d){return client[_0x981d('0xa')](_0x5c476d,_0x28a5dd)[_0x981d('0xb')](function(_0x307710){logger[_0x981d('0xc')](_0x981d('0xd'),_0x5a259b,_0x981d('0xe'));logger[_0x981d('0xf')](_0x981d('0x10'),_0x5a259b,_0x981d('0xe'),JSON[_0x981d('0x11')](_0x307710));if(_0x307710[_0x981d('0x12')]){if(_0x307710[_0x981d('0x12')]['code']===0x1f4){logger[_0x981d('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x5a259b,_0x307710[_0x981d('0x12')][_0x981d('0x13')]);return _0x40c61d(_0x307710[_0x981d('0x12')][_0x981d('0x13')]);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x5a259b,_0x307710[_0x981d('0x12')][_0x981d('0x13')]);return _0x59071c(_0x307710['error'][_0x981d('0x13')]);}else{logger[_0x981d('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x5a259b,'request\x20sent');_0x59071c(_0x307710['result'][_0x981d('0x13')]);}})[_0x981d('0x14')](function(_0x45301a){logger[_0x981d('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x5a259b,_0x45301a);_0x40c61d(_0x45301a);});});}exports['GetSalesforceAccount']=function(_0x436334){var _0x591e69=this;return new Promise(function(_0x1a0138,_0x4faac3){return db[_0x981d('0x15')][_0x981d('0x16')]({'raw':_0x436334['options']?_0x436334[_0x981d('0x17')][_0x981d('0x18')]===undefined?!![]:![]:!![],'where':_0x436334['options']?_0x436334['options'][_0x981d('0x19')]||null:null,'attributes':_0x436334[_0x981d('0x17')]?_0x436334[_0x981d('0x17')][_0x981d('0x1a')]||null:null,'limit':_0x436334[_0x981d('0x17')]?_0x436334['options'][_0x981d('0x1b')]||null:null,'include':_0x436334[_0x981d('0x17')]?_0x436334[_0x981d('0x17')]['include']?_[_0x981d('0x1c')](_0x436334['options'][_0x981d('0x1d')],function(_0x2b8b20){return{'model':db[_0x2b8b20[_0x981d('0x1e')]],'as':_0x2b8b20['as'],'attributes':_0x2b8b20[_0x981d('0x1a')],'include':_0x2b8b20['include']?_[_0x981d('0x1c')](_0x2b8b20[_0x981d('0x1d')],function(_0x34bf8b){return{'model':db[_0x34bf8b[_0x981d('0x1e')]],'as':_0x34bf8b['as'],'attributes':_0x34bf8b[_0x981d('0x1a')],'include':_0x34bf8b[_0x981d('0x1d')]?_[_0x981d('0x1c')](_0x34bf8b['include'],function(_0x1b75f5){return{'model':db[_0x1b75f5[_0x981d('0x1e')]],'as':_0x1b75f5['as'],'attributes':_0x1b75f5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x37b68b){logger[_0x981d('0xc')](_0x981d('0x1f'),_0x436334);logger[_0x981d('0xf')]('GetSalesforceAccount',_0x436334,JSON[_0x981d('0x11')](_0x37b68b));_0x1a0138(_0x37b68b);})[_0x981d('0x14')](function(_0x1df87d){logger[_0x981d('0x12')](_0x981d('0x1f'),_0x1df87d[_0x981d('0x13')],_0x436334);_0x4faac3(_0x591e69[_0x981d('0x12')](0x1f4,_0x1df87d['message']));});});};exports[_0x981d('0x20')]=function(_0xf6b9e4){var _0x468fd2=this;return new Promise(function(_0x3596c1,_0x5ea43b){return db[_0x981d('0x15')]['find']({'raw':_0xf6b9e4[_0x981d('0x17')]?_0xf6b9e4[_0x981d('0x17')][_0x981d('0x18')]===undefined?!![]:![]:!![],'where':_0xf6b9e4['options']?_0xf6b9e4['options'][_0x981d('0x19')]||null:null,'attributes':_0xf6b9e4['options']?_0xf6b9e4[_0x981d('0x17')][_0x981d('0x1a')]||null:null,'include':_0xf6b9e4['options']?_0xf6b9e4['options'][_0x981d('0x1d')]?_[_0x981d('0x1c')](_0xf6b9e4[_0x981d('0x17')][_0x981d('0x1d')],function(_0x87acd2){return{'model':db[_0x87acd2[_0x981d('0x1e')]],'as':_0x87acd2['as'],'attributes':_0x87acd2[_0x981d('0x1a')],'include':_0x87acd2[_0x981d('0x1d')]?_[_0x981d('0x1c')](_0x87acd2['include'],function(_0x532af1){return{'model':db[_0x532af1['model']],'as':_0x532af1['as'],'attributes':_0x532af1[_0x981d('0x1a')],'include':_0x532af1['include']?_[_0x981d('0x1c')](_0x532af1[_0x981d('0x1d')],function(_0x280d66){return{'model':db[_0x280d66[_0x981d('0x1e')]],'as':_0x280d66['as'],'attributes':_0x280d66[_0x981d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x981d('0xb')](function(_0x360404){logger[_0x981d('0xc')]('ShowSalesforceAccount',_0xf6b9e4);logger['debug'](_0x981d('0x20'),_0xf6b9e4,JSON[_0x981d('0x11')](_0x360404));_0x3596c1(_0x360404);})['catch'](function(_0x2144e6){logger[_0x981d('0x12')](_0x981d('0x20'),_0x2144e6[_0x981d('0x13')],_0xf6b9e4);_0x5ea43b(_0x468fd2[_0x981d('0x12')](0x1f4,_0x2144e6[_0x981d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 2f4140e..537e8fc 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x4573b3,_0x48ce53){var _0xb843ff=function(_0x53cc02){while(--_0x53cc02){_0x4573b3['push'](_0x4573b3['shift']());}};_0xb843ff(++_0x48ce53);}(_0x2ef3,0xba));var _0x32ef=function(_0x5dc3bd,_0x55af44){_0x5dc3bd=_0x5dc3bd-0x0;var _0x11dd8a=_0x2ef3[_0x5dc3bd];return _0x11dd8a;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file +var _0x2032=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','exports','util','path','connect-timeout'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2032,0xd9));var _0x2203=function(_0x8737b1,_0x1bdeb2){_0x8737b1=_0x8737b1-0x0;var _0x23702b=_0x2032[_0x8737b1];return _0x23702b;};'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/fields',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['get'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router['get'](_0x2203('0x10'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);router['post']('/',auth[_0x2203('0x9')](),controller[_0x2203('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x2203('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x2203('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index b0f8651..47990f6 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 _0x96ca=['exports','STRING','ENUM','Task','Case','contact','account_contact_lead','account','contact_lead','lead','sequelize'];(function(_0x256c49,_0x53f00a){var _0x280282=function(_0x1455c1){while(--_0x1455c1){_0x256c49['push'](_0x256c49['shift']());}};_0x280282(++_0x53f00a);}(_0x96ca,0xf1));var _0xa96c=function(_0x4c71f0,_0x52151f){_0x4c71f0=_0x4c71f0-0x0;var _0x2ceb53=_0x96ca[_0x4c71f0];return _0x2ceb53;};'use strict';var Sequelize=require(_0xa96c('0x0'));module[_0xa96c('0x1')]={'name':{'type':Sequelize[_0xa96c('0x2')]},'description':{'type':Sequelize[_0xa96c('0x2')]},'ticketType':{'type':Sequelize[_0xa96c('0x3')](_0xa96c('0x4'),_0xa96c('0x5')),'defaultValue':_0xa96c('0x4')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0xa96c('0x6'),'lead',_0xa96c('0x7'),_0xa96c('0x8')),'defaultValue':_0xa96c('0x9')},'moduleCreate':{'type':Sequelize[_0xa96c('0x3')]('nothing',_0xa96c('0x6'),_0xa96c('0xa'),_0xa96c('0x8')),'defaultValue':_0xa96c('0xa')},'leadId':{'type':Sequelize[_0xa96c('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xa96c('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xa96c('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xa96c('0x2')]}}; \ No newline at end of file +var _0x13e3=['STRING','Task','Case','ENUM','contact','lead','account_contact_lead','account','contact_lead','nothing'];(function(_0x1bb0b8,_0x24add2){var _0x22fc67=function(_0x2e051d){while(--_0x2e051d){_0x1bb0b8['push'](_0x1bb0b8['shift']());}};_0x22fc67(++_0x24add2);}(_0x13e3,0x6e));var _0x313e=function(_0x31b5a5,_0x44376a){_0x31b5a5=_0x31b5a5-0x0;var _0x364cc9=_0x13e3[_0x31b5a5];return _0x364cc9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x313e('0x0')]},'description':{'type':Sequelize[_0x313e('0x0')]},'ticketType':{'type':Sequelize['ENUM'](_0x313e('0x1'),_0x313e('0x2')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x313e('0x3')]('contact_lead',_0x313e('0x4'),_0x313e('0x5'),_0x313e('0x6'),_0x313e('0x7')),'defaultValue':_0x313e('0x8')},'moduleCreate':{'type':Sequelize[_0x313e('0x3')](_0x313e('0x9'),_0x313e('0x4'),'lead','account'),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x313e('0x0')]},'additionalSearchAccount':{'type':Sequelize[_0x313e('0x0')]},'additionalSearchContact':{'type':Sequelize[_0x313e('0x0')]},'additionalSearchLead':{'type':Sequelize[_0x313e('0x0')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 5fb57d1..36f8ae1 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 _0x7c22=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','getFields','findOne','SalesforceField','pick','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','index','SalesforceConfiguration','rawAttributes','fieldName','type','key','map','query','filters'];(function(_0x12a612,_0x2a147e){var _0x20eea8=function(_0x1745b3){while(--_0x1745b3){_0x12a612['push'](_0x12a612['shift']());}};_0x20eea8(++_0x2a147e);}(_0x7c22,0x6c));var _0x27c2=function(_0xbaf433,_0x30ea39){_0xbaf433=_0xbaf433-0x0;var _0x24193a=_0x7c22[_0xbaf433];return _0x24193a;};'use strict';var emlformat=require(_0x27c2('0x0'));var rimraf=require(_0x27c2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x27c2('0x2'));var rp=require(_0x27c2('0x3'));var moment=require('moment');var BPromise=require(_0x27c2('0x4'));var Mustache=require(_0x27c2('0x5'));var util=require('util');var path=require('path');var sox=require(_0x27c2('0x6'));var csv=require('to-csv');var ejs=require(_0x27c2('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x27c2('0x8'));var squel=require(_0x27c2('0x9'));var crypto=require('crypto');var jsforce=require(_0x27c2('0xa'));var deskjs=require(_0x27c2('0xb'));var toCsv=require(_0x27c2('0xc'));var querystring=require(_0x27c2('0xd'));var Papa=require(_0x27c2('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x27c2('0xf'));var as=require(_0x27c2('0x10'));var hardwareService=require(_0x27c2('0x11'));var logger=require(_0x27c2('0x12'))('api');var utils=require(_0x27c2('0x13'));var config=require(_0x27c2('0x14'));var licenseUtil=require(_0x27c2('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c654a,_0x23a6ed){_0x23a6ed=_0x23a6ed||0xcc;return function(_0x3a8d1f){if(_0x3a8d1f){return _0x4c654a[_0x27c2('0x16')](_0x23a6ed);}return _0x4c654a[_0x27c2('0x17')](_0x23a6ed)[_0x27c2('0x18')]();};}function respondWithResult(_0x599589,_0xa704c2){_0xa704c2=_0xa704c2||0xc8;return function(_0x4db64a){if(_0x4db64a){return _0x599589[_0x27c2('0x17')](_0xa704c2)[_0x27c2('0x19')](_0x4db64a);}};}function respondWithFilteredResult(_0x333db1,_0x2e2193){return function(_0x49241e){if(_0x49241e){var _0x272038=typeof _0x2e2193[_0x27c2('0x1a')]===_0x27c2('0x1b')&&typeof _0x2e2193[_0x27c2('0x1c')]===_0x27c2('0x1b');var _0x2db0b6=_0x49241e[_0x27c2('0x1d')];var _0x2daee4=_0x272038?0x0:_0x2e2193[_0x27c2('0x1a')];var _0x5f197c=_0x272038?_0x49241e[_0x27c2('0x1d')]:_0x2e2193[_0x27c2('0x1a')]+_0x2e2193[_0x27c2('0x1c')];var _0x824e60;if(_0x5f197c>=_0x2db0b6){_0x5f197c=_0x2db0b6;_0x824e60=0xc8;}else{_0x824e60=0xce;}_0x333db1['status'](_0x824e60);return _0x333db1['set'](_0x27c2('0x1e'),_0x2daee4+'-'+_0x5f197c+'/'+_0x2db0b6)[_0x27c2('0x19')](_0x49241e);}return null;};}function patchUpdates(_0x25136d){return function(_0x282cdb){try{jsonpatch[_0x27c2('0x1f')](_0x282cdb,_0x25136d,!![]);}catch(_0x9f380){return BPromise['reject'](_0x9f380);}return _0x282cdb[_0x27c2('0x20')]();};}function saveUpdates(_0x111287,_0x38e982){return function(_0x136a63){if(_0x136a63){return _0x136a63[_0x27c2('0x21')](_0x111287)[_0x27c2('0x22')](function(_0x311cd2){return _0x311cd2;});}return null;};}function removeEntity(_0xb9af7f,_0x52ecc5){return function(_0x58ffa6){if(_0x58ffa6){return _0x58ffa6[_0x27c2('0x23')]()[_0x27c2('0x22')](function(){_0xb9af7f['status'](0xcc)[_0x27c2('0x18')]();});}};}function handleEntityNotFound(_0x66bf45,_0x21ccb2){return function(_0x1cf775){if(!_0x1cf775){_0x66bf45['sendStatus'](0x194);}return _0x1cf775;};}function handleError(_0x3e7563,_0x2d9974){_0x2d9974=_0x2d9974||0x1f4;return function(_0x3d2338){logger[_0x27c2('0x24')](_0x3d2338[_0x27c2('0x25')]);if(_0x3d2338[_0x27c2('0x26')]){delete _0x3d2338[_0x27c2('0x26')];}_0x3e7563[_0x27c2('0x17')](_0x2d9974)['send'](_0x3d2338);};}exports[_0x27c2('0x27')]=function(_0x3c13a1,_0x54b061){var _0x48ef72={},_0xeeba0b={},_0x34cf90={'count':0x0,'rows':[]};var _0x2b0b3=_['map'](db[_0x27c2('0x28')][_0x27c2('0x29')],function(_0x2768a6){return{'name':_0x2768a6[_0x27c2('0x2a')],'type':_0x2768a6[_0x27c2('0x2b')][_0x27c2('0x2c')]};});_0xeeba0b['model']=_[_0x27c2('0x2d')](_0x2b0b3,_0x27c2('0x26'));_0xeeba0b[_0x27c2('0x2e')]=_['keys'](_0x3c13a1[_0x27c2('0x2e')]);_0xeeba0b[_0x27c2('0x2f')]=_[_0x27c2('0x30')](_0xeeba0b[_0x27c2('0x31')],_0xeeba0b['query']);_0x48ef72[_0x27c2('0x32')]=_[_0x27c2('0x30')](_0xeeba0b[_0x27c2('0x31')],qs[_0x27c2('0x33')](_0x3c13a1[_0x27c2('0x2e')][_0x27c2('0x33')]));_0x48ef72[_0x27c2('0x32')]=_0x48ef72[_0x27c2('0x32')][_0x27c2('0x34')]?_0x48ef72['attributes']:_0xeeba0b[_0x27c2('0x31')];if(!_0x3c13a1[_0x27c2('0x2e')][_0x27c2('0x35')](_0x27c2('0x36'))){_0x48ef72[_0x27c2('0x1c')]=qs['limit'](_0x3c13a1[_0x27c2('0x2e')][_0x27c2('0x1c')]);_0x48ef72[_0x27c2('0x1a')]=qs[_0x27c2('0x1a')](_0x3c13a1['query'][_0x27c2('0x1a')]);}_0x48ef72[_0x27c2('0x37')]=qs[_0x27c2('0x38')](_0x3c13a1[_0x27c2('0x2e')][_0x27c2('0x38')]);_0x48ef72[_0x27c2('0x39')]=qs[_0x27c2('0x2f')](_['pick'](_0x3c13a1[_0x27c2('0x2e')],_0xeeba0b[_0x27c2('0x2f')]),_0x2b0b3);if(_0x3c13a1['query'][_0x27c2('0x3a')]){_0x48ef72[_0x27c2('0x39')]=_[_0x27c2('0x3b')](_0x48ef72['where'],{'$or':_[_0x27c2('0x2d')](_0x2b0b3,function(_0x303ace){if(_0x303ace[_0x27c2('0x2b')]!==_0x27c2('0x3c')){var _0x3075e5={};_0x3075e5[_0x303ace['name']]={'$like':'%'+_0x3c13a1[_0x27c2('0x2e')]['filter']+'%'};return _0x3075e5;}})});}_0x48ef72=_[_0x27c2('0x3b')]({},_0x48ef72,_0x3c13a1[_0x27c2('0x3d')]);var _0x2363df={'where':_0x48ef72[_0x27c2('0x39')]};return db[_0x27c2('0x28')][_0x27c2('0x1d')](_0x2363df)['then'](function(_0x19f1d6){_0x34cf90[_0x27c2('0x1d')]=_0x19f1d6;if(_0x3c13a1['query'][_0x27c2('0x3e')]){_0x48ef72[_0x27c2('0x3f')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x27c2('0x40')](_0x48ef72);})[_0x27c2('0x22')](function(_0x57dcb2){_0x34cf90[_0x27c2('0x41')]=_0x57dcb2;return _0x34cf90;})[_0x27c2('0x22')](respondWithFilteredResult(_0x54b061,_0x48ef72))[_0x27c2('0x42')](handleError(_0x54b061,null));};exports['show']=function(_0x32b088,_0xd44965){var _0x30e13e={'raw':![],'where':{'id':_0x32b088[_0x27c2('0x43')]['id']}},_0x26546c={};_0x26546c[_0x27c2('0x31')]=_['keys'](db['SalesforceConfiguration'][_0x27c2('0x29')]);_0x26546c[_0x27c2('0x2e')]=_[_0x27c2('0x44')](_0x32b088[_0x27c2('0x2e')]);_0x26546c['filters']=_[_0x27c2('0x30')](_0x26546c[_0x27c2('0x31')],_0x26546c[_0x27c2('0x2e')]);_0x30e13e[_0x27c2('0x32')]=_['intersection'](_0x26546c[_0x27c2('0x31')],qs[_0x27c2('0x33')](_0x32b088[_0x27c2('0x2e')]['fields']));_0x30e13e['attributes']=_0x30e13e[_0x27c2('0x32')]['length']?_0x30e13e[_0x27c2('0x32')]:_0x26546c[_0x27c2('0x31')];if(_0x32b088[_0x27c2('0x2e')][_0x27c2('0x3e')]){_0x30e13e[_0x27c2('0x3f')]=[{'all':!![]}];}_0x30e13e=_['merge']({},_0x30e13e,_0x32b088['options']);return db[_0x27c2('0x28')][_0x27c2('0x45')](_0x30e13e)[_0x27c2('0x22')](handleEntityNotFound(_0xd44965,null))[_0x27c2('0x22')](respondWithResult(_0xd44965,null))[_0x27c2('0x42')](handleError(_0xd44965,null));};exports['create']=function(_0x5eae01,_0x31bee2){return db[_0x27c2('0x28')][_0x27c2('0x46')](_0x5eae01[_0x27c2('0x47')],{})[_0x27c2('0x22')](respondWithResult(_0x31bee2,0xc9))['catch'](handleError(_0x31bee2,null));};exports[_0x27c2('0x21')]=function(_0xa6fdea,_0x3bbd25){if(_0xa6fdea[_0x27c2('0x47')]['id']){delete _0xa6fdea[_0x27c2('0x47')]['id'];}return db[_0x27c2('0x28')]['find']({'where':{'id':_0xa6fdea[_0x27c2('0x43')]['id']}})[_0x27c2('0x22')](handleEntityNotFound(_0x3bbd25,null))[_0x27c2('0x22')](saveUpdates(_0xa6fdea['body'],null))[_0x27c2('0x22')](respondWithResult(_0x3bbd25,null))[_0x27c2('0x42')](handleError(_0x3bbd25,null));};exports[_0x27c2('0x23')]=function(_0x5a3c00,_0x11068b){return db[_0x27c2('0x28')][_0x27c2('0x45')]({'where':{'id':_0x5a3c00[_0x27c2('0x43')]['id']}})[_0x27c2('0x22')](handleEntityNotFound(_0x11068b,null))[_0x27c2('0x22')](removeEntity(_0x11068b,null))[_0x27c2('0x42')](handleError(_0x11068b,null));};exports[_0x27c2('0x48')]=function(_0x4a4248,_0x2ffa99,_0x36e705){var _0x5b633d={};var _0x29f1de={};var _0x26057e;var _0x394f75;return db['SalesforceConfiguration'][_0x27c2('0x49')]({'where':{'id':_0x4a4248[_0x27c2('0x43')]['id']}})[_0x27c2('0x22')](handleEntityNotFound(_0x2ffa99,null))[_0x27c2('0x22')](function(_0x17a9d7){if(_0x17a9d7){_0x26057e=_0x17a9d7;_0x29f1de['model']=_['keys'](db[_0x27c2('0x4a')]['rawAttributes']);_0x29f1de[_0x27c2('0x2e')]=_[_0x27c2('0x44')](_0x4a4248[_0x27c2('0x2e')]);_0x29f1de[_0x27c2('0x2f')]=_[_0x27c2('0x30')](_0x29f1de[_0x27c2('0x31')],_0x29f1de[_0x27c2('0x2e')]);_0x5b633d[_0x27c2('0x32')]=_['intersection'](_0x29f1de[_0x27c2('0x31')],qs[_0x27c2('0x33')](_0x4a4248['query']['fields']));_0x5b633d['attributes']=_0x5b633d['attributes'][_0x27c2('0x34')]?_0x5b633d[_0x27c2('0x32')]:_0x29f1de[_0x27c2('0x31')];_0x5b633d['order']=qs[_0x27c2('0x38')](_0x4a4248[_0x27c2('0x2e')]['sort']);_0x5b633d[_0x27c2('0x39')]=qs[_0x27c2('0x2f')](_[_0x27c2('0x4b')](_0x4a4248[_0x27c2('0x2e')],_0x29f1de[_0x27c2('0x2f')]));if(_0x4a4248['query'][_0x27c2('0x3a')]){_0x5b633d['where']=_[_0x27c2('0x3b')](_0x5b633d[_0x27c2('0x39')],{'$or':_[_0x27c2('0x2d')](_0x5b633d[_0x27c2('0x32')],function(_0x205cbc){var _0x471dee={};_0x471dee[_0x205cbc]={'$like':'%'+_0x4a4248[_0x27c2('0x2e')][_0x27c2('0x3a')]+'%'};return _0x471dee;})});}_0x5b633d=_[_0x27c2('0x3b')]({},_0x5b633d,_0x4a4248[_0x27c2('0x3d')]);return _0x26057e['getFields'](_0x5b633d);}})[_0x27c2('0x22')](function(_0x24a59b){if(_0x24a59b){_0x394f75=_0x24a59b[_0x27c2('0x34')];if(!_0x4a4248[_0x27c2('0x2e')][_0x27c2('0x35')](_0x27c2('0x36'))){_0x5b633d[_0x27c2('0x1c')]=qs['limit'](_0x4a4248['query'][_0x27c2('0x1c')]);_0x5b633d[_0x27c2('0x1a')]=qs[_0x27c2('0x1a')](_0x4a4248[_0x27c2('0x2e')][_0x27c2('0x1a')]);}return _0x26057e['getFields'](_0x5b633d);}})['then'](function(_0x20a84e){if(_0x20a84e){return _0x20a84e?{'count':_0x394f75,'rows':_0x20a84e}:null;}})[_0x27c2('0x22')](respondWithResult(_0x2ffa99,null))[_0x27c2('0x42')](handleError(_0x2ffa99,null));};exports[_0x27c2('0x4c')]=function(_0x6fee14,_0x1aa3d3,_0x68a60a){var _0x4a5bb2={};var _0x11eb06={};var _0x4d445e;var _0x8bef8a;return db[_0x27c2('0x28')][_0x27c2('0x49')]({'where':{'id':_0x6fee14['params']['id']}})[_0x27c2('0x22')](handleEntityNotFound(_0x1aa3d3,null))[_0x27c2('0x22')](function(_0x33a918){if(_0x33a918){_0x4d445e=_0x33a918;_0x11eb06[_0x27c2('0x31')]=_['keys'](db[_0x27c2('0x4a')][_0x27c2('0x29')]);_0x11eb06['query']=_[_0x27c2('0x44')](_0x6fee14[_0x27c2('0x2e')]);_0x11eb06[_0x27c2('0x2f')]=_[_0x27c2('0x30')](_0x11eb06[_0x27c2('0x31')],_0x11eb06[_0x27c2('0x2e')]);_0x4a5bb2[_0x27c2('0x32')]=_[_0x27c2('0x30')](_0x11eb06['model'],qs[_0x27c2('0x33')](_0x6fee14[_0x27c2('0x2e')][_0x27c2('0x33')]));_0x4a5bb2[_0x27c2('0x32')]=_0x4a5bb2[_0x27c2('0x32')]['length']?_0x4a5bb2[_0x27c2('0x32')]:_0x11eb06['model'];_0x4a5bb2[_0x27c2('0x37')]=qs[_0x27c2('0x38')](_0x6fee14[_0x27c2('0x2e')][_0x27c2('0x38')]);_0x4a5bb2[_0x27c2('0x39')]=qs[_0x27c2('0x2f')](_['pick'](_0x6fee14[_0x27c2('0x2e')],_0x11eb06[_0x27c2('0x2f')]));if(_0x6fee14[_0x27c2('0x2e')][_0x27c2('0x3a')]){_0x4a5bb2['where']=_[_0x27c2('0x3b')](_0x4a5bb2['where'],{'$or':_[_0x27c2('0x2d')](_0x4a5bb2[_0x27c2('0x32')],function(_0x5283ca){var _0x31343c={};_0x31343c[_0x5283ca]={'$like':'%'+_0x6fee14[_0x27c2('0x2e')][_0x27c2('0x3a')]+'%'};return _0x31343c;})});}_0x4a5bb2=_[_0x27c2('0x3b')]({},_0x4a5bb2,_0x6fee14[_0x27c2('0x3d')]);return _0x4d445e[_0x27c2('0x4c')](_0x4a5bb2);}})[_0x27c2('0x22')](function(_0x235ca7){if(_0x235ca7){_0x8bef8a=_0x235ca7[_0x27c2('0x34')];if(!_0x6fee14['query'][_0x27c2('0x35')]('nolimit')){_0x4a5bb2[_0x27c2('0x1c')]=qs[_0x27c2('0x1c')](_0x6fee14['query'][_0x27c2('0x1c')]);_0x4a5bb2[_0x27c2('0x1a')]=qs[_0x27c2('0x1a')](_0x6fee14['query'][_0x27c2('0x1a')]);}return _0x4d445e['getSubjects'](_0x4a5bb2);}})[_0x27c2('0x22')](function(_0x39721f){if(_0x39721f){return _0x39721f?{'count':_0x8bef8a,'rows':_0x39721f}:null;}})['then'](respondWithResult(_0x1aa3d3,null))[_0x27c2('0x42')](handleError(_0x1aa3d3,null));};exports[_0x27c2('0x4d')]=function(_0x79e594,_0x127a5d,_0x511c1e){var _0x5e2f9c={};var _0x12b6fd={};var _0x3c52fd;var _0x5ec488;return db[_0x27c2('0x28')][_0x27c2('0x49')]({'where':{'id':_0x79e594[_0x27c2('0x43')]['id']}})[_0x27c2('0x22')](handleEntityNotFound(_0x127a5d,null))['then'](function(_0x396ac3){if(_0x396ac3){_0x3c52fd=_0x396ac3;_0x12b6fd[_0x27c2('0x31')]=_['keys'](db['SalesforceField'][_0x27c2('0x29')]);_0x12b6fd[_0x27c2('0x2e')]=_[_0x27c2('0x44')](_0x79e594['query']);_0x12b6fd[_0x27c2('0x2f')]=_[_0x27c2('0x30')](_0x12b6fd[_0x27c2('0x31')],_0x12b6fd['query']);_0x5e2f9c['attributes']=_[_0x27c2('0x30')](_0x12b6fd['model'],qs[_0x27c2('0x33')](_0x79e594[_0x27c2('0x2e')]['fields']));_0x5e2f9c['attributes']=_0x5e2f9c[_0x27c2('0x32')]['length']?_0x5e2f9c[_0x27c2('0x32')]:_0x12b6fd[_0x27c2('0x31')];_0x5e2f9c[_0x27c2('0x37')]=qs[_0x27c2('0x38')](_0x79e594[_0x27c2('0x2e')][_0x27c2('0x38')]);_0x5e2f9c['where']=qs[_0x27c2('0x2f')](_[_0x27c2('0x4b')](_0x79e594[_0x27c2('0x2e')],_0x12b6fd[_0x27c2('0x2f')]));if(_0x79e594[_0x27c2('0x2e')][_0x27c2('0x3a')]){_0x5e2f9c[_0x27c2('0x39')]=_[_0x27c2('0x3b')](_0x5e2f9c[_0x27c2('0x39')],{'$or':_['map'](_0x5e2f9c[_0x27c2('0x32')],function(_0x1a792f){var _0x43592e={};_0x43592e[_0x1a792f]={'$like':'%'+_0x79e594[_0x27c2('0x2e')][_0x27c2('0x3a')]+'%'};return _0x43592e;})});}_0x5e2f9c=_[_0x27c2('0x3b')]({},_0x5e2f9c,_0x79e594[_0x27c2('0x3d')]);return _0x3c52fd[_0x27c2('0x4d')](_0x5e2f9c);}})[_0x27c2('0x22')](function(_0xf7a022){if(_0xf7a022){_0x5ec488=_0xf7a022['length'];if(!_0x79e594[_0x27c2('0x2e')][_0x27c2('0x35')]('nolimit')){_0x5e2f9c[_0x27c2('0x1c')]=qs['limit'](_0x79e594[_0x27c2('0x2e')][_0x27c2('0x1c')]);_0x5e2f9c['offset']=qs[_0x27c2('0x1a')](_0x79e594[_0x27c2('0x2e')][_0x27c2('0x1a')]);}return _0x3c52fd[_0x27c2('0x4d')](_0x5e2f9c);}})['then'](function(_0x3cb698){if(_0x3cb698){return _0x3cb698?{'count':_0x5ec488,'rows':_0x3cb698}:null;}})[_0x27c2('0x22')](respondWithResult(_0x127a5d,null))['catch'](handleError(_0x127a5d,null));}; \ No newline at end of file +var _0x0694=['ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','then','destroy','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','intersection','fields','options','find','create','update','body','findOne','getFields','SalesforceField','getSubjects','nolimit','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv'];(function(_0x45aed4,_0x45d212){var _0x4b1cd0=function(_0x137571){while(--_0x137571){_0x45aed4['push'](_0x45aed4['shift']());}};_0x4b1cd0(++_0x45d212);}(_0x0694,0x183));var _0x4069=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x0694[_0xbe200f];return _0x192597;};'use strict';var emlformat=require(_0x4069('0x0'));var rimraf=require(_0x4069('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4069('0x2'));var rp=require(_0x4069('0x3'));var moment=require('moment');var BPromise=require(_0x4069('0x4'));var Mustache=require(_0x4069('0x5'));var util=require('util');var path=require('path');var sox=require(_0x4069('0x6'));var csv=require(_0x4069('0x7'));var ejs=require(_0x4069('0x8'));var fs=require('fs');var fs_extra=require(_0x4069('0x9'));var _=require('lodash');var squel=require(_0x4069('0xa'));var crypto=require(_0x4069('0xb'));var jsforce=require(_0x4069('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4069('0xd'));var Papa=require(_0x4069('0xe'));var Redis=require('ioredis');var authService=require(_0x4069('0xf'));var qs=require(_0x4069('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4069('0x11'));var logger=require(_0x4069('0x12'))(_0x4069('0x13'));var utils=require(_0x4069('0x14'));var config=require(_0x4069('0x15'));var licenseUtil=require(_0x4069('0x16'));var db=require(_0x4069('0x17'))['db'];function respondWithStatusCode(_0x21e7b7,_0x45aeb1){_0x45aeb1=_0x45aeb1||0xcc;return function(_0x1321f3){if(_0x1321f3){return _0x21e7b7[_0x4069('0x18')](_0x45aeb1);}return _0x21e7b7[_0x4069('0x19')](_0x45aeb1)[_0x4069('0x1a')]();};}function respondWithResult(_0x131cba,_0x4d35fd){_0x4d35fd=_0x4d35fd||0xc8;return function(_0x476889){if(_0x476889){return _0x131cba[_0x4069('0x19')](_0x4d35fd)[_0x4069('0x1b')](_0x476889);}};}function respondWithFilteredResult(_0x215ce7,_0x4e82fc){return function(_0x1d5f81){if(_0x1d5f81){var _0x15323d=typeof _0x4e82fc[_0x4069('0x1c')]==='undefined'&&typeof _0x4e82fc[_0x4069('0x1d')]===_0x4069('0x1e');var _0x351782=_0x1d5f81['count'];var _0x3ed37e=_0x15323d?0x0:_0x4e82fc[_0x4069('0x1c')];var _0x24ab91=_0x15323d?_0x1d5f81[_0x4069('0x1f')]:_0x4e82fc[_0x4069('0x1c')]+_0x4e82fc['limit'];var _0x57567f;if(_0x24ab91>=_0x351782){_0x24ab91=_0x351782;_0x57567f=0xc8;}else{_0x57567f=0xce;}_0x215ce7[_0x4069('0x19')](_0x57567f);return _0x215ce7['set'](_0x4069('0x20'),_0x3ed37e+'-'+_0x24ab91+'/'+_0x351782)[_0x4069('0x1b')](_0x1d5f81);}return null;};}function patchUpdates(_0x38c29c){return function(_0x284585){try{jsonpatch[_0x4069('0x21')](_0x284585,_0x38c29c,!![]);}catch(_0x496fe3){return BPromise['reject'](_0x496fe3);}return _0x284585[_0x4069('0x22')]();};}function saveUpdates(_0x49532a,_0x859439){return function(_0x35a1d5){if(_0x35a1d5){return _0x35a1d5['update'](_0x49532a)[_0x4069('0x23')](function(_0x5ba7dc){return _0x5ba7dc;});}return null;};}function removeEntity(_0x5d84d8,_0x34a71b){return function(_0x524b68){if(_0x524b68){return _0x524b68[_0x4069('0x24')]()[_0x4069('0x23')](function(){_0x5d84d8[_0x4069('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29527c,_0x434eb6){return function(_0x2639a2){if(!_0x2639a2){_0x29527c['sendStatus'](0x194);}return _0x2639a2;};}function handleError(_0x4713a9,_0x572b9a){_0x572b9a=_0x572b9a||0x1f4;return function(_0x2ff5ca){logger['error'](_0x2ff5ca['stack']);if(_0x2ff5ca['name']){delete _0x2ff5ca[_0x4069('0x25')];}_0x4713a9['status'](_0x572b9a)[_0x4069('0x26')](_0x2ff5ca);};}exports[_0x4069('0x27')]=function(_0x6405c5,_0x17c83f){var _0x13087c={},_0x3e2c2e={},_0x5bc872={'count':0x0,'rows':[]};var _0x43c382=_[_0x4069('0x28')](db[_0x4069('0x29')][_0x4069('0x2a')],function(_0x52cb87){return{'name':_0x52cb87[_0x4069('0x2b')],'type':_0x52cb87[_0x4069('0x2c')]['key']};});_0x3e2c2e[_0x4069('0x2d')]=_[_0x4069('0x28')](_0x43c382,_0x4069('0x25'));_0x3e2c2e[_0x4069('0x2e')]=_[_0x4069('0x2f')](_0x6405c5['query']);_0x3e2c2e[_0x4069('0x30')]=_['intersection'](_0x3e2c2e[_0x4069('0x2d')],_0x3e2c2e[_0x4069('0x2e')]);_0x13087c['attributes']=_['intersection'](_0x3e2c2e[_0x4069('0x2d')],qs['fields'](_0x6405c5[_0x4069('0x2e')]['fields']));_0x13087c['attributes']=_0x13087c[_0x4069('0x31')][_0x4069('0x32')]?_0x13087c[_0x4069('0x31')]:_0x3e2c2e[_0x4069('0x2d')];if(!_0x6405c5[_0x4069('0x2e')][_0x4069('0x33')]('nolimit')){_0x13087c[_0x4069('0x1d')]=qs['limit'](_0x6405c5[_0x4069('0x2e')][_0x4069('0x1d')]);_0x13087c['offset']=qs[_0x4069('0x1c')](_0x6405c5[_0x4069('0x2e')][_0x4069('0x1c')]);}_0x13087c[_0x4069('0x34')]=qs[_0x4069('0x35')](_0x6405c5[_0x4069('0x2e')][_0x4069('0x35')]);_0x13087c[_0x4069('0x36')]=qs[_0x4069('0x30')](_[_0x4069('0x37')](_0x6405c5[_0x4069('0x2e')],_0x3e2c2e[_0x4069('0x30')]),_0x43c382);if(_0x6405c5['query'][_0x4069('0x38')]){_0x13087c[_0x4069('0x36')]=_[_0x4069('0x39')](_0x13087c[_0x4069('0x36')],{'$or':_[_0x4069('0x28')](_0x43c382,function(_0x53c78c){if(_0x53c78c['type']!==_0x4069('0x3a')){var _0x527470={};_0x527470[_0x53c78c['name']]={'$like':'%'+_0x6405c5[_0x4069('0x2e')][_0x4069('0x38')]+'%'};return _0x527470;}})});}_0x13087c=_[_0x4069('0x39')]({},_0x13087c,_0x6405c5['options']);var _0x3e78ed={'where':_0x13087c[_0x4069('0x36')]};return db[_0x4069('0x29')][_0x4069('0x1f')](_0x3e78ed)['then'](function(_0x4a6aaa){_0x5bc872[_0x4069('0x1f')]=_0x4a6aaa;if(_0x6405c5[_0x4069('0x2e')][_0x4069('0x3b')]){_0x13087c[_0x4069('0x3c')]=[{'all':!![]}];}return db[_0x4069('0x29')][_0x4069('0x3d')](_0x13087c);})[_0x4069('0x23')](function(_0x1522d1){_0x5bc872[_0x4069('0x3e')]=_0x1522d1;return _0x5bc872;})['then'](respondWithFilteredResult(_0x17c83f,_0x13087c))[_0x4069('0x3f')](handleError(_0x17c83f,null));};exports[_0x4069('0x40')]=function(_0x14f898,_0x88b782){var _0x5d2d4f={'raw':![],'where':{'id':_0x14f898[_0x4069('0x41')]['id']}},_0x53295b={};_0x53295b[_0x4069('0x2d')]=_[_0x4069('0x2f')](db['SalesforceConfiguration']['rawAttributes']);_0x53295b['query']=_['keys'](_0x14f898['query']);_0x53295b[_0x4069('0x30')]=_[_0x4069('0x42')](_0x53295b[_0x4069('0x2d')],_0x53295b['query']);_0x5d2d4f['attributes']=_[_0x4069('0x42')](_0x53295b[_0x4069('0x2d')],qs[_0x4069('0x43')](_0x14f898['query'][_0x4069('0x43')]));_0x5d2d4f[_0x4069('0x31')]=_0x5d2d4f[_0x4069('0x31')][_0x4069('0x32')]?_0x5d2d4f[_0x4069('0x31')]:_0x53295b[_0x4069('0x2d')];if(_0x14f898['query']['includeAll']){_0x5d2d4f['include']=[{'all':!![]}];}_0x5d2d4f=_[_0x4069('0x39')]({},_0x5d2d4f,_0x14f898[_0x4069('0x44')]);return db[_0x4069('0x29')][_0x4069('0x45')](_0x5d2d4f)[_0x4069('0x23')](handleEntityNotFound(_0x88b782,null))[_0x4069('0x23')](respondWithResult(_0x88b782,null))['catch'](handleError(_0x88b782,null));};exports[_0x4069('0x46')]=function(_0x3c6f07,_0x54e96b){return db[_0x4069('0x29')][_0x4069('0x46')](_0x3c6f07['body'],{})[_0x4069('0x23')](respondWithResult(_0x54e96b,0xc9))[_0x4069('0x3f')](handleError(_0x54e96b,null));};exports[_0x4069('0x47')]=function(_0x161589,_0x14000d){if(_0x161589[_0x4069('0x48')]['id']){delete _0x161589[_0x4069('0x48')]['id'];}return db['SalesforceConfiguration'][_0x4069('0x45')]({'where':{'id':_0x161589[_0x4069('0x41')]['id']}})[_0x4069('0x23')](handleEntityNotFound(_0x14000d,null))[_0x4069('0x23')](saveUpdates(_0x161589['body'],null))[_0x4069('0x23')](respondWithResult(_0x14000d,null))['catch'](handleError(_0x14000d,null));};exports[_0x4069('0x24')]=function(_0x5915cf,_0x12f350){return db[_0x4069('0x29')][_0x4069('0x45')]({'where':{'id':_0x5915cf[_0x4069('0x41')]['id']}})[_0x4069('0x23')](handleEntityNotFound(_0x12f350,null))[_0x4069('0x23')](removeEntity(_0x12f350,null))[_0x4069('0x3f')](handleError(_0x12f350,null));};exports['getFields']=function(_0x217c92,_0x18a137,_0x38bdfc){var _0x1ef2f2={};var _0x29c898={};var _0x2f5dce;var _0xf03798;return db['SalesforceConfiguration'][_0x4069('0x49')]({'where':{'id':_0x217c92[_0x4069('0x41')]['id']}})['then'](handleEntityNotFound(_0x18a137,null))['then'](function(_0x4ae680){if(_0x4ae680){_0x2f5dce=_0x4ae680;_0x29c898[_0x4069('0x2d')]=_[_0x4069('0x2f')](db['SalesforceField'][_0x4069('0x2a')]);_0x29c898[_0x4069('0x2e')]=_[_0x4069('0x2f')](_0x217c92[_0x4069('0x2e')]);_0x29c898[_0x4069('0x30')]=_[_0x4069('0x42')](_0x29c898[_0x4069('0x2d')],_0x29c898['query']);_0x1ef2f2[_0x4069('0x31')]=_['intersection'](_0x29c898[_0x4069('0x2d')],qs[_0x4069('0x43')](_0x217c92[_0x4069('0x2e')]['fields']));_0x1ef2f2[_0x4069('0x31')]=_0x1ef2f2[_0x4069('0x31')][_0x4069('0x32')]?_0x1ef2f2[_0x4069('0x31')]:_0x29c898['model'];_0x1ef2f2[_0x4069('0x34')]=qs[_0x4069('0x35')](_0x217c92[_0x4069('0x2e')][_0x4069('0x35')]);_0x1ef2f2[_0x4069('0x36')]=qs[_0x4069('0x30')](_['pick'](_0x217c92[_0x4069('0x2e')],_0x29c898[_0x4069('0x30')]));if(_0x217c92[_0x4069('0x2e')][_0x4069('0x38')]){_0x1ef2f2['where']=_['merge'](_0x1ef2f2['where'],{'$or':_['map'](_0x1ef2f2[_0x4069('0x31')],function(_0x4f16f9){var _0x1b6285={};_0x1b6285[_0x4f16f9]={'$like':'%'+_0x217c92[_0x4069('0x2e')][_0x4069('0x38')]+'%'};return _0x1b6285;})});}_0x1ef2f2=_[_0x4069('0x39')]({},_0x1ef2f2,_0x217c92[_0x4069('0x44')]);return _0x2f5dce[_0x4069('0x4a')](_0x1ef2f2);}})['then'](function(_0x33c429){if(_0x33c429){_0xf03798=_0x33c429[_0x4069('0x32')];if(!_0x217c92[_0x4069('0x2e')][_0x4069('0x33')]('nolimit')){_0x1ef2f2['limit']=qs['limit'](_0x217c92[_0x4069('0x2e')][_0x4069('0x1d')]);_0x1ef2f2[_0x4069('0x1c')]=qs[_0x4069('0x1c')](_0x217c92[_0x4069('0x2e')][_0x4069('0x1c')]);}return _0x2f5dce['getFields'](_0x1ef2f2);}})['then'](function(_0xad6563){if(_0xad6563){return _0xad6563?{'count':_0xf03798,'rows':_0xad6563}:null;}})[_0x4069('0x23')](respondWithResult(_0x18a137,null))[_0x4069('0x3f')](handleError(_0x18a137,null));};exports['getSubjects']=function(_0x2e1c54,_0x48918b,_0x2610e6){var _0x31e601={};var _0x37aa4f={};var _0x1b119d;var _0x481ee5;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x2e1c54[_0x4069('0x41')]['id']}})[_0x4069('0x23')](handleEntityNotFound(_0x48918b,null))[_0x4069('0x23')](function(_0x17ca5f){if(_0x17ca5f){_0x1b119d=_0x17ca5f;_0x37aa4f[_0x4069('0x2d')]=_[_0x4069('0x2f')](db[_0x4069('0x4b')][_0x4069('0x2a')]);_0x37aa4f[_0x4069('0x2e')]=_[_0x4069('0x2f')](_0x2e1c54[_0x4069('0x2e')]);_0x37aa4f['filters']=_[_0x4069('0x42')](_0x37aa4f[_0x4069('0x2d')],_0x37aa4f['query']);_0x31e601[_0x4069('0x31')]=_[_0x4069('0x42')](_0x37aa4f[_0x4069('0x2d')],qs[_0x4069('0x43')](_0x2e1c54[_0x4069('0x2e')]['fields']));_0x31e601[_0x4069('0x31')]=_0x31e601[_0x4069('0x31')]['length']?_0x31e601['attributes']:_0x37aa4f[_0x4069('0x2d')];_0x31e601[_0x4069('0x34')]=qs[_0x4069('0x35')](_0x2e1c54[_0x4069('0x2e')][_0x4069('0x35')]);_0x31e601['where']=qs['filters'](_[_0x4069('0x37')](_0x2e1c54['query'],_0x37aa4f[_0x4069('0x30')]));if(_0x2e1c54[_0x4069('0x2e')][_0x4069('0x38')]){_0x31e601['where']=_[_0x4069('0x39')](_0x31e601[_0x4069('0x36')],{'$or':_[_0x4069('0x28')](_0x31e601[_0x4069('0x31')],function(_0x226abf){var _0xd6cb96={};_0xd6cb96[_0x226abf]={'$like':'%'+_0x2e1c54[_0x4069('0x2e')][_0x4069('0x38')]+'%'};return _0xd6cb96;})});}_0x31e601=_[_0x4069('0x39')]({},_0x31e601,_0x2e1c54[_0x4069('0x44')]);return _0x1b119d[_0x4069('0x4c')](_0x31e601);}})[_0x4069('0x23')](function(_0x4184a8){if(_0x4184a8){_0x481ee5=_0x4184a8[_0x4069('0x32')];if(!_0x2e1c54[_0x4069('0x2e')][_0x4069('0x33')](_0x4069('0x4d'))){_0x31e601[_0x4069('0x1d')]=qs[_0x4069('0x1d')](_0x2e1c54[_0x4069('0x2e')]['limit']);_0x31e601[_0x4069('0x1c')]=qs[_0x4069('0x1c')](_0x2e1c54[_0x4069('0x2e')][_0x4069('0x1c')]);}return _0x1b119d[_0x4069('0x4c')](_0x31e601);}})[_0x4069('0x23')](function(_0x2a64a3){if(_0x2a64a3){return _0x2a64a3?{'count':_0x481ee5,'rows':_0x2a64a3}:null;}})[_0x4069('0x23')](respondWithResult(_0x48918b,null))['catch'](handleError(_0x48918b,null));};exports[_0x4069('0x4e')]=function(_0x3e03cd,_0x1be820,_0x6507b2){var _0x272595={};var _0x3178fe={};var _0x50c72e;var _0x3f31f6;return db[_0x4069('0x29')]['findOne']({'where':{'id':_0x3e03cd[_0x4069('0x41')]['id']}})[_0x4069('0x23')](handleEntityNotFound(_0x1be820,null))[_0x4069('0x23')](function(_0x464a0b){if(_0x464a0b){_0x50c72e=_0x464a0b;_0x3178fe[_0x4069('0x2d')]=_[_0x4069('0x2f')](db[_0x4069('0x4b')][_0x4069('0x2a')]);_0x3178fe['query']=_[_0x4069('0x2f')](_0x3e03cd[_0x4069('0x2e')]);_0x3178fe[_0x4069('0x30')]=_[_0x4069('0x42')](_0x3178fe[_0x4069('0x2d')],_0x3178fe['query']);_0x272595[_0x4069('0x31')]=_[_0x4069('0x42')](_0x3178fe['model'],qs[_0x4069('0x43')](_0x3e03cd[_0x4069('0x2e')]['fields']));_0x272595['attributes']=_0x272595[_0x4069('0x31')][_0x4069('0x32')]?_0x272595[_0x4069('0x31')]:_0x3178fe[_0x4069('0x2d')];_0x272595[_0x4069('0x34')]=qs[_0x4069('0x35')](_0x3e03cd[_0x4069('0x2e')][_0x4069('0x35')]);_0x272595['where']=qs[_0x4069('0x30')](_[_0x4069('0x37')](_0x3e03cd['query'],_0x3178fe['filters']));if(_0x3e03cd[_0x4069('0x2e')]['filter']){_0x272595[_0x4069('0x36')]=_[_0x4069('0x39')](_0x272595['where'],{'$or':_[_0x4069('0x28')](_0x272595[_0x4069('0x31')],function(_0x1079e4){var _0x1cc368={};_0x1cc368[_0x1079e4]={'$like':'%'+_0x3e03cd[_0x4069('0x2e')]['filter']+'%'};return _0x1cc368;})});}_0x272595=_[_0x4069('0x39')]({},_0x272595,_0x3e03cd[_0x4069('0x44')]);return _0x50c72e[_0x4069('0x4e')](_0x272595);}})[_0x4069('0x23')](function(_0x22d376){if(_0x22d376){_0x3f31f6=_0x22d376[_0x4069('0x32')];if(!_0x3e03cd['query'][_0x4069('0x33')](_0x4069('0x4d'))){_0x272595[_0x4069('0x1d')]=qs[_0x4069('0x1d')](_0x3e03cd[_0x4069('0x2e')]['limit']);_0x272595[_0x4069('0x1c')]=qs[_0x4069('0x1c')](_0x3e03cd[_0x4069('0x2e')][_0x4069('0x1c')]);}return _0x50c72e[_0x4069('0x4e')](_0x272595);}})[_0x4069('0x23')](function(_0x4d6489){if(_0x4d6489){return _0x4d6489?{'count':_0x3f31f6,'rows':_0x4d6489}:null;}})[_0x4069('0x23')](respondWithResult(_0x1be820,null))[_0x4069('0x3f')](handleError(_0x1be820,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index df736b5..9a71305 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 _0x3568=['moment','request-promise','rimraf','../../config/environment','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api'];(function(_0x525b28,_0x5cf5a0){var _0x180178=function(_0x43e066){while(--_0x43e066){_0x525b28['push'](_0x525b28['shift']());}};_0x180178(++_0x5cf5a0);}(_0x3568,0x193));var _0x8356=function(_0xbccbb2,_0x1b0cb4){_0xbccbb2=_0xbccbb2-0x0;var _0x3e0523=_0x3568[_0xbccbb2];return _0x3e0523;};'use strict';var _=require(_0x8356('0x0'));var util=require(_0x8356('0x1'));var logger=require(_0x8356('0x2'))(_0x8356('0x3'));var moment=require(_0x8356('0x4'));var BPromise=require('bluebird');var rp=require(_0x8356('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8356('0x6'));var config=require(_0x8356('0x7'));var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0x4bcb9f,_0xa0bbee){return _0x4bcb9f[_0x8356('0x8')](_0x8356('0x9'),attributes,{'tableName':_0x8356('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc0e3=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define'];(function(_0x2da1d1,_0x2f44eb){var _0x3d534e=function(_0x48b0aa){while(--_0x48b0aa){_0x2da1d1['push'](_0x2da1d1['shift']());}};_0x3d534e(++_0x2f44eb);}(_0xc0e3,0x1d9));var _0x3c0e=function(_0x229532,_0x1c0e67){_0x229532=_0x229532-0x0;var _0x598c8a=_0xc0e3[_0x229532];return _0x598c8a;};'use strict';var _=require(_0x3c0e('0x0'));var util=require(_0x3c0e('0x1'));var logger=require(_0x3c0e('0x2'))(_0x3c0e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3c0e('0x4'));var fs=require('fs');var path=require(_0x3c0e('0x5'));var rimraf=require(_0x3c0e('0x6'));var config=require(_0x3c0e('0x7'));var attributes=require(_0x3c0e('0x8'));module[_0x3c0e('0x9')]=function(_0x42867c,_0x508fe9){return _0x42867c[_0x3c0e('0xa')]('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index dff6aa1..2d1e95f 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 _0x04cc=['../../config/logger','../../config/environment','client','request','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5c431e,_0x410cef){var _0xcd3453=function(_0x3fa165){while(--_0x3fa165){_0x5c431e['push'](_0x5c431e['shift']());}};_0xcd3453(++_0x410cef);}(_0x04cc,0x138));var _0xc04c=function(_0x23e346,_0x2ffc96){_0x23e346=_0x23e346-0x0;var _0x58fd5a=_0x04cc[_0x23e346];return _0x58fd5a;};'use strict';var _=require(_0xc04c('0x0'));var util=require(_0xc04c('0x1'));var moment=require(_0xc04c('0x2'));var BPromise=require(_0xc04c('0x3'));var rs=require(_0xc04c('0x4'));var fs=require('fs');var Redis=require(_0xc04c('0x5'));var db=require(_0xc04c('0x6'))['db'];var utils=require(_0xc04c('0x7'));var logger=require(_0xc04c('0x8'))('rpc');var config=require(_0xc04c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc04c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fd9ff,_0x51a2cc,_0x5353b9){return new BPromise(function(_0x8548de,_0x502497){return client[_0xc04c('0xb')](_0x4fd9ff,_0x5353b9)['then'](function(_0xb615ac){logger['info'](_0xc04c('0xc'),_0x51a2cc,_0xc04c('0xd'));logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x51a2cc,_0xc04c('0xd'),JSON[_0xc04c('0xe')](_0xb615ac));if(_0xb615ac[_0xc04c('0xf')]){if(_0xb615ac[_0xc04c('0xf')]['code']===0x1f4){logger[_0xc04c('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x51a2cc,_0xb615ac[_0xc04c('0xf')][_0xc04c('0x10')]);return _0x502497(_0xb615ac[_0xc04c('0xf')][_0xc04c('0x10')]);}logger['error'](_0xc04c('0xc'),_0x51a2cc,_0xb615ac['error'][_0xc04c('0x10')]);return _0x8548de(_0xb615ac['error'][_0xc04c('0x10')]);}else{logger[_0xc04c('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x51a2cc,_0xc04c('0xd'));_0x8548de(_0xb615ac[_0xc04c('0x12')][_0xc04c('0x10')]);}})[_0xc04c('0x13')](function(_0x2c932e){logger[_0xc04c('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x51a2cc,_0x2c932e);_0x502497(_0x2c932e);});});} \ No newline at end of file +var _0x9bf0=['util','moment','bluebird','../../config/utils','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x295314,_0x17b250){var _0x584b0c=function(_0x51cc84){while(--_0x51cc84){_0x295314['push'](_0x295314['shift']());}};_0x584b0c(++_0x17b250);}(_0x9bf0,0x18f));var _0x09bf=function(_0x2d9c6a,_0x59393d){_0x2d9c6a=_0x2d9c6a-0x0;var _0xf3c918=_0x9bf0[_0x2d9c6a];return _0xf3c918;};'use strict';var _=require(_0x09bf('0x0'));var util=require(_0x09bf('0x1'));var moment=require(_0x09bf('0x2'));var BPromise=require(_0x09bf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x09bf('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x09bf('0x5'));var jayson=require(_0x09bf('0x6'));var client=jayson[_0x09bf('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5456bb,_0x4b643d,_0x38b401){return new BPromise(function(_0x2050aa,_0x3c444d){return client[_0x09bf('0x8')](_0x5456bb,_0x38b401)['then'](function(_0x3df074){logger[_0x09bf('0x9')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4b643d,_0x09bf('0xa'));logger[_0x09bf('0xb')](_0x09bf('0xc'),_0x4b643d,_0x09bf('0xa'),JSON[_0x09bf('0xd')](_0x3df074));if(_0x3df074[_0x09bf('0xe')]){if(_0x3df074[_0x09bf('0xe')][_0x09bf('0xf')]===0x1f4){logger[_0x09bf('0xe')](_0x09bf('0x10'),_0x4b643d,_0x3df074[_0x09bf('0xe')][_0x09bf('0x11')]);return _0x3c444d(_0x3df074[_0x09bf('0xe')][_0x09bf('0x11')]);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x4b643d,_0x3df074[_0x09bf('0xe')]['message']);return _0x2050aa(_0x3df074[_0x09bf('0xe')][_0x09bf('0x11')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x4b643d,_0x09bf('0xa'));_0x2050aa(_0x3df074[_0x09bf('0x12')][_0x09bf('0x11')]);}})[_0x09bf('0x13')](function(_0x5d2024){logger[_0x09bf('0xe')](_0x09bf('0x10'),_0x4b643d,_0x5d2024);_0x3c444d(_0x5d2024);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index a8389e7..192500e 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 _0x5443=['express','Router','../../components/auth/service','../../config/environment','./intSalesforceField.controller','get','index','/:id','isAuthenticated','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5443,0x81));var _0x3544=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x5443[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x3544('0x0'));var util=require(_0x3544('0x1'));var path=require(_0x3544('0x2'));var timeout=require(_0x3544('0x3'));var express=require(_0x3544('0x4'));var router=express[_0x3544('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3544('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3544('0x7'));var controller=require(_0x3544('0x8'));router[_0x3544('0x9')]('/',auth['isAuthenticated'](),controller[_0x3544('0xa')]);router['get'](_0x3544('0xb'),auth[_0x3544('0xc')](),controller[_0x3544('0xd')]);router['post']('/',auth[_0x3544('0xc')](),controller[_0x3544('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x3544('0xf')]);router[_0x3544('0x10')](_0x3544('0xb'),auth[_0x3544('0xc')](),controller[_0x3544('0x11')]);module[_0x3544('0x12')]=router; \ No newline at end of file +var _0x0903=['destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated','/:id','create','put','update','delete'];(function(_0x222c49,_0x1e8a56){var _0x540de7=function(_0x5c9ec9){while(--_0x5c9ec9){_0x222c49['push'](_0x222c49['shift']());}};_0x540de7(++_0x1e8a56);}(_0x0903,0x1ab));var _0x3090=function(_0xb7f071,_0x34134a){_0xb7f071=_0xb7f071-0x0;var _0xdc2c6d=_0x0903[_0xb7f071];return _0xdc2c6d;};'use strict';var multer=require(_0x3090('0x0'));var util=require('util');var path=require(_0x3090('0x1'));var timeout=require(_0x3090('0x2'));var express=require('express');var router=express[_0x3090('0x3')]();var fs_extra=require(_0x3090('0x4'));var auth=require(_0x3090('0x5'));var interaction=require(_0x3090('0x6'));var config=require('../../config/environment');var controller=require(_0x3090('0x7'));router[_0x3090('0x8')]('/',auth[_0x3090('0x9')](),controller['index']);router[_0x3090('0x8')](_0x3090('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x3090('0x9')](),controller[_0x3090('0xb')]);router[_0x3090('0xc')](_0x3090('0xa'),auth[_0x3090('0x9')](),controller[_0x3090('0xd')]);router[_0x3090('0xe')](_0x3090('0xa'),auth[_0x3090('0x9')](),controller[_0x3090('0xf')]);module[_0x3090('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index d3b22e2..51eee9f 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 _0x25a2=['STRING','ENUM','variable','sequelize','exports','customVariable','keyValue','picklist','string'];(function(_0x3fc6b0,_0x1b44fa){var _0x71b2bc=function(_0x329e4c){while(--_0x329e4c){_0x3fc6b0['push'](_0x3fc6b0['shift']());}};_0x71b2bc(++_0x1b44fa);}(_0x25a2,0x1e0));var _0x225a=function(_0x1a7d23,_0x1d8a94){_0x1a7d23=_0x1a7d23-0x0;var _0x91fb2a=_0x25a2[_0x1a7d23];return _0x91fb2a;};'use strict';var Sequelize=require(_0x225a('0x0'));module[_0x225a('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0x225a('0x2'),_0x225a('0x3'),_0x225a('0x4')),'defaultValue':_0x225a('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x225a('0x6')]},'keyType':{'type':Sequelize[_0x225a('0x7')](_0x225a('0x5'),_0x225a('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0x225a('0x6')]},'idField':{'type':Sequelize[_0x225a('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xca05=['sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x55e37a,_0x322f60){var _0x736d59=function(_0x2de212){while(--_0x2de212){_0x55e37a['push'](_0x55e37a['shift']());}};_0x736d59(++_0x322f60);}(_0xca05,0x170));var _0x5ca0=function(_0x7729b1,_0x468322){_0x7729b1=_0x7729b1-0x0;var _0x349504=_0xca05[_0x7729b1];return _0x349504;};'use strict';var Sequelize=require(_0x5ca0('0x0'));module[_0x5ca0('0x1')]={'type':{'type':Sequelize['ENUM'](_0x5ca0('0x2'),_0x5ca0('0x3'),_0x5ca0('0x4'),_0x5ca0('0x5'),_0x5ca0('0x6')),'defaultValue':_0x5ca0('0x2')},'content':{'type':Sequelize[_0x5ca0('0x7')]},'key':{'type':Sequelize[_0x5ca0('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x5ca0('0x2'),'variable',_0x5ca0('0x4'))},'keyContent':{'type':Sequelize[_0x5ca0('0x7')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x5ca0('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index a8da7df..5ec8d0d 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 _0x634e=['rawAttributes','fieldName','key','model','map','keys','filters','intersection','query','attributes','fields','order','sort','pick','filter','where','merge','type','VIRTUAL','rows','catch','show','params','length','includeAll','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','stack','name','send','index','SalesforceField'];(function(_0x4503df,_0xfec122){var _0x3f1b2b=function(_0x32b1de){while(--_0x32b1de){_0x4503df['push'](_0x4503df['shift']());}};_0x3f1b2b(++_0xfec122);}(_0x634e,0x151));var _0xe634=function(_0x25b4a4,_0x2e081b){_0x25b4a4=_0x25b4a4-0x0;var _0x707267=_0x634e[_0x25b4a4];return _0x707267;};'use strict';var emlformat=require(_0xe634('0x0'));var rimraf=require(_0xe634('0x1'));var zipdir=require(_0xe634('0x2'));var jsonpatch=require(_0xe634('0x3'));var rp=require(_0xe634('0x4'));var moment=require('moment');var BPromise=require(_0xe634('0x5'));var Mustache=require(_0xe634('0x6'));var util=require(_0xe634('0x7'));var path=require(_0xe634('0x8'));var sox=require(_0xe634('0x9'));var csv=require(_0xe634('0xa'));var ejs=require(_0xe634('0xb'));var fs=require('fs');var fs_extra=require(_0xe634('0xc'));var _=require(_0xe634('0xd'));var squel=require(_0xe634('0xe'));var crypto=require(_0xe634('0xf'));var jsforce=require(_0xe634('0x10'));var deskjs=require(_0xe634('0x11'));var toCsv=require(_0xe634('0xa'));var querystring=require(_0xe634('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe634('0x13'));var qs=require(_0xe634('0x14'));var as=require(_0xe634('0x15'));var hardwareService=require(_0xe634('0x16'));var logger=require(_0xe634('0x17'))(_0xe634('0x18'));var utils=require(_0xe634('0x19'));var config=require(_0xe634('0x1a'));var licenseUtil=require(_0xe634('0x1b'));var db=require(_0xe634('0x1c'))['db'];function respondWithStatusCode(_0x15b4b4,_0x348f89){_0x348f89=_0x348f89||0xcc;return function(_0x152ec4){if(_0x152ec4){return _0x15b4b4[_0xe634('0x1d')](_0x348f89);}return _0x15b4b4['status'](_0x348f89)[_0xe634('0x1e')]();};}function respondWithResult(_0x10f727,_0x187bac){_0x187bac=_0x187bac||0xc8;return function(_0x5dc2fa){if(_0x5dc2fa){return _0x10f727[_0xe634('0x1f')](_0x187bac)[_0xe634('0x20')](_0x5dc2fa);}};}function respondWithFilteredResult(_0xe7a5d4,_0x5160a8){return function(_0x2a3361){if(_0x2a3361){var _0x71dac6=typeof _0x5160a8[_0xe634('0x21')]===_0xe634('0x22')&&typeof _0x5160a8[_0xe634('0x23')]===_0xe634('0x22');var _0x8e7221=_0x2a3361['count'];var _0x2ec459=_0x71dac6?0x0:_0x5160a8[_0xe634('0x21')];var _0x10c807=_0x71dac6?_0x2a3361[_0xe634('0x24')]:_0x5160a8[_0xe634('0x21')]+_0x5160a8['limit'];var _0x25c889;if(_0x10c807>=_0x8e7221){_0x10c807=_0x8e7221;_0x25c889=0xc8;}else{_0x25c889=0xce;}_0xe7a5d4[_0xe634('0x1f')](_0x25c889);return _0xe7a5d4[_0xe634('0x25')]('Content-Range',_0x2ec459+'-'+_0x10c807+'/'+_0x8e7221)[_0xe634('0x20')](_0x2a3361);}return null;};}function patchUpdates(_0x4ff400){return function(_0x3bbeb7){try{jsonpatch[_0xe634('0x26')](_0x3bbeb7,_0x4ff400,!![]);}catch(_0x3cf8b4){return BPromise[_0xe634('0x27')](_0x3cf8b4);}return _0x3bbeb7[_0xe634('0x28')]();};}function saveUpdates(_0x29ee3c,_0x293964){return function(_0x5e7081){if(_0x5e7081){return _0x5e7081[_0xe634('0x29')](_0x29ee3c)[_0xe634('0x2a')](function(_0x5f3998){return _0x5f3998;});}return null;};}function removeEntity(_0x481b4e,_0x5d6525){return function(_0x1213e3){if(_0x1213e3){return _0x1213e3['destroy']()['then'](function(){_0x481b4e[_0xe634('0x1f')](0xcc)[_0xe634('0x1e')]();});}};}function handleEntityNotFound(_0x33d93f,_0x54c691){return function(_0x34f896){if(!_0x34f896){_0x33d93f[_0xe634('0x1d')](0x194);}return _0x34f896;};}function handleError(_0x15c6ed,_0x37c508){_0x37c508=_0x37c508||0x1f4;return function(_0x3a582f){logger['error'](_0x3a582f[_0xe634('0x2b')]);if(_0x3a582f[_0xe634('0x2c')]){delete _0x3a582f['name'];}_0x15c6ed[_0xe634('0x1f')](_0x37c508)[_0xe634('0x2d')](_0x3a582f);};}exports[_0xe634('0x2e')]=function(_0x10998d,_0x1ef83c){var _0x8da8e5={},_0x12f5df={},_0x500aeb={'count':0x0,'rows':[]};var _0x9867ae=_['map'](db[_0xe634('0x2f')][_0xe634('0x30')],function(_0x412012){return{'name':_0x412012[_0xe634('0x31')],'type':_0x412012['type'][_0xe634('0x32')]};});_0x12f5df[_0xe634('0x33')]=_[_0xe634('0x34')](_0x9867ae,_0xe634('0x2c'));_0x12f5df['query']=_[_0xe634('0x35')](_0x10998d['query']);_0x12f5df[_0xe634('0x36')]=_[_0xe634('0x37')](_0x12f5df[_0xe634('0x33')],_0x12f5df[_0xe634('0x38')]);_0x8da8e5[_0xe634('0x39')]=_[_0xe634('0x37')](_0x12f5df[_0xe634('0x33')],qs['fields'](_0x10998d[_0xe634('0x38')][_0xe634('0x3a')]));_0x8da8e5[_0xe634('0x39')]=_0x8da8e5[_0xe634('0x39')]['length']?_0x8da8e5['attributes']:_0x12f5df[_0xe634('0x33')];if(!_0x10998d['query']['hasOwnProperty']('nolimit')){_0x8da8e5[_0xe634('0x23')]=qs['limit'](_0x10998d['query'][_0xe634('0x23')]);_0x8da8e5[_0xe634('0x21')]=qs[_0xe634('0x21')](_0x10998d['query']['offset']);}_0x8da8e5[_0xe634('0x3b')]=qs[_0xe634('0x3c')](_0x10998d[_0xe634('0x38')]['sort']);_0x8da8e5['where']=qs[_0xe634('0x36')](_[_0xe634('0x3d')](_0x10998d['query'],_0x12f5df[_0xe634('0x36')]),_0x9867ae);if(_0x10998d[_0xe634('0x38')][_0xe634('0x3e')]){_0x8da8e5[_0xe634('0x3f')]=_[_0xe634('0x40')](_0x8da8e5[_0xe634('0x3f')],{'$or':_[_0xe634('0x34')](_0x9867ae,function(_0x56a21d){if(_0x56a21d[_0xe634('0x41')]!==_0xe634('0x42')){var _0x1f1553={};_0x1f1553[_0x56a21d[_0xe634('0x2c')]]={'$like':'%'+_0x10998d['query'][_0xe634('0x3e')]+'%'};return _0x1f1553;}})});}_0x8da8e5=_[_0xe634('0x40')]({},_0x8da8e5,_0x10998d['options']);var _0x3c90ba={'where':_0x8da8e5[_0xe634('0x3f')]};return db[_0xe634('0x2f')][_0xe634('0x24')](_0x3c90ba)['then'](function(_0x2cb94f){_0x500aeb[_0xe634('0x24')]=_0x2cb94f;if(_0x10998d['query']['includeAll']){_0x8da8e5['include']=[{'all':!![]}];}return db['SalesforceField']['findAll'](_0x8da8e5);})[_0xe634('0x2a')](function(_0x5ad5c1){_0x500aeb[_0xe634('0x43')]=_0x5ad5c1;return _0x500aeb;})['then'](respondWithFilteredResult(_0x1ef83c,_0x8da8e5))[_0xe634('0x44')](handleError(_0x1ef83c,null));};exports[_0xe634('0x45')]=function(_0x2b03cc,_0x1ca319){var _0x1cd3e8={'raw':!![],'where':{'id':_0x2b03cc[_0xe634('0x46')]['id']}},_0x31090c={};_0x31090c[_0xe634('0x33')]=_[_0xe634('0x35')](db[_0xe634('0x2f')][_0xe634('0x30')]);_0x31090c['query']=_[_0xe634('0x35')](_0x2b03cc[_0xe634('0x38')]);_0x31090c[_0xe634('0x36')]=_[_0xe634('0x37')](_0x31090c[_0xe634('0x33')],_0x31090c[_0xe634('0x38')]);_0x1cd3e8[_0xe634('0x39')]=_[_0xe634('0x37')](_0x31090c[_0xe634('0x33')],qs[_0xe634('0x3a')](_0x2b03cc[_0xe634('0x38')]['fields']));_0x1cd3e8['attributes']=_0x1cd3e8[_0xe634('0x39')][_0xe634('0x47')]?_0x1cd3e8[_0xe634('0x39')]:_0x31090c[_0xe634('0x33')];if(_0x2b03cc['query'][_0xe634('0x48')]){_0x1cd3e8['include']=[{'all':!![]}];}_0x1cd3e8=_['merge']({},_0x1cd3e8,_0x2b03cc['options']);return db[_0xe634('0x2f')][_0xe634('0x49')](_0x1cd3e8)[_0xe634('0x2a')](handleEntityNotFound(_0x1ca319,null))[_0xe634('0x2a')](respondWithResult(_0x1ca319,null))['catch'](handleError(_0x1ca319,null));};exports[_0xe634('0x4a')]=function(_0x4f859e,_0x439606){return db[_0xe634('0x2f')][_0xe634('0x4a')](_0x4f859e[_0xe634('0x4b')],{})[_0xe634('0x2a')](respondWithResult(_0x439606,0xc9))[_0xe634('0x44')](handleError(_0x439606,null));};exports[_0xe634('0x29')]=function(_0x960f26,_0x5d42d4){if(_0x960f26[_0xe634('0x4b')]['id']){delete _0x960f26[_0xe634('0x4b')]['id'];}return db[_0xe634('0x2f')][_0xe634('0x49')]({'where':{'id':_0x960f26[_0xe634('0x46')]['id']}})[_0xe634('0x2a')](handleEntityNotFound(_0x5d42d4,null))[_0xe634('0x2a')](saveUpdates(_0x960f26[_0xe634('0x4b')],null))[_0xe634('0x2a')](respondWithResult(_0x5d42d4,null))['catch'](handleError(_0x5d42d4,null));};exports[_0xe634('0x4c')]=function(_0x31985e,_0x4f2b94){return db['SalesforceField'][_0xe634('0x49')]({'where':{'id':_0x31985e[_0xe634('0x46')]['id']}})[_0xe634('0x2a')](handleEntityNotFound(_0x4f2b94,null))[_0xe634('0x2a')](removeEntity(_0x4f2b94,null))['catch'](handleError(_0x4f2b94,null));}; \ No newline at end of file +var _0x3ff2=['where','type','VIRTUAL','includeAll','include','SalesforceField','findAll','rows','catch','params','options','create','body','find','rimraf','zip-dir','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter'];(function(_0x236654,_0x16e44f){var _0x27653b=function(_0x2d227c){while(--_0x2d227c){_0x236654['push'](_0x236654['shift']());}};_0x27653b(++_0x16e44f);}(_0x3ff2,0xa6));var _0x23ff=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3ff2[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x23ff('0x0'));var zipdir=require(_0x23ff('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x23ff('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x23ff('0x3'));var path=require(_0x23ff('0x4'));var sox=require(_0x23ff('0x5'));var csv=require(_0x23ff('0x6'));var ejs=require(_0x23ff('0x7'));var fs=require('fs');var fs_extra=require(_0x23ff('0x8'));var _=require(_0x23ff('0x9'));var squel=require(_0x23ff('0xa'));var crypto=require(_0x23ff('0xb'));var jsforce=require(_0x23ff('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x23ff('0x6'));var querystring=require(_0x23ff('0xd'));var Papa=require(_0x23ff('0xe'));var Redis=require(_0x23ff('0xf'));var authService=require(_0x23ff('0x10'));var qs=require(_0x23ff('0x11'));var as=require(_0x23ff('0x12'));var hardwareService=require(_0x23ff('0x13'));var logger=require(_0x23ff('0x14'))(_0x23ff('0x15'));var utils=require(_0x23ff('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x23ff('0x17'));var db=require(_0x23ff('0x18'))['db'];function respondWithStatusCode(_0x3741d7,_0x4a9291){_0x4a9291=_0x4a9291||0xcc;return function(_0x5196dc){if(_0x5196dc){return _0x3741d7[_0x23ff('0x19')](_0x4a9291);}return _0x3741d7['status'](_0x4a9291)['end']();};}function respondWithResult(_0x5a7f78,_0xe1d389){_0xe1d389=_0xe1d389||0xc8;return function(_0x419f2d){if(_0x419f2d){return _0x5a7f78[_0x23ff('0x1a')](_0xe1d389)[_0x23ff('0x1b')](_0x419f2d);}};}function respondWithFilteredResult(_0x115031,_0x2d6837){return function(_0x4a77b4){if(_0x4a77b4){var _0x32cb0a=typeof _0x2d6837[_0x23ff('0x1c')]===_0x23ff('0x1d')&&typeof _0x2d6837[_0x23ff('0x1e')]===_0x23ff('0x1d');var _0x646825=_0x4a77b4[_0x23ff('0x1f')];var _0x11e86c=_0x32cb0a?0x0:_0x2d6837[_0x23ff('0x1c')];var _0x28d803=_0x32cb0a?_0x4a77b4['count']:_0x2d6837['offset']+_0x2d6837[_0x23ff('0x1e')];var _0x466423;if(_0x28d803>=_0x646825){_0x28d803=_0x646825;_0x466423=0xc8;}else{_0x466423=0xce;}_0x115031[_0x23ff('0x1a')](_0x466423);return _0x115031[_0x23ff('0x20')](_0x23ff('0x21'),_0x11e86c+'-'+_0x28d803+'/'+_0x646825)['json'](_0x4a77b4);}return null;};}function patchUpdates(_0x132171){return function(_0x2c2f57){try{jsonpatch[_0x23ff('0x22')](_0x2c2f57,_0x132171,!![]);}catch(_0x5a9ce1){return BPromise[_0x23ff('0x23')](_0x5a9ce1);}return _0x2c2f57[_0x23ff('0x24')]();};}function saveUpdates(_0x2a72cb,_0x2a5163){return function(_0x302038){if(_0x302038){return _0x302038[_0x23ff('0x25')](_0x2a72cb)['then'](function(_0x5a899d){return _0x5a899d;});}return null;};}function removeEntity(_0x31f8c7,_0xcc34de){return function(_0x2afec0){if(_0x2afec0){return _0x2afec0[_0x23ff('0x26')]()[_0x23ff('0x27')](function(){_0x31f8c7[_0x23ff('0x1a')](0xcc)[_0x23ff('0x28')]();});}};}function handleEntityNotFound(_0xb4adf3,_0x3bd04a){return function(_0x106ac6){if(!_0x106ac6){_0xb4adf3['sendStatus'](0x194);}return _0x106ac6;};}function handleError(_0x22fa23,_0x5358c6){_0x5358c6=_0x5358c6||0x1f4;return function(_0x196024){logger['error'](_0x196024[_0x23ff('0x29')]);if(_0x196024[_0x23ff('0x2a')]){delete _0x196024[_0x23ff('0x2a')];}_0x22fa23[_0x23ff('0x1a')](_0x5358c6)[_0x23ff('0x2b')](_0x196024);};}exports[_0x23ff('0x2c')]=function(_0x308d5d,_0x284ff2){var _0x40d412={},_0x1fb70f={},_0x1815fe={'count':0x0,'rows':[]};var _0x1a5178=_[_0x23ff('0x2d')](db['SalesforceField'][_0x23ff('0x2e')],function(_0x21cc4f){return{'name':_0x21cc4f[_0x23ff('0x2f')],'type':_0x21cc4f['type'][_0x23ff('0x30')]};});_0x1fb70f[_0x23ff('0x31')]=_[_0x23ff('0x2d')](_0x1a5178,'name');_0x1fb70f[_0x23ff('0x32')]=_[_0x23ff('0x33')](_0x308d5d[_0x23ff('0x32')]);_0x1fb70f['filters']=_[_0x23ff('0x34')](_0x1fb70f[_0x23ff('0x31')],_0x1fb70f['query']);_0x40d412[_0x23ff('0x35')]=_[_0x23ff('0x34')](_0x1fb70f[_0x23ff('0x31')],qs['fields'](_0x308d5d[_0x23ff('0x32')][_0x23ff('0x36')]));_0x40d412[_0x23ff('0x35')]=_0x40d412[_0x23ff('0x35')][_0x23ff('0x37')]?_0x40d412[_0x23ff('0x35')]:_0x1fb70f[_0x23ff('0x31')];if(!_0x308d5d[_0x23ff('0x32')][_0x23ff('0x38')](_0x23ff('0x39'))){_0x40d412[_0x23ff('0x1e')]=qs[_0x23ff('0x1e')](_0x308d5d[_0x23ff('0x32')][_0x23ff('0x1e')]);_0x40d412[_0x23ff('0x1c')]=qs['offset'](_0x308d5d[_0x23ff('0x32')]['offset']);}_0x40d412[_0x23ff('0x3a')]=qs[_0x23ff('0x3b')](_0x308d5d[_0x23ff('0x32')][_0x23ff('0x3b')]);_0x40d412['where']=qs[_0x23ff('0x3c')](_['pick'](_0x308d5d[_0x23ff('0x32')],_0x1fb70f[_0x23ff('0x3c')]),_0x1a5178);if(_0x308d5d['query'][_0x23ff('0x3d')]){_0x40d412['where']=_['merge'](_0x40d412[_0x23ff('0x3e')],{'$or':_[_0x23ff('0x2d')](_0x1a5178,function(_0x225413){if(_0x225413[_0x23ff('0x3f')]!==_0x23ff('0x40')){var _0x10b840={};_0x10b840[_0x225413['name']]={'$like':'%'+_0x308d5d['query']['filter']+'%'};return _0x10b840;}})});}_0x40d412=_['merge']({},_0x40d412,_0x308d5d['options']);var _0x1ec653={'where':_0x40d412[_0x23ff('0x3e')]};return db['SalesforceField']['count'](_0x1ec653)[_0x23ff('0x27')](function(_0x551471){_0x1815fe[_0x23ff('0x1f')]=_0x551471;if(_0x308d5d['query'][_0x23ff('0x41')]){_0x40d412[_0x23ff('0x42')]=[{'all':!![]}];}return db[_0x23ff('0x43')][_0x23ff('0x44')](_0x40d412);})[_0x23ff('0x27')](function(_0x5b00b4){_0x1815fe[_0x23ff('0x45')]=_0x5b00b4;return _0x1815fe;})[_0x23ff('0x27')](respondWithFilteredResult(_0x284ff2,_0x40d412))[_0x23ff('0x46')](handleError(_0x284ff2,null));};exports['show']=function(_0x1a2f2d,_0x2029fa){var _0x2467c3={'raw':!![],'where':{'id':_0x1a2f2d[_0x23ff('0x47')]['id']}},_0x48de78={};_0x48de78[_0x23ff('0x31')]=_[_0x23ff('0x33')](db[_0x23ff('0x43')]['rawAttributes']);_0x48de78['query']=_['keys'](_0x1a2f2d['query']);_0x48de78[_0x23ff('0x3c')]=_[_0x23ff('0x34')](_0x48de78[_0x23ff('0x31')],_0x48de78[_0x23ff('0x32')]);_0x2467c3['attributes']=_['intersection'](_0x48de78['model'],qs[_0x23ff('0x36')](_0x1a2f2d[_0x23ff('0x32')][_0x23ff('0x36')]));_0x2467c3[_0x23ff('0x35')]=_0x2467c3[_0x23ff('0x35')][_0x23ff('0x37')]?_0x2467c3[_0x23ff('0x35')]:_0x48de78[_0x23ff('0x31')];if(_0x1a2f2d[_0x23ff('0x32')]['includeAll']){_0x2467c3[_0x23ff('0x42')]=[{'all':!![]}];}_0x2467c3=_['merge']({},_0x2467c3,_0x1a2f2d[_0x23ff('0x48')]);return db[_0x23ff('0x43')]['find'](_0x2467c3)[_0x23ff('0x27')](handleEntityNotFound(_0x2029fa,null))[_0x23ff('0x27')](respondWithResult(_0x2029fa,null))[_0x23ff('0x46')](handleError(_0x2029fa,null));};exports[_0x23ff('0x49')]=function(_0x12d944,_0x20aa6a){return db[_0x23ff('0x43')]['create'](_0x12d944[_0x23ff('0x4a')],{})[_0x23ff('0x27')](respondWithResult(_0x20aa6a,0xc9))[_0x23ff('0x46')](handleError(_0x20aa6a,null));};exports['update']=function(_0xc14212,_0x27a66a){if(_0xc14212['body']['id']){delete _0xc14212['body']['id'];}return db[_0x23ff('0x43')]['find']({'where':{'id':_0xc14212[_0x23ff('0x47')]['id']}})[_0x23ff('0x27')](handleEntityNotFound(_0x27a66a,null))[_0x23ff('0x27')](saveUpdates(_0xc14212['body'],null))[_0x23ff('0x27')](respondWithResult(_0x27a66a,null))[_0x23ff('0x46')](handleError(_0x27a66a,null));};exports['destroy']=function(_0x16ddf4,_0x4566b4){return db['SalesforceField'][_0x23ff('0x4b')]({'where':{'id':_0x16ddf4[_0x23ff('0x47')]['id']}})[_0x23ff('0x27')](handleEntityNotFound(_0x4566b4,null))[_0x23ff('0x27')](removeEntity(_0x4566b4,null))[_0x23ff('0x46')](handleError(_0x4566b4,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 4e3403b..8c3e287 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 _0xe32b=['./intSalesforceField.attributes','define','SalesforceField','salesforce_unique_index','idField','FieldId','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe32b,0x156));var _0xbe32=function(_0x17b3e6,_0x4b6606){_0x17b3e6=_0x17b3e6-0x0;var _0x394794=_0xe32b[_0x17b3e6];return _0x394794;};'use strict';var _=require('lodash');var util=require(_0xbe32('0x0'));var logger=require(_0xbe32('0x1'))(_0xbe32('0x2'));var moment=require(_0xbe32('0x3'));var BPromise=require('bluebird');var rp=require(_0xbe32('0x4'));var fs=require('fs');var path=require(_0xbe32('0x5'));var rimraf=require(_0xbe32('0x6'));var config=require(_0xbe32('0x7'));var attributes=require(_0xbe32('0x8'));module['exports']=function(_0x48dd35,_0x48d43a){return _0x48dd35[_0xbe32('0x9')](_0xbe32('0xa'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0xbe32('0xb'),'fields':[_0xbe32('0xc'),_0xbe32('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xda92=['../../config/environment','exports','define','int_salesforce_fields','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x28e449,_0x1e08ef){var _0x345cbe=function(_0x36706c){while(--_0x36706c){_0x28e449['push'](_0x28e449['shift']());}};_0x345cbe(++_0x1e08ef);}(_0xda92,0x13e));var _0x2da9=function(_0x33d5d6,_0x2ad866){_0x33d5d6=_0x33d5d6-0x0;var _0x27032e=_0xda92[_0x33d5d6];return _0x27032e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2da9('0x0'))(_0x2da9('0x1'));var moment=require(_0x2da9('0x2'));var BPromise=require(_0x2da9('0x3'));var rp=require(_0x2da9('0x4'));var fs=require('fs');var path=require(_0x2da9('0x5'));var rimraf=require(_0x2da9('0x6'));var config=require(_0x2da9('0x7'));var attributes=require('./intSalesforceField.attributes');module[_0x2da9('0x8')]=function(_0x2a9701,_0x26b00d){return _0x2a9701[_0x2da9('0x9')]('SalesforceField',attributes,{'tableName':_0x2da9('0xa'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x2da9('0xb'),_0x2da9('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 1c9f430..dfe1fb2 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 _0x5da8=['../../mysqldb','../../config/utils','../../config/logger','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','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x26322d,_0x158191){var _0x370c41=function(_0x188d69){while(--_0x188d69){_0x26322d['push'](_0x26322d['shift']());}};_0x370c41(++_0x158191);}(_0x5da8,0xfe));var _0x85da=function(_0x429cb2,_0x30ada8){_0x429cb2=_0x429cb2-0x0;var _0x1af243=_0x5da8[_0x429cb2];return _0x1af243;};'use strict';var _=require(_0x85da('0x0'));var util=require(_0x85da('0x1'));var moment=require(_0x85da('0x2'));var BPromise=require(_0x85da('0x3'));var rs=require(_0x85da('0x4'));var fs=require('fs');var Redis=require(_0x85da('0x5'));var db=require(_0x85da('0x6'))['db'];var utils=require(_0x85da('0x7'));var logger=require(_0x85da('0x8'))(_0x85da('0x9'));var config=require(_0x85da('0xa'));var jayson=require(_0x85da('0xb'));var client=jayson[_0x85da('0xc')][_0x85da('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5adc8b,_0x5657c3,_0x2da798){return new BPromise(function(_0x2d9f3e,_0x42b457){return client[_0x85da('0xe')](_0x5adc8b,_0x2da798)[_0x85da('0xf')](function(_0x337282){logger[_0x85da('0x10')](_0x85da('0x11'),_0x5657c3,_0x85da('0x12'));logger[_0x85da('0x13')](_0x85da('0x14'),_0x5657c3,_0x85da('0x12'),JSON[_0x85da('0x15')](_0x337282));if(_0x337282[_0x85da('0x16')]){if(_0x337282['error']['code']===0x1f4){logger[_0x85da('0x16')](_0x85da('0x11'),_0x5657c3,_0x337282[_0x85da('0x16')][_0x85da('0x17')]);return _0x42b457(_0x337282[_0x85da('0x16')][_0x85da('0x17')]);}logger[_0x85da('0x16')](_0x85da('0x11'),_0x5657c3,_0x337282[_0x85da('0x16')]['message']);return _0x2d9f3e(_0x337282[_0x85da('0x16')][_0x85da('0x17')]);}else{logger[_0x85da('0x10')](_0x85da('0x11'),_0x5657c3,_0x85da('0x12'));_0x2d9f3e(_0x337282[_0x85da('0x18')][_0x85da('0x17')]);}})[_0x85da('0x19')](function(_0x57f827){logger['error'](_0x85da('0x11'),_0x5657c3,_0x57f827);_0x42b457(_0x57f827);});});} \ No newline at end of file +var _0x0459=['error','code','SalesforceField,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x0459,0x1e5));var _0x9045=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x0459[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x9045('0x0'));var util=require(_0x9045('0x1'));var moment=require(_0x9045('0x2'));var BPromise=require(_0x9045('0x3'));var rs=require(_0x9045('0x4'));var fs=require('fs');var Redis=require(_0x9045('0x5'));var db=require(_0x9045('0x6'))['db'];var utils=require(_0x9045('0x7'));var logger=require('../../config/logger')(_0x9045('0x8'));var config=require(_0x9045('0x9'));var jayson=require(_0x9045('0xa'));var client=jayson[_0x9045('0xb')][_0x9045('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x6b359d,_0x9aa8e,_0x370dc3){return new BPromise(function(_0x1a6122,_0x4771fa){return client[_0x9045('0xd')](_0x6b359d,_0x370dc3)[_0x9045('0xe')](function(_0x301696){logger[_0x9045('0xf')]('SalesforceField,\x20%s,\x20%s',_0x9aa8e,_0x9045('0x10'));logger[_0x9045('0x11')](_0x9045('0x12'),_0x9aa8e,_0x9045('0x10'),JSON['stringify'](_0x301696));if(_0x301696[_0x9045('0x13')]){if(_0x301696[_0x9045('0x13')][_0x9045('0x14')]===0x1f4){logger['error'](_0x9045('0x15'),_0x9aa8e,_0x301696[_0x9045('0x13')][_0x9045('0x16')]);return _0x4771fa(_0x301696[_0x9045('0x13')][_0x9045('0x16')]);}logger[_0x9045('0x13')](_0x9045('0x15'),_0x9aa8e,_0x301696[_0x9045('0x13')][_0x9045('0x16')]);return _0x1a6122(_0x301696[_0x9045('0x13')]['message']);}else{logger[_0x9045('0xf')](_0x9045('0x15'),_0x9aa8e,_0x9045('0x10'));_0x1a6122(_0x301696['result']['message']);}})[_0x9045('0x17')](function(_0x25060b){logger[_0x9045('0x13')]('SalesforceField,\x20%s,\x20%s',_0x9aa8e,_0x25060b);_0x4771fa(_0x25060b);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index abe3084..48e7831 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 _0x8ff4=['fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','update','delete','exports','multer','util','connect-timeout','express','Router'];(function(_0x9f8e0a,_0x28ea63){var _0x19e8fb=function(_0x3b907e){while(--_0x3b907e){_0x9f8e0a['push'](_0x9f8e0a['shift']());}};_0x19e8fb(++_0x28ea63);}(_0x8ff4,0x1b3));var _0x48ff=function(_0x179c4a,_0x10eb06){_0x179c4a=_0x179c4a-0x0;var _0x5d1879=_0x8ff4[_0x179c4a];return _0x5d1879;};'use strict';var multer=require(_0x48ff('0x0'));var util=require(_0x48ff('0x1'));var path=require('path');var timeout=require(_0x48ff('0x2'));var express=require(_0x48ff('0x3'));var router=express[_0x48ff('0x4')]();var fs_extra=require(_0x48ff('0x5'));var auth=require(_0x48ff('0x6'));var interaction=require(_0x48ff('0x7'));var config=require('../../config/environment');var controller=require(_0x48ff('0x8'));router[_0x48ff('0x9')]('/',auth[_0x48ff('0xa')](),controller[_0x48ff('0xb')]);router[_0x48ff('0x9')](_0x48ff('0xc'),auth['isAuthenticated'](),controller[_0x48ff('0xd')]);router[_0x48ff('0x9')](_0x48ff('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x48ff('0xf'),auth[_0x48ff('0xa')](),controller[_0x48ff('0x10')]);router[_0x48ff('0x11')]('/',auth[_0x48ff('0xa')](),controller['create']);router[_0x48ff('0x11')](_0x48ff('0xe'),auth[_0x48ff('0xa')](),controller[_0x48ff('0x12')]);router['put'](_0x48ff('0xc'),auth[_0x48ff('0xa')](),controller[_0x48ff('0x13')]);router[_0x48ff('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x48ff('0x15')]=router; \ No newline at end of file +var _0x98ea=['../../components/interaction/service','./intServicenowAccount.controller','isAuthenticated','index','get','show','/:id/configurations','post','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4817ef,_0x1d494){var _0x43431d=function(_0x158495){while(--_0x158495){_0x4817ef['push'](_0x4817ef['shift']());}};_0x43431d(++_0x1d494);}(_0x98ea,0x1ce));var _0xa98e=function(_0x1e76d8,_0x11b451){_0x1e76d8=_0x1e76d8-0x0;var _0x5cc770=_0x98ea[_0x1e76d8];return _0x5cc770;};'use strict';var multer=require(_0xa98e('0x0'));var util=require('util');var path=require(_0xa98e('0x1'));var timeout=require('connect-timeout');var express=require(_0xa98e('0x2'));var router=express[_0xa98e('0x3')]();var fs_extra=require(_0xa98e('0x4'));var auth=require(_0xa98e('0x5'));var interaction=require(_0xa98e('0x6'));var config=require('../../config/environment');var controller=require(_0xa98e('0x7'));router['get']('/',auth[_0xa98e('0x8')](),controller[_0xa98e('0x9')]);router[_0xa98e('0xa')]('/:id',auth[_0xa98e('0x8')](),controller[_0xa98e('0xb')]);router['get'](_0xa98e('0xc'),auth[_0xa98e('0x8')](),controller['getConfigurations']);router[_0xa98e('0xa')]('/:id/fields',auth[_0xa98e('0x8')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xa98e('0xd')](_0xa98e('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router['put']('/:id',auth[_0xa98e('0x8')](),controller[_0xa98e('0xe')]);router[_0xa98e('0xf')]('/:id',auth[_0xa98e('0x8')](),controller[_0xa98e('0x10')]);module[_0xa98e('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index b77852a..34b5d48 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 _0x3b39=['STRING','username','remoteUri','sequelize'];(function(_0x452968,_0x31e391){var _0xb6f9ae=function(_0x263987){while(--_0x263987){_0x452968['push'](_0x452968['shift']());}};_0xb6f9ae(++_0x31e391);}(_0x3b39,0x1ab));var _0x93b3=function(_0x4e87ba,_0x2d95f9){_0x4e87ba=_0x4e87ba-0x0;var _0x212b08=_0x3b39[_0x4e87ba];return _0x212b08;};'use strict';var Sequelize=require(_0x93b3('0x0'));module['exports']={'name':{'type':Sequelize[_0x93b3('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x93b3('0x1')],'unique':_0x93b3('0x2')},'password':{'type':Sequelize[_0x93b3('0x1')]},'email':{'type':Sequelize[_0x93b3('0x1')]},'remoteUri':{'type':Sequelize[_0x93b3('0x1')],'unique':_0x93b3('0x3')},'serverUrl':{'type':Sequelize[_0x93b3('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x3319=['STRING','username','remoteUri','sequelize'];(function(_0xc08a2a,_0x287a22){var _0x404b1e=function(_0x450922){while(--_0x450922){_0xc08a2a['push'](_0xc08a2a['shift']());}};_0x404b1e(++_0x287a22);}(_0x3319,0x10b));var _0x9331=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x3319[_0x92c450];return _0x2a9599;};'use strict';var Sequelize=require(_0x9331('0x0'));module['exports']={'name':{'type':Sequelize[_0x9331('0x1')]},'description':{'type':Sequelize[_0x9331('0x1')]},'username':{'type':Sequelize[_0x9331('0x1')],'unique':_0x9331('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x9331('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x9331('0x3')},'serverUrl':{'type':Sequelize[_0x9331('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index a15e592..d5db473 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 _0xd9b6=['includeAll','include','findAll','rows','catch','find','create','body','params','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','incident_state','severity','category','watch_list','upon_reject','child_incidents','number','resolved_by','user_input','sys_domain','state','sys_created_by','cmdb_ci','delivery_plan','impact','work_notes_list','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','delivery_task','assignment_group','business_stc','calendar_duration','notify','sys_class_name','close_notes','follow_up','parent_incident','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','comments','sla_due','approval','comments_and_work_notes','due_date','reopen_count','escalation','upon_approval','correlation_id','location','username','password','email','serverUrl','remoteUri','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','includes','forEach','label','push','all','TCL:\x20_object','remove','internalType','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','true','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','undefined','count','limit','set','Content-Range','reject','save','update','destroy','then','end','error','stack','name','send','index','ServicenowAccount','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','map','VIRTUAL','options'];(function(_0x2d1be5,_0x117de7){var _0x34a7cc=function(_0x5e910e){while(--_0x5e910e){_0x2d1be5['push'](_0x2d1be5['shift']());}};_0x34a7cc(++_0x117de7);}(_0xd9b6,0x1ed));var _0x6d9b=function(_0x140d2f,_0x2ad576){_0x140d2f=_0x140d2f-0x0;var _0x1a04c6=_0xd9b6[_0x140d2f];return _0x1a04c6;};'use strict';var emlformat=require(_0x6d9b('0x0'));var rimraf=require(_0x6d9b('0x1'));var zipdir=require(_0x6d9b('0x2'));var jsonpatch=require(_0x6d9b('0x3'));var rp=require(_0x6d9b('0x4'));var moment=require(_0x6d9b('0x5'));var BPromise=require(_0x6d9b('0x6'));var Mustache=require('mustache');var util=require(_0x6d9b('0x7'));var path=require(_0x6d9b('0x8'));var sox=require(_0x6d9b('0x9'));var csv=require(_0x6d9b('0xa'));var ejs=require(_0x6d9b('0xb'));var fs=require('fs');var fs_extra=require(_0x6d9b('0xc'));var _=require(_0x6d9b('0xd'));var squel=require('squel');var crypto=require(_0x6d9b('0xe'));var jsforce=require(_0x6d9b('0xf'));var deskjs=require(_0x6d9b('0x10'));var toCsv=require(_0x6d9b('0xa'));var querystring=require('querystring');var Papa=require(_0x6d9b('0x11'));var Redis=require('ioredis');var authService=require(_0x6d9b('0x12'));var qs=require(_0x6d9b('0x13'));var as=require(_0x6d9b('0x14'));var hardwareService=require(_0x6d9b('0x15'));var logger=require(_0x6d9b('0x16'))(_0x6d9b('0x17'));var utils=require(_0x6d9b('0x18'));var config=require(_0x6d9b('0x19'));var licenseUtil=require(_0x6d9b('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0x6d9b('0x1b'));function respondWithStatusCode(_0x30166a,_0x14e575){_0x14e575=_0x14e575||0xcc;return function(_0x1b8c2d){if(_0x1b8c2d){return _0x30166a[_0x6d9b('0x1c')](_0x14e575);}return _0x30166a[_0x6d9b('0x1d')](_0x14e575)['end']();};}function respondWithResult(_0x32c71b,_0x17cc4a){_0x17cc4a=_0x17cc4a||0xc8;return function(_0x4a79a7){if(_0x4a79a7){return _0x32c71b[_0x6d9b('0x1d')](_0x17cc4a)[_0x6d9b('0x1e')](_0x4a79a7);}};}function respondWithFilteredResult(_0x275004,_0x432b33){return function(_0x593a06){if(_0x593a06){var _0xe4a696=typeof _0x432b33['offset']==='undefined'&&typeof _0x432b33['limit']===_0x6d9b('0x1f');var _0x1ed8f3=_0x593a06[_0x6d9b('0x20')];var _0x571187=_0xe4a696?0x0:_0x432b33['offset'];var _0x3389cd=_0xe4a696?_0x593a06[_0x6d9b('0x20')]:_0x432b33['offset']+_0x432b33[_0x6d9b('0x21')];var _0x341838;if(_0x3389cd>=_0x1ed8f3){_0x3389cd=_0x1ed8f3;_0x341838=0xc8;}else{_0x341838=0xce;}_0x275004['status'](_0x341838);return _0x275004[_0x6d9b('0x22')](_0x6d9b('0x23'),_0x571187+'-'+_0x3389cd+'/'+_0x1ed8f3)[_0x6d9b('0x1e')](_0x593a06);}return null;};}function patchUpdates(_0x5b1e1c){return function(_0x554480){try{jsonpatch['apply'](_0x554480,_0x5b1e1c,!![]);}catch(_0x632e9c){return BPromise[_0x6d9b('0x24')](_0x632e9c);}return _0x554480[_0x6d9b('0x25')]();};}function saveUpdates(_0x87fd85,_0x3a3a94){return function(_0x30dfcd){if(_0x30dfcd){return _0x30dfcd[_0x6d9b('0x26')](_0x87fd85)['then'](function(_0x57d225){return _0x57d225;});}return null;};}function removeEntity(_0x5240df,_0xb0133d){return function(_0x284cfe){if(_0x284cfe){return _0x284cfe[_0x6d9b('0x27')]()[_0x6d9b('0x28')](function(){_0x5240df[_0x6d9b('0x1d')](0xcc)[_0x6d9b('0x29')]();});}};}function handleEntityNotFound(_0xc7865d,_0x5c27e7){return function(_0x3cb54c){if(!_0x3cb54c){_0xc7865d[_0x6d9b('0x1c')](0x194);}return _0x3cb54c;};}function handleError(_0x3130ba,_0x5f1be7){_0x5f1be7=_0x5f1be7||0x1f4;return function(_0x1a8134){logger[_0x6d9b('0x2a')](_0x1a8134[_0x6d9b('0x2b')]);if(_0x1a8134['name']){delete _0x1a8134[_0x6d9b('0x2c')];}_0x3130ba[_0x6d9b('0x1d')](_0x5f1be7)[_0x6d9b('0x2d')](_0x1a8134);};}exports[_0x6d9b('0x2e')]=function(_0x4fabcc,_0x5cbbd5){var _0x4033dd={},_0x290c89={},_0x27e380={'count':0x0,'rows':[]};var _0x3f9ee3=_['map'](db[_0x6d9b('0x2f')][_0x6d9b('0x30')],function(_0x2b16c6){return{'name':_0x2b16c6['fieldName'],'type':_0x2b16c6[_0x6d9b('0x31')][_0x6d9b('0x32')]};});_0x290c89['model']=_['map'](_0x3f9ee3,_0x6d9b('0x2c'));_0x290c89[_0x6d9b('0x33')]=_[_0x6d9b('0x34')](_0x4fabcc[_0x6d9b('0x33')]);_0x290c89[_0x6d9b('0x35')]=_[_0x6d9b('0x36')](_0x290c89[_0x6d9b('0x37')],_0x290c89['query']);_0x4033dd[_0x6d9b('0x38')]=_[_0x6d9b('0x36')](_0x290c89[_0x6d9b('0x37')],qs[_0x6d9b('0x39')](_0x4fabcc[_0x6d9b('0x33')][_0x6d9b('0x39')]));_0x4033dd[_0x6d9b('0x38')]=_0x4033dd['attributes'][_0x6d9b('0x3a')]?_0x4033dd[_0x6d9b('0x38')]:_0x290c89['model'];if(!_0x4fabcc[_0x6d9b('0x33')][_0x6d9b('0x3b')](_0x6d9b('0x3c'))){_0x4033dd[_0x6d9b('0x21')]=qs[_0x6d9b('0x21')](_0x4fabcc[_0x6d9b('0x33')][_0x6d9b('0x21')]);_0x4033dd[_0x6d9b('0x3d')]=qs[_0x6d9b('0x3d')](_0x4fabcc[_0x6d9b('0x33')][_0x6d9b('0x3d')]);}_0x4033dd[_0x6d9b('0x3e')]=qs[_0x6d9b('0x3f')](_0x4fabcc['query']['sort']);_0x4033dd[_0x6d9b('0x40')]=qs['filters'](_[_0x6d9b('0x41')](_0x4fabcc[_0x6d9b('0x33')],_0x290c89[_0x6d9b('0x35')]),_0x3f9ee3);if(_0x4fabcc[_0x6d9b('0x33')][_0x6d9b('0x42')]){_0x4033dd[_0x6d9b('0x40')]=_[_0x6d9b('0x43')](_0x4033dd[_0x6d9b('0x40')],{'$or':_[_0x6d9b('0x44')](_0x3f9ee3,function(_0x22e3c6){if(_0x22e3c6[_0x6d9b('0x31')]!==_0x6d9b('0x45')){var _0x3c79c8={};_0x3c79c8[_0x22e3c6[_0x6d9b('0x2c')]]={'$like':'%'+_0x4fabcc[_0x6d9b('0x33')]['filter']+'%'};return _0x3c79c8;}})});}_0x4033dd=_[_0x6d9b('0x43')]({},_0x4033dd,_0x4fabcc[_0x6d9b('0x46')]);var _0x1fa349={'where':_0x4033dd[_0x6d9b('0x40')]};return db[_0x6d9b('0x2f')][_0x6d9b('0x20')](_0x1fa349)[_0x6d9b('0x28')](function(_0x13c837){_0x27e380[_0x6d9b('0x20')]=_0x13c837;if(_0x4fabcc['query'][_0x6d9b('0x47')]){_0x4033dd[_0x6d9b('0x48')]=[{'all':!![]}];}return db[_0x6d9b('0x2f')][_0x6d9b('0x49')](_0x4033dd);})[_0x6d9b('0x28')](function(_0x2c285e){_0x27e380[_0x6d9b('0x4a')]=_0x2c285e;return _0x27e380;})['then'](respondWithFilteredResult(_0x5cbbd5,_0x4033dd))[_0x6d9b('0x4b')](handleError(_0x5cbbd5,null));};exports['show']=function(_0x5dd5d3,_0x2c0056){var _0x437638={'raw':![],'where':{'id':_0x5dd5d3['params']['id']}},_0x25ea83={};_0x25ea83['model']=_[_0x6d9b('0x34')](db[_0x6d9b('0x2f')][_0x6d9b('0x30')]);_0x25ea83[_0x6d9b('0x33')]=_[_0x6d9b('0x34')](_0x5dd5d3[_0x6d9b('0x33')]);_0x25ea83['filters']=_[_0x6d9b('0x36')](_0x25ea83[_0x6d9b('0x37')],_0x25ea83['query']);_0x437638[_0x6d9b('0x38')]=_[_0x6d9b('0x36')](_0x25ea83['model'],qs[_0x6d9b('0x39')](_0x5dd5d3['query'][_0x6d9b('0x39')]));_0x437638[_0x6d9b('0x38')]=_0x437638[_0x6d9b('0x38')][_0x6d9b('0x3a')]?_0x437638[_0x6d9b('0x38')]:_0x25ea83[_0x6d9b('0x37')];if(_0x5dd5d3[_0x6d9b('0x33')][_0x6d9b('0x47')]){_0x437638[_0x6d9b('0x48')]=[{'all':!![]}];}_0x437638=_['merge']({},_0x437638,_0x5dd5d3[_0x6d9b('0x46')]);return db[_0x6d9b('0x2f')][_0x6d9b('0x4c')](_0x437638)[_0x6d9b('0x28')](handleEntityNotFound(_0x2c0056,null))[_0x6d9b('0x28')](respondWithResult(_0x2c0056,null))[_0x6d9b('0x4b')](handleError(_0x2c0056,null));};exports[_0x6d9b('0x4d')]=function(_0x895c71,_0x3f54ec){return db[_0x6d9b('0x2f')][_0x6d9b('0x4d')](_0x895c71[_0x6d9b('0x4e')],{})['then'](respondWithResult(_0x3f54ec,0xc9))['catch'](handleError(_0x3f54ec,null));};exports[_0x6d9b('0x26')]=function(_0x2252fa,_0x57ebe8){if(_0x2252fa[_0x6d9b('0x4e')]['id']){delete _0x2252fa[_0x6d9b('0x4e')]['id'];}return db[_0x6d9b('0x2f')]['find']({'where':{'id':_0x2252fa['params']['id']}})[_0x6d9b('0x28')](handleEntityNotFound(_0x57ebe8,null))[_0x6d9b('0x28')](saveUpdates(_0x2252fa['body'],null))[_0x6d9b('0x28')](respondWithResult(_0x57ebe8,null))[_0x6d9b('0x4b')](handleError(_0x57ebe8,null));};exports[_0x6d9b('0x27')]=function(_0xc4df9b,_0x178373){return db['ServicenowAccount']['find']({'where':{'id':_0xc4df9b[_0x6d9b('0x4f')]['id']}})[_0x6d9b('0x28')](handleEntityNotFound(_0x178373,null))[_0x6d9b('0x28')](removeEntity(_0x178373,null))[_0x6d9b('0x4b')](handleError(_0x178373,null));};exports[_0x6d9b('0x50')]=function(_0x140491,_0x17ba05,_0x21e08c){var _0x1dd5db={};var _0xd3830c={};var _0x5e3e6c;var _0x291fa0;return db[_0x6d9b('0x2f')][_0x6d9b('0x51')]({'where':{'id':_0x140491[_0x6d9b('0x4f')]['id']}})['then'](handleEntityNotFound(_0x17ba05,null))[_0x6d9b('0x28')](function(_0x5ab1e1){if(_0x5ab1e1){_0x5e3e6c=_0x5ab1e1;_0xd3830c[_0x6d9b('0x37')]=_['keys'](db[_0x6d9b('0x52')][_0x6d9b('0x30')]);_0xd3830c[_0x6d9b('0x33')]=_[_0x6d9b('0x34')](_0x140491[_0x6d9b('0x33')]);_0xd3830c[_0x6d9b('0x35')]=_['intersection'](_0xd3830c[_0x6d9b('0x37')],_0xd3830c[_0x6d9b('0x33')]);_0x1dd5db[_0x6d9b('0x38')]=_[_0x6d9b('0x36')](_0xd3830c[_0x6d9b('0x37')],qs[_0x6d9b('0x39')](_0x140491[_0x6d9b('0x33')][_0x6d9b('0x39')]));_0x1dd5db['attributes']=_0x1dd5db[_0x6d9b('0x38')][_0x6d9b('0x3a')]?_0x1dd5db[_0x6d9b('0x38')]:_0xd3830c[_0x6d9b('0x37')];_0x1dd5db[_0x6d9b('0x3e')]=qs[_0x6d9b('0x3f')](_0x140491[_0x6d9b('0x33')]['sort']);_0x1dd5db[_0x6d9b('0x40')]=qs[_0x6d9b('0x35')](_['pick'](_0x140491[_0x6d9b('0x33')],_0xd3830c[_0x6d9b('0x35')]));if(_0x140491[_0x6d9b('0x33')][_0x6d9b('0x42')]){_0x1dd5db[_0x6d9b('0x40')]=_[_0x6d9b('0x43')](_0x1dd5db[_0x6d9b('0x40')],{'$or':_[_0x6d9b('0x44')](_0x1dd5db[_0x6d9b('0x38')],function(_0x20a5b9){var _0x12d837={};_0x12d837[_0x20a5b9]={'$like':'%'+_0x140491[_0x6d9b('0x33')][_0x6d9b('0x42')]+'%'};return _0x12d837;})});}_0x1dd5db=_[_0x6d9b('0x43')]({},_0x1dd5db,_0x140491[_0x6d9b('0x46')]);return _0x5e3e6c[_0x6d9b('0x50')](_0x1dd5db);}})[_0x6d9b('0x28')](function(_0x141517){if(_0x141517){_0x291fa0=_0x141517['length'];if(!_0x140491[_0x6d9b('0x33')][_0x6d9b('0x3b')](_0x6d9b('0x3c'))){_0x1dd5db[_0x6d9b('0x21')]=qs[_0x6d9b('0x21')](_0x140491[_0x6d9b('0x33')][_0x6d9b('0x21')]);_0x1dd5db['offset']=qs[_0x6d9b('0x3d')](_0x140491[_0x6d9b('0x33')][_0x6d9b('0x3d')]);}return _0x5e3e6c[_0x6d9b('0x50')](_0x1dd5db);}})[_0x6d9b('0x28')](function(_0x510aa4){if(_0x510aa4){return _0x510aa4?{'count':_0x291fa0,'rows':_0x510aa4}:null;}})[_0x6d9b('0x28')](respondWithResult(_0x17ba05,null))[_0x6d9b('0x4b')](handleError(_0x17ba05,null));};exports[_0x6d9b('0x53')]=function(_0x1e9fad,_0x6733ec,_0x36c378){if(_0x1e9fad[_0x6d9b('0x4e')]['id']){delete _0x1e9fad[_0x6d9b('0x4e')]['id'];}return db[_0x6d9b('0x2f')][_0x6d9b('0x51')]({'where':{'id':_0x1e9fad['params']['id']}})[_0x6d9b('0x28')](handleEntityNotFound(_0x6733ec,null))[_0x6d9b('0x28')](function(_0x3ac3a3){if(_0x3ac3a3){_0x1e9fad[_0x6d9b('0x4e')][_0x6d9b('0x54')]=_0x3ac3a3['id'];_0x1e9fad['body'][_0x6d9b('0x55')]=integrations[_0x6d9b('0x56')](_0x1e9fad['body'][_0x6d9b('0x57')],_0x1e9fad[_0x6d9b('0x4e')][_0x6d9b('0x31')]);_0x1e9fad[_0x6d9b('0x4e')][_0x6d9b('0x58')]=integrations[_0x6d9b('0x59')](_0x1e9fad[_0x6d9b('0x4e')][_0x6d9b('0x57')],_0x1e9fad[_0x6d9b('0x4e')][_0x6d9b('0x31')]);return db['ServicenowConfiguration'][_0x6d9b('0x4d')](_0x1e9fad[_0x6d9b('0x4e')],{'include':[{'model':db[_0x6d9b('0x5a')],'as':'Subjects'},{'model':db[_0x6d9b('0x5a')],'as':_0x6d9b('0x58')}]});}return null;})[_0x6d9b('0x28')](respondWithResult(_0x6733ec,null))['catch'](handleError(_0x6733ec,null));};exports[_0x6d9b('0x5b')]=function(_0x44115c,_0x3bb1e2,_0xcfc6fc){var _0x193873=[_0x6d9b('0x5c'),_0x6d9b('0x5d'),_0x6d9b('0x5e'),_0x6d9b('0x5f'),_0x6d9b('0x60'),'notify',_0x6d9b('0x61'),_0x6d9b('0x62'),_0x6d9b('0x63')];var _0x3782c5=['parent','made_sla','caused_by',_0x6d9b('0x64'),_0x6d9b('0x65'),'sys_updated_on',_0x6d9b('0x66'),_0x6d9b('0x5d'),'approval_history',_0x6d9b('0x67'),_0x6d9b('0x68'),'sys_updated_by','opened_by',_0x6d9b('0x69'),'sys_created_on',_0x6d9b('0x6a'),_0x6d9b('0x6b'),_0x6d9b('0x6c'),_0x6d9b('0x5e'),'order','calendar_stc','closed_at',_0x6d9b('0x6d'),_0x6d9b('0x6e'),_0x6d9b('0x6f'),'active',_0x6d9b('0x70'),'business_service',_0x6d9b('0x71'),_0x6d9b('0x72'),_0x6d9b('0x73'),_0x6d9b('0x74'),_0x6d9b('0x75'),_0x6d9b('0x76'),_0x6d9b('0x77'),_0x6d9b('0x78'),'work_end',_0x6d9b('0x79'),_0x6d9b('0x7a'),_0x6d9b('0x7b'),_0x6d9b('0x7c'),_0x6d9b('0x5f'),_0x6d9b('0x7d'),_0x6d9b('0x7e'),_0x6d9b('0x60'),'correlation_display',_0x6d9b('0x7f'),'work_start',_0x6d9b('0x80'),_0x6d9b('0x81'),'additional_assignee_list','description',_0x6d9b('0x82'),_0x6d9b('0x83'),_0x6d9b('0x84'),_0x6d9b('0x85'),'closed_by',_0x6d9b('0x86'),_0x6d9b('0x87'),'sys_id',_0x6d9b('0x88'),_0x6d9b('0x89'),_0x6d9b('0x61'),_0x6d9b('0x8a'),_0x6d9b('0x8b'),_0x6d9b('0x8c'),_0x6d9b('0x8d'),_0x6d9b('0x8e'),'assigned_to',_0x6d9b('0x62'),_0x6d9b('0x8f'),_0x6d9b('0x90'),_0x6d9b('0x91'),_0x6d9b('0x92'),_0x6d9b('0x93'),'sys_mod_count',_0x6d9b('0x94'),'sys_tags',_0x6d9b('0x95'),_0x6d9b('0x96'),_0x6d9b('0x97'),_0x6d9b('0x98'),_0x6d9b('0x63')];var _0x471f9a='';var _0x59cebb='';var _0xa23f7b=[];var _0xbe9db2='';var _0x156bfe='';var _0x11ddad=[];var _0x420afc='';var _0x46cc1b='';var _0xd81d9d={};var _0x3c86e4='';return db[_0x6d9b('0x2f')][_0x6d9b('0x51')]({'where':{'id':_0x44115c['params']['id']},'attributes':['id',_0x6d9b('0x99'),_0x6d9b('0x9a'),_0x6d9b('0x9b'),'remoteUri',_0x6d9b('0x9c')]})[_0x6d9b('0x28')](handleEntityNotFound(_0x3bb1e2,null))['then'](function(_0x500478){if(_0x500478){_0x3c86e4=_0x500478[_0x6d9b('0x9d')];var _0x2d8a04=_0x3c86e4[_0x6d9b('0x9e')](-0x1);if(_0x2d8a04==='/'){_0x3c86e4=_0x3c86e4['substring'](0x0,_0x3c86e4[_0x6d9b('0x9f')](_0x2d8a04));}_0x46cc1b=util[_0x6d9b('0xa0')](_0x6d9b('0xa1'),_0x3c86e4);_0x420afc=util['format'](_0x6d9b('0xa2'),_0x3c86e4);_0xd81d9d={'user':_0x500478[_0x6d9b('0x99')],'pass':_0x500478[_0x6d9b('0x9a')]};var _0x43413c={'method':_0x6d9b('0xa3'),'uri':_0x46cc1b+_0x6d9b('0xa4'),'auth':_0xd81d9d,'json':!![]};return rp(_0x43413c);}})[_0x6d9b('0x28')](function(_0x58f8ab){if(_0x58f8ab[_0x6d9b('0xa5')][_0x6d9b('0x3a')]>0x0){_0x471f9a=_0x58f8ab['result'];}console[_0x6d9b('0xa6')](_0x6d9b('0xa7'),_0x471f9a);_0x11ddad=[];_0x59cebb=Object[_0x6d9b('0xa8')]([],_0x471f9a);_['remove'](_0x59cebb,function(_0x416328){return!_0x193873[_0x6d9b('0xa9')](_0x416328['name']);});_0x59cebb[_0x6d9b('0xaa')](function(_0x5ce04c){var _0x5605b8=createFieldObject(_0x420afc,_0xd81d9d,_0x5ce04c['internalType'],_0x5ce04c[_0x6d9b('0x2c')],_0x5ce04c[_0x6d9b('0xab')],![]);_0x11ddad[_0x6d9b('0xac')](_0x5605b8);});return Promise[_0x6d9b('0xad')](_0x11ddad);})[_0x6d9b('0x28')](function(_0xef8f50){_0xa23f7b=_0xef8f50;_0xbe9db2=Object['assign']([],_0x471f9a);console[_0x6d9b('0xa6')](_0x6d9b('0xae'),_0x471f9a);_[_0x6d9b('0xaf')](_0xbe9db2,function(_0x1e1a8e){return _0x3782c5[_0x6d9b('0xa9')](_0x1e1a8e[_0x6d9b('0x2c')]);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0xbe9db2);_0x11ddad=[];_0xbe9db2[_0x6d9b('0xaa')](function(_0x16faf3){var _0x50b8df=createFieldObject(_0x420afc,_0xd81d9d,_0x16faf3[_0x6d9b('0xb0')],_0x16faf3[_0x6d9b('0x2c')],_0x16faf3[_0x6d9b('0xab')],!![]);_0x11ddad[_0x6d9b('0xac')](_0x50b8df);});return Promise[_0x6d9b('0xad')](_0x11ddad);})[_0x6d9b('0x28')](function(_0x4f1874){_0x156bfe=_0x4f1874;var _0x506b5f=_0xa23f7b[_0x6d9b('0xb1')](_0x156bfe);return{'count':_0x506b5f[_0x6d9b('0x3a')],'rows':_0x506b5f};})[_0x6d9b('0x28')](respondWithResult(_0x3bb1e2,null))[_0x6d9b('0x4b')](function(_0x4856c9){console[_0x6d9b('0xa6')](_0x6d9b('0xb2')+_0x4856c9);var _0x4ee0c1=_0x44115c[_0x6d9b('0x33')][_0x6d9b('0xb3')]?0x1f4:_0x4856c9[_0x6d9b('0xb4')]||0x1f4;logger[_0x6d9b('0x2a')](_0x4856c9[_0x6d9b('0x2b')]);delete _0x4856c9[_0x6d9b('0x2c')];if(_0x4ee0c1===0x191){_0x4ee0c1=0x190;}_0x3bb1e2['status'](_0x4ee0c1)[_0x6d9b('0x2d')](_0x44115c[_0x6d9b('0x33')]['test']?{'message':_0x6d9b('0xb5'),'statusCode':_0x4856c9['statusCode']}:_0x4856c9);});};function createFieldObject(_0x4a36b5,_0x33c556,_0x487601,_0x539298,_0x1be6d5,_0x359b65){return new Promise(function(_0x261588,_0x382c86){var _0x2111f9={'id':_0x539298,'name':_0x1be6d5,'custom':_0x359b65};if(_0x487601===_0x6d9b('0xb6')){_0x2111f9[_0x6d9b('0x46')]=[{'name':'True','value':_0x6d9b('0xb7')},{'name':'False','value':_0x6d9b('0xb8')}];_0x261588(_0x2111f9);}else{var _0x2613ba={'method':_0x6d9b('0xa3'),'uri':_0x4a36b5+_0x6d9b('0xb9')+_0x539298,'auth':_0x33c556,'json':!![]};return rp(_0x2613ba)[_0x6d9b('0x28')](function(_0x37dede){var _0x5c93f3=[];if(_0x37dede[_0x6d9b('0xa5')][_0x6d9b('0x3a')]>0x0){_0x37dede['result'][_0x6d9b('0xaa')](function(_0x50eb9f){if(_0x50eb9f[_0x6d9b('0xba')]===_0x6d9b('0xb8')){var _0x432fa5={'name':_0x50eb9f['label'],'value':_0x50eb9f[_0x6d9b('0xbb')]};_0x5c93f3['push'](_0x432fa5);}});}_0x2111f9[_0x6d9b('0x46')]=_0x5c93f3;if(_0x2111f9[_0x6d9b('0x46')][_0x6d9b('0x3a')]>0x0){_0x261588(_0x2111f9);}else{if(_0x359b65==![]){_0x261588();}else{_0x261588(_0x2111f9);}}});}});} \ No newline at end of file +var _0x0b40=['internalType','label','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','concat','ServiceNow\x20error:\x20','stack','test','Wrong\x20credentials','True','true','False','false','inactive','value','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','name','index','map','ServicenowAccount','rawAttributes','fieldName','type','keys','filters','intersection','model','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','create','body','find','params','findOne','ServicenowConfiguration','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','ServicenowField','Subjects','hold_reason','subcategory','close_code','notify','incident_state','severity','category','parent','made_sla','caused_by','watch_list','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','user_input','sys_domain','state','sys_created_by','knowledge','calendar_stc','cmdb_ci','impact','active','business_service','priority','time_worked','expected_start','opened_at','reopened_time','caller_id','work_notes','short_description','correlation_display','delivery_task','work_start','business_stc','additional_assignee_list','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','substring','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'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0b40,0x181));var _0x00b4=function(_0x35d775,_0x25431e){_0x35d775=_0x35d775-0x0;var _0x59384d=_0x0b40[_0x35d775];return _0x59384d;};'use strict';var emlformat=require(_0x00b4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x00b4('0x1'));var jsonpatch=require(_0x00b4('0x2'));var rp=require(_0x00b4('0x3'));var moment=require(_0x00b4('0x4'));var BPromise=require(_0x00b4('0x5'));var Mustache=require(_0x00b4('0x6'));var util=require(_0x00b4('0x7'));var path=require('path');var sox=require(_0x00b4('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x00b4('0x9'));var _=require(_0x00b4('0xa'));var squel=require(_0x00b4('0xb'));var crypto=require(_0x00b4('0xc'));var jsforce=require(_0x00b4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x00b4('0xe'));var querystring=require(_0x00b4('0xf'));var Papa=require('papaparse');var Redis=require(_0x00b4('0x10'));var authService=require(_0x00b4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x00b4('0x12'));var hardwareService=require(_0x00b4('0x13'));var logger=require(_0x00b4('0x14'))(_0x00b4('0x15'));var utils=require(_0x00b4('0x16'));var config=require(_0x00b4('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x00b4('0x18'))['db'];var integrations=require(_0x00b4('0x19'));function respondWithStatusCode(_0x4b61c1,_0x45534c){_0x45534c=_0x45534c||0xcc;return function(_0x48b4dc){if(_0x48b4dc){return _0x4b61c1[_0x00b4('0x1a')](_0x45534c);}return _0x4b61c1[_0x00b4('0x1b')](_0x45534c)[_0x00b4('0x1c')]();};}function respondWithResult(_0x45a1cd,_0x139adf){_0x139adf=_0x139adf||0xc8;return function(_0x4e1aa6){if(_0x4e1aa6){return _0x45a1cd[_0x00b4('0x1b')](_0x139adf)['json'](_0x4e1aa6);}};}function respondWithFilteredResult(_0x5cebe4,_0x4acd0e){return function(_0x276764){if(_0x276764){var _0x2a701a=typeof _0x4acd0e[_0x00b4('0x1d')]===_0x00b4('0x1e')&&typeof _0x4acd0e[_0x00b4('0x1f')]===_0x00b4('0x1e');var _0x3834aa=_0x276764[_0x00b4('0x20')];var _0x54cfc7=_0x2a701a?0x0:_0x4acd0e['offset'];var _0x1af170=_0x2a701a?_0x276764[_0x00b4('0x20')]:_0x4acd0e[_0x00b4('0x1d')]+_0x4acd0e[_0x00b4('0x1f')];var _0x1a63b8;if(_0x1af170>=_0x3834aa){_0x1af170=_0x3834aa;_0x1a63b8=0xc8;}else{_0x1a63b8=0xce;}_0x5cebe4[_0x00b4('0x1b')](_0x1a63b8);return _0x5cebe4[_0x00b4('0x21')](_0x00b4('0x22'),_0x54cfc7+'-'+_0x1af170+'/'+_0x3834aa)['json'](_0x276764);}return null;};}function patchUpdates(_0x331791){return function(_0x5116a1){try{jsonpatch['apply'](_0x5116a1,_0x331791,!![]);}catch(_0x26d17a){return BPromise[_0x00b4('0x23')](_0x26d17a);}return _0x5116a1[_0x00b4('0x24')]();};}function saveUpdates(_0x3c7f47,_0x42a138){return function(_0x5735b4){if(_0x5735b4){return _0x5735b4[_0x00b4('0x25')](_0x3c7f47)[_0x00b4('0x26')](function(_0x1c0869){return _0x1c0869;});}return null;};}function removeEntity(_0x2b0b23,_0x137028){return function(_0xb3da31){if(_0xb3da31){return _0xb3da31[_0x00b4('0x27')]()['then'](function(){_0x2b0b23[_0x00b4('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28e1ad,_0xefb1bb){return function(_0xe919ed){if(!_0xe919ed){_0x28e1ad[_0x00b4('0x1a')](0x194);}return _0xe919ed;};}function handleError(_0x3f325e,_0x28f857){_0x28f857=_0x28f857||0x1f4;return function(_0x2a617b){logger[_0x00b4('0x28')](_0x2a617b['stack']);if(_0x2a617b[_0x00b4('0x29')]){delete _0x2a617b['name'];}_0x3f325e[_0x00b4('0x1b')](_0x28f857)['send'](_0x2a617b);};}exports[_0x00b4('0x2a')]=function(_0x102fbc,_0x129f87){var _0xe203fb={},_0x479bda={},_0x195063={'count':0x0,'rows':[]};var _0x253378=_[_0x00b4('0x2b')](db[_0x00b4('0x2c')][_0x00b4('0x2d')],function(_0x4e7170){return{'name':_0x4e7170[_0x00b4('0x2e')],'type':_0x4e7170[_0x00b4('0x2f')]['key']};});_0x479bda['model']=_[_0x00b4('0x2b')](_0x253378,_0x00b4('0x29'));_0x479bda['query']=_[_0x00b4('0x30')](_0x102fbc['query']);_0x479bda[_0x00b4('0x31')]=_[_0x00b4('0x32')](_0x479bda[_0x00b4('0x33')],_0x479bda['query']);_0xe203fb[_0x00b4('0x34')]=_[_0x00b4('0x32')](_0x479bda[_0x00b4('0x33')],qs[_0x00b4('0x35')](_0x102fbc[_0x00b4('0x36')]['fields']));_0xe203fb[_0x00b4('0x34')]=_0xe203fb[_0x00b4('0x34')][_0x00b4('0x37')]?_0xe203fb[_0x00b4('0x34')]:_0x479bda[_0x00b4('0x33')];if(!_0x102fbc['query'][_0x00b4('0x38')](_0x00b4('0x39'))){_0xe203fb['limit']=qs['limit'](_0x102fbc[_0x00b4('0x36')][_0x00b4('0x1f')]);_0xe203fb[_0x00b4('0x1d')]=qs[_0x00b4('0x1d')](_0x102fbc[_0x00b4('0x36')][_0x00b4('0x1d')]);}_0xe203fb[_0x00b4('0x3a')]=qs[_0x00b4('0x3b')](_0x102fbc['query'][_0x00b4('0x3b')]);_0xe203fb['where']=qs[_0x00b4('0x31')](_[_0x00b4('0x3c')](_0x102fbc['query'],_0x479bda[_0x00b4('0x31')]),_0x253378);if(_0x102fbc[_0x00b4('0x36')][_0x00b4('0x3d')]){_0xe203fb[_0x00b4('0x3e')]=_[_0x00b4('0x3f')](_0xe203fb[_0x00b4('0x3e')],{'$or':_['map'](_0x253378,function(_0x5c0811){if(_0x5c0811[_0x00b4('0x2f')]!==_0x00b4('0x40')){var _0x173c1d={};_0x173c1d[_0x5c0811[_0x00b4('0x29')]]={'$like':'%'+_0x102fbc[_0x00b4('0x36')][_0x00b4('0x3d')]+'%'};return _0x173c1d;}})});}_0xe203fb=_[_0x00b4('0x3f')]({},_0xe203fb,_0x102fbc[_0x00b4('0x41')]);var _0x16cf32={'where':_0xe203fb[_0x00b4('0x3e')]};return db[_0x00b4('0x2c')]['count'](_0x16cf32)[_0x00b4('0x26')](function(_0x1ad55d){_0x195063[_0x00b4('0x20')]=_0x1ad55d;if(_0x102fbc[_0x00b4('0x36')][_0x00b4('0x42')]){_0xe203fb[_0x00b4('0x43')]=[{'all':!![]}];}return db[_0x00b4('0x2c')][_0x00b4('0x44')](_0xe203fb);})[_0x00b4('0x26')](function(_0x42cf4a){_0x195063[_0x00b4('0x45')]=_0x42cf4a;return _0x195063;})[_0x00b4('0x26')](respondWithFilteredResult(_0x129f87,_0xe203fb))[_0x00b4('0x46')](handleError(_0x129f87,null));};exports['show']=function(_0x5682c4,_0x4fbfd4){var _0x1f64d9={'raw':![],'where':{'id':_0x5682c4['params']['id']}},_0xa0541a={};_0xa0541a[_0x00b4('0x33')]=_[_0x00b4('0x30')](db['ServicenowAccount']['rawAttributes']);_0xa0541a[_0x00b4('0x36')]=_[_0x00b4('0x30')](_0x5682c4['query']);_0xa0541a['filters']=_[_0x00b4('0x32')](_0xa0541a[_0x00b4('0x33')],_0xa0541a['query']);_0x1f64d9['attributes']=_[_0x00b4('0x32')](_0xa0541a['model'],qs[_0x00b4('0x35')](_0x5682c4['query'][_0x00b4('0x35')]));_0x1f64d9['attributes']=_0x1f64d9[_0x00b4('0x34')][_0x00b4('0x37')]?_0x1f64d9[_0x00b4('0x34')]:_0xa0541a[_0x00b4('0x33')];if(_0x5682c4['query'][_0x00b4('0x42')]){_0x1f64d9['include']=[{'all':!![]}];}_0x1f64d9=_[_0x00b4('0x3f')]({},_0x1f64d9,_0x5682c4[_0x00b4('0x41')]);return db[_0x00b4('0x2c')]['find'](_0x1f64d9)[_0x00b4('0x26')](handleEntityNotFound(_0x4fbfd4,null))[_0x00b4('0x26')](respondWithResult(_0x4fbfd4,null))[_0x00b4('0x46')](handleError(_0x4fbfd4,null));};exports[_0x00b4('0x47')]=function(_0x3ef226,_0x5096b0){return db['ServicenowAccount']['create'](_0x3ef226[_0x00b4('0x48')],{})[_0x00b4('0x26')](respondWithResult(_0x5096b0,0xc9))[_0x00b4('0x46')](handleError(_0x5096b0,null));};exports[_0x00b4('0x25')]=function(_0x3bd88e,_0x2d4399){if(_0x3bd88e['body']['id']){delete _0x3bd88e[_0x00b4('0x48')]['id'];}return db['ServicenowAccount'][_0x00b4('0x49')]({'where':{'id':_0x3bd88e['params']['id']}})['then'](handleEntityNotFound(_0x2d4399,null))['then'](saveUpdates(_0x3bd88e[_0x00b4('0x48')],null))[_0x00b4('0x26')](respondWithResult(_0x2d4399,null))[_0x00b4('0x46')](handleError(_0x2d4399,null));};exports[_0x00b4('0x27')]=function(_0x142b35,_0x52b136){return db[_0x00b4('0x2c')][_0x00b4('0x49')]({'where':{'id':_0x142b35[_0x00b4('0x4a')]['id']}})[_0x00b4('0x26')](handleEntityNotFound(_0x52b136,null))[_0x00b4('0x26')](removeEntity(_0x52b136,null))[_0x00b4('0x46')](handleError(_0x52b136,null));};exports['getConfigurations']=function(_0x921a77,_0x5d2c54,_0xf4ec0a){var _0x569da7={};var _0x67ca54={};var _0x16c12c;var _0xd1bdda;return db['ServicenowAccount'][_0x00b4('0x4b')]({'where':{'id':_0x921a77[_0x00b4('0x4a')]['id']}})[_0x00b4('0x26')](handleEntityNotFound(_0x5d2c54,null))['then'](function(_0x277547){if(_0x277547){_0x16c12c=_0x277547;_0x67ca54['model']=_['keys'](db[_0x00b4('0x4c')][_0x00b4('0x2d')]);_0x67ca54['query']=_[_0x00b4('0x30')](_0x921a77[_0x00b4('0x36')]);_0x67ca54[_0x00b4('0x31')]=_[_0x00b4('0x32')](_0x67ca54[_0x00b4('0x33')],_0x67ca54[_0x00b4('0x36')]);_0x569da7[_0x00b4('0x34')]=_['intersection'](_0x67ca54[_0x00b4('0x33')],qs[_0x00b4('0x35')](_0x921a77['query'][_0x00b4('0x35')]));_0x569da7[_0x00b4('0x34')]=_0x569da7[_0x00b4('0x34')][_0x00b4('0x37')]?_0x569da7[_0x00b4('0x34')]:_0x67ca54[_0x00b4('0x33')];_0x569da7[_0x00b4('0x3a')]=qs[_0x00b4('0x3b')](_0x921a77[_0x00b4('0x36')][_0x00b4('0x3b')]);_0x569da7[_0x00b4('0x3e')]=qs[_0x00b4('0x31')](_[_0x00b4('0x3c')](_0x921a77[_0x00b4('0x36')],_0x67ca54[_0x00b4('0x31')]));if(_0x921a77[_0x00b4('0x36')][_0x00b4('0x3d')]){_0x569da7[_0x00b4('0x3e')]=_[_0x00b4('0x3f')](_0x569da7['where'],{'$or':_[_0x00b4('0x2b')](_0x569da7[_0x00b4('0x34')],function(_0x38361f){var _0x4424ce={};_0x4424ce[_0x38361f]={'$like':'%'+_0x921a77['query'][_0x00b4('0x3d')]+'%'};return _0x4424ce;})});}_0x569da7=_['merge']({},_0x569da7,_0x921a77[_0x00b4('0x41')]);return _0x16c12c[_0x00b4('0x4d')](_0x569da7);}})[_0x00b4('0x26')](function(_0x15b020){if(_0x15b020){_0xd1bdda=_0x15b020['length'];if(!_0x921a77['query']['hasOwnProperty'](_0x00b4('0x39'))){_0x569da7[_0x00b4('0x1f')]=qs[_0x00b4('0x1f')](_0x921a77[_0x00b4('0x36')][_0x00b4('0x1f')]);_0x569da7[_0x00b4('0x1d')]=qs[_0x00b4('0x1d')](_0x921a77[_0x00b4('0x36')]['offset']);}return _0x16c12c[_0x00b4('0x4d')](_0x569da7);}})[_0x00b4('0x26')](function(_0x47ccec){if(_0x47ccec){return _0x47ccec?{'count':_0xd1bdda,'rows':_0x47ccec}:null;}})[_0x00b4('0x26')](respondWithResult(_0x5d2c54,null))[_0x00b4('0x46')](handleError(_0x5d2c54,null));};exports[_0x00b4('0x4e')]=function(_0x361654,_0x3d4099,_0x45c482){if(_0x361654['body']['id']){delete _0x361654[_0x00b4('0x48')]['id'];}return db[_0x00b4('0x2c')][_0x00b4('0x4b')]({'where':{'id':_0x361654[_0x00b4('0x4a')]['id']}})[_0x00b4('0x26')](handleEntityNotFound(_0x3d4099,null))['then'](function(_0xac9107){if(_0xac9107){_0x361654[_0x00b4('0x48')][_0x00b4('0x4f')]=_0xac9107['id'];_0x361654['body']['Subjects']=integrations[_0x00b4('0x50')](_0x361654['body'][_0x00b4('0x51')],_0x361654[_0x00b4('0x48')][_0x00b4('0x2f')]);_0x361654[_0x00b4('0x48')][_0x00b4('0x52')]=integrations['getDescriptions'](_0x361654[_0x00b4('0x48')]['channel'],_0x361654['body'][_0x00b4('0x2f')]);return db[_0x00b4('0x4c')][_0x00b4('0x47')](_0x361654[_0x00b4('0x48')],{'include':[{'model':db[_0x00b4('0x53')],'as':_0x00b4('0x54')},{'model':db[_0x00b4('0x53')],'as':_0x00b4('0x52')}]});}return null;})[_0x00b4('0x26')](respondWithResult(_0x3d4099,null))[_0x00b4('0x46')](handleError(_0x3d4099,null));};exports['getFields']=function(_0x5770dc,_0x4d2108,_0x808a67){var _0x3b3634=['made_sla',_0x00b4('0x55'),'knowledge',_0x00b4('0x56'),_0x00b4('0x57'),_0x00b4('0x58'),_0x00b4('0x59'),_0x00b4('0x5a'),_0x00b4('0x5b')];var _0x2f1a81=[_0x00b4('0x5c'),_0x00b4('0x5d'),_0x00b4('0x5e'),_0x00b4('0x5f'),'upon_reject',_0x00b4('0x60'),_0x00b4('0x61'),_0x00b4('0x55'),_0x00b4('0x62'),_0x00b4('0x63'),_0x00b4('0x64'),_0x00b4('0x65'),'opened_by',_0x00b4('0x66'),'sys_created_on',_0x00b4('0x67'),_0x00b4('0x68'),_0x00b4('0x69'),_0x00b4('0x6a'),_0x00b4('0x3a'),_0x00b4('0x6b'),'closed_at',_0x00b4('0x6c'),'delivery_plan',_0x00b4('0x6d'),_0x00b4('0x6e'),'work_notes_list',_0x00b4('0x6f'),_0x00b4('0x70'),'sys_domain_path','rfc',_0x00b4('0x71'),_0x00b4('0x72'),_0x00b4('0x73'),'business_duration','group_list','work_end',_0x00b4('0x74'),'resolved_at',_0x00b4('0x75'),'approval_set',_0x00b4('0x56'),_0x00b4('0x76'),_0x00b4('0x77'),'close_code',_0x00b4('0x78'),_0x00b4('0x79'),_0x00b4('0x7a'),'assignment_group',_0x00b4('0x7b'),_0x00b4('0x7c'),'description',_0x00b4('0x7d'),_0x00b4('0x58'),_0x00b4('0x7e'),_0x00b4('0x7f'),_0x00b4('0x80'),_0x00b4('0x81'),'parent_incident','sys_id',_0x00b4('0x82'),_0x00b4('0x83'),_0x00b4('0x59'),_0x00b4('0x84'),_0x00b4('0x85'),_0x00b4('0x86'),_0x00b4('0x87'),_0x00b4('0x88'),_0x00b4('0x89'),'severity',_0x00b4('0x8a'),_0x00b4('0x8b'),'approval',_0x00b4('0x8c'),_0x00b4('0x8d'),_0x00b4('0x8e'),_0x00b4('0x8f'),'sys_tags',_0x00b4('0x90'),_0x00b4('0x91'),_0x00b4('0x92'),_0x00b4('0x93'),_0x00b4('0x5b')];var _0x1c47c8='';var _0x5e1e60='';var _0x8af83b=[];var _0x1811d8='';var _0x105be8='';var _0x584bd2=[];var _0x1a3240='';var _0x4173b0='';var _0x242882={};var _0x3db532='';return db['ServicenowAccount'][_0x00b4('0x4b')]({'where':{'id':_0x5770dc[_0x00b4('0x4a')]['id']},'attributes':['id',_0x00b4('0x94'),_0x00b4('0x95'),_0x00b4('0x96'),_0x00b4('0x97'),_0x00b4('0x98')]})[_0x00b4('0x26')](handleEntityNotFound(_0x4d2108,null))[_0x00b4('0x26')](function(_0x2c893f){if(_0x2c893f){_0x3db532=_0x2c893f[_0x00b4('0x97')];var _0x2d42c8=_0x3db532[_0x00b4('0x99')](-0x1);if(_0x2d42c8==='/'){_0x3db532=_0x3db532[_0x00b4('0x9a')](0x0,_0x3db532['lastIndexOf'](_0x2d42c8));}_0x4173b0=util[_0x00b4('0x9b')](_0x00b4('0x9c'),_0x3db532);_0x1a3240=util['format'](_0x00b4('0x9d'),_0x3db532);_0x242882={'user':_0x2c893f[_0x00b4('0x94')],'pass':_0x2c893f[_0x00b4('0x95')]};var _0x27ad5b={'method':_0x00b4('0x9e'),'uri':_0x4173b0+_0x00b4('0x9f'),'auth':_0x242882,'json':!![]};return rp(_0x27ad5b);}})['then'](function(_0x2aebf4){if(_0x2aebf4[_0x00b4('0xa0')]['length']>0x0){_0x1c47c8=_0x2aebf4['result'];}console[_0x00b4('0xa1')](_0x00b4('0xa2'),_0x1c47c8);_0x584bd2=[];_0x5e1e60=Object[_0x00b4('0xa3')]([],_0x1c47c8);_[_0x00b4('0xa4')](_0x5e1e60,function(_0x86fcbb){return!_0x3b3634[_0x00b4('0xa5')](_0x86fcbb[_0x00b4('0x29')]);});_0x5e1e60[_0x00b4('0xa6')](function(_0x42da9d){var _0x43b115=createFieldObject(_0x1a3240,_0x242882,_0x42da9d[_0x00b4('0xa7')],_0x42da9d['name'],_0x42da9d[_0x00b4('0xa8')],![]);_0x584bd2['push'](_0x43b115);});return Promise[_0x00b4('0xa9')](_0x584bd2);})[_0x00b4('0x26')](function(_0x331121){_0x8af83b=_0x331121;_0x1811d8=Object[_0x00b4('0xa3')]([],_0x1c47c8);console[_0x00b4('0xa1')](_0x00b4('0xaa'),_0x1c47c8);_[_0x00b4('0xa4')](_0x1811d8,function(_0x43614f){return _0x2f1a81[_0x00b4('0xa5')](_0x43614f[_0x00b4('0x29')]);});console[_0x00b4('0xa1')](_0x00b4('0xab'),_0x1811d8);_0x584bd2=[];_0x1811d8[_0x00b4('0xa6')](function(_0x41982f){var _0x44c190=createFieldObject(_0x1a3240,_0x242882,_0x41982f[_0x00b4('0xa7')],_0x41982f[_0x00b4('0x29')],_0x41982f[_0x00b4('0xa8')],!![]);_0x584bd2[_0x00b4('0xac')](_0x44c190);});return Promise['all'](_0x584bd2);})[_0x00b4('0x26')](function(_0xd6fab1){_0x105be8=_0xd6fab1;var _0x3af6fe=_0x8af83b[_0x00b4('0xad')](_0x105be8);return{'count':_0x3af6fe['length'],'rows':_0x3af6fe};})['then'](respondWithResult(_0x4d2108,null))[_0x00b4('0x46')](function(_0x3b5ab7){console[_0x00b4('0xa1')](_0x00b4('0xae')+_0x3b5ab7);var _0x49d97b=_0x5770dc[_0x00b4('0x36')]['test']?0x1f4:_0x3b5ab7['statusCode']||0x1f4;logger[_0x00b4('0x28')](_0x3b5ab7[_0x00b4('0xaf')]);delete _0x3b5ab7[_0x00b4('0x29')];if(_0x49d97b===0x191){_0x49d97b=0x190;}_0x4d2108[_0x00b4('0x1b')](_0x49d97b)['send'](_0x5770dc[_0x00b4('0x36')][_0x00b4('0xb0')]?{'message':_0x00b4('0xb1'),'statusCode':_0x3b5ab7['statusCode']}:_0x3b5ab7);});};function createFieldObject(_0x2ea88c,_0x1ff4e5,_0x5c3c9d,_0x22b40e,_0x5dac23,_0x228b5f){return new Promise(function(_0x7188af,_0x7c46c){var _0x5b8d90={'id':_0x22b40e,'name':_0x5dac23,'custom':_0x228b5f};if(_0x5c3c9d==='boolean'){_0x5b8d90[_0x00b4('0x41')]=[{'name':_0x00b4('0xb2'),'value':_0x00b4('0xb3')},{'name':_0x00b4('0xb4'),'value':_0x00b4('0xb5')}];_0x7188af(_0x5b8d90);}else{var _0x4bec40={'method':_0x00b4('0x9e'),'uri':_0x2ea88c+'sys_choice?sysparm_query=name=incident^element='+_0x22b40e,'auth':_0x1ff4e5,'json':!![]};return rp(_0x4bec40)[_0x00b4('0x26')](function(_0x33c0e4){var _0x51f18c=[];if(_0x33c0e4[_0x00b4('0xa0')]['length']>0x0){_0x33c0e4[_0x00b4('0xa0')][_0x00b4('0xa6')](function(_0x4d040b){if(_0x4d040b[_0x00b4('0xb6')]===_0x00b4('0xb5')){var _0x429149={'name':_0x4d040b[_0x00b4('0xa8')],'value':_0x4d040b[_0x00b4('0xb7')]};_0x51f18c[_0x00b4('0xac')](_0x429149);}});}_0x5b8d90['options']=_0x51f18c;if(_0x5b8d90[_0x00b4('0x41')][_0x00b4('0x37')]>0x0){_0x7188af(_0x5b8d90);}else{if(_0x228b5f==![]){_0x7188af();}else{_0x7188af(_0x5b8d90);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index b8edc9d..fb465d0 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 _0xabce=['path','rimraf','../../config/environment','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0xabce,0x103));var _0xeabc=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xabce[_0x54d4a8];return _0x3b321b;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./intServicenowAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xeabc('0x8')]=function(_0x52a4d7,_0x229ba4){return _0x52a4d7['define'](_0xeabc('0x9'),attributes,{'tableName':_0xeabc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3eea=['bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','../../config/logger','api','moment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x445729,_0x1a6c3f){_0x445729=_0x445729-0x0;var _0x5085ec=_0x3eea[_0x445729];return _0x5085ec;};'use strict';var _=require(_0xa3ee('0x0'));var util=require('util');var logger=require(_0xa3ee('0x1'))(_0xa3ee('0x2'));var moment=require(_0xa3ee('0x3'));var BPromise=require(_0xa3ee('0x4'));var rp=require(_0xa3ee('0x5'));var fs=require('fs');var path=require(_0xa3ee('0x6'));var rimraf=require(_0xa3ee('0x7'));var config=require(_0xa3ee('0x8'));var attributes=require(_0xa3ee('0x9'));var integrations=require(_0xa3ee('0xa'));module[_0xa3ee('0xb')]=function(_0x5776bb,_0x538bf9){return _0x5776bb[_0xa3ee('0xc')]('ServicenowAccount',attributes,{'tableName':_0xa3ee('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 8944c2d..9c1b5b0 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 _0x63a1=['client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetServicenowAccount','ShowServicenowAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0x63a1,0x11d));var _0x163a=function(_0x1c886e,_0x45c241){_0x1c886e=_0x1c886e-0x0;var _0x296675=_0x63a1[_0x1c886e];return _0x296675;};'use strict';var _=require(_0x163a('0x0'));var util=require(_0x163a('0x1'));var moment=require(_0x163a('0x2'));var BPromise=require(_0x163a('0x3'));var rs=require(_0x163a('0x4'));var fs=require('fs');var Redis=require(_0x163a('0x5'));var db=require(_0x163a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x163a('0x7'))(_0x163a('0x8'));var config=require(_0x163a('0x9'));var jayson=require(_0x163a('0xa'));var client=jayson[_0x163a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27047a,_0x339d9e,_0x12b95d){return new BPromise(function(_0x45215b,_0x1c2b51){return client[_0x163a('0xc')](_0x27047a,_0x12b95d)[_0x163a('0xd')](function(_0x441967){logger[_0x163a('0xe')](_0x163a('0xf'),_0x339d9e,_0x163a('0x10'));logger[_0x163a('0x11')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x339d9e,_0x163a('0x10'),JSON[_0x163a('0x12')](_0x441967));if(_0x441967[_0x163a('0x13')]){if(_0x441967[_0x163a('0x13')][_0x163a('0x14')]===0x1f4){logger[_0x163a('0x13')](_0x163a('0xf'),_0x339d9e,_0x441967[_0x163a('0x13')]['message']);return _0x1c2b51(_0x441967['error']['message']);}logger[_0x163a('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x339d9e,_0x441967['error']['message']);return _0x45215b(_0x441967[_0x163a('0x13')][_0x163a('0x15')]);}else{logger[_0x163a('0xe')](_0x163a('0xf'),_0x339d9e,'request\x20sent');_0x45215b(_0x441967[_0x163a('0x16')][_0x163a('0x15')]);}})[_0x163a('0x17')](function(_0x235ef6){logger[_0x163a('0x13')](_0x163a('0xf'),_0x339d9e,_0x235ef6);_0x1c2b51(_0x235ef6);});});}exports['GetServicenowAccount']=function(_0x2ac5a6){var _0x10f449=this;return new Promise(function(_0x2ad6f4,_0x3e9104){return db[_0x163a('0x18')][_0x163a('0x19')]({'raw':_0x2ac5a6['options']?_0x2ac5a6[_0x163a('0x1a')][_0x163a('0x1b')]===undefined?!![]:![]:!![],'where':_0x2ac5a6[_0x163a('0x1a')]?_0x2ac5a6[_0x163a('0x1a')][_0x163a('0x1c')]||null:null,'attributes':_0x2ac5a6[_0x163a('0x1a')]?_0x2ac5a6['options'][_0x163a('0x1d')]||null:null,'limit':_0x2ac5a6[_0x163a('0x1a')]?_0x2ac5a6[_0x163a('0x1a')][_0x163a('0x1e')]||null:null,'include':_0x2ac5a6['options']?_0x2ac5a6['options'][_0x163a('0x1f')]?_[_0x163a('0x20')](_0x2ac5a6[_0x163a('0x1a')]['include'],function(_0x331c90){return{'model':db[_0x331c90[_0x163a('0x21')]],'as':_0x331c90['as'],'attributes':_0x331c90['attributes'],'include':_0x331c90[_0x163a('0x1f')]?_[_0x163a('0x20')](_0x331c90[_0x163a('0x1f')],function(_0x29b821){return{'model':db[_0x29b821[_0x163a('0x21')]],'as':_0x29b821['as'],'attributes':_0x29b821[_0x163a('0x1d')],'include':_0x29b821[_0x163a('0x1f')]?_['map'](_0x29b821[_0x163a('0x1f')],function(_0x3002d3){return{'model':db[_0x3002d3[_0x163a('0x21')]],'as':_0x3002d3['as'],'attributes':_0x3002d3[_0x163a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x163a('0xd')](function(_0xfa8ba5){logger['info'](_0x163a('0x22'),_0x2ac5a6);logger[_0x163a('0x11')]('GetServicenowAccount',_0x2ac5a6,JSON['stringify'](_0xfa8ba5));_0x2ad6f4(_0xfa8ba5);})[_0x163a('0x17')](function(_0x15126c){logger[_0x163a('0x13')](_0x163a('0x22'),_0x15126c[_0x163a('0x15')],_0x2ac5a6);_0x3e9104(_0x10f449['error'](0x1f4,_0x15126c[_0x163a('0x15')]));});});};exports[_0x163a('0x23')]=function(_0x2663cf){var _0x5c544f=this;return new Promise(function(_0x36a268,_0x40293){return db['ServicenowAccount'][_0x163a('0x24')]({'raw':_0x2663cf[_0x163a('0x1a')]?_0x2663cf[_0x163a('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2663cf[_0x163a('0x1a')]?_0x2663cf[_0x163a('0x1a')][_0x163a('0x1c')]||null:null,'attributes':_0x2663cf['options']?_0x2663cf[_0x163a('0x1a')]['attributes']||null:null,'include':_0x2663cf[_0x163a('0x1a')]?_0x2663cf[_0x163a('0x1a')]['include']?_['map'](_0x2663cf[_0x163a('0x1a')][_0x163a('0x1f')],function(_0x4049f3){return{'model':db[_0x4049f3[_0x163a('0x21')]],'as':_0x4049f3['as'],'attributes':_0x4049f3[_0x163a('0x1d')],'include':_0x4049f3[_0x163a('0x1f')]?_['map'](_0x4049f3['include'],function(_0x4f7858){return{'model':db[_0x4f7858[_0x163a('0x21')]],'as':_0x4f7858['as'],'attributes':_0x4f7858[_0x163a('0x1d')],'include':_0x4f7858['include']?_[_0x163a('0x20')](_0x4f7858[_0x163a('0x1f')],function(_0x496b8a){return{'model':db[_0x496b8a[_0x163a('0x21')]],'as':_0x496b8a['as'],'attributes':_0x496b8a[_0x163a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x163a('0xd')](function(_0x22c524){logger['info'](_0x163a('0x23'),_0x2663cf);logger[_0x163a('0x11')](_0x163a('0x23'),_0x2663cf,JSON[_0x163a('0x12')](_0x22c524));_0x36a268(_0x22c524);})['catch'](function(_0x915fe){logger[_0x163a('0x13')](_0x163a('0x23'),_0x915fe[_0x163a('0x15')],_0x2663cf);_0x40293(_0x5c544f[_0x163a('0x13')](0x1f4,_0x915fe['message']));});});}; \ No newline at end of file +var _0xb30d=['rpc','client','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowServicenowAccount','ServicenowAccount','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x13537c,_0x4ec4ce){var _0x26c65d=function(_0x56fdbc){while(--_0x56fdbc){_0x13537c['push'](_0x13537c['shift']());}};_0x26c65d(++_0x4ec4ce);}(_0xb30d,0x178));var _0xdb30=function(_0x2eb3db,_0x4a32c0){_0x2eb3db=_0x2eb3db-0x0;var _0x358f33=_0xb30d[_0x2eb3db];return _0x358f33;};'use strict';var _=require(_0xdb30('0x0'));var util=require(_0xdb30('0x1'));var moment=require(_0xdb30('0x2'));var BPromise=require(_0xdb30('0x3'));var rs=require(_0xdb30('0x4'));var fs=require('fs');var Redis=require(_0xdb30('0x5'));var db=require(_0xdb30('0x6'))['db'];var utils=require(_0xdb30('0x7'));var logger=require(_0xdb30('0x8'))(_0xdb30('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdb30('0xa')][_0xdb30('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x467c6c,_0x1aecea,_0x33c541){return new BPromise(function(_0x4ee534,_0x363f6a){return client['request'](_0x467c6c,_0x33c541)[_0xdb30('0xc')](function(_0x552a87){logger[_0xdb30('0xd')](_0xdb30('0xe'),_0x1aecea,_0xdb30('0xf'));logger[_0xdb30('0x10')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x1aecea,_0xdb30('0xf'),JSON['stringify'](_0x552a87));if(_0x552a87[_0xdb30('0x11')]){if(_0x552a87['error'][_0xdb30('0x12')]===0x1f4){logger[_0xdb30('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x1aecea,_0x552a87['error'][_0xdb30('0x13')]);return _0x363f6a(_0x552a87[_0xdb30('0x11')][_0xdb30('0x13')]);}logger['error'](_0xdb30('0xe'),_0x1aecea,_0x552a87[_0xdb30('0x11')][_0xdb30('0x13')]);return _0x4ee534(_0x552a87[_0xdb30('0x11')][_0xdb30('0x13')]);}else{logger[_0xdb30('0xd')](_0xdb30('0xe'),_0x1aecea,_0xdb30('0xf'));_0x4ee534(_0x552a87[_0xdb30('0x14')][_0xdb30('0x13')]);}})[_0xdb30('0x15')](function(_0x50a692){logger[_0xdb30('0x11')](_0xdb30('0xe'),_0x1aecea,_0x50a692);_0x363f6a(_0x50a692);});});}exports[_0xdb30('0x16')]=function(_0x83f7e6){var _0x5456b1=this;return new Promise(function(_0x434d1e,_0x176637){return db['ServicenowAccount'][_0xdb30('0x17')]({'raw':_0x83f7e6[_0xdb30('0x18')]?_0x83f7e6[_0xdb30('0x18')][_0xdb30('0x19')]===undefined?!![]:![]:!![],'where':_0x83f7e6['options']?_0x83f7e6['options'][_0xdb30('0x1a')]||null:null,'attributes':_0x83f7e6[_0xdb30('0x18')]?_0x83f7e6['options'][_0xdb30('0x1b')]||null:null,'limit':_0x83f7e6[_0xdb30('0x18')]?_0x83f7e6[_0xdb30('0x18')][_0xdb30('0x1c')]||null:null,'include':_0x83f7e6[_0xdb30('0x18')]?_0x83f7e6[_0xdb30('0x18')][_0xdb30('0x1d')]?_[_0xdb30('0x1e')](_0x83f7e6[_0xdb30('0x18')]['include'],function(_0x4034b9){return{'model':db[_0x4034b9[_0xdb30('0x1f')]],'as':_0x4034b9['as'],'attributes':_0x4034b9[_0xdb30('0x1b')],'include':_0x4034b9[_0xdb30('0x1d')]?_[_0xdb30('0x1e')](_0x4034b9[_0xdb30('0x1d')],function(_0x1e682c){return{'model':db[_0x1e682c[_0xdb30('0x1f')]],'as':_0x1e682c['as'],'attributes':_0x1e682c[_0xdb30('0x1b')],'include':_0x1e682c[_0xdb30('0x1d')]?_[_0xdb30('0x1e')](_0x1e682c[_0xdb30('0x1d')],function(_0x284285){return{'model':db[_0x284285['model']],'as':_0x284285['as'],'attributes':_0x284285[_0xdb30('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf2c39e){logger[_0xdb30('0xd')](_0xdb30('0x16'),_0x83f7e6);logger[_0xdb30('0x10')]('GetServicenowAccount',_0x83f7e6,JSON['stringify'](_0xf2c39e));_0x434d1e(_0xf2c39e);})['catch'](function(_0x31918c){logger['error'](_0xdb30('0x16'),_0x31918c[_0xdb30('0x13')],_0x83f7e6);_0x176637(_0x5456b1[_0xdb30('0x11')](0x1f4,_0x31918c[_0xdb30('0x13')]));});});};exports[_0xdb30('0x20')]=function(_0xdd88f7){var _0x2d63b4=this;return new Promise(function(_0x23a95e,_0x1e9e5b){return db[_0xdb30('0x21')]['find']({'raw':_0xdd88f7[_0xdb30('0x18')]?_0xdd88f7['options'][_0xdb30('0x19')]===undefined?!![]:![]:!![],'where':_0xdd88f7[_0xdb30('0x18')]?_0xdd88f7['options']['where']||null:null,'attributes':_0xdd88f7['options']?_0xdd88f7[_0xdb30('0x18')]['attributes']||null:null,'include':_0xdd88f7['options']?_0xdd88f7[_0xdb30('0x18')][_0xdb30('0x1d')]?_['map'](_0xdd88f7[_0xdb30('0x18')]['include'],function(_0x35ac92){return{'model':db[_0x35ac92[_0xdb30('0x1f')]],'as':_0x35ac92['as'],'attributes':_0x35ac92[_0xdb30('0x1b')],'include':_0x35ac92['include']?_[_0xdb30('0x1e')](_0x35ac92[_0xdb30('0x1d')],function(_0x24f103){return{'model':db[_0x24f103[_0xdb30('0x1f')]],'as':_0x24f103['as'],'attributes':_0x24f103[_0xdb30('0x1b')],'include':_0x24f103['include']?_[_0xdb30('0x1e')](_0x24f103[_0xdb30('0x1d')],function(_0x4f0368){return{'model':db[_0x4f0368['model']],'as':_0x4f0368['as'],'attributes':_0x4f0368[_0xdb30('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23c4f8){logger[_0xdb30('0xd')]('ShowServicenowAccount',_0xdd88f7);logger[_0xdb30('0x10')](_0xdb30('0x20'),_0xdd88f7,JSON[_0xdb30('0x22')](_0x23c4f8));_0x23a95e(_0x23c4f8);})[_0xdb30('0x15')](function(_0x471b95){logger[_0xdb30('0x11')](_0xdb30('0x20'),_0x471b95[_0xdb30('0x13')],_0xdd88f7);_0x1e9e5b(_0x2d63b4[_0xdb30('0x11')](0x1f4,_0x471b95[_0xdb30('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 43f547a..6e6eec2 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 _0x5725=['exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','delete'];(function(_0x1e3207,_0x3ce24a){var _0x5b986e=function(_0xa8a77e){while(--_0xa8a77e){_0x1e3207['push'](_0x1e3207['shift']());}};_0x5b986e(++_0x3ce24a);}(_0x5725,0xdd));var _0x5572=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x5725[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x5572('0x0'));var util=require(_0x5572('0x1'));var path=require(_0x5572('0x2'));var timeout=require(_0x5572('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5572('0x4'));var auth=require(_0x5572('0x5'));var interaction=require(_0x5572('0x6'));var config=require(_0x5572('0x7'));var controller=require(_0x5572('0x8'));router[_0x5572('0x9')]('/',auth[_0x5572('0xa')](),controller['index']);router[_0x5572('0x9')](_0x5572('0xb'),auth[_0x5572('0xa')](),controller[_0x5572('0xc')]);router[_0x5572('0x9')](_0x5572('0xd'),auth[_0x5572('0xa')](),controller[_0x5572('0xe')]);router[_0x5572('0x9')](_0x5572('0xf'),auth[_0x5572('0xa')](),controller[_0x5572('0x10')]);router[_0x5572('0x9')](_0x5572('0x11'),auth['isAuthenticated'](),controller[_0x5572('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5572('0x13')](_0x5572('0xb'),auth[_0x5572('0xa')](),controller['update']);router[_0x5572('0x14')]('/:id',auth[_0x5572('0xa')](),controller['destroy']);module[_0x5572('0x15')]=router; \ No newline at end of file +var _0x13e6=['getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getSubjects','/:id/descriptions'];(function(_0x488b22,_0x380301){var _0x15b14c=function(_0x20fcd7){while(--_0x20fcd7){_0x488b22['push'](_0x488b22['shift']());}};_0x15b14c(++_0x380301);}(_0x13e6,0x1a8));var _0x613e=function(_0x48159c,_0x434ab1){_0x48159c=_0x48159c-0x0;var _0x19932c=_0x13e6[_0x48159c];return _0x19932c;};'use strict';var multer=require(_0x613e('0x0'));var util=require('util');var path=require(_0x613e('0x1'));var timeout=require(_0x613e('0x2'));var express=require('express');var router=express[_0x613e('0x3')]();var fs_extra=require(_0x613e('0x4'));var auth=require(_0x613e('0x5'));var interaction=require(_0x613e('0x6'));var config=require('../../config/environment');var controller=require(_0x613e('0x7'));router['get']('/',auth[_0x613e('0x8')](),controller[_0x613e('0x9')]);router[_0x613e('0xa')](_0x613e('0xb'),auth['isAuthenticated'](),controller[_0x613e('0xc')]);router[_0x613e('0xa')](_0x613e('0xd'),auth[_0x613e('0x8')](),controller['getFields']);router[_0x613e('0xa')]('/:id/subjects',auth[_0x613e('0x8')](),controller[_0x613e('0xe')]);router[_0x613e('0xa')](_0x613e('0xf'),auth[_0x613e('0x8')](),controller[_0x613e('0x10')]);router['post']('/',auth[_0x613e('0x8')](),controller['create']);router[_0x613e('0x11')](_0x613e('0xb'),auth[_0x613e('0x8')](),controller[_0x613e('0x12')]);router[_0x613e('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x613e('0x14')]);module[_0x613e('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 4de811f..b4b371b 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 _0xb116=['STRING','sequelize','exports'];(function(_0x57048e,_0x4058f4){var _0x24d679=function(_0x249379){while(--_0x249379){_0x57048e['push'](_0x57048e['shift']());}};_0x24d679(++_0x4058f4);}(_0xb116,0xdf));var _0x6b11=function(_0x590851,_0x496bee){_0x590851=_0x590851-0x0;var _0x3b0115=_0xb116[_0x590851];return _0x3b0115;};'use strict';var Sequelize=require(_0x6b11('0x0'));module[_0x6b11('0x1')]={'name':{'type':Sequelize[_0x6b11('0x2')]},'description':{'type':Sequelize[_0x6b11('0x2')]}}; \ No newline at end of file +var _0x50eb=['STRING','sequelize'];(function(_0x55728f,_0x39eb48){var _0x71c1c=function(_0x2e3972){while(--_0x2e3972){_0x55728f['push'](_0x55728f['shift']());}};_0x71c1c(++_0x39eb48);}(_0x50eb,0xf3));var _0xb50e=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x50eb[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require(_0xb50e('0x0'));module['exports']={'name':{'type':Sequelize[_0xb50e('0x1')]},'description':{'type':Sequelize[_0xb50e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 46f19aa..9f72656 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 _0x45b6=['end','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','find','getFields','findOne','ServicenowField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x45b6,0xd0));var _0x645b=function(_0x39277f,_0x460842){_0x39277f=_0x39277f-0x0;var _0xfcf21e=_0x45b6[_0x39277f];return _0xfcf21e;};'use strict';var emlformat=require(_0x645b('0x0'));var rimraf=require(_0x645b('0x1'));var zipdir=require(_0x645b('0x2'));var jsonpatch=require(_0x645b('0x3'));var rp=require(_0x645b('0x4'));var moment=require('moment');var BPromise=require(_0x645b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x645b('0x6'));var sox=require(_0x645b('0x7'));var csv=require(_0x645b('0x8'));var ejs=require(_0x645b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x645b('0xa'));var jsforce=require(_0x645b('0xb'));var deskjs=require(_0x645b('0xc'));var toCsv=require(_0x645b('0x8'));var querystring=require(_0x645b('0xd'));var Papa=require('papaparse');var Redis=require(_0x645b('0xe'));var authService=require(_0x645b('0xf'));var qs=require(_0x645b('0x10'));var as=require(_0x645b('0x11'));var hardwareService=require(_0x645b('0x12'));var logger=require(_0x645b('0x13'))(_0x645b('0x14'));var utils=require(_0x645b('0x15'));var config=require(_0x645b('0x16'));var licenseUtil=require(_0x645b('0x17'));var db=require(_0x645b('0x18'))['db'];function respondWithStatusCode(_0x475b55,_0x3e23ac){_0x3e23ac=_0x3e23ac||0xcc;return function(_0x138c67){if(_0x138c67){return _0x475b55[_0x645b('0x19')](_0x3e23ac);}return _0x475b55[_0x645b('0x1a')](_0x3e23ac)['end']();};}function respondWithResult(_0xe0c1fd,_0x2bee47){_0x2bee47=_0x2bee47||0xc8;return function(_0x102656){if(_0x102656){return _0xe0c1fd[_0x645b('0x1a')](_0x2bee47)[_0x645b('0x1b')](_0x102656);}};}function respondWithFilteredResult(_0x5aa2f1,_0x2109d7){return function(_0x35a86f){if(_0x35a86f){var _0x385cfd=typeof _0x2109d7['offset']===_0x645b('0x1c')&&typeof _0x2109d7[_0x645b('0x1d')]===_0x645b('0x1c');var _0x3065bc=_0x35a86f[_0x645b('0x1e')];var _0x58331d=_0x385cfd?0x0:_0x2109d7[_0x645b('0x1f')];var _0x5850ea=_0x385cfd?_0x35a86f[_0x645b('0x1e')]:_0x2109d7[_0x645b('0x1f')]+_0x2109d7[_0x645b('0x1d')];var _0x5763fc;if(_0x5850ea>=_0x3065bc){_0x5850ea=_0x3065bc;_0x5763fc=0xc8;}else{_0x5763fc=0xce;}_0x5aa2f1[_0x645b('0x1a')](_0x5763fc);return _0x5aa2f1[_0x645b('0x20')](_0x645b('0x21'),_0x58331d+'-'+_0x5850ea+'/'+_0x3065bc)['json'](_0x35a86f);}return null;};}function patchUpdates(_0x46e7d8){return function(_0x2219ab){try{jsonpatch['apply'](_0x2219ab,_0x46e7d8,!![]);}catch(_0xb2af85){return BPromise[_0x645b('0x22')](_0xb2af85);}return _0x2219ab['save']();};}function saveUpdates(_0x3bd92a,_0x542a91){return function(_0x3e5589){if(_0x3e5589){return _0x3e5589[_0x645b('0x23')](_0x3bd92a)[_0x645b('0x24')](function(_0x25c0e3){return _0x25c0e3;});}return null;};}function removeEntity(_0x129767,_0x12e376){return function(_0x2828d5){if(_0x2828d5){return _0x2828d5[_0x645b('0x25')]()[_0x645b('0x24')](function(){_0x129767[_0x645b('0x1a')](0xcc)[_0x645b('0x26')]();});}};}function handleEntityNotFound(_0x5f41fb,_0x8d609d){return function(_0x2f5387){if(!_0x2f5387){_0x5f41fb[_0x645b('0x19')](0x194);}return _0x2f5387;};}function handleError(_0x38b095,_0x75346c){_0x75346c=_0x75346c||0x1f4;return function(_0x202827){logger[_0x645b('0x27')](_0x202827[_0x645b('0x28')]);if(_0x202827[_0x645b('0x29')]){delete _0x202827[_0x645b('0x29')];}_0x38b095['status'](_0x75346c)[_0x645b('0x2a')](_0x202827);};}exports[_0x645b('0x2b')]=function(_0x3f69d6,_0x404f0c){var _0x3bd0d5={},_0x36bda5={},_0x21069d={'count':0x0,'rows':[]};var _0x48072b=_[_0x645b('0x2c')](db[_0x645b('0x2d')][_0x645b('0x2e')],function(_0x49c490){return{'name':_0x49c490[_0x645b('0x2f')],'type':_0x49c490['type'][_0x645b('0x30')]};});_0x36bda5[_0x645b('0x31')]=_[_0x645b('0x2c')](_0x48072b,_0x645b('0x29'));_0x36bda5[_0x645b('0x32')]=_['keys'](_0x3f69d6['query']);_0x36bda5[_0x645b('0x33')]=_[_0x645b('0x34')](_0x36bda5['model'],_0x36bda5[_0x645b('0x32')]);_0x3bd0d5[_0x645b('0x35')]=_[_0x645b('0x34')](_0x36bda5[_0x645b('0x31')],qs[_0x645b('0x36')](_0x3f69d6[_0x645b('0x32')][_0x645b('0x36')]));_0x3bd0d5[_0x645b('0x35')]=_0x3bd0d5[_0x645b('0x35')][_0x645b('0x37')]?_0x3bd0d5[_0x645b('0x35')]:_0x36bda5['model'];if(!_0x3f69d6[_0x645b('0x32')][_0x645b('0x38')](_0x645b('0x39'))){_0x3bd0d5[_0x645b('0x1d')]=qs[_0x645b('0x1d')](_0x3f69d6[_0x645b('0x32')][_0x645b('0x1d')]);_0x3bd0d5[_0x645b('0x1f')]=qs['offset'](_0x3f69d6['query'][_0x645b('0x1f')]);}_0x3bd0d5[_0x645b('0x3a')]=qs[_0x645b('0x3b')](_0x3f69d6[_0x645b('0x32')][_0x645b('0x3b')]);_0x3bd0d5[_0x645b('0x3c')]=qs[_0x645b('0x33')](_[_0x645b('0x3d')](_0x3f69d6[_0x645b('0x32')],_0x36bda5[_0x645b('0x33')]),_0x48072b);if(_0x3f69d6[_0x645b('0x32')]['filter']){_0x3bd0d5[_0x645b('0x3c')]=_['merge'](_0x3bd0d5[_0x645b('0x3c')],{'$or':_[_0x645b('0x2c')](_0x48072b,function(_0x3c9886){if(_0x3c9886['type']!==_0x645b('0x3e')){var _0x59cd93={};_0x59cd93[_0x3c9886['name']]={'$like':'%'+_0x3f69d6[_0x645b('0x32')][_0x645b('0x3f')]+'%'};return _0x59cd93;}})});}_0x3bd0d5=_[_0x645b('0x40')]({},_0x3bd0d5,_0x3f69d6['options']);var _0x2c60a9={'where':_0x3bd0d5[_0x645b('0x3c')]};return db[_0x645b('0x2d')][_0x645b('0x1e')](_0x2c60a9)[_0x645b('0x24')](function(_0x181de1){_0x21069d[_0x645b('0x1e')]=_0x181de1;if(_0x3f69d6[_0x645b('0x32')][_0x645b('0x41')]){_0x3bd0d5[_0x645b('0x42')]=[{'all':!![]}];}return db[_0x645b('0x2d')][_0x645b('0x43')](_0x3bd0d5);})['then'](function(_0x2cb56e){_0x21069d[_0x645b('0x44')]=_0x2cb56e;return _0x21069d;})[_0x645b('0x24')](respondWithFilteredResult(_0x404f0c,_0x3bd0d5))[_0x645b('0x45')](handleError(_0x404f0c,null));};exports[_0x645b('0x46')]=function(_0x4803eb,_0x53a1bc){var _0x58f22={'raw':![],'where':{'id':_0x4803eb[_0x645b('0x47')]['id']}},_0xeadd89={};_0xeadd89[_0x645b('0x31')]=_[_0x645b('0x48')](db[_0x645b('0x2d')][_0x645b('0x2e')]);_0xeadd89['query']=_[_0x645b('0x48')](_0x4803eb[_0x645b('0x32')]);_0xeadd89[_0x645b('0x33')]=_[_0x645b('0x34')](_0xeadd89['model'],_0xeadd89[_0x645b('0x32')]);_0x58f22[_0x645b('0x35')]=_[_0x645b('0x34')](_0xeadd89['model'],qs['fields'](_0x4803eb[_0x645b('0x32')][_0x645b('0x36')]));_0x58f22[_0x645b('0x35')]=_0x58f22['attributes']['length']?_0x58f22[_0x645b('0x35')]:_0xeadd89[_0x645b('0x31')];if(_0x4803eb[_0x645b('0x32')][_0x645b('0x41')]){_0x58f22[_0x645b('0x42')]=[{'all':!![]}];}_0x58f22=_[_0x645b('0x40')]({},_0x58f22,_0x4803eb[_0x645b('0x49')]);return db[_0x645b('0x2d')]['find'](_0x58f22)[_0x645b('0x24')](handleEntityNotFound(_0x53a1bc,null))[_0x645b('0x24')](respondWithResult(_0x53a1bc,null))[_0x645b('0x45')](handleError(_0x53a1bc,null));};exports['create']=function(_0x45cef4,_0x599b28){return db[_0x645b('0x2d')][_0x645b('0x4a')](_0x45cef4[_0x645b('0x4b')],{})[_0x645b('0x24')](respondWithResult(_0x599b28,0xc9))[_0x645b('0x45')](handleError(_0x599b28,null));};exports[_0x645b('0x23')]=function(_0x45880f,_0x230da9){if(_0x45880f[_0x645b('0x4b')]['id']){delete _0x45880f[_0x645b('0x4b')]['id'];}return db[_0x645b('0x2d')][_0x645b('0x4c')]({'where':{'id':_0x45880f[_0x645b('0x47')]['id']}})[_0x645b('0x24')](handleEntityNotFound(_0x230da9,null))[_0x645b('0x24')](saveUpdates(_0x45880f[_0x645b('0x4b')],null))[_0x645b('0x24')](respondWithResult(_0x230da9,null))[_0x645b('0x45')](handleError(_0x230da9,null));};exports['destroy']=function(_0x21265c,_0xdafc43){return db['ServicenowConfiguration']['find']({'where':{'id':_0x21265c['params']['id']}})[_0x645b('0x24')](handleEntityNotFound(_0xdafc43,null))[_0x645b('0x24')](removeEntity(_0xdafc43,null))[_0x645b('0x45')](handleError(_0xdafc43,null));};exports[_0x645b('0x4d')]=function(_0x1388d2,_0x529710,_0x92f902){var _0x3fb338={};var _0x370fa3={};var _0x550a8e;var _0x44e1c4;return db['ServicenowConfiguration'][_0x645b('0x4e')]({'where':{'id':_0x1388d2[_0x645b('0x47')]['id']}})[_0x645b('0x24')](handleEntityNotFound(_0x529710,null))[_0x645b('0x24')](function(_0x21463d){if(_0x21463d){_0x550a8e=_0x21463d;_0x370fa3[_0x645b('0x31')]=_[_0x645b('0x48')](db[_0x645b('0x4f')][_0x645b('0x2e')]);_0x370fa3['query']=_['keys'](_0x1388d2['query']);_0x370fa3[_0x645b('0x33')]=_[_0x645b('0x34')](_0x370fa3['model'],_0x370fa3[_0x645b('0x32')]);_0x3fb338[_0x645b('0x35')]=_[_0x645b('0x34')](_0x370fa3['model'],qs['fields'](_0x1388d2[_0x645b('0x32')][_0x645b('0x36')]));_0x3fb338[_0x645b('0x35')]=_0x3fb338[_0x645b('0x35')]['length']?_0x3fb338[_0x645b('0x35')]:_0x370fa3[_0x645b('0x31')];_0x3fb338[_0x645b('0x3a')]=qs[_0x645b('0x3b')](_0x1388d2[_0x645b('0x32')][_0x645b('0x3b')]);_0x3fb338[_0x645b('0x3c')]=qs[_0x645b('0x33')](_['pick'](_0x1388d2['query'],_0x370fa3[_0x645b('0x33')]));if(_0x1388d2['query']['filter']){_0x3fb338['where']=_[_0x645b('0x40')](_0x3fb338['where'],{'$or':_[_0x645b('0x2c')](_0x3fb338[_0x645b('0x35')],function(_0x56ba16){var _0x335d10={};_0x335d10[_0x56ba16]={'$like':'%'+_0x1388d2[_0x645b('0x32')][_0x645b('0x3f')]+'%'};return _0x335d10;})});}_0x3fb338=_['merge']({},_0x3fb338,_0x1388d2['options']);return _0x550a8e[_0x645b('0x4d')](_0x3fb338);}})['then'](function(_0x182a8d){if(_0x182a8d){_0x44e1c4=_0x182a8d[_0x645b('0x37')];if(!_0x1388d2['query'][_0x645b('0x38')]('nolimit')){_0x3fb338[_0x645b('0x1d')]=qs[_0x645b('0x1d')](_0x1388d2[_0x645b('0x32')][_0x645b('0x1d')]);_0x3fb338['offset']=qs[_0x645b('0x1f')](_0x1388d2[_0x645b('0x32')][_0x645b('0x1f')]);}return _0x550a8e[_0x645b('0x4d')](_0x3fb338);}})[_0x645b('0x24')](function(_0x13d564){if(_0x13d564){return _0x13d564?{'count':_0x44e1c4,'rows':_0x13d564}:null;}})['then'](respondWithResult(_0x529710,null))[_0x645b('0x45')](handleError(_0x529710,null));};exports[_0x645b('0x50')]=function(_0x1e5a20,_0x76a279,_0x12f858){var _0x23d24e={};var _0x1a9b12={};var _0x216bb7;var _0x23807b;return db[_0x645b('0x2d')][_0x645b('0x4e')]({'where':{'id':_0x1e5a20[_0x645b('0x47')]['id']}})[_0x645b('0x24')](handleEntityNotFound(_0x76a279,null))[_0x645b('0x24')](function(_0x5498ab){if(_0x5498ab){_0x216bb7=_0x5498ab;_0x1a9b12[_0x645b('0x31')]=_[_0x645b('0x48')](db[_0x645b('0x4f')]['rawAttributes']);_0x1a9b12[_0x645b('0x32')]=_['keys'](_0x1e5a20[_0x645b('0x32')]);_0x1a9b12[_0x645b('0x33')]=_[_0x645b('0x34')](_0x1a9b12['model'],_0x1a9b12[_0x645b('0x32')]);_0x23d24e[_0x645b('0x35')]=_['intersection'](_0x1a9b12['model'],qs[_0x645b('0x36')](_0x1e5a20[_0x645b('0x32')][_0x645b('0x36')]));_0x23d24e[_0x645b('0x35')]=_0x23d24e[_0x645b('0x35')][_0x645b('0x37')]?_0x23d24e[_0x645b('0x35')]:_0x1a9b12[_0x645b('0x31')];_0x23d24e['order']=qs['sort'](_0x1e5a20[_0x645b('0x32')][_0x645b('0x3b')]);_0x23d24e[_0x645b('0x3c')]=qs[_0x645b('0x33')](_[_0x645b('0x3d')](_0x1e5a20[_0x645b('0x32')],_0x1a9b12['filters']));if(_0x1e5a20[_0x645b('0x32')][_0x645b('0x3f')]){_0x23d24e['where']=_[_0x645b('0x40')](_0x23d24e[_0x645b('0x3c')],{'$or':_[_0x645b('0x2c')](_0x23d24e['attributes'],function(_0x1f47f4){var _0x4e7076={};_0x4e7076[_0x1f47f4]={'$like':'%'+_0x1e5a20[_0x645b('0x32')][_0x645b('0x3f')]+'%'};return _0x4e7076;})});}_0x23d24e=_['merge']({},_0x23d24e,_0x1e5a20[_0x645b('0x49')]);return _0x216bb7['getSubjects'](_0x23d24e);}})[_0x645b('0x24')](function(_0x17fc49){if(_0x17fc49){_0x23807b=_0x17fc49['length'];if(!_0x1e5a20[_0x645b('0x32')][_0x645b('0x38')](_0x645b('0x39'))){_0x23d24e['limit']=qs[_0x645b('0x1d')](_0x1e5a20[_0x645b('0x32')]['limit']);_0x23d24e[_0x645b('0x1f')]=qs['offset'](_0x1e5a20[_0x645b('0x32')]['offset']);}return _0x216bb7['getSubjects'](_0x23d24e);}})[_0x645b('0x24')](function(_0x26b5ba){if(_0x26b5ba){return _0x26b5ba?{'count':_0x23807b,'rows':_0x26b5ba}:null;}})[_0x645b('0x24')](respondWithResult(_0x76a279,null))[_0x645b('0x45')](handleError(_0x76a279,null));};exports['getDescriptions']=function(_0x1f89cf,_0x280747,_0x4ff78f){var _0x2abe68={};var _0x21ac2e={};var _0x4820bc;var _0x39da6e;return db[_0x645b('0x2d')][_0x645b('0x4e')]({'where':{'id':_0x1f89cf[_0x645b('0x47')]['id']}})['then'](handleEntityNotFound(_0x280747,null))[_0x645b('0x24')](function(_0x2d7443){if(_0x2d7443){_0x4820bc=_0x2d7443;_0x21ac2e['model']=_[_0x645b('0x48')](db['ServicenowField']['rawAttributes']);_0x21ac2e[_0x645b('0x32')]=_[_0x645b('0x48')](_0x1f89cf[_0x645b('0x32')]);_0x21ac2e['filters']=_[_0x645b('0x34')](_0x21ac2e['model'],_0x21ac2e['query']);_0x2abe68['attributes']=_[_0x645b('0x34')](_0x21ac2e[_0x645b('0x31')],qs[_0x645b('0x36')](_0x1f89cf[_0x645b('0x32')][_0x645b('0x36')]));_0x2abe68['attributes']=_0x2abe68[_0x645b('0x35')]['length']?_0x2abe68[_0x645b('0x35')]:_0x21ac2e['model'];_0x2abe68[_0x645b('0x3a')]=qs[_0x645b('0x3b')](_0x1f89cf[_0x645b('0x32')][_0x645b('0x3b')]);_0x2abe68['where']=qs[_0x645b('0x33')](_['pick'](_0x1f89cf['query'],_0x21ac2e[_0x645b('0x33')]));if(_0x1f89cf[_0x645b('0x32')][_0x645b('0x3f')]){_0x2abe68[_0x645b('0x3c')]=_[_0x645b('0x40')](_0x2abe68[_0x645b('0x3c')],{'$or':_[_0x645b('0x2c')](_0x2abe68[_0x645b('0x35')],function(_0x47fd77){var _0x37205e={};_0x37205e[_0x47fd77]={'$like':'%'+_0x1f89cf['query'][_0x645b('0x3f')]+'%'};return _0x37205e;})});}_0x2abe68=_['merge']({},_0x2abe68,_0x1f89cf[_0x645b('0x49')]);return _0x4820bc[_0x645b('0x51')](_0x2abe68);}})[_0x645b('0x24')](function(_0x2b6e5f){if(_0x2b6e5f){_0x39da6e=_0x2b6e5f['length'];if(!_0x1f89cf[_0x645b('0x32')][_0x645b('0x38')](_0x645b('0x39'))){_0x2abe68['limit']=qs[_0x645b('0x1d')](_0x1f89cf[_0x645b('0x32')][_0x645b('0x1d')]);_0x2abe68[_0x645b('0x1f')]=qs[_0x645b('0x1f')](_0x1f89cf[_0x645b('0x32')][_0x645b('0x1f')]);}return _0x4820bc[_0x645b('0x51')](_0x2abe68);}})['then'](function(_0x38b713){if(_0x38b713){return _0x38b713?{'count':_0x39da6e,'rows':_0x38b713}:null;}})[_0x645b('0x24')](respondWithResult(_0x280747,null))[_0x645b('0x45')](handleError(_0x280747,null));}; \ No newline at end of file +var _0x0c39=['count','set','Content-Range','apply','reject','save','update','then','end','sendStatus','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','limit','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','findOne','ServicenowField','pick','getFields','getSubjects','getDescriptions','order','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined'];(function(_0x2fb5c3,_0x13c99d){var _0x530f8c=function(_0x564906){while(--_0x564906){_0x2fb5c3['push'](_0x2fb5c3['shift']());}};_0x530f8c(++_0x13c99d);}(_0x0c39,0x130));var _0x90c3=function(_0x2a4dc7,_0x55c293){_0x2a4dc7=_0x2a4dc7-0x0;var _0x578292=_0x0c39[_0x2a4dc7];return _0x578292;};'use strict';var emlformat=require(_0x90c3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x90c3('0x1'));var jsonpatch=require(_0x90c3('0x2'));var rp=require(_0x90c3('0x3'));var moment=require(_0x90c3('0x4'));var BPromise=require(_0x90c3('0x5'));var Mustache=require(_0x90c3('0x6'));var util=require('util');var path=require(_0x90c3('0x7'));var sox=require(_0x90c3('0x8'));var csv=require(_0x90c3('0x9'));var ejs=require(_0x90c3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x90c3('0xb'));var squel=require(_0x90c3('0xc'));var crypto=require(_0x90c3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x90c3('0xe'));var toCsv=require(_0x90c3('0x9'));var querystring=require(_0x90c3('0xf'));var Papa=require(_0x90c3('0x10'));var Redis=require('ioredis');var authService=require(_0x90c3('0x11'));var qs=require(_0x90c3('0x12'));var as=require(_0x90c3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x90c3('0x14'));var config=require(_0x90c3('0x15'));var licenseUtil=require(_0x90c3('0x16'));var db=require(_0x90c3('0x17'))['db'];function respondWithStatusCode(_0x521df1,_0x586955){_0x586955=_0x586955||0xcc;return function(_0x1984ce){if(_0x1984ce){return _0x521df1['sendStatus'](_0x586955);}return _0x521df1[_0x90c3('0x18')](_0x586955)['end']();};}function respondWithResult(_0x3d17b8,_0x223e48){_0x223e48=_0x223e48||0xc8;return function(_0x41675e){if(_0x41675e){return _0x3d17b8[_0x90c3('0x18')](_0x223e48)[_0x90c3('0x19')](_0x41675e);}};}function respondWithFilteredResult(_0x5579d2,_0x3b8d18){return function(_0x1b094d){if(_0x1b094d){var _0x3e71a2=typeof _0x3b8d18[_0x90c3('0x1a')]==='undefined'&&typeof _0x3b8d18['limit']===_0x90c3('0x1b');var _0x440e72=_0x1b094d[_0x90c3('0x1c')];var _0x559d77=_0x3e71a2?0x0:_0x3b8d18['offset'];var _0xe37313=_0x3e71a2?_0x1b094d[_0x90c3('0x1c')]:_0x3b8d18['offset']+_0x3b8d18['limit'];var _0x3535ef;if(_0xe37313>=_0x440e72){_0xe37313=_0x440e72;_0x3535ef=0xc8;}else{_0x3535ef=0xce;}_0x5579d2['status'](_0x3535ef);return _0x5579d2[_0x90c3('0x1d')](_0x90c3('0x1e'),_0x559d77+'-'+_0xe37313+'/'+_0x440e72)['json'](_0x1b094d);}return null;};}function patchUpdates(_0x41ae99){return function(_0x2f39e8){try{jsonpatch[_0x90c3('0x1f')](_0x2f39e8,_0x41ae99,!![]);}catch(_0x3e5dae){return BPromise[_0x90c3('0x20')](_0x3e5dae);}return _0x2f39e8[_0x90c3('0x21')]();};}function saveUpdates(_0x100acd,_0x426dd2){return function(_0x2005a4){if(_0x2005a4){return _0x2005a4[_0x90c3('0x22')](_0x100acd)[_0x90c3('0x23')](function(_0x5c6b93){return _0x5c6b93;});}return null;};}function removeEntity(_0x75def,_0x10e37e){return function(_0x1c84ee){if(_0x1c84ee){return _0x1c84ee['destroy']()[_0x90c3('0x23')](function(){_0x75def[_0x90c3('0x18')](0xcc)[_0x90c3('0x24')]();});}};}function handleEntityNotFound(_0x16c831,_0x36c186){return function(_0x31e5a0){if(!_0x31e5a0){_0x16c831[_0x90c3('0x25')](0x194);}return _0x31e5a0;};}function handleError(_0x1519a4,_0x553c26){_0x553c26=_0x553c26||0x1f4;return function(_0x47d1e5){logger['error'](_0x47d1e5[_0x90c3('0x26')]);if(_0x47d1e5[_0x90c3('0x27')]){delete _0x47d1e5[_0x90c3('0x27')];}_0x1519a4['status'](_0x553c26)[_0x90c3('0x28')](_0x47d1e5);};}exports[_0x90c3('0x29')]=function(_0x4a3e63,_0xae051d){var _0x59ca2a={},_0x1d2ff8={},_0x5945b5={'count':0x0,'rows':[]};var _0x11221f=_[_0x90c3('0x2a')](db[_0x90c3('0x2b')][_0x90c3('0x2c')],function(_0xd05e24){return{'name':_0xd05e24[_0x90c3('0x2d')],'type':_0xd05e24[_0x90c3('0x2e')][_0x90c3('0x2f')]};});_0x1d2ff8[_0x90c3('0x30')]=_[_0x90c3('0x2a')](_0x11221f,_0x90c3('0x27'));_0x1d2ff8[_0x90c3('0x31')]=_[_0x90c3('0x32')](_0x4a3e63[_0x90c3('0x31')]);_0x1d2ff8[_0x90c3('0x33')]=_[_0x90c3('0x34')](_0x1d2ff8[_0x90c3('0x30')],_0x1d2ff8['query']);_0x59ca2a['attributes']=_[_0x90c3('0x34')](_0x1d2ff8['model'],qs[_0x90c3('0x35')](_0x4a3e63[_0x90c3('0x31')]['fields']));_0x59ca2a['attributes']=_0x59ca2a['attributes'][_0x90c3('0x36')]?_0x59ca2a[_0x90c3('0x37')]:_0x1d2ff8[_0x90c3('0x30')];if(!_0x4a3e63[_0x90c3('0x31')][_0x90c3('0x38')](_0x90c3('0x39'))){_0x59ca2a[_0x90c3('0x3a')]=qs['limit'](_0x4a3e63[_0x90c3('0x31')][_0x90c3('0x3a')]);_0x59ca2a['offset']=qs[_0x90c3('0x1a')](_0x4a3e63[_0x90c3('0x31')][_0x90c3('0x1a')]);}_0x59ca2a['order']=qs[_0x90c3('0x3b')](_0x4a3e63['query'][_0x90c3('0x3b')]);_0x59ca2a['where']=qs[_0x90c3('0x33')](_['pick'](_0x4a3e63[_0x90c3('0x31')],_0x1d2ff8['filters']),_0x11221f);if(_0x4a3e63[_0x90c3('0x31')][_0x90c3('0x3c')]){_0x59ca2a[_0x90c3('0x3d')]=_[_0x90c3('0x3e')](_0x59ca2a[_0x90c3('0x3d')],{'$or':_[_0x90c3('0x2a')](_0x11221f,function(_0x57c86c){if(_0x57c86c[_0x90c3('0x2e')]!==_0x90c3('0x3f')){var _0x22c0b6={};_0x22c0b6[_0x57c86c['name']]={'$like':'%'+_0x4a3e63[_0x90c3('0x31')][_0x90c3('0x3c')]+'%'};return _0x22c0b6;}})});}_0x59ca2a=_[_0x90c3('0x3e')]({},_0x59ca2a,_0x4a3e63[_0x90c3('0x40')]);var _0x164ee2={'where':_0x59ca2a['where']};return db[_0x90c3('0x2b')]['count'](_0x164ee2)['then'](function(_0x286dfd){_0x5945b5[_0x90c3('0x1c')]=_0x286dfd;if(_0x4a3e63['query'][_0x90c3('0x41')]){_0x59ca2a[_0x90c3('0x42')]=[{'all':!![]}];}return db[_0x90c3('0x2b')][_0x90c3('0x43')](_0x59ca2a);})[_0x90c3('0x23')](function(_0x56e442){_0x5945b5[_0x90c3('0x44')]=_0x56e442;return _0x5945b5;})[_0x90c3('0x23')](respondWithFilteredResult(_0xae051d,_0x59ca2a))[_0x90c3('0x45')](handleError(_0xae051d,null));};exports[_0x90c3('0x46')]=function(_0x262c70,_0x7dfcb4){var _0x4bd208={'raw':![],'where':{'id':_0x262c70[_0x90c3('0x47')]['id']}},_0x1d07c2={};_0x1d07c2['model']=_[_0x90c3('0x32')](db[_0x90c3('0x2b')]['rawAttributes']);_0x1d07c2[_0x90c3('0x31')]=_[_0x90c3('0x32')](_0x262c70[_0x90c3('0x31')]);_0x1d07c2[_0x90c3('0x33')]=_[_0x90c3('0x34')](_0x1d07c2[_0x90c3('0x30')],_0x1d07c2[_0x90c3('0x31')]);_0x4bd208[_0x90c3('0x37')]=_[_0x90c3('0x34')](_0x1d07c2[_0x90c3('0x30')],qs[_0x90c3('0x35')](_0x262c70[_0x90c3('0x31')]['fields']));_0x4bd208[_0x90c3('0x37')]=_0x4bd208['attributes'][_0x90c3('0x36')]?_0x4bd208[_0x90c3('0x37')]:_0x1d07c2[_0x90c3('0x30')];if(_0x262c70[_0x90c3('0x31')][_0x90c3('0x41')]){_0x4bd208[_0x90c3('0x42')]=[{'all':!![]}];}_0x4bd208=_[_0x90c3('0x3e')]({},_0x4bd208,_0x262c70[_0x90c3('0x40')]);return db[_0x90c3('0x2b')][_0x90c3('0x48')](_0x4bd208)['then'](handleEntityNotFound(_0x7dfcb4,null))[_0x90c3('0x23')](respondWithResult(_0x7dfcb4,null))[_0x90c3('0x45')](handleError(_0x7dfcb4,null));};exports[_0x90c3('0x49')]=function(_0x22077b,_0x12b7d4){return db[_0x90c3('0x2b')][_0x90c3('0x49')](_0x22077b[_0x90c3('0x4a')],{})['then'](respondWithResult(_0x12b7d4,0xc9))[_0x90c3('0x45')](handleError(_0x12b7d4,null));};exports['update']=function(_0x1f740f,_0x18b363){if(_0x1f740f[_0x90c3('0x4a')]['id']){delete _0x1f740f[_0x90c3('0x4a')]['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x1f740f['params']['id']}})[_0x90c3('0x23')](handleEntityNotFound(_0x18b363,null))['then'](saveUpdates(_0x1f740f[_0x90c3('0x4a')],null))[_0x90c3('0x23')](respondWithResult(_0x18b363,null))[_0x90c3('0x45')](handleError(_0x18b363,null));};exports[_0x90c3('0x4b')]=function(_0x1bf97d,_0x39e6a5){return db[_0x90c3('0x2b')]['find']({'where':{'id':_0x1bf97d['params']['id']}})['then'](handleEntityNotFound(_0x39e6a5,null))['then'](removeEntity(_0x39e6a5,null))[_0x90c3('0x45')](handleError(_0x39e6a5,null));};exports['getFields']=function(_0x4ccf1f,_0x5f3960,_0x375d02){var _0x204f27={};var _0x1f9e01={};var _0x3e20b7;var _0x5106cc;return db['ServicenowConfiguration'][_0x90c3('0x4c')]({'where':{'id':_0x4ccf1f[_0x90c3('0x47')]['id']}})[_0x90c3('0x23')](handleEntityNotFound(_0x5f3960,null))[_0x90c3('0x23')](function(_0x1be649){if(_0x1be649){_0x3e20b7=_0x1be649;_0x1f9e01[_0x90c3('0x30')]=_['keys'](db[_0x90c3('0x4d')][_0x90c3('0x2c')]);_0x1f9e01[_0x90c3('0x31')]=_[_0x90c3('0x32')](_0x4ccf1f[_0x90c3('0x31')]);_0x1f9e01['filters']=_['intersection'](_0x1f9e01[_0x90c3('0x30')],_0x1f9e01[_0x90c3('0x31')]);_0x204f27[_0x90c3('0x37')]=_[_0x90c3('0x34')](_0x1f9e01[_0x90c3('0x30')],qs[_0x90c3('0x35')](_0x4ccf1f[_0x90c3('0x31')][_0x90c3('0x35')]));_0x204f27[_0x90c3('0x37')]=_0x204f27[_0x90c3('0x37')][_0x90c3('0x36')]?_0x204f27[_0x90c3('0x37')]:_0x1f9e01[_0x90c3('0x30')];_0x204f27['order']=qs['sort'](_0x4ccf1f[_0x90c3('0x31')][_0x90c3('0x3b')]);_0x204f27[_0x90c3('0x3d')]=qs['filters'](_[_0x90c3('0x4e')](_0x4ccf1f[_0x90c3('0x31')],_0x1f9e01[_0x90c3('0x33')]));if(_0x4ccf1f[_0x90c3('0x31')][_0x90c3('0x3c')]){_0x204f27[_0x90c3('0x3d')]=_[_0x90c3('0x3e')](_0x204f27['where'],{'$or':_[_0x90c3('0x2a')](_0x204f27['attributes'],function(_0x5d273e){var _0x3e13ab={};_0x3e13ab[_0x5d273e]={'$like':'%'+_0x4ccf1f[_0x90c3('0x31')][_0x90c3('0x3c')]+'%'};return _0x3e13ab;})});}_0x204f27=_[_0x90c3('0x3e')]({},_0x204f27,_0x4ccf1f[_0x90c3('0x40')]);return _0x3e20b7[_0x90c3('0x4f')](_0x204f27);}})[_0x90c3('0x23')](function(_0x1c7c94){if(_0x1c7c94){_0x5106cc=_0x1c7c94[_0x90c3('0x36')];if(!_0x4ccf1f[_0x90c3('0x31')]['hasOwnProperty'](_0x90c3('0x39'))){_0x204f27[_0x90c3('0x3a')]=qs['limit'](_0x4ccf1f[_0x90c3('0x31')][_0x90c3('0x3a')]);_0x204f27['offset']=qs[_0x90c3('0x1a')](_0x4ccf1f[_0x90c3('0x31')][_0x90c3('0x1a')]);}return _0x3e20b7[_0x90c3('0x4f')](_0x204f27);}})[_0x90c3('0x23')](function(_0x43beb4){if(_0x43beb4){return _0x43beb4?{'count':_0x5106cc,'rows':_0x43beb4}:null;}})[_0x90c3('0x23')](respondWithResult(_0x5f3960,null))[_0x90c3('0x45')](handleError(_0x5f3960,null));};exports[_0x90c3('0x50')]=function(_0x1a0225,_0x13d408,_0x23d5f4){var _0x288309={};var _0x1ef5e1={};var _0x4d1a36;var _0x5c7cb6;return db[_0x90c3('0x2b')][_0x90c3('0x4c')]({'where':{'id':_0x1a0225[_0x90c3('0x47')]['id']}})[_0x90c3('0x23')](handleEntityNotFound(_0x13d408,null))['then'](function(_0x40f190){if(_0x40f190){_0x4d1a36=_0x40f190;_0x1ef5e1[_0x90c3('0x30')]=_[_0x90c3('0x32')](db[_0x90c3('0x4d')]['rawAttributes']);_0x1ef5e1[_0x90c3('0x31')]=_[_0x90c3('0x32')](_0x1a0225[_0x90c3('0x31')]);_0x1ef5e1[_0x90c3('0x33')]=_[_0x90c3('0x34')](_0x1ef5e1[_0x90c3('0x30')],_0x1ef5e1[_0x90c3('0x31')]);_0x288309['attributes']=_[_0x90c3('0x34')](_0x1ef5e1[_0x90c3('0x30')],qs[_0x90c3('0x35')](_0x1a0225[_0x90c3('0x31')][_0x90c3('0x35')]));_0x288309['attributes']=_0x288309['attributes'][_0x90c3('0x36')]?_0x288309[_0x90c3('0x37')]:_0x1ef5e1[_0x90c3('0x30')];_0x288309['order']=qs['sort'](_0x1a0225[_0x90c3('0x31')][_0x90c3('0x3b')]);_0x288309['where']=qs['filters'](_['pick'](_0x1a0225[_0x90c3('0x31')],_0x1ef5e1[_0x90c3('0x33')]));if(_0x1a0225[_0x90c3('0x31')][_0x90c3('0x3c')]){_0x288309[_0x90c3('0x3d')]=_[_0x90c3('0x3e')](_0x288309[_0x90c3('0x3d')],{'$or':_[_0x90c3('0x2a')](_0x288309[_0x90c3('0x37')],function(_0x451762){var _0x342386={};_0x342386[_0x451762]={'$like':'%'+_0x1a0225['query'][_0x90c3('0x3c')]+'%'};return _0x342386;})});}_0x288309=_[_0x90c3('0x3e')]({},_0x288309,_0x1a0225['options']);return _0x4d1a36[_0x90c3('0x50')](_0x288309);}})[_0x90c3('0x23')](function(_0x43a00f){if(_0x43a00f){_0x5c7cb6=_0x43a00f[_0x90c3('0x36')];if(!_0x1a0225[_0x90c3('0x31')][_0x90c3('0x38')](_0x90c3('0x39'))){_0x288309[_0x90c3('0x3a')]=qs[_0x90c3('0x3a')](_0x1a0225['query'][_0x90c3('0x3a')]);_0x288309['offset']=qs[_0x90c3('0x1a')](_0x1a0225[_0x90c3('0x31')][_0x90c3('0x1a')]);}return _0x4d1a36['getSubjects'](_0x288309);}})[_0x90c3('0x23')](function(_0xd1f9fb){if(_0xd1f9fb){return _0xd1f9fb?{'count':_0x5c7cb6,'rows':_0xd1f9fb}:null;}})[_0x90c3('0x23')](respondWithResult(_0x13d408,null))[_0x90c3('0x45')](handleError(_0x13d408,null));};exports[_0x90c3('0x51')]=function(_0x19b385,_0x11dda5,_0xd11f05){var _0x39ff7a={};var _0x4468a2={};var _0x381966;var _0x7f7325;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x19b385[_0x90c3('0x47')]['id']}})[_0x90c3('0x23')](handleEntityNotFound(_0x11dda5,null))[_0x90c3('0x23')](function(_0x4c4e8a){if(_0x4c4e8a){_0x381966=_0x4c4e8a;_0x4468a2[_0x90c3('0x30')]=_[_0x90c3('0x32')](db[_0x90c3('0x4d')]['rawAttributes']);_0x4468a2[_0x90c3('0x31')]=_[_0x90c3('0x32')](_0x19b385['query']);_0x4468a2[_0x90c3('0x33')]=_[_0x90c3('0x34')](_0x4468a2[_0x90c3('0x30')],_0x4468a2[_0x90c3('0x31')]);_0x39ff7a[_0x90c3('0x37')]=_[_0x90c3('0x34')](_0x4468a2[_0x90c3('0x30')],qs['fields'](_0x19b385[_0x90c3('0x31')][_0x90c3('0x35')]));_0x39ff7a['attributes']=_0x39ff7a[_0x90c3('0x37')]['length']?_0x39ff7a[_0x90c3('0x37')]:_0x4468a2[_0x90c3('0x30')];_0x39ff7a[_0x90c3('0x52')]=qs[_0x90c3('0x3b')](_0x19b385[_0x90c3('0x31')][_0x90c3('0x3b')]);_0x39ff7a['where']=qs[_0x90c3('0x33')](_[_0x90c3('0x4e')](_0x19b385[_0x90c3('0x31')],_0x4468a2['filters']));if(_0x19b385[_0x90c3('0x31')][_0x90c3('0x3c')]){_0x39ff7a[_0x90c3('0x3d')]=_[_0x90c3('0x3e')](_0x39ff7a[_0x90c3('0x3d')],{'$or':_[_0x90c3('0x2a')](_0x39ff7a[_0x90c3('0x37')],function(_0x95f7f){var _0x2e5bbc={};_0x2e5bbc[_0x95f7f]={'$like':'%'+_0x19b385[_0x90c3('0x31')]['filter']+'%'};return _0x2e5bbc;})});}_0x39ff7a=_[_0x90c3('0x3e')]({},_0x39ff7a,_0x19b385[_0x90c3('0x40')]);return _0x381966[_0x90c3('0x51')](_0x39ff7a);}})['then'](function(_0x4ca942){if(_0x4ca942){_0x7f7325=_0x4ca942[_0x90c3('0x36')];if(!_0x19b385[_0x90c3('0x31')][_0x90c3('0x38')]('nolimit')){_0x39ff7a[_0x90c3('0x3a')]=qs[_0x90c3('0x3a')](_0x19b385['query'][_0x90c3('0x3a')]);_0x39ff7a[_0x90c3('0x1a')]=qs[_0x90c3('0x1a')](_0x19b385[_0x90c3('0x31')][_0x90c3('0x1a')]);}return _0x381966[_0x90c3('0x51')](_0x39ff7a);}})[_0x90c3('0x23')](function(_0x34e869){if(_0x34e869){return _0x34e869?{'count':_0x7f7325,'rows':_0x34e869}:null;}})[_0x90c3('0x23')](respondWithResult(_0x11dda5,null))['catch'](handleError(_0x11dda5,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 93e8e8f..0d85cc2 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 _0x39c4=['ServicenowConfiguration','int_servicenow_configurations','util','moment','bluebird','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define'];(function(_0x5d0b9c,_0x1d45a8){var _0x7ceeca=function(_0x5ba763){while(--_0x5ba763){_0x5d0b9c['push'](_0x5d0b9c['shift']());}};_0x7ceeca(++_0x1d45a8);}(_0x39c4,0x174));var _0x439c=function(_0x2f4667,_0xb7e42){_0x2f4667=_0x2f4667-0x0;var _0x41ef3e=_0x39c4[_0x2f4667];return _0x41ef3e;};'use strict';var _=require('lodash');var util=require(_0x439c('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x439c('0x1'));var BPromise=require(_0x439c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x439c('0x3'));var config=require(_0x439c('0x4'));var attributes=require(_0x439c('0x5'));module[_0x439c('0x6')]=function(_0x105a46,_0x387467){return _0x105a46[_0x439c('0x7')](_0x439c('0x8'),attributes,{'tableName':_0x439c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x317b=['util','api','moment','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x317b,0x1c7));var _0xb317=function(_0xfdaf18,_0x4de08d){_0xfdaf18=_0xfdaf18-0x0;var _0x26e427=_0x317b[_0xfdaf18];return _0x26e427;};'use strict';var _=require(_0xb317('0x0'));var util=require(_0xb317('0x1'));var logger=require('../../config/logger')(_0xb317('0x2'));var moment=require(_0xb317('0x3'));var BPromise=require('bluebird');var rp=require(_0xb317('0x4'));var fs=require('fs');var path=require(_0xb317('0x5'));var rimraf=require(_0xb317('0x6'));var config=require(_0xb317('0x7'));var attributes=require(_0xb317('0x8'));module[_0xb317('0x9')]=function(_0x2904b8,_0x33ed9c){return _0x2904b8[_0xb317('0xa')](_0xb317('0xb'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 74d299c..a70e5a9 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 _0xc7dd=['ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info'];(function(_0xc1272c,_0x37d921){var _0x247520=function(_0x5223a0){while(--_0x5223a0){_0xc1272c['push'](_0xc1272c['shift']());}};_0x247520(++_0x37d921);}(_0xc7dd,0x15d));var _0xdc7d=function(_0x3774c7,_0x361f2b){_0x3774c7=_0x3774c7-0x0;var _0x1db61e=_0xc7dd[_0x3774c7];return _0x1db61e;};'use strict';var _=require(_0xdc7d('0x0'));var util=require(_0xdc7d('0x1'));var moment=require('moment');var BPromise=require(_0xdc7d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdc7d('0x3'))['db'];var utils=require(_0xdc7d('0x4'));var logger=require('../../config/logger')(_0xdc7d('0x5'));var config=require(_0xdc7d('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdc7d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x563446,_0x35c7f9,_0x2fecb4){return new BPromise(function(_0x213c25,_0x4acc5f){return client[_0xdc7d('0x8')](_0x563446,_0x2fecb4)[_0xdc7d('0x9')](function(_0x531c3e){logger[_0xdc7d('0xa')](_0xdc7d('0xb'),_0x35c7f9,'request\x20sent');logger[_0xdc7d('0xc')](_0xdc7d('0xd'),_0x35c7f9,'request\x20sent',JSON['stringify'](_0x531c3e));if(_0x531c3e[_0xdc7d('0xe')]){if(_0x531c3e[_0xdc7d('0xe')][_0xdc7d('0xf')]===0x1f4){logger[_0xdc7d('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x35c7f9,_0x531c3e[_0xdc7d('0xe')][_0xdc7d('0x10')]);return _0x4acc5f(_0x531c3e[_0xdc7d('0xe')][_0xdc7d('0x10')]);}logger[_0xdc7d('0xe')](_0xdc7d('0xb'),_0x35c7f9,_0x531c3e['error']['message']);return _0x213c25(_0x531c3e[_0xdc7d('0xe')][_0xdc7d('0x10')]);}else{logger[_0xdc7d('0xa')](_0xdc7d('0xb'),_0x35c7f9,_0xdc7d('0x11'));_0x213c25(_0x531c3e[_0xdc7d('0x12')][_0xdc7d('0x10')]);}})[_0xdc7d('0x13')](function(_0x9f8765){logger[_0xdc7d('0xe')](_0xdc7d('0xb'),_0x35c7f9,_0x9f8765);_0x4acc5f(_0x9f8765);});});} \ No newline at end of file +var _0xbc29=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xbc29,0xd0));var _0x9bc2=function(_0x9ab250,_0xbd9990){_0x9ab250=_0x9ab250-0x0;var _0x45fd9f=_0xbc29[_0x9ab250];return _0x45fd9f;};'use strict';var _=require(_0x9bc2('0x0'));var util=require(_0x9bc2('0x1'));var moment=require(_0x9bc2('0x2'));var BPromise=require(_0x9bc2('0x3'));var rs=require(_0x9bc2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9bc2('0x5'))['db'];var utils=require(_0x9bc2('0x6'));var logger=require(_0x9bc2('0x7'))(_0x9bc2('0x8'));var config=require(_0x9bc2('0x9'));var jayson=require(_0x9bc2('0xa'));var client=jayson['client'][_0x9bc2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46ee5c,_0x11e737,_0x5563e5){return new BPromise(function(_0x39e14e,_0x263cfd){return client[_0x9bc2('0xc')](_0x46ee5c,_0x5563e5)['then'](function(_0x40dce6){logger[_0x9bc2('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x11e737,_0x9bc2('0xe'));logger[_0x9bc2('0xf')](_0x9bc2('0x10'),_0x11e737,'request\x20sent',JSON[_0x9bc2('0x11')](_0x40dce6));if(_0x40dce6[_0x9bc2('0x12')]){if(_0x40dce6[_0x9bc2('0x12')][_0x9bc2('0x13')]===0x1f4){logger[_0x9bc2('0x12')](_0x9bc2('0x14'),_0x11e737,_0x40dce6[_0x9bc2('0x12')][_0x9bc2('0x15')]);return _0x263cfd(_0x40dce6[_0x9bc2('0x12')][_0x9bc2('0x15')]);}logger[_0x9bc2('0x12')](_0x9bc2('0x14'),_0x11e737,_0x40dce6[_0x9bc2('0x12')]['message']);return _0x39e14e(_0x40dce6[_0x9bc2('0x12')][_0x9bc2('0x15')]);}else{logger['info'](_0x9bc2('0x14'),_0x11e737,_0x9bc2('0xe'));_0x39e14e(_0x40dce6['result'][_0x9bc2('0x15')]);}})[_0x9bc2('0x16')](function(_0x12c047){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x11e737,_0x12c047);_0x263cfd(_0x12c047);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 55934d3..b7bdb38 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 _0xd831=['index','show','post','create','put','/:id','isAuthenticated','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller'];(function(_0x5d6455,_0x49bf23){var _0x4330af=function(_0x3136f3){while(--_0x3136f3){_0x5d6455['push'](_0x5d6455['shift']());}};_0x4330af(++_0x49bf23);}(_0xd831,0xd5));var _0x1d83=function(_0xd68a4,_0x5543f0){_0xd68a4=_0xd68a4-0x0;var _0x2f21b6=_0xd831[_0xd68a4];return _0x2f21b6;};'use strict';var multer=require(_0x1d83('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1d83('0x1'));var express=require(_0x1d83('0x2'));var router=express['Router']();var fs_extra=require(_0x1d83('0x3'));var auth=require(_0x1d83('0x4'));var interaction=require(_0x1d83('0x5'));var config=require(_0x1d83('0x6'));var controller=require(_0x1d83('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x1d83('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x1d83('0x9')]);router[_0x1d83('0xa')]('/',auth['isAuthenticated'](),controller[_0x1d83('0xb')]);router[_0x1d83('0xc')](_0x1d83('0xd'),auth[_0x1d83('0xe')](),controller['update']);router['delete']('/:id',auth[_0x1d83('0xe')](),controller[_0x1d83('0xf')]);module[_0x1d83('0x10')]=router; \ No newline at end of file +var _0x7ace=['destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','show','post','/:id','update','delete'];(function(_0x5a636f,_0x3fec2b){var _0x6a8cfb=function(_0x20e6ca){while(--_0x20e6ca){_0x5a636f['push'](_0x5a636f['shift']());}};_0x6a8cfb(++_0x3fec2b);}(_0x7ace,0x169));var _0xe7ac=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7ace[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0xe7ac('0x0'));var util=require(_0xe7ac('0x1'));var path=require(_0xe7ac('0x2'));var timeout=require(_0xe7ac('0x3'));var express=require(_0xe7ac('0x4'));var router=express['Router']();var fs_extra=require(_0xe7ac('0x5'));var auth=require(_0xe7ac('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe7ac('0x7'));var controller=require(_0xe7ac('0x8'));router[_0xe7ac('0x9')]('/',auth[_0xe7ac('0xa')](),controller[_0xe7ac('0xb')]);router[_0xe7ac('0x9')]('/:id',auth[_0xe7ac('0xa')](),controller[_0xe7ac('0xc')]);router[_0xe7ac('0xd')]('/',auth[_0xe7ac('0xa')](),controller['create']);router['put'](_0xe7ac('0xe'),auth[_0xe7ac('0xa')](),controller[_0xe7ac('0xf')]);router[_0xe7ac('0x10')](_0xe7ac('0xe'),auth[_0xe7ac('0xa')](),controller[_0xe7ac('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 106a879..f1abed5 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 _0x1293=['string','STRING','ENUM','BOOLEAN','exports','variable','customVariable','keyValue','picklist'];(function(_0x1781de,_0x5c4b38){var _0x48d7fc=function(_0x7becb5){while(--_0x7becb5){_0x1781de['push'](_0x1781de['shift']());}};_0x48d7fc(++_0x5c4b38);}(_0x1293,0x1bd));var _0x3129=function(_0x37e4c5,_0x278256){_0x37e4c5=_0x37e4c5-0x0;var _0x2a93ea=_0x1293[_0x37e4c5];return _0x2a93ea;};'use strict';var Sequelize=require('sequelize');module[_0x3129('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0x3129('0x1'),_0x3129('0x2'),_0x3129('0x3'),_0x3129('0x4')),'defaultValue':_0x3129('0x5')},'content':{'type':Sequelize[_0x3129('0x6')]},'key':{'type':Sequelize[_0x3129('0x6')]},'keyType':{'type':Sequelize[_0x3129('0x7')](_0x3129('0x5'),_0x3129('0x1'),_0x3129('0x2'))},'keyContent':{'type':Sequelize[_0x3129('0x6')]},'idField':{'type':Sequelize[_0x3129('0x6')]},'nameField':{'type':Sequelize[_0x3129('0x6')]},'customField':{'type':Sequelize[_0x3129('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x715b=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x266172,_0xdedc75){var _0x54ee01=function(_0xe54d62){while(--_0xe54d62){_0x266172['push'](_0x266172['shift']());}};_0x54ee01(++_0xdedc75);}(_0x715b,0x1c0));var _0xb715=function(_0x48bbaa,_0x151240){_0x48bbaa=_0x48bbaa-0x0;var _0x3360e1=_0x715b[_0x48bbaa];return _0x3360e1;};'use strict';var Sequelize=require(_0xb715('0x0'));module['exports']={'type':{'type':Sequelize[_0xb715('0x1')](_0xb715('0x2'),_0xb715('0x3'),_0xb715('0x4'),_0xb715('0x5'),_0xb715('0x6')),'defaultValue':_0xb715('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb715('0x7')]},'keyType':{'type':Sequelize[_0xb715('0x1')](_0xb715('0x2'),_0xb715('0x3'),_0xb715('0x4'))},'keyContent':{'type':Sequelize[_0xb715('0x7')]},'idField':{'type':Sequelize[_0xb715('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb715('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 12f5f2a..c204d24 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 _0xfa13=['where','VIRTUAL','options','includeAll','rows','catch','params','include','merge','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','pick','filter'];(function(_0x56c35e,_0x25323c){var _0x1ca65b=function(_0x457946){while(--_0x457946){_0x56c35e['push'](_0x56c35e['shift']());}};_0x1ca65b(++_0x25323c);}(_0xfa13,0x183));var _0x3fa1=function(_0x3119f6,_0x57b8b5){_0x3119f6=_0x3119f6-0x0;var _0x4c5a4a=_0xfa13[_0x3119f6];return _0x4c5a4a;};'use strict';var emlformat=require(_0x3fa1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3fa1('0x1'));var jsonpatch=require(_0x3fa1('0x2'));var rp=require(_0x3fa1('0x3'));var moment=require(_0x3fa1('0x4'));var BPromise=require(_0x3fa1('0x5'));var Mustache=require(_0x3fa1('0x6'));var util=require('util');var path=require(_0x3fa1('0x7'));var sox=require(_0x3fa1('0x8'));var csv=require(_0x3fa1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3fa1('0xa'));var _=require('lodash');var squel=require(_0x3fa1('0xb'));var crypto=require(_0x3fa1('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3fa1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3fa1('0xe'));var Papa=require('papaparse');var Redis=require(_0x3fa1('0xf'));var authService=require(_0x3fa1('0x10'));var qs=require(_0x3fa1('0x11'));var as=require(_0x3fa1('0x12'));var hardwareService=require(_0x3fa1('0x13'));var logger=require(_0x3fa1('0x14'))(_0x3fa1('0x15'));var utils=require(_0x3fa1('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3fa1('0x17'));var db=require(_0x3fa1('0x18'))['db'];function respondWithStatusCode(_0x435900,_0x44f0bd){_0x44f0bd=_0x44f0bd||0xcc;return function(_0x607e57){if(_0x607e57){return _0x435900[_0x3fa1('0x19')](_0x44f0bd);}return _0x435900[_0x3fa1('0x1a')](_0x44f0bd)[_0x3fa1('0x1b')]();};}function respondWithResult(_0x2ee03b,_0x42bd6a){_0x42bd6a=_0x42bd6a||0xc8;return function(_0x272159){if(_0x272159){return _0x2ee03b[_0x3fa1('0x1a')](_0x42bd6a)['json'](_0x272159);}};}function respondWithFilteredResult(_0x1c0c6b,_0x14fc95){return function(_0x4c0348){if(_0x4c0348){var _0x2e959c=typeof _0x14fc95[_0x3fa1('0x1c')]===_0x3fa1('0x1d')&&typeof _0x14fc95[_0x3fa1('0x1e')]===_0x3fa1('0x1d');var _0x18fd9e=_0x4c0348[_0x3fa1('0x1f')];var _0x3c7d19=_0x2e959c?0x0:_0x14fc95['offset'];var _0x50ed76=_0x2e959c?_0x4c0348['count']:_0x14fc95[_0x3fa1('0x1c')]+_0x14fc95[_0x3fa1('0x1e')];var _0x150796;if(_0x50ed76>=_0x18fd9e){_0x50ed76=_0x18fd9e;_0x150796=0xc8;}else{_0x150796=0xce;}_0x1c0c6b[_0x3fa1('0x1a')](_0x150796);return _0x1c0c6b[_0x3fa1('0x20')](_0x3fa1('0x21'),_0x3c7d19+'-'+_0x50ed76+'/'+_0x18fd9e)[_0x3fa1('0x22')](_0x4c0348);}return null;};}function patchUpdates(_0x4ea709){return function(_0x43b2d9){try{jsonpatch[_0x3fa1('0x23')](_0x43b2d9,_0x4ea709,!![]);}catch(_0x1c49fe){return BPromise[_0x3fa1('0x24')](_0x1c49fe);}return _0x43b2d9[_0x3fa1('0x25')]();};}function saveUpdates(_0x5dbffa,_0x1b942b){return function(_0x245194){if(_0x245194){return _0x245194[_0x3fa1('0x26')](_0x5dbffa)[_0x3fa1('0x27')](function(_0x143243){return _0x143243;});}return null;};}function removeEntity(_0x6d70b3,_0x1af356){return function(_0x3a9824){if(_0x3a9824){return _0x3a9824[_0x3fa1('0x28')]()[_0x3fa1('0x27')](function(){_0x6d70b3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59783d,_0x4ecc8e){return function(_0x36f0e6){if(!_0x36f0e6){_0x59783d[_0x3fa1('0x19')](0x194);}return _0x36f0e6;};}function handleError(_0xc6be36,_0x131674){_0x131674=_0x131674||0x1f4;return function(_0x494670){logger['error'](_0x494670[_0x3fa1('0x29')]);if(_0x494670[_0x3fa1('0x2a')]){delete _0x494670[_0x3fa1('0x2a')];}_0xc6be36[_0x3fa1('0x1a')](_0x131674)[_0x3fa1('0x2b')](_0x494670);};}exports[_0x3fa1('0x2c')]=function(_0x577bf8,_0x118488){var _0x57955c={},_0x57d064={},_0x1de182={'count':0x0,'rows':[]};var _0x4cc936=_[_0x3fa1('0x2d')](db[_0x3fa1('0x2e')][_0x3fa1('0x2f')],function(_0x2e6f7f){return{'name':_0x2e6f7f[_0x3fa1('0x30')],'type':_0x2e6f7f[_0x3fa1('0x31')][_0x3fa1('0x32')]};});_0x57d064[_0x3fa1('0x33')]=_[_0x3fa1('0x2d')](_0x4cc936,_0x3fa1('0x2a'));_0x57d064['query']=_[_0x3fa1('0x34')](_0x577bf8[_0x3fa1('0x35')]);_0x57d064[_0x3fa1('0x36')]=_[_0x3fa1('0x37')](_0x57d064[_0x3fa1('0x33')],_0x57d064[_0x3fa1('0x35')]);_0x57955c[_0x3fa1('0x38')]=_[_0x3fa1('0x37')](_0x57d064[_0x3fa1('0x33')],qs[_0x3fa1('0x39')](_0x577bf8[_0x3fa1('0x35')][_0x3fa1('0x39')]));_0x57955c['attributes']=_0x57955c[_0x3fa1('0x38')][_0x3fa1('0x3a')]?_0x57955c[_0x3fa1('0x38')]:_0x57d064[_0x3fa1('0x33')];if(!_0x577bf8[_0x3fa1('0x35')][_0x3fa1('0x3b')](_0x3fa1('0x3c'))){_0x57955c[_0x3fa1('0x1e')]=qs[_0x3fa1('0x1e')](_0x577bf8[_0x3fa1('0x35')][_0x3fa1('0x1e')]);_0x57955c[_0x3fa1('0x1c')]=qs['offset'](_0x577bf8[_0x3fa1('0x35')][_0x3fa1('0x1c')]);}_0x57955c['order']=qs['sort'](_0x577bf8['query']['sort']);_0x57955c['where']=qs[_0x3fa1('0x36')](_[_0x3fa1('0x3d')](_0x577bf8[_0x3fa1('0x35')],_0x57d064[_0x3fa1('0x36')]),_0x4cc936);if(_0x577bf8['query'][_0x3fa1('0x3e')]){_0x57955c[_0x3fa1('0x3f')]=_['merge'](_0x57955c[_0x3fa1('0x3f')],{'$or':_[_0x3fa1('0x2d')](_0x4cc936,function(_0x41e1ff){if(_0x41e1ff[_0x3fa1('0x31')]!==_0x3fa1('0x40')){var _0x4a37f5={};_0x4a37f5[_0x41e1ff['name']]={'$like':'%'+_0x577bf8[_0x3fa1('0x35')][_0x3fa1('0x3e')]+'%'};return _0x4a37f5;}})});}_0x57955c=_['merge']({},_0x57955c,_0x577bf8[_0x3fa1('0x41')]);var _0x20bbc1={'where':_0x57955c[_0x3fa1('0x3f')]};return db['ServicenowField'][_0x3fa1('0x1f')](_0x20bbc1)['then'](function(_0x126e8d){_0x1de182[_0x3fa1('0x1f')]=_0x126e8d;if(_0x577bf8[_0x3fa1('0x35')][_0x3fa1('0x42')]){_0x57955c['include']=[{'all':!![]}];}return db[_0x3fa1('0x2e')]['findAll'](_0x57955c);})['then'](function(_0x1be364){_0x1de182[_0x3fa1('0x43')]=_0x1be364;return _0x1de182;})[_0x3fa1('0x27')](respondWithFilteredResult(_0x118488,_0x57955c))[_0x3fa1('0x44')](handleError(_0x118488,null));};exports['show']=function(_0x38b070,_0x4603e2){var _0x52e2a9={'raw':!![],'where':{'id':_0x38b070[_0x3fa1('0x45')]['id']}},_0xabc1ac={};_0xabc1ac[_0x3fa1('0x33')]=_[_0x3fa1('0x34')](db[_0x3fa1('0x2e')][_0x3fa1('0x2f')]);_0xabc1ac[_0x3fa1('0x35')]=_[_0x3fa1('0x34')](_0x38b070['query']);_0xabc1ac['filters']=_[_0x3fa1('0x37')](_0xabc1ac[_0x3fa1('0x33')],_0xabc1ac[_0x3fa1('0x35')]);_0x52e2a9[_0x3fa1('0x38')]=_[_0x3fa1('0x37')](_0xabc1ac['model'],qs[_0x3fa1('0x39')](_0x38b070['query'][_0x3fa1('0x39')]));_0x52e2a9[_0x3fa1('0x38')]=_0x52e2a9[_0x3fa1('0x38')][_0x3fa1('0x3a')]?_0x52e2a9[_0x3fa1('0x38')]:_0xabc1ac[_0x3fa1('0x33')];if(_0x38b070[_0x3fa1('0x35')][_0x3fa1('0x42')]){_0x52e2a9[_0x3fa1('0x46')]=[{'all':!![]}];}_0x52e2a9=_[_0x3fa1('0x47')]({},_0x52e2a9,_0x38b070['options']);return db[_0x3fa1('0x2e')][_0x3fa1('0x48')](_0x52e2a9)['then'](handleEntityNotFound(_0x4603e2,null))[_0x3fa1('0x27')](respondWithResult(_0x4603e2,null))[_0x3fa1('0x44')](handleError(_0x4603e2,null));};exports[_0x3fa1('0x49')]=function(_0x2f234d,_0x54487d){return db[_0x3fa1('0x2e')][_0x3fa1('0x49')](_0x2f234d[_0x3fa1('0x4a')],{})[_0x3fa1('0x27')](respondWithResult(_0x54487d,0xc9))[_0x3fa1('0x44')](handleError(_0x54487d,null));};exports[_0x3fa1('0x26')]=function(_0x4b3366,_0x2ee779){if(_0x4b3366[_0x3fa1('0x4a')]['id']){delete _0x4b3366[_0x3fa1('0x4a')]['id'];}return db['ServicenowField'][_0x3fa1('0x48')]({'where':{'id':_0x4b3366[_0x3fa1('0x45')]['id']}})[_0x3fa1('0x27')](handleEntityNotFound(_0x2ee779,null))[_0x3fa1('0x27')](saveUpdates(_0x4b3366[_0x3fa1('0x4a')],null))['then'](respondWithResult(_0x2ee779,null))[_0x3fa1('0x44')](handleError(_0x2ee779,null));};exports[_0x3fa1('0x28')]=function(_0x573044,_0x346348){return db[_0x3fa1('0x2e')][_0x3fa1('0x48')]({'where':{'id':_0x573044[_0x3fa1('0x45')]['id']}})[_0x3fa1('0x27')](handleEntityNotFound(_0x346348,null))[_0x3fa1('0x27')](removeEntity(_0x346348,null))['catch'](handleError(_0x346348,null));}; \ No newline at end of file +var _0x0a48=['set','json','reject','save','update','then','destroy','error','name','send','index','map','ServicenowField','rawAttributes','type','query','keys','model','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','fields','find','catch','create','body','eml-format','rimraf','zip-dir','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count'];(function(_0x67d3e6,_0x32de47){var _0x37b84e=function(_0x476321){while(--_0x476321){_0x67d3e6['push'](_0x67d3e6['shift']());}};_0x37b84e(++_0x32de47);}(_0x0a48,0x6e));var _0x80a4=function(_0x3e1c4c,_0x3a27fc){_0x3e1c4c=_0x3e1c4c-0x0;var _0x4ff014=_0x0a48[_0x3e1c4c];return _0x4ff014;};'use strict';var emlformat=require(_0x80a4('0x0'));var rimraf=require(_0x80a4('0x1'));var zipdir=require(_0x80a4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x80a4('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x80a4('0x4'));var path=require(_0x80a4('0x5'));var sox=require(_0x80a4('0x6'));var csv=require(_0x80a4('0x7'));var ejs=require(_0x80a4('0x8'));var fs=require('fs');var fs_extra=require(_0x80a4('0x9'));var _=require(_0x80a4('0xa'));var squel=require(_0x80a4('0xb'));var crypto=require(_0x80a4('0xc'));var jsforce=require(_0x80a4('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x80a4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x80a4('0xf'));var hardwareService=require(_0x80a4('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x80a4('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x80a4('0x12'));var db=require(_0x80a4('0x13'))['db'];function respondWithStatusCode(_0x389b16,_0x4314c2){_0x4314c2=_0x4314c2||0xcc;return function(_0x5690da){if(_0x5690da){return _0x389b16['sendStatus'](_0x4314c2);}return _0x389b16['status'](_0x4314c2)[_0x80a4('0x14')]();};}function respondWithResult(_0x514059,_0x3e96f5){_0x3e96f5=_0x3e96f5||0xc8;return function(_0x8f9f29){if(_0x8f9f29){return _0x514059[_0x80a4('0x15')](_0x3e96f5)['json'](_0x8f9f29);}};}function respondWithFilteredResult(_0x557148,_0x5411df){return function(_0x5a0ac2){if(_0x5a0ac2){var _0x4bfe9d=typeof _0x5411df[_0x80a4('0x16')]===_0x80a4('0x17')&&typeof _0x5411df[_0x80a4('0x18')]===_0x80a4('0x17');var _0x307d86=_0x5a0ac2[_0x80a4('0x19')];var _0x5881a8=_0x4bfe9d?0x0:_0x5411df['offset'];var _0x40ab41=_0x4bfe9d?_0x5a0ac2['count']:_0x5411df['offset']+_0x5411df[_0x80a4('0x18')];var _0x5bb9ad;if(_0x40ab41>=_0x307d86){_0x40ab41=_0x307d86;_0x5bb9ad=0xc8;}else{_0x5bb9ad=0xce;}_0x557148[_0x80a4('0x15')](_0x5bb9ad);return _0x557148[_0x80a4('0x1a')]('Content-Range',_0x5881a8+'-'+_0x40ab41+'/'+_0x307d86)[_0x80a4('0x1b')](_0x5a0ac2);}return null;};}function patchUpdates(_0x27b0fd){return function(_0x25bd85){try{jsonpatch['apply'](_0x25bd85,_0x27b0fd,!![]);}catch(_0x2898b7){return BPromise[_0x80a4('0x1c')](_0x2898b7);}return _0x25bd85[_0x80a4('0x1d')]();};}function saveUpdates(_0x6597be,_0x58f393){return function(_0x8faf40){if(_0x8faf40){return _0x8faf40[_0x80a4('0x1e')](_0x6597be)[_0x80a4('0x1f')](function(_0x1cf4de){return _0x1cf4de;});}return null;};}function removeEntity(_0x3097c3,_0x2263b8){return function(_0x3c3a86){if(_0x3c3a86){return _0x3c3a86[_0x80a4('0x20')]()[_0x80a4('0x1f')](function(){_0x3097c3[_0x80a4('0x15')](0xcc)[_0x80a4('0x14')]();});}};}function handleEntityNotFound(_0x2d201d,_0x48e2f9){return function(_0x4bb3e9){if(!_0x4bb3e9){_0x2d201d['sendStatus'](0x194);}return _0x4bb3e9;};}function handleError(_0x4102d0,_0x201b8a){_0x201b8a=_0x201b8a||0x1f4;return function(_0x53665e){logger[_0x80a4('0x21')](_0x53665e['stack']);if(_0x53665e[_0x80a4('0x22')]){delete _0x53665e[_0x80a4('0x22')];}_0x4102d0[_0x80a4('0x15')](_0x201b8a)[_0x80a4('0x23')](_0x53665e);};}exports[_0x80a4('0x24')]=function(_0x3c77da,_0xe4de41){var _0x321272={},_0x5849ef={},_0x24031f={'count':0x0,'rows':[]};var _0x2081a9=_[_0x80a4('0x25')](db[_0x80a4('0x26')][_0x80a4('0x27')],function(_0x349a70){return{'name':_0x349a70['fieldName'],'type':_0x349a70[_0x80a4('0x28')]['key']};});_0x5849ef['model']=_[_0x80a4('0x25')](_0x2081a9,_0x80a4('0x22'));_0x5849ef[_0x80a4('0x29')]=_[_0x80a4('0x2a')](_0x3c77da[_0x80a4('0x29')]);_0x5849ef['filters']=_['intersection'](_0x5849ef[_0x80a4('0x2b')],_0x5849ef[_0x80a4('0x29')]);_0x321272['attributes']=_[_0x80a4('0x2c')](_0x5849ef['model'],qs['fields'](_0x3c77da[_0x80a4('0x29')]['fields']));_0x321272[_0x80a4('0x2d')]=_0x321272[_0x80a4('0x2d')][_0x80a4('0x2e')]?_0x321272[_0x80a4('0x2d')]:_0x5849ef[_0x80a4('0x2b')];if(!_0x3c77da[_0x80a4('0x29')][_0x80a4('0x2f')](_0x80a4('0x30'))){_0x321272[_0x80a4('0x18')]=qs['limit'](_0x3c77da[_0x80a4('0x29')][_0x80a4('0x18')]);_0x321272[_0x80a4('0x16')]=qs['offset'](_0x3c77da['query'][_0x80a4('0x16')]);}_0x321272[_0x80a4('0x31')]=qs[_0x80a4('0x32')](_0x3c77da[_0x80a4('0x29')]['sort']);_0x321272[_0x80a4('0x33')]=qs[_0x80a4('0x34')](_[_0x80a4('0x35')](_0x3c77da[_0x80a4('0x29')],_0x5849ef['filters']),_0x2081a9);if(_0x3c77da[_0x80a4('0x29')][_0x80a4('0x36')]){_0x321272[_0x80a4('0x33')]=_[_0x80a4('0x37')](_0x321272['where'],{'$or':_[_0x80a4('0x25')](_0x2081a9,function(_0x21fb4c){if(_0x21fb4c[_0x80a4('0x28')]!==_0x80a4('0x38')){var _0x5297bf={};_0x5297bf[_0x21fb4c[_0x80a4('0x22')]]={'$like':'%'+_0x3c77da['query'][_0x80a4('0x36')]+'%'};return _0x5297bf;}})});}_0x321272=_[_0x80a4('0x37')]({},_0x321272,_0x3c77da[_0x80a4('0x39')]);var _0x2c16ac={'where':_0x321272[_0x80a4('0x33')]};return db[_0x80a4('0x26')][_0x80a4('0x19')](_0x2c16ac)[_0x80a4('0x1f')](function(_0x2a9f38){_0x24031f['count']=_0x2a9f38;if(_0x3c77da['query'][_0x80a4('0x3a')]){_0x321272[_0x80a4('0x3b')]=[{'all':!![]}];}return db[_0x80a4('0x26')][_0x80a4('0x3c')](_0x321272);})[_0x80a4('0x1f')](function(_0x3d65fb){_0x24031f[_0x80a4('0x3d')]=_0x3d65fb;return _0x24031f;})[_0x80a4('0x1f')](respondWithFilteredResult(_0xe4de41,_0x321272))['catch'](handleError(_0xe4de41,null));};exports['show']=function(_0x45202c,_0x15e6ff){var _0x1720eb={'raw':!![],'where':{'id':_0x45202c[_0x80a4('0x3e')]['id']}},_0x279f51={};_0x279f51['model']=_[_0x80a4('0x2a')](db[_0x80a4('0x26')]['rawAttributes']);_0x279f51[_0x80a4('0x29')]=_['keys'](_0x45202c[_0x80a4('0x29')]);_0x279f51['filters']=_['intersection'](_0x279f51[_0x80a4('0x2b')],_0x279f51['query']);_0x1720eb[_0x80a4('0x2d')]=_['intersection'](_0x279f51[_0x80a4('0x2b')],qs[_0x80a4('0x3f')](_0x45202c[_0x80a4('0x29')]['fields']));_0x1720eb[_0x80a4('0x2d')]=_0x1720eb[_0x80a4('0x2d')][_0x80a4('0x2e')]?_0x1720eb[_0x80a4('0x2d')]:_0x279f51[_0x80a4('0x2b')];if(_0x45202c[_0x80a4('0x29')]['includeAll']){_0x1720eb[_0x80a4('0x3b')]=[{'all':!![]}];}_0x1720eb=_[_0x80a4('0x37')]({},_0x1720eb,_0x45202c[_0x80a4('0x39')]);return db[_0x80a4('0x26')][_0x80a4('0x40')](_0x1720eb)['then'](handleEntityNotFound(_0x15e6ff,null))[_0x80a4('0x1f')](respondWithResult(_0x15e6ff,null))[_0x80a4('0x41')](handleError(_0x15e6ff,null));};exports[_0x80a4('0x42')]=function(_0x2758c7,_0x3fdf96){return db['ServicenowField'][_0x80a4('0x42')](_0x2758c7[_0x80a4('0x43')],{})[_0x80a4('0x1f')](respondWithResult(_0x3fdf96,0xc9))['catch'](handleError(_0x3fdf96,null));};exports[_0x80a4('0x1e')]=function(_0x3f5b83,_0x19e630){if(_0x3f5b83[_0x80a4('0x43')]['id']){delete _0x3f5b83[_0x80a4('0x43')]['id'];}return db[_0x80a4('0x26')][_0x80a4('0x40')]({'where':{'id':_0x3f5b83[_0x80a4('0x3e')]['id']}})[_0x80a4('0x1f')](handleEntityNotFound(_0x19e630,null))[_0x80a4('0x1f')](saveUpdates(_0x3f5b83['body'],null))[_0x80a4('0x1f')](respondWithResult(_0x19e630,null))[_0x80a4('0x41')](handleError(_0x19e630,null));};exports['destroy']=function(_0x21942d,_0x1e8438){return db[_0x80a4('0x26')][_0x80a4('0x40')]({'where':{'id':_0x21942d[_0x80a4('0x3e')]['id']}})[_0x80a4('0x1f')](handleEntityNotFound(_0x1e8438,null))[_0x80a4('0x1f')](removeEntity(_0x1e8438,null))['catch'](handleError(_0x1e8438,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 636c7d3..be380cf 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 _0x7051=['request-promise','../../config/environment','./intServicenowField.attributes','exports','define','int_servicenow_fields','idField','FieldId','util','moment','bluebird'];(function(_0x1b6311,_0x42ec20){var _0x25aab6=function(_0x139a77){while(--_0x139a77){_0x1b6311['push'](_0x1b6311['shift']());}};_0x25aab6(++_0x42ec20);}(_0x7051,0x97));var _0x1705=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x7051[_0x51c819];return _0x15c5d2;};'use strict';var _=require('lodash');var util=require(_0x1705('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x1705('0x1'));var BPromise=require(_0x1705('0x2'));var rp=require(_0x1705('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1705('0x4'));var attributes=require(_0x1705('0x5'));module[_0x1705('0x6')]=function(_0x3bfa6a,_0x2b867b){return _0x3bfa6a[_0x1705('0x7')]('ServicenowField',attributes,{'tableName':_0x1705('0x8'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x1705('0x9'),_0x1705('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa929=['./intServicenowField.attributes','exports','ServicenowField','int_servicenow_fields','idField','FieldId','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0xa929,0xca));var _0x9a92=function(_0x24b9be,_0x5f39b4){_0x24b9be=_0x24b9be-0x0;var _0x5c6dc6=_0xa929[_0x24b9be];return _0x5c6dc6;};'use strict';var _=require('lodash');var util=require(_0x9a92('0x0'));var logger=require(_0x9a92('0x1'))('api');var moment=require(_0x9a92('0x2'));var BPromise=require(_0x9a92('0x3'));var rp=require(_0x9a92('0x4'));var fs=require('fs');var path=require(_0x9a92('0x5'));var rimraf=require(_0x9a92('0x6'));var config=require(_0x9a92('0x7'));var attributes=require(_0x9a92('0x8'));module[_0x9a92('0x9')]=function(_0x2e4b12,_0x45083f){return _0x2e4b12['define'](_0x9a92('0xa'),attributes,{'tableName':_0x9a92('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x9a92('0xc'),_0x9a92('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 2b1402a..3b47b6c 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 _0xe706=['http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2512a0,_0x4b91a8){var _0x1c11d1=function(_0x22cd0f){while(--_0x22cd0f){_0x2512a0['push'](_0x2512a0['shift']());}};_0x1c11d1(++_0x4b91a8);}(_0xe706,0xa3));var _0x6e70=function(_0x503d48,_0x42e5a9){_0x503d48=_0x503d48-0x0;var _0x59743e=_0xe706[_0x503d48];return _0x59743e;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0x9ffd=['ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0xd444e7,_0x986904){var _0x171580=function(_0x429241){while(--_0x429241){_0xd444e7['push'](_0xd444e7['shift']());}};_0x171580(++_0x986904);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x516e9c,_0x19b55e){_0x516e9c=_0x516e9c-0x0;var _0x4b4984=_0x9ffd[_0x516e9c];return _0x4b4984;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index dc09275..b746e0a 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x11ee67,_0x1760b5){var _0x3ebfda=function(_0x73db8b){while(--_0x73db8b){_0x11ee67['push'](_0x11ee67['shift']());}};_0x3ebfda(++_0x1760b5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x8ac44e,_0x37c2d6){var _0x6fea15=function(_0x32d875){while(--_0x32d875){_0x8ac44e['push'](_0x8ac44e['shift']());}};_0x6fea15(++_0x37c2d6);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index ae7560b..964701b 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(_0x15fcb1,_0x3b41e1){var _0x48bcc8=function(_0x5898bc){while(--_0x5898bc){_0x15fcb1['push'](_0x15fcb1['shift']());}};_0x48bcc8(++_0x3b41e1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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(_0x5a2a15,_0x2749f5){var _0x5ad81b=function(_0x2e14d4){while(--_0x2e14d4){_0x5a2a15['push'](_0x5a2a15['shift']());}};_0x5ad81b(++_0x2749f5);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 29ae2c2..1eef0ec 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 _0xa53e=['fields','attributes','length','hasOwnProperty','limit','order','sort','where','filters','filter','merge','options','includeAll','rows','catch','show','params','include','create','body','find','getConfigurations','findOne','SugarcrmConfiguration','pick','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','created_by','description','duration_hours','duration_minutes','parent_id','parent_name','direction','username','password','slice','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','Invalid\x20Login','format','get_module_fields','values','includes','endsWith','value','statusCode','test','send','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','SugarcrmAccount','rawAttributes','fieldName','type','key','map','query','keys','intersection','model'];(function(_0x2b5513,_0x3fe5cd){var _0x578fd2=function(_0x7a9106){while(--_0x7a9106){_0x2b5513['push'](_0x2b5513['shift']());}};_0x578fd2(++_0x3fe5cd);}(_0xa53e,0x124));var _0xea53=function(_0x174870,_0x482eb3){_0x174870=_0x174870-0x0;var _0x4bfafa=_0xa53e[_0x174870];return _0x4bfafa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xea53('0x0'));var zipdir=require(_0xea53('0x1'));var jsonpatch=require(_0xea53('0x2'));var rp=require(_0xea53('0x3'));var moment=require('moment');var BPromise=require(_0xea53('0x4'));var Mustache=require(_0xea53('0x5'));var util=require(_0xea53('0x6'));var path=require(_0xea53('0x7'));var sox=require(_0xea53('0x8'));var csv=require('to-csv');var ejs=require(_0xea53('0x9'));var fs=require('fs');var fs_extra=require(_0xea53('0xa'));var _=require('lodash');var squel=require(_0xea53('0xb'));var crypto=require('crypto');var jsforce=require(_0xea53('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xea53('0xd'));var Papa=require('papaparse');var Redis=require(_0xea53('0xe'));var authService=require(_0xea53('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xea53('0x10'));var hardwareService=require(_0xea53('0x11'));var logger=require('../../config/logger')(_0xea53('0x12'));var utils=require(_0xea53('0x13'));var config=require(_0xea53('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xea53('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x47da34,_0x4aad28){_0x4aad28=_0x4aad28||0xcc;return function(_0x40ee49){if(_0x40ee49){return _0x47da34['sendStatus'](_0x4aad28);}return _0x47da34[_0xea53('0x16')](_0x4aad28)[_0xea53('0x17')]();};}function respondWithResult(_0x582748,_0x542ada){_0x542ada=_0x542ada||0xc8;return function(_0x54c788){if(_0x54c788){return _0x582748[_0xea53('0x16')](_0x542ada)[_0xea53('0x18')](_0x54c788);}};}function respondWithFilteredResult(_0x1c57a4,_0x4be7f7){return function(_0x5706bf){if(_0x5706bf){var _0xba163a=typeof _0x4be7f7['offset']==='undefined'&&typeof _0x4be7f7['limit']===_0xea53('0x19');var _0x46d84a=_0x5706bf['count'];var _0x42bc80=_0xba163a?0x0:_0x4be7f7[_0xea53('0x1a')];var _0x2ed162=_0xba163a?_0x5706bf[_0xea53('0x1b')]:_0x4be7f7[_0xea53('0x1a')]+_0x4be7f7['limit'];var _0x4b2938;if(_0x2ed162>=_0x46d84a){_0x2ed162=_0x46d84a;_0x4b2938=0xc8;}else{_0x4b2938=0xce;}_0x1c57a4[_0xea53('0x16')](_0x4b2938);return _0x1c57a4[_0xea53('0x1c')](_0xea53('0x1d'),_0x42bc80+'-'+_0x2ed162+'/'+_0x46d84a)[_0xea53('0x18')](_0x5706bf);}return null;};}function patchUpdates(_0x1ca1dc){return function(_0x45bb34){try{jsonpatch[_0xea53('0x1e')](_0x45bb34,_0x1ca1dc,!![]);}catch(_0x3de85b){return BPromise[_0xea53('0x1f')](_0x3de85b);}return _0x45bb34[_0xea53('0x20')]();};}function saveUpdates(_0x5a6a73,_0x133627){return function(_0x18f5b6){if(_0x18f5b6){return _0x18f5b6[_0xea53('0x21')](_0x5a6a73)[_0xea53('0x22')](function(_0x43543){return _0x43543;});}return null;};}function removeEntity(_0x1703a0,_0x4b1519){return function(_0xa5ffc8){if(_0xa5ffc8){return _0xa5ffc8[_0xea53('0x23')]()[_0xea53('0x22')](function(){_0x1703a0[_0xea53('0x16')](0xcc)[_0xea53('0x17')]();});}};}function handleEntityNotFound(_0x46cef6,_0x53dc58){return function(_0x439beb){if(!_0x439beb){_0x46cef6[_0xea53('0x24')](0x194);}return _0x439beb;};}function handleError(_0x31afa9,_0x4f0175){_0x4f0175=_0x4f0175||0x1f4;return function(_0x1227f4){logger[_0xea53('0x25')](_0x1227f4[_0xea53('0x26')]);if(_0x1227f4[_0xea53('0x27')]){delete _0x1227f4[_0xea53('0x27')];}_0x31afa9['status'](_0x4f0175)['send'](_0x1227f4);};}exports['index']=function(_0x44e5ab,_0x10bb83){var _0x2d1112={},_0x278aa3={},_0x321b85={'count':0x0,'rows':[]};var _0x4487af=_['map'](db[_0xea53('0x28')][_0xea53('0x29')],function(_0x2d643d){return{'name':_0x2d643d[_0xea53('0x2a')],'type':_0x2d643d[_0xea53('0x2b')][_0xea53('0x2c')]};});_0x278aa3['model']=_[_0xea53('0x2d')](_0x4487af,_0xea53('0x27'));_0x278aa3[_0xea53('0x2e')]=_[_0xea53('0x2f')](_0x44e5ab[_0xea53('0x2e')]);_0x278aa3['filters']=_['intersection'](_0x278aa3['model'],_0x278aa3[_0xea53('0x2e')]);_0x2d1112['attributes']=_[_0xea53('0x30')](_0x278aa3[_0xea53('0x31')],qs[_0xea53('0x32')](_0x44e5ab['query'][_0xea53('0x32')]));_0x2d1112[_0xea53('0x33')]=_0x2d1112[_0xea53('0x33')][_0xea53('0x34')]?_0x2d1112[_0xea53('0x33')]:_0x278aa3[_0xea53('0x31')];if(!_0x44e5ab[_0xea53('0x2e')][_0xea53('0x35')]('nolimit')){_0x2d1112[_0xea53('0x36')]=qs[_0xea53('0x36')](_0x44e5ab[_0xea53('0x2e')][_0xea53('0x36')]);_0x2d1112['offset']=qs[_0xea53('0x1a')](_0x44e5ab[_0xea53('0x2e')][_0xea53('0x1a')]);}_0x2d1112[_0xea53('0x37')]=qs[_0xea53('0x38')](_0x44e5ab[_0xea53('0x2e')][_0xea53('0x38')]);_0x2d1112[_0xea53('0x39')]=qs['filters'](_['pick'](_0x44e5ab['query'],_0x278aa3[_0xea53('0x3a')]),_0x4487af);if(_0x44e5ab[_0xea53('0x2e')][_0xea53('0x3b')]){_0x2d1112[_0xea53('0x39')]=_[_0xea53('0x3c')](_0x2d1112[_0xea53('0x39')],{'$or':_[_0xea53('0x2d')](_0x4487af,function(_0x4cd088){if(_0x4cd088[_0xea53('0x2b')]!=='VIRTUAL'){var _0x51c5c1={};_0x51c5c1[_0x4cd088[_0xea53('0x27')]]={'$like':'%'+_0x44e5ab[_0xea53('0x2e')][_0xea53('0x3b')]+'%'};return _0x51c5c1;}})});}_0x2d1112=_[_0xea53('0x3c')]({},_0x2d1112,_0x44e5ab[_0xea53('0x3d')]);var _0x17dc0b={'where':_0x2d1112[_0xea53('0x39')]};return db[_0xea53('0x28')][_0xea53('0x1b')](_0x17dc0b)['then'](function(_0x47e1e8){_0x321b85[_0xea53('0x1b')]=_0x47e1e8;if(_0x44e5ab[_0xea53('0x2e')][_0xea53('0x3e')]){_0x2d1112['include']=[{'all':!![]}];}return db[_0xea53('0x28')]['findAll'](_0x2d1112);})[_0xea53('0x22')](function(_0x14635c){_0x321b85[_0xea53('0x3f')]=_0x14635c;return _0x321b85;})[_0xea53('0x22')](respondWithFilteredResult(_0x10bb83,_0x2d1112))[_0xea53('0x40')](handleError(_0x10bb83,null));};exports[_0xea53('0x41')]=function(_0x1c8455,_0x593894){var _0x1ca6a2={'raw':![],'where':{'id':_0x1c8455[_0xea53('0x42')]['id']}},_0xcdda26={};_0xcdda26[_0xea53('0x31')]=_['keys'](db[_0xea53('0x28')]['rawAttributes']);_0xcdda26['query']=_[_0xea53('0x2f')](_0x1c8455[_0xea53('0x2e')]);_0xcdda26[_0xea53('0x3a')]=_['intersection'](_0xcdda26[_0xea53('0x31')],_0xcdda26[_0xea53('0x2e')]);_0x1ca6a2['attributes']=_[_0xea53('0x30')](_0xcdda26[_0xea53('0x31')],qs[_0xea53('0x32')](_0x1c8455[_0xea53('0x2e')]['fields']));_0x1ca6a2[_0xea53('0x33')]=_0x1ca6a2['attributes']['length']?_0x1ca6a2[_0xea53('0x33')]:_0xcdda26[_0xea53('0x31')];if(_0x1c8455[_0xea53('0x2e')][_0xea53('0x3e')]){_0x1ca6a2[_0xea53('0x43')]=[{'all':!![]}];}_0x1ca6a2=_[_0xea53('0x3c')]({},_0x1ca6a2,_0x1c8455[_0xea53('0x3d')]);return db[_0xea53('0x28')]['find'](_0x1ca6a2)['then'](handleEntityNotFound(_0x593894,null))['then'](respondWithResult(_0x593894,null))[_0xea53('0x40')](handleError(_0x593894,null));};exports['create']=function(_0x283a00,_0x28ef1e){return db[_0xea53('0x28')][_0xea53('0x44')](_0x283a00[_0xea53('0x45')],{})[_0xea53('0x22')](respondWithResult(_0x28ef1e,0xc9))[_0xea53('0x40')](handleError(_0x28ef1e,null));};exports[_0xea53('0x21')]=function(_0x3c3da9,_0x1f1a80){if(_0x3c3da9[_0xea53('0x45')]['id']){delete _0x3c3da9['body']['id'];}return db[_0xea53('0x28')][_0xea53('0x46')]({'where':{'id':_0x3c3da9[_0xea53('0x42')]['id']}})[_0xea53('0x22')](handleEntityNotFound(_0x1f1a80,null))[_0xea53('0x22')](saveUpdates(_0x3c3da9[_0xea53('0x45')],null))['then'](respondWithResult(_0x1f1a80,null))['catch'](handleError(_0x1f1a80,null));};exports[_0xea53('0x23')]=function(_0xe66610,_0x76bbff){return db[_0xea53('0x28')][_0xea53('0x46')]({'where':{'id':_0xe66610[_0xea53('0x42')]['id']}})[_0xea53('0x22')](handleEntityNotFound(_0x76bbff,null))[_0xea53('0x22')](removeEntity(_0x76bbff,null))[_0xea53('0x40')](handleError(_0x76bbff,null));};exports[_0xea53('0x47')]=function(_0x2601cf,_0x28d9ba,_0x3d5973){var _0x2437ed={};var _0x8f0bbc={};var _0x59d4a5;var _0x46abcf;return db[_0xea53('0x28')][_0xea53('0x48')]({'where':{'id':_0x2601cf[_0xea53('0x42')]['id']}})[_0xea53('0x22')](handleEntityNotFound(_0x28d9ba,null))[_0xea53('0x22')](function(_0x1315f5){if(_0x1315f5){_0x59d4a5=_0x1315f5;_0x8f0bbc[_0xea53('0x31')]=_[_0xea53('0x2f')](db[_0xea53('0x49')][_0xea53('0x29')]);_0x8f0bbc[_0xea53('0x2e')]=_['keys'](_0x2601cf[_0xea53('0x2e')]);_0x8f0bbc[_0xea53('0x3a')]=_[_0xea53('0x30')](_0x8f0bbc[_0xea53('0x31')],_0x8f0bbc['query']);_0x2437ed[_0xea53('0x33')]=_[_0xea53('0x30')](_0x8f0bbc[_0xea53('0x31')],qs[_0xea53('0x32')](_0x2601cf[_0xea53('0x2e')][_0xea53('0x32')]));_0x2437ed[_0xea53('0x33')]=_0x2437ed['attributes'][_0xea53('0x34')]?_0x2437ed[_0xea53('0x33')]:_0x8f0bbc[_0xea53('0x31')];_0x2437ed[_0xea53('0x37')]=qs['sort'](_0x2601cf[_0xea53('0x2e')][_0xea53('0x38')]);_0x2437ed[_0xea53('0x39')]=qs[_0xea53('0x3a')](_[_0xea53('0x4a')](_0x2601cf[_0xea53('0x2e')],_0x8f0bbc['filters']));if(_0x2601cf[_0xea53('0x2e')]['filter']){_0x2437ed['where']=_[_0xea53('0x3c')](_0x2437ed[_0xea53('0x39')],{'$or':_[_0xea53('0x2d')](_0x2437ed[_0xea53('0x33')],function(_0x235e9d){var _0x352064={};_0x352064[_0x235e9d]={'$like':'%'+_0x2601cf[_0xea53('0x2e')][_0xea53('0x3b')]+'%'};return _0x352064;})});}_0x2437ed=_['merge']({},_0x2437ed,_0x2601cf[_0xea53('0x3d')]);return _0x59d4a5[_0xea53('0x47')](_0x2437ed);}})[_0xea53('0x22')](function(_0x5b21ba){if(_0x5b21ba){_0x46abcf=_0x5b21ba[_0xea53('0x34')];if(!_0x2601cf['query'][_0xea53('0x35')](_0xea53('0x4b'))){_0x2437ed[_0xea53('0x36')]=qs[_0xea53('0x36')](_0x2601cf[_0xea53('0x2e')]['limit']);_0x2437ed[_0xea53('0x1a')]=qs[_0xea53('0x1a')](_0x2601cf[_0xea53('0x2e')]['offset']);}return _0x59d4a5['getConfigurations'](_0x2437ed);}})['then'](function(_0x3b09ee){if(_0x3b09ee){return _0x3b09ee?{'count':_0x46abcf,'rows':_0x3b09ee}:null;}})[_0xea53('0x22')](respondWithResult(_0x28d9ba,null))['catch'](handleError(_0x28d9ba,null));};exports[_0xea53('0x4c')]=function(_0x535191,_0x46c436,_0x1a0127){if(_0x535191[_0xea53('0x45')]['id']){delete _0x535191[_0xea53('0x45')]['id'];}return db[_0xea53('0x28')][_0xea53('0x48')]({'where':{'id':_0x535191[_0xea53('0x42')]['id']}})[_0xea53('0x22')](handleEntityNotFound(_0x46c436,null))[_0xea53('0x22')](function(_0x1691b2){if(_0x1691b2){_0x535191[_0xea53('0x45')][_0xea53('0x4d')]=_0x1691b2['id'];_0x535191[_0xea53('0x45')][_0xea53('0x4e')]=integrations['getSubjects'](_0x535191[_0xea53('0x45')][_0xea53('0x4f')],_0x535191[_0xea53('0x45')][_0xea53('0x2b')]);_0x535191[_0xea53('0x45')][_0xea53('0x50')]=integrations[_0xea53('0x51')](_0x535191[_0xea53('0x45')][_0xea53('0x4f')],_0x535191[_0xea53('0x45')]['type']);return db[_0xea53('0x49')][_0xea53('0x44')](_0x535191['body'],{'include':[{'model':db[_0xea53('0x52')],'as':_0xea53('0x4e')},{'model':db['SugarcrmField'],'as':_0xea53('0x50')}]});}return null;})[_0xea53('0x22')](respondWithResult(_0x46c436,null))[_0xea53('0x40')](handleError(_0x46c436,null));};exports[_0xea53('0x53')]=function(_0xfa627a,_0x464062,_0x3cb6a2){var _0x3d2a6e='';var _0x178111=['id',_0xea53('0x27'),'assigned_user_id',_0xea53('0x54'),_0xea53('0x55'),'date_start',_0xea53('0x56'),_0xea53('0x57'),_0xea53('0x58'),'parent_type',_0xea53('0x59'),_0xea53('0x5a')];return db[_0xea53('0x28')]['findOne']({'where':{'id':_0xfa627a[_0xea53('0x42')]['id']},'attributes':['id',_0xea53('0x5b'),_0xea53('0x5c'),'remoteUri']})[_0xea53('0x22')](handleEntityNotFound(_0x464062,null))[_0xea53('0x22')](function(_0x45dbe9){if(_0x45dbe9){_0x3d2a6e=_0x45dbe9['remoteUri'];var _0x219741=_0x3d2a6e[_0xea53('0x5d')](-0x1);if(_0x219741==='/'){_0x3d2a6e=_0x3d2a6e[_0xea53('0x5e')](0x0,_0x3d2a6e[_0xea53('0x5f')](_0x219741));}return rp({'method':_0xea53('0x60'),'uri':util['format'](_0xea53('0x61'),_0x3d2a6e,_0xea53('0x62')),'json':!![],'form':{'method':_0xea53('0x63'),'input_type':_0xea53('0x64'),'response_type':_0xea53('0x64'),'rest_data':JSON[_0xea53('0x65')]({'user_auth':{'user_name':_0x45dbe9[_0xea53('0x5b')],'password':_0x45dbe9[_0xea53('0x5c')],'encryption':_0xea53('0x66')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xea53('0x22')](function(_0x358193){if(_0x358193&&_0x358193[_0xea53('0x27')]!==_0xea53('0x67')&&_0x358193[_0xea53('0x27')]!=='Password\x20Expired'){return rp({'method':_0xea53('0x60'),'uri':util[_0xea53('0x68')]('%s%s',_0x3d2a6e,_0xea53('0x62')),'json':!![],'form':{'method':_0xea53('0x69'),'input_type':_0xea53('0x64'),'response_type':_0xea53('0x64'),'rest_data':JSON['stringify']({'session':_0x358193['id'],'module_name':'Calls'})}})[_0xea53('0x22')](function(_0x573102){if(_0x573102){var _0x4fecf2=_[_0xea53('0x6a')](_0x573102['module_fields']);_['remove'](_0x4fecf2,function(_0x38f931){return _0x178111[_0xea53('0x6b')](_0x38f931['name']);});return{'count':_0x4fecf2[_0xea53('0x34')],'rows':_[_0xea53('0x2d')](_0x4fecf2,function(_0x3c6ffe){return{'id':_0x3c6ffe['name'],'name':_0x3c6ffe['label'],'custom':_[_0xea53('0x6c')](_0x3c6ffe['name'],'_c')?!![]:![],'options':_0x3c6ffe['options']?_[_0xea53('0x2d')](_[_0xea53('0x6a')](_0x3c6ffe['options']),function(_0x39a0e0){return{'name':_0x39a0e0[_0xea53('0x6d')],'value':_0x39a0e0[_0xea53('0x27')]};}):[]};})};}})[_0xea53('0x22')](respondWithResult(_0x464062,null))[_0xea53('0x40')](function(_0x586d65){var _0x1c4291=_0xfa627a[_0xea53('0x2e')]['test']?0x1f4:_0x586d65[_0xea53('0x6e')]||0x1f4;logger[_0xea53('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0xea53('0x53'),_0x1c4291,JSON[_0xea53('0x65')](_0x586d65));delete _0x586d65[_0xea53('0x27')];if(_0x1c4291===0x191){_0x1c4291=0x190;}_0x464062['status'](_0x1c4291)['send'](_0xfa627a[_0xea53('0x2e')][_0xea53('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x586d65[_0xea53('0x6e')]}:_0x586d65);});}else{var _0x36d7dd=0x1f4;_0x464062[_0xea53('0x16')](_0x36d7dd)[_0xea53('0x70')]({'message':_0xea53('0x71'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x8518=['options','getConfigurations','addConfiguration','findOne','AccountId','Subjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','username','password','remoteUri','slice','lastIndexOf','POST','format','/service/v4_1/rest.php','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','%s%s','get_module_fields','Calls','values','remove','includes','label','endsWith','value','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','save','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','SugarcrmAccount','findAll','rows','catch','params','length','includeAll','include','find','create','body','update','SugarcrmConfiguration'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x8518,0x11b));var _0x8851=function(_0x391802,_0xde0fd){_0x391802=_0x391802-0x0;var _0x3aa73b=_0x8518[_0x391802];return _0x3aa73b;};'use strict';var emlformat=require(_0x8851('0x0'));var rimraf=require(_0x8851('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8851('0x2'));var rp=require(_0x8851('0x3'));var moment=require(_0x8851('0x4'));var BPromise=require(_0x8851('0x5'));var Mustache=require(_0x8851('0x6'));var util=require('util');var path=require(_0x8851('0x7'));var sox=require(_0x8851('0x8'));var csv=require(_0x8851('0x9'));var ejs=require(_0x8851('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8851('0xb'));var crypto=require('crypto');var jsforce=require(_0x8851('0xc'));var deskjs=require(_0x8851('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8851('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8851('0xf'))(_0x8851('0x10'));var utils=require(_0x8851('0x11'));var config=require(_0x8851('0x12'));var licenseUtil=require(_0x8851('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0x8851('0x14'));function respondWithStatusCode(_0xeecf4,_0x24d625){_0x24d625=_0x24d625||0xcc;return function(_0xa2315){if(_0xa2315){return _0xeecf4[_0x8851('0x15')](_0x24d625);}return _0xeecf4[_0x8851('0x16')](_0x24d625)[_0x8851('0x17')]();};}function respondWithResult(_0x160d54,_0x4e85ba){_0x4e85ba=_0x4e85ba||0xc8;return function(_0x122cd0){if(_0x122cd0){return _0x160d54['status'](_0x4e85ba)['json'](_0x122cd0);}};}function respondWithFilteredResult(_0x1a0037,_0x1fceed){return function(_0x538df2){if(_0x538df2){var _0x5c7f34=typeof _0x1fceed[_0x8851('0x18')]===_0x8851('0x19')&&typeof _0x1fceed[_0x8851('0x1a')]===_0x8851('0x19');var _0x4eae9c=_0x538df2[_0x8851('0x1b')];var _0x46caf6=_0x5c7f34?0x0:_0x1fceed[_0x8851('0x18')];var _0x40d24c=_0x5c7f34?_0x538df2[_0x8851('0x1b')]:_0x1fceed[_0x8851('0x18')]+_0x1fceed[_0x8851('0x1a')];var _0xd6b816;if(_0x40d24c>=_0x4eae9c){_0x40d24c=_0x4eae9c;_0xd6b816=0xc8;}else{_0xd6b816=0xce;}_0x1a0037[_0x8851('0x16')](_0xd6b816);return _0x1a0037['set'](_0x8851('0x1c'),_0x46caf6+'-'+_0x40d24c+'/'+_0x4eae9c)['json'](_0x538df2);}return null;};}function patchUpdates(_0x431bef){return function(_0x36237f){try{jsonpatch[_0x8851('0x1d')](_0x36237f,_0x431bef,!![]);}catch(_0x3414e0){return BPromise['reject'](_0x3414e0);}return _0x36237f[_0x8851('0x1e')]();};}function saveUpdates(_0x293ca5,_0x3de558){return function(_0x44ca52){if(_0x44ca52){return _0x44ca52['update'](_0x293ca5)['then'](function(_0x55546c){return _0x55546c;});}return null;};}function removeEntity(_0x3b2468,_0x4d7894){return function(_0x3f92b0){if(_0x3f92b0){return _0x3f92b0['destroy']()[_0x8851('0x1f')](function(){_0x3b2468[_0x8851('0x16')](0xcc)[_0x8851('0x17')]();});}};}function handleEntityNotFound(_0x9c4d15,_0xd1b378){return function(_0x303fa2){if(!_0x303fa2){_0x9c4d15['sendStatus'](0x194);}return _0x303fa2;};}function handleError(_0x1b043d,_0x15e84c){_0x15e84c=_0x15e84c||0x1f4;return function(_0x4a302e){logger[_0x8851('0x20')](_0x4a302e[_0x8851('0x21')]);if(_0x4a302e[_0x8851('0x22')]){delete _0x4a302e[_0x8851('0x22')];}_0x1b043d[_0x8851('0x16')](_0x15e84c)[_0x8851('0x23')](_0x4a302e);};}exports[_0x8851('0x24')]=function(_0x28441c,_0x4eb594){var _0x3106f7={},_0x1336aa={},_0x957d5d={'count':0x0,'rows':[]};var _0x105395=_[_0x8851('0x25')](db['SugarcrmAccount'][_0x8851('0x26')],function(_0x4b1825){return{'name':_0x4b1825[_0x8851('0x27')],'type':_0x4b1825[_0x8851('0x28')][_0x8851('0x29')]};});_0x1336aa[_0x8851('0x2a')]=_[_0x8851('0x25')](_0x105395,_0x8851('0x22'));_0x1336aa[_0x8851('0x2b')]=_[_0x8851('0x2c')](_0x28441c[_0x8851('0x2b')]);_0x1336aa[_0x8851('0x2d')]=_[_0x8851('0x2e')](_0x1336aa['model'],_0x1336aa[_0x8851('0x2b')]);_0x3106f7[_0x8851('0x2f')]=_['intersection'](_0x1336aa[_0x8851('0x2a')],qs[_0x8851('0x30')](_0x28441c['query'][_0x8851('0x30')]));_0x3106f7[_0x8851('0x2f')]=_0x3106f7['attributes']['length']?_0x3106f7['attributes']:_0x1336aa[_0x8851('0x2a')];if(!_0x28441c[_0x8851('0x2b')][_0x8851('0x31')](_0x8851('0x32'))){_0x3106f7[_0x8851('0x1a')]=qs['limit'](_0x28441c[_0x8851('0x2b')][_0x8851('0x1a')]);_0x3106f7[_0x8851('0x18')]=qs[_0x8851('0x18')](_0x28441c['query'][_0x8851('0x18')]);}_0x3106f7[_0x8851('0x33')]=qs[_0x8851('0x34')](_0x28441c[_0x8851('0x2b')][_0x8851('0x34')]);_0x3106f7['where']=qs['filters'](_[_0x8851('0x35')](_0x28441c[_0x8851('0x2b')],_0x1336aa[_0x8851('0x2d')]),_0x105395);if(_0x28441c[_0x8851('0x2b')][_0x8851('0x36')]){_0x3106f7['where']=_[_0x8851('0x37')](_0x3106f7[_0x8851('0x38')],{'$or':_[_0x8851('0x25')](_0x105395,function(_0x13e3e6){if(_0x13e3e6[_0x8851('0x28')]!==_0x8851('0x39')){var _0x2222d5={};_0x2222d5[_0x13e3e6[_0x8851('0x22')]]={'$like':'%'+_0x28441c[_0x8851('0x2b')][_0x8851('0x36')]+'%'};return _0x2222d5;}})});}_0x3106f7=_[_0x8851('0x37')]({},_0x3106f7,_0x28441c['options']);var _0x15a509={'where':_0x3106f7[_0x8851('0x38')]};return db[_0x8851('0x3a')][_0x8851('0x1b')](_0x15a509)['then'](function(_0x2fa6e5){_0x957d5d[_0x8851('0x1b')]=_0x2fa6e5;if(_0x28441c['query']['includeAll']){_0x3106f7['include']=[{'all':!![]}];}return db[_0x8851('0x3a')][_0x8851('0x3b')](_0x3106f7);})[_0x8851('0x1f')](function(_0x35c5b0){_0x957d5d[_0x8851('0x3c')]=_0x35c5b0;return _0x957d5d;})[_0x8851('0x1f')](respondWithFilteredResult(_0x4eb594,_0x3106f7))[_0x8851('0x3d')](handleError(_0x4eb594,null));};exports['show']=function(_0x3bc1fd,_0x58e050){var _0x32c174={'raw':![],'where':{'id':_0x3bc1fd[_0x8851('0x3e')]['id']}},_0xd50e15={};_0xd50e15[_0x8851('0x2a')]=_['keys'](db[_0x8851('0x3a')][_0x8851('0x26')]);_0xd50e15[_0x8851('0x2b')]=_[_0x8851('0x2c')](_0x3bc1fd['query']);_0xd50e15[_0x8851('0x2d')]=_['intersection'](_0xd50e15[_0x8851('0x2a')],_0xd50e15[_0x8851('0x2b')]);_0x32c174['attributes']=_['intersection'](_0xd50e15[_0x8851('0x2a')],qs['fields'](_0x3bc1fd[_0x8851('0x2b')][_0x8851('0x30')]));_0x32c174['attributes']=_0x32c174[_0x8851('0x2f')][_0x8851('0x3f')]?_0x32c174['attributes']:_0xd50e15['model'];if(_0x3bc1fd[_0x8851('0x2b')][_0x8851('0x40')]){_0x32c174[_0x8851('0x41')]=[{'all':!![]}];}_0x32c174=_['merge']({},_0x32c174,_0x3bc1fd['options']);return db[_0x8851('0x3a')][_0x8851('0x42')](_0x32c174)[_0x8851('0x1f')](handleEntityNotFound(_0x58e050,null))[_0x8851('0x1f')](respondWithResult(_0x58e050,null))[_0x8851('0x3d')](handleError(_0x58e050,null));};exports[_0x8851('0x43')]=function(_0x981cab,_0x35ac4d){return db[_0x8851('0x3a')][_0x8851('0x43')](_0x981cab[_0x8851('0x44')],{})['then'](respondWithResult(_0x35ac4d,0xc9))[_0x8851('0x3d')](handleError(_0x35ac4d,null));};exports[_0x8851('0x45')]=function(_0x1e6fce,_0x3a388b){if(_0x1e6fce['body']['id']){delete _0x1e6fce[_0x8851('0x44')]['id'];}return db[_0x8851('0x3a')][_0x8851('0x42')]({'where':{'id':_0x1e6fce[_0x8851('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3a388b,null))[_0x8851('0x1f')](saveUpdates(_0x1e6fce[_0x8851('0x44')],null))['then'](respondWithResult(_0x3a388b,null))[_0x8851('0x3d')](handleError(_0x3a388b,null));};exports['destroy']=function(_0x132b3e,_0x52520c){return db[_0x8851('0x3a')][_0x8851('0x42')]({'where':{'id':_0x132b3e[_0x8851('0x3e')]['id']}})[_0x8851('0x1f')](handleEntityNotFound(_0x52520c,null))[_0x8851('0x1f')](removeEntity(_0x52520c,null))['catch'](handleError(_0x52520c,null));};exports['getConfigurations']=function(_0x3f3d22,_0x2835bb,_0x5c311e){var _0xec8b0e={};var _0x45042f={};var _0x375d9f;var _0x43dadf;return db[_0x8851('0x3a')]['findOne']({'where':{'id':_0x3f3d22['params']['id']}})[_0x8851('0x1f')](handleEntityNotFound(_0x2835bb,null))[_0x8851('0x1f')](function(_0x986ef3){if(_0x986ef3){_0x375d9f=_0x986ef3;_0x45042f['model']=_[_0x8851('0x2c')](db[_0x8851('0x46')][_0x8851('0x26')]);_0x45042f[_0x8851('0x2b')]=_[_0x8851('0x2c')](_0x3f3d22[_0x8851('0x2b')]);_0x45042f[_0x8851('0x2d')]=_[_0x8851('0x2e')](_0x45042f[_0x8851('0x2a')],_0x45042f['query']);_0xec8b0e[_0x8851('0x2f')]=_[_0x8851('0x2e')](_0x45042f[_0x8851('0x2a')],qs[_0x8851('0x30')](_0x3f3d22['query']['fields']));_0xec8b0e['attributes']=_0xec8b0e[_0x8851('0x2f')][_0x8851('0x3f')]?_0xec8b0e[_0x8851('0x2f')]:_0x45042f[_0x8851('0x2a')];_0xec8b0e[_0x8851('0x33')]=qs[_0x8851('0x34')](_0x3f3d22['query'][_0x8851('0x34')]);_0xec8b0e[_0x8851('0x38')]=qs['filters'](_['pick'](_0x3f3d22[_0x8851('0x2b')],_0x45042f[_0x8851('0x2d')]));if(_0x3f3d22['query'][_0x8851('0x36')]){_0xec8b0e['where']=_[_0x8851('0x37')](_0xec8b0e[_0x8851('0x38')],{'$or':_[_0x8851('0x25')](_0xec8b0e[_0x8851('0x2f')],function(_0x1bfcbe){var _0x3aabd5={};_0x3aabd5[_0x1bfcbe]={'$like':'%'+_0x3f3d22[_0x8851('0x2b')][_0x8851('0x36')]+'%'};return _0x3aabd5;})});}_0xec8b0e=_[_0x8851('0x37')]({},_0xec8b0e,_0x3f3d22[_0x8851('0x47')]);return _0x375d9f[_0x8851('0x48')](_0xec8b0e);}})[_0x8851('0x1f')](function(_0x188e36){if(_0x188e36){_0x43dadf=_0x188e36[_0x8851('0x3f')];if(!_0x3f3d22[_0x8851('0x2b')][_0x8851('0x31')](_0x8851('0x32'))){_0xec8b0e[_0x8851('0x1a')]=qs[_0x8851('0x1a')](_0x3f3d22[_0x8851('0x2b')][_0x8851('0x1a')]);_0xec8b0e[_0x8851('0x18')]=qs[_0x8851('0x18')](_0x3f3d22[_0x8851('0x2b')][_0x8851('0x18')]);}return _0x375d9f['getConfigurations'](_0xec8b0e);}})['then'](function(_0x1736aa){if(_0x1736aa){return _0x1736aa?{'count':_0x43dadf,'rows':_0x1736aa}:null;}})[_0x8851('0x1f')](respondWithResult(_0x2835bb,null))['catch'](handleError(_0x2835bb,null));};exports[_0x8851('0x49')]=function(_0x329f20,_0xa159d8,_0x156c67){if(_0x329f20[_0x8851('0x44')]['id']){delete _0x329f20[_0x8851('0x44')]['id'];}return db[_0x8851('0x3a')][_0x8851('0x4a')]({'where':{'id':_0x329f20['params']['id']}})[_0x8851('0x1f')](handleEntityNotFound(_0xa159d8,null))[_0x8851('0x1f')](function(_0x4d594c){if(_0x4d594c){_0x329f20[_0x8851('0x44')][_0x8851('0x4b')]=_0x4d594c['id'];_0x329f20[_0x8851('0x44')][_0x8851('0x4c')]=integrations['getSubjects'](_0x329f20['body'][_0x8851('0x4d')],_0x329f20[_0x8851('0x44')]['type']);_0x329f20[_0x8851('0x44')]['Descriptions']=integrations[_0x8851('0x4e')](_0x329f20['body'][_0x8851('0x4d')],_0x329f20[_0x8851('0x44')][_0x8851('0x28')]);return db[_0x8851('0x46')][_0x8851('0x43')](_0x329f20['body'],{'include':[{'model':db[_0x8851('0x4f')],'as':_0x8851('0x4c')},{'model':db['SugarcrmField'],'as':_0x8851('0x50')}]});}return null;})['then'](respondWithResult(_0xa159d8,null))[_0x8851('0x3d')](handleError(_0xa159d8,null));};exports[_0x8851('0x51')]=function(_0x134818,_0x5e17d2,_0x317305){var _0x18f471='';var _0xb455b6=['id',_0x8851('0x22'),_0x8851('0x52'),_0x8851('0x53'),_0x8851('0x54'),_0x8851('0x55'),_0x8851('0x56'),_0x8851('0x57'),'parent_id',_0x8851('0x58'),_0x8851('0x59'),_0x8851('0x5a')];return db['SugarcrmAccount'][_0x8851('0x4a')]({'where':{'id':_0x134818['params']['id']},'attributes':['id',_0x8851('0x5b'),_0x8851('0x5c'),_0x8851('0x5d')]})[_0x8851('0x1f')](handleEntityNotFound(_0x5e17d2,null))[_0x8851('0x1f')](function(_0x1e78f9){if(_0x1e78f9){_0x18f471=_0x1e78f9[_0x8851('0x5d')];var _0x423860=_0x18f471[_0x8851('0x5e')](-0x1);if(_0x423860==='/'){_0x18f471=_0x18f471['substring'](0x0,_0x18f471[_0x8851('0x5f')](_0x423860));}return rp({'method':_0x8851('0x60'),'uri':util[_0x8851('0x61')]('%s%s',_0x18f471,_0x8851('0x62')),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':_0x8851('0x63'),'rest_data':JSON[_0x8851('0x64')]({'user_auth':{'user_name':_0x1e78f9[_0x8851('0x5b')],'password':_0x1e78f9[_0x8851('0x5c')],'encryption':_0x8851('0x65')},'application':_0x8851('0x66')})}});}})[_0x8851('0x1f')](function(_0x3104c9){if(_0x3104c9&&_0x3104c9[_0x8851('0x22')]!==_0x8851('0x67')&&_0x3104c9[_0x8851('0x22')]!==_0x8851('0x68')){return rp({'method':'POST','uri':util[_0x8851('0x61')](_0x8851('0x69'),_0x18f471,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x8851('0x6a'),'input_type':_0x8851('0x63'),'response_type':_0x8851('0x63'),'rest_data':JSON[_0x8851('0x64')]({'session':_0x3104c9['id'],'module_name':_0x8851('0x6b')})}})['then'](function(_0x4fa732){if(_0x4fa732){var _0x2bb01e=_[_0x8851('0x6c')](_0x4fa732['module_fields']);_[_0x8851('0x6d')](_0x2bb01e,function(_0xa0e940){return _0xb455b6[_0x8851('0x6e')](_0xa0e940[_0x8851('0x22')]);});return{'count':_0x2bb01e[_0x8851('0x3f')],'rows':_[_0x8851('0x25')](_0x2bb01e,function(_0xc4699e){return{'id':_0xc4699e['name'],'name':_0xc4699e[_0x8851('0x6f')],'custom':_[_0x8851('0x70')](_0xc4699e['name'],'_c')?!![]:![],'options':_0xc4699e[_0x8851('0x47')]?_[_0x8851('0x25')](_[_0x8851('0x6c')](_0xc4699e[_0x8851('0x47')]),function(_0x4d1d88){return{'name':_0x4d1d88[_0x8851('0x71')],'value':_0x4d1d88[_0x8851('0x22')]};}):[]};})};}})[_0x8851('0x1f')](respondWithResult(_0x5e17d2,null))[_0x8851('0x3d')](function(_0x121c84){var _0x33d24f=_0x134818[_0x8851('0x2b')][_0x8851('0x72')]?0x1f4:_0x121c84['statusCode']||0x1f4;logger[_0x8851('0x20')](_0x8851('0x73'),_0x8851('0x51'),_0x33d24f,JSON[_0x8851('0x64')](_0x121c84));delete _0x121c84[_0x8851('0x22')];if(_0x33d24f===0x191){_0x33d24f=0x190;}_0x5e17d2[_0x8851('0x16')](_0x33d24f)[_0x8851('0x23')](_0x134818['query'][_0x8851('0x72')]?{'message':_0x8851('0x74'),'statusCode':_0x121c84[_0x8851('0x75')]}:_0x121c84);});}else{var _0x13b5e7=0x1f4;_0x5e17d2[_0x8851('0x16')](_0x13b5e7)[_0x8851('0x23')]({'message':_0x8851('0x74'),'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 2825fbc..b0eee30 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 _0x6a19=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','../../config/logger'];(function(_0x4320a7,_0x239a92){var _0x3700bf=function(_0x2c3db0){while(--_0x2c3db0){_0x4320a7['push'](_0x4320a7['shift']());}};_0x3700bf(++_0x239a92);}(_0x6a19,0x144));var _0x96a1=function(_0x1d56fd,_0x36c2d4){_0x1d56fd=_0x1d56fd-0x0;var _0x1f9f71=_0x6a19[_0x1d56fd];return _0x1f9f71;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x96a1('0x0'))(_0x96a1('0x1'));var moment=require(_0x96a1('0x2'));var BPromise=require(_0x96a1('0x3'));var rp=require(_0x96a1('0x4'));var fs=require('fs');var path=require(_0x96a1('0x5'));var rimraf=require(_0x96a1('0x6'));var config=require(_0x96a1('0x7'));var attributes=require(_0x96a1('0x8'));var integrations=require(_0x96a1('0x9'));module[_0x96a1('0xa')]=function(_0x5b7d76,_0x4fe712){return _0x5b7d76[_0x96a1('0xb')](_0x96a1('0xc'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x77a9=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger'];(function(_0xe8f44e,_0x5c50b2){var _0x3d6a98=function(_0x102d92){while(--_0x102d92){_0xe8f44e['push'](_0xe8f44e['shift']());}};_0x3d6a98(++_0x5c50b2);}(_0x77a9,0x1ec));var _0x977a=function(_0x438c9b,_0x4d87d8){_0x438c9b=_0x438c9b-0x0;var _0x5a70df=_0x77a9[_0x438c9b];return _0x5a70df;};'use strict';var _=require(_0x977a('0x0'));var util=require(_0x977a('0x1'));var logger=require(_0x977a('0x2'))(_0x977a('0x3'));var moment=require(_0x977a('0x4'));var BPromise=require(_0x977a('0x5'));var rp=require(_0x977a('0x6'));var fs=require('fs');var path=require(_0x977a('0x7'));var rimraf=require(_0x977a('0x8'));var config=require(_0x977a('0x9'));var attributes=require(_0x977a('0xa'));var integrations=require('../../components/integrations/configuration');module[_0x977a('0xb')]=function(_0x5e3e6e,_0x593dda){return _0x5e3e6e[_0x977a('0xc')](_0x977a('0xd'),attributes,{'tableName':_0x977a('0xe'),'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 ff726b3..810c0fc 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 _0x9c7b=['GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','include','map','model','attributes','ShowSugarcrmAccount','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0xfeb3ff,_0x15b34b){var _0x22a5a7=function(_0x420b8e){while(--_0x420b8e){_0xfeb3ff['push'](_0xfeb3ff['shift']());}};_0x22a5a7(++_0x15b34b);}(_0x9c7b,0xd8));var _0xb9c7=function(_0x58ef9c,_0xe84649){_0x58ef9c=_0x58ef9c-0x0;var _0x2147e=_0x9c7b[_0x58ef9c];return _0x2147e;};'use strict';var _=require(_0xb9c7('0x0'));var util=require('util');var moment=require(_0xb9c7('0x1'));var BPromise=require('bluebird');var rs=require(_0xb9c7('0x2'));var fs=require('fs');var Redis=require(_0xb9c7('0x3'));var db=require(_0xb9c7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb9c7('0x5'))(_0xb9c7('0x6'));var config=require(_0xb9c7('0x7'));var jayson=require(_0xb9c7('0x8'));var client=jayson[_0xb9c7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd0c8d3,_0x24427e,_0x5b2765){return new BPromise(function(_0x2ac9a8,_0x39fe6a){return client[_0xb9c7('0xa')](_0xd0c8d3,_0x5b2765)[_0xb9c7('0xb')](function(_0xed05f1){logger[_0xb9c7('0xc')](_0xb9c7('0xd'),_0x24427e,_0xb9c7('0xe'));logger[_0xb9c7('0xf')](_0xb9c7('0x10'),_0x24427e,_0xb9c7('0xe'),JSON['stringify'](_0xed05f1));if(_0xed05f1[_0xb9c7('0x11')]){if(_0xed05f1['error'][_0xb9c7('0x12')]===0x1f4){logger[_0xb9c7('0x11')](_0xb9c7('0xd'),_0x24427e,_0xed05f1[_0xb9c7('0x11')][_0xb9c7('0x13')]);return _0x39fe6a(_0xed05f1[_0xb9c7('0x11')][_0xb9c7('0x13')]);}logger[_0xb9c7('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x24427e,_0xed05f1[_0xb9c7('0x11')][_0xb9c7('0x13')]);return _0x2ac9a8(_0xed05f1[_0xb9c7('0x11')][_0xb9c7('0x13')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x24427e,_0xb9c7('0xe'));_0x2ac9a8(_0xed05f1[_0xb9c7('0x14')][_0xb9c7('0x13')]);}})[_0xb9c7('0x15')](function(_0x22d171){logger[_0xb9c7('0x11')](_0xb9c7('0xd'),_0x24427e,_0x22d171);_0x39fe6a(_0x22d171);});});}exports[_0xb9c7('0x16')]=function(_0x496387){var _0x471533=this;return new Promise(function(_0x168ad4,_0x1348fc){return db[_0xb9c7('0x17')][_0xb9c7('0x18')]({'raw':_0x496387[_0xb9c7('0x19')]?_0x496387[_0xb9c7('0x19')][_0xb9c7('0x1a')]===undefined?!![]:![]:!![],'where':_0x496387[_0xb9c7('0x19')]?_0x496387['options'][_0xb9c7('0x1b')]||null:null,'attributes':_0x496387[_0xb9c7('0x19')]?_0x496387[_0xb9c7('0x19')]['attributes']||null:null,'limit':_0x496387[_0xb9c7('0x19')]?_0x496387[_0xb9c7('0x19')]['limit']||null:null,'include':_0x496387[_0xb9c7('0x19')]?_0x496387[_0xb9c7('0x19')][_0xb9c7('0x1c')]?_[_0xb9c7('0x1d')](_0x496387['options'][_0xb9c7('0x1c')],function(_0x448b2b){return{'model':db[_0x448b2b[_0xb9c7('0x1e')]],'as':_0x448b2b['as'],'attributes':_0x448b2b[_0xb9c7('0x1f')],'include':_0x448b2b[_0xb9c7('0x1c')]?_[_0xb9c7('0x1d')](_0x448b2b[_0xb9c7('0x1c')],function(_0x31a3e3){return{'model':db[_0x31a3e3['model']],'as':_0x31a3e3['as'],'attributes':_0x31a3e3[_0xb9c7('0x1f')],'include':_0x31a3e3[_0xb9c7('0x1c')]?_[_0xb9c7('0x1d')](_0x31a3e3[_0xb9c7('0x1c')],function(_0x2d3f99){return{'model':db[_0x2d3f99[_0xb9c7('0x1e')]],'as':_0x2d3f99['as'],'attributes':_0x2d3f99[_0xb9c7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb9c7('0xb')](function(_0x4989d5){logger[_0xb9c7('0xc')](_0xb9c7('0x16'),_0x496387);logger[_0xb9c7('0xf')](_0xb9c7('0x16'),_0x496387,JSON['stringify'](_0x4989d5));_0x168ad4(_0x4989d5);})[_0xb9c7('0x15')](function(_0x44101e){logger[_0xb9c7('0x11')]('GetSugarcrmAccount',_0x44101e[_0xb9c7('0x13')],_0x496387);_0x1348fc(_0x471533['error'](0x1f4,_0x44101e[_0xb9c7('0x13')]));});});};exports[_0xb9c7('0x20')]=function(_0x6648ee){var _0x3ec182=this;return new Promise(function(_0x3cad91,_0xb9ac4e){return db[_0xb9c7('0x17')][_0xb9c7('0x21')]({'raw':_0x6648ee['options']?_0x6648ee[_0xb9c7('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x6648ee[_0xb9c7('0x19')]?_0x6648ee[_0xb9c7('0x19')]['where']||null:null,'attributes':_0x6648ee[_0xb9c7('0x19')]?_0x6648ee[_0xb9c7('0x19')][_0xb9c7('0x1f')]||null:null,'include':_0x6648ee[_0xb9c7('0x19')]?_0x6648ee[_0xb9c7('0x19')][_0xb9c7('0x1c')]?_['map'](_0x6648ee[_0xb9c7('0x19')][_0xb9c7('0x1c')],function(_0x4982ef){return{'model':db[_0x4982ef[_0xb9c7('0x1e')]],'as':_0x4982ef['as'],'attributes':_0x4982ef['attributes'],'include':_0x4982ef[_0xb9c7('0x1c')]?_[_0xb9c7('0x1d')](_0x4982ef[_0xb9c7('0x1c')],function(_0x32d532){return{'model':db[_0x32d532[_0xb9c7('0x1e')]],'as':_0x32d532['as'],'attributes':_0x32d532['attributes'],'include':_0x32d532[_0xb9c7('0x1c')]?_['map'](_0x32d532['include'],function(_0x44fe79){return{'model':db[_0x44fe79[_0xb9c7('0x1e')]],'as':_0x44fe79['as'],'attributes':_0x44fe79['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x124c89){logger[_0xb9c7('0xc')](_0xb9c7('0x20'),_0x6648ee);logger[_0xb9c7('0xf')](_0xb9c7('0x20'),_0x6648ee,JSON['stringify'](_0x124c89));_0x3cad91(_0x124c89);})[_0xb9c7('0x15')](function(_0x56994b){logger[_0xb9c7('0x11')](_0xb9c7('0x20'),_0x56994b[_0xb9c7('0x13')],_0x6648ee);_0xb9ac4e(_0x3ec182[_0xb9c7('0x11')](0x1f4,_0x56994b[_0xb9c7('0x13')]));});});}; \ No newline at end of file +var _0x140f=['map','include','model','ShowSugarcrmAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes'];(function(_0xfb41d,_0x32740c){var _0x246945=function(_0xd82dd9){while(--_0xd82dd9){_0xfb41d['push'](_0xfb41d['shift']());}};_0x246945(++_0x32740c);}(_0x140f,0x10c));var _0xf140=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x140f[_0x5e36d1];return _0x950b9e;};'use strict';var _=require(_0xf140('0x0'));var util=require(_0xf140('0x1'));var moment=require(_0xf140('0x2'));var BPromise=require(_0xf140('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf140('0x4'));var db=require(_0xf140('0x5'))['db'];var utils=require(_0xf140('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf140('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf140('0x8')][_0xf140('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4cb85e,_0x5cc986,_0x47f9fa){return new BPromise(function(_0x45d8e3,_0x46a853){return client['request'](_0x4cb85e,_0x47f9fa)[_0xf140('0xa')](function(_0x357266){logger[_0xf140('0xb')](_0xf140('0xc'),_0x5cc986,_0xf140('0xd'));logger[_0xf140('0xe')](_0xf140('0xf'),_0x5cc986,'request\x20sent',JSON[_0xf140('0x10')](_0x357266));if(_0x357266[_0xf140('0x11')]){if(_0x357266[_0xf140('0x11')][_0xf140('0x12')]===0x1f4){logger[_0xf140('0x11')](_0xf140('0xc'),_0x5cc986,_0x357266['error']['message']);return _0x46a853(_0x357266['error'][_0xf140('0x13')]);}logger[_0xf140('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x5cc986,_0x357266[_0xf140('0x11')][_0xf140('0x13')]);return _0x45d8e3(_0x357266[_0xf140('0x11')][_0xf140('0x13')]);}else{logger[_0xf140('0xb')](_0xf140('0xc'),_0x5cc986,_0xf140('0xd'));_0x45d8e3(_0x357266[_0xf140('0x14')][_0xf140('0x13')]);}})[_0xf140('0x15')](function(_0x3ac66c){logger['error'](_0xf140('0xc'),_0x5cc986,_0x3ac66c);_0x46a853(_0x3ac66c);});});}exports[_0xf140('0x16')]=function(_0x44e91f){var _0x1e5de5=this;return new Promise(function(_0x3ef57c,_0x46a31d){return db[_0xf140('0x17')][_0xf140('0x18')]({'raw':_0x44e91f[_0xf140('0x19')]?_0x44e91f[_0xf140('0x19')][_0xf140('0x1a')]===undefined?!![]:![]:!![],'where':_0x44e91f[_0xf140('0x19')]?_0x44e91f[_0xf140('0x19')][_0xf140('0x1b')]||null:null,'attributes':_0x44e91f['options']?_0x44e91f['options'][_0xf140('0x1c')]||null:null,'limit':_0x44e91f['options']?_0x44e91f[_0xf140('0x19')]['limit']||null:null,'include':_0x44e91f[_0xf140('0x19')]?_0x44e91f[_0xf140('0x19')]['include']?_[_0xf140('0x1d')](_0x44e91f[_0xf140('0x19')][_0xf140('0x1e')],function(_0x1ff64b){return{'model':db[_0x1ff64b[_0xf140('0x1f')]],'as':_0x1ff64b['as'],'attributes':_0x1ff64b[_0xf140('0x1c')],'include':_0x1ff64b['include']?_[_0xf140('0x1d')](_0x1ff64b['include'],function(_0x5b7965){return{'model':db[_0x5b7965['model']],'as':_0x5b7965['as'],'attributes':_0x5b7965[_0xf140('0x1c')],'include':_0x5b7965[_0xf140('0x1e')]?_[_0xf140('0x1d')](_0x5b7965[_0xf140('0x1e')],function(_0x2d0d23){return{'model':db[_0x2d0d23[_0xf140('0x1f')]],'as':_0x2d0d23['as'],'attributes':_0x2d0d23[_0xf140('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf140('0xa')](function(_0x184ba3){logger[_0xf140('0xb')](_0xf140('0x16'),_0x44e91f);logger[_0xf140('0xe')](_0xf140('0x16'),_0x44e91f,JSON[_0xf140('0x10')](_0x184ba3));_0x3ef57c(_0x184ba3);})[_0xf140('0x15')](function(_0x1157b4){logger[_0xf140('0x11')](_0xf140('0x16'),_0x1157b4[_0xf140('0x13')],_0x44e91f);_0x46a31d(_0x1e5de5[_0xf140('0x11')](0x1f4,_0x1157b4[_0xf140('0x13')]));});});};exports[_0xf140('0x20')]=function(_0x543424){var _0x1cf14d=this;return new Promise(function(_0x2d2d72,_0x408154){return db[_0xf140('0x17')]['find']({'raw':_0x543424[_0xf140('0x19')]?_0x543424['options'][_0xf140('0x1a')]===undefined?!![]:![]:!![],'where':_0x543424['options']?_0x543424['options'][_0xf140('0x1b')]||null:null,'attributes':_0x543424[_0xf140('0x19')]?_0x543424[_0xf140('0x19')][_0xf140('0x1c')]||null:null,'include':_0x543424['options']?_0x543424[_0xf140('0x19')][_0xf140('0x1e')]?_['map'](_0x543424[_0xf140('0x19')]['include'],function(_0x50d17c){return{'model':db[_0x50d17c['model']],'as':_0x50d17c['as'],'attributes':_0x50d17c[_0xf140('0x1c')],'include':_0x50d17c['include']?_[_0xf140('0x1d')](_0x50d17c[_0xf140('0x1e')],function(_0x36c8e7){return{'model':db[_0x36c8e7[_0xf140('0x1f')]],'as':_0x36c8e7['as'],'attributes':_0x36c8e7['attributes'],'include':_0x36c8e7[_0xf140('0x1e')]?_['map'](_0x36c8e7[_0xf140('0x1e')],function(_0x5070dc){return{'model':db[_0x5070dc['model']],'as':_0x5070dc['as'],'attributes':_0x5070dc['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2da440){logger[_0xf140('0xb')](_0xf140('0x20'),_0x543424);logger['debug'](_0xf140('0x20'),_0x543424,JSON[_0xf140('0x10')](_0x2da440));_0x2d2d72(_0x2da440);})[_0xf140('0x15')](function(_0xe3814d){logger[_0xf140('0x11')](_0xf140('0x20'),_0xe3814d[_0xf140('0x13')],_0x543424);_0x408154(_0x1cf14d['error'](0x1f4,_0xe3814d[_0xf140('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 09887f3..f4258d7 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 _0x3e2b=['post','create','put','update','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','index','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x314e16,_0x109b3b){var _0x2b76a5=function(_0x34eabe){while(--_0x34eabe){_0x314e16['push'](_0x314e16['shift']());}};_0x2b76a5(++_0x109b3b);}(_0x3e2b,0xd3));var _0xb3e2=function(_0x2ceab6,_0x3cbfb1){_0x2ceab6=_0x2ceab6-0x0;var _0x5aedbb=_0x3e2b[_0x2ceab6];return _0x5aedbb;};'use strict';var multer=require(_0xb3e2('0x0'));var util=require(_0xb3e2('0x1'));var path=require(_0xb3e2('0x2'));var timeout=require(_0xb3e2('0x3'));var express=require('express');var router=express[_0xb3e2('0x4')]();var fs_extra=require(_0xb3e2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb3e2('0x6'));var config=require(_0xb3e2('0x7'));var controller=require(_0xb3e2('0x8'));router[_0xb3e2('0x9')]('/',auth['isAuthenticated'](),controller[_0xb3e2('0xa')]);router[_0xb3e2('0x9')]('/:id',auth[_0xb3e2('0xb')](),controller[_0xb3e2('0xc')]);router[_0xb3e2('0x9')](_0xb3e2('0xd'),auth[_0xb3e2('0xb')](),controller[_0xb3e2('0xe')]);router[_0xb3e2('0x9')](_0xb3e2('0xf'),auth[_0xb3e2('0xb')](),controller[_0xb3e2('0x10')]);router[_0xb3e2('0x9')](_0xb3e2('0x11'),auth['isAuthenticated'](),controller[_0xb3e2('0x12')]);router[_0xb3e2('0x13')]('/',auth['isAuthenticated'](),controller[_0xb3e2('0x14')]);router[_0xb3e2('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xb3e2('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8589=['index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','create','put','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated'];(function(_0x1628b3,_0x5f1805){var _0x4bad95=function(_0x1afa12){while(--_0x1afa12){_0x1628b3['push'](_0x1628b3['shift']());}};_0x4bad95(++_0x5f1805);}(_0x8589,0xfa));var _0x9858=function(_0xcef381,_0x2e42c7){_0xcef381=_0xcef381-0x0;var _0x21c3e9=_0x8589[_0xcef381];return _0x21c3e9;};'use strict';var multer=require('multer');var util=require(_0x9858('0x0'));var path=require(_0x9858('0x1'));var timeout=require(_0x9858('0x2'));var express=require(_0x9858('0x3'));var router=express[_0x9858('0x4')]();var fs_extra=require(_0x9858('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9858('0x6'));var controller=require(_0x9858('0x7'));router[_0x9858('0x8')]('/',auth[_0x9858('0x9')](),controller[_0x9858('0xa')]);router[_0x9858('0x8')](_0x9858('0xb'),auth['isAuthenticated'](),controller[_0x9858('0xc')]);router[_0x9858('0x8')](_0x9858('0xd'),auth['isAuthenticated'](),controller['getFields']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x9858('0xe')]);router['get'](_0x9858('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller[_0x9858('0x10')]);router[_0x9858('0x11')](_0x9858('0xb'),auth[_0x9858('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9858('0x12')]);module[_0x9858('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 8a7ba29..aff8ccd 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 _0xf433=['sequelize','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf433,0x196));var _0x3f43=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf433[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x3f43('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3f43('0x1')]}}; \ No newline at end of file +var _0xa3e7=['sequelize','exports','STRING'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xa3e7,0x165));var _0x7a3e=function(_0x175095,_0x486a85){_0x175095=_0x175095-0x0;var _0x137e14=_0xa3e7[_0x175095];return _0x137e14;};'use strict';var Sequelize=require(_0x7a3e('0x0'));module[_0x7a3e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7a3e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 0b38ffb..0465076 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 _0x9442=['getFields','SugarcrmField','getSubjects','findOne','getDescriptions','eml-format','zip-dir','request-promise','moment','util','path','sox','ejs','squel','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','destroy','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body'];(function(_0x1b7e7f,_0x1b3165){var _0x48ba76=function(_0x317f63){while(--_0x317f63){_0x1b7e7f['push'](_0x1b7e7f['shift']());}};_0x48ba76(++_0x1b3165);}(_0x9442,0x139));var _0x2944=function(_0x768e32,_0x4f80f6){_0x768e32=_0x768e32-0x0;var _0x54ee49=_0x9442[_0x768e32];return _0x54ee49;};'use strict';var emlformat=require(_0x2944('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2944('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2944('0x2'));var moment=require(_0x2944('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2944('0x4'));var path=require(_0x2944('0x5'));var sox=require(_0x2944('0x6'));var csv=require('to-csv');var ejs=require(_0x2944('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2944('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2944('0x9'));var toCsv=require(_0x2944('0xa'));var querystring=require('querystring');var Papa=require(_0x2944('0xb'));var Redis=require('ioredis');var authService=require(_0x2944('0xc'));var qs=require(_0x2944('0xd'));var as=require(_0x2944('0xe'));var hardwareService=require(_0x2944('0xf'));var logger=require(_0x2944('0x10'))(_0x2944('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2944('0x12'));var db=require(_0x2944('0x13'))['db'];function respondWithStatusCode(_0xb6921c,_0x355b2b){_0x355b2b=_0x355b2b||0xcc;return function(_0x120856){if(_0x120856){return _0xb6921c[_0x2944('0x14')](_0x355b2b);}return _0xb6921c['status'](_0x355b2b)[_0x2944('0x15')]();};}function respondWithResult(_0x588902,_0x1c6f28){_0x1c6f28=_0x1c6f28||0xc8;return function(_0x2c6ea1){if(_0x2c6ea1){return _0x588902[_0x2944('0x16')](_0x1c6f28)[_0x2944('0x17')](_0x2c6ea1);}};}function respondWithFilteredResult(_0x266af6,_0x1c5749){return function(_0x1bf770){if(_0x1bf770){var _0x49de63=typeof _0x1c5749[_0x2944('0x18')]==='undefined'&&typeof _0x1c5749[_0x2944('0x19')]===_0x2944('0x1a');var _0x5456bf=_0x1bf770[_0x2944('0x1b')];var _0x4a76e4=_0x49de63?0x0:_0x1c5749[_0x2944('0x18')];var _0x57e230=_0x49de63?_0x1bf770[_0x2944('0x1b')]:_0x1c5749[_0x2944('0x18')]+_0x1c5749[_0x2944('0x19')];var _0x458450;if(_0x57e230>=_0x5456bf){_0x57e230=_0x5456bf;_0x458450=0xc8;}else{_0x458450=0xce;}_0x266af6[_0x2944('0x16')](_0x458450);return _0x266af6[_0x2944('0x1c')](_0x2944('0x1d'),_0x4a76e4+'-'+_0x57e230+'/'+_0x5456bf)[_0x2944('0x17')](_0x1bf770);}return null;};}function patchUpdates(_0x4ad73e){return function(_0xf04ff0){try{jsonpatch[_0x2944('0x1e')](_0xf04ff0,_0x4ad73e,!![]);}catch(_0x5e41c7){return BPromise['reject'](_0x5e41c7);}return _0xf04ff0['save']();};}function saveUpdates(_0x54b436,_0x23e670){return function(_0x11cce9){if(_0x11cce9){return _0x11cce9[_0x2944('0x1f')](_0x54b436)[_0x2944('0x20')](function(_0x5c591d){return _0x5c591d;});}return null;};}function removeEntity(_0x448889,_0x28d814){return function(_0x1cc43c){if(_0x1cc43c){return _0x1cc43c[_0x2944('0x21')]()['then'](function(){_0x448889[_0x2944('0x16')](0xcc)[_0x2944('0x15')]();});}};}function handleEntityNotFound(_0x3ab499,_0x25cb88){return function(_0x3075ed){if(!_0x3075ed){_0x3ab499[_0x2944('0x14')](0x194);}return _0x3075ed;};}function handleError(_0x18e0f8,_0x43dd8d){_0x43dd8d=_0x43dd8d||0x1f4;return function(_0x355e06){logger['error'](_0x355e06[_0x2944('0x22')]);if(_0x355e06[_0x2944('0x23')]){delete _0x355e06[_0x2944('0x23')];}_0x18e0f8[_0x2944('0x16')](_0x43dd8d)[_0x2944('0x24')](_0x355e06);};}exports[_0x2944('0x25')]=function(_0x15225e,_0xfe6be5){var _0x5a9931={},_0x5c38f7={},_0x50cef7={'count':0x0,'rows':[]};var _0x575ce6=_[_0x2944('0x26')](db[_0x2944('0x27')][_0x2944('0x28')],function(_0x53e8dd){return{'name':_0x53e8dd[_0x2944('0x29')],'type':_0x53e8dd[_0x2944('0x2a')][_0x2944('0x2b')]};});_0x5c38f7[_0x2944('0x2c')]=_[_0x2944('0x26')](_0x575ce6,_0x2944('0x23'));_0x5c38f7[_0x2944('0x2d')]=_[_0x2944('0x2e')](_0x15225e[_0x2944('0x2d')]);_0x5c38f7[_0x2944('0x2f')]=_[_0x2944('0x30')](_0x5c38f7[_0x2944('0x2c')],_0x5c38f7[_0x2944('0x2d')]);_0x5a9931[_0x2944('0x31')]=_[_0x2944('0x30')](_0x5c38f7[_0x2944('0x2c')],qs[_0x2944('0x32')](_0x15225e[_0x2944('0x2d')][_0x2944('0x32')]));_0x5a9931['attributes']=_0x5a9931[_0x2944('0x31')][_0x2944('0x33')]?_0x5a9931[_0x2944('0x31')]:_0x5c38f7[_0x2944('0x2c')];if(!_0x15225e[_0x2944('0x2d')][_0x2944('0x34')](_0x2944('0x35'))){_0x5a9931[_0x2944('0x19')]=qs[_0x2944('0x19')](_0x15225e[_0x2944('0x2d')][_0x2944('0x19')]);_0x5a9931['offset']=qs['offset'](_0x15225e[_0x2944('0x2d')][_0x2944('0x18')]);}_0x5a9931[_0x2944('0x36')]=qs[_0x2944('0x37')](_0x15225e[_0x2944('0x2d')][_0x2944('0x37')]);_0x5a9931[_0x2944('0x38')]=qs['filters'](_[_0x2944('0x39')](_0x15225e['query'],_0x5c38f7[_0x2944('0x2f')]),_0x575ce6);if(_0x15225e[_0x2944('0x2d')][_0x2944('0x3a')]){_0x5a9931[_0x2944('0x38')]=_[_0x2944('0x3b')](_0x5a9931[_0x2944('0x38')],{'$or':_[_0x2944('0x26')](_0x575ce6,function(_0x30a39c){if(_0x30a39c[_0x2944('0x2a')]!==_0x2944('0x3c')){var _0x4f1efc={};_0x4f1efc[_0x30a39c[_0x2944('0x23')]]={'$like':'%'+_0x15225e[_0x2944('0x2d')]['filter']+'%'};return _0x4f1efc;}})});}_0x5a9931=_[_0x2944('0x3b')]({},_0x5a9931,_0x15225e[_0x2944('0x3d')]);var _0x18b644={'where':_0x5a9931[_0x2944('0x38')]};return db[_0x2944('0x27')][_0x2944('0x1b')](_0x18b644)[_0x2944('0x20')](function(_0x38243a){_0x50cef7[_0x2944('0x1b')]=_0x38243a;if(_0x15225e[_0x2944('0x2d')][_0x2944('0x3e')]){_0x5a9931['include']=[{'all':!![]}];}return db[_0x2944('0x27')][_0x2944('0x3f')](_0x5a9931);})[_0x2944('0x20')](function(_0x513eba){_0x50cef7[_0x2944('0x40')]=_0x513eba;return _0x50cef7;})[_0x2944('0x20')](respondWithFilteredResult(_0xfe6be5,_0x5a9931))[_0x2944('0x41')](handleError(_0xfe6be5,null));};exports[_0x2944('0x42')]=function(_0x38d9d6,_0x3f133e){var _0x142eb9={'raw':![],'where':{'id':_0x38d9d6[_0x2944('0x43')]['id']}},_0x14812b={};_0x14812b['model']=_[_0x2944('0x2e')](db['SugarcrmConfiguration'][_0x2944('0x28')]);_0x14812b[_0x2944('0x2d')]=_['keys'](_0x38d9d6[_0x2944('0x2d')]);_0x14812b[_0x2944('0x2f')]=_['intersection'](_0x14812b[_0x2944('0x2c')],_0x14812b[_0x2944('0x2d')]);_0x142eb9[_0x2944('0x31')]=_[_0x2944('0x30')](_0x14812b[_0x2944('0x2c')],qs[_0x2944('0x32')](_0x38d9d6[_0x2944('0x2d')][_0x2944('0x32')]));_0x142eb9['attributes']=_0x142eb9[_0x2944('0x31')][_0x2944('0x33')]?_0x142eb9[_0x2944('0x31')]:_0x14812b[_0x2944('0x2c')];if(_0x38d9d6[_0x2944('0x2d')][_0x2944('0x3e')]){_0x142eb9[_0x2944('0x44')]=[{'all':!![]}];}_0x142eb9=_[_0x2944('0x3b')]({},_0x142eb9,_0x38d9d6[_0x2944('0x3d')]);return db[_0x2944('0x27')][_0x2944('0x45')](_0x142eb9)[_0x2944('0x20')](handleEntityNotFound(_0x3f133e,null))[_0x2944('0x20')](respondWithResult(_0x3f133e,null))[_0x2944('0x41')](handleError(_0x3f133e,null));};exports[_0x2944('0x46')]=function(_0x2e3b57,_0x5f4857){return db[_0x2944('0x27')][_0x2944('0x46')](_0x2e3b57[_0x2944('0x47')],{})[_0x2944('0x20')](respondWithResult(_0x5f4857,0xc9))[_0x2944('0x41')](handleError(_0x5f4857,null));};exports[_0x2944('0x1f')]=function(_0x4737c1,_0x37ad80){if(_0x4737c1[_0x2944('0x47')]['id']){delete _0x4737c1['body']['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x4737c1[_0x2944('0x43')]['id']}})[_0x2944('0x20')](handleEntityNotFound(_0x37ad80,null))[_0x2944('0x20')](saveUpdates(_0x4737c1[_0x2944('0x47')],null))[_0x2944('0x20')](respondWithResult(_0x37ad80,null))[_0x2944('0x41')](handleError(_0x37ad80,null));};exports[_0x2944('0x21')]=function(_0x4a5a78,_0x520151){return db['SugarcrmConfiguration'][_0x2944('0x45')]({'where':{'id':_0x4a5a78['params']['id']}})['then'](handleEntityNotFound(_0x520151,null))[_0x2944('0x20')](removeEntity(_0x520151,null))['catch'](handleError(_0x520151,null));};exports[_0x2944('0x48')]=function(_0x535266,_0x5497e8,_0x2508af){var _0x423154={};var _0x87f32d={};var _0xd07427;var _0x2a8084;return db[_0x2944('0x27')]['findOne']({'where':{'id':_0x535266[_0x2944('0x43')]['id']}})[_0x2944('0x20')](handleEntityNotFound(_0x5497e8,null))[_0x2944('0x20')](function(_0x4f6bf7){if(_0x4f6bf7){_0xd07427=_0x4f6bf7;_0x87f32d[_0x2944('0x2c')]=_['keys'](db[_0x2944('0x49')][_0x2944('0x28')]);_0x87f32d[_0x2944('0x2d')]=_[_0x2944('0x2e')](_0x535266['query']);_0x87f32d[_0x2944('0x2f')]=_[_0x2944('0x30')](_0x87f32d[_0x2944('0x2c')],_0x87f32d[_0x2944('0x2d')]);_0x423154['attributes']=_[_0x2944('0x30')](_0x87f32d[_0x2944('0x2c')],qs[_0x2944('0x32')](_0x535266[_0x2944('0x2d')][_0x2944('0x32')]));_0x423154[_0x2944('0x31')]=_0x423154[_0x2944('0x31')][_0x2944('0x33')]?_0x423154[_0x2944('0x31')]:_0x87f32d[_0x2944('0x2c')];_0x423154[_0x2944('0x36')]=qs['sort'](_0x535266[_0x2944('0x2d')]['sort']);_0x423154['where']=qs['filters'](_['pick'](_0x535266[_0x2944('0x2d')],_0x87f32d['filters']));if(_0x535266[_0x2944('0x2d')][_0x2944('0x3a')]){_0x423154['where']=_[_0x2944('0x3b')](_0x423154[_0x2944('0x38')],{'$or':_['map'](_0x423154[_0x2944('0x31')],function(_0x30373e){var _0x273e5e={};_0x273e5e[_0x30373e]={'$like':'%'+_0x535266[_0x2944('0x2d')]['filter']+'%'};return _0x273e5e;})});}_0x423154=_['merge']({},_0x423154,_0x535266[_0x2944('0x3d')]);return _0xd07427[_0x2944('0x48')](_0x423154);}})[_0x2944('0x20')](function(_0x54d4b7){if(_0x54d4b7){_0x2a8084=_0x54d4b7[_0x2944('0x33')];if(!_0x535266[_0x2944('0x2d')][_0x2944('0x34')](_0x2944('0x35'))){_0x423154['limit']=qs[_0x2944('0x19')](_0x535266['query'][_0x2944('0x19')]);_0x423154[_0x2944('0x18')]=qs[_0x2944('0x18')](_0x535266[_0x2944('0x2d')][_0x2944('0x18')]);}return _0xd07427[_0x2944('0x48')](_0x423154);}})[_0x2944('0x20')](function(_0x20ded5){if(_0x20ded5){return _0x20ded5?{'count':_0x2a8084,'rows':_0x20ded5}:null;}})[_0x2944('0x20')](respondWithResult(_0x5497e8,null))['catch'](handleError(_0x5497e8,null));};exports[_0x2944('0x4a')]=function(_0x1dfb17,_0x1aa4a9,_0x2beeb6){var _0x259a5c={};var _0x2ad602={};var _0x49865f;var _0x1237fe;return db[_0x2944('0x27')][_0x2944('0x4b')]({'where':{'id':_0x1dfb17['params']['id']}})[_0x2944('0x20')](handleEntityNotFound(_0x1aa4a9,null))['then'](function(_0x67c7cc){if(_0x67c7cc){_0x49865f=_0x67c7cc;_0x2ad602['model']=_[_0x2944('0x2e')](db['SugarcrmField'][_0x2944('0x28')]);_0x2ad602[_0x2944('0x2d')]=_[_0x2944('0x2e')](_0x1dfb17['query']);_0x2ad602[_0x2944('0x2f')]=_['intersection'](_0x2ad602[_0x2944('0x2c')],_0x2ad602['query']);_0x259a5c[_0x2944('0x31')]=_[_0x2944('0x30')](_0x2ad602[_0x2944('0x2c')],qs['fields'](_0x1dfb17['query'][_0x2944('0x32')]));_0x259a5c[_0x2944('0x31')]=_0x259a5c[_0x2944('0x31')][_0x2944('0x33')]?_0x259a5c[_0x2944('0x31')]:_0x2ad602[_0x2944('0x2c')];_0x259a5c[_0x2944('0x36')]=qs[_0x2944('0x37')](_0x1dfb17[_0x2944('0x2d')][_0x2944('0x37')]);_0x259a5c[_0x2944('0x38')]=qs[_0x2944('0x2f')](_[_0x2944('0x39')](_0x1dfb17[_0x2944('0x2d')],_0x2ad602[_0x2944('0x2f')]));if(_0x1dfb17[_0x2944('0x2d')][_0x2944('0x3a')]){_0x259a5c['where']=_[_0x2944('0x3b')](_0x259a5c['where'],{'$or':_[_0x2944('0x26')](_0x259a5c['attributes'],function(_0x299ebd){var _0x3dc317={};_0x3dc317[_0x299ebd]={'$like':'%'+_0x1dfb17['query'][_0x2944('0x3a')]+'%'};return _0x3dc317;})});}_0x259a5c=_[_0x2944('0x3b')]({},_0x259a5c,_0x1dfb17['options']);return _0x49865f['getSubjects'](_0x259a5c);}})[_0x2944('0x20')](function(_0x5af6ab){if(_0x5af6ab){_0x1237fe=_0x5af6ab[_0x2944('0x33')];if(!_0x1dfb17['query'][_0x2944('0x34')]('nolimit')){_0x259a5c[_0x2944('0x19')]=qs[_0x2944('0x19')](_0x1dfb17[_0x2944('0x2d')][_0x2944('0x19')]);_0x259a5c['offset']=qs['offset'](_0x1dfb17[_0x2944('0x2d')][_0x2944('0x18')]);}return _0x49865f[_0x2944('0x4a')](_0x259a5c);}})[_0x2944('0x20')](function(_0x152263){if(_0x152263){return _0x152263?{'count':_0x1237fe,'rows':_0x152263}:null;}})[_0x2944('0x20')](respondWithResult(_0x1aa4a9,null))[_0x2944('0x41')](handleError(_0x1aa4a9,null));};exports['getDescriptions']=function(_0x5eff2c,_0x151330,_0x450086){var _0x1651ff={};var _0x3dfa78={};var _0x38441a;var _0xab3dfc;return db[_0x2944('0x27')]['findOne']({'where':{'id':_0x5eff2c[_0x2944('0x43')]['id']}})[_0x2944('0x20')](handleEntityNotFound(_0x151330,null))[_0x2944('0x20')](function(_0x142df1){if(_0x142df1){_0x38441a=_0x142df1;_0x3dfa78[_0x2944('0x2c')]=_[_0x2944('0x2e')](db[_0x2944('0x49')][_0x2944('0x28')]);_0x3dfa78['query']=_[_0x2944('0x2e')](_0x5eff2c[_0x2944('0x2d')]);_0x3dfa78['filters']=_[_0x2944('0x30')](_0x3dfa78[_0x2944('0x2c')],_0x3dfa78[_0x2944('0x2d')]);_0x1651ff[_0x2944('0x31')]=_[_0x2944('0x30')](_0x3dfa78[_0x2944('0x2c')],qs[_0x2944('0x32')](_0x5eff2c[_0x2944('0x2d')][_0x2944('0x32')]));_0x1651ff[_0x2944('0x31')]=_0x1651ff[_0x2944('0x31')][_0x2944('0x33')]?_0x1651ff['attributes']:_0x3dfa78[_0x2944('0x2c')];_0x1651ff['order']=qs[_0x2944('0x37')](_0x5eff2c[_0x2944('0x2d')][_0x2944('0x37')]);_0x1651ff['where']=qs[_0x2944('0x2f')](_[_0x2944('0x39')](_0x5eff2c[_0x2944('0x2d')],_0x3dfa78[_0x2944('0x2f')]));if(_0x5eff2c['query'][_0x2944('0x3a')]){_0x1651ff[_0x2944('0x38')]=_[_0x2944('0x3b')](_0x1651ff[_0x2944('0x38')],{'$or':_[_0x2944('0x26')](_0x1651ff['attributes'],function(_0x4cf209){var _0x35d359={};_0x35d359[_0x4cf209]={'$like':'%'+_0x5eff2c[_0x2944('0x2d')][_0x2944('0x3a')]+'%'};return _0x35d359;})});}_0x1651ff=_[_0x2944('0x3b')]({},_0x1651ff,_0x5eff2c['options']);return _0x38441a[_0x2944('0x4c')](_0x1651ff);}})['then'](function(_0x321202){if(_0x321202){_0xab3dfc=_0x321202[_0x2944('0x33')];if(!_0x5eff2c['query'][_0x2944('0x34')]('nolimit')){_0x1651ff[_0x2944('0x19')]=qs[_0x2944('0x19')](_0x5eff2c[_0x2944('0x2d')][_0x2944('0x19')]);_0x1651ff[_0x2944('0x18')]=qs[_0x2944('0x18')](_0x5eff2c[_0x2944('0x2d')][_0x2944('0x18')]);}return _0x38441a[_0x2944('0x4c')](_0x1651ff);}})[_0x2944('0x20')](function(_0x22b68f){if(_0x22b68f){return _0x22b68f?{'count':_0xab3dfc,'rows':_0x22b68f}:null;}})[_0x2944('0x20')](respondWithResult(_0x151330,null))[_0x2944('0x41')](handleError(_0x151330,null));}; \ No newline at end of file +var _0xff62=['findOne','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','merge','where','type','VIRTUAL','options','SugarcrmConfiguration','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','SugarcrmField','pick','nolimit','getSubjects'];(function(_0x482611,_0x33356d){var _0x4aeb3a=function(_0x44feae){while(--_0x44feae){_0x482611['push'](_0x482611['shift']());}};_0x4aeb3a(++_0x33356d);}(_0xff62,0x1ee));var _0x2ff6=function(_0x384d39,_0xf060fc){_0x384d39=_0x384d39-0x0;var _0x13bf22=_0xff62[_0x384d39];return _0x13bf22;};'use strict';var emlformat=require(_0x2ff6('0x0'));var rimraf=require(_0x2ff6('0x1'));var zipdir=require(_0x2ff6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2ff6('0x3'));var moment=require(_0x2ff6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2ff6('0x5'));var path=require(_0x2ff6('0x6'));var sox=require('sox');var csv=require(_0x2ff6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2ff6('0x8'));var _=require(_0x2ff6('0x9'));var squel=require('squel');var crypto=require(_0x2ff6('0xa'));var jsforce=require(_0x2ff6('0xb'));var deskjs=require(_0x2ff6('0xc'));var toCsv=require(_0x2ff6('0x7'));var querystring=require(_0x2ff6('0xd'));var Papa=require(_0x2ff6('0xe'));var Redis=require(_0x2ff6('0xf'));var authService=require(_0x2ff6('0x10'));var qs=require(_0x2ff6('0x11'));var as=require(_0x2ff6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2ff6('0x13'))(_0x2ff6('0x14'));var utils=require(_0x2ff6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2ff6('0x16'));var db=require(_0x2ff6('0x17'))['db'];function respondWithStatusCode(_0x50f682,_0x27b390){_0x27b390=_0x27b390||0xcc;return function(_0x48755f){if(_0x48755f){return _0x50f682[_0x2ff6('0x18')](_0x27b390);}return _0x50f682[_0x2ff6('0x19')](_0x27b390)[_0x2ff6('0x1a')]();};}function respondWithResult(_0x5e0924,_0xac1805){_0xac1805=_0xac1805||0xc8;return function(_0x32b997){if(_0x32b997){return _0x5e0924[_0x2ff6('0x19')](_0xac1805)[_0x2ff6('0x1b')](_0x32b997);}};}function respondWithFilteredResult(_0x1cd598,_0x45e829){return function(_0x34e9a1){if(_0x34e9a1){var _0x1a8dab=typeof _0x45e829[_0x2ff6('0x1c')]===_0x2ff6('0x1d')&&typeof _0x45e829[_0x2ff6('0x1e')]===_0x2ff6('0x1d');var _0x4e79bd=_0x34e9a1[_0x2ff6('0x1f')];var _0x2bf3ed=_0x1a8dab?0x0:_0x45e829[_0x2ff6('0x1c')];var _0x39b3a4=_0x1a8dab?_0x34e9a1[_0x2ff6('0x1f')]:_0x45e829['offset']+_0x45e829[_0x2ff6('0x1e')];var _0x8e65e0;if(_0x39b3a4>=_0x4e79bd){_0x39b3a4=_0x4e79bd;_0x8e65e0=0xc8;}else{_0x8e65e0=0xce;}_0x1cd598[_0x2ff6('0x19')](_0x8e65e0);return _0x1cd598['set'](_0x2ff6('0x20'),_0x2bf3ed+'-'+_0x39b3a4+'/'+_0x4e79bd)[_0x2ff6('0x1b')](_0x34e9a1);}return null;};}function patchUpdates(_0x4f964d){return function(_0x67a0c0){try{jsonpatch[_0x2ff6('0x21')](_0x67a0c0,_0x4f964d,!![]);}catch(_0x4f260e){return BPromise[_0x2ff6('0x22')](_0x4f260e);}return _0x67a0c0[_0x2ff6('0x23')]();};}function saveUpdates(_0x9983f8,_0x324e6c){return function(_0x2bc207){if(_0x2bc207){return _0x2bc207[_0x2ff6('0x24')](_0x9983f8)[_0x2ff6('0x25')](function(_0x575787){return _0x575787;});}return null;};}function removeEntity(_0x47c60e,_0x25460c){return function(_0x1753c3){if(_0x1753c3){return _0x1753c3[_0x2ff6('0x26')]()[_0x2ff6('0x25')](function(){_0x47c60e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x320a0d,_0x26c043){return function(_0x46b4c1){if(!_0x46b4c1){_0x320a0d[_0x2ff6('0x18')](0x194);}return _0x46b4c1;};}function handleError(_0x4a72a2,_0x8e5e3f){_0x8e5e3f=_0x8e5e3f||0x1f4;return function(_0x47f7ef){logger[_0x2ff6('0x27')](_0x47f7ef[_0x2ff6('0x28')]);if(_0x47f7ef[_0x2ff6('0x29')]){delete _0x47f7ef[_0x2ff6('0x29')];}_0x4a72a2[_0x2ff6('0x19')](_0x8e5e3f)[_0x2ff6('0x2a')](_0x47f7ef);};}exports[_0x2ff6('0x2b')]=function(_0xa57fe4,_0x42b461){var _0x456292={},_0xa8b216={},_0x1d9b33={'count':0x0,'rows':[]};var _0x49bfc8=_[_0x2ff6('0x2c')](db['SugarcrmConfiguration'][_0x2ff6('0x2d')],function(_0x4586a2){return{'name':_0x4586a2['fieldName'],'type':_0x4586a2['type'][_0x2ff6('0x2e')]};});_0xa8b216[_0x2ff6('0x2f')]=_[_0x2ff6('0x2c')](_0x49bfc8,'name');_0xa8b216[_0x2ff6('0x30')]=_[_0x2ff6('0x31')](_0xa57fe4['query']);_0xa8b216[_0x2ff6('0x32')]=_[_0x2ff6('0x33')](_0xa8b216['model'],_0xa8b216[_0x2ff6('0x30')]);_0x456292[_0x2ff6('0x34')]=_[_0x2ff6('0x33')](_0xa8b216[_0x2ff6('0x2f')],qs[_0x2ff6('0x35')](_0xa57fe4[_0x2ff6('0x30')][_0x2ff6('0x35')]));_0x456292[_0x2ff6('0x34')]=_0x456292[_0x2ff6('0x34')][_0x2ff6('0x36')]?_0x456292[_0x2ff6('0x34')]:_0xa8b216[_0x2ff6('0x2f')];if(!_0xa57fe4[_0x2ff6('0x30')][_0x2ff6('0x37')]('nolimit')){_0x456292['limit']=qs[_0x2ff6('0x1e')](_0xa57fe4['query'][_0x2ff6('0x1e')]);_0x456292['offset']=qs['offset'](_0xa57fe4[_0x2ff6('0x30')]['offset']);}_0x456292[_0x2ff6('0x38')]=qs[_0x2ff6('0x39')](_0xa57fe4['query']['sort']);_0x456292['where']=qs[_0x2ff6('0x32')](_['pick'](_0xa57fe4[_0x2ff6('0x30')],_0xa8b216[_0x2ff6('0x32')]),_0x49bfc8);if(_0xa57fe4[_0x2ff6('0x30')][_0x2ff6('0x3a')]){_0x456292['where']=_[_0x2ff6('0x3b')](_0x456292[_0x2ff6('0x3c')],{'$or':_['map'](_0x49bfc8,function(_0x270559){if(_0x270559[_0x2ff6('0x3d')]!==_0x2ff6('0x3e')){var _0x9dd3e7={};_0x9dd3e7[_0x270559['name']]={'$like':'%'+_0xa57fe4[_0x2ff6('0x30')]['filter']+'%'};return _0x9dd3e7;}})});}_0x456292=_[_0x2ff6('0x3b')]({},_0x456292,_0xa57fe4[_0x2ff6('0x3f')]);var _0xc0105d={'where':_0x456292[_0x2ff6('0x3c')]};return db[_0x2ff6('0x40')][_0x2ff6('0x1f')](_0xc0105d)[_0x2ff6('0x25')](function(_0xd8439a){_0x1d9b33[_0x2ff6('0x1f')]=_0xd8439a;if(_0xa57fe4[_0x2ff6('0x30')][_0x2ff6('0x41')]){_0x456292[_0x2ff6('0x42')]=[{'all':!![]}];}return db[_0x2ff6('0x40')][_0x2ff6('0x43')](_0x456292);})[_0x2ff6('0x25')](function(_0x505be4){_0x1d9b33[_0x2ff6('0x44')]=_0x505be4;return _0x1d9b33;})['then'](respondWithFilteredResult(_0x42b461,_0x456292))[_0x2ff6('0x45')](handleError(_0x42b461,null));};exports[_0x2ff6('0x46')]=function(_0x186fbf,_0x12fdcd){var _0x21fe4a={'raw':![],'where':{'id':_0x186fbf[_0x2ff6('0x47')]['id']}},_0x2766fd={};_0x2766fd[_0x2ff6('0x2f')]=_[_0x2ff6('0x31')](db[_0x2ff6('0x40')][_0x2ff6('0x2d')]);_0x2766fd[_0x2ff6('0x30')]=_[_0x2ff6('0x31')](_0x186fbf[_0x2ff6('0x30')]);_0x2766fd[_0x2ff6('0x32')]=_['intersection'](_0x2766fd['model'],_0x2766fd[_0x2ff6('0x30')]);_0x21fe4a['attributes']=_[_0x2ff6('0x33')](_0x2766fd[_0x2ff6('0x2f')],qs[_0x2ff6('0x35')](_0x186fbf[_0x2ff6('0x30')]['fields']));_0x21fe4a[_0x2ff6('0x34')]=_0x21fe4a[_0x2ff6('0x34')]['length']?_0x21fe4a['attributes']:_0x2766fd[_0x2ff6('0x2f')];if(_0x186fbf['query'][_0x2ff6('0x41')]){_0x21fe4a[_0x2ff6('0x42')]=[{'all':!![]}];}_0x21fe4a=_[_0x2ff6('0x3b')]({},_0x21fe4a,_0x186fbf['options']);return db[_0x2ff6('0x40')][_0x2ff6('0x48')](_0x21fe4a)['then'](handleEntityNotFound(_0x12fdcd,null))[_0x2ff6('0x25')](respondWithResult(_0x12fdcd,null))[_0x2ff6('0x45')](handleError(_0x12fdcd,null));};exports[_0x2ff6('0x49')]=function(_0xd62b88,_0x1c1a79){return db['SugarcrmConfiguration'][_0x2ff6('0x49')](_0xd62b88[_0x2ff6('0x4a')],{})[_0x2ff6('0x25')](respondWithResult(_0x1c1a79,0xc9))[_0x2ff6('0x45')](handleError(_0x1c1a79,null));};exports[_0x2ff6('0x24')]=function(_0x2461e2,_0x5abf47){if(_0x2461e2[_0x2ff6('0x4a')]['id']){delete _0x2461e2[_0x2ff6('0x4a')]['id'];}return db[_0x2ff6('0x40')]['find']({'where':{'id':_0x2461e2['params']['id']}})['then'](handleEntityNotFound(_0x5abf47,null))[_0x2ff6('0x25')](saveUpdates(_0x2461e2[_0x2ff6('0x4a')],null))['then'](respondWithResult(_0x5abf47,null))[_0x2ff6('0x45')](handleError(_0x5abf47,null));};exports[_0x2ff6('0x26')]=function(_0x1460aa,_0xab3f62){return db[_0x2ff6('0x40')][_0x2ff6('0x48')]({'where':{'id':_0x1460aa['params']['id']}})[_0x2ff6('0x25')](handleEntityNotFound(_0xab3f62,null))[_0x2ff6('0x25')](removeEntity(_0xab3f62,null))[_0x2ff6('0x45')](handleError(_0xab3f62,null));};exports[_0x2ff6('0x4b')]=function(_0x2e3366,_0x43c328,_0x45f193){var _0x48e405={};var _0x1aaf75={};var _0x593258;var _0x4eb068;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x2e3366[_0x2ff6('0x47')]['id']}})[_0x2ff6('0x25')](handleEntityNotFound(_0x43c328,null))[_0x2ff6('0x25')](function(_0x34c245){if(_0x34c245){_0x593258=_0x34c245;_0x1aaf75[_0x2ff6('0x2f')]=_[_0x2ff6('0x31')](db[_0x2ff6('0x4c')][_0x2ff6('0x2d')]);_0x1aaf75['query']=_[_0x2ff6('0x31')](_0x2e3366[_0x2ff6('0x30')]);_0x1aaf75['filters']=_[_0x2ff6('0x33')](_0x1aaf75['model'],_0x1aaf75[_0x2ff6('0x30')]);_0x48e405['attributes']=_[_0x2ff6('0x33')](_0x1aaf75['model'],qs[_0x2ff6('0x35')](_0x2e3366[_0x2ff6('0x30')][_0x2ff6('0x35')]));_0x48e405[_0x2ff6('0x34')]=_0x48e405[_0x2ff6('0x34')][_0x2ff6('0x36')]?_0x48e405['attributes']:_0x1aaf75['model'];_0x48e405[_0x2ff6('0x38')]=qs[_0x2ff6('0x39')](_0x2e3366[_0x2ff6('0x30')]['sort']);_0x48e405[_0x2ff6('0x3c')]=qs['filters'](_[_0x2ff6('0x4d')](_0x2e3366[_0x2ff6('0x30')],_0x1aaf75[_0x2ff6('0x32')]));if(_0x2e3366['query'][_0x2ff6('0x3a')]){_0x48e405['where']=_[_0x2ff6('0x3b')](_0x48e405['where'],{'$or':_[_0x2ff6('0x2c')](_0x48e405[_0x2ff6('0x34')],function(_0x1f654b){var _0x268334={};_0x268334[_0x1f654b]={'$like':'%'+_0x2e3366[_0x2ff6('0x30')][_0x2ff6('0x3a')]+'%'};return _0x268334;})});}_0x48e405=_[_0x2ff6('0x3b')]({},_0x48e405,_0x2e3366['options']);return _0x593258[_0x2ff6('0x4b')](_0x48e405);}})[_0x2ff6('0x25')](function(_0x3235f6){if(_0x3235f6){_0x4eb068=_0x3235f6[_0x2ff6('0x36')];if(!_0x2e3366[_0x2ff6('0x30')][_0x2ff6('0x37')](_0x2ff6('0x4e'))){_0x48e405[_0x2ff6('0x1e')]=qs[_0x2ff6('0x1e')](_0x2e3366[_0x2ff6('0x30')][_0x2ff6('0x1e')]);_0x48e405[_0x2ff6('0x1c')]=qs['offset'](_0x2e3366[_0x2ff6('0x30')][_0x2ff6('0x1c')]);}return _0x593258['getFields'](_0x48e405);}})[_0x2ff6('0x25')](function(_0x1d79fd){if(_0x1d79fd){return _0x1d79fd?{'count':_0x4eb068,'rows':_0x1d79fd}:null;}})[_0x2ff6('0x25')](respondWithResult(_0x43c328,null))[_0x2ff6('0x45')](handleError(_0x43c328,null));};exports[_0x2ff6('0x4f')]=function(_0x148ab3,_0x55e2c6,_0x4280dc){var _0xb89439={};var _0x5ea61d={};var _0x3e5d00;var _0x142f64;return db[_0x2ff6('0x40')][_0x2ff6('0x50')]({'where':{'id':_0x148ab3['params']['id']}})['then'](handleEntityNotFound(_0x55e2c6,null))['then'](function(_0x2b0b04){if(_0x2b0b04){_0x3e5d00=_0x2b0b04;_0x5ea61d[_0x2ff6('0x2f')]=_[_0x2ff6('0x31')](db[_0x2ff6('0x4c')][_0x2ff6('0x2d')]);_0x5ea61d[_0x2ff6('0x30')]=_[_0x2ff6('0x31')](_0x148ab3[_0x2ff6('0x30')]);_0x5ea61d[_0x2ff6('0x32')]=_[_0x2ff6('0x33')](_0x5ea61d[_0x2ff6('0x2f')],_0x5ea61d[_0x2ff6('0x30')]);_0xb89439[_0x2ff6('0x34')]=_[_0x2ff6('0x33')](_0x5ea61d[_0x2ff6('0x2f')],qs[_0x2ff6('0x35')](_0x148ab3[_0x2ff6('0x30')][_0x2ff6('0x35')]));_0xb89439['attributes']=_0xb89439['attributes'][_0x2ff6('0x36')]?_0xb89439[_0x2ff6('0x34')]:_0x5ea61d[_0x2ff6('0x2f')];_0xb89439[_0x2ff6('0x38')]=qs['sort'](_0x148ab3[_0x2ff6('0x30')]['sort']);_0xb89439[_0x2ff6('0x3c')]=qs[_0x2ff6('0x32')](_[_0x2ff6('0x4d')](_0x148ab3[_0x2ff6('0x30')],_0x5ea61d[_0x2ff6('0x32')]));if(_0x148ab3['query']['filter']){_0xb89439[_0x2ff6('0x3c')]=_[_0x2ff6('0x3b')](_0xb89439[_0x2ff6('0x3c')],{'$or':_[_0x2ff6('0x2c')](_0xb89439[_0x2ff6('0x34')],function(_0x346c51){var _0x2c3ca8={};_0x2c3ca8[_0x346c51]={'$like':'%'+_0x148ab3['query'][_0x2ff6('0x3a')]+'%'};return _0x2c3ca8;})});}_0xb89439=_[_0x2ff6('0x3b')]({},_0xb89439,_0x148ab3[_0x2ff6('0x3f')]);return _0x3e5d00[_0x2ff6('0x4f')](_0xb89439);}})[_0x2ff6('0x25')](function(_0x2151c0){if(_0x2151c0){_0x142f64=_0x2151c0['length'];if(!_0x148ab3[_0x2ff6('0x30')][_0x2ff6('0x37')](_0x2ff6('0x4e'))){_0xb89439[_0x2ff6('0x1e')]=qs[_0x2ff6('0x1e')](_0x148ab3['query'][_0x2ff6('0x1e')]);_0xb89439[_0x2ff6('0x1c')]=qs[_0x2ff6('0x1c')](_0x148ab3[_0x2ff6('0x30')][_0x2ff6('0x1c')]);}return _0x3e5d00[_0x2ff6('0x4f')](_0xb89439);}})[_0x2ff6('0x25')](function(_0x167dfd){if(_0x167dfd){return _0x167dfd?{'count':_0x142f64,'rows':_0x167dfd}:null;}})[_0x2ff6('0x25')](respondWithResult(_0x55e2c6,null))[_0x2ff6('0x45')](handleError(_0x55e2c6,null));};exports[_0x2ff6('0x51')]=function(_0x513d92,_0xe3426,_0x2fdca5){var _0x2220d6={};var _0x5067f8={};var _0xd4d6e2;var _0x5a8b1a;return db[_0x2ff6('0x40')]['findOne']({'where':{'id':_0x513d92[_0x2ff6('0x47')]['id']}})[_0x2ff6('0x25')](handleEntityNotFound(_0xe3426,null))[_0x2ff6('0x25')](function(_0xf3d9c1){if(_0xf3d9c1){_0xd4d6e2=_0xf3d9c1;_0x5067f8[_0x2ff6('0x2f')]=_['keys'](db[_0x2ff6('0x4c')][_0x2ff6('0x2d')]);_0x5067f8['query']=_[_0x2ff6('0x31')](_0x513d92[_0x2ff6('0x30')]);_0x5067f8[_0x2ff6('0x32')]=_['intersection'](_0x5067f8[_0x2ff6('0x2f')],_0x5067f8[_0x2ff6('0x30')]);_0x2220d6['attributes']=_['intersection'](_0x5067f8['model'],qs[_0x2ff6('0x35')](_0x513d92['query'][_0x2ff6('0x35')]));_0x2220d6[_0x2ff6('0x34')]=_0x2220d6[_0x2ff6('0x34')]['length']?_0x2220d6[_0x2ff6('0x34')]:_0x5067f8['model'];_0x2220d6[_0x2ff6('0x38')]=qs[_0x2ff6('0x39')](_0x513d92[_0x2ff6('0x30')]['sort']);_0x2220d6['where']=qs['filters'](_[_0x2ff6('0x4d')](_0x513d92[_0x2ff6('0x30')],_0x5067f8[_0x2ff6('0x32')]));if(_0x513d92[_0x2ff6('0x30')]['filter']){_0x2220d6[_0x2ff6('0x3c')]=_[_0x2ff6('0x3b')](_0x2220d6[_0x2ff6('0x3c')],{'$or':_[_0x2ff6('0x2c')](_0x2220d6[_0x2ff6('0x34')],function(_0x149145){var _0x37f66c={};_0x37f66c[_0x149145]={'$like':'%'+_0x513d92[_0x2ff6('0x30')][_0x2ff6('0x3a')]+'%'};return _0x37f66c;})});}_0x2220d6=_['merge']({},_0x2220d6,_0x513d92[_0x2ff6('0x3f')]);return _0xd4d6e2['getDescriptions'](_0x2220d6);}})[_0x2ff6('0x25')](function(_0x5de98d){if(_0x5de98d){_0x5a8b1a=_0x5de98d[_0x2ff6('0x36')];if(!_0x513d92[_0x2ff6('0x30')][_0x2ff6('0x37')](_0x2ff6('0x4e'))){_0x2220d6[_0x2ff6('0x1e')]=qs['limit'](_0x513d92['query']['limit']);_0x2220d6[_0x2ff6('0x1c')]=qs[_0x2ff6('0x1c')](_0x513d92['query'][_0x2ff6('0x1c')]);}return _0xd4d6e2['getDescriptions'](_0x2220d6);}})[_0x2ff6('0x25')](function(_0x5c8c79){if(_0x5c8c79){return _0x5c8c79?{'count':_0x5a8b1a,'rows':_0x5c8c79}:null;}})[_0x2ff6('0x25')](respondWithResult(_0xe3426,null))[_0x2ff6('0x45')](handleError(_0xe3426,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 2a95b7c..42b9918 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 _0xf699=['exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1b2bd2,_0x491f68){var _0x34a271=function(_0x6036d){while(--_0x6036d){_0x1b2bd2['push'](_0x1b2bd2['shift']());}};_0x34a271(++_0x491f68);}(_0xf699,0x14e));var _0x9f69=function(_0xf4fee8,_0x5951ce){_0xf4fee8=_0xf4fee8-0x0;var _0x1303d7=_0xf699[_0xf4fee8];return _0x1303d7;};'use strict';var _=require(_0x9f69('0x0'));var util=require('util');var logger=require(_0x9f69('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9f69('0x2'));var rp=require(_0x9f69('0x3'));var fs=require('fs');var path=require(_0x9f69('0x4'));var rimraf=require(_0x9f69('0x5'));var config=require(_0x9f69('0x6'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x9f69('0x7')]=function(_0x2d569a,_0x53cd33){return _0x2d569a[_0x9f69('0x8')](_0x9f69('0x9'),attributes,{'tableName':_0x9f69('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1bb=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash'];(function(_0x3d5f84,_0x569548){var _0x1981b8=function(_0x3bf9f3){while(--_0x3bf9f3){_0x3d5f84['push'](_0x3d5f84['shift']());}};_0x1981b8(++_0x569548);}(_0xd1bb,0x141));var _0xbd1b=function(_0x1cae3c,_0x1e68a7){_0x1cae3c=_0x1cae3c-0x0;var _0x321490=_0xd1bb[_0x1cae3c];return _0x321490;};'use strict';var _=require(_0xbd1b('0x0'));var util=require(_0xbd1b('0x1'));var logger=require(_0xbd1b('0x2'))(_0xbd1b('0x3'));var moment=require('moment');var BPromise=require(_0xbd1b('0x4'));var rp=require(_0xbd1b('0x5'));var fs=require('fs');var path=require(_0xbd1b('0x6'));var rimraf=require(_0xbd1b('0x7'));var config=require(_0xbd1b('0x8'));var attributes=require(_0xbd1b('0x9'));module[_0xbd1b('0xa')]=function(_0x41a9e0,_0x3ac295){return _0x41a9e0[_0xbd1b('0xb')](_0xbd1b('0xc'),attributes,{'tableName':_0xbd1b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 31598ff..5307915 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 _0x2773=['info','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SugarcrmConfiguration,\x20%s,\x20%s','message','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then'];(function(_0x1e2321,_0x3ae1c5){var _0x1d346d=function(_0x24f171){while(--_0x24f171){_0x1e2321['push'](_0x1e2321['shift']());}};_0x1d346d(++_0x3ae1c5);}(_0x2773,0x108));var _0x3277=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2773[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0x3277('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3277('0x1'))['db'];var utils=require(_0x3277('0x2'));var logger=require(_0x3277('0x3'))(_0x3277('0x4'));var config=require(_0x3277('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3f10b4,_0x5a74ca,_0x1e09cb){return new BPromise(function(_0x3d3941,_0x4ca374){return client[_0x3277('0x6')](_0x3f10b4,_0x1e09cb)[_0x3277('0x7')](function(_0x4560f0){logger[_0x3277('0x8')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5a74ca,'request\x20sent');logger[_0x3277('0x9')](_0x3277('0xa'),_0x5a74ca,_0x3277('0xb'),JSON[_0x3277('0xc')](_0x4560f0));if(_0x4560f0[_0x3277('0xd')]){if(_0x4560f0[_0x3277('0xd')]['code']===0x1f4){logger[_0x3277('0xd')](_0x3277('0xe'),_0x5a74ca,_0x4560f0[_0x3277('0xd')][_0x3277('0xf')]);return _0x4ca374(_0x4560f0[_0x3277('0xd')][_0x3277('0xf')]);}logger[_0x3277('0xd')](_0x3277('0xe'),_0x5a74ca,_0x4560f0[_0x3277('0xd')][_0x3277('0xf')]);return _0x3d3941(_0x4560f0[_0x3277('0xd')][_0x3277('0xf')]);}else{logger[_0x3277('0x8')](_0x3277('0xe'),_0x5a74ca,'request\x20sent');_0x3d3941(_0x4560f0['result'][_0x3277('0xf')]);}})['catch'](function(_0x1c8fa2){logger[_0x3277('0xd')](_0x3277('0xe'),_0x5a74ca,_0x1c8fa2);_0x4ca374(_0x1c8fa2);});});} \ No newline at end of file +var _0xad68=['error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xad68,0x15a));var _0x8ad6=function(_0x292bab,_0x4eb300){_0x292bab=_0x292bab-0x0;var _0x18b22a=_0xad68[_0x292bab];return _0x18b22a;};'use strict';var _=require(_0x8ad6('0x0'));var util=require(_0x8ad6('0x1'));var moment=require('moment');var BPromise=require(_0x8ad6('0x2'));var rs=require(_0x8ad6('0x3'));var fs=require('fs');var Redis=require(_0x8ad6('0x4'));var db=require(_0x8ad6('0x5'))['db'];var utils=require(_0x8ad6('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8ad6('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8ad6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4958dd,_0x5b3636,_0x4069cd){return new BPromise(function(_0x438bf2,_0x230b9f){return client['request'](_0x4958dd,_0x4069cd)[_0x8ad6('0x9')](function(_0x202946){logger[_0x8ad6('0xa')](_0x8ad6('0xb'),_0x5b3636,_0x8ad6('0xc'));logger['debug'](_0x8ad6('0xd'),_0x5b3636,_0x8ad6('0xc'),JSON[_0x8ad6('0xe')](_0x202946));if(_0x202946['error']){if(_0x202946['error']['code']===0x1f4){logger[_0x8ad6('0xf')](_0x8ad6('0xb'),_0x5b3636,_0x202946['error']['message']);return _0x230b9f(_0x202946['error'][_0x8ad6('0x10')]);}logger[_0x8ad6('0xf')](_0x8ad6('0xb'),_0x5b3636,_0x202946['error'][_0x8ad6('0x10')]);return _0x438bf2(_0x202946[_0x8ad6('0xf')][_0x8ad6('0x10')]);}else{logger['info'](_0x8ad6('0xb'),_0x5b3636,'request\x20sent');_0x438bf2(_0x202946[_0x8ad6('0x11')][_0x8ad6('0x10')]);}})[_0x8ad6('0x12')](function(_0x5eb695){logger[_0x8ad6('0xf')](_0x8ad6('0xb'),_0x5b3636,_0x5eb695);_0x230b9f(_0x5eb695);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index a3a65ab..9c46353 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 _0x1c47=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x314a2e,_0x2d4f9d){var _0x3f3fc2=function(_0x1d47c7){while(--_0x1d47c7){_0x314a2e['push'](_0x314a2e['shift']());}};_0x3f3fc2(++_0x2d4f9d);}(_0x1c47,0x1c3));var _0x71c4=function(_0x4cce65,_0x40021e){_0x4cce65=_0x4cce65-0x0;var _0x4d1b45=_0x1c47[_0x4cce65];return _0x4d1b45;};'use strict';var multer=require(_0x71c4('0x0'));var util=require(_0x71c4('0x1'));var path=require(_0x71c4('0x2'));var timeout=require(_0x71c4('0x3'));var express=require(_0x71c4('0x4'));var router=express[_0x71c4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x71c4('0x6'));var interaction=require(_0x71c4('0x7'));var config=require(_0x71c4('0x8'));var controller=require(_0x71c4('0x9'));router['get']('/',auth[_0x71c4('0xa')](),controller[_0x71c4('0xb')]);router['get'](_0x71c4('0xc'),auth[_0x71c4('0xa')](),controller[_0x71c4('0xd')]);router['post']('/',auth[_0x71c4('0xa')](),controller[_0x71c4('0xe')]);router[_0x71c4('0xf')](_0x71c4('0xc'),auth[_0x71c4('0xa')](),controller[_0x71c4('0x10')]);router[_0x71c4('0x11')](_0x71c4('0xc'),auth[_0x71c4('0xa')](),controller[_0x71c4('0x12')]);module['exports']=router; \ No newline at end of file +var _0xd11d=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','util','path','connect-timeout','Router'];(function(_0x515afd,_0x1a1e91){var _0x536d53=function(_0x1d3a89){while(--_0x1d3a89){_0x515afd['push'](_0x515afd['shift']());}};_0x536d53(++_0x1a1e91);}(_0xd11d,0x1be));var _0xdd11=function(_0x351dd9,_0x42a54d){_0x351dd9=_0x351dd9-0x0;var _0x1925e1=_0xd11d[_0x351dd9];return _0x1925e1;};'use strict';var multer=require('multer');var util=require(_0xdd11('0x0'));var path=require(_0xdd11('0x1'));var timeout=require(_0xdd11('0x2'));var express=require('express');var router=express[_0xdd11('0x3')]();var fs_extra=require(_0xdd11('0x4'));var auth=require(_0xdd11('0x5'));var interaction=require(_0xdd11('0x6'));var config=require(_0xdd11('0x7'));var controller=require('./intSugarcrmField.controller');router[_0xdd11('0x8')]('/',auth['isAuthenticated'](),controller[_0xdd11('0x9')]);router[_0xdd11('0x8')](_0xdd11('0xa'),auth[_0xdd11('0xb')](),controller[_0xdd11('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdd11('0xd')]);router[_0xdd11('0xe')](_0xdd11('0xa'),auth['isAuthenticated'](),controller[_0xdd11('0xf')]);router[_0xdd11('0x10')](_0xdd11('0xa'),auth[_0xdd11('0xb')](),controller[_0xdd11('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 16dc179..da1a7aa 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 _0xdaa9=['ENUM','string','variable','customVariable','STRING','BOOLEAN','sequelize','exports'];(function(_0x1f01f8,_0xe249c5){var _0x31ea67=function(_0x5e05b5){while(--_0x5e05b5){_0x1f01f8['push'](_0x1f01f8['shift']());}};_0x31ea67(++_0xe249c5);}(_0xdaa9,0x196));var _0x9daa=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xdaa9[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x9daa('0x0'));module[_0x9daa('0x1')]={'type':{'type':Sequelize[_0x9daa('0x2')](_0x9daa('0x3'),_0x9daa('0x4'),_0x9daa('0x5'),'keyValue','picklist'),'defaultValue':_0x9daa('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9daa('0x2')](_0x9daa('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x9daa('0x6')]},'idField':{'type':Sequelize[_0x9daa('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9daa('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9daa('0x6')]}}; \ No newline at end of file +var _0xb68f=['exports','ENUM','variable','customVariable','keyValue','picklist','STRING','string','BOOLEAN','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb68f,0xa9));var _0xfb68=function(_0x4e29de,_0x329e27){_0x4e29de=_0x4e29de-0x0;var _0xd40819=_0xb68f[_0x4e29de];return _0xd40819;};'use strict';var Sequelize=require(_0xfb68('0x0'));module[_0xfb68('0x1')]={'type':{'type':Sequelize[_0xfb68('0x2')]('string',_0xfb68('0x3'),_0xfb68('0x4'),_0xfb68('0x5'),_0xfb68('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xfb68('0x7')]},'keyType':{'type':Sequelize[_0xfb68('0x2')](_0xfb68('0x8'),_0xfb68('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xfb68('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xfb68('0x7')]},'customField':{'type':Sequelize[_0xfb68('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfb68('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index b5dd26f..683b5fc 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 _0x8a60=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','length','attributes','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','SugarcrmField','findAll','rows','catch','show','find','create','body','update','params','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x3c051c,_0x326acd){var _0x4b7daa=function(_0x24592a){while(--_0x24592a){_0x3c051c['push'](_0x3c051c['shift']());}};_0x4b7daa(++_0x326acd);}(_0x8a60,0x137));var _0x08a6=function(_0x2474ac,_0x335d3a){_0x2474ac=_0x2474ac-0x0;var _0x384a8f=_0x8a60[_0x2474ac];return _0x384a8f;};'use strict';var emlformat=require(_0x08a6('0x0'));var rimraf=require(_0x08a6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x08a6('0x2'));var rp=require(_0x08a6('0x3'));var moment=require(_0x08a6('0x4'));var BPromise=require(_0x08a6('0x5'));var Mustache=require(_0x08a6('0x6'));var util=require(_0x08a6('0x7'));var path=require(_0x08a6('0x8'));var sox=require(_0x08a6('0x9'));var csv=require(_0x08a6('0xa'));var ejs=require(_0x08a6('0xb'));var fs=require('fs');var fs_extra=require(_0x08a6('0xc'));var _=require(_0x08a6('0xd'));var squel=require(_0x08a6('0xe'));var crypto=require(_0x08a6('0xf'));var jsforce=require(_0x08a6('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x08a6('0xa'));var querystring=require(_0x08a6('0x11'));var Papa=require('papaparse');var Redis=require(_0x08a6('0x12'));var authService=require(_0x08a6('0x13'));var qs=require(_0x08a6('0x14'));var as=require(_0x08a6('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x08a6('0x16'))('api');var utils=require(_0x08a6('0x17'));var config=require(_0x08a6('0x18'));var licenseUtil=require(_0x08a6('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x351f3c,_0x21f4e3){_0x21f4e3=_0x21f4e3||0xcc;return function(_0x339c17){if(_0x339c17){return _0x351f3c[_0x08a6('0x1a')](_0x21f4e3);}return _0x351f3c[_0x08a6('0x1b')](_0x21f4e3)[_0x08a6('0x1c')]();};}function respondWithResult(_0x448246,_0x1898c4){_0x1898c4=_0x1898c4||0xc8;return function(_0x18ab2c){if(_0x18ab2c){return _0x448246[_0x08a6('0x1b')](_0x1898c4)[_0x08a6('0x1d')](_0x18ab2c);}};}function respondWithFilteredResult(_0x8cd7fc,_0x16f5bd){return function(_0x145212){if(_0x145212){var _0x356f62=typeof _0x16f5bd['offset']===_0x08a6('0x1e')&&typeof _0x16f5bd[_0x08a6('0x1f')]===_0x08a6('0x1e');var _0x24568b=_0x145212[_0x08a6('0x20')];var _0x2a0d89=_0x356f62?0x0:_0x16f5bd['offset'];var _0x4d3f8d=_0x356f62?_0x145212[_0x08a6('0x20')]:_0x16f5bd[_0x08a6('0x21')]+_0x16f5bd[_0x08a6('0x1f')];var _0x536acb;if(_0x4d3f8d>=_0x24568b){_0x4d3f8d=_0x24568b;_0x536acb=0xc8;}else{_0x536acb=0xce;}_0x8cd7fc[_0x08a6('0x1b')](_0x536acb);return _0x8cd7fc[_0x08a6('0x22')](_0x08a6('0x23'),_0x2a0d89+'-'+_0x4d3f8d+'/'+_0x24568b)[_0x08a6('0x1d')](_0x145212);}return null;};}function patchUpdates(_0x376c26){return function(_0x5f4add){try{jsonpatch[_0x08a6('0x24')](_0x5f4add,_0x376c26,!![]);}catch(_0x45d2ab){return BPromise[_0x08a6('0x25')](_0x45d2ab);}return _0x5f4add[_0x08a6('0x26')]();};}function saveUpdates(_0x1c673c,_0x478753){return function(_0x4d98f3){if(_0x4d98f3){return _0x4d98f3['update'](_0x1c673c)[_0x08a6('0x27')](function(_0x186c26){return _0x186c26;});}return null;};}function removeEntity(_0xf20f90,_0xe7a9d7){return function(_0x3e59e4){if(_0x3e59e4){return _0x3e59e4[_0x08a6('0x28')]()[_0x08a6('0x27')](function(){_0xf20f90[_0x08a6('0x1b')](0xcc)[_0x08a6('0x1c')]();});}};}function handleEntityNotFound(_0x3f4301,_0x1e3b58){return function(_0x1709fe){if(!_0x1709fe){_0x3f4301[_0x08a6('0x1a')](0x194);}return _0x1709fe;};}function handleError(_0x20e7df,_0x257a4a){_0x257a4a=_0x257a4a||0x1f4;return function(_0x3aaafe){logger[_0x08a6('0x29')](_0x3aaafe[_0x08a6('0x2a')]);if(_0x3aaafe[_0x08a6('0x2b')]){delete _0x3aaafe[_0x08a6('0x2b')];}_0x20e7df[_0x08a6('0x1b')](_0x257a4a)[_0x08a6('0x2c')](_0x3aaafe);};}exports[_0x08a6('0x2d')]=function(_0x5eb2b1,_0x1397c2){var _0x8685a9={},_0x4d1484={},_0x4a0785={'count':0x0,'rows':[]};var _0x4c1d45=_[_0x08a6('0x2e')](db['SugarcrmField'][_0x08a6('0x2f')],function(_0x508b50){return{'name':_0x508b50[_0x08a6('0x30')],'type':_0x508b50[_0x08a6('0x31')][_0x08a6('0x32')]};});_0x4d1484[_0x08a6('0x33')]=_['map'](_0x4c1d45,_0x08a6('0x2b'));_0x4d1484[_0x08a6('0x34')]=_[_0x08a6('0x35')](_0x5eb2b1[_0x08a6('0x34')]);_0x4d1484['filters']=_[_0x08a6('0x36')](_0x4d1484['model'],_0x4d1484[_0x08a6('0x34')]);_0x8685a9['attributes']=_[_0x08a6('0x36')](_0x4d1484['model'],qs[_0x08a6('0x37')](_0x5eb2b1['query']['fields']));_0x8685a9['attributes']=_0x8685a9['attributes'][_0x08a6('0x38')]?_0x8685a9[_0x08a6('0x39')]:_0x4d1484[_0x08a6('0x33')];if(!_0x5eb2b1[_0x08a6('0x34')][_0x08a6('0x3a')]('nolimit')){_0x8685a9[_0x08a6('0x1f')]=qs[_0x08a6('0x1f')](_0x5eb2b1[_0x08a6('0x34')][_0x08a6('0x1f')]);_0x8685a9[_0x08a6('0x21')]=qs[_0x08a6('0x21')](_0x5eb2b1[_0x08a6('0x34')][_0x08a6('0x21')]);}_0x8685a9[_0x08a6('0x3b')]=qs[_0x08a6('0x3c')](_0x5eb2b1[_0x08a6('0x34')]['sort']);_0x8685a9[_0x08a6('0x3d')]=qs[_0x08a6('0x3e')](_['pick'](_0x5eb2b1[_0x08a6('0x34')],_0x4d1484['filters']),_0x4c1d45);if(_0x5eb2b1[_0x08a6('0x34')][_0x08a6('0x3f')]){_0x8685a9[_0x08a6('0x3d')]=_[_0x08a6('0x40')](_0x8685a9[_0x08a6('0x3d')],{'$or':_[_0x08a6('0x2e')](_0x4c1d45,function(_0x1ae3bc){if(_0x1ae3bc[_0x08a6('0x31')]!==_0x08a6('0x41')){var _0x1f8edc={};_0x1f8edc[_0x1ae3bc['name']]={'$like':'%'+_0x5eb2b1[_0x08a6('0x34')][_0x08a6('0x3f')]+'%'};return _0x1f8edc;}})});}_0x8685a9=_[_0x08a6('0x40')]({},_0x8685a9,_0x5eb2b1[_0x08a6('0x42')]);var _0x444fa3={'where':_0x8685a9['where']};return db['SugarcrmField']['count'](_0x444fa3)[_0x08a6('0x27')](function(_0x247c5c){_0x4a0785[_0x08a6('0x20')]=_0x247c5c;if(_0x5eb2b1[_0x08a6('0x34')][_0x08a6('0x43')]){_0x8685a9[_0x08a6('0x44')]=[{'all':!![]}];}return db[_0x08a6('0x45')][_0x08a6('0x46')](_0x8685a9);})[_0x08a6('0x27')](function(_0xf9d5a6){_0x4a0785[_0x08a6('0x47')]=_0xf9d5a6;return _0x4a0785;})[_0x08a6('0x27')](respondWithFilteredResult(_0x1397c2,_0x8685a9))[_0x08a6('0x48')](handleError(_0x1397c2,null));};exports[_0x08a6('0x49')]=function(_0x1a71ca,_0x4efc04){var _0x1196b1={'raw':!![],'where':{'id':_0x1a71ca['params']['id']}},_0x56d9ff={};_0x56d9ff['model']=_[_0x08a6('0x35')](db[_0x08a6('0x45')][_0x08a6('0x2f')]);_0x56d9ff[_0x08a6('0x34')]=_[_0x08a6('0x35')](_0x1a71ca[_0x08a6('0x34')]);_0x56d9ff[_0x08a6('0x3e')]=_['intersection'](_0x56d9ff[_0x08a6('0x33')],_0x56d9ff[_0x08a6('0x34')]);_0x1196b1[_0x08a6('0x39')]=_[_0x08a6('0x36')](_0x56d9ff[_0x08a6('0x33')],qs['fields'](_0x1a71ca[_0x08a6('0x34')][_0x08a6('0x37')]));_0x1196b1['attributes']=_0x1196b1[_0x08a6('0x39')][_0x08a6('0x38')]?_0x1196b1[_0x08a6('0x39')]:_0x56d9ff['model'];if(_0x1a71ca['query'][_0x08a6('0x43')]){_0x1196b1[_0x08a6('0x44')]=[{'all':!![]}];}_0x1196b1=_[_0x08a6('0x40')]({},_0x1196b1,_0x1a71ca[_0x08a6('0x42')]);return db[_0x08a6('0x45')][_0x08a6('0x4a')](_0x1196b1)['then'](handleEntityNotFound(_0x4efc04,null))[_0x08a6('0x27')](respondWithResult(_0x4efc04,null))[_0x08a6('0x48')](handleError(_0x4efc04,null));};exports['create']=function(_0x260baf,_0x232218){return db[_0x08a6('0x45')][_0x08a6('0x4b')](_0x260baf[_0x08a6('0x4c')],{})['then'](respondWithResult(_0x232218,0xc9))[_0x08a6('0x48')](handleError(_0x232218,null));};exports[_0x08a6('0x4d')]=function(_0x47dd50,_0x320730){if(_0x47dd50[_0x08a6('0x4c')]['id']){delete _0x47dd50[_0x08a6('0x4c')]['id'];}return db[_0x08a6('0x45')][_0x08a6('0x4a')]({'where':{'id':_0x47dd50[_0x08a6('0x4e')]['id']}})[_0x08a6('0x27')](handleEntityNotFound(_0x320730,null))[_0x08a6('0x27')](saveUpdates(_0x47dd50[_0x08a6('0x4c')],null))[_0x08a6('0x27')](respondWithResult(_0x320730,null))[_0x08a6('0x48')](handleError(_0x320730,null));};exports[_0x08a6('0x28')]=function(_0x300fad,_0x24703b){return db['SugarcrmField'][_0x08a6('0x4a')]({'where':{'id':_0x300fad['params']['id']}})[_0x08a6('0x27')](handleEntityNotFound(_0x24703b,null))[_0x08a6('0x27')](removeEntity(_0x24703b,null))[_0x08a6('0x48')](handleError(_0x24703b,null));}; \ No newline at end of file +var _0xef82=['destroy','stack','name','send','index','SugarcrmField','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','show','params','options','find','catch','create','body','update','eml-format','rimraf','zip-dir','bluebird','mustache','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/license/util','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','then'];(function(_0x5f5dbb,_0x38812a){var _0x18057f=function(_0x79afb6){while(--_0x79afb6){_0x5f5dbb['push'](_0x5f5dbb['shift']());}};_0x18057f(++_0x38812a);}(_0xef82,0x14c));var _0x2ef8=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xef82[_0x243b59];return _0x3e1676;};'use strict';var emlformat=require(_0x2ef8('0x0'));var rimraf=require(_0x2ef8('0x1'));var zipdir=require(_0x2ef8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2ef8('0x3'));var Mustache=require(_0x2ef8('0x4'));var util=require(_0x2ef8('0x5'));var path=require(_0x2ef8('0x6'));var sox=require(_0x2ef8('0x7'));var csv=require(_0x2ef8('0x8'));var ejs=require(_0x2ef8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2ef8('0xa'));var squel=require(_0x2ef8('0xb'));var crypto=require(_0x2ef8('0xc'));var jsforce=require(_0x2ef8('0xd'));var deskjs=require(_0x2ef8('0xe'));var toCsv=require(_0x2ef8('0x8'));var querystring=require(_0x2ef8('0xf'));var Papa=require(_0x2ef8('0x10'));var Redis=require(_0x2ef8('0x11'));var authService=require(_0x2ef8('0x12'));var qs=require(_0x2ef8('0x13'));var as=require(_0x2ef8('0x14'));var hardwareService=require(_0x2ef8('0x15'));var logger=require(_0x2ef8('0x16'))(_0x2ef8('0x17'));var utils=require(_0x2ef8('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2ef8('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x308834,_0x140b6b){_0x140b6b=_0x140b6b||0xcc;return function(_0x5899a9){if(_0x5899a9){return _0x308834[_0x2ef8('0x1a')](_0x140b6b);}return _0x308834[_0x2ef8('0x1b')](_0x140b6b)[_0x2ef8('0x1c')]();};}function respondWithResult(_0x1cd844,_0x1d2782){_0x1d2782=_0x1d2782||0xc8;return function(_0x2d4dc8){if(_0x2d4dc8){return _0x1cd844[_0x2ef8('0x1b')](_0x1d2782)[_0x2ef8('0x1d')](_0x2d4dc8);}};}function respondWithFilteredResult(_0x306dda,_0x192131){return function(_0x1bf7bf){if(_0x1bf7bf){var _0x12fd9f=typeof _0x192131[_0x2ef8('0x1e')]===_0x2ef8('0x1f')&&typeof _0x192131['limit']===_0x2ef8('0x1f');var _0x99905=_0x1bf7bf[_0x2ef8('0x20')];var _0x3c1b9d=_0x12fd9f?0x0:_0x192131[_0x2ef8('0x1e')];var _0x3e28ab=_0x12fd9f?_0x1bf7bf['count']:_0x192131[_0x2ef8('0x1e')]+_0x192131['limit'];var _0x168d86;if(_0x3e28ab>=_0x99905){_0x3e28ab=_0x99905;_0x168d86=0xc8;}else{_0x168d86=0xce;}_0x306dda[_0x2ef8('0x1b')](_0x168d86);return _0x306dda['set'](_0x2ef8('0x21'),_0x3c1b9d+'-'+_0x3e28ab+'/'+_0x99905)[_0x2ef8('0x1d')](_0x1bf7bf);}return null;};}function patchUpdates(_0x346a54){return function(_0x2f8a5c){try{jsonpatch[_0x2ef8('0x22')](_0x2f8a5c,_0x346a54,!![]);}catch(_0x534801){return BPromise[_0x2ef8('0x23')](_0x534801);}return _0x2f8a5c[_0x2ef8('0x24')]();};}function saveUpdates(_0x1b3c35,_0x13a7cb){return function(_0x5c14d7){if(_0x5c14d7){return _0x5c14d7['update'](_0x1b3c35)[_0x2ef8('0x25')](function(_0x2bafcc){return _0x2bafcc;});}return null;};}function removeEntity(_0x14f119,_0x1872f1){return function(_0x35b9f7){if(_0x35b9f7){return _0x35b9f7[_0x2ef8('0x26')]()[_0x2ef8('0x25')](function(){_0x14f119[_0x2ef8('0x1b')](0xcc)[_0x2ef8('0x1c')]();});}};}function handleEntityNotFound(_0x20249f,_0x15bed4){return function(_0x19c480){if(!_0x19c480){_0x20249f[_0x2ef8('0x1a')](0x194);}return _0x19c480;};}function handleError(_0x8351f5,_0xbaf5c8){_0xbaf5c8=_0xbaf5c8||0x1f4;return function(_0x3287a9){logger['error'](_0x3287a9[_0x2ef8('0x27')]);if(_0x3287a9[_0x2ef8('0x28')]){delete _0x3287a9['name'];}_0x8351f5['status'](_0xbaf5c8)[_0x2ef8('0x29')](_0x3287a9);};}exports[_0x2ef8('0x2a')]=function(_0x4473dd,_0x244e71){var _0x48ae4d={},_0x10e130={},_0x3a97fa={'count':0x0,'rows':[]};var _0x548504=_['map'](db[_0x2ef8('0x2b')]['rawAttributes'],function(_0x4774a1){return{'name':_0x4774a1[_0x2ef8('0x2c')],'type':_0x4774a1[_0x2ef8('0x2d')][_0x2ef8('0x2e')]};});_0x10e130[_0x2ef8('0x2f')]=_['map'](_0x548504,_0x2ef8('0x28'));_0x10e130[_0x2ef8('0x30')]=_[_0x2ef8('0x31')](_0x4473dd[_0x2ef8('0x30')]);_0x10e130[_0x2ef8('0x32')]=_[_0x2ef8('0x33')](_0x10e130[_0x2ef8('0x2f')],_0x10e130['query']);_0x48ae4d[_0x2ef8('0x34')]=_[_0x2ef8('0x33')](_0x10e130[_0x2ef8('0x2f')],qs[_0x2ef8('0x35')](_0x4473dd[_0x2ef8('0x30')][_0x2ef8('0x35')]));_0x48ae4d['attributes']=_0x48ae4d[_0x2ef8('0x34')][_0x2ef8('0x36')]?_0x48ae4d[_0x2ef8('0x34')]:_0x10e130['model'];if(!_0x4473dd[_0x2ef8('0x30')]['hasOwnProperty'](_0x2ef8('0x37'))){_0x48ae4d['limit']=qs[_0x2ef8('0x38')](_0x4473dd[_0x2ef8('0x30')][_0x2ef8('0x38')]);_0x48ae4d[_0x2ef8('0x1e')]=qs['offset'](_0x4473dd[_0x2ef8('0x30')][_0x2ef8('0x1e')]);}_0x48ae4d['order']=qs['sort'](_0x4473dd[_0x2ef8('0x30')][_0x2ef8('0x39')]);_0x48ae4d[_0x2ef8('0x3a')]=qs[_0x2ef8('0x32')](_[_0x2ef8('0x3b')](_0x4473dd['query'],_0x10e130[_0x2ef8('0x32')]),_0x548504);if(_0x4473dd['query']['filter']){_0x48ae4d[_0x2ef8('0x3a')]=_[_0x2ef8('0x3c')](_0x48ae4d[_0x2ef8('0x3a')],{'$or':_['map'](_0x548504,function(_0x3428cb){if(_0x3428cb[_0x2ef8('0x2d')]!==_0x2ef8('0x3d')){var _0x507357={};_0x507357[_0x3428cb[_0x2ef8('0x28')]]={'$like':'%'+_0x4473dd[_0x2ef8('0x30')][_0x2ef8('0x3e')]+'%'};return _0x507357;}})});}_0x48ae4d=_['merge']({},_0x48ae4d,_0x4473dd['options']);var _0x4b56ee={'where':_0x48ae4d[_0x2ef8('0x3a')]};return db[_0x2ef8('0x2b')][_0x2ef8('0x20')](_0x4b56ee)[_0x2ef8('0x25')](function(_0x1cf0f1){_0x3a97fa[_0x2ef8('0x20')]=_0x1cf0f1;if(_0x4473dd[_0x2ef8('0x30')][_0x2ef8('0x3f')]){_0x48ae4d['include']=[{'all':!![]}];}return db[_0x2ef8('0x2b')][_0x2ef8('0x40')](_0x48ae4d);})['then'](function(_0x5dd111){_0x3a97fa[_0x2ef8('0x41')]=_0x5dd111;return _0x3a97fa;})[_0x2ef8('0x25')](respondWithFilteredResult(_0x244e71,_0x48ae4d))['catch'](handleError(_0x244e71,null));};exports[_0x2ef8('0x42')]=function(_0x9ba331,_0x3e258c){var _0x4a20ac={'raw':!![],'where':{'id':_0x9ba331[_0x2ef8('0x43')]['id']}},_0x4375e0={};_0x4375e0[_0x2ef8('0x2f')]=_[_0x2ef8('0x31')](db[_0x2ef8('0x2b')]['rawAttributes']);_0x4375e0['query']=_[_0x2ef8('0x31')](_0x9ba331[_0x2ef8('0x30')]);_0x4375e0[_0x2ef8('0x32')]=_[_0x2ef8('0x33')](_0x4375e0[_0x2ef8('0x2f')],_0x4375e0[_0x2ef8('0x30')]);_0x4a20ac[_0x2ef8('0x34')]=_['intersection'](_0x4375e0[_0x2ef8('0x2f')],qs[_0x2ef8('0x35')](_0x9ba331[_0x2ef8('0x30')][_0x2ef8('0x35')]));_0x4a20ac[_0x2ef8('0x34')]=_0x4a20ac[_0x2ef8('0x34')]['length']?_0x4a20ac[_0x2ef8('0x34')]:_0x4375e0['model'];if(_0x9ba331[_0x2ef8('0x30')][_0x2ef8('0x3f')]){_0x4a20ac['include']=[{'all':!![]}];}_0x4a20ac=_[_0x2ef8('0x3c')]({},_0x4a20ac,_0x9ba331[_0x2ef8('0x44')]);return db[_0x2ef8('0x2b')][_0x2ef8('0x45')](_0x4a20ac)[_0x2ef8('0x25')](handleEntityNotFound(_0x3e258c,null))[_0x2ef8('0x25')](respondWithResult(_0x3e258c,null))[_0x2ef8('0x46')](handleError(_0x3e258c,null));};exports[_0x2ef8('0x47')]=function(_0x1117aa,_0x3ad0fe){return db[_0x2ef8('0x2b')][_0x2ef8('0x47')](_0x1117aa[_0x2ef8('0x48')],{})[_0x2ef8('0x25')](respondWithResult(_0x3ad0fe,0xc9))[_0x2ef8('0x46')](handleError(_0x3ad0fe,null));};exports[_0x2ef8('0x49')]=function(_0x5844a0,_0x17efba){if(_0x5844a0[_0x2ef8('0x48')]['id']){delete _0x5844a0['body']['id'];}return db[_0x2ef8('0x2b')]['find']({'where':{'id':_0x5844a0['params']['id']}})[_0x2ef8('0x25')](handleEntityNotFound(_0x17efba,null))[_0x2ef8('0x25')](saveUpdates(_0x5844a0[_0x2ef8('0x48')],null))['then'](respondWithResult(_0x17efba,null))[_0x2ef8('0x46')](handleError(_0x17efba,null));};exports[_0x2ef8('0x26')]=function(_0x3b855d,_0x4755df){return db[_0x2ef8('0x2b')]['find']({'where':{'id':_0x3b855d[_0x2ef8('0x43')]['id']}})['then'](handleEntityNotFound(_0x4755df,null))[_0x2ef8('0x25')](removeEntity(_0x4755df,null))[_0x2ef8('0x46')](handleError(_0x4755df,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 7ecdc64..2948a9c 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 _0x2c91=['bluebird','request-promise','path','rimraf','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','lodash','util','../../config/logger'];(function(_0x4e8bed,_0x4267b8){var _0x4bf357=function(_0x221c49){while(--_0x221c49){_0x4e8bed['push'](_0x4e8bed['shift']());}};_0x4bf357(++_0x4267b8);}(_0x2c91,0xc9));var _0x12c9=function(_0xb366e2,_0x26a0d6){_0xb366e2=_0xb366e2-0x0;var _0x36486e=_0x2c91[_0xb366e2];return _0x36486e;};'use strict';var _=require(_0x12c9('0x0'));var util=require(_0x12c9('0x1'));var logger=require(_0x12c9('0x2'))('api');var moment=require('moment');var BPromise=require(_0x12c9('0x3'));var rp=require(_0x12c9('0x4'));var fs=require('fs');var path=require(_0x12c9('0x5'));var rimraf=require(_0x12c9('0x6'));var config=require('../../config/environment');var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x92bbc7,_0x3e2315){return _0x92bbc7[_0x12c9('0x7')](_0x12c9('0x8'),attributes,{'tableName':_0x12c9('0x9'),'paranoid':![],'indexes':[{'name':_0x12c9('0xa'),'fields':['idField',_0x12c9('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0623=['request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','lodash','../../config/logger','api','moment','bluebird'];(function(_0xa388a2,_0x40bde6){var _0x7ce7f6=function(_0x5a242a){while(--_0x5a242a){_0xa388a2['push'](_0xa388a2['shift']());}};_0x7ce7f6(++_0x40bde6);}(_0x0623,0x145));var _0x3062=function(_0x2b98fe,_0x2939f8){_0x2b98fe=_0x2b98fe-0x0;var _0x1ccf8d=_0x0623[_0x2b98fe];return _0x1ccf8d;};'use strict';var _=require(_0x3062('0x0'));var util=require('util');var logger=require(_0x3062('0x1'))(_0x3062('0x2'));var moment=require(_0x3062('0x3'));var BPromise=require(_0x3062('0x4'));var rp=require(_0x3062('0x5'));var fs=require('fs');var path=require(_0x3062('0x6'));var rimraf=require(_0x3062('0x7'));var config=require(_0x3062('0x8'));var attributes=require(_0x3062('0x9'));module[_0x3062('0xa')]=function(_0x373d00,_0x5733ca){return _0x373d00[_0x3062('0xb')](_0x3062('0xc'),attributes,{'tableName':_0x3062('0xd'),'paranoid':![],'indexes':[{'name':_0x3062('0xe'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 15b6b1b..fc3c57b 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 _0xc80a=['stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../config/environment','http','request','request\x20sent','debug'];(function(_0x45043c,_0x1b378b){var _0x35d455=function(_0x435b87){while(--_0x435b87){_0x45043c['push'](_0x45043c['shift']());}};_0x35d455(++_0x1b378b);}(_0xc80a,0xe5));var _0xac80=function(_0x9b24a5,_0x47c37a){_0x9b24a5=_0x9b24a5-0x0;var _0x3f4434=_0xc80a[_0x9b24a5];return _0x3f4434;};'use strict';var _=require(_0xac80('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xac80('0x1'));var rs=require(_0xac80('0x2'));var fs=require('fs');var Redis=require(_0xac80('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xac80('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0xac80('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x365106,_0x2586bf,_0x3188f7){return new BPromise(function(_0x111a64,_0x2b7ec5){return client[_0xac80('0x6')](_0x365106,_0x3188f7)['then'](function(_0x2be5b3){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x2586bf,_0xac80('0x7'));logger[_0xac80('0x8')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x2586bf,_0xac80('0x7'),JSON[_0xac80('0x9')](_0x2be5b3));if(_0x2be5b3[_0xac80('0xa')]){if(_0x2be5b3['error'][_0xac80('0xb')]===0x1f4){logger[_0xac80('0xa')](_0xac80('0xc'),_0x2586bf,_0x2be5b3[_0xac80('0xa')][_0xac80('0xd')]);return _0x2b7ec5(_0x2be5b3['error'][_0xac80('0xd')]);}logger[_0xac80('0xa')](_0xac80('0xc'),_0x2586bf,_0x2be5b3[_0xac80('0xa')][_0xac80('0xd')]);return _0x111a64(_0x2be5b3[_0xac80('0xa')][_0xac80('0xd')]);}else{logger[_0xac80('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x2586bf,_0xac80('0x7'));_0x111a64(_0x2be5b3[_0xac80('0xf')][_0xac80('0xd')]);}})[_0xac80('0x10')](function(_0x19b822){logger[_0xac80('0xa')](_0xac80('0xc'),_0x2586bf,_0x19b822);_0x2b7ec5(_0x19b822);});});} \ No newline at end of file +var _0xe2d6=['SugarcrmField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x4109e7,_0x2c8158){var _0x28d807=function(_0x386518){while(--_0x386518){_0x4109e7['push'](_0x4109e7['shift']());}};_0x28d807(++_0x2c8158);}(_0xe2d6,0x194));var _0x6e2d=function(_0x172ed7,_0x3d08fd){_0x172ed7=_0x172ed7-0x0;var _0xfa8f61=_0xe2d6[_0x172ed7];return _0xfa8f61;};'use strict';var _=require(_0x6e2d('0x0'));var util=require(_0x6e2d('0x1'));var moment=require(_0x6e2d('0x2'));var BPromise=require(_0x6e2d('0x3'));var rs=require(_0x6e2d('0x4'));var fs=require('fs');var Redis=require(_0x6e2d('0x5'));var db=require(_0x6e2d('0x6'))['db'];var utils=require(_0x6e2d('0x7'));var logger=require(_0x6e2d('0x8'))(_0x6e2d('0x9'));var config=require('../../config/environment');var jayson=require(_0x6e2d('0xa'));var client=jayson[_0x6e2d('0xb')][_0x6e2d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1e471e,_0x47736a,_0x24bf05){return new BPromise(function(_0x5644ca,_0x36ffb7){return client[_0x6e2d('0xd')](_0x1e471e,_0x24bf05)[_0x6e2d('0xe')](function(_0x1d56e5){logger[_0x6e2d('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x47736a,'request\x20sent');logger[_0x6e2d('0x10')](_0x6e2d('0x11'),_0x47736a,_0x6e2d('0x12'),JSON['stringify'](_0x1d56e5));if(_0x1d56e5[_0x6e2d('0x13')]){if(_0x1d56e5[_0x6e2d('0x13')][_0x6e2d('0x14')]===0x1f4){logger[_0x6e2d('0x13')](_0x6e2d('0x15'),_0x47736a,_0x1d56e5[_0x6e2d('0x13')][_0x6e2d('0x16')]);return _0x36ffb7(_0x1d56e5[_0x6e2d('0x13')][_0x6e2d('0x16')]);}logger['error'](_0x6e2d('0x15'),_0x47736a,_0x1d56e5['error']['message']);return _0x5644ca(_0x1d56e5[_0x6e2d('0x13')][_0x6e2d('0x16')]);}else{logger[_0x6e2d('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x47736a,_0x6e2d('0x12'));_0x5644ca(_0x1d56e5[_0x6e2d('0x17')][_0x6e2d('0x16')]);}})[_0x6e2d('0x18')](function(_0x4defa6){logger[_0x6e2d('0x13')](_0x6e2d('0x15'),_0x47736a,_0x4defa6);_0x36ffb7(_0x4defa6);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 8c94934..23df94c 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 _0x0fc2=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','post','create','addConfiguration','put','delete','exports','multer','util','path','connect-timeout','Router'];(function(_0x4ee864,_0x501c05){var _0x98627a=function(_0x1d27e2){while(--_0x1d27e2){_0x4ee864['push'](_0x4ee864['shift']());}};_0x98627a(++_0x501c05);}(_0x0fc2,0x6e));var _0x20fc=function(_0x2dd8e9,_0xd45b23){_0x2dd8e9=_0x2dd8e9-0x0;var _0x3b8ccd=_0x0fc2[_0x2dd8e9];return _0x3b8ccd;};'use strict';var multer=require(_0x20fc('0x0'));var util=require(_0x20fc('0x1'));var path=require(_0x20fc('0x2'));var timeout=require(_0x20fc('0x3'));var express=require('express');var router=express[_0x20fc('0x4')]();var fs_extra=require(_0x20fc('0x5'));var auth=require(_0x20fc('0x6'));var interaction=require(_0x20fc('0x7'));var config=require(_0x20fc('0x8'));var controller=require(_0x20fc('0x9'));router[_0x20fc('0xa')]('/',auth[_0x20fc('0xb')](),controller[_0x20fc('0xc')]);router[_0x20fc('0xa')](_0x20fc('0xd'),auth[_0x20fc('0xb')](),controller[_0x20fc('0xe')]);router[_0x20fc('0xa')](_0x20fc('0xf'),auth[_0x20fc('0xb')](),controller['getConfigurations']);router[_0x20fc('0xa')](_0x20fc('0x10'),auth[_0x20fc('0xb')](),controller['getFields']);router[_0x20fc('0x11')]('/',auth[_0x20fc('0xb')](),controller[_0x20fc('0x12')]);router[_0x20fc('0x11')](_0x20fc('0xf'),auth[_0x20fc('0xb')](),controller[_0x20fc('0x13')]);router[_0x20fc('0x14')]('/:id',auth[_0x20fc('0xb')](),controller['update']);router[_0x20fc('0x15')]('/:id',auth[_0x20fc('0xb')](),controller['destroy']);module[_0x20fc('0x16')]=router; \ No newline at end of file +var _0xed8a=['getConfigurations','getFields','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show'];(function(_0x1942b6,_0x18ed56){var _0x5deaad=function(_0x6da8d4){while(--_0x6da8d4){_0x1942b6['push'](_0x1942b6['shift']());}};_0x5deaad(++_0x18ed56);}(_0xed8a,0xc5));var _0xaed8=function(_0xb5cba5,_0x5c939f){_0xb5cba5=_0xb5cba5-0x0;var _0x511e77=_0xed8a[_0xb5cba5];return _0x511e77;};'use strict';var multer=require(_0xaed8('0x0'));var util=require(_0xaed8('0x1'));var path=require(_0xaed8('0x2'));var timeout=require(_0xaed8('0x3'));var express=require('express');var router=express[_0xaed8('0x4')]();var fs_extra=require(_0xaed8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xaed8('0x6'));var config=require(_0xaed8('0x7'));var controller=require('./intVtigerAccount.controller');router['get']('/',auth[_0xaed8('0x8')](),controller[_0xaed8('0x9')]);router[_0xaed8('0xa')](_0xaed8('0xb'),auth[_0xaed8('0x8')](),controller[_0xaed8('0xc')]);router[_0xaed8('0xa')]('/:id/configurations',auth[_0xaed8('0x8')](),controller[_0xaed8('0xd')]);router[_0xaed8('0xa')]('/:id/fields',auth[_0xaed8('0x8')](),controller[_0xaed8('0xe')]);router[_0xaed8('0xf')]('/',auth[_0xaed8('0x8')](),controller[_0xaed8('0x10')]);router['post']('/:id/configurations',auth[_0xaed8('0x8')](),controller['addConfiguration']);router[_0xaed8('0x11')](_0xaed8('0xb'),auth[_0xaed8('0x8')](),controller[_0xaed8('0x12')]);router['delete'](_0xaed8('0xb'),auth[_0xaed8('0x8')](),controller[_0xaed8('0x13')]);module[_0xaed8('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index c091250..faa309c 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 _0xc844=['sequelize','exports','STRING','HelpDesk'];(function(_0x2e2738,_0x5def7b){var _0x460f5d=function(_0x390555){while(--_0x390555){_0x2e2738['push'](_0x2e2738['shift']());}};_0x460f5d(++_0x5def7b);}(_0xc844,0x104));var _0x4c84=function(_0x35d2b9,_0x7ef769){_0x35d2b9=_0x35d2b9-0x0;var _0x210456=_0xc844[_0x35d2b9];return _0x210456;};'use strict';var Sequelize=require(_0x4c84('0x0'));module[_0x4c84('0x1')]={'name':{'type':Sequelize[_0x4c84('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x4c84('0x2')]},'username':{'type':Sequelize[_0x4c84('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x4c84('0x2')],'allowNull':![],'defaultValue':_0x4c84('0x3')},'remoteUri':{'type':Sequelize[_0x4c84('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x4c84('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x4c84('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x593a=['HelpDesk','sequelize','STRING'];(function(_0x43a6cd,_0x503d1a){var _0x5acb36=function(_0x2dd95e){while(--_0x2dd95e){_0x43a6cd['push'](_0x43a6cd['shift']());}};_0x5acb36(++_0x503d1a);}(_0x593a,0xee));var _0xa593=function(_0x3c66dc,_0x3c288a){_0x3c66dc=_0x3c66dc-0x0;var _0x3d7664=_0x593a[_0x3c66dc];return _0x3d7664;};'use strict';var Sequelize=require(_0xa593('0x0'));module['exports']={'name':{'type':Sequelize[_0xa593('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa593('0x1')]},'username':{'type':Sequelize[_0xa593('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa593('0x2')},'remoteUri':{'type':Sequelize[_0xa593('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xa593('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xa593('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 0fdd08f..afd8839 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 _0xdc51=['destroy','status','sendStatus','error','stack','index','map','VtigerAccount','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','name','options','include','rows','params','rawAttributes','length','includeAll','find','catch','create','body','getConfigurations','findOne','VtigerConfiguration','order','hasOwnProperty','addConfiguration','AccountId','Subjects','getDescriptions','channel','VtigerField','Descriptions','md5','username','description','remoteUri','accessKey','moduleName','slice','substring','lastIndexOf','%s/webservice.php','GET','getchallenge','success','POST','login','token','describe','sessionName','autogenerated','reference','owner','remove','result','editable','false','label','startsWith','cf_','picklistValues','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then'];(function(_0x50964f,_0x54fd30){var _0x4fa524=function(_0x314b20){while(--_0x314b20){_0x50964f['push'](_0x50964f['shift']());}};_0x4fa524(++_0x54fd30);}(_0xdc51,0xd1));var _0x1dc5=function(_0x2f8b0f,_0x2654eb){_0x2f8b0f=_0x2f8b0f-0x0;var _0x384196=_0xdc51[_0x2f8b0f];return _0x384196;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1dc5('0x0'));var zipdir=require(_0x1dc5('0x1'));var jsonpatch=require(_0x1dc5('0x2'));var rp=require(_0x1dc5('0x3'));var moment=require(_0x1dc5('0x4'));var BPromise=require(_0x1dc5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1dc5('0x6'));var sox=require(_0x1dc5('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1dc5('0x8'));var squel=require(_0x1dc5('0x9'));var crypto=require(_0x1dc5('0xa'));var jsforce=require(_0x1dc5('0xb'));var deskjs=require(_0x1dc5('0xc'));var toCsv=require(_0x1dc5('0xd'));var querystring=require('querystring');var Papa=require(_0x1dc5('0xe'));var Redis=require(_0x1dc5('0xf'));var authService=require(_0x1dc5('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1dc5('0x11'))(_0x1dc5('0x12'));var utils=require(_0x1dc5('0x13'));var config=require(_0x1dc5('0x14'));var licenseUtil=require(_0x1dc5('0x15'));var db=require(_0x1dc5('0x16'))['db'];var integrations=require(_0x1dc5('0x17'));function respondWithStatusCode(_0x1a5846,_0x5a0e08){_0x5a0e08=_0x5a0e08||0xcc;return function(_0x3b446c){if(_0x3b446c){return _0x1a5846['sendStatus'](_0x5a0e08);}return _0x1a5846['status'](_0x5a0e08)[_0x1dc5('0x18')]();};}function respondWithResult(_0x4059b9,_0x4fb88e){_0x4fb88e=_0x4fb88e||0xc8;return function(_0x5732cc){if(_0x5732cc){return _0x4059b9['status'](_0x4fb88e)[_0x1dc5('0x19')](_0x5732cc);}};}function respondWithFilteredResult(_0x41b55d,_0x4ac9e8){return function(_0x5db013){if(_0x5db013){var _0x30817e=typeof _0x4ac9e8['offset']===_0x1dc5('0x1a')&&typeof _0x4ac9e8[_0x1dc5('0x1b')]==='undefined';var _0x5b1f8c=_0x5db013[_0x1dc5('0x1c')];var _0x1b691c=_0x30817e?0x0:_0x4ac9e8[_0x1dc5('0x1d')];var _0x1123ff=_0x30817e?_0x5db013[_0x1dc5('0x1c')]:_0x4ac9e8['offset']+_0x4ac9e8[_0x1dc5('0x1b')];var _0x6e22a4;if(_0x1123ff>=_0x5b1f8c){_0x1123ff=_0x5b1f8c;_0x6e22a4=0xc8;}else{_0x6e22a4=0xce;}_0x41b55d['status'](_0x6e22a4);return _0x41b55d[_0x1dc5('0x1e')](_0x1dc5('0x1f'),_0x1b691c+'-'+_0x1123ff+'/'+_0x5b1f8c)[_0x1dc5('0x19')](_0x5db013);}return null;};}function patchUpdates(_0x57cfee){return function(_0x2116e6){try{jsonpatch[_0x1dc5('0x20')](_0x2116e6,_0x57cfee,!![]);}catch(_0x1a49e1){return BPromise[_0x1dc5('0x21')](_0x1a49e1);}return _0x2116e6[_0x1dc5('0x22')]();};}function saveUpdates(_0x1ab9d8,_0x581a21){return function(_0x146769){if(_0x146769){return _0x146769[_0x1dc5('0x23')](_0x1ab9d8)[_0x1dc5('0x24')](function(_0x2affed){return _0x2affed;});}return null;};}function removeEntity(_0x3bced5,_0x3edc4c){return function(_0x4bc585){if(_0x4bc585){return _0x4bc585[_0x1dc5('0x25')]()['then'](function(){_0x3bced5[_0x1dc5('0x26')](0xcc)[_0x1dc5('0x18')]();});}};}function handleEntityNotFound(_0x3f43c1,_0x43fed2){return function(_0x3e33e6){if(!_0x3e33e6){_0x3f43c1[_0x1dc5('0x27')](0x194);}return _0x3e33e6;};}function handleError(_0x8b8ba8,_0x24fe3a){_0x24fe3a=_0x24fe3a||0x1f4;return function(_0x11b23b){logger[_0x1dc5('0x28')](_0x11b23b[_0x1dc5('0x29')]);if(_0x11b23b['name']){delete _0x11b23b['name'];}_0x8b8ba8[_0x1dc5('0x26')](_0x24fe3a)['send'](_0x11b23b);};}exports[_0x1dc5('0x2a')]=function(_0x5837a6,_0x1c0e86){var _0x579473={},_0x9ebc11={},_0x11a0a1={'count':0x0,'rows':[]};var _0x348a99=_[_0x1dc5('0x2b')](db[_0x1dc5('0x2c')]['rawAttributes'],function(_0x5cc43a){return{'name':_0x5cc43a[_0x1dc5('0x2d')],'type':_0x5cc43a[_0x1dc5('0x2e')][_0x1dc5('0x2f')]};});_0x9ebc11[_0x1dc5('0x30')]=_[_0x1dc5('0x2b')](_0x348a99,'name');_0x9ebc11['query']=_[_0x1dc5('0x31')](_0x5837a6[_0x1dc5('0x32')]);_0x9ebc11[_0x1dc5('0x33')]=_[_0x1dc5('0x34')](_0x9ebc11[_0x1dc5('0x30')],_0x9ebc11[_0x1dc5('0x32')]);_0x579473[_0x1dc5('0x35')]=_[_0x1dc5('0x34')](_0x9ebc11[_0x1dc5('0x30')],qs['fields'](_0x5837a6[_0x1dc5('0x32')][_0x1dc5('0x36')]));_0x579473['attributes']=_0x579473[_0x1dc5('0x35')]['length']?_0x579473[_0x1dc5('0x35')]:_0x9ebc11['model'];if(!_0x5837a6[_0x1dc5('0x32')]['hasOwnProperty'](_0x1dc5('0x37'))){_0x579473[_0x1dc5('0x1b')]=qs[_0x1dc5('0x1b')](_0x5837a6['query']['limit']);_0x579473[_0x1dc5('0x1d')]=qs[_0x1dc5('0x1d')](_0x5837a6[_0x1dc5('0x32')][_0x1dc5('0x1d')]);}_0x579473['order']=qs[_0x1dc5('0x38')](_0x5837a6[_0x1dc5('0x32')][_0x1dc5('0x38')]);_0x579473[_0x1dc5('0x39')]=qs[_0x1dc5('0x33')](_[_0x1dc5('0x3a')](_0x5837a6['query'],_0x9ebc11[_0x1dc5('0x33')]),_0x348a99);if(_0x5837a6[_0x1dc5('0x32')][_0x1dc5('0x3b')]){_0x579473['where']=_[_0x1dc5('0x3c')](_0x579473[_0x1dc5('0x39')],{'$or':_[_0x1dc5('0x2b')](_0x348a99,function(_0x2d9343){if(_0x2d9343[_0x1dc5('0x2e')]!==_0x1dc5('0x3d')){var _0x4a4f3c={};_0x4a4f3c[_0x2d9343[_0x1dc5('0x3e')]]={'$like':'%'+_0x5837a6['query']['filter']+'%'};return _0x4a4f3c;}})});}_0x579473=_[_0x1dc5('0x3c')]({},_0x579473,_0x5837a6[_0x1dc5('0x3f')]);var _0x1b6e04={'where':_0x579473[_0x1dc5('0x39')]};return db[_0x1dc5('0x2c')][_0x1dc5('0x1c')](_0x1b6e04)['then'](function(_0x4e44cd){_0x11a0a1[_0x1dc5('0x1c')]=_0x4e44cd;if(_0x5837a6['query']['includeAll']){_0x579473[_0x1dc5('0x40')]=[{'all':!![]}];}return db['VtigerAccount']['findAll'](_0x579473);})[_0x1dc5('0x24')](function(_0x49a7f5){_0x11a0a1[_0x1dc5('0x41')]=_0x49a7f5;return _0x11a0a1;})[_0x1dc5('0x24')](respondWithFilteredResult(_0x1c0e86,_0x579473))['catch'](handleError(_0x1c0e86,null));};exports['show']=function(_0xba185d,_0x554bd2){var _0x230c0e={'raw':![],'where':{'id':_0xba185d[_0x1dc5('0x42')]['id']}},_0x1a9223={};_0x1a9223[_0x1dc5('0x30')]=_['keys'](db[_0x1dc5('0x2c')][_0x1dc5('0x43')]);_0x1a9223['query']=_[_0x1dc5('0x31')](_0xba185d[_0x1dc5('0x32')]);_0x1a9223['filters']=_[_0x1dc5('0x34')](_0x1a9223['model'],_0x1a9223[_0x1dc5('0x32')]);_0x230c0e[_0x1dc5('0x35')]=_['intersection'](_0x1a9223[_0x1dc5('0x30')],qs[_0x1dc5('0x36')](_0xba185d[_0x1dc5('0x32')][_0x1dc5('0x36')]));_0x230c0e[_0x1dc5('0x35')]=_0x230c0e[_0x1dc5('0x35')][_0x1dc5('0x44')]?_0x230c0e[_0x1dc5('0x35')]:_0x1a9223[_0x1dc5('0x30')];if(_0xba185d[_0x1dc5('0x32')][_0x1dc5('0x45')]){_0x230c0e[_0x1dc5('0x40')]=[{'all':!![]}];}_0x230c0e=_[_0x1dc5('0x3c')]({},_0x230c0e,_0xba185d[_0x1dc5('0x3f')]);return db[_0x1dc5('0x2c')][_0x1dc5('0x46')](_0x230c0e)[_0x1dc5('0x24')](handleEntityNotFound(_0x554bd2,null))[_0x1dc5('0x24')](respondWithResult(_0x554bd2,null))[_0x1dc5('0x47')](handleError(_0x554bd2,null));};exports[_0x1dc5('0x48')]=function(_0x329f2d,_0x26665b){return db['VtigerAccount']['create'](_0x329f2d[_0x1dc5('0x49')],{})[_0x1dc5('0x24')](respondWithResult(_0x26665b,0xc9))[_0x1dc5('0x47')](handleError(_0x26665b,null));};exports['update']=function(_0xec128b,_0x1926d8){if(_0xec128b[_0x1dc5('0x49')]['id']){delete _0xec128b[_0x1dc5('0x49')]['id'];}return db['VtigerAccount']['find']({'where':{'id':_0xec128b[_0x1dc5('0x42')]['id']}})[_0x1dc5('0x24')](handleEntityNotFound(_0x1926d8,null))['then'](saveUpdates(_0xec128b[_0x1dc5('0x49')],null))['then'](respondWithResult(_0x1926d8,null))['catch'](handleError(_0x1926d8,null));};exports[_0x1dc5('0x25')]=function(_0x1caa53,_0x3e35fe){return db[_0x1dc5('0x2c')][_0x1dc5('0x46')]({'where':{'id':_0x1caa53['params']['id']}})[_0x1dc5('0x24')](handleEntityNotFound(_0x3e35fe,null))[_0x1dc5('0x24')](removeEntity(_0x3e35fe,null))[_0x1dc5('0x47')](handleError(_0x3e35fe,null));};exports[_0x1dc5('0x4a')]=function(_0x40eb3f,_0xb2032d,_0x2b29f8){var _0x1c7292={};var _0x1460b9={};var _0x5cca14;var _0x17c79b;return db['VtigerAccount'][_0x1dc5('0x4b')]({'where':{'id':_0x40eb3f[_0x1dc5('0x42')]['id']}})[_0x1dc5('0x24')](handleEntityNotFound(_0xb2032d,null))[_0x1dc5('0x24')](function(_0x26c2a8){if(_0x26c2a8){_0x5cca14=_0x26c2a8;_0x1460b9['model']=_['keys'](db[_0x1dc5('0x4c')][_0x1dc5('0x43')]);_0x1460b9[_0x1dc5('0x32')]=_[_0x1dc5('0x31')](_0x40eb3f[_0x1dc5('0x32')]);_0x1460b9['filters']=_[_0x1dc5('0x34')](_0x1460b9[_0x1dc5('0x30')],_0x1460b9[_0x1dc5('0x32')]);_0x1c7292[_0x1dc5('0x35')]=_[_0x1dc5('0x34')](_0x1460b9[_0x1dc5('0x30')],qs['fields'](_0x40eb3f[_0x1dc5('0x32')][_0x1dc5('0x36')]));_0x1c7292['attributes']=_0x1c7292['attributes'][_0x1dc5('0x44')]?_0x1c7292[_0x1dc5('0x35')]:_0x1460b9['model'];_0x1c7292[_0x1dc5('0x4d')]=qs[_0x1dc5('0x38')](_0x40eb3f['query'][_0x1dc5('0x38')]);_0x1c7292[_0x1dc5('0x39')]=qs[_0x1dc5('0x33')](_[_0x1dc5('0x3a')](_0x40eb3f[_0x1dc5('0x32')],_0x1460b9[_0x1dc5('0x33')]));if(_0x40eb3f['query'][_0x1dc5('0x3b')]){_0x1c7292['where']=_[_0x1dc5('0x3c')](_0x1c7292[_0x1dc5('0x39')],{'$or':_['map'](_0x1c7292[_0x1dc5('0x35')],function(_0x1193be){var _0x5ad3c7={};_0x5ad3c7[_0x1193be]={'$like':'%'+_0x40eb3f['query']['filter']+'%'};return _0x5ad3c7;})});}_0x1c7292=_[_0x1dc5('0x3c')]({},_0x1c7292,_0x40eb3f[_0x1dc5('0x3f')]);return _0x5cca14[_0x1dc5('0x4a')](_0x1c7292);}})['then'](function(_0x5a0e41){if(_0x5a0e41){_0x17c79b=_0x5a0e41[_0x1dc5('0x44')];if(!_0x40eb3f[_0x1dc5('0x32')][_0x1dc5('0x4e')](_0x1dc5('0x37'))){_0x1c7292[_0x1dc5('0x1b')]=qs[_0x1dc5('0x1b')](_0x40eb3f['query'][_0x1dc5('0x1b')]);_0x1c7292['offset']=qs[_0x1dc5('0x1d')](_0x40eb3f['query']['offset']);}return _0x5cca14['getConfigurations'](_0x1c7292);}})['then'](function(_0xea4e32){if(_0xea4e32){return _0xea4e32?{'count':_0x17c79b,'rows':_0xea4e32}:null;}})[_0x1dc5('0x24')](respondWithResult(_0xb2032d,null))[_0x1dc5('0x47')](handleError(_0xb2032d,null));};exports[_0x1dc5('0x4f')]=function(_0x2dbaff,_0x507ed3,_0x1e8922){if(_0x2dbaff[_0x1dc5('0x49')]['id']){delete _0x2dbaff[_0x1dc5('0x49')]['id'];}return db[_0x1dc5('0x2c')][_0x1dc5('0x4b')]({'where':{'id':_0x2dbaff[_0x1dc5('0x42')]['id']}})['then'](handleEntityNotFound(_0x507ed3,null))['then'](function(_0x2b5758){if(_0x2b5758){_0x2dbaff['body'][_0x1dc5('0x50')]=_0x2b5758['id'];_0x2dbaff[_0x1dc5('0x49')][_0x1dc5('0x51')]=integrations['getSubjects'](_0x2dbaff[_0x1dc5('0x49')]['channel'],_0x2dbaff[_0x1dc5('0x49')][_0x1dc5('0x2e')]);_0x2dbaff[_0x1dc5('0x49')]['Descriptions']=integrations[_0x1dc5('0x52')](_0x2dbaff[_0x1dc5('0x49')][_0x1dc5('0x53')],_0x2dbaff[_0x1dc5('0x49')]['type']);return db[_0x1dc5('0x4c')][_0x1dc5('0x48')](_0x2dbaff['body'],{'include':[{'model':db['VtigerField'],'as':_0x1dc5('0x51')},{'model':db[_0x1dc5('0x54')],'as':_0x1dc5('0x55')}]});}return null;})[_0x1dc5('0x24')](respondWithResult(_0x507ed3,null))['catch'](handleError(_0x507ed3,null));};var md5=require(_0x1dc5('0x56'));exports['getFields']=function(_0x136e83,_0x46734b,_0x204ea2){var _0x41bdb2=null;var _0x1577c5=null;var _0x27aafd=null;var _0x20c6bd=null;var _0x38d222='';return db[_0x1dc5('0x2c')][_0x1dc5('0x4b')]({'where':{'id':_0x136e83[_0x1dc5('0x42')]['id']},'attributes':['id',_0x1dc5('0x3e'),_0x1dc5('0x57'),_0x1dc5('0x58'),'moduleName',_0x1dc5('0x59'),'serverUrl','accessKey']})['then'](handleEntityNotFound(_0x46734b,null))['then'](function(_0x789b4e){if(_0x789b4e){_0x41bdb2=_0x789b4e[_0x1dc5('0x57')];_0x1577c5=_0x789b4e[_0x1dc5('0x5a')];_0x27aafd=_0x789b4e[_0x1dc5('0x5b')];_0x38d222=_0x789b4e[_0x1dc5('0x59')];var _0x1acaa0=_0x38d222[_0x1dc5('0x5c')](-0x1);if(_0x1acaa0==='/'){_0x38d222=_0x38d222[_0x1dc5('0x5d')](0x0,_0x38d222[_0x1dc5('0x5e')](_0x1acaa0));}_0x20c6bd=util['format'](_0x1dc5('0x5f'),_0x38d222);var _0x958003={'method':_0x1dc5('0x60'),'uri':_0x20c6bd,'qs':{'operation':_0x1dc5('0x61'),'username':_0x789b4e[_0x1dc5('0x57')]},'json':!![]};return rp(_0x958003);}})[_0x1dc5('0x24')](function(_0x4510b5){if(_0x4510b5[_0x1dc5('0x62')]){var _0x70a761={'method':_0x1dc5('0x63'),'uri':_0x20c6bd,'form':{'operation':_0x1dc5('0x64'),'username':_0x41bdb2,'accessKey':md5(_0x4510b5['result'][_0x1dc5('0x65')]+_0x1577c5)},'json':!![]};return rp(_0x70a761);}})[_0x1dc5('0x24')](function(_0x475cb9){if(_0x475cb9[_0x1dc5('0x62')]){var _0x1112b7={'method':_0x1dc5('0x60'),'uri':_0x20c6bd,'qs':{'operation':_0x1dc5('0x66'),'username':_0x41bdb2,'sessionName':_0x475cb9['result'][_0x1dc5('0x67')],'elementType':_0x27aafd},'json':!![]};return rp(_0x1112b7);}})[_0x1dc5('0x24')](function(_0xbaf2d3){if(_0xbaf2d3[_0x1dc5('0x62')]){var _0xc2a376=[_0x1dc5('0x68'),_0x1dc5('0x69'),_0x1dc5('0x6a')];_[_0x1dc5('0x6b')](_0xbaf2d3[_0x1dc5('0x6c')][_0x1dc5('0x36')],function(_0x2d2522){return _0xc2a376['includes'](_0x2d2522[_0x1dc5('0x2e')][_0x1dc5('0x3e')]);});_[_0x1dc5('0x6b')](_0xbaf2d3[_0x1dc5('0x6c')][_0x1dc5('0x36')],function(_0x40cf41){return _0x40cf41[_0x1dc5('0x6d')]===_0x1dc5('0x6e');});return{'count':_0xbaf2d3['result'][_0x1dc5('0x36')][_0x1dc5('0x44')],'rows':_[_0x1dc5('0x2b')](_0xbaf2d3[_0x1dc5('0x6c')][_0x1dc5('0x36')],function(_0xcf5c29){return{'id':_0xcf5c29['name'],'name':_0xcf5c29[_0x1dc5('0x6f')],'custom':_[_0x1dc5('0x70')](_0xcf5c29[_0x1dc5('0x3e')],_0x1dc5('0x71'))?!![]:![],'options':_0xcf5c29['type']['name']==='picklist'&&_0xcf5c29['type'][_0x1dc5('0x72')][_0x1dc5('0x44')]>0x0?_[_0x1dc5('0x2b')](_0xcf5c29['type'][_0x1dc5('0x72')],function(_0x1e4834){return{'name':_0x1e4834[_0x1dc5('0x6f')],'value':_0x1e4834['value']};}):[]};})};}})[_0x1dc5('0x24')](respondWithResult(_0x46734b,null))[_0x1dc5('0x47')](function(_0x89302e){console[_0x1dc5('0x73')](_0x1dc5('0x74')+_0x89302e);var _0x3be04c=_0x136e83[_0x1dc5('0x32')][_0x1dc5('0x75')]?0x1f4:_0x89302e['statusCode']||0x1f4;logger[_0x1dc5('0x28')](_0x1dc5('0x76'),_0x1dc5('0x77'),_0x3be04c,JSON[_0x1dc5('0x78')](_0x89302e));delete _0x89302e[_0x1dc5('0x3e')];if(_0x3be04c===0x191){_0x3be04c=0x190;}_0x46734b[_0x1dc5('0x26')](_0x3be04c)['send'](_0x136e83[_0x1dc5('0x32')]['test']?{'message':_0x1dc5('0x79'),'statusCode':_0x89302e[_0x1dc5('0x7a')]}:_0x89302e);});}; \ No newline at end of file +var _0xcf96=['accessKey','username','slice','substring','lastIndexOf','format','GET','success','token','describe','result','sessionName','autogenerated','owner','remove','false','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','includeAll','VtigerAccount','catch','params','keys','options','find','create','body','getConfigurations','findOne','VtigerConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','description','moduleName','remoteUri'];(function(_0x57ad0c,_0x18d49a){var _0x3dea49=function(_0x2b2041){while(--_0x2b2041){_0x57ad0c['push'](_0x57ad0c['shift']());}};_0x3dea49(++_0x18d49a);}(_0xcf96,0x16d));var _0x6cf9=function(_0x4b6dc0,_0x27f881){_0x4b6dc0=_0x4b6dc0-0x0;var _0x4be496=_0xcf96[_0x4b6dc0];return _0x4be496;};'use strict';var emlformat=require(_0x6cf9('0x0'));var rimraf=require(_0x6cf9('0x1'));var zipdir=require(_0x6cf9('0x2'));var jsonpatch=require(_0x6cf9('0x3'));var rp=require(_0x6cf9('0x4'));var moment=require('moment');var BPromise=require(_0x6cf9('0x5'));var Mustache=require(_0x6cf9('0x6'));var util=require(_0x6cf9('0x7'));var path=require(_0x6cf9('0x8'));var sox=require(_0x6cf9('0x9'));var csv=require(_0x6cf9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6cf9('0xb'));var _=require(_0x6cf9('0xc'));var squel=require(_0x6cf9('0xd'));var crypto=require(_0x6cf9('0xe'));var jsforce=require(_0x6cf9('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6cf9('0xa'));var querystring=require(_0x6cf9('0x10'));var Papa=require(_0x6cf9('0x11'));var Redis=require(_0x6cf9('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6cf9('0x13'));var logger=require(_0x6cf9('0x14'))(_0x6cf9('0x15'));var utils=require(_0x6cf9('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6cf9('0x17'));var db=require(_0x6cf9('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x216d70,_0x1f31a4){_0x1f31a4=_0x1f31a4||0xcc;return function(_0x200b91){if(_0x200b91){return _0x216d70[_0x6cf9('0x19')](_0x1f31a4);}return _0x216d70['status'](_0x1f31a4)['end']();};}function respondWithResult(_0x1c2505,_0x526a75){_0x526a75=_0x526a75||0xc8;return function(_0x1fd0d0){if(_0x1fd0d0){return _0x1c2505[_0x6cf9('0x1a')](_0x526a75)[_0x6cf9('0x1b')](_0x1fd0d0);}};}function respondWithFilteredResult(_0x41737a,_0x446371){return function(_0x414b7d){if(_0x414b7d){var _0x58e09f=typeof _0x446371['offset']===_0x6cf9('0x1c')&&typeof _0x446371['limit']===_0x6cf9('0x1c');var _0x482ea8=_0x414b7d[_0x6cf9('0x1d')];var _0x473ce7=_0x58e09f?0x0:_0x446371[_0x6cf9('0x1e')];var _0x24f4bd=_0x58e09f?_0x414b7d['count']:_0x446371[_0x6cf9('0x1e')]+_0x446371[_0x6cf9('0x1f')];var _0x320b73;if(_0x24f4bd>=_0x482ea8){_0x24f4bd=_0x482ea8;_0x320b73=0xc8;}else{_0x320b73=0xce;}_0x41737a[_0x6cf9('0x1a')](_0x320b73);return _0x41737a[_0x6cf9('0x20')](_0x6cf9('0x21'),_0x473ce7+'-'+_0x24f4bd+'/'+_0x482ea8)[_0x6cf9('0x1b')](_0x414b7d);}return null;};}function patchUpdates(_0x13a53b){return function(_0x14d05a){try{jsonpatch[_0x6cf9('0x22')](_0x14d05a,_0x13a53b,!![]);}catch(_0x330281){return BPromise[_0x6cf9('0x23')](_0x330281);}return _0x14d05a[_0x6cf9('0x24')]();};}function saveUpdates(_0x35e447,_0x587ad2){return function(_0x14c0f9){if(_0x14c0f9){return _0x14c0f9[_0x6cf9('0x25')](_0x35e447)['then'](function(_0x1946dd){return _0x1946dd;});}return null;};}function removeEntity(_0x38982c,_0x318352){return function(_0x5dd044){if(_0x5dd044){return _0x5dd044[_0x6cf9('0x26')]()[_0x6cf9('0x27')](function(){_0x38982c[_0x6cf9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x197b19,_0x12f215){return function(_0x36bbac){if(!_0x36bbac){_0x197b19['sendStatus'](0x194);}return _0x36bbac;};}function handleError(_0x31d91a,_0x496f35){_0x496f35=_0x496f35||0x1f4;return function(_0x77e6e8){logger['error'](_0x77e6e8[_0x6cf9('0x28')]);if(_0x77e6e8['name']){delete _0x77e6e8[_0x6cf9('0x29')];}_0x31d91a[_0x6cf9('0x1a')](_0x496f35)[_0x6cf9('0x2a')](_0x77e6e8);};}exports['index']=function(_0x267148,_0xcb4e7e){var _0x23b476={},_0x24417e={},_0x5d1947={'count':0x0,'rows':[]};var _0x276500=_[_0x6cf9('0x2b')](db['VtigerAccount'][_0x6cf9('0x2c')],function(_0x55e438){return{'name':_0x55e438[_0x6cf9('0x2d')],'type':_0x55e438['type'][_0x6cf9('0x2e')]};});_0x24417e[_0x6cf9('0x2f')]=_[_0x6cf9('0x2b')](_0x276500,_0x6cf9('0x29'));_0x24417e[_0x6cf9('0x30')]=_['keys'](_0x267148['query']);_0x24417e[_0x6cf9('0x31')]=_[_0x6cf9('0x32')](_0x24417e['model'],_0x24417e['query']);_0x23b476[_0x6cf9('0x33')]=_[_0x6cf9('0x32')](_0x24417e[_0x6cf9('0x2f')],qs[_0x6cf9('0x34')](_0x267148[_0x6cf9('0x30')]['fields']));_0x23b476['attributes']=_0x23b476['attributes'][_0x6cf9('0x35')]?_0x23b476['attributes']:_0x24417e[_0x6cf9('0x2f')];if(!_0x267148[_0x6cf9('0x30')]['hasOwnProperty'](_0x6cf9('0x36'))){_0x23b476[_0x6cf9('0x1f')]=qs[_0x6cf9('0x1f')](_0x267148[_0x6cf9('0x30')][_0x6cf9('0x1f')]);_0x23b476[_0x6cf9('0x1e')]=qs[_0x6cf9('0x1e')](_0x267148[_0x6cf9('0x30')][_0x6cf9('0x1e')]);}_0x23b476[_0x6cf9('0x37')]=qs['sort'](_0x267148[_0x6cf9('0x30')][_0x6cf9('0x38')]);_0x23b476[_0x6cf9('0x39')]=qs[_0x6cf9('0x31')](_['pick'](_0x267148['query'],_0x24417e[_0x6cf9('0x31')]),_0x276500);if(_0x267148[_0x6cf9('0x30')][_0x6cf9('0x3a')]){_0x23b476[_0x6cf9('0x39')]=_[_0x6cf9('0x3b')](_0x23b476[_0x6cf9('0x39')],{'$or':_[_0x6cf9('0x2b')](_0x276500,function(_0xfed863){if(_0xfed863[_0x6cf9('0x3c')]!=='VIRTUAL'){var _0xe2d0fc={};_0xe2d0fc[_0xfed863[_0x6cf9('0x29')]]={'$like':'%'+_0x267148[_0x6cf9('0x30')][_0x6cf9('0x3a')]+'%'};return _0xe2d0fc;}})});}_0x23b476=_[_0x6cf9('0x3b')]({},_0x23b476,_0x267148['options']);var _0x510297={'where':_0x23b476[_0x6cf9('0x39')]};return db['VtigerAccount'][_0x6cf9('0x1d')](_0x510297)[_0x6cf9('0x27')](function(_0x1c86ee){_0x5d1947['count']=_0x1c86ee;if(_0x267148[_0x6cf9('0x30')][_0x6cf9('0x3d')]){_0x23b476['include']=[{'all':!![]}];}return db[_0x6cf9('0x3e')]['findAll'](_0x23b476);})[_0x6cf9('0x27')](function(_0x3f7378){_0x5d1947['rows']=_0x3f7378;return _0x5d1947;})['then'](respondWithFilteredResult(_0xcb4e7e,_0x23b476))[_0x6cf9('0x3f')](handleError(_0xcb4e7e,null));};exports['show']=function(_0x28d473,_0x19e5fa){var _0xe7e019={'raw':![],'where':{'id':_0x28d473[_0x6cf9('0x40')]['id']}},_0x29fafa={};_0x29fafa[_0x6cf9('0x2f')]=_[_0x6cf9('0x41')](db[_0x6cf9('0x3e')][_0x6cf9('0x2c')]);_0x29fafa[_0x6cf9('0x30')]=_[_0x6cf9('0x41')](_0x28d473['query']);_0x29fafa[_0x6cf9('0x31')]=_[_0x6cf9('0x32')](_0x29fafa[_0x6cf9('0x2f')],_0x29fafa[_0x6cf9('0x30')]);_0xe7e019['attributes']=_['intersection'](_0x29fafa[_0x6cf9('0x2f')],qs[_0x6cf9('0x34')](_0x28d473['query'][_0x6cf9('0x34')]));_0xe7e019[_0x6cf9('0x33')]=_0xe7e019[_0x6cf9('0x33')][_0x6cf9('0x35')]?_0xe7e019[_0x6cf9('0x33')]:_0x29fafa['model'];if(_0x28d473[_0x6cf9('0x30')][_0x6cf9('0x3d')]){_0xe7e019['include']=[{'all':!![]}];}_0xe7e019=_[_0x6cf9('0x3b')]({},_0xe7e019,_0x28d473[_0x6cf9('0x42')]);return db['VtigerAccount'][_0x6cf9('0x43')](_0xe7e019)['then'](handleEntityNotFound(_0x19e5fa,null))[_0x6cf9('0x27')](respondWithResult(_0x19e5fa,null))[_0x6cf9('0x3f')](handleError(_0x19e5fa,null));};exports['create']=function(_0x819c44,_0x41b3b9){return db[_0x6cf9('0x3e')][_0x6cf9('0x44')](_0x819c44[_0x6cf9('0x45')],{})['then'](respondWithResult(_0x41b3b9,0xc9))[_0x6cf9('0x3f')](handleError(_0x41b3b9,null));};exports[_0x6cf9('0x25')]=function(_0x38d13d,_0x9a7e91){if(_0x38d13d['body']['id']){delete _0x38d13d['body']['id'];}return db[_0x6cf9('0x3e')][_0x6cf9('0x43')]({'where':{'id':_0x38d13d[_0x6cf9('0x40')]['id']}})[_0x6cf9('0x27')](handleEntityNotFound(_0x9a7e91,null))[_0x6cf9('0x27')](saveUpdates(_0x38d13d[_0x6cf9('0x45')],null))[_0x6cf9('0x27')](respondWithResult(_0x9a7e91,null))[_0x6cf9('0x3f')](handleError(_0x9a7e91,null));};exports['destroy']=function(_0x22b2d9,_0x518940){return db[_0x6cf9('0x3e')][_0x6cf9('0x43')]({'where':{'id':_0x22b2d9[_0x6cf9('0x40')]['id']}})['then'](handleEntityNotFound(_0x518940,null))[_0x6cf9('0x27')](removeEntity(_0x518940,null))[_0x6cf9('0x3f')](handleError(_0x518940,null));};exports[_0x6cf9('0x46')]=function(_0x807706,_0x21bc2a,_0x121b87){var _0x2d6ba3={};var _0x5282ab={};var _0x3641d5;var _0x4a7d7d;return db[_0x6cf9('0x3e')][_0x6cf9('0x47')]({'where':{'id':_0x807706[_0x6cf9('0x40')]['id']}})[_0x6cf9('0x27')](handleEntityNotFound(_0x21bc2a,null))['then'](function(_0x5cf35e){if(_0x5cf35e){_0x3641d5=_0x5cf35e;_0x5282ab[_0x6cf9('0x2f')]=_[_0x6cf9('0x41')](db[_0x6cf9('0x48')]['rawAttributes']);_0x5282ab['query']=_[_0x6cf9('0x41')](_0x807706[_0x6cf9('0x30')]);_0x5282ab[_0x6cf9('0x31')]=_[_0x6cf9('0x32')](_0x5282ab[_0x6cf9('0x2f')],_0x5282ab['query']);_0x2d6ba3['attributes']=_[_0x6cf9('0x32')](_0x5282ab['model'],qs[_0x6cf9('0x34')](_0x807706[_0x6cf9('0x30')][_0x6cf9('0x34')]));_0x2d6ba3[_0x6cf9('0x33')]=_0x2d6ba3['attributes'][_0x6cf9('0x35')]?_0x2d6ba3['attributes']:_0x5282ab[_0x6cf9('0x2f')];_0x2d6ba3[_0x6cf9('0x37')]=qs[_0x6cf9('0x38')](_0x807706[_0x6cf9('0x30')][_0x6cf9('0x38')]);_0x2d6ba3[_0x6cf9('0x39')]=qs[_0x6cf9('0x31')](_['pick'](_0x807706[_0x6cf9('0x30')],_0x5282ab['filters']));if(_0x807706[_0x6cf9('0x30')][_0x6cf9('0x3a')]){_0x2d6ba3[_0x6cf9('0x39')]=_[_0x6cf9('0x3b')](_0x2d6ba3[_0x6cf9('0x39')],{'$or':_[_0x6cf9('0x2b')](_0x2d6ba3[_0x6cf9('0x33')],function(_0x14a219){var _0x223f60={};_0x223f60[_0x14a219]={'$like':'%'+_0x807706[_0x6cf9('0x30')]['filter']+'%'};return _0x223f60;})});}_0x2d6ba3=_[_0x6cf9('0x3b')]({},_0x2d6ba3,_0x807706[_0x6cf9('0x42')]);return _0x3641d5[_0x6cf9('0x46')](_0x2d6ba3);}})[_0x6cf9('0x27')](function(_0x17185e){if(_0x17185e){_0x4a7d7d=_0x17185e[_0x6cf9('0x35')];if(!_0x807706[_0x6cf9('0x30')][_0x6cf9('0x49')](_0x6cf9('0x36'))){_0x2d6ba3[_0x6cf9('0x1f')]=qs[_0x6cf9('0x1f')](_0x807706[_0x6cf9('0x30')][_0x6cf9('0x1f')]);_0x2d6ba3[_0x6cf9('0x1e')]=qs[_0x6cf9('0x1e')](_0x807706[_0x6cf9('0x30')][_0x6cf9('0x1e')]);}return _0x3641d5[_0x6cf9('0x46')](_0x2d6ba3);}})[_0x6cf9('0x27')](function(_0x232b0d){if(_0x232b0d){return _0x232b0d?{'count':_0x4a7d7d,'rows':_0x232b0d}:null;}})['then'](respondWithResult(_0x21bc2a,null))[_0x6cf9('0x3f')](handleError(_0x21bc2a,null));};exports[_0x6cf9('0x4a')]=function(_0x34caa6,_0x5f5de4,_0x4bcafb){if(_0x34caa6['body']['id']){delete _0x34caa6[_0x6cf9('0x45')]['id'];}return db[_0x6cf9('0x3e')][_0x6cf9('0x47')]({'where':{'id':_0x34caa6[_0x6cf9('0x40')]['id']}})['then'](handleEntityNotFound(_0x5f5de4,null))[_0x6cf9('0x27')](function(_0x58b363){if(_0x58b363){_0x34caa6['body'][_0x6cf9('0x4b')]=_0x58b363['id'];_0x34caa6[_0x6cf9('0x45')][_0x6cf9('0x4c')]=integrations[_0x6cf9('0x4d')](_0x34caa6[_0x6cf9('0x45')][_0x6cf9('0x4e')],_0x34caa6[_0x6cf9('0x45')][_0x6cf9('0x3c')]);_0x34caa6[_0x6cf9('0x45')][_0x6cf9('0x4f')]=integrations[_0x6cf9('0x50')](_0x34caa6[_0x6cf9('0x45')][_0x6cf9('0x4e')],_0x34caa6[_0x6cf9('0x45')][_0x6cf9('0x3c')]);return db['VtigerConfiguration'][_0x6cf9('0x44')](_0x34caa6[_0x6cf9('0x45')],{'include':[{'model':db[_0x6cf9('0x51')],'as':_0x6cf9('0x4c')},{'model':db[_0x6cf9('0x51')],'as':_0x6cf9('0x4f')}]});}return null;})[_0x6cf9('0x27')](respondWithResult(_0x5f5de4,null))[_0x6cf9('0x3f')](handleError(_0x5f5de4,null));};var md5=require(_0x6cf9('0x52'));exports[_0x6cf9('0x53')]=function(_0x196e44,_0x59f79d,_0x2fc9d9){var _0x2435b0=null;var _0x4d9df7=null;var _0x431ead=null;var _0x27fd71=null;var _0x490204='';return db['VtigerAccount'][_0x6cf9('0x47')]({'where':{'id':_0x196e44[_0x6cf9('0x40')]['id']},'attributes':['id','name','username',_0x6cf9('0x54'),_0x6cf9('0x55'),_0x6cf9('0x56'),'serverUrl',_0x6cf9('0x57')]})['then'](handleEntityNotFound(_0x59f79d,null))[_0x6cf9('0x27')](function(_0x31d49b){if(_0x31d49b){_0x2435b0=_0x31d49b[_0x6cf9('0x58')];_0x4d9df7=_0x31d49b['accessKey'];_0x431ead=_0x31d49b[_0x6cf9('0x55')];_0x490204=_0x31d49b[_0x6cf9('0x56')];var _0x3331c2=_0x490204[_0x6cf9('0x59')](-0x1);if(_0x3331c2==='/'){_0x490204=_0x490204[_0x6cf9('0x5a')](0x0,_0x490204[_0x6cf9('0x5b')](_0x3331c2));}_0x27fd71=util[_0x6cf9('0x5c')]('%s/webservice.php',_0x490204);var _0x457b01={'method':_0x6cf9('0x5d'),'uri':_0x27fd71,'qs':{'operation':'getchallenge','username':_0x31d49b[_0x6cf9('0x58')]},'json':!![]};return rp(_0x457b01);}})[_0x6cf9('0x27')](function(_0x1fb6d7){if(_0x1fb6d7[_0x6cf9('0x5e')]){var _0x465280={'method':'POST','uri':_0x27fd71,'form':{'operation':'login','username':_0x2435b0,'accessKey':md5(_0x1fb6d7['result'][_0x6cf9('0x5f')]+_0x4d9df7)},'json':!![]};return rp(_0x465280);}})[_0x6cf9('0x27')](function(_0x206bcb){if(_0x206bcb[_0x6cf9('0x5e')]){var _0x4735ab={'method':_0x6cf9('0x5d'),'uri':_0x27fd71,'qs':{'operation':_0x6cf9('0x60'),'username':_0x2435b0,'sessionName':_0x206bcb[_0x6cf9('0x61')][_0x6cf9('0x62')],'elementType':_0x431ead},'json':!![]};return rp(_0x4735ab);}})[_0x6cf9('0x27')](function(_0x282c33){if(_0x282c33[_0x6cf9('0x5e')]){var _0x1cf95c=[_0x6cf9('0x63'),'reference',_0x6cf9('0x64')];_[_0x6cf9('0x65')](_0x282c33[_0x6cf9('0x61')][_0x6cf9('0x34')],function(_0x27c4b7){return _0x1cf95c['includes'](_0x27c4b7[_0x6cf9('0x3c')][_0x6cf9('0x29')]);});_[_0x6cf9('0x65')](_0x282c33[_0x6cf9('0x61')]['fields'],function(_0x42924a){return _0x42924a['editable']===_0x6cf9('0x66');});return{'count':_0x282c33[_0x6cf9('0x61')][_0x6cf9('0x34')][_0x6cf9('0x35')],'rows':_['map'](_0x282c33[_0x6cf9('0x61')]['fields'],function(_0x375ca8){return{'id':_0x375ca8[_0x6cf9('0x29')],'name':_0x375ca8[_0x6cf9('0x67')],'custom':_[_0x6cf9('0x68')](_0x375ca8[_0x6cf9('0x29')],_0x6cf9('0x69'))?!![]:![],'options':_0x375ca8[_0x6cf9('0x3c')]['name']===_0x6cf9('0x6a')&&_0x375ca8['type'][_0x6cf9('0x6b')]['length']>0x0?_[_0x6cf9('0x2b')](_0x375ca8['type'][_0x6cf9('0x6b')],function(_0x58d279){return{'name':_0x58d279[_0x6cf9('0x67')],'value':_0x58d279['value']};}):[]};})};}})['then'](respondWithResult(_0x59f79d,null))[_0x6cf9('0x3f')](function(_0x57ee45){console[_0x6cf9('0x6c')](_0x6cf9('0x6d')+_0x57ee45);var _0x50431c=_0x196e44[_0x6cf9('0x30')][_0x6cf9('0x6e')]?0x1f4:_0x57ee45[_0x6cf9('0x6f')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x6cf9('0x53'),_0x50431c,JSON['stringify'](_0x57ee45));delete _0x57ee45['name'];if(_0x50431c===0x191){_0x50431c=0x190;}_0x59f79d[_0x6cf9('0x1a')](_0x50431c)['send'](_0x196e44[_0x6cf9('0x30')][_0x6cf9('0x6e')]?{'message':_0x6cf9('0x70'),'statusCode':_0x57ee45[_0x6cf9('0x6f')]}:_0x57ee45);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 3b599d6..5b46ee3 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 _0xb6c5=['../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x19c7bf,_0x130f9d){var _0x4c5970=function(_0x4fc7cf){while(--_0x4fc7cf){_0x19c7bf['push'](_0x19c7bf['shift']());}};_0x4c5970(++_0x130f9d);}(_0xb6c5,0x173));var _0x5b6c=function(_0x58bbfd,_0x2554cf){_0x58bbfd=_0x58bbfd-0x0;var _0x31c79c=_0xb6c5[_0x58bbfd];return _0x31c79c;};'use strict';var _=require(_0x5b6c('0x0'));var util=require(_0x5b6c('0x1'));var logger=require(_0x5b6c('0x2'))(_0x5b6c('0x3'));var moment=require('moment');var BPromise=require(_0x5b6c('0x4'));var rp=require(_0x5b6c('0x5'));var fs=require('fs');var path=require(_0x5b6c('0x6'));var rimraf=require('rimraf');var config=require(_0x5b6c('0x7'));var attributes=require(_0x5b6c('0x8'));var integrations=require(_0x5b6c('0x9'));module[_0x5b6c('0xa')]=function(_0x8c1594,_0x5550ed){return _0x8c1594[_0x5b6c('0xb')](_0x5b6c('0xc'),attributes,{'tableName':_0x5b6c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b5a=['../../components/integrations/configuration','exports','VtigerAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intVtigerAccount.attributes'];(function(_0x155890,_0x21813e){var _0x3f156d=function(_0x3edc20){while(--_0x3edc20){_0x155890['push'](_0x155890['shift']());}};_0x3f156d(++_0x21813e);}(_0x2b5a,0x93));var _0xa2b5=function(_0x397892,_0x24d491){_0x397892=_0x397892-0x0;var _0x2a5183=_0x2b5a[_0x397892];return _0x2a5183;};'use strict';var _=require(_0xa2b5('0x0'));var util=require(_0xa2b5('0x1'));var logger=require(_0xa2b5('0x2'))(_0xa2b5('0x3'));var moment=require(_0xa2b5('0x4'));var BPromise=require(_0xa2b5('0x5'));var rp=require(_0xa2b5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa2b5('0x7'));var config=require('../../config/environment');var attributes=require(_0xa2b5('0x8'));var integrations=require(_0xa2b5('0x9'));module[_0xa2b5('0xa')]=function(_0x44292a,_0x1c5606){return _0x44292a['define'](_0xa2b5('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 517a01f..b9c2a85 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 _0x39cb=['request','then','info','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','attributes','limit','map','include','model','debug','ShowVtigerAccount','raw','where','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x5353a6,_0x385344){var _0x2e62e1=function(_0x23ce72){while(--_0x23ce72){_0x5353a6['push'](_0x5353a6['shift']());}};_0x2e62e1(++_0x385344);}(_0x39cb,0x1bd));var _0xb39c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x39cb[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xb39c('0x0'));var moment=require(_0xb39c('0x1'));var BPromise=require('bluebird');var rs=require(_0xb39c('0x2'));var fs=require('fs');var Redis=require(_0xb39c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb39c('0x4'));var logger=require(_0xb39c('0x5'))(_0xb39c('0x6'));var config=require(_0xb39c('0x7'));var jayson=require(_0xb39c('0x8'));var client=jayson['client'][_0xb39c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fc868,_0x40112f,_0x3f2fbe){return new BPromise(function(_0x47d6d7,_0x5ae14a){return client[_0xb39c('0xa')](_0x2fc868,_0x3f2fbe)[_0xb39c('0xb')](function(_0x3ffb94){logger[_0xb39c('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x40112f,'request\x20sent');logger['debug'](_0xb39c('0xd'),_0x40112f,_0xb39c('0xe'),JSON[_0xb39c('0xf')](_0x3ffb94));if(_0x3ffb94[_0xb39c('0x10')]){if(_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x11')]===0x1f4){logger[_0xb39c('0x10')](_0xb39c('0x12'),_0x40112f,_0x3ffb94['error'][_0xb39c('0x13')]);return _0x5ae14a(_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x13')]);}logger['error'](_0xb39c('0x12'),_0x40112f,_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x13')]);return _0x47d6d7(_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x13')]);}else{logger[_0xb39c('0xc')](_0xb39c('0x12'),_0x40112f,'request\x20sent');_0x47d6d7(_0x3ffb94[_0xb39c('0x14')][_0xb39c('0x13')]);}})[_0xb39c('0x15')](function(_0x1c2c5f){logger[_0xb39c('0x10')](_0xb39c('0x12'),_0x40112f,_0x1c2c5f);_0x5ae14a(_0x1c2c5f);});});}exports[_0xb39c('0x16')]=function(_0x4e02cf){var _0x35dade=this;return new Promise(function(_0x2eeae6,_0x559ad6){return db[_0xb39c('0x17')][_0xb39c('0x18')]({'raw':_0x4e02cf[_0xb39c('0x19')]?_0x4e02cf[_0xb39c('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4e02cf[_0xb39c('0x19')]?_0x4e02cf[_0xb39c('0x19')]['where']||null:null,'attributes':_0x4e02cf[_0xb39c('0x19')]?_0x4e02cf[_0xb39c('0x19')][_0xb39c('0x1a')]||null:null,'limit':_0x4e02cf['options']?_0x4e02cf['options'][_0xb39c('0x1b')]||null:null,'include':_0x4e02cf[_0xb39c('0x19')]?_0x4e02cf[_0xb39c('0x19')]['include']?_[_0xb39c('0x1c')](_0x4e02cf[_0xb39c('0x19')][_0xb39c('0x1d')],function(_0x16f3b0){return{'model':db[_0x16f3b0[_0xb39c('0x1e')]],'as':_0x16f3b0['as'],'attributes':_0x16f3b0['attributes'],'include':_0x16f3b0[_0xb39c('0x1d')]?_[_0xb39c('0x1c')](_0x16f3b0['include'],function(_0x1fd145){return{'model':db[_0x1fd145[_0xb39c('0x1e')]],'as':_0x1fd145['as'],'attributes':_0x1fd145[_0xb39c('0x1a')],'include':_0x1fd145[_0xb39c('0x1d')]?_[_0xb39c('0x1c')](_0x1fd145['include'],function(_0x23a2f1){return{'model':db[_0x23a2f1[_0xb39c('0x1e')]],'as':_0x23a2f1['as'],'attributes':_0x23a2f1[_0xb39c('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41fff2){logger[_0xb39c('0xc')]('GetVtigerAccount',_0x4e02cf);logger[_0xb39c('0x1f')](_0xb39c('0x16'),_0x4e02cf,JSON[_0xb39c('0xf')](_0x41fff2));_0x2eeae6(_0x41fff2);})['catch'](function(_0x714d20){logger[_0xb39c('0x10')]('GetVtigerAccount',_0x714d20[_0xb39c('0x13')],_0x4e02cf);_0x559ad6(_0x35dade['error'](0x1f4,_0x714d20[_0xb39c('0x13')]));});});};exports[_0xb39c('0x20')]=function(_0x309697){var _0x7339b4=this;return new Promise(function(_0x17eb7b,_0x52e642){return db[_0xb39c('0x17')]['find']({'raw':_0x309697[_0xb39c('0x19')]?_0x309697['options'][_0xb39c('0x21')]===undefined?!![]:![]:!![],'where':_0x309697[_0xb39c('0x19')]?_0x309697[_0xb39c('0x19')][_0xb39c('0x22')]||null:null,'attributes':_0x309697['options']?_0x309697['options'][_0xb39c('0x1a')]||null:null,'include':_0x309697[_0xb39c('0x19')]?_0x309697['options'][_0xb39c('0x1d')]?_[_0xb39c('0x1c')](_0x309697[_0xb39c('0x19')][_0xb39c('0x1d')],function(_0x14a92f){return{'model':db[_0x14a92f[_0xb39c('0x1e')]],'as':_0x14a92f['as'],'attributes':_0x14a92f[_0xb39c('0x1a')],'include':_0x14a92f[_0xb39c('0x1d')]?_[_0xb39c('0x1c')](_0x14a92f[_0xb39c('0x1d')],function(_0x15882d){return{'model':db[_0x15882d[_0xb39c('0x1e')]],'as':_0x15882d['as'],'attributes':_0x15882d[_0xb39c('0x1a')],'include':_0x15882d[_0xb39c('0x1d')]?_[_0xb39c('0x1c')](_0x15882d[_0xb39c('0x1d')],function(_0x8e5a74){return{'model':db[_0x8e5a74[_0xb39c('0x1e')]],'as':_0x8e5a74['as'],'attributes':_0x8e5a74[_0xb39c('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c2b40){logger[_0xb39c('0xc')]('ShowVtigerAccount',_0x309697);logger['debug']('ShowVtigerAccount',_0x309697,JSON[_0xb39c('0xf')](_0x2c2b40));_0x17eb7b(_0x2c2b40);})[_0xb39c('0x15')](function(_0xe6bc2e){logger['error'](_0xb39c('0x20'),_0xe6bc2e[_0xb39c('0x13')],_0x309697);_0x52e642(_0x7339b4[_0xb39c('0x10')](0x1f4,_0xe6bc2e[_0xb39c('0x13')]));});});}; \ No newline at end of file +var _0x44a3=['code','message','VtigerAccount,\x20%s,\x20%s','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowVtigerAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error'];(function(_0x2540b2,_0x569ec4){var _0xb3565d=function(_0x490c13){while(--_0x490c13){_0x2540b2['push'](_0x2540b2['shift']());}};_0xb3565d(++_0x569ec4);}(_0x44a3,0x1a9));var _0x344a=function(_0x128a73,_0x26c676){_0x128a73=_0x128a73-0x0;var _0x210caa=_0x44a3[_0x128a73];return _0x210caa;};'use strict';var _=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var moment=require(_0x344a('0x2'));var BPromise=require(_0x344a('0x3'));var rs=require(_0x344a('0x4'));var fs=require('fs');var Redis=require(_0x344a('0x5'));var db=require(_0x344a('0x6'))['db'];var utils=require(_0x344a('0x7'));var logger=require('../../config/logger')(_0x344a('0x8'));var config=require(_0x344a('0x9'));var jayson=require(_0x344a('0xa'));var client=jayson[_0x344a('0xb')][_0x344a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x504bd1,_0x553d97,_0x55ddca){return new BPromise(function(_0x484661,_0x475dab){return client[_0x344a('0xd')](_0x504bd1,_0x55ddca)[_0x344a('0xe')](function(_0x233ca1){logger[_0x344a('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x553d97,_0x344a('0x10'));logger[_0x344a('0x11')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x553d97,_0x344a('0x10'),JSON['stringify'](_0x233ca1));if(_0x233ca1[_0x344a('0x12')]){if(_0x233ca1['error'][_0x344a('0x13')]===0x1f4){logger[_0x344a('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x553d97,_0x233ca1['error'][_0x344a('0x14')]);return _0x475dab(_0x233ca1[_0x344a('0x12')][_0x344a('0x14')]);}logger[_0x344a('0x12')](_0x344a('0x15'),_0x553d97,_0x233ca1[_0x344a('0x12')]['message']);return _0x484661(_0x233ca1[_0x344a('0x12')][_0x344a('0x14')]);}else{logger[_0x344a('0xf')](_0x344a('0x15'),_0x553d97,'request\x20sent');_0x484661(_0x233ca1['result'][_0x344a('0x14')]);}})[_0x344a('0x16')](function(_0x36227e){logger[_0x344a('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x553d97,_0x36227e);_0x475dab(_0x36227e);});});}exports[_0x344a('0x17')]=function(_0x277c06){var _0x49b55f=this;return new Promise(function(_0x9fe854,_0x274016){return db[_0x344a('0x18')][_0x344a('0x19')]({'raw':_0x277c06[_0x344a('0x1a')]?_0x277c06[_0x344a('0x1a')][_0x344a('0x1b')]===undefined?!![]:![]:!![],'where':_0x277c06[_0x344a('0x1a')]?_0x277c06[_0x344a('0x1a')][_0x344a('0x1c')]||null:null,'attributes':_0x277c06['options']?_0x277c06[_0x344a('0x1a')][_0x344a('0x1d')]||null:null,'limit':_0x277c06[_0x344a('0x1a')]?_0x277c06[_0x344a('0x1a')][_0x344a('0x1e')]||null:null,'include':_0x277c06[_0x344a('0x1a')]?_0x277c06[_0x344a('0x1a')][_0x344a('0x1f')]?_[_0x344a('0x20')](_0x277c06[_0x344a('0x1a')][_0x344a('0x1f')],function(_0x3b2ab9){return{'model':db[_0x3b2ab9[_0x344a('0x21')]],'as':_0x3b2ab9['as'],'attributes':_0x3b2ab9[_0x344a('0x1d')],'include':_0x3b2ab9['include']?_[_0x344a('0x20')](_0x3b2ab9['include'],function(_0x2a5e49){return{'model':db[_0x2a5e49['model']],'as':_0x2a5e49['as'],'attributes':_0x2a5e49[_0x344a('0x1d')],'include':_0x2a5e49[_0x344a('0x1f')]?_[_0x344a('0x20')](_0x2a5e49[_0x344a('0x1f')],function(_0x26f059){return{'model':db[_0x26f059[_0x344a('0x21')]],'as':_0x26f059['as'],'attributes':_0x26f059[_0x344a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x344a('0xe')](function(_0x4f2499){logger[_0x344a('0xf')](_0x344a('0x17'),_0x277c06);logger[_0x344a('0x11')](_0x344a('0x17'),_0x277c06,JSON[_0x344a('0x22')](_0x4f2499));_0x9fe854(_0x4f2499);})[_0x344a('0x16')](function(_0x5b877d){logger[_0x344a('0x12')]('GetVtigerAccount',_0x5b877d['message'],_0x277c06);_0x274016(_0x49b55f[_0x344a('0x12')](0x1f4,_0x5b877d[_0x344a('0x14')]));});});};exports[_0x344a('0x23')]=function(_0x4803db){var _0x5cd9c6=this;return new Promise(function(_0x5cafd2,_0x16f490){return db[_0x344a('0x18')][_0x344a('0x24')]({'raw':_0x4803db['options']?_0x4803db[_0x344a('0x1a')][_0x344a('0x1b')]===undefined?!![]:![]:!![],'where':_0x4803db[_0x344a('0x1a')]?_0x4803db[_0x344a('0x1a')][_0x344a('0x1c')]||null:null,'attributes':_0x4803db[_0x344a('0x1a')]?_0x4803db[_0x344a('0x1a')]['attributes']||null:null,'include':_0x4803db[_0x344a('0x1a')]?_0x4803db['options']['include']?_['map'](_0x4803db[_0x344a('0x1a')][_0x344a('0x1f')],function(_0x2b8e71){return{'model':db[_0x2b8e71[_0x344a('0x21')]],'as':_0x2b8e71['as'],'attributes':_0x2b8e71[_0x344a('0x1d')],'include':_0x2b8e71[_0x344a('0x1f')]?_['map'](_0x2b8e71[_0x344a('0x1f')],function(_0x1fbf64){return{'model':db[_0x1fbf64[_0x344a('0x21')]],'as':_0x1fbf64['as'],'attributes':_0x1fbf64['attributes'],'include':_0x1fbf64[_0x344a('0x1f')]?_[_0x344a('0x20')](_0x1fbf64[_0x344a('0x1f')],function(_0x487a9b){return{'model':db[_0x487a9b[_0x344a('0x21')]],'as':_0x487a9b['as'],'attributes':_0x487a9b['attributes']};}):[]};}):[]};}):[]:[]})[_0x344a('0xe')](function(_0xeabc7c){logger[_0x344a('0xf')](_0x344a('0x23'),_0x4803db);logger[_0x344a('0x11')]('ShowVtigerAccount',_0x4803db,JSON[_0x344a('0x22')](_0xeabc7c));_0x5cafd2(_0xeabc7c);})[_0x344a('0x16')](function(_0x11e81f){logger[_0x344a('0x12')](_0x344a('0x23'),_0x11e81f['message'],_0x4803db);_0x16f490(_0x5cd9c6[_0x344a('0x12')](0x1f4,_0x11e81f[_0x344a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 9d0ffc6..14ff808 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 _0xc6c6=['/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','put','delete','destroy','exports','path','express','fs-extra','../../components/auth/service','./intVtigerConfiguration.controller','get','isAuthenticated','index'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xc6c6,0xb6));var _0x6c6c=function(_0x15106b,_0x4d96f6){_0x15106b=_0x15106b-0x0;var _0x521203=_0xc6c6[_0x15106b];return _0x521203;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6c6c('0x0'));var timeout=require('connect-timeout');var express=require(_0x6c6c('0x1'));var router=express['Router']();var fs_extra=require(_0x6c6c('0x2'));var auth=require(_0x6c6c('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6c6c('0x4'));router[_0x6c6c('0x5')]('/',auth[_0x6c6c('0x6')](),controller[_0x6c6c('0x7')]);router['get'](_0x6c6c('0x8'),auth[_0x6c6c('0x6')](),controller['show']);router[_0x6c6c('0x5')](_0x6c6c('0x9'),auth[_0x6c6c('0x6')](),controller[_0x6c6c('0xa')]);router[_0x6c6c('0x5')](_0x6c6c('0xb'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x6c6c('0x5')](_0x6c6c('0xc'),auth[_0x6c6c('0x6')](),controller[_0x6c6c('0xd')]);router['post']('/',auth[_0x6c6c('0x6')](),controller[_0x6c6c('0xe')]);router[_0x6c6c('0xf')](_0x6c6c('0x8'),auth[_0x6c6c('0x6')](),controller['update']);router[_0x6c6c('0x10')](_0x6c6c('0x8'),auth[_0x6c6c('0x6')](),controller[_0x6c6c('0x11')]);module[_0x6c6c('0x12')]=router; \ No newline at end of file +var _0x06c7=['getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','/:id/fields'];(function(_0x548a37,_0x122e19){var _0x2e350c=function(_0x4aeb84){while(--_0x4aeb84){_0x548a37['push'](_0x548a37['shift']());}};_0x2e350c(++_0x122e19);}(_0x06c7,0x1a9));var _0x706c=function(_0xf5bf37,_0x145a22){_0xf5bf37=_0xf5bf37-0x0;var _0x42214d=_0x06c7[_0xf5bf37];return _0x42214d;};'use strict';var multer=require('multer');var util=require(_0x706c('0x0'));var path=require(_0x706c('0x1'));var timeout=require(_0x706c('0x2'));var express=require(_0x706c('0x3'));var router=express[_0x706c('0x4')]();var fs_extra=require(_0x706c('0x5'));var auth=require(_0x706c('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intVtigerConfiguration.controller');router[_0x706c('0x7')]('/',auth[_0x706c('0x8')](),controller[_0x706c('0x9')]);router['get'](_0x706c('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0x706c('0xb'),auth[_0x706c('0x8')](),controller[_0x706c('0xc')]);router[_0x706c('0x7')](_0x706c('0xd'),auth[_0x706c('0x8')](),controller[_0x706c('0xe')]);router[_0x706c('0x7')](_0x706c('0xf'),auth[_0x706c('0x8')](),controller[_0x706c('0x10')]);router['post']('/',auth[_0x706c('0x8')](),controller[_0x706c('0x11')]);router[_0x706c('0x12')](_0x706c('0xa'),auth[_0x706c('0x8')](),controller[_0x706c('0x13')]);router[_0x706c('0x14')]('/:id',auth[_0x706c('0x8')](),controller[_0x706c('0x15')]);module[_0x706c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 877e2c4..f95b133 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 _0x50d5=['STRING','sequelize'];(function(_0x5562c5,_0x36071d){var _0x51fcf3=function(_0x2cfe90){while(--_0x2cfe90){_0x5562c5['push'](_0x5562c5['shift']());}};_0x51fcf3(++_0x36071d);}(_0x50d5,0x1e7));var _0x550d=function(_0x479d28,_0x344b0a){_0x479d28=_0x479d28-0x0;var _0x35ba93=_0x50d5[_0x479d28];return _0x35ba93;};'use strict';var Sequelize=require(_0x550d('0x0'));module['exports']={'name':{'type':Sequelize[_0x550d('0x1')]},'description':{'type':Sequelize[_0x550d('0x1')]}}; \ No newline at end of file +var _0x6d8c=['exports','STRING'];(function(_0x12723c,_0x148a5a){var _0x3fc804=function(_0x810da6){while(--_0x810da6){_0x12723c['push'](_0x12723c['shift']());}};_0x3fc804(++_0x148a5a);}(_0x6d8c,0x162));var _0xc6d8=function(_0x461c85,_0xf632ee){_0x461c85=_0x461c85-0x0;var _0x22a4e5=_0x6d8c[_0x461c85];return _0x22a4e5;};'use strict';var Sequelize=require('sequelize');module[_0xc6d8('0x0')]={'name':{'type':Sequelize[_0xc6d8('0x1')]},'description':{'type':Sequelize[_0xc6d8('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 976c75d..88644aa 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 _0xfdc1=['VtigerConfiguration','rawAttributes','fieldName','type','query','filters','intersection','fields','attributes','model','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','then','include','catch','show','keys','find','create','body','params','destroy','getFields','VtigerField','findOne','length','getDescriptions','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','error','stack','name','index','map'];(function(_0x36327e,_0x46fcdc){var _0x32b9ad=function(_0x1a90d2){while(--_0x1a90d2){_0x36327e['push'](_0x36327e['shift']());}};_0x32b9ad(++_0x46fcdc);}(_0xfdc1,0x71));var _0x1fdc=function(_0x28d7b5,_0x1305a4){_0x28d7b5=_0x28d7b5-0x0;var _0x1ed035=_0xfdc1[_0x28d7b5];return _0x1ed035;};'use strict';var emlformat=require(_0x1fdc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1fdc('0x1'));var jsonpatch=require(_0x1fdc('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1fdc('0x3'));var Mustache=require(_0x1fdc('0x4'));var util=require(_0x1fdc('0x5'));var path=require(_0x1fdc('0x6'));var sox=require(_0x1fdc('0x7'));var csv=require(_0x1fdc('0x8'));var ejs=require(_0x1fdc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1fdc('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1fdc('0xb'));var deskjs=require(_0x1fdc('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1fdc('0xd'));var Papa=require(_0x1fdc('0xe'));var Redis=require('ioredis');var authService=require(_0x1fdc('0xf'));var qs=require(_0x1fdc('0x10'));var as=require(_0x1fdc('0x11'));var hardwareService=require(_0x1fdc('0x12'));var logger=require(_0x1fdc('0x13'))(_0x1fdc('0x14'));var utils=require(_0x1fdc('0x15'));var config=require(_0x1fdc('0x16'));var licenseUtil=require(_0x1fdc('0x17'));var db=require(_0x1fdc('0x18'))['db'];function respondWithStatusCode(_0x2c7a3a,_0x118a2e){_0x118a2e=_0x118a2e||0xcc;return function(_0x2228fd){if(_0x2228fd){return _0x2c7a3a[_0x1fdc('0x19')](_0x118a2e);}return _0x2c7a3a['status'](_0x118a2e)[_0x1fdc('0x1a')]();};}function respondWithResult(_0xd5b977,_0x5e09e9){_0x5e09e9=_0x5e09e9||0xc8;return function(_0x5cfe90){if(_0x5cfe90){return _0xd5b977[_0x1fdc('0x1b')](_0x5e09e9)[_0x1fdc('0x1c')](_0x5cfe90);}};}function respondWithFilteredResult(_0x200700,_0x2b4c5d){return function(_0x199ed3){if(_0x199ed3){var _0x3d783e=typeof _0x2b4c5d[_0x1fdc('0x1d')]===_0x1fdc('0x1e')&&typeof _0x2b4c5d[_0x1fdc('0x1f')]==='undefined';var _0x381707=_0x199ed3[_0x1fdc('0x20')];var _0x2b1b2b=_0x3d783e?0x0:_0x2b4c5d[_0x1fdc('0x1d')];var _0x46ea3e=_0x3d783e?_0x199ed3[_0x1fdc('0x20')]:_0x2b4c5d[_0x1fdc('0x1d')]+_0x2b4c5d[_0x1fdc('0x1f')];var _0x1215d8;if(_0x46ea3e>=_0x381707){_0x46ea3e=_0x381707;_0x1215d8=0xc8;}else{_0x1215d8=0xce;}_0x200700[_0x1fdc('0x1b')](_0x1215d8);return _0x200700[_0x1fdc('0x21')](_0x1fdc('0x22'),_0x2b1b2b+'-'+_0x46ea3e+'/'+_0x381707)[_0x1fdc('0x1c')](_0x199ed3);}return null;};}function patchUpdates(_0x2cf343){return function(_0xd90f0a){try{jsonpatch[_0x1fdc('0x23')](_0xd90f0a,_0x2cf343,!![]);}catch(_0x4e08fd){return BPromise[_0x1fdc('0x24')](_0x4e08fd);}return _0xd90f0a['save']();};}function saveUpdates(_0x25b5c2,_0x3bf72a){return function(_0x2a2a41){if(_0x2a2a41){return _0x2a2a41[_0x1fdc('0x25')](_0x25b5c2)['then'](function(_0x5c13ee){return _0x5c13ee;});}return null;};}function removeEntity(_0x57fcec,_0x3eae26){return function(_0x374762){if(_0x374762){return _0x374762['destroy']()['then'](function(){_0x57fcec['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d8d56,_0x427f85){return function(_0x28c709){if(!_0x28c709){_0x5d8d56[_0x1fdc('0x19')](0x194);}return _0x28c709;};}function handleError(_0x210865,_0x36c8ea){_0x36c8ea=_0x36c8ea||0x1f4;return function(_0x15b197){logger[_0x1fdc('0x26')](_0x15b197[_0x1fdc('0x27')]);if(_0x15b197[_0x1fdc('0x28')]){delete _0x15b197[_0x1fdc('0x28')];}_0x210865[_0x1fdc('0x1b')](_0x36c8ea)['send'](_0x15b197);};}exports[_0x1fdc('0x29')]=function(_0x48fc58,_0x55e7fc){var _0xd99ed2={},_0x4e7f49={},_0x46df80={'count':0x0,'rows':[]};var _0x1544a3=_[_0x1fdc('0x2a')](db[_0x1fdc('0x2b')][_0x1fdc('0x2c')],function(_0x52ab33){return{'name':_0x52ab33[_0x1fdc('0x2d')],'type':_0x52ab33[_0x1fdc('0x2e')]['key']};});_0x4e7f49['model']=_[_0x1fdc('0x2a')](_0x1544a3,'name');_0x4e7f49[_0x1fdc('0x2f')]=_['keys'](_0x48fc58[_0x1fdc('0x2f')]);_0x4e7f49[_0x1fdc('0x30')]=_[_0x1fdc('0x31')](_0x4e7f49['model'],_0x4e7f49[_0x1fdc('0x2f')]);_0xd99ed2['attributes']=_[_0x1fdc('0x31')](_0x4e7f49['model'],qs[_0x1fdc('0x32')](_0x48fc58[_0x1fdc('0x2f')][_0x1fdc('0x32')]));_0xd99ed2[_0x1fdc('0x33')]=_0xd99ed2[_0x1fdc('0x33')]['length']?_0xd99ed2[_0x1fdc('0x33')]:_0x4e7f49[_0x1fdc('0x34')];if(!_0x48fc58[_0x1fdc('0x2f')][_0x1fdc('0x35')](_0x1fdc('0x36'))){_0xd99ed2['limit']=qs['limit'](_0x48fc58['query']['limit']);_0xd99ed2[_0x1fdc('0x1d')]=qs[_0x1fdc('0x1d')](_0x48fc58[_0x1fdc('0x2f')][_0x1fdc('0x1d')]);}_0xd99ed2[_0x1fdc('0x37')]=qs['sort'](_0x48fc58[_0x1fdc('0x2f')][_0x1fdc('0x38')]);_0xd99ed2[_0x1fdc('0x39')]=qs['filters'](_[_0x1fdc('0x3a')](_0x48fc58[_0x1fdc('0x2f')],_0x4e7f49['filters']),_0x1544a3);if(_0x48fc58[_0x1fdc('0x2f')]['filter']){_0xd99ed2[_0x1fdc('0x39')]=_[_0x1fdc('0x3b')](_0xd99ed2[_0x1fdc('0x39')],{'$or':_[_0x1fdc('0x2a')](_0x1544a3,function(_0x54574a){if(_0x54574a[_0x1fdc('0x2e')]!==_0x1fdc('0x3c')){var _0x5702e9={};_0x5702e9[_0x54574a[_0x1fdc('0x28')]]={'$like':'%'+_0x48fc58[_0x1fdc('0x2f')][_0x1fdc('0x3d')]+'%'};return _0x5702e9;}})});}_0xd99ed2=_[_0x1fdc('0x3b')]({},_0xd99ed2,_0x48fc58[_0x1fdc('0x3e')]);var _0x6408c0={'where':_0xd99ed2[_0x1fdc('0x39')]};return db[_0x1fdc('0x2b')][_0x1fdc('0x20')](_0x6408c0)[_0x1fdc('0x3f')](function(_0x1893ea){_0x46df80[_0x1fdc('0x20')]=_0x1893ea;if(_0x48fc58[_0x1fdc('0x2f')]['includeAll']){_0xd99ed2[_0x1fdc('0x40')]=[{'all':!![]}];}return db[_0x1fdc('0x2b')]['findAll'](_0xd99ed2);})[_0x1fdc('0x3f')](function(_0xacac2d){_0x46df80['rows']=_0xacac2d;return _0x46df80;})[_0x1fdc('0x3f')](respondWithFilteredResult(_0x55e7fc,_0xd99ed2))[_0x1fdc('0x41')](handleError(_0x55e7fc,null));};exports[_0x1fdc('0x42')]=function(_0x2cc7b0,_0x36ed1d){var _0x554b3d={'raw':![],'where':{'id':_0x2cc7b0['params']['id']}},_0x3e9bb4={};_0x3e9bb4[_0x1fdc('0x34')]=_[_0x1fdc('0x43')](db[_0x1fdc('0x2b')]['rawAttributes']);_0x3e9bb4[_0x1fdc('0x2f')]=_[_0x1fdc('0x43')](_0x2cc7b0[_0x1fdc('0x2f')]);_0x3e9bb4['filters']=_['intersection'](_0x3e9bb4[_0x1fdc('0x34')],_0x3e9bb4[_0x1fdc('0x2f')]);_0x554b3d[_0x1fdc('0x33')]=_[_0x1fdc('0x31')](_0x3e9bb4[_0x1fdc('0x34')],qs[_0x1fdc('0x32')](_0x2cc7b0[_0x1fdc('0x2f')]['fields']));_0x554b3d[_0x1fdc('0x33')]=_0x554b3d['attributes']['length']?_0x554b3d['attributes']:_0x3e9bb4[_0x1fdc('0x34')];if(_0x2cc7b0[_0x1fdc('0x2f')]['includeAll']){_0x554b3d[_0x1fdc('0x40')]=[{'all':!![]}];}_0x554b3d=_[_0x1fdc('0x3b')]({},_0x554b3d,_0x2cc7b0[_0x1fdc('0x3e')]);return db[_0x1fdc('0x2b')][_0x1fdc('0x44')](_0x554b3d)[_0x1fdc('0x3f')](handleEntityNotFound(_0x36ed1d,null))[_0x1fdc('0x3f')](respondWithResult(_0x36ed1d,null))[_0x1fdc('0x41')](handleError(_0x36ed1d,null));};exports[_0x1fdc('0x45')]=function(_0x19ce87,_0x590f11){return db[_0x1fdc('0x2b')]['create'](_0x19ce87[_0x1fdc('0x46')],{})[_0x1fdc('0x3f')](respondWithResult(_0x590f11,0xc9))[_0x1fdc('0x41')](handleError(_0x590f11,null));};exports[_0x1fdc('0x25')]=function(_0x4bf31a,_0x36a0dc){if(_0x4bf31a['body']['id']){delete _0x4bf31a[_0x1fdc('0x46')]['id'];}return db['VtigerConfiguration'][_0x1fdc('0x44')]({'where':{'id':_0x4bf31a[_0x1fdc('0x47')]['id']}})['then'](handleEntityNotFound(_0x36a0dc,null))[_0x1fdc('0x3f')](saveUpdates(_0x4bf31a[_0x1fdc('0x46')],null))['then'](respondWithResult(_0x36a0dc,null))[_0x1fdc('0x41')](handleError(_0x36a0dc,null));};exports[_0x1fdc('0x48')]=function(_0x2505f0,_0x507288){return db[_0x1fdc('0x2b')][_0x1fdc('0x44')]({'where':{'id':_0x2505f0[_0x1fdc('0x47')]['id']}})[_0x1fdc('0x3f')](handleEntityNotFound(_0x507288,null))['then'](removeEntity(_0x507288,null))[_0x1fdc('0x41')](handleError(_0x507288,null));};exports[_0x1fdc('0x49')]=function(_0x113b92,_0xbc16d4,_0x572a12){var _0x188840={};var _0x36ea2f={};var _0x315ea6;var _0x4f1525;return db[_0x1fdc('0x2b')]['findOne']({'where':{'id':_0x113b92[_0x1fdc('0x47')]['id']}})['then'](handleEntityNotFound(_0xbc16d4,null))[_0x1fdc('0x3f')](function(_0x7ae803){if(_0x7ae803){_0x315ea6=_0x7ae803;_0x36ea2f[_0x1fdc('0x34')]=_[_0x1fdc('0x43')](db[_0x1fdc('0x4a')]['rawAttributes']);_0x36ea2f[_0x1fdc('0x2f')]=_[_0x1fdc('0x43')](_0x113b92[_0x1fdc('0x2f')]);_0x36ea2f[_0x1fdc('0x30')]=_[_0x1fdc('0x31')](_0x36ea2f[_0x1fdc('0x34')],_0x36ea2f[_0x1fdc('0x2f')]);_0x188840[_0x1fdc('0x33')]=_[_0x1fdc('0x31')](_0x36ea2f[_0x1fdc('0x34')],qs['fields'](_0x113b92['query'][_0x1fdc('0x32')]));_0x188840['attributes']=_0x188840[_0x1fdc('0x33')]['length']?_0x188840[_0x1fdc('0x33')]:_0x36ea2f['model'];_0x188840[_0x1fdc('0x37')]=qs[_0x1fdc('0x38')](_0x113b92[_0x1fdc('0x2f')][_0x1fdc('0x38')]);_0x188840[_0x1fdc('0x39')]=qs['filters'](_[_0x1fdc('0x3a')](_0x113b92[_0x1fdc('0x2f')],_0x36ea2f['filters']));if(_0x113b92[_0x1fdc('0x2f')][_0x1fdc('0x3d')]){_0x188840['where']=_[_0x1fdc('0x3b')](_0x188840[_0x1fdc('0x39')],{'$or':_[_0x1fdc('0x2a')](_0x188840[_0x1fdc('0x33')],function(_0x481994){var _0x3f5eef={};_0x3f5eef[_0x481994]={'$like':'%'+_0x113b92[_0x1fdc('0x2f')][_0x1fdc('0x3d')]+'%'};return _0x3f5eef;})});}_0x188840=_[_0x1fdc('0x3b')]({},_0x188840,_0x113b92[_0x1fdc('0x3e')]);return _0x315ea6[_0x1fdc('0x49')](_0x188840);}})['then'](function(_0x1adf82){if(_0x1adf82){_0x4f1525=_0x1adf82['length'];if(!_0x113b92[_0x1fdc('0x2f')][_0x1fdc('0x35')](_0x1fdc('0x36'))){_0x188840[_0x1fdc('0x1f')]=qs[_0x1fdc('0x1f')](_0x113b92['query'][_0x1fdc('0x1f')]);_0x188840[_0x1fdc('0x1d')]=qs[_0x1fdc('0x1d')](_0x113b92[_0x1fdc('0x2f')][_0x1fdc('0x1d')]);}return _0x315ea6[_0x1fdc('0x49')](_0x188840);}})[_0x1fdc('0x3f')](function(_0x364a62){if(_0x364a62){return _0x364a62?{'count':_0x4f1525,'rows':_0x364a62}:null;}})[_0x1fdc('0x3f')](respondWithResult(_0xbc16d4,null))[_0x1fdc('0x41')](handleError(_0xbc16d4,null));};exports['getSubjects']=function(_0x379f54,_0x5931b6,_0x3c397f){var _0x3d5087={};var _0xc63e55={};var _0x43c718;var _0x22422e;return db['VtigerConfiguration'][_0x1fdc('0x4b')]({'where':{'id':_0x379f54[_0x1fdc('0x47')]['id']}})[_0x1fdc('0x3f')](handleEntityNotFound(_0x5931b6,null))['then'](function(_0x40e5bf){if(_0x40e5bf){_0x43c718=_0x40e5bf;_0xc63e55[_0x1fdc('0x34')]=_[_0x1fdc('0x43')](db[_0x1fdc('0x4a')][_0x1fdc('0x2c')]);_0xc63e55[_0x1fdc('0x2f')]=_[_0x1fdc('0x43')](_0x379f54[_0x1fdc('0x2f')]);_0xc63e55['filters']=_[_0x1fdc('0x31')](_0xc63e55[_0x1fdc('0x34')],_0xc63e55['query']);_0x3d5087['attributes']=_[_0x1fdc('0x31')](_0xc63e55[_0x1fdc('0x34')],qs[_0x1fdc('0x32')](_0x379f54[_0x1fdc('0x2f')][_0x1fdc('0x32')]));_0x3d5087[_0x1fdc('0x33')]=_0x3d5087[_0x1fdc('0x33')][_0x1fdc('0x4c')]?_0x3d5087['attributes']:_0xc63e55[_0x1fdc('0x34')];_0x3d5087[_0x1fdc('0x37')]=qs[_0x1fdc('0x38')](_0x379f54[_0x1fdc('0x2f')][_0x1fdc('0x38')]);_0x3d5087[_0x1fdc('0x39')]=qs[_0x1fdc('0x30')](_[_0x1fdc('0x3a')](_0x379f54[_0x1fdc('0x2f')],_0xc63e55['filters']));if(_0x379f54['query'][_0x1fdc('0x3d')]){_0x3d5087[_0x1fdc('0x39')]=_[_0x1fdc('0x3b')](_0x3d5087[_0x1fdc('0x39')],{'$or':_[_0x1fdc('0x2a')](_0x3d5087['attributes'],function(_0x415120){var _0x657f5c={};_0x657f5c[_0x415120]={'$like':'%'+_0x379f54['query'][_0x1fdc('0x3d')]+'%'};return _0x657f5c;})});}_0x3d5087=_[_0x1fdc('0x3b')]({},_0x3d5087,_0x379f54[_0x1fdc('0x3e')]);return _0x43c718['getSubjects'](_0x3d5087);}})[_0x1fdc('0x3f')](function(_0x1d841e){if(_0x1d841e){_0x22422e=_0x1d841e['length'];if(!_0x379f54['query'][_0x1fdc('0x35')](_0x1fdc('0x36'))){_0x3d5087[_0x1fdc('0x1f')]=qs['limit'](_0x379f54['query'][_0x1fdc('0x1f')]);_0x3d5087[_0x1fdc('0x1d')]=qs['offset'](_0x379f54[_0x1fdc('0x2f')]['offset']);}return _0x43c718['getSubjects'](_0x3d5087);}})[_0x1fdc('0x3f')](function(_0x1f7d5b){if(_0x1f7d5b){return _0x1f7d5b?{'count':_0x22422e,'rows':_0x1f7d5b}:null;}})['then'](respondWithResult(_0x5931b6,null))[_0x1fdc('0x41')](handleError(_0x5931b6,null));};exports[_0x1fdc('0x4d')]=function(_0x13194c,_0x288f56,_0x289875){var _0x3d4957={};var _0x253577={};var _0x780a75;var _0x3eff28;return db[_0x1fdc('0x2b')][_0x1fdc('0x4b')]({'where':{'id':_0x13194c[_0x1fdc('0x47')]['id']}})['then'](handleEntityNotFound(_0x288f56,null))[_0x1fdc('0x3f')](function(_0x3ec14c){if(_0x3ec14c){_0x780a75=_0x3ec14c;_0x253577['model']=_['keys'](db[_0x1fdc('0x4a')][_0x1fdc('0x2c')]);_0x253577[_0x1fdc('0x2f')]=_[_0x1fdc('0x43')](_0x13194c[_0x1fdc('0x2f')]);_0x253577[_0x1fdc('0x30')]=_[_0x1fdc('0x31')](_0x253577[_0x1fdc('0x34')],_0x253577[_0x1fdc('0x2f')]);_0x3d4957[_0x1fdc('0x33')]=_[_0x1fdc('0x31')](_0x253577[_0x1fdc('0x34')],qs[_0x1fdc('0x32')](_0x13194c[_0x1fdc('0x2f')][_0x1fdc('0x32')]));_0x3d4957[_0x1fdc('0x33')]=_0x3d4957[_0x1fdc('0x33')][_0x1fdc('0x4c')]?_0x3d4957[_0x1fdc('0x33')]:_0x253577['model'];_0x3d4957[_0x1fdc('0x37')]=qs[_0x1fdc('0x38')](_0x13194c[_0x1fdc('0x2f')][_0x1fdc('0x38')]);_0x3d4957[_0x1fdc('0x39')]=qs[_0x1fdc('0x30')](_[_0x1fdc('0x3a')](_0x13194c[_0x1fdc('0x2f')],_0x253577[_0x1fdc('0x30')]));if(_0x13194c[_0x1fdc('0x2f')][_0x1fdc('0x3d')]){_0x3d4957[_0x1fdc('0x39')]=_[_0x1fdc('0x3b')](_0x3d4957[_0x1fdc('0x39')],{'$or':_[_0x1fdc('0x2a')](_0x3d4957[_0x1fdc('0x33')],function(_0x2a8d82){var _0x409f09={};_0x409f09[_0x2a8d82]={'$like':'%'+_0x13194c[_0x1fdc('0x2f')][_0x1fdc('0x3d')]+'%'};return _0x409f09;})});}_0x3d4957=_[_0x1fdc('0x3b')]({},_0x3d4957,_0x13194c[_0x1fdc('0x3e')]);return _0x780a75[_0x1fdc('0x4d')](_0x3d4957);}})['then'](function(_0xf76321){if(_0xf76321){_0x3eff28=_0xf76321[_0x1fdc('0x4c')];if(!_0x13194c['query'][_0x1fdc('0x35')]('nolimit')){_0x3d4957[_0x1fdc('0x1f')]=qs[_0x1fdc('0x1f')](_0x13194c['query'][_0x1fdc('0x1f')]);_0x3d4957[_0x1fdc('0x1d')]=qs[_0x1fdc('0x1d')](_0x13194c[_0x1fdc('0x2f')][_0x1fdc('0x1d')]);}return _0x780a75['getDescriptions'](_0x3d4957);}})[_0x1fdc('0x3f')](function(_0x1c37f2){if(_0x1c37f2){return _0x1c37f2?{'count':_0x3eff28,'rows':_0x1c37f2}:null;}})[_0x1fdc('0x3f')](respondWithResult(_0x288f56,null))[_0x1fdc('0x41')](handleError(_0x288f56,null));}; \ No newline at end of file +var _0xe2d4=['jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','VtigerConfiguration','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','keys','includeAll','find','create','body','params','getFields','rawAttributes','length','order','options','getSubjects','VtigerField','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','fs-extra','lodash','crypto'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe2d4,0xd9));var _0x4e2d=function(_0x1a405a,_0x5378d1){_0x1a405a=_0x1a405a-0x0;var _0x359947=_0xe2d4[_0x1a405a];return _0x359947;};'use strict';var emlformat=require(_0x4e2d('0x0'));var rimraf=require(_0x4e2d('0x1'));var zipdir=require(_0x4e2d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4e2d('0x3'));var moment=require(_0x4e2d('0x4'));var BPromise=require(_0x4e2d('0x5'));var Mustache=require('mustache');var util=require(_0x4e2d('0x6'));var path=require('path');var sox=require(_0x4e2d('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4e2d('0x8'));var _=require(_0x4e2d('0x9'));var squel=require('squel');var crypto=require(_0x4e2d('0xa'));var jsforce=require(_0x4e2d('0xb'));var deskjs=require(_0x4e2d('0xc'));var toCsv=require(_0x4e2d('0xd'));var querystring=require(_0x4e2d('0xe'));var Papa=require(_0x4e2d('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4e2d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e2d('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x4e2d('0x12'));var config=require(_0x4e2d('0x13'));var licenseUtil=require(_0x4e2d('0x14'));var db=require(_0x4e2d('0x15'))['db'];function respondWithStatusCode(_0x392b0d,_0x10da00){_0x10da00=_0x10da00||0xcc;return function(_0x465efb){if(_0x465efb){return _0x392b0d[_0x4e2d('0x16')](_0x10da00);}return _0x392b0d[_0x4e2d('0x17')](_0x10da00)[_0x4e2d('0x18')]();};}function respondWithResult(_0x29563c,_0x3d84d6){_0x3d84d6=_0x3d84d6||0xc8;return function(_0x2a5e0e){if(_0x2a5e0e){return _0x29563c['status'](_0x3d84d6)[_0x4e2d('0x19')](_0x2a5e0e);}};}function respondWithFilteredResult(_0x2e21c1,_0xcf4929){return function(_0x2db016){if(_0x2db016){var _0x5e4815=typeof _0xcf4929[_0x4e2d('0x1a')]===_0x4e2d('0x1b')&&typeof _0xcf4929[_0x4e2d('0x1c')]===_0x4e2d('0x1b');var _0x163211=_0x2db016[_0x4e2d('0x1d')];var _0x3a3bab=_0x5e4815?0x0:_0xcf4929['offset'];var _0x25fffb=_0x5e4815?_0x2db016[_0x4e2d('0x1d')]:_0xcf4929[_0x4e2d('0x1a')]+_0xcf4929[_0x4e2d('0x1c')];var _0x39a35b;if(_0x25fffb>=_0x163211){_0x25fffb=_0x163211;_0x39a35b=0xc8;}else{_0x39a35b=0xce;}_0x2e21c1['status'](_0x39a35b);return _0x2e21c1['set'](_0x4e2d('0x1e'),_0x3a3bab+'-'+_0x25fffb+'/'+_0x163211)[_0x4e2d('0x19')](_0x2db016);}return null;};}function patchUpdates(_0x1a0169){return function(_0x2f0d3f){try{jsonpatch[_0x4e2d('0x1f')](_0x2f0d3f,_0x1a0169,!![]);}catch(_0x507492){return BPromise[_0x4e2d('0x20')](_0x507492);}return _0x2f0d3f[_0x4e2d('0x21')]();};}function saveUpdates(_0x1d336b,_0x3e3978){return function(_0x586436){if(_0x586436){return _0x586436[_0x4e2d('0x22')](_0x1d336b)[_0x4e2d('0x23')](function(_0x252bf0){return _0x252bf0;});}return null;};}function removeEntity(_0x365105,_0x16d3a0){return function(_0x247327){if(_0x247327){return _0x247327[_0x4e2d('0x24')]()[_0x4e2d('0x23')](function(){_0x365105['status'](0xcc)[_0x4e2d('0x18')]();});}};}function handleEntityNotFound(_0xf09ffc,_0x28385d){return function(_0x241af6){if(!_0x241af6){_0xf09ffc[_0x4e2d('0x16')](0x194);}return _0x241af6;};}function handleError(_0x27082,_0x3db470){_0x3db470=_0x3db470||0x1f4;return function(_0x450ff7){logger[_0x4e2d('0x25')](_0x450ff7[_0x4e2d('0x26')]);if(_0x450ff7['name']){delete _0x450ff7[_0x4e2d('0x27')];}_0x27082['status'](_0x3db470)['send'](_0x450ff7);};}exports['index']=function(_0x4d8328,_0x105998){var _0x522e2a={},_0x653f81={},_0x5702a1={'count':0x0,'rows':[]};var _0x151df6=_['map'](db[_0x4e2d('0x28')]['rawAttributes'],function(_0x17650d){return{'name':_0x17650d[_0x4e2d('0x29')],'type':_0x17650d[_0x4e2d('0x2a')]['key']};});_0x653f81[_0x4e2d('0x2b')]=_[_0x4e2d('0x2c')](_0x151df6,'name');_0x653f81[_0x4e2d('0x2d')]=_['keys'](_0x4d8328[_0x4e2d('0x2d')]);_0x653f81[_0x4e2d('0x2e')]=_[_0x4e2d('0x2f')](_0x653f81[_0x4e2d('0x2b')],_0x653f81[_0x4e2d('0x2d')]);_0x522e2a[_0x4e2d('0x30')]=_[_0x4e2d('0x2f')](_0x653f81[_0x4e2d('0x2b')],qs[_0x4e2d('0x31')](_0x4d8328['query']['fields']));_0x522e2a[_0x4e2d('0x30')]=_0x522e2a[_0x4e2d('0x30')]['length']?_0x522e2a[_0x4e2d('0x30')]:_0x653f81[_0x4e2d('0x2b')];if(!_0x4d8328[_0x4e2d('0x2d')][_0x4e2d('0x32')](_0x4e2d('0x33'))){_0x522e2a[_0x4e2d('0x1c')]=qs[_0x4e2d('0x1c')](_0x4d8328[_0x4e2d('0x2d')][_0x4e2d('0x1c')]);_0x522e2a[_0x4e2d('0x1a')]=qs[_0x4e2d('0x1a')](_0x4d8328[_0x4e2d('0x2d')]['offset']);}_0x522e2a['order']=qs[_0x4e2d('0x34')](_0x4d8328[_0x4e2d('0x2d')][_0x4e2d('0x34')]);_0x522e2a[_0x4e2d('0x35')]=qs['filters'](_[_0x4e2d('0x36')](_0x4d8328['query'],_0x653f81[_0x4e2d('0x2e')]),_0x151df6);if(_0x4d8328[_0x4e2d('0x2d')]['filter']){_0x522e2a['where']=_[_0x4e2d('0x37')](_0x522e2a[_0x4e2d('0x35')],{'$or':_[_0x4e2d('0x2c')](_0x151df6,function(_0x39cb43){if(_0x39cb43[_0x4e2d('0x2a')]!==_0x4e2d('0x38')){var _0x2b5e4a={};_0x2b5e4a[_0x39cb43[_0x4e2d('0x27')]]={'$like':'%'+_0x4d8328[_0x4e2d('0x2d')][_0x4e2d('0x39')]+'%'};return _0x2b5e4a;}})});}_0x522e2a=_[_0x4e2d('0x37')]({},_0x522e2a,_0x4d8328['options']);var _0x924d34={'where':_0x522e2a[_0x4e2d('0x35')]};return db[_0x4e2d('0x28')]['count'](_0x924d34)[_0x4e2d('0x23')](function(_0x1bdaca){_0x5702a1[_0x4e2d('0x1d')]=_0x1bdaca;if(_0x4d8328[_0x4e2d('0x2d')]['includeAll']){_0x522e2a[_0x4e2d('0x3a')]=[{'all':!![]}];}return db[_0x4e2d('0x28')][_0x4e2d('0x3b')](_0x522e2a);})['then'](function(_0x37e6a9){_0x5702a1[_0x4e2d('0x3c')]=_0x37e6a9;return _0x5702a1;})['then'](respondWithFilteredResult(_0x105998,_0x522e2a))[_0x4e2d('0x3d')](handleError(_0x105998,null));};exports['show']=function(_0x5d66ec,_0x4d2330){var _0x19c814={'raw':![],'where':{'id':_0x5d66ec['params']['id']}},_0x1dfee9={};_0x1dfee9['model']=_[_0x4e2d('0x3e')](db[_0x4e2d('0x28')]['rawAttributes']);_0x1dfee9[_0x4e2d('0x2d')]=_[_0x4e2d('0x3e')](_0x5d66ec[_0x4e2d('0x2d')]);_0x1dfee9[_0x4e2d('0x2e')]=_['intersection'](_0x1dfee9[_0x4e2d('0x2b')],_0x1dfee9['query']);_0x19c814[_0x4e2d('0x30')]=_[_0x4e2d('0x2f')](_0x1dfee9[_0x4e2d('0x2b')],qs[_0x4e2d('0x31')](_0x5d66ec[_0x4e2d('0x2d')]['fields']));_0x19c814[_0x4e2d('0x30')]=_0x19c814[_0x4e2d('0x30')]['length']?_0x19c814['attributes']:_0x1dfee9['model'];if(_0x5d66ec[_0x4e2d('0x2d')][_0x4e2d('0x3f')]){_0x19c814[_0x4e2d('0x3a')]=[{'all':!![]}];}_0x19c814=_[_0x4e2d('0x37')]({},_0x19c814,_0x5d66ec['options']);return db[_0x4e2d('0x28')][_0x4e2d('0x40')](_0x19c814)[_0x4e2d('0x23')](handleEntityNotFound(_0x4d2330,null))[_0x4e2d('0x23')](respondWithResult(_0x4d2330,null))[_0x4e2d('0x3d')](handleError(_0x4d2330,null));};exports[_0x4e2d('0x41')]=function(_0xe55c0e,_0x18864f){return db[_0x4e2d('0x28')][_0x4e2d('0x41')](_0xe55c0e['body'],{})[_0x4e2d('0x23')](respondWithResult(_0x18864f,0xc9))['catch'](handleError(_0x18864f,null));};exports[_0x4e2d('0x22')]=function(_0x2e0874,_0x1f87af){if(_0x2e0874[_0x4e2d('0x42')]['id']){delete _0x2e0874[_0x4e2d('0x42')]['id'];}return db[_0x4e2d('0x28')][_0x4e2d('0x40')]({'where':{'id':_0x2e0874[_0x4e2d('0x43')]['id']}})[_0x4e2d('0x23')](handleEntityNotFound(_0x1f87af,null))[_0x4e2d('0x23')](saveUpdates(_0x2e0874[_0x4e2d('0x42')],null))[_0x4e2d('0x23')](respondWithResult(_0x1f87af,null))['catch'](handleError(_0x1f87af,null));};exports[_0x4e2d('0x24')]=function(_0x310324,_0x7a3866){return db[_0x4e2d('0x28')]['find']({'where':{'id':_0x310324[_0x4e2d('0x43')]['id']}})[_0x4e2d('0x23')](handleEntityNotFound(_0x7a3866,null))[_0x4e2d('0x23')](removeEntity(_0x7a3866,null))['catch'](handleError(_0x7a3866,null));};exports[_0x4e2d('0x44')]=function(_0x236220,_0x51c76f,_0x2fe153){var _0x55432d={};var _0x3df470={};var _0xb73c14;var _0x5bf08f;return db[_0x4e2d('0x28')]['findOne']({'where':{'id':_0x236220[_0x4e2d('0x43')]['id']}})[_0x4e2d('0x23')](handleEntityNotFound(_0x51c76f,null))['then'](function(_0x43579c){if(_0x43579c){_0xb73c14=_0x43579c;_0x3df470[_0x4e2d('0x2b')]=_[_0x4e2d('0x3e')](db['VtigerField'][_0x4e2d('0x45')]);_0x3df470[_0x4e2d('0x2d')]=_[_0x4e2d('0x3e')](_0x236220[_0x4e2d('0x2d')]);_0x3df470[_0x4e2d('0x2e')]=_[_0x4e2d('0x2f')](_0x3df470[_0x4e2d('0x2b')],_0x3df470[_0x4e2d('0x2d')]);_0x55432d[_0x4e2d('0x30')]=_['intersection'](_0x3df470[_0x4e2d('0x2b')],qs[_0x4e2d('0x31')](_0x236220[_0x4e2d('0x2d')]['fields']));_0x55432d[_0x4e2d('0x30')]=_0x55432d[_0x4e2d('0x30')][_0x4e2d('0x46')]?_0x55432d[_0x4e2d('0x30')]:_0x3df470[_0x4e2d('0x2b')];_0x55432d[_0x4e2d('0x47')]=qs[_0x4e2d('0x34')](_0x236220['query'][_0x4e2d('0x34')]);_0x55432d[_0x4e2d('0x35')]=qs[_0x4e2d('0x2e')](_[_0x4e2d('0x36')](_0x236220['query'],_0x3df470['filters']));if(_0x236220['query'][_0x4e2d('0x39')]){_0x55432d[_0x4e2d('0x35')]=_[_0x4e2d('0x37')](_0x55432d[_0x4e2d('0x35')],{'$or':_[_0x4e2d('0x2c')](_0x55432d[_0x4e2d('0x30')],function(_0x220c7d){var _0x425179={};_0x425179[_0x220c7d]={'$like':'%'+_0x236220[_0x4e2d('0x2d')][_0x4e2d('0x39')]+'%'};return _0x425179;})});}_0x55432d=_[_0x4e2d('0x37')]({},_0x55432d,_0x236220[_0x4e2d('0x48')]);return _0xb73c14[_0x4e2d('0x44')](_0x55432d);}})[_0x4e2d('0x23')](function(_0x3bb804){if(_0x3bb804){_0x5bf08f=_0x3bb804['length'];if(!_0x236220[_0x4e2d('0x2d')]['hasOwnProperty'](_0x4e2d('0x33'))){_0x55432d[_0x4e2d('0x1c')]=qs[_0x4e2d('0x1c')](_0x236220[_0x4e2d('0x2d')]['limit']);_0x55432d['offset']=qs[_0x4e2d('0x1a')](_0x236220[_0x4e2d('0x2d')][_0x4e2d('0x1a')]);}return _0xb73c14[_0x4e2d('0x44')](_0x55432d);}})['then'](function(_0x3dfdff){if(_0x3dfdff){return _0x3dfdff?{'count':_0x5bf08f,'rows':_0x3dfdff}:null;}})['then'](respondWithResult(_0x51c76f,null))[_0x4e2d('0x3d')](handleError(_0x51c76f,null));};exports[_0x4e2d('0x49')]=function(_0x3808e1,_0x23cf95,_0x3fc067){var _0x256610={};var _0x172bf3={};var _0x435c96;var _0x30dad4;return db[_0x4e2d('0x28')]['findOne']({'where':{'id':_0x3808e1[_0x4e2d('0x43')]['id']}})[_0x4e2d('0x23')](handleEntityNotFound(_0x23cf95,null))[_0x4e2d('0x23')](function(_0x8ed67f){if(_0x8ed67f){_0x435c96=_0x8ed67f;_0x172bf3[_0x4e2d('0x2b')]=_[_0x4e2d('0x3e')](db[_0x4e2d('0x4a')][_0x4e2d('0x45')]);_0x172bf3[_0x4e2d('0x2d')]=_[_0x4e2d('0x3e')](_0x3808e1[_0x4e2d('0x2d')]);_0x172bf3['filters']=_[_0x4e2d('0x2f')](_0x172bf3[_0x4e2d('0x2b')],_0x172bf3[_0x4e2d('0x2d')]);_0x256610[_0x4e2d('0x30')]=_[_0x4e2d('0x2f')](_0x172bf3['model'],qs[_0x4e2d('0x31')](_0x3808e1[_0x4e2d('0x2d')][_0x4e2d('0x31')]));_0x256610['attributes']=_0x256610[_0x4e2d('0x30')][_0x4e2d('0x46')]?_0x256610[_0x4e2d('0x30')]:_0x172bf3[_0x4e2d('0x2b')];_0x256610[_0x4e2d('0x47')]=qs['sort'](_0x3808e1['query'][_0x4e2d('0x34')]);_0x256610[_0x4e2d('0x35')]=qs['filters'](_[_0x4e2d('0x36')](_0x3808e1[_0x4e2d('0x2d')],_0x172bf3[_0x4e2d('0x2e')]));if(_0x3808e1['query'][_0x4e2d('0x39')]){_0x256610[_0x4e2d('0x35')]=_[_0x4e2d('0x37')](_0x256610[_0x4e2d('0x35')],{'$or':_[_0x4e2d('0x2c')](_0x256610[_0x4e2d('0x30')],function(_0x1338e2){var _0xdce3f2={};_0xdce3f2[_0x1338e2]={'$like':'%'+_0x3808e1['query'][_0x4e2d('0x39')]+'%'};return _0xdce3f2;})});}_0x256610=_[_0x4e2d('0x37')]({},_0x256610,_0x3808e1[_0x4e2d('0x48')]);return _0x435c96['getSubjects'](_0x256610);}})[_0x4e2d('0x23')](function(_0x351acc){if(_0x351acc){_0x30dad4=_0x351acc[_0x4e2d('0x46')];if(!_0x3808e1[_0x4e2d('0x2d')][_0x4e2d('0x32')]('nolimit')){_0x256610[_0x4e2d('0x1c')]=qs[_0x4e2d('0x1c')](_0x3808e1[_0x4e2d('0x2d')][_0x4e2d('0x1c')]);_0x256610[_0x4e2d('0x1a')]=qs['offset'](_0x3808e1[_0x4e2d('0x2d')]['offset']);}return _0x435c96[_0x4e2d('0x49')](_0x256610);}})[_0x4e2d('0x23')](function(_0x4264af){if(_0x4264af){return _0x4264af?{'count':_0x30dad4,'rows':_0x4264af}:null;}})[_0x4e2d('0x23')](respondWithResult(_0x23cf95,null))['catch'](handleError(_0x23cf95,null));};exports[_0x4e2d('0x4b')]=function(_0x4e3f8b,_0x2a8072,_0x26dc41){var _0x19b6d4={};var _0x517a38={};var _0x912443;var _0x53de7b;return db[_0x4e2d('0x28')]['findOne']({'where':{'id':_0x4e3f8b[_0x4e2d('0x43')]['id']}})['then'](handleEntityNotFound(_0x2a8072,null))[_0x4e2d('0x23')](function(_0x18492c){if(_0x18492c){_0x912443=_0x18492c;_0x517a38[_0x4e2d('0x2b')]=_['keys'](db[_0x4e2d('0x4a')][_0x4e2d('0x45')]);_0x517a38[_0x4e2d('0x2d')]=_[_0x4e2d('0x3e')](_0x4e3f8b['query']);_0x517a38[_0x4e2d('0x2e')]=_[_0x4e2d('0x2f')](_0x517a38[_0x4e2d('0x2b')],_0x517a38[_0x4e2d('0x2d')]);_0x19b6d4[_0x4e2d('0x30')]=_[_0x4e2d('0x2f')](_0x517a38[_0x4e2d('0x2b')],qs[_0x4e2d('0x31')](_0x4e3f8b[_0x4e2d('0x2d')][_0x4e2d('0x31')]));_0x19b6d4[_0x4e2d('0x30')]=_0x19b6d4[_0x4e2d('0x30')][_0x4e2d('0x46')]?_0x19b6d4[_0x4e2d('0x30')]:_0x517a38['model'];_0x19b6d4[_0x4e2d('0x47')]=qs[_0x4e2d('0x34')](_0x4e3f8b[_0x4e2d('0x2d')][_0x4e2d('0x34')]);_0x19b6d4[_0x4e2d('0x35')]=qs['filters'](_[_0x4e2d('0x36')](_0x4e3f8b[_0x4e2d('0x2d')],_0x517a38[_0x4e2d('0x2e')]));if(_0x4e3f8b['query'][_0x4e2d('0x39')]){_0x19b6d4['where']=_['merge'](_0x19b6d4[_0x4e2d('0x35')],{'$or':_[_0x4e2d('0x2c')](_0x19b6d4[_0x4e2d('0x30')],function(_0x47b9c5){var _0x421219={};_0x421219[_0x47b9c5]={'$like':'%'+_0x4e3f8b[_0x4e2d('0x2d')]['filter']+'%'};return _0x421219;})});}_0x19b6d4=_[_0x4e2d('0x37')]({},_0x19b6d4,_0x4e3f8b[_0x4e2d('0x48')]);return _0x912443[_0x4e2d('0x4b')](_0x19b6d4);}})[_0x4e2d('0x23')](function(_0x2acfbb){if(_0x2acfbb){_0x53de7b=_0x2acfbb[_0x4e2d('0x46')];if(!_0x4e3f8b['query'][_0x4e2d('0x32')](_0x4e2d('0x33'))){_0x19b6d4[_0x4e2d('0x1c')]=qs[_0x4e2d('0x1c')](_0x4e3f8b[_0x4e2d('0x2d')][_0x4e2d('0x1c')]);_0x19b6d4[_0x4e2d('0x1a')]=qs['offset'](_0x4e3f8b[_0x4e2d('0x2d')][_0x4e2d('0x1a')]);}return _0x912443[_0x4e2d('0x4b')](_0x19b6d4);}})['then'](function(_0x56bc46){if(_0x56bc46){return _0x56bc46?{'count':_0x53de7b,'rows':_0x56bc46}:null;}})[_0x4e2d('0x23')](respondWithResult(_0x2a8072,null))[_0x4e2d('0x3d')](handleError(_0x2a8072,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 08cd4a8..f496b51 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 _0x32c1=['exports','define','VtigerConfiguration','int_vtiger_configurations','moment','bluebird','path','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0x101ccf,_0x37e172){var _0x99b0f1=function(_0x4111c8){while(--_0x4111c8){_0x101ccf['push'](_0x101ccf['shift']());}};_0x99b0f1(++_0x37e172);}(_0x32c1,0x1ab));var _0x132c=function(_0x486f78,_0x2de315){_0x486f78=_0x486f78-0x0;var _0x1fb5ea=_0x32c1[_0x486f78];return _0x1fb5ea;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x132c('0x0'));var BPromise=require(_0x132c('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x132c('0x2'));var rimraf=require('rimraf');var config=require(_0x132c('0x3'));var attributes=require(_0x132c('0x4'));module[_0x132c('0x5')]=function(_0x41663c,_0x6ddca7){return _0x41663c[_0x132c('0x6')](_0x132c('0x7'),attributes,{'tableName':_0x132c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x605b=['int_vtiger_configurations','lodash','api','moment','path','rimraf','./intVtigerConfiguration.attributes','define','VtigerConfiguration'];(function(_0xdac678,_0x5d1714){var _0x92c2fe=function(_0x1108c5){while(--_0x1108c5){_0xdac678['push'](_0xdac678['shift']());}};_0x92c2fe(++_0x5d1714);}(_0x605b,0x7f));var _0xb605=function(_0x376238,_0x697233){_0x376238=_0x376238-0x0;var _0xcd59b9=_0x605b[_0x376238];return _0xcd59b9;};'use strict';var _=require(_0xb605('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb605('0x1'));var moment=require(_0xb605('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb605('0x3'));var rimraf=require(_0xb605('0x4'));var config=require('../../config/environment');var attributes=require(_0xb605('0x5'));module['exports']=function(_0x225069,_0x4851b6){return _0x225069[_0xb605('0x6')](_0xb605('0x7'),attributes,{'tableName':_0xb605('0x8'),'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 77839d9..a7332e8 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 _0xbd45=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x371b29,_0x2d33ed){var _0x434d79=function(_0x3966cf){while(--_0x3966cf){_0x371b29['push'](_0x371b29['shift']());}};_0x434d79(++_0x2d33ed);}(_0xbd45,0x187));var _0x5bd4=function(_0x1235a7,_0x422881){_0x1235a7=_0x1235a7-0x0;var _0x3e7f04=_0xbd45[_0x1235a7];return _0x3e7f04;};'use strict';var _=require(_0x5bd4('0x0'));var util=require(_0x5bd4('0x1'));var moment=require(_0x5bd4('0x2'));var BPromise=require('bluebird');var rs=require(_0x5bd4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5bd4('0x4'))['db'];var utils=require(_0x5bd4('0x5'));var logger=require(_0x5bd4('0x6'))(_0x5bd4('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5bd4('0x8')][_0x5bd4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ea1e7,_0x46bc9f,_0x5f52ca){return new BPromise(function(_0x5c1291,_0x2bcb3c){return client[_0x5bd4('0xa')](_0x5ea1e7,_0x5f52ca)[_0x5bd4('0xb')](function(_0x55ff54){logger['info'](_0x5bd4('0xc'),_0x46bc9f,_0x5bd4('0xd'));logger[_0x5bd4('0xe')](_0x5bd4('0xf'),_0x46bc9f,_0x5bd4('0xd'),JSON[_0x5bd4('0x10')](_0x55ff54));if(_0x55ff54[_0x5bd4('0x11')]){if(_0x55ff54[_0x5bd4('0x11')][_0x5bd4('0x12')]===0x1f4){logger[_0x5bd4('0x11')](_0x5bd4('0xc'),_0x46bc9f,_0x55ff54[_0x5bd4('0x11')][_0x5bd4('0x13')]);return _0x2bcb3c(_0x55ff54[_0x5bd4('0x11')][_0x5bd4('0x13')]);}logger[_0x5bd4('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x46bc9f,_0x55ff54[_0x5bd4('0x11')][_0x5bd4('0x13')]);return _0x5c1291(_0x55ff54[_0x5bd4('0x11')]['message']);}else{logger[_0x5bd4('0x14')](_0x5bd4('0xc'),_0x46bc9f,_0x5bd4('0xd'));_0x5c1291(_0x55ff54[_0x5bd4('0x15')][_0x5bd4('0x13')]);}})[_0x5bd4('0x16')](function(_0x14cc0c){logger[_0x5bd4('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x46bc9f,_0x14cc0c);_0x2bcb3c(_0x14cc0c);});});} \ No newline at end of file +var _0xdeab=['rpc','../../config/environment','http','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x5ed4c2,_0x58b5a2){var _0x1740e0=function(_0x14d475){while(--_0x14d475){_0x5ed4c2['push'](_0x5ed4c2['shift']());}};_0x1740e0(++_0x58b5a2);}(_0xdeab,0x158));var _0xbdea=function(_0x52ddf5,_0x865610){_0x52ddf5=_0x52ddf5-0x0;var _0x2e1d65=_0xdeab[_0x52ddf5];return _0x2e1d65;};'use strict';var _=require(_0xbdea('0x0'));var util=require(_0xbdea('0x1'));var moment=require(_0xbdea('0x2'));var BPromise=require(_0xbdea('0x3'));var rs=require(_0xbdea('0x4'));var fs=require('fs');var Redis=require(_0xbdea('0x5'));var db=require(_0xbdea('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbdea('0x7'))(_0xbdea('0x8'));var config=require(_0xbdea('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbdea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20d18b,_0x26befb,_0x2c37dc){return new BPromise(function(_0x47ab10,_0x42df1a){return client[_0xbdea('0xb')](_0x20d18b,_0x2c37dc)[_0xbdea('0xc')](function(_0x5898de){logger['info'](_0xbdea('0xd'),_0x26befb,_0xbdea('0xe'));logger[_0xbdea('0xf')](_0xbdea('0x10'),_0x26befb,'request\x20sent',JSON[_0xbdea('0x11')](_0x5898de));if(_0x5898de['error']){if(_0x5898de[_0xbdea('0x12')]['code']===0x1f4){logger[_0xbdea('0x12')](_0xbdea('0xd'),_0x26befb,_0x5898de[_0xbdea('0x12')][_0xbdea('0x13')]);return _0x42df1a(_0x5898de[_0xbdea('0x12')]['message']);}logger[_0xbdea('0x12')](_0xbdea('0xd'),_0x26befb,_0x5898de[_0xbdea('0x12')][_0xbdea('0x13')]);return _0x47ab10(_0x5898de[_0xbdea('0x12')][_0xbdea('0x13')]);}else{logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x26befb,_0xbdea('0xe'));_0x47ab10(_0x5898de[_0xbdea('0x14')][_0xbdea('0x13')]);}})[_0xbdea('0x15')](function(_0x30a4fb){logger['error'](_0xbdea('0xd'),_0x26befb,_0x30a4fb);_0x42df1a(_0x30a4fb);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index cb3131a..c36838d 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 _0x6416=['delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','create','put'];(function(_0x183acf,_0x20a500){var _0x52453c=function(_0x3c36ec){while(--_0x3c36ec){_0x183acf['push'](_0x183acf['shift']());}};_0x52453c(++_0x20a500);}(_0x6416,0x1b1));var _0x6641=function(_0x4a258d,_0x30f281){_0x4a258d=_0x4a258d-0x0;var _0x104963=_0x6416[_0x4a258d];return _0x104963;};'use strict';var multer=require(_0x6641('0x0'));var util=require(_0x6641('0x1'));var path=require(_0x6641('0x2'));var timeout=require(_0x6641('0x3'));var express=require(_0x6641('0x4'));var router=express[_0x6641('0x5')]();var fs_extra=require(_0x6641('0x6'));var auth=require(_0x6641('0x7'));var interaction=require(_0x6641('0x8'));var config=require('../../config/environment');var controller=require(_0x6641('0x9'));router[_0x6641('0xa')]('/',auth[_0x6641('0xb')](),controller[_0x6641('0xc')]);router[_0x6641('0xa')](_0x6641('0xd'),auth[_0x6641('0xb')](),controller[_0x6641('0xe')]);router['post']('/',auth[_0x6641('0xb')](),controller[_0x6641('0xf')]);router[_0x6641('0x10')]('/:id',auth[_0x6641('0xb')](),controller['update']);router[_0x6641('0x11')](_0x6641('0xd'),auth[_0x6641('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7523=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','index','/:id','isAuthenticated','post','put','delete','destroy','exports','multer','util'];(function(_0x1052eb,_0x1f6f80){var _0x1459b0=function(_0x28f5e3){while(--_0x28f5e3){_0x1052eb['push'](_0x1052eb['shift']());}};_0x1459b0(++_0x1f6f80);}(_0x7523,0x17a));var _0x3752=function(_0x169040,_0x1081db){_0x169040=_0x169040-0x0;var _0x1d3ceb=_0x7523[_0x169040];return _0x1d3ceb;};'use strict';var multer=require(_0x3752('0x0'));var util=require(_0x3752('0x1'));var path=require(_0x3752('0x2'));var timeout=require(_0x3752('0x3'));var express=require(_0x3752('0x4'));var router=express[_0x3752('0x5')]();var fs_extra=require(_0x3752('0x6'));var auth=require(_0x3752('0x7'));var interaction=require(_0x3752('0x8'));var config=require(_0x3752('0x9'));var controller=require(_0x3752('0xa'));router[_0x3752('0xb')]('/',auth['isAuthenticated'](),controller[_0x3752('0xc')]);router[_0x3752('0xb')](_0x3752('0xd'),auth[_0x3752('0xe')](),controller['show']);router[_0x3752('0xf')]('/',auth[_0x3752('0xe')](),controller['create']);router[_0x3752('0x10')]('/:id',auth[_0x3752('0xe')](),controller['update']);router[_0x3752('0x11')](_0x3752('0xd'),auth[_0x3752('0xe')](),controller[_0x3752('0x12')]);module[_0x3752('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 49e547b..c577bc7 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 _0x5a48=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x139c39,_0xc46751){var _0xdb9b55=function(_0x34e0d0){while(--_0x34e0d0){_0x139c39['push'](_0x139c39['shift']());}};_0xdb9b55(++_0xc46751);}(_0x5a48,0x64));var _0x85a4=function(_0x5837b1,_0x54229a){_0x5837b1=_0x5837b1-0x0;var _0x490d8b=_0x5a48[_0x5837b1];return _0x490d8b;};'use strict';var Sequelize=require(_0x85a4('0x0'));module[_0x85a4('0x1')]={'type':{'type':Sequelize[_0x85a4('0x2')](_0x85a4('0x3'),_0x85a4('0x4'),_0x85a4('0x5'),_0x85a4('0x6'),_0x85a4('0x7')),'defaultValue':_0x85a4('0x3')},'content':{'type':Sequelize[_0x85a4('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x85a4('0x2')](_0x85a4('0x3'),_0x85a4('0x4'),_0x85a4('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x85a4('0x8')]},'nameField':{'type':Sequelize[_0x85a4('0x8')]},'customField':{'type':Sequelize[_0x85a4('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x85a4('0x8')]}}; \ No newline at end of file +var _0x0cc0=['variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x0cc0,0x1d3));var _0x00cc=function(_0x5ed592,_0x33e0b9){_0x5ed592=_0x5ed592-0x0;var _0x2fefd0=_0x0cc0[_0x5ed592];return _0x2fefd0;};'use strict';var Sequelize=require(_0x00cc('0x0'));module[_0x00cc('0x1')]={'type':{'type':Sequelize[_0x00cc('0x2')]('string',_0x00cc('0x3'),_0x00cc('0x4'),_0x00cc('0x5'),_0x00cc('0x6')),'defaultValue':_0x00cc('0x7')},'content':{'type':Sequelize[_0x00cc('0x8')]},'key':{'type':Sequelize[_0x00cc('0x8')]},'keyType':{'type':Sequelize[_0x00cc('0x2')](_0x00cc('0x7'),'variable',_0x00cc('0x4'))},'keyContent':{'type':Sequelize[_0x00cc('0x8')]},'idField':{'type':Sequelize[_0x00cc('0x8')]},'nameField':{'type':Sequelize[_0x00cc('0x8')]},'customField':{'type':Sequelize[_0x00cc('0x9')],'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 19bba87..3736103 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 _0xa51e=['json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','error','stack','name','send','index','map','VtigerField','rawAttributes','type','key','query','keys','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','then','catch','show','params','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end'];(function(_0x389948,_0x579e7d){var _0x127ffa=function(_0x459e1d){while(--_0x459e1d){_0x389948['push'](_0x389948['shift']());}};_0x127ffa(++_0x579e7d);}(_0xa51e,0x1f3));var _0xea51=function(_0x40d722,_0x5ab18c){_0x40d722=_0x40d722-0x0;var _0x232ffa=_0xa51e[_0x40d722];return _0x232ffa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xea51('0x0'));var zipdir=require(_0xea51('0x1'));var jsonpatch=require(_0xea51('0x2'));var rp=require(_0xea51('0x3'));var moment=require(_0xea51('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xea51('0x5'));var util=require('util');var path=require(_0xea51('0x6'));var sox=require('sox');var csv=require(_0xea51('0x7'));var ejs=require(_0xea51('0x8'));var fs=require('fs');var fs_extra=require(_0xea51('0x9'));var _=require(_0xea51('0xa'));var squel=require('squel');var crypto=require(_0xea51('0xb'));var jsforce=require(_0xea51('0xc'));var deskjs=require(_0xea51('0xd'));var toCsv=require(_0xea51('0x7'));var querystring=require(_0xea51('0xe'));var Papa=require(_0xea51('0xf'));var Redis=require(_0xea51('0x10'));var authService=require(_0xea51('0x11'));var qs=require(_0xea51('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xea51('0x13'));var logger=require('../../config/logger')(_0xea51('0x14'));var utils=require(_0xea51('0x15'));var config=require(_0xea51('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xea51('0x17'))['db'];function respondWithStatusCode(_0x5f04ae,_0x49405d){_0x49405d=_0x49405d||0xcc;return function(_0x4d6378){if(_0x4d6378){return _0x5f04ae['sendStatus'](_0x49405d);}return _0x5f04ae[_0xea51('0x18')](_0x49405d)[_0xea51('0x19')]();};}function respondWithResult(_0x126b1f,_0x24df7a){_0x24df7a=_0x24df7a||0xc8;return function(_0x2f8c89){if(_0x2f8c89){return _0x126b1f[_0xea51('0x18')](_0x24df7a)[_0xea51('0x1a')](_0x2f8c89);}};}function respondWithFilteredResult(_0x27f631,_0x2ccbd5){return function(_0x1e9934){if(_0x1e9934){var _0x5d9c91=typeof _0x2ccbd5[_0xea51('0x1b')]===_0xea51('0x1c')&&typeof _0x2ccbd5[_0xea51('0x1d')]==='undefined';var _0x4e9f0b=_0x1e9934['count'];var _0x52d5f8=_0x5d9c91?0x0:_0x2ccbd5[_0xea51('0x1b')];var _0x1b3723=_0x5d9c91?_0x1e9934[_0xea51('0x1e')]:_0x2ccbd5[_0xea51('0x1b')]+_0x2ccbd5[_0xea51('0x1d')];var _0xd34971;if(_0x1b3723>=_0x4e9f0b){_0x1b3723=_0x4e9f0b;_0xd34971=0xc8;}else{_0xd34971=0xce;}_0x27f631['status'](_0xd34971);return _0x27f631[_0xea51('0x1f')](_0xea51('0x20'),_0x52d5f8+'-'+_0x1b3723+'/'+_0x4e9f0b)[_0xea51('0x1a')](_0x1e9934);}return null;};}function patchUpdates(_0x21cebe){return function(_0x518f24){try{jsonpatch[_0xea51('0x21')](_0x518f24,_0x21cebe,!![]);}catch(_0x9d3e25){return BPromise['reject'](_0x9d3e25);}return _0x518f24[_0xea51('0x22')]();};}function saveUpdates(_0x28f7f3,_0xb2ddb9){return function(_0x1e63e0){if(_0x1e63e0){return _0x1e63e0[_0xea51('0x23')](_0x28f7f3)['then'](function(_0x88f0cb){return _0x88f0cb;});}return null;};}function removeEntity(_0x31ca56,_0x3416a8){return function(_0x3dc20f){if(_0x3dc20f){return _0x3dc20f[_0xea51('0x24')]()['then'](function(){_0x31ca56[_0xea51('0x18')](0xcc)[_0xea51('0x19')]();});}};}function handleEntityNotFound(_0x593e19,_0x32be68){return function(_0x98cc80){if(!_0x98cc80){_0x593e19['sendStatus'](0x194);}return _0x98cc80;};}function handleError(_0x3ba5ce,_0x21587e){_0x21587e=_0x21587e||0x1f4;return function(_0x1dca11){logger[_0xea51('0x25')](_0x1dca11[_0xea51('0x26')]);if(_0x1dca11['name']){delete _0x1dca11[_0xea51('0x27')];}_0x3ba5ce[_0xea51('0x18')](_0x21587e)[_0xea51('0x28')](_0x1dca11);};}exports[_0xea51('0x29')]=function(_0x53900f,_0xff586a){var _0x4e112b={},_0x24181c={},_0x38d0f4={'count':0x0,'rows':[]};var _0x205f82=_[_0xea51('0x2a')](db[_0xea51('0x2b')][_0xea51('0x2c')],function(_0x517df3){return{'name':_0x517df3['fieldName'],'type':_0x517df3[_0xea51('0x2d')][_0xea51('0x2e')]};});_0x24181c['model']=_[_0xea51('0x2a')](_0x205f82,_0xea51('0x27'));_0x24181c[_0xea51('0x2f')]=_[_0xea51('0x30')](_0x53900f[_0xea51('0x2f')]);_0x24181c[_0xea51('0x31')]=_['intersection'](_0x24181c['model'],_0x24181c[_0xea51('0x2f')]);_0x4e112b[_0xea51('0x32')]=_[_0xea51('0x33')](_0x24181c[_0xea51('0x34')],qs[_0xea51('0x35')](_0x53900f[_0xea51('0x2f')][_0xea51('0x35')]));_0x4e112b[_0xea51('0x32')]=_0x4e112b[_0xea51('0x32')]['length']?_0x4e112b[_0xea51('0x32')]:_0x24181c['model'];if(!_0x53900f[_0xea51('0x2f')][_0xea51('0x36')](_0xea51('0x37'))){_0x4e112b[_0xea51('0x1d')]=qs['limit'](_0x53900f[_0xea51('0x2f')][_0xea51('0x1d')]);_0x4e112b[_0xea51('0x1b')]=qs[_0xea51('0x1b')](_0x53900f[_0xea51('0x2f')][_0xea51('0x1b')]);}_0x4e112b[_0xea51('0x38')]=qs[_0xea51('0x39')](_0x53900f[_0xea51('0x2f')][_0xea51('0x39')]);_0x4e112b[_0xea51('0x3a')]=qs[_0xea51('0x31')](_[_0xea51('0x3b')](_0x53900f[_0xea51('0x2f')],_0x24181c[_0xea51('0x31')]),_0x205f82);if(_0x53900f[_0xea51('0x2f')][_0xea51('0x3c')]){_0x4e112b[_0xea51('0x3a')]=_['merge'](_0x4e112b[_0xea51('0x3a')],{'$or':_[_0xea51('0x2a')](_0x205f82,function(_0x4996d8){if(_0x4996d8[_0xea51('0x2d')]!==_0xea51('0x3d')){var _0x3c9d46={};_0x3c9d46[_0x4996d8[_0xea51('0x27')]]={'$like':'%'+_0x53900f['query'][_0xea51('0x3c')]+'%'};return _0x3c9d46;}})});}_0x4e112b=_[_0xea51('0x3e')]({},_0x4e112b,_0x53900f[_0xea51('0x3f')]);var _0x978d8b={'where':_0x4e112b[_0xea51('0x3a')]};return db[_0xea51('0x2b')][_0xea51('0x1e')](_0x978d8b)['then'](function(_0x176a72){_0x38d0f4[_0xea51('0x1e')]=_0x176a72;if(_0x53900f[_0xea51('0x2f')][_0xea51('0x40')]){_0x4e112b[_0xea51('0x41')]=[{'all':!![]}];}return db[_0xea51('0x2b')][_0xea51('0x42')](_0x4e112b);})['then'](function(_0x290f8d){_0x38d0f4[_0xea51('0x43')]=_0x290f8d;return _0x38d0f4;})[_0xea51('0x44')](respondWithFilteredResult(_0xff586a,_0x4e112b))[_0xea51('0x45')](handleError(_0xff586a,null));};exports[_0xea51('0x46')]=function(_0x272b78,_0x558358){var _0x4967e2={'raw':!![],'where':{'id':_0x272b78[_0xea51('0x47')]['id']}},_0x2354b5={};_0x2354b5[_0xea51('0x34')]=_[_0xea51('0x30')](db['VtigerField']['rawAttributes']);_0x2354b5['query']=_[_0xea51('0x30')](_0x272b78[_0xea51('0x2f')]);_0x2354b5[_0xea51('0x31')]=_['intersection'](_0x2354b5[_0xea51('0x34')],_0x2354b5[_0xea51('0x2f')]);_0x4967e2[_0xea51('0x32')]=_[_0xea51('0x33')](_0x2354b5[_0xea51('0x34')],qs['fields'](_0x272b78[_0xea51('0x2f')][_0xea51('0x35')]));_0x4967e2['attributes']=_0x4967e2[_0xea51('0x32')]['length']?_0x4967e2[_0xea51('0x32')]:_0x2354b5[_0xea51('0x34')];if(_0x272b78[_0xea51('0x2f')]['includeAll']){_0x4967e2[_0xea51('0x41')]=[{'all':!![]}];}_0x4967e2=_[_0xea51('0x3e')]({},_0x4967e2,_0x272b78[_0xea51('0x3f')]);return db[_0xea51('0x2b')]['find'](_0x4967e2)[_0xea51('0x44')](handleEntityNotFound(_0x558358,null))[_0xea51('0x44')](respondWithResult(_0x558358,null))['catch'](handleError(_0x558358,null));};exports['create']=function(_0x900705,_0x201557){return db[_0xea51('0x2b')][_0xea51('0x48')](_0x900705[_0xea51('0x49')],{})[_0xea51('0x44')](respondWithResult(_0x201557,0xc9))[_0xea51('0x45')](handleError(_0x201557,null));};exports[_0xea51('0x23')]=function(_0x10035f,_0x413e66){if(_0x10035f['body']['id']){delete _0x10035f['body']['id'];}return db[_0xea51('0x2b')][_0xea51('0x4a')]({'where':{'id':_0x10035f['params']['id']}})['then'](handleEntityNotFound(_0x413e66,null))[_0xea51('0x44')](saveUpdates(_0x10035f['body'],null))[_0xea51('0x44')](respondWithResult(_0x413e66,null))[_0xea51('0x45')](handleError(_0x413e66,null));};exports['destroy']=function(_0x358d90,_0x5ac151){return db['VtigerField'][_0xea51('0x4a')]({'where':{'id':_0x358d90[_0xea51('0x47')]['id']}})[_0xea51('0x44')](handleEntityNotFound(_0x5ac151,null))[_0xea51('0x44')](removeEntity(_0x5ac151,null))['catch'](handleError(_0x5ac151,null));}; \ No newline at end of file +var _0xabed=['query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','rows','catch','show','params','keys','find','create','body','update','eml-format','rimraf','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../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','then','destroy','name','index','map','VtigerField','rawAttributes','fieldName','type','key'];(function(_0x50b55e,_0x2e7254){var _0x2838e4=function(_0x57af82){while(--_0x57af82){_0x50b55e['push'](_0x50b55e['shift']());}};_0x2838e4(++_0x2e7254);}(_0xabed,0xa4));var _0xdabe=function(_0xd0a847,_0x72562b){_0xd0a847=_0xd0a847-0x0;var _0x2536ec=_0xabed[_0xd0a847];return _0x2536ec;};'use strict';var emlformat=require(_0xdabe('0x0'));var rimraf=require(_0xdabe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdabe('0x2'));var moment=require(_0xdabe('0x3'));var BPromise=require(_0xdabe('0x4'));var Mustache=require(_0xdabe('0x5'));var util=require('util');var path=require('path');var sox=require(_0xdabe('0x6'));var csv=require(_0xdabe('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdabe('0x8'));var squel=require(_0xdabe('0x9'));var crypto=require(_0xdabe('0xa'));var jsforce=require(_0xdabe('0xb'));var deskjs=require(_0xdabe('0xc'));var toCsv=require(_0xdabe('0x7'));var querystring=require('querystring');var Papa=require(_0xdabe('0xd'));var Redis=require(_0xdabe('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdabe('0xf'));var hardwareService=require(_0xdabe('0x10'));var logger=require('../../config/logger')(_0xdabe('0x11'));var utils=require(_0xdabe('0x12'));var config=require(_0xdabe('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xdabe('0x14'))['db'];function respondWithStatusCode(_0x3ebcfc,_0x4a6952){_0x4a6952=_0x4a6952||0xcc;return function(_0x3c5d20){if(_0x3c5d20){return _0x3ebcfc[_0xdabe('0x15')](_0x4a6952);}return _0x3ebcfc[_0xdabe('0x16')](_0x4a6952)[_0xdabe('0x17')]();};}function respondWithResult(_0x5e51c0,_0xc9f4ec){_0xc9f4ec=_0xc9f4ec||0xc8;return function(_0x43dca4){if(_0x43dca4){return _0x5e51c0[_0xdabe('0x16')](_0xc9f4ec)[_0xdabe('0x18')](_0x43dca4);}};}function respondWithFilteredResult(_0x1d142d,_0x156172){return function(_0x582b5f){if(_0x582b5f){var _0x4aa73c=typeof _0x156172[_0xdabe('0x19')]===_0xdabe('0x1a')&&typeof _0x156172[_0xdabe('0x1b')]===_0xdabe('0x1a');var _0x293e58=_0x582b5f[_0xdabe('0x1c')];var _0x28c444=_0x4aa73c?0x0:_0x156172[_0xdabe('0x19')];var _0x20fe11=_0x4aa73c?_0x582b5f[_0xdabe('0x1c')]:_0x156172['offset']+_0x156172[_0xdabe('0x1b')];var _0x268565;if(_0x20fe11>=_0x293e58){_0x20fe11=_0x293e58;_0x268565=0xc8;}else{_0x268565=0xce;}_0x1d142d[_0xdabe('0x16')](_0x268565);return _0x1d142d[_0xdabe('0x1d')](_0xdabe('0x1e'),_0x28c444+'-'+_0x20fe11+'/'+_0x293e58)[_0xdabe('0x18')](_0x582b5f);}return null;};}function patchUpdates(_0x5c5879){return function(_0x395d97){try{jsonpatch[_0xdabe('0x1f')](_0x395d97,_0x5c5879,!![]);}catch(_0xf8ca83){return BPromise[_0xdabe('0x20')](_0xf8ca83);}return _0x395d97['save']();};}function saveUpdates(_0x2883ff,_0x5f0a06){return function(_0x1ff0e9){if(_0x1ff0e9){return _0x1ff0e9['update'](_0x2883ff)[_0xdabe('0x21')](function(_0x1ca4fe){return _0x1ca4fe;});}return null;};}function removeEntity(_0x30eb95,_0x1431cf){return function(_0x3c235b){if(_0x3c235b){return _0x3c235b[_0xdabe('0x22')]()[_0xdabe('0x21')](function(){_0x30eb95[_0xdabe('0x16')](0xcc)[_0xdabe('0x17')]();});}};}function handleEntityNotFound(_0x4b94ad,_0x1c2bd8){return function(_0x339638){if(!_0x339638){_0x4b94ad[_0xdabe('0x15')](0x194);}return _0x339638;};}function handleError(_0x545bcb,_0x5aafb4){_0x5aafb4=_0x5aafb4||0x1f4;return function(_0x3a585c){logger['error'](_0x3a585c['stack']);if(_0x3a585c[_0xdabe('0x23')]){delete _0x3a585c['name'];}_0x545bcb[_0xdabe('0x16')](_0x5aafb4)['send'](_0x3a585c);};}exports[_0xdabe('0x24')]=function(_0xf06155,_0xf1cd89){var _0x44e14c={},_0x13eddd={},_0x10ecf5={'count':0x0,'rows':[]};var _0x4bac16=_[_0xdabe('0x25')](db[_0xdabe('0x26')][_0xdabe('0x27')],function(_0x27459f){return{'name':_0x27459f[_0xdabe('0x28')],'type':_0x27459f[_0xdabe('0x29')][_0xdabe('0x2a')]};});_0x13eddd['model']=_['map'](_0x4bac16,_0xdabe('0x23'));_0x13eddd[_0xdabe('0x2b')]=_['keys'](_0xf06155[_0xdabe('0x2b')]);_0x13eddd[_0xdabe('0x2c')]=_[_0xdabe('0x2d')](_0x13eddd[_0xdabe('0x2e')],_0x13eddd[_0xdabe('0x2b')]);_0x44e14c[_0xdabe('0x2f')]=_['intersection'](_0x13eddd[_0xdabe('0x2e')],qs[_0xdabe('0x30')](_0xf06155[_0xdabe('0x2b')][_0xdabe('0x30')]));_0x44e14c[_0xdabe('0x2f')]=_0x44e14c[_0xdabe('0x2f')]['length']?_0x44e14c[_0xdabe('0x2f')]:_0x13eddd[_0xdabe('0x2e')];if(!_0xf06155['query'][_0xdabe('0x31')](_0xdabe('0x32'))){_0x44e14c[_0xdabe('0x1b')]=qs[_0xdabe('0x1b')](_0xf06155['query'][_0xdabe('0x1b')]);_0x44e14c['offset']=qs[_0xdabe('0x19')](_0xf06155[_0xdabe('0x2b')][_0xdabe('0x19')]);}_0x44e14c[_0xdabe('0x33')]=qs[_0xdabe('0x34')](_0xf06155[_0xdabe('0x2b')][_0xdabe('0x34')]);_0x44e14c[_0xdabe('0x35')]=qs['filters'](_[_0xdabe('0x36')](_0xf06155[_0xdabe('0x2b')],_0x13eddd['filters']),_0x4bac16);if(_0xf06155[_0xdabe('0x2b')]['filter']){_0x44e14c[_0xdabe('0x35')]=_[_0xdabe('0x37')](_0x44e14c[_0xdabe('0x35')],{'$or':_[_0xdabe('0x25')](_0x4bac16,function(_0x2cc5f5){if(_0x2cc5f5['type']!=='VIRTUAL'){var _0x3ffa53={};_0x3ffa53[_0x2cc5f5[_0xdabe('0x23')]]={'$like':'%'+_0xf06155[_0xdabe('0x2b')][_0xdabe('0x38')]+'%'};return _0x3ffa53;}})});}_0x44e14c=_[_0xdabe('0x37')]({},_0x44e14c,_0xf06155[_0xdabe('0x39')]);var _0x1dd13b={'where':_0x44e14c[_0xdabe('0x35')]};return db[_0xdabe('0x26')][_0xdabe('0x1c')](_0x1dd13b)['then'](function(_0x5bfcb8){_0x10ecf5[_0xdabe('0x1c')]=_0x5bfcb8;if(_0xf06155['query'][_0xdabe('0x3a')]){_0x44e14c[_0xdabe('0x3b')]=[{'all':!![]}];}return db[_0xdabe('0x26')]['findAll'](_0x44e14c);})[_0xdabe('0x21')](function(_0x35a29b){_0x10ecf5[_0xdabe('0x3c')]=_0x35a29b;return _0x10ecf5;})['then'](respondWithFilteredResult(_0xf1cd89,_0x44e14c))[_0xdabe('0x3d')](handleError(_0xf1cd89,null));};exports[_0xdabe('0x3e')]=function(_0x18bcd0,_0x292db4){var _0x569259={'raw':!![],'where':{'id':_0x18bcd0[_0xdabe('0x3f')]['id']}},_0x3a2484={};_0x3a2484[_0xdabe('0x2e')]=_[_0xdabe('0x40')](db['VtigerField'][_0xdabe('0x27')]);_0x3a2484[_0xdabe('0x2b')]=_[_0xdabe('0x40')](_0x18bcd0[_0xdabe('0x2b')]);_0x3a2484[_0xdabe('0x2c')]=_[_0xdabe('0x2d')](_0x3a2484[_0xdabe('0x2e')],_0x3a2484[_0xdabe('0x2b')]);_0x569259['attributes']=_[_0xdabe('0x2d')](_0x3a2484[_0xdabe('0x2e')],qs[_0xdabe('0x30')](_0x18bcd0[_0xdabe('0x2b')]['fields']));_0x569259['attributes']=_0x569259[_0xdabe('0x2f')]['length']?_0x569259[_0xdabe('0x2f')]:_0x3a2484[_0xdabe('0x2e')];if(_0x18bcd0[_0xdabe('0x2b')]['includeAll']){_0x569259[_0xdabe('0x3b')]=[{'all':!![]}];}_0x569259=_[_0xdabe('0x37')]({},_0x569259,_0x18bcd0[_0xdabe('0x39')]);return db[_0xdabe('0x26')][_0xdabe('0x41')](_0x569259)[_0xdabe('0x21')](handleEntityNotFound(_0x292db4,null))[_0xdabe('0x21')](respondWithResult(_0x292db4,null))[_0xdabe('0x3d')](handleError(_0x292db4,null));};exports[_0xdabe('0x42')]=function(_0xc227b0,_0x5bdf0d){return db[_0xdabe('0x26')]['create'](_0xc227b0[_0xdabe('0x43')],{})[_0xdabe('0x21')](respondWithResult(_0x5bdf0d,0xc9))[_0xdabe('0x3d')](handleError(_0x5bdf0d,null));};exports[_0xdabe('0x44')]=function(_0xb6655e,_0x71283){if(_0xb6655e['body']['id']){delete _0xb6655e[_0xdabe('0x43')]['id'];}return db[_0xdabe('0x26')]['find']({'where':{'id':_0xb6655e[_0xdabe('0x3f')]['id']}})['then'](handleEntityNotFound(_0x71283,null))['then'](saveUpdates(_0xb6655e[_0xdabe('0x43')],null))['then'](respondWithResult(_0x71283,null))['catch'](handleError(_0x71283,null));};exports[_0xdabe('0x22')]=function(_0x15397c,_0x120ed3){return db['VtigerField']['find']({'where':{'id':_0x15397c['params']['id']}})[_0xdabe('0x21')](handleEntityNotFound(_0x120ed3,null))[_0xdabe('0x21')](removeEntity(_0x120ed3,null))[_0xdabe('0x3d')](handleError(_0x120ed3,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 474f768..00011fb 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 _0xed92=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','../../config/logger'];(function(_0x46efd7,_0x43f84d){var _0x5637e4=function(_0x54e078){while(--_0x54e078){_0x46efd7['push'](_0x46efd7['shift']());}};_0x5637e4(++_0x43f84d);}(_0xed92,0xde));var _0x2ed9=function(_0x304482,_0x516d09){_0x304482=_0x304482-0x0;var _0x33bc4a=_0xed92[_0x304482];return _0x33bc4a;};'use strict';var _=require(_0x2ed9('0x0'));var util=require('util');var logger=require(_0x2ed9('0x1'))(_0x2ed9('0x2'));var moment=require(_0x2ed9('0x3'));var BPromise=require(_0x2ed9('0x4'));var rp=require(_0x2ed9('0x5'));var fs=require('fs');var path=require(_0x2ed9('0x6'));var rimraf=require(_0x2ed9('0x7'));var config=require(_0x2ed9('0x8'));var attributes=require(_0x2ed9('0x9'));module[_0x2ed9('0xa')]=function(_0x9ba93a,_0x58d44b){return _0x9ba93a[_0x2ed9('0xb')]('VtigerField',attributes,{'tableName':_0x2ed9('0xc'),'paranoid':![],'indexes':[{'name':_0x2ed9('0xd'),'fields':[_0x2ed9('0xe'),_0x2ed9('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4c07=['./intVtigerField.attributes','define','int_vtiger_fields','vtiger_unique_index','idField','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x17b618,_0x12975a){var _0x56d8a1=function(_0x2f4c97){while(--_0x2f4c97){_0x17b618['push'](_0x17b618['shift']());}};_0x56d8a1(++_0x12975a);}(_0x4c07,0x1a9));var _0x74c0=function(_0x421c56,_0x4efd00){_0x421c56=_0x421c56-0x0;var _0x49b244=_0x4c07[_0x421c56];return _0x49b244;};'use strict';var _=require(_0x74c0('0x0'));var util=require(_0x74c0('0x1'));var logger=require('../../config/logger')(_0x74c0('0x2'));var moment=require(_0x74c0('0x3'));var BPromise=require(_0x74c0('0x4'));var rp=require(_0x74c0('0x5'));var fs=require('fs');var path=require(_0x74c0('0x6'));var rimraf=require(_0x74c0('0x7'));var config=require(_0x74c0('0x8'));var attributes=require(_0x74c0('0x9'));module['exports']=function(_0x16b2b6,_0xc6a8a5){return _0x16b2b6[_0x74c0('0xa')]('VtigerField',attributes,{'tableName':_0x74c0('0xb'),'paranoid':![],'indexes':[{'name':_0x74c0('0xc'),'fields':[_0x74c0('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 1007686..f29d813 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 _0x517a=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','VtigerField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','util'];(function(_0x4e66e2,_0x34899d){var _0x338b70=function(_0x2b6de7){while(--_0x2b6de7){_0x4e66e2['push'](_0x4e66e2['shift']());}};_0x338b70(++_0x34899d);}(_0x517a,0xc5));var _0xa517=function(_0x78bee0,_0x497ec6){_0x78bee0=_0x78bee0-0x0;var _0x3543de=_0x517a[_0x78bee0];return _0x3543de;};'use strict';var _=require('lodash');var util=require(_0xa517('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa517('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa517('0x2'))['db'];var utils=require(_0xa517('0x3'));var logger=require('../../config/logger')(_0xa517('0x4'));var config=require(_0xa517('0x5'));var jayson=require(_0xa517('0x6'));var client=jayson[_0xa517('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20922e,_0x43509d,_0x3a75e6){return new BPromise(function(_0x51d195,_0x544795){return client['request'](_0x20922e,_0x3a75e6)[_0xa517('0x8')](function(_0x10d115){logger['info'](_0xa517('0x9'),_0x43509d,'request\x20sent');logger[_0xa517('0xa')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x43509d,_0xa517('0xb'),JSON[_0xa517('0xc')](_0x10d115));if(_0x10d115[_0xa517('0xd')]){if(_0x10d115['error']['code']===0x1f4){logger[_0xa517('0xd')](_0xa517('0x9'),_0x43509d,_0x10d115[_0xa517('0xd')]['message']);return _0x544795(_0x10d115[_0xa517('0xd')][_0xa517('0xe')]);}logger[_0xa517('0xd')](_0xa517('0x9'),_0x43509d,_0x10d115['error'][_0xa517('0xe')]);return _0x51d195(_0x10d115['error'][_0xa517('0xe')]);}else{logger[_0xa517('0xf')]('VtigerField,\x20%s,\x20%s',_0x43509d,'request\x20sent');_0x51d195(_0x10d115[_0xa517('0x10')][_0xa517('0xe')]);}})[_0xa517('0x11')](function(_0x59ae24){logger[_0xa517('0xd')](_0xa517('0x9'),_0x43509d,_0x59ae24);_0x544795(_0x59ae24);});});} \ No newline at end of file +var _0xa38d=['VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info'];(function(_0x34a2af,_0x2aecae){var _0x356993=function(_0x37027f){while(--_0x37027f){_0x34a2af['push'](_0x34a2af['shift']());}};_0x356993(++_0x2aecae);}(_0xa38d,0x122));var _0xda38=function(_0x1423a7,_0x278fa9){_0x1423a7=_0x1423a7-0x0;var _0x5854b9=_0xa38d[_0x1423a7];return _0x5854b9;};'use strict';var _=require(_0xda38('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda38('0x1'));var db=require(_0xda38('0x2'))['db'];var utils=require(_0xda38('0x3'));var logger=require('../../config/logger')(_0xda38('0x4'));var config=require('../../config/environment');var jayson=require(_0xda38('0x5'));var client=jayson[_0xda38('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f5bd2,_0x182621,_0x8b1587){return new BPromise(function(_0x24a6ac,_0x3345c3){return client[_0xda38('0x7')](_0x3f5bd2,_0x8b1587)[_0xda38('0x8')](function(_0x2552c1){logger[_0xda38('0x9')](_0xda38('0xa'),_0x182621,_0xda38('0xb'));logger[_0xda38('0xc')](_0xda38('0xd'),_0x182621,'request\x20sent',JSON[_0xda38('0xe')](_0x2552c1));if(_0x2552c1[_0xda38('0xf')]){if(_0x2552c1['error'][_0xda38('0x10')]===0x1f4){logger[_0xda38('0xf')](_0xda38('0xa'),_0x182621,_0x2552c1[_0xda38('0xf')][_0xda38('0x11')]);return _0x3345c3(_0x2552c1['error'][_0xda38('0x11')]);}logger[_0xda38('0xf')]('VtigerField,\x20%s,\x20%s',_0x182621,_0x2552c1[_0xda38('0xf')][_0xda38('0x11')]);return _0x24a6ac(_0x2552c1['error'][_0xda38('0x11')]);}else{logger['info'](_0xda38('0xa'),_0x182621,_0xda38('0xb'));_0x24a6ac(_0x2552c1[_0xda38('0x12')][_0xda38('0x11')]);}})[_0xda38('0x13')](function(_0x57e2bf){logger[_0xda38('0xf')](_0xda38('0xa'),_0x182621,_0x57e2bf);_0x3345c3(_0x57e2bf);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index e9f545c..dbf76f4 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 _0x81c9=['update','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put'];(function(_0x52b15d,_0x111cb9){var _0x3f4bce=function(_0x3e528f){while(--_0x3e528f){_0x52b15d['push'](_0x52b15d['shift']());}};_0x3f4bce(++_0x111cb9);}(_0x81c9,0x188));var _0x981c=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x81c9[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0x981c('0x0'));var util=require(_0x981c('0x1'));var path=require(_0x981c('0x2'));var timeout=require('connect-timeout');var express=require(_0x981c('0x3'));var router=express[_0x981c('0x4')]();var fs_extra=require(_0x981c('0x5'));var auth=require(_0x981c('0x6'));var interaction=require(_0x981c('0x7'));var config=require(_0x981c('0x8'));var controller=require(_0x981c('0x9'));router[_0x981c('0xa')]('/',auth[_0x981c('0xb')](),controller[_0x981c('0xc')]);router[_0x981c('0xa')](_0x981c('0xd'),auth[_0x981c('0xb')](),controller[_0x981c('0xe')]);router['get']('/:id/configurations',auth[_0x981c('0xb')](),controller[_0x981c('0xf')]);router[_0x981c('0xa')](_0x981c('0x10'),auth[_0x981c('0xb')](),controller[_0x981c('0x11')]);router[_0x981c('0x12')]('/',auth['isAuthenticated'](),controller[_0x981c('0x13')]);router['post'](_0x981c('0x14'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x981c('0x15')](_0x981c('0xd'),auth[_0x981c('0xb')](),controller[_0x981c('0x16')]);router['delete']('/:id',auth[_0x981c('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd60d=['../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','/:id','multer','path','../../components/auth/service','../../components/interaction/service'];(function(_0x503ba1,_0x1f9cbe){var _0x5b6354=function(_0x562b94){while(--_0x562b94){_0x503ba1['push'](_0x503ba1['shift']());}};_0x5b6354(++_0x1f9cbe);}(_0xd60d,0xd8));var _0xdd60=function(_0x225491,_0x3b23f9){_0x225491=_0x225491-0x0;var _0x2b50dc=_0xd60d[_0x225491];return _0x2b50dc;};'use strict';var multer=require(_0xdd60('0x0'));var util=require('util');var path=require(_0xdd60('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdd60('0x2'));var interaction=require(_0xdd60('0x3'));var config=require(_0xdd60('0x4'));var controller=require(_0xdd60('0x5'));router[_0xdd60('0x6')]('/',auth[_0xdd60('0x7')](),controller[_0xdd60('0x8')]);router[_0xdd60('0x6')]('/:id',auth[_0xdd60('0x7')](),controller[_0xdd60('0x9')]);router['get']('/:id/configurations',auth[_0xdd60('0x7')](),controller[_0xdd60('0xa')]);router['get'](_0xdd60('0xb'),auth[_0xdd60('0x7')](),controller[_0xdd60('0xc')]);router[_0xdd60('0xd')]('/',auth[_0xdd60('0x7')](),controller[_0xdd60('0xe')]);router[_0xdd60('0xd')](_0xdd60('0xf'),auth[_0xdd60('0x7')](),controller[_0xdd60('0x10')]);router[_0xdd60('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xdd60('0x12')]);router['delete'](_0xdd60('0x13'),auth[_0xdd60('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 2e1412e..187e9dd 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 _0x1122=['newTab','sequelize','STRING','username','remoteUri','password','token','ENUM','integrationTab'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1122,0xac));var _0x2112=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1122[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2112('0x0'));module['exports']={'name':{'type':Sequelize[_0x2112('0x1')]},'description':{'type':Sequelize[_0x2112('0x1')]},'username':{'type':Sequelize[_0x2112('0x1')],'unique':_0x2112('0x2')},'password':{'type':Sequelize[_0x2112('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x2112('0x3')},'authType':{'type':Sequelize['ENUM'](_0x2112('0x4'),_0x2112('0x5')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x2112('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2112('0x6')](_0x2112('0x7'),_0x2112('0x8')),'defaultValue':_0x2112('0x7')}}; \ No newline at end of file +var _0xd991=['remoteUri','ENUM','password','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x467af4,_0xe27272){var _0x2bd0b9=function(_0x4568de){while(--_0x4568de){_0x467af4['push'](_0x467af4['shift']());}};_0x2bd0b9(++_0xe27272);}(_0xd991,0x115));var _0x1d99=function(_0xf6f33,_0x17f023){_0xf6f33=_0xf6f33-0x0;var _0x2406af=_0xd991[_0xf6f33];return _0x2406af;};'use strict';var Sequelize=require(_0x1d99('0x0'));module[_0x1d99('0x1')]={'name':{'type':Sequelize[_0x1d99('0x2')]},'description':{'type':Sequelize[_0x1d99('0x2')]},'username':{'type':Sequelize[_0x1d99('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x1d99('0x2')]},'token':{'type':Sequelize[_0x1d99('0x2')]},'remoteUri':{'type':Sequelize[_0x1d99('0x2')],'unique':_0x1d99('0x3')},'authType':{'type':Sequelize[_0x1d99('0x4')](_0x1d99('0x5'),'token'),'defaultValue':_0x1d99('0x5')},'serverUrl':{'type':Sequelize[_0x1d99('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x1d99('0x6'),_0x1d99('0x7')),'defaultValue':_0x1d99('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index dbbc48b..da3d834 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 _0xd87e=['undefined','count','limit','set','Content-Range','reject','update','destroy','error','stack','name','index','ZendeskAccount','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','include','findAll','then','rows','catch','show','params','includeAll','find','create','body','getConfigurations','findOne','order','pick','filter','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZendeskConfiguration','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','headers','format','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','ticket_fields','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x3c40f4,_0x500b8a){var _0x1209d=function(_0x46b429){while(--_0x46b429){_0x3c40f4['push'](_0x3c40f4['shift']());}};_0x1209d(++_0x500b8a);}(_0xd87e,0x1bf));var _0xed87=function(_0x140327,_0x4ff244){_0x140327=_0x140327-0x0;var _0x46f126=_0xd87e[_0x140327];return _0x46f126;};'use strict';var emlformat=require(_0xed87('0x0'));var rimraf=require(_0xed87('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xed87('0x2'));var rp=require(_0xed87('0x3'));var moment=require(_0xed87('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xed87('0x5'));var util=require('util');var path=require(_0xed87('0x6'));var sox=require(_0xed87('0x7'));var csv=require('to-csv');var ejs=require(_0xed87('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xed87('0x9'));var crypto=require(_0xed87('0xa'));var jsforce=require(_0xed87('0xb'));var deskjs=require(_0xed87('0xc'));var toCsv=require('to-csv');var querystring=require(_0xed87('0xd'));var Papa=require(_0xed87('0xe'));var Redis=require(_0xed87('0xf'));var authService=require(_0xed87('0x10'));var qs=require(_0xed87('0x11'));var as=require(_0xed87('0x12'));var hardwareService=require(_0xed87('0x13'));var logger=require('../../config/logger')(_0xed87('0x14'));var utils=require(_0xed87('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xed87('0x16'));var db=require(_0xed87('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4ffc2d,_0x466f35){_0x466f35=_0x466f35||0xcc;return function(_0x32276e){if(_0x32276e){return _0x4ffc2d[_0xed87('0x18')](_0x466f35);}return _0x4ffc2d[_0xed87('0x19')](_0x466f35)[_0xed87('0x1a')]();};}function respondWithResult(_0x3865c5,_0x52dfe8){_0x52dfe8=_0x52dfe8||0xc8;return function(_0x4494da){if(_0x4494da){return _0x3865c5[_0xed87('0x19')](_0x52dfe8)[_0xed87('0x1b')](_0x4494da);}};}function respondWithFilteredResult(_0x1e9a3d,_0x2f2fd3){return function(_0xd34e0e){if(_0xd34e0e){var _0x173413=typeof _0x2f2fd3[_0xed87('0x1c')]===_0xed87('0x1d')&&typeof _0x2f2fd3['limit']===_0xed87('0x1d');var _0x18ab7d=_0xd34e0e[_0xed87('0x1e')];var _0xfb8a44=_0x173413?0x0:_0x2f2fd3['offset'];var _0x211085=_0x173413?_0xd34e0e[_0xed87('0x1e')]:_0x2f2fd3[_0xed87('0x1c')]+_0x2f2fd3[_0xed87('0x1f')];var _0x98a2ca;if(_0x211085>=_0x18ab7d){_0x211085=_0x18ab7d;_0x98a2ca=0xc8;}else{_0x98a2ca=0xce;}_0x1e9a3d[_0xed87('0x19')](_0x98a2ca);return _0x1e9a3d[_0xed87('0x20')](_0xed87('0x21'),_0xfb8a44+'-'+_0x211085+'/'+_0x18ab7d)[_0xed87('0x1b')](_0xd34e0e);}return null;};}function patchUpdates(_0x52e81c){return function(_0x5a7329){try{jsonpatch['apply'](_0x5a7329,_0x52e81c,!![]);}catch(_0x47c121){return BPromise[_0xed87('0x22')](_0x47c121);}return _0x5a7329['save']();};}function saveUpdates(_0x4191a7,_0x2b0b98){return function(_0x5b1659){if(_0x5b1659){return _0x5b1659[_0xed87('0x23')](_0x4191a7)['then'](function(_0x3d1641){return _0x3d1641;});}return null;};}function removeEntity(_0x24962e,_0x27799a){return function(_0x2a8733){if(_0x2a8733){return _0x2a8733[_0xed87('0x24')]()['then'](function(){_0x24962e[_0xed87('0x19')](0xcc)[_0xed87('0x1a')]();});}};}function handleEntityNotFound(_0x41e0d4,_0x320bcc){return function(_0x31c600){if(!_0x31c600){_0x41e0d4[_0xed87('0x18')](0x194);}return _0x31c600;};}function handleError(_0x25a6f7,_0x4735b3){_0x4735b3=_0x4735b3||0x1f4;return function(_0x40b2fa){logger[_0xed87('0x25')](_0x40b2fa[_0xed87('0x26')]);if(_0x40b2fa[_0xed87('0x27')]){delete _0x40b2fa[_0xed87('0x27')];}_0x25a6f7[_0xed87('0x19')](_0x4735b3)['send'](_0x40b2fa);};}exports[_0xed87('0x28')]=function(_0x1c4a65,_0x4eaa44){var _0x3dff74={},_0x33c367={},_0x21c93b={'count':0x0,'rows':[]};var _0x4b259e=_['map'](db[_0xed87('0x29')][_0xed87('0x2a')],function(_0x21ab8a){return{'name':_0x21ab8a['fieldName'],'type':_0x21ab8a[_0xed87('0x2b')][_0xed87('0x2c')]};});_0x33c367[_0xed87('0x2d')]=_[_0xed87('0x2e')](_0x4b259e,_0xed87('0x27'));_0x33c367[_0xed87('0x2f')]=_[_0xed87('0x30')](_0x1c4a65[_0xed87('0x2f')]);_0x33c367[_0xed87('0x31')]=_['intersection'](_0x33c367[_0xed87('0x2d')],_0x33c367[_0xed87('0x2f')]);_0x3dff74['attributes']=_[_0xed87('0x32')](_0x33c367['model'],qs[_0xed87('0x33')](_0x1c4a65[_0xed87('0x2f')][_0xed87('0x33')]));_0x3dff74[_0xed87('0x34')]=_0x3dff74[_0xed87('0x34')][_0xed87('0x35')]?_0x3dff74[_0xed87('0x34')]:_0x33c367[_0xed87('0x2d')];if(!_0x1c4a65[_0xed87('0x2f')][_0xed87('0x36')](_0xed87('0x37'))){_0x3dff74['limit']=qs[_0xed87('0x1f')](_0x1c4a65[_0xed87('0x2f')]['limit']);_0x3dff74[_0xed87('0x1c')]=qs['offset'](_0x1c4a65[_0xed87('0x2f')][_0xed87('0x1c')]);}_0x3dff74['order']=qs[_0xed87('0x38')](_0x1c4a65[_0xed87('0x2f')][_0xed87('0x38')]);_0x3dff74[_0xed87('0x39')]=qs[_0xed87('0x31')](_['pick'](_0x1c4a65[_0xed87('0x2f')],_0x33c367['filters']),_0x4b259e);if(_0x1c4a65[_0xed87('0x2f')]['filter']){_0x3dff74[_0xed87('0x39')]=_[_0xed87('0x3a')](_0x3dff74[_0xed87('0x39')],{'$or':_[_0xed87('0x2e')](_0x4b259e,function(_0x319f69){if(_0x319f69[_0xed87('0x2b')]!==_0xed87('0x3b')){var _0x161491={};_0x161491[_0x319f69[_0xed87('0x27')]]={'$like':'%'+_0x1c4a65['query']['filter']+'%'};return _0x161491;}})});}_0x3dff74=_[_0xed87('0x3a')]({},_0x3dff74,_0x1c4a65[_0xed87('0x3c')]);var _0x1f16a8={'where':_0x3dff74[_0xed87('0x39')]};return db[_0xed87('0x29')][_0xed87('0x1e')](_0x1f16a8)['then'](function(_0x4398a0){_0x21c93b[_0xed87('0x1e')]=_0x4398a0;if(_0x1c4a65[_0xed87('0x2f')]['includeAll']){_0x3dff74[_0xed87('0x3d')]=[{'all':!![]}];}return db[_0xed87('0x29')][_0xed87('0x3e')](_0x3dff74);})[_0xed87('0x3f')](function(_0x1d1e99){_0x21c93b[_0xed87('0x40')]=_0x1d1e99;return _0x21c93b;})[_0xed87('0x3f')](respondWithFilteredResult(_0x4eaa44,_0x3dff74))[_0xed87('0x41')](handleError(_0x4eaa44,null));};exports[_0xed87('0x42')]=function(_0x406b73,_0x5c6925){var _0x7e6cbb={'raw':![],'where':{'id':_0x406b73[_0xed87('0x43')]['id']}},_0x3c7fcc={};_0x3c7fcc['model']=_['keys'](db[_0xed87('0x29')][_0xed87('0x2a')]);_0x3c7fcc[_0xed87('0x2f')]=_[_0xed87('0x30')](_0x406b73['query']);_0x3c7fcc[_0xed87('0x31')]=_[_0xed87('0x32')](_0x3c7fcc['model'],_0x3c7fcc[_0xed87('0x2f')]);_0x7e6cbb[_0xed87('0x34')]=_[_0xed87('0x32')](_0x3c7fcc[_0xed87('0x2d')],qs[_0xed87('0x33')](_0x406b73[_0xed87('0x2f')][_0xed87('0x33')]));_0x7e6cbb[_0xed87('0x34')]=_0x7e6cbb[_0xed87('0x34')][_0xed87('0x35')]?_0x7e6cbb[_0xed87('0x34')]:_0x3c7fcc['model'];if(_0x406b73[_0xed87('0x2f')][_0xed87('0x44')]){_0x7e6cbb[_0xed87('0x3d')]=[{'all':!![]}];}_0x7e6cbb=_[_0xed87('0x3a')]({},_0x7e6cbb,_0x406b73[_0xed87('0x3c')]);return db[_0xed87('0x29')][_0xed87('0x45')](_0x7e6cbb)[_0xed87('0x3f')](handleEntityNotFound(_0x5c6925,null))[_0xed87('0x3f')](respondWithResult(_0x5c6925,null))[_0xed87('0x41')](handleError(_0x5c6925,null));};exports[_0xed87('0x46')]=function(_0x26c8f4,_0x27ed22){return db[_0xed87('0x29')][_0xed87('0x46')](_0x26c8f4[_0xed87('0x47')],{})[_0xed87('0x3f')](respondWithResult(_0x27ed22,0xc9))['catch'](handleError(_0x27ed22,null));};exports[_0xed87('0x23')]=function(_0x1a68a7,_0x3a91c5){if(_0x1a68a7['body']['id']){delete _0x1a68a7[_0xed87('0x47')]['id'];}return db[_0xed87('0x29')]['find']({'where':{'id':_0x1a68a7[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x3a91c5,null))[_0xed87('0x3f')](saveUpdates(_0x1a68a7[_0xed87('0x47')],null))['then'](respondWithResult(_0x3a91c5,null))[_0xed87('0x41')](handleError(_0x3a91c5,null));};exports[_0xed87('0x24')]=function(_0x3ca34c,_0x272a07){return db[_0xed87('0x29')][_0xed87('0x45')]({'where':{'id':_0x3ca34c[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x272a07,null))[_0xed87('0x3f')](removeEntity(_0x272a07,null))[_0xed87('0x41')](handleError(_0x272a07,null));};exports[_0xed87('0x48')]=function(_0x18846f,_0x2e5a9f,_0x4df105){var _0x43ffa4={};var _0x4ea4e3={};var _0x17cad7;var _0x329973;return db[_0xed87('0x29')][_0xed87('0x49')]({'where':{'id':_0x18846f[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x2e5a9f,null))[_0xed87('0x3f')](function(_0xccdbb6){if(_0xccdbb6){_0x17cad7=_0xccdbb6;_0x4ea4e3[_0xed87('0x2d')]=_[_0xed87('0x30')](db['ZendeskConfiguration'][_0xed87('0x2a')]);_0x4ea4e3[_0xed87('0x2f')]=_[_0xed87('0x30')](_0x18846f[_0xed87('0x2f')]);_0x4ea4e3[_0xed87('0x31')]=_[_0xed87('0x32')](_0x4ea4e3[_0xed87('0x2d')],_0x4ea4e3[_0xed87('0x2f')]);_0x43ffa4[_0xed87('0x34')]=_[_0xed87('0x32')](_0x4ea4e3[_0xed87('0x2d')],qs['fields'](_0x18846f['query'][_0xed87('0x33')]));_0x43ffa4[_0xed87('0x34')]=_0x43ffa4[_0xed87('0x34')][_0xed87('0x35')]?_0x43ffa4[_0xed87('0x34')]:_0x4ea4e3['model'];_0x43ffa4[_0xed87('0x4a')]=qs[_0xed87('0x38')](_0x18846f[_0xed87('0x2f')][_0xed87('0x38')]);_0x43ffa4[_0xed87('0x39')]=qs[_0xed87('0x31')](_[_0xed87('0x4b')](_0x18846f[_0xed87('0x2f')],_0x4ea4e3[_0xed87('0x31')]));if(_0x18846f[_0xed87('0x2f')][_0xed87('0x4c')]){_0x43ffa4[_0xed87('0x39')]=_[_0xed87('0x3a')](_0x43ffa4[_0xed87('0x39')],{'$or':_['map'](_0x43ffa4[_0xed87('0x34')],function(_0x10a19c){var _0x2f03d4={};_0x2f03d4[_0x10a19c]={'$like':'%'+_0x18846f[_0xed87('0x2f')][_0xed87('0x4c')]+'%'};return _0x2f03d4;})});}_0x43ffa4=_[_0xed87('0x3a')]({},_0x43ffa4,_0x18846f[_0xed87('0x3c')]);return _0x17cad7[_0xed87('0x48')](_0x43ffa4);}})['then'](function(_0x4367c3){if(_0x4367c3){_0x329973=_0x4367c3[_0xed87('0x35')];if(!_0x18846f[_0xed87('0x2f')][_0xed87('0x36')](_0xed87('0x37'))){_0x43ffa4[_0xed87('0x1f')]=qs['limit'](_0x18846f['query'][_0xed87('0x1f')]);_0x43ffa4[_0xed87('0x1c')]=qs[_0xed87('0x1c')](_0x18846f[_0xed87('0x2f')][_0xed87('0x1c')]);}return _0x17cad7[_0xed87('0x48')](_0x43ffa4);}})[_0xed87('0x3f')](function(_0x3bdf7c){if(_0x3bdf7c){return _0x3bdf7c?{'count':_0x329973,'rows':_0x3bdf7c}:null;}})['then'](respondWithResult(_0x2e5a9f,null))[_0xed87('0x41')](handleError(_0x2e5a9f,null));};exports['addConfiguration']=function(_0xd3b300,_0x3c82de,_0x4e5055){if(_0xd3b300[_0xed87('0x47')]['id']){delete _0xd3b300[_0xed87('0x47')]['id'];}return db['ZendeskAccount'][_0xed87('0x49')]({'where':{'id':_0xd3b300[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x3c82de,null))[_0xed87('0x3f')](function(_0x112685){if(_0x112685){_0xd3b300['body'][_0xed87('0x4d')]=_0x112685['id'];_0xd3b300[_0xed87('0x47')][_0xed87('0x4e')]=integrations[_0xed87('0x4f')](_0xd3b300['body']['channel'],_0xd3b300[_0xed87('0x47')][_0xed87('0x2b')]);_0xd3b300['body'][_0xed87('0x50')]=integrations[_0xed87('0x51')](_0xd3b300[_0xed87('0x47')][_0xed87('0x52')],_0xd3b300[_0xed87('0x47')][_0xed87('0x2b')]);return db[_0xed87('0x53')][_0xed87('0x46')](_0xd3b300[_0xed87('0x47')],{'include':[{'model':db[_0xed87('0x54')],'as':_0xed87('0x4e')},{'model':db[_0xed87('0x54')],'as':_0xed87('0x50')}]});}return null;})[_0xed87('0x3f')](respondWithResult(_0x3c82de,null))['catch'](handleError(_0x3c82de,null));};exports[_0xed87('0x55')]=function(_0x2686cd,_0x566ace,_0x4f7b92){var _0x5136c9='';return db[_0xed87('0x29')][_0xed87('0x49')]({'where':{'id':_0x2686cd[_0xed87('0x43')]['id']},'attributes':['id',_0xed87('0x56'),_0xed87('0x57'),_0xed87('0x58'),_0xed87('0x59'),'remoteUri']})[_0xed87('0x3f')](handleEntityNotFound(_0x566ace,null))[_0xed87('0x3f')](function(_0x3b6a9b){if(_0x3b6a9b){_0x5136c9=_0x3b6a9b[_0xed87('0x5a')];var _0xc35cab=_0x5136c9[_0xed87('0x5b')](-0x1);if(_0xc35cab==='/'){_0x5136c9=_0x5136c9[_0xed87('0x5c')](0x0,_0x5136c9[_0xed87('0x5d')](_0xc35cab));}var _0x116198={'method':_0xed87('0x5e'),'uri':util['format']('%s/%s',_0x5136c9,'ticket_fields'),'json':!![]};switch(_0x3b6a9b[_0xed87('0x59')]){case _0xed87('0x57'):_0x116198[_0xed87('0x5f')]={'Authorization':util[_0xed87('0x60')](_0xed87('0x61'),new Buffer(util['format'](_0xed87('0x62'),_0x3b6a9b[_0xed87('0x56')],_0x3b6a9b[_0xed87('0x57')]))[_0xed87('0x63')](_0xed87('0x64')))};break;case _0xed87('0x58'):_0x116198['headers']={'Authorization':util['format'](_0xed87('0x61'),new Buffer(util[_0xed87('0x60')](_0xed87('0x65'),_0x3b6a9b[_0xed87('0x56')],_0x3b6a9b[_0xed87('0x58')]))[_0xed87('0x63')](_0xed87('0x64')))};break;default:throw new db[(_0xed87('0x66'))][(_0xed87('0x67'))](_0xed87('0x68'));}return rp(_0x116198);}})[_0xed87('0x3f')](function(_0x1a1f95){if(_0x1a1f95){var _0x52af5c=[_0xed87('0x69'),_0xed87('0x6a'),_0xed87('0x6b'),_0xed87('0x6c')];_[_0xed87('0x6d')](_0x1a1f95[_0xed87('0x6e')],function(_0x4ae84c){return _0x52af5c[_0xed87('0x6f')](_0x4ae84c[_0xed87('0x2b')]);});return{'count':_0x1a1f95[_0xed87('0x6e')][_0xed87('0x35')],'rows':_['map'](_0x1a1f95['ticket_fields'],function(_0x4bfca0){return{'id':_0x4bfca0['id'],'name':_0x4bfca0['position']>0x7?_0x4bfca0['title']:_0x4bfca0[_0xed87('0x2b')],'custom':_0x4bfca0[_0xed87('0x70')]>0x7?!![]:![],'options':_0x4bfca0[_0xed87('0x71')]?_0x4bfca0[_0xed87('0x71')]:_0x4bfca0[_0xed87('0x72')]?_0x4bfca0[_0xed87('0x72')]:[]};})};}})[_0xed87('0x3f')](respondWithResult(_0x566ace,null))[_0xed87('0x41')](function(_0x1b223b){var _0x510066=_0x2686cd['query'][_0xed87('0x73')]?0x1f4:_0x1b223b[_0xed87('0x74')]||0x1f4;logger[_0xed87('0x25')](_0xed87('0x75'),_0xed87('0x55'),_0x510066,JSON['stringify'](_0x1b223b));delete _0x1b223b['name'];if(_0x510066===0x191){_0x510066=0x190;}_0x566ace[_0xed87('0x19')](_0x510066)[_0xed87('0x76')](_0x2686cd['query'][_0xed87('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x1b223b[_0xed87('0x74')]}:_0x1b223b);});}; \ No newline at end of file +var _0x6324=['error','name','send','index','ZendeskAccount','key','model','map','keys','query','intersection','fields','attributes','length','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','find','getConfigurations','findOne','ZendeskConfiguration','hasOwnProperty','nolimit','addConfiguration','AccountId','getSubjects','channel','getDescriptions','ZendeskField','Subjects','Descriptions','getFields','username','password','token','authType','remoteUri','substring','lastIndexOf','GET','format','%s/%s','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','subject','assignee','remove','includes','ticket_fields','title','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end'];(function(_0x4e5862,_0x50a4a4){var _0x59372a=function(_0x595272){while(--_0x595272){_0x4e5862['push'](_0x4e5862['shift']());}};_0x59372a(++_0x50a4a4);}(_0x6324,0x142));var _0x4632=function(_0x214890,_0x2562c0){_0x214890=_0x214890-0x0;var _0x760050=_0x6324[_0x214890];return _0x760050;};'use strict';var emlformat=require(_0x4632('0x0'));var rimraf=require(_0x4632('0x1'));var zipdir=require(_0x4632('0x2'));var jsonpatch=require(_0x4632('0x3'));var rp=require('request-promise');var moment=require(_0x4632('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4632('0x5'));var util=require('util');var path=require(_0x4632('0x6'));var sox=require('sox');var csv=require(_0x4632('0x7'));var ejs=require(_0x4632('0x8'));var fs=require('fs');var fs_extra=require(_0x4632('0x9'));var _=require(_0x4632('0xa'));var squel=require('squel');var crypto=require(_0x4632('0xb'));var jsforce=require(_0x4632('0xc'));var deskjs=require(_0x4632('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4632('0xe'));var Papa=require(_0x4632('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4632('0x10'));var as=require(_0x4632('0x11'));var hardwareService=require(_0x4632('0x12'));var logger=require(_0x4632('0x13'))(_0x4632('0x14'));var utils=require(_0x4632('0x15'));var config=require(_0x4632('0x16'));var licenseUtil=require(_0x4632('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x4632('0x18'));function respondWithStatusCode(_0x499d88,_0x4719f7){_0x4719f7=_0x4719f7||0xcc;return function(_0x299073){if(_0x299073){return _0x499d88[_0x4632('0x19')](_0x4719f7);}return _0x499d88[_0x4632('0x1a')](_0x4719f7)['end']();};}function respondWithResult(_0x3ba361,_0x255882){_0x255882=_0x255882||0xc8;return function(_0x3b9901){if(_0x3b9901){return _0x3ba361[_0x4632('0x1a')](_0x255882)[_0x4632('0x1b')](_0x3b9901);}};}function respondWithFilteredResult(_0x5438ab,_0x47b349){return function(_0x2fd7ae){if(_0x2fd7ae){var _0x38bedd=typeof _0x47b349[_0x4632('0x1c')]===_0x4632('0x1d')&&typeof _0x47b349['limit']===_0x4632('0x1d');var _0x113872=_0x2fd7ae[_0x4632('0x1e')];var _0x5b28b7=_0x38bedd?0x0:_0x47b349[_0x4632('0x1c')];var _0x1894bb=_0x38bedd?_0x2fd7ae['count']:_0x47b349['offset']+_0x47b349[_0x4632('0x1f')];var _0x3cf2bd;if(_0x1894bb>=_0x113872){_0x1894bb=_0x113872;_0x3cf2bd=0xc8;}else{_0x3cf2bd=0xce;}_0x5438ab[_0x4632('0x1a')](_0x3cf2bd);return _0x5438ab[_0x4632('0x20')](_0x4632('0x21'),_0x5b28b7+'-'+_0x1894bb+'/'+_0x113872)[_0x4632('0x1b')](_0x2fd7ae);}return null;};}function patchUpdates(_0x9ab826){return function(_0x468ccb){try{jsonpatch[_0x4632('0x22')](_0x468ccb,_0x9ab826,!![]);}catch(_0x3ea0d1){return BPromise[_0x4632('0x23')](_0x3ea0d1);}return _0x468ccb[_0x4632('0x24')]();};}function saveUpdates(_0x2ca6a5,_0x263907){return function(_0x4cfebc){if(_0x4cfebc){return _0x4cfebc[_0x4632('0x25')](_0x2ca6a5)[_0x4632('0x26')](function(_0x3537ed){return _0x3537ed;});}return null;};}function removeEntity(_0x380a9f,_0x1e1b86){return function(_0x38cbbc){if(_0x38cbbc){return _0x38cbbc[_0x4632('0x27')]()[_0x4632('0x26')](function(){_0x380a9f[_0x4632('0x1a')](0xcc)[_0x4632('0x28')]();});}};}function handleEntityNotFound(_0x1b8de0,_0x4af026){return function(_0x2e3428){if(!_0x2e3428){_0x1b8de0[_0x4632('0x19')](0x194);}return _0x2e3428;};}function handleError(_0x372679,_0x22d0f5){_0x22d0f5=_0x22d0f5||0x1f4;return function(_0x2a0b11){logger[_0x4632('0x29')](_0x2a0b11['stack']);if(_0x2a0b11['name']){delete _0x2a0b11[_0x4632('0x2a')];}_0x372679[_0x4632('0x1a')](_0x22d0f5)[_0x4632('0x2b')](_0x2a0b11);};}exports[_0x4632('0x2c')]=function(_0x34079f,_0x119d1b){var _0x3570b2={},_0x5e2ee4={},_0x42d505={'count':0x0,'rows':[]};var _0x135fd2=_['map'](db[_0x4632('0x2d')]['rawAttributes'],function(_0x6599ad){return{'name':_0x6599ad['fieldName'],'type':_0x6599ad['type'][_0x4632('0x2e')]};});_0x5e2ee4[_0x4632('0x2f')]=_[_0x4632('0x30')](_0x135fd2,'name');_0x5e2ee4['query']=_[_0x4632('0x31')](_0x34079f[_0x4632('0x32')]);_0x5e2ee4['filters']=_['intersection'](_0x5e2ee4[_0x4632('0x2f')],_0x5e2ee4[_0x4632('0x32')]);_0x3570b2['attributes']=_[_0x4632('0x33')](_0x5e2ee4[_0x4632('0x2f')],qs[_0x4632('0x34')](_0x34079f[_0x4632('0x32')][_0x4632('0x34')]));_0x3570b2['attributes']=_0x3570b2[_0x4632('0x35')][_0x4632('0x36')]?_0x3570b2['attributes']:_0x5e2ee4['model'];if(!_0x34079f[_0x4632('0x32')]['hasOwnProperty']('nolimit')){_0x3570b2[_0x4632('0x1f')]=qs['limit'](_0x34079f[_0x4632('0x32')][_0x4632('0x1f')]);_0x3570b2[_0x4632('0x1c')]=qs['offset'](_0x34079f[_0x4632('0x32')][_0x4632('0x1c')]);}_0x3570b2[_0x4632('0x37')]=qs[_0x4632('0x38')](_0x34079f[_0x4632('0x32')]['sort']);_0x3570b2['where']=qs[_0x4632('0x39')](_[_0x4632('0x3a')](_0x34079f[_0x4632('0x32')],_0x5e2ee4['filters']),_0x135fd2);if(_0x34079f['query']['filter']){_0x3570b2[_0x4632('0x3b')]=_[_0x4632('0x3c')](_0x3570b2['where'],{'$or':_[_0x4632('0x30')](_0x135fd2,function(_0x20a700){if(_0x20a700[_0x4632('0x3d')]!==_0x4632('0x3e')){var _0x2309f1={};_0x2309f1[_0x20a700[_0x4632('0x2a')]]={'$like':'%'+_0x34079f[_0x4632('0x32')][_0x4632('0x3f')]+'%'};return _0x2309f1;}})});}_0x3570b2=_[_0x4632('0x3c')]({},_0x3570b2,_0x34079f[_0x4632('0x40')]);var _0x1fd3f1={'where':_0x3570b2[_0x4632('0x3b')]};return db['ZendeskAccount'][_0x4632('0x1e')](_0x1fd3f1)[_0x4632('0x26')](function(_0x4c0e13){_0x42d505[_0x4632('0x1e')]=_0x4c0e13;if(_0x34079f[_0x4632('0x32')]['includeAll']){_0x3570b2[_0x4632('0x41')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x4632('0x42')](_0x3570b2);})[_0x4632('0x26')](function(_0x1bfb36){_0x42d505[_0x4632('0x43')]=_0x1bfb36;return _0x42d505;})['then'](respondWithFilteredResult(_0x119d1b,_0x3570b2))[_0x4632('0x44')](handleError(_0x119d1b,null));};exports[_0x4632('0x45')]=function(_0x23ef38,_0x279298){var _0x5cc716={'raw':![],'where':{'id':_0x23ef38[_0x4632('0x46')]['id']}},_0x5b3fa9={};_0x5b3fa9[_0x4632('0x2f')]=_[_0x4632('0x31')](db['ZendeskAccount'][_0x4632('0x47')]);_0x5b3fa9[_0x4632('0x32')]=_[_0x4632('0x31')](_0x23ef38[_0x4632('0x32')]);_0x5b3fa9[_0x4632('0x39')]=_[_0x4632('0x33')](_0x5b3fa9[_0x4632('0x2f')],_0x5b3fa9['query']);_0x5cc716[_0x4632('0x35')]=_[_0x4632('0x33')](_0x5b3fa9[_0x4632('0x2f')],qs[_0x4632('0x34')](_0x23ef38[_0x4632('0x32')]['fields']));_0x5cc716['attributes']=_0x5cc716[_0x4632('0x35')][_0x4632('0x36')]?_0x5cc716[_0x4632('0x35')]:_0x5b3fa9[_0x4632('0x2f')];if(_0x23ef38['query'][_0x4632('0x48')]){_0x5cc716[_0x4632('0x41')]=[{'all':!![]}];}_0x5cc716=_[_0x4632('0x3c')]({},_0x5cc716,_0x23ef38[_0x4632('0x40')]);return db[_0x4632('0x2d')]['find'](_0x5cc716)[_0x4632('0x26')](handleEntityNotFound(_0x279298,null))[_0x4632('0x26')](respondWithResult(_0x279298,null))[_0x4632('0x44')](handleError(_0x279298,null));};exports[_0x4632('0x49')]=function(_0x3676fa,_0x2eb8b0){return db[_0x4632('0x2d')][_0x4632('0x49')](_0x3676fa[_0x4632('0x4a')],{})[_0x4632('0x26')](respondWithResult(_0x2eb8b0,0xc9))[_0x4632('0x44')](handleError(_0x2eb8b0,null));};exports['update']=function(_0xc3ffd0,_0x1ccadb){if(_0xc3ffd0[_0x4632('0x4a')]['id']){delete _0xc3ffd0['body']['id'];}return db[_0x4632('0x2d')][_0x4632('0x4b')]({'where':{'id':_0xc3ffd0[_0x4632('0x46')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x1ccadb,null))[_0x4632('0x26')](saveUpdates(_0xc3ffd0[_0x4632('0x4a')],null))[_0x4632('0x26')](respondWithResult(_0x1ccadb,null))[_0x4632('0x44')](handleError(_0x1ccadb,null));};exports[_0x4632('0x27')]=function(_0x1aa831,_0x4e89e3){return db[_0x4632('0x2d')][_0x4632('0x4b')]({'where':{'id':_0x1aa831['params']['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x4e89e3,null))[_0x4632('0x26')](removeEntity(_0x4e89e3,null))[_0x4632('0x44')](handleError(_0x4e89e3,null));};exports[_0x4632('0x4c')]=function(_0x2c59f5,_0xfeeac0,_0x248dcf){var _0xf4880f={};var _0x31b42d={};var _0x1b66e0;var _0x3e66d8;return db[_0x4632('0x2d')][_0x4632('0x4d')]({'where':{'id':_0x2c59f5[_0x4632('0x46')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0xfeeac0,null))[_0x4632('0x26')](function(_0x32cd35){if(_0x32cd35){_0x1b66e0=_0x32cd35;_0x31b42d[_0x4632('0x2f')]=_[_0x4632('0x31')](db[_0x4632('0x4e')]['rawAttributes']);_0x31b42d[_0x4632('0x32')]=_[_0x4632('0x31')](_0x2c59f5[_0x4632('0x32')]);_0x31b42d[_0x4632('0x39')]=_[_0x4632('0x33')](_0x31b42d[_0x4632('0x2f')],_0x31b42d['query']);_0xf4880f[_0x4632('0x35')]=_[_0x4632('0x33')](_0x31b42d[_0x4632('0x2f')],qs['fields'](_0x2c59f5[_0x4632('0x32')][_0x4632('0x34')]));_0xf4880f['attributes']=_0xf4880f[_0x4632('0x35')][_0x4632('0x36')]?_0xf4880f[_0x4632('0x35')]:_0x31b42d['model'];_0xf4880f[_0x4632('0x37')]=qs[_0x4632('0x38')](_0x2c59f5[_0x4632('0x32')][_0x4632('0x38')]);_0xf4880f[_0x4632('0x3b')]=qs[_0x4632('0x39')](_[_0x4632('0x3a')](_0x2c59f5[_0x4632('0x32')],_0x31b42d[_0x4632('0x39')]));if(_0x2c59f5[_0x4632('0x32')]['filter']){_0xf4880f[_0x4632('0x3b')]=_[_0x4632('0x3c')](_0xf4880f['where'],{'$or':_[_0x4632('0x30')](_0xf4880f['attributes'],function(_0x48e942){var _0xa55d76={};_0xa55d76[_0x48e942]={'$like':'%'+_0x2c59f5[_0x4632('0x32')][_0x4632('0x3f')]+'%'};return _0xa55d76;})});}_0xf4880f=_[_0x4632('0x3c')]({},_0xf4880f,_0x2c59f5[_0x4632('0x40')]);return _0x1b66e0[_0x4632('0x4c')](_0xf4880f);}})[_0x4632('0x26')](function(_0x3e2849){if(_0x3e2849){_0x3e66d8=_0x3e2849[_0x4632('0x36')];if(!_0x2c59f5[_0x4632('0x32')][_0x4632('0x4f')](_0x4632('0x50'))){_0xf4880f[_0x4632('0x1f')]=qs[_0x4632('0x1f')](_0x2c59f5['query']['limit']);_0xf4880f[_0x4632('0x1c')]=qs[_0x4632('0x1c')](_0x2c59f5[_0x4632('0x32')][_0x4632('0x1c')]);}return _0x1b66e0[_0x4632('0x4c')](_0xf4880f);}})[_0x4632('0x26')](function(_0x5b66ee){if(_0x5b66ee){return _0x5b66ee?{'count':_0x3e66d8,'rows':_0x5b66ee}:null;}})[_0x4632('0x26')](respondWithResult(_0xfeeac0,null))[_0x4632('0x44')](handleError(_0xfeeac0,null));};exports[_0x4632('0x51')]=function(_0x2e4d57,_0x5d1994,_0x529be1){if(_0x2e4d57[_0x4632('0x4a')]['id']){delete _0x2e4d57['body']['id'];}return db[_0x4632('0x2d')][_0x4632('0x4d')]({'where':{'id':_0x2e4d57[_0x4632('0x46')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x5d1994,null))[_0x4632('0x26')](function(_0x5e5669){if(_0x5e5669){_0x2e4d57[_0x4632('0x4a')][_0x4632('0x52')]=_0x5e5669['id'];_0x2e4d57['body']['Subjects']=integrations[_0x4632('0x53')](_0x2e4d57[_0x4632('0x4a')][_0x4632('0x54')],_0x2e4d57[_0x4632('0x4a')]['type']);_0x2e4d57['body']['Descriptions']=integrations[_0x4632('0x55')](_0x2e4d57['body'][_0x4632('0x54')],_0x2e4d57[_0x4632('0x4a')][_0x4632('0x3d')]);return db[_0x4632('0x4e')][_0x4632('0x49')](_0x2e4d57[_0x4632('0x4a')],{'include':[{'model':db[_0x4632('0x56')],'as':_0x4632('0x57')},{'model':db[_0x4632('0x56')],'as':_0x4632('0x58')}]});}return null;})[_0x4632('0x26')](respondWithResult(_0x5d1994,null))[_0x4632('0x44')](handleError(_0x5d1994,null));};exports[_0x4632('0x59')]=function(_0x3d5e65,_0x461700,_0x1b2905){var _0x550c4d='';return db[_0x4632('0x2d')][_0x4632('0x4d')]({'where':{'id':_0x3d5e65[_0x4632('0x46')]['id']},'attributes':['id',_0x4632('0x5a'),_0x4632('0x5b'),_0x4632('0x5c'),_0x4632('0x5d'),_0x4632('0x5e')]})[_0x4632('0x26')](handleEntityNotFound(_0x461700,null))[_0x4632('0x26')](function(_0x16ed40){if(_0x16ed40){_0x550c4d=_0x16ed40[_0x4632('0x5e')];var _0x27e2a6=_0x550c4d['slice'](-0x1);if(_0x27e2a6==='/'){_0x550c4d=_0x550c4d[_0x4632('0x5f')](0x0,_0x550c4d[_0x4632('0x60')](_0x27e2a6));}var _0x348af1={'method':_0x4632('0x61'),'uri':util[_0x4632('0x62')](_0x4632('0x63'),_0x550c4d,'ticket_fields'),'json':!![]};switch(_0x16ed40[_0x4632('0x5d')]){case _0x4632('0x5b'):_0x348af1['headers']={'Authorization':util[_0x4632('0x62')](_0x4632('0x64'),new Buffer(util[_0x4632('0x62')](_0x4632('0x65'),_0x16ed40[_0x4632('0x5a')],_0x16ed40['password']))[_0x4632('0x66')](_0x4632('0x67')))};break;case _0x4632('0x5c'):_0x348af1['headers']={'Authorization':util[_0x4632('0x62')](_0x4632('0x64'),new Buffer(util[_0x4632('0x62')](_0x4632('0x68'),_0x16ed40[_0x4632('0x5a')],_0x16ed40[_0x4632('0x5c')]))[_0x4632('0x66')](_0x4632('0x67')))};break;default:throw new db['Sequelize'][(_0x4632('0x69'))](_0x4632('0x6a'));}return rp(_0x348af1);}})[_0x4632('0x26')](function(_0x525bf9){if(_0x525bf9){var _0xfc48bd=[_0x4632('0x6b'),'description','group',_0x4632('0x6c')];_[_0x4632('0x6d')](_0x525bf9['ticket_fields'],function(_0x63d3e1){return _0xfc48bd[_0x4632('0x6e')](_0x63d3e1[_0x4632('0x3d')]);});return{'count':_0x525bf9[_0x4632('0x6f')][_0x4632('0x36')],'rows':_[_0x4632('0x30')](_0x525bf9[_0x4632('0x6f')],function(_0x130b52){return{'id':_0x130b52['id'],'name':_0x130b52['position']>0x7?_0x130b52[_0x4632('0x70')]:_0x130b52[_0x4632('0x3d')],'custom':_0x130b52[_0x4632('0x71')]>0x7?!![]:![],'options':_0x130b52[_0x4632('0x72')]?_0x130b52['system_field_options']:_0x130b52[_0x4632('0x73')]?_0x130b52[_0x4632('0x73')]:[]};})};}})[_0x4632('0x26')](respondWithResult(_0x461700,null))[_0x4632('0x44')](function(_0x3cee1d){var _0x4ca8a8=_0x3d5e65[_0x4632('0x32')][_0x4632('0x74')]?0x1f4:_0x3cee1d[_0x4632('0x75')]||0x1f4;logger[_0x4632('0x29')](_0x4632('0x76'),_0x4632('0x59'),_0x4ca8a8,JSON[_0x4632('0x77')](_0x3cee1d));delete _0x3cee1d[_0x4632('0x2a')];if(_0x4ca8a8===0x191){_0x4ca8a8=0x190;}_0x461700['status'](_0x4ca8a8)[_0x4632('0x2b')](_0x3d5e65[_0x4632('0x32')][_0x4632('0x74')]?{'message':_0x4632('0x78'),'statusCode':_0x3cee1d[_0x4632('0x75')]}:_0x3cee1d);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 3505a9c..e294c5e 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 _0x1227=['exports','define','ZendeskAccount','int_zendesk_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x81e446,_0x4e5b91){var _0xae6f7d=function(_0x281501){while(--_0x281501){_0x81e446['push'](_0x81e446['shift']());}};_0xae6f7d(++_0x4e5b91);}(_0x1227,0x149));var _0x7122=function(_0x625d33,_0x49620c){_0x625d33=_0x625d33-0x0;var _0x564efe=_0x1227[_0x625d33];return _0x564efe;};'use strict';var _=require('lodash');var util=require(_0x7122('0x0'));var logger=require(_0x7122('0x1'))(_0x7122('0x2'));var moment=require(_0x7122('0x3'));var BPromise=require(_0x7122('0x4'));var rp=require(_0x7122('0x5'));var fs=require('fs');var path=require(_0x7122('0x6'));var rimraf=require(_0x7122('0x7'));var config=require(_0x7122('0x8'));var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x7122('0x9')]=function(_0x2159c1,_0x501892){return _0x2159c1[_0x7122('0xa')](_0x7122('0xb'),attributes,{'tableName':_0x7122('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ea8=['ZendeskAccount','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./intZendeskAccount.attributes','define'];(function(_0xeec4e8,_0x15de72){var _0x3c07fc=function(_0x2a30c3){while(--_0x2a30c3){_0xeec4e8['push'](_0xeec4e8['shift']());}};_0x3c07fc(++_0x15de72);}(_0x9ea8,0x9b));var _0x89ea=function(_0x4e4a38,_0x13b3a0){_0x4e4a38=_0x4e4a38-0x0;var _0x2fe004=_0x9ea8[_0x4e4a38];return _0x2fe004;};'use strict';var _=require(_0x89ea('0x0'));var util=require(_0x89ea('0x1'));var logger=require('../../config/logger')(_0x89ea('0x2'));var moment=require(_0x89ea('0x3'));var BPromise=require(_0x89ea('0x4'));var rp=require(_0x89ea('0x5'));var fs=require('fs');var path=require(_0x89ea('0x6'));var rimraf=require(_0x89ea('0x7'));var config=require('../../config/environment');var attributes=require(_0x89ea('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xd1e13c,_0xa1cae9){return _0xd1e13c[_0x89ea('0x9')](_0x89ea('0xa'),attributes,{'tableName':'int_zendesk_accounts','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 5ca7065..7fe3a58 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 _0xe2db=['map','model','catch','find','ShowZendeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xe2db,0x149));var _0xbe2d=function(_0x478a5b,_0x1c566f){_0x478a5b=_0x478a5b-0x0;var _0x2da27f=_0xe2db[_0x478a5b];return _0x2da27f;};'use strict';var _=require(_0xbe2d('0x0'));var util=require(_0xbe2d('0x1'));var moment=require(_0xbe2d('0x2'));var BPromise=require(_0xbe2d('0x3'));var rs=require(_0xbe2d('0x4'));var fs=require('fs');var Redis=require(_0xbe2d('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbe2d('0x6'))(_0xbe2d('0x7'));var config=require(_0xbe2d('0x8'));var jayson=require(_0xbe2d('0x9'));var client=jayson[_0xbe2d('0xa')][_0xbe2d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x189f5a,_0x5f45b0,_0x56830d){return new BPromise(function(_0x192b86,_0x5d7ffb){return client[_0xbe2d('0xc')](_0x189f5a,_0x56830d)[_0xbe2d('0xd')](function(_0x36aa22){logger[_0xbe2d('0xe')](_0xbe2d('0xf'),_0x5f45b0,_0xbe2d('0x10'));logger[_0xbe2d('0x11')](_0xbe2d('0x12'),_0x5f45b0,'request\x20sent',JSON[_0xbe2d('0x13')](_0x36aa22));if(_0x36aa22[_0xbe2d('0x14')]){if(_0x36aa22[_0xbe2d('0x14')]['code']===0x1f4){logger[_0xbe2d('0x14')](_0xbe2d('0xf'),_0x5f45b0,_0x36aa22[_0xbe2d('0x14')][_0xbe2d('0x15')]);return _0x5d7ffb(_0x36aa22[_0xbe2d('0x14')][_0xbe2d('0x15')]);}logger[_0xbe2d('0x14')](_0xbe2d('0xf'),_0x5f45b0,_0x36aa22['error'][_0xbe2d('0x15')]);return _0x192b86(_0x36aa22['error']['message']);}else{logger[_0xbe2d('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x5f45b0,_0xbe2d('0x10'));_0x192b86(_0x36aa22['result'][_0xbe2d('0x15')]);}})['catch'](function(_0x4995aa){logger[_0xbe2d('0x14')](_0xbe2d('0xf'),_0x5f45b0,_0x4995aa);_0x5d7ffb(_0x4995aa);});});}exports[_0xbe2d('0x16')]=function(_0xd293){var _0x3d9eda=this;return new Promise(function(_0x886461,_0x2ffa9a){return db[_0xbe2d('0x17')][_0xbe2d('0x18')]({'raw':_0xd293['options']?_0xd293[_0xbe2d('0x19')][_0xbe2d('0x1a')]===undefined?!![]:![]:!![],'where':_0xd293[_0xbe2d('0x19')]?_0xd293[_0xbe2d('0x19')][_0xbe2d('0x1b')]||null:null,'attributes':_0xd293[_0xbe2d('0x19')]?_0xd293['options'][_0xbe2d('0x1c')]||null:null,'limit':_0xd293['options']?_0xd293[_0xbe2d('0x19')][_0xbe2d('0x1d')]||null:null,'include':_0xd293[_0xbe2d('0x19')]?_0xd293[_0xbe2d('0x19')][_0xbe2d('0x1e')]?_[_0xbe2d('0x1f')](_0xd293[_0xbe2d('0x19')][_0xbe2d('0x1e')],function(_0x528d12){return{'model':db[_0x528d12[_0xbe2d('0x20')]],'as':_0x528d12['as'],'attributes':_0x528d12[_0xbe2d('0x1c')],'include':_0x528d12[_0xbe2d('0x1e')]?_[_0xbe2d('0x1f')](_0x528d12[_0xbe2d('0x1e')],function(_0x17525a){return{'model':db[_0x17525a['model']],'as':_0x17525a['as'],'attributes':_0x17525a[_0xbe2d('0x1c')],'include':_0x17525a[_0xbe2d('0x1e')]?_[_0xbe2d('0x1f')](_0x17525a['include'],function(_0x1199b7){return{'model':db[_0x1199b7['model']],'as':_0x1199b7['as'],'attributes':_0x1199b7[_0xbe2d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbe2d('0xd')](function(_0x484560){logger['info'](_0xbe2d('0x16'),_0xd293);logger[_0xbe2d('0x11')](_0xbe2d('0x16'),_0xd293,JSON[_0xbe2d('0x13')](_0x484560));_0x886461(_0x484560);})[_0xbe2d('0x21')](function(_0x3563c6){logger['error'](_0xbe2d('0x16'),_0x3563c6['message'],_0xd293);_0x2ffa9a(_0x3d9eda[_0xbe2d('0x14')](0x1f4,_0x3563c6['message']));});});};exports['ShowZendeskAccount']=function(_0x11b114){var _0x4b4c66=this;return new Promise(function(_0x1b88ef,_0x332230){return db[_0xbe2d('0x17')][_0xbe2d('0x22')]({'raw':_0x11b114[_0xbe2d('0x19')]?_0x11b114[_0xbe2d('0x19')][_0xbe2d('0x1a')]===undefined?!![]:![]:!![],'where':_0x11b114[_0xbe2d('0x19')]?_0x11b114[_0xbe2d('0x19')][_0xbe2d('0x1b')]||null:null,'attributes':_0x11b114[_0xbe2d('0x19')]?_0x11b114[_0xbe2d('0x19')]['attributes']||null:null,'include':_0x11b114['options']?_0x11b114[_0xbe2d('0x19')][_0xbe2d('0x1e')]?_[_0xbe2d('0x1f')](_0x11b114[_0xbe2d('0x19')][_0xbe2d('0x1e')],function(_0x3d7416){return{'model':db[_0x3d7416['model']],'as':_0x3d7416['as'],'attributes':_0x3d7416[_0xbe2d('0x1c')],'include':_0x3d7416['include']?_[_0xbe2d('0x1f')](_0x3d7416['include'],function(_0x5163ea){return{'model':db[_0x5163ea[_0xbe2d('0x20')]],'as':_0x5163ea['as'],'attributes':_0x5163ea[_0xbe2d('0x1c')],'include':_0x5163ea[_0xbe2d('0x1e')]?_[_0xbe2d('0x1f')](_0x5163ea[_0xbe2d('0x1e')],function(_0x10a3d8){return{'model':db[_0x10a3d8['model']],'as':_0x10a3d8['as'],'attributes':_0x10a3d8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b09fd){logger[_0xbe2d('0xe')](_0xbe2d('0x23'),_0x11b114);logger[_0xbe2d('0x11')]('ShowZendeskAccount',_0x11b114,JSON[_0xbe2d('0x13')](_0x3b09fd));_0x1b88ef(_0x3b09fd);})[_0xbe2d('0x21')](function(_0x429314){logger[_0xbe2d('0x14')](_0xbe2d('0x23'),_0x429314[_0xbe2d('0x15')],_0x11b114);_0x332230(_0x4b4c66[_0xbe2d('0x14')](0x1f4,_0x429314[_0xbe2d('0x15')]));});});}; \ No newline at end of file +var _0xbaa4=['../../config/environment','jayson/promise','client','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','ShowZendeskAccount','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x149155,_0x4668d9){var _0x154d7a=function(_0xa1a287){while(--_0xa1a287){_0x149155['push'](_0x149155['shift']());}};_0x154d7a(++_0x4668d9);}(_0xbaa4,0x65));var _0x4baa=function(_0x5265d4,_0x3c305b){_0x5265d4=_0x5265d4-0x0;var _0x4db98b=_0xbaa4[_0x5265d4];return _0x4db98b;};'use strict';var _=require(_0x4baa('0x0'));var util=require(_0x4baa('0x1'));var moment=require(_0x4baa('0x2'));var BPromise=require(_0x4baa('0x3'));var rs=require(_0x4baa('0x4'));var fs=require('fs');var Redis=require(_0x4baa('0x5'));var db=require(_0x4baa('0x6'))['db'];var utils=require(_0x4baa('0x7'));var logger=require(_0x4baa('0x8'))(_0x4baa('0x9'));var config=require(_0x4baa('0xa'));var jayson=require(_0x4baa('0xb'));var client=jayson[_0x4baa('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x785757,_0x4c4190,_0x1ab13b){return new BPromise(function(_0x47ea61,_0x5a55c0){return client[_0x4baa('0xd')](_0x785757,_0x1ab13b)[_0x4baa('0xe')](function(_0x4464e9){logger[_0x4baa('0xf')](_0x4baa('0x10'),_0x4c4190,_0x4baa('0x11'));logger[_0x4baa('0x12')](_0x4baa('0x13'),_0x4c4190,'request\x20sent',JSON['stringify'](_0x4464e9));if(_0x4464e9[_0x4baa('0x14')]){if(_0x4464e9['error']['code']===0x1f4){logger['error'](_0x4baa('0x10'),_0x4c4190,_0x4464e9[_0x4baa('0x14')][_0x4baa('0x15')]);return _0x5a55c0(_0x4464e9['error'][_0x4baa('0x15')]);}logger[_0x4baa('0x14')](_0x4baa('0x10'),_0x4c4190,_0x4464e9[_0x4baa('0x14')][_0x4baa('0x15')]);return _0x47ea61(_0x4464e9[_0x4baa('0x14')][_0x4baa('0x15')]);}else{logger[_0x4baa('0xf')](_0x4baa('0x10'),_0x4c4190,_0x4baa('0x11'));_0x47ea61(_0x4464e9[_0x4baa('0x16')][_0x4baa('0x15')]);}})[_0x4baa('0x17')](function(_0x4a43c9){logger[_0x4baa('0x14')](_0x4baa('0x10'),_0x4c4190,_0x4a43c9);_0x5a55c0(_0x4a43c9);});});}exports[_0x4baa('0x18')]=function(_0x4c1a94){var _0x3e424b=this;return new Promise(function(_0x35295e,_0x56f364){return db[_0x4baa('0x19')][_0x4baa('0x1a')]({'raw':_0x4c1a94[_0x4baa('0x1b')]?_0x4c1a94[_0x4baa('0x1b')][_0x4baa('0x1c')]===undefined?!![]:![]:!![],'where':_0x4c1a94[_0x4baa('0x1b')]?_0x4c1a94[_0x4baa('0x1b')][_0x4baa('0x1d')]||null:null,'attributes':_0x4c1a94['options']?_0x4c1a94[_0x4baa('0x1b')]['attributes']||null:null,'limit':_0x4c1a94['options']?_0x4c1a94['options'][_0x4baa('0x1e')]||null:null,'include':_0x4c1a94[_0x4baa('0x1b')]?_0x4c1a94[_0x4baa('0x1b')][_0x4baa('0x1f')]?_[_0x4baa('0x20')](_0x4c1a94[_0x4baa('0x1b')][_0x4baa('0x1f')],function(_0x57c101){return{'model':db[_0x57c101[_0x4baa('0x21')]],'as':_0x57c101['as'],'attributes':_0x57c101['attributes'],'include':_0x57c101[_0x4baa('0x1f')]?_[_0x4baa('0x20')](_0x57c101[_0x4baa('0x1f')],function(_0x5efecb){return{'model':db[_0x5efecb[_0x4baa('0x21')]],'as':_0x5efecb['as'],'attributes':_0x5efecb[_0x4baa('0x22')],'include':_0x5efecb[_0x4baa('0x1f')]?_[_0x4baa('0x20')](_0x5efecb[_0x4baa('0x1f')],function(_0x568d42){return{'model':db[_0x568d42[_0x4baa('0x21')]],'as':_0x568d42['as'],'attributes':_0x568d42[_0x4baa('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x91bd06){logger[_0x4baa('0xf')](_0x4baa('0x18'),_0x4c1a94);logger[_0x4baa('0x12')](_0x4baa('0x18'),_0x4c1a94,JSON['stringify'](_0x91bd06));_0x35295e(_0x91bd06);})[_0x4baa('0x17')](function(_0xdc0ece){logger['error'](_0x4baa('0x18'),_0xdc0ece['message'],_0x4c1a94);_0x56f364(_0x3e424b[_0x4baa('0x14')](0x1f4,_0xdc0ece[_0x4baa('0x15')]));});});};exports[_0x4baa('0x23')]=function(_0x292ec9){var _0x20e173=this;return new Promise(function(_0x592d57,_0x3687a3){return db[_0x4baa('0x19')]['find']({'raw':_0x292ec9[_0x4baa('0x1b')]?_0x292ec9[_0x4baa('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x292ec9[_0x4baa('0x1b')]?_0x292ec9['options'][_0x4baa('0x1d')]||null:null,'attributes':_0x292ec9[_0x4baa('0x1b')]?_0x292ec9[_0x4baa('0x1b')][_0x4baa('0x22')]||null:null,'include':_0x292ec9[_0x4baa('0x1b')]?_0x292ec9[_0x4baa('0x1b')][_0x4baa('0x1f')]?_[_0x4baa('0x20')](_0x292ec9['options'][_0x4baa('0x1f')],function(_0x22121e){return{'model':db[_0x22121e[_0x4baa('0x21')]],'as':_0x22121e['as'],'attributes':_0x22121e[_0x4baa('0x22')],'include':_0x22121e['include']?_[_0x4baa('0x20')](_0x22121e[_0x4baa('0x1f')],function(_0x4c33ad){return{'model':db[_0x4c33ad[_0x4baa('0x21')]],'as':_0x4c33ad['as'],'attributes':_0x4c33ad['attributes'],'include':_0x4c33ad[_0x4baa('0x1f')]?_['map'](_0x4c33ad[_0x4baa('0x1f')],function(_0xef31b9){return{'model':db[_0xef31b9['model']],'as':_0xef31b9['as'],'attributes':_0xef31b9[_0x4baa('0x22')]};}):[]};}):[]};}):[]:[]})[_0x4baa('0xe')](function(_0x55e728){logger[_0x4baa('0xf')](_0x4baa('0x23'),_0x292ec9);logger[_0x4baa('0x12')](_0x4baa('0x23'),_0x292ec9,JSON[_0x4baa('0x24')](_0x55e728));_0x592d57(_0x55e728);})[_0x4baa('0x17')](function(_0x5c7947){logger[_0x4baa('0x14')](_0x4baa('0x23'),_0x5c7947[_0x4baa('0x15')],_0x292ec9);_0x3687a3(_0x20e173[_0x4baa('0x14')](0x1f4,_0x5c7947[_0x4baa('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 90c3f5a..9ae4a0b 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 _0x4fc2=['get','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','/:id','show'];(function(_0x3eb197,_0xd5493e){var _0x4b53f4=function(_0x327c89){while(--_0x327c89){_0x3eb197['push'](_0x3eb197['shift']());}};_0x4b53f4(++_0xd5493e);}(_0x4fc2,0x111));var _0x24fc=function(_0x446737,_0x411246){_0x446737=_0x446737-0x0;var _0x575b95=_0x4fc2[_0x446737];return _0x575b95;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')](_0x24fc('0xe'),auth[_0x24fc('0x9')](),controller['getFields']);router[_0x24fc('0xd')](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x10')]);router[_0x24fc('0xd')](_0x24fc('0x11'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x12')]);router['get'](_0x24fc('0x13'),auth[_0x24fc('0x9')](),controller['getTags']);router[_0x24fc('0x14')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0x15')]);router[_0x24fc('0x14')](_0x24fc('0x13'),auth[_0x24fc('0x9')](),controller['setTags']);router[_0x24fc('0x16')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x17')]);router['delete'](_0x24fc('0xb'),auth['isAuthenticated'](),controller[_0x24fc('0x18')]);module[_0x24fc('0x19')]=router; \ No newline at end of file +var _0x5eb8=['getTags','post','/:id/tags','setTags','put','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x23250e,_0x5bbe16){var _0x530e54=function(_0x10aada){while(--_0x10aada){_0x23250e['push'](_0x23250e['shift']());}};_0x530e54(++_0x5bbe16);}(_0x5eb8,0xb0));var _0x85eb=function(_0x3b1106,_0x4bd523){_0x3b1106=_0x3b1106-0x0;var _0x1fbeef=_0x5eb8[_0x3b1106];return _0x1fbeef;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['get'](_0x85eb('0xe'),auth['isAuthenticated'](),controller[_0x85eb('0xf')]);router[_0x85eb('0x9')](_0x85eb('0x10'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x11')]);router[_0x85eb('0x9')](_0x85eb('0x12'),auth['isAuthenticated'](),controller[_0x85eb('0x13')]);router[_0x85eb('0x9')]('/:id/tags',auth[_0x85eb('0xa')](),controller[_0x85eb('0x14')]);router[_0x85eb('0x15')]('/',auth[_0x85eb('0xa')](),controller['create']);router['post'](_0x85eb('0x16'),auth['isAuthenticated'](),controller[_0x85eb('0x17')]);router[_0x85eb('0x18')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x19')]);router['delete'](_0x85eb('0xc'),auth['isAuthenticated'](),controller[_0x85eb('0x1a')]);module[_0x85eb('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 1e4e1eb..94346bf 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 _0x01aa=['STRING','sequelize','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x01aa,0x193));var _0xa01a=function(_0x492387,_0x433bd5){_0x492387=_0x492387-0x0;var _0x347d9a=_0x01aa[_0x492387];return _0x347d9a;};'use strict';var Sequelize=require(_0xa01a('0x0'));module[_0xa01a('0x1')]={'name':{'type':Sequelize[_0xa01a('0x2')]},'description':{'type':Sequelize[_0xa01a('0x2')]}}; \ No newline at end of file +var _0x911d=['STRING','sequelize','exports'];(function(_0x3efe82,_0x1c33f1){var _0x308e93=function(_0x1d6936){while(--_0x1d6936){_0x3efe82['push'](_0x3efe82['shift']());}};_0x308e93(++_0x1c33f1);}(_0x911d,0xac));var _0xd911=function(_0xe23db4,_0x125dd5){_0xe23db4=_0xe23db4-0x0;var _0x3906c2=_0x911d[_0xe23db4];return _0x3906c2;};'use strict';var Sequelize=require(_0xd911('0x0'));module[_0xd911('0x1')]={'name':{'type':Sequelize[_0xd911('0x2')]},'description':{'type':Sequelize[_0xd911('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 6742d91..4f34a41 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 _0x2fa9=['type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','fields','options','find','create','body','params','destroy','getFields','findOne','nolimit','getSubjects','ZendeskField','getDescriptions','getTags','Tag','setTags','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','update','then','name','send','index','map','ZendeskConfiguration','rawAttributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2fa9,0x1ee));var _0x92fa=function(_0x81250f,_0x68727d){_0x81250f=_0x81250f-0x0;var _0x53ec19=_0x2fa9[_0x81250f];return _0x53ec19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x92fa('0x0'));var zipdir=require(_0x92fa('0x1'));var jsonpatch=require(_0x92fa('0x2'));var rp=require(_0x92fa('0x3'));var moment=require(_0x92fa('0x4'));var BPromise=require(_0x92fa('0x5'));var Mustache=require(_0x92fa('0x6'));var util=require('util');var path=require(_0x92fa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x92fa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x92fa('0x9'));var squel=require(_0x92fa('0xa'));var crypto=require(_0x92fa('0xb'));var jsforce=require(_0x92fa('0xc'));var deskjs=require(_0x92fa('0xd'));var toCsv=require(_0x92fa('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x92fa('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x92fa('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x92fa('0x11'));var logger=require('../../config/logger')(_0x92fa('0x12'));var utils=require(_0x92fa('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x92fa('0x14'))['db'];function respondWithStatusCode(_0xdf1d4b,_0x37f9dd){_0x37f9dd=_0x37f9dd||0xcc;return function(_0x5ccaaf){if(_0x5ccaaf){return _0xdf1d4b[_0x92fa('0x15')](_0x37f9dd);}return _0xdf1d4b[_0x92fa('0x16')](_0x37f9dd)[_0x92fa('0x17')]();};}function respondWithResult(_0x135398,_0x59203e){_0x59203e=_0x59203e||0xc8;return function(_0x154cfa){if(_0x154cfa){return _0x135398[_0x92fa('0x16')](_0x59203e)['json'](_0x154cfa);}};}function respondWithFilteredResult(_0x448172,_0x5b46c9){return function(_0x3bbae3){if(_0x3bbae3){var _0x204ee4=typeof _0x5b46c9[_0x92fa('0x18')]===_0x92fa('0x19')&&typeof _0x5b46c9[_0x92fa('0x1a')]===_0x92fa('0x19');var _0x5420a2=_0x3bbae3[_0x92fa('0x1b')];var _0x2aebbf=_0x204ee4?0x0:_0x5b46c9[_0x92fa('0x18')];var _0x3932c6=_0x204ee4?_0x3bbae3[_0x92fa('0x1b')]:_0x5b46c9[_0x92fa('0x18')]+_0x5b46c9['limit'];var _0x508f24;if(_0x3932c6>=_0x5420a2){_0x3932c6=_0x5420a2;_0x508f24=0xc8;}else{_0x508f24=0xce;}_0x448172[_0x92fa('0x16')](_0x508f24);return _0x448172[_0x92fa('0x1c')](_0x92fa('0x1d'),_0x2aebbf+'-'+_0x3932c6+'/'+_0x5420a2)['json'](_0x3bbae3);}return null;};}function patchUpdates(_0x43e2c0){return function(_0x2ec14b){try{jsonpatch['apply'](_0x2ec14b,_0x43e2c0,!![]);}catch(_0x4a716d){return BPromise['reject'](_0x4a716d);}return _0x2ec14b['save']();};}function saveUpdates(_0xc8a9d4,_0x642229){return function(_0x4cd86e){if(_0x4cd86e){return _0x4cd86e[_0x92fa('0x1e')](_0xc8a9d4)[_0x92fa('0x1f')](function(_0x2e42e6){return _0x2e42e6;});}return null;};}function removeEntity(_0x446b63,_0x2893f7){return function(_0xd60088){if(_0xd60088){return _0xd60088['destroy']()[_0x92fa('0x1f')](function(){_0x446b63[_0x92fa('0x16')](0xcc)[_0x92fa('0x17')]();});}};}function handleEntityNotFound(_0x28bbe0,_0xcba3bc){return function(_0x49774c){if(!_0x49774c){_0x28bbe0[_0x92fa('0x15')](0x194);}return _0x49774c;};}function handleError(_0x5f2050,_0x5d90e5){_0x5d90e5=_0x5d90e5||0x1f4;return function(_0x46384d){logger['error'](_0x46384d['stack']);if(_0x46384d[_0x92fa('0x20')]){delete _0x46384d['name'];}_0x5f2050[_0x92fa('0x16')](_0x5d90e5)[_0x92fa('0x21')](_0x46384d);};}exports[_0x92fa('0x22')]=function(_0x3abeff,_0x13e03b){var _0x1f3086={},_0x1403cc={},_0x170b1f={'count':0x0,'rows':[]};var _0xd3b1da=_[_0x92fa('0x23')](db[_0x92fa('0x24')][_0x92fa('0x25')],function(_0x2bfebb){return{'name':_0x2bfebb['fieldName'],'type':_0x2bfebb[_0x92fa('0x26')][_0x92fa('0x27')]};});_0x1403cc['model']=_[_0x92fa('0x23')](_0xd3b1da,_0x92fa('0x20'));_0x1403cc[_0x92fa('0x28')]=_[_0x92fa('0x29')](_0x3abeff[_0x92fa('0x28')]);_0x1403cc[_0x92fa('0x2a')]=_[_0x92fa('0x2b')](_0x1403cc[_0x92fa('0x2c')],_0x1403cc['query']);_0x1f3086[_0x92fa('0x2d')]=_['intersection'](_0x1403cc[_0x92fa('0x2c')],qs['fields'](_0x3abeff[_0x92fa('0x28')]['fields']));_0x1f3086[_0x92fa('0x2d')]=_0x1f3086['attributes'][_0x92fa('0x2e')]?_0x1f3086[_0x92fa('0x2d')]:_0x1403cc[_0x92fa('0x2c')];if(!_0x3abeff[_0x92fa('0x28')][_0x92fa('0x2f')]('nolimit')){_0x1f3086[_0x92fa('0x1a')]=qs['limit'](_0x3abeff['query']['limit']);_0x1f3086[_0x92fa('0x18')]=qs[_0x92fa('0x18')](_0x3abeff[_0x92fa('0x28')][_0x92fa('0x18')]);}_0x1f3086[_0x92fa('0x30')]=qs['sort'](_0x3abeff['query'][_0x92fa('0x31')]);_0x1f3086[_0x92fa('0x32')]=qs['filters'](_[_0x92fa('0x33')](_0x3abeff['query'],_0x1403cc[_0x92fa('0x2a')]),_0xd3b1da);if(_0x3abeff[_0x92fa('0x28')][_0x92fa('0x34')]){_0x1f3086[_0x92fa('0x32')]=_[_0x92fa('0x35')](_0x1f3086[_0x92fa('0x32')],{'$or':_['map'](_0xd3b1da,function(_0x484023){if(_0x484023[_0x92fa('0x26')]!==_0x92fa('0x36')){var _0x561376={};_0x561376[_0x484023[_0x92fa('0x20')]]={'$like':'%'+_0x3abeff['query'][_0x92fa('0x34')]+'%'};return _0x561376;}})});}_0x1f3086=_['merge']({},_0x1f3086,_0x3abeff['options']);var _0x3e844e={'where':_0x1f3086['where']};return db[_0x92fa('0x24')][_0x92fa('0x1b')](_0x3e844e)[_0x92fa('0x1f')](function(_0x15458e){_0x170b1f[_0x92fa('0x1b')]=_0x15458e;if(_0x3abeff[_0x92fa('0x28')][_0x92fa('0x37')]){_0x1f3086[_0x92fa('0x38')]=[{'all':!![]}];}return db[_0x92fa('0x24')][_0x92fa('0x39')](_0x1f3086);})[_0x92fa('0x1f')](function(_0x2f9fce){_0x170b1f['rows']=_0x2f9fce;return _0x170b1f;})['then'](respondWithFilteredResult(_0x13e03b,_0x1f3086))[_0x92fa('0x3a')](handleError(_0x13e03b,null));};exports[_0x92fa('0x3b')]=function(_0x46eba9,_0x2542be){var _0x4f52cc={'raw':![],'where':{'id':_0x46eba9['params']['id']}},_0x46bb23={};_0x46bb23[_0x92fa('0x2c')]=_[_0x92fa('0x29')](db[_0x92fa('0x24')]['rawAttributes']);_0x46bb23[_0x92fa('0x28')]=_['keys'](_0x46eba9[_0x92fa('0x28')]);_0x46bb23[_0x92fa('0x2a')]=_[_0x92fa('0x2b')](_0x46bb23[_0x92fa('0x2c')],_0x46bb23[_0x92fa('0x28')]);_0x4f52cc[_0x92fa('0x2d')]=_['intersection'](_0x46bb23[_0x92fa('0x2c')],qs[_0x92fa('0x3c')](_0x46eba9[_0x92fa('0x28')][_0x92fa('0x3c')]));_0x4f52cc[_0x92fa('0x2d')]=_0x4f52cc[_0x92fa('0x2d')][_0x92fa('0x2e')]?_0x4f52cc[_0x92fa('0x2d')]:_0x46bb23['model'];if(_0x46eba9[_0x92fa('0x28')][_0x92fa('0x37')]){_0x4f52cc[_0x92fa('0x38')]=[{'all':!![]}];}_0x4f52cc=_[_0x92fa('0x35')]({},_0x4f52cc,_0x46eba9[_0x92fa('0x3d')]);return db[_0x92fa('0x24')][_0x92fa('0x3e')](_0x4f52cc)[_0x92fa('0x1f')](handleEntityNotFound(_0x2542be,null))[_0x92fa('0x1f')](respondWithResult(_0x2542be,null))[_0x92fa('0x3a')](handleError(_0x2542be,null));};exports[_0x92fa('0x3f')]=function(_0x3429f7,_0x45ce54){return db[_0x92fa('0x24')][_0x92fa('0x3f')](_0x3429f7[_0x92fa('0x40')],{})[_0x92fa('0x1f')](respondWithResult(_0x45ce54,0xc9))[_0x92fa('0x3a')](handleError(_0x45ce54,null));};exports[_0x92fa('0x1e')]=function(_0x56385f,_0x46ee06){if(_0x56385f['body']['id']){delete _0x56385f[_0x92fa('0x40')]['id'];}return db[_0x92fa('0x24')][_0x92fa('0x3e')]({'where':{'id':_0x56385f[_0x92fa('0x41')]['id']}})[_0x92fa('0x1f')](handleEntityNotFound(_0x46ee06,null))['then'](saveUpdates(_0x56385f['body'],null))[_0x92fa('0x1f')](respondWithResult(_0x46ee06,null))['catch'](handleError(_0x46ee06,null));};exports[_0x92fa('0x42')]=function(_0x51d56e,_0x109441){return db[_0x92fa('0x24')][_0x92fa('0x3e')]({'where':{'id':_0x51d56e['params']['id']}})[_0x92fa('0x1f')](handleEntityNotFound(_0x109441,null))[_0x92fa('0x1f')](removeEntity(_0x109441,null))['catch'](handleError(_0x109441,null));};exports[_0x92fa('0x43')]=function(_0x37544c,_0x2a08b4,_0x3cd46c){var _0x2b2923={};var _0x16a172={};var _0x51f532;var _0x428b98;return db[_0x92fa('0x24')][_0x92fa('0x44')]({'where':{'id':_0x37544c[_0x92fa('0x41')]['id']}})[_0x92fa('0x1f')](handleEntityNotFound(_0x2a08b4,null))[_0x92fa('0x1f')](function(_0x2ae3a2){if(_0x2ae3a2){_0x51f532=_0x2ae3a2;_0x16a172[_0x92fa('0x2c')]=_[_0x92fa('0x29')](db['ZendeskField']['rawAttributes']);_0x16a172[_0x92fa('0x28')]=_[_0x92fa('0x29')](_0x37544c['query']);_0x16a172[_0x92fa('0x2a')]=_[_0x92fa('0x2b')](_0x16a172[_0x92fa('0x2c')],_0x16a172[_0x92fa('0x28')]);_0x2b2923[_0x92fa('0x2d')]=_['intersection'](_0x16a172[_0x92fa('0x2c')],qs['fields'](_0x37544c[_0x92fa('0x28')]['fields']));_0x2b2923['attributes']=_0x2b2923['attributes'][_0x92fa('0x2e')]?_0x2b2923['attributes']:_0x16a172[_0x92fa('0x2c')];_0x2b2923['order']=qs[_0x92fa('0x31')](_0x37544c['query'][_0x92fa('0x31')]);_0x2b2923['where']=qs[_0x92fa('0x2a')](_[_0x92fa('0x33')](_0x37544c[_0x92fa('0x28')],_0x16a172[_0x92fa('0x2a')]));if(_0x37544c[_0x92fa('0x28')]['filter']){_0x2b2923[_0x92fa('0x32')]=_[_0x92fa('0x35')](_0x2b2923[_0x92fa('0x32')],{'$or':_['map'](_0x2b2923['attributes'],function(_0x2e5b75){var _0x551b82={};_0x551b82[_0x2e5b75]={'$like':'%'+_0x37544c['query']['filter']+'%'};return _0x551b82;})});}_0x2b2923=_[_0x92fa('0x35')]({},_0x2b2923,_0x37544c[_0x92fa('0x3d')]);return _0x51f532[_0x92fa('0x43')](_0x2b2923);}})[_0x92fa('0x1f')](function(_0x3c722){if(_0x3c722){_0x428b98=_0x3c722[_0x92fa('0x2e')];if(!_0x37544c[_0x92fa('0x28')][_0x92fa('0x2f')](_0x92fa('0x45'))){_0x2b2923['limit']=qs[_0x92fa('0x1a')](_0x37544c[_0x92fa('0x28')][_0x92fa('0x1a')]);_0x2b2923[_0x92fa('0x18')]=qs[_0x92fa('0x18')](_0x37544c[_0x92fa('0x28')]['offset']);}return _0x51f532[_0x92fa('0x43')](_0x2b2923);}})[_0x92fa('0x1f')](function(_0x2b0166){if(_0x2b0166){return _0x2b0166?{'count':_0x428b98,'rows':_0x2b0166}:null;}})[_0x92fa('0x1f')](respondWithResult(_0x2a08b4,null))[_0x92fa('0x3a')](handleError(_0x2a08b4,null));};exports[_0x92fa('0x46')]=function(_0x18d184,_0x366c24,_0x4e7dab){var _0x49ed52={};var _0xa45965={};var _0x25b350;var _0x5a843f;return db['ZendeskConfiguration'][_0x92fa('0x44')]({'where':{'id':_0x18d184[_0x92fa('0x41')]['id']}})['then'](handleEntityNotFound(_0x366c24,null))[_0x92fa('0x1f')](function(_0xaed28c){if(_0xaed28c){_0x25b350=_0xaed28c;_0xa45965[_0x92fa('0x2c')]=_[_0x92fa('0x29')](db[_0x92fa('0x47')][_0x92fa('0x25')]);_0xa45965[_0x92fa('0x28')]=_[_0x92fa('0x29')](_0x18d184[_0x92fa('0x28')]);_0xa45965['filters']=_['intersection'](_0xa45965[_0x92fa('0x2c')],_0xa45965[_0x92fa('0x28')]);_0x49ed52['attributes']=_[_0x92fa('0x2b')](_0xa45965['model'],qs['fields'](_0x18d184[_0x92fa('0x28')][_0x92fa('0x3c')]));_0x49ed52[_0x92fa('0x2d')]=_0x49ed52[_0x92fa('0x2d')][_0x92fa('0x2e')]?_0x49ed52[_0x92fa('0x2d')]:_0xa45965[_0x92fa('0x2c')];_0x49ed52[_0x92fa('0x30')]=qs[_0x92fa('0x31')](_0x18d184[_0x92fa('0x28')][_0x92fa('0x31')]);_0x49ed52['where']=qs[_0x92fa('0x2a')](_[_0x92fa('0x33')](_0x18d184['query'],_0xa45965[_0x92fa('0x2a')]));if(_0x18d184[_0x92fa('0x28')][_0x92fa('0x34')]){_0x49ed52[_0x92fa('0x32')]=_['merge'](_0x49ed52[_0x92fa('0x32')],{'$or':_[_0x92fa('0x23')](_0x49ed52[_0x92fa('0x2d')],function(_0x496228){var _0x353fa7={};_0x353fa7[_0x496228]={'$like':'%'+_0x18d184[_0x92fa('0x28')][_0x92fa('0x34')]+'%'};return _0x353fa7;})});}_0x49ed52=_[_0x92fa('0x35')]({},_0x49ed52,_0x18d184[_0x92fa('0x3d')]);return _0x25b350[_0x92fa('0x46')](_0x49ed52);}})[_0x92fa('0x1f')](function(_0x4535ba){if(_0x4535ba){_0x5a843f=_0x4535ba[_0x92fa('0x2e')];if(!_0x18d184[_0x92fa('0x28')][_0x92fa('0x2f')](_0x92fa('0x45'))){_0x49ed52['limit']=qs[_0x92fa('0x1a')](_0x18d184[_0x92fa('0x28')]['limit']);_0x49ed52[_0x92fa('0x18')]=qs[_0x92fa('0x18')](_0x18d184[_0x92fa('0x28')][_0x92fa('0x18')]);}return _0x25b350[_0x92fa('0x46')](_0x49ed52);}})[_0x92fa('0x1f')](function(_0x2cfcd0){if(_0x2cfcd0){return _0x2cfcd0?{'count':_0x5a843f,'rows':_0x2cfcd0}:null;}})[_0x92fa('0x1f')](respondWithResult(_0x366c24,null))[_0x92fa('0x3a')](handleError(_0x366c24,null));};exports[_0x92fa('0x48')]=function(_0x38e427,_0x143239,_0x181bb3){var _0x45d0d2={};var _0x24a0fc={};var _0x16e80a;var _0x2521be;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x38e427[_0x92fa('0x41')]['id']}})['then'](handleEntityNotFound(_0x143239,null))['then'](function(_0x19d0a0){if(_0x19d0a0){_0x16e80a=_0x19d0a0;_0x24a0fc[_0x92fa('0x2c')]=_[_0x92fa('0x29')](db[_0x92fa('0x47')][_0x92fa('0x25')]);_0x24a0fc[_0x92fa('0x28')]=_[_0x92fa('0x29')](_0x38e427[_0x92fa('0x28')]);_0x24a0fc[_0x92fa('0x2a')]=_[_0x92fa('0x2b')](_0x24a0fc[_0x92fa('0x2c')],_0x24a0fc[_0x92fa('0x28')]);_0x45d0d2[_0x92fa('0x2d')]=_[_0x92fa('0x2b')](_0x24a0fc[_0x92fa('0x2c')],qs[_0x92fa('0x3c')](_0x38e427[_0x92fa('0x28')][_0x92fa('0x3c')]));_0x45d0d2[_0x92fa('0x2d')]=_0x45d0d2[_0x92fa('0x2d')][_0x92fa('0x2e')]?_0x45d0d2[_0x92fa('0x2d')]:_0x24a0fc['model'];_0x45d0d2['order']=qs['sort'](_0x38e427[_0x92fa('0x28')][_0x92fa('0x31')]);_0x45d0d2['where']=qs['filters'](_[_0x92fa('0x33')](_0x38e427[_0x92fa('0x28')],_0x24a0fc[_0x92fa('0x2a')]));if(_0x38e427[_0x92fa('0x28')][_0x92fa('0x34')]){_0x45d0d2['where']=_[_0x92fa('0x35')](_0x45d0d2[_0x92fa('0x32')],{'$or':_[_0x92fa('0x23')](_0x45d0d2['attributes'],function(_0x2123d8){var _0x5d9d70={};_0x5d9d70[_0x2123d8]={'$like':'%'+_0x38e427[_0x92fa('0x28')][_0x92fa('0x34')]+'%'};return _0x5d9d70;})});}_0x45d0d2=_[_0x92fa('0x35')]({},_0x45d0d2,_0x38e427['options']);return _0x16e80a['getDescriptions'](_0x45d0d2);}})['then'](function(_0x163c46){if(_0x163c46){_0x2521be=_0x163c46[_0x92fa('0x2e')];if(!_0x38e427[_0x92fa('0x28')][_0x92fa('0x2f')]('nolimit')){_0x45d0d2[_0x92fa('0x1a')]=qs['limit'](_0x38e427[_0x92fa('0x28')][_0x92fa('0x1a')]);_0x45d0d2['offset']=qs['offset'](_0x38e427[_0x92fa('0x28')]['offset']);}return _0x16e80a[_0x92fa('0x48')](_0x45d0d2);}})[_0x92fa('0x1f')](function(_0x4bf62b){if(_0x4bf62b){return _0x4bf62b?{'count':_0x2521be,'rows':_0x4bf62b}:null;}})[_0x92fa('0x1f')](respondWithResult(_0x143239,null))[_0x92fa('0x3a')](handleError(_0x143239,null));};exports[_0x92fa('0x49')]=function(_0x1423ea,_0x3d77e3,_0x12f1dd){var _0x23147f={};var _0x29acaa={};var _0x2b942e;var _0x429973;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x1423ea[_0x92fa('0x41')]['id']}})[_0x92fa('0x1f')](handleEntityNotFound(_0x3d77e3,null))['then'](function(_0xe30c9a){if(_0xe30c9a){_0x2b942e=_0xe30c9a;_0x29acaa[_0x92fa('0x2c')]=_[_0x92fa('0x29')](db[_0x92fa('0x4a')]['rawAttributes']);_0x29acaa[_0x92fa('0x28')]=_[_0x92fa('0x29')](_0x1423ea[_0x92fa('0x28')]);_0x29acaa['filters']=_[_0x92fa('0x2b')](_0x29acaa['model'],_0x29acaa[_0x92fa('0x28')]);_0x23147f[_0x92fa('0x2d')]=_['intersection'](_0x29acaa['model'],qs[_0x92fa('0x3c')](_0x1423ea[_0x92fa('0x28')][_0x92fa('0x3c')]));_0x23147f[_0x92fa('0x2d')]=_0x23147f[_0x92fa('0x2d')][_0x92fa('0x2e')]?_0x23147f[_0x92fa('0x2d')]:_0x29acaa[_0x92fa('0x2c')];_0x23147f[_0x92fa('0x30')]=qs[_0x92fa('0x31')](_0x1423ea[_0x92fa('0x28')]['sort']);_0x23147f[_0x92fa('0x32')]=qs[_0x92fa('0x2a')](_[_0x92fa('0x33')](_0x1423ea['query'],_0x29acaa[_0x92fa('0x2a')]));if(_0x1423ea[_0x92fa('0x28')][_0x92fa('0x34')]){_0x23147f[_0x92fa('0x32')]=_[_0x92fa('0x35')](_0x23147f[_0x92fa('0x32')],{'$or':_['map'](_0x23147f['attributes'],function(_0x5b4f3d){var _0x3b5c7a={};_0x3b5c7a[_0x5b4f3d]={'$like':'%'+_0x1423ea[_0x92fa('0x28')][_0x92fa('0x34')]+'%'};return _0x3b5c7a;})});}_0x23147f=_['merge']({},_0x23147f,_0x1423ea[_0x92fa('0x3d')]);return _0x2b942e['getTags'](_0x23147f);}})[_0x92fa('0x1f')](function(_0x34eae3){if(_0x34eae3){_0x429973=_0x34eae3['length'];if(!_0x1423ea['query'][_0x92fa('0x2f')](_0x92fa('0x45'))){_0x23147f[_0x92fa('0x1a')]=qs['limit'](_0x1423ea[_0x92fa('0x28')][_0x92fa('0x1a')]);_0x23147f[_0x92fa('0x18')]=qs[_0x92fa('0x18')](_0x1423ea['query'][_0x92fa('0x18')]);}return _0x2b942e[_0x92fa('0x49')](_0x23147f);}})[_0x92fa('0x1f')](function(_0x483a38){if(_0x483a38){return _0x483a38?{'count':_0x429973,'rows':_0x483a38}:null;}})[_0x92fa('0x1f')](respondWithResult(_0x3d77e3,null))[_0x92fa('0x3a')](handleError(_0x3d77e3,null));};exports[_0x92fa('0x4b')]=function(_0xcce999,_0x237c0e,_0x3f7d86){if(_0xcce999[_0x92fa('0x40')]['id']){delete _0xcce999[_0x92fa('0x40')]['id'];}return db[_0x92fa('0x24')]['findOne']({'where':{'id':_0xcce999[_0x92fa('0x41')]['id']}})[_0x92fa('0x1f')](handleEntityNotFound(_0x237c0e,null))[_0x92fa('0x1f')](function(_0x2a7a07){if(_0x2a7a07){return _0x2a7a07[_0x92fa('0x4b')](_0xcce999[_0x92fa('0x40')]['ids']||[]);}return null;})[_0x92fa('0x1f')](respondWithResult(_0x237c0e,null))[_0x92fa('0x3a')](handleError(_0x237c0e,null));}; \ No newline at end of file +var _0xa1ff=['ids','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','json','reject','save','update','destroy','error','stack','name','send','ZendeskConfiguration','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','then','show','params','keys','rawAttributes','include','find','create','catch','body','findOne','ZendeskField','getFields','getSubjects','getDescriptions','getTags','Tag','setTags'];(function(_0x30c21c,_0x500a39){var _0x232560=function(_0x474667){while(--_0x474667){_0x30c21c['push'](_0x30c21c['shift']());}};_0x232560(++_0x500a39);}(_0xa1ff,0x1aa));var _0xfa1f=function(_0x1a14c4,_0x2dabb0){_0x1a14c4=_0x1a14c4-0x0;var _0x2a407d=_0xa1ff[_0x1a14c4];return _0x2a407d;};'use strict';var emlformat=require(_0xfa1f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfa1f('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfa1f('0x2'));var Mustache=require(_0xfa1f('0x3'));var util=require(_0xfa1f('0x4'));var path=require(_0xfa1f('0x5'));var sox=require(_0xfa1f('0x6'));var csv=require(_0xfa1f('0x7'));var ejs=require(_0xfa1f('0x8'));var fs=require('fs');var fs_extra=require(_0xfa1f('0x9'));var _=require(_0xfa1f('0xa'));var squel=require(_0xfa1f('0xb'));var crypto=require('crypto');var jsforce=require(_0xfa1f('0xc'));var deskjs=require(_0xfa1f('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfa1f('0xe'));var Papa=require(_0xfa1f('0xf'));var Redis=require(_0xfa1f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfa1f('0x11'));var logger=require(_0xfa1f('0x12'))(_0xfa1f('0x13'));var utils=require(_0xfa1f('0x14'));var config=require(_0xfa1f('0x15'));var licenseUtil=require(_0xfa1f('0x16'));var db=require(_0xfa1f('0x17'))['db'];function respondWithStatusCode(_0x1406be,_0x21a3be){_0x21a3be=_0x21a3be||0xcc;return function(_0x3742eb){if(_0x3742eb){return _0x1406be[_0xfa1f('0x18')](_0x21a3be);}return _0x1406be[_0xfa1f('0x19')](_0x21a3be)[_0xfa1f('0x1a')]();};}function respondWithResult(_0x5c9ab5,_0xe73ae2){_0xe73ae2=_0xe73ae2||0xc8;return function(_0xebc232){if(_0xebc232){return _0x5c9ab5['status'](_0xe73ae2)['json'](_0xebc232);}};}function respondWithFilteredResult(_0x39f552,_0x573ff4){return function(_0x4f8c88){if(_0x4f8c88){var _0x509037=typeof _0x573ff4[_0xfa1f('0x1b')]===_0xfa1f('0x1c')&&typeof _0x573ff4['limit']===_0xfa1f('0x1c');var _0x359add=_0x4f8c88[_0xfa1f('0x1d')];var _0x1baa95=_0x509037?0x0:_0x573ff4[_0xfa1f('0x1b')];var _0x81dd4f=_0x509037?_0x4f8c88[_0xfa1f('0x1d')]:_0x573ff4[_0xfa1f('0x1b')]+_0x573ff4[_0xfa1f('0x1e')];var _0x502df8;if(_0x81dd4f>=_0x359add){_0x81dd4f=_0x359add;_0x502df8=0xc8;}else{_0x502df8=0xce;}_0x39f552[_0xfa1f('0x19')](_0x502df8);return _0x39f552[_0xfa1f('0x1f')]('Content-Range',_0x1baa95+'-'+_0x81dd4f+'/'+_0x359add)[_0xfa1f('0x20')](_0x4f8c88);}return null;};}function patchUpdates(_0x56e4eb){return function(_0x36487c){try{jsonpatch['apply'](_0x36487c,_0x56e4eb,!![]);}catch(_0x5396ae){return BPromise[_0xfa1f('0x21')](_0x5396ae);}return _0x36487c[_0xfa1f('0x22')]();};}function saveUpdates(_0x262345,_0x4e97c0){return function(_0x207181){if(_0x207181){return _0x207181[_0xfa1f('0x23')](_0x262345)['then'](function(_0x1d5ca9){return _0x1d5ca9;});}return null;};}function removeEntity(_0x2d5b5f,_0xfe5645){return function(_0x456b1e){if(_0x456b1e){return _0x456b1e[_0xfa1f('0x24')]()['then'](function(){_0x2d5b5f[_0xfa1f('0x19')](0xcc)[_0xfa1f('0x1a')]();});}};}function handleEntityNotFound(_0x3bedac,_0x5f338d){return function(_0x418e79){if(!_0x418e79){_0x3bedac[_0xfa1f('0x18')](0x194);}return _0x418e79;};}function handleError(_0x213874,_0x3caff7){_0x3caff7=_0x3caff7||0x1f4;return function(_0x2c0eb5){logger[_0xfa1f('0x25')](_0x2c0eb5[_0xfa1f('0x26')]);if(_0x2c0eb5[_0xfa1f('0x27')]){delete _0x2c0eb5[_0xfa1f('0x27')];}_0x213874[_0xfa1f('0x19')](_0x3caff7)[_0xfa1f('0x28')](_0x2c0eb5);};}exports['index']=function(_0x1059d6,_0x785b27){var _0x3028d9={},_0x4d0d20={},_0x32b287={'count':0x0,'rows':[]};var _0x22be87=_['map'](db[_0xfa1f('0x29')]['rawAttributes'],function(_0x5674f1){return{'name':_0x5674f1[_0xfa1f('0x2a')],'type':_0x5674f1[_0xfa1f('0x2b')][_0xfa1f('0x2c')]};});_0x4d0d20[_0xfa1f('0x2d')]=_[_0xfa1f('0x2e')](_0x22be87,_0xfa1f('0x27'));_0x4d0d20['query']=_['keys'](_0x1059d6[_0xfa1f('0x2f')]);_0x4d0d20[_0xfa1f('0x30')]=_[_0xfa1f('0x31')](_0x4d0d20[_0xfa1f('0x2d')],_0x4d0d20[_0xfa1f('0x2f')]);_0x3028d9[_0xfa1f('0x32')]=_[_0xfa1f('0x31')](_0x4d0d20['model'],qs['fields'](_0x1059d6[_0xfa1f('0x2f')][_0xfa1f('0x33')]));_0x3028d9[_0xfa1f('0x32')]=_0x3028d9[_0xfa1f('0x32')][_0xfa1f('0x34')]?_0x3028d9[_0xfa1f('0x32')]:_0x4d0d20[_0xfa1f('0x2d')];if(!_0x1059d6['query'][_0xfa1f('0x35')](_0xfa1f('0x36'))){_0x3028d9['limit']=qs[_0xfa1f('0x1e')](_0x1059d6[_0xfa1f('0x2f')][_0xfa1f('0x1e')]);_0x3028d9[_0xfa1f('0x1b')]=qs[_0xfa1f('0x1b')](_0x1059d6[_0xfa1f('0x2f')]['offset']);}_0x3028d9[_0xfa1f('0x37')]=qs[_0xfa1f('0x38')](_0x1059d6['query'][_0xfa1f('0x38')]);_0x3028d9[_0xfa1f('0x39')]=qs[_0xfa1f('0x30')](_[_0xfa1f('0x3a')](_0x1059d6[_0xfa1f('0x2f')],_0x4d0d20[_0xfa1f('0x30')]),_0x22be87);if(_0x1059d6[_0xfa1f('0x2f')][_0xfa1f('0x3b')]){_0x3028d9[_0xfa1f('0x39')]=_[_0xfa1f('0x3c')](_0x3028d9[_0xfa1f('0x39')],{'$or':_[_0xfa1f('0x2e')](_0x22be87,function(_0x30d755){if(_0x30d755[_0xfa1f('0x2b')]!==_0xfa1f('0x3d')){var _0x2f268a={};_0x2f268a[_0x30d755[_0xfa1f('0x27')]]={'$like':'%'+_0x1059d6['query']['filter']+'%'};return _0x2f268a;}})});}_0x3028d9=_[_0xfa1f('0x3c')]({},_0x3028d9,_0x1059d6[_0xfa1f('0x3e')]);var _0x782d2e={'where':_0x3028d9[_0xfa1f('0x39')]};return db[_0xfa1f('0x29')][_0xfa1f('0x1d')](_0x782d2e)['then'](function(_0xd83792){_0x32b287['count']=_0xd83792;if(_0x1059d6[_0xfa1f('0x2f')][_0xfa1f('0x3f')]){_0x3028d9['include']=[{'all':!![]}];}return db[_0xfa1f('0x29')][_0xfa1f('0x40')](_0x3028d9);})['then'](function(_0x5344c0){_0x32b287[_0xfa1f('0x41')]=_0x5344c0;return _0x32b287;})[_0xfa1f('0x42')](respondWithFilteredResult(_0x785b27,_0x3028d9))['catch'](handleError(_0x785b27,null));};exports[_0xfa1f('0x43')]=function(_0x2f6431,_0x2c9036){var _0x24b97b={'raw':![],'where':{'id':_0x2f6431[_0xfa1f('0x44')]['id']}},_0x3f095f={};_0x3f095f[_0xfa1f('0x2d')]=_[_0xfa1f('0x45')](db[_0xfa1f('0x29')][_0xfa1f('0x46')]);_0x3f095f['query']=_[_0xfa1f('0x45')](_0x2f6431['query']);_0x3f095f[_0xfa1f('0x30')]=_[_0xfa1f('0x31')](_0x3f095f[_0xfa1f('0x2d')],_0x3f095f['query']);_0x24b97b[_0xfa1f('0x32')]=_[_0xfa1f('0x31')](_0x3f095f[_0xfa1f('0x2d')],qs[_0xfa1f('0x33')](_0x2f6431[_0xfa1f('0x2f')][_0xfa1f('0x33')]));_0x24b97b[_0xfa1f('0x32')]=_0x24b97b[_0xfa1f('0x32')][_0xfa1f('0x34')]?_0x24b97b['attributes']:_0x3f095f['model'];if(_0x2f6431[_0xfa1f('0x2f')][_0xfa1f('0x3f')]){_0x24b97b[_0xfa1f('0x47')]=[{'all':!![]}];}_0x24b97b=_[_0xfa1f('0x3c')]({},_0x24b97b,_0x2f6431[_0xfa1f('0x3e')]);return db['ZendeskConfiguration'][_0xfa1f('0x48')](_0x24b97b)['then'](handleEntityNotFound(_0x2c9036,null))['then'](respondWithResult(_0x2c9036,null))['catch'](handleError(_0x2c9036,null));};exports[_0xfa1f('0x49')]=function(_0x14b45a,_0x460fab){return db[_0xfa1f('0x29')]['create'](_0x14b45a['body'],{})[_0xfa1f('0x42')](respondWithResult(_0x460fab,0xc9))[_0xfa1f('0x4a')](handleError(_0x460fab,null));};exports['update']=function(_0x4f8d56,_0x1ba9df){if(_0x4f8d56[_0xfa1f('0x4b')]['id']){delete _0x4f8d56[_0xfa1f('0x4b')]['id'];}return db[_0xfa1f('0x29')][_0xfa1f('0x48')]({'where':{'id':_0x4f8d56['params']['id']}})[_0xfa1f('0x42')](handleEntityNotFound(_0x1ba9df,null))[_0xfa1f('0x42')](saveUpdates(_0x4f8d56[_0xfa1f('0x4b')],null))[_0xfa1f('0x42')](respondWithResult(_0x1ba9df,null))[_0xfa1f('0x4a')](handleError(_0x1ba9df,null));};exports[_0xfa1f('0x24')]=function(_0x37fae7,_0x251597){return db[_0xfa1f('0x29')][_0xfa1f('0x48')]({'where':{'id':_0x37fae7[_0xfa1f('0x44')]['id']}})['then'](handleEntityNotFound(_0x251597,null))['then'](removeEntity(_0x251597,null))[_0xfa1f('0x4a')](handleError(_0x251597,null));};exports['getFields']=function(_0x1ce0fd,_0x3681e6,_0x5a074e){var _0x4a9896={};var _0xa8c259={};var _0x42fc8f;var _0x4357c1;return db['ZendeskConfiguration'][_0xfa1f('0x4c')]({'where':{'id':_0x1ce0fd[_0xfa1f('0x44')]['id']}})[_0xfa1f('0x42')](handleEntityNotFound(_0x3681e6,null))['then'](function(_0xe0e0a0){if(_0xe0e0a0){_0x42fc8f=_0xe0e0a0;_0xa8c259[_0xfa1f('0x2d')]=_[_0xfa1f('0x45')](db[_0xfa1f('0x4d')][_0xfa1f('0x46')]);_0xa8c259['query']=_['keys'](_0x1ce0fd[_0xfa1f('0x2f')]);_0xa8c259[_0xfa1f('0x30')]=_[_0xfa1f('0x31')](_0xa8c259['model'],_0xa8c259[_0xfa1f('0x2f')]);_0x4a9896['attributes']=_[_0xfa1f('0x31')](_0xa8c259[_0xfa1f('0x2d')],qs[_0xfa1f('0x33')](_0x1ce0fd[_0xfa1f('0x2f')][_0xfa1f('0x33')]));_0x4a9896[_0xfa1f('0x32')]=_0x4a9896['attributes']['length']?_0x4a9896[_0xfa1f('0x32')]:_0xa8c259['model'];_0x4a9896[_0xfa1f('0x37')]=qs['sort'](_0x1ce0fd['query']['sort']);_0x4a9896['where']=qs[_0xfa1f('0x30')](_[_0xfa1f('0x3a')](_0x1ce0fd[_0xfa1f('0x2f')],_0xa8c259[_0xfa1f('0x30')]));if(_0x1ce0fd[_0xfa1f('0x2f')][_0xfa1f('0x3b')]){_0x4a9896[_0xfa1f('0x39')]=_[_0xfa1f('0x3c')](_0x4a9896[_0xfa1f('0x39')],{'$or':_[_0xfa1f('0x2e')](_0x4a9896[_0xfa1f('0x32')],function(_0x17d062){var _0x16cf2e={};_0x16cf2e[_0x17d062]={'$like':'%'+_0x1ce0fd[_0xfa1f('0x2f')][_0xfa1f('0x3b')]+'%'};return _0x16cf2e;})});}_0x4a9896=_[_0xfa1f('0x3c')]({},_0x4a9896,_0x1ce0fd[_0xfa1f('0x3e')]);return _0x42fc8f['getFields'](_0x4a9896);}})['then'](function(_0x530c9e){if(_0x530c9e){_0x4357c1=_0x530c9e[_0xfa1f('0x34')];if(!_0x1ce0fd[_0xfa1f('0x2f')][_0xfa1f('0x35')](_0xfa1f('0x36'))){_0x4a9896['limit']=qs[_0xfa1f('0x1e')](_0x1ce0fd['query'][_0xfa1f('0x1e')]);_0x4a9896[_0xfa1f('0x1b')]=qs[_0xfa1f('0x1b')](_0x1ce0fd[_0xfa1f('0x2f')][_0xfa1f('0x1b')]);}return _0x42fc8f[_0xfa1f('0x4e')](_0x4a9896);}})[_0xfa1f('0x42')](function(_0x2f3148){if(_0x2f3148){return _0x2f3148?{'count':_0x4357c1,'rows':_0x2f3148}:null;}})[_0xfa1f('0x42')](respondWithResult(_0x3681e6,null))[_0xfa1f('0x4a')](handleError(_0x3681e6,null));};exports[_0xfa1f('0x4f')]=function(_0x160ab8,_0x59a91b,_0x1b5300){var _0x346cc5={};var _0x37dd83={};var _0x1a03b9;var _0x22acfd;return db[_0xfa1f('0x29')]['findOne']({'where':{'id':_0x160ab8['params']['id']}})[_0xfa1f('0x42')](handleEntityNotFound(_0x59a91b,null))['then'](function(_0x1ac8b6){if(_0x1ac8b6){_0x1a03b9=_0x1ac8b6;_0x37dd83[_0xfa1f('0x2d')]=_[_0xfa1f('0x45')](db[_0xfa1f('0x4d')][_0xfa1f('0x46')]);_0x37dd83[_0xfa1f('0x2f')]=_[_0xfa1f('0x45')](_0x160ab8[_0xfa1f('0x2f')]);_0x37dd83['filters']=_[_0xfa1f('0x31')](_0x37dd83['model'],_0x37dd83[_0xfa1f('0x2f')]);_0x346cc5[_0xfa1f('0x32')]=_[_0xfa1f('0x31')](_0x37dd83[_0xfa1f('0x2d')],qs[_0xfa1f('0x33')](_0x160ab8['query'][_0xfa1f('0x33')]));_0x346cc5[_0xfa1f('0x32')]=_0x346cc5[_0xfa1f('0x32')][_0xfa1f('0x34')]?_0x346cc5[_0xfa1f('0x32')]:_0x37dd83[_0xfa1f('0x2d')];_0x346cc5[_0xfa1f('0x37')]=qs['sort'](_0x160ab8[_0xfa1f('0x2f')]['sort']);_0x346cc5[_0xfa1f('0x39')]=qs[_0xfa1f('0x30')](_[_0xfa1f('0x3a')](_0x160ab8['query'],_0x37dd83['filters']));if(_0x160ab8[_0xfa1f('0x2f')][_0xfa1f('0x3b')]){_0x346cc5['where']=_['merge'](_0x346cc5['where'],{'$or':_['map'](_0x346cc5[_0xfa1f('0x32')],function(_0x565429){var _0x29f36c={};_0x29f36c[_0x565429]={'$like':'%'+_0x160ab8[_0xfa1f('0x2f')]['filter']+'%'};return _0x29f36c;})});}_0x346cc5=_[_0xfa1f('0x3c')]({},_0x346cc5,_0x160ab8[_0xfa1f('0x3e')]);return _0x1a03b9['getSubjects'](_0x346cc5);}})[_0xfa1f('0x42')](function(_0x255bfe){if(_0x255bfe){_0x22acfd=_0x255bfe[_0xfa1f('0x34')];if(!_0x160ab8[_0xfa1f('0x2f')][_0xfa1f('0x35')]('nolimit')){_0x346cc5[_0xfa1f('0x1e')]=qs[_0xfa1f('0x1e')](_0x160ab8['query'][_0xfa1f('0x1e')]);_0x346cc5[_0xfa1f('0x1b')]=qs['offset'](_0x160ab8['query']['offset']);}return _0x1a03b9[_0xfa1f('0x4f')](_0x346cc5);}})[_0xfa1f('0x42')](function(_0x39cec8){if(_0x39cec8){return _0x39cec8?{'count':_0x22acfd,'rows':_0x39cec8}:null;}})['then'](respondWithResult(_0x59a91b,null))[_0xfa1f('0x4a')](handleError(_0x59a91b,null));};exports['getDescriptions']=function(_0x21448a,_0x190d90,_0x1731f8){var _0x5ae011={};var _0xb4494={};var _0x4da4a0;var _0x482d30;return db[_0xfa1f('0x29')]['findOne']({'where':{'id':_0x21448a[_0xfa1f('0x44')]['id']}})[_0xfa1f('0x42')](handleEntityNotFound(_0x190d90,null))['then'](function(_0x24b87c){if(_0x24b87c){_0x4da4a0=_0x24b87c;_0xb4494['model']=_[_0xfa1f('0x45')](db[_0xfa1f('0x4d')]['rawAttributes']);_0xb4494[_0xfa1f('0x2f')]=_[_0xfa1f('0x45')](_0x21448a[_0xfa1f('0x2f')]);_0xb4494[_0xfa1f('0x30')]=_['intersection'](_0xb4494[_0xfa1f('0x2d')],_0xb4494[_0xfa1f('0x2f')]);_0x5ae011[_0xfa1f('0x32')]=_[_0xfa1f('0x31')](_0xb4494[_0xfa1f('0x2d')],qs[_0xfa1f('0x33')](_0x21448a[_0xfa1f('0x2f')][_0xfa1f('0x33')]));_0x5ae011[_0xfa1f('0x32')]=_0x5ae011[_0xfa1f('0x32')]['length']?_0x5ae011['attributes']:_0xb4494[_0xfa1f('0x2d')];_0x5ae011[_0xfa1f('0x37')]=qs[_0xfa1f('0x38')](_0x21448a['query']['sort']);_0x5ae011[_0xfa1f('0x39')]=qs[_0xfa1f('0x30')](_[_0xfa1f('0x3a')](_0x21448a[_0xfa1f('0x2f')],_0xb4494[_0xfa1f('0x30')]));if(_0x21448a[_0xfa1f('0x2f')][_0xfa1f('0x3b')]){_0x5ae011[_0xfa1f('0x39')]=_['merge'](_0x5ae011[_0xfa1f('0x39')],{'$or':_['map'](_0x5ae011[_0xfa1f('0x32')],function(_0x36fe78){var _0x3348f2={};_0x3348f2[_0x36fe78]={'$like':'%'+_0x21448a[_0xfa1f('0x2f')][_0xfa1f('0x3b')]+'%'};return _0x3348f2;})});}_0x5ae011=_[_0xfa1f('0x3c')]({},_0x5ae011,_0x21448a['options']);return _0x4da4a0[_0xfa1f('0x50')](_0x5ae011);}})['then'](function(_0x4dcd81){if(_0x4dcd81){_0x482d30=_0x4dcd81[_0xfa1f('0x34')];if(!_0x21448a[_0xfa1f('0x2f')][_0xfa1f('0x35')]('nolimit')){_0x5ae011[_0xfa1f('0x1e')]=qs[_0xfa1f('0x1e')](_0x21448a[_0xfa1f('0x2f')][_0xfa1f('0x1e')]);_0x5ae011[_0xfa1f('0x1b')]=qs[_0xfa1f('0x1b')](_0x21448a[_0xfa1f('0x2f')][_0xfa1f('0x1b')]);}return _0x4da4a0[_0xfa1f('0x50')](_0x5ae011);}})['then'](function(_0x406c9d){if(_0x406c9d){return _0x406c9d?{'count':_0x482d30,'rows':_0x406c9d}:null;}})[_0xfa1f('0x42')](respondWithResult(_0x190d90,null))[_0xfa1f('0x4a')](handleError(_0x190d90,null));};exports[_0xfa1f('0x51')]=function(_0x13b1f0,_0x5dc71d,_0x5a159c){var _0x13828c={};var _0x2df9f9={};var _0xb5d125;var _0x5661d6;return db[_0xfa1f('0x29')][_0xfa1f('0x4c')]({'where':{'id':_0x13b1f0[_0xfa1f('0x44')]['id']}})[_0xfa1f('0x42')](handleEntityNotFound(_0x5dc71d,null))[_0xfa1f('0x42')](function(_0x4a7506){if(_0x4a7506){_0xb5d125=_0x4a7506;_0x2df9f9[_0xfa1f('0x2d')]=_['keys'](db[_0xfa1f('0x52')][_0xfa1f('0x46')]);_0x2df9f9[_0xfa1f('0x2f')]=_[_0xfa1f('0x45')](_0x13b1f0[_0xfa1f('0x2f')]);_0x2df9f9[_0xfa1f('0x30')]=_[_0xfa1f('0x31')](_0x2df9f9[_0xfa1f('0x2d')],_0x2df9f9[_0xfa1f('0x2f')]);_0x13828c[_0xfa1f('0x32')]=_[_0xfa1f('0x31')](_0x2df9f9[_0xfa1f('0x2d')],qs['fields'](_0x13b1f0[_0xfa1f('0x2f')][_0xfa1f('0x33')]));_0x13828c['attributes']=_0x13828c[_0xfa1f('0x32')][_0xfa1f('0x34')]?_0x13828c[_0xfa1f('0x32')]:_0x2df9f9[_0xfa1f('0x2d')];_0x13828c[_0xfa1f('0x37')]=qs[_0xfa1f('0x38')](_0x13b1f0['query'][_0xfa1f('0x38')]);_0x13828c['where']=qs['filters'](_[_0xfa1f('0x3a')](_0x13b1f0[_0xfa1f('0x2f')],_0x2df9f9[_0xfa1f('0x30')]));if(_0x13b1f0[_0xfa1f('0x2f')][_0xfa1f('0x3b')]){_0x13828c[_0xfa1f('0x39')]=_[_0xfa1f('0x3c')](_0x13828c[_0xfa1f('0x39')],{'$or':_[_0xfa1f('0x2e')](_0x13828c[_0xfa1f('0x32')],function(_0x204028){var _0x176d2a={};_0x176d2a[_0x204028]={'$like':'%'+_0x13b1f0['query']['filter']+'%'};return _0x176d2a;})});}_0x13828c=_[_0xfa1f('0x3c')]({},_0x13828c,_0x13b1f0[_0xfa1f('0x3e')]);return _0xb5d125['getTags'](_0x13828c);}})['then'](function(_0x3125db){if(_0x3125db){_0x5661d6=_0x3125db[_0xfa1f('0x34')];if(!_0x13b1f0[_0xfa1f('0x2f')][_0xfa1f('0x35')](_0xfa1f('0x36'))){_0x13828c[_0xfa1f('0x1e')]=qs[_0xfa1f('0x1e')](_0x13b1f0['query'][_0xfa1f('0x1e')]);_0x13828c[_0xfa1f('0x1b')]=qs[_0xfa1f('0x1b')](_0x13b1f0[_0xfa1f('0x2f')][_0xfa1f('0x1b')]);}return _0xb5d125[_0xfa1f('0x51')](_0x13828c);}})[_0xfa1f('0x42')](function(_0xfb3f65){if(_0xfb3f65){return _0xfb3f65?{'count':_0x5661d6,'rows':_0xfb3f65}:null;}})[_0xfa1f('0x42')](respondWithResult(_0x5dc71d,null))[_0xfa1f('0x4a')](handleError(_0x5dc71d,null));};exports[_0xfa1f('0x53')]=function(_0x593311,_0x7f0b54,_0x37d233){if(_0x593311['body']['id']){delete _0x593311['body']['id'];}return db[_0xfa1f('0x29')][_0xfa1f('0x4c')]({'where':{'id':_0x593311[_0xfa1f('0x44')]['id']}})['then'](handleEntityNotFound(_0x7f0b54,null))['then'](function(_0x11dd06){if(_0x11dd06){return _0x11dd06['setTags'](_0x593311['body'][_0xfa1f('0x54')]||[]);}return null;})[_0xfa1f('0x42')](respondWithResult(_0x7f0b54,null))[_0xfa1f('0x4a')](handleError(_0x7f0b54,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 26a197c..59730af 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 _0x8952=['exports','int_zendesk_configurations','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x40d4b4,_0xecfa1d){var _0x3c6271=function(_0x36ab4f){while(--_0x36ab4f){_0x40d4b4['push'](_0x40d4b4['shift']());}};_0x3c6271(++_0xecfa1d);}(_0x8952,0x17e));var _0x2895=function(_0x152d44,_0x5d7684){_0x152d44=_0x152d44-0x0;var _0x3bef24=_0x8952[_0x152d44];return _0x3bef24;};'use strict';var _=require('lodash');var util=require(_0x2895('0x0'));var logger=require(_0x2895('0x1'))(_0x2895('0x2'));var moment=require(_0x2895('0x3'));var BPromise=require(_0x2895('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2895('0x5'));var rimraf=require(_0x2895('0x6'));var config=require(_0x2895('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x2895('0x8')]=function(_0x73c245,_0x37305b){return _0x73c245['define']('ZendeskConfiguration',attributes,{'tableName':_0x2895('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','util'];(function(_0x31aaca,_0x5d55fc){var _0x518ad3=function(_0x286705){while(--_0x286705){_0x31aaca['push'](_0x31aaca['shift']());}};_0x518ad3(++_0x5d55fc);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 00d9e5c..176596d 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 _0xe01a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment'];(function(_0x161917,_0x496ce4){var _0x197210=function(_0x46f6ec){while(--_0x46f6ec){_0x161917['push'](_0x161917['shift']());}};_0x197210(++_0x496ce4);}(_0xe01a,0xfa));var _0xae01=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe01a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xae01('0x0'));var util=require(_0xae01('0x1'));var moment=require(_0xae01('0x2'));var BPromise=require(_0xae01('0x3'));var rs=require(_0xae01('0x4'));var fs=require('fs');var Redis=require(_0xae01('0x5'));var db=require(_0xae01('0x6'))['db'];var utils=require(_0xae01('0x7'));var logger=require(_0xae01('0x8'))('rpc');var config=require(_0xae01('0x9'));var jayson=require(_0xae01('0xa'));var client=jayson[_0xae01('0xb')][_0xae01('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1865ea,_0xd4259d,_0x5c97b9){return new BPromise(function(_0x3c189e,_0x4e22a8){return client['request'](_0x1865ea,_0x5c97b9)['then'](function(_0x295110){logger[_0xae01('0xd')](_0xae01('0xe'),_0xd4259d,_0xae01('0xf'));logger[_0xae01('0x10')](_0xae01('0x11'),_0xd4259d,_0xae01('0xf'),JSON['stringify'](_0x295110));if(_0x295110[_0xae01('0x12')]){if(_0x295110['error'][_0xae01('0x13')]===0x1f4){logger['error'](_0xae01('0xe'),_0xd4259d,_0x295110[_0xae01('0x12')]['message']);return _0x4e22a8(_0x295110[_0xae01('0x12')]['message']);}logger['error'](_0xae01('0xe'),_0xd4259d,_0x295110[_0xae01('0x12')][_0xae01('0x14')]);return _0x3c189e(_0x295110['error']['message']);}else{logger[_0xae01('0xd')](_0xae01('0xe'),_0xd4259d,_0xae01('0xf'));_0x3c189e(_0x295110[_0xae01('0x15')]['message']);}})[_0xae01('0x16')](function(_0xba20de){logger[_0xae01('0x12')](_0xae01('0xe'),_0xd4259d,_0xba20de);_0x4e22a8(_0xba20de);});});} \ No newline at end of file +var _0x81c5=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x81c5,0x132));var _0x581c=function(_0x637da3,_0x36dfdd){_0x637da3=_0x637da3-0x0;var _0x2ec2bc=_0x81c5[_0x637da3];return _0x2ec2bc;};'use strict';var _=require('lodash');var util=require(_0x581c('0x0'));var moment=require(_0x581c('0x1'));var BPromise=require(_0x581c('0x2'));var rs=require(_0x581c('0x3'));var fs=require('fs');var Redis=require(_0x581c('0x4'));var db=require(_0x581c('0x5'))['db'];var utils=require(_0x581c('0x6'));var logger=require(_0x581c('0x7'))(_0x581c('0x8'));var config=require(_0x581c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x581c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a6c40,_0x5872ca,_0x3ad899){return new BPromise(function(_0x142901,_0x585e7c){return client['request'](_0x5a6c40,_0x3ad899)[_0x581c('0xb')](function(_0x1aab50){logger[_0x581c('0xc')](_0x581c('0xd'),_0x5872ca,_0x581c('0xe'));logger['debug'](_0x581c('0xf'),_0x5872ca,_0x581c('0xe'),JSON[_0x581c('0x10')](_0x1aab50));if(_0x1aab50[_0x581c('0x11')]){if(_0x1aab50['error'][_0x581c('0x12')]===0x1f4){logger[_0x581c('0x11')](_0x581c('0xd'),_0x5872ca,_0x1aab50[_0x581c('0x11')]['message']);return _0x585e7c(_0x1aab50[_0x581c('0x11')][_0x581c('0x13')]);}logger[_0x581c('0x11')](_0x581c('0xd'),_0x5872ca,_0x1aab50[_0x581c('0x11')][_0x581c('0x13')]);return _0x142901(_0x1aab50[_0x581c('0x11')][_0x581c('0x13')]);}else{logger[_0x581c('0xc')](_0x581c('0xd'),_0x5872ca,_0x581c('0xe'));_0x142901(_0x1aab50[_0x581c('0x14')]['message']);}})[_0x581c('0x15')](function(_0x4a83b9){logger[_0x581c('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5872ca,_0x4a83b9);_0x585e7c(_0x4a83b9);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 85ffc18..46a3f71 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 _0x4f01=['util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x2a44ca,_0x4b4d73){var _0x4f3122=function(_0x232f36){while(--_0x232f36){_0x2a44ca['push'](_0x2a44ca['shift']());}};_0x4f3122(++_0x4b4d73);}(_0x4f01,0x1cb));var _0x14f0=function(_0x3a8f17,_0x2539d0){_0x3a8f17=_0x3a8f17-0x0;var _0x501bbd=_0x4f01[_0x3a8f17];return _0x501bbd;};'use strict';var multer=require('multer');var util=require(_0x14f0('0x0'));var path=require('path');var timeout=require(_0x14f0('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x14f0('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x14f0('0x3'));var config=require(_0x14f0('0x4'));var controller=require('./intZendeskField.controller');router[_0x14f0('0x5')]('/',auth[_0x14f0('0x6')](),controller[_0x14f0('0x7')]);router['get'](_0x14f0('0x8'),auth[_0x14f0('0x6')](),controller[_0x14f0('0x9')]);router[_0x14f0('0xa')]('/',auth[_0x14f0('0x6')](),controller[_0x14f0('0xb')]);router[_0x14f0('0xc')](_0x14f0('0x8'),auth['isAuthenticated'](),controller[_0x14f0('0xd')]);router[_0x14f0('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x14f0('0xf')]);module[_0x14f0('0x10')]=router; \ No newline at end of file +var _0xa0e0=['post','create','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show'];(function(_0xc1f508,_0x592256){var _0x51e51e=function(_0x56402d){while(--_0x56402d){_0xc1f508['push'](_0xc1f508['shift']());}};_0x51e51e(++_0x592256);}(_0xa0e0,0x17f));var _0x0a0e=function(_0x3fa2b6,_0xbc858){_0x3fa2b6=_0x3fa2b6-0x0;var _0x49d3b8=_0xa0e0[_0x3fa2b6];return _0x49d3b8;};'use strict';var multer=require(_0x0a0e('0x0'));var util=require(_0x0a0e('0x1'));var path=require(_0x0a0e('0x2'));var timeout=require(_0x0a0e('0x3'));var express=require(_0x0a0e('0x4'));var router=express[_0x0a0e('0x5')]();var fs_extra=require(_0x0a0e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0a0e('0x7'));var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router[_0x0a0e('0x8')]('/',auth[_0x0a0e('0x9')](),controller[_0x0a0e('0xa')]);router[_0x0a0e('0x8')](_0x0a0e('0xb'),auth['isAuthenticated'](),controller[_0x0a0e('0xc')]);router[_0x0a0e('0xd')]('/',auth[_0x0a0e('0x9')](),controller[_0x0a0e('0xe')]);router[_0x0a0e('0xf')]('/:id',auth[_0x0a0e('0x9')](),controller[_0x0a0e('0x10')]);router[_0x0a0e('0x11')](_0x0a0e('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 75a9a17..f8e52a1 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 _0x75ed=['picklist','STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue'];(function(_0x14635e,_0x2e764d){var _0x127db4=function(_0x22d8ce){while(--_0x22d8ce){_0x14635e['push'](_0x14635e['shift']());}};_0x127db4(++_0x2e764d);}(_0x75ed,0x1b3));var _0xd75e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x75ed[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0xd75e('0x0'));module['exports']={'type':{'type':Sequelize[_0xd75e('0x1')](_0xd75e('0x2'),_0xd75e('0x3'),_0xd75e('0x4'),_0xd75e('0x5'),_0xd75e('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd75e('0x7')]},'keyType':{'type':Sequelize[_0xd75e('0x1')](_0xd75e('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xd75e('0x7')]},'idField':{'type':Sequelize[_0xd75e('0x7')]},'nameField':{'type':Sequelize[_0xd75e('0x7')]},'customField':{'type':Sequelize[_0xd75e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd75e('0x7')]}}; \ No newline at end of file +var _0x47f5=['variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x47f5,0x137));var _0x547f=function(_0x4f2c3a,_0x6bde90){_0x4f2c3a=_0x4f2c3a-0x0;var _0x17d91c=_0x47f5[_0x4f2c3a];return _0x17d91c;};'use strict';var Sequelize=require(_0x547f('0x0'));module[_0x547f('0x1')]={'type':{'type':Sequelize[_0x547f('0x2')](_0x547f('0x3'),_0x547f('0x4'),_0x547f('0x5'),_0x547f('0x6'),_0x547f('0x7')),'defaultValue':_0x547f('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x547f('0x8')]},'keyType':{'type':Sequelize['ENUM']('string',_0x547f('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x547f('0x8')]},'idField':{'type':Sequelize[_0x547f('0x8')]},'nameField':{'type':Sequelize[_0x547f('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x547f('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 9188d93..dd692eb 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 _0xa5be=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','stack','name','index','map','ZendeskField','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x44cf73,_0x2e4c2b){var _0x51a303=function(_0x4ce38a){while(--_0x4ce38a){_0x44cf73['push'](_0x44cf73['shift']());}};_0x51a303(++_0x2e4c2b);}(_0xa5be,0x10e));var _0xea5b=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xa5be[_0x618414];return _0x21c19a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xea5b('0x0'));var jsonpatch=require(_0xea5b('0x1'));var rp=require(_0xea5b('0x2'));var moment=require(_0xea5b('0x3'));var BPromise=require(_0xea5b('0x4'));var Mustache=require(_0xea5b('0x5'));var util=require('util');var path=require(_0xea5b('0x6'));var sox=require('sox');var csv=require(_0xea5b('0x7'));var ejs=require(_0xea5b('0x8'));var fs=require('fs');var fs_extra=require(_0xea5b('0x9'));var _=require('lodash');var squel=require(_0xea5b('0xa'));var crypto=require('crypto');var jsforce=require(_0xea5b('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xea5b('0xc'));var Papa=require('papaparse');var Redis=require(_0xea5b('0xd'));var authService=require(_0xea5b('0xe'));var qs=require(_0xea5b('0xf'));var as=require(_0xea5b('0x10'));var hardwareService=require(_0xea5b('0x11'));var logger=require(_0xea5b('0x12'))(_0xea5b('0x13'));var utils=require(_0xea5b('0x14'));var config=require(_0xea5b('0x15'));var licenseUtil=require(_0xea5b('0x16'));var db=require(_0xea5b('0x17'))['db'];function respondWithStatusCode(_0x591361,_0x4ddcb5){_0x4ddcb5=_0x4ddcb5||0xcc;return function(_0x550218){if(_0x550218){return _0x591361[_0xea5b('0x18')](_0x4ddcb5);}return _0x591361['status'](_0x4ddcb5)[_0xea5b('0x19')]();};}function respondWithResult(_0x41306b,_0x10abb5){_0x10abb5=_0x10abb5||0xc8;return function(_0x1f0c5f){if(_0x1f0c5f){return _0x41306b[_0xea5b('0x1a')](_0x10abb5)['json'](_0x1f0c5f);}};}function respondWithFilteredResult(_0x3809b0,_0x23bc97){return function(_0x8c4cf){if(_0x8c4cf){var _0x3c4ab2=typeof _0x23bc97[_0xea5b('0x1b')]===_0xea5b('0x1c')&&typeof _0x23bc97[_0xea5b('0x1d')]===_0xea5b('0x1c');var _0x161cbe=_0x8c4cf[_0xea5b('0x1e')];var _0x4737e8=_0x3c4ab2?0x0:_0x23bc97[_0xea5b('0x1b')];var _0x4b8147=_0x3c4ab2?_0x8c4cf[_0xea5b('0x1e')]:_0x23bc97[_0xea5b('0x1b')]+_0x23bc97[_0xea5b('0x1d')];var _0x1323af;if(_0x4b8147>=_0x161cbe){_0x4b8147=_0x161cbe;_0x1323af=0xc8;}else{_0x1323af=0xce;}_0x3809b0[_0xea5b('0x1a')](_0x1323af);return _0x3809b0[_0xea5b('0x1f')](_0xea5b('0x20'),_0x4737e8+'-'+_0x4b8147+'/'+_0x161cbe)['json'](_0x8c4cf);}return null;};}function patchUpdates(_0x564f66){return function(_0x2e4acd){try{jsonpatch[_0xea5b('0x21')](_0x2e4acd,_0x564f66,!![]);}catch(_0x4c2839){return BPromise['reject'](_0x4c2839);}return _0x2e4acd[_0xea5b('0x22')]();};}function saveUpdates(_0xa0dfe2,_0xed987b){return function(_0x4f12b9){if(_0x4f12b9){return _0x4f12b9[_0xea5b('0x23')](_0xa0dfe2)['then'](function(_0x37186f){return _0x37186f;});}return null;};}function removeEntity(_0x30ae40,_0x440214){return function(_0x3e44cb){if(_0x3e44cb){return _0x3e44cb[_0xea5b('0x24')]()[_0xea5b('0x25')](function(){_0x30ae40['status'](0xcc)[_0xea5b('0x19')]();});}};}function handleEntityNotFound(_0x259c12,_0x1154ad){return function(_0x3b9f2c){if(!_0x3b9f2c){_0x259c12['sendStatus'](0x194);}return _0x3b9f2c;};}function handleError(_0x150c26,_0x323890){_0x323890=_0x323890||0x1f4;return function(_0x3dd15f){logger['error'](_0x3dd15f[_0xea5b('0x26')]);if(_0x3dd15f[_0xea5b('0x27')]){delete _0x3dd15f[_0xea5b('0x27')];}_0x150c26[_0xea5b('0x1a')](_0x323890)['send'](_0x3dd15f);};}exports[_0xea5b('0x28')]=function(_0x1a3f99,_0x163848){var _0x35a336={},_0x307839={},_0x1e9345={'count':0x0,'rows':[]};var _0x68b590=_[_0xea5b('0x29')](db[_0xea5b('0x2a')]['rawAttributes'],function(_0x5ca922){return{'name':_0x5ca922[_0xea5b('0x2b')],'type':_0x5ca922[_0xea5b('0x2c')][_0xea5b('0x2d')]};});_0x307839[_0xea5b('0x2e')]=_[_0xea5b('0x29')](_0x68b590,_0xea5b('0x27'));_0x307839[_0xea5b('0x2f')]=_[_0xea5b('0x30')](_0x1a3f99[_0xea5b('0x2f')]);_0x307839[_0xea5b('0x31')]=_[_0xea5b('0x32')](_0x307839[_0xea5b('0x2e')],_0x307839[_0xea5b('0x2f')]);_0x35a336['attributes']=_[_0xea5b('0x32')](_0x307839[_0xea5b('0x2e')],qs[_0xea5b('0x33')](_0x1a3f99[_0xea5b('0x2f')]['fields']));_0x35a336[_0xea5b('0x34')]=_0x35a336[_0xea5b('0x34')][_0xea5b('0x35')]?_0x35a336['attributes']:_0x307839['model'];if(!_0x1a3f99[_0xea5b('0x2f')]['hasOwnProperty'](_0xea5b('0x36'))){_0x35a336[_0xea5b('0x1d')]=qs[_0xea5b('0x1d')](_0x1a3f99[_0xea5b('0x2f')]['limit']);_0x35a336[_0xea5b('0x1b')]=qs[_0xea5b('0x1b')](_0x1a3f99[_0xea5b('0x2f')][_0xea5b('0x1b')]);}_0x35a336[_0xea5b('0x37')]=qs[_0xea5b('0x38')](_0x1a3f99[_0xea5b('0x2f')][_0xea5b('0x38')]);_0x35a336[_0xea5b('0x39')]=qs['filters'](_['pick'](_0x1a3f99[_0xea5b('0x2f')],_0x307839['filters']),_0x68b590);if(_0x1a3f99[_0xea5b('0x2f')][_0xea5b('0x3a')]){_0x35a336[_0xea5b('0x39')]=_[_0xea5b('0x3b')](_0x35a336[_0xea5b('0x39')],{'$or':_[_0xea5b('0x29')](_0x68b590,function(_0x1ad3fa){if(_0x1ad3fa['type']!=='VIRTUAL'){var _0x1e338b={};_0x1e338b[_0x1ad3fa[_0xea5b('0x27')]]={'$like':'%'+_0x1a3f99[_0xea5b('0x2f')][_0xea5b('0x3a')]+'%'};return _0x1e338b;}})});}_0x35a336=_[_0xea5b('0x3b')]({},_0x35a336,_0x1a3f99[_0xea5b('0x3c')]);var _0x2e3db4={'where':_0x35a336[_0xea5b('0x39')]};return db['ZendeskField'][_0xea5b('0x1e')](_0x2e3db4)[_0xea5b('0x25')](function(_0x429c23){_0x1e9345[_0xea5b('0x1e')]=_0x429c23;if(_0x1a3f99[_0xea5b('0x2f')][_0xea5b('0x3d')]){_0x35a336[_0xea5b('0x3e')]=[{'all':!![]}];}return db['ZendeskField'][_0xea5b('0x3f')](_0x35a336);})[_0xea5b('0x25')](function(_0x276499){_0x1e9345[_0xea5b('0x40')]=_0x276499;return _0x1e9345;})[_0xea5b('0x25')](respondWithFilteredResult(_0x163848,_0x35a336))[_0xea5b('0x41')](handleError(_0x163848,null));};exports[_0xea5b('0x42')]=function(_0x12b1ec,_0x61ace6){var _0x34642c={'raw':!![],'where':{'id':_0x12b1ec[_0xea5b('0x43')]['id']}},_0x417a24={};_0x417a24[_0xea5b('0x2e')]=_[_0xea5b('0x30')](db['ZendeskField'][_0xea5b('0x44')]);_0x417a24[_0xea5b('0x2f')]=_[_0xea5b('0x30')](_0x12b1ec[_0xea5b('0x2f')]);_0x417a24[_0xea5b('0x31')]=_[_0xea5b('0x32')](_0x417a24[_0xea5b('0x2e')],_0x417a24['query']);_0x34642c['attributes']=_[_0xea5b('0x32')](_0x417a24[_0xea5b('0x2e')],qs[_0xea5b('0x33')](_0x12b1ec[_0xea5b('0x2f')][_0xea5b('0x33')]));_0x34642c[_0xea5b('0x34')]=_0x34642c['attributes']['length']?_0x34642c[_0xea5b('0x34')]:_0x417a24[_0xea5b('0x2e')];if(_0x12b1ec[_0xea5b('0x2f')][_0xea5b('0x3d')]){_0x34642c[_0xea5b('0x3e')]=[{'all':!![]}];}_0x34642c=_['merge']({},_0x34642c,_0x12b1ec[_0xea5b('0x3c')]);return db['ZendeskField']['find'](_0x34642c)[_0xea5b('0x25')](handleEntityNotFound(_0x61ace6,null))['then'](respondWithResult(_0x61ace6,null))[_0xea5b('0x41')](handleError(_0x61ace6,null));};exports[_0xea5b('0x45')]=function(_0x1e8c98,_0x335edc){return db['ZendeskField'][_0xea5b('0x45')](_0x1e8c98[_0xea5b('0x46')],{})[_0xea5b('0x25')](respondWithResult(_0x335edc,0xc9))[_0xea5b('0x41')](handleError(_0x335edc,null));};exports[_0xea5b('0x23')]=function(_0x1cc260,_0x349050){if(_0x1cc260[_0xea5b('0x46')]['id']){delete _0x1cc260['body']['id'];}return db['ZendeskField'][_0xea5b('0x47')]({'where':{'id':_0x1cc260[_0xea5b('0x43')]['id']}})[_0xea5b('0x25')](handleEntityNotFound(_0x349050,null))[_0xea5b('0x25')](saveUpdates(_0x1cc260[_0xea5b('0x46')],null))['then'](respondWithResult(_0x349050,null))['catch'](handleError(_0x349050,null));};exports[_0xea5b('0x24')]=function(_0x25c410,_0x258fce){return db['ZendeskField'][_0xea5b('0x47')]({'where':{'id':_0x25c410[_0xea5b('0x43')]['id']}})[_0xea5b('0x25')](handleEntityNotFound(_0x258fce,null))[_0xea5b('0x25')](removeEntity(_0x258fce,null))[_0xea5b('0x41')](handleError(_0x258fce,null));}; \ No newline at end of file +var _0xa8d7=['show','params','length','include','find','create','body','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','stack','name','send','map','ZendeskField','rawAttributes','fieldName','type','query','keys','intersection','model','fields','attributes','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','then','rows'];(function(_0x4d4b96,_0x1428b0){var _0x5cc737=function(_0x2af766){while(--_0x2af766){_0x4d4b96['push'](_0x4d4b96['shift']());}};_0x5cc737(++_0x1428b0);}(_0xa8d7,0x1b8));var _0x7a8d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xa8d7[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x7a8d('0x0'));var rimraf=require(_0x7a8d('0x1'));var zipdir=require(_0x7a8d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7a8d('0x3'));var moment=require(_0x7a8d('0x4'));var BPromise=require(_0x7a8d('0x5'));var Mustache=require(_0x7a8d('0x6'));var util=require(_0x7a8d('0x7'));var path=require(_0x7a8d('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7a8d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7a8d('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7a8d('0xb'));var deskjs=require(_0x7a8d('0xc'));var toCsv=require(_0x7a8d('0xd'));var querystring=require('querystring');var Papa=require(_0x7a8d('0xe'));var Redis=require(_0x7a8d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7a8d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a8d('0x11'));var logger=require(_0x7a8d('0x12'))(_0x7a8d('0x13'));var utils=require('../../config/utils');var config=require(_0x7a8d('0x14'));var licenseUtil=require(_0x7a8d('0x15'));var db=require(_0x7a8d('0x16'))['db'];function respondWithStatusCode(_0x102270,_0x4eda02){_0x4eda02=_0x4eda02||0xcc;return function(_0x1498fd){if(_0x1498fd){return _0x102270[_0x7a8d('0x17')](_0x4eda02);}return _0x102270[_0x7a8d('0x18')](_0x4eda02)[_0x7a8d('0x19')]();};}function respondWithResult(_0x199178,_0x246c3c){_0x246c3c=_0x246c3c||0xc8;return function(_0x52e7d3){if(_0x52e7d3){return _0x199178[_0x7a8d('0x18')](_0x246c3c)['json'](_0x52e7d3);}};}function respondWithFilteredResult(_0x16cae9,_0x385156){return function(_0x22832f){if(_0x22832f){var _0x3b8bd0=typeof _0x385156[_0x7a8d('0x1a')]===_0x7a8d('0x1b')&&typeof _0x385156[_0x7a8d('0x1c')]===_0x7a8d('0x1b');var _0x4d92e0=_0x22832f[_0x7a8d('0x1d')];var _0x2ec784=_0x3b8bd0?0x0:_0x385156[_0x7a8d('0x1a')];var _0x58f6d2=_0x3b8bd0?_0x22832f[_0x7a8d('0x1d')]:_0x385156[_0x7a8d('0x1a')]+_0x385156[_0x7a8d('0x1c')];var _0x589de5;if(_0x58f6d2>=_0x4d92e0){_0x58f6d2=_0x4d92e0;_0x589de5=0xc8;}else{_0x589de5=0xce;}_0x16cae9[_0x7a8d('0x18')](_0x589de5);return _0x16cae9[_0x7a8d('0x1e')]('Content-Range',_0x2ec784+'-'+_0x58f6d2+'/'+_0x4d92e0)[_0x7a8d('0x1f')](_0x22832f);}return null;};}function patchUpdates(_0x42546d){return function(_0x12451c){try{jsonpatch[_0x7a8d('0x20')](_0x12451c,_0x42546d,!![]);}catch(_0x187953){return BPromise[_0x7a8d('0x21')](_0x187953);}return _0x12451c[_0x7a8d('0x22')]();};}function saveUpdates(_0x50bf3c,_0x56efe8){return function(_0xc029a5){if(_0xc029a5){return _0xc029a5[_0x7a8d('0x23')](_0x50bf3c)['then'](function(_0x54dc9e){return _0x54dc9e;});}return null;};}function removeEntity(_0xe9de36,_0x401894){return function(_0x30af97){if(_0x30af97){return _0x30af97[_0x7a8d('0x24')]()['then'](function(){_0xe9de36[_0x7a8d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14a69d,_0x19e10d){return function(_0x44ebdc){if(!_0x44ebdc){_0x14a69d[_0x7a8d('0x17')](0x194);}return _0x44ebdc;};}function handleError(_0x569a8e,_0x5779a8){_0x5779a8=_0x5779a8||0x1f4;return function(_0x1e7b74){logger['error'](_0x1e7b74[_0x7a8d('0x25')]);if(_0x1e7b74['name']){delete _0x1e7b74[_0x7a8d('0x26')];}_0x569a8e['status'](_0x5779a8)[_0x7a8d('0x27')](_0x1e7b74);};}exports['index']=function(_0x49d6ac,_0x1e78aa){var _0x4dd2e6={},_0x1ae521={},_0x56273e={'count':0x0,'rows':[]};var _0x121214=_[_0x7a8d('0x28')](db[_0x7a8d('0x29')][_0x7a8d('0x2a')],function(_0x22b97e){return{'name':_0x22b97e[_0x7a8d('0x2b')],'type':_0x22b97e[_0x7a8d('0x2c')]['key']};});_0x1ae521['model']=_[_0x7a8d('0x28')](_0x121214,_0x7a8d('0x26'));_0x1ae521[_0x7a8d('0x2d')]=_[_0x7a8d('0x2e')](_0x49d6ac[_0x7a8d('0x2d')]);_0x1ae521['filters']=_[_0x7a8d('0x2f')](_0x1ae521[_0x7a8d('0x30')],_0x1ae521[_0x7a8d('0x2d')]);_0x4dd2e6['attributes']=_['intersection'](_0x1ae521[_0x7a8d('0x30')],qs[_0x7a8d('0x31')](_0x49d6ac[_0x7a8d('0x2d')]['fields']));_0x4dd2e6[_0x7a8d('0x32')]=_0x4dd2e6[_0x7a8d('0x32')]['length']?_0x4dd2e6[_0x7a8d('0x32')]:_0x1ae521['model'];if(!_0x49d6ac['query']['hasOwnProperty'](_0x7a8d('0x33'))){_0x4dd2e6['limit']=qs['limit'](_0x49d6ac[_0x7a8d('0x2d')]['limit']);_0x4dd2e6['offset']=qs['offset'](_0x49d6ac['query'][_0x7a8d('0x1a')]);}_0x4dd2e6[_0x7a8d('0x34')]=qs[_0x7a8d('0x35')](_0x49d6ac[_0x7a8d('0x2d')][_0x7a8d('0x35')]);_0x4dd2e6[_0x7a8d('0x36')]=qs['filters'](_['pick'](_0x49d6ac[_0x7a8d('0x2d')],_0x1ae521[_0x7a8d('0x37')]),_0x121214);if(_0x49d6ac['query'][_0x7a8d('0x38')]){_0x4dd2e6[_0x7a8d('0x36')]=_[_0x7a8d('0x39')](_0x4dd2e6[_0x7a8d('0x36')],{'$or':_[_0x7a8d('0x28')](_0x121214,function(_0x181d16){if(_0x181d16[_0x7a8d('0x2c')]!==_0x7a8d('0x3a')){var _0xb8d453={};_0xb8d453[_0x181d16['name']]={'$like':'%'+_0x49d6ac[_0x7a8d('0x2d')][_0x7a8d('0x38')]+'%'};return _0xb8d453;}})});}_0x4dd2e6=_[_0x7a8d('0x39')]({},_0x4dd2e6,_0x49d6ac[_0x7a8d('0x3b')]);var _0x15d13a={'where':_0x4dd2e6[_0x7a8d('0x36')]};return db['ZendeskField'][_0x7a8d('0x1d')](_0x15d13a)['then'](function(_0x1cff06){_0x56273e[_0x7a8d('0x1d')]=_0x1cff06;if(_0x49d6ac[_0x7a8d('0x2d')][_0x7a8d('0x3c')]){_0x4dd2e6['include']=[{'all':!![]}];}return db[_0x7a8d('0x29')][_0x7a8d('0x3d')](_0x4dd2e6);})[_0x7a8d('0x3e')](function(_0x2e9fe5){_0x56273e[_0x7a8d('0x3f')]=_0x2e9fe5;return _0x56273e;})[_0x7a8d('0x3e')](respondWithFilteredResult(_0x1e78aa,_0x4dd2e6))['catch'](handleError(_0x1e78aa,null));};exports[_0x7a8d('0x40')]=function(_0x42cdf5,_0x58c8ce){var _0xa50f31={'raw':!![],'where':{'id':_0x42cdf5[_0x7a8d('0x41')]['id']}},_0xf10e5a={};_0xf10e5a[_0x7a8d('0x30')]=_[_0x7a8d('0x2e')](db[_0x7a8d('0x29')][_0x7a8d('0x2a')]);_0xf10e5a[_0x7a8d('0x2d')]=_[_0x7a8d('0x2e')](_0x42cdf5[_0x7a8d('0x2d')]);_0xf10e5a['filters']=_[_0x7a8d('0x2f')](_0xf10e5a[_0x7a8d('0x30')],_0xf10e5a[_0x7a8d('0x2d')]);_0xa50f31[_0x7a8d('0x32')]=_['intersection'](_0xf10e5a['model'],qs[_0x7a8d('0x31')](_0x42cdf5[_0x7a8d('0x2d')][_0x7a8d('0x31')]));_0xa50f31[_0x7a8d('0x32')]=_0xa50f31['attributes'][_0x7a8d('0x42')]?_0xa50f31[_0x7a8d('0x32')]:_0xf10e5a['model'];if(_0x42cdf5[_0x7a8d('0x2d')][_0x7a8d('0x3c')]){_0xa50f31[_0x7a8d('0x43')]=[{'all':!![]}];}_0xa50f31=_['merge']({},_0xa50f31,_0x42cdf5[_0x7a8d('0x3b')]);return db['ZendeskField'][_0x7a8d('0x44')](_0xa50f31)[_0x7a8d('0x3e')](handleEntityNotFound(_0x58c8ce,null))[_0x7a8d('0x3e')](respondWithResult(_0x58c8ce,null))['catch'](handleError(_0x58c8ce,null));};exports[_0x7a8d('0x45')]=function(_0x41fd7e,_0x382c38){return db[_0x7a8d('0x29')][_0x7a8d('0x45')](_0x41fd7e[_0x7a8d('0x46')],{})[_0x7a8d('0x3e')](respondWithResult(_0x382c38,0xc9))[_0x7a8d('0x47')](handleError(_0x382c38,null));};exports[_0x7a8d('0x23')]=function(_0x2cbb48,_0xaf7c78){if(_0x2cbb48[_0x7a8d('0x46')]['id']){delete _0x2cbb48[_0x7a8d('0x46')]['id'];}return db['ZendeskField'][_0x7a8d('0x44')]({'where':{'id':_0x2cbb48[_0x7a8d('0x41')]['id']}})[_0x7a8d('0x3e')](handleEntityNotFound(_0xaf7c78,null))[_0x7a8d('0x3e')](saveUpdates(_0x2cbb48[_0x7a8d('0x46')],null))[_0x7a8d('0x3e')](respondWithResult(_0xaf7c78,null))[_0x7a8d('0x47')](handleError(_0xaf7c78,null));};exports[_0x7a8d('0x24')]=function(_0x2036ab,_0x4bc6d1){return db[_0x7a8d('0x29')][_0x7a8d('0x44')]({'where':{'id':_0x2036ab[_0x7a8d('0x41')]['id']}})['then'](handleEntityNotFound(_0x4bc6d1,null))[_0x7a8d('0x3e')](removeEntity(_0x4bc6d1,null))[_0x7a8d('0x47')](handleError(_0x4bc6d1,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 7139bf8..ce79610 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 _0x51c1=['rimraf','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2311aa,_0x52fb94){var _0x3315c6=function(_0x21f087){while(--_0x21f087){_0x2311aa['push'](_0x2311aa['shift']());}};_0x3315c6(++_0x52fb94);}(_0x51c1,0x149));var _0x151c=function(_0x1e1965,_0x55785c){_0x1e1965=_0x1e1965-0x0;var _0x1a2e96=_0x51c1[_0x1e1965];return _0x1a2e96;};'use strict';var _=require(_0x151c('0x0'));var util=require(_0x151c('0x1'));var logger=require(_0x151c('0x2'))(_0x151c('0x3'));var moment=require(_0x151c('0x4'));var BPromise=require(_0x151c('0x5'));var rp=require(_0x151c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x151c('0x7'));var config=require('../../config/environment');var attributes=require(_0x151c('0x8'));module[_0x151c('0x9')]=function(_0x2f7078,_0x24f71c){return _0x2f7078[_0x151c('0xa')](_0x151c('0xb'),attributes,{'tableName':_0x151c('0xc'),'paranoid':![],'indexes':[{'name':_0x151c('0xd'),'fields':[_0x151c('0xe'),_0x151c('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x24a9=['path','rimraf','./intZendeskField.attributes','exports','define','ZendeskField','zendesk_unique_index','idField','FieldId','lodash','util','bluebird','request-promise'];(function(_0x4322a1,_0x268148){var _0x356d1f=function(_0x3a2763){while(--_0x3a2763){_0x4322a1['push'](_0x4322a1['shift']());}};_0x356d1f(++_0x268148);}(_0x24a9,0xcc));var _0x924a=function(_0x3b6892,_0x50a5b2){_0x3b6892=_0x3b6892-0x0;var _0x2ea79d=_0x24a9[_0x3b6892];return _0x2ea79d;};'use strict';var _=require(_0x924a('0x0'));var util=require(_0x924a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x924a('0x2'));var rp=require(_0x924a('0x3'));var fs=require('fs');var path=require(_0x924a('0x4'));var rimraf=require(_0x924a('0x5'));var config=require('../../config/environment');var attributes=require(_0x924a('0x6'));module[_0x924a('0x7')]=function(_0x45628c,_0x16d024){return _0x45628c[_0x924a('0x8')](_0x924a('0x9'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x924a('0xa'),'fields':[_0x924a('0xb'),_0x924a('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 7cb6122..7e35ee7 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 _0x7026=['ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x7026,0x66));var _0x6702=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x7026[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0x6702('0x0'));var util=require(_0x6702('0x1'));var moment=require(_0x6702('0x2'));var BPromise=require(_0x6702('0x3'));var rs=require(_0x6702('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6702('0x5'))['db'];var utils=require(_0x6702('0x6'));var logger=require(_0x6702('0x7'))(_0x6702('0x8'));var config=require(_0x6702('0x9'));var jayson=require(_0x6702('0xa'));var client=jayson[_0x6702('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x347217,_0x54ca0e,_0x3e9dde){return new BPromise(function(_0x5e85a7,_0x5e0819){return client['request'](_0x347217,_0x3e9dde)[_0x6702('0xc')](function(_0x59dcff){logger['info'](_0x6702('0xd'),_0x54ca0e,_0x6702('0xe'));logger[_0x6702('0xf')](_0x6702('0x10'),_0x54ca0e,_0x6702('0xe'),JSON[_0x6702('0x11')](_0x59dcff));if(_0x59dcff['error']){if(_0x59dcff['error'][_0x6702('0x12')]===0x1f4){logger[_0x6702('0x13')](_0x6702('0xd'),_0x54ca0e,_0x59dcff[_0x6702('0x13')][_0x6702('0x14')]);return _0x5e0819(_0x59dcff['error']['message']);}logger[_0x6702('0x13')](_0x6702('0xd'),_0x54ca0e,_0x59dcff[_0x6702('0x13')][_0x6702('0x14')]);return _0x5e85a7(_0x59dcff[_0x6702('0x13')][_0x6702('0x14')]);}else{logger[_0x6702('0x15')](_0x6702('0xd'),_0x54ca0e,_0x6702('0xe'));_0x5e85a7(_0x59dcff[_0x6702('0x16')][_0x6702('0x14')]);}})['catch'](function(_0x64190b){logger[_0x6702('0x13')](_0x6702('0xd'),_0x54ca0e,_0x64190b);_0x5e0819(_0x64190b);});});} \ No newline at end of file +var _0x7f20=['rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x11361f,_0x303a1d){var _0x521700=function(_0x55115c){while(--_0x55115c){_0x11361f['push'](_0x11361f['shift']());}};_0x521700(++_0x303a1d);}(_0x7f20,0xe0));var _0x07f2=function(_0x532150,_0xd71b97){_0x532150=_0x532150-0x0;var _0x31b423=_0x7f20[_0x532150];return _0x31b423;};'use strict';var _=require(_0x07f2('0x0'));var util=require('util');var moment=require(_0x07f2('0x1'));var BPromise=require(_0x07f2('0x2'));var rs=require(_0x07f2('0x3'));var fs=require('fs');var Redis=require(_0x07f2('0x4'));var db=require(_0x07f2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x07f2('0x6'))(_0x07f2('0x7'));var config=require(_0x07f2('0x8'));var jayson=require(_0x07f2('0x9'));var client=jayson['client'][_0x07f2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x380123,_0x52aa71,_0x2ba691){return new BPromise(function(_0x4195e1,_0x496f20){return client[_0x07f2('0xb')](_0x380123,_0x2ba691)[_0x07f2('0xc')](function(_0x5cde1b){logger[_0x07f2('0xd')](_0x07f2('0xe'),_0x52aa71,_0x07f2('0xf'));logger[_0x07f2('0x10')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x52aa71,'request\x20sent',JSON[_0x07f2('0x11')](_0x5cde1b));if(_0x5cde1b[_0x07f2('0x12')]){if(_0x5cde1b['error']['code']===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x52aa71,_0x5cde1b[_0x07f2('0x12')][_0x07f2('0x13')]);return _0x496f20(_0x5cde1b[_0x07f2('0x12')]['message']);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x52aa71,_0x5cde1b[_0x07f2('0x12')][_0x07f2('0x13')]);return _0x4195e1(_0x5cde1b[_0x07f2('0x12')][_0x07f2('0x13')]);}else{logger[_0x07f2('0xd')](_0x07f2('0xe'),_0x52aa71,'request\x20sent');_0x4195e1(_0x5cde1b[_0x07f2('0x14')][_0x07f2('0x13')]);}})['catch'](function(_0x1779bc){logger[_0x07f2('0x12')](_0x07f2('0xe'),_0x52aa71,_0x1779bc);_0x496f20(_0x1779bc);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index df8f4f4..deffbe5 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 _0xdad0=['./intZohoAccount.controller','index','get','/:id','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x1a60bb,_0x305072){var _0x5b8061=function(_0xa7e7a2){while(--_0xa7e7a2){_0x1a60bb['push'](_0x1a60bb['shift']());}};_0x5b8061(++_0x305072);}(_0xdad0,0x1c4));var _0x0dad=function(_0x340732,_0x46e36b){_0x340732=_0x340732-0x0;var _0x1999f0=_0xdad0[_0x340732];return _0x1999f0;};'use strict';var multer=require(_0x0dad('0x0'));var util=require(_0x0dad('0x1'));var path=require(_0x0dad('0x2'));var timeout=require(_0x0dad('0x3'));var express=require(_0x0dad('0x4'));var router=express['Router']();var fs_extra=require(_0x0dad('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0dad('0x6'));var config=require(_0x0dad('0x7'));var controller=require(_0x0dad('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x0dad('0x9')]);router[_0x0dad('0xa')](_0x0dad('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x0dad('0xa')](_0x0dad('0xc'),auth[_0x0dad('0xd')](),controller[_0x0dad('0xe')]);router[_0x0dad('0xa')](_0x0dad('0xf'),auth[_0x0dad('0xd')](),controller[_0x0dad('0x10')]);router[_0x0dad('0x11')]('/',auth[_0x0dad('0xd')](),controller['create']);router[_0x0dad('0x11')](_0x0dad('0xc'),auth[_0x0dad('0xd')](),controller[_0x0dad('0x12')]);router[_0x0dad('0x13')](_0x0dad('0xb'),auth[_0x0dad('0xd')](),controller[_0x0dad('0x14')]);router[_0x0dad('0x15')]('/:id',auth[_0x0dad('0xd')](),controller['destroy']);module[_0x0dad('0x16')]=router; \ No newline at end of file +var _0xc315=['delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','get','index','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update'];(function(_0xce5b22,_0x5c4553){var _0x4bd14e=function(_0x281c21){while(--_0x281c21){_0xce5b22['push'](_0xce5b22['shift']());}};_0x4bd14e(++_0x5c4553);}(_0xc315,0x10b));var _0x5c31=function(_0x4d80db,_0xfb4210){_0x4d80db=_0x4d80db-0x0;var _0x1cf0f7=_0xc315[_0x4d80db];return _0x1cf0f7;};'use strict';var multer=require(_0x5c31('0x0'));var util=require(_0x5c31('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5c31('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5c31('0x3'));var interaction=require(_0x5c31('0x4'));var config=require('../../config/environment');var controller=require(_0x5c31('0x5'));router[_0x5c31('0x6')]('/',auth['isAuthenticated'](),controller[_0x5c31('0x7')]);router['get']('/:id',auth[_0x5c31('0x8')](),controller[_0x5c31('0x9')]);router['get'](_0x5c31('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x5c31('0x6')](_0x5c31('0xb'),auth[_0x5c31('0x8')](),controller[_0x5c31('0xc')]);router[_0x5c31('0xd')]('/',auth[_0x5c31('0x8')](),controller[_0x5c31('0xe')]);router[_0x5c31('0xd')]('/:id/configurations',auth[_0x5c31('0x8')](),controller[_0x5c31('0xf')]);router[_0x5c31('0x10')](_0x5c31('0x11'),auth[_0x5c31('0x8')](),controller[_0x5c31('0x12')]);router[_0x5c31('0x13')]('/:id',auth[_0x5c31('0x8')](),controller[_0x5c31('0x14')]);module[_0x5c31('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index d9742e3..c8185bd 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 _0xf3cd=['exports','STRING','sequelize'];(function(_0xc30af,_0x14cd1e){var _0x5f2ed2=function(_0x39d5c7){while(--_0x39d5c7){_0xc30af['push'](_0xc30af['shift']());}};_0x5f2ed2(++_0x14cd1e);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x2a7c2a,_0x37cc9e){_0x2a7c2a=_0x2a7c2a-0x0;var _0x195732=_0xf3cd[_0x2a7c2a];return _0x195732;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'name':{'type':Sequelize[_0xdf3c('0x2')]},'description':{'type':Sequelize[_0xdf3c('0x2')]},'host':{'type':Sequelize[_0xdf3c('0x2')]},'zone':{'type':Sequelize[_0xdf3c('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xdf3c('0x2')]},'serverUrl':{'type':Sequelize[_0xdf3c('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xdf3c('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2dae=['STRING','sequelize'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2dae,0xc3));var _0xe2da=function(_0x34c063,_0x11d3d7){_0x34c063=_0x34c063-0x0;var _0x2c63a3=_0x2dae[_0x34c063];return _0x2c63a3;};'use strict';var Sequelize=require(_0xe2da('0x0'));module['exports']={'name':{'type':Sequelize[_0xe2da('0x1')]},'description':{'type':Sequelize[_0xe2da('0x1')]},'host':{'type':Sequelize[_0xe2da('0x1')]},'zone':{'type':Sequelize[_0xe2da('0x1')]},'clientId':{'type':Sequelize[_0xe2da('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xe2da('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xe2da('0x1')]},'refreshToken':{'type':Sequelize[_0xe2da('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 3a49c5b..2329569 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 _0x035a=['https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','refreshToken','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientSecret','serverUrl','code','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','push','display_label','custom_field','data_type','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','undefined','count','offset','limit','set','reject','save','update','destroy','then','end','sendStatus','error','name','index','map','ZohoAccount','rawAttributes','fieldName','model','query','fields','attributes','length','nolimit','order','sort','filters','pick','where','VIRTUAL','filter','merge','options','includeAll','findAll','rows','show','params','keys','intersection','include','find','catch','create','body','ZohoConfiguration','getConfigurations','addConfiguration','findOne','AccountId','Subjects','channel','type','ZohoField','Descriptions','zone','https://accounts.zoho.com.au'];(function(_0xbef11,_0x1d3004){var _0x227e3a=function(_0x47489b){while(--_0x47489b){_0xbef11['push'](_0xbef11['shift']());}};_0x227e3a(++_0x1d3004);}(_0x035a,0x1ad));var _0xa035=function(_0x3da78b,_0x541b12){_0x3da78b=_0x3da78b-0x0;var _0x4d0a37=_0x035a[_0x3da78b];return _0x4d0a37;};'use strict';var emlformat=require(_0xa035('0x0'));var rimraf=require(_0xa035('0x1'));var zipdir=require(_0xa035('0x2'));var jsonpatch=require(_0xa035('0x3'));var rp=require(_0xa035('0x4'));var moment=require(_0xa035('0x5'));var BPromise=require(_0xa035('0x6'));var Mustache=require(_0xa035('0x7'));var util=require(_0xa035('0x8'));var path=require('path');var sox=require(_0xa035('0x9'));var csv=require(_0xa035('0xa'));var ejs=require(_0xa035('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa035('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa035('0xd'));var Papa=require(_0xa035('0xe'));var Redis=require(_0xa035('0xf'));var authService=require(_0xa035('0x10'));var qs=require(_0xa035('0x11'));var as=require(_0xa035('0x12'));var hardwareService=require(_0xa035('0x13'));var logger=require(_0xa035('0x14'))(_0xa035('0x15'));var utils=require(_0xa035('0x16'));var config=require(_0xa035('0x17'));var licenseUtil=require(_0xa035('0x18'));var db=require(_0xa035('0x19'))['db'];var integrations=require(_0xa035('0x1a'));function respondWithStatusCode(_0x5a3bc7,_0x17bbc0){_0x17bbc0=_0x17bbc0||0xcc;return function(_0x1375a6){if(_0x1375a6){return _0x5a3bc7['sendStatus'](_0x17bbc0);}return _0x5a3bc7[_0xa035('0x1b')](_0x17bbc0)['end']();};}function respondWithResult(_0x35e290,_0x4ad6c0){_0x4ad6c0=_0x4ad6c0||0xc8;return function(_0x451fe4){if(_0x451fe4){return _0x35e290[_0xa035('0x1b')](_0x4ad6c0)[_0xa035('0x1c')](_0x451fe4);}};}function respondWithFilteredResult(_0x2e4ba6,_0x4e83cf){return function(_0x4bc89d){if(_0x4bc89d){var _0x3e9bee=typeof _0x4e83cf['offset']===_0xa035('0x1d')&&typeof _0x4e83cf['limit']==='undefined';var _0x4a95ad=_0x4bc89d[_0xa035('0x1e')];var _0x5de18a=_0x3e9bee?0x0:_0x4e83cf[_0xa035('0x1f')];var _0x4eb5bb=_0x3e9bee?_0x4bc89d['count']:_0x4e83cf[_0xa035('0x1f')]+_0x4e83cf[_0xa035('0x20')];var _0xf28a01;if(_0x4eb5bb>=_0x4a95ad){_0x4eb5bb=_0x4a95ad;_0xf28a01=0xc8;}else{_0xf28a01=0xce;}_0x2e4ba6['status'](_0xf28a01);return _0x2e4ba6[_0xa035('0x21')]('Content-Range',_0x5de18a+'-'+_0x4eb5bb+'/'+_0x4a95ad)['json'](_0x4bc89d);}return null;};}function patchUpdates(_0x35dfc7){return function(_0x353582){try{jsonpatch['apply'](_0x353582,_0x35dfc7,!![]);}catch(_0xcc808c){return BPromise[_0xa035('0x22')](_0xcc808c);}return _0x353582[_0xa035('0x23')]();};}function saveUpdates(_0x452c6f,_0x4512a2){return function(_0x1115a4){if(_0x1115a4){return _0x1115a4[_0xa035('0x24')](_0x452c6f)['then'](function(_0x237364){return _0x237364;});}return null;};}function removeEntity(_0x16e477,_0x3a0208){return function(_0x5a6ef5){if(_0x5a6ef5){return _0x5a6ef5[_0xa035('0x25')]()[_0xa035('0x26')](function(){_0x16e477[_0xa035('0x1b')](0xcc)[_0xa035('0x27')]();});}};}function handleEntityNotFound(_0x336a57,_0x288161){return function(_0x4334ac){if(!_0x4334ac){_0x336a57[_0xa035('0x28')](0x194);}return _0x4334ac;};}function handleError(_0x1b1dee,_0x1b9c32){_0x1b9c32=_0x1b9c32||0x1f4;return function(_0x40d713){logger[_0xa035('0x29')](_0x40d713['stack']);if(_0x40d713[_0xa035('0x2a')]){delete _0x40d713[_0xa035('0x2a')];}_0x1b1dee['status'](_0x1b9c32)['send'](_0x40d713);};}exports[_0xa035('0x2b')]=function(_0x7d3a1c,_0x1a23a5){var _0x4e1272={},_0x5cfa3b={},_0xbd53cb={'count':0x0,'rows':[]};var _0x55e91c=_[_0xa035('0x2c')](db[_0xa035('0x2d')][_0xa035('0x2e')],function(_0x2f2a63){return{'name':_0x2f2a63[_0xa035('0x2f')],'type':_0x2f2a63['type']['key']};});_0x5cfa3b[_0xa035('0x30')]=_[_0xa035('0x2c')](_0x55e91c,_0xa035('0x2a'));_0x5cfa3b['query']=_['keys'](_0x7d3a1c[_0xa035('0x31')]);_0x5cfa3b['filters']=_['intersection'](_0x5cfa3b[_0xa035('0x30')],_0x5cfa3b[_0xa035('0x31')]);_0x4e1272['attributes']=_['intersection'](_0x5cfa3b[_0xa035('0x30')],qs[_0xa035('0x32')](_0x7d3a1c[_0xa035('0x31')][_0xa035('0x32')]));_0x4e1272[_0xa035('0x33')]=_0x4e1272[_0xa035('0x33')][_0xa035('0x34')]?_0x4e1272['attributes']:_0x5cfa3b['model'];if(!_0x7d3a1c[_0xa035('0x31')]['hasOwnProperty'](_0xa035('0x35'))){_0x4e1272['limit']=qs[_0xa035('0x20')](_0x7d3a1c[_0xa035('0x31')]['limit']);_0x4e1272[_0xa035('0x1f')]=qs[_0xa035('0x1f')](_0x7d3a1c['query'][_0xa035('0x1f')]);}_0x4e1272[_0xa035('0x36')]=qs[_0xa035('0x37')](_0x7d3a1c[_0xa035('0x31')][_0xa035('0x37')]);_0x4e1272['where']=qs[_0xa035('0x38')](_[_0xa035('0x39')](_0x7d3a1c[_0xa035('0x31')],_0x5cfa3b[_0xa035('0x38')]),_0x55e91c);if(_0x7d3a1c[_0xa035('0x31')]['filter']){_0x4e1272[_0xa035('0x3a')]=_['merge'](_0x4e1272[_0xa035('0x3a')],{'$or':_[_0xa035('0x2c')](_0x55e91c,function(_0x90adcc){if(_0x90adcc['type']!==_0xa035('0x3b')){var _0x23f653={};_0x23f653[_0x90adcc['name']]={'$like':'%'+_0x7d3a1c['query'][_0xa035('0x3c')]+'%'};return _0x23f653;}})});}_0x4e1272=_[_0xa035('0x3d')]({},_0x4e1272,_0x7d3a1c[_0xa035('0x3e')]);var _0x10c94b={'where':_0x4e1272['where']};return db[_0xa035('0x2d')][_0xa035('0x1e')](_0x10c94b)[_0xa035('0x26')](function(_0x50f645){_0xbd53cb[_0xa035('0x1e')]=_0x50f645;if(_0x7d3a1c[_0xa035('0x31')][_0xa035('0x3f')]){_0x4e1272['include']=[{'all':!![]}];}return db['ZohoAccount'][_0xa035('0x40')](_0x4e1272);})[_0xa035('0x26')](function(_0x53ac4b){_0xbd53cb[_0xa035('0x41')]=_0x53ac4b;return _0xbd53cb;})[_0xa035('0x26')](respondWithFilteredResult(_0x1a23a5,_0x4e1272))['catch'](handleError(_0x1a23a5,null));};exports[_0xa035('0x42')]=function(_0x1eaa21,_0xd58a1e){var _0x31c19f={'raw':![],'where':{'id':_0x1eaa21[_0xa035('0x43')]['id']}},_0x5b497e={};_0x5b497e[_0xa035('0x30')]=_[_0xa035('0x44')](db['ZohoAccount']['rawAttributes']);_0x5b497e['query']=_[_0xa035('0x44')](_0x1eaa21['query']);_0x5b497e[_0xa035('0x38')]=_['intersection'](_0x5b497e['model'],_0x5b497e[_0xa035('0x31')]);_0x31c19f[_0xa035('0x33')]=_[_0xa035('0x45')](_0x5b497e[_0xa035('0x30')],qs['fields'](_0x1eaa21[_0xa035('0x31')][_0xa035('0x32')]));_0x31c19f[_0xa035('0x33')]=_0x31c19f[_0xa035('0x33')][_0xa035('0x34')]?_0x31c19f[_0xa035('0x33')]:_0x5b497e[_0xa035('0x30')];if(_0x1eaa21[_0xa035('0x31')][_0xa035('0x3f')]){_0x31c19f[_0xa035('0x46')]=[{'all':!![]}];}_0x31c19f=_['merge']({},_0x31c19f,_0x1eaa21[_0xa035('0x3e')]);return db[_0xa035('0x2d')][_0xa035('0x47')](_0x31c19f)[_0xa035('0x26')](handleEntityNotFound(_0xd58a1e,null))[_0xa035('0x26')](respondWithResult(_0xd58a1e,null))[_0xa035('0x48')](handleError(_0xd58a1e,null));};exports[_0xa035('0x49')]=function(_0x472265,_0x15219c){return db['ZohoAccount'][_0xa035('0x49')](_0x472265[_0xa035('0x4a')],{})['then'](respondWithResult(_0x15219c,0xc9))['catch'](handleError(_0x15219c,null));};exports[_0xa035('0x24')]=function(_0x5cdc0e,_0x1b435b){if(_0x5cdc0e['body']['id']){delete _0x5cdc0e[_0xa035('0x4a')]['id'];}return db[_0xa035('0x2d')][_0xa035('0x47')]({'where':{'id':_0x5cdc0e[_0xa035('0x43')]['id']}})[_0xa035('0x26')](handleEntityNotFound(_0x1b435b,null))[_0xa035('0x26')](saveUpdates(_0x5cdc0e[_0xa035('0x4a')],null))[_0xa035('0x26')](respondWithResult(_0x1b435b,null))[_0xa035('0x48')](handleError(_0x1b435b,null));};exports['destroy']=function(_0x5a33d2,_0x8750a2){return db[_0xa035('0x2d')][_0xa035('0x47')]({'where':{'id':_0x5a33d2[_0xa035('0x43')]['id']}})[_0xa035('0x26')](handleEntityNotFound(_0x8750a2,null))['then'](removeEntity(_0x8750a2,null))[_0xa035('0x48')](handleError(_0x8750a2,null));};exports['getConfigurations']=function(_0x36d4be,_0x1511d5,_0x4296ba){var _0x523ec8={};var _0x5544a5={};var _0x4476d6;var _0x42e652;return db[_0xa035('0x2d')]['findOne']({'where':{'id':_0x36d4be[_0xa035('0x43')]['id']}})[_0xa035('0x26')](handleEntityNotFound(_0x1511d5,null))[_0xa035('0x26')](function(_0x29a7c2){if(_0x29a7c2){_0x4476d6=_0x29a7c2;_0x5544a5[_0xa035('0x30')]=_['keys'](db[_0xa035('0x4b')][_0xa035('0x2e')]);_0x5544a5['query']=_['keys'](_0x36d4be[_0xa035('0x31')]);_0x5544a5[_0xa035('0x38')]=_[_0xa035('0x45')](_0x5544a5[_0xa035('0x30')],_0x5544a5['query']);_0x523ec8[_0xa035('0x33')]=_[_0xa035('0x45')](_0x5544a5[_0xa035('0x30')],qs[_0xa035('0x32')](_0x36d4be[_0xa035('0x31')][_0xa035('0x32')]));_0x523ec8[_0xa035('0x33')]=_0x523ec8[_0xa035('0x33')][_0xa035('0x34')]?_0x523ec8[_0xa035('0x33')]:_0x5544a5['model'];_0x523ec8[_0xa035('0x36')]=qs[_0xa035('0x37')](_0x36d4be[_0xa035('0x31')][_0xa035('0x37')]);_0x523ec8[_0xa035('0x3a')]=qs[_0xa035('0x38')](_[_0xa035('0x39')](_0x36d4be[_0xa035('0x31')],_0x5544a5['filters']));if(_0x36d4be['query'][_0xa035('0x3c')]){_0x523ec8['where']=_[_0xa035('0x3d')](_0x523ec8['where'],{'$or':_['map'](_0x523ec8[_0xa035('0x33')],function(_0x310789){var _0x3b0de0={};_0x3b0de0[_0x310789]={'$like':'%'+_0x36d4be['query'][_0xa035('0x3c')]+'%'};return _0x3b0de0;})});}_0x523ec8=_[_0xa035('0x3d')]({},_0x523ec8,_0x36d4be['options']);return _0x4476d6['getConfigurations'](_0x523ec8);}})[_0xa035('0x26')](function(_0x51587d){if(_0x51587d){_0x42e652=_0x51587d[_0xa035('0x34')];if(!_0x36d4be[_0xa035('0x31')]['hasOwnProperty'](_0xa035('0x35'))){_0x523ec8['limit']=qs[_0xa035('0x20')](_0x36d4be['query'][_0xa035('0x20')]);_0x523ec8[_0xa035('0x1f')]=qs['offset'](_0x36d4be[_0xa035('0x31')][_0xa035('0x1f')]);}return _0x4476d6[_0xa035('0x4c')](_0x523ec8);}})[_0xa035('0x26')](function(_0x13ed6d){if(_0x13ed6d){return _0x13ed6d?{'count':_0x42e652,'rows':_0x13ed6d}:null;}})[_0xa035('0x26')](respondWithResult(_0x1511d5,null))[_0xa035('0x48')](handleError(_0x1511d5,null));};exports[_0xa035('0x4d')]=function(_0x30f22b,_0x5170d3,_0x968113){if(_0x30f22b[_0xa035('0x4a')]['id']){delete _0x30f22b[_0xa035('0x4a')]['id'];}return db[_0xa035('0x2d')][_0xa035('0x4e')]({'where':{'id':_0x30f22b[_0xa035('0x43')]['id']}})[_0xa035('0x26')](handleEntityNotFound(_0x5170d3,null))['then'](function(_0x173a1b){if(_0x173a1b){_0x30f22b[_0xa035('0x4a')][_0xa035('0x4f')]=_0x173a1b['id'];_0x30f22b['body'][_0xa035('0x50')]=integrations['getSubjects'](_0x30f22b['body'][_0xa035('0x51')],_0x30f22b[_0xa035('0x4a')][_0xa035('0x52')]);_0x30f22b[_0xa035('0x4a')]['Descriptions']=integrations['getDescriptions'](_0x30f22b[_0xa035('0x4a')][_0xa035('0x51')],_0x30f22b[_0xa035('0x4a')][_0xa035('0x52')]);return db['ZohoConfiguration'][_0xa035('0x49')](_0x30f22b[_0xa035('0x4a')],{'include':[{'model':db['ZohoField'],'as':_0xa035('0x50')},{'model':db[_0xa035('0x53')],'as':_0xa035('0x54')}]});}return null;})[_0xa035('0x26')](respondWithResult(_0x5170d3,null))[_0xa035('0x48')](handleError(_0x5170d3,null));};function getAccessToken(_0x45f922){return new Promise(function(_0x15e38c,_0x40f89b){var _0xdb5641;switch(_0x45f922[_0xa035('0x55')]){case'US':_0xdb5641='https://accounts.zoho.com';break;case'AU':_0xdb5641=_0xa035('0x56');break;case'EU':_0xdb5641=_0xa035('0x57');break;case'IN':_0xdb5641='https://accounts.zoho.in';break;case'CN':_0xdb5641=_0xa035('0x58');break;default:_0xdb5641=_0xa035('0x57');break;}var _0x5e3fc8={'method':_0xa035('0x59'),'uri':_0xdb5641+'/oauth/v2/token','qs':{'refresh_token':_0x45f922[_0xa035('0x5a')],'client_id':_0x45f922[_0xa035('0x5b')],'client_secret':_0x45f922['clientSecret'],'grant_type':_0xa035('0x5c')},'json':!![]};return rp(_0x5e3fc8)[_0xa035('0x26')](function(_0x3e0281){if(_0x3e0281[_0xa035('0x5d')]){_0x15e38c(_0x3e0281['access_token']);}else{_0x40f89b(_0xa035('0x5e'));}})['catch'](function(_0xbed3f0){_0x40f89b(_0xbed3f0);});});}exports[_0xa035('0x5f')]=function(_0x25d5fd,_0x4355ff,_0xfd5489){var _0x28a9e6,_0x1141a6,_0xef465d,_0x263c0a,_0x4238d1;return db['ZohoAccount'][_0xa035('0x4e')]({'where':{'id':_0x25d5fd['params']['id']},'attributes':['id',_0xa035('0x60'),_0xa035('0x55'),_0xa035('0x5b'),_0xa035('0x61'),_0xa035('0x62'),_0xa035('0x63'),_0xa035('0x5a')]})[_0xa035('0x26')](handleEntityNotFound(_0x4355ff,null))['then'](function(_0x51a0a9){_0x4238d1=_0x51a0a9;_0x28a9e6=_0x4238d1[_0xa035('0x60')];_0x1141a6=_0x28a9e6===_0xa035('0x64')?'eu':'com';_0xef465d=_0x4238d1[_0xa035('0x62')];var _0x1538a0=_0xef465d[_0xa035('0x65')](-0x1);if(_0x1538a0==='/'||_0x1538a0==='\x5c'||_0x1538a0===':'){_0xef465d=_0xef465d[_0xa035('0x66')](0x0,_0xef465d[_0xa035('0x67')](_0x1538a0));}if(!_0x4238d1[_0xa035('0x5a')]){throw new Error(_0xa035('0x68'));}return getAccessToken(_0x4238d1);})[_0xa035('0x26')](function(_0x4d17d3){if(_0x4d17d3){return rp({'method':_0xa035('0x69'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x1141a6),'qs':{'module':_0xa035('0x6a')},'headers':{'Authorization':_0xa035('0x6b')+_0x4d17d3},'json':!![]});}})[_0xa035('0x26')](function(_0x4198f3){if(_0x4198f3){if(_0x4198f3[_0xa035('0x6c')]&&_0x4198f3[_0xa035('0x6c')][_0xa035('0x29')]){throw new Error(_0x4198f3[_0xa035('0x6c')]['error'][_0xa035('0x6d')]);}var _0x1dda50=[];var _0x813174=[];var _0x41de2a=[_0xa035('0x6e'),_0xa035('0x6f'),'Description',_0xa035('0x70'),_0xa035('0x71'),_0xa035('0x72'),_0xa035('0x73'),_0xa035('0x74')];_0x813174=_[_0xa035('0x75')](_0x4198f3[_0xa035('0x32')],function(_0x2652a0){return _0x41de2a[_0xa035('0x76')](_0x2652a0[_0xa035('0x77')]);});for(var _0x4c1c28=0x0;_0x4c1c28<_0x813174[_0xa035('0x34')];_0x4c1c28++){if(_0x813174[_0x4c1c28]['system_mandatory']===![]){_0x1dda50[_0xa035('0x78')]({'id':_0x813174[_0x4c1c28]['id'],'name':_0x813174[_0x4c1c28][_0xa035('0x79')],'custom':_0x813174[_0x4c1c28][_0xa035('0x7a')],'options':_0x813174[_0x4c1c28][_0xa035('0x7b')]===_0xa035('0x7c')&&_0x813174[_0x4c1c28][_0xa035('0x7d')][_0xa035('0x34')]>-0x1?_[_0xa035('0x2c')](_0x813174[_0x4c1c28][_0xa035('0x7d')],function(_0xe1636){return{'name':_0xe1636,'value':_0xe1636};}):[]});}}return{'count':_0x1dda50[_0xa035('0x34')],'rows':_0x1dda50};}else{return{'count':0x0,'rows':[]};}})[_0xa035('0x26')](respondWithResult(_0x4355ff,null))[_0xa035('0x48')](function(_0x28672e){var _0x5a377b=_0x25d5fd[_0xa035('0x31')][_0xa035('0x7e')]?0x1f4:_0x28672e['statusCode']||0x1f4;logger['error'](_0xa035('0x7f'),'getFields',_0x5a377b,JSON['stringify'](_0x28672e));delete _0x28672e[_0xa035('0x2a')];if(_0x5a377b===0x191){_0x5a377b=0x190;}_0x4355ff[_0xa035('0x1b')](_0x5a377b)['send'](_0x25d5fd[_0xa035('0x31')][_0xa035('0x7e')]?{'message':_0xa035('0x80'),'statusCode':_0x28672e['statusCode']}:_0x28672e);});}; \ No newline at end of file +var _0xb641=['code','zoho.eu','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','Calls','Zoho-oauthtoken\x20','response','message','Owner','Description','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','zip-dir','bluebird','sox','to-csv','ejs','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','then','end','error','stack','name','send','index','map','ZohoAccount','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','keys','includeAll','body','update','find','getConfigurations','findOne','ZohoConfiguration','order','pick','hasOwnProperty','AccountId','Subjects','getSubjects','channel','getDescriptions','create','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','clientSecret','serverUrl'];(function(_0x4c518d,_0x5e6af5){var _0x5c6288=function(_0x3d6ddd){while(--_0x3d6ddd){_0x4c518d['push'](_0x4c518d['shift']());}};_0x5c6288(++_0x5e6af5);}(_0xb641,0x9b));var _0x1b64=function(_0x8a38ff,_0x561d79){_0x8a38ff=_0x8a38ff-0x0;var _0x11ccdc=_0xb641[_0x8a38ff];return _0x11ccdc;};'use strict';var emlformat=require(_0x1b64('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1b64('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1b64('0x2'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1b64('0x3'));var csv=require(_0x1b64('0x4'));var ejs=require(_0x1b64('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1b64('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1b64('0x7'));var toCsv=require(_0x1b64('0x4'));var querystring=require('querystring');var Papa=require(_0x1b64('0x8'));var Redis=require(_0x1b64('0x9'));var authService=require(_0x1b64('0xa'));var qs=require(_0x1b64('0xb'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1b64('0xc'));var logger=require(_0x1b64('0xd'))('api');var utils=require(_0x1b64('0xe'));var config=require('../../config/environment');var licenseUtil=require(_0x1b64('0xf'));var db=require(_0x1b64('0x10'))['db'];var integrations=require(_0x1b64('0x11'));function respondWithStatusCode(_0x23d597,_0x14dbad){_0x14dbad=_0x14dbad||0xcc;return function(_0x264992){if(_0x264992){return _0x23d597[_0x1b64('0x12')](_0x14dbad);}return _0x23d597[_0x1b64('0x13')](_0x14dbad)['end']();};}function respondWithResult(_0x5de0ad,_0x3f93fe){_0x3f93fe=_0x3f93fe||0xc8;return function(_0x3cafe7){if(_0x3cafe7){return _0x5de0ad[_0x1b64('0x13')](_0x3f93fe)[_0x1b64('0x14')](_0x3cafe7);}};}function respondWithFilteredResult(_0x35c9f8,_0x771866){return function(_0x1f958f){if(_0x1f958f){var _0x9318ad=typeof _0x771866[_0x1b64('0x15')]===_0x1b64('0x16')&&typeof _0x771866[_0x1b64('0x17')]===_0x1b64('0x16');var _0x3c5af2=_0x1f958f[_0x1b64('0x18')];var _0x31a7f2=_0x9318ad?0x0:_0x771866[_0x1b64('0x15')];var _0x3a96bd=_0x9318ad?_0x1f958f[_0x1b64('0x18')]:_0x771866[_0x1b64('0x15')]+_0x771866[_0x1b64('0x17')];var _0x5639c1;if(_0x3a96bd>=_0x3c5af2){_0x3a96bd=_0x3c5af2;_0x5639c1=0xc8;}else{_0x5639c1=0xce;}_0x35c9f8[_0x1b64('0x13')](_0x5639c1);return _0x35c9f8['set']('Content-Range',_0x31a7f2+'-'+_0x3a96bd+'/'+_0x3c5af2)[_0x1b64('0x14')](_0x1f958f);}return null;};}function patchUpdates(_0x40d53c){return function(_0x47247b){try{jsonpatch[_0x1b64('0x19')](_0x47247b,_0x40d53c,!![]);}catch(_0x2203e4){return BPromise[_0x1b64('0x1a')](_0x2203e4);}return _0x47247b[_0x1b64('0x1b')]();};}function saveUpdates(_0x261425,_0x2bef51){return function(_0x42d0f8){if(_0x42d0f8){return _0x42d0f8['update'](_0x261425)[_0x1b64('0x1c')](function(_0x24069c){return _0x24069c;});}return null;};}function removeEntity(_0x48934e,_0x1b6594){return function(_0x44bd0f){if(_0x44bd0f){return _0x44bd0f['destroy']()['then'](function(){_0x48934e[_0x1b64('0x13')](0xcc)[_0x1b64('0x1d')]();});}};}function handleEntityNotFound(_0x54d330,_0x3f7a7c){return function(_0x4239b8){if(!_0x4239b8){_0x54d330[_0x1b64('0x12')](0x194);}return _0x4239b8;};}function handleError(_0x447c47,_0x37fa11){_0x37fa11=_0x37fa11||0x1f4;return function(_0x31e691){logger[_0x1b64('0x1e')](_0x31e691[_0x1b64('0x1f')]);if(_0x31e691[_0x1b64('0x20')]){delete _0x31e691[_0x1b64('0x20')];}_0x447c47[_0x1b64('0x13')](_0x37fa11)[_0x1b64('0x21')](_0x31e691);};}exports[_0x1b64('0x22')]=function(_0x8eeaf3,_0x119393){var _0x58092c={},_0x1d38ca={},_0x452258={'count':0x0,'rows':[]};var _0x50b047=_[_0x1b64('0x23')](db[_0x1b64('0x24')][_0x1b64('0x25')],function(_0x18b7e0){return{'name':_0x18b7e0['fieldName'],'type':_0x18b7e0[_0x1b64('0x26')][_0x1b64('0x27')]};});_0x1d38ca['model']=_[_0x1b64('0x23')](_0x50b047,_0x1b64('0x20'));_0x1d38ca[_0x1b64('0x28')]=_['keys'](_0x8eeaf3[_0x1b64('0x28')]);_0x1d38ca[_0x1b64('0x29')]=_[_0x1b64('0x2a')](_0x1d38ca[_0x1b64('0x2b')],_0x1d38ca[_0x1b64('0x28')]);_0x58092c[_0x1b64('0x2c')]=_[_0x1b64('0x2a')](_0x1d38ca[_0x1b64('0x2b')],qs['fields'](_0x8eeaf3[_0x1b64('0x28')][_0x1b64('0x2d')]));_0x58092c[_0x1b64('0x2c')]=_0x58092c[_0x1b64('0x2c')][_0x1b64('0x2e')]?_0x58092c[_0x1b64('0x2c')]:_0x1d38ca[_0x1b64('0x2b')];if(!_0x8eeaf3[_0x1b64('0x28')]['hasOwnProperty'](_0x1b64('0x2f'))){_0x58092c[_0x1b64('0x17')]=qs[_0x1b64('0x17')](_0x8eeaf3[_0x1b64('0x28')][_0x1b64('0x17')]);_0x58092c[_0x1b64('0x15')]=qs['offset'](_0x8eeaf3[_0x1b64('0x28')][_0x1b64('0x15')]);}_0x58092c['order']=qs['sort'](_0x8eeaf3['query'][_0x1b64('0x30')]);_0x58092c['where']=qs[_0x1b64('0x29')](_['pick'](_0x8eeaf3['query'],_0x1d38ca[_0x1b64('0x29')]),_0x50b047);if(_0x8eeaf3[_0x1b64('0x28')]['filter']){_0x58092c[_0x1b64('0x31')]=_[_0x1b64('0x32')](_0x58092c[_0x1b64('0x31')],{'$or':_['map'](_0x50b047,function(_0x23763a){if(_0x23763a[_0x1b64('0x26')]!==_0x1b64('0x33')){var _0x2d903f={};_0x2d903f[_0x23763a[_0x1b64('0x20')]]={'$like':'%'+_0x8eeaf3[_0x1b64('0x28')][_0x1b64('0x34')]+'%'};return _0x2d903f;}})});}_0x58092c=_[_0x1b64('0x32')]({},_0x58092c,_0x8eeaf3[_0x1b64('0x35')]);var _0x5cfdae={'where':_0x58092c['where']};return db[_0x1b64('0x24')][_0x1b64('0x18')](_0x5cfdae)[_0x1b64('0x1c')](function(_0x5a2165){_0x452258[_0x1b64('0x18')]=_0x5a2165;if(_0x8eeaf3[_0x1b64('0x28')]['includeAll']){_0x58092c[_0x1b64('0x36')]=[{'all':!![]}];}return db[_0x1b64('0x24')][_0x1b64('0x37')](_0x58092c);})['then'](function(_0x3f2944){_0x452258[_0x1b64('0x38')]=_0x3f2944;return _0x452258;})[_0x1b64('0x1c')](respondWithFilteredResult(_0x119393,_0x58092c))[_0x1b64('0x39')](handleError(_0x119393,null));};exports[_0x1b64('0x3a')]=function(_0x512f72,_0x34381e){var _0x596710={'raw':![],'where':{'id':_0x512f72[_0x1b64('0x3b')]['id']}},_0x34e385={};_0x34e385['model']=_[_0x1b64('0x3c')](db[_0x1b64('0x24')][_0x1b64('0x25')]);_0x34e385[_0x1b64('0x28')]=_[_0x1b64('0x3c')](_0x512f72[_0x1b64('0x28')]);_0x34e385[_0x1b64('0x29')]=_[_0x1b64('0x2a')](_0x34e385[_0x1b64('0x2b')],_0x34e385[_0x1b64('0x28')]);_0x596710[_0x1b64('0x2c')]=_[_0x1b64('0x2a')](_0x34e385[_0x1b64('0x2b')],qs[_0x1b64('0x2d')](_0x512f72[_0x1b64('0x28')][_0x1b64('0x2d')]));_0x596710['attributes']=_0x596710[_0x1b64('0x2c')][_0x1b64('0x2e')]?_0x596710[_0x1b64('0x2c')]:_0x34e385['model'];if(_0x512f72[_0x1b64('0x28')][_0x1b64('0x3d')]){_0x596710[_0x1b64('0x36')]=[{'all':!![]}];}_0x596710=_[_0x1b64('0x32')]({},_0x596710,_0x512f72[_0x1b64('0x35')]);return db['ZohoAccount']['find'](_0x596710)['then'](handleEntityNotFound(_0x34381e,null))[_0x1b64('0x1c')](respondWithResult(_0x34381e,null))[_0x1b64('0x39')](handleError(_0x34381e,null));};exports['create']=function(_0x4baeaf,_0x563588){return db[_0x1b64('0x24')]['create'](_0x4baeaf[_0x1b64('0x3e')],{})[_0x1b64('0x1c')](respondWithResult(_0x563588,0xc9))[_0x1b64('0x39')](handleError(_0x563588,null));};exports[_0x1b64('0x3f')]=function(_0x6055aa,_0x52bf80){if(_0x6055aa[_0x1b64('0x3e')]['id']){delete _0x6055aa[_0x1b64('0x3e')]['id'];}return db[_0x1b64('0x24')][_0x1b64('0x40')]({'where':{'id':_0x6055aa[_0x1b64('0x3b')]['id']}})[_0x1b64('0x1c')](handleEntityNotFound(_0x52bf80,null))[_0x1b64('0x1c')](saveUpdates(_0x6055aa[_0x1b64('0x3e')],null))[_0x1b64('0x1c')](respondWithResult(_0x52bf80,null))[_0x1b64('0x39')](handleError(_0x52bf80,null));};exports['destroy']=function(_0x143960,_0x5780b8){return db['ZohoAccount'][_0x1b64('0x40')]({'where':{'id':_0x143960[_0x1b64('0x3b')]['id']}})['then'](handleEntityNotFound(_0x5780b8,null))[_0x1b64('0x1c')](removeEntity(_0x5780b8,null))['catch'](handleError(_0x5780b8,null));};exports[_0x1b64('0x41')]=function(_0x451448,_0xdceb77,_0x2a8557){var _0xc470b7={};var _0x1160be={};var _0x1cbef8;var _0x14ad71;return db['ZohoAccount'][_0x1b64('0x42')]({'where':{'id':_0x451448[_0x1b64('0x3b')]['id']}})[_0x1b64('0x1c')](handleEntityNotFound(_0xdceb77,null))[_0x1b64('0x1c')](function(_0x25f87a){if(_0x25f87a){_0x1cbef8=_0x25f87a;_0x1160be['model']=_[_0x1b64('0x3c')](db[_0x1b64('0x43')][_0x1b64('0x25')]);_0x1160be[_0x1b64('0x28')]=_[_0x1b64('0x3c')](_0x451448[_0x1b64('0x28')]);_0x1160be[_0x1b64('0x29')]=_[_0x1b64('0x2a')](_0x1160be[_0x1b64('0x2b')],_0x1160be['query']);_0xc470b7[_0x1b64('0x2c')]=_[_0x1b64('0x2a')](_0x1160be[_0x1b64('0x2b')],qs[_0x1b64('0x2d')](_0x451448[_0x1b64('0x28')][_0x1b64('0x2d')]));_0xc470b7[_0x1b64('0x2c')]=_0xc470b7[_0x1b64('0x2c')][_0x1b64('0x2e')]?_0xc470b7[_0x1b64('0x2c')]:_0x1160be[_0x1b64('0x2b')];_0xc470b7[_0x1b64('0x44')]=qs['sort'](_0x451448['query'][_0x1b64('0x30')]);_0xc470b7['where']=qs[_0x1b64('0x29')](_[_0x1b64('0x45')](_0x451448[_0x1b64('0x28')],_0x1160be[_0x1b64('0x29')]));if(_0x451448[_0x1b64('0x28')][_0x1b64('0x34')]){_0xc470b7[_0x1b64('0x31')]=_['merge'](_0xc470b7[_0x1b64('0x31')],{'$or':_[_0x1b64('0x23')](_0xc470b7['attributes'],function(_0x18cb97){var _0x5a1c50={};_0x5a1c50[_0x18cb97]={'$like':'%'+_0x451448[_0x1b64('0x28')][_0x1b64('0x34')]+'%'};return _0x5a1c50;})});}_0xc470b7=_[_0x1b64('0x32')]({},_0xc470b7,_0x451448[_0x1b64('0x35')]);return _0x1cbef8['getConfigurations'](_0xc470b7);}})[_0x1b64('0x1c')](function(_0x245a8f){if(_0x245a8f){_0x14ad71=_0x245a8f[_0x1b64('0x2e')];if(!_0x451448[_0x1b64('0x28')][_0x1b64('0x46')](_0x1b64('0x2f'))){_0xc470b7[_0x1b64('0x17')]=qs[_0x1b64('0x17')](_0x451448['query'][_0x1b64('0x17')]);_0xc470b7['offset']=qs[_0x1b64('0x15')](_0x451448[_0x1b64('0x28')][_0x1b64('0x15')]);}return _0x1cbef8[_0x1b64('0x41')](_0xc470b7);}})[_0x1b64('0x1c')](function(_0xcf364d){if(_0xcf364d){return _0xcf364d?{'count':_0x14ad71,'rows':_0xcf364d}:null;}})[_0x1b64('0x1c')](respondWithResult(_0xdceb77,null))[_0x1b64('0x39')](handleError(_0xdceb77,null));};exports['addConfiguration']=function(_0x1ef9f1,_0x1ef249,_0x89eadf){if(_0x1ef9f1[_0x1b64('0x3e')]['id']){delete _0x1ef9f1[_0x1b64('0x3e')]['id'];}return db[_0x1b64('0x24')][_0x1b64('0x42')]({'where':{'id':_0x1ef9f1[_0x1b64('0x3b')]['id']}})['then'](handleEntityNotFound(_0x1ef249,null))[_0x1b64('0x1c')](function(_0x555cfb){if(_0x555cfb){_0x1ef9f1[_0x1b64('0x3e')][_0x1b64('0x47')]=_0x555cfb['id'];_0x1ef9f1['body'][_0x1b64('0x48')]=integrations[_0x1b64('0x49')](_0x1ef9f1[_0x1b64('0x3e')][_0x1b64('0x4a')],_0x1ef9f1[_0x1b64('0x3e')][_0x1b64('0x26')]);_0x1ef9f1[_0x1b64('0x3e')]['Descriptions']=integrations[_0x1b64('0x4b')](_0x1ef9f1['body'][_0x1b64('0x4a')],_0x1ef9f1['body']['type']);return db[_0x1b64('0x43')][_0x1b64('0x4c')](_0x1ef9f1[_0x1b64('0x3e')],{'include':[{'model':db[_0x1b64('0x4d')],'as':_0x1b64('0x48')},{'model':db[_0x1b64('0x4d')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x1ef249,null))[_0x1b64('0x39')](handleError(_0x1ef249,null));};function getAccessToken(_0x259de0){return new Promise(function(_0x346e72,_0x5ae84b){var _0x1b0d22;switch(_0x259de0[_0x1b64('0x4e')]){case'US':_0x1b0d22='https://accounts.zoho.com';break;case'AU':_0x1b0d22=_0x1b64('0x4f');break;case'EU':_0x1b0d22=_0x1b64('0x50');break;case'IN':_0x1b0d22=_0x1b64('0x51');break;case'CN':_0x1b0d22=_0x1b64('0x52');break;default:_0x1b0d22=_0x1b64('0x50');break;}var _0x33e3b4={'method':_0x1b64('0x53'),'uri':_0x1b0d22+_0x1b64('0x54'),'qs':{'refresh_token':_0x259de0['refreshToken'],'client_id':_0x259de0['clientId'],'client_secret':_0x259de0['clientSecret'],'grant_type':_0x1b64('0x55')},'json':!![]};return rp(_0x33e3b4)['then'](function(_0x380eb5){if(_0x380eb5['access_token']){_0x346e72(_0x380eb5[_0x1b64('0x56')]);}else{_0x5ae84b(_0x1b64('0x57'));}})['catch'](function(_0x11a513){_0x5ae84b(_0x11a513);});});}exports['getFields']=function(_0x1a77fd,_0x3decac,_0x4a2a82){var _0x5337ef,_0x3d9b01,_0x357e7f,_0x47449e,_0x4a7289;return db['ZohoAccount'][_0x1b64('0x42')]({'where':{'id':_0x1a77fd['params']['id']},'attributes':['id',_0x1b64('0x58'),_0x1b64('0x4e'),'clientId',_0x1b64('0x59'),_0x1b64('0x5a'),_0x1b64('0x5b'),'refreshToken']})[_0x1b64('0x1c')](handleEntityNotFound(_0x3decac,null))['then'](function(_0x19f8fc){_0x4a7289=_0x19f8fc;_0x5337ef=_0x4a7289[_0x1b64('0x58')];_0x3d9b01=_0x5337ef===_0x1b64('0x5c')?'eu':_0x1b64('0x5d');_0x357e7f=_0x4a7289[_0x1b64('0x5a')];var _0x24b5f3=_0x357e7f[_0x1b64('0x5e')](-0x1);if(_0x24b5f3==='/'||_0x24b5f3==='\x5c'||_0x24b5f3===':'){_0x357e7f=_0x357e7f['substring'](0x0,_0x357e7f[_0x1b64('0x5f')](_0x24b5f3));}if(!_0x4a7289['refreshToken']){throw new Error(_0x1b64('0x60'));}return getAccessToken(_0x4a7289);})[_0x1b64('0x1c')](function(_0x5c1133){if(_0x5c1133){return rp({'method':'GET','uri':util[_0x1b64('0x61')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x3d9b01),'qs':{'module':_0x1b64('0x62')},'headers':{'Authorization':_0x1b64('0x63')+_0x5c1133},'json':!![]});}})['then'](function(_0x340654){if(_0x340654){if(_0x340654[_0x1b64('0x64')]&&_0x340654[_0x1b64('0x64')][_0x1b64('0x1e')]){throw new Error(_0x340654[_0x1b64('0x64')][_0x1b64('0x1e')][_0x1b64('0x65')]);}var _0x45ab0b=[];var _0x10d36a=[];var _0x4be178=[_0x1b64('0x66'),'Subject',_0x1b64('0x67'),'WhoId',_0x1b64('0x68'),_0x1b64('0x69'),_0x1b64('0x6a'),_0x1b64('0x6b')];_0x10d36a=_[_0x1b64('0x6c')](_0x340654['fields'],function(_0x396462){return _0x4be178[_0x1b64('0x6d')](_0x396462[_0x1b64('0x6e')]);});for(var _0x50db29=0x0;_0x50db29<_0x10d36a['length'];_0x50db29++){if(_0x10d36a[_0x50db29]['system_mandatory']===![]){_0x45ab0b[_0x1b64('0x6f')]({'id':_0x10d36a[_0x50db29]['id'],'name':_0x10d36a[_0x50db29][_0x1b64('0x70')],'custom':_0x10d36a[_0x50db29][_0x1b64('0x71')],'options':_0x10d36a[_0x50db29][_0x1b64('0x72')]===_0x1b64('0x73')&&_0x10d36a[_0x50db29]['pick_list_values'][_0x1b64('0x2e')]>-0x1?_[_0x1b64('0x23')](_0x10d36a[_0x50db29][_0x1b64('0x74')],function(_0x12a7e6){return{'name':_0x12a7e6,'value':_0x12a7e6};}):[]});}}return{'count':_0x45ab0b['length'],'rows':_0x45ab0b};}else{return{'count':0x0,'rows':[]};}})[_0x1b64('0x1c')](respondWithResult(_0x3decac,null))[_0x1b64('0x39')](function(_0x5b890a){var _0x3fabb6=_0x1a77fd[_0x1b64('0x28')][_0x1b64('0x75')]?0x1f4:_0x5b890a[_0x1b64('0x76')]||0x1f4;logger['error'](_0x1b64('0x77'),_0x1b64('0x78'),_0x3fabb6,JSON[_0x1b64('0x79')](_0x5b890a));delete _0x5b890a['name'];if(_0x3fabb6===0x191){_0x3fabb6=0x190;}_0x3decac[_0x1b64('0x13')](_0x3fabb6)[_0x1b64('0x21')](_0x1a77fd['query']['test']?{'message':_0x1b64('0x7a'),'statusCode':_0x5b890a[_0x1b64('0x76')]}:_0x5b890a);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index d64dfce..20e83d9 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 _0xda6b=['parse','error','inspect','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','clientId','code','serverUrl','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientSecret','application/x-www-form-urlencoded','then','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','host','substring'];(function(_0x5180c3,_0x4b35f7){var _0x55c975=function(_0x4746cb){while(--_0x4746cb){_0x5180c3['push'](_0x5180c3['shift']());}};_0x55c975(++_0x4b35f7);}(_0xda6b,0x137));var _0xbda6=function(_0x39dd2b,_0x4e4f78){_0x39dd2b=_0x39dd2b-0x0;var _0x1ffc82=_0xda6b[_0x39dd2b];return _0x1ffc82;};'use strict';var _=require(_0xbda6('0x0'));var util=require(_0xbda6('0x1'));var logger=require(_0xbda6('0x2'))(_0xbda6('0x3'));var moment=require(_0xbda6('0x4'));var BPromise=require(_0xbda6('0x5'));var rp=require(_0xbda6('0x6'));var fs=require('fs');var path=require(_0xbda6('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xbda6('0x8'));module[_0xbda6('0x9')]=function(_0x32e4c1,_0x59715c){return _0x32e4c1[_0xbda6('0xa')](_0xbda6('0xb'),attributes,{'tableName':_0xbda6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x17b1fe,_0x537632,_0x4f9128){if(_0x17b1fe[_0xbda6('0xd')](_0xbda6('0xe'))||_0x17b1fe[_0xbda6('0xd')]('serverUrl')||_0x17b1fe['changed'](_0xbda6('0xf'))||_0x17b1fe['changed']('clientSecret')||_0x17b1fe[_0xbda6('0xd')](_0xbda6('0x10'))||_0x17b1fe[_0xbda6('0xd')]('host')){var _0x3e31a6,_0x17e261;_0x3e31a6=_0x17b1fe[_0xbda6('0x11')];var _0x21412a=_0x3e31a6[_0xbda6('0x12')](-0x1);if(_0x21412a==='/'||_0x21412a==='\x5c'||_0x21412a===':'){_0x3e31a6=_0x3e31a6['substring'](0x0,_0x3e31a6[_0xbda6('0x13')](_0x21412a));}switch(_0x17b1fe[_0xbda6('0xe')]){case'US':_0x17e261=_0xbda6('0x14');break;case'AU':_0x17e261=_0xbda6('0x15');break;case'IN':_0x17e261=_0xbda6('0x16');break;case'CN':_0x17e261=_0xbda6('0x17');break;default:_0x17e261=_0xbda6('0x18');break;}var _0x30bb7a={'method':_0xbda6('0x19'),'uri':_0x17e261+_0xbda6('0x1a'),'form':{'grant_type':_0xbda6('0x1b'),'client_id':_0x17b1fe[_0xbda6('0xf')],'client_secret':_0x17b1fe[_0xbda6('0x1c')],'redirect_uri':_0x17b1fe['serverUrl'],'code':_0x17b1fe['code']},'headers':{'Content-Type':_0xbda6('0x1d')}};return rp(_0x30bb7a)[_0xbda6('0x1e')](function(_0x5eb87c){var _0x234a59=JSON['parse'](_0x5eb87c);if(_0x234a59[_0xbda6('0x1f')]){_0x17b1fe[_0xbda6('0x20')]=_0x234a59[_0xbda6('0x1f')];logger[_0xbda6('0x21')](util[_0xbda6('0x22')](_0xbda6('0x23'),_0x17b1fe[_0xbda6('0x24')],_0x17b1fe['id']));}else{logger['error'](util[_0xbda6('0x22')](_0xbda6('0x25'),_0x17b1fe[_0xbda6('0x24')],_0x17b1fe['id']),util['inspect'](_0x234a59,{'showHidden':![],'depth':null}));}return _0x4f9128(null,_0x537632);})[_0xbda6('0x26')](function(_0x22df13){logger['error'](util[_0xbda6('0x22')](_0xbda6('0x25'),_0x17b1fe[_0xbda6('0x24')],_0x17b1fe['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x4f9128(_0x22df13);});}else{return _0x4f9128(null,_0x537632);}},'beforeUpdate':function(_0x1a0e9b,_0x5d9b95,_0x32b2a1){if(_0x1a0e9b[_0xbda6('0xd')](_0xbda6('0xe'))||_0x1a0e9b[_0xbda6('0xd')](_0xbda6('0x11'))||_0x1a0e9b[_0xbda6('0xd')](_0xbda6('0xf'))||_0x1a0e9b[_0xbda6('0xd')](_0xbda6('0x1c'))||_0x1a0e9b['changed'](_0xbda6('0x10'))||_0x1a0e9b[_0xbda6('0xd')](_0xbda6('0x27'))){var _0x30e57d,_0x119b6a;_0x30e57d=_0x1a0e9b['serverUrl'];var _0x4f68f6=_0x30e57d[_0xbda6('0x12')](-0x1);if(_0x4f68f6==='/'||_0x4f68f6==='\x5c'||_0x4f68f6===':'){_0x30e57d=_0x30e57d[_0xbda6('0x28')](0x0,_0x30e57d['lastIndexOf'](_0x4f68f6));}switch(_0x1a0e9b[_0xbda6('0xe')]){case'US':_0x119b6a=_0xbda6('0x14');break;case'AU':_0x119b6a=_0xbda6('0x15');break;case'IN':_0x119b6a='https://accounts.zoho.in';break;case'CN':_0x119b6a=_0xbda6('0x17');break;default:_0x119b6a=_0xbda6('0x18');break;}var _0x5aa3a5={'method':_0xbda6('0x19'),'uri':_0x119b6a+'/oauth/v2/token','form':{'grant_type':_0xbda6('0x1b'),'client_id':_0x1a0e9b[_0xbda6('0xf')],'client_secret':_0x1a0e9b[_0xbda6('0x1c')],'redirect_uri':_0x1a0e9b['serverUrl'],'code':_0x1a0e9b['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x5aa3a5)[_0xbda6('0x1e')](function(_0x3149c9){var _0x43d8f9=JSON[_0xbda6('0x29')](_0x3149c9);if(_0x43d8f9['refresh_token']){_0x1a0e9b[_0xbda6('0x20')]=_0x43d8f9[_0xbda6('0x1f')];logger['info'](util['format'](_0xbda6('0x23'),_0x1a0e9b[_0xbda6('0x24')],_0x1a0e9b['id']));}else{logger[_0xbda6('0x2a')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1a0e9b['name'],_0x1a0e9b['id']),util['inspect'](_0x43d8f9,{'showHidden':![],'depth':null}));}return _0x32b2a1(null,_0x5d9b95);})[_0xbda6('0x26')](function(_0x19eabf){logger[_0xbda6('0x2a')](util[_0xbda6('0x22')](_0xbda6('0x25'),_0x1a0e9b['name'],_0x1a0e9b['id']),util[_0xbda6('0x2b')](parsedResult,{'showHidden':![],'depth':null}));return _0x32b2a1(_0x19eabf);});}else{return _0x32b2a1(null,_0x5d9b95);}}}});}; \ No newline at end of file +var _0x5f44=['rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','zone','changed','serverUrl','clientId','clientSecret','code','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','refresh_token','refreshToken','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','POST','parse','info','util','../../config/logger','api','moment','request-promise'];(function(_0x3a099a,_0x12b55a){var _0x47a694=function(_0x4d721b){while(--_0x4d721b){_0x3a099a['push'](_0x3a099a['shift']());}};_0x47a694(++_0x12b55a);}(_0x5f44,0x1e7));var _0x45f4=function(_0x517278,_0x392ed4){_0x517278=_0x517278-0x0;var _0x3cccef=_0x5f44[_0x517278];return _0x3cccef;};'use strict';var _=require('lodash');var util=require(_0x45f4('0x0'));var logger=require(_0x45f4('0x1'))(_0x45f4('0x2'));var moment=require(_0x45f4('0x3'));var BPromise=require('bluebird');var rp=require(_0x45f4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x45f4('0x5'));var config=require(_0x45f4('0x6'));var attributes=require(_0x45f4('0x7'));var integrations=require(_0x45f4('0x8'));module['exports']=function(_0x138037,_0x2dd501){return _0x138037[_0x45f4('0x9')](_0x45f4('0xa'),attributes,{'tableName':_0x45f4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x42a78d,_0x357ad4,_0x51f387){if(_0x42a78d['changed'](_0x45f4('0xc'))||_0x42a78d[_0x45f4('0xd')](_0x45f4('0xe'))||_0x42a78d[_0x45f4('0xd')](_0x45f4('0xf'))||_0x42a78d[_0x45f4('0xd')](_0x45f4('0x10'))||_0x42a78d['changed'](_0x45f4('0x11'))||_0x42a78d[_0x45f4('0xd')]('host')){var _0x53de42,_0x38b826;_0x53de42=_0x42a78d[_0x45f4('0xe')];var _0x292e59=_0x53de42[_0x45f4('0x12')](-0x1);if(_0x292e59==='/'||_0x292e59==='\x5c'||_0x292e59===':'){_0x53de42=_0x53de42[_0x45f4('0x13')](0x0,_0x53de42[_0x45f4('0x14')](_0x292e59));}switch(_0x42a78d[_0x45f4('0xc')]){case'US':_0x38b826=_0x45f4('0x15');break;case'AU':_0x38b826='https://accounts.zoho.com.au';break;case'IN':_0x38b826=_0x45f4('0x16');break;case'CN':_0x38b826='https://accounts.zoho.com.cn';break;default:_0x38b826=_0x45f4('0x17');break;}var _0x479e8f={'method':'POST','uri':_0x38b826+_0x45f4('0x18'),'form':{'grant_type':_0x45f4('0x19'),'client_id':_0x42a78d[_0x45f4('0xf')],'client_secret':_0x42a78d[_0x45f4('0x10')],'redirect_uri':_0x42a78d['serverUrl'],'code':_0x42a78d[_0x45f4('0x11')]},'headers':{'Content-Type':_0x45f4('0x1a')}};return rp(_0x479e8f)[_0x45f4('0x1b')](function(_0x9e5540){var _0x31da06=JSON['parse'](_0x9e5540);if(_0x31da06[_0x45f4('0x1c')]){_0x42a78d[_0x45f4('0x1d')]=_0x31da06['refresh_token'];logger['info'](util[_0x45f4('0x1e')](_0x45f4('0x1f'),_0x42a78d[_0x45f4('0x20')],_0x42a78d['id']));}else{logger[_0x45f4('0x21')](util[_0x45f4('0x1e')](_0x45f4('0x22'),_0x42a78d[_0x45f4('0x20')],_0x42a78d['id']),util['inspect'](_0x31da06,{'showHidden':![],'depth':null}));}return _0x51f387(null,_0x357ad4);})['catch'](function(_0x1be036){logger['error'](util['format'](_0x45f4('0x22'),_0x42a78d['name'],_0x42a78d['id']),util[_0x45f4('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x51f387(_0x1be036);});}else{return _0x51f387(null,_0x357ad4);}},'beforeUpdate':function(_0x3a077c,_0x3d609b,_0x466b01){if(_0x3a077c[_0x45f4('0xd')]('zone')||_0x3a077c[_0x45f4('0xd')](_0x45f4('0xe'))||_0x3a077c[_0x45f4('0xd')]('clientId')||_0x3a077c[_0x45f4('0xd')](_0x45f4('0x10'))||_0x3a077c[_0x45f4('0xd')](_0x45f4('0x11'))||_0x3a077c['changed']('host')){var _0x249617,_0x41fe55;_0x249617=_0x3a077c[_0x45f4('0xe')];var _0x57940b=_0x249617[_0x45f4('0x12')](-0x1);if(_0x57940b==='/'||_0x57940b==='\x5c'||_0x57940b===':'){_0x249617=_0x249617[_0x45f4('0x13')](0x0,_0x249617[_0x45f4('0x14')](_0x57940b));}switch(_0x3a077c['zone']){case'US':_0x41fe55='https://accounts.zoho.com';break;case'AU':_0x41fe55=_0x45f4('0x24');break;case'IN':_0x41fe55=_0x45f4('0x16');break;case'CN':_0x41fe55=_0x45f4('0x25');break;default:_0x41fe55=_0x45f4('0x17');break;}var _0x105397={'method':_0x45f4('0x26'),'uri':_0x41fe55+_0x45f4('0x18'),'form':{'grant_type':_0x45f4('0x19'),'client_id':_0x3a077c[_0x45f4('0xf')],'client_secret':_0x3a077c['clientSecret'],'redirect_uri':_0x3a077c[_0x45f4('0xe')],'code':_0x3a077c[_0x45f4('0x11')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x105397)[_0x45f4('0x1b')](function(_0x9fae57){var _0x2a1dd2=JSON[_0x45f4('0x27')](_0x9fae57);if(_0x2a1dd2[_0x45f4('0x1c')]){_0x3a077c[_0x45f4('0x1d')]=_0x2a1dd2[_0x45f4('0x1c')];logger[_0x45f4('0x28')](util[_0x45f4('0x1e')](_0x45f4('0x1f'),_0x3a077c[_0x45f4('0x20')],_0x3a077c['id']));}else{logger[_0x45f4('0x21')](util[_0x45f4('0x1e')](_0x45f4('0x22'),_0x3a077c['name'],_0x3a077c['id']),util[_0x45f4('0x23')](_0x2a1dd2,{'showHidden':![],'depth':null}));}return _0x466b01(null,_0x3d609b);})['catch'](function(_0x314afa){logger[_0x45f4('0x21')](util['format'](_0x45f4('0x22'),_0x3a077c[_0x45f4('0x20')],_0x3a077c['id']),util[_0x45f4('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x466b01(_0x314afa);});}else{return _0x466b01(null,_0x3d609b);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 3e92f03..2b81c1a 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 _0xbe51=['result','catch','GetZohoAccount','options','raw','where','limit','include','map','model','attributes','ShowZohoAccount','ZohoAccount','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x28e847,_0x37d150){var _0x2ff8e2=function(_0xfef875){while(--_0xfef875){_0x28e847['push'](_0x28e847['shift']());}};_0x2ff8e2(++_0x37d150);}(_0xbe51,0x1e2));var _0x1be5=function(_0x56bd54,_0x14ccad){_0x56bd54=_0x56bd54-0x0;var _0x51de08=_0xbe51[_0x56bd54];return _0x51de08;};'use strict';var _=require(_0x1be5('0x0'));var util=require(_0x1be5('0x1'));var moment=require('moment');var BPromise=require(_0x1be5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1be5('0x3'));var db=require(_0x1be5('0x4'))['db'];var utils=require(_0x1be5('0x5'));var logger=require(_0x1be5('0x6'))(_0x1be5('0x7'));var config=require(_0x1be5('0x8'));var jayson=require(_0x1be5('0x9'));var client=jayson[_0x1be5('0xa')][_0x1be5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13fa3e,_0xf4a39f,_0x49e05a){return new BPromise(function(_0x484d9b,_0x1171b0){return client['request'](_0x13fa3e,_0x49e05a)[_0x1be5('0xc')](function(_0x36c7c2){logger['info'](_0x1be5('0xd'),_0xf4a39f,_0x1be5('0xe'));logger[_0x1be5('0xf')](_0x1be5('0x10'),_0xf4a39f,_0x1be5('0xe'),JSON[_0x1be5('0x11')](_0x36c7c2));if(_0x36c7c2[_0x1be5('0x12')]){if(_0x36c7c2['error'][_0x1be5('0x13')]===0x1f4){logger['error'](_0x1be5('0xd'),_0xf4a39f,_0x36c7c2[_0x1be5('0x12')][_0x1be5('0x14')]);return _0x1171b0(_0x36c7c2['error'][_0x1be5('0x14')]);}logger['error'](_0x1be5('0xd'),_0xf4a39f,_0x36c7c2[_0x1be5('0x12')][_0x1be5('0x14')]);return _0x484d9b(_0x36c7c2[_0x1be5('0x12')][_0x1be5('0x14')]);}else{logger[_0x1be5('0x15')](_0x1be5('0xd'),_0xf4a39f,'request\x20sent');_0x484d9b(_0x36c7c2[_0x1be5('0x16')][_0x1be5('0x14')]);}})[_0x1be5('0x17')](function(_0x3ca2b5){logger[_0x1be5('0x12')](_0x1be5('0xd'),_0xf4a39f,_0x3ca2b5);_0x1171b0(_0x3ca2b5);});});}exports[_0x1be5('0x18')]=function(_0x3a1fe3){var _0x4e777a=this;return new Promise(function(_0x3020fc,_0x33cf5d){return db['ZohoAccount']['findAll']({'raw':_0x3a1fe3['options']?_0x3a1fe3[_0x1be5('0x19')][_0x1be5('0x1a')]===undefined?!![]:![]:!![],'where':_0x3a1fe3[_0x1be5('0x19')]?_0x3a1fe3[_0x1be5('0x19')][_0x1be5('0x1b')]||null:null,'attributes':_0x3a1fe3['options']?_0x3a1fe3[_0x1be5('0x19')]['attributes']||null:null,'limit':_0x3a1fe3['options']?_0x3a1fe3[_0x1be5('0x19')][_0x1be5('0x1c')]||null:null,'include':_0x3a1fe3[_0x1be5('0x19')]?_0x3a1fe3[_0x1be5('0x19')][_0x1be5('0x1d')]?_[_0x1be5('0x1e')](_0x3a1fe3[_0x1be5('0x19')][_0x1be5('0x1d')],function(_0x4f4db0){return{'model':db[_0x4f4db0[_0x1be5('0x1f')]],'as':_0x4f4db0['as'],'attributes':_0x4f4db0[_0x1be5('0x20')],'include':_0x4f4db0[_0x1be5('0x1d')]?_[_0x1be5('0x1e')](_0x4f4db0[_0x1be5('0x1d')],function(_0x162e7c){return{'model':db[_0x162e7c[_0x1be5('0x1f')]],'as':_0x162e7c['as'],'attributes':_0x162e7c[_0x1be5('0x20')],'include':_0x162e7c['include']?_[_0x1be5('0x1e')](_0x162e7c['include'],function(_0x3b9ddb){return{'model':db[_0x3b9ddb[_0x1be5('0x1f')]],'as':_0x3b9ddb['as'],'attributes':_0x3b9ddb[_0x1be5('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1be5('0xc')](function(_0x59beb3){logger[_0x1be5('0x15')](_0x1be5('0x18'),_0x3a1fe3);logger[_0x1be5('0xf')](_0x1be5('0x18'),_0x3a1fe3,JSON[_0x1be5('0x11')](_0x59beb3));_0x3020fc(_0x59beb3);})['catch'](function(_0x39abb8){logger[_0x1be5('0x12')](_0x1be5('0x18'),_0x39abb8[_0x1be5('0x14')],_0x3a1fe3);_0x33cf5d(_0x4e777a[_0x1be5('0x12')](0x1f4,_0x39abb8['message']));});});};exports[_0x1be5('0x21')]=function(_0x303f6f){var _0x9fbfa9=this;return new Promise(function(_0x3ab053,_0x58685b){return db[_0x1be5('0x22')][_0x1be5('0x23')]({'raw':_0x303f6f['options']?_0x303f6f[_0x1be5('0x19')][_0x1be5('0x1a')]===undefined?!![]:![]:!![],'where':_0x303f6f['options']?_0x303f6f['options'][_0x1be5('0x1b')]||null:null,'attributes':_0x303f6f[_0x1be5('0x19')]?_0x303f6f[_0x1be5('0x19')][_0x1be5('0x20')]||null:null,'include':_0x303f6f['options']?_0x303f6f[_0x1be5('0x19')][_0x1be5('0x1d')]?_[_0x1be5('0x1e')](_0x303f6f[_0x1be5('0x19')][_0x1be5('0x1d')],function(_0x5b5f17){return{'model':db[_0x5b5f17[_0x1be5('0x1f')]],'as':_0x5b5f17['as'],'attributes':_0x5b5f17[_0x1be5('0x20')],'include':_0x5b5f17['include']?_[_0x1be5('0x1e')](_0x5b5f17['include'],function(_0x4d5e55){return{'model':db[_0x4d5e55[_0x1be5('0x1f')]],'as':_0x4d5e55['as'],'attributes':_0x4d5e55[_0x1be5('0x20')],'include':_0x4d5e55[_0x1be5('0x1d')]?_['map'](_0x4d5e55[_0x1be5('0x1d')],function(_0x5e030f){return{'model':db[_0x5e030f[_0x1be5('0x1f')]],'as':_0x5e030f['as'],'attributes':_0x5e030f[_0x1be5('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1be5('0xc')](function(_0x783680){logger['info'](_0x1be5('0x21'),_0x303f6f);logger[_0x1be5('0xf')](_0x1be5('0x21'),_0x303f6f,JSON[_0x1be5('0x11')](_0x783680));_0x3ab053(_0x783680);})[_0x1be5('0x17')](function(_0x10eb63){logger[_0x1be5('0x12')](_0x1be5('0x21'),_0x10eb63[_0x1be5('0x14')],_0x303f6f);_0x58685b(_0x9fbfa9['error'](0x1f4,_0x10eb63['message']));});});}; \ No newline at end of file +var _0xd5a2=['error','code','message','catch','ZohoAccount','findAll','options','where','attributes','include','map','model','GetZohoAccount','ShowZohoAccount','find','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xd5a2,0x1eb));var _0x2d5a=function(_0xd22c33,_0x467148){_0xd22c33=_0xd22c33-0x0;var _0x22b531=_0xd5a2[_0xd22c33];return _0x22b531;};'use strict';var _=require('lodash');var util=require(_0x2d5a('0x0'));var moment=require(_0x2d5a('0x1'));var BPromise=require(_0x2d5a('0x2'));var rs=require(_0x2d5a('0x3'));var fs=require('fs');var Redis=require(_0x2d5a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d5a('0x5'));var logger=require(_0x2d5a('0x6'))(_0x2d5a('0x7'));var config=require(_0x2d5a('0x8'));var jayson=require(_0x2d5a('0x9'));var client=jayson[_0x2d5a('0xa')][_0x2d5a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ae103,_0x1cdfc4,_0x7eb4c3){return new BPromise(function(_0x79898c,_0x4d5c52){return client['request'](_0x1ae103,_0x7eb4c3)[_0x2d5a('0xc')](function(_0x562b6a){logger[_0x2d5a('0xd')](_0x2d5a('0xe'),_0x1cdfc4,'request\x20sent');logger[_0x2d5a('0xf')](_0x2d5a('0x10'),_0x1cdfc4,_0x2d5a('0x11'),JSON[_0x2d5a('0x12')](_0x562b6a));if(_0x562b6a[_0x2d5a('0x13')]){if(_0x562b6a['error'][_0x2d5a('0x14')]===0x1f4){logger[_0x2d5a('0x13')](_0x2d5a('0xe'),_0x1cdfc4,_0x562b6a[_0x2d5a('0x13')]['message']);return _0x4d5c52(_0x562b6a['error'][_0x2d5a('0x15')]);}logger[_0x2d5a('0x13')](_0x2d5a('0xe'),_0x1cdfc4,_0x562b6a[_0x2d5a('0x13')]['message']);return _0x79898c(_0x562b6a[_0x2d5a('0x13')][_0x2d5a('0x15')]);}else{logger[_0x2d5a('0xd')](_0x2d5a('0xe'),_0x1cdfc4,_0x2d5a('0x11'));_0x79898c(_0x562b6a['result'][_0x2d5a('0x15')]);}})[_0x2d5a('0x16')](function(_0x38de62){logger[_0x2d5a('0x13')](_0x2d5a('0xe'),_0x1cdfc4,_0x38de62);_0x4d5c52(_0x38de62);});});}exports['GetZohoAccount']=function(_0x454c53){var _0x50f723=this;return new Promise(function(_0x34ae77,_0x29692e){return db[_0x2d5a('0x17')][_0x2d5a('0x18')]({'raw':_0x454c53['options']?_0x454c53['options']['raw']===undefined?!![]:![]:!![],'where':_0x454c53['options']?_0x454c53[_0x2d5a('0x19')][_0x2d5a('0x1a')]||null:null,'attributes':_0x454c53['options']?_0x454c53[_0x2d5a('0x19')][_0x2d5a('0x1b')]||null:null,'limit':_0x454c53[_0x2d5a('0x19')]?_0x454c53[_0x2d5a('0x19')]['limit']||null:null,'include':_0x454c53[_0x2d5a('0x19')]?_0x454c53['options'][_0x2d5a('0x1c')]?_[_0x2d5a('0x1d')](_0x454c53[_0x2d5a('0x19')][_0x2d5a('0x1c')],function(_0x5f1c75){return{'model':db[_0x5f1c75['model']],'as':_0x5f1c75['as'],'attributes':_0x5f1c75['attributes'],'include':_0x5f1c75[_0x2d5a('0x1c')]?_[_0x2d5a('0x1d')](_0x5f1c75[_0x2d5a('0x1c')],function(_0x304b9a){return{'model':db[_0x304b9a[_0x2d5a('0x1e')]],'as':_0x304b9a['as'],'attributes':_0x304b9a[_0x2d5a('0x1b')],'include':_0x304b9a['include']?_[_0x2d5a('0x1d')](_0x304b9a[_0x2d5a('0x1c')],function(_0x24f733){return{'model':db[_0x24f733[_0x2d5a('0x1e')]],'as':_0x24f733['as'],'attributes':_0x24f733[_0x2d5a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2d5a('0xc')](function(_0x4fb606){logger['info'](_0x2d5a('0x1f'),_0x454c53);logger[_0x2d5a('0xf')]('GetZohoAccount',_0x454c53,JSON[_0x2d5a('0x12')](_0x4fb606));_0x34ae77(_0x4fb606);})[_0x2d5a('0x16')](function(_0x199686){logger[_0x2d5a('0x13')](_0x2d5a('0x1f'),_0x199686[_0x2d5a('0x15')],_0x454c53);_0x29692e(_0x50f723[_0x2d5a('0x13')](0x1f4,_0x199686[_0x2d5a('0x15')]));});});};exports[_0x2d5a('0x20')]=function(_0x3e8fda){var _0xf62d6e=this;return new Promise(function(_0x3a55ff,_0x598b61){return db[_0x2d5a('0x17')][_0x2d5a('0x21')]({'raw':_0x3e8fda['options']?_0x3e8fda[_0x2d5a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3e8fda['options']?_0x3e8fda['options']['where']||null:null,'attributes':_0x3e8fda[_0x2d5a('0x19')]?_0x3e8fda['options'][_0x2d5a('0x1b')]||null:null,'include':_0x3e8fda[_0x2d5a('0x19')]?_0x3e8fda['options'][_0x2d5a('0x1c')]?_['map'](_0x3e8fda[_0x2d5a('0x19')][_0x2d5a('0x1c')],function(_0x69f4f){return{'model':db[_0x69f4f['model']],'as':_0x69f4f['as'],'attributes':_0x69f4f[_0x2d5a('0x1b')],'include':_0x69f4f[_0x2d5a('0x1c')]?_['map'](_0x69f4f[_0x2d5a('0x1c')],function(_0x4f0792){return{'model':db[_0x4f0792[_0x2d5a('0x1e')]],'as':_0x4f0792['as'],'attributes':_0x4f0792[_0x2d5a('0x1b')],'include':_0x4f0792[_0x2d5a('0x1c')]?_[_0x2d5a('0x1d')](_0x4f0792[_0x2d5a('0x1c')],function(_0x3e166f){return{'model':db[_0x3e166f[_0x2d5a('0x1e')]],'as':_0x3e166f['as'],'attributes':_0x3e166f[_0x2d5a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2d5a('0xc')](function(_0x31955b){logger[_0x2d5a('0xd')]('ShowZohoAccount',_0x3e8fda);logger[_0x2d5a('0xf')]('ShowZohoAccount',_0x3e8fda,JSON['stringify'](_0x31955b));_0x3a55ff(_0x31955b);})[_0x2d5a('0x16')](function(_0x33c16e){logger[_0x2d5a('0x13')](_0x2d5a('0x20'),_0x33c16e[_0x2d5a('0x15')],_0x3e8fda);_0x598b61(_0xf62d6e[_0x2d5a('0x13')](0x1f4,_0x33c16e['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 1b4ef4d..154365a 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 _0xafd5=['update','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put'];(function(_0xec2241,_0x453d5c){var _0x201e24=function(_0x3988a5){while(--_0x3988a5){_0xec2241['push'](_0xec2241['shift']());}};_0x201e24(++_0x453d5c);}(_0xafd5,0x116));var _0x5afd=function(_0x2dbce7,_0x57cb8d){_0x2dbce7=_0x2dbce7-0x0;var _0x3a3ed0=_0xafd5[_0x2dbce7];return _0x3a3ed0;};'use strict';var multer=require(_0x5afd('0x0'));var util=require(_0x5afd('0x1'));var path=require('path');var timeout=require(_0x5afd('0x2'));var express=require(_0x5afd('0x3'));var router=express['Router']();var fs_extra=require(_0x5afd('0x4'));var auth=require(_0x5afd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5afd('0x6'));var controller=require(_0x5afd('0x7'));router[_0x5afd('0x8')]('/',auth[_0x5afd('0x9')](),controller[_0x5afd('0xa')]);router[_0x5afd('0x8')](_0x5afd('0xb'),auth[_0x5afd('0x9')](),controller[_0x5afd('0xc')]);router[_0x5afd('0x8')](_0x5afd('0xd'),auth[_0x5afd('0x9')](),controller['getFields']);router[_0x5afd('0x8')](_0x5afd('0xe'),auth[_0x5afd('0x9')](),controller[_0x5afd('0xf')]);router['get'](_0x5afd('0x10'),auth[_0x5afd('0x9')](),controller[_0x5afd('0x11')]);router[_0x5afd('0x12')]('/',auth[_0x5afd('0x9')](),controller[_0x5afd('0x13')]);router[_0x5afd('0x14')](_0x5afd('0xb'),auth[_0x5afd('0x9')](),controller[_0x5afd('0x15')]);router['delete'](_0x5afd('0xb'),auth['isAuthenticated'](),controller[_0x5afd('0x16')]);module['exports']=router; \ No newline at end of file +var _0x29ca=['/:id/descriptions','post','create','/:id','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id/fields','/:id/subjects'];(function(_0x4e6738,_0x1e7927){var _0x5b2e4a=function(_0x3d8060){while(--_0x3d8060){_0x4e6738['push'](_0x4e6738['shift']());}};_0x5b2e4a(++_0x1e7927);}(_0x29ca,0xd7));var _0xa29c=function(_0x3764c0,_0x5e0bf5){_0x3764c0=_0x3764c0-0x0;var _0x4a0006=_0x29ca[_0x3764c0];return _0x4a0006;};'use strict';var multer=require(_0xa29c('0x0'));var util=require('util');var path=require(_0xa29c('0x1'));var timeout=require(_0xa29c('0x2'));var express=require(_0xa29c('0x3'));var router=express[_0xa29c('0x4')]();var fs_extra=require(_0xa29c('0x5'));var auth=require(_0xa29c('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa29c('0x7'));router[_0xa29c('0x8')]('/',auth[_0xa29c('0x9')](),controller[_0xa29c('0xa')]);router[_0xa29c('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa29c('0x8')](_0xa29c('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0xa29c('0x8')](_0xa29c('0xc'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xa29c('0x8')](_0xa29c('0xd'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xa29c('0xe')]('/',auth[_0xa29c('0x9')](),controller[_0xa29c('0xf')]);router['put'](_0xa29c('0x10'),auth[_0xa29c('0x9')](),controller[_0xa29c('0x11')]);router['delete']('/:id',auth[_0xa29c('0x9')](),controller[_0xa29c('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index afa878f..db1e3a7 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 _0xc80f=['STRING','ENUM','lead','contact','nothing','contact_lead','sequelize','exports'];(function(_0x4f0ba8,_0x40294e){var _0x5bc34d=function(_0x564e14){while(--_0x564e14){_0x4f0ba8['push'](_0x4f0ba8['shift']());}};_0x5bc34d(++_0x40294e);}(_0xc80f,0x7e));var _0xfc80=function(_0x443f51,_0x3e2f6d){_0x443f51=_0x443f51-0x0;var _0x2b8695=_0xc80f[_0x443f51];return _0x2b8695;};'use strict';var Sequelize=require(_0xfc80('0x0'));module[_0xfc80('0x1')]={'name':{'type':Sequelize[_0xfc80('0x2')]},'moduleCreate':{'type':Sequelize[_0xfc80('0x3')](_0xfc80('0x4'),_0xfc80('0x5'),_0xfc80('0x6')),'defaultValue':_0xfc80('0x4')},'moduleSearch':{'type':Sequelize[_0xfc80('0x3')](_0xfc80('0x7'),_0xfc80('0x5'),_0xfc80('0x4')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xfc80('0x2')]}}; \ No newline at end of file +var _0x3c94=['ENUM','lead','contact','nothing','contact_lead','sequelize','exports','STRING'];(function(_0x5ca853,_0x1ff91d){var _0x5a9171=function(_0x4686e0){while(--_0x4686e0){_0x5ca853['push'](_0x5ca853['shift']());}};_0x5a9171(++_0x1ff91d);}(_0x3c94,0xcd));var _0x43c9=function(_0x4efd3d,_0x2b9694){_0x4efd3d=_0x4efd3d-0x0;var _0x1293f2=_0x3c94[_0x4efd3d];return _0x1293f2;};'use strict';var Sequelize=require(_0x43c9('0x0'));module[_0x43c9('0x1')]={'name':{'type':Sequelize[_0x43c9('0x2')]},'moduleCreate':{'type':Sequelize[_0x43c9('0x3')](_0x43c9('0x4'),_0x43c9('0x5'),_0x43c9('0x6')),'defaultValue':_0x43c9('0x4')},'moduleSearch':{'type':Sequelize[_0x43c9('0x3')](_0x43c9('0x7'),_0x43c9('0x5'),_0x43c9('0x4')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x43c9('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 19a6239..3929c8f 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 _0x37f1=['moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','stack','map','ZohoConfiguration','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','sort','filters','pick','where','name','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','destroy','getFields','findOne','ZohoField','hasOwnProperty','getSubjects','order','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x528bb5,_0x119c5b){var _0x58e8ca=function(_0x5a8077){while(--_0x5a8077){_0x528bb5['push'](_0x528bb5['shift']());}};_0x58e8ca(++_0x119c5b);}(_0x37f1,0x140));var _0x137f=function(_0x1a60b2,_0x11f540){_0x1a60b2=_0x1a60b2-0x0;var _0x5903c4=_0x37f1[_0x1a60b2];return _0x5903c4;};'use strict';var emlformat=require(_0x137f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x137f('0x1'));var jsonpatch=require(_0x137f('0x2'));var rp=require(_0x137f('0x3'));var moment=require(_0x137f('0x4'));var BPromise=require(_0x137f('0x5'));var Mustache=require(_0x137f('0x6'));var util=require(_0x137f('0x7'));var path=require(_0x137f('0x8'));var sox=require(_0x137f('0x9'));var csv=require('to-csv');var ejs=require(_0x137f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x137f('0xb'));var squel=require(_0x137f('0xc'));var crypto=require(_0x137f('0xd'));var jsforce=require(_0x137f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x137f('0xf'));var querystring=require(_0x137f('0x10'));var Papa=require(_0x137f('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x137f('0x12'));var as=require(_0x137f('0x13'));var hardwareService=require(_0x137f('0x14'));var logger=require(_0x137f('0x15'))('api');var utils=require(_0x137f('0x16'));var config=require(_0x137f('0x17'));var licenseUtil=require(_0x137f('0x18'));var db=require(_0x137f('0x19'))['db'];function respondWithStatusCode(_0xc5b44b,_0x3c8b83){_0x3c8b83=_0x3c8b83||0xcc;return function(_0x24208f){if(_0x24208f){return _0xc5b44b[_0x137f('0x1a')](_0x3c8b83);}return _0xc5b44b[_0x137f('0x1b')](_0x3c8b83)[_0x137f('0x1c')]();};}function respondWithResult(_0x779495,_0x50c27d){_0x50c27d=_0x50c27d||0xc8;return function(_0x5d3e71){if(_0x5d3e71){return _0x779495['status'](_0x50c27d)[_0x137f('0x1d')](_0x5d3e71);}};}function respondWithFilteredResult(_0x14b701,_0x63b6ba){return function(_0x48468b){if(_0x48468b){var _0x5e9240=typeof _0x63b6ba[_0x137f('0x1e')]===_0x137f('0x1f')&&typeof _0x63b6ba[_0x137f('0x20')]===_0x137f('0x1f');var _0xac1f1f=_0x48468b[_0x137f('0x21')];var _0x1730d3=_0x5e9240?0x0:_0x63b6ba[_0x137f('0x1e')];var _0x199387=_0x5e9240?_0x48468b['count']:_0x63b6ba[_0x137f('0x1e')]+_0x63b6ba[_0x137f('0x20')];var _0x260bb7;if(_0x199387>=_0xac1f1f){_0x199387=_0xac1f1f;_0x260bb7=0xc8;}else{_0x260bb7=0xce;}_0x14b701['status'](_0x260bb7);return _0x14b701[_0x137f('0x22')](_0x137f('0x23'),_0x1730d3+'-'+_0x199387+'/'+_0xac1f1f)[_0x137f('0x1d')](_0x48468b);}return null;};}function patchUpdates(_0x424b52){return function(_0x19ac70){try{jsonpatch['apply'](_0x19ac70,_0x424b52,!![]);}catch(_0x34898f){return BPromise[_0x137f('0x24')](_0x34898f);}return _0x19ac70[_0x137f('0x25')]();};}function saveUpdates(_0x414fa5,_0x57dc36){return function(_0x31dc82){if(_0x31dc82){return _0x31dc82[_0x137f('0x26')](_0x414fa5)[_0x137f('0x27')](function(_0x20cba4){return _0x20cba4;});}return null;};}function removeEntity(_0x4bd542,_0x58fcb4){return function(_0x25c8a3){if(_0x25c8a3){return _0x25c8a3['destroy']()['then'](function(){_0x4bd542[_0x137f('0x1b')](0xcc)[_0x137f('0x1c')]();});}};}function handleEntityNotFound(_0x4cc4ca,_0x5037a4){return function(_0x1d5a28){if(!_0x1d5a28){_0x4cc4ca[_0x137f('0x1a')](0x194);}return _0x1d5a28;};}function handleError(_0x264cb8,_0x1d68f9){_0x1d68f9=_0x1d68f9||0x1f4;return function(_0x5907f3){logger['error'](_0x5907f3[_0x137f('0x28')]);if(_0x5907f3['name']){delete _0x5907f3['name'];}_0x264cb8['status'](_0x1d68f9)['send'](_0x5907f3);};}exports['index']=function(_0x1334e7,_0x2c6d1b){var _0xd679fa={},_0x5182bf={},_0x194116={'count':0x0,'rows':[]};var _0x3ccb1a=_[_0x137f('0x29')](db[_0x137f('0x2a')][_0x137f('0x2b')],function(_0x5c82e3){return{'name':_0x5c82e3[_0x137f('0x2c')],'type':_0x5c82e3[_0x137f('0x2d')][_0x137f('0x2e')]};});_0x5182bf['model']=_[_0x137f('0x29')](_0x3ccb1a,'name');_0x5182bf[_0x137f('0x2f')]=_[_0x137f('0x30')](_0x1334e7[_0x137f('0x2f')]);_0x5182bf['filters']=_[_0x137f('0x31')](_0x5182bf[_0x137f('0x32')],_0x5182bf[_0x137f('0x2f')]);_0xd679fa[_0x137f('0x33')]=_[_0x137f('0x31')](_0x5182bf[_0x137f('0x32')],qs['fields'](_0x1334e7[_0x137f('0x2f')][_0x137f('0x34')]));_0xd679fa[_0x137f('0x33')]=_0xd679fa[_0x137f('0x33')][_0x137f('0x35')]?_0xd679fa[_0x137f('0x33')]:_0x5182bf[_0x137f('0x32')];if(!_0x1334e7[_0x137f('0x2f')]['hasOwnProperty'](_0x137f('0x36'))){_0xd679fa['limit']=qs[_0x137f('0x20')](_0x1334e7['query']['limit']);_0xd679fa[_0x137f('0x1e')]=qs['offset'](_0x1334e7[_0x137f('0x2f')][_0x137f('0x1e')]);}_0xd679fa['order']=qs[_0x137f('0x37')](_0x1334e7[_0x137f('0x2f')][_0x137f('0x37')]);_0xd679fa['where']=qs[_0x137f('0x38')](_[_0x137f('0x39')](_0x1334e7[_0x137f('0x2f')],_0x5182bf[_0x137f('0x38')]),_0x3ccb1a);if(_0x1334e7[_0x137f('0x2f')]['filter']){_0xd679fa[_0x137f('0x3a')]=_['merge'](_0xd679fa[_0x137f('0x3a')],{'$or':_['map'](_0x3ccb1a,function(_0x4ab186){if(_0x4ab186[_0x137f('0x2d')]!=='VIRTUAL'){var _0x4291b9={};_0x4291b9[_0x4ab186[_0x137f('0x3b')]]={'$like':'%'+_0x1334e7[_0x137f('0x2f')][_0x137f('0x3c')]+'%'};return _0x4291b9;}})});}_0xd679fa=_[_0x137f('0x3d')]({},_0xd679fa,_0x1334e7[_0x137f('0x3e')]);var _0x24af48={'where':_0xd679fa[_0x137f('0x3a')]};return db[_0x137f('0x2a')][_0x137f('0x21')](_0x24af48)['then'](function(_0x5a8a78){_0x194116[_0x137f('0x21')]=_0x5a8a78;if(_0x1334e7[_0x137f('0x2f')][_0x137f('0x3f')]){_0xd679fa[_0x137f('0x40')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x137f('0x41')](_0xd679fa);})[_0x137f('0x27')](function(_0x4a9103){_0x194116[_0x137f('0x42')]=_0x4a9103;return _0x194116;})['then'](respondWithFilteredResult(_0x2c6d1b,_0xd679fa))[_0x137f('0x43')](handleError(_0x2c6d1b,null));};exports[_0x137f('0x44')]=function(_0x2aae38,_0x43a37a){var _0x411d3f={'raw':![],'where':{'id':_0x2aae38['params']['id']}},_0x3f618b={};_0x3f618b[_0x137f('0x32')]=_[_0x137f('0x30')](db['ZohoConfiguration'][_0x137f('0x2b')]);_0x3f618b[_0x137f('0x2f')]=_['keys'](_0x2aae38[_0x137f('0x2f')]);_0x3f618b[_0x137f('0x38')]=_[_0x137f('0x31')](_0x3f618b[_0x137f('0x32')],_0x3f618b[_0x137f('0x2f')]);_0x411d3f[_0x137f('0x33')]=_[_0x137f('0x31')](_0x3f618b[_0x137f('0x32')],qs['fields'](_0x2aae38['query'][_0x137f('0x34')]));_0x411d3f[_0x137f('0x33')]=_0x411d3f[_0x137f('0x33')]['length']?_0x411d3f['attributes']:_0x3f618b[_0x137f('0x32')];if(_0x2aae38[_0x137f('0x2f')][_0x137f('0x3f')]){_0x411d3f[_0x137f('0x40')]=[{'all':!![]}];}_0x411d3f=_['merge']({},_0x411d3f,_0x2aae38[_0x137f('0x3e')]);return db['ZohoConfiguration'][_0x137f('0x45')](_0x411d3f)[_0x137f('0x27')](handleEntityNotFound(_0x43a37a,null))[_0x137f('0x27')](respondWithResult(_0x43a37a,null))[_0x137f('0x43')](handleError(_0x43a37a,null));};exports[_0x137f('0x46')]=function(_0x39ac95,_0x473878){return db[_0x137f('0x2a')]['create'](_0x39ac95['body'],{})[_0x137f('0x27')](respondWithResult(_0x473878,0xc9))['catch'](handleError(_0x473878,null));};exports[_0x137f('0x26')]=function(_0x5a2411,_0x11b5b8){if(_0x5a2411['body']['id']){delete _0x5a2411[_0x137f('0x47')]['id'];}return db['ZohoConfiguration'][_0x137f('0x45')]({'where':{'id':_0x5a2411[_0x137f('0x48')]['id']}})[_0x137f('0x27')](handleEntityNotFound(_0x11b5b8,null))[_0x137f('0x27')](saveUpdates(_0x5a2411[_0x137f('0x47')],null))[_0x137f('0x27')](respondWithResult(_0x11b5b8,null))[_0x137f('0x43')](handleError(_0x11b5b8,null));};exports[_0x137f('0x49')]=function(_0xd499b4,_0x4c1a36){return db[_0x137f('0x2a')]['find']({'where':{'id':_0xd499b4[_0x137f('0x48')]['id']}})[_0x137f('0x27')](handleEntityNotFound(_0x4c1a36,null))[_0x137f('0x27')](removeEntity(_0x4c1a36,null))[_0x137f('0x43')](handleError(_0x4c1a36,null));};exports[_0x137f('0x4a')]=function(_0x5732fc,_0xcce850,_0x490629){var _0x1db496={};var _0x2e51b3={};var _0x16e60a;var _0x34ef9a;return db[_0x137f('0x2a')][_0x137f('0x4b')]({'where':{'id':_0x5732fc[_0x137f('0x48')]['id']}})[_0x137f('0x27')](handleEntityNotFound(_0xcce850,null))[_0x137f('0x27')](function(_0x461a3b){if(_0x461a3b){_0x16e60a=_0x461a3b;_0x2e51b3[_0x137f('0x32')]=_[_0x137f('0x30')](db[_0x137f('0x4c')][_0x137f('0x2b')]);_0x2e51b3[_0x137f('0x2f')]=_['keys'](_0x5732fc[_0x137f('0x2f')]);_0x2e51b3[_0x137f('0x38')]=_[_0x137f('0x31')](_0x2e51b3['model'],_0x2e51b3['query']);_0x1db496['attributes']=_[_0x137f('0x31')](_0x2e51b3[_0x137f('0x32')],qs[_0x137f('0x34')](_0x5732fc[_0x137f('0x2f')][_0x137f('0x34')]));_0x1db496[_0x137f('0x33')]=_0x1db496[_0x137f('0x33')][_0x137f('0x35')]?_0x1db496[_0x137f('0x33')]:_0x2e51b3[_0x137f('0x32')];_0x1db496['order']=qs[_0x137f('0x37')](_0x5732fc[_0x137f('0x2f')][_0x137f('0x37')]);_0x1db496[_0x137f('0x3a')]=qs['filters'](_[_0x137f('0x39')](_0x5732fc[_0x137f('0x2f')],_0x2e51b3[_0x137f('0x38')]));if(_0x5732fc[_0x137f('0x2f')][_0x137f('0x3c')]){_0x1db496[_0x137f('0x3a')]=_['merge'](_0x1db496[_0x137f('0x3a')],{'$or':_[_0x137f('0x29')](_0x1db496[_0x137f('0x33')],function(_0x1149d3){var _0x312459={};_0x312459[_0x1149d3]={'$like':'%'+_0x5732fc[_0x137f('0x2f')][_0x137f('0x3c')]+'%'};return _0x312459;})});}_0x1db496=_[_0x137f('0x3d')]({},_0x1db496,_0x5732fc[_0x137f('0x3e')]);return _0x16e60a['getFields'](_0x1db496);}})[_0x137f('0x27')](function(_0x4d3fc3){if(_0x4d3fc3){_0x34ef9a=_0x4d3fc3[_0x137f('0x35')];if(!_0x5732fc[_0x137f('0x2f')][_0x137f('0x4d')](_0x137f('0x36'))){_0x1db496[_0x137f('0x20')]=qs['limit'](_0x5732fc[_0x137f('0x2f')][_0x137f('0x20')]);_0x1db496[_0x137f('0x1e')]=qs[_0x137f('0x1e')](_0x5732fc[_0x137f('0x2f')][_0x137f('0x1e')]);}return _0x16e60a[_0x137f('0x4a')](_0x1db496);}})[_0x137f('0x27')](function(_0x13ffc5){if(_0x13ffc5){return _0x13ffc5?{'count':_0x34ef9a,'rows':_0x13ffc5}:null;}})[_0x137f('0x27')](respondWithResult(_0xcce850,null))[_0x137f('0x43')](handleError(_0xcce850,null));};exports[_0x137f('0x4e')]=function(_0x306a64,_0x204190,_0x2776e6){var _0x120f87={};var _0x3ce5b8={};var _0x21096e;var _0x20e631;return db[_0x137f('0x2a')]['findOne']({'where':{'id':_0x306a64[_0x137f('0x48')]['id']}})['then'](handleEntityNotFound(_0x204190,null))[_0x137f('0x27')](function(_0x21fff9){if(_0x21fff9){_0x21096e=_0x21fff9;_0x3ce5b8['model']=_[_0x137f('0x30')](db['ZohoField'][_0x137f('0x2b')]);_0x3ce5b8[_0x137f('0x2f')]=_[_0x137f('0x30')](_0x306a64[_0x137f('0x2f')]);_0x3ce5b8[_0x137f('0x38')]=_[_0x137f('0x31')](_0x3ce5b8[_0x137f('0x32')],_0x3ce5b8[_0x137f('0x2f')]);_0x120f87['attributes']=_[_0x137f('0x31')](_0x3ce5b8[_0x137f('0x32')],qs[_0x137f('0x34')](_0x306a64[_0x137f('0x2f')][_0x137f('0x34')]));_0x120f87['attributes']=_0x120f87[_0x137f('0x33')][_0x137f('0x35')]?_0x120f87[_0x137f('0x33')]:_0x3ce5b8[_0x137f('0x32')];_0x120f87[_0x137f('0x4f')]=qs[_0x137f('0x37')](_0x306a64[_0x137f('0x2f')][_0x137f('0x37')]);_0x120f87[_0x137f('0x3a')]=qs[_0x137f('0x38')](_[_0x137f('0x39')](_0x306a64['query'],_0x3ce5b8[_0x137f('0x38')]));if(_0x306a64[_0x137f('0x2f')]['filter']){_0x120f87['where']=_['merge'](_0x120f87['where'],{'$or':_[_0x137f('0x29')](_0x120f87[_0x137f('0x33')],function(_0xdd7166){var _0x3f764d={};_0x3f764d[_0xdd7166]={'$like':'%'+_0x306a64[_0x137f('0x2f')][_0x137f('0x3c')]+'%'};return _0x3f764d;})});}_0x120f87=_[_0x137f('0x3d')]({},_0x120f87,_0x306a64['options']);return _0x21096e[_0x137f('0x4e')](_0x120f87);}})['then'](function(_0x1ebbba){if(_0x1ebbba){_0x20e631=_0x1ebbba['length'];if(!_0x306a64['query'][_0x137f('0x4d')](_0x137f('0x36'))){_0x120f87[_0x137f('0x20')]=qs[_0x137f('0x20')](_0x306a64[_0x137f('0x2f')]['limit']);_0x120f87[_0x137f('0x1e')]=qs[_0x137f('0x1e')](_0x306a64[_0x137f('0x2f')][_0x137f('0x1e')]);}return _0x21096e[_0x137f('0x4e')](_0x120f87);}})['then'](function(_0x5304d3){if(_0x5304d3){return _0x5304d3?{'count':_0x20e631,'rows':_0x5304d3}:null;}})['then'](respondWithResult(_0x204190,null))['catch'](handleError(_0x204190,null));};exports['getDescriptions']=function(_0x39ddec,_0x2f055a,_0x197b4c){var _0x12e589={};var _0x3fc6a5={};var _0x276e53;var _0xf6b879;return db[_0x137f('0x2a')][_0x137f('0x4b')]({'where':{'id':_0x39ddec[_0x137f('0x48')]['id']}})[_0x137f('0x27')](handleEntityNotFound(_0x2f055a,null))['then'](function(_0x31d4b0){if(_0x31d4b0){_0x276e53=_0x31d4b0;_0x3fc6a5['model']=_[_0x137f('0x30')](db['ZohoField'][_0x137f('0x2b')]);_0x3fc6a5[_0x137f('0x2f')]=_['keys'](_0x39ddec[_0x137f('0x2f')]);_0x3fc6a5[_0x137f('0x38')]=_[_0x137f('0x31')](_0x3fc6a5['model'],_0x3fc6a5[_0x137f('0x2f')]);_0x12e589[_0x137f('0x33')]=_[_0x137f('0x31')](_0x3fc6a5[_0x137f('0x32')],qs['fields'](_0x39ddec[_0x137f('0x2f')][_0x137f('0x34')]));_0x12e589[_0x137f('0x33')]=_0x12e589[_0x137f('0x33')]['length']?_0x12e589[_0x137f('0x33')]:_0x3fc6a5[_0x137f('0x32')];_0x12e589[_0x137f('0x4f')]=qs[_0x137f('0x37')](_0x39ddec['query'][_0x137f('0x37')]);_0x12e589['where']=qs[_0x137f('0x38')](_[_0x137f('0x39')](_0x39ddec[_0x137f('0x2f')],_0x3fc6a5[_0x137f('0x38')]));if(_0x39ddec['query']['filter']){_0x12e589[_0x137f('0x3a')]=_[_0x137f('0x3d')](_0x12e589['where'],{'$or':_[_0x137f('0x29')](_0x12e589['attributes'],function(_0x2ae836){var _0x3f2ed1={};_0x3f2ed1[_0x2ae836]={'$like':'%'+_0x39ddec[_0x137f('0x2f')][_0x137f('0x3c')]+'%'};return _0x3f2ed1;})});}_0x12e589=_[_0x137f('0x3d')]({},_0x12e589,_0x39ddec[_0x137f('0x3e')]);return _0x276e53[_0x137f('0x50')](_0x12e589);}})['then'](function(_0x49ea80){if(_0x49ea80){_0xf6b879=_0x49ea80['length'];if(!_0x39ddec[_0x137f('0x2f')][_0x137f('0x4d')](_0x137f('0x36'))){_0x12e589['limit']=qs['limit'](_0x39ddec[_0x137f('0x2f')][_0x137f('0x20')]);_0x12e589[_0x137f('0x1e')]=qs[_0x137f('0x1e')](_0x39ddec[_0x137f('0x2f')][_0x137f('0x1e')]);}return _0x276e53[_0x137f('0x50')](_0x12e589);}})[_0x137f('0x27')](function(_0x7adab){if(_0x7adab){return _0x7adab?{'count':_0xf6b879,'rows':_0x7adab}:null;}})[_0x137f('0x27')](respondWithResult(_0x2f055a,null))[_0x137f('0x43')](handleError(_0x2f055a,null));}; \ No newline at end of file +var _0xfcbe=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','reject','save','then','destroy','error','stack','name','index','map','ZohoConfiguration','fieldName','type','key','query','keys','intersection','model','attributes','fields','nolimit','order','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','find','create','body','update','getFields','findOne','ZohoField','sort','hasOwnProperty','getDescriptions','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x266029,_0x5b6d90){var _0x381937=function(_0x5f203d){while(--_0x5f203d){_0x266029['push'](_0x266029['shift']());}};_0x381937(++_0x5b6d90);}(_0xfcbe,0x1d8));var _0xefcb=function(_0x307130,_0x445c23){_0x307130=_0x307130-0x0;var _0x4700ad=_0xfcbe[_0x307130];return _0x4700ad;};'use strict';var emlformat=require(_0xefcb('0x0'));var rimraf=require(_0xefcb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xefcb('0x2'));var moment=require('moment');var BPromise=require(_0xefcb('0x3'));var Mustache=require(_0xefcb('0x4'));var util=require(_0xefcb('0x5'));var path=require(_0xefcb('0x6'));var sox=require(_0xefcb('0x7'));var csv=require(_0xefcb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xefcb('0x9'));var _=require(_0xefcb('0xa'));var squel=require(_0xefcb('0xb'));var crypto=require(_0xefcb('0xc'));var jsforce=require(_0xefcb('0xd'));var deskjs=require(_0xefcb('0xe'));var toCsv=require('to-csv');var querystring=require(_0xefcb('0xf'));var Papa=require(_0xefcb('0x10'));var Redis=require(_0xefcb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xefcb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xefcb('0x13'));var logger=require(_0xefcb('0x14'))(_0xefcb('0x15'));var utils=require('../../config/utils');var config=require(_0xefcb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xefcb('0x17'))['db'];function respondWithStatusCode(_0x43a545,_0x7bde4e){_0x7bde4e=_0x7bde4e||0xcc;return function(_0x547ca3){if(_0x547ca3){return _0x43a545[_0xefcb('0x18')](_0x7bde4e);}return _0x43a545[_0xefcb('0x19')](_0x7bde4e)[_0xefcb('0x1a')]();};}function respondWithResult(_0x12b075,_0x46d44a){_0x46d44a=_0x46d44a||0xc8;return function(_0x506d18){if(_0x506d18){return _0x12b075['status'](_0x46d44a)['json'](_0x506d18);}};}function respondWithFilteredResult(_0x4f8922,_0x4fd26c){return function(_0x508efa){if(_0x508efa){var _0x168556=typeof _0x4fd26c['offset']==='undefined'&&typeof _0x4fd26c[_0xefcb('0x1b')]===_0xefcb('0x1c');var _0x3b63bc=_0x508efa[_0xefcb('0x1d')];var _0x546642=_0x168556?0x0:_0x4fd26c['offset'];var _0x13cb0f=_0x168556?_0x508efa['count']:_0x4fd26c[_0xefcb('0x1e')]+_0x4fd26c[_0xefcb('0x1b')];var _0x584f68;if(_0x13cb0f>=_0x3b63bc){_0x13cb0f=_0x3b63bc;_0x584f68=0xc8;}else{_0x584f68=0xce;}_0x4f8922[_0xefcb('0x19')](_0x584f68);return _0x4f8922[_0xefcb('0x1f')](_0xefcb('0x20'),_0x546642+'-'+_0x13cb0f+'/'+_0x3b63bc)[_0xefcb('0x21')](_0x508efa);}return null;};}function patchUpdates(_0x22a9a8){return function(_0x559d49){try{jsonpatch['apply'](_0x559d49,_0x22a9a8,!![]);}catch(_0x4e9d15){return BPromise[_0xefcb('0x22')](_0x4e9d15);}return _0x559d49[_0xefcb('0x23')]();};}function saveUpdates(_0x2783e5,_0x3d309e){return function(_0xb35b3b){if(_0xb35b3b){return _0xb35b3b['update'](_0x2783e5)[_0xefcb('0x24')](function(_0x186df3){return _0x186df3;});}return null;};}function removeEntity(_0x36aaf7,_0x127b61){return function(_0x495087){if(_0x495087){return _0x495087[_0xefcb('0x25')]()[_0xefcb('0x24')](function(){_0x36aaf7[_0xefcb('0x19')](0xcc)[_0xefcb('0x1a')]();});}};}function handleEntityNotFound(_0x2e1eec,_0xeac49f){return function(_0x1d763e){if(!_0x1d763e){_0x2e1eec[_0xefcb('0x18')](0x194);}return _0x1d763e;};}function handleError(_0x46ae5b,_0x42e679){_0x42e679=_0x42e679||0x1f4;return function(_0x32cd09){logger[_0xefcb('0x26')](_0x32cd09[_0xefcb('0x27')]);if(_0x32cd09[_0xefcb('0x28')]){delete _0x32cd09['name'];}_0x46ae5b[_0xefcb('0x19')](_0x42e679)['send'](_0x32cd09);};}exports[_0xefcb('0x29')]=function(_0x17dbc9,_0x4963f6){var _0x1655d4={},_0x321df1={},_0x2d5f62={'count':0x0,'rows':[]};var _0x5b8880=_[_0xefcb('0x2a')](db[_0xefcb('0x2b')]['rawAttributes'],function(_0x424fe1){return{'name':_0x424fe1[_0xefcb('0x2c')],'type':_0x424fe1[_0xefcb('0x2d')][_0xefcb('0x2e')]};});_0x321df1['model']=_['map'](_0x5b8880,_0xefcb('0x28'));_0x321df1[_0xefcb('0x2f')]=_[_0xefcb('0x30')](_0x17dbc9[_0xefcb('0x2f')]);_0x321df1['filters']=_[_0xefcb('0x31')](_0x321df1[_0xefcb('0x32')],_0x321df1[_0xefcb('0x2f')]);_0x1655d4[_0xefcb('0x33')]=_[_0xefcb('0x31')](_0x321df1[_0xefcb('0x32')],qs[_0xefcb('0x34')](_0x17dbc9[_0xefcb('0x2f')][_0xefcb('0x34')]));_0x1655d4[_0xefcb('0x33')]=_0x1655d4[_0xefcb('0x33')]['length']?_0x1655d4[_0xefcb('0x33')]:_0x321df1['model'];if(!_0x17dbc9[_0xefcb('0x2f')]['hasOwnProperty'](_0xefcb('0x35'))){_0x1655d4[_0xefcb('0x1b')]=qs['limit'](_0x17dbc9['query'][_0xefcb('0x1b')]);_0x1655d4[_0xefcb('0x1e')]=qs[_0xefcb('0x1e')](_0x17dbc9['query'][_0xefcb('0x1e')]);}_0x1655d4[_0xefcb('0x36')]=qs['sort'](_0x17dbc9[_0xefcb('0x2f')]['sort']);_0x1655d4['where']=qs['filters'](_[_0xefcb('0x37')](_0x17dbc9[_0xefcb('0x2f')],_0x321df1[_0xefcb('0x38')]),_0x5b8880);if(_0x17dbc9[_0xefcb('0x2f')][_0xefcb('0x39')]){_0x1655d4[_0xefcb('0x3a')]=_[_0xefcb('0x3b')](_0x1655d4[_0xefcb('0x3a')],{'$or':_[_0xefcb('0x2a')](_0x5b8880,function(_0x56216d){if(_0x56216d[_0xefcb('0x2d')]!==_0xefcb('0x3c')){var _0x173105={};_0x173105[_0x56216d[_0xefcb('0x28')]]={'$like':'%'+_0x17dbc9[_0xefcb('0x2f')]['filter']+'%'};return _0x173105;}})});}_0x1655d4=_[_0xefcb('0x3b')]({},_0x1655d4,_0x17dbc9[_0xefcb('0x3d')]);var _0x1e6a0a={'where':_0x1655d4[_0xefcb('0x3a')]};return db[_0xefcb('0x2b')][_0xefcb('0x1d')](_0x1e6a0a)[_0xefcb('0x24')](function(_0x39355c){_0x2d5f62[_0xefcb('0x1d')]=_0x39355c;if(_0x17dbc9[_0xefcb('0x2f')][_0xefcb('0x3e')]){_0x1655d4['include']=[{'all':!![]}];}return db[_0xefcb('0x2b')][_0xefcb('0x3f')](_0x1655d4);})[_0xefcb('0x24')](function(_0x173f30){_0x2d5f62[_0xefcb('0x40')]=_0x173f30;return _0x2d5f62;})[_0xefcb('0x24')](respondWithFilteredResult(_0x4963f6,_0x1655d4))[_0xefcb('0x41')](handleError(_0x4963f6,null));};exports[_0xefcb('0x42')]=function(_0x220ad2,_0x346396){var _0x544f49={'raw':![],'where':{'id':_0x220ad2[_0xefcb('0x43')]['id']}},_0x443ef2={};_0x443ef2[_0xefcb('0x32')]=_['keys'](db[_0xefcb('0x2b')][_0xefcb('0x44')]);_0x443ef2[_0xefcb('0x2f')]=_[_0xefcb('0x30')](_0x220ad2[_0xefcb('0x2f')]);_0x443ef2[_0xefcb('0x38')]=_[_0xefcb('0x31')](_0x443ef2[_0xefcb('0x32')],_0x443ef2['query']);_0x544f49[_0xefcb('0x33')]=_['intersection'](_0x443ef2[_0xefcb('0x32')],qs[_0xefcb('0x34')](_0x220ad2[_0xefcb('0x2f')][_0xefcb('0x34')]));_0x544f49['attributes']=_0x544f49[_0xefcb('0x33')][_0xefcb('0x45')]?_0x544f49[_0xefcb('0x33')]:_0x443ef2[_0xefcb('0x32')];if(_0x220ad2['query'][_0xefcb('0x3e')]){_0x544f49[_0xefcb('0x46')]=[{'all':!![]}];}_0x544f49=_[_0xefcb('0x3b')]({},_0x544f49,_0x220ad2['options']);return db[_0xefcb('0x2b')][_0xefcb('0x47')](_0x544f49)[_0xefcb('0x24')](handleEntityNotFound(_0x346396,null))[_0xefcb('0x24')](respondWithResult(_0x346396,null))[_0xefcb('0x41')](handleError(_0x346396,null));};exports['create']=function(_0x164b01,_0x53a630){return db['ZohoConfiguration'][_0xefcb('0x48')](_0x164b01[_0xefcb('0x49')],{})['then'](respondWithResult(_0x53a630,0xc9))[_0xefcb('0x41')](handleError(_0x53a630,null));};exports[_0xefcb('0x4a')]=function(_0x58929e,_0x3bb3fe){if(_0x58929e[_0xefcb('0x49')]['id']){delete _0x58929e[_0xefcb('0x49')]['id'];}return db[_0xefcb('0x2b')]['find']({'where':{'id':_0x58929e['params']['id']}})[_0xefcb('0x24')](handleEntityNotFound(_0x3bb3fe,null))[_0xefcb('0x24')](saveUpdates(_0x58929e[_0xefcb('0x49')],null))[_0xefcb('0x24')](respondWithResult(_0x3bb3fe,null))['catch'](handleError(_0x3bb3fe,null));};exports[_0xefcb('0x25')]=function(_0x5e36e7,_0x4fd118){return db['ZohoConfiguration'][_0xefcb('0x47')]({'where':{'id':_0x5e36e7[_0xefcb('0x43')]['id']}})[_0xefcb('0x24')](handleEntityNotFound(_0x4fd118,null))['then'](removeEntity(_0x4fd118,null))[_0xefcb('0x41')](handleError(_0x4fd118,null));};exports[_0xefcb('0x4b')]=function(_0xcd85d1,_0x1e6c6b,_0x1aab08){var _0x324d08={};var _0x403da3={};var _0x47cd7f;var _0x571ff1;return db[_0xefcb('0x2b')][_0xefcb('0x4c')]({'where':{'id':_0xcd85d1[_0xefcb('0x43')]['id']}})['then'](handleEntityNotFound(_0x1e6c6b,null))['then'](function(_0x1c719c){if(_0x1c719c){_0x47cd7f=_0x1c719c;_0x403da3[_0xefcb('0x32')]=_[_0xefcb('0x30')](db[_0xefcb('0x4d')][_0xefcb('0x44')]);_0x403da3[_0xefcb('0x2f')]=_[_0xefcb('0x30')](_0xcd85d1[_0xefcb('0x2f')]);_0x403da3[_0xefcb('0x38')]=_[_0xefcb('0x31')](_0x403da3['model'],_0x403da3[_0xefcb('0x2f')]);_0x324d08[_0xefcb('0x33')]=_['intersection'](_0x403da3[_0xefcb('0x32')],qs[_0xefcb('0x34')](_0xcd85d1[_0xefcb('0x2f')]['fields']));_0x324d08[_0xefcb('0x33')]=_0x324d08['attributes'][_0xefcb('0x45')]?_0x324d08[_0xefcb('0x33')]:_0x403da3[_0xefcb('0x32')];_0x324d08[_0xefcb('0x36')]=qs[_0xefcb('0x4e')](_0xcd85d1[_0xefcb('0x2f')][_0xefcb('0x4e')]);_0x324d08[_0xefcb('0x3a')]=qs[_0xefcb('0x38')](_[_0xefcb('0x37')](_0xcd85d1[_0xefcb('0x2f')],_0x403da3[_0xefcb('0x38')]));if(_0xcd85d1[_0xefcb('0x2f')][_0xefcb('0x39')]){_0x324d08[_0xefcb('0x3a')]=_[_0xefcb('0x3b')](_0x324d08[_0xefcb('0x3a')],{'$or':_[_0xefcb('0x2a')](_0x324d08[_0xefcb('0x33')],function(_0x4ff802){var _0x363cf0={};_0x363cf0[_0x4ff802]={'$like':'%'+_0xcd85d1[_0xefcb('0x2f')][_0xefcb('0x39')]+'%'};return _0x363cf0;})});}_0x324d08=_[_0xefcb('0x3b')]({},_0x324d08,_0xcd85d1[_0xefcb('0x3d')]);return _0x47cd7f['getFields'](_0x324d08);}})[_0xefcb('0x24')](function(_0x1b23e3){if(_0x1b23e3){_0x571ff1=_0x1b23e3[_0xefcb('0x45')];if(!_0xcd85d1[_0xefcb('0x2f')][_0xefcb('0x4f')](_0xefcb('0x35'))){_0x324d08[_0xefcb('0x1b')]=qs[_0xefcb('0x1b')](_0xcd85d1['query'][_0xefcb('0x1b')]);_0x324d08[_0xefcb('0x1e')]=qs[_0xefcb('0x1e')](_0xcd85d1['query']['offset']);}return _0x47cd7f[_0xefcb('0x4b')](_0x324d08);}})[_0xefcb('0x24')](function(_0x46a519){if(_0x46a519){return _0x46a519?{'count':_0x571ff1,'rows':_0x46a519}:null;}})['then'](respondWithResult(_0x1e6c6b,null))[_0xefcb('0x41')](handleError(_0x1e6c6b,null));};exports['getSubjects']=function(_0x3cb731,_0x18718c,_0x3c3661){var _0x217a39={};var _0x42aa5b={};var _0x172810;var _0x362a15;return db['ZohoConfiguration'][_0xefcb('0x4c')]({'where':{'id':_0x3cb731[_0xefcb('0x43')]['id']}})['then'](handleEntityNotFound(_0x18718c,null))[_0xefcb('0x24')](function(_0x5686ac){if(_0x5686ac){_0x172810=_0x5686ac;_0x42aa5b[_0xefcb('0x32')]=_[_0xefcb('0x30')](db[_0xefcb('0x4d')]['rawAttributes']);_0x42aa5b['query']=_[_0xefcb('0x30')](_0x3cb731[_0xefcb('0x2f')]);_0x42aa5b[_0xefcb('0x38')]=_['intersection'](_0x42aa5b[_0xefcb('0x32')],_0x42aa5b[_0xefcb('0x2f')]);_0x217a39[_0xefcb('0x33')]=_['intersection'](_0x42aa5b[_0xefcb('0x32')],qs[_0xefcb('0x34')](_0x3cb731[_0xefcb('0x2f')][_0xefcb('0x34')]));_0x217a39[_0xefcb('0x33')]=_0x217a39['attributes']['length']?_0x217a39[_0xefcb('0x33')]:_0x42aa5b[_0xefcb('0x32')];_0x217a39['order']=qs[_0xefcb('0x4e')](_0x3cb731[_0xefcb('0x2f')][_0xefcb('0x4e')]);_0x217a39[_0xefcb('0x3a')]=qs['filters'](_['pick'](_0x3cb731['query'],_0x42aa5b[_0xefcb('0x38')]));if(_0x3cb731[_0xefcb('0x2f')][_0xefcb('0x39')]){_0x217a39[_0xefcb('0x3a')]=_[_0xefcb('0x3b')](_0x217a39['where'],{'$or':_[_0xefcb('0x2a')](_0x217a39[_0xefcb('0x33')],function(_0x4a41ee){var _0x4ec52b={};_0x4ec52b[_0x4a41ee]={'$like':'%'+_0x3cb731[_0xefcb('0x2f')]['filter']+'%'};return _0x4ec52b;})});}_0x217a39=_[_0xefcb('0x3b')]({},_0x217a39,_0x3cb731[_0xefcb('0x3d')]);return _0x172810['getSubjects'](_0x217a39);}})[_0xefcb('0x24')](function(_0x236101){if(_0x236101){_0x362a15=_0x236101['length'];if(!_0x3cb731[_0xefcb('0x2f')][_0xefcb('0x4f')](_0xefcb('0x35'))){_0x217a39[_0xefcb('0x1b')]=qs[_0xefcb('0x1b')](_0x3cb731[_0xefcb('0x2f')][_0xefcb('0x1b')]);_0x217a39[_0xefcb('0x1e')]=qs[_0xefcb('0x1e')](_0x3cb731[_0xefcb('0x2f')][_0xefcb('0x1e')]);}return _0x172810['getSubjects'](_0x217a39);}})['then'](function(_0x710643){if(_0x710643){return _0x710643?{'count':_0x362a15,'rows':_0x710643}:null;}})[_0xefcb('0x24')](respondWithResult(_0x18718c,null))['catch'](handleError(_0x18718c,null));};exports[_0xefcb('0x50')]=function(_0x123b9f,_0x253618,_0x51c359){var _0x4c4c6c={};var _0x1c131c={};var _0x26d9c7;var _0x54593a;return db['ZohoConfiguration'][_0xefcb('0x4c')]({'where':{'id':_0x123b9f['params']['id']}})[_0xefcb('0x24')](handleEntityNotFound(_0x253618,null))[_0xefcb('0x24')](function(_0x3fb19c){if(_0x3fb19c){_0x26d9c7=_0x3fb19c;_0x1c131c['model']=_[_0xefcb('0x30')](db[_0xefcb('0x4d')][_0xefcb('0x44')]);_0x1c131c[_0xefcb('0x2f')]=_[_0xefcb('0x30')](_0x123b9f['query']);_0x1c131c[_0xefcb('0x38')]=_[_0xefcb('0x31')](_0x1c131c[_0xefcb('0x32')],_0x1c131c[_0xefcb('0x2f')]);_0x4c4c6c[_0xefcb('0x33')]=_['intersection'](_0x1c131c[_0xefcb('0x32')],qs[_0xefcb('0x34')](_0x123b9f[_0xefcb('0x2f')][_0xefcb('0x34')]));_0x4c4c6c['attributes']=_0x4c4c6c['attributes'][_0xefcb('0x45')]?_0x4c4c6c[_0xefcb('0x33')]:_0x1c131c['model'];_0x4c4c6c[_0xefcb('0x36')]=qs[_0xefcb('0x4e')](_0x123b9f[_0xefcb('0x2f')][_0xefcb('0x4e')]);_0x4c4c6c['where']=qs['filters'](_[_0xefcb('0x37')](_0x123b9f[_0xefcb('0x2f')],_0x1c131c[_0xefcb('0x38')]));if(_0x123b9f['query'][_0xefcb('0x39')]){_0x4c4c6c[_0xefcb('0x3a')]=_[_0xefcb('0x3b')](_0x4c4c6c['where'],{'$or':_['map'](_0x4c4c6c[_0xefcb('0x33')],function(_0x453edc){var _0x422226={};_0x422226[_0x453edc]={'$like':'%'+_0x123b9f[_0xefcb('0x2f')][_0xefcb('0x39')]+'%'};return _0x422226;})});}_0x4c4c6c=_[_0xefcb('0x3b')]({},_0x4c4c6c,_0x123b9f['options']);return _0x26d9c7[_0xefcb('0x50')](_0x4c4c6c);}})[_0xefcb('0x24')](function(_0x5eb0dc){if(_0x5eb0dc){_0x54593a=_0x5eb0dc['length'];if(!_0x123b9f[_0xefcb('0x2f')][_0xefcb('0x4f')](_0xefcb('0x35'))){_0x4c4c6c['limit']=qs[_0xefcb('0x1b')](_0x123b9f['query']['limit']);_0x4c4c6c[_0xefcb('0x1e')]=qs[_0xefcb('0x1e')](_0x123b9f[_0xefcb('0x2f')][_0xefcb('0x1e')]);}return _0x26d9c7['getDescriptions'](_0x4c4c6c);}})['then'](function(_0x1e5349){if(_0x1e5349){return _0x1e5349?{'count':_0x54593a,'rows':_0x1e5349}:null;}})['then'](respondWithResult(_0x253618,null))[_0xefcb('0x41')](handleError(_0x253618,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 960d581..22fbd73 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 _0x46fc=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','define','ZohoConfiguration','int_zoho_configurations'];(function(_0x52ab62,_0x203d25){var _0x42f499=function(_0x56adfd){while(--_0x56adfd){_0x52ab62['push'](_0x52ab62['shift']());}};_0x42f499(++_0x203d25);}(_0x46fc,0x113));var _0xc46f=function(_0x23e5d6,_0x581445){_0x23e5d6=_0x23e5d6-0x0;var _0x51d225=_0x46fc[_0x23e5d6];return _0x51d225;};'use strict';var _=require(_0xc46f('0x0'));var util=require(_0xc46f('0x1'));var logger=require(_0xc46f('0x2'))(_0xc46f('0x3'));var moment=require('moment');var BPromise=require(_0xc46f('0x4'));var rp=require(_0xc46f('0x5'));var fs=require('fs');var path=require(_0xc46f('0x6'));var rimraf=require(_0xc46f('0x7'));var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module['exports']=function(_0x5c6c1f,_0x355f99){return _0x5c6c1f[_0xc46f('0x8')](_0xc46f('0x9'),attributes,{'tableName':_0xc46f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff8c=['path','./intZohoConfiguration.attributes','define','ZohoConfiguration','int_zoho_configurations','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x5f417e,_0x56601a){var _0xb924e8=function(_0x55ab28){while(--_0x55ab28){_0x5f417e['push'](_0x5f417e['shift']());}};_0xb924e8(++_0x56601a);}(_0xff8c,0x91));var _0xcff8=function(_0x45aac6,_0x13dafe){_0x45aac6=_0x45aac6-0x0;var _0x535760=_0xff8c[_0x45aac6];return _0x535760;};'use strict';var _=require(_0xcff8('0x0'));var util=require('util');var logger=require(_0xcff8('0x1'))(_0xcff8('0x2'));var moment=require('moment');var BPromise=require(_0xcff8('0x3'));var rp=require(_0xcff8('0x4'));var fs=require('fs');var path=require(_0xcff8('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcff8('0x6'));module['exports']=function(_0x3a06d9,_0x2f240b){return _0x3a06d9[_0xcff8('0x7')](_0xcff8('0x8'),attributes,{'tableName':_0xcff8('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 55bb430..4b48dcc 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 _0xe17a=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','stringify','error','ZohoConfiguration,\x20%s,\x20%s','message','result','lodash'];(function(_0x121d9e,_0x11b966){var _0x5df466=function(_0x519340){while(--_0x519340){_0x121d9e['push'](_0x121d9e['shift']());}};_0x5df466(++_0x11b966);}(_0xe17a,0x1b4));var _0xae17=function(_0x31a566,_0x1a3028){_0x31a566=_0x31a566-0x0;var _0x2fe294=_0xe17a[_0x31a566];return _0x2fe294;};'use strict';var _=require(_0xae17('0x0'));var util=require(_0xae17('0x1'));var moment=require(_0xae17('0x2'));var BPromise=require(_0xae17('0x3'));var rs=require(_0xae17('0x4'));var fs=require('fs');var Redis=require(_0xae17('0x5'));var db=require(_0xae17('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xae17('0x7'));var config=require(_0xae17('0x8'));var jayson=require(_0xae17('0x9'));var client=jayson['client'][_0xae17('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b779f,_0x34089b,_0x14710e){return new BPromise(function(_0x3949a9,_0x21f5e4){return client[_0xae17('0xb')](_0x2b779f,_0x14710e)['then'](function(_0x4b6094){logger[_0xae17('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x34089b,_0xae17('0xd'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x34089b,_0xae17('0xd'),JSON[_0xae17('0xe')](_0x4b6094));if(_0x4b6094[_0xae17('0xf')]){if(_0x4b6094['error']['code']===0x1f4){logger[_0xae17('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x34089b,_0x4b6094[_0xae17('0xf')]['message']);return _0x21f5e4(_0x4b6094[_0xae17('0xf')]['message']);}logger[_0xae17('0xf')](_0xae17('0x10'),_0x34089b,_0x4b6094[_0xae17('0xf')][_0xae17('0x11')]);return _0x3949a9(_0x4b6094['error'][_0xae17('0x11')]);}else{logger[_0xae17('0xc')](_0xae17('0x10'),_0x34089b,_0xae17('0xd'));_0x3949a9(_0x4b6094[_0xae17('0x12')][_0xae17('0x11')]);}})['catch'](function(_0x5c9403){logger[_0xae17('0xf')](_0xae17('0x10'),_0x34089b,_0x5c9403);_0x21f5e4(_0x5c9403);});});} \ No newline at end of file +var _0x40f0=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','then','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash'];(function(_0x54879d,_0x37904b){var _0x351d6f=function(_0x532211){while(--_0x532211){_0x54879d['push'](_0x54879d['shift']());}};_0x351d6f(++_0x37904b);}(_0x40f0,0x1df));var _0x040f=function(_0x11e383,_0x55912d){_0x11e383=_0x11e383-0x0;var _0x3e92bf=_0x40f0[_0x11e383];return _0x3e92bf;};'use strict';var _=require(_0x040f('0x0'));var util=require(_0x040f('0x1'));var moment=require(_0x040f('0x2'));var BPromise=require(_0x040f('0x3'));var rs=require(_0x040f('0x4'));var fs=require('fs');var Redis=require(_0x040f('0x5'));var db=require(_0x040f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x040f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x040f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48226c,_0x37ad40,_0x1338b8){return new BPromise(function(_0x23ef92,_0x2ef15a){return client['request'](_0x48226c,_0x1338b8)[_0x040f('0x9')](function(_0x554fc1){logger['info'](_0x040f('0xa'),_0x37ad40,'request\x20sent');logger[_0x040f('0xb')](_0x040f('0xc'),_0x37ad40,_0x040f('0xd'),JSON['stringify'](_0x554fc1));if(_0x554fc1[_0x040f('0xe')]){if(_0x554fc1['error'][_0x040f('0xf')]===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x37ad40,_0x554fc1['error'][_0x040f('0x10')]);return _0x2ef15a(_0x554fc1[_0x040f('0xe')][_0x040f('0x10')]);}logger[_0x040f('0xe')](_0x040f('0xa'),_0x37ad40,_0x554fc1[_0x040f('0xe')][_0x040f('0x10')]);return _0x23ef92(_0x554fc1[_0x040f('0xe')]['message']);}else{logger[_0x040f('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x37ad40,_0x040f('0xd'));_0x23ef92(_0x554fc1[_0x040f('0x12')][_0x040f('0x10')]);}})[_0x040f('0x13')](function(_0x402e60){logger['error'](_0x040f('0xa'),_0x37ad40,_0x402e60);_0x2ef15a(_0x402e60);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index b3fa334..178c580 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 _0x1ef5=['./intZohoField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x1ef5,0x1e6));var _0x51ef=function(_0x2bf8ad,_0x10ba3e){_0x2bf8ad=_0x2bf8ad-0x0;var _0x3aac96=_0x1ef5[_0x2bf8ad];return _0x3aac96;};'use strict';var multer=require('multer');var util=require(_0x51ef('0x0'));var path=require(_0x51ef('0x1'));var timeout=require(_0x51ef('0x2'));var express=require(_0x51ef('0x3'));var router=express[_0x51ef('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x51ef('0x5'));var interaction=require(_0x51ef('0x6'));var config=require(_0x51ef('0x7'));var controller=require(_0x51ef('0x8'));router[_0x51ef('0x9')]('/',auth[_0x51ef('0xa')](),controller['index']);router[_0x51ef('0x9')](_0x51ef('0xb'),auth[_0x51ef('0xa')](),controller[_0x51ef('0xc')]);router[_0x51ef('0xd')]('/',auth[_0x51ef('0xa')](),controller[_0x51ef('0xe')]);router[_0x51ef('0xf')](_0x51ef('0xb'),auth[_0x51ef('0xa')](),controller[_0x51ef('0x10')]);router[_0x51ef('0x11')](_0x51ef('0xb'),auth[_0x51ef('0xa')](),controller['destroy']);module[_0x51ef('0x12')]=router; \ No newline at end of file +var _0x3e86=['Router','fs-extra','../../components/auth/service','./intZohoField.controller','get','isAuthenticated','index','/:id','post','create','put','update','multer','util','path','connect-timeout','express'];(function(_0x4c3338,_0x35fa13){var _0xf7384a=function(_0x24a2f5){while(--_0x24a2f5){_0x4c3338['push'](_0x4c3338['shift']());}};_0xf7384a(++_0x35fa13);}(_0x3e86,0x12d));var _0x63e8=function(_0xb4c0c4,_0x4f6d44){_0xb4c0c4=_0xb4c0c4-0x0;var _0x2fb140=_0x3e86[_0xb4c0c4];return _0x2fb140;};'use strict';var multer=require(_0x63e8('0x0'));var util=require(_0x63e8('0x1'));var path=require(_0x63e8('0x2'));var timeout=require(_0x63e8('0x3'));var express=require(_0x63e8('0x4'));var router=express[_0x63e8('0x5')]();var fs_extra=require(_0x63e8('0x6'));var auth=require(_0x63e8('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x63e8('0x8'));router[_0x63e8('0x9')]('/',auth[_0x63e8('0xa')](),controller[_0x63e8('0xb')]);router[_0x63e8('0x9')](_0x63e8('0xc'),auth[_0x63e8('0xa')](),controller['show']);router[_0x63e8('0xd')]('/',auth['isAuthenticated'](),controller[_0x63e8('0xe')]);router[_0x63e8('0xf')](_0x63e8('0xc'),auth[_0x63e8('0xa')](),controller[_0x63e8('0x10')]);router['delete'](_0x63e8('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 8bdf28f..fb3da00 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 _0x81cb=['STRING','variable','sequelize','exports','ENUM','string','customVariable','keyValue','picklist'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x81cb,0xad));var _0xb81c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x81cb[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xb81c('0x0'));module[_0xb81c('0x1')]={'type':{'type':Sequelize[_0xb81c('0x2')](_0xb81c('0x3'),'variable',_0xb81c('0x4'),_0xb81c('0x5'),_0xb81c('0x6')),'defaultValue':_0xb81c('0x3')},'content':{'type':Sequelize[_0xb81c('0x7')]},'key':{'type':Sequelize[_0xb81c('0x7')]},'keyType':{'type':Sequelize[_0xb81c('0x2')](_0xb81c('0x3'),_0xb81c('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0xb81c('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xb81c('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb81c('0x7')]}}; \ No newline at end of file +var _0x667c=['sequelize','exports','string','variable','customVariable','STRING','BOOLEAN'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x667c,0x1dc));var _0xc667=function(_0x411541,_0x3fc8ba){_0x411541=_0x411541-0x0;var _0x2a4d92=_0x667c[_0x411541];return _0x2a4d92;};'use strict';var Sequelize=require(_0xc667('0x0'));module[_0xc667('0x1')]={'type':{'type':Sequelize['ENUM'](_0xc667('0x2'),_0xc667('0x3'),_0xc667('0x4'),'keyValue','picklist'),'defaultValue':_0xc667('0x2')},'content':{'type':Sequelize[_0xc667('0x5')]},'key':{'type':Sequelize[_0xc667('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0xc667('0x3'),_0xc667('0x4'))},'keyContent':{'type':Sequelize[_0xc667('0x5')]},'idField':{'type':Sequelize[_0xc667('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc667('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc667('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 3e5495d..bb3026e 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 _0xc762=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','stack','name','send','map','ZohoField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','rows','show','keys','length','options','find','catch','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x26a0e5,_0x23f0e8){var _0x585403=function(_0x490d10){while(--_0x490d10){_0x26a0e5['push'](_0x26a0e5['shift']());}};_0x585403(++_0x23f0e8);}(_0xc762,0x92));var _0x2c76=function(_0x51308d,_0x42cf02){_0x51308d=_0x51308d-0x0;var _0x37cde8=_0xc762[_0x51308d];return _0x37cde8;};'use strict';var emlformat=require(_0x2c76('0x0'));var rimraf=require(_0x2c76('0x1'));var zipdir=require(_0x2c76('0x2'));var jsonpatch=require(_0x2c76('0x3'));var rp=require(_0x2c76('0x4'));var moment=require(_0x2c76('0x5'));var BPromise=require(_0x2c76('0x6'));var Mustache=require(_0x2c76('0x7'));var util=require(_0x2c76('0x8'));var path=require(_0x2c76('0x9'));var sox=require(_0x2c76('0xa'));var csv=require(_0x2c76('0xb'));var ejs=require(_0x2c76('0xc'));var fs=require('fs');var fs_extra=require(_0x2c76('0xd'));var _=require(_0x2c76('0xe'));var squel=require(_0x2c76('0xf'));var crypto=require('crypto');var jsforce=require(_0x2c76('0x10'));var deskjs=require(_0x2c76('0x11'));var toCsv=require(_0x2c76('0xb'));var querystring=require('querystring');var Papa=require(_0x2c76('0x12'));var Redis=require(_0x2c76('0x13'));var authService=require(_0x2c76('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2c76('0x15'));var logger=require('../../config/logger')(_0x2c76('0x16'));var utils=require(_0x2c76('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2c76('0x18'))['db'];function respondWithStatusCode(_0x4e49e8,_0x23428d){_0x23428d=_0x23428d||0xcc;return function(_0x5b97b1){if(_0x5b97b1){return _0x4e49e8[_0x2c76('0x19')](_0x23428d);}return _0x4e49e8['status'](_0x23428d)[_0x2c76('0x1a')]();};}function respondWithResult(_0x3664aa,_0x7e730d){_0x7e730d=_0x7e730d||0xc8;return function(_0x1093d4){if(_0x1093d4){return _0x3664aa[_0x2c76('0x1b')](_0x7e730d)[_0x2c76('0x1c')](_0x1093d4);}};}function respondWithFilteredResult(_0x54ec6b,_0x57c8f4){return function(_0x10c65b){if(_0x10c65b){var _0x10078e=typeof _0x57c8f4['offset']===_0x2c76('0x1d')&&typeof _0x57c8f4[_0x2c76('0x1e')]===_0x2c76('0x1d');var _0x37162f=_0x10c65b[_0x2c76('0x1f')];var _0x57461c=_0x10078e?0x0:_0x57c8f4[_0x2c76('0x20')];var _0x176b45=_0x10078e?_0x10c65b['count']:_0x57c8f4['offset']+_0x57c8f4[_0x2c76('0x1e')];var _0x20bf15;if(_0x176b45>=_0x37162f){_0x176b45=_0x37162f;_0x20bf15=0xc8;}else{_0x20bf15=0xce;}_0x54ec6b[_0x2c76('0x1b')](_0x20bf15);return _0x54ec6b[_0x2c76('0x21')](_0x2c76('0x22'),_0x57461c+'-'+_0x176b45+'/'+_0x37162f)[_0x2c76('0x1c')](_0x10c65b);}return null;};}function patchUpdates(_0x45c5f5){return function(_0x1638d3){try{jsonpatch[_0x2c76('0x23')](_0x1638d3,_0x45c5f5,!![]);}catch(_0x26f6ae){return BPromise[_0x2c76('0x24')](_0x26f6ae);}return _0x1638d3[_0x2c76('0x25')]();};}function saveUpdates(_0x46b324,_0x5f24bc){return function(_0x2d2a71){if(_0x2d2a71){return _0x2d2a71['update'](_0x46b324)['then'](function(_0x497cc6){return _0x497cc6;});}return null;};}function removeEntity(_0xed1e6c,_0x22abba){return function(_0x5c794f){if(_0x5c794f){return _0x5c794f[_0x2c76('0x26')]()[_0x2c76('0x27')](function(){_0xed1e6c[_0x2c76('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21f73b,_0x701b34){return function(_0x23b9ee){if(!_0x23b9ee){_0x21f73b[_0x2c76('0x19')](0x194);}return _0x23b9ee;};}function handleError(_0x446bf9,_0x3ef034){_0x3ef034=_0x3ef034||0x1f4;return function(_0x3cd841){logger['error'](_0x3cd841[_0x2c76('0x28')]);if(_0x3cd841[_0x2c76('0x29')]){delete _0x3cd841[_0x2c76('0x29')];}_0x446bf9[_0x2c76('0x1b')](_0x3ef034)[_0x2c76('0x2a')](_0x3cd841);};}exports['index']=function(_0x38f967,_0x92dee0){var _0x28402f={},_0x48a03={},_0x2e6999={'count':0x0,'rows':[]};var _0x5a1c91=_[_0x2c76('0x2b')](db[_0x2c76('0x2c')][_0x2c76('0x2d')],function(_0x480c62){return{'name':_0x480c62[_0x2c76('0x2e')],'type':_0x480c62[_0x2c76('0x2f')][_0x2c76('0x30')]};});_0x48a03[_0x2c76('0x31')]=_[_0x2c76('0x2b')](_0x5a1c91,_0x2c76('0x29'));_0x48a03['query']=_['keys'](_0x38f967[_0x2c76('0x32')]);_0x48a03[_0x2c76('0x33')]=_[_0x2c76('0x34')](_0x48a03[_0x2c76('0x31')],_0x48a03[_0x2c76('0x32')]);_0x28402f[_0x2c76('0x35')]=_['intersection'](_0x48a03[_0x2c76('0x31')],qs[_0x2c76('0x36')](_0x38f967[_0x2c76('0x32')][_0x2c76('0x36')]));_0x28402f['attributes']=_0x28402f['attributes']['length']?_0x28402f[_0x2c76('0x35')]:_0x48a03['model'];if(!_0x38f967[_0x2c76('0x32')][_0x2c76('0x37')](_0x2c76('0x38'))){_0x28402f[_0x2c76('0x1e')]=qs[_0x2c76('0x1e')](_0x38f967[_0x2c76('0x32')]['limit']);_0x28402f[_0x2c76('0x20')]=qs[_0x2c76('0x20')](_0x38f967[_0x2c76('0x32')][_0x2c76('0x20')]);}_0x28402f[_0x2c76('0x39')]=qs[_0x2c76('0x3a')](_0x38f967[_0x2c76('0x32')][_0x2c76('0x3a')]);_0x28402f['where']=qs[_0x2c76('0x33')](_[_0x2c76('0x3b')](_0x38f967['query'],_0x48a03[_0x2c76('0x33')]),_0x5a1c91);if(_0x38f967[_0x2c76('0x32')][_0x2c76('0x3c')]){_0x28402f['where']=_['merge'](_0x28402f[_0x2c76('0x3d')],{'$or':_[_0x2c76('0x2b')](_0x5a1c91,function(_0x4cc7bc){if(_0x4cc7bc[_0x2c76('0x2f')]!=='VIRTUAL'){var _0x57ce22={};_0x57ce22[_0x4cc7bc[_0x2c76('0x29')]]={'$like':'%'+_0x38f967[_0x2c76('0x32')][_0x2c76('0x3c')]+'%'};return _0x57ce22;}})});}_0x28402f=_[_0x2c76('0x3e')]({},_0x28402f,_0x38f967['options']);var _0x5d4e70={'where':_0x28402f[_0x2c76('0x3d')]};return db[_0x2c76('0x2c')][_0x2c76('0x1f')](_0x5d4e70)[_0x2c76('0x27')](function(_0x490027){_0x2e6999[_0x2c76('0x1f')]=_0x490027;if(_0x38f967[_0x2c76('0x32')][_0x2c76('0x3f')]){_0x28402f[_0x2c76('0x40')]=[{'all':!![]}];}return db[_0x2c76('0x2c')]['findAll'](_0x28402f);})['then'](function(_0x5c105c){_0x2e6999[_0x2c76('0x41')]=_0x5c105c;return _0x2e6999;})[_0x2c76('0x27')](respondWithFilteredResult(_0x92dee0,_0x28402f))['catch'](handleError(_0x92dee0,null));};exports[_0x2c76('0x42')]=function(_0x558d04,_0x57714f){var _0x170843={'raw':!![],'where':{'id':_0x558d04['params']['id']}},_0x1eb94b={};_0x1eb94b[_0x2c76('0x31')]=_[_0x2c76('0x43')](db[_0x2c76('0x2c')][_0x2c76('0x2d')]);_0x1eb94b[_0x2c76('0x32')]=_['keys'](_0x558d04['query']);_0x1eb94b[_0x2c76('0x33')]=_[_0x2c76('0x34')](_0x1eb94b['model'],_0x1eb94b[_0x2c76('0x32')]);_0x170843[_0x2c76('0x35')]=_[_0x2c76('0x34')](_0x1eb94b[_0x2c76('0x31')],qs['fields'](_0x558d04[_0x2c76('0x32')][_0x2c76('0x36')]));_0x170843['attributes']=_0x170843['attributes'][_0x2c76('0x44')]?_0x170843[_0x2c76('0x35')]:_0x1eb94b['model'];if(_0x558d04[_0x2c76('0x32')]['includeAll']){_0x170843['include']=[{'all':!![]}];}_0x170843=_[_0x2c76('0x3e')]({},_0x170843,_0x558d04[_0x2c76('0x45')]);return db['ZohoField'][_0x2c76('0x46')](_0x170843)['then'](handleEntityNotFound(_0x57714f,null))['then'](respondWithResult(_0x57714f,null))[_0x2c76('0x47')](handleError(_0x57714f,null));};exports[_0x2c76('0x48')]=function(_0x54549a,_0x527804){return db[_0x2c76('0x2c')][_0x2c76('0x48')](_0x54549a[_0x2c76('0x49')],{})[_0x2c76('0x27')](respondWithResult(_0x527804,0xc9))[_0x2c76('0x47')](handleError(_0x527804,null));};exports[_0x2c76('0x4a')]=function(_0x355e85,_0x5e827f){if(_0x355e85[_0x2c76('0x49')]['id']){delete _0x355e85[_0x2c76('0x49')]['id'];}return db[_0x2c76('0x2c')][_0x2c76('0x46')]({'where':{'id':_0x355e85[_0x2c76('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5e827f,null))[_0x2c76('0x27')](saveUpdates(_0x355e85[_0x2c76('0x49')],null))[_0x2c76('0x27')](respondWithResult(_0x5e827f,null))['catch'](handleError(_0x5e827f,null));};exports[_0x2c76('0x26')]=function(_0x230a49,_0x3f763c){return db[_0x2c76('0x2c')][_0x2c76('0x46')]({'where':{'id':_0x230a49[_0x2c76('0x4b')]['id']}})[_0x2c76('0x27')](handleEntityNotFound(_0x3f763c,null))['then'](removeEntity(_0x3f763c,null))[_0x2c76('0x47')](handleError(_0x3f763c,null));}; \ No newline at end of file +var _0xf41e=['type','VIRTUAL','merge','options','ZohoField','count','includeAll','findAll','catch','params','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','set','json','apply','reject','update','then','destroy','error','name','send','index','map','rawAttributes','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xf41e,0x167));var _0xef41=function(_0x42861e,_0x49d86e){_0x42861e=_0x42861e-0x0;var _0x5dfda1=_0xf41e[_0x42861e];return _0x5dfda1;};'use strict';var emlformat=require(_0xef41('0x0'));var rimraf=require(_0xef41('0x1'));var zipdir=require(_0xef41('0x2'));var jsonpatch=require(_0xef41('0x3'));var rp=require(_0xef41('0x4'));var moment=require(_0xef41('0x5'));var BPromise=require(_0xef41('0x6'));var Mustache=require(_0xef41('0x7'));var util=require('util');var path=require('path');var sox=require(_0xef41('0x8'));var csv=require(_0xef41('0x9'));var ejs=require(_0xef41('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xef41('0xb'));var deskjs=require(_0xef41('0xc'));var toCsv=require('to-csv');var querystring=require(_0xef41('0xd'));var Papa=require(_0xef41('0xe'));var Redis=require(_0xef41('0xf'));var authService=require(_0xef41('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xef41('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xef41('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xef41('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd1bdcb,_0x426fb9){_0x426fb9=_0x426fb9||0xcc;return function(_0x46aadf){if(_0x46aadf){return _0xd1bdcb[_0xef41('0x14')](_0x426fb9);}return _0xd1bdcb[_0xef41('0x15')](_0x426fb9)[_0xef41('0x16')]();};}function respondWithResult(_0x54dbc6,_0x4e65b4){_0x4e65b4=_0x4e65b4||0xc8;return function(_0x7f3093){if(_0x7f3093){return _0x54dbc6[_0xef41('0x15')](_0x4e65b4)['json'](_0x7f3093);}};}function respondWithFilteredResult(_0x2f1fcf,_0x15f700){return function(_0x206eac){if(_0x206eac){var _0x1ccd87=typeof _0x15f700[_0xef41('0x17')]===_0xef41('0x18')&&typeof _0x15f700[_0xef41('0x19')]===_0xef41('0x18');var _0x82286c=_0x206eac['count'];var _0xd18802=_0x1ccd87?0x0:_0x15f700[_0xef41('0x17')];var _0x108961=_0x1ccd87?_0x206eac['count']:_0x15f700[_0xef41('0x17')]+_0x15f700[_0xef41('0x19')];var _0x5686ab;if(_0x108961>=_0x82286c){_0x108961=_0x82286c;_0x5686ab=0xc8;}else{_0x5686ab=0xce;}_0x2f1fcf['status'](_0x5686ab);return _0x2f1fcf[_0xef41('0x1a')]('Content-Range',_0xd18802+'-'+_0x108961+'/'+_0x82286c)[_0xef41('0x1b')](_0x206eac);}return null;};}function patchUpdates(_0x2df964){return function(_0x598765){try{jsonpatch[_0xef41('0x1c')](_0x598765,_0x2df964,!![]);}catch(_0x2acc37){return BPromise[_0xef41('0x1d')](_0x2acc37);}return _0x598765['save']();};}function saveUpdates(_0x525b1a,_0x2f105b){return function(_0x155c93){if(_0x155c93){return _0x155c93[_0xef41('0x1e')](_0x525b1a)[_0xef41('0x1f')](function(_0x406f81){return _0x406f81;});}return null;};}function removeEntity(_0x427949,_0x341650){return function(_0x1bfb93){if(_0x1bfb93){return _0x1bfb93[_0xef41('0x20')]()[_0xef41('0x1f')](function(){_0x427949[_0xef41('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52da94,_0x3b2af7){return function(_0x41edd7){if(!_0x41edd7){_0x52da94[_0xef41('0x14')](0x194);}return _0x41edd7;};}function handleError(_0x1518f0,_0xa657a1){_0xa657a1=_0xa657a1||0x1f4;return function(_0x5027d0){logger[_0xef41('0x21')](_0x5027d0['stack']);if(_0x5027d0[_0xef41('0x22')]){delete _0x5027d0[_0xef41('0x22')];}_0x1518f0['status'](_0xa657a1)[_0xef41('0x23')](_0x5027d0);};}exports[_0xef41('0x24')]=function(_0x5df038,_0x41c819){var _0x324d68={},_0x378f4c={},_0x48c574={'count':0x0,'rows':[]};var _0x4cd755=_[_0xef41('0x25')](db['ZohoField'][_0xef41('0x26')],function(_0x4e5e80){return{'name':_0x4e5e80['fieldName'],'type':_0x4e5e80['type'][_0xef41('0x27')]};});_0x378f4c[_0xef41('0x28')]=_[_0xef41('0x25')](_0x4cd755,_0xef41('0x22'));_0x378f4c['query']=_[_0xef41('0x29')](_0x5df038[_0xef41('0x2a')]);_0x378f4c[_0xef41('0x2b')]=_[_0xef41('0x2c')](_0x378f4c[_0xef41('0x28')],_0x378f4c['query']);_0x324d68['attributes']=_['intersection'](_0x378f4c['model'],qs['fields'](_0x5df038['query'][_0xef41('0x2d')]));_0x324d68['attributes']=_0x324d68[_0xef41('0x2e')][_0xef41('0x2f')]?_0x324d68[_0xef41('0x2e')]:_0x378f4c[_0xef41('0x28')];if(!_0x5df038[_0xef41('0x2a')][_0xef41('0x30')](_0xef41('0x31'))){_0x324d68[_0xef41('0x19')]=qs[_0xef41('0x19')](_0x5df038[_0xef41('0x2a')]['limit']);_0x324d68[_0xef41('0x17')]=qs['offset'](_0x5df038[_0xef41('0x2a')]['offset']);}_0x324d68[_0xef41('0x32')]=qs[_0xef41('0x33')](_0x5df038[_0xef41('0x2a')][_0xef41('0x33')]);_0x324d68[_0xef41('0x34')]=qs['filters'](_[_0xef41('0x35')](_0x5df038['query'],_0x378f4c['filters']),_0x4cd755);if(_0x5df038[_0xef41('0x2a')][_0xef41('0x36')]){_0x324d68[_0xef41('0x34')]=_['merge'](_0x324d68[_0xef41('0x34')],{'$or':_[_0xef41('0x25')](_0x4cd755,function(_0x30a7f1){if(_0x30a7f1[_0xef41('0x37')]!==_0xef41('0x38')){var _0x17a37c={};_0x17a37c[_0x30a7f1[_0xef41('0x22')]]={'$like':'%'+_0x5df038[_0xef41('0x2a')][_0xef41('0x36')]+'%'};return _0x17a37c;}})});}_0x324d68=_[_0xef41('0x39')]({},_0x324d68,_0x5df038[_0xef41('0x3a')]);var _0x3155c8={'where':_0x324d68[_0xef41('0x34')]};return db[_0xef41('0x3b')][_0xef41('0x3c')](_0x3155c8)['then'](function(_0x450bb9){_0x48c574[_0xef41('0x3c')]=_0x450bb9;if(_0x5df038[_0xef41('0x2a')][_0xef41('0x3d')]){_0x324d68['include']=[{'all':!![]}];}return db[_0xef41('0x3b')][_0xef41('0x3e')](_0x324d68);})['then'](function(_0x2e664b){_0x48c574['rows']=_0x2e664b;return _0x48c574;})[_0xef41('0x1f')](respondWithFilteredResult(_0x41c819,_0x324d68))[_0xef41('0x3f')](handleError(_0x41c819,null));};exports['show']=function(_0x4685af,_0x31ada7){var _0x57f412={'raw':!![],'where':{'id':_0x4685af[_0xef41('0x40')]['id']}},_0x108a92={};_0x108a92['model']=_[_0xef41('0x29')](db[_0xef41('0x3b')][_0xef41('0x26')]);_0x108a92['query']=_['keys'](_0x4685af[_0xef41('0x2a')]);_0x108a92[_0xef41('0x2b')]=_[_0xef41('0x2c')](_0x108a92[_0xef41('0x28')],_0x108a92[_0xef41('0x2a')]);_0x57f412['attributes']=_[_0xef41('0x2c')](_0x108a92[_0xef41('0x28')],qs[_0xef41('0x2d')](_0x4685af[_0xef41('0x2a')]['fields']));_0x57f412[_0xef41('0x2e')]=_0x57f412[_0xef41('0x2e')][_0xef41('0x2f')]?_0x57f412[_0xef41('0x2e')]:_0x108a92['model'];if(_0x4685af['query'][_0xef41('0x3d')]){_0x57f412[_0xef41('0x41')]=[{'all':!![]}];}_0x57f412=_['merge']({},_0x57f412,_0x4685af[_0xef41('0x3a')]);return db[_0xef41('0x3b')][_0xef41('0x42')](_0x57f412)[_0xef41('0x1f')](handleEntityNotFound(_0x31ada7,null))[_0xef41('0x1f')](respondWithResult(_0x31ada7,null))['catch'](handleError(_0x31ada7,null));};exports[_0xef41('0x43')]=function(_0x141363,_0x200b0d){return db[_0xef41('0x3b')][_0xef41('0x43')](_0x141363[_0xef41('0x44')],{})[_0xef41('0x1f')](respondWithResult(_0x200b0d,0xc9))['catch'](handleError(_0x200b0d,null));};exports[_0xef41('0x1e')]=function(_0x744ffc,_0x886039){if(_0x744ffc[_0xef41('0x44')]['id']){delete _0x744ffc[_0xef41('0x44')]['id'];}return db['ZohoField'][_0xef41('0x42')]({'where':{'id':_0x744ffc[_0xef41('0x40')]['id']}})['then'](handleEntityNotFound(_0x886039,null))[_0xef41('0x1f')](saveUpdates(_0x744ffc[_0xef41('0x44')],null))[_0xef41('0x1f')](respondWithResult(_0x886039,null))[_0xef41('0x3f')](handleError(_0x886039,null));};exports['destroy']=function(_0x1a1f61,_0x2009e4){return db[_0xef41('0x3b')]['find']({'where':{'id':_0x1a1f61[_0xef41('0x40')]['id']}})[_0xef41('0x1f')](handleEntityNotFound(_0x2009e4,null))[_0xef41('0x1f')](removeEntity(_0x2009e4,null))[_0xef41('0x3f')](handleError(_0x2009e4,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index eb1e708..1c1cfc6 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 _0x524e=['define','ZohoField','zoho_unique_index','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports'];(function(_0x45518f,_0x475a6b){var _0x198175=function(_0x40d333){while(--_0x40d333){_0x45518f['push'](_0x45518f['shift']());}};_0x198175(++_0x475a6b);}(_0x524e,0x15e));var _0xe524=function(_0x353798,_0x2f3f1b){_0x353798=_0x353798-0x0;var _0x5d03ef=_0x524e[_0x353798];return _0x5d03ef;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe524('0x0'))(_0xe524('0x1'));var moment=require(_0xe524('0x2'));var BPromise=require(_0xe524('0x3'));var rp=require(_0xe524('0x4'));var fs=require('fs');var path=require(_0xe524('0x5'));var rimraf=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var attributes=require(_0xe524('0x8'));module[_0xe524('0x9')]=function(_0x4f75d6,_0xaaeaa9){return _0x4f75d6[_0xe524('0xa')](_0xe524('0xb'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xe524('0xc'),'fields':[_0xe524('0xd'),_0xe524('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6455=['moment','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','FieldId','lodash','../../config/logger','api'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x6455,0x97));var _0x5645=function(_0x36bd82,_0x135aca){_0x36bd82=_0x36bd82-0x0;var _0x2447f7=_0x6455[_0x36bd82];return _0x2447f7;};'use strict';var _=require(_0x5645('0x0'));var util=require('util');var logger=require(_0x5645('0x1'))(_0x5645('0x2'));var moment=require(_0x5645('0x3'));var BPromise=require(_0x5645('0x4'));var rp=require(_0x5645('0x5'));var fs=require('fs');var path=require(_0x5645('0x6'));var rimraf=require('rimraf');var config=require(_0x5645('0x7'));var attributes=require(_0x5645('0x8'));module[_0x5645('0x9')]=function(_0x9400a8,_0x3a635d){return _0x9400a8[_0x5645('0xa')](_0x5645('0xb'),attributes,{'tableName':_0x5645('0xc'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0x5645('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 2c794d5..9656915 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 _0x381a=['bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x128d4d,_0x319a91){var _0x71dd8e=function(_0xd6f97d){while(--_0xd6f97d){_0x128d4d['push'](_0x128d4d['shift']());}};_0x71dd8e(++_0x319a91);}(_0x381a,0x1a2));var _0xa381=function(_0x8bc1f0,_0x2b6d35){_0x8bc1f0=_0x8bc1f0-0x0;var _0x21634=_0x381a[_0x8bc1f0];return _0x21634;};'use strict';var _=require(_0xa381('0x0'));var util=require(_0xa381('0x1'));var moment=require('moment');var BPromise=require(_0xa381('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa381('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa381('0x4'))(_0xa381('0x5'));var config=require(_0xa381('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa381('0x7')][_0xa381('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x241376,_0x13bbe4,_0x3a9454){return new BPromise(function(_0x34dcf9,_0x4c058e){return client[_0xa381('0x9')](_0x241376,_0x3a9454)[_0xa381('0xa')](function(_0x32c57c){logger[_0xa381('0xb')](_0xa381('0xc'),_0x13bbe4,_0xa381('0xd'));logger[_0xa381('0xe')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x13bbe4,'request\x20sent',JSON[_0xa381('0xf')](_0x32c57c));if(_0x32c57c[_0xa381('0x10')]){if(_0x32c57c[_0xa381('0x10')][_0xa381('0x11')]===0x1f4){logger[_0xa381('0x10')](_0xa381('0xc'),_0x13bbe4,_0x32c57c[_0xa381('0x10')][_0xa381('0x12')]);return _0x4c058e(_0x32c57c[_0xa381('0x10')][_0xa381('0x12')]);}logger[_0xa381('0x10')](_0xa381('0xc'),_0x13bbe4,_0x32c57c[_0xa381('0x10')][_0xa381('0x12')]);return _0x34dcf9(_0x32c57c[_0xa381('0x10')][_0xa381('0x12')]);}else{logger['info'](_0xa381('0xc'),_0x13bbe4,'request\x20sent');_0x34dcf9(_0x32c57c[_0xa381('0x13')][_0xa381('0x12')]);}})[_0xa381('0x14')](function(_0x523dfa){logger[_0xa381('0x10')](_0xa381('0xc'),_0x13bbe4,_0x523dfa);_0x4c058e(_0x523dfa);});});} \ No newline at end of file +var _0x0502=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x5f1cf8,_0x5e0923){var _0x27d0fa=function(_0x3f1171){while(--_0x3f1171){_0x5f1cf8['push'](_0x5f1cf8['shift']());}};_0x27d0fa(++_0x5e0923);}(_0x0502,0x198));var _0x2050=function(_0x3534ca,_0x4fb25e){_0x3534ca=_0x3534ca-0x0;var _0xd2c661=_0x0502[_0x3534ca];return _0xd2c661;};'use strict';var _=require(_0x2050('0x0'));var util=require('util');var moment=require(_0x2050('0x1'));var BPromise=require(_0x2050('0x2'));var rs=require(_0x2050('0x3'));var fs=require('fs');var Redis=require(_0x2050('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2050('0x5'))(_0x2050('0x6'));var config=require(_0x2050('0x7'));var jayson=require(_0x2050('0x8'));var client=jayson[_0x2050('0x9')][_0x2050('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c155b,_0x1b309d,_0x2d100a){return new BPromise(function(_0x522675,_0xbf20b8){return client[_0x2050('0xb')](_0x1c155b,_0x2d100a)[_0x2050('0xc')](function(_0x182aff){logger[_0x2050('0xd')](_0x2050('0xe'),_0x1b309d,_0x2050('0xf'));logger[_0x2050('0x10')](_0x2050('0x11'),_0x1b309d,_0x2050('0xf'),JSON[_0x2050('0x12')](_0x182aff));if(_0x182aff[_0x2050('0x13')]){if(_0x182aff[_0x2050('0x13')][_0x2050('0x14')]===0x1f4){logger['error'](_0x2050('0xe'),_0x1b309d,_0x182aff[_0x2050('0x13')]['message']);return _0xbf20b8(_0x182aff['error'][_0x2050('0x15')]);}logger[_0x2050('0x13')]('ZohoField,\x20%s,\x20%s',_0x1b309d,_0x182aff[_0x2050('0x13')][_0x2050('0x15')]);return _0x522675(_0x182aff['error'][_0x2050('0x15')]);}else{logger[_0x2050('0xd')](_0x2050('0xe'),_0x1b309d,_0x2050('0xf'));_0x522675(_0x182aff['result'][_0x2050('0x15')]);}})[_0x2050('0x16')](function(_0x55d526){logger[_0x2050('0x13')](_0x2050('0xe'),_0x1b309d,_0x55d526);_0xbf20b8(_0x55d526);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index b4a9462..0d516a5 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4693b8,_0xff4dcc){var _0x117328=function(_0x847a02){while(--_0x847a02){_0x4693b8['push'](_0x4693b8['shift']());}};_0x117328(++_0xff4dcc);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x35296d,_0x5103aa){var _0x192739=function(_0x48cd1d){while(--_0x48cd1d){_0x35296d['push'](_0x35296d['shift']());}};_0x192739(++_0x5103aa);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xcb91[_0x4f9b18];return _0x29f20c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index d4efa3e..e9f569a 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 _0xc15e=['unique_name_and_version','INTEGER','BOOLEAN','state','sequelize','exports','STRING'];(function(_0x401c2a,_0x3aa4bb){var _0x303419=function(_0x4a9f9d){while(--_0x4a9f9d){_0x401c2a['push'](_0x401c2a['shift']());}};_0x303419(++_0x3aa4bb);}(_0xc15e,0x154));var _0xec15=function(_0x475e73,_0x57d609){_0x475e73=_0x475e73-0x0;var _0x622ab7=_0xc15e[_0x475e73];return _0x622ab7;};'use strict';var Sequelize=require(_0xec15('0x0'));module[_0xec15('0x1')]={'name':{'type':Sequelize[_0xec15('0x2')],'allowNull':![],'unique':_0xec15('0x3')},'version':{'type':Sequelize[_0xec15('0x2')],'allowNull':![],'unique':_0xec15('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xec15('0x2')]},'path':{'type':Sequelize[_0xec15('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xec15('0x4')]},'active':{'type':Sequelize[_0xec15('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xec15('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':_0xec15('0x6')},'description':{'type':Sequelize[_0xec15('0x2')]},'title':{'type':Sequelize[_0xec15('0x2')]},'remoteUri':{'type':Sequelize[_0xec15('0x2')]},'link':{'type':Sequelize[_0xec15('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x1aac=['INTEGER','state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x114dd7,_0xf5c47e){var _0x6f1910=function(_0x44283c){while(--_0x44283c){_0x114dd7['push'](_0x114dd7['shift']());}};_0x6f1910(++_0xf5c47e);}(_0x1aac,0xf7));var _0xc1aa=function(_0x2aca2a,_0x1bbf87){_0x2aca2a=_0x2aca2a-0x0;var _0x2bf154=_0x1aac[_0x2aca2a];return _0x2bf154;};'use strict';var Sequelize=require(_0xc1aa('0x0'));module[_0xc1aa('0x1')]={'name':{'type':Sequelize[_0xc1aa('0x2')],'allowNull':![],'unique':_0xc1aa('0x3')},'version':{'type':Sequelize[_0xc1aa('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xc1aa('0x2')],'defaultValue':_0xc1aa('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc1aa('0x2')]},'size':{'type':Sequelize[_0xc1aa('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xc1aa('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0xc1aa('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xc1aa('0x2')]},'link':{'type':Sequelize[_0xc1aa('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 45484a4..229fdd2 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 _0x187d=['body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','update','destroy','error','stack','name','index','map','Integration','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','where','filter','merge','includeAll','include','findAll','then','rows','catch','show','params','fields','options','find','create'];(function(_0x5ae7ae,_0x534c34){var _0x5929f7=function(_0xeabd3a){while(--_0xeabd3a){_0x5ae7ae['push'](_0x5ae7ae['shift']());}};_0x5929f7(++_0x534c34);}(_0x187d,0x93));var _0xd187=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x187d[_0x18a79d];return _0x4f8848;};'use strict';var emlformat=require(_0xd187('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd187('0x1'));var jsonpatch=require(_0xd187('0x2'));var rp=require(_0xd187('0x3'));var moment=require(_0xd187('0x4'));var BPromise=require(_0xd187('0x5'));var Mustache=require(_0xd187('0x6'));var util=require('util');var path=require(_0xd187('0x7'));var sox=require(_0xd187('0x8'));var csv=require('to-csv');var ejs=require(_0xd187('0x9'));var fs=require('fs');var fs_extra=require(_0xd187('0xa'));var _=require(_0xd187('0xb'));var squel=require(_0xd187('0xc'));var crypto=require(_0xd187('0xd'));var jsforce=require(_0xd187('0xe'));var deskjs=require(_0xd187('0xf'));var toCsv=require(_0xd187('0x10'));var querystring=require('querystring');var Papa=require(_0xd187('0x11'));var Redis=require(_0xd187('0x12'));var authService=require(_0xd187('0x13'));var qs=require(_0xd187('0x14'));var as=require(_0xd187('0x15'));var hardwareService=require(_0xd187('0x16'));var logger=require('../../config/logger')(_0xd187('0x17'));var utils=require(_0xd187('0x18'));var config=require(_0xd187('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd187('0x1a'))['db'];function respondWithStatusCode(_0x4545cf,_0x32ba07){_0x32ba07=_0x32ba07||0xcc;return function(_0x59ee4a){if(_0x59ee4a){return _0x4545cf[_0xd187('0x1b')](_0x32ba07);}return _0x4545cf[_0xd187('0x1c')](_0x32ba07)[_0xd187('0x1d')]();};}function respondWithResult(_0x126d1a,_0x517b25){_0x517b25=_0x517b25||0xc8;return function(_0x39a927){if(_0x39a927){return _0x126d1a[_0xd187('0x1c')](_0x517b25)[_0xd187('0x1e')](_0x39a927);}};}function respondWithFilteredResult(_0x188cfe,_0x4c8f68){return function(_0x245d3e){if(_0x245d3e){var _0x52a208=typeof _0x4c8f68['offset']===_0xd187('0x1f')&&typeof _0x4c8f68['limit']==='undefined';var _0x207b36=_0x245d3e[_0xd187('0x20')];var _0x374fe0=_0x52a208?0x0:_0x4c8f68[_0xd187('0x21')];var _0x21df74=_0x52a208?_0x245d3e[_0xd187('0x20')]:_0x4c8f68[_0xd187('0x21')]+_0x4c8f68[_0xd187('0x22')];var _0x4f2f88;if(_0x21df74>=_0x207b36){_0x21df74=_0x207b36;_0x4f2f88=0xc8;}else{_0x4f2f88=0xce;}_0x188cfe[_0xd187('0x1c')](_0x4f2f88);return _0x188cfe[_0xd187('0x23')](_0xd187('0x24'),_0x374fe0+'-'+_0x21df74+'/'+_0x207b36)[_0xd187('0x1e')](_0x245d3e);}return null;};}function patchUpdates(_0x5204ee){return function(_0x2f7fb3){try{jsonpatch[_0xd187('0x25')](_0x2f7fb3,_0x5204ee,!![]);}catch(_0xc5bba5){return BPromise['reject'](_0xc5bba5);}return _0x2f7fb3['save']();};}function saveUpdates(_0x57cf1d,_0x435d94){return function(_0x33741d){if(_0x33741d){return _0x33741d[_0xd187('0x26')](_0x57cf1d)['then'](function(_0x2c07c8){return _0x2c07c8;});}return null;};}function removeEntity(_0x57186b,_0x145771){return function(_0x5a7a23){if(_0x5a7a23){return _0x5a7a23[_0xd187('0x27')]()['then'](function(){_0x57186b['status'](0xcc)[_0xd187('0x1d')]();});}};}function handleEntityNotFound(_0x4d992b,_0x12da33){return function(_0x598aa4){if(!_0x598aa4){_0x4d992b['sendStatus'](0x194);}return _0x598aa4;};}function handleError(_0x4eac6a,_0x848ddd){_0x848ddd=_0x848ddd||0x1f4;return function(_0xeff822){logger[_0xd187('0x28')](_0xeff822[_0xd187('0x29')]);if(_0xeff822['name']){delete _0xeff822[_0xd187('0x2a')];}_0x4eac6a[_0xd187('0x1c')](_0x848ddd)['send'](_0xeff822);};}exports[_0xd187('0x2b')]=function(_0x1c87ee,_0x34febe){var _0x4c50a5={},_0x15e2e8={},_0x56e292={'count':0x0,'rows':[]};var _0x263e31=_[_0xd187('0x2c')](db[_0xd187('0x2d')][_0xd187('0x2e')],function(_0x489f2e){return{'name':_0x489f2e[_0xd187('0x2f')],'type':_0x489f2e[_0xd187('0x30')]['key']};});_0x15e2e8['model']=_[_0xd187('0x2c')](_0x263e31,_0xd187('0x2a'));_0x15e2e8[_0xd187('0x31')]=_[_0xd187('0x32')](_0x1c87ee[_0xd187('0x31')]);_0x15e2e8[_0xd187('0x33')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],_0x15e2e8['query']);_0x4c50a5[_0xd187('0x36')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],qs['fields'](_0x1c87ee[_0xd187('0x31')]['fields']));_0x4c50a5[_0xd187('0x36')]=_0x4c50a5[_0xd187('0x36')][_0xd187('0x37')]?_0x4c50a5['attributes']:_0x15e2e8['model'];if(!_0x1c87ee[_0xd187('0x31')][_0xd187('0x38')]('nolimit')){_0x4c50a5[_0xd187('0x22')]=qs[_0xd187('0x22')](_0x1c87ee[_0xd187('0x31')]['limit']);_0x4c50a5['offset']=qs[_0xd187('0x21')](_0x1c87ee[_0xd187('0x31')]['offset']);}_0x4c50a5['order']=qs['sort'](_0x1c87ee[_0xd187('0x31')]['sort']);_0x4c50a5[_0xd187('0x39')]=qs[_0xd187('0x33')](_['pick'](_0x1c87ee[_0xd187('0x31')],_0x15e2e8['filters']),_0x263e31);if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]){_0x4c50a5['where']=_[_0xd187('0x3b')](_0x4c50a5[_0xd187('0x39')],{'$or':_['map'](_0x263e31,function(_0x4399a5){if(_0x4399a5['type']!=='VIRTUAL'){var _0x26b06d={};_0x26b06d[_0x4399a5[_0xd187('0x2a')]]={'$like':'%'+_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]+'%'};return _0x26b06d;}})});}_0x4c50a5=_[_0xd187('0x3b')]({},_0x4c50a5,_0x1c87ee['options']);var _0x8860c={'where':_0x4c50a5[_0xd187('0x39')]};return db[_0xd187('0x2d')]['count'](_0x8860c)['then'](function(_0x538c05){_0x56e292['count']=_0x538c05;if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3c')]){_0x4c50a5[_0xd187('0x3d')]=[{'all':!![]}];}return db[_0xd187('0x2d')][_0xd187('0x3e')](_0x4c50a5);})[_0xd187('0x3f')](function(_0x4699e1){_0x56e292[_0xd187('0x40')]=_0x4699e1;return _0x56e292;})['then'](respondWithFilteredResult(_0x34febe,_0x4c50a5))[_0xd187('0x41')](handleError(_0x34febe,null));};exports[_0xd187('0x42')]=function(_0x31d9d2,_0x51c7fc){var _0x21cbf6={'raw':![],'where':{'id':_0x31d9d2[_0xd187('0x43')]['id']}},_0x48c100={};_0x48c100[_0xd187('0x35')]=_[_0xd187('0x32')](db[_0xd187('0x2d')][_0xd187('0x2e')]);_0x48c100['query']=_[_0xd187('0x32')](_0x31d9d2[_0xd187('0x31')]);_0x48c100[_0xd187('0x33')]=_[_0xd187('0x34')](_0x48c100['model'],_0x48c100[_0xd187('0x31')]);_0x21cbf6[_0xd187('0x36')]=_['intersection'](_0x48c100[_0xd187('0x35')],qs[_0xd187('0x44')](_0x31d9d2['query']['fields']));_0x21cbf6[_0xd187('0x36')]=_0x21cbf6[_0xd187('0x36')]['length']?_0x21cbf6['attributes']:_0x48c100['model'];if(_0x31d9d2[_0xd187('0x31')][_0xd187('0x3c')]){_0x21cbf6[_0xd187('0x3d')]=[{'all':!![]}];}_0x21cbf6=_[_0xd187('0x3b')]({},_0x21cbf6,_0x31d9d2[_0xd187('0x45')]);return db[_0xd187('0x2d')][_0xd187('0x46')](_0x21cbf6)['then'](handleEntityNotFound(_0x51c7fc,null))[_0xd187('0x3f')](respondWithResult(_0x51c7fc,null))[_0xd187('0x41')](handleError(_0x51c7fc,null));};exports[_0xd187('0x47')]=function(_0x3ce4a1,_0x3f5def){return db[_0xd187('0x2d')][_0xd187('0x47')](_0x3ce4a1[_0xd187('0x48')],{})['then'](respondWithResult(_0x3f5def,0xc9))[_0xd187('0x41')](handleError(_0x3f5def,null));};exports[_0xd187('0x26')]=function(_0x4523c8,_0x1449d7){if(_0x4523c8[_0xd187('0x48')]['id']){delete _0x4523c8['body']['id'];}return db[_0xd187('0x2d')][_0xd187('0x46')]({'where':{'id':_0x4523c8['params']['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x1449d7,null))[_0xd187('0x3f')](saveUpdates(_0x4523c8['body'],null))['then'](respondWithResult(_0x1449d7,null))['catch'](handleError(_0x1449d7,null));};exports['destroy']=function(_0x473bef,_0x22f432){return db[_0xd187('0x2d')][_0xd187('0x46')]({'where':{'id':_0x473bef[_0xd187('0x43')]['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x22f432,null))[_0xd187('0x3f')](removeEntity(_0x22f432,null))['catch'](handleError(_0x22f432,null));}; \ No newline at end of file +var _0xafc4=['reject','save','update','destroy','then','stack','name','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL','options','Integration','includeAll','catch','show','params','create','body','find','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x3bb6f3,_0x33b960){var _0x24405b=function(_0x5d4884){while(--_0x5d4884){_0x3bb6f3['push'](_0x3bb6f3['shift']());}};_0x24405b(++_0x33b960);}(_0xafc4,0x69));var _0x4afc=function(_0x3a942c,_0x58f049){_0x3a942c=_0x3a942c-0x0;var _0x27d328=_0xafc4[_0x3a942c];return _0x27d328;};'use strict';var emlformat=require(_0x4afc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4afc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4afc('0x2'));var moment=require(_0x4afc('0x3'));var BPromise=require(_0x4afc('0x4'));var Mustache=require(_0x4afc('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4afc('0x6'));var ejs=require(_0x4afc('0x7'));var fs=require('fs');var fs_extra=require(_0x4afc('0x8'));var _=require(_0x4afc('0x9'));var squel=require(_0x4afc('0xa'));var crypto=require(_0x4afc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4afc('0xc'));var toCsv=require(_0x4afc('0x6'));var querystring=require(_0x4afc('0xd'));var Papa=require(_0x4afc('0xe'));var Redis=require(_0x4afc('0xf'));var authService=require(_0x4afc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4afc('0x11'));var logger=require('../../config/logger')(_0x4afc('0x12'));var utils=require(_0x4afc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4afc('0x14'));var db=require(_0x4afc('0x15'))['db'];function respondWithStatusCode(_0x2b191c,_0x2768bf){_0x2768bf=_0x2768bf||0xcc;return function(_0x1d8f98){if(_0x1d8f98){return _0x2b191c[_0x4afc('0x16')](_0x2768bf);}return _0x2b191c[_0x4afc('0x17')](_0x2768bf)[_0x4afc('0x18')]();};}function respondWithResult(_0x5effb4,_0x26f3f1){_0x26f3f1=_0x26f3f1||0xc8;return function(_0x429fd8){if(_0x429fd8){return _0x5effb4[_0x4afc('0x17')](_0x26f3f1)[_0x4afc('0x19')](_0x429fd8);}};}function respondWithFilteredResult(_0x5f2dc9,_0x4e32e8){return function(_0x2452ae){if(_0x2452ae){var _0x4f3127=typeof _0x4e32e8[_0x4afc('0x1a')]===_0x4afc('0x1b')&&typeof _0x4e32e8[_0x4afc('0x1c')]===_0x4afc('0x1b');var _0x3a306f=_0x2452ae[_0x4afc('0x1d')];var _0x22f809=_0x4f3127?0x0:_0x4e32e8[_0x4afc('0x1a')];var _0x16365f=_0x4f3127?_0x2452ae[_0x4afc('0x1d')]:_0x4e32e8[_0x4afc('0x1a')]+_0x4e32e8['limit'];var _0x1a8f49;if(_0x16365f>=_0x3a306f){_0x16365f=_0x3a306f;_0x1a8f49=0xc8;}else{_0x1a8f49=0xce;}_0x5f2dc9[_0x4afc('0x17')](_0x1a8f49);return _0x5f2dc9[_0x4afc('0x1e')](_0x4afc('0x1f'),_0x22f809+'-'+_0x16365f+'/'+_0x3a306f)['json'](_0x2452ae);}return null;};}function patchUpdates(_0x3bddc0){return function(_0x30eda3){try{jsonpatch[_0x4afc('0x20')](_0x30eda3,_0x3bddc0,!![]);}catch(_0x280587){return BPromise[_0x4afc('0x21')](_0x280587);}return _0x30eda3[_0x4afc('0x22')]();};}function saveUpdates(_0x3ad7a5,_0x573a75){return function(_0x5403e4){if(_0x5403e4){return _0x5403e4[_0x4afc('0x23')](_0x3ad7a5)['then'](function(_0x37debf){return _0x37debf;});}return null;};}function removeEntity(_0x4e9a48,_0x1aa676){return function(_0x2a0314){if(_0x2a0314){return _0x2a0314[_0x4afc('0x24')]()[_0x4afc('0x25')](function(){_0x4e9a48[_0x4afc('0x17')](0xcc)[_0x4afc('0x18')]();});}};}function handleEntityNotFound(_0x40a0db,_0x383a71){return function(_0x2bb837){if(!_0x2bb837){_0x40a0db[_0x4afc('0x16')](0x194);}return _0x2bb837;};}function handleError(_0x4e8273,_0x359c07){_0x359c07=_0x359c07||0x1f4;return function(_0x35f5b3){logger['error'](_0x35f5b3[_0x4afc('0x26')]);if(_0x35f5b3[_0x4afc('0x27')]){delete _0x35f5b3[_0x4afc('0x27')];}_0x4e8273['status'](_0x359c07)['send'](_0x35f5b3);};}exports['index']=function(_0x426e9d,_0x5db47e){var _0x5e4747={},_0xd26d2f={},_0x628e42={'count':0x0,'rows':[]};var _0x494fe7=_['map'](db['Integration'][_0x4afc('0x28')],function(_0x34434a){return{'name':_0x34434a[_0x4afc('0x29')],'type':_0x34434a[_0x4afc('0x2a')][_0x4afc('0x2b')]};});_0xd26d2f[_0x4afc('0x2c')]=_['map'](_0x494fe7,_0x4afc('0x27'));_0xd26d2f[_0x4afc('0x2d')]=_[_0x4afc('0x2e')](_0x426e9d[_0x4afc('0x2d')]);_0xd26d2f[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0xd26d2f[_0x4afc('0x2c')],_0xd26d2f[_0x4afc('0x2d')]);_0x5e4747['attributes']=_[_0x4afc('0x30')](_0xd26d2f['model'],qs['fields'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x5e4747[_0x4afc('0x32')]=_0x5e4747[_0x4afc('0x32')][_0x4afc('0x33')]?_0x5e4747[_0x4afc('0x32')]:_0xd26d2f['model'];if(!_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x34')](_0x4afc('0x35'))){_0x5e4747[_0x4afc('0x1c')]=qs[_0x4afc('0x1c')](_0x426e9d[_0x4afc('0x2d')]['limit']);_0x5e4747[_0x4afc('0x1a')]=qs[_0x4afc('0x1a')](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x1a')]);}_0x5e4747['order']=qs['sort'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x36')]);_0x5e4747[_0x4afc('0x37')]=qs['filters'](_['pick'](_0x426e9d[_0x4afc('0x2d')],_0xd26d2f['filters']),_0x494fe7);if(_0x426e9d['query'][_0x4afc('0x38')]){_0x5e4747[_0x4afc('0x37')]=_[_0x4afc('0x39')](_0x5e4747[_0x4afc('0x37')],{'$or':_[_0x4afc('0x3a')](_0x494fe7,function(_0x4420fb){if(_0x4420fb[_0x4afc('0x2a')]!==_0x4afc('0x3b')){var _0x3ccc5a={};_0x3ccc5a[_0x4420fb[_0x4afc('0x27')]]={'$like':'%'+_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x38')]+'%'};return _0x3ccc5a;}})});}_0x5e4747=_[_0x4afc('0x39')]({},_0x5e4747,_0x426e9d[_0x4afc('0x3c')]);var _0x46dd2a={'where':_0x5e4747['where']};return db[_0x4afc('0x3d')][_0x4afc('0x1d')](_0x46dd2a)[_0x4afc('0x25')](function(_0xe6db12){_0x628e42[_0x4afc('0x1d')]=_0xe6db12;if(_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x3e')]){_0x5e4747['include']=[{'all':!![]}];}return db['Integration']['findAll'](_0x5e4747);})[_0x4afc('0x25')](function(_0x105c03){_0x628e42['rows']=_0x105c03;return _0x628e42;})[_0x4afc('0x25')](respondWithFilteredResult(_0x5db47e,_0x5e4747))[_0x4afc('0x3f')](handleError(_0x5db47e,null));};exports[_0x4afc('0x40')]=function(_0x397996,_0x545109){var _0x12b5db={'raw':![],'where':{'id':_0x397996[_0x4afc('0x41')]['id']}},_0x45c9c3={};_0x45c9c3[_0x4afc('0x2c')]=_[_0x4afc('0x2e')](db[_0x4afc('0x3d')]['rawAttributes']);_0x45c9c3[_0x4afc('0x2d')]=_['keys'](_0x397996[_0x4afc('0x2d')]);_0x45c9c3[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0x45c9c3['model'],_0x45c9c3['query']);_0x12b5db[_0x4afc('0x32')]=_[_0x4afc('0x30')](_0x45c9c3[_0x4afc('0x2c')],qs[_0x4afc('0x31')](_0x397996[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x12b5db[_0x4afc('0x32')]=_0x12b5db[_0x4afc('0x32')]['length']?_0x12b5db[_0x4afc('0x32')]:_0x45c9c3[_0x4afc('0x2c')];if(_0x397996['query'][_0x4afc('0x3e')]){_0x12b5db['include']=[{'all':!![]}];}_0x12b5db=_[_0x4afc('0x39')]({},_0x12b5db,_0x397996[_0x4afc('0x3c')]);return db[_0x4afc('0x3d')]['find'](_0x12b5db)[_0x4afc('0x25')](handleEntityNotFound(_0x545109,null))[_0x4afc('0x25')](respondWithResult(_0x545109,null))[_0x4afc('0x3f')](handleError(_0x545109,null));};exports[_0x4afc('0x42')]=function(_0x4772db,_0x19a0ac){return db['Integration']['create'](_0x4772db['body'],{})[_0x4afc('0x25')](respondWithResult(_0x19a0ac,0xc9))[_0x4afc('0x3f')](handleError(_0x19a0ac,null));};exports[_0x4afc('0x23')]=function(_0x269c24,_0xb5cca9){if(_0x269c24[_0x4afc('0x43')]['id']){delete _0x269c24[_0x4afc('0x43')]['id'];}return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x269c24[_0x4afc('0x41')]['id']}})['then'](handleEntityNotFound(_0xb5cca9,null))[_0x4afc('0x25')](saveUpdates(_0x269c24['body'],null))['then'](respondWithResult(_0xb5cca9,null))[_0x4afc('0x3f')](handleError(_0xb5cca9,null));};exports['destroy']=function(_0x428d78,_0x355198){return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x428d78['params']['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x355198,null))['then'](removeEntity(_0x355198,null))[_0x4afc('0x3f')](handleError(_0x355198,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 781a44b..774d8c5 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 _0xe808=['../../config/environment','exports','Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x187dfb,_0x33bfce){var _0x1116df=function(_0x5b5ae6){while(--_0x5b5ae6){_0x187dfb['push'](_0x187dfb['shift']());}};_0x1116df(++_0x33bfce);}(_0xe808,0xd0));var _0x8e80=function(_0xe58478,_0x20668c){_0xe58478=_0xe58478-0x0;var _0xc326b=_0xe808[_0xe58478];return _0xc326b;};'use strict';var _=require(_0x8e80('0x0'));var util=require(_0x8e80('0x1'));var logger=require(_0x8e80('0x2'))(_0x8e80('0x3'));var moment=require(_0x8e80('0x4'));var BPromise=require(_0x8e80('0x5'));var rp=require(_0x8e80('0x6'));var fs=require('fs');var path=require(_0x8e80('0x7'));var rimraf=require('rimraf');var config=require(_0x8e80('0x8'));var attributes=require('./integration.attributes');module[_0x8e80('0x9')]=function(_0xb363d4,_0x1fdff5){return _0xb363d4['define'](_0x8e80('0xa'),attributes,{'tableName':_0x8e80('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a97=['../../config/environment','exports','define','Integration','integrations','lodash','util','api','bluebird','request-promise','rimraf'];(function(_0x2e0afd,_0x1a71f7){var _0x4cefad=function(_0x8f4720){while(--_0x8f4720){_0x2e0afd['push'](_0x2e0afd['shift']());}};_0x4cefad(++_0x1a71f7);}(_0x2a97,0xc0));var _0x72a9=function(_0x34b46f,_0x51c903){_0x34b46f=_0x34b46f-0x0;var _0x2bd653=_0x2a97[_0x34b46f];return _0x2bd653;};'use strict';var _=require(_0x72a9('0x0'));var util=require(_0x72a9('0x1'));var logger=require('../../config/logger')(_0x72a9('0x2'));var moment=require('moment');var BPromise=require(_0x72a9('0x3'));var rp=require(_0x72a9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x72a9('0x5'));var config=require(_0x72a9('0x6'));var attributes=require('./integration.attributes');module[_0x72a9('0x7')]=function(_0x53cb2a,_0x57b90f){return _0x53cb2a[_0x72a9('0x8')](_0x72a9('0x9'),attributes,{'tableName':_0x72a9('0xa'),'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 6e8daed..e039456 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 _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x4975,0x86));var _0x5497=function(_0x34a6de,_0x3e4de7){_0x34a6de=_0x34a6de-0x0;var _0x502c97=_0x4975[_0x34a6de];return _0x502c97;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('Integration,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file +var _0xe2fe=['then','info','Integration,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x269295,_0x496b7f){var _0x2887b0=function(_0x26a10b){while(--_0x26a10b){_0x269295['push'](_0x269295['shift']());}};_0x2887b0(++_0x496b7f);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 5077957..6b1dc06 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 _0xc6ac=['./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1d2e70,_0x144e1f){var _0x4c8a00=function(_0x197ca8){while(--_0x197ca8){_0x1d2e70['push'](_0x1d2e70['shift']());}};_0x4c8a00(++_0x144e1f);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x253f75,_0x21fc1f){_0x253f75=_0x253f75-0x0;var _0x24ddc2=_0xc6ac[_0x253f75];return _0x24ddc2;};'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('0x10'),auth[_0xcc6a('0xc')](),controller['update']);router[_0xcc6a('0x14')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe2fe=['describe','/:id','post','update','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x34a8c8,_0x31e259){var _0x1fe6e5=function(_0x30f28d){while(--_0x30f28d){_0x34a8c8['push'](_0x34a8c8['shift']());}};_0x1fe6e5(++_0x31e259);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./integrationReport.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0xc')]('/',auth[_0xee2f('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xe')]);module[_0xee2f('0xf')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 830fa51..4a2c1da 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 _0x2ce3=['SENDING','RECEIVED','FAILED','sequelize','STRING','INTEGER','DATE','BOOLEAN','TEXT','SENT'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x2ce3,0x125));var _0x32ce=function(_0x9e3f01,_0x54f29b){_0x9e3f01=_0x9e3f01-0x0;var _0x2fb260=_0x2ce3[_0x9e3f01];return _0x2fb260;};'use strict';var Sequelize=require(_0x32ce('0x0'));module['exports']={'integration':{'type':Sequelize[_0x32ce('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x32ce('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x32ce('0x2')]},'contacts':{'type':Sequelize[_0x32ce('0x1')]},'uniqueid':{'type':Sequelize[_0x32ce('0x1')]},'calleridnum':{'type':Sequelize[_0x32ce('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x32ce('0x1')]},'interface':{'type':Sequelize[_0x32ce('0x1')]},'membername':{'type':Sequelize[_0x32ce('0x1')]},'agentcalledAt':{'type':Sequelize[_0x32ce('0x3')]},'agentconnectAt':{'type':Sequelize[_0x32ce('0x3')]},'holdtime':{'type':Sequelize[_0x32ce('0x2')]},'agentcomplete':{'type':Sequelize[_0x32ce('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x32ce('0x2')]},'agentacw':{'type':Sequelize[_0x32ce('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x32ce('0x2')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x32ce('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x32ce('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x32ce('0x1')]},'channel':{'type':Sequelize[_0x32ce('0x1')]},'channelstate':{'type':Sequelize[_0x32ce('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x32ce('0x1')]},'connectedlinename':{'type':Sequelize[_0x32ce('0x1')]},'language':{'type':Sequelize[_0x32ce('0x1')]},'accountcode':{'type':Sequelize[_0x32ce('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x32ce('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x32ce('0x1')]},'destchannelstate':{'type':Sequelize[_0x32ce('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x32ce('0x1')]},'destcalleridnum':{'type':Sequelize[_0x32ce('0x1')]},'destcalleridname':{'type':Sequelize[_0x32ce('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x32ce('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x32ce('0x1')]},'destlanguage':{'type':Sequelize[_0x32ce('0x1')]},'destaccountcode':{'type':Sequelize[_0x32ce('0x1')]},'destcontext':{'type':Sequelize[_0x32ce('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x32ce('0x1')]},'destuniqueid':{'type':Sequelize[_0x32ce('0x1')]},'messageId':{'type':Sequelize[_0x32ce('0x1')]},'inReplyTo':{'type':Sequelize[_0x32ce('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x32ce('0x1')]},'to':{'type':Sequelize[_0x32ce('0x1')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x32ce('0x5')]},'status':{'type':Sequelize['ENUM'](_0x32ce('0x6'),_0x32ce('0x7'),_0x32ce('0x8'),_0x32ce('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x32ce('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x32ce('0x2')]}}; \ No newline at end of file +var _0x093f=['exports','STRING','DATE','INTEGER','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','FAILED','sequelize'];(function(_0x252646,_0x2a0ae2){var _0x55911c=function(_0x3f8314){while(--_0x3f8314){_0x252646['push'](_0x252646['shift']());}};_0x55911c(++_0x2a0ae2);}(_0x093f,0x1c2));var _0xf093=function(_0x2219b3,_0x2c0733){_0x2219b3=_0x2219b3-0x0;var _0x221b09=_0x093f[_0x2219b3];return _0x221b09;};'use strict';var Sequelize=require(_0xf093('0x0'));module[_0xf093('0x1')]={'integration':{'type':Sequelize[_0xf093('0x2')]},'eventChannel':{'type':Sequelize[_0xf093('0x2')]},'exitStatus':{'type':Sequelize[_0xf093('0x2')]},'ticketId':{'type':Sequelize[_0xf093('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xf093('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xf093('0x2')]},'queue':{'type':Sequelize[_0xf093('0x2')]},'interface':{'type':Sequelize[_0xf093('0x2')]},'membername':{'type':Sequelize[_0xf093('0x2')]},'agentcalledAt':{'type':Sequelize[_0xf093('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xf093('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xf093('0x3')]},'talktime':{'type':Sequelize[_0xf093('0x4')]},'agentacw':{'type':Sequelize[_0xf093('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xf093('0x4')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xf093('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xf093('0x3')]},'agentdump':{'type':Sequelize[_0xf093('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xf093('0x2')]},'channel':{'type':Sequelize[_0xf093('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xf093('0x2')]},'connectedlinenum':{'type':Sequelize[_0xf093('0x2')]},'connectedlinename':{'type':Sequelize[_0xf093('0x2')]},'language':{'type':Sequelize[_0xf093('0x2')]},'accountcode':{'type':Sequelize[_0xf093('0x2')]},'context':{'type':Sequelize[_0xf093('0x2')]},'exten':{'type':Sequelize[_0xf093('0x2')]},'priority':{'type':Sequelize[_0xf093('0x2')]},'destchannel':{'type':Sequelize[_0xf093('0x2')]},'destchannelstate':{'type':Sequelize[_0xf093('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xf093('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xf093('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf093('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xf093('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xf093('0x2')]},'destuniqueid':{'type':Sequelize[_0xf093('0x2')]},'messageId':{'type':Sequelize[_0xf093('0x2')]},'inReplyTo':{'type':Sequelize[_0xf093('0x2')]},'subject':{'type':Sequelize[_0xf093('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xf093('0x2')]},'cc':{'type':Sequelize[_0xf093('0x2')]},'attachment':{'type':Sequelize[_0xf093('0x6')]},'html':{'type':Sequelize[_0xf093('0x6')]},'text':{'type':Sequelize[_0xf093('0x6')]},'status':{'type':Sequelize[_0xf093('0x7')]('SENT',_0xf093('0x8'),_0xf093('0x9'),_0xf093('0xa'))},'url':{'type':Sequelize[_0xf093('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xf093('0x2')]},'projectId':{'type':Sequelize[_0xf093('0x4')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index f181e1f..8ad2e78 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 _0xf8ee=['describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','status','end','json','offset','undefined','limit','count','set','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','options','includeAll','include','IntegrationReport','findAll','catch','show','params','merge','find','create','body'];(function(_0x1b8d87,_0x4168fb){var _0x182b74=function(_0x12b570){while(--_0x12b570){_0x1b8d87['push'](_0x1b8d87['shift']());}};_0x182b74(++_0x4168fb);}(_0xf8ee,0xd3));var _0xef8e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf8ee[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xef8e('0x0'));var rimraf=require(_0xef8e('0x1'));var zipdir=require(_0xef8e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef8e('0x3'));var moment=require(_0xef8e('0x4'));var BPromise=require(_0xef8e('0x5'));var Mustache=require('mustache');var util=require(_0xef8e('0x6'));var path=require(_0xef8e('0x7'));var sox=require(_0xef8e('0x8'));var csv=require(_0xef8e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef8e('0xa'));var _=require(_0xef8e('0xb'));var squel=require('squel');var crypto=require(_0xef8e('0xc'));var jsforce=require(_0xef8e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xef8e('0x9'));var querystring=require(_0xef8e('0xe'));var Papa=require(_0xef8e('0xf'));var Redis=require('ioredis');var authService=require(_0xef8e('0x10'));var qs=require(_0xef8e('0x11'));var as=require(_0xef8e('0x12'));var hardwareService=require(_0xef8e('0x13'));var logger=require(_0xef8e('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xef8e('0x15'))['db'];function respondWithStatusCode(_0x559f82,_0x34d03d){_0x34d03d=_0x34d03d||0xcc;return function(_0x9472c5){if(_0x9472c5){return _0x559f82['sendStatus'](_0x34d03d);}return _0x559f82[_0xef8e('0x16')](_0x34d03d)[_0xef8e('0x17')]();};}function respondWithResult(_0x32c851,_0x1ec4e0){_0x1ec4e0=_0x1ec4e0||0xc8;return function(_0x248e48){if(_0x248e48){return _0x32c851[_0xef8e('0x16')](_0x1ec4e0)[_0xef8e('0x18')](_0x248e48);}};}function respondWithFilteredResult(_0xc89e15,_0x529558){return function(_0x529c32){if(_0x529c32){var _0x476d93=typeof _0x529558[_0xef8e('0x19')]===_0xef8e('0x1a')&&typeof _0x529558[_0xef8e('0x1b')]===_0xef8e('0x1a');var _0x22f6ed=_0x529c32[_0xef8e('0x1c')];var _0x51b3fe=_0x476d93?0x0:_0x529558['offset'];var _0x3de4ad=_0x476d93?_0x529c32['count']:_0x529558['offset']+_0x529558[_0xef8e('0x1b')];var _0x14b4bc;if(_0x3de4ad>=_0x22f6ed){_0x3de4ad=_0x22f6ed;_0x14b4bc=0xc8;}else{_0x14b4bc=0xce;}_0xc89e15['status'](_0x14b4bc);return _0xc89e15[_0xef8e('0x1d')]('Content-Range',_0x51b3fe+'-'+_0x3de4ad+'/'+_0x22f6ed)[_0xef8e('0x18')](_0x529c32);}return null;};}function patchUpdates(_0x1d68f6){return function(_0x57c575){try{jsonpatch['apply'](_0x57c575,_0x1d68f6,!![]);}catch(_0x1457c3){return BPromise['reject'](_0x1457c3);}return _0x57c575[_0xef8e('0x1e')]();};}function saveUpdates(_0x1f92c3,_0x21abed){return function(_0x30848c){if(_0x30848c){return _0x30848c[_0xef8e('0x1f')](_0x1f92c3)[_0xef8e('0x20')](function(_0xf38eca){return _0xf38eca;});}return null;};}function removeEntity(_0x48ec86,_0x30cfae){return function(_0x3ef651){if(_0x3ef651){return _0x3ef651[_0xef8e('0x21')]()[_0xef8e('0x20')](function(){_0x48ec86[_0xef8e('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fffdf,_0x1e388a){return function(_0x4c69f0){if(!_0x4c69f0){_0x4fffdf[_0xef8e('0x22')](0x194);}return _0x4c69f0;};}function handleError(_0xb88a56,_0x17d684){_0x17d684=_0x17d684||0x1f4;return function(_0x249889){logger[_0xef8e('0x23')](_0x249889['stack']);if(_0x249889[_0xef8e('0x24')]){delete _0x249889[_0xef8e('0x24')];}_0xb88a56[_0xef8e('0x16')](_0x17d684)[_0xef8e('0x25')](_0x249889);};}exports[_0xef8e('0x26')]=function(_0x4847ee,_0x5284ff){var _0x4df09d={},_0x5c13c5={},_0x5442e5={'count':0x0,'rows':[]};var _0x220eb8=_[_0xef8e('0x27')](db['IntegrationReport'][_0xef8e('0x28')],function(_0x563e60){return{'name':_0x563e60['fieldName'],'type':_0x563e60['type'][_0xef8e('0x29')]};});_0x5c13c5['model']=_[_0xef8e('0x27')](_0x220eb8,'name');_0x5c13c5[_0xef8e('0x2a')]=_[_0xef8e('0x2b')](_0x4847ee[_0xef8e('0x2a')]);_0x5c13c5[_0xef8e('0x2c')]=_[_0xef8e('0x2d')](_0x5c13c5[_0xef8e('0x2e')],_0x5c13c5[_0xef8e('0x2a')]);_0x4df09d['attributes']=_[_0xef8e('0x2d')](_0x5c13c5['model'],qs[_0xef8e('0x2f')](_0x4847ee[_0xef8e('0x2a')][_0xef8e('0x2f')]));_0x4df09d[_0xef8e('0x30')]=_0x4df09d[_0xef8e('0x30')][_0xef8e('0x31')]?_0x4df09d[_0xef8e('0x30')]:_0x5c13c5[_0xef8e('0x2e')];if(!_0x4847ee[_0xef8e('0x2a')][_0xef8e('0x32')](_0xef8e('0x33'))){_0x4df09d['limit']=qs[_0xef8e('0x1b')](_0x4847ee[_0xef8e('0x2a')][_0xef8e('0x1b')]);_0x4df09d['offset']=qs[_0xef8e('0x19')](_0x4847ee['query'][_0xef8e('0x19')]);}_0x4df09d[_0xef8e('0x34')]=qs['sort'](_0x4847ee[_0xef8e('0x2a')]['sort']);_0x4df09d[_0xef8e('0x35')]=qs[_0xef8e('0x2c')](_[_0xef8e('0x36')](_0x4847ee['query'],_0x5c13c5[_0xef8e('0x2c')]),_0x220eb8);if(_0x4847ee[_0xef8e('0x2a')][_0xef8e('0x37')]){_0x4df09d[_0xef8e('0x35')]=_['merge'](_0x4df09d['where'],{'$or':_[_0xef8e('0x27')](_0x220eb8,function(_0x1f1030){if(_0x1f1030['type']!==_0xef8e('0x38')){var _0x239544={};_0x239544[_0x1f1030[_0xef8e('0x24')]]={'$like':'%'+_0x4847ee['query'][_0xef8e('0x37')]+'%'};return _0x239544;}})});}_0x4df09d=_['merge']({},_0x4df09d,_0x4847ee[_0xef8e('0x39')]);var _0x58590b={'where':_0x4df09d[_0xef8e('0x35')]};return db['IntegrationReport'][_0xef8e('0x1c')](_0x58590b)[_0xef8e('0x20')](function(_0x9a8d73){_0x5442e5[_0xef8e('0x1c')]=_0x9a8d73;if(_0x4847ee[_0xef8e('0x2a')][_0xef8e('0x3a')]){_0x4df09d[_0xef8e('0x3b')]=[{'all':!![]}];}return db[_0xef8e('0x3c')][_0xef8e('0x3d')](_0x4df09d);})[_0xef8e('0x20')](function(_0x35d75f){_0x5442e5['rows']=_0x35d75f;return _0x5442e5;})[_0xef8e('0x20')](respondWithFilteredResult(_0x5284ff,_0x4df09d))[_0xef8e('0x3e')](handleError(_0x5284ff,null));};exports[_0xef8e('0x3f')]=function(_0x551908,_0x40b415){var _0x4a00a6={'raw':![],'where':{'id':_0x551908[_0xef8e('0x40')]['id']}},_0x3fa977={};_0x3fa977[_0xef8e('0x2e')]=_[_0xef8e('0x2b')](db[_0xef8e('0x3c')]['rawAttributes']);_0x3fa977[_0xef8e('0x2a')]=_['keys'](_0x551908[_0xef8e('0x2a')]);_0x3fa977[_0xef8e('0x2c')]=_[_0xef8e('0x2d')](_0x3fa977[_0xef8e('0x2e')],_0x3fa977['query']);_0x4a00a6['attributes']=_['intersection'](_0x3fa977[_0xef8e('0x2e')],qs[_0xef8e('0x2f')](_0x551908[_0xef8e('0x2a')][_0xef8e('0x2f')]));_0x4a00a6[_0xef8e('0x30')]=_0x4a00a6[_0xef8e('0x30')][_0xef8e('0x31')]?_0x4a00a6[_0xef8e('0x30')]:_0x3fa977['model'];if(_0x551908['query'][_0xef8e('0x3a')]){_0x4a00a6[_0xef8e('0x3b')]=[{'all':!![]}];}_0x4a00a6=_[_0xef8e('0x41')]({},_0x4a00a6,_0x551908[_0xef8e('0x39')]);return db[_0xef8e('0x3c')][_0xef8e('0x42')](_0x4a00a6)[_0xef8e('0x20')](handleEntityNotFound(_0x40b415,null))[_0xef8e('0x20')](respondWithResult(_0x40b415,null))[_0xef8e('0x3e')](handleError(_0x40b415,null));};exports['create']=function(_0x17363c,_0x28e616){return db['IntegrationReport'][_0xef8e('0x43')](_0x17363c[_0xef8e('0x44')],{})['then'](respondWithResult(_0x28e616,0xc9))[_0xef8e('0x3e')](handleError(_0x28e616,null));};exports[_0xef8e('0x1f')]=function(_0x22670f,_0x299edf){if(_0x22670f[_0xef8e('0x44')]['id']){delete _0x22670f['body']['id'];}return db['IntegrationReport'][_0xef8e('0x42')]({'where':{'id':_0x22670f[_0xef8e('0x40')]['id']}})[_0xef8e('0x20')](handleEntityNotFound(_0x299edf,null))['then'](saveUpdates(_0x22670f['body'],null))[_0xef8e('0x20')](respondWithResult(_0x299edf,null))[_0xef8e('0x3e')](handleError(_0x299edf,null));};exports[_0xef8e('0x21')]=function(_0x4cac7e,_0x508406){return db[_0xef8e('0x3c')][_0xef8e('0x42')]({'where':{'id':_0x4cac7e[_0xef8e('0x40')]['id']}})[_0xef8e('0x20')](handleEntityNotFound(_0x508406,null))[_0xef8e('0x20')](removeEntity(_0x508406,null))[_0xef8e('0x3e')](handleError(_0x508406,null));};exports[_0xef8e('0x45')]=function(_0x13e720,_0x17271f){return db[_0xef8e('0x3c')]['describe']()[_0xef8e('0x20')](respondWithResult(_0x17271f,null))[_0xef8e('0x3e')](handleError(_0x17271f,null));}; \ No newline at end of file +var _0xda06=['filter','VIRTUAL','merge','options','IntegrationReport','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','reject','save','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick'];(function(_0x18d466,_0x26a30a){var _0x368767=function(_0x1402d1){while(--_0x1402d1){_0x18d466['push'](_0x18d466['shift']());}};_0x368767(++_0x26a30a);}(_0xda06,0x142));var _0x6da0=function(_0x3f37a0,_0x4f5821){_0x3f37a0=_0x3f37a0-0x0;var _0x1c5626=_0xda06[_0x3f37a0];return _0x1c5626;};'use strict';var emlformat=require(_0x6da0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6da0('0x1'));var jsonpatch=require(_0x6da0('0x2'));var rp=require(_0x6da0('0x3'));var moment=require('moment');var BPromise=require(_0x6da0('0x4'));var Mustache=require(_0x6da0('0x5'));var util=require(_0x6da0('0x6'));var path=require(_0x6da0('0x7'));var sox=require(_0x6da0('0x8'));var csv=require(_0x6da0('0x9'));var ejs=require(_0x6da0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6da0('0xb'));var squel=require(_0x6da0('0xc'));var crypto=require(_0x6da0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6da0('0xe'));var toCsv=require(_0x6da0('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6da0('0xf'));var authService=require(_0x6da0('0x10'));var qs=require(_0x6da0('0x11'));var as=require(_0x6da0('0x12'));var hardwareService=require(_0x6da0('0x13'));var logger=require(_0x6da0('0x14'))(_0x6da0('0x15'));var utils=require('../../config/utils');var config=require(_0x6da0('0x16'));var licenseUtil=require(_0x6da0('0x17'));var db=require(_0x6da0('0x18'))['db'];function respondWithStatusCode(_0x24397f,_0x2a7394){_0x2a7394=_0x2a7394||0xcc;return function(_0x2eceb4){if(_0x2eceb4){return _0x24397f[_0x6da0('0x19')](_0x2a7394);}return _0x24397f[_0x6da0('0x1a')](_0x2a7394)[_0x6da0('0x1b')]();};}function respondWithResult(_0xd8930a,_0x345765){_0x345765=_0x345765||0xc8;return function(_0x1b7edd){if(_0x1b7edd){return _0xd8930a['status'](_0x345765)['json'](_0x1b7edd);}};}function respondWithFilteredResult(_0xb7eb8c,_0x7d8371){return function(_0x27efea){if(_0x27efea){var _0x14678d=typeof _0x7d8371[_0x6da0('0x1c')]===_0x6da0('0x1d')&&typeof _0x7d8371['limit']===_0x6da0('0x1d');var _0x605f12=_0x27efea[_0x6da0('0x1e')];var _0x234fec=_0x14678d?0x0:_0x7d8371['offset'];var _0x2d2540=_0x14678d?_0x27efea[_0x6da0('0x1e')]:_0x7d8371[_0x6da0('0x1c')]+_0x7d8371[_0x6da0('0x1f')];var _0x2dbd2a;if(_0x2d2540>=_0x605f12){_0x2d2540=_0x605f12;_0x2dbd2a=0xc8;}else{_0x2dbd2a=0xce;}_0xb7eb8c[_0x6da0('0x1a')](_0x2dbd2a);return _0xb7eb8c['set'](_0x6da0('0x20'),_0x234fec+'-'+_0x2d2540+'/'+_0x605f12)['json'](_0x27efea);}return null;};}function patchUpdates(_0x15d950){return function(_0x67718d){try{jsonpatch['apply'](_0x67718d,_0x15d950,!![]);}catch(_0x307d8c){return BPromise[_0x6da0('0x21')](_0x307d8c);}return _0x67718d[_0x6da0('0x22')]();};}function saveUpdates(_0x4c3074,_0xca3823){return function(_0x234067){if(_0x234067){return _0x234067[_0x6da0('0x23')](_0x4c3074)[_0x6da0('0x24')](function(_0x1695fa){return _0x1695fa;});}return null;};}function removeEntity(_0x49e865,_0x4a0a89){return function(_0x20b913){if(_0x20b913){return _0x20b913['destroy']()[_0x6da0('0x24')](function(){_0x49e865[_0x6da0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f6ce8,_0x553852){return function(_0x34bd85){if(!_0x34bd85){_0x4f6ce8[_0x6da0('0x19')](0x194);}return _0x34bd85;};}function handleError(_0x43da14,_0x354af8){_0x354af8=_0x354af8||0x1f4;return function(_0x4f742a){logger[_0x6da0('0x25')](_0x4f742a[_0x6da0('0x26')]);if(_0x4f742a[_0x6da0('0x27')]){delete _0x4f742a[_0x6da0('0x27')];}_0x43da14['status'](_0x354af8)[_0x6da0('0x28')](_0x4f742a);};}exports[_0x6da0('0x29')]=function(_0x1cb4d4,_0x5627d8){var _0x5c341b={},_0xf44009={},_0x2e164e={'count':0x0,'rows':[]};var _0x210251=_['map'](db['IntegrationReport'][_0x6da0('0x2a')],function(_0x303a0b){return{'name':_0x303a0b[_0x6da0('0x2b')],'type':_0x303a0b[_0x6da0('0x2c')][_0x6da0('0x2d')]};});_0xf44009[_0x6da0('0x2e')]=_[_0x6da0('0x2f')](_0x210251,_0x6da0('0x27'));_0xf44009[_0x6da0('0x30')]=_['keys'](_0x1cb4d4[_0x6da0('0x30')]);_0xf44009[_0x6da0('0x31')]=_['intersection'](_0xf44009[_0x6da0('0x2e')],_0xf44009[_0x6da0('0x30')]);_0x5c341b['attributes']=_[_0x6da0('0x32')](_0xf44009[_0x6da0('0x2e')],qs[_0x6da0('0x33')](_0x1cb4d4[_0x6da0('0x30')][_0x6da0('0x33')]));_0x5c341b['attributes']=_0x5c341b[_0x6da0('0x34')][_0x6da0('0x35')]?_0x5c341b['attributes']:_0xf44009[_0x6da0('0x2e')];if(!_0x1cb4d4[_0x6da0('0x30')]['hasOwnProperty'](_0x6da0('0x36'))){_0x5c341b[_0x6da0('0x1f')]=qs[_0x6da0('0x1f')](_0x1cb4d4[_0x6da0('0x30')]['limit']);_0x5c341b[_0x6da0('0x1c')]=qs['offset'](_0x1cb4d4[_0x6da0('0x30')][_0x6da0('0x1c')]);}_0x5c341b['order']=qs[_0x6da0('0x37')](_0x1cb4d4[_0x6da0('0x30')][_0x6da0('0x37')]);_0x5c341b[_0x6da0('0x38')]=qs['filters'](_[_0x6da0('0x39')](_0x1cb4d4[_0x6da0('0x30')],_0xf44009[_0x6da0('0x31')]),_0x210251);if(_0x1cb4d4[_0x6da0('0x30')][_0x6da0('0x3a')]){_0x5c341b[_0x6da0('0x38')]=_['merge'](_0x5c341b['where'],{'$or':_[_0x6da0('0x2f')](_0x210251,function(_0x5e0c83){if(_0x5e0c83[_0x6da0('0x2c')]!==_0x6da0('0x3b')){var _0x4e7a60={};_0x4e7a60[_0x5e0c83[_0x6da0('0x27')]]={'$like':'%'+_0x1cb4d4[_0x6da0('0x30')][_0x6da0('0x3a')]+'%'};return _0x4e7a60;}})});}_0x5c341b=_[_0x6da0('0x3c')]({},_0x5c341b,_0x1cb4d4[_0x6da0('0x3d')]);var _0x5a22da={'where':_0x5c341b[_0x6da0('0x38')]};return db[_0x6da0('0x3e')]['count'](_0x5a22da)[_0x6da0('0x24')](function(_0x1c828d){_0x2e164e['count']=_0x1c828d;if(_0x1cb4d4[_0x6da0('0x30')][_0x6da0('0x3f')]){_0x5c341b[_0x6da0('0x40')]=[{'all':!![]}];}return db['IntegrationReport'][_0x6da0('0x41')](_0x5c341b);})['then'](function(_0x296b9d){_0x2e164e[_0x6da0('0x42')]=_0x296b9d;return _0x2e164e;})[_0x6da0('0x24')](respondWithFilteredResult(_0x5627d8,_0x5c341b))[_0x6da0('0x43')](handleError(_0x5627d8,null));};exports[_0x6da0('0x44')]=function(_0x246b28,_0x2728ac){var _0x3605f5={'raw':![],'where':{'id':_0x246b28[_0x6da0('0x45')]['id']}},_0x515fd2={};_0x515fd2[_0x6da0('0x2e')]=_['keys'](db[_0x6da0('0x3e')][_0x6da0('0x2a')]);_0x515fd2[_0x6da0('0x30')]=_[_0x6da0('0x46')](_0x246b28[_0x6da0('0x30')]);_0x515fd2[_0x6da0('0x31')]=_['intersection'](_0x515fd2[_0x6da0('0x2e')],_0x515fd2[_0x6da0('0x30')]);_0x3605f5[_0x6da0('0x34')]=_[_0x6da0('0x32')](_0x515fd2['model'],qs['fields'](_0x246b28[_0x6da0('0x30')][_0x6da0('0x33')]));_0x3605f5['attributes']=_0x3605f5[_0x6da0('0x34')][_0x6da0('0x35')]?_0x3605f5[_0x6da0('0x34')]:_0x515fd2[_0x6da0('0x2e')];if(_0x246b28[_0x6da0('0x30')][_0x6da0('0x3f')]){_0x3605f5[_0x6da0('0x40')]=[{'all':!![]}];}_0x3605f5=_[_0x6da0('0x3c')]({},_0x3605f5,_0x246b28[_0x6da0('0x3d')]);return db[_0x6da0('0x3e')]['find'](_0x3605f5)['then'](handleEntityNotFound(_0x2728ac,null))[_0x6da0('0x24')](respondWithResult(_0x2728ac,null))['catch'](handleError(_0x2728ac,null));};exports[_0x6da0('0x47')]=function(_0x1453f6,_0xc03b0a){return db[_0x6da0('0x3e')][_0x6da0('0x47')](_0x1453f6['body'],{})[_0x6da0('0x24')](respondWithResult(_0xc03b0a,0xc9))[_0x6da0('0x43')](handleError(_0xc03b0a,null));};exports[_0x6da0('0x23')]=function(_0x12cb9d,_0x56c26a){if(_0x12cb9d[_0x6da0('0x48')]['id']){delete _0x12cb9d['body']['id'];}return db[_0x6da0('0x3e')][_0x6da0('0x49')]({'where':{'id':_0x12cb9d[_0x6da0('0x45')]['id']}})[_0x6da0('0x24')](handleEntityNotFound(_0x56c26a,null))[_0x6da0('0x24')](saveUpdates(_0x12cb9d[_0x6da0('0x48')],null))['then'](respondWithResult(_0x56c26a,null))[_0x6da0('0x43')](handleError(_0x56c26a,null));};exports[_0x6da0('0x4a')]=function(_0x57b8f2,_0x2ce5a6){return db['IntegrationReport']['find']({'where':{'id':_0x57b8f2[_0x6da0('0x45')]['id']}})[_0x6da0('0x24')](handleEntityNotFound(_0x2ce5a6,null))[_0x6da0('0x24')](removeEntity(_0x2ce5a6,null))[_0x6da0('0x43')](handleError(_0x2ce5a6,null));};exports[_0x6da0('0x4b')]=function(_0x5228cf,_0x3ed3f6){return db[_0x6da0('0x3e')][_0x6da0('0x4b')]()[_0x6da0('0x24')](respondWithResult(_0x3ed3f6,null))['catch'](handleError(_0x3ed3f6,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 6e734df..e8ac282 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 _0x9bcc=['rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','api','request-promise','path'];(function(_0x5e9aa2,_0xd197ca){var _0xc42277=function(_0xbda71a){while(--_0xbda71a){_0x5e9aa2['push'](_0x5e9aa2['shift']());}};_0xc42277(++_0xd197ca);}(_0x9bcc,0xbb));var _0xc9bc=function(_0x44e333,_0x586055){_0x44e333=_0x44e333-0x0;var _0x4c8d19=_0x9bcc[_0x44e333];return _0x4c8d19;};'use strict';var _=require(_0xc9bc('0x0'));var util=require(_0xc9bc('0x1'));var logger=require('../../config/logger')(_0xc9bc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc9bc('0x3'));var fs=require('fs');var path=require(_0xc9bc('0x4'));var rimraf=require(_0xc9bc('0x5'));var config=require(_0xc9bc('0x6'));var attributes=require(_0xc9bc('0x7'));module[_0xc9bc('0x8')]=function(_0x26d311,_0x189bc6){return _0x26d311[_0xc9bc('0x9')](_0xc9bc('0xa'),attributes,{'tableName':_0xc9bc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9757=['../../config/logger','moment','request-promise','define','lodash'];(function(_0x57ede0,_0x2c5e8c){var _0x60056=function(_0x588cd2){while(--_0x588cd2){_0x57ede0['push'](_0x57ede0['shift']());}};_0x60056(++_0x2c5e8c);}(_0x9757,0x15d));var _0x7975=function(_0x2b1c47,_0x447d38){_0x2b1c47=_0x2b1c47-0x0;var _0x25f7ce=_0x9757[_0x2b1c47];return _0x25f7ce;};'use strict';var _=require(_0x7975('0x0'));var util=require('util');var logger=require(_0x7975('0x1'))('api');var moment=require(_0x7975('0x2'));var BPromise=require('bluebird');var rp=require(_0x7975('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module['exports']=function(_0x237f55,_0x54e29a){return _0x237f55[_0x7975('0x4')]('IntegrationReport',attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 7618d08..fae643a 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x31f0=['../../config/environment','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0xd28119,_0x2a8097){var _0x418b38=function(_0x331d0e){while(--_0x331d0e){_0xd28119['push'](_0xd28119['shift']());}};_0x418b38(++_0x2a8097);}(_0x31f0,0xb7));var _0x031f=function(_0x38d0ae,_0x3fd572){_0x38d0ae=_0x38d0ae-0x0;var _0x470c14=_0x31f0[_0x38d0ae];return _0x470c14;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var moment=require(_0x031f('0x1'));var BPromise=require('bluebird');var rs=require(_0x031f('0x2'));var fs=require('fs');var Redis=require(_0x031f('0x3'));var db=require(_0x031f('0x4'))['db'];var utils=require(_0x031f('0x5'));var logger=require('../../config/logger')(_0x031f('0x6'));var config=require(_0x031f('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dc98e,_0x487e65,_0x365f59){return new BPromise(function(_0x4300b4,_0x2569b6){return client[_0x031f('0x8')](_0x3dc98e,_0x365f59)['then'](function(_0x2e5624){logger[_0x031f('0x9')](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));logger[_0x031f('0xc')](_0x031f('0xd'),_0x487e65,_0x031f('0xb'),JSON[_0x031f('0xe')](_0x2e5624));if(_0x2e5624['error']){if(_0x2e5624[_0x031f('0xf')][_0x031f('0x10')]===0x1f4){logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x2569b6(_0x2e5624[_0x031f('0xf')]['message']);}logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x4300b4(_0x2e5624[_0x031f('0xf')]['message']);}else{logger['info'](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));_0x4300b4(_0x2e5624[_0x031f('0x12')][_0x031f('0x11')]);}})['catch'](function(_0x1dc4a7){logger[_0x031f('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x487e65,_0x1dc4a7);_0x2569b6(_0x1dc4a7);});});} \ No newline at end of file +var _0x0295=['client','http','then','info','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','IntegrationReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x34dcc4,_0x5affdb){var _0x2cc531=function(_0x36c323){while(--_0x36c323){_0x34dcc4['push'](_0x34dcc4['shift']());}};_0x2cc531(++_0x5affdb);}(_0x0295,0x1f0));var _0x5029=function(_0x1d1967,_0x52b368){_0x1d1967=_0x1d1967-0x0;var _0x5d6ce0=_0x0295[_0x1d1967];return _0x5d6ce0;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('IntegrationReport,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 9e41627..bf91f6f 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 _0x3f1c=['get','/:id','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','put','update','delete','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','isAuthenticated'];(function(_0x16e569,_0x33f836){var _0x22470a=function(_0x4b7c33){while(--_0x4b7c33){_0x16e569['push'](_0x16e569['shift']());}};_0x22470a(++_0x33f836);}(_0x3f1c,0xd4));var _0xc3f1=function(_0x14c077,_0x30af9f){_0x14c077=_0x14c077-0x0;var _0x3c5f46=_0x3f1c[_0x14c077];return _0x3c5f46;};'use strict';var multer=require(_0xc3f1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc3f1('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc3f1('0x2'));var auth=require(_0xc3f1('0x3'));var interaction=require(_0xc3f1('0x4'));var config=require(_0xc3f1('0x5'));var controller=require(_0xc3f1('0x6'));router['get']('/',auth[_0xc3f1('0x7')](),controller['index']);router[_0xc3f1('0x8')](_0xc3f1('0x9'),auth[_0xc3f1('0x7')](),controller['show']);router['get'](_0xc3f1('0xa'),auth['isAuthenticated'](),controller[_0xc3f1('0xb')]);router[_0xc3f1('0xc')]('/',auth[_0xc3f1('0x7')](),controller[_0xc3f1('0xd')]);router['post'](_0xc3f1('0xa'),auth['isAuthenticated'](),controller[_0xc3f1('0xe')]);router['post'](_0xc3f1('0xf'),auth['isAuthenticated'](),controller['addIntervals']);router[_0xc3f1('0x10')](_0xc3f1('0x9'),auth[_0xc3f1('0x7')](),controller[_0xc3f1('0x11')]);router[_0xc3f1('0x12')](_0xc3f1('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xc3f1('0x13')]=router; \ No newline at end of file +var _0x4b66=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','show','/:id/sub_intervals','getIntervals','create','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','/:id','update','delete','destroy','exports'];(function(_0x373cca,_0xa65ffe){var _0x214dfe=function(_0x158256){while(--_0x158256){_0x373cca['push'](_0x373cca['shift']());}};_0x214dfe(++_0xa65ffe);}(_0x4b66,0x1dc));var _0x64b6=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4b66[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x64b6('0x0'));var util=require(_0x64b6('0x1'));var path=require(_0x64b6('0x2'));var timeout=require(_0x64b6('0x3'));var express=require(_0x64b6('0x4'));var router=express[_0x64b6('0x5')]();var fs_extra=require(_0x64b6('0x6'));var auth=require(_0x64b6('0x7'));var interaction=require(_0x64b6('0x8'));var config=require(_0x64b6('0x9'));var controller=require(_0x64b6('0xa'));router[_0x64b6('0xb')]('/',auth[_0x64b6('0xc')](),controller[_0x64b6('0xd')]);router[_0x64b6('0xb')]('/:id',auth[_0x64b6('0xc')](),controller[_0x64b6('0xe')]);router[_0x64b6('0xb')](_0x64b6('0xf'),auth['isAuthenticated'](),controller[_0x64b6('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x64b6('0x11')]);router[_0x64b6('0x12')](_0x64b6('0xf'),auth[_0x64b6('0xc')](),controller[_0x64b6('0x13')]);router[_0x64b6('0x12')](_0x64b6('0x14'),auth['isAuthenticated'](),controller[_0x64b6('0x15')]);router[_0x64b6('0x16')](_0x64b6('0x17'),auth['isAuthenticated'](),controller[_0x64b6('0x18')]);router[_0x64b6('0x19')](_0x64b6('0x17'),auth[_0x64b6('0xc')](),controller[_0x64b6('0x1a')]);module[_0x64b6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 5f62753..48d23ba 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 _0xb173=['sequelize','exports','STRING'];(function(_0x204ef2,_0x571b13){var _0x1dd0ca=function(_0x414a51){while(--_0x414a51){_0x204ef2['push'](_0x204ef2['shift']());}};_0x1dd0ca(++_0x571b13);}(_0xb173,0x93));var _0x3b17=function(_0x384047,_0x3ce278){_0x384047=_0x384047-0x0;var _0x43bf57=_0xb173[_0x384047];return _0x43bf57;};'use strict';var Sequelize=require(_0x3b17('0x0'));module[_0x3b17('0x1')]={'name':{'type':Sequelize[_0x3b17('0x2')]},'description':{'type':Sequelize[_0x3b17('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xebbe=['exports','STRING','sequelize'];(function(_0x5b7d4d,_0xa76429){var _0x31eba2=function(_0x30e7d5){while(--_0x30e7d5){_0x5b7d4d['push'](_0x5b7d4d['shift']());}};_0x31eba2(++_0xa76429);}(_0xebbe,0x110));var _0xeebb=function(_0x3c3651,_0x4fe66a){_0x3c3651=_0x3c3651-0x0;var _0x4995d0=_0xebbe[_0x3c3651];return _0x4995d0;};'use strict';var Sequelize=require(_0xeebb('0x0'));module[_0xeebb('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xeebb('0x2')]},'interval':{'type':Sequelize[_0xeebb('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 1a6c910..47c71eb 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 _0x042b=['../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','Intervals','UserProfileResource','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','intersection','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','catch','addInterval','IntervalId','getIntervals','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0x042b,0xfa));var _0xb042=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x042b[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0xb042('0x0'));var rimraf=require(_0xb042('0x1'));var zipdir=require(_0xb042('0x2'));var jsonpatch=require(_0xb042('0x3'));var rp=require(_0xb042('0x4'));var moment=require('moment');var BPromise=require(_0xb042('0x5'));var Mustache=require('mustache');var util=require(_0xb042('0x6'));var path=require(_0xb042('0x7'));var sox=require(_0xb042('0x8'));var csv=require(_0xb042('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb042('0xa'));var _=require(_0xb042('0xb'));var squel=require(_0xb042('0xc'));var crypto=require(_0xb042('0xd'));var jsforce=require(_0xb042('0xe'));var deskjs=require(_0xb042('0xf'));var toCsv=require(_0xb042('0x9'));var querystring=require(_0xb042('0x10'));var Papa=require(_0xb042('0x11'));var Redis=require(_0xb042('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb042('0x13'));var as=require(_0xb042('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb042('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb042('0x16'));var db=require('../../mysqldb')['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x51f2c9,_0x45b67b){_0x45b67b=_0x45b67b||0xcc;return function(_0xb73023){if(_0xb73023){return _0x51f2c9[_0xb042('0x17')](_0x45b67b);}return _0x51f2c9[_0xb042('0x18')](_0x45b67b)[_0xb042('0x19')]();};}function respondWithResult(_0x508ef9,_0x115204){_0x115204=_0x115204||0xc8;return function(_0x2083ad){if(_0x2083ad){return _0x508ef9['status'](_0x115204)[_0xb042('0x1a')](_0x2083ad);}};}function respondWithFilteredResult(_0x367d07,_0x3cf495){return function(_0x6fbf5f){if(_0x6fbf5f){var _0x20c68d=typeof _0x3cf495[_0xb042('0x1b')]===_0xb042('0x1c')&&typeof _0x3cf495[_0xb042('0x1d')]==='undefined';var _0x4541a9=_0x6fbf5f['count'];var _0x26a70b=_0x20c68d?0x0:_0x3cf495[_0xb042('0x1b')];var _0x42ea9f=_0x20c68d?_0x6fbf5f[_0xb042('0x1e')]:_0x3cf495[_0xb042('0x1b')]+_0x3cf495[_0xb042('0x1d')];var _0x4eb2c4;if(_0x42ea9f>=_0x4541a9){_0x42ea9f=_0x4541a9;_0x4eb2c4=0xc8;}else{_0x4eb2c4=0xce;}_0x367d07[_0xb042('0x18')](_0x4eb2c4);return _0x367d07[_0xb042('0x1f')](_0xb042('0x20'),_0x26a70b+'-'+_0x42ea9f+'/'+_0x4541a9)[_0xb042('0x1a')](_0x6fbf5f);}return null;};}function patchUpdates(_0x3fda80){return function(_0xef0446){try{jsonpatch[_0xb042('0x21')](_0xef0446,_0x3fda80,!![]);}catch(_0x28a3ee){return BPromise[_0xb042('0x22')](_0x28a3ee);}return _0xef0446[_0xb042('0x23')]();};}function saveUpdates(_0x3e8d3f,_0x519535){return function(_0x3f7243){if(_0x3f7243){return _0x3f7243['update'](_0x3e8d3f)[_0xb042('0x24')](function(_0x45577b){return _0x45577b;});}return null;};}function removeEntity(_0x599f8e,_0x212ba3){return function(_0xaf11e3){if(_0xaf11e3){return _0xaf11e3[_0xb042('0x25')]()['then'](function(){var _0x176e5f=_0xaf11e3[_0xb042('0x26')]({'plain':!![]});var _0x27ed77=_0xb042('0x27');return db[_0xb042('0x28')][_0xb042('0x25')]({'where':{'type':_0x27ed77,'resourceId':_0x176e5f['id']}})[_0xb042('0x24')](function(){return _0xaf11e3;});})['then'](function(){_0x599f8e[_0xb042('0x18')](0xcc)[_0xb042('0x19')]();});}};}function handleEntityNotFound(_0x57c3d7,_0x21f414){return function(_0x1fda00){if(!_0x1fda00){_0x57c3d7['sendStatus'](0x194);}return _0x1fda00;};}function handleError(_0x4d5e7f,_0xba8d6e){_0xba8d6e=_0xba8d6e||0x1f4;return function(_0x2f0b8e){logger[_0xb042('0x29')](_0x2f0b8e[_0xb042('0x2a')]);if(_0x2f0b8e[_0xb042('0x2b')]){delete _0x2f0b8e[_0xb042('0x2b')];}_0x4d5e7f['status'](_0xba8d6e)[_0xb042('0x2c')](_0x2f0b8e);};}exports[_0xb042('0x2d')]=function(_0x3df4ef,_0x4cbef4){var _0xbcbf4c={},_0x53aed9={},_0x23f70b={'count':0x0,'rows':[]};var _0x251c51=_[_0xb042('0x2e')](db[_0xb042('0x2f')][_0xb042('0x30')],function(_0x318a79){return{'name':_0x318a79[_0xb042('0x31')],'type':_0x318a79[_0xb042('0x32')][_0xb042('0x33')]};});_0x53aed9[_0xb042('0x34')]=_[_0xb042('0x2e')](_0x251c51,'name');_0x53aed9[_0xb042('0x35')]=_[_0xb042('0x36')](_0x3df4ef[_0xb042('0x35')]);_0x53aed9['filters']=_['intersection'](_0x53aed9['model'],_0x53aed9[_0xb042('0x35')]);_0xbcbf4c[_0xb042('0x37')]=_['intersection'](_0x53aed9[_0xb042('0x34')],qs['fields'](_0x3df4ef[_0xb042('0x35')][_0xb042('0x38')]));_0xbcbf4c[_0xb042('0x37')]=_0xbcbf4c[_0xb042('0x37')][_0xb042('0x39')]?_0xbcbf4c[_0xb042('0x37')]:_0x53aed9[_0xb042('0x34')];if(!_0x3df4ef[_0xb042('0x35')][_0xb042('0x3a')](_0xb042('0x3b'))){_0xbcbf4c[_0xb042('0x1d')]=qs[_0xb042('0x1d')](_0x3df4ef['query'][_0xb042('0x1d')]);_0xbcbf4c[_0xb042('0x1b')]=qs[_0xb042('0x1b')](_0x3df4ef['query'][_0xb042('0x1b')]);}_0xbcbf4c[_0xb042('0x3c')]=qs[_0xb042('0x3d')](_0x3df4ef['query'][_0xb042('0x3d')]);_0xbcbf4c[_0xb042('0x3e')]=qs[_0xb042('0x3f')](_[_0xb042('0x40')](_0x3df4ef[_0xb042('0x35')],_0x53aed9[_0xb042('0x3f')]),_0x251c51);if(_0x3df4ef[_0xb042('0x35')][_0xb042('0x41')]){_0xbcbf4c[_0xb042('0x3e')]=_['merge'](_0xbcbf4c[_0xb042('0x3e')],{'$or':_['map'](_0x251c51,function(_0x1859d8){if(_0x1859d8['type']!==_0xb042('0x42')){var _0x62e94c={};_0x62e94c[_0x1859d8['name']]={'$like':'%'+_0x3df4ef['query'][_0xb042('0x41')]+'%'};return _0x62e94c;}})});}_0xbcbf4c=_[_0xb042('0x43')]({},_0xbcbf4c,_0x3df4ef[_0xb042('0x44')]);var _0x4621d8={'where':_0xbcbf4c[_0xb042('0x3e')]};return db[_0xb042('0x2f')][_0xb042('0x1e')](_0x4621d8)[_0xb042('0x24')](function(_0x518947){_0x23f70b[_0xb042('0x1e')]=_0x518947;if(_0x3df4ef[_0xb042('0x35')][_0xb042('0x45')]){_0xbcbf4c[_0xb042('0x46')]=[{'all':!![]}];}return db[_0xb042('0x2f')][_0xb042('0x47')](_0xbcbf4c);})['then'](function(_0x271771){_0x23f70b[_0xb042('0x48')]=_0x271771;return _0x23f70b;})[_0xb042('0x24')](respondWithFilteredResult(_0x4cbef4,_0xbcbf4c))['catch'](handleError(_0x4cbef4,null));};exports[_0xb042('0x49')]=function(_0x406cf8,_0x513e62){var _0x440b41={'raw':!![],'where':{'id':_0x406cf8[_0xb042('0x4a')]['id']}},_0x4f7c60={};_0x4f7c60['model']=_[_0xb042('0x36')](db['Interval'][_0xb042('0x30')]);_0x4f7c60[_0xb042('0x35')]=_[_0xb042('0x36')](_0x406cf8[_0xb042('0x35')]);_0x4f7c60['filters']=_[_0xb042('0x4b')](_0x4f7c60[_0xb042('0x34')],_0x4f7c60['query']);_0x440b41['attributes']=_[_0xb042('0x4b')](_0x4f7c60[_0xb042('0x34')],qs[_0xb042('0x38')](_0x406cf8[_0xb042('0x35')][_0xb042('0x38')]));_0x440b41[_0xb042('0x37')]=_0x440b41[_0xb042('0x37')][_0xb042('0x39')]?_0x440b41['attributes']:_0x4f7c60['model'];if(_0x406cf8[_0xb042('0x35')]['includeAll']){_0x440b41['include']=[{'all':!![]}];}_0x440b41=_[_0xb042('0x43')]({},_0x440b41,_0x406cf8[_0xb042('0x44')]);return db[_0xb042('0x2f')]['find'](_0x440b41)['then'](handleEntityNotFound(_0x513e62,null))[_0xb042('0x24')](respondWithResult(_0x513e62,null))['catch'](handleError(_0x513e62,null));};exports[_0xb042('0x4c')]=function(_0x283164,_0x2b7db5){return db[_0xb042('0x2f')][_0xb042('0x4c')](_0x283164[_0xb042('0x4d')],{})[_0xb042('0x24')](function(_0x5e2e1e){var _0x320a22=_0x283164['user']['get']({'plain':!![]});if(!_0x320a22)throw new Error(_0xb042('0x4e'));if(_0x320a22['role']===_0xb042('0x4f')){var _0x286c1f=_0x5e2e1e['get']({'plain':!![]});var _0x29717d=_0xb042('0x27');return db[_0xb042('0x50')][_0xb042('0x51')]({'where':{'name':_0x29717d,'userProfileId':_0x320a22['userProfileId']},'raw':!![]})[_0xb042('0x24')](function(_0x23555f){if(_0x23555f&&_0x23555f['autoAssociation']===0x0){return db[_0xb042('0x28')][_0xb042('0x4c')]({'name':_0x286c1f[_0xb042('0x2b')],'resourceId':_0x286c1f['id'],'type':_0x23555f[_0xb042('0x2b')],'sectionId':_0x23555f['id']},{})[_0xb042('0x24')](function(){return _0x5e2e1e;});}else{return _0x5e2e1e;}})['catch'](function(_0x5d6932){logger[_0xb042('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d6932);throw _0x5d6932;});}return _0x5e2e1e;})[_0xb042('0x24')](respondWithResult(_0x2b7db5,0xc9))['catch'](handleError(_0x2b7db5,null));};exports['update']=function(_0x2734fe,_0x5c9540){if(_0x2734fe[_0xb042('0x4d')]['id']){delete _0x2734fe['body']['id'];}return db['Interval'][_0xb042('0x51')]({'where':{'id':_0x2734fe['params']['id']}})[_0xb042('0x24')](handleEntityNotFound(_0x5c9540,null))[_0xb042('0x24')](saveUpdates(_0x2734fe[_0xb042('0x4d')],null))[_0xb042('0x24')](respondWithResult(_0x5c9540,null))['catch'](handleError(_0x5c9540,null));};exports[_0xb042('0x25')]=function(_0x5defd7,_0x59c5e0){return db[_0xb042('0x2f')][_0xb042('0x51')]({'where':{'id':_0x5defd7['params']['id']}})[_0xb042('0x24')](handleEntityNotFound(_0x59c5e0,null))[_0xb042('0x24')](removeEntity(_0x59c5e0,null))[_0xb042('0x52')](handleError(_0x59c5e0,null));};exports[_0xb042('0x53')]=function(_0xd8ead6,_0x946b92,_0x37c42b){if(_0xd8ead6[_0xb042('0x4d')]['id']){delete _0xd8ead6['body']['id'];}return db[_0xb042('0x2f')]['find']({'where':{'id':_0xd8ead6[_0xb042('0x4a')]['id']}})[_0xb042('0x24')](handleEntityNotFound(_0x946b92,null))[_0xb042('0x24')](function(_0x5b5f5c){if(_0x5b5f5c){_0xd8ead6[_0xb042('0x4d')][_0xb042('0x54')]=_0x5b5f5c['id'];return db[_0xb042('0x2f')][_0xb042('0x4c')](_0xd8ead6[_0xb042('0x4d')]);}})[_0xb042('0x24')](respondWithResult(_0x946b92,null))[_0xb042('0x52')](handleError(_0x946b92,null));};exports[_0xb042('0x55')]=function(_0x52d9a0,_0x18e7e7,_0x57588f){var _0x4c2744={};var _0x2b29ad={};var _0x355db3;var _0x3648bc;return db['Interval']['findOne']({'where':{'id':_0x52d9a0['params']['id']}})['then'](handleEntityNotFound(_0x18e7e7,null))[_0xb042('0x24')](function(_0x4c6dfd){if(_0x4c6dfd){_0x355db3=_0x4c6dfd;_0x2b29ad[_0xb042('0x34')]=_[_0xb042('0x36')](db[_0xb042('0x2f')][_0xb042('0x30')]);_0x2b29ad['query']=_['keys'](_0x52d9a0['query']);_0x2b29ad['filters']=_[_0xb042('0x4b')](_0x2b29ad[_0xb042('0x34')],_0x2b29ad[_0xb042('0x35')]);_0x4c2744[_0xb042('0x37')]=_[_0xb042('0x4b')](_0x2b29ad[_0xb042('0x34')],qs[_0xb042('0x38')](_0x52d9a0[_0xb042('0x35')]['fields']));_0x4c2744['attributes']=_0x4c2744[_0xb042('0x37')][_0xb042('0x39')]?_0x4c2744['attributes']:_0x2b29ad['model'];_0x4c2744[_0xb042('0x3c')]=qs[_0xb042('0x3d')](_0x52d9a0[_0xb042('0x35')][_0xb042('0x3d')]);_0x4c2744[_0xb042('0x3e')]=qs['filters'](_[_0xb042('0x40')](_0x52d9a0[_0xb042('0x35')],_0x2b29ad[_0xb042('0x3f')]));if(_0x52d9a0['query'][_0xb042('0x41')]){_0x4c2744[_0xb042('0x3e')]=_[_0xb042('0x43')](_0x4c2744[_0xb042('0x3e')],{'$or':_[_0xb042('0x2e')](_0x4c2744['attributes'],function(_0x5cf6de){var _0x54f55a={};_0x54f55a[_0x5cf6de]={'$like':'%'+_0x52d9a0[_0xb042('0x35')][_0xb042('0x41')]+'%'};return _0x54f55a;})});}_0x4c2744=_[_0xb042('0x43')]({},_0x4c2744,_0x52d9a0[_0xb042('0x44')]);return _0x355db3[_0xb042('0x55')](_0x4c2744);}})[_0xb042('0x24')](function(_0x3d562e){if(_0x3d562e){_0x3648bc=_0x3d562e[_0xb042('0x39')];if(!_0x52d9a0['query'][_0xb042('0x3a')](_0xb042('0x3b'))){_0x4c2744[_0xb042('0x1d')]=qs['limit'](_0x52d9a0['query']['limit']);_0x4c2744[_0xb042('0x1b')]=qs['offset'](_0x52d9a0[_0xb042('0x35')][_0xb042('0x1b')]);}return _0x355db3['getIntervals'](_0x4c2744);}})[_0xb042('0x24')](function(_0x11108b){if(_0x11108b){return _0x11108b?{'count':_0x3648bc,'rows':_0x11108b}:null;}})['then'](respondWithResult(_0x18e7e7,null))[_0xb042('0x52')](handleError(_0x18e7e7,null));};exports[_0xb042('0x56')]=function(_0x4eafa7,_0x39adda,_0x29c96b){return db[_0xb042('0x2f')]['findOne']({'where':{'id':_0x4eafa7[_0xb042('0x4a')]['id']}})[_0xb042('0x24')](handleEntityNotFound(_0x39adda,null))[_0xb042('0x24')](function(_0xcf4ab1){if(_0xcf4ab1){return db[_0xb042('0x57')][_0xb042('0x58')](function(_0x4b8664){return db[_0xb042('0x2f')][_0xb042('0x25')]({'where':{'IntervalId':_0x4eafa7['params']['id']},'transaction':_0x4b8664})[_0xb042('0x24')](function(_0x4b3242){var _0x17d99d=_[_0xb042('0x2e')](_0x4eafa7[_0xb042('0x4d')],function(_0x3ba181){delete _0x3ba181['id'];_0x3ba181['IntervalId']=_0x4eafa7['params']['id'];return _0x3ba181;});return db[_0xb042('0x2f')][_0xb042('0x59')](_0x17d99d,{'transaction':_0x4b8664});});})[_0xb042('0x24')](function(){return db[_0xb042('0x2f')][_0xb042('0x47')]({'where':{'IntervalId':_0x4eafa7['params']['id']}});});}})[_0xb042('0x24')](respondWithResult(_0x39adda,null))['catch'](handleError(_0x39adda,null));}; \ No newline at end of file +var _0xe6f6=['pick','filter','where','merge','options','includeAll','include','findAll','catch','show','params','fields','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addInterval','IntervalId','findOne','getIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../components/extensions/rewrite','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','Intervals','UserProfileResource','destroy','error','stack','name','send','map','Interval','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x565f6b,_0x2424b0){var _0x6f4dcc=function(_0x438afa){while(--_0x438afa){_0x565f6b['push'](_0x565f6b['shift']());}};_0x6f4dcc(++_0x2424b0);}(_0xe6f6,0x76));var _0x6e6f=function(_0x4a5e2a,_0x5e3652){_0x4a5e2a=_0x4a5e2a-0x0;var _0x1c23af=_0xe6f6[_0x4a5e2a];return _0x1c23af;};'use strict';var emlformat=require(_0x6e6f('0x0'));var rimraf=require(_0x6e6f('0x1'));var zipdir=require(_0x6e6f('0x2'));var jsonpatch=require(_0x6e6f('0x3'));var rp=require(_0x6e6f('0x4'));var moment=require(_0x6e6f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6e6f('0x6'));var util=require('util');var path=require(_0x6e6f('0x7'));var sox=require(_0x6e6f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6e6f('0x9'));var _=require(_0x6e6f('0xa'));var squel=require(_0x6e6f('0xb'));var crypto=require('crypto');var jsforce=require(_0x6e6f('0xc'));var deskjs=require(_0x6e6f('0xd'));var toCsv=require(_0x6e6f('0xe'));var querystring=require(_0x6e6f('0xf'));var Papa=require('papaparse');var Redis=require(_0x6e6f('0x10'));var authService=require(_0x6e6f('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e6f('0x12'));var logger=require('../../config/logger')(_0x6e6f('0x13'));var utils=require(_0x6e6f('0x14'));var config=require(_0x6e6f('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var extensions=require(_0x6e6f('0x16'));function respondWithStatusCode(_0x42074b,_0x5c0090){_0x5c0090=_0x5c0090||0xcc;return function(_0x52a13c){if(_0x52a13c){return _0x42074b[_0x6e6f('0x17')](_0x5c0090);}return _0x42074b['status'](_0x5c0090)[_0x6e6f('0x18')]();};}function respondWithResult(_0x2c653c,_0x1dc29b){_0x1dc29b=_0x1dc29b||0xc8;return function(_0x4c4d85){if(_0x4c4d85){return _0x2c653c[_0x6e6f('0x19')](_0x1dc29b)[_0x6e6f('0x1a')](_0x4c4d85);}};}function respondWithFilteredResult(_0x139ffb,_0x575f9e){return function(_0x528b61){if(_0x528b61){var _0x1cc64b=typeof _0x575f9e[_0x6e6f('0x1b')]===_0x6e6f('0x1c')&&typeof _0x575f9e[_0x6e6f('0x1d')]===_0x6e6f('0x1c');var _0x4e07d6=_0x528b61[_0x6e6f('0x1e')];var _0x310868=_0x1cc64b?0x0:_0x575f9e[_0x6e6f('0x1b')];var _0x6bc61d=_0x1cc64b?_0x528b61['count']:_0x575f9e[_0x6e6f('0x1b')]+_0x575f9e[_0x6e6f('0x1d')];var _0x3c5fe6;if(_0x6bc61d>=_0x4e07d6){_0x6bc61d=_0x4e07d6;_0x3c5fe6=0xc8;}else{_0x3c5fe6=0xce;}_0x139ffb[_0x6e6f('0x19')](_0x3c5fe6);return _0x139ffb[_0x6e6f('0x1f')]('Content-Range',_0x310868+'-'+_0x6bc61d+'/'+_0x4e07d6)[_0x6e6f('0x1a')](_0x528b61);}return null;};}function patchUpdates(_0x818005){return function(_0x59af0b){try{jsonpatch[_0x6e6f('0x20')](_0x59af0b,_0x818005,!![]);}catch(_0x41a35c){return BPromise[_0x6e6f('0x21')](_0x41a35c);}return _0x59af0b[_0x6e6f('0x22')]();};}function saveUpdates(_0x26bd5a,_0x380693){return function(_0x55ede9){if(_0x55ede9){return _0x55ede9[_0x6e6f('0x23')](_0x26bd5a)[_0x6e6f('0x24')](function(_0x483d6c){return _0x483d6c;});}return null;};}function removeEntity(_0x44fa5d,_0x1bbdff){return function(_0x57f610){if(_0x57f610){return _0x57f610['destroy']()[_0x6e6f('0x24')](function(){var _0x35f48f=_0x57f610['get']({'plain':!![]});var _0x4ff495=_0x6e6f('0x25');return db[_0x6e6f('0x26')][_0x6e6f('0x27')]({'where':{'type':_0x4ff495,'resourceId':_0x35f48f['id']}})[_0x6e6f('0x24')](function(){return _0x57f610;});})[_0x6e6f('0x24')](function(){_0x44fa5d['status'](0xcc)[_0x6e6f('0x18')]();});}};}function handleEntityNotFound(_0x25925f,_0x205226){return function(_0x1d3073){if(!_0x1d3073){_0x25925f[_0x6e6f('0x17')](0x194);}return _0x1d3073;};}function handleError(_0x34506a,_0x464f05){_0x464f05=_0x464f05||0x1f4;return function(_0x3271c2){logger[_0x6e6f('0x28')](_0x3271c2[_0x6e6f('0x29')]);if(_0x3271c2[_0x6e6f('0x2a')]){delete _0x3271c2[_0x6e6f('0x2a')];}_0x34506a[_0x6e6f('0x19')](_0x464f05)[_0x6e6f('0x2b')](_0x3271c2);};}exports['index']=function(_0x2f3689,_0x1b52bd){var _0xa07e8e={},_0x5b932d={},_0x357fab={'count':0x0,'rows':[]};var _0x5a2638=_[_0x6e6f('0x2c')](db[_0x6e6f('0x2d')][_0x6e6f('0x2e')],function(_0x6ebd30){return{'name':_0x6ebd30[_0x6e6f('0x2f')],'type':_0x6ebd30[_0x6e6f('0x30')]['key']};});_0x5b932d[_0x6e6f('0x31')]=_['map'](_0x5a2638,_0x6e6f('0x2a'));_0x5b932d[_0x6e6f('0x32')]=_[_0x6e6f('0x33')](_0x2f3689['query']);_0x5b932d[_0x6e6f('0x34')]=_[_0x6e6f('0x35')](_0x5b932d[_0x6e6f('0x31')],_0x5b932d[_0x6e6f('0x32')]);_0xa07e8e[_0x6e6f('0x36')]=_[_0x6e6f('0x35')](_0x5b932d['model'],qs['fields'](_0x2f3689[_0x6e6f('0x32')]['fields']));_0xa07e8e[_0x6e6f('0x36')]=_0xa07e8e[_0x6e6f('0x36')][_0x6e6f('0x37')]?_0xa07e8e[_0x6e6f('0x36')]:_0x5b932d['model'];if(!_0x2f3689[_0x6e6f('0x32')][_0x6e6f('0x38')](_0x6e6f('0x39'))){_0xa07e8e[_0x6e6f('0x1d')]=qs[_0x6e6f('0x1d')](_0x2f3689['query'][_0x6e6f('0x1d')]);_0xa07e8e[_0x6e6f('0x1b')]=qs[_0x6e6f('0x1b')](_0x2f3689[_0x6e6f('0x32')]['offset']);}_0xa07e8e[_0x6e6f('0x3a')]=qs['sort'](_0x2f3689[_0x6e6f('0x32')][_0x6e6f('0x3b')]);_0xa07e8e['where']=qs[_0x6e6f('0x34')](_[_0x6e6f('0x3c')](_0x2f3689[_0x6e6f('0x32')],_0x5b932d['filters']),_0x5a2638);if(_0x2f3689[_0x6e6f('0x32')][_0x6e6f('0x3d')]){_0xa07e8e[_0x6e6f('0x3e')]=_['merge'](_0xa07e8e['where'],{'$or':_[_0x6e6f('0x2c')](_0x5a2638,function(_0x24cada){if(_0x24cada[_0x6e6f('0x30')]!=='VIRTUAL'){var _0x554141={};_0x554141[_0x24cada[_0x6e6f('0x2a')]]={'$like':'%'+_0x2f3689[_0x6e6f('0x32')][_0x6e6f('0x3d')]+'%'};return _0x554141;}})});}_0xa07e8e=_[_0x6e6f('0x3f')]({},_0xa07e8e,_0x2f3689[_0x6e6f('0x40')]);var _0x4a7234={'where':_0xa07e8e['where']};return db['Interval'][_0x6e6f('0x1e')](_0x4a7234)[_0x6e6f('0x24')](function(_0x46b9ca){_0x357fab['count']=_0x46b9ca;if(_0x2f3689[_0x6e6f('0x32')][_0x6e6f('0x41')]){_0xa07e8e[_0x6e6f('0x42')]=[{'all':!![]}];}return db[_0x6e6f('0x2d')][_0x6e6f('0x43')](_0xa07e8e);})[_0x6e6f('0x24')](function(_0x41c3c8){_0x357fab['rows']=_0x41c3c8;return _0x357fab;})[_0x6e6f('0x24')](respondWithFilteredResult(_0x1b52bd,_0xa07e8e))[_0x6e6f('0x44')](handleError(_0x1b52bd,null));};exports[_0x6e6f('0x45')]=function(_0x50c3c5,_0xd225a7){var _0x2ab2ab={'raw':!![],'where':{'id':_0x50c3c5[_0x6e6f('0x46')]['id']}},_0x45fee1={};_0x45fee1['model']=_[_0x6e6f('0x33')](db['Interval']['rawAttributes']);_0x45fee1['query']=_['keys'](_0x50c3c5[_0x6e6f('0x32')]);_0x45fee1['filters']=_[_0x6e6f('0x35')](_0x45fee1['model'],_0x45fee1[_0x6e6f('0x32')]);_0x2ab2ab['attributes']=_['intersection'](_0x45fee1[_0x6e6f('0x31')],qs[_0x6e6f('0x47')](_0x50c3c5[_0x6e6f('0x32')][_0x6e6f('0x47')]));_0x2ab2ab['attributes']=_0x2ab2ab[_0x6e6f('0x36')]['length']?_0x2ab2ab[_0x6e6f('0x36')]:_0x45fee1[_0x6e6f('0x31')];if(_0x50c3c5['query']['includeAll']){_0x2ab2ab[_0x6e6f('0x42')]=[{'all':!![]}];}_0x2ab2ab=_[_0x6e6f('0x3f')]({},_0x2ab2ab,_0x50c3c5[_0x6e6f('0x40')]);return db[_0x6e6f('0x2d')]['find'](_0x2ab2ab)[_0x6e6f('0x24')](handleEntityNotFound(_0xd225a7,null))['then'](respondWithResult(_0xd225a7,null))[_0x6e6f('0x44')](handleError(_0xd225a7,null));};exports[_0x6e6f('0x48')]=function(_0x3df54f,_0x1a7624){return db[_0x6e6f('0x2d')]['create'](_0x3df54f['body'],{})[_0x6e6f('0x24')](function(_0x3aca1f){var _0xb81ec8=_0x3df54f['user'][_0x6e6f('0x49')]({'plain':!![]});if(!_0xb81ec8)throw new Error(_0x6e6f('0x4a'));if(_0xb81ec8[_0x6e6f('0x4b')]==='user'){var _0x20e354=_0x3aca1f[_0x6e6f('0x49')]({'plain':!![]});var _0xb60431=_0x6e6f('0x25');return db[_0x6e6f('0x4c')][_0x6e6f('0x4d')]({'where':{'name':_0xb60431,'userProfileId':_0xb81ec8[_0x6e6f('0x4e')]},'raw':!![]})[_0x6e6f('0x24')](function(_0x5e66d7){if(_0x5e66d7&&_0x5e66d7[_0x6e6f('0x4f')]===0x0){return db[_0x6e6f('0x26')][_0x6e6f('0x48')]({'name':_0x20e354[_0x6e6f('0x2a')],'resourceId':_0x20e354['id'],'type':_0x5e66d7[_0x6e6f('0x2a')],'sectionId':_0x5e66d7['id']},{})[_0x6e6f('0x24')](function(){return _0x3aca1f;});}else{return _0x3aca1f;}})[_0x6e6f('0x44')](function(_0x4e2630){logger[_0x6e6f('0x28')](_0x6e6f('0x50'),_0x4e2630);throw _0x4e2630;});}return _0x3aca1f;})['then'](respondWithResult(_0x1a7624,0xc9))['catch'](handleError(_0x1a7624,null));};exports[_0x6e6f('0x23')]=function(_0x4f9906,_0x456f49){if(_0x4f9906[_0x6e6f('0x51')]['id']){delete _0x4f9906[_0x6e6f('0x51')]['id'];}return db['Interval'][_0x6e6f('0x4d')]({'where':{'id':_0x4f9906[_0x6e6f('0x46')]['id']}})['then'](handleEntityNotFound(_0x456f49,null))[_0x6e6f('0x24')](saveUpdates(_0x4f9906[_0x6e6f('0x51')],null))['then'](respondWithResult(_0x456f49,null))['catch'](handleError(_0x456f49,null));};exports['destroy']=function(_0x318c33,_0x57e928){return db[_0x6e6f('0x2d')][_0x6e6f('0x4d')]({'where':{'id':_0x318c33['params']['id']}})[_0x6e6f('0x24')](handleEntityNotFound(_0x57e928,null))[_0x6e6f('0x24')](removeEntity(_0x57e928,null))[_0x6e6f('0x44')](handleError(_0x57e928,null));};exports[_0x6e6f('0x52')]=function(_0x1f4e73,_0x235d57,_0x1e55b0){if(_0x1f4e73[_0x6e6f('0x51')]['id']){delete _0x1f4e73['body']['id'];}return db[_0x6e6f('0x2d')][_0x6e6f('0x4d')]({'where':{'id':_0x1f4e73[_0x6e6f('0x46')]['id']}})[_0x6e6f('0x24')](handleEntityNotFound(_0x235d57,null))[_0x6e6f('0x24')](function(_0x3897a5){if(_0x3897a5){_0x1f4e73['body'][_0x6e6f('0x53')]=_0x3897a5['id'];return db[_0x6e6f('0x2d')][_0x6e6f('0x48')](_0x1f4e73[_0x6e6f('0x51')]);}})[_0x6e6f('0x24')](respondWithResult(_0x235d57,null))[_0x6e6f('0x44')](handleError(_0x235d57,null));};exports['getIntervals']=function(_0x498de4,_0x3272b6,_0x3bf2db){var _0x48a279={};var _0x35054f={};var _0x14e4ee;var _0x3374ca;return db[_0x6e6f('0x2d')][_0x6e6f('0x54')]({'where':{'id':_0x498de4[_0x6e6f('0x46')]['id']}})[_0x6e6f('0x24')](handleEntityNotFound(_0x3272b6,null))[_0x6e6f('0x24')](function(_0x33e5ab){if(_0x33e5ab){_0x14e4ee=_0x33e5ab;_0x35054f['model']=_[_0x6e6f('0x33')](db[_0x6e6f('0x2d')][_0x6e6f('0x2e')]);_0x35054f[_0x6e6f('0x32')]=_[_0x6e6f('0x33')](_0x498de4['query']);_0x35054f[_0x6e6f('0x34')]=_[_0x6e6f('0x35')](_0x35054f[_0x6e6f('0x31')],_0x35054f[_0x6e6f('0x32')]);_0x48a279[_0x6e6f('0x36')]=_['intersection'](_0x35054f[_0x6e6f('0x31')],qs['fields'](_0x498de4[_0x6e6f('0x32')][_0x6e6f('0x47')]));_0x48a279['attributes']=_0x48a279[_0x6e6f('0x36')]['length']?_0x48a279[_0x6e6f('0x36')]:_0x35054f[_0x6e6f('0x31')];_0x48a279[_0x6e6f('0x3a')]=qs[_0x6e6f('0x3b')](_0x498de4['query'][_0x6e6f('0x3b')]);_0x48a279[_0x6e6f('0x3e')]=qs['filters'](_[_0x6e6f('0x3c')](_0x498de4['query'],_0x35054f[_0x6e6f('0x34')]));if(_0x498de4[_0x6e6f('0x32')][_0x6e6f('0x3d')]){_0x48a279[_0x6e6f('0x3e')]=_[_0x6e6f('0x3f')](_0x48a279[_0x6e6f('0x3e')],{'$or':_['map'](_0x48a279[_0x6e6f('0x36')],function(_0x1daab6){var _0x2132ac={};_0x2132ac[_0x1daab6]={'$like':'%'+_0x498de4[_0x6e6f('0x32')]['filter']+'%'};return _0x2132ac;})});}_0x48a279=_[_0x6e6f('0x3f')]({},_0x48a279,_0x498de4[_0x6e6f('0x40')]);return _0x14e4ee[_0x6e6f('0x55')](_0x48a279);}})[_0x6e6f('0x24')](function(_0x37527b){if(_0x37527b){_0x3374ca=_0x37527b[_0x6e6f('0x37')];if(!_0x498de4[_0x6e6f('0x32')]['hasOwnProperty'](_0x6e6f('0x39'))){_0x48a279[_0x6e6f('0x1d')]=qs[_0x6e6f('0x1d')](_0x498de4[_0x6e6f('0x32')][_0x6e6f('0x1d')]);_0x48a279['offset']=qs[_0x6e6f('0x1b')](_0x498de4[_0x6e6f('0x32')][_0x6e6f('0x1b')]);}return _0x14e4ee[_0x6e6f('0x55')](_0x48a279);}})[_0x6e6f('0x24')](function(_0x385b5a){if(_0x385b5a){return _0x385b5a?{'count':_0x3374ca,'rows':_0x385b5a}:null;}})[_0x6e6f('0x24')](respondWithResult(_0x3272b6,null))[_0x6e6f('0x44')](handleError(_0x3272b6,null));};exports['addIntervals']=function(_0x3bc812,_0x4c2ae1,_0x2bb90e){return db[_0x6e6f('0x2d')][_0x6e6f('0x54')]({'where':{'id':_0x3bc812[_0x6e6f('0x46')]['id']}})[_0x6e6f('0x24')](handleEntityNotFound(_0x4c2ae1,null))[_0x6e6f('0x24')](function(_0x13049e){if(_0x13049e){return db[_0x6e6f('0x56')][_0x6e6f('0x57')](function(_0x4951ea){return db[_0x6e6f('0x2d')]['destroy']({'where':{'IntervalId':_0x3bc812[_0x6e6f('0x46')]['id']},'transaction':_0x4951ea})['then'](function(_0x867239){var _0x4cdd40=_[_0x6e6f('0x2c')](_0x3bc812[_0x6e6f('0x51')],function(_0x2d8871){delete _0x2d8871['id'];_0x2d8871[_0x6e6f('0x53')]=_0x3bc812[_0x6e6f('0x46')]['id'];return _0x2d8871;});return db[_0x6e6f('0x2d')][_0x6e6f('0x58')](_0x4cdd40,{'transaction':_0x4951ea});});})['then'](function(){return db[_0x6e6f('0x2d')]['findAll']({'where':{'IntervalId':_0x3bc812[_0x6e6f('0x46')]['id']}});});}})[_0x6e6f('0x24')](respondWithResult(_0x4c2ae1,null))[_0x6e6f('0x44')](handleError(_0x4c2ae1,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 300093f..47556dd 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 _0xa11b=['iftime','exports','define','tools_intervals','rewrite','interval','all','map','ifTime','then','reduce','./interval.attributes','../../components/extensions/rewrite'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa11b,0x66));var _0xba11=function(_0x3ae5d6,_0x906e55){_0x3ae5d6=_0x3ae5d6-0x0;var _0x346177=_0xa11b[_0x3ae5d6];return _0x346177;};'use strict';var attributes=require(_0xba11('0x0'));var extensions=require(_0xba11('0x1'));var iftime=require('../../utils/iftime')[_0xba11('0x2')];module[_0xba11('0x3')]=function(_0x3e66c3){return _0x3e66c3[_0xba11('0x4')]('Interval',attributes,{'tableName':_0xba11('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x29d3d4){extensions[_0xba11('0x6')](_0x3e66c3,_0x29d3d4);},'afterBulkCreate':function(_0x29fba6,_0xa834b7,_0x1661fd){_0x1661fd();extensions[_0xba11('0x6')](_0x3e66c3,_0x29fba6[0x0]);},'afterUpdate':function(_0x3d0584){extensions[_0xba11('0x6')](_0x3e66c3,_0x3d0584);},'afterDestroy':function(_0x238ab1){extensions['rewrite'](_0x3e66c3,_0x238ab1);}},'instanceMethods':{'ifTime':function(_0x40987f=undefined,_0x5e2dad=new Date()){if(typeof this[_0xba11('0x7')]==='string'){return iftime(this['interval'],_0x40987f,_0x5e2dad);}else{return this['getIntervals']()['then'](function(_0x1eab14){return Promise[_0xba11('0x8')](_0x1eab14[_0xba11('0x9')](function(_0x456029){return _0x456029[_0xba11('0xa')](_0x40987f,_0x5e2dad);}));})[_0xba11('0xb')](function(_0x280f11){return _0x280f11[_0xba11('0xc')](function(_0x48a6cd,_0x391aaa){return _0x48a6cd||_0x391aaa;},![]);});}}}});}; \ No newline at end of file +var _0x0d8a=['./interval.attributes','../../components/extensions/rewrite','iftime','exports','define','Interval','tools_intervals','rewrite','interval','getIntervals','all','map','ifTime','reduce'];(function(_0x49eaa0,_0x261984){var _0x3f15b6=function(_0x2bb8c0){while(--_0x2bb8c0){_0x49eaa0['push'](_0x49eaa0['shift']());}};_0x3f15b6(++_0x261984);}(_0x0d8a,0x188));var _0xa0d8=function(_0x110caa,_0xaeee2a){_0x110caa=_0x110caa-0x0;var _0x4c4d21=_0x0d8a[_0x110caa];return _0x4c4d21;};'use strict';var attributes=require(_0xa0d8('0x0'));var extensions=require(_0xa0d8('0x1'));var iftime=require('../../utils/iftime')[_0xa0d8('0x2')];module[_0xa0d8('0x3')]=function(_0x149ab8){return _0x149ab8[_0xa0d8('0x4')](_0xa0d8('0x5'),attributes,{'tableName':_0xa0d8('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x27948a){extensions[_0xa0d8('0x7')](_0x149ab8,_0x27948a);},'afterBulkCreate':function(_0x3c89a6,_0x37dcc6,_0x1a1121){_0x1a1121();extensions[_0xa0d8('0x7')](_0x149ab8,_0x3c89a6[0x0]);},'afterUpdate':function(_0x4dc68b){extensions[_0xa0d8('0x7')](_0x149ab8,_0x4dc68b);},'afterDestroy':function(_0x560784){extensions['rewrite'](_0x149ab8,_0x560784);}},'instanceMethods':{'ifTime':function(_0x168abe=undefined,_0x42471b=new Date()){if(typeof this[_0xa0d8('0x8')]==='string'){return iftime(this['interval'],_0x168abe,_0x42471b);}else{return this[_0xa0d8('0x9')]()['then'](function(_0x355948){return Promise[_0xa0d8('0xa')](_0x355948[_0xa0d8('0xb')](function(_0x107120){return _0x107120[_0xa0d8('0xc')](_0x168abe,_0x42471b);}));})['then'](function(_0x5468b5){return _0x5468b5[_0xa0d8('0xd')](function(_0xb8a628,_0x1314ad){return _0xb8a628||_0x1314ad;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index dc4f0f1..8401e93 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 _0xdfe2=['where','limit','include','map','model','attributes','info','GetInterval','debug','stringify','catch','error','message','find','then','ShowInterval','all','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','format','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','name','ifTime','IntervalIftime','intervals','string','timezone','length','Iftime','silly','resolve','isArray','reduce','lodash','util','../../mysqldb','../../utils/iftime','iftime','Interval','findAll','options','raw'];(function(_0x3f2a90,_0x50baf1){var _0xb46279=function(_0x5e47b5){while(--_0x5e47b5){_0x3f2a90['push'](_0x3f2a90['shift']());}};_0xb46279(++_0x50baf1);}(_0xdfe2,0x1a5));var _0x2dfe=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xdfe2[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x2dfe('0x0'));var util=require(_0x2dfe('0x1'));var db=require(_0x2dfe('0x2'))['db'];var iftime=require(_0x2dfe('0x3'))[_0x2dfe('0x4')];var logger=require('../../config/logger')('rpc');exports['GetInterval']=function(_0xcfa292){var _0x356645=this;return new Promise(function(_0xf603a5,_0x257f41){return db[_0x2dfe('0x5')][_0x2dfe('0x6')]({'raw':_0xcfa292[_0x2dfe('0x7')]?_0xcfa292['options'][_0x2dfe('0x8')]===undefined?!![]:![]:!![],'where':_0xcfa292[_0x2dfe('0x7')]?_0xcfa292[_0x2dfe('0x7')][_0x2dfe('0x9')]||null:null,'attributes':_0xcfa292[_0x2dfe('0x7')]?_0xcfa292[_0x2dfe('0x7')]['attributes']||null:null,'limit':_0xcfa292[_0x2dfe('0x7')]?_0xcfa292[_0x2dfe('0x7')][_0x2dfe('0xa')]||null:null,'include':_0xcfa292[_0x2dfe('0x7')]?_0xcfa292[_0x2dfe('0x7')][_0x2dfe('0xb')]?_[_0x2dfe('0xc')](_0xcfa292[_0x2dfe('0x7')][_0x2dfe('0xb')],function(_0x3bdeb5){return{'model':db[_0x3bdeb5[_0x2dfe('0xd')]],'as':_0x3bdeb5['as'],'attributes':_0x3bdeb5['attributes'],'include':_0x3bdeb5[_0x2dfe('0xb')]?_[_0x2dfe('0xc')](_0x3bdeb5['include'],function(_0x5695f5){return{'model':db[_0x5695f5[_0x2dfe('0xd')]],'as':_0x5695f5['as'],'attributes':_0x5695f5[_0x2dfe('0xe')],'include':_0x5695f5[_0x2dfe('0xb')]?_[_0x2dfe('0xc')](_0x5695f5[_0x2dfe('0xb')],function(_0x4adcf5){return{'model':db[_0x4adcf5['model']],'as':_0x4adcf5['as'],'attributes':_0x4adcf5[_0x2dfe('0xe')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1841aa){logger[_0x2dfe('0xf')](_0x2dfe('0x10'),_0xcfa292);logger[_0x2dfe('0x11')](_0x2dfe('0x10'),_0xcfa292,JSON[_0x2dfe('0x12')](_0x1841aa));_0xf603a5(_0x1841aa);})[_0x2dfe('0x13')](function(_0x3f4908){logger[_0x2dfe('0x14')]('GetInterval',_0x3f4908[_0x2dfe('0x15')],_0xcfa292);_0x257f41(_0x356645[_0x2dfe('0x14')](0x1f4,_0x3f4908[_0x2dfe('0x15')]));});});};exports['ShowInterval']=function(_0x144388){var _0x9ced6b=this;return new Promise(function(_0x2daf97,_0x3c23b3){return db['Interval'][_0x2dfe('0x16')]({'raw':_0x144388[_0x2dfe('0x7')]?_0x144388[_0x2dfe('0x7')][_0x2dfe('0x8')]===undefined?!![]:![]:!![],'where':_0x144388[_0x2dfe('0x7')]?_0x144388['options'][_0x2dfe('0x9')]||null:null,'attributes':_0x144388[_0x2dfe('0x7')]?_0x144388[_0x2dfe('0x7')][_0x2dfe('0xe')]||null:null,'include':_0x144388[_0x2dfe('0x7')]?_0x144388['options'][_0x2dfe('0xb')]?_[_0x2dfe('0xc')](_0x144388['options'][_0x2dfe('0xb')],function(_0x5765e7){return{'model':db[_0x5765e7['model']],'as':_0x5765e7['as'],'attributes':_0x5765e7[_0x2dfe('0xe')],'include':_0x5765e7[_0x2dfe('0xb')]?_['map'](_0x5765e7['include'],function(_0x3f9e9d){return{'model':db[_0x3f9e9d[_0x2dfe('0xd')]],'as':_0x3f9e9d['as'],'attributes':_0x3f9e9d[_0x2dfe('0xe')],'include':_0x3f9e9d[_0x2dfe('0xb')]?_[_0x2dfe('0xc')](_0x3f9e9d[_0x2dfe('0xb')],function(_0x59212f){return{'model':db[_0x59212f[_0x2dfe('0xd')]],'as':_0x59212f['as'],'attributes':_0x59212f[_0x2dfe('0xe')]};}):[]};}):[]};}):[]:[]})[_0x2dfe('0x17')](function(_0x132f76){logger['info'](_0x2dfe('0x18'),_0x144388);logger[_0x2dfe('0x11')](_0x2dfe('0x18'),_0x144388,JSON[_0x2dfe('0x12')](_0x132f76));_0x2daf97(_0x132f76);})['catch'](function(_0x3f61d4){logger[_0x2dfe('0x14')](_0x2dfe('0x18'),_0x3f61d4[_0x2dfe('0x15')],_0x144388);_0x3c23b3(_0x9ced6b[_0x2dfe('0x14')](0x1f4,_0x3f61d4[_0x2dfe('0x15')]));});});};function checkArrayOfIntervals(_0x321b72,_0x292785){var _0x1c2446=[];return db['Interval'][_0x2dfe('0x6')]({'where':{'id':_0x321b72}})[_0x2dfe('0x17')](function(_0x5a87f9){_0x1c2446=_0x5a87f9;return Promise[_0x2dfe('0x19')](_0x1c2446[_0x2dfe('0xc')](function(_0x5e3a5e){return _0x5e3a5e['ifTime'](_0x292785);}));})[_0x2dfe('0x17')](function(_0x5d76ee){var _0x2e4742=_0x5d76ee['reduce'](function(_0x3769e9,_0x5ef8af){return _0x3769e9||_0x5ef8af;},![]);logger[_0x2dfe('0xf')](util['format'](_0x2dfe('0x1a'),_0x1c2446[_0x2dfe('0xc')](function(_0x4664bb){return _0x4664bb['name'];})[_0x2dfe('0x1b')](',\x20'),_0x1c2446[_0x2dfe('0xc')](function(_0x128456){return _0x128456['id'];})[_0x2dfe('0x1b')](',\x20')));return _0x2e4742;});}function checkSingleInterval(_0x5c917c,_0x989c64){return db[_0x2dfe('0x5')][_0x2dfe('0x1c')](_0x5c917c)[_0x2dfe('0x17')](function(_0x569289){if(_0x569289){logger['info'](util[_0x2dfe('0x1d')](_0x2dfe('0x1e'),_0x569289[_0x2dfe('0x1f')],_0x569289['id']));return _0x569289[_0x2dfe('0x20')](_0x989c64);}});}exports[_0x2dfe('0x21')]=function(_0x45ca6c){var _0x103be3=_0x45ca6c['intervalIds'];var _0x5112c5=Array['isArray'](_0x45ca6c[_0x2dfe('0x22')])?_0x45ca6c[_0x2dfe('0x22')]:typeof _0x45ca6c[_0x2dfe('0x22')]===_0x2dfe('0x23')?[_0x45ca6c['intervals']]:[];var _0x342432=_0x45ca6c[_0x2dfe('0x24')]||undefined;var _0x3f4e35=![];if(_0x5112c5[_0x2dfe('0x25')]){logger['info'](util[_0x2dfe('0x1d')]('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x5112c5['join'](';\x20')));}if(_0x342432){logger['info'](util[_0x2dfe('0x1d')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x342432));}logger['debug'](_0x2dfe('0x26'),_0x3f4e35);logger[_0x2dfe('0x27')]('IntervalIftime',_0x45ca6c);return Promise[_0x2dfe('0x28')]()[_0x2dfe('0x17')](function(){if(Array[_0x2dfe('0x29')](_0x103be3)){return checkArrayOfIntervals(_0x103be3,_0x342432);}else if(_0x103be3){return checkSingleInterval(_0x103be3,_0x342432);}})[_0x2dfe('0x17')](function(_0x3f98cf){var _0x3a5496=_0x5112c5[_0x2dfe('0x2a')](function(_0x292758,_0x1f7687){return _0x292758||iftime(_0x1f7687,_0x342432);},![]);_0x3f4e35=_0x3f98cf||_0x3a5496;return _0x3f4e35;})['catch'](function(_0x37d14a){logger[_0x2dfe('0x14')](_0x2dfe('0x21'),_0x45ca6c,_0x37d14a);throw this[_0x2dfe('0x14')](0x1f4,_0x37d14a[_0x2dfe('0x15')]);});}; \ No newline at end of file +var _0x1218=['IntervalIftime','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','join','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','lodash','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','findAll','options','raw','where','attributes','limit','include','map','model','then','info','debug','stringify','catch','message','error','ShowInterval','Interval','find','all','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)'];(function(_0xe712b0,_0x29a9f3){var _0x1138bb=function(_0x54cfe1){while(--_0x54cfe1){_0xe712b0['push'](_0xe712b0['shift']());}};_0x1138bb(++_0x29a9f3);}(_0x1218,0x127));var _0x8121=function(_0x303bdf,_0x5956c9){_0x303bdf=_0x303bdf-0x0;var _0x2536b5=_0x1218[_0x303bdf];return _0x2536b5;};'use strict';var _=require(_0x8121('0x0'));var util=require('util');var db=require(_0x8121('0x1'))['db'];var iftime=require(_0x8121('0x2'))[_0x8121('0x3')];var logger=require(_0x8121('0x4'))(_0x8121('0x5'));exports[_0x8121('0x6')]=function(_0xe37894){var _0x252e03=this;return new Promise(function(_0x7786d2,_0x18a180){return db['Interval'][_0x8121('0x7')]({'raw':_0xe37894[_0x8121('0x8')]?_0xe37894['options'][_0x8121('0x9')]===undefined?!![]:![]:!![],'where':_0xe37894['options']?_0xe37894[_0x8121('0x8')][_0x8121('0xa')]||null:null,'attributes':_0xe37894['options']?_0xe37894['options'][_0x8121('0xb')]||null:null,'limit':_0xe37894['options']?_0xe37894[_0x8121('0x8')][_0x8121('0xc')]||null:null,'include':_0xe37894['options']?_0xe37894[_0x8121('0x8')][_0x8121('0xd')]?_[_0x8121('0xe')](_0xe37894[_0x8121('0x8')]['include'],function(_0x469ac9){return{'model':db[_0x469ac9[_0x8121('0xf')]],'as':_0x469ac9['as'],'attributes':_0x469ac9[_0x8121('0xb')],'include':_0x469ac9['include']?_[_0x8121('0xe')](_0x469ac9['include'],function(_0x5d7138){return{'model':db[_0x5d7138['model']],'as':_0x5d7138['as'],'attributes':_0x5d7138[_0x8121('0xb')],'include':_0x5d7138[_0x8121('0xd')]?_['map'](_0x5d7138[_0x8121('0xd')],function(_0x388bc2){return{'model':db[_0x388bc2['model']],'as':_0x388bc2['as'],'attributes':_0x388bc2[_0x8121('0xb')]};}):[]};}):[]};}):[]:[]})[_0x8121('0x10')](function(_0x5e6e45){logger[_0x8121('0x11')](_0x8121('0x6'),_0xe37894);logger[_0x8121('0x12')](_0x8121('0x6'),_0xe37894,JSON[_0x8121('0x13')](_0x5e6e45));_0x7786d2(_0x5e6e45);})[_0x8121('0x14')](function(_0xd8c971){logger['error']('GetInterval',_0xd8c971[_0x8121('0x15')],_0xe37894);_0x18a180(_0x252e03[_0x8121('0x16')](0x1f4,_0xd8c971[_0x8121('0x15')]));});});};exports[_0x8121('0x17')]=function(_0x2df1cd){var _0x4c4594=this;return new Promise(function(_0x1e9014,_0xf23f43){return db[_0x8121('0x18')][_0x8121('0x19')]({'raw':_0x2df1cd['options']?_0x2df1cd[_0x8121('0x8')][_0x8121('0x9')]===undefined?!![]:![]:!![],'where':_0x2df1cd[_0x8121('0x8')]?_0x2df1cd[_0x8121('0x8')][_0x8121('0xa')]||null:null,'attributes':_0x2df1cd[_0x8121('0x8')]?_0x2df1cd[_0x8121('0x8')][_0x8121('0xb')]||null:null,'include':_0x2df1cd[_0x8121('0x8')]?_0x2df1cd[_0x8121('0x8')][_0x8121('0xd')]?_[_0x8121('0xe')](_0x2df1cd[_0x8121('0x8')][_0x8121('0xd')],function(_0x2779db){return{'model':db[_0x2779db['model']],'as':_0x2779db['as'],'attributes':_0x2779db[_0x8121('0xb')],'include':_0x2779db[_0x8121('0xd')]?_[_0x8121('0xe')](_0x2779db['include'],function(_0x19130f){return{'model':db[_0x19130f[_0x8121('0xf')]],'as':_0x19130f['as'],'attributes':_0x19130f[_0x8121('0xb')],'include':_0x19130f['include']?_[_0x8121('0xe')](_0x19130f[_0x8121('0xd')],function(_0x40dec1){return{'model':db[_0x40dec1['model']],'as':_0x40dec1['as'],'attributes':_0x40dec1[_0x8121('0xb')]};}):[]};}):[]};}):[]:[]})[_0x8121('0x10')](function(_0x296a9f){logger[_0x8121('0x11')]('ShowInterval',_0x2df1cd);logger['debug'](_0x8121('0x17'),_0x2df1cd,JSON[_0x8121('0x13')](_0x296a9f));_0x1e9014(_0x296a9f);})[_0x8121('0x14')](function(_0x28cc16){logger['error'](_0x8121('0x17'),_0x28cc16[_0x8121('0x15')],_0x2df1cd);_0xf23f43(_0x4c4594[_0x8121('0x16')](0x1f4,_0x28cc16[_0x8121('0x15')]));});});};function checkArrayOfIntervals(_0x58567c,_0x122afb){var _0x242e07=[];return db['Interval']['findAll']({'where':{'id':_0x58567c}})[_0x8121('0x10')](function(_0x315a3d){_0x242e07=_0x315a3d;return Promise[_0x8121('0x1a')](_0x242e07[_0x8121('0xe')](function(_0x35261a){return _0x35261a[_0x8121('0x1b')](_0x122afb);}));})[_0x8121('0x10')](function(_0x1efe31){var _0x1ee4a2=_0x1efe31[_0x8121('0x1c')](function(_0x11ac08,_0x354ff1){return _0x11ac08||_0x354ff1;},![]);logger[_0x8121('0x11')](util[_0x8121('0x1d')](_0x8121('0x1e'),_0x242e07[_0x8121('0xe')](function(_0x579009){return _0x579009[_0x8121('0x1f')];})['join'](',\x20'),_0x242e07['map'](function(_0x217a16){return _0x217a16['id'];})['join'](',\x20')));return _0x1ee4a2;});}function checkSingleInterval(_0x3d8082,_0x59756e){return db['Interval'][_0x8121('0x20')](_0x3d8082)['then'](function(_0x4afca2){if(_0x4afca2){logger[_0x8121('0x11')](util[_0x8121('0x1d')](_0x8121('0x21'),_0x4afca2[_0x8121('0x1f')],_0x4afca2['id']));return _0x4afca2[_0x8121('0x1b')](_0x59756e);}});}exports[_0x8121('0x22')]=function(_0x1e2339){var _0x5dd585=_0x1e2339[_0x8121('0x23')];var _0x22bcfa=Array[_0x8121('0x24')](_0x1e2339[_0x8121('0x25')])?_0x1e2339['intervals']:typeof _0x1e2339[_0x8121('0x25')]===_0x8121('0x26')?[_0x1e2339[_0x8121('0x25')]]:[];var _0x248cd7=_0x1e2339[_0x8121('0x27')]||undefined;var _0x236c74=![];if(_0x22bcfa[_0x8121('0x28')]){logger[_0x8121('0x11')](util[_0x8121('0x1d')](_0x8121('0x29'),_0x22bcfa[_0x8121('0x2a')](';\x20')));}if(_0x248cd7){logger['info'](util[_0x8121('0x1d')](_0x8121('0x2b'),_0x248cd7));}logger[_0x8121('0x12')](_0x8121('0x2c'),_0x236c74);logger[_0x8121('0x2d')](_0x8121('0x22'),_0x1e2339);return Promise[_0x8121('0x2e')]()[_0x8121('0x10')](function(){if(Array['isArray'](_0x5dd585)){return checkArrayOfIntervals(_0x5dd585,_0x248cd7);}else if(_0x5dd585){return checkSingleInterval(_0x5dd585,_0x248cd7);}})[_0x8121('0x10')](function(_0x42049b){var _0x210893=_0x22bcfa['reduce'](function(_0xe22b4a,_0x25d472){return _0xe22b4a||iftime(_0x25d472,_0x248cd7);},![]);_0x236c74=_0x42049b||_0x210893;return _0x236c74;})[_0x8121('0x14')](function(_0x4e0bf1){logger[_0x8121('0x16')]('IntervalIftime',_0x1e2339,_0x4e0bf1);throw this[_0x8121('0x16')](0x1f4,_0x4e0bf1['message']);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 75d64b5..7402ad5 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1304c6,_0x6bb485){_0x1304c6=_0x1304c6-0x0;var _0x2e6654=_0x0b0e[_0x1304c6];return _0x2e6654;};'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 _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x229532,_0x7a0350){var _0xbe8ef=function(_0x2c9aa3){while(--_0x2c9aa3){_0x229532['push'](_0x229532['shift']());}};_0xbe8ef(++_0x7a0350);}(_0xdb28,0x106));var _0x8db2=function(_0x57b0cc,_0x38b25b){_0x57b0cc=_0x57b0cc-0x0;var _0x53a23a=_0xdb28[_0x57b0cc];return _0x53a23a;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 576daa2..fa94f92 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 _0xd64c=['Basic\x20','toString','base64','request','setEncoding','utf8','statusCode','json','error','write','end','openIssue','send','x-forwarded-for','connection','remoteAddress','socket','body','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','stringify','issuetype','Bug','fields','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','POST'];(function(_0x2d5781,_0x375b2f){var _0x1071a6=function(_0x2aba1e){while(--_0x2aba1e){_0x2d5781['push'](_0x2d5781['shift']());}};_0x1071a6(++_0x375b2f);}(_0xd64c,0x1e0));var _0xcd64=function(_0x83322e,_0x2c95da){_0x83322e=_0x83322e-0x0;var _0x1e44e4=_0xd64c[_0x83322e];return _0x1e44e4;};'use strict';var BPromise=require(_0xcd64('0x0'));var https=require(_0xcd64('0x1'));var logger=require(_0xcd64('0x2'))(_0xcd64('0x3'));var USERNAME=_0xcd64('0x4');var PASSWORD=_0xcd64('0x5');function openIssue(_0x383586,_0x3437c1){var _0x1cfab2={'fields':{'project':{'key':_0x383586[_0xcd64('0x6')]||_0xcd64('0x7')},'summary':(_0x383586['summary']||_0xcd64('0x8'))+_0xcd64('0x9')+_0x383586['ip'],'description':_0x383586['description']||JSON[_0xcd64('0xa')](_0x383586),'issuetype':{'name':_0x383586[_0xcd64('0xb')]||_0xcd64('0xc')}}};_0x1cfab2[_0xcd64('0xd')]['customfield_11500']=_0x383586['email'];_0x1cfab2['fields']['customfield_11501']=_0x383586[_0xcd64('0xe')];_0x1cfab2['fields'][_0xcd64('0xf')]=_0x383586[_0xcd64('0x10')];_0x1cfab2[_0xcd64('0xd')][_0xcd64('0x11')]=_0x383586[_0xcd64('0x12')];_0x1cfab2[_0xcd64('0xd')][_0xcd64('0x13')]=_0x383586[_0xcd64('0x14')];_0x1cfab2[_0xcd64('0xd')]['customfield_10102']=_0x383586['ip'];var _0x1f7e45={'host':_0xcd64('0x15'),'port':0x1bb,'path':_0xcd64('0x16'),'method':_0xcd64('0x17'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xcd64('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0xcd64('0x19')](_0xcd64('0x1a'))}};var _0x408ff4=JSON[_0xcd64('0xa')](_0x1cfab2);var _0x19c6cb=https[_0xcd64('0x1b')](_0x1f7e45,function(_0x24c3df){_0x24c3df[_0xcd64('0x1c')](_0xcd64('0x1d'));var _0x4d3777='';_0x24c3df['on']('data',function(_0x264d75){_0x4d3777+=_0x264d75;});_0x24c3df['on']('end',function(){if(_0x3437c1){return _0x3437c1['status'](_0x24c3df[_0xcd64('0x1e')])[_0xcd64('0x1f')](JSON['parse'](_0x4d3777));}});});_0x19c6cb['on'](_0xcd64('0x20'),function(_0x280f8d){if(_0x3437c1){return _0x3437c1['status'](0x1f4)[_0xcd64('0x1f')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':'api.jira'}]});}});_0x19c6cb[_0xcd64('0x21')](_0x408ff4);_0x19c6cb[_0xcd64('0x22')]();}exports[_0xcd64('0x23')]=openIssue;exports[_0xcd64('0x24')]=function(_0x4eea4a,_0x1fe85e){_0x4eea4a['body']['ip']=_0x4eea4a['headers'][_0xcd64('0x25')]||_0x4eea4a[_0xcd64('0x26')][_0xcd64('0x27')]||_0x4eea4a[_0xcd64('0x28')][_0xcd64('0x27')]||_0x4eea4a[_0xcd64('0x26')][_0xcd64('0x28')][_0xcd64('0x27')];return openIssue(_0x4eea4a[_0xcd64('0x29')],_0x1fe85e);}; \ No newline at end of file +var _0x4c37=['json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','end','send','body','headers','connection','socket','remoteAddress','bluebird','https','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','description','stringify','Bug','fields','customfield_11500','email','customfield_11501','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','request','setEncoding','utf8','data','statusCode'];(function(_0x5ee4aa,_0x500126){var _0x560256=function(_0x2c6b8e){while(--_0x2c6b8e){_0x5ee4aa['push'](_0x5ee4aa['shift']());}};_0x560256(++_0x500126);}(_0x4c37,0x162));var _0x74c3=function(_0x3b9e39,_0x5eaf06){_0x3b9e39=_0x3b9e39-0x0;var _0x4c33b7=_0x4c37[_0x3b9e39];return _0x4c33b7;};'use strict';var BPromise=require(_0x74c3('0x0'));var https=require(_0x74c3('0x1'));var logger=require('../../config/logger')(_0x74c3('0x2'));var USERNAME=_0x74c3('0x3');var PASSWORD=_0x74c3('0x4');function openIssue(_0x3034c2,_0x25b2f6){var _0x403fd0={'fields':{'project':{'key':_0x3034c2[_0x74c3('0x5')]||_0x74c3('0x6')},'summary':(_0x3034c2[_0x74c3('0x7')]||_0x74c3('0x8'))+'\x20from\x20'+_0x3034c2['ip'],'description':_0x3034c2[_0x74c3('0x9')]||JSON[_0x74c3('0xa')](_0x3034c2),'issuetype':{'name':_0x3034c2['issuetype']||_0x74c3('0xb')}}};_0x403fd0[_0x74c3('0xc')][_0x74c3('0xd')]=_0x3034c2[_0x74c3('0xe')];_0x403fd0[_0x74c3('0xc')][_0x74c3('0xf')]=_0x3034c2['oldToken'];_0x403fd0[_0x74c3('0xc')]['customfield_11502']=_0x3034c2[_0x74c3('0x10')];_0x403fd0[_0x74c3('0xc')][_0x74c3('0x11')]=_0x3034c2[_0x74c3('0x12')];_0x403fd0['fields'][_0x74c3('0x13')]=_0x3034c2[_0x74c3('0x14')];_0x403fd0['fields'][_0x74c3('0x15')]=_0x3034c2['ip'];var _0x30b829={'host':_0x74c3('0x16'),'port':0x1bb,'path':_0x74c3('0x17'),'method':_0x74c3('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0x74c3('0x19'),'Authorization':_0x74c3('0x1a')+new Buffer(USERNAME+':'+PASSWORD)[_0x74c3('0x1b')]('base64')}};var _0x2cbc59=JSON['stringify'](_0x403fd0);var _0x153fb3=https[_0x74c3('0x1c')](_0x30b829,function(_0x1343d1){_0x1343d1[_0x74c3('0x1d')](_0x74c3('0x1e'));var _0xe5b960='';_0x1343d1['on'](_0x74c3('0x1f'),function(_0x4d29b3){_0xe5b960+=_0x4d29b3;});_0x1343d1['on']('end',function(){if(_0x25b2f6){return _0x25b2f6['status'](_0x1343d1[_0x74c3('0x20')])[_0x74c3('0x21')](JSON['parse'](_0xe5b960));}});});_0x153fb3['on'](_0x74c3('0x22'),function(_0x16d0c3){if(_0x25b2f6){return _0x25b2f6['status'](0x1f4)[_0x74c3('0x21')]({'errors':[{'message':_0x74c3('0x23'),'type':'api.jira'}]});}});_0x153fb3['write'](_0x2cbc59);_0x153fb3[_0x74c3('0x24')]();}exports['openIssue']=openIssue;exports[_0x74c3('0x25')]=function(_0x5b47ac,_0x425596){_0x5b47ac[_0x74c3('0x26')]['ip']=_0x5b47ac[_0x74c3('0x27')]['x-forwarded-for']||_0x5b47ac[_0x74c3('0x28')]['remoteAddress']||_0x5b47ac[_0x74c3('0x29')][_0x74c3('0x2a')]||_0x5b47ac[_0x74c3('0x28')][_0x74c3('0x29')]['remoteAddress'];return openIssue(_0x5b47ac[_0x74c3('0x26')],_0x425596);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index c63dfbf..7e7c278 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 _0x668b=['get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','isAuthenticated','index'];(function(_0xb6c53d,_0x1e5eb1){var _0x3537ab=function(_0xd08c58){while(--_0xd08c58){_0xb6c53d['push'](_0xb6c53d['shift']());}};_0x3537ab(++_0x1e5eb1);}(_0x668b,0x140));var _0xb668=function(_0x12bcf7,_0xc11103){_0x12bcf7=_0x12bcf7-0x0;var _0x2825a=_0x668b[_0x12bcf7];return _0x2825a;};'use strict';var multer=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var path=require('path');var timeout=require(_0xb668('0x2'));var express=require(_0xb668('0x3'));var router=express['Router']();var fs_extra=require(_0xb668('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb668('0x5'));var config=require(_0xb668('0x6'));var controller=require(_0xb668('0x7'));router['get']('/',auth[_0xb668('0x8')](),controller[_0xb668('0x9')]);router[_0xb668('0xa')](_0xb668('0xb'),auth[_0xb668('0x8')](),controller[_0xb668('0xc')]);router['get'](_0xb668('0xd'),auth[_0xb668('0x8')](),controller[_0xb668('0xe')]);router[_0xb668('0xf')]('/',auth[_0xb668('0x8')](),controller[_0xb668('0x10')]);router[_0xb668('0x11')](_0xb668('0xd'),auth['isAuthenticated'](),controller[_0xb668('0x12')]);router[_0xb668('0x13')](_0xb668('0xd'),auth[_0xb668('0x8')](),controller[_0xb668('0x14')]);module[_0xb668('0x15')]=router; \ No newline at end of file +var _0x6f7a=['isAuthenticated','index','/describe','/:id','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get'];(function(_0x4938d8,_0x9d674b){var _0x5bbf85=function(_0x337fac){while(--_0x337fac){_0x4938d8['push'](_0x4938d8['shift']());}};_0x5bbf85(++_0x9d674b);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x13863f,_0xd352a1){_0x13863f=_0x13863f-0x0;var _0x2798c2=_0x6f7a[_0x13863f];return _0x2798c2;};'use strict';var multer=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var path=require(_0xa6f7('0x2'));var timeout=require(_0xa6f7('0x3'));var express=require('express');var router=express[_0xa6f7('0x4')]();var fs_extra=require(_0xa6f7('0x5'));var auth=require(_0xa6f7('0x6'));var interaction=require(_0xa6f7('0x7'));var config=require(_0xa6f7('0x8'));var controller=require(_0xa6f7('0x9'));router[_0xa6f7('0xa')]('/',auth[_0xa6f7('0xb')](),controller[_0xa6f7('0xc')]);router[_0xa6f7('0xa')](_0xa6f7('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xa6f7('0xa')](_0xa6f7('0xe'),auth[_0xa6f7('0xb')](),controller[_0xa6f7('0xf')]);router[_0xa6f7('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa6f7('0x11')](_0xa6f7('0xe'),auth['isAuthenticated'](),controller[_0xa6f7('0x12')]);router['delete'](_0xa6f7('0xe'),auth[_0xa6f7('0xb')](),controller[_0xa6f7('0x13')]);module[_0xa6f7('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 62f8f88..38f16a2 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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7a54,0x106));var _0x47a5=function(_0x185be3,_0x5a197a){_0x185be3=_0x185be3-0x0;var _0x44c3c3=_0x7a54[_0x185be3];return _0x44c3c3;};'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(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x7a54,0x106));var _0x47a5=function(_0x1e9bbb,_0x179834){_0x1e9bbb=_0x1e9bbb-0x0;var _0x58ac2b=_0x7a54[_0x1e9bbb];return _0x58ac2b;};'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 7820a49..8192101 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 _0xfd7b=['stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','key','keys','query','intersection','model','fields','attributes','length','nolimit','order','sort','where','filters','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','show','params','find','body','catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','json','apply','reject','update','then','destroy','end','error'];(function(_0xda6a82,_0x5f00f0){var _0xbacb19=function(_0x31fe92){while(--_0x31fe92){_0xda6a82['push'](_0xda6a82['shift']());}};_0xbacb19(++_0x5f00f0);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xfd7b[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbfd7('0x0'));var zipdir=require(_0xbfd7('0x1'));var jsonpatch=require(_0xbfd7('0x2'));var rp=require(_0xbfd7('0x3'));var moment=require(_0xbfd7('0x4'));var BPromise=require(_0xbfd7('0x5'));var Mustache=require(_0xbfd7('0x6'));var util=require(_0xbfd7('0x7'));var path=require(_0xbfd7('0x8'));var sox=require(_0xbfd7('0x9'));var csv=require(_0xbfd7('0xa'));var ejs=require(_0xbfd7('0xb'));var fs=require('fs');var fs_extra=require(_0xbfd7('0xc'));var _=require('lodash');var squel=require(_0xbfd7('0xd'));var crypto=require('crypto');var jsforce=require(_0xbfd7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xbfd7('0xa'));var querystring=require(_0xbfd7('0xf'));var Papa=require(_0xbfd7('0x10'));var Redis=require(_0xbfd7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbfd7('0x12'));var as=require(_0xbfd7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbfd7('0x14'));var utils=require(_0xbfd7('0x15'));var config=require(_0xbfd7('0x16'));var licenseUtil=require(_0xbfd7('0x17'));var db=require(_0xbfd7('0x18'))['db'];function respondWithStatusCode(_0x559eca,_0x46feae){_0x46feae=_0x46feae||0xcc;return function(_0x534d66){if(_0x534d66){return _0x559eca[_0xbfd7('0x19')](_0x46feae);}return _0x559eca['status'](_0x46feae)['end']();};}function respondWithResult(_0x44847e,_0x4fec16){_0x4fec16=_0x4fec16||0xc8;return function(_0x3789b7){if(_0x3789b7){return _0x44847e[_0xbfd7('0x1a')](_0x4fec16)['json'](_0x3789b7);}};}function respondWithFilteredResult(_0x5efd54,_0x48f4a4){return function(_0x37e777){if(_0x37e777){var _0x115a34=typeof _0x48f4a4[_0xbfd7('0x1b')]===_0xbfd7('0x1c')&&typeof _0x48f4a4[_0xbfd7('0x1d')]===_0xbfd7('0x1c');var _0x137d50=_0x37e777[_0xbfd7('0x1e')];var _0x3053f3=_0x115a34?0x0:_0x48f4a4['offset'];var _0x5b718b=_0x115a34?_0x37e777[_0xbfd7('0x1e')]:_0x48f4a4[_0xbfd7('0x1b')]+_0x48f4a4['limit'];var _0x5ea27a;if(_0x5b718b>=_0x137d50){_0x5b718b=_0x137d50;_0x5ea27a=0xc8;}else{_0x5ea27a=0xce;}_0x5efd54[_0xbfd7('0x1a')](_0x5ea27a);return _0x5efd54['set']('Content-Range',_0x3053f3+'-'+_0x5b718b+'/'+_0x137d50)[_0xbfd7('0x1f')](_0x37e777);}return null;};}function patchUpdates(_0x5eab37){return function(_0x594792){try{jsonpatch[_0xbfd7('0x20')](_0x594792,_0x5eab37,!![]);}catch(_0x1db6de){return BPromise[_0xbfd7('0x21')](_0x1db6de);}return _0x594792['save']();};}function saveUpdates(_0xb38f6b,_0x32a489){return function(_0x152893){if(_0x152893){return _0x152893[_0xbfd7('0x22')](_0xb38f6b)[_0xbfd7('0x23')](function(_0x2639b6){return _0x2639b6;});}return null;};}function removeEntity(_0x51b13d,_0x2402fb){return function(_0x1c765b){if(_0x1c765b){return _0x1c765b[_0xbfd7('0x24')]()['then'](function(){_0x51b13d[_0xbfd7('0x1a')](0xcc)[_0xbfd7('0x25')]();});}};}function handleEntityNotFound(_0x18dd74,_0x2d0549){return function(_0x358549){if(!_0x358549){_0x18dd74['sendStatus'](0x194);}return _0x358549;};}function handleError(_0x2a7749,_0x6ef5aa){_0x6ef5aa=_0x6ef5aa||0x1f4;return function(_0x120e39){logger[_0xbfd7('0x26')](_0x120e39[_0xbfd7('0x27')]);if(_0x120e39[_0xbfd7('0x28')]){delete _0x120e39[_0xbfd7('0x28')];}_0x2a7749['status'](_0x6ef5aa)[_0xbfd7('0x29')](_0x120e39);};}exports[_0xbfd7('0x2a')]=function(_0x4d7ef4,_0x2971ea){var _0x33583b={},_0x2ec4a5={},_0x14c55d={'count':0x0,'rows':[]};var _0x510506=_[_0xbfd7('0x2b')](db[_0xbfd7('0x2c')][_0xbfd7('0x2d')],function(_0x489365){return{'name':_0x489365[_0xbfd7('0x2e')],'type':_0x489365['type'][_0xbfd7('0x2f')]};});_0x2ec4a5['model']=_[_0xbfd7('0x2b')](_0x510506,_0xbfd7('0x28'));_0x2ec4a5['query']=_[_0xbfd7('0x30')](_0x4d7ef4[_0xbfd7('0x31')]);_0x2ec4a5['filters']=_[_0xbfd7('0x32')](_0x2ec4a5[_0xbfd7('0x33')],_0x2ec4a5[_0xbfd7('0x31')]);_0x33583b['attributes']=_[_0xbfd7('0x32')](_0x2ec4a5[_0xbfd7('0x33')],qs[_0xbfd7('0x34')](_0x4d7ef4[_0xbfd7('0x31')][_0xbfd7('0x34')]));_0x33583b[_0xbfd7('0x35')]=_0x33583b[_0xbfd7('0x35')][_0xbfd7('0x36')]?_0x33583b[_0xbfd7('0x35')]:_0x2ec4a5[_0xbfd7('0x33')];if(!_0x4d7ef4[_0xbfd7('0x31')]['hasOwnProperty'](_0xbfd7('0x37'))){_0x33583b['limit']=qs['limit'](_0x4d7ef4[_0xbfd7('0x31')][_0xbfd7('0x1d')]);_0x33583b[_0xbfd7('0x1b')]=qs[_0xbfd7('0x1b')](_0x4d7ef4[_0xbfd7('0x31')][_0xbfd7('0x1b')]);}_0x33583b[_0xbfd7('0x38')]=qs[_0xbfd7('0x39')](_0x4d7ef4['query']['sort']);_0x33583b[_0xbfd7('0x3a')]=qs[_0xbfd7('0x3b')](_['pick'](_0x4d7ef4[_0xbfd7('0x31')],_0x2ec4a5[_0xbfd7('0x3b')]),_0x510506);if(_0x4d7ef4['query']['filter']){_0x33583b[_0xbfd7('0x3a')]=_[_0xbfd7('0x3c')](_0x33583b['where'],{'$or':_[_0xbfd7('0x2b')](_0x510506,function(_0xfee712){if(_0xfee712[_0xbfd7('0x3d')]!==_0xbfd7('0x3e')){var _0x68f13={};_0x68f13[_0xfee712['name']]={'$like':'%'+_0x4d7ef4[_0xbfd7('0x31')][_0xbfd7('0x3f')]+'%'};return _0x68f13;}})});}_0x33583b=_[_0xbfd7('0x3c')]({},_0x33583b,_0x4d7ef4[_0xbfd7('0x40')]);var _0x25ac4a={'where':_0x33583b[_0xbfd7('0x3a')]};return db[_0xbfd7('0x2c')][_0xbfd7('0x1e')](_0x25ac4a)['then'](function(_0x32df79){_0x14c55d['count']=_0x32df79;if(_0x4d7ef4['query'][_0xbfd7('0x41')]){_0x33583b[_0xbfd7('0x42')]=[{'all':!![]}];}return db[_0xbfd7('0x2c')][_0xbfd7('0x43')](_0x33583b);})[_0xbfd7('0x23')](function(_0x1236dd){_0x14c55d['rows']=_0x1236dd;return _0x14c55d;})[_0xbfd7('0x23')](respondWithFilteredResult(_0x2971ea,_0x33583b))['catch'](handleError(_0x2971ea,null));};exports[_0xbfd7('0x44')]=function(_0x3b7d7f,_0x12f99b){var _0x159c20={'raw':!![],'where':{'id':_0x3b7d7f[_0xbfd7('0x45')]['id']}},_0x1df6a3={};_0x1df6a3[_0xbfd7('0x33')]=_['keys'](db[_0xbfd7('0x2c')][_0xbfd7('0x2d')]);_0x1df6a3[_0xbfd7('0x31')]=_[_0xbfd7('0x30')](_0x3b7d7f[_0xbfd7('0x31')]);_0x1df6a3[_0xbfd7('0x3b')]=_[_0xbfd7('0x32')](_0x1df6a3['model'],_0x1df6a3[_0xbfd7('0x31')]);_0x159c20[_0xbfd7('0x35')]=_[_0xbfd7('0x32')](_0x1df6a3['model'],qs['fields'](_0x3b7d7f['query'][_0xbfd7('0x34')]));_0x159c20[_0xbfd7('0x35')]=_0x159c20[_0xbfd7('0x35')][_0xbfd7('0x36')]?_0x159c20['attributes']:_0x1df6a3[_0xbfd7('0x33')];if(_0x3b7d7f['query'][_0xbfd7('0x41')]){_0x159c20[_0xbfd7('0x42')]=[{'all':!![]}];}_0x159c20=_['merge']({},_0x159c20,_0x3b7d7f[_0xbfd7('0x40')]);return db['JscriptyAnswerReport'][_0xbfd7('0x46')](_0x159c20)[_0xbfd7('0x23')](handleEntityNotFound(_0x12f99b,null))[_0xbfd7('0x23')](respondWithResult(_0x12f99b,null))['catch'](handleError(_0x12f99b,null));};exports['create']=function(_0x356f58,_0xb8b319){return db['JscriptyAnswerReport']['create'](_0x356f58[_0xbfd7('0x47')],{})[_0xbfd7('0x23')](respondWithResult(_0xb8b319,0xc9))[_0xbfd7('0x48')](handleError(_0xb8b319,null));};exports[_0xbfd7('0x22')]=function(_0x1cea7d,_0x14bc15){if(_0x1cea7d[_0xbfd7('0x47')]['id']){delete _0x1cea7d['body']['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0x1cea7d[_0xbfd7('0x45')]['id']}})[_0xbfd7('0x23')](handleEntityNotFound(_0x14bc15,null))[_0xbfd7('0x23')](saveUpdates(_0x1cea7d['body'],null))[_0xbfd7('0x23')](respondWithResult(_0x14bc15,null))[_0xbfd7('0x48')](handleError(_0x14bc15,null));};exports['destroy']=function(_0x4a7a72,_0xc89535){return db[_0xbfd7('0x2c')][_0xbfd7('0x46')]({'where':{'id':_0x4a7a72['params']['id']}})[_0xbfd7('0x23')](handleEntityNotFound(_0xc89535,null))[_0xbfd7('0x23')](removeEntity(_0xc89535,null))[_0xbfd7('0x48')](handleError(_0xc89535,null));};exports['describe']=function(_0x371d01,_0x15c0fe){return db[_0xbfd7('0x2c')][_0xbfd7('0x49')]()['then'](respondWithResult(_0x15c0fe,null))[_0xbfd7('0x48')](handleError(_0x15c0fe,null));}; \ No newline at end of file +var _0x11e5=['lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','undefined','set','Content-Range','apply','save','update','then','error','stack','name','index','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','count','includeAll','include','JscriptyAnswerReport','findAll','rows','catch','show','params','options','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','ejs','fs-extra'];(function(_0x176a40,_0x480f77){var _0x96fd72=function(_0x509125){while(--_0x509125){_0x176a40['push'](_0x176a40['shift']());}};_0x96fd72(++_0x480f77);}(_0x11e5,0x8b));var _0x511e=function(_0x160476,_0x5bdd7c){_0x160476=_0x160476-0x0;var _0x5dc472=_0x11e5[_0x160476];return _0x5dc472;};'use strict';var emlformat=require(_0x511e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x511e('0x1'));var jsonpatch=require(_0x511e('0x2'));var rp=require('request-promise');var moment=require(_0x511e('0x3'));var BPromise=require(_0x511e('0x4'));var Mustache=require(_0x511e('0x5'));var util=require('util');var path=require(_0x511e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x511e('0x7'));var fs=require('fs');var fs_extra=require(_0x511e('0x8'));var _=require(_0x511e('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x511e('0xa'));var deskjs=require(_0x511e('0xb'));var toCsv=require(_0x511e('0xc'));var querystring=require(_0x511e('0xd'));var Papa=require(_0x511e('0xe'));var Redis=require(_0x511e('0xf'));var authService=require(_0x511e('0x10'));var qs=require(_0x511e('0x11'));var as=require(_0x511e('0x12'));var hardwareService=require(_0x511e('0x13'));var logger=require(_0x511e('0x14'))('api');var utils=require(_0x511e('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x511e('0x16'))['db'];function respondWithStatusCode(_0x327880,_0x42679e){_0x42679e=_0x42679e||0xcc;return function(_0x258e2f){if(_0x258e2f){return _0x327880[_0x511e('0x17')](_0x42679e);}return _0x327880[_0x511e('0x18')](_0x42679e)['end']();};}function respondWithResult(_0xdd0dcd,_0x33fd64){_0x33fd64=_0x33fd64||0xc8;return function(_0x4e6507){if(_0x4e6507){return _0xdd0dcd[_0x511e('0x18')](_0x33fd64)[_0x511e('0x19')](_0x4e6507);}};}function respondWithFilteredResult(_0x4f50b9,_0xed773e){return function(_0x162c91){if(_0x162c91){var _0x3b990b=typeof _0xed773e[_0x511e('0x1a')]==='undefined'&&typeof _0xed773e[_0x511e('0x1b')]===_0x511e('0x1c');var _0x2e66b6=_0x162c91['count'];var _0x26af67=_0x3b990b?0x0:_0xed773e['offset'];var _0x34e6cd=_0x3b990b?_0x162c91['count']:_0xed773e['offset']+_0xed773e[_0x511e('0x1b')];var _0x5c4fb9;if(_0x34e6cd>=_0x2e66b6){_0x34e6cd=_0x2e66b6;_0x5c4fb9=0xc8;}else{_0x5c4fb9=0xce;}_0x4f50b9[_0x511e('0x18')](_0x5c4fb9);return _0x4f50b9[_0x511e('0x1d')](_0x511e('0x1e'),_0x26af67+'-'+_0x34e6cd+'/'+_0x2e66b6)[_0x511e('0x19')](_0x162c91);}return null;};}function patchUpdates(_0xd4df6f){return function(_0x3d3f46){try{jsonpatch[_0x511e('0x1f')](_0x3d3f46,_0xd4df6f,!![]);}catch(_0x452f20){return BPromise['reject'](_0x452f20);}return _0x3d3f46[_0x511e('0x20')]();};}function saveUpdates(_0x39e0b4,_0x2ebf30){return function(_0x1a273b){if(_0x1a273b){return _0x1a273b[_0x511e('0x21')](_0x39e0b4)[_0x511e('0x22')](function(_0x886b6){return _0x886b6;});}return null;};}function removeEntity(_0x2f28fc,_0x211b90){return function(_0x26618d){if(_0x26618d){return _0x26618d['destroy']()['then'](function(){_0x2f28fc[_0x511e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ff5c4,_0x53017d){return function(_0x3fbd19){if(!_0x3fbd19){_0x1ff5c4[_0x511e('0x17')](0x194);}return _0x3fbd19;};}function handleError(_0x406dfb,_0x1f8040){_0x1f8040=_0x1f8040||0x1f4;return function(_0x1bb7f9){logger[_0x511e('0x23')](_0x1bb7f9[_0x511e('0x24')]);if(_0x1bb7f9[_0x511e('0x25')]){delete _0x1bb7f9[_0x511e('0x25')];}_0x406dfb[_0x511e('0x18')](_0x1f8040)['send'](_0x1bb7f9);};}exports[_0x511e('0x26')]=function(_0x1d754d,_0xb563f6){var _0x1aaac1={},_0x369be6={},_0x50305a={'count':0x0,'rows':[]};var _0x431b75=_['map'](db['JscriptyAnswerReport'][_0x511e('0x27')],function(_0xb1d444){return{'name':_0xb1d444[_0x511e('0x28')],'type':_0xb1d444[_0x511e('0x29')][_0x511e('0x2a')]};});_0x369be6['model']=_[_0x511e('0x2b')](_0x431b75,_0x511e('0x25'));_0x369be6[_0x511e('0x2c')]=_[_0x511e('0x2d')](_0x1d754d[_0x511e('0x2c')]);_0x369be6['filters']=_[_0x511e('0x2e')](_0x369be6[_0x511e('0x2f')],_0x369be6[_0x511e('0x2c')]);_0x1aaac1[_0x511e('0x30')]=_[_0x511e('0x2e')](_0x369be6[_0x511e('0x2f')],qs[_0x511e('0x31')](_0x1d754d[_0x511e('0x2c')]['fields']));_0x1aaac1[_0x511e('0x30')]=_0x1aaac1[_0x511e('0x30')][_0x511e('0x32')]?_0x1aaac1[_0x511e('0x30')]:_0x369be6['model'];if(!_0x1d754d['query'][_0x511e('0x33')]('nolimit')){_0x1aaac1['limit']=qs[_0x511e('0x1b')](_0x1d754d[_0x511e('0x2c')][_0x511e('0x1b')]);_0x1aaac1[_0x511e('0x1a')]=qs[_0x511e('0x1a')](_0x1d754d['query'][_0x511e('0x1a')]);}_0x1aaac1[_0x511e('0x34')]=qs[_0x511e('0x35')](_0x1d754d['query'][_0x511e('0x35')]);_0x1aaac1[_0x511e('0x36')]=qs[_0x511e('0x37')](_['pick'](_0x1d754d[_0x511e('0x2c')],_0x369be6[_0x511e('0x37')]),_0x431b75);if(_0x1d754d['query'][_0x511e('0x38')]){_0x1aaac1[_0x511e('0x36')]=_[_0x511e('0x39')](_0x1aaac1[_0x511e('0x36')],{'$or':_[_0x511e('0x2b')](_0x431b75,function(_0x1a989a){if(_0x1a989a[_0x511e('0x29')]!==_0x511e('0x3a')){var _0xde4b8={};_0xde4b8[_0x1a989a[_0x511e('0x25')]]={'$like':'%'+_0x1d754d[_0x511e('0x2c')]['filter']+'%'};return _0xde4b8;}})});}_0x1aaac1=_[_0x511e('0x39')]({},_0x1aaac1,_0x1d754d['options']);var _0x51716f={'where':_0x1aaac1[_0x511e('0x36')]};return db['JscriptyAnswerReport']['count'](_0x51716f)[_0x511e('0x22')](function(_0x200207){_0x50305a[_0x511e('0x3b')]=_0x200207;if(_0x1d754d[_0x511e('0x2c')][_0x511e('0x3c')]){_0x1aaac1[_0x511e('0x3d')]=[{'all':!![]}];}return db[_0x511e('0x3e')][_0x511e('0x3f')](_0x1aaac1);})[_0x511e('0x22')](function(_0x396542){_0x50305a[_0x511e('0x40')]=_0x396542;return _0x50305a;})[_0x511e('0x22')](respondWithFilteredResult(_0xb563f6,_0x1aaac1))[_0x511e('0x41')](handleError(_0xb563f6,null));};exports[_0x511e('0x42')]=function(_0x5086e0,_0x5a7a12){var _0x19ffde={'raw':!![],'where':{'id':_0x5086e0[_0x511e('0x43')]['id']}},_0x29dcc1={};_0x29dcc1[_0x511e('0x2f')]=_[_0x511e('0x2d')](db['JscriptyAnswerReport'][_0x511e('0x27')]);_0x29dcc1[_0x511e('0x2c')]=_[_0x511e('0x2d')](_0x5086e0['query']);_0x29dcc1['filters']=_['intersection'](_0x29dcc1[_0x511e('0x2f')],_0x29dcc1[_0x511e('0x2c')]);_0x19ffde[_0x511e('0x30')]=_['intersection'](_0x29dcc1['model'],qs['fields'](_0x5086e0[_0x511e('0x2c')][_0x511e('0x31')]));_0x19ffde[_0x511e('0x30')]=_0x19ffde[_0x511e('0x30')][_0x511e('0x32')]?_0x19ffde[_0x511e('0x30')]:_0x29dcc1[_0x511e('0x2f')];if(_0x5086e0[_0x511e('0x2c')][_0x511e('0x3c')]){_0x19ffde[_0x511e('0x3d')]=[{'all':!![]}];}_0x19ffde=_[_0x511e('0x39')]({},_0x19ffde,_0x5086e0[_0x511e('0x44')]);return db[_0x511e('0x3e')][_0x511e('0x45')](_0x19ffde)[_0x511e('0x22')](handleEntityNotFound(_0x5a7a12,null))[_0x511e('0x22')](respondWithResult(_0x5a7a12,null))[_0x511e('0x41')](handleError(_0x5a7a12,null));};exports[_0x511e('0x46')]=function(_0x3a8395,_0x2c2573){return db[_0x511e('0x3e')][_0x511e('0x46')](_0x3a8395[_0x511e('0x47')],{})[_0x511e('0x22')](respondWithResult(_0x2c2573,0xc9))[_0x511e('0x41')](handleError(_0x2c2573,null));};exports[_0x511e('0x21')]=function(_0x3d6f6e,_0x31e949){if(_0x3d6f6e[_0x511e('0x47')]['id']){delete _0x3d6f6e[_0x511e('0x47')]['id'];}return db[_0x511e('0x3e')]['find']({'where':{'id':_0x3d6f6e[_0x511e('0x43')]['id']}})['then'](handleEntityNotFound(_0x31e949,null))[_0x511e('0x22')](saveUpdates(_0x3d6f6e[_0x511e('0x47')],null))[_0x511e('0x22')](respondWithResult(_0x31e949,null))['catch'](handleError(_0x31e949,null));};exports[_0x511e('0x48')]=function(_0x1217df,_0x33d555){return db['JscriptyAnswerReport'][_0x511e('0x45')]({'where':{'id':_0x1217df[_0x511e('0x43')]['id']}})['then'](handleEntityNotFound(_0x33d555,null))[_0x511e('0x22')](removeEntity(_0x33d555,null))[_0x511e('0x41')](handleError(_0x33d555,null));};exports[_0x511e('0x49')]=function(_0x32df56,_0x523669){return db[_0x511e('0x3e')]['describe']()[_0x511e('0x22')](respondWithResult(_0x523669,null))[_0x511e('0x41')](handleError(_0x523669,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index e4fd3ae..5c30b8b 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 _0xf597=['bluebird','request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','api','moment'];(function(_0x50c4be,_0x449629){var _0x5c2abb=function(_0x41ec01){while(--_0x41ec01){_0x50c4be['push'](_0x50c4be['shift']());}};_0x5c2abb(++_0x449629);}(_0xf597,0x11a));var _0x7f59=function(_0x34e8f7,_0x3c9362){_0x34e8f7=_0x34e8f7-0x0;var _0x499358=_0xf597[_0x34e8f7];return _0x499358;};'use strict';var _=require(_0x7f59('0x0'));var util=require(_0x7f59('0x1'));var logger=require('../../config/logger')(_0x7f59('0x2'));var moment=require(_0x7f59('0x3'));var BPromise=require(_0x7f59('0x4'));var rp=require(_0x7f59('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7f59('0x6'));var config=require(_0x7f59('0x7'));var attributes=require(_0x7f59('0x8'));module[_0x7f59('0x9')]=function(_0x50a1b6,_0x46927c){return _0x50a1b6[_0x7f59('0xa')](_0x7f59('0xb'),attributes,{'tableName':_0x7f59('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e98=['util','api','moment','bluebird','exports','define','report_jscripty_answers','lodash'];(function(_0x27c5fa,_0x240756){var _0x3176f9=function(_0x2cb5cb){while(--_0x2cb5cb){_0x27c5fa['push'](_0x27c5fa['shift']());}};_0x3176f9(++_0x240756);}(_0x8e98,0x8f));var _0x88e9=function(_0x3beb74,_0x2a39c1){_0x3beb74=_0x3beb74-0x0;var _0x2ca990=_0x8e98[_0x3beb74];return _0x2ca990;};'use strict';var _=require(_0x88e9('0x0'));var util=require(_0x88e9('0x1'));var logger=require('../../config/logger')(_0x88e9('0x2'));var moment=require(_0x88e9('0x3'));var BPromise=require(_0x88e9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptyAnswerReport.attributes');module[_0x88e9('0x5')]=function(_0xd0ef6a,_0xd969ac){return _0xd0ef6a[_0x88e9('0x6')]('JscriptyAnswerReport',attributes,{'tableName':_0x88e9('0x7'),'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 d4e85f8..9061b2d 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 _0x3da0=['rpc','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x21236a,_0x19e918){var _0xcab860=function(_0x375d90){while(--_0x375d90){_0x21236a['push'](_0x21236a['shift']());}};_0xcab860(++_0x19e918);}(_0x3da0,0x101));var _0x03da=function(_0x2f6541,_0x363cba){_0x2f6541=_0x2f6541-0x0;var _0x4d76d8=_0x3da0[_0x2f6541];return _0x4d76d8;};'use strict';var _=require(_0x03da('0x0'));var util=require(_0x03da('0x1'));var moment=require(_0x03da('0x2'));var BPromise=require('bluebird');var rs=require(_0x03da('0x3'));var fs=require('fs');var Redis=require(_0x03da('0x4'));var db=require(_0x03da('0x5'))['db'];var utils=require(_0x03da('0x6'));var logger=require('../../config/logger')(_0x03da('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x03da('0x8')][_0x03da('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1be589,_0x5a5518,_0x29b16a){return new BPromise(function(_0x4d4a75,_0xc747ed){return client[_0x03da('0xa')](_0x1be589,_0x29b16a)[_0x03da('0xb')](function(_0x281465){logger[_0x03da('0xc')](_0x03da('0xd'),_0x5a5518,'request\x20sent');logger[_0x03da('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x5a5518,_0x03da('0xf'),JSON[_0x03da('0x10')](_0x281465));if(_0x281465[_0x03da('0x11')]){if(_0x281465['error'][_0x03da('0x12')]===0x1f4){logger[_0x03da('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5a5518,_0x281465[_0x03da('0x11')]['message']);return _0xc747ed(_0x281465[_0x03da('0x11')][_0x03da('0x13')]);}logger[_0x03da('0x11')](_0x03da('0xd'),_0x5a5518,_0x281465[_0x03da('0x11')]['message']);return _0x4d4a75(_0x281465[_0x03da('0x11')]['message']);}else{logger[_0x03da('0xc')](_0x03da('0xd'),_0x5a5518,_0x03da('0xf'));_0x4d4a75(_0x281465[_0x03da('0x14')][_0x03da('0x13')]);}})[_0x03da('0x15')](function(_0x1aa650){logger[_0x03da('0x11')](_0x03da('0xd'),_0x5a5518,_0x1aa650);_0xc747ed(_0x1aa650);});});} \ No newline at end of file +var _0x975a=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','stringify','error','JscriptyAnswerReport,\x20%s,\x20%s','message','result'];(function(_0x39f108,_0x2cdb80){var _0x443e86=function(_0x409e16){while(--_0x409e16){_0x39f108['push'](_0x39f108['shift']());}};_0x443e86(++_0x2cdb80);}(_0x975a,0x78));var _0xa975=function(_0x182026,_0xc20b43){_0x182026=_0x182026-0x0;var _0x69410f=_0x975a[_0x182026];return _0x69410f;};'use strict';var _=require('lodash');var util=require(_0xa975('0x0'));var moment=require(_0xa975('0x1'));var BPromise=require(_0xa975('0x2'));var rs=require(_0xa975('0x3'));var fs=require('fs');var Redis=require(_0xa975('0x4'));var db=require(_0xa975('0x5'))['db'];var utils=require(_0xa975('0x6'));var logger=require('../../config/logger')(_0xa975('0x7'));var config=require(_0xa975('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa975('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f21e1,_0x3928f,_0x2bbf0b){return new BPromise(function(_0x3b7aa8,_0x425b5f){return client[_0xa975('0xa')](_0x1f21e1,_0x2bbf0b)[_0xa975('0xb')](function(_0x824f36){logger[_0xa975('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3928f,_0xa975('0xd'));logger[_0xa975('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x3928f,'request\x20sent',JSON[_0xa975('0xf')](_0x824f36));if(_0x824f36[_0xa975('0x10')]){if(_0x824f36[_0xa975('0x10')]['code']===0x1f4){logger[_0xa975('0x10')](_0xa975('0x11'),_0x3928f,_0x824f36[_0xa975('0x10')][_0xa975('0x12')]);return _0x425b5f(_0x824f36[_0xa975('0x10')]['message']);}logger[_0xa975('0x10')](_0xa975('0x11'),_0x3928f,_0x824f36[_0xa975('0x10')][_0xa975('0x12')]);return _0x3b7aa8(_0x824f36[_0xa975('0x10')]['message']);}else{logger[_0xa975('0xc')](_0xa975('0x11'),_0x3928f,_0xa975('0xd'));_0x3b7aa8(_0x824f36[_0xa975('0x13')]['message']);}})['catch'](function(_0x4b1ab0){logger[_0xa975('0x10')](_0xa975('0x11'),_0x3928f,_0x4b1ab0);_0x425b5f(_0x4b1ab0);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 289f1c9..793eebb 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 _0x846f=['/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','getSummary','post','/:id/clone','clone','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','/:id','show'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x846f,0x174));var _0xf846=function(_0x2c089e,_0x157d0e){_0x2c089e=_0x2c089e-0x0;var _0x4b872c=_0x846f[_0x2c089e];return _0x4b872c;};'use strict';var multer=require(_0xf846('0x0'));var util=require(_0xf846('0x1'));var path=require(_0xf846('0x2'));var timeout=require(_0xf846('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf846('0x4'));var auth=require(_0xf846('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf846('0x6'));var controller=require(_0xf846('0x7'));router[_0xf846('0x8')]('/',auth[_0xf846('0x9')](),controller['index']);router[_0xf846('0x8')](_0xf846('0xa'),auth['isAuthenticated'](),controller[_0xf846('0xb')]);router[_0xf846('0x8')](_0xf846('0xc'),auth[_0xf846('0x9')](),controller[_0xf846('0xd')]);router[_0xf846('0x8')](_0xf846('0xe'),auth[_0xf846('0x9')](),controller[_0xf846('0xf')]);router['get'](_0xf846('0x10'),auth[_0xf846('0x9')](),timeout('30s'),controller[_0xf846('0x11')]);router[_0xf846('0x12')]('/',auth[_0xf846('0x9')](),controller['create']);router[_0xf846('0x12')](_0xf846('0x13'),auth[_0xf846('0x9')](),controller[_0xf846('0x14')]);router['put'](_0xf846('0xa'),auth[_0xf846('0x9')](),controller['update']);router[_0xf846('0x15')](_0xf846('0xa'),auth[_0xf846('0x9')](),controller[_0xf846('0x16')]);module[_0xf846('0x17')]=router; \ No newline at end of file +var _0x1811=['show','/:id/sessions','/:id/answers','getAnswers','/:id/summary','30s','post','/:id/clone','clone','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','get','isAuthenticated','index'];(function(_0xf31767,_0x381746){var _0x24bd0c=function(_0x3b3472){while(--_0x3b3472){_0xf31767['push'](_0xf31767['shift']());}};_0x24bd0c(++_0x381746);}(_0x1811,0x12e));var _0x1181=function(_0x502e15,_0x49ff8f){_0x502e15=_0x502e15-0x0;var _0xadd0c4=_0x1811[_0x502e15];return _0xadd0c4;};'use strict';var multer=require(_0x1181('0x0'));var util=require(_0x1181('0x1'));var path=require(_0x1181('0x2'));var timeout=require(_0x1181('0x3'));var express=require(_0x1181('0x4'));var router=express['Router']();var fs_extra=require(_0x1181('0x5'));var auth=require(_0x1181('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./jscriptyProject.controller');router[_0x1181('0x7')]('/',auth[_0x1181('0x8')](),controller[_0x1181('0x9')]);router[_0x1181('0x7')]('/:id',auth[_0x1181('0x8')](),controller[_0x1181('0xa')]);router['get'](_0x1181('0xb'),auth[_0x1181('0x8')](),controller['getSessions']);router['get'](_0x1181('0xc'),auth[_0x1181('0x8')](),controller[_0x1181('0xd')]);router[_0x1181('0x7')](_0x1181('0xe'),auth[_0x1181('0x8')](),timeout(_0x1181('0xf')),controller['getSummary']);router[_0x1181('0x10')]('/',auth[_0x1181('0x8')](),controller['create']);router['post'](_0x1181('0x11'),auth['isAuthenticated'](),controller[_0x1181('0x12')]);router[_0x1181('0x13')](_0x1181('0x14'),auth[_0x1181('0x8')](),controller[_0x1181('0x15')]);router[_0x1181('0x16')](_0x1181('0x14'),auth[_0x1181('0x8')](),controller['destroy']);module[_0x1181('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 1210eed..7e49ec6 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 _0x2103=['isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','lodash','util','exports','name','TEXT','long','isObjectLike','setDataValue','formData'];(function(_0x131dc5,_0x22be98){var _0xdbd0a2=function(_0x243fd2){while(--_0x243fd2){_0x131dc5['push'](_0x131dc5['shift']());}};_0xdbd0a2(++_0x22be98);}(_0x2103,0x122));var _0x3210=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x2103[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x3210('0x0'));var _=require(_0x3210('0x1'));var util=require(_0x3210('0x2'));module[_0x3210('0x3')]={'name':{'type':Sequelize['STRING'],'unique':_0x3210('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x3210('0x5')](_0x3210('0x6')),'set':function(_0x456a51){if(_[_0x3210('0x7')](_0x456a51)){this[_0x3210('0x8')](_0x3210('0x9'),JSON['stringify'](_0x456a51));}else if(_[_0x3210('0xa')](_0x456a51)){this['setDataValue'](_0x3210('0x9'),_0x456a51);}else{this[_0x3210('0x8')](_0x3210('0x9'),util[_0x3210('0xb')](_0x3210('0xc'),this[_0x3210('0xd')](_0x3210('0x4'))||'',this[_0x3210('0xd')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x3210('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0da5=['formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','lodash','util','STRING','name','TEXT','long','isObjectLike'];(function(_0x326c39,_0xc0573b){var _0xb9de86=function(_0x37b035){while(--_0x37b035){_0x326c39['push'](_0x326c39['shift']());}};_0xb9de86(++_0xc0573b);}(_0x0da5,0x116));var _0x50da=function(_0x50e26a,_0x2f7a08){_0x50e26a=_0x50e26a-0x0;var _0x34f013=_0x0da5[_0x50e26a];return _0x34f013;};'use strict';var Sequelize=require('sequelize');var _=require(_0x50da('0x0'));var util=require(_0x50da('0x1'));module['exports']={'name':{'type':Sequelize[_0x50da('0x2')],'unique':_0x50da('0x3')},'description':{'type':Sequelize[_0x50da('0x2')]},'formData':{'type':Sequelize[_0x50da('0x4')](_0x50da('0x5')),'set':function(_0x11a86){if(_[_0x50da('0x6')](_0x11a86)){this['setDataValue'](_0x50da('0x7'),JSON[_0x50da('0x8')](_0x11a86));}else if(_[_0x50da('0x9')](_0x11a86)){this['setDataValue'](_0x50da('0x7'),_0x11a86);}else{this['setDataValue'](_0x50da('0x7'),util[_0x50da('0xa')](_0x50da('0xb'),this[_0x50da('0xc')](_0x50da('0x3'))||'',this[_0x50da('0xc')](_0x50da('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x50da('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x50da('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 acf8b63..db31152 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 _0xc30e=['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','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','error','stack','name','index','JscriptyProject','rawAttributes','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','findAll','rows','show','params','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','clone','includeAll','find','omit','createdAt','updatedAt','userProfileId','findOne','JscriptySessionReport','ProjectId','getAnswers','JscriptyAnswerReport','number','toString','indexOf','replace','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','sendStatus','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x54f820,_0x1024b1){var _0x23ce5b=function(_0x310118){while(--_0x310118){_0x54f820['push'](_0x54f820['shift']());}};_0x23ce5b(++_0x1024b1);}(_0xc30e,0x15a));var _0xec30=function(_0x1e8e6f,_0x3c8242){_0x1e8e6f=_0x1e8e6f-0x0;var _0x2fbc91=_0xc30e[_0x1e8e6f];return _0x2fbc91;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xec30('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xec30('0x1'));var rp=require(_0xec30('0x2'));var moment=require(_0xec30('0x3'));var BPromise=require(_0xec30('0x4'));var Mustache=require(_0xec30('0x5'));var util=require(_0xec30('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xec30('0x7'));var ejs=require(_0xec30('0x8'));var fs=require('fs');var fs_extra=require(_0xec30('0x9'));var _=require(_0xec30('0xa'));var squel=require(_0xec30('0xb'));var crypto=require(_0xec30('0xc'));var jsforce=require(_0xec30('0xd'));var deskjs=require(_0xec30('0xe'));var toCsv=require(_0xec30('0x7'));var querystring=require(_0xec30('0xf'));var Papa=require(_0xec30('0x10'));var Redis=require(_0xec30('0x11'));var authService=require(_0xec30('0x12'));var qs=require(_0xec30('0x13'));var as=require(_0xec30('0x14'));var hardwareService=require(_0xec30('0x15'));var logger=require(_0xec30('0x16'))('api');var utils=require(_0xec30('0x17'));var config=require(_0xec30('0x18'));var licenseUtil=require(_0xec30('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12a2e5,_0x48929a){_0x48929a=_0x48929a||0xcc;return function(_0x160460){if(_0x160460){return _0x12a2e5['sendStatus'](_0x48929a);}return _0x12a2e5['status'](_0x48929a)[_0xec30('0x1a')]();};}function respondWithResult(_0x3bdad7,_0x17643e){_0x17643e=_0x17643e||0xc8;return function(_0x16bea5){if(_0x16bea5){return _0x3bdad7[_0xec30('0x1b')](_0x17643e)[_0xec30('0x1c')](_0x16bea5);}};}function respondWithFilteredResult(_0x152f8a,_0xa25259){return function(_0x2fa25d){if(_0x2fa25d){var _0x404296=typeof _0xa25259[_0xec30('0x1d')]===_0xec30('0x1e')&&typeof _0xa25259[_0xec30('0x1f')]===_0xec30('0x1e');var _0x1a194c=_0x2fa25d[_0xec30('0x20')];var _0x560ef9=_0x404296?0x0:_0xa25259[_0xec30('0x1d')];var _0xf54119=_0x404296?_0x2fa25d['count']:_0xa25259[_0xec30('0x1d')]+_0xa25259[_0xec30('0x1f')];var _0x3bca8c;if(_0xf54119>=_0x1a194c){_0xf54119=_0x1a194c;_0x3bca8c=0xc8;}else{_0x3bca8c=0xce;}_0x152f8a[_0xec30('0x1b')](_0x3bca8c);return _0x152f8a[_0xec30('0x21')](_0xec30('0x22'),_0x560ef9+'-'+_0xf54119+'/'+_0x1a194c)[_0xec30('0x1c')](_0x2fa25d);}return null;};}function patchUpdates(_0x451bd8){return function(_0x28cd1b){try{jsonpatch[_0xec30('0x23')](_0x28cd1b,_0x451bd8,!![]);}catch(_0x57b9cd){return BPromise[_0xec30('0x24')](_0x57b9cd);}return _0x28cd1b[_0xec30('0x25')]();};}function saveUpdates(_0x118b81,_0x529b7c){return function(_0xf48b58){if(_0xf48b58){return _0xf48b58[_0xec30('0x26')](_0x118b81)[_0xec30('0x27')](function(_0x414157){return _0x414157;});}return null;};}function removeEntity(_0x2120d5,_0x35f2cc){return function(_0x11a53c){if(_0x11a53c){return _0x11a53c[_0xec30('0x28')]()[_0xec30('0x27')](function(){var _0x998a55=_0x11a53c[_0xec30('0x29')]({'plain':!![]});var _0x2ff56c=_0xec30('0x2a');return db[_0xec30('0x2b')][_0xec30('0x28')]({'where':{'type':_0x2ff56c,'resourceId':_0x998a55['id']}})[_0xec30('0x27')](function(){return _0x11a53c;});})[_0xec30('0x27')](function(){_0x2120d5[_0xec30('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x155a84,_0x62b2d4){return function(_0x52c569){if(!_0x52c569){_0x155a84['sendStatus'](0x194);}return _0x52c569;};}function handleError(_0x5ef494,_0x21c7ae){_0x21c7ae=_0x21c7ae||0x1f4;return function(_0x75b95b){logger[_0xec30('0x2c')](_0x75b95b[_0xec30('0x2d')]);if(_0x75b95b[_0xec30('0x2e')]){delete _0x75b95b[_0xec30('0x2e')];}_0x5ef494[_0xec30('0x1b')](_0x21c7ae)['send'](_0x75b95b);};}exports[_0xec30('0x2f')]=function(_0x256fd4,_0x1b2f00){var _0xa78d61={},_0x299c23={},_0x4ebf94={'count':0x0,'rows':[]};var _0x140ab8=_['map'](db[_0xec30('0x30')][_0xec30('0x31')],function(_0x406140){return{'name':_0x406140['fieldName'],'type':_0x406140['type'][_0xec30('0x32')]};});_0x299c23[_0xec30('0x33')]=_[_0xec30('0x34')](_0x140ab8,'name');_0x299c23[_0xec30('0x35')]=_[_0xec30('0x36')](_0x256fd4[_0xec30('0x35')]);_0x299c23['filters']=_[_0xec30('0x37')](_0x299c23['model'],_0x299c23[_0xec30('0x35')]);_0xa78d61[_0xec30('0x38')]=_['intersection'](_0x299c23['model'],qs[_0xec30('0x39')](_0x256fd4[_0xec30('0x35')]['fields']));_0xa78d61['attributes']=_0xa78d61[_0xec30('0x38')][_0xec30('0x3a')]?_0xa78d61[_0xec30('0x38')]:_0x299c23[_0xec30('0x33')];if(!_0x256fd4[_0xec30('0x35')][_0xec30('0x3b')](_0xec30('0x3c'))){_0xa78d61[_0xec30('0x1f')]=qs[_0xec30('0x1f')](_0x256fd4[_0xec30('0x35')][_0xec30('0x1f')]);_0xa78d61['offset']=qs[_0xec30('0x1d')](_0x256fd4['query']['offset']);}_0xa78d61[_0xec30('0x3d')]=qs[_0xec30('0x3e')](_0x256fd4[_0xec30('0x35')][_0xec30('0x3e')]);_0xa78d61[_0xec30('0x3f')]=qs['filters'](_[_0xec30('0x40')](_0x256fd4['query'],_0x299c23[_0xec30('0x41')]),_0x140ab8);if(_0x256fd4[_0xec30('0x35')]['filter']){_0xa78d61[_0xec30('0x3f')]=_[_0xec30('0x42')](_0xa78d61[_0xec30('0x3f')],{'$or':_['map'](_0x140ab8,function(_0x5945c1){if(_0x5945c1['type']!==_0xec30('0x43')){var _0x31d906={};_0x31d906[_0x5945c1[_0xec30('0x2e')]]={'$like':'%'+_0x256fd4[_0xec30('0x35')][_0xec30('0x44')]+'%'};return _0x31d906;}})});}_0xa78d61=_[_0xec30('0x42')]({},_0xa78d61,_0x256fd4[_0xec30('0x45')]);var _0x581424={'where':_0xa78d61[_0xec30('0x3f')]};return db[_0xec30('0x30')][_0xec30('0x20')](_0x581424)[_0xec30('0x27')](function(_0x334c01){_0x4ebf94[_0xec30('0x20')]=_0x334c01;if(_0x256fd4[_0xec30('0x35')]['includeAll']){_0xa78d61['include']=[{'all':!![]}];}return db[_0xec30('0x30')][_0xec30('0x46')](_0xa78d61);})[_0xec30('0x27')](function(_0x56baa4){_0x4ebf94[_0xec30('0x47')]=_0x56baa4;return _0x4ebf94;})[_0xec30('0x27')](respondWithFilteredResult(_0x1b2f00,_0xa78d61))['catch'](handleError(_0x1b2f00,null));};exports[_0xec30('0x48')]=function(_0x58b249,_0x3f8997){var _0x1e25b7={'raw':![],'where':{'id':_0x58b249[_0xec30('0x49')]['id']}},_0x4915df={};_0x4915df['model']=_[_0xec30('0x36')](db[_0xec30('0x30')]['rawAttributes']);_0x4915df[_0xec30('0x35')]=_[_0xec30('0x36')](_0x58b249[_0xec30('0x35')]);_0x4915df[_0xec30('0x41')]=_['intersection'](_0x4915df[_0xec30('0x33')],_0x4915df[_0xec30('0x35')]);_0x1e25b7[_0xec30('0x38')]=_['intersection'](_0x4915df['model'],qs['fields'](_0x58b249[_0xec30('0x35')][_0xec30('0x39')]));_0x1e25b7[_0xec30('0x38')]=_0x1e25b7[_0xec30('0x38')]['length']?_0x1e25b7['attributes']:_0x4915df[_0xec30('0x33')];if(_0x58b249[_0xec30('0x35')]['includeAll']){_0x1e25b7[_0xec30('0x4a')]=[{'all':!![]}];}_0x1e25b7=_[_0xec30('0x42')]({},_0x1e25b7,_0x58b249['options']);return db[_0xec30('0x30')]['find'](_0x1e25b7)[_0xec30('0x27')](handleEntityNotFound(_0x3f8997,null))[_0xec30('0x27')](respondWithResult(_0x3f8997,null))[_0xec30('0x4b')](handleError(_0x3f8997,null));};exports[_0xec30('0x4c')]=function(_0x1194cf,_0x4993c0){return db['JscriptyProject']['create'](_0x1194cf[_0xec30('0x4d')],{})[_0xec30('0x27')](function(_0x20b4d1){var _0x3b6fca=_0x1194cf[_0xec30('0x4e')][_0xec30('0x29')]({'plain':!![]});if(!_0x3b6fca)throw new Error(_0xec30('0x4f'));if(_0x3b6fca[_0xec30('0x50')]===_0xec30('0x4e')){var _0x1151e3=_0x20b4d1[_0xec30('0x29')]({'plain':!![]});var _0x431d55=_0xec30('0x2a');return db[_0xec30('0x51')]['find']({'where':{'name':_0x431d55,'userProfileId':_0x3b6fca['userProfileId']},'raw':!![]})[_0xec30('0x27')](function(_0x34278e){if(_0x34278e&&_0x34278e[_0xec30('0x52')]===0x0){return db[_0xec30('0x2b')]['create']({'name':_0x1151e3['name'],'resourceId':_0x1151e3['id'],'type':_0x34278e[_0xec30('0x2e')],'sectionId':_0x34278e['id']},{})[_0xec30('0x27')](function(){return _0x20b4d1;});}else{return _0x20b4d1;}})[_0xec30('0x4b')](function(_0x4aa618){logger[_0xec30('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4aa618);throw _0x4aa618;});}return _0x20b4d1;})[_0xec30('0x27')](respondWithResult(_0x4993c0,0xc9))[_0xec30('0x4b')](handleError(_0x4993c0,null));};exports[_0xec30('0x53')]=function(_0x3f8340,_0x453cc6){var _0x4b39aa={'where':{'id':_0x3f8340[_0xec30('0x49')]['id']}},_0x1e113d={};_0x1e113d[_0xec30('0x33')]=_[_0xec30('0x36')](db[_0xec30('0x30')][_0xec30('0x31')]);_0x4b39aa[_0xec30('0x38')]=_[_0xec30('0x37')](_0x1e113d['model'],qs[_0xec30('0x39')](_0x3f8340[_0xec30('0x35')][_0xec30('0x39')]));_0x4b39aa['attributes']=_0x4b39aa['attributes']['length']?_0x4b39aa[_0xec30('0x38')]:_0x1e113d[_0xec30('0x33')];if(_0x3f8340[_0xec30('0x35')][_0xec30('0x54')]){_0x4b39aa[_0xec30('0x4a')]=[{'all':!![]}];}_0x4b39aa=_[_0xec30('0x42')]({},_0x4b39aa,_0x3f8340[_0xec30('0x45')]);return db[_0xec30('0x30')][_0xec30('0x55')](_0x4b39aa)[_0xec30('0x27')](handleEntityNotFound(_0x453cc6,null))[_0xec30('0x27')](function(_0x29e072){if(_0x29e072){var _0x21d94c=_0x29e072[_0xec30('0x29')]({'plain':!![]});_0x21d94c=qs[_0xec30('0x56')](_0x21d94c,['id',_0xec30('0x57'),_0xec30('0x58')]);_0x3f8340[_0xec30('0x4d')]=_[_0xec30('0x56')](_0x3f8340[_0xec30('0x4d')],['id',_0xec30('0x57'),_0xec30('0x58')]);return db['JscriptyProject'][_0xec30('0x4c')](_[_0xec30('0x42')](_0x21d94c,_0x3f8340[_0xec30('0x4d')]),{'include':_0x3f8340[_0xec30('0x35')][_0xec30('0x54')]?[{'all':!![]}]:undefined})[_0xec30('0x27')](function(_0x3f51c9){var _0x5c668d=_0x3f8340['user']['get']({'plain':!![]});if(!_0x5c668d)throw new Error(_0xec30('0x4f'));if(_0x5c668d[_0xec30('0x50')]===_0xec30('0x4e')){var _0x542fc3=_0x3f51c9['get']({'plain':!![]});var _0x2068a7=_0xec30('0x2a');return db[_0xec30('0x51')][_0xec30('0x55')]({'where':{'name':_0x2068a7,'userProfileId':_0x5c668d[_0xec30('0x59')]},'raw':!![]})[_0xec30('0x27')](function(_0x395a7a){if(_0x395a7a&&_0x395a7a[_0xec30('0x52')]===0x0){return db[_0xec30('0x2b')][_0xec30('0x4c')]({'name':_0x542fc3['name'],'resourceId':_0x542fc3['id'],'type':_0x395a7a[_0xec30('0x2e')],'sectionId':_0x395a7a['id']},{})[_0xec30('0x27')](function(){return _0x3f51c9;});}else{return _0x3f51c9;}})[_0xec30('0x4b')](function(_0x25bf56){logger[_0xec30('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x25bf56);throw _0x25bf56;});}return _0x3f51c9;});}})[_0xec30('0x27')](respondWithResult(_0x453cc6,0xc9))[_0xec30('0x4b')](handleError(_0x453cc6,null));};exports[_0xec30('0x26')]=function(_0x762333,_0x480267){if(_0x762333[_0xec30('0x4d')]['id']){delete _0x762333[_0xec30('0x4d')]['id'];}return db['JscriptyProject'][_0xec30('0x55')]({'where':{'id':_0x762333[_0xec30('0x49')]['id']}})[_0xec30('0x27')](handleEntityNotFound(_0x480267,null))[_0xec30('0x27')](saveUpdates(_0x762333[_0xec30('0x4d')],null))[_0xec30('0x27')](respondWithResult(_0x480267,null))[_0xec30('0x4b')](handleError(_0x480267,null));};exports[_0xec30('0x28')]=function(_0x3fdf2f,_0x124720){return db[_0xec30('0x30')][_0xec30('0x55')]({'where':{'id':_0x3fdf2f['params']['id']}})['then'](handleEntityNotFound(_0x124720,null))['then'](removeEntity(_0x124720,null))['catch'](handleError(_0x124720,null));};exports['getSessions']=function(_0x495639,_0x38623b,_0x2576c1){var _0x3434bb={'raw':!![],'where':{}};var _0x1445bc={};var _0x5bca63={'count':0x0,'rows':[]};return db[_0xec30('0x30')][_0xec30('0x5a')]({'where':{'id':_0x495639[_0xec30('0x49')]['id']}})[_0xec30('0x27')](handleEntityNotFound(_0x38623b,null))['then'](function(_0x954a8f){if(_0x954a8f){_0x1445bc[_0xec30('0x33')]=_[_0xec30('0x36')](db[_0xec30('0x5b')][_0xec30('0x31')]);_0x1445bc[_0xec30('0x35')]=_[_0xec30('0x36')](_0x495639[_0xec30('0x35')]);_0x1445bc[_0xec30('0x41')]=_[_0xec30('0x37')](_0x1445bc[_0xec30('0x33')],_0x1445bc[_0xec30('0x35')]);_0x3434bb[_0xec30('0x38')]=_[_0xec30('0x37')](_0x1445bc[_0xec30('0x33')],qs[_0xec30('0x39')](_0x495639[_0xec30('0x35')][_0xec30('0x39')]));_0x3434bb[_0xec30('0x38')]=_0x3434bb[_0xec30('0x38')]['length']?_0x3434bb[_0xec30('0x38')]:_0x1445bc[_0xec30('0x33')];if(!_0x495639['query'][_0xec30('0x3b')](_0xec30('0x3c'))){_0x3434bb[_0xec30('0x1f')]=qs[_0xec30('0x1f')](_0x495639['query'][_0xec30('0x1f')]);_0x3434bb[_0xec30('0x1d')]=qs[_0xec30('0x1d')](_0x495639['query'][_0xec30('0x1d')]);}_0x3434bb[_0xec30('0x3d')]=qs[_0xec30('0x3e')](_0x495639[_0xec30('0x35')]['sort']);_0x3434bb[_0xec30('0x3f')]=qs['filters'](_['pick'](_0x495639[_0xec30('0x35')],_0x1445bc[_0xec30('0x41')]));_0x3434bb['where'][_0xec30('0x5c')]=_0x954a8f['id'];if(_0x495639[_0xec30('0x35')][_0xec30('0x44')]){_0x3434bb[_0xec30('0x3f')]=_[_0xec30('0x42')](_0x3434bb[_0xec30('0x3f')],{'$or':_[_0xec30('0x34')](_0x3434bb[_0xec30('0x38')],function(_0x4477de){var _0x3fb751={};_0x3fb751[_0x4477de]={'$like':'%'+_0x495639[_0xec30('0x35')][_0xec30('0x44')]+'%'};return _0x3fb751;})});}_0x3434bb=_['merge']({},_0x3434bb,_0x495639[_0xec30('0x45')]);return db[_0xec30('0x5b')][_0xec30('0x20')]({'where':_0x3434bb[_0xec30('0x3f')]})[_0xec30('0x27')](function(_0x2f89b8){_0x5bca63[_0xec30('0x20')]=_0x2f89b8;if(_0x495639[_0xec30('0x35')][_0xec30('0x54')]){_0x3434bb['include']=[{'all':!![]}];}return db[_0xec30('0x5b')][_0xec30('0x46')](_0x3434bb);})[_0xec30('0x27')](function(_0x3531e8){_0x5bca63[_0xec30('0x47')]=_0x3531e8;return _0x5bca63;});}})['then'](respondWithFilteredResult(_0x38623b,_0x3434bb))[_0xec30('0x4b')](handleError(_0x38623b,null));};exports[_0xec30('0x5d')]=function(_0x345a2f,_0x50904b,_0x224098){var _0x524667={'raw':!![],'where':{}};var _0x1b0719={};var _0x20fd86={'count':0x0,'rows':[]};return db[_0xec30('0x30')]['findOne']({'where':{'id':_0x345a2f['params']['id']}})[_0xec30('0x27')](handleEntityNotFound(_0x50904b,null))[_0xec30('0x27')](function(_0x56bfbc){if(_0x56bfbc){_0x1b0719[_0xec30('0x33')]=_['keys'](db[_0xec30('0x5e')][_0xec30('0x31')]);_0x1b0719['query']=_[_0xec30('0x36')](_0x345a2f[_0xec30('0x35')]);_0x1b0719[_0xec30('0x41')]=_[_0xec30('0x37')](_0x1b0719[_0xec30('0x33')],_0x1b0719['query']);_0x524667['attributes']=_[_0xec30('0x37')](_0x1b0719[_0xec30('0x33')],qs[_0xec30('0x39')](_0x345a2f[_0xec30('0x35')][_0xec30('0x39')]));_0x524667[_0xec30('0x38')]=_0x524667[_0xec30('0x38')][_0xec30('0x3a')]?_0x524667[_0xec30('0x38')]:_0x1b0719['model'];if(!_0x345a2f[_0xec30('0x35')][_0xec30('0x3b')]('nolimit')){_0x524667[_0xec30('0x1f')]=qs['limit'](_0x345a2f[_0xec30('0x35')][_0xec30('0x1f')]);_0x524667['offset']=qs[_0xec30('0x1d')](_0x345a2f['query'][_0xec30('0x1d')]);}_0x524667['order']=qs[_0xec30('0x3e')](_0x345a2f[_0xec30('0x35')]['sort']);_0x524667[_0xec30('0x3f')]=qs[_0xec30('0x41')](_[_0xec30('0x40')](_0x345a2f[_0xec30('0x35')],_0x1b0719[_0xec30('0x41')]));_0x524667[_0xec30('0x3f')]['ProjectId']=_0x56bfbc['id'];if(_0x345a2f[_0xec30('0x35')][_0xec30('0x44')]){_0x524667[_0xec30('0x3f')]=_[_0xec30('0x42')](_0x524667[_0xec30('0x3f')],{'$or':_[_0xec30('0x34')](_0x524667[_0xec30('0x38')],function(_0x2cc45f){var _0x44ee08={};_0x44ee08[_0x2cc45f]={'$like':'%'+_0x345a2f[_0xec30('0x35')][_0xec30('0x44')]+'%'};return _0x44ee08;})});}_0x524667=_[_0xec30('0x42')]({},_0x524667,_0x345a2f[_0xec30('0x45')]);return db[_0xec30('0x5e')]['count']({'where':_0x524667[_0xec30('0x3f')]})[_0xec30('0x27')](function(_0x50cc63){_0x20fd86[_0xec30('0x20')]=_0x50cc63;if(_0x345a2f[_0xec30('0x35')]['includeAll']){_0x524667[_0xec30('0x4a')]=[{'all':!![]}];}return db[_0xec30('0x5e')][_0xec30('0x46')](_0x524667);})['then'](function(_0x430ddc){_0x20fd86[_0xec30('0x47')]=_0x430ddc;return _0x20fd86;});}})[_0xec30('0x27')](respondWithFilteredResult(_0x50904b,_0x524667))[_0xec30('0x4b')](handleError(_0x50904b,null));};function char(_0x2152b9){return _0xec30('0x5f')===typeof _0x2152b9?String['fromCharCode'][_0xec30('0x23')](null,arguments):_0x2152b9;}function needsEncapsulation(_0x24ca88){return!!_0x24ca88&&(_0x24ca88[_0xec30('0x60')]()[_0xec30('0x61')](char(0xd))>=0x0||_0x24ca88['toString']()['indexOf'](char(0xa))>=0x0||_0x24ca88[_0xec30('0x60')]()[_0xec30('0x61')](char(0x2c))>=0x0||_0x24ca88[_0xec30('0x60')]()[_0xec30('0x61')](char(0x22))>=0x0);}function encapsulate(_0x3de0c5){var _0x1c18a0=char(0x22),_0x45ac68='\x5c'+char(0x22),_0x2e9dd2=_0x3de0c5[_0xec30('0x60')]()[_0xec30('0x62')](new RegExp(_0x1c18a0,'g'),_0x45ac68);return _0x1c18a0+_0x2e9dd2+_0x1c18a0;}exports['getSummary']=function(_0x4f669c,_0x383583,_0x4b9a7a){var _0x8a213e,_0x24f077;var _0x2d915c={'where':{'ProjectId':_0x4f669c[_0xec30('0x49')]['id']}};if(_0x4f669c[_0xec30('0x35')][_0xec30('0x63')]){_0x2d915c['where']['starttime']=JSON[_0xec30('0x64')](_0x4f669c[_0xec30('0x35')]['startTime']);}return db[_0xec30('0x5b')]['findAll'](_0x2d915c)[_0xec30('0x27')](handleEntityNotFound(_0x383583,null))['then'](function(_0x3db3bb){if(_0x3db3bb){_0x8a213e=_0x3db3bb;return db[_0xec30('0x65')]['findAll']({'where':{'SessionId':{'$in':_[_0xec30('0x34')](_0x8a213e,'id')},'ProjectId':_0x4f669c[_0xec30('0x49')]['id']},'order':_0xec30('0x66')});}})['then'](handleEntityNotFound(_0x383583,null))['then'](function(_0x571693){if(_0x571693){_0x24f077=_0x571693;var _0x1c169e={};for(var _0x204c5d=0x0,_0x29ed7d=_0x24f077[_0xec30('0x3a')];_0x204c5d<_0x29ed7d;_0x204c5d++){if(!_0x1c169e['hasOwnProperty'](_0x24f077[_0x204c5d][_0xec30('0x67')])){_0x1c169e[_0x24f077[_0x204c5d][_0xec30('0x67')]]=needsEncapsulation(_0x24f077[_0x204c5d][_0xec30('0x68')])?encapsulate(_0x24f077[_0x204c5d][_0xec30('0x68')]):_0x24f077[_0x204c5d][_0xec30('0x68')];}}var _0x9f20d8=[],_0x45ad3c={};for(var _0x41180c=0x0,_0x46beb8=_0x8a213e['length'];_0x41180c<_0x46beb8;_0x41180c++){_0x45ad3c={'ProjectId':_0x4f669c[_0xec30('0x49')]['id'],'SessionId':_0x8a213e[_0x41180c]['id'],'StartTime':moment(_0x8a213e[_0x41180c][_0xec30('0x69')])[_0xec30('0x6a')](_0xec30('0x6b'))};for(var _0x519577=0x0,_0x2f358a=_0x24f077['length'];_0x519577<_0x2f358a;_0x519577++){if(_0x24f077[_0x519577]['SessionId']==_0x8a213e[_0x41180c]['id']&&_0x1c169e['hasOwnProperty'](_0x24f077[_0x519577][_0xec30('0x67')])){_0x45ad3c[_0x1c169e[_0x24f077[_0x519577][_0xec30('0x67')]]]=_0x24f077[_0x519577][_0xec30('0x6c')];}}for(var _0x461755 in _0x1c169e){if(!_0x45ad3c['hasOwnProperty'](_0x1c169e[_0x461755])){_0x45ad3c[_0x1c169e[_0x461755]]=null;}}_0x9f20d8[_0xec30('0x6d')](_0x45ad3c);}return _0x9f20d8;}})[_0xec30('0x27')](function(_0x3d950e){if(!_[_0xec30('0x6e')](_0x3d950e)){var _0x44bec5=toCsv(_0x3d950e);var _0x3199c9=Date[_0xec30('0x6f')]();fs[_0xec30('0x70')](util[_0xec30('0x6a')](_0xec30('0x71'),_0x4f669c[_0xec30('0x49')]['id'],_0x3199c9),_0x44bec5);_0x383583[_0xec30('0x72')](_0xec30('0x73'),'attachment;\x20filename='+util[_0xec30('0x6a')](_0xec30('0x74'),_0x4f669c[_0xec30('0x49')]['id'],_0x3199c9));_0x383583[_0xec30('0x72')]('Content-type',_0xec30('0x75'));return _0x383583[_0xec30('0x76')](util['format'](_0xec30('0x71'),_0x4f669c[_0xec30('0x49')]['id'],_0x3199c9));}else{return _0x383583[_0xec30('0x77')](0xcc);}})[_0xec30('0x4b')](handleError(_0x383583,null));}; \ No newline at end of file +var _0xe11d=['answer','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','Content-Range','apply','reject','update','then','Projects','UserProfileResource','destroy','error','stack','name','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','clone','params','createdAt','updatedAt','omit','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','JscriptySessionReport','hasOwnProperty','ProjectId','rows','getAnswers','pick','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','parse','startTime','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId'];(function(_0x15569e,_0x39fa26){var _0x404aa7=function(_0xb12b0a){while(--_0xb12b0a){_0x15569e['push'](_0x15569e['shift']());}};_0x404aa7(++_0x39fa26);}(_0xe11d,0x1eb));var _0xde11=function(_0x16fce5,_0x281c65){_0x16fce5=_0x16fce5-0x0;var _0x389b46=_0xe11d[_0x16fce5];return _0x389b46;};'use strict';var emlformat=require(_0xde11('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xde11('0x1'));var jsonpatch=require(_0xde11('0x2'));var rp=require(_0xde11('0x3'));var moment=require('moment');var BPromise=require(_0xde11('0x4'));var Mustache=require(_0xde11('0x5'));var util=require(_0xde11('0x6'));var path=require(_0xde11('0x7'));var sox=require(_0xde11('0x8'));var csv=require(_0xde11('0x9'));var ejs=require(_0xde11('0xa'));var fs=require('fs');var fs_extra=require(_0xde11('0xb'));var _=require('lodash');var squel=require(_0xde11('0xc'));var crypto=require(_0xde11('0xd'));var jsforce=require(_0xde11('0xe'));var deskjs=require(_0xde11('0xf'));var toCsv=require(_0xde11('0x9'));var querystring=require('querystring');var Papa=require(_0xde11('0x10'));var Redis=require(_0xde11('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xde11('0x12'));var hardwareService=require(_0xde11('0x13'));var logger=require(_0xde11('0x14'))(_0xde11('0x15'));var utils=require(_0xde11('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xde11('0x17'));var db=require(_0xde11('0x18'))['db'];function respondWithStatusCode(_0x27bdb2,_0x4c892a){_0x4c892a=_0x4c892a||0xcc;return function(_0x4971e7){if(_0x4971e7){return _0x27bdb2[_0xde11('0x19')](_0x4c892a);}return _0x27bdb2[_0xde11('0x1a')](_0x4c892a)[_0xde11('0x1b')]();};}function respondWithResult(_0x10f8c2,_0x7008ec){_0x7008ec=_0x7008ec||0xc8;return function(_0x49b68e){if(_0x49b68e){return _0x10f8c2[_0xde11('0x1a')](_0x7008ec)['json'](_0x49b68e);}};}function respondWithFilteredResult(_0x39c5f3,_0x4d5439){return function(_0x57dd88){if(_0x57dd88){var _0x17c1ea=typeof _0x4d5439['offset']==='undefined'&&typeof _0x4d5439[_0xde11('0x1c')]===_0xde11('0x1d');var _0x4fb962=_0x57dd88['count'];var _0x5717cd=_0x17c1ea?0x0:_0x4d5439['offset'];var _0x416c5e=_0x17c1ea?_0x57dd88[_0xde11('0x1e')]:_0x4d5439[_0xde11('0x1f')]+_0x4d5439[_0xde11('0x1c')];var _0x2763fb;if(_0x416c5e>=_0x4fb962){_0x416c5e=_0x4fb962;_0x2763fb=0xc8;}else{_0x2763fb=0xce;}_0x39c5f3['status'](_0x2763fb);return _0x39c5f3['set'](_0xde11('0x20'),_0x5717cd+'-'+_0x416c5e+'/'+_0x4fb962)['json'](_0x57dd88);}return null;};}function patchUpdates(_0x1f2656){return function(_0x2029c1){try{jsonpatch[_0xde11('0x21')](_0x2029c1,_0x1f2656,!![]);}catch(_0x36c7d5){return BPromise[_0xde11('0x22')](_0x36c7d5);}return _0x2029c1['save']();};}function saveUpdates(_0x2ba473,_0x289e2e){return function(_0x1fb8c7){if(_0x1fb8c7){return _0x1fb8c7[_0xde11('0x23')](_0x2ba473)[_0xde11('0x24')](function(_0x285187){return _0x285187;});}return null;};}function removeEntity(_0x425f2f,_0xd1b362){return function(_0x54e20e){if(_0x54e20e){return _0x54e20e['destroy']()[_0xde11('0x24')](function(){var _0x183ff1=_0x54e20e['get']({'plain':!![]});var _0x1a3600=_0xde11('0x25');return db[_0xde11('0x26')][_0xde11('0x27')]({'where':{'type':_0x1a3600,'resourceId':_0x183ff1['id']}})['then'](function(){return _0x54e20e;});})[_0xde11('0x24')](function(){_0x425f2f[_0xde11('0x1a')](0xcc)[_0xde11('0x1b')]();});}};}function handleEntityNotFound(_0x4ad5ec,_0x1918f9){return function(_0x3e8fb9){if(!_0x3e8fb9){_0x4ad5ec['sendStatus'](0x194);}return _0x3e8fb9;};}function handleError(_0x30cf39,_0x1528fc){_0x1528fc=_0x1528fc||0x1f4;return function(_0x1976a3){logger[_0xde11('0x28')](_0x1976a3[_0xde11('0x29')]);if(_0x1976a3[_0xde11('0x2a')]){delete _0x1976a3[_0xde11('0x2a')];}_0x30cf39[_0xde11('0x1a')](_0x1528fc)['send'](_0x1976a3);};}exports[_0xde11('0x2b')]=function(_0x4e576e,_0x3700cb){var _0x24e573={},_0x1aa465={},_0x2ff130={'count':0x0,'rows':[]};var _0x503b16=_[_0xde11('0x2c')](db[_0xde11('0x2d')][_0xde11('0x2e')],function(_0x13f173){return{'name':_0x13f173[_0xde11('0x2f')],'type':_0x13f173[_0xde11('0x30')][_0xde11('0x31')]};});_0x1aa465[_0xde11('0x32')]=_['map'](_0x503b16,_0xde11('0x2a'));_0x1aa465[_0xde11('0x33')]=_[_0xde11('0x34')](_0x4e576e['query']);_0x1aa465[_0xde11('0x35')]=_[_0xde11('0x36')](_0x1aa465['model'],_0x1aa465['query']);_0x24e573[_0xde11('0x37')]=_['intersection'](_0x1aa465[_0xde11('0x32')],qs[_0xde11('0x38')](_0x4e576e['query'][_0xde11('0x38')]));_0x24e573['attributes']=_0x24e573['attributes'][_0xde11('0x39')]?_0x24e573['attributes']:_0x1aa465[_0xde11('0x32')];if(!_0x4e576e['query']['hasOwnProperty'](_0xde11('0x3a'))){_0x24e573[_0xde11('0x1c')]=qs[_0xde11('0x1c')](_0x4e576e[_0xde11('0x33')][_0xde11('0x1c')]);_0x24e573['offset']=qs[_0xde11('0x1f')](_0x4e576e['query'][_0xde11('0x1f')]);}_0x24e573[_0xde11('0x3b')]=qs[_0xde11('0x3c')](_0x4e576e[_0xde11('0x33')][_0xde11('0x3c')]);_0x24e573[_0xde11('0x3d')]=qs[_0xde11('0x35')](_['pick'](_0x4e576e[_0xde11('0x33')],_0x1aa465['filters']),_0x503b16);if(_0x4e576e[_0xde11('0x33')][_0xde11('0x3e')]){_0x24e573[_0xde11('0x3d')]=_[_0xde11('0x3f')](_0x24e573[_0xde11('0x3d')],{'$or':_['map'](_0x503b16,function(_0x552b82){if(_0x552b82['type']!==_0xde11('0x40')){var _0x30b233={};_0x30b233[_0x552b82[_0xde11('0x2a')]]={'$like':'%'+_0x4e576e[_0xde11('0x33')][_0xde11('0x3e')]+'%'};return _0x30b233;}})});}_0x24e573=_[_0xde11('0x3f')]({},_0x24e573,_0x4e576e[_0xde11('0x41')]);var _0x2788df={'where':_0x24e573['where']};return db[_0xde11('0x2d')][_0xde11('0x1e')](_0x2788df)[_0xde11('0x24')](function(_0x1df1e1){_0x2ff130[_0xde11('0x1e')]=_0x1df1e1;if(_0x4e576e['query'][_0xde11('0x42')]){_0x24e573[_0xde11('0x43')]=[{'all':!![]}];}return db[_0xde11('0x2d')][_0xde11('0x44')](_0x24e573);})[_0xde11('0x24')](function(_0x1360df){_0x2ff130['rows']=_0x1360df;return _0x2ff130;})[_0xde11('0x24')](respondWithFilteredResult(_0x3700cb,_0x24e573))[_0xde11('0x45')](handleError(_0x3700cb,null));};exports['show']=function(_0x1bcbc2,_0x37c31a){var _0x337db1={'raw':![],'where':{'id':_0x1bcbc2['params']['id']}},_0x78ae79={};_0x78ae79[_0xde11('0x32')]=_['keys'](db[_0xde11('0x2d')][_0xde11('0x2e')]);_0x78ae79['query']=_['keys'](_0x1bcbc2[_0xde11('0x33')]);_0x78ae79[_0xde11('0x35')]=_['intersection'](_0x78ae79[_0xde11('0x32')],_0x78ae79[_0xde11('0x33')]);_0x337db1[_0xde11('0x37')]=_['intersection'](_0x78ae79[_0xde11('0x32')],qs[_0xde11('0x38')](_0x1bcbc2[_0xde11('0x33')][_0xde11('0x38')]));_0x337db1[_0xde11('0x37')]=_0x337db1[_0xde11('0x37')][_0xde11('0x39')]?_0x337db1['attributes']:_0x78ae79[_0xde11('0x32')];if(_0x1bcbc2['query'][_0xde11('0x42')]){_0x337db1['include']=[{'all':!![]}];}_0x337db1=_['merge']({},_0x337db1,_0x1bcbc2[_0xde11('0x41')]);return db[_0xde11('0x2d')][_0xde11('0x46')](_0x337db1)[_0xde11('0x24')](handleEntityNotFound(_0x37c31a,null))[_0xde11('0x24')](respondWithResult(_0x37c31a,null))[_0xde11('0x45')](handleError(_0x37c31a,null));};exports[_0xde11('0x47')]=function(_0x570f25,_0x42f4f6){return db[_0xde11('0x2d')][_0xde11('0x47')](_0x570f25[_0xde11('0x48')],{})[_0xde11('0x24')](function(_0x416970){var _0x5d016f=_0x570f25[_0xde11('0x49')][_0xde11('0x4a')]({'plain':!![]});if(!_0x5d016f)throw new Error(_0xde11('0x4b'));if(_0x5d016f[_0xde11('0x4c')]===_0xde11('0x49')){var _0x41b134=_0x416970[_0xde11('0x4a')]({'plain':!![]});var _0x3eb497='Projects';return db[_0xde11('0x4d')][_0xde11('0x46')]({'where':{'name':_0x3eb497,'userProfileId':_0x5d016f[_0xde11('0x4e')]},'raw':!![]})[_0xde11('0x24')](function(_0x3148d6){if(_0x3148d6&&_0x3148d6[_0xde11('0x4f')]===0x0){return db[_0xde11('0x26')][_0xde11('0x47')]({'name':_0x41b134[_0xde11('0x2a')],'resourceId':_0x41b134['id'],'type':_0x3148d6[_0xde11('0x2a')],'sectionId':_0x3148d6['id']},{})[_0xde11('0x24')](function(){return _0x416970;});}else{return _0x416970;}})[_0xde11('0x45')](function(_0x5a36b1){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a36b1);throw _0x5a36b1;});}return _0x416970;})['then'](respondWithResult(_0x42f4f6,0xc9))['catch'](handleError(_0x42f4f6,null));};exports[_0xde11('0x50')]=function(_0x41aa0c,_0xad248c){var _0x2ae5aa={'where':{'id':_0x41aa0c[_0xde11('0x51')]['id']}},_0x4231b0={};_0x4231b0[_0xde11('0x32')]=_[_0xde11('0x34')](db[_0xde11('0x2d')]['rawAttributes']);_0x2ae5aa[_0xde11('0x37')]=_[_0xde11('0x36')](_0x4231b0['model'],qs[_0xde11('0x38')](_0x41aa0c['query'][_0xde11('0x38')]));_0x2ae5aa['attributes']=_0x2ae5aa['attributes'][_0xde11('0x39')]?_0x2ae5aa[_0xde11('0x37')]:_0x4231b0['model'];if(_0x41aa0c[_0xde11('0x33')][_0xde11('0x42')]){_0x2ae5aa['include']=[{'all':!![]}];}_0x2ae5aa=_['merge']({},_0x2ae5aa,_0x41aa0c[_0xde11('0x41')]);return db[_0xde11('0x2d')][_0xde11('0x46')](_0x2ae5aa)[_0xde11('0x24')](handleEntityNotFound(_0xad248c,null))[_0xde11('0x24')](function(_0x17132e){if(_0x17132e){var _0x403aa9=_0x17132e[_0xde11('0x4a')]({'plain':!![]});_0x403aa9=qs['omit'](_0x403aa9,['id',_0xde11('0x52'),_0xde11('0x53')]);_0x41aa0c['body']=_[_0xde11('0x54')](_0x41aa0c[_0xde11('0x48')],['id',_0xde11('0x52'),_0xde11('0x53')]);return db[_0xde11('0x2d')][_0xde11('0x47')](_[_0xde11('0x3f')](_0x403aa9,_0x41aa0c[_0xde11('0x48')]),{'include':_0x41aa0c[_0xde11('0x33')][_0xde11('0x42')]?[{'all':!![]}]:undefined})[_0xde11('0x24')](function(_0x1556bc){var _0x20a742=_0x41aa0c[_0xde11('0x49')]['get']({'plain':!![]});if(!_0x20a742)throw new Error(_0xde11('0x4b'));if(_0x20a742[_0xde11('0x4c')]===_0xde11('0x49')){var _0x47000c=_0x1556bc['get']({'plain':!![]});var _0x5a6bed=_0xde11('0x25');return db[_0xde11('0x4d')][_0xde11('0x46')]({'where':{'name':_0x5a6bed,'userProfileId':_0x20a742[_0xde11('0x4e')]},'raw':!![]})[_0xde11('0x24')](function(_0xe18b88){if(_0xe18b88&&_0xe18b88[_0xde11('0x4f')]===0x0){return db[_0xde11('0x26')][_0xde11('0x47')]({'name':_0x47000c[_0xde11('0x2a')],'resourceId':_0x47000c['id'],'type':_0xe18b88[_0xde11('0x2a')],'sectionId':_0xe18b88['id']},{})['then'](function(){return _0x1556bc;});}else{return _0x1556bc;}})[_0xde11('0x45')](function(_0x94f152){logger[_0xde11('0x28')](_0xde11('0x55'),_0x94f152);throw _0x94f152;});}return _0x1556bc;});}})[_0xde11('0x24')](respondWithResult(_0xad248c,0xc9))[_0xde11('0x45')](handleError(_0xad248c,null));};exports[_0xde11('0x23')]=function(_0x170ced,_0x9d61a0){if(_0x170ced[_0xde11('0x48')]['id']){delete _0x170ced[_0xde11('0x48')]['id'];}return db[_0xde11('0x2d')][_0xde11('0x46')]({'where':{'id':_0x170ced[_0xde11('0x51')]['id']}})[_0xde11('0x24')](handleEntityNotFound(_0x9d61a0,null))[_0xde11('0x24')](saveUpdates(_0x170ced['body'],null))[_0xde11('0x24')](respondWithResult(_0x9d61a0,null))[_0xde11('0x45')](handleError(_0x9d61a0,null));};exports[_0xde11('0x27')]=function(_0x520c85,_0x52c41b){return db[_0xde11('0x2d')][_0xde11('0x46')]({'where':{'id':_0x520c85[_0xde11('0x51')]['id']}})[_0xde11('0x24')](handleEntityNotFound(_0x52c41b,null))[_0xde11('0x24')](removeEntity(_0x52c41b,null))[_0xde11('0x45')](handleError(_0x52c41b,null));};exports[_0xde11('0x56')]=function(_0xfd36a,_0xb90ed9,_0x18ffed){var _0x13a7e9={'raw':!![],'where':{}};var _0x227898={};var _0x3cb0c1={'count':0x0,'rows':[]};return db[_0xde11('0x2d')][_0xde11('0x57')]({'where':{'id':_0xfd36a['params']['id']}})[_0xde11('0x24')](handleEntityNotFound(_0xb90ed9,null))[_0xde11('0x24')](function(_0x2b9148){if(_0x2b9148){_0x227898[_0xde11('0x32')]=_[_0xde11('0x34')](db[_0xde11('0x58')][_0xde11('0x2e')]);_0x227898[_0xde11('0x33')]=_[_0xde11('0x34')](_0xfd36a[_0xde11('0x33')]);_0x227898[_0xde11('0x35')]=_[_0xde11('0x36')](_0x227898['model'],_0x227898[_0xde11('0x33')]);_0x13a7e9['attributes']=_[_0xde11('0x36')](_0x227898['model'],qs[_0xde11('0x38')](_0xfd36a['query'][_0xde11('0x38')]));_0x13a7e9[_0xde11('0x37')]=_0x13a7e9[_0xde11('0x37')]['length']?_0x13a7e9[_0xde11('0x37')]:_0x227898[_0xde11('0x32')];if(!_0xfd36a[_0xde11('0x33')][_0xde11('0x59')](_0xde11('0x3a'))){_0x13a7e9[_0xde11('0x1c')]=qs[_0xde11('0x1c')](_0xfd36a[_0xde11('0x33')]['limit']);_0x13a7e9[_0xde11('0x1f')]=qs[_0xde11('0x1f')](_0xfd36a[_0xde11('0x33')][_0xde11('0x1f')]);}_0x13a7e9[_0xde11('0x3b')]=qs[_0xde11('0x3c')](_0xfd36a[_0xde11('0x33')][_0xde11('0x3c')]);_0x13a7e9['where']=qs[_0xde11('0x35')](_['pick'](_0xfd36a[_0xde11('0x33')],_0x227898[_0xde11('0x35')]));_0x13a7e9[_0xde11('0x3d')][_0xde11('0x5a')]=_0x2b9148['id'];if(_0xfd36a['query']['filter']){_0x13a7e9[_0xde11('0x3d')]=_[_0xde11('0x3f')](_0x13a7e9['where'],{'$or':_[_0xde11('0x2c')](_0x13a7e9[_0xde11('0x37')],function(_0x42082c){var _0x3b6430={};_0x3b6430[_0x42082c]={'$like':'%'+_0xfd36a[_0xde11('0x33')]['filter']+'%'};return _0x3b6430;})});}_0x13a7e9=_[_0xde11('0x3f')]({},_0x13a7e9,_0xfd36a[_0xde11('0x41')]);return db['JscriptySessionReport']['count']({'where':_0x13a7e9['where']})[_0xde11('0x24')](function(_0x357409){_0x3cb0c1[_0xde11('0x1e')]=_0x357409;if(_0xfd36a['query'][_0xde11('0x42')]){_0x13a7e9['include']=[{'all':!![]}];}return db[_0xde11('0x58')][_0xde11('0x44')](_0x13a7e9);})[_0xde11('0x24')](function(_0x238f9e){_0x3cb0c1[_0xde11('0x5b')]=_0x238f9e;return _0x3cb0c1;});}})[_0xde11('0x24')](respondWithFilteredResult(_0xb90ed9,_0x13a7e9))['catch'](handleError(_0xb90ed9,null));};exports[_0xde11('0x5c')]=function(_0x4b7877,_0x2e25e1,_0x468338){var _0x2a3ad2={'raw':!![],'where':{}};var _0xc3743={};var _0x5f5ab4={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xde11('0x57')]({'where':{'id':_0x4b7877[_0xde11('0x51')]['id']}})[_0xde11('0x24')](handleEntityNotFound(_0x2e25e1,null))[_0xde11('0x24')](function(_0x40d3e7){if(_0x40d3e7){_0xc3743[_0xde11('0x32')]=_['keys'](db['JscriptyAnswerReport'][_0xde11('0x2e')]);_0xc3743[_0xde11('0x33')]=_[_0xde11('0x34')](_0x4b7877[_0xde11('0x33')]);_0xc3743[_0xde11('0x35')]=_['intersection'](_0xc3743['model'],_0xc3743[_0xde11('0x33')]);_0x2a3ad2[_0xde11('0x37')]=_[_0xde11('0x36')](_0xc3743[_0xde11('0x32')],qs[_0xde11('0x38')](_0x4b7877[_0xde11('0x33')]['fields']));_0x2a3ad2[_0xde11('0x37')]=_0x2a3ad2[_0xde11('0x37')][_0xde11('0x39')]?_0x2a3ad2[_0xde11('0x37')]:_0xc3743[_0xde11('0x32')];if(!_0x4b7877[_0xde11('0x33')][_0xde11('0x59')]('nolimit')){_0x2a3ad2[_0xde11('0x1c')]=qs[_0xde11('0x1c')](_0x4b7877[_0xde11('0x33')][_0xde11('0x1c')]);_0x2a3ad2[_0xde11('0x1f')]=qs[_0xde11('0x1f')](_0x4b7877[_0xde11('0x33')][_0xde11('0x1f')]);}_0x2a3ad2[_0xde11('0x3b')]=qs[_0xde11('0x3c')](_0x4b7877['query'][_0xde11('0x3c')]);_0x2a3ad2[_0xde11('0x3d')]=qs['filters'](_[_0xde11('0x5d')](_0x4b7877[_0xde11('0x33')],_0xc3743[_0xde11('0x35')]));_0x2a3ad2[_0xde11('0x3d')][_0xde11('0x5a')]=_0x40d3e7['id'];if(_0x4b7877[_0xde11('0x33')][_0xde11('0x3e')]){_0x2a3ad2[_0xde11('0x3d')]=_[_0xde11('0x3f')](_0x2a3ad2['where'],{'$or':_[_0xde11('0x2c')](_0x2a3ad2[_0xde11('0x37')],function(_0x335551){var _0x1ad7da={};_0x1ad7da[_0x335551]={'$like':'%'+_0x4b7877[_0xde11('0x33')]['filter']+'%'};return _0x1ad7da;})});}_0x2a3ad2=_['merge']({},_0x2a3ad2,_0x4b7877[_0xde11('0x41')]);return db[_0xde11('0x5e')][_0xde11('0x1e')]({'where':_0x2a3ad2[_0xde11('0x3d')]})[_0xde11('0x24')](function(_0x5e4de6){_0x5f5ab4['count']=_0x5e4de6;if(_0x4b7877[_0xde11('0x33')]['includeAll']){_0x2a3ad2[_0xde11('0x43')]=[{'all':!![]}];}return db[_0xde11('0x5e')]['findAll'](_0x2a3ad2);})[_0xde11('0x24')](function(_0x4e68e0){_0x5f5ab4[_0xde11('0x5b')]=_0x4e68e0;return _0x5f5ab4;});}})[_0xde11('0x24')](respondWithFilteredResult(_0x2e25e1,_0x2a3ad2))[_0xde11('0x45')](handleError(_0x2e25e1,null));};function char(_0x16b1c1){return _0xde11('0x5f')===typeof _0x16b1c1?String[_0xde11('0x60')][_0xde11('0x21')](null,arguments):_0x16b1c1;}function needsEncapsulation(_0x5b2841){return!!_0x5b2841&&(_0x5b2841[_0xde11('0x61')]()[_0xde11('0x62')](char(0xd))>=0x0||_0x5b2841[_0xde11('0x61')]()[_0xde11('0x62')](char(0xa))>=0x0||_0x5b2841[_0xde11('0x61')]()[_0xde11('0x62')](char(0x2c))>=0x0||_0x5b2841[_0xde11('0x61')]()[_0xde11('0x62')](char(0x22))>=0x0);}function encapsulate(_0x5a133f){var _0x4e8f0f=char(0x22),_0xec764d='\x5c'+char(0x22),_0x3ac4d1=_0x5a133f[_0xde11('0x61')]()[_0xde11('0x63')](new RegExp(_0x4e8f0f,'g'),_0xec764d);return _0x4e8f0f+_0x3ac4d1+_0x4e8f0f;}exports[_0xde11('0x64')]=function(_0x2d8c7d,_0x2941e4,_0x5e9b1d){var _0x361d54,_0x3dbfb8;var _0x461126={'where':{'ProjectId':_0x2d8c7d[_0xde11('0x51')]['id']}};if(_0x2d8c7d['query']['startTime']){_0x461126[_0xde11('0x3d')]['starttime']=JSON[_0xde11('0x65')](_0x2d8c7d[_0xde11('0x33')][_0xde11('0x66')]);}return db[_0xde11('0x58')][_0xde11('0x44')](_0x461126)[_0xde11('0x24')](handleEntityNotFound(_0x2941e4,null))[_0xde11('0x24')](function(_0x1069ee){if(_0x1069ee){_0x361d54=_0x1069ee;return db['JscriptyQuestionReport'][_0xde11('0x44')]({'where':{'SessionId':{'$in':_['map'](_0x361d54,'id')},'ProjectId':_0x2d8c7d['params']['id']},'order':_0xde11('0x67')});}})[_0xde11('0x24')](handleEntityNotFound(_0x2941e4,null))['then'](function(_0x57508d){if(_0x57508d){_0x3dbfb8=_0x57508d;var _0x4fb5f4={};for(var _0x1d3cf4=0x0,_0x537b88=_0x3dbfb8[_0xde11('0x39')];_0x1d3cf4<_0x537b88;_0x1d3cf4++){if(!_0x4fb5f4[_0xde11('0x59')](_0x3dbfb8[_0x1d3cf4][_0xde11('0x68')])){_0x4fb5f4[_0x3dbfb8[_0x1d3cf4][_0xde11('0x68')]]=needsEncapsulation(_0x3dbfb8[_0x1d3cf4][_0xde11('0x69')])?encapsulate(_0x3dbfb8[_0x1d3cf4][_0xde11('0x69')]):_0x3dbfb8[_0x1d3cf4][_0xde11('0x69')];}}var _0x5d4fb0=[],_0x4739c4={};for(var _0x4430e8=0x0,_0x312db4=_0x361d54[_0xde11('0x39')];_0x4430e8<_0x312db4;_0x4430e8++){_0x4739c4={'ProjectId':_0x2d8c7d[_0xde11('0x51')]['id'],'SessionId':_0x361d54[_0x4430e8]['id'],'StartTime':moment(_0x361d54[_0x4430e8]['starttime'])[_0xde11('0x6a')](_0xde11('0x6b'))};for(var _0x3b95c8=0x0,_0x44a3c3=_0x3dbfb8['length'];_0x3b95c8<_0x44a3c3;_0x3b95c8++){if(_0x3dbfb8[_0x3b95c8][_0xde11('0x6c')]==_0x361d54[_0x4430e8]['id']&&_0x4fb5f4[_0xde11('0x59')](_0x3dbfb8[_0x3b95c8]['questionId'])){_0x4739c4[_0x4fb5f4[_0x3dbfb8[_0x3b95c8]['questionId']]]=_0x3dbfb8[_0x3b95c8][_0xde11('0x6d')];}}for(var _0x5dbdf6 in _0x4fb5f4){if(!_0x4739c4[_0xde11('0x59')](_0x4fb5f4[_0x5dbdf6])){_0x4739c4[_0x4fb5f4[_0x5dbdf6]]=null;}}_0x5d4fb0['push'](_0x4739c4);}return _0x5d4fb0;}})['then'](function(_0x485c66){if(!_[_0xde11('0x6e')](_0x485c66)){var _0xf7e700=toCsv(_0x485c66);var _0x1c26f3=Date[_0xde11('0x6f')]();fs[_0xde11('0x70')](util[_0xde11('0x6a')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x2d8c7d[_0xde11('0x51')]['id'],_0x1c26f3),_0xf7e700);_0x2941e4[_0xde11('0x71')](_0xde11('0x72'),_0xde11('0x73')+util['format'](_0xde11('0x74'),_0x2d8c7d[_0xde11('0x51')]['id'],_0x1c26f3));_0x2941e4[_0xde11('0x71')](_0xde11('0x75'),_0xde11('0x76'));return _0x2941e4[_0xde11('0x77')](util[_0xde11('0x6a')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x2d8c7d[_0xde11('0x51')]['id'],_0x1c26f3));}else{return _0x2941e4['sendStatus'](0xcc);}})['catch'](handleError(_0x2941e4,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index a3ac151..0fa74b9 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 _0xe292=['request-promise','path','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','../../config/logger','api'];(function(_0x38c147,_0x27602d){var _0x25f103=function(_0x444e29){while(--_0x444e29){_0x38c147['push'](_0x38c147['shift']());}};_0x25f103(++_0x27602d);}(_0xe292,0x19e));var _0x2e29=function(_0x20b8b6,_0x5be6e0){_0x20b8b6=_0x20b8b6-0x0;var _0x5e0c53=_0xe292[_0x20b8b6];return _0x5e0c53;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2e29('0x0'))(_0x2e29('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2e29('0x2'));var fs=require('fs');var path=require(_0x2e29('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2e29('0x4'));module['exports']=function(_0x5bd6cc,_0xcdccd7){return _0x5bd6cc[_0x2e29('0x5')](_0x2e29('0x6'),attributes,{'tableName':_0x2e29('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf88f=['jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyProject.attributes','define','JscriptyProject'];(function(_0x4fd46c,_0x509045){var _0x55f53e=function(_0x2beaff){while(--_0x2beaff){_0x4fd46c['push'](_0x4fd46c['shift']());}};_0x55f53e(++_0x509045);}(_0xf88f,0x1bb));var _0xff88=function(_0x30b301,_0x275dea){_0x30b301=_0x30b301-0x0;var _0x2c83ed=_0xf88f[_0x30b301];return _0x2c83ed;};'use strict';var _=require(_0xff88('0x0'));var util=require(_0xff88('0x1'));var logger=require(_0xff88('0x2'))(_0xff88('0x3'));var moment=require(_0xff88('0x4'));var BPromise=require(_0xff88('0x5'));var rp=require(_0xff88('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xff88('0x7'));var config=require(_0xff88('0x8'));var attributes=require(_0xff88('0x9'));module['exports']=function(_0x38e1df,_0x406a2e){return _0x38e1df[_0xff88('0xa')](_0xff88('0xb'),attributes,{'tableName':_0xff88('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 3390ceb..543569f 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 _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xdebb9,_0x6e6caa){var _0x241d91=function(_0x1510b0){while(--_0x1510b0){_0xdebb9['push'](_0xdebb9['shift']());}};_0x241d91(++_0x6e6caa);}(_0x70e0,0x17b));var _0x070e=function(_0x524b92,_0x54ebe5){_0x524b92=_0x524b92-0x0;var _0x170bdc=_0x70e0[_0x524b92];return _0x170bdc;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xda3f=['rpc','jayson/promise','client','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0xda3f,0xec));var _0xfda3=function(_0x14bddd,_0x2422ed){_0x14bddd=_0x14bddd-0x0;var _0x412749=_0xda3f[_0x14bddd];return _0x412749;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index a4759b2..af635cc 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 _0x1515=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','post','create','update'];(function(_0x3a7576,_0xabfeb2){var _0x3d13cb=function(_0x341b30){while(--_0x341b30){_0x3a7576['push'](_0x3a7576['shift']());}};_0x3d13cb(++_0xabfeb2);}(_0x1515,0x1d1));var _0x5151=function(_0x5bca20,_0x37e530){_0x5bca20=_0x5bca20-0x0;var _0x40f5f5=_0x1515[_0x5bca20];return _0x40f5f5;};'use strict';var multer=require(_0x5151('0x0'));var util=require(_0x5151('0x1'));var path=require(_0x5151('0x2'));var timeout=require(_0x5151('0x3'));var express=require(_0x5151('0x4'));var router=express[_0x5151('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5151('0x6'));var interaction=require(_0x5151('0x7'));var config=require(_0x5151('0x8'));var controller=require('./jscriptyQuestionReport.controller');router[_0x5151('0x9')]('/',auth['isAuthenticated'](),controller[_0x5151('0xa')]);router[_0x5151('0x9')](_0x5151('0xb'),auth[_0x5151('0xc')](),controller[_0x5151('0xd')]);router[_0x5151('0x9')](_0x5151('0xe'),auth[_0x5151('0xc')](),controller['show']);router[_0x5151('0xf')]('/',auth['isAuthenticated'](),controller[_0x5151('0x10')]);router['put'](_0x5151('0xe'),auth[_0x5151('0xc')](),controller[_0x5151('0x11')]);router[_0x5151('0x12')]('/:id',auth[_0x5151('0xc')](),controller[_0x5151('0x13')]);module[_0x5151('0x14')]=router; \ No newline at end of file +var _0xb702=['create','put','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post'];(function(_0x5e6bec,_0x1eb54d){var _0x5dc5cf=function(_0x59429a){while(--_0x59429a){_0x5e6bec['push'](_0x5e6bec['shift']());}};_0x5dc5cf(++_0x1eb54d);}(_0xb702,0x1d1));var _0x2b70=function(_0x1afabf,_0x56fdcc){_0x1afabf=_0x1afabf-0x0;var _0x497ff1=_0xb702[_0x1afabf];return _0x497ff1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2b70('0x0'));var timeout=require(_0x2b70('0x1'));var express=require(_0x2b70('0x2'));var router=express[_0x2b70('0x3')]();var fs_extra=require(_0x2b70('0x4'));var auth=require(_0x2b70('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2b70('0x6'));var controller=require(_0x2b70('0x7'));router[_0x2b70('0x8')]('/',auth[_0x2b70('0x9')](),controller['index']);router[_0x2b70('0x8')](_0x2b70('0xa'),auth[_0x2b70('0x9')](),controller[_0x2b70('0xb')]);router[_0x2b70('0x8')](_0x2b70('0xc'),auth[_0x2b70('0x9')](),controller[_0x2b70('0xd')]);router[_0x2b70('0xe')]('/',auth[_0x2b70('0x9')](),controller[_0x2b70('0xf')]);router[_0x2b70('0x10')]('/:id',auth[_0x2b70('0x9')](),controller[_0x2b70('0x11')]);router['delete']('/:id',auth[_0x2b70('0x9')](),controller[_0x2b70('0x12')]);module[_0x2b70('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index c8a6a83..62bab6a 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x7a54,0x106));var _0x47a5=function(_0x113b58,_0x23d404){_0x113b58=_0x113b58-0x0;var _0x257db6=_0x7a54[_0x113b58];return _0x257db6;};'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(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x7a54,0x106));var _0x47a5=function(_0x1a42d8,_0xc091d6){_0x1a42d8=_0x1a42d8-0x0;var _0x2d21af=_0x7a54[_0x1a42d8];return _0x2d21af;};'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 85660fb..66ae724 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 _0x7717=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','end','error','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','length','merge','find','body','update','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x5c1067,_0x571972){var _0x39f5a5=function(_0x83854d){while(--_0x83854d){_0x5c1067['push'](_0x5c1067['shift']());}};_0x39f5a5(++_0x571972);}(_0x7717,0xc9));var _0x7771=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x7717[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0x7771('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7771('0x1'));var jsonpatch=require(_0x7771('0x2'));var rp=require('request-promise');var moment=require(_0x7771('0x3'));var BPromise=require(_0x7771('0x4'));var Mustache=require(_0x7771('0x5'));var util=require('util');var path=require(_0x7771('0x6'));var sox=require(_0x7771('0x7'));var csv=require(_0x7771('0x8'));var ejs=require(_0x7771('0x9'));var fs=require('fs');var fs_extra=require(_0x7771('0xa'));var _=require(_0x7771('0xb'));var squel=require(_0x7771('0xc'));var crypto=require(_0x7771('0xd'));var jsforce=require(_0x7771('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7771('0xf'));var Redis=require(_0x7771('0x10'));var authService=require(_0x7771('0x11'));var qs=require(_0x7771('0x12'));var as=require(_0x7771('0x13'));var hardwareService=require(_0x7771('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7771('0x15'));var db=require(_0x7771('0x16'))['db'];function respondWithStatusCode(_0x41ea8d,_0x383ab4){_0x383ab4=_0x383ab4||0xcc;return function(_0x52993a){if(_0x52993a){return _0x41ea8d[_0x7771('0x17')](_0x383ab4);}return _0x41ea8d[_0x7771('0x18')](_0x383ab4)['end']();};}function respondWithResult(_0x1cc283,_0x5cf4d4){_0x5cf4d4=_0x5cf4d4||0xc8;return function(_0x4d9e65){if(_0x4d9e65){return _0x1cc283['status'](_0x5cf4d4)[_0x7771('0x19')](_0x4d9e65);}};}function respondWithFilteredResult(_0x25c3b1,_0x23a442){return function(_0x3defd8){if(_0x3defd8){var _0xd9253b=typeof _0x23a442[_0x7771('0x1a')]==='undefined'&&typeof _0x23a442['limit']===_0x7771('0x1b');var _0x587c85=_0x3defd8[_0x7771('0x1c')];var _0x54935d=_0xd9253b?0x0:_0x23a442['offset'];var _0x44e8bc=_0xd9253b?_0x3defd8[_0x7771('0x1c')]:_0x23a442[_0x7771('0x1a')]+_0x23a442[_0x7771('0x1d')];var _0x5f198a;if(_0x44e8bc>=_0x587c85){_0x44e8bc=_0x587c85;_0x5f198a=0xc8;}else{_0x5f198a=0xce;}_0x25c3b1[_0x7771('0x18')](_0x5f198a);return _0x25c3b1[_0x7771('0x1e')](_0x7771('0x1f'),_0x54935d+'-'+_0x44e8bc+'/'+_0x587c85)['json'](_0x3defd8);}return null;};}function patchUpdates(_0x2ecd2e){return function(_0x5ca346){try{jsonpatch[_0x7771('0x20')](_0x5ca346,_0x2ecd2e,!![]);}catch(_0x583d55){return BPromise[_0x7771('0x21')](_0x583d55);}return _0x5ca346['save']();};}function saveUpdates(_0x1d96bd,_0x123a36){return function(_0x2f306a){if(_0x2f306a){return _0x2f306a['update'](_0x1d96bd)[_0x7771('0x22')](function(_0x25df94){return _0x25df94;});}return null;};}function removeEntity(_0x50a93d,_0x37c5b9){return function(_0x1322f7){if(_0x1322f7){return _0x1322f7[_0x7771('0x23')]()['then'](function(){_0x50a93d[_0x7771('0x18')](0xcc)[_0x7771('0x24')]();});}};}function handleEntityNotFound(_0x1e586e,_0x17ee87){return function(_0x5b2340){if(!_0x5b2340){_0x1e586e[_0x7771('0x17')](0x194);}return _0x5b2340;};}function handleError(_0x1497ec,_0x446e98){_0x446e98=_0x446e98||0x1f4;return function(_0x4a62d9){logger[_0x7771('0x25')](_0x4a62d9['stack']);if(_0x4a62d9[_0x7771('0x26')]){delete _0x4a62d9[_0x7771('0x26')];}_0x1497ec['status'](_0x446e98)[_0x7771('0x27')](_0x4a62d9);};}exports[_0x7771('0x28')]=function(_0x4431bf,_0x5577b1){var _0x5708ce={},_0x5b3bbf={},_0x53e4d3={'count':0x0,'rows':[]};var _0x143ac9=_[_0x7771('0x29')](db[_0x7771('0x2a')][_0x7771('0x2b')],function(_0x3beb6a){return{'name':_0x3beb6a[_0x7771('0x2c')],'type':_0x3beb6a[_0x7771('0x2d')]['key']};});_0x5b3bbf[_0x7771('0x2e')]=_[_0x7771('0x29')](_0x143ac9,'name');_0x5b3bbf[_0x7771('0x2f')]=_[_0x7771('0x30')](_0x4431bf['query']);_0x5b3bbf['filters']=_['intersection'](_0x5b3bbf[_0x7771('0x2e')],_0x5b3bbf[_0x7771('0x2f')]);_0x5708ce[_0x7771('0x31')]=_[_0x7771('0x32')](_0x5b3bbf[_0x7771('0x2e')],qs[_0x7771('0x33')](_0x4431bf[_0x7771('0x2f')][_0x7771('0x33')]));_0x5708ce[_0x7771('0x31')]=_0x5708ce['attributes']['length']?_0x5708ce[_0x7771('0x31')]:_0x5b3bbf['model'];if(!_0x4431bf['query'][_0x7771('0x34')](_0x7771('0x35'))){_0x5708ce[_0x7771('0x1d')]=qs[_0x7771('0x1d')](_0x4431bf[_0x7771('0x2f')][_0x7771('0x1d')]);_0x5708ce[_0x7771('0x1a')]=qs[_0x7771('0x1a')](_0x4431bf['query']['offset']);}_0x5708ce['order']=qs[_0x7771('0x36')](_0x4431bf[_0x7771('0x2f')][_0x7771('0x36')]);_0x5708ce[_0x7771('0x37')]=qs[_0x7771('0x38')](_[_0x7771('0x39')](_0x4431bf[_0x7771('0x2f')],_0x5b3bbf['filters']),_0x143ac9);if(_0x4431bf[_0x7771('0x2f')][_0x7771('0x3a')]){_0x5708ce[_0x7771('0x37')]=_['merge'](_0x5708ce[_0x7771('0x37')],{'$or':_[_0x7771('0x29')](_0x143ac9,function(_0x10b946){if(_0x10b946[_0x7771('0x2d')]!==_0x7771('0x3b')){var _0x4c8a33={};_0x4c8a33[_0x10b946[_0x7771('0x26')]]={'$like':'%'+_0x4431bf[_0x7771('0x2f')]['filter']+'%'};return _0x4c8a33;}})});}_0x5708ce=_['merge']({},_0x5708ce,_0x4431bf['options']);var _0x33de69={'where':_0x5708ce[_0x7771('0x37')]};return db[_0x7771('0x2a')][_0x7771('0x1c')](_0x33de69)[_0x7771('0x22')](function(_0x1829f3){_0x53e4d3['count']=_0x1829f3;if(_0x4431bf[_0x7771('0x2f')][_0x7771('0x3c')]){_0x5708ce[_0x7771('0x3d')]=[{'all':!![]}];}return db[_0x7771('0x2a')][_0x7771('0x3e')](_0x5708ce);})[_0x7771('0x22')](function(_0x3e929a){_0x53e4d3[_0x7771('0x3f')]=_0x3e929a;return _0x53e4d3;})['then'](respondWithFilteredResult(_0x5577b1,_0x5708ce))[_0x7771('0x40')](handleError(_0x5577b1,null));};exports[_0x7771('0x41')]=function(_0x2662f7,_0x3beffe){var _0x3335a7={'raw':!![],'where':{'id':_0x2662f7['params']['id']}},_0x5671ad={};_0x5671ad[_0x7771('0x2e')]=_[_0x7771('0x30')](db[_0x7771('0x2a')][_0x7771('0x2b')]);_0x5671ad[_0x7771('0x2f')]=_[_0x7771('0x30')](_0x2662f7[_0x7771('0x2f')]);_0x5671ad['filters']=_[_0x7771('0x32')](_0x5671ad[_0x7771('0x2e')],_0x5671ad['query']);_0x3335a7[_0x7771('0x31')]=_[_0x7771('0x32')](_0x5671ad[_0x7771('0x2e')],qs[_0x7771('0x33')](_0x2662f7[_0x7771('0x2f')][_0x7771('0x33')]));_0x3335a7[_0x7771('0x31')]=_0x3335a7[_0x7771('0x31')][_0x7771('0x42')]?_0x3335a7[_0x7771('0x31')]:_0x5671ad[_0x7771('0x2e')];if(_0x2662f7[_0x7771('0x2f')]['includeAll']){_0x3335a7[_0x7771('0x3d')]=[{'all':!![]}];}_0x3335a7=_[_0x7771('0x43')]({},_0x3335a7,_0x2662f7['options']);return db[_0x7771('0x2a')][_0x7771('0x44')](_0x3335a7)[_0x7771('0x22')](handleEntityNotFound(_0x3beffe,null))[_0x7771('0x22')](respondWithResult(_0x3beffe,null))[_0x7771('0x40')](handleError(_0x3beffe,null));};exports['create']=function(_0xb856ce,_0x5e3c7c){return db[_0x7771('0x2a')]['create'](_0xb856ce[_0x7771('0x45')],{})[_0x7771('0x22')](respondWithResult(_0x5e3c7c,0xc9))['catch'](handleError(_0x5e3c7c,null));};exports[_0x7771('0x46')]=function(_0x2a4288,_0x665f7c){if(_0x2a4288[_0x7771('0x45')]['id']){delete _0x2a4288[_0x7771('0x45')]['id'];}return db[_0x7771('0x2a')][_0x7771('0x44')]({'where':{'id':_0x2a4288['params']['id']}})[_0x7771('0x22')](handleEntityNotFound(_0x665f7c,null))[_0x7771('0x22')](saveUpdates(_0x2a4288['body'],null))[_0x7771('0x22')](respondWithResult(_0x665f7c,null))[_0x7771('0x40')](handleError(_0x665f7c,null));};exports[_0x7771('0x23')]=function(_0x2dd6b3,_0x531018){return db['JscriptyQuestionReport'][_0x7771('0x44')]({'where':{'id':_0x2dd6b3['params']['id']}})[_0x7771('0x22')](handleEntityNotFound(_0x531018,null))[_0x7771('0x22')](removeEntity(_0x531018,null))[_0x7771('0x40')](handleError(_0x531018,null));};exports[_0x7771('0x47')]=function(_0x697089,_0x3a2b9d){return db[_0x7771('0x2a')]['describe']()['then'](respondWithResult(_0x3a2b9d,null))[_0x7771('0x40')](handleError(_0x3a2b9d,null));}; \ No newline at end of file +var _0x584d=['where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','length','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort'];(function(_0x12946d,_0x5dfeaa){var _0x544591=function(_0x1e56de){while(--_0x1e56de){_0x12946d['push'](_0x12946d['shift']());}};_0x544591(++_0x5dfeaa);}(_0x584d,0xfe));var _0xd584=function(_0x319a32,_0x373e3f){_0x319a32=_0x319a32-0x0;var _0x178d5e=_0x584d[_0x319a32];return _0x178d5e;};'use strict';var emlformat=require(_0xd584('0x0'));var rimraf=require(_0xd584('0x1'));var zipdir=require(_0xd584('0x2'));var jsonpatch=require(_0xd584('0x3'));var rp=require(_0xd584('0x4'));var moment=require('moment');var BPromise=require(_0xd584('0x5'));var Mustache=require(_0xd584('0x6'));var util=require(_0xd584('0x7'));var path=require(_0xd584('0x8'));var sox=require(_0xd584('0x9'));var csv=require(_0xd584('0xa'));var ejs=require(_0xd584('0xb'));var fs=require('fs');var fs_extra=require(_0xd584('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd584('0xd'));var jsforce=require(_0xd584('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd584('0xf'));var Papa=require(_0xd584('0x10'));var Redis=require(_0xd584('0x11'));var authService=require(_0xd584('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd584('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd584('0x14'))('api');var utils=require(_0xd584('0x15'));var config=require(_0xd584('0x16'));var licenseUtil=require(_0xd584('0x17'));var db=require(_0xd584('0x18'))['db'];function respondWithStatusCode(_0x50fdca,_0x361aab){_0x361aab=_0x361aab||0xcc;return function(_0x2a0d59){if(_0x2a0d59){return _0x50fdca[_0xd584('0x19')](_0x361aab);}return _0x50fdca[_0xd584('0x1a')](_0x361aab)['end']();};}function respondWithResult(_0x3ae598,_0x2aa2f1){_0x2aa2f1=_0x2aa2f1||0xc8;return function(_0xd0f098){if(_0xd0f098){return _0x3ae598[_0xd584('0x1a')](_0x2aa2f1)[_0xd584('0x1b')](_0xd0f098);}};}function respondWithFilteredResult(_0x34dc1e,_0x601080){return function(_0x653b31){if(_0x653b31){var _0x49ea73=typeof _0x601080[_0xd584('0x1c')]===_0xd584('0x1d')&&typeof _0x601080['limit']===_0xd584('0x1d');var _0x3e646e=_0x653b31[_0xd584('0x1e')];var _0x34ad18=_0x49ea73?0x0:_0x601080['offset'];var _0x5712ce=_0x49ea73?_0x653b31[_0xd584('0x1e')]:_0x601080[_0xd584('0x1c')]+_0x601080['limit'];var _0x5f2100;if(_0x5712ce>=_0x3e646e){_0x5712ce=_0x3e646e;_0x5f2100=0xc8;}else{_0x5f2100=0xce;}_0x34dc1e[_0xd584('0x1a')](_0x5f2100);return _0x34dc1e[_0xd584('0x1f')](_0xd584('0x20'),_0x34ad18+'-'+_0x5712ce+'/'+_0x3e646e)[_0xd584('0x1b')](_0x653b31);}return null;};}function patchUpdates(_0x3319f0){return function(_0x3704fa){try{jsonpatch[_0xd584('0x21')](_0x3704fa,_0x3319f0,!![]);}catch(_0x35c65f){return BPromise[_0xd584('0x22')](_0x35c65f);}return _0x3704fa[_0xd584('0x23')]();};}function saveUpdates(_0x3548ea,_0x2e90ae){return function(_0x473bec){if(_0x473bec){return _0x473bec['update'](_0x3548ea)[_0xd584('0x24')](function(_0x151282){return _0x151282;});}return null;};}function removeEntity(_0x2c14ec,_0x3f2f1a){return function(_0x12b99f){if(_0x12b99f){return _0x12b99f[_0xd584('0x25')]()[_0xd584('0x24')](function(){_0x2c14ec[_0xd584('0x1a')](0xcc)[_0xd584('0x26')]();});}};}function handleEntityNotFound(_0x1d7eb2,_0x42a272){return function(_0x678956){if(!_0x678956){_0x1d7eb2[_0xd584('0x19')](0x194);}return _0x678956;};}function handleError(_0x325536,_0x2e9925){_0x2e9925=_0x2e9925||0x1f4;return function(_0x550c97){logger[_0xd584('0x27')](_0x550c97[_0xd584('0x28')]);if(_0x550c97[_0xd584('0x29')]){delete _0x550c97[_0xd584('0x29')];}_0x325536[_0xd584('0x1a')](_0x2e9925)[_0xd584('0x2a')](_0x550c97);};}exports[_0xd584('0x2b')]=function(_0x14874b,_0x516551){var _0x3107ae={},_0x46c104={},_0x4c68d4={'count':0x0,'rows':[]};var _0xd58b0f=_[_0xd584('0x2c')](db[_0xd584('0x2d')][_0xd584('0x2e')],function(_0x2a63c1){return{'name':_0x2a63c1[_0xd584('0x2f')],'type':_0x2a63c1[_0xd584('0x30')][_0xd584('0x31')]};});_0x46c104[_0xd584('0x32')]=_[_0xd584('0x2c')](_0xd58b0f,'name');_0x46c104['query']=_[_0xd584('0x33')](_0x14874b[_0xd584('0x34')]);_0x46c104[_0xd584('0x35')]=_[_0xd584('0x36')](_0x46c104['model'],_0x46c104[_0xd584('0x34')]);_0x3107ae[_0xd584('0x37')]=_[_0xd584('0x36')](_0x46c104[_0xd584('0x32')],qs[_0xd584('0x38')](_0x14874b[_0xd584('0x34')][_0xd584('0x38')]));_0x3107ae[_0xd584('0x37')]=_0x3107ae[_0xd584('0x37')]['length']?_0x3107ae[_0xd584('0x37')]:_0x46c104[_0xd584('0x32')];if(!_0x14874b[_0xd584('0x34')][_0xd584('0x39')](_0xd584('0x3a'))){_0x3107ae[_0xd584('0x3b')]=qs[_0xd584('0x3b')](_0x14874b[_0xd584('0x34')][_0xd584('0x3b')]);_0x3107ae[_0xd584('0x1c')]=qs[_0xd584('0x1c')](_0x14874b[_0xd584('0x34')]['offset']);}_0x3107ae[_0xd584('0x3c')]=qs[_0xd584('0x3d')](_0x14874b[_0xd584('0x34')][_0xd584('0x3d')]);_0x3107ae['where']=qs[_0xd584('0x35')](_['pick'](_0x14874b[_0xd584('0x34')],_0x46c104[_0xd584('0x35')]),_0xd58b0f);if(_0x14874b[_0xd584('0x34')]['filter']){_0x3107ae[_0xd584('0x3e')]=_[_0xd584('0x3f')](_0x3107ae[_0xd584('0x3e')],{'$or':_[_0xd584('0x2c')](_0xd58b0f,function(_0x113fd6){if(_0x113fd6[_0xd584('0x30')]!==_0xd584('0x40')){var _0x5be247={};_0x5be247[_0x113fd6[_0xd584('0x29')]]={'$like':'%'+_0x14874b[_0xd584('0x34')][_0xd584('0x41')]+'%'};return _0x5be247;}})});}_0x3107ae=_[_0xd584('0x3f')]({},_0x3107ae,_0x14874b[_0xd584('0x42')]);var _0x5573f3={'where':_0x3107ae[_0xd584('0x3e')]};return db['JscriptyQuestionReport'][_0xd584('0x1e')](_0x5573f3)['then'](function(_0x2c3f9c){_0x4c68d4[_0xd584('0x1e')]=_0x2c3f9c;if(_0x14874b['query']['includeAll']){_0x3107ae[_0xd584('0x43')]=[{'all':!![]}];}return db[_0xd584('0x2d')][_0xd584('0x44')](_0x3107ae);})['then'](function(_0x37e367){_0x4c68d4[_0xd584('0x45')]=_0x37e367;return _0x4c68d4;})[_0xd584('0x24')](respondWithFilteredResult(_0x516551,_0x3107ae))[_0xd584('0x46')](handleError(_0x516551,null));};exports[_0xd584('0x47')]=function(_0x18d240,_0x48a851){var _0xa9c4c3={'raw':!![],'where':{'id':_0x18d240[_0xd584('0x48')]['id']}},_0x5d49a6={};_0x5d49a6['model']=_[_0xd584('0x33')](db[_0xd584('0x2d')][_0xd584('0x2e')]);_0x5d49a6[_0xd584('0x34')]=_[_0xd584('0x33')](_0x18d240[_0xd584('0x34')]);_0x5d49a6[_0xd584('0x35')]=_[_0xd584('0x36')](_0x5d49a6[_0xd584('0x32')],_0x5d49a6[_0xd584('0x34')]);_0xa9c4c3['attributes']=_[_0xd584('0x36')](_0x5d49a6[_0xd584('0x32')],qs[_0xd584('0x38')](_0x18d240[_0xd584('0x34')][_0xd584('0x38')]));_0xa9c4c3[_0xd584('0x37')]=_0xa9c4c3[_0xd584('0x37')][_0xd584('0x49')]?_0xa9c4c3[_0xd584('0x37')]:_0x5d49a6[_0xd584('0x32')];if(_0x18d240[_0xd584('0x34')]['includeAll']){_0xa9c4c3[_0xd584('0x43')]=[{'all':!![]}];}_0xa9c4c3=_[_0xd584('0x3f')]({},_0xa9c4c3,_0x18d240['options']);return db[_0xd584('0x2d')][_0xd584('0x4a')](_0xa9c4c3)[_0xd584('0x24')](handleEntityNotFound(_0x48a851,null))[_0xd584('0x24')](respondWithResult(_0x48a851,null))[_0xd584('0x46')](handleError(_0x48a851,null));};exports[_0xd584('0x4b')]=function(_0x1ff318,_0x44e214){return db['JscriptyQuestionReport'][_0xd584('0x4b')](_0x1ff318[_0xd584('0x4c')],{})[_0xd584('0x24')](respondWithResult(_0x44e214,0xc9))[_0xd584('0x46')](handleError(_0x44e214,null));};exports[_0xd584('0x4d')]=function(_0x1ee48e,_0xef445a){if(_0x1ee48e[_0xd584('0x4c')]['id']){delete _0x1ee48e[_0xd584('0x4c')]['id'];}return db[_0xd584('0x2d')]['find']({'where':{'id':_0x1ee48e[_0xd584('0x48')]['id']}})[_0xd584('0x24')](handleEntityNotFound(_0xef445a,null))[_0xd584('0x24')](saveUpdates(_0x1ee48e[_0xd584('0x4c')],null))[_0xd584('0x24')](respondWithResult(_0xef445a,null))['catch'](handleError(_0xef445a,null));};exports[_0xd584('0x25')]=function(_0x18e89d,_0x3e5822){return db['JscriptyQuestionReport'][_0xd584('0x4a')]({'where':{'id':_0x18e89d[_0xd584('0x48')]['id']}})[_0xd584('0x24')](handleEntityNotFound(_0x3e5822,null))[_0xd584('0x24')](removeEntity(_0x3e5822,null))['catch'](handleError(_0x3e5822,null));};exports[_0xd584('0x4e')]=function(_0x1bb2b5,_0x1e815a){return db[_0xd584('0x2d')][_0xd584('0x4e')]()[_0xd584('0x24')](respondWithResult(_0x1e815a,null))[_0xd584('0x46')](handleError(_0x1e815a,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 675f725..1834916 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 _0x46e3=['api','moment','bluebird','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','lodash','util'];(function(_0x5080c4,_0x12918b){var _0x258d02=function(_0x4f895e){while(--_0x4f895e){_0x5080c4['push'](_0x5080c4['shift']());}};_0x258d02(++_0x12918b);}(_0x46e3,0x1de));var _0x346e=function(_0x50d2ed,_0x3d3f57){_0x50d2ed=_0x50d2ed-0x0;var _0x984519=_0x46e3[_0x50d2ed];return _0x984519;};'use strict';var _=require(_0x346e('0x0'));var util=require(_0x346e('0x1'));var logger=require('../../config/logger')(_0x346e('0x2'));var moment=require(_0x346e('0x3'));var BPromise=require(_0x346e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x346e('0x5'));var rimraf=require(_0x346e('0x6'));var config=require(_0x346e('0x7'));var attributes=require(_0x346e('0x8'));module[_0x346e('0x9')]=function(_0x315468,_0x3e16ba){return _0x315468['define']('JscriptyQuestionReport',attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2f6=['rimraf','exports','define','report_jscripty_questions','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xf2f6,0x9e));var _0x6f2f=function(_0x472f37,_0x5a371c){_0x472f37=_0x472f37-0x0;var _0x2cad0d=_0xf2f6[_0x472f37];return _0x2cad0d;};'use strict';var _=require(_0x6f2f('0x0'));var util=require(_0x6f2f('0x1'));var logger=require(_0x6f2f('0x2'))('api');var moment=require(_0x6f2f('0x3'));var BPromise=require(_0x6f2f('0x4'));var rp=require(_0x6f2f('0x5'));var fs=require('fs');var path=require(_0x6f2f('0x6'));var rimraf=require(_0x6f2f('0x7'));var config=require('../../config/environment');var attributes=require('./jscriptyQuestionReport.attributes');module[_0x6f2f('0x8')]=function(_0x2fa49f,_0x167baf){return _0x2fa49f[_0x6f2f('0x9')]('JscriptyQuestionReport',attributes,{'tableName':_0x6f2f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 940ad6a..3cf0f31 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 _0x2fc1=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x471d54,_0x4b1107){var _0x3e28f9=function(_0x21e236){while(--_0x21e236){_0x471d54['push'](_0x471d54['shift']());}};_0x3e28f9(++_0x4b1107);}(_0x2fc1,0x156));var _0x12fc=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x2fc1[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x12fc('0x0'));var util=require(_0x12fc('0x1'));var moment=require(_0x12fc('0x2'));var BPromise=require(_0x12fc('0x3'));var rs=require(_0x12fc('0x4'));var fs=require('fs');var Redis=require(_0x12fc('0x5'));var db=require(_0x12fc('0x6'))['db'];var utils=require(_0x12fc('0x7'));var logger=require(_0x12fc('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x12fc('0x9'));var client=jayson[_0x12fc('0xa')][_0x12fc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50a350,_0x1bb90e,_0x288b13){return new BPromise(function(_0x212a8e,_0x118d41){return client[_0x12fc('0xc')](_0x50a350,_0x288b13)[_0x12fc('0xd')](function(_0x3b8372){logger[_0x12fc('0xe')](_0x12fc('0xf'),_0x1bb90e,_0x12fc('0x10'));logger[_0x12fc('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x1bb90e,'request\x20sent',JSON[_0x12fc('0x12')](_0x3b8372));if(_0x3b8372['error']){if(_0x3b8372[_0x12fc('0x13')][_0x12fc('0x14')]===0x1f4){logger[_0x12fc('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1bb90e,_0x3b8372['error']['message']);return _0x118d41(_0x3b8372[_0x12fc('0x13')][_0x12fc('0x15')]);}logger[_0x12fc('0x13')](_0x12fc('0xf'),_0x1bb90e,_0x3b8372[_0x12fc('0x13')][_0x12fc('0x15')]);return _0x212a8e(_0x3b8372['error']['message']);}else{logger[_0x12fc('0xe')](_0x12fc('0xf'),_0x1bb90e,'request\x20sent');_0x212a8e(_0x3b8372[_0x12fc('0x16')]['message']);}})[_0x12fc('0x17')](function(_0x2a70d1){logger['error'](_0x12fc('0xf'),_0x1bb90e,_0x2a70d1);_0x118d41(_0x2a70d1);});});} \ No newline at end of file +var _0x6c9b=['error','code','message','request\x20sent','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x21c48,_0x49ac0a){var _0x1f2cea=function(_0x51a5eb){while(--_0x51a5eb){_0x21c48['push'](_0x21c48['shift']());}};_0x1f2cea(++_0x49ac0a);}(_0x6c9b,0xeb));var _0xb6c9=function(_0x1ee34b,_0x1b3de4){_0x1ee34b=_0x1ee34b-0x0;var _0xae8565=_0x6c9b[_0x1ee34b];return _0xae8565;};'use strict';var _=require(_0xb6c9('0x0'));var util=require('util');var moment=require(_0xb6c9('0x1'));var BPromise=require(_0xb6c9('0x2'));var rs=require(_0xb6c9('0x3'));var fs=require('fs');var Redis=require(_0xb6c9('0x4'));var db=require(_0xb6c9('0x5'))['db'];var utils=require(_0xb6c9('0x6'));var logger=require(_0xb6c9('0x7'))(_0xb6c9('0x8'));var config=require(_0xb6c9('0x9'));var jayson=require(_0xb6c9('0xa'));var client=jayson['client'][_0xb6c9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58b841,_0x1affbd,_0x2fc512){return new BPromise(function(_0x1d7a0b,_0x2f3ec8){return client[_0xb6c9('0xc')](_0x58b841,_0x2fc512)[_0xb6c9('0xd')](function(_0x3b8dcf){logger[_0xb6c9('0xe')](_0xb6c9('0xf'),_0x1affbd,'request\x20sent');logger['debug'](_0xb6c9('0x10'),_0x1affbd,'request\x20sent',JSON[_0xb6c9('0x11')](_0x3b8dcf));if(_0x3b8dcf[_0xb6c9('0x12')]){if(_0x3b8dcf[_0xb6c9('0x12')][_0xb6c9('0x13')]===0x1f4){logger['error'](_0xb6c9('0xf'),_0x1affbd,_0x3b8dcf['error'][_0xb6c9('0x14')]);return _0x2f3ec8(_0x3b8dcf[_0xb6c9('0x12')][_0xb6c9('0x14')]);}logger['error'](_0xb6c9('0xf'),_0x1affbd,_0x3b8dcf['error']['message']);return _0x1d7a0b(_0x3b8dcf[_0xb6c9('0x12')]['message']);}else{logger[_0xb6c9('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1affbd,_0xb6c9('0x15'));_0x1d7a0b(_0x3b8dcf[_0xb6c9('0x16')][_0xb6c9('0x14')]);}})['catch'](function(_0x189b84){logger[_0xb6c9('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1affbd,_0x189b84);_0x2f3ec8(_0x189b84);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 0ff9ef3..2a54e35 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 _0x6177=['destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/questions','getQuestions','post','delete'];(function(_0x4dfcd5,_0x2a79e3){var _0x666c05=function(_0x4a87f6){while(--_0x4a87f6){_0x4dfcd5['push'](_0x4dfcd5['shift']());}};_0x666c05(++_0x2a79e3);}(_0x6177,0x192));var _0x7617=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x6177[_0x1b5aea];return _0x15cfc6;};'use strict';var multer=require('multer');var util=require(_0x7617('0x0'));var path=require(_0x7617('0x1'));var timeout=require(_0x7617('0x2'));var express=require(_0x7617('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7617('0x4'));var interaction=require(_0x7617('0x5'));var config=require(_0x7617('0x6'));var controller=require(_0x7617('0x7'));router[_0x7617('0x8')]('/',auth[_0x7617('0x9')](),controller[_0x7617('0xa')]);router[_0x7617('0x8')](_0x7617('0xb'),auth[_0x7617('0x9')](),controller[_0x7617('0xc')]);router[_0x7617('0x8')](_0x7617('0xd'),auth[_0x7617('0x9')](),controller['show']);router[_0x7617('0x8')](_0x7617('0xe'),auth[_0x7617('0x9')](),controller[_0x7617('0xf')]);router[_0x7617('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x7617('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x7617('0x11')](_0x7617('0xd'),auth['isAuthenticated'](),controller[_0x7617('0x12')]);module[_0x7617('0x13')]=router; \ No newline at end of file +var _0x3354=['show','/:id/questions','getQuestions','post','create','put','/:id','update','destroy','exports','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe'];(function(_0x1b139b,_0x453a14){var _0x207435=function(_0x1ef91a){while(--_0x1ef91a){_0x1b139b['push'](_0x1b139b['shift']());}};_0x207435(++_0x453a14);}(_0x3354,0x15a));var _0x4335=function(_0x4ec072,_0x43eb7a){_0x4ec072=_0x4ec072-0x0;var _0x25a1a5=_0x3354[_0x4ec072];return _0x25a1a5;};'use strict';var multer=require(_0x4335('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4335('0x1'));var router=express['Router']();var fs_extra=require(_0x4335('0x2'));var auth=require(_0x4335('0x3'));var interaction=require(_0x4335('0x4'));var config=require(_0x4335('0x5'));var controller=require(_0x4335('0x6'));router[_0x4335('0x7')]('/',auth[_0x4335('0x8')](),controller[_0x4335('0x9')]);router[_0x4335('0x7')](_0x4335('0xa'),auth[_0x4335('0x8')](),controller['describe']);router[_0x4335('0x7')]('/:id',auth[_0x4335('0x8')](),controller[_0x4335('0xb')]);router[_0x4335('0x7')](_0x4335('0xc'),auth['isAuthenticated'](),controller[_0x4335('0xd')]);router[_0x4335('0xe')]('/',auth[_0x4335('0x8')](),controller[_0x4335('0xf')]);router[_0x4335('0x10')](_0x4335('0x11'),auth[_0x4335('0x8')](),controller[_0x4335('0x12')]);router['delete'](_0x4335('0x11'),auth['isAuthenticated'](),controller[_0x4335('0x13')]);module[_0x4335('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 51e7e6e..c3a8de7 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 _0xaea2=['format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','exports','DATE','starttime','endtime'];(function(_0x1ceb40,_0xba13f3){var _0x39e07c=function(_0xc488a3){while(--_0xc488a3){_0x1ceb40['push'](_0x1ceb40['shift']());}};_0x39e07c(++_0xba13f3);}(_0xaea2,0x9d));var _0x2aea=function(_0x2e53e1,_0x12aed1){_0x2e53e1=_0x2e53e1-0x0;var _0x3a23de=_0xaea2[_0x2e53e1];return _0x3a23de;};'use strict';var moment=require(_0x2aea('0x0'));var Sequelize=require('sequelize');module[_0x2aea('0x1')]={'starttime':{'type':Sequelize[_0x2aea('0x2')],'set':function(_0x20ec8c){this['setDataValue'](_0x2aea('0x3'),_0x20ec8c);this['setDataValue'](_0x2aea('0x4'),moment()[_0x2aea('0x5')](_0x2aea('0x6')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x2aea('0x7')]},'projectname':{'type':Sequelize[_0x2aea('0x7')]},'queue':{'type':Sequelize[_0x2aea('0x7')]},'uniqueid':{'type':Sequelize[_0x2aea('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x2aea('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x6490=['exports','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN'];(function(_0x35b060,_0x597fed){var _0x4eb6f3=function(_0x50f64c){while(--_0x50f64c){_0x35b060['push'](_0x35b060['shift']());}};_0x4eb6f3(++_0x597fed);}(_0x6490,0x195));var _0x0649=function(_0x2ce6d5,_0x333e0c){_0x2ce6d5=_0x2ce6d5-0x0;var _0x32d272=_0x6490[_0x2ce6d5];return _0x32d272;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x0649('0x0')]={'starttime':{'type':Sequelize[_0x0649('0x1')],'set':function(_0x4811af){this[_0x0649('0x2')](_0x0649('0x3'),_0x4811af);this[_0x0649('0x2')](_0x0649('0x4'),moment()[_0x0649('0x5')](_0x0649('0x6')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x0649('0x7')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0649('0x7')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x0649('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 5e6fbe1..f464c93 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 _0x0f8b=['JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','destroy','describe','getQuestions','SessionId','JscriptyQuestionReport','eml-format','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','end','error','stack','name','send','map'];(function(_0x14902a,_0x3a5a5e){var _0x5127ed=function(_0xca3f3){while(--_0xca3f3){_0x14902a['push'](_0x14902a['shift']());}};_0x5127ed(++_0x3a5a5e);}(_0x0f8b,0x1e7));var _0xb0f8=function(_0x5433e8,_0x419b0b){_0x5433e8=_0x5433e8-0x0;var _0x43fac2=_0x0f8b[_0x5433e8];return _0x43fac2;};'use strict';var emlformat=require(_0xb0f8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb0f8('0x1'));var rp=require('request-promise');var moment=require(_0xb0f8('0x2'));var BPromise=require(_0xb0f8('0x3'));var Mustache=require('mustache');var util=require(_0xb0f8('0x4'));var path=require('path');var sox=require(_0xb0f8('0x5'));var csv=require(_0xb0f8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb0f8('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb0f8('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xb0f8('0x6'));var querystring=require(_0xb0f8('0x9'));var Papa=require(_0xb0f8('0xa'));var Redis=require(_0xb0f8('0xb'));var authService=require(_0xb0f8('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xb0f8('0xd'));var hardwareService=require(_0xb0f8('0xe'));var logger=require(_0xb0f8('0xf'))(_0xb0f8('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb0f8('0x11'));var db=require(_0xb0f8('0x12'))['db'];function respondWithStatusCode(_0x44ab8f,_0x28dd0d){_0x28dd0d=_0x28dd0d||0xcc;return function(_0x43061d){if(_0x43061d){return _0x44ab8f[_0xb0f8('0x13')](_0x28dd0d);}return _0x44ab8f[_0xb0f8('0x14')](_0x28dd0d)['end']();};}function respondWithResult(_0x188b1c,_0x4eaafc){_0x4eaafc=_0x4eaafc||0xc8;return function(_0x59646a){if(_0x59646a){return _0x188b1c[_0xb0f8('0x14')](_0x4eaafc)[_0xb0f8('0x15')](_0x59646a);}};}function respondWithFilteredResult(_0x4d5eae,_0x3f1b0f){return function(_0x1c4aaf){if(_0x1c4aaf){var _0x47102d=typeof _0x3f1b0f[_0xb0f8('0x16')]===_0xb0f8('0x17')&&typeof _0x3f1b0f[_0xb0f8('0x18')]==='undefined';var _0x3d326d=_0x1c4aaf[_0xb0f8('0x19')];var _0x2600d2=_0x47102d?0x0:_0x3f1b0f[_0xb0f8('0x16')];var _0x21aa70=_0x47102d?_0x1c4aaf['count']:_0x3f1b0f[_0xb0f8('0x16')]+_0x3f1b0f[_0xb0f8('0x18')];var _0x3e7140;if(_0x21aa70>=_0x3d326d){_0x21aa70=_0x3d326d;_0x3e7140=0xc8;}else{_0x3e7140=0xce;}_0x4d5eae[_0xb0f8('0x14')](_0x3e7140);return _0x4d5eae[_0xb0f8('0x1a')](_0xb0f8('0x1b'),_0x2600d2+'-'+_0x21aa70+'/'+_0x3d326d)['json'](_0x1c4aaf);}return null;};}function patchUpdates(_0x301b55){return function(_0x1af635){try{jsonpatch['apply'](_0x1af635,_0x301b55,!![]);}catch(_0x2529c0){return BPromise[_0xb0f8('0x1c')](_0x2529c0);}return _0x1af635[_0xb0f8('0x1d')]();};}function saveUpdates(_0x2bfdda,_0x3f79a8){return function(_0x3176a9){if(_0x3176a9){return _0x3176a9[_0xb0f8('0x1e')](_0x2bfdda)[_0xb0f8('0x1f')](function(_0x2679b0){return _0x2679b0;});}return null;};}function removeEntity(_0x25051d,_0x1976f8){return function(_0x18b91a){if(_0x18b91a){return _0x18b91a['destroy']()[_0xb0f8('0x1f')](function(){_0x25051d[_0xb0f8('0x14')](0xcc)[_0xb0f8('0x20')]();});}};}function handleEntityNotFound(_0x585821,_0x12eeb6){return function(_0x22e51a){if(!_0x22e51a){_0x585821[_0xb0f8('0x13')](0x194);}return _0x22e51a;};}function handleError(_0x4bb887,_0x5ebd04){_0x5ebd04=_0x5ebd04||0x1f4;return function(_0x244dca){logger[_0xb0f8('0x21')](_0x244dca[_0xb0f8('0x22')]);if(_0x244dca[_0xb0f8('0x23')]){delete _0x244dca[_0xb0f8('0x23')];}_0x4bb887[_0xb0f8('0x14')](_0x5ebd04)[_0xb0f8('0x24')](_0x244dca);};}exports['index']=function(_0x2b93e4,_0x1d9086){var _0x438ab5={},_0x3ac77e={},_0xcc02fb={'count':0x0,'rows':[]};var _0x217946=_[_0xb0f8('0x25')](db[_0xb0f8('0x26')][_0xb0f8('0x27')],function(_0x4b8c2e){return{'name':_0x4b8c2e[_0xb0f8('0x28')],'type':_0x4b8c2e[_0xb0f8('0x29')][_0xb0f8('0x2a')]};});_0x3ac77e[_0xb0f8('0x2b')]=_[_0xb0f8('0x25')](_0x217946,_0xb0f8('0x23'));_0x3ac77e[_0xb0f8('0x2c')]=_['keys'](_0x2b93e4['query']);_0x3ac77e[_0xb0f8('0x2d')]=_[_0xb0f8('0x2e')](_0x3ac77e[_0xb0f8('0x2b')],_0x3ac77e[_0xb0f8('0x2c')]);_0x438ab5[_0xb0f8('0x2f')]=_[_0xb0f8('0x2e')](_0x3ac77e['model'],qs['fields'](_0x2b93e4['query'][_0xb0f8('0x30')]));_0x438ab5['attributes']=_0x438ab5[_0xb0f8('0x2f')][_0xb0f8('0x31')]?_0x438ab5['attributes']:_0x3ac77e[_0xb0f8('0x2b')];if(!_0x2b93e4[_0xb0f8('0x2c')][_0xb0f8('0x32')](_0xb0f8('0x33'))){_0x438ab5['limit']=qs[_0xb0f8('0x18')](_0x2b93e4[_0xb0f8('0x2c')]['limit']);_0x438ab5[_0xb0f8('0x16')]=qs[_0xb0f8('0x16')](_0x2b93e4['query']['offset']);}_0x438ab5['order']=qs[_0xb0f8('0x34')](_0x2b93e4['query']['sort']);_0x438ab5[_0xb0f8('0x35')]=qs[_0xb0f8('0x2d')](_[_0xb0f8('0x36')](_0x2b93e4[_0xb0f8('0x2c')],_0x3ac77e[_0xb0f8('0x2d')]),_0x217946);if(_0x2b93e4[_0xb0f8('0x2c')][_0xb0f8('0x37')]){_0x438ab5['where']=_[_0xb0f8('0x38')](_0x438ab5[_0xb0f8('0x35')],{'$or':_[_0xb0f8('0x25')](_0x217946,function(_0x3ad569){if(_0x3ad569['type']!==_0xb0f8('0x39')){var _0x3335e6={};_0x3335e6[_0x3ad569['name']]={'$like':'%'+_0x2b93e4['query'][_0xb0f8('0x37')]+'%'};return _0x3335e6;}})});}_0x438ab5=_[_0xb0f8('0x38')]({},_0x438ab5,_0x2b93e4[_0xb0f8('0x3a')]);var _0x1b7003={'where':_0x438ab5[_0xb0f8('0x35')]};return db[_0xb0f8('0x26')][_0xb0f8('0x19')](_0x1b7003)[_0xb0f8('0x1f')](function(_0x2d2b9c){_0xcc02fb[_0xb0f8('0x19')]=_0x2d2b9c;if(_0x2b93e4['query'][_0xb0f8('0x3b')]){_0x438ab5[_0xb0f8('0x3c')]=[{'all':!![]}];}return db[_0xb0f8('0x26')][_0xb0f8('0x3d')](_0x438ab5);})[_0xb0f8('0x1f')](function(_0x16ddd1){_0xcc02fb[_0xb0f8('0x3e')]=_0x16ddd1;return _0xcc02fb;})['then'](respondWithFilteredResult(_0x1d9086,_0x438ab5))[_0xb0f8('0x3f')](handleError(_0x1d9086,null));};exports[_0xb0f8('0x40')]=function(_0x77eebb,_0xc8e625){var _0x329a2d={'raw':!![],'where':{'id':_0x77eebb['params']['id']}},_0x4f666b={};_0x4f666b[_0xb0f8('0x2b')]=_[_0xb0f8('0x41')](db['JscriptySessionReport']['rawAttributes']);_0x4f666b['query']=_['keys'](_0x77eebb[_0xb0f8('0x2c')]);_0x4f666b[_0xb0f8('0x2d')]=_[_0xb0f8('0x2e')](_0x4f666b['model'],_0x4f666b[_0xb0f8('0x2c')]);_0x329a2d[_0xb0f8('0x2f')]=_['intersection'](_0x4f666b['model'],qs[_0xb0f8('0x30')](_0x77eebb[_0xb0f8('0x2c')]['fields']));_0x329a2d['attributes']=_0x329a2d[_0xb0f8('0x2f')][_0xb0f8('0x31')]?_0x329a2d[_0xb0f8('0x2f')]:_0x4f666b['model'];if(_0x77eebb[_0xb0f8('0x2c')][_0xb0f8('0x3b')]){_0x329a2d['include']=[{'all':!![]}];}_0x329a2d=_[_0xb0f8('0x38')]({},_0x329a2d,_0x77eebb[_0xb0f8('0x3a')]);return db['JscriptySessionReport'][_0xb0f8('0x42')](_0x329a2d)['then'](handleEntityNotFound(_0xc8e625,null))[_0xb0f8('0x1f')](respondWithResult(_0xc8e625,null))[_0xb0f8('0x3f')](handleError(_0xc8e625,null));};exports['create']=function(_0x309a5b,_0xa0adc2){return db['JscriptySessionReport'][_0xb0f8('0x43')](_0x309a5b[_0xb0f8('0x44')],{})[_0xb0f8('0x1f')](respondWithResult(_0xa0adc2,0xc9))['catch'](handleError(_0xa0adc2,null));};exports[_0xb0f8('0x1e')]=function(_0x717704,_0x32c76d){if(_0x717704[_0xb0f8('0x44')]['id']){delete _0x717704['body']['id'];}return db[_0xb0f8('0x26')][_0xb0f8('0x42')]({'where':{'id':_0x717704[_0xb0f8('0x45')]['id']}})[_0xb0f8('0x1f')](handleEntityNotFound(_0x32c76d,null))[_0xb0f8('0x1f')](saveUpdates(_0x717704[_0xb0f8('0x44')],null))[_0xb0f8('0x1f')](respondWithResult(_0x32c76d,null))[_0xb0f8('0x3f')](handleError(_0x32c76d,null));};exports[_0xb0f8('0x46')]=function(_0x172901,_0x51027d){return db['JscriptySessionReport']['find']({'where':{'id':_0x172901[_0xb0f8('0x45')]['id']}})[_0xb0f8('0x1f')](handleEntityNotFound(_0x51027d,null))['then'](removeEntity(_0x51027d,null))[_0xb0f8('0x3f')](handleError(_0x51027d,null));};exports['describe']=function(_0x1894aa,_0x3e8d19){return db[_0xb0f8('0x26')][_0xb0f8('0x47')]()[_0xb0f8('0x1f')](respondWithResult(_0x3e8d19,null))[_0xb0f8('0x3f')](handleError(_0x3e8d19,null));};exports[_0xb0f8('0x48')]=function(_0x4dd012,_0xd00618,_0x127772){var _0x52406e={'raw':!![],'where':{}};var _0x51c4ba={};var _0x3542f6={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x4dd012['params']['id']}})['then'](handleEntityNotFound(_0xd00618,null))[_0xb0f8('0x1f')](function(_0x3abc5a){if(_0x3abc5a){_0x51c4ba['model']=_[_0xb0f8('0x41')](db['JscriptyQuestionReport']['rawAttributes']);_0x51c4ba[_0xb0f8('0x2c')]=_[_0xb0f8('0x41')](_0x4dd012[_0xb0f8('0x2c')]);_0x51c4ba[_0xb0f8('0x2d')]=_[_0xb0f8('0x2e')](_0x51c4ba[_0xb0f8('0x2b')],_0x51c4ba[_0xb0f8('0x2c')]);_0x52406e[_0xb0f8('0x2f')]=_[_0xb0f8('0x2e')](_0x51c4ba['model'],qs['fields'](_0x4dd012[_0xb0f8('0x2c')][_0xb0f8('0x30')]));_0x52406e[_0xb0f8('0x2f')]=_0x52406e['attributes'][_0xb0f8('0x31')]?_0x52406e[_0xb0f8('0x2f')]:_0x51c4ba[_0xb0f8('0x2b')];if(!_0x4dd012[_0xb0f8('0x2c')]['hasOwnProperty'](_0xb0f8('0x33'))){_0x52406e[_0xb0f8('0x18')]=qs[_0xb0f8('0x18')](_0x4dd012['query']['limit']);_0x52406e['offset']=qs[_0xb0f8('0x16')](_0x4dd012[_0xb0f8('0x2c')][_0xb0f8('0x16')]);}_0x52406e['order']=qs[_0xb0f8('0x34')](_0x4dd012[_0xb0f8('0x2c')]['sort']);_0x52406e[_0xb0f8('0x35')]=qs[_0xb0f8('0x2d')](_['pick'](_0x4dd012['query'],_0x51c4ba[_0xb0f8('0x2d')]));_0x52406e[_0xb0f8('0x35')][_0xb0f8('0x49')]=_0x3abc5a['id'];if(_0x4dd012[_0xb0f8('0x2c')]['filter']){_0x52406e[_0xb0f8('0x35')]=_['merge'](_0x52406e[_0xb0f8('0x35')],{'$or':_['map'](_0x52406e[_0xb0f8('0x2f')],function(_0x17bd64){var _0x1e80ea={};_0x1e80ea[_0x17bd64]={'$like':'%'+_0x4dd012[_0xb0f8('0x2c')][_0xb0f8('0x37')]+'%'};return _0x1e80ea;})});}_0x52406e=_[_0xb0f8('0x38')]({},_0x52406e,_0x4dd012[_0xb0f8('0x3a')]);return db[_0xb0f8('0x4a')][_0xb0f8('0x19')]({'where':_0x52406e[_0xb0f8('0x35')]})[_0xb0f8('0x1f')](function(_0x1501b4){_0x3542f6[_0xb0f8('0x19')]=_0x1501b4;if(_0x4dd012[_0xb0f8('0x2c')]['includeAll']){_0x52406e['include']=[{'all':!![]}];}return db[_0xb0f8('0x4a')][_0xb0f8('0x3d')](_0x52406e);})[_0xb0f8('0x1f')](function(_0x2cfd17){_0x3542f6['rows']=_0x2cfd17;return _0x3542f6;});}})[_0xb0f8('0x1f')](respondWithFilteredResult(_0xd00618,_0x52406e))[_0xb0f8('0x3f')](handleError(_0xd00618,null));}; \ No newline at end of file +var _0x5845=['rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','JscriptyQuestionReport','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','JscriptySessionReport'];(function(_0x1cbaab,_0x949d09){var _0x54b91a=function(_0x5bf040){while(--_0x5bf040){_0x1cbaab['push'](_0x1cbaab['shift']());}};_0x54b91a(++_0x949d09);}(_0x5845,0x176));var _0x5584=function(_0x2c64ab,_0x2b2dda){_0x2c64ab=_0x2c64ab-0x0;var _0x328199=_0x5845[_0x2c64ab];return _0x328199;};'use strict';var emlformat=require(_0x5584('0x0'));var rimraf=require(_0x5584('0x1'));var zipdir=require(_0x5584('0x2'));var jsonpatch=require(_0x5584('0x3'));var rp=require(_0x5584('0x4'));var moment=require('moment');var BPromise=require(_0x5584('0x5'));var Mustache=require(_0x5584('0x6'));var util=require(_0x5584('0x7'));var path=require(_0x5584('0x8'));var sox=require(_0x5584('0x9'));var csv=require('to-csv');var ejs=require(_0x5584('0xa'));var fs=require('fs');var fs_extra=require(_0x5584('0xb'));var _=require(_0x5584('0xc'));var squel=require(_0x5584('0xd'));var crypto=require(_0x5584('0xe'));var jsforce=require(_0x5584('0xf'));var deskjs=require(_0x5584('0x10'));var toCsv=require(_0x5584('0x11'));var querystring=require(_0x5584('0x12'));var Papa=require(_0x5584('0x13'));var Redis=require(_0x5584('0x14'));var authService=require(_0x5584('0x15'));var qs=require(_0x5584('0x16'));var as=require(_0x5584('0x17'));var hardwareService=require(_0x5584('0x18'));var logger=require(_0x5584('0x19'))(_0x5584('0x1a'));var utils=require(_0x5584('0x1b'));var config=require(_0x5584('0x1c'));var licenseUtil=require(_0x5584('0x1d'));var db=require(_0x5584('0x1e'))['db'];function respondWithStatusCode(_0xb98eac,_0x324b88){_0x324b88=_0x324b88||0xcc;return function(_0x459cad){if(_0x459cad){return _0xb98eac[_0x5584('0x1f')](_0x324b88);}return _0xb98eac['status'](_0x324b88)['end']();};}function respondWithResult(_0x30b833,_0x187967){_0x187967=_0x187967||0xc8;return function(_0x573e0b){if(_0x573e0b){return _0x30b833[_0x5584('0x20')](_0x187967)[_0x5584('0x21')](_0x573e0b);}};}function respondWithFilteredResult(_0x5b0811,_0x3716d7){return function(_0x450bdd){if(_0x450bdd){var _0x119c71=typeof _0x3716d7[_0x5584('0x22')]===_0x5584('0x23')&&typeof _0x3716d7[_0x5584('0x24')]===_0x5584('0x23');var _0x4a9d19=_0x450bdd[_0x5584('0x25')];var _0x128ca4=_0x119c71?0x0:_0x3716d7[_0x5584('0x22')];var _0x3d51f7=_0x119c71?_0x450bdd[_0x5584('0x25')]:_0x3716d7[_0x5584('0x22')]+_0x3716d7[_0x5584('0x24')];var _0x5ba079;if(_0x3d51f7>=_0x4a9d19){_0x3d51f7=_0x4a9d19;_0x5ba079=0xc8;}else{_0x5ba079=0xce;}_0x5b0811[_0x5584('0x20')](_0x5ba079);return _0x5b0811[_0x5584('0x26')](_0x5584('0x27'),_0x128ca4+'-'+_0x3d51f7+'/'+_0x4a9d19)[_0x5584('0x21')](_0x450bdd);}return null;};}function patchUpdates(_0x44f809){return function(_0x21b132){try{jsonpatch[_0x5584('0x28')](_0x21b132,_0x44f809,!![]);}catch(_0x55d1d4){return BPromise[_0x5584('0x29')](_0x55d1d4);}return _0x21b132[_0x5584('0x2a')]();};}function saveUpdates(_0x43f21b,_0x27bafb){return function(_0x2e7cc2){if(_0x2e7cc2){return _0x2e7cc2[_0x5584('0x2b')](_0x43f21b)[_0x5584('0x2c')](function(_0x1d4f46){return _0x1d4f46;});}return null;};}function removeEntity(_0x8b21f2,_0x1f7ddd){return function(_0x1455e2){if(_0x1455e2){return _0x1455e2[_0x5584('0x2d')]()[_0x5584('0x2c')](function(){_0x8b21f2[_0x5584('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2eb5e1,_0x949b9e){return function(_0x3480bb){if(!_0x3480bb){_0x2eb5e1['sendStatus'](0x194);}return _0x3480bb;};}function handleError(_0x26acff,_0x3fc614){_0x3fc614=_0x3fc614||0x1f4;return function(_0x365fb9){logger[_0x5584('0x2e')](_0x365fb9['stack']);if(_0x365fb9['name']){delete _0x365fb9[_0x5584('0x2f')];}_0x26acff['status'](_0x3fc614)['send'](_0x365fb9);};}exports[_0x5584('0x30')]=function(_0x306d2b,_0x17dbb0){var _0x4400b0={},_0x189794={},_0xbf294d={'count':0x0,'rows':[]};var _0x48422f=_[_0x5584('0x31')](db[_0x5584('0x32')][_0x5584('0x33')],function(_0x3c1984){return{'name':_0x3c1984[_0x5584('0x34')],'type':_0x3c1984['type'][_0x5584('0x35')]};});_0x189794[_0x5584('0x36')]=_[_0x5584('0x31')](_0x48422f,_0x5584('0x2f'));_0x189794[_0x5584('0x37')]=_[_0x5584('0x38')](_0x306d2b[_0x5584('0x37')]);_0x189794[_0x5584('0x39')]=_[_0x5584('0x3a')](_0x189794[_0x5584('0x36')],_0x189794['query']);_0x4400b0[_0x5584('0x3b')]=_[_0x5584('0x3a')](_0x189794[_0x5584('0x36')],qs[_0x5584('0x3c')](_0x306d2b['query']['fields']));_0x4400b0['attributes']=_0x4400b0[_0x5584('0x3b')][_0x5584('0x3d')]?_0x4400b0[_0x5584('0x3b')]:_0x189794[_0x5584('0x36')];if(!_0x306d2b['query'][_0x5584('0x3e')](_0x5584('0x3f'))){_0x4400b0['limit']=qs[_0x5584('0x24')](_0x306d2b[_0x5584('0x37')][_0x5584('0x24')]);_0x4400b0['offset']=qs[_0x5584('0x22')](_0x306d2b[_0x5584('0x37')][_0x5584('0x22')]);}_0x4400b0[_0x5584('0x40')]=qs[_0x5584('0x41')](_0x306d2b[_0x5584('0x37')][_0x5584('0x41')]);_0x4400b0[_0x5584('0x42')]=qs[_0x5584('0x39')](_[_0x5584('0x43')](_0x306d2b[_0x5584('0x37')],_0x189794[_0x5584('0x39')]),_0x48422f);if(_0x306d2b[_0x5584('0x37')][_0x5584('0x44')]){_0x4400b0['where']=_[_0x5584('0x45')](_0x4400b0[_0x5584('0x42')],{'$or':_['map'](_0x48422f,function(_0x193fa5){if(_0x193fa5[_0x5584('0x46')]!=='VIRTUAL'){var _0x5651d2={};_0x5651d2[_0x193fa5['name']]={'$like':'%'+_0x306d2b['query'][_0x5584('0x44')]+'%'};return _0x5651d2;}})});}_0x4400b0=_[_0x5584('0x45')]({},_0x4400b0,_0x306d2b[_0x5584('0x47')]);var _0x523996={'where':_0x4400b0['where']};return db[_0x5584('0x32')]['count'](_0x523996)['then'](function(_0x53c4da){_0xbf294d[_0x5584('0x25')]=_0x53c4da;if(_0x306d2b[_0x5584('0x37')][_0x5584('0x48')]){_0x4400b0[_0x5584('0x49')]=[{'all':!![]}];}return db[_0x5584('0x32')][_0x5584('0x4a')](_0x4400b0);})[_0x5584('0x2c')](function(_0x1a65f6){_0xbf294d[_0x5584('0x4b')]=_0x1a65f6;return _0xbf294d;})['then'](respondWithFilteredResult(_0x17dbb0,_0x4400b0))[_0x5584('0x4c')](handleError(_0x17dbb0,null));};exports[_0x5584('0x4d')]=function(_0x408eab,_0x5518c0){var _0x3d94ad={'raw':!![],'where':{'id':_0x408eab['params']['id']}},_0x8d203d={};_0x8d203d[_0x5584('0x36')]=_[_0x5584('0x38')](db[_0x5584('0x32')]['rawAttributes']);_0x8d203d[_0x5584('0x37')]=_[_0x5584('0x38')](_0x408eab[_0x5584('0x37')]);_0x8d203d[_0x5584('0x39')]=_['intersection'](_0x8d203d[_0x5584('0x36')],_0x8d203d[_0x5584('0x37')]);_0x3d94ad[_0x5584('0x3b')]=_['intersection'](_0x8d203d[_0x5584('0x36')],qs[_0x5584('0x3c')](_0x408eab['query'][_0x5584('0x3c')]));_0x3d94ad[_0x5584('0x3b')]=_0x3d94ad[_0x5584('0x3b')][_0x5584('0x3d')]?_0x3d94ad['attributes']:_0x8d203d[_0x5584('0x36')];if(_0x408eab['query'][_0x5584('0x48')]){_0x3d94ad[_0x5584('0x49')]=[{'all':!![]}];}_0x3d94ad=_[_0x5584('0x45')]({},_0x3d94ad,_0x408eab[_0x5584('0x47')]);return db[_0x5584('0x32')][_0x5584('0x4e')](_0x3d94ad)[_0x5584('0x2c')](handleEntityNotFound(_0x5518c0,null))['then'](respondWithResult(_0x5518c0,null))[_0x5584('0x4c')](handleError(_0x5518c0,null));};exports[_0x5584('0x4f')]=function(_0x30c08d,_0x574836){return db['JscriptySessionReport'][_0x5584('0x4f')](_0x30c08d[_0x5584('0x50')],{})['then'](respondWithResult(_0x574836,0xc9))[_0x5584('0x4c')](handleError(_0x574836,null));};exports[_0x5584('0x2b')]=function(_0x32a18c,_0x193935){if(_0x32a18c[_0x5584('0x50')]['id']){delete _0x32a18c['body']['id'];}return db[_0x5584('0x32')][_0x5584('0x4e')]({'where':{'id':_0x32a18c[_0x5584('0x51')]['id']}})['then'](handleEntityNotFound(_0x193935,null))[_0x5584('0x2c')](saveUpdates(_0x32a18c[_0x5584('0x50')],null))[_0x5584('0x2c')](respondWithResult(_0x193935,null))[_0x5584('0x4c')](handleError(_0x193935,null));};exports[_0x5584('0x2d')]=function(_0x5d39bf,_0x14619d){return db[_0x5584('0x32')]['find']({'where':{'id':_0x5d39bf[_0x5584('0x51')]['id']}})[_0x5584('0x2c')](handleEntityNotFound(_0x14619d,null))[_0x5584('0x2c')](removeEntity(_0x14619d,null))[_0x5584('0x4c')](handleError(_0x14619d,null));};exports[_0x5584('0x52')]=function(_0x4b77da,_0x213e78){return db[_0x5584('0x32')][_0x5584('0x52')]()[_0x5584('0x2c')](respondWithResult(_0x213e78,null))[_0x5584('0x4c')](handleError(_0x213e78,null));};exports['getQuestions']=function(_0x5b8465,_0xde36e7,_0x4a639e){var _0x519035={'raw':!![],'where':{}};var _0x2de09e={};var _0x13e5a0={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x5b8465[_0x5584('0x51')]['id']}})[_0x5584('0x2c')](handleEntityNotFound(_0xde36e7,null))[_0x5584('0x2c')](function(_0x4c309a){if(_0x4c309a){_0x2de09e[_0x5584('0x36')]=_[_0x5584('0x38')](db[_0x5584('0x53')][_0x5584('0x33')]);_0x2de09e[_0x5584('0x37')]=_['keys'](_0x5b8465[_0x5584('0x37')]);_0x2de09e[_0x5584('0x39')]=_[_0x5584('0x3a')](_0x2de09e[_0x5584('0x36')],_0x2de09e[_0x5584('0x37')]);_0x519035[_0x5584('0x3b')]=_[_0x5584('0x3a')](_0x2de09e[_0x5584('0x36')],qs['fields'](_0x5b8465[_0x5584('0x37')][_0x5584('0x3c')]));_0x519035['attributes']=_0x519035['attributes']['length']?_0x519035[_0x5584('0x3b')]:_0x2de09e[_0x5584('0x36')];if(!_0x5b8465[_0x5584('0x37')][_0x5584('0x3e')](_0x5584('0x3f'))){_0x519035['limit']=qs['limit'](_0x5b8465[_0x5584('0x37')]['limit']);_0x519035[_0x5584('0x22')]=qs[_0x5584('0x22')](_0x5b8465[_0x5584('0x37')]['offset']);}_0x519035[_0x5584('0x40')]=qs[_0x5584('0x41')](_0x5b8465[_0x5584('0x37')][_0x5584('0x41')]);_0x519035['where']=qs[_0x5584('0x39')](_[_0x5584('0x43')](_0x5b8465[_0x5584('0x37')],_0x2de09e[_0x5584('0x39')]));_0x519035['where'][_0x5584('0x54')]=_0x4c309a['id'];if(_0x5b8465[_0x5584('0x37')][_0x5584('0x44')]){_0x519035[_0x5584('0x42')]=_['merge'](_0x519035[_0x5584('0x42')],{'$or':_[_0x5584('0x31')](_0x519035['attributes'],function(_0x585a2c){var _0x1d8558={};_0x1d8558[_0x585a2c]={'$like':'%'+_0x5b8465['query']['filter']+'%'};return _0x1d8558;})});}_0x519035=_[_0x5584('0x45')]({},_0x519035,_0x5b8465['options']);return db[_0x5584('0x53')]['count']({'where':_0x519035['where']})[_0x5584('0x2c')](function(_0x538f3a){_0x13e5a0[_0x5584('0x25')]=_0x538f3a;if(_0x5b8465['query'][_0x5584('0x48')]){_0x519035[_0x5584('0x49')]=[{'all':!![]}];}return db[_0x5584('0x53')][_0x5584('0x4a')](_0x519035);})[_0x5584('0x2c')](function(_0x124b62){_0x13e5a0['rows']=_0x124b62;return _0x13e5a0;});}})['then'](respondWithFilteredResult(_0xde36e7,_0x519035))[_0x5584('0x4c')](handleError(_0xde36e7,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index da111fe..e0aa48c 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 _0x71ab=['exports','define','JscriptySessionReport','report_jscripty_sessions','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes'];(function(_0x1c88e1,_0x2f92ff){var _0x38c8d8=function(_0x1ed00c){while(--_0x1ed00c){_0x1c88e1['push'](_0x1c88e1['shift']());}};_0x38c8d8(++_0x2f92ff);}(_0x71ab,0x64));var _0xb71a=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x71ab[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var logger=require('../../config/logger')(_0xb71a('0x1'));var moment=require('moment');var BPromise=require(_0xb71a('0x2'));var rp=require(_0xb71a('0x3'));var fs=require('fs');var path=require(_0xb71a('0x4'));var rimraf=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var attributes=require(_0xb71a('0x7'));module[_0xb71a('0x8')]=function(_0x38d931,_0x22c072){return _0x38d931[_0xb71a('0x9')](_0xb71a('0xa'),attributes,{'tableName':_0xb71a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfcf0=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x213a2b,_0x57e9d6){var _0x2cb5fa=function(_0x182380){while(--_0x182380){_0x213a2b['push'](_0x213a2b['shift']());}};_0x2cb5fa(++_0x57e9d6);}(_0xfcf0,0x138));var _0x0fcf=function(_0x59ae8f,_0x148344){_0x59ae8f=_0x59ae8f-0x0;var _0x3900b5=_0xfcf0[_0x59ae8f];return _0x3900b5;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var logger=require('../../config/logger')(_0x0fcf('0x2'));var moment=require(_0x0fcf('0x3'));var BPromise=require(_0x0fcf('0x4'));var rp=require(_0x0fcf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var attributes=require(_0x0fcf('0x8'));module[_0x0fcf('0x9')]=function(_0x1bace8,_0x1a7b03){return _0x1bace8[_0x0fcf('0xa')](_0x0fcf('0xb'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 74bb32a..d957516 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 _0x896e=['JscriptySessionReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x333ec4,_0x22edd7){var _0x2c87f7=function(_0x541c4f){while(--_0x541c4f){_0x333ec4['push'](_0x333ec4['shift']());}};_0x2c87f7(++_0x22edd7);}(_0x896e,0x1e9));var _0xe896=function(_0x57bb6f,_0x18d90f){_0x57bb6f=_0x57bb6f-0x0;var _0x254ba2=_0x896e[_0x57bb6f];return _0x254ba2;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7a0721,_0x3b902c,_0x264eeb){return new BPromise(function(_0x43c619,_0x5a1909){return client[_0xe896('0xd')](_0x7a0721,_0x264eeb)[_0xe896('0xe')](function(_0x37a90d){logger['info'](_0xe896('0xf'),_0x3b902c,'request\x20sent');logger[_0xe896('0x10')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x3b902c,_0xe896('0x11'),JSON[_0xe896('0x12')](_0x37a90d));if(_0x37a90d[_0xe896('0x13')]){if(_0x37a90d['error'][_0xe896('0x14')]===0x1f4){logger[_0xe896('0x13')](_0xe896('0xf'),_0x3b902c,_0x37a90d['error'][_0xe896('0x15')]);return _0x5a1909(_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);}logger['error'](_0xe896('0xf'),_0x3b902c,_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);return _0x43c619(_0x37a90d['error']['message']);}else{logger[_0xe896('0x16')](_0xe896('0xf'),_0x3b902c,'request\x20sent');_0x43c619(_0x37a90d['result'][_0xe896('0x15')]);}})[_0xe896('0x17')](function(_0x57f04b){logger[_0xe896('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x3b902c,_0x57f04b);_0x5a1909(_0x57f04b);});});} \ No newline at end of file +var _0x5464=['info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x12d1b1,_0x23aa48){var _0x59f874=function(_0x4cf2e2){while(--_0x4cf2e2){_0x12d1b1['push'](_0x12d1b1['shift']());}};_0x59f874(++_0x23aa48);}(_0x5464,0x15d));var _0x4546=function(_0x4aa4b5,_0x5313e4){_0x4aa4b5=_0x4aa4b5-0x0;var _0x5d9cbb=_0x5464[_0x4aa4b5];return _0x5d9cbb;};'use strict';var _=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var moment=require(_0x4546('0x2'));var BPromise=require('bluebird');var rs=require(_0x4546('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4546('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4546('0x5'))(_0x4546('0x6'));var config=require(_0x4546('0x7'));var jayson=require(_0x4546('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5c5e09,_0x224c7c,_0x36c875){return new BPromise(function(_0x1a76c1,_0x2e860a){return client[_0x4546('0x9')](_0x5c5e09,_0x36c875)[_0x4546('0xa')](function(_0x11d63e){logger[_0x4546('0xb')](_0x4546('0xc'),_0x224c7c,'request\x20sent');logger[_0x4546('0xd')](_0x4546('0xe'),_0x224c7c,_0x4546('0xf'),JSON['stringify'](_0x11d63e));if(_0x11d63e[_0x4546('0x10')]){if(_0x11d63e[_0x4546('0x10')][_0x4546('0x11')]===0x1f4){logger[_0x4546('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x224c7c,_0x11d63e['error'][_0x4546('0x12')]);return _0x2e860a(_0x11d63e['error']['message']);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x224c7c,_0x11d63e['error']['message']);return _0x1a76c1(_0x11d63e[_0x4546('0x10')]['message']);}else{logger[_0x4546('0xb')]('JscriptySessionReport,\x20%s,\x20%s',_0x224c7c,_0x4546('0xf'));_0x1a76c1(_0x11d63e['result'][_0x4546('0x12')]);}})[_0x4546('0x13')](function(_0x24b32a){logger[_0x4546('0x10')](_0x4546('0xc'),_0x224c7c,_0x24b32a);_0x2e860a(_0x24b32a);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 0a29544..431d6a6 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 _0xe041=['index','put','isAuthenticated','downloadLogFile','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x18a1e8,_0x20ced8){var _0x484ee8=function(_0x245779){while(--_0x245779){_0x18a1e8['push'](_0x18a1e8['shift']());}};_0x484ee8(++_0x20ced8);}(_0xe041,0x1a4));var _0x1e04=function(_0x57e924,_0x2916a5){_0x57e924=_0x57e924-0x0;var _0x262cc2=_0xe041[_0x57e924];return _0x262cc2;};'use strict';var multer=require(_0x1e04('0x0'));var util=require(_0x1e04('0x1'));var path=require(_0x1e04('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1e04('0x3')]();var fs_extra=require(_0x1e04('0x4'));var auth=require(_0x1e04('0x5'));var interaction=require(_0x1e04('0x6'));var config=require(_0x1e04('0x7'));var controller=require('./license.controller');router[_0x1e04('0x8')]('/',controller[_0x1e04('0x9')]);router[_0x1e04('0xa')]('/:id',auth[_0x1e04('0xb')](),controller['update']);router[_0x1e04('0x8')]('/download_log_file',auth['isAuthenticated'](),controller[_0x1e04('0xc')]);module['exports']=router; \ No newline at end of file +var _0x5a9f=['isAuthenticated','update','get','/download_log_file','downloadLogFile','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','index','/:id'];(function(_0x4267d7,_0x13dc39){var _0x225836=function(_0x3f5fe9){while(--_0x3f5fe9){_0x4267d7['push'](_0x4267d7['shift']());}};_0x225836(++_0x13dc39);}(_0x5a9f,0xcc));var _0xf5a9=function(_0x3f999c,_0x5b6c35){_0x3f999c=_0x3f999c-0x0;var _0x253755=_0x5a9f[_0x3f999c];return _0x253755;};'use strict';var multer=require(_0xf5a9('0x0'));var util=require(_0xf5a9('0x1'));var path=require(_0xf5a9('0x2'));var timeout=require(_0xf5a9('0x3'));var express=require('express');var router=express[_0xf5a9('0x4')]();var fs_extra=require(_0xf5a9('0x5'));var auth=require(_0xf5a9('0x6'));var interaction=require(_0xf5a9('0x7'));var config=require(_0xf5a9('0x8'));var controller=require(_0xf5a9('0x9'));router['get']('/',controller[_0xf5a9('0xa')]);router['put'](_0xf5a9('0xb'),auth[_0xf5a9('0xc')](),controller[_0xf5a9('0xd')]);router[_0xf5a9('0xe')](_0xf5a9('0xf'),auth['isAuthenticated'](),controller[_0xf5a9('0x10')]);module[_0xf5a9('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 055e570..c45c54e 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 _0x107f=['exports','TEXT','STRING','sequelize'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x107f,0x1b7));var _0xf107=function(_0x450cfe,_0x349562){_0x450cfe=_0x450cfe-0x0;var _0x3806ad=_0x107f[_0x450cfe];return _0x3806ad;};'use strict';var Sequelize=require(_0xf107('0x0'));module[_0xf107('0x1')]={'license':{'type':Sequelize[_0xf107('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xf107('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe0e1=['sequelize','TEXT','STRING','INTEGER'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xe0e1,0x110));var _0x1e0e=function(_0x5027fd,_0x6e219d){_0x5027fd=_0x5027fd-0x0;var _0x2be6d6=_0xe0e1[_0x5027fd];return _0x2be6d6;};'use strict';var Sequelize=require(_0x1e0e('0x0'));module['exports']={'license':{'type':Sequelize[_0x1e0e('0x1')]},'data1':{'type':Sequelize[_0x1e0e('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x1e0e('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index bbb27e5..f8c12ef 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 _0x7413=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','destroy','error','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','catch','update','body','params','get','checkLicense','key','demo','join','/var','log','xcally','Content-disposition','attachment;\x20filename=','Content-Type','download','eml-format','moment','bluebird','util','to-csv','fs-extra','lodash','squel','jsforce','papaparse','ioredis'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x7413,0x1dd));var _0x3741=function(_0xed269c,_0x33bdf4){_0xed269c=_0xed269c-0x0;var _0x4b6cf1=_0x7413[_0xed269c];return _0x4b6cf1;};'use strict';var emlformat=require(_0x3741('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3741('0x1'));var BPromise=require(_0x3741('0x2'));var Mustache=require('mustache');var util=require(_0x3741('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x3741('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3741('0x5'));var _=require(_0x3741('0x6'));var squel=require(_0x3741('0x7'));var crypto=require('crypto');var jsforce=require(_0x3741('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x3741('0x4'));var querystring=require('querystring');var Papa=require(_0x3741('0x9'));var Redis=require(_0x3741('0xa'));var authService=require(_0x3741('0xb'));var qs=require(_0x3741('0xc'));var as=require(_0x3741('0xd'));var hardwareService=require(_0x3741('0xe'));var logger=require(_0x3741('0xf'))(_0x3741('0x10'));var utils=require(_0x3741('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x3741('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5aeff8,_0x55cf6f){_0x55cf6f=_0x55cf6f||0xcc;return function(_0x2af8b2){if(_0x2af8b2){return _0x5aeff8[_0x3741('0x13')](_0x55cf6f);}return _0x5aeff8[_0x3741('0x14')](_0x55cf6f)[_0x3741('0x15')]();};}function respondWithResult(_0x47ee04,_0x19ca62){_0x19ca62=_0x19ca62||0xc8;return function(_0x13353f){if(_0x13353f){return _0x47ee04[_0x3741('0x14')](_0x19ca62)[_0x3741('0x16')](_0x13353f);}};}function respondWithFilteredResult(_0x4ebcf6,_0x1ab12d){return function(_0x812d5e){if(_0x812d5e){var _0x28e276=typeof _0x1ab12d[_0x3741('0x17')]===_0x3741('0x18')&&typeof _0x1ab12d[_0x3741('0x19')]==='undefined';var _0x306453=_0x812d5e['count'];var _0x23c862=_0x28e276?0x0:_0x1ab12d['offset'];var _0x3200f5=_0x28e276?_0x812d5e['count']:_0x1ab12d[_0x3741('0x17')]+_0x1ab12d[_0x3741('0x19')];var _0x497bf3;if(_0x3200f5>=_0x306453){_0x3200f5=_0x306453;_0x497bf3=0xc8;}else{_0x497bf3=0xce;}_0x4ebcf6[_0x3741('0x14')](_0x497bf3);return _0x4ebcf6[_0x3741('0x1a')](_0x3741('0x1b'),_0x23c862+'-'+_0x3200f5+'/'+_0x306453)[_0x3741('0x16')](_0x812d5e);}return null;};}function patchUpdates(_0x555b13){return function(_0x11c9b0){try{jsonpatch[_0x3741('0x1c')](_0x11c9b0,_0x555b13,!![]);}catch(_0x2843c3){return BPromise[_0x3741('0x1d')](_0x2843c3);}return _0x11c9b0['save']();};}function saveUpdates(_0x43013c,_0x15510d){return function(_0x2bd9e8){if(_0x2bd9e8){return _0x2bd9e8['update'](_0x43013c)[_0x3741('0x1e')](function(_0x5bb9cf){return _0x5bb9cf;});}return null;};}function removeEntity(_0x451284,_0x246be5){return function(_0x1edda9){if(_0x1edda9){return _0x1edda9[_0x3741('0x1f')]()['then'](function(){_0x451284['status'](0xcc)[_0x3741('0x15')]();});}};}function handleEntityNotFound(_0x507439,_0xbde400){return function(_0x30a8ce){if(!_0x30a8ce){_0x507439[_0x3741('0x13')](0x194);}return _0x30a8ce;};}function handleError(_0x5c4baa,_0x49eba5){_0x49eba5=_0x49eba5||0x1f4;return function(_0xb929b2){logger[_0x3741('0x20')](_0xb929b2['stack']);if(_0xb929b2[_0x3741('0x21')]){delete _0xb929b2['name'];}_0x5c4baa[_0x3741('0x14')](_0x49eba5)[_0x3741('0x22')](_0xb929b2);};}var utilLicense=require(_0x3741('0x12'));exports[_0x3741('0x23')]=function(_0x9e3d8f,_0x20f187){var _0x953a68={'raw':!![],'where':{'id':0x1}},_0x43f8b4={};_0x43f8b4[_0x3741('0x24')]=_[_0x3741('0x25')](db[_0x3741('0x26')][_0x3741('0x27')]);_0x43f8b4[_0x3741('0x28')]=_[_0x3741('0x25')](_0x9e3d8f['query']);_0x43f8b4[_0x3741('0x29')]=_[_0x3741('0x2a')](_0x43f8b4[_0x3741('0x24')],_0x43f8b4[_0x3741('0x28')]);_0x953a68[_0x3741('0x2b')]=_[_0x3741('0x2a')](_0x43f8b4[_0x3741('0x24')],qs[_0x3741('0x2c')](_0x9e3d8f['query']['fields']));_0x953a68['attributes']=_0x953a68[_0x3741('0x2b')]['length']?_0x953a68[_0x3741('0x2b')]:_0x43f8b4[_0x3741('0x24')];_0x953a68=_['merge']({},_0x953a68,_0x9e3d8f['options']);return utilLicense['getLicense'](_0x953a68)[_0x3741('0x1e')](respondWithResult(_0x20f187,null))[_0x3741('0x2d')](handleError(_0x20f187,null));};exports[_0x3741('0x2e')]=function(_0x358cdb,_0x1c87d6){if(_0x358cdb['body']['id']){delete _0x358cdb[_0x3741('0x2f')]['id'];}return db[_0x3741('0x26')]['find']({'where':{'id':_0x358cdb[_0x3741('0x30')]['id']}})['then'](handleEntityNotFound(_0x1c87d6,null))[_0x3741('0x1e')](function(_0x1ec11d){var _0x417e24=_0x1ec11d[_0x3741('0x31')]({'plain':!![]});return utilLicense[_0x3741('0x32')](_0x417e24,_0x358cdb['body'][_0x3741('0x33')]);})['then'](function(_0x49de44){if(!_0x49de44[_0x3741('0x34')]){return saveUpdates(_0x358cdb[_0x3741('0x2f')],null);}return _0x49de44;})[_0x3741('0x1e')](respondWithResult(_0x1c87d6,null))[_0x3741('0x2d')](handleError(_0x1c87d6,null));};exports['downloadLogFile']=function(_0x273173,_0x30a317){var _0x1f8450='license-info.log';var _0x2bc366=path[_0x3741('0x35')](_0x3741('0x36'),_0x3741('0x37'),_0x3741('0x38'),_0x1f8450);_0x30a317['setHeader'](_0x3741('0x39'),_0x3741('0x3a')+_0x1f8450);_0x30a317['set'](_0x3741('0x3b'),'text/plain');_0x30a317[_0x3741('0x3c')](_0x2bc366);}; \ No newline at end of file +var _0x116d=['xcally','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','name','send','index','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','body','License','find','params','get','checkLicense','demo','downloadLogFile','license-info.log','join','/var','log'];(function(_0x4ffaf4,_0x1de0ef){var _0x43a8eb=function(_0x1fc979){while(--_0x1fc979){_0x4ffaf4['push'](_0x4ffaf4['shift']());}};_0x43a8eb(++_0x1de0ef);}(_0x116d,0xe1));var _0xd116=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x116d[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require(_0xd116('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd116('0x1'));var jsonpatch=require(_0xd116('0x2'));var rp=require(_0xd116('0x3'));var moment=require('moment');var BPromise=require(_0xd116('0x4'));var Mustache=require(_0xd116('0x5'));var util=require(_0xd116('0x6'));var path=require(_0xd116('0x7'));var sox=require(_0xd116('0x8'));var csv=require(_0xd116('0x9'));var ejs=require(_0xd116('0xa'));var fs=require('fs');var fs_extra=require(_0xd116('0xb'));var _=require(_0xd116('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd116('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd116('0xe'));var Papa=require('papaparse');var Redis=require(_0xd116('0xf'));var authService=require(_0xd116('0x10'));var qs=require(_0xd116('0x11'));var as=require(_0xd116('0x12'));var hardwareService=require(_0xd116('0x13'));var logger=require(_0xd116('0x14'))(_0xd116('0x15'));var utils=require('../../config/utils');var config=require(_0xd116('0x16'));var licenseUtil=require(_0xd116('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4918b5,_0xfe6e23){_0xfe6e23=_0xfe6e23||0xcc;return function(_0x1ba1b2){if(_0x1ba1b2){return _0x4918b5[_0xd116('0x18')](_0xfe6e23);}return _0x4918b5['status'](_0xfe6e23)[_0xd116('0x19')]();};}function respondWithResult(_0x54d36a,_0x3177d4){_0x3177d4=_0x3177d4||0xc8;return function(_0x31b4cb){if(_0x31b4cb){return _0x54d36a[_0xd116('0x1a')](_0x3177d4)[_0xd116('0x1b')](_0x31b4cb);}};}function respondWithFilteredResult(_0x388037,_0x23f313){return function(_0x4f7fd4){if(_0x4f7fd4){var _0x3982d6=typeof _0x23f313[_0xd116('0x1c')]==='undefined'&&typeof _0x23f313[_0xd116('0x1d')]===_0xd116('0x1e');var _0x3fae40=_0x4f7fd4[_0xd116('0x1f')];var _0x145e84=_0x3982d6?0x0:_0x23f313[_0xd116('0x1c')];var _0x151932=_0x3982d6?_0x4f7fd4[_0xd116('0x1f')]:_0x23f313[_0xd116('0x1c')]+_0x23f313[_0xd116('0x1d')];var _0x5485fa;if(_0x151932>=_0x3fae40){_0x151932=_0x3fae40;_0x5485fa=0xc8;}else{_0x5485fa=0xce;}_0x388037[_0xd116('0x1a')](_0x5485fa);return _0x388037[_0xd116('0x20')](_0xd116('0x21'),_0x145e84+'-'+_0x151932+'/'+_0x3fae40)['json'](_0x4f7fd4);}return null;};}function patchUpdates(_0x446496){return function(_0x1dc0af){try{jsonpatch[_0xd116('0x22')](_0x1dc0af,_0x446496,!![]);}catch(_0x13d06e){return BPromise[_0xd116('0x23')](_0x13d06e);}return _0x1dc0af['save']();};}function saveUpdates(_0xa68e2d,_0x58d851){return function(_0x1096cb){if(_0x1096cb){return _0x1096cb[_0xd116('0x24')](_0xa68e2d)[_0xd116('0x25')](function(_0x194213){return _0x194213;});}return null;};}function removeEntity(_0x23ca46,_0x3c6003){return function(_0x166063){if(_0x166063){return _0x166063[_0xd116('0x26')]()[_0xd116('0x25')](function(){_0x23ca46[_0xd116('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x571fb6,_0x22423f){return function(_0x4453c6){if(!_0x4453c6){_0x571fb6[_0xd116('0x18')](0x194);}return _0x4453c6;};}function handleError(_0x15e4f4,_0x5e82d3){_0x5e82d3=_0x5e82d3||0x1f4;return function(_0x508cb7){logger['error'](_0x508cb7['stack']);if(_0x508cb7[_0xd116('0x27')]){delete _0x508cb7['name'];}_0x15e4f4[_0xd116('0x1a')](_0x5e82d3)[_0xd116('0x28')](_0x508cb7);};}var utilLicense=require(_0xd116('0x17'));exports[_0xd116('0x29')]=function(_0x42200d,_0x16424e){var _0x13c9f5={'raw':!![],'where':{'id':0x1}},_0x2608b5={};_0x2608b5[_0xd116('0x2a')]=_[_0xd116('0x2b')](db['License'][_0xd116('0x2c')]);_0x2608b5['query']=_[_0xd116('0x2b')](_0x42200d[_0xd116('0x2d')]);_0x2608b5[_0xd116('0x2e')]=_[_0xd116('0x2f')](_0x2608b5[_0xd116('0x2a')],_0x2608b5[_0xd116('0x2d')]);_0x13c9f5[_0xd116('0x30')]=_['intersection'](_0x2608b5[_0xd116('0x2a')],qs[_0xd116('0x31')](_0x42200d['query'][_0xd116('0x31')]));_0x13c9f5[_0xd116('0x30')]=_0x13c9f5['attributes'][_0xd116('0x32')]?_0x13c9f5[_0xd116('0x30')]:_0x2608b5[_0xd116('0x2a')];_0x13c9f5=_[_0xd116('0x33')]({},_0x13c9f5,_0x42200d[_0xd116('0x34')]);return utilLicense[_0xd116('0x35')](_0x13c9f5)['then'](respondWithResult(_0x16424e,null))[_0xd116('0x36')](handleError(_0x16424e,null));};exports[_0xd116('0x24')]=function(_0x4f8070,_0x423ee8){if(_0x4f8070[_0xd116('0x37')]['id']){delete _0x4f8070[_0xd116('0x37')]['id'];}return db[_0xd116('0x38')][_0xd116('0x39')]({'where':{'id':_0x4f8070[_0xd116('0x3a')]['id']}})[_0xd116('0x25')](handleEntityNotFound(_0x423ee8,null))[_0xd116('0x25')](function(_0x2f3a1e){var _0x31aeb7=_0x2f3a1e[_0xd116('0x3b')]({'plain':!![]});return utilLicense[_0xd116('0x3c')](_0x31aeb7,_0x4f8070[_0xd116('0x37')]['key']);})[_0xd116('0x25')](function(_0x51e0b8){if(!_0x51e0b8[_0xd116('0x3d')]){return saveUpdates(_0x4f8070['body'],null);}return _0x51e0b8;})[_0xd116('0x25')](respondWithResult(_0x423ee8,null))[_0xd116('0x36')](handleError(_0x423ee8,null));};exports[_0xd116('0x3e')]=function(_0x334196,_0x51f2f2){var _0x2e6bd9=_0xd116('0x3f');var _0x577e82=path[_0xd116('0x40')](_0xd116('0x41'),_0xd116('0x42'),_0xd116('0x43'),_0x2e6bd9);_0x51f2f2['setHeader'](_0xd116('0x44'),_0xd116('0x45')+_0x2e6bd9);_0x51f2f2[_0xd116('0x20')](_0xd116('0x46'),_0xd116('0x47'));_0x51f2f2[_0xd116('0x48')](_0x577e82);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index e1dff32..0fca343 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 _0xec36=['api','moment','bluebird','request-promise','./license.attributes','exports','define','License','lodash','../../config/logger'];(function(_0x22de67,_0x3922e9){var _0x4cafed=function(_0x2e9b33){while(--_0x2e9b33){_0x22de67['push'](_0x22de67['shift']());}};_0x4cafed(++_0x3922e9);}(_0xec36,0xda));var _0x6ec3=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0xec36[_0x819464];return _0x49dcc0;};'use strict';var _=require(_0x6ec3('0x0'));var util=require('util');var logger=require(_0x6ec3('0x1'))(_0x6ec3('0x2'));var moment=require(_0x6ec3('0x3'));var BPromise=require(_0x6ec3('0x4'));var rp=require(_0x6ec3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6ec3('0x6'));module[_0x6ec3('0x7')]=function(_0x2777f4,_0x3c401f){return _0x2777f4[_0x6ec3('0x8')](_0x6ec3('0x9'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x573a=['path','rimraf','../../config/environment','./license.attributes','exports','License','lodash','util','api','moment','request-promise'];(function(_0xc7230,_0x415cd5){var _0x12a0a2=function(_0x35eee1){while(--_0x35eee1){_0xc7230['push'](_0xc7230['shift']());}};_0x12a0a2(++_0x415cd5);}(_0x573a,0xc1));var _0xa573=function(_0x152136,_0x4f14f1){_0x152136=_0x152136-0x0;var _0x20df44=_0x573a[_0x152136];return _0x20df44;};'use strict';var _=require(_0xa573('0x0'));var util=require(_0xa573('0x1'));var logger=require('../../config/logger')(_0xa573('0x2'));var moment=require(_0xa573('0x3'));var BPromise=require('bluebird');var rp=require(_0xa573('0x4'));var fs=require('fs');var path=require(_0xa573('0x5'));var rimraf=require(_0xa573('0x6'));var config=require(_0xa573('0x7'));var attributes=require(_0xa573('0x8'));module[_0xa573('0x9')]=function(_0x41e8ca,_0x1408fd){return _0x41e8ca['define'](_0xa573('0xa'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 1a7d4fe..b524a3d 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 _0x8206=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','License,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x897cb,_0x56ae0f){var _0x4966c8=function(_0x64f61f){while(--_0x64f61f){_0x897cb['push'](_0x897cb['shift']());}};_0x4966c8(++_0x56ae0f);}(_0x8206,0x158));var _0x6820=function(_0x4e3817,_0x6bcf14){_0x4e3817=_0x4e3817-0x0;var _0x159f8a=_0x8206[_0x4e3817];return _0x159f8a;};'use strict';var _=require(_0x6820('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6820('0x1'));var rs=require(_0x6820('0x2'));var fs=require('fs');var Redis=require(_0x6820('0x3'));var db=require(_0x6820('0x4'))['db'];var utils=require(_0x6820('0x5'));var logger=require(_0x6820('0x6'))(_0x6820('0x7'));var config=require(_0x6820('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6820('0x9')][_0x6820('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x228793,_0x31bdff,_0x427fef){return new BPromise(function(_0x46c075,_0x483a45){return client[_0x6820('0xb')](_0x228793,_0x427fef)[_0x6820('0xc')](function(_0x18d09d){logger[_0x6820('0xd')]('License,\x20%s,\x20%s',_0x31bdff,_0x6820('0xe'));logger[_0x6820('0xf')](_0x6820('0x10'),_0x31bdff,'request\x20sent',JSON[_0x6820('0x11')](_0x18d09d));if(_0x18d09d[_0x6820('0x12')]){if(_0x18d09d[_0x6820('0x12')]['code']===0x1f4){logger[_0x6820('0x12')](_0x6820('0x13'),_0x31bdff,_0x18d09d[_0x6820('0x12')][_0x6820('0x14')]);return _0x483a45(_0x18d09d[_0x6820('0x12')][_0x6820('0x14')]);}logger[_0x6820('0x12')](_0x6820('0x13'),_0x31bdff,_0x18d09d['error'][_0x6820('0x14')]);return _0x46c075(_0x18d09d[_0x6820('0x12')]['message']);}else{logger['info']('License,\x20%s,\x20%s',_0x31bdff,_0x6820('0xe'));_0x46c075(_0x18d09d[_0x6820('0x15')][_0x6820('0x14')]);}})[_0x6820('0x16')](function(_0x2ebc06){logger[_0x6820('0x12')](_0x6820('0x13'),_0x31bdff,_0x2ebc06);_0x483a45(_0x2ebc06);});});} \ No newline at end of file +var _0xc243=['then','info','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xc243,0x144));var _0x3c24=function(_0x585133,_0x2412a1){_0x585133=_0x585133-0x0;var _0x18254a=_0xc243[_0x585133];return _0x18254a;};'use strict';var _=require('lodash');var util=require(_0x3c24('0x0'));var moment=require('moment');var BPromise=require(_0x3c24('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3c24('0x2'));var db=require(_0x3c24('0x3'))['db'];var utils=require(_0x3c24('0x4'));var logger=require(_0x3c24('0x5'))(_0x3c24('0x6'));var config=require(_0x3c24('0x7'));var jayson=require(_0x3c24('0x8'));var client=jayson[_0x3c24('0x9')][_0x3c24('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x171988,_0x4435b0,_0x3dffa6){return new BPromise(function(_0x465aa6,_0x41b3e9){return client[_0x3c24('0xb')](_0x171988,_0x3dffa6)[_0x3c24('0xc')](function(_0x2afe2e){logger[_0x3c24('0xd')]('License,\x20%s,\x20%s',_0x4435b0,_0x3c24('0xe'));logger['debug'](_0x3c24('0xf'),_0x4435b0,_0x3c24('0xe'),JSON[_0x3c24('0x10')](_0x2afe2e));if(_0x2afe2e[_0x3c24('0x11')]){if(_0x2afe2e['error'][_0x3c24('0x12')]===0x1f4){logger['error'](_0x3c24('0x13'),_0x4435b0,_0x2afe2e[_0x3c24('0x11')]['message']);return _0x41b3e9(_0x2afe2e['error'][_0x3c24('0x14')]);}logger[_0x3c24('0x11')]('License,\x20%s,\x20%s',_0x4435b0,_0x2afe2e[_0x3c24('0x11')][_0x3c24('0x14')]);return _0x465aa6(_0x2afe2e[_0x3c24('0x11')][_0x3c24('0x14')]);}else{logger[_0x3c24('0xd')](_0x3c24('0x13'),_0x4435b0,_0x3c24('0xe'));_0x465aa6(_0x2afe2e['result'][_0x3c24('0x14')]);}})['catch'](function(_0x4f20d8){logger[_0x3c24('0x11')](_0x3c24('0x13'),_0x4435b0,_0x4f20d8);_0x41b3e9(_0x4f20d8);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 0905e6c..e8e49e6 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 _0x7019=['Router','fs-extra','../../config/environment','get','index','isAuthenticated','describe','show','/:id/dispositions','/:id/canned_answers','/:id/in_servers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/verify','/:id/users','getAgents','post','addDisposition','addSmtp','addApplications','addAgents','put','/:id','delete','removeDispositions','removeAnswers','removeImap','/:id/out_servers','removeSmtp','destroy','removeAgents','exports','multer','util','connect-timeout','express'];(function(_0x208224,_0x389732){var _0x5f0b1e=function(_0x3daa25){while(--_0x3daa25){_0x208224['push'](_0x208224['shift']());}};_0x5f0b1e(++_0x389732);}(_0x7019,0x196));var _0x9701=function(_0x190682,_0x398101){_0x190682=_0x190682-0x0;var _0x17e720=_0x7019[_0x190682];return _0x17e720;};'use strict';var multer=require(_0x9701('0x0'));var util=require(_0x9701('0x1'));var path=require('path');var timeout=require(_0x9701('0x2'));var express=require(_0x9701('0x3'));var router=express[_0x9701('0x4')]();var fs_extra=require(_0x9701('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9701('0x6'));var controller=require('./mailAccount.controller');router[_0x9701('0x7')]('/',auth['isAuthenticated'](),controller[_0x9701('0x8')]);router[_0x9701('0x7')]('/describe',auth[_0x9701('0x9')](),controller[_0x9701('0xa')]);router[_0x9701('0x7')]('/:id',auth[_0x9701('0x9')](),controller[_0x9701('0xb')]);router['get'](_0x9701('0xc'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x9701('0x7')](_0x9701('0xd'),auth[_0x9701('0x9')](),controller['getAnswers']);router['get'](_0x9701('0xe'),auth[_0x9701('0x9')](),controller[_0x9701('0xf')]);router['get']('/:id/out_servers',auth[_0x9701('0x9')](),controller[_0x9701('0x10')]);router[_0x9701('0x7')](_0x9701('0x11'),auth[_0x9701('0x9')](),controller[_0x9701('0x12')]);router[_0x9701('0x7')](_0x9701('0x13'),auth[_0x9701('0x9')](),controller['getApplications']);router['get'](_0x9701('0x14'),auth[_0x9701('0x9')](),controller[_0x9701('0x15')]);router[_0x9701('0x7')](_0x9701('0x16'),auth[_0x9701('0x9')](),controller['verifySmtp']);router[_0x9701('0x7')](_0x9701('0x17'),auth[_0x9701('0x9')](),controller[_0x9701('0x18')]);router[_0x9701('0x19')](_0x9701('0xc'),auth['isAuthenticated'](),controller[_0x9701('0x1a')]);router['post'](_0x9701('0xd'),auth[_0x9701('0x9')](),controller['addAnswer']);router[_0x9701('0x19')]('/',auth[_0x9701('0x9')](),controller['create']);router['post'](_0x9701('0xe'),auth[_0x9701('0x9')](),controller['addImap']);router[_0x9701('0x19')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x9701('0x1b')]);router[_0x9701('0x19')](_0x9701('0x11'),auth[_0x9701('0x9')](),controller['addInteraction']);router[_0x9701('0x19')](_0x9701('0x13'),auth[_0x9701('0x9')](),controller[_0x9701('0x1c')]);router[_0x9701('0x19')]('/:id/send',auth['isAuthenticated'](),controller['send']);router[_0x9701('0x19')]('/:id/users',auth['isAuthenticated'](),controller[_0x9701('0x1d')]);router[_0x9701('0x1e')](_0x9701('0x1f'),auth[_0x9701('0x9')](),controller['update']);router[_0x9701('0x20')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x9701('0x21')]);router['delete'](_0x9701('0xd'),auth['isAuthenticated'](),controller[_0x9701('0x22')]);router['delete']('/:id/in_servers',auth[_0x9701('0x9')](),controller[_0x9701('0x23')]);router[_0x9701('0x20')](_0x9701('0x24'),auth[_0x9701('0x9')](),controller[_0x9701('0x25')]);router[_0x9701('0x20')](_0x9701('0x1f'),auth['isAuthenticated'](),controller[_0x9701('0x26')]);router[_0x9701('0x20')](_0x9701('0x17'),auth[_0x9701('0x9')](),controller[_0x9701('0x27')]);module[_0x9701('0x28')]=router; \ No newline at end of file +var _0x5bc7=['addImap','addSmtp','addInteraction','/:id/send','put','update','delete','removeDispositions','removeAnswers','removeImap','destroy','removeAgents','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./mailAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','/:id/applications','getApplications','/:id/messages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','create'];(function(_0x314ee0,_0x2c854d){var _0x2c618a=function(_0x7c5729){while(--_0x7c5729){_0x314ee0['push'](_0x314ee0['shift']());}};_0x2c618a(++_0x2c854d);}(_0x5bc7,0xbd));var _0x75bc=function(_0x4c168c,_0x583909){_0x4c168c=_0x4c168c-0x0;var _0x2430ec=_0x5bc7[_0x4c168c];return _0x2430ec;};'use strict';var multer=require(_0x75bc('0x0'));var util=require('util');var path=require(_0x75bc('0x1'));var timeout=require(_0x75bc('0x2'));var express=require('express');var router=express[_0x75bc('0x3')]();var fs_extra=require(_0x75bc('0x4'));var auth=require(_0x75bc('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x75bc('0x6'));var controller=require(_0x75bc('0x7'));router['get']('/',auth[_0x75bc('0x8')](),controller[_0x75bc('0x9')]);router[_0x75bc('0xa')](_0x75bc('0xb'),auth[_0x75bc('0x8')](),controller[_0x75bc('0xc')]);router[_0x75bc('0xa')](_0x75bc('0xd'),auth[_0x75bc('0x8')](),controller['show']);router[_0x75bc('0xa')](_0x75bc('0xe'),auth[_0x75bc('0x8')](),controller[_0x75bc('0xf')]);router['get'](_0x75bc('0x10'),auth[_0x75bc('0x8')](),controller['getAnswers']);router[_0x75bc('0xa')](_0x75bc('0x11'),auth[_0x75bc('0x8')](),controller[_0x75bc('0x12')]);router[_0x75bc('0xa')](_0x75bc('0x13'),auth[_0x75bc('0x8')](),controller['getSmtp']);router[_0x75bc('0xa')](_0x75bc('0x14'),auth[_0x75bc('0x8')](),controller['getInteractions']);router[_0x75bc('0xa')](_0x75bc('0x15'),auth['isAuthenticated'](),controller[_0x75bc('0x16')]);router[_0x75bc('0xa')](_0x75bc('0x17'),auth[_0x75bc('0x8')](),controller['getMessages']);router['get'](_0x75bc('0x18'),auth['isAuthenticated'](),controller[_0x75bc('0x19')]);router[_0x75bc('0xa')](_0x75bc('0x1a'),auth['isAuthenticated'](),controller[_0x75bc('0x1b')]);router[_0x75bc('0x1c')]('/:id/dispositions',auth[_0x75bc('0x8')](),controller[_0x75bc('0x1d')]);router[_0x75bc('0x1c')](_0x75bc('0x10'),auth[_0x75bc('0x8')](),controller['addAnswer']);router[_0x75bc('0x1c')]('/',auth['isAuthenticated'](),controller[_0x75bc('0x1e')]);router['post'](_0x75bc('0x11'),auth[_0x75bc('0x8')](),controller[_0x75bc('0x1f')]);router[_0x75bc('0x1c')](_0x75bc('0x13'),auth[_0x75bc('0x8')](),controller[_0x75bc('0x20')]);router[_0x75bc('0x1c')](_0x75bc('0x14'),auth[_0x75bc('0x8')](),controller[_0x75bc('0x21')]);router[_0x75bc('0x1c')](_0x75bc('0x15'),auth[_0x75bc('0x8')](),controller['addApplications']);router[_0x75bc('0x1c')](_0x75bc('0x22'),auth[_0x75bc('0x8')](),controller['send']);router[_0x75bc('0x1c')](_0x75bc('0x1a'),auth[_0x75bc('0x8')](),controller['addAgents']);router[_0x75bc('0x23')](_0x75bc('0xd'),auth[_0x75bc('0x8')](),controller[_0x75bc('0x24')]);router[_0x75bc('0x25')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x75bc('0x26')]);router[_0x75bc('0x25')](_0x75bc('0x10'),auth['isAuthenticated'](),controller[_0x75bc('0x27')]);router['delete'](_0x75bc('0x11'),auth[_0x75bc('0x8')](),controller[_0x75bc('0x28')]);router[_0x75bc('0x25')](_0x75bc('0x13'),auth['isAuthenticated'](),controller['removeSmtp']);router[_0x75bc('0x25')]('/:id',auth['isAuthenticated'](),controller[_0x75bc('0x29')]);router[_0x75bc('0x25')](_0x75bc('0x1a'),auth[_0x75bc('0x8')](),controller[_0x75bc('0x2a')]);module[_0x75bc('0x2b')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 5b98e5c..6545ba3 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 _0xfec4=['exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','gmail','hotmail','yahoo','getDataValue','provider','custom'];(function(_0x41dd01,_0x3287fe){var _0x1b2a58=function(_0x399d16){while(--_0x399d16){_0x41dd01['push'](_0x41dd01['shift']());}};_0x1b2a58(++_0x3287fe);}(_0xfec4,0x77));var _0x4fec=function(_0x292f93,_0x2c6e8e){_0x292f93=_0x292f93-0x0;var _0x5a94b1=_0xfec4[_0x292f93];return _0x5a94b1;};'use strict';var Sequelize=require('sequelize');module[_0x4fec('0x0')]={'description':{'type':Sequelize[_0x4fec('0x1')]},'name':{'type':Sequelize[_0x4fec('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x4fec('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x4fec('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x4fec('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x4fec('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x4fec('0x3')]},'markAsUnread':{'type':Sequelize[_0x4fec('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x4fec('0x1')],'allowNull':![],'defaultValue':_0x4fec('0x4')},'fontSize':{'type':Sequelize[_0x4fec('0x5')](0x2)[_0x4fec('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x4fec('0x3')],'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[_0x4fec('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4fec('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4fec('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x4fec('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4fec('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4fec('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4fec('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4fec('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4fec('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x4fec('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x4fec('0x2')],'defaultValue':![],'comment':_0x4fec('0x8'),'set':function(_0x5352cb){if(!_0x5352cb)this[_0x4fec('0x9')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x4fec('0xa'),_0x5352cb);}},'provider':{'type':Sequelize['ENUM'](_0x4fec('0xb'),_0x4fec('0xc'),_0x4fec('0xd'),'outlook365'),'defaultValue':null,'get':function(){var _0x303d36=this[_0x4fec('0xe')](_0x4fec('0xf'));return _0x303d36||_0x4fec('0x10');},'set':function(_0x5bb07c){if(_0x5bb07c===_0x4fec('0x10')){_0x5bb07c=null;}return this[_0x4fec('0x9')](_0x4fec('0xf'),_0x5bb07c);}}}; \ No newline at end of file +var _0xd38b=['STRING','BOOLEAN','INTEGER','UNSIGNED','TEXT','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','gmail','hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','exports'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xd38b,0xda));var _0xbd38=function(_0x451735,_0x391a76){_0x451735=_0x451735-0x0;var _0x41d1e2=_0xd38b[_0x451735];return _0x41d1e2;};'use strict';var Sequelize=require(_0xbd38('0x0'));module[_0xbd38('0x1')]={'description':{'type':Sequelize[_0xbd38('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xbd38('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xbd38('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xbd38('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xbd38('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xbd38('0x4')](0x2)[_0xbd38('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xbd38('0x6')],'defaultValue':function(){return _0xbd38('0x7');}},'notificationSound':{'type':Sequelize[_0xbd38('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbd38('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbd38('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xbd38('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbd38('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbd38('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbd38('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbd38('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0xbd38('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xbd38('0x3')],'defaultValue':![],'comment':_0xbd38('0x9'),'set':function(_0x347f63){if(!_0x347f63)this[_0xbd38('0xa')](_0xbd38('0xb'),null);this[_0xbd38('0xa')](_0xbd38('0xc'),_0x347f63);}},'provider':{'type':Sequelize['ENUM'](_0xbd38('0xd'),_0xbd38('0xe'),_0xbd38('0xf'),_0xbd38('0x10')),'defaultValue':null,'get':function(){var _0x2bd768=this[_0xbd38('0x11')](_0xbd38('0x12'));return _0x2bd768||'custom';},'set':function(_0x53d7a1){if(_0x53d7a1===_0xbd38('0x13')){_0x53d7a1=null;}return this[_0xbd38('0xa')](_0xbd38('0x12'),_0x53d7a1);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index c7f2e6b..8c5d460 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 _0x66a4=['findOne','nolimit','Disposition','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','key','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','rows','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','Contacts','updatedAt','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','email','attachments','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','subject','out','Interaction','Messages','verifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','sendStatus','status','end','json','undefined','count','offset','Content-Range','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','yahoo','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','pass','modernAuthentication','CloudProviderId','password','host','port','secure','service','authentication','username','Imap','index','MailServerIn','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','MailServerOut','length','options','find','body','provider','custom','Mail\x20Account\x20not\x20found','addDisposition','MailAccountId','create','getDispositions'];(function(_0x220979,_0x46cd13){var _0x3787ce=function(_0x43e4f6){while(--_0x43e4f6){_0x220979['push'](_0x220979['shift']());}};_0x3787ce(++_0x46cd13);}(_0x66a4,0x123));var _0x466a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x66a4[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require(_0x466a('0x0'));var BPromise=require(_0x466a('0x1'));var util=require(_0x466a('0x2'));var path=require(_0x466a('0x3'));var _=require('lodash');var juice=require('juice');var Redis=require('ioredis');var qs=require(_0x466a('0x4'));var logger=require(_0x466a('0x5'))(_0x466a('0x6'));var config=require(_0x466a('0x7'));var db=require(_0x466a('0x8'))['db'];config['redis']=_[_0x466a('0x9')](config[_0x466a('0xa')],{'host':_0x466a('0xb'),'port':0x18eb});var socket=require(_0x466a('0xc'))(new Redis(config[_0x466a('0xa')]));require(_0x466a('0xd'))[_0x466a('0xe')](socket);var jayson=require(_0x466a('0xf'));var client=jayson[_0x466a('0x10')]['http']({'port':0x232b});function respondWithRpcPromise(_0x1ceed9,_0x533862,_0x590920,_0x1a0cca){return new BPromise(function(_0x228851,_0x45e16e){var _0x3379d2=_0x1a0cca||client;return _0x3379d2[_0x466a('0x11')](_0x1ceed9,_0x590920)[_0x466a('0x12')](function(_0x3c41b3){logger[_0x466a('0x13')](_0x466a('0x14'),_0x533862,_0x466a('0x15'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x533862,'request\x20sent',JSON[_0x466a('0x16')](_0x3c41b3));if(_0x3c41b3[_0x466a('0x17')]){if(_0x3c41b3['error'][_0x466a('0x18')]===0x1f4){logger[_0x466a('0x17')](_0x466a('0x14'),_0x533862,_0x3c41b3['error'][_0x466a('0x19')]);return _0x45e16e(_0x3c41b3[_0x466a('0x17')]['message']);}logger[_0x466a('0x17')](_0x466a('0x14'),_0x533862,_0x3c41b3[_0x466a('0x17')][_0x466a('0x19')]);return _0x228851(_0x3c41b3['error'][_0x466a('0x19')]);}else{logger['info'](_0x466a('0x14'),_0x533862,_0x466a('0x15'));_0x228851(_0x3c41b3['result'][_0x466a('0x19')]);}})['catch'](function(_0x56ae02){logger['error'](_0x466a('0x14'),_0x533862,_0x56ae02);_0x45e16e(_0x56ae02);});});}function respondWithStatusCode(_0x16375a,_0x1ed555){_0x1ed555=_0x1ed555||0xcc;return function(_0x48b070){if(_0x48b070){return _0x16375a[_0x466a('0x1a')](_0x1ed555);}return _0x16375a[_0x466a('0x1b')](_0x1ed555)[_0x466a('0x1c')]();};}function respondWithResult(_0x5c69f1,_0x237a41){_0x237a41=_0x237a41||0xc8;return function(_0x431e64){if(_0x431e64){return _0x5c69f1[_0x466a('0x1b')](_0x237a41)[_0x466a('0x1d')](_0x431e64);}};}function respondWithFilteredResult(_0x22a336,_0x275dc2){return function(_0x50377b){if(_0x50377b){var _0x246720=typeof _0x275dc2['offset']==='undefined'&&typeof _0x275dc2['limit']===_0x466a('0x1e');var _0x565387=_0x50377b[_0x466a('0x1f')];var _0x47c610=_0x246720?0x0:_0x275dc2[_0x466a('0x20')];var _0x4a2aa5=_0x246720?_0x50377b[_0x466a('0x1f')]:_0x275dc2['offset']+_0x275dc2['limit'];var _0x5f1bc1;if(_0x4a2aa5>=_0x565387){_0x4a2aa5=_0x565387;_0x5f1bc1=0xc8;}else{_0x5f1bc1=0xce;}_0x22a336[_0x466a('0x1b')](_0x5f1bc1);return _0x22a336['set'](_0x466a('0x21'),_0x47c610+'-'+_0x4a2aa5+'/'+_0x565387)[_0x466a('0x1d')](_0x50377b);}return null;};}function saveUpdates(_0x430b97){return function(_0x1ae09e){if(_0x1ae09e){return _0x1ae09e[_0x466a('0x22')](_0x430b97)[_0x466a('0x12')](function(_0x664c83){return _0x664c83;});}return null;};}function removeEntity(_0x2e9214){return function(_0x10f4ae){if(_0x10f4ae){return _0x10f4ae[_0x466a('0x23')]()[_0x466a('0x12')](function(){var _0x2597db=_0x10f4ae[_0x466a('0x24')]({'plain':!![]});var _0x2b5cf5=_0x466a('0x25');return db[_0x466a('0x26')][_0x466a('0x23')]({'where':{'type':_0x2b5cf5,'resourceId':_0x2597db['id']}})['then'](function(){return _0x10f4ae;});})[_0x466a('0x12')](function(){_0x2e9214[_0x466a('0x1b')](0xcc)[_0x466a('0x1c')]();});}};}function handleEntityNotFound(_0x6b9939){return function(_0x3c11b4){if(!_0x3c11b4){_0x6b9939[_0x466a('0x1a')](0x194);}return _0x3c11b4;};}function handleError(_0x31d91f,_0x5a2245){_0x5a2245=_0x5a2245||0x1f4;return function(_0x456a91){logger[_0x466a('0x17')](_0x456a91[_0x466a('0x27')]);if(_0x456a91[_0x466a('0x28')]){delete _0x456a91[_0x466a('0x28')];}_0x31d91f[_0x466a('0x1b')](_0x5a2245)[_0x466a('0x29')](_0x456a91);};}function getImapHost(_0x47010a){switch(_0x47010a){case'gmail':return'imap.gmail.com';case'yahoo':return _0x466a('0x2a');case _0x466a('0x2b'):return _0x466a('0x2c');case _0x466a('0x2d'):return _0x466a('0x2e');}throw new Error(_0x466a('0x2f'),_0x47010a);}function getSmtpHost(_0x4bc8f3){switch(_0x4bc8f3){case'gmail':return _0x466a('0x30');case _0x466a('0x31'):return _0x466a('0x32');case _0x466a('0x2b'):return _0x466a('0x33');case _0x466a('0x2d'):return _0x466a('0x34');}throw new Error('Unknown\x20email\x20service\x20provider',_0x4bc8f3);}function getAuthenticationOptions(_0x4c3ab0,_0x2ff006){var _0x5d2ac0={};var _0xa2fbcf={};if(_0x4c3ab0){_0x5d2ac0['user']=_0xa2fbcf[_0x466a('0x35')]=_0x2ff006['username'];_0x5d2ac0['password']=_0xa2fbcf[_0x466a('0x36')]=_0x2ff006['password'];if(_0x2ff006[_0x466a('0x37')]){_0x5d2ac0[_0x466a('0x37')]=_0xa2fbcf[_0x466a('0x37')]=!![];_0x5d2ac0[_0x466a('0x38')]=_0xa2fbcf[_0x466a('0x38')]=_0x2ff006[_0x466a('0x38')];_0x5d2ac0[_0x466a('0x39')]=_0xa2fbcf['pass']=null;}else{_0x5d2ac0[_0x466a('0x38')]=_0xa2fbcf[_0x466a('0x38')]=null;}_0x5d2ac0[_0x466a('0x3a')]=getImapHost(_0x4c3ab0);_0x5d2ac0[_0x466a('0x3b')]=0x3e1;_0xa2fbcf[_0x466a('0x3a')]=getSmtpHost(_0x4c3ab0);_0xa2fbcf[_0x466a('0x3b')]=0x24b;_0xa2fbcf[_0x466a('0x3c')]=![];_0x5d2ac0[_0x466a('0x3d')]=_0xa2fbcf['service']=null;}else{if(_0x2ff006[_0x466a('0x3e')]){_0x5d2ac0['user']=_0xa2fbcf[_0x466a('0x35')]=_0x2ff006[_0x466a('0x3f')];_0x5d2ac0[_0x466a('0x39')]=_0xa2fbcf[_0x466a('0x36')]=_0x2ff006[_0x466a('0x39')];}else{_0x5d2ac0[_0x466a('0x3e')]=_0xa2fbcf[_0x466a('0x3e')]=![];_0x5d2ac0[_0x466a('0x35')]=_0xa2fbcf['user']=null;_0x5d2ac0[_0x466a('0x39')]=_0xa2fbcf['pass']=null;}_0x5d2ac0[_0x466a('0x3a')]=_0x2ff006[_0x466a('0x40')]['host'];_0x5d2ac0[_0x466a('0x3b')]=_0x2ff006['Imap'][_0x466a('0x3b')];_0xa2fbcf[_0x466a('0x3a')]=_0x2ff006['Smtp']['host'];_0xa2fbcf[_0x466a('0x3b')]=_0x2ff006['Smtp'][_0x466a('0x3b')];}return{'Imap':_0x5d2ac0,'Smtp':_0xa2fbcf};}exports[_0x466a('0x41')]=function(_0x28c079,_0x926f82){var _0x45b70b={'include':[{'model':db[_0x466a('0x42')],'as':_0x466a('0x40')},{'model':db['MailServerOut'],'as':_0x466a('0x43')},{'model':db[_0x466a('0x44')],'as':_0x466a('0x45')}]},_0x561612={},_0xe16dff={'count':0x0,'rows':[]};var _0x4fadb9=_[_0x466a('0x46')](db[_0x466a('0x47')][_0x466a('0x48')],function(_0x41d7c0){return{'name':_0x41d7c0[_0x466a('0x49')],'type':_0x41d7c0[_0x466a('0x4a')]['key']};});_0x561612[_0x466a('0x4b')]=_[_0x466a('0x46')](_0x4fadb9,_0x466a('0x28'));_0x561612[_0x466a('0x4c')]=_[_0x466a('0x4d')](_0x28c079['query']);_0x561612[_0x466a('0x4e')]=_['intersection'](_0x561612[_0x466a('0x4b')],_0x561612[_0x466a('0x4c')]);_0x45b70b[_0x466a('0x4f')]=_[_0x466a('0x50')](_0x561612['model'],qs[_0x466a('0x51')](_0x28c079['query'][_0x466a('0x51')]));_0x45b70b[_0x466a('0x4f')]=_0x45b70b['attributes']['length']?_0x45b70b['attributes']:_0x561612[_0x466a('0x4b')];if(!_0x28c079[_0x466a('0x4c')][_0x466a('0x52')]('nolimit')){_0x45b70b[_0x466a('0x53')]=qs[_0x466a('0x53')](_0x28c079['query'][_0x466a('0x53')]);_0x45b70b['offset']=qs[_0x466a('0x20')](_0x28c079[_0x466a('0x4c')][_0x466a('0x20')]);}_0x45b70b[_0x466a('0x54')]=qs[_0x466a('0x55')](_0x28c079[_0x466a('0x4c')][_0x466a('0x55')]);_0x45b70b[_0x466a('0x56')]=qs[_0x466a('0x4e')](_[_0x466a('0x57')](_0x28c079[_0x466a('0x4c')],_0x561612['filters']),_0x4fadb9);if(_0x28c079[_0x466a('0x4c')][_0x466a('0x58')]){_0x45b70b['where']=_[_0x466a('0x59')](_0x45b70b[_0x466a('0x56')],{'$or':_['map'](_0x4fadb9,function(_0x5b2364){if(_0x5b2364[_0x466a('0x4a')]!==_0x466a('0x5a')){var _0x3697ca={};_0x3697ca[_0x5b2364[_0x466a('0x28')]]={'$like':'%'+_0x28c079[_0x466a('0x4c')][_0x466a('0x58')]+'%'};return _0x3697ca;}})});}_0x45b70b=_[_0x466a('0x59')]({},_0x45b70b,_0x28c079['options']);var _0x4ba71a={'where':_0x45b70b[_0x466a('0x56')]};return db[_0x466a('0x47')][_0x466a('0x1f')](_0x4ba71a)['then'](function(_0x58f1dd){_0xe16dff[_0x466a('0x1f')]=_0x58f1dd;if(_0x28c079['query'][_0x466a('0x5b')]){_0x45b70b[_0x466a('0x5c')]=[{'all':!![]}];}return db[_0x466a('0x47')][_0x466a('0x5d')](_0x45b70b);})[_0x466a('0x12')](function(_0x199d5c){_0xe16dff['rows']=_0x199d5c;return _0xe16dff;})[_0x466a('0x12')](respondWithFilteredResult(_0x926f82,_0x45b70b))[_0x466a('0x5e')](handleError(_0x926f82,null));};exports[_0x466a('0x5f')]=function(_0x3bc4a2,_0x2d9843){var _0x43fba0={'raw':![],'where':{'id':_0x3bc4a2[_0x466a('0x60')]['id']},'include':[{'model':db[_0x466a('0x42')],'as':'Imap'},{'model':db[_0x466a('0x61')],'as':_0x466a('0x43')},{'model':db['Pause'],'as':_0x466a('0x45')}]},_0x3e2b3c={};_0x3e2b3c['model']=_[_0x466a('0x4d')](db[_0x466a('0x47')][_0x466a('0x48')]);_0x3e2b3c[_0x466a('0x4c')]=_[_0x466a('0x4d')](_0x3bc4a2['query']);_0x3e2b3c[_0x466a('0x4e')]=_[_0x466a('0x50')](_0x3e2b3c[_0x466a('0x4b')],_0x3e2b3c[_0x466a('0x4c')]);_0x43fba0[_0x466a('0x4f')]=_[_0x466a('0x50')](_0x3e2b3c[_0x466a('0x4b')],qs['fields'](_0x3bc4a2[_0x466a('0x4c')]['fields']));_0x43fba0[_0x466a('0x4f')]=_0x43fba0[_0x466a('0x4f')][_0x466a('0x62')]?_0x43fba0[_0x466a('0x4f')]:_0x3e2b3c[_0x466a('0x4b')];if(_0x3bc4a2[_0x466a('0x4c')][_0x466a('0x5b')]){_0x43fba0[_0x466a('0x5c')]=[{'all':!![]}];}_0x43fba0=_[_0x466a('0x59')]({},_0x43fba0,_0x3bc4a2[_0x466a('0x63')]);return db['MailAccount'][_0x466a('0x64')](_0x43fba0)[_0x466a('0x12')](handleEntityNotFound(_0x2d9843,null))[_0x466a('0x12')](respondWithResult(_0x2d9843,null))[_0x466a('0x5e')](handleError(_0x2d9843,null));};exports[_0x466a('0x22')]=function(_0x6ac089,_0x41eeda){if(_0x6ac089[_0x466a('0x65')]['id']){delete _0x6ac089[_0x466a('0x65')]['id'];}var _0x2a4dbf=_0x6ac089[_0x466a('0x65')][_0x466a('0x66')]===_0x466a('0x67')?null:_0x6ac089[_0x466a('0x65')][_0x466a('0x66')];var _0x35316d=_0x6ac089[_0x466a('0x65')][_0x466a('0x40')]||{};var _0x113c3b=_0x6ac089[_0x466a('0x65')]['Smtp']||{};if(_0x2a4dbf){_0x35316d['host']=getImapHost(_0x2a4dbf);_0x35316d[_0x466a('0x3b')]=0x3e1;_0x113c3b[_0x466a('0x3a')]=getSmtpHost(_0x2a4dbf);_0x113c3b[_0x466a('0x3b')]=0x24b;_0x113c3b[_0x466a('0x3c')]=![];}if(_0x113c3b[_0x466a('0x37')]){_0x113c3b[_0x466a('0x3c')]=![];}else{_0x113c3b['CloudProviderId']=null;}if(!_0x35316d[_0x466a('0x37')])_0x35316d['CloudProviderId']=null;_0x6ac089['body'][_0x466a('0x40')]=_0x35316d;_0x6ac089[_0x466a('0x65')][_0x466a('0x43')]=_0x113c3b;return db[_0x466a('0x47')][_0x466a('0x64')]({'where':{'id':_0x6ac089[_0x466a('0x60')]['id']},'include':[{'model':db[_0x466a('0x42')],'as':_0x466a('0x40')},{'model':db[_0x466a('0x61')],'as':_0x466a('0x43')},{'model':db[_0x466a('0x44')],'as':_0x466a('0x45')}]})['then'](handleEntityNotFound(_0x41eeda,null))[_0x466a('0x12')](function(_0x14b94f){if(!_0x14b94f)throw new Error(_0x466a('0x68'));if(_0x14b94f['service'])delete _0x6ac089['body'][_0x466a('0x40')];return _0x14b94f;})[_0x466a('0x12')](saveUpdates(_0x6ac089[_0x466a('0x65')],null))['then'](function(_0x185b20){if(!_0x6ac089[_0x466a('0x65')]['Imap'])return _0x185b20;return db[_0x466a('0x42')][_0x466a('0x22')](_0x6ac089[_0x466a('0x65')]['Imap'],{'where':{'MailAccountId':_0x185b20['id']}})['then'](function(){return _0x185b20;});})['then'](function(_0x3623e9){if(!_0x6ac089[_0x466a('0x65')][_0x466a('0x43')])return _0x3623e9;return db[_0x466a('0x61')][_0x466a('0x22')](_0x6ac089[_0x466a('0x65')]['Smtp'],{'where':{'MailAccountId':_0x3623e9['id']}})[_0x466a('0x12')](function(){return _0x3623e9;});})[_0x466a('0x12')](respondWithResult(_0x41eeda,null))[_0x466a('0x5e')](handleError(_0x41eeda,null));};exports['describe']=function(_0x23a538,_0x18c29b){return db[_0x466a('0x47')]['describe']()[_0x466a('0x12')](respondWithResult(_0x18c29b,null))[_0x466a('0x5e')](handleError(_0x18c29b,null));};exports[_0x466a('0x69')]=function(_0x1553ed,_0x37b8c1){if(_0x1553ed[_0x466a('0x65')]['id']){delete _0x1553ed[_0x466a('0x65')]['id'];}return db['MailAccount'][_0x466a('0x64')]({'where':{'id':_0x1553ed['params']['id']}})[_0x466a('0x12')](handleEntityNotFound(_0x37b8c1,null))[_0x466a('0x12')](function(_0x2c0dd8){if(_0x2c0dd8){_0x1553ed[_0x466a('0x65')][_0x466a('0x6a')]=_0x2c0dd8['id'];return db['Disposition'][_0x466a('0x6b')](_0x1553ed[_0x466a('0x65')]);}})[_0x466a('0x12')](respondWithResult(_0x37b8c1,null))[_0x466a('0x5e')](handleError(_0x37b8c1,null));};exports[_0x466a('0x6c')]=function(_0xa00fe0,_0x342c80){var _0x2d7a4d={'raw':![],'where':{}};var _0x3ab306={};var _0xfbdac7={'count':0x0,'rows':[]};return db[_0x466a('0x47')][_0x466a('0x6d')]({'where':{'id':_0xa00fe0['params']['id']}})[_0x466a('0x12')](handleEntityNotFound(_0x342c80,null))[_0x466a('0x12')](function(_0x3c0e9f){if(_0x3c0e9f){_0x3ab306[_0x466a('0x4b')]=_[_0x466a('0x4d')](db['Disposition'][_0x466a('0x48')]);_0x3ab306[_0x466a('0x4c')]=_['keys'](_0xa00fe0['query']);_0x3ab306[_0x466a('0x4e')]=_[_0x466a('0x50')](_0x3ab306['model'],_0x3ab306[_0x466a('0x4c')]);_0x2d7a4d['attributes']=_[_0x466a('0x50')](_0x3ab306[_0x466a('0x4b')],qs[_0x466a('0x51')](_0xa00fe0[_0x466a('0x4c')]['fields']));_0x2d7a4d[_0x466a('0x4f')]=_0x2d7a4d[_0x466a('0x4f')]['length']?_0x2d7a4d[_0x466a('0x4f')]:_0x3ab306['model'];if(!_0xa00fe0[_0x466a('0x4c')][_0x466a('0x52')](_0x466a('0x6e'))){_0x2d7a4d['limit']=qs[_0x466a('0x53')](_0xa00fe0['query']['limit']);_0x2d7a4d[_0x466a('0x20')]=qs[_0x466a('0x20')](_0xa00fe0[_0x466a('0x4c')][_0x466a('0x20')]);}_0x2d7a4d[_0x466a('0x54')]=qs['sort'](_0xa00fe0[_0x466a('0x4c')][_0x466a('0x55')]);_0x2d7a4d['where']=qs[_0x466a('0x4e')](_[_0x466a('0x57')](_0xa00fe0[_0x466a('0x4c')],_0x3ab306[_0x466a('0x4e')]));_0x2d7a4d[_0x466a('0x56')]['MailAccountId']=_0x3c0e9f['id'];if(_0xa00fe0[_0x466a('0x4c')][_0x466a('0x58')]){_0x2d7a4d['where']=_[_0x466a('0x59')](_0x2d7a4d[_0x466a('0x56')],{'$or':_[_0x466a('0x46')](_0x2d7a4d[_0x466a('0x4f')],function(_0x45a5da){var _0x330a75={};_0x330a75[_0x45a5da]={'$like':'%'+_0xa00fe0[_0x466a('0x4c')][_0x466a('0x58')]+'%'};return _0x330a75;})});}_0x2d7a4d=_[_0x466a('0x59')]({},_0x2d7a4d,_0xa00fe0[_0x466a('0x63')]);return db[_0x466a('0x6f')][_0x466a('0x1f')]({'where':_0x2d7a4d[_0x466a('0x56')]})[_0x466a('0x12')](function(_0x149913){_0xfbdac7[_0x466a('0x1f')]=_0x149913;if(_0xa00fe0[_0x466a('0x4c')][_0x466a('0x5b')]){_0x2d7a4d['include']=[{'all':!![]}];}return db[_0x466a('0x6f')]['findAll'](_0x2d7a4d);})[_0x466a('0x12')](function(_0x2c6b4e){_0xfbdac7['rows']=_0x2c6b4e;return _0xfbdac7;});}})[_0x466a('0x12')](respondWithFilteredResult(_0x342c80,_0x2d7a4d))[_0x466a('0x5e')](handleError(_0x342c80,null));};exports['removeDispositions']=function(_0x44b45d,_0x4984b0){return db[_0x466a('0x47')][_0x466a('0x64')]({'where':{'id':_0x44b45d['params']['id']}})['then'](handleEntityNotFound(_0x4984b0,null))['then'](function(_0x40507c){if(_0x40507c){return _0x40507c[_0x466a('0x70')](_0x44b45d[_0x466a('0x4c')][_0x466a('0x71')]);}})[_0x466a('0x12')](respondWithStatusCode(_0x4984b0,null))[_0x466a('0x5e')](handleError(_0x4984b0,null));};exports[_0x466a('0x72')]=function(_0x47a20b,_0x23d9e8){if(_0x47a20b[_0x466a('0x65')]['id']){delete _0x47a20b[_0x466a('0x65')]['id'];}return db['MailAccount'][_0x466a('0x64')]({'where':{'id':_0x47a20b[_0x466a('0x60')]['id']}})[_0x466a('0x12')](handleEntityNotFound(_0x23d9e8,null))[_0x466a('0x12')](function(_0x3c6099){if(_0x3c6099){_0x47a20b[_0x466a('0x65')][_0x466a('0x6a')]=_0x3c6099['id'];return db['CannedAnswer'][_0x466a('0x6b')](_0x47a20b['body']);}})['then'](respondWithResult(_0x23d9e8,null))[_0x466a('0x5e')](handleError(_0x23d9e8,null));};exports[_0x466a('0x73')]=function(_0x5799a3,_0x31630f){var _0x6f6686={'raw':![],'where':{}};var _0x47b3dc={};var _0x442cac={'count':0x0,'rows':[]};return db[_0x466a('0x47')][_0x466a('0x6d')]({'where':{'id':_0x5799a3[_0x466a('0x60')]['id']}})['then'](handleEntityNotFound(_0x31630f,null))[_0x466a('0x12')](function(_0xc15a58){if(_0xc15a58){_0x47b3dc[_0x466a('0x4b')]=_[_0x466a('0x4d')](db['CannedAnswer']['rawAttributes']);_0x47b3dc['query']=_[_0x466a('0x4d')](_0x5799a3['query']);_0x47b3dc[_0x466a('0x4e')]=_[_0x466a('0x50')](_0x47b3dc[_0x466a('0x4b')],_0x47b3dc[_0x466a('0x4c')]);_0x6f6686['attributes']=_['intersection'](_0x47b3dc['model'],qs['fields'](_0x5799a3[_0x466a('0x4c')][_0x466a('0x51')]));_0x6f6686['attributes']=_0x6f6686[_0x466a('0x4f')]['length']?_0x6f6686[_0x466a('0x4f')]:_0x47b3dc[_0x466a('0x4b')];if(!_0x5799a3[_0x466a('0x4c')][_0x466a('0x52')]('nolimit')){_0x6f6686['limit']=qs['limit'](_0x5799a3['query'][_0x466a('0x53')]);_0x6f6686[_0x466a('0x20')]=qs[_0x466a('0x20')](_0x5799a3['query'][_0x466a('0x20')]);}_0x6f6686[_0x466a('0x54')]=qs[_0x466a('0x55')](_0x5799a3['query'][_0x466a('0x55')]);_0x6f6686[_0x466a('0x56')]=qs[_0x466a('0x4e')](_[_0x466a('0x57')](_0x5799a3[_0x466a('0x4c')],_0x47b3dc[_0x466a('0x4e')]));_0x6f6686['where'][_0x466a('0x6a')]=_0xc15a58['id'];if(_0x5799a3[_0x466a('0x4c')]['filter']){_0x6f6686[_0x466a('0x56')]=_[_0x466a('0x59')](_0x6f6686[_0x466a('0x56')],{'$or':_['map'](_0x6f6686['attributes'],function(_0x1f82d7){var _0x52ca2f={};_0x52ca2f[_0x1f82d7]={'$like':'%'+_0x5799a3[_0x466a('0x4c')][_0x466a('0x58')]+'%'};return _0x52ca2f;})});}_0x6f6686=_[_0x466a('0x59')]({},_0x6f6686,_0x5799a3['options']);return db[_0x466a('0x74')][_0x466a('0x1f')]({'where':_0x6f6686[_0x466a('0x56')]})[_0x466a('0x12')](function(_0x2542a6){_0x442cac[_0x466a('0x1f')]=_0x2542a6;if(_0x5799a3[_0x466a('0x4c')][_0x466a('0x5b')]){_0x6f6686['include']=[{'all':!![]}];}return db[_0x466a('0x74')][_0x466a('0x5d')](_0x6f6686);})[_0x466a('0x12')](function(_0x2a041b){_0x442cac['rows']=_0x2a041b;return _0x442cac;});}})[_0x466a('0x12')](respondWithFilteredResult(_0x31630f,_0x6f6686))[_0x466a('0x5e')](handleError(_0x31630f,null));};exports['removeAnswers']=function(_0x560f60,_0x17ed79){return db[_0x466a('0x47')][_0x466a('0x64')]({'where':{'id':_0x560f60[_0x466a('0x60')]['id']}})['then'](handleEntityNotFound(_0x17ed79,null))[_0x466a('0x12')](function(_0x1600a9){if(_0x1600a9){return _0x1600a9[_0x466a('0x75')](_0x560f60[_0x466a('0x4c')]['ids']);}})['then'](respondWithStatusCode(_0x17ed79,null))['catch'](handleError(_0x17ed79,null));};exports[_0x466a('0x6b')]=function(_0x584378,_0x5adf0f){var _0x23cf7e={'name':_0x584378['body'][_0x466a('0x28')],'key':_0x584378['body'][_0x466a('0x76')],'provider':_0x584378[_0x466a('0x65')][_0x466a('0x66')]===_0x466a('0x67')?null:_0x584378['body'][_0x466a('0x66')],'email':_0x584378['body']['email'],'ListId':_0x584378['body'][_0x466a('0x77')],'active':!_[_0x466a('0x78')](_0x584378['body'][_0x466a('0x79')])?_0x584378[_0x466a('0x65')][_0x466a('0x79')]:!![],'description':_0x584378[_0x466a('0x65')][_0x466a('0x7a')]||null};var _0x56318e=getAuthenticationOptions(_0x23cf7e['provider'],_0x584378[_0x466a('0x65')]);_0x23cf7e[_0x466a('0x40')]=_0x56318e['Imap'];_0x23cf7e[_0x466a('0x43')]=_0x56318e[_0x466a('0x43')];return db[_0x466a('0x47')][_0x466a('0x6b')](_0x23cf7e,{'include':[{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x466a('0x42')],'as':'Imap'}]})[_0x466a('0x12')](function(_0x288462){var _0x4425b2=_0x584378[_0x466a('0x35')][_0x466a('0x24')]({'plain':!![]});if(!_0x4425b2)throw new Error(_0x466a('0x7b'));if(_0x4425b2[_0x466a('0x7c')]===_0x466a('0x35')){var _0x3bdb05=_0x288462[_0x466a('0x24')]({'plain':!![]});return db['UserProfileSection'][_0x466a('0x64')]({'where':{'name':_0x466a('0x25'),'userProfileId':_0x4425b2[_0x466a('0x7d')]},'raw':!![]})[_0x466a('0x12')](function(_0x19a851){if(_0x19a851&&_0x19a851[_0x466a('0x7e')]===0x0){return db[_0x466a('0x26')]['create']({'name':_0x3bdb05[_0x466a('0x28')],'resourceId':_0x3bdb05['id'],'type':_0x19a851['name'],'sectionId':_0x19a851['id']},{})[_0x466a('0x12')](function(){return _0x288462;});}else{return _0x288462;}})[_0x466a('0x5e')](function(_0x30eaa0){logger[_0x466a('0x17')](_0x466a('0x7f'),_0x30eaa0);throw _0x30eaa0;});}return _0x288462;})[_0x466a('0x12')](respondWithResult(_0x5adf0f,0xc9))[_0x466a('0x5e')](handleError(_0x5adf0f,null));};exports['getImap']=function(_0x19c1ea,_0x141c2b){return db['MailAccount']['findOne']({'where':{'id':_0x19c1ea[_0x466a('0x60')]['id']}})[_0x466a('0x12')](handleEntityNotFound(_0x141c2b,null))['then'](function(_0x322335){if(_0x322335){return _0x322335[_0x466a('0x80')]();}return null;})[_0x466a('0x12')](respondWithResult(_0x141c2b,null))[_0x466a('0x5e')](handleError(_0x141c2b,null));};exports[_0x466a('0x81')]=function(_0x210341,_0x3d1904){if(_0x210341[_0x466a('0x65')]['id']){delete _0x210341[_0x466a('0x65')]['id'];}return db['MailAccount'][_0x466a('0x64')]({'where':{'id':_0x210341[_0x466a('0x60')]['id']}})['then'](handleEntityNotFound(_0x3d1904,null))[_0x466a('0x12')](function(_0x2134ff){if(_0x2134ff){_0x210341[_0x466a('0x65')][_0x466a('0x6a')]=_0x2134ff['id'];return db[_0x466a('0x42')]['create'](_0x210341[_0x466a('0x65')]);}})[_0x466a('0x12')](respondWithResult(_0x3d1904,null))[_0x466a('0x5e')](handleError(_0x3d1904,null));};exports[_0x466a('0x82')]=function(_0x9cfc78,_0x4f0a2a){return db[_0x466a('0x47')]['findOne']({'where':{'id':_0x9cfc78[_0x466a('0x60')]['id']}})[_0x466a('0x12')](handleEntityNotFound(_0x4f0a2a,null))['then'](function(_0x54b81f){if(_0x54b81f){return _0x54b81f[_0x466a('0x83')](null);}return null;})[_0x466a('0x12')](respondWithStatusCode(_0x4f0a2a,null))[_0x466a('0x5e')](handleError(_0x4f0a2a,null));};exports['getSmtp']=function(_0x556381,_0x101b9e){return db['MailAccount'][_0x466a('0x6d')]({'where':{'id':_0x556381['params']['id']}})[_0x466a('0x12')](handleEntityNotFound(_0x101b9e,null))[_0x466a('0x12')](function(_0x22fe1e){if(_0x22fe1e){return _0x22fe1e[_0x466a('0x84')]();}return null;})['then'](respondWithResult(_0x101b9e,null))[_0x466a('0x5e')](handleError(_0x101b9e,null));};exports[_0x466a('0x85')]=function(_0x536dcd,_0xf9750d){if(_0x536dcd[_0x466a('0x65')]['id']){delete _0x536dcd[_0x466a('0x65')]['id'];}return db[_0x466a('0x47')]['find']({'where':{'id':_0x536dcd[_0x466a('0x60')]['id']}})[_0x466a('0x12')](handleEntityNotFound(_0xf9750d,null))[_0x466a('0x12')](function(_0x6105c8){if(_0x6105c8){_0x536dcd['body'][_0x466a('0x6a')]=_0x6105c8['id'];return db[_0x466a('0x61')][_0x466a('0x6b')](_0x536dcd[_0x466a('0x65')]);}})[_0x466a('0x12')](respondWithResult(_0xf9750d,null))[_0x466a('0x5e')](handleError(_0xf9750d,null));};exports[_0x466a('0x86')]=function(_0x407468,_0x2a972c){return db[_0x466a('0x47')][_0x466a('0x6d')]({'where':{'id':_0x407468[_0x466a('0x60')]['id']}})[_0x466a('0x12')](handleEntityNotFound(_0x2a972c,null))[_0x466a('0x12')](function(_0x3f30c5){if(_0x3f30c5){return _0x3f30c5[_0x466a('0x87')](null);}return null;})[_0x466a('0x12')](respondWithStatusCode(_0x2a972c,null))[_0x466a('0x5e')](handleError(_0x2a972c,null));};exports['addInteraction']=function(_0xb4c3a3,_0x5d05eb){return db[_0x466a('0x88')][_0x466a('0x64')]({'where':{'id':_0xb4c3a3[_0x466a('0x60')]['id']}})[_0x466a('0x12')](handleEntityNotFound(_0x5d05eb,null))[_0x466a('0x12')](function(_0x22660e){if(_0x22660e){return _0x22660e[_0x466a('0x89')](_0xb4c3a3['body'][_0x466a('0x71')],_[_0x466a('0x8a')](_0xb4c3a3[_0x466a('0x65')],[_0x466a('0x71'),'id'])||{});}})['then'](respondWithResult(_0x5d05eb,null))[_0x466a('0x5e')](handleError(_0x5d05eb,null));};exports[_0x466a('0x8b')]=function(_0x134476,_0x26145e){var _0x4133a4={'raw':![],'where':{}};var _0x1beafb={};var _0x5c70db={'count':0x0,'rows':[]};return db['MailAccount'][_0x466a('0x6d')]({'where':{'id':_0x134476['params']['id']}})[_0x466a('0x12')](handleEntityNotFound(_0x26145e,null))[_0x466a('0x12')](function(_0x151730){if(_0x151730){_0x1beafb[_0x466a('0x4b')]=_[_0x466a('0x4d')](db['MailInteraction']['rawAttributes']);_0x1beafb[_0x466a('0x4c')]=_[_0x466a('0x4d')](_0x134476[_0x466a('0x4c')]);_0x1beafb[_0x466a('0x4e')]=_[_0x466a('0x50')](_0x1beafb['model'],_0x1beafb[_0x466a('0x4c')]);_0x4133a4[_0x466a('0x4f')]=_[_0x466a('0x50')](_0x1beafb[_0x466a('0x4b')],qs['fields'](_0x134476[_0x466a('0x4c')][_0x466a('0x51')]));_0x4133a4[_0x466a('0x4f')]=_0x4133a4[_0x466a('0x4f')][_0x466a('0x62')]?_0x4133a4[_0x466a('0x4f')]:_0x1beafb[_0x466a('0x4b')];if(!_0x134476[_0x466a('0x4c')]['hasOwnProperty']('nolimit')){_0x4133a4['limit']=qs[_0x466a('0x53')](_0x134476[_0x466a('0x4c')][_0x466a('0x53')]);_0x4133a4['offset']=qs[_0x466a('0x20')](_0x134476['query']['offset']);}_0x4133a4[_0x466a('0x54')]=qs['sort'](_0x134476[_0x466a('0x4c')][_0x466a('0x55')]);_0x4133a4[_0x466a('0x56')]=qs[_0x466a('0x4e')](_[_0x466a('0x57')](_0x134476[_0x466a('0x4c')],_0x1beafb[_0x466a('0x4e')]));_0x4133a4[_0x466a('0x56')][_0x466a('0x6a')]=_0x151730['id'];if(_0x134476[_0x466a('0x4c')][_0x466a('0x58')]){_0x4133a4[_0x466a('0x56')]=_['merge'](_0x4133a4['where'],{'$or':_[_0x466a('0x46')](_0x4133a4[_0x466a('0x4f')],function(_0xcc8ecd){var _0x28cb56={};_0x28cb56[_0xcc8ecd]={'$like':'%'+_0x134476['query'][_0x466a('0x58')]+'%'};return _0x28cb56;})});}_0x4133a4=_[_0x466a('0x59')]({},_0x4133a4,_0x134476[_0x466a('0x63')]);return db[_0x466a('0x88')][_0x466a('0x1f')]({'where':_0x4133a4['where']})[_0x466a('0x12')](function(_0x38b3ac){_0x5c70db[_0x466a('0x1f')]=_0x38b3ac;if(_0x134476[_0x466a('0x4c')]['includeAll']){_0x4133a4[_0x466a('0x5c')]=[{'model':db[_0x466a('0x8c')],'as':_0x466a('0x8d'),'required':![]},{'model':db[_0x466a('0x8e')],'as':_0x466a('0x8f'),'attributes':[_0x466a('0x28'),_0x466a('0x90'),_0x466a('0x91')],'required':![]},{'model':db[_0x466a('0x92')],'as':_0x466a('0x93'),'attributes':['id',_0x466a('0x28'),_0x466a('0x94')],'where':_0x134476[_0x466a('0x4c')][_0x466a('0x95')]?{'id':_0x134476[_0x466a('0x4c')][_0x466a('0x95')]}:undefined,'required':_0x134476[_0x466a('0x4c')]['tag']?!![]:![]}];}return db[_0x466a('0x88')][_0x466a('0x5d')](_0x4133a4);})[_0x466a('0x12')](function(_0x5d1c98){_0x5c70db[_0x466a('0x96')]=_0x5d1c98;return _0x5c70db;});}})[_0x466a('0x12')](respondWithFilteredResult(_0x26145e,_0x4133a4))[_0x466a('0x5e')](handleError(_0x26145e,null));};exports[_0x466a('0x97')]=function addApplications(_0x586c03,_0xc46f92){var _0xe58f96=_0x586c03[_0x466a('0x60')]['id'];var _0x81f8fa=_0x586c03[_0x466a('0x65')];var _0x100d47=0xc8;var _0xdec584=null;return db[_0x466a('0x98')][_0x466a('0x99')]({'isolationLevel':db['sequelize'][_0x466a('0x9a')][_0x466a('0x9b')][_0x466a('0x9c')]},function(_0x3105e5){return db['MailAccount'][_0x466a('0x6d')]({'where':{'id':_0xe58f96},'transaction':_0x3105e5})[_0x466a('0x12')](function(_0xa6a260){if(_0xa6a260){return db[_0x466a('0x9d')][_0x466a('0x23')]({'where':{'MailAccountId':_0xe58f96},'transaction':_0x3105e5})['then'](function(){var _0x13993e=_[_0x466a('0x46')](_0x81f8fa,function(_0xfc5ee4){_0xfc5ee4[_0x466a('0x6a')]=_0xe58f96;return _0xfc5ee4;});return db['MailApplication'][_0x466a('0x9e')](_0x13993e,{'transaction':_0x3105e5});});}else{_0x100d47=0x194;_0xdec584=[];}});})[_0x466a('0x12')](function(){if(_0x100d47!==0x194){return db[_0x466a('0x9d')][_0x466a('0x9f')]({'where':{'MailAccountId':_0xe58f96},'order':_0x466a('0xa0')})[_0x466a('0x12')](function(_0x22e5d4){_0xdec584=_0x22e5d4;});}})['catch'](function(_0xec5714){_0x100d47=0x1f4;logger[_0x466a('0x17')](_0xec5714[_0x466a('0x27')]);if(_0xec5714[_0x466a('0x28')]){delete _0xec5714['name'];}_0xdec584=_0xec5714;})['finally'](function(){if(_0xdec584===null){_0xc46f92[_0x466a('0x1a')](_0x100d47);}else{if(_0x100d47===0x1f4){_0xc46f92['status'](_0x100d47)[_0x466a('0x29')](_0xdec584);}else{_0xc46f92['status'](_0x100d47)[_0x466a('0x1d')](_0xdec584);}}});};exports['getApplications']=function(_0x5e01fe,_0x2e8215){var _0x358c4f={};var _0x363f62={};var _0x457750;var _0x47c38f;return db[_0x466a('0x47')]['findOne']({'where':{'id':_0x5e01fe['params']['id']}})[_0x466a('0x12')](handleEntityNotFound(_0x2e8215,null))[_0x466a('0x12')](function(_0x41999d){if(_0x41999d){_0x457750=_0x41999d;_0x363f62[_0x466a('0x4b')]=_['keys'](db['MailApplication'][_0x466a('0x48')]);_0x363f62[_0x466a('0x4c')]=_['keys'](_0x5e01fe['query']);_0x363f62[_0x466a('0x4e')]=_['intersection'](_0x363f62[_0x466a('0x4b')],_0x363f62[_0x466a('0x4c')]);_0x358c4f[_0x466a('0x4f')]=_['intersection'](_0x363f62['model'],qs[_0x466a('0x51')](_0x5e01fe[_0x466a('0x4c')]['fields']));_0x358c4f[_0x466a('0x4f')]=_0x358c4f[_0x466a('0x4f')][_0x466a('0x62')]?_0x358c4f[_0x466a('0x4f')]:_0x363f62[_0x466a('0x4b')];_0x358c4f[_0x466a('0x54')]=qs[_0x466a('0x55')](_0x5e01fe['query'][_0x466a('0x55')]);_0x358c4f[_0x466a('0x56')]=qs[_0x466a('0x4e')](_[_0x466a('0x57')](_0x5e01fe[_0x466a('0x4c')],_0x363f62[_0x466a('0x4e')]));if(_0x5e01fe[_0x466a('0x4c')][_0x466a('0x58')]){_0x358c4f[_0x466a('0x56')]=_['merge'](_0x358c4f[_0x466a('0x56')],{'$or':_[_0x466a('0x46')](_0x358c4f['attributes'],function(_0x5943f6){var _0x3b86d3={};_0x3b86d3[_0x5943f6]={'$like':'%'+_0x5e01fe['query'][_0x466a('0x58')]+'%'};return _0x3b86d3;})});}_0x358c4f=_[_0x466a('0x59')]({},_0x358c4f,_0x5e01fe[_0x466a('0x63')]);return _0x457750[_0x466a('0xa1')](_0x358c4f);}})[_0x466a('0x12')](function(_0x876422){if(_0x876422){_0x47c38f=_0x876422[_0x466a('0x62')];if(!_0x5e01fe['query'][_0x466a('0x52')](_0x466a('0x6e'))){_0x358c4f['limit']=qs[_0x466a('0x53')](_0x5e01fe[_0x466a('0x4c')][_0x466a('0x53')]);_0x358c4f[_0x466a('0x20')]=qs[_0x466a('0x20')](_0x5e01fe[_0x466a('0x4c')]['offset']);}return _0x457750['getApplications'](_0x358c4f);}})['then'](function(_0x5f2579){if(_0x5f2579){return _0x5f2579?{'count':_0x47c38f,'rows':_0x5f2579}:null;}})[_0x466a('0x12')](respondWithResult(_0x2e8215,null))['catch'](handleError(_0x2e8215,null));};exports[_0x466a('0xa2')]=function(_0x12e6d7,_0xd6d54b){var _0x9eca81={'raw':!![],'where':{}};var _0x3b5a98={};var _0x36dedb={'count':0x0,'rows':[]};return db[_0x466a('0x47')][_0x466a('0x6d')]({'where':{'id':_0x12e6d7[_0x466a('0x60')]['id']}})['then'](handleEntityNotFound(_0xd6d54b,null))[_0x466a('0x12')](function(_0x1b7b4b){if(_0x1b7b4b){_0x3b5a98[_0x466a('0x4b')]=_[_0x466a('0x4d')](db[_0x466a('0xa3')][_0x466a('0x48')]);_0x3b5a98[_0x466a('0x4c')]=_[_0x466a('0x4d')](_0x12e6d7['query']);_0x3b5a98[_0x466a('0x4e')]=_[_0x466a('0x50')](_0x3b5a98[_0x466a('0x4b')],_0x3b5a98[_0x466a('0x4c')]);_0x9eca81['attributes']=_[_0x466a('0x50')](_0x3b5a98[_0x466a('0x4b')],qs['fields'](_0x12e6d7[_0x466a('0x4c')][_0x466a('0x51')]));_0x9eca81[_0x466a('0x4f')]=_0x9eca81[_0x466a('0x4f')]['length']?_0x9eca81[_0x466a('0x4f')]:_0x3b5a98['model'];if(!_0x12e6d7[_0x466a('0x4c')][_0x466a('0x52')](_0x466a('0x6e'))){_0x9eca81[_0x466a('0x53')]=qs[_0x466a('0x53')](_0x12e6d7['query'][_0x466a('0x53')]);_0x9eca81[_0x466a('0x20')]=qs['offset'](_0x12e6d7[_0x466a('0x4c')][_0x466a('0x20')]);}_0x9eca81['order']=qs[_0x466a('0x55')](_0x12e6d7[_0x466a('0x4c')][_0x466a('0x55')]);_0x9eca81[_0x466a('0x56')]=qs[_0x466a('0x4e')](_[_0x466a('0x57')](_0x12e6d7[_0x466a('0x4c')],_0x3b5a98[_0x466a('0x4e')]));_0x9eca81[_0x466a('0x56')]['MailAccountId']=_0x1b7b4b['id'];if(_0x12e6d7[_0x466a('0x4c')][_0x466a('0x58')]){_0x9eca81['where']=_['merge'](_0x9eca81['where'],{'$or':_[_0x466a('0x46')](_0x9eca81[_0x466a('0x4f')],function(_0x1209bb){var _0x4e594d={};_0x4e594d[_0x1209bb]={'$like':'%'+_0x12e6d7[_0x466a('0x4c')]['filter']+'%'};return _0x4e594d;})});}if(_0x12e6d7[_0x466a('0x4c')][_0x466a('0xa4')]){var _0x4bd015=_0x12e6d7[_0x466a('0x4c')][_0x466a('0xa4')][_0x466a('0xa5')](',');var _0x31c1d5={};_0x31c1d5[_0x4bd015[0x0]]={'$gte':moment(_0x4bd015[0x1])[_0x466a('0xa6')](_0x466a('0xa7'))};_0x9eca81[_0x466a('0x56')]=_[_0x466a('0x59')](_0x9eca81[_0x466a('0x56')],_0x31c1d5);}_0x9eca81=_['merge']({},_0x9eca81,_0x12e6d7[_0x466a('0x63')]);return db[_0x466a('0xa3')][_0x466a('0x1f')]({'where':_0x9eca81['where']})[_0x466a('0x12')](function(_0x238968){_0x36dedb['count']=_0x238968;if(_0x12e6d7['query'][_0x466a('0x5b')]){_0x9eca81[_0x466a('0x5c')]=[{'all':!![]}];}return db[_0x466a('0xa3')][_0x466a('0x5d')](_0x9eca81);})[_0x466a('0x12')](function(_0x1d7801){if(_0x12e6d7[_0x466a('0x4c')][_0x466a('0xa8')]===_0x466a('0xa9')){for(var _0x15dcf4=0x0;_0x15dcf4<_0x1d7801['length'];_0x15dcf4++){_0x1d7801[_0x15dcf4][_0x466a('0x65')]=juice(_0x1d7801[_0x15dcf4]['body']);}}_0x36dedb[_0x466a('0x96')]=_0x1d7801;return _0x36dedb;});}})[_0x466a('0x12')](respondWithFilteredResult(_0xd6d54b,_0x9eca81))[_0x466a('0x5e')](handleError(_0xd6d54b,null));};exports[_0x466a('0x29')]=function(_0x3b711d,_0x468177){var _0x1e311a,_0x5f5a2a={},_0x363eaa;if(_0x3b711d[_0x466a('0x65')]['to']){_0x363eaa=_0x3b711d[_0x466a('0x65')]['to']['split'](',')[0x0];}return db[_0x466a('0x47')][_0x466a('0x64')]({'where':{'id':_0x3b711d[_0x466a('0x60')]['id']},'include':[{'model':db[_0x466a('0xaa')],'as':_0x466a('0xab'),'include':[{'model':db['CmContact'],'as':_0x466a('0xac'),'where':{'email':_0x363eaa},'limit':0x1,'order':[[_0x466a('0xad'),'DESC']]}]},{'model':db[_0x466a('0x61')],'as':_0x466a('0x43'),'raw':!![],'include':[{'model':db[_0x466a('0xae')],'as':_0x466a('0xae'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x468177,null))[_0x466a('0x12')](function(_0x50c6fc){if(!_0x50c6fc)return;_0x1e311a=_0x50c6fc;if(!_0x50c6fc[_0x466a('0x43')])throw new Error(_0x466a('0xaf'));if(_[_0x466a('0x78')](_0x3b711d[_0x466a('0x65')][_0x466a('0xb0')])){_0x3b711d[_0x466a('0x65')][_0x466a('0xb0')]=util[_0x466a('0xa6')](_0x466a('0xb1'),_0x50c6fc['name'],_0x50c6fc[_0x466a('0xb2')]||_0x50c6fc[_0x466a('0x43')]['user']);}if(_0x3b711d[_0x466a('0x65')][_0x466a('0xb3')]&&_0x3b711d['body'][_0x466a('0xb3')][_0x466a('0x62')]){for(var _0x215174=0x0;_0x215174<_0x3b711d[_0x466a('0x65')][_0x466a('0xb3')]['length'];_0x215174+=0x1){_0x3b711d[_0x466a('0x65')][_0x466a('0xb3')][_0x215174]={'filename':_0x3b711d[_0x466a('0x65')][_0x466a('0xb3')][_0x215174][_0x466a('0x28')],'path':path['join'](config['root'],_0x466a('0xb4'),_0x3b711d[_0x466a('0x65')][_0x466a('0xb3')][_0x215174][_0x466a('0xb5')])};}}var _0x10a809=_0x50c6fc[_0x466a('0xb6')]();return respondWithRpcPromise(_0x466a('0xb7'),_0x466a('0xb8'),{'account':_0x10a809,'message':_0x3b711d['body']});})[_0x466a('0x12')](function(_0x33d690){if(!_0x33d690)return;_0x5f5a2a=_0x33d690;if(!_0x1e311a[_0x466a('0xab')])throw new Error('List\x20not\x20found');if(_0x1e311a[_0x466a('0xab')][_0x466a('0xac')][_0x466a('0x62')])return _0x1e311a[_0x466a('0xab')]['Contacts'][0x0];return db[_0x466a('0x8c')][_0x466a('0x6b')](_[_0x466a('0x9')](_0x3b711d[_0x466a('0x65')],{'firstName':_0x3b711d['body']['to'],'email':_0x3b711d['body']['to'],'phone':_0x3b711d[_0x466a('0x65')]['to'],'ListId':_0x1e311a[_0x466a('0x77')]}));})[_0x466a('0x12')](function(_0x4f70cb){if(!_0x4f70cb)return;var _0x5b9ba4={'UserId':_0x3b711d[_0x466a('0x35')]['id'],'ContactId':_0x4f70cb['id'],'MailAccountId':_0x1e311a['id'],'inReplyTo':_0x5f5a2a['messageId'],'to':_0x3b711d[_0x466a('0x65')][_0x466a('0xb0')],'cc':_0x3b711d[_0x466a('0x65')]['cc'],'subject':_0x3b711d[_0x466a('0x65')][_0x466a('0xb9')],'attach':_0x3b711d[_0x466a('0x65')]['attach'],'firstMsgDirection':_0x466a('0xba'),'lastMsgAt':moment()[_0x466a('0xa6')](_0x466a('0xa7')),'lastMsgDirection':_0x466a('0xba'),'Messages':[_['merge'](_0x3b711d[_0x466a('0x65')],{'messageId':_0x5f5a2a['messageId'],'sentAt':moment()[_0x466a('0xa6')](_0x466a('0xa7')),'read':!![],'MailAccountId':_0x1e311a['id'],'UserId':_0x3b711d[_0x466a('0x35')]['id'],'ContactId':_0x4f70cb['id']})]};if(_0x3b711d['body'][_0x466a('0xbb')]){_0x5b9ba4=_['merge'](_0x5b9ba4,_0x3b711d[_0x466a('0x65')]['Interaction']);}return db[_0x466a('0x88')][_0x466a('0x6b')](_0x5b9ba4,{'include':[{'model':db['MailMessage'],'as':_0x466a('0xbc')}]});})[_0x466a('0x12')](respondWithResult(_0x468177,null))[_0x466a('0x5e')](handleError(_0x468177,null));};exports[_0x466a('0xbd')]=function(_0x5470a6,_0x4a57dc){return db[_0x466a('0x47')][_0x466a('0x64')]({'where':{'id':_0x5470a6['params']['id']},'include':[{'model':db[_0x466a('0x61')],'as':_0x466a('0x43'),'raw':!![],'include':[{'model':db[_0x466a('0xae')],'as':_0x466a('0xae'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x4a57dc,null))[_0x466a('0x12')](function(_0x385b11){if(!_0x385b11['Smtp'])return;var _0x5e21f9=_0x385b11[_0x466a('0xb6')]();return respondWithRpcPromise('VerifySmtp',_0x466a('0xbd'),{'account':_0x5e21f9});})[_0x466a('0x12')](respondWithResult(_0x4a57dc,null))[_0x466a('0x5e')](handleError(_0x4a57dc,null));};exports[_0x466a('0x23')]=function(_0x40a11e,_0x118daa){return db[_0x466a('0x47')][_0x466a('0x64')]({'where':{'id':_0x40a11e[_0x466a('0x60')]['id']}})[_0x466a('0x12')](handleEntityNotFound(_0x118daa,null))['then'](function(_0x1aa317){if(_0x1aa317&&_0x1aa317[_0x466a('0x3d')]){throw new db['Sequelize'][(_0x466a('0xbe'))](_0x466a('0xbf'));}return _0x1aa317;})['then'](removeEntity(_0x118daa,null))[_0x466a('0x5e')](handleError(_0x118daa,null));};exports[_0x466a('0xc0')]=function(_0x313814,_0x39b360){return db['MailAccount']['find']({'where':{'id':_0x313814[_0x466a('0x60')]['id']}})[_0x466a('0x12')](handleEntityNotFound(_0x39b360,null))[_0x466a('0x12')](function(_0x1d9f99){if(_0x1d9f99){return _0x1d9f99[_0x466a('0xc0')](_0x313814[_0x466a('0x65')][_0x466a('0x71')],_['omit'](_0x313814[_0x466a('0x65')],['ids','id'])||{})[_0x466a('0xc1')](function(_0x4ee90e){for(var _0x1bdb2a=0x0;_0x1bdb2a<_0x313814['body'][_0x466a('0x71')][_0x466a('0x62')];_0x1bdb2a+=0x1){socket[_0x466a('0xc2')](_0x466a('0xc3'),{'UserId':Number(_0x313814[_0x466a('0x65')][_0x466a('0x71')][_0x1bdb2a]),'MailAccountId':Number(_0x313814[_0x466a('0x60')]['id'])});}return _0x4ee90e;});}})['then'](respondWithResult(_0x39b360,null))['catch'](handleError(_0x39b360,null));};exports['removeAgents']=function(_0x193014,_0x47652d){return db[_0x466a('0x47')][_0x466a('0x64')]({'where':{'id':_0x193014[_0x466a('0x60')]['id']}})['then'](handleEntityNotFound(_0x47652d,null))['then'](function(_0x3e74e5){if(_0x3e74e5){return _0x3e74e5[_0x466a('0xc4')](_0x193014[_0x466a('0x4c')]['ids'])[_0x466a('0x12')](function(){if(_[_0x466a('0xc5')](_0x193014[_0x466a('0x4c')][_0x466a('0x71')])){for(var _0x25430f=0x0;_0x25430f<_0x193014[_0x466a('0x4c')][_0x466a('0x71')][_0x466a('0x62')];_0x25430f+=0x1){socket[_0x466a('0xc2')]('userMailAccount:remove',{'UserId':Number(_0x193014[_0x466a('0x4c')][_0x466a('0x71')][_0x25430f]),'MailAccountId':Number(_0x193014[_0x466a('0x60')]['id'])});}}else{socket['emit'](_0x466a('0xc6'),{'UserId':Number(_0x193014[_0x466a('0x4c')][_0x466a('0x71')]),'MailAccountId':Number(_0x193014[_0x466a('0x60')]['id'])});}});}})[_0x466a('0x12')](respondWithStatusCode(_0x47652d,null))['catch'](handleError(_0x47652d,null));};exports[_0x466a('0xc7')]=function(_0x58cc71,_0xa15b68){var _0xedf695={};var _0x36864c={};var _0x504541;var _0x36df9f;return db[_0x466a('0x47')][_0x466a('0x6d')]({'where':{'id':_0x58cc71[_0x466a('0x60')]['id']}})[_0x466a('0x12')](handleEntityNotFound(_0xa15b68,null))[_0x466a('0x12')](function(_0x29421b){if(_0x29421b){_0x504541=_0x29421b;_0x36864c['model']=_['keys'](db[_0x466a('0x8e')][_0x466a('0x48')]);_0x36864c[_0x466a('0x4c')]=_[_0x466a('0x4d')](_0x58cc71[_0x466a('0x4c')]);_0x36864c[_0x466a('0x4e')]=_[_0x466a('0x50')](_0x36864c[_0x466a('0x4b')],_0x36864c['query']);_0xedf695[_0x466a('0x4f')]=_[_0x466a('0x50')](_0x36864c[_0x466a('0x4b')],qs[_0x466a('0x51')](_0x58cc71[_0x466a('0x4c')][_0x466a('0x51')]));_0xedf695[_0x466a('0x4f')]=_0xedf695[_0x466a('0x4f')][_0x466a('0x62')]?_0xedf695['attributes']:_0x36864c[_0x466a('0x4b')];_0xedf695['order']=qs[_0x466a('0x55')](_0x58cc71[_0x466a('0x4c')][_0x466a('0x55')]);_0xedf695[_0x466a('0x56')]=qs['filters'](_[_0x466a('0x57')](_0x58cc71[_0x466a('0x4c')],_0x36864c[_0x466a('0x4e')]));if(_0x58cc71['query'][_0x466a('0x58')]){_0xedf695[_0x466a('0x56')]=_[_0x466a('0x59')](_0xedf695['where'],{'$or':_[_0x466a('0x46')](_0xedf695[_0x466a('0x4f')],function(_0x418ade){var _0x3b8038={};_0x3b8038[_0x418ade]={'$like':'%'+_0x58cc71[_0x466a('0x4c')]['filter']+'%'};return _0x3b8038;})});}_0xedf695=_[_0x466a('0x59')]({},_0xedf695,_0x58cc71[_0x466a('0x63')]);return _0x504541[_0x466a('0xc7')](_0xedf695);}})[_0x466a('0x12')](function(_0x3280fa){if(_0x3280fa){_0x36df9f=_0x3280fa['length'];if(!_0x58cc71[_0x466a('0x4c')][_0x466a('0x52')](_0x466a('0x6e'))){_0xedf695[_0x466a('0x53')]=qs[_0x466a('0x53')](_0x58cc71[_0x466a('0x4c')][_0x466a('0x53')]);_0xedf695[_0x466a('0x20')]=qs[_0x466a('0x20')](_0x58cc71[_0x466a('0x4c')][_0x466a('0x20')]);}return _0x504541['getAgents'](_0xedf695);}})['then'](function(_0x2daec9){if(_0x2daec9){return _0x2daec9?{'count':_0x36df9f,'rows':_0x2daec9}:null;}})[_0x466a('0x12')](respondWithResult(_0xa15b68,null))[_0x466a('0x5e')](handleError(_0xa15b68,null));}; \ No newline at end of file +var _0x9db1=['fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','merge','VIRTUAL','filter','options','MailAccount','includeAll','findAll','rows','show','Pause','keys','include','body','provider','custom','secure','find','params','describe','addDisposition','MailAccountId','create','getDispositions','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','description','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','findOne','setImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','order','Contact','User','fullname','internal','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','true','CmList','List','Contacts','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','CmContact','messageId','subject','attach','out','Interaction','MailMessage','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./mailAccount.socket','register','jayson/promise','client','http','then','MailAccount,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','MailAccounts','UserProfileResource','end','stack','name','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','outlook365','smtp.office365.com','user','username','pass','password','modernAuthentication','CloudProviderId','host','port','service','authentication','Smtp','index','MailServerIn','Imap','MailServerOut','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','query','intersection','model','attributes'];(function(_0x2d68b2,_0x5d8a6d){var _0x2ccb34=function(_0x13c8f0){while(--_0x13c8f0){_0x2d68b2['push'](_0x2d68b2['shift']());}};_0x2ccb34(++_0x5d8a6d);}(_0x9db1,0x78));var _0x19db=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9db1[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x19db('0x0'));var BPromise=require(_0x19db('0x1'));var util=require(_0x19db('0x2'));var path=require(_0x19db('0x3'));var _=require(_0x19db('0x4'));var juice=require(_0x19db('0x5'));var Redis=require('ioredis');var qs=require(_0x19db('0x6'));var logger=require(_0x19db('0x7'))(_0x19db('0x8'));var config=require('../../config/environment');var db=require(_0x19db('0x9'))['db'];config[_0x19db('0xa')]=_[_0x19db('0xb')](config[_0x19db('0xa')],{'host':_0x19db('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x19db('0xd'))[_0x19db('0xe')](socket);var jayson=require(_0x19db('0xf'));var client=jayson[_0x19db('0x10')][_0x19db('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x332d95,_0x1ba518,_0x3d7328,_0x124f8b){return new BPromise(function(_0x45807f,_0x3857){var _0x47c486=_0x124f8b||client;return _0x47c486['request'](_0x332d95,_0x3d7328)[_0x19db('0x12')](function(_0x33c561){logger['info'](_0x19db('0x13'),_0x1ba518,_0x19db('0x14'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x1ba518,_0x19db('0x14'),JSON['stringify'](_0x33c561));if(_0x33c561[_0x19db('0x15')]){if(_0x33c561['error'][_0x19db('0x16')]===0x1f4){logger[_0x19db('0x15')]('MailAccount,\x20%s,\x20%s',_0x1ba518,_0x33c561[_0x19db('0x15')][_0x19db('0x17')]);return _0x3857(_0x33c561[_0x19db('0x15')][_0x19db('0x17')]);}logger[_0x19db('0x15')](_0x19db('0x13'),_0x1ba518,_0x33c561[_0x19db('0x15')]['message']);return _0x45807f(_0x33c561['error'][_0x19db('0x17')]);}else{logger[_0x19db('0x18')](_0x19db('0x13'),_0x1ba518,'request\x20sent');_0x45807f(_0x33c561[_0x19db('0x19')][_0x19db('0x17')]);}})[_0x19db('0x1a')](function(_0x3967a5){logger[_0x19db('0x15')](_0x19db('0x13'),_0x1ba518,_0x3967a5);_0x3857(_0x3967a5);});});}function respondWithStatusCode(_0x168a5d,_0x5b4dee){_0x5b4dee=_0x5b4dee||0xcc;return function(_0x177b57){if(_0x177b57){return _0x168a5d[_0x19db('0x1b')](_0x5b4dee);}return _0x168a5d[_0x19db('0x1c')](_0x5b4dee)['end']();};}function respondWithResult(_0x4573ee,_0x49db30){_0x49db30=_0x49db30||0xc8;return function(_0x1bcbe4){if(_0x1bcbe4){return _0x4573ee[_0x19db('0x1c')](_0x49db30)[_0x19db('0x1d')](_0x1bcbe4);}};}function respondWithFilteredResult(_0x2b8ffb,_0x57446f){return function(_0x230d8a){if(_0x230d8a){var _0x25e16b=typeof _0x57446f[_0x19db('0x1e')]==='undefined'&&typeof _0x57446f[_0x19db('0x1f')]===_0x19db('0x20');var _0x75af0a=_0x230d8a[_0x19db('0x21')];var _0x50949f=_0x25e16b?0x0:_0x57446f['offset'];var _0x2cc286=_0x25e16b?_0x230d8a[_0x19db('0x21')]:_0x57446f['offset']+_0x57446f['limit'];var _0x2c9993;if(_0x2cc286>=_0x75af0a){_0x2cc286=_0x75af0a;_0x2c9993=0xc8;}else{_0x2c9993=0xce;}_0x2b8ffb['status'](_0x2c9993);return _0x2b8ffb[_0x19db('0x22')](_0x19db('0x23'),_0x50949f+'-'+_0x2cc286+'/'+_0x75af0a)['json'](_0x230d8a);}return null;};}function saveUpdates(_0x37473c){return function(_0x3c71fa){if(_0x3c71fa){return _0x3c71fa[_0x19db('0x24')](_0x37473c)[_0x19db('0x12')](function(_0x303c38){return _0x303c38;});}return null;};}function removeEntity(_0x3b7ef8){return function(_0x5e18a1){if(_0x5e18a1){return _0x5e18a1[_0x19db('0x25')]()['then'](function(){var _0x255fdc=_0x5e18a1['get']({'plain':!![]});var _0x5c8513=_0x19db('0x26');return db[_0x19db('0x27')][_0x19db('0x25')]({'where':{'type':_0x5c8513,'resourceId':_0x255fdc['id']}})[_0x19db('0x12')](function(){return _0x5e18a1;});})[_0x19db('0x12')](function(){_0x3b7ef8[_0x19db('0x1c')](0xcc)[_0x19db('0x28')]();});}};}function handleEntityNotFound(_0x13249f){return function(_0x53930d){if(!_0x53930d){_0x13249f[_0x19db('0x1b')](0x194);}return _0x53930d;};}function handleError(_0x5c011e,_0x26f96c){_0x26f96c=_0x26f96c||0x1f4;return function(_0x3ff9d7){logger[_0x19db('0x15')](_0x3ff9d7[_0x19db('0x29')]);if(_0x3ff9d7[_0x19db('0x2a')]){delete _0x3ff9d7[_0x19db('0x2a')];}_0x5c011e[_0x19db('0x1c')](_0x26f96c)['send'](_0x3ff9d7);};}function getImapHost(_0x1a47b6){switch(_0x1a47b6){case _0x19db('0x2b'):return _0x19db('0x2c');case _0x19db('0x2d'):return _0x19db('0x2e');case _0x19db('0x2f'):return _0x19db('0x30');case'outlook365':return _0x19db('0x31');}throw new Error(_0x19db('0x32'),_0x1a47b6);}function getSmtpHost(_0x4b8d1b){switch(_0x4b8d1b){case'gmail':return _0x19db('0x33');case'yahoo':return _0x19db('0x34');case _0x19db('0x2f'):return'smtp-mail.outlook.com';case _0x19db('0x35'):return _0x19db('0x36');}throw new Error(_0x19db('0x32'),_0x4b8d1b);}function getAuthenticationOptions(_0x2cb2e9,_0x453f0d){var _0x1c9e2d={};var _0x5b948f={};if(_0x2cb2e9){_0x1c9e2d[_0x19db('0x37')]=_0x5b948f[_0x19db('0x37')]=_0x453f0d[_0x19db('0x38')];_0x1c9e2d['password']=_0x5b948f[_0x19db('0x39')]=_0x453f0d[_0x19db('0x3a')];if(_0x453f0d[_0x19db('0x3b')]){_0x1c9e2d[_0x19db('0x3b')]=_0x5b948f[_0x19db('0x3b')]=!![];_0x1c9e2d['CloudProviderId']=_0x5b948f['CloudProviderId']=_0x453f0d[_0x19db('0x3c')];_0x1c9e2d[_0x19db('0x3a')]=_0x5b948f[_0x19db('0x39')]=null;}else{_0x1c9e2d['CloudProviderId']=_0x5b948f['CloudProviderId']=null;}_0x1c9e2d[_0x19db('0x3d')]=getImapHost(_0x2cb2e9);_0x1c9e2d[_0x19db('0x3e')]=0x3e1;_0x5b948f[_0x19db('0x3d')]=getSmtpHost(_0x2cb2e9);_0x5b948f[_0x19db('0x3e')]=0x24b;_0x5b948f['secure']=![];_0x1c9e2d[_0x19db('0x3f')]=_0x5b948f[_0x19db('0x3f')]=null;}else{if(_0x453f0d[_0x19db('0x40')]){_0x1c9e2d[_0x19db('0x37')]=_0x5b948f[_0x19db('0x37')]=_0x453f0d[_0x19db('0x38')];_0x1c9e2d[_0x19db('0x3a')]=_0x5b948f[_0x19db('0x39')]=_0x453f0d['password'];}else{_0x1c9e2d[_0x19db('0x40')]=_0x5b948f[_0x19db('0x40')]=![];_0x1c9e2d['user']=_0x5b948f[_0x19db('0x37')]=null;_0x1c9e2d[_0x19db('0x3a')]=_0x5b948f[_0x19db('0x39')]=null;}_0x1c9e2d[_0x19db('0x3d')]=_0x453f0d['Imap'][_0x19db('0x3d')];_0x1c9e2d[_0x19db('0x3e')]=_0x453f0d['Imap'][_0x19db('0x3e')];_0x5b948f[_0x19db('0x3d')]=_0x453f0d[_0x19db('0x41')][_0x19db('0x3d')];_0x5b948f['port']=_0x453f0d[_0x19db('0x41')][_0x19db('0x3e')];}return{'Imap':_0x1c9e2d,'Smtp':_0x5b948f};}exports[_0x19db('0x42')]=function(_0x2cfdfd,_0x5756de){var _0x3316c1={'include':[{'model':db[_0x19db('0x43')],'as':_0x19db('0x44')},{'model':db[_0x19db('0x45')],'as':_0x19db('0x41')},{'model':db['Pause'],'as':_0x19db('0x46')}]},_0x4e0299={},_0x51d1b3={'count':0x0,'rows':[]};var _0xd493d3=_[_0x19db('0x47')](db['MailAccount'][_0x19db('0x48')],function(_0x33f14c){return{'name':_0x33f14c[_0x19db('0x49')],'type':_0x33f14c[_0x19db('0x4a')][_0x19db('0x4b')]};});_0x4e0299['model']=_['map'](_0xd493d3,_0x19db('0x2a'));_0x4e0299[_0x19db('0x4c')]=_['keys'](_0x2cfdfd[_0x19db('0x4c')]);_0x4e0299['filters']=_[_0x19db('0x4d')](_0x4e0299[_0x19db('0x4e')],_0x4e0299[_0x19db('0x4c')]);_0x3316c1[_0x19db('0x4f')]=_['intersection'](_0x4e0299[_0x19db('0x4e')],qs[_0x19db('0x50')](_0x2cfdfd['query'][_0x19db('0x50')]));_0x3316c1[_0x19db('0x4f')]=_0x3316c1[_0x19db('0x4f')][_0x19db('0x51')]?_0x3316c1[_0x19db('0x4f')]:_0x4e0299[_0x19db('0x4e')];if(!_0x2cfdfd['query'][_0x19db('0x52')](_0x19db('0x53'))){_0x3316c1[_0x19db('0x1f')]=qs['limit'](_0x2cfdfd[_0x19db('0x4c')]['limit']);_0x3316c1[_0x19db('0x1e')]=qs[_0x19db('0x1e')](_0x2cfdfd[_0x19db('0x4c')][_0x19db('0x1e')]);}_0x3316c1['order']=qs[_0x19db('0x54')](_0x2cfdfd[_0x19db('0x4c')]['sort']);_0x3316c1['where']=qs[_0x19db('0x55')](_[_0x19db('0x56')](_0x2cfdfd[_0x19db('0x4c')],_0x4e0299[_0x19db('0x55')]),_0xd493d3);if(_0x2cfdfd['query']['filter']){_0x3316c1[_0x19db('0x57')]=_[_0x19db('0x58')](_0x3316c1[_0x19db('0x57')],{'$or':_[_0x19db('0x47')](_0xd493d3,function(_0x136a7c){if(_0x136a7c['type']!==_0x19db('0x59')){var _0x1ed019={};_0x1ed019[_0x136a7c[_0x19db('0x2a')]]={'$like':'%'+_0x2cfdfd[_0x19db('0x4c')][_0x19db('0x5a')]+'%'};return _0x1ed019;}})});}_0x3316c1=_['merge']({},_0x3316c1,_0x2cfdfd[_0x19db('0x5b')]);var _0x3fb422={'where':_0x3316c1[_0x19db('0x57')]};return db[_0x19db('0x5c')][_0x19db('0x21')](_0x3fb422)[_0x19db('0x12')](function(_0x5ccd82){_0x51d1b3[_0x19db('0x21')]=_0x5ccd82;if(_0x2cfdfd['query'][_0x19db('0x5d')]){_0x3316c1['include']=[{'all':!![]}];}return db[_0x19db('0x5c')][_0x19db('0x5e')](_0x3316c1);})[_0x19db('0x12')](function(_0x510b5a){_0x51d1b3[_0x19db('0x5f')]=_0x510b5a;return _0x51d1b3;})[_0x19db('0x12')](respondWithFilteredResult(_0x5756de,_0x3316c1))['catch'](handleError(_0x5756de,null));};exports[_0x19db('0x60')]=function(_0x36475b,_0x2f3127){var _0x46a717={'raw':![],'where':{'id':_0x36475b['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x19db('0x44')},{'model':db[_0x19db('0x45')],'as':'Smtp'},{'model':db[_0x19db('0x61')],'as':_0x19db('0x46')}]},_0x515de4={};_0x515de4[_0x19db('0x4e')]=_['keys'](db[_0x19db('0x5c')][_0x19db('0x48')]);_0x515de4['query']=_[_0x19db('0x62')](_0x36475b[_0x19db('0x4c')]);_0x515de4[_0x19db('0x55')]=_['intersection'](_0x515de4[_0x19db('0x4e')],_0x515de4[_0x19db('0x4c')]);_0x46a717[_0x19db('0x4f')]=_[_0x19db('0x4d')](_0x515de4[_0x19db('0x4e')],qs[_0x19db('0x50')](_0x36475b[_0x19db('0x4c')]['fields']));_0x46a717[_0x19db('0x4f')]=_0x46a717['attributes'][_0x19db('0x51')]?_0x46a717['attributes']:_0x515de4['model'];if(_0x36475b[_0x19db('0x4c')][_0x19db('0x5d')]){_0x46a717[_0x19db('0x63')]=[{'all':!![]}];}_0x46a717=_[_0x19db('0x58')]({},_0x46a717,_0x36475b[_0x19db('0x5b')]);return db[_0x19db('0x5c')]['find'](_0x46a717)[_0x19db('0x12')](handleEntityNotFound(_0x2f3127,null))[_0x19db('0x12')](respondWithResult(_0x2f3127,null))[_0x19db('0x1a')](handleError(_0x2f3127,null));};exports['update']=function(_0x3ffab3,_0x5e1c67){if(_0x3ffab3[_0x19db('0x64')]['id']){delete _0x3ffab3[_0x19db('0x64')]['id'];}var _0x50df25=_0x3ffab3[_0x19db('0x64')][_0x19db('0x65')]===_0x19db('0x66')?null:_0x3ffab3[_0x19db('0x64')][_0x19db('0x65')];var _0x4540e0=_0x3ffab3['body'][_0x19db('0x44')]||{};var _0x337785=_0x3ffab3[_0x19db('0x64')][_0x19db('0x41')]||{};if(_0x50df25){_0x4540e0[_0x19db('0x3d')]=getImapHost(_0x50df25);_0x4540e0[_0x19db('0x3e')]=0x3e1;_0x337785['host']=getSmtpHost(_0x50df25);_0x337785['port']=0x24b;_0x337785[_0x19db('0x67')]=![];}if(_0x337785['modernAuthentication']){_0x337785['secure']=![];}else{_0x337785[_0x19db('0x3c')]=null;}if(!_0x4540e0[_0x19db('0x3b')])_0x4540e0[_0x19db('0x3c')]=null;_0x3ffab3[_0x19db('0x64')][_0x19db('0x44')]=_0x4540e0;_0x3ffab3[_0x19db('0x64')]['Smtp']=_0x337785;return db['MailAccount'][_0x19db('0x68')]({'where':{'id':_0x3ffab3[_0x19db('0x69')]['id']},'include':[{'model':db[_0x19db('0x43')],'as':_0x19db('0x44')},{'model':db[_0x19db('0x45')],'as':_0x19db('0x41')},{'model':db[_0x19db('0x61')],'as':_0x19db('0x46')}]})[_0x19db('0x12')](handleEntityNotFound(_0x5e1c67,null))['then'](function(_0x13c659){if(!_0x13c659)throw new Error('Mail\x20Account\x20not\x20found');if(_0x13c659[_0x19db('0x3f')])delete _0x3ffab3['body'][_0x19db('0x44')];return _0x13c659;})[_0x19db('0x12')](saveUpdates(_0x3ffab3[_0x19db('0x64')],null))[_0x19db('0x12')](function(_0x7a312a){if(!_0x3ffab3[_0x19db('0x64')]['Imap'])return _0x7a312a;return db['MailServerIn']['update'](_0x3ffab3[_0x19db('0x64')][_0x19db('0x44')],{'where':{'MailAccountId':_0x7a312a['id']}})[_0x19db('0x12')](function(){return _0x7a312a;});})['then'](function(_0x385a28){if(!_0x3ffab3[_0x19db('0x64')][_0x19db('0x41')])return _0x385a28;return db[_0x19db('0x45')][_0x19db('0x24')](_0x3ffab3['body'][_0x19db('0x41')],{'where':{'MailAccountId':_0x385a28['id']}})[_0x19db('0x12')](function(){return _0x385a28;});})[_0x19db('0x12')](respondWithResult(_0x5e1c67,null))[_0x19db('0x1a')](handleError(_0x5e1c67,null));};exports[_0x19db('0x6a')]=function(_0x163488,_0xfd8602){return db[_0x19db('0x5c')][_0x19db('0x6a')]()[_0x19db('0x12')](respondWithResult(_0xfd8602,null))[_0x19db('0x1a')](handleError(_0xfd8602,null));};exports[_0x19db('0x6b')]=function(_0x2d8f29,_0x2fc354){if(_0x2d8f29[_0x19db('0x64')]['id']){delete _0x2d8f29[_0x19db('0x64')]['id'];}return db[_0x19db('0x5c')][_0x19db('0x68')]({'where':{'id':_0x2d8f29[_0x19db('0x69')]['id']}})['then'](handleEntityNotFound(_0x2fc354,null))[_0x19db('0x12')](function(_0x50462b){if(_0x50462b){_0x2d8f29[_0x19db('0x64')][_0x19db('0x6c')]=_0x50462b['id'];return db['Disposition'][_0x19db('0x6d')](_0x2d8f29['body']);}})[_0x19db('0x12')](respondWithResult(_0x2fc354,null))[_0x19db('0x1a')](handleError(_0x2fc354,null));};exports[_0x19db('0x6e')]=function(_0x2bd6f0,_0x3994ee){var _0x58b349={'raw':![],'where':{}};var _0x9729b2={};var _0x240eac={'count':0x0,'rows':[]};return db[_0x19db('0x5c')]['findOne']({'where':{'id':_0x2bd6f0[_0x19db('0x69')]['id']}})['then'](handleEntityNotFound(_0x3994ee,null))['then'](function(_0x3f727c){if(_0x3f727c){_0x9729b2[_0x19db('0x4e')]=_[_0x19db('0x62')](db[_0x19db('0x6f')][_0x19db('0x48')]);_0x9729b2['query']=_[_0x19db('0x62')](_0x2bd6f0[_0x19db('0x4c')]);_0x9729b2['filters']=_[_0x19db('0x4d')](_0x9729b2[_0x19db('0x4e')],_0x9729b2[_0x19db('0x4c')]);_0x58b349[_0x19db('0x4f')]=_[_0x19db('0x4d')](_0x9729b2[_0x19db('0x4e')],qs[_0x19db('0x50')](_0x2bd6f0[_0x19db('0x4c')][_0x19db('0x50')]));_0x58b349[_0x19db('0x4f')]=_0x58b349['attributes'][_0x19db('0x51')]?_0x58b349[_0x19db('0x4f')]:_0x9729b2[_0x19db('0x4e')];if(!_0x2bd6f0['query'][_0x19db('0x52')](_0x19db('0x53'))){_0x58b349[_0x19db('0x1f')]=qs[_0x19db('0x1f')](_0x2bd6f0[_0x19db('0x4c')][_0x19db('0x1f')]);_0x58b349[_0x19db('0x1e')]=qs[_0x19db('0x1e')](_0x2bd6f0[_0x19db('0x4c')][_0x19db('0x1e')]);}_0x58b349['order']=qs['sort'](_0x2bd6f0[_0x19db('0x4c')][_0x19db('0x54')]);_0x58b349[_0x19db('0x57')]=qs['filters'](_[_0x19db('0x56')](_0x2bd6f0[_0x19db('0x4c')],_0x9729b2[_0x19db('0x55')]));_0x58b349[_0x19db('0x57')][_0x19db('0x6c')]=_0x3f727c['id'];if(_0x2bd6f0['query']['filter']){_0x58b349['where']=_[_0x19db('0x58')](_0x58b349[_0x19db('0x57')],{'$or':_[_0x19db('0x47')](_0x58b349['attributes'],function(_0x48d93d){var _0x461a26={};_0x461a26[_0x48d93d]={'$like':'%'+_0x2bd6f0['query'][_0x19db('0x5a')]+'%'};return _0x461a26;})});}_0x58b349=_[_0x19db('0x58')]({},_0x58b349,_0x2bd6f0[_0x19db('0x5b')]);return db['Disposition']['count']({'where':_0x58b349[_0x19db('0x57')]})[_0x19db('0x12')](function(_0x3d18e2){_0x240eac[_0x19db('0x21')]=_0x3d18e2;if(_0x2bd6f0[_0x19db('0x4c')]['includeAll']){_0x58b349[_0x19db('0x63')]=[{'all':!![]}];}return db[_0x19db('0x6f')][_0x19db('0x5e')](_0x58b349);})[_0x19db('0x12')](function(_0x22a15b){_0x240eac[_0x19db('0x5f')]=_0x22a15b;return _0x240eac;});}})['then'](respondWithFilteredResult(_0x3994ee,_0x58b349))['catch'](handleError(_0x3994ee,null));};exports[_0x19db('0x70')]=function(_0x512e1c,_0x220fa1){return db[_0x19db('0x5c')][_0x19db('0x68')]({'where':{'id':_0x512e1c['params']['id']}})['then'](handleEntityNotFound(_0x220fa1,null))[_0x19db('0x12')](function(_0x18b0ce){if(_0x18b0ce){return _0x18b0ce[_0x19db('0x70')](_0x512e1c[_0x19db('0x4c')][_0x19db('0x71')]);}})[_0x19db('0x12')](respondWithStatusCode(_0x220fa1,null))[_0x19db('0x1a')](handleError(_0x220fa1,null));};exports[_0x19db('0x72')]=function(_0x5dd3b4,_0x4d89a0){if(_0x5dd3b4[_0x19db('0x64')]['id']){delete _0x5dd3b4[_0x19db('0x64')]['id'];}return db[_0x19db('0x5c')][_0x19db('0x68')]({'where':{'id':_0x5dd3b4[_0x19db('0x69')]['id']}})[_0x19db('0x12')](handleEntityNotFound(_0x4d89a0,null))[_0x19db('0x12')](function(_0x2b981c){if(_0x2b981c){_0x5dd3b4[_0x19db('0x64')][_0x19db('0x6c')]=_0x2b981c['id'];return db[_0x19db('0x73')][_0x19db('0x6d')](_0x5dd3b4[_0x19db('0x64')]);}})['then'](respondWithResult(_0x4d89a0,null))[_0x19db('0x1a')](handleError(_0x4d89a0,null));};exports[_0x19db('0x74')]=function(_0x555705,_0x256940){var _0x74f729={'raw':![],'where':{}};var _0x3e17ba={};var _0x102fc9={'count':0x0,'rows':[]};return db[_0x19db('0x5c')]['findOne']({'where':{'id':_0x555705['params']['id']}})[_0x19db('0x12')](handleEntityNotFound(_0x256940,null))['then'](function(_0x27b5ba){if(_0x27b5ba){_0x3e17ba[_0x19db('0x4e')]=_[_0x19db('0x62')](db[_0x19db('0x73')]['rawAttributes']);_0x3e17ba['query']=_[_0x19db('0x62')](_0x555705['query']);_0x3e17ba[_0x19db('0x55')]=_[_0x19db('0x4d')](_0x3e17ba[_0x19db('0x4e')],_0x3e17ba['query']);_0x74f729['attributes']=_[_0x19db('0x4d')](_0x3e17ba['model'],qs['fields'](_0x555705['query'][_0x19db('0x50')]));_0x74f729['attributes']=_0x74f729[_0x19db('0x4f')]['length']?_0x74f729[_0x19db('0x4f')]:_0x3e17ba[_0x19db('0x4e')];if(!_0x555705['query'][_0x19db('0x52')](_0x19db('0x53'))){_0x74f729[_0x19db('0x1f')]=qs[_0x19db('0x1f')](_0x555705[_0x19db('0x4c')][_0x19db('0x1f')]);_0x74f729['offset']=qs['offset'](_0x555705['query']['offset']);}_0x74f729['order']=qs[_0x19db('0x54')](_0x555705[_0x19db('0x4c')][_0x19db('0x54')]);_0x74f729[_0x19db('0x57')]=qs[_0x19db('0x55')](_[_0x19db('0x56')](_0x555705['query'],_0x3e17ba['filters']));_0x74f729[_0x19db('0x57')][_0x19db('0x6c')]=_0x27b5ba['id'];if(_0x555705[_0x19db('0x4c')]['filter']){_0x74f729[_0x19db('0x57')]=_[_0x19db('0x58')](_0x74f729[_0x19db('0x57')],{'$or':_[_0x19db('0x47')](_0x74f729[_0x19db('0x4f')],function(_0x4cafc9){var _0x3cc5bd={};_0x3cc5bd[_0x4cafc9]={'$like':'%'+_0x555705['query']['filter']+'%'};return _0x3cc5bd;})});}_0x74f729=_[_0x19db('0x58')]({},_0x74f729,_0x555705[_0x19db('0x5b')]);return db['CannedAnswer'][_0x19db('0x21')]({'where':_0x74f729[_0x19db('0x57')]})['then'](function(_0x2d740e){_0x102fc9[_0x19db('0x21')]=_0x2d740e;if(_0x555705[_0x19db('0x4c')][_0x19db('0x5d')]){_0x74f729[_0x19db('0x63')]=[{'all':!![]}];}return db[_0x19db('0x73')][_0x19db('0x5e')](_0x74f729);})['then'](function(_0x75363c){_0x102fc9[_0x19db('0x5f')]=_0x75363c;return _0x102fc9;});}})[_0x19db('0x12')](respondWithFilteredResult(_0x256940,_0x74f729))[_0x19db('0x1a')](handleError(_0x256940,null));};exports[_0x19db('0x75')]=function(_0x3e3604,_0x5c5abe){return db[_0x19db('0x5c')][_0x19db('0x68')]({'where':{'id':_0x3e3604['params']['id']}})[_0x19db('0x12')](handleEntityNotFound(_0x5c5abe,null))[_0x19db('0x12')](function(_0x3e1a2e){if(_0x3e1a2e){return _0x3e1a2e[_0x19db('0x75')](_0x3e3604['query'][_0x19db('0x71')]);}})['then'](respondWithStatusCode(_0x5c5abe,null))[_0x19db('0x1a')](handleError(_0x5c5abe,null));};exports[_0x19db('0x6d')]=function(_0x27cb84,_0x234822){var _0x25bdc9={'name':_0x27cb84[_0x19db('0x64')]['name'],'key':_0x27cb84[_0x19db('0x64')]['key'],'provider':_0x27cb84[_0x19db('0x64')][_0x19db('0x65')]==='custom'?null:_0x27cb84[_0x19db('0x64')][_0x19db('0x65')],'email':_0x27cb84[_0x19db('0x64')][_0x19db('0x76')],'ListId':_0x27cb84[_0x19db('0x64')][_0x19db('0x77')],'active':!_[_0x19db('0x78')](_0x27cb84[_0x19db('0x64')][_0x19db('0x79')])?_0x27cb84[_0x19db('0x64')][_0x19db('0x79')]:!![],'description':_0x27cb84[_0x19db('0x64')][_0x19db('0x7a')]||null};var _0x2d7dc4=getAuthenticationOptions(_0x25bdc9[_0x19db('0x65')],_0x27cb84[_0x19db('0x64')]);_0x25bdc9['Imap']=_0x2d7dc4['Imap'];_0x25bdc9['Smtp']=_0x2d7dc4[_0x19db('0x41')];return db[_0x19db('0x5c')]['create'](_0x25bdc9,{'include':[{'model':db['MailServerOut'],'as':_0x19db('0x41')},{'model':db[_0x19db('0x43')],'as':_0x19db('0x44')}]})[_0x19db('0x12')](function(_0x144df2){var _0x345855=_0x27cb84[_0x19db('0x37')][_0x19db('0x7b')]({'plain':!![]});if(!_0x345855)throw new Error(_0x19db('0x7c'));if(_0x345855[_0x19db('0x7d')]===_0x19db('0x37')){var _0x35479d=_0x144df2['get']({'plain':!![]});return db['UserProfileSection'][_0x19db('0x68')]({'where':{'name':'MailAccounts','userProfileId':_0x345855[_0x19db('0x7e')]},'raw':!![]})[_0x19db('0x12')](function(_0x527c39){if(_0x527c39&&_0x527c39[_0x19db('0x7f')]===0x0){return db[_0x19db('0x27')][_0x19db('0x6d')]({'name':_0x35479d[_0x19db('0x2a')],'resourceId':_0x35479d['id'],'type':_0x527c39[_0x19db('0x2a')],'sectionId':_0x527c39['id']},{})['then'](function(){return _0x144df2;});}else{return _0x144df2;}})[_0x19db('0x1a')](function(_0x561753){logger[_0x19db('0x15')](_0x19db('0x80'),_0x561753);throw _0x561753;});}return _0x144df2;})[_0x19db('0x12')](respondWithResult(_0x234822,0xc9))['catch'](handleError(_0x234822,null));};exports[_0x19db('0x81')]=function(_0x3cb90d,_0x32be52){return db[_0x19db('0x5c')]['findOne']({'where':{'id':_0x3cb90d[_0x19db('0x69')]['id']}})['then'](handleEntityNotFound(_0x32be52,null))[_0x19db('0x12')](function(_0x18dac1){if(_0x18dac1){return _0x18dac1[_0x19db('0x81')]();}return null;})['then'](respondWithResult(_0x32be52,null))['catch'](handleError(_0x32be52,null));};exports[_0x19db('0x82')]=function(_0x3a20e0,_0x3dfa61){if(_0x3a20e0[_0x19db('0x64')]['id']){delete _0x3a20e0[_0x19db('0x64')]['id'];}return db[_0x19db('0x5c')]['find']({'where':{'id':_0x3a20e0[_0x19db('0x69')]['id']}})[_0x19db('0x12')](handleEntityNotFound(_0x3dfa61,null))['then'](function(_0x1358cb){if(_0x1358cb){_0x3a20e0[_0x19db('0x64')][_0x19db('0x6c')]=_0x1358cb['id'];return db[_0x19db('0x43')][_0x19db('0x6d')](_0x3a20e0[_0x19db('0x64')]);}})[_0x19db('0x12')](respondWithResult(_0x3dfa61,null))['catch'](handleError(_0x3dfa61,null));};exports['removeImap']=function(_0x252d02,_0x29aa5c){return db[_0x19db('0x5c')][_0x19db('0x83')]({'where':{'id':_0x252d02[_0x19db('0x69')]['id']}})[_0x19db('0x12')](handleEntityNotFound(_0x29aa5c,null))[_0x19db('0x12')](function(_0x195501){if(_0x195501){return _0x195501[_0x19db('0x84')](null);}return null;})[_0x19db('0x12')](respondWithStatusCode(_0x29aa5c,null))[_0x19db('0x1a')](handleError(_0x29aa5c,null));};exports['getSmtp']=function(_0x3a7ebb,_0x38ceb9){return db[_0x19db('0x5c')][_0x19db('0x83')]({'where':{'id':_0x3a7ebb['params']['id']}})['then'](handleEntityNotFound(_0x38ceb9,null))[_0x19db('0x12')](function(_0x2464ac){if(_0x2464ac){return _0x2464ac[_0x19db('0x85')]();}return null;})[_0x19db('0x12')](respondWithResult(_0x38ceb9,null))['catch'](handleError(_0x38ceb9,null));};exports[_0x19db('0x86')]=function(_0x470a56,_0x2e03a0){if(_0x470a56[_0x19db('0x64')]['id']){delete _0x470a56[_0x19db('0x64')]['id'];}return db[_0x19db('0x5c')][_0x19db('0x68')]({'where':{'id':_0x470a56['params']['id']}})[_0x19db('0x12')](handleEntityNotFound(_0x2e03a0,null))[_0x19db('0x12')](function(_0x4bf8a7){if(_0x4bf8a7){_0x470a56[_0x19db('0x64')]['MailAccountId']=_0x4bf8a7['id'];return db[_0x19db('0x45')]['create'](_0x470a56['body']);}})[_0x19db('0x12')](respondWithResult(_0x2e03a0,null))[_0x19db('0x1a')](handleError(_0x2e03a0,null));};exports['removeSmtp']=function(_0x356464,_0x451dcf){return db[_0x19db('0x5c')][_0x19db('0x83')]({'where':{'id':_0x356464[_0x19db('0x69')]['id']}})[_0x19db('0x12')](handleEntityNotFound(_0x451dcf,null))[_0x19db('0x12')](function(_0x2bf7e3){if(_0x2bf7e3){return _0x2bf7e3[_0x19db('0x87')](null);}return null;})[_0x19db('0x12')](respondWithStatusCode(_0x451dcf,null))[_0x19db('0x1a')](handleError(_0x451dcf,null));};exports[_0x19db('0x88')]=function(_0x2eb9f8,_0x5d51ae){return db[_0x19db('0x89')][_0x19db('0x68')]({'where':{'id':_0x2eb9f8[_0x19db('0x69')]['id']}})[_0x19db('0x12')](handleEntityNotFound(_0x5d51ae,null))[_0x19db('0x12')](function(_0x4b6bb4){if(_0x4b6bb4){return _0x4b6bb4[_0x19db('0x88')](_0x2eb9f8[_0x19db('0x64')][_0x19db('0x71')],_[_0x19db('0x8a')](_0x2eb9f8[_0x19db('0x64')],[_0x19db('0x71'),'id'])||{});}})[_0x19db('0x12')](respondWithResult(_0x5d51ae,null))['catch'](handleError(_0x5d51ae,null));};exports[_0x19db('0x8b')]=function(_0x144fe5,_0x528b48){var _0x370be3={'raw':![],'where':{}};var _0x568215={};var _0x4c2f0b={'count':0x0,'rows':[]};return db[_0x19db('0x5c')]['findOne']({'where':{'id':_0x144fe5[_0x19db('0x69')]['id']}})[_0x19db('0x12')](handleEntityNotFound(_0x528b48,null))[_0x19db('0x12')](function(_0x2c2021){if(_0x2c2021){_0x568215['model']=_[_0x19db('0x62')](db['MailInteraction'][_0x19db('0x48')]);_0x568215[_0x19db('0x4c')]=_[_0x19db('0x62')](_0x144fe5['query']);_0x568215[_0x19db('0x55')]=_['intersection'](_0x568215['model'],_0x568215[_0x19db('0x4c')]);_0x370be3['attributes']=_['intersection'](_0x568215[_0x19db('0x4e')],qs[_0x19db('0x50')](_0x144fe5[_0x19db('0x4c')][_0x19db('0x50')]));_0x370be3['attributes']=_0x370be3[_0x19db('0x4f')][_0x19db('0x51')]?_0x370be3[_0x19db('0x4f')]:_0x568215[_0x19db('0x4e')];if(!_0x144fe5[_0x19db('0x4c')][_0x19db('0x52')]('nolimit')){_0x370be3[_0x19db('0x1f')]=qs[_0x19db('0x1f')](_0x144fe5[_0x19db('0x4c')][_0x19db('0x1f')]);_0x370be3['offset']=qs[_0x19db('0x1e')](_0x144fe5[_0x19db('0x4c')][_0x19db('0x1e')]);}_0x370be3[_0x19db('0x8c')]=qs[_0x19db('0x54')](_0x144fe5[_0x19db('0x4c')][_0x19db('0x54')]);_0x370be3['where']=qs[_0x19db('0x55')](_[_0x19db('0x56')](_0x144fe5[_0x19db('0x4c')],_0x568215['filters']));_0x370be3[_0x19db('0x57')]['MailAccountId']=_0x2c2021['id'];if(_0x144fe5[_0x19db('0x4c')][_0x19db('0x5a')]){_0x370be3[_0x19db('0x57')]=_['merge'](_0x370be3[_0x19db('0x57')],{'$or':_[_0x19db('0x47')](_0x370be3[_0x19db('0x4f')],function(_0x4de12b){var _0x56255e={};_0x56255e[_0x4de12b]={'$like':'%'+_0x144fe5[_0x19db('0x4c')][_0x19db('0x5a')]+'%'};return _0x56255e;})});}_0x370be3=_['merge']({},_0x370be3,_0x144fe5[_0x19db('0x5b')]);return db[_0x19db('0x89')][_0x19db('0x21')]({'where':_0x370be3[_0x19db('0x57')]})[_0x19db('0x12')](function(_0x59ead9){_0x4c2f0b[_0x19db('0x21')]=_0x59ead9;if(_0x144fe5[_0x19db('0x4c')][_0x19db('0x5d')]){_0x370be3[_0x19db('0x63')]=[{'model':db['CmContact'],'as':_0x19db('0x8d'),'required':![]},{'model':db[_0x19db('0x8e')],'as':'Owner','attributes':['name',_0x19db('0x8f'),_0x19db('0x90')],'required':![]},{'model':db['Tag'],'as':_0x19db('0x91'),'attributes':['id',_0x19db('0x2a'),_0x19db('0x92')],'where':_0x144fe5['query'][_0x19db('0x93')]?{'id':_0x144fe5[_0x19db('0x4c')][_0x19db('0x93')]}:undefined,'required':_0x144fe5[_0x19db('0x4c')][_0x19db('0x93')]?!![]:![]}];}return db[_0x19db('0x89')]['findAll'](_0x370be3);})[_0x19db('0x12')](function(_0x49fd4d){_0x4c2f0b['rows']=_0x49fd4d;return _0x4c2f0b;});}})[_0x19db('0x12')](respondWithFilteredResult(_0x528b48,_0x370be3))[_0x19db('0x1a')](handleError(_0x528b48,null));};exports[_0x19db('0x94')]=function addApplications(_0x52ef8d,_0xf41782){var _0x4025be=_0x52ef8d['params']['id'];var _0x363a4c=_0x52ef8d[_0x19db('0x64')];var _0x14f13c=0xc8;var _0x216889=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x19db('0x95')][_0x19db('0x96')][_0x19db('0x97')][_0x19db('0x98')]},function(_0x43e43c){return db['MailAccount'][_0x19db('0x83')]({'where':{'id':_0x4025be},'transaction':_0x43e43c})[_0x19db('0x12')](function(_0x3b40f2){if(_0x3b40f2){return db[_0x19db('0x99')]['destroy']({'where':{'MailAccountId':_0x4025be},'transaction':_0x43e43c})[_0x19db('0x12')](function(){var _0x50fc7b=_[_0x19db('0x47')](_0x363a4c,function(_0xcb4b3d){_0xcb4b3d[_0x19db('0x6c')]=_0x4025be;return _0xcb4b3d;});return db[_0x19db('0x99')][_0x19db('0x9a')](_0x50fc7b,{'transaction':_0x43e43c});});}else{_0x14f13c=0x194;_0x216889=[];}});})['then'](function(){if(_0x14f13c!==0x194){return db['MailApplication'][_0x19db('0x9b')]({'where':{'MailAccountId':_0x4025be},'order':_0x19db('0x9c')})[_0x19db('0x12')](function(_0x314713){_0x216889=_0x314713;});}})[_0x19db('0x1a')](function(_0x488f48){_0x14f13c=0x1f4;logger[_0x19db('0x15')](_0x488f48['stack']);if(_0x488f48[_0x19db('0x2a')]){delete _0x488f48[_0x19db('0x2a')];}_0x216889=_0x488f48;})[_0x19db('0x9d')](function(){if(_0x216889===null){_0xf41782[_0x19db('0x1b')](_0x14f13c);}else{if(_0x14f13c===0x1f4){_0xf41782[_0x19db('0x1c')](_0x14f13c)['send'](_0x216889);}else{_0xf41782[_0x19db('0x1c')](_0x14f13c)[_0x19db('0x1d')](_0x216889);}}});};exports[_0x19db('0x9e')]=function(_0x309318,_0x3fb000){var _0x3897cd={};var _0x4b8798={};var _0x3d766d;var _0x2b8379;return db[_0x19db('0x5c')]['findOne']({'where':{'id':_0x309318['params']['id']}})[_0x19db('0x12')](handleEntityNotFound(_0x3fb000,null))[_0x19db('0x12')](function(_0x9733a0){if(_0x9733a0){_0x3d766d=_0x9733a0;_0x4b8798[_0x19db('0x4e')]=_['keys'](db[_0x19db('0x99')][_0x19db('0x48')]);_0x4b8798[_0x19db('0x4c')]=_[_0x19db('0x62')](_0x309318[_0x19db('0x4c')]);_0x4b8798[_0x19db('0x55')]=_[_0x19db('0x4d')](_0x4b8798['model'],_0x4b8798['query']);_0x3897cd[_0x19db('0x4f')]=_[_0x19db('0x4d')](_0x4b8798[_0x19db('0x4e')],qs[_0x19db('0x50')](_0x309318['query']['fields']));_0x3897cd[_0x19db('0x4f')]=_0x3897cd[_0x19db('0x4f')]['length']?_0x3897cd['attributes']:_0x4b8798[_0x19db('0x4e')];_0x3897cd[_0x19db('0x8c')]=qs['sort'](_0x309318['query'][_0x19db('0x54')]);_0x3897cd[_0x19db('0x57')]=qs[_0x19db('0x55')](_['pick'](_0x309318['query'],_0x4b8798[_0x19db('0x55')]));if(_0x309318[_0x19db('0x4c')][_0x19db('0x5a')]){_0x3897cd[_0x19db('0x57')]=_[_0x19db('0x58')](_0x3897cd[_0x19db('0x57')],{'$or':_[_0x19db('0x47')](_0x3897cd[_0x19db('0x4f')],function(_0x4ba9f6){var _0x31ac27={};_0x31ac27[_0x4ba9f6]={'$like':'%'+_0x309318['query'][_0x19db('0x5a')]+'%'};return _0x31ac27;})});}_0x3897cd=_[_0x19db('0x58')]({},_0x3897cd,_0x309318[_0x19db('0x5b')]);return _0x3d766d[_0x19db('0x9e')](_0x3897cd);}})[_0x19db('0x12')](function(_0x5d4096){if(_0x5d4096){_0x2b8379=_0x5d4096['length'];if(!_0x309318[_0x19db('0x4c')]['hasOwnProperty'](_0x19db('0x53'))){_0x3897cd[_0x19db('0x1f')]=qs['limit'](_0x309318[_0x19db('0x4c')][_0x19db('0x1f')]);_0x3897cd[_0x19db('0x1e')]=qs['offset'](_0x309318['query'][_0x19db('0x1e')]);}return _0x3d766d[_0x19db('0x9e')](_0x3897cd);}})['then'](function(_0x4417f6){if(_0x4417f6){return _0x4417f6?{'count':_0x2b8379,'rows':_0x4417f6}:null;}})[_0x19db('0x12')](respondWithResult(_0x3fb000,null))[_0x19db('0x1a')](handleError(_0x3fb000,null));};exports[_0x19db('0x9f')]=function(_0x58d029,_0x24675a){var _0x2eb36a={'raw':!![],'where':{}};var _0x5b763c={};var _0x30cb0c={'count':0x0,'rows':[]};return db[_0x19db('0x5c')][_0x19db('0x83')]({'where':{'id':_0x58d029[_0x19db('0x69')]['id']}})['then'](handleEntityNotFound(_0x24675a,null))['then'](function(_0x1ff144){if(_0x1ff144){_0x5b763c['model']=_[_0x19db('0x62')](db['MailMessage'][_0x19db('0x48')]);_0x5b763c['query']=_[_0x19db('0x62')](_0x58d029['query']);_0x5b763c['filters']=_['intersection'](_0x5b763c[_0x19db('0x4e')],_0x5b763c[_0x19db('0x4c')]);_0x2eb36a[_0x19db('0x4f')]=_[_0x19db('0x4d')](_0x5b763c[_0x19db('0x4e')],qs[_0x19db('0x50')](_0x58d029[_0x19db('0x4c')][_0x19db('0x50')]));_0x2eb36a[_0x19db('0x4f')]=_0x2eb36a[_0x19db('0x4f')][_0x19db('0x51')]?_0x2eb36a[_0x19db('0x4f')]:_0x5b763c[_0x19db('0x4e')];if(!_0x58d029[_0x19db('0x4c')][_0x19db('0x52')](_0x19db('0x53'))){_0x2eb36a[_0x19db('0x1f')]=qs[_0x19db('0x1f')](_0x58d029['query'][_0x19db('0x1f')]);_0x2eb36a['offset']=qs[_0x19db('0x1e')](_0x58d029['query'][_0x19db('0x1e')]);}_0x2eb36a[_0x19db('0x8c')]=qs['sort'](_0x58d029[_0x19db('0x4c')][_0x19db('0x54')]);_0x2eb36a[_0x19db('0x57')]=qs[_0x19db('0x55')](_[_0x19db('0x56')](_0x58d029[_0x19db('0x4c')],_0x5b763c[_0x19db('0x55')]));_0x2eb36a[_0x19db('0x57')][_0x19db('0x6c')]=_0x1ff144['id'];if(_0x58d029['query'][_0x19db('0x5a')]){_0x2eb36a[_0x19db('0x57')]=_[_0x19db('0x58')](_0x2eb36a[_0x19db('0x57')],{'$or':_[_0x19db('0x47')](_0x2eb36a[_0x19db('0x4f')],function(_0x3b81a0){var _0x37e755={};_0x37e755[_0x3b81a0]={'$like':'%'+_0x58d029[_0x19db('0x4c')][_0x19db('0x5a')]+'%'};return _0x37e755;})});}if(_0x58d029[_0x19db('0x4c')][_0x19db('0xa0')]){var _0x4a2c9b=_0x58d029[_0x19db('0x4c')]['$gte'][_0x19db('0xa1')](',');var _0x11e1ad={};_0x11e1ad[_0x4a2c9b[0x0]]={'$gte':moment(_0x4a2c9b[0x1])[_0x19db('0xa2')](_0x19db('0xa3'))};_0x2eb36a['where']=_[_0x19db('0x58')](_0x2eb36a[_0x19db('0x57')],_0x11e1ad);}_0x2eb36a=_[_0x19db('0x58')]({},_0x2eb36a,_0x58d029[_0x19db('0x5b')]);return db['MailMessage']['count']({'where':_0x2eb36a[_0x19db('0x57')]})[_0x19db('0x12')](function(_0x69b819){_0x30cb0c[_0x19db('0x21')]=_0x69b819;if(_0x58d029[_0x19db('0x4c')]['includeAll']){_0x2eb36a[_0x19db('0x63')]=[{'all':!![]}];}return db['MailMessage'][_0x19db('0x5e')](_0x2eb36a);})[_0x19db('0x12')](function(_0x323984){if(_0x58d029[_0x19db('0x4c')]['inlineCss']===_0x19db('0xa4')){for(var _0x401178=0x0;_0x401178<_0x323984[_0x19db('0x51')];_0x401178++){_0x323984[_0x401178][_0x19db('0x64')]=juice(_0x323984[_0x401178]['body']);}}_0x30cb0c['rows']=_0x323984;return _0x30cb0c;});}})['then'](respondWithFilteredResult(_0x24675a,_0x2eb36a))['catch'](handleError(_0x24675a,null));};exports['send']=function(_0x3b430a,_0x4f8213){var _0x21d9b1,_0x2ec925={},_0x5a18d8;if(_0x3b430a['body']['to']){_0x5a18d8=_0x3b430a['body']['to']['split'](',')[0x0];}return db[_0x19db('0x5c')][_0x19db('0x68')]({'where':{'id':_0x3b430a['params']['id']},'include':[{'model':db[_0x19db('0xa5')],'as':_0x19db('0xa6'),'include':[{'model':db['CmContact'],'as':_0x19db('0xa7'),'where':{'email':_0x5a18d8},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x19db('0x45')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x19db('0xa8')],'as':_0x19db('0xa8'),'raw':!![]}]}]})[_0x19db('0x12')](handleEntityNotFound(_0x4f8213,null))[_0x19db('0x12')](function(_0x31e843){if(!_0x31e843)return;_0x21d9b1=_0x31e843;if(!_0x31e843['Smtp'])throw new Error(_0x19db('0xa9'));if(_['isNil'](_0x3b430a[_0x19db('0x64')]['from'])){_0x3b430a[_0x19db('0x64')][_0x19db('0xaa')]=util[_0x19db('0xa2')](_0x19db('0xab'),_0x31e843[_0x19db('0x2a')],_0x31e843[_0x19db('0x76')]||_0x31e843[_0x19db('0x41')][_0x19db('0x37')]);}if(_0x3b430a[_0x19db('0x64')]['attachments']&&_0x3b430a[_0x19db('0x64')]['attachments'][_0x19db('0x51')]){for(var _0x356e29=0x0;_0x356e29<_0x3b430a[_0x19db('0x64')]['attachments'][_0x19db('0x51')];_0x356e29+=0x1){_0x3b430a[_0x19db('0x64')][_0x19db('0xac')][_0x356e29]={'filename':_0x3b430a[_0x19db('0x64')][_0x19db('0xac')][_0x356e29][_0x19db('0x2a')],'path':path[_0x19db('0xad')](config[_0x19db('0xae')],_0x19db('0xaf'),_0x3b430a[_0x19db('0x64')]['attachments'][_0x356e29][_0x19db('0xb0')])};}}var _0x1766aa=_0x31e843[_0x19db('0xb1')]();return respondWithRpcPromise(_0x19db('0xb2'),_0x19db('0xb3'),{'account':_0x1766aa,'message':_0x3b430a[_0x19db('0x64')]});})[_0x19db('0x12')](function(_0x33f18b){if(!_0x33f18b)return;_0x2ec925=_0x33f18b;if(!_0x21d9b1[_0x19db('0xa6')])throw new Error(_0x19db('0xb4'));if(_0x21d9b1[_0x19db('0xa6')][_0x19db('0xa7')]['length'])return _0x21d9b1[_0x19db('0xa6')]['Contacts'][0x0];return db[_0x19db('0xb5')][_0x19db('0x6d')](_[_0x19db('0xb')](_0x3b430a[_0x19db('0x64')],{'firstName':_0x3b430a['body']['to'],'email':_0x3b430a[_0x19db('0x64')]['to'],'phone':_0x3b430a[_0x19db('0x64')]['to'],'ListId':_0x21d9b1[_0x19db('0x77')]}));})['then'](function(_0x4376c3){if(!_0x4376c3)return;var _0x31961b={'UserId':_0x3b430a[_0x19db('0x37')]['id'],'ContactId':_0x4376c3['id'],'MailAccountId':_0x21d9b1['id'],'inReplyTo':_0x2ec925[_0x19db('0xb6')],'to':_0x3b430a[_0x19db('0x64')][_0x19db('0xaa')],'cc':_0x3b430a[_0x19db('0x64')]['cc'],'subject':_0x3b430a['body'][_0x19db('0xb7')],'attach':_0x3b430a[_0x19db('0x64')][_0x19db('0xb8')],'firstMsgDirection':_0x19db('0xb9'),'lastMsgAt':moment()[_0x19db('0xa2')](_0x19db('0xa3')),'lastMsgDirection':_0x19db('0xb9'),'Messages':[_[_0x19db('0x58')](_0x3b430a[_0x19db('0x64')],{'messageId':_0x2ec925[_0x19db('0xb6')],'sentAt':moment()['format'](_0x19db('0xa3')),'read':!![],'MailAccountId':_0x21d9b1['id'],'UserId':_0x3b430a[_0x19db('0x37')]['id'],'ContactId':_0x4376c3['id']})]};if(_0x3b430a[_0x19db('0x64')][_0x19db('0xba')]){_0x31961b=_[_0x19db('0x58')](_0x31961b,_0x3b430a['body'][_0x19db('0xba')]);}return db['MailInteraction'][_0x19db('0x6d')](_0x31961b,{'include':[{'model':db[_0x19db('0xbb')],'as':_0x19db('0xbc')}]});})[_0x19db('0x12')](respondWithResult(_0x4f8213,null))[_0x19db('0x1a')](handleError(_0x4f8213,null));};exports[_0x19db('0xbd')]=function(_0x44af92,_0x5ae1fb){return db['MailAccount'][_0x19db('0x68')]({'where':{'id':_0x44af92[_0x19db('0x69')]['id']},'include':[{'model':db[_0x19db('0x45')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x19db('0xa8')],'as':_0x19db('0xa8'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x5ae1fb,null))[_0x19db('0x12')](function(_0x5d99af){if(!_0x5d99af['Smtp'])return;var _0x13f5bb=_0x5d99af[_0x19db('0xb1')]();return respondWithRpcPromise(_0x19db('0xbe'),'verifySmtp',{'account':_0x13f5bb});})[_0x19db('0x12')](respondWithResult(_0x5ae1fb,null))[_0x19db('0x1a')](handleError(_0x5ae1fb,null));};exports[_0x19db('0x25')]=function(_0xc432c7,_0x58b12a){return db[_0x19db('0x5c')][_0x19db('0x68')]({'where':{'id':_0xc432c7['params']['id']}})[_0x19db('0x12')](handleEntityNotFound(_0x58b12a,null))[_0x19db('0x12')](function(_0x58fa2c){if(_0x58fa2c&&_0x58fa2c[_0x19db('0x3f')]){throw new db[(_0x19db('0xbf'))][(_0x19db('0xc0'))](_0x19db('0xc1'));}return _0x58fa2c;})[_0x19db('0x12')](removeEntity(_0x58b12a,null))[_0x19db('0x1a')](handleError(_0x58b12a,null));};exports[_0x19db('0xc2')]=function(_0x14d83e,_0x525e81){return db['MailAccount'][_0x19db('0x68')]({'where':{'id':_0x14d83e[_0x19db('0x69')]['id']}})[_0x19db('0x12')](handleEntityNotFound(_0x525e81,null))[_0x19db('0x12')](function(_0x24dcdd){if(_0x24dcdd){return _0x24dcdd[_0x19db('0xc2')](_0x14d83e['body']['ids'],_['omit'](_0x14d83e[_0x19db('0x64')],['ids','id'])||{})[_0x19db('0xc3')](function(_0x44ac98){for(var _0x100a5a=0x0;_0x100a5a<_0x14d83e[_0x19db('0x64')][_0x19db('0x71')][_0x19db('0x51')];_0x100a5a+=0x1){socket[_0x19db('0xc4')]('userMailAccount:save',{'UserId':Number(_0x14d83e[_0x19db('0x64')]['ids'][_0x100a5a]),'MailAccountId':Number(_0x14d83e[_0x19db('0x69')]['id'])});}return _0x44ac98;});}})[_0x19db('0x12')](respondWithResult(_0x525e81,null))['catch'](handleError(_0x525e81,null));};exports[_0x19db('0xc5')]=function(_0x426b97,_0x87de87){return db[_0x19db('0x5c')][_0x19db('0x68')]({'where':{'id':_0x426b97['params']['id']}})[_0x19db('0x12')](handleEntityNotFound(_0x87de87,null))[_0x19db('0x12')](function(_0x557685){if(_0x557685){return _0x557685[_0x19db('0xc5')](_0x426b97['query'][_0x19db('0x71')])[_0x19db('0x12')](function(){if(_['isArray'](_0x426b97[_0x19db('0x4c')][_0x19db('0x71')])){for(var _0x4d2b39=0x0;_0x4d2b39<_0x426b97[_0x19db('0x4c')]['ids'][_0x19db('0x51')];_0x4d2b39+=0x1){socket[_0x19db('0xc4')](_0x19db('0xc6'),{'UserId':Number(_0x426b97[_0x19db('0x4c')][_0x19db('0x71')][_0x4d2b39]),'MailAccountId':Number(_0x426b97[_0x19db('0x69')]['id'])});}}else{socket[_0x19db('0xc4')](_0x19db('0xc6'),{'UserId':Number(_0x426b97[_0x19db('0x4c')]['ids']),'MailAccountId':Number(_0x426b97[_0x19db('0x69')]['id'])});}});}})[_0x19db('0x12')](respondWithStatusCode(_0x87de87,null))['catch'](handleError(_0x87de87,null));};exports[_0x19db('0xc7')]=function(_0x451cb0,_0x2b7a86){var _0x3073cb={};var _0x57fb5f={};var _0x5de1dd;var _0x45fbcb;return db[_0x19db('0x5c')]['findOne']({'where':{'id':_0x451cb0[_0x19db('0x69')]['id']}})[_0x19db('0x12')](handleEntityNotFound(_0x2b7a86,null))['then'](function(_0x33bcbb){if(_0x33bcbb){_0x5de1dd=_0x33bcbb;_0x57fb5f[_0x19db('0x4e')]=_[_0x19db('0x62')](db[_0x19db('0x8e')][_0x19db('0x48')]);_0x57fb5f[_0x19db('0x4c')]=_[_0x19db('0x62')](_0x451cb0['query']);_0x57fb5f[_0x19db('0x55')]=_[_0x19db('0x4d')](_0x57fb5f[_0x19db('0x4e')],_0x57fb5f[_0x19db('0x4c')]);_0x3073cb['attributes']=_['intersection'](_0x57fb5f[_0x19db('0x4e')],qs[_0x19db('0x50')](_0x451cb0[_0x19db('0x4c')][_0x19db('0x50')]));_0x3073cb[_0x19db('0x4f')]=_0x3073cb['attributes'][_0x19db('0x51')]?_0x3073cb['attributes']:_0x57fb5f['model'];_0x3073cb[_0x19db('0x8c')]=qs[_0x19db('0x54')](_0x451cb0['query'][_0x19db('0x54')]);_0x3073cb[_0x19db('0x57')]=qs['filters'](_[_0x19db('0x56')](_0x451cb0['query'],_0x57fb5f['filters']));if(_0x451cb0[_0x19db('0x4c')][_0x19db('0x5a')]){_0x3073cb[_0x19db('0x57')]=_['merge'](_0x3073cb['where'],{'$or':_['map'](_0x3073cb['attributes'],function(_0x39cd77){var _0xc3ecb3={};_0xc3ecb3[_0x39cd77]={'$like':'%'+_0x451cb0[_0x19db('0x4c')][_0x19db('0x5a')]+'%'};return _0xc3ecb3;})});}_0x3073cb=_[_0x19db('0x58')]({},_0x3073cb,_0x451cb0[_0x19db('0x5b')]);return _0x5de1dd[_0x19db('0xc7')](_0x3073cb);}})['then'](function(_0x2d2fa7){if(_0x2d2fa7){_0x45fbcb=_0x2d2fa7['length'];if(!_0x451cb0['query'][_0x19db('0x52')](_0x19db('0x53'))){_0x3073cb[_0x19db('0x1f')]=qs[_0x19db('0x1f')](_0x451cb0[_0x19db('0x4c')]['limit']);_0x3073cb[_0x19db('0x1e')]=qs[_0x19db('0x1e')](_0x451cb0[_0x19db('0x4c')]['offset']);}return _0x5de1dd[_0x19db('0xc7')](_0x3073cb);}})['then'](function(_0x55e1b4){if(_0x55e1b4){return _0x55e1b4?{'count':_0x45fbcb,'rows':_0x55e1b4}:null;}})[_0x19db('0x12')](respondWithResult(_0x2b7a86,null))[_0x19db('0x1a')](handleError(_0x2b7a86,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index e27b93b..a756bd3 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 _0x96e0=['update','remove','emit','hasOwnProperty','hook','exports','events','MailAccount'];(function(_0x73ad5b,_0x3703f7){var _0x56284e=function(_0x16fa6e){while(--_0x16fa6e){_0x73ad5b['push'](_0x73ad5b['shift']());}};_0x56284e(++_0x3703f7);}(_0x96e0,0x7e));var _0x096e=function(_0x3d4e2c,_0x379fc4){_0x3d4e2c=_0x3d4e2c-0x0;var _0x4b60cc=_0x96e0[_0x3d4e2c];return _0x4b60cc;};'use strict';var EventEmitter=require(_0x096e('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x096e('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x096e('0x2'),'afterDestroy':_0x096e('0x3')};function emitEvent(_0x44027f){return function(_0xaf295b,_0x58d22d,_0x54a9b6){MailAccountEvents['emit'](_0x44027f+':'+_0xaf295b['id'],_0xaf295b);MailAccountEvents[_0x096e('0x4')](_0x44027f,_0xaf295b);_0x54a9b6(null);};}for(var e in events){if(events[_0x096e('0x5')](e)){var event=events[e];MailAccount[_0x096e('0x6')](e,emitEvent(event));}}module[_0x096e('0x7')]=MailAccountEvents; \ No newline at end of file +var _0xa468=['hook','events','../../mysqldb','MailAccount','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x30e0f5,_0x5e4826){var _0x3b5800=function(_0x3d9155){while(--_0x3d9155){_0x30e0f5['push'](_0x30e0f5['shift']());}};_0x3b5800(++_0x5e4826);}(_0xa468,0x1b1));var _0x8a46=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa468[_0x3ab51d];return _0x29a04e;};'use strict';var EventEmitter=require(_0x8a46('0x0'));var MailAccount=require(_0x8a46('0x1'))['db'][_0x8a46('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x8a46('0x3')](0x0);var events={'afterCreate':_0x8a46('0x4'),'afterUpdate':_0x8a46('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4ba2a8){return function(_0x1b4c6c,_0x179abb,_0x140e82){MailAccountEvents[_0x8a46('0x6')](_0x4ba2a8+':'+_0x1b4c6c['id'],_0x1b4c6c);MailAccountEvents[_0x8a46('0x6')](_0x4ba2a8,_0x1b4c6c);_0x140e82(null);};}for(var e in events){if(events[_0x8a46('0x7')](e)){var event=events[e];MailAccount[_0x8a46('0x8')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index e2c7a55..711e891 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 _0xab32=['./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','custom','service','host','port','Smtp','secure','authentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','data5','user','pass'];(function(_0x265920,_0x45054f){var _0x4814da=function(_0x2c3c34){while(--_0x2c3c34){_0x265920['push'](_0x265920['shift']());}};_0x4814da(++_0x45054f);}(_0xab32,0xe4));var _0x2ab3=function(_0x316c42,_0x3391f0){_0x316c42=_0x316c42-0x0;var _0x2b38f7=_0xab32[_0x316c42];return _0x2b38f7;};'use strict';var attributes=require(_0x2ab3('0x0'));module[_0x2ab3('0x1')]=function(_0x3016ac){return _0x3016ac[_0x2ab3('0x2')](_0x2ab3('0x3'),attributes,{'tableName':_0x2ab3('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x135e13=this;var _0x471e6f={'id':_0x135e13['id'],'tls':{'rejectUnauthorized':![]}};if(_0x135e13[_0x2ab3('0x5')]!==_0x2ab3('0x6')){_0x471e6f[_0x2ab3('0x7')]=_0x135e13[_0x2ab3('0x5')];}else{_0x471e6f['host']=_0x135e13['Smtp'][_0x2ab3('0x8')];_0x471e6f[_0x2ab3('0x9')]=_0x135e13[_0x2ab3('0xa')]['port'];_0x471e6f[_0x2ab3('0xb')]=_0x135e13['Smtp'][_0x2ab3('0xb')];}if(_0x135e13[_0x2ab3('0xa')][_0x2ab3('0xc')]){if(_0x135e13['Smtp']['modernAuthentication']){if(!_0x135e13[_0x2ab3('0xa')][_0x2ab3('0xd')])throw new Error(_0x2ab3('0xe'));_0x471e6f[_0x2ab3('0xf')]={'type':'OAuth2','user':_0x135e13[_0x2ab3('0xa')]['user'],'accessToken':_0x135e13[_0x2ab3('0xa')][_0x2ab3('0xd')][_0x2ab3('0x10')]};}else{_0x471e6f['auth']={'user':_0x135e13['Smtp'][_0x2ab3('0x11')],'pass':_0x135e13[_0x2ab3('0xa')][_0x2ab3('0x12')]};}}return _0x471e6f;}}});}; \ No newline at end of file +var _0xdb86=['./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','service','host','Smtp','secure','authentication','modernAuthentication','OAuth2','CloudProvider','data5','auth','user','pass'];(function(_0x565254,_0x14c923){var _0x1de238=function(_0x221c42){while(--_0x221c42){_0x565254['push'](_0x565254['shift']());}};_0x1de238(++_0x14c923);}(_0xdb86,0x6c));var _0x6db8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdb86[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require(_0x6db8('0x0'));module[_0x6db8('0x1')]=function(_0x22e6a3){return _0x22e6a3[_0x6db8('0x2')](_0x6db8('0x3'),attributes,{'tableName':_0x6db8('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x5a7c6e=this;var _0x4c24c1={'id':_0x5a7c6e['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5a7c6e[_0x6db8('0x5')]!=='custom'){_0x4c24c1[_0x6db8('0x6')]=_0x5a7c6e[_0x6db8('0x5')];}else{_0x4c24c1[_0x6db8('0x7')]=_0x5a7c6e['Smtp'][_0x6db8('0x7')];_0x4c24c1['port']=_0x5a7c6e[_0x6db8('0x8')]['port'];_0x4c24c1['secure']=_0x5a7c6e['Smtp'][_0x6db8('0x9')];}if(_0x5a7c6e[_0x6db8('0x8')][_0x6db8('0xa')]){if(_0x5a7c6e[_0x6db8('0x8')][_0x6db8('0xb')]){if(!_0x5a7c6e['Smtp']['CloudProvider'])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x4c24c1['auth']={'type':_0x6db8('0xc'),'user':_0x5a7c6e['Smtp']['user'],'accessToken':_0x5a7c6e[_0x6db8('0x8')][_0x6db8('0xd')][_0x6db8('0xe')]};}else{_0x4c24c1[_0x6db8('0xf')]={'user':_0x5a7c6e[_0x6db8('0x8')][_0x6db8('0x10')],'pass':_0x5a7c6e[_0x6db8('0x8')][_0x6db8('0x11')]};}}return _0x4c24c1;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 031065b..65c6b40 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 _0x36c3=['options','raw','where','limit','include','map','model','attributes','catch','find','smtp','setDataValue','getSmtpOptions','ShowMailAccount','stringify','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','smtpOptions','list','applications','orderBy','priority','asc','push','length','create','List\x20not\x20found','contact','messageId','generate','subject','MailInteraction','MailMessage','Messages','inReplyTo','spread','update','attach','format','YYYY-MM-DD\x20HH:mm:ss','get','interaction','created','attachments','originTo','bcc','ChatWebsiteId','originChannel','ChatOfflineMessageId','User','UserId','unshift','agent','name','waitForTheAssignedAgent','queueId','MailQueue','queue','waitForTheAssignedQueue','*,*,*,*','Start','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','message','result','GetMailAccount'];(function(_0x1e500e,_0x2c9d74){var _0x10dc5e=function(_0x354423){while(--_0x354423){_0x1e500e['push'](_0x1e500e['shift']());}};_0x10dc5e(++_0x2c9d74);}(_0x36c3,0x1a6));var _0x336c=function(_0x366e99,_0x15d82d){_0x366e99=_0x366e99-0x0;var _0x180bbe=_0x36c3[_0x366e99];return _0x180bbe;};'use strict';var _=require(_0x336c('0x0'));var moment=require(_0x336c('0x1'));var BPromise=require('bluebird');var rs=require(_0x336c('0x2'));var Redis=require(_0x336c('0x3'));var db=require(_0x336c('0x4'))['db'];var logger=require(_0x336c('0x5'))(_0x336c('0x6'));var config=require(_0x336c('0x7'));var jayson=require(_0x336c('0x8'));var client=jayson['client'][_0x336c('0x9')]({'port':0x232c});config[_0x336c('0xa')]=_[_0x336c('0xb')](config[_0x336c('0xa')],{'host':_0x336c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x336c('0xa')]));require(_0x336c('0xd'))[_0x336c('0xe')](socket);function respondWithRpcPromise(_0x5e7830,_0x8b3722,_0x243984){return new BPromise(function(_0x33ced0,_0x1a4503){return client[_0x336c('0xf')](_0x5e7830,_0x243984)[_0x336c('0x10')](function(_0x174acc){logger[_0x336c('0x11')](_0x336c('0x12'),_0x8b3722,_0x336c('0x13'));logger[_0x336c('0x14')](_0x336c('0x15'),_0x8b3722,_0x336c('0x13'),JSON['stringify'](_0x174acc));if(_0x174acc['error']){if(_0x174acc[_0x336c('0x16')]['code']===0x1f4){logger[_0x336c('0x16')](_0x336c('0x12'),_0x8b3722,_0x174acc[_0x336c('0x16')][_0x336c('0x17')]);return _0x1a4503(_0x174acc['error'][_0x336c('0x17')]);}logger[_0x336c('0x16')]('MailAccount,\x20%s,\x20%s',_0x8b3722,_0x174acc[_0x336c('0x16')]['message']);return _0x33ced0(_0x174acc[_0x336c('0x16')]['message']);}else{logger[_0x336c('0x11')]('MailAccount,\x20%s,\x20%s',_0x8b3722,_0x336c('0x13'));_0x33ced0(_0x174acc[_0x336c('0x18')]['message']);}})['catch'](function(_0x13db87){logger[_0x336c('0x16')](_0x336c('0x12'),_0x8b3722,_0x13db87);_0x1a4503(_0x13db87);});});}exports[_0x336c('0x19')]=function(_0x366182){var _0x4fde93=this;return new Promise(function(_0x327e10,_0x532e12){return db['MailAccount']['findAll']({'raw':_0x366182[_0x336c('0x1a')]?_0x366182[_0x336c('0x1a')][_0x336c('0x1b')]===undefined?!![]:![]:!![],'where':_0x366182['options']?_0x366182['options'][_0x336c('0x1c')]||null:null,'attributes':_0x366182[_0x336c('0x1a')]?_0x366182[_0x336c('0x1a')]['attributes']||null:null,'limit':_0x366182[_0x336c('0x1a')]?_0x366182[_0x336c('0x1a')][_0x336c('0x1d')]||null:null,'include':_0x366182['options']?_0x366182[_0x336c('0x1a')][_0x336c('0x1e')]?_[_0x336c('0x1f')](_0x366182[_0x336c('0x1a')]['include'],function(_0x401660){return{'model':db[_0x401660[_0x336c('0x20')]],'as':_0x401660['as'],'attributes':_0x401660[_0x336c('0x21')],'include':_0x401660[_0x336c('0x1e')]?_[_0x336c('0x1f')](_0x401660[_0x336c('0x1e')],function(_0x567bfa){return{'model':db[_0x567bfa[_0x336c('0x20')]],'as':_0x567bfa['as'],'attributes':_0x567bfa[_0x336c('0x21')],'include':_0x567bfa[_0x336c('0x1e')]?_[_0x336c('0x1f')](_0x567bfa['include'],function(_0x637e87){return{'model':db[_0x637e87[_0x336c('0x20')]],'as':_0x637e87['as'],'attributes':_0x637e87['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x562043){logger[_0x336c('0x11')](_0x336c('0x19'),_0x366182);logger['debug']('GetMailAccount',_0x366182,JSON['stringify'](_0x562043));_0x327e10(_0x562043);})[_0x336c('0x22')](function(_0x37782a){logger[_0x336c('0x16')](_0x336c('0x19'),_0x37782a[_0x336c('0x17')],_0x366182);_0x532e12(_0x4fde93[_0x336c('0x16')](0x1f4,_0x37782a[_0x336c('0x17')]));});});};exports['ShowMailAccount']=function(_0x90d7de){var _0x21f671=this;return new Promise(function(_0x2b1af7,_0x34bcbe){return db['MailAccount'][_0x336c('0x23')]({'raw':_0x90d7de[_0x336c('0x1a')]?_0x90d7de['options'][_0x336c('0x1b')]===undefined?!![]:![]:!![],'where':_0x90d7de[_0x336c('0x1a')]?_0x90d7de['options'][_0x336c('0x1c')]||null:null,'attributes':_0x90d7de[_0x336c('0x1a')]?_0x90d7de[_0x336c('0x1a')][_0x336c('0x21')]||null:null,'include':_0x90d7de[_0x336c('0x1a')]?_0x90d7de[_0x336c('0x1a')][_0x336c('0x1e')]?_[_0x336c('0x1f')](_0x90d7de['options'][_0x336c('0x1e')],function(_0x351d13){return{'model':db[_0x351d13[_0x336c('0x20')]],'as':_0x351d13['as'],'attributes':_0x351d13[_0x336c('0x21')],'include':_0x351d13[_0x336c('0x1e')]?_[_0x336c('0x1f')](_0x351d13[_0x336c('0x1e')],function(_0x223c86){return{'model':db[_0x223c86[_0x336c('0x20')]],'as':_0x223c86['as'],'attributes':_0x223c86[_0x336c('0x21')],'include':_0x223c86['include']?_[_0x336c('0x1f')](_0x223c86[_0x336c('0x1e')],function(_0x4690c3){return{'model':db[_0x4690c3[_0x336c('0x20')]],'as':_0x4690c3['as'],'attributes':_0x4690c3[_0x336c('0x21')]};}):[]};}):[]};}):[]:[]})[_0x336c('0x10')](function(_0x853b2d){if(_0x90d7de[_0x336c('0x1a')][_0x336c('0x24')]===!![])_0x853b2d[_0x336c('0x25')]('smtpOptions',_0x853b2d[_0x336c('0x26')]());logger[_0x336c('0x11')](_0x336c('0x27'),_0x90d7de);logger['debug'](_0x336c('0x27'),_0x90d7de,JSON[_0x336c('0x28')](_0x853b2d));_0x2b1af7(_0x853b2d);})[_0x336c('0x22')](function(_0x36a46f){logger['error'](_0x336c('0x27'),_0x36a46f[_0x336c('0x17')],_0x90d7de);_0x34bcbe(_0x21f671['error'](0x1f4,_0x36a46f[_0x336c('0x17')]));});});};exports[_0x336c('0x29')]=function(_0x1d30ac){var _0x4e75fc=this;return new Promise(function(_0x16c6c6,_0x2af458){var _0xdd7677={'body':_0x1d30ac[_0x336c('0x2a')],'channel':_0x336c('0x2b')};var _0x437170=_[_0x336c('0x2c')](_[_0x336c('0x2d')](db[_0x336c('0x2e')][_0x336c('0x2f')]),['createdAt',_0x336c('0x30'),_0x336c('0x31'),_0x336c('0x32')]);var _0x5b2f25=![];if(_0x1d30ac[_0x336c('0x2a')]['id']){delete _0x1d30ac[_0x336c('0x2a')]['id'];}if(_['isNil'](_0x1d30ac[_0x336c('0x2a')][_0x336c('0x33')])){return _0x2af458(_0x4e75fc[_0x336c('0x16')](0x1f4,_0x336c('0x34')));}if(_['isNil'](_0x1d30ac[_0x336c('0x2a')][_0x336c('0x2a')])||_0x1d30ac['body'][_0x336c('0x2a')]===''){return _0x2af458(_0x4e75fc[_0x336c('0x16')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x336c('0x35')](_0x1d30ac[_0x336c('0x2a')][_0x336c('0x36')])){return _0x2af458(_0x4e75fc[_0x336c('0x16')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x437170));}if(!_[_0x336c('0x37')](_0x437170,_0x1d30ac[_0x336c('0x2a')][_0x336c('0x36')])){return _0x2af458(_0x4e75fc[_0x336c('0x16')](0x1f4,_0x336c('0x38')+_0x437170));}var _0x3b68c4={};_0x3b68c4[_0x1d30ac[_0x336c('0x2a')][_0x336c('0x36')]]=_0x1d30ac[_0x336c('0x2a')]['from'];return db[_0x336c('0x39')][_0x336c('0x23')]({'where':{'id':_0x1d30ac[_0x336c('0x3a')]['id']},'include':[{'model':db[_0x336c('0x3b')],'as':_0x336c('0x3c'),'include':[{'model':db[_0x336c('0x2e')],'as':_0x336c('0x3d'),'where':_0x3b68c4,'limit':0x1,'order':[[_0x336c('0x30'),_0x336c('0x3e')]]}]},{'model':db[_0x336c('0x3f')],'as':_0x336c('0x40')},{'model':db[_0x336c('0x41')],'as':_0x336c('0x42'),'include':[{'model':db['CloudProvider'],'as':_0x336c('0x43')}]}]})['then'](function(_0x4f4e12){if(_0x4f4e12&&_0x4f4e12[_0x336c('0x3c')]){var _0x4f717e=_0x4f4e12['get']({'plain':!![]});_0xdd7677[_0x336c('0x3a')]=_['omit'](_0x4f717e,[_0x336c('0x40'),_0x336c('0x3c')]);_0xdd7677[_0x336c('0x3a')][_0x336c('0x44')]=_0x4f4e12['getSmtpOptions']();_0xdd7677['applications']=_0x4f717e[_0x336c('0x40')];_0xdd7677[_0x336c('0x45')]=_0x4f717e['List'];_0xdd7677[_0x336c('0x46')]=_[_0x336c('0x47')](_0xdd7677['applications'],[_0x336c('0x48')],[_0x336c('0x49')]);if(_0xdd7677[_0x336c('0x3a')]&&_0xdd7677[_0x336c('0x3a')]['autoclose']){_0xdd7677[_0x336c('0x46')][_0x336c('0x4a')]({'id':0x0,'priority':_0xdd7677['applications']['length']+0x1,'app':'close','appdata':'autoclose','interval':'*,*,*,*'});}if(_0xdd7677[_0x336c('0x3a')][_0x336c('0x40')]){delete _0xdd7677[_0x336c('0x3a')][_0x336c('0x40')];}if(_0xdd7677['account'][_0x336c('0x3c')]){delete _0xdd7677[_0x336c('0x3a')][_0x336c('0x3c')];}if(_0x4f717e[_0x336c('0x3c')]['Contacts'][_0x336c('0x4b')]){return _0x4f717e['List'][_0x336c('0x3d')][0x0];}var _0x3dc6ee=_[_0x336c('0xb')](_0x1d30ac[_0x336c('0x2a')],{'firstName':_0x1d30ac[_0x336c('0x2a')][_0x336c('0x33')],'ListId':_0x4f717e['ListId']});_0x3dc6ee[_0x1d30ac['body'][_0x336c('0x36')]]=_0x1d30ac[_0x336c('0x2a')]['from'];return db[_0x336c('0x2e')][_0x336c('0x4c')](_0x3dc6ee);}else{throw new Error(_0x336c('0x4d'));}})['then'](function(_0x5bacb9){_0xdd7677[_0x336c('0x4e')]=_0x5bacb9;if(_0x5bacb9){if(!_0x1d30ac[_0x336c('0x2a')][_0x336c('0x17')][_0x336c('0x4f')]){_0x1d30ac[_0x336c('0x2a')][_0x336c('0x17')]['messageId']=rs[_0x336c('0x50')]()+'\x20'+_0x1d30ac[_0x336c('0x2a')][_0x336c('0x17')]['from'];}var _0x58f63f={'ContactId':_0x5bacb9['id'],'MailAccountId':_0x1d30ac[_0x336c('0x3a')]['id'],'inReplyTo':_0x1d30ac[_0x336c('0x2a')][_0x336c('0x17')][_0x336c('0x4f')],'to':_0x1d30ac[_0x336c('0x2a')][_0x336c('0x17')][_0x336c('0x33')],'cc':_0x1d30ac[_0x336c('0x2a')][_0x336c('0x17')]['cc'],'subject':_0x1d30ac[_0x336c('0x2a')][_0x336c('0x17')][_0x336c('0x51')],'attach':_0x1d30ac[_0x336c('0x2a')]['message']['attach'],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x336c('0x52')][_0x336c('0x23')]({'where':{'closed':![],'MailAccountId':_0x1d30ac['account']['id']},'include':[{'model':db[_0x336c('0x53')],'as':_0x336c('0x54'),'attributes':[_0x336c('0x4f')],'where':{'messageId':_0x1d30ac[_0x336c('0x2a')][_0x336c('0x17')][_0x336c('0x55')]}}]})['then'](function(_0x2086a4){if(_0x2086a4){return[_0x2086a4,![]];}return db['MailInteraction'][_0x336c('0x4c')](_0x58f63f)[_0x336c('0x10')](function(_0x2d4c48){return[_0x2d4c48,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x336c('0x56')](function(_0x39697d,_0x579607){if(_0x39697d){_0x5b2f25=_0x579607;if(!_0x579607){return _0x39697d[_0x336c('0x57')]({'inReplyTo':_0x1d30ac['body'][_0x336c('0x17')][_0x336c('0x4f')],'to':_0x1d30ac[_0x336c('0x2a')][_0x336c('0x17')][_0x336c('0x33')],'cc':_0x1d30ac[_0x336c('0x2a')]['message']['cc'],'subject':_0x1d30ac[_0x336c('0x2a')]['message']['subject'],'attach':_0x39697d['attach']?_0x39697d['attach']:_0x1d30ac['body']['message'][_0x336c('0x58')],'substatus':null,'substatusAt':moment()[_0x336c('0x59')](_0x336c('0x5a')),'lastMsgAt':moment()[_0x336c('0x59')](_0x336c('0x5a')),'lastMsgDirection':'in'});}else{return _0x39697d;}}})[_0x336c('0x10')](function(_0x338106){_0xdd7677['interaction']=_0x338106[_0x336c('0x5b')]({'plain':!![]});_0xdd7677[_0x336c('0x5c')][_0x336c('0x5d')]=_0x5b2f25;return db[_0x336c('0x53')]['create']({'body':_0x1d30ac[_0x336c('0x2a')][_0x336c('0x2a')],'MailAccountId':_0x1d30ac[_0x336c('0x3a')]['id'],'MailInteractionId':_0x338106['id'],'direction':'in','ContactId':_0xdd7677['contact']['id'],'messageId':_0x1d30ac[_0x336c('0x2a')][_0x336c('0x17')][_0x336c('0x4f')],'from':_0x1d30ac[_0x336c('0x2a')][_0x336c('0x17')][_0x336c('0x33')],'to':_0x1d30ac[_0x336c('0x2a')]['message']['to'],'cc':_0x1d30ac['body'][_0x336c('0x17')]['cc'],'subject':_0x1d30ac[_0x336c('0x2a')][_0x336c('0x17')][_0x336c('0x51')],'attach':_0x1d30ac[_0x336c('0x2a')][_0x336c('0x17')][_0x336c('0x58')],'Attachments':_0x1d30ac[_0x336c('0x2a')]['message'][_0x336c('0x5e')],'originTo':_0x1d30ac[_0x336c('0x2a')]['message'][_0x336c('0x5f')],'originCc':_0x1d30ac[_0x336c('0x2a')]['message']['originCc'],'bcc':_0x1d30ac[_0x336c('0x2a')]['message'][_0x336c('0x60')],'ChatWebsiteId':_0x1d30ac[_0x336c('0x2a')]['message'][_0x336c('0x61')]||null,'originChannel':_0x1d30ac[_0x336c('0x2a')][_0x336c('0x17')][_0x336c('0x62')]||'Email','ChatOfflineMessageId':_0x1d30ac[_0x336c('0x2a')][_0x336c('0x17')][_0x336c('0x63')]||null},{'include':[{'model':db['Attachment'],'as':'Attachments'}]});})['then'](function(_0x553f66){_0xdd7677['message']=_0x553f66;if(!_0xdd7677[_0x336c('0x5c')]['UserId']){return;}return db[_0x336c('0x64')]['find']({'attributes':['id','name'],'where':{'id':_0xdd7677[_0x336c('0x5c')][_0x336c('0x65')]}});})['then'](function(_0x34e9c8){if(_0x34e9c8){_0xdd7677['applications'][_0x336c('0x66')]({'id':0x0,'priority':0x0,'app':_0x336c('0x67'),'appdata':_0x34e9c8[_0x336c('0x68')]+','+(_0xdd7677[_0x336c('0x3a')][_0x336c('0x69')]||0xa),'interval':'*,*,*,*'});}if(!_0xdd7677[_0x336c('0x5c')][_0x336c('0x6a')]){return;}return db[_0x336c('0x6b')]['find']({'attributes':['id',_0x336c('0x68')],'where':{'id':_0xdd7677[_0x336c('0x5c')][_0x336c('0x6a')]}});})[_0x336c('0x10')](function(_0x444c4f){if(_0x444c4f){_0xdd7677[_0x336c('0x46')][_0x336c('0x66')]({'id':0x0,'priority':0x1,'app':_0x336c('0x6c'),'appdata':_0x444c4f['name']+','+(_0xdd7677[_0x336c('0x3a')][_0x336c('0x6d')]||0x12c),'interval':_0x336c('0x6e')});}return respondWithRpcPromise(_0x336c('0x6f'),'startRouting',_0xdd7677);})[_0x336c('0x10')](function(_0x57de54){_0x16c6c6(_0x57de54);})[_0x336c('0x22')](function(_0x364e89){_0x2af458(_0x4e75fc[_0x336c('0x16')](0x1f4,_0x364e89[_0x336c('0x17')]));});});}; \ No newline at end of file +var _0xbacd=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailAccount','MailAccount','findAll','options','where','attributes','limit','include','map','model','ShowMailAccount','find','raw','smtp','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','CmContact','Contacts','DESC','MailApplication','Applications','MailServerOut','CloudProvider','get','omit','smtpOptions','applications','list','priority','push','autoclose','*,*,*,*','length','create','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','messageId','Contact\x20not\x20found','spread','update','interaction','created','contact','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','UserId','User','name','agent','waitForTheAssignedAgent','queueId','MailQueue','unshift','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x1bad4d,_0x4b07aa){var _0x3bc73b=function(_0x2efc36){while(--_0x2efc36){_0x1bad4d['push'](_0x1bad4d['shift']());}};_0x3bc73b(++_0x4b07aa);}(_0xbacd,0x1c5));var _0xdbac=function(_0x520d4f,_0x658a7a){_0x520d4f=_0x520d4f-0x0;var _0x38d5d4=_0xbacd[_0x520d4f];return _0x38d5d4;};'use strict';var _=require(_0xdbac('0x0'));var moment=require(_0xdbac('0x1'));var BPromise=require('bluebird');var rs=require(_0xdbac('0x2'));var Redis=require(_0xdbac('0x3'));var db=require(_0xdbac('0x4'))['db'];var logger=require('../../config/logger')(_0xdbac('0x5'));var config=require(_0xdbac('0x6'));var jayson=require(_0xdbac('0x7'));var client=jayson[_0xdbac('0x8')][_0xdbac('0x9')]({'port':0x232c});config[_0xdbac('0xa')]=_[_0xdbac('0xb')](config[_0xdbac('0xa')],{'host':_0xdbac('0xc'),'port':0x18eb});var socket=require(_0xdbac('0xd'))(new Redis(config[_0xdbac('0xa')]));require(_0xdbac('0xe'))[_0xdbac('0xf')](socket);function respondWithRpcPromise(_0x2824c8,_0x2f90c4,_0x4d025f){return new BPromise(function(_0x18f3ad,_0x258f7e){return client['request'](_0x2824c8,_0x4d025f)[_0xdbac('0x10')](function(_0x5bcf69){logger[_0xdbac('0x11')](_0xdbac('0x12'),_0x2f90c4,_0xdbac('0x13'));logger[_0xdbac('0x14')](_0xdbac('0x15'),_0x2f90c4,_0xdbac('0x13'),JSON[_0xdbac('0x16')](_0x5bcf69));if(_0x5bcf69[_0xdbac('0x17')]){if(_0x5bcf69[_0xdbac('0x17')]['code']===0x1f4){logger[_0xdbac('0x17')](_0xdbac('0x12'),_0x2f90c4,_0x5bcf69[_0xdbac('0x17')][_0xdbac('0x18')]);return _0x258f7e(_0x5bcf69[_0xdbac('0x17')][_0xdbac('0x18')]);}logger[_0xdbac('0x17')](_0xdbac('0x12'),_0x2f90c4,_0x5bcf69['error'][_0xdbac('0x18')]);return _0x18f3ad(_0x5bcf69[_0xdbac('0x17')][_0xdbac('0x18')]);}else{logger['info'](_0xdbac('0x12'),_0x2f90c4,_0xdbac('0x13'));_0x18f3ad(_0x5bcf69[_0xdbac('0x19')][_0xdbac('0x18')]);}})[_0xdbac('0x1a')](function(_0x1a9690){logger[_0xdbac('0x17')](_0xdbac('0x12'),_0x2f90c4,_0x1a9690);_0x258f7e(_0x1a9690);});});}exports[_0xdbac('0x1b')]=function(_0x1301d2){var _0x4598d9=this;return new Promise(function(_0x9c74a5,_0x5ec67c){return db[_0xdbac('0x1c')][_0xdbac('0x1d')]({'raw':_0x1301d2['options']?_0x1301d2[_0xdbac('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x1301d2[_0xdbac('0x1e')]?_0x1301d2['options'][_0xdbac('0x1f')]||null:null,'attributes':_0x1301d2[_0xdbac('0x1e')]?_0x1301d2[_0xdbac('0x1e')][_0xdbac('0x20')]||null:null,'limit':_0x1301d2[_0xdbac('0x1e')]?_0x1301d2[_0xdbac('0x1e')][_0xdbac('0x21')]||null:null,'include':_0x1301d2['options']?_0x1301d2[_0xdbac('0x1e')][_0xdbac('0x22')]?_[_0xdbac('0x23')](_0x1301d2[_0xdbac('0x1e')][_0xdbac('0x22')],function(_0x2b4cda){return{'model':db[_0x2b4cda[_0xdbac('0x24')]],'as':_0x2b4cda['as'],'attributes':_0x2b4cda[_0xdbac('0x20')],'include':_0x2b4cda[_0xdbac('0x22')]?_[_0xdbac('0x23')](_0x2b4cda[_0xdbac('0x22')],function(_0x1ea3c3){return{'model':db[_0x1ea3c3[_0xdbac('0x24')]],'as':_0x1ea3c3['as'],'attributes':_0x1ea3c3[_0xdbac('0x20')],'include':_0x1ea3c3[_0xdbac('0x22')]?_[_0xdbac('0x23')](_0x1ea3c3[_0xdbac('0x22')],function(_0x2bdb01){return{'model':db[_0x2bdb01[_0xdbac('0x24')]],'as':_0x2bdb01['as'],'attributes':_0x2bdb01[_0xdbac('0x20')]};}):[]};}):[]};}):[]:[]})[_0xdbac('0x10')](function(_0x4e7ef9){logger[_0xdbac('0x11')](_0xdbac('0x1b'),_0x1301d2);logger[_0xdbac('0x14')](_0xdbac('0x1b'),_0x1301d2,JSON['stringify'](_0x4e7ef9));_0x9c74a5(_0x4e7ef9);})['catch'](function(_0x10c3c8){logger[_0xdbac('0x17')](_0xdbac('0x1b'),_0x10c3c8[_0xdbac('0x18')],_0x1301d2);_0x5ec67c(_0x4598d9['error'](0x1f4,_0x10c3c8[_0xdbac('0x18')]));});});};exports[_0xdbac('0x25')]=function(_0x1659e4){var _0x2f53ef=this;return new Promise(function(_0x30a711,_0x1e3702){return db[_0xdbac('0x1c')][_0xdbac('0x26')]({'raw':_0x1659e4['options']?_0x1659e4['options'][_0xdbac('0x27')]===undefined?!![]:![]:!![],'where':_0x1659e4[_0xdbac('0x1e')]?_0x1659e4[_0xdbac('0x1e')][_0xdbac('0x1f')]||null:null,'attributes':_0x1659e4['options']?_0x1659e4['options'][_0xdbac('0x20')]||null:null,'include':_0x1659e4[_0xdbac('0x1e')]?_0x1659e4[_0xdbac('0x1e')][_0xdbac('0x22')]?_[_0xdbac('0x23')](_0x1659e4[_0xdbac('0x1e')][_0xdbac('0x22')],function(_0x4640f7){return{'model':db[_0x4640f7[_0xdbac('0x24')]],'as':_0x4640f7['as'],'attributes':_0x4640f7[_0xdbac('0x20')],'include':_0x4640f7[_0xdbac('0x22')]?_[_0xdbac('0x23')](_0x4640f7[_0xdbac('0x22')],function(_0x48a49f){return{'model':db[_0x48a49f[_0xdbac('0x24')]],'as':_0x48a49f['as'],'attributes':_0x48a49f['attributes'],'include':_0x48a49f[_0xdbac('0x22')]?_[_0xdbac('0x23')](_0x48a49f[_0xdbac('0x22')],function(_0x3a4829){return{'model':db[_0x3a4829['model']],'as':_0x3a4829['as'],'attributes':_0x3a4829[_0xdbac('0x20')]};}):[]};}):[]};}):[]:[]})[_0xdbac('0x10')](function(_0x58a661){if(_0x1659e4['options'][_0xdbac('0x28')]===!![])_0x58a661['setDataValue']('smtpOptions',_0x58a661[_0xdbac('0x29')]());logger[_0xdbac('0x11')](_0xdbac('0x25'),_0x1659e4);logger['debug'](_0xdbac('0x25'),_0x1659e4,JSON[_0xdbac('0x16')](_0x58a661));_0x30a711(_0x58a661);})[_0xdbac('0x1a')](function(_0x3d1dc1){logger['error']('ShowMailAccount',_0x3d1dc1[_0xdbac('0x18')],_0x1659e4);_0x1e3702(_0x2f53ef[_0xdbac('0x17')](0x1f4,_0x3d1dc1[_0xdbac('0x18')]));});});};exports[_0xdbac('0x2a')]=function(_0x2346e9){var _0x53c779=this;return new Promise(function(_0x1a27a4,_0x3bf656){var _0x5a4851={'body':_0x2346e9[_0xdbac('0x2b')],'channel':_0xdbac('0x2c')};var _0x1710a5=_[_0xdbac('0x2d')](_[_0xdbac('0x2e')](db['CmContact'][_0xdbac('0x2f')]),[_0xdbac('0x30'),_0xdbac('0x31'),_0xdbac('0x32'),_0xdbac('0x33')]);var _0x25344a=![];if(_0x2346e9[_0xdbac('0x2b')]['id']){delete _0x2346e9[_0xdbac('0x2b')]['id'];}if(_[_0xdbac('0x34')](_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x35')])){return _0x3bf656(_0x53c779[_0xdbac('0x17')](0x1f4,'from\x20is\x20mandatory'));}if(_['isNil'](_0x2346e9['body']['body'])||_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x2b')]===''){return _0x3bf656(_0x53c779[_0xdbac('0x17')](0x1f4,_0xdbac('0x36')));}if(_[_0xdbac('0x34')](_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x37')])){return _0x3bf656(_0x53c779[_0xdbac('0x17')](0x1f4,_0xdbac('0x38')+_0x1710a5));}if(!_['includes'](_0x1710a5,_0x2346e9['body']['mapKey'])){return _0x3bf656(_0x53c779[_0xdbac('0x17')](0x1f4,_0xdbac('0x39')+_0x1710a5));}var _0x573fb3={};_0x573fb3[_0x2346e9['body']['mapKey']]=_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x35')];return db[_0xdbac('0x1c')]['find']({'where':{'id':_0x2346e9[_0xdbac('0x3a')]['id']},'include':[{'model':db[_0xdbac('0x3b')],'as':_0xdbac('0x3c'),'include':[{'model':db[_0xdbac('0x3d')],'as':_0xdbac('0x3e'),'where':_0x573fb3,'limit':0x1,'order':[['updatedAt',_0xdbac('0x3f')]]}]},{'model':db[_0xdbac('0x40')],'as':_0xdbac('0x41')},{'model':db[_0xdbac('0x42')],'as':'Smtp','include':[{'model':db[_0xdbac('0x43')],'as':_0xdbac('0x43')}]}]})[_0xdbac('0x10')](function(_0x5d6e86){if(_0x5d6e86&&_0x5d6e86[_0xdbac('0x3c')]){var _0x5ce39=_0x5d6e86[_0xdbac('0x44')]({'plain':!![]});_0x5a4851[_0xdbac('0x3a')]=_[_0xdbac('0x45')](_0x5ce39,[_0xdbac('0x41'),'List']);_0x5a4851[_0xdbac('0x3a')][_0xdbac('0x46')]=_0x5d6e86['getSmtpOptions']();_0x5a4851[_0xdbac('0x47')]=_0x5ce39[_0xdbac('0x41')];_0x5a4851[_0xdbac('0x48')]=_0x5ce39[_0xdbac('0x3c')];_0x5a4851['applications']=_['orderBy'](_0x5a4851[_0xdbac('0x47')],[_0xdbac('0x49')],['asc']);if(_0x5a4851['account']&&_0x5a4851[_0xdbac('0x3a')]['autoclose']){_0x5a4851[_0xdbac('0x47')][_0xdbac('0x4a')]({'id':0x0,'priority':_0x5a4851[_0xdbac('0x47')]['length']+0x1,'app':'close','appdata':_0xdbac('0x4b'),'interval':_0xdbac('0x4c')});}if(_0x5a4851[_0xdbac('0x3a')][_0xdbac('0x41')]){delete _0x5a4851[_0xdbac('0x3a')][_0xdbac('0x41')];}if(_0x5a4851[_0xdbac('0x3a')]['List']){delete _0x5a4851['account'][_0xdbac('0x3c')];}if(_0x5ce39[_0xdbac('0x3c')][_0xdbac('0x3e')][_0xdbac('0x4d')]){return _0x5ce39[_0xdbac('0x3c')][_0xdbac('0x3e')][0x0];}var _0x5ec4f8=_[_0xdbac('0xb')](_0x2346e9[_0xdbac('0x2b')],{'firstName':_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x35')],'ListId':_0x5ce39[_0xdbac('0x33')]});_0x5ec4f8[_0x2346e9['body']['mapKey']]=_0x2346e9[_0xdbac('0x2b')]['from'];return db[_0xdbac('0x3d')][_0xdbac('0x4e')](_0x5ec4f8);}else{throw new Error('List\x20not\x20found');}})[_0xdbac('0x10')](function(_0x50af7a){_0x5a4851['contact']=_0x50af7a;if(_0x50af7a){if(!_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')]['messageId']){_0x2346e9['body'][_0xdbac('0x18')]['messageId']=rs[_0xdbac('0x4f')]()+'\x20'+_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')]['from'];}var _0x4be6fc={'ContactId':_0x50af7a['id'],'MailAccountId':_0x2346e9[_0xdbac('0x3a')]['id'],'inReplyTo':_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')]['messageId'],'to':_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')]['from'],'cc':_0x2346e9[_0xdbac('0x2b')]['message']['cc'],'subject':_0x2346e9['body'][_0xdbac('0x18')][_0xdbac('0x50')],'attach':_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')][_0xdbac('0x51')],'lastMsgAt':moment()[_0xdbac('0x52')](_0xdbac('0x53')),'lastMsgDirection':'in'};return db[_0xdbac('0x54')][_0xdbac('0x26')]({'where':{'closed':![],'MailAccountId':_0x2346e9['account']['id']},'include':[{'model':db[_0xdbac('0x55')],'as':_0xdbac('0x56'),'attributes':[_0xdbac('0x57')],'where':{'messageId':_0x2346e9[_0xdbac('0x2b')]['message']['inReplyTo']}}]})['then'](function(_0x54de5e){if(_0x54de5e){return[_0x54de5e,![]];}return db[_0xdbac('0x54')]['create'](_0x4be6fc)[_0xdbac('0x10')](function(_0x3d471f){return[_0x3d471f,!![]];});});}else{throw new Error(_0xdbac('0x58'));}})[_0xdbac('0x59')](function(_0x41645c,_0xc2d800){if(_0x41645c){_0x25344a=_0xc2d800;if(!_0xc2d800){return _0x41645c[_0xdbac('0x5a')]({'inReplyTo':_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')]['messageId'],'to':_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')][_0xdbac('0x35')],'cc':_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')]['cc'],'subject':_0x2346e9['body'][_0xdbac('0x18')][_0xdbac('0x50')],'attach':_0x41645c[_0xdbac('0x51')]?_0x41645c[_0xdbac('0x51')]:_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')][_0xdbac('0x51')],'substatus':null,'substatusAt':moment()[_0xdbac('0x52')](_0xdbac('0x53')),'lastMsgAt':moment()['format'](_0xdbac('0x53')),'lastMsgDirection':'in'});}else{return _0x41645c;}}})[_0xdbac('0x10')](function(_0x5410bc){_0x5a4851['interaction']=_0x5410bc['get']({'plain':!![]});_0x5a4851[_0xdbac('0x5b')][_0xdbac('0x5c')]=_0x25344a;return db[_0xdbac('0x55')][_0xdbac('0x4e')]({'body':_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x2b')],'MailAccountId':_0x2346e9[_0xdbac('0x3a')]['id'],'MailInteractionId':_0x5410bc['id'],'direction':'in','ContactId':_0x5a4851[_0xdbac('0x5d')]['id'],'messageId':_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')]['messageId'],'from':_0x2346e9[_0xdbac('0x2b')]['message'][_0xdbac('0x35')],'to':_0x2346e9['body'][_0xdbac('0x18')]['to'],'cc':_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')]['cc'],'subject':_0x2346e9[_0xdbac('0x2b')]['message'][_0xdbac('0x50')],'attach':_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')][_0xdbac('0x51')],'Attachments':_0x2346e9[_0xdbac('0x2b')]['message'][_0xdbac('0x5e')],'originTo':_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')][_0xdbac('0x5f')],'originCc':_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')][_0xdbac('0x60')],'bcc':_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')][_0xdbac('0x61')],'ChatWebsiteId':_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')][_0xdbac('0x62')]||null,'originChannel':_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')][_0xdbac('0x63')]||_0xdbac('0x64'),'ChatOfflineMessageId':_0x2346e9['body'][_0xdbac('0x18')][_0xdbac('0x65')]||null},{'include':[{'model':db[_0xdbac('0x66')],'as':'Attachments'}]});})[_0xdbac('0x10')](function(_0x2bb725){_0x5a4851['message']=_0x2bb725;if(!_0x5a4851['interaction'][_0xdbac('0x67')]){return;}return db[_0xdbac('0x68')]['find']({'attributes':['id',_0xdbac('0x69')],'where':{'id':_0x5a4851[_0xdbac('0x5b')][_0xdbac('0x67')]}});})[_0xdbac('0x10')](function(_0xdaa182){if(_0xdaa182){_0x5a4851['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xdbac('0x6a'),'appdata':_0xdaa182[_0xdbac('0x69')]+','+(_0x5a4851['account'][_0xdbac('0x6b')]||0xa),'interval':_0xdbac('0x4c')});}if(!_0x5a4851[_0xdbac('0x5b')][_0xdbac('0x6c')]){return;}return db[_0xdbac('0x6d')][_0xdbac('0x26')]({'attributes':['id',_0xdbac('0x69')],'where':{'id':_0x5a4851['interaction'][_0xdbac('0x6c')]}});})['then'](function(_0x47cc7f){if(_0x47cc7f){_0x5a4851['applications'][_0xdbac('0x6e')]({'id':0x0,'priority':0x1,'app':_0xdbac('0x6f'),'appdata':_0x47cc7f[_0xdbac('0x69')]+','+(_0x5a4851['account'][_0xdbac('0x70')]||0x12c),'interval':_0xdbac('0x4c')});}return respondWithRpcPromise(_0xdbac('0x71'),_0xdbac('0x72'),_0x5a4851);})[_0xdbac('0x10')](function(_0x3c578a){_0x1a27a4(_0x3c578a);})[_0xdbac('0x1a')](function(_0x141830){_0x3bf656(_0x53c779['error'](0x1f4,_0x141830[_0xdbac('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index dba7a0f..464b58f 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 _0x57e9=['update','removeListener','register','mailAccount:','remove'];(function(_0x1d8b81,_0x1c6674){var _0xa78343=function(_0x31f0b){while(--_0x31f0b){_0x1d8b81['push'](_0x1d8b81['shift']());}};_0xa78343(++_0x1c6674);}(_0x57e9,0x12b));var _0x957e=function(_0x40bf8a,_0xb0b6b8){_0x40bf8a=_0x40bf8a-0x0;var _0xcb1d41=_0x57e9[_0x40bf8a];return _0xcb1d41;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=['save',_0x957e('0x0'),_0x957e('0x1')];function createListener(_0x2b91b9,_0xc72cad){return function(_0x369cb6){_0xc72cad['emit'](_0x2b91b9,_0x369cb6);};}function removeListener(_0x3e0abc,_0x5be3f6){return function(){MailAccountEvents[_0x957e('0x2')](_0x3e0abc,_0x5be3f6);};}exports[_0x957e('0x3')]=function(_0x3fdae0){for(var _0x380d85=0x0,_0x2577de=events['length'];_0x380d85<_0x2577de;_0x380d85++){var _0x5756a6=events[_0x380d85];var _0x5856b5=createListener(_0x957e('0x4')+_0x5756a6,_0x3fdae0);MailAccountEvents['on'](_0x5756a6,_0x5856b5);}}; \ No newline at end of file +var _0x8bef=['register','length','mailAccount:','./mailAccount.events','save','remove','update','emit','removeListener'];(function(_0x599168,_0x1c91f0){var _0x423ca5=function(_0x488ec2){while(--_0x488ec2){_0x599168['push'](_0x599168['shift']());}};_0x423ca5(++_0x1c91f0);}(_0x8bef,0x66));var _0xf8be=function(_0x1385dc,_0x2c7fd7){_0x1385dc=_0x1385dc-0x0;var _0x2f6469=_0x8bef[_0x1385dc];return _0x2f6469;};'use strict';var MailAccountEvents=require(_0xf8be('0x0'));var events=[_0xf8be('0x1'),_0xf8be('0x2'),_0xf8be('0x3')];function createListener(_0x4398fd,_0x53d752){return function(_0x2dd53c){_0x53d752[_0xf8be('0x4')](_0x4398fd,_0x2dd53c);};}function removeListener(_0x335ee3,_0x306f7a){return function(){MailAccountEvents[_0xf8be('0x5')](_0x335ee3,_0x306f7a);};}exports[_0xf8be('0x6')]=function(_0x86bf8e){for(var _0x3238f1=0x0,_0x226cb8=events[_0xf8be('0x7')];_0x3238f1<_0x226cb8;_0x3238f1++){var _0x5a53f9=events[_0x3238f1];var _0x3ff5d2=createListener(_0xf8be('0x8')+_0x5a53f9,_0x86bf8e);MailAccountEvents['on'](_0x5a53f9,_0x3ff5d2);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 7f46aed..8733199 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 _0x85ce=['delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','put','isAuthenticated'];(function(_0xc7089,_0x4768dd){var _0x1f9bf6=function(_0x2b7ccf){while(--_0x2b7ccf){_0xc7089['push'](_0xc7089['shift']());}};_0x1f9bf6(++_0x4768dd);}(_0x85ce,0x102));var _0xe85c=function(_0x2eefa7,_0x16d385){_0x2eefa7=_0x2eefa7-0x0;var _0x41eec1=_0x85ce[_0x2eefa7];return _0x41eec1;};'use strict';var multer=require('multer');var util=require(_0xe85c('0x0'));var path=require('path');var timeout=require(_0xe85c('0x1'));var express=require(_0xe85c('0x2'));var router=express[_0xe85c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe85c('0x4'));var interaction=require(_0xe85c('0x5'));var config=require(_0xe85c('0x6'));var controller=require('./mailApplication.controller');router[_0xe85c('0x7')](_0xe85c('0x8'),auth['isAuthenticated'](),controller[_0xe85c('0x9')]);router[_0xe85c('0xa')](_0xe85c('0x8'),auth[_0xe85c('0xb')](),controller['update']);router[_0xe85c('0xc')]('/:id',auth[_0xe85c('0xb')](),controller[_0xe85c('0xd')]);module[_0xe85c('0xe')]=router; \ No newline at end of file +var _0x2593=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','put','update','delete','destroy','exports','multer','util','path'];(function(_0x1e4ff3,_0x36f03b){var _0x10b449=function(_0x1af4b4){while(--_0x1af4b4){_0x1e4ff3['push'](_0x1e4ff3['shift']());}};_0x10b449(++_0x36f03b);}(_0x2593,0xfd));var _0x3259=function(_0x2179f1,_0x21c653){_0x2179f1=_0x2179f1-0x0;var _0x176ec9=_0x2593[_0x2179f1];return _0x176ec9;};'use strict';var multer=require(_0x3259('0x0'));var util=require(_0x3259('0x1'));var path=require(_0x3259('0x2'));var timeout=require('connect-timeout');var express=require(_0x3259('0x3'));var router=express[_0x3259('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3259('0x5'));var interaction=require(_0x3259('0x6'));var config=require(_0x3259('0x7'));var controller=require('./mailApplication.controller');router[_0x3259('0x8')](_0x3259('0x9'),auth[_0x3259('0xa')](),controller['show']);router[_0x3259('0xb')](_0x3259('0x9'),auth[_0x3259('0xa')](),controller[_0x3259('0xc')]);router[_0x3259('0xd')](_0x3259('0x9'),auth[_0x3259('0xa')](),controller[_0x3259('0xe')]);module[_0x3259('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 e4725f0..ef05412 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 _0x7144=['sequelize','exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x42e321,_0x3792e0){var _0x4c6b7e=function(_0x13c669){while(--_0x13c669){_0x42e321['push'](_0x42e321['shift']());}};_0x4c6b7e(++_0x3792e0);}(_0x7144,0x16e));var _0x4714=function(_0x3a5555,_0x3147fc){_0x3a5555=_0x3a5555-0x0;var _0x520ad6=_0x7144[_0x3a5555];return _0x520ad6;};'use strict';var Sequelize=require(_0x4714('0x0'));module[_0x4714('0x1')]={'priority':{'type':Sequelize[_0x4714('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x4714('0x3')],'allowNull':![],'defaultValue':_0x4714('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x4714('0x3')]},'interval':{'type':Sequelize[_0x4714('0x3')],'defaultValue':_0x4714('0x5')}}; \ No newline at end of file +var _0xe69e=['STRING','noop','TEXT','*,*,*,*','INTEGER'];(function(_0x128e9c,_0x2dfb85){var _0x39a85d=function(_0xaae6e){while(--_0xaae6e){_0x128e9c['push'](_0x128e9c['shift']());}};_0x39a85d(++_0x2dfb85);}(_0xe69e,0xea));var _0xee69=function(_0x2bf5bd,_0x120787){_0x2bf5bd=_0x2bf5bd-0x0;var _0xc810c0=_0xe69e[_0x2bf5bd];return _0xc810c0;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xee69('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xee69('0x1')],'allowNull':![],'defaultValue':_0xee69('0x2')},'appdata':{'type':Sequelize[_0xee69('0x3')]()},'description':{'type':Sequelize[_0xee69('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xee69('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index f502cf3..f892d69 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 _0xd8b0=['attributes','length','include','merge','find','catch','body','params','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','show','model','MailApplication','query','keys','intersection','fields'];(function(_0x3ef1dc,_0x210a81){var _0x151f5f=function(_0x2ac8b6){while(--_0x2ac8b6){_0x3ef1dc['push'](_0x3ef1dc['shift']());}};_0x151f5f(++_0x210a81);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x0d8b('0x0'));var rimraf=require(_0x0d8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d8b('0x2'));var BPromise=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var util=require(_0x0d8b('0x5'));var path=require(_0x0d8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8b('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x8'));var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0xc'));var querystring=require(_0x0d8b('0xd'));var Papa=require(_0x0d8b('0xe'));var Redis=require(_0x0d8b('0xf'));var authService=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var as=require(_0x0d8b('0x12'));var hardwareService=require(_0x0d8b('0x13'));var logger=require('../../config/logger')(_0x0d8b('0x14'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x19')](_0x35a07b)[_0x0d8b('0x1a')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x19')](_0x5ad086)[_0x0d8b('0x1b')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=typeof _0x23eb7b[_0x0d8b('0x1c')]===_0x0d8b('0x1d')&&typeof _0x23eb7b['limit']===_0x0d8b('0x1d');var _0x4586c2=_0xa86349[_0x0d8b('0x1e')];var _0x5fecbd=_0x17f7df?0x0:_0x23eb7b[_0x0d8b('0x1c')];var _0x18dd2d=_0x17f7df?_0xa86349[_0x0d8b('0x1e')]:_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b['limit'];var _0x27512e;if(_0x18dd2d>=_0x4586c2){_0x18dd2d=_0x4586c2;_0x27512e=0xc8;}else{_0x27512e=0xce;}_0x4f6f21[_0x0d8b('0x19')](_0x27512e);return _0x4f6f21[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x5fecbd+'-'+_0x18dd2d+'/'+_0x4586c2)[_0x0d8b('0x1b')](_0xa86349);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x21')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x22')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')](_0x54a9a7)[_0x0d8b('0x24')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x25')]()[_0x0d8b('0x24')](function(){_0x38efc8[_0x0d8b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8bbee,_0x4463ee){return function(_0x5363e3){if(!_0x5363e3){_0xe8bbee[_0x0d8b('0x18')](0x194);}return _0x5363e3;};}function handleError(_0x4a0ae4,_0x3dd149){_0x3dd149=_0x3dd149||0x1f4;return function(_0x234bdd){logger[_0x0d8b('0x26')](_0x234bdd['stack']);if(_0x234bdd['name']){delete _0x234bdd[_0x0d8b('0x27')];}_0x4a0ae4[_0x0d8b('0x19')](_0x3dd149)['send'](_0x234bdd);};}exports[_0x0d8b('0x28')]=function(_0x59aa83,_0x1b2b59){var _0x4b59e5={'raw':!![],'where':{'id':_0x59aa83['params']['id']}},_0x97050a={};_0x97050a[_0x0d8b('0x29')]=_['keys'](db[_0x0d8b('0x2a')]['rawAttributes']);_0x97050a[_0x0d8b('0x2b')]=_[_0x0d8b('0x2c')](_0x59aa83[_0x0d8b('0x2b')]);_0x97050a['filters']=_['intersection'](_0x97050a['model'],_0x97050a[_0x0d8b('0x2b')]);_0x4b59e5['attributes']=_[_0x0d8b('0x2d')](_0x97050a['model'],qs['fields'](_0x59aa83[_0x0d8b('0x2b')][_0x0d8b('0x2e')]));_0x4b59e5[_0x0d8b('0x2f')]=_0x4b59e5[_0x0d8b('0x2f')][_0x0d8b('0x30')]?_0x4b59e5[_0x0d8b('0x2f')]:_0x97050a[_0x0d8b('0x29')];if(_0x59aa83[_0x0d8b('0x2b')]['includeAll']){_0x4b59e5[_0x0d8b('0x31')]=[{'all':!![]}];}_0x4b59e5=_[_0x0d8b('0x32')]({},_0x4b59e5,_0x59aa83['options']);return db[_0x0d8b('0x2a')][_0x0d8b('0x33')](_0x4b59e5)[_0x0d8b('0x24')](handleEntityNotFound(_0x1b2b59,null))['then'](respondWithResult(_0x1b2b59,null))[_0x0d8b('0x34')](handleError(_0x1b2b59,null));};exports[_0x0d8b('0x23')]=function(_0x206157,_0x31ceba){if(_0x206157[_0x0d8b('0x35')]['id']){delete _0x206157['body']['id'];}return db[_0x0d8b('0x2a')][_0x0d8b('0x33')]({'where':{'id':_0x206157['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x31ceba,null))[_0x0d8b('0x24')](saveUpdates(_0x206157[_0x0d8b('0x35')],null))[_0x0d8b('0x24')](respondWithResult(_0x31ceba,null))[_0x0d8b('0x34')](handleError(_0x31ceba,null));};exports['destroy']=function(_0x497a71,_0x41b4f9){return db['MailApplication']['find']({'where':{'id':_0x497a71[_0x0d8b('0x36')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x41b4f9,null))[_0x0d8b('0x24')](removeEntity(_0x41b4f9,null))[_0x0d8b('0x34')](handleError(_0x41b4f9,null));}; \ No newline at end of file +var _0xaa88=['limit','count','set','apply','reject','then','stack','name','send','params','model','keys','MailApplication','query','filters','intersection','attributes','fields','length','include','merge','options','find','update','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa88,0x137));var _0x8aa8=function(_0x594ece,_0x2a1f27){_0x594ece=_0x594ece-0x0;var _0x471bc4=_0xaa88[_0x594ece];return _0x471bc4;};'use strict';var emlformat=require(_0x8aa8('0x0'));var rimraf=require(_0x8aa8('0x1'));var zipdir=require(_0x8aa8('0x2'));var jsonpatch=require(_0x8aa8('0x3'));var rp=require('request-promise');var moment=require(_0x8aa8('0x4'));var BPromise=require(_0x8aa8('0x5'));var Mustache=require(_0x8aa8('0x6'));var util=require(_0x8aa8('0x7'));var path=require(_0x8aa8('0x8'));var sox=require(_0x8aa8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8aa8('0xa'));var _=require('lodash');var squel=require(_0x8aa8('0xb'));var crypto=require(_0x8aa8('0xc'));var jsforce=require(_0x8aa8('0xd'));var deskjs=require(_0x8aa8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8aa8('0xf'));var Papa=require(_0x8aa8('0x10'));var Redis=require(_0x8aa8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8aa8('0x12'));var as=require(_0x8aa8('0x13'));var hardwareService=require(_0x8aa8('0x14'));var logger=require(_0x8aa8('0x15'))('api');var utils=require(_0x8aa8('0x16'));var config=require(_0x8aa8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8aa8('0x18'))['db'];function respondWithStatusCode(_0xa691d6,_0x28132f){_0x28132f=_0x28132f||0xcc;return function(_0x535aa0){if(_0x535aa0){return _0xa691d6[_0x8aa8('0x19')](_0x28132f);}return _0xa691d6[_0x8aa8('0x1a')](_0x28132f)[_0x8aa8('0x1b')]();};}function respondWithResult(_0x4b686e,_0x391642){_0x391642=_0x391642||0xc8;return function(_0x4af534){if(_0x4af534){return _0x4b686e['status'](_0x391642)[_0x8aa8('0x1c')](_0x4af534);}};}function respondWithFilteredResult(_0x200662,_0xae81a0){return function(_0xa6c2af){if(_0xa6c2af){var _0x42a6a4=typeof _0xae81a0[_0x8aa8('0x1d')]===_0x8aa8('0x1e')&&typeof _0xae81a0[_0x8aa8('0x1f')]===_0x8aa8('0x1e');var _0x4e8ce3=_0xa6c2af['count'];var _0x2c1b9a=_0x42a6a4?0x0:_0xae81a0['offset'];var _0x557adc=_0x42a6a4?_0xa6c2af[_0x8aa8('0x20')]:_0xae81a0['offset']+_0xae81a0[_0x8aa8('0x1f')];var _0x41092b;if(_0x557adc>=_0x4e8ce3){_0x557adc=_0x4e8ce3;_0x41092b=0xc8;}else{_0x41092b=0xce;}_0x200662[_0x8aa8('0x1a')](_0x41092b);return _0x200662[_0x8aa8('0x21')]('Content-Range',_0x2c1b9a+'-'+_0x557adc+'/'+_0x4e8ce3)[_0x8aa8('0x1c')](_0xa6c2af);}return null;};}function patchUpdates(_0x36c445){return function(_0x2825fd){try{jsonpatch[_0x8aa8('0x22')](_0x2825fd,_0x36c445,!![]);}catch(_0x4c754e){return BPromise[_0x8aa8('0x23')](_0x4c754e);}return _0x2825fd['save']();};}function saveUpdates(_0x26cf63,_0x4cc455){return function(_0x1fdadd){if(_0x1fdadd){return _0x1fdadd['update'](_0x26cf63)[_0x8aa8('0x24')](function(_0x557e4e){return _0x557e4e;});}return null;};}function removeEntity(_0x65945b,_0x40adb5){return function(_0x3ca7dc){if(_0x3ca7dc){return _0x3ca7dc['destroy']()[_0x8aa8('0x24')](function(){_0x65945b[_0x8aa8('0x1a')](0xcc)[_0x8aa8('0x1b')]();});}};}function handleEntityNotFound(_0x547a7b,_0x57acd2){return function(_0x2d1508){if(!_0x2d1508){_0x547a7b[_0x8aa8('0x19')](0x194);}return _0x2d1508;};}function handleError(_0x2f91f3,_0x3a3c7a){_0x3a3c7a=_0x3a3c7a||0x1f4;return function(_0x24143e){logger['error'](_0x24143e[_0x8aa8('0x25')]);if(_0x24143e['name']){delete _0x24143e[_0x8aa8('0x26')];}_0x2f91f3[_0x8aa8('0x1a')](_0x3a3c7a)[_0x8aa8('0x27')](_0x24143e);};}exports['show']=function(_0x4c5c5c,_0x10810d){var _0x5e96c9={'raw':!![],'where':{'id':_0x4c5c5c[_0x8aa8('0x28')]['id']}},_0x385208={};_0x385208[_0x8aa8('0x29')]=_[_0x8aa8('0x2a')](db[_0x8aa8('0x2b')]['rawAttributes']);_0x385208[_0x8aa8('0x2c')]=_[_0x8aa8('0x2a')](_0x4c5c5c['query']);_0x385208[_0x8aa8('0x2d')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],_0x385208['query']);_0x5e96c9[_0x8aa8('0x2f')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],qs[_0x8aa8('0x30')](_0x4c5c5c[_0x8aa8('0x2c')][_0x8aa8('0x30')]));_0x5e96c9[_0x8aa8('0x2f')]=_0x5e96c9[_0x8aa8('0x2f')][_0x8aa8('0x31')]?_0x5e96c9[_0x8aa8('0x2f')]:_0x385208[_0x8aa8('0x29')];if(_0x4c5c5c['query']['includeAll']){_0x5e96c9[_0x8aa8('0x32')]=[{'all':!![]}];}_0x5e96c9=_[_0x8aa8('0x33')]({},_0x5e96c9,_0x4c5c5c[_0x8aa8('0x34')]);return db[_0x8aa8('0x2b')][_0x8aa8('0x35')](_0x5e96c9)[_0x8aa8('0x24')](handleEntityNotFound(_0x10810d,null))['then'](respondWithResult(_0x10810d,null))['catch'](handleError(_0x10810d,null));};exports[_0x8aa8('0x36')]=function(_0x5755b5,_0x24997c){if(_0x5755b5[_0x8aa8('0x37')]['id']){delete _0x5755b5[_0x8aa8('0x37')]['id'];}return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x5755b5[_0x8aa8('0x28')]['id']}})[_0x8aa8('0x24')](handleEntityNotFound(_0x24997c,null))['then'](saveUpdates(_0x5755b5['body'],null))[_0x8aa8('0x24')](respondWithResult(_0x24997c,null))[_0x8aa8('0x38')](handleError(_0x24997c,null));};exports['destroy']=function(_0x24eb18,_0x2e1f52){return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x24eb18['params']['id']}})['then'](handleEntityNotFound(_0x2e1f52,null))[_0x8aa8('0x24')](removeEntity(_0x2e1f52,null))['catch'](handleError(_0x2e1f52,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index eac0d9e..e76d216 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 _0x9306=['bluebird','request-promise','../../config/environment','./mailApplication.attributes','exports','MailApplication','mail_applications','utf8mb4_unicode_ci','lodash','util','moment'];(function(_0x42f3d8,_0x38d414){var _0x20ffc1=function(_0x2def54){while(--_0x2def54){_0x42f3d8['push'](_0x42f3d8['shift']());}};_0x20ffc1(++_0x38d414);}(_0x9306,0x1ec));var _0x6930=function(_0x3f7c37,_0x415a9f){_0x3f7c37=_0x3f7c37-0x0;var _0x1accd1=_0x9306[_0x3f7c37];return _0x1accd1;};'use strict';var _=require(_0x6930('0x0'));var util=require(_0x6930('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6930('0x2'));var BPromise=require(_0x6930('0x3'));var rp=require(_0x6930('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6930('0x5'));var attributes=require(_0x6930('0x6'));module[_0x6930('0x7')]=function(_0x15b0c4,_0x57b135){return _0x15b0c4['define'](_0x6930('0x8'),attributes,{'tableName':_0x6930('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6930('0xa')});}; \ No newline at end of file +var _0x8467=['request-promise','path','../../config/environment','define','mail_applications','utf8mb4','lodash','../../config/logger','bluebird'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x8467,0x1e3));var _0x7846=function(_0x50f392,_0x1d8441){_0x50f392=_0x50f392-0x0;var _0x5926f2=_0x8467[_0x50f392];return _0x5926f2;};'use strict';var _=require(_0x7846('0x0'));var util=require('util');var logger=require(_0x7846('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7846('0x2'));var rp=require(_0x7846('0x3'));var fs=require('fs');var path=require(_0x7846('0x4'));var rimraf=require('rimraf');var config=require(_0x7846('0x5'));var attributes=require('./mailApplication.attributes');module['exports']=function(_0xe9aaba,_0x482cbf){return _0xe9aaba[_0x7846('0x6')]('MailApplication',attributes,{'tableName':_0x7846('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7846('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 492a882..1b1de03 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 _0x665f=['body','options','raw','where','attributes','limit','UpdateMailApplication','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailApplication,\x20%s,\x20%s','result','catch','MailApplication','update'];(function(_0x780921,_0x7c3eef){var _0x1536c6=function(_0x5b2c11){while(--_0x5b2c11){_0x780921['push'](_0x780921['shift']());}};_0x1536c6(++_0x7c3eef);}(_0x665f,0x19a));var _0xf665=function(_0x309824,_0x150a1a){_0x309824=_0x309824-0x0;var _0x2eaa86=_0x665f[_0x309824];return _0x2eaa86;};'use strict';var _=require('lodash');var util=require(_0xf665('0x0'));var moment=require(_0xf665('0x1'));var BPromise=require('bluebird');var rs=require(_0xf665('0x2'));var fs=require('fs');var Redis=require(_0xf665('0x3'));var db=require(_0xf665('0x4'))['db'];var utils=require(_0xf665('0x5'));var logger=require('../../config/logger')(_0xf665('0x6'));var config=require(_0xf665('0x7'));var jayson=require(_0xf665('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x155d67,_0x4ad922,_0x43c05e){return new BPromise(function(_0x31535f,_0x1249e0){return client[_0xf665('0x9')](_0x155d67,_0x43c05e)[_0xf665('0xa')](function(_0x5784d5){logger[_0xf665('0xb')]('MailApplication,\x20%s,\x20%s',_0x4ad922,_0xf665('0xc'));logger[_0xf665('0xd')](_0xf665('0xe'),_0x4ad922,_0xf665('0xc'),JSON[_0xf665('0xf')](_0x5784d5));if(_0x5784d5['error']){if(_0x5784d5[_0xf665('0x10')][_0xf665('0x11')]===0x1f4){logger[_0xf665('0x10')]('MailApplication,\x20%s,\x20%s',_0x4ad922,_0x5784d5[_0xf665('0x10')][_0xf665('0x12')]);return _0x1249e0(_0x5784d5[_0xf665('0x10')]['message']);}logger[_0xf665('0x10')]('MailApplication,\x20%s,\x20%s',_0x4ad922,_0x5784d5[_0xf665('0x10')][_0xf665('0x12')]);return _0x31535f(_0x5784d5['error'][_0xf665('0x12')]);}else{logger['info'](_0xf665('0x13'),_0x4ad922,_0xf665('0xc'));_0x31535f(_0x5784d5[_0xf665('0x14')]['message']);}})[_0xf665('0x15')](function(_0x2e0786){logger[_0xf665('0x10')](_0xf665('0x13'),_0x4ad922,_0x2e0786);_0x1249e0(_0x2e0786);});});}exports['UpdateMailApplication']=function(_0x334b84){var _0x2f04c8=this;return new Promise(function(_0x36b356,_0x2543da){return db[_0xf665('0x16')][_0xf665('0x17')](_0x334b84[_0xf665('0x18')],{'raw':_0x334b84[_0xf665('0x19')]?_0x334b84['options'][_0xf665('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x334b84[_0xf665('0x19')]?_0x334b84[_0xf665('0x19')][_0xf665('0x1b')]||null:null,'attributes':_0x334b84['options']?_0x334b84[_0xf665('0x19')][_0xf665('0x1c')]||null:null,'limit':_0x334b84['options']?_0x334b84['options'][_0xf665('0x1d')]||null:null})[_0xf665('0xa')](function(_0x418801){logger['info']('UpdateMailApplication',_0x334b84);logger[_0xf665('0xd')](_0xf665('0x1e'),_0x334b84,JSON[_0xf665('0xf')](_0x418801));_0x36b356(_0x418801);})[_0xf665('0x15')](function(_0x373083){logger[_0xf665('0x10')](_0xf665('0x1e'),_0x373083[_0xf665('0x12')],_0x334b84);_0x2543da(_0x2f04c8[_0xf665('0x10')](0x1f4,_0x373083[_0xf665('0x12')]));});});}; \ No newline at end of file +var _0x8767=['MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','MailApplication,\x20%s,\x20%s','message','catch','MailApplication','update','body','options','raw','where','attributes','limit','UpdateMailApplication','debug','lodash','util','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','then','info','request\x20sent'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x8767,0x65));var _0x7876=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8767[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7876('0x0'));var util=require(_0x7876('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7876('0x2'));var db=require(_0x7876('0x3'))['db'];var utils=require(_0x7876('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x7876('0x5'));var client=jayson[_0x7876('0x6')][_0x7876('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3005df,_0x4c6c04,_0x45cc03){return new BPromise(function(_0x2e2165,_0x5d0f66){return client['request'](_0x3005df,_0x45cc03)[_0x7876('0x8')](function(_0x307d6d){logger[_0x7876('0x9')]('MailApplication,\x20%s,\x20%s',_0x4c6c04,_0x7876('0xa'));logger['debug'](_0x7876('0xb'),_0x4c6c04,_0x7876('0xa'),JSON[_0x7876('0xc')](_0x307d6d));if(_0x307d6d[_0x7876('0xd')]){if(_0x307d6d[_0x7876('0xd')][_0x7876('0xe')]===0x1f4){logger[_0x7876('0xd')](_0x7876('0xf'),_0x4c6c04,_0x307d6d[_0x7876('0xd')][_0x7876('0x10')]);return _0x5d0f66(_0x307d6d['error'][_0x7876('0x10')]);}logger[_0x7876('0xd')]('MailApplication,\x20%s,\x20%s',_0x4c6c04,_0x307d6d[_0x7876('0xd')][_0x7876('0x10')]);return _0x2e2165(_0x307d6d[_0x7876('0xd')][_0x7876('0x10')]);}else{logger['info'](_0x7876('0xf'),_0x4c6c04,_0x7876('0xa'));_0x2e2165(_0x307d6d['result'][_0x7876('0x10')]);}})[_0x7876('0x11')](function(_0x5f160e){logger[_0x7876('0xd')](_0x7876('0xf'),_0x4c6c04,_0x5f160e);_0x5d0f66(_0x5f160e);});});}exports['UpdateMailApplication']=function(_0x3e0b53){var _0x6c33be=this;return new Promise(function(_0x3e7c1f,_0x5efe69){return db[_0x7876('0x12')][_0x7876('0x13')](_0x3e0b53[_0x7876('0x14')],{'raw':_0x3e0b53[_0x7876('0x15')]?_0x3e0b53['options'][_0x7876('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e0b53[_0x7876('0x15')]?_0x3e0b53[_0x7876('0x15')][_0x7876('0x17')]||null:null,'attributes':_0x3e0b53[_0x7876('0x15')]?_0x3e0b53[_0x7876('0x15')][_0x7876('0x18')]||null:null,'limit':_0x3e0b53['options']?_0x3e0b53[_0x7876('0x15')][_0x7876('0x19')]||null:null})[_0x7876('0x8')](function(_0x2c3f74){logger['info'](_0x7876('0x1a'),_0x3e0b53);logger[_0x7876('0x1b')](_0x7876('0x1a'),_0x3e0b53,JSON['stringify'](_0x2c3f74));_0x3e7c1f(_0x2c3f74);})[_0x7876('0x11')](function(_0x6312d9){logger[_0x7876('0xd')](_0x7876('0x1a'),_0x6312d9['message'],_0x3e0b53);_0x5efe69(_0x6c33be[_0x7876('0xd')](0x1f4,_0x6312d9['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 28500ec..d3d4a35 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 _0xaffe=['/:id/tags','tracked','mail','addTags','put','mailinteraction:update','update','mailinteraction:destroy','delete','removeTags','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage'];(function(_0x178668,_0x1ec300){var _0x26107d=function(_0x4c0aa8){while(--_0x4c0aa8){_0x178668['push'](_0x178668['shift']());}};_0x26107d(++_0x1ec300);}(_0xaffe,0x14e));var _0xeaff=function(_0x1753ec,_0x3dee54){_0x1753ec=_0x1753ec-0x0;var _0x4a7871=_0xaffe[_0x1753ec];return _0x4a7871;};'use strict';var express=require(_0xeaff('0x0'));var router=express[_0xeaff('0x1')]();var auth=require(_0xeaff('0x2'));var interaction=require(_0xeaff('0x3'));var controller=require(_0xeaff('0x4'));router[_0xeaff('0x5')]('/',auth[_0xeaff('0x6')](),controller['index']);router[_0xeaff('0x5')](_0xeaff('0x7'),auth[_0xeaff('0x6')](),controller[_0xeaff('0x8')]);router['get'](_0xeaff('0x9'),auth['isAuthenticated'](),controller['show']);router['get'](_0xeaff('0xa'),auth['isAuthenticated'](),controller[_0xeaff('0xb')]);router[_0xeaff('0x5')](_0xeaff('0xc'),auth[_0xeaff('0x6')](),controller[_0xeaff('0xd')]);router[_0xeaff('0xe')]('/',auth[_0xeaff('0x6')](),controller[_0xeaff('0xf')]);router[_0xeaff('0xe')](_0xeaff('0xa'),auth[_0xeaff('0x6')](),controller[_0xeaff('0x10')]);router[_0xeaff('0xe')](_0xeaff('0x11'),auth[_0xeaff('0x6')](),interaction[_0xeaff('0x12')](_0xeaff('0x13'),'mailinteraction:addtags'),controller[_0xeaff('0x14')]);router[_0xeaff('0x15')](_0xeaff('0x9'),auth[_0xeaff('0x6')](),interaction[_0xeaff('0x12')](_0xeaff('0x13'),_0xeaff('0x16')),controller[_0xeaff('0x17')]);router['delete'](_0xeaff('0x9'),auth[_0xeaff('0x6')](),interaction[_0xeaff('0x12')](_0xeaff('0x13'),_0xeaff('0x18')),controller['destroy']);router[_0xeaff('0x19')](_0xeaff('0x11'),auth[_0xeaff('0x6')](),controller[_0xeaff('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x06ee=['index','/describe','describe','show','/:id/messages','getMessages','/:id/download','post','create','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','/:id','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x06ee,0x1d9));var _0xe06e=function(_0x169fca,_0x4cfa9c){_0x169fca=_0x169fca-0x0;var _0x10ae1a=_0x06ee[_0x169fca];return _0x10ae1a;};'use strict';var express=require(_0xe06e('0x0'));var router=express[_0xe06e('0x1')]();var auth=require(_0xe06e('0x2'));var interaction=require(_0xe06e('0x3'));var controller=require(_0xe06e('0x4'));router[_0xe06e('0x5')]('/',auth[_0xe06e('0x6')](),controller[_0xe06e('0x7')]);router[_0xe06e('0x5')](_0xe06e('0x8'),auth['isAuthenticated'](),controller[_0xe06e('0x9')]);router[_0xe06e('0x5')]('/:id',auth[_0xe06e('0x6')](),controller[_0xe06e('0xa')]);router[_0xe06e('0x5')](_0xe06e('0xb'),auth[_0xe06e('0x6')](),controller[_0xe06e('0xc')]);router[_0xe06e('0x5')](_0xe06e('0xd'),auth[_0xe06e('0x6')](),controller['download']);router[_0xe06e('0xe')]('/',auth[_0xe06e('0x6')](),controller[_0xe06e('0xf')]);router[_0xe06e('0xe')](_0xe06e('0xb'),auth['isAuthenticated'](),controller['addMessage']);router['post'](_0xe06e('0x10'),auth['isAuthenticated'](),interaction[_0xe06e('0x11')](_0xe06e('0x12'),_0xe06e('0x13')),controller[_0xe06e('0x14')]);router[_0xe06e('0x15')](_0xe06e('0x16'),auth['isAuthenticated'](),interaction['tracked'](_0xe06e('0x12'),_0xe06e('0x17')),controller[_0xe06e('0x18')]);router[_0xe06e('0x19')](_0xe06e('0x16'),auth['isAuthenticated'](),interaction[_0xe06e('0x11')](_0xe06e('0x12'),_0xe06e('0x1a')),controller[_0xe06e('0x1b')]);router[_0xe06e('0x19')]('/:id/tags',auth[_0xe06e('0x6')](),controller[_0xe06e('0x1c')]);module[_0xe06e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 1c10c12..56eea75 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 _0x8675=['STRING','long','TEXT','ENUM','out','INTEGER','iconv','BOOLEAN','DATE'];(function(_0x414065,_0x5b8fbe){var _0x410567=function(_0x2bdc0f){while(--_0x2bdc0f){_0x414065['push'](_0x414065['shift']());}};_0x410567(++_0x5b8fbe);}(_0x8675,0x165));var _0x5867=function(_0x5dfe9b,_0x318b85){_0x5dfe9b=_0x5dfe9b-0x0;var _0x3bb0f4=_0x8675[_0x5dfe9b];return _0x3bb0f4;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x5867('0x0'));module['exports']={'closed':{'type':Sequelize[_0x5867('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5867('0x2')]},'disposition':{'type':Sequelize[_0x5867('0x3')]},'secondDisposition':{'type':Sequelize[_0x5867('0x3')]},'thirdDisposition':{'type':Sequelize[_0x5867('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x5867('0x3')]},'cc':{'type':Sequelize['TEXT'](_0x5867('0x4'))},'subject':{'type':Sequelize[_0x5867('0x5')]()},'attach':{'type':Sequelize[_0x5867('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x5867('0x2')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x5867('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x5867('0x6')]('in',_0x5867('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x5867('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x5867('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x5867('0x8')]}}; \ No newline at end of file +var _0x1edb=['exports','BOOLEAN','DATE','STRING','TEXT','out','ENUM','INTEGER','iconv'];(function(_0x58d085,_0x103939){var _0x55a8a4=function(_0x167fe9){while(--_0x167fe9){_0x58d085['push'](_0x58d085['shift']());}};_0x55a8a4(++_0x103939);}(_0x1edb,0x1b8));var _0xb1ed=function(_0x123c92,_0x4af8ff){_0x123c92=_0x123c92-0x0;var _0x18c35f=_0x1edb[_0x123c92];return _0x18c35f;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xb1ed('0x0'));module[_0xb1ed('0x1')]={'closed':{'type':Sequelize[_0xb1ed('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb1ed('0x3')]},'disposition':{'type':Sequelize[_0xb1ed('0x4')]},'secondDisposition':{'type':Sequelize[_0xb1ed('0x4')]},'thirdDisposition':{'type':Sequelize[_0xb1ed('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0xb1ed('0x4')]},'cc':{'type':Sequelize[_0xb1ed('0x5')]('long')},'subject':{'type':Sequelize[_0xb1ed('0x5')]()},'attach':{'type':Sequelize[_0xb1ed('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xb1ed('0x3')]},'substatus':{'type':Sequelize[_0xb1ed('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xb1ed('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xb1ed('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xb1ed('0x7')]('in',_0xb1ed('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb1ed('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xb1ed('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 43d890e..e336c9f 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 _0x991b=['tmp','attachments','transcript-%d-%s.zip','push','Attachments','Messages','from','bcc','subject','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','decode','format','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','build','download','unlinkSync','eml-format','zip-dir','bluebird','juice','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','html-entities','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','error','stack','name','map','MailInteraction','rawAttributes','key','getOptions','findAll','mail','query','user','then','catch','show','params','model','keys','intersection','attributes','fields','includeAll','include','merge','find','create','body','destroy','describe','addMessage','ids','omit','getMessages','MailMessage','filters','order','sort','where','pick','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','length','rows','addTags','setTags','spread','Tag','color','emit','removeTags','join','root','server','files'];(function(_0x31bca0,_0x150f4f){var _0x1de0fe=function(_0x31e3c7){while(--_0x31e3c7){_0x31bca0['push'](_0x31bca0['shift']());}};_0x1de0fe(++_0x150f4f);}(_0x991b,0x83));var _0xb991=function(_0x23c394,_0x13ffae){_0x23c394=_0x23c394-0x0;var _0x59bcef=_0x991b[_0x23c394];return _0x59bcef;};'use strict';var emlformat=require(_0xb991('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb991('0x1'));var moment=require('moment');var BPromise=require(_0xb991('0x2'));var util=require('util');var path=require('path');var fs=require('fs');var _=require('lodash');var juice=require(_0xb991('0x3'));var Redis=require(_0xb991('0x4'));var interaction=require('../../components/interaction/service');var qs=require(_0xb991('0x5'));var logger=require('../../config/logger')(_0xb991('0x6'));var config=require(_0xb991('0x7'));var db=require(_0xb991('0x8'))['db'];var htmlEntities=require(_0xb991('0x9'));config[_0xb991('0xa')]=_['defaults'](config[_0xb991('0xa')],{'host':_0xb991('0xb'),'port':0x18eb});var socket=require(_0xb991('0xc'))(new Redis(config[_0xb991('0xa')]));require(_0xb991('0xd'))[_0xb991('0xe')](socket);function respondWithStatusCode(_0x2daa77,_0x9ff182){_0x9ff182=_0x9ff182||0xcc;return function(_0x111654){if(_0x111654){return _0x2daa77[_0xb991('0xf')](_0x9ff182);}return _0x2daa77[_0xb991('0x10')](_0x9ff182)[_0xb991('0x11')]();};}function respondWithResult(_0x1bd7d5,_0x201097){_0x201097=_0x201097||0xc8;return function(_0x478ad8){if(_0x478ad8){return _0x1bd7d5['status'](_0x201097)[_0xb991('0x12')](_0x478ad8);}};}function respondWithFilteredResult(_0x363a23,_0x5c43f1){return function(_0x2c77ff){if(_0x2c77ff){var _0x3f9622=typeof _0x5c43f1[_0xb991('0x13')]===_0xb991('0x14')&&typeof _0x5c43f1[_0xb991('0x15')]===_0xb991('0x14');var _0x420f29=_0x2c77ff['count'];var _0x3c8800=_0x3f9622?0x0:_0x5c43f1[_0xb991('0x13')];var _0x29c374=_0x3f9622?_0x2c77ff[_0xb991('0x16')]:_0x5c43f1[_0xb991('0x13')]+_0x5c43f1[_0xb991('0x15')];var _0x4f6dca;if(_0x29c374>=_0x420f29){_0x29c374=_0x420f29;_0x4f6dca=0xc8;}else{_0x4f6dca=0xce;}_0x363a23[_0xb991('0x10')](_0x4f6dca);return _0x363a23['set'](_0xb991('0x17'),_0x3c8800+'-'+_0x29c374+'/'+_0x420f29)[_0xb991('0x12')](_0x2c77ff);}return null;};}function saveUpdates(_0x2140f0){return function(_0x43c989){if(_0x43c989){return _0x43c989[_0xb991('0x18')](_0x2140f0)['then'](function(_0x213d93){return _0x213d93;});}return null;};}function removeEntity(_0x1b1efc){return function(_0x238c88){if(_0x238c88){return _0x238c88['destroy']()['then'](function(){_0x1b1efc[_0xb991('0x10')](0xcc)[_0xb991('0x11')]();});}};}function handleEntityNotFound(_0x1fc5ce){return function(_0x6f919e){if(!_0x6f919e){_0x1fc5ce['sendStatus'](0x194);}return _0x6f919e;};}function handleError(_0x1e6047,_0x3f6168){_0x3f6168=_0x3f6168||0x1f4;return function(_0xbabe32){logger[_0xb991('0x19')](_0xbabe32[_0xb991('0x1a')]);if(_0xbabe32[_0xb991('0x1b')]){delete _0xbabe32[_0xb991('0x1b')];}_0x1e6047[_0xb991('0x10')](_0x3f6168)['send'](_0xbabe32);};}exports['index']=function(_0x20bde2,_0x513696){var _0x14f30c={};var _0x3cd708=_[_0xb991('0x1c')](db[_0xb991('0x1d')][_0xb991('0x1e')],function(_0x5ef654){return{'name':_0x5ef654['fieldName'],'type':_0x5ef654['type'][_0xb991('0x1f')]};});_0x14f30c=qs[_0xb991('0x20')](_0x3cd708,_0x20bde2);return interaction[_0xb991('0x21')](_0xb991('0x22'),_0x20bde2[_0xb991('0x23')],_0x20bde2[_0xb991('0x24')],_0x14f30c,_0x3cd708)[_0xb991('0x25')](respondWithFilteredResult(_0x513696,_0x14f30c))[_0xb991('0x26')](handleError(_0x513696,null));};exports[_0xb991('0x27')]=function(_0x54918d,_0x16aa6a){var _0xec04d0={'raw':![],'where':{'id':_0x54918d[_0xb991('0x28')]['id']}},_0x5bbe37={};_0x5bbe37[_0xb991('0x29')]=_[_0xb991('0x2a')](db[_0xb991('0x1d')][_0xb991('0x1e')]);_0x5bbe37[_0xb991('0x23')]=_[_0xb991('0x2a')](_0x54918d[_0xb991('0x23')]);_0x5bbe37['filters']=_[_0xb991('0x2b')](_0x5bbe37[_0xb991('0x29')],_0x5bbe37[_0xb991('0x23')]);_0xec04d0[_0xb991('0x2c')]=_[_0xb991('0x2b')](_0x5bbe37['model'],qs[_0xb991('0x2d')](_0x54918d['query']['fields']));_0xec04d0[_0xb991('0x2c')]=_0xec04d0[_0xb991('0x2c')]['length']?_0xec04d0[_0xb991('0x2c')]:_0x5bbe37['model'];if(_0x54918d[_0xb991('0x23')][_0xb991('0x2e')]){_0xec04d0[_0xb991('0x2f')]=[{'all':!![]}];}_0xec04d0=_[_0xb991('0x30')]({},_0xec04d0,_0x54918d['options']);return db[_0xb991('0x1d')][_0xb991('0x31')](_0xec04d0)[_0xb991('0x25')](handleEntityNotFound(_0x16aa6a,null))[_0xb991('0x25')](respondWithResult(_0x16aa6a,null))['catch'](handleError(_0x16aa6a,null));};exports[_0xb991('0x32')]=function(_0x4b3bff,_0x89b1cc){return db[_0xb991('0x1d')][_0xb991('0x32')](_0x4b3bff[_0xb991('0x33')],{})[_0xb991('0x25')](respondWithResult(_0x89b1cc,0xc9))['catch'](handleError(_0x89b1cc,null));};exports[_0xb991('0x18')]=function(_0x1105b7,_0x193b2c){if(_0x1105b7[_0xb991('0x33')]['id']){delete _0x1105b7['body']['id'];}return db[_0xb991('0x1d')][_0xb991('0x31')]({'where':{'id':_0x1105b7[_0xb991('0x28')]['id']}})[_0xb991('0x25')](handleEntityNotFound(_0x193b2c,null))[_0xb991('0x25')](saveUpdates(_0x1105b7[_0xb991('0x33')],null))[_0xb991('0x25')](respondWithResult(_0x193b2c,null))[_0xb991('0x26')](handleError(_0x193b2c,null));};exports[_0xb991('0x34')]=function(_0x314a63,_0x498998){return db[_0xb991('0x1d')][_0xb991('0x31')]({'where':{'id':_0x314a63[_0xb991('0x28')]['id']}})[_0xb991('0x25')](handleEntityNotFound(_0x498998,null))[_0xb991('0x25')](removeEntity(_0x498998,null))[_0xb991('0x26')](handleError(_0x498998,null));};exports[_0xb991('0x35')]=function(_0x1232ec,_0x4f8d3c){return db[_0xb991('0x1d')][_0xb991('0x35')]()[_0xb991('0x25')](respondWithResult(_0x4f8d3c,null))[_0xb991('0x26')](handleError(_0x4f8d3c,null));};exports['addMessage']=function(_0x18dcc6,_0x3901e9){return db['MailMessage']['find']({'where':{'id':_0x18dcc6[_0xb991('0x28')]['id']}})['then'](handleEntityNotFound(_0x3901e9,null))[_0xb991('0x25')](function(_0x129e1f){if(_0x129e1f){return _0x129e1f[_0xb991('0x36')](_0x18dcc6[_0xb991('0x33')][_0xb991('0x37')],_[_0xb991('0x38')](_0x18dcc6[_0xb991('0x33')],[_0xb991('0x37'),'id'])||{});}})['then'](respondWithResult(_0x3901e9,null))[_0xb991('0x26')](handleError(_0x3901e9,null));};exports[_0xb991('0x39')]=function(_0x56f291,_0x5b12e1){var _0x4d8b82={'raw':![],'where':{}};var _0x2bd22f={};var _0x50e96b={'count':0x0,'rows':[]};return db[_0xb991('0x1d')]['findOne']({'where':{'id':_0x56f291[_0xb991('0x28')]['id']}})[_0xb991('0x25')](handleEntityNotFound(_0x5b12e1,null))[_0xb991('0x25')](function(_0x7d99e5){if(_0x7d99e5){_0x2bd22f['model']=_[_0xb991('0x2a')](db[_0xb991('0x3a')][_0xb991('0x1e')]);_0x2bd22f[_0xb991('0x23')]=_[_0xb991('0x2a')](_0x56f291[_0xb991('0x23')]);_0x2bd22f[_0xb991('0x3b')]=_[_0xb991('0x2b')](_0x2bd22f[_0xb991('0x29')],_0x2bd22f['query']);_0x4d8b82[_0xb991('0x2c')]=_['intersection'](_0x2bd22f['model'],qs['fields'](_0x56f291[_0xb991('0x23')][_0xb991('0x2d')]));_0x4d8b82[_0xb991('0x2c')]=_0x4d8b82[_0xb991('0x2c')]['length']?_0x4d8b82[_0xb991('0x2c')]:_0x2bd22f['model'];if(!_0x56f291[_0xb991('0x23')]['hasOwnProperty']('nolimit')){_0x4d8b82[_0xb991('0x15')]=qs[_0xb991('0x15')](_0x56f291[_0xb991('0x23')][_0xb991('0x15')]);_0x4d8b82[_0xb991('0x13')]=qs[_0xb991('0x13')](_0x56f291[_0xb991('0x23')][_0xb991('0x13')]);}_0x4d8b82[_0xb991('0x3c')]=qs[_0xb991('0x3d')](_0x56f291['query']['sort']);_0x4d8b82[_0xb991('0x3e')]=qs[_0xb991('0x3b')](_[_0xb991('0x3f')](_0x56f291[_0xb991('0x23')],_0x2bd22f[_0xb991('0x3b')]));_0x4d8b82[_0xb991('0x3e')]['MailInteractionId']=_0x7d99e5['id'];if(_0x56f291['query']['filter']){_0x4d8b82[_0xb991('0x3e')]=_['merge'](_0x4d8b82[_0xb991('0x3e')],{'$or':_['map'](_0x4d8b82[_0xb991('0x2c')],function(_0x5b48cf){var _0x444532={};_0x444532[_0x5b48cf]={'$like':'%'+_0x56f291[_0xb991('0x23')][_0xb991('0x40')]+'%'};return _0x444532;})});}if(_0x56f291[_0xb991('0x23')][_0xb991('0x41')]){var _0x56d5f3=_0x56f291['query'][_0xb991('0x41')][_0xb991('0x42')](',');var _0x49faf4={};_0x49faf4[_0x56d5f3[0x0]]={'$gte':moment(_0x56d5f3[0x1])['format'](_0xb991('0x43'))};_0x4d8b82[_0xb991('0x3e')]=_[_0xb991('0x30')](_0x4d8b82[_0xb991('0x3e')],_0x49faf4);}_0x4d8b82=_[_0xb991('0x30')]({},_0x4d8b82,_0x56f291['options']);return db[_0xb991('0x3a')][_0xb991('0x16')]({'where':_0x4d8b82['where']})['then'](function(_0x1d0725){_0x50e96b[_0xb991('0x16')]=_0x1d0725;if(_0x56f291[_0xb991('0x23')]['includeAll']){_0x4d8b82['include']=[{'all':!![]}];}return db[_0xb991('0x3a')]['findAll'](_0x4d8b82);})[_0xb991('0x25')](function(_0x495d55){if(_0x56f291[_0xb991('0x23')][_0xb991('0x44')]===_0xb991('0x45')){for(var _0x2226ff=0x0;_0x2226ff<_0x495d55[_0xb991('0x46')];_0x2226ff++){_0x495d55[_0x2226ff][_0xb991('0x33')]=juice(_0x495d55[_0x2226ff][_0xb991('0x33')]);}}_0x50e96b[_0xb991('0x47')]=_0x495d55;return _0x50e96b;});}})[_0xb991('0x25')](respondWithFilteredResult(_0x5b12e1,_0x4d8b82))[_0xb991('0x26')](handleError(_0x5b12e1,null));};exports[_0xb991('0x48')]=function(_0xeb271e,_0x2799ef){return db[_0xb991('0x1d')][_0xb991('0x31')]({'where':{'id':_0xeb271e[_0xb991('0x28')]['id']}})['then'](handleEntityNotFound(_0x2799ef,null))[_0xb991('0x25')](function(_0x203eea){if(_0x203eea){return _0x203eea[_0xb991('0x49')](_0xeb271e['body'][_0xb991('0x37')],_['omit'](_0xeb271e[_0xb991('0x33')],[_0xb991('0x37'),'id'])||{})[_0xb991('0x4a')](function(){return db[_0xb991('0x4b')][_0xb991('0x21')]({'attributes':['id',_0xb991('0x1b'),_0xb991('0x4c')],'where':{'id':_0xeb271e[_0xb991('0x33')]['ids']}});})[_0xb991('0x25')](function(_0x2e7ddf){socket[_0xb991('0x4d')]('mailInteractionTags:save',{'id':Number(_0xeb271e['params']['id']),'tags':_0x2e7ddf||[]});return{'id':Number(_0xeb271e[_0xb991('0x28')]['id']),'tags':_0x2e7ddf||[]};});}})[_0xb991('0x25')](respondWithResult(_0x2799ef,null))[_0xb991('0x26')](handleError(_0x2799ef,null));};exports[_0xb991('0x4e')]=function(_0x4c05a0,_0x316b67){return db[_0xb991('0x1d')][_0xb991('0x31')]({'where':{'id':_0x4c05a0[_0xb991('0x28')]['id']}})['then'](handleEntityNotFound(_0x316b67,null))[_0xb991('0x25')](function(_0x4421d2){if(_0x4421d2){return _0x4421d2[_0xb991('0x4e')](_0x4c05a0[_0xb991('0x23')]['ids']);}})[_0xb991('0x25')](respondWithStatusCode(_0x316b67,null))[_0xb991('0x26')](handleError(_0x316b67,null));};exports['download']=function(_0x536edf,_0x18542f){var _0x532ccf=moment()['unix']()['toString']();var _0x5710ec=path[_0xb991('0x4f')](config[_0xb991('0x50')],_0xb991('0x51'),_0xb991('0x52'),_0xb991('0x53'));var _0x38b483=path[_0xb991('0x4f')](config[_0xb991('0x50')],_0xb991('0x51'),'files',_0xb991('0x54'));var _0x57c23f=path[_0xb991('0x4f')](_0x5710ec,_0x532ccf);var _0x5447f6=util['format'](_0xb991('0x55'),_0x536edf[_0xb991('0x28')]['id'],_0x532ccf);var _0x1cbfa5=path[_0xb991('0x4f')](_0x5710ec,_0x5447f6);var _0x5b8dbf=[];if(_0x536edf[_0xb991('0x23')]['attachments']){_0x5b8dbf[_0xb991('0x56')]({'model':db['Attachment'],'as':_0xb991('0x57'),'raw':!![]});}var _0x18969b=[{'model':db['MailMessage'],'as':_0xb991('0x58'),'attributes':['id',_0xb991('0x33'),_0xb991('0x59'),'to','cc',_0xb991('0x5a'),_0xb991('0x5b'),_0xb991('0x5c')],'where':{'secret':![]},'order':qs[_0xb991('0x3d')]('id'),'include':_0x5b8dbf}];return db[_0xb991('0x1d')]['find']({'where':{'id':_0x536edf['params']['id']},'include':_0x18969b})[_0xb991('0x25')](handleEntityNotFound(_0x18542f,null))[_0xb991('0x25')](function(_0x24536b){if(_0x24536b&&_0x24536b[_0xb991('0x58')]){var _0x2ee40a=_0x24536b[_0xb991('0x5d')]({'plain':!![]});fs[_0xb991('0x5e')](_0x57c23f);return BPromise[_0xb991('0x5f')](_0x2ee40a[_0xb991('0x58')],function(_0x291bb8,_0xa1fa58){var _0x2d9bf0={'from':_0x291bb8[_0xb991('0x59')],'to':_0x291bb8['to']||_0xb991('0x60'),'subject':_0x291bb8[_0xb991('0x5b')],'html':htmlEntities[_0xb991('0x61')](_0x291bb8[_0xb991('0x33')]),'headers':{'Date':moment(_0x291bb8[_0xb991('0x5c')])[_0xb991('0x62')](_0xb991('0x63'))},'attachments':[]};if(_0x291bb8['cc']){_0x2d9bf0[_0xb991('0x64')]['Cc']=_0x291bb8['cc'];}if(_0x291bb8[_0xb991('0x5a')]){_0x2d9bf0[_0xb991('0x64')][_0xb991('0x65')]=_0x291bb8[_0xb991('0x5a')];}return new BPromise(function(_0x255f97,_0x547d6c){if(_0x291bb8[_0xb991('0x57')]){for(var _0x29ab07=0x0;_0x29ab07<_0x291bb8[_0xb991('0x57')][_0xb991('0x46')];_0x29ab07++){var _0x9fff2b=_0x291bb8[_0xb991('0x57')][_0x29ab07];var _0x485c7f=path['join'](_0x38b483,_0x9fff2b['basename']);if(fs[_0xb991('0x66')](_0x485c7f)){_0x2d9bf0['attachments'][_0xb991('0x56')]({'name':_0x9fff2b['name'],'contentType':_0x9fff2b['type'],'data':fs[_0xb991('0x67')](_0x485c7f)});}}}emlformat[_0xb991('0x68')](_0x2d9bf0,function(_0x4ecf89,_0x4558d0){if(_0x4ecf89)return _0x547d6c(_0x4ecf89);fs['writeFileSync'](path['join'](_0x57c23f,util[_0xb991('0x62')]('message%d.eml',_0xa1fa58)),_0x4558d0);return _0x255f97(_0x4558d0);});});})['then'](function(){return new BPromise(function(_0x44f00c,_0x16718a){zipdir(_0x57c23f,{'saveTo':_0x1cbfa5},function(_0x23c54d,_0x886620){if(_0x23c54d)return _0x16718a(_0x23c54d);return _0x44f00c(_0x886620);});})[_0xb991('0x25')](function(){return new BPromise(function(_0x5ce4cf,_0x218b0a){rimraf(_0x57c23f,function(_0x15db8b){if(_0x15db8b)_0x218b0a(_0x15db8b);return _0x5ce4cf();});});})[_0xb991('0x25')](function(){return _0x18542f[_0xb991('0x69')](_0x1cbfa5,_0x5447f6,function(_0x4c7543){if(!_0x4c7543)fs[_0xb991('0x6a')](_0x1cbfa5);});});});}else{return _0x18542f[_0xb991('0xf')](0xc8);}})[_0xb991('0x26')](handleError(_0x18542f,null));}; \ No newline at end of file +var _0x6e91=['split','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','setTags','spread','Tag','color','emit','removeTags','unix','toString','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','Attachment','Messages','from','bcc','subject','createdAt','get','each','missing.recipient@your.company.com','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','basename','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','zip-dir','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','html-entities','defaults','redis','localhost','socket.io-emitter','register','status','end','json','undefined','count','offset','limit','Content-Range','then','destroy','sendStatus','error','stack','name','send','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','mail','query','user','catch','show','model','keys','intersection','attributes','fields','includeAll','include','merge','options','find','create','update','body','params','describe','addMessage','MailMessage','ids','omit','getMessages','filters','length','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','$gte'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x6e91,0x17a));var _0x16e9=function(_0x382a3c,_0x4dc29f){_0x382a3c=_0x382a3c-0x0;var _0x5e0789=_0x6e91[_0x382a3c];return _0x5e0789;};'use strict';var emlformat=require(_0x16e9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x16e9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x16e9('0x2'));var path=require(_0x16e9('0x3'));var fs=require('fs');var _=require(_0x16e9('0x4'));var juice=require('juice');var Redis=require(_0x16e9('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0x16e9('0x6'));var logger=require(_0x16e9('0x7'))(_0x16e9('0x8'));var config=require('../../config/environment');var db=require(_0x16e9('0x9'))['db'];var htmlEntities=require(_0x16e9('0xa'));config['redis']=_[_0x16e9('0xb')](config[_0x16e9('0xc')],{'host':_0x16e9('0xd'),'port':0x18eb});var socket=require(_0x16e9('0xe'))(new Redis(config[_0x16e9('0xc')]));require('./mailInteraction.socket')[_0x16e9('0xf')](socket);function respondWithStatusCode(_0x131714,_0x2b7c70){_0x2b7c70=_0x2b7c70||0xcc;return function(_0x533c62){if(_0x533c62){return _0x131714['sendStatus'](_0x2b7c70);}return _0x131714[_0x16e9('0x10')](_0x2b7c70)[_0x16e9('0x11')]();};}function respondWithResult(_0xc83cc0,_0x1e7f12){_0x1e7f12=_0x1e7f12||0xc8;return function(_0x4dea69){if(_0x4dea69){return _0xc83cc0['status'](_0x1e7f12)[_0x16e9('0x12')](_0x4dea69);}};}function respondWithFilteredResult(_0xa1fa16,_0x29c602){return function(_0x4ebd2b){if(_0x4ebd2b){var _0x1323e4=typeof _0x29c602['offset']===_0x16e9('0x13')&&typeof _0x29c602['limit']===_0x16e9('0x13');var _0x4f010d=_0x4ebd2b[_0x16e9('0x14')];var _0x5ac0b7=_0x1323e4?0x0:_0x29c602[_0x16e9('0x15')];var _0x24d6b1=_0x1323e4?_0x4ebd2b[_0x16e9('0x14')]:_0x29c602['offset']+_0x29c602[_0x16e9('0x16')];var _0x164706;if(_0x24d6b1>=_0x4f010d){_0x24d6b1=_0x4f010d;_0x164706=0xc8;}else{_0x164706=0xce;}_0xa1fa16[_0x16e9('0x10')](_0x164706);return _0xa1fa16['set'](_0x16e9('0x17'),_0x5ac0b7+'-'+_0x24d6b1+'/'+_0x4f010d)[_0x16e9('0x12')](_0x4ebd2b);}return null;};}function saveUpdates(_0x8a60a5){return function(_0x56867b){if(_0x56867b){return _0x56867b['update'](_0x8a60a5)[_0x16e9('0x18')](function(_0x39c7b6){return _0x39c7b6;});}return null;};}function removeEntity(_0x156ed5){return function(_0x425eff){if(_0x425eff){return _0x425eff[_0x16e9('0x19')]()['then'](function(){_0x156ed5[_0x16e9('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28ed54){return function(_0x546fc7){if(!_0x546fc7){_0x28ed54[_0x16e9('0x1a')](0x194);}return _0x546fc7;};}function handleError(_0x4703d1,_0x201948){_0x201948=_0x201948||0x1f4;return function(_0x37aaa1){logger[_0x16e9('0x1b')](_0x37aaa1[_0x16e9('0x1c')]);if(_0x37aaa1[_0x16e9('0x1d')]){delete _0x37aaa1['name'];}_0x4703d1[_0x16e9('0x10')](_0x201948)[_0x16e9('0x1e')](_0x37aaa1);};}exports['index']=function(_0x253990,_0x53bb4c){var _0x52e36c={};var _0x10c837=_[_0x16e9('0x1f')](db[_0x16e9('0x20')][_0x16e9('0x21')],function(_0xda86b7){return{'name':_0xda86b7[_0x16e9('0x22')],'type':_0xda86b7[_0x16e9('0x23')][_0x16e9('0x24')]};});_0x52e36c=qs[_0x16e9('0x25')](_0x10c837,_0x253990);return interaction['findAll'](_0x16e9('0x26'),_0x253990[_0x16e9('0x27')],_0x253990[_0x16e9('0x28')],_0x52e36c,_0x10c837)[_0x16e9('0x18')](respondWithFilteredResult(_0x53bb4c,_0x52e36c))[_0x16e9('0x29')](handleError(_0x53bb4c,null));};exports[_0x16e9('0x2a')]=function(_0x2821e3,_0xf3108e){var _0x47b2e2={'raw':![],'where':{'id':_0x2821e3['params']['id']}},_0x334d42={};_0x334d42[_0x16e9('0x2b')]=_[_0x16e9('0x2c')](db[_0x16e9('0x20')][_0x16e9('0x21')]);_0x334d42[_0x16e9('0x27')]=_['keys'](_0x2821e3[_0x16e9('0x27')]);_0x334d42['filters']=_[_0x16e9('0x2d')](_0x334d42[_0x16e9('0x2b')],_0x334d42[_0x16e9('0x27')]);_0x47b2e2[_0x16e9('0x2e')]=_[_0x16e9('0x2d')](_0x334d42['model'],qs['fields'](_0x2821e3['query'][_0x16e9('0x2f')]));_0x47b2e2[_0x16e9('0x2e')]=_0x47b2e2[_0x16e9('0x2e')]['length']?_0x47b2e2[_0x16e9('0x2e')]:_0x334d42[_0x16e9('0x2b')];if(_0x2821e3[_0x16e9('0x27')][_0x16e9('0x30')]){_0x47b2e2[_0x16e9('0x31')]=[{'all':!![]}];}_0x47b2e2=_[_0x16e9('0x32')]({},_0x47b2e2,_0x2821e3[_0x16e9('0x33')]);return db['MailInteraction'][_0x16e9('0x34')](_0x47b2e2)['then'](handleEntityNotFound(_0xf3108e,null))['then'](respondWithResult(_0xf3108e,null))[_0x16e9('0x29')](handleError(_0xf3108e,null));};exports[_0x16e9('0x35')]=function(_0x345b21,_0x5ce610){return db[_0x16e9('0x20')][_0x16e9('0x35')](_0x345b21['body'],{})[_0x16e9('0x18')](respondWithResult(_0x5ce610,0xc9))[_0x16e9('0x29')](handleError(_0x5ce610,null));};exports[_0x16e9('0x36')]=function(_0x4eac24,_0x43a0f5){if(_0x4eac24[_0x16e9('0x37')]['id']){delete _0x4eac24[_0x16e9('0x37')]['id'];}return db['MailInteraction'][_0x16e9('0x34')]({'where':{'id':_0x4eac24[_0x16e9('0x38')]['id']}})[_0x16e9('0x18')](handleEntityNotFound(_0x43a0f5,null))[_0x16e9('0x18')](saveUpdates(_0x4eac24['body'],null))[_0x16e9('0x18')](respondWithResult(_0x43a0f5,null))[_0x16e9('0x29')](handleError(_0x43a0f5,null));};exports[_0x16e9('0x19')]=function(_0x5d931e,_0x58f88d){return db[_0x16e9('0x20')][_0x16e9('0x34')]({'where':{'id':_0x5d931e['params']['id']}})[_0x16e9('0x18')](handleEntityNotFound(_0x58f88d,null))['then'](removeEntity(_0x58f88d,null))['catch'](handleError(_0x58f88d,null));};exports[_0x16e9('0x39')]=function(_0x1a3101,_0x54585a){return db[_0x16e9('0x20')][_0x16e9('0x39')]()[_0x16e9('0x18')](respondWithResult(_0x54585a,null))[_0x16e9('0x29')](handleError(_0x54585a,null));};exports[_0x16e9('0x3a')]=function(_0x409f05,_0x54fe22){return db[_0x16e9('0x3b')][_0x16e9('0x34')]({'where':{'id':_0x409f05[_0x16e9('0x38')]['id']}})[_0x16e9('0x18')](handleEntityNotFound(_0x54fe22,null))[_0x16e9('0x18')](function(_0x4eb9bb){if(_0x4eb9bb){return _0x4eb9bb['addMessage'](_0x409f05['body'][_0x16e9('0x3c')],_[_0x16e9('0x3d')](_0x409f05[_0x16e9('0x37')],[_0x16e9('0x3c'),'id'])||{});}})[_0x16e9('0x18')](respondWithResult(_0x54fe22,null))[_0x16e9('0x29')](handleError(_0x54fe22,null));};exports[_0x16e9('0x3e')]=function(_0x16d797,_0x2d24d6){var _0x5e79d6={'raw':![],'where':{}};var _0x2ac86e={};var _0x33dffe={'count':0x0,'rows':[]};return db[_0x16e9('0x20')]['findOne']({'where':{'id':_0x16d797[_0x16e9('0x38')]['id']}})[_0x16e9('0x18')](handleEntityNotFound(_0x2d24d6,null))[_0x16e9('0x18')](function(_0x2b99a4){if(_0x2b99a4){_0x2ac86e[_0x16e9('0x2b')]=_[_0x16e9('0x2c')](db[_0x16e9('0x3b')][_0x16e9('0x21')]);_0x2ac86e[_0x16e9('0x27')]=_['keys'](_0x16d797[_0x16e9('0x27')]);_0x2ac86e[_0x16e9('0x3f')]=_['intersection'](_0x2ac86e[_0x16e9('0x2b')],_0x2ac86e[_0x16e9('0x27')]);_0x5e79d6[_0x16e9('0x2e')]=_[_0x16e9('0x2d')](_0x2ac86e[_0x16e9('0x2b')],qs[_0x16e9('0x2f')](_0x16d797[_0x16e9('0x27')][_0x16e9('0x2f')]));_0x5e79d6['attributes']=_0x5e79d6[_0x16e9('0x2e')][_0x16e9('0x40')]?_0x5e79d6[_0x16e9('0x2e')]:_0x2ac86e[_0x16e9('0x2b')];if(!_0x16d797[_0x16e9('0x27')][_0x16e9('0x41')](_0x16e9('0x42'))){_0x5e79d6['limit']=qs[_0x16e9('0x16')](_0x16d797[_0x16e9('0x27')][_0x16e9('0x16')]);_0x5e79d6['offset']=qs[_0x16e9('0x15')](_0x16d797[_0x16e9('0x27')][_0x16e9('0x15')]);}_0x5e79d6[_0x16e9('0x43')]=qs['sort'](_0x16d797['query'][_0x16e9('0x44')]);_0x5e79d6[_0x16e9('0x45')]=qs['filters'](_[_0x16e9('0x46')](_0x16d797[_0x16e9('0x27')],_0x2ac86e[_0x16e9('0x3f')]));_0x5e79d6[_0x16e9('0x45')][_0x16e9('0x47')]=_0x2b99a4['id'];if(_0x16d797['query'][_0x16e9('0x48')]){_0x5e79d6['where']=_[_0x16e9('0x32')](_0x5e79d6[_0x16e9('0x45')],{'$or':_[_0x16e9('0x1f')](_0x5e79d6[_0x16e9('0x2e')],function(_0x4483b0){var _0x56f801={};_0x56f801[_0x4483b0]={'$like':'%'+_0x16d797[_0x16e9('0x27')]['filter']+'%'};return _0x56f801;})});}if(_0x16d797['query']['$gte']){var _0xc83070=_0x16d797[_0x16e9('0x27')][_0x16e9('0x49')][_0x16e9('0x4a')](',');var _0x275e56={};_0x275e56[_0xc83070[0x0]]={'$gte':moment(_0xc83070[0x1])['format'](_0x16e9('0x4b'))};_0x5e79d6[_0x16e9('0x45')]=_[_0x16e9('0x32')](_0x5e79d6[_0x16e9('0x45')],_0x275e56);}_0x5e79d6=_[_0x16e9('0x32')]({},_0x5e79d6,_0x16d797[_0x16e9('0x33')]);return db['MailMessage'][_0x16e9('0x14')]({'where':_0x5e79d6[_0x16e9('0x45')]})[_0x16e9('0x18')](function(_0x16413c){_0x33dffe['count']=_0x16413c;if(_0x16d797[_0x16e9('0x27')][_0x16e9('0x30')]){_0x5e79d6['include']=[{'all':!![]}];}return db[_0x16e9('0x3b')][_0x16e9('0x4c')](_0x5e79d6);})[_0x16e9('0x18')](function(_0x5165d6){if(_0x16d797[_0x16e9('0x27')][_0x16e9('0x4d')]===_0x16e9('0x4e')){for(var _0x52d52d=0x0;_0x52d52d<_0x5165d6[_0x16e9('0x40')];_0x52d52d++){_0x5165d6[_0x52d52d]['body']=juice(_0x5165d6[_0x52d52d][_0x16e9('0x37')]);}}_0x33dffe['rows']=_0x5165d6;return _0x33dffe;});}})['then'](respondWithFilteredResult(_0x2d24d6,_0x5e79d6))['catch'](handleError(_0x2d24d6,null));};exports['addTags']=function(_0xe897a5,_0x8bb339){return db[_0x16e9('0x20')]['find']({'where':{'id':_0xe897a5[_0x16e9('0x38')]['id']}})[_0x16e9('0x18')](handleEntityNotFound(_0x8bb339,null))['then'](function(_0x1650ca){if(_0x1650ca){return _0x1650ca[_0x16e9('0x4f')](_0xe897a5[_0x16e9('0x37')][_0x16e9('0x3c')],_['omit'](_0xe897a5[_0x16e9('0x37')],[_0x16e9('0x3c'),'id'])||{})[_0x16e9('0x50')](function(){return db[_0x16e9('0x51')][_0x16e9('0x4c')]({'attributes':['id',_0x16e9('0x1d'),_0x16e9('0x52')],'where':{'id':_0xe897a5['body'][_0x16e9('0x3c')]}});})['then'](function(_0x5dc04c){socket[_0x16e9('0x53')]('mailInteractionTags:save',{'id':Number(_0xe897a5[_0x16e9('0x38')]['id']),'tags':_0x5dc04c||[]});return{'id':Number(_0xe897a5[_0x16e9('0x38')]['id']),'tags':_0x5dc04c||[]};});}})[_0x16e9('0x18')](respondWithResult(_0x8bb339,null))['catch'](handleError(_0x8bb339,null));};exports[_0x16e9('0x54')]=function(_0x2ea06f,_0x58ba87){return db['MailInteraction']['find']({'where':{'id':_0x2ea06f['params']['id']}})[_0x16e9('0x18')](handleEntityNotFound(_0x58ba87,null))[_0x16e9('0x18')](function(_0x366765){if(_0x366765){return _0x366765[_0x16e9('0x54')](_0x2ea06f[_0x16e9('0x27')][_0x16e9('0x3c')]);}})[_0x16e9('0x18')](respondWithStatusCode(_0x58ba87,null))[_0x16e9('0x29')](handleError(_0x58ba87,null));};exports['download']=function(_0x1983b6,_0xc69830){var _0x14adc8=moment()[_0x16e9('0x55')]()[_0x16e9('0x56')]();var _0x2bbb4e=path[_0x16e9('0x57')](config[_0x16e9('0x58')],_0x16e9('0x59'),_0x16e9('0x5a'),_0x16e9('0x5b'));var _0x21084b=path[_0x16e9('0x57')](config[_0x16e9('0x58')],_0x16e9('0x59'),_0x16e9('0x5a'),_0x16e9('0x5c'));var _0xe1d662=path[_0x16e9('0x57')](_0x2bbb4e,_0x14adc8);var _0x9bab2f=util[_0x16e9('0x5d')](_0x16e9('0x5e'),_0x1983b6[_0x16e9('0x38')]['id'],_0x14adc8);var _0x389dca=path['join'](_0x2bbb4e,_0x9bab2f);var _0x507d97=[];if(_0x1983b6['query'][_0x16e9('0x5c')]){_0x507d97['push']({'model':db[_0x16e9('0x5f')],'as':'Attachments','raw':!![]});}var _0x50de63=[{'model':db[_0x16e9('0x3b')],'as':_0x16e9('0x60'),'attributes':['id',_0x16e9('0x37'),_0x16e9('0x61'),'to','cc',_0x16e9('0x62'),_0x16e9('0x63'),_0x16e9('0x64')],'where':{'secret':![]},'order':qs[_0x16e9('0x44')]('id'),'include':_0x507d97}];return db[_0x16e9('0x20')][_0x16e9('0x34')]({'where':{'id':_0x1983b6[_0x16e9('0x38')]['id']},'include':_0x50de63})[_0x16e9('0x18')](handleEntityNotFound(_0xc69830,null))[_0x16e9('0x18')](function(_0x3bd208){if(_0x3bd208&&_0x3bd208[_0x16e9('0x60')]){var _0x4f06a7=_0x3bd208[_0x16e9('0x65')]({'plain':!![]});fs['mkdirSync'](_0xe1d662);return BPromise[_0x16e9('0x66')](_0x4f06a7['Messages'],function(_0x50ba5a,_0x245df8){var _0x20f3c3={'from':_0x50ba5a[_0x16e9('0x61')],'to':_0x50ba5a['to']||_0x16e9('0x67'),'subject':_0x50ba5a[_0x16e9('0x63')],'html':htmlEntities['decode'](_0x50ba5a[_0x16e9('0x37')]),'headers':{'Date':moment(_0x50ba5a[_0x16e9('0x64')])[_0x16e9('0x5d')](_0x16e9('0x68'))},'attachments':[]};if(_0x50ba5a['cc']){_0x20f3c3['headers']['Cc']=_0x50ba5a['cc'];}if(_0x50ba5a['bcc']){_0x20f3c3[_0x16e9('0x69')]['Bcc']=_0x50ba5a['bcc'];}return new BPromise(function(_0x357679,_0x14ff9c){if(_0x50ba5a[_0x16e9('0x6a')]){for(var _0x4b48c7=0x0;_0x4b48c7<_0x50ba5a[_0x16e9('0x6a')][_0x16e9('0x40')];_0x4b48c7++){var _0x1cb7c7=_0x50ba5a[_0x16e9('0x6a')][_0x4b48c7];var _0x100842=path[_0x16e9('0x57')](_0x21084b,_0x1cb7c7[_0x16e9('0x6b')]);if(fs['existsSync'](_0x100842)){_0x20f3c3['attachments']['push']({'name':_0x1cb7c7[_0x16e9('0x1d')],'contentType':_0x1cb7c7[_0x16e9('0x23')],'data':fs[_0x16e9('0x6c')](_0x100842)});}}}emlformat[_0x16e9('0x6d')](_0x20f3c3,function(_0x575bd2,_0x59ab7e){if(_0x575bd2)return _0x14ff9c(_0x575bd2);fs[_0x16e9('0x6e')](path[_0x16e9('0x57')](_0xe1d662,util[_0x16e9('0x5d')](_0x16e9('0x6f'),_0x245df8)),_0x59ab7e);return _0x357679(_0x59ab7e);});});})['then'](function(){return new BPromise(function(_0x448b00,_0x5a8624){zipdir(_0xe1d662,{'saveTo':_0x389dca},function(_0x4506a2,_0x375f50){if(_0x4506a2)return _0x5a8624(_0x4506a2);return _0x448b00(_0x375f50);});})[_0x16e9('0x18')](function(){return new BPromise(function(_0x45233c,_0x4538df){rimraf(_0xe1d662,function(_0x2e0f0e){if(_0x2e0f0e)_0x4538df(_0x2e0f0e);return _0x45233c();});});})[_0x16e9('0x18')](function(){return _0xc69830['download'](_0x389dca,_0x9bab2f,function(_0x429bf6){if(!_0x429bf6)fs[_0x16e9('0x70')](_0x389dca);});});});}else{return _0xc69830['sendStatus'](0xc8);}})[_0x16e9('0x29')](handleError(_0xc69830,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 92428af..9e5d32e 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 _0xd581=['update','remove','getUsers','then','setDataValue','findAll','length','emit','hasOwnProperty','exports','MailInteraction','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd581,0x99));var _0x1d58=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xd581[_0x45d55e];return _0x29812a;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db'][_0x1d58('0x0')];var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x1d58('0x1')](0x0);var events={'afterCreate':_0x1d58('0x2'),'afterUpdate':_0x1d58('0x3'),'afterDestroy':_0x1d58('0x4')};function emitEvent(_0x409835){return function(_0x4759d3,_0x59d4b6,_0x5175d4){_0x4759d3[_0x1d58('0x5')]({'attributes':['id'],'raw':!![]})[_0x1d58('0x6')](function(_0x71d58d){_0x4759d3[_0x1d58('0x7')]('Users',_0x71d58d['map'](function(_0x2cfa66){return{'id':_0x2cfa66['id']};}));return MailMessage[_0x1d58('0x8')]({'where':{'MailInteractionId':_0x4759d3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1d58('0x6')](function(_0x2d2668){_0x4759d3[_0x1d58('0x7')]('unreadMessages',_0x2d2668[_0x1d58('0x9')]);MailInteractionEvents['emit'](_0x409835+':'+_0x4759d3['id'],_0x4759d3);MailInteractionEvents[_0x1d58('0xa')](_0x409835,_0x4759d3);_0x5175d4(null);})['catch'](_0x5175d4(null));};}for(var e in events){if(events[_0x1d58('0xb')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x1d58('0xc')]=MailInteractionEvents; \ No newline at end of file +var _0x0152=['save','remove','getUsers','then','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','MailInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0152,0x1cf));var _0x2015=function(_0x32ffca,_0x458df0){_0x32ffca=_0x32ffca-0x0;var _0x138a7f=_0x0152[_0x32ffca];return _0x138a7f;};'use strict';var EventEmitter=require(_0x2015('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x2015('0x1')];var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2015('0x2'),'afterUpdate':'update','afterDestroy':_0x2015('0x3')};function emitEvent(_0x1208d5){return function(_0x1b4ed3,_0x6f6c05,_0x56554b){_0x1b4ed3[_0x2015('0x4')]({'attributes':['id'],'raw':!![]})[_0x2015('0x5')](function(_0x4d68d3){_0x1b4ed3['setDataValue'](_0x2015('0x6'),_0x4d68d3[_0x2015('0x7')](function(_0x587566){return{'id':_0x587566['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x1b4ed3['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3dbc97){_0x1b4ed3['setDataValue'](_0x2015('0x8'),_0x3dbc97[_0x2015('0x9')]);MailInteractionEvents['emit'](_0x1208d5+':'+_0x1b4ed3['id'],_0x1b4ed3);MailInteractionEvents[_0x2015('0xa')](_0x1208d5,_0x1b4ed3);_0x56554b(null);})[_0x2015('0xb')](_0x56554b(null));};}for(var e in events){if(events[_0x2015('0xc')](e)){var event=events[e];MailInteraction[_0x2015('0xd')](e,emitEvent(event));}}module[_0x2015('0xe')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 9c76153..0ee978c 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 _0x73e9=['exports','define','MailInteraction','mail_interactions','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','get','update','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x18f152,_0x41585a){var _0xa10b34=function(_0x1e9798){while(--_0x1e9798){_0x18f152['push'](_0x18f152['shift']());}};_0xa10b34(++_0x41585a);}(_0x73e9,0x1ae));var _0x973e=function(_0x423e15,_0x12b2b2){_0x423e15=_0x423e15-0x0;var _0x184279=_0x73e9[_0x423e15];return _0x184279;};'use strict';var _=require(_0x973e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x973e('0x1'));var moment=require(_0x973e('0x2'));var BPromise=require(_0x973e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x973e('0x4'));var rimraf=require(_0x973e('0x5'));var config=require(_0x973e('0x6'));var attributes=require('./mailInteraction.attributes');module[_0x973e('0x7')]=function(_0x5f78a,_0x59a193){return _0x5f78a[_0x973e('0x8')](_0x973e('0x9'),attributes,{'tableName':_0x973e('0xa'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':['subject','to'],'type':_0x973e('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1c9668,_0x2dfc5c,_0x64a12b){if(_0x1c9668[_0x973e('0xc')]){_0x1c9668[_0x973e('0xd')]=moment()[_0x973e('0xe')](_0x973e('0xf'));}if(_0x1c9668[_0x973e('0x10')]){_0x1c9668[_0x973e('0x11')]=moment()[_0x973e('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x64a12b(null,_0x2dfc5c);},'beforeUpdate':function(_0x4dd69a,_0x3a1e8a,_0x40acd7){if(_0x4dd69a['changed']('substatus')){_0x4dd69a[_0x973e('0xd')]=_0x4dd69a[_0x973e('0xc')]?moment()[_0x973e('0xe')](_0x973e('0xf')):null;}if(_0x4dd69a[_0x973e('0x12')]('closed')){_0x4dd69a[_0x973e('0x11')]=moment()[_0x973e('0xe')](_0x973e('0xf'));_0x4dd69a[_0x973e('0xc')]=null;_0x4dd69a['substatusAt']=null;}_0x40acd7(null,_0x4dd69a);},'afterUpdate':function(_0x1f48e6,_0x1df399,_0x2eb56d){var _0x599665=_0x5f78a['models'];var _0x5a10ba=_0x1f48e6[_0x973e('0x13')]({'plain':!![]});if(_0x5a10ba[_0x973e('0x10')]){return _0x599665['MailMessage'][_0x973e('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x5a10ba['id']}})['then'](function(){_0x2eb56d();})['catch'](function(_0x527415){_0x2eb56d(_0x527415);});}else{_0x2eb56d();}}},'charset':_0x973e('0x15'),'collate':_0x973e('0x16')});}; \ No newline at end of file +var _0xd715=['substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','subject','FULLTEXT','substatus'];(function(_0x2b67a3,_0x499a3a){var _0x33e42c=function(_0x74a323){while(--_0x74a323){_0x2b67a3['push'](_0x2b67a3['shift']());}};_0x33e42c(++_0x499a3a);}(_0xd715,0x78));var _0x5d71=function(_0x3f356b,_0x1ad885){_0x3f356b=_0x3f356b-0x0;var _0x235c01=_0xd715[_0x3f356b];return _0x235c01;};'use strict';var _=require(_0x5d71('0x0'));var util=require(_0x5d71('0x1'));var logger=require('../../config/logger')(_0x5d71('0x2'));var moment=require('moment');var BPromise=require(_0x5d71('0x3'));var rp=require(_0x5d71('0x4'));var fs=require('fs');var path=require(_0x5d71('0x5'));var rimraf=require(_0x5d71('0x6'));var config=require(_0x5d71('0x7'));var attributes=require(_0x5d71('0x8'));module[_0x5d71('0x9')]=function(_0x49d558,_0x2ef134){return _0x49d558[_0x5d71('0xa')]('MailInteraction',attributes,{'tableName':_0x5d71('0xb'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x5d71('0xc'),'to'],'type':_0x5d71('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4d1a35,_0x5859cd,_0x2b0f44){if(_0x4d1a35[_0x5d71('0xe')]){_0x4d1a35[_0x5d71('0xf')]=moment()['format'](_0x5d71('0x10'));}if(_0x4d1a35[_0x5d71('0x11')]){_0x4d1a35[_0x5d71('0x12')]=moment()['format'](_0x5d71('0x10'));}_0x2b0f44(null,_0x5859cd);},'beforeUpdate':function(_0x2155d7,_0x26214d,_0xfafecd){if(_0x2155d7[_0x5d71('0x13')](_0x5d71('0xe'))){_0x2155d7[_0x5d71('0xf')]=_0x2155d7[_0x5d71('0xe')]?moment()['format'](_0x5d71('0x10')):null;}if(_0x2155d7['changed'](_0x5d71('0x11'))){_0x2155d7[_0x5d71('0x12')]=moment()['format'](_0x5d71('0x10'));_0x2155d7[_0x5d71('0xe')]=null;_0x2155d7[_0x5d71('0xf')]=null;}_0xfafecd(null,_0x2155d7);},'afterUpdate':function(_0x222966,_0x25ea76,_0x4b26b2){var _0x68f658=_0x49d558[_0x5d71('0x14')];var _0x420839=_0x222966['get']({'plain':!![]});if(_0x420839[_0x5d71('0x11')]){return _0x68f658[_0x5d71('0x15')][_0x5d71('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x420839['id']}})[_0x5d71('0x17')](function(){_0x4b26b2();})[_0x5d71('0x18')](function(_0x3ede89){_0x4b26b2(_0x3ede89);});}else{_0x4b26b2();}}},'charset':_0x5d71('0x19'),'collate':_0x5d71('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 4a2bf73..f7616a3 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 _0xb657=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./mailInteraction.socket','then','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','update','body','options','raw','where','attributes','limit','UpdateMailInteraction','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags'];(function(_0x2e4eba,_0x455860){var _0x589cdf=function(_0x55865b){while(--_0x55865b){_0x2e4eba['push'](_0x2e4eba['shift']());}};_0x589cdf(++_0x455860);}(_0xb657,0x150));var _0x7b65=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xb657[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require(_0x7b65('0x0'));var util=require(_0x7b65('0x1'));var moment=require(_0x7b65('0x2'));var BPromise=require(_0x7b65('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b65('0x4'));var db=require(_0x7b65('0x5'))['db'];var utils=require(_0x7b65('0x6'));var logger=require(_0x7b65('0x7'))(_0x7b65('0x8'));var config=require(_0x7b65('0x9'));var jayson=require(_0x7b65('0xa'));var client=jayson['client'][_0x7b65('0xb')]({'port':0x232a});config[_0x7b65('0xc')]=_[_0x7b65('0xd')](config[_0x7b65('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x7b65('0xe'))(new Redis(config[_0x7b65('0xc')]));require(_0x7b65('0xf'))['register'](socket);function respondWithRpcPromise(_0xf86fd7,_0x414202,_0x3f11b5){return new BPromise(function(_0x6dd6cf,_0x3c0f61){return client['request'](_0xf86fd7,_0x3f11b5)[_0x7b65('0x10')](function(_0x4d4ac2){logger['info'](_0x7b65('0x11'),_0x414202,'request\x20sent');logger[_0x7b65('0x12')](_0x7b65('0x13'),_0x414202,_0x7b65('0x14'),JSON[_0x7b65('0x15')](_0x4d4ac2));if(_0x4d4ac2[_0x7b65('0x16')]){if(_0x4d4ac2['error']['code']===0x1f4){logger['error'](_0x7b65('0x11'),_0x414202,_0x4d4ac2['error']['message']);return _0x3c0f61(_0x4d4ac2[_0x7b65('0x16')][_0x7b65('0x17')]);}logger[_0x7b65('0x16')](_0x7b65('0x11'),_0x414202,_0x4d4ac2[_0x7b65('0x16')][_0x7b65('0x17')]);return _0x6dd6cf(_0x4d4ac2[_0x7b65('0x16')][_0x7b65('0x17')]);}else{logger[_0x7b65('0x18')](_0x7b65('0x11'),_0x414202,_0x7b65('0x14'));_0x6dd6cf(_0x4d4ac2[_0x7b65('0x19')]['message']);}})[_0x7b65('0x1a')](function(_0x398fcb){logger[_0x7b65('0x16')](_0x7b65('0x11'),_0x414202,_0x398fcb);_0x3c0f61(_0x398fcb);});});}exports['UpdateMailInteraction']=function(_0x3ed7de){var _0x455284=this;return new Promise(function(_0xa7a6b,_0x5a4d23){return db['MailInteraction'][_0x7b65('0x1b')](_0x3ed7de[_0x7b65('0x1c')],{'raw':_0x3ed7de[_0x7b65('0x1d')]?_0x3ed7de[_0x7b65('0x1d')][_0x7b65('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ed7de[_0x7b65('0x1d')]?_0x3ed7de['options'][_0x7b65('0x1f')]||null:null,'attributes':_0x3ed7de[_0x7b65('0x1d')]?_0x3ed7de[_0x7b65('0x1d')][_0x7b65('0x20')]||null:null,'limit':_0x3ed7de[_0x7b65('0x1d')]?_0x3ed7de[_0x7b65('0x1d')][_0x7b65('0x21')]||null:null})[_0x7b65('0x10')](function(_0x3c4262){logger[_0x7b65('0x18')](_0x7b65('0x22'),_0x3ed7de);logger['debug'](_0x7b65('0x22'),_0x3ed7de,JSON[_0x7b65('0x15')](_0x3c4262));_0xa7a6b(_0x3c4262);})[_0x7b65('0x1a')](function(_0x165924){logger['error']('UpdateMailInteraction',_0x165924[_0x7b65('0x17')],_0x3ed7de);_0x5a4d23(_0x455284[_0x7b65('0x16')](0x1f4,_0x165924[_0x7b65('0x17')]));});});};exports[_0x7b65('0x23')]=function(_0x5975ae){return new Promise(function(_0x54c0cf,_0x1b714c){return db['MailInteraction'][_0x7b65('0x24')]({'where':_0x5975ae['options']?_0x5975ae[_0x7b65('0x1d')][_0x7b65('0x1f')]||null:null})[_0x7b65('0x10')](function(_0x239dec){if(_0x239dec){return _0x239dec[_0x7b65('0x25')](_0x5975ae[_0x7b65('0x1c')][_0x7b65('0x26')],_[_0x7b65('0x27')](_0x5975ae[_0x7b65('0x1c')],[_0x7b65('0x26'),'id'])||{});}})[_0x7b65('0x28')](function(_0x19a67e){logger[_0x7b65('0x18')](_0x7b65('0x29'),_0x5975ae);logger[_0x7b65('0x12')]('AddTags',_0x5975ae,JSON['stringify'](_0x19a67e));_0x54c0cf(_0x19a67e);})[_0x7b65('0x1a')](function(_0x521215){logger['error'](_0x7b65('0x29'),_0x521215[_0x7b65('0x17')],_0x5975ae);_0x1b714c(_this[_0x7b65('0x16')](0x1f4,_0x521215['message']));});});}; \ No newline at end of file +var _0xe79c=['defaults','socket.io-emitter','./mailInteraction.socket','register','then','info','MailInteraction,\x20%s,\x20%s','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','limit','debug','catch','AddTagsToMailInteraction','find','addTags','ids','omit','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x53c4d4,_0x48ae17){var _0x30f054=function(_0x3574c5){while(--_0x3574c5){_0x53c4d4['push'](_0x53c4d4['shift']());}};_0x30f054(++_0x48ae17);}(_0xe79c,0x9f));var _0xce79=function(_0x30f85b,_0x3e539a){_0x30f85b=_0x30f85b-0x0;var _0x5d63d6=_0xe79c[_0x30f85b];return _0x5d63d6;};'use strict';var _=require(_0xce79('0x0'));var util=require('util');var moment=require(_0xce79('0x1'));var BPromise=require(_0xce79('0x2'));var rs=require(_0xce79('0x3'));var fs=require('fs');var Redis=require(_0xce79('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xce79('0x5'));var logger=require(_0xce79('0x6'))(_0xce79('0x7'));var config=require(_0xce79('0x8'));var jayson=require(_0xce79('0x9'));var client=jayson[_0xce79('0xa')][_0xce79('0xb')]({'port':0x232a});config[_0xce79('0xc')]=_[_0xce79('0xd')](config[_0xce79('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xce79('0xe'))(new Redis(config[_0xce79('0xc')]));require(_0xce79('0xf'))[_0xce79('0x10')](socket);function respondWithRpcPromise(_0x4ef8e2,_0x3bfed5,_0x322e17){return new BPromise(function(_0x5d01cd,_0xf46cd){return client['request'](_0x4ef8e2,_0x322e17)[_0xce79('0x11')](function(_0x2b861e){logger[_0xce79('0x12')](_0xce79('0x13'),_0x3bfed5,'request\x20sent');logger['debug'](_0xce79('0x14'),_0x3bfed5,_0xce79('0x15'),JSON[_0xce79('0x16')](_0x2b861e));if(_0x2b861e[_0xce79('0x17')]){if(_0x2b861e[_0xce79('0x17')][_0xce79('0x18')]===0x1f4){logger[_0xce79('0x17')](_0xce79('0x13'),_0x3bfed5,_0x2b861e[_0xce79('0x17')][_0xce79('0x19')]);return _0xf46cd(_0x2b861e['error']['message']);}logger[_0xce79('0x17')](_0xce79('0x13'),_0x3bfed5,_0x2b861e[_0xce79('0x17')][_0xce79('0x19')]);return _0x5d01cd(_0x2b861e[_0xce79('0x17')][_0xce79('0x19')]);}else{logger[_0xce79('0x12')](_0xce79('0x13'),_0x3bfed5,_0xce79('0x15'));_0x5d01cd(_0x2b861e[_0xce79('0x1a')]['message']);}})['catch'](function(_0x300f14){logger[_0xce79('0x17')](_0xce79('0x13'),_0x3bfed5,_0x300f14);_0xf46cd(_0x300f14);});});}exports[_0xce79('0x1b')]=function(_0x1a1b02){var _0x5655af=this;return new Promise(function(_0x2aabe,_0x1f3988){return db[_0xce79('0x1c')][_0xce79('0x1d')](_0x1a1b02[_0xce79('0x1e')],{'raw':_0x1a1b02['options']?_0x1a1b02[_0xce79('0x1f')][_0xce79('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a1b02[_0xce79('0x1f')]?_0x1a1b02[_0xce79('0x1f')][_0xce79('0x21')]||null:null,'attributes':_0x1a1b02['options']?_0x1a1b02[_0xce79('0x1f')]['attributes']||null:null,'limit':_0x1a1b02['options']?_0x1a1b02[_0xce79('0x1f')][_0xce79('0x22')]||null:null})['then'](function(_0x4021d2){logger[_0xce79('0x12')]('UpdateMailInteraction',_0x1a1b02);logger[_0xce79('0x23')]('UpdateMailInteraction',_0x1a1b02,JSON[_0xce79('0x16')](_0x4021d2));_0x2aabe(_0x4021d2);})[_0xce79('0x24')](function(_0x43221a){logger[_0xce79('0x17')](_0xce79('0x1b'),_0x43221a[_0xce79('0x19')],_0x1a1b02);_0x1f3988(_0x5655af[_0xce79('0x17')](0x1f4,_0x43221a[_0xce79('0x19')]));});});};exports[_0xce79('0x25')]=function(_0x56db56){return new Promise(function(_0x16cc20,_0x41bee7){return db[_0xce79('0x1c')][_0xce79('0x26')]({'where':_0x56db56[_0xce79('0x1f')]?_0x56db56[_0xce79('0x1f')][_0xce79('0x21')]||null:null})[_0xce79('0x11')](function(_0x21d3cc){if(_0x21d3cc){return _0x21d3cc[_0xce79('0x27')](_0x56db56[_0xce79('0x1e')][_0xce79('0x28')],_[_0xce79('0x29')](_0x56db56[_0xce79('0x1e')],[_0xce79('0x28'),'id'])||{});}})['spread'](function(_0x498dc8){logger[_0xce79('0x12')]('AddTags',_0x56db56);logger[_0xce79('0x23')]('AddTags',_0x56db56,JSON['stringify'](_0x498dc8));_0x16cc20(_0x498dc8);})[_0xce79('0x24')](function(_0x592a72){logger[_0xce79('0x17')](_0xce79('0x2a'),_0x592a72[_0xce79('0x19')],_0x56db56);_0x41bee7(_this[_0xce79('0x17')](0x1f4,_0x592a72['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 1c5fe49..d7097c2 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 _0x035a=['save','emit','mailInteraction:','./mailInteraction.events'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x035a,0x1bb));var _0xa035=function(_0x4e9a35,_0x4aefb7){_0x4e9a35=_0x4e9a35-0x0;var _0x88996d=_0x035a[_0x4e9a35];return _0x88996d;};'use strict';var MailInteractionEvents=require(_0xa035('0x0'));var events=[_0xa035('0x1'),'remove','update'];function createListener(_0x10a1d3,_0x5d4d73){return function(_0x2f2902){_0x5d4d73[_0xa035('0x2')](_0x10a1d3,_0x2f2902);};}function removeListener(_0x5797f3,_0x128f46){return function(){MailInteractionEvents['removeListener'](_0x5797f3,_0x128f46);};}exports['register']=function(_0x135833){for(var _0x4ac5e9=0x0,_0x1313a1=events['length'];_0x4ac5e9<_0x1313a1;_0x4ac5e9++){var _0x2e121f=events[_0x4ac5e9];var _0x40a774=createListener(_0xa035('0x3')+_0x2e121f,_0x135833);MailInteractionEvents['on'](_0x2e121f,_0x40a774);}}; \ No newline at end of file +var _0x4114=['length','mailInteraction:','./mailInteraction.events','save','remove','update','emit','removeListener'];(function(_0x56e5cf,_0x5732f1){var _0x1e5660=function(_0x2bef81){while(--_0x2bef81){_0x56e5cf['push'](_0x56e5cf['shift']());}};_0x1e5660(++_0x5732f1);}(_0x4114,0xa2));var _0x4411=function(_0x956339,_0x67f8fe){_0x956339=_0x956339-0x0;var _0x224c92=_0x4114[_0x956339];return _0x224c92;};'use strict';var MailInteractionEvents=require(_0x4411('0x0'));var events=[_0x4411('0x1'),_0x4411('0x2'),_0x4411('0x3')];function createListener(_0x3d4b6a,_0x6e7784){return function(_0x20d28a){_0x6e7784[_0x4411('0x4')](_0x3d4b6a,_0x20d28a);};}function removeListener(_0x3236e0,_0x27ff1e){return function(){MailInteractionEvents[_0x4411('0x5')](_0x3236e0,_0x27ff1e);};}exports['register']=function(_0x4accdc){for(var _0x36e4f5=0x0,_0x593720=events[_0x4411('0x6')];_0x36e4f5<_0x593720;_0x36e4f5++){var _0x452aef=events[_0x36e4f5];var _0x9bc94=createListener(_0x4411('0x7')+_0x452aef,_0x4accdc);MailInteractionEvents['on'](_0x452aef,_0x9bc94);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index bca7fac..e48e6c9 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 _0xa75b=['get','isAuthenticated','index','/describe','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','/:id','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller'];(function(_0x16d9af,_0x165741){var _0x1ff0a6=function(_0x1414d3){while(--_0x1414d3){_0x16d9af['push'](_0x16d9af['shift']());}};_0x1ff0a6(++_0x165741);}(_0xa75b,0x170));var _0xba75=function(_0x2a3072,_0x36dd48){_0x2a3072=_0x2a3072-0x0;var _0x5e4573=_0xa75b[_0x2a3072];return _0x5e4573;};'use strict';var multer=require(_0xba75('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xba75('0x1'));var express=require(_0xba75('0x2'));var router=express[_0xba75('0x3')]();var fs_extra=require(_0xba75('0x4'));var auth=require(_0xba75('0x5'));var interaction=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var controller=require(_0xba75('0x8'));router[_0xba75('0x9')]('/',auth[_0xba75('0xa')](),controller[_0xba75('0xb')]);router[_0xba75('0x9')](_0xba75('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xba75('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xba75('0xd')]);router['get'](_0xba75('0xe'),auth[_0xba75('0xa')](),controller[_0xba75('0xf')]);router[_0xba75('0x10')]('/',auth[_0xba75('0xa')](),interaction[_0xba75('0x11')](_0xba75('0x12'),_0xba75('0x13')),controller[_0xba75('0x14')]);router[_0xba75('0x15')](_0xba75('0x16'),auth[_0xba75('0xa')](),controller['update']);router['put'](_0xba75('0x17'),auth['isAuthenticated'](),controller[_0xba75('0x18')]);router[_0xba75('0x15')](_0xba75('0x19'),auth[_0xba75('0xa')](),controller['reject']);router[_0xba75('0x1a')](_0xba75('0x16'),auth[_0xba75('0xa')](),controller[_0xba75('0x1b')]);module[_0xba75('0x1c')]=router; \ No newline at end of file +var _0x5668=['get','isAuthenticated','/describe','show','/:id/download','download','tracked','/:id','update','put','/:id/accept','reject','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller'];(function(_0x11415d,_0x50af8c){var _0x33228d=function(_0xcc89ae){while(--_0xcc89ae){_0x11415d['push'](_0x11415d['shift']());}};_0x33228d(++_0x50af8c);}(_0x5668,0x8b));var _0x8566=function(_0x2c38da,_0x8f1352){_0x2c38da=_0x2c38da-0x0;var _0x4af535=_0x5668[_0x2c38da];return _0x4af535;};'use strict';var multer=require(_0x8566('0x0'));var util=require(_0x8566('0x1'));var path=require(_0x8566('0x2'));var timeout=require(_0x8566('0x3'));var express=require(_0x8566('0x4'));var router=express[_0x8566('0x5')]();var fs_extra=require(_0x8566('0x6'));var auth=require(_0x8566('0x7'));var interaction=require(_0x8566('0x8'));var config=require(_0x8566('0x9'));var controller=require(_0x8566('0xa'));router[_0x8566('0xb')]('/',auth[_0x8566('0xc')](),controller['index']);router[_0x8566('0xb')](_0x8566('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x8566('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x8566('0xe')]);router['get'](_0x8566('0xf'),auth[_0x8566('0xc')](),controller[_0x8566('0x10')]);router['post']('/',auth[_0x8566('0xc')](),interaction[_0x8566('0x11')]('mail','mailmessage:create'),controller['create']);router['put'](_0x8566('0x12'),auth[_0x8566('0xc')](),controller[_0x8566('0x13')]);router[_0x8566('0x14')](_0x8566('0x15'),auth['isAuthenticated'](),controller['accept']);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x8566('0x16')]);router[_0x8566('0x17')](_0x8566('0x12'),auth[_0x8566('0xc')](),controller[_0x8566('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index f8bea7f..069ec04 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 _0x08a7=['STRING','long','DATE','Email','Chat','sequelize','exports','TEXT','BOOLEAN','ENUM','out'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x08a7,0x123));var _0x708a=function(_0x3290fa,_0x402648){_0x3290fa=_0x3290fa-0x0;var _0x18e2e5=_0x08a7[_0x3290fa];return _0x18e2e5;};'use strict';var Sequelize=require(_0x708a('0x0'));var _=require('lodash');module[_0x708a('0x1')]={'body':{'type':Sequelize[_0x708a('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x708a('0x2')]('medium')},'read':{'type':Sequelize[_0x708a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x708a('0x4')]('in',_0x708a('0x5')),'defaultValue':_0x708a('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x708a('0x6')](0x1fe)},'from':{'type':Sequelize[_0x708a('0x6')]},'to':{'type':Sequelize['TEXT']('long')},'cc':{'type':Sequelize[_0x708a('0x2')](_0x708a('0x7'))},'bcc':{'type':Sequelize[_0x708a('0x2')](_0x708a('0x7'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x708a('0x8')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x708a('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x708a('0x8')]},'originTo':{'type':Sequelize[_0x708a('0x2')](_0x708a('0x7'))},'originCc':{'type':Sequelize[_0x708a('0x2')](_0x708a('0x7'))},'originChannel':{'type':Sequelize['ENUM'](_0x708a('0x9'),_0x708a('0xa')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0x3bf9=['INTEGER','Email','Chat','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3bf9,0xab));var _0x93bf=function(_0x445b7e,_0x3ea85f){_0x445b7e=_0x445b7e-0x0;var _0x17d997=_0x3bf9[_0x445b7e];return _0x17d997;};'use strict';var Sequelize=require(_0x93bf('0x0'));var _=require(_0x93bf('0x1'));module[_0x93bf('0x2')]={'body':{'type':Sequelize[_0x93bf('0x3')](_0x93bf('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x93bf('0x5'))},'read':{'type':Sequelize[_0x93bf('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x93bf('0x7')]('in',_0x93bf('0x8')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x93bf('0x9')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x93bf('0x3')]('long')},'cc':{'type':Sequelize[_0x93bf('0x3')](_0x93bf('0x4'))},'bcc':{'type':Sequelize[_0x93bf('0x3')](_0x93bf('0x4'))},'subject':{'type':Sequelize[_0x93bf('0x3')]},'sentAt':{'type':Sequelize[_0x93bf('0xa')]},'attach':{'type':Sequelize[_0x93bf('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x93bf('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x93bf('0xa')]},'originTo':{'type':Sequelize[_0x93bf('0x3')](_0x93bf('0x4'))},'originCc':{'type':Sequelize[_0x93bf('0x3')](_0x93bf('0x4'))},'originChannel':{'type':Sequelize[_0x93bf('0x7')](_0x93bf('0xc'),_0x93bf('0xd')),'defaultValue':_0x93bf('0xc'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index fe692f9..600b9db 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 _0xb68d=['reject','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','User','email','event','download','server','files','tmp','message-%s.eml','bcc','subject','createdAt','Attachment','Attachments','from','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','push','readFileSync','unlinkSync','eml-format','moment','bluebird','util','lodash','ioredis','html-to-text','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','message','error','catch','status','offset','limit','undefined','count','update','destroy','end','sendStatus','stack','name','index','MailMessage','rawAttributes','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','body','describe','create','direction','out','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','updatedAt','DESC','Smtp','attachments','join','root','server/files/attachments','Contacts','ListId','List\x20not\x20found','sendMail','messageId','format','stringify','accept','read','readAt','UserId','user','MailInteractionId','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','SELECT','contact','fullname','internal','agent','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage'];(function(_0x599f82,_0x528685){var _0x3cd36b=function(_0x4301af){while(--_0x4301af){_0x599f82['push'](_0x599f82['shift']());}};_0x3cd36b(++_0x528685);}(_0xb68d,0x152));var _0xdb68=function(_0x453eed,_0x447daa){_0x453eed=_0x453eed-0x0;var _0x6db50=_0xb68d[_0x453eed];return _0x6db50;};'use strict';var emlformat=require(_0xdb68('0x0'));var moment=require(_0xdb68('0x1'));var BPromise=require(_0xdb68('0x2'));var util=require(_0xdb68('0x3'));var path=require('path');var fs=require('fs');var _=require(_0xdb68('0x4'));var Redis=require(_0xdb68('0x5'));var htmlToText=require(_0xdb68('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0xdb68('0x7'))(_0xdb68('0x8'));var interaction_log=require('../../config/logger')('mail-interactions');var config=require(_0xdb68('0x9'));var db=require(_0xdb68('0xa'))['db'];config[_0xdb68('0xb')]=_[_0xdb68('0xc')](config['redis'],{'host':_0xdb68('0xd'),'port':0x18eb});var socket=require(_0xdb68('0xe'))(new Redis(config['redis']));var htmlEntities=require('html-entities');require('./mailMessage.socket')[_0xdb68('0xf')](socket);var jayson=require(_0xdb68('0x10'));var client=jayson[_0xdb68('0x11')][_0xdb68('0x12')]({'port':0x232c});var client9003=jayson[_0xdb68('0x11')][_0xdb68('0x12')]({'port':0x232b});var client9002=jayson['client'][_0xdb68('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x40b723,_0x45b697,_0x5522e7,_0x5097c3){return new BPromise(function(_0x4ee17d,_0x3ac956){var _0x1787ba=_0x5097c3||client;return _0x1787ba['request'](_0x40b723,_0x5522e7)[_0xdb68('0x13')](function(_0x48685a){logger[_0xdb68('0x14')](_0xdb68('0x15'),_0x45b697,_0xdb68('0x16'));logger[_0xdb68('0x17')](_0xdb68('0x18'),_0x45b697,_0xdb68('0x16'),JSON['stringify'](_0x48685a));if(_0x48685a['error']){if(_0x48685a['error']['code']===0x1f4){logger['error'](_0xdb68('0x15'),_0x45b697,_0x48685a['error'][_0xdb68('0x19')]);return _0x3ac956(_0x48685a[_0xdb68('0x1a')][_0xdb68('0x19')]);}logger['error'](_0xdb68('0x15'),_0x45b697,_0x48685a['error'][_0xdb68('0x19')]);return _0x4ee17d(_0x48685a[_0xdb68('0x1a')]['message']);}else{logger[_0xdb68('0x14')]('MailMessage,\x20%s,\x20%s',_0x45b697,_0xdb68('0x16'));_0x4ee17d(_0x48685a['result'][_0xdb68('0x19')]);}})[_0xdb68('0x1b')](function(_0x3f63c5){logger[_0xdb68('0x1a')](_0xdb68('0x15'),_0x45b697,_0x3f63c5);_0x3ac956(_0x3f63c5);});});}function respondWithResult(_0x4de19e,_0x7c6cf){_0x7c6cf=_0x7c6cf||0xc8;return function(_0x521ae0){if(_0x521ae0){return _0x4de19e[_0xdb68('0x1c')](_0x7c6cf)['json'](_0x521ae0);}};}function respondWithFilteredResult(_0x42f2b4,_0xad5df7){return function(_0x1f9e67){if(_0x1f9e67){var _0x5a129d=typeof _0xad5df7[_0xdb68('0x1d')]==='undefined'&&typeof _0xad5df7[_0xdb68('0x1e')]===_0xdb68('0x1f');var _0x3ea068=_0x1f9e67[_0xdb68('0x20')];var _0x31fa9a=_0x5a129d?0x0:_0xad5df7['offset'];var _0x5d9bdc=_0x5a129d?_0x1f9e67['count']:_0xad5df7[_0xdb68('0x1d')]+_0xad5df7[_0xdb68('0x1e')];var _0x297341;if(_0x5d9bdc>=_0x3ea068){_0x5d9bdc=_0x3ea068;_0x297341=0xc8;}else{_0x297341=0xce;}_0x42f2b4['status'](_0x297341);return _0x42f2b4['set']('Content-Range',_0x31fa9a+'-'+_0x5d9bdc+'/'+_0x3ea068)['json'](_0x1f9e67);}return null;};}function saveUpdates(_0x332b79){return function(_0x36a289){if(_0x36a289){return _0x36a289[_0xdb68('0x21')](_0x332b79)[_0xdb68('0x13')](function(_0x193684){return _0x193684;});}return null;};}function removeEntity(_0x1c6c6e){return function(_0x5b280b){if(_0x5b280b){return _0x5b280b[_0xdb68('0x22')]()[_0xdb68('0x13')](function(){_0x1c6c6e[_0xdb68('0x1c')](0xcc)[_0xdb68('0x23')]();});}};}function handleEntityNotFound(_0x317de7){return function(_0x5f12f6){if(!_0x5f12f6){_0x317de7[_0xdb68('0x24')](0x194);}return _0x5f12f6;};}function handleError(_0x735e61,_0x5ba73e){_0x5ba73e=_0x5ba73e||0x1f4;return function(_0xba041d){logger[_0xdb68('0x1a')](_0xba041d[_0xdb68('0x25')]);if(_0xba041d[_0xdb68('0x26')]){delete _0xba041d[_0xdb68('0x26')];}_0x735e61[_0xdb68('0x1c')](_0x5ba73e)['send'](_0xba041d);};}exports[_0xdb68('0x27')]=function(_0x151438,_0x3f21b4){var _0x2db78a={},_0x207c01={},_0x28e3cf={'count':0x0,'rows':[]};var _0x652557=_['map'](db[_0xdb68('0x28')][_0xdb68('0x29')],function(_0x57cd49){return{'name':_0x57cd49['fieldName'],'type':_0x57cd49['type'][_0xdb68('0x2a')]};});_0x207c01['model']=_[_0xdb68('0x2b')](_0x652557,'name');_0x207c01[_0xdb68('0x2c')]=_['keys'](_0x151438['query']);_0x207c01[_0xdb68('0x2d')]=_[_0xdb68('0x2e')](_0x207c01['model'],_0x207c01['query']);_0x2db78a['attributes']=_[_0xdb68('0x2e')](_0x207c01[_0xdb68('0x2f')],qs[_0xdb68('0x30')](_0x151438[_0xdb68('0x2c')][_0xdb68('0x30')]));_0x2db78a['attributes']=_0x2db78a[_0xdb68('0x31')][_0xdb68('0x32')]?_0x2db78a['attributes']:_0x207c01[_0xdb68('0x2f')];if(!_0x151438[_0xdb68('0x2c')][_0xdb68('0x33')]('nolimit')){_0x2db78a[_0xdb68('0x1e')]=qs[_0xdb68('0x1e')](_0x151438[_0xdb68('0x2c')]['limit']);_0x2db78a[_0xdb68('0x1d')]=qs[_0xdb68('0x1d')](_0x151438[_0xdb68('0x2c')][_0xdb68('0x1d')]);}_0x2db78a[_0xdb68('0x34')]=qs[_0xdb68('0x35')](_0x151438[_0xdb68('0x2c')][_0xdb68('0x35')]);_0x2db78a['where']=qs[_0xdb68('0x2d')](_[_0xdb68('0x36')](_0x151438[_0xdb68('0x2c')],_0x207c01[_0xdb68('0x2d')]),_0x652557);if(_0x151438['query'][_0xdb68('0x37')]){_0x2db78a[_0xdb68('0x38')]=_[_0xdb68('0x39')](_0x2db78a[_0xdb68('0x38')],{'$or':_[_0xdb68('0x2b')](_0x652557,function(_0x1f38da){if(_0x1f38da[_0xdb68('0x3a')]!==_0xdb68('0x3b')){var _0x4c946d={};_0x4c946d[_0x1f38da[_0xdb68('0x26')]]={'$like':'%'+_0x151438[_0xdb68('0x2c')]['filter']+'%'};return _0x4c946d;}})});}_0x2db78a=_[_0xdb68('0x39')]({},_0x2db78a,_0x151438[_0xdb68('0x3c')]);var _0x1ea3ee={'where':_0x2db78a[_0xdb68('0x38')]};return db[_0xdb68('0x28')]['count'](_0x1ea3ee)[_0xdb68('0x13')](function(_0x3a3784){_0x28e3cf[_0xdb68('0x20')]=_0x3a3784;if(_0x151438[_0xdb68('0x2c')][_0xdb68('0x3d')]){_0x2db78a[_0xdb68('0x3e')]=[{'all':!![]}];}return db[_0xdb68('0x28')][_0xdb68('0x3f')](_0x2db78a);})[_0xdb68('0x13')](function(_0x2f79dd){_0x28e3cf[_0xdb68('0x40')]=_0x2f79dd;return _0x28e3cf;})[_0xdb68('0x13')](respondWithFilteredResult(_0x3f21b4,_0x2db78a))[_0xdb68('0x1b')](handleError(_0x3f21b4,null));};exports[_0xdb68('0x41')]=function(_0x151a07,_0x566661){var _0x2e8ffc={'raw':!![],'where':{'id':_0x151a07[_0xdb68('0x42')]['id']}},_0x2f4d7d={};_0x2f4d7d['model']=_[_0xdb68('0x43')](db[_0xdb68('0x28')]['rawAttributes']);_0x2f4d7d[_0xdb68('0x2c')]=_[_0xdb68('0x43')](_0x151a07['query']);_0x2f4d7d[_0xdb68('0x2d')]=_[_0xdb68('0x2e')](_0x2f4d7d[_0xdb68('0x2f')],_0x2f4d7d[_0xdb68('0x2c')]);_0x2e8ffc[_0xdb68('0x31')]=_[_0xdb68('0x2e')](_0x2f4d7d[_0xdb68('0x2f')],qs['fields'](_0x151a07['query'][_0xdb68('0x30')]));_0x2e8ffc[_0xdb68('0x31')]=_0x2e8ffc[_0xdb68('0x31')][_0xdb68('0x32')]?_0x2e8ffc[_0xdb68('0x31')]:_0x2f4d7d[_0xdb68('0x2f')];if(_0x151a07['query']['includeAll']){_0x2e8ffc[_0xdb68('0x3e')]=[{'all':!![]}];}_0x2e8ffc=_[_0xdb68('0x39')]({},_0x2e8ffc,_0x151a07[_0xdb68('0x3c')]);return db['MailMessage'][_0xdb68('0x44')](_0x2e8ffc)['then'](handleEntityNotFound(_0x566661,null))[_0xdb68('0x13')](respondWithResult(_0x566661,null))['catch'](handleError(_0x566661,null));};exports[_0xdb68('0x21')]=function(_0x2b5c18,_0x2cb7cb){if(_0x2b5c18[_0xdb68('0x45')]['id']){delete _0x2b5c18[_0xdb68('0x45')]['id'];}return db[_0xdb68('0x28')][_0xdb68('0x44')]({'where':{'id':_0x2b5c18['params']['id']}})[_0xdb68('0x13')](handleEntityNotFound(_0x2cb7cb,null))['then'](saveUpdates(_0x2b5c18[_0xdb68('0x45')],null))['then'](respondWithResult(_0x2cb7cb,null))[_0xdb68('0x1b')](handleError(_0x2cb7cb,null));};exports[_0xdb68('0x22')]=function(_0xaf4e33,_0x58b1a3){return db[_0xdb68('0x28')]['find']({'where':{'id':_0xaf4e33[_0xdb68('0x42')]['id']}})[_0xdb68('0x13')](handleEntityNotFound(_0x58b1a3,null))[_0xdb68('0x13')](removeEntity(_0x58b1a3,null))[_0xdb68('0x1b')](handleError(_0x58b1a3,null));};exports['describe']=function(_0x579ecb,_0x407bca){return db['MailMessage'][_0xdb68('0x46')]()[_0xdb68('0x13')](respondWithResult(_0x407bca,null))[_0xdb68('0x1b')](handleError(_0x407bca,null));};exports[_0xdb68('0x47')]=function(_0x2fd996,_0x5a5bc7){return db[_0xdb68('0x28')][_0xdb68('0x47')](_0x2fd996[_0xdb68('0x45')])[_0xdb68('0x13')](function(_0x4c9c9d){if(_0x4c9c9d){if(_0x4c9c9d[_0xdb68('0x48')]===_0xdb68('0x49')&&!_0x4c9c9d['secret']){var _0x3219a1,_0x30be3a,_0x49ca58;if(_0x2fd996[_0xdb68('0x45')]['to']){_0x30be3a=_0x2fd996[_0xdb68('0x45')]['to'][_0xdb68('0x4a')](',')[0x0];}return db[_0xdb68('0x4b')][_0xdb68('0x4c')]({'where':{'id':_0x4c9c9d[_0xdb68('0x4d')]},'include':[{'model':db[_0xdb68('0x4e')],'as':_0xdb68('0x4f'),'include':[{'model':db[_0xdb68('0x50')],'as':'Contacts','where':{'email':_0x30be3a},'limit':0x1,'order':[[_0xdb68('0x51'),_0xdb68('0x52')]]}]},{'model':db['MailServerOut'],'as':_0xdb68('0x53'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0xdb68('0x13')](function(_0x4e5448){_0x3219a1=_0x4e5448;if(!_0x3219a1||!_0x3219a1[_0xdb68('0x53')])return;var _0x5cd196=_0x3219a1['getSmtpOptions']();if(_0x2fd996[_0xdb68('0x45')]['attachments']&&_0x2fd996[_0xdb68('0x45')][_0xdb68('0x54')][_0xdb68('0x32')]){for(var _0xe9e391=0x0;_0xe9e391<_0x2fd996['body'][_0xdb68('0x54')][_0xdb68('0x32')];_0xe9e391+=0x1){_0x2fd996['body'][_0xdb68('0x54')][_0xe9e391]={'filename':_0x2fd996[_0xdb68('0x45')][_0xdb68('0x54')][_0xe9e391][_0xdb68('0x26')],'path':path[_0xdb68('0x55')](config[_0xdb68('0x56')],_0xdb68('0x57'),_0x2fd996[_0xdb68('0x45')][_0xdb68('0x54')][_0xe9e391]['basename'])};}}_0x49ca58={'account':_0x5cd196,'message':_0x2fd996[_0xdb68('0x45')]};return;})[_0xdb68('0x13')](function(){if(_0x3219a1[_0xdb68('0x4f')]){if(_0x3219a1['List'][_0xdb68('0x58')][_0xdb68('0x32')]){return _0x3219a1[_0xdb68('0x4f')][_0xdb68('0x58')][0x0];}else{return db[_0xdb68('0x50')]['create'](_[_0xdb68('0xc')](_0x2fd996['body'],{'firstName':_0x2fd996[_0xdb68('0x45')]['to'],'email':_0x2fd996[_0xdb68('0x45')]['to'],'phone':_0x2fd996[_0xdb68('0x45')]['to'],'ListId':_0x3219a1[_0xdb68('0x59')]}));}}else{throw new Error(_0xdb68('0x5a'));}})['then'](function(){if(_0x49ca58){return respondWithRpcPromise('SendMail',_0xdb68('0x5b'),_0x49ca58,client9003)[_0xdb68('0x13')](function(_0x201d7a){return _0x4c9c9d[_0xdb68('0x21')]({'read':!![],'messageId':_0x201d7a[_0xdb68('0x5c')],'sentAt':moment()[_0xdb68('0x5d')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xdb68('0x1b')](function(_0x30d448){logger[_0xdb68('0x1a')]('%s',JSON[_0xdb68('0x5e')](_0x30d448));return _0x4c9c9d;});}return _0x4c9c9d;});}return _0x4c9c9d;}})[_0xdb68('0x13')](respondWithResult(_0x5a5bc7,0xc9))[_0xdb68('0x1b')](handleError(_0x5a5bc7,null));};exports[_0xdb68('0x5f')]=function(_0x5f4c0b,_0x10dd6e){var _0x398ed6={'agent':{},'channel':'mail'};if(_0x5f4c0b['body']['id']){delete _0x5f4c0b[_0xdb68('0x45')]['id'];}_0x5f4c0b[_0xdb68('0x45')][_0xdb68('0x60')]=!![];_0x5f4c0b[_0xdb68('0x45')][_0xdb68('0x61')]=moment()[_0xdb68('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x5f4c0b[_0xdb68('0x45')][_0xdb68('0x62')]=_0x5f4c0b[_0xdb68('0x45')][_0xdb68('0x62')]||_0x5f4c0b[_0xdb68('0x63')]['id'];_0x398ed6['agent']['id']=_0x5f4c0b[_0xdb68('0x45')]['UserId'];return db[_0xdb68('0x28')][_0xdb68('0x44')]({'where':{'id':_0x5f4c0b[_0xdb68('0x42')]['id'],'UserId':null}})[_0xdb68('0x13')](handleEntityNotFound(_0x10dd6e,null))[_0xdb68('0x13')](saveUpdates(_0x5f4c0b['body'],null))[_0xdb68('0x13')](function(_0x32354d){if(_0x32354d){_0x398ed6[_0xdb68('0x19')]=_0x32354d['get']({'plain':!![]});return db['MailInteraction'][_0xdb68('0x44')]({'where':{'id':_0x32354d[_0xdb68('0x64')]}});}return null;})[_0xdb68('0x13')](handleEntityNotFound(_0x10dd6e,null))[_0xdb68('0x13')](function(_0x1e4826){if(_0x1e4826){return _0x1e4826['update']({'UserId':_0x5f4c0b[_0xdb68('0x45')][_0xdb68('0x62')],'read1stAt':_['isNil'](_0x1e4826[_0xdb68('0x65')])?moment()[_0xdb68('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xdb68('0x13')](function(_0x52660e){if(_0x52660e){_0x398ed6[_0xdb68('0x66')]=_0x52660e[_0xdb68('0x67')]({'plain':!![]});interaction_log[_0xdb68('0x14')](_0xdb68('0x68'),_0x5f4c0b[_0xdb68('0x63')]['id'],_0x5f4c0b['user'][_0xdb68('0x26')],_0x5f4c0b[_0xdb68('0x63')][_0xdb68('0x69')],_0x398ed6['interaction']['id'],_0x5f4c0b[_0xdb68('0x45')]?JSON['stringify'](_0x5f4c0b[_0xdb68('0x45')]):_0xdb68('0x6a'));return respondWithRpcPromise(_0xdb68('0x6b'),_0xdb68('0x6c'),_0x398ed6);}return null;})[_0xdb68('0x13')](function(_0x5dc6ba){var _0x59aab8='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5dc6ba[_0xdb68('0x19')][_0xdb68('0x6d')];return db[_0xdb68('0x6e')][_0xdb68('0x2c')](_0x59aab8,{'type':db[_0xdb68('0x6f')]['QueryTypes'][_0xdb68('0x70')],'raw':!![]})[_0xdb68('0x13')](function(_0x436185){return _0x436185;});})[_0xdb68('0x13')](function(_0x5f1e63){if(_0x5f1e63){_0x398ed6[_0xdb68('0x19')][_0xdb68('0x71')]=_0x5f1e63[0x0];if(!_0x5f4c0b[_0xdb68('0x45')][_0xdb68('0x62')])return;return db['User'][_0xdb68('0x44')]({'where':{'id':_0x5f4c0b[_0xdb68('0x45')][_0xdb68('0x62')],'role':'agent'},'attributes':['id',_0xdb68('0x26'),_0xdb68('0x72'),'email',_0xdb68('0x73')],'raw':!![]});}return null;})[_0xdb68('0x13')](function(_0x289b57){if(!_0x289b57)return null;_0x398ed6[_0xdb68('0x19')][_0xdb68('0x74')]=_0x289b57;return _0x398ed6;})[_0xdb68('0x13')](function(_0x44eed0){if(_0x44eed0){if(_0x5f4c0b[_0xdb68('0x45')][_0xdb68('0x75')]){_0x398ed6[_0xdb68('0x19')][_0xdb68('0x76')]=util[_0xdb68('0x5d')](_0xdb68('0x77'),_0x5f4c0b[_0xdb68('0x63')]['name']);_0x398ed6[_0xdb68('0x19')][_0xdb68('0x78')]=_0x398ed6[_0xdb68('0x78')];_0x398ed6[_0xdb68('0x19')][_0xdb68('0x79')]=_0x398ed6['channel'];_0x398ed6['message']['event']=_0xdb68('0x5f');_0x398ed6[_0xdb68('0x19')]['body']=htmlToText['fromString'](_0x398ed6[_0xdb68('0x19')][_0xdb68('0x45')]);return respondWithRpcPromise(_0xdb68('0x7a'),_0xdb68('0x7a'),{'event':_0xdb68('0x7b'),'message':_0x398ed6[_0xdb68('0x19')]},client9002)[_0xdb68('0x13')](function(){return _0x398ed6;});}return _0x398ed6;}return null;})['then'](respondWithResult(_0x10dd6e,null))[_0xdb68('0x1b')](handleError(_0x10dd6e,null));};exports[_0xdb68('0x7c')]=function(_0x3edff1,_0x1c2246){var _0x2f8d6e={'agent':{},'channel':_0xdb68('0x7d')};if(_0x3edff1[_0xdb68('0x45')]['id']){delete _0x3edff1[_0xdb68('0x45')]['id'];}_0x3edff1['body']['UserId']=_0x3edff1['body'][_0xdb68('0x62')]||_0x3edff1['user']['id'];_0x2f8d6e[_0xdb68('0x74')]['id']=_0x3edff1['body'][_0xdb68('0x62')];return db['MailMessage']['find']({'where':{'id':_0x3edff1[_0xdb68('0x42')]['id'],'UserId':null}})[_0xdb68('0x13')](handleEntityNotFound(_0x1c2246,null))[_0xdb68('0x13')](function(_0x250623){if(_0x250623){_0x2f8d6e['message']=_0x250623[_0xdb68('0x67')]({'plain':!![]});return db['MailInteraction'][_0xdb68('0x44')]({'where':{'id':_0x250623[_0xdb68('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x1c2246,null))[_0xdb68('0x13')](function(_0x35dab3){if(_0x35dab3){_0x2f8d6e[_0xdb68('0x66')]=_0x35dab3['get']({'plain':!![]});interaction_log[_0xdb68('0x14')](_0xdb68('0x7e'),_0x3edff1[_0xdb68('0x63')]['id'],_0x3edff1[_0xdb68('0x63')]['name'],_0x3edff1['user'][_0xdb68('0x69')],_0x2f8d6e[_0xdb68('0x66')]['id'],_0x3edff1[_0xdb68('0x45')]?JSON[_0xdb68('0x5e')](_0x3edff1[_0xdb68('0x45')]):_0xdb68('0x6a'));return respondWithRpcPromise(_0xdb68('0x7f'),_0xdb68('0x80'),_0x2f8d6e);}return null;})['then'](function(_0x3d00ac){var _0x835455=_0xdb68('0x81')+_0x3d00ac['message'][_0xdb68('0x6d')];return db[_0xdb68('0x6e')][_0xdb68('0x2c')](_0x835455,{'type':db[_0xdb68('0x6f')][_0xdb68('0x82')][_0xdb68('0x70')],'raw':!![]})[_0xdb68('0x13')](function(_0x11e752){return _0x11e752;});})[_0xdb68('0x13')](function(_0x493d39){if(_0x493d39){_0x2f8d6e['message']['contact']=_0x493d39[0x0];if(!_0x3edff1[_0xdb68('0x45')][_0xdb68('0x62')])return;return db[_0xdb68('0x83')][_0xdb68('0x44')]({'where':{'id':_0x3edff1[_0xdb68('0x45')][_0xdb68('0x62')],'role':_0xdb68('0x74')},'attributes':['id',_0xdb68('0x26'),_0xdb68('0x72'),_0xdb68('0x84'),_0xdb68('0x73')],'raw':!![]});}return null;})[_0xdb68('0x13')](function(_0x35f8e5){if(!_0x35f8e5)return null;_0x2f8d6e[_0xdb68('0x19')][_0xdb68('0x74')]=_0x35f8e5;return _0x2f8d6e;})[_0xdb68('0x13')](function(_0x22089d){if(_0x22089d){_0x22089d[_0xdb68('0x19')]['interface']=util['format'](_0xdb68('0x77'),_0x3edff1[_0xdb68('0x63')]['name']);_0x22089d[_0xdb68('0x19')][_0xdb68('0x78')]=_0x2f8d6e[_0xdb68('0x78')];_0x22089d['message'][_0xdb68('0x79')]=_0x2f8d6e[_0xdb68('0x78')];_0x22089d[_0xdb68('0x19')][_0xdb68('0x85')]=_0xdb68('0x7c');_0x22089d[_0xdb68('0x19')][_0xdb68('0x45')]=htmlToText['fromString'](_0x2f8d6e[_0xdb68('0x19')][_0xdb68('0x45')]);respondWithRpcPromise('EventManager',_0xdb68('0x7a'),{'event':'rejectmessage','message':_0x22089d['message']},client9002);return _0x2f8d6e;}return null;})['then'](respondWithResult(_0x1c2246,null))[_0xdb68('0x1b')](handleError(_0x1c2246,null));};exports[_0xdb68('0x86')]=function(_0x1b4d64,_0x597641){var _0x2175c3=moment()['unix']()['toString']();var _0x24df26=path['join'](config[_0xdb68('0x56')],_0xdb68('0x87'),_0xdb68('0x88'),_0xdb68('0x89'));var _0x1b520a=path[_0xdb68('0x55')](config[_0xdb68('0x56')],'server','files',_0xdb68('0x54'));var _0x299a0c=util['format'](_0xdb68('0x8a'),_0x2175c3);return db[_0xdb68('0x28')][_0xdb68('0x44')]({'where':{'id':_0x1b4d64[_0xdb68('0x42')]['id']},'attributes':['id',_0xdb68('0x45'),'from','to','cc',_0xdb68('0x8b'),_0xdb68('0x8c'),_0xdb68('0x8d')],'include':_0x1b4d64['query'][_0xdb68('0x54')]?[{'model':db[_0xdb68('0x8e')],'as':_0xdb68('0x8f')}]:undefined})['then'](handleEntityNotFound(_0x597641,null))['then'](function(_0x4d914b){if(_0x4d914b){var _0x5149e3=_0x4d914b;var _0x8b5676={'from':_0x5149e3[_0xdb68('0x90')],'to':_0x5149e3['to'],'subject':_0x5149e3['subject'],'html':htmlEntities[_0xdb68('0x91')](_0x5149e3['body']),'headers':{'Date':moment(_0x5149e3[_0xdb68('0x8d')])[_0xdb68('0x5d')](_0xdb68('0x92'))},'attachments':[]};if(_0x4d914b['cc']){_0x8b5676['headers']['Cc']=_0x4d914b['cc'];}if(_0x4d914b['bcc']){_0x8b5676[_0xdb68('0x93')][_0xdb68('0x94')]=_0x4d914b['bcc'];}return new BPromise(function(_0x4af33c,_0x2df2a7){if(_0x4d914b[_0xdb68('0x8f')]){for(var _0x48be27=0x0;_0x48be27<_0x4d914b[_0xdb68('0x8f')][_0xdb68('0x32')];_0x48be27++){var _0x5c7082=_0x4d914b[_0xdb68('0x8f')][_0x48be27];var _0x1e3012=path[_0xdb68('0x55')](_0x1b520a,_0x5c7082[_0xdb68('0x95')]);if(fs[_0xdb68('0x96')](_0x1e3012)){_0x8b5676['attachments'][_0xdb68('0x97')]({'name':_0x5c7082[_0xdb68('0x26')],'contentType':_0x5c7082['type'],'data':fs[_0xdb68('0x98')](_0x1e3012)});}}}emlformat['build'](_0x8b5676,function(_0x11478f,_0x52eedd){if(_0x11478f)return _0x2df2a7(_0x11478f);fs['writeFileSync'](path['join'](_0x24df26,_0x299a0c),_0x52eedd);return _0x4af33c(_0x52eedd);});});}})[_0xdb68('0x13')](function(_0x5235da){if(_0x5235da){return _0x597641[_0xdb68('0x86')](path[_0xdb68('0x55')](_0x24df26,_0x299a0c),_0x299a0c,function(_0xff5c55){if(!_0xff5c55)fs[_0xdb68('0x99')](path[_0xdb68('0x55')](_0x24df26,_0x299a0c));});}})[_0xdb68('0x1b')](handleError(_0x597641,null));}; \ No newline at end of file +var _0x8677=['root','server/files/attachments','basename','Contacts','defaults','ListId','List\x20not\x20found','SendMail','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','readAt','UserId','user','get','MailInteraction','MailInteractionId','isNil','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','email','internal','interface','SIP/%s','channel','event','fromString','EventManager','acceptmessage','reject','RejectMessage','rejectMessage','fullname','motionChannel','rejectmessage','download','unix','toString','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','Bcc','push','writeFileSync','eml-format','moment','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailMessage.socket','register','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','sendStatus','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','show','params','catch','body','find','describe','create','direction','out','split','findOne','CmList','List','updatedAt','DESC','MailServerOut','CloudProvider','Smtp','getSmtpOptions','attachments','join'];(function(_0x32bd48,_0x384f50){var _0x254db6=function(_0x1d9379){while(--_0x1d9379){_0x32bd48['push'](_0x32bd48['shift']());}};_0x254db6(++_0x384f50);}(_0x8677,0x17a));var _0x7867=function(_0x1a6f54,_0x38d620){_0x1a6f54=_0x1a6f54-0x0;var _0x31af4c=_0x8677[_0x1a6f54];return _0x31af4c;};'use strict';var emlformat=require(_0x7867('0x0'));var moment=require(_0x7867('0x1'));var BPromise=require('bluebird');var util=require(_0x7867('0x2'));var path=require(_0x7867('0x3'));var fs=require('fs');var _=require(_0x7867('0x4'));var Redis=require(_0x7867('0x5'));var htmlToText=require(_0x7867('0x6'));var qs=require(_0x7867('0x7'));var logger=require(_0x7867('0x8'))(_0x7867('0x9'));var interaction_log=require(_0x7867('0x8'))(_0x7867('0xa'));var config=require(_0x7867('0xb'));var db=require(_0x7867('0xc'))['db'];config[_0x7867('0xd')]=_['defaults'](config[_0x7867('0xd')],{'host':_0x7867('0xe'),'port':0x18eb});var socket=require(_0x7867('0xf'))(new Redis(config[_0x7867('0xd')]));var htmlEntities=require('html-entities');require(_0x7867('0x10'))[_0x7867('0x11')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7867('0x12')]['http']({'port':0x232c});var client9003=jayson['client']['http']({'port':0x232b});var client9002=jayson[_0x7867('0x12')][_0x7867('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x56b0c1,_0xd0f227,_0x4823e0,_0x28edb5){return new BPromise(function(_0x4bbb8b,_0x4ac9b1){var _0x42d6ff=_0x28edb5||client;return _0x42d6ff[_0x7867('0x14')](_0x56b0c1,_0x4823e0)[_0x7867('0x15')](function(_0x34f6f5){logger[_0x7867('0x16')](_0x7867('0x17'),_0xd0f227,_0x7867('0x18'));logger['debug'](_0x7867('0x19'),_0xd0f227,'request\x20sent',JSON[_0x7867('0x1a')](_0x34f6f5));if(_0x34f6f5[_0x7867('0x1b')]){if(_0x34f6f5['error'][_0x7867('0x1c')]===0x1f4){logger[_0x7867('0x1b')](_0x7867('0x17'),_0xd0f227,_0x34f6f5[_0x7867('0x1b')]['message']);return _0x4ac9b1(_0x34f6f5[_0x7867('0x1b')]['message']);}logger['error'](_0x7867('0x17'),_0xd0f227,_0x34f6f5[_0x7867('0x1b')][_0x7867('0x1d')]);return _0x4bbb8b(_0x34f6f5['error'][_0x7867('0x1d')]);}else{logger[_0x7867('0x16')](_0x7867('0x17'),_0xd0f227,_0x7867('0x18'));_0x4bbb8b(_0x34f6f5[_0x7867('0x1e')][_0x7867('0x1d')]);}})['catch'](function(_0x5a3ad3){logger[_0x7867('0x1b')](_0x7867('0x17'),_0xd0f227,_0x5a3ad3);_0x4ac9b1(_0x5a3ad3);});});}function respondWithResult(_0x4c1b29,_0x12743b){_0x12743b=_0x12743b||0xc8;return function(_0xdf44ff){if(_0xdf44ff){return _0x4c1b29[_0x7867('0x1f')](_0x12743b)[_0x7867('0x20')](_0xdf44ff);}};}function respondWithFilteredResult(_0x3348af,_0x1413e7){return function(_0x19235a){if(_0x19235a){var _0x5dd049=typeof _0x1413e7[_0x7867('0x21')]===_0x7867('0x22')&&typeof _0x1413e7[_0x7867('0x23')]===_0x7867('0x22');var _0xda4452=_0x19235a[_0x7867('0x24')];var _0x1d4238=_0x5dd049?0x0:_0x1413e7[_0x7867('0x21')];var _0x24bfa9=_0x5dd049?_0x19235a[_0x7867('0x24')]:_0x1413e7[_0x7867('0x21')]+_0x1413e7['limit'];var _0x4e26bf;if(_0x24bfa9>=_0xda4452){_0x24bfa9=_0xda4452;_0x4e26bf=0xc8;}else{_0x4e26bf=0xce;}_0x3348af[_0x7867('0x1f')](_0x4e26bf);return _0x3348af[_0x7867('0x25')](_0x7867('0x26'),_0x1d4238+'-'+_0x24bfa9+'/'+_0xda4452)['json'](_0x19235a);}return null;};}function saveUpdates(_0x4ef68a){return function(_0x10c897){if(_0x10c897){return _0x10c897[_0x7867('0x27')](_0x4ef68a)[_0x7867('0x15')](function(_0x3c70cc){return _0x3c70cc;});}return null;};}function removeEntity(_0x2f10f7){return function(_0x1cc5a1){if(_0x1cc5a1){return _0x1cc5a1[_0x7867('0x28')]()[_0x7867('0x15')](function(){_0x2f10f7[_0x7867('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33e65c){return function(_0x436387){if(!_0x436387){_0x33e65c[_0x7867('0x29')](0x194);}return _0x436387;};}function handleError(_0x3833b4,_0x36deb0){_0x36deb0=_0x36deb0||0x1f4;return function(_0x2683ac){logger[_0x7867('0x1b')](_0x2683ac['stack']);if(_0x2683ac[_0x7867('0x2a')]){delete _0x2683ac[_0x7867('0x2a')];}_0x3833b4[_0x7867('0x1f')](_0x36deb0)[_0x7867('0x2b')](_0x2683ac);};}exports[_0x7867('0x2c')]=function(_0x1df434,_0x2cea67){var _0x5b1304={},_0x14b286={},_0x3a7dab={'count':0x0,'rows':[]};var _0x515fca=_[_0x7867('0x2d')](db[_0x7867('0x2e')][_0x7867('0x2f')],function(_0x497773){return{'name':_0x497773[_0x7867('0x30')],'type':_0x497773[_0x7867('0x31')][_0x7867('0x32')]};});_0x14b286[_0x7867('0x33')]=_[_0x7867('0x2d')](_0x515fca,_0x7867('0x2a'));_0x14b286['query']=_['keys'](_0x1df434[_0x7867('0x34')]);_0x14b286[_0x7867('0x35')]=_[_0x7867('0x36')](_0x14b286[_0x7867('0x33')],_0x14b286[_0x7867('0x34')]);_0x5b1304[_0x7867('0x37')]=_[_0x7867('0x36')](_0x14b286[_0x7867('0x33')],qs[_0x7867('0x38')](_0x1df434['query'][_0x7867('0x38')]));_0x5b1304[_0x7867('0x37')]=_0x5b1304[_0x7867('0x37')][_0x7867('0x39')]?_0x5b1304['attributes']:_0x14b286[_0x7867('0x33')];if(!_0x1df434[_0x7867('0x34')]['hasOwnProperty']('nolimit')){_0x5b1304['limit']=qs[_0x7867('0x23')](_0x1df434['query']['limit']);_0x5b1304[_0x7867('0x21')]=qs[_0x7867('0x21')](_0x1df434[_0x7867('0x34')][_0x7867('0x21')]);}_0x5b1304[_0x7867('0x3a')]=qs[_0x7867('0x3b')](_0x1df434[_0x7867('0x34')][_0x7867('0x3b')]);_0x5b1304[_0x7867('0x3c')]=qs['filters'](_[_0x7867('0x3d')](_0x1df434[_0x7867('0x34')],_0x14b286[_0x7867('0x35')]),_0x515fca);if(_0x1df434[_0x7867('0x34')][_0x7867('0x3e')]){_0x5b1304['where']=_['merge'](_0x5b1304['where'],{'$or':_['map'](_0x515fca,function(_0x548547){if(_0x548547[_0x7867('0x31')]!==_0x7867('0x3f')){var _0x363f71={};_0x363f71[_0x548547[_0x7867('0x2a')]]={'$like':'%'+_0x1df434[_0x7867('0x34')][_0x7867('0x3e')]+'%'};return _0x363f71;}})});}_0x5b1304=_[_0x7867('0x40')]({},_0x5b1304,_0x1df434[_0x7867('0x41')]);var _0x3fd9e9={'where':_0x5b1304['where']};return db[_0x7867('0x2e')][_0x7867('0x24')](_0x3fd9e9)[_0x7867('0x15')](function(_0x4ffa1a){_0x3a7dab[_0x7867('0x24')]=_0x4ffa1a;if(_0x1df434[_0x7867('0x34')][_0x7867('0x42')]){_0x5b1304[_0x7867('0x43')]=[{'all':!![]}];}return db[_0x7867('0x2e')]['findAll'](_0x5b1304);})[_0x7867('0x15')](function(_0x43229f){_0x3a7dab[_0x7867('0x44')]=_0x43229f;return _0x3a7dab;})['then'](respondWithFilteredResult(_0x2cea67,_0x5b1304))['catch'](handleError(_0x2cea67,null));};exports[_0x7867('0x45')]=function(_0x5d7b1f,_0x37495b){var _0x3635bb={'raw':!![],'where':{'id':_0x5d7b1f[_0x7867('0x46')]['id']}},_0x2d9601={};_0x2d9601[_0x7867('0x33')]=_['keys'](db['MailMessage'][_0x7867('0x2f')]);_0x2d9601['query']=_['keys'](_0x5d7b1f[_0x7867('0x34')]);_0x2d9601['filters']=_[_0x7867('0x36')](_0x2d9601[_0x7867('0x33')],_0x2d9601[_0x7867('0x34')]);_0x3635bb[_0x7867('0x37')]=_[_0x7867('0x36')](_0x2d9601[_0x7867('0x33')],qs[_0x7867('0x38')](_0x5d7b1f[_0x7867('0x34')][_0x7867('0x38')]));_0x3635bb['attributes']=_0x3635bb[_0x7867('0x37')][_0x7867('0x39')]?_0x3635bb['attributes']:_0x2d9601[_0x7867('0x33')];if(_0x5d7b1f['query'][_0x7867('0x42')]){_0x3635bb[_0x7867('0x43')]=[{'all':!![]}];}_0x3635bb=_[_0x7867('0x40')]({},_0x3635bb,_0x5d7b1f[_0x7867('0x41')]);return db[_0x7867('0x2e')]['find'](_0x3635bb)[_0x7867('0x15')](handleEntityNotFound(_0x37495b,null))[_0x7867('0x15')](respondWithResult(_0x37495b,null))[_0x7867('0x47')](handleError(_0x37495b,null));};exports[_0x7867('0x27')]=function(_0x42c935,_0x8ea4b4){if(_0x42c935[_0x7867('0x48')]['id']){delete _0x42c935[_0x7867('0x48')]['id'];}return db[_0x7867('0x2e')][_0x7867('0x49')]({'where':{'id':_0x42c935['params']['id']}})[_0x7867('0x15')](handleEntityNotFound(_0x8ea4b4,null))[_0x7867('0x15')](saveUpdates(_0x42c935[_0x7867('0x48')],null))['then'](respondWithResult(_0x8ea4b4,null))[_0x7867('0x47')](handleError(_0x8ea4b4,null));};exports[_0x7867('0x28')]=function(_0x2dfe40,_0x87653d){return db[_0x7867('0x2e')][_0x7867('0x49')]({'where':{'id':_0x2dfe40['params']['id']}})[_0x7867('0x15')](handleEntityNotFound(_0x87653d,null))[_0x7867('0x15')](removeEntity(_0x87653d,null))[_0x7867('0x47')](handleError(_0x87653d,null));};exports[_0x7867('0x4a')]=function(_0x8de728,_0xdf6de7){return db[_0x7867('0x2e')][_0x7867('0x4a')]()[_0x7867('0x15')](respondWithResult(_0xdf6de7,null))[_0x7867('0x47')](handleError(_0xdf6de7,null));};exports['create']=function(_0x21defe,_0x22fadf){return db[_0x7867('0x2e')][_0x7867('0x4b')](_0x21defe['body'])[_0x7867('0x15')](function(_0xd6c418){if(_0xd6c418){if(_0xd6c418[_0x7867('0x4c')]===_0x7867('0x4d')&&!_0xd6c418['secret']){var _0x2c4f1e,_0x471ae2,_0x2066cc;if(_0x21defe[_0x7867('0x48')]['to']){_0x471ae2=_0x21defe['body']['to'][_0x7867('0x4e')](',')[0x0];}return db['MailAccount'][_0x7867('0x4f')]({'where':{'id':_0xd6c418['MailAccountId']},'include':[{'model':db[_0x7867('0x50')],'as':_0x7867('0x51'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x471ae2},'limit':0x1,'order':[[_0x7867('0x52'),_0x7867('0x53')]]}]},{'model':db[_0x7867('0x54')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x7867('0x55'),'raw':!![]}]}]})['then'](function(_0x2e22e8){_0x2c4f1e=_0x2e22e8;if(!_0x2c4f1e||!_0x2c4f1e[_0x7867('0x56')])return;var _0x541d15=_0x2c4f1e[_0x7867('0x57')]();if(_0x21defe[_0x7867('0x48')][_0x7867('0x58')]&&_0x21defe['body'][_0x7867('0x58')]['length']){for(var _0x3d7e28=0x0;_0x3d7e28<_0x21defe[_0x7867('0x48')]['attachments']['length'];_0x3d7e28+=0x1){_0x21defe[_0x7867('0x48')]['attachments'][_0x3d7e28]={'filename':_0x21defe[_0x7867('0x48')]['attachments'][_0x3d7e28][_0x7867('0x2a')],'path':path[_0x7867('0x59')](config[_0x7867('0x5a')],_0x7867('0x5b'),_0x21defe[_0x7867('0x48')][_0x7867('0x58')][_0x3d7e28][_0x7867('0x5c')])};}}_0x2066cc={'account':_0x541d15,'message':_0x21defe['body']};return;})[_0x7867('0x15')](function(){if(_0x2c4f1e[_0x7867('0x51')]){if(_0x2c4f1e[_0x7867('0x51')]['Contacts'][_0x7867('0x39')]){return _0x2c4f1e[_0x7867('0x51')][_0x7867('0x5d')][0x0];}else{return db['CmContact']['create'](_[_0x7867('0x5e')](_0x21defe[_0x7867('0x48')],{'firstName':_0x21defe[_0x7867('0x48')]['to'],'email':_0x21defe['body']['to'],'phone':_0x21defe['body']['to'],'ListId':_0x2c4f1e[_0x7867('0x5f')]}));}}else{throw new Error(_0x7867('0x60'));}})[_0x7867('0x15')](function(){if(_0x2066cc){return respondWithRpcPromise(_0x7867('0x61'),'sendMail',_0x2066cc,client9003)[_0x7867('0x15')](function(_0x39e2c4){return _0xd6c418[_0x7867('0x27')]({'read':!![],'messageId':_0x39e2c4['messageId'],'sentAt':moment()[_0x7867('0x62')](_0x7867('0x63'))});})['catch'](function(_0x3de761){logger[_0x7867('0x1b')]('%s',JSON['stringify'](_0x3de761));return _0xd6c418;});}return _0xd6c418;});}return _0xd6c418;}})[_0x7867('0x15')](respondWithResult(_0x22fadf,0xc9))[_0x7867('0x47')](handleError(_0x22fadf,null));};exports[_0x7867('0x64')]=function(_0x292f6c,_0x417b98){var _0x127bbe={'agent':{},'channel':_0x7867('0x65')};if(_0x292f6c[_0x7867('0x48')]['id']){delete _0x292f6c[_0x7867('0x48')]['id'];}_0x292f6c[_0x7867('0x48')]['read']=!![];_0x292f6c[_0x7867('0x48')][_0x7867('0x66')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x292f6c[_0x7867('0x48')]['UserId']=_0x292f6c[_0x7867('0x48')][_0x7867('0x67')]||_0x292f6c[_0x7867('0x68')]['id'];_0x127bbe['agent']['id']=_0x292f6c[_0x7867('0x48')][_0x7867('0x67')];return db[_0x7867('0x2e')]['find']({'where':{'id':_0x292f6c[_0x7867('0x46')]['id'],'UserId':null}})[_0x7867('0x15')](handleEntityNotFound(_0x417b98,null))['then'](saveUpdates(_0x292f6c[_0x7867('0x48')],null))[_0x7867('0x15')](function(_0x483099){if(_0x483099){_0x127bbe[_0x7867('0x1d')]=_0x483099[_0x7867('0x69')]({'plain':!![]});return db[_0x7867('0x6a')][_0x7867('0x49')]({'where':{'id':_0x483099[_0x7867('0x6b')]}});}return null;})[_0x7867('0x15')](handleEntityNotFound(_0x417b98,null))[_0x7867('0x15')](function(_0x301f84){if(_0x301f84){return _0x301f84['update']({'UserId':_0x292f6c[_0x7867('0x48')][_0x7867('0x67')],'read1stAt':_[_0x7867('0x6c')](_0x301f84['read1stAt'])?moment()[_0x7867('0x62')](_0x7867('0x63')):undefined});}return null;})[_0x7867('0x15')](function(_0x5033e5){if(_0x5033e5){_0x127bbe[_0x7867('0x6d')]=_0x5033e5[_0x7867('0x69')]({'plain':!![]});interaction_log[_0x7867('0x16')](_0x7867('0x6e'),_0x292f6c['user']['id'],_0x292f6c[_0x7867('0x68')][_0x7867('0x2a')],_0x292f6c[_0x7867('0x68')][_0x7867('0x6f')],_0x127bbe[_0x7867('0x6d')]['id'],_0x292f6c[_0x7867('0x48')]?JSON[_0x7867('0x1a')](_0x292f6c[_0x7867('0x48')]):_0x7867('0x70'));return respondWithRpcPromise(_0x7867('0x71'),_0x7867('0x72'),_0x127bbe);}return null;})[_0x7867('0x15')](function(_0x5505d6){var _0xfd18e3=_0x7867('0x73')+_0x5505d6[_0x7867('0x1d')]['ContactId'];return db[_0x7867('0x74')][_0x7867('0x34')](_0xfd18e3,{'type':db[_0x7867('0x75')][_0x7867('0x76')][_0x7867('0x77')],'raw':!![]})[_0x7867('0x15')](function(_0x317e57){return _0x317e57;});})[_0x7867('0x15')](function(_0x59cdee){if(_0x59cdee){_0x127bbe['message'][_0x7867('0x78')]=_0x59cdee[0x0];if(!_0x292f6c[_0x7867('0x48')][_0x7867('0x67')])return;return db[_0x7867('0x79')]['find']({'where':{'id':_0x292f6c[_0x7867('0x48')][_0x7867('0x67')],'role':_0x7867('0x7a')},'attributes':['id',_0x7867('0x2a'),'fullname',_0x7867('0x7b'),_0x7867('0x7c')],'raw':!![]});}return null;})[_0x7867('0x15')](function(_0x3b82bd){if(!_0x3b82bd)return null;_0x127bbe[_0x7867('0x1d')][_0x7867('0x7a')]=_0x3b82bd;return _0x127bbe;})[_0x7867('0x15')](function(_0x41356e){if(_0x41356e){if(_0x292f6c[_0x7867('0x48')]['manual']){_0x127bbe[_0x7867('0x1d')][_0x7867('0x7d')]=util[_0x7867('0x62')](_0x7867('0x7e'),_0x292f6c['user'][_0x7867('0x2a')]);_0x127bbe[_0x7867('0x1d')]['channel']=_0x127bbe[_0x7867('0x7f')];_0x127bbe['message']['motionChannel']=_0x127bbe[_0x7867('0x7f')];_0x127bbe[_0x7867('0x1d')][_0x7867('0x80')]=_0x7867('0x64');_0x127bbe['message']['body']=htmlToText[_0x7867('0x81')](_0x127bbe['message']['body']);return respondWithRpcPromise('EventManager',_0x7867('0x82'),{'event':_0x7867('0x83'),'message':_0x127bbe['message']},client9002)['then'](function(){return _0x127bbe;});}return _0x127bbe;}return null;})['then'](respondWithResult(_0x417b98,null))[_0x7867('0x47')](handleError(_0x417b98,null));};exports[_0x7867('0x84')]=function(_0x254d8d,_0x45ed9a){var _0x5cbaac={'agent':{},'channel':_0x7867('0x65')};if(_0x254d8d['body']['id']){delete _0x254d8d[_0x7867('0x48')]['id'];}_0x254d8d[_0x7867('0x48')][_0x7867('0x67')]=_0x254d8d['body'][_0x7867('0x67')]||_0x254d8d[_0x7867('0x68')]['id'];_0x5cbaac['agent']['id']=_0x254d8d[_0x7867('0x48')][_0x7867('0x67')];return db[_0x7867('0x2e')]['find']({'where':{'id':_0x254d8d[_0x7867('0x46')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x45ed9a,null))[_0x7867('0x15')](function(_0xbc4211){if(_0xbc4211){_0x5cbaac[_0x7867('0x1d')]=_0xbc4211['get']({'plain':!![]});return db[_0x7867('0x6a')][_0x7867('0x49')]({'where':{'id':_0xbc4211['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x45ed9a,null))[_0x7867('0x15')](function(_0x3cc915){if(_0x3cc915){_0x5cbaac[_0x7867('0x6d')]=_0x3cc915[_0x7867('0x69')]({'plain':!![]});interaction_log[_0x7867('0x16')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x254d8d[_0x7867('0x68')]['id'],_0x254d8d[_0x7867('0x68')]['name'],_0x254d8d['user'][_0x7867('0x6f')],_0x5cbaac[_0x7867('0x6d')]['id'],_0x254d8d[_0x7867('0x48')]?JSON['stringify'](_0x254d8d[_0x7867('0x48')]):_0x7867('0x70'));return respondWithRpcPromise(_0x7867('0x85'),_0x7867('0x86'),_0x5cbaac);}return null;})[_0x7867('0x15')](function(_0x5699a1){var _0xf4123d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5699a1[_0x7867('0x1d')]['ContactId'];return db['sequelize'][_0x7867('0x34')](_0xf4123d,{'type':db[_0x7867('0x75')][_0x7867('0x76')][_0x7867('0x77')],'raw':!![]})['then'](function(_0x59166a){return _0x59166a;});})[_0x7867('0x15')](function(_0x2ec444){if(_0x2ec444){_0x5cbaac[_0x7867('0x1d')][_0x7867('0x78')]=_0x2ec444[0x0];if(!_0x254d8d[_0x7867('0x48')][_0x7867('0x67')])return;return db[_0x7867('0x79')][_0x7867('0x49')]({'where':{'id':_0x254d8d['body'][_0x7867('0x67')],'role':_0x7867('0x7a')},'attributes':['id',_0x7867('0x2a'),_0x7867('0x87'),_0x7867('0x7b'),'internal'],'raw':!![]});}return null;})[_0x7867('0x15')](function(_0x467b4d){if(!_0x467b4d)return null;_0x5cbaac['message'][_0x7867('0x7a')]=_0x467b4d;return _0x5cbaac;})[_0x7867('0x15')](function(_0x43c7df){if(_0x43c7df){_0x43c7df['message'][_0x7867('0x7d')]=util[_0x7867('0x62')](_0x7867('0x7e'),_0x254d8d[_0x7867('0x68')][_0x7867('0x2a')]);_0x43c7df['message'][_0x7867('0x7f')]=_0x5cbaac[_0x7867('0x7f')];_0x43c7df[_0x7867('0x1d')][_0x7867('0x88')]=_0x5cbaac['channel'];_0x43c7df['message'][_0x7867('0x80')]=_0x7867('0x84');_0x43c7df[_0x7867('0x1d')][_0x7867('0x48')]=htmlToText['fromString'](_0x5cbaac['message']['body']);respondWithRpcPromise(_0x7867('0x82'),_0x7867('0x82'),{'event':_0x7867('0x89'),'message':_0x43c7df[_0x7867('0x1d')]},client9002);return _0x5cbaac;}return null;})['then'](respondWithResult(_0x45ed9a,null))[_0x7867('0x47')](handleError(_0x45ed9a,null));};exports[_0x7867('0x8a')]=function(_0x1fdd76,_0x4b7231){var _0x2395f6=moment()[_0x7867('0x8b')]()[_0x7867('0x8c')]();var _0x2207e4=path[_0x7867('0x59')](config[_0x7867('0x5a')],_0x7867('0x8d'),_0x7867('0x8e'),_0x7867('0x8f'));var _0x36f06d=path['join'](config[_0x7867('0x5a')],_0x7867('0x8d'),_0x7867('0x8e'),_0x7867('0x58'));var _0x181ddb=util[_0x7867('0x62')](_0x7867('0x90'),_0x2395f6);return db[_0x7867('0x2e')][_0x7867('0x49')]({'where':{'id':_0x1fdd76['params']['id']},'attributes':['id',_0x7867('0x48'),_0x7867('0x91'),'to','cc',_0x7867('0x92'),_0x7867('0x93'),_0x7867('0x94')],'include':_0x1fdd76['query'][_0x7867('0x58')]?[{'model':db[_0x7867('0x95')],'as':_0x7867('0x96')}]:undefined})['then'](handleEntityNotFound(_0x4b7231,null))[_0x7867('0x15')](function(_0x3b3d12){if(_0x3b3d12){var _0x3219b7=_0x3b3d12;var _0x3d2532={'from':_0x3219b7['from'],'to':_0x3219b7['to'],'subject':_0x3219b7[_0x7867('0x93')],'html':htmlEntities[_0x7867('0x97')](_0x3219b7[_0x7867('0x48')]),'headers':{'Date':moment(_0x3219b7[_0x7867('0x94')])[_0x7867('0x62')](_0x7867('0x98'))},'attachments':[]};if(_0x3b3d12['cc']){_0x3d2532['headers']['Cc']=_0x3b3d12['cc'];}if(_0x3b3d12[_0x7867('0x92')]){_0x3d2532['headers'][_0x7867('0x99')]=_0x3b3d12[_0x7867('0x92')];}return new BPromise(function(_0xdfff78,_0x761da9){if(_0x3b3d12['Attachments']){for(var _0xcba0c6=0x0;_0xcba0c6<_0x3b3d12['Attachments']['length'];_0xcba0c6++){var _0x15bd4e=_0x3b3d12[_0x7867('0x96')][_0xcba0c6];var _0x4422c0=path[_0x7867('0x59')](_0x36f06d,_0x15bd4e[_0x7867('0x5c')]);if(fs['existsSync'](_0x4422c0)){_0x3d2532['attachments'][_0x7867('0x9a')]({'name':_0x15bd4e['name'],'contentType':_0x15bd4e[_0x7867('0x31')],'data':fs['readFileSync'](_0x4422c0)});}}}emlformat['build'](_0x3d2532,function(_0x31f380,_0x2d0a04){if(_0x31f380)return _0x761da9(_0x31f380);fs[_0x7867('0x9b')](path[_0x7867('0x59')](_0x2207e4,_0x181ddb),_0x2d0a04);return _0xdfff78(_0x2d0a04);});});}})[_0x7867('0x15')](function(_0x4e5c83){if(_0x4e5c83){return _0x4b7231[_0x7867('0x8a')](path[_0x7867('0x59')](_0x2207e4,_0x181ddb),_0x181ddb,function(_0x524502){if(!_0x524502)fs['unlinkSync'](path[_0x7867('0x59')](_0x2207e4,_0x181ddb));});}})['catch'](handleError(_0x4b7231,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 8f07bef..7aaa132 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 _0xf448=['MailMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0xe62388,_0x20a8dc){var _0x364a83=function(_0x3c3718){while(--_0x3c3718){_0xe62388['push'](_0xe62388['shift']());}};_0x364a83(++_0x20a8dc);}(_0xf448,0x1dc));var _0x8f44=function(_0x2fbb34,_0x358b15){_0x2fbb34=_0x2fbb34-0x0;var _0x26914a=_0xf448[_0x2fbb34];return _0x26914a;};'use strict';var EventEmitter=require(_0x8f44('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x8f44('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x8f44('0x2')](0x0);var events={'afterCreate':_0x8f44('0x3'),'afterUpdate':_0x8f44('0x4'),'afterDestroy':_0x8f44('0x5')};function emitEvent(_0x3f84ae){return function(_0x2756b6,_0x314b1d,_0x394c2d){MailMessageEvents[_0x8f44('0x6')](_0x3f84ae+':'+_0x2756b6['id'],_0x2756b6);MailMessageEvents['emit'](_0x3f84ae,_0x2756b6);_0x394c2d(null);};}for(var e in events){if(events[_0x8f44('0x7')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x8f44('0x8')]=MailMessageEvents; \ No newline at end of file +var _0xf0f3=['save','emit','hasOwnProperty','events','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x4b33c7,_0x4c7837){var _0x4adaff=function(_0x7eb867){while(--_0x7eb867){_0x4b33c7['push'](_0x4b33c7['shift']());}};_0x4adaff(++_0x4c7837);}(_0xf0f3,0x1ae));var _0x3f0f=function(_0x38966c,_0x3c6726){_0x38966c=_0x38966c-0x0;var _0x428657=_0xf0f3[_0x38966c];return _0x428657;};'use strict';var EventEmitter=require(_0x3f0f('0x0'));var MailMessage=require(_0x3f0f('0x1'))['db'][_0x3f0f('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x3f0f('0x3')](0x0);var events={'afterCreate':_0x3f0f('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x332fd0){return function(_0x43b529,_0x55f377,_0x5b165a){MailMessageEvents['emit'](_0x332fd0+':'+_0x43b529['id'],_0x43b529);MailMessageEvents[_0x3f0f('0x5')](_0x332fd0,_0x43b529);_0x5b165a(null);};}for(var e in events){if(events[_0x3f0f('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index f14219e..dc8cb7a 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 _0xf4dc=['FULLTEXT','body','fromString','get','direction','toLowerCase','out','isNil','UserId','MailInteraction','findOne','then','update','createdAt','catch','error','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xf4dc,0x95));var _0xcf4d=function(_0x4ce618,_0x1b3ac0){_0x4ce618=_0x4ce618-0x0;var _0x158e12=_0xf4dc[_0x4ce618];return _0x158e12;};'use strict';var _=require('lodash');var util=require(_0xcf4d('0x0'));var logger=require(_0xcf4d('0x1'))(_0xcf4d('0x2'));var moment=require(_0xcf4d('0x3'));var BPromise=require(_0xcf4d('0x4'));var rp=require(_0xcf4d('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xcf4d('0x6'));var rimraf=require(_0xcf4d('0x7'));var config=require('../../config/environment');var attributes=require('./mailMessage.attributes');module[_0xcf4d('0x8')]=function(_0x3158b6,_0x33a46f){return _0x3158b6[_0xcf4d('0x9')](_0xcf4d('0xa'),attributes,{'tableName':_0xcf4d('0xb'),'paranoid':![],'indexes':[{'name':_0xcf4d('0xc'),'fields':['messageId']},{'name':_0xcf4d('0xd'),'fields':[_0xcf4d('0xe'),_0xcf4d('0xf')],'type':_0xcf4d('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3dc138,_0x255c7d,_0x52556b){if(_0x3dc138[_0xcf4d('0x11')]){_0x3dc138['plainBody']=htmlToText[_0xcf4d('0x12')](_0x3dc138[_0xcf4d('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x52556b(null,_0x255c7d);},'afterCreate':function(_0x362474,_0x3cd38d,_0x4f491b){var _0x586c84=_0x3158b6['models'];var _0x556155=_0x362474[_0xcf4d('0x13')]({'plain':!![]});if(_0x556155[_0xcf4d('0x14')]['toLowerCase']()==='in'||_0x556155[_0xcf4d('0x14')][_0xcf4d('0x15')]()===_0xcf4d('0x16')&&!_0x556155['secret']&&!_[_0xcf4d('0x17')](_0x556155[_0xcf4d('0x18')])){_0x586c84[_0xcf4d('0x19')][_0xcf4d('0x1a')]({'where':{'id':_0x556155['MailInteractionId']}})[_0xcf4d('0x1b')](function(_0x313fc7){if(_0x313fc7){_0x313fc7[_0xcf4d('0x1c')]({'lastMsgAt':_0x556155[_0xcf4d('0x1d')],'lastMsgDirection':_0x556155[_0xcf4d('0x14')][_0xcf4d('0x15')]()});}})[_0xcf4d('0x1e')](function(_0x497491){console[_0xcf4d('0x1f')](_0x497491);});}_0x4f491b();}},'charset':_0xcf4d('0x20'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x92c5=['messageId','fti_mail_messages','plainBody','subject','FULLTEXT','models','toLowerCase','direction','out','UserId','MailInteraction','findOne','MailInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','../../config/environment','./mailMessage.attributes','define','MailMessage','mail_messages'];(function(_0x17406e,_0x1049fd){var _0x2bfc5a=function(_0x2aae05){while(--_0x2aae05){_0x17406e['push'](_0x17406e['shift']());}};_0x2bfc5a(++_0x1049fd);}(_0x92c5,0xb8));var _0x592c=function(_0x1a6588,_0x1fea73){_0x1a6588=_0x1a6588-0x0;var _0x109b37=_0x92c5[_0x1a6588];return _0x109b37;};'use strict';var _=require(_0x592c('0x0'));var util=require(_0x592c('0x1'));var logger=require(_0x592c('0x2'))(_0x592c('0x3'));var moment=require(_0x592c('0x4'));var BPromise=require(_0x592c('0x5'));var rp=require(_0x592c('0x6'));var htmlToText=require(_0x592c('0x7'));var fs=require('fs');var path=require(_0x592c('0x8'));var rimraf=require('rimraf');var config=require(_0x592c('0x9'));var attributes=require(_0x592c('0xa'));module['exports']=function(_0x353a92,_0x4b3858){return _0x353a92[_0x592c('0xb')](_0x592c('0xc'),attributes,{'tableName':_0x592c('0xd'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x592c('0xe')]},{'name':_0x592c('0xf'),'fields':[_0x592c('0x10'),_0x592c('0x11')],'type':_0x592c('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x450790,_0x1104a9,_0x531b73){if(_0x450790['body']){_0x450790[_0x592c('0x10')]=htmlToText['fromString'](_0x450790['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x531b73(null,_0x1104a9);},'afterCreate':function(_0xb61ce7,_0x36c360,_0xffc654){var _0x1c4891=_0x353a92[_0x592c('0x13')];var _0x3f712d=_0xb61ce7['get']({'plain':!![]});if(_0x3f712d['direction'][_0x592c('0x14')]()==='in'||_0x3f712d[_0x592c('0x15')][_0x592c('0x14')]()===_0x592c('0x16')&&!_0x3f712d['secret']&&!_['isNil'](_0x3f712d[_0x592c('0x17')])){_0x1c4891[_0x592c('0x18')][_0x592c('0x19')]({'where':{'id':_0x3f712d[_0x592c('0x1a')]}})[_0x592c('0x1b')](function(_0x28d990){if(_0x28d990){_0x28d990['update']({'lastMsgAt':_0x3f712d[_0x592c('0x1c')],'lastMsgDirection':_0x3f712d[_0x592c('0x15')][_0x592c('0x14')]()});}})[_0x592c('0x1d')](function(_0x39ae4f){console[_0x592c('0x1e')](_0x39ae4f);});}_0xffc654();}},'charset':_0x592c('0x1f'),'collate':_0x592c('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 1b91b28..ab9140e 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 _0x47c5=['request','then','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','MailMessage','create','options','info','debug','CreateMailMessage','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register'];(function(_0x148645,_0x249915){var _0x43eed6=function(_0xac384b){while(--_0xac384b){_0x148645['push'](_0x148645['shift']());}};_0x43eed6(++_0x249915);}(_0x47c5,0x165));var _0x547c=function(_0x313d6f,_0x122c8d){_0x313d6f=_0x313d6f-0x0;var _0x2059ac=_0x47c5[_0x313d6f];return _0x2059ac;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});config[_0x547c('0xb')]=_[_0x547c('0xc')](config[_0x547c('0xb')],{'host':_0x547c('0xd'),'port':0x18eb});var socket=require(_0x547c('0xe'))(new Redis(config[_0x547c('0xb')]));require(_0x547c('0xf'))[_0x547c('0x10')](socket);function respondWithRpcPromise(_0x44a581,_0x72828d,_0x2c54e){return new BPromise(function(_0x111457,_0x2455e9){return client[_0x547c('0x11')](_0x44a581,_0x2c54e)[_0x547c('0x12')](function(_0x44ab17){logger['info'](_0x547c('0x13'),_0x72828d,_0x547c('0x14'));logger['debug'](_0x547c('0x15'),_0x72828d,_0x547c('0x14'),JSON[_0x547c('0x16')](_0x44ab17));if(_0x44ab17[_0x547c('0x17')]){if(_0x44ab17[_0x547c('0x17')][_0x547c('0x18')]===0x1f4){logger[_0x547c('0x17')](_0x547c('0x13'),_0x72828d,_0x44ab17[_0x547c('0x17')][_0x547c('0x19')]);return _0x2455e9(_0x44ab17[_0x547c('0x17')][_0x547c('0x19')]);}logger[_0x547c('0x17')](_0x547c('0x13'),_0x72828d,_0x44ab17[_0x547c('0x17')][_0x547c('0x19')]);return _0x111457(_0x44ab17[_0x547c('0x17')][_0x547c('0x19')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x72828d,_0x547c('0x14'));_0x111457(_0x44ab17[_0x547c('0x1a')][_0x547c('0x19')]);}})['catch'](function(_0x248aca){logger[_0x547c('0x17')](_0x547c('0x13'),_0x72828d,_0x248aca);_0x2455e9(_0x248aca);});});}exports['CreateMailMessage']=function(_0x4511d3){var _0x41149f=this;return new Promise(function(_0x496c38,_0x5453f9){return db[_0x547c('0x1b')][_0x547c('0x1c')](_0x4511d3['body'],{'raw':_0x4511d3[_0x547c('0x1d')]?_0x4511d3[_0x547c('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x547c('0x12')](function(_0x17fd97){logger[_0x547c('0x1e')]('CreateMailMessage',_0x4511d3);logger[_0x547c('0x1f')](_0x547c('0x20'),_0x4511d3,JSON[_0x547c('0x16')](_0x17fd97));_0x496c38(_0x17fd97);})[_0x547c('0x21')](function(_0x1f3581){logger[_0x547c('0x17')](_0x547c('0x20'),_0x1f3581[_0x547c('0x19')],_0x4511d3);_0x5453f9(_0x41149f['error'](0x1f4,_0x1f3581[_0x547c('0x19')]));});});}; \ No newline at end of file +var _0x93e9=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailMessage.socket','register','request','info','request\x20sent','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','then','debug'];(function(_0x27a997,_0x85f149){var _0x5aa288=function(_0x38f03c){while(--_0x38f03c){_0x27a997['push'](_0x27a997['shift']());}};_0x5aa288(++_0x85f149);}(_0x93e9,0xcc));var _0x993e=function(_0x331ade,_0x149e32){_0x331ade=_0x331ade-0x0;var _0x495b12=_0x93e9[_0x331ade];return _0x495b12;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var moment=require(_0x993e('0x2'));var BPromise=require(_0x993e('0x3'));var rs=require(_0x993e('0x4'));var fs=require('fs');var Redis=require(_0x993e('0x5'));var db=require(_0x993e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x993e('0x7'));var config=require(_0x993e('0x8'));var jayson=require(_0x993e('0x9'));var client=jayson[_0x993e('0xa')][_0x993e('0xb')]({'port':0x232a});config[_0x993e('0xc')]=_[_0x993e('0xd')](config[_0x993e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x993e('0xe'))(new Redis(config[_0x993e('0xc')]));require(_0x993e('0xf'))[_0x993e('0x10')](socket);function respondWithRpcPromise(_0x2cd389,_0x27a28f,_0x1c2324){return new BPromise(function(_0x48291a,_0x196f6d){return client[_0x993e('0x11')](_0x2cd389,_0x1c2324)['then'](function(_0x5ebc8c){logger[_0x993e('0x12')]('MailMessage,\x20%s,\x20%s',_0x27a28f,_0x993e('0x13'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x27a28f,_0x993e('0x13'),JSON[_0x993e('0x14')](_0x5ebc8c));if(_0x5ebc8c[_0x993e('0x15')]){if(_0x5ebc8c[_0x993e('0x15')][_0x993e('0x16')]===0x1f4){logger[_0x993e('0x15')](_0x993e('0x17'),_0x27a28f,_0x5ebc8c[_0x993e('0x15')][_0x993e('0x18')]);return _0x196f6d(_0x5ebc8c[_0x993e('0x15')][_0x993e('0x18')]);}logger[_0x993e('0x15')](_0x993e('0x17'),_0x27a28f,_0x5ebc8c[_0x993e('0x15')][_0x993e('0x18')]);return _0x48291a(_0x5ebc8c[_0x993e('0x15')][_0x993e('0x18')]);}else{logger['info'](_0x993e('0x17'),_0x27a28f,_0x993e('0x13'));_0x48291a(_0x5ebc8c[_0x993e('0x19')][_0x993e('0x18')]);}})[_0x993e('0x1a')](function(_0x3eda77){logger['error'](_0x993e('0x17'),_0x27a28f,_0x3eda77);_0x196f6d(_0x3eda77);});});}exports[_0x993e('0x1b')]=function(_0x1eaf57){var _0x22390e=this;return new Promise(function(_0x130a8a,_0x425ab4){return db[_0x993e('0x1c')][_0x993e('0x1d')](_0x1eaf57['body'],{'raw':_0x1eaf57[_0x993e('0x1e')]?_0x1eaf57['options'][_0x993e('0x1f')]===undefined?!![]:![]:!![]})[_0x993e('0x20')](function(_0x32b09e){logger['info'](_0x993e('0x1b'),_0x1eaf57);logger[_0x993e('0x21')](_0x993e('0x1b'),_0x1eaf57,JSON[_0x993e('0x14')](_0x32b09e));_0x130a8a(_0x32b09e);})[_0x993e('0x1a')](function(_0x328d22){logger[_0x993e('0x15')](_0x993e('0x1b'),_0x328d22[_0x993e('0x18')],_0x1eaf57);_0x425ab4(_0x22390e[_0x993e('0x15')](0x1f4,_0x328d22[_0x993e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index f783af6..0c9d6ed 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 _0x998d=['update','emit','register','length','./mailMessage.events','save','remove'];(function(_0x1a89f3,_0x35d7d4){var _0x4f907a=function(_0x4c7836){while(--_0x4c7836){_0x1a89f3['push'](_0x1a89f3['shift']());}};_0x4f907a(++_0x35d7d4);}(_0x998d,0x11c));var _0xd998=function(_0x52a394,_0x45cdc6){_0x52a394=_0x52a394-0x0;var _0x523cae=_0x998d[_0x52a394];return _0x523cae;};'use strict';var MailMessageEvents=require(_0xd998('0x0'));var events=[_0xd998('0x1'),_0xd998('0x2'),_0xd998('0x3')];function createListener(_0x2de845,_0x581493){return function(_0x3df4fb){_0x581493[_0xd998('0x4')](_0x2de845,_0x3df4fb);};}function removeListener(_0x18566d,_0xa2d4ed){return function(){MailMessageEvents['removeListener'](_0x18566d,_0xa2d4ed);};}exports[_0xd998('0x5')]=function(_0x4bca30){for(var _0x2d3cb8=0x0,_0x1e81ef=events[_0xd998('0x6')];_0x2d3cb8<_0x1e81ef;_0x2d3cb8++){var _0xfd33f8=events[_0x2d3cb8];var _0x40d6a4=createListener('mailMessage:'+_0xfd33f8,_0x4bca30);MailMessageEvents['on'](_0xfd33f8,_0x40d6a4);}}; \ No newline at end of file +var _0x7554=['removeListener','register','length','mailMessage:','./mailMessage.events','remove','emit'];(function(_0x34edba,_0x22b405){var _0x549e92=function(_0x3b091f){while(--_0x3b091f){_0x34edba['push'](_0x34edba['shift']());}};_0x549e92(++_0x22b405);}(_0x7554,0xcf));var _0x4755=function(_0x4db4a9,_0x2993f1){_0x4db4a9=_0x4db4a9-0x0;var _0x3abb2d=_0x7554[_0x4db4a9];return _0x3abb2d;};'use strict';var MailMessageEvents=require(_0x4755('0x0'));var events=['save',_0x4755('0x1'),'update'];function createListener(_0x280867,_0x432012){return function(_0x256e44){_0x432012[_0x4755('0x2')](_0x280867,_0x256e44);};}function removeListener(_0xd296c2,_0x1abd3f){return function(){MailMessageEvents[_0x4755('0x3')](_0xd296c2,_0x1abd3f);};}exports[_0x4755('0x4')]=function(_0x2755e4){for(var _0x30f5e2=0x0,_0x33bacd=events[_0x4755('0x5')];_0x30f5e2<_0x33bacd;_0x30f5e2++){var _0xeeb067=events[_0x30f5e2];var _0x5931b8=createListener(_0x4755('0x6')+_0xeeb067,_0x2755e4);MailMessageEvents['on'](_0xeeb067,_0x5931b8);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 9fe428f..49ad537 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 _0x86a1=['/:id/teams','getTeams','create','post','addTeams','/:id/users','put','update','delete','destroy','removeTeams','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers'];(function(_0x129577,_0x1794e3){var _0x2600d9=function(_0x3e211d){while(--_0x3e211d){_0x129577['push'](_0x129577['shift']());}};_0x2600d9(++_0x1794e3);}(_0x86a1,0x105));var _0x186a=function(_0x2984d0,_0x1a7211){_0x2984d0=_0x2984d0-0x0;var _0x2885f2=_0x86a1[_0x2984d0];return _0x2885f2;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x186a('0x0'));var express=require('express');var router=express[_0x186a('0x1')]();var fs_extra=require(_0x186a('0x2'));var auth=require(_0x186a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x186a('0x4'));var controller=require(_0x186a('0x5'));router[_0x186a('0x6')]('/',auth[_0x186a('0x7')](),controller[_0x186a('0x8')]);router['get'](_0x186a('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x186a('0xa'),auth['isAuthenticated'](),controller[_0x186a('0xb')]);router[_0x186a('0x6')](_0x186a('0xc'),auth['isAuthenticated'](),controller[_0x186a('0xd')]);router['get'](_0x186a('0xe'),auth[_0x186a('0x7')](),controller[_0x186a('0xf')]);router[_0x186a('0x6')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x186a('0x10')]);router[_0x186a('0x11')](_0x186a('0xe'),auth[_0x186a('0x7')](),controller[_0x186a('0x12')]);router[_0x186a('0x11')](_0x186a('0x13'),auth[_0x186a('0x7')](),controller['addAgents']);router[_0x186a('0x14')](_0x186a('0xa'),auth[_0x186a('0x7')](),controller[_0x186a('0x15')]);router[_0x186a('0x16')](_0x186a('0xa'),auth[_0x186a('0x7')](),controller[_0x186a('0x17')]);router['delete'](_0x186a('0xe'),auth[_0x186a('0x7')](),controller[_0x186a('0x18')]);router[_0x186a('0x16')]('/:id/users',auth[_0x186a('0x7')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x5b9f=['post','addTeams','put','/:id','update','destroy','removeTeams','delete','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','get','/describe','describe','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents'];(function(_0x54d7ad,_0x329b88){var _0x171a5f=function(_0xcf4956){while(--_0xcf4956){_0x54d7ad['push'](_0x54d7ad['shift']());}};_0x171a5f(++_0x329b88);}(_0x5b9f,0x17e));var _0xf5b9=function(_0x4d96c4,_0x325e34){_0x4d96c4=_0x4d96c4-0x0;var _0x1dd8fd=_0x5b9f[_0x4d96c4];return _0x1dd8fd;};'use strict';var multer=require(_0xf5b9('0x0'));var util=require('util');var path=require(_0xf5b9('0x1'));var timeout=require(_0xf5b9('0x2'));var express=require(_0xf5b9('0x3'));var router=express[_0xf5b9('0x4')]();var fs_extra=require(_0xf5b9('0x5'));var auth=require(_0xf5b9('0x6'));var interaction=require(_0xf5b9('0x7'));var config=require(_0xf5b9('0x8'));var controller=require(_0xf5b9('0x9'));router['get']('/',auth[_0xf5b9('0xa')](),controller[_0xf5b9('0xb')]);router[_0xf5b9('0xc')](_0xf5b9('0xd'),auth['isAuthenticated'](),controller[_0xf5b9('0xe')]);router[_0xf5b9('0xc')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0xf5b9('0xf'),auth[_0xf5b9('0xa')](),controller[_0xf5b9('0x10')]);router['get'](_0xf5b9('0x11'),auth[_0xf5b9('0xa')](),controller[_0xf5b9('0x12')]);router[_0xf5b9('0xc')](_0xf5b9('0x13'),auth['isAuthenticated'](),controller[_0xf5b9('0x14')]);router[_0xf5b9('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf5b9('0x15')]('/:id/teams',auth[_0xf5b9('0xa')](),controller[_0xf5b9('0x16')]);router[_0xf5b9('0x15')](_0xf5b9('0x13'),auth['isAuthenticated'](),controller['addAgents']);router[_0xf5b9('0x17')](_0xf5b9('0x18'),auth['isAuthenticated'](),controller[_0xf5b9('0x19')]);router['delete'](_0xf5b9('0x18'),auth[_0xf5b9('0xa')](),controller[_0xf5b9('0x1a')]);router['delete'](_0xf5b9('0x11'),auth[_0xf5b9('0xa')](),controller[_0xf5b9('0x1b')]);router[_0xf5b9('0x1c')](_0xf5b9('0x13'),auth['isAuthenticated'](),controller[_0xf5b9('0x1d')]);module[_0xf5b9('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 8d4f0ec..183a29a 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 _0x0a42=['beepall','roundrobin','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x1019e6,_0x3312d1){var _0x5acecc=function(_0x36233d){while(--_0x36233d){_0x1019e6['push'](_0x1019e6['shift']());}};_0x5acecc(++_0x3312d1);}(_0x0a42,0x1ea));var _0x20a4=function(_0xd0c47,_0x18f92a){_0xd0c47=_0xd0c47-0x0;var _0x5e7cca=_0x0a42[_0xd0c47];return _0x5e7cca;};'use strict';var Sequelize=require('sequelize');module[_0x20a4('0x0')]={'name':{'type':Sequelize[_0x20a4('0x1')],'unique':_0x20a4('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x20a4('0x1')]},'timeout':{'type':Sequelize[_0x20a4('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x20a4('0x4')](_0x20a4('0x5'),_0x20a4('0x6'),_0x20a4('0x7'))}}; \ No newline at end of file +var _0xa131=['beepall','roundrobin','exports','STRING','INTEGER','ENUM'];(function(_0x5a4a88,_0x576c2e){var _0x41af68=function(_0xe8e61b){while(--_0xe8e61b){_0x5a4a88['push'](_0x5a4a88['shift']());}};_0x41af68(++_0x576c2e);}(_0xa131,0x182));var _0x1a13=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa131[_0x4c7fb5];return _0x2e10ac;};'use strict';var Sequelize=require('sequelize');module[_0x1a13('0x0')]={'name':{'type':Sequelize[_0x1a13('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1a13('0x1')]},'timeout':{'type':Sequelize[_0x1a13('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1a13('0x3')]('rrmemory',_0x1a13('0x4'),_0x1a13('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 79244be..b747247 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 _0x1746=['updatedAt','createdAt','format','%s/%s','getTeams','Team','Agents','online','voicePause','interface','flatMap','transaction','addTeams','each','findOrCreate','userMailQueue:save','ids','User','select','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','removeTeams','isEmpty','emit','addAgents','spread','removeAgents','isArray','userMailQueue:remove','getAgents','order','nolimit','bluebird','util','lodash','squel','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','register','status','offset','undefined','limit','count','set','update','destroy','then','MailQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','key','getOptions','where','include','query','findAll','rows','show','keys','filters','intersection','attributes','model','fields','length','includeAll','merge','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','sort','pick','MailQueueId','filter','findAndCountAll','UserId','agent','mailPause'];(function(_0x34bf51,_0x3aae95){var _0x2326cb=function(_0x3d3d0f){while(--_0x3d3d0f){_0x34bf51['push'](_0x34bf51['shift']());}};_0x2326cb(++_0x3aae95);}(_0x1746,0x11b));var _0x6174=function(_0x4d278e,_0x2621d3){_0x4d278e=_0x4d278e-0x0;var _0x598224=_0x1746[_0x4d278e];return _0x598224;};'use strict';var BPromise=require(_0x6174('0x0'));var util=require(_0x6174('0x1'));var _=require(_0x6174('0x2'));var squel=require(_0x6174('0x3'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x6174('0x4'))(_0x6174('0x5'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x6174('0x6')]=_[_0x6174('0x7')](config[_0x6174('0x6')],{'host':_0x6174('0x8'),'port':0x18eb});var socket=require(_0x6174('0x9'))(new Redis(config[_0x6174('0x6')]));require('./mailQueue.socket')[_0x6174('0xa')](socket);function respondWithStatusCode(_0x55dd88,_0x482986){_0x482986=_0x482986||0xcc;return function(_0x4ea478){if(_0x4ea478){return _0x55dd88['sendStatus'](_0x482986);}return _0x55dd88[_0x6174('0xb')](_0x482986)['end']();};}function respondWithResult(_0x13430d,_0x24aafe){_0x24aafe=_0x24aafe||0xc8;return function(_0x5e12a6){if(_0x5e12a6){return _0x13430d['status'](_0x24aafe)['json'](_0x5e12a6);}};}function respondWithFilteredResult(_0x16490b,_0x597b53){return function(_0x4adfd7){if(_0x4adfd7){var _0x351e2b=typeof _0x597b53[_0x6174('0xc')]===_0x6174('0xd')&&typeof _0x597b53[_0x6174('0xe')]==='undefined';var _0x1a27cc=_0x4adfd7[_0x6174('0xf')];var _0x4f2e23=_0x351e2b?0x0:_0x597b53['offset'];var _0x5512a2=_0x351e2b?_0x4adfd7[_0x6174('0xf')]:_0x597b53[_0x6174('0xc')]+_0x597b53[_0x6174('0xe')];var _0x1e9f9c;if(_0x5512a2>=_0x1a27cc){_0x5512a2=_0x1a27cc;_0x1e9f9c=0xc8;}else{_0x1e9f9c=0xce;}_0x16490b[_0x6174('0xb')](_0x1e9f9c);return _0x16490b[_0x6174('0x10')]('Content-Range',_0x4f2e23+'-'+_0x5512a2+'/'+_0x1a27cc)['json'](_0x4adfd7);}return null;};}function saveUpdates(_0x330637){return function(_0x5891e8){if(_0x5891e8){return _0x5891e8[_0x6174('0x11')](_0x330637)['then'](function(_0x3e67b8){return _0x3e67b8;});}return null;};}function removeEntity(_0x4ad3e1){return function(_0x3d649c){if(_0x3d649c){return _0x3d649c[_0x6174('0x12')]()[_0x6174('0x13')](function(){var _0x21b9a5=_0x3d649c['get']({'plain':!![]});var _0x4d55b8=_0x6174('0x14');return db[_0x6174('0x15')][_0x6174('0x12')]({'where':{'type':_0x4d55b8,'resourceId':_0x21b9a5['id']}})[_0x6174('0x13')](function(){return _0x3d649c;});})[_0x6174('0x13')](function(){_0x4ad3e1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c226f){return function(_0x58b073){if(!_0x58b073){_0x2c226f[_0x6174('0x16')](0x194);}return _0x58b073;};}function handleError(_0x2e061d,_0x53212b){_0x53212b=_0x53212b||0x1f4;return function(_0x43b162){logger[_0x6174('0x17')](_0x43b162[_0x6174('0x18')]);if(_0x43b162[_0x6174('0x19')]){delete _0x43b162[_0x6174('0x19')];}_0x2e061d['status'](_0x53212b)[_0x6174('0x1a')](_0x43b162);};}exports[_0x6174('0x1b')]=function(_0x3b1fbf,_0x14ad73){var _0x847b6d={};var _0x277963={'count':0x0,'rows':[]};var _0x5a165d=_[_0x6174('0x1c')](db[_0x6174('0x1d')][_0x6174('0x1e')],function(_0x1a7c9f){return{'name':_0x1a7c9f[_0x6174('0x1f')],'type':_0x1a7c9f['type'][_0x6174('0x20')]};});_0x847b6d=qs[_0x6174('0x21')](_0x5a165d,_0x3b1fbf);var _0x89c84c={'where':_0x847b6d[_0x6174('0x22')]};return db[_0x6174('0x1d')][_0x6174('0xf')](_0x89c84c)[_0x6174('0x13')](function(_0x3c58cc){_0x277963[_0x6174('0xf')]=_0x3c58cc;_0x847b6d[_0x6174('0x23')]=qs[_0x6174('0x23')](_0x3b1fbf[_0x6174('0x24')]);return db[_0x6174('0x1d')][_0x6174('0x25')](_0x847b6d);})[_0x6174('0x13')](function(_0x442386){_0x277963[_0x6174('0x26')]=_0x442386;return _0x277963;})[_0x6174('0x13')](respondWithFilteredResult(_0x14ad73,_0x847b6d))['catch'](handleError(_0x14ad73,null));};exports[_0x6174('0x27')]=function(_0x57cb27,_0x2f0ec6){var _0x2e1442={'raw':!![],'where':{'id':_0x57cb27['params']['id']}},_0x577d62={};_0x577d62['model']=_['keys'](db['MailQueue'][_0x6174('0x1e')]);_0x577d62[_0x6174('0x24')]=_[_0x6174('0x28')](_0x57cb27[_0x6174('0x24')]);_0x577d62[_0x6174('0x29')]=_[_0x6174('0x2a')](_0x577d62['model'],_0x577d62[_0x6174('0x24')]);_0x2e1442[_0x6174('0x2b')]=_[_0x6174('0x2a')](_0x577d62[_0x6174('0x2c')],qs[_0x6174('0x2d')](_0x57cb27[_0x6174('0x24')]['fields']));_0x2e1442[_0x6174('0x2b')]=_0x2e1442[_0x6174('0x2b')][_0x6174('0x2e')]?_0x2e1442[_0x6174('0x2b')]:_0x577d62['model'];if(_0x57cb27['query'][_0x6174('0x2f')]){_0x2e1442[_0x6174('0x23')]=[{'all':!![]}];}_0x2e1442=_[_0x6174('0x30')]({},_0x2e1442,_0x57cb27[_0x6174('0x31')]);return db[_0x6174('0x1d')][_0x6174('0x32')](_0x2e1442)[_0x6174('0x13')](handleEntityNotFound(_0x2f0ec6,null))['then'](respondWithResult(_0x2f0ec6,null))[_0x6174('0x33')](handleError(_0x2f0ec6,null));};exports[_0x6174('0x34')]=function(_0x413fa5,_0x23f31b){return db[_0x6174('0x1d')][_0x6174('0x34')](_0x413fa5[_0x6174('0x35')],{})[_0x6174('0x13')](function(_0x52fd15){var _0x4e4d74=_0x413fa5[_0x6174('0x36')]['get']({'plain':!![]});if(!_0x4e4d74)throw new Error(_0x6174('0x37'));if(_0x4e4d74[_0x6174('0x38')]===_0x6174('0x36')){var _0x5de927=_0x52fd15[_0x6174('0x39')]({'plain':!![]});var _0x14c60a=_0x6174('0x14');return db['UserProfileSection'][_0x6174('0x32')]({'where':{'name':_0x14c60a,'userProfileId':_0x4e4d74['userProfileId']},'raw':!![]})[_0x6174('0x13')](function(_0x21550d){if(_0x21550d&&_0x21550d[_0x6174('0x3a')]===0x0){return db['UserProfileResource']['create']({'name':_0x5de927[_0x6174('0x19')],'resourceId':_0x5de927['id'],'type':_0x21550d[_0x6174('0x19')],'sectionId':_0x21550d['id']},{})[_0x6174('0x13')](function(){return _0x52fd15;});}else{return _0x52fd15;}})[_0x6174('0x33')](function(_0x2b3308){logger['error'](_0x6174('0x3b'),_0x2b3308);throw _0x2b3308;});}return _0x52fd15;})[_0x6174('0x13')](respondWithResult(_0x23f31b,0xc9))[_0x6174('0x33')](handleError(_0x23f31b,null));};exports['update']=function(_0x24b047,_0x302513){if(_0x24b047[_0x6174('0x35')]['id']){delete _0x24b047[_0x6174('0x35')]['id'];}return db[_0x6174('0x1d')][_0x6174('0x32')]({'where':{'id':_0x24b047[_0x6174('0x3c')]['id']}})['then'](handleEntityNotFound(_0x302513,null))[_0x6174('0x13')](saveUpdates(_0x24b047[_0x6174('0x35')],null))['then'](respondWithResult(_0x302513,null))['catch'](handleError(_0x302513,null));};exports[_0x6174('0x12')]=function(_0x348805,_0x20ea30){return db[_0x6174('0x1d')][_0x6174('0x32')]({'where':{'id':_0x348805['params']['id']}})['then'](handleEntityNotFound(_0x20ea30,null))[_0x6174('0x13')](removeEntity(_0x20ea30,null))['catch'](handleError(_0x20ea30,null));};exports['describe']=function(_0x26497b,_0x3033e2){return db[_0x6174('0x1d')][_0x6174('0x3d')]()[_0x6174('0x13')](respondWithResult(_0x3033e2,null))[_0x6174('0x33')](handleError(_0x3033e2,null));};exports[_0x6174('0x3e')]=function(_0x52d013,_0x59e629){var _0x49b9fd={'raw':!![],'where':{}},_0x202df5={},_0x46905d;return db[_0x6174('0x1d')][_0x6174('0x3f')]({'where':{'id':_0x52d013[_0x6174('0x3c')]['id']}})[_0x6174('0x13')](handleEntityNotFound(_0x59e629,null))['then'](function(_0x26cf5c){if(_0x26cf5c){_0x46905d=_0x26cf5c['get']({'plain':!![]});_0x202df5[_0x6174('0x2c')]=_[_0x6174('0x28')](db[_0x6174('0x40')][_0x6174('0x1e')]);_0x202df5[_0x6174('0x24')]=_[_0x6174('0x28')](_0x52d013[_0x6174('0x24')]);_0x202df5[_0x6174('0x29')]=_['intersection'](_0x202df5['model'],_0x202df5[_0x6174('0x24')]);_0x49b9fd['attributes']=_['intersection'](_0x202df5['model'],qs[_0x6174('0x2d')](_0x52d013[_0x6174('0x24')][_0x6174('0x2d')]));_0x49b9fd[_0x6174('0x2b')]=_0x49b9fd[_0x6174('0x2b')][_0x6174('0x2e')]?_0x49b9fd[_0x6174('0x2b')]:_0x202df5[_0x6174('0x2c')];if(!_0x52d013[_0x6174('0x24')][_0x6174('0x41')]('nolimit')){_0x49b9fd['limit']=qs[_0x6174('0xe')](_0x52d013[_0x6174('0x24')]['limit']);_0x49b9fd[_0x6174('0xc')]=qs[_0x6174('0xc')](_0x52d013[_0x6174('0x24')][_0x6174('0xc')]);}_0x49b9fd['order']=qs[_0x6174('0x42')](_0x52d013[_0x6174('0x24')][_0x6174('0x42')]);_0x49b9fd[_0x6174('0x22')]=qs[_0x6174('0x29')](_[_0x6174('0x43')](_0x52d013[_0x6174('0x24')],_0x202df5['filters']));_0x49b9fd[_0x6174('0x22')][_0x6174('0x44')]=_0x26cf5c['id'];if(_0x52d013[_0x6174('0x24')][_0x6174('0x45')]){_0x49b9fd[_0x6174('0x22')]=_[_0x6174('0x30')](_0x49b9fd['where'],{'$or':_[_0x6174('0x1c')](_0x49b9fd['attributes'],function(_0x2b7365){var _0x4331a1={};_0x4331a1[_0x2b7365]={'$like':'%'+_0x52d013['query'][_0x6174('0x45')]+'%'};return _0x4331a1;})});}_0x49b9fd=_[_0x6174('0x30')]({},_0x49b9fd,_0x52d013[_0x6174('0x31')]);return db[_0x6174('0x40')][_0x6174('0x25')](_0x49b9fd);}})[_0x6174('0x13')](function(_0x481a32){if(_0x481a32){return db['User'][_0x6174('0x46')]({'where':{'id':_[_0x6174('0x1c')](_0x481a32,_0x6174('0x47')),'role':_0x6174('0x48')},'attributes':['id','name',_0x6174('0x49'),_0x6174('0x4a'),_0x6174('0x4b')]});}})[_0x6174('0x13')](function(_0xbf81f8){if(_0xbf81f8){return{'count':_0xbf81f8[_0x6174('0xf')],'rows':_[_0x6174('0x1c')](_0xbf81f8[_0x6174('0x26')],function(_0x5f0c3f){return{'membername':_0x5f0c3f[_0x6174('0x19')],'UserId':_0x5f0c3f['id'],'queue_name':_0x46905d[_0x6174('0x19')],'MailQueueId':_0x46905d['id'],'interface':util[_0x6174('0x4c')](_0x6174('0x4d'),'SIP',_0x5f0c3f[_0x6174('0x19')]),'penalty':0x0,'paused':_0x5f0c3f[_0x6174('0x49')],'createdAt':_0x5f0c3f[_0x6174('0x4b')],'updatedAt':_0x5f0c3f[_0x6174('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6174('0x13')](respondWithFilteredResult(_0x59e629,_0x49b9fd))[_0x6174('0x33')](handleError(_0x59e629,null));};exports[_0x6174('0x4e')]=function(_0x30f8a5,_0xbbb7ad){var _0x3f8c6b={};var _0x2ec815={};var _0x34b1a9;var _0x18010c;return db[_0x6174('0x1d')][_0x6174('0x3f')]({'where':{'id':_0x30f8a5['params']['id']}})[_0x6174('0x13')](handleEntityNotFound(_0xbbb7ad,null))[_0x6174('0x13')](function(_0x1fcdd1){if(_0x1fcdd1){_0x34b1a9=_0x1fcdd1;_0x2ec815[_0x6174('0x2c')]=_[_0x6174('0x28')](db[_0x6174('0x4f')][_0x6174('0x1e')]);_0x2ec815[_0x6174('0x24')]=_[_0x6174('0x28')](_0x30f8a5['query']);_0x2ec815[_0x6174('0x29')]=_['intersection'](_0x2ec815['model'],_0x2ec815['query']);_0x3f8c6b[_0x6174('0x2b')]=_['intersection'](_0x2ec815[_0x6174('0x2c')],qs['fields'](_0x30f8a5[_0x6174('0x24')][_0x6174('0x2d')]));_0x3f8c6b[_0x6174('0x2b')]=_0x3f8c6b['attributes']['length']?_0x3f8c6b['attributes']:_0x2ec815[_0x6174('0x2c')];_0x3f8c6b['order']=qs[_0x6174('0x42')](_0x30f8a5[_0x6174('0x24')][_0x6174('0x42')]);_0x3f8c6b[_0x6174('0x22')]=qs[_0x6174('0x29')](_[_0x6174('0x43')](_0x30f8a5['query'],_0x2ec815[_0x6174('0x29')]));if(_0x30f8a5[_0x6174('0x24')]['filter']){_0x3f8c6b[_0x6174('0x22')]=_[_0x6174('0x30')](_0x3f8c6b[_0x6174('0x22')],{'$or':_['map'](_0x3f8c6b[_0x6174('0x2b')],function(_0x88ef62){var _0x86f5d1={};_0x86f5d1[_0x88ef62]={'$like':'%'+_0x30f8a5[_0x6174('0x24')]['filter']+'%'};return _0x86f5d1;})});}_0x3f8c6b=_[_0x6174('0x30')]({},_0x3f8c6b,_0x30f8a5['options']);return _0x34b1a9[_0x6174('0x4e')](_0x3f8c6b);}})[_0x6174('0x13')](function(_0x12f359){if(_0x12f359){_0x18010c=_0x12f359[_0x6174('0x2e')];if(!_0x30f8a5[_0x6174('0x24')][_0x6174('0x41')]('nolimit')){_0x3f8c6b['limit']=qs[_0x6174('0xe')](_0x30f8a5[_0x6174('0x24')]['limit']);_0x3f8c6b[_0x6174('0xc')]=qs['offset'](_0x30f8a5['query'][_0x6174('0xc')]);}return _0x34b1a9[_0x6174('0x4e')](_0x3f8c6b);}})[_0x6174('0x13')](function(_0x98e758){if(_0x98e758){return _0x98e758?{'count':_0x18010c,'rows':_0x98e758}:null;}})[_0x6174('0x13')](respondWithResult(_0xbbb7ad,null))[_0x6174('0x33')](handleError(_0xbbb7ad,null));};exports['addTeams']=function(_0x5c7364,_0x2d4438){var _0x40141c=_0x5c7364['body']['ids'];return db[_0x6174('0x4f')][_0x6174('0x25')]({'where':{'id':_0x40141c},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6174('0x50'),'attributes':['id','name',_0x6174('0x51'),_0x6174('0x52'),_0x6174('0x53')],'raw':!![]}]})[_0x6174('0x13')](function(_0x4cdbc3){if(_0x4cdbc3){var _0x2502a8=_[_0x6174('0x54')](_0x4cdbc3,function(_0x59a909){var _0x3252fa=_0x59a909[_0x6174('0x39')]({'plain':!![]});return _0x3252fa['Agents'];});return db[_0x6174('0x1d')][_0x6174('0x32')]({'where':{'id':_0x5c7364[_0x6174('0x3c')]['id']}})[_0x6174('0x13')](function(_0x8ddef){return db['sequelize'][_0x6174('0x55')](function(_0x149951){return _0x8ddef[_0x6174('0x56')](_0x40141c,{'transaction':_0x149951})[_0x6174('0x13')](function(){return BPromise[_0x6174('0x57')](_0x2502a8,function(_0x4332e9){return db[_0x6174('0x40')][_0x6174('0x58')]({'where':{'UserId':_0x4332e9['id'],'MailQueueId':_0x5c7364['params']['id']},'transaction':_0x149951});});})['then'](function(){_0x2502a8['forEach'](function(_0x3db508){socket['emit'](_0x6174('0x59'),{'UserId':_0x3db508['id'],'MailQueueId':_0x8ddef['id']});});});});});}})[_0x6174('0x13')](respondWithStatusCode(_0x2d4438,null))[_0x6174('0x33')](handleError(_0x2d4438,null));};exports['removeTeams']=function(_0x2cd4e2,_0x180518){return db[_0x6174('0x4f')][_0x6174('0x25')]({'where':{'id':_0x2cd4e2[_0x6174('0x24')][_0x6174('0x5a')]},'attributes':['id'],'include':[{'model':db[_0x6174('0x5b')],'as':_0x6174('0x50'),'attributes':['id'],'raw':!![]}]})[_0x6174('0x13')](handleEntityNotFound(_0x180518,null))['then'](function(_0xb2a7a5){var _0x3964a1=_[_0x6174('0x1c')](_0xb2a7a5,'id');var _0x1fa629=[];var _0x15c078=[];var _0x3dd006=squel[_0x6174('0x5c')]();_0x3dd006['field']('tq.TeamId')['from']('team_has_mail_queues','tq')[_0x6174('0x5d')](_0x6174('0x5e'),'ut',_0x6174('0x5f'))[_0x6174('0x22')](_0x6174('0x60'),_0x2cd4e2['params']['id']);for(var _0x449d4c=0x0;_0x449d4c<_0xb2a7a5[_0x6174('0x2e')];_0x449d4c+=0x1){let _0x9bd94b=_0xb2a7a5[_0x449d4c];for(var _0x47c95d=0x0;_0x47c95d<_0x9bd94b[_0x6174('0x50')][_0x6174('0x2e')];_0x47c95d+=0x1){let _0x554efa=_0x9bd94b[_0x6174('0x50')][_0x47c95d];var _0x9d7e26=_0x3dd006[_0x6174('0x61')]();_0x9d7e26[_0x6174('0x22')]('ut.UserId\x20=\x20?',_0x554efa['id']);_0x15c078['push'](db[_0x6174('0x62')][_0x6174('0x24')](_0x9d7e26[_0x6174('0x63')](),{'type':db[_0x6174('0x62')][_0x6174('0x64')][_0x6174('0x65')]})[_0x6174('0x13')](function(_0x37db73){if(_0x37db73['length']===0x1){return _0x554efa['id'];}else{var _0x3a60e6=_[_0x6174('0x66')](_[_0x6174('0x1c')](_0x37db73,_0x6174('0x67')),function(_0x5eefb0){return _[_0x6174('0x68')](_0x3964a1,_0x5eefb0);});if(_0x3a60e6){return _0x554efa['id'];}}}));}}return BPromise[_0x6174('0x69')](_0x15c078)[_0x6174('0x13')](function(_0x1b3b55){_0x1fa629=_(_0x1fa629)['union'](_0x1b3b55)[_0x6174('0x6a')]()[_0x6174('0x6b')]();return db['MailQueue'][_0x6174('0x32')]({'where':{'id':_0x2cd4e2[_0x6174('0x3c')]['id']}})['then'](function(_0x2e0343){return db[_0x6174('0x62')][_0x6174('0x55')](function(_0x103f01){return _0x2e0343[_0x6174('0x6c')](_0x2cd4e2[_0x6174('0x24')]['ids'],{'transaction':_0x103f01})[_0x6174('0x13')](function(){if(!_[_0x6174('0x6d')](_0x1fa629)){return _0x2e0343['removeAgents'](_0x1fa629,{'transaction':_0x103f01});}})[_0x6174('0x13')](function(){_0x1fa629['forEach'](function(_0x18326b){socket[_0x6174('0x6e')]('userMailQueue:remove',{'UserId':_0x18326b,'MailQueueId':_0x2e0343['id']});});});});});});})[_0x6174('0x13')](respondWithStatusCode(_0x180518,null))[_0x6174('0x33')](handleError(_0x180518,null));};exports[_0x6174('0x6f')]=function(_0x1e9440,_0xd12b84){return db['MailQueue'][_0x6174('0x32')]({'where':{'id':_0x1e9440[_0x6174('0x3c')]['id']}})[_0x6174('0x13')](handleEntityNotFound(_0xd12b84,null))[_0x6174('0x13')](function(_0x9cfade){if(_0x9cfade){return _0x9cfade[_0x6174('0x6f')](_0x1e9440[_0x6174('0x35')]['ids'],_['omit'](_0x1e9440[_0x6174('0x35')],[_0x6174('0x5a'),'id'])||{})[_0x6174('0x70')](function(_0x494626){for(var _0x741230=0x0;_0x741230<_0x1e9440['body'][_0x6174('0x5a')][_0x6174('0x2e')];_0x741230+=0x1){socket[_0x6174('0x6e')](_0x6174('0x59'),{'UserId':Number(_0x1e9440[_0x6174('0x35')][_0x6174('0x5a')][_0x741230]),'MailQueueId':Number(_0x1e9440[_0x6174('0x3c')]['id'])});}return _0x494626;});}})['then'](respondWithResult(_0xd12b84,null))[_0x6174('0x33')](handleError(_0xd12b84,null));};exports[_0x6174('0x71')]=function(_0x32fe87,_0x34ba2a){return db['MailQueue'][_0x6174('0x32')]({'where':{'id':_0x32fe87[_0x6174('0x3c')]['id']}})['then'](handleEntityNotFound(_0x34ba2a,null))['then'](function(_0x12fb1d){if(_0x12fb1d){return _0x12fb1d[_0x6174('0x71')](_0x32fe87['query'][_0x6174('0x5a')])[_0x6174('0x13')](function(){if(_[_0x6174('0x72')](_0x32fe87[_0x6174('0x24')][_0x6174('0x5a')])){for(var _0x1b5c86=0x0;_0x1b5c86<_0x32fe87[_0x6174('0x24')]['ids']['length'];_0x1b5c86+=0x1){socket[_0x6174('0x6e')](_0x6174('0x73'),{'UserId':Number(_0x32fe87[_0x6174('0x24')][_0x6174('0x5a')][_0x1b5c86]),'MailQueueId':Number(_0x32fe87[_0x6174('0x3c')]['id'])});}}else{socket['emit'](_0x6174('0x73'),{'UserId':Number(_0x32fe87[_0x6174('0x24')]['ids']),'MailQueueId':Number(_0x32fe87['params']['id'])});}});}})['then'](respondWithStatusCode(_0x34ba2a,null))[_0x6174('0x33')](handleError(_0x34ba2a,null));};exports[_0x6174('0x74')]=function(_0x173394,_0x1a8027){var _0x26e2d8={};var _0x93afb0={};var _0x5b5b8b;var _0x2d68ba;return db[_0x6174('0x1d')][_0x6174('0x3f')]({'where':{'id':_0x173394[_0x6174('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1a8027,null))[_0x6174('0x13')](function(_0x2d84c5){if(_0x2d84c5){_0x5b5b8b=_0x2d84c5;_0x93afb0[_0x6174('0x2c')]=_[_0x6174('0x28')](db['User'][_0x6174('0x1e')]);_0x93afb0[_0x6174('0x24')]=_['keys'](_0x173394[_0x6174('0x24')]);_0x93afb0[_0x6174('0x29')]=_[_0x6174('0x2a')](_0x93afb0[_0x6174('0x2c')],_0x93afb0[_0x6174('0x24')]);_0x26e2d8['attributes']=_[_0x6174('0x2a')](_0x93afb0[_0x6174('0x2c')],qs[_0x6174('0x2d')](_0x173394['query']['fields']));_0x26e2d8[_0x6174('0x2b')]=_0x26e2d8[_0x6174('0x2b')][_0x6174('0x2e')]?_0x26e2d8[_0x6174('0x2b')]:_0x93afb0['model'];_0x26e2d8[_0x6174('0x75')]=qs['sort'](_0x173394[_0x6174('0x24')]['sort']);_0x26e2d8[_0x6174('0x22')]=qs[_0x6174('0x29')](_[_0x6174('0x43')](_0x173394[_0x6174('0x24')],_0x93afb0['filters']));if(_0x173394[_0x6174('0x24')][_0x6174('0x45')]){_0x26e2d8[_0x6174('0x22')]=_[_0x6174('0x30')](_0x26e2d8['where'],{'$or':_['map'](_0x26e2d8[_0x6174('0x2b')],function(_0x3bcc81){var _0x184008={};_0x184008[_0x3bcc81]={'$like':'%'+_0x173394[_0x6174('0x24')][_0x6174('0x45')]+'%'};return _0x184008;})});}_0x26e2d8=_[_0x6174('0x30')]({},_0x26e2d8,_0x173394[_0x6174('0x31')]);return _0x5b5b8b[_0x6174('0x74')](_0x26e2d8);}})[_0x6174('0x13')](function(_0x35f41f){if(_0x35f41f){_0x2d68ba=_0x35f41f['length'];if(!_0x173394[_0x6174('0x24')]['hasOwnProperty'](_0x6174('0x76'))){_0x26e2d8['limit']=qs[_0x6174('0xe')](_0x173394['query']['limit']);_0x26e2d8['offset']=qs[_0x6174('0xc')](_0x173394[_0x6174('0x24')][_0x6174('0xc')]);}return _0x5b5b8b['getAgents'](_0x26e2d8);}})[_0x6174('0x13')](function(_0x32fd7f){if(_0x32fd7f){return _0x32fd7f?{'count':_0x2d68ba,'rows':_0x32fd7f}:null;}})[_0x6174('0x13')](respondWithResult(_0x1a8027,null))[_0x6174('0x33')](handleError(_0x1a8027,null));}; \ No newline at end of file +var _0x9d81=['destroy','get','MailQueues','UserProfileResource','sendStatus','stack','name','send','index','map','MailQueue','fieldName','type','key','getOptions','where','include','findAll','rows','catch','show','keys','rawAttributes','query','intersection','model','attributes','fields','length','includeAll','merge','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserMailQueue','filters','hasOwnProperty','nolimit','sort','MailQueueId','filter','options','findAndCountAll','agent','updatedAt','createdAt','format','SIP','mailPause','getTeams','Team','order','pick','ids','User','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','Agents','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','compact','removeTeams','isEmpty','addAgents','omit','removeAgents','userMailQueue:remove','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','end','status','json','offset','undefined','limit','count','set','update','then'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x9d81,0x1e3));var _0x19d8=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9d81[_0x4a9fb1];return _0x348672;};'use strict';var BPromise=require(_0x19d8('0x0'));var util=require(_0x19d8('0x1'));var _=require(_0x19d8('0x2'));var squel=require(_0x19d8('0x3'));var Redis=require('ioredis');var qs=require(_0x19d8('0x4'));var logger=require(_0x19d8('0x5'))(_0x19d8('0x6'));var config=require(_0x19d8('0x7'));var db=require(_0x19d8('0x8'))['db'];config['redis']=_[_0x19d8('0x9')](config[_0x19d8('0xa')],{'host':_0x19d8('0xb'),'port':0x18eb});var socket=require(_0x19d8('0xc'))(new Redis(config[_0x19d8('0xa')]));require(_0x19d8('0xd'))[_0x19d8('0xe')](socket);function respondWithStatusCode(_0x2558bc,_0x244c15){_0x244c15=_0x244c15||0xcc;return function(_0xd17a12){if(_0xd17a12){return _0x2558bc['sendStatus'](_0x244c15);}return _0x2558bc['status'](_0x244c15)[_0x19d8('0xf')]();};}function respondWithResult(_0x2c6f62,_0x14af78){_0x14af78=_0x14af78||0xc8;return function(_0x5da87e){if(_0x5da87e){return _0x2c6f62[_0x19d8('0x10')](_0x14af78)[_0x19d8('0x11')](_0x5da87e);}};}function respondWithFilteredResult(_0x170147,_0x4b65eb){return function(_0x163db2){if(_0x163db2){var _0x339ca5=typeof _0x4b65eb[_0x19d8('0x12')]===_0x19d8('0x13')&&typeof _0x4b65eb[_0x19d8('0x14')]===_0x19d8('0x13');var _0x62f0d1=_0x163db2['count'];var _0x29981c=_0x339ca5?0x0:_0x4b65eb[_0x19d8('0x12')];var _0x2ebf32=_0x339ca5?_0x163db2[_0x19d8('0x15')]:_0x4b65eb[_0x19d8('0x12')]+_0x4b65eb[_0x19d8('0x14')];var _0x21a035;if(_0x2ebf32>=_0x62f0d1){_0x2ebf32=_0x62f0d1;_0x21a035=0xc8;}else{_0x21a035=0xce;}_0x170147[_0x19d8('0x10')](_0x21a035);return _0x170147[_0x19d8('0x16')]('Content-Range',_0x29981c+'-'+_0x2ebf32+'/'+_0x62f0d1)['json'](_0x163db2);}return null;};}function saveUpdates(_0x5eafcd){return function(_0x4a67d0){if(_0x4a67d0){return _0x4a67d0[_0x19d8('0x17')](_0x5eafcd)[_0x19d8('0x18')](function(_0x5475ab){return _0x5475ab;});}return null;};}function removeEntity(_0x4e3590){return function(_0x4ce657){if(_0x4ce657){return _0x4ce657[_0x19d8('0x19')]()[_0x19d8('0x18')](function(){var _0x230dcb=_0x4ce657[_0x19d8('0x1a')]({'plain':!![]});var _0x5680fa=_0x19d8('0x1b');return db[_0x19d8('0x1c')][_0x19d8('0x19')]({'where':{'type':_0x5680fa,'resourceId':_0x230dcb['id']}})[_0x19d8('0x18')](function(){return _0x4ce657;});})[_0x19d8('0x18')](function(){_0x4e3590['status'](0xcc)[_0x19d8('0xf')]();});}};}function handleEntityNotFound(_0x405ba8){return function(_0x44c19b){if(!_0x44c19b){_0x405ba8[_0x19d8('0x1d')](0x194);}return _0x44c19b;};}function handleError(_0x2ba135,_0x50ee58){_0x50ee58=_0x50ee58||0x1f4;return function(_0x285fd1){logger['error'](_0x285fd1[_0x19d8('0x1e')]);if(_0x285fd1[_0x19d8('0x1f')]){delete _0x285fd1[_0x19d8('0x1f')];}_0x2ba135['status'](_0x50ee58)[_0x19d8('0x20')](_0x285fd1);};}exports[_0x19d8('0x21')]=function(_0x30488c,_0x2c6962){var _0xec6d44={};var _0x4cbb9f={'count':0x0,'rows':[]};var _0x1178b0=_[_0x19d8('0x22')](db[_0x19d8('0x23')]['rawAttributes'],function(_0x7c4d76){return{'name':_0x7c4d76[_0x19d8('0x24')],'type':_0x7c4d76[_0x19d8('0x25')][_0x19d8('0x26')]};});_0xec6d44=qs[_0x19d8('0x27')](_0x1178b0,_0x30488c);var _0x55cf05={'where':_0xec6d44[_0x19d8('0x28')]};return db[_0x19d8('0x23')][_0x19d8('0x15')](_0x55cf05)['then'](function(_0x2f4e10){_0x4cbb9f[_0x19d8('0x15')]=_0x2f4e10;_0xec6d44[_0x19d8('0x29')]=qs[_0x19d8('0x29')](_0x30488c['query']);return db['MailQueue'][_0x19d8('0x2a')](_0xec6d44);})[_0x19d8('0x18')](function(_0x5de1de){_0x4cbb9f[_0x19d8('0x2b')]=_0x5de1de;return _0x4cbb9f;})[_0x19d8('0x18')](respondWithFilteredResult(_0x2c6962,_0xec6d44))[_0x19d8('0x2c')](handleError(_0x2c6962,null));};exports[_0x19d8('0x2d')]=function(_0x386f74,_0x61b3c8){var _0x433227={'raw':!![],'where':{'id':_0x386f74['params']['id']}},_0x28c3d0={};_0x28c3d0['model']=_[_0x19d8('0x2e')](db[_0x19d8('0x23')][_0x19d8('0x2f')]);_0x28c3d0[_0x19d8('0x30')]=_['keys'](_0x386f74[_0x19d8('0x30')]);_0x28c3d0['filters']=_[_0x19d8('0x31')](_0x28c3d0[_0x19d8('0x32')],_0x28c3d0[_0x19d8('0x30')]);_0x433227[_0x19d8('0x33')]=_['intersection'](_0x28c3d0[_0x19d8('0x32')],qs[_0x19d8('0x34')](_0x386f74[_0x19d8('0x30')][_0x19d8('0x34')]));_0x433227[_0x19d8('0x33')]=_0x433227[_0x19d8('0x33')][_0x19d8('0x35')]?_0x433227['attributes']:_0x28c3d0[_0x19d8('0x32')];if(_0x386f74['query'][_0x19d8('0x36')]){_0x433227[_0x19d8('0x29')]=[{'all':!![]}];}_0x433227=_[_0x19d8('0x37')]({},_0x433227,_0x386f74['options']);return db['MailQueue'][_0x19d8('0x38')](_0x433227)[_0x19d8('0x18')](handleEntityNotFound(_0x61b3c8,null))['then'](respondWithResult(_0x61b3c8,null))[_0x19d8('0x2c')](handleError(_0x61b3c8,null));};exports[_0x19d8('0x39')]=function(_0x28d407,_0x181763){return db[_0x19d8('0x23')][_0x19d8('0x39')](_0x28d407[_0x19d8('0x3a')],{})[_0x19d8('0x18')](function(_0x2d22c4){var _0x51f38c=_0x28d407[_0x19d8('0x3b')][_0x19d8('0x1a')]({'plain':!![]});if(!_0x51f38c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x51f38c[_0x19d8('0x3c')]===_0x19d8('0x3b')){var _0x45fb72=_0x2d22c4[_0x19d8('0x1a')]({'plain':!![]});var _0x38b1c7=_0x19d8('0x1b');return db[_0x19d8('0x3d')][_0x19d8('0x38')]({'where':{'name':_0x38b1c7,'userProfileId':_0x51f38c[_0x19d8('0x3e')]},'raw':!![]})[_0x19d8('0x18')](function(_0x56db68){if(_0x56db68&&_0x56db68[_0x19d8('0x3f')]===0x0){return db['UserProfileResource'][_0x19d8('0x39')]({'name':_0x45fb72[_0x19d8('0x1f')],'resourceId':_0x45fb72['id'],'type':_0x56db68[_0x19d8('0x1f')],'sectionId':_0x56db68['id']},{})[_0x19d8('0x18')](function(){return _0x2d22c4;});}else{return _0x2d22c4;}})[_0x19d8('0x2c')](function(_0xbe05bd){logger[_0x19d8('0x40')](_0x19d8('0x41'),_0xbe05bd);throw _0xbe05bd;});}return _0x2d22c4;})['then'](respondWithResult(_0x181763,0xc9))[_0x19d8('0x2c')](handleError(_0x181763,null));};exports[_0x19d8('0x17')]=function(_0x128d43,_0x21b3ff){if(_0x128d43['body']['id']){delete _0x128d43[_0x19d8('0x3a')]['id'];}return db[_0x19d8('0x23')][_0x19d8('0x38')]({'where':{'id':_0x128d43[_0x19d8('0x42')]['id']}})['then'](handleEntityNotFound(_0x21b3ff,null))[_0x19d8('0x18')](saveUpdates(_0x128d43['body'],null))[_0x19d8('0x18')](respondWithResult(_0x21b3ff,null))[_0x19d8('0x2c')](handleError(_0x21b3ff,null));};exports[_0x19d8('0x19')]=function(_0x1b06fd,_0xf61207){return db[_0x19d8('0x23')]['find']({'where':{'id':_0x1b06fd[_0x19d8('0x42')]['id']}})[_0x19d8('0x18')](handleEntityNotFound(_0xf61207,null))[_0x19d8('0x18')](removeEntity(_0xf61207,null))[_0x19d8('0x2c')](handleError(_0xf61207,null));};exports['describe']=function(_0x3fb558,_0x40f7a2){return db[_0x19d8('0x23')][_0x19d8('0x43')]()[_0x19d8('0x18')](respondWithResult(_0x40f7a2,null))[_0x19d8('0x2c')](handleError(_0x40f7a2,null));};exports[_0x19d8('0x44')]=function(_0x6a1b1e,_0x3ae9b6){var _0x54ca7b={'raw':!![],'where':{}},_0x12dc0c={},_0xec70aa;return db[_0x19d8('0x23')][_0x19d8('0x45')]({'where':{'id':_0x6a1b1e['params']['id']}})[_0x19d8('0x18')](handleEntityNotFound(_0x3ae9b6,null))[_0x19d8('0x18')](function(_0x2eeaa1){if(_0x2eeaa1){_0xec70aa=_0x2eeaa1[_0x19d8('0x1a')]({'plain':!![]});_0x12dc0c[_0x19d8('0x32')]=_[_0x19d8('0x2e')](db[_0x19d8('0x46')][_0x19d8('0x2f')]);_0x12dc0c[_0x19d8('0x30')]=_[_0x19d8('0x2e')](_0x6a1b1e[_0x19d8('0x30')]);_0x12dc0c[_0x19d8('0x47')]=_['intersection'](_0x12dc0c[_0x19d8('0x32')],_0x12dc0c['query']);_0x54ca7b[_0x19d8('0x33')]=_['intersection'](_0x12dc0c[_0x19d8('0x32')],qs['fields'](_0x6a1b1e[_0x19d8('0x30')][_0x19d8('0x34')]));_0x54ca7b[_0x19d8('0x33')]=_0x54ca7b[_0x19d8('0x33')]['length']?_0x54ca7b[_0x19d8('0x33')]:_0x12dc0c[_0x19d8('0x32')];if(!_0x6a1b1e[_0x19d8('0x30')][_0x19d8('0x48')](_0x19d8('0x49'))){_0x54ca7b[_0x19d8('0x14')]=qs[_0x19d8('0x14')](_0x6a1b1e[_0x19d8('0x30')][_0x19d8('0x14')]);_0x54ca7b[_0x19d8('0x12')]=qs[_0x19d8('0x12')](_0x6a1b1e['query'][_0x19d8('0x12')]);}_0x54ca7b['order']=qs[_0x19d8('0x4a')](_0x6a1b1e[_0x19d8('0x30')][_0x19d8('0x4a')]);_0x54ca7b[_0x19d8('0x28')]=qs[_0x19d8('0x47')](_['pick'](_0x6a1b1e[_0x19d8('0x30')],_0x12dc0c[_0x19d8('0x47')]));_0x54ca7b['where'][_0x19d8('0x4b')]=_0x2eeaa1['id'];if(_0x6a1b1e['query'][_0x19d8('0x4c')]){_0x54ca7b['where']=_[_0x19d8('0x37')](_0x54ca7b[_0x19d8('0x28')],{'$or':_[_0x19d8('0x22')](_0x54ca7b[_0x19d8('0x33')],function(_0x3a61f2){var _0x2fd1b1={};_0x2fd1b1[_0x3a61f2]={'$like':'%'+_0x6a1b1e['query'][_0x19d8('0x4c')]+'%'};return _0x2fd1b1;})});}_0x54ca7b=_[_0x19d8('0x37')]({},_0x54ca7b,_0x6a1b1e[_0x19d8('0x4d')]);return db['UserMailQueue'][_0x19d8('0x2a')](_0x54ca7b);}})[_0x19d8('0x18')](function(_0x3f39c9){if(_0x3f39c9){return db['User'][_0x19d8('0x4e')]({'where':{'id':_['map'](_0x3f39c9,'UserId'),'role':_0x19d8('0x4f')},'attributes':['id','name','mailPause',_0x19d8('0x50'),_0x19d8('0x51')]});}})[_0x19d8('0x18')](function(_0x5daa48){if(_0x5daa48){return{'count':_0x5daa48[_0x19d8('0x15')],'rows':_[_0x19d8('0x22')](_0x5daa48['rows'],function(_0x4c070c){return{'membername':_0x4c070c['name'],'UserId':_0x4c070c['id'],'queue_name':_0xec70aa[_0x19d8('0x1f')],'MailQueueId':_0xec70aa['id'],'interface':util[_0x19d8('0x52')]('%s/%s',_0x19d8('0x53'),_0x4c070c[_0x19d8('0x1f')]),'penalty':0x0,'paused':_0x4c070c[_0x19d8('0x54')],'createdAt':_0x4c070c[_0x19d8('0x51')],'updatedAt':_0x4c070c[_0x19d8('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3ae9b6,_0x54ca7b))[_0x19d8('0x2c')](handleError(_0x3ae9b6,null));};exports[_0x19d8('0x55')]=function(_0x37d5ce,_0x278fa5){var _0x205912={};var _0x385f24={};var _0x4512e3;var _0x47a3e1;return db[_0x19d8('0x23')][_0x19d8('0x45')]({'where':{'id':_0x37d5ce[_0x19d8('0x42')]['id']}})[_0x19d8('0x18')](handleEntityNotFound(_0x278fa5,null))[_0x19d8('0x18')](function(_0x4d9c04){if(_0x4d9c04){_0x4512e3=_0x4d9c04;_0x385f24[_0x19d8('0x32')]=_[_0x19d8('0x2e')](db[_0x19d8('0x56')][_0x19d8('0x2f')]);_0x385f24[_0x19d8('0x30')]=_[_0x19d8('0x2e')](_0x37d5ce['query']);_0x385f24[_0x19d8('0x47')]=_['intersection'](_0x385f24[_0x19d8('0x32')],_0x385f24[_0x19d8('0x30')]);_0x205912['attributes']=_[_0x19d8('0x31')](_0x385f24[_0x19d8('0x32')],qs['fields'](_0x37d5ce['query'][_0x19d8('0x34')]));_0x205912[_0x19d8('0x33')]=_0x205912[_0x19d8('0x33')]['length']?_0x205912['attributes']:_0x385f24['model'];_0x205912[_0x19d8('0x57')]=qs['sort'](_0x37d5ce[_0x19d8('0x30')]['sort']);_0x205912['where']=qs['filters'](_[_0x19d8('0x58')](_0x37d5ce['query'],_0x385f24['filters']));if(_0x37d5ce[_0x19d8('0x30')][_0x19d8('0x4c')]){_0x205912[_0x19d8('0x28')]=_[_0x19d8('0x37')](_0x205912[_0x19d8('0x28')],{'$or':_[_0x19d8('0x22')](_0x205912[_0x19d8('0x33')],function(_0x2452a6){var _0x586208={};_0x586208[_0x2452a6]={'$like':'%'+_0x37d5ce[_0x19d8('0x30')][_0x19d8('0x4c')]+'%'};return _0x586208;})});}_0x205912=_[_0x19d8('0x37')]({},_0x205912,_0x37d5ce['options']);return _0x4512e3[_0x19d8('0x55')](_0x205912);}})[_0x19d8('0x18')](function(_0x2dc794){if(_0x2dc794){_0x47a3e1=_0x2dc794['length'];if(!_0x37d5ce[_0x19d8('0x30')][_0x19d8('0x48')](_0x19d8('0x49'))){_0x205912[_0x19d8('0x14')]=qs[_0x19d8('0x14')](_0x37d5ce['query'][_0x19d8('0x14')]);_0x205912[_0x19d8('0x12')]=qs[_0x19d8('0x12')](_0x37d5ce[_0x19d8('0x30')][_0x19d8('0x12')]);}return _0x4512e3['getTeams'](_0x205912);}})[_0x19d8('0x18')](function(_0x600c3d){if(_0x600c3d){return _0x600c3d?{'count':_0x47a3e1,'rows':_0x600c3d}:null;}})[_0x19d8('0x18')](respondWithResult(_0x278fa5,null))[_0x19d8('0x2c')](handleError(_0x278fa5,null));};exports['addTeams']=function(_0x3b661e,_0x1db1ca){var _0x48850d=_0x3b661e[_0x19d8('0x3a')][_0x19d8('0x59')];return db[_0x19d8('0x56')][_0x19d8('0x2a')]({'where':{'id':_0x48850d},'attributes':['id'],'include':[{'model':db[_0x19d8('0x5a')],'as':'Agents','attributes':['id','name',_0x19d8('0x5b'),_0x19d8('0x5c'),_0x19d8('0x5d')],'raw':!![]}]})['then'](function(_0x284ee2){if(_0x284ee2){var _0xea7b45=_[_0x19d8('0x5e')](_0x284ee2,function(_0x56f3d0){var _0x46bad2=_0x56f3d0[_0x19d8('0x1a')]({'plain':!![]});return _0x46bad2['Agents'];});return db['MailQueue'][_0x19d8('0x38')]({'where':{'id':_0x3b661e[_0x19d8('0x42')]['id']}})[_0x19d8('0x18')](function(_0x42db08){return db[_0x19d8('0x5f')][_0x19d8('0x60')](function(_0x3a4027){return _0x42db08['addTeams'](_0x48850d,{'transaction':_0x3a4027})[_0x19d8('0x18')](function(){return BPromise[_0x19d8('0x61')](_0xea7b45,function(_0x1c452a){return db[_0x19d8('0x46')][_0x19d8('0x62')]({'where':{'UserId':_0x1c452a['id'],'MailQueueId':_0x3b661e['params']['id']},'transaction':_0x3a4027});});})['then'](function(){_0xea7b45[_0x19d8('0x63')](function(_0x55ef61){socket[_0x19d8('0x64')](_0x19d8('0x65'),{'UserId':_0x55ef61['id'],'MailQueueId':_0x42db08['id']});});});});});}})[_0x19d8('0x18')](respondWithStatusCode(_0x1db1ca,null))[_0x19d8('0x2c')](handleError(_0x1db1ca,null));};exports['removeTeams']=function(_0x9b2a3b,_0x57e37f){return db[_0x19d8('0x56')][_0x19d8('0x2a')]({'where':{'id':_0x9b2a3b[_0x19d8('0x30')]['ids']},'attributes':['id'],'include':[{'model':db[_0x19d8('0x5a')],'as':_0x19d8('0x66'),'attributes':['id'],'raw':!![]}]})[_0x19d8('0x18')](handleEntityNotFound(_0x57e37f,null))[_0x19d8('0x18')](function(_0x418065){var _0xf49448=_[_0x19d8('0x22')](_0x418065,'id');var _0x221b6d=[];var _0x1d5ca6=[];var _0x488d0e=squel[_0x19d8('0x67')]();_0x488d0e[_0x19d8('0x68')](_0x19d8('0x69'))[_0x19d8('0x6a')](_0x19d8('0x6b'),'tq')[_0x19d8('0x6c')](_0x19d8('0x6d'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x19d8('0x28')](_0x19d8('0x6e'),_0x9b2a3b[_0x19d8('0x42')]['id']);for(var _0x9ae301=0x0;_0x9ae301<_0x418065[_0x19d8('0x35')];_0x9ae301+=0x1){let _0x301967=_0x418065[_0x9ae301];for(var _0x47a8d5=0x0;_0x47a8d5<_0x301967['Agents'][_0x19d8('0x35')];_0x47a8d5+=0x1){let _0x54c2a9=_0x301967['Agents'][_0x47a8d5];var _0x52d88d=_0x488d0e[_0x19d8('0x6f')]();_0x52d88d[_0x19d8('0x28')](_0x19d8('0x70'),_0x54c2a9['id']);_0x1d5ca6[_0x19d8('0x71')](db[_0x19d8('0x5f')]['query'](_0x52d88d[_0x19d8('0x72')](),{'type':db[_0x19d8('0x5f')][_0x19d8('0x73')][_0x19d8('0x74')]})['then'](function(_0x4b844a){if(_0x4b844a[_0x19d8('0x35')]===0x1){return _0x54c2a9['id'];}else{var _0x1e35be=_[_0x19d8('0x75')](_[_0x19d8('0x22')](_0x4b844a,'TeamId'),function(_0x1767f8){return _[_0x19d8('0x76')](_0xf49448,_0x1767f8);});if(_0x1e35be){return _0x54c2a9['id'];}}}));}}return BPromise['all'](_0x1d5ca6)[_0x19d8('0x18')](function(_0x38c7db){_0x221b6d=_(_0x221b6d)['union'](_0x38c7db)[_0x19d8('0x77')]()['value']();return db['MailQueue'][_0x19d8('0x38')]({'where':{'id':_0x9b2a3b[_0x19d8('0x42')]['id']}})['then'](function(_0x1361c9){return db['sequelize']['transaction'](function(_0x5037f1){return _0x1361c9[_0x19d8('0x78')](_0x9b2a3b['query'][_0x19d8('0x59')],{'transaction':_0x5037f1})[_0x19d8('0x18')](function(){if(!_[_0x19d8('0x79')](_0x221b6d)){return _0x1361c9['removeAgents'](_0x221b6d,{'transaction':_0x5037f1});}})[_0x19d8('0x18')](function(){_0x221b6d[_0x19d8('0x63')](function(_0x506ff5){socket[_0x19d8('0x64')]('userMailQueue:remove',{'UserId':_0x506ff5,'MailQueueId':_0x1361c9['id']});});});});});});})[_0x19d8('0x18')](respondWithStatusCode(_0x57e37f,null))[_0x19d8('0x2c')](handleError(_0x57e37f,null));};exports[_0x19d8('0x7a')]=function(_0x9aef4f,_0x78b7e){return db[_0x19d8('0x23')]['find']({'where':{'id':_0x9aef4f['params']['id']}})[_0x19d8('0x18')](handleEntityNotFound(_0x78b7e,null))['then'](function(_0xed9f5f){if(_0xed9f5f){return _0xed9f5f[_0x19d8('0x7a')](_0x9aef4f['body'][_0x19d8('0x59')],_[_0x19d8('0x7b')](_0x9aef4f[_0x19d8('0x3a')],[_0x19d8('0x59'),'id'])||{})['spread'](function(_0x486888){for(var _0x48c65d=0x0;_0x48c65d<_0x9aef4f[_0x19d8('0x3a')][_0x19d8('0x59')]['length'];_0x48c65d+=0x1){socket[_0x19d8('0x64')](_0x19d8('0x65'),{'UserId':Number(_0x9aef4f[_0x19d8('0x3a')]['ids'][_0x48c65d]),'MailQueueId':Number(_0x9aef4f[_0x19d8('0x42')]['id'])});}return _0x486888;});}})[_0x19d8('0x18')](respondWithResult(_0x78b7e,null))[_0x19d8('0x2c')](handleError(_0x78b7e,null));};exports[_0x19d8('0x7c')]=function(_0x2946c3,_0x399580){return db[_0x19d8('0x23')][_0x19d8('0x38')]({'where':{'id':_0x2946c3[_0x19d8('0x42')]['id']}})['then'](handleEntityNotFound(_0x399580,null))[_0x19d8('0x18')](function(_0x2c95aa){if(_0x2c95aa){return _0x2c95aa[_0x19d8('0x7c')](_0x2946c3[_0x19d8('0x30')][_0x19d8('0x59')])[_0x19d8('0x18')](function(){if(_['isArray'](_0x2946c3['query'][_0x19d8('0x59')])){for(var _0x48500b=0x0;_0x48500b<_0x2946c3['query']['ids']['length'];_0x48500b+=0x1){socket[_0x19d8('0x64')]('userMailQueue:remove',{'UserId':Number(_0x2946c3[_0x19d8('0x30')][_0x19d8('0x59')][_0x48500b]),'MailQueueId':Number(_0x2946c3[_0x19d8('0x42')]['id'])});}}else{socket['emit'](_0x19d8('0x7d'),{'UserId':Number(_0x2946c3['query']['ids']),'MailQueueId':Number(_0x2946c3[_0x19d8('0x42')]['id'])});}});}})[_0x19d8('0x18')](respondWithStatusCode(_0x399580,null))['catch'](handleError(_0x399580,null));};exports[_0x19d8('0x7e')]=function(_0x8a4c1b,_0x4780e7){var _0x5b6a9c={};var _0x52dcf9={};var _0x5dedcc;var _0x4da75b;return db['MailQueue'][_0x19d8('0x45')]({'where':{'id':_0x8a4c1b[_0x19d8('0x42')]['id']}})[_0x19d8('0x18')](handleEntityNotFound(_0x4780e7,null))[_0x19d8('0x18')](function(_0x507351){if(_0x507351){_0x5dedcc=_0x507351;_0x52dcf9[_0x19d8('0x32')]=_[_0x19d8('0x2e')](db['User'][_0x19d8('0x2f')]);_0x52dcf9[_0x19d8('0x30')]=_[_0x19d8('0x2e')](_0x8a4c1b[_0x19d8('0x30')]);_0x52dcf9['filters']=_['intersection'](_0x52dcf9['model'],_0x52dcf9['query']);_0x5b6a9c[_0x19d8('0x33')]=_[_0x19d8('0x31')](_0x52dcf9['model'],qs['fields'](_0x8a4c1b['query'][_0x19d8('0x34')]));_0x5b6a9c[_0x19d8('0x33')]=_0x5b6a9c[_0x19d8('0x33')][_0x19d8('0x35')]?_0x5b6a9c[_0x19d8('0x33')]:_0x52dcf9[_0x19d8('0x32')];_0x5b6a9c[_0x19d8('0x57')]=qs['sort'](_0x8a4c1b[_0x19d8('0x30')][_0x19d8('0x4a')]);_0x5b6a9c['where']=qs[_0x19d8('0x47')](_[_0x19d8('0x58')](_0x8a4c1b['query'],_0x52dcf9[_0x19d8('0x47')]));if(_0x8a4c1b[_0x19d8('0x30')][_0x19d8('0x4c')]){_0x5b6a9c[_0x19d8('0x28')]=_[_0x19d8('0x37')](_0x5b6a9c['where'],{'$or':_[_0x19d8('0x22')](_0x5b6a9c[_0x19d8('0x33')],function(_0x4101a3){var _0x925a4={};_0x925a4[_0x4101a3]={'$like':'%'+_0x8a4c1b[_0x19d8('0x30')][_0x19d8('0x4c')]+'%'};return _0x925a4;})});}_0x5b6a9c=_[_0x19d8('0x37')]({},_0x5b6a9c,_0x8a4c1b['options']);return _0x5dedcc[_0x19d8('0x7e')](_0x5b6a9c);}})['then'](function(_0x2ae1f4){if(_0x2ae1f4){_0x4da75b=_0x2ae1f4[_0x19d8('0x35')];if(!_0x8a4c1b[_0x19d8('0x30')][_0x19d8('0x48')](_0x19d8('0x49'))){_0x5b6a9c[_0x19d8('0x14')]=qs['limit'](_0x8a4c1b[_0x19d8('0x30')][_0x19d8('0x14')]);_0x5b6a9c[_0x19d8('0x12')]=qs['offset'](_0x8a4c1b[_0x19d8('0x30')][_0x19d8('0x12')]);}return _0x5dedcc[_0x19d8('0x7e')](_0x5b6a9c);}})[_0x19d8('0x18')](function(_0x503711){if(_0x503711){return _0x503711?{'count':_0x4da75b,'rows':_0x503711}:null;}})[_0x19d8('0x18')](respondWithResult(_0x4780e7,null))[_0x19d8('0x2c')](handleError(_0x4780e7,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 78b0b30..39ad044 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 _0xf732=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','MailQueue','setMaxListeners','update'];(function(_0x2918e1,_0x9613bc){var _0x2f5165=function(_0x12d6e2){while(--_0x12d6e2){_0x2918e1['push'](_0x2918e1['shift']());}};_0x2f5165(++_0x9613bc);}(_0xf732,0x67));var _0x2f73=function(_0x582d37,_0xc34a90){_0x582d37=_0x582d37-0x0;var _0x4aa6b6=_0xf732[_0x582d37];return _0x4aa6b6;};'use strict';var EventEmitter=require(_0x2f73('0x0'));var MailQueue=require(_0x2f73('0x1'))['db'][_0x2f73('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x2f73('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2f73('0x4'),'afterDestroy':_0x2f73('0x5')};function emitEvent(_0x1168f7){return function(_0x1aeb9d,_0x5b010b,_0xfcc901){MailQueueEvents[_0x2f73('0x6')](_0x1168f7+':'+_0x1aeb9d['id'],_0x1aeb9d);MailQueueEvents[_0x2f73('0x6')](_0x1168f7,_0x1aeb9d);_0xfcc901(null);};}for(var e in events){if(events[_0x2f73('0x7')](e)){var event=events[e];MailQueue[_0x2f73('0x8')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x97be=['hasOwnProperty','hook','exports','events','../../mysqldb','update','remove','emit'];(function(_0x458285,_0x2132d0){var _0x311be0=function(_0x46d466){while(--_0x46d466){_0x458285['push'](_0x458285['shift']());}};_0x311be0(++_0x2132d0);}(_0x97be,0xf3));var _0xe97b=function(_0x24b0ba,_0x2d58bc){_0x24b0ba=_0x24b0ba-0x0;var _0x4df53a=_0x97be[_0x24b0ba];return _0x4df53a;};'use strict';var EventEmitter=require(_0xe97b('0x0'));var MailQueue=require(_0xe97b('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe97b('0x2'),'afterDestroy':_0xe97b('0x3')};function emitEvent(_0x306075){return function(_0x2897c2,_0x209e4d,_0x243df0){MailQueueEvents[_0xe97b('0x4')](_0x306075+':'+_0x2897c2['id'],_0x2897c2);MailQueueEvents[_0xe97b('0x4')](_0x306075,_0x2897c2);_0x243df0(null);};}for(var e in events){if(events[_0xe97b('0x5')](e)){var event=events[e];MailQueue[_0xe97b('0x6')](e,emitEvent(event));}}module[_0xe97b('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 562578c..15ee8e4 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 _0x6873=['../../config/logger','api','bluebird','request-promise','exports','define','MailQueue','util'];(function(_0x10b48a,_0x1a0a3f){var _0x2c4533=function(_0x5e4be6){while(--_0x5e4be6){_0x10b48a['push'](_0x10b48a['shift']());}};_0x2c4533(++_0x1a0a3f);}(_0x6873,0x1ef));var _0x3687=function(_0x592e40,_0x2ed011){_0x592e40=_0x592e40-0x0;var _0x5d4288=_0x6873[_0x592e40];return _0x5d4288;};'use strict';var _=require('lodash');var util=require(_0x3687('0x0'));var logger=require(_0x3687('0x1'))(_0x3687('0x2'));var moment=require('moment');var BPromise=require(_0x3687('0x3'));var rp=require(_0x3687('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module[_0x3687('0x5')]=function(_0xb66a7,_0x2cd366){return _0xb66a7[_0x3687('0x6')](_0x3687('0x7'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x728b=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','MailQueue','lodash'];(function(_0x30a79b,_0xf8f34a){var _0x24d0d2=function(_0x58d286){while(--_0x58d286){_0x30a79b['push'](_0x30a79b['shift']());}};_0x24d0d2(++_0xf8f34a);}(_0x728b,0xe6));var _0xb728=function(_0x3150d1,_0x4e693d){_0x3150d1=_0x3150d1-0x0;var _0x22a258=_0x728b[_0x3150d1];return _0x22a258;};'use strict';var _=require(_0xb728('0x0'));var util=require(_0xb728('0x1'));var logger=require(_0xb728('0x2'))('api');var moment=require(_0xb728('0x3'));var BPromise=require(_0xb728('0x4'));var rp=require(_0xb728('0x5'));var fs=require('fs');var path=require(_0xb728('0x6'));var rimraf=require(_0xb728('0x7'));var config=require(_0xb728('0x8'));var attributes=require('./mailQueue.attributes');module[_0xb728('0x9')]=function(_0x3c8bd4,_0x344bb7){return _0x3c8bd4['define'](_0xb728('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 736068a..2f4b777 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 _0xf996=['../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailQueue,\x20%s,\x20%s','message','result','catch','GetMailQueue','MailQueue','options','raw','where','attributes','limit','include','map','model','debug','ShowMailQueue','find','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x1913dd,_0x1bf814){var _0x31852c=function(_0x30aa2d){while(--_0x30aa2d){_0x1913dd['push'](_0x1913dd['shift']());}};_0x31852c(++_0x1bf814);}(_0xf996,0x74));var _0x6f99=function(_0x343e9f,_0x319944){_0x343e9f=_0x343e9f-0x0;var _0x710004=_0xf996[_0x343e9f];return _0x710004;};'use strict';var _=require(_0x6f99('0x0'));var util=require(_0x6f99('0x1'));var moment=require(_0x6f99('0x2'));var BPromise=require('bluebird');var rs=require(_0x6f99('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6f99('0x4'));var logger=require(_0x6f99('0x5'))(_0x6f99('0x6'));var config=require(_0x6f99('0x7'));var jayson=require(_0x6f99('0x8'));var client=jayson[_0x6f99('0x9')][_0x6f99('0xa')]({'port':0x232a});config[_0x6f99('0xb')]=_[_0x6f99('0xc')](config[_0x6f99('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6f99('0xd'))(new Redis(config['redis']));require(_0x6f99('0xe'))[_0x6f99('0xf')](socket);function respondWithRpcPromise(_0x41f436,_0x161b64,_0xf42ba3){return new BPromise(function(_0x2edd9,_0x43b5c0){return client[_0x6f99('0x10')](_0x41f436,_0xf42ba3)[_0x6f99('0x11')](function(_0x509929){logger[_0x6f99('0x12')]('MailQueue,\x20%s,\x20%s',_0x161b64,'request\x20sent');logger['debug'](_0x6f99('0x13'),_0x161b64,_0x6f99('0x14'),JSON[_0x6f99('0x15')](_0x509929));if(_0x509929[_0x6f99('0x16')]){if(_0x509929[_0x6f99('0x16')][_0x6f99('0x17')]===0x1f4){logger[_0x6f99('0x16')](_0x6f99('0x18'),_0x161b64,_0x509929[_0x6f99('0x16')][_0x6f99('0x19')]);return _0x43b5c0(_0x509929[_0x6f99('0x16')][_0x6f99('0x19')]);}logger['error'](_0x6f99('0x18'),_0x161b64,_0x509929[_0x6f99('0x16')]['message']);return _0x2edd9(_0x509929['error'][_0x6f99('0x19')]);}else{logger['info'](_0x6f99('0x18'),_0x161b64,_0x6f99('0x14'));_0x2edd9(_0x509929[_0x6f99('0x1a')][_0x6f99('0x19')]);}})[_0x6f99('0x1b')](function(_0x5bfb51){logger[_0x6f99('0x16')]('MailQueue,\x20%s,\x20%s',_0x161b64,_0x5bfb51);_0x43b5c0(_0x5bfb51);});});}exports[_0x6f99('0x1c')]=function(_0x286edb){var _0x4cfa68=this;return new Promise(function(_0x26cd36,_0x1dc9e5){return db[_0x6f99('0x1d')]['findAll']({'raw':_0x286edb['options']?_0x286edb[_0x6f99('0x1e')][_0x6f99('0x1f')]===undefined?!![]:![]:!![],'where':_0x286edb['options']?_0x286edb['options'][_0x6f99('0x20')]||null:null,'attributes':_0x286edb[_0x6f99('0x1e')]?_0x286edb[_0x6f99('0x1e')][_0x6f99('0x21')]||null:null,'limit':_0x286edb[_0x6f99('0x1e')]?_0x286edb[_0x6f99('0x1e')][_0x6f99('0x22')]||null:null,'include':_0x286edb[_0x6f99('0x1e')]?_0x286edb[_0x6f99('0x1e')][_0x6f99('0x23')]?_[_0x6f99('0x24')](_0x286edb[_0x6f99('0x1e')][_0x6f99('0x23')],function(_0x381e92){return{'model':db[_0x381e92['model']],'as':_0x381e92['as'],'attributes':_0x381e92[_0x6f99('0x21')],'include':_0x381e92[_0x6f99('0x23')]?_['map'](_0x381e92['include'],function(_0x7eef41){return{'model':db[_0x7eef41[_0x6f99('0x25')]],'as':_0x7eef41['as'],'attributes':_0x7eef41['attributes'],'include':_0x7eef41[_0x6f99('0x23')]?_[_0x6f99('0x24')](_0x7eef41['include'],function(_0x45fe22){return{'model':db[_0x45fe22[_0x6f99('0x25')]],'as':_0x45fe22['as'],'attributes':_0x45fe22['attributes']};}):[]};}):[]};}):[]:[]})[_0x6f99('0x11')](function(_0x3ef6c5){logger[_0x6f99('0x12')](_0x6f99('0x1c'),_0x286edb);logger[_0x6f99('0x26')](_0x6f99('0x1c'),_0x286edb,JSON['stringify'](_0x3ef6c5));_0x26cd36(_0x3ef6c5);})[_0x6f99('0x1b')](function(_0x1972f0){logger['error']('GetMailQueue',_0x1972f0[_0x6f99('0x19')],_0x286edb);_0x1dc9e5(_0x4cfa68[_0x6f99('0x16')](0x1f4,_0x1972f0[_0x6f99('0x19')]));});});};exports[_0x6f99('0x27')]=function(_0x1dea2c){var _0x184bbe=this;return new Promise(function(_0x47d721,_0x499926){return db[_0x6f99('0x1d')][_0x6f99('0x28')]({'raw':_0x1dea2c[_0x6f99('0x1e')]?_0x1dea2c[_0x6f99('0x1e')][_0x6f99('0x1f')]===undefined?!![]:![]:!![],'where':_0x1dea2c[_0x6f99('0x1e')]?_0x1dea2c[_0x6f99('0x1e')][_0x6f99('0x20')]||null:null,'attributes':_0x1dea2c[_0x6f99('0x1e')]?_0x1dea2c[_0x6f99('0x1e')][_0x6f99('0x21')]||null:null,'include':_0x1dea2c['options']?_0x1dea2c[_0x6f99('0x1e')][_0x6f99('0x23')]?_[_0x6f99('0x24')](_0x1dea2c[_0x6f99('0x1e')][_0x6f99('0x23')],function(_0x48a1b8){return{'model':db[_0x48a1b8[_0x6f99('0x25')]],'as':_0x48a1b8['as'],'attributes':_0x48a1b8[_0x6f99('0x21')],'include':_0x48a1b8['include']?_[_0x6f99('0x24')](_0x48a1b8[_0x6f99('0x23')],function(_0x46de85){return{'model':db[_0x46de85[_0x6f99('0x25')]],'as':_0x46de85['as'],'attributes':_0x46de85[_0x6f99('0x21')],'include':_0x46de85[_0x6f99('0x23')]?_[_0x6f99('0x24')](_0x46de85[_0x6f99('0x23')],function(_0x56e206){return{'model':db[_0x56e206[_0x6f99('0x25')]],'as':_0x56e206['as'],'attributes':_0x56e206['attributes']};}):[]};}):[]};}):[]:[]})[_0x6f99('0x11')](function(_0x383220){logger[_0x6f99('0x12')](_0x6f99('0x27'),_0x1dea2c);logger['debug'](_0x6f99('0x27'),_0x1dea2c,JSON['stringify'](_0x383220));_0x47d721(_0x383220);})[_0x6f99('0x1b')](function(_0x321515){logger[_0x6f99('0x16')](_0x6f99('0x27'),_0x321515[_0x6f99('0x19')],_0x1dea2c);_0x499926(_0x184bbe[_0x6f99('0x16')](0x1f4,_0x321515[_0x6f99('0x19')]));});});}; \ No newline at end of file +var _0x2c59=['result','catch','MailQueue','findAll','options','raw','attributes','limit','include','map','model','GetMailQueue','ShowMailQueue','find','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x3f36e9,_0x432d5d){var _0x3f7aa4=function(_0x4d9d88){while(--_0x4d9d88){_0x3f36e9['push'](_0x3f36e9['shift']());}};_0x3f7aa4(++_0x432d5d);}(_0x2c59,0xb7));var _0x92c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c59[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x92c5('0x0'));var BPromise=require(_0x92c5('0x1'));var rs=require(_0x92c5('0x2'));var fs=require('fs');var Redis=require(_0x92c5('0x3'));var db=require(_0x92c5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x92c5('0x5'))(_0x92c5('0x6'));var config=require(_0x92c5('0x7'));var jayson=require(_0x92c5('0x8'));var client=jayson[_0x92c5('0x9')][_0x92c5('0xa')]({'port':0x232a});config[_0x92c5('0xb')]=_[_0x92c5('0xc')](config[_0x92c5('0xb')],{'host':_0x92c5('0xd'),'port':0x18eb});var socket=require(_0x92c5('0xe'))(new Redis(config[_0x92c5('0xb')]));require(_0x92c5('0xf'))[_0x92c5('0x10')](socket);function respondWithRpcPromise(_0x4c7343,_0x4ba4b9,_0x5415e1){return new BPromise(function(_0x429dc7,_0x51bc2d){return client[_0x92c5('0x11')](_0x4c7343,_0x5415e1)[_0x92c5('0x12')](function(_0x4b72b6){logger['info'](_0x92c5('0x13'),_0x4ba4b9,_0x92c5('0x14'));logger[_0x92c5('0x15')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x4ba4b9,_0x92c5('0x14'),JSON[_0x92c5('0x16')](_0x4b72b6));if(_0x4b72b6[_0x92c5('0x17')]){if(_0x4b72b6['error'][_0x92c5('0x18')]===0x1f4){logger[_0x92c5('0x17')](_0x92c5('0x13'),_0x4ba4b9,_0x4b72b6[_0x92c5('0x17')][_0x92c5('0x19')]);return _0x51bc2d(_0x4b72b6[_0x92c5('0x17')][_0x92c5('0x19')]);}logger[_0x92c5('0x17')]('MailQueue,\x20%s,\x20%s',_0x4ba4b9,_0x4b72b6[_0x92c5('0x17')][_0x92c5('0x19')]);return _0x429dc7(_0x4b72b6[_0x92c5('0x17')][_0x92c5('0x19')]);}else{logger[_0x92c5('0x1a')](_0x92c5('0x13'),_0x4ba4b9,_0x92c5('0x14'));_0x429dc7(_0x4b72b6[_0x92c5('0x1b')][_0x92c5('0x19')]);}})[_0x92c5('0x1c')](function(_0x83b797){logger['error'](_0x92c5('0x13'),_0x4ba4b9,_0x83b797);_0x51bc2d(_0x83b797);});});}exports['GetMailQueue']=function(_0x3c9fde){var _0x51bbfb=this;return new Promise(function(_0x1b1fcd,_0x36a3f2){return db[_0x92c5('0x1d')][_0x92c5('0x1e')]({'raw':_0x3c9fde['options']?_0x3c9fde[_0x92c5('0x1f')][_0x92c5('0x20')]===undefined?!![]:![]:!![],'where':_0x3c9fde[_0x92c5('0x1f')]?_0x3c9fde[_0x92c5('0x1f')]['where']||null:null,'attributes':_0x3c9fde[_0x92c5('0x1f')]?_0x3c9fde[_0x92c5('0x1f')][_0x92c5('0x21')]||null:null,'limit':_0x3c9fde[_0x92c5('0x1f')]?_0x3c9fde['options'][_0x92c5('0x22')]||null:null,'include':_0x3c9fde['options']?_0x3c9fde['options'][_0x92c5('0x23')]?_[_0x92c5('0x24')](_0x3c9fde[_0x92c5('0x1f')][_0x92c5('0x23')],function(_0x1415d4){return{'model':db[_0x1415d4[_0x92c5('0x25')]],'as':_0x1415d4['as'],'attributes':_0x1415d4[_0x92c5('0x21')],'include':_0x1415d4[_0x92c5('0x23')]?_[_0x92c5('0x24')](_0x1415d4[_0x92c5('0x23')],function(_0x2c675e){return{'model':db[_0x2c675e[_0x92c5('0x25')]],'as':_0x2c675e['as'],'attributes':_0x2c675e[_0x92c5('0x21')],'include':_0x2c675e[_0x92c5('0x23')]?_[_0x92c5('0x24')](_0x2c675e[_0x92c5('0x23')],function(_0x460f31){return{'model':db[_0x460f31[_0x92c5('0x25')]],'as':_0x460f31['as'],'attributes':_0x460f31['attributes']};}):[]};}):[]};}):[]:[]})[_0x92c5('0x12')](function(_0x55b554){logger[_0x92c5('0x1a')](_0x92c5('0x26'),_0x3c9fde);logger[_0x92c5('0x15')](_0x92c5('0x26'),_0x3c9fde,JSON['stringify'](_0x55b554));_0x1b1fcd(_0x55b554);})[_0x92c5('0x1c')](function(_0x1be770){logger['error'](_0x92c5('0x26'),_0x1be770[_0x92c5('0x19')],_0x3c9fde);_0x36a3f2(_0x51bbfb[_0x92c5('0x17')](0x1f4,_0x1be770[_0x92c5('0x19')]));});});};exports[_0x92c5('0x27')]=function(_0x31cc40){var _0x450386=this;return new Promise(function(_0x3dd97c,_0x13b2a1){return db[_0x92c5('0x1d')][_0x92c5('0x28')]({'raw':_0x31cc40[_0x92c5('0x1f')]?_0x31cc40[_0x92c5('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x31cc40[_0x92c5('0x1f')]?_0x31cc40[_0x92c5('0x1f')][_0x92c5('0x29')]||null:null,'attributes':_0x31cc40[_0x92c5('0x1f')]?_0x31cc40[_0x92c5('0x1f')][_0x92c5('0x21')]||null:null,'include':_0x31cc40[_0x92c5('0x1f')]?_0x31cc40[_0x92c5('0x1f')][_0x92c5('0x23')]?_[_0x92c5('0x24')](_0x31cc40[_0x92c5('0x1f')]['include'],function(_0x259c89){return{'model':db[_0x259c89[_0x92c5('0x25')]],'as':_0x259c89['as'],'attributes':_0x259c89[_0x92c5('0x21')],'include':_0x259c89['include']?_[_0x92c5('0x24')](_0x259c89[_0x92c5('0x23')],function(_0x32dea8){return{'model':db[_0x32dea8[_0x92c5('0x25')]],'as':_0x32dea8['as'],'attributes':_0x32dea8[_0x92c5('0x21')],'include':_0x32dea8[_0x92c5('0x23')]?_[_0x92c5('0x24')](_0x32dea8[_0x92c5('0x23')],function(_0x47c9a6){return{'model':db[_0x47c9a6[_0x92c5('0x25')]],'as':_0x47c9a6['as'],'attributes':_0x47c9a6[_0x92c5('0x21')]};}):[]};}):[]};}):[]:[]})[_0x92c5('0x12')](function(_0x523f62){logger[_0x92c5('0x1a')](_0x92c5('0x27'),_0x31cc40);logger[_0x92c5('0x15')](_0x92c5('0x27'),_0x31cc40,JSON[_0x92c5('0x16')](_0x523f62));_0x3dd97c(_0x523f62);})[_0x92c5('0x1c')](function(_0x2a2eae){logger[_0x92c5('0x17')](_0x92c5('0x27'),_0x2a2eae['message'],_0x31cc40);_0x13b2a1(_0x450386[_0x92c5('0x17')](0x1f4,_0x2a2eae['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 9a1e92d..c17bfc3 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 _0x13c9=['remove','removeListener','length','mailQueue:','save'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0x13c9,0x1c1));var _0x913c=function(_0xe0b9a4,_0x10f667){_0xe0b9a4=_0xe0b9a4-0x0;var _0x4520c6=_0x13c9[_0xe0b9a4];return _0x4520c6;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x913c('0x0'),_0x913c('0x1'),'update'];function createListener(_0x635577,_0xfd36cc){return function(_0x193b82){_0xfd36cc['emit'](_0x635577,_0x193b82);};}function removeListener(_0x2cc2ee,_0x14c2c8){return function(){MailQueueEvents[_0x913c('0x2')](_0x2cc2ee,_0x14c2c8);};}exports['register']=function(_0x4b265f){for(var _0x2c4741=0x0,_0x52e125=events[_0x913c('0x3')];_0x2c4741<_0x52e125;_0x2c4741++){var _0x26a913=events[_0x2c4741];var _0x2e6bc7=createListener(_0x913c('0x4')+_0x26a913,_0x4b265f);MailQueueEvents['on'](_0x26a913,_0x2e6bc7);}}; \ No newline at end of file +var _0xfecd=['removeListener','register','length','mailQueue:','./mailQueue.events','remove','update'];(function(_0x37c3c9,_0x4813c5){var _0xe8617e=function(_0x3d1619){while(--_0x3d1619){_0x37c3c9['push'](_0x37c3c9['shift']());}};_0xe8617e(++_0x4813c5);}(_0xfecd,0x107));var _0xdfec=function(_0xeb7c21,_0xe67b4){_0xeb7c21=_0xeb7c21-0x0;var _0xc91d23=_0xfecd[_0xeb7c21];return _0xc91d23;};'use strict';var MailQueueEvents=require(_0xdfec('0x0'));var events=['save',_0xdfec('0x1'),_0xdfec('0x2')];function createListener(_0x5a23aa,_0x412b00){return function(_0x2fb9f4){_0x412b00['emit'](_0x5a23aa,_0x2fb9f4);};}function removeListener(_0x46bda1,_0x51658b){return function(){MailQueueEvents[_0xdfec('0x3')](_0x46bda1,_0x51658b);};}exports[_0xdfec('0x4')]=function(_0x10ca9b){for(var _0x4d0fa6=0x0,_0x2f35a8=events[_0xdfec('0x5')];_0x4d0fa6<_0x2f35a8;_0x4d0fa6++){var _0x40782c=events[_0x4d0fa6];var _0x81175c=createListener(_0xdfec('0x6')+_0x40782c,_0x10ca9b);MailQueueEvents['on'](_0x40782c,_0x81175c);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 796d886..13bc12e 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 _0xae0f=['get','/describe','isAuthenticated','/:id','create','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller','index'];(function(_0x1e8cf1,_0x494b52){var _0x5026d2=function(_0x39876c){while(--_0x39876c){_0x1e8cf1['push'](_0x1e8cf1['shift']());}};_0x5026d2(++_0x494b52);}(_0xae0f,0xa9));var _0xfae0=function(_0x515516,_0x19cafd){_0x515516=_0x515516-0x0;var _0x1ba828=_0xae0f[_0x515516];return _0x1ba828;};'use strict';var multer=require(_0xfae0('0x0'));var util=require(_0xfae0('0x1'));var path=require(_0xfae0('0x2'));var timeout=require(_0xfae0('0x3'));var express=require(_0xfae0('0x4'));var router=express[_0xfae0('0x5')]();var fs_extra=require(_0xfae0('0x6'));var auth=require(_0xfae0('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xfae0('0x8'));var controller=require(_0xfae0('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xfae0('0xa')]);router[_0xfae0('0xb')](_0xfae0('0xc'),auth[_0xfae0('0xd')](),controller['describe']);router['get'](_0xfae0('0xe'),auth[_0xfae0('0xd')](),controller['show']);router['post']('/',auth[_0xfae0('0xd')](),controller[_0xfae0('0xf')]);router[_0xfae0('0x10')](_0xfae0('0xe'),auth[_0xfae0('0xd')](),controller['update']);router[_0xfae0('0x11')](_0xfae0('0xe'),auth[_0xfae0('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6628=['../../config/environment','./mailQueueReport.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xc6a950,_0x30bb6d){var _0x45feee=function(_0x5f0bcf){while(--_0x5f0bcf){_0xc6a950['push'](_0xc6a950['shift']());}};_0x45feee(++_0x30bb6d);}(_0x6628,0x150));var _0x8662=function(_0x4ae26f,_0x3f54bf){_0x4ae26f=_0x4ae26f-0x0;var _0x3e5e15=_0x6628[_0x4ae26f];return _0x3e5e15;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8662('0x0'));var timeout=require(_0x8662('0x1'));var express=require(_0x8662('0x2'));var router=express[_0x8662('0x3')]();var fs_extra=require(_0x8662('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8662('0x5'));var config=require(_0x8662('0x6'));var controller=require(_0x8662('0x7'));router[_0x8662('0x8')]('/',auth[_0x8662('0x9')](),controller['index']);router['get']('/describe',auth[_0x8662('0x9')](),controller[_0x8662('0xa')]);router[_0x8662('0x8')](_0x8662('0xb'),auth[_0x8662('0x9')](),controller[_0x8662('0xc')]);router[_0x8662('0xd')]('/',auth[_0x8662('0x9')](),controller[_0x8662('0xe')]);router[_0x8662('0xf')](_0x8662('0xb'),auth[_0x8662('0x9')](),controller[_0x8662('0x10')]);router[_0x8662('0x11')](_0x8662('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x8662('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 008acb8..9ed9739 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 _0x22d3=['sequelize','STRING','DATE'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x22d3,0x66));var _0x322d=function(_0x1385dc,_0x2c7fd7){_0x1385dc=_0x1385dc-0x0;var _0x2f6469=_0x22d3[_0x1385dc];return _0x2f6469;};'use strict';var moment=require('moment');var Sequelize=require(_0x322d('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x322d('0x1')]},'joinAt':{'type':Sequelize[_0x322d('0x2')]},'leaveAt':{'type':Sequelize[_0x322d('0x2')]},'acceptAt':{'type':Sequelize[_0x322d('0x2')]},'exitAt':{'type':Sequelize[_0x322d('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb22e=['STRING','DATE','moment','sequelize'];(function(_0x575b72,_0x1a7eb1){var _0x561c57=function(_0x10e401){while(--_0x10e401){_0x575b72['push'](_0x575b72['shift']());}};_0x561c57(++_0x1a7eb1);}(_0xb22e,0xba));var _0xeb22=function(_0x151a3f,_0x4cac03){_0x151a3f=_0x151a3f-0x0;var _0xa3489f=_0xb22e[_0x151a3f];return _0xa3489f;};'use strict';var moment=require(_0xeb22('0x0'));var Sequelize=require(_0xeb22('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xeb22('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xeb22('0x2')]},'joinAt':{'type':Sequelize[_0xeb22('0x3')]},'leaveAt':{'type':Sequelize[_0xeb22('0x3')]},'acceptAt':{'type':Sequelize[_0xeb22('0x3')]},'exitAt':{'type':Sequelize[_0xeb22('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 6cec0c5..f4fc3e3 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 _0x0adf=['find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','MailQueueReport','count','includeAll','include','findAll','rows','catch','show','params','fields'];(function(_0x21aea9,_0x4cc2c3){var _0x233ea8=function(_0x1e86e9){while(--_0x1e86e9){_0x21aea9['push'](_0x21aea9['shift']());}};_0x233ea8(++_0x4cc2c3);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x9c6930,_0x2ae3ab){_0x9c6930=_0x9c6930-0x0;var _0x1e6d58=_0x0adf[_0x9c6930];return _0x1e6d58;};'use strict';var emlformat=require(_0xf0ad('0x0'));var rimraf=require(_0xf0ad('0x1'));var zipdir=require(_0xf0ad('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf0ad('0x3'));var moment=require(_0xf0ad('0x4'));var BPromise=require(_0xf0ad('0x5'));var Mustache=require(_0xf0ad('0x6'));var util=require(_0xf0ad('0x7'));var path=require(_0xf0ad('0x8'));var sox=require(_0xf0ad('0x9'));var csv=require('to-csv');var ejs=require(_0xf0ad('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf0ad('0xb'));var squel=require(_0xf0ad('0xc'));var crypto=require(_0xf0ad('0xd'));var jsforce=require(_0xf0ad('0xe'));var deskjs=require(_0xf0ad('0xf'));var toCsv=require(_0xf0ad('0x10'));var querystring=require(_0xf0ad('0x11'));var Papa=require('papaparse');var Redis=require(_0xf0ad('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf0ad('0x13'));var as=require(_0xf0ad('0x14'));var hardwareService=require(_0xf0ad('0x15'));var logger=require(_0xf0ad('0x16'))(_0xf0ad('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf0ad('0x18'));var db=require(_0xf0ad('0x19'))['db'];function respondWithStatusCode(_0x3646a2,_0x238c3b){_0x238c3b=_0x238c3b||0xcc;return function(_0x597c40){if(_0x597c40){return _0x3646a2[_0xf0ad('0x1a')](_0x238c3b);}return _0x3646a2[_0xf0ad('0x1b')](_0x238c3b)['end']();};}function respondWithResult(_0x49df92,_0x5332e9){_0x5332e9=_0x5332e9||0xc8;return function(_0x221d7b){if(_0x221d7b){return _0x49df92['status'](_0x5332e9)[_0xf0ad('0x1c')](_0x221d7b);}};}function respondWithFilteredResult(_0x313ad6,_0xfa544c){return function(_0xfa829e){if(_0xfa829e){var _0x237dd9=typeof _0xfa544c['offset']===_0xf0ad('0x1d')&&typeof _0xfa544c[_0xf0ad('0x1e')]===_0xf0ad('0x1d');var _0x1c9fac=_0xfa829e['count'];var _0x4e9970=_0x237dd9?0x0:_0xfa544c[_0xf0ad('0x1f')];var _0x46fb20=_0x237dd9?_0xfa829e['count']:_0xfa544c[_0xf0ad('0x1f')]+_0xfa544c[_0xf0ad('0x1e')];var _0x9a95bf;if(_0x46fb20>=_0x1c9fac){_0x46fb20=_0x1c9fac;_0x9a95bf=0xc8;}else{_0x9a95bf=0xce;}_0x313ad6[_0xf0ad('0x1b')](_0x9a95bf);return _0x313ad6['set']('Content-Range',_0x4e9970+'-'+_0x46fb20+'/'+_0x1c9fac)[_0xf0ad('0x1c')](_0xfa829e);}return null;};}function patchUpdates(_0x2da425){return function(_0x37b968){try{jsonpatch[_0xf0ad('0x20')](_0x37b968,_0x2da425,!![]);}catch(_0x2ac8ba){return BPromise[_0xf0ad('0x21')](_0x2ac8ba);}return _0x37b968['save']();};}function saveUpdates(_0x33c95d,_0x16e62a){return function(_0x31635b){if(_0x31635b){return _0x31635b[_0xf0ad('0x22')](_0x33c95d)[_0xf0ad('0x23')](function(_0x88b47b){return _0x88b47b;});}return null;};}function removeEntity(_0xb91769,_0x276322){return function(_0x3fc97e){if(_0x3fc97e){return _0x3fc97e[_0xf0ad('0x24')]()[_0xf0ad('0x23')](function(){_0xb91769[_0xf0ad('0x1b')](0xcc)[_0xf0ad('0x25')]();});}};}function handleEntityNotFound(_0x456f81,_0x879f89){return function(_0x557f90){if(!_0x557f90){_0x456f81[_0xf0ad('0x1a')](0x194);}return _0x557f90;};}function handleError(_0x1507a3,_0x248794){_0x248794=_0x248794||0x1f4;return function(_0x7377d7){logger[_0xf0ad('0x26')](_0x7377d7[_0xf0ad('0x27')]);if(_0x7377d7['name']){delete _0x7377d7[_0xf0ad('0x28')];}_0x1507a3[_0xf0ad('0x1b')](_0x248794)[_0xf0ad('0x29')](_0x7377d7);};}exports[_0xf0ad('0x2a')]=function(_0x1b6880,_0x1ac25c){var _0x267b7a={},_0x1bee71={},_0x2386e8={'count':0x0,'rows':[]};var _0x39c46c=_[_0xf0ad('0x2b')](db['MailQueueReport'][_0xf0ad('0x2c')],function(_0x5f5115){return{'name':_0x5f5115[_0xf0ad('0x2d')],'type':_0x5f5115['type'][_0xf0ad('0x2e')]};});_0x1bee71[_0xf0ad('0x2f')]=_[_0xf0ad('0x2b')](_0x39c46c,_0xf0ad('0x28'));_0x1bee71[_0xf0ad('0x30')]=_[_0xf0ad('0x31')](_0x1b6880[_0xf0ad('0x30')]);_0x1bee71[_0xf0ad('0x32')]=_['intersection'](_0x1bee71['model'],_0x1bee71[_0xf0ad('0x30')]);_0x267b7a[_0xf0ad('0x33')]=_[_0xf0ad('0x34')](_0x1bee71[_0xf0ad('0x2f')],qs['fields'](_0x1b6880[_0xf0ad('0x30')]['fields']));_0x267b7a[_0xf0ad('0x33')]=_0x267b7a['attributes'][_0xf0ad('0x35')]?_0x267b7a['attributes']:_0x1bee71[_0xf0ad('0x2f')];if(!_0x1b6880[_0xf0ad('0x30')][_0xf0ad('0x36')](_0xf0ad('0x37'))){_0x267b7a[_0xf0ad('0x1e')]=qs[_0xf0ad('0x1e')](_0x1b6880[_0xf0ad('0x30')][_0xf0ad('0x1e')]);_0x267b7a['offset']=qs[_0xf0ad('0x1f')](_0x1b6880['query'][_0xf0ad('0x1f')]);}_0x267b7a['order']=qs[_0xf0ad('0x38')](_0x1b6880[_0xf0ad('0x30')][_0xf0ad('0x38')]);_0x267b7a[_0xf0ad('0x39')]=qs[_0xf0ad('0x32')](_['pick'](_0x1b6880[_0xf0ad('0x30')],_0x1bee71[_0xf0ad('0x32')]),_0x39c46c);if(_0x1b6880[_0xf0ad('0x30')][_0xf0ad('0x3a')]){_0x267b7a[_0xf0ad('0x39')]=_[_0xf0ad('0x3b')](_0x267b7a[_0xf0ad('0x39')],{'$or':_['map'](_0x39c46c,function(_0x2e0c7a){if(_0x2e0c7a[_0xf0ad('0x3c')]!==_0xf0ad('0x3d')){var _0x189f67={};_0x189f67[_0x2e0c7a[_0xf0ad('0x28')]]={'$like':'%'+_0x1b6880[_0xf0ad('0x30')][_0xf0ad('0x3a')]+'%'};return _0x189f67;}})});}_0x267b7a=_[_0xf0ad('0x3b')]({},_0x267b7a,_0x1b6880[_0xf0ad('0x3e')]);var _0x5dd631={'where':_0x267b7a[_0xf0ad('0x39')]};return db[_0xf0ad('0x3f')][_0xf0ad('0x40')](_0x5dd631)['then'](function(_0x510f54){_0x2386e8['count']=_0x510f54;if(_0x1b6880[_0xf0ad('0x30')][_0xf0ad('0x41')]){_0x267b7a[_0xf0ad('0x42')]=[{'all':!![]}];}return db[_0xf0ad('0x3f')][_0xf0ad('0x43')](_0x267b7a);})[_0xf0ad('0x23')](function(_0x39083d){_0x2386e8[_0xf0ad('0x44')]=_0x39083d;return _0x2386e8;})[_0xf0ad('0x23')](respondWithFilteredResult(_0x1ac25c,_0x267b7a))[_0xf0ad('0x45')](handleError(_0x1ac25c,null));};exports[_0xf0ad('0x46')]=function(_0x516a72,_0x4ea947){var _0x5cd1dc={'raw':!![],'where':{'id':_0x516a72[_0xf0ad('0x47')]['id']}},_0x1c0609={};_0x1c0609['model']=_[_0xf0ad('0x31')](db[_0xf0ad('0x3f')]['rawAttributes']);_0x1c0609[_0xf0ad('0x30')]=_[_0xf0ad('0x31')](_0x516a72[_0xf0ad('0x30')]);_0x1c0609[_0xf0ad('0x32')]=_['intersection'](_0x1c0609[_0xf0ad('0x2f')],_0x1c0609[_0xf0ad('0x30')]);_0x5cd1dc[_0xf0ad('0x33')]=_[_0xf0ad('0x34')](_0x1c0609[_0xf0ad('0x2f')],qs[_0xf0ad('0x48')](_0x516a72[_0xf0ad('0x30')][_0xf0ad('0x48')]));_0x5cd1dc[_0xf0ad('0x33')]=_0x5cd1dc[_0xf0ad('0x33')][_0xf0ad('0x35')]?_0x5cd1dc['attributes']:_0x1c0609[_0xf0ad('0x2f')];if(_0x516a72[_0xf0ad('0x30')][_0xf0ad('0x41')]){_0x5cd1dc['include']=[{'all':!![]}];}_0x5cd1dc=_['merge']({},_0x5cd1dc,_0x516a72[_0xf0ad('0x3e')]);return db[_0xf0ad('0x3f')][_0xf0ad('0x49')](_0x5cd1dc)[_0xf0ad('0x23')](handleEntityNotFound(_0x4ea947,null))[_0xf0ad('0x23')](respondWithResult(_0x4ea947,null))[_0xf0ad('0x45')](handleError(_0x4ea947,null));};exports[_0xf0ad('0x4a')]=function(_0x561f2a,_0x1e35ce){return db['MailQueueReport'][_0xf0ad('0x4a')](_0x561f2a[_0xf0ad('0x4b')],{})[_0xf0ad('0x23')](respondWithResult(_0x1e35ce,0xc9))[_0xf0ad('0x45')](handleError(_0x1e35ce,null));};exports[_0xf0ad('0x22')]=function(_0x5b18a7,_0x4e8ef5){if(_0x5b18a7[_0xf0ad('0x4b')]['id']){delete _0x5b18a7[_0xf0ad('0x4b')]['id'];}return db[_0xf0ad('0x3f')][_0xf0ad('0x49')]({'where':{'id':_0x5b18a7[_0xf0ad('0x47')]['id']}})[_0xf0ad('0x23')](handleEntityNotFound(_0x4e8ef5,null))[_0xf0ad('0x23')](saveUpdates(_0x5b18a7['body'],null))[_0xf0ad('0x23')](respondWithResult(_0x4e8ef5,null))[_0xf0ad('0x45')](handleError(_0x4e8ef5,null));};exports[_0xf0ad('0x24')]=function(_0xda0e52,_0x2cb082){return db['MailQueueReport'][_0xf0ad('0x49')]({'where':{'id':_0xda0e52[_0xf0ad('0x47')]['id']}})[_0xf0ad('0x23')](handleEntityNotFound(_0x2cb082,null))[_0xf0ad('0x23')](removeEntity(_0x2cb082,null))[_0xf0ad('0x45')](handleError(_0x2cb082,null));};exports[_0xf0ad('0x4c')]=function(_0x3d156d,_0x5e75d0){return db[_0xf0ad('0x3f')][_0xf0ad('0x4c')]()[_0xf0ad('0x23')](respondWithResult(_0x5e75d0,null))['catch'](handleError(_0x5e75d0,null));}; \ No newline at end of file +var _0x4137=['key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','includeAll','options','find','catch','body','describe','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','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','count','set','apply','reject','save','update','destroy','then','end','sendStatus','error','name','send','index','map','MailQueueReport','rawAttributes','type'];(function(_0x3878e9,_0x14fcf2){var _0x2ad526=function(_0x1bd76b){while(--_0x1bd76b){_0x3878e9['push'](_0x3878e9['shift']());}};_0x2ad526(++_0x14fcf2);}(_0x4137,0xf8));var _0x7413=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4137[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0x7413('0x0'));var rimraf=require(_0x7413('0x1'));var zipdir=require(_0x7413('0x2'));var jsonpatch=require(_0x7413('0x3'));var rp=require(_0x7413('0x4'));var moment=require(_0x7413('0x5'));var BPromise=require(_0x7413('0x6'));var Mustache=require(_0x7413('0x7'));var util=require(_0x7413('0x8'));var path=require(_0x7413('0x9'));var sox=require(_0x7413('0xa'));var csv=require(_0x7413('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7413('0xc'));var _=require(_0x7413('0xd'));var squel=require(_0x7413('0xe'));var crypto=require(_0x7413('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7413('0x10'));var toCsv=require(_0x7413('0xb'));var querystring=require('querystring');var Papa=require(_0x7413('0x11'));var Redis=require(_0x7413('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7413('0x13'));var as=require(_0x7413('0x14'));var hardwareService=require(_0x7413('0x15'));var logger=require(_0x7413('0x16'))(_0x7413('0x17'));var utils=require('../../config/utils');var config=require(_0x7413('0x18'));var licenseUtil=require(_0x7413('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18a874,_0xa26ca4){_0xa26ca4=_0xa26ca4||0xcc;return function(_0x13e6bd){if(_0x13e6bd){return _0x18a874['sendStatus'](_0xa26ca4);}return _0x18a874['status'](_0xa26ca4)['end']();};}function respondWithResult(_0x2267f6,_0x336c4c){_0x336c4c=_0x336c4c||0xc8;return function(_0x49f0f6){if(_0x49f0f6){return _0x2267f6[_0x7413('0x1a')](_0x336c4c)[_0x7413('0x1b')](_0x49f0f6);}};}function respondWithFilteredResult(_0x4955d3,_0x38b3d1){return function(_0x50f301){if(_0x50f301){var _0x4b9a5b=typeof _0x38b3d1[_0x7413('0x1c')]==='undefined'&&typeof _0x38b3d1[_0x7413('0x1d')]==='undefined';var _0x2036b6=_0x50f301[_0x7413('0x1e')];var _0x19157f=_0x4b9a5b?0x0:_0x38b3d1[_0x7413('0x1c')];var _0x2a3417=_0x4b9a5b?_0x50f301[_0x7413('0x1e')]:_0x38b3d1['offset']+_0x38b3d1[_0x7413('0x1d')];var _0x17c062;if(_0x2a3417>=_0x2036b6){_0x2a3417=_0x2036b6;_0x17c062=0xc8;}else{_0x17c062=0xce;}_0x4955d3[_0x7413('0x1a')](_0x17c062);return _0x4955d3[_0x7413('0x1f')]('Content-Range',_0x19157f+'-'+_0x2a3417+'/'+_0x2036b6)[_0x7413('0x1b')](_0x50f301);}return null;};}function patchUpdates(_0x12d94d){return function(_0x206afc){try{jsonpatch[_0x7413('0x20')](_0x206afc,_0x12d94d,!![]);}catch(_0x409392){return BPromise[_0x7413('0x21')](_0x409392);}return _0x206afc[_0x7413('0x22')]();};}function saveUpdates(_0x4e18cb,_0x56a06a){return function(_0x5f12a2){if(_0x5f12a2){return _0x5f12a2[_0x7413('0x23')](_0x4e18cb)['then'](function(_0x1585ba){return _0x1585ba;});}return null;};}function removeEntity(_0x372944,_0x3b0c81){return function(_0x2fc0f4){if(_0x2fc0f4){return _0x2fc0f4[_0x7413('0x24')]()[_0x7413('0x25')](function(){_0x372944[_0x7413('0x1a')](0xcc)[_0x7413('0x26')]();});}};}function handleEntityNotFound(_0x1d455b,_0x5a8329){return function(_0x5cb15f){if(!_0x5cb15f){_0x1d455b[_0x7413('0x27')](0x194);}return _0x5cb15f;};}function handleError(_0x48c2dc,_0x46c895){_0x46c895=_0x46c895||0x1f4;return function(_0x71cbb4){logger[_0x7413('0x28')](_0x71cbb4['stack']);if(_0x71cbb4[_0x7413('0x29')]){delete _0x71cbb4[_0x7413('0x29')];}_0x48c2dc[_0x7413('0x1a')](_0x46c895)[_0x7413('0x2a')](_0x71cbb4);};}exports[_0x7413('0x2b')]=function(_0x2e521f,_0x5eb4d9){var _0x24dce7={},_0x4ed662={},_0x1d0bde={'count':0x0,'rows':[]};var _0x23e682=_[_0x7413('0x2c')](db[_0x7413('0x2d')][_0x7413('0x2e')],function(_0x2004ea){return{'name':_0x2004ea['fieldName'],'type':_0x2004ea[_0x7413('0x2f')][_0x7413('0x30')]};});_0x4ed662[_0x7413('0x31')]=_[_0x7413('0x2c')](_0x23e682,_0x7413('0x29'));_0x4ed662[_0x7413('0x32')]=_[_0x7413('0x33')](_0x2e521f['query']);_0x4ed662[_0x7413('0x34')]=_[_0x7413('0x35')](_0x4ed662[_0x7413('0x31')],_0x4ed662[_0x7413('0x32')]);_0x24dce7[_0x7413('0x36')]=_['intersection'](_0x4ed662[_0x7413('0x31')],qs['fields'](_0x2e521f[_0x7413('0x32')][_0x7413('0x37')]));_0x24dce7[_0x7413('0x36')]=_0x24dce7['attributes'][_0x7413('0x38')]?_0x24dce7['attributes']:_0x4ed662[_0x7413('0x31')];if(!_0x2e521f[_0x7413('0x32')]['hasOwnProperty']('nolimit')){_0x24dce7[_0x7413('0x1d')]=qs[_0x7413('0x1d')](_0x2e521f[_0x7413('0x32')]['limit']);_0x24dce7['offset']=qs[_0x7413('0x1c')](_0x2e521f['query']['offset']);}_0x24dce7[_0x7413('0x39')]=qs['sort'](_0x2e521f[_0x7413('0x32')][_0x7413('0x3a')]);_0x24dce7[_0x7413('0x3b')]=qs[_0x7413('0x34')](_[_0x7413('0x3c')](_0x2e521f['query'],_0x4ed662[_0x7413('0x34')]),_0x23e682);if(_0x2e521f[_0x7413('0x32')][_0x7413('0x3d')]){_0x24dce7[_0x7413('0x3b')]=_[_0x7413('0x3e')](_0x24dce7[_0x7413('0x3b')],{'$or':_[_0x7413('0x2c')](_0x23e682,function(_0x385156){if(_0x385156[_0x7413('0x2f')]!==_0x7413('0x3f')){var _0x5c03eb={};_0x5c03eb[_0x385156[_0x7413('0x29')]]={'$like':'%'+_0x2e521f['query'][_0x7413('0x3d')]+'%'};return _0x5c03eb;}})});}_0x24dce7=_['merge']({},_0x24dce7,_0x2e521f['options']);var _0x5b592c={'where':_0x24dce7['where']};return db['MailQueueReport'][_0x7413('0x1e')](_0x5b592c)['then'](function(_0x535e49){_0x1d0bde[_0x7413('0x1e')]=_0x535e49;if(_0x2e521f['query']['includeAll']){_0x24dce7[_0x7413('0x40')]=[{'all':!![]}];}return db[_0x7413('0x2d')][_0x7413('0x41')](_0x24dce7);})[_0x7413('0x25')](function(_0x8049c0){_0x1d0bde['rows']=_0x8049c0;return _0x1d0bde;})[_0x7413('0x25')](respondWithFilteredResult(_0x5eb4d9,_0x24dce7))['catch'](handleError(_0x5eb4d9,null));};exports[_0x7413('0x42')]=function(_0x1d8219,_0xa063d1){var _0xfe0daa={'raw':!![],'where':{'id':_0x1d8219[_0x7413('0x43')]['id']}},_0x3f7da2={};_0x3f7da2[_0x7413('0x31')]=_[_0x7413('0x33')](db[_0x7413('0x2d')][_0x7413('0x2e')]);_0x3f7da2[_0x7413('0x32')]=_[_0x7413('0x33')](_0x1d8219[_0x7413('0x32')]);_0x3f7da2['filters']=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],_0x3f7da2[_0x7413('0x32')]);_0xfe0daa[_0x7413('0x36')]=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],qs[_0x7413('0x37')](_0x1d8219[_0x7413('0x32')][_0x7413('0x37')]));_0xfe0daa[_0x7413('0x36')]=_0xfe0daa[_0x7413('0x36')]['length']?_0xfe0daa[_0x7413('0x36')]:_0x3f7da2['model'];if(_0x1d8219[_0x7413('0x32')][_0x7413('0x44')]){_0xfe0daa[_0x7413('0x40')]=[{'all':!![]}];}_0xfe0daa=_[_0x7413('0x3e')]({},_0xfe0daa,_0x1d8219[_0x7413('0x45')]);return db[_0x7413('0x2d')][_0x7413('0x46')](_0xfe0daa)[_0x7413('0x25')](handleEntityNotFound(_0xa063d1,null))[_0x7413('0x25')](respondWithResult(_0xa063d1,null))[_0x7413('0x47')](handleError(_0xa063d1,null));};exports['create']=function(_0x513657,_0x3c1f1a){return db['MailQueueReport']['create'](_0x513657[_0x7413('0x48')],{})[_0x7413('0x25')](respondWithResult(_0x3c1f1a,0xc9))['catch'](handleError(_0x3c1f1a,null));};exports[_0x7413('0x23')]=function(_0x586d25,_0x562bae){if(_0x586d25[_0x7413('0x48')]['id']){delete _0x586d25['body']['id'];}return db[_0x7413('0x2d')][_0x7413('0x46')]({'where':{'id':_0x586d25[_0x7413('0x43')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x562bae,null))[_0x7413('0x25')](saveUpdates(_0x586d25[_0x7413('0x48')],null))[_0x7413('0x25')](respondWithResult(_0x562bae,null))[_0x7413('0x47')](handleError(_0x562bae,null));};exports[_0x7413('0x24')]=function(_0x2031e3,_0x50a27d){return db[_0x7413('0x2d')]['find']({'where':{'id':_0x2031e3['params']['id']}})['then'](handleEntityNotFound(_0x50a27d,null))[_0x7413('0x25')](removeEntity(_0x50a27d,null))[_0x7413('0x47')](handleError(_0x50a27d,null));};exports[_0x7413('0x49')]=function(_0x1ba4e9,_0x4bc337){return db['MailQueueReport'][_0x7413('0x49')]()['then'](respondWithResult(_0x4bc337,null))[_0x7413('0x47')](handleError(_0x4bc337,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index b692f74..0335ad9 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 _0xb4f2=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue','uniqueid'];(function(_0x283d9f,_0x424903){var _0xc93b1d=function(_0x317770){while(--_0x317770){_0x283d9f['push'](_0x283d9f['shift']());}};_0xc93b1d(++_0x424903);}(_0xb4f2,0x196));var _0x2b4f=function(_0x2bab66,_0x39499e){_0x2bab66=_0x2bab66-0x0;var _0x1f6fba=_0xb4f2[_0x2bab66];return _0x1f6fba;};'use strict';var _=require(_0x2b4f('0x0'));var util=require('util');var logger=require(_0x2b4f('0x1'))(_0x2b4f('0x2'));var moment=require(_0x2b4f('0x3'));var BPromise=require(_0x2b4f('0x4'));var rp=require(_0x2b4f('0x5'));var fs=require('fs');var path=require(_0x2b4f('0x6'));var rimraf=require(_0x2b4f('0x7'));var config=require(_0x2b4f('0x8'));var attributes=require(_0x2b4f('0x9'));module['exports']=function(_0x3dab6a,_0x239eff){return _0x3dab6a[_0x2b4f('0xa')](_0x2b4f('0xb'),attributes,{'tableName':_0x2b4f('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2b4f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc871=['bluebird','request-promise','path','../../config/environment','exports','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x514aaf,_0x2a0c60){var _0x5f5552=function(_0x4b6847){while(--_0x4b6847){_0x514aaf['push'](_0x514aaf['shift']());}};_0x5f5552(++_0x2a0c60);}(_0xc871,0x164));var _0x1c87=function(_0x5bbb91,_0x42b07e){_0x5bbb91=_0x5bbb91-0x0;var _0x36626a=_0xc871[_0x5bbb91];return _0x36626a;};'use strict';var _=require(_0x1c87('0x0'));var util=require(_0x1c87('0x1'));var logger=require(_0x1c87('0x2'))('api');var moment=require(_0x1c87('0x3'));var BPromise=require(_0x1c87('0x4'));var rp=require(_0x1c87('0x5'));var fs=require('fs');var path=require(_0x1c87('0x6'));var rimraf=require('rimraf');var config=require(_0x1c87('0x7'));var attributes=require('./mailQueueReport.attributes');module[_0x1c87('0x8')]=function(_0x18bc77,_0x1e24cb){return _0x18bc77['define'](_0x1c87('0x9'),attributes,{'tableName':_0x1c87('0xa'),'paranoid':![],'indexes':[{'name':_0x1c87('0xb'),'fields':[_0x1c87('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 9153403..08a4313 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 _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','body','options','raw','stringify','MailQueueReport','update','where','UpdateMailQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4137af,_0x47fc6b){var _0x8dd2eb=function(_0x14a271){while(--_0x14a271){_0x4137af['push'](_0x4137af['shift']());}};_0x8dd2eb(++_0x47fc6b);}(_0x1261,0x144));var _0x1126=function(_0x3b6648,_0x2d723a){_0x3b6648=_0x3b6648-0x0;var _0x5a0a0d=_0x1261[_0x3b6648];return _0x5a0a0d;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['MailQueueReport']['create'](_0x4a7b49[_0x1126('0x16')],{'raw':_0x4a7b49['options']?_0x4a7b49[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![]})[_0x1126('0xc')](function(_0x54400a){logger[_0x1126('0xd')]('CreateMailQueueReport',_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x19')](_0x54400a));_0x22ae0b(_0x54400a);})[_0x1126('0x14')](function(_0x36d254){logger['error'](_0x1126('0x15'),_0x36d254[_0x1126('0x13')],_0x4a7b49);_0x2b2487(_0x4d2b38['error'](0x1f4,_0x36d254[_0x1126('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x529dd9){var _0x4b57ab=this;return new Promise(function(_0x2199d9,_0x15bcc3){return db[_0x1126('0x1a')][_0x1126('0x1b')](_0x529dd9[_0x1126('0x16')],{'raw':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529dd9['options']?_0x529dd9[_0x1126('0x17')][_0x1126('0x1c')]||null:null,'attributes':_0x529dd9[_0x1126('0x17')]?_0x529dd9['options']['attributes']||null:null,'limit':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')]['limit']||null:null})[_0x1126('0xc')](function(_0x23d2bc){logger['info'](_0x1126('0x1d'),_0x529dd9);logger['debug'](_0x1126('0x1d'),_0x529dd9,JSON['stringify'](_0x23d2bc));_0x2199d9(_0x23d2bc);})[_0x1126('0x14')](function(_0x583ce6){logger[_0x1126('0x11')]('UpdateMailQueueReport',_0x583ce6['message'],_0x529dd9);_0x15bcc3(_0x4b57ab['error'](0x1f4,_0x583ce6[_0x1126('0x13')]));});});}; \ No newline at end of file +var _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x660237,_0x465a6f){var _0x218abd=function(_0x5b70af){while(--_0x5b70af){_0x660237['push'](_0x660237['shift']());}};_0x218abd(++_0x465a6f);}(_0xdb28,0x106));var _0x8db2=function(_0x12c7bd,_0x32eb5b){_0x12c7bd=_0x12c7bd-0x0;var _0x3b1d5e=_0xdb28[_0x12c7bd];return _0x3b1d5e;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index e9cf83a..037d9fa 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x280c4c,_0x170c4c){var _0x46306d=function(_0x335ba1){while(--_0x335ba1){_0x280c4c['push'](_0x280c4c['shift']());}};_0x46306d(++_0x170c4c);}(_0xedd9,0xfc));var _0x9edd=function(_0x96643c,_0x5e101c){_0x96643c=_0x96643c-0x0;var _0x359103=_0xedd9[_0x96643c];return _0x359103;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x561771,_0x554760){var _0x54d16e=function(_0x381c1f){while(--_0x381c1f){_0x561771['push'](_0x561771['shift']());}};_0x54d16e(++_0x554760);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 87d9082..5c55439 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 _0xbec8=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x46e36d,_0x37b78b){var _0x2c65d6=function(_0x4968fe){while(--_0x4968fe){_0x46e36d['push'](_0x46e36d['shift']());}};_0x2c65d6(++_0x37b78b);}(_0xbec8,0x125));var _0x8bec=function(_0x334201,_0x39f06f){_0x334201=_0x334201-0x0;var _0x134700=_0xbec8[_0x334201];return _0x134700;};'use strict';var Sequelize=require(_0x8bec('0x0'));module[_0x8bec('0x1')]={'description':{'type':Sequelize[_0x8bec('0x2')]},'host':{'type':Sequelize[_0x8bec('0x2')]},'authentication':{'type':Sequelize[_0x8bec('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x8bec('0x2')]},'port':{'type':Sequelize[_0x8bec('0x4')]},'tls':{'type':Sequelize[_0x8bec('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x8bec('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x8bec('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x8bec('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xce11=['BOOLEAN','INBOX','INTEGER','exports','STRING'];(function(_0x1bf788,_0x33161b){var _0x1845c8=function(_0x4f160c){while(--_0x4f160c){_0x1bf788['push'](_0x1bf788['shift']());}};_0x1845c8(++_0x33161b);}(_0xce11,0x12a));var _0x1ce1=function(_0x1a9cf9,_0x21eb55){_0x1a9cf9=_0x1a9cf9-0x0;var _0x5890a3=_0xce11[_0x1a9cf9];return _0x5890a3;};'use strict';var Sequelize=require('sequelize');module[_0x1ce1('0x0')]={'description':{'type':Sequelize[_0x1ce1('0x1')]},'host':{'type':Sequelize[_0x1ce1('0x1')]},'authentication':{'type':Sequelize[_0x1ce1('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x1ce1('0x1')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x1ce1('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x1ce1('0x1')],'defaultValue':_0x1ce1('0x3')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x1ce1('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x1ce1('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 91bc3e7..b90f7e2 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 _0x9141=['MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','define'];(function(_0x45c2b2,_0x4d2d55){var _0x5d7d9b=function(_0x382f6f){while(--_0x382f6f){_0x45c2b2['push'](_0x45c2b2['shift']());}};_0x5d7d9b(++_0x4d2d55);}(_0x9141,0x136));var _0x1914=function(_0x24a6db,_0x14f433){_0x24a6db=_0x24a6db-0x0;var _0x390f46=_0x9141[_0x24a6db];return _0x390f46;};'use strict';var _=require(_0x1914('0x0'));var util=require(_0x1914('0x1'));var logger=require(_0x1914('0x2'))(_0x1914('0x3'));var moment=require(_0x1914('0x4'));var BPromise=require(_0x1914('0x5'));var rp=require(_0x1914('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1914('0x7'));var config=require('../../config/environment');var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x4a8741,_0x9333b7){return _0x4a8741[_0x1914('0x8')](_0x1914('0x9'),attributes,{'tableName':_0x1914('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88cf=['moment','bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api'];(function(_0x4ce4e7,_0x39be7e){var _0x294324=function(_0x2129d7){while(--_0x2129d7){_0x4ce4e7['push'](_0x4ce4e7['shift']());}};_0x294324(++_0x39be7e);}(_0x88cf,0x88));var _0xf88c=function(_0x18ae3f,_0x36cf42){_0x18ae3f=_0x18ae3f-0x0;var _0x4683ca=_0x88cf[_0x18ae3f];return _0x4683ca;};'use strict';var _=require(_0xf88c('0x0'));var util=require(_0xf88c('0x1'));var logger=require(_0xf88c('0x2'))(_0xf88c('0x3'));var moment=require(_0xf88c('0x4'));var BPromise=require(_0xf88c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf88c('0x6'));var rimraf=require(_0xf88c('0x7'));var config=require(_0xf88c('0x8'));var attributes=require(_0xf88c('0x9'));module[_0xf88c('0xa')]=function(_0x391ac1,_0x18bc38){return _0x391ac1[_0xf88c('0xb')](_0xf88c('0xc'),attributes,{'tableName':_0xf88c('0xd'),'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 4a87ab2..0299242 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 _0xd0be=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetMailServerIn','MailServerIn','options','raw','attributes','limit','map','include','model'];(function(_0xfde924,_0x68c74f){var _0x23eebd=function(_0x13cd3a){while(--_0x13cd3a){_0xfde924['push'](_0xfde924['shift']());}};_0x23eebd(++_0x68c74f);}(_0xd0be,0x1a0));var _0xed0b=function(_0x16017e,_0xf8154b){_0x16017e=_0x16017e-0x0;var _0x365023=_0xd0be[_0x16017e];return _0x365023;};'use strict';var _=require(_0xed0b('0x0'));var util=require(_0xed0b('0x1'));var moment=require(_0xed0b('0x2'));var BPromise=require(_0xed0b('0x3'));var rs=require(_0xed0b('0x4'));var fs=require('fs');var Redis=require(_0xed0b('0x5'));var db=require(_0xed0b('0x6'))['db'];var utils=require(_0xed0b('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xed0b('0x8'));var client=jayson[_0xed0b('0x9')][_0xed0b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x234dcd,_0x20c99d,_0x3b8c09){return new BPromise(function(_0xa4213d,_0x1848f4){return client['request'](_0x234dcd,_0x3b8c09)[_0xed0b('0xb')](function(_0x529957){logger[_0xed0b('0xc')](_0xed0b('0xd'),_0x20c99d,_0xed0b('0xe'));logger[_0xed0b('0xf')](_0xed0b('0x10'),_0x20c99d,_0xed0b('0xe'),JSON[_0xed0b('0x11')](_0x529957));if(_0x529957['error']){if(_0x529957['error'][_0xed0b('0x12')]===0x1f4){logger[_0xed0b('0x13')]('MailServerIn,\x20%s,\x20%s',_0x20c99d,_0x529957['error'][_0xed0b('0x14')]);return _0x1848f4(_0x529957[_0xed0b('0x13')][_0xed0b('0x14')]);}logger[_0xed0b('0x13')](_0xed0b('0xd'),_0x20c99d,_0x529957['error']['message']);return _0xa4213d(_0x529957[_0xed0b('0x13')][_0xed0b('0x14')]);}else{logger['info'](_0xed0b('0xd'),_0x20c99d,_0xed0b('0xe'));_0xa4213d(_0x529957[_0xed0b('0x15')][_0xed0b('0x14')]);}})[_0xed0b('0x16')](function(_0x5aa35b){logger['error'](_0xed0b('0xd'),_0x20c99d,_0x5aa35b);_0x1848f4(_0x5aa35b);});});}exports[_0xed0b('0x17')]=function(_0x444f9b){var _0x3e22d3=this;return new Promise(function(_0x3b9307,_0x12600a){return db[_0xed0b('0x18')]['findAll']({'raw':_0x444f9b[_0xed0b('0x19')]?_0x444f9b[_0xed0b('0x19')][_0xed0b('0x1a')]===undefined?!![]:![]:!![],'where':_0x444f9b[_0xed0b('0x19')]?_0x444f9b[_0xed0b('0x19')]['where']||null:null,'attributes':_0x444f9b[_0xed0b('0x19')]?_0x444f9b[_0xed0b('0x19')][_0xed0b('0x1b')]||null:null,'limit':_0x444f9b['options']?_0x444f9b[_0xed0b('0x19')][_0xed0b('0x1c')]||null:null,'include':_0x444f9b[_0xed0b('0x19')]?_0x444f9b['options']['include']?_[_0xed0b('0x1d')](_0x444f9b[_0xed0b('0x19')][_0xed0b('0x1e')],function(_0x36bc17){return{'model':db[_0x36bc17[_0xed0b('0x1f')]],'as':_0x36bc17['as'],'attributes':_0x36bc17[_0xed0b('0x1b')],'include':_0x36bc17[_0xed0b('0x1e')]?_[_0xed0b('0x1d')](_0x36bc17[_0xed0b('0x1e')],function(_0x7f27a5){return{'model':db[_0x7f27a5[_0xed0b('0x1f')]],'as':_0x7f27a5['as'],'attributes':_0x7f27a5[_0xed0b('0x1b')],'include':_0x7f27a5[_0xed0b('0x1e')]?_['map'](_0x7f27a5['include'],function(_0xf4de62){return{'model':db[_0xf4de62[_0xed0b('0x1f')]],'as':_0xf4de62['as'],'attributes':_0xf4de62[_0xed0b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xed0b('0xb')](function(_0x54249f){logger[_0xed0b('0xc')](_0xed0b('0x17'),_0x444f9b);logger['debug'](_0xed0b('0x17'),_0x444f9b,JSON['stringify'](_0x54249f));_0x3b9307(_0x54249f);})[_0xed0b('0x16')](function(_0x4896c3){logger[_0xed0b('0x13')]('GetMailServerIn',_0x4896c3['message'],_0x444f9b);_0x12600a(_0x3e22d3[_0xed0b('0x13')](0x1f4,_0x4896c3[_0xed0b('0x14')]));});});}; \ No newline at end of file +var _0xde46=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetMailServerIn','findAll','options','raw','where','attributes','include','map','model','debug','stringify','lodash','moment'];(function(_0x253d11,_0x52c440){var _0x4ffbd0=function(_0x2d2438){while(--_0x2d2438){_0x253d11['push'](_0x253d11['shift']());}};_0x4ffbd0(++_0x52c440);}(_0xde46,0x174));var _0x6de4=function(_0x189307,_0x35e4b9){_0x189307=_0x189307-0x0;var _0x39bb9d=_0xde46[_0x189307];return _0x39bb9d;};'use strict';var _=require(_0x6de4('0x0'));var util=require('util');var moment=require(_0x6de4('0x1'));var BPromise=require('bluebird');var rs=require(_0x6de4('0x2'));var fs=require('fs');var Redis=require(_0x6de4('0x3'));var db=require(_0x6de4('0x4'))['db'];var utils=require(_0x6de4('0x5'));var logger=require(_0x6de4('0x6'))(_0x6de4('0x7'));var config=require(_0x6de4('0x8'));var jayson=require(_0x6de4('0x9'));var client=jayson[_0x6de4('0xa')][_0x6de4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29887f,_0x24d3a3,_0x14939a){return new BPromise(function(_0x2b6cba,_0x1c4041){return client[_0x6de4('0xc')](_0x29887f,_0x14939a)[_0x6de4('0xd')](function(_0x4df889){logger[_0x6de4('0xe')](_0x6de4('0xf'),_0x24d3a3,'request\x20sent');logger['debug'](_0x6de4('0x10'),_0x24d3a3,_0x6de4('0x11'),JSON['stringify'](_0x4df889));if(_0x4df889['error']){if(_0x4df889[_0x6de4('0x12')][_0x6de4('0x13')]===0x1f4){logger[_0x6de4('0x12')](_0x6de4('0xf'),_0x24d3a3,_0x4df889['error']['message']);return _0x1c4041(_0x4df889[_0x6de4('0x12')][_0x6de4('0x14')]);}logger['error'](_0x6de4('0xf'),_0x24d3a3,_0x4df889[_0x6de4('0x12')][_0x6de4('0x14')]);return _0x2b6cba(_0x4df889['error'][_0x6de4('0x14')]);}else{logger[_0x6de4('0xe')]('MailServerIn,\x20%s,\x20%s',_0x24d3a3,'request\x20sent');_0x2b6cba(_0x4df889[_0x6de4('0x15')][_0x6de4('0x14')]);}})[_0x6de4('0x16')](function(_0x423fb8){logger[_0x6de4('0x12')](_0x6de4('0xf'),_0x24d3a3,_0x423fb8);_0x1c4041(_0x423fb8);});});}exports[_0x6de4('0x17')]=function(_0x14ce70){var _0x1a2bfe=this;return new Promise(function(_0xd237fd,_0x3a2092){return db['MailServerIn'][_0x6de4('0x18')]({'raw':_0x14ce70[_0x6de4('0x19')]?_0x14ce70[_0x6de4('0x19')][_0x6de4('0x1a')]===undefined?!![]:![]:!![],'where':_0x14ce70[_0x6de4('0x19')]?_0x14ce70[_0x6de4('0x19')][_0x6de4('0x1b')]||null:null,'attributes':_0x14ce70[_0x6de4('0x19')]?_0x14ce70[_0x6de4('0x19')][_0x6de4('0x1c')]||null:null,'limit':_0x14ce70[_0x6de4('0x19')]?_0x14ce70[_0x6de4('0x19')]['limit']||null:null,'include':_0x14ce70[_0x6de4('0x19')]?_0x14ce70[_0x6de4('0x19')][_0x6de4('0x1d')]?_[_0x6de4('0x1e')](_0x14ce70[_0x6de4('0x19')][_0x6de4('0x1d')],function(_0x2b47fe){return{'model':db[_0x2b47fe[_0x6de4('0x1f')]],'as':_0x2b47fe['as'],'attributes':_0x2b47fe[_0x6de4('0x1c')],'include':_0x2b47fe['include']?_[_0x6de4('0x1e')](_0x2b47fe['include'],function(_0x43be21){return{'model':db[_0x43be21[_0x6de4('0x1f')]],'as':_0x43be21['as'],'attributes':_0x43be21[_0x6de4('0x1c')],'include':_0x43be21[_0x6de4('0x1d')]?_['map'](_0x43be21['include'],function(_0x3abc16){return{'model':db[_0x3abc16[_0x6de4('0x1f')]],'as':_0x3abc16['as'],'attributes':_0x3abc16['attributes']};}):[]};}):[]};}):[]:[]})[_0x6de4('0xd')](function(_0x3850fc){logger[_0x6de4('0xe')](_0x6de4('0x17'),_0x14ce70);logger[_0x6de4('0x20')]('GetMailServerIn',_0x14ce70,JSON[_0x6de4('0x21')](_0x3850fc));_0xd237fd(_0x3850fc);})[_0x6de4('0x16')](function(_0x2baed2){logger[_0x6de4('0x12')](_0x6de4('0x17'),_0x2baed2[_0x6de4('0x14')],_0x14ce70);_0x3a2092(_0x1a2bfe[_0x6de4('0x12')](0x1f4,_0x2baed2[_0x6de4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 330417c..d2eb965 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(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x7a54,0x106));var _0x47a5=function(_0x29ee7a,_0x52247d){_0x29ee7a=_0x29ee7a-0x0;var _0x5e660a=_0x7a54[_0x29ee7a];return _0x5e660a;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x7a54,0x106));var _0x47a5=function(_0x524679,_0x3058fd){_0x524679=_0x524679-0x0;var _0x3f6880=_0x7a54[_0x524679];return _0x3f6880;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 55adaa2..d7b01be 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 _0xa5fa=['exports','STRING','INTEGER','BOOLEAN'];(function(_0x304e5e,_0x19cda0){var _0x2ed500=function(_0x16b448){while(--_0x16b448){_0x304e5e['push'](_0x304e5e['shift']());}};_0x2ed500(++_0x19cda0);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x1ad279,_0x42d157){_0x1ad279=_0x1ad279-0x0;var _0x272861=_0xa5fa[_0x1ad279];return _0x272861;};'use strict';var Sequelize=require('sequelize');module[_0xaa5f('0x0')]={'description':{'type':Sequelize[_0xaa5f('0x1')]},'host':{'type':Sequelize[_0xaa5f('0x1')]},'user':{'type':Sequelize[_0xaa5f('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xaa5f('0x2')]},'secure':{'type':Sequelize[_0xaa5f('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xaa5f('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xaa5f('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xdb94=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x3f14b2,_0x943402){var _0x14bcaa=function(_0x1ce8d7){while(--_0x1ce8d7){_0x3f14b2['push'](_0x3f14b2['shift']());}};_0x14bcaa(++_0x943402);}(_0xdb94,0xab));var _0x4db9=function(_0x9a43d5,_0x2d785e){_0x9a43d5=_0x9a43d5-0x0;var _0xceaf49=_0xdb94[_0x9a43d5];return _0xceaf49;};'use strict';var Sequelize=require(_0x4db9('0x0'));module[_0x4db9('0x1')]={'description':{'type':Sequelize[_0x4db9('0x2')]},'host':{'type':Sequelize[_0x4db9('0x2')]},'user':{'type':Sequelize[_0x4db9('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x4db9('0x3')]},'secure':{'type':Sequelize[_0x4db9('0x4')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x4db9('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 6e243e1..149dda5 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 _0xc087=['sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','error','stack','name','send','index','MailServerOut','rawAttributes','type','key','map','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x11c8bc,_0x1f6e51){var _0x1c00ef=function(_0x8574ae){while(--_0x8574ae){_0x11c8bc['push'](_0x11c8bc['shift']());}};_0x1c00ef(++_0x1f6e51);}(_0xc087,0x166));var _0x7c08=function(_0x161f03,_0x5d141b){_0x161f03=_0x161f03-0x0;var _0x2f396f=_0xc087[_0x161f03];return _0x2f396f;};'use strict';var emlformat=require(_0x7c08('0x0'));var rimraf=require(_0x7c08('0x1'));var zipdir=require(_0x7c08('0x2'));var jsonpatch=require(_0x7c08('0x3'));var rp=require('request-promise');var moment=require(_0x7c08('0x4'));var BPromise=require(_0x7c08('0x5'));var Mustache=require(_0x7c08('0x6'));var util=require('util');var path=require('path');var sox=require(_0x7c08('0x7'));var csv=require(_0x7c08('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7c08('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7c08('0xa'));var jsforce=require(_0x7c08('0xb'));var deskjs=require(_0x7c08('0xc'));var toCsv=require(_0x7c08('0x8'));var querystring=require(_0x7c08('0xd'));var Papa=require(_0x7c08('0xe'));var Redis=require('ioredis');var authService=require(_0x7c08('0xf'));var qs=require(_0x7c08('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7c08('0x11'));var logger=require('../../config/logger')(_0x7c08('0x12'));var utils=require(_0x7c08('0x13'));var config=require(_0x7c08('0x14'));var licenseUtil=require(_0x7c08('0x15'));var db=require(_0x7c08('0x16'))['db'];function respondWithStatusCode(_0x8b24f8,_0x36be86){_0x36be86=_0x36be86||0xcc;return function(_0x210725){if(_0x210725){return _0x8b24f8[_0x7c08('0x17')](_0x36be86);}return _0x8b24f8[_0x7c08('0x18')](_0x36be86)[_0x7c08('0x19')]();};}function respondWithResult(_0x1fdc53,_0x66fcab){_0x66fcab=_0x66fcab||0xc8;return function(_0x4e5f4f){if(_0x4e5f4f){return _0x1fdc53[_0x7c08('0x18')](_0x66fcab)[_0x7c08('0x1a')](_0x4e5f4f);}};}function respondWithFilteredResult(_0x5cc5c1,_0x18e801){return function(_0x481bdf){if(_0x481bdf){var _0x516a66=typeof _0x18e801[_0x7c08('0x1b')]===_0x7c08('0x1c')&&typeof _0x18e801[_0x7c08('0x1d')]==='undefined';var _0x268831=_0x481bdf[_0x7c08('0x1e')];var _0x496a12=_0x516a66?0x0:_0x18e801[_0x7c08('0x1b')];var _0x570b21=_0x516a66?_0x481bdf[_0x7c08('0x1e')]:_0x18e801[_0x7c08('0x1b')]+_0x18e801[_0x7c08('0x1d')];var _0x210121;if(_0x570b21>=_0x268831){_0x570b21=_0x268831;_0x210121=0xc8;}else{_0x210121=0xce;}_0x5cc5c1[_0x7c08('0x18')](_0x210121);return _0x5cc5c1[_0x7c08('0x1f')](_0x7c08('0x20'),_0x496a12+'-'+_0x570b21+'/'+_0x268831)['json'](_0x481bdf);}return null;};}function patchUpdates(_0x3b2e88){return function(_0x166c52){try{jsonpatch[_0x7c08('0x21')](_0x166c52,_0x3b2e88,!![]);}catch(_0x421933){return BPromise['reject'](_0x421933);}return _0x166c52[_0x7c08('0x22')]();};}function saveUpdates(_0x5e9b5b,_0x106454){return function(_0x10fa68){if(_0x10fa68){return _0x10fa68['update'](_0x5e9b5b)[_0x7c08('0x23')](function(_0x34509a){return _0x34509a;});}return null;};}function removeEntity(_0x290e5f,_0x446aac){return function(_0x218cee){if(_0x218cee){return _0x218cee['destroy']()['then'](function(){_0x290e5f[_0x7c08('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3715c2,_0x34b6fc){return function(_0x16c536){if(!_0x16c536){_0x3715c2[_0x7c08('0x17')](0x194);}return _0x16c536;};}function handleError(_0x16110e,_0x2c42b9){_0x2c42b9=_0x2c42b9||0x1f4;return function(_0x425a16){logger[_0x7c08('0x24')](_0x425a16[_0x7c08('0x25')]);if(_0x425a16['name']){delete _0x425a16[_0x7c08('0x26')];}_0x16110e[_0x7c08('0x18')](_0x2c42b9)[_0x7c08('0x27')](_0x425a16);};}exports[_0x7c08('0x28')]=function(_0x27e65f,_0x44d770){var _0x2f976e={},_0x27fa79={},_0x2527f6={'count':0x0,'rows':[]};var _0x455490=_['map'](db[_0x7c08('0x29')][_0x7c08('0x2a')],function(_0x3da867){return{'name':_0x3da867['fieldName'],'type':_0x3da867[_0x7c08('0x2b')][_0x7c08('0x2c')]};});_0x27fa79['model']=_[_0x7c08('0x2d')](_0x455490,'name');_0x27fa79[_0x7c08('0x2e')]=_['keys'](_0x27e65f[_0x7c08('0x2e')]);_0x27fa79['filters']=_[_0x7c08('0x2f')](_0x27fa79[_0x7c08('0x30')],_0x27fa79[_0x7c08('0x2e')]);_0x2f976e['attributes']=_[_0x7c08('0x2f')](_0x27fa79[_0x7c08('0x30')],qs[_0x7c08('0x31')](_0x27e65f[_0x7c08('0x2e')][_0x7c08('0x31')]));_0x2f976e[_0x7c08('0x32')]=_0x2f976e[_0x7c08('0x32')][_0x7c08('0x33')]?_0x2f976e['attributes']:_0x27fa79[_0x7c08('0x30')];if(!_0x27e65f['query'][_0x7c08('0x34')](_0x7c08('0x35'))){_0x2f976e[_0x7c08('0x1d')]=qs[_0x7c08('0x1d')](_0x27e65f['query'][_0x7c08('0x1d')]);_0x2f976e[_0x7c08('0x1b')]=qs[_0x7c08('0x1b')](_0x27e65f[_0x7c08('0x2e')]['offset']);}_0x2f976e[_0x7c08('0x36')]=qs[_0x7c08('0x37')](_0x27e65f[_0x7c08('0x2e')]['sort']);_0x2f976e[_0x7c08('0x38')]=qs[_0x7c08('0x39')](_[_0x7c08('0x3a')](_0x27e65f['query'],_0x27fa79[_0x7c08('0x39')]),_0x455490);if(_0x27e65f[_0x7c08('0x2e')][_0x7c08('0x3b')]){_0x2f976e[_0x7c08('0x38')]=_[_0x7c08('0x3c')](_0x2f976e['where'],{'$or':_['map'](_0x455490,function(_0x19d8b3){if(_0x19d8b3[_0x7c08('0x2b')]!==_0x7c08('0x3d')){var _0x409814={};_0x409814[_0x19d8b3[_0x7c08('0x26')]]={'$like':'%'+_0x27e65f[_0x7c08('0x2e')][_0x7c08('0x3b')]+'%'};return _0x409814;}})});}_0x2f976e=_[_0x7c08('0x3c')]({},_0x2f976e,_0x27e65f[_0x7c08('0x3e')]);var _0x25b7cf={'where':_0x2f976e[_0x7c08('0x38')]};return db['MailServerOut']['count'](_0x25b7cf)[_0x7c08('0x23')](function(_0x488f6c){_0x2527f6['count']=_0x488f6c;if(_0x27e65f[_0x7c08('0x2e')][_0x7c08('0x3f')]){_0x2f976e[_0x7c08('0x40')]=[{'all':!![]}];}return db[_0x7c08('0x29')][_0x7c08('0x41')](_0x2f976e);})[_0x7c08('0x23')](function(_0x542f96){_0x2527f6['rows']=_0x542f96;return _0x2527f6;})[_0x7c08('0x23')](respondWithFilteredResult(_0x44d770,_0x2f976e))[_0x7c08('0x42')](handleError(_0x44d770,null));};exports['show']=function(_0x3cda21,_0x3b0e5b){var _0x1149f0={'raw':!![],'where':{'id':_0x3cda21[_0x7c08('0x43')]['id']}},_0x5b310e={};_0x5b310e['model']=_[_0x7c08('0x44')](db['MailServerOut']['rawAttributes']);_0x5b310e['query']=_['keys'](_0x3cda21[_0x7c08('0x2e')]);_0x5b310e[_0x7c08('0x39')]=_[_0x7c08('0x2f')](_0x5b310e[_0x7c08('0x30')],_0x5b310e[_0x7c08('0x2e')]);_0x1149f0['attributes']=_[_0x7c08('0x2f')](_0x5b310e[_0x7c08('0x30')],qs[_0x7c08('0x31')](_0x3cda21[_0x7c08('0x2e')]['fields']));_0x1149f0[_0x7c08('0x32')]=_0x1149f0[_0x7c08('0x32')][_0x7c08('0x33')]?_0x1149f0[_0x7c08('0x32')]:_0x5b310e[_0x7c08('0x30')];if(_0x3cda21[_0x7c08('0x2e')][_0x7c08('0x3f')]){_0x1149f0['include']=[{'all':!![]}];}_0x1149f0=_['merge']({},_0x1149f0,_0x3cda21['options']);return db[_0x7c08('0x29')]['find'](_0x1149f0)['then'](handleEntityNotFound(_0x3b0e5b,null))[_0x7c08('0x23')](respondWithResult(_0x3b0e5b,null))[_0x7c08('0x42')](handleError(_0x3b0e5b,null));};exports[_0x7c08('0x45')]=function(_0x318210,_0x310cf2){return db[_0x7c08('0x29')][_0x7c08('0x45')](_0x318210[_0x7c08('0x46')],{})[_0x7c08('0x23')](respondWithResult(_0x310cf2,0xc9))[_0x7c08('0x42')](handleError(_0x310cf2,null));};exports['update']=function(_0x468536,_0x1875a7){if(_0x468536[_0x7c08('0x46')]['id']){delete _0x468536[_0x7c08('0x46')]['id'];}return db[_0x7c08('0x29')][_0x7c08('0x47')]({'where':{'id':_0x468536[_0x7c08('0x43')]['id']}})[_0x7c08('0x23')](handleEntityNotFound(_0x1875a7,null))[_0x7c08('0x23')](saveUpdates(_0x468536[_0x7c08('0x46')],null))['then'](respondWithResult(_0x1875a7,null))[_0x7c08('0x42')](handleError(_0x1875a7,null));};exports[_0x7c08('0x48')]=function(_0x5387e5,_0xb54189){return db[_0x7c08('0x29')][_0x7c08('0x47')]({'where':{'id':_0x5387e5[_0x7c08('0x43')]['id']}})[_0x7c08('0x23')](handleEntityNotFound(_0xb54189,null))[_0x7c08('0x23')](removeEntity(_0xb54189,null))['catch'](handleError(_0xb54189,null));}; \ No newline at end of file +var _0x1df8=['error','stack','name','send','map','MailServerOut','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','then','include','rows','show','params','rawAttributes','length','includeAll','find','catch','create','body','update','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','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','save','destroy','end'];(function(_0x2a134a,_0x227420){var _0x21e0b4=function(_0x50feb2){while(--_0x50feb2){_0x2a134a['push'](_0x2a134a['shift']());}};_0x21e0b4(++_0x227420);}(_0x1df8,0x155));var _0x81df=function(_0x5eb11d,_0x772377){_0x5eb11d=_0x5eb11d-0x0;var _0x596912=_0x1df8[_0x5eb11d];return _0x596912;};'use strict';var emlformat=require(_0x81df('0x0'));var rimraf=require(_0x81df('0x1'));var zipdir=require(_0x81df('0x2'));var jsonpatch=require(_0x81df('0x3'));var rp=require(_0x81df('0x4'));var moment=require(_0x81df('0x5'));var BPromise=require(_0x81df('0x6'));var Mustache=require(_0x81df('0x7'));var util=require(_0x81df('0x8'));var path=require(_0x81df('0x9'));var sox=require(_0x81df('0xa'));var csv=require(_0x81df('0xb'));var ejs=require(_0x81df('0xc'));var fs=require('fs');var fs_extra=require(_0x81df('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x81df('0xe'));var jsforce=require(_0x81df('0xf'));var deskjs=require(_0x81df('0x10'));var toCsv=require(_0x81df('0xb'));var querystring=require(_0x81df('0x11'));var Papa=require('papaparse');var Redis=require(_0x81df('0x12'));var authService=require(_0x81df('0x13'));var qs=require(_0x81df('0x14'));var as=require(_0x81df('0x15'));var hardwareService=require(_0x81df('0x16'));var logger=require(_0x81df('0x17'))(_0x81df('0x18'));var utils=require(_0x81df('0x19'));var config=require(_0x81df('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54f6eb,_0x6c3960){_0x6c3960=_0x6c3960||0xcc;return function(_0x1c1530){if(_0x1c1530){return _0x54f6eb[_0x81df('0x1b')](_0x6c3960);}return _0x54f6eb[_0x81df('0x1c')](_0x6c3960)['end']();};}function respondWithResult(_0x453f47,_0x59e385){_0x59e385=_0x59e385||0xc8;return function(_0x137b87){if(_0x137b87){return _0x453f47[_0x81df('0x1c')](_0x59e385)[_0x81df('0x1d')](_0x137b87);}};}function respondWithFilteredResult(_0xf47bf4,_0x1b3c79){return function(_0x2b1fca){if(_0x2b1fca){var _0x33ee28=typeof _0x1b3c79[_0x81df('0x1e')]==='undefined'&&typeof _0x1b3c79[_0x81df('0x1f')]===_0x81df('0x20');var _0x300dff=_0x2b1fca[_0x81df('0x21')];var _0x3305e8=_0x33ee28?0x0:_0x1b3c79[_0x81df('0x1e')];var _0x25e8f3=_0x33ee28?_0x2b1fca['count']:_0x1b3c79[_0x81df('0x1e')]+_0x1b3c79[_0x81df('0x1f')];var _0x9a681c;if(_0x25e8f3>=_0x300dff){_0x25e8f3=_0x300dff;_0x9a681c=0xc8;}else{_0x9a681c=0xce;}_0xf47bf4['status'](_0x9a681c);return _0xf47bf4[_0x81df('0x22')](_0x81df('0x23'),_0x3305e8+'-'+_0x25e8f3+'/'+_0x300dff)[_0x81df('0x1d')](_0x2b1fca);}return null;};}function patchUpdates(_0x4e5bea){return function(_0x3c452d){try{jsonpatch['apply'](_0x3c452d,_0x4e5bea,!![]);}catch(_0x2c129a){return BPromise['reject'](_0x2c129a);}return _0x3c452d[_0x81df('0x24')]();};}function saveUpdates(_0x559de3,_0x5b8370){return function(_0x423995){if(_0x423995){return _0x423995['update'](_0x559de3)['then'](function(_0x4748a8){return _0x4748a8;});}return null;};}function removeEntity(_0x4983eb,_0x30c934){return function(_0x2754be){if(_0x2754be){return _0x2754be[_0x81df('0x25')]()['then'](function(){_0x4983eb[_0x81df('0x1c')](0xcc)[_0x81df('0x26')]();});}};}function handleEntityNotFound(_0x233228,_0x1fb7db){return function(_0x456bf7){if(!_0x456bf7){_0x233228['sendStatus'](0x194);}return _0x456bf7;};}function handleError(_0x5335e4,_0x40490d){_0x40490d=_0x40490d||0x1f4;return function(_0x560b1a){logger[_0x81df('0x27')](_0x560b1a[_0x81df('0x28')]);if(_0x560b1a[_0x81df('0x29')]){delete _0x560b1a[_0x81df('0x29')];}_0x5335e4[_0x81df('0x1c')](_0x40490d)[_0x81df('0x2a')](_0x560b1a);};}exports['index']=function(_0x145ec8,_0x415994){var _0x2f2659={},_0x590cc0={},_0x2ecdd4={'count':0x0,'rows':[]};var _0x248407=_[_0x81df('0x2b')](db[_0x81df('0x2c')]['rawAttributes'],function(_0x45305a){return{'name':_0x45305a[_0x81df('0x2d')],'type':_0x45305a[_0x81df('0x2e')]['key']};});_0x590cc0[_0x81df('0x2f')]=_[_0x81df('0x2b')](_0x248407,_0x81df('0x29'));_0x590cc0[_0x81df('0x30')]=_[_0x81df('0x31')](_0x145ec8['query']);_0x590cc0[_0x81df('0x32')]=_[_0x81df('0x33')](_0x590cc0['model'],_0x590cc0[_0x81df('0x30')]);_0x2f2659['attributes']=_['intersection'](_0x590cc0[_0x81df('0x2f')],qs[_0x81df('0x34')](_0x145ec8[_0x81df('0x30')]['fields']));_0x2f2659[_0x81df('0x35')]=_0x2f2659[_0x81df('0x35')]['length']?_0x2f2659[_0x81df('0x35')]:_0x590cc0['model'];if(!_0x145ec8[_0x81df('0x30')][_0x81df('0x36')](_0x81df('0x37'))){_0x2f2659['limit']=qs['limit'](_0x145ec8[_0x81df('0x30')]['limit']);_0x2f2659[_0x81df('0x1e')]=qs[_0x81df('0x1e')](_0x145ec8[_0x81df('0x30')][_0x81df('0x1e')]);}_0x2f2659[_0x81df('0x38')]=qs['sort'](_0x145ec8[_0x81df('0x30')][_0x81df('0x39')]);_0x2f2659[_0x81df('0x3a')]=qs[_0x81df('0x32')](_[_0x81df('0x3b')](_0x145ec8[_0x81df('0x30')],_0x590cc0[_0x81df('0x32')]),_0x248407);if(_0x145ec8['query'][_0x81df('0x3c')]){_0x2f2659[_0x81df('0x3a')]=_[_0x81df('0x3d')](_0x2f2659[_0x81df('0x3a')],{'$or':_['map'](_0x248407,function(_0x586463){if(_0x586463[_0x81df('0x2e')]!=='VIRTUAL'){var _0x388754={};_0x388754[_0x586463[_0x81df('0x29')]]={'$like':'%'+_0x145ec8[_0x81df('0x30')][_0x81df('0x3c')]+'%'};return _0x388754;}})});}_0x2f2659=_[_0x81df('0x3d')]({},_0x2f2659,_0x145ec8[_0x81df('0x3e')]);var _0x30dc6e={'where':_0x2f2659[_0x81df('0x3a')]};return db[_0x81df('0x2c')][_0x81df('0x21')](_0x30dc6e)[_0x81df('0x3f')](function(_0x2b2fd8){_0x2ecdd4[_0x81df('0x21')]=_0x2b2fd8;if(_0x145ec8[_0x81df('0x30')]['includeAll']){_0x2f2659[_0x81df('0x40')]=[{'all':!![]}];}return db[_0x81df('0x2c')]['findAll'](_0x2f2659);})[_0x81df('0x3f')](function(_0x5c93a0){_0x2ecdd4[_0x81df('0x41')]=_0x5c93a0;return _0x2ecdd4;})[_0x81df('0x3f')](respondWithFilteredResult(_0x415994,_0x2f2659))['catch'](handleError(_0x415994,null));};exports[_0x81df('0x42')]=function(_0x420d05,_0x18c0eb){var _0x250f5c={'raw':!![],'where':{'id':_0x420d05[_0x81df('0x43')]['id']}},_0x1b8b40={};_0x1b8b40[_0x81df('0x2f')]=_[_0x81df('0x31')](db[_0x81df('0x2c')][_0x81df('0x44')]);_0x1b8b40[_0x81df('0x30')]=_[_0x81df('0x31')](_0x420d05[_0x81df('0x30')]);_0x1b8b40['filters']=_[_0x81df('0x33')](_0x1b8b40['model'],_0x1b8b40[_0x81df('0x30')]);_0x250f5c[_0x81df('0x35')]=_[_0x81df('0x33')](_0x1b8b40['model'],qs[_0x81df('0x34')](_0x420d05[_0x81df('0x30')][_0x81df('0x34')]));_0x250f5c[_0x81df('0x35')]=_0x250f5c[_0x81df('0x35')][_0x81df('0x45')]?_0x250f5c[_0x81df('0x35')]:_0x1b8b40['model'];if(_0x420d05[_0x81df('0x30')][_0x81df('0x46')]){_0x250f5c[_0x81df('0x40')]=[{'all':!![]}];}_0x250f5c=_['merge']({},_0x250f5c,_0x420d05[_0x81df('0x3e')]);return db[_0x81df('0x2c')][_0x81df('0x47')](_0x250f5c)['then'](handleEntityNotFound(_0x18c0eb,null))['then'](respondWithResult(_0x18c0eb,null))[_0x81df('0x48')](handleError(_0x18c0eb,null));};exports[_0x81df('0x49')]=function(_0x345d00,_0x5ccdd6){return db['MailServerOut'][_0x81df('0x49')](_0x345d00[_0x81df('0x4a')],{})[_0x81df('0x3f')](respondWithResult(_0x5ccdd6,0xc9))[_0x81df('0x48')](handleError(_0x5ccdd6,null));};exports[_0x81df('0x4b')]=function(_0x4ed910,_0xd1c333){if(_0x4ed910[_0x81df('0x4a')]['id']){delete _0x4ed910[_0x81df('0x4a')]['id'];}return db[_0x81df('0x2c')]['find']({'where':{'id':_0x4ed910['params']['id']}})[_0x81df('0x3f')](handleEntityNotFound(_0xd1c333,null))[_0x81df('0x3f')](saveUpdates(_0x4ed910[_0x81df('0x4a')],null))[_0x81df('0x3f')](respondWithResult(_0xd1c333,null))[_0x81df('0x48')](handleError(_0xd1c333,null));};exports[_0x81df('0x25')]=function(_0x56cf48,_0x3bb84a){return db[_0x81df('0x2c')][_0x81df('0x47')]({'where':{'id':_0x56cf48[_0x81df('0x43')]['id']}})[_0x81df('0x3f')](handleEntityNotFound(_0x3bb84a,null))['then'](removeEntity(_0x3bb84a,null))[_0x81df('0x48')](handleError(_0x3bb84a,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 555059b..ceb2154 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 _0xcf64=['../../config/environment','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x412f09,_0x35c149){var _0x29c61f=function(_0x54c770){while(--_0x54c770){_0x412f09['push'](_0x412f09['shift']());}};_0x29c61f(++_0x35c149);}(_0xcf64,0x9f));var _0x4cf6=function(_0x5e4886,_0x15ce6e){_0x5e4886=_0x5e4886-0x0;var _0x1bb9f6=_0xcf64[_0x5e4886];return _0x1bb9f6;};'use strict';var _=require(_0x4cf6('0x0'));var util=require(_0x4cf6('0x1'));var logger=require(_0x4cf6('0x2'))(_0x4cf6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4cf6('0x4'));var fs=require('fs');var path=require(_0x4cf6('0x5'));var rimraf=require('rimraf');var config=require(_0x4cf6('0x6'));var attributes=require('./mailServerOut.attributes');module[_0x4cf6('0x7')]=function(_0x1bbd86,_0x3a072a){return _0x1bbd86[_0x4cf6('0x8')](_0x4cf6('0x9'),attributes,{'tableName':_0x4cf6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd41=['bluebird','request-promise','path','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger'];(function(_0x2a0a38,_0x4a6de5){var _0x4a200e=function(_0x2ef26b){while(--_0x2ef26b){_0x2a0a38['push'](_0x2a0a38['shift']());}};_0x4a200e(++_0x4a6de5);}(_0xdd41,0xad));var _0x1dd4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd41[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1dd4('0x0'));var util=require(_0x1dd4('0x1'));var logger=require(_0x1dd4('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1dd4('0x3'));var rp=require(_0x1dd4('0x4'));var fs=require('fs');var path=require(_0x1dd4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1dd4('0x6'));module[_0x1dd4('0x7')]=function(_0x2be213,_0x15c4da){return _0x2be213[_0x1dd4('0x8')](_0x1dd4('0x9'),attributes,{'tableName':_0x1dd4('0xa'),'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 8cb0840..f8141ee 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x3096e5,_0x5b3392){var _0x348a5a=function(_0x34ec9d){while(--_0x34ec9d){_0x3096e5['push'](_0x3096e5['shift']());}};_0x348a5a(++_0x5b3392);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1a82eb,_0x5d8426){_0x1a82eb=_0x1a82eb-0x0;var _0x5b894a=_0x5f2f[_0x1a82eb];return _0x5b894a;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _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(_0x2a43b9,_0x2aa7ea){var _0x3b6c90=function(_0x5be37f){while(--_0x5be37f){_0x2a43b9['push'](_0x2a43b9['shift']());}};_0x3b6c90(++_0x2aa7ea);}(_0xadb5,0xad));var _0x5adb=function(_0x12b4b8,_0x46b567){_0x12b4b8=_0x12b4b8-0x0;var _0x20f4e7=_0xadb5[_0x12b4b8];return _0x20f4e7;};'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 b38fb5d..9d41645 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 _0x8ec7=['get','isAuthenticated','index','/describe','/:id','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailSubstatus.controller'];(function(_0x21ef6f,_0x30208e){var _0x558d88=function(_0x2b766b){while(--_0x2b766b){_0x21ef6f['push'](_0x21ef6f['shift']());}};_0x558d88(++_0x30208e);}(_0x8ec7,0x100));var _0x78ec=function(_0x1044e5,_0x498e01){_0x1044e5=_0x1044e5-0x0;var _0x5ad0dd=_0x8ec7[_0x1044e5];return _0x5ad0dd;};'use strict';var multer=require(_0x78ec('0x0'));var util=require(_0x78ec('0x1'));var path=require(_0x78ec('0x2'));var timeout=require(_0x78ec('0x3'));var express=require(_0x78ec('0x4'));var router=express[_0x78ec('0x5')]();var fs_extra=require(_0x78ec('0x6'));var auth=require(_0x78ec('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x78ec('0x8'));var controller=require(_0x78ec('0x9'));router[_0x78ec('0xa')]('/',auth[_0x78ec('0xb')](),controller[_0x78ec('0xc')]);router[_0x78ec('0xa')](_0x78ec('0xd'),auth[_0x78ec('0xb')](),controller['describe']);router[_0x78ec('0xa')](_0x78ec('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x78ec('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x78ec('0x10')]);router[_0x78ec('0x11')](_0x78ec('0xe'),auth[_0x78ec('0xb')](),controller[_0x78ec('0x12')]);module['exports']=router; \ No newline at end of file +var _0x9674=['express','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','multer','connect-timeout'];(function(_0x3d70c4,_0x32d358){var _0x5902fa=function(_0x24d271){while(--_0x24d271){_0x3d70c4['push'](_0x3d70c4['shift']());}};_0x5902fa(++_0x32d358);}(_0x9674,0x11e));var _0x4967=function(_0x26bceb,_0x124ed3){_0x26bceb=_0x26bceb-0x0;var _0xcb6fef=_0x9674[_0x26bceb];return _0xcb6fef;};'use strict';var multer=require(_0x4967('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4967('0x1'));var express=require(_0x4967('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4967('0x3'));var config=require(_0x4967('0x4'));var controller=require(_0x4967('0x5'));router[_0x4967('0x6')]('/',auth[_0x4967('0x7')](),controller[_0x4967('0x8')]);router[_0x4967('0x6')](_0x4967('0x9'),auth['isAuthenticated'](),controller[_0x4967('0xa')]);router[_0x4967('0x6')](_0x4967('0xb'),auth[_0x4967('0x7')](),controller[_0x4967('0xc')]);router[_0x4967('0xd')]('/',auth[_0x4967('0x7')](),controller[_0x4967('0xe')]);router[_0x4967('0xf')](_0x4967('0xb'),auth[_0x4967('0x7')](),controller[_0x4967('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x4967('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 4769971..db50994 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 _0xfdbd=['sequelize','exports','STRING','name'];(function(_0x17b31d,_0x3654f0){var _0xd68ac4=function(_0x164129){while(--_0x164129){_0x17b31d['push'](_0x17b31d['shift']());}};_0xd68ac4(++_0x3654f0);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x5515a7,_0x2c4af1){_0x5515a7=_0x5515a7-0x0;var _0x43f4bf=_0xfdbd[_0x5515a7];return _0x43f4bf;};'use strict';var Sequelize=require(_0xdfdb('0x0'));module[_0xdfdb('0x1')]={'name':{'type':Sequelize[_0xdfdb('0x2')],'unique':_0xdfdb('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdfdb('0x2')]}}; \ No newline at end of file +var _0x8b8e=['sequelize','STRING'];(function(_0x2ea83c,_0x3ae951){var _0x11e0c3=function(_0x99ef4){while(--_0x99ef4){_0x2ea83c['push'](_0x2ea83c['shift']());}};_0x11e0c3(++_0x3ae951);}(_0x8b8e,0x108));var _0xe8b8=function(_0x289f03,_0x3f214d){_0x289f03=_0x289f03-0x0;var _0x3d0a3c=_0x8b8e[_0x289f03];return _0x3d0a3c;};'use strict';var Sequelize=require(_0xe8b8('0x0'));module['exports']={'name':{'type':Sequelize[_0xe8b8('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe8b8('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index e4a1091..0dcb7f9 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 _0x415a=['VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','map','MailSubstatus','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge'];(function(_0x532112,_0x37d94b){var _0x23e5fb=function(_0x690ac8){while(--_0x690ac8){_0x532112['push'](_0x532112['shift']());}};_0x23e5fb(++_0x37d94b);}(_0x415a,0x137));var _0xa415=function(_0x4a0f17,_0x1a56d2){_0x4a0f17=_0x4a0f17-0x0;var _0x2a315b=_0x415a[_0x4a0f17];return _0x2a315b;};'use strict';var emlformat=require(_0xa415('0x0'));var rimraf=require(_0xa415('0x1'));var zipdir=require(_0xa415('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa415('0x3'));var moment=require(_0xa415('0x4'));var BPromise=require(_0xa415('0x5'));var Mustache=require(_0xa415('0x6'));var util=require('util');var path=require(_0xa415('0x7'));var sox=require(_0xa415('0x8'));var csv=require(_0xa415('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa415('0xa'));var _=require(_0xa415('0xb'));var squel=require(_0xa415('0xc'));var crypto=require(_0xa415('0xd'));var jsforce=require(_0xa415('0xe'));var deskjs=require(_0xa415('0xf'));var toCsv=require(_0xa415('0x9'));var querystring=require(_0xa415('0x10'));var Papa=require(_0xa415('0x11'));var Redis=require(_0xa415('0x12'));var authService=require(_0xa415('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa415('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa415('0x15'))(_0xa415('0x16'));var utils=require(_0xa415('0x17'));var config=require(_0xa415('0x18'));var licenseUtil=require(_0xa415('0x19'));var db=require(_0xa415('0x1a'))['db'];function respondWithStatusCode(_0x4f0074,_0x253e3e){_0x253e3e=_0x253e3e||0xcc;return function(_0x179695){if(_0x179695){return _0x4f0074[_0xa415('0x1b')](_0x253e3e);}return _0x4f0074[_0xa415('0x1c')](_0x253e3e)[_0xa415('0x1d')]();};}function respondWithResult(_0x2f3d14,_0x2c81d5){_0x2c81d5=_0x2c81d5||0xc8;return function(_0x4bcaf7){if(_0x4bcaf7){return _0x2f3d14[_0xa415('0x1c')](_0x2c81d5)[_0xa415('0x1e')](_0x4bcaf7);}};}function respondWithFilteredResult(_0x257664,_0x1e02a5){return function(_0x1a4f26){if(_0x1a4f26){var _0x5ccaef=typeof _0x1e02a5[_0xa415('0x1f')]===_0xa415('0x20')&&typeof _0x1e02a5[_0xa415('0x21')]==='undefined';var _0x5108ca=_0x1a4f26['count'];var _0x5939fa=_0x5ccaef?0x0:_0x1e02a5[_0xa415('0x1f')];var _0x1d6b3d=_0x5ccaef?_0x1a4f26[_0xa415('0x22')]:_0x1e02a5[_0xa415('0x1f')]+_0x1e02a5['limit'];var _0x1e6c6c;if(_0x1d6b3d>=_0x5108ca){_0x1d6b3d=_0x5108ca;_0x1e6c6c=0xc8;}else{_0x1e6c6c=0xce;}_0x257664[_0xa415('0x1c')](_0x1e6c6c);return _0x257664['set'](_0xa415('0x23'),_0x5939fa+'-'+_0x1d6b3d+'/'+_0x5108ca)[_0xa415('0x1e')](_0x1a4f26);}return null;};}function patchUpdates(_0x50d78b){return function(_0x5b7b31){try{jsonpatch[_0xa415('0x24')](_0x5b7b31,_0x50d78b,!![]);}catch(_0x8cd3f5){return BPromise[_0xa415('0x25')](_0x8cd3f5);}return _0x5b7b31[_0xa415('0x26')]();};}function saveUpdates(_0x53fa82,_0x3c1faa){return function(_0x4f2415){if(_0x4f2415){return _0x4f2415[_0xa415('0x27')](_0x53fa82)['then'](function(_0x5edb77){return _0x5edb77;});}return null;};}function removeEntity(_0x111bc9,_0x22c324){return function(_0x1def7f){if(_0x1def7f){return _0x1def7f[_0xa415('0x28')]()[_0xa415('0x29')](function(){_0x111bc9[_0xa415('0x1c')](0xcc)[_0xa415('0x1d')]();});}};}function handleEntityNotFound(_0x40cc19,_0x3c0cbf){return function(_0x5ca0b6){if(!_0x5ca0b6){_0x40cc19[_0xa415('0x1b')](0x194);}return _0x5ca0b6;};}function handleError(_0x586658,_0x40961b){_0x40961b=_0x40961b||0x1f4;return function(_0x1d96d1){logger[_0xa415('0x2a')](_0x1d96d1['stack']);if(_0x1d96d1[_0xa415('0x2b')]){delete _0x1d96d1['name'];}_0x586658[_0xa415('0x1c')](_0x40961b)[_0xa415('0x2c')](_0x1d96d1);};}exports[_0xa415('0x2d')]=function(_0x52c9b5,_0x168719){var _0x47ccb5={},_0xc113ad={},_0x45c0cf={'count':0x0,'rows':[]};var _0x46e907=_[_0xa415('0x2e')](db[_0xa415('0x2f')]['rawAttributes'],function(_0x4506f0){return{'name':_0x4506f0[_0xa415('0x30')],'type':_0x4506f0[_0xa415('0x31')]['key']};});_0xc113ad[_0xa415('0x32')]=_[_0xa415('0x2e')](_0x46e907,_0xa415('0x2b'));_0xc113ad[_0xa415('0x33')]=_[_0xa415('0x34')](_0x52c9b5[_0xa415('0x33')]);_0xc113ad[_0xa415('0x35')]=_[_0xa415('0x36')](_0xc113ad[_0xa415('0x32')],_0xc113ad[_0xa415('0x33')]);_0x47ccb5['attributes']=_['intersection'](_0xc113ad[_0xa415('0x32')],qs[_0xa415('0x37')](_0x52c9b5[_0xa415('0x33')][_0xa415('0x37')]));_0x47ccb5[_0xa415('0x38')]=_0x47ccb5['attributes'][_0xa415('0x39')]?_0x47ccb5[_0xa415('0x38')]:_0xc113ad[_0xa415('0x32')];if(!_0x52c9b5[_0xa415('0x33')]['hasOwnProperty'](_0xa415('0x3a'))){_0x47ccb5[_0xa415('0x21')]=qs[_0xa415('0x21')](_0x52c9b5[_0xa415('0x33')][_0xa415('0x21')]);_0x47ccb5['offset']=qs[_0xa415('0x1f')](_0x52c9b5['query'][_0xa415('0x1f')]);}_0x47ccb5[_0xa415('0x3b')]=qs[_0xa415('0x3c')](_0x52c9b5['query'][_0xa415('0x3c')]);_0x47ccb5[_0xa415('0x3d')]=qs['filters'](_['pick'](_0x52c9b5[_0xa415('0x33')],_0xc113ad[_0xa415('0x35')]),_0x46e907);if(_0x52c9b5[_0xa415('0x33')][_0xa415('0x3e')]){_0x47ccb5[_0xa415('0x3d')]=_[_0xa415('0x3f')](_0x47ccb5[_0xa415('0x3d')],{'$or':_[_0xa415('0x2e')](_0x46e907,function(_0x2af229){if(_0x2af229[_0xa415('0x31')]!==_0xa415('0x40')){var _0x3eed6a={};_0x3eed6a[_0x2af229[_0xa415('0x2b')]]={'$like':'%'+_0x52c9b5[_0xa415('0x33')][_0xa415('0x3e')]+'%'};return _0x3eed6a;}})});}_0x47ccb5=_[_0xa415('0x3f')]({},_0x47ccb5,_0x52c9b5[_0xa415('0x41')]);var _0x5d2769={'where':_0x47ccb5[_0xa415('0x3d')]};return db[_0xa415('0x2f')][_0xa415('0x22')](_0x5d2769)['then'](function(_0x57535c){_0x45c0cf[_0xa415('0x22')]=_0x57535c;if(_0x52c9b5[_0xa415('0x33')][_0xa415('0x42')]){_0x47ccb5[_0xa415('0x43')]=[{'all':!![]}];}return db[_0xa415('0x2f')]['findAll'](_0x47ccb5);})[_0xa415('0x29')](function(_0x5a1b22){_0x45c0cf['rows']=_0x5a1b22;return _0x45c0cf;})[_0xa415('0x29')](respondWithFilteredResult(_0x168719,_0x47ccb5))[_0xa415('0x44')](handleError(_0x168719,null));};exports[_0xa415('0x45')]=function(_0x54c5e8,_0x59bf03){var _0x441417={'raw':!![],'where':{'id':_0x54c5e8[_0xa415('0x46')]['id']}},_0x20a3ef={};_0x20a3ef[_0xa415('0x32')]=_[_0xa415('0x34')](db[_0xa415('0x2f')]['rawAttributes']);_0x20a3ef[_0xa415('0x33')]=_[_0xa415('0x34')](_0x54c5e8[_0xa415('0x33')]);_0x20a3ef[_0xa415('0x35')]=_[_0xa415('0x36')](_0x20a3ef[_0xa415('0x32')],_0x20a3ef[_0xa415('0x33')]);_0x441417[_0xa415('0x38')]=_['intersection'](_0x20a3ef[_0xa415('0x32')],qs[_0xa415('0x37')](_0x54c5e8[_0xa415('0x33')][_0xa415('0x37')]));_0x441417[_0xa415('0x38')]=_0x441417[_0xa415('0x38')][_0xa415('0x39')]?_0x441417[_0xa415('0x38')]:_0x20a3ef[_0xa415('0x32')];if(_0x54c5e8[_0xa415('0x33')][_0xa415('0x42')]){_0x441417[_0xa415('0x43')]=[{'all':!![]}];}_0x441417=_[_0xa415('0x3f')]({},_0x441417,_0x54c5e8[_0xa415('0x41')]);return db[_0xa415('0x2f')][_0xa415('0x47')](_0x441417)[_0xa415('0x29')](handleEntityNotFound(_0x59bf03,null))[_0xa415('0x29')](respondWithResult(_0x59bf03,null))[_0xa415('0x44')](handleError(_0x59bf03,null));};exports['create']=function(_0x1eb5a4,_0x1b2ef1){return db[_0xa415('0x2f')][_0xa415('0x48')](_0x1eb5a4[_0xa415('0x49')],{})[_0xa415('0x29')](respondWithResult(_0x1b2ef1,0xc9))[_0xa415('0x44')](handleError(_0x1b2ef1,null));};exports[_0xa415('0x27')]=function(_0x340626,_0xb50471){if(_0x340626[_0xa415('0x49')]['id']){delete _0x340626['body']['id'];}return db[_0xa415('0x2f')][_0xa415('0x47')]({'where':{'id':_0x340626[_0xa415('0x46')]['id']}})[_0xa415('0x29')](handleEntityNotFound(_0xb50471,null))[_0xa415('0x29')](saveUpdates(_0x340626['body'],null))['then'](respondWithResult(_0xb50471,null))['catch'](handleError(_0xb50471,null));};exports[_0xa415('0x28')]=function(_0x145cb4,_0x2c9da2){return db[_0xa415('0x2f')][_0xa415('0x47')]({'where':{'id':_0x145cb4[_0xa415('0x46')]['id']}})[_0xa415('0x29')](handleEntityNotFound(_0x2c9da2,null))[_0xa415('0x29')](removeEntity(_0x2c9da2,null))[_0xa415('0x44')](handleError(_0x2c9da2,null));};exports[_0xa415('0x4a')]=function(_0x2420e0,_0x1ff5db){return db[_0xa415('0x2f')]['describe']()[_0xa415('0x29')](respondWithResult(_0x1ff5db,null))['catch'](handleError(_0x1ff5db,null));}; \ No newline at end of file +var _0xfd4d=['../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','map','MailSubstatus','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','rows','show','length','include','options','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfd4d,0x167));var _0xdfd4=function(_0x95a006,_0x2648e7){_0x95a006=_0x95a006-0x0;var _0x17f713=_0xfd4d[_0x95a006];return _0x17f713;};'use strict';var emlformat=require(_0xdfd4('0x0'));var rimraf=require(_0xdfd4('0x1'));var zipdir=require(_0xdfd4('0x2'));var jsonpatch=require(_0xdfd4('0x3'));var rp=require(_0xdfd4('0x4'));var moment=require(_0xdfd4('0x5'));var BPromise=require(_0xdfd4('0x6'));var Mustache=require('mustache');var util=require(_0xdfd4('0x7'));var path=require('path');var sox=require(_0xdfd4('0x8'));var csv=require(_0xdfd4('0x9'));var ejs=require(_0xdfd4('0xa'));var fs=require('fs');var fs_extra=require(_0xdfd4('0xb'));var _=require(_0xdfd4('0xc'));var squel=require(_0xdfd4('0xd'));var crypto=require(_0xdfd4('0xe'));var jsforce=require(_0xdfd4('0xf'));var deskjs=require(_0xdfd4('0x10'));var toCsv=require(_0xdfd4('0x9'));var querystring=require(_0xdfd4('0x11'));var Papa=require('papaparse');var Redis=require(_0xdfd4('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xdfd4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdfd4('0x14'));var logger=require(_0xdfd4('0x15'))(_0xdfd4('0x16'));var utils=require(_0xdfd4('0x17'));var config=require(_0xdfd4('0x18'));var licenseUtil=require(_0xdfd4('0x19'));var db=require(_0xdfd4('0x1a'))['db'];function respondWithStatusCode(_0x3b72d1,_0x39c384){_0x39c384=_0x39c384||0xcc;return function(_0x3da9e3){if(_0x3da9e3){return _0x3b72d1[_0xdfd4('0x1b')](_0x39c384);}return _0x3b72d1['status'](_0x39c384)['end']();};}function respondWithResult(_0x13c6b4,_0x36f99d){_0x36f99d=_0x36f99d||0xc8;return function(_0x303846){if(_0x303846){return _0x13c6b4[_0xdfd4('0x1c')](_0x36f99d)['json'](_0x303846);}};}function respondWithFilteredResult(_0x2fe0dd,_0x4dde09){return function(_0x2e3f14){if(_0x2e3f14){var _0x4a0312=typeof _0x4dde09[_0xdfd4('0x1d')]==='undefined'&&typeof _0x4dde09[_0xdfd4('0x1e')]===_0xdfd4('0x1f');var _0x224915=_0x2e3f14[_0xdfd4('0x20')];var _0x1fdafa=_0x4a0312?0x0:_0x4dde09[_0xdfd4('0x1d')];var _0x4285c0=_0x4a0312?_0x2e3f14[_0xdfd4('0x20')]:_0x4dde09['offset']+_0x4dde09[_0xdfd4('0x1e')];var _0x27a396;if(_0x4285c0>=_0x224915){_0x4285c0=_0x224915;_0x27a396=0xc8;}else{_0x27a396=0xce;}_0x2fe0dd[_0xdfd4('0x1c')](_0x27a396);return _0x2fe0dd[_0xdfd4('0x21')](_0xdfd4('0x22'),_0x1fdafa+'-'+_0x4285c0+'/'+_0x224915)['json'](_0x2e3f14);}return null;};}function patchUpdates(_0x306ab5){return function(_0x45b202){try{jsonpatch[_0xdfd4('0x23')](_0x45b202,_0x306ab5,!![]);}catch(_0x3b21f6){return BPromise[_0xdfd4('0x24')](_0x3b21f6);}return _0x45b202[_0xdfd4('0x25')]();};}function saveUpdates(_0x3bf2a2,_0x3ea606){return function(_0x5f037f){if(_0x5f037f){return _0x5f037f[_0xdfd4('0x26')](_0x3bf2a2)[_0xdfd4('0x27')](function(_0x35d327){return _0x35d327;});}return null;};}function removeEntity(_0x43103d,_0x1a32e3){return function(_0x4e8aa7){if(_0x4e8aa7){return _0x4e8aa7[_0xdfd4('0x28')]()[_0xdfd4('0x27')](function(){_0x43103d[_0xdfd4('0x1c')](0xcc)[_0xdfd4('0x29')]();});}};}function handleEntityNotFound(_0x345777,_0x98da16){return function(_0x5e6824){if(!_0x5e6824){_0x345777[_0xdfd4('0x1b')](0x194);}return _0x5e6824;};}function handleError(_0x1d08df,_0x2d3dc2){_0x2d3dc2=_0x2d3dc2||0x1f4;return function(_0x138880){logger['error'](_0x138880[_0xdfd4('0x2a')]);if(_0x138880[_0xdfd4('0x2b')]){delete _0x138880[_0xdfd4('0x2b')];}_0x1d08df[_0xdfd4('0x1c')](_0x2d3dc2)[_0xdfd4('0x2c')](_0x138880);};}exports['index']=function(_0x2c0bd9,_0x29e0f8){var _0x48025a={},_0xd735b7={},_0x4d5dbe={'count':0x0,'rows':[]};var _0x4151b2=_[_0xdfd4('0x2d')](db[_0xdfd4('0x2e')][_0xdfd4('0x2f')],function(_0x170b08){return{'name':_0x170b08[_0xdfd4('0x30')],'type':_0x170b08['type'][_0xdfd4('0x31')]};});_0xd735b7[_0xdfd4('0x32')]=_[_0xdfd4('0x2d')](_0x4151b2,'name');_0xd735b7[_0xdfd4('0x33')]=_[_0xdfd4('0x34')](_0x2c0bd9[_0xdfd4('0x33')]);_0xd735b7['filters']=_[_0xdfd4('0x35')](_0xd735b7['model'],_0xd735b7[_0xdfd4('0x33')]);_0x48025a[_0xdfd4('0x36')]=_[_0xdfd4('0x35')](_0xd735b7['model'],qs['fields'](_0x2c0bd9[_0xdfd4('0x33')][_0xdfd4('0x37')]));_0x48025a[_0xdfd4('0x36')]=_0x48025a['attributes']['length']?_0x48025a[_0xdfd4('0x36')]:_0xd735b7[_0xdfd4('0x32')];if(!_0x2c0bd9[_0xdfd4('0x33')]['hasOwnProperty']('nolimit')){_0x48025a[_0xdfd4('0x1e')]=qs[_0xdfd4('0x1e')](_0x2c0bd9['query'][_0xdfd4('0x1e')]);_0x48025a[_0xdfd4('0x1d')]=qs[_0xdfd4('0x1d')](_0x2c0bd9['query'][_0xdfd4('0x1d')]);}_0x48025a[_0xdfd4('0x38')]=qs['sort'](_0x2c0bd9[_0xdfd4('0x33')][_0xdfd4('0x39')]);_0x48025a[_0xdfd4('0x3a')]=qs[_0xdfd4('0x3b')](_[_0xdfd4('0x3c')](_0x2c0bd9['query'],_0xd735b7[_0xdfd4('0x3b')]),_0x4151b2);if(_0x2c0bd9[_0xdfd4('0x33')][_0xdfd4('0x3d')]){_0x48025a[_0xdfd4('0x3a')]=_[_0xdfd4('0x3e')](_0x48025a[_0xdfd4('0x3a')],{'$or':_['map'](_0x4151b2,function(_0x302b3e){if(_0x302b3e[_0xdfd4('0x3f')]!==_0xdfd4('0x40')){var _0x344947={};_0x344947[_0x302b3e[_0xdfd4('0x2b')]]={'$like':'%'+_0x2c0bd9[_0xdfd4('0x33')][_0xdfd4('0x3d')]+'%'};return _0x344947;}})});}_0x48025a=_[_0xdfd4('0x3e')]({},_0x48025a,_0x2c0bd9['options']);var _0x38ff8c={'where':_0x48025a[_0xdfd4('0x3a')]};return db['MailSubstatus'][_0xdfd4('0x20')](_0x38ff8c)['then'](function(_0x4b9a8a){_0x4d5dbe[_0xdfd4('0x20')]=_0x4b9a8a;if(_0x2c0bd9[_0xdfd4('0x33')][_0xdfd4('0x41')]){_0x48025a['include']=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x48025a);})['then'](function(_0x570289){_0x4d5dbe[_0xdfd4('0x42')]=_0x570289;return _0x4d5dbe;})['then'](respondWithFilteredResult(_0x29e0f8,_0x48025a))['catch'](handleError(_0x29e0f8,null));};exports[_0xdfd4('0x43')]=function(_0x4cee71,_0x153179){var _0x3114a6={'raw':!![],'where':{'id':_0x4cee71['params']['id']}},_0x3dac8c={};_0x3dac8c['model']=_[_0xdfd4('0x34')](db[_0xdfd4('0x2e')]['rawAttributes']);_0x3dac8c[_0xdfd4('0x33')]=_[_0xdfd4('0x34')](_0x4cee71[_0xdfd4('0x33')]);_0x3dac8c[_0xdfd4('0x3b')]=_[_0xdfd4('0x35')](_0x3dac8c[_0xdfd4('0x32')],_0x3dac8c[_0xdfd4('0x33')]);_0x3114a6['attributes']=_['intersection'](_0x3dac8c[_0xdfd4('0x32')],qs[_0xdfd4('0x37')](_0x4cee71[_0xdfd4('0x33')]['fields']));_0x3114a6[_0xdfd4('0x36')]=_0x3114a6['attributes'][_0xdfd4('0x44')]?_0x3114a6[_0xdfd4('0x36')]:_0x3dac8c[_0xdfd4('0x32')];if(_0x4cee71[_0xdfd4('0x33')][_0xdfd4('0x41')]){_0x3114a6[_0xdfd4('0x45')]=[{'all':!![]}];}_0x3114a6=_['merge']({},_0x3114a6,_0x4cee71[_0xdfd4('0x46')]);return db[_0xdfd4('0x2e')][_0xdfd4('0x47')](_0x3114a6)[_0xdfd4('0x27')](handleEntityNotFound(_0x153179,null))[_0xdfd4('0x27')](respondWithResult(_0x153179,null))[_0xdfd4('0x48')](handleError(_0x153179,null));};exports[_0xdfd4('0x49')]=function(_0xf52367,_0x4da553){return db['MailSubstatus'][_0xdfd4('0x49')](_0xf52367['body'],{})[_0xdfd4('0x27')](respondWithResult(_0x4da553,0xc9))[_0xdfd4('0x48')](handleError(_0x4da553,null));};exports[_0xdfd4('0x26')]=function(_0x5774aa,_0x57478b){if(_0x5774aa[_0xdfd4('0x4a')]['id']){delete _0x5774aa[_0xdfd4('0x4a')]['id'];}return db[_0xdfd4('0x2e')][_0xdfd4('0x47')]({'where':{'id':_0x5774aa[_0xdfd4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x57478b,null))['then'](saveUpdates(_0x5774aa[_0xdfd4('0x4a')],null))[_0xdfd4('0x27')](respondWithResult(_0x57478b,null))[_0xdfd4('0x48')](handleError(_0x57478b,null));};exports[_0xdfd4('0x28')]=function(_0x586de0,_0x1b749d){return db[_0xdfd4('0x2e')]['find']({'where':{'id':_0x586de0[_0xdfd4('0x4b')]['id']}})[_0xdfd4('0x27')](handleEntityNotFound(_0x1b749d,null))['then'](removeEntity(_0x1b749d,null))['catch'](handleError(_0x1b749d,null));};exports[_0xdfd4('0x4c')]=function(_0x2d222a,_0x13b27f){return db[_0xdfd4('0x2e')]['describe']()['then'](respondWithResult(_0x13b27f,null))[_0xdfd4('0x48')](handleError(_0x13b27f,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index c48ca8f..4af16dd 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 _0xec87=['emit','hasOwnProperty','exports','MailSubstatus','update'];(function(_0x305855,_0x28c119){var _0x8272f8=function(_0x3f7340){while(--_0x3f7340){_0x305855['push'](_0x305855['shift']());}};_0x8272f8(++_0x28c119);}(_0xec87,0x18e));var _0x7ec8=function(_0x16337a,_0x4789a1){_0x16337a=_0x16337a-0x0;var _0x422365=_0xec87[_0x16337a];return _0x422365;};'use strict';var EventEmitter=require('events');var MailSubstatus=require('../../mysqldb')['db'][_0x7ec8('0x0')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x7ec8('0x1')};function emitEvent(_0x104020){return function(_0x7b7a5b,_0x1a589d,_0x31041b){MailSubstatusEvents[_0x7ec8('0x2')](_0x104020+':'+_0x7b7a5b['id'],_0x7b7a5b);MailSubstatusEvents[_0x7ec8('0x2')](_0x104020,_0x7b7a5b);_0x31041b(null);};}for(var e in events){if(events[_0x7ec8('0x3')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x7ec8('0x4')]=MailSubstatusEvents; \ No newline at end of file +var _0xfe17=['hasOwnProperty','hook','exports','../../mysqldb','MailSubstatus','update','emit'];(function(_0x29b802,_0x2377f1){var _0x14ff64=function(_0x55f474){while(--_0x55f474){_0x29b802['push'](_0x29b802['shift']());}};_0x14ff64(++_0x2377f1);}(_0xfe17,0xce));var _0x7fe1=function(_0x5b879a,_0x1fe17a){_0x5b879a=_0x5b879a-0x0;var _0x52e759=_0xfe17[_0x5b879a];return _0x52e759;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x7fe1('0x0'))['db'][_0x7fe1('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x7fe1('0x2')};function emitEvent(_0x5a615e){return function(_0x363628,_0x7ec5eb,_0x3bf1ee){MailSubstatusEvents[_0x7fe1('0x3')](_0x5a615e+':'+_0x363628['id'],_0x363628);MailSubstatusEvents[_0x7fe1('0x3')](_0x5a615e,_0x363628);_0x3bf1ee(null);};}for(var e in events){if(events[_0x7fe1('0x4')](e)){var event=events[e];MailSubstatus[_0x7fe1('0x5')](e,emitEvent(event));}}module[_0x7fe1('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 29930aa..f68a2de 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 _0xe3f3=['mail_substatuses','Condition','update','name','mailSubstatus','_previousDataValues','then','./mailSubstatus.attributes','exports','define','MailSubstatus'];(function(_0x2d90ff,_0x11c2dc){var _0x50fe02=function(_0x9e8e84){while(--_0x9e8e84){_0x2d90ff['push'](_0x2d90ff['shift']());}};_0x50fe02(++_0x11c2dc);}(_0xe3f3,0x1eb));var _0x3e3f=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xe3f3[_0x5f309e];return _0x487b5e;};'use strict';var attributes=require(_0x3e3f('0x0'));module[_0x3e3f('0x1')]=function(_0x588a95){var _0x4a469b=_0x588a95['models'];return _0x588a95[_0x3e3f('0x2')](_0x3e3f('0x3'),attributes,{'tableName':_0x3e3f('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3aff68,_0x3fcff2,_0xcbdc6e){return _0x4a469b[_0x3e3f('0x5')][_0x3e3f('0x6')]({'value':_0x3aff68[_0x3e3f('0x7')]},{'where':{'field':_0x3e3f('0x8'),'value':_0x3aff68[_0x3e3f('0x9')][_0x3e3f('0x7')]}})[_0x3e3f('0xa')](function(){_0xcbdc6e();})['catch'](function(_0x50cc50){_0xcbdc6e(_0x50cc50);});}}});}; \ No newline at end of file +var _0xf482=['MailSubstatus','Condition','update','name','mailSubstatus','_previousDataValues','then','define'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xf482,0xff));var _0x2f48=function(_0x215fd4,_0x4eeb45){_0x215fd4=_0x215fd4-0x0;var _0x502530=_0xf482[_0x215fd4];return _0x502530;};'use strict';var attributes=require('./mailSubstatus.attributes');module['exports']=function(_0x2de510){var _0x3a495f=_0x2de510['models'];return _0x2de510[_0x2f48('0x0')](_0x2f48('0x1'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x23f870,_0xa6e8f5,_0x38755d){return _0x3a495f[_0x2f48('0x2')][_0x2f48('0x3')]({'value':_0x23f870[_0x2f48('0x4')]},{'where':{'field':_0x2f48('0x5'),'value':_0x23f870[_0x2f48('0x6')][_0x2f48('0x4')]}})[_0x2f48('0x7')](function(){_0x38755d();})['catch'](function(_0x131cf9){_0x38755d(_0x131cf9);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index a1edbec..64b6590 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 _0x1bd8=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x1fcb63,_0x283fdc){var _0x3a5834=function(_0x5e6d28){while(--_0x5e6d28){_0x1fcb63['push'](_0x1fcb63['shift']());}};_0x3a5834(++_0x283fdc);}(_0x1bd8,0xfa));var _0x81bd=function(_0x213721,_0x5c4621){_0x213721=_0x213721-0x0;var _0x2223b5=_0x1bd8[_0x213721];return _0x2223b5;};'use strict';var _=require(_0x81bd('0x0'));var util=require('util');var moment=require(_0x81bd('0x1'));var BPromise=require(_0x81bd('0x2'));var rs=require(_0x81bd('0x3'));var fs=require('fs');var Redis=require(_0x81bd('0x4'));var db=require(_0x81bd('0x5'))['db'];var utils=require(_0x81bd('0x6'));var logger=require(_0x81bd('0x7'))(_0x81bd('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x81bd('0x9')][_0x81bd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d4117,_0x530d62,_0x502b0b){return new BPromise(function(_0x1aeb83,_0x42e0eb){return client[_0x81bd('0xb')](_0x1d4117,_0x502b0b)[_0x81bd('0xc')](function(_0x157d89){logger[_0x81bd('0xd')](_0x81bd('0xe'),_0x530d62,_0x81bd('0xf'));logger[_0x81bd('0x10')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x530d62,_0x81bd('0xf'),JSON[_0x81bd('0x11')](_0x157d89));if(_0x157d89[_0x81bd('0x12')]){if(_0x157d89['error'][_0x81bd('0x13')]===0x1f4){logger[_0x81bd('0x12')](_0x81bd('0xe'),_0x530d62,_0x157d89[_0x81bd('0x12')][_0x81bd('0x14')]);return _0x42e0eb(_0x157d89[_0x81bd('0x12')]['message']);}logger[_0x81bd('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x530d62,_0x157d89[_0x81bd('0x12')][_0x81bd('0x14')]);return _0x1aeb83(_0x157d89[_0x81bd('0x12')][_0x81bd('0x14')]);}else{logger[_0x81bd('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x530d62,_0x81bd('0xf'));_0x1aeb83(_0x157d89[_0x81bd('0x15')][_0x81bd('0x14')]);}})[_0x81bd('0x16')](function(_0x53a2e9){logger[_0x81bd('0x12')](_0x81bd('0xe'),_0x530d62,_0x53a2e9);_0x42e0eb(_0x53a2e9);});});} \ No newline at end of file +var _0x5423=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment'];(function(_0x4a80f6,_0x3d43ad){var _0x5bc762=function(_0x1ad68a){while(--_0x1ad68a){_0x4a80f6['push'](_0x4a80f6['shift']());}};_0x5bc762(++_0x3d43ad);}(_0x5423,0x19c));var _0x3542=function(_0x3fc923,_0x49a23c){_0x3fc923=_0x3fc923-0x0;var _0x40fe6d=_0x5423[_0x3fc923];return _0x40fe6d;};'use strict';var _=require(_0x3542('0x0'));var util=require('util');var moment=require(_0x3542('0x1'));var BPromise=require(_0x3542('0x2'));var rs=require(_0x3542('0x3'));var fs=require('fs');var Redis=require(_0x3542('0x4'));var db=require(_0x3542('0x5'))['db'];var utils=require(_0x3542('0x6'));var logger=require(_0x3542('0x7'))(_0x3542('0x8'));var config=require(_0x3542('0x9'));var jayson=require(_0x3542('0xa'));var client=jayson['client'][_0x3542('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x288547,_0x44b3c4,_0x95a0b7){return new BPromise(function(_0x223154,_0x467593){return client[_0x3542('0xc')](_0x288547,_0x95a0b7)[_0x3542('0xd')](function(_0x172058){logger[_0x3542('0xe')](_0x3542('0xf'),_0x44b3c4,_0x3542('0x10'));logger['debug'](_0x3542('0x11'),_0x44b3c4,_0x3542('0x10'),JSON[_0x3542('0x12')](_0x172058));if(_0x172058[_0x3542('0x13')]){if(_0x172058[_0x3542('0x13')][_0x3542('0x14')]===0x1f4){logger[_0x3542('0x13')](_0x3542('0xf'),_0x44b3c4,_0x172058[_0x3542('0x13')][_0x3542('0x15')]);return _0x467593(_0x172058[_0x3542('0x13')][_0x3542('0x15')]);}logger[_0x3542('0x13')](_0x3542('0xf'),_0x44b3c4,_0x172058[_0x3542('0x13')][_0x3542('0x15')]);return _0x223154(_0x172058[_0x3542('0x13')][_0x3542('0x15')]);}else{logger[_0x3542('0xe')](_0x3542('0xf'),_0x44b3c4,'request\x20sent');_0x223154(_0x172058[_0x3542('0x16')][_0x3542('0x15')]);}})['catch'](function(_0x5a4063){logger[_0x3542('0x13')](_0x3542('0xf'),_0x44b3c4,_0x5a4063);_0x467593(_0x5a4063);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index af70364..0720fab 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 _0x2979=['/describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','index'];(function(_0x1d2c0e,_0x2322d9){var _0x4d478b=function(_0x33db0b){while(--_0x33db0b){_0x1d2c0e['push'](_0x1d2c0e['shift']());}};_0x4d478b(++_0x2322d9);}(_0x2979,0x1c1));var _0x9297=function(_0x42e495,_0x49d9da){_0x42e495=_0x42e495-0x0;var _0x595da1=_0x2979[_0x42e495];return _0x595da1;};'use strict';var multer=require(_0x9297('0x0'));var util=require(_0x9297('0x1'));var path=require(_0x9297('0x2'));var timeout=require(_0x9297('0x3'));var express=require('express');var router=express[_0x9297('0x4')]();var fs_extra=require(_0x9297('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9297('0x6'));var config=require('../../config/environment');var controller=require(_0x9297('0x7'));router[_0x9297('0x8')]('/',auth[_0x9297('0x9')](),controller[_0x9297('0xa')]);router['get'](_0x9297('0xb'),auth[_0x9297('0x9')](),controller['describe']);router[_0x9297('0x8')](_0x9297('0xc'),auth[_0x9297('0x9')](),controller[_0x9297('0xd')]);router[_0x9297('0xe')]('/',auth[_0x9297('0x9')](),controller[_0x9297('0xf')]);router[_0x9297('0x10')]('/:id',auth[_0x9297('0x9')](),controller[_0x9297('0x11')]);router['delete'](_0x9297('0xc'),auth[_0x9297('0x9')](),controller[_0x9297('0x12')]);module[_0x9297('0x13')]=router; \ No newline at end of file +var _0xbf74=['isAuthenticated','index','get','/describe','/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x20575f,_0x17527f){var _0x2ec851=function(_0x1565f2){while(--_0x1565f2){_0x20575f['push'](_0x20575f['shift']());}};_0x2ec851(++_0x17527f);}(_0xbf74,0xf0));var _0x4bf7=function(_0x3f7f20,_0x1cd927){_0x3f7f20=_0x3f7f20-0x0;var _0x35cdf6=_0xbf74[_0x3f7f20];return _0x35cdf6;};'use strict';var multer=require(_0x4bf7('0x0'));var util=require(_0x4bf7('0x1'));var path=require('path');var timeout=require(_0x4bf7('0x2'));var express=require('express');var router=express[_0x4bf7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4bf7('0x4'));var interaction=require(_0x4bf7('0x5'));var config=require(_0x4bf7('0x6'));var controller=require('./mailTransferReport.controller');router['get']('/',auth[_0x4bf7('0x7')](),controller[_0x4bf7('0x8')]);router[_0x4bf7('0x9')](_0x4bf7('0xa'),auth[_0x4bf7('0x7')](),controller['describe']);router[_0x4bf7('0x9')](_0x4bf7('0xb'),auth[_0x4bf7('0x7')](),controller[_0x4bf7('0xc')]);router[_0x4bf7('0xd')]('/',auth[_0x4bf7('0x7')](),controller[_0x4bf7('0xe')]);router[_0x4bf7('0xf')](_0x4bf7('0xb'),auth[_0x4bf7('0x7')](),controller[_0x4bf7('0x10')]);router[_0x4bf7('0x11')](_0x4bf7('0xb'),auth[_0x4bf7('0x7')](),controller['destroy']);module[_0x4bf7('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 986b110..9762292 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x2226e8,_0x282041){var _0x1054b3=function(_0x42704c){while(--_0x42704c){_0x2226e8['push'](_0x2226e8['shift']());}};_0x1054b3(++_0x282041);}(_0x00bb,0x1d8));var _0xb00b=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x00bb[_0x28947d];return _0x12d2ee;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x1a7a0d,_0x2d5bfa){var _0x14c390=function(_0x5271bf){while(--_0x5271bf){_0x1a7a0d['push'](_0x1a7a0d['shift']());}};_0x14c390(++_0x2d5bfa);}(_0x4b84,0x1cc));var _0x44b8=function(_0x569fef,_0x49c37a){_0x569fef=_0x569fef-0x0;var _0x11f20b=_0x4b84[_0x569fef];return _0x11f20b;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 86c3e28..cab4674 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 _0x2ae9=['request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','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','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','stack','name','index','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','nolimit','sort','filters','pick','where','merge','VIRTUAL','MailTransferReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch'];(function(_0x5c4e53,_0x5c15f7){var _0x581e7c=function(_0x2c1329){while(--_0x2c1329){_0x5c4e53['push'](_0x5c4e53['shift']());}};_0x581e7c(++_0x5c15f7);}(_0x2ae9,0xdb));var _0x92ae=function(_0x47b844,_0x3e805c){_0x47b844=_0x47b844-0x0;var _0x20f0e1=_0x2ae9[_0x47b844];return _0x20f0e1;};'use strict';var emlformat=require(_0x92ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x92ae('0x1'));var jsonpatch=require(_0x92ae('0x2'));var rp=require(_0x92ae('0x3'));var moment=require('moment');var BPromise=require(_0x92ae('0x4'));var Mustache=require(_0x92ae('0x5'));var util=require(_0x92ae('0x6'));var path=require(_0x92ae('0x7'));var sox=require(_0x92ae('0x8'));var csv=require(_0x92ae('0x9'));var ejs=require(_0x92ae('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x92ae('0xb'));var squel=require(_0x92ae('0xc'));var crypto=require('crypto');var jsforce=require(_0x92ae('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x92ae('0xe'));var Papa=require(_0x92ae('0xf'));var Redis=require(_0x92ae('0x10'));var authService=require(_0x92ae('0x11'));var qs=require(_0x92ae('0x12'));var as=require(_0x92ae('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x92ae('0x14'))('api');var utils=require(_0x92ae('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x92ae('0x16'));var db=require(_0x92ae('0x17'))['db'];function respondWithStatusCode(_0x461ae8,_0x519838){_0x519838=_0x519838||0xcc;return function(_0x1ec7fb){if(_0x1ec7fb){return _0x461ae8[_0x92ae('0x18')](_0x519838);}return _0x461ae8[_0x92ae('0x19')](_0x519838)[_0x92ae('0x1a')]();};}function respondWithResult(_0x24f3c5,_0x470d25){_0x470d25=_0x470d25||0xc8;return function(_0x1db664){if(_0x1db664){return _0x24f3c5[_0x92ae('0x19')](_0x470d25)[_0x92ae('0x1b')](_0x1db664);}};}function respondWithFilteredResult(_0x302021,_0x4c8132){return function(_0x28c5a5){if(_0x28c5a5){var _0x320c46=typeof _0x4c8132['offset']===_0x92ae('0x1c')&&typeof _0x4c8132[_0x92ae('0x1d')]==='undefined';var _0xd81f47=_0x28c5a5['count'];var _0x51db6d=_0x320c46?0x0:_0x4c8132['offset'];var _0x2a54f2=_0x320c46?_0x28c5a5[_0x92ae('0x1e')]:_0x4c8132[_0x92ae('0x1f')]+_0x4c8132['limit'];var _0x37cdc7;if(_0x2a54f2>=_0xd81f47){_0x2a54f2=_0xd81f47;_0x37cdc7=0xc8;}else{_0x37cdc7=0xce;}_0x302021[_0x92ae('0x19')](_0x37cdc7);return _0x302021[_0x92ae('0x20')](_0x92ae('0x21'),_0x51db6d+'-'+_0x2a54f2+'/'+_0xd81f47)['json'](_0x28c5a5);}return null;};}function patchUpdates(_0x3b83ee){return function(_0x2c3631){try{jsonpatch[_0x92ae('0x22')](_0x2c3631,_0x3b83ee,!![]);}catch(_0x5f5a52){return BPromise[_0x92ae('0x23')](_0x5f5a52);}return _0x2c3631[_0x92ae('0x24')]();};}function saveUpdates(_0x10b43d,_0x1ee0b9){return function(_0x50452c){if(_0x50452c){return _0x50452c['update'](_0x10b43d)[_0x92ae('0x25')](function(_0x39da70){return _0x39da70;});}return null;};}function removeEntity(_0x2c8062,_0x20fe42){return function(_0x1428ab){if(_0x1428ab){return _0x1428ab[_0x92ae('0x26')]()['then'](function(){_0x2c8062['status'](0xcc)[_0x92ae('0x1a')]();});}};}function handleEntityNotFound(_0x7f1cb7,_0x132b4a){return function(_0x5686e5){if(!_0x5686e5){_0x7f1cb7['sendStatus'](0x194);}return _0x5686e5;};}function handleError(_0x124360,_0x3bfa3c){_0x3bfa3c=_0x3bfa3c||0x1f4;return function(_0x2c71b2){logger['error'](_0x2c71b2[_0x92ae('0x27')]);if(_0x2c71b2[_0x92ae('0x28')]){delete _0x2c71b2['name'];}_0x124360[_0x92ae('0x19')](_0x3bfa3c)['send'](_0x2c71b2);};}exports[_0x92ae('0x29')]=function(_0x1ab96d,_0x4dddab){var _0x3ea4c2={},_0x103922={},_0xe73e30={'count':0x0,'rows':[]};var _0xca70f0=_['map'](db['MailTransferReport']['rawAttributes'],function(_0x34a0f9){return{'name':_0x34a0f9[_0x92ae('0x2a')],'type':_0x34a0f9[_0x92ae('0x2b')][_0x92ae('0x2c')]};});_0x103922['model']=_[_0x92ae('0x2d')](_0xca70f0,_0x92ae('0x28'));_0x103922[_0x92ae('0x2e')]=_[_0x92ae('0x2f')](_0x1ab96d[_0x92ae('0x2e')]);_0x103922['filters']=_[_0x92ae('0x30')](_0x103922[_0x92ae('0x31')],_0x103922[_0x92ae('0x2e')]);_0x3ea4c2[_0x92ae('0x32')]=_[_0x92ae('0x30')](_0x103922[_0x92ae('0x31')],qs[_0x92ae('0x33')](_0x1ab96d[_0x92ae('0x2e')][_0x92ae('0x33')]));_0x3ea4c2[_0x92ae('0x32')]=_0x3ea4c2[_0x92ae('0x32')][_0x92ae('0x34')]?_0x3ea4c2[_0x92ae('0x32')]:_0x103922[_0x92ae('0x31')];if(!_0x1ab96d[_0x92ae('0x2e')]['hasOwnProperty'](_0x92ae('0x35'))){_0x3ea4c2['limit']=qs[_0x92ae('0x1d')](_0x1ab96d[_0x92ae('0x2e')][_0x92ae('0x1d')]);_0x3ea4c2[_0x92ae('0x1f')]=qs[_0x92ae('0x1f')](_0x1ab96d['query'][_0x92ae('0x1f')]);}_0x3ea4c2['order']=qs[_0x92ae('0x36')](_0x1ab96d[_0x92ae('0x2e')][_0x92ae('0x36')]);_0x3ea4c2['where']=qs[_0x92ae('0x37')](_[_0x92ae('0x38')](_0x1ab96d[_0x92ae('0x2e')],_0x103922[_0x92ae('0x37')]),_0xca70f0);if(_0x1ab96d[_0x92ae('0x2e')]['filter']){_0x3ea4c2[_0x92ae('0x39')]=_[_0x92ae('0x3a')](_0x3ea4c2[_0x92ae('0x39')],{'$or':_[_0x92ae('0x2d')](_0xca70f0,function(_0x5e34f1){if(_0x5e34f1[_0x92ae('0x2b')]!==_0x92ae('0x3b')){var _0x170c51={};_0x170c51[_0x5e34f1['name']]={'$like':'%'+_0x1ab96d[_0x92ae('0x2e')]['filter']+'%'};return _0x170c51;}})});}_0x3ea4c2=_[_0x92ae('0x3a')]({},_0x3ea4c2,_0x1ab96d['options']);var _0x959d38={'where':_0x3ea4c2['where']};return db[_0x92ae('0x3c')][_0x92ae('0x1e')](_0x959d38)[_0x92ae('0x25')](function(_0x1c06d5){_0xe73e30['count']=_0x1c06d5;if(_0x1ab96d[_0x92ae('0x2e')][_0x92ae('0x3d')]){_0x3ea4c2[_0x92ae('0x3e')]=[{'all':!![]}];}return db['MailTransferReport'][_0x92ae('0x3f')](_0x3ea4c2);})[_0x92ae('0x25')](function(_0xf6f08){_0xe73e30[_0x92ae('0x40')]=_0xf6f08;return _0xe73e30;})[_0x92ae('0x25')](respondWithFilteredResult(_0x4dddab,_0x3ea4c2))[_0x92ae('0x41')](handleError(_0x4dddab,null));};exports[_0x92ae('0x42')]=function(_0x1ed93d,_0xf93b91){var _0x110e30={'raw':!![],'where':{'id':_0x1ed93d[_0x92ae('0x43')]['id']}},_0x3ab02e={};_0x3ab02e['model']=_[_0x92ae('0x2f')](db['MailTransferReport'][_0x92ae('0x44')]);_0x3ab02e[_0x92ae('0x2e')]=_[_0x92ae('0x2f')](_0x1ed93d['query']);_0x3ab02e[_0x92ae('0x37')]=_[_0x92ae('0x30')](_0x3ab02e['model'],_0x3ab02e[_0x92ae('0x2e')]);_0x110e30[_0x92ae('0x32')]=_[_0x92ae('0x30')](_0x3ab02e[_0x92ae('0x31')],qs['fields'](_0x1ed93d['query']['fields']));_0x110e30[_0x92ae('0x32')]=_0x110e30[_0x92ae('0x32')]['length']?_0x110e30[_0x92ae('0x32')]:_0x3ab02e['model'];if(_0x1ed93d[_0x92ae('0x2e')][_0x92ae('0x3d')]){_0x110e30[_0x92ae('0x3e')]=[{'all':!![]}];}_0x110e30=_[_0x92ae('0x3a')]({},_0x110e30,_0x1ed93d[_0x92ae('0x45')]);return db[_0x92ae('0x3c')][_0x92ae('0x46')](_0x110e30)['then'](handleEntityNotFound(_0xf93b91,null))[_0x92ae('0x25')](respondWithResult(_0xf93b91,null))['catch'](handleError(_0xf93b91,null));};exports[_0x92ae('0x47')]=function(_0x435520,_0x11cffd){return db[_0x92ae('0x3c')][_0x92ae('0x47')](_0x435520[_0x92ae('0x48')],{})[_0x92ae('0x25')](respondWithResult(_0x11cffd,0xc9))[_0x92ae('0x41')](handleError(_0x11cffd,null));};exports['update']=function(_0x2d5288,_0x22748f){if(_0x2d5288[_0x92ae('0x48')]['id']){delete _0x2d5288[_0x92ae('0x48')]['id'];}return db[_0x92ae('0x3c')][_0x92ae('0x46')]({'where':{'id':_0x2d5288[_0x92ae('0x43')]['id']}})[_0x92ae('0x25')](handleEntityNotFound(_0x22748f,null))[_0x92ae('0x25')](saveUpdates(_0x2d5288[_0x92ae('0x48')],null))[_0x92ae('0x25')](respondWithResult(_0x22748f,null))['catch'](handleError(_0x22748f,null));};exports[_0x92ae('0x26')]=function(_0x1399bc,_0x5e244e){return db['MailTransferReport']['find']({'where':{'id':_0x1399bc[_0x92ae('0x43')]['id']}})[_0x92ae('0x25')](handleEntityNotFound(_0x5e244e,null))[_0x92ae('0x25')](removeEntity(_0x5e244e,null))['catch'](handleError(_0x5e244e,null));};exports[_0x92ae('0x49')]=function(_0x197030,_0x1e974b){return db['MailTransferReport'][_0x92ae('0x49')]()['then'](respondWithResult(_0x1e974b,null))[_0x92ae('0x41')](handleError(_0x1e974b,null));}; \ No newline at end of file +var _0xd5d7=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','MailTransferReport','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','create','body','find','describe'];(function(_0x5c9de3,_0x488000){var _0x490296=function(_0x4f17ac){while(--_0x4f17ac){_0x5c9de3['push'](_0x5c9de3['shift']());}};_0x490296(++_0x488000);}(_0xd5d7,0x16d));var _0x7d5d=function(_0xc61b1b,_0x391f7d){_0xc61b1b=_0xc61b1b-0x0;var _0x15540f=_0xd5d7[_0xc61b1b];return _0x15540f;};'use strict';var emlformat=require(_0x7d5d('0x0'));var rimraf=require(_0x7d5d('0x1'));var zipdir=require(_0x7d5d('0x2'));var jsonpatch=require(_0x7d5d('0x3'));var rp=require(_0x7d5d('0x4'));var moment=require('moment');var BPromise=require(_0x7d5d('0x5'));var Mustache=require(_0x7d5d('0x6'));var util=require(_0x7d5d('0x7'));var path=require('path');var sox=require(_0x7d5d('0x8'));var csv=require(_0x7d5d('0x9'));var ejs=require(_0x7d5d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d5d('0xb'));var squel=require(_0x7d5d('0xc'));var crypto=require('crypto');var jsforce=require(_0x7d5d('0xd'));var deskjs=require(_0x7d5d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7d5d('0xf'));var Papa=require(_0x7d5d('0x10'));var Redis=require(_0x7d5d('0x11'));var authService=require(_0x7d5d('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d5d('0x13'));var logger=require(_0x7d5d('0x14'))(_0x7d5d('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7d5d('0x16'))['db'];function respondWithStatusCode(_0x4a18ad,_0x501955){_0x501955=_0x501955||0xcc;return function(_0x192a9a){if(_0x192a9a){return _0x4a18ad[_0x7d5d('0x17')](_0x501955);}return _0x4a18ad[_0x7d5d('0x18')](_0x501955)['end']();};}function respondWithResult(_0x1fa1a0,_0x102fca){_0x102fca=_0x102fca||0xc8;return function(_0x4cd410){if(_0x4cd410){return _0x1fa1a0['status'](_0x102fca)['json'](_0x4cd410);}};}function respondWithFilteredResult(_0x2b6ef7,_0x36c882){return function(_0x855f0d){if(_0x855f0d){var _0x5f4eab=typeof _0x36c882[_0x7d5d('0x19')]===_0x7d5d('0x1a')&&typeof _0x36c882['limit']===_0x7d5d('0x1a');var _0x4d01ae=_0x855f0d[_0x7d5d('0x1b')];var _0x5679b9=_0x5f4eab?0x0:_0x36c882[_0x7d5d('0x19')];var _0xcec981=_0x5f4eab?_0x855f0d['count']:_0x36c882[_0x7d5d('0x19')]+_0x36c882[_0x7d5d('0x1c')];var _0x150f72;if(_0xcec981>=_0x4d01ae){_0xcec981=_0x4d01ae;_0x150f72=0xc8;}else{_0x150f72=0xce;}_0x2b6ef7['status'](_0x150f72);return _0x2b6ef7[_0x7d5d('0x1d')](_0x7d5d('0x1e'),_0x5679b9+'-'+_0xcec981+'/'+_0x4d01ae)['json'](_0x855f0d);}return null;};}function patchUpdates(_0x4417c3){return function(_0x2ca010){try{jsonpatch[_0x7d5d('0x1f')](_0x2ca010,_0x4417c3,!![]);}catch(_0x2e860c){return BPromise['reject'](_0x2e860c);}return _0x2ca010[_0x7d5d('0x20')]();};}function saveUpdates(_0x164e80,_0x4d2240){return function(_0x28a7da){if(_0x28a7da){return _0x28a7da[_0x7d5d('0x21')](_0x164e80)[_0x7d5d('0x22')](function(_0x27c963){return _0x27c963;});}return null;};}function removeEntity(_0x1378bf,_0x4b3602){return function(_0x1f14d3){if(_0x1f14d3){return _0x1f14d3[_0x7d5d('0x23')]()['then'](function(){_0x1378bf['status'](0xcc)[_0x7d5d('0x24')]();});}};}function handleEntityNotFound(_0x42e19b,_0x1c8ebf){return function(_0x272dce){if(!_0x272dce){_0x42e19b[_0x7d5d('0x17')](0x194);}return _0x272dce;};}function handleError(_0x189188,_0x1484e5){_0x1484e5=_0x1484e5||0x1f4;return function(_0x1416f9){logger[_0x7d5d('0x25')](_0x1416f9[_0x7d5d('0x26')]);if(_0x1416f9[_0x7d5d('0x27')]){delete _0x1416f9[_0x7d5d('0x27')];}_0x189188[_0x7d5d('0x18')](_0x1484e5)[_0x7d5d('0x28')](_0x1416f9);};}exports[_0x7d5d('0x29')]=function(_0x4b180d,_0x28ca80){var _0x550a0f={},_0x4771a1={},_0x58e615={'count':0x0,'rows':[]};var _0x1f2eb1=_['map'](db[_0x7d5d('0x2a')]['rawAttributes'],function(_0x1d5130){return{'name':_0x1d5130['fieldName'],'type':_0x1d5130[_0x7d5d('0x2b')][_0x7d5d('0x2c')]};});_0x4771a1[_0x7d5d('0x2d')]=_[_0x7d5d('0x2e')](_0x1f2eb1,_0x7d5d('0x27'));_0x4771a1[_0x7d5d('0x2f')]=_[_0x7d5d('0x30')](_0x4b180d[_0x7d5d('0x2f')]);_0x4771a1['filters']=_[_0x7d5d('0x31')](_0x4771a1[_0x7d5d('0x2d')],_0x4771a1[_0x7d5d('0x2f')]);_0x550a0f[_0x7d5d('0x32')]=_[_0x7d5d('0x31')](_0x4771a1[_0x7d5d('0x2d')],qs[_0x7d5d('0x33')](_0x4b180d[_0x7d5d('0x2f')][_0x7d5d('0x33')]));_0x550a0f[_0x7d5d('0x32')]=_0x550a0f[_0x7d5d('0x32')][_0x7d5d('0x34')]?_0x550a0f[_0x7d5d('0x32')]:_0x4771a1[_0x7d5d('0x2d')];if(!_0x4b180d[_0x7d5d('0x2f')][_0x7d5d('0x35')](_0x7d5d('0x36'))){_0x550a0f[_0x7d5d('0x1c')]=qs[_0x7d5d('0x1c')](_0x4b180d[_0x7d5d('0x2f')]['limit']);_0x550a0f[_0x7d5d('0x19')]=qs[_0x7d5d('0x19')](_0x4b180d[_0x7d5d('0x2f')]['offset']);}_0x550a0f['order']=qs[_0x7d5d('0x37')](_0x4b180d[_0x7d5d('0x2f')][_0x7d5d('0x37')]);_0x550a0f[_0x7d5d('0x38')]=qs[_0x7d5d('0x39')](_[_0x7d5d('0x3a')](_0x4b180d[_0x7d5d('0x2f')],_0x4771a1[_0x7d5d('0x39')]),_0x1f2eb1);if(_0x4b180d[_0x7d5d('0x2f')]['filter']){_0x550a0f['where']=_[_0x7d5d('0x3b')](_0x550a0f['where'],{'$or':_[_0x7d5d('0x2e')](_0x1f2eb1,function(_0x56c01b){if(_0x56c01b[_0x7d5d('0x2b')]!==_0x7d5d('0x3c')){var _0x7ea34d={};_0x7ea34d[_0x56c01b[_0x7d5d('0x27')]]={'$like':'%'+_0x4b180d[_0x7d5d('0x2f')]['filter']+'%'};return _0x7ea34d;}})});}_0x550a0f=_[_0x7d5d('0x3b')]({},_0x550a0f,_0x4b180d[_0x7d5d('0x3d')]);var _0x3cd957={'where':_0x550a0f[_0x7d5d('0x38')]};return db[_0x7d5d('0x2a')][_0x7d5d('0x1b')](_0x3cd957)[_0x7d5d('0x22')](function(_0x386e04){_0x58e615[_0x7d5d('0x1b')]=_0x386e04;if(_0x4b180d[_0x7d5d('0x2f')][_0x7d5d('0x3e')]){_0x550a0f[_0x7d5d('0x3f')]=[{'all':!![]}];}return db[_0x7d5d('0x2a')]['findAll'](_0x550a0f);})[_0x7d5d('0x22')](function(_0x5326fe){_0x58e615[_0x7d5d('0x40')]=_0x5326fe;return _0x58e615;})[_0x7d5d('0x22')](respondWithFilteredResult(_0x28ca80,_0x550a0f))[_0x7d5d('0x41')](handleError(_0x28ca80,null));};exports[_0x7d5d('0x42')]=function(_0xe8139f,_0x559893){var _0x3fbb8b={'raw':!![],'where':{'id':_0xe8139f[_0x7d5d('0x43')]['id']}},_0x5a3c9f={};_0x5a3c9f[_0x7d5d('0x2d')]=_['keys'](db[_0x7d5d('0x2a')][_0x7d5d('0x44')]);_0x5a3c9f[_0x7d5d('0x2f')]=_[_0x7d5d('0x30')](_0xe8139f[_0x7d5d('0x2f')]);_0x5a3c9f[_0x7d5d('0x39')]=_[_0x7d5d('0x31')](_0x5a3c9f[_0x7d5d('0x2d')],_0x5a3c9f['query']);_0x3fbb8b[_0x7d5d('0x32')]=_[_0x7d5d('0x31')](_0x5a3c9f[_0x7d5d('0x2d')],qs[_0x7d5d('0x33')](_0xe8139f[_0x7d5d('0x2f')][_0x7d5d('0x33')]));_0x3fbb8b[_0x7d5d('0x32')]=_0x3fbb8b['attributes'][_0x7d5d('0x34')]?_0x3fbb8b[_0x7d5d('0x32')]:_0x5a3c9f[_0x7d5d('0x2d')];if(_0xe8139f[_0x7d5d('0x2f')][_0x7d5d('0x3e')]){_0x3fbb8b[_0x7d5d('0x3f')]=[{'all':!![]}];}_0x3fbb8b=_[_0x7d5d('0x3b')]({},_0x3fbb8b,_0xe8139f[_0x7d5d('0x3d')]);return db[_0x7d5d('0x2a')]['find'](_0x3fbb8b)[_0x7d5d('0x22')](handleEntityNotFound(_0x559893,null))[_0x7d5d('0x22')](respondWithResult(_0x559893,null))[_0x7d5d('0x41')](handleError(_0x559893,null));};exports[_0x7d5d('0x45')]=function(_0x39ee77,_0x2b1288){return db[_0x7d5d('0x2a')][_0x7d5d('0x45')](_0x39ee77[_0x7d5d('0x46')],{})[_0x7d5d('0x22')](respondWithResult(_0x2b1288,0xc9))[_0x7d5d('0x41')](handleError(_0x2b1288,null));};exports[_0x7d5d('0x21')]=function(_0x351db4,_0x22fd70){if(_0x351db4[_0x7d5d('0x46')]['id']){delete _0x351db4[_0x7d5d('0x46')]['id'];}return db['MailTransferReport'][_0x7d5d('0x47')]({'where':{'id':_0x351db4['params']['id']}})[_0x7d5d('0x22')](handleEntityNotFound(_0x22fd70,null))[_0x7d5d('0x22')](saveUpdates(_0x351db4[_0x7d5d('0x46')],null))['then'](respondWithResult(_0x22fd70,null))['catch'](handleError(_0x22fd70,null));};exports['destroy']=function(_0x229680,_0x76b54a){return db[_0x7d5d('0x2a')][_0x7d5d('0x47')]({'where':{'id':_0x229680[_0x7d5d('0x43')]['id']}})[_0x7d5d('0x22')](handleEntityNotFound(_0x76b54a,null))[_0x7d5d('0x22')](removeEntity(_0x76b54a,null))[_0x7d5d('0x41')](handleError(_0x76b54a,null));};exports['describe']=function(_0x398b1e,_0x3475f9){return db[_0x7d5d('0x2a')][_0x7d5d('0x48')]()[_0x7d5d('0x22')](respondWithResult(_0x3475f9,null))[_0x7d5d('0x41')](handleError(_0x3475f9,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index ef75604..7a0015e 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 _0x194c=['./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1a2106,_0x495d37){var _0x423fe7=function(_0x356667){while(--_0x356667){_0x1a2106['push'](_0x1a2106['shift']());}};_0x423fe7(++_0x495d37);}(_0x194c,0x19b));var _0xc194=function(_0x1a3ec7,_0x43c808){_0x1a3ec7=_0x1a3ec7-0x0;var _0xec9ef6=_0x194c[_0x1a3ec7];return _0xec9ef6;};'use strict';var _=require(_0xc194('0x0'));var util=require(_0xc194('0x1'));var logger=require(_0xc194('0x2'))(_0xc194('0x3'));var moment=require(_0xc194('0x4'));var BPromise=require(_0xc194('0x5'));var rp=require(_0xc194('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc194('0x7'));var config=require(_0xc194('0x8'));var attributes=require(_0xc194('0x9'));module[_0xc194('0xa')]=function(_0x3872ac,_0x330147){return _0x3872ac[_0xc194('0xb')](_0xc194('0xc'),attributes,{'tableName':_0xc194('0xd'),'paranoid':![],'indexes':[{'name':_0xc194('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd737=['MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','../../config/environment','define'];(function(_0x10a904,_0x2bf292){var _0x53815a=function(_0x2e6ce4){while(--_0x2e6ce4){_0x10a904['push'](_0x10a904['shift']());}};_0x53815a(++_0x2bf292);}(_0xd737,0x85));var _0x7d73=function(_0xbd3a05,_0xe6c6b7){_0xbd3a05=_0xbd3a05-0x0;var _0x101f90=_0xd737[_0xbd3a05];return _0x101f90;};'use strict';var _=require(_0x7d73('0x0'));var util=require('util');var logger=require(_0x7d73('0x1'))('api');var moment=require(_0x7d73('0x2'));var BPromise=require(_0x7d73('0x3'));var rp=require(_0x7d73('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7d73('0x5'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0xaa37cc,_0x20b8a9){return _0xaa37cc[_0x7d73('0x6')](_0x7d73('0x7'),attributes,{'tableName':_0x7d73('0x8'),'paranoid':![],'indexes':[{'name':_0x7d73('0x9'),'fields':[_0x7d73('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 0c3526c..fc743d9 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 _0x8888=['debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent'];(function(_0x22b62c,_0x362e4f){var _0x51c975=function(_0x479954){while(--_0x479954){_0x22b62c['push'](_0x22b62c['shift']());}};_0x51c975(++_0x362e4f);}(_0x8888,0x7c));var _0x8888=function(_0x1516fb,_0xa60c04){_0x1516fb=_0x1516fb-0x0;var _0x40cecb=_0x8888[_0x1516fb];return _0x40cecb;};'use strict';var _=require(_0x8888('0x0'));var util=require(_0x8888('0x1'));var moment=require(_0x8888('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8888('0x3'));var db=require(_0x8888('0x4'))['db'];var utils=require(_0x8888('0x5'));var logger=require(_0x8888('0x6'))(_0x8888('0x7'));var config=require(_0x8888('0x8'));var jayson=require(_0x8888('0x9'));var client=jayson['client'][_0x8888('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ae141,_0x8d1e7,_0x4bb383){return new BPromise(function(_0x131e91,_0x58fcda){return client[_0x8888('0xb')](_0x3ae141,_0x4bb383)[_0x8888('0xc')](function(_0x380e76){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x8d1e7,_0x8888('0xd'));logger[_0x8888('0xe')](_0x8888('0xf'),_0x8d1e7,_0x8888('0xd'),JSON[_0x8888('0x10')](_0x380e76));if(_0x380e76[_0x8888('0x11')]){if(_0x380e76[_0x8888('0x11')][_0x8888('0x12')]===0x1f4){logger[_0x8888('0x11')](_0x8888('0x13'),_0x8d1e7,_0x380e76[_0x8888('0x11')][_0x8888('0x14')]);return _0x58fcda(_0x380e76[_0x8888('0x11')]['message']);}logger[_0x8888('0x11')](_0x8888('0x13'),_0x8d1e7,_0x380e76[_0x8888('0x11')][_0x8888('0x14')]);return _0x131e91(_0x380e76[_0x8888('0x11')][_0x8888('0x14')]);}else{logger['info'](_0x8888('0x13'),_0x8d1e7,_0x8888('0xd'));_0x131e91(_0x380e76[_0x8888('0x15')][_0x8888('0x14')]);}})[_0x8888('0x16')](function(_0x2a9688){logger[_0x8888('0x11')](_0x8888('0x13'),_0x8d1e7,_0x2a9688);_0x58fcda(_0x2a9688);});});} \ No newline at end of file +var _0xc4c5=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','MailTransferReport,\x20%s,\x20%s','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','lodash','util','moment'];(function(_0x5b8144,_0x5ab67b){var _0x5a7153=function(_0x86d8e2){while(--_0x86d8e2){_0x5b8144['push'](_0x5b8144['shift']());}};_0x5a7153(++_0x5ab67b);}(_0xc4c5,0x1f1));var _0x5c4c=function(_0xcc102,_0x14a840){_0xcc102=_0xcc102-0x0;var _0x11e946=_0xc4c5[_0xcc102];return _0x11e946;};'use strict';var _=require(_0x5c4c('0x0'));var util=require(_0x5c4c('0x1'));var moment=require(_0x5c4c('0x2'));var BPromise=require('bluebird');var rs=require(_0x5c4c('0x3'));var fs=require('fs');var Redis=require(_0x5c4c('0x4'));var db=require(_0x5c4c('0x5'))['db'];var utils=require(_0x5c4c('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x5c4c('0x7'));var jayson=require(_0x5c4c('0x8'));var client=jayson[_0x5c4c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4335af,_0x1fcae2,_0x39b449){return new BPromise(function(_0x2d26ff,_0x43d014){return client[_0x5c4c('0xa')](_0x4335af,_0x39b449)[_0x5c4c('0xb')](function(_0x895ad2){logger['info'](_0x5c4c('0xc'),_0x1fcae2,'request\x20sent');logger['debug'](_0x5c4c('0xd'),_0x1fcae2,'request\x20sent',JSON[_0x5c4c('0xe')](_0x895ad2));if(_0x895ad2[_0x5c4c('0xf')]){if(_0x895ad2[_0x5c4c('0xf')][_0x5c4c('0x10')]===0x1f4){logger[_0x5c4c('0xf')](_0x5c4c('0xc'),_0x1fcae2,_0x895ad2[_0x5c4c('0xf')][_0x5c4c('0x11')]);return _0x43d014(_0x895ad2[_0x5c4c('0xf')][_0x5c4c('0x11')]);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0x1fcae2,_0x895ad2['error'][_0x5c4c('0x11')]);return _0x2d26ff(_0x895ad2['error']['message']);}else{logger[_0x5c4c('0x12')](_0x5c4c('0xc'),_0x1fcae2,_0x5c4c('0x13'));_0x2d26ff(_0x895ad2['result'][_0x5c4c('0x11')]);}})['catch'](function(_0x4afdb8){logger[_0x5c4c('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x1fcae2,_0x4afdb8);_0x43d014(_0x4afdb8);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index cced251..7d0deee 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 _0x13ad=['../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','update','destroy','util','path','connect-timeout','../../components/auth/service'];(function(_0x469104,_0x42c4ae){var _0x3f4a27=function(_0x2ec8de){while(--_0x2ec8de){_0x469104['push'](_0x469104['shift']());}};_0x3f4a27(++_0x42c4ae);}(_0x13ad,0x9c));var _0xd13a=function(_0x467208,_0x4c4d4e){_0x467208=_0x467208-0x0;var _0x5cb8aa=_0x13ad[_0x467208];return _0x5cb8aa;};'use strict';var multer=require('multer');var util=require(_0xd13a('0x0'));var path=require(_0xd13a('0x1'));var timeout=require(_0xd13a('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd13a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xd13a('0x4'));var controller=require(_0xd13a('0x5'));router[_0xd13a('0x6')]('/',auth[_0xd13a('0x7')](),controller[_0xd13a('0x8')]);router[_0xd13a('0x6')](_0xd13a('0x9'),auth[_0xd13a('0x7')](),controller[_0xd13a('0xa')]);router[_0xd13a('0x6')](_0xd13a('0xb'),auth[_0xd13a('0x7')](),controller['show']);router[_0xd13a('0xc')]('/',auth['isAuthenticated'](),controller[_0xd13a('0xd')]);router['put'](_0xd13a('0xb'),auth['isAuthenticated'](),controller[_0xd13a('0xe')]);router['delete'](_0xd13a('0xb'),auth[_0xd13a('0x7')](),controller[_0xd13a('0xf')]);module['exports']=router; \ No newline at end of file +var _0x72eb=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','create','put','delete'];(function(_0x3014a4,_0x56b5aa){var _0x4ff3da=function(_0x17c093){while(--_0x17c093){_0x3014a4['push'](_0x3014a4['shift']());}};_0x4ff3da(++_0x56b5aa);}(_0x72eb,0x7a));var _0xb72e=function(_0x2b4f76,_0x21804d){_0x2b4f76=_0x2b4f76-0x0;var _0x31671c=_0x72eb[_0x2b4f76];return _0x31671c;};'use strict';var multer=require(_0xb72e('0x0'));var util=require(_0xb72e('0x1'));var path=require(_0xb72e('0x2'));var timeout=require(_0xb72e('0x3'));var express=require('express');var router=express[_0xb72e('0x4')]();var fs_extra=require(_0xb72e('0x5'));var auth=require(_0xb72e('0x6'));var interaction=require(_0xb72e('0x7'));var config=require(_0xb72e('0x8'));var controller=require('./memberReport.controller');router[_0xb72e('0x9')]('/',auth[_0xb72e('0xa')](),controller[_0xb72e('0xb')]);router[_0xb72e('0x9')]('/describe',auth[_0xb72e('0xa')](),controller[_0xb72e('0xc')]);router['get'](_0xb72e('0xd'),auth['isAuthenticated'](),controller[_0xb72e('0xe')]);router['post']('/',auth[_0xb72e('0xa')](),controller[_0xb72e('0xf')]);router[_0xb72e('0x10')](_0xb72e('0xd'),auth[_0xb72e('0xa')](),controller['update']);router[_0xb72e('0x11')](_0xb72e('0xd'),auth['isAuthenticated'](),controller[_0xb72e('0x12')]);module[_0xb72e('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 29a013e..bc11baa 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 _0x6486=['STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6486,0xa8));var _0x6648=function(_0x5b4e97,_0x19a68c){_0x5b4e97=_0x5b4e97-0x0;var _0x43b0f9=_0x6486[_0x5b4e97];return _0x43b0f9;};'use strict';var Sequelize=require(_0x6648('0x0'));var moment=require(_0x6648('0x1'));module['exports']={'channel':{'type':Sequelize[_0x6648('0x2')]},'membername':{'type':Sequelize[_0x6648('0x2')]},'interface':{'type':Sequelize[_0x6648('0x2')]},'type':{'type':Sequelize[_0x6648('0x2')],'defaultValue':_0x6648('0x3'),'comment':_0x6648('0x4')},'duration':{'type':Sequelize[_0x6648('0x5')]},'enterAt':{'type':Sequelize[_0x6648('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x15224b){var _0x222c35=moment(_0x15224b);var _0xc6a9d7=moment(this[_0x6648('0x7')](_0x6648('0x8')));var _0x6219fc=_0x222c35[_0x6648('0x9')](_0xc6a9d7,_0x6648('0xa'));this[_0x6648('0xb')]('exitAt',_0x15224b);this['setDataValue'](_0x6648('0xc'),_0x6219fc>=0x0?_0x6219fc:null);}},'data1':{'type':Sequelize[_0x6648('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':_0x6648('0xd')},'data3':{'type':Sequelize[_0x6648('0x2')],'comment':_0x6648('0xe')},'data4':{'type':Sequelize[_0x6648('0x2')],'comment':_0x6648('0xf')},'data5':{'type':Sequelize[_0x6648('0x2')],'comment':_0x6648('0x10')},'role':{'type':Sequelize[_0x6648('0x2')]},'internal':{'type':Sequelize[_0x6648('0x5')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9da3=['DATE','getDataValue','enterAt','diff','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER'];(function(_0x318f00,_0x56a9d9){var _0x382786=function(_0x155337){while(--_0x155337){_0x318f00['push'](_0x318f00['shift']());}};_0x382786(++_0x56a9d9);}(_0x9da3,0x171));var _0x39da=function(_0x4d4968,_0x2fbe38){_0x4d4968=_0x4d4968-0x0;var _0x19e5e6=_0x9da3[_0x4d4968];return _0x19e5e6;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x39da('0x0'));module[_0x39da('0x1')]={'channel':{'type':Sequelize[_0x39da('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x39da('0x2')]},'type':{'type':Sequelize[_0x39da('0x2')],'defaultValue':_0x39da('0x3'),'comment':_0x39da('0x4')},'duration':{'type':Sequelize[_0x39da('0x5')]},'enterAt':{'type':Sequelize[_0x39da('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x94d2cd){var _0x20dd83=moment(_0x94d2cd);var _0x46ed33=moment(this[_0x39da('0x7')](_0x39da('0x8')));var _0x487f9a=_0x20dd83[_0x39da('0x9')](_0x46ed33,'seconds');this[_0x39da('0xa')](_0x39da('0xb'),_0x94d2cd);this['setDataValue']('duration',_0x487f9a>=0x0?_0x487f9a:null);}},'data1':{'type':Sequelize[_0x39da('0x2')],'comment':_0x39da('0xc')},'data2':{'type':Sequelize[_0x39da('0x2')],'comment':_0x39da('0xd')},'data3':{'type':Sequelize[_0x39da('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x39da('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x39da('0x2')],'comment':_0x39da('0xe')},'role':{'type':Sequelize[_0x39da('0x2')]},'internal':{'type':Sequelize[_0x39da('0x5')]},'uniqueid':{'type':Sequelize[_0x39da('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 80496f6..c7fe89b 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 _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(_0x158658,_0x46f304){var _0x2c408f=function(_0x68e3c3){while(--_0x68e3c3){_0x158658['push'](_0x158658['shift']());}};_0x2c408f(++_0x46f304);}(_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 +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(_0x2cf37f,_0x2217b7){var _0x1bd369=function(_0x12d071){while(--_0x12d071){_0x2cf37f['push'](_0x2cf37f['shift']());}};_0x1bd369(++_0x2217b7);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){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 1f239c5..5148706 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 _0x9208=['report_member','membername_interface','membername','interface','lodash','util','api','request-promise','path','rimraf','../../config/environment','exports','MemberReport'];(function(_0x2448b2,_0x4d3d93){var _0xa8bf7f=function(_0x4c925a){while(--_0x4c925a){_0x2448b2['push'](_0x2448b2['shift']());}};_0xa8bf7f(++_0x4d3d93);}(_0x9208,0x108));var _0x8920=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9208[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8920('0x0'));var util=require(_0x8920('0x1'));var logger=require('../../config/logger')(_0x8920('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8920('0x3'));var fs=require('fs');var path=require(_0x8920('0x4'));var rimraf=require(_0x8920('0x5'));var config=require(_0x8920('0x6'));var attributes=require('./memberReport.attributes');module[_0x8920('0x7')]=function(_0x126772,_0x194026){return _0x126772['define'](_0x8920('0x8'),attributes,{'tableName':_0x8920('0x9'),'paranoid':![],'indexes':[{'name':_0x8920('0xa'),'fields':[_0x8920('0xb'),_0x8920('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4a38=['bluebird','path','rimraf','./memberReport.attributes','exports','define','report_member','membername_interface','membername','interface','lodash','util','api'];(function(_0x142e28,_0x15940f){var _0x249c65=function(_0x4af350){while(--_0x4af350){_0x142e28['push'](_0x142e28['shift']());}};_0x249c65(++_0x15940f);}(_0x4a38,0x1de));var _0x84a3=function(_0x386e56,_0x5ac20b){_0x386e56=_0x386e56-0x0;var _0x43f60b=_0x4a38[_0x386e56];return _0x43f60b;};'use strict';var _=require(_0x84a3('0x0'));var util=require(_0x84a3('0x1'));var logger=require('../../config/logger')(_0x84a3('0x2'));var moment=require('moment');var BPromise=require(_0x84a3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x84a3('0x4'));var rimraf=require(_0x84a3('0x5'));var config=require('../../config/environment');var attributes=require(_0x84a3('0x6'));module[_0x84a3('0x7')]=function(_0x4dd6da,_0x361606){return _0x4dd6da[_0x84a3('0x8')]('MemberReport',attributes,{'tableName':_0x84a3('0x9'),'paranoid':![],'indexes':[{'name':_0x84a3('0xa'),'fields':[_0x84a3('0xb'),_0x84a3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index b6becd3..92518e1 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 _0x9120=['CreateMemberReport','MemberReport','create','body','UpdateMemberReport','update','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMemberReport','options','raw','where','limit','include','map','attributes','model'];(function(_0x4acdd0,_0x4d1f59){var _0x392ba5=function(_0x30cab7){while(--_0x30cab7){_0x4acdd0['push'](_0x4acdd0['shift']());}};_0x392ba5(++_0x4d1f59);}(_0x9120,0x1b3));var _0x0912=function(_0x3eed90,_0x1d1db1){_0x3eed90=_0x3eed90-0x0;var _0x326be2=_0x9120[_0x3eed90];return _0x326be2;};'use strict';var _=require(_0x0912('0x0'));var util=require(_0x0912('0x1'));var moment=require(_0x0912('0x2'));var BPromise=require(_0x0912('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0912('0x4'))['db'];var utils=require(_0x0912('0x5'));var logger=require(_0x0912('0x6'))(_0x0912('0x7'));var config=require(_0x0912('0x8'));var jayson=require(_0x0912('0x9'));var client=jayson['client'][_0x0912('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x345969,_0x438bb2,_0x564522){return new BPromise(function(_0x674709,_0x4383c7){return client[_0x0912('0xb')](_0x345969,_0x564522)[_0x0912('0xc')](function(_0x1532bd){logger['info'](_0x0912('0xd'),_0x438bb2,_0x0912('0xe'));logger[_0x0912('0xf')](_0x0912('0x10'),_0x438bb2,'request\x20sent',JSON[_0x0912('0x11')](_0x1532bd));if(_0x1532bd['error']){if(_0x1532bd[_0x0912('0x12')][_0x0912('0x13')]===0x1f4){logger[_0x0912('0x12')](_0x0912('0xd'),_0x438bb2,_0x1532bd[_0x0912('0x12')][_0x0912('0x14')]);return _0x4383c7(_0x1532bd[_0x0912('0x12')][_0x0912('0x14')]);}logger[_0x0912('0x12')](_0x0912('0xd'),_0x438bb2,_0x1532bd[_0x0912('0x12')][_0x0912('0x14')]);return _0x674709(_0x1532bd[_0x0912('0x12')][_0x0912('0x14')]);}else{logger[_0x0912('0x15')]('MemberReport,\x20%s,\x20%s',_0x438bb2,'request\x20sent');_0x674709(_0x1532bd[_0x0912('0x16')]['message']);}})[_0x0912('0x17')](function(_0x5cd19f){logger[_0x0912('0x12')]('MemberReport,\x20%s,\x20%s',_0x438bb2,_0x5cd19f);_0x4383c7(_0x5cd19f);});});}exports[_0x0912('0x18')]=function(_0x5eace1){var _0x22befd=this;return new Promise(function(_0x5357db,_0x495e2e){return db['MemberReport']['findAll']({'raw':_0x5eace1[_0x0912('0x19')]?_0x5eace1['options'][_0x0912('0x1a')]===undefined?!![]:![]:!![],'where':_0x5eace1[_0x0912('0x19')]?_0x5eace1['options'][_0x0912('0x1b')]||null:null,'attributes':_0x5eace1[_0x0912('0x19')]?_0x5eace1[_0x0912('0x19')]['attributes']||null:null,'limit':_0x5eace1['options']?_0x5eace1[_0x0912('0x19')][_0x0912('0x1c')]||null:null,'include':_0x5eace1[_0x0912('0x19')]?_0x5eace1[_0x0912('0x19')][_0x0912('0x1d')]?_[_0x0912('0x1e')](_0x5eace1[_0x0912('0x19')][_0x0912('0x1d')],function(_0xca7f8b){return{'model':db[_0xca7f8b['model']],'as':_0xca7f8b['as'],'attributes':_0xca7f8b[_0x0912('0x1f')],'include':_0xca7f8b[_0x0912('0x1d')]?_[_0x0912('0x1e')](_0xca7f8b['include'],function(_0x4a938e){return{'model':db[_0x4a938e[_0x0912('0x20')]],'as':_0x4a938e['as'],'attributes':_0x4a938e['attributes'],'include':_0x4a938e['include']?_[_0x0912('0x1e')](_0x4a938e[_0x0912('0x1d')],function(_0x4d45d2){return{'model':db[_0x4d45d2[_0x0912('0x20')]],'as':_0x4d45d2['as'],'attributes':_0x4d45d2[_0x0912('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0912('0xc')](function(_0x2c8e48){logger[_0x0912('0x15')]('GetMemberReport',_0x5eace1);logger[_0x0912('0xf')](_0x0912('0x18'),_0x5eace1,JSON['stringify'](_0x2c8e48));_0x5357db(_0x2c8e48);})[_0x0912('0x17')](function(_0x3428a9){logger[_0x0912('0x12')]('GetMemberReport',_0x3428a9[_0x0912('0x14')],_0x5eace1);_0x495e2e(_0x22befd[_0x0912('0x12')](0x1f4,_0x3428a9[_0x0912('0x14')]));});});};exports[_0x0912('0x21')]=function(_0x5a30d8){var _0x448fa3=this;return new Promise(function(_0x195c08,_0x2a9282){return db[_0x0912('0x22')][_0x0912('0x23')](_0x5a30d8[_0x0912('0x24')],{'raw':_0x5a30d8['options']?_0x5a30d8['options'][_0x0912('0x1a')]===undefined?!![]:![]:!![]})[_0x0912('0xc')](function(_0x485c3d){logger['info'](_0x0912('0x21'),_0x5a30d8);logger[_0x0912('0xf')](_0x0912('0x21'),_0x5a30d8,JSON[_0x0912('0x11')](_0x485c3d));_0x195c08(_0x485c3d);})[_0x0912('0x17')](function(_0x933d56){logger[_0x0912('0x12')](_0x0912('0x21'),_0x933d56['message'],_0x5a30d8);_0x2a9282(_0x448fa3['error'](0x1f4,_0x933d56[_0x0912('0x14')]));});});};exports[_0x0912('0x25')]=function(_0x49628d){var _0x2f2448=this;return new Promise(function(_0x271a9c,_0x39a152){return db[_0x0912('0x22')][_0x0912('0x26')](_0x49628d[_0x0912('0x24')],{'raw':_0x49628d[_0x0912('0x19')]?_0x49628d[_0x0912('0x19')][_0x0912('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49628d['options']?_0x49628d[_0x0912('0x19')][_0x0912('0x1b')]||null:null,'attributes':_0x49628d[_0x0912('0x19')]?_0x49628d[_0x0912('0x19')][_0x0912('0x1f')]||null:null,'limit':_0x49628d[_0x0912('0x19')]?_0x49628d[_0x0912('0x19')]['limit']||null:null})[_0x0912('0xc')](function(_0x4aef9a){logger['info']('UpdateMemberReport',_0x49628d);logger[_0x0912('0xf')](_0x0912('0x25'),_0x49628d,JSON['stringify'](_0x4aef9a));_0x271a9c(_0x4aef9a);})[_0x0912('0x17')](function(_0x200399){logger[_0x0912('0x12')]('UpdateMemberReport',_0x200399[_0x0912('0x14')],_0x49628d);_0x39a152(_0x2f2448[_0x0912('0x12')](0x1f4,_0x200399['message']));});});}; \ No newline at end of file +var _0xaaee=['then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','MemberReport','findAll','options','raw','where','include','map','model','attributes','GetMemberReport','create','CreateMemberReport','UpdateMemberReport','update','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2b0007,_0x1b85f9){var _0x4b3fec=function(_0x11a889){while(--_0x11a889){_0x2b0007['push'](_0x2b0007['shift']());}};_0x4b3fec(++_0x1b85f9);}(_0xaaee,0x132));var _0xeaae=function(_0x598b98,_0x48599e){_0x598b98=_0x598b98-0x0;var _0x5e2036=_0xaaee[_0x598b98];return _0x5e2036;};'use strict';var _=require(_0xeaae('0x0'));var util=require(_0xeaae('0x1'));var moment=require(_0xeaae('0x2'));var BPromise=require(_0xeaae('0x3'));var rs=require(_0xeaae('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeaae('0x5'))['db'];var utils=require(_0xeaae('0x6'));var logger=require(_0xeaae('0x7'))(_0xeaae('0x8'));var config=require(_0xeaae('0x9'));var jayson=require(_0xeaae('0xa'));var client=jayson[_0xeaae('0xb')][_0xeaae('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x113fa9,_0x13023a,_0x33afb9){return new BPromise(function(_0x1ad467,_0x5072b9){return client[_0xeaae('0xd')](_0x113fa9,_0x33afb9)[_0xeaae('0xe')](function(_0x58f501){logger[_0xeaae('0xf')](_0xeaae('0x10'),_0x13023a,_0xeaae('0x11'));logger[_0xeaae('0x12')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x13023a,'request\x20sent',JSON[_0xeaae('0x13')](_0x58f501));if(_0x58f501[_0xeaae('0x14')]){if(_0x58f501['error'][_0xeaae('0x15')]===0x1f4){logger[_0xeaae('0x14')](_0xeaae('0x10'),_0x13023a,_0x58f501[_0xeaae('0x14')]['message']);return _0x5072b9(_0x58f501[_0xeaae('0x14')]['message']);}logger[_0xeaae('0x14')](_0xeaae('0x10'),_0x13023a,_0x58f501[_0xeaae('0x14')][_0xeaae('0x16')]);return _0x1ad467(_0x58f501[_0xeaae('0x14')][_0xeaae('0x16')]);}else{logger[_0xeaae('0xf')](_0xeaae('0x10'),_0x13023a,_0xeaae('0x11'));_0x1ad467(_0x58f501[_0xeaae('0x17')][_0xeaae('0x16')]);}})[_0xeaae('0x18')](function(_0x8bc041){logger['error'](_0xeaae('0x10'),_0x13023a,_0x8bc041);_0x5072b9(_0x8bc041);});});}exports['GetMemberReport']=function(_0x3ace1f){var _0x10b6bf=this;return new Promise(function(_0x2b4fd3,_0x3220c0){return db[_0xeaae('0x19')][_0xeaae('0x1a')]({'raw':_0x3ace1f[_0xeaae('0x1b')]?_0x3ace1f['options'][_0xeaae('0x1c')]===undefined?!![]:![]:!![],'where':_0x3ace1f[_0xeaae('0x1b')]?_0x3ace1f[_0xeaae('0x1b')][_0xeaae('0x1d')]||null:null,'attributes':_0x3ace1f[_0xeaae('0x1b')]?_0x3ace1f[_0xeaae('0x1b')]['attributes']||null:null,'limit':_0x3ace1f[_0xeaae('0x1b')]?_0x3ace1f[_0xeaae('0x1b')]['limit']||null:null,'include':_0x3ace1f[_0xeaae('0x1b')]?_0x3ace1f['options'][_0xeaae('0x1e')]?_[_0xeaae('0x1f')](_0x3ace1f[_0xeaae('0x1b')][_0xeaae('0x1e')],function(_0x5970df){return{'model':db[_0x5970df[_0xeaae('0x20')]],'as':_0x5970df['as'],'attributes':_0x5970df[_0xeaae('0x21')],'include':_0x5970df[_0xeaae('0x1e')]?_['map'](_0x5970df['include'],function(_0x4129ed){return{'model':db[_0x4129ed[_0xeaae('0x20')]],'as':_0x4129ed['as'],'attributes':_0x4129ed[_0xeaae('0x21')],'include':_0x4129ed[_0xeaae('0x1e')]?_[_0xeaae('0x1f')](_0x4129ed['include'],function(_0x162311){return{'model':db[_0x162311[_0xeaae('0x20')]],'as':_0x162311['as'],'attributes':_0x162311['attributes']};}):[]};}):[]};}):[]:[]})[_0xeaae('0xe')](function(_0x3bd47a){logger[_0xeaae('0xf')](_0xeaae('0x22'),_0x3ace1f);logger['debug'](_0xeaae('0x22'),_0x3ace1f,JSON[_0xeaae('0x13')](_0x3bd47a));_0x2b4fd3(_0x3bd47a);})[_0xeaae('0x18')](function(_0x4db82c){logger[_0xeaae('0x14')](_0xeaae('0x22'),_0x4db82c[_0xeaae('0x16')],_0x3ace1f);_0x3220c0(_0x10b6bf[_0xeaae('0x14')](0x1f4,_0x4db82c[_0xeaae('0x16')]));});});};exports['CreateMemberReport']=function(_0x1a9967){var _0x3b73fa=this;return new Promise(function(_0x516289,_0x2f23c2){return db['MemberReport'][_0xeaae('0x23')](_0x1a9967['body'],{'raw':_0x1a9967[_0xeaae('0x1b')]?_0x1a9967[_0xeaae('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xeaae('0xe')](function(_0x2bd911){logger[_0xeaae('0xf')](_0xeaae('0x24'),_0x1a9967);logger['debug'](_0xeaae('0x24'),_0x1a9967,JSON[_0xeaae('0x13')](_0x2bd911));_0x516289(_0x2bd911);})['catch'](function(_0x58846b){logger[_0xeaae('0x14')](_0xeaae('0x24'),_0x58846b[_0xeaae('0x16')],_0x1a9967);_0x2f23c2(_0x3b73fa['error'](0x1f4,_0x58846b[_0xeaae('0x16')]));});});};exports[_0xeaae('0x25')]=function(_0x221bd4){var _0x2827a6=this;return new Promise(function(_0x436a94,_0x26f417){return db['MemberReport'][_0xeaae('0x26')](_0x221bd4['body'],{'raw':_0x221bd4[_0xeaae('0x1b')]?_0x221bd4[_0xeaae('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x221bd4[_0xeaae('0x1b')]?_0x221bd4[_0xeaae('0x1b')][_0xeaae('0x1d')]||null:null,'attributes':_0x221bd4['options']?_0x221bd4[_0xeaae('0x1b')][_0xeaae('0x21')]||null:null,'limit':_0x221bd4[_0xeaae('0x1b')]?_0x221bd4[_0xeaae('0x1b')][_0xeaae('0x27')]||null:null})[_0xeaae('0xe')](function(_0x460da9){logger['info'](_0xeaae('0x25'),_0x221bd4);logger[_0xeaae('0x12')](_0xeaae('0x25'),_0x221bd4,JSON[_0xeaae('0x13')](_0x460da9));_0x436a94(_0x460da9);})[_0xeaae('0x18')](function(_0x390055){logger['error']('UpdateMemberReport',_0x390055[_0xeaae('0x16')],_0x221bd4);_0x26f417(_0x2827a6[_0xeaae('0x14')](0x1f4,_0x390055[_0xeaae('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index a3d27f5..9b70140 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 _0x8786=['../../components/interaction/service','../../config/environment','./migration.controller','get','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x218697,_0xea54bf){var _0x29cac1=function(_0x51e3c8){while(--_0x51e3c8){_0x218697['push'](_0x218697['shift']());}};_0x29cac1(++_0xea54bf);}(_0x8786,0x7a));var _0x6878=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x8786[_0x1d1779];return _0x2377e9;};'use strict';var multer=require(_0x6878('0x0'));var util=require(_0x6878('0x1'));var path=require(_0x6878('0x2'));var timeout=require(_0x6878('0x3'));var express=require(_0x6878('0x4'));var router=express[_0x6878('0x5')]();var fs_extra=require(_0x6878('0x6'));var auth=require(_0x6878('0x7'));var interaction=require(_0x6878('0x8'));var config=require(_0x6878('0x9'));var controller=require(_0x6878('0xa'));router[_0x6878('0xb')]('/',controller['index']);module[_0x6878('0xc')]=router; \ No newline at end of file +var _0xd3fd=['../../components/auth/service','../../config/environment','./migration.controller','get','exports','multer','util','path','express'];(function(_0x57d5bf,_0x2f5241){var _0x9d615d=function(_0x1da529){while(--_0x1da529){_0x57d5bf['push'](_0x57d5bf['shift']());}};_0x9d615d(++_0x2f5241);}(_0xd3fd,0x10a));var _0xdd3f=function(_0x268bea,_0x70e3b3){_0x268bea=_0x268bea-0x0;var _0x12e920=_0xd3fd[_0x268bea];return _0x12e920;};'use strict';var multer=require(_0xdd3f('0x0'));var util=require(_0xdd3f('0x1'));var path=require(_0xdd3f('0x2'));var timeout=require('connect-timeout');var express=require(_0xdd3f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdd3f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdd3f('0x5'));var controller=require(_0xdd3f('0x6'));router[_0xdd3f('0x7')]('/',controller['index']);module[_0xdd3f('0x8')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 350a055..1d5788d 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 _0x7aa7=['STRING','version','sequelize','exports'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x7aa7,0x13a));var _0x77aa=function(_0x260d4e,_0x5bf8cf){_0x260d4e=_0x260d4e-0x0;var _0x3aa8f6=_0x7aa7[_0x260d4e];return _0x3aa8f6;};'use strict';var Sequelize=require(_0x77aa('0x0'));module[_0x77aa('0x1')]={'version':{'type':Sequelize[_0x77aa('0x2')],'unique':_0x77aa('0x3')}}; \ No newline at end of file +var _0xdfd2=['STRING','version','sequelize','exports'];(function(_0x522f72,_0x3839c3){var _0x3aff90=function(_0x24f582){while(--_0x24f582){_0x522f72['push'](_0x522f72['shift']());}};_0x3aff90(++_0x3839c3);}(_0xdfd2,0x15e));var _0x2dfd=function(_0x318f75,_0x49d008){_0x318f75=_0x318f75-0x0;var _0x15cbb9=_0xdfd2[_0x318f75];return _0x15cbb9;};'use strict';var Sequelize=require(_0x2dfd('0x0'));module[_0x2dfd('0x1')]={'version':{'type':Sequelize[_0x2dfd('0x2')],'unique':_0x2dfd('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 834d1f0..0f9cf8b 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 _0xcf5f=['type','model','map','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','error','stack','name','Migration'];(function(_0x11f0e1,_0x520662){var _0x383b23=function(_0x397ed4){while(--_0x397ed4){_0x11f0e1['push'](_0x11f0e1['shift']());}};_0x383b23(++_0x520662);}(_0xcf5f,0xcb));var _0xfcf5=function(_0x6ba211,_0x192ba6){_0x6ba211=_0x6ba211-0x0;var _0x3affae=_0xcf5f[_0x6ba211];return _0x3affae;};'use strict';var emlformat=require(_0xfcf5('0x0'));var rimraf=require(_0xfcf5('0x1'));var zipdir=require(_0xfcf5('0x2'));var jsonpatch=require(_0xfcf5('0x3'));var rp=require(_0xfcf5('0x4'));var moment=require('moment');var BPromise=require(_0xfcf5('0x5'));var Mustache=require('mustache');var util=require(_0xfcf5('0x6'));var path=require(_0xfcf5('0x7'));var sox=require(_0xfcf5('0x8'));var csv=require(_0xfcf5('0x9'));var ejs=require(_0xfcf5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfcf5('0xb'));var crypto=require(_0xfcf5('0xc'));var jsforce=require(_0xfcf5('0xd'));var deskjs=require(_0xfcf5('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfcf5('0xf'));var Papa=require(_0xfcf5('0x10'));var Redis=require(_0xfcf5('0x11'));var authService=require(_0xfcf5('0x12'));var qs=require(_0xfcf5('0x13'));var as=require(_0xfcf5('0x14'));var hardwareService=require(_0xfcf5('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xfcf5('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xfcf5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x500d95,_0x5cc01c){_0x5cc01c=_0x5cc01c||0xcc;return function(_0x47437f){if(_0x47437f){return _0x500d95[_0xfcf5('0x18')](_0x5cc01c);}return _0x500d95[_0xfcf5('0x19')](_0x5cc01c)[_0xfcf5('0x1a')]();};}function respondWithResult(_0x50f1f1,_0x17b5d1){_0x17b5d1=_0x17b5d1||0xc8;return function(_0x394c00){if(_0x394c00){return _0x50f1f1[_0xfcf5('0x19')](_0x17b5d1)[_0xfcf5('0x1b')](_0x394c00);}};}function respondWithFilteredResult(_0x37f5a1,_0x469fa1){return function(_0x16d2f6){if(_0x16d2f6){var _0x8f4f0=typeof _0x469fa1[_0xfcf5('0x1c')]===_0xfcf5('0x1d')&&typeof _0x469fa1['limit']===_0xfcf5('0x1d');var _0x3af216=_0x16d2f6[_0xfcf5('0x1e')];var _0x16bb78=_0x8f4f0?0x0:_0x469fa1[_0xfcf5('0x1c')];var _0x47dfe7=_0x8f4f0?_0x16d2f6[_0xfcf5('0x1e')]:_0x469fa1[_0xfcf5('0x1c')]+_0x469fa1[_0xfcf5('0x1f')];var _0x32c18a;if(_0x47dfe7>=_0x3af216){_0x47dfe7=_0x3af216;_0x32c18a=0xc8;}else{_0x32c18a=0xce;}_0x37f5a1['status'](_0x32c18a);return _0x37f5a1['set'](_0xfcf5('0x20'),_0x16bb78+'-'+_0x47dfe7+'/'+_0x3af216)[_0xfcf5('0x1b')](_0x16d2f6);}return null;};}function patchUpdates(_0xec3b13){return function(_0x4e7289){try{jsonpatch['apply'](_0x4e7289,_0xec3b13,!![]);}catch(_0x3a0425){return BPromise[_0xfcf5('0x21')](_0x3a0425);}return _0x4e7289[_0xfcf5('0x22')]();};}function saveUpdates(_0xd8ff0,_0x1d7f7f){return function(_0x3042e0){if(_0x3042e0){return _0x3042e0[_0xfcf5('0x23')](_0xd8ff0)[_0xfcf5('0x24')](function(_0x4346c8){return _0x4346c8;});}return null;};}function removeEntity(_0x422066,_0x7fbbca){return function(_0x2803bc){if(_0x2803bc){return _0x2803bc['destroy']()[_0xfcf5('0x24')](function(){_0x422066[_0xfcf5('0x19')](0xcc)[_0xfcf5('0x1a')]();});}};}function handleEntityNotFound(_0x633c02,_0x38f190){return function(_0x2b0c48){if(!_0x2b0c48){_0x633c02[_0xfcf5('0x18')](0x194);}return _0x2b0c48;};}function handleError(_0x4d4da2,_0x52bff5){_0x52bff5=_0x52bff5||0x1f4;return function(_0x2eebbd){logger[_0xfcf5('0x25')](_0x2eebbd[_0xfcf5('0x26')]);if(_0x2eebbd[_0xfcf5('0x27')]){delete _0x2eebbd['name'];}_0x4d4da2[_0xfcf5('0x19')](_0x52bff5)['send'](_0x2eebbd);};}exports['index']=function(_0x34d399,_0x455855){var _0x12c95b={},_0xc0bc24={},_0x4198d8={'count':0x0,'rows':[]};var _0x2b6d01=_['map'](db[_0xfcf5('0x28')]['rawAttributes'],function(_0x1ed1d4){return{'name':_0x1ed1d4['fieldName'],'type':_0x1ed1d4[_0xfcf5('0x29')]['key']};});_0xc0bc24[_0xfcf5('0x2a')]=_[_0xfcf5('0x2b')](_0x2b6d01,_0xfcf5('0x27'));_0xc0bc24['query']=_['keys'](_0x34d399[_0xfcf5('0x2c')]);_0xc0bc24[_0xfcf5('0x2d')]=_[_0xfcf5('0x2e')](_0xc0bc24[_0xfcf5('0x2a')],_0xc0bc24[_0xfcf5('0x2c')]);_0x12c95b['attributes']=_[_0xfcf5('0x2e')](_0xc0bc24[_0xfcf5('0x2a')],qs[_0xfcf5('0x2f')](_0x34d399[_0xfcf5('0x2c')][_0xfcf5('0x2f')]));_0x12c95b[_0xfcf5('0x30')]=_0x12c95b['attributes'][_0xfcf5('0x31')]?_0x12c95b['attributes']:_0xc0bc24[_0xfcf5('0x2a')];if(!_0x34d399[_0xfcf5('0x2c')]['hasOwnProperty'](_0xfcf5('0x32'))){_0x12c95b[_0xfcf5('0x1f')]=qs[_0xfcf5('0x1f')](_0x34d399[_0xfcf5('0x2c')][_0xfcf5('0x1f')]);_0x12c95b[_0xfcf5('0x1c')]=qs[_0xfcf5('0x1c')](_0x34d399[_0xfcf5('0x2c')]['offset']);}_0x12c95b['order']=qs['sort'](_0x34d399[_0xfcf5('0x2c')][_0xfcf5('0x33')]);_0x12c95b[_0xfcf5('0x34')]=qs[_0xfcf5('0x2d')](_[_0xfcf5('0x35')](_0x34d399[_0xfcf5('0x2c')],_0xc0bc24['filters']),_0x2b6d01);if(_0x34d399[_0xfcf5('0x2c')][_0xfcf5('0x36')]){_0x12c95b[_0xfcf5('0x34')]=_[_0xfcf5('0x37')](_0x12c95b[_0xfcf5('0x34')],{'$or':_[_0xfcf5('0x2b')](_0x2b6d01,function(_0x26c5bc){if(_0x26c5bc[_0xfcf5('0x29')]!==_0xfcf5('0x38')){var _0x3e70d3={};_0x3e70d3[_0x26c5bc[_0xfcf5('0x27')]]={'$like':'%'+_0x34d399['query'][_0xfcf5('0x36')]+'%'};return _0x3e70d3;}})});}_0x12c95b=_[_0xfcf5('0x37')]({},_0x12c95b,_0x34d399['options']);var _0xd23199={'where':_0x12c95b['where']};return db[_0xfcf5('0x28')]['count'](_0xd23199)[_0xfcf5('0x24')](function(_0x5f3366){_0x4198d8[_0xfcf5('0x1e')]=_0x5f3366;if(_0x34d399['query']['includeAll']){_0x12c95b[_0xfcf5('0x39')]=[{'all':!![]}];}return db[_0xfcf5('0x28')][_0xfcf5('0x3a')](_0x12c95b);})[_0xfcf5('0x24')](function(_0x155868){_0x4198d8[_0xfcf5('0x3b')]=_0x155868;return _0x4198d8;})[_0xfcf5('0x24')](respondWithFilteredResult(_0x455855,_0x12c95b))[_0xfcf5('0x3c')](handleError(_0x455855,null));}; \ No newline at end of file +var _0x4209=['stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','options','includeAll','include','findAll','rows','catch','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then'];(function(_0x4f17de,_0x5a8a7b){var _0x4eb4b5=function(_0x1e3815){while(--_0x1e3815){_0x4f17de['push'](_0x4f17de['shift']());}};_0x4eb4b5(++_0x5a8a7b);}(_0x4209,0x11c));var _0x9420=function(_0x512aa7,_0x2be0d9){_0x512aa7=_0x512aa7-0x0;var _0x952539=_0x4209[_0x512aa7];return _0x952539;};'use strict';var emlformat=require(_0x9420('0x0'));var rimraf=require(_0x9420('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9420('0x2'));var rp=require(_0x9420('0x3'));var moment=require('moment');var BPromise=require(_0x9420('0x4'));var Mustache=require(_0x9420('0x5'));var util=require(_0x9420('0x6'));var path=require(_0x9420('0x7'));var sox=require(_0x9420('0x8'));var csv=require(_0x9420('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9420('0xa'));var _=require(_0x9420('0xb'));var squel=require(_0x9420('0xc'));var crypto=require(_0x9420('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9420('0xe'));var toCsv=require(_0x9420('0x9'));var querystring=require('querystring');var Papa=require(_0x9420('0xf'));var Redis=require(_0x9420('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9420('0x11'));var as=require(_0x9420('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9420('0x13'))(_0x9420('0x14'));var utils=require(_0x9420('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9420('0x16'))['db'];function respondWithStatusCode(_0x1e0204,_0x556585){_0x556585=_0x556585||0xcc;return function(_0x2a2472){if(_0x2a2472){return _0x1e0204[_0x9420('0x17')](_0x556585);}return _0x1e0204[_0x9420('0x18')](_0x556585)[_0x9420('0x19')]();};}function respondWithResult(_0x338da4,_0x33def7){_0x33def7=_0x33def7||0xc8;return function(_0x2e448c){if(_0x2e448c){return _0x338da4['status'](_0x33def7)[_0x9420('0x1a')](_0x2e448c);}};}function respondWithFilteredResult(_0x30c09b,_0x476dd7){return function(_0x9a63d4){if(_0x9a63d4){var _0x433253=typeof _0x476dd7[_0x9420('0x1b')]===_0x9420('0x1c')&&typeof _0x476dd7[_0x9420('0x1d')]===_0x9420('0x1c');var _0x3ecb33=_0x9a63d4[_0x9420('0x1e')];var _0x191700=_0x433253?0x0:_0x476dd7[_0x9420('0x1b')];var _0x5856f6=_0x433253?_0x9a63d4[_0x9420('0x1e')]:_0x476dd7['offset']+_0x476dd7[_0x9420('0x1d')];var _0x1196ff;if(_0x5856f6>=_0x3ecb33){_0x5856f6=_0x3ecb33;_0x1196ff=0xc8;}else{_0x1196ff=0xce;}_0x30c09b[_0x9420('0x18')](_0x1196ff);return _0x30c09b[_0x9420('0x1f')]('Content-Range',_0x191700+'-'+_0x5856f6+'/'+_0x3ecb33)[_0x9420('0x1a')](_0x9a63d4);}return null;};}function patchUpdates(_0x12f654){return function(_0x24f92a){try{jsonpatch['apply'](_0x24f92a,_0x12f654,!![]);}catch(_0x462756){return BPromise[_0x9420('0x20')](_0x462756);}return _0x24f92a[_0x9420('0x21')]();};}function saveUpdates(_0x5704e2,_0xcc94d){return function(_0x30a7da){if(_0x30a7da){return _0x30a7da[_0x9420('0x22')](_0x5704e2)[_0x9420('0x23')](function(_0x539b49){return _0x539b49;});}return null;};}function removeEntity(_0x163857,_0x177a53){return function(_0x139d20){if(_0x139d20){return _0x139d20['destroy']()['then'](function(){_0x163857[_0x9420('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15b9ba,_0x241876){return function(_0x5195eb){if(!_0x5195eb){_0x15b9ba[_0x9420('0x17')](0x194);}return _0x5195eb;};}function handleError(_0x47eb98,_0x67fea){_0x67fea=_0x67fea||0x1f4;return function(_0x5a2311){logger['error'](_0x5a2311[_0x9420('0x24')]);if(_0x5a2311[_0x9420('0x25')]){delete _0x5a2311[_0x9420('0x25')];}_0x47eb98[_0x9420('0x18')](_0x67fea)[_0x9420('0x26')](_0x5a2311);};}exports[_0x9420('0x27')]=function(_0x5a11ac,_0x8e0d00){var _0x271dc2={},_0x401c43={},_0x5b36bb={'count':0x0,'rows':[]};var _0x545eb6=_[_0x9420('0x28')](db[_0x9420('0x29')][_0x9420('0x2a')],function(_0x4fed9e){return{'name':_0x4fed9e[_0x9420('0x2b')],'type':_0x4fed9e[_0x9420('0x2c')][_0x9420('0x2d')]};});_0x401c43[_0x9420('0x2e')]=_[_0x9420('0x28')](_0x545eb6,_0x9420('0x25'));_0x401c43[_0x9420('0x2f')]=_[_0x9420('0x30')](_0x5a11ac[_0x9420('0x2f')]);_0x401c43[_0x9420('0x31')]=_[_0x9420('0x32')](_0x401c43['model'],_0x401c43['query']);_0x271dc2[_0x9420('0x33')]=_[_0x9420('0x32')](_0x401c43['model'],qs['fields'](_0x5a11ac[_0x9420('0x2f')][_0x9420('0x34')]));_0x271dc2['attributes']=_0x271dc2[_0x9420('0x33')]['length']?_0x271dc2[_0x9420('0x33')]:_0x401c43[_0x9420('0x2e')];if(!_0x5a11ac[_0x9420('0x2f')][_0x9420('0x35')]('nolimit')){_0x271dc2[_0x9420('0x1d')]=qs[_0x9420('0x1d')](_0x5a11ac[_0x9420('0x2f')][_0x9420('0x1d')]);_0x271dc2[_0x9420('0x1b')]=qs['offset'](_0x5a11ac[_0x9420('0x2f')][_0x9420('0x1b')]);}_0x271dc2['order']=qs[_0x9420('0x36')](_0x5a11ac[_0x9420('0x2f')][_0x9420('0x36')]);_0x271dc2[_0x9420('0x37')]=qs[_0x9420('0x31')](_[_0x9420('0x38')](_0x5a11ac[_0x9420('0x2f')],_0x401c43[_0x9420('0x31')]),_0x545eb6);if(_0x5a11ac['query'][_0x9420('0x39')]){_0x271dc2[_0x9420('0x37')]=_['merge'](_0x271dc2['where'],{'$or':_[_0x9420('0x28')](_0x545eb6,function(_0x325a2c){if(_0x325a2c[_0x9420('0x2c')]!=='VIRTUAL'){var _0x3dd5cc={};_0x3dd5cc[_0x325a2c[_0x9420('0x25')]]={'$like':'%'+_0x5a11ac['query'][_0x9420('0x39')]+'%'};return _0x3dd5cc;}})});}_0x271dc2=_['merge']({},_0x271dc2,_0x5a11ac[_0x9420('0x3a')]);var _0x482709={'where':_0x271dc2['where']};return db['Migration'][_0x9420('0x1e')](_0x482709)[_0x9420('0x23')](function(_0x123844){_0x5b36bb['count']=_0x123844;if(_0x5a11ac[_0x9420('0x2f')][_0x9420('0x3b')]){_0x271dc2[_0x9420('0x3c')]=[{'all':!![]}];}return db[_0x9420('0x29')][_0x9420('0x3d')](_0x271dc2);})[_0x9420('0x23')](function(_0x536910){_0x5b36bb[_0x9420('0x3e')]=_0x536910;return _0x5b36bb;})[_0x9420('0x23')](respondWithFilteredResult(_0x8e0d00,_0x271dc2))[_0x9420('0x3f')](handleError(_0x8e0d00,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index a946c4d..b14fcba 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 _0x063a=['request-promise','path','exports','Migration','migrations','lodash','../../config/logger','api','bluebird'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x063a,0x125));var _0xa063=function(_0x221da6,_0x5e6658){_0x221da6=_0x221da6-0x0;var _0x32726b=_0x063a[_0x221da6];return _0x32726b;};'use strict';var _=require(_0xa063('0x0'));var util=require('util');var logger=require(_0xa063('0x1'))(_0xa063('0x2'));var moment=require('moment');var BPromise=require(_0xa063('0x3'));var rp=require(_0xa063('0x4'));var fs=require('fs');var path=require(_0xa063('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./migration.attributes');module[_0xa063('0x6')]=function(_0x4000af,_0x5286b4){return _0x4000af['define'](_0xa063('0x7'),attributes,{'tableName':_0xa063('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e17=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash','util','../../config/logger','api'];(function(_0x2a5bfc,_0x3d857a){var _0x1abdb0=function(_0x5a0950){while(--_0x5a0950){_0x2a5bfc['push'](_0x2a5bfc['shift']());}};_0x1abdb0(++_0x3d857a);}(_0x5e17,0x92));var _0x75e1=function(_0x5494ce,_0x21d232){_0x5494ce=_0x5494ce-0x0;var _0x44a58f=_0x5e17[_0x5494ce];return _0x44a58f;};'use strict';var _=require(_0x75e1('0x0'));var util=require(_0x75e1('0x1'));var logger=require(_0x75e1('0x2'))(_0x75e1('0x3'));var moment=require(_0x75e1('0x4'));var BPromise=require(_0x75e1('0x5'));var rp=require(_0x75e1('0x6'));var fs=require('fs');var path=require(_0x75e1('0x7'));var rimraf=require(_0x75e1('0x8'));var config=require(_0x75e1('0x9'));var attributes=require(_0x75e1('0xa'));module[_0x75e1('0xb')]=function(_0x1f0c01,_0x2be265){return _0x1f0c01[_0x75e1('0xc')](_0x75e1('0xd'),attributes,{'tableName':_0x75e1('0xe'),'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 11e0c2a..328e497 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 _0x502a=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x502a,0xd8));var _0xa502=function(_0x45c490,_0x117edb){_0x45c490=_0x45c490-0x0;var _0x220c22=_0x502a[_0x45c490];return _0x220c22;};'use strict';var _=require(_0xa502('0x0'));var util=require(_0xa502('0x1'));var moment=require('moment');var BPromise=require(_0xa502('0x2'));var rs=require(_0xa502('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa502('0x4'));var logger=require('../../config/logger')(_0xa502('0x5'));var config=require(_0xa502('0x6'));var jayson=require(_0xa502('0x7'));var client=jayson[_0xa502('0x8')][_0xa502('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x489407,_0x329022,_0x29fb03){return new BPromise(function(_0x4d30f2,_0x4e4e5d){return client[_0xa502('0xa')](_0x489407,_0x29fb03)[_0xa502('0xb')](function(_0x5251fa){logger[_0xa502('0xc')](_0xa502('0xd'),_0x329022,_0xa502('0xe'));logger['debug'](_0xa502('0xf'),_0x329022,_0xa502('0xe'),JSON[_0xa502('0x10')](_0x5251fa));if(_0x5251fa['error']){if(_0x5251fa[_0xa502('0x11')][_0xa502('0x12')]===0x1f4){logger['error'](_0xa502('0xd'),_0x329022,_0x5251fa[_0xa502('0x11')]['message']);return _0x4e4e5d(_0x5251fa[_0xa502('0x11')][_0xa502('0x13')]);}logger[_0xa502('0x11')]('Migration,\x20%s,\x20%s',_0x329022,_0x5251fa[_0xa502('0x11')][_0xa502('0x13')]);return _0x4d30f2(_0x5251fa[_0xa502('0x11')]['message']);}else{logger[_0xa502('0xc')](_0xa502('0xd'),_0x329022,_0xa502('0xe'));_0x4d30f2(_0x5251fa[_0xa502('0x14')][_0xa502('0x13')]);}})[_0xa502('0x15')](function(_0x3107a0){logger[_0xa502('0x11')](_0xa502('0xd'),_0x329022,_0x3107a0);_0x4e4e5d(_0x3107a0);});});} \ No newline at end of file +var _0xb16f=['error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','request','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0xb16f,0xf6));var _0xfb16=function(_0x53c4f8,_0x44ccaf){_0x53c4f8=_0x53c4f8-0x0;var _0x416458=_0xb16f[_0x53c4f8];return _0x416458;};'use strict';var _=require(_0xfb16('0x0'));var util=require(_0xfb16('0x1'));var moment=require(_0xfb16('0x2'));var BPromise=require('bluebird');var rs=require(_0xfb16('0x3'));var fs=require('fs');var Redis=require(_0xfb16('0x4'));var db=require(_0xfb16('0x5'))['db'];var utils=require(_0xfb16('0x6'));var logger=require('../../config/logger')(_0xfb16('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3cdd5e,_0x4de946,_0x1e615f){return new BPromise(function(_0x4b5296,_0x119b28){return client[_0xfb16('0x8')](_0x3cdd5e,_0x1e615f)['then'](function(_0x4fc6bf){logger['info'](_0xfb16('0x9'),_0x4de946,_0xfb16('0xa'));logger[_0xfb16('0xb')](_0xfb16('0xc'),_0x4de946,_0xfb16('0xa'),JSON[_0xfb16('0xd')](_0x4fc6bf));if(_0x4fc6bf[_0xfb16('0xe')]){if(_0x4fc6bf[_0xfb16('0xe')][_0xfb16('0xf')]===0x1f4){logger[_0xfb16('0xe')](_0xfb16('0x9'),_0x4de946,_0x4fc6bf['error'][_0xfb16('0x10')]);return _0x119b28(_0x4fc6bf['error']['message']);}logger[_0xfb16('0xe')](_0xfb16('0x9'),_0x4de946,_0x4fc6bf[_0xfb16('0xe')]['message']);return _0x4b5296(_0x4fc6bf[_0xfb16('0xe')][_0xfb16('0x10')]);}else{logger[_0xfb16('0x11')](_0xfb16('0x9'),_0x4de946,_0xfb16('0xa'));_0x4b5296(_0x4fc6bf[_0xfb16('0x12')][_0xfb16('0x10')]);}})[_0xfb16('0x13')](function(_0x384f74){logger[_0xfb16('0xe')](_0xfb16('0x9'),_0x4de946,_0x384f74);_0x119b28(_0x384f74);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 72b7dde..b989afd 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 _0xedf1=['show','post','create','put','update','delete','destroy','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./network.controller','index','get','/:id','isAuthenticated'];(function(_0x37b729,_0x8f10af){var _0x40cd25=function(_0x24154b){while(--_0x24154b){_0x37b729['push'](_0x37b729['shift']());}};_0x40cd25(++_0x8f10af);}(_0xedf1,0xb2));var _0x1edf=function(_0x28ae1c,_0x8dd13c){_0x28ae1c=_0x28ae1c-0x0;var _0x5270d2=_0xedf1[_0x28ae1c];return _0x5270d2;};'use strict';var multer=require(_0x1edf('0x0'));var util=require(_0x1edf('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1edf('0x2'));var router=express[_0x1edf('0x3')]();var fs_extra=require(_0x1edf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1edf('0x5'));var config=require(_0x1edf('0x6'));var controller=require(_0x1edf('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x1edf('0x8')]);router[_0x1edf('0x9')](_0x1edf('0xa'),auth[_0x1edf('0xb')](),controller[_0x1edf('0xc')]);router[_0x1edf('0xd')]('/',auth[_0x1edf('0xb')](),controller[_0x1edf('0xe')]);router[_0x1edf('0xf')]('/:id',auth[_0x1edf('0xb')](),controller[_0x1edf('0x10')]);router[_0x1edf('0x11')](_0x1edf('0xa'),auth['isAuthenticated'](),controller[_0x1edf('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5cd5=['show','post','create','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','index','/:id','isAuthenticated'];(function(_0x5adf81,_0x1232e9){var _0x376768=function(_0x1822a5){while(--_0x1822a5){_0x5adf81['push'](_0x5adf81['shift']());}};_0x376768(++_0x1232e9);}(_0x5cd5,0x149));var _0x55cd=function(_0x504f7a,_0x5562c4){_0x504f7a=_0x504f7a-0x0;var _0xb31d44=_0x5cd5[_0x504f7a];return _0xb31d44;};'use strict';var multer=require(_0x55cd('0x0'));var util=require(_0x55cd('0x1'));var path=require(_0x55cd('0x2'));var timeout=require(_0x55cd('0x3'));var express=require(_0x55cd('0x4'));var router=express['Router']();var fs_extra=require(_0x55cd('0x5'));var auth=require(_0x55cd('0x6'));var interaction=require(_0x55cd('0x7'));var config=require(_0x55cd('0x8'));var controller=require(_0x55cd('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x55cd('0xa')]);router['get'](_0x55cd('0xb'),auth[_0x55cd('0xc')](),controller[_0x55cd('0xd')]);router[_0x55cd('0xe')]('/',auth['isAuthenticated'](),controller[_0x55cd('0xf')]);router['put'](_0x55cd('0xb'),auth[_0x55cd('0xc')](),controller['update']);router[_0x55cd('0x10')](_0x55cd('0xb'),auth[_0x55cd('0xc')](),controller['destroy']);module[_0x55cd('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 3d962ca..a814135 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 _0x6619=['stun','turn','STRING','sequelize','exports','ENUM','localnet','externip'];(function(_0x444e8b,_0x3524cc){var _0x35eb37=function(_0x17e1a3){while(--_0x17e1a3){_0x444e8b['push'](_0x444e8b['shift']());}};_0x35eb37(++_0x3524cc);}(_0x6619,0x7b));var _0x9661=function(_0x3a6c58,_0xf360e2){_0x3a6c58=_0x3a6c58-0x0;var _0x3c9853=_0x6619[_0x3a6c58];return _0x3c9853;};'use strict';var Sequelize=require(_0x9661('0x0'));module[_0x9661('0x1')]={'type':{'type':Sequelize[_0x9661('0x2')](_0x9661('0x3'),_0x9661('0x4'),_0x9661('0x5'),_0x9661('0x6'))},'value':{'type':Sequelize[_0x9661('0x7')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x9661('0x7')]}}; \ No newline at end of file +var _0x9842=['STRING','localnet','externip','stun'];(function(_0x33b8de,_0x41819a){var _0x507fe1=function(_0x51f232){while(--_0x51f232){_0x33b8de['push'](_0x33b8de['shift']());}};_0x507fe1(++_0x41819a);}(_0x9842,0x1d9));var _0x2984=function(_0x4d9008,_0xb807a8){_0x4d9008=_0x4d9008-0x0;var _0x552075=_0x9842[_0x4d9008];return _0x552075;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0x2984('0x0'),_0x2984('0x1'),_0x2984('0x2'),'turn')},'value':{'type':Sequelize[_0x2984('0x3')]},'username':{'type':Sequelize[_0x2984('0x3')]},'password':{'type':Sequelize[_0x2984('0x3')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 47501f2..dbb9be8 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 _0x9b45=['request','then','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','status','limit','undefined','count','offset','set','json','update','end','sendStatus','stack','name','send','index','map','Network','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','show','params','rawAttributes','find','create','body','findAll','toUpperCase','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','readFileSync','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','format','chan_sip.so','destroy','toLowerCase','ejs','lodash','../../config/logger','api','../../config/environment','jayson/promise','http'];(function(_0x56206c,_0x3cb817){var _0x39a8f0=function(_0x478e67){while(--_0x478e67){_0x56206c['push'](_0x56206c['shift']());}};_0x39a8f0(++_0x3cb817);}(_0x9b45,0x151));var _0x59b4=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9b45[_0x4a9fb1];return _0x348672;};'use strict';var util=require('util');var path=require('path');var ejs=require(_0x59b4('0x0'));var fs=require('fs');var _=require(_0x59b4('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x59b4('0x2'))(_0x59b4('0x3'));var config=require(_0x59b4('0x4'));var db=require('../../mysqldb')['db'];var jayson=require(_0x59b4('0x5'));var client=jayson['client'][_0x59b4('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x597485,_0x2bb524,_0x417c41,_0x156c80){return new Promise(function(_0x4b267a,_0x2c465e){var _0x2e4ce6=_0x156c80||client;return _0x2e4ce6[_0x59b4('0x7')](_0x597485,_0x417c41)[_0x59b4('0x8')](function(_0x14dec1){logger['info'](_0x59b4('0x9'),_0x2bb524,_0x59b4('0xa'));logger[_0x59b4('0xb')](_0x59b4('0xc'),_0x2bb524,_0x59b4('0xa'),JSON[_0x59b4('0xd')](_0x14dec1));if(_0x14dec1[_0x59b4('0xe')]){if(_0x14dec1[_0x59b4('0xe')]['code']===0x1f4){logger[_0x59b4('0xe')](_0x59b4('0x9'),_0x2bb524,_0x14dec1['error'][_0x59b4('0xf')]);return _0x2c465e(_0x14dec1[_0x59b4('0xe')][_0x59b4('0xf')]);}logger['error'](_0x59b4('0x9'),_0x2bb524,_0x14dec1[_0x59b4('0xe')][_0x59b4('0xf')]);return _0x4b267a(_0x14dec1[_0x59b4('0xe')]['message']);}else{logger[_0x59b4('0x10')](_0x59b4('0x9'),_0x2bb524,_0x59b4('0xa'));_0x4b267a(_0x14dec1[_0x59b4('0x11')][_0x59b4('0xf')]);}})[_0x59b4('0x12')](function(_0x1e81ac){logger[_0x59b4('0xe')](_0x59b4('0x9'),_0x2bb524,_0x1e81ac);_0x2c465e(_0x1e81ac);});});}function respondWithResult(_0x15d900,_0x56eb24){_0x56eb24=_0x56eb24||0xc8;return function(_0x542c23){if(_0x542c23){return _0x15d900[_0x59b4('0x13')](_0x56eb24)['json'](_0x542c23);}};}function respondWithFilteredResult(_0x2ce0fb,_0x4551ce){return function(_0x2ff221){if(_0x2ff221){var _0x4c96c4=typeof _0x4551ce['offset']==='undefined'&&typeof _0x4551ce[_0x59b4('0x14')]===_0x59b4('0x15');var _0x2d7951=_0x2ff221[_0x59b4('0x16')];var _0x53d2bb=_0x4c96c4?0x0:_0x4551ce[_0x59b4('0x17')];var _0x49a322=_0x4c96c4?_0x2ff221[_0x59b4('0x16')]:_0x4551ce[_0x59b4('0x17')]+_0x4551ce[_0x59b4('0x14')];var _0x3f7998;if(_0x49a322>=_0x2d7951){_0x49a322=_0x2d7951;_0x3f7998=0xc8;}else{_0x3f7998=0xce;}_0x2ce0fb[_0x59b4('0x13')](_0x3f7998);return _0x2ce0fb[_0x59b4('0x18')]('Content-Range',_0x53d2bb+'-'+_0x49a322+'/'+_0x2d7951)[_0x59b4('0x19')](_0x2ff221);}return null;};}function saveUpdates(_0x5d38a0){return function(_0x1996d4){if(_0x1996d4){return _0x1996d4[_0x59b4('0x1a')](_0x5d38a0)[_0x59b4('0x8')](function(_0xdf9bd0){return _0xdf9bd0;});}return null;};}function removeEntity(_0x271682){return function(_0x2f6c37){if(_0x2f6c37){return _0x2f6c37['destroy']()['then'](function(){_0x271682[_0x59b4('0x13')](0xcc)[_0x59b4('0x1b')]();});}};}function handleEntityNotFound(_0x3312c9){return function(_0x296ee6){if(!_0x296ee6){_0x3312c9[_0x59b4('0x1c')](0x194);}return _0x296ee6;};}function handleError(_0x4336e2,_0x528392){_0x528392=_0x528392||0x1f4;return function(_0x6bc86b){logger[_0x59b4('0xe')](_0x6bc86b[_0x59b4('0x1d')]);if(_0x6bc86b[_0x59b4('0x1e')]){delete _0x6bc86b[_0x59b4('0x1e')];}_0x4336e2['status'](_0x528392)[_0x59b4('0x1f')](_0x6bc86b);};}exports[_0x59b4('0x20')]=function(_0x2d7f37,_0x88bb3a){var _0x23da5a={},_0x45af5e={},_0xfe0d91={'count':0x0,'rows':[]};var _0x104da0=_[_0x59b4('0x21')](db[_0x59b4('0x22')]['rawAttributes'],function(_0xe2dc3c){return{'name':_0xe2dc3c[_0x59b4('0x23')],'type':_0xe2dc3c[_0x59b4('0x24')][_0x59b4('0x25')]};});_0x45af5e['model']=_[_0x59b4('0x21')](_0x104da0,_0x59b4('0x1e'));_0x45af5e[_0x59b4('0x26')]=_[_0x59b4('0x27')](_0x2d7f37[_0x59b4('0x26')]);_0x45af5e[_0x59b4('0x28')]=_['intersection'](_0x45af5e[_0x59b4('0x29')],_0x45af5e[_0x59b4('0x26')]);_0x23da5a[_0x59b4('0x2a')]=_[_0x59b4('0x2b')](_0x45af5e[_0x59b4('0x29')],qs[_0x59b4('0x2c')](_0x2d7f37[_0x59b4('0x26')]['fields']));_0x23da5a[_0x59b4('0x2a')]=_0x23da5a[_0x59b4('0x2a')][_0x59b4('0x2d')]?_0x23da5a[_0x59b4('0x2a')]:_0x45af5e['model'];if(!_0x2d7f37[_0x59b4('0x26')][_0x59b4('0x2e')](_0x59b4('0x2f'))){_0x23da5a[_0x59b4('0x14')]=qs[_0x59b4('0x14')](_0x2d7f37[_0x59b4('0x26')]['limit']);_0x23da5a[_0x59b4('0x17')]=qs[_0x59b4('0x17')](_0x2d7f37[_0x59b4('0x26')][_0x59b4('0x17')]);}_0x23da5a[_0x59b4('0x30')]=qs[_0x59b4('0x31')](_0x2d7f37[_0x59b4('0x26')][_0x59b4('0x31')]);_0x23da5a[_0x59b4('0x32')]=qs[_0x59b4('0x28')](_[_0x59b4('0x33')](_0x2d7f37[_0x59b4('0x26')],_0x45af5e[_0x59b4('0x28')]),_0x104da0);if(_0x2d7f37[_0x59b4('0x26')][_0x59b4('0x34')]){_0x23da5a[_0x59b4('0x32')]=_[_0x59b4('0x35')](_0x23da5a[_0x59b4('0x32')],{'$or':_[_0x59b4('0x21')](_0x104da0,function(_0x1903e6){if(_0x1903e6['type']!==_0x59b4('0x36')){var _0x96fead={};_0x96fead[_0x1903e6[_0x59b4('0x1e')]]={'$like':'%'+_0x2d7f37[_0x59b4('0x26')]['filter']+'%'};return _0x96fead;}})});}_0x23da5a=_[_0x59b4('0x35')]({},_0x23da5a,_0x2d7f37[_0x59b4('0x37')]);var _0x3fa24d={'where':_0x23da5a[_0x59b4('0x32')]};return db['Network'][_0x59b4('0x16')](_0x3fa24d)['then'](function(_0x4a605f){_0xfe0d91[_0x59b4('0x16')]=_0x4a605f;if(_0x2d7f37['query'][_0x59b4('0x38')]){_0x23da5a[_0x59b4('0x39')]=[{'all':!![]}];}return db[_0x59b4('0x22')]['findAll'](_0x23da5a);})[_0x59b4('0x8')](function(_0x262a9f){_0xfe0d91['rows']=_0x262a9f;return _0xfe0d91;})[_0x59b4('0x8')](respondWithFilteredResult(_0x88bb3a,_0x23da5a))[_0x59b4('0x12')](handleError(_0x88bb3a,null));};exports[_0x59b4('0x3a')]=function(_0x24434c,_0x2da9c4){var _0x291223={'raw':!![],'where':{'id':_0x24434c[_0x59b4('0x3b')]['id']}},_0x25bb00={};_0x25bb00[_0x59b4('0x29')]=_[_0x59b4('0x27')](db[_0x59b4('0x22')][_0x59b4('0x3c')]);_0x25bb00[_0x59b4('0x26')]=_[_0x59b4('0x27')](_0x24434c['query']);_0x25bb00[_0x59b4('0x28')]=_[_0x59b4('0x2b')](_0x25bb00[_0x59b4('0x29')],_0x25bb00[_0x59b4('0x26')]);_0x291223[_0x59b4('0x2a')]=_[_0x59b4('0x2b')](_0x25bb00[_0x59b4('0x29')],qs[_0x59b4('0x2c')](_0x24434c[_0x59b4('0x26')][_0x59b4('0x2c')]));_0x291223[_0x59b4('0x2a')]=_0x291223[_0x59b4('0x2a')][_0x59b4('0x2d')]?_0x291223[_0x59b4('0x2a')]:_0x25bb00[_0x59b4('0x29')];if(_0x24434c[_0x59b4('0x26')]['includeAll']){_0x291223[_0x59b4('0x39')]=[{'all':!![]}];}_0x291223=_['merge']({},_0x291223,_0x24434c[_0x59b4('0x37')]);return db[_0x59b4('0x22')][_0x59b4('0x3d')](_0x291223)[_0x59b4('0x8')](handleEntityNotFound(_0x2da9c4,null))['then'](respondWithResult(_0x2da9c4,null))[_0x59b4('0x12')](handleError(_0x2da9c4,null));};exports[_0x59b4('0x3e')]=function(_0xc5af88,_0x329ea2){var _0x2b50f3;return db['Network']['create'](_0xc5af88[_0x59b4('0x3f')],{'raw':!![]})[_0x59b4('0x8')](function(_0xa4d97){_0x2b50f3=_0xa4d97;return db[_0x59b4('0x22')][_0x59b4('0x40')]({'where':{'type':_0xc5af88[_0x59b4('0x3f')]['type']},'raw':!![]});})['then'](function(_0x3a7ffe){if(_0x2b50f3[_0x59b4('0x24')][_0x59b4('0x41')]()==_0x59b4('0x42')){var _0x287c51=fs['readFileSync'](path[_0x59b4('0x43')](config[_0x59b4('0x44')],_0x59b4('0x45')),_0x59b4('0x46'));var _0x2a0bb3=ejs[_0x59b4('0x47')](_0x287c51,{'networks':_0x3a7ffe||[]});fs[_0x59b4('0x48')](_0x59b4('0x49'),_0x2a0bb3);return respondWithRpcPromise(_0x59b4('0x4a'),_0x59b4('0x3e'),{'module':_0x59b4('0x4b')});}else if(_0x2b50f3[_0x59b4('0x24')][_0x59b4('0x41')]()==_0x59b4('0x4c')){var _0x518900=fs[_0x59b4('0x4d')](path['join'](config[_0x59b4('0x44')],_0x59b4('0x4e')),_0x59b4('0x46'));var _0x1664a8=ejs[_0x59b4('0x47')](_0x518900,{'networks':_0x3a7ffe||[]});fs['writeFileSync'](_0x59b4('0x4f'),_0x1664a8);return respondWithRpcPromise(_0x59b4('0x4a'),_0x59b4('0x3e'),{'module':_0x59b4('0x4b')});}else{var _0x53c96c=fs[_0x59b4('0x4d')](path[_0x59b4('0x43')](config[_0x59b4('0x44')],_0x59b4('0x50')),_0x59b4('0x46'));var _0x188928=ejs['render'](_0x53c96c,{'networks':_0x3a7ffe||[]});fs[_0x59b4('0x48')](util['format'](_0x59b4('0x51'),_0xc5af88[_0x59b4('0x3f')][_0x59b4('0x24')]['toLowerCase']()),_0x188928);return respondWithRpcPromise(_0x59b4('0x4a'),_0x59b4('0x3e'),{'module':'chan_sip.so'});}})[_0x59b4('0x8')](function(){return _0x2b50f3;})[_0x59b4('0x8')](respondWithResult(_0x329ea2,0xc9))[_0x59b4('0x12')](handleError(_0x329ea2,null));};exports['update']=function(_0x4153ed,_0x2f9bcc){var _0x550037;return db['Network'][_0x59b4('0x3d')]({'where':{'id':_0x4153ed[_0x59b4('0x3b')]['id']}})[_0x59b4('0x8')](handleEntityNotFound(_0x2f9bcc,null))['then'](saveUpdates(_0x4153ed[_0x59b4('0x3f')],null))[_0x59b4('0x8')](function(_0x31f783){if(_0x31f783){_0x550037=_0x31f783;return db[_0x59b4('0x22')][_0x59b4('0x40')]({'where':{'type':_0x550037[_0x59b4('0x24')]},'raw':!![]});}return null;})[_0x59b4('0x8')](function(_0x179e9e){if(_0x550037['type'][_0x59b4('0x41')]()==_0x59b4('0x42')){var _0x5394ce=fs['readFileSync'](path['join'](config[_0x59b4('0x44')],_0x59b4('0x45')),_0x59b4('0x46'));var _0x37ec4c=ejs['render'](_0x5394ce,{'networks':_0x179e9e||[]});fs[_0x59b4('0x48')]('/etc/asterisk/stun_xcally.conf',_0x37ec4c);return respondWithRpcPromise('Reload',_0x59b4('0x1a'),{'module':_0x59b4('0x4b')});}else if(_0x550037[_0x59b4('0x24')]['toUpperCase']()=='TURN'){var _0x2207d0=fs[_0x59b4('0x4d')](path[_0x59b4('0x43')](config[_0x59b4('0x44')],_0x59b4('0x4e')),'utf8');var _0x4b8ab4=ejs[_0x59b4('0x47')](_0x2207d0,{'networks':_0x179e9e||[]});fs[_0x59b4('0x48')](_0x59b4('0x4f'),_0x4b8ab4);return respondWithRpcPromise(_0x59b4('0x4a'),_0x59b4('0x1a'),{'module':_0x59b4('0x4b')});}else{var _0x334c2a=fs[_0x59b4('0x4d')](path[_0x59b4('0x43')](config[_0x59b4('0x44')],_0x59b4('0x50')),_0x59b4('0x46'));var _0x22a744=ejs[_0x59b4('0x47')](_0x334c2a,{'networks':_0x179e9e||[]});fs[_0x59b4('0x48')](util[_0x59b4('0x52')](_0x59b4('0x51'),_0x4153ed[_0x59b4('0x3f')][_0x59b4('0x24')]['toLowerCase']()),_0x22a744);return respondWithRpcPromise(_0x59b4('0x4a'),_0x59b4('0x1a'),{'module':_0x59b4('0x53')});}})[_0x59b4('0x8')](function(_0x4e0fb5){if(_0x4e0fb5){return _0x550037;}return null;})['then'](respondWithResult(_0x2f9bcc,null))['catch'](handleError(_0x2f9bcc,null));};exports[_0x59b4('0x54')]=function(_0x5caffa,_0x30bc3d){var _0x20d3dc;return db['Network'][_0x59b4('0x3d')]({'where':{'id':_0x5caffa['params']['id']}})[_0x59b4('0x8')](function(_0x2ed930){_0x20d3dc=_0x2ed930;return _0x2ed930;})[_0x59b4('0x8')](handleEntityNotFound(_0x30bc3d,null))[_0x59b4('0x8')](removeEntity(_0x30bc3d,null))[_0x59b4('0x8')](function(){if(_0x20d3dc){return db[_0x59b4('0x22')][_0x59b4('0x40')]({'where':{'type':_0x20d3dc['type']},'raw':!![]});}})[_0x59b4('0x8')](function(_0xa1a3e){if(_0x20d3dc['type'][_0x59b4('0x41')]()=='STUN'){var _0x57470f=fs['readFileSync'](path[_0x59b4('0x43')](config[_0x59b4('0x44')],_0x59b4('0x45')),_0x59b4('0x46'));var _0x263238=ejs[_0x59b4('0x47')](_0x57470f,{'networks':_0xa1a3e||[]});fs[_0x59b4('0x48')]('/etc/asterisk/stun_xcally.conf',_0x263238);return respondWithRpcPromise(_0x59b4('0x4a'),'destroy',{'module':_0x59b4('0x4b')});}else if(_0x20d3dc['type']['toUpperCase']()==_0x59b4('0x4c')){var _0x32d6d3=fs[_0x59b4('0x4d')](path['join'](config[_0x59b4('0x44')],_0x59b4('0x4e')),'utf8');var _0x3240ef=ejs[_0x59b4('0x47')](_0x32d6d3,{'networks':_0xa1a3e||[]});fs['writeFileSync'](_0x59b4('0x4f'),_0x3240ef);return respondWithRpcPromise(_0x59b4('0x4a'),_0x59b4('0x54'),{'module':_0x59b4('0x4b')});}else{var _0x3493d9=fs['readFileSync'](path[_0x59b4('0x43')](config[_0x59b4('0x44')],_0x59b4('0x50')),_0x59b4('0x46'));var _0x587dc6=ejs[_0x59b4('0x47')](_0x3493d9,{'networks':_0xa1a3e||[]});fs[_0x59b4('0x48')](util[_0x59b4('0x52')](_0x59b4('0x51'),_0x20d3dc[_0x59b4('0x24')][_0x59b4('0x55')]()),_0x587dc6);return respondWithRpcPromise(_0x59b4('0x4a'),_0x59b4('0x54'),{'module':'chan_sip.so'});}})[_0x59b4('0x12')](handleError(_0x30bc3d,null));}; \ No newline at end of file +var _0x725c=['request','then','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','Network,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','count','limit','set','Content-Range','update','destroy','sendStatus','stack','name','send','index','Network','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','params','rawAttributes','length','include','find','create','body','findAll','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','/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','writeFileSync','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','path','lodash','../../components/parsers/qs','api','../../config/environment','jayson/promise','client'];(function(_0x2ef7b0,_0x3c1a32){var _0x41739b=function(_0x2e89a2){while(--_0x2e89a2){_0x2ef7b0['push'](_0x2ef7b0['shift']());}};_0x41739b(++_0x3c1a32);}(_0x725c,0x1eb));var _0xc725=function(_0x12ec3e,_0x396b4a){_0x12ec3e=_0x12ec3e-0x0;var _0x12cbbe=_0x725c[_0x12ec3e];return _0x12cbbe;};'use strict';var util=require('util');var path=require(_0xc725('0x0'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc725('0x1'));var qs=require(_0xc725('0x2'));var logger=require('../../config/logger')(_0xc725('0x3'));var config=require(_0xc725('0x4'));var db=require('../../mysqldb')['db'];var jayson=require(_0xc725('0x5'));var client=jayson[_0xc725('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3baf57,_0x42d39f,_0x447665,_0x2aa844){return new Promise(function(_0x124967,_0x501909){var _0x2c80f6=_0x2aa844||client;return _0x2c80f6[_0xc725('0x7')](_0x3baf57,_0x447665)[_0xc725('0x8')](function(_0x13c952){logger[_0xc725('0x9')]('Network,\x20%s,\x20%s',_0x42d39f,_0xc725('0xa'));logger[_0xc725('0xb')](_0xc725('0xc'),_0x42d39f,_0xc725('0xa'),JSON['stringify'](_0x13c952));if(_0x13c952['error']){if(_0x13c952[_0xc725('0xd')][_0xc725('0xe')]===0x1f4){logger[_0xc725('0xd')](_0xc725('0xf'),_0x42d39f,_0x13c952['error'][_0xc725('0x10')]);return _0x501909(_0x13c952[_0xc725('0xd')]['message']);}logger['error'](_0xc725('0xf'),_0x42d39f,_0x13c952[_0xc725('0xd')][_0xc725('0x10')]);return _0x124967(_0x13c952[_0xc725('0xd')][_0xc725('0x10')]);}else{logger[_0xc725('0x9')](_0xc725('0xf'),_0x42d39f,'request\x20sent');_0x124967(_0x13c952[_0xc725('0x11')][_0xc725('0x10')]);}})[_0xc725('0x12')](function(_0x47b2c7){logger['error'](_0xc725('0xf'),_0x42d39f,_0x47b2c7);_0x501909(_0x47b2c7);});});}function respondWithResult(_0x10fec5,_0xa1dabf){_0xa1dabf=_0xa1dabf||0xc8;return function(_0xad4e57){if(_0xad4e57){return _0x10fec5[_0xc725('0x13')](_0xa1dabf)[_0xc725('0x14')](_0xad4e57);}};}function respondWithFilteredResult(_0x591284,_0x3e76b4){return function(_0x5e7394){if(_0x5e7394){var _0x9ecf45=typeof _0x3e76b4[_0xc725('0x15')]===_0xc725('0x16')&&typeof _0x3e76b4['limit']===_0xc725('0x16');var _0x353187=_0x5e7394[_0xc725('0x17')];var _0x24aed5=_0x9ecf45?0x0:_0x3e76b4['offset'];var _0x318107=_0x9ecf45?_0x5e7394[_0xc725('0x17')]:_0x3e76b4[_0xc725('0x15')]+_0x3e76b4[_0xc725('0x18')];var _0x40349e;if(_0x318107>=_0x353187){_0x318107=_0x353187;_0x40349e=0xc8;}else{_0x40349e=0xce;}_0x591284[_0xc725('0x13')](_0x40349e);return _0x591284[_0xc725('0x19')](_0xc725('0x1a'),_0x24aed5+'-'+_0x318107+'/'+_0x353187)[_0xc725('0x14')](_0x5e7394);}return null;};}function saveUpdates(_0x510a79){return function(_0x3711ca){if(_0x3711ca){return _0x3711ca[_0xc725('0x1b')](_0x510a79)[_0xc725('0x8')](function(_0x394d3c){return _0x394d3c;});}return null;};}function removeEntity(_0xb9d264){return function(_0x48b7e9){if(_0x48b7e9){return _0x48b7e9[_0xc725('0x1c')]()['then'](function(){_0xb9d264[_0xc725('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x918c1f){return function(_0x2c15e2){if(!_0x2c15e2){_0x918c1f[_0xc725('0x1d')](0x194);}return _0x2c15e2;};}function handleError(_0x2e46f3,_0x511386){_0x511386=_0x511386||0x1f4;return function(_0x15a355){logger[_0xc725('0xd')](_0x15a355[_0xc725('0x1e')]);if(_0x15a355['name']){delete _0x15a355[_0xc725('0x1f')];}_0x2e46f3[_0xc725('0x13')](_0x511386)[_0xc725('0x20')](_0x15a355);};}exports[_0xc725('0x21')]=function(_0x419a24,_0x1125fe){var _0x5c9e64={},_0x2fba7b={},_0x4d6645={'count':0x0,'rows':[]};var _0x2ecde2=_['map'](db[_0xc725('0x22')]['rawAttributes'],function(_0x18f3b7){return{'name':_0x18f3b7[_0xc725('0x23')],'type':_0x18f3b7[_0xc725('0x24')]['key']};});_0x2fba7b[_0xc725('0x25')]=_[_0xc725('0x26')](_0x2ecde2,_0xc725('0x1f'));_0x2fba7b['query']=_[_0xc725('0x27')](_0x419a24[_0xc725('0x28')]);_0x2fba7b[_0xc725('0x29')]=_[_0xc725('0x2a')](_0x2fba7b[_0xc725('0x25')],_0x2fba7b['query']);_0x5c9e64[_0xc725('0x2b')]=_[_0xc725('0x2a')](_0x2fba7b[_0xc725('0x25')],qs[_0xc725('0x2c')](_0x419a24[_0xc725('0x28')][_0xc725('0x2c')]));_0x5c9e64[_0xc725('0x2b')]=_0x5c9e64[_0xc725('0x2b')]['length']?_0x5c9e64[_0xc725('0x2b')]:_0x2fba7b[_0xc725('0x25')];if(!_0x419a24[_0xc725('0x28')]['hasOwnProperty'](_0xc725('0x2d'))){_0x5c9e64[_0xc725('0x18')]=qs[_0xc725('0x18')](_0x419a24['query'][_0xc725('0x18')]);_0x5c9e64['offset']=qs['offset'](_0x419a24['query'][_0xc725('0x15')]);}_0x5c9e64[_0xc725('0x2e')]=qs[_0xc725('0x2f')](_0x419a24[_0xc725('0x28')][_0xc725('0x2f')]);_0x5c9e64[_0xc725('0x30')]=qs[_0xc725('0x29')](_[_0xc725('0x31')](_0x419a24[_0xc725('0x28')],_0x2fba7b[_0xc725('0x29')]),_0x2ecde2);if(_0x419a24[_0xc725('0x28')]['filter']){_0x5c9e64[_0xc725('0x30')]=_[_0xc725('0x32')](_0x5c9e64[_0xc725('0x30')],{'$or':_['map'](_0x2ecde2,function(_0x1a7a30){if(_0x1a7a30[_0xc725('0x24')]!==_0xc725('0x33')){var _0x24da9e={};_0x24da9e[_0x1a7a30[_0xc725('0x1f')]]={'$like':'%'+_0x419a24[_0xc725('0x28')][_0xc725('0x34')]+'%'};return _0x24da9e;}})});}_0x5c9e64=_[_0xc725('0x32')]({},_0x5c9e64,_0x419a24[_0xc725('0x35')]);var _0x48a65b={'where':_0x5c9e64[_0xc725('0x30')]};return db[_0xc725('0x22')][_0xc725('0x17')](_0x48a65b)[_0xc725('0x8')](function(_0x16f264){_0x4d6645['count']=_0x16f264;if(_0x419a24['query'][_0xc725('0x36')]){_0x5c9e64['include']=[{'all':!![]}];}return db[_0xc725('0x22')]['findAll'](_0x5c9e64);})[_0xc725('0x8')](function(_0x862fb9){_0x4d6645['rows']=_0x862fb9;return _0x4d6645;})['then'](respondWithFilteredResult(_0x1125fe,_0x5c9e64))[_0xc725('0x12')](handleError(_0x1125fe,null));};exports['show']=function(_0x4c9d97,_0x2f03c8){var _0x334af9={'raw':!![],'where':{'id':_0x4c9d97[_0xc725('0x37')]['id']}},_0x51fc47={};_0x51fc47[_0xc725('0x25')]=_[_0xc725('0x27')](db['Network'][_0xc725('0x38')]);_0x51fc47[_0xc725('0x28')]=_[_0xc725('0x27')](_0x4c9d97[_0xc725('0x28')]);_0x51fc47[_0xc725('0x29')]=_[_0xc725('0x2a')](_0x51fc47['model'],_0x51fc47['query']);_0x334af9[_0xc725('0x2b')]=_['intersection'](_0x51fc47[_0xc725('0x25')],qs[_0xc725('0x2c')](_0x4c9d97[_0xc725('0x28')][_0xc725('0x2c')]));_0x334af9[_0xc725('0x2b')]=_0x334af9['attributes'][_0xc725('0x39')]?_0x334af9[_0xc725('0x2b')]:_0x51fc47[_0xc725('0x25')];if(_0x4c9d97['query'][_0xc725('0x36')]){_0x334af9[_0xc725('0x3a')]=[{'all':!![]}];}_0x334af9=_[_0xc725('0x32')]({},_0x334af9,_0x4c9d97['options']);return db['Network'][_0xc725('0x3b')](_0x334af9)['then'](handleEntityNotFound(_0x2f03c8,null))[_0xc725('0x8')](respondWithResult(_0x2f03c8,null))[_0xc725('0x12')](handleError(_0x2f03c8,null));};exports[_0xc725('0x3c')]=function(_0x34bae6,_0x37731a){var _0x377b3;return db[_0xc725('0x22')]['create'](_0x34bae6[_0xc725('0x3d')],{'raw':!![]})['then'](function(_0x1788a1){_0x377b3=_0x1788a1;return db[_0xc725('0x22')][_0xc725('0x3e')]({'where':{'type':_0x34bae6[_0xc725('0x3d')][_0xc725('0x24')]},'raw':!![]});})['then'](function(_0x53f03f){if(_0x377b3[_0xc725('0x24')][_0xc725('0x3f')]()==_0xc725('0x40')){var _0x38a496=fs[_0xc725('0x41')](path[_0xc725('0x42')](config[_0xc725('0x43')],_0xc725('0x44')),_0xc725('0x45'));var _0x41b9a9=ejs[_0xc725('0x46')](_0x38a496,{'networks':_0x53f03f||[]});fs['writeFileSync'](_0xc725('0x47'),_0x41b9a9);return respondWithRpcPromise(_0xc725('0x48'),'create',{'module':'res_stun_monitor.so'});}else if(_0x377b3[_0xc725('0x24')][_0xc725('0x3f')]()==_0xc725('0x49')){var _0x15d35f=fs['readFileSync'](path[_0xc725('0x42')](config['root'],_0xc725('0x4a')),_0xc725('0x45'));var _0x19941f=ejs[_0xc725('0x46')](_0x15d35f,{'networks':_0x53f03f||[]});fs['writeFileSync'](_0xc725('0x4b'),_0x19941f);return respondWithRpcPromise(_0xc725('0x48'),_0xc725('0x3c'),{'module':_0xc725('0x4c')});}else{var _0x1fb235=fs[_0xc725('0x41')](path[_0xc725('0x42')](config[_0xc725('0x43')],_0xc725('0x4d')),_0xc725('0x45'));var _0x26cee4=ejs['render'](_0x1fb235,{'networks':_0x53f03f||[]});fs[_0xc725('0x4e')](util[_0xc725('0x4f')](_0xc725('0x50'),_0x34bae6[_0xc725('0x3d')][_0xc725('0x24')][_0xc725('0x51')]()),_0x26cee4);return respondWithRpcPromise(_0xc725('0x48'),'create',{'module':_0xc725('0x52')});}})[_0xc725('0x8')](function(){return _0x377b3;})[_0xc725('0x8')](respondWithResult(_0x37731a,0xc9))[_0xc725('0x12')](handleError(_0x37731a,null));};exports['update']=function(_0x55e2c9,_0x48c4f8){var _0x44538b;return db[_0xc725('0x22')][_0xc725('0x3b')]({'where':{'id':_0x55e2c9['params']['id']}})[_0xc725('0x8')](handleEntityNotFound(_0x48c4f8,null))['then'](saveUpdates(_0x55e2c9[_0xc725('0x3d')],null))[_0xc725('0x8')](function(_0x3698c9){if(_0x3698c9){_0x44538b=_0x3698c9;return db[_0xc725('0x22')][_0xc725('0x3e')]({'where':{'type':_0x44538b[_0xc725('0x24')]},'raw':!![]});}return null;})['then'](function(_0x1b70ab){if(_0x44538b[_0xc725('0x24')]['toUpperCase']()==_0xc725('0x40')){var _0x3bfa75=fs[_0xc725('0x41')](path['join'](config['root'],_0xc725('0x44')),_0xc725('0x45'));var _0x32ef57=ejs[_0xc725('0x46')](_0x3bfa75,{'networks':_0x1b70ab||[]});fs[_0xc725('0x4e')](_0xc725('0x47'),_0x32ef57);return respondWithRpcPromise(_0xc725('0x48'),'update',{'module':_0xc725('0x4c')});}else if(_0x44538b['type'][_0xc725('0x3f')]()==_0xc725('0x49')){var _0xad2538=fs[_0xc725('0x41')](path['join'](config[_0xc725('0x43')],_0xc725('0x4a')),_0xc725('0x45'));var _0x11d74a=ejs[_0xc725('0x46')](_0xad2538,{'networks':_0x1b70ab||[]});fs[_0xc725('0x4e')]('/etc/asterisk/turn_xcally.conf',_0x11d74a);return respondWithRpcPromise(_0xc725('0x48'),_0xc725('0x1b'),{'module':_0xc725('0x4c')});}else{var _0xa1340c=fs[_0xc725('0x41')](path['join'](config[_0xc725('0x43')],_0xc725('0x4d')),_0xc725('0x45'));var _0x54c6a7=ejs['render'](_0xa1340c,{'networks':_0x1b70ab||[]});fs[_0xc725('0x4e')](util[_0xc725('0x4f')](_0xc725('0x50'),_0x55e2c9[_0xc725('0x3d')][_0xc725('0x24')]['toLowerCase']()),_0x54c6a7);return respondWithRpcPromise(_0xc725('0x48'),_0xc725('0x1b'),{'module':'chan_sip.so'});}})[_0xc725('0x8')](function(_0x49ba58){if(_0x49ba58){return _0x44538b;}return null;})[_0xc725('0x8')](respondWithResult(_0x48c4f8,null))[_0xc725('0x12')](handleError(_0x48c4f8,null));};exports[_0xc725('0x1c')]=function(_0x28ef8e,_0x8dbc96){var _0x2476d3;return db[_0xc725('0x22')][_0xc725('0x3b')]({'where':{'id':_0x28ef8e[_0xc725('0x37')]['id']}})[_0xc725('0x8')](function(_0x1bc119){_0x2476d3=_0x1bc119;return _0x1bc119;})[_0xc725('0x8')](handleEntityNotFound(_0x8dbc96,null))[_0xc725('0x8')](removeEntity(_0x8dbc96,null))[_0xc725('0x8')](function(){if(_0x2476d3){return db[_0xc725('0x22')][_0xc725('0x3e')]({'where':{'type':_0x2476d3['type']},'raw':!![]});}})['then'](function(_0x262ed1){if(_0x2476d3[_0xc725('0x24')][_0xc725('0x3f')]()==_0xc725('0x40')){var _0x4546c7=fs[_0xc725('0x41')](path['join'](config[_0xc725('0x43')],_0xc725('0x44')),_0xc725('0x45'));var _0x3c597e=ejs[_0xc725('0x46')](_0x4546c7,{'networks':_0x262ed1||[]});fs[_0xc725('0x4e')]('/etc/asterisk/stun_xcally.conf',_0x3c597e);return respondWithRpcPromise('Reload',_0xc725('0x1c'),{'module':_0xc725('0x4c')});}else if(_0x2476d3[_0xc725('0x24')][_0xc725('0x3f')]()==_0xc725('0x49')){var _0x45e4d9=fs[_0xc725('0x41')](path['join'](config[_0xc725('0x43')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x1bd719=ejs[_0xc725('0x46')](_0x45e4d9,{'networks':_0x262ed1||[]});fs[_0xc725('0x4e')]('/etc/asterisk/turn_xcally.conf',_0x1bd719);return respondWithRpcPromise('Reload',_0xc725('0x1c'),{'module':_0xc725('0x4c')});}else{var _0x289dea=fs[_0xc725('0x41')](path['join'](config[_0xc725('0x43')],_0xc725('0x4d')),_0xc725('0x45'));var _0x442c1e=ejs[_0xc725('0x46')](_0x289dea,{'networks':_0x262ed1||[]});fs['writeFileSync'](util['format'](_0xc725('0x50'),_0x2476d3[_0xc725('0x24')][_0xc725('0x51')]()),_0x442c1e);return respondWithRpcPromise(_0xc725('0x48'),_0xc725('0x1c'),{'module':'chan_sip.so'});}})[_0xc725('0x12')](handleError(_0x8dbc96,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index e2c91ac..a65d764 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 _0x8cc8=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','exports','Network','network','lodash','util','../../config/logger'];(function(_0x252700,_0x5e80ec){var _0x5c4844=function(_0x371874){while(--_0x371874){_0x252700['push'](_0x252700['shift']());}};_0x5c4844(++_0x5e80ec);}(_0x8cc8,0x177));var _0x88cc=function(_0x16c9fc,_0x41195b){_0x16c9fc=_0x16c9fc-0x0;var _0xdfdba1=_0x8cc8[_0x16c9fc];return _0xdfdba1;};'use strict';var _=require(_0x88cc('0x0'));var util=require(_0x88cc('0x1'));var logger=require(_0x88cc('0x2'))(_0x88cc('0x3'));var moment=require(_0x88cc('0x4'));var BPromise=require(_0x88cc('0x5'));var rp=require(_0x88cc('0x6'));var fs=require('fs');var path=require(_0x88cc('0x7'));var rimraf=require(_0x88cc('0x8'));var config=require(_0x88cc('0x9'));var attributes=require(_0x88cc('0xa'));module[_0x88cc('0xb')]=function(_0x1683f9,_0x525362){return _0x1683f9['define'](_0x88cc('0xc'),attributes,{'tableName':_0x88cc('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2bc6=['./network.attributes','define','Network','network','lodash','util','../../config/logger','path','../../config/environment'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x2bc6,0x163));var _0x62bc=function(_0x5378bb,_0xdbe6c2){_0x5378bb=_0x5378bb-0x0;var _0x32dc23=_0x2bc6[_0x5378bb];return _0x32dc23;};'use strict';var _=require(_0x62bc('0x0'));var util=require(_0x62bc('0x1'));var logger=require(_0x62bc('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x62bc('0x3'));var rimraf=require('rimraf');var config=require(_0x62bc('0x4'));var attributes=require(_0x62bc('0x5'));module['exports']=function(_0x3cce26,_0x450cb6){return _0x3cce26[_0x62bc('0x6')](_0x62bc('0x7'),attributes,{'tableName':_0x62bc('0x8'),'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 62d7f47..2be9d73 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(_0x36d57f,_0x2f9118){var _0x3f93fb=function(_0x567b58){while(--_0x567b58){_0x36d57f['push'](_0x36d57f['shift']());}};_0x3f93fb(++_0x2f9118);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x1da3cc,_0x51dc9c){_0x1da3cc=_0x1da3cc-0x0;var _0x369b6b=_0x7a54[_0x1da3cc];return _0x369b6b;};'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 08c02c2..40c3f9d 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 _0xbbbc=['fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','getInteractions','getAgents','post','/:id/dispositions','addDisposition','/:id/notify','notify','addApplications','/:id/users','addAgents','/:id/send','send','put','update','delete','destroy','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router'];(function(_0x91c27d,_0x453090){var _0x22f9a2=function(_0x3be5d1){while(--_0x3be5d1){_0x91c27d['push'](_0x91c27d['shift']());}};_0x22f9a2(++_0x453090);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x6fd730,_0x3b1344){_0x6fd730=_0x6fd730-0x0;var _0x2cb7d7=_0xbbbc[_0x6fd730];return _0x2cb7d7;};'use strict';var multer=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var path=require(_0xcbbb('0x2'));var timeout=require(_0xcbbb('0x3'));var express=require(_0xcbbb('0x4'));var router=express[_0xcbbb('0x5')]();var fs_extra=require(_0xcbbb('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xcbbb('0x7'));var config=require(_0xcbbb('0x8'));var controller=require(_0xcbbb('0x9'));router[_0xcbbb('0xa')]('/',auth[_0xcbbb('0xb')](),controller['index']);router[_0xcbbb('0xa')](_0xcbbb('0xc'),auth[_0xcbbb('0xb')](),controller[_0xcbbb('0xd')]);router[_0xcbbb('0xa')](_0xcbbb('0xe'),auth[_0xcbbb('0xb')](),controller['show']);router[_0xcbbb('0xa')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xcbbb('0xf')]);router['get'](_0xcbbb('0x10'),auth['isAuthenticated'](),controller[_0xcbbb('0x11')]);router[_0xcbbb('0xa')]('/:id/applications',auth[_0xcbbb('0xb')](),controller['getApplications']);router[_0xcbbb('0xa')]('/:id/interactions',auth[_0xcbbb('0xb')](),controller[_0xcbbb('0x12')]);router[_0xcbbb('0xa')]('/:id/users',auth[_0xcbbb('0xb')](),controller[_0xcbbb('0x13')]);router[_0xcbbb('0x14')]('/',auth[_0xcbbb('0xb')](),controller['create']);router['post'](_0xcbbb('0x15'),auth[_0xcbbb('0xb')](),controller[_0xcbbb('0x16')]);router[_0xcbbb('0x14')]('/:id/canned_answers',auth[_0xcbbb('0xb')](),controller['addAnswer']);router[_0xcbbb('0x14')](_0xcbbb('0x17'),controller[_0xcbbb('0x18')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xcbbb('0x19')]);router[_0xcbbb('0x14')](_0xcbbb('0x1a'),auth[_0xcbbb('0xb')](),controller[_0xcbbb('0x1b')]);router[_0xcbbb('0x14')](_0xcbbb('0x1c'),auth[_0xcbbb('0xb')](),controller[_0xcbbb('0x1d')]);router[_0xcbbb('0x1e')]('/:id',auth[_0xcbbb('0xb')](),controller[_0xcbbb('0x1f')]);router[_0xcbbb('0x20')](_0xcbbb('0xe'),auth[_0xcbbb('0xb')](),controller[_0xcbbb('0x21')]);router[_0xcbbb('0x20')](_0xcbbb('0x15'),auth[_0xcbbb('0xb')](),controller['removeDispositions']);router[_0xcbbb('0x20')](_0xcbbb('0x10'),auth['isAuthenticated'](),controller[_0xcbbb('0x22')]);router['delete']('/:id/users',auth[_0xcbbb('0xb')](),controller[_0xcbbb('0x23')]);module['exports']=router; \ No newline at end of file +var _0xa456=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id/dispositions','getDispositions','getAnswers','/:id/interactions','getInteractions','getAgents','post','create','addAnswer','notify','/:id/applications','/:id/users','/:id/send','send','put','/:id','update','destroy','delete','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','multer','util'];(function(_0x44e00a,_0x248bbc){var _0x2bdfba=function(_0x5e66c4){while(--_0x5e66c4){_0x44e00a['push'](_0x44e00a['shift']());}};_0x2bdfba(++_0x248bbc);}(_0xa456,0x142));var _0x6a45=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xa456[_0x344a3f];return _0x264712;};'use strict';var multer=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var path=require(_0x6a45('0x2'));var timeout=require(_0x6a45('0x3'));var express=require('express');var router=express[_0x6a45('0x4')]();var fs_extra=require(_0x6a45('0x5'));var auth=require(_0x6a45('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6a45('0x7'));var controller=require(_0x6a45('0x8'));router[_0x6a45('0x9')]('/',auth[_0x6a45('0xa')](),controller['index']);router[_0x6a45('0x9')](_0x6a45('0xb'),auth[_0x6a45('0xa')](),controller[_0x6a45('0xc')]);router[_0x6a45('0x9')]('/:id',auth[_0x6a45('0xa')](),controller['show']);router[_0x6a45('0x9')](_0x6a45('0xd'),auth[_0x6a45('0xa')](),controller[_0x6a45('0xe')]);router[_0x6a45('0x9')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x6a45('0xf')]);router[_0x6a45('0x9')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0x6a45('0x9')](_0x6a45('0x10'),auth[_0x6a45('0xa')](),controller[_0x6a45('0x11')]);router[_0x6a45('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x6a45('0x12')]);router[_0x6a45('0x13')]('/',auth['isAuthenticated'](),controller[_0x6a45('0x14')]);router[_0x6a45('0x13')](_0x6a45('0xd'),auth[_0x6a45('0xa')](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0x6a45('0xa')](),controller[_0x6a45('0x15')]);router[_0x6a45('0x13')]('/:id/notify',controller[_0x6a45('0x16')]);router[_0x6a45('0x13')](_0x6a45('0x17'),auth['isAuthenticated'](),controller['addApplications']);router['post'](_0x6a45('0x18'),auth[_0x6a45('0xa')](),controller['addAgents']);router[_0x6a45('0x13')](_0x6a45('0x19'),auth['isAuthenticated'](),controller[_0x6a45('0x1a')]);router[_0x6a45('0x1b')](_0x6a45('0x1c'),auth[_0x6a45('0xa')](),controller[_0x6a45('0x1d')]);router['delete']('/:id',auth[_0x6a45('0xa')](),controller[_0x6a45('0x1e')]);router[_0x6a45('0x1f')](_0x6a45('0xd'),auth[_0x6a45('0xa')](),controller[_0x6a45('0x20')]);router[_0x6a45('0x1f')](_0x6a45('0x21'),auth[_0x6a45('0xa')](),controller[_0x6a45('0x22')]);router[_0x6a45('0x1f')](_0x6a45('0x18'),auth['isAuthenticated'](),controller[_0x6a45('0x23')]);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 43813d7..8983f4d 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 _0x6522=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate'];(function(_0x5057c5,_0x15a845){var _0x335404=function(_0x512876){while(--_0x512876){_0x5057c5['push'](_0x5057c5['shift']());}};_0x335404(++_0x15a845);}(_0x6522,0xa3));var _0x2652=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6522[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x2652('0x0'));var rs=require(_0x2652('0x1'));module[_0x2652('0x2')]={'name':{'type':Sequelize[_0x2652('0x3')],'unique':_0x2652('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x2652('0x3')],'defaultValue':function(){return rs[_0x2652('0x5')]();}},'replyUri':{'type':Sequelize[_0x2652('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x2652('0x6');}},'notificationSound':{'type':Sequelize[_0x2652('0x7')],'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['STRING']},'queueTransfer':{'type':Sequelize[_0x2652('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2652('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2652('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2652('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2652('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x2652('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x2652('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2eec07){if(!_0x2eec07)this[_0x2652('0xa')](_0x2652('0xb'),null);this[_0x2652('0xa')](_0x2652('0xc'),_0x2eec07);}}}; \ No newline at end of file +var _0x178c=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING','generate','TEXT','BOOLEAN'];(function(_0x51dbf7,_0x447e4f){var _0x31c608=function(_0x1aba44){while(--_0x1aba44){_0x51dbf7['push'](_0x51dbf7['shift']());}};_0x31c608(++_0x447e4f);}(_0x178c,0x9f));var _0xc178=function(_0x4ee3d0,_0x329d19){_0x4ee3d0=_0x4ee3d0-0x0;var _0xe66e40=_0x178c[_0x4ee3d0];return _0xe66e40;};'use strict';var Sequelize=require(_0xc178('0x0'));var rs=require(_0xc178('0x1'));module['exports']={'name':{'type':Sequelize[_0xc178('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xc178('0x2')]},'token':{'type':Sequelize[_0xc178('0x2')],'defaultValue':function(){return rs[_0xc178('0x3')]();}},'replyUri':{'type':Sequelize[_0xc178('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xc178('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xc178('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc178('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc178('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xc178('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0xc178('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc178('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc178('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc178('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xc178('0x5')],'defaultValue':![],'comment':_0xc178('0x7'),'set':function(_0x21bb36){if(!_0x21bb36)this['setDataValue'](_0xc178('0x8'),null);this[_0xc178('0x9')](_0xc178('0xa'),_0x21bb36);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 66514b6..838bafb 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 _0x3fa4=['lastName','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','User','UserId','unshift','agent','queueId','OpenchannelQueue','waitForTheAssignedQueue','Start','startRouting','EventManager','notify','sequelize','transaction','Transaction','ISOLATION_LEVELS','findAndCountAll','priority','finally','send','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','addAgents','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','client','http','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','OpenchannelAccounts','then','stack','name','index','Pause','mandatoryDispositionPause','fieldName','key','model','map','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','OpenchannelAccount','includeAll','include','findAll','show','params','rawAttributes','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','pick','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','openchannel','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','list','orderBy','applications','asc','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3fa4,0xf0));var _0x43fa=function(_0x189afb,_0xd441ae){_0x189afb=_0x189afb-0x0;var _0x3b63b7=_0x3fa4[_0x189afb];return _0x3b63b7;};'use strict';var emlformat=require(_0x43fa('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x43fa('0x1'));var moment=require(_0x43fa('0x2'));var BPromise=require(_0x43fa('0x3'));var Mustache=require(_0x43fa('0x4'));var util=require(_0x43fa('0x5'));var path=require(_0x43fa('0x6'));var sox=require(_0x43fa('0x7'));var csv=require('to-csv');var ejs=require(_0x43fa('0x8'));var fs=require('fs');var fs_extra=require(_0x43fa('0x9'));var _=require(_0x43fa('0xa'));var squel=require('squel');var crypto=require(_0x43fa('0xb'));var jsforce=require(_0x43fa('0xc'));var deskjs=require(_0x43fa('0xd'));var toCsv=require('to-csv');var querystring=require(_0x43fa('0xe'));var Papa=require(_0x43fa('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43fa('0x10'));var as=require(_0x43fa('0x11'));var hardwareService=require(_0x43fa('0x12'));var logger=require(_0x43fa('0x13'))(_0x43fa('0x14'));var utils=require('../../config/utils');var config=require(_0x43fa('0x15'));var licenseUtil=require(_0x43fa('0x16'));var db=require(_0x43fa('0x17'))['db'];config['redis']=_[_0x43fa('0x18')](config[_0x43fa('0x19')],{'host':_0x43fa('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x43fa('0x19')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x43fa('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x43fa('0x1b')][_0x43fa('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4a07b5,_0x27b87f,_0xf421b2,_0x32ac9c){return new BPromise(function(_0x2439d4,_0x2c68e0){var _0x53c04c=_0x32ac9c||client;return _0x53c04c['request'](_0x4a07b5,_0xf421b2)['then'](function(_0x1c98bb){logger[_0x43fa('0x1d')](_0x43fa('0x1e'),_0x27b87f,_0x43fa('0x1f'));logger[_0x43fa('0x20')](_0x43fa('0x21'),_0x27b87f,_0x43fa('0x1f'),JSON[_0x43fa('0x22')](_0x1c98bb));if(_0x1c98bb[_0x43fa('0x23')]){if(_0x1c98bb['error'][_0x43fa('0x24')]===0x1f4){logger[_0x43fa('0x23')](_0x43fa('0x1e'),_0x27b87f,_0x1c98bb[_0x43fa('0x23')][_0x43fa('0x25')]);return _0x2c68e0(_0x1c98bb['error'][_0x43fa('0x25')]);}logger[_0x43fa('0x23')](_0x43fa('0x1e'),_0x27b87f,_0x1c98bb[_0x43fa('0x23')][_0x43fa('0x25')]);return _0x2439d4(_0x1c98bb[_0x43fa('0x23')][_0x43fa('0x25')]);}else{logger[_0x43fa('0x1d')](_0x43fa('0x1e'),_0x27b87f,'request\x20sent');_0x2439d4(_0x1c98bb['result'][_0x43fa('0x25')]);}})[_0x43fa('0x26')](function(_0x28f695){logger[_0x43fa('0x23')](_0x43fa('0x1e'),_0x27b87f,_0x28f695);_0x2c68e0(_0x28f695);});});}function respondWithStatusCode(_0x243dda,_0x5014fb){_0x5014fb=_0x5014fb||0xcc;return function(_0x4f6101){if(_0x4f6101){return _0x243dda[_0x43fa('0x27')](_0x5014fb);}return _0x243dda[_0x43fa('0x28')](_0x5014fb)[_0x43fa('0x29')]();};}function respondWithResult(_0x4d88b1,_0x573261){_0x573261=_0x573261||0xc8;return function(_0x11b998){if(_0x11b998){return _0x4d88b1[_0x43fa('0x28')](_0x573261)[_0x43fa('0x2a')](_0x11b998);}};}function respondWithFilteredResult(_0x186249,_0x4d6c8c){return function(_0x3d5abd){if(_0x3d5abd){var _0x44fdef=typeof _0x4d6c8c[_0x43fa('0x2b')]===_0x43fa('0x2c')&&typeof _0x4d6c8c[_0x43fa('0x2d')]===_0x43fa('0x2c');var _0x2c3acd=_0x3d5abd[_0x43fa('0x2e')];var _0xd383ff=_0x44fdef?0x0:_0x4d6c8c[_0x43fa('0x2b')];var _0x3ef547=_0x44fdef?_0x3d5abd[_0x43fa('0x2e')]:_0x4d6c8c['offset']+_0x4d6c8c['limit'];var _0x2791a0;if(_0x3ef547>=_0x2c3acd){_0x3ef547=_0x2c3acd;_0x2791a0=0xc8;}else{_0x2791a0=0xce;}_0x186249[_0x43fa('0x28')](_0x2791a0);return _0x186249[_0x43fa('0x2f')](_0x43fa('0x30'),_0xd383ff+'-'+_0x3ef547+'/'+_0x2c3acd)['json'](_0x3d5abd);}return null;};}function patchUpdates(_0xd8db16){return function(_0x1ab736){try{jsonpatch[_0x43fa('0x31')](_0x1ab736,_0xd8db16,!![]);}catch(_0x5c9413){return BPromise[_0x43fa('0x32')](_0x5c9413);}return _0x1ab736[_0x43fa('0x33')]();};}function saveUpdates(_0x179c3a,_0x7be71){return function(_0x58919a){if(_0x58919a){return _0x58919a[_0x43fa('0x34')](_0x179c3a)['then'](function(_0x2d1e72){return _0x2d1e72;});}return null;};}function removeEntity(_0x79683a,_0xcdeb70){return function(_0x4e06e0){if(_0x4e06e0){return _0x4e06e0[_0x43fa('0x35')]()['then'](function(){var _0x564dd9=_0x4e06e0[_0x43fa('0x36')]({'plain':!![]});var _0x3fd9c3=_0x43fa('0x37');return db['UserProfileResource'][_0x43fa('0x35')]({'where':{'type':_0x3fd9c3,'resourceId':_0x564dd9['id']}})[_0x43fa('0x38')](function(){return _0x4e06e0;});})[_0x43fa('0x38')](function(){_0x79683a[_0x43fa('0x28')](0xcc)[_0x43fa('0x29')]();});}};}function handleEntityNotFound(_0x5978dd,_0x3daddf){return function(_0x108aca){if(!_0x108aca){_0x5978dd[_0x43fa('0x27')](0x194);}return _0x108aca;};}function handleError(_0x360078,_0x503d9d){_0x503d9d=_0x503d9d||0x1f4;return function(_0x521f7f){logger[_0x43fa('0x23')](_0x521f7f[_0x43fa('0x39')]);if(_0x521f7f[_0x43fa('0x3a')]){delete _0x521f7f[_0x43fa('0x3a')];}_0x360078[_0x43fa('0x28')](_0x503d9d)['send'](_0x521f7f);};}exports[_0x43fa('0x3b')]=function(_0x578688,_0x4cb1bd){var _0x236332={'include':[{'model':db[_0x43fa('0x3c')],'as':_0x43fa('0x3d')}]},_0x59e332={},_0x8ac566={'count':0x0,'rows':[]};var _0x17403c=_['map'](db['OpenchannelAccount']['rawAttributes'],function(_0x20568b){return{'name':_0x20568b[_0x43fa('0x3e')],'type':_0x20568b['type'][_0x43fa('0x3f')]};});_0x59e332[_0x43fa('0x40')]=_[_0x43fa('0x41')](_0x17403c,_0x43fa('0x3a'));_0x59e332['query']=_[_0x43fa('0x42')](_0x578688[_0x43fa('0x43')]);_0x59e332['filters']=_['intersection'](_0x59e332[_0x43fa('0x40')],_0x59e332['query']);_0x236332[_0x43fa('0x44')]=_[_0x43fa('0x45')](_0x59e332['model'],qs[_0x43fa('0x46')](_0x578688['query'][_0x43fa('0x46')]));_0x236332[_0x43fa('0x44')]=_0x236332[_0x43fa('0x44')]['length']?_0x236332[_0x43fa('0x44')]:_0x59e332[_0x43fa('0x40')];if(!_0x578688[_0x43fa('0x43')][_0x43fa('0x47')](_0x43fa('0x48'))){_0x236332[_0x43fa('0x2d')]=qs['limit'](_0x578688[_0x43fa('0x43')]['limit']);_0x236332[_0x43fa('0x2b')]=qs['offset'](_0x578688[_0x43fa('0x43')][_0x43fa('0x2b')]);}_0x236332[_0x43fa('0x49')]=qs[_0x43fa('0x4a')](_0x578688[_0x43fa('0x43')]['sort']);_0x236332[_0x43fa('0x4b')]=qs['filters'](_['pick'](_0x578688['query'],_0x59e332[_0x43fa('0x4c')]),_0x17403c);if(_0x578688[_0x43fa('0x43')][_0x43fa('0x4d')]){_0x236332[_0x43fa('0x4b')]=_[_0x43fa('0x4e')](_0x236332['where'],{'$or':_[_0x43fa('0x41')](_0x17403c,function(_0x1662d5){if(_0x1662d5[_0x43fa('0x4f')]!==_0x43fa('0x50')){var _0x1d1407={};_0x1d1407[_0x1662d5[_0x43fa('0x3a')]]={'$like':'%'+_0x578688[_0x43fa('0x43')][_0x43fa('0x4d')]+'%'};return _0x1d1407;}})});}_0x236332=_[_0x43fa('0x4e')]({},_0x236332,_0x578688[_0x43fa('0x51')]);var _0x1ae6e0={'where':_0x236332['where']};return db[_0x43fa('0x52')][_0x43fa('0x2e')](_0x1ae6e0)['then'](function(_0x44f125){_0x8ac566['count']=_0x44f125;if(_0x578688[_0x43fa('0x43')][_0x43fa('0x53')]){_0x236332[_0x43fa('0x54')]=[{'all':!![]}];}return db[_0x43fa('0x52')][_0x43fa('0x55')](_0x236332);})['then'](function(_0x1bbae4){_0x8ac566['rows']=_0x1bbae4;return _0x8ac566;})[_0x43fa('0x38')](respondWithFilteredResult(_0x4cb1bd,_0x236332))[_0x43fa('0x26')](handleError(_0x4cb1bd,null));};exports[_0x43fa('0x56')]=function(_0x5e05fd,_0x5cbcd9){var _0xc3f7aa={'raw':![],'where':{'id':_0x5e05fd[_0x43fa('0x57')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x5be796={};_0x5be796[_0x43fa('0x40')]=_[_0x43fa('0x42')](db['OpenchannelAccount'][_0x43fa('0x58')]);_0x5be796[_0x43fa('0x43')]=_[_0x43fa('0x42')](_0x5e05fd[_0x43fa('0x43')]);_0x5be796['filters']=_[_0x43fa('0x45')](_0x5be796[_0x43fa('0x40')],_0x5be796[_0x43fa('0x43')]);_0xc3f7aa[_0x43fa('0x44')]=_['intersection'](_0x5be796['model'],qs[_0x43fa('0x46')](_0x5e05fd['query']['fields']));_0xc3f7aa['attributes']=_0xc3f7aa[_0x43fa('0x44')][_0x43fa('0x59')]?_0xc3f7aa[_0x43fa('0x44')]:_0x5be796[_0x43fa('0x40')];if(_0x5e05fd[_0x43fa('0x43')][_0x43fa('0x53')]){_0xc3f7aa[_0x43fa('0x54')]=[{'all':!![]}];}_0xc3f7aa=_['merge']({},_0xc3f7aa,_0x5e05fd[_0x43fa('0x51')]);return db[_0x43fa('0x52')]['find'](_0xc3f7aa)[_0x43fa('0x38')](handleEntityNotFound(_0x5cbcd9,null))['then'](respondWithResult(_0x5cbcd9,null))[_0x43fa('0x26')](handleError(_0x5cbcd9,null));};exports[_0x43fa('0x5a')]=function(_0x3b9de0,_0x41caf9){return db['OpenchannelAccount']['create'](_0x3b9de0[_0x43fa('0x5b')],{})[_0x43fa('0x38')](function(_0x1d74a7){var _0x3ba2e0=_0x3b9de0['user']['get']({'plain':!![]});if(!_0x3ba2e0)throw new Error(_0x43fa('0x5c'));if(_0x3ba2e0['role']===_0x43fa('0x5d')){var _0x23b7c1=_0x1d74a7[_0x43fa('0x36')]({'plain':!![]});var _0x33e439='OpenchannelAccounts';return db['UserProfileSection'][_0x43fa('0x5e')]({'where':{'name':_0x33e439,'userProfileId':_0x3ba2e0['userProfileId']},'raw':!![]})[_0x43fa('0x38')](function(_0x13ade5){if(_0x13ade5&&_0x13ade5[_0x43fa('0x5f')]===0x0){return db[_0x43fa('0x60')][_0x43fa('0x5a')]({'name':_0x23b7c1[_0x43fa('0x3a')],'resourceId':_0x23b7c1['id'],'type':_0x13ade5[_0x43fa('0x3a')],'sectionId':_0x13ade5['id']},{})['then'](function(){return _0x1d74a7;});}else{return _0x1d74a7;}})[_0x43fa('0x26')](function(_0x36a8c6){logger[_0x43fa('0x23')](_0x43fa('0x61'),_0x36a8c6);throw _0x36a8c6;});}return _0x1d74a7;})[_0x43fa('0x38')](respondWithResult(_0x41caf9,0xc9))['catch'](handleError(_0x41caf9,null));};exports[_0x43fa('0x34')]=function(_0x295602,_0x202a29){if(_0x295602[_0x43fa('0x5b')]['id']){delete _0x295602[_0x43fa('0x5b')]['id'];}return db[_0x43fa('0x52')][_0x43fa('0x5e')]({'where':{'id':_0x295602[_0x43fa('0x57')]['id']},'include':[{'model':db[_0x43fa('0x3c')],'as':'mandatoryDispositionPause'}]})[_0x43fa('0x38')](handleEntityNotFound(_0x202a29,null))[_0x43fa('0x38')](saveUpdates(_0x295602[_0x43fa('0x5b')],null))[_0x43fa('0x38')](respondWithResult(_0x202a29,null))[_0x43fa('0x26')](handleError(_0x202a29,null));};exports['destroy']=function(_0x5e1ceb,_0x31f416){return db[_0x43fa('0x52')][_0x43fa('0x5e')]({'where':{'id':_0x5e1ceb[_0x43fa('0x57')]['id']}})[_0x43fa('0x38')](handleEntityNotFound(_0x31f416,null))[_0x43fa('0x38')](removeEntity(_0x31f416,null))[_0x43fa('0x26')](handleError(_0x31f416,null));};exports[_0x43fa('0x62')]=function(_0x29338e,_0x45136b){return db[_0x43fa('0x52')][_0x43fa('0x62')]()[_0x43fa('0x38')](respondWithResult(_0x45136b,null))[_0x43fa('0x26')](handleError(_0x45136b,null));};exports[_0x43fa('0x63')]=function(_0xf33ed3,_0x3cc967,_0xbd04bf){if(_0xf33ed3[_0x43fa('0x5b')]['id']){delete _0xf33ed3[_0x43fa('0x5b')]['id'];}return db[_0x43fa('0x52')][_0x43fa('0x5e')]({'where':{'id':_0xf33ed3['params']['id']}})['then'](handleEntityNotFound(_0x3cc967,null))[_0x43fa('0x38')](function(_0x44e268){if(_0x44e268){_0xf33ed3['body'][_0x43fa('0x64')]=_0x44e268['id'];return db['Disposition'][_0x43fa('0x5a')](_0xf33ed3['body']);}})[_0x43fa('0x38')](respondWithResult(_0x3cc967,null))[_0x43fa('0x26')](handleError(_0x3cc967,null));};exports[_0x43fa('0x65')]=function(_0x149093,_0x61aef,_0x5b4981){var _0x19de6c={'raw':![],'where':{}};var _0x492bc4={};var _0x1ea3a0={'count':0x0,'rows':[]};return db[_0x43fa('0x52')][_0x43fa('0x66')]({'where':{'id':_0x149093[_0x43fa('0x57')]['id']}})[_0x43fa('0x38')](handleEntityNotFound(_0x61aef,null))['then'](function(_0x284beb){if(_0x284beb){_0x492bc4[_0x43fa('0x40')]=_['keys'](db[_0x43fa('0x67')]['rawAttributes']);_0x492bc4[_0x43fa('0x43')]=_[_0x43fa('0x42')](_0x149093['query']);_0x492bc4[_0x43fa('0x4c')]=_[_0x43fa('0x45')](_0x492bc4[_0x43fa('0x40')],_0x492bc4['query']);_0x19de6c['attributes']=_[_0x43fa('0x45')](_0x492bc4[_0x43fa('0x40')],qs[_0x43fa('0x46')](_0x149093[_0x43fa('0x43')]['fields']));_0x19de6c[_0x43fa('0x44')]=_0x19de6c['attributes']['length']?_0x19de6c[_0x43fa('0x44')]:_0x492bc4[_0x43fa('0x40')];if(!_0x149093[_0x43fa('0x43')][_0x43fa('0x47')](_0x43fa('0x48'))){_0x19de6c[_0x43fa('0x2d')]=qs['limit'](_0x149093[_0x43fa('0x43')][_0x43fa('0x2d')]);_0x19de6c[_0x43fa('0x2b')]=qs['offset'](_0x149093[_0x43fa('0x43')][_0x43fa('0x2b')]);}_0x19de6c[_0x43fa('0x49')]=qs['sort'](_0x149093[_0x43fa('0x43')][_0x43fa('0x4a')]);_0x19de6c['where']=qs['filters'](_[_0x43fa('0x68')](_0x149093[_0x43fa('0x43')],_0x492bc4[_0x43fa('0x4c')]));_0x19de6c[_0x43fa('0x4b')][_0x43fa('0x64')]=_0x284beb['id'];if(_0x149093[_0x43fa('0x43')][_0x43fa('0x4d')]){_0x19de6c[_0x43fa('0x4b')]=_[_0x43fa('0x4e')](_0x19de6c[_0x43fa('0x4b')],{'$or':_[_0x43fa('0x41')](_0x19de6c[_0x43fa('0x44')],function(_0x529a1c){var _0x408419={};_0x408419[_0x529a1c]={'$like':'%'+_0x149093[_0x43fa('0x43')][_0x43fa('0x4d')]+'%'};return _0x408419;})});}_0x19de6c=_['merge']({},_0x19de6c,_0x149093[_0x43fa('0x51')]);return db[_0x43fa('0x67')][_0x43fa('0x2e')]({'where':_0x19de6c[_0x43fa('0x4b')]})['then'](function(_0x271487){_0x1ea3a0['count']=_0x271487;if(_0x149093['query']['includeAll']){_0x19de6c[_0x43fa('0x54')]=[{'all':!![]}];}return db['Disposition'][_0x43fa('0x55')](_0x19de6c);})[_0x43fa('0x38')](function(_0x39a0d8){_0x1ea3a0[_0x43fa('0x69')]=_0x39a0d8;return _0x1ea3a0;});}})[_0x43fa('0x38')](respondWithFilteredResult(_0x61aef,_0x19de6c))['catch'](handleError(_0x61aef,null));};exports[_0x43fa('0x6a')]=function(_0x1d28b5,_0x44b968,_0x3c8b6a){return db['OpenchannelAccount']['find']({'where':{'id':_0x1d28b5['params']['id']}})['then'](handleEntityNotFound(_0x44b968,null))[_0x43fa('0x38')](function(_0x830a70){if(_0x830a70){return _0x830a70[_0x43fa('0x6a')](_0x1d28b5['query'][_0x43fa('0x6b')]);}})[_0x43fa('0x38')](respondWithStatusCode(_0x44b968,null))[_0x43fa('0x26')](handleError(_0x44b968,null));};exports[_0x43fa('0x6c')]=function(_0x566fe3,_0x170e69,_0x391111){if(_0x566fe3[_0x43fa('0x5b')]['id']){delete _0x566fe3[_0x43fa('0x5b')]['id'];}return db[_0x43fa('0x52')][_0x43fa('0x5e')]({'where':{'id':_0x566fe3[_0x43fa('0x57')]['id']}})[_0x43fa('0x38')](handleEntityNotFound(_0x170e69,null))['then'](function(_0x4b31b2){if(_0x4b31b2){_0x566fe3[_0x43fa('0x5b')][_0x43fa('0x64')]=_0x4b31b2['id'];return db[_0x43fa('0x6d')]['create'](_0x566fe3[_0x43fa('0x5b')]);}})[_0x43fa('0x38')](respondWithResult(_0x170e69,null))[_0x43fa('0x26')](handleError(_0x170e69,null));};exports['getAnswers']=function(_0x3a3771,_0x78ca4e,_0x25eb3a){var _0x532ff4={'raw':![],'where':{}};var _0x10123f={};var _0x457006={'count':0x0,'rows':[]};return db[_0x43fa('0x52')]['findOne']({'where':{'id':_0x3a3771[_0x43fa('0x57')]['id']}})[_0x43fa('0x38')](handleEntityNotFound(_0x78ca4e,null))['then'](function(_0x733caf){if(_0x733caf){_0x10123f[_0x43fa('0x40')]=_[_0x43fa('0x42')](db['CannedAnswer'][_0x43fa('0x58')]);_0x10123f[_0x43fa('0x43')]=_[_0x43fa('0x42')](_0x3a3771[_0x43fa('0x43')]);_0x10123f[_0x43fa('0x4c')]=_[_0x43fa('0x45')](_0x10123f['model'],_0x10123f[_0x43fa('0x43')]);_0x532ff4[_0x43fa('0x44')]=_[_0x43fa('0x45')](_0x10123f[_0x43fa('0x40')],qs[_0x43fa('0x46')](_0x3a3771[_0x43fa('0x43')][_0x43fa('0x46')]));_0x532ff4[_0x43fa('0x44')]=_0x532ff4['attributes']['length']?_0x532ff4[_0x43fa('0x44')]:_0x10123f[_0x43fa('0x40')];if(!_0x3a3771[_0x43fa('0x43')][_0x43fa('0x47')]('nolimit')){_0x532ff4[_0x43fa('0x2d')]=qs[_0x43fa('0x2d')](_0x3a3771['query'][_0x43fa('0x2d')]);_0x532ff4[_0x43fa('0x2b')]=qs[_0x43fa('0x2b')](_0x3a3771[_0x43fa('0x43')][_0x43fa('0x2b')]);}_0x532ff4['order']=qs[_0x43fa('0x4a')](_0x3a3771[_0x43fa('0x43')][_0x43fa('0x4a')]);_0x532ff4[_0x43fa('0x4b')]=qs[_0x43fa('0x4c')](_[_0x43fa('0x68')](_0x3a3771[_0x43fa('0x43')],_0x10123f[_0x43fa('0x4c')]));_0x532ff4[_0x43fa('0x4b')]['OpenchannelAccountId']=_0x733caf['id'];if(_0x3a3771[_0x43fa('0x43')][_0x43fa('0x4d')]){_0x532ff4[_0x43fa('0x4b')]=_[_0x43fa('0x4e')](_0x532ff4[_0x43fa('0x4b')],{'$or':_[_0x43fa('0x41')](_0x532ff4[_0x43fa('0x44')],function(_0x593df8){var _0x25ade1={};_0x25ade1[_0x593df8]={'$like':'%'+_0x3a3771['query'][_0x43fa('0x4d')]+'%'};return _0x25ade1;})});}_0x532ff4=_[_0x43fa('0x4e')]({},_0x532ff4,_0x3a3771['options']);return db['CannedAnswer'][_0x43fa('0x2e')]({'where':_0x532ff4[_0x43fa('0x4b')]})[_0x43fa('0x38')](function(_0x262aee){_0x457006[_0x43fa('0x2e')]=_0x262aee;if(_0x3a3771[_0x43fa('0x43')][_0x43fa('0x53')]){_0x532ff4[_0x43fa('0x54')]=[{'all':!![]}];}return db['CannedAnswer'][_0x43fa('0x55')](_0x532ff4);})[_0x43fa('0x38')](function(_0x17024c){_0x457006[_0x43fa('0x69')]=_0x17024c;return _0x457006;});}})[_0x43fa('0x38')](respondWithFilteredResult(_0x78ca4e,_0x532ff4))[_0x43fa('0x26')](handleError(_0x78ca4e,null));};exports['removeAnswers']=function(_0x599ae9,_0x5c75b0,_0x14a79d){return db[_0x43fa('0x52')]['find']({'where':{'id':_0x599ae9['params']['id']}})['then'](handleEntityNotFound(_0x5c75b0,null))[_0x43fa('0x38')](function(_0x3ea18b){if(_0x3ea18b){return _0x3ea18b[_0x43fa('0x6e')](_0x599ae9[_0x43fa('0x43')][_0x43fa('0x6b')]);}})[_0x43fa('0x38')](respondWithStatusCode(_0x5c75b0,null))['catch'](handleError(_0x5c75b0,null));};exports['notify']=function(_0x151b1f,_0x122586,_0x1132b3){var _0x17d016={'body':_0x151b1f[_0x43fa('0x5b')],'channel':_0x43fa('0x6f')};var _0x431d41=[];var _0x4ae736=[];var _0x14bc72={};var _0xce2cf6=![];return db[_0x43fa('0x70')][_0x43fa('0x62')]()[_0x43fa('0x38')](function(_0x403aa8){if(!_0x403aa8){throw new db[(_0x43fa('0x71'))][(_0x43fa('0x72'))]('no\x20available\x20attributes');}_0x431d41=_[_0x43fa('0x73')](_[_0x43fa('0x42')](_0x403aa8),[_0x43fa('0x74'),_0x43fa('0x75')]);_0x4ae736=_[_0x43fa('0x73')](_[_0x43fa('0x42')](_0x403aa8),[_0x43fa('0x74'),_0x43fa('0x75'),_0x43fa('0x76'),_0x43fa('0x77')]);if(_0x151b1f[_0x43fa('0x5b')]['id']){delete _0x151b1f['body']['id'];}if(_['isNil'](_0x151b1f[_0x43fa('0x5b')][_0x43fa('0x78')])){throw new db['Sequelize'][(_0x43fa('0x72'))](_0x43fa('0x79'));}if(_[_0x43fa('0x7a')](_0x151b1f['body'][_0x43fa('0x5b')])||_0x151b1f[_0x43fa('0x5b')]['body']===''){throw new db[(_0x43fa('0x71'))]['ValidationError'](_0x43fa('0x7b'));}if(_[_0x43fa('0x7a')](_0x151b1f['body']['mapKey'])){throw new db['Sequelize'][(_0x43fa('0x72'))](_0x43fa('0x7c')+_0x4ae736);}if(!_[_0x43fa('0x7d')](_0x4ae736,_0x151b1f[_0x43fa('0x5b')][_0x43fa('0x7e')])){throw new db[(_0x43fa('0x71'))][(_0x43fa('0x72'))](_0x43fa('0x7f')+_0x4ae736);}_0x14bc72[_0x151b1f[_0x43fa('0x5b')][_0x43fa('0x7e')]]=_0x151b1f['body'][_0x43fa('0x78')];})['then'](function(){return db[_0x43fa('0x52')][_0x43fa('0x5e')]({'where':{'id':_0x151b1f[_0x43fa('0x57')]['id']},'include':[{'model':db[_0x43fa('0x80')],'as':_0x43fa('0x81'),'include':[{'model':db[_0x43fa('0x70')],'as':_0x43fa('0x82'),'where':_0x14bc72,'limit':0x1,'order':[[_0x43fa('0x75'),_0x43fa('0x83')]]}]},{'model':db[_0x43fa('0x84')],'as':_0x43fa('0x85')}]});})['then'](handleEntityNotFound(_0x122586,null))['then'](function(_0x307272){if(_0x307272&&_0x307272[_0x43fa('0x81')]){_0x17d016[_0x43fa('0x86')]=_0x307272;_0x17d016['applications']=_0x307272[_0x43fa('0x85')];_0x17d016[_0x43fa('0x87')]=_0x307272[_0x43fa('0x81')];_0x17d016['applications']=_[_0x43fa('0x88')](_0x17d016[_0x43fa('0x89')],['priority'],[_0x43fa('0x8a')]);if(_0x17d016[_0x43fa('0x86')]['Applications']){delete _0x17d016[_0x43fa('0x86')]['Applications'];}if(_0x17d016[_0x43fa('0x86')][_0x43fa('0x81')]&&_0x17d016[_0x43fa('0x86')][_0x43fa('0x81')]['Contacts']['length']){return _0x17d016[_0x43fa('0x86')][_0x43fa('0x81')][_0x43fa('0x82')][0x0];}var _0x496801=_[_0x43fa('0x18')](_0x151b1f[_0x43fa('0x5b')],{'firstName':_0x151b1f[_0x43fa('0x5b')][_0x43fa('0x78')],'ListId':_0x307272['ListId']});_0x496801[_0x151b1f[_0x43fa('0x5b')][_0x43fa('0x7e')]]=_0x151b1f[_0x43fa('0x5b')][_0x43fa('0x78')];return db['CmContact'][_0x43fa('0x5a')](_0x496801,{'fields':_0x431d41,'raw':!![]});}})[_0x43fa('0x38')](handleEntityNotFound(_0x122586,null))[_0x43fa('0x38')](function(_0x12bc8c){_0x17d016[_0x43fa('0x8b')]=_0x12bc8c;if(_0x12bc8c){var _0xb14e5a={'ContactId':_0x12bc8c['id'],'OpenchannelAccountId':_0x151b1f[_0x43fa('0x57')]['id'],'from':(_0x12bc8c[_0x43fa('0x8c')]||'')+'\x20'+(_0x12bc8c['lastName']||'')};var _0x441412={'OpenchannelAccountId':_0x151b1f[_0x43fa('0x57')]['id'],'closed':![]};if(_0x151b1f[_0x43fa('0x5b')][_0x43fa('0x8d')]){_0x441412[_0x43fa('0x8d')]=_0x151b1f[_0x43fa('0x5b')]['threadId'];return db[_0x43fa('0x8e')]['find']({'where':_0x441412})[_0x43fa('0x38')](function(_0x6be06b){if(_0x6be06b){return[_0x6be06b,![]];}_0xb14e5a[_0x43fa('0x8d')]=_0x151b1f['body'][_0x43fa('0x8d')];_0xb14e5a[_0x43fa('0x8f')]=_0x151b1f['body'][_0x43fa('0x8f')];return db[_0x43fa('0x8e')][_0x43fa('0x5a')](_0xb14e5a)[_0x43fa('0x38')](function(_0x560105){return[_0x560105,!![]];});});}else{_0x441412[_0x43fa('0x8d')]=null;}_0x441412[_0x43fa('0x90')]=_0x12bc8c['id'];return db[_0x43fa('0x8e')]['find']({'where':_0x441412})[_0x43fa('0x38')](function(_0x4f99f1){if(_0x4f99f1){return[_0x4f99f1,![]];}return db[_0x43fa('0x8e')][_0x43fa('0x5a')](_0xb14e5a)[_0x43fa('0x38')](function(_0x2f6ebd){return[_0x2f6ebd,!![]];});});}})[_0x43fa('0x91')](function(_0x41c6c3,_0x518b78){if(_0x41c6c3){_0xce2cf6=_0x518b78;if(!_0x518b78){var _0x4128cb={'from':(_0x17d016[_0x43fa('0x8b')]['firstName']||'')+'\x20'+(_0x17d016[_0x43fa('0x8b')][_0x43fa('0x92')]||'')};if(_0x151b1f[_0x43fa('0x5b')]['threadId']&&_0x151b1f['body'][_0x43fa('0x93')]&&_0x151b1f[_0x43fa('0x5b')][_0x43fa('0x8d')]!=_0x151b1f[_0x43fa('0x5b')][_0x43fa('0x93')]){_0x4128cb['threadId']=_0x151b1f[_0x43fa('0x5b')][_0x43fa('0x93')];}return _0x41c6c3['update'](_0x4128cb);}else{return _0x41c6c3;}}})[_0x43fa('0x38')](function(_0x36a2ee){_0x17d016[_0x43fa('0x94')]=_0x36a2ee[_0x43fa('0x36')]({'plain':!![]});_0x17d016[_0x43fa('0x94')][_0x43fa('0x95')]=_0xce2cf6;if(_0x17d016['interaction']['created']){if(_0x17d016['account'][_0x43fa('0x96')]){_0x17d016[_0x43fa('0x89')][_0x43fa('0x97')]({'id':0x0,'priority':_0x17d016[_0x43fa('0x89')][_0x43fa('0x59')]+0x1,'app':'close','appdata':_0x43fa('0x98'),'interval':_0x43fa('0x99')});}}return db[_0x43fa('0x9a')][_0x43fa('0x5a')]({'body':_0x151b1f[_0x43fa('0x5b')][_0x43fa('0x5b')],'OpenchannelAccountId':_0x151b1f[_0x43fa('0x57')]['id'],'OpenchannelInteractionId':_0x36a2ee['id'],'direction':'in','ContactId':_0x17d016[_0x43fa('0x8b')]['id'],'AttachmentId':_0x151b1f[_0x43fa('0x5b')][_0x43fa('0x9b')]});})[_0x43fa('0x38')](function(_0x341313){_0x17d016['message']=_0x341313;if(!_0x17d016['interaction']['UserId'])return;return db[_0x43fa('0x9c')][_0x43fa('0x5e')]({'attributes':['id',_0x43fa('0x3a')],'where':{'id':_0x17d016[_0x43fa('0x94')][_0x43fa('0x9d')]}});})[_0x43fa('0x38')](function(_0x4fcc50){if(_0x4fcc50){_0x17d016[_0x43fa('0x89')][_0x43fa('0x9e')]({'id':0x0,'priority':0x0,'app':_0x43fa('0x9f'),'appdata':_0x4fcc50[_0x43fa('0x3a')]+','+(_0x17d016['account']['waitForTheAssignedAgent']||0xa),'interval':_0x43fa('0x99')});}if(!_0x17d016[_0x43fa('0x94')][_0x43fa('0xa0')])return;return db[_0x43fa('0xa1')][_0x43fa('0x5e')]({'attributes':['id','name'],'where':{'id':_0x17d016['interaction']['queueId']}});})[_0x43fa('0x38')](function(_0x46564e){if(_0x46564e){_0x17d016['applications'][_0x43fa('0x9e')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x46564e[_0x43fa('0x3a')]+','+(_0x17d016['account'][_0x43fa('0xa2')]||0x12c),'interval':_0x43fa('0x99')});}return respondWithRpcPromise(_0x43fa('0xa3'),_0x43fa('0xa4'),_0x17d016);})['then'](function(_0x388f35){respondWithRpcPromise(_0x43fa('0xa5'),_0x43fa('0xa5'),{'event':_0x43fa('0xa6'),'message':_0x388f35},client9002);return _0x388f35;})[_0x43fa('0x38')](respondWithResult(_0x122586,null))[_0x43fa('0x26')](handleError(_0x122586,null));};exports['addApplications']=function(_0x14fb4d,_0xaf699f){var _0x9aaefd=_0x14fb4d['params']['id'];var _0x2367be=_0x14fb4d[_0x43fa('0x5b')];var _0x114d42=0xc8;var _0x4e6c23=null;return db[_0x43fa('0xa7')][_0x43fa('0xa8')]({'isolationLevel':db[_0x43fa('0xa7')][_0x43fa('0xa9')][_0x43fa('0xaa')]['READ_COMMITTED']},function(_0x115013){return db[_0x43fa('0x52')][_0x43fa('0x66')]({'where':{'id':_0x9aaefd},'transaction':_0x115013})[_0x43fa('0x38')](function(_0x6b8cf0){if(_0x6b8cf0){return db['OpenchannelApplication'][_0x43fa('0x35')]({'where':{'OpenchannelAccountId':_0x9aaefd},'transaction':_0x115013})['then'](function(){var _0x1ea7dc=_['map'](_0x2367be,function(_0x1544a3){_0x1544a3[_0x43fa('0x64')]=_0x9aaefd;return _0x1544a3;});return db[_0x43fa('0x84')]['bulkCreate'](_0x1ea7dc,{'transaction':_0x115013});});}else{_0x114d42=0x194;_0x4e6c23=[];}});})['then'](function(){if(_0x114d42!==0x194){return db[_0x43fa('0x84')][_0x43fa('0xab')]({'where':{'OpenchannelAccountId':_0x9aaefd},'order':_0x43fa('0xac')})[_0x43fa('0x38')](function(_0x7c08c2){_0x4e6c23=_0x7c08c2;});}})[_0x43fa('0x26')](function(_0x51a848){_0x114d42=0x1f4;logger[_0x43fa('0x23')](_0x51a848[_0x43fa('0x39')]);if(_0x51a848[_0x43fa('0x3a')]){delete _0x51a848[_0x43fa('0x3a')];}_0x4e6c23=_0x51a848;})[_0x43fa('0xad')](function(){if(_0x4e6c23===null){_0xaf699f['sendStatus'](_0x114d42);}else{if(_0x114d42===0x1f4){_0xaf699f['status'](_0x114d42)[_0x43fa('0xae')](_0x4e6c23);}else{_0xaf699f[_0x43fa('0x28')](_0x114d42)['json'](_0x4e6c23);}}});};exports[_0x43fa('0xaf')]=function(_0x2d00f0,_0x3e37ed,_0xc363b9){var _0xa25974={};var _0x169c0a={};var _0x3b6af4;var _0x274672;return db[_0x43fa('0x52')][_0x43fa('0x66')]({'where':{'id':_0x2d00f0[_0x43fa('0x57')]['id']}})[_0x43fa('0x38')](handleEntityNotFound(_0x3e37ed,null))[_0x43fa('0x38')](function(_0x56827a){if(_0x56827a){_0x3b6af4=_0x56827a;_0x169c0a[_0x43fa('0x40')]=_[_0x43fa('0x42')](db['OpenchannelApplication'][_0x43fa('0x58')]);_0x169c0a[_0x43fa('0x43')]=_[_0x43fa('0x42')](_0x2d00f0[_0x43fa('0x43')]);_0x169c0a[_0x43fa('0x4c')]=_['intersection'](_0x169c0a[_0x43fa('0x40')],_0x169c0a['query']);_0xa25974['attributes']=_[_0x43fa('0x45')](_0x169c0a[_0x43fa('0x40')],qs['fields'](_0x2d00f0[_0x43fa('0x43')]['fields']));_0xa25974[_0x43fa('0x44')]=_0xa25974[_0x43fa('0x44')]['length']?_0xa25974[_0x43fa('0x44')]:_0x169c0a['model'];_0xa25974[_0x43fa('0x49')]=qs['sort'](_0x2d00f0[_0x43fa('0x43')][_0x43fa('0x4a')]);_0xa25974[_0x43fa('0x4b')]=qs['filters'](_[_0x43fa('0x68')](_0x2d00f0[_0x43fa('0x43')],_0x169c0a[_0x43fa('0x4c')]));if(_0x2d00f0[_0x43fa('0x43')][_0x43fa('0x4d')]){_0xa25974[_0x43fa('0x4b')]=_[_0x43fa('0x4e')](_0xa25974['where'],{'$or':_[_0x43fa('0x41')](_0xa25974[_0x43fa('0x44')],function(_0x553d90){var _0xfc449f={};_0xfc449f[_0x553d90]={'$like':'%'+_0x2d00f0[_0x43fa('0x43')]['filter']+'%'};return _0xfc449f;})});}_0xa25974=_['merge']({},_0xa25974,_0x2d00f0[_0x43fa('0x51')]);return _0x3b6af4['getApplications'](_0xa25974);}})[_0x43fa('0x38')](function(_0x12ce32){if(_0x12ce32){_0x274672=_0x12ce32['length'];if(!_0x2d00f0['query']['hasOwnProperty']('nolimit')){_0xa25974[_0x43fa('0x2d')]=qs[_0x43fa('0x2d')](_0x2d00f0[_0x43fa('0x43')][_0x43fa('0x2d')]);_0xa25974['offset']=qs[_0x43fa('0x2b')](_0x2d00f0[_0x43fa('0x43')][_0x43fa('0x2b')]);}return _0x3b6af4[_0x43fa('0xaf')](_0xa25974);}})[_0x43fa('0x38')](function(_0x5637f9){if(_0x5637f9){return _0x5637f9?{'count':_0x274672,'rows':_0x5637f9}:null;}})[_0x43fa('0x38')](respondWithResult(_0x3e37ed,null))['catch'](handleError(_0x3e37ed,null));};exports[_0x43fa('0xb0')]=function(_0x20babd,_0x181ee4,_0x2698a9){var _0x3994a9={'raw':![],'where':{}};var _0xb0245e={};var _0x24e4fb={'count':0x0,'rows':[]};return db[_0x43fa('0x52')][_0x43fa('0x66')]({'where':{'id':_0x20babd['params']['id']}})[_0x43fa('0x38')](handleEntityNotFound(_0x181ee4,null))[_0x43fa('0x38')](function(_0x342b17){if(_0x342b17){_0xb0245e[_0x43fa('0x40')]=_[_0x43fa('0x42')](db['OpenchannelInteraction'][_0x43fa('0x58')]);_0xb0245e['query']=_[_0x43fa('0x42')](_0x20babd['query']);_0xb0245e['filters']=_[_0x43fa('0x45')](_0xb0245e[_0x43fa('0x40')],_0xb0245e['query']);_0x3994a9[_0x43fa('0x44')]=_[_0x43fa('0x45')](_0xb0245e[_0x43fa('0x40')],qs[_0x43fa('0x46')](_0x20babd[_0x43fa('0x43')][_0x43fa('0x46')]));_0x3994a9[_0x43fa('0x44')]=_0x3994a9[_0x43fa('0x44')][_0x43fa('0x59')]?_0x3994a9[_0x43fa('0x44')]:_0xb0245e['model'];if(!_0x20babd[_0x43fa('0x43')][_0x43fa('0x47')]('nolimit')){_0x3994a9[_0x43fa('0x2d')]=qs[_0x43fa('0x2d')](_0x20babd['query'][_0x43fa('0x2d')]);_0x3994a9['offset']=qs['offset'](_0x20babd['query'][_0x43fa('0x2b')]);}_0x3994a9['order']=qs[_0x43fa('0x4a')](_0x20babd[_0x43fa('0x43')][_0x43fa('0x4a')]);_0x3994a9[_0x43fa('0x4b')]=qs[_0x43fa('0x4c')](_[_0x43fa('0x68')](_0x20babd[_0x43fa('0x43')],_0xb0245e[_0x43fa('0x4c')]));_0x3994a9[_0x43fa('0x4b')]['OpenchannelAccountId']=_0x342b17['id'];if(_0x20babd[_0x43fa('0x43')]['filter']){_0x3994a9[_0x43fa('0x4b')]=_[_0x43fa('0x4e')](_0x3994a9[_0x43fa('0x4b')],{'$or':_[_0x43fa('0x41')](_0x3994a9[_0x43fa('0x44')],function(_0x36bab8){var _0x71591c={};_0x71591c[_0x36bab8]={'$like':'%'+_0x20babd[_0x43fa('0x43')][_0x43fa('0x4d')]+'%'};return _0x71591c;})});}_0x3994a9=_[_0x43fa('0x4e')]({},_0x3994a9,_0x20babd['options']);return db[_0x43fa('0x8e')][_0x43fa('0x2e')]({'where':_0x3994a9[_0x43fa('0x4b')]})[_0x43fa('0x38')](function(_0x2ebc2a){_0x24e4fb[_0x43fa('0x2e')]=_0x2ebc2a;if(_0x20babd[_0x43fa('0x43')][_0x43fa('0x53')]){_0x3994a9[_0x43fa('0x54')]=[{'model':db['CmContact'],'as':_0x43fa('0xb1'),'required':![]},{'model':db['User'],'as':_0x43fa('0xb2'),'attributes':[_0x43fa('0x3a'),_0x43fa('0xb3'),'internal'],'required':![]},{'model':db[_0x43fa('0xb4')],'as':_0x43fa('0xb5'),'attributes':['id','name',_0x43fa('0xb6')],'where':_0x20babd[_0x43fa('0x43')][_0x43fa('0xb7')]?{'id':_0x20babd[_0x43fa('0x43')][_0x43fa('0xb7')]}:undefined,'required':_0x20babd['query'][_0x43fa('0xb7')]?!![]:![]}];}return db[_0x43fa('0x8e')][_0x43fa('0x55')](_0x3994a9);})['then'](function(_0x111ce3){_0x24e4fb[_0x43fa('0x69')]=_0x111ce3;return _0x24e4fb;});}})[_0x43fa('0x38')](respondWithFilteredResult(_0x181ee4,_0x3994a9))[_0x43fa('0x26')](handleError(_0x181ee4,null));};exports[_0x43fa('0xb8')]=function(_0x5c345f,_0x51cc4c,_0x5ec132){return db[_0x43fa('0x52')][_0x43fa('0x5e')]({'where':{'id':_0x5c345f[_0x43fa('0x57')]['id']}})['then'](handleEntityNotFound(_0x51cc4c,null))['then'](function(_0x1268a5){if(_0x1268a5){return _0x1268a5[_0x43fa('0xb8')](_0x5c345f[_0x43fa('0x5b')][_0x43fa('0x6b')],_['omit'](_0x5c345f[_0x43fa('0x5b')],[_0x43fa('0x6b'),'id'])||{})['spread'](function(_0x28996b){for(var _0x5d0b38=0x0;_0x5d0b38<_0x5c345f[_0x43fa('0x5b')]['ids'][_0x43fa('0x59')];_0x5d0b38+=0x1){socket[_0x43fa('0xb9')]('userOpenchannelAccount:save',{'UserId':Number(_0x5c345f['body'][_0x43fa('0x6b')][_0x5d0b38]),'OpenchannelAccountId':Number(_0x5c345f[_0x43fa('0x57')]['id'])});}return _0x28996b;});}})[_0x43fa('0x38')](respondWithResult(_0x51cc4c,null))[_0x43fa('0x26')](handleError(_0x51cc4c,null));};exports[_0x43fa('0xba')]=function(_0x4517e2,_0x1fb67d,_0xfabbc0){return db[_0x43fa('0x52')][_0x43fa('0x5e')]({'where':{'id':_0x4517e2[_0x43fa('0x57')]['id']}})['then'](handleEntityNotFound(_0x1fb67d,null))['then'](function(_0x243c9f){if(_0x243c9f){return _0x243c9f[_0x43fa('0xba')](_0x4517e2[_0x43fa('0x43')][_0x43fa('0x6b')])[_0x43fa('0x38')](function(){if(_[_0x43fa('0xbb')](_0x4517e2[_0x43fa('0x43')][_0x43fa('0x6b')])){for(var _0x172bbd=0x0;_0x172bbd<_0x4517e2['query'][_0x43fa('0x6b')]['length'];_0x172bbd+=0x1){socket['emit'](_0x43fa('0xbc'),{'UserId':Number(_0x4517e2['query'][_0x43fa('0x6b')][_0x172bbd]),'OpenchannelAccountId':Number(_0x4517e2[_0x43fa('0x57')]['id'])});}}else{socket[_0x43fa('0xb9')](_0x43fa('0xbc'),{'UserId':Number(_0x4517e2[_0x43fa('0x43')][_0x43fa('0x6b')]),'OpenchannelAccountId':Number(_0x4517e2[_0x43fa('0x57')]['id'])});}});}})[_0x43fa('0x38')](respondWithStatusCode(_0x1fb67d,null))[_0x43fa('0x26')](handleError(_0x1fb67d,null));};exports[_0x43fa('0xbd')]=function(_0x5ae5c1,_0x94ac58,_0x235f0e){var _0x3c89f2={};var _0x95c47={};var _0x56a135;var _0x1efd04;return db[_0x43fa('0x52')][_0x43fa('0x66')]({'where':{'id':_0x5ae5c1['params']['id']}})[_0x43fa('0x38')](handleEntityNotFound(_0x94ac58,null))[_0x43fa('0x38')](function(_0x2e5b74){if(_0x2e5b74){_0x56a135=_0x2e5b74;_0x95c47[_0x43fa('0x40')]=_[_0x43fa('0x42')](db[_0x43fa('0x9c')][_0x43fa('0x58')]);_0x95c47[_0x43fa('0x43')]=_[_0x43fa('0x42')](_0x5ae5c1[_0x43fa('0x43')]);_0x95c47[_0x43fa('0x4c')]=_['intersection'](_0x95c47['model'],_0x95c47[_0x43fa('0x43')]);_0x3c89f2[_0x43fa('0x44')]=_[_0x43fa('0x45')](_0x95c47['model'],qs[_0x43fa('0x46')](_0x5ae5c1[_0x43fa('0x43')][_0x43fa('0x46')]));_0x3c89f2['attributes']=_0x3c89f2[_0x43fa('0x44')][_0x43fa('0x59')]?_0x3c89f2[_0x43fa('0x44')]:_0x95c47[_0x43fa('0x40')];_0x3c89f2[_0x43fa('0x49')]=qs['sort'](_0x5ae5c1['query'][_0x43fa('0x4a')]);_0x3c89f2[_0x43fa('0x4b')]=qs[_0x43fa('0x4c')](_['pick'](_0x5ae5c1[_0x43fa('0x43')],_0x95c47[_0x43fa('0x4c')]));if(_0x5ae5c1['query']['filter']){_0x3c89f2[_0x43fa('0x4b')]=_[_0x43fa('0x4e')](_0x3c89f2['where'],{'$or':_['map'](_0x3c89f2[_0x43fa('0x44')],function(_0x4941e5){var _0x1d3b9b={};_0x1d3b9b[_0x4941e5]={'$like':'%'+_0x5ae5c1[_0x43fa('0x43')][_0x43fa('0x4d')]+'%'};return _0x1d3b9b;})});}_0x3c89f2=_[_0x43fa('0x4e')]({},_0x3c89f2,_0x5ae5c1[_0x43fa('0x51')]);return _0x56a135[_0x43fa('0xbd')](_0x3c89f2);}})[_0x43fa('0x38')](function(_0x28e255){if(_0x28e255){_0x1efd04=_0x28e255[_0x43fa('0x59')];if(!_0x5ae5c1[_0x43fa('0x43')]['hasOwnProperty'](_0x43fa('0x48'))){_0x3c89f2[_0x43fa('0x2d')]=qs['limit'](_0x5ae5c1[_0x43fa('0x43')][_0x43fa('0x2d')]);_0x3c89f2[_0x43fa('0x2b')]=qs[_0x43fa('0x2b')](_0x5ae5c1[_0x43fa('0x43')][_0x43fa('0x2b')]);}return _0x56a135[_0x43fa('0xbd')](_0x3c89f2);}})[_0x43fa('0x38')](function(_0x7779a6){if(_0x7779a6){return _0x7779a6?{'count':_0x1efd04,'rows':_0x7779a6}:null;}})[_0x43fa('0x38')](respondWithResult(_0x94ac58,null))[_0x43fa('0x26')](handleError(_0x94ac58,null));};exports['send']=function(_0x4722f8,_0x36762a,_0x59c287){var _0x52f7cd,_0x1facd1,_0x32281c;if(_[_0x43fa('0x7a')](_0x4722f8['body'][_0x43fa('0x5b')])||_0x4722f8[_0x43fa('0x5b')][_0x43fa('0x5b')]===''){throw new db['Sequelize'][(_0x43fa('0x72'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x43fa('0x7a')](_0x4722f8[_0x43fa('0x5b')]['to'])){}_0x52f7cd=_0x4722f8[_0x43fa('0x5b')]['to'];return db[_0x43fa('0x52')]['findOne']({'where':{'id':_0x4722f8[_0x43fa('0x57')]['id']}})['then'](handleEntityNotFound(_0x36762a,null))[_0x43fa('0x38')](function(_0x4aa708){if(_0x4aa708){return db[_0x43fa('0x52')][_0x43fa('0x5e')]({'where':{'id':_0x4aa708['id']},'include':[{'model':db[_0x43fa('0x80')],'as':_0x43fa('0x81'),'include':[{'model':db[_0x43fa('0x70')],'as':_0x43fa('0x82'),'where':{[_0x4aa708[_0x43fa('0x7e')]]:_0x52f7cd},'limit':0x1,'order':[[_0x43fa('0x75'),'DESC']]}]}]})[_0x43fa('0x38')](handleEntityNotFound(_0x36762a,null))[_0x43fa('0x38')](function(_0x3837c1){if(_0x3837c1&&_0x3837c1[_0x43fa('0x81')]){_0x1facd1=_0x3837c1[_0x43fa('0x36')]({'plain':!![]});if(_0x1facd1[_0x43fa('0x81')]&&_0x1facd1[_0x43fa('0x81')][_0x43fa('0x82')][_0x43fa('0x59')]){return _0x1facd1[_0x43fa('0x81')][_0x43fa('0x82')][0x0];}return db['CmContact'][_0x43fa('0x5a')](_[_0x43fa('0x18')](_0x4722f8[_0x43fa('0x5b')],{'firstName':_0x52f7cd,[_0x3837c1[_0x43fa('0x7e')]]:_0x52f7cd,'phone':_0x52f7cd,'ListId':_0x1facd1[_0x43fa('0x77')]}));}})[_0x43fa('0x38')](handleEntityNotFound(_0x36762a,null))[_0x43fa('0x38')](function(_0x2270f0){if(_0x2270f0){_0x32281c=_0x2270f0;return db[_0x43fa('0x8e')][_0x43fa('0x5e')]({'where':{'ContactId':_0x32281c['id'],'closed':![],'OpenchannelAccountId':_0x1facd1['id']}})['then'](function(_0x1001c2){if(_0x1001c2){return[_0x1001c2,![]];}return db['OpenchannelInteraction'][_0x43fa('0x5a')]({'UserId':_0x4722f8[_0x43fa('0x5d')]['id'],'ContactId':_0x32281c['id'],'OpenchannelAccountId':_0x1facd1['id'],'lastMsgDirection':_0x43fa('0xbe'),'firstMsgDirection':_0x43fa('0xbe'),'Messages':[_[_0x43fa('0x4e')](_0x4722f8[_0x43fa('0x5b')],{'read':![],'body':_0x4722f8[_0x43fa('0x5b')]['body'],'OpenchannelAccountId':_0x1facd1['id'],'UserId':_0x4722f8[_0x43fa('0x5d')]['id'],'ContactId':_0x32281c['id']})]},{'include':[{'model':db[_0x43fa('0x9a')],'as':_0x43fa('0xbf')}]})[_0x43fa('0x38')](function(_0x43dd23){return[_0x43dd23,!![]];});});}})['spread'](function(_0x396394,_0x49208c){if(_0x49208c){return _0x396394;}return db[_0x43fa('0x9a')][_0x43fa('0x5a')](_[_0x43fa('0x4e')](_0x4722f8[_0x43fa('0x5b')],{'read':![],'body':_0x4722f8['body'][_0x43fa('0x5b')],'OpenchannelAccountId':_0x1facd1['id'],'OpenchannelInteractionId':_0x396394['id'],'UserId':_0x4722f8[_0x43fa('0x5d')]['id'],'ContactId':_0x32281c['id']}))[_0x43fa('0x38')](function(_0x592ca1){_0x396394[_0x43fa('0xc0')][_0x43fa('0xbf')]=[];_0x396394['dataValues']['Messages'][_0x43fa('0x97')](_0x592ca1[_0x43fa('0xc0')]);return _0x396394;});});}})[_0x43fa('0x38')](respondWithResult(_0x36762a,null))[_0x43fa('0x26')](handleError(_0x36762a,null));}; \ No newline at end of file +var _0x6a83=['getAgents','User','user','out','OpenchannelMessage','dataValues','Messages','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','http','client','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','OpenchannelAccount','includeAll','findAll','rows','catch','show','params','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','openchannel','CmContact','ValidationError','no\x20available\x20attributes','updatedAt','createdAt','CompanyId','ListId','Sequelize','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','list','applications','orderBy','asc','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','messageId','interaction','created','close','unmanaged','AttachmentId','UserId','unshift','agent','*,*,*,*','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','startRouting','EventManager','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','priority','finally','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','emit'];(function(_0x1e8972,_0x12b85d){var _0x353f33=function(_0x16f1da){while(--_0x16f1da){_0x1e8972['push'](_0x1e8972['shift']());}};_0x353f33(++_0x12b85d);}(_0x6a83,0xd2));var _0x36a8=function(_0x2d4f1d,_0x279019){_0x2d4f1d=_0x2d4f1d-0x0;var _0x5f5502=_0x6a83[_0x2d4f1d];return _0x5f5502;};'use strict';var emlformat=require(_0x36a8('0x0'));var rimraf=require(_0x36a8('0x1'));var zipdir=require(_0x36a8('0x2'));var jsonpatch=require(_0x36a8('0x3'));var rp=require(_0x36a8('0x4'));var moment=require(_0x36a8('0x5'));var BPromise=require(_0x36a8('0x6'));var Mustache=require(_0x36a8('0x7'));var util=require(_0x36a8('0x8'));var path=require(_0x36a8('0x9'));var sox=require(_0x36a8('0xa'));var csv=require(_0x36a8('0xb'));var ejs=require(_0x36a8('0xc'));var fs=require('fs');var fs_extra=require(_0x36a8('0xd'));var _=require(_0x36a8('0xe'));var squel=require(_0x36a8('0xf'));var crypto=require(_0x36a8('0x10'));var jsforce=require(_0x36a8('0x11'));var deskjs=require(_0x36a8('0x12'));var toCsv=require('to-csv');var querystring=require(_0x36a8('0x13'));var Papa=require('papaparse');var Redis=require(_0x36a8('0x14'));var authService=require(_0x36a8('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x36a8('0x16'));var hardwareService=require(_0x36a8('0x17'));var logger=require('../../config/logger')(_0x36a8('0x18'));var utils=require(_0x36a8('0x19'));var config=require(_0x36a8('0x1a'));var licenseUtil=require(_0x36a8('0x1b'));var db=require(_0x36a8('0x1c'))['db'];config[_0x36a8('0x1d')]=_[_0x36a8('0x1e')](config[_0x36a8('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0x36a8('0x1f'))(new Redis(config[_0x36a8('0x1d')]));require(_0x36a8('0x20'))[_0x36a8('0x21')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x36a8('0x22')]({'port':0x232c});var client9002=jayson[_0x36a8('0x23')][_0x36a8('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x3fc020,_0x1bf935,_0x237c4d,_0x20f0d2){return new BPromise(function(_0x4840b0,_0x1d600f){var _0x19350a=_0x20f0d2||client;return _0x19350a[_0x36a8('0x24')](_0x3fc020,_0x237c4d)['then'](function(_0x37156f){logger['info'](_0x36a8('0x25'),_0x1bf935,_0x36a8('0x26'));logger[_0x36a8('0x27')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x1bf935,_0x36a8('0x26'),JSON[_0x36a8('0x28')](_0x37156f));if(_0x37156f['error']){if(_0x37156f[_0x36a8('0x29')][_0x36a8('0x2a')]===0x1f4){logger['error'](_0x36a8('0x25'),_0x1bf935,_0x37156f[_0x36a8('0x29')][_0x36a8('0x2b')]);return _0x1d600f(_0x37156f[_0x36a8('0x29')][_0x36a8('0x2b')]);}logger[_0x36a8('0x29')]('OpenchannelAccount,\x20%s,\x20%s',_0x1bf935,_0x37156f[_0x36a8('0x29')][_0x36a8('0x2b')]);return _0x4840b0(_0x37156f['error']['message']);}else{logger['info'](_0x36a8('0x25'),_0x1bf935,_0x36a8('0x26'));_0x4840b0(_0x37156f[_0x36a8('0x2c')][_0x36a8('0x2b')]);}})['catch'](function(_0xf0e6b7){logger['error'](_0x36a8('0x25'),_0x1bf935,_0xf0e6b7);_0x1d600f(_0xf0e6b7);});});}function respondWithStatusCode(_0x5eea15,_0xfd03bf){_0xfd03bf=_0xfd03bf||0xcc;return function(_0x5ea9ae){if(_0x5ea9ae){return _0x5eea15[_0x36a8('0x2d')](_0xfd03bf);}return _0x5eea15[_0x36a8('0x2e')](_0xfd03bf)[_0x36a8('0x2f')]();};}function respondWithResult(_0x2cf72a,_0x27bd18){_0x27bd18=_0x27bd18||0xc8;return function(_0x48db93){if(_0x48db93){return _0x2cf72a[_0x36a8('0x2e')](_0x27bd18)[_0x36a8('0x30')](_0x48db93);}};}function respondWithFilteredResult(_0x2318b7,_0x52217f){return function(_0xa3ac71){if(_0xa3ac71){var _0x2b9b9c=typeof _0x52217f[_0x36a8('0x31')]==='undefined'&&typeof _0x52217f['limit']===_0x36a8('0x32');var _0x70e42c=_0xa3ac71[_0x36a8('0x33')];var _0x8f440a=_0x2b9b9c?0x0:_0x52217f[_0x36a8('0x31')];var _0x174f75=_0x2b9b9c?_0xa3ac71['count']:_0x52217f[_0x36a8('0x31')]+_0x52217f[_0x36a8('0x34')];var _0xaf1e05;if(_0x174f75>=_0x70e42c){_0x174f75=_0x70e42c;_0xaf1e05=0xc8;}else{_0xaf1e05=0xce;}_0x2318b7[_0x36a8('0x2e')](_0xaf1e05);return _0x2318b7[_0x36a8('0x35')](_0x36a8('0x36'),_0x8f440a+'-'+_0x174f75+'/'+_0x70e42c)[_0x36a8('0x30')](_0xa3ac71);}return null;};}function patchUpdates(_0x9682bf){return function(_0x458fb5){try{jsonpatch[_0x36a8('0x37')](_0x458fb5,_0x9682bf,!![]);}catch(_0x24acd5){return BPromise[_0x36a8('0x38')](_0x24acd5);}return _0x458fb5[_0x36a8('0x39')]();};}function saveUpdates(_0x3552c3,_0x20b990){return function(_0x130342){if(_0x130342){return _0x130342[_0x36a8('0x3a')](_0x3552c3)[_0x36a8('0x3b')](function(_0x3f482d){return _0x3f482d;});}return null;};}function removeEntity(_0x4aad01,_0x463d8c){return function(_0x517890){if(_0x517890){return _0x517890[_0x36a8('0x3c')]()['then'](function(){var _0x48fc2e=_0x517890['get']({'plain':!![]});var _0x2fa435='OpenchannelAccounts';return db[_0x36a8('0x3d')]['destroy']({'where':{'type':_0x2fa435,'resourceId':_0x48fc2e['id']}})[_0x36a8('0x3b')](function(){return _0x517890;});})[_0x36a8('0x3b')](function(){_0x4aad01[_0x36a8('0x2e')](0xcc)[_0x36a8('0x2f')]();});}};}function handleEntityNotFound(_0xd06071,_0x5f373f){return function(_0x5427bb){if(!_0x5427bb){_0xd06071[_0x36a8('0x2d')](0x194);}return _0x5427bb;};}function handleError(_0x4639f6,_0x136eb8){_0x136eb8=_0x136eb8||0x1f4;return function(_0x563fab){logger[_0x36a8('0x29')](_0x563fab[_0x36a8('0x3e')]);if(_0x563fab[_0x36a8('0x3f')]){delete _0x563fab[_0x36a8('0x3f')];}_0x4639f6[_0x36a8('0x2e')](_0x136eb8)[_0x36a8('0x40')](_0x563fab);};}exports['index']=function(_0x408f86,_0x2597fc){var _0x133a79={'include':[{'model':db[_0x36a8('0x41')],'as':_0x36a8('0x42')}]},_0x3d7642={},_0x706d00={'count':0x0,'rows':[]};var _0x4d324a=_['map'](db['OpenchannelAccount'][_0x36a8('0x43')],function(_0x3c6328){return{'name':_0x3c6328['fieldName'],'type':_0x3c6328[_0x36a8('0x44')][_0x36a8('0x45')]};});_0x3d7642[_0x36a8('0x46')]=_['map'](_0x4d324a,_0x36a8('0x3f'));_0x3d7642[_0x36a8('0x47')]=_[_0x36a8('0x48')](_0x408f86[_0x36a8('0x47')]);_0x3d7642['filters']=_[_0x36a8('0x49')](_0x3d7642[_0x36a8('0x46')],_0x3d7642[_0x36a8('0x47')]);_0x133a79['attributes']=_[_0x36a8('0x49')](_0x3d7642['model'],qs[_0x36a8('0x4a')](_0x408f86[_0x36a8('0x47')]['fields']));_0x133a79[_0x36a8('0x4b')]=_0x133a79[_0x36a8('0x4b')][_0x36a8('0x4c')]?_0x133a79[_0x36a8('0x4b')]:_0x3d7642[_0x36a8('0x46')];if(!_0x408f86[_0x36a8('0x47')][_0x36a8('0x4d')](_0x36a8('0x4e'))){_0x133a79[_0x36a8('0x34')]=qs['limit'](_0x408f86[_0x36a8('0x47')][_0x36a8('0x34')]);_0x133a79[_0x36a8('0x31')]=qs[_0x36a8('0x31')](_0x408f86[_0x36a8('0x47')][_0x36a8('0x31')]);}_0x133a79[_0x36a8('0x4f')]=qs[_0x36a8('0x50')](_0x408f86['query'][_0x36a8('0x50')]);_0x133a79[_0x36a8('0x51')]=qs[_0x36a8('0x52')](_[_0x36a8('0x53')](_0x408f86[_0x36a8('0x47')],_0x3d7642[_0x36a8('0x52')]),_0x4d324a);if(_0x408f86[_0x36a8('0x47')][_0x36a8('0x54')]){_0x133a79['where']=_[_0x36a8('0x55')](_0x133a79['where'],{'$or':_[_0x36a8('0x56')](_0x4d324a,function(_0x52dec5){if(_0x52dec5[_0x36a8('0x44')]!==_0x36a8('0x57')){var _0x56346f={};_0x56346f[_0x52dec5[_0x36a8('0x3f')]]={'$like':'%'+_0x408f86[_0x36a8('0x47')]['filter']+'%'};return _0x56346f;}})});}_0x133a79=_['merge']({},_0x133a79,_0x408f86[_0x36a8('0x58')]);var _0x595e29={'where':_0x133a79[_0x36a8('0x51')]};return db[_0x36a8('0x59')][_0x36a8('0x33')](_0x595e29)[_0x36a8('0x3b')](function(_0x6940b8){_0x706d00[_0x36a8('0x33')]=_0x6940b8;if(_0x408f86[_0x36a8('0x47')][_0x36a8('0x5a')]){_0x133a79['include']=[{'all':!![]}];}return db['OpenchannelAccount'][_0x36a8('0x5b')](_0x133a79);})[_0x36a8('0x3b')](function(_0x7d6b3c){_0x706d00[_0x36a8('0x5c')]=_0x7d6b3c;return _0x706d00;})[_0x36a8('0x3b')](respondWithFilteredResult(_0x2597fc,_0x133a79))[_0x36a8('0x5d')](handleError(_0x2597fc,null));};exports[_0x36a8('0x5e')]=function(_0xabc5ec,_0x1ebe73){var _0x172d70={'raw':![],'where':{'id':_0xabc5ec[_0x36a8('0x5f')]['id']},'include':[{'model':db[_0x36a8('0x41')],'as':_0x36a8('0x42')}]},_0x28fa5d={};_0x28fa5d['model']=_['keys'](db[_0x36a8('0x59')][_0x36a8('0x43')]);_0x28fa5d[_0x36a8('0x47')]=_['keys'](_0xabc5ec['query']);_0x28fa5d[_0x36a8('0x52')]=_[_0x36a8('0x49')](_0x28fa5d[_0x36a8('0x46')],_0x28fa5d[_0x36a8('0x47')]);_0x172d70[_0x36a8('0x4b')]=_['intersection'](_0x28fa5d[_0x36a8('0x46')],qs[_0x36a8('0x4a')](_0xabc5ec[_0x36a8('0x47')]['fields']));_0x172d70[_0x36a8('0x4b')]=_0x172d70[_0x36a8('0x4b')][_0x36a8('0x4c')]?_0x172d70['attributes']:_0x28fa5d[_0x36a8('0x46')];if(_0xabc5ec['query']['includeAll']){_0x172d70[_0x36a8('0x60')]=[{'all':!![]}];}_0x172d70=_[_0x36a8('0x55')]({},_0x172d70,_0xabc5ec[_0x36a8('0x58')]);return db['OpenchannelAccount'][_0x36a8('0x61')](_0x172d70)[_0x36a8('0x3b')](handleEntityNotFound(_0x1ebe73,null))[_0x36a8('0x3b')](respondWithResult(_0x1ebe73,null))[_0x36a8('0x5d')](handleError(_0x1ebe73,null));};exports['create']=function(_0x2c2ed1,_0x51b0bd){return db['OpenchannelAccount'][_0x36a8('0x62')](_0x2c2ed1[_0x36a8('0x63')],{})[_0x36a8('0x3b')](function(_0x5055c7){var _0x33f894=_0x2c2ed1['user'][_0x36a8('0x64')]({'plain':!![]});if(!_0x33f894)throw new Error(_0x36a8('0x65'));if(_0x33f894[_0x36a8('0x66')]==='user'){var _0x4176c4=_0x5055c7['get']({'plain':!![]});var _0x347be4=_0x36a8('0x67');return db['UserProfileSection'][_0x36a8('0x61')]({'where':{'name':_0x347be4,'userProfileId':_0x33f894[_0x36a8('0x68')]},'raw':!![]})[_0x36a8('0x3b')](function(_0x46e065){if(_0x46e065&&_0x46e065[_0x36a8('0x69')]===0x0){return db[_0x36a8('0x3d')]['create']({'name':_0x4176c4['name'],'resourceId':_0x4176c4['id'],'type':_0x46e065['name'],'sectionId':_0x46e065['id']},{})['then'](function(){return _0x5055c7;});}else{return _0x5055c7;}})[_0x36a8('0x5d')](function(_0x2acb50){logger[_0x36a8('0x29')](_0x36a8('0x6a'),_0x2acb50);throw _0x2acb50;});}return _0x5055c7;})[_0x36a8('0x3b')](respondWithResult(_0x51b0bd,0xc9))[_0x36a8('0x5d')](handleError(_0x51b0bd,null));};exports['update']=function(_0x2f0715,_0x1b65b1){if(_0x2f0715[_0x36a8('0x63')]['id']){delete _0x2f0715['body']['id'];}return db['OpenchannelAccount'][_0x36a8('0x61')]({'where':{'id':_0x2f0715[_0x36a8('0x5f')]['id']},'include':[{'model':db[_0x36a8('0x41')],'as':_0x36a8('0x42')}]})[_0x36a8('0x3b')](handleEntityNotFound(_0x1b65b1,null))['then'](saveUpdates(_0x2f0715['body'],null))['then'](respondWithResult(_0x1b65b1,null))[_0x36a8('0x5d')](handleError(_0x1b65b1,null));};exports[_0x36a8('0x3c')]=function(_0x247b38,_0x4589c9){return db[_0x36a8('0x59')]['find']({'where':{'id':_0x247b38[_0x36a8('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4589c9,null))[_0x36a8('0x3b')](removeEntity(_0x4589c9,null))['catch'](handleError(_0x4589c9,null));};exports[_0x36a8('0x6b')]=function(_0x3a133a,_0x19d4c6){return db['OpenchannelAccount'][_0x36a8('0x6b')]()[_0x36a8('0x3b')](respondWithResult(_0x19d4c6,null))[_0x36a8('0x5d')](handleError(_0x19d4c6,null));};exports[_0x36a8('0x6c')]=function(_0x4e91de,_0x4dd744,_0x2957a9){if(_0x4e91de[_0x36a8('0x63')]['id']){delete _0x4e91de['body']['id'];}return db['OpenchannelAccount'][_0x36a8('0x61')]({'where':{'id':_0x4e91de[_0x36a8('0x5f')]['id']}})[_0x36a8('0x3b')](handleEntityNotFound(_0x4dd744,null))['then'](function(_0x1c4809){if(_0x1c4809){_0x4e91de[_0x36a8('0x63')][_0x36a8('0x6d')]=_0x1c4809['id'];return db[_0x36a8('0x6e')][_0x36a8('0x62')](_0x4e91de['body']);}})[_0x36a8('0x3b')](respondWithResult(_0x4dd744,null))['catch'](handleError(_0x4dd744,null));};exports[_0x36a8('0x6f')]=function(_0x275404,_0x5bbcc4,_0x237418){var _0x2db7c1={'raw':![],'where':{}};var _0x5c9601={};var _0x4c0ce3={'count':0x0,'rows':[]};return db[_0x36a8('0x59')][_0x36a8('0x70')]({'where':{'id':_0x275404[_0x36a8('0x5f')]['id']}})[_0x36a8('0x3b')](handleEntityNotFound(_0x5bbcc4,null))['then'](function(_0x150c78){if(_0x150c78){_0x5c9601[_0x36a8('0x46')]=_['keys'](db[_0x36a8('0x6e')][_0x36a8('0x43')]);_0x5c9601[_0x36a8('0x47')]=_['keys'](_0x275404[_0x36a8('0x47')]);_0x5c9601[_0x36a8('0x52')]=_[_0x36a8('0x49')](_0x5c9601[_0x36a8('0x46')],_0x5c9601[_0x36a8('0x47')]);_0x2db7c1['attributes']=_[_0x36a8('0x49')](_0x5c9601['model'],qs[_0x36a8('0x4a')](_0x275404[_0x36a8('0x47')][_0x36a8('0x4a')]));_0x2db7c1[_0x36a8('0x4b')]=_0x2db7c1[_0x36a8('0x4b')][_0x36a8('0x4c')]?_0x2db7c1[_0x36a8('0x4b')]:_0x5c9601[_0x36a8('0x46')];if(!_0x275404[_0x36a8('0x47')][_0x36a8('0x4d')](_0x36a8('0x4e'))){_0x2db7c1[_0x36a8('0x34')]=qs[_0x36a8('0x34')](_0x275404[_0x36a8('0x47')]['limit']);_0x2db7c1[_0x36a8('0x31')]=qs[_0x36a8('0x31')](_0x275404[_0x36a8('0x47')]['offset']);}_0x2db7c1[_0x36a8('0x4f')]=qs[_0x36a8('0x50')](_0x275404['query']['sort']);_0x2db7c1[_0x36a8('0x51')]=qs['filters'](_[_0x36a8('0x53')](_0x275404[_0x36a8('0x47')],_0x5c9601[_0x36a8('0x52')]));_0x2db7c1[_0x36a8('0x51')]['OpenchannelAccountId']=_0x150c78['id'];if(_0x275404[_0x36a8('0x47')][_0x36a8('0x54')]){_0x2db7c1[_0x36a8('0x51')]=_[_0x36a8('0x55')](_0x2db7c1[_0x36a8('0x51')],{'$or':_[_0x36a8('0x56')](_0x2db7c1[_0x36a8('0x4b')],function(_0x3b25f6){var _0x3b2bb2={};_0x3b2bb2[_0x3b25f6]={'$like':'%'+_0x275404[_0x36a8('0x47')][_0x36a8('0x54')]+'%'};return _0x3b2bb2;})});}_0x2db7c1=_[_0x36a8('0x55')]({},_0x2db7c1,_0x275404[_0x36a8('0x58')]);return db[_0x36a8('0x6e')][_0x36a8('0x33')]({'where':_0x2db7c1[_0x36a8('0x51')]})[_0x36a8('0x3b')](function(_0x283d51){_0x4c0ce3[_0x36a8('0x33')]=_0x283d51;if(_0x275404[_0x36a8('0x47')][_0x36a8('0x5a')]){_0x2db7c1[_0x36a8('0x60')]=[{'all':!![]}];}return db['Disposition'][_0x36a8('0x5b')](_0x2db7c1);})[_0x36a8('0x3b')](function(_0xcfe3aa){_0x4c0ce3[_0x36a8('0x5c')]=_0xcfe3aa;return _0x4c0ce3;});}})[_0x36a8('0x3b')](respondWithFilteredResult(_0x5bbcc4,_0x2db7c1))[_0x36a8('0x5d')](handleError(_0x5bbcc4,null));};exports[_0x36a8('0x71')]=function(_0x446218,_0xbf9d1e,_0x35529d){return db['OpenchannelAccount']['find']({'where':{'id':_0x446218[_0x36a8('0x5f')]['id']}})['then'](handleEntityNotFound(_0xbf9d1e,null))[_0x36a8('0x3b')](function(_0x35876b){if(_0x35876b){return _0x35876b[_0x36a8('0x71')](_0x446218[_0x36a8('0x47')][_0x36a8('0x72')]);}})[_0x36a8('0x3b')](respondWithStatusCode(_0xbf9d1e,null))[_0x36a8('0x5d')](handleError(_0xbf9d1e,null));};exports[_0x36a8('0x73')]=function(_0x12cba2,_0x447e3d,_0x2383b8){if(_0x12cba2['body']['id']){delete _0x12cba2[_0x36a8('0x63')]['id'];}return db['OpenchannelAccount'][_0x36a8('0x61')]({'where':{'id':_0x12cba2['params']['id']}})[_0x36a8('0x3b')](handleEntityNotFound(_0x447e3d,null))[_0x36a8('0x3b')](function(_0x788492){if(_0x788492){_0x12cba2[_0x36a8('0x63')]['OpenchannelAccountId']=_0x788492['id'];return db[_0x36a8('0x74')][_0x36a8('0x62')](_0x12cba2[_0x36a8('0x63')]);}})[_0x36a8('0x3b')](respondWithResult(_0x447e3d,null))[_0x36a8('0x5d')](handleError(_0x447e3d,null));};exports[_0x36a8('0x75')]=function(_0x18c0e9,_0x21a16c,_0x47b271){var _0x3357d7={'raw':![],'where':{}};var _0x24de45={};var _0x33792a={'count':0x0,'rows':[]};return db[_0x36a8('0x59')]['findOne']({'where':{'id':_0x18c0e9[_0x36a8('0x5f')]['id']}})[_0x36a8('0x3b')](handleEntityNotFound(_0x21a16c,null))['then'](function(_0x2cbcce){if(_0x2cbcce){_0x24de45['model']=_['keys'](db[_0x36a8('0x74')]['rawAttributes']);_0x24de45[_0x36a8('0x47')]=_[_0x36a8('0x48')](_0x18c0e9[_0x36a8('0x47')]);_0x24de45[_0x36a8('0x52')]=_[_0x36a8('0x49')](_0x24de45[_0x36a8('0x46')],_0x24de45[_0x36a8('0x47')]);_0x3357d7[_0x36a8('0x4b')]=_[_0x36a8('0x49')](_0x24de45[_0x36a8('0x46')],qs['fields'](_0x18c0e9[_0x36a8('0x47')][_0x36a8('0x4a')]));_0x3357d7[_0x36a8('0x4b')]=_0x3357d7[_0x36a8('0x4b')][_0x36a8('0x4c')]?_0x3357d7[_0x36a8('0x4b')]:_0x24de45[_0x36a8('0x46')];if(!_0x18c0e9[_0x36a8('0x47')][_0x36a8('0x4d')](_0x36a8('0x4e'))){_0x3357d7['limit']=qs[_0x36a8('0x34')](_0x18c0e9[_0x36a8('0x47')]['limit']);_0x3357d7['offset']=qs[_0x36a8('0x31')](_0x18c0e9[_0x36a8('0x47')]['offset']);}_0x3357d7[_0x36a8('0x4f')]=qs['sort'](_0x18c0e9[_0x36a8('0x47')][_0x36a8('0x50')]);_0x3357d7[_0x36a8('0x51')]=qs[_0x36a8('0x52')](_[_0x36a8('0x53')](_0x18c0e9['query'],_0x24de45[_0x36a8('0x52')]));_0x3357d7['where'][_0x36a8('0x6d')]=_0x2cbcce['id'];if(_0x18c0e9[_0x36a8('0x47')]['filter']){_0x3357d7['where']=_[_0x36a8('0x55')](_0x3357d7[_0x36a8('0x51')],{'$or':_[_0x36a8('0x56')](_0x3357d7['attributes'],function(_0x1c49c9){var _0x535655={};_0x535655[_0x1c49c9]={'$like':'%'+_0x18c0e9['query'][_0x36a8('0x54')]+'%'};return _0x535655;})});}_0x3357d7=_[_0x36a8('0x55')]({},_0x3357d7,_0x18c0e9['options']);return db[_0x36a8('0x74')]['count']({'where':_0x3357d7['where']})['then'](function(_0x3dd651){_0x33792a[_0x36a8('0x33')]=_0x3dd651;if(_0x18c0e9['query']['includeAll']){_0x3357d7[_0x36a8('0x60')]=[{'all':!![]}];}return db[_0x36a8('0x74')][_0x36a8('0x5b')](_0x3357d7);})[_0x36a8('0x3b')](function(_0x2aea61){_0x33792a[_0x36a8('0x5c')]=_0x2aea61;return _0x33792a;});}})[_0x36a8('0x3b')](respondWithFilteredResult(_0x21a16c,_0x3357d7))[_0x36a8('0x5d')](handleError(_0x21a16c,null));};exports[_0x36a8('0x76')]=function(_0x312493,_0x1b6a8d,_0x5d8885){return db[_0x36a8('0x59')]['find']({'where':{'id':_0x312493[_0x36a8('0x5f')]['id']}})[_0x36a8('0x3b')](handleEntityNotFound(_0x1b6a8d,null))['then'](function(_0x45aabc){if(_0x45aabc){return _0x45aabc['removeAnswers'](_0x312493[_0x36a8('0x47')][_0x36a8('0x72')]);}})['then'](respondWithStatusCode(_0x1b6a8d,null))[_0x36a8('0x5d')](handleError(_0x1b6a8d,null));};exports['notify']=function(_0x15d394,_0x465609,_0x519061){var _0x4c4cdd={'body':_0x15d394[_0x36a8('0x63')],'channel':_0x36a8('0x77')};var _0x50437f=[];var _0x1bc9c6=[];var _0x70b57d={};var _0x3a8cce=![];return db[_0x36a8('0x78')][_0x36a8('0x6b')]()[_0x36a8('0x3b')](function(_0x256f3c){if(!_0x256f3c){throw new db['Sequelize'][(_0x36a8('0x79'))](_0x36a8('0x7a'));}_0x50437f=_['difference'](_[_0x36a8('0x48')](_0x256f3c),['createdAt',_0x36a8('0x7b')]);_0x1bc9c6=_['difference'](_[_0x36a8('0x48')](_0x256f3c),[_0x36a8('0x7c'),_0x36a8('0x7b'),_0x36a8('0x7d'),_0x36a8('0x7e')]);if(_0x15d394[_0x36a8('0x63')]['id']){delete _0x15d394[_0x36a8('0x63')]['id'];}if(_['isNil'](_0x15d394[_0x36a8('0x63')]['from'])){throw new db[(_0x36a8('0x7f'))][(_0x36a8('0x79'))](_0x36a8('0x80'));}if(_[_0x36a8('0x81')](_0x15d394[_0x36a8('0x63')][_0x36a8('0x63')])||_0x15d394[_0x36a8('0x63')]['body']===''){throw new db['Sequelize']['ValidationError'](_0x36a8('0x82'));}if(_['isNil'](_0x15d394[_0x36a8('0x63')][_0x36a8('0x83')])){throw new db[(_0x36a8('0x7f'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1bc9c6);}if(!_['includes'](_0x1bc9c6,_0x15d394[_0x36a8('0x63')][_0x36a8('0x83')])){throw new db['Sequelize'][(_0x36a8('0x79'))](_0x36a8('0x84')+_0x1bc9c6);}_0x70b57d[_0x15d394['body'][_0x36a8('0x83')]]=_0x15d394[_0x36a8('0x63')][_0x36a8('0x85')];})['then'](function(){return db['OpenchannelAccount'][_0x36a8('0x61')]({'where':{'id':_0x15d394[_0x36a8('0x5f')]['id']},'include':[{'model':db[_0x36a8('0x86')],'as':_0x36a8('0x87'),'include':[{'model':db[_0x36a8('0x78')],'as':_0x36a8('0x88'),'where':_0x70b57d,'limit':0x1,'order':[['updatedAt',_0x36a8('0x89')]]}]},{'model':db[_0x36a8('0x8a')],'as':_0x36a8('0x8b')}]});})[_0x36a8('0x3b')](handleEntityNotFound(_0x465609,null))[_0x36a8('0x3b')](function(_0x2b2f39){if(_0x2b2f39&&_0x2b2f39[_0x36a8('0x87')]){_0x4c4cdd[_0x36a8('0x8c')]=_0x2b2f39;_0x4c4cdd['applications']=_0x2b2f39[_0x36a8('0x8b')];_0x4c4cdd[_0x36a8('0x8d')]=_0x2b2f39[_0x36a8('0x87')];_0x4c4cdd[_0x36a8('0x8e')]=_[_0x36a8('0x8f')](_0x4c4cdd['applications'],['priority'],[_0x36a8('0x90')]);if(_0x4c4cdd[_0x36a8('0x8c')][_0x36a8('0x8b')]){delete _0x4c4cdd[_0x36a8('0x8c')][_0x36a8('0x8b')];}if(_0x4c4cdd[_0x36a8('0x8c')]['List']&&_0x4c4cdd[_0x36a8('0x8c')][_0x36a8('0x87')][_0x36a8('0x88')]['length']){return _0x4c4cdd['account'][_0x36a8('0x87')][_0x36a8('0x88')][0x0];}var _0x8fa258=_[_0x36a8('0x1e')](_0x15d394['body'],{'firstName':_0x15d394[_0x36a8('0x63')][_0x36a8('0x85')],'ListId':_0x2b2f39[_0x36a8('0x7e')]});_0x8fa258[_0x15d394[_0x36a8('0x63')]['mapKey']]=_0x15d394[_0x36a8('0x63')][_0x36a8('0x85')];return db[_0x36a8('0x78')][_0x36a8('0x62')](_0x8fa258,{'fields':_0x50437f,'raw':!![]});}})[_0x36a8('0x3b')](handleEntityNotFound(_0x465609,null))[_0x36a8('0x3b')](function(_0x1e50c0){_0x4c4cdd[_0x36a8('0x91')]=_0x1e50c0;if(_0x1e50c0){var _0x36656a={'ContactId':_0x1e50c0['id'],'OpenchannelAccountId':_0x15d394[_0x36a8('0x5f')]['id'],'from':(_0x1e50c0['firstName']||'')+'\x20'+(_0x1e50c0[_0x36a8('0x92')]||'')};var _0x14a06d={'OpenchannelAccountId':_0x15d394[_0x36a8('0x5f')]['id'],'closed':![]};if(_0x15d394[_0x36a8('0x63')][_0x36a8('0x93')]){_0x14a06d[_0x36a8('0x93')]=_0x15d394[_0x36a8('0x63')][_0x36a8('0x93')];return db[_0x36a8('0x94')][_0x36a8('0x61')]({'where':_0x14a06d})[_0x36a8('0x3b')](function(_0x367da1){if(_0x367da1){return[_0x367da1,![]];}_0x36656a[_0x36a8('0x93')]=_0x15d394[_0x36a8('0x63')]['threadId'];_0x36656a[_0x36a8('0x95')]=_0x15d394[_0x36a8('0x63')][_0x36a8('0x95')];return db['OpenchannelInteraction'][_0x36a8('0x62')](_0x36656a)[_0x36a8('0x3b')](function(_0x26ddc8){return[_0x26ddc8,!![]];});});}else{_0x14a06d[_0x36a8('0x93')]=null;}_0x14a06d[_0x36a8('0x96')]=_0x1e50c0['id'];return db[_0x36a8('0x94')]['find']({'where':_0x14a06d})[_0x36a8('0x3b')](function(_0x4007b3){if(_0x4007b3){return[_0x4007b3,![]];}return db[_0x36a8('0x94')]['create'](_0x36656a)['then'](function(_0x435ef1){return[_0x435ef1,!![]];});});}})[_0x36a8('0x97')](function(_0x45f85b,_0x538066){if(_0x45f85b){_0x3a8cce=_0x538066;if(!_0x538066){var _0x2809ff={'from':(_0x4c4cdd[_0x36a8('0x91')][_0x36a8('0x98')]||'')+'\x20'+(_0x4c4cdd['contact'][_0x36a8('0x92')]||'')};if(_0x15d394[_0x36a8('0x63')][_0x36a8('0x93')]&&_0x15d394[_0x36a8('0x63')]['messageId']&&_0x15d394[_0x36a8('0x63')][_0x36a8('0x93')]!=_0x15d394['body'][_0x36a8('0x99')]){_0x2809ff[_0x36a8('0x93')]=_0x15d394['body'][_0x36a8('0x99')];}return _0x45f85b[_0x36a8('0x3a')](_0x2809ff);}else{return _0x45f85b;}}})[_0x36a8('0x3b')](function(_0x42c9fd){_0x4c4cdd[_0x36a8('0x9a')]=_0x42c9fd['get']({'plain':!![]});_0x4c4cdd['interaction'][_0x36a8('0x9b')]=_0x3a8cce;if(_0x4c4cdd[_0x36a8('0x9a')][_0x36a8('0x9b')]){if(_0x4c4cdd['account']['autoclose']){_0x4c4cdd[_0x36a8('0x8e')]['push']({'id':0x0,'priority':_0x4c4cdd[_0x36a8('0x8e')]['length']+0x1,'app':_0x36a8('0x9c'),'appdata':_0x36a8('0x9d'),'interval':'*,*,*,*'});}}return db['OpenchannelMessage'][_0x36a8('0x62')]({'body':_0x15d394[_0x36a8('0x63')]['body'],'OpenchannelAccountId':_0x15d394[_0x36a8('0x5f')]['id'],'OpenchannelInteractionId':_0x42c9fd['id'],'direction':'in','ContactId':_0x4c4cdd['contact']['id'],'AttachmentId':_0x15d394[_0x36a8('0x63')][_0x36a8('0x9e')]});})[_0x36a8('0x3b')](function(_0x40fbd1){_0x4c4cdd[_0x36a8('0x2b')]=_0x40fbd1;if(!_0x4c4cdd['interaction'][_0x36a8('0x9f')])return;return db['User'][_0x36a8('0x61')]({'attributes':['id',_0x36a8('0x3f')],'where':{'id':_0x4c4cdd[_0x36a8('0x9a')]['UserId']}});})[_0x36a8('0x3b')](function(_0x3bac98){if(_0x3bac98){_0x4c4cdd[_0x36a8('0x8e')][_0x36a8('0xa0')]({'id':0x0,'priority':0x0,'app':_0x36a8('0xa1'),'appdata':_0x3bac98['name']+','+(_0x4c4cdd[_0x36a8('0x8c')]['waitForTheAssignedAgent']||0xa),'interval':_0x36a8('0xa2')});}if(!_0x4c4cdd[_0x36a8('0x9a')][_0x36a8('0xa3')])return;return db[_0x36a8('0xa4')][_0x36a8('0x61')]({'attributes':['id','name'],'where':{'id':_0x4c4cdd[_0x36a8('0x9a')]['queueId']}});})[_0x36a8('0x3b')](function(_0x10b97c){if(_0x10b97c){_0x4c4cdd['applications'][_0x36a8('0xa0')]({'id':0x0,'priority':0x1,'app':_0x36a8('0xa5'),'appdata':_0x10b97c['name']+','+(_0x4c4cdd[_0x36a8('0x8c')][_0x36a8('0xa6')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x36a8('0xa7'),_0x4c4cdd);})[_0x36a8('0x3b')](function(_0x5780b9){respondWithRpcPromise(_0x36a8('0xa8'),_0x36a8('0xa8'),{'event':'notify','message':_0x5780b9},client9002);return _0x5780b9;})[_0x36a8('0x3b')](respondWithResult(_0x465609,null))[_0x36a8('0x5d')](handleError(_0x465609,null));};exports[_0x36a8('0xa9')]=function(_0xa4e072,_0xe68fc5){var _0x495c5e=_0xa4e072[_0x36a8('0x5f')]['id'];var _0xd4fddc=_0xa4e072[_0x36a8('0x63')];var _0x1bacf1=0xc8;var _0x5d50ab=null;return db['sequelize'][_0x36a8('0xaa')]({'isolationLevel':db[_0x36a8('0xab')][_0x36a8('0xac')][_0x36a8('0xad')][_0x36a8('0xae')]},function(_0x40e0b6){return db[_0x36a8('0x59')][_0x36a8('0x70')]({'where':{'id':_0x495c5e},'transaction':_0x40e0b6})['then'](function(_0x2161df){if(_0x2161df){return db[_0x36a8('0x8a')][_0x36a8('0x3c')]({'where':{'OpenchannelAccountId':_0x495c5e},'transaction':_0x40e0b6})[_0x36a8('0x3b')](function(){var _0x41bd49=_[_0x36a8('0x56')](_0xd4fddc,function(_0x1c98bf){_0x1c98bf[_0x36a8('0x6d')]=_0x495c5e;return _0x1c98bf;});return db[_0x36a8('0x8a')][_0x36a8('0xaf')](_0x41bd49,{'transaction':_0x40e0b6});});}else{_0x1bacf1=0x194;_0x5d50ab=[];}});})[_0x36a8('0x3b')](function(){if(_0x1bacf1!==0x194){return db['OpenchannelApplication'][_0x36a8('0xb0')]({'where':{'OpenchannelAccountId':_0x495c5e},'order':_0x36a8('0xb1')})[_0x36a8('0x3b')](function(_0x537bd7){_0x5d50ab=_0x537bd7;});}})[_0x36a8('0x5d')](function(_0x25edc4){_0x1bacf1=0x1f4;logger[_0x36a8('0x29')](_0x25edc4['stack']);if(_0x25edc4[_0x36a8('0x3f')]){delete _0x25edc4[_0x36a8('0x3f')];}_0x5d50ab=_0x25edc4;})[_0x36a8('0xb2')](function(){if(_0x5d50ab===null){_0xe68fc5[_0x36a8('0x2d')](_0x1bacf1);}else{if(_0x1bacf1===0x1f4){_0xe68fc5[_0x36a8('0x2e')](_0x1bacf1)[_0x36a8('0x40')](_0x5d50ab);}else{_0xe68fc5[_0x36a8('0x2e')](_0x1bacf1)['json'](_0x5d50ab);}}});};exports[_0x36a8('0xb3')]=function(_0x34dbab,_0x2d9fdb,_0x49ab65){var _0x3b193a={};var _0x34aeee={};var _0x1c3964;var _0x33c41c;return db[_0x36a8('0x59')]['findOne']({'where':{'id':_0x34dbab[_0x36a8('0x5f')]['id']}})[_0x36a8('0x3b')](handleEntityNotFound(_0x2d9fdb,null))['then'](function(_0x55a67c){if(_0x55a67c){_0x1c3964=_0x55a67c;_0x34aeee[_0x36a8('0x46')]=_['keys'](db[_0x36a8('0x8a')][_0x36a8('0x43')]);_0x34aeee[_0x36a8('0x47')]=_[_0x36a8('0x48')](_0x34dbab[_0x36a8('0x47')]);_0x34aeee[_0x36a8('0x52')]=_[_0x36a8('0x49')](_0x34aeee[_0x36a8('0x46')],_0x34aeee[_0x36a8('0x47')]);_0x3b193a[_0x36a8('0x4b')]=_[_0x36a8('0x49')](_0x34aeee[_0x36a8('0x46')],qs[_0x36a8('0x4a')](_0x34dbab[_0x36a8('0x47')][_0x36a8('0x4a')]));_0x3b193a[_0x36a8('0x4b')]=_0x3b193a['attributes'][_0x36a8('0x4c')]?_0x3b193a['attributes']:_0x34aeee[_0x36a8('0x46')];_0x3b193a['order']=qs['sort'](_0x34dbab[_0x36a8('0x47')][_0x36a8('0x50')]);_0x3b193a[_0x36a8('0x51')]=qs[_0x36a8('0x52')](_[_0x36a8('0x53')](_0x34dbab['query'],_0x34aeee[_0x36a8('0x52')]));if(_0x34dbab['query']['filter']){_0x3b193a[_0x36a8('0x51')]=_['merge'](_0x3b193a[_0x36a8('0x51')],{'$or':_[_0x36a8('0x56')](_0x3b193a[_0x36a8('0x4b')],function(_0x17ec58){var _0x1795f0={};_0x1795f0[_0x17ec58]={'$like':'%'+_0x34dbab['query'][_0x36a8('0x54')]+'%'};return _0x1795f0;})});}_0x3b193a=_[_0x36a8('0x55')]({},_0x3b193a,_0x34dbab[_0x36a8('0x58')]);return _0x1c3964['getApplications'](_0x3b193a);}})[_0x36a8('0x3b')](function(_0x305f5d){if(_0x305f5d){_0x33c41c=_0x305f5d[_0x36a8('0x4c')];if(!_0x34dbab[_0x36a8('0x47')][_0x36a8('0x4d')](_0x36a8('0x4e'))){_0x3b193a[_0x36a8('0x34')]=qs[_0x36a8('0x34')](_0x34dbab[_0x36a8('0x47')]['limit']);_0x3b193a['offset']=qs[_0x36a8('0x31')](_0x34dbab['query'][_0x36a8('0x31')]);}return _0x1c3964['getApplications'](_0x3b193a);}})['then'](function(_0x29bd4c){if(_0x29bd4c){return _0x29bd4c?{'count':_0x33c41c,'rows':_0x29bd4c}:null;}})[_0x36a8('0x3b')](respondWithResult(_0x2d9fdb,null))[_0x36a8('0x5d')](handleError(_0x2d9fdb,null));};exports[_0x36a8('0xb4')]=function(_0x16f887,_0x2d97cf,_0x472c60){var _0xe3706a={'raw':![],'where':{}};var _0xa54c3={};var _0x3f513f={'count':0x0,'rows':[]};return db[_0x36a8('0x59')][_0x36a8('0x70')]({'where':{'id':_0x16f887['params']['id']}})[_0x36a8('0x3b')](handleEntityNotFound(_0x2d97cf,null))[_0x36a8('0x3b')](function(_0x206da0){if(_0x206da0){_0xa54c3[_0x36a8('0x46')]=_['keys'](db[_0x36a8('0x94')][_0x36a8('0x43')]);_0xa54c3['query']=_[_0x36a8('0x48')](_0x16f887[_0x36a8('0x47')]);_0xa54c3['filters']=_['intersection'](_0xa54c3[_0x36a8('0x46')],_0xa54c3['query']);_0xe3706a[_0x36a8('0x4b')]=_[_0x36a8('0x49')](_0xa54c3[_0x36a8('0x46')],qs[_0x36a8('0x4a')](_0x16f887[_0x36a8('0x47')]['fields']));_0xe3706a[_0x36a8('0x4b')]=_0xe3706a[_0x36a8('0x4b')][_0x36a8('0x4c')]?_0xe3706a[_0x36a8('0x4b')]:_0xa54c3[_0x36a8('0x46')];if(!_0x16f887[_0x36a8('0x47')][_0x36a8('0x4d')](_0x36a8('0x4e'))){_0xe3706a[_0x36a8('0x34')]=qs[_0x36a8('0x34')](_0x16f887[_0x36a8('0x47')][_0x36a8('0x34')]);_0xe3706a[_0x36a8('0x31')]=qs[_0x36a8('0x31')](_0x16f887[_0x36a8('0x47')]['offset']);}_0xe3706a[_0x36a8('0x4f')]=qs['sort'](_0x16f887[_0x36a8('0x47')][_0x36a8('0x50')]);_0xe3706a[_0x36a8('0x51')]=qs['filters'](_['pick'](_0x16f887[_0x36a8('0x47')],_0xa54c3[_0x36a8('0x52')]));_0xe3706a[_0x36a8('0x51')][_0x36a8('0x6d')]=_0x206da0['id'];if(_0x16f887[_0x36a8('0x47')]['filter']){_0xe3706a[_0x36a8('0x51')]=_['merge'](_0xe3706a[_0x36a8('0x51')],{'$or':_['map'](_0xe3706a[_0x36a8('0x4b')],function(_0x5154bc){var _0x154609={};_0x154609[_0x5154bc]={'$like':'%'+_0x16f887[_0x36a8('0x47')][_0x36a8('0x54')]+'%'};return _0x154609;})});}_0xe3706a=_[_0x36a8('0x55')]({},_0xe3706a,_0x16f887[_0x36a8('0x58')]);return db[_0x36a8('0x94')][_0x36a8('0x33')]({'where':_0xe3706a[_0x36a8('0x51')]})[_0x36a8('0x3b')](function(_0x3c10cc){_0x3f513f['count']=_0x3c10cc;if(_0x16f887[_0x36a8('0x47')][_0x36a8('0x5a')]){_0xe3706a[_0x36a8('0x60')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':_0x36a8('0xb5'),'attributes':[_0x36a8('0x3f'),_0x36a8('0xb6'),_0x36a8('0xb7')],'required':![]},{'model':db[_0x36a8('0xb8')],'as':_0x36a8('0xb9'),'attributes':['id',_0x36a8('0x3f'),_0x36a8('0xba')],'where':_0x16f887['query'][_0x36a8('0xbb')]?{'id':_0x16f887[_0x36a8('0x47')][_0x36a8('0xbb')]}:undefined,'required':_0x16f887[_0x36a8('0x47')]['tag']?!![]:![]}];}return db[_0x36a8('0x94')]['findAll'](_0xe3706a);})[_0x36a8('0x3b')](function(_0x9ee7cb){_0x3f513f[_0x36a8('0x5c')]=_0x9ee7cb;return _0x3f513f;});}})[_0x36a8('0x3b')](respondWithFilteredResult(_0x2d97cf,_0xe3706a))[_0x36a8('0x5d')](handleError(_0x2d97cf,null));};exports[_0x36a8('0xbc')]=function(_0x253250,_0x386a82,_0x2f868b){return db[_0x36a8('0x59')][_0x36a8('0x61')]({'where':{'id':_0x253250[_0x36a8('0x5f')]['id']}})[_0x36a8('0x3b')](handleEntityNotFound(_0x386a82,null))['then'](function(_0x5ccc39){if(_0x5ccc39){return _0x5ccc39[_0x36a8('0xbc')](_0x253250['body']['ids'],_[_0x36a8('0xbd')](_0x253250[_0x36a8('0x63')],[_0x36a8('0x72'),'id'])||{})['spread'](function(_0x4df086){for(var _0xe706a2=0x0;_0xe706a2<_0x253250[_0x36a8('0x63')][_0x36a8('0x72')][_0x36a8('0x4c')];_0xe706a2+=0x1){socket['emit'](_0x36a8('0xbe'),{'UserId':Number(_0x253250[_0x36a8('0x63')][_0x36a8('0x72')][_0xe706a2]),'OpenchannelAccountId':Number(_0x253250[_0x36a8('0x5f')]['id'])});}return _0x4df086;});}})[_0x36a8('0x3b')](respondWithResult(_0x386a82,null))['catch'](handleError(_0x386a82,null));};exports[_0x36a8('0xbf')]=function(_0x265d50,_0x30678d,_0x2f4a38){return db[_0x36a8('0x59')][_0x36a8('0x61')]({'where':{'id':_0x265d50[_0x36a8('0x5f')]['id']}})[_0x36a8('0x3b')](handleEntityNotFound(_0x30678d,null))['then'](function(_0x371af0){if(_0x371af0){return _0x371af0[_0x36a8('0xbf')](_0x265d50['query']['ids'])[_0x36a8('0x3b')](function(){if(_['isArray'](_0x265d50[_0x36a8('0x47')]['ids'])){for(var _0x5565b8=0x0;_0x5565b8<_0x265d50[_0x36a8('0x47')][_0x36a8('0x72')][_0x36a8('0x4c')];_0x5565b8+=0x1){socket['emit'](_0x36a8('0xc0'),{'UserId':Number(_0x265d50[_0x36a8('0x47')][_0x36a8('0x72')][_0x5565b8]),'OpenchannelAccountId':Number(_0x265d50[_0x36a8('0x5f')]['id'])});}}else{socket[_0x36a8('0xc1')]('userOpenchannelAccount:remove',{'UserId':Number(_0x265d50[_0x36a8('0x47')]['ids']),'OpenchannelAccountId':Number(_0x265d50['params']['id'])});}});}})[_0x36a8('0x3b')](respondWithStatusCode(_0x30678d,null))[_0x36a8('0x5d')](handleError(_0x30678d,null));};exports[_0x36a8('0xc2')]=function(_0x42255b,_0x30975a,_0x441d65){var _0x36dae5={};var _0x48b4bf={};var _0x28ae0d;var _0x41f691;return db[_0x36a8('0x59')]['findOne']({'where':{'id':_0x42255b[_0x36a8('0x5f')]['id']}})[_0x36a8('0x3b')](handleEntityNotFound(_0x30975a,null))[_0x36a8('0x3b')](function(_0x5b3807){if(_0x5b3807){_0x28ae0d=_0x5b3807;_0x48b4bf['model']=_[_0x36a8('0x48')](db[_0x36a8('0xc3')][_0x36a8('0x43')]);_0x48b4bf[_0x36a8('0x47')]=_[_0x36a8('0x48')](_0x42255b[_0x36a8('0x47')]);_0x48b4bf['filters']=_[_0x36a8('0x49')](_0x48b4bf[_0x36a8('0x46')],_0x48b4bf[_0x36a8('0x47')]);_0x36dae5[_0x36a8('0x4b')]=_[_0x36a8('0x49')](_0x48b4bf[_0x36a8('0x46')],qs['fields'](_0x42255b[_0x36a8('0x47')][_0x36a8('0x4a')]));_0x36dae5[_0x36a8('0x4b')]=_0x36dae5[_0x36a8('0x4b')][_0x36a8('0x4c')]?_0x36dae5[_0x36a8('0x4b')]:_0x48b4bf['model'];_0x36dae5[_0x36a8('0x4f')]=qs['sort'](_0x42255b['query']['sort']);_0x36dae5[_0x36a8('0x51')]=qs[_0x36a8('0x52')](_[_0x36a8('0x53')](_0x42255b[_0x36a8('0x47')],_0x48b4bf['filters']));if(_0x42255b[_0x36a8('0x47')][_0x36a8('0x54')]){_0x36dae5[_0x36a8('0x51')]=_['merge'](_0x36dae5[_0x36a8('0x51')],{'$or':_[_0x36a8('0x56')](_0x36dae5['attributes'],function(_0x3b67a2){var _0x12e8be={};_0x12e8be[_0x3b67a2]={'$like':'%'+_0x42255b[_0x36a8('0x47')][_0x36a8('0x54')]+'%'};return _0x12e8be;})});}_0x36dae5=_['merge']({},_0x36dae5,_0x42255b[_0x36a8('0x58')]);return _0x28ae0d[_0x36a8('0xc2')](_0x36dae5);}})['then'](function(_0x38091c){if(_0x38091c){_0x41f691=_0x38091c[_0x36a8('0x4c')];if(!_0x42255b[_0x36a8('0x47')][_0x36a8('0x4d')](_0x36a8('0x4e'))){_0x36dae5[_0x36a8('0x34')]=qs[_0x36a8('0x34')](_0x42255b['query'][_0x36a8('0x34')]);_0x36dae5[_0x36a8('0x31')]=qs['offset'](_0x42255b['query'][_0x36a8('0x31')]);}return _0x28ae0d['getAgents'](_0x36dae5);}})[_0x36a8('0x3b')](function(_0x28b1e7){if(_0x28b1e7){return _0x28b1e7?{'count':_0x41f691,'rows':_0x28b1e7}:null;}})['then'](respondWithResult(_0x30975a,null))[_0x36a8('0x5d')](handleError(_0x30975a,null));};exports['send']=function(_0x18f900,_0x1613c9,_0x1f8b78){var _0x303377,_0x3903b7,_0x3ee42c;if(_[_0x36a8('0x81')](_0x18f900[_0x36a8('0x63')][_0x36a8('0x63')])||_0x18f900[_0x36a8('0x63')][_0x36a8('0x63')]===''){throw new db[(_0x36a8('0x7f'))][(_0x36a8('0x79'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x36a8('0x81')](_0x18f900[_0x36a8('0x63')]['to'])){}_0x303377=_0x18f900[_0x36a8('0x63')]['to'];return db[_0x36a8('0x59')]['findOne']({'where':{'id':_0x18f900[_0x36a8('0x5f')]['id']}})[_0x36a8('0x3b')](handleEntityNotFound(_0x1613c9,null))['then'](function(_0x2af9af){if(_0x2af9af){return db['OpenchannelAccount']['find']({'where':{'id':_0x2af9af['id']},'include':[{'model':db[_0x36a8('0x86')],'as':'List','include':[{'model':db[_0x36a8('0x78')],'as':_0x36a8('0x88'),'where':{[_0x2af9af[_0x36a8('0x83')]]:_0x303377},'limit':0x1,'order':[[_0x36a8('0x7b'),_0x36a8('0x89')]]}]}]})[_0x36a8('0x3b')](handleEntityNotFound(_0x1613c9,null))['then'](function(_0x87d1e0){if(_0x87d1e0&&_0x87d1e0[_0x36a8('0x87')]){_0x3903b7=_0x87d1e0[_0x36a8('0x64')]({'plain':!![]});if(_0x3903b7[_0x36a8('0x87')]&&_0x3903b7[_0x36a8('0x87')]['Contacts']['length']){return _0x3903b7[_0x36a8('0x87')][_0x36a8('0x88')][0x0];}return db[_0x36a8('0x78')][_0x36a8('0x62')](_[_0x36a8('0x1e')](_0x18f900[_0x36a8('0x63')],{'firstName':_0x303377,[_0x87d1e0[_0x36a8('0x83')]]:_0x303377,'phone':_0x303377,'ListId':_0x3903b7['ListId']}));}})[_0x36a8('0x3b')](handleEntityNotFound(_0x1613c9,null))[_0x36a8('0x3b')](function(_0x308df0){if(_0x308df0){_0x3ee42c=_0x308df0;return db[_0x36a8('0x94')][_0x36a8('0x61')]({'where':{'ContactId':_0x3ee42c['id'],'closed':![],'OpenchannelAccountId':_0x3903b7['id']}})['then'](function(_0x2990a9){if(_0x2990a9){return[_0x2990a9,![]];}return db[_0x36a8('0x94')]['create']({'UserId':_0x18f900[_0x36a8('0xc4')]['id'],'ContactId':_0x3ee42c['id'],'OpenchannelAccountId':_0x3903b7['id'],'lastMsgDirection':'out','firstMsgDirection':_0x36a8('0xc5'),'Messages':[_['merge'](_0x18f900[_0x36a8('0x63')],{'read':![],'body':_0x18f900[_0x36a8('0x63')][_0x36a8('0x63')],'OpenchannelAccountId':_0x3903b7['id'],'UserId':_0x18f900['user']['id'],'ContactId':_0x3ee42c['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})[_0x36a8('0x3b')](function(_0x15206d){return[_0x15206d,!![]];});});}})[_0x36a8('0x97')](function(_0x48d44d,_0x292c14){if(_0x292c14){return _0x48d44d;}return db[_0x36a8('0xc6')][_0x36a8('0x62')](_[_0x36a8('0x55')](_0x18f900['body'],{'read':![],'body':_0x18f900[_0x36a8('0x63')]['body'],'OpenchannelAccountId':_0x3903b7['id'],'OpenchannelInteractionId':_0x48d44d['id'],'UserId':_0x18f900['user']['id'],'ContactId':_0x3ee42c['id']}))[_0x36a8('0x3b')](function(_0x5047ee){_0x48d44d[_0x36a8('0xc7')][_0x36a8('0xc8')]=[];_0x48d44d[_0x36a8('0xc7')][_0x36a8('0xc8')][_0x36a8('0xc9')](_0x5047ee[_0x36a8('0xc7')]);return _0x48d44d;});});}})[_0x36a8('0x3b')](respondWithResult(_0x1613c9,null))[_0x36a8('0x5d')](handleError(_0x1613c9,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 4e8bc3d..b6d5f37 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 _0x99e9=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x47ea98,_0x2decc8){var _0x2d9382=function(_0x39bd6b){while(--_0x39bd6b){_0x47ea98['push'](_0x47ea98['shift']());}};_0x2d9382(++_0x2decc8);}(_0x99e9,0xb4));var _0x999e=function(_0x282f9a,_0x63dff){_0x282f9a=_0x282f9a-0x0;var _0x52528c=_0x99e9[_0x282f9a];return _0x52528c;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x999e('0x0'))['db'][_0x999e('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x999e('0x2')](0x0);var events={'afterCreate':_0x999e('0x3'),'afterUpdate':'update','afterDestroy':_0x999e('0x4')};function emitEvent(_0x2f803e){return function(_0x3aac27,_0x4e2112,_0x296411){OpenchannelAccountEvents['emit'](_0x2f803e+':'+_0x3aac27['id'],_0x3aac27);OpenchannelAccountEvents[_0x999e('0x5')](_0x2f803e,_0x3aac27);_0x296411(null);};}for(var e in events){if(events[_0x999e('0x6')](e)){var event=events[e];OpenchannelAccount[_0x999e('0x7')](e,emitEvent(event));}}module[_0x999e('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xb688=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x4bb691,_0x37679a){var _0x588b53=function(_0x2c802d){while(--_0x2c802d){_0x4bb691['push'](_0x4bb691['shift']());}};_0x588b53(++_0x37679a);}(_0xb688,0xcf));var _0x8b68=function(_0x4389f6,_0x11f2b9){_0x4389f6=_0x4389f6-0x0;var _0x583c3d=_0xb688[_0x4389f6];return _0x583c3d;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x8b68('0x0'))['db'][_0x8b68('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x8b68('0x2')](0x0);var events={'afterCreate':_0x8b68('0x3'),'afterUpdate':_0x8b68('0x4'),'afterDestroy':_0x8b68('0x5')};function emitEvent(_0x4e281c){return function(_0x41030e,_0x27925d,_0x30f33d){OpenchannelAccountEvents[_0x8b68('0x6')](_0x4e281c+':'+_0x41030e['id'],_0x41030e);OpenchannelAccountEvents['emit'](_0x4e281c,_0x41030e);_0x30f33d(null);};}for(var e in events){if(events[_0x8b68('0x7')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x8b68('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 1ebce09..7a2a7ac 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(_0x4744c9,_0x1a2d6e){var _0x1a5d9a=function(_0x392430){while(--_0x392430){_0x4744c9['push'](_0x4744c9['shift']());}};_0x1a5d9a(++_0x1a2d6e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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(_0x4326bf,_0x113132){var _0x420edc=function(_0x536cc1){while(--_0x536cc1){_0x4326bf['push'](_0x4326bf['shift']());}};_0x420edc(++_0x113132);}(_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 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 c5d8a3d..751d2db 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 _0x5ec6=['stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','defaults','redis','socket.io-emitter','./openchannelAccount.socket','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s'];(function(_0x35d3a8,_0x44406a){var _0x182378=function(_0x298e0b){while(--_0x298e0b){_0x35d3a8['push'](_0x35d3a8['shift']());}};_0x182378(++_0x44406a);}(_0x5ec6,0x7f));var _0x65ec=function(_0x87077e,_0x1c921f){_0x87077e=_0x87077e-0x0;var _0x28f8c4=_0x5ec6[_0x87077e];return _0x28f8c4;};'use strict';var _=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var moment=require(_0x65ec('0x2'));var BPromise=require('bluebird');var rs=require(_0x65ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x65ec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x65ec('0x5'))('rpc');var config=require(_0x65ec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x65ec('0x7')][_0x65ec('0x8')]({'port':0x232a});config['redis']=_[_0x65ec('0x9')](config[_0x65ec('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x65ec('0xb'))(new Redis(config[_0x65ec('0xa')]));require(_0x65ec('0xc'))['register'](socket);function respondWithRpcPromise(_0x49aacd,_0x3cf126,_0x5e78f8){return new BPromise(function(_0x136928,_0x28fe68){return client['request'](_0x49aacd,_0x5e78f8)[_0x65ec('0xd')](function(_0xd7cf80){logger['info'](_0x65ec('0xe'),_0x3cf126,_0x65ec('0xf'));logger['debug'](_0x65ec('0x10'),_0x3cf126,_0x65ec('0xf'),JSON[_0x65ec('0x11')](_0xd7cf80));if(_0xd7cf80[_0x65ec('0x12')]){if(_0xd7cf80[_0x65ec('0x12')][_0x65ec('0x13')]===0x1f4){logger[_0x65ec('0x12')](_0x65ec('0xe'),_0x3cf126,_0xd7cf80['error'][_0x65ec('0x14')]);return _0x28fe68(_0xd7cf80[_0x65ec('0x12')][_0x65ec('0x14')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x3cf126,_0xd7cf80[_0x65ec('0x12')][_0x65ec('0x14')]);return _0x136928(_0xd7cf80[_0x65ec('0x12')]['message']);}else{logger[_0x65ec('0x15')](_0x65ec('0xe'),_0x3cf126,_0x65ec('0xf'));_0x136928(_0xd7cf80[_0x65ec('0x16')][_0x65ec('0x14')]);}})[_0x65ec('0x17')](function(_0x37c494){logger[_0x65ec('0x12')](_0x65ec('0xe'),_0x3cf126,_0x37c494);_0x28fe68(_0x37c494);});});} \ No newline at end of file +var _0xeb74=['request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','./openchannelAccount.socket','register'];(function(_0x2d5557,_0x1e7799){var _0x585e79=function(_0x26fba0){while(--_0x26fba0){_0x2d5557['push'](_0x2d5557['shift']());}};_0x585e79(++_0x1e7799);}(_0xeb74,0xe3));var _0x4eb7=function(_0x3ce9ee,_0x12fe4c){_0x3ce9ee=_0x3ce9ee-0x0;var _0x577418=_0xeb74[_0x3ce9ee];return _0x577418;};'use strict';var _=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var moment=require(_0x4eb7('0x2'));var BPromise=require(_0x4eb7('0x3'));var rs=require(_0x4eb7('0x4'));var fs=require('fs');var Redis=require(_0x4eb7('0x5'));var db=require(_0x4eb7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4eb7('0x7'))(_0x4eb7('0x8'));var config=require(_0x4eb7('0x9'));var jayson=require(_0x4eb7('0xa'));var client=jayson[_0x4eb7('0xb')]['http']({'port':0x232a});config[_0x4eb7('0xc')]=_['defaults'](config[_0x4eb7('0xc')],{'host':_0x4eb7('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4eb7('0xe'))[_0x4eb7('0xf')](socket);function respondWithRpcPromise(_0x4b3add,_0xa72e98,_0x4ff98e){return new BPromise(function(_0x3326cd,_0x462392){return client[_0x4eb7('0x10')](_0x4b3add,_0x4ff98e)['then'](function(_0x2b32be){logger[_0x4eb7('0x11')](_0x4eb7('0x12'),_0xa72e98,_0x4eb7('0x13'));logger[_0x4eb7('0x14')](_0x4eb7('0x15'),_0xa72e98,_0x4eb7('0x13'),JSON['stringify'](_0x2b32be));if(_0x2b32be['error']){if(_0x2b32be['error'][_0x4eb7('0x16')]===0x1f4){logger['error'](_0x4eb7('0x12'),_0xa72e98,_0x2b32be[_0x4eb7('0x17')][_0x4eb7('0x18')]);return _0x462392(_0x2b32be[_0x4eb7('0x17')][_0x4eb7('0x18')]);}logger[_0x4eb7('0x17')](_0x4eb7('0x12'),_0xa72e98,_0x2b32be[_0x4eb7('0x17')][_0x4eb7('0x18')]);return _0x3326cd(_0x2b32be[_0x4eb7('0x17')]['message']);}else{logger[_0x4eb7('0x11')](_0x4eb7('0x12'),_0xa72e98,_0x4eb7('0x13'));_0x3326cd(_0x2b32be[_0x4eb7('0x19')][_0x4eb7('0x18')]);}})[_0x4eb7('0x1a')](function(_0x2d0ea7){logger[_0x4eb7('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0xa72e98,_0x2d0ea7);_0x462392(_0x2d0ea7);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index eae44fc..703da58 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 _0xb575=['openchannelAccount:','./openchannelAccount.events','save','update','emit','removeListener','register'];(function(_0x1a1cd2,_0x849e45){var _0x7c3a03=function(_0x29daee){while(--_0x29daee){_0x1a1cd2['push'](_0x1a1cd2['shift']());}};_0x7c3a03(++_0x849e45);}(_0xb575,0xda));var _0x5b57=function(_0x139e29,_0x4e1c87){_0x139e29=_0x139e29-0x0;var _0x409da1=_0xb575[_0x139e29];return _0x409da1;};'use strict';var OpenchannelAccountEvents=require(_0x5b57('0x0'));var events=[_0x5b57('0x1'),'remove',_0x5b57('0x2')];function createListener(_0x4c5b3f,_0x4a644c){return function(_0x585c94){_0x4a644c[_0x5b57('0x3')](_0x4c5b3f,_0x585c94);};}function removeListener(_0x34ae8e,_0x4b91c3){return function(){OpenchannelAccountEvents[_0x5b57('0x4')](_0x34ae8e,_0x4b91c3);};}exports[_0x5b57('0x5')]=function(_0x501a91){for(var _0x542b77=0x0,_0x672beb=events['length'];_0x542b77<_0x672beb;_0x542b77++){var _0x4232d0=events[_0x542b77];var _0x5dd0c7=createListener(_0x5b57('0x6')+_0x4232d0,_0x501a91);OpenchannelAccountEvents['on'](_0x4232d0,_0x5dd0c7);}}; \ No newline at end of file +var _0x86dd=['update','emit','removeListener','register','save'];(function(_0x3fe042,_0x1106f7){var _0x7d4a1f=function(_0x2df987){while(--_0x2df987){_0x3fe042['push'](_0x3fe042['shift']());}};_0x7d4a1f(++_0x1106f7);}(_0x86dd,0x1ee));var _0xd86d=function(_0x6e6827,_0x50956b){_0x6e6827=_0x6e6827-0x0;var _0x2792fe=_0x86dd[_0x6e6827];return _0x2792fe;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xd86d('0x0'),'remove',_0xd86d('0x1')];function createListener(_0x2cb4b4,_0x287d1d){return function(_0x217373){_0x287d1d[_0xd86d('0x2')](_0x2cb4b4,_0x217373);};}function removeListener(_0x30a31c,_0x2e82a9){return function(){OpenchannelAccountEvents[_0xd86d('0x3')](_0x30a31c,_0x2e82a9);};}exports[_0xd86d('0x4')]=function(_0x1d5ffc){for(var _0x3b13f9=0x0,_0x4274f8=events['length'];_0x3b13f9<_0x4274f8;_0x3b13f9++){var _0x341335=events[_0x3b13f9];var _0xfcba94=createListener('openchannelAccount:'+_0x341335,_0x1d5ffc);OpenchannelAccountEvents['on'](_0x341335,_0xfcba94);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 4785e3b..45a469c 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 _0xb889=['index','/:id','isAuthenticated','show','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./openchannelApplication.controller','get'];(function(_0x1cbcf1,_0x3f9fd9){var _0x3a06f0=function(_0x5425d4){while(--_0x5425d4){_0x1cbcf1['push'](_0x1cbcf1['shift']());}};_0x3a06f0(++_0x3f9fd9);}(_0xb889,0x1f4));var _0x9b88=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0xb889[_0x2db12b];return _0x20990b;};'use strict';var multer=require(_0x9b88('0x0'));var util=require(_0x9b88('0x1'));var path=require(_0x9b88('0x2'));var timeout=require(_0x9b88('0x3'));var express=require(_0x9b88('0x4'));var router=express[_0x9b88('0x5')]();var fs_extra=require(_0x9b88('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9b88('0x7'));var config=require('../../config/environment');var controller=require(_0x9b88('0x8'));router[_0x9b88('0x9')]('/',auth['isAuthenticated'](),controller[_0x9b88('0xa')]);router['get'](_0x9b88('0xb'),auth[_0x9b88('0xc')](),controller[_0x9b88('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x9b88('0xb'),auth[_0x9b88('0xc')](),controller['update']);router[_0x9b88('0xe')](_0x9b88('0xb'),auth[_0x9b88('0xc')](),controller[_0x9b88('0xf')]);module[_0x9b88('0x10')]=router; \ No newline at end of file +var _0xb96a=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','/:id','post','create','update','delete','destroy'];(function(_0x25578d,_0x82680e){var _0xfe34ba=function(_0x2fdb86){while(--_0x2fdb86){_0x25578d['push'](_0x25578d['shift']());}};_0xfe34ba(++_0x82680e);}(_0xb96a,0x16a));var _0xab96=function(_0x5971ab,_0x34eaee){_0x5971ab=_0x5971ab-0x0;var _0x22fc84=_0xb96a[_0x5971ab];return _0x22fc84;};'use strict';var multer=require(_0xab96('0x0'));var util=require(_0xab96('0x1'));var path=require(_0xab96('0x2'));var timeout=require('connect-timeout');var express=require(_0xab96('0x3'));var router=express[_0xab96('0x4')]();var fs_extra=require(_0xab96('0x5'));var auth=require(_0xab96('0x6'));var interaction=require(_0xab96('0x7'));var config=require(_0xab96('0x8'));var controller=require(_0xab96('0x9'));router[_0xab96('0xa')]('/',auth[_0xab96('0xb')](),controller['index']);router[_0xab96('0xa')](_0xab96('0xc'),auth[_0xab96('0xb')](),controller['show']);router[_0xab96('0xd')]('/',auth[_0xab96('0xb')](),controller[_0xab96('0xe')]);router['put'](_0xab96('0xc'),auth[_0xab96('0xb')](),controller[_0xab96('0xf')]);router[_0xab96('0x10')](_0xab96('0xc'),auth[_0xab96('0xb')](),controller[_0xab96('0x11')]);module[_0xab96('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 90bbe85..7de56f9 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 _0x5346=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x5346,0x1a7));var _0x6534=function(_0x3f47ce,_0x26fd51){_0x3f47ce=_0x3f47ce-0x0;var _0x2eb156=_0x5346[_0x3f47ce];return _0x2eb156;};'use strict';var Sequelize=require(_0x6534('0x0'));module[_0x6534('0x1')]={'priority':{'type':Sequelize[_0x6534('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6534('0x3')],'allowNull':![],'defaultValue':_0x6534('0x4')},'appdata':{'type':Sequelize[_0x6534('0x5')]()},'description':{'type':Sequelize[_0x6534('0x3')]},'interval':{'type':Sequelize[_0x6534('0x3')],'defaultValue':_0x6534('0x6')}}; \ No newline at end of file +var _0x2455=['exports','INTEGER','STRING','TEXT','sequelize'];(function(_0x438ab6,_0x3ce820){var _0x5a9aec=function(_0x46d1e1){while(--_0x46d1e1){_0x438ab6['push'](_0x438ab6['shift']());}};_0x5a9aec(++_0x3ce820);}(_0x2455,0x1c1));var _0x5245=function(_0x17fc20,_0x7d3f2f){_0x17fc20=_0x17fc20-0x0;var _0x29d108=_0x2455[_0x17fc20];return _0x29d108;};'use strict';var Sequelize=require(_0x5245('0x0'));module[_0x5245('0x1')]={'priority':{'type':Sequelize[_0x5245('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5245('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x5245('0x4')]()},'description':{'type':Sequelize[_0x5245('0x3')]},'interval':{'type':Sequelize[_0x5245('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 6685903..234e942 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 _0x454e=['sort','where','filters','filter','VIRTUAL','includeAll','rows','catch','show','params','keys','fields','include','merge','options','create','body','find','destroy','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/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','set','json','apply','save','update','then','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','type','model','query','intersection','attributes','hasOwnProperty','nolimit','limit','order'];(function(_0x2fda7f,_0x5c6cf9){var _0x3ce5fe=function(_0x52b27e){while(--_0x52b27e){_0x2fda7f['push'](_0x2fda7f['shift']());}};_0x3ce5fe(++_0x5c6cf9);}(_0x454e,0xa9));var _0xe454=function(_0x4ddfc1,_0x5d1d15){_0x4ddfc1=_0x4ddfc1-0x0;var _0x5c9ad6=_0x454e[_0x4ddfc1];return _0x5c9ad6;};'use strict';var emlformat=require(_0xe454('0x0'));var rimraf=require(_0xe454('0x1'));var zipdir=require(_0xe454('0x2'));var jsonpatch=require(_0xe454('0x3'));var rp=require(_0xe454('0x4'));var moment=require(_0xe454('0x5'));var BPromise=require(_0xe454('0x6'));var Mustache=require(_0xe454('0x7'));var util=require('util');var path=require(_0xe454('0x8'));var sox=require(_0xe454('0x9'));var csv=require(_0xe454('0xa'));var ejs=require(_0xe454('0xb'));var fs=require('fs');var fs_extra=require(_0xe454('0xc'));var _=require(_0xe454('0xd'));var squel=require(_0xe454('0xe'));var crypto=require(_0xe454('0xf'));var jsforce=require(_0xe454('0x10'));var deskjs=require(_0xe454('0x11'));var toCsv=require(_0xe454('0xa'));var querystring=require(_0xe454('0x12'));var Papa=require(_0xe454('0x13'));var Redis=require(_0xe454('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xe454('0x15'));var as=require(_0xe454('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe454('0x17'));var utils=require(_0xe454('0x18'));var config=require(_0xe454('0x19'));var licenseUtil=require(_0xe454('0x1a'));var db=require(_0xe454('0x1b'))['db'];function respondWithStatusCode(_0x2c4d26,_0x4506c4){_0x4506c4=_0x4506c4||0xcc;return function(_0x505bf2){if(_0x505bf2){return _0x2c4d26[_0xe454('0x1c')](_0x4506c4);}return _0x2c4d26[_0xe454('0x1d')](_0x4506c4)['end']();};}function respondWithResult(_0x197b18,_0x4f1983){_0x4f1983=_0x4f1983||0xc8;return function(_0x1d0f93){if(_0x1d0f93){return _0x197b18[_0xe454('0x1d')](_0x4f1983)['json'](_0x1d0f93);}};}function respondWithFilteredResult(_0x4d57a1,_0x3468fc){return function(_0x5ab9ab){if(_0x5ab9ab){var _0x2dcb44=typeof _0x3468fc[_0xe454('0x1e')]===_0xe454('0x1f')&&typeof _0x3468fc['limit']==='undefined';var _0x1dd256=_0x5ab9ab[_0xe454('0x20')];var _0x4ac235=_0x2dcb44?0x0:_0x3468fc[_0xe454('0x1e')];var _0x21e8c7=_0x2dcb44?_0x5ab9ab[_0xe454('0x20')]:_0x3468fc['offset']+_0x3468fc['limit'];var _0x1ff95a;if(_0x21e8c7>=_0x1dd256){_0x21e8c7=_0x1dd256;_0x1ff95a=0xc8;}else{_0x1ff95a=0xce;}_0x4d57a1[_0xe454('0x1d')](_0x1ff95a);return _0x4d57a1[_0xe454('0x21')]('Content-Range',_0x4ac235+'-'+_0x21e8c7+'/'+_0x1dd256)[_0xe454('0x22')](_0x5ab9ab);}return null;};}function patchUpdates(_0x324467){return function(_0x23d0ce){try{jsonpatch[_0xe454('0x23')](_0x23d0ce,_0x324467,!![]);}catch(_0x4a6771){return BPromise['reject'](_0x4a6771);}return _0x23d0ce[_0xe454('0x24')]();};}function saveUpdates(_0x75b76f,_0x289c4f){return function(_0x17141f){if(_0x17141f){return _0x17141f[_0xe454('0x25')](_0x75b76f)[_0xe454('0x26')](function(_0x4e2fd1){return _0x4e2fd1;});}return null;};}function removeEntity(_0x3e79a0,_0xb3ca9b){return function(_0x3630c6){if(_0x3630c6){return _0x3630c6['destroy']()['then'](function(){_0x3e79a0[_0xe454('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10851d,_0x5e3577){return function(_0xa42c72){if(!_0xa42c72){_0x10851d[_0xe454('0x1c')](0x194);}return _0xa42c72;};}function handleError(_0x6665ee,_0x59a6d1){_0x59a6d1=_0x59a6d1||0x1f4;return function(_0x3352a8){logger[_0xe454('0x27')](_0x3352a8[_0xe454('0x28')]);if(_0x3352a8[_0xe454('0x29')]){delete _0x3352a8['name'];}_0x6665ee[_0xe454('0x1d')](_0x59a6d1)[_0xe454('0x2a')](_0x3352a8);};}exports[_0xe454('0x2b')]=function(_0x2551d1,_0x2fd131){var _0x1dcc63={},_0x56a48b={},_0x3300ba={'count':0x0,'rows':[]};var _0x1c2703=_[_0xe454('0x2c')](db[_0xe454('0x2d')][_0xe454('0x2e')],function(_0x4b9279){return{'name':_0x4b9279['fieldName'],'type':_0x4b9279[_0xe454('0x2f')]['key']};});_0x56a48b[_0xe454('0x30')]=_[_0xe454('0x2c')](_0x1c2703,'name');_0x56a48b[_0xe454('0x31')]=_['keys'](_0x2551d1[_0xe454('0x31')]);_0x56a48b['filters']=_[_0xe454('0x32')](_0x56a48b[_0xe454('0x30')],_0x56a48b[_0xe454('0x31')]);_0x1dcc63[_0xe454('0x33')]=_[_0xe454('0x32')](_0x56a48b['model'],qs['fields'](_0x2551d1[_0xe454('0x31')]['fields']));_0x1dcc63[_0xe454('0x33')]=_0x1dcc63[_0xe454('0x33')]['length']?_0x1dcc63[_0xe454('0x33')]:_0x56a48b[_0xe454('0x30')];if(!_0x2551d1[_0xe454('0x31')][_0xe454('0x34')](_0xe454('0x35'))){_0x1dcc63['limit']=qs[_0xe454('0x36')](_0x2551d1[_0xe454('0x31')][_0xe454('0x36')]);_0x1dcc63['offset']=qs[_0xe454('0x1e')](_0x2551d1[_0xe454('0x31')][_0xe454('0x1e')]);}_0x1dcc63[_0xe454('0x37')]=qs['sort'](_0x2551d1[_0xe454('0x31')][_0xe454('0x38')]);_0x1dcc63[_0xe454('0x39')]=qs['filters'](_['pick'](_0x2551d1[_0xe454('0x31')],_0x56a48b[_0xe454('0x3a')]),_0x1c2703);if(_0x2551d1[_0xe454('0x31')][_0xe454('0x3b')]){_0x1dcc63[_0xe454('0x39')]=_['merge'](_0x1dcc63[_0xe454('0x39')],{'$or':_[_0xe454('0x2c')](_0x1c2703,function(_0x35afe3){if(_0x35afe3[_0xe454('0x2f')]!==_0xe454('0x3c')){var _0x4dc910={};_0x4dc910[_0x35afe3['name']]={'$like':'%'+_0x2551d1['query'][_0xe454('0x3b')]+'%'};return _0x4dc910;}})});}_0x1dcc63=_['merge']({},_0x1dcc63,_0x2551d1['options']);var _0x10c447={'where':_0x1dcc63[_0xe454('0x39')]};return db['OpenchannelApplication'][_0xe454('0x20')](_0x10c447)[_0xe454('0x26')](function(_0x425502){_0x3300ba['count']=_0x425502;if(_0x2551d1[_0xe454('0x31')][_0xe454('0x3d')]){_0x1dcc63['include']=[{'all':!![]}];}return db[_0xe454('0x2d')]['findAll'](_0x1dcc63);})[_0xe454('0x26')](function(_0x5604de){_0x3300ba[_0xe454('0x3e')]=_0x5604de;return _0x3300ba;})['then'](respondWithFilteredResult(_0x2fd131,_0x1dcc63))[_0xe454('0x3f')](handleError(_0x2fd131,null));};exports[_0xe454('0x40')]=function(_0x61a48a,_0x1883a0){var _0x52b346={'raw':!![],'where':{'id':_0x61a48a[_0xe454('0x41')]['id']}},_0x3a57bc={};_0x3a57bc[_0xe454('0x30')]=_[_0xe454('0x42')](db['OpenchannelApplication'][_0xe454('0x2e')]);_0x3a57bc[_0xe454('0x31')]=_[_0xe454('0x42')](_0x61a48a[_0xe454('0x31')]);_0x3a57bc['filters']=_[_0xe454('0x32')](_0x3a57bc[_0xe454('0x30')],_0x3a57bc[_0xe454('0x31')]);_0x52b346['attributes']=_[_0xe454('0x32')](_0x3a57bc[_0xe454('0x30')],qs['fields'](_0x61a48a['query'][_0xe454('0x43')]));_0x52b346[_0xe454('0x33')]=_0x52b346[_0xe454('0x33')]['length']?_0x52b346[_0xe454('0x33')]:_0x3a57bc['model'];if(_0x61a48a[_0xe454('0x31')]['includeAll']){_0x52b346[_0xe454('0x44')]=[{'all':!![]}];}_0x52b346=_[_0xe454('0x45')]({},_0x52b346,_0x61a48a[_0xe454('0x46')]);return db[_0xe454('0x2d')]['find'](_0x52b346)[_0xe454('0x26')](handleEntityNotFound(_0x1883a0,null))[_0xe454('0x26')](respondWithResult(_0x1883a0,null))['catch'](handleError(_0x1883a0,null));};exports['create']=function(_0x2a359e,_0xc37182){return db[_0xe454('0x2d')][_0xe454('0x47')](_0x2a359e[_0xe454('0x48')],{})[_0xe454('0x26')](respondWithResult(_0xc37182,0xc9))['catch'](handleError(_0xc37182,null));};exports['update']=function(_0x32812d,_0x38db64){if(_0x32812d[_0xe454('0x48')]['id']){delete _0x32812d[_0xe454('0x48')]['id'];}return db[_0xe454('0x2d')][_0xe454('0x49')]({'where':{'id':_0x32812d['params']['id']}})[_0xe454('0x26')](handleEntityNotFound(_0x38db64,null))[_0xe454('0x26')](saveUpdates(_0x32812d['body'],null))['then'](respondWithResult(_0x38db64,null))[_0xe454('0x3f')](handleError(_0x38db64,null));};exports[_0xe454('0x4a')]=function(_0x5778ee,_0x5b58d0){return db[_0xe454('0x2d')][_0xe454('0x49')]({'where':{'id':_0x5778ee[_0xe454('0x41')]['id']}})[_0xe454('0x26')](handleEntityNotFound(_0x5b58d0,null))['then'](removeEntity(_0x5b58d0,null))['catch'](handleError(_0x5b58d0,null));}; \ No newline at end of file +var _0x343d=['include','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','jsforce','desk.js','../../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','count','reject','save','then','destroy','stack','name','index','OpenchannelApplication','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','catch','show','params'];(function(_0x9efaf0,_0x16e9fb){var _0x58306e=function(_0x342dfb){while(--_0x342dfb){_0x9efaf0['push'](_0x9efaf0['shift']());}};_0x58306e(++_0x16e9fb);}(_0x343d,0x1e0));var _0xd343=function(_0x456904,_0x4cb25c){_0x456904=_0x456904-0x0;var _0x4b0063=_0x343d[_0x456904];return _0x4b0063;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd343('0x0'));var zipdir=require(_0xd343('0x1'));var jsonpatch=require(_0xd343('0x2'));var rp=require(_0xd343('0x3'));var moment=require(_0xd343('0x4'));var BPromise=require(_0xd343('0x5'));var Mustache=require('mustache');var util=require(_0xd343('0x6'));var path=require('path');var sox=require(_0xd343('0x7'));var csv=require(_0xd343('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd343('0x9'));var squel=require(_0xd343('0xa'));var crypto=require('crypto');var jsforce=require(_0xd343('0xb'));var deskjs=require(_0xd343('0xc'));var toCsv=require(_0xd343('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd343('0xd'));var qs=require(_0xd343('0xe'));var as=require(_0xd343('0xf'));var hardwareService=require(_0xd343('0x10'));var logger=require('../../config/logger')(_0xd343('0x11'));var utils=require(_0xd343('0x12'));var config=require(_0xd343('0x13'));var licenseUtil=require(_0xd343('0x14'));var db=require(_0xd343('0x15'))['db'];function respondWithStatusCode(_0x5f1c5c,_0x566b6c){_0x566b6c=_0x566b6c||0xcc;return function(_0x1c6077){if(_0x1c6077){return _0x5f1c5c[_0xd343('0x16')](_0x566b6c);}return _0x5f1c5c['status'](_0x566b6c)[_0xd343('0x17')]();};}function respondWithResult(_0x469f26,_0x12cde5){_0x12cde5=_0x12cde5||0xc8;return function(_0xa35b09){if(_0xa35b09){return _0x469f26[_0xd343('0x18')](_0x12cde5)[_0xd343('0x19')](_0xa35b09);}};}function respondWithFilteredResult(_0x31e0fb,_0x41b70e){return function(_0x1e4c3b){if(_0x1e4c3b){var _0x39057e=typeof _0x41b70e[_0xd343('0x1a')]==='undefined'&&typeof _0x41b70e[_0xd343('0x1b')]==='undefined';var _0x1269cf=_0x1e4c3b[_0xd343('0x1c')];var _0x8c3b63=_0x39057e?0x0:_0x41b70e[_0xd343('0x1a')];var _0x3ed0ff=_0x39057e?_0x1e4c3b[_0xd343('0x1c')]:_0x41b70e[_0xd343('0x1a')]+_0x41b70e['limit'];var _0x54f6ff;if(_0x3ed0ff>=_0x1269cf){_0x3ed0ff=_0x1269cf;_0x54f6ff=0xc8;}else{_0x54f6ff=0xce;}_0x31e0fb[_0xd343('0x18')](_0x54f6ff);return _0x31e0fb['set']('Content-Range',_0x8c3b63+'-'+_0x3ed0ff+'/'+_0x1269cf)['json'](_0x1e4c3b);}return null;};}function patchUpdates(_0x298aa8){return function(_0x388253){try{jsonpatch['apply'](_0x388253,_0x298aa8,!![]);}catch(_0x5979d9){return BPromise[_0xd343('0x1d')](_0x5979d9);}return _0x388253[_0xd343('0x1e')]();};}function saveUpdates(_0x372be6,_0x4c9e9d){return function(_0x133029){if(_0x133029){return _0x133029['update'](_0x372be6)[_0xd343('0x1f')](function(_0x2a3f60){return _0x2a3f60;});}return null;};}function removeEntity(_0x43b2b3,_0x1cc1f0){return function(_0x1e4e48){if(_0x1e4e48){return _0x1e4e48[_0xd343('0x20')]()[_0xd343('0x1f')](function(){_0x43b2b3[_0xd343('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ccc5d,_0xea21fa){return function(_0xd098a){if(!_0xd098a){_0x5ccc5d[_0xd343('0x16')](0x194);}return _0xd098a;};}function handleError(_0x4ca8e3,_0x3db0bc){_0x3db0bc=_0x3db0bc||0x1f4;return function(_0x1c1b30){logger['error'](_0x1c1b30[_0xd343('0x21')]);if(_0x1c1b30[_0xd343('0x22')]){delete _0x1c1b30['name'];}_0x4ca8e3[_0xd343('0x18')](_0x3db0bc)['send'](_0x1c1b30);};}exports[_0xd343('0x23')]=function(_0x4840fb,_0x38df9d){var _0x1e040c={},_0x5ab092={},_0x16fb6f={'count':0x0,'rows':[]};var _0x435023=_['map'](db[_0xd343('0x24')][_0xd343('0x25')],function(_0x4b6b46){return{'name':_0x4b6b46[_0xd343('0x26')],'type':_0x4b6b46[_0xd343('0x27')][_0xd343('0x28')]};});_0x5ab092[_0xd343('0x29')]=_[_0xd343('0x2a')](_0x435023,'name');_0x5ab092[_0xd343('0x2b')]=_[_0xd343('0x2c')](_0x4840fb['query']);_0x5ab092[_0xd343('0x2d')]=_[_0xd343('0x2e')](_0x5ab092['model'],_0x5ab092[_0xd343('0x2b')]);_0x1e040c['attributes']=_[_0xd343('0x2e')](_0x5ab092['model'],qs[_0xd343('0x2f')](_0x4840fb[_0xd343('0x2b')][_0xd343('0x2f')]));_0x1e040c[_0xd343('0x30')]=_0x1e040c[_0xd343('0x30')][_0xd343('0x31')]?_0x1e040c['attributes']:_0x5ab092[_0xd343('0x29')];if(!_0x4840fb[_0xd343('0x2b')][_0xd343('0x32')](_0xd343('0x33'))){_0x1e040c[_0xd343('0x1b')]=qs[_0xd343('0x1b')](_0x4840fb[_0xd343('0x2b')][_0xd343('0x1b')]);_0x1e040c[_0xd343('0x1a')]=qs[_0xd343('0x1a')](_0x4840fb['query'][_0xd343('0x1a')]);}_0x1e040c[_0xd343('0x34')]=qs[_0xd343('0x35')](_0x4840fb[_0xd343('0x2b')][_0xd343('0x35')]);_0x1e040c[_0xd343('0x36')]=qs[_0xd343('0x2d')](_[_0xd343('0x37')](_0x4840fb['query'],_0x5ab092['filters']),_0x435023);if(_0x4840fb[_0xd343('0x2b')][_0xd343('0x38')]){_0x1e040c['where']=_['merge'](_0x1e040c['where'],{'$or':_[_0xd343('0x2a')](_0x435023,function(_0x10f316){if(_0x10f316['type']!==_0xd343('0x39')){var _0x461118={};_0x461118[_0x10f316[_0xd343('0x22')]]={'$like':'%'+_0x4840fb[_0xd343('0x2b')][_0xd343('0x38')]+'%'};return _0x461118;}})});}_0x1e040c=_['merge']({},_0x1e040c,_0x4840fb[_0xd343('0x3a')]);var _0x473711={'where':_0x1e040c[_0xd343('0x36')]};return db[_0xd343('0x24')][_0xd343('0x1c')](_0x473711)['then'](function(_0x3f2639){_0x16fb6f['count']=_0x3f2639;if(_0x4840fb['query'][_0xd343('0x3b')]){_0x1e040c['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0xd343('0x3c')](_0x1e040c);})[_0xd343('0x1f')](function(_0x5b5169){_0x16fb6f['rows']=_0x5b5169;return _0x16fb6f;})[_0xd343('0x1f')](respondWithFilteredResult(_0x38df9d,_0x1e040c))[_0xd343('0x3d')](handleError(_0x38df9d,null));};exports[_0xd343('0x3e')]=function(_0x35b7af,_0x1242eb){var _0x5d9cfb={'raw':!![],'where':{'id':_0x35b7af[_0xd343('0x3f')]['id']}},_0x25b1a5={};_0x25b1a5[_0xd343('0x29')]=_[_0xd343('0x2c')](db[_0xd343('0x24')][_0xd343('0x25')]);_0x25b1a5[_0xd343('0x2b')]=_[_0xd343('0x2c')](_0x35b7af[_0xd343('0x2b')]);_0x25b1a5[_0xd343('0x2d')]=_[_0xd343('0x2e')](_0x25b1a5[_0xd343('0x29')],_0x25b1a5[_0xd343('0x2b')]);_0x5d9cfb[_0xd343('0x30')]=_[_0xd343('0x2e')](_0x25b1a5['model'],qs[_0xd343('0x2f')](_0x35b7af['query'][_0xd343('0x2f')]));_0x5d9cfb['attributes']=_0x5d9cfb[_0xd343('0x30')][_0xd343('0x31')]?_0x5d9cfb[_0xd343('0x30')]:_0x25b1a5[_0xd343('0x29')];if(_0x35b7af['query']['includeAll']){_0x5d9cfb[_0xd343('0x40')]=[{'all':!![]}];}_0x5d9cfb=_['merge']({},_0x5d9cfb,_0x35b7af['options']);return db[_0xd343('0x24')][_0xd343('0x41')](_0x5d9cfb)[_0xd343('0x1f')](handleEntityNotFound(_0x1242eb,null))['then'](respondWithResult(_0x1242eb,null))[_0xd343('0x3d')](handleError(_0x1242eb,null));};exports[_0xd343('0x42')]=function(_0x4ecc4b,_0x556adb){return db['OpenchannelApplication'][_0xd343('0x42')](_0x4ecc4b[_0xd343('0x43')],{})[_0xd343('0x1f')](respondWithResult(_0x556adb,0xc9))['catch'](handleError(_0x556adb,null));};exports['update']=function(_0xc830e0,_0xc4dff4){if(_0xc830e0[_0xd343('0x43')]['id']){delete _0xc830e0[_0xd343('0x43')]['id'];}return db[_0xd343('0x24')][_0xd343('0x41')]({'where':{'id':_0xc830e0[_0xd343('0x3f')]['id']}})['then'](handleEntityNotFound(_0xc4dff4,null))[_0xd343('0x1f')](saveUpdates(_0xc830e0[_0xd343('0x43')],null))[_0xd343('0x1f')](respondWithResult(_0xc4dff4,null))[_0xd343('0x3d')](handleError(_0xc4dff4,null));};exports[_0xd343('0x20')]=function(_0x29469c,_0x227600){return db[_0xd343('0x24')][_0xd343('0x41')]({'where':{'id':_0x29469c['params']['id']}})[_0xd343('0x1f')](handleEntityNotFound(_0x227600,null))[_0xd343('0x1f')](removeEntity(_0x227600,null))['catch'](handleError(_0x227600,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 657b679..a3fdd41 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 _0x8097=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x2fb16e,_0x161667){var _0x5e0882=function(_0x4ed56d){while(--_0x4ed56d){_0x2fb16e['push'](_0x2fb16e['shift']());}};_0x5e0882(++_0x161667);}(_0x8097,0x1a0));var _0x7809=function(_0x37f731,_0x29a5a2){_0x37f731=_0x37f731-0x0;var _0x433120=_0x8097[_0x37f731];return _0x433120;};'use strict';var _=require(_0x7809('0x0'));var util=require(_0x7809('0x1'));var logger=require(_0x7809('0x2'))(_0x7809('0x3'));var moment=require(_0x7809('0x4'));var BPromise=require(_0x7809('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7809('0x6'));var rimraf=require(_0x7809('0x7'));var config=require(_0x7809('0x8'));var attributes=require(_0x7809('0x9'));module[_0x7809('0xa')]=function(_0x984846,_0x49a14a){return _0x984846[_0x7809('0xb')](_0x7809('0xc'),attributes,{'tableName':_0x7809('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7809('0xe'),'collate':_0x7809('0xf')});}; \ No newline at end of file +var _0x0856=['rimraf','./openchannelApplication.attributes','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0856,0x1d4));var _0x6085=function(_0x2fa313,_0xba5600){_0x2fa313=_0x2fa313-0x0;var _0x167ef5=_0x0856[_0x2fa313];return _0x167ef5;};'use strict';var _=require(_0x6085('0x0'));var util=require(_0x6085('0x1'));var logger=require(_0x6085('0x2'))(_0x6085('0x3'));var moment=require(_0x6085('0x4'));var BPromise=require(_0x6085('0x5'));var rp=require(_0x6085('0x6'));var fs=require('fs');var path=require(_0x6085('0x7'));var rimraf=require(_0x6085('0x8'));var config=require('../../config/environment');var attributes=require(_0x6085('0x9'));module['exports']=function(_0x5320ae,_0x2b0228){return _0x5320ae['define'](_0x6085('0xa'),attributes,{'tableName':_0x6085('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6085('0xc'),'collate':_0x6085('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 65be008..700dfce 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 _0xc662=['debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','UpdateOpenchannelApplication','OpenchannelApplication','body','options','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','OpenchannelApplication,\x20%s,\x20%s'];(function(_0x50def0,_0x52d982){var _0x14baf4=function(_0x2b5e1f){while(--_0x2b5e1f){_0x50def0['push'](_0x50def0['shift']());}};_0x14baf4(++_0x52d982);}(_0xc662,0x83));var _0x2c66=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xc662[_0x487b0c];return _0x1adbdc;};'use strict';var _=require(_0x2c66('0x0'));var util=require(_0x2c66('0x1'));var moment=require(_0x2c66('0x2'));var BPromise=require(_0x2c66('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c66('0x4'));var db=require(_0x2c66('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2c66('0x6'))(_0x2c66('0x7'));var config=require('../../config/environment');var jayson=require(_0x2c66('0x8'));var client=jayson[_0x2c66('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x425099,_0x1cb1da,_0x226f9e){return new BPromise(function(_0x5a410a,_0x30864e){return client[_0x2c66('0xa')](_0x425099,_0x226f9e)[_0x2c66('0xb')](function(_0x4006e6){logger[_0x2c66('0xc')](_0x2c66('0xd'),_0x1cb1da,'request\x20sent');logger[_0x2c66('0xe')](_0x2c66('0xf'),_0x1cb1da,_0x2c66('0x10'),JSON[_0x2c66('0x11')](_0x4006e6));if(_0x4006e6['error']){if(_0x4006e6['error'][_0x2c66('0x12')]===0x1f4){logger[_0x2c66('0x13')](_0x2c66('0xd'),_0x1cb1da,_0x4006e6[_0x2c66('0x13')][_0x2c66('0x14')]);return _0x30864e(_0x4006e6['error'][_0x2c66('0x14')]);}logger[_0x2c66('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0x1cb1da,_0x4006e6[_0x2c66('0x13')][_0x2c66('0x14')]);return _0x5a410a(_0x4006e6[_0x2c66('0x13')][_0x2c66('0x14')]);}else{logger['info'](_0x2c66('0xd'),_0x1cb1da,_0x2c66('0x10'));_0x5a410a(_0x4006e6['result']['message']);}})[_0x2c66('0x15')](function(_0x547599){logger[_0x2c66('0x13')](_0x2c66('0xd'),_0x1cb1da,_0x547599);_0x30864e(_0x547599);});});}exports[_0x2c66('0x16')]=function(_0x127b6f){var _0x4eab4d=this;return new Promise(function(_0x21b0a4,_0x4a938b){return db[_0x2c66('0x17')]['update'](_0x127b6f[_0x2c66('0x18')],{'raw':_0x127b6f['options']?_0x127b6f[_0x2c66('0x19')][_0x2c66('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x127b6f[_0x2c66('0x19')]?_0x127b6f[_0x2c66('0x19')][_0x2c66('0x1b')]||null:null,'attributes':_0x127b6f['options']?_0x127b6f[_0x2c66('0x19')]['attributes']||null:null,'limit':_0x127b6f[_0x2c66('0x19')]?_0x127b6f[_0x2c66('0x19')][_0x2c66('0x1c')]||null:null})[_0x2c66('0xb')](function(_0x269abf){logger[_0x2c66('0xc')]('UpdateOpenchannelApplication',_0x127b6f);logger['debug'](_0x2c66('0x16'),_0x127b6f,JSON[_0x2c66('0x11')](_0x269abf));_0x21b0a4(_0x269abf);})[_0x2c66('0x15')](function(_0xc049c8){logger['error']('UpdateOpenchannelApplication',_0xc049c8[_0x2c66('0x14')],_0x127b6f);_0x4a938b(_0x4eab4d[_0x2c66('0x13')](0x1f4,_0xc049c8[_0x2c66('0x14')]));});});}; \ No newline at end of file +var _0xc279=['catch','OpenchannelApplication','update','body','options','raw','where','attributes','limit','then','UpdateOpenchannelApplication','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xc279,0x90));var _0x9c27=function(_0x35798f,_0x26fbfc){_0x35798f=_0x35798f-0x0;var _0x7e116f=_0xc279[_0x35798f];return _0x7e116f;};'use strict';var _=require(_0x9c27('0x0'));var util=require('util');var moment=require(_0x9c27('0x1'));var BPromise=require('bluebird');var rs=require(_0x9c27('0x2'));var fs=require('fs');var Redis=require(_0x9c27('0x3'));var db=require(_0x9c27('0x4'))['db'];var utils=require(_0x9c27('0x5'));var logger=require(_0x9c27('0x6'))(_0x9c27('0x7'));var config=require(_0x9c27('0x8'));var jayson=require(_0x9c27('0x9'));var client=jayson[_0x9c27('0xa')][_0x9c27('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x374cb9,_0x26ad11,_0x5f881c){return new BPromise(function(_0x2f1c96,_0x4a50c7){return client[_0x9c27('0xc')](_0x374cb9,_0x5f881c)['then'](function(_0x3e0f9b){logger[_0x9c27('0xd')](_0x9c27('0xe'),_0x26ad11,'request\x20sent');logger[_0x9c27('0xf')](_0x9c27('0x10'),_0x26ad11,_0x9c27('0x11'),JSON['stringify'](_0x3e0f9b));if(_0x3e0f9b['error']){if(_0x3e0f9b[_0x9c27('0x12')]['code']===0x1f4){logger['error'](_0x9c27('0xe'),_0x26ad11,_0x3e0f9b[_0x9c27('0x12')]['message']);return _0x4a50c7(_0x3e0f9b[_0x9c27('0x12')][_0x9c27('0x13')]);}logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x26ad11,_0x3e0f9b[_0x9c27('0x12')]['message']);return _0x2f1c96(_0x3e0f9b[_0x9c27('0x12')][_0x9c27('0x13')]);}else{logger['info'](_0x9c27('0xe'),_0x26ad11,_0x9c27('0x11'));_0x2f1c96(_0x3e0f9b[_0x9c27('0x14')]['message']);}})[_0x9c27('0x15')](function(_0x1a529c){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x26ad11,_0x1a529c);_0x4a50c7(_0x1a529c);});});}exports['UpdateOpenchannelApplication']=function(_0xa9c078){var _0x4bfe4d=this;return new Promise(function(_0x214703,_0x53e718){return db[_0x9c27('0x16')][_0x9c27('0x17')](_0xa9c078[_0x9c27('0x18')],{'raw':_0xa9c078[_0x9c27('0x19')]?_0xa9c078['options'][_0x9c27('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa9c078[_0x9c27('0x19')]?_0xa9c078['options'][_0x9c27('0x1b')]||null:null,'attributes':_0xa9c078[_0x9c27('0x19')]?_0xa9c078['options'][_0x9c27('0x1c')]||null:null,'limit':_0xa9c078[_0x9c27('0x19')]?_0xa9c078[_0x9c27('0x19')][_0x9c27('0x1d')]||null:null})[_0x9c27('0x1e')](function(_0x581ffd){logger[_0x9c27('0xd')]('UpdateOpenchannelApplication',_0xa9c078);logger['debug'](_0x9c27('0x1f'),_0xa9c078,JSON[_0x9c27('0x20')](_0x581ffd));_0x214703(_0x581ffd);})[_0x9c27('0x15')](function(_0x2dfea0){logger['error'](_0x9c27('0x1f'),_0x2dfea0[_0x9c27('0x13')],_0xa9c078);_0x53e718(_0x4bfe4d[_0x9c27('0x12')](0x1f4,_0x2dfea0[_0x9c27('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index b14c9d7..b49fb4a 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 _0xe19a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','update','delete','openchannelinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout'];(function(_0x1f667b,_0x585190){var _0x15aee6=function(_0x188296){while(--_0x188296){_0x1f667b['push'](_0x1f667b['shift']());}};_0x15aee6(++_0x585190);}(_0xe19a,0x10c));var _0xae19=function(_0x606fe8,_0x10b084){_0x606fe8=_0x606fe8-0x0;var _0x28b517=_0xe19a[_0x606fe8];return _0x28b517;};'use strict';var multer=require(_0xae19('0x0'));var util=require(_0xae19('0x1'));var path=require(_0xae19('0x2'));var timeout=require(_0xae19('0x3'));var express=require(_0xae19('0x4'));var router=express[_0xae19('0x5')]();var fs_extra=require(_0xae19('0x6'));var auth=require(_0xae19('0x7'));var interaction=require(_0xae19('0x8'));var config=require(_0xae19('0x9'));var controller=require(_0xae19('0xa'));router['get']('/',auth[_0xae19('0xb')](),controller[_0xae19('0xc')]);router['get'](_0xae19('0xd'),auth[_0xae19('0xb')](),controller[_0xae19('0xe')]);router[_0xae19('0xf')](_0xae19('0x10'),auth[_0xae19('0xb')](),controller[_0xae19('0x11')]);router[_0xae19('0xf')](_0xae19('0x12'),auth[_0xae19('0xb')](),controller[_0xae19('0x13')]);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xae19('0x14')]('/',auth[_0xae19('0xb')](),controller[_0xae19('0x15')]);router[_0xae19('0x14')](_0xae19('0x12'),auth[_0xae19('0xb')](),controller[_0xae19('0x16')]);router['post'](_0xae19('0x17'),auth['isAuthenticated'](),interaction[_0xae19('0x18')](_0xae19('0x19'),_0xae19('0x1a')),controller[_0xae19('0x1b')]);router[_0xae19('0x1c')]('/:id',auth[_0xae19('0xb')](),interaction[_0xae19('0x18')](_0xae19('0x19'),'openchannelinteraction:update'),controller[_0xae19('0x1d')]);router[_0xae19('0x1e')](_0xae19('0x10'),auth['isAuthenticated'](),interaction['tracked']('openchannel',_0xae19('0x1f')),controller['destroy']);router[_0xae19('0x1e')](_0xae19('0x17'),auth[_0xae19('0xb')](),controller[_0xae19('0x20')]);module[_0xae19('0x21')]=router; \ No newline at end of file +var _0xcdab=['post','addMessage','/:id/tags','tracked','openchannel','addTags','put','/:id','openchannelinteraction:update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','/describe','describe','show','get','/:id/messages','/:id/download','download'];(function(_0x560a65,_0x53fde6){var _0xaa9c0c=function(_0x110973){while(--_0x110973){_0x560a65['push'](_0x560a65['shift']());}};_0xaa9c0c(++_0x53fde6);}(_0xcdab,0x1a1));var _0xbcda=function(_0x55b3b5,_0x254983){_0x55b3b5=_0x55b3b5-0x0;var _0x5297a9=_0xcdab[_0x55b3b5];return _0x5297a9;};'use strict';var multer=require(_0xbcda('0x0'));var util=require(_0xbcda('0x1'));var path=require(_0xbcda('0x2'));var timeout=require(_0xbcda('0x3'));var express=require('express');var router=express[_0xbcda('0x4')]();var fs_extra=require(_0xbcda('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbcda('0x6'));var controller=require(_0xbcda('0x7'));router['get']('/',auth[_0xbcda('0x8')](),controller[_0xbcda('0x9')]);router['get'](_0xbcda('0xa'),auth[_0xbcda('0x8')](),controller[_0xbcda('0xb')]);router['get']('/:id',auth[_0xbcda('0x8')](),controller[_0xbcda('0xc')]);router[_0xbcda('0xd')](_0xbcda('0xe'),auth['isAuthenticated'](),controller['getMessages']);router[_0xbcda('0xd')](_0xbcda('0xf'),auth['isAuthenticated'](),controller[_0xbcda('0x10')]);router[_0xbcda('0x11')]('/',auth[_0xbcda('0x8')](),controller['create']);router[_0xbcda('0x11')](_0xbcda('0xe'),auth['isAuthenticated'](),controller[_0xbcda('0x12')]);router['post'](_0xbcda('0x13'),auth[_0xbcda('0x8')](),interaction[_0xbcda('0x14')](_0xbcda('0x15'),'openchannelinteraction:addtags'),controller[_0xbcda('0x16')]);router[_0xbcda('0x17')](_0xbcda('0x18'),auth['isAuthenticated'](),interaction[_0xbcda('0x14')](_0xbcda('0x15'),_0xbcda('0x19')),controller['update']);router[_0xbcda('0x1a')](_0xbcda('0x18'),auth[_0xbcda('0x8')](),interaction[_0xbcda('0x14')](_0xbcda('0x15'),_0xbcda('0x1b')),controller[_0xbcda('0x1c')]);router[_0xbcda('0x1a')](_0xbcda('0x13'),auth[_0xbcda('0x8')](),controller[_0xbcda('0x1d')]);module[_0xbcda('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 b50416e..f21d0ad 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 _0xe126=['out','BOOLEAN','INTEGER','sequelize','exports','DATE','STRING','ENUM'];(function(_0xcf4569,_0x1ce755){var _0x7fef=function(_0x374ab8){while(--_0x374ab8){_0xcf4569['push'](_0xcf4569['shift']());}};_0x7fef(++_0x1ce755);}(_0xe126,0xeb));var _0x6e12=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0xe126[_0x87b0ff];return _0x3bc0b2;};'use strict';var Sequelize=require(_0x6e12('0x0'));module[_0x6e12('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6e12('0x2')]},'disposition':{'type':Sequelize[_0x6e12('0x3')]},'secondDisposition':{'type':Sequelize[_0x6e12('0x3')]},'thirdDisposition':{'type':Sequelize[_0x6e12('0x3')]},'note':{'type':Sequelize[_0x6e12('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x6e12('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x6e12('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x6e12('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x6e12('0x4')]('in',_0x6e12('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x6e12('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x6e12('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x6e12('0x7')]}}; \ No newline at end of file +var _0x2f38=['ENUM','BOOLEAN','INTEGER','exports','DATE','STRING','out'];(function(_0x456904,_0x4cb25c){var _0x4b0063=function(_0x2cb59f){while(--_0x2cb59f){_0x456904['push'](_0x456904['shift']());}};_0x4b0063(++_0x4cb25c);}(_0x2f38,0x1a7));var _0x82f3=function(_0x5af3b9,_0x434262){_0x5af3b9=_0x5af3b9-0x0;var _0x34160a=_0x2f38[_0x5af3b9];return _0x34160a;};'use strict';var Sequelize=require('sequelize');module[_0x82f3('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x82f3('0x1')]},'disposition':{'type':Sequelize[_0x82f3('0x2')]},'secondDisposition':{'type':Sequelize[_0x82f3('0x2')]},'thirdDisposition':{'type':Sequelize[_0x82f3('0x2')]},'note':{'type':Sequelize[_0x82f3('0x2')]},'read1stAt':{'type':Sequelize[_0x82f3('0x1')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x82f3('0x2')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x82f3('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x82f3('0x4')]('in',_0x82f3('0x3')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x82f3('0x2')]},'autoreplyExecuted':{'type':Sequelize[_0x82f3('0x5')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x82f3('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 88b0676..e760757 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 _0x7387=['OpenchannelMessage','omit','ids','getMessages','findOne','hasOwnProperty','nolimit','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','CmContact','Contact','Attachment','direction','secret','read','Account','Owner','fullname','get','mkdirSync','createdAt','toString','closed','threadId','Public','Private','Messages','existsSync','createReadStream','pipe','createWriteStream','basename','out','firstName','lastName','value','downloadInteraction.ejs','transcript-','.pdf','Openchannel','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','zip-dir','moment','ejs','../../components/interaction/service','../../components/export/pdf','../../config/logger','../../config/environment','redis','socket.io-emitter','./openchannelInteraction.socket','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','update','destroy','error','stack','name','send','index','map','OpenchannelInteraction','rawAttributes','fieldName','getOptions','openchannel','query','user','then','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','find','create','body','describe','addMessage'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0x7387,0xbe));var _0x7738=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x7387[_0x8c43de];return _0xa6591b;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x7738('0x0'));var moment=require(_0x7738('0x1'));var util=require('util');var path=require('path');var ejs=require(_0x7738('0x2'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0x7738('0x3'));var qs=require('../../components/parsers/qs');var pdf=require(_0x7738('0x4'));var logger=require(_0x7738('0x5'))('api');var config=require(_0x7738('0x6'));var db=require('../../mysqldb')['db'];config[_0x7738('0x7')]=_['defaults'](config[_0x7738('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x7738('0x8'))(new Redis(config[_0x7738('0x7')]));require(_0x7738('0x9'))['register'](socket);function respondWithStatusCode(_0x2c20c4,_0x24c120){_0x24c120=_0x24c120||0xcc;return function(_0x4fc03c){if(_0x4fc03c){return _0x2c20c4[_0x7738('0xa')](_0x24c120);}return _0x2c20c4[_0x7738('0xb')](_0x24c120)[_0x7738('0xc')]();};}function respondWithResult(_0x20ec9f,_0x39cecc){_0x39cecc=_0x39cecc||0xc8;return function(_0x146d3f){if(_0x146d3f){return _0x20ec9f[_0x7738('0xb')](_0x39cecc)[_0x7738('0xd')](_0x146d3f);}};}function respondWithFilteredResult(_0x38241c,_0x1b9e65){return function(_0x541d6f){if(_0x541d6f){var _0x4242f4=typeof _0x1b9e65['offset']===_0x7738('0xe')&&typeof _0x1b9e65['limit']===_0x7738('0xe');var _0x2ff62b=_0x541d6f[_0x7738('0xf')];var _0x5672be=_0x4242f4?0x0:_0x1b9e65[_0x7738('0x10')];var _0x2be2c1=_0x4242f4?_0x541d6f[_0x7738('0xf')]:_0x1b9e65['offset']+_0x1b9e65[_0x7738('0x11')];var _0x540573;if(_0x2be2c1>=_0x2ff62b){_0x2be2c1=_0x2ff62b;_0x540573=0xc8;}else{_0x540573=0xce;}_0x38241c[_0x7738('0xb')](_0x540573);return _0x38241c[_0x7738('0x12')](_0x7738('0x13'),_0x5672be+'-'+_0x2be2c1+'/'+_0x2ff62b)[_0x7738('0xd')](_0x541d6f);}return null;};}function saveUpdates(_0x275773){return function(_0x34eb9a){if(_0x34eb9a){return _0x34eb9a[_0x7738('0x14')](_0x275773)['then'](function(_0x48ca71){return _0x48ca71;});}return null;};}function removeEntity(_0x175583){return function(_0x24d6d5){if(_0x24d6d5){return _0x24d6d5[_0x7738('0x15')]()['then'](function(){_0x175583[_0x7738('0xb')](0xcc)[_0x7738('0xc')]();});}};}function handleEntityNotFound(_0x1b3e7a){return function(_0x5a635a){if(!_0x5a635a){_0x1b3e7a[_0x7738('0xa')](0x194);}return _0x5a635a;};}function handleError(_0x440515,_0x23984d){_0x23984d=_0x23984d||0x1f4;return function(_0x41d718){logger[_0x7738('0x16')](_0x41d718[_0x7738('0x17')]);if(_0x41d718[_0x7738('0x18')]){delete _0x41d718[_0x7738('0x18')];}_0x440515[_0x7738('0xb')](_0x23984d)[_0x7738('0x19')](_0x41d718);};}exports[_0x7738('0x1a')]=function(_0x4cd777,_0x131df7){var _0x5d3710={};var _0x496eaa=_[_0x7738('0x1b')](db[_0x7738('0x1c')][_0x7738('0x1d')],function(_0x409ec4){return{'name':_0x409ec4[_0x7738('0x1e')],'type':_0x409ec4['type']['key']};});_0x5d3710=qs[_0x7738('0x1f')](_0x496eaa,_0x4cd777);return interaction['findAll'](_0x7738('0x20'),_0x4cd777[_0x7738('0x21')],_0x4cd777[_0x7738('0x22')],_0x5d3710,_0x496eaa)[_0x7738('0x23')](respondWithFilteredResult(_0x131df7,_0x5d3710))[_0x7738('0x24')](handleError(_0x131df7,null));};exports[_0x7738('0x25')]=function(_0x5b6697,_0x2ff730){var _0x15ee0a={};if(_0x5b6697['query']['type']&&_0x5b6697[_0x7738('0x21')]['type']==='from'){_0x15ee0a['from']=_0x5b6697['params']['id'];}else{_0x15ee0a['id']=_0x5b6697[_0x7738('0x26')]['id'];}var _0x31f973={'raw':![],'where':_0x15ee0a},_0x14b85b={};_0x14b85b[_0x7738('0x27')]=_[_0x7738('0x28')](db['OpenchannelInteraction'][_0x7738('0x1d')]);_0x14b85b[_0x7738('0x21')]=_[_0x7738('0x28')](_0x5b6697[_0x7738('0x21')]);_0x14b85b[_0x7738('0x29')]=_[_0x7738('0x2a')](_0x14b85b[_0x7738('0x27')],_0x14b85b[_0x7738('0x21')]);_0x31f973[_0x7738('0x2b')]=_['intersection'](_0x14b85b[_0x7738('0x27')],qs['fields'](_0x5b6697[_0x7738('0x21')][_0x7738('0x2c')]));_0x31f973['attributes']=_0x31f973[_0x7738('0x2b')][_0x7738('0x2d')]?_0x31f973[_0x7738('0x2b')]:_0x14b85b['model'];if(_0x5b6697[_0x7738('0x21')][_0x7738('0x2e')]){_0x31f973[_0x7738('0x2f')]=[{'all':!![]}];}_0x31f973=_[_0x7738('0x30')]({},_0x31f973,_0x5b6697['options']);return db[_0x7738('0x1c')][_0x7738('0x31')](_0x31f973)[_0x7738('0x23')](handleEntityNotFound(_0x2ff730,null))[_0x7738('0x23')](respondWithResult(_0x2ff730,null))[_0x7738('0x24')](handleError(_0x2ff730,null));};exports[_0x7738('0x32')]=function(_0x4c503d,_0x258f42){return db[_0x7738('0x1c')][_0x7738('0x32')](_0x4c503d[_0x7738('0x33')],{})['then'](respondWithResult(_0x258f42,0xc9))['catch'](handleError(_0x258f42,null));};exports[_0x7738('0x14')]=function(_0x3e5dc8,_0x465cda){if(_0x3e5dc8[_0x7738('0x33')]['id']){delete _0x3e5dc8[_0x7738('0x33')]['id'];}return db[_0x7738('0x1c')][_0x7738('0x31')]({'where':{'id':_0x3e5dc8[_0x7738('0x26')]['id']}})[_0x7738('0x23')](handleEntityNotFound(_0x465cda,null))[_0x7738('0x23')](saveUpdates(_0x3e5dc8['body'],null))[_0x7738('0x23')](respondWithResult(_0x465cda,null))[_0x7738('0x24')](handleError(_0x465cda,null));};exports[_0x7738('0x15')]=function(_0x3fb022,_0x3db669){return db[_0x7738('0x1c')][_0x7738('0x31')]({'where':{'id':_0x3fb022[_0x7738('0x26')]['id']}})[_0x7738('0x23')](handleEntityNotFound(_0x3db669,null))['then'](removeEntity(_0x3db669,null))[_0x7738('0x24')](handleError(_0x3db669,null));};exports[_0x7738('0x34')]=function(_0x249e22,_0x41eea7){return db[_0x7738('0x1c')][_0x7738('0x34')]()['then'](respondWithResult(_0x41eea7,null))[_0x7738('0x24')](handleError(_0x41eea7,null));};exports[_0x7738('0x35')]=function(_0x49a462,_0x63d49){return db[_0x7738('0x36')][_0x7738('0x31')]({'where':{'id':_0x49a462[_0x7738('0x26')]['id']}})['then'](handleEntityNotFound(_0x63d49,null))[_0x7738('0x23')](function(_0x47c2f7){if(_0x47c2f7){return _0x47c2f7[_0x7738('0x35')](_0x49a462[_0x7738('0x33')]['ids'],_[_0x7738('0x37')](_0x49a462[_0x7738('0x33')],[_0x7738('0x38'),'id'])||{});}})['then'](respondWithResult(_0x63d49,null))[_0x7738('0x24')](handleError(_0x63d49,null));};exports[_0x7738('0x39')]=function(_0x16467d,_0x3a7cf8){var _0x429623={'raw':![],'where':{}};var _0x4706e8={};var _0xa05a37={'count':0x0,'rows':[]};return db[_0x7738('0x1c')][_0x7738('0x3a')]({'where':{'id':_0x16467d['params']['id']}})[_0x7738('0x23')](handleEntityNotFound(_0x3a7cf8,null))[_0x7738('0x23')](function(_0x209764){if(_0x209764){_0x4706e8[_0x7738('0x27')]=_['keys'](db[_0x7738('0x36')][_0x7738('0x1d')]);_0x4706e8[_0x7738('0x21')]=_[_0x7738('0x28')](_0x16467d[_0x7738('0x21')]);_0x4706e8[_0x7738('0x29')]=_[_0x7738('0x2a')](_0x4706e8[_0x7738('0x27')],_0x4706e8['query']);_0x429623[_0x7738('0x2b')]=_[_0x7738('0x2a')](_0x4706e8[_0x7738('0x27')],qs[_0x7738('0x2c')](_0x16467d['query'][_0x7738('0x2c')]));_0x429623[_0x7738('0x2b')]=_0x429623[_0x7738('0x2b')][_0x7738('0x2d')]?_0x429623['attributes']:_0x4706e8[_0x7738('0x27')];if(!_0x16467d[_0x7738('0x21')][_0x7738('0x3b')](_0x7738('0x3c'))){_0x429623['limit']=qs[_0x7738('0x11')](_0x16467d[_0x7738('0x21')]['limit']);_0x429623['offset']=qs[_0x7738('0x10')](_0x16467d[_0x7738('0x21')][_0x7738('0x10')]);}_0x429623['order']=qs[_0x7738('0x3d')](_0x16467d[_0x7738('0x21')]['sort']);_0x429623[_0x7738('0x3e')]=qs[_0x7738('0x29')](_[_0x7738('0x3f')](_0x16467d['query'],_0x4706e8['filters']));_0x429623[_0x7738('0x3e')][_0x7738('0x40')]=_0x209764['id'];if(_0x16467d[_0x7738('0x21')][_0x7738('0x41')]){_0x429623[_0x7738('0x3e')]=_[_0x7738('0x30')](_0x429623['where'],{'$or':_[_0x7738('0x1b')](_0x429623[_0x7738('0x2b')],function(_0x11e4d6){var _0x5e04c0={};_0x5e04c0[_0x11e4d6]={'$like':'%'+_0x16467d[_0x7738('0x21')][_0x7738('0x41')]+'%'};return _0x5e04c0;})});}if(_0x16467d['query']['$gte']){var _0x166da0=_0x16467d[_0x7738('0x21')][_0x7738('0x42')][_0x7738('0x43')](',');var _0x5f3f57={};_0x5f3f57[_0x166da0[0x0]]={'$gte':moment(_0x166da0[0x1])[_0x7738('0x44')](_0x7738('0x45'))};_0x429623[_0x7738('0x3e')]=_[_0x7738('0x30')](_0x429623[_0x7738('0x3e')],_0x5f3f57);}_0x429623=_[_0x7738('0x30')]({},_0x429623,_0x16467d[_0x7738('0x46')]);return db['OpenchannelMessage']['count']({'where':_0x429623[_0x7738('0x3e')]})[_0x7738('0x23')](function(_0xe9372c){_0xa05a37[_0x7738('0xf')]=_0xe9372c;if(_0x16467d[_0x7738('0x21')][_0x7738('0x2e')]){_0x429623['include']=[{'all':!![]}];}return db[_0x7738('0x36')][_0x7738('0x47')](_0x429623);})[_0x7738('0x23')](function(_0x51300c){_0xa05a37['rows']=_0x51300c;return _0xa05a37;});}})['then'](respondWithFilteredResult(_0x3a7cf8,_0x429623))['catch'](handleError(_0x3a7cf8,null));};exports[_0x7738('0x48')]=function(_0x960d00,_0xee7752){return db['OpenchannelInteraction'][_0x7738('0x31')]({'where':{'id':_0x960d00['params']['id']}})[_0x7738('0x23')](handleEntityNotFound(_0xee7752,null))[_0x7738('0x23')](function(_0x2fd301){if(_0x2fd301){return _0x2fd301['setTags'](_0x960d00[_0x7738('0x33')][_0x7738('0x38')],_[_0x7738('0x37')](_0x960d00['body'],[_0x7738('0x38'),'id'])||{})[_0x7738('0x49')](function(){return db[_0x7738('0x4a')][_0x7738('0x47')]({'attributes':['id',_0x7738('0x18'),_0x7738('0x4b')],'where':{'id':_0x960d00[_0x7738('0x33')][_0x7738('0x38')]}});})[_0x7738('0x23')](function(_0x234a1e){socket[_0x7738('0x4c')](_0x7738('0x4d'),{'id':Number(_0x960d00[_0x7738('0x26')]['id']),'tags':_0x234a1e||[]});return{'id':Number(_0x960d00['params']['id']),'tags':_0x234a1e||[]};});}})[_0x7738('0x23')](respondWithResult(_0xee7752,null))[_0x7738('0x24')](handleError(_0xee7752,null));};exports[_0x7738('0x4e')]=function(_0x3aa879,_0x145b02){return db[_0x7738('0x1c')][_0x7738('0x31')]({'where':{'id':_0x3aa879['params']['id']}})[_0x7738('0x23')](handleEntityNotFound(_0x145b02,null))[_0x7738('0x23')](function(_0x32accf){if(_0x32accf){return _0x32accf[_0x7738('0x4e')](_0x3aa879['query'][_0x7738('0x38')]);}})[_0x7738('0x23')](respondWithStatusCode(_0x145b02,null))[_0x7738('0x24')](handleError(_0x145b02,null));};exports['download']=function(_0x21f287,_0x2f3215){var _0x3834c7=moment()[_0x7738('0x4f')]()['toString']();var _0x23008d=path[_0x7738('0x50')](config[_0x7738('0x51')],_0x7738('0x52'),_0x7738('0x53'),_0x7738('0x54'));var _0x249f00=path['join'](config['root'],_0x7738('0x52'),'files',_0x7738('0x55'));var _0x3756b8=path[_0x7738('0x50')](_0x23008d,_0x3834c7);var _0x179728=util['format'](_0x7738('0x56'),_0x21f287[_0x7738('0x26')]['id'],_0x3834c7);var _0x44a8e5=path[_0x7738('0x50')](_0x23008d,_0x179728);var _0x1c8a7b=[];_0x1c8a7b[_0x7738('0x57')]({'model':db[_0x7738('0x58')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x1c8a7b[_0x7738('0x57')]({'model':db[_0x7738('0x59')],'as':_0x7738('0x5a'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x21f287[_0x7738('0x21')][_0x7738('0x55')]){_0x1c8a7b[_0x7738('0x57')]({'model':db['Attachment'],'as':_0x7738('0x5b'),'raw':!![]});}var _0xbc7172=[{'model':db[_0x7738('0x36')],'as':'Messages','attributes':['id',_0x7738('0x33'),'createdAt',_0x7738('0x5c'),_0x7738('0x5d'),_0x7738('0x5e')],'include':_0x1c8a7b}];_0xbc7172[_0x7738('0x57')]({'model':db['OpenchannelAccount'],'as':_0x7738('0x5f'),'attributes':['id',_0x7738('0x18')]});_0xbc7172[_0x7738('0x57')]({'model':db[_0x7738('0x58')],'as':_0x7738('0x60'),'attributes':['id',_0x7738('0x61')]});return db[_0x7738('0x1c')]['find']({'where':{'id':_0x21f287[_0x7738('0x26')]['id']},'include':_0xbc7172})[_0x7738('0x23')](handleEntityNotFound(_0x2f3215,null))[_0x7738('0x23')](function(_0x484431){if(_0x484431){var _0x2ee34c=_0x484431[_0x7738('0x62')]({'plain':!![]});fs[_0x7738('0x63')](_0x3756b8);var _0x3c02bc={'channel':'Openchannel','account':_0x2ee34c[_0x7738('0x5f')][_0x7738('0x18')],'agent':_0x2ee34c[_0x7738('0x60')]?_0x2ee34c['Owner'][_0x7738('0x61')]:'N.A.','createdAt':moment(_0x2ee34c[_0x7738('0x64')])[_0x7738('0x44')](_0x7738('0x45'))[_0x7738('0x65')](),'closedAt':_0x2ee34c[_0x7738('0x66')]?moment(_0x2ee34c['closedAt'])[_0x7738('0x44')](_0x7738('0x45'))[_0x7738('0x65')]():'','disposition':_0x2ee34c['disposition'],'visibility':_0x2ee34c[_0x7738('0x67')]?_0x7738('0x68'):_0x7738('0x69'),'messages':_(_0x2ee34c[_0x7738('0x6a')])[_0x7738('0x41')]({'secret':![]})[_0x7738('0x1b')](function(_0x244b15){if(_0x244b15[_0x7738('0x5b')]){var _0x5a087e=path[_0x7738('0x50')](_0x249f00,_0x244b15['Attachment']['basename']);if(fs[_0x7738('0x6b')](_0x5a087e)){fs[_0x7738('0x6c')](_0x5a087e)[_0x7738('0x6d')](fs[_0x7738('0x6e')](path['join'](_0x3756b8,_0x244b15[_0x7738('0x5b')][_0x7738('0x6f')])));}}return{'date':moment(_0x244b15[_0x7738('0x64')])[_0x7738('0x44')](_0x7738('0x45'))[_0x7738('0x65')](),'sender':_0x244b15['direction']===_0x7738('0x70')?_0x244b15[_0x7738('0x58')]?_0x244b15[_0x7738('0x58')][_0x7738('0x61')]:'System':_0x244b15[_0x7738('0x5a')][_0x7738('0x71')]+(_0x244b15[_0x7738('0x5a')][_0x7738('0x72')]?'\x20'+_0x244b15[_0x7738('0x5a')][_0x7738('0x72')]:''),'body':_0x244b15[_0x7738('0x5b')]?_0x244b15[_0x7738('0x5b')]['basename']:_0x244b15[_0x7738('0x33')],'direction':_0x244b15['direction']===_0x7738('0x70')?'A':'C','secret':_0x244b15[_0x7738('0x5d')],'read':_0x244b15[_0x7738('0x5e')],'attachment':_0x244b15[_0x7738('0x5b')]};})[_0x7738('0x73')]()};return ejs['renderFile'](path[_0x7738('0x50')](config[_0x7738('0x51')],_0x7738('0x52'),'views',_0x7738('0x74')),{'interaction':_0x3c02bc})[_0x7738('0x23')](function(_0x1a021e){var _0x3bdf0c=path['join'](_0x3756b8,_0x7738('0x75')+_0x2ee34c['id']+'-'+_0x3834c7+_0x7738('0x76'));var _0x2cae38={'path':_0x3bdf0c,'channel':_0x7738('0x77'),'interactionId':_0x2ee34c['id']};return pdf['createPdfFromHTML'](_0x1a021e,_0x2cae38);})[_0x7738('0x23')](function(){return new Promise(function(_0x423e58,_0x55cbad){zipdir(_0x3756b8,{'saveTo':_0x44a8e5},function(_0x2ecccd,_0x16aa9a){if(_0x2ecccd)return _0x55cbad(_0x2ecccd);return _0x423e58(_0x16aa9a);});})['then'](function(){return new Promise(function(_0x400b0e,_0x4d0b8b){rimraf(_0x3756b8,function(_0x540c7a){if(_0x540c7a)_0x4d0b8b(_0x540c7a);return _0x400b0e();});});})[_0x7738('0x23')](function(){return _0x2f3215['download'](_0x44a8e5,_0x179728,function(_0x5cce11){if(_0x5cce11){logger[_0x7738('0x16')](_0x7738('0x78'),_0x5cce11);}else{fs[_0x7738('0x79')](_0x44a8e5);}});});});}else{return _0x2f3215[_0x7738('0xa')](0xc8);}})[_0x7738('0x24')](handleError(_0x2f3215,null));}; \ No newline at end of file +var _0x37e4=['include','merge','options','find','create','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','filters','hasOwnProperty','nolimit','order','sort','where','OpenchannelInteractionId','filter','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','files','tmp','server','attachments','format','transcript-%d-%s.zip','User','push','CmContact','Contact','firstName','lastName','Attachment','createdAt','direction','secret','read','Account','fullname','mkdirSync','Openchannel','Owner','closedAt','threadId','Public','basename','existsSync','createReadStream','pipe','createWriteStream','System','out','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','unlinkSync','rimraf','zip-dir','path','ejs','../../components/interaction/service','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','getOptions','findAll','openchannel','query','catch','show','from','params','model','OpenchannelInteraction','keys','intersection','attributes','fields','length','includeAll'];(function(_0x159a17,_0x5a10d9){var _0x57c17b=function(_0x147c55){while(--_0x147c55){_0x159a17['push'](_0x159a17['shift']());}};_0x57c17b(++_0x5a10d9);}(_0x37e4,0x153));var _0x437e=function(_0x26dba3,_0x31408f){_0x26dba3=_0x26dba3-0x0;var _0x25726c=_0x37e4[_0x26dba3];return _0x25726c;};'use strict';var rimraf=require(_0x437e('0x0'));var zipdir=require(_0x437e('0x1'));var moment=require('moment');var util=require('util');var path=require(_0x437e('0x2'));var ejs=require(_0x437e('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0x437e('0x4'));var qs=require('../../components/parsers/qs');var pdf=require(_0x437e('0x5'));var logger=require(_0x437e('0x6'))('api');var config=require(_0x437e('0x7'));var db=require(_0x437e('0x8'))['db'];config[_0x437e('0x9')]=_[_0x437e('0xa')](config[_0x437e('0x9')],{'host':_0x437e('0xb'),'port':0x18eb});var socket=require(_0x437e('0xc'))(new Redis(config[_0x437e('0x9')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0x2b3038,_0x41f57e){_0x41f57e=_0x41f57e||0xcc;return function(_0x3f14cf){if(_0x3f14cf){return _0x2b3038[_0x437e('0xd')](_0x41f57e);}return _0x2b3038[_0x437e('0xe')](_0x41f57e)[_0x437e('0xf')]();};}function respondWithResult(_0x83ee2a,_0x2e376d){_0x2e376d=_0x2e376d||0xc8;return function(_0x46c0f6){if(_0x46c0f6){return _0x83ee2a['status'](_0x2e376d)['json'](_0x46c0f6);}};}function respondWithFilteredResult(_0x51659d,_0x36d78c){return function(_0x2da5e8){if(_0x2da5e8){var _0x48d27a=typeof _0x36d78c['offset']==='undefined'&&typeof _0x36d78c[_0x437e('0x10')]===_0x437e('0x11');var _0x23d106=_0x2da5e8[_0x437e('0x12')];var _0x4264c4=_0x48d27a?0x0:_0x36d78c[_0x437e('0x13')];var _0x2f94e4=_0x48d27a?_0x2da5e8[_0x437e('0x12')]:_0x36d78c['offset']+_0x36d78c[_0x437e('0x10')];var _0x4133a8;if(_0x2f94e4>=_0x23d106){_0x2f94e4=_0x23d106;_0x4133a8=0xc8;}else{_0x4133a8=0xce;}_0x51659d[_0x437e('0xe')](_0x4133a8);return _0x51659d[_0x437e('0x14')](_0x437e('0x15'),_0x4264c4+'-'+_0x2f94e4+'/'+_0x23d106)[_0x437e('0x16')](_0x2da5e8);}return null;};}function saveUpdates(_0x375149){return function(_0xaad207){if(_0xaad207){return _0xaad207[_0x437e('0x17')](_0x375149)[_0x437e('0x18')](function(_0x2a3cc3){return _0x2a3cc3;});}return null;};}function removeEntity(_0x3ea783){return function(_0x293b81){if(_0x293b81){return _0x293b81[_0x437e('0x19')]()['then'](function(){_0x3ea783[_0x437e('0xe')](0xcc)[_0x437e('0xf')]();});}};}function handleEntityNotFound(_0x28fd8c){return function(_0x2ed79a){if(!_0x2ed79a){_0x28fd8c[_0x437e('0xd')](0x194);}return _0x2ed79a;};}function handleError(_0x56da93,_0x1d188e){_0x1d188e=_0x1d188e||0x1f4;return function(_0x5a9fd0){logger[_0x437e('0x1a')](_0x5a9fd0[_0x437e('0x1b')]);if(_0x5a9fd0[_0x437e('0x1c')]){delete _0x5a9fd0[_0x437e('0x1c')];}_0x56da93[_0x437e('0xe')](_0x1d188e)[_0x437e('0x1d')](_0x5a9fd0);};}exports[_0x437e('0x1e')]=function(_0x11220f,_0x8dc487){var _0x58661a={};var _0x21ce42=_['map'](db['OpenchannelInteraction'][_0x437e('0x1f')],function(_0x133e34){return{'name':_0x133e34[_0x437e('0x20')],'type':_0x133e34[_0x437e('0x21')][_0x437e('0x22')]};});_0x58661a=qs[_0x437e('0x23')](_0x21ce42,_0x11220f);return interaction[_0x437e('0x24')](_0x437e('0x25'),_0x11220f[_0x437e('0x26')],_0x11220f['user'],_0x58661a,_0x21ce42)['then'](respondWithFilteredResult(_0x8dc487,_0x58661a))[_0x437e('0x27')](handleError(_0x8dc487,null));};exports[_0x437e('0x28')]=function(_0xbb13a8,_0x2a45ba){var _0x3d697b={};if(_0xbb13a8[_0x437e('0x26')][_0x437e('0x21')]&&_0xbb13a8[_0x437e('0x26')]['type']===_0x437e('0x29')){_0x3d697b['from']=_0xbb13a8[_0x437e('0x2a')]['id'];}else{_0x3d697b['id']=_0xbb13a8[_0x437e('0x2a')]['id'];}var _0x13760a={'raw':![],'where':_0x3d697b},_0x599d33={};_0x599d33[_0x437e('0x2b')]=_['keys'](db[_0x437e('0x2c')][_0x437e('0x1f')]);_0x599d33['query']=_[_0x437e('0x2d')](_0xbb13a8[_0x437e('0x26')]);_0x599d33['filters']=_[_0x437e('0x2e')](_0x599d33[_0x437e('0x2b')],_0x599d33['query']);_0x13760a[_0x437e('0x2f')]=_['intersection'](_0x599d33[_0x437e('0x2b')],qs[_0x437e('0x30')](_0xbb13a8[_0x437e('0x26')][_0x437e('0x30')]));_0x13760a[_0x437e('0x2f')]=_0x13760a['attributes'][_0x437e('0x31')]?_0x13760a[_0x437e('0x2f')]:_0x599d33['model'];if(_0xbb13a8[_0x437e('0x26')][_0x437e('0x32')]){_0x13760a[_0x437e('0x33')]=[{'all':!![]}];}_0x13760a=_[_0x437e('0x34')]({},_0x13760a,_0xbb13a8[_0x437e('0x35')]);return db['OpenchannelInteraction'][_0x437e('0x36')](_0x13760a)[_0x437e('0x18')](handleEntityNotFound(_0x2a45ba,null))[_0x437e('0x18')](respondWithResult(_0x2a45ba,null))[_0x437e('0x27')](handleError(_0x2a45ba,null));};exports[_0x437e('0x37')]=function(_0x53a76c,_0x235a0e){return db[_0x437e('0x2c')][_0x437e('0x37')](_0x53a76c[_0x437e('0x38')],{})[_0x437e('0x18')](respondWithResult(_0x235a0e,0xc9))[_0x437e('0x27')](handleError(_0x235a0e,null));};exports[_0x437e('0x17')]=function(_0x5e6147,_0x3a9ecc){if(_0x5e6147[_0x437e('0x38')]['id']){delete _0x5e6147[_0x437e('0x38')]['id'];}return db[_0x437e('0x2c')][_0x437e('0x36')]({'where':{'id':_0x5e6147[_0x437e('0x2a')]['id']}})[_0x437e('0x18')](handleEntityNotFound(_0x3a9ecc,null))[_0x437e('0x18')](saveUpdates(_0x5e6147[_0x437e('0x38')],null))['then'](respondWithResult(_0x3a9ecc,null))[_0x437e('0x27')](handleError(_0x3a9ecc,null));};exports['destroy']=function(_0x3d09ec,_0x4b5dda){return db['OpenchannelInteraction'][_0x437e('0x36')]({'where':{'id':_0x3d09ec[_0x437e('0x2a')]['id']}})[_0x437e('0x18')](handleEntityNotFound(_0x4b5dda,null))[_0x437e('0x18')](removeEntity(_0x4b5dda,null))[_0x437e('0x27')](handleError(_0x4b5dda,null));};exports[_0x437e('0x39')]=function(_0x1bbe5e,_0x595d9a){return db[_0x437e('0x2c')]['describe']()['then'](respondWithResult(_0x595d9a,null))[_0x437e('0x27')](handleError(_0x595d9a,null));};exports[_0x437e('0x3a')]=function(_0x555ff9,_0x22c13f){return db[_0x437e('0x3b')][_0x437e('0x36')]({'where':{'id':_0x555ff9['params']['id']}})[_0x437e('0x18')](handleEntityNotFound(_0x22c13f,null))['then'](function(_0x367419){if(_0x367419){return _0x367419[_0x437e('0x3a')](_0x555ff9[_0x437e('0x38')][_0x437e('0x3c')],_[_0x437e('0x3d')](_0x555ff9[_0x437e('0x38')],[_0x437e('0x3c'),'id'])||{});}})['then'](respondWithResult(_0x22c13f,null))[_0x437e('0x27')](handleError(_0x22c13f,null));};exports[_0x437e('0x3e')]=function(_0x28a26a,_0x568ccd){var _0x5f4fa6={'raw':![],'where':{}};var _0x46779e={};var _0x2384d4={'count':0x0,'rows':[]};return db[_0x437e('0x2c')][_0x437e('0x3f')]({'where':{'id':_0x28a26a[_0x437e('0x2a')]['id']}})[_0x437e('0x18')](handleEntityNotFound(_0x568ccd,null))['then'](function(_0x2fa90f){if(_0x2fa90f){_0x46779e[_0x437e('0x2b')]=_[_0x437e('0x2d')](db[_0x437e('0x3b')][_0x437e('0x1f')]);_0x46779e[_0x437e('0x26')]=_['keys'](_0x28a26a['query']);_0x46779e[_0x437e('0x40')]=_[_0x437e('0x2e')](_0x46779e['model'],_0x46779e[_0x437e('0x26')]);_0x5f4fa6[_0x437e('0x2f')]=_['intersection'](_0x46779e[_0x437e('0x2b')],qs[_0x437e('0x30')](_0x28a26a['query'][_0x437e('0x30')]));_0x5f4fa6[_0x437e('0x2f')]=_0x5f4fa6[_0x437e('0x2f')][_0x437e('0x31')]?_0x5f4fa6['attributes']:_0x46779e[_0x437e('0x2b')];if(!_0x28a26a[_0x437e('0x26')][_0x437e('0x41')](_0x437e('0x42'))){_0x5f4fa6['limit']=qs[_0x437e('0x10')](_0x28a26a[_0x437e('0x26')][_0x437e('0x10')]);_0x5f4fa6[_0x437e('0x13')]=qs['offset'](_0x28a26a['query'][_0x437e('0x13')]);}_0x5f4fa6[_0x437e('0x43')]=qs[_0x437e('0x44')](_0x28a26a[_0x437e('0x26')]['sort']);_0x5f4fa6[_0x437e('0x45')]=qs['filters'](_['pick'](_0x28a26a[_0x437e('0x26')],_0x46779e[_0x437e('0x40')]));_0x5f4fa6['where'][_0x437e('0x46')]=_0x2fa90f['id'];if(_0x28a26a[_0x437e('0x26')][_0x437e('0x47')]){_0x5f4fa6[_0x437e('0x45')]=_['merge'](_0x5f4fa6['where'],{'$or':_[_0x437e('0x48')](_0x5f4fa6[_0x437e('0x2f')],function(_0x546c35){var _0x5cd03d={};_0x5cd03d[_0x546c35]={'$like':'%'+_0x28a26a[_0x437e('0x26')][_0x437e('0x47')]+'%'};return _0x5cd03d;})});}if(_0x28a26a[_0x437e('0x26')]['$gte']){var _0x18b33c=_0x28a26a[_0x437e('0x26')][_0x437e('0x49')][_0x437e('0x4a')](',');var _0x92de98={};_0x92de98[_0x18b33c[0x0]]={'$gte':moment(_0x18b33c[0x1])['format'](_0x437e('0x4b'))};_0x5f4fa6[_0x437e('0x45')]=_['merge'](_0x5f4fa6[_0x437e('0x45')],_0x92de98);}_0x5f4fa6=_['merge']({},_0x5f4fa6,_0x28a26a[_0x437e('0x35')]);return db['OpenchannelMessage'][_0x437e('0x12')]({'where':_0x5f4fa6[_0x437e('0x45')]})[_0x437e('0x18')](function(_0x5e95e8){_0x2384d4[_0x437e('0x12')]=_0x5e95e8;if(_0x28a26a[_0x437e('0x26')][_0x437e('0x32')]){_0x5f4fa6[_0x437e('0x33')]=[{'all':!![]}];}return db[_0x437e('0x3b')][_0x437e('0x24')](_0x5f4fa6);})['then'](function(_0xa9fc06){_0x2384d4[_0x437e('0x4c')]=_0xa9fc06;return _0x2384d4;});}})[_0x437e('0x18')](respondWithFilteredResult(_0x568ccd,_0x5f4fa6))[_0x437e('0x27')](handleError(_0x568ccd,null));};exports[_0x437e('0x4d')]=function(_0x469732,_0x445b47){return db[_0x437e('0x2c')][_0x437e('0x36')]({'where':{'id':_0x469732[_0x437e('0x2a')]['id']}})['then'](handleEntityNotFound(_0x445b47,null))['then'](function(_0x35ee1d){if(_0x35ee1d){return _0x35ee1d[_0x437e('0x4e')](_0x469732[_0x437e('0x38')][_0x437e('0x3c')],_[_0x437e('0x3d')](_0x469732['body'],[_0x437e('0x3c'),'id'])||{})[_0x437e('0x4f')](function(){return db[_0x437e('0x50')][_0x437e('0x24')]({'attributes':['id',_0x437e('0x1c'),_0x437e('0x51')],'where':{'id':_0x469732[_0x437e('0x38')][_0x437e('0x3c')]}});})[_0x437e('0x18')](function(_0x3bcdfb){socket[_0x437e('0x52')](_0x437e('0x53'),{'id':Number(_0x469732[_0x437e('0x2a')]['id']),'tags':_0x3bcdfb||[]});return{'id':Number(_0x469732['params']['id']),'tags':_0x3bcdfb||[]};});}})[_0x437e('0x18')](respondWithResult(_0x445b47,null))['catch'](handleError(_0x445b47,null));};exports[_0x437e('0x54')]=function(_0x468631,_0x38e659){return db['OpenchannelInteraction']['find']({'where':{'id':_0x468631['params']['id']}})['then'](handleEntityNotFound(_0x38e659,null))[_0x437e('0x18')](function(_0x372eee){if(_0x372eee){return _0x372eee['removeTags'](_0x468631[_0x437e('0x26')][_0x437e('0x3c')]);}})[_0x437e('0x18')](respondWithStatusCode(_0x38e659,null))[_0x437e('0x27')](handleError(_0x38e659,null));};exports[_0x437e('0x55')]=function(_0xf9871b,_0x559a59){var _0x57dbd7=moment()[_0x437e('0x56')]()[_0x437e('0x57')]();var _0x40a438=path[_0x437e('0x58')](config[_0x437e('0x59')],'server',_0x437e('0x5a'),_0x437e('0x5b'));var _0x3ee784=path['join'](config[_0x437e('0x59')],_0x437e('0x5c'),_0x437e('0x5a'),_0x437e('0x5d'));var _0x2d351f=path[_0x437e('0x58')](_0x40a438,_0x57dbd7);var _0x6ea8b=util[_0x437e('0x5e')](_0x437e('0x5f'),_0xf9871b['params']['id'],_0x57dbd7);var _0x536ddc=path[_0x437e('0x58')](_0x40a438,_0x6ea8b);var _0x49a4d2=[];_0x49a4d2['push']({'model':db[_0x437e('0x60')],'as':_0x437e('0x60'),'attributes':['id','fullname'],'raw':!![]});_0x49a4d2[_0x437e('0x61')]({'model':db[_0x437e('0x62')],'as':_0x437e('0x63'),'attributes':['id',_0x437e('0x64'),_0x437e('0x65')],'raw':!![]});if(_0xf9871b[_0x437e('0x26')][_0x437e('0x5d')]){_0x49a4d2[_0x437e('0x61')]({'model':db[_0x437e('0x66')],'as':'Attachment','raw':!![]});}var _0x17a202=[{'model':db[_0x437e('0x3b')],'as':'Messages','attributes':['id',_0x437e('0x38'),_0x437e('0x67'),_0x437e('0x68'),_0x437e('0x69'),_0x437e('0x6a')],'include':_0x49a4d2}];_0x17a202[_0x437e('0x61')]({'model':db['OpenchannelAccount'],'as':_0x437e('0x6b'),'attributes':['id',_0x437e('0x1c')]});_0x17a202['push']({'model':db['User'],'as':'Owner','attributes':['id',_0x437e('0x6c')]});return db[_0x437e('0x2c')][_0x437e('0x36')]({'where':{'id':_0xf9871b[_0x437e('0x2a')]['id']},'include':_0x17a202})[_0x437e('0x18')](handleEntityNotFound(_0x559a59,null))[_0x437e('0x18')](function(_0x36feef){if(_0x36feef){var _0x277753=_0x36feef['get']({'plain':!![]});fs[_0x437e('0x6d')](_0x2d351f);var _0x410f9e={'channel':_0x437e('0x6e'),'account':_0x277753['Account'][_0x437e('0x1c')],'agent':_0x277753[_0x437e('0x6f')]?_0x277753[_0x437e('0x6f')][_0x437e('0x6c')]:'N.A.','createdAt':moment(_0x277753['createdAt'])['format'](_0x437e('0x4b'))['toString'](),'closedAt':_0x277753['closed']?moment(_0x277753[_0x437e('0x70')])[_0x437e('0x5e')](_0x437e('0x4b'))[_0x437e('0x57')]():'','disposition':_0x277753['disposition'],'visibility':_0x277753[_0x437e('0x71')]?_0x437e('0x72'):'Private','messages':_(_0x277753['Messages'])[_0x437e('0x47')]({'secret':![]})[_0x437e('0x48')](function(_0x323b31){if(_0x323b31[_0x437e('0x66')]){var _0x3523f4=path[_0x437e('0x58')](_0x3ee784,_0x323b31[_0x437e('0x66')][_0x437e('0x73')]);if(fs[_0x437e('0x74')](_0x3523f4)){fs[_0x437e('0x75')](_0x3523f4)[_0x437e('0x76')](fs[_0x437e('0x77')](path['join'](_0x2d351f,_0x323b31[_0x437e('0x66')][_0x437e('0x73')])));}}return{'date':moment(_0x323b31[_0x437e('0x67')])['format'](_0x437e('0x4b'))[_0x437e('0x57')](),'sender':_0x323b31['direction']==='out'?_0x323b31['User']?_0x323b31[_0x437e('0x60')][_0x437e('0x6c')]:_0x437e('0x78'):_0x323b31[_0x437e('0x63')]['firstName']+(_0x323b31[_0x437e('0x63')][_0x437e('0x65')]?'\x20'+_0x323b31[_0x437e('0x63')][_0x437e('0x65')]:''),'body':_0x323b31[_0x437e('0x66')]?_0x323b31[_0x437e('0x66')][_0x437e('0x73')]:_0x323b31[_0x437e('0x38')],'direction':_0x323b31['direction']===_0x437e('0x79')?'A':'C','secret':_0x323b31[_0x437e('0x69')],'read':_0x323b31[_0x437e('0x6a')],'attachment':_0x323b31['Attachment']};})[_0x437e('0x7a')]()};return ejs[_0x437e('0x7b')](path['join'](config[_0x437e('0x59')],_0x437e('0x5c'),_0x437e('0x7c'),_0x437e('0x7d')),{'interaction':_0x410f9e})[_0x437e('0x18')](function(_0x195fdf){var _0x43c549=path['join'](_0x2d351f,_0x437e('0x7e')+_0x277753['id']+'-'+_0x57dbd7+_0x437e('0x7f'));var _0x4fe648={'path':_0x43c549,'channel':_0x437e('0x6e'),'interactionId':_0x277753['id']};return pdf[_0x437e('0x80')](_0x195fdf,_0x4fe648);})['then'](function(){return new Promise(function(_0x543495,_0x2341ea){zipdir(_0x2d351f,{'saveTo':_0x536ddc},function(_0x850cf,_0x52c1c9){if(_0x850cf)return _0x2341ea(_0x850cf);return _0x543495(_0x52c1c9);});})[_0x437e('0x18')](function(){return new Promise(function(_0x5c935d,_0x477bb0){rimraf(_0x2d351f,function(_0x58a6b2){if(_0x58a6b2)_0x477bb0(_0x58a6b2);return _0x5c935d();});});})[_0x437e('0x18')](function(){return _0x559a59[_0x437e('0x55')](_0x536ddc,_0x6ea8b,function(_0x920b40){if(_0x920b40){logger[_0x437e('0x1a')]('Unable\x20to\x20delete\x20zip\x20file',_0x920b40);}else{fs[_0x437e('0x81')](_0x536ddc);}});});});}else{return _0x559a59[_0x437e('0xd')](0xc8);}})[_0x437e('0x27')](handleError(_0x559a59,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index b213858..db52b4c 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 _0x38d8=['hook','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','emit','catch'];(function(_0x141088,_0x15d40d){var _0x461353=function(_0x26068d){while(--_0x26068d){_0x141088['push'](_0x141088['shift']());}};_0x461353(++_0x15d40d);}(_0x38d8,0xb5));var _0x838d=function(_0x1f99a0,_0x50b73d){_0x1f99a0=_0x1f99a0-0x0;var _0x1e0849=_0x38d8[_0x1f99a0];return _0x1e0849;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x838d('0x0'))['db'][_0x838d('0x1')];var OpenchannelMessage=require(_0x838d('0x0'))['db'][_0x838d('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x838d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x838d('0x4'),'afterDestroy':_0x838d('0x5')};function emitEvent(_0x3f5cec){return function(_0x4df053,_0x1ea0be,_0xb66a46){_0x4df053[_0x838d('0x6')]({'attributes':['id'],'raw':!![]})[_0x838d('0x7')](function(_0x1b4fe9){_0x4df053[_0x838d('0x8')](_0x838d('0x9'),_0x1b4fe9['map'](function(_0x44d919){return{'id':_0x44d919['id']};}));return OpenchannelMessage[_0x838d('0xa')]({'where':{'OpenchannelInteractionId':_0x4df053['id'],'direction':'in','read':![]},'raw':!![]});})[_0x838d('0x7')](function(_0xa64178){_0x4df053[_0x838d('0x8')](_0x838d('0xb'),_0xa64178['length']);OpenchannelInteractionEvents[_0x838d('0xc')](_0x3f5cec+':'+_0x4df053['id'],_0x4df053);OpenchannelInteractionEvents[_0x838d('0xc')](_0x3f5cec,_0x4df053);_0xb66a46(null);})[_0x838d('0xd')](_0xb66a46(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x838d('0xe')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0xf67a=['Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','update','remove','getUsers','then','setDataValue'];(function(_0x55f7ac,_0x316665){var _0x46bdf6=function(_0x799605){while(--_0x799605){_0x55f7ac['push'](_0x55f7ac['shift']());}};_0x46bdf6(++_0x316665);}(_0xf67a,0x171));var _0xaf67=function(_0x173ba3,_0x5ee8f6){_0x173ba3=_0x173ba3-0x0;var _0x56debd=_0xf67a[_0x173ba3];return _0x56debd;};'use strict';var EventEmitter=require(_0xaf67('0x0'));var OpenchannelInteraction=require(_0xaf67('0x1'))['db'][_0xaf67('0x2')];var OpenchannelMessage=require(_0xaf67('0x1'))['db'][_0xaf67('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xaf67('0x4'),'afterDestroy':_0xaf67('0x5')};function emitEvent(_0xe874a1){return function(_0x5d6ef6,_0x31c5b5,_0xd8cd45){_0x5d6ef6[_0xaf67('0x6')]({'attributes':['id'],'raw':!![]})[_0xaf67('0x7')](function(_0xb3c571){_0x5d6ef6[_0xaf67('0x8')](_0xaf67('0x9'),_0xb3c571[_0xaf67('0xa')](function(_0x3402b9){return{'id':_0x3402b9['id']};}));return OpenchannelMessage[_0xaf67('0xb')]({'where':{'OpenchannelInteractionId':_0x5d6ef6['id'],'direction':'in','read':![]},'raw':!![]});})[_0xaf67('0x7')](function(_0x2199eb){_0x5d6ef6['setDataValue'](_0xaf67('0xc'),_0x2199eb[_0xaf67('0xd')]);OpenchannelInteractionEvents[_0xaf67('0xe')](_0xe874a1+':'+_0x5d6ef6['id'],_0x5d6ef6);OpenchannelInteractionEvents[_0xaf67('0xe')](_0xe874a1,_0x5d6ef6);_0xd8cd45(null);})[_0xaf67('0xf')](_0xd8cd45(null));};}for(var e in events){if(events[_0xaf67('0x10')](e)){var event=events[e];OpenchannelInteraction[_0xaf67('0x11')](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 8b861ca..0b2af2d 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 _0x84c5=['utf8mb4_unicode_ci','changed','closed','format','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','define','openchannel_interactions'];(function(_0x3a16b4,_0x1dfc5c){var _0x8eba2f=function(_0x506811){while(--_0x506811){_0x3a16b4['push'](_0x3a16b4['shift']());}};_0x8eba2f(++_0x1dfc5c);}(_0x84c5,0x9a));var _0x584c=function(_0x24819b,_0x32f536){_0x24819b=_0x24819b-0x0;var _0x3ea61f=_0x84c5[_0x24819b];return _0x3ea61f;};'use strict';var _=require('lodash');var util=require(_0x584c('0x0'));var logger=require(_0x584c('0x1'))(_0x584c('0x2'));var moment=require('moment');var BPromise=require(_0x584c('0x3'));var rp=require(_0x584c('0x4'));var fs=require('fs');var path=require(_0x584c('0x5'));var rimraf=require(_0x584c('0x6'));var config=require(_0x584c('0x7'));var attributes=require(_0x584c('0x8'));module['exports']=function(_0x12c067,_0x3c0a23){return _0x12c067[_0x584c('0x9')]('OpenchannelInteraction',attributes,{'tableName':_0x584c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x584c('0xb'),'hooks':{'beforeUpdate':function(_0x3fe0a0,_0x4cd533,_0x4b06c4){if(_0x3fe0a0[_0x584c('0xc')](_0x584c('0xd'))){_0x3fe0a0['closedAt']=moment()[_0x584c('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4b06c4(null,_0x3fe0a0);}}});}; \ No newline at end of file +var _0xe0c1=['util','../../config/logger','api','moment','bluebird','request-promise','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','lodash'];(function(_0x1f5796,_0x38379a){var _0x51bc37=function(_0x24aa5f){while(--_0x24aa5f){_0x1f5796['push'](_0x1f5796['shift']());}};_0x51bc37(++_0x38379a);}(_0xe0c1,0x10f));var _0x1e0c=function(_0x43baf0,_0x267c2d){_0x43baf0=_0x43baf0-0x0;var _0x4a7518=_0xe0c1[_0x43baf0];return _0x4a7518;};'use strict';var _=require(_0x1e0c('0x0'));var util=require(_0x1e0c('0x1'));var logger=require(_0x1e0c('0x2'))(_0x1e0c('0x3'));var moment=require(_0x1e0c('0x4'));var BPromise=require(_0x1e0c('0x5'));var rp=require(_0x1e0c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x57c88f,_0x935e3b){return _0x57c88f[_0x1e0c('0x7')](_0x1e0c('0x8'),attributes,{'tableName':_0x1e0c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1e0c('0xa'),'collate':_0x1e0c('0xb'),'hooks':{'beforeUpdate':function(_0x364859,_0x1fe14b,_0x5182bb){if(_0x364859[_0x1e0c('0xc')](_0x1e0c('0xd'))){_0x364859[_0x1e0c('0xe')]=moment()[_0x1e0c('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5182bb(null,_0x364859);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 7b468a9..784763c 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 _0xc3ce=['AddTags','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','attributes','limit','find','where','ids','omit','spread'];(function(_0x48d8fc,_0x5e5bc5){var _0x4c1900=function(_0x2c0be3){while(--_0x2c0be3){_0x48d8fc['push'](_0x48d8fc['shift']());}};_0x4c1900(++_0x5e5bc5);}(_0xc3ce,0x10b));var _0xec3c=function(_0x17468d,_0x313ae9){_0x17468d=_0x17468d-0x0;var _0x30971c=_0xc3ce[_0x17468d];return _0x30971c;};'use strict';var _=require(_0xec3c('0x0'));var util=require(_0xec3c('0x1'));var moment=require('moment');var BPromise=require(_0xec3c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xec3c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xec3c('0x4'));var logger=require(_0xec3c('0x5'))(_0xec3c('0x6'));var config=require(_0xec3c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xec3c('0x8')][_0xec3c('0x9')]({'port':0x232a});config[_0xec3c('0xa')]=_[_0xec3c('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xec3c('0xc'))(new Redis(config['redis']));require(_0xec3c('0xd'))[_0xec3c('0xe')](socket);function respondWithRpcPromise(_0x3c0aa2,_0x4a6330,_0x2dac83){return new BPromise(function(_0x2cc013,_0x1d4b97){return client[_0xec3c('0xf')](_0x3c0aa2,_0x2dac83)[_0xec3c('0x10')](function(_0x38306c){logger[_0xec3c('0x11')](_0xec3c('0x12'),_0x4a6330,'request\x20sent');logger[_0xec3c('0x13')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x4a6330,_0xec3c('0x14'),JSON[_0xec3c('0x15')](_0x38306c));if(_0x38306c[_0xec3c('0x16')]){if(_0x38306c['error']['code']===0x1f4){logger[_0xec3c('0x16')](_0xec3c('0x12'),_0x4a6330,_0x38306c[_0xec3c('0x16')][_0xec3c('0x17')]);return _0x1d4b97(_0x38306c[_0xec3c('0x16')]['message']);}logger['error'](_0xec3c('0x12'),_0x4a6330,_0x38306c[_0xec3c('0x16')][_0xec3c('0x17')]);return _0x2cc013(_0x38306c['error'][_0xec3c('0x17')]);}else{logger[_0xec3c('0x11')](_0xec3c('0x12'),_0x4a6330,_0xec3c('0x14'));_0x2cc013(_0x38306c['result'][_0xec3c('0x17')]);}})[_0xec3c('0x18')](function(_0xa4dacb){logger[_0xec3c('0x16')](_0xec3c('0x12'),_0x4a6330,_0xa4dacb);_0x1d4b97(_0xa4dacb);});});}exports[_0xec3c('0x19')]=function(_0x460e51){var _0x32133c=this;return new Promise(function(_0x1c591c,_0x52d1e3){return db[_0xec3c('0x1a')]['update'](_0x460e51[_0xec3c('0x1b')],{'raw':_0x460e51[_0xec3c('0x1c')]?_0x460e51[_0xec3c('0x1c')][_0xec3c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x460e51['options']?_0x460e51[_0xec3c('0x1c')]['where']||null:null,'attributes':_0x460e51[_0xec3c('0x1c')]?_0x460e51[_0xec3c('0x1c')][_0xec3c('0x1e')]||null:null,'limit':_0x460e51['options']?_0x460e51[_0xec3c('0x1c')][_0xec3c('0x1f')]||null:null})[_0xec3c('0x10')](function(_0x4a01ab){logger[_0xec3c('0x11')](_0xec3c('0x19'),_0x460e51);logger[_0xec3c('0x13')](_0xec3c('0x19'),_0x460e51,JSON[_0xec3c('0x15')](_0x4a01ab));_0x1c591c(_0x4a01ab);})['catch'](function(_0x404e9f){logger[_0xec3c('0x16')](_0xec3c('0x19'),_0x404e9f['message'],_0x460e51);_0x52d1e3(_0x32133c[_0xec3c('0x16')](0x1f4,_0x404e9f[_0xec3c('0x17')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x5183eb){return new Promise(function(_0x189022,_0x35a501){return db['OpenchannelInteraction'][_0xec3c('0x20')]({'where':_0x5183eb[_0xec3c('0x1c')]?_0x5183eb[_0xec3c('0x1c')][_0xec3c('0x21')]||null:null})['then'](function(_0x55fc73){if(_0x55fc73){return _0x55fc73['addTags'](_0x5183eb['body'][_0xec3c('0x22')],_[_0xec3c('0x23')](_0x5183eb[_0xec3c('0x1b')],['ids','id'])||{});}})[_0xec3c('0x24')](function(_0x58c77b){logger[_0xec3c('0x11')](_0xec3c('0x25'),_0x5183eb);logger[_0xec3c('0x13')](_0xec3c('0x25'),_0x5183eb,JSON['stringify'](_0x58c77b));_0x189022(_0x58c77b);})[_0xec3c('0x18')](function(_0x25976e){logger['error'](_0xec3c('0x25'),_0x25976e['message'],_0x5183eb);_0x35a501(_this['error'](0x1f4,_0x25976e[_0xec3c('0x17')]));});});}; \ No newline at end of file +var _0x78a2=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','register','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','attributes','limit','then','AddTagsToOpenchannelInteraction','find','ids','omit','AddTags','lodash','util'];(function(_0x22b8a3,_0x2a79a7){var _0x199a0c=function(_0x544c66){while(--_0x544c66){_0x22b8a3['push'](_0x22b8a3['shift']());}};_0x199a0c(++_0x2a79a7);}(_0x78a2,0x73));var _0x278a=function(_0x48b2ed,_0x241060){_0x48b2ed=_0x48b2ed-0x0;var _0x4a6147=_0x78a2[_0x48b2ed];return _0x4a6147;};'use strict';var _=require(_0x278a('0x0'));var util=require(_0x278a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x278a('0x2'));var fs=require('fs');var Redis=require(_0x278a('0x3'));var db=require(_0x278a('0x4'))['db'];var utils=require(_0x278a('0x5'));var logger=require(_0x278a('0x6'))(_0x278a('0x7'));var config=require(_0x278a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x278a('0x9')]['http']({'port':0x232a});config[_0x278a('0xa')]=_['defaults'](config['redis'],{'host':_0x278a('0xb'),'port':0x18eb});var socket=require(_0x278a('0xc'))(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0x278a('0xd')](socket);function respondWithRpcPromise(_0x7e76f8,_0x7c65e7,_0x4b61c5){return new BPromise(function(_0x41527f,_0x5c60c0){return client[_0x278a('0xe')](_0x7e76f8,_0x4b61c5)['then'](function(_0x149a50){logger[_0x278a('0xf')](_0x278a('0x10'),_0x7c65e7,_0x278a('0x11'));logger[_0x278a('0x12')](_0x278a('0x13'),_0x7c65e7,_0x278a('0x11'),JSON[_0x278a('0x14')](_0x149a50));if(_0x149a50['error']){if(_0x149a50['error']['code']===0x1f4){logger[_0x278a('0x15')](_0x278a('0x10'),_0x7c65e7,_0x149a50[_0x278a('0x15')][_0x278a('0x16')]);return _0x5c60c0(_0x149a50[_0x278a('0x15')][_0x278a('0x16')]);}logger[_0x278a('0x15')](_0x278a('0x10'),_0x7c65e7,_0x149a50['error']['message']);return _0x41527f(_0x149a50[_0x278a('0x15')]['message']);}else{logger[_0x278a('0xf')]('OpenchannelInteraction,\x20%s,\x20%s',_0x7c65e7,_0x278a('0x11'));_0x41527f(_0x149a50[_0x278a('0x17')]['message']);}})[_0x278a('0x18')](function(_0x19dc2e){logger['error'](_0x278a('0x10'),_0x7c65e7,_0x19dc2e);_0x5c60c0(_0x19dc2e);});});}exports[_0x278a('0x19')]=function(_0x519507){var _0x536ac4=this;return new Promise(function(_0x130f73,_0x3f19a7){return db[_0x278a('0x1a')][_0x278a('0x1b')](_0x519507[_0x278a('0x1c')],{'raw':_0x519507[_0x278a('0x1d')]?_0x519507[_0x278a('0x1d')][_0x278a('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x519507[_0x278a('0x1d')]?_0x519507[_0x278a('0x1d')]['where']||null:null,'attributes':_0x519507[_0x278a('0x1d')]?_0x519507[_0x278a('0x1d')][_0x278a('0x1f')]||null:null,'limit':_0x519507[_0x278a('0x1d')]?_0x519507[_0x278a('0x1d')][_0x278a('0x20')]||null:null})[_0x278a('0x21')](function(_0x25fbe9){logger[_0x278a('0xf')]('UpdateOpenchannelInteraction',_0x519507);logger[_0x278a('0x12')](_0x278a('0x19'),_0x519507,JSON[_0x278a('0x14')](_0x25fbe9));_0x130f73(_0x25fbe9);})[_0x278a('0x18')](function(_0xe5f6aa){logger[_0x278a('0x15')](_0x278a('0x19'),_0xe5f6aa[_0x278a('0x16')],_0x519507);_0x3f19a7(_0x536ac4[_0x278a('0x15')](0x1f4,_0xe5f6aa[_0x278a('0x16')]));});});};exports[_0x278a('0x22')]=function(_0x5564ca){return new Promise(function(_0x27f34c,_0x630609){return db[_0x278a('0x1a')][_0x278a('0x23')]({'where':_0x5564ca[_0x278a('0x1d')]?_0x5564ca['options']['where']||null:null})[_0x278a('0x21')](function(_0x183280){if(_0x183280){return _0x183280['addTags'](_0x5564ca[_0x278a('0x1c')][_0x278a('0x24')],_[_0x278a('0x25')](_0x5564ca[_0x278a('0x1c')],[_0x278a('0x24'),'id'])||{});}})['spread'](function(_0xb7d3e8){logger['info'](_0x278a('0x26'),_0x5564ca);logger[_0x278a('0x12')](_0x278a('0x26'),_0x5564ca,JSON[_0x278a('0x14')](_0xb7d3e8));_0x27f34c(_0xb7d3e8);})[_0x278a('0x18')](function(_0x2cffc6){logger[_0x278a('0x15')](_0x278a('0x26'),_0x2cffc6[_0x278a('0x16')],_0x5564ca);_0x630609(_this[_0x278a('0x15')](0x1f4,_0x2cffc6[_0x278a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index e926b61..f0976b0 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 _0xffe8=['length','openchannelInteraction:','save','remove','emit','removeListener','register'];(function(_0x43e227,_0x20da9e){var _0x1e9e57=function(_0x565e3a){while(--_0x565e3a){_0x43e227['push'](_0x43e227['shift']());}};_0x1e9e57(++_0x20da9e);}(_0xffe8,0xfe));var _0x8ffe=function(_0x27605b,_0x32808e){_0x27605b=_0x27605b-0x0;var _0x44eea4=_0xffe8[_0x27605b];return _0x44eea4;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x8ffe('0x0'),_0x8ffe('0x1'),'update'];function createListener(_0x6b57c6,_0x541c2f){return function(_0xca1c61){_0x541c2f[_0x8ffe('0x2')](_0x6b57c6,_0xca1c61);};}function removeListener(_0x31dea3,_0xa43ef6){return function(){OpenchannelInteractionEvents[_0x8ffe('0x3')](_0x31dea3,_0xa43ef6);};}exports[_0x8ffe('0x4')]=function(_0x2b54fb){for(var _0x1b3790=0x0,_0x346c99=events[_0x8ffe('0x5')];_0x1b3790<_0x346c99;_0x1b3790++){var _0x1c3743=events[_0x1b3790];var _0x4de284=createListener(_0x8ffe('0x6')+_0x1c3743,_0x2b54fb);OpenchannelInteractionEvents['on'](_0x1c3743,_0x4de284);}}; \ No newline at end of file +var _0xbb08=['save','remove','update','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x469348,_0x39af3d){var _0x5a13a1=function(_0x48324a){while(--_0x48324a){_0x469348['push'](_0x469348['shift']());}};_0x5a13a1(++_0x39af3d);}(_0xbb08,0xcf));var _0x8bb0=function(_0x4544b5,_0x347417){_0x4544b5=_0x4544b5-0x0;var _0x161203=_0xbb08[_0x4544b5];return _0x161203;};'use strict';var OpenchannelInteractionEvents=require(_0x8bb0('0x0'));var events=[_0x8bb0('0x1'),_0x8bb0('0x2'),_0x8bb0('0x3')];function createListener(_0x968730,_0x43bf28){return function(_0x31654d){_0x43bf28['emit'](_0x968730,_0x31654d);};}function removeListener(_0x1873c9,_0x13bfc5){return function(){OpenchannelInteractionEvents[_0x8bb0('0x4')](_0x1873c9,_0x13bfc5);};}exports[_0x8bb0('0x5')]=function(_0x566826){for(var _0x482c87=0x0,_0x3de4b1=events[_0x8bb0('0x6')];_0x482c87<_0x3de4b1;_0x482c87++){var _0x720cd7=events[_0x482c87];var _0x282129=createListener(_0x8bb0('0x7')+_0x720cd7,_0x566826);OpenchannelInteractionEvents['on'](_0x720cd7,_0x282129);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index e3201a4..a0f17e9 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 _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0xfba933,_0x1b26f2){var _0x349af3=function(_0x4ff27f){while(--_0x4ff27f){_0xfba933['push'](_0xfba933['shift']());}};_0x349af3(++_0x1b26f2);}(_0xe706,0xa3));var _0x6e70=function(_0x554a48,_0x3b0b29){_0x554a48=_0x554a48-0x0;var _0x4cd1dc=_0xe706[_0x554a48];return _0x4cd1dc;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 458f92a..5c3658a 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 _0xc06d=['BOOLEAN','ENUM','DATE','sequelize','exports','TEXT','medium'];(function(_0x2bc1fe,_0x45da98){var _0x1a47a5=function(_0x2e5053){while(--_0x2e5053){_0x2bc1fe['push'](_0x2bc1fe['shift']());}};_0x1a47a5(++_0x45da98);}(_0xc06d,0x15a));var _0xdc06=function(_0x34e540,_0x3112be){_0x34e540=_0x34e540-0x0;var _0x2dcc0a=_0xc06d[_0x34e540];return _0x2dcc0a;};'use strict';var Sequelize=require(_0xdc06('0x0'));module[_0xdc06('0x1')]={'body':{'type':Sequelize[_0xdc06('0x2')](_0xdc06('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xdc06('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xdc06('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xdc06('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xdc06('0x2')]}}; \ No newline at end of file +var _0x97e7=['STRING','sequelize','exports','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x97e7,0x1a1));var _0x797e=function(_0x2e85c2,_0x54dc93){_0x2e85c2=_0x2e85c2-0x0;var _0x5818bf=_0x97e7[_0x2e85c2];return _0x5818bf;};'use strict';var Sequelize=require(_0x797e('0x0'));module[_0x797e('0x1')]={'body':{'type':Sequelize[_0x797e('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x797e('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x797e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x797e('0x4')]('in',_0x797e('0x5')),'defaultValue':_0x797e('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x797e('0x6')]},'providerName':{'type':Sequelize[_0x797e('0x7')]},'providerResponse':{'type':Sequelize[_0x797e('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 0015a6f..5224478 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 _0x51d1=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','findAll','rows','params','includeAll','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','OpenchannelInteraction','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','fullname','email','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','User','internal','interface','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','end','stack','name','send','index','map','OpenchannelMessage','rawAttributes','type'];(function(_0x242afe,_0x14680b){var _0x3293e9=function(_0x1244e7){while(--_0x1244e7){_0x242afe['push'](_0x242afe['shift']());}};_0x3293e9(++_0x14680b);}(_0x51d1,0x1d6));var _0x151d=function(_0x483d2a,_0x4bffba){_0x483d2a=_0x483d2a-0x0;var _0x5ba5d5=_0x51d1[_0x483d2a];return _0x5ba5d5;};'use strict';var emlformat=require(_0x151d('0x0'));var rimraf=require(_0x151d('0x1'));var zipdir=require(_0x151d('0x2'));var jsonpatch=require(_0x151d('0x3'));var rp=require(_0x151d('0x4'));var moment=require(_0x151d('0x5'));var BPromise=require(_0x151d('0x6'));var Mustache=require(_0x151d('0x7'));var util=require(_0x151d('0x8'));var path=require(_0x151d('0x9'));var sox=require(_0x151d('0xa'));var csv=require('to-csv');var ejs=require(_0x151d('0xb'));var fs=require('fs');var fs_extra=require(_0x151d('0xc'));var _=require(_0x151d('0xd'));var squel=require(_0x151d('0xe'));var crypto=require(_0x151d('0xf'));var jsforce=require(_0x151d('0x10'));var deskjs=require(_0x151d('0x11'));var toCsv=require(_0x151d('0x12'));var querystring=require(_0x151d('0x13'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x151d('0x14'));var qs=require(_0x151d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x151d('0x16'));var logger=require(_0x151d('0x17'))(_0x151d('0x18'));var utils=require(_0x151d('0x19'));var config=require(_0x151d('0x1a'));var licenseUtil=require(_0x151d('0x1b'));var db=require(_0x151d('0x1c'))['db'];config[_0x151d('0x1d')]=_[_0x151d('0x1e')](config[_0x151d('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0x151d('0x1f'))(new Redis(config[_0x151d('0x1d')]));require(_0x151d('0x20'))[_0x151d('0x21')](socket);var jayson=require(_0x151d('0x22'));var client=jayson[_0x151d('0x23')]['http']({'port':0x232c});var client9002=jayson[_0x151d('0x23')][_0x151d('0x24')]({'port':0x232a});function respondWithRpcPromise(_0x43629c,_0x2e973b,_0x26bbca,_0x2f5b1b){return new BPromise(function(_0x30ce58,_0x47f4ff){var _0x1eab1a=_0x2f5b1b||client;return _0x1eab1a[_0x151d('0x25')](_0x43629c,_0x26bbca)[_0x151d('0x26')](function(_0x57e3b1){logger[_0x151d('0x27')](_0x151d('0x28'),_0x2e973b,_0x151d('0x29'));logger[_0x151d('0x2a')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x2e973b,_0x151d('0x29'),JSON['stringify'](_0x57e3b1));if(_0x57e3b1['error']){if(_0x57e3b1[_0x151d('0x2b')][_0x151d('0x2c')]===0x1f4){logger[_0x151d('0x2b')](_0x151d('0x28'),_0x2e973b,_0x57e3b1[_0x151d('0x2b')][_0x151d('0x2d')]);return _0x47f4ff(_0x57e3b1['error'][_0x151d('0x2d')]);}logger[_0x151d('0x2b')](_0x151d('0x28'),_0x2e973b,_0x57e3b1['error'][_0x151d('0x2d')]);return _0x30ce58(_0x57e3b1[_0x151d('0x2b')][_0x151d('0x2d')]);}else{logger[_0x151d('0x27')](_0x151d('0x28'),_0x2e973b,_0x151d('0x29'));_0x30ce58(_0x57e3b1[_0x151d('0x2e')][_0x151d('0x2d')]);}})[_0x151d('0x2f')](function(_0xe7ffd0){logger[_0x151d('0x2b')](_0x151d('0x28'),_0x2e973b,_0xe7ffd0);_0x47f4ff(_0xe7ffd0);});});}function respondWithStatusCode(_0x2d2b3e,_0x4790f7){_0x4790f7=_0x4790f7||0xcc;return function(_0x5d36bd){if(_0x5d36bd){return _0x2d2b3e[_0x151d('0x30')](_0x4790f7);}return _0x2d2b3e[_0x151d('0x31')](_0x4790f7)['end']();};}function respondWithResult(_0x4b1263,_0x17b985){_0x17b985=_0x17b985||0xc8;return function(_0x1fd9cb){if(_0x1fd9cb){return _0x4b1263['status'](_0x17b985)[_0x151d('0x32')](_0x1fd9cb);}};}function respondWithFilteredResult(_0x65922e,_0x4de0ef){return function(_0x2bcae7){if(_0x2bcae7){var _0x791b82=typeof _0x4de0ef[_0x151d('0x33')]===_0x151d('0x34')&&typeof _0x4de0ef[_0x151d('0x35')]===_0x151d('0x34');var _0x377920=_0x2bcae7[_0x151d('0x36')];var _0xdbd2e7=_0x791b82?0x0:_0x4de0ef[_0x151d('0x33')];var _0x2495cd=_0x791b82?_0x2bcae7[_0x151d('0x36')]:_0x4de0ef[_0x151d('0x33')]+_0x4de0ef[_0x151d('0x35')];var _0x270a83;if(_0x2495cd>=_0x377920){_0x2495cd=_0x377920;_0x270a83=0xc8;}else{_0x270a83=0xce;}_0x65922e[_0x151d('0x31')](_0x270a83);return _0x65922e[_0x151d('0x37')](_0x151d('0x38'),_0xdbd2e7+'-'+_0x2495cd+'/'+_0x377920)[_0x151d('0x32')](_0x2bcae7);}return null;};}function patchUpdates(_0x287171){return function(_0x1876e0){try{jsonpatch[_0x151d('0x39')](_0x1876e0,_0x287171,!![]);}catch(_0x450bad){return BPromise[_0x151d('0x3a')](_0x450bad);}return _0x1876e0['save']();};}function saveUpdates(_0x13a6c8,_0x3d664d){return function(_0x2b9f52){if(_0x2b9f52){return _0x2b9f52[_0x151d('0x3b')](_0x13a6c8)['then'](function(_0x20e505){return _0x20e505;});}return null;};}function removeEntity(_0x256247,_0x5bdafe){return function(_0x5ec482){if(_0x5ec482){return _0x5ec482[_0x151d('0x3c')]()[_0x151d('0x26')](function(){_0x256247[_0x151d('0x31')](0xcc)[_0x151d('0x3d')]();});}};}function handleEntityNotFound(_0x49c489,_0x410f6e){return function(_0x5c76a8){if(!_0x5c76a8){_0x49c489[_0x151d('0x30')](0x194);}return _0x5c76a8;};}function handleError(_0x4ddd0d,_0x4f586f){_0x4f586f=_0x4f586f||0x1f4;return function(_0xde181e){logger['error'](_0xde181e[_0x151d('0x3e')]);if(_0xde181e['name']){delete _0xde181e[_0x151d('0x3f')];}_0x4ddd0d['status'](_0x4f586f)[_0x151d('0x40')](_0xde181e);};}exports[_0x151d('0x41')]=function(_0x3c0823,_0x9eb943){var _0x13a6d5={},_0x38656d={},_0x4e53aa={'count':0x0,'rows':[]};var _0x1a2a52=_[_0x151d('0x42')](db[_0x151d('0x43')][_0x151d('0x44')],function(_0x387489){return{'name':_0x387489['fieldName'],'type':_0x387489[_0x151d('0x45')][_0x151d('0x46')]};});_0x38656d[_0x151d('0x47')]=_['map'](_0x1a2a52,'name');_0x38656d[_0x151d('0x48')]=_[_0x151d('0x49')](_0x3c0823[_0x151d('0x48')]);_0x38656d[_0x151d('0x4a')]=_[_0x151d('0x4b')](_0x38656d['model'],_0x38656d[_0x151d('0x48')]);_0x13a6d5[_0x151d('0x4c')]=_[_0x151d('0x4b')](_0x38656d[_0x151d('0x47')],qs['fields'](_0x3c0823[_0x151d('0x48')][_0x151d('0x4d')]));_0x13a6d5[_0x151d('0x4c')]=_0x13a6d5['attributes'][_0x151d('0x4e')]?_0x13a6d5[_0x151d('0x4c')]:_0x38656d[_0x151d('0x47')];if(!_0x3c0823[_0x151d('0x48')][_0x151d('0x4f')]('nolimit')){_0x13a6d5['limit']=qs[_0x151d('0x35')](_0x3c0823[_0x151d('0x48')]['limit']);_0x13a6d5[_0x151d('0x33')]=qs[_0x151d('0x33')](_0x3c0823['query'][_0x151d('0x33')]);}_0x13a6d5[_0x151d('0x50')]=qs[_0x151d('0x51')](_0x3c0823[_0x151d('0x48')]['sort']);_0x13a6d5[_0x151d('0x52')]=qs[_0x151d('0x4a')](_[_0x151d('0x53')](_0x3c0823[_0x151d('0x48')],_0x38656d[_0x151d('0x4a')]),_0x1a2a52);if(_0x3c0823[_0x151d('0x48')]['filter']){_0x13a6d5[_0x151d('0x52')]=_['merge'](_0x13a6d5[_0x151d('0x52')],{'$or':_[_0x151d('0x42')](_0x1a2a52,function(_0x4840de){if(_0x4840de[_0x151d('0x45')]!=='VIRTUAL'){var _0x35708e={};_0x35708e[_0x4840de[_0x151d('0x3f')]]={'$like':'%'+_0x3c0823[_0x151d('0x48')][_0x151d('0x54')]+'%'};return _0x35708e;}})});}_0x13a6d5=_[_0x151d('0x55')]({},_0x13a6d5,_0x3c0823[_0x151d('0x56')]);var _0x37b458={'where':_0x13a6d5[_0x151d('0x52')]};return db[_0x151d('0x43')][_0x151d('0x36')](_0x37b458)['then'](function(_0x46ed36){_0x4e53aa[_0x151d('0x36')]=_0x46ed36;if(_0x3c0823[_0x151d('0x48')]['includeAll']){_0x13a6d5[_0x151d('0x57')]=[{'all':!![]}];}return db[_0x151d('0x43')][_0x151d('0x58')](_0x13a6d5);})[_0x151d('0x26')](function(_0x273212){_0x4e53aa[_0x151d('0x59')]=_0x273212;return _0x4e53aa;})['then'](respondWithFilteredResult(_0x9eb943,_0x13a6d5))[_0x151d('0x2f')](handleError(_0x9eb943,null));};exports['show']=function(_0x4b8f4f,_0x196dbb){var _0x6db60f={'raw':!![],'where':{'id':_0x4b8f4f[_0x151d('0x5a')]['id']}},_0x29153c={};_0x29153c['model']=_['keys'](db[_0x151d('0x43')][_0x151d('0x44')]);_0x29153c[_0x151d('0x48')]=_[_0x151d('0x49')](_0x4b8f4f['query']);_0x29153c[_0x151d('0x4a')]=_[_0x151d('0x4b')](_0x29153c[_0x151d('0x47')],_0x29153c[_0x151d('0x48')]);_0x6db60f['attributes']=_['intersection'](_0x29153c[_0x151d('0x47')],qs[_0x151d('0x4d')](_0x4b8f4f[_0x151d('0x48')][_0x151d('0x4d')]));_0x6db60f['attributes']=_0x6db60f[_0x151d('0x4c')][_0x151d('0x4e')]?_0x6db60f[_0x151d('0x4c')]:_0x29153c['model'];if(_0x4b8f4f[_0x151d('0x48')][_0x151d('0x5b')]){_0x6db60f[_0x151d('0x57')]=[{'all':!![]}];}_0x6db60f=_['merge']({},_0x6db60f,_0x4b8f4f['options']);return db[_0x151d('0x43')][_0x151d('0x5c')](_0x6db60f)[_0x151d('0x26')](handleEntityNotFound(_0x196dbb,null))[_0x151d('0x26')](respondWithResult(_0x196dbb,null))['catch'](handleError(_0x196dbb,null));};exports['create']=function(_0x3ddec8,_0xd2610){return db[_0x151d('0x43')][_0x151d('0x5d')](_0x3ddec8[_0x151d('0x5e')],{})[_0x151d('0x26')](respondWithResult(_0xd2610,0xc9))['catch'](handleError(_0xd2610,null));};exports['update']=function(_0x14705e,_0x40e13e){if(_0x14705e[_0x151d('0x5e')]['id']){delete _0x14705e[_0x151d('0x5e')]['id'];}return db['OpenchannelMessage'][_0x151d('0x5c')]({'where':{'id':_0x14705e[_0x151d('0x5a')]['id']}})[_0x151d('0x26')](handleEntityNotFound(_0x40e13e,null))[_0x151d('0x26')](saveUpdates(_0x14705e['body'],null))[_0x151d('0x26')](respondWithResult(_0x40e13e,null))[_0x151d('0x2f')](handleError(_0x40e13e,null));};exports[_0x151d('0x3c')]=function(_0x5ba794,_0x20e081){return db[_0x151d('0x43')][_0x151d('0x5c')]({'where':{'id':_0x5ba794[_0x151d('0x5a')]['id']}})[_0x151d('0x26')](handleEntityNotFound(_0x20e081,null))[_0x151d('0x26')](removeEntity(_0x20e081,null))[_0x151d('0x2f')](handleError(_0x20e081,null));};exports[_0x151d('0x5f')]=function(_0x56cf40,_0x4914b0){return db[_0x151d('0x43')][_0x151d('0x5f')]()[_0x151d('0x26')](respondWithResult(_0x4914b0,null))[_0x151d('0x2f')](handleError(_0x4914b0,null));};var interaction_log=require(_0x151d('0x17'))(_0x151d('0x60'));exports[_0x151d('0x61')]=function(_0x241328,_0x275c55,_0x285a79){var _0x3d6a67={'agent':{},'channel':_0x151d('0x62')};if(_0x241328[_0x151d('0x5e')]['id']){delete _0x241328[_0x151d('0x5e')]['id'];}_0x241328[_0x151d('0x5e')][_0x151d('0x63')]=!![];_0x241328[_0x151d('0x5e')][_0x151d('0x64')]=moment()[_0x151d('0x65')](_0x151d('0x66'));_0x241328[_0x151d('0x5e')]['UserId']=_0x241328[_0x151d('0x5e')][_0x151d('0x67')]||_0x241328[_0x151d('0x68')]['id'];_0x3d6a67[_0x151d('0x69')]['id']=_0x241328[_0x151d('0x5e')][_0x151d('0x67')];return db['OpenchannelMessage']['find']({'where':{'id':_0x241328[_0x151d('0x5a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x275c55,null))['then'](saveUpdates(_0x241328[_0x151d('0x5e')],null))[_0x151d('0x26')](function(_0x4d597c){if(_0x4d597c){_0x3d6a67[_0x151d('0x2d')]=_0x4d597c['get']({'plain':!![]});return db[_0x151d('0x6a')][_0x151d('0x5c')]({'where':{'id':_0x4d597c['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x275c55,null))[_0x151d('0x26')](function(_0x1ca402){if(_0x1ca402){return _0x1ca402['update']({'UserId':_0x241328[_0x151d('0x5e')][_0x151d('0x67')],'read1stAt':_['isNil'](_0x1ca402['read1stAt'])?moment()[_0x151d('0x65')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x151d('0x26')](function(_0x51220e){if(_0x51220e){_0x3d6a67[_0x151d('0x6b')]=_0x51220e[_0x151d('0x6c')]({'plain':!![]});interaction_log[_0x151d('0x27')](_0x151d('0x6d'),_0x241328[_0x151d('0x68')]['id'],_0x241328[_0x151d('0x68')]['name'],_0x241328[_0x151d('0x68')][_0x151d('0x6e')],_0x3d6a67[_0x151d('0x6b')]['id'],_0x241328[_0x151d('0x5e')]?JSON[_0x151d('0x6f')](_0x241328[_0x151d('0x5e')]):'null');return respondWithRpcPromise('AcceptMessage',_0x151d('0x70'),_0x3d6a67);}return null;})[_0x151d('0x26')](function(_0x3708bc){var _0x41be79=_0x151d('0x71')+_0x3708bc['message'][_0x151d('0x72')];return db[_0x151d('0x73')][_0x151d('0x48')](_0x41be79,{'type':db['Sequelize'][_0x151d('0x74')][_0x151d('0x75')],'raw':!![]})[_0x151d('0x26')](function(_0xa80bfe){return _0xa80bfe;});})[_0x151d('0x26')](function(_0x21f5e4){if(_0x21f5e4){_0x3d6a67[_0x151d('0x2d')][_0x151d('0x76')]=_0x21f5e4[0x0];if(!_0x241328[_0x151d('0x5e')][_0x151d('0x67')])return;return db['User'][_0x151d('0x5c')]({'where':{'id':_0x241328[_0x151d('0x5e')][_0x151d('0x67')],'role':_0x151d('0x69')},'attributes':['id','name',_0x151d('0x77'),_0x151d('0x78'),'internal'],'raw':!![]});}return null;})[_0x151d('0x26')](function(_0xeb1d39){if(!_0xeb1d39)return null;_0x3d6a67['message']['agent']=_0xeb1d39;return _0x3d6a67;})[_0x151d('0x26')](function(_0x5536ce){if(_0x5536ce){if(_0x241328['body']['manual']){_0x3d6a67[_0x151d('0x2d')]['interface']=util[_0x151d('0x65')](_0x151d('0x79'),_0x241328['user'][_0x151d('0x3f')]);_0x3d6a67[_0x151d('0x2d')][_0x151d('0x7a')]=_0x3d6a67['channel'];_0x3d6a67[_0x151d('0x2d')][_0x151d('0x7b')]=_0x3d6a67[_0x151d('0x7a')];_0x3d6a67[_0x151d('0x2d')][_0x151d('0x7c')]='accept';return respondWithRpcPromise(_0x151d('0x7d'),_0x151d('0x7d'),{'event':_0x151d('0x7e'),'message':_0x3d6a67[_0x151d('0x2d')]},client9002)[_0x151d('0x26')](function(){return _0x3d6a67;});}return _0x3d6a67;}return null;})[_0x151d('0x26')](respondWithResult(_0x275c55,null))['catch'](handleError(_0x275c55,null));};var interaction_log=require(_0x151d('0x17'))(_0x151d('0x60'));exports['reject']=function(_0x422f04,_0x482bf4,_0x27dda5){var _0x2cb31b={'agent':{},'channel':_0x151d('0x62')};if(_0x422f04[_0x151d('0x5e')]['id']){delete _0x422f04[_0x151d('0x5e')]['id'];}_0x422f04[_0x151d('0x5e')][_0x151d('0x67')]=_0x422f04[_0x151d('0x5e')][_0x151d('0x67')]||_0x422f04[_0x151d('0x68')]['id'];_0x2cb31b[_0x151d('0x69')]['id']=_0x422f04[_0x151d('0x5e')][_0x151d('0x67')];return db[_0x151d('0x43')][_0x151d('0x5c')]({'where':{'id':_0x422f04[_0x151d('0x5a')]['id'],'UserId':null}})[_0x151d('0x26')](handleEntityNotFound(_0x482bf4,null))['then'](function(_0x40734a){if(_0x40734a){_0x2cb31b[_0x151d('0x2d')]=_0x40734a[_0x151d('0x6c')]({'plain':!![]});return db[_0x151d('0x6a')][_0x151d('0x5c')]({'where':{'id':_0x40734a['OpenchannelInteractionId']}});}return null;})[_0x151d('0x26')](handleEntityNotFound(_0x482bf4,null))[_0x151d('0x26')](function(_0x461e5e){if(_0x461e5e){_0x2cb31b[_0x151d('0x6b')]=_0x461e5e[_0x151d('0x6c')]({'plain':!![]});interaction_log[_0x151d('0x27')](_0x151d('0x7f'),_0x422f04['user']['id'],_0x422f04[_0x151d('0x68')][_0x151d('0x3f')],_0x422f04[_0x151d('0x68')]['role'],_0x2cb31b['interaction']['id'],_0x422f04[_0x151d('0x5e')]?JSON['stringify'](_0x422f04[_0x151d('0x5e')]):'null');return respondWithRpcPromise(_0x151d('0x80'),_0x151d('0x81'),_0x2cb31b);}return null;})[_0x151d('0x26')](function(_0x4f27a8){var _0x2d30ff='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4f27a8[_0x151d('0x2d')]['ContactId'];return db[_0x151d('0x73')][_0x151d('0x48')](_0x2d30ff,{'type':db[_0x151d('0x82')]['QueryTypes'][_0x151d('0x75')],'raw':!![]})[_0x151d('0x26')](function(_0xed22f2){return _0xed22f2;});})[_0x151d('0x26')](function(_0x39e1c9){if(_0x39e1c9){_0x2cb31b[_0x151d('0x2d')][_0x151d('0x76')]=_0x39e1c9[0x0];if(!_0x422f04[_0x151d('0x5e')][_0x151d('0x67')])return;return db[_0x151d('0x83')][_0x151d('0x5c')]({'where':{'id':_0x422f04[_0x151d('0x5e')][_0x151d('0x67')],'role':_0x151d('0x69')},'attributes':['id','name',_0x151d('0x77'),_0x151d('0x78'),_0x151d('0x84')],'raw':!![]});}return null;})[_0x151d('0x26')](function(_0x5bf78c){if(!_0x5bf78c)return null;_0x2cb31b[_0x151d('0x2d')][_0x151d('0x69')]=_0x5bf78c;return _0x2cb31b;})[_0x151d('0x26')](function(_0x4bbb86){if(_0x4bbb86){_0x4bbb86['message'][_0x151d('0x85')]=util[_0x151d('0x65')](_0x151d('0x79'),_0x422f04['user'][_0x151d('0x3f')]);_0x4bbb86[_0x151d('0x2d')][_0x151d('0x7a')]=_0x2cb31b['channel'];_0x4bbb86[_0x151d('0x2d')][_0x151d('0x7b')]=_0x2cb31b[_0x151d('0x7a')];_0x4bbb86['message'][_0x151d('0x7c')]=_0x151d('0x3a');respondWithRpcPromise(_0x151d('0x7d'),_0x151d('0x7d'),{'event':_0x151d('0x86'),'message':_0x4bbb86['message']},client9002);return _0x2cb31b;}return null;})[_0x151d('0x26')](respondWithResult(_0x482bf4,null))[_0x151d('0x2f')](handleError(_0x482bf4,null));}; \ No newline at end of file +var _0x2e57=['hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','includeAll','include','findAll','rows','params','rawAttributes','fields','length','find','create','body','describe','openchannel-interactions','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','channel','motionChannel','event','accept','EventManager','acceptmessage','reject','OpenchannelInteractionId','get','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','json','limit','offset','count','set','Content-Range','apply','save','update','destroy','then','stack','name','send','index','map','OpenchannelMessage','fieldName','type','key','keys','query','filters','intersection','model','attributes'];(function(_0x3cf518,_0x2cd587){var _0x187969=function(_0x20885d){while(--_0x20885d){_0x3cf518['push'](_0x3cf518['shift']());}};_0x187969(++_0x2cd587);}(_0x2e57,0x1cc));var _0x72e5=function(_0x57203d,_0x31f230){_0x57203d=_0x57203d-0x0;var _0x4d6d08=_0x2e57[_0x57203d];return _0x4d6d08;};'use strict';var emlformat=require(_0x72e5('0x0'));var rimraf=require(_0x72e5('0x1'));var zipdir=require(_0x72e5('0x2'));var jsonpatch=require(_0x72e5('0x3'));var rp=require(_0x72e5('0x4'));var moment=require(_0x72e5('0x5'));var BPromise=require(_0x72e5('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x72e5('0x7'));var sox=require(_0x72e5('0x8'));var csv=require('to-csv');var ejs=require(_0x72e5('0x9'));var fs=require('fs');var fs_extra=require(_0x72e5('0xa'));var _=require(_0x72e5('0xb'));var squel=require(_0x72e5('0xc'));var crypto=require('crypto');var jsforce=require(_0x72e5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x72e5('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x72e5('0xf'));var authService=require(_0x72e5('0x10'));var qs=require(_0x72e5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72e5('0x12'));var logger=require(_0x72e5('0x13'))(_0x72e5('0x14'));var utils=require(_0x72e5('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x72e5('0x16'));var db=require('../../mysqldb')['db'];config[_0x72e5('0x17')]=_[_0x72e5('0x18')](config[_0x72e5('0x17')],{'host':_0x72e5('0x19'),'port':0x18eb});var socket=require(_0x72e5('0x1a'))(new Redis(config[_0x72e5('0x17')]));require(_0x72e5('0x1b'))[_0x72e5('0x1c')](socket);var jayson=require(_0x72e5('0x1d'));var client=jayson[_0x72e5('0x1e')][_0x72e5('0x1f')]({'port':0x232c});var client9002=jayson[_0x72e5('0x1e')][_0x72e5('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2b143b,_0x2c3cda,_0x4989ed,_0x55ae10){return new BPromise(function(_0xf695e4,_0x4213de){var _0x2af4b6=_0x55ae10||client;return _0x2af4b6[_0x72e5('0x20')](_0x2b143b,_0x4989ed)['then'](function(_0x12a42f){logger[_0x72e5('0x21')](_0x72e5('0x22'),_0x2c3cda,_0x72e5('0x23'));logger[_0x72e5('0x24')](_0x72e5('0x25'),_0x2c3cda,_0x72e5('0x23'),JSON[_0x72e5('0x26')](_0x12a42f));if(_0x12a42f['error']){if(_0x12a42f[_0x72e5('0x27')][_0x72e5('0x28')]===0x1f4){logger[_0x72e5('0x27')](_0x72e5('0x22'),_0x2c3cda,_0x12a42f[_0x72e5('0x27')][_0x72e5('0x29')]);return _0x4213de(_0x12a42f[_0x72e5('0x27')][_0x72e5('0x29')]);}logger['error'](_0x72e5('0x22'),_0x2c3cda,_0x12a42f[_0x72e5('0x27')]['message']);return _0xf695e4(_0x12a42f['error'][_0x72e5('0x29')]);}else{logger[_0x72e5('0x21')](_0x72e5('0x22'),_0x2c3cda,'request\x20sent');_0xf695e4(_0x12a42f['result']['message']);}})[_0x72e5('0x2a')](function(_0x2c587a){logger[_0x72e5('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x2c3cda,_0x2c587a);_0x4213de(_0x2c587a);});});}function respondWithStatusCode(_0x46a8f3,_0x516a47){_0x516a47=_0x516a47||0xcc;return function(_0x26cc6c){if(_0x26cc6c){return _0x46a8f3[_0x72e5('0x2b')](_0x516a47);}return _0x46a8f3['status'](_0x516a47)[_0x72e5('0x2c')]();};}function respondWithResult(_0x417e07,_0xfa195e){_0xfa195e=_0xfa195e||0xc8;return function(_0x49e506){if(_0x49e506){return _0x417e07[_0x72e5('0x2d')](_0xfa195e)[_0x72e5('0x2e')](_0x49e506);}};}function respondWithFilteredResult(_0x2ad78e,_0x1343a0){return function(_0x1a06b8){if(_0x1a06b8){var _0x27a351=typeof _0x1343a0['offset']==='undefined'&&typeof _0x1343a0[_0x72e5('0x2f')]==='undefined';var _0x47aa0d=_0x1a06b8['count'];var _0x954fc4=_0x27a351?0x0:_0x1343a0[_0x72e5('0x30')];var _0x35bd99=_0x27a351?_0x1a06b8[_0x72e5('0x31')]:_0x1343a0[_0x72e5('0x30')]+_0x1343a0[_0x72e5('0x2f')];var _0x538bfb;if(_0x35bd99>=_0x47aa0d){_0x35bd99=_0x47aa0d;_0x538bfb=0xc8;}else{_0x538bfb=0xce;}_0x2ad78e[_0x72e5('0x2d')](_0x538bfb);return _0x2ad78e[_0x72e5('0x32')](_0x72e5('0x33'),_0x954fc4+'-'+_0x35bd99+'/'+_0x47aa0d)[_0x72e5('0x2e')](_0x1a06b8);}return null;};}function patchUpdates(_0x52febb){return function(_0xd5554a){try{jsonpatch[_0x72e5('0x34')](_0xd5554a,_0x52febb,!![]);}catch(_0x454c98){return BPromise['reject'](_0x454c98);}return _0xd5554a[_0x72e5('0x35')]();};}function saveUpdates(_0x215fbd,_0x28f8af){return function(_0x570ceb){if(_0x570ceb){return _0x570ceb[_0x72e5('0x36')](_0x215fbd)['then'](function(_0x302267){return _0x302267;});}return null;};}function removeEntity(_0x908afa,_0x29591c){return function(_0x2859b1){if(_0x2859b1){return _0x2859b1[_0x72e5('0x37')]()[_0x72e5('0x38')](function(){_0x908afa[_0x72e5('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x438d24,_0x2c070d){return function(_0x2043cf){if(!_0x2043cf){_0x438d24[_0x72e5('0x2b')](0x194);}return _0x2043cf;};}function handleError(_0x15afed,_0x7ca818){_0x7ca818=_0x7ca818||0x1f4;return function(_0x554e1f){logger['error'](_0x554e1f[_0x72e5('0x39')]);if(_0x554e1f['name']){delete _0x554e1f[_0x72e5('0x3a')];}_0x15afed[_0x72e5('0x2d')](_0x7ca818)[_0x72e5('0x3b')](_0x554e1f);};}exports[_0x72e5('0x3c')]=function(_0x61be90,_0x50a061){var _0x54fd77={},_0x4dd808={},_0x5b7ee9={'count':0x0,'rows':[]};var _0x472014=_[_0x72e5('0x3d')](db[_0x72e5('0x3e')]['rawAttributes'],function(_0x268591){return{'name':_0x268591[_0x72e5('0x3f')],'type':_0x268591[_0x72e5('0x40')][_0x72e5('0x41')]};});_0x4dd808['model']=_[_0x72e5('0x3d')](_0x472014,_0x72e5('0x3a'));_0x4dd808['query']=_[_0x72e5('0x42')](_0x61be90[_0x72e5('0x43')]);_0x4dd808[_0x72e5('0x44')]=_[_0x72e5('0x45')](_0x4dd808[_0x72e5('0x46')],_0x4dd808['query']);_0x54fd77['attributes']=_[_0x72e5('0x45')](_0x4dd808[_0x72e5('0x46')],qs['fields'](_0x61be90['query']['fields']));_0x54fd77['attributes']=_0x54fd77['attributes']['length']?_0x54fd77[_0x72e5('0x47')]:_0x4dd808[_0x72e5('0x46')];if(!_0x61be90[_0x72e5('0x43')][_0x72e5('0x48')](_0x72e5('0x49'))){_0x54fd77[_0x72e5('0x2f')]=qs[_0x72e5('0x2f')](_0x61be90[_0x72e5('0x43')][_0x72e5('0x2f')]);_0x54fd77[_0x72e5('0x30')]=qs[_0x72e5('0x30')](_0x61be90[_0x72e5('0x43')][_0x72e5('0x30')]);}_0x54fd77[_0x72e5('0x4a')]=qs['sort'](_0x61be90[_0x72e5('0x43')][_0x72e5('0x4b')]);_0x54fd77['where']=qs[_0x72e5('0x44')](_[_0x72e5('0x4c')](_0x61be90[_0x72e5('0x43')],_0x4dd808[_0x72e5('0x44')]),_0x472014);if(_0x61be90[_0x72e5('0x43')][_0x72e5('0x4d')]){_0x54fd77['where']=_[_0x72e5('0x4e')](_0x54fd77[_0x72e5('0x4f')],{'$or':_['map'](_0x472014,function(_0x12ce0b){if(_0x12ce0b[_0x72e5('0x40')]!=='VIRTUAL'){var _0x2f18c5={};_0x2f18c5[_0x12ce0b[_0x72e5('0x3a')]]={'$like':'%'+_0x61be90[_0x72e5('0x43')][_0x72e5('0x4d')]+'%'};return _0x2f18c5;}})});}_0x54fd77=_['merge']({},_0x54fd77,_0x61be90[_0x72e5('0x50')]);var _0x45015d={'where':_0x54fd77['where']};return db[_0x72e5('0x3e')][_0x72e5('0x31')](_0x45015d)[_0x72e5('0x38')](function(_0x51ef03){_0x5b7ee9[_0x72e5('0x31')]=_0x51ef03;if(_0x61be90[_0x72e5('0x43')][_0x72e5('0x51')]){_0x54fd77[_0x72e5('0x52')]=[{'all':!![]}];}return db[_0x72e5('0x3e')][_0x72e5('0x53')](_0x54fd77);})[_0x72e5('0x38')](function(_0x2d6fb0){_0x5b7ee9[_0x72e5('0x54')]=_0x2d6fb0;return _0x5b7ee9;})[_0x72e5('0x38')](respondWithFilteredResult(_0x50a061,_0x54fd77))[_0x72e5('0x2a')](handleError(_0x50a061,null));};exports['show']=function(_0x204b2c,_0x264cbe){var _0x183919={'raw':!![],'where':{'id':_0x204b2c[_0x72e5('0x55')]['id']}},_0x2b93e1={};_0x2b93e1[_0x72e5('0x46')]=_[_0x72e5('0x42')](db['OpenchannelMessage'][_0x72e5('0x56')]);_0x2b93e1['query']=_['keys'](_0x204b2c[_0x72e5('0x43')]);_0x2b93e1[_0x72e5('0x44')]=_[_0x72e5('0x45')](_0x2b93e1[_0x72e5('0x46')],_0x2b93e1[_0x72e5('0x43')]);_0x183919['attributes']=_[_0x72e5('0x45')](_0x2b93e1['model'],qs[_0x72e5('0x57')](_0x204b2c['query'][_0x72e5('0x57')]));_0x183919[_0x72e5('0x47')]=_0x183919['attributes'][_0x72e5('0x58')]?_0x183919[_0x72e5('0x47')]:_0x2b93e1['model'];if(_0x204b2c['query'][_0x72e5('0x51')]){_0x183919[_0x72e5('0x52')]=[{'all':!![]}];}_0x183919=_[_0x72e5('0x4e')]({},_0x183919,_0x204b2c[_0x72e5('0x50')]);return db['OpenchannelMessage'][_0x72e5('0x59')](_0x183919)[_0x72e5('0x38')](handleEntityNotFound(_0x264cbe,null))[_0x72e5('0x38')](respondWithResult(_0x264cbe,null))['catch'](handleError(_0x264cbe,null));};exports[_0x72e5('0x5a')]=function(_0x11bef2,_0x2c8c1a){return db['OpenchannelMessage']['create'](_0x11bef2[_0x72e5('0x5b')],{})['then'](respondWithResult(_0x2c8c1a,0xc9))[_0x72e5('0x2a')](handleError(_0x2c8c1a,null));};exports[_0x72e5('0x36')]=function(_0x2a105e,_0x1d596){if(_0x2a105e['body']['id']){delete _0x2a105e[_0x72e5('0x5b')]['id'];}return db[_0x72e5('0x3e')][_0x72e5('0x59')]({'where':{'id':_0x2a105e[_0x72e5('0x55')]['id']}})[_0x72e5('0x38')](handleEntityNotFound(_0x1d596,null))[_0x72e5('0x38')](saveUpdates(_0x2a105e['body'],null))['then'](respondWithResult(_0x1d596,null))[_0x72e5('0x2a')](handleError(_0x1d596,null));};exports[_0x72e5('0x37')]=function(_0x5b0246,_0x583b04){return db[_0x72e5('0x3e')][_0x72e5('0x59')]({'where':{'id':_0x5b0246[_0x72e5('0x55')]['id']}})[_0x72e5('0x38')](handleEntityNotFound(_0x583b04,null))[_0x72e5('0x38')](removeEntity(_0x583b04,null))['catch'](handleError(_0x583b04,null));};exports['describe']=function(_0x46de9b,_0x4cb219){return db[_0x72e5('0x3e')][_0x72e5('0x5c')]()[_0x72e5('0x38')](respondWithResult(_0x4cb219,null))[_0x72e5('0x2a')](handleError(_0x4cb219,null));};var interaction_log=require(_0x72e5('0x13'))(_0x72e5('0x5d'));exports['accept']=function(_0x4bc223,_0x54ed41,_0x4eb5f5){var _0x112f00={'agent':{},'channel':_0x72e5('0x5e')};if(_0x4bc223[_0x72e5('0x5b')]['id']){delete _0x4bc223[_0x72e5('0x5b')]['id'];}_0x4bc223[_0x72e5('0x5b')][_0x72e5('0x5f')]=!![];_0x4bc223[_0x72e5('0x5b')][_0x72e5('0x60')]=moment()[_0x72e5('0x61')](_0x72e5('0x62'));_0x4bc223[_0x72e5('0x5b')][_0x72e5('0x63')]=_0x4bc223[_0x72e5('0x5b')][_0x72e5('0x63')]||_0x4bc223[_0x72e5('0x64')]['id'];_0x112f00[_0x72e5('0x65')]['id']=_0x4bc223['body'][_0x72e5('0x63')];return db['OpenchannelMessage']['find']({'where':{'id':_0x4bc223['params']['id'],'UserId':null}})[_0x72e5('0x38')](handleEntityNotFound(_0x54ed41,null))['then'](saveUpdates(_0x4bc223[_0x72e5('0x5b')],null))[_0x72e5('0x38')](function(_0x1cfca3){if(_0x1cfca3){_0x112f00[_0x72e5('0x29')]=_0x1cfca3['get']({'plain':!![]});return db['OpenchannelInteraction'][_0x72e5('0x59')]({'where':{'id':_0x1cfca3['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x54ed41,null))[_0x72e5('0x38')](function(_0x4dd347){if(_0x4dd347){return _0x4dd347[_0x72e5('0x36')]({'UserId':_0x4bc223['body'][_0x72e5('0x63')],'read1stAt':_[_0x72e5('0x66')](_0x4dd347[_0x72e5('0x67')])?moment()[_0x72e5('0x61')](_0x72e5('0x62')):undefined});}return null;})[_0x72e5('0x38')](function(_0x2dbcb5){if(_0x2dbcb5){_0x112f00[_0x72e5('0x68')]=_0x2dbcb5['get']({'plain':!![]});interaction_log[_0x72e5('0x21')](_0x72e5('0x69'),_0x4bc223['user']['id'],_0x4bc223[_0x72e5('0x64')][_0x72e5('0x3a')],_0x4bc223['user']['role'],_0x112f00[_0x72e5('0x68')]['id'],_0x4bc223[_0x72e5('0x5b')]?JSON['stringify'](_0x4bc223[_0x72e5('0x5b')]):_0x72e5('0x6a'));return respondWithRpcPromise(_0x72e5('0x6b'),_0x72e5('0x6c'),_0x112f00);}return null;})[_0x72e5('0x38')](function(_0x412e50){var _0x29fc0b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x412e50[_0x72e5('0x29')][_0x72e5('0x6d')];return db[_0x72e5('0x6e')]['query'](_0x29fc0b,{'type':db['Sequelize'][_0x72e5('0x6f')][_0x72e5('0x70')],'raw':!![]})[_0x72e5('0x38')](function(_0x21ec9c){return _0x21ec9c;});})[_0x72e5('0x38')](function(_0x4be85d){if(_0x4be85d){_0x112f00[_0x72e5('0x29')][_0x72e5('0x71')]=_0x4be85d[0x0];if(!_0x4bc223[_0x72e5('0x5b')]['UserId'])return;return db[_0x72e5('0x72')][_0x72e5('0x59')]({'where':{'id':_0x4bc223[_0x72e5('0x5b')][_0x72e5('0x63')],'role':'agent'},'attributes':['id',_0x72e5('0x3a'),_0x72e5('0x73'),_0x72e5('0x74'),_0x72e5('0x75')],'raw':!![]});}return null;})[_0x72e5('0x38')](function(_0x40820d){if(!_0x40820d)return null;_0x112f00['message'][_0x72e5('0x65')]=_0x40820d;return _0x112f00;})[_0x72e5('0x38')](function(_0x23d73a){if(_0x23d73a){if(_0x4bc223['body']['manual']){_0x112f00[_0x72e5('0x29')][_0x72e5('0x76')]=util[_0x72e5('0x61')]('SIP/%s',_0x4bc223[_0x72e5('0x64')][_0x72e5('0x3a')]);_0x112f00[_0x72e5('0x29')][_0x72e5('0x77')]=_0x112f00[_0x72e5('0x77')];_0x112f00[_0x72e5('0x29')][_0x72e5('0x78')]=_0x112f00[_0x72e5('0x77')];_0x112f00[_0x72e5('0x29')][_0x72e5('0x79')]=_0x72e5('0x7a');return respondWithRpcPromise(_0x72e5('0x7b'),'EventManager',{'event':_0x72e5('0x7c'),'message':_0x112f00[_0x72e5('0x29')]},client9002)[_0x72e5('0x38')](function(){return _0x112f00;});}return _0x112f00;}return null;})[_0x72e5('0x38')](respondWithResult(_0x54ed41,null))[_0x72e5('0x2a')](handleError(_0x54ed41,null));};var interaction_log=require(_0x72e5('0x13'))('openchannel-interactions');exports[_0x72e5('0x7d')]=function(_0x184036,_0x4c608a,_0x231156){var _0x47429f={'agent':{},'channel':'openchannel'};if(_0x184036['body']['id']){delete _0x184036[_0x72e5('0x5b')]['id'];}_0x184036['body'][_0x72e5('0x63')]=_0x184036[_0x72e5('0x5b')]['UserId']||_0x184036[_0x72e5('0x64')]['id'];_0x47429f[_0x72e5('0x65')]['id']=_0x184036[_0x72e5('0x5b')][_0x72e5('0x63')];return db[_0x72e5('0x3e')][_0x72e5('0x59')]({'where':{'id':_0x184036[_0x72e5('0x55')]['id'],'UserId':null}})[_0x72e5('0x38')](handleEntityNotFound(_0x4c608a,null))['then'](function(_0x3e2461){if(_0x3e2461){_0x47429f[_0x72e5('0x29')]=_0x3e2461['get']({'plain':!![]});return db['OpenchannelInteraction'][_0x72e5('0x59')]({'where':{'id':_0x3e2461[_0x72e5('0x7e')]}});}return null;})[_0x72e5('0x38')](handleEntityNotFound(_0x4c608a,null))['then'](function(_0xdde62f){if(_0xdde62f){_0x47429f['interaction']=_0xdde62f[_0x72e5('0x7f')]({'plain':!![]});interaction_log['info'](_0x72e5('0x80'),_0x184036[_0x72e5('0x64')]['id'],_0x184036['user']['name'],_0x184036[_0x72e5('0x64')][_0x72e5('0x81')],_0x47429f[_0x72e5('0x68')]['id'],_0x184036[_0x72e5('0x5b')]?JSON[_0x72e5('0x26')](_0x184036[_0x72e5('0x5b')]):'null');return respondWithRpcPromise('RejectMessage',_0x72e5('0x82'),_0x47429f);}return null;})[_0x72e5('0x38')](function(_0x240752){var _0x316157=_0x72e5('0x83')+_0x240752[_0x72e5('0x29')]['ContactId'];return db['sequelize'][_0x72e5('0x43')](_0x316157,{'type':db['Sequelize']['QueryTypes'][_0x72e5('0x70')],'raw':!![]})['then'](function(_0x15a06f){return _0x15a06f;});})[_0x72e5('0x38')](function(_0x16a6b5){if(_0x16a6b5){_0x47429f[_0x72e5('0x29')][_0x72e5('0x71')]=_0x16a6b5[0x0];if(!_0x184036[_0x72e5('0x5b')]['UserId'])return;return db['User'][_0x72e5('0x59')]({'where':{'id':_0x184036[_0x72e5('0x5b')][_0x72e5('0x63')],'role':_0x72e5('0x65')},'attributes':['id','name',_0x72e5('0x73'),'email',_0x72e5('0x75')],'raw':!![]});}return null;})['then'](function(_0x55a4d5){if(!_0x55a4d5)return null;_0x47429f[_0x72e5('0x29')][_0x72e5('0x65')]=_0x55a4d5;return _0x47429f;})[_0x72e5('0x38')](function(_0x217d4c){if(_0x217d4c){_0x217d4c[_0x72e5('0x29')][_0x72e5('0x76')]=util[_0x72e5('0x61')]('SIP/%s',_0x184036[_0x72e5('0x64')][_0x72e5('0x3a')]);_0x217d4c['message'][_0x72e5('0x77')]=_0x47429f['channel'];_0x217d4c['message'][_0x72e5('0x78')]=_0x47429f[_0x72e5('0x77')];_0x217d4c['message'][_0x72e5('0x79')]=_0x72e5('0x7d');respondWithRpcPromise(_0x72e5('0x7b'),_0x72e5('0x7b'),{'event':_0x72e5('0x84'),'message':_0x217d4c['message']},client9002);return _0x47429f;}return null;})[_0x72e5('0x38')](respondWithResult(_0x4c608a,null))[_0x72e5('0x2a')](handleError(_0x4c608a,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 13b39b3..e86762b 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 _0xaa01=['events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xaa01,0x154));var _0x1aa0=function(_0x5c28ba,_0x24df4b){_0x5c28ba=_0x5c28ba-0x0;var _0x2f1111=_0xaa01[_0x5c28ba];return _0x2f1111;};'use strict';var EventEmitter=require(_0x1aa0('0x0'));var OpenchannelMessage=require(_0x1aa0('0x1'))['db'][_0x1aa0('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x1aa0('0x3')](0x0);var events={'afterCreate':_0x1aa0('0x4'),'afterUpdate':'update','afterDestroy':_0x1aa0('0x5')};function emitEvent(_0x47fca5){return function(_0x235a0b,_0x4a264d,_0x2776af){OpenchannelMessageEvents['emit'](_0x47fca5+':'+_0x235a0b['id'],_0x235a0b);OpenchannelMessageEvents[_0x1aa0('0x6')](_0x47fca5,_0x235a0b);_0x2776af(null);};}for(var e in events){if(events[_0x1aa0('0x7')](e)){var event=events[e];OpenchannelMessage[_0x1aa0('0x8')](e,emitEvent(event));}}module[_0x1aa0('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xb369=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove','emit'];(function(_0x296923,_0x4adaed){var _0x29af70=function(_0x4eeedb){while(--_0x4eeedb){_0x296923['push'](_0x296923['shift']());}};_0x29af70(++_0x4adaed);}(_0xb369,0x1cf));var _0x9b36=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb369[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0x9b36('0x0'));var OpenchannelMessage=require(_0x9b36('0x1'))['db'][_0x9b36('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x9b36('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9b36('0x4'),'afterDestroy':_0x9b36('0x5')};function emitEvent(_0x294fa8){return function(_0x5259a7,_0x5c3666,_0x5adfd3){OpenchannelMessageEvents[_0x9b36('0x6')](_0x294fa8+':'+_0x5259a7['id'],_0x5259a7);OpenchannelMessageEvents[_0x9b36('0x6')](_0x294fa8,_0x5259a7);_0x5adfd3(null);};}for(var e in events){if(events[_0x9b36('0x7')](e)){var event=events[e];OpenchannelMessage[_0x9b36('0x8')](e,emitEvent(event));}}module[_0x9b36('0x9')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 641963e..6a4f6e2 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 _0x1aec=['then','createdAt','catch','error','secret','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','Contact','keys','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','POST','method','GET','format','threadId','update','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','findOne'];(function(_0x53b0f3,_0x3d7309){var _0x1e96d4=function(_0x44e591){while(--_0x44e591){_0x53b0f3['push'](_0x53b0f3['shift']());}};_0x1e96d4(++_0x3d7309);}(_0x1aec,0x11c));var _0xc1ae=function(_0xfbf519,_0x18803d){_0xfbf519=_0xfbf519-0x0;var _0x4ccfa9=_0x1aec[_0xfbf519];return _0x4ccfa9;};'use strict';var _=require(_0xc1ae('0x0'));var util=require(_0xc1ae('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc1ae('0x2'));var BPromise=require(_0xc1ae('0x3'));var rp=require(_0xc1ae('0x4'));var fs=require('fs');var path=require(_0xc1ae('0x5'));var rimraf=require(_0xc1ae('0x6'));var config=require('../../config/environment');var attributes=require(_0xc1ae('0x7'));module[_0xc1ae('0x8')]=function(_0x4e9edb,_0x4fd238){return _0x4e9edb['define'](_0xc1ae('0x9'),attributes,{'tableName':_0xc1ae('0xa'),'paranoid':![],'indexes':[{'name':_0xc1ae('0xb'),'fields':[_0xc1ae('0xc')],'type':_0xc1ae('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x43c8ed,_0x1c3b17,_0x564d9a){var _0x16d043=_0x4e9edb[_0xc1ae('0xe')];var _0x4ecd21=_0x43c8ed['get']({'plain':!![]});if(_0x4ecd21[_0xc1ae('0xf')][_0xc1ae('0x10')]()==='in'||_0x4ecd21[_0xc1ae('0xf')]['toLowerCase']()===_0xc1ae('0x11')&&!_0x4ecd21['secret']&&!_[_0xc1ae('0x12')](_0x4ecd21[_0xc1ae('0x13')])){_0x16d043[_0xc1ae('0x14')][_0xc1ae('0x15')]({'where':{'id':_0x4ecd21['OpenchannelInteractionId']}})[_0xc1ae('0x16')](function(_0x521933){if(_0x521933){_0x521933['update']({'lastMsgAt':_0x4ecd21[_0xc1ae('0x17')],'lastMsgDirection':_0x4ecd21[_0xc1ae('0xf')]['toLowerCase']()});}})[_0xc1ae('0x18')](function(_0x5e6447){console[_0xc1ae('0x19')](_0x5e6447);});}if(_0x4ecd21[_0xc1ae('0xf')]==='out'&&!_0x4ecd21[_0xc1ae('0x1a')]){var _0x6340b9;_0x16d043[_0xc1ae('0x1b')][_0xc1ae('0x1c')]()[_0xc1ae('0x16')](function(_0x2a741f){return _0x16d043[_0xc1ae('0x1d')][_0xc1ae('0x1e')]({'where':{'id':_0x4ecd21[_0xc1ae('0x1f')]},'include':[{'model':_0x16d043['OpenchannelInteraction'],'as':_0xc1ae('0x20'),'where':{'id':_0x4ecd21[_0xc1ae('0x21')]},'limit':0x1,'include':[{'model':_0x16d043[_0xc1ae('0x1b')],'as':_0xc1ae('0x22'),'attributes':_[_0xc1ae('0x23')](_0x2a741f)}]}]});})[_0xc1ae('0x16')](function(_0x45ae2c){_0x6340b9=_0x45ae2c[_0xc1ae('0x24')]({'plain':!![]});if(_0x6340b9&&_0x6340b9[_0xc1ae('0x25')]){logger[_0xc1ae('0x26')](_0xc1ae('0x27'),_0xc1ae('0x28'),util['format'](_0xc1ae('0x29'),_0x4ecd21['id'],_0x6340b9[_0xc1ae('0x25')]));if(_0x6340b9[_0xc1ae('0x20')]&&_0x6340b9[_0xc1ae('0x20')][_0xc1ae('0x2a')]){_0x4ecd21[_0xc1ae('0x2b')]=_['omit'](_0x6340b9[_0xc1ae('0x20')][0x0],'Contact');_0x4ecd21[_0xc1ae('0x22')]=_0x6340b9[_0xc1ae('0x20')][0x0]['Contact'];}var _0x1c3b17={'method':_0xc1ae('0x2c'),'uri':encodeURI(_0x6340b9[_0xc1ae('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1c3b17[_0xc1ae('0x2d')]){case _0xc1ae('0x2e'):_0x1c3b17['qs']=_0x4ecd21;break;case _0xc1ae('0x2c'):_0x1c3b17[_0xc1ae('0xc')]=_0x4ecd21;break;}return rp(_0x1c3b17)[_0xc1ae('0x16')](function(_0x4d85bd){logger[_0xc1ae('0x26')](_0xc1ae('0x27'),_0xc1ae('0x28'),util[_0xc1ae('0x2f')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x4ecd21['id'],_0x6340b9[_0xc1ae('0x25')]));if(_0x4d85bd['body']['threadId']&&_0x4d85bd['body']['threadId']!=_0x4ecd21[_0xc1ae('0x2b')][_0xc1ae('0x30')]){return _0x16d043[_0xc1ae('0x14')][_0xc1ae('0x31')]({'threadId':_0x4d85bd[_0xc1ae('0xc')][_0xc1ae('0x30')]},{'where':{'id':_0x4ecd21[_0xc1ae('0x2b')]['id']}});}else{return;}})[_0xc1ae('0x16')](function(){return _0x43c8ed['update']({'read':!![]});})[_0xc1ae('0x18')](function(_0x581efe){logger[_0xc1ae('0x19')](_0xc1ae('0x27'),'afterCreate',util['inspect'](_0x581efe,{'showHidden':![],'depth':null}));_0x564d9a();});}else{_0x564d9a();}})['finally'](function(){_0x564d9a();});}else{_0x564d9a();}}},'charset':'utf8mb4','collate':_0xc1ae('0x32')});}; \ No newline at end of file +var _0xfdfb=['body','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','update','catch','error','inspect','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','get','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','omit','Contact','GET','POST'];(function(_0x3225f0,_0x1f2bdf){var _0x48b5e8=function(_0x1b05fa){while(--_0x1b05fa){_0x3225f0['push'](_0x3225f0['shift']());}};_0x48b5e8(++_0x1f2bdf);}(_0xfdfb,0x1df));var _0xbfdf=function(_0x5b48bf,_0x1554e4){_0x5b48bf=_0x5b48bf-0x0;var _0x42344c=_0xfdfb[_0x5b48bf];return _0x42344c;};'use strict';var _=require(_0xbfdf('0x0'));var util=require(_0xbfdf('0x1'));var logger=require(_0xbfdf('0x2'))(_0xbfdf('0x3'));var moment=require(_0xbfdf('0x4'));var BPromise=require(_0xbfdf('0x5'));var rp=require(_0xbfdf('0x6'));var fs=require('fs');var path=require(_0xbfdf('0x7'));var rimraf=require(_0xbfdf('0x8'));var config=require(_0xbfdf('0x9'));var attributes=require(_0xbfdf('0xa'));module[_0xbfdf('0xb')]=function(_0xae91d4,_0x4332f8){return _0xae91d4[_0xbfdf('0xc')](_0xbfdf('0xd'),attributes,{'tableName':_0xbfdf('0xe'),'paranoid':![],'indexes':[{'name':_0xbfdf('0xf'),'fields':['body'],'type':_0xbfdf('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x464500,_0x4e5b43,_0x3d5f5f){var _0x46a1ab=_0xae91d4['models'];var _0x510bae=_0x464500[_0xbfdf('0x11')]({'plain':!![]});if(_0x510bae[_0xbfdf('0x12')][_0xbfdf('0x13')]()==='in'||_0x510bae['direction'][_0xbfdf('0x13')]()===_0xbfdf('0x14')&&!_0x510bae[_0xbfdf('0x15')]&&!_['isNil'](_0x510bae[_0xbfdf('0x16')])){_0x46a1ab[_0xbfdf('0x17')][_0xbfdf('0x18')]({'where':{'id':_0x510bae[_0xbfdf('0x19')]}})[_0xbfdf('0x1a')](function(_0x36a73a){if(_0x36a73a){_0x36a73a['update']({'lastMsgAt':_0x510bae['createdAt'],'lastMsgDirection':_0x510bae[_0xbfdf('0x12')][_0xbfdf('0x13')]()});}})['catch'](function(_0x1f55fd){console['error'](_0x1f55fd);});}if(_0x510bae[_0xbfdf('0x12')]===_0xbfdf('0x14')&&!_0x510bae['secret']){var _0x425630;_0x46a1ab['CmContact'][_0xbfdf('0x1b')]()[_0xbfdf('0x1a')](function(_0x12f20d){return _0x46a1ab[_0xbfdf('0x1c')][_0xbfdf('0x1d')]({'where':{'id':_0x510bae[_0xbfdf('0x1e')]},'include':[{'model':_0x46a1ab[_0xbfdf('0x17')],'as':_0xbfdf('0x1f'),'where':{'id':_0x510bae[_0xbfdf('0x19')]},'limit':0x1,'include':[{'model':_0x46a1ab['CmContact'],'as':'Contact','attributes':_['keys'](_0x12f20d)}]}]});})[_0xbfdf('0x1a')](function(_0x39ad78){_0x425630=_0x39ad78[_0xbfdf('0x11')]({'plain':!![]});if(_0x425630&&_0x425630[_0xbfdf('0x20')]){logger['info'](_0xbfdf('0x21'),_0xbfdf('0x22'),util[_0xbfdf('0x23')](_0xbfdf('0x24'),_0x510bae['id'],_0x425630[_0xbfdf('0x20')]));if(_0x425630[_0xbfdf('0x1f')]&&_0x425630[_0xbfdf('0x1f')]['length']){_0x510bae['Interaction']=_[_0xbfdf('0x25')](_0x425630[_0xbfdf('0x1f')][0x0],'Contact');_0x510bae[_0xbfdf('0x26')]=_0x425630[_0xbfdf('0x1f')][0x0][_0xbfdf('0x26')];}var _0x4e5b43={'method':'POST','uri':encodeURI(_0x425630[_0xbfdf('0x20')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4e5b43['method']){case _0xbfdf('0x27'):_0x4e5b43['qs']=_0x510bae;break;case _0xbfdf('0x28'):_0x4e5b43[_0xbfdf('0x29')]=_0x510bae;break;}return rp(_0x4e5b43)[_0xbfdf('0x1a')](function(_0x457486){logger[_0xbfdf('0x2a')](_0xbfdf('0x21'),_0xbfdf('0x22'),util[_0xbfdf('0x23')](_0xbfdf('0x2b'),_0x510bae['id'],_0x425630[_0xbfdf('0x20')]));if(_0x457486['body'][_0xbfdf('0x2c')]&&_0x457486[_0xbfdf('0x29')]['threadId']!=_0x510bae[_0xbfdf('0x2d')][_0xbfdf('0x2c')]){return _0x46a1ab[_0xbfdf('0x17')]['update']({'threadId':_0x457486[_0xbfdf('0x29')][_0xbfdf('0x2c')]},{'where':{'id':_0x510bae['Interaction']['id']}});}else{return;}})[_0xbfdf('0x1a')](function(){return _0x464500[_0xbfdf('0x2e')]({'read':!![]});})[_0xbfdf('0x2f')](function(_0x129840){logger[_0xbfdf('0x30')](_0xbfdf('0x21'),'afterCreate',util[_0xbfdf('0x31')](_0x129840,{'showHidden':![],'depth':null}));_0x3d5f5f();});}else{_0x3d5f5f();}})[_0xbfdf('0x32')](function(){_0x3d5f5f();});}else{_0x3d5f5f();}}},'charset':'utf8mb4','collate':_0xbfdf('0x33')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index b10fd67..5f31e27 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(_0x1e405a,_0x5d8635){var _0x578cf1=function(_0x2e8492){while(--_0x2e8492){_0x1e405a['push'](_0x1e405a['shift']());}};_0x578cf1(++_0x5d8635);}(_0x2ef3,0xba));var _0x32ef=function(_0x155bde,_0xc4f717){_0x155bde=_0x155bde-0x0;var _0x17df09=_0x2ef3[_0x155bde];return _0x17df09;};'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(_0x56208d,_0x437ac8){var _0x171c5c=function(_0x271d32){while(--_0x271d32){_0x56208d['push'](_0x56208d['shift']());}};_0x171c5c(++_0x437ac8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x308a1d,_0x3d379d){_0x308a1d=_0x308a1d-0x0;var _0x5eb875=_0x5f2f[_0x308a1d];return _0x5eb875;};'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 1f2c972..3938154 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 _0x6cae=['length','openchannelMessage:','./openchannelMessage.events','save','update','emit','register'];(function(_0x22cc16,_0x1f4fa2){var _0x399b70=function(_0x34d464){while(--_0x34d464){_0x22cc16['push'](_0x22cc16['shift']());}};_0x399b70(++_0x1f4fa2);}(_0x6cae,0xf0));var _0xe6ca=function(_0x57d0c1,_0x478e7a){_0x57d0c1=_0x57d0c1-0x0;var _0x3c8b91=_0x6cae[_0x57d0c1];return _0x3c8b91;};'use strict';var OpenchannelMessageEvents=require(_0xe6ca('0x0'));var events=[_0xe6ca('0x1'),'remove',_0xe6ca('0x2')];function createListener(_0x321f19,_0x3bc22b){return function(_0x3630f1){_0x3bc22b[_0xe6ca('0x3')](_0x321f19,_0x3630f1);};}function removeListener(_0x123f96,_0x3c32ce){return function(){OpenchannelMessageEvents['removeListener'](_0x123f96,_0x3c32ce);};}exports[_0xe6ca('0x4')]=function(_0x1fb8a6){for(var _0x30f82a=0x0,_0x257149=events[_0xe6ca('0x5')];_0x30f82a<_0x257149;_0x30f82a++){var _0x91d28c=events[_0x30f82a];var _0x10a28f=createListener(_0xe6ca('0x6')+_0x91d28c,_0x1fb8a6);OpenchannelMessageEvents['on'](_0x91d28c,_0x10a28f);}}; \ No newline at end of file +var _0x5e11=['register','length','openchannelMessage:','./openchannelMessage.events','remove','update','emit'];(function(_0x462c60,_0xd4cb4c){var _0x2b1877=function(_0x53ce32){while(--_0x53ce32){_0x462c60['push'](_0x462c60['shift']());}};_0x2b1877(++_0xd4cb4c);}(_0x5e11,0x1c3));var _0x15e1=function(_0x57fa33,_0x2b8222){_0x57fa33=_0x57fa33-0x0;var _0x12e724=_0x5e11[_0x57fa33];return _0x12e724;};'use strict';var OpenchannelMessageEvents=require(_0x15e1('0x0'));var events=['save',_0x15e1('0x1'),_0x15e1('0x2')];function createListener(_0x197058,_0xd2c9d9){return function(_0x82943a){_0xd2c9d9[_0x15e1('0x3')](_0x197058,_0x82943a);};}function removeListener(_0x598eda,_0x2409d8){return function(){OpenchannelMessageEvents['removeListener'](_0x598eda,_0x2409d8);};}exports[_0x15e1('0x4')]=function(_0x41b56c){for(var _0xa0d783=0x0,_0xfabd74=events[_0x15e1('0x5')];_0xa0d783<_0xfabd74;_0xa0d783++){var _0x50b131=events[_0xa0d783];var _0xe0b339=createListener(_0x15e1('0x6')+_0x50b131,_0x41b56c);OpenchannelMessageEvents['on'](_0x50b131,_0xe0b339);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index de45ebb..2b3fdb3 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 _0x9146=['addTeams','addAgents','put','destroy','delete','removeTeams','removeAgents','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./openchannelQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x225679,_0x1e8511){var _0x2a652e=function(_0x2665b6){while(--_0x2665b6){_0x225679['push'](_0x225679['shift']());}};_0x2a652e(++_0x1e8511);}(_0x9146,0x1bb));var _0x6914=function(_0x101a17,_0x5d047a){_0x101a17=_0x101a17-0x0;var _0x3b76ee=_0x9146[_0x101a17];return _0x3b76ee;};'use strict';var multer=require('multer');var util=require(_0x6914('0x0'));var path=require(_0x6914('0x1'));var timeout=require(_0x6914('0x2'));var express=require(_0x6914('0x3'));var router=express['Router']();var fs_extra=require(_0x6914('0x4'));var auth=require(_0x6914('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6914('0x6'));router[_0x6914('0x7')]('/',auth[_0x6914('0x8')](),controller[_0x6914('0x9')]);router[_0x6914('0x7')](_0x6914('0xa'),auth[_0x6914('0x8')](),controller['describe']);router[_0x6914('0x7')](_0x6914('0xb'),auth[_0x6914('0x8')](),controller[_0x6914('0xc')]);router[_0x6914('0x7')](_0x6914('0xd'),auth[_0x6914('0x8')](),controller[_0x6914('0xe')]);router['get'](_0x6914('0xf'),auth[_0x6914('0x8')](),controller[_0x6914('0x10')]);router[_0x6914('0x7')](_0x6914('0x11'),auth[_0x6914('0x8')](),controller[_0x6914('0x12')]);router[_0x6914('0x13')]('/',auth[_0x6914('0x8')](),controller[_0x6914('0x14')]);router[_0x6914('0x13')](_0x6914('0xf'),auth[_0x6914('0x8')](),controller[_0x6914('0x15')]);router[_0x6914('0x13')]('/:id/users',auth[_0x6914('0x8')](),controller[_0x6914('0x16')]);router[_0x6914('0x17')](_0x6914('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x6914('0xb'),auth[_0x6914('0x8')](),controller[_0x6914('0x18')]);router[_0x6914('0x19')](_0x6914('0xf'),auth[_0x6914('0x8')](),controller[_0x6914('0x1a')]);router[_0x6914('0x19')](_0x6914('0x11'),auth[_0x6914('0x8')](),controller[_0x6914('0x1b')]);module[_0x6914('0x1c')]=router; \ No newline at end of file +var _0x046b=['getMembers','/:id/teams','getTeams','/:id/users','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','multer','util','connect-timeout','express','Router','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members'];(function(_0x191c31,_0x4afc09){var _0x33c6c9=function(_0xc5dbba){while(--_0xc5dbba){_0x191c31['push'](_0x191c31['shift']());}};_0x33c6c9(++_0x4afc09);}(_0x046b,0xed));var _0xb046=function(_0x105278,_0x774ed2){_0x105278=_0x105278-0x0;var _0x47b1f=_0x046b[_0x105278];return _0x47b1f;};'use strict';var multer=require(_0xb046('0x0'));var util=require(_0xb046('0x1'));var path=require('path');var timeout=require(_0xb046('0x2'));var express=require(_0xb046('0x3'));var router=express[_0xb046('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb046('0x5'));var controller=require(_0xb046('0x6'));router[_0xb046('0x7')]('/',auth[_0xb046('0x8')](),controller[_0xb046('0x9')]);router['get'](_0xb046('0xa'),auth[_0xb046('0x8')](),controller[_0xb046('0xb')]);router['get'](_0xb046('0xc'),auth[_0xb046('0x8')](),controller[_0xb046('0xd')]);router['get'](_0xb046('0xe'),auth[_0xb046('0x8')](),controller[_0xb046('0xf')]);router[_0xb046('0x7')](_0xb046('0x10'),auth[_0xb046('0x8')](),controller[_0xb046('0x11')]);router[_0xb046('0x7')](_0xb046('0x12'),auth[_0xb046('0x8')](),controller['getAgents']);router['post']('/',auth[_0xb046('0x8')](),controller[_0xb046('0x13')]);router['post']('/:id/teams',auth[_0xb046('0x8')](),controller[_0xb046('0x14')]);router['post']('/:id/users',auth[_0xb046('0x8')](),controller[_0xb046('0x15')]);router[_0xb046('0x16')](_0xb046('0xc'),auth[_0xb046('0x8')](),controller[_0xb046('0x17')]);router[_0xb046('0x18')](_0xb046('0xc'),auth[_0xb046('0x8')](),controller[_0xb046('0x19')]);router[_0xb046('0x18')]('/:id/teams',auth['isAuthenticated'](),controller[_0xb046('0x1a')]);router[_0xb046('0x18')]('/:id/users',auth[_0xb046('0x8')](),controller['removeAgents']);module[_0xb046('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 51c3044..9651114 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 _0xc779=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x2c7dc6,_0x3c4ce0){var _0x10002b=function(_0x26f390){while(--_0x26f390){_0x2c7dc6['push'](_0x2c7dc6['shift']());}};_0x10002b(++_0x3c4ce0);}(_0xc779,0xee));var _0x9c77=function(_0x28384d,_0x594725){_0x28384d=_0x28384d-0x0;var _0x4514d8=_0xc779[_0x28384d];return _0x4514d8;};'use strict';var Sequelize=require(_0x9c77('0x0'));module[_0x9c77('0x1')]={'name':{'type':Sequelize[_0x9c77('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x9c77('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9c77('0x4')](_0x9c77('0x5'),_0x9c77('0x6'),_0x9c77('0x7'))}}; \ No newline at end of file +var _0x0120=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x50a79d,_0x2591aa){var _0x2ce3eb=function(_0x2e9927){while(--_0x2e9927){_0x50a79d['push'](_0x50a79d['shift']());}};_0x2ce3eb(++_0x2591aa);}(_0x0120,0x13c));var _0x0012=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0120[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x0012('0x0'));module[_0x0012('0x1')]={'name':{'type':Sequelize[_0x0012('0x2')],'unique':_0x0012('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0012('0x2')]},'timeout':{'type':Sequelize[_0x0012('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0012('0x5')](_0x0012('0x6'),_0x0012('0x7'),_0x0012('0x8'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index e0544a4..0022660 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 _0x31c0=['name','send','map','OpenchannelQueue','type','key','getOptions','include','show','params','keys','rawAttributes','query','filters','model','intersection','attributes','length','includeAll','merge','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserOpenchannelQueue','fields','hasOwnProperty','order','sort','pick','where','OpenchannelQueueId','filter','findAll','User','findAndCountAll','openchannelPause','updatedAt','createdAt','rows','format','%s/%s','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','each','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','transaction','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','nolimit','bluebird','util','lodash','squel','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','get','OpenchannelQueues','UserProfileResource','status'];(function(_0x149234,_0xb398ea){var _0x5a3b92=function(_0x35124e){while(--_0x35124e){_0x149234['push'](_0x149234['shift']());}};_0x5a3b92(++_0xb398ea);}(_0x31c0,0xd7));var _0x031c=function(_0xedc58a,_0x46d853){_0xedc58a=_0xedc58a-0x0;var _0x37ac38=_0x31c0[_0xedc58a];return _0x37ac38;};'use strict';var BPromise=require(_0x031c('0x0'));var util=require(_0x031c('0x1'));var _=require(_0x031c('0x2'));var squel=require(_0x031c('0x3'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x031c('0x4'));var config=require(_0x031c('0x5'));var db=require(_0x031c('0x6'))['db'];config[_0x031c('0x7')]=_[_0x031c('0x8')](config[_0x031c('0x7')],{'host':_0x031c('0x9'),'port':0x18eb});var socket=require(_0x031c('0xa'))(new Redis(config[_0x031c('0x7')]));require(_0x031c('0xb'))[_0x031c('0xc')](socket);function respondWithStatusCode(_0x51140c,_0x50ef91){_0x50ef91=_0x50ef91||0xcc;return function(_0x22286c){if(_0x22286c){return _0x51140c[_0x031c('0xd')](_0x50ef91);}return _0x51140c['status'](_0x50ef91)[_0x031c('0xe')]();};}function respondWithResult(_0x4601c4,_0xd61c5b){_0xd61c5b=_0xd61c5b||0xc8;return function(_0x41fe52){if(_0x41fe52){return _0x4601c4['status'](_0xd61c5b)[_0x031c('0xf')](_0x41fe52);}};}function respondWithFilteredResult(_0x517cc4,_0xa5be77){return function(_0x473ac5){if(_0x473ac5){var _0x3e1008=typeof _0xa5be77[_0x031c('0x10')]===_0x031c('0x11')&&typeof _0xa5be77[_0x031c('0x12')]==='undefined';var _0x1f4ac0=_0x473ac5[_0x031c('0x13')];var _0x28d8fa=_0x3e1008?0x0:_0xa5be77[_0x031c('0x10')];var _0x2dfe66=_0x3e1008?_0x473ac5[_0x031c('0x13')]:_0xa5be77[_0x031c('0x10')]+_0xa5be77['limit'];var _0x3a66f0;if(_0x2dfe66>=_0x1f4ac0){_0x2dfe66=_0x1f4ac0;_0x3a66f0=0xc8;}else{_0x3a66f0=0xce;}_0x517cc4['status'](_0x3a66f0);return _0x517cc4[_0x031c('0x14')](_0x031c('0x15'),_0x28d8fa+'-'+_0x2dfe66+'/'+_0x1f4ac0)['json'](_0x473ac5);}return null;};}function saveUpdates(_0x3d7563){return function(_0x4316f4){if(_0x4316f4){return _0x4316f4[_0x031c('0x16')](_0x3d7563)['then'](function(_0x3a5a88){return _0x3a5a88;});}return null;};}function removeEntity(_0x34434a){return function(_0x313c4a){if(_0x313c4a){return _0x313c4a[_0x031c('0x17')]()[_0x031c('0x18')](function(){var _0x20cee3=_0x313c4a[_0x031c('0x19')]({'plain':!![]});var _0x202b54=_0x031c('0x1a');return db[_0x031c('0x1b')][_0x031c('0x17')]({'where':{'type':_0x202b54,'resourceId':_0x20cee3['id']}})[_0x031c('0x18')](function(){return _0x313c4a;});})[_0x031c('0x18')](function(){_0x34434a[_0x031c('0x1c')](0xcc)[_0x031c('0xe')]();});}};}function handleEntityNotFound(_0x5ffe6c){return function(_0x100f6d){if(!_0x100f6d){_0x5ffe6c[_0x031c('0xd')](0x194);}return _0x100f6d;};}function handleError(_0x33a897,_0x53eb28){_0x53eb28=_0x53eb28||0x1f4;return function(_0xc7897){logger['error'](_0xc7897['stack']);if(_0xc7897[_0x031c('0x1d')]){delete _0xc7897['name'];}_0x33a897[_0x031c('0x1c')](_0x53eb28)[_0x031c('0x1e')](_0xc7897);};}exports['index']=function(_0x495674,_0x40ef79){var _0x3483e7={};var _0x4345fc={'count':0x0,'rows':[]};var _0x49f00f=_[_0x031c('0x1f')](db[_0x031c('0x20')]['rawAttributes'],function(_0x594a35){return{'name':_0x594a35['fieldName'],'type':_0x594a35[_0x031c('0x21')][_0x031c('0x22')]};});_0x3483e7=qs[_0x031c('0x23')](_0x49f00f,_0x495674);var _0x368ea0={'where':_0x3483e7['where']};return db[_0x031c('0x20')][_0x031c('0x13')](_0x368ea0)[_0x031c('0x18')](function(_0x4328bd){_0x4345fc[_0x031c('0x13')]=_0x4328bd;_0x3483e7['include']=qs[_0x031c('0x24')](_0x495674['query']);return db[_0x031c('0x20')]['findAll'](_0x3483e7);})['then'](function(_0x1c5714){_0x4345fc['rows']=_0x1c5714;return _0x4345fc;})[_0x031c('0x18')](respondWithFilteredResult(_0x40ef79,_0x3483e7))['catch'](handleError(_0x40ef79,null));};exports[_0x031c('0x25')]=function(_0x4389d3,_0xa9d339){var _0x593f79={'raw':!![],'where':{'id':_0x4389d3[_0x031c('0x26')]['id']}},_0x3ac56a={};_0x3ac56a['model']=_[_0x031c('0x27')](db[_0x031c('0x20')][_0x031c('0x28')]);_0x3ac56a[_0x031c('0x29')]=_[_0x031c('0x27')](_0x4389d3[_0x031c('0x29')]);_0x3ac56a[_0x031c('0x2a')]=_['intersection'](_0x3ac56a[_0x031c('0x2b')],_0x3ac56a['query']);_0x593f79['attributes']=_[_0x031c('0x2c')](_0x3ac56a[_0x031c('0x2b')],qs['fields'](_0x4389d3[_0x031c('0x29')]['fields']));_0x593f79[_0x031c('0x2d')]=_0x593f79[_0x031c('0x2d')][_0x031c('0x2e')]?_0x593f79['attributes']:_0x3ac56a[_0x031c('0x2b')];if(_0x4389d3[_0x031c('0x29')][_0x031c('0x2f')]){_0x593f79[_0x031c('0x24')]=[{'all':!![]}];}_0x593f79=_[_0x031c('0x30')]({},_0x593f79,_0x4389d3[_0x031c('0x31')]);return db[_0x031c('0x20')][_0x031c('0x32')](_0x593f79)[_0x031c('0x18')](handleEntityNotFound(_0xa9d339,null))[_0x031c('0x18')](respondWithResult(_0xa9d339,null))[_0x031c('0x33')](handleError(_0xa9d339,null));};exports[_0x031c('0x34')]=function(_0x3181af,_0x1327b5){return db[_0x031c('0x20')][_0x031c('0x34')](_0x3181af[_0x031c('0x35')],{})[_0x031c('0x18')](function(_0x4deefc){var _0xd53d95=_0x3181af[_0x031c('0x36')][_0x031c('0x19')]({'plain':!![]});if(!_0xd53d95)throw new Error(_0x031c('0x37'));if(_0xd53d95[_0x031c('0x38')]===_0x031c('0x36')){var _0x2b5471=_0x4deefc[_0x031c('0x19')]({'plain':!![]});var _0xb6d1cb='OpenchannelQueues';return db[_0x031c('0x39')][_0x031c('0x32')]({'where':{'name':_0xb6d1cb,'userProfileId':_0xd53d95['userProfileId']},'raw':!![]})[_0x031c('0x18')](function(_0x1813a1){if(_0x1813a1&&_0x1813a1[_0x031c('0x3a')]===0x0){return db['UserProfileResource'][_0x031c('0x34')]({'name':_0x2b5471[_0x031c('0x1d')],'resourceId':_0x2b5471['id'],'type':_0x1813a1[_0x031c('0x1d')],'sectionId':_0x1813a1['id']},{})[_0x031c('0x18')](function(){return _0x4deefc;});}else{return _0x4deefc;}})[_0x031c('0x33')](function(_0x23e290){logger[_0x031c('0x3b')](_0x031c('0x3c'),_0x23e290);throw _0x23e290;});}return _0x4deefc;})[_0x031c('0x18')](respondWithResult(_0x1327b5,0xc9))[_0x031c('0x33')](handleError(_0x1327b5,null));};exports[_0x031c('0x16')]=function(_0x18aa8a,_0x3a1ab3){if(_0x18aa8a[_0x031c('0x35')]['id']){delete _0x18aa8a[_0x031c('0x35')]['id'];}return db[_0x031c('0x20')][_0x031c('0x32')]({'where':{'id':_0x18aa8a['params']['id']}})[_0x031c('0x18')](handleEntityNotFound(_0x3a1ab3,null))[_0x031c('0x18')](saveUpdates(_0x18aa8a[_0x031c('0x35')],null))[_0x031c('0x18')](respondWithResult(_0x3a1ab3,null))[_0x031c('0x33')](handleError(_0x3a1ab3,null));};exports['destroy']=function(_0x2fb772,_0x3192ef){return db['OpenchannelQueue'][_0x031c('0x32')]({'where':{'id':_0x2fb772['params']['id']}})[_0x031c('0x18')](handleEntityNotFound(_0x3192ef,null))[_0x031c('0x18')](removeEntity(_0x3192ef,null))['catch'](handleError(_0x3192ef,null));};exports[_0x031c('0x3d')]=function(_0x5d9210,_0x5ceeaf){return db[_0x031c('0x20')][_0x031c('0x3d')]()[_0x031c('0x18')](respondWithResult(_0x5ceeaf,null))[_0x031c('0x33')](handleError(_0x5ceeaf,null));};exports['getMembers']=function(_0x511151,_0x36f629){var _0x3ec199={'raw':!![],'where':{}},_0x35946b={},_0x33b762;return db[_0x031c('0x20')]['findOne']({'where':{'id':_0x511151[_0x031c('0x26')]['id']}})[_0x031c('0x18')](handleEntityNotFound(_0x36f629,null))[_0x031c('0x18')](function(_0x1d70e2){if(_0x1d70e2){_0x33b762=_0x1d70e2[_0x031c('0x19')]({'plain':!![]});_0x35946b[_0x031c('0x2b')]=_['keys'](db[_0x031c('0x3e')]['rawAttributes']);_0x35946b['query']=_[_0x031c('0x27')](_0x511151[_0x031c('0x29')]);_0x35946b[_0x031c('0x2a')]=_['intersection'](_0x35946b[_0x031c('0x2b')],_0x35946b[_0x031c('0x29')]);_0x3ec199[_0x031c('0x2d')]=_[_0x031c('0x2c')](_0x35946b[_0x031c('0x2b')],qs[_0x031c('0x3f')](_0x511151[_0x031c('0x29')][_0x031c('0x3f')]));_0x3ec199[_0x031c('0x2d')]=_0x3ec199[_0x031c('0x2d')]['length']?_0x3ec199[_0x031c('0x2d')]:_0x35946b[_0x031c('0x2b')];if(!_0x511151[_0x031c('0x29')][_0x031c('0x40')]('nolimit')){_0x3ec199[_0x031c('0x12')]=qs['limit'](_0x511151[_0x031c('0x29')][_0x031c('0x12')]);_0x3ec199[_0x031c('0x10')]=qs[_0x031c('0x10')](_0x511151[_0x031c('0x29')][_0x031c('0x10')]);}_0x3ec199[_0x031c('0x41')]=qs[_0x031c('0x42')](_0x511151[_0x031c('0x29')][_0x031c('0x42')]);_0x3ec199['where']=qs[_0x031c('0x2a')](_[_0x031c('0x43')](_0x511151[_0x031c('0x29')],_0x35946b[_0x031c('0x2a')]));_0x3ec199[_0x031c('0x44')][_0x031c('0x45')]=_0x1d70e2['id'];if(_0x511151[_0x031c('0x29')][_0x031c('0x46')]){_0x3ec199[_0x031c('0x44')]=_[_0x031c('0x30')](_0x3ec199[_0x031c('0x44')],{'$or':_[_0x031c('0x1f')](_0x3ec199[_0x031c('0x2d')],function(_0x36e6ab){var _0x5d4b8f={};_0x5d4b8f[_0x36e6ab]={'$like':'%'+_0x511151[_0x031c('0x29')][_0x031c('0x46')]+'%'};return _0x5d4b8f;})});}_0x3ec199=_['merge']({},_0x3ec199,_0x511151[_0x031c('0x31')]);return db[_0x031c('0x3e')][_0x031c('0x47')](_0x3ec199);}})['then'](function(_0x2825e0){if(_0x2825e0){return db[_0x031c('0x48')][_0x031c('0x49')]({'where':{'id':_[_0x031c('0x1f')](_0x2825e0,'UserId'),'role':'agent'},'attributes':['id',_0x031c('0x1d'),_0x031c('0x4a'),_0x031c('0x4b'),_0x031c('0x4c')]});}})[_0x031c('0x18')](function(_0x515529){if(_0x515529){return{'count':_0x515529['count'],'rows':_[_0x031c('0x1f')](_0x515529[_0x031c('0x4d')],function(_0x1e641b){return{'membername':_0x1e641b[_0x031c('0x1d')],'UserId':_0x1e641b['id'],'queue_name':_0x33b762[_0x031c('0x1d')],'OpenchannelQueueId':_0x33b762['id'],'interface':util[_0x031c('0x4e')](_0x031c('0x4f'),'SIP',_0x1e641b[_0x031c('0x1d')]),'penalty':0x0,'paused':_0x1e641b[_0x031c('0x4a')],'createdAt':_0x1e641b[_0x031c('0x4c')],'updatedAt':_0x1e641b[_0x031c('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x36f629,_0x3ec199))['catch'](handleError(_0x36f629,null));};exports[_0x031c('0x50')]=function(_0x32ec29,_0x2745d0){var _0x5e34d7={};var _0xbb7d54={};var _0x8bab5a;var _0x97b2a7;return db['OpenchannelQueue'][_0x031c('0x51')]({'where':{'id':_0x32ec29[_0x031c('0x26')]['id']}})[_0x031c('0x18')](handleEntityNotFound(_0x2745d0,null))['then'](function(_0x17e995){if(_0x17e995){_0x8bab5a=_0x17e995;_0xbb7d54[_0x031c('0x2b')]=_['keys'](db[_0x031c('0x52')][_0x031c('0x28')]);_0xbb7d54[_0x031c('0x29')]=_[_0x031c('0x27')](_0x32ec29[_0x031c('0x29')]);_0xbb7d54[_0x031c('0x2a')]=_[_0x031c('0x2c')](_0xbb7d54[_0x031c('0x2b')],_0xbb7d54['query']);_0x5e34d7[_0x031c('0x2d')]=_[_0x031c('0x2c')](_0xbb7d54[_0x031c('0x2b')],qs[_0x031c('0x3f')](_0x32ec29[_0x031c('0x29')][_0x031c('0x3f')]));_0x5e34d7[_0x031c('0x2d')]=_0x5e34d7[_0x031c('0x2d')][_0x031c('0x2e')]?_0x5e34d7[_0x031c('0x2d')]:_0xbb7d54[_0x031c('0x2b')];_0x5e34d7[_0x031c('0x41')]=qs[_0x031c('0x42')](_0x32ec29[_0x031c('0x29')][_0x031c('0x42')]);_0x5e34d7[_0x031c('0x44')]=qs['filters'](_[_0x031c('0x43')](_0x32ec29[_0x031c('0x29')],_0xbb7d54[_0x031c('0x2a')]));if(_0x32ec29[_0x031c('0x29')][_0x031c('0x46')]){_0x5e34d7[_0x031c('0x44')]=_['merge'](_0x5e34d7[_0x031c('0x44')],{'$or':_[_0x031c('0x1f')](_0x5e34d7[_0x031c('0x2d')],function(_0x51a01f){var _0x4323b3={};_0x4323b3[_0x51a01f]={'$like':'%'+_0x32ec29[_0x031c('0x29')]['filter']+'%'};return _0x4323b3;})});}_0x5e34d7=_[_0x031c('0x30')]({},_0x5e34d7,_0x32ec29['options']);return _0x8bab5a['getTeams'](_0x5e34d7);}})[_0x031c('0x18')](function(_0x432ac6){if(_0x432ac6){_0x97b2a7=_0x432ac6[_0x031c('0x2e')];if(!_0x32ec29[_0x031c('0x29')][_0x031c('0x40')]('nolimit')){_0x5e34d7[_0x031c('0x12')]=qs[_0x031c('0x12')](_0x32ec29[_0x031c('0x29')][_0x031c('0x12')]);_0x5e34d7[_0x031c('0x10')]=qs[_0x031c('0x10')](_0x32ec29[_0x031c('0x29')]['offset']);}return _0x8bab5a[_0x031c('0x50')](_0x5e34d7);}})[_0x031c('0x18')](function(_0x1dbf74){if(_0x1dbf74){return _0x1dbf74?{'count':_0x97b2a7,'rows':_0x1dbf74}:null;}})[_0x031c('0x18')](respondWithResult(_0x2745d0,null))[_0x031c('0x33')](handleError(_0x2745d0,null));};exports[_0x031c('0x53')]=function(_0x9cda7a,_0x3f3fab){var _0x1efff3=_0x9cda7a['body'][_0x031c('0x54')];return db[_0x031c('0x52')][_0x031c('0x47')]({'where':{'id':_0x1efff3},'attributes':['id'],'include':[{'model':db[_0x031c('0x48')],'as':_0x031c('0x55'),'attributes':['id',_0x031c('0x1d'),_0x031c('0x56'),_0x031c('0x57'),'interface'],'raw':!![]}]})['then'](function(_0x5ab046){if(_0x5ab046){var _0x1ac1b8=_[_0x031c('0x58')](_0x5ab046,function(_0x1738e9){var _0x1e2938=_0x1738e9[_0x031c('0x19')]({'plain':!![]});return _0x1e2938[_0x031c('0x55')];});return db[_0x031c('0x20')][_0x031c('0x32')]({'where':{'id':_0x9cda7a['params']['id']}})[_0x031c('0x18')](function(_0x38dd11){return db[_0x031c('0x59')]['transaction'](function(_0x18edc7){return _0x38dd11['addTeams'](_0x1efff3,{'transaction':_0x18edc7})[_0x031c('0x18')](function(){return BPromise[_0x031c('0x5a')](_0x1ac1b8,function(_0x26a1f1){return db['UserOpenchannelQueue'][_0x031c('0x5b')]({'where':{'UserId':_0x26a1f1['id'],'OpenchannelQueueId':_0x9cda7a['params']['id']},'transaction':_0x18edc7});});})[_0x031c('0x18')](function(){_0x1ac1b8[_0x031c('0x5c')](function(_0x37067d){socket['emit'](_0x031c('0x5d'),{'UserId':_0x37067d['id'],'OpenchannelQueueId':_0x38dd11['id']});});});});});}})[_0x031c('0x18')](respondWithStatusCode(_0x3f3fab,null))[_0x031c('0x33')](handleError(_0x3f3fab,null));};exports[_0x031c('0x5e')]=function(_0x1be6c6,_0x51ef8f){return db[_0x031c('0x52')][_0x031c('0x47')]({'where':{'id':_0x1be6c6[_0x031c('0x29')][_0x031c('0x54')]},'attributes':['id'],'include':[{'model':db[_0x031c('0x48')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x031c('0x18')](handleEntityNotFound(_0x51ef8f,null))[_0x031c('0x18')](function(_0x436e72){var _0x56b9f2=_[_0x031c('0x1f')](_0x436e72,'id');var _0x2abad9=[];var _0x12c0d4=[];var _0x453329=squel[_0x031c('0x5f')]();_0x453329[_0x031c('0x60')](_0x031c('0x61'))['from'](_0x031c('0x62'),'tq')[_0x031c('0x63')]('user_has_teams','ut',_0x031c('0x64'))['where']('OpenchannelQueueId\x20=\x20?',_0x1be6c6[_0x031c('0x26')]['id']);for(var _0x2985a3=0x0;_0x2985a3<_0x436e72[_0x031c('0x2e')];_0x2985a3+=0x1){let _0x280739=_0x436e72[_0x2985a3];for(var _0x24f8d5=0x0;_0x24f8d5<_0x280739['Agents'][_0x031c('0x2e')];_0x24f8d5+=0x1){let _0x3fe53a=_0x280739[_0x031c('0x55')][_0x24f8d5];var _0x5a6dfb=_0x453329[_0x031c('0x65')]();_0x5a6dfb[_0x031c('0x44')]('ut.UserId\x20=\x20?',_0x3fe53a['id']);_0x12c0d4[_0x031c('0x66')](db['sequelize'][_0x031c('0x29')](_0x5a6dfb[_0x031c('0x67')](),{'type':db['sequelize'][_0x031c('0x68')][_0x031c('0x69')]})[_0x031c('0x18')](function(_0x445cae){if(_0x445cae[_0x031c('0x2e')]===0x1){return _0x3fe53a['id'];}else{var _0x3eaa25=_[_0x031c('0x6a')](_[_0x031c('0x1f')](_0x445cae,_0x031c('0x6b')),function(_0x2628ad){return _[_0x031c('0x6c')](_0x56b9f2,_0x2628ad);});if(_0x3eaa25){return _0x3fe53a['id'];}}}));}}return BPromise[_0x031c('0x6d')](_0x12c0d4)[_0x031c('0x18')](function(_0x120560){_0x2abad9=_(_0x2abad9)[_0x031c('0x6e')](_0x120560)[_0x031c('0x6f')]()['value']();return db[_0x031c('0x20')]['find']({'where':{'id':_0x1be6c6[_0x031c('0x26')]['id']}})['then'](function(_0x9795e9){return db[_0x031c('0x59')][_0x031c('0x70')](function(_0x1bed3d){return _0x9795e9['removeTeams'](_0x1be6c6[_0x031c('0x29')][_0x031c('0x54')],{'transaction':_0x1bed3d})[_0x031c('0x18')](function(){if(!_['isEmpty'](_0x2abad9)){return _0x9795e9[_0x031c('0x71')](_0x2abad9,{'transaction':_0x1bed3d});}})[_0x031c('0x18')](function(){_0x2abad9['forEach'](function(_0x59f275){socket[_0x031c('0x72')](_0x031c('0x73'),{'UserId':_0x59f275,'OpenchannelQueueId':_0x9795e9['id']});});});});});});})['then'](respondWithStatusCode(_0x51ef8f,null))['catch'](handleError(_0x51ef8f,null));};exports[_0x031c('0x74')]=function(_0x46df64,_0x329a1b){return db[_0x031c('0x20')][_0x031c('0x32')]({'where':{'id':_0x46df64[_0x031c('0x26')]['id']}})[_0x031c('0x18')](handleEntityNotFound(_0x329a1b,null))[_0x031c('0x18')](function(_0x52b550){if(_0x52b550){return _0x52b550[_0x031c('0x74')](_0x46df64[_0x031c('0x35')][_0x031c('0x54')],_[_0x031c('0x75')](_0x46df64[_0x031c('0x35')],[_0x031c('0x54'),'id'])||{})[_0x031c('0x76')](function(_0x1c1137){for(var _0x57c23b=0x0;_0x57c23b<_0x46df64[_0x031c('0x35')][_0x031c('0x54')][_0x031c('0x2e')];_0x57c23b+=0x1){socket[_0x031c('0x72')](_0x031c('0x5d'),{'UserId':Number(_0x46df64['body'][_0x031c('0x54')][_0x57c23b]),'OpenchannelQueueId':Number(_0x46df64[_0x031c('0x26')]['id'])});}return _0x1c1137;});}})[_0x031c('0x18')](respondWithResult(_0x329a1b,null))[_0x031c('0x33')](handleError(_0x329a1b,null));};exports[_0x031c('0x71')]=function(_0x322835,_0x28e705){return db[_0x031c('0x20')][_0x031c('0x32')]({'where':{'id':_0x322835['params']['id']}})[_0x031c('0x18')](handleEntityNotFound(_0x28e705,null))['then'](function(_0x14c1b1){if(_0x14c1b1){return _0x14c1b1[_0x031c('0x71')](_0x322835['query']['ids'])[_0x031c('0x18')](function(){if(_[_0x031c('0x77')](_0x322835[_0x031c('0x29')][_0x031c('0x54')])){for(var _0x450945=0x0;_0x450945<_0x322835[_0x031c('0x29')]['ids']['length'];_0x450945+=0x1){socket['emit'](_0x031c('0x73'),{'UserId':Number(_0x322835[_0x031c('0x29')][_0x031c('0x54')][_0x450945]),'OpenchannelQueueId':Number(_0x322835[_0x031c('0x26')]['id'])});}}else{socket[_0x031c('0x72')]('userOpenchannelQueue:remove',{'UserId':Number(_0x322835['query'][_0x031c('0x54')]),'OpenchannelQueueId':Number(_0x322835[_0x031c('0x26')]['id'])});}});}})[_0x031c('0x18')](respondWithStatusCode(_0x28e705,null))['catch'](handleError(_0x28e705,null));};exports[_0x031c('0x78')]=function(_0x359ca6,_0x10aaac){var _0x15c090={};var _0x47db60={};var _0x39f573;var _0x5bceb4;return db['OpenchannelQueue'][_0x031c('0x51')]({'where':{'id':_0x359ca6[_0x031c('0x26')]['id']}})['then'](handleEntityNotFound(_0x10aaac,null))['then'](function(_0x139734){if(_0x139734){_0x39f573=_0x139734;_0x47db60[_0x031c('0x2b')]=_[_0x031c('0x27')](db[_0x031c('0x48')][_0x031c('0x28')]);_0x47db60[_0x031c('0x29')]=_[_0x031c('0x27')](_0x359ca6[_0x031c('0x29')]);_0x47db60[_0x031c('0x2a')]=_['intersection'](_0x47db60['model'],_0x47db60[_0x031c('0x29')]);_0x15c090[_0x031c('0x2d')]=_[_0x031c('0x2c')](_0x47db60[_0x031c('0x2b')],qs[_0x031c('0x3f')](_0x359ca6['query'][_0x031c('0x3f')]));_0x15c090[_0x031c('0x2d')]=_0x15c090[_0x031c('0x2d')][_0x031c('0x2e')]?_0x15c090['attributes']:_0x47db60[_0x031c('0x2b')];_0x15c090[_0x031c('0x41')]=qs[_0x031c('0x42')](_0x359ca6[_0x031c('0x29')][_0x031c('0x42')]);_0x15c090[_0x031c('0x44')]=qs[_0x031c('0x2a')](_[_0x031c('0x43')](_0x359ca6[_0x031c('0x29')],_0x47db60[_0x031c('0x2a')]));if(_0x359ca6[_0x031c('0x29')][_0x031c('0x46')]){_0x15c090[_0x031c('0x44')]=_['merge'](_0x15c090[_0x031c('0x44')],{'$or':_[_0x031c('0x1f')](_0x15c090[_0x031c('0x2d')],function(_0x5dd464){var _0x318d84={};_0x318d84[_0x5dd464]={'$like':'%'+_0x359ca6[_0x031c('0x29')][_0x031c('0x46')]+'%'};return _0x318d84;})});}_0x15c090=_['merge']({},_0x15c090,_0x359ca6[_0x031c('0x31')]);return _0x39f573[_0x031c('0x78')](_0x15c090);}})['then'](function(_0x5a17c1){if(_0x5a17c1){_0x5bceb4=_0x5a17c1[_0x031c('0x2e')];if(!_0x359ca6[_0x031c('0x29')]['hasOwnProperty'](_0x031c('0x79'))){_0x15c090[_0x031c('0x12')]=qs[_0x031c('0x12')](_0x359ca6[_0x031c('0x29')][_0x031c('0x12')]);_0x15c090[_0x031c('0x10')]=qs[_0x031c('0x10')](_0x359ca6[_0x031c('0x29')]['offset']);}return _0x39f573['getAgents'](_0x15c090);}})[_0x031c('0x18')](function(_0x341999){if(_0x341999){return _0x341999?{'count':_0x5bceb4,'rows':_0x341999}:null;}})[_0x031c('0x18')](respondWithResult(_0x10aaac,null))[_0x031c('0x33')](handleError(_0x10aaac,null));}; \ No newline at end of file +var _0x2a94=['addAgents','omit','userOpenchannelQueue:save','getAgents','util','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','end','json','undefined','limit','offset','count','status','set','Content-Range','update','then','get','OpenchannelQueues','UserProfileResource','destroy','sendStatus','error','stack','name','send','map','OpenchannelQueue','rawAttributes','fieldName','getOptions','where','include','query','findAll','rows','catch','show','model','keys','filters','intersection','attributes','fields','length','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMembers','findOne','hasOwnProperty','nolimit','sort','pick','filter','merge','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','Team','order','getTeams','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','forEach','emit','removeTeams','User','team_has_openchannel_queues','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove'];(function(_0x1ded98,_0x585af3){var _0x164710=function(_0x2479c7){while(--_0x2479c7){_0x1ded98['push'](_0x1ded98['shift']());}};_0x164710(++_0x585af3);}(_0x2a94,0x1c4));var _0x42a9=function(_0x225aac,_0x38a06a){_0x225aac=_0x225aac-0x0;var _0x3b1822=_0x2a94[_0x225aac];return _0x3b1822;};'use strict';var BPromise=require('bluebird');var util=require(_0x42a9('0x0'));var _=require(_0x42a9('0x1'));var squel=require('squel');var Redis=require('ioredis');var qs=require(_0x42a9('0x2'));var logger=require(_0x42a9('0x3'))('api');var config=require(_0x42a9('0x4'));var db=require(_0x42a9('0x5'))['db'];config['redis']=_[_0x42a9('0x6')](config[_0x42a9('0x7')],{'host':_0x42a9('0x8'),'port':0x18eb});var socket=require(_0x42a9('0x9'))(new Redis(config[_0x42a9('0x7')]));require(_0x42a9('0xa'))[_0x42a9('0xb')](socket);function respondWithStatusCode(_0xb48f36,_0x541150){_0x541150=_0x541150||0xcc;return function(_0xcaac35){if(_0xcaac35){return _0xb48f36['sendStatus'](_0x541150);}return _0xb48f36['status'](_0x541150)[_0x42a9('0xc')]();};}function respondWithResult(_0x5c24bf,_0x12e8b2){_0x12e8b2=_0x12e8b2||0xc8;return function(_0x14e3bc){if(_0x14e3bc){return _0x5c24bf['status'](_0x12e8b2)[_0x42a9('0xd')](_0x14e3bc);}};}function respondWithFilteredResult(_0x34414a,_0x1c0316){return function(_0x2edee0){if(_0x2edee0){var _0x2a0055=typeof _0x1c0316['offset']===_0x42a9('0xe')&&typeof _0x1c0316[_0x42a9('0xf')]===_0x42a9('0xe');var _0x36b6ce=_0x2edee0['count'];var _0x254311=_0x2a0055?0x0:_0x1c0316[_0x42a9('0x10')];var _0x108fcd=_0x2a0055?_0x2edee0[_0x42a9('0x11')]:_0x1c0316[_0x42a9('0x10')]+_0x1c0316[_0x42a9('0xf')];var _0x5ac5d0;if(_0x108fcd>=_0x36b6ce){_0x108fcd=_0x36b6ce;_0x5ac5d0=0xc8;}else{_0x5ac5d0=0xce;}_0x34414a[_0x42a9('0x12')](_0x5ac5d0);return _0x34414a[_0x42a9('0x13')](_0x42a9('0x14'),_0x254311+'-'+_0x108fcd+'/'+_0x36b6ce)[_0x42a9('0xd')](_0x2edee0);}return null;};}function saveUpdates(_0x9337f2){return function(_0x4cdad3){if(_0x4cdad3){return _0x4cdad3[_0x42a9('0x15')](_0x9337f2)[_0x42a9('0x16')](function(_0x2cf614){return _0x2cf614;});}return null;};}function removeEntity(_0x4bfff6){return function(_0x10c993){if(_0x10c993){return _0x10c993['destroy']()[_0x42a9('0x16')](function(){var _0x13338f=_0x10c993[_0x42a9('0x17')]({'plain':!![]});var _0x2ff77d=_0x42a9('0x18');return db[_0x42a9('0x19')][_0x42a9('0x1a')]({'where':{'type':_0x2ff77d,'resourceId':_0x13338f['id']}})[_0x42a9('0x16')](function(){return _0x10c993;});})[_0x42a9('0x16')](function(){_0x4bfff6[_0x42a9('0x12')](0xcc)[_0x42a9('0xc')]();});}};}function handleEntityNotFound(_0x14faf4){return function(_0x3a67e1){if(!_0x3a67e1){_0x14faf4[_0x42a9('0x1b')](0x194);}return _0x3a67e1;};}function handleError(_0x226214,_0x4301e4){_0x4301e4=_0x4301e4||0x1f4;return function(_0x4e7f14){logger[_0x42a9('0x1c')](_0x4e7f14[_0x42a9('0x1d')]);if(_0x4e7f14[_0x42a9('0x1e')]){delete _0x4e7f14[_0x42a9('0x1e')];}_0x226214['status'](_0x4301e4)[_0x42a9('0x1f')](_0x4e7f14);};}exports['index']=function(_0x574047,_0x97300b){var _0x51af04={};var _0x28fc2a={'count':0x0,'rows':[]};var _0x1a6186=_[_0x42a9('0x20')](db[_0x42a9('0x21')][_0x42a9('0x22')],function(_0x1feb4e){return{'name':_0x1feb4e[_0x42a9('0x23')],'type':_0x1feb4e['type']['key']};});_0x51af04=qs[_0x42a9('0x24')](_0x1a6186,_0x574047);var _0x3c7eb2={'where':_0x51af04[_0x42a9('0x25')]};return db[_0x42a9('0x21')][_0x42a9('0x11')](_0x3c7eb2)[_0x42a9('0x16')](function(_0x50cf97){_0x28fc2a[_0x42a9('0x11')]=_0x50cf97;_0x51af04[_0x42a9('0x26')]=qs[_0x42a9('0x26')](_0x574047[_0x42a9('0x27')]);return db[_0x42a9('0x21')][_0x42a9('0x28')](_0x51af04);})[_0x42a9('0x16')](function(_0x3cf8f9){_0x28fc2a[_0x42a9('0x29')]=_0x3cf8f9;return _0x28fc2a;})[_0x42a9('0x16')](respondWithFilteredResult(_0x97300b,_0x51af04))[_0x42a9('0x2a')](handleError(_0x97300b,null));};exports[_0x42a9('0x2b')]=function(_0x1b9294,_0x31a988){var _0x111be6={'raw':!![],'where':{'id':_0x1b9294['params']['id']}},_0x34bede={};_0x34bede[_0x42a9('0x2c')]=_[_0x42a9('0x2d')](db[_0x42a9('0x21')][_0x42a9('0x22')]);_0x34bede[_0x42a9('0x27')]=_[_0x42a9('0x2d')](_0x1b9294[_0x42a9('0x27')]);_0x34bede[_0x42a9('0x2e')]=_[_0x42a9('0x2f')](_0x34bede['model'],_0x34bede[_0x42a9('0x27')]);_0x111be6[_0x42a9('0x30')]=_[_0x42a9('0x2f')](_0x34bede[_0x42a9('0x2c')],qs['fields'](_0x1b9294[_0x42a9('0x27')][_0x42a9('0x31')]));_0x111be6[_0x42a9('0x30')]=_0x111be6[_0x42a9('0x30')][_0x42a9('0x32')]?_0x111be6['attributes']:_0x34bede[_0x42a9('0x2c')];if(_0x1b9294[_0x42a9('0x27')][_0x42a9('0x33')]){_0x111be6[_0x42a9('0x26')]=[{'all':!![]}];}_0x111be6=_['merge']({},_0x111be6,_0x1b9294[_0x42a9('0x34')]);return db[_0x42a9('0x21')][_0x42a9('0x35')](_0x111be6)[_0x42a9('0x16')](handleEntityNotFound(_0x31a988,null))[_0x42a9('0x16')](respondWithResult(_0x31a988,null))['catch'](handleError(_0x31a988,null));};exports[_0x42a9('0x36')]=function(_0x4b3a95,_0x5d889e){return db['OpenchannelQueue'][_0x42a9('0x36')](_0x4b3a95[_0x42a9('0x37')],{})[_0x42a9('0x16')](function(_0x43accb){var _0x300f2c=_0x4b3a95[_0x42a9('0x38')][_0x42a9('0x17')]({'plain':!![]});if(!_0x300f2c)throw new Error(_0x42a9('0x39'));if(_0x300f2c[_0x42a9('0x3a')]===_0x42a9('0x38')){var _0x5b6ac1=_0x43accb[_0x42a9('0x17')]({'plain':!![]});var _0x21b240=_0x42a9('0x18');return db['UserProfileSection'][_0x42a9('0x35')]({'where':{'name':_0x21b240,'userProfileId':_0x300f2c['userProfileId']},'raw':!![]})[_0x42a9('0x16')](function(_0x47b78e){if(_0x47b78e&&_0x47b78e[_0x42a9('0x3b')]===0x0){return db[_0x42a9('0x19')]['create']({'name':_0x5b6ac1[_0x42a9('0x1e')],'resourceId':_0x5b6ac1['id'],'type':_0x47b78e[_0x42a9('0x1e')],'sectionId':_0x47b78e['id']},{})[_0x42a9('0x16')](function(){return _0x43accb;});}else{return _0x43accb;}})[_0x42a9('0x2a')](function(_0x38ecb1){logger[_0x42a9('0x1c')](_0x42a9('0x3c'),_0x38ecb1);throw _0x38ecb1;});}return _0x43accb;})[_0x42a9('0x16')](respondWithResult(_0x5d889e,0xc9))[_0x42a9('0x2a')](handleError(_0x5d889e,null));};exports[_0x42a9('0x15')]=function(_0x469e54,_0x1e88a1){if(_0x469e54['body']['id']){delete _0x469e54[_0x42a9('0x37')]['id'];}return db[_0x42a9('0x21')][_0x42a9('0x35')]({'where':{'id':_0x469e54[_0x42a9('0x3d')]['id']}})[_0x42a9('0x16')](handleEntityNotFound(_0x1e88a1,null))[_0x42a9('0x16')](saveUpdates(_0x469e54[_0x42a9('0x37')],null))[_0x42a9('0x16')](respondWithResult(_0x1e88a1,null))[_0x42a9('0x2a')](handleError(_0x1e88a1,null));};exports['destroy']=function(_0x482640,_0x24c6b7){return db['OpenchannelQueue'][_0x42a9('0x35')]({'where':{'id':_0x482640[_0x42a9('0x3d')]['id']}})['then'](handleEntityNotFound(_0x24c6b7,null))['then'](removeEntity(_0x24c6b7,null))[_0x42a9('0x2a')](handleError(_0x24c6b7,null));};exports['describe']=function(_0x51b305,_0x4eedba){return db[_0x42a9('0x21')]['describe']()['then'](respondWithResult(_0x4eedba,null))[_0x42a9('0x2a')](handleError(_0x4eedba,null));};exports[_0x42a9('0x3e')]=function(_0x5117c0,_0x365391){var _0x5a84ae={'raw':!![],'where':{}},_0x52c879={},_0x23b0fc;return db['OpenchannelQueue'][_0x42a9('0x3f')]({'where':{'id':_0x5117c0[_0x42a9('0x3d')]['id']}})[_0x42a9('0x16')](handleEntityNotFound(_0x365391,null))[_0x42a9('0x16')](function(_0x483ba8){if(_0x483ba8){_0x23b0fc=_0x483ba8[_0x42a9('0x17')]({'plain':!![]});_0x52c879[_0x42a9('0x2c')]=_['keys'](db['UserOpenchannelQueue'][_0x42a9('0x22')]);_0x52c879[_0x42a9('0x27')]=_[_0x42a9('0x2d')](_0x5117c0[_0x42a9('0x27')]);_0x52c879['filters']=_[_0x42a9('0x2f')](_0x52c879[_0x42a9('0x2c')],_0x52c879[_0x42a9('0x27')]);_0x5a84ae[_0x42a9('0x30')]=_[_0x42a9('0x2f')](_0x52c879['model'],qs['fields'](_0x5117c0[_0x42a9('0x27')][_0x42a9('0x31')]));_0x5a84ae['attributes']=_0x5a84ae[_0x42a9('0x30')][_0x42a9('0x32')]?_0x5a84ae[_0x42a9('0x30')]:_0x52c879[_0x42a9('0x2c')];if(!_0x5117c0['query'][_0x42a9('0x40')](_0x42a9('0x41'))){_0x5a84ae['limit']=qs['limit'](_0x5117c0['query']['limit']);_0x5a84ae[_0x42a9('0x10')]=qs['offset'](_0x5117c0['query'][_0x42a9('0x10')]);}_0x5a84ae['order']=qs[_0x42a9('0x42')](_0x5117c0['query'][_0x42a9('0x42')]);_0x5a84ae[_0x42a9('0x25')]=qs['filters'](_[_0x42a9('0x43')](_0x5117c0[_0x42a9('0x27')],_0x52c879[_0x42a9('0x2e')]));_0x5a84ae[_0x42a9('0x25')]['OpenchannelQueueId']=_0x483ba8['id'];if(_0x5117c0['query'][_0x42a9('0x44')]){_0x5a84ae[_0x42a9('0x25')]=_['merge'](_0x5a84ae[_0x42a9('0x25')],{'$or':_['map'](_0x5a84ae[_0x42a9('0x30')],function(_0x3f1d6e){var _0x3fa7b6={};_0x3fa7b6[_0x3f1d6e]={'$like':'%'+_0x5117c0['query'][_0x42a9('0x44')]+'%'};return _0x3fa7b6;})});}_0x5a84ae=_[_0x42a9('0x45')]({},_0x5a84ae,_0x5117c0[_0x42a9('0x34')]);return db['UserOpenchannelQueue'][_0x42a9('0x28')](_0x5a84ae);}})[_0x42a9('0x16')](function(_0xea2265){if(_0xea2265){return db['User'][_0x42a9('0x46')]({'where':{'id':_[_0x42a9('0x20')](_0xea2265,_0x42a9('0x47')),'role':_0x42a9('0x48')},'attributes':['id',_0x42a9('0x1e'),_0x42a9('0x49'),_0x42a9('0x4a'),_0x42a9('0x4b')]});}})['then'](function(_0x37eaba){if(_0x37eaba){return{'count':_0x37eaba[_0x42a9('0x11')],'rows':_[_0x42a9('0x20')](_0x37eaba[_0x42a9('0x29')],function(_0x58f2c8){return{'membername':_0x58f2c8[_0x42a9('0x1e')],'UserId':_0x58f2c8['id'],'queue_name':_0x23b0fc[_0x42a9('0x1e')],'OpenchannelQueueId':_0x23b0fc['id'],'interface':util[_0x42a9('0x4c')](_0x42a9('0x4d'),'SIP',_0x58f2c8[_0x42a9('0x1e')]),'penalty':0x0,'paused':_0x58f2c8['openchannelPause'],'createdAt':_0x58f2c8[_0x42a9('0x4b')],'updatedAt':_0x58f2c8['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x42a9('0x16')](respondWithFilteredResult(_0x365391,_0x5a84ae))[_0x42a9('0x2a')](handleError(_0x365391,null));};exports['getTeams']=function(_0x4547b2,_0x1fba31){var _0x3cce2c={};var _0x3496d0={};var _0x5e6997;var _0x4ee9c7;return db[_0x42a9('0x21')][_0x42a9('0x3f')]({'where':{'id':_0x4547b2[_0x42a9('0x3d')]['id']}})[_0x42a9('0x16')](handleEntityNotFound(_0x1fba31,null))[_0x42a9('0x16')](function(_0x4514fc){if(_0x4514fc){_0x5e6997=_0x4514fc;_0x3496d0[_0x42a9('0x2c')]=_[_0x42a9('0x2d')](db[_0x42a9('0x4e')]['rawAttributes']);_0x3496d0[_0x42a9('0x27')]=_[_0x42a9('0x2d')](_0x4547b2[_0x42a9('0x27')]);_0x3496d0[_0x42a9('0x2e')]=_[_0x42a9('0x2f')](_0x3496d0[_0x42a9('0x2c')],_0x3496d0[_0x42a9('0x27')]);_0x3cce2c[_0x42a9('0x30')]=_[_0x42a9('0x2f')](_0x3496d0['model'],qs[_0x42a9('0x31')](_0x4547b2['query'][_0x42a9('0x31')]));_0x3cce2c[_0x42a9('0x30')]=_0x3cce2c['attributes']['length']?_0x3cce2c[_0x42a9('0x30')]:_0x3496d0[_0x42a9('0x2c')];_0x3cce2c[_0x42a9('0x4f')]=qs[_0x42a9('0x42')](_0x4547b2['query']['sort']);_0x3cce2c[_0x42a9('0x25')]=qs[_0x42a9('0x2e')](_[_0x42a9('0x43')](_0x4547b2['query'],_0x3496d0['filters']));if(_0x4547b2['query']['filter']){_0x3cce2c[_0x42a9('0x25')]=_[_0x42a9('0x45')](_0x3cce2c[_0x42a9('0x25')],{'$or':_[_0x42a9('0x20')](_0x3cce2c[_0x42a9('0x30')],function(_0x4324f8){var _0x25a64b={};_0x25a64b[_0x4324f8]={'$like':'%'+_0x4547b2[_0x42a9('0x27')][_0x42a9('0x44')]+'%'};return _0x25a64b;})});}_0x3cce2c=_[_0x42a9('0x45')]({},_0x3cce2c,_0x4547b2[_0x42a9('0x34')]);return _0x5e6997['getTeams'](_0x3cce2c);}})[_0x42a9('0x16')](function(_0x306b2c){if(_0x306b2c){_0x4ee9c7=_0x306b2c[_0x42a9('0x32')];if(!_0x4547b2[_0x42a9('0x27')][_0x42a9('0x40')](_0x42a9('0x41'))){_0x3cce2c['limit']=qs[_0x42a9('0xf')](_0x4547b2[_0x42a9('0x27')][_0x42a9('0xf')]);_0x3cce2c[_0x42a9('0x10')]=qs[_0x42a9('0x10')](_0x4547b2['query'][_0x42a9('0x10')]);}return _0x5e6997[_0x42a9('0x50')](_0x3cce2c);}})[_0x42a9('0x16')](function(_0xdd4bc3){if(_0xdd4bc3){return _0xdd4bc3?{'count':_0x4ee9c7,'rows':_0xdd4bc3}:null;}})[_0x42a9('0x16')](respondWithResult(_0x1fba31,null))[_0x42a9('0x2a')](handleError(_0x1fba31,null));};exports[_0x42a9('0x51')]=function(_0x1b0a9a,_0x428cb5){var _0x29f1a6=_0x1b0a9a['body'][_0x42a9('0x52')];return db[_0x42a9('0x4e')][_0x42a9('0x28')]({'where':{'id':_0x29f1a6},'attributes':['id'],'include':[{'model':db['User'],'as':_0x42a9('0x53'),'attributes':['id',_0x42a9('0x1e'),_0x42a9('0x54'),_0x42a9('0x55'),_0x42a9('0x56')],'raw':!![]}]})[_0x42a9('0x16')](function(_0x4d67c4){if(_0x4d67c4){var _0x29a99b=_['flatMap'](_0x4d67c4,function(_0x4e7956){var _0x52fb22=_0x4e7956[_0x42a9('0x17')]({'plain':!![]});return _0x52fb22[_0x42a9('0x53')];});return db['OpenchannelQueue']['find']({'where':{'id':_0x1b0a9a[_0x42a9('0x3d')]['id']}})[_0x42a9('0x16')](function(_0xbc980f){return db[_0x42a9('0x57')][_0x42a9('0x58')](function(_0x31e09a){return _0xbc980f[_0x42a9('0x51')](_0x29f1a6,{'transaction':_0x31e09a})['then'](function(){return BPromise['each'](_0x29a99b,function(_0x1f6bb5){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x1f6bb5['id'],'OpenchannelQueueId':_0x1b0a9a[_0x42a9('0x3d')]['id']},'transaction':_0x31e09a});});})[_0x42a9('0x16')](function(){_0x29a99b[_0x42a9('0x59')](function(_0x308318){socket[_0x42a9('0x5a')]('userOpenchannelQueue:save',{'UserId':_0x308318['id'],'OpenchannelQueueId':_0xbc980f['id']});});});});});}})['then'](respondWithStatusCode(_0x428cb5,null))[_0x42a9('0x2a')](handleError(_0x428cb5,null));};exports[_0x42a9('0x5b')]=function(_0x44897e,_0x50b3e9){return db[_0x42a9('0x4e')][_0x42a9('0x28')]({'where':{'id':_0x44897e[_0x42a9('0x27')][_0x42a9('0x52')]},'attributes':['id'],'include':[{'model':db[_0x42a9('0x5c')],'as':_0x42a9('0x53'),'attributes':['id'],'raw':!![]}]})[_0x42a9('0x16')](handleEntityNotFound(_0x50b3e9,null))[_0x42a9('0x16')](function(_0x2a3fb7){var _0x322345=_[_0x42a9('0x20')](_0x2a3fb7,'id');var _0x4a5251=[];var _0x5a7c0d=[];var _0x8e3e5b=squel['select']();_0x8e3e5b['field']('tq.TeamId')['from'](_0x42a9('0x5d'),'tq')['join']('user_has_teams','ut',_0x42a9('0x5e'))[_0x42a9('0x25')](_0x42a9('0x5f'),_0x44897e[_0x42a9('0x3d')]['id']);for(var _0x5a8800=0x0;_0x5a8800<_0x2a3fb7[_0x42a9('0x32')];_0x5a8800+=0x1){let _0x400c2f=_0x2a3fb7[_0x5a8800];for(var _0xc22813=0x0;_0xc22813<_0x400c2f[_0x42a9('0x53')][_0x42a9('0x32')];_0xc22813+=0x1){let _0x1dc6cf=_0x400c2f['Agents'][_0xc22813];var _0x2a4a4c=_0x8e3e5b[_0x42a9('0x60')]();_0x2a4a4c[_0x42a9('0x25')](_0x42a9('0x61'),_0x1dc6cf['id']);_0x5a7c0d[_0x42a9('0x62')](db['sequelize'][_0x42a9('0x27')](_0x2a4a4c[_0x42a9('0x63')](),{'type':db[_0x42a9('0x57')][_0x42a9('0x64')]['SELECT']})['then'](function(_0x50ea3f){if(_0x50ea3f[_0x42a9('0x32')]===0x1){return _0x1dc6cf['id'];}else{var _0x2c7c23=_[_0x42a9('0x65')](_[_0x42a9('0x20')](_0x50ea3f,'TeamId'),function(_0x11758a){return _['includes'](_0x322345,_0x11758a);});if(_0x2c7c23){return _0x1dc6cf['id'];}}}));}}return BPromise['all'](_0x5a7c0d)[_0x42a9('0x16')](function(_0x48bd58){_0x4a5251=_(_0x4a5251)[_0x42a9('0x66')](_0x48bd58)[_0x42a9('0x67')]()[_0x42a9('0x68')]();return db[_0x42a9('0x21')][_0x42a9('0x35')]({'where':{'id':_0x44897e[_0x42a9('0x3d')]['id']}})[_0x42a9('0x16')](function(_0x486b0d){return db['sequelize'][_0x42a9('0x58')](function(_0x1c9323){return _0x486b0d[_0x42a9('0x5b')](_0x44897e['query']['ids'],{'transaction':_0x1c9323})[_0x42a9('0x16')](function(){if(!_[_0x42a9('0x69')](_0x4a5251)){return _0x486b0d[_0x42a9('0x6a')](_0x4a5251,{'transaction':_0x1c9323});}})[_0x42a9('0x16')](function(){_0x4a5251[_0x42a9('0x59')](function(_0x7b86a9){socket[_0x42a9('0x5a')](_0x42a9('0x6b'),{'UserId':_0x7b86a9,'OpenchannelQueueId':_0x486b0d['id']});});});});});});})[_0x42a9('0x16')](respondWithStatusCode(_0x50b3e9,null))['catch'](handleError(_0x50b3e9,null));};exports['addAgents']=function(_0x2aab3c,_0xefe2e3){return db['OpenchannelQueue'][_0x42a9('0x35')]({'where':{'id':_0x2aab3c['params']['id']}})['then'](handleEntityNotFound(_0xefe2e3,null))[_0x42a9('0x16')](function(_0x14b75c){if(_0x14b75c){return _0x14b75c[_0x42a9('0x6c')](_0x2aab3c[_0x42a9('0x37')][_0x42a9('0x52')],_[_0x42a9('0x6d')](_0x2aab3c[_0x42a9('0x37')],[_0x42a9('0x52'),'id'])||{})['spread'](function(_0x578489){for(var _0x221b1a=0x0;_0x221b1a<_0x2aab3c[_0x42a9('0x37')]['ids'][_0x42a9('0x32')];_0x221b1a+=0x1){socket['emit'](_0x42a9('0x6e'),{'UserId':Number(_0x2aab3c[_0x42a9('0x37')][_0x42a9('0x52')][_0x221b1a]),'OpenchannelQueueId':Number(_0x2aab3c['params']['id'])});}return _0x578489;});}})['then'](respondWithResult(_0xefe2e3,null))[_0x42a9('0x2a')](handleError(_0xefe2e3,null));};exports[_0x42a9('0x6a')]=function(_0x1582b1,_0x56087d){return db['OpenchannelQueue'][_0x42a9('0x35')]({'where':{'id':_0x1582b1['params']['id']}})[_0x42a9('0x16')](handleEntityNotFound(_0x56087d,null))[_0x42a9('0x16')](function(_0x1b4c81){if(_0x1b4c81){return _0x1b4c81['removeAgents'](_0x1582b1[_0x42a9('0x27')]['ids'])[_0x42a9('0x16')](function(){if(_['isArray'](_0x1582b1[_0x42a9('0x27')][_0x42a9('0x52')])){for(var _0x1ddb88=0x0;_0x1ddb88<_0x1582b1[_0x42a9('0x27')]['ids'][_0x42a9('0x32')];_0x1ddb88+=0x1){socket['emit'](_0x42a9('0x6b'),{'UserId':Number(_0x1582b1['query'][_0x42a9('0x52')][_0x1ddb88]),'OpenchannelQueueId':Number(_0x1582b1[_0x42a9('0x3d')]['id'])});}}else{socket[_0x42a9('0x5a')](_0x42a9('0x6b'),{'UserId':Number(_0x1582b1[_0x42a9('0x27')]['ids']),'OpenchannelQueueId':Number(_0x1582b1[_0x42a9('0x3d')]['id'])});}});}})[_0x42a9('0x16')](respondWithStatusCode(_0x56087d,null))[_0x42a9('0x2a')](handleError(_0x56087d,null));};exports[_0x42a9('0x6f')]=function(_0x2a1583,_0x12c860){var _0x598d20={};var _0x4cac8a={};var _0x1a4c39;var _0x306d47;return db[_0x42a9('0x21')][_0x42a9('0x3f')]({'where':{'id':_0x2a1583[_0x42a9('0x3d')]['id']}})[_0x42a9('0x16')](handleEntityNotFound(_0x12c860,null))['then'](function(_0x2b17b4){if(_0x2b17b4){_0x1a4c39=_0x2b17b4;_0x4cac8a['model']=_[_0x42a9('0x2d')](db[_0x42a9('0x5c')][_0x42a9('0x22')]);_0x4cac8a[_0x42a9('0x27')]=_[_0x42a9('0x2d')](_0x2a1583[_0x42a9('0x27')]);_0x4cac8a['filters']=_[_0x42a9('0x2f')](_0x4cac8a[_0x42a9('0x2c')],_0x4cac8a[_0x42a9('0x27')]);_0x598d20[_0x42a9('0x30')]=_[_0x42a9('0x2f')](_0x4cac8a[_0x42a9('0x2c')],qs[_0x42a9('0x31')](_0x2a1583[_0x42a9('0x27')][_0x42a9('0x31')]));_0x598d20['attributes']=_0x598d20[_0x42a9('0x30')]['length']?_0x598d20[_0x42a9('0x30')]:_0x4cac8a[_0x42a9('0x2c')];_0x598d20[_0x42a9('0x4f')]=qs[_0x42a9('0x42')](_0x2a1583[_0x42a9('0x27')][_0x42a9('0x42')]);_0x598d20['where']=qs[_0x42a9('0x2e')](_[_0x42a9('0x43')](_0x2a1583[_0x42a9('0x27')],_0x4cac8a[_0x42a9('0x2e')]));if(_0x2a1583['query'][_0x42a9('0x44')]){_0x598d20[_0x42a9('0x25')]=_[_0x42a9('0x45')](_0x598d20[_0x42a9('0x25')],{'$or':_['map'](_0x598d20[_0x42a9('0x30')],function(_0x590580){var _0x50985a={};_0x50985a[_0x590580]={'$like':'%'+_0x2a1583[_0x42a9('0x27')][_0x42a9('0x44')]+'%'};return _0x50985a;})});}_0x598d20=_['merge']({},_0x598d20,_0x2a1583[_0x42a9('0x34')]);return _0x1a4c39['getAgents'](_0x598d20);}})[_0x42a9('0x16')](function(_0x3dd5b3){if(_0x3dd5b3){_0x306d47=_0x3dd5b3[_0x42a9('0x32')];if(!_0x2a1583[_0x42a9('0x27')][_0x42a9('0x40')](_0x42a9('0x41'))){_0x598d20[_0x42a9('0xf')]=qs[_0x42a9('0xf')](_0x2a1583[_0x42a9('0x27')][_0x42a9('0xf')]);_0x598d20[_0x42a9('0x10')]=qs['offset'](_0x2a1583[_0x42a9('0x27')][_0x42a9('0x10')]);}return _0x1a4c39[_0x42a9('0x6f')](_0x598d20);}})['then'](function(_0x49e40b){if(_0x49e40b){return _0x49e40b?{'count':_0x306d47,'rows':_0x49e40b}:null;}})[_0x42a9('0x16')](respondWithResult(_0x12c860,null))[_0x42a9('0x2a')](handleError(_0x12c860,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index fb58bfb..085e150 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 _0x4a83=['exports','../../mysqldb','OpenchannelQueue','save','update','remove','emit','hook'];(function(_0x48854f,_0x3b877f){var _0x48255f=function(_0x5fec38){while(--_0x5fec38){_0x48854f['push'](_0x48854f['shift']());}};_0x48255f(++_0x3b877f);}(_0x4a83,0x1a1));var _0x34a8=function(_0x131bfd,_0x53a8a3){_0x131bfd=_0x131bfd-0x0;var _0x72e362=_0x4a83[_0x131bfd];return _0x72e362;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x34a8('0x0'))['db'][_0x34a8('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x34a8('0x2'),'afterUpdate':_0x34a8('0x3'),'afterDestroy':_0x34a8('0x4')};function emitEvent(_0x13220d){return function(_0x28496e,_0x445db1,_0x5ff3bd){OpenchannelQueueEvents[_0x34a8('0x5')](_0x13220d+':'+_0x28496e['id'],_0x28496e);OpenchannelQueueEvents['emit'](_0x13220d,_0x28496e);_0x5ff3bd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x34a8('0x6')](e,emitEvent(event));}}module[_0x34a8('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x81df=['OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x13b4ca,_0x20be06){var _0x17f592=function(_0x3a0bbd){while(--_0x3a0bbd){_0x13b4ca['push'](_0x13b4ca['shift']());}};_0x17f592(++_0x20be06);}(_0x81df,0x185));var _0xf81d=function(_0x28ecd0,_0x295f3d){_0x28ecd0=_0x28ecd0-0x0;var _0x585ae5=_0x81df[_0x28ecd0];return _0x585ae5;};'use strict';var EventEmitter=require(_0xf81d('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0xf81d('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xf81d('0x2')](0x0);var events={'afterCreate':_0xf81d('0x3'),'afterUpdate':_0xf81d('0x4'),'afterDestroy':_0xf81d('0x5')};function emitEvent(_0x19e21f){return function(_0x4dbeab,_0x3101d6,_0x8c949b){OpenchannelQueueEvents[_0xf81d('0x6')](_0x19e21f+':'+_0x4dbeab['id'],_0x4dbeab);OpenchannelQueueEvents[_0xf81d('0x6')](_0x19e21f,_0x4dbeab);_0x8c949b(null);};}for(var e in events){if(events[_0xf81d('0x7')](e)){var event=events[e];OpenchannelQueue[_0xf81d('0x8')](e,emitEvent(event));}}module[_0xf81d('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 c9e8d90..72c392b 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 _0x9a23=['request-promise','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','openchannel_queues','util','../../config/logger','api','bluebird'];(function(_0x5a13e7,_0x5106ca){var _0xdf0d59=function(_0xa46ae){while(--_0xa46ae){_0x5a13e7['push'](_0x5a13e7['shift']());}};_0xdf0d59(++_0x5106ca);}(_0x9a23,0x96));var _0x39a2=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9a23[_0x2064e5];return _0x21a233;};'use strict';var _=require('lodash');var util=require(_0x39a2('0x0'));var logger=require(_0x39a2('0x1'))(_0x39a2('0x2'));var moment=require('moment');var BPromise=require(_0x39a2('0x3'));var rp=require(_0x39a2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x39a2('0x5'));var config=require(_0x39a2('0x6'));var attributes=require(_0x39a2('0x7'));module[_0x39a2('0x8')]=function(_0x36632a,_0x1444a7){return _0x36632a[_0x39a2('0x9')]('OpenchannelQueue',attributes,{'tableName':_0x39a2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd047=['./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x2d23e1,_0x889f9f){var _0xd6388d=function(_0x23e594){while(--_0x23e594){_0x2d23e1['push'](_0x2d23e1['shift']());}};_0xd6388d(++_0x889f9f);}(_0xd047,0x14f));var _0x7d04=function(_0x22c00f,_0x248a69){_0x22c00f=_0x22c00f-0x0;var _0x7c801=_0xd047[_0x22c00f];return _0x7c801;};'use strict';var _=require('lodash');var util=require(_0x7d04('0x0'));var logger=require(_0x7d04('0x1'))('api');var moment=require(_0x7d04('0x2'));var BPromise=require(_0x7d04('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7d04('0x4'));var rimraf=require(_0x7d04('0x5'));var config=require('../../config/environment');var attributes=require(_0x7d04('0x6'));module[_0x7d04('0x7')]=function(_0x3499a0,_0x4be5e3){return _0x3499a0[_0x7d04('0x8')](_0x7d04('0x9'),attributes,{'tableName':_0x7d04('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 619351e..a706c79 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 _0xb65f=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis','localhost','socket.io-emitter','./openchannelQueue.socket','request','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','catch','OpenchannelQueue','findAll','options','raw','where','attributes','include','map','model','GetOpenchannelQueue','ShowOpenchannelQueue','lodash'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb65f,0x1a1));var _0xfb65=function(_0x271688,_0x3be140){_0x271688=_0x271688-0x0;var _0x37c1fa=_0xb65f[_0x271688];return _0x37c1fa;};'use strict';var _=require(_0xfb65('0x0'));var util=require(_0xfb65('0x1'));var moment=require(_0xfb65('0x2'));var BPromise=require(_0xfb65('0x3'));var rs=require(_0xfb65('0x4'));var fs=require('fs');var Redis=require(_0xfb65('0x5'));var db=require(_0xfb65('0x6'))['db'];var utils=require(_0xfb65('0x7'));var logger=require('../../config/logger')(_0xfb65('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfb65('0x9')][_0xfb65('0xa')]({'port':0x232a});config[_0xfb65('0xb')]=_['defaults'](config['redis'],{'host':_0xfb65('0xc'),'port':0x18eb});var socket=require(_0xfb65('0xd'))(new Redis(config[_0xfb65('0xb')]));require(_0xfb65('0xe'))['register'](socket);function respondWithRpcPromise(_0xb2656a,_0x4f46c1,_0x303fb9){return new BPromise(function(_0x51c393,_0x1a97a4){return client[_0xfb65('0xf')](_0xb2656a,_0x303fb9)[_0xfb65('0x10')](function(_0x1d2bdd){logger[_0xfb65('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x4f46c1,_0xfb65('0x12'));logger[_0xfb65('0x13')](_0xfb65('0x14'),_0x4f46c1,_0xfb65('0x12'),JSON[_0xfb65('0x15')](_0x1d2bdd));if(_0x1d2bdd[_0xfb65('0x16')]){if(_0x1d2bdd[_0xfb65('0x16')][_0xfb65('0x17')]===0x1f4){logger[_0xfb65('0x16')](_0xfb65('0x18'),_0x4f46c1,_0x1d2bdd['error'][_0xfb65('0x19')]);return _0x1a97a4(_0x1d2bdd[_0xfb65('0x16')][_0xfb65('0x19')]);}logger[_0xfb65('0x16')](_0xfb65('0x18'),_0x4f46c1,_0x1d2bdd['error']['message']);return _0x51c393(_0x1d2bdd[_0xfb65('0x16')][_0xfb65('0x19')]);}else{logger[_0xfb65('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x4f46c1,_0xfb65('0x12'));_0x51c393(_0x1d2bdd['result'][_0xfb65('0x19')]);}})[_0xfb65('0x1a')](function(_0x5b25ec){logger[_0xfb65('0x16')](_0xfb65('0x18'),_0x4f46c1,_0x5b25ec);_0x1a97a4(_0x5b25ec);});});}exports['GetOpenchannelQueue']=function(_0x266d1a){var _0x81e74f=this;return new Promise(function(_0x91aa00,_0x3eb941){return db[_0xfb65('0x1b')][_0xfb65('0x1c')]({'raw':_0x266d1a[_0xfb65('0x1d')]?_0x266d1a[_0xfb65('0x1d')][_0xfb65('0x1e')]===undefined?!![]:![]:!![],'where':_0x266d1a[_0xfb65('0x1d')]?_0x266d1a[_0xfb65('0x1d')][_0xfb65('0x1f')]||null:null,'attributes':_0x266d1a[_0xfb65('0x1d')]?_0x266d1a[_0xfb65('0x1d')][_0xfb65('0x20')]||null:null,'limit':_0x266d1a[_0xfb65('0x1d')]?_0x266d1a['options']['limit']||null:null,'include':_0x266d1a['options']?_0x266d1a[_0xfb65('0x1d')][_0xfb65('0x21')]?_[_0xfb65('0x22')](_0x266d1a['options']['include'],function(_0x2dd656){return{'model':db[_0x2dd656[_0xfb65('0x23')]],'as':_0x2dd656['as'],'attributes':_0x2dd656[_0xfb65('0x20')],'include':_0x2dd656[_0xfb65('0x21')]?_[_0xfb65('0x22')](_0x2dd656['include'],function(_0x14efa2){return{'model':db[_0x14efa2[_0xfb65('0x23')]],'as':_0x14efa2['as'],'attributes':_0x14efa2[_0xfb65('0x20')],'include':_0x14efa2[_0xfb65('0x21')]?_[_0xfb65('0x22')](_0x14efa2[_0xfb65('0x21')],function(_0x5a8502){return{'model':db[_0x5a8502['model']],'as':_0x5a8502['as'],'attributes':_0x5a8502['attributes']};}):[]};}):[]};}):[]:[]})[_0xfb65('0x10')](function(_0x278e03){logger[_0xfb65('0x11')](_0xfb65('0x24'),_0x266d1a);logger['debug'](_0xfb65('0x24'),_0x266d1a,JSON[_0xfb65('0x15')](_0x278e03));_0x91aa00(_0x278e03);})['catch'](function(_0x536162){logger['error']('GetOpenchannelQueue',_0x536162['message'],_0x266d1a);_0x3eb941(_0x81e74f[_0xfb65('0x16')](0x1f4,_0x536162[_0xfb65('0x19')]));});});};exports[_0xfb65('0x25')]=function(_0x439125){var _0x59bb53=this;return new Promise(function(_0x5157f6,_0x1c41fe){return db[_0xfb65('0x1b')]['find']({'raw':_0x439125['options']?_0x439125[_0xfb65('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x439125[_0xfb65('0x1d')]?_0x439125[_0xfb65('0x1d')][_0xfb65('0x1f')]||null:null,'attributes':_0x439125['options']?_0x439125[_0xfb65('0x1d')]['attributes']||null:null,'include':_0x439125['options']?_0x439125['options'][_0xfb65('0x21')]?_[_0xfb65('0x22')](_0x439125[_0xfb65('0x1d')][_0xfb65('0x21')],function(_0x9c6c15){return{'model':db[_0x9c6c15['model']],'as':_0x9c6c15['as'],'attributes':_0x9c6c15['attributes'],'include':_0x9c6c15[_0xfb65('0x21')]?_[_0xfb65('0x22')](_0x9c6c15[_0xfb65('0x21')],function(_0x3ec544){return{'model':db[_0x3ec544['model']],'as':_0x3ec544['as'],'attributes':_0x3ec544[_0xfb65('0x20')],'include':_0x3ec544[_0xfb65('0x21')]?_[_0xfb65('0x22')](_0x3ec544[_0xfb65('0x21')],function(_0x1cd4a7){return{'model':db[_0x1cd4a7[_0xfb65('0x23')]],'as':_0x1cd4a7['as'],'attributes':_0x1cd4a7[_0xfb65('0x20')]};}):[]};}):[]};}):[]:[]})[_0xfb65('0x10')](function(_0x155317){logger[_0xfb65('0x11')](_0xfb65('0x25'),_0x439125);logger[_0xfb65('0x13')]('ShowOpenchannelQueue',_0x439125,JSON['stringify'](_0x155317));_0x5157f6(_0x155317);})['catch'](function(_0x3517d5){logger[_0xfb65('0x16')](_0xfb65('0x25'),_0x3517d5[_0xfb65('0x19')],_0x439125);_0x1c41fe(_0x59bb53['error'](0x1f4,_0x3517d5[_0xfb65('0x19')]));});});}; \ No newline at end of file +var _0x4268=['localhost','socket.io-emitter','./openchannelQueue.socket','register','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetOpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','OpenchannelQueue','find','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults'];(function(_0x53c8cd,_0x3e87ed){var _0x44fa30=function(_0x31038a){while(--_0x31038a){_0x53c8cd['push'](_0x53c8cd['shift']());}};_0x44fa30(++_0x3e87ed);}(_0x4268,0xef));var _0x8426=function(_0x1f3cf5,_0x29ad10){_0x1f3cf5=_0x1f3cf5-0x0;var _0x329236=_0x4268[_0x1f3cf5];return _0x329236;};'use strict';var _=require(_0x8426('0x0'));var util=require(_0x8426('0x1'));var moment=require(_0x8426('0x2'));var BPromise=require(_0x8426('0x3'));var rs=require(_0x8426('0x4'));var fs=require('fs');var Redis=require(_0x8426('0x5'));var db=require(_0x8426('0x6'))['db'];var utils=require(_0x8426('0x7'));var logger=require(_0x8426('0x8'))('rpc');var config=require(_0x8426('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8426('0xa')]['http']({'port':0x232a});config[_0x8426('0xb')]=_[_0x8426('0xc')](config[_0x8426('0xb')],{'host':_0x8426('0xd'),'port':0x18eb});var socket=require(_0x8426('0xe'))(new Redis(config[_0x8426('0xb')]));require(_0x8426('0xf'))[_0x8426('0x10')](socket);function respondWithRpcPromise(_0x660295,_0x4afdeb,_0x5eb1d6){return new BPromise(function(_0x4cfd4a,_0x552f6a){return client['request'](_0x660295,_0x5eb1d6)[_0x8426('0x11')](function(_0x47116b){logger['info'](_0x8426('0x12'),_0x4afdeb,_0x8426('0x13'));logger[_0x8426('0x14')](_0x8426('0x15'),_0x4afdeb,_0x8426('0x13'),JSON[_0x8426('0x16')](_0x47116b));if(_0x47116b[_0x8426('0x17')]){if(_0x47116b[_0x8426('0x17')][_0x8426('0x18')]===0x1f4){logger[_0x8426('0x17')](_0x8426('0x12'),_0x4afdeb,_0x47116b[_0x8426('0x17')]['message']);return _0x552f6a(_0x47116b[_0x8426('0x17')]['message']);}logger[_0x8426('0x17')](_0x8426('0x12'),_0x4afdeb,_0x47116b[_0x8426('0x17')][_0x8426('0x19')]);return _0x4cfd4a(_0x47116b['error']['message']);}else{logger[_0x8426('0x1a')]('OpenchannelQueue,\x20%s,\x20%s',_0x4afdeb,_0x8426('0x13'));_0x4cfd4a(_0x47116b[_0x8426('0x1b')][_0x8426('0x19')]);}})[_0x8426('0x1c')](function(_0x3566f3){logger[_0x8426('0x17')](_0x8426('0x12'),_0x4afdeb,_0x3566f3);_0x552f6a(_0x3566f3);});});}exports[_0x8426('0x1d')]=function(_0x5d8abd){var _0x4bbb6e=this;return new Promise(function(_0x58dfb3,_0x2d6a1b){return db['OpenchannelQueue'][_0x8426('0x1e')]({'raw':_0x5d8abd[_0x8426('0x1f')]?_0x5d8abd[_0x8426('0x1f')][_0x8426('0x20')]===undefined?!![]:![]:!![],'where':_0x5d8abd[_0x8426('0x1f')]?_0x5d8abd[_0x8426('0x1f')][_0x8426('0x21')]||null:null,'attributes':_0x5d8abd[_0x8426('0x1f')]?_0x5d8abd[_0x8426('0x1f')][_0x8426('0x22')]||null:null,'limit':_0x5d8abd[_0x8426('0x1f')]?_0x5d8abd['options'][_0x8426('0x23')]||null:null,'include':_0x5d8abd['options']?_0x5d8abd['options'][_0x8426('0x24')]?_[_0x8426('0x25')](_0x5d8abd['options']['include'],function(_0x33e40f){return{'model':db[_0x33e40f[_0x8426('0x26')]],'as':_0x33e40f['as'],'attributes':_0x33e40f[_0x8426('0x22')],'include':_0x33e40f[_0x8426('0x24')]?_[_0x8426('0x25')](_0x33e40f['include'],function(_0x5acc39){return{'model':db[_0x5acc39[_0x8426('0x26')]],'as':_0x5acc39['as'],'attributes':_0x5acc39[_0x8426('0x22')],'include':_0x5acc39['include']?_[_0x8426('0x25')](_0x5acc39['include'],function(_0x50371c){return{'model':db[_0x50371c['model']],'as':_0x50371c['as'],'attributes':_0x50371c[_0x8426('0x22')]};}):[]};}):[]};}):[]:[]})[_0x8426('0x11')](function(_0x531649){logger[_0x8426('0x1a')](_0x8426('0x1d'),_0x5d8abd);logger['debug'](_0x8426('0x1d'),_0x5d8abd,JSON[_0x8426('0x16')](_0x531649));_0x58dfb3(_0x531649);})['catch'](function(_0xd098a3){logger[_0x8426('0x17')]('GetOpenchannelQueue',_0xd098a3[_0x8426('0x19')],_0x5d8abd);_0x2d6a1b(_0x4bbb6e['error'](0x1f4,_0xd098a3[_0x8426('0x19')]));});});};exports['ShowOpenchannelQueue']=function(_0x54bc80){var _0x230ed3=this;return new Promise(function(_0x176fda,_0x1e3077){return db[_0x8426('0x27')][_0x8426('0x28')]({'raw':_0x54bc80[_0x8426('0x1f')]?_0x54bc80[_0x8426('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x54bc80[_0x8426('0x1f')]?_0x54bc80[_0x8426('0x1f')][_0x8426('0x21')]||null:null,'attributes':_0x54bc80[_0x8426('0x1f')]?_0x54bc80[_0x8426('0x1f')][_0x8426('0x22')]||null:null,'include':_0x54bc80[_0x8426('0x1f')]?_0x54bc80['options']['include']?_[_0x8426('0x25')](_0x54bc80[_0x8426('0x1f')][_0x8426('0x24')],function(_0x10e166){return{'model':db[_0x10e166[_0x8426('0x26')]],'as':_0x10e166['as'],'attributes':_0x10e166[_0x8426('0x22')],'include':_0x10e166['include']?_['map'](_0x10e166[_0x8426('0x24')],function(_0x1ae567){return{'model':db[_0x1ae567[_0x8426('0x26')]],'as':_0x1ae567['as'],'attributes':_0x1ae567[_0x8426('0x22')],'include':_0x1ae567[_0x8426('0x24')]?_[_0x8426('0x25')](_0x1ae567[_0x8426('0x24')],function(_0xd550c6){return{'model':db[_0xd550c6['model']],'as':_0xd550c6['as'],'attributes':_0xd550c6['attributes']};}):[]};}):[]};}):[]:[]})[_0x8426('0x11')](function(_0x3b5846){logger[_0x8426('0x1a')](_0x8426('0x29'),_0x54bc80);logger['debug'](_0x8426('0x29'),_0x54bc80,JSON[_0x8426('0x16')](_0x3b5846));_0x176fda(_0x3b5846);})[_0x8426('0x1c')](function(_0x560bca){logger[_0x8426('0x17')](_0x8426('0x29'),_0x560bca[_0x8426('0x19')],_0x54bc80);_0x1e3077(_0x230ed3[_0x8426('0x17')](0x1f4,_0x560bca[_0x8426('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 68cffcb..e940912 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 _0x53d0=['remove','update','emit','removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save'];(function(_0x3f6bab,_0x47fdb0){var _0x26d34b=function(_0x1a8bfc){while(--_0x1a8bfc){_0x3f6bab['push'](_0x3f6bab['shift']());}};_0x26d34b(++_0x47fdb0);}(_0x53d0,0xbb));var _0x053d=function(_0x134536,_0x1d4b79){_0x134536=_0x134536-0x0;var _0x15208d=_0x53d0[_0x134536];return _0x15208d;};'use strict';var OpenchannelQueueEvents=require(_0x053d('0x0'));var events=[_0x053d('0x1'),_0x053d('0x2'),_0x053d('0x3')];function createListener(_0x3ceaad,_0x46eacc){return function(_0x422d5f){_0x46eacc[_0x053d('0x4')](_0x3ceaad,_0x422d5f);};}function removeListener(_0x2e311f,_0x4668de){return function(){OpenchannelQueueEvents[_0x053d('0x5')](_0x2e311f,_0x4668de);};}exports[_0x053d('0x6')]=function(_0x3e3bea){for(var _0x9720d2=0x0,_0x177692=events[_0x053d('0x7')];_0x9720d2<_0x177692;_0x9720d2++){var _0x57427f=events[_0x9720d2];var _0x42e8a4=createListener(_0x053d('0x8')+_0x57427f,_0x3e3bea);OpenchannelQueueEvents['on'](_0x57427f,_0x42e8a4);}}; \ No newline at end of file +var _0xbecc=['./openchannelQueue.events','save','remove','update','emit','register','length','openchannelQueue:'];(function(_0x19159d,_0x3d05c8){var _0x35884a=function(_0xe419f8){while(--_0xe419f8){_0x19159d['push'](_0x19159d['shift']());}};_0x35884a(++_0x3d05c8);}(_0xbecc,0x158));var _0xcbec=function(_0xe45611,_0x200666){_0xe45611=_0xe45611-0x0;var _0x3be42b=_0xbecc[_0xe45611];return _0x3be42b;};'use strict';var OpenchannelQueueEvents=require(_0xcbec('0x0'));var events=[_0xcbec('0x1'),_0xcbec('0x2'),_0xcbec('0x3')];function createListener(_0x488e43,_0x465c63){return function(_0x6c2bcd){_0x465c63[_0xcbec('0x4')](_0x488e43,_0x6c2bcd);};}function removeListener(_0x56b5d8,_0x4de063){return function(){OpenchannelQueueEvents['removeListener'](_0x56b5d8,_0x4de063);};}exports[_0xcbec('0x5')]=function(_0x4c259e){for(var _0x5b7336=0x0,_0x2062d7=events[_0xcbec('0x6')];_0x5b7336<_0x2062d7;_0x5b7336++){var _0x22ab35=events[_0x5b7336];var _0x6d82d8=createListener(_0xcbec('0x7')+_0x22ab35,_0x4c259e);OpenchannelQueueEvents['on'](_0x22ab35,_0x6d82d8);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index d8c31c5..df424fe 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 _0xec82=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','index','/describe','isAuthenticated','get','/:id','show','create','put','update','delete','destroy','multer','util'];(function(_0xa389bf,_0x453bdd){var _0x25595c=function(_0x1608c7){while(--_0x1608c7){_0xa389bf['push'](_0xa389bf['shift']());}};_0x25595c(++_0x453bdd);}(_0xec82,0x1a0));var _0x2ec8=function(_0x22f74c,_0x487f52){_0x22f74c=_0x22f74c-0x0;var _0x1d0889=_0xec82[_0x22f74c];return _0x1d0889;};'use strict';var multer=require(_0x2ec8('0x0'));var util=require(_0x2ec8('0x1'));var path=require(_0x2ec8('0x2'));var timeout=require(_0x2ec8('0x3'));var express=require(_0x2ec8('0x4'));var router=express[_0x2ec8('0x5')]();var fs_extra=require(_0x2ec8('0x6'));var auth=require(_0x2ec8('0x7'));var interaction=require(_0x2ec8('0x8'));var config=require(_0x2ec8('0x9'));var controller=require(_0x2ec8('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x2ec8('0xb')]);router['get'](_0x2ec8('0xc'),auth[_0x2ec8('0xd')](),controller['describe']);router[_0x2ec8('0xe')](_0x2ec8('0xf'),auth[_0x2ec8('0xd')](),controller[_0x2ec8('0x10')]);router['post']('/',auth[_0x2ec8('0xd')](),controller[_0x2ec8('0x11')]);router[_0x2ec8('0x12')](_0x2ec8('0xf'),auth[_0x2ec8('0xd')](),controller[_0x2ec8('0x13')]);router[_0x2ec8('0x14')](_0x2ec8('0xf'),auth[_0x2ec8('0xd')](),controller[_0x2ec8('0x15')]);module['exports']=router; \ No newline at end of file +var _0xd2b4=['create','put','/:id','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','show','post'];(function(_0x4279a7,_0x41a7ab){var _0x4b61a1=function(_0x99aa3){while(--_0x99aa3){_0x4279a7['push'](_0x4279a7['shift']());}};_0x4b61a1(++_0x41a7ab);}(_0xd2b4,0xfc));var _0x4d2b=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0xd2b4[_0x377a6e];return _0x37f751;};'use strict';var multer=require('multer');var util=require(_0x4d2b('0x0'));var path=require(_0x4d2b('0x1'));var timeout=require(_0x4d2b('0x2'));var express=require(_0x4d2b('0x3'));var router=express[_0x4d2b('0x4')]();var fs_extra=require(_0x4d2b('0x5'));var auth=require(_0x4d2b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelQueueReport.controller');router[_0x4d2b('0x7')]('/',auth[_0x4d2b('0x8')](),controller[_0x4d2b('0x9')]);router[_0x4d2b('0x7')](_0x4d2b('0xa'),auth['isAuthenticated'](),controller[_0x4d2b('0xb')]);router[_0x4d2b('0x7')]('/:id',auth[_0x4d2b('0x8')](),controller[_0x4d2b('0xc')]);router[_0x4d2b('0xd')]('/',auth[_0x4d2b('0x8')](),controller[_0x4d2b('0xe')]);router[_0x4d2b('0xf')](_0x4d2b('0x10'),auth['isAuthenticated'](),controller[_0x4d2b('0x11')]);router['delete'](_0x4d2b('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x4d2b('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 9d2ca63..3fa0eed 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 _0x383d=['STRING','DATE','exports'];(function(_0x5311a1,_0x304912){var _0x2acb9f=function(_0x4803e7){while(--_0x4803e7){_0x5311a1['push'](_0x5311a1['shift']());}};_0x2acb9f(++_0x304912);}(_0x383d,0x86));var _0xd383=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x383d[_0x20a584];return _0x4b41a8;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xd383('0x0')]={'uniqueid':{'type':Sequelize[_0xd383('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xd383('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd383('0x2')]},'acceptAt':{'type':Sequelize[_0xd383('0x2')]},'exitAt':{'type':Sequelize[_0xd383('0x2')]},'reason':{'type':Sequelize[_0xd383('0x1')]}}; \ No newline at end of file +var _0xa3ab=['sequelize','exports','STRING','DATE','moment'];(function(_0x17159d,_0x1ab3e4){var _0x51c293=function(_0xb6cced){while(--_0xb6cced){_0x17159d['push'](_0x17159d['shift']());}};_0x51c293(++_0x1ab3e4);}(_0xa3ab,0x103));var _0xba3a=function(_0xd92d38,_0x26890e){_0xd92d38=_0xd92d38-0x0;var _0x3f4559=_0xa3ab[_0xd92d38];return _0x3f4559;};'use strict';var moment=require(_0xba3a('0x0'));var Sequelize=require(_0xba3a('0x1'));module[_0xba3a('0x2')]={'uniqueid':{'type':Sequelize[_0xba3a('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xba3a('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xba3a('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xba3a('0x4')]},'reason':{'type':Sequelize[_0xba3a('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index c64bf1f..a2da3f5 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 _0x4d5d=['fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','type','VIRTUAL','includeAll','include','findAll','params','merge','options','find','catch','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','error','name','send','map','OpenchannelQueueReport','rawAttributes'];(function(_0x175254,_0x31b1b5){var _0x5ed1d3=function(_0x3d2452){while(--_0x3d2452){_0x175254['push'](_0x175254['shift']());}};_0x5ed1d3(++_0x31b1b5);}(_0x4d5d,0x6c));var _0xd4d5=function(_0x2599f0,_0x315d31){_0x2599f0=_0x2599f0-0x0;var _0x45e9af=_0x4d5d[_0x2599f0];return _0x45e9af;};'use strict';var emlformat=require(_0xd4d5('0x0'));var rimraf=require(_0xd4d5('0x1'));var zipdir=require(_0xd4d5('0x2'));var jsonpatch=require(_0xd4d5('0x3'));var rp=require(_0xd4d5('0x4'));var moment=require('moment');var BPromise=require(_0xd4d5('0x5'));var Mustache=require(_0xd4d5('0x6'));var util=require(_0xd4d5('0x7'));var path=require(_0xd4d5('0x8'));var sox=require(_0xd4d5('0x9'));var csv=require(_0xd4d5('0xa'));var ejs=require(_0xd4d5('0xb'));var fs=require('fs');var fs_extra=require(_0xd4d5('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd4d5('0xd'));var jsforce=require(_0xd4d5('0xe'));var deskjs=require(_0xd4d5('0xf'));var toCsv=require(_0xd4d5('0xa'));var querystring=require(_0xd4d5('0x10'));var Papa=require('papaparse');var Redis=require(_0xd4d5('0x11'));var authService=require(_0xd4d5('0x12'));var qs=require(_0xd4d5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd4d5('0x14'));var logger=require('../../config/logger')(_0xd4d5('0x15'));var utils=require(_0xd4d5('0x16'));var config=require(_0xd4d5('0x17'));var licenseUtil=require(_0xd4d5('0x18'));var db=require(_0xd4d5('0x19'))['db'];function respondWithStatusCode(_0x4a8207,_0x58fadf){_0x58fadf=_0x58fadf||0xcc;return function(_0xa4f0dd){if(_0xa4f0dd){return _0x4a8207['sendStatus'](_0x58fadf);}return _0x4a8207[_0xd4d5('0x1a')](_0x58fadf)[_0xd4d5('0x1b')]();};}function respondWithResult(_0x6e45eb,_0x27fb9d){_0x27fb9d=_0x27fb9d||0xc8;return function(_0x225099){if(_0x225099){return _0x6e45eb['status'](_0x27fb9d)[_0xd4d5('0x1c')](_0x225099);}};}function respondWithFilteredResult(_0x289ec7,_0x51705e){return function(_0x4902e8){if(_0x4902e8){var _0x3efd1a=typeof _0x51705e[_0xd4d5('0x1d')]===_0xd4d5('0x1e')&&typeof _0x51705e[_0xd4d5('0x1f')]===_0xd4d5('0x1e');var _0x12b313=_0x4902e8['count'];var _0x54bd45=_0x3efd1a?0x0:_0x51705e['offset'];var _0x380408=_0x3efd1a?_0x4902e8[_0xd4d5('0x20')]:_0x51705e['offset']+_0x51705e[_0xd4d5('0x1f')];var _0x24f23c;if(_0x380408>=_0x12b313){_0x380408=_0x12b313;_0x24f23c=0xc8;}else{_0x24f23c=0xce;}_0x289ec7[_0xd4d5('0x1a')](_0x24f23c);return _0x289ec7[_0xd4d5('0x21')](_0xd4d5('0x22'),_0x54bd45+'-'+_0x380408+'/'+_0x12b313)[_0xd4d5('0x1c')](_0x4902e8);}return null;};}function patchUpdates(_0x1a057e){return function(_0x35ac9e){try{jsonpatch[_0xd4d5('0x23')](_0x35ac9e,_0x1a057e,!![]);}catch(_0x5936bd){return BPromise[_0xd4d5('0x24')](_0x5936bd);}return _0x35ac9e[_0xd4d5('0x25')]();};}function saveUpdates(_0x5285ed,_0x4824d0){return function(_0x129fb4){if(_0x129fb4){return _0x129fb4['update'](_0x5285ed)[_0xd4d5('0x26')](function(_0x3a5862){return _0x3a5862;});}return null;};}function removeEntity(_0x5b7ee4,_0x3f757f){return function(_0x14e34c){if(_0x14e34c){return _0x14e34c['destroy']()[_0xd4d5('0x26')](function(){_0x5b7ee4[_0xd4d5('0x1a')](0xcc)[_0xd4d5('0x1b')]();});}};}function handleEntityNotFound(_0x4f938a,_0x30c06d){return function(_0x3228b3){if(!_0x3228b3){_0x4f938a[_0xd4d5('0x27')](0x194);}return _0x3228b3;};}function handleError(_0x49fe70,_0x88544b){_0x88544b=_0x88544b||0x1f4;return function(_0x366357){logger[_0xd4d5('0x28')](_0x366357['stack']);if(_0x366357['name']){delete _0x366357[_0xd4d5('0x29')];}_0x49fe70[_0xd4d5('0x1a')](_0x88544b)[_0xd4d5('0x2a')](_0x366357);};}exports['index']=function(_0x45b299,_0x82da1){var _0x31a682={},_0x4b7ae0={},_0x418e9c={'count':0x0,'rows':[]};var _0x92c5f8=_[_0xd4d5('0x2b')](db[_0xd4d5('0x2c')][_0xd4d5('0x2d')],function(_0x424b65){return{'name':_0x424b65[_0xd4d5('0x2e')],'type':_0x424b65['type'][_0xd4d5('0x2f')]};});_0x4b7ae0[_0xd4d5('0x30')]=_[_0xd4d5('0x2b')](_0x92c5f8,'name');_0x4b7ae0[_0xd4d5('0x31')]=_[_0xd4d5('0x32')](_0x45b299['query']);_0x4b7ae0[_0xd4d5('0x33')]=_[_0xd4d5('0x34')](_0x4b7ae0[_0xd4d5('0x30')],_0x4b7ae0[_0xd4d5('0x31')]);_0x31a682[_0xd4d5('0x35')]=_[_0xd4d5('0x34')](_0x4b7ae0['model'],qs[_0xd4d5('0x36')](_0x45b299[_0xd4d5('0x31')][_0xd4d5('0x36')]));_0x31a682['attributes']=_0x31a682[_0xd4d5('0x35')][_0xd4d5('0x37')]?_0x31a682[_0xd4d5('0x35')]:_0x4b7ae0[_0xd4d5('0x30')];if(!_0x45b299['query'][_0xd4d5('0x38')](_0xd4d5('0x39'))){_0x31a682[_0xd4d5('0x1f')]=qs[_0xd4d5('0x1f')](_0x45b299[_0xd4d5('0x31')][_0xd4d5('0x1f')]);_0x31a682[_0xd4d5('0x1d')]=qs['offset'](_0x45b299[_0xd4d5('0x31')]['offset']);}_0x31a682[_0xd4d5('0x3a')]=qs['sort'](_0x45b299[_0xd4d5('0x31')]['sort']);_0x31a682[_0xd4d5('0x3b')]=qs[_0xd4d5('0x33')](_[_0xd4d5('0x3c')](_0x45b299['query'],_0x4b7ae0[_0xd4d5('0x33')]),_0x92c5f8);if(_0x45b299['query'][_0xd4d5('0x3d')]){_0x31a682['where']=_['merge'](_0x31a682[_0xd4d5('0x3b')],{'$or':_[_0xd4d5('0x2b')](_0x92c5f8,function(_0x39a840){if(_0x39a840[_0xd4d5('0x3e')]!==_0xd4d5('0x3f')){var _0x3420df={};_0x3420df[_0x39a840[_0xd4d5('0x29')]]={'$like':'%'+_0x45b299[_0xd4d5('0x31')][_0xd4d5('0x3d')]+'%'};return _0x3420df;}})});}_0x31a682=_['merge']({},_0x31a682,_0x45b299['options']);var _0x113806={'where':_0x31a682[_0xd4d5('0x3b')]};return db['OpenchannelQueueReport'][_0xd4d5('0x20')](_0x113806)[_0xd4d5('0x26')](function(_0x2f56ca){_0x418e9c[_0xd4d5('0x20')]=_0x2f56ca;if(_0x45b299[_0xd4d5('0x31')][_0xd4d5('0x40')]){_0x31a682[_0xd4d5('0x41')]=[{'all':!![]}];}return db[_0xd4d5('0x2c')][_0xd4d5('0x42')](_0x31a682);})[_0xd4d5('0x26')](function(_0x3823eb){_0x418e9c['rows']=_0x3823eb;return _0x418e9c;})[_0xd4d5('0x26')](respondWithFilteredResult(_0x82da1,_0x31a682))['catch'](handleError(_0x82da1,null));};exports['show']=function(_0x47fd9d,_0x54aab0){var _0x4a4ed3={'raw':!![],'where':{'id':_0x47fd9d[_0xd4d5('0x43')]['id']}},_0x2edb22={};_0x2edb22[_0xd4d5('0x30')]=_[_0xd4d5('0x32')](db[_0xd4d5('0x2c')][_0xd4d5('0x2d')]);_0x2edb22[_0xd4d5('0x31')]=_[_0xd4d5('0x32')](_0x47fd9d['query']);_0x2edb22['filters']=_[_0xd4d5('0x34')](_0x2edb22[_0xd4d5('0x30')],_0x2edb22[_0xd4d5('0x31')]);_0x4a4ed3[_0xd4d5('0x35')]=_['intersection'](_0x2edb22[_0xd4d5('0x30')],qs['fields'](_0x47fd9d[_0xd4d5('0x31')][_0xd4d5('0x36')]));_0x4a4ed3[_0xd4d5('0x35')]=_0x4a4ed3[_0xd4d5('0x35')][_0xd4d5('0x37')]?_0x4a4ed3[_0xd4d5('0x35')]:_0x2edb22[_0xd4d5('0x30')];if(_0x47fd9d[_0xd4d5('0x31')]['includeAll']){_0x4a4ed3[_0xd4d5('0x41')]=[{'all':!![]}];}_0x4a4ed3=_[_0xd4d5('0x44')]({},_0x4a4ed3,_0x47fd9d[_0xd4d5('0x45')]);return db[_0xd4d5('0x2c')][_0xd4d5('0x46')](_0x4a4ed3)[_0xd4d5('0x26')](handleEntityNotFound(_0x54aab0,null))[_0xd4d5('0x26')](respondWithResult(_0x54aab0,null))[_0xd4d5('0x47')](handleError(_0x54aab0,null));};exports[_0xd4d5('0x48')]=function(_0x4db0a8,_0x2e152d){return db[_0xd4d5('0x2c')][_0xd4d5('0x48')](_0x4db0a8[_0xd4d5('0x49')],{})[_0xd4d5('0x26')](respondWithResult(_0x2e152d,0xc9))['catch'](handleError(_0x2e152d,null));};exports[_0xd4d5('0x4a')]=function(_0x141a50,_0xf829af){if(_0x141a50[_0xd4d5('0x49')]['id']){delete _0x141a50[_0xd4d5('0x49')]['id'];}return db['OpenchannelQueueReport'][_0xd4d5('0x46')]({'where':{'id':_0x141a50[_0xd4d5('0x43')]['id']}})['then'](handleEntityNotFound(_0xf829af,null))['then'](saveUpdates(_0x141a50['body'],null))[_0xd4d5('0x26')](respondWithResult(_0xf829af,null))['catch'](handleError(_0xf829af,null));};exports[_0xd4d5('0x4b')]=function(_0x1904cb,_0xdb4c09){return db[_0xd4d5('0x2c')][_0xd4d5('0x46')]({'where':{'id':_0x1904cb[_0xd4d5('0x43')]['id']}})[_0xd4d5('0x26')](handleEntityNotFound(_0xdb4c09,null))[_0xd4d5('0x26')](removeEntity(_0xdb4c09,null))[_0xd4d5('0x47')](handleError(_0xdb4c09,null));};exports[_0xd4d5('0x4c')]=function(_0xf562cc,_0x3e597d){return db[_0xd4d5('0x2c')][_0xd4d5('0x4c')]()[_0xd4d5('0x26')](respondWithResult(_0x3e597d,null))[_0xd4d5('0x47')](handleError(_0x3e597d,null));}; \ No newline at end of file +var _0xe073=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','reject','save','update','then','error','stack','name','send','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','describe','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xe073,0x17a));var _0x3e07=function(_0x4a4603,_0x1e9e15){_0x4a4603=_0x4a4603-0x0;var _0x47ed45=_0xe073[_0x4a4603];return _0x47ed45;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e07('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3e07('0x1'));var moment=require(_0x3e07('0x2'));var BPromise=require(_0x3e07('0x3'));var Mustache=require(_0x3e07('0x4'));var util=require('util');var path=require(_0x3e07('0x5'));var sox=require(_0x3e07('0x6'));var csv=require(_0x3e07('0x7'));var ejs=require(_0x3e07('0x8'));var fs=require('fs');var fs_extra=require(_0x3e07('0x9'));var _=require(_0x3e07('0xa'));var squel=require(_0x3e07('0xb'));var crypto=require(_0x3e07('0xc'));var jsforce=require(_0x3e07('0xd'));var deskjs=require(_0x3e07('0xe'));var toCsv=require(_0x3e07('0x7'));var querystring=require(_0x3e07('0xf'));var Papa=require(_0x3e07('0x10'));var Redis=require(_0x3e07('0x11'));var authService=require(_0x3e07('0x12'));var qs=require(_0x3e07('0x13'));var as=require(_0x3e07('0x14'));var hardwareService=require(_0x3e07('0x15'));var logger=require(_0x3e07('0x16'))(_0x3e07('0x17'));var utils=require(_0x3e07('0x18'));var config=require(_0x3e07('0x19'));var licenseUtil=require(_0x3e07('0x1a'));var db=require(_0x3e07('0x1b'))['db'];function respondWithStatusCode(_0x252d77,_0x270e18){_0x270e18=_0x270e18||0xcc;return function(_0x202f3a){if(_0x202f3a){return _0x252d77[_0x3e07('0x1c')](_0x270e18);}return _0x252d77['status'](_0x270e18)[_0x3e07('0x1d')]();};}function respondWithResult(_0x21ee3c,_0x4a9feb){_0x4a9feb=_0x4a9feb||0xc8;return function(_0x325193){if(_0x325193){return _0x21ee3c['status'](_0x4a9feb)[_0x3e07('0x1e')](_0x325193);}};}function respondWithFilteredResult(_0x192a0d,_0x1703bd){return function(_0x3314fc){if(_0x3314fc){var _0x5a3520=typeof _0x1703bd[_0x3e07('0x1f')]==='undefined'&&typeof _0x1703bd[_0x3e07('0x20')]===_0x3e07('0x21');var _0x204500=_0x3314fc[_0x3e07('0x22')];var _0x4810d7=_0x5a3520?0x0:_0x1703bd[_0x3e07('0x1f')];var _0x391146=_0x5a3520?_0x3314fc[_0x3e07('0x22')]:_0x1703bd[_0x3e07('0x1f')]+_0x1703bd['limit'];var _0xf92eac;if(_0x391146>=_0x204500){_0x391146=_0x204500;_0xf92eac=0xc8;}else{_0xf92eac=0xce;}_0x192a0d[_0x3e07('0x23')](_0xf92eac);return _0x192a0d[_0x3e07('0x24')](_0x3e07('0x25'),_0x4810d7+'-'+_0x391146+'/'+_0x204500)[_0x3e07('0x1e')](_0x3314fc);}return null;};}function patchUpdates(_0x40e7f1){return function(_0xd251d1){try{jsonpatch['apply'](_0xd251d1,_0x40e7f1,!![]);}catch(_0x59bb03){return BPromise[_0x3e07('0x26')](_0x59bb03);}return _0xd251d1[_0x3e07('0x27')]();};}function saveUpdates(_0x30f825,_0x3ad3c8){return function(_0x22f69d){if(_0x22f69d){return _0x22f69d[_0x3e07('0x28')](_0x30f825)[_0x3e07('0x29')](function(_0x79f41e){return _0x79f41e;});}return null;};}function removeEntity(_0x4ffcd4,_0xa29067){return function(_0x31173f){if(_0x31173f){return _0x31173f['destroy']()[_0x3e07('0x29')](function(){_0x4ffcd4[_0x3e07('0x23')](0xcc)[_0x3e07('0x1d')]();});}};}function handleEntityNotFound(_0x4a39b6,_0x2e04c5){return function(_0x3682f7){if(!_0x3682f7){_0x4a39b6[_0x3e07('0x1c')](0x194);}return _0x3682f7;};}function handleError(_0x594ad0,_0x24290f){_0x24290f=_0x24290f||0x1f4;return function(_0x4b4cdd){logger[_0x3e07('0x2a')](_0x4b4cdd[_0x3e07('0x2b')]);if(_0x4b4cdd[_0x3e07('0x2c')]){delete _0x4b4cdd[_0x3e07('0x2c')];}_0x594ad0[_0x3e07('0x23')](_0x24290f)[_0x3e07('0x2d')](_0x4b4cdd);};}exports['index']=function(_0x23096d,_0x403043){var _0x2ce22c={},_0x7a242={},_0x44e61f={'count':0x0,'rows':[]};var _0x3b1286=_[_0x3e07('0x2e')](db[_0x3e07('0x2f')][_0x3e07('0x30')],function(_0x463272){return{'name':_0x463272[_0x3e07('0x31')],'type':_0x463272[_0x3e07('0x32')][_0x3e07('0x33')]};});_0x7a242[_0x3e07('0x34')]=_[_0x3e07('0x2e')](_0x3b1286,_0x3e07('0x2c'));_0x7a242[_0x3e07('0x35')]=_['keys'](_0x23096d['query']);_0x7a242[_0x3e07('0x36')]=_['intersection'](_0x7a242[_0x3e07('0x34')],_0x7a242['query']);_0x2ce22c['attributes']=_[_0x3e07('0x37')](_0x7a242[_0x3e07('0x34')],qs[_0x3e07('0x38')](_0x23096d[_0x3e07('0x35')]['fields']));_0x2ce22c['attributes']=_0x2ce22c[_0x3e07('0x39')][_0x3e07('0x3a')]?_0x2ce22c[_0x3e07('0x39')]:_0x7a242['model'];if(!_0x23096d[_0x3e07('0x35')][_0x3e07('0x3b')]('nolimit')){_0x2ce22c[_0x3e07('0x20')]=qs[_0x3e07('0x20')](_0x23096d['query']['limit']);_0x2ce22c['offset']=qs['offset'](_0x23096d['query'][_0x3e07('0x1f')]);}_0x2ce22c[_0x3e07('0x3c')]=qs[_0x3e07('0x3d')](_0x23096d[_0x3e07('0x35')][_0x3e07('0x3d')]);_0x2ce22c[_0x3e07('0x3e')]=qs['filters'](_[_0x3e07('0x3f')](_0x23096d[_0x3e07('0x35')],_0x7a242[_0x3e07('0x36')]),_0x3b1286);if(_0x23096d[_0x3e07('0x35')]['filter']){_0x2ce22c[_0x3e07('0x3e')]=_[_0x3e07('0x40')](_0x2ce22c[_0x3e07('0x3e')],{'$or':_['map'](_0x3b1286,function(_0x5636a3){if(_0x5636a3[_0x3e07('0x32')]!==_0x3e07('0x41')){var _0x2e5c4a={};_0x2e5c4a[_0x5636a3[_0x3e07('0x2c')]]={'$like':'%'+_0x23096d[_0x3e07('0x35')]['filter']+'%'};return _0x2e5c4a;}})});}_0x2ce22c=_[_0x3e07('0x40')]({},_0x2ce22c,_0x23096d['options']);var _0xa7ce1b={'where':_0x2ce22c[_0x3e07('0x3e')]};return db[_0x3e07('0x2f')][_0x3e07('0x22')](_0xa7ce1b)[_0x3e07('0x29')](function(_0x1835c6){_0x44e61f['count']=_0x1835c6;if(_0x23096d['query'][_0x3e07('0x42')]){_0x2ce22c[_0x3e07('0x43')]=[{'all':!![]}];}return db[_0x3e07('0x2f')][_0x3e07('0x44')](_0x2ce22c);})['then'](function(_0x3a3d48){_0x44e61f[_0x3e07('0x45')]=_0x3a3d48;return _0x44e61f;})[_0x3e07('0x29')](respondWithFilteredResult(_0x403043,_0x2ce22c))[_0x3e07('0x46')](handleError(_0x403043,null));};exports[_0x3e07('0x47')]=function(_0x2f954f,_0x3b4a99){var _0x425d51={'raw':!![],'where':{'id':_0x2f954f[_0x3e07('0x48')]['id']}},_0x26da3b={};_0x26da3b[_0x3e07('0x34')]=_[_0x3e07('0x49')](db[_0x3e07('0x2f')][_0x3e07('0x30')]);_0x26da3b['query']=_[_0x3e07('0x49')](_0x2f954f[_0x3e07('0x35')]);_0x26da3b[_0x3e07('0x36')]=_[_0x3e07('0x37')](_0x26da3b[_0x3e07('0x34')],_0x26da3b['query']);_0x425d51['attributes']=_[_0x3e07('0x37')](_0x26da3b[_0x3e07('0x34')],qs[_0x3e07('0x38')](_0x2f954f[_0x3e07('0x35')][_0x3e07('0x38')]));_0x425d51[_0x3e07('0x39')]=_0x425d51[_0x3e07('0x39')]['length']?_0x425d51[_0x3e07('0x39')]:_0x26da3b[_0x3e07('0x34')];if(_0x2f954f[_0x3e07('0x35')]['includeAll']){_0x425d51[_0x3e07('0x43')]=[{'all':!![]}];}_0x425d51=_[_0x3e07('0x40')]({},_0x425d51,_0x2f954f[_0x3e07('0x4a')]);return db['OpenchannelQueueReport'][_0x3e07('0x4b')](_0x425d51)['then'](handleEntityNotFound(_0x3b4a99,null))[_0x3e07('0x29')](respondWithResult(_0x3b4a99,null))[_0x3e07('0x46')](handleError(_0x3b4a99,null));};exports[_0x3e07('0x4c')]=function(_0x34b2b2,_0x1f345c){return db['OpenchannelQueueReport'][_0x3e07('0x4c')](_0x34b2b2[_0x3e07('0x4d')],{})[_0x3e07('0x29')](respondWithResult(_0x1f345c,0xc9))[_0x3e07('0x46')](handleError(_0x1f345c,null));};exports['update']=function(_0x382f41,_0x8c7479){if(_0x382f41['body']['id']){delete _0x382f41[_0x3e07('0x4d')]['id'];}return db['OpenchannelQueueReport'][_0x3e07('0x4b')]({'where':{'id':_0x382f41['params']['id']}})[_0x3e07('0x29')](handleEntityNotFound(_0x8c7479,null))[_0x3e07('0x29')](saveUpdates(_0x382f41[_0x3e07('0x4d')],null))[_0x3e07('0x29')](respondWithResult(_0x8c7479,null))['catch'](handleError(_0x8c7479,null));};exports['destroy']=function(_0x28885a,_0x4db8b0){return db[_0x3e07('0x2f')][_0x3e07('0x4b')]({'where':{'id':_0x28885a['params']['id']}})[_0x3e07('0x29')](handleEntityNotFound(_0x4db8b0,null))[_0x3e07('0x29')](removeEntity(_0x4db8b0,null))[_0x3e07('0x46')](handleError(_0x4db8b0,null));};exports[_0x3e07('0x4e')]=function(_0x12573c,_0x955e6c){return db[_0x3e07('0x2f')][_0x3e07('0x4e')]()['then'](respondWithResult(_0x955e6c,null))['catch'](handleError(_0x955e6c,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index df33e30..b8d208e 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(_0x370ff4,_0x5f1f3b){var _0x22490c=function(_0x348597){while(--_0x348597){_0x370ff4['push'](_0x370ff4['shift']());}};_0x22490c(++_0x5f1f3b);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xc4aa[_0x21549c];return _0x426cbd;};'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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x134d87,_0xd177eb){var _0x2a2110=function(_0x21a2d7){while(--_0x21a2d7){_0x134d87['push'](_0x134d87['shift']());}};_0x2a2110(++_0xd177eb);}(_0x326f,0xd1));var _0xf326=function(_0x4e71ad,_0x555775){_0x4e71ad=_0x4e71ad-0x0;var _0x154448=_0x326f[_0x4e71ad];return _0x154448;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 5faa391..c4aa29c 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 _0x6582=['client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','OpenchannelQueueReport','create','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','update','body','where','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4e61b4,_0x1015fc){var _0x55758a=function(_0x2239b7){while(--_0x2239b7){_0x4e61b4['push'](_0x4e61b4['shift']());}};_0x55758a(++_0x1015fc);}(_0x6582,0x108));var _0x2658=function(_0xdc2b18,_0x385615){_0xdc2b18=_0xdc2b18-0x0;var _0x2b5b88=_0x6582[_0xdc2b18];return _0x2b5b88;};'use strict';var _=require(_0x2658('0x0'));var util=require(_0x2658('0x1'));var moment=require(_0x2658('0x2'));var BPromise=require(_0x2658('0x3'));var rs=require(_0x2658('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2658('0x5'))['db'];var utils=require(_0x2658('0x6'));var logger=require(_0x2658('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2658('0x8')][_0x2658('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2cb94f,_0x3f53e7,_0x443df){return new BPromise(function(_0x412a9f,_0x52ef38){return client[_0x2658('0xa')](_0x2cb94f,_0x443df)[_0x2658('0xb')](function(_0x426744){logger[_0x2658('0xc')](_0x2658('0xd'),_0x3f53e7,_0x2658('0xe'));logger[_0x2658('0xf')](_0x2658('0x10'),_0x3f53e7,_0x2658('0xe'),JSON['stringify'](_0x426744));if(_0x426744[_0x2658('0x11')]){if(_0x426744['error'][_0x2658('0x12')]===0x1f4){logger[_0x2658('0x11')](_0x2658('0xd'),_0x3f53e7,_0x426744[_0x2658('0x11')][_0x2658('0x13')]);return _0x52ef38(_0x426744[_0x2658('0x11')][_0x2658('0x13')]);}logger['error'](_0x2658('0xd'),_0x3f53e7,_0x426744[_0x2658('0x11')][_0x2658('0x13')]);return _0x412a9f(_0x426744[_0x2658('0x11')][_0x2658('0x13')]);}else{logger['info'](_0x2658('0xd'),_0x3f53e7,_0x2658('0xe'));_0x412a9f(_0x426744[_0x2658('0x14')]['message']);}})[_0x2658('0x15')](function(_0x44c6d2){logger[_0x2658('0x11')](_0x2658('0xd'),_0x3f53e7,_0x44c6d2);_0x52ef38(_0x44c6d2);});});}exports['CreateOpenchannelQueueReport']=function(_0x4eb90d){var _0x57337e=this;return new Promise(function(_0xf4193a,_0x260fc7){return db[_0x2658('0x16')][_0x2658('0x17')](_0x4eb90d['body'],{'raw':_0x4eb90d[_0x2658('0x18')]?_0x4eb90d[_0x2658('0x18')][_0x2658('0x19')]===undefined?!![]:![]:!![]})[_0x2658('0xb')](function(_0x23cf70){logger[_0x2658('0xc')]('CreateOpenchannelQueueReport',_0x4eb90d);logger[_0x2658('0xf')]('CreateOpenchannelQueueReport',_0x4eb90d,JSON['stringify'](_0x23cf70));_0xf4193a(_0x23cf70);})[_0x2658('0x15')](function(_0x132000){logger['error'](_0x2658('0x1a'),_0x132000['message'],_0x4eb90d);_0x260fc7(_0x57337e[_0x2658('0x11')](0x1f4,_0x132000[_0x2658('0x13')]));});});};exports[_0x2658('0x1b')]=function(_0x2e6d6a){var _0x31231c=this;return new Promise(function(_0x2e80fc,_0xe9f81){return db[_0x2658('0x16')][_0x2658('0x1c')](_0x2e6d6a[_0x2658('0x1d')],{'raw':_0x2e6d6a['options']?_0x2e6d6a[_0x2658('0x18')][_0x2658('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e6d6a[_0x2658('0x18')]?_0x2e6d6a[_0x2658('0x18')][_0x2658('0x1e')]||null:null,'attributes':_0x2e6d6a[_0x2658('0x18')]?_0x2e6d6a['options'][_0x2658('0x1f')]||null:null,'limit':_0x2e6d6a[_0x2658('0x18')]?_0x2e6d6a[_0x2658('0x18')][_0x2658('0x20')]||null:null})[_0x2658('0xb')](function(_0x1492cb){logger[_0x2658('0xc')](_0x2658('0x1b'),_0x2e6d6a);logger[_0x2658('0xf')](_0x2658('0x1b'),_0x2e6d6a,JSON[_0x2658('0x21')](_0x1492cb));_0x2e80fc(_0x1492cb);})[_0x2658('0x15')](function(_0x291bb4){logger[_0x2658('0x11')](_0x2658('0x1b'),_0x291bb4[_0x2658('0x13')],_0x2e6d6a);_0xe9f81(_0x31231c[_0x2658('0x11')](0x1f4,_0x291bb4[_0x2658('0x13')]));});});}; \ No newline at end of file +var _0x282b=['catch','CreateOpenchannelQueueReport','create','body','options','raw','debug','OpenchannelQueueReport','update','where','attributes','UpdateOpenchannelQueueReport','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x3198f0,_0x482730){var _0x41efd9=function(_0x5acd6b){while(--_0x5acd6b){_0x3198f0['push'](_0x3198f0['shift']());}};_0x41efd9(++_0x482730);}(_0x282b,0xec));var _0xb282=function(_0x1513f4,_0x1f7343){_0x1513f4=_0x1513f4-0x0;var _0xa0a347=_0x282b[_0x1513f4];return _0xa0a347;};'use strict';var _=require(_0xb282('0x0'));var util=require(_0xb282('0x1'));var moment=require(_0xb282('0x2'));var BPromise=require(_0xb282('0x3'));var rs=require(_0xb282('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb282('0x5'));var logger=require('../../config/logger')(_0xb282('0x6'));var config=require(_0xb282('0x7'));var jayson=require(_0xb282('0x8'));var client=jayson[_0xb282('0x9')][_0xb282('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33635f,_0x4f0410,_0x4a0d28){return new BPromise(function(_0x17fba1,_0x436eaa){return client['request'](_0x33635f,_0x4a0d28)[_0xb282('0xb')](function(_0x20f517){logger[_0xb282('0xc')](_0xb282('0xd'),_0x4f0410,'request\x20sent');logger['debug'](_0xb282('0xe'),_0x4f0410,_0xb282('0xf'),JSON[_0xb282('0x10')](_0x20f517));if(_0x20f517[_0xb282('0x11')]){if(_0x20f517[_0xb282('0x11')]['code']===0x1f4){logger['error'](_0xb282('0xd'),_0x4f0410,_0x20f517[_0xb282('0x11')][_0xb282('0x12')]);return _0x436eaa(_0x20f517[_0xb282('0x11')][_0xb282('0x12')]);}logger['error'](_0xb282('0xd'),_0x4f0410,_0x20f517['error'][_0xb282('0x12')]);return _0x17fba1(_0x20f517[_0xb282('0x11')]['message']);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x4f0410,_0xb282('0xf'));_0x17fba1(_0x20f517[_0xb282('0x13')][_0xb282('0x12')]);}})[_0xb282('0x14')](function(_0x438a05){logger['error'](_0xb282('0xd'),_0x4f0410,_0x438a05);_0x436eaa(_0x438a05);});});}exports[_0xb282('0x15')]=function(_0xca5f12){var _0x45b070=this;return new Promise(function(_0x3f8a3f,_0x492d20){return db['OpenchannelQueueReport'][_0xb282('0x16')](_0xca5f12[_0xb282('0x17')],{'raw':_0xca5f12['options']?_0xca5f12[_0xb282('0x18')][_0xb282('0x19')]===undefined?!![]:![]:!![]})[_0xb282('0xb')](function(_0x438dbe){logger[_0xb282('0xc')]('CreateOpenchannelQueueReport',_0xca5f12);logger[_0xb282('0x1a')](_0xb282('0x15'),_0xca5f12,JSON[_0xb282('0x10')](_0x438dbe));_0x3f8a3f(_0x438dbe);})['catch'](function(_0x437d66){logger[_0xb282('0x11')](_0xb282('0x15'),_0x437d66[_0xb282('0x12')],_0xca5f12);_0x492d20(_0x45b070[_0xb282('0x11')](0x1f4,_0x437d66['message']));});});};exports['UpdateOpenchannelQueueReport']=function(_0x360f15){var _0x3c7f1f=this;return new Promise(function(_0x4934f0,_0x5e828e){return db[_0xb282('0x1b')][_0xb282('0x1c')](_0x360f15[_0xb282('0x17')],{'raw':_0x360f15[_0xb282('0x18')]?_0x360f15[_0xb282('0x18')][_0xb282('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x360f15['options']?_0x360f15[_0xb282('0x18')][_0xb282('0x1d')]||null:null,'attributes':_0x360f15['options']?_0x360f15[_0xb282('0x18')][_0xb282('0x1e')]||null:null,'limit':_0x360f15[_0xb282('0x18')]?_0x360f15[_0xb282('0x18')]['limit']||null:null})[_0xb282('0xb')](function(_0x1fb89f){logger[_0xb282('0xc')](_0xb282('0x1f'),_0x360f15);logger[_0xb282('0x1a')](_0xb282('0x1f'),_0x360f15,JSON[_0xb282('0x10')](_0x1fb89f));_0x4934f0(_0x1fb89f);})['catch'](function(_0x1b15b5){logger[_0xb282('0x11')](_0xb282('0x1f'),_0x1b15b5[_0xb282('0x12')],_0x360f15);_0x5e828e(_0x3c7f1f[_0xb282('0x11')](0x1f4,_0x1b15b5['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 0a9ea89..95b9de9 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 _0x3509=['put','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x188719,_0x239a5a){var _0x2bcf5d=function(_0xfd71e7){while(--_0xfd71e7){_0x188719['push'](_0x188719['shift']());}};_0x2bcf5d(++_0x239a5a);}(_0x3509,0xf3));var _0x9350=function(_0x499e28,_0x2d0c3e){_0x499e28=_0x499e28-0x0;var _0x4b8c09=_0x3509[_0x499e28];return _0x4b8c09;};'use strict';var multer=require(_0x9350('0x0'));var util=require(_0x9350('0x1'));var path=require(_0x9350('0x2'));var timeout=require(_0x9350('0x3'));var express=require(_0x9350('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9350('0x5'));var interaction=require(_0x9350('0x6'));var config=require('../../config/environment');var controller=require(_0x9350('0x7'));router[_0x9350('0x8')]('/',auth[_0x9350('0x9')](),controller[_0x9350('0xa')]);router[_0x9350('0x8')](_0x9350('0xb'),auth[_0x9350('0x9')](),controller[_0x9350('0xc')]);router[_0x9350('0x8')](_0x9350('0xd'),auth[_0x9350('0x9')](),controller[_0x9350('0xe')]);router[_0x9350('0xf')]('/',auth['isAuthenticated'](),controller[_0x9350('0x10')]);router[_0x9350('0x11')](_0x9350('0xd'),auth[_0x9350('0x9')](),controller['update']);router['delete']('/:id',auth[_0x9350('0x9')](),controller[_0x9350('0x12')]);module[_0x9350('0x13')]=router; \ No newline at end of file +var _0xd738=['./openchannelTransferReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xd738,0x92));var _0x8d73=function(_0x18e0f7,_0x7199f7){_0x18e0f7=_0x18e0f7-0x0;var _0x1a9a36=_0xd738[_0x18e0f7];return _0x1a9a36;};'use strict';var multer=require(_0x8d73('0x0'));var util=require(_0x8d73('0x1'));var path=require(_0x8d73('0x2'));var timeout=require('connect-timeout');var express=require(_0x8d73('0x3'));var router=express[_0x8d73('0x4')]();var fs_extra=require(_0x8d73('0x5'));var auth=require(_0x8d73('0x6'));var interaction=require(_0x8d73('0x7'));var config=require('../../config/environment');var controller=require(_0x8d73('0x8'));router['get']('/',auth[_0x8d73('0x9')](),controller['index']);router[_0x8d73('0xa')](_0x8d73('0xb'),auth[_0x8d73('0x9')](),controller[_0x8d73('0xc')]);router[_0x8d73('0xa')](_0x8d73('0xd'),auth[_0x8d73('0x9')](),controller[_0x8d73('0xe')]);router[_0x8d73('0xf')]('/',auth[_0x8d73('0x9')](),controller[_0x8d73('0x10')]);router[_0x8d73('0x11')](_0x8d73('0xd'),auth[_0x8d73('0x9')](),controller[_0x8d73('0x12')]);router[_0x8d73('0x13')](_0x8d73('0xd'),auth[_0x8d73('0x9')](),controller[_0x8d73('0x14')]);module[_0x8d73('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 0cdbb89..bcabc84 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x2875b2,_0x43d894){var _0x54f37b=function(_0x37530b){while(--_0x37530b){_0x2875b2['push'](_0x2875b2['shift']());}};_0x54f37b(++_0x43d894);}(_0xf4eb,0xec));var _0xbf4e=function(_0x113ccd,_0x22a01b){_0x113ccd=_0x113ccd-0x0;var _0x1e2d8a=_0xf4eb[_0x113ccd];return _0x1e2d8a;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x160425,_0x2983aa){var _0x455b67=function(_0x1e964a){while(--_0x1e964a){_0x160425['push'](_0x160425['shift']());}};_0x455b67(++_0x2983aa);}(_0x54ef,0x112));var _0xf54e=function(_0x310676,_0x2de10){_0x310676=_0x310676-0x0;var _0x39d05=_0x54ef[_0x310676];return _0x39d05;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 27a1480..4832e89 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 _0x6260=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','destroy','then','error','name','send','index','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','OpenchannelTransferReport','rawAttributes','find','create','body','update','describe','eml-format'];(function(_0x6cf760,_0x1616c8){var _0x2c0ff0=function(_0x4b8a10){while(--_0x4b8a10){_0x6cf760['push'](_0x6cf760['shift']());}};_0x2c0ff0(++_0x1616c8);}(_0x6260,0xe6));var _0x0626=function(_0x7ad6cb,_0xffee6c){_0x7ad6cb=_0x7ad6cb-0x0;var _0x22a0ba=_0x6260[_0x7ad6cb];return _0x22a0ba;};'use strict';var emlformat=require(_0x0626('0x0'));var rimraf=require(_0x0626('0x1'));var zipdir=require(_0x0626('0x2'));var jsonpatch=require(_0x0626('0x3'));var rp=require(_0x0626('0x4'));var moment=require(_0x0626('0x5'));var BPromise=require(_0x0626('0x6'));var Mustache=require('mustache');var util=require(_0x0626('0x7'));var path=require(_0x0626('0x8'));var sox=require(_0x0626('0x9'));var csv=require(_0x0626('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0626('0xb'));var squel=require(_0x0626('0xc'));var crypto=require(_0x0626('0xd'));var jsforce=require(_0x0626('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0626('0xa'));var querystring=require(_0x0626('0xf'));var Papa=require(_0x0626('0x10'));var Redis=require(_0x0626('0x11'));var authService=require(_0x0626('0x12'));var qs=require(_0x0626('0x13'));var as=require(_0x0626('0x14'));var hardwareService=require(_0x0626('0x15'));var logger=require(_0x0626('0x16'))('api');var utils=require(_0x0626('0x17'));var config=require(_0x0626('0x18'));var licenseUtil=require(_0x0626('0x19'));var db=require(_0x0626('0x1a'))['db'];function respondWithStatusCode(_0x1144a3,_0x1c273b){_0x1c273b=_0x1c273b||0xcc;return function(_0x4b86b7){if(_0x4b86b7){return _0x1144a3[_0x0626('0x1b')](_0x1c273b);}return _0x1144a3[_0x0626('0x1c')](_0x1c273b)[_0x0626('0x1d')]();};}function respondWithResult(_0x489af4,_0x3eb2d4){_0x3eb2d4=_0x3eb2d4||0xc8;return function(_0x520697){if(_0x520697){return _0x489af4[_0x0626('0x1c')](_0x3eb2d4)['json'](_0x520697);}};}function respondWithFilteredResult(_0x79f072,_0x2b9fac){return function(_0x41447e){if(_0x41447e){var _0x13d687=typeof _0x2b9fac['offset']===_0x0626('0x1e')&&typeof _0x2b9fac[_0x0626('0x1f')]==='undefined';var _0x2f8934=_0x41447e[_0x0626('0x20')];var _0x198a71=_0x13d687?0x0:_0x2b9fac[_0x0626('0x21')];var _0x3d265c=_0x13d687?_0x41447e['count']:_0x2b9fac[_0x0626('0x21')]+_0x2b9fac[_0x0626('0x1f')];var _0x475d34;if(_0x3d265c>=_0x2f8934){_0x3d265c=_0x2f8934;_0x475d34=0xc8;}else{_0x475d34=0xce;}_0x79f072[_0x0626('0x1c')](_0x475d34);return _0x79f072['set'](_0x0626('0x22'),_0x198a71+'-'+_0x3d265c+'/'+_0x2f8934)[_0x0626('0x23')](_0x41447e);}return null;};}function patchUpdates(_0x2e5db1){return function(_0x984259){try{jsonpatch[_0x0626('0x24')](_0x984259,_0x2e5db1,!![]);}catch(_0x32c2b9){return BPromise[_0x0626('0x25')](_0x32c2b9);}return _0x984259[_0x0626('0x26')]();};}function saveUpdates(_0x58aa60,_0x1ad587){return function(_0x1b72c7){if(_0x1b72c7){return _0x1b72c7['update'](_0x58aa60)['then'](function(_0x4c3d90){return _0x4c3d90;});}return null;};}function removeEntity(_0x2f43b4,_0x51f27c){return function(_0x1c104a){if(_0x1c104a){return _0x1c104a[_0x0626('0x27')]()[_0x0626('0x28')](function(){_0x2f43b4[_0x0626('0x1c')](0xcc)[_0x0626('0x1d')]();});}};}function handleEntityNotFound(_0x134800,_0x3b340d){return function(_0x1dfba0){if(!_0x1dfba0){_0x134800['sendStatus'](0x194);}return _0x1dfba0;};}function handleError(_0xe7a64b,_0x46b23c){_0x46b23c=_0x46b23c||0x1f4;return function(_0x230f49){logger[_0x0626('0x29')](_0x230f49['stack']);if(_0x230f49['name']){delete _0x230f49[_0x0626('0x2a')];}_0xe7a64b[_0x0626('0x1c')](_0x46b23c)[_0x0626('0x2b')](_0x230f49);};}exports[_0x0626('0x2c')]=function(_0x4fc238,_0x3f37cf){var _0x4f6503={},_0x5784f8={},_0x2ca8f5={'count':0x0,'rows':[]};var _0x39258d=_['map'](db['OpenchannelTransferReport']['rawAttributes'],function(_0x4577bf){return{'name':_0x4577bf[_0x0626('0x2d')],'type':_0x4577bf[_0x0626('0x2e')][_0x0626('0x2f')]};});_0x5784f8['model']=_['map'](_0x39258d,_0x0626('0x2a'));_0x5784f8[_0x0626('0x30')]=_[_0x0626('0x31')](_0x4fc238[_0x0626('0x30')]);_0x5784f8[_0x0626('0x32')]=_[_0x0626('0x33')](_0x5784f8['model'],_0x5784f8[_0x0626('0x30')]);_0x4f6503['attributes']=_['intersection'](_0x5784f8[_0x0626('0x34')],qs[_0x0626('0x35')](_0x4fc238[_0x0626('0x30')]['fields']));_0x4f6503[_0x0626('0x36')]=_0x4f6503[_0x0626('0x36')][_0x0626('0x37')]?_0x4f6503['attributes']:_0x5784f8[_0x0626('0x34')];if(!_0x4fc238[_0x0626('0x30')][_0x0626('0x38')]('nolimit')){_0x4f6503[_0x0626('0x1f')]=qs[_0x0626('0x1f')](_0x4fc238['query']['limit']);_0x4f6503[_0x0626('0x21')]=qs['offset'](_0x4fc238[_0x0626('0x30')][_0x0626('0x21')]);}_0x4f6503[_0x0626('0x39')]=qs['sort'](_0x4fc238[_0x0626('0x30')][_0x0626('0x3a')]);_0x4f6503[_0x0626('0x3b')]=qs[_0x0626('0x32')](_['pick'](_0x4fc238['query'],_0x5784f8['filters']),_0x39258d);if(_0x4fc238['query'][_0x0626('0x3c')]){_0x4f6503['where']=_[_0x0626('0x3d')](_0x4f6503['where'],{'$or':_['map'](_0x39258d,function(_0x300255){if(_0x300255['type']!==_0x0626('0x3e')){var _0x2e045e={};_0x2e045e[_0x300255[_0x0626('0x2a')]]={'$like':'%'+_0x4fc238[_0x0626('0x30')]['filter']+'%'};return _0x2e045e;}})});}_0x4f6503=_[_0x0626('0x3d')]({},_0x4f6503,_0x4fc238[_0x0626('0x3f')]);var _0x5be53f={'where':_0x4f6503[_0x0626('0x3b')]};return db['OpenchannelTransferReport'][_0x0626('0x20')](_0x5be53f)['then'](function(_0x19e0f7){_0x2ca8f5[_0x0626('0x20')]=_0x19e0f7;if(_0x4fc238[_0x0626('0x30')][_0x0626('0x40')]){_0x4f6503[_0x0626('0x41')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x0626('0x42')](_0x4f6503);})[_0x0626('0x28')](function(_0x262c1f){_0x2ca8f5[_0x0626('0x43')]=_0x262c1f;return _0x2ca8f5;})[_0x0626('0x28')](respondWithFilteredResult(_0x3f37cf,_0x4f6503))[_0x0626('0x44')](handleError(_0x3f37cf,null));};exports['show']=function(_0x431915,_0x3464e2){var _0x5b7f52={'raw':!![],'where':{'id':_0x431915[_0x0626('0x45')]['id']}},_0x54a1dd={};_0x54a1dd[_0x0626('0x34')]=_['keys'](db[_0x0626('0x46')][_0x0626('0x47')]);_0x54a1dd[_0x0626('0x30')]=_[_0x0626('0x31')](_0x431915[_0x0626('0x30')]);_0x54a1dd[_0x0626('0x32')]=_[_0x0626('0x33')](_0x54a1dd[_0x0626('0x34')],_0x54a1dd['query']);_0x5b7f52[_0x0626('0x36')]=_[_0x0626('0x33')](_0x54a1dd[_0x0626('0x34')],qs['fields'](_0x431915[_0x0626('0x30')][_0x0626('0x35')]));_0x5b7f52['attributes']=_0x5b7f52[_0x0626('0x36')]['length']?_0x5b7f52['attributes']:_0x54a1dd[_0x0626('0x34')];if(_0x431915[_0x0626('0x30')][_0x0626('0x40')]){_0x5b7f52['include']=[{'all':!![]}];}_0x5b7f52=_[_0x0626('0x3d')]({},_0x5b7f52,_0x431915[_0x0626('0x3f')]);return db[_0x0626('0x46')][_0x0626('0x48')](_0x5b7f52)['then'](handleEntityNotFound(_0x3464e2,null))['then'](respondWithResult(_0x3464e2,null))['catch'](handleError(_0x3464e2,null));};exports['create']=function(_0x2b5957,_0x4740bd){return db[_0x0626('0x46')][_0x0626('0x49')](_0x2b5957[_0x0626('0x4a')],{})[_0x0626('0x28')](respondWithResult(_0x4740bd,0xc9))[_0x0626('0x44')](handleError(_0x4740bd,null));};exports[_0x0626('0x4b')]=function(_0x489bf7,_0x2bd0f1){if(_0x489bf7[_0x0626('0x4a')]['id']){delete _0x489bf7[_0x0626('0x4a')]['id'];}return db[_0x0626('0x46')][_0x0626('0x48')]({'where':{'id':_0x489bf7['params']['id']}})[_0x0626('0x28')](handleEntityNotFound(_0x2bd0f1,null))['then'](saveUpdates(_0x489bf7['body'],null))['then'](respondWithResult(_0x2bd0f1,null))[_0x0626('0x44')](handleError(_0x2bd0f1,null));};exports[_0x0626('0x27')]=function(_0x4d241f,_0x4efe22){return db[_0x0626('0x46')][_0x0626('0x48')]({'where':{'id':_0x4d241f['params']['id']}})[_0x0626('0x28')](handleEntityNotFound(_0x4efe22,null))['then'](removeEntity(_0x4efe22,null))[_0x0626('0x44')](handleError(_0x4efe22,null));};exports[_0x0626('0x4c')]=function(_0x274c65,_0x2afd2e){return db['OpenchannelTransferReport']['describe']()[_0x0626('0x28')](respondWithResult(_0x2afd2e,null))[_0x0626('0x44')](handleError(_0x2afd2e,null));}; \ No newline at end of file +var _0x8d5e=['stack','name','index','OpenchannelTransferReport','rawAttributes','key','map','query','keys','intersection','attributes','model','length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','fields','options','find','create','body','describe','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','status','set','apply','save','update','then','destroy','sendStatus','error'];(function(_0x5483f3,_0x12e654){var _0x1ff4d2=function(_0x223a7){while(--_0x223a7){_0x5483f3['push'](_0x5483f3['shift']());}};_0x1ff4d2(++_0x12e654);}(_0x8d5e,0x19a));var _0xe8d5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8d5e[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe8d5('0x0'));var zipdir=require(_0xe8d5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe8d5('0x2'));var BPromise=require(_0xe8d5('0x3'));var Mustache=require(_0xe8d5('0x4'));var util=require(_0xe8d5('0x5'));var path=require('path');var sox=require(_0xe8d5('0x6'));var csv=require(_0xe8d5('0x7'));var ejs=require(_0xe8d5('0x8'));var fs=require('fs');var fs_extra=require(_0xe8d5('0x9'));var _=require(_0xe8d5('0xa'));var squel=require(_0xe8d5('0xb'));var crypto=require(_0xe8d5('0xc'));var jsforce=require(_0xe8d5('0xd'));var deskjs=require(_0xe8d5('0xe'));var toCsv=require(_0xe8d5('0x7'));var querystring=require('querystring');var Papa=require(_0xe8d5('0xf'));var Redis=require(_0xe8d5('0x10'));var authService=require(_0xe8d5('0x11'));var qs=require(_0xe8d5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe8d5('0x13'));var logger=require('../../config/logger')(_0xe8d5('0x14'));var utils=require(_0xe8d5('0x15'));var config=require(_0xe8d5('0x16'));var licenseUtil=require(_0xe8d5('0x17'));var db=require(_0xe8d5('0x18'))['db'];function respondWithStatusCode(_0x129161,_0x4d74c7){_0x4d74c7=_0x4d74c7||0xcc;return function(_0x4618fb){if(_0x4618fb){return _0x129161['sendStatus'](_0x4d74c7);}return _0x129161['status'](_0x4d74c7)[_0xe8d5('0x19')]();};}function respondWithResult(_0x5d71e7,_0x2a0b8d){_0x2a0b8d=_0x2a0b8d||0xc8;return function(_0x1f5eed){if(_0x1f5eed){return _0x5d71e7['status'](_0x2a0b8d)[_0xe8d5('0x1a')](_0x1f5eed);}};}function respondWithFilteredResult(_0x1d5a51,_0x4c043f){return function(_0x49e74c){if(_0x49e74c){var _0x3d2086=typeof _0x4c043f[_0xe8d5('0x1b')]===_0xe8d5('0x1c')&&typeof _0x4c043f[_0xe8d5('0x1d')]===_0xe8d5('0x1c');var _0x3a78fa=_0x49e74c[_0xe8d5('0x1e')];var _0x2b3596=_0x3d2086?0x0:_0x4c043f[_0xe8d5('0x1b')];var _0x3d138f=_0x3d2086?_0x49e74c['count']:_0x4c043f[_0xe8d5('0x1b')]+_0x4c043f[_0xe8d5('0x1d')];var _0x1903d6;if(_0x3d138f>=_0x3a78fa){_0x3d138f=_0x3a78fa;_0x1903d6=0xc8;}else{_0x1903d6=0xce;}_0x1d5a51[_0xe8d5('0x1f')](_0x1903d6);return _0x1d5a51[_0xe8d5('0x20')]('Content-Range',_0x2b3596+'-'+_0x3d138f+'/'+_0x3a78fa)[_0xe8d5('0x1a')](_0x49e74c);}return null;};}function patchUpdates(_0x72abbf){return function(_0x3d8ea2){try{jsonpatch[_0xe8d5('0x21')](_0x3d8ea2,_0x72abbf,!![]);}catch(_0xac760a){return BPromise['reject'](_0xac760a);}return _0x3d8ea2[_0xe8d5('0x22')]();};}function saveUpdates(_0x4d9859,_0x20142c){return function(_0xaf70ba){if(_0xaf70ba){return _0xaf70ba[_0xe8d5('0x23')](_0x4d9859)[_0xe8d5('0x24')](function(_0x339c13){return _0x339c13;});}return null;};}function removeEntity(_0x606ff3,_0x107a25){return function(_0x2035e4){if(_0x2035e4){return _0x2035e4[_0xe8d5('0x25')]()['then'](function(){_0x606ff3[_0xe8d5('0x1f')](0xcc)[_0xe8d5('0x19')]();});}};}function handleEntityNotFound(_0x1c729b,_0x427183){return function(_0x419873){if(!_0x419873){_0x1c729b[_0xe8d5('0x26')](0x194);}return _0x419873;};}function handleError(_0x5c11ee,_0x179931){_0x179931=_0x179931||0x1f4;return function(_0x35293c){logger[_0xe8d5('0x27')](_0x35293c[_0xe8d5('0x28')]);if(_0x35293c[_0xe8d5('0x29')]){delete _0x35293c[_0xe8d5('0x29')];}_0x5c11ee[_0xe8d5('0x1f')](_0x179931)['send'](_0x35293c);};}exports[_0xe8d5('0x2a')]=function(_0x4da53d,_0x5aa93c){var _0x3b23ae={},_0x4c7ca1={},_0x4e8909={'count':0x0,'rows':[]};var _0xde93b4=_['map'](db[_0xe8d5('0x2b')][_0xe8d5('0x2c')],function(_0x4127b0){return{'name':_0x4127b0['fieldName'],'type':_0x4127b0['type'][_0xe8d5('0x2d')]};});_0x4c7ca1['model']=_[_0xe8d5('0x2e')](_0xde93b4,_0xe8d5('0x29'));_0x4c7ca1[_0xe8d5('0x2f')]=_[_0xe8d5('0x30')](_0x4da53d[_0xe8d5('0x2f')]);_0x4c7ca1['filters']=_[_0xe8d5('0x31')](_0x4c7ca1['model'],_0x4c7ca1['query']);_0x3b23ae[_0xe8d5('0x32')]=_[_0xe8d5('0x31')](_0x4c7ca1[_0xe8d5('0x33')],qs['fields'](_0x4da53d[_0xe8d5('0x2f')]['fields']));_0x3b23ae[_0xe8d5('0x32')]=_0x3b23ae[_0xe8d5('0x32')][_0xe8d5('0x34')]?_0x3b23ae['attributes']:_0x4c7ca1[_0xe8d5('0x33')];if(!_0x4da53d['query']['hasOwnProperty'](_0xe8d5('0x35'))){_0x3b23ae[_0xe8d5('0x1d')]=qs[_0xe8d5('0x1d')](_0x4da53d['query'][_0xe8d5('0x1d')]);_0x3b23ae[_0xe8d5('0x1b')]=qs['offset'](_0x4da53d[_0xe8d5('0x2f')][_0xe8d5('0x1b')]);}_0x3b23ae[_0xe8d5('0x36')]=qs[_0xe8d5('0x37')](_0x4da53d[_0xe8d5('0x2f')][_0xe8d5('0x37')]);_0x3b23ae['where']=qs[_0xe8d5('0x38')](_[_0xe8d5('0x39')](_0x4da53d[_0xe8d5('0x2f')],_0x4c7ca1['filters']),_0xde93b4);if(_0x4da53d[_0xe8d5('0x2f')][_0xe8d5('0x3a')]){_0x3b23ae[_0xe8d5('0x3b')]=_[_0xe8d5('0x3c')](_0x3b23ae[_0xe8d5('0x3b')],{'$or':_[_0xe8d5('0x2e')](_0xde93b4,function(_0x40d9d7){if(_0x40d9d7['type']!==_0xe8d5('0x3d')){var _0x24a77b={};_0x24a77b[_0x40d9d7[_0xe8d5('0x29')]]={'$like':'%'+_0x4da53d[_0xe8d5('0x2f')]['filter']+'%'};return _0x24a77b;}})});}_0x3b23ae=_[_0xe8d5('0x3c')]({},_0x3b23ae,_0x4da53d['options']);var _0x34772e={'where':_0x3b23ae[_0xe8d5('0x3b')]};return db[_0xe8d5('0x2b')][_0xe8d5('0x1e')](_0x34772e)[_0xe8d5('0x24')](function(_0x314419){_0x4e8909[_0xe8d5('0x1e')]=_0x314419;if(_0x4da53d[_0xe8d5('0x2f')][_0xe8d5('0x3e')]){_0x3b23ae[_0xe8d5('0x3f')]=[{'all':!![]}];}return db[_0xe8d5('0x2b')][_0xe8d5('0x40')](_0x3b23ae);})[_0xe8d5('0x24')](function(_0x5a2335){_0x4e8909[_0xe8d5('0x41')]=_0x5a2335;return _0x4e8909;})[_0xe8d5('0x24')](respondWithFilteredResult(_0x5aa93c,_0x3b23ae))[_0xe8d5('0x42')](handleError(_0x5aa93c,null));};exports[_0xe8d5('0x43')]=function(_0x145dcb,_0xdf301a){var _0x52422b={'raw':!![],'where':{'id':_0x145dcb[_0xe8d5('0x44')]['id']}},_0x4cda4f={};_0x4cda4f[_0xe8d5('0x33')]=_[_0xe8d5('0x30')](db['OpenchannelTransferReport']['rawAttributes']);_0x4cda4f[_0xe8d5('0x2f')]=_[_0xe8d5('0x30')](_0x145dcb['query']);_0x4cda4f[_0xe8d5('0x38')]=_[_0xe8d5('0x31')](_0x4cda4f[_0xe8d5('0x33')],_0x4cda4f[_0xe8d5('0x2f')]);_0x52422b[_0xe8d5('0x32')]=_[_0xe8d5('0x31')](_0x4cda4f[_0xe8d5('0x33')],qs[_0xe8d5('0x45')](_0x145dcb[_0xe8d5('0x2f')]['fields']));_0x52422b[_0xe8d5('0x32')]=_0x52422b[_0xe8d5('0x32')]['length']?_0x52422b[_0xe8d5('0x32')]:_0x4cda4f[_0xe8d5('0x33')];if(_0x145dcb['query'][_0xe8d5('0x3e')]){_0x52422b[_0xe8d5('0x3f')]=[{'all':!![]}];}_0x52422b=_['merge']({},_0x52422b,_0x145dcb[_0xe8d5('0x46')]);return db[_0xe8d5('0x2b')][_0xe8d5('0x47')](_0x52422b)['then'](handleEntityNotFound(_0xdf301a,null))[_0xe8d5('0x24')](respondWithResult(_0xdf301a,null))[_0xe8d5('0x42')](handleError(_0xdf301a,null));};exports['create']=function(_0x21edde,_0x5dc9a4){return db[_0xe8d5('0x2b')][_0xe8d5('0x48')](_0x21edde[_0xe8d5('0x49')],{})[_0xe8d5('0x24')](respondWithResult(_0x5dc9a4,0xc9))['catch'](handleError(_0x5dc9a4,null));};exports[_0xe8d5('0x23')]=function(_0x13aefd,_0x38580a){if(_0x13aefd[_0xe8d5('0x49')]['id']){delete _0x13aefd[_0xe8d5('0x49')]['id'];}return db['OpenchannelTransferReport'][_0xe8d5('0x47')]({'where':{'id':_0x13aefd[_0xe8d5('0x44')]['id']}})['then'](handleEntityNotFound(_0x38580a,null))[_0xe8d5('0x24')](saveUpdates(_0x13aefd[_0xe8d5('0x49')],null))['then'](respondWithResult(_0x38580a,null))[_0xe8d5('0x42')](handleError(_0x38580a,null));};exports['destroy']=function(_0x2e42de,_0x486484){return db[_0xe8d5('0x2b')]['find']({'where':{'id':_0x2e42de[_0xe8d5('0x44')]['id']}})[_0xe8d5('0x24')](handleEntityNotFound(_0x486484,null))[_0xe8d5('0x24')](removeEntity(_0x486484,null))['catch'](handleError(_0x486484,null));};exports['describe']=function(_0x367eb8,_0x40aa74){return db[_0xe8d5('0x2b')][_0xe8d5('0x4a')]()[_0xe8d5('0x24')](respondWithResult(_0x40aa74,null))[_0xe8d5('0x42')](handleError(_0x40aa74,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 61a2a2c..54fa85b 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 _0xa978=['api','moment','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x3c1cbb,_0x383df3){var _0x6be838=function(_0x23f573){while(--_0x23f573){_0x3c1cbb['push'](_0x3c1cbb['shift']());}};_0x6be838(++_0x383df3);}(_0xa978,0xc9));var _0x8a97=function(_0x1bd7a7,_0x573794){_0x1bd7a7=_0x1bd7a7-0x0;var _0x30141c=_0xa978[_0x1bd7a7];return _0x30141c;};'use strict';var _=require(_0x8a97('0x0'));var util=require(_0x8a97('0x1'));var logger=require(_0x8a97('0x2'))(_0x8a97('0x3'));var moment=require(_0x8a97('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8a97('0x5'));var attributes=require(_0x8a97('0x6'));module[_0x8a97('0x7')]=function(_0x550304,_0x5aeca9){return _0x550304[_0x8a97('0x8')](_0x8a97('0x9'),attributes,{'tableName':_0x8a97('0xa'),'paranoid':![],'indexes':[{'name':_0x8a97('0xb'),'fields':[_0x8a97('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5156=['api','moment','bluebird','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5156,0x177));var _0x6515=function(_0x190e94,_0x117fc1){_0x190e94=_0x190e94-0x0;var _0x3012a0=_0x5156[_0x190e94];return _0x3012a0;};'use strict';var _=require(_0x6515('0x0'));var util=require(_0x6515('0x1'));var logger=require(_0x6515('0x2'))(_0x6515('0x3'));var moment=require(_0x6515('0x4'));var BPromise=require(_0x6515('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6515('0x6'));var config=require(_0x6515('0x7'));var attributes=require(_0x6515('0x8'));module[_0x6515('0x9')]=function(_0x10b3c8,_0x37923b){return _0x10b3c8[_0x6515('0xa')](_0x6515('0xb'),attributes,{'tableName':_0x6515('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x6515('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 9edd59e..c34a5ba 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 _0xcb81=['lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch'];(function(_0x55d56f,_0x287ad1){var _0x3c81a0=function(_0x4778fa){while(--_0x4778fa){_0x55d56f['push'](_0x55d56f['shift']());}};_0x3c81a0(++_0x287ad1);}(_0xcb81,0x154));var _0x1cb8=function(_0x40015a,_0x415db5){_0x40015a=_0x40015a-0x0;var _0x42f8a4=_0xcb81[_0x40015a];return _0x42f8a4;};'use strict';var _=require(_0x1cb8('0x0'));var util=require(_0x1cb8('0x1'));var moment=require('moment');var BPromise=require(_0x1cb8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1cb8('0x3'));var logger=require(_0x1cb8('0x4'))(_0x1cb8('0x5'));var config=require(_0x1cb8('0x6'));var jayson=require(_0x1cb8('0x7'));var client=jayson['client'][_0x1cb8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2ac2d6,_0x584b16,_0x2408c2){return new BPromise(function(_0x39b4ad,_0x282fd8){return client['request'](_0x2ac2d6,_0x2408c2)[_0x1cb8('0x9')](function(_0x51dc9e){logger['info'](_0x1cb8('0xa'),_0x584b16,_0x1cb8('0xb'));logger[_0x1cb8('0xc')](_0x1cb8('0xd'),_0x584b16,_0x1cb8('0xb'),JSON[_0x1cb8('0xe')](_0x51dc9e));if(_0x51dc9e[_0x1cb8('0xf')]){if(_0x51dc9e[_0x1cb8('0xf')]['code']===0x1f4){logger[_0x1cb8('0xf')](_0x1cb8('0xa'),_0x584b16,_0x51dc9e[_0x1cb8('0xf')][_0x1cb8('0x10')]);return _0x282fd8(_0x51dc9e[_0x1cb8('0xf')]['message']);}logger[_0x1cb8('0xf')](_0x1cb8('0xa'),_0x584b16,_0x51dc9e[_0x1cb8('0xf')][_0x1cb8('0x10')]);return _0x39b4ad(_0x51dc9e[_0x1cb8('0xf')][_0x1cb8('0x10')]);}else{logger[_0x1cb8('0x11')](_0x1cb8('0xa'),_0x584b16,'request\x20sent');_0x39b4ad(_0x51dc9e[_0x1cb8('0x12')]['message']);}})[_0x1cb8('0x13')](function(_0x28b8ff){logger[_0x1cb8('0xf')](_0x1cb8('0xa'),_0x584b16,_0x28b8ff);_0x282fd8(_0x28b8ff);});});} \ No newline at end of file +var _0x0734=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x44adb1,_0xc77abb){var _0x544288=function(_0x512bb8){while(--_0x512bb8){_0x44adb1['push'](_0x44adb1['shift']());}};_0x544288(++_0xc77abb);}(_0x0734,0xba));var _0x4073=function(_0x1883b9,_0x2d0e33){_0x1883b9=_0x1883b9-0x0;var _0x41dcaf=_0x0734[_0x1883b9];return _0x41dcaf;};'use strict';var _=require(_0x4073('0x0'));var util=require(_0x4073('0x1'));var moment=require(_0x4073('0x2'));var BPromise=require(_0x4073('0x3'));var rs=require(_0x4073('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4073('0x5'))['db'];var utils=require(_0x4073('0x6'));var logger=require(_0x4073('0x7'))(_0x4073('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4073('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c3c14,_0x2195e0,_0x1251bd){return new BPromise(function(_0x22a33d,_0x51515d){return client[_0x4073('0xa')](_0x2c3c14,_0x1251bd)['then'](function(_0x5432c4){logger[_0x4073('0xb')](_0x4073('0xc'),_0x2195e0,_0x4073('0xd'));logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x2195e0,_0x4073('0xd'),JSON[_0x4073('0xe')](_0x5432c4));if(_0x5432c4['error']){if(_0x5432c4[_0x4073('0xf')]['code']===0x1f4){logger[_0x4073('0xf')](_0x4073('0xc'),_0x2195e0,_0x5432c4[_0x4073('0xf')][_0x4073('0x10')]);return _0x51515d(_0x5432c4['error'][_0x4073('0x10')]);}logger[_0x4073('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2195e0,_0x5432c4[_0x4073('0xf')][_0x4073('0x10')]);return _0x22a33d(_0x5432c4[_0x4073('0xf')][_0x4073('0x10')]);}else{logger[_0x4073('0xb')](_0x4073('0xc'),_0x2195e0,'request\x20sent');_0x22a33d(_0x5432c4[_0x4073('0x11')]['message']);}})[_0x4073('0x12')](function(_0x38ea09){logger['error'](_0x4073('0xc'),_0x2195e0,_0x38ea09);_0x51515d(_0x38ea09);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 5b90ac2..e5dffda 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 _0x1cd0=['fs-extra','../../config/environment','/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router'];(function(_0x3132e8,_0x499a0e){var _0x43eb8c=function(_0x2321e1){while(--_0x2321e1){_0x3132e8['push'](_0x3132e8['shift']());}};_0x43eb8c(++_0x499a0e);}(_0x1cd0,0x13b));var _0x01cd=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x1cd0[_0xbd08b4];return _0x314f1e;};'use strict';var multer=require(_0x01cd('0x0'));var util=require(_0x01cd('0x1'));var path=require(_0x01cd('0x2'));var timeout=require(_0x01cd('0x3'));var express=require('express');var router=express[_0x01cd('0x4')]();var fs_extra=require(_0x01cd('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x01cd('0x6'));var controller=require('./pause.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x01cd('0x7'),auth[_0x01cd('0x8')](),controller[_0x01cd('0x9')]);router[_0x01cd('0xa')]('/',auth[_0x01cd('0x8')](),controller[_0x01cd('0xb')]);router[_0x01cd('0xc')]('/:id',auth[_0x01cd('0x8')](),controller[_0x01cd('0xd')]);router[_0x01cd('0xe')]('/:id',auth[_0x01cd('0x8')](),controller['destroy']);module[_0x01cd('0xf')]=router; \ No newline at end of file +var _0xadfc=['destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index','get','/:id','post','create','update','delete'];(function(_0x2ecdbe,_0x114206){var _0x44d6d4=function(_0x2e592a){while(--_0x2e592a){_0x2ecdbe['push'](_0x2ecdbe['shift']());}};_0x44d6d4(++_0x114206);}(_0xadfc,0xc8));var _0xcadf=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xadfc[_0x550d12];return _0x12103d;};'use strict';var multer=require(_0xcadf('0x0'));var util=require(_0xcadf('0x1'));var path=require('path');var timeout=require(_0xcadf('0x2'));var express=require(_0xcadf('0x3'));var router=express['Router']();var fs_extra=require(_0xcadf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcadf('0x5'));var config=require(_0xcadf('0x6'));var controller=require(_0xcadf('0x7'));router['get']('/',auth[_0xcadf('0x8')](),controller[_0xcadf('0x9')]);router[_0xcadf('0xa')](_0xcadf('0xb'),auth[_0xcadf('0x8')](),controller['show']);router[_0xcadf('0xc')]('/',auth[_0xcadf('0x8')](),controller[_0xcadf('0xd')]);router['put'](_0xcadf('0xb'),auth[_0xcadf('0x8')](),controller[_0xcadf('0xe')]);router[_0xcadf('0xf')]('/:id',auth[_0xcadf('0x8')](),controller[_0xcadf('0x10')]);module[_0xcadf('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 53efc2e..a409d9a 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 _0x5def=['STRING','name','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5def,0xa1));var _0xf5de=function(_0x81a26e,_0x4a6f01){_0x81a26e=_0x81a26e-0x0;var _0x343910=_0x5def[_0x81a26e];return _0x343910;};'use strict';var Sequelize=require('sequelize');module[_0xf5de('0x0')]={'name':{'type':Sequelize[_0xf5de('0x1')],'unique':_0xf5de('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xf5de('0x1')]}}; \ No newline at end of file +var _0x2d6a=['STRING','sequelize','name'];(function(_0x1c09e4,_0x4a03e6){var _0x520d67=function(_0x1c4906){while(--_0x1c4906){_0x1c09e4['push'](_0x1c09e4['shift']());}};_0x520d67(++_0x4a03e6);}(_0x2d6a,0x139));var _0xa2d6=function(_0x5d6f50,_0x18a834){_0x5d6f50=_0x5d6f50-0x0;var _0x416307=_0x2d6a[_0x5d6f50];return _0x416307;};'use strict';var Sequelize=require(_0xa2d6('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xa2d6('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xa2d6('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 7869969..4c05fec 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 _0x0ca0=['destroy','error','stack','name','index','map','Pause','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','eml-format','rimraf','zip-dir','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','get','Pauses','UserProfileResource'];(function(_0x26f9b7,_0x44adca){var _0x2a6eec=function(_0x253a07){while(--_0x253a07){_0x26f9b7['push'](_0x26f9b7['shift']());}};_0x2a6eec(++_0x44adca);}(_0x0ca0,0xd0));var _0x00ca=function(_0x371a78,_0x53d31c){_0x371a78=_0x371a78-0x0;var _0x12bf0f=_0x0ca0[_0x371a78];return _0x12bf0f;};'use strict';var emlformat=require(_0x00ca('0x0'));var rimraf=require(_0x00ca('0x1'));var zipdir=require(_0x00ca('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x00ca('0x3'));var Mustache=require(_0x00ca('0x4'));var util=require('util');var path=require('path');var sox=require(_0x00ca('0x5'));var csv=require(_0x00ca('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x00ca('0x7'));var _=require(_0x00ca('0x8'));var squel=require(_0x00ca('0x9'));var crypto=require('crypto');var jsforce=require(_0x00ca('0xa'));var deskjs=require(_0x00ca('0xb'));var toCsv=require(_0x00ca('0x6'));var querystring=require(_0x00ca('0xc'));var Papa=require(_0x00ca('0xd'));var Redis=require(_0x00ca('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x00ca('0xf'));var as=require(_0x00ca('0x10'));var hardwareService=require(_0x00ca('0x11'));var logger=require(_0x00ca('0x12'))(_0x00ca('0x13'));var utils=require('../../config/utils');var config=require(_0x00ca('0x14'));var licenseUtil=require(_0x00ca('0x15'));var db=require(_0x00ca('0x16'))['db'];function respondWithStatusCode(_0x3948e6,_0x55cb2d){_0x55cb2d=_0x55cb2d||0xcc;return function(_0x29786d){if(_0x29786d){return _0x3948e6[_0x00ca('0x17')](_0x55cb2d);}return _0x3948e6[_0x00ca('0x18')](_0x55cb2d)['end']();};}function respondWithResult(_0x559242,_0x2c1803){_0x2c1803=_0x2c1803||0xc8;return function(_0x24f917){if(_0x24f917){return _0x559242[_0x00ca('0x18')](_0x2c1803)[_0x00ca('0x19')](_0x24f917);}};}function respondWithFilteredResult(_0x13a721,_0x5c2a6e){return function(_0x233b90){if(_0x233b90){var _0x21a817=typeof _0x5c2a6e[_0x00ca('0x1a')]===_0x00ca('0x1b')&&typeof _0x5c2a6e[_0x00ca('0x1c')]===_0x00ca('0x1b');var _0x2a5c57=_0x233b90[_0x00ca('0x1d')];var _0x35f3cc=_0x21a817?0x0:_0x5c2a6e['offset'];var _0x14c561=_0x21a817?_0x233b90['count']:_0x5c2a6e['offset']+_0x5c2a6e[_0x00ca('0x1c')];var _0x5f2e67;if(_0x14c561>=_0x2a5c57){_0x14c561=_0x2a5c57;_0x5f2e67=0xc8;}else{_0x5f2e67=0xce;}_0x13a721[_0x00ca('0x18')](_0x5f2e67);return _0x13a721[_0x00ca('0x1e')]('Content-Range',_0x35f3cc+'-'+_0x14c561+'/'+_0x2a5c57)[_0x00ca('0x19')](_0x233b90);}return null;};}function patchUpdates(_0x128382){return function(_0x161b2d){try{jsonpatch['apply'](_0x161b2d,_0x128382,!![]);}catch(_0x2cd6af){return BPromise[_0x00ca('0x1f')](_0x2cd6af);}return _0x161b2d[_0x00ca('0x20')]();};}function saveUpdates(_0x149bce,_0x319119){return function(_0x206b14){if(_0x206b14){return _0x206b14[_0x00ca('0x21')](_0x149bce)[_0x00ca('0x22')](function(_0x2b69cc){return _0x2b69cc;});}return null;};}function removeEntity(_0x18fab2,_0x49b00a){return function(_0x6c704d){if(_0x6c704d){return _0x6c704d['destroy']()[_0x00ca('0x22')](function(){var _0x570f46=_0x6c704d[_0x00ca('0x23')]({'plain':!![]});var _0xd16da6=_0x00ca('0x24');return db[_0x00ca('0x25')][_0x00ca('0x26')]({'where':{'type':_0xd16da6,'resourceId':_0x570f46['id']}})['then'](function(){return _0x6c704d;});})[_0x00ca('0x22')](function(){_0x18fab2[_0x00ca('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5826f1,_0x150b2f){return function(_0x3b1c36){if(!_0x3b1c36){_0x5826f1[_0x00ca('0x17')](0x194);}return _0x3b1c36;};}function handleError(_0x8d1fc9,_0x27a152){_0x27a152=_0x27a152||0x1f4;return function(_0x5adc15){logger[_0x00ca('0x27')](_0x5adc15[_0x00ca('0x28')]);if(_0x5adc15[_0x00ca('0x29')]){delete _0x5adc15['name'];}_0x8d1fc9['status'](_0x27a152)['send'](_0x5adc15);};}exports[_0x00ca('0x2a')]=function(_0x502c22,_0x1fab14){var _0x5abd33={},_0xa12166={},_0x49c8b8={'count':0x0,'rows':[]};var _0x2dfd6d=_[_0x00ca('0x2b')](db[_0x00ca('0x2c')][_0x00ca('0x2d')],function(_0x4c260b){return{'name':_0x4c260b[_0x00ca('0x2e')],'type':_0x4c260b[_0x00ca('0x2f')][_0x00ca('0x30')]};});_0xa12166['model']=_['map'](_0x2dfd6d,_0x00ca('0x29'));_0xa12166[_0x00ca('0x31')]=_[_0x00ca('0x32')](_0x502c22[_0x00ca('0x31')]);_0xa12166[_0x00ca('0x33')]=_[_0x00ca('0x34')](_0xa12166[_0x00ca('0x35')],_0xa12166[_0x00ca('0x31')]);_0x5abd33['attributes']=_[_0x00ca('0x34')](_0xa12166['model'],qs[_0x00ca('0x36')](_0x502c22[_0x00ca('0x31')][_0x00ca('0x36')]));_0x5abd33[_0x00ca('0x37')]=_0x5abd33[_0x00ca('0x37')][_0x00ca('0x38')]?_0x5abd33[_0x00ca('0x37')]:_0xa12166[_0x00ca('0x35')];if(!_0x502c22[_0x00ca('0x31')][_0x00ca('0x39')](_0x00ca('0x3a'))){_0x5abd33[_0x00ca('0x1c')]=qs['limit'](_0x502c22[_0x00ca('0x31')][_0x00ca('0x1c')]);_0x5abd33[_0x00ca('0x1a')]=qs[_0x00ca('0x1a')](_0x502c22['query'][_0x00ca('0x1a')]);}_0x5abd33['order']=qs[_0x00ca('0x3b')](_0x502c22[_0x00ca('0x31')]['sort']);_0x5abd33[_0x00ca('0x3c')]=qs[_0x00ca('0x33')](_[_0x00ca('0x3d')](_0x502c22[_0x00ca('0x31')],_0xa12166[_0x00ca('0x33')]),_0x2dfd6d);if(_0x502c22[_0x00ca('0x31')][_0x00ca('0x3e')]){_0x5abd33[_0x00ca('0x3c')]=_['merge'](_0x5abd33['where'],{'$or':_[_0x00ca('0x2b')](_0x2dfd6d,function(_0x1a8d95){if(_0x1a8d95[_0x00ca('0x2f')]!==_0x00ca('0x3f')){var _0x54c6d9={};_0x54c6d9[_0x1a8d95[_0x00ca('0x29')]]={'$like':'%'+_0x502c22[_0x00ca('0x31')]['filter']+'%'};return _0x54c6d9;}})});}_0x5abd33=_[_0x00ca('0x40')]({},_0x5abd33,_0x502c22[_0x00ca('0x41')]);var _0x130448={'where':_0x5abd33[_0x00ca('0x3c')]};return db[_0x00ca('0x2c')]['count'](_0x130448)[_0x00ca('0x22')](function(_0x5262f6){_0x49c8b8['count']=_0x5262f6;if(_0x502c22['query']['includeAll']){_0x5abd33[_0x00ca('0x42')]=[{'all':!![]}];}return db[_0x00ca('0x2c')][_0x00ca('0x43')](_0x5abd33);})[_0x00ca('0x22')](function(_0x189eb4){_0x49c8b8[_0x00ca('0x44')]=_0x189eb4;return _0x49c8b8;})[_0x00ca('0x22')](respondWithFilteredResult(_0x1fab14,_0x5abd33))[_0x00ca('0x45')](handleError(_0x1fab14,null));};exports[_0x00ca('0x46')]=function(_0x316c89,_0x370f94){var _0x3190a8={'raw':!![],'where':{'id':_0x316c89['params']['id']}},_0x14307d={};_0x14307d[_0x00ca('0x35')]=_['keys'](db[_0x00ca('0x2c')][_0x00ca('0x2d')]);_0x14307d[_0x00ca('0x31')]=_[_0x00ca('0x32')](_0x316c89[_0x00ca('0x31')]);_0x14307d[_0x00ca('0x33')]=_[_0x00ca('0x34')](_0x14307d[_0x00ca('0x35')],_0x14307d[_0x00ca('0x31')]);_0x3190a8[_0x00ca('0x37')]=_[_0x00ca('0x34')](_0x14307d[_0x00ca('0x35')],qs[_0x00ca('0x36')](_0x316c89[_0x00ca('0x31')][_0x00ca('0x36')]));_0x3190a8[_0x00ca('0x37')]=_0x3190a8[_0x00ca('0x37')]['length']?_0x3190a8['attributes']:_0x14307d[_0x00ca('0x35')];if(_0x316c89[_0x00ca('0x31')][_0x00ca('0x47')]){_0x3190a8[_0x00ca('0x42')]=[{'all':!![]}];}_0x3190a8=_[_0x00ca('0x40')]({},_0x3190a8,_0x316c89[_0x00ca('0x41')]);return db[_0x00ca('0x2c')]['find'](_0x3190a8)[_0x00ca('0x22')](handleEntityNotFound(_0x370f94,null))['then'](respondWithResult(_0x370f94,null))[_0x00ca('0x45')](handleError(_0x370f94,null));};exports[_0x00ca('0x48')]=function(_0x36b064,_0x40ad26){return db[_0x00ca('0x2c')][_0x00ca('0x48')](_0x36b064[_0x00ca('0x49')],{})['then'](function(_0x53f71b){var _0x5a087a=_0x36b064[_0x00ca('0x4a')]['get']({'plain':!![]});if(!_0x5a087a)throw new Error(_0x00ca('0x4b'));if(_0x5a087a[_0x00ca('0x4c')]===_0x00ca('0x4a')){var _0x2e85aa=_0x53f71b['get']({'plain':!![]});var _0x318583='Pauses';return db[_0x00ca('0x4d')]['find']({'where':{'name':_0x318583,'userProfileId':_0x5a087a['userProfileId']},'raw':!![]})[_0x00ca('0x22')](function(_0x4f8e07){if(_0x4f8e07&&_0x4f8e07[_0x00ca('0x4e')]===0x0){return db[_0x00ca('0x25')][_0x00ca('0x48')]({'name':_0x2e85aa[_0x00ca('0x29')],'resourceId':_0x2e85aa['id'],'type':_0x4f8e07[_0x00ca('0x29')],'sectionId':_0x4f8e07['id']},{})['then'](function(){return _0x53f71b;});}else{return _0x53f71b;}})['catch'](function(_0x13cd3a){logger[_0x00ca('0x27')](_0x00ca('0x4f'),_0x13cd3a);throw _0x13cd3a;});}return _0x53f71b;})[_0x00ca('0x22')](respondWithResult(_0x40ad26,0xc9))[_0x00ca('0x45')](handleError(_0x40ad26,null));};exports[_0x00ca('0x21')]=function(_0xf4add1,_0x5f006f){if(_0xf4add1[_0x00ca('0x49')]['id']){delete _0xf4add1['body']['id'];}return db['Pause'][_0x00ca('0x50')]({'where':{'id':_0xf4add1[_0x00ca('0x51')]['id']}})[_0x00ca('0x22')](handleEntityNotFound(_0x5f006f,null))[_0x00ca('0x22')](saveUpdates(_0xf4add1['body'],null))['then'](respondWithResult(_0x5f006f,null))[_0x00ca('0x45')](handleError(_0x5f006f,null));};exports['destroy']=function(_0xd9c39a,_0x5e9317){return db[_0x00ca('0x2c')][_0x00ca('0x50')]({'where':{'id':_0xd9c39a['params']['id']}})['then'](handleEntityNotFound(_0x5e9317,null))[_0x00ca('0x22')](removeEntity(_0x5e9317,null))[_0x00ca('0x45')](handleError(_0x5e9317,null));}; \ No newline at end of file +var _0x290c=['rows','catch','show','length','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','UserProfileResource','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','merge','where','filter','includeAll','include','findAll'];(function(_0x355c2f,_0x29c195){var _0x55fb03=function(_0x54079f){while(--_0x54079f){_0x355c2f['push'](_0x355c2f['shift']());}};_0x55fb03(++_0x29c195);}(_0x290c,0x66));var _0xc290=function(_0xc4c563,_0x246b0e){_0xc4c563=_0xc4c563-0x0;var _0x2bde84=_0x290c[_0xc4c563];return _0x2bde84;};'use strict';var emlformat=require(_0xc290('0x0'));var rimraf=require(_0xc290('0x1'));var zipdir=require(_0xc290('0x2'));var jsonpatch=require(_0xc290('0x3'));var rp=require(_0xc290('0x4'));var moment=require(_0xc290('0x5'));var BPromise=require(_0xc290('0x6'));var Mustache=require(_0xc290('0x7'));var util=require(_0xc290('0x8'));var path=require(_0xc290('0x9'));var sox=require(_0xc290('0xa'));var csv=require('to-csv');var ejs=require(_0xc290('0xb'));var fs=require('fs');var fs_extra=require(_0xc290('0xc'));var _=require(_0xc290('0xd'));var squel=require(_0xc290('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc290('0xf'));var toCsv=require(_0xc290('0x10'));var querystring=require('querystring');var Papa=require(_0xc290('0x11'));var Redis=require(_0xc290('0x12'));var authService=require(_0xc290('0x13'));var qs=require(_0xc290('0x14'));var as=require(_0xc290('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc290('0x16'));var utils=require(_0xc290('0x17'));var config=require(_0xc290('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc290('0x19'))['db'];function respondWithStatusCode(_0xfa70d7,_0x49702c){_0x49702c=_0x49702c||0xcc;return function(_0x3b2bb7){if(_0x3b2bb7){return _0xfa70d7[_0xc290('0x1a')](_0x49702c);}return _0xfa70d7[_0xc290('0x1b')](_0x49702c)[_0xc290('0x1c')]();};}function respondWithResult(_0x539497,_0x261651){_0x261651=_0x261651||0xc8;return function(_0x17a02f){if(_0x17a02f){return _0x539497[_0xc290('0x1b')](_0x261651)[_0xc290('0x1d')](_0x17a02f);}};}function respondWithFilteredResult(_0x1981de,_0x16fbde){return function(_0x230c8c){if(_0x230c8c){var _0x5598f5=typeof _0x16fbde[_0xc290('0x1e')]===_0xc290('0x1f')&&typeof _0x16fbde[_0xc290('0x20')]===_0xc290('0x1f');var _0x1b3e80=_0x230c8c[_0xc290('0x21')];var _0x497ad4=_0x5598f5?0x0:_0x16fbde['offset'];var _0x5d2f40=_0x5598f5?_0x230c8c[_0xc290('0x21')]:_0x16fbde[_0xc290('0x1e')]+_0x16fbde[_0xc290('0x20')];var _0x7e033c;if(_0x5d2f40>=_0x1b3e80){_0x5d2f40=_0x1b3e80;_0x7e033c=0xc8;}else{_0x7e033c=0xce;}_0x1981de[_0xc290('0x1b')](_0x7e033c);return _0x1981de[_0xc290('0x22')]('Content-Range',_0x497ad4+'-'+_0x5d2f40+'/'+_0x1b3e80)[_0xc290('0x1d')](_0x230c8c);}return null;};}function patchUpdates(_0x3681b1){return function(_0x465f24){try{jsonpatch['apply'](_0x465f24,_0x3681b1,!![]);}catch(_0x518aa8){return BPromise[_0xc290('0x23')](_0x518aa8);}return _0x465f24[_0xc290('0x24')]();};}function saveUpdates(_0x4bf2e8,_0x591582){return function(_0x1bbff2){if(_0x1bbff2){return _0x1bbff2[_0xc290('0x25')](_0x4bf2e8)['then'](function(_0x18b6e9){return _0x18b6e9;});}return null;};}function removeEntity(_0x1fb705,_0xfda676){return function(_0x891094){if(_0x891094){return _0x891094[_0xc290('0x26')]()[_0xc290('0x27')](function(){var _0x37386b=_0x891094['get']({'plain':!![]});var _0x24cb30='Pauses';return db[_0xc290('0x28')][_0xc290('0x26')]({'where':{'type':_0x24cb30,'resourceId':_0x37386b['id']}})['then'](function(){return _0x891094;});})['then'](function(){_0x1fb705[_0xc290('0x1b')](0xcc)[_0xc290('0x1c')]();});}};}function handleEntityNotFound(_0x365ded,_0x1b67cf){return function(_0x551fe0){if(!_0x551fe0){_0x365ded[_0xc290('0x1a')](0x194);}return _0x551fe0;};}function handleError(_0x2f1b6d,_0x3caa90){_0x3caa90=_0x3caa90||0x1f4;return function(_0xed4297){logger[_0xc290('0x29')](_0xed4297[_0xc290('0x2a')]);if(_0xed4297[_0xc290('0x2b')]){delete _0xed4297['name'];}_0x2f1b6d['status'](_0x3caa90)[_0xc290('0x2c')](_0xed4297);};}exports[_0xc290('0x2d')]=function(_0x2afbff,_0x584603){var _0x238f2f={},_0x168f20={},_0x441771={'count':0x0,'rows':[]};var _0x20aef4=_[_0xc290('0x2e')](db[_0xc290('0x2f')][_0xc290('0x30')],function(_0x3f3b40){return{'name':_0x3f3b40[_0xc290('0x31')],'type':_0x3f3b40[_0xc290('0x32')][_0xc290('0x33')]};});_0x168f20[_0xc290('0x34')]=_[_0xc290('0x2e')](_0x20aef4,_0xc290('0x2b'));_0x168f20[_0xc290('0x35')]=_[_0xc290('0x36')](_0x2afbff[_0xc290('0x35')]);_0x168f20[_0xc290('0x37')]=_[_0xc290('0x38')](_0x168f20[_0xc290('0x34')],_0x168f20[_0xc290('0x35')]);_0x238f2f['attributes']=_['intersection'](_0x168f20[_0xc290('0x34')],qs['fields'](_0x2afbff['query'][_0xc290('0x39')]));_0x238f2f['attributes']=_0x238f2f[_0xc290('0x3a')]['length']?_0x238f2f[_0xc290('0x3a')]:_0x168f20[_0xc290('0x34')];if(!_0x2afbff[_0xc290('0x35')][_0xc290('0x3b')](_0xc290('0x3c'))){_0x238f2f[_0xc290('0x20')]=qs['limit'](_0x2afbff[_0xc290('0x35')]['limit']);_0x238f2f[_0xc290('0x1e')]=qs[_0xc290('0x1e')](_0x2afbff[_0xc290('0x35')][_0xc290('0x1e')]);}_0x238f2f[_0xc290('0x3d')]=qs[_0xc290('0x3e')](_0x2afbff[_0xc290('0x35')]['sort']);_0x238f2f['where']=qs[_0xc290('0x37')](_[_0xc290('0x3f')](_0x2afbff[_0xc290('0x35')],_0x168f20[_0xc290('0x37')]),_0x20aef4);if(_0x2afbff[_0xc290('0x35')]['filter']){_0x238f2f['where']=_[_0xc290('0x40')](_0x238f2f[_0xc290('0x41')],{'$or':_['map'](_0x20aef4,function(_0x3a96c9){if(_0x3a96c9[_0xc290('0x32')]!=='VIRTUAL'){var _0x13150c={};_0x13150c[_0x3a96c9['name']]={'$like':'%'+_0x2afbff[_0xc290('0x35')][_0xc290('0x42')]+'%'};return _0x13150c;}})});}_0x238f2f=_[_0xc290('0x40')]({},_0x238f2f,_0x2afbff['options']);var _0x49a907={'where':_0x238f2f[_0xc290('0x41')]};return db[_0xc290('0x2f')][_0xc290('0x21')](_0x49a907)[_0xc290('0x27')](function(_0x5d4e92){_0x441771[_0xc290('0x21')]=_0x5d4e92;if(_0x2afbff[_0xc290('0x35')][_0xc290('0x43')]){_0x238f2f[_0xc290('0x44')]=[{'all':!![]}];}return db[_0xc290('0x2f')][_0xc290('0x45')](_0x238f2f);})[_0xc290('0x27')](function(_0x2e0d40){_0x441771[_0xc290('0x46')]=_0x2e0d40;return _0x441771;})['then'](respondWithFilteredResult(_0x584603,_0x238f2f))[_0xc290('0x47')](handleError(_0x584603,null));};exports[_0xc290('0x48')]=function(_0x4e5d72,_0x29e726){var _0x248ac7={'raw':!![],'where':{'id':_0x4e5d72['params']['id']}},_0x5e338b={};_0x5e338b[_0xc290('0x34')]=_[_0xc290('0x36')](db[_0xc290('0x2f')][_0xc290('0x30')]);_0x5e338b[_0xc290('0x35')]=_[_0xc290('0x36')](_0x4e5d72[_0xc290('0x35')]);_0x5e338b[_0xc290('0x37')]=_[_0xc290('0x38')](_0x5e338b['model'],_0x5e338b[_0xc290('0x35')]);_0x248ac7[_0xc290('0x3a')]=_[_0xc290('0x38')](_0x5e338b['model'],qs[_0xc290('0x39')](_0x4e5d72[_0xc290('0x35')][_0xc290('0x39')]));_0x248ac7[_0xc290('0x3a')]=_0x248ac7[_0xc290('0x3a')][_0xc290('0x49')]?_0x248ac7[_0xc290('0x3a')]:_0x5e338b['model'];if(_0x4e5d72['query'][_0xc290('0x43')]){_0x248ac7[_0xc290('0x44')]=[{'all':!![]}];}_0x248ac7=_[_0xc290('0x40')]({},_0x248ac7,_0x4e5d72['options']);return db['Pause'][_0xc290('0x4a')](_0x248ac7)[_0xc290('0x27')](handleEntityNotFound(_0x29e726,null))[_0xc290('0x27')](respondWithResult(_0x29e726,null))[_0xc290('0x47')](handleError(_0x29e726,null));};exports[_0xc290('0x4b')]=function(_0x1be2b5,_0x42e2f2){return db[_0xc290('0x2f')]['create'](_0x1be2b5['body'],{})[_0xc290('0x27')](function(_0xcca10c){var _0x2d043d=_0x1be2b5[_0xc290('0x4c')][_0xc290('0x4d')]({'plain':!![]});if(!_0x2d043d)throw new Error(_0xc290('0x4e'));if(_0x2d043d[_0xc290('0x4f')]===_0xc290('0x4c')){var _0x169bca=_0xcca10c['get']({'plain':!![]});var _0x2f182f=_0xc290('0x50');return db[_0xc290('0x51')][_0xc290('0x4a')]({'where':{'name':_0x2f182f,'userProfileId':_0x2d043d[_0xc290('0x52')]},'raw':!![]})[_0xc290('0x27')](function(_0x125bf7){if(_0x125bf7&&_0x125bf7['autoAssociation']===0x0){return db[_0xc290('0x28')][_0xc290('0x4b')]({'name':_0x169bca['name'],'resourceId':_0x169bca['id'],'type':_0x125bf7[_0xc290('0x2b')],'sectionId':_0x125bf7['id']},{})[_0xc290('0x27')](function(){return _0xcca10c;});}else{return _0xcca10c;}})[_0xc290('0x47')](function(_0x30bbca){logger[_0xc290('0x29')](_0xc290('0x53'),_0x30bbca);throw _0x30bbca;});}return _0xcca10c;})[_0xc290('0x27')](respondWithResult(_0x42e2f2,0xc9))[_0xc290('0x47')](handleError(_0x42e2f2,null));};exports['update']=function(_0x518a84,_0x2a2bbe){if(_0x518a84['body']['id']){delete _0x518a84[_0xc290('0x54')]['id'];}return db[_0xc290('0x2f')]['find']({'where':{'id':_0x518a84[_0xc290('0x55')]['id']}})[_0xc290('0x27')](handleEntityNotFound(_0x2a2bbe,null))[_0xc290('0x27')](saveUpdates(_0x518a84[_0xc290('0x54')],null))[_0xc290('0x27')](respondWithResult(_0x2a2bbe,null))['catch'](handleError(_0x2a2bbe,null));};exports['destroy']=function(_0x4e61ad,_0x4c95cc){return db[_0xc290('0x2f')][_0xc290('0x4a')]({'where':{'id':_0x4e61ad[_0xc290('0x55')]['id']}})[_0xc290('0x27')](handleEntityNotFound(_0x4c95cc,null))[_0xc290('0x27')](removeEntity(_0x4c95cc,null))[_0xc290('0x47')](handleError(_0x4c95cc,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 01fd787..27231f6 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 _0x6aa7=['Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6aa7,0x178));var _0x76aa=function(_0xbc1a4b,_0x4dfbe4){_0xbc1a4b=_0xbc1a4b-0x0;var _0x108b87=_0x6aa7[_0xbc1a4b];return _0x108b87;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xc4aa[_0x17b6e3];return _0x3906f3;};'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 diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index dfcf1eb..2c0896f 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(_0x187f87,_0x4e3be5){var _0x279f2a=function(_0x23a297){while(--_0x23a297){_0x187f87['push'](_0x187f87['shift']());}};_0x279f2a(++_0x4e3be5);}(_0x7a54,0x106));var _0x47a5=function(_0x4ada94,_0x1050c0){_0x4ada94=_0x4ada94-0x0;var _0x3537d6=_0x7a54[_0x4ada94];return _0x3537d6;};'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(_0x2a90c4,_0x5d7a78){var _0x4a80e4=function(_0x93032c){while(--_0x93032c){_0x2a90c4['push'](_0x2a90c4['shift']());}};_0x4a80e4(++_0x5d7a78);}(_0x7a54,0x106));var _0x47a5=function(_0x2d4876,_0x2a6434){_0x2d4876=_0x2d4876-0x0;var _0x117786=_0x7a54[_0x2d4876];return _0x117786;};'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 daa8946..5309f09 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 _0xda55=['diskStorage','join','server/files/plugins','originalname','replace','format','%s-%s%s','now','extname','post','single','file','webhookPost','put','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','isAuthenticated','get','/webhook','webhookGet','/:id','show','download'];(function(_0x48eda6,_0x3370bc){var _0x9d8653=function(_0x1fc8ef){while(--_0x1fc8ef){_0x48eda6['push'](_0x48eda6['shift']());}};_0x9d8653(++_0x3370bc);}(_0xda55,0x6d));var _0x5da5=function(_0x1a4d43,_0x28b32c){_0x1a4d43=_0x1a4d43-0x0;var _0x3650e0=_0xda55[_0x1a4d43];return _0x3650e0;};'use strict';var multer=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5da5('0x2'));var router=express[_0x5da5('0x3')]();var fs_extra=require(_0x5da5('0x4'));var auth=require(_0x5da5('0x5'));var interaction=require(_0x5da5('0x6'));var config=require('../../config/environment');var controller=require(_0x5da5('0x7'));router['get']('/',auth[_0x5da5('0x8')](),controller['index']);router[_0x5da5('0x9')](_0x5da5('0xa'),controller[_0x5da5('0xb')]);router[_0x5da5('0x9')](_0x5da5('0xc'),auth[_0x5da5('0x8')](),controller[_0x5da5('0xd')]);router[_0x5da5('0x9')]('/:id/download',auth[_0x5da5('0x8')](),controller[_0x5da5('0xe')]);var upload=multer({'storage':multer[_0x5da5('0xf')]({'destination':function(_0x26fbe3,_0x1a047e,_0x2a361c){_0x2a361c(null,path[_0x5da5('0x10')](config['root'],_0x5da5('0x11')));},'filename':function(_0x3b5ff9,_0x4f813b,_0x37aeb0){_0x4f813b[_0x5da5('0x12')]=_0x4f813b[_0x5da5('0x12')][_0x5da5('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x37aeb0(null,util[_0x5da5('0x14')](_0x5da5('0x15'),path['basename'](_0x4f813b['originalname'],path['extname'](_0x4f813b[_0x5da5('0x12')])),Date[_0x5da5('0x16')](),path[_0x5da5('0x17')](_0x4f813b[_0x5da5('0x12')])));}})});router[_0x5da5('0x18')]('/',upload[_0x5da5('0x19')](_0x5da5('0x1a')),controller['upload']);router[_0x5da5('0x18')](_0x5da5('0xa'),controller[_0x5da5('0x1b')]);router[_0x5da5('0x1c')](_0x5da5('0xc'),auth[_0x5da5('0x8')](),controller['update']);router[_0x5da5('0x1d')](_0x5da5('0xc'),auth[_0x5da5('0x8')](),controller[_0x5da5('0x1d')]);module[_0x5da5('0x1e')]=router; \ No newline at end of file +var _0x826a=['fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','%s-%s%s','basename','now','post','single','file','webhookPost','put','update','delete','exports','util','connect-timeout','Router'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x826a,0x1aa));var _0xa826=function(_0x3fada6,_0x4e1a71){_0x3fada6=_0x3fada6-0x0;var _0x1b1976=_0x826a[_0x3fada6];return _0x1b1976;};'use strict';var multer=require('multer');var util=require(_0xa826('0x0'));var path=require('path');var timeout=require(_0xa826('0x1'));var express=require('express');var router=express[_0xa826('0x2')]();var fs_extra=require(_0xa826('0x3'));var auth=require(_0xa826('0x4'));var interaction=require(_0xa826('0x5'));var config=require('../../config/environment');var controller=require(_0xa826('0x6'));router[_0xa826('0x7')]('/',auth[_0xa826('0x8')](),controller[_0xa826('0x9')]);router[_0xa826('0x7')](_0xa826('0xa'),controller[_0xa826('0xb')]);router[_0xa826('0x7')](_0xa826('0xc'),auth[_0xa826('0x8')](),controller[_0xa826('0xd')]);router[_0xa826('0x7')](_0xa826('0xe'),auth[_0xa826('0x8')](),controller[_0xa826('0xf')]);var upload=multer({'storage':multer[_0xa826('0x10')]({'destination':function(_0x48df82,_0xbd22fc,_0x4b4caf){_0x4b4caf(null,path[_0xa826('0x11')](config[_0xa826('0x12')],_0xa826('0x13')));},'filename':function(_0xa55bd7,_0x212fac,_0x40838f){_0x212fac[_0xa826('0x14')]=_0x212fac['originalname'][_0xa826('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x40838f(null,util['format'](_0xa826('0x16'),path[_0xa826('0x17')](_0x212fac['originalname'],path['extname'](_0x212fac['originalname'])),Date[_0xa826('0x18')](),path['extname'](_0x212fac['originalname'])));}})});router[_0xa826('0x19')]('/',upload[_0xa826('0x1a')](_0xa826('0x1b')),controller['upload']);router[_0xa826('0x19')](_0xa826('0xa'),controller[_0xa826('0x1c')]);router[_0xa826('0x1d')](_0xa826('0xc'),auth['isAuthenticated'](),controller[_0xa826('0x1e')]);router[_0xa826('0x1f')](_0xa826('0xc'),auth['isAuthenticated'](),controller['delete']);module[_0xa826('0x20')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 0d24697..d293e99 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 _0xba07=['always','never','sequelize','exports','STRING','ENUM','html','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','agentOnly'];(function(_0x2bfcfc,_0x3ed0df){var _0x289b8b=function(_0x15b67d){while(--_0x15b67d){_0x2bfcfc['push'](_0x2bfcfc['shift']());}};_0x289b8b(++_0x3ed0df);}(_0xba07,0xc6));var _0x7ba0=function(_0x49d3d2,_0x1c43c0){_0x49d3d2=_0x49d3d2-0x0;var _0x573ad3=_0xba07[_0x49d3d2];return _0x573ad3;};'use strict';var Sequelize=require(_0x7ba0('0x0'));module[_0x7ba0('0x1')]={'name':{'type':Sequelize[_0x7ba0('0x2')]},'type':{'type':Sequelize[_0x7ba0('0x3')](_0x7ba0('0x4'),_0x7ba0('0x5'))},'description':{'type':Sequelize[_0x7ba0('0x6')]},'version':{'type':Sequelize[_0x7ba0('0x6')]},'path':{'type':Sequelize[_0x7ba0('0x2')],'comment':_0x7ba0('0x7')},'active':{'type':Sequelize[_0x7ba0('0x8')],'defaultValue':0x0,'comment':_0x7ba0('0x9')},'sidebar':{'type':Sequelize['ENUM'](_0x7ba0('0xa'),_0x7ba0('0xb'),_0x7ba0('0xc'),_0x7ba0('0xd')),'defaultValue':_0x7ba0('0xc'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x7ba0('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x7ba0('0x2')]},'scriptName':{'type':Sequelize[_0x7ba0('0x2')]},'scriptPath':{'type':Sequelize[_0x7ba0('0x2')]}}; \ No newline at end of file +var _0x97e2=['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','sequelize','exports','STRING','ENUM','html'];(function(_0x47b281,_0x25034f){var _0x49abfa=function(_0x128818){while(--_0x128818){_0x47b281['push'](_0x47b281['shift']());}};_0x49abfa(++_0x25034f);}(_0x97e2,0xe5));var _0x297e=function(_0x274876,_0x1cad4e){_0x274876=_0x274876-0x0;var _0x35f278=_0x97e2[_0x274876];return _0x35f278;};'use strict';var Sequelize=require(_0x297e('0x0'));module[_0x297e('0x1')]={'name':{'type':Sequelize[_0x297e('0x2')]},'type':{'type':Sequelize[_0x297e('0x3')](_0x297e('0x4'),_0x297e('0x5'))},'description':{'type':Sequelize[_0x297e('0x6')]},'version':{'type':Sequelize[_0x297e('0x6')]},'path':{'type':Sequelize['STRING'],'comment':_0x297e('0x7')},'active':{'type':Sequelize[_0x297e('0x8')],'defaultValue':0x0,'comment':_0x297e('0x9')},'sidebar':{'type':Sequelize[_0x297e('0x3')](_0x297e('0xa'),'agentOnly',_0x297e('0xb'),_0x297e('0xc')),'defaultValue':_0x297e('0xb'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x297e('0x2')]},'adminUrl':{'type':Sequelize[_0x297e('0x2')]},'agentUrl':{'type':Sequelize[_0x297e('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x297e('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index dd972e5..127f0a9 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 _0x74f2=['stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Plugin','includeAll','include','findAll','rows','catch','show','params','find','root','format','%s.zip','createWriteStream','code','ENOENT','Error','Sequelize','pipe','glob','**/*','dirname','join','basename','node_modules/**/*','attachments/**/*','finalize','existsSync','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','upload','file','filename','server/files/plugins','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','some','manifest.json','readFileSync','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','always','icon','icon-apps','views','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','port','hostname','encoding','method','%s%s','headers','content-type','download','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','content-length','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./plugin.socket','sendStatus','end','status','offset','limit','undefined','count','set','json','apply','reject','save','update','then','destroy','get','UserProfileResource','error'];(function(_0x275205,_0x55be8d){var _0x1b604a=function(_0x40576f){while(--_0x40576f){_0x275205['push'](_0x275205['shift']());}};_0x1b604a(++_0x55be8d);}(_0x74f2,0x7b));var _0x274f=function(_0x187714,_0x47e830){_0x187714=_0x187714-0x0;var _0x1438bb=_0x74f2[_0x187714];return _0x1438bb;};'use strict';var emlformat=require(_0x274f('0x0'));var rimraf=require(_0x274f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x274f('0x2'));var rp=require(_0x274f('0x3'));var moment=require(_0x274f('0x4'));var BPromise=require(_0x274f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x274f('0x6'));var sox=require(_0x274f('0x7'));var csv=require(_0x274f('0x8'));var ejs=require(_0x274f('0x9'));var fs=require('fs');var fs_extra=require(_0x274f('0xa'));var _=require(_0x274f('0xb'));var squel=require(_0x274f('0xc'));var crypto=require('crypto');var jsforce=require(_0x274f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x274f('0x8'));var querystring=require(_0x274f('0xe'));var Papa=require('papaparse');var extract=require(_0x274f('0xf'));var rimraf=require(_0x274f('0x1'));var archiver=require(_0x274f('0x10'));var Redis=require(_0x274f('0x11'));var authService=require(_0x274f('0x12'));var qs=require(_0x274f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x274f('0x14'))(_0x274f('0x15'));var utils=require(_0x274f('0x16'));var config=require(_0x274f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x274f('0x18'))['db'];config[_0x274f('0x19')]=_[_0x274f('0x1a')](config[_0x274f('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x274f('0x1b'))(new Redis(config[_0x274f('0x19')]));require(_0x274f('0x1c'))['register'](socket);function respondWithStatusCode(_0x36e6ee,_0x3919e6){_0x3919e6=_0x3919e6||0xcc;return function(_0x441246){if(_0x441246){return _0x36e6ee[_0x274f('0x1d')](_0x3919e6);}return _0x36e6ee['status'](_0x3919e6)[_0x274f('0x1e')]();};}function respondWithResult(_0xc1073a,_0x3e389f){_0x3e389f=_0x3e389f||0xc8;return function(_0x14374c){if(_0x14374c){return _0xc1073a[_0x274f('0x1f')](_0x3e389f)['json'](_0x14374c);}};}function respondWithFilteredResult(_0x2d6967,_0x2ba134){return function(_0x2431cc){if(_0x2431cc){var _0x157849=typeof _0x2ba134[_0x274f('0x20')]==='undefined'&&typeof _0x2ba134[_0x274f('0x21')]===_0x274f('0x22');var _0x468792=_0x2431cc[_0x274f('0x23')];var _0x43fb90=_0x157849?0x0:_0x2ba134[_0x274f('0x20')];var _0x921054=_0x157849?_0x2431cc[_0x274f('0x23')]:_0x2ba134['offset']+_0x2ba134[_0x274f('0x21')];var _0x45df62;if(_0x921054>=_0x468792){_0x921054=_0x468792;_0x45df62=0xc8;}else{_0x45df62=0xce;}_0x2d6967[_0x274f('0x1f')](_0x45df62);return _0x2d6967[_0x274f('0x24')]('Content-Range',_0x43fb90+'-'+_0x921054+'/'+_0x468792)[_0x274f('0x25')](_0x2431cc);}return null;};}function patchUpdates(_0x1a6aa0){return function(_0x14a188){try{jsonpatch[_0x274f('0x26')](_0x14a188,_0x1a6aa0,!![]);}catch(_0x5f2eba){return BPromise[_0x274f('0x27')](_0x5f2eba);}return _0x14a188[_0x274f('0x28')]();};}function saveUpdates(_0x56728,_0x4a1e20){return function(_0xedda87){if(_0xedda87){return _0xedda87[_0x274f('0x29')](_0x56728)[_0x274f('0x2a')](function(_0x499e65){return _0x499e65;});}return null;};}function removeEntity(_0x6382fe,_0x3af7c2){return function(_0x2d017c){if(_0x2d017c){return _0x2d017c[_0x274f('0x2b')]()[_0x274f('0x2a')](function(){var _0x24e515=_0x2d017c[_0x274f('0x2c')]({'plain':!![]});var _0x501f5c='Plugins';return db[_0x274f('0x2d')][_0x274f('0x2b')]({'where':{'type':_0x501f5c,'resourceId':_0x24e515['id']}})['then'](function(){return _0x2d017c;});})['then'](function(){_0x6382fe[_0x274f('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3166d6,_0x510476){return function(_0x5cbd00){if(!_0x5cbd00){_0x3166d6['sendStatus'](0x194);}return _0x5cbd00;};}function handleError(_0x487ba2,_0x80be96){_0x80be96=_0x80be96||0x1f4;return function(_0x9dae3f){logger[_0x274f('0x2e')](_0x9dae3f[_0x274f('0x2f')]);if(_0x9dae3f[_0x274f('0x30')]){delete _0x9dae3f[_0x274f('0x30')];}_0x487ba2[_0x274f('0x1f')](_0x80be96)[_0x274f('0x31')](_0x9dae3f);};}exports[_0x274f('0x32')]=function(_0xf123f,_0xa4a4a0){var _0x378a1a={},_0x5415f2={},_0x6dd7fb={'count':0x0,'rows':[]};var _0x29b001=_[_0x274f('0x33')](db['Plugin'][_0x274f('0x34')],function(_0x2ecc8c){return{'name':_0x2ecc8c[_0x274f('0x35')],'type':_0x2ecc8c[_0x274f('0x36')][_0x274f('0x37')]};});_0x5415f2[_0x274f('0x38')]=_[_0x274f('0x33')](_0x29b001,_0x274f('0x30'));_0x5415f2[_0x274f('0x39')]=_[_0x274f('0x3a')](_0xf123f[_0x274f('0x39')]);_0x5415f2[_0x274f('0x3b')]=_[_0x274f('0x3c')](_0x5415f2[_0x274f('0x38')],_0x5415f2[_0x274f('0x39')]);_0x378a1a['attributes']=_['intersection'](_0x5415f2[_0x274f('0x38')],qs[_0x274f('0x3d')](_0xf123f[_0x274f('0x39')][_0x274f('0x3d')]));_0x378a1a[_0x274f('0x3e')]=_0x378a1a[_0x274f('0x3e')][_0x274f('0x3f')]?_0x378a1a['attributes']:_0x5415f2['model'];if(!_0xf123f['query'][_0x274f('0x40')]('nolimit')){_0x378a1a[_0x274f('0x21')]=qs['limit'](_0xf123f['query'][_0x274f('0x21')]);_0x378a1a['offset']=qs[_0x274f('0x20')](_0xf123f[_0x274f('0x39')][_0x274f('0x20')]);}_0x378a1a[_0x274f('0x41')]=qs[_0x274f('0x42')](_0xf123f[_0x274f('0x39')][_0x274f('0x42')]);_0x378a1a[_0x274f('0x43')]=qs['filters'](_[_0x274f('0x44')](_0xf123f[_0x274f('0x39')],_0x5415f2[_0x274f('0x3b')]),_0x29b001);if(_0xf123f[_0x274f('0x39')][_0x274f('0x45')]){_0x378a1a[_0x274f('0x43')]=_[_0x274f('0x46')](_0x378a1a[_0x274f('0x43')],{'$or':_[_0x274f('0x33')](_0x29b001,function(_0x4f321b){if(_0x4f321b[_0x274f('0x36')]!==_0x274f('0x47')){var _0x28fb0a={};_0x28fb0a[_0x4f321b[_0x274f('0x30')]]={'$like':'%'+_0xf123f['query']['filter']+'%'};return _0x28fb0a;}})});}_0x378a1a=_[_0x274f('0x46')]({},_0x378a1a,_0xf123f[_0x274f('0x48')]);var _0x5a3ab0={'where':_0x378a1a[_0x274f('0x43')]};return db[_0x274f('0x49')]['count'](_0x5a3ab0)[_0x274f('0x2a')](function(_0x2e6229){_0x6dd7fb[_0x274f('0x23')]=_0x2e6229;if(_0xf123f[_0x274f('0x39')][_0x274f('0x4a')]){_0x378a1a[_0x274f('0x4b')]=[{'all':!![]}];}return db[_0x274f('0x49')][_0x274f('0x4c')](_0x378a1a);})[_0x274f('0x2a')](function(_0x53ca68){_0x6dd7fb[_0x274f('0x4d')]=_0x53ca68;return _0x6dd7fb;})[_0x274f('0x2a')](respondWithFilteredResult(_0xa4a4a0,_0x378a1a))[_0x274f('0x4e')](handleError(_0xa4a4a0,null));};exports[_0x274f('0x4f')]=function(_0x419e75,_0x5eefe4){var _0x3cbc9f={'raw':!![],'where':{'id':_0x419e75[_0x274f('0x50')]['id']}},_0x3f2726={};_0x3f2726[_0x274f('0x38')]=_[_0x274f('0x3a')](db[_0x274f('0x49')][_0x274f('0x34')]);_0x3f2726[_0x274f('0x39')]=_[_0x274f('0x3a')](_0x419e75[_0x274f('0x39')]);_0x3f2726[_0x274f('0x3b')]=_[_0x274f('0x3c')](_0x3f2726['model'],_0x3f2726['query']);_0x3cbc9f['attributes']=_['intersection'](_0x3f2726[_0x274f('0x38')],qs[_0x274f('0x3d')](_0x419e75[_0x274f('0x39')][_0x274f('0x3d')]));_0x3cbc9f[_0x274f('0x3e')]=_0x3cbc9f['attributes'][_0x274f('0x3f')]?_0x3cbc9f[_0x274f('0x3e')]:_0x3f2726[_0x274f('0x38')];if(_0x419e75[_0x274f('0x39')]['includeAll']){_0x3cbc9f['include']=[{'all':!![]}];}_0x3cbc9f=_[_0x274f('0x46')]({},_0x3cbc9f,_0x419e75['options']);return db[_0x274f('0x49')][_0x274f('0x51')](_0x3cbc9f)['then'](handleEntityNotFound(_0x5eefe4,null))[_0x274f('0x2a')](respondWithResult(_0x5eefe4,null))[_0x274f('0x4e')](handleError(_0x5eefe4,null));};exports['download']=function(_0x2d66c1,_0x940c14,_0x1432cd){return db[_0x274f('0x49')][_0x274f('0x51')]({'where':{'id':_0x2d66c1[_0x274f('0x50')]['id']},'attributes':[_0x274f('0x30'),_0x274f('0x6')],'raw':!![]})['then'](handleEntityNotFound(_0x940c14,null))[_0x274f('0x2a')](function(_0x3e2423){if(_0x3e2423){var _0x571c28=path['join'](config[_0x274f('0x52')],'server/files/plugins',util[_0x274f('0x53')](_0x274f('0x54'),path['basename'](_0x3e2423[_0x274f('0x6')])));var _0x137db0=fs[_0x274f('0x55')](_0x571c28);var _0xa335db=archiver('zip',{'zlib':{'level':0x9}});_0xa335db['on']('warning',function(_0x48fc5d){if(_0x48fc5d[_0x274f('0x56')]===_0x274f('0x57')){logger['error'](_0x48fc5d);}else{throw new db['Sequelize'][(_0x274f('0x58'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0xa335db['on'](_0x274f('0x2e'),function(_0x553db1){throw new db[(_0x274f('0x59'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0xa335db[_0x274f('0x5a')](_0x137db0);_0xa335db[_0x274f('0x5b')](_0x274f('0x5c'),{'cwd':path['join'](config['root'],'server/files/plugins',path[_0x274f('0x5d')](_0x3e2423['path'])),'ignore':[path[_0x274f('0x5e')](path[_0x274f('0x5f')](_0x3e2423[_0x274f('0x6')]),_0x274f('0x60')),path[_0x274f('0x5e')](path['basename'](_0x3e2423[_0x274f('0x6')]),_0x274f('0x61'))],'nodir':!![]})[_0x274f('0x62')]();_0x137db0['on']('close',function(){if(!fs[_0x274f('0x63')](_0x571c28)){throw new db['Sequelize']['Error']('Plugin\x20not\x20found');}return _0x940c14['download'](_0x571c28,util[_0x274f('0x53')](_0x274f('0x54'),path[_0x274f('0x5f')](_0x3e2423['path'])),function(_0x50ffbc){if(_0x50ffbc){throw new db[(_0x274f('0x59'))][(_0x274f('0x58'))](_0x274f('0x64'));}fs[_0x274f('0x65')](_0x571c28);logger['info'](_0x274f('0x66'));logger[_0x274f('0x67')](_0x274f('0x68'));});});}return null;})[_0x274f('0x4e')](handleError(_0x940c14,null));};exports[_0x274f('0x69')]=function(_0x239038,_0x338c48,_0x2b4e93){var _0x339245=path[_0x274f('0x5f')](_0x239038[_0x274f('0x6a')][_0x274f('0x6b')],path['extname'](_0x239038[_0x274f('0x6a')][_0x274f('0x6b')]));var _0x5f446e=path[_0x274f('0x5e')](config[_0x274f('0x52')],_0x274f('0x6c'),_0x239038[_0x274f('0x6a')][_0x274f('0x6b')]);var _0xfa0f9f=path[_0x274f('0x5e')](config[_0x274f('0x52')],'server/files/plugins',_0x339245);logger[_0x274f('0x67')](_0x274f('0x6d'),_0x5f446e);logger[_0x274f('0x67')](_0x274f('0x6e'),_0xfa0f9f);try{fs[_0x274f('0x6f')](_0x5f446e,parseInt('0777',0x8));extract(_0x5f446e,{'dir':_0xfa0f9f},function(_0x2cc6ed){if(_0x2cc6ed){logger['error'](_0x2cc6ed);handleError(_0x2cc6ed,!![]);};var _0x2438ac=fs['readdirSync'](_0xfa0f9f);if(_0x2438ac[_0x274f('0x3f')]>0x1){removeReferences(_0x5f446e,_0xfa0f9f);logger[_0x274f('0x2e')](_0x274f('0x70'));return _0x2b4e93(new Error(_0x274f('0x70')));}var _0x11ad40=fs[_0x274f('0x71')](path[_0x274f('0x5e')](_0xfa0f9f,_0x2438ac[0x0]));if(_0x11ad40[_0x274f('0x72')]()){removeReferences(_0x5f446e,_0xfa0f9f);logger[_0x274f('0x2e')](_0x274f('0x70'));return _0x2b4e93(new Error(_0x274f('0x70')));}if(_0x11ad40[_0x274f('0x73')]()){var _0xe39eb3=fs[_0x274f('0x74')](path[_0x274f('0x5e')](_0xfa0f9f,_0x2438ac[0x0]));if(_0xe39eb3[_0x274f('0x3f')]===0x0){removeReferences(_0x5f446e,_0xfa0f9f);logger['error']('Invalid\x20plugin\x20structure');return _0x2b4e93(new Error('Invalid\x20plugin\x20structure'));}var _0x2caa7a=_0xe39eb3[_0x274f('0x75')](function(_0x5464a3){return _0x5464a3===_0x274f('0x76');});if(!_0x2caa7a){return _0x2b4e93(new Error('Plugin\x20manifest\x20missing'));}var _0x93d53=fs[_0x274f('0x77')](path[_0x274f('0x5e')](_0xfa0f9f,_0x2438ac[0x0],_0x274f('0x76')));var _0x1cba00=JSON['parse'](_0x93d53);if('undefined'==typeof _0x1cba00['name']){return _0x2b4e93(new Error(_0x274f('0x78')));}if('undefined'==typeof _0x1cba00[_0x274f('0x36')]){return _0x2b4e93(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x274f('0x22')==typeof _0x1cba00[_0x274f('0x79')]){return _0x2b4e93(new Error(_0x274f('0x7a')));}if(_0x274f('0x22')==typeof _0x1cba00[_0x274f('0x7b')]){return _0x2b4e93(new Error(_0x274f('0x7c')));}if(_0x1cba00[_0x274f('0x36')]===_0x274f('0x7d')){if(_0x274f('0x22')==typeof _0x1cba00[_0x274f('0x7b')]['views']){return _0x2b4e93(new Error(_0x274f('0x7e')));}if(_0x274f('0x22')==typeof _0x1cba00[_0x274f('0x7b')]['views'][_0x274f('0x7f')]&&_0x274f('0x22')==typeof _0x1cba00[_0x274f('0x7b')]['views'][_0x274f('0x80')]){return _0x2b4e93(new Error(_0x274f('0x81')));}}else if(_0x1cba00[_0x274f('0x36')]===_0x274f('0x82')){if('undefined'==typeof _0x1cba00['parameters']['scriptName']){return _0x2b4e93(new Error(_0x274f('0x83')));}if(_0x274f('0x22')==typeof _0x1cba00[_0x274f('0x7b')]['scriptPath']){return _0x2b4e93(new Error(_0x274f('0x84')));}}else{return _0x2b4e93(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0xe6ba09=_0x1cba00['name'];var _0x426db2=_0x1cba00['description'];var _0x118813=_0x1cba00[_0x274f('0x36')];var _0x129ecf=_0x1cba00['sidebar']?_0x1cba00['sidebar']:_0x274f('0x85');var _0x2ac1cb=_0x1cba00[_0x274f('0x86')]?_0x1cba00[_0x274f('0x86')]:_0x274f('0x87');var _0x348fab='';var _0x224092='';var _0x32edb9='';var _0x2cc49f='';var _0x328628=_0x1cba00[_0x274f('0x79')];if(_0x118813===_0x274f('0x7d')){if('undefined'!=typeof _0x1cba00[_0x274f('0x7b')][_0x274f('0x88')][_0x274f('0x7f')]){var _0x5e0d82=_0x1cba00['parameters']['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x274f('0x89')](_0x5e0d82)){_0x348fab=path['join']('plugins',_0x339245,_0x2438ac[0x0],_0x5e0d82);}else{_0x348fab=_0x5e0d82;}}else{logger[_0x274f('0x67')](_0x274f('0x8a'));}if(_0x274f('0x22')!=typeof _0x1cba00[_0x274f('0x7b')]['views']['agent']){var _0x5c4f94=_0x1cba00[_0x274f('0x7b')][_0x274f('0x88')][_0x274f('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x274f('0x89')](_0x5c4f94)){_0x224092=path[_0x274f('0x5e')](_0x274f('0x8b'),_0x339245,_0x2438ac[0x0],_0x5c4f94);}else{_0x224092=_0x5c4f94;}}else{logger[_0x274f('0x67')](_0x274f('0x8c'));}}else if(_0x118813===_0x274f('0x82')){_0x32edb9=_0x1cba00['parameters'][_0x274f('0x8d')];_0x2cc49f=_0x1cba00[_0x274f('0x7b')]['scriptPath'];if(_0x274f('0x22')!=typeof _0x1cba00[_0x274f('0x7b')][_0x274f('0x88')]){if('undefined'!=typeof _0x1cba00[_0x274f('0x7b')][_0x274f('0x88')][_0x274f('0x7f')]){var _0x5e0d82=_0x1cba00['parameters'][_0x274f('0x88')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x5e0d82)){_0x348fab=path[_0x274f('0x5e')]('plugins',_0x339245,_0x2438ac[0x0],_0x5e0d82);}else{_0x348fab=_0x5e0d82;}}if(_0x274f('0x22')!=typeof _0x1cba00[_0x274f('0x7b')][_0x274f('0x88')][_0x274f('0x80')]){var _0x5c4f94=_0x1cba00[_0x274f('0x7b')][_0x274f('0x88')][_0x274f('0x80')];if(!/^(f|ht)tps?:\/\//i['test'](_0x5c4f94)){_0x224092=path['join']('plugins',_0x339245,_0x2438ac[0x0],_0x5c4f94);}else{_0x224092=_0x5c4f94;}}}}var _0x4118b2={'name':_0xe6ba09,'description':_0x426db2,'path':path[_0x274f('0x5e')](_0x339245,_0x2438ac[0x0]),'type':_0x118813,'sidebar':_0x129ecf,'icon':_0x2ac1cb,'adminUrl':_0x348fab,'agentUrl':_0x224092,'scriptName':_0x32edb9,'scriptPath':_0x2cc49f,'version':_0x328628};removeReferences(_0x5f446e,null);return db[_0x274f('0x49')][_0x274f('0x8e')](_0x4118b2)[_0x274f('0x2a')](function(_0x200c8e){var _0x40833f={'role':_0x239038[_0x274f('0x8f')][_0x274f('0x90')],'userProfileId':_0x239038['body'][_0x274f('0x91')]};if(!_0x40833f)throw new Error(_0x274f('0x92'));if(_0x40833f[_0x274f('0x90')]===_0x274f('0x93')){var _0x5a24a1=_0x200c8e['get']({'plain':!![]});return db[_0x274f('0x94')]['find']({'where':{'name':'Plugins','userProfileId':_0x40833f[_0x274f('0x91')]},'raw':!![]})[_0x274f('0x2a')](function(_0x46ad1c){if(_0x46ad1c&&_0x46ad1c[_0x274f('0x95')]===0x0){return db['UserProfileResource'][_0x274f('0x8e')]({'name':_0x5a24a1['name'],'resourceId':_0x5a24a1['id'],'type':_0x46ad1c[_0x274f('0x30')],'sectionId':_0x46ad1c['id']},{})[_0x274f('0x2a')](function(){return _0x200c8e;});}else{return _0x200c8e;}})[_0x274f('0x4e')](function(_0x35e56b){logger[_0x274f('0x2e')](_0x274f('0x96'),_0x35e56b);throw _0x35e56b;});}return _0x200c8e;})['then'](respondWithResult(_0x338c48,null))[_0x274f('0x4e')](handleError(_0x338c48,null));}});}catch(_0x177548){_0x338c48[_0x274f('0x1f')](0x1f4)[_0x274f('0x31')](_0x177548);}};function removeReferences(_0x399fc8,_0x91506){try{if(_0x399fc8){fs[_0x274f('0x65')](_0x399fc8);logger[_0x274f('0x67')](_0x274f('0x97'));}if(_0x91506){rimraf(_0x91506,function(){});logger['info'](_0x274f('0x98'));}}catch(_0x317d6b){logger[_0x274f('0x2e')](_0x317d6b);}}exports[_0x274f('0x29')]=function(_0x1e8804,_0x5611c5,_0x430469){return db[_0x274f('0x49')][_0x274f('0x51')]({'where':{'id':_0x1e8804[_0x274f('0x50')]['id']}})['then'](handleEntityNotFound(_0x5611c5,null))[_0x274f('0x2a')](saveUpdates(_0x1e8804[_0x274f('0x8f')],null))[_0x274f('0x2a')](respondWithResult(_0x5611c5,null))[_0x274f('0x4e')](handleError(_0x5611c5,null));};exports[_0x274f('0x99')]=function(_0x3c3152,_0x157a3a,_0x71aabd){return db[_0x274f('0x49')][_0x274f('0x51')]({'where':{'id':_0x3c3152['params']['id']}})[_0x274f('0x2a')](function(_0x14b268){if(_0x14b268){return _0x14b268[_0x274f('0x2b')]();}})[_0x274f('0x2a')](function(_0xa576e1){rimraf(path[_0x274f('0x5e')](config['root'],_0x274f('0x6c'),path[_0x274f('0x5d')](_0xa576e1['path'])),function(){});return _0xa576e1;})['then'](handleEntityNotFound(_0x157a3a,null))[_0x274f('0x2a')](respondWithStatusCode(_0x157a3a,null))[_0x274f('0x4e')](handleError(_0x157a3a,null));};exports[_0x274f('0x9a')]=function(_0xf37107,_0x302182,_0x4ddfa5){return BPromise[_0x274f('0x9b')]()[_0x274f('0x2a')](function(){if(!_0xf37107[_0x274f('0x39')][_0x274f('0x6')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0xf37107[_0x274f('0x39')][_0x274f('0x9c')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x2a0620=_0xf37107[_0x274f('0x39')]['hostname']?_0xf37107[_0x274f('0x39')][_0x274f('0x9d')]+':'+_0xf37107[_0x274f('0x39')][_0x274f('0x9c')]:'http://localhost:'+_0xf37107['query'][_0x274f('0x9c')];var _0x564bde=_0xf37107[_0x274f('0x39')][_0x274f('0x25')]?_0xf37107[_0x274f('0x39')][_0x274f('0x25')]:!![];var _0xf253bd=_0xf37107[_0x274f('0x39')][_0x274f('0x9e')]?_0xf37107[_0x274f('0x39')][_0x274f('0x9e')]:null;var _0x68fb3e={'method':_0xf37107[_0x274f('0x9f')],'uri':util['format'](_0x274f('0xa0'),_0x2a0620,_0xf37107[_0x274f('0x39')]['path']),'json':_0x564bde,'resolveWithFullResponse':!![],'encoding':_0xf253bd,'qs':_0xf37107[_0x274f('0x39')]};if(_0xf37107[_0x274f('0xa1')]){_0x68fb3e[_0x274f('0xa1')]=_0xf37107['headers'];if(_0x68fb3e[_0x274f('0xa1')]['content-length']){delete _0x68fb3e['headers']['content-length'];}}if(_0x68fb3e[_0x274f('0xa1')][_0x274f('0xa2')]){delete _0x68fb3e[_0x274f('0xa1')][_0x274f('0xa2')];}return rp(_0x68fb3e);})[_0x274f('0x2a')](function(_0x1efc00){if(_0x1efc00){_0x302182[_0x274f('0x24')](_0x1efc00[_0x274f('0xa1')]);logger['info'](_0x1efc00[_0x274f('0x8f')]);if(_['endsWith'](_0xf37107[_0x274f('0x39')][_0x274f('0x6')],_0x274f('0xa3'))&&_0x1efc00[_0x274f('0xa4')]==0x1f4){return _0x302182['sendStatus'](_0x1efc00[_0x274f('0xa4')]);}else{return _0x302182[_0x274f('0x1f')](_0x1efc00[_0x274f('0xa4')])[_0x274f('0x31')](_0x1efc00[_0x274f('0x8f')]);}}else{return _0x302182[_0x274f('0x1d')](0xc8);}})['catch'](handleError(_0x302182,null));};exports[_0x274f('0xa5')]=function(_0x471314,_0x2636ee,_0x2657dc){return BPromise[_0x274f('0x9b')]()[_0x274f('0x2a')](function(){if(!_0x471314[_0x274f('0x39')]['path']){throw new Error(_0x274f('0xa6'));}if(!_0x471314[_0x274f('0x39')]['port']){throw new Error(_0x274f('0xa7'));}var _0xfedee2=_0x471314[_0x274f('0x39')][_0x274f('0x9d')]?_0x471314[_0x274f('0x39')]['hostname']+':'+_0x471314[_0x274f('0x39')][_0x274f('0x9c')]:_0x274f('0xa8')+_0x471314[_0x274f('0x39')][_0x274f('0x9c')];var _0x34698b=_0x471314[_0x274f('0x39')]['json']?_0x471314[_0x274f('0x39')]['json']:!![];var _0x2c3c16=_0x471314[_0x274f('0x39')][_0x274f('0x9e')]?_0x471314['query'][_0x274f('0x9e')]:null;var _0x2e9e45={'method':_0x471314[_0x274f('0x9f')],'uri':util[_0x274f('0x53')](_0x274f('0xa0'),_0xfedee2,_0x471314[_0x274f('0x39')][_0x274f('0x6')]),'json':_0x34698b,'resolveWithFullResponse':!![],'encoding':_0x2c3c16,'body':_0x471314[_0x274f('0x8f')]};if(_0x471314['headers']){_0x2e9e45[_0x274f('0xa1')]=_0x471314['headers'];if(_0x2e9e45[_0x274f('0xa1')]['content-length']){delete _0x2e9e45[_0x274f('0xa1')][_0x274f('0xa9')];}}if(_0x2e9e45['headers'][_0x274f('0xa2')]){delete _0x2e9e45[_0x274f('0xa1')][_0x274f('0xa2')];}return rp(_0x2e9e45);})['then'](function(_0x1b0450){if(_0x1b0450){_0x2636ee[_0x274f('0x24')](_0x1b0450[_0x274f('0xa1')]);logger[_0x274f('0x67')](_0x1b0450[_0x274f('0x8f')]);return _0x2636ee['status'](_0x1b0450[_0x274f('0xa4')])[_0x274f('0x31')](_0x1b0450['body']);}else{return _0x2636ee[_0x274f('0x1d')](0xc8);}})[_0x274f('0x4e')](handleError(_0x2636ee,null));}; \ No newline at end of file +var _0x908c=['send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','where','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','include','options','find','join','root','format','%s.zip','warning','ENOENT','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','server/files/plugins','basename','finalize','close','existsSync','download','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','extname','file','filename','Plugin\x20upload\x20filepath:\x20%s','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','some','manifest.json','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20views\x20missing','admin','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon-apps','html','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Plugins','autoAssociation','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','params','body','delete','dirname','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','statusCode','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','name'];(function(_0x2d91c6,_0x10ae0e){var _0x3a8d19=function(_0x27a3ce){while(--_0x27a3ce){_0x2d91c6['push'](_0x2d91c6['shift']());}};_0x3a8d19(++_0x10ae0e);}(_0x908c,0x11b));var _0xc908=function(_0x436bde,_0x4009e9){_0x436bde=_0x436bde-0x0;var _0x3d5075=_0x908c[_0x436bde];return _0x3d5075;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc908('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc908('0x1'));var rp=require(_0xc908('0x2'));var moment=require(_0xc908('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc908('0x4'));var util=require(_0xc908('0x5'));var path=require(_0xc908('0x6'));var sox=require('sox');var csv=require(_0xc908('0x7'));var ejs=require(_0xc908('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc908('0x9'));var squel=require(_0xc908('0xa'));var crypto=require(_0xc908('0xb'));var jsforce=require(_0xc908('0xc'));var deskjs=require(_0xc908('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc908('0xe'));var extract=require(_0xc908('0xf'));var rimraf=require('rimraf');var archiver=require(_0xc908('0x10'));var Redis=require(_0xc908('0x11'));var authService=require(_0xc908('0x12'));var qs=require(_0xc908('0x13'));var as=require(_0xc908('0x14'));var hardwareService=require(_0xc908('0x15'));var logger=require(_0xc908('0x16'))('api');var utils=require(_0xc908('0x17'));var config=require(_0xc908('0x18'));var licenseUtil=require(_0xc908('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc908('0x1a')](config[_0xc908('0x1b')],{'host':_0xc908('0x1c'),'port':0x18eb});var socket=require(_0xc908('0x1d'))(new Redis(config[_0xc908('0x1b')]));require(_0xc908('0x1e'))[_0xc908('0x1f')](socket);function respondWithStatusCode(_0x2f27d0,_0x15d4b3){_0x15d4b3=_0x15d4b3||0xcc;return function(_0x4ca1e0){if(_0x4ca1e0){return _0x2f27d0[_0xc908('0x20')](_0x15d4b3);}return _0x2f27d0[_0xc908('0x21')](_0x15d4b3)['end']();};}function respondWithResult(_0x1f48d2,_0x3159c7){_0x3159c7=_0x3159c7||0xc8;return function(_0xbc85d5){if(_0xbc85d5){return _0x1f48d2[_0xc908('0x21')](_0x3159c7)[_0xc908('0x22')](_0xbc85d5);}};}function respondWithFilteredResult(_0x213b58,_0x49571a){return function(_0x58aa1e){if(_0x58aa1e){var _0x1f5460=typeof _0x49571a['offset']===_0xc908('0x23')&&typeof _0x49571a[_0xc908('0x24')]===_0xc908('0x23');var _0x5f3ec7=_0x58aa1e['count'];var _0x2d5046=_0x1f5460?0x0:_0x49571a['offset'];var _0x2d5df1=_0x1f5460?_0x58aa1e[_0xc908('0x25')]:_0x49571a[_0xc908('0x26')]+_0x49571a[_0xc908('0x24')];var _0xc0ff59;if(_0x2d5df1>=_0x5f3ec7){_0x2d5df1=_0x5f3ec7;_0xc0ff59=0xc8;}else{_0xc0ff59=0xce;}_0x213b58[_0xc908('0x21')](_0xc0ff59);return _0x213b58[_0xc908('0x27')](_0xc908('0x28'),_0x2d5046+'-'+_0x2d5df1+'/'+_0x5f3ec7)[_0xc908('0x22')](_0x58aa1e);}return null;};}function patchUpdates(_0x22d5bf){return function(_0xb76310){try{jsonpatch[_0xc908('0x29')](_0xb76310,_0x22d5bf,!![]);}catch(_0x30d450){return BPromise[_0xc908('0x2a')](_0x30d450);}return _0xb76310[_0xc908('0x2b')]();};}function saveUpdates(_0x313fbc,_0x586718){return function(_0x1f4dc9){if(_0x1f4dc9){return _0x1f4dc9[_0xc908('0x2c')](_0x313fbc)[_0xc908('0x2d')](function(_0x29ddfe){return _0x29ddfe;});}return null;};}function removeEntity(_0x1ee8d6,_0x152ff9){return function(_0x2e1172){if(_0x2e1172){return _0x2e1172[_0xc908('0x2e')]()[_0xc908('0x2d')](function(){var _0x32dc78=_0x2e1172['get']({'plain':!![]});var _0xac507b='Plugins';return db[_0xc908('0x2f')]['destroy']({'where':{'type':_0xac507b,'resourceId':_0x32dc78['id']}})[_0xc908('0x2d')](function(){return _0x2e1172;});})['then'](function(){_0x1ee8d6[_0xc908('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2eefb3,_0x23af37){return function(_0x493e61){if(!_0x493e61){_0x2eefb3['sendStatus'](0x194);}return _0x493e61;};}function handleError(_0x4a9228,_0x59a190){_0x59a190=_0x59a190||0x1f4;return function(_0x265a66){logger['error'](_0x265a66['stack']);if(_0x265a66[_0xc908('0x30')]){delete _0x265a66[_0xc908('0x30')];}_0x4a9228[_0xc908('0x21')](_0x59a190)[_0xc908('0x31')](_0x265a66);};}exports[_0xc908('0x32')]=function(_0x5edd90,_0x4ab231){var _0x4c55b9={},_0x3b553f={},_0x4d92d8={'count':0x0,'rows':[]};var _0x167655=_[_0xc908('0x33')](db[_0xc908('0x34')][_0xc908('0x35')],function(_0xb9ba7c){return{'name':_0xb9ba7c[_0xc908('0x36')],'type':_0xb9ba7c[_0xc908('0x37')][_0xc908('0x38')]};});_0x3b553f[_0xc908('0x39')]=_['map'](_0x167655,'name');_0x3b553f[_0xc908('0x3a')]=_[_0xc908('0x3b')](_0x5edd90[_0xc908('0x3a')]);_0x3b553f[_0xc908('0x3c')]=_[_0xc908('0x3d')](_0x3b553f['model'],_0x3b553f[_0xc908('0x3a')]);_0x4c55b9[_0xc908('0x3e')]=_['intersection'](_0x3b553f[_0xc908('0x39')],qs['fields'](_0x5edd90[_0xc908('0x3a')][_0xc908('0x3f')]));_0x4c55b9['attributes']=_0x4c55b9[_0xc908('0x3e')][_0xc908('0x40')]?_0x4c55b9[_0xc908('0x3e')]:_0x3b553f['model'];if(!_0x5edd90[_0xc908('0x3a')][_0xc908('0x41')](_0xc908('0x42'))){_0x4c55b9['limit']=qs[_0xc908('0x24')](_0x5edd90['query'][_0xc908('0x24')]);_0x4c55b9['offset']=qs[_0xc908('0x26')](_0x5edd90[_0xc908('0x3a')]['offset']);}_0x4c55b9[_0xc908('0x43')]=qs['sort'](_0x5edd90['query']['sort']);_0x4c55b9['where']=qs['filters'](_[_0xc908('0x44')](_0x5edd90[_0xc908('0x3a')],_0x3b553f[_0xc908('0x3c')]),_0x167655);if(_0x5edd90[_0xc908('0x3a')]['filter']){_0x4c55b9[_0xc908('0x45')]=_[_0xc908('0x46')](_0x4c55b9[_0xc908('0x45')],{'$or':_[_0xc908('0x33')](_0x167655,function(_0x16e3d5){if(_0x16e3d5[_0xc908('0x37')]!==_0xc908('0x47')){var _0x1fd52a={};_0x1fd52a[_0x16e3d5[_0xc908('0x30')]]={'$like':'%'+_0x5edd90[_0xc908('0x3a')][_0xc908('0x48')]+'%'};return _0x1fd52a;}})});}_0x4c55b9=_['merge']({},_0x4c55b9,_0x5edd90['options']);var _0x30a147={'where':_0x4c55b9['where']};return db[_0xc908('0x34')][_0xc908('0x25')](_0x30a147)['then'](function(_0x2ff4fd){_0x4d92d8[_0xc908('0x25')]=_0x2ff4fd;if(_0x5edd90[_0xc908('0x3a')][_0xc908('0x49')]){_0x4c55b9['include']=[{'all':!![]}];}return db[_0xc908('0x34')][_0xc908('0x4a')](_0x4c55b9);})[_0xc908('0x2d')](function(_0x523a80){_0x4d92d8[_0xc908('0x4b')]=_0x523a80;return _0x4d92d8;})[_0xc908('0x2d')](respondWithFilteredResult(_0x4ab231,_0x4c55b9))[_0xc908('0x4c')](handleError(_0x4ab231,null));};exports[_0xc908('0x4d')]=function(_0x47271b,_0x109df8){var _0x553322={'raw':!![],'where':{'id':_0x47271b['params']['id']}},_0x1ea77d={};_0x1ea77d[_0xc908('0x39')]=_['keys'](db[_0xc908('0x34')][_0xc908('0x35')]);_0x1ea77d[_0xc908('0x3a')]=_[_0xc908('0x3b')](_0x47271b[_0xc908('0x3a')]);_0x1ea77d[_0xc908('0x3c')]=_[_0xc908('0x3d')](_0x1ea77d['model'],_0x1ea77d[_0xc908('0x3a')]);_0x553322['attributes']=_[_0xc908('0x3d')](_0x1ea77d['model'],qs[_0xc908('0x3f')](_0x47271b[_0xc908('0x3a')]['fields']));_0x553322['attributes']=_0x553322['attributes'][_0xc908('0x40')]?_0x553322[_0xc908('0x3e')]:_0x1ea77d[_0xc908('0x39')];if(_0x47271b[_0xc908('0x3a')][_0xc908('0x49')]){_0x553322[_0xc908('0x4e')]=[{'all':!![]}];}_0x553322=_[_0xc908('0x46')]({},_0x553322,_0x47271b[_0xc908('0x4f')]);return db[_0xc908('0x34')]['find'](_0x553322)[_0xc908('0x2d')](handleEntityNotFound(_0x109df8,null))[_0xc908('0x2d')](respondWithResult(_0x109df8,null))['catch'](handleError(_0x109df8,null));};exports['download']=function(_0x481102,_0x2e1448,_0x412b75){return db['Plugin'][_0xc908('0x50')]({'where':{'id':_0x481102['params']['id']},'attributes':[_0xc908('0x30'),_0xc908('0x6')],'raw':!![]})[_0xc908('0x2d')](handleEntityNotFound(_0x2e1448,null))[_0xc908('0x2d')](function(_0x4b6b69){if(_0x4b6b69){var _0x21794b=path[_0xc908('0x51')](config[_0xc908('0x52')],'server/files/plugins',util[_0xc908('0x53')](_0xc908('0x54'),path['basename'](_0x4b6b69[_0xc908('0x6')])));var _0x3f0d91=fs['createWriteStream'](_0x21794b);var _0x74495b=archiver('zip',{'zlib':{'level':0x9}});_0x74495b['on'](_0xc908('0x55'),function(_0x10eca9){if(_0x10eca9['code']===_0xc908('0x56')){logger[_0xc908('0x57')](_0x10eca9);}else{throw new db[(_0xc908('0x58'))][(_0xc908('0x59'))](_0xc908('0x5a'));}});_0x74495b['on'](_0xc908('0x57'),function(_0x2c751e){throw new db[(_0xc908('0x58'))][(_0xc908('0x59'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x74495b[_0xc908('0x5b')](_0x3f0d91);_0x74495b[_0xc908('0x5c')](_0xc908('0x5d'),{'cwd':path[_0xc908('0x51')](config[_0xc908('0x52')],_0xc908('0x5e'),path['dirname'](_0x4b6b69[_0xc908('0x6')])),'ignore':[path[_0xc908('0x51')](path[_0xc908('0x5f')](_0x4b6b69[_0xc908('0x6')]),'node_modules/**/*'),path[_0xc908('0x51')](path[_0xc908('0x5f')](_0x4b6b69[_0xc908('0x6')]),'attachments/**/*')],'nodir':!![]})[_0xc908('0x60')]();_0x3f0d91['on'](_0xc908('0x61'),function(){if(!fs[_0xc908('0x62')](_0x21794b)){throw new db[(_0xc908('0x58'))]['Error']('Plugin\x20not\x20found');}return _0x2e1448[_0xc908('0x63')](_0x21794b,util[_0xc908('0x53')](_0xc908('0x54'),path[_0xc908('0x5f')](_0x4b6b69[_0xc908('0x6')])),function(_0x8e4116){if(_0x8e4116){throw new db['Sequelize']['Error']('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xc908('0x64')](_0x21794b);logger[_0xc908('0x65')](_0xc908('0x66'));logger['info'](_0xc908('0x67'));});});}return null;})[_0xc908('0x4c')](handleError(_0x2e1448,null));};exports['upload']=function(_0x1c26ff,_0x1597e7,_0x4567e9){var _0x15da8f=path['basename'](_0x1c26ff['file']['filename'],path[_0xc908('0x68')](_0x1c26ff[_0xc908('0x69')][_0xc908('0x6a')]));var _0x40383b=path['join'](config[_0xc908('0x52')],_0xc908('0x5e'),_0x1c26ff[_0xc908('0x69')][_0xc908('0x6a')]);var _0x357572=path[_0xc908('0x51')](config['root'],_0xc908('0x5e'),_0x15da8f);logger[_0xc908('0x65')](_0xc908('0x6b'),_0x40383b);logger[_0xc908('0x65')]('Plugin\x20upload\x20destination:\x20%s',_0x357572);try{fs['chmodSync'](_0x40383b,parseInt('0777',0x8));extract(_0x40383b,{'dir':_0x357572},function(_0x7172f2){if(_0x7172f2){logger[_0xc908('0x57')](_0x7172f2);handleError(_0x7172f2,!![]);};var _0xdcc97b=fs[_0xc908('0x6c')](_0x357572);if(_0xdcc97b[_0xc908('0x40')]>0x1){removeReferences(_0x40383b,_0x357572);logger[_0xc908('0x57')](_0xc908('0x6d'));return _0x4567e9(new Error(_0xc908('0x6d')));}var _0x316f14=fs[_0xc908('0x6e')](path['join'](_0x357572,_0xdcc97b[0x0]));if(_0x316f14[_0xc908('0x6f')]()){removeReferences(_0x40383b,_0x357572);logger['error'](_0xc908('0x6d'));return _0x4567e9(new Error(_0xc908('0x6d')));}if(_0x316f14['isDirectory']()){var _0x426c1c=fs[_0xc908('0x6c')](path['join'](_0x357572,_0xdcc97b[0x0]));if(_0x426c1c[_0xc908('0x40')]===0x0){removeReferences(_0x40383b,_0x357572);logger['error'](_0xc908('0x6d'));return _0x4567e9(new Error(_0xc908('0x6d')));}var _0x4457f9=_0x426c1c[_0xc908('0x70')](function(_0x433e79){return _0x433e79===_0xc908('0x71');});if(!_0x4457f9){return _0x4567e9(new Error('Plugin\x20manifest\x20missing'));}var _0x4c6c15=fs[_0xc908('0x72')](path[_0xc908('0x51')](_0x357572,_0xdcc97b[0x0],_0xc908('0x71')));var _0x7e1f33=JSON['parse'](_0x4c6c15);if(_0xc908('0x23')==typeof _0x7e1f33[_0xc908('0x30')]){return _0x4567e9(new Error(_0xc908('0x73')));}if('undefined'==typeof _0x7e1f33['type']){return _0x4567e9(new Error(_0xc908('0x74')));}if(_0xc908('0x23')==typeof _0x7e1f33[_0xc908('0x75')]){return _0x4567e9(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xc908('0x23')==typeof _0x7e1f33['parameters']){return _0x4567e9(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x7e1f33[_0xc908('0x37')]==='html'){if(_0xc908('0x23')==typeof _0x7e1f33[_0xc908('0x76')]['views']){return _0x4567e9(new Error(_0xc908('0x77')));}if(_0xc908('0x23')==typeof _0x7e1f33[_0xc908('0x76')]['views'][_0xc908('0x78')]&&_0xc908('0x23')==typeof _0x7e1f33['parameters'][_0xc908('0x79')][_0xc908('0x7a')]){return _0x4567e9(new Error(_0xc908('0x7b')));}}else if(_0x7e1f33[_0xc908('0x37')]==='script'){if('undefined'==typeof _0x7e1f33[_0xc908('0x76')][_0xc908('0x7c')]){return _0x4567e9(new Error(_0xc908('0x7d')));}if(_0xc908('0x23')==typeof _0x7e1f33[_0xc908('0x76')][_0xc908('0x7e')]){return _0x4567e9(new Error(_0xc908('0x7f')));}}else{return _0x4567e9(new Error(_0xc908('0x80')));}var _0xc63bbc=_0x7e1f33['name'];var _0x22cf8b=_0x7e1f33[_0xc908('0x81')];var _0xccbffe=_0x7e1f33[_0xc908('0x37')];var _0x315fee=_0x7e1f33[_0xc908('0x82')]?_0x7e1f33['sidebar']:_0xc908('0x83');var _0x1b5a89=_0x7e1f33['icon']?_0x7e1f33['icon']:_0xc908('0x84');var _0x28370f='';var _0x580215='';var _0x137b0a='';var _0x5355a6='';var _0x23ee8f=_0x7e1f33[_0xc908('0x75')];if(_0xccbffe===_0xc908('0x85')){if(_0xc908('0x23')!=typeof _0x7e1f33[_0xc908('0x76')][_0xc908('0x79')][_0xc908('0x78')]){var _0x58f7e0=_0x7e1f33[_0xc908('0x76')][_0xc908('0x79')][_0xc908('0x78')];if(!/^(f|ht)tps?:\/\//i[_0xc908('0x86')](_0x58f7e0)){_0x28370f=path['join']('plugins',_0x15da8f,_0xdcc97b[0x0],_0x58f7e0);}else{_0x28370f=_0x58f7e0;}}else{logger['info'](_0xc908('0x87'));}if(_0xc908('0x23')!=typeof _0x7e1f33[_0xc908('0x76')][_0xc908('0x79')][_0xc908('0x7a')]){var _0x2db1bc=_0x7e1f33[_0xc908('0x76')][_0xc908('0x79')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x2db1bc)){_0x580215=path[_0xc908('0x51')](_0xc908('0x88'),_0x15da8f,_0xdcc97b[0x0],_0x2db1bc);}else{_0x580215=_0x2db1bc;}}else{logger[_0xc908('0x65')](_0xc908('0x89'));}}else if(_0xccbffe==='script'){_0x137b0a=_0x7e1f33['parameters']['scriptName'];_0x5355a6=_0x7e1f33[_0xc908('0x76')]['scriptPath'];if(_0xc908('0x23')!=typeof _0x7e1f33[_0xc908('0x76')][_0xc908('0x79')]){if('undefined'!=typeof _0x7e1f33[_0xc908('0x76')][_0xc908('0x79')][_0xc908('0x78')]){var _0x58f7e0=_0x7e1f33['parameters'][_0xc908('0x79')][_0xc908('0x78')];if(!/^(f|ht)tps?:\/\//i[_0xc908('0x86')](_0x58f7e0)){_0x28370f=path[_0xc908('0x51')]('plugins',_0x15da8f,_0xdcc97b[0x0],_0x58f7e0);}else{_0x28370f=_0x58f7e0;}}if(_0xc908('0x23')!=typeof _0x7e1f33[_0xc908('0x76')][_0xc908('0x79')]['agent']){var _0x2db1bc=_0x7e1f33[_0xc908('0x76')]['views'][_0xc908('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0xc908('0x86')](_0x2db1bc)){_0x580215=path['join'](_0xc908('0x88'),_0x15da8f,_0xdcc97b[0x0],_0x2db1bc);}else{_0x580215=_0x2db1bc;}}}}var _0x26cacb={'name':_0xc63bbc,'description':_0x22cf8b,'path':path['join'](_0x15da8f,_0xdcc97b[0x0]),'type':_0xccbffe,'sidebar':_0x315fee,'icon':_0x1b5a89,'adminUrl':_0x28370f,'agentUrl':_0x580215,'scriptName':_0x137b0a,'scriptPath':_0x5355a6,'version':_0x23ee8f};removeReferences(_0x40383b,null);return db[_0xc908('0x34')][_0xc908('0x8a')](_0x26cacb)[_0xc908('0x2d')](function(_0x1f2476){var _0x24bcb6={'role':_0x1c26ff['body'][_0xc908('0x8b')],'userProfileId':_0x1c26ff['body'][_0xc908('0x8c')]};if(!_0x24bcb6)throw new Error(_0xc908('0x8d'));if(_0x24bcb6[_0xc908('0x8b')]===_0xc908('0x8e')){var _0x59072f=_0x1f2476['get']({'plain':!![]});return db[_0xc908('0x8f')]['find']({'where':{'name':_0xc908('0x90'),'userProfileId':_0x24bcb6[_0xc908('0x8c')]},'raw':!![]})[_0xc908('0x2d')](function(_0x1ac26d){if(_0x1ac26d&&_0x1ac26d[_0xc908('0x91')]===0x0){return db[_0xc908('0x2f')][_0xc908('0x8a')]({'name':_0x59072f['name'],'resourceId':_0x59072f['id'],'type':_0x1ac26d[_0xc908('0x30')],'sectionId':_0x1ac26d['id']},{})[_0xc908('0x2d')](function(){return _0x1f2476;});}else{return _0x1f2476;}})[_0xc908('0x4c')](function(_0x3d5fd6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d5fd6);throw _0x3d5fd6;});}return _0x1f2476;})['then'](respondWithResult(_0x1597e7,null))[_0xc908('0x4c')](handleError(_0x1597e7,null));}});}catch(_0x35c7d2){_0x1597e7[_0xc908('0x21')](0x1f4)[_0xc908('0x31')](_0x35c7d2);}};function removeReferences(_0x258da7,_0x1678ba){try{if(_0x258da7){fs[_0xc908('0x64')](_0x258da7);logger[_0xc908('0x65')](_0xc908('0x92'));}if(_0x1678ba){rimraf(_0x1678ba,function(){});logger['info'](_0xc908('0x93'));}}catch(_0x185f50){logger['error'](_0x185f50);}}exports[_0xc908('0x2c')]=function(_0x5b8ded,_0x13c96c,_0x3ec146){return db[_0xc908('0x34')]['find']({'where':{'id':_0x5b8ded[_0xc908('0x94')]['id']}})[_0xc908('0x2d')](handleEntityNotFound(_0x13c96c,null))['then'](saveUpdates(_0x5b8ded[_0xc908('0x95')],null))['then'](respondWithResult(_0x13c96c,null))[_0xc908('0x4c')](handleError(_0x13c96c,null));};exports[_0xc908('0x96')]=function(_0xcf8bc4,_0x52de43,_0xe65702){return db[_0xc908('0x34')]['find']({'where':{'id':_0xcf8bc4[_0xc908('0x94')]['id']}})[_0xc908('0x2d')](function(_0x1bce15){if(_0x1bce15){return _0x1bce15[_0xc908('0x2e')]();}})[_0xc908('0x2d')](function(_0x49c06d){rimraf(path[_0xc908('0x51')](config['root'],_0xc908('0x5e'),path[_0xc908('0x97')](_0x49c06d[_0xc908('0x6')])),function(){});return _0x49c06d;})[_0xc908('0x2d')](handleEntityNotFound(_0x52de43,null))[_0xc908('0x2d')](respondWithStatusCode(_0x52de43,null))[_0xc908('0x4c')](handleError(_0x52de43,null));};exports[_0xc908('0x98')]=function(_0x2aabe4,_0x54cd22,_0x27f7a1){return BPromise[_0xc908('0x99')]()['then'](function(){if(!_0x2aabe4['query'][_0xc908('0x6')]){throw new Error(_0xc908('0x9a'));}if(!_0x2aabe4[_0xc908('0x3a')][_0xc908('0x9b')]){throw new Error(_0xc908('0x9c'));}var _0x6481c1=_0x2aabe4[_0xc908('0x3a')][_0xc908('0x9d')]?_0x2aabe4[_0xc908('0x3a')][_0xc908('0x9d')]+':'+_0x2aabe4[_0xc908('0x3a')][_0xc908('0x9b')]:_0xc908('0x9e')+_0x2aabe4[_0xc908('0x3a')]['port'];var _0x1c25a7=_0x2aabe4[_0xc908('0x3a')][_0xc908('0x22')]?_0x2aabe4[_0xc908('0x3a')][_0xc908('0x22')]:!![];var _0x25bbaa=_0x2aabe4[_0xc908('0x3a')][_0xc908('0x9f')]?_0x2aabe4[_0xc908('0x3a')][_0xc908('0x9f')]:null;var _0x7af809={'method':_0x2aabe4[_0xc908('0xa0')],'uri':util[_0xc908('0x53')](_0xc908('0xa1'),_0x6481c1,_0x2aabe4[_0xc908('0x3a')][_0xc908('0x6')]),'json':_0x1c25a7,'resolveWithFullResponse':!![],'encoding':_0x25bbaa,'qs':_0x2aabe4[_0xc908('0x3a')]};if(_0x2aabe4[_0xc908('0xa2')]){_0x7af809[_0xc908('0xa2')]=_0x2aabe4[_0xc908('0xa2')];if(_0x7af809[_0xc908('0xa2')][_0xc908('0xa3')]){delete _0x7af809[_0xc908('0xa2')][_0xc908('0xa3')];}}if(_0x7af809[_0xc908('0xa2')]['content-type']){delete _0x7af809[_0xc908('0xa2')][_0xc908('0xa4')];}return rp(_0x7af809);})[_0xc908('0x2d')](function(_0x431724){if(_0x431724){_0x54cd22['set'](_0x431724[_0xc908('0xa2')]);logger[_0xc908('0x65')](_0x431724[_0xc908('0x95')]);if(_['endsWith'](_0x2aabe4[_0xc908('0x3a')]['path'],_0xc908('0x63'))&&_0x431724[_0xc908('0xa5')]==0x1f4){return _0x54cd22[_0xc908('0x20')](_0x431724[_0xc908('0xa5')]);}else{return _0x54cd22[_0xc908('0x21')](_0x431724['statusCode'])['send'](_0x431724[_0xc908('0x95')]);}}else{return _0x54cd22['sendStatus'](0xc8);}})['catch'](handleError(_0x54cd22,null));};exports['webhookPost']=function(_0x55b3fa,_0x63a270,_0x1b808c){return BPromise[_0xc908('0x99')]()[_0xc908('0x2d')](function(){if(!_0x55b3fa[_0xc908('0x3a')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x55b3fa['query']['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x59e08d=_0x55b3fa[_0xc908('0x3a')]['hostname']?_0x55b3fa[_0xc908('0x3a')][_0xc908('0x9d')]+':'+_0x55b3fa['query'][_0xc908('0x9b')]:_0xc908('0x9e')+_0x55b3fa[_0xc908('0x3a')][_0xc908('0x9b')];var _0x1e4a75=_0x55b3fa[_0xc908('0x3a')][_0xc908('0x22')]?_0x55b3fa[_0xc908('0x3a')][_0xc908('0x22')]:!![];var _0x7f6d58=_0x55b3fa[_0xc908('0x3a')]['encoding']?_0x55b3fa[_0xc908('0x3a')][_0xc908('0x9f')]:null;var _0x197b8c={'method':_0x55b3fa['method'],'uri':util[_0xc908('0x53')](_0xc908('0xa1'),_0x59e08d,_0x55b3fa[_0xc908('0x3a')][_0xc908('0x6')]),'json':_0x1e4a75,'resolveWithFullResponse':!![],'encoding':_0x7f6d58,'body':_0x55b3fa['body']};if(_0x55b3fa[_0xc908('0xa2')]){_0x197b8c[_0xc908('0xa2')]=_0x55b3fa[_0xc908('0xa2')];if(_0x197b8c[_0xc908('0xa2')][_0xc908('0xa3')]){delete _0x197b8c[_0xc908('0xa2')][_0xc908('0xa3')];}}if(_0x197b8c[_0xc908('0xa2')][_0xc908('0xa4')]){delete _0x197b8c['headers'][_0xc908('0xa4')];}return rp(_0x197b8c);})['then'](function(_0x5cf046){if(_0x5cf046){_0x63a270[_0xc908('0x27')](_0x5cf046[_0xc908('0xa2')]);logger[_0xc908('0x65')](_0x5cf046['body']);return _0x63a270[_0xc908('0x21')](_0x5cf046[_0xc908('0xa5')])[_0xc908('0x31')](_0x5cf046[_0xc908('0x95')]);}else{return _0x63a270[_0xc908('0x20')](0xc8);}})[_0xc908('0x4c')](handleError(_0x63a270,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index f3fc824..20f1597 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 _0x9536=['../../mysqldb','Plugin','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x9536,0x179));var _0x6953=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x9536[_0xdea41a];return _0x15d0d8;};'use strict';var EventEmitter=require(_0x6953('0x0'));var Plugin=require(_0x6953('0x1'))['db'][_0x6953('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x6953('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6953('0x4'),'afterDestroy':'remove'};function emitEvent(_0x42fb54){return function(_0x3c32c7,_0x1dee7c,_0x3ba964){PluginEvents[_0x6953('0x5')](_0x42fb54+':'+_0x3c32c7['id'],_0x3c32c7);PluginEvents['emit'](_0x42fb54,_0x3c32c7);_0x3ba964(null);};}for(var e in events){if(events[_0x6953('0x6')](e)){var event=events[e];Plugin[_0x6953('0x7')](e,emitEvent(event));}}module[_0x6953('0x8')]=PluginEvents; \ No newline at end of file +var _0x91c6=['hook','events','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x5b5a86,_0x1173d9){var _0x128a60=function(_0x4841df){while(--_0x4841df){_0x5b5a86['push'](_0x5b5a86['shift']());}};_0x128a60(++_0x1173d9);}(_0x91c6,0xf9));var _0x691c=function(_0xb8256,_0x2b3bfd){_0xb8256=_0xb8256-0x0;var _0x4fe1ab=_0x91c6[_0xb8256];return _0x4fe1ab;};'use strict';var EventEmitter=require(_0x691c('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x691c('0x1')](0x0);var events={'afterCreate':_0x691c('0x2'),'afterUpdate':_0x691c('0x3'),'afterDestroy':_0x691c('0x4')};function emitEvent(_0xa7799c){return function(_0x4944ce,_0xa14528,_0x10c5df){PluginEvents[_0x691c('0x5')](_0xa7799c+':'+_0x4944ce['id'],_0x4944ce);PluginEvents[_0x691c('0x5')](_0xa7799c,_0x4944ce);_0x10c5df(null);};}for(var e in events){if(events[_0x691c('0x6')](e)){var event=events[e];Plugin[_0x691c('0x7')](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 db18c59..4b17be6 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 _0x74d8=['path','../../config/environment','./plugin.attributes','exports','define','plugins','../../config/logger','api','moment','request-promise'];(function(_0x5ee024,_0x5a33e2){var _0x542633=function(_0x22d9a7){while(--_0x22d9a7){_0x5ee024['push'](_0x5ee024['shift']());}};_0x542633(++_0x5a33e2);}(_0x74d8,0xd8));var _0x874d=function(_0x421b21,_0x152af2){_0x421b21=_0x421b21-0x0;var _0x5709ad=_0x74d8[_0x421b21];return _0x5709ad;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x874d('0x0'))(_0x874d('0x1'));var moment=require(_0x874d('0x2'));var BPromise=require('bluebird');var rp=require(_0x874d('0x3'));var fs=require('fs');var path=require(_0x874d('0x4'));var rimraf=require('rimraf');var config=require(_0x874d('0x5'));var attributes=require(_0x874d('0x6'));module[_0x874d('0x7')]=function(_0x4260cf,_0xc7720c){return _0x4260cf[_0x874d('0x8')]('Plugin',attributes,{'tableName':_0x874d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc69b=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','Plugin','plugins','lodash'];(function(_0x26fd83,_0x18ea5a){var _0x5a0d82=function(_0x11e190){while(--_0x11e190){_0x26fd83['push'](_0x26fd83['shift']());}};_0x5a0d82(++_0x18ea5a);}(_0xc69b,0x1d3));var _0xbc69=function(_0x47c5bf,_0x45977e){_0x47c5bf=_0x47c5bf-0x0;var _0x11b779=_0xc69b[_0x47c5bf];return _0x11b779;};'use strict';var _=require(_0xbc69('0x0'));var util=require(_0xbc69('0x1'));var logger=require('../../config/logger')(_0xbc69('0x2'));var moment=require(_0xbc69('0x3'));var BPromise=require(_0xbc69('0x4'));var rp=require(_0xbc69('0x5'));var fs=require('fs');var path=require(_0xbc69('0x6'));var rimraf=require(_0xbc69('0x7'));var config=require(_0xbc69('0x8'));var attributes=require(_0xbc69('0x9'));module[_0xbc69('0xa')]=function(_0x2bb393,_0x467bee){return _0x2bb393['define'](_0xbc69('0xb'),attributes,{'tableName':_0xbc69('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 0588cee..fb2151f 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 _0xdd2e=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','request','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CreatePlugin','Plugin','body','options','raw','stringify','lodash','util','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdd2e,0x13d));var _0xedd2=function(_0x459de1,_0x187d8c){_0x459de1=_0x459de1-0x0;var _0x2a1006=_0xdd2e[_0x459de1];return _0x2a1006;};'use strict';var _=require(_0xedd2('0x0'));var util=require(_0xedd2('0x1'));var moment=require('moment');var BPromise=require(_0xedd2('0x2'));var rs=require(_0xedd2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedd2('0x4'))['db'];var utils=require(_0xedd2('0x5'));var logger=require(_0xedd2('0x6'))(_0xedd2('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xedd2('0x8')][_0xedd2('0x9')]({'port':0x232a});config[_0xedd2('0xa')]=_[_0xedd2('0xb')](config[_0xedd2('0xa')],{'host':_0xedd2('0xc'),'port':0x18eb});var socket=require(_0xedd2('0xd'))(new Redis(config['redis']));require(_0xedd2('0xe'))['register'](socket);function respondWithRpcPromise(_0x3d243a,_0x46022d,_0x42256f){return new BPromise(function(_0xbac524,_0x1559e9){return client[_0xedd2('0xf')](_0x3d243a,_0x42256f)[_0xedd2('0x10')](function(_0x5c16dd){logger['info'](_0xedd2('0x11'),_0x46022d,_0xedd2('0x12'));logger[_0xedd2('0x13')](_0xedd2('0x14'),_0x46022d,'request\x20sent',JSON['stringify'](_0x5c16dd));if(_0x5c16dd[_0xedd2('0x15')]){if(_0x5c16dd['error']['code']===0x1f4){logger[_0xedd2('0x15')]('Plugin,\x20%s,\x20%s',_0x46022d,_0x5c16dd[_0xedd2('0x15')]['message']);return _0x1559e9(_0x5c16dd[_0xedd2('0x15')]['message']);}logger[_0xedd2('0x15')](_0xedd2('0x11'),_0x46022d,_0x5c16dd[_0xedd2('0x15')][_0xedd2('0x16')]);return _0xbac524(_0x5c16dd[_0xedd2('0x15')][_0xedd2('0x16')]);}else{logger[_0xedd2('0x17')](_0xedd2('0x11'),_0x46022d,_0xedd2('0x12'));_0xbac524(_0x5c16dd[_0xedd2('0x18')][_0xedd2('0x16')]);}})[_0xedd2('0x19')](function(_0x493357){logger['error'](_0xedd2('0x11'),_0x46022d,_0x493357);_0x1559e9(_0x493357);});});}exports[_0xedd2('0x1a')]=function(_0x4dfddb){var _0x1babe8=this;return new Promise(function(_0x381455,_0xd9f8ae){return db[_0xedd2('0x1b')]['create'](_0x4dfddb[_0xedd2('0x1c')],{'raw':_0x4dfddb[_0xedd2('0x1d')]?_0x4dfddb[_0xedd2('0x1d')][_0xedd2('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x445d7a){logger['info'](_0xedd2('0x1a'),_0x4dfddb);logger[_0xedd2('0x13')]('CreatePlugin',_0x4dfddb,JSON[_0xedd2('0x1f')](_0x445d7a));_0x381455(_0x445d7a);})[_0xedd2('0x19')](function(_0x79d98a){logger[_0xedd2('0x15')](_0xedd2('0x1a'),_0x79d98a[_0xedd2('0x16')],_0x4dfddb);_0xd9f8ae(_0x1babe8['error'](0x1f4,_0x79d98a['message']));});});}; \ No newline at end of file +var _0x8469=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreatePlugin','Plugin','create','body','options','raw'];(function(_0x1f9ffb,_0x40d7b1){var _0xee5715=function(_0x2518f2){while(--_0x2518f2){_0x1f9ffb['push'](_0x1f9ffb['shift']());}};_0xee5715(++_0x40d7b1);}(_0x8469,0xd9));var _0x9846=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x8469[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var util=require(_0x9846('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9846('0x1'));var fs=require('fs');var Redis=require(_0x9846('0x2'));var db=require(_0x9846('0x3'))['db'];var utils=require(_0x9846('0x4'));var logger=require(_0x9846('0x5'))(_0x9846('0x6'));var config=require('../../config/environment');var jayson=require(_0x9846('0x7'));var client=jayson[_0x9846('0x8')]['http']({'port':0x232a});config[_0x9846('0x9')]=_[_0x9846('0xa')](config[_0x9846('0x9')],{'host':_0x9846('0xb'),'port':0x18eb});var socket=require(_0x9846('0xc'))(new Redis(config[_0x9846('0x9')]));require('./plugin.socket')[_0x9846('0xd')](socket);function respondWithRpcPromise(_0x2b31f8,_0x198896,_0x1320e4){return new BPromise(function(_0x199d52,_0x1251bd){return client[_0x9846('0xe')](_0x2b31f8,_0x1320e4)[_0x9846('0xf')](function(_0x5a82ba){logger[_0x9846('0x10')](_0x9846('0x11'),_0x198896,_0x9846('0x12'));logger[_0x9846('0x13')]('Plugin,\x20%s,\x20%s,\x20%s',_0x198896,_0x9846('0x12'),JSON[_0x9846('0x14')](_0x5a82ba));if(_0x5a82ba[_0x9846('0x15')]){if(_0x5a82ba['error'][_0x9846('0x16')]===0x1f4){logger[_0x9846('0x15')](_0x9846('0x11'),_0x198896,_0x5a82ba['error'][_0x9846('0x17')]);return _0x1251bd(_0x5a82ba[_0x9846('0x15')][_0x9846('0x17')]);}logger['error'](_0x9846('0x11'),_0x198896,_0x5a82ba[_0x9846('0x15')][_0x9846('0x17')]);return _0x199d52(_0x5a82ba['error']['message']);}else{logger[_0x9846('0x10')](_0x9846('0x11'),_0x198896,'request\x20sent');_0x199d52(_0x5a82ba['result']['message']);}})[_0x9846('0x18')](function(_0x2b77da){logger['error'](_0x9846('0x11'),_0x198896,_0x2b77da);_0x1251bd(_0x2b77da);});});}exports[_0x9846('0x19')]=function(_0x21ca49){var _0x2e71a7=this;return new Promise(function(_0xf99e6,_0x597502){return db[_0x9846('0x1a')][_0x9846('0x1b')](_0x21ca49[_0x9846('0x1c')],{'raw':_0x21ca49[_0x9846('0x1d')]?_0x21ca49[_0x9846('0x1d')][_0x9846('0x1e')]===undefined?!![]:![]:!![]})[_0x9846('0xf')](function(_0x2875f5){logger[_0x9846('0x10')](_0x9846('0x19'),_0x21ca49);logger[_0x9846('0x13')]('CreatePlugin',_0x21ca49,JSON[_0x9846('0x14')](_0x2875f5));_0xf99e6(_0x2875f5);})[_0x9846('0x18')](function(_0x923e47){logger[_0x9846('0x15')]('CreatePlugin',_0x923e47[_0x9846('0x17')],_0x21ca49);_0x597502(_0x2e71a7[_0x9846('0x15')](0x1f4,_0x923e47[_0x9846('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 4856800..5a48bb0 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 _0x7398=['length','plugin:','./plugin.events','save','remove','update','emit','removeListener'];(function(_0x5f416b,_0x2d8810){var _0x14c815=function(_0x1fd5d2){while(--_0x1fd5d2){_0x5f416b['push'](_0x5f416b['shift']());}};_0x14c815(++_0x2d8810);}(_0x7398,0x162));var _0x8739=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x7398[_0x3511d3];return _0x5d6321;};'use strict';var PluginEvents=require(_0x8739('0x0'));var events=[_0x8739('0x1'),_0x8739('0x2'),_0x8739('0x3')];function createListener(_0x5ad82c,_0x14a324){return function(_0x58910a){_0x14a324[_0x8739('0x4')](_0x5ad82c,_0x58910a);};}function removeListener(_0x5eba34,_0x276b8e){return function(){PluginEvents[_0x8739('0x5')](_0x5eba34,_0x276b8e);};}exports['register']=function(_0x457bc7){for(var _0x1bfcf7=0x0,_0x280f6d=events[_0x8739('0x6')];_0x1bfcf7<_0x280f6d;_0x1bfcf7++){var _0xbb359c=events[_0x1bfcf7];var _0x1d0678=createListener(_0x8739('0x7')+_0xbb359c,_0x457bc7);PluginEvents['on'](_0xbb359c,_0x1d0678);}}; \ No newline at end of file +var _0x0dff=['register','length','plugin:','./plugin.events','remove','update','emit','removeListener'];(function(_0x578a80,_0x412698){var _0x4b4ba8=function(_0x4ff947){while(--_0x4ff947){_0x578a80['push'](_0x578a80['shift']());}};_0x4b4ba8(++_0x412698);}(_0x0dff,0x14b));var _0xf0df=function(_0x3223b2,_0x4dea1e){_0x3223b2=_0x3223b2-0x0;var _0x6c61f5=_0x0dff[_0x3223b2];return _0x6c61f5;};'use strict';var PluginEvents=require(_0xf0df('0x0'));var events=['save',_0xf0df('0x1'),_0xf0df('0x2')];function createListener(_0x2420cd,_0x32da08){return function(_0x48bebd){_0x32da08[_0xf0df('0x3')](_0x2420cd,_0x48bebd);};}function removeListener(_0x507be0,_0x3ddf98){return function(){PluginEvents[_0xf0df('0x4')](_0x507be0,_0x3ddf98);};}exports[_0xf0df('0x5')]=function(_0x4148b0){for(var _0x4633e7=0x0,_0x38f896=events[_0xf0df('0x6')];_0x4633e7<_0x38f896;_0x4633e7++){var _0x38ce96=events[_0x4633e7];var _0x43e0ce=createListener(_0xf0df('0x7')+_0x38ce96,_0x4148b0);PluginEvents['on'](_0x38ce96,_0x43e0ce);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index e8a0990..2efa639 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(_0x2db056,_0x2fce25){var _0x156b51=function(_0x420cc1){while(--_0x420cc1){_0x2db056['push'](_0x2db056['shift']());}};_0x156b51(++_0x2fce25);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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(_0x3fc18e,_0xa6bcc){var _0x52e1b3=function(_0x256325){while(--_0x256325){_0x3fc18e['push'](_0x3fc18e['shift']());}};_0x52e1b3(++_0xa6bcc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 96d1f55..a582ed1 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 _0x57f8=['error','name','npm\x20install','info','index','list','express','length','then','catch','show','describe','params','body','script','../../files/plugins','cwd','chdir','dirname','dump','send','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json'];(function(_0x3fe280,_0x1d8260){var _0x2e833f=function(_0x2fc4e2){while(--_0x2fc4e2){_0x3fe280['push'](_0x3fe280['shift']());}};_0x2e833f(++_0x1d8260);}(_0x57f8,0x198));var _0x857f=function(_0x25cec5,_0x115d0c){_0x25cec5=_0x25cec5-0x0;var _0x19fba4=_0x57f8[_0x25cec5];return _0x19fba4;};'use strict';var _=require('lodash');var pm2=require(_0x857f('0x0'));var logger=require(_0x857f('0x1'))(_0x857f('0x2'));var path=require(_0x857f('0x3'));var exec=require(_0x857f('0x4'))[_0x857f('0x5')];var BPromise=require(_0x857f('0x6'));function handleEntityNotFound(_0x6f054b,_0x318050){return function(_0xced48e){if(!_0xced48e){_0x6f054b[_0x857f('0x7')](0x194);;}return _0xced48e;};}function respondWithResult(_0x369c40,_0x5d22e4){_0x5d22e4=_0x5d22e4||0xc8;return function(_0x8380e8){if(_0x8380e8){return _0x369c40[_0x857f('0x8')](_0x5d22e4)[_0x857f('0x9')](_0x8380e8);}return null;};}function handleError(_0x577fc3,_0x5f6a66){_0x5f6a66=_0x5f6a66||0x1f4;return function(_0x135855){logger[_0x857f('0xa')](_0x135855['stack']);if(_0x135855[_0x857f('0xb')]){delete _0x135855[_0x857f('0xb')];}_0x577fc3[_0x857f('0x8')](_0x5f6a66)['send'](_0x135855);};}function execChildProcess(){return new BPromise(function(_0xefee53,_0x360827){exec(_0x857f('0xc'),function(_0x11adfd,_0x268f9d,_0x3eb530){logger[_0x857f('0xd')](_0x268f9d);logger['info'](_0x3eb530);if(_0x11adfd){logger[_0x857f('0xa')](_0x11adfd);return _0x360827(_0x11adfd);}return _0xefee53(_0x268f9d);});});}exports[_0x857f('0xe')]=function(_0x373333,_0x2caf29){return pm2[_0x857f('0xf')]()['then'](function(_0x4bc590){if(_0x4bc590){var _0x3b09d9=_['reject'](_0x4bc590,function(_0x1fafbe){return _0x1fafbe['name']===_0x857f('0x10')||_0x1fafbe[_0x857f('0xb')]==='motion2';});return{'rows':_0x3b09d9,'count':_0x3b09d9[_0x857f('0x11')]};}return null;})[_0x857f('0x12')](respondWithResult(_0x2caf29,null))[_0x857f('0x13')](handleError(_0x2caf29,null));};exports[_0x857f('0x14')]=function(_0x279e74,_0x38a3c2){return pm2[_0x857f('0x15')](_0x279e74[_0x857f('0x16')]['id'])[_0x857f('0x12')](respondWithResult(_0x38a3c2,null))[_0x857f('0x12')](handleEntityNotFound(_0x38a3c2,null))[_0x857f('0x13')](handleError(_0x38a3c2,null));};exports['create']=function(_0x1729d8,_0x1e8fd4){if(_0x1729d8['body'][_0x857f('0xb')]&&_0x1729d8[_0x857f('0x17')][_0x857f('0x18')]){var _0x484035=path['join'](__dirname,_0x857f('0x19'),_0x1729d8[_0x857f('0x17')][_0x857f('0x18')]);var _0x4fa031=process[_0x857f('0x1a')]();process[_0x857f('0x1b')](path[_0x857f('0x1c')](_0x484035));return execChildProcess()['then'](function(_0x1961ea){process[_0x857f('0x1b')](_0x4fa031);return pm2['start']({'name':_0x1729d8[_0x857f('0x17')][_0x857f('0xb')],'script':_0x484035});})[_0x857f('0x12')](function(_0x44ff23){pm2[_0x857f('0x1d')]();return _0x44ff23[0x0];})[_0x857f('0x12')](respondWithResult(_0x1e8fd4,0xc9))[_0x857f('0x13')](handleError(_0x1e8fd4,null));}else{return _0x1e8fd4[_0x857f('0x8')](0x1f4)[_0x857f('0x1e')]({'message':_0x857f('0x1f')});}};exports[_0x857f('0x20')]=function(_0x4782ab,_0x250731){if(_0x4782ab[_0x857f('0x17')]['id']){delete _0x4782ab['body']['id'];}var _0x17e415={'online':_0x857f('0x21'),'stopped':_0x857f('0x22')};if(_0x17e415[_0x857f('0x23')](_0x4782ab['body'][_0x857f('0x8')])){return pm2[_0x17e415[_0x4782ab['body'][_0x857f('0x8')]]](_0x4782ab[_0x857f('0x16')]['id'])[_0x857f('0x12')](respondWithResult(_0x250731,0xc8))[_0x857f('0x13')](handleError(_0x250731,null));}else{return _0x250731[_0x857f('0x8')](0x1f4)[_0x857f('0x1e')]({'message':_0x857f('0x24')});}};exports[_0x857f('0x25')]=function(_0x17e7b6,_0x41f832){if(_0x17e7b6[_0x857f('0x17')]['id']){delete _0x17e7b6[_0x857f('0x17')]['id'];}if(_0x17e7b6[_0x857f('0x16')]['id']){return pm2['delete'](_0x17e7b6[_0x857f('0x16')]['id'])[_0x857f('0x12')](function(_0x55e69f){pm2[_0x857f('0x1d')]();return _0x55e69f[0x0];})[_0x857f('0x12')](respondWithResult(_0x41f832,null))['catch'](handleError(_0x41f832,null));}else{return _0x41f832[_0x857f('0x8')](0x1f4)[_0x857f('0x1e')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0xb469=['motion2','show','create','body','join','../../files/plugins','chdir','dirname','start','dump','catch','status','update','restart','hasOwnProperty','params','Unknown\x20status','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','sendStatus','error','stack','name','send','info','index','list','then','reject','express'];(function(_0x5364dc,_0x1c3e10){var _0x2fe5ba=function(_0x28cd5a){while(--_0x28cd5a){_0x5364dc['push'](_0x5364dc['shift']());}};_0x2fe5ba(++_0x1c3e10);}(_0xb469,0x13b));var _0x9b46=function(_0xe9a760,_0x42833f){_0xe9a760=_0xe9a760-0x0;var _0x3fa38c=_0xb469[_0xe9a760];return _0x3fa38c;};'use strict';var _=require(_0x9b46('0x0'));var pm2=require(_0x9b46('0x1'));var logger=require(_0x9b46('0x2'))(_0x9b46('0x3'));var path=require(_0x9b46('0x4'));var exec=require(_0x9b46('0x5'))[_0x9b46('0x6')];var BPromise=require('bluebird');function handleEntityNotFound(_0x31f853,_0x45322f){return function(_0x538fc4){if(!_0x538fc4){_0x31f853[_0x9b46('0x7')](0x194);;}return _0x538fc4;};}function respondWithResult(_0x405d1c,_0x50b49e){_0x50b49e=_0x50b49e||0xc8;return function(_0x1b2dd3){if(_0x1b2dd3){return _0x405d1c['status'](_0x50b49e)['json'](_0x1b2dd3);}return null;};}function handleError(_0x34c0de,_0x545b6c){_0x545b6c=_0x545b6c||0x1f4;return function(_0x402595){logger[_0x9b46('0x8')](_0x402595[_0x9b46('0x9')]);if(_0x402595['name']){delete _0x402595[_0x9b46('0xa')];}_0x34c0de['status'](_0x545b6c)[_0x9b46('0xb')](_0x402595);};}function execChildProcess(){return new BPromise(function(_0x568d9a,_0x2c29a7){exec('npm\x20install',function(_0x672157,_0x233b6b,_0x563de4){logger[_0x9b46('0xc')](_0x233b6b);logger[_0x9b46('0xc')](_0x563de4);if(_0x672157){logger['error'](_0x672157);return _0x2c29a7(_0x672157);}return _0x568d9a(_0x233b6b);});});}exports[_0x9b46('0xd')]=function(_0x2cfb35,_0x3d9618){return pm2[_0x9b46('0xe')]()[_0x9b46('0xf')](function(_0x35c5c1){if(_0x35c5c1){var _0x2136bc=_[_0x9b46('0x10')](_0x35c5c1,function(_0x3f2b28){return _0x3f2b28[_0x9b46('0xa')]===_0x9b46('0x11')||_0x3f2b28[_0x9b46('0xa')]===_0x9b46('0x12');});return{'rows':_0x2136bc,'count':_0x2136bc['length']};}return null;})['then'](respondWithResult(_0x3d9618,null))['catch'](handleError(_0x3d9618,null));};exports[_0x9b46('0x13')]=function(_0x5a380c,_0x29fec9){return pm2['describe'](_0x5a380c['params']['id'])[_0x9b46('0xf')](respondWithResult(_0x29fec9,null))['then'](handleEntityNotFound(_0x29fec9,null))['catch'](handleError(_0x29fec9,null));};exports[_0x9b46('0x14')]=function(_0x3a15cc,_0x5a0d25){if(_0x3a15cc[_0x9b46('0x15')][_0x9b46('0xa')]&&_0x3a15cc['body']['script']){var _0xbec2ea=path[_0x9b46('0x16')](__dirname,_0x9b46('0x17'),_0x3a15cc['body']['script']);var _0x2b3440=process['cwd']();process[_0x9b46('0x18')](path[_0x9b46('0x19')](_0xbec2ea));return execChildProcess()['then'](function(_0xadff19){process['chdir'](_0x2b3440);return pm2[_0x9b46('0x1a')]({'name':_0x3a15cc[_0x9b46('0x15')]['name'],'script':_0xbec2ea});})[_0x9b46('0xf')](function(_0x31ca63){pm2[_0x9b46('0x1b')]();return _0x31ca63[0x0];})[_0x9b46('0xf')](respondWithResult(_0x5a0d25,0xc9))[_0x9b46('0x1c')](handleError(_0x5a0d25,null));}else{return _0x5a0d25[_0x9b46('0x1d')](0x1f4)[_0x9b46('0xb')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x9b46('0x1e')]=function(_0x3ac37e,_0x478105){if(_0x3ac37e[_0x9b46('0x15')]['id']){delete _0x3ac37e[_0x9b46('0x15')]['id'];}var _0x2a79a5={'online':_0x9b46('0x1f'),'stopped':'stop'};if(_0x2a79a5[_0x9b46('0x20')](_0x3ac37e[_0x9b46('0x15')][_0x9b46('0x1d')])){return pm2[_0x2a79a5[_0x3ac37e[_0x9b46('0x15')][_0x9b46('0x1d')]]](_0x3ac37e[_0x9b46('0x21')]['id'])[_0x9b46('0xf')](respondWithResult(_0x478105,0xc8))[_0x9b46('0x1c')](handleError(_0x478105,null));}else{return _0x478105[_0x9b46('0x1d')](0x1f4)[_0x9b46('0xb')]({'message':_0x9b46('0x22')});}};exports['destroy']=function(_0x1f722d,_0x27f326){if(_0x1f722d[_0x9b46('0x15')]['id']){delete _0x1f722d[_0x9b46('0x15')]['id'];}if(_0x1f722d[_0x9b46('0x21')]['id']){return pm2[_0x9b46('0x23')](_0x1f722d[_0x9b46('0x21')]['id'])[_0x9b46('0xf')](function(_0x3ab49a){pm2[_0x9b46('0x1b')]();return _0x3ab49a[0x0];})[_0x9b46('0xf')](respondWithResult(_0x27f326,null))['catch'](handleError(_0x27f326,null));}else{return _0x27f326[_0x9b46('0x1d')](0x1f4)['send']({'message':_0x9b46('0x24')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 039bf63..548fe9d 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 _0x5890=['express','Router','../../components/auth/service','./realtime.controller','get','getAgents','/queues','isAuthenticated','exports'];(function(_0x1a662e,_0x4ee34b){var _0x58cd86=function(_0x776a55){while(--_0x776a55){_0x1a662e['push'](_0x1a662e['shift']());}};_0x58cd86(++_0x4ee34b);}(_0x5890,0x1b9));var _0x0589=function(_0x30362e,_0x3a89bb){_0x30362e=_0x30362e-0x0;var _0xe49675=_0x5890[_0x30362e];return _0xe49675;};'use strict';var express=require(_0x0589('0x0'));var router=express[_0x0589('0x1')]();var auth=require(_0x0589('0x2'));var controller=require(_0x0589('0x3'));router[_0x0589('0x4')]('/agents',auth['isAuthenticated'](),controller[_0x0589('0x5')]);router[_0x0589('0x4')](_0x0589('0x6'),auth[_0x0589('0x7')](),controller['getQueues']);module[_0x0589('0x8')]=router; \ No newline at end of file +var _0x78d4=['/agents','isAuthenticated','getAgents','exports','Router','../../components/auth/service','./realtime.controller','get'];(function(_0x4b43e2,_0x24fb8a){var _0x24b9e2=function(_0x4b82b4){while(--_0x4b82b4){_0x4b43e2['push'](_0x4b43e2['shift']());}};_0x24b9e2(++_0x24fb8a);}(_0x78d4,0x16c));var _0x478d=function(_0x276561,_0x90f689){_0x276561=_0x276561-0x0;var _0x5bca6e=_0x78d4[_0x276561];return _0x5bca6e;};'use strict';var express=require('express');var router=express[_0x478d('0x0')]();var auth=require(_0x478d('0x1'));var controller=require(_0x478d('0x2'));router[_0x478d('0x3')](_0x478d('0x4'),auth[_0x478d('0x5')](),controller[_0x478d('0x6')]);router[_0x478d('0x3')]('/queues',auth[_0x478d('0x5')](),controller['getQueues']);module[_0x478d('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 5a43f40..3d0af95 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 _0xc150=['offset','undefined','limit','count','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','pauseTypeFilter','pause','*pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','getUpdatedSortOptions','fields','join','order','getRealtimeAgents','rows','getAgentIdsByStatus','length','map','User','fieldName','key','role','agent','getOptions','raw','push','sequelize','literal','FIELD(id,','Pause','where','user','Agents','online','extraQueryConditions','assign','UserProfile','findAndCountAll','find','filterAgentAttributes','getAgentStatus','voice','voiceStatus','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','startCase','Queue','rawAttributes','type','name','outbound','dialMethod','Queues','filter','getRealtimeQueues','util','../../components/realtime/queues','../../components/parsers/qs','../../errors/api','APIBadRequestError','handleError'];(function(_0x8f2b45,_0x54a119){var _0x664c5c=function(_0x5de1a7){while(--_0x5de1a7){_0x8f2b45['push'](_0x8f2b45['shift']());}};_0x664c5c(++_0x54a119);}(_0xc150,0x1da));var _0x0c15=function(_0x406d8e,_0xa3c666){_0x406d8e=_0x406d8e-0x0;var _0x229317=_0xc150[_0x406d8e];return _0x229317;};'use strict';var _=require('lodash');var util=require(_0x0c15('0x0'));var rta=require('../../components/realtime/agents');var rtq=require(_0x0c15('0x1'));var qs=require(_0x0c15('0x2'));var utils=require('../../config/utils');var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x0c15('0x3'))[_0x0c15('0x4')];var APIHandleError=require(_0x0c15('0x3'))[_0x0c15('0x5')];function respondWithFilteredResult(_0x38220e,_0x5fc52){return function(_0x35857d){if(_0x35857d){var _0x5507c2=typeof _0x5fc52[_0x0c15('0x6')]===_0x0c15('0x7')&&typeof _0x5fc52[_0x0c15('0x8')]==='undefined';var _0x24b56e=_0x35857d[_0x0c15('0x9')];var _0x1bea36=_0x5507c2?0x0:_0x5fc52[_0x0c15('0x6')];var _0x204684=_0x5507c2?_0x35857d[_0x0c15('0x9')]:_0x5fc52[_0x0c15('0x6')]+_0x5fc52[_0x0c15('0x8')];var _0x3824ee;if(_0x204684>=_0x24b56e){_0x204684=_0x24b56e;_0x3824ee=0xc8;}else{_0x3824ee=0xce;}_0x38220e['status'](_0x3824ee);return _0x38220e[_0x0c15('0xa')](_0x0c15('0xb'),_0x1bea36+'-'+_0x204684+'/'+_0x24b56e)[_0x0c15('0xc')](_0x35857d);}return null;};}exports[_0x0c15('0xd')]=function(_0x229316,_0x2816e9){var _0x289743={'count':0x0,'rows':[]};var _0x181169={};var _0x6236a2;var _0x2de80d=utils[_0x0c15('0xe')]();var _0x314f3c;var _0x33dec4;var _0x5b4457=_0x229316[_0x0c15('0xf')][_0x0c15('0x10')];var _0x509e4a=_0x229316['query']['globalStatusFilter'];var _0x4b7c93=_0x229316[_0x0c15('0xf')][_0x0c15('0x11')];var _0x1e07fc=_0x509e4a===_0x0c15('0x12')||_0x509e4a===_0x0c15('0x13')?!![]:![];var _0x13f09b=[];var _0x3ef99b;var _0x4ef303;Promise[_0x0c15('0x14')]()[_0x0c15('0x15')](function(){if(_0x229316[_0x0c15('0xf')][_0x0c15('0x16')]){if(!utils[_0x0c15('0x17')](_0x229316[_0x0c15('0xf')]['channel'])){throw new APIBadRequestError(util[_0x0c15('0x18')](_0x0c15('0x19'),_0x229316['query']['channel']));}_0x6236a2=_0x229316[_0x0c15('0xf')][_0x0c15('0x16')][_0x0c15('0x1a')]();}if(!_0x229316[_0x0c15('0xf')][_0x0c15('0x1b')]||!_0x229316[_0x0c15('0xf')][_0x0c15('0x1b')][_0x0c15('0x1c')](_0x0c15('0x1d'))){_0x229316['query'][_0x0c15('0x1b')]=rta['validateSortParameter'](_0x229316[_0x0c15('0xf')]['sort']);return;}var _0x465f67=rta[_0x0c15('0x1e')](_0x229316[_0x0c15('0xf')]['sort']);_0x229316[_0x0c15('0xf')]['sort']=_0x465f67[_0x0c15('0x1f')][_0x0c15('0x20')](',');_0x3ef99b=_0x465f67[_0x0c15('0x21')];})[_0x0c15('0x15')](function(){if(!_0x5b4457){return[];}return rta['getAgentIdsByQueues'](_0x5b4457,_0x6236a2);})[_0x0c15('0x15')](function(_0x2dd903){_0x13f09b=_0x2dd903;return rta[_0x0c15('0x22')]();})[_0x0c15('0x15')](function(_0x578b68){_0x33dec4=_0x578b68[_0x0c15('0x23')];if((!_0x509e4a||_0x1e07fc)&&!_0x3ef99b){return _0x13f09b;}if(_0x3ef99b&&!_0x509e4a){return rta['getSortedAgentsIdsByStatus'](_0x33dec4,_0x13f09b,_0x3ef99b);}else{return rta[_0x0c15('0x24')](_0x33dec4,_0x13f09b,_0x509e4a);}})['then'](function(_0x4f082a){_0x13f09b=_0x4f082a;var _0x472a42=![];if(_0x13f09b[_0x0c15('0x25')]===0x0){if(_0x5b4457||_0x509e4a){_0x472a42=!![];}if(_0x1e07fc){_0x472a42=![];}}if(_0x472a42){return _0x289743;}var _0x36998e=_[_0x0c15('0x26')](db[_0x0c15('0x27')]['rawAttributes'],function(_0x43d605){return{'name':_0x43d605[_0x0c15('0x28')],'type':_0x43d605['type'][_0x0c15('0x29')]};});_0x229316['query'][_0x0c15('0x2a')]=_0x0c15('0x2b');_0x181169=qs[_0x0c15('0x2c')](_0x36998e,_0x229316);_0x181169[_0x0c15('0x2d')]=!![];var _0x293d5e=[];if(_0x13f09b[_0x0c15('0x25')]>0x0){_0x293d5e[_0x0c15('0x2e')]({'id':{'$in':_0x13f09b}});if(_0x3ef99b&&!_0x509e4a){_0x4ef303=[db[_0x0c15('0x2f')][_0x0c15('0x30')](_0x0c15('0x31')+_0x13f09b+')')];_0x181169[_0x0c15('0x21')]=_0x4ef303;}}if(_0x1e07fc){_0x2de80d['forEach'](function(_0x5c60e2){var _0x2e61b8=!![];if(_0x509e4a===_0x0c15('0x13')&&_0x6236a2!==_0x5c60e2){_0x2e61b8=![];}_0x293d5e[_0x0c15('0x2e')]({[_0x5c60e2+'Pause']:_0x2e61b8});});if(_0x4b7c93){_0x293d5e['push']({'pauseType':_0x4b7c93});}}else if(_0x509e4a){_0x2de80d['forEach'](function(_0x2be8dc){_0x293d5e[_0x0c15('0x2e')]({[_0x2be8dc+_0x0c15('0x32')]:![]});});}_0x181169[_0x0c15('0x33')]=_['merge'](_0x181169['where'],{'$and':_0x293d5e});if(_0x229316['user']['role']===_0x0c15('0x34')){var _0x8658c7={'params':{'id':_0x229316[_0x0c15('0x34')]['userProfileId']},'query':{'section':_0x0c15('0x35'),'role':_0x0c15('0x2b'),'raw':!![],'ids':_0x13f09b,'customSorting':_0x4ef303}};if(_0x229316[_0x0c15('0xf')][_0x0c15('0x36')]){_0x8658c7[_0x0c15('0xf')][_0x0c15('0x36')]=!![];}if(_0x1e07fc){_0x8658c7[_0x0c15('0xf')][_0x0c15('0x37')]=_0x293d5e;}_0x8658c7['query']=Object[_0x0c15('0x38')](_0x8658c7[_0x0c15('0xf')],_0x229316[_0x0c15('0xf')]);return db[_0x0c15('0x39')]['getResources'](_0x8658c7);}return db[_0x0c15('0x27')][_0x0c15('0x3a')](_0x181169);})[_0x0c15('0x15')](function(_0x21bfa7){_0x289743['count']=_0x21bfa7['count'];_0x314f3c=_0x21bfa7['rows'];return _0x314f3c['map'](function(_0x495ac6){var _0x43677e=_[_0x0c15('0x3b')](_0x33dec4,['id',_0x495ac6['id']]);if(_0x43677e){var _0x49f7e5=rta[_0x0c15('0x3c')](_0x43677e);_['merge'](_0x495ac6,_0x49f7e5);}_0x495ac6['globalStatus']=rta[_0x0c15('0x3d')](_0x495ac6);if(_0x495ac6[_0x0c15('0x1d')]['includes']('pause')){_0x2de80d['forEach'](function(_0x2dff42){if(_0x495ac6[_0x2dff42+_0x0c15('0x32')]){if(_0x2dff42===_0x0c15('0x3e')){if(_0x495ac6[_0x0c15('0x3f')]!=='talking'){_0x495ac6[_0x0c15('0x3f')]='pause';}}else{_0x495ac6[_0x2dff42+_0x0c15('0x40')]='pause';}}});}return _0x495ac6;});})[_0x0c15('0x15')](function(_0x10214a){if(!_0x3ef99b||_0x4ef303){return _0x10214a;}return rta[_0x0c15('0x41')](_0x10214a,_0x3ef99b);})[_0x0c15('0x15')](function(_0x5bc389){var _0x53e1d6=rta[_0x0c15('0x42')]();_0x289743[_0x0c15('0x23')]=_0x5bc389['map'](function(_0x550334){return _[_0x0c15('0x43')](_0x550334,_0x53e1d6);});return _0x289743;})['then'](respondWithFilteredResult(_0x2816e9,_0x181169))[_0x0c15('0x44')](APIHandleError(_0x2816e9));};exports[_0x0c15('0x45')]=function(_0x2cb590,_0x532af4){var _0x46094b={'count':0x0,'rows':[]};var _0x483952={};var _0xe50937;var _0x4acbad;var _0x2acad1;Promise['resolve']()[_0x0c15('0x15')](function(){if(_0x2cb590[_0x0c15('0xf')][_0x0c15('0x16')]){if(!utils['isValidChannel'](_0x2cb590[_0x0c15('0xf')][_0x0c15('0x16')])){throw new APIBadRequestError(util[_0x0c15('0x18')](_0x0c15('0x19'),_0x2cb590['query'][_0x0c15('0x16')]));}_0xe50937=_0x2cb590[_0x0c15('0xf')]['channel'][_0x0c15('0x1a')]();}var _0x4fbc7c=_[_0x0c15('0x46')](_0xe50937)+_0x0c15('0x47');var _0x163502=_[_0x0c15('0x26')](db[_0x4fbc7c][_0x0c15('0x48')],function(_0x593fd6){return{'name':_0x593fd6['fieldName'],'type':_0x593fd6[_0x0c15('0x49')][_0x0c15('0x29')]};});if(!_0x2cb590[_0x0c15('0xf')][_0x0c15('0x1f')]){var _0x4836ae=['id',_0x0c15('0x4a')];if(_0xe50937===_0x0c15('0x3e')){_0x4836ae[_0x0c15('0x2e')](_0x0c15('0x49'));if(_0x2cb590[_0x0c15('0xf')][_0x0c15('0x49')]===_0x0c15('0x4b')){_0x4836ae['push'](['dialActive',_0x0c15('0x4c')]);}}_0x2cb590[_0x0c15('0xf')][_0x0c15('0x1f')]=_0x4836ae[_0x0c15('0x20')](',');}_0x483952=qs[_0x0c15('0x2c')](_0x163502,_0x2cb590);if(_0x2cb590['user'][_0x0c15('0x2a')]==='user'){var _0x566d39={'params':{'id':_0x2cb590[_0x0c15('0x34')]['userProfileId']},'query':{'section':_0xe50937===_0x0c15('0x3e')&&_0x2cb590[_0x0c15('0xf')][_0x0c15('0x49')]==='outbound'?'QueueCampaigns':_[_0x0c15('0x46')](_0xe50937)+_0x0c15('0x4d'),'type':_0x2cb590[_0x0c15('0xf')][_0x0c15('0x49')],'nolimit':!![],'sort':'name','filter':_0x2cb590['query'][_0x0c15('0x4e')]}};_0x566d39[_0x0c15('0xf')]=Object['assign'](_0x566d39['query'],_0x2cb590['query']);delete _0x566d39[_0x0c15('0xf')]['id'];return db['UserProfile']['getResources'](_0x566d39);}return db[_0x4fbc7c][_0x0c15('0x3a')](_0x483952);})[_0x0c15('0x15')](function(_0x3301a4){_0x46094b['count']=_0x3301a4[_0x0c15('0x9')];_0x4acbad=_0x3301a4[_0x0c15('0x23')];return rtq[_0x0c15('0x4f')](_0x2cb590,_0xe50937);})['then'](function(_0x4f6aad){_0x2acad1=_0x4f6aad[_0x0c15('0x23')];return rtq['initializeQueues'](_0x4acbad,_0x2acad1,_0xe50937,_0x2cb590[_0x0c15('0xf')][_0x0c15('0x49')]);})[_0x0c15('0x15')](function(_0x293373){_0x46094b[_0x0c15('0x23')]=_0x293373;return _0x46094b;})[_0x0c15('0x15')](respondWithFilteredResult(_0x532af4,_0x483952))['catch'](APIHandleError(_0x532af4));}; \ No newline at end of file +var _0x919f=['Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','join','getAgentIdsByQueues','rows','getAgentIdsByStatus','length','map','User','fieldName','type','key','role','agent','getOptions','raw','push','sequelize','FIELD(id,','order','forEach','*pause','Pause','merge','where','user','userProfileId','Agents','online','extraQueryConditions','assign','UserProfile','getResources','findAndCountAll','find','filterAgentAttributes','pause','voiceStatus','talking','Status','getRealtimeAgentsQueryFields','pick','catch','getQueues','startCase','Queue','rawAttributes','fields','name','voice','outbound','dialActive','dialMethod','QueueCampaigns','filter','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','handleError','offset','limit','count','set','Content-Range','json','getAgents','getChannels','globalQueueFilter','globalStatusFilter','query','pauseTypeFilter','resolve','then','isValidChannel','channel','format'];(function(_0x449e2f,_0x1a1a84){var _0x6b34fe=function(_0x2e6e93){while(--_0x2e6e93){_0x449e2f['push'](_0x449e2f['shift']());}};_0x6b34fe(++_0x1a1a84);}(_0x919f,0x93));var _0xf919=function(_0x5c5edf,_0x30cad6){_0x5c5edf=_0x5c5edf-0x0;var _0x4b83a9=_0x919f[_0x5c5edf];return _0x4b83a9;};'use strict';var _=require(_0xf919('0x0'));var util=require(_0xf919('0x1'));var rta=require(_0xf919('0x2'));var rtq=require('../../components/realtime/queues');var qs=require(_0xf919('0x3'));var utils=require(_0xf919('0x4'));var db=require(_0xf919('0x5'))['db'];var APIBadRequestError=require(_0xf919('0x6'))['APIBadRequestError'];var APIHandleError=require(_0xf919('0x6'))[_0xf919('0x7')];function respondWithFilteredResult(_0xf443b5,_0x421e43){return function(_0x36344c){if(_0x36344c){var _0x521baa=typeof _0x421e43[_0xf919('0x8')]==='undefined'&&typeof _0x421e43[_0xf919('0x9')]==='undefined';var _0x2fb0ba=_0x36344c[_0xf919('0xa')];var _0x190a31=_0x521baa?0x0:_0x421e43[_0xf919('0x8')];var _0x5914eb=_0x521baa?_0x36344c[_0xf919('0xa')]:_0x421e43['offset']+_0x421e43['limit'];var _0x4c3e85;if(_0x5914eb>=_0x2fb0ba){_0x5914eb=_0x2fb0ba;_0x4c3e85=0xc8;}else{_0x4c3e85=0xce;}_0xf443b5['status'](_0x4c3e85);return _0xf443b5[_0xf919('0xb')](_0xf919('0xc'),_0x190a31+'-'+_0x5914eb+'/'+_0x2fb0ba)[_0xf919('0xd')](_0x36344c);}return null;};}exports[_0xf919('0xe')]=function(_0x4f068e,_0x4de192){var _0x536748={'count':0x0,'rows':[]};var _0x301a16={};var _0x18676f;var _0x597ed9=utils[_0xf919('0xf')]();var _0x4fc0c5;var _0x54a2d5;var _0x94034b=_0x4f068e['query'][_0xf919('0x10')];var _0x2acf24=_0x4f068e['query'][_0xf919('0x11')];var _0x24260=_0x4f068e[_0xf919('0x12')][_0xf919('0x13')];var _0x3aefd0=_0x2acf24==='pause'||_0x2acf24==='*pause'?!![]:![];var _0x2a2d3a=[];var _0x32db58;var _0x3f1b25;Promise[_0xf919('0x14')]()[_0xf919('0x15')](function(){if(_0x4f068e['query']['channel']){if(!utils[_0xf919('0x16')](_0x4f068e[_0xf919('0x12')][_0xf919('0x17')])){throw new APIBadRequestError(util[_0xf919('0x18')](_0xf919('0x19'),_0x4f068e[_0xf919('0x12')][_0xf919('0x17')]));}_0x18676f=_0x4f068e[_0xf919('0x12')][_0xf919('0x17')][_0xf919('0x1a')]();}if(!_0x4f068e[_0xf919('0x12')]['sort']||!_0x4f068e[_0xf919('0x12')][_0xf919('0x1b')][_0xf919('0x1c')](_0xf919('0x1d'))){_0x4f068e[_0xf919('0x12')]['sort']=rta[_0xf919('0x1e')](_0x4f068e[_0xf919('0x12')][_0xf919('0x1b')]);return;}var _0x2f463d=rta['getUpdatedSortOptions'](_0x4f068e[_0xf919('0x12')][_0xf919('0x1b')]);_0x4f068e[_0xf919('0x12')][_0xf919('0x1b')]=_0x2f463d['fields'][_0xf919('0x1f')](',');_0x32db58=_0x2f463d['order'];})[_0xf919('0x15')](function(){if(!_0x94034b){return[];}return rta[_0xf919('0x20')](_0x94034b,_0x18676f);})[_0xf919('0x15')](function(_0x2de9ec){_0x2a2d3a=_0x2de9ec;return rta['getRealtimeAgents']();})['then'](function(_0x42c727){_0x54a2d5=_0x42c727[_0xf919('0x21')];if((!_0x2acf24||_0x3aefd0)&&!_0x32db58){return _0x2a2d3a;}if(_0x32db58&&!_0x2acf24){return rta['getSortedAgentsIdsByStatus'](_0x54a2d5,_0x2a2d3a,_0x32db58);}else{return rta[_0xf919('0x22')](_0x54a2d5,_0x2a2d3a,_0x2acf24);}})[_0xf919('0x15')](function(_0x16081c){_0x2a2d3a=_0x16081c;var _0x5b0963=![];if(_0x2a2d3a[_0xf919('0x23')]===0x0){if(_0x94034b||_0x2acf24){_0x5b0963=!![];}if(_0x3aefd0){_0x5b0963=![];}}if(_0x5b0963){return _0x536748;}var _0x1440da=_[_0xf919('0x24')](db[_0xf919('0x25')]['rawAttributes'],function(_0x58981c){return{'name':_0x58981c[_0xf919('0x26')],'type':_0x58981c[_0xf919('0x27')][_0xf919('0x28')]};});_0x4f068e[_0xf919('0x12')][_0xf919('0x29')]=_0xf919('0x2a');_0x301a16=qs[_0xf919('0x2b')](_0x1440da,_0x4f068e);_0x301a16[_0xf919('0x2c')]=!![];var _0x1fbfe1=[];if(_0x2a2d3a['length']>0x0){_0x1fbfe1[_0xf919('0x2d')]({'id':{'$in':_0x2a2d3a}});if(_0x32db58&&!_0x2acf24){_0x3f1b25=[db[_0xf919('0x2e')]['literal'](_0xf919('0x2f')+_0x2a2d3a+')')];_0x301a16[_0xf919('0x30')]=_0x3f1b25;}}if(_0x3aefd0){_0x597ed9[_0xf919('0x31')](function(_0x492daa){var _0x1b4083=!![];if(_0x2acf24===_0xf919('0x32')&&_0x18676f!==_0x492daa){_0x1b4083=![];}_0x1fbfe1[_0xf919('0x2d')]({[_0x492daa+'Pause']:_0x1b4083});});if(_0x24260){_0x1fbfe1[_0xf919('0x2d')]({'pauseType':_0x24260});}}else if(_0x2acf24){_0x597ed9[_0xf919('0x31')](function(_0x24cd2a){_0x1fbfe1['push']({[_0x24cd2a+_0xf919('0x33')]:![]});});}_0x301a16['where']=_[_0xf919('0x34')](_0x301a16[_0xf919('0x35')],{'$and':_0x1fbfe1});if(_0x4f068e['user'][_0xf919('0x29')]===_0xf919('0x36')){var _0x3a0f41={'params':{'id':_0x4f068e['user'][_0xf919('0x37')]},'query':{'section':_0xf919('0x38'),'role':_0xf919('0x2a'),'raw':!![],'ids':_0x2a2d3a,'customSorting':_0x3f1b25}};if(_0x4f068e[_0xf919('0x12')]['online']){_0x3a0f41[_0xf919('0x12')][_0xf919('0x39')]=!![];}if(_0x3aefd0){_0x3a0f41['query'][_0xf919('0x3a')]=_0x1fbfe1;}_0x3a0f41[_0xf919('0x12')]=Object[_0xf919('0x3b')](_0x3a0f41['query'],_0x4f068e[_0xf919('0x12')]);return db[_0xf919('0x3c')][_0xf919('0x3d')](_0x3a0f41);}return db[_0xf919('0x25')][_0xf919('0x3e')](_0x301a16);})[_0xf919('0x15')](function(_0x2c5758){_0x536748[_0xf919('0xa')]=_0x2c5758[_0xf919('0xa')];_0x4fc0c5=_0x2c5758[_0xf919('0x21')];return _0x4fc0c5['map'](function(_0x5e2c38){var _0x5225fd=_[_0xf919('0x3f')](_0x54a2d5,['id',_0x5e2c38['id']]);if(_0x5225fd){var _0x24e650=rta[_0xf919('0x40')](_0x5225fd);_['merge'](_0x5e2c38,_0x24e650);}_0x5e2c38[_0xf919('0x1d')]=rta['getAgentStatus'](_0x5e2c38);if(_0x5e2c38[_0xf919('0x1d')][_0xf919('0x1c')](_0xf919('0x41'))){_0x597ed9[_0xf919('0x31')](function(_0x45a7af){if(_0x5e2c38[_0x45a7af+_0xf919('0x33')]){if(_0x45a7af==='voice'){if(_0x5e2c38[_0xf919('0x42')]!==_0xf919('0x43')){_0x5e2c38[_0xf919('0x42')]=_0xf919('0x41');}}else{_0x5e2c38[_0x45a7af+_0xf919('0x44')]=_0xf919('0x41');}}});}return _0x5e2c38;});})[_0xf919('0x15')](function(_0x2a9b44){if(!_0x32db58||_0x3f1b25){return _0x2a9b44;}return rta['sortAgentsByStatus'](_0x2a9b44,_0x32db58);})[_0xf919('0x15')](function(_0xdf3d27){var _0x9c6476=rta[_0xf919('0x45')]();_0x536748[_0xf919('0x21')]=_0xdf3d27[_0xf919('0x24')](function(_0x4a08b4){return _[_0xf919('0x46')](_0x4a08b4,_0x9c6476);});return _0x536748;})[_0xf919('0x15')](respondWithFilteredResult(_0x4de192,_0x301a16))[_0xf919('0x47')](APIHandleError(_0x4de192));};exports[_0xf919('0x48')]=function(_0x4f8245,_0x28d297){var _0x4883c8={'count':0x0,'rows':[]};var _0x2e0a99={};var _0x363eb6;var _0x5e96f2;var _0x44f892;Promise[_0xf919('0x14')]()[_0xf919('0x15')](function(){if(_0x4f8245[_0xf919('0x12')]['channel']){if(!utils[_0xf919('0x16')](_0x4f8245['query'][_0xf919('0x17')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x4f8245[_0xf919('0x12')][_0xf919('0x17')]));}_0x363eb6=_0x4f8245[_0xf919('0x12')][_0xf919('0x17')]['toLowerCase']();}var _0x1f6614=_[_0xf919('0x49')](_0x363eb6)+_0xf919('0x4a');var _0x15a66d=_[_0xf919('0x24')](db[_0x1f6614][_0xf919('0x4b')],function(_0x73835a){return{'name':_0x73835a['fieldName'],'type':_0x73835a[_0xf919('0x27')][_0xf919('0x28')]};});if(!_0x4f8245[_0xf919('0x12')][_0xf919('0x4c')]){var _0x4315fe=['id',_0xf919('0x4d')];if(_0x363eb6===_0xf919('0x4e')){_0x4315fe[_0xf919('0x2d')](_0xf919('0x27'));if(_0x4f8245['query']['type']===_0xf919('0x4f')){_0x4315fe[_0xf919('0x2d')]([_0xf919('0x50'),_0xf919('0x51')]);}}_0x4f8245[_0xf919('0x12')][_0xf919('0x4c')]=_0x4315fe[_0xf919('0x1f')](',');}_0x2e0a99=qs[_0xf919('0x2b')](_0x15a66d,_0x4f8245);if(_0x4f8245[_0xf919('0x36')][_0xf919('0x29')]==='user'){var _0x4ebab8={'params':{'id':_0x4f8245[_0xf919('0x36')][_0xf919('0x37')]},'query':{'section':_0x363eb6===_0xf919('0x4e')&&_0x4f8245[_0xf919('0x12')][_0xf919('0x27')]===_0xf919('0x4f')?_0xf919('0x52'):_[_0xf919('0x49')](_0x363eb6)+'Queues','type':_0x4f8245[_0xf919('0x12')][_0xf919('0x27')],'nolimit':!![],'sort':_0xf919('0x4d'),'filter':_0x4f8245['query'][_0xf919('0x53')]}};_0x4ebab8[_0xf919('0x12')]=Object[_0xf919('0x3b')](_0x4ebab8['query'],_0x4f8245[_0xf919('0x12')]);delete _0x4ebab8['query']['id'];return db['UserProfile'][_0xf919('0x3d')](_0x4ebab8);}return db[_0x1f6614][_0xf919('0x3e')](_0x2e0a99);})[_0xf919('0x15')](function(_0x2d38b0){_0x4883c8[_0xf919('0xa')]=_0x2d38b0[_0xf919('0xa')];_0x5e96f2=_0x2d38b0[_0xf919('0x21')];return rtq[_0xf919('0x54')](_0x4f8245,_0x363eb6);})[_0xf919('0x15')](function(_0x1b251d){_0x44f892=_0x1b251d[_0xf919('0x21')];return rtq[_0xf919('0x55')](_0x5e96f2,_0x44f892,_0x363eb6,_0x4f8245[_0xf919('0x12')][_0xf919('0x27')]);})['then'](function(_0x3f4fdb){_0x4883c8[_0xf919('0x21')]=_0x3f4fdb;return _0x4883c8;})['then'](respondWithFilteredResult(_0x28d297,_0x2e0a99))[_0xf919('0x47')](APIHandleError(_0x28d297));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 89cdd39..2297761 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5b1892,_0x24ec5b){var _0xeddceb=function(_0x5f5a56){while(--_0x5f5a56){_0x5b1892['push'](_0x5b1892['shift']());}};_0xeddceb(++_0x24ec5b);}(_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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x45ac44,_0x101b0a){var _0x3a4e4a=function(_0x25d401){while(--_0x25d401){_0x45ac44['push'](_0x45ac44['shift']());}};_0x3a4e4a(++_0x101b0a);}(_0xedd9,0xfc));var _0x9edd=function(_0x2e8a2f,_0x51a80){_0x2e8a2f=_0x2e8a2f-0x0;var _0xa6875=_0xedd9[_0x2e8a2f];return _0xa6875;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index ec6fb9e..5a1441c 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 _0x6455=['INTEGER','STRING','DATE','sequelize'];(function(_0x264545,_0x214037){var _0x114d10=function(_0x9e3461){while(--_0x9e3461){_0x264545['push'](_0x264545['shift']());}};_0x114d10(++_0x214037);}(_0x6455,0x97));var _0x5645=function(_0x19c5c1,_0x279326){_0x19c5c1=_0x19c5c1-0x0;var _0x59172f=_0x6455[_0x19c5c1];return _0x59172f;};'use strict';var Sequelize=require(_0x5645('0x0'));module['exports']={'state':{'type':Sequelize[_0x5645('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x5645('0x2')]},'scheduledat':{'type':Sequelize[_0x5645('0x3')]},'uniqueid':{'type':Sequelize[_0x5645('0x2')]},'starttime':{'type':Sequelize[_0x5645('0x3')]},'responsetime':{'type':Sequelize[_0x5645('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x5645('0x2')]},'campaigntype':{'type':Sequelize[_0x5645('0x2')]},'membername':{'type':Sequelize[_0x5645('0x2')]}}; \ No newline at end of file +var _0x90b1=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x2d0f9f,_0x5e62d3){var _0x68047d=function(_0x4f3534){while(--_0x4f3534){_0x2d0f9f['push'](_0x2d0f9f['shift']());}};_0x68047d(++_0x5e62d3);}(_0x90b1,0x1bb));var _0x190b=function(_0x1005d4,_0x5199ab){_0x1005d4=_0x1005d4-0x0;var _0x421977=_0x90b1[_0x1005d4];return _0x421977;};'use strict';var Sequelize=require(_0x190b('0x0'));module[_0x190b('0x1')]={'state':{'type':Sequelize[_0x190b('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x190b('0x3')]},'starttime':{'type':Sequelize[_0x190b('0x4')]},'responsetime':{'type':Sequelize[_0x190b('0x4')]},'ringtime':{'type':Sequelize[_0x190b('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 60445a0..390a76c 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 _0x9975=['define','ReportAgentPreview','report_agent_preview','util','../../config/logger','api','bluebird','request-promise','./reportAgentPreview.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9975,0x17d));var _0x5997=function(_0x5bc526,_0x270710){_0x5bc526=_0x5bc526-0x0;var _0x5d3c3b=_0x9975[_0x5bc526];return _0x5d3c3b;};'use strict';var _=require('lodash');var util=require(_0x5997('0x0'));var logger=require(_0x5997('0x1'))(_0x5997('0x2'));var moment=require('moment');var BPromise=require(_0x5997('0x3'));var rp=require(_0x5997('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5997('0x5'));module['exports']=function(_0x639caa,_0x42d681){return _0x639caa[_0x5997('0x6')](_0x5997('0x7'),attributes,{'tableName':_0x5997('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8076=['moment','request-promise','path','rimraf','../../config/environment','ReportAgentPreview','lodash','util','../../config/logger'];(function(_0x5c7e87,_0x38fa46){var _0x3e232d=function(_0x1e64d9){while(--_0x1e64d9){_0x5c7e87['push'](_0x5c7e87['shift']());}};_0x3e232d(++_0x38fa46);}(_0x8076,0x14a));var _0x6807=function(_0x36fd4a,_0x1ba84b){_0x36fd4a=_0x36fd4a-0x0;var _0x299ded=_0x8076[_0x36fd4a];return _0x299ded;};'use strict';var _=require(_0x6807('0x0'));var util=require(_0x6807('0x1'));var logger=require(_0x6807('0x2'))('api');var moment=require(_0x6807('0x3'));var BPromise=require('bluebird');var rp=require(_0x6807('0x4'));var fs=require('fs');var path=require(_0x6807('0x5'));var rimraf=require(_0x6807('0x6'));var config=require(_0x6807('0x7'));var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0x56519c,_0x41833d){return _0x56519c['define'](_0x6807('0x8'),attributes,{'tableName':'report_agent_preview','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 9f03233..7e7271a 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 _0xd415=['info','request\x20sent','debug','stringify','error','ReportAgentPreview,\x20%s,\x20%s','message','result','CreateReportAgentPreview','ReportAgentPreview','body','options','raw','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then'];(function(_0x3bda7b,_0x42ef6c){var _0x290a3f=function(_0x1ecb12){while(--_0x1ecb12){_0x3bda7b['push'](_0x3bda7b['shift']());}};_0x290a3f(++_0x42ef6c);}(_0xd415,0x1e2));var _0x5d41=function(_0x13fe8c,_0x58472c){_0x13fe8c=_0x13fe8c-0x0;var _0x3e3ef4=_0xd415[_0x13fe8c];return _0x3e3ef4;};'use strict';var _=require('lodash');var util=require(_0x5d41('0x0'));var moment=require(_0x5d41('0x1'));var BPromise=require(_0x5d41('0x2'));var rs=require(_0x5d41('0x3'));var fs=require('fs');var Redis=require(_0x5d41('0x4'));var db=require(_0x5d41('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5d41('0x6'));var config=require(_0x5d41('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5d41('0x8')][_0x5d41('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a7e9d,_0x368c7d,_0x4fc872){return new BPromise(function(_0x3dc8cd,_0x4c8a53){return client[_0x5d41('0xa')](_0x4a7e9d,_0x4fc872)[_0x5d41('0xb')](function(_0x189d26){logger[_0x5d41('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x368c7d,_0x5d41('0xd'));logger[_0x5d41('0xe')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x368c7d,'request\x20sent',JSON[_0x5d41('0xf')](_0x189d26));if(_0x189d26[_0x5d41('0x10')]){if(_0x189d26['error']['code']===0x1f4){logger['error'](_0x5d41('0x11'),_0x368c7d,_0x189d26[_0x5d41('0x10')]['message']);return _0x4c8a53(_0x189d26[_0x5d41('0x10')][_0x5d41('0x12')]);}logger[_0x5d41('0x10')](_0x5d41('0x11'),_0x368c7d,_0x189d26[_0x5d41('0x10')]['message']);return _0x3dc8cd(_0x189d26[_0x5d41('0x10')][_0x5d41('0x12')]);}else{logger[_0x5d41('0xc')](_0x5d41('0x11'),_0x368c7d,_0x5d41('0xd'));_0x3dc8cd(_0x189d26[_0x5d41('0x13')][_0x5d41('0x12')]);}})['catch'](function(_0x1b8af3){logger[_0x5d41('0x10')](_0x5d41('0x11'),_0x368c7d,_0x1b8af3);_0x4c8a53(_0x1b8af3);});});}exports[_0x5d41('0x14')]=function(_0x285596){var _0x37e946=this;return new Promise(function(_0x2c1dfd,_0xe64d04){return db[_0x5d41('0x15')]['create'](_0x285596[_0x5d41('0x16')],{'raw':_0x285596[_0x5d41('0x17')]?_0x285596['options'][_0x5d41('0x18')]===undefined?!![]:![]:!![]})[_0x5d41('0xb')](function(_0x4377d0){logger[_0x5d41('0xc')]('CreateReportAgentPreview',_0x285596);logger[_0x5d41('0xe')]('CreateReportAgentPreview',_0x285596,JSON[_0x5d41('0xf')](_0x4377d0));_0x2c1dfd(_0x4377d0);})[_0x5d41('0x19')](function(_0x70508c){logger[_0x5d41('0x10')](_0x5d41('0x14'),_0x70508c['message'],_0x285596);_0xe64d04(_0x37e946[_0x5d41('0x10')](0x1f4,_0x70508c['message']));});});}; \ No newline at end of file +var _0xb502=['util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateReportAgentPreview','ReportAgentPreview','create','options','raw','debug','lodash'];(function(_0x4f21c4,_0x960024){var _0x2f9fa6=function(_0x26f914){while(--_0x26f914){_0x4f21c4['push'](_0x4f21c4['shift']());}};_0x2f9fa6(++_0x960024);}(_0xb502,0x9b));var _0x2b50=function(_0x23b87e,_0x1914d7){_0x23b87e=_0x23b87e-0x0;var _0x54cebc=_0xb502[_0x23b87e];return _0x54cebc;};'use strict';var _=require(_0x2b50('0x0'));var util=require(_0x2b50('0x1'));var moment=require('moment');var BPromise=require(_0x2b50('0x2'));var rs=require(_0x2b50('0x3'));var fs=require('fs');var Redis=require(_0x2b50('0x4'));var db=require(_0x2b50('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2b50('0x6'));var config=require(_0x2b50('0x7'));var jayson=require(_0x2b50('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x108258,_0x270f9b,_0x2d8757){return new BPromise(function(_0x354302,_0x105503){return client[_0x2b50('0x9')](_0x108258,_0x2d8757)[_0x2b50('0xa')](function(_0x30a97){logger[_0x2b50('0xb')](_0x2b50('0xc'),_0x270f9b,_0x2b50('0xd'));logger['debug'](_0x2b50('0xe'),_0x270f9b,'request\x20sent',JSON[_0x2b50('0xf')](_0x30a97));if(_0x30a97[_0x2b50('0x10')]){if(_0x30a97[_0x2b50('0x10')][_0x2b50('0x11')]===0x1f4){logger[_0x2b50('0x10')](_0x2b50('0xc'),_0x270f9b,_0x30a97[_0x2b50('0x10')][_0x2b50('0x12')]);return _0x105503(_0x30a97[_0x2b50('0x10')]['message']);}logger['error'](_0x2b50('0xc'),_0x270f9b,_0x30a97['error'][_0x2b50('0x12')]);return _0x354302(_0x30a97[_0x2b50('0x10')][_0x2b50('0x12')]);}else{logger[_0x2b50('0xb')](_0x2b50('0xc'),_0x270f9b,_0x2b50('0xd'));_0x354302(_0x30a97['result'][_0x2b50('0x12')]);}})[_0x2b50('0x13')](function(_0x293468){logger['error'](_0x2b50('0xc'),_0x270f9b,_0x293468);_0x105503(_0x293468);});});}exports[_0x2b50('0x14')]=function(_0x367645){var _0x349c8a=this;return new Promise(function(_0x1558a3,_0x3a8919){return db[_0x2b50('0x15')][_0x2b50('0x16')](_0x367645['body'],{'raw':_0x367645[_0x2b50('0x17')]?_0x367645['options'][_0x2b50('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x41ab09){logger[_0x2b50('0xb')](_0x2b50('0x14'),_0x367645);logger[_0x2b50('0x19')]('CreateReportAgentPreview',_0x367645,JSON[_0x2b50('0xf')](_0x41ab09));_0x1558a3(_0x41ab09);})['catch'](function(_0x111c8a){logger[_0x2b50('0x10')]('CreateReportAgentPreview',_0x111c8a[_0x2b50('0x12')],_0x367645);_0x3a8919(_0x349c8a[_0x2b50('0x10')](0x1f4,_0x111c8a['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 48a2559..e051ba7 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 _0x478d=['smsQueues','/whatsapp/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outboundChannels','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','/campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','mail','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','multer','util','path','express','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x478d,0x89));var _0xd478=function(_0x18cebd,_0x5f138f){_0x18cebd=_0x18cebd-0x0;var _0x4c702f=_0x478d[_0x18cebd];return _0x4c702f;};'use strict';var multer=require(_0xd478('0x0'));var util=require(_0xd478('0x1'));var path=require(_0xd478('0x2'));var express=require(_0xd478('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xd478('0x4'));router[_0xd478('0x5')](_0xd478('0x6'),auth[_0xd478('0x7')](),controller[_0xd478('0x8')]);router[_0xd478('0x5')](_0xd478('0x9'),auth[_0xd478('0x7')](),controller[_0xd478('0xa')]);router[_0xd478('0x5')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xd478('0x7')](),controller[_0xd478('0xb')]);router[_0xd478('0x5')](_0xd478('0xc'),auth[_0xd478('0x7')](),controller[_0xd478('0xd')]);router['get']('/chat/queues',auth['isAuthenticated'](),controller[_0xd478('0xe')]);router['get'](_0xd478('0xf'),auth[_0xd478('0x7')](),controller[_0xd478('0x10')]);router[_0xd478('0x5')](_0xd478('0x11'),auth[_0xd478('0x7')](),controller['mailAccounts']);router['get'](_0xd478('0x12'),auth[_0xd478('0x7')](),controller[_0xd478('0x13')]);router['get'](_0xd478('0x14'),auth['isAuthenticated'](),controller[_0xd478('0x15')]);router[_0xd478('0x5')](_0xd478('0x16'),auth[_0xd478('0x7')](),controller['whatsappQueues']);router['get']('/fax/queues',auth['isAuthenticated'](),controller[_0xd478('0x17')]);router[_0xd478('0x5')](_0xd478('0x18'),auth[_0xd478('0x7')](),controller['voiceQueuesPreview']);router[_0xd478('0x5')](_0xd478('0x19'),auth[_0xd478('0x7')](),controller[_0xd478('0x1a')]);router[_0xd478('0x5')](_0xd478('0x1b'),auth['isAuthenticated'](),controller[_0xd478('0x1c')]);router['get'](_0xd478('0x1d'),auth[_0xd478('0x7')](),controller[_0xd478('0x1e')]);router[_0xd478('0x5')](_0xd478('0x1f'),auth[_0xd478('0x7')](),controller['voiceQueuesChannelRedirect']);router[_0xd478('0x5')](_0xd478('0x20'),auth[_0xd478('0x7')](),controller[_0xd478('0x21')]);router[_0xd478('0x22')](_0xd478('0x20'),auth[_0xd478('0x7')](),controller[_0xd478('0x23')]);router[_0xd478('0x5')](_0xd478('0x24'),auth['isAuthenticated'](),controller['outbound']);router[_0xd478('0x5')]('/outbound/channels',auth[_0xd478('0x7')](),controller[_0xd478('0x25')]);router[_0xd478('0x5')]('/agents',auth[_0xd478('0x7')](),controller['agents']);router['put'](_0xd478('0x26'),auth[_0xd478('0x7')](),controller[_0xd478('0x27')]);router['get'](_0xd478('0x28'),auth[_0xd478('0x7')](),controller[_0xd478('0x29')]);router[_0xd478('0x5')](_0xd478('0x2a'),auth[_0xd478('0x7')](),controller['trunks']);router[_0xd478('0x5')](_0xd478('0x2b'),auth[_0xd478('0x7')](),controller['campaigns']);router['get']('/fax/accounts',auth[_0xd478('0x7')](),controller[_0xd478('0x2c')]);router[_0xd478('0x5')](_0xd478('0x2d'),auth[_0xd478('0x7')](),controller[_0xd478('0x2e')]);router[_0xd478('0x5')](_0xd478('0x2f'),auth[_0xd478('0x7')](),controller[_0xd478('0x30')]);router['get'](_0xd478('0x31'),auth[_0xd478('0x7')](),controller[_0xd478('0x32')]);router['get'](_0xd478('0x33'),auth[_0xd478('0x7')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0xd478('0x5')]('/sms/queues/waitinginteractions',auth[_0xd478('0x7')](),controller['smsQueuesWaitingInteractions']);router[_0xd478('0x5')](_0xd478('0x34'),auth[_0xd478('0x7')](),controller[_0xd478('0x35')]);router[_0xd478('0x5')]('/fax/queues/waitinginteractions',auth[_0xd478('0x7')](),controller[_0xd478('0x36')]);router['post']('/mail/queues/:id/notify',auth[_0xd478('0x7')](),controller[_0xd478('0x37')](_0xd478('0x38')));router['get'](_0xd478('0x39'),auth[_0xd478('0x7')](),controller[_0xd478('0x3a')]);router[_0xd478('0x3b')](_0xd478('0x3c'),auth['isAuthenticated'](),controller['queueNotify'](_0xd478('0x3d')));router[_0xd478('0x5')](_0xd478('0x3e'),auth[_0xd478('0x7')](),controller[_0xd478('0x3f')]);router[_0xd478('0x3b')]('/fax/queues/:id/notify',auth[_0xd478('0x7')](),controller['queueNotify']('fax'));router[_0xd478('0x5')](_0xd478('0x40'),auth[_0xd478('0x7')](),controller[_0xd478('0x41')]);router[_0xd478('0x3b')](_0xd478('0x42'),auth['isAuthenticated'](),controller['queueNotify'](_0xd478('0x43')));router['get'](_0xd478('0x44'),auth[_0xd478('0x7')](),controller[_0xd478('0x45')]);router[_0xd478('0x3b')](_0xd478('0x46'),auth[_0xd478('0x7')](),controller['queueNotify'](_0xd478('0x47')));router['post'](_0xd478('0x48'),auth[_0xd478('0x7')](),controller['queueNotify'](_0xd478('0x49')));router[_0xd478('0x5')](_0xd478('0x4a'),auth[_0xd478('0x7')](),controller[_0xd478('0x4b')]);router[_0xd478('0x5')](_0xd478('0x4c'),auth[_0xd478('0x7')](),controller[_0xd478('0x4d')]);router[_0xd478('0x3b')]('/agents/:id/notify',auth[_0xd478('0x7')](),controller[_0xd478('0x4e')]);module['exports']=router; \ No newline at end of file +var _0x8dd7=['/outbound','outbound','/outbound/channels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','/trunks','trunks','/campaigns','campaigns','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','mail','showMailQueues','post','/chat/queues/:id/notify','queueNotify','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','showWhatsappQueues','agentNotify','util','path','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','mailQueues','/mail/accounts','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','updateVoiceQueue'];(function(_0x50e417,_0x5a1bff){var _0x56fec0=function(_0xab353){while(--_0xab353){_0x50e417['push'](_0x50e417['shift']());}};_0x56fec0(++_0x5a1bff);}(_0x8dd7,0x154));var _0x78dd=function(_0xb64e9e,_0x519fb2){_0xb64e9e=_0xb64e9e-0x0;var _0x1c63f4=_0x8dd7[_0xb64e9e];return _0x1c63f4;};'use strict';var multer=require('multer');var util=require(_0x78dd('0x0'));var path=require(_0x78dd('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x78dd('0x2'));var controller=require(_0x78dd('0x3'));router[_0x78dd('0x4')](_0x78dd('0x5'),auth[_0x78dd('0x6')](),controller['voiceChannels']);router[_0x78dd('0x4')]('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller[_0x78dd('0x7')]);router[_0x78dd('0x4')]('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller[_0x78dd('0x8')]);router[_0x78dd('0x4')](_0x78dd('0x9'),auth[_0x78dd('0x6')](),controller[_0x78dd('0xa')]);router[_0x78dd('0x4')](_0x78dd('0xb'),auth[_0x78dd('0x6')](),controller['chatQueues']);router[_0x78dd('0x4')]('/mail/queues',auth[_0x78dd('0x6')](),controller[_0x78dd('0xc')]);router[_0x78dd('0x4')](_0x78dd('0xd'),auth[_0x78dd('0x6')](),controller['mailAccounts']);router['get']('/openchannel/queues',auth[_0x78dd('0x6')](),controller[_0x78dd('0xe')]);router[_0x78dd('0x4')](_0x78dd('0xf'),auth[_0x78dd('0x6')](),controller[_0x78dd('0x10')]);router[_0x78dd('0x4')](_0x78dd('0x11'),auth[_0x78dd('0x6')](),controller[_0x78dd('0x12')]);router[_0x78dd('0x4')](_0x78dd('0x13'),auth['isAuthenticated'](),controller['faxQueues']);router[_0x78dd('0x4')](_0x78dd('0x14'),auth['isAuthenticated'](),controller['voiceQueuesPreview']);router[_0x78dd('0x4')]('/voice/queues/channels',auth[_0x78dd('0x6')](),controller[_0x78dd('0x15')]);router[_0x78dd('0x4')](_0x78dd('0x16'),auth[_0x78dd('0x6')](),controller[_0x78dd('0x17')]);router['get'](_0x78dd('0x18'),auth['isAuthenticated'](),controller[_0x78dd('0x19')]);router[_0x78dd('0x4')](_0x78dd('0x1a'),auth[_0x78dd('0x6')](),controller['voiceQueuesChannelRedirect']);router[_0x78dd('0x4')](_0x78dd('0x1b'),auth['isAuthenticated'](),controller[_0x78dd('0x1c')]);router['put'](_0x78dd('0x1b'),auth[_0x78dd('0x6')](),controller[_0x78dd('0x1d')]);router[_0x78dd('0x4')](_0x78dd('0x1e'),auth[_0x78dd('0x6')](),controller[_0x78dd('0x1f')]);router[_0x78dd('0x4')](_0x78dd('0x20'),auth[_0x78dd('0x6')](),controller['outboundChannels']);router[_0x78dd('0x4')](_0x78dd('0x21'),auth[_0x78dd('0x6')](),controller[_0x78dd('0x22')]);router[_0x78dd('0x23')](_0x78dd('0x24'),auth[_0x78dd('0x6')](),controller[_0x78dd('0x25')]);router['get'](_0x78dd('0x26'),auth[_0x78dd('0x6')](),controller['telephones']);router[_0x78dd('0x4')](_0x78dd('0x27'),auth[_0x78dd('0x6')](),controller[_0x78dd('0x28')]);router[_0x78dd('0x4')](_0x78dd('0x29'),auth[_0x78dd('0x6')](),controller[_0x78dd('0x2a')]);router[_0x78dd('0x4')]('/fax/accounts',auth[_0x78dd('0x6')](),controller[_0x78dd('0x2b')]);router[_0x78dd('0x4')]('/chat/queues/waitinginteractions',auth[_0x78dd('0x6')](),controller[_0x78dd('0x2c')]);router['get'](_0x78dd('0x2d'),auth[_0x78dd('0x6')](),controller['mailQueuesWaitingInteractions']);router[_0x78dd('0x4')](_0x78dd('0x2e'),auth[_0x78dd('0x6')](),controller[_0x78dd('0x2f')]);router[_0x78dd('0x4')](_0x78dd('0x30'),auth[_0x78dd('0x6')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x78dd('0x4')](_0x78dd('0x31'),auth[_0x78dd('0x6')](),controller['smsQueuesWaitingInteractions']);router[_0x78dd('0x4')](_0x78dd('0x32'),auth[_0x78dd('0x6')](),controller[_0x78dd('0x33')]);router['get']('/fax/queues/waitinginteractions',auth[_0x78dd('0x6')](),controller[_0x78dd('0x34')]);router['post'](_0x78dd('0x35'),auth['isAuthenticated'](),controller['queueNotify'](_0x78dd('0x36')));router[_0x78dd('0x4')]('/mail/queues/:id',auth['isAuthenticated'](),controller[_0x78dd('0x37')]);router[_0x78dd('0x38')](_0x78dd('0x39'),auth[_0x78dd('0x6')](),controller[_0x78dd('0x3a')]('chat'));router[_0x78dd('0x4')]('/chat/queues/:id',auth['isAuthenticated'](),controller['showChatQueues']);router[_0x78dd('0x38')](_0x78dd('0x3b'),auth[_0x78dd('0x6')](),controller['queueNotify'](_0x78dd('0x3c')));router[_0x78dd('0x4')](_0x78dd('0x3d'),auth['isAuthenticated'](),controller[_0x78dd('0x3e')]);router['post'](_0x78dd('0x3f'),auth[_0x78dd('0x6')](),controller[_0x78dd('0x3a')](_0x78dd('0x40')));router[_0x78dd('0x4')](_0x78dd('0x41'),auth[_0x78dd('0x6')](),controller[_0x78dd('0x42')]);router['post'](_0x78dd('0x43'),auth[_0x78dd('0x6')](),controller[_0x78dd('0x3a')](_0x78dd('0x44')));router['post'](_0x78dd('0x45'),auth[_0x78dd('0x6')](),controller[_0x78dd('0x3a')](_0x78dd('0x46')));router[_0x78dd('0x4')]('/sms/queues/:id',auth[_0x78dd('0x6')](),controller[_0x78dd('0x47')]);router['get']('/whatsapp/queues/:id',auth[_0x78dd('0x6')](),controller[_0x78dd('0x48')]);router[_0x78dd('0x38')]('/agents/:id/notify',auth['isAuthenticated'](),controller[_0x78dd('0x49')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 706fec4..1495823 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(_0x24cd0a,_0x14ab93){var _0xae7451=function(_0x52b358){while(--_0x52b358){_0x24cd0a['push'](_0x24cd0a['shift']());}};_0xae7451(++_0x14ab93);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'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 _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(_0xa83d49,_0x593632){var _0x1dcb31=function(_0x4c3550){while(--_0x4c3550){_0xa83d49['push'](_0xa83d49['shift']());}};_0x1dcb31(++_0x593632);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var BPromise=require('bluebird');var moment=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var db=require(_0x0baf('0x3'))['db'];var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232a});var mailClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232b});var routingClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){var _0x5f20aa=_0x1d0a0d?_0x1d0a0d:amiClient;return _0x5f20aa[_0x0baf('0x8')](_0x1a10b1,_0x2dcaac)[_0x0baf('0x9')](function(_0x465528){if(_0x465528[_0x0baf('0xa')]){if(_0x465528[_0x0baf('0xa')][_0x0baf('0xb')]===0x1f4){return _0x11b947(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}return _0x5f5030(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}else{_0x5f5030(_0x465528[_0x0baf('0xd')]);}})['catch'](function(_0x5a53e2){_0x11b947(_0x5a53e2);});});}function respondWithResult(_0x465dd7,_0xe4378c){_0xe4378c=_0xe4378c||0xc8;return function(_0x5db689){if(_0x5db689){return _0x465dd7[_0x0baf('0xe')](_0xe4378c)['json'](_0x5db689);}return _0x465dd7[_0x0baf('0xf')](0x194);};}function handleError(_0x49e44b,_0x1c76a8){_0x1c76a8=_0x1c76a8||0x1f4;return function(_0x1f50c3){logger[_0x0baf('0xa')](_0x1f50c3[_0x0baf('0x10')]);if(_0x1f50c3[_0x0baf('0x11')]){delete _0x1f50c3[_0x0baf('0x11')];}_0x49e44b['status'](_0x1c76a8)['send'](_0x1f50c3);};}function findById(_0x2312c7){return function(_0x38395b){if(!_[_0x0baf('0x12')](_0x2312c7)&&!_[_0x0baf('0x12')](_0x38395b)&&!_[_0x0baf('0x12')](_0x38395b[_0x0baf('0x13')])){return _['find'](_0x38395b[_0x0baf('0x13')],function(_0xfbecec){return _0xfbecec['id']==_0x2312c7;});}return null;};}exports[_0x0baf('0x14')]=function(_0x3e9cb4,_0x47070d){return respondWithRpcPromise(_0x0baf('0x15'),_0x3e9cb4['query'])['then'](respondWithResult(_0x47070d,null))[_0x0baf('0x16')](handleError(_0x47070d,null));};exports[_0x0baf('0x17')]=function(_0x32e839,_0x1848e8){return respondWithRpcPromise(_0x0baf('0x18'),_[_0x0baf('0x19')](_0x32e839[_0x0baf('0x1a')],_0x32e839[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1848e8,null))[_0x0baf('0x16')](handleError(_0x1848e8,null));};exports['voiceChannelStopMixMonitor']=function(_0x334bd6,_0x482522){return respondWithRpcPromise(_0x0baf('0x1c'),_['merge'](_0x334bd6['query'],_0x334bd6[_0x0baf('0x1b')]))['then'](respondWithResult(_0x482522,null))['catch'](handleError(_0x482522,null));};exports[_0x0baf('0x1d')]=function(_0x27b59c,_0x34e264){return respondWithRpcPromise(_0x0baf('0x1e'),_0x27b59c[_0x0baf('0x1a')])['then'](respondWithResult(_0x34e264,null))[_0x0baf('0x16')](handleError(_0x34e264,null));};exports[_0x0baf('0x1f')]=function(_0x1ca35a,_0x366e71){return respondWithRpcPromise(_0x0baf('0x1e'),_0x1ca35a[_0x0baf('0x1a')])[_0x0baf('0x9')](findById(_0x1ca35a['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x366e71,null))[_0x0baf('0x16')](handleError(_0x366e71,null));};exports[_0x0baf('0x20')]=function(_0x265915,_0x55c715){return respondWithRpcPromise(_0x0baf('0x21'),_[_0x0baf('0x19')](_0x265915['body'],_0x265915[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x55c715,null))[_0x0baf('0x16')](handleError(_0x55c715,null));};exports[_0x0baf('0x22')]=function(_0xd14f0f,_0x366924){return respondWithRpcPromise(_0x0baf('0x23'),_['merge'](_0xd14f0f[_0x0baf('0x1a')],_0xd14f0f[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x366924,null))[_0x0baf('0x16')](handleError(_0x366924,null));};exports[_0x0baf('0x24')]=function(_0x275ea1,_0x2fc983){return respondWithRpcPromise(_0x0baf('0x25'),_0x275ea1[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x2fc983,null))[_0x0baf('0x16')](handleError(_0x2fc983,null));};exports[_0x0baf('0x26')]=function(_0x45294a,_0x3a3353){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0baf('0x19')](_0x45294a['query'],_0x45294a[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x3a3353,null))[_0x0baf('0x16')](handleError(_0x3a3353,null));};exports[_0x0baf('0x27')]=function(_0x5300a5,_0x1a2b03){return respondWithRpcPromise(_0x0baf('0x28'),_['merge'](_0x5300a5[_0x0baf('0x1a')],_0x5300a5[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1a2b03,null))[_0x0baf('0x16')](handleError(_0x1a2b03,null));};exports[_0x0baf('0x29')]=function(_0x1b0991,_0xe03d82){return respondWithRpcPromise(_0x0baf('0x2a'),_['merge'](_0x1b0991[_0x0baf('0x1a')],_0x1b0991[_0x0baf('0x1b')]))['then'](respondWithResult(_0xe03d82,null))[_0x0baf('0x16')](handleError(_0xe03d82,null));};exports['outbound']=function(_0x5c545f,_0x11bc49){return respondWithRpcPromise(_0x0baf('0x2b'),_0x5c545f['query'])['then'](respondWithResult(_0x11bc49,null))[_0x0baf('0x16')](handleError(_0x11bc49,null));};exports[_0x0baf('0x2c')]=function(_0x3412bc,_0xb2d9ab){return respondWithRpcPromise(_0x0baf('0x2d'),_0x3412bc[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0xb2d9ab,null))[_0x0baf('0x16')](handleError(_0xb2d9ab,null));};exports[_0x0baf('0x2e')]=function(_0x36c6d2,_0x200864){var _0x148540;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2[_0x0baf('0x1a')])['then'](function(_0x3573ce){_0x148540=_0x3573ce;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2['query'],routingClient);})[_0x0baf('0x9')](function(_0x324369){return _[_0x0baf('0x19')]({},_0x324369,_0x148540);})[_0x0baf('0x9')](respondWithResult(_0x200864,null))[_0x0baf('0x16')](handleError(_0x200864,null));};exports[_0x0baf('0x30')]=function(_0x57b581,_0x23ad34){if(_0x57b581[_0x0baf('0x31')]&&_0x57b581['body'][_0x0baf('0x32')]&&_0x57b581[_0x0baf('0x33')]&&_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]){for(var _0x504031 in _0x57b581[_0x0baf('0x31')][_0x0baf('0x32')]){if(_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x0baf('0x34')](_0x504031)){db[_0x0baf('0x35')][_0x0baf('0x36')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':_0x0baf('0x37'),'exitAt':null,'uniqueid':_0x57b581['body'][_0x0baf('0x32')][_0x504031]&&_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')]?{'$notIn':_0x57b581[_0x0baf('0x31')]['interaction'][_0x504031]}:{'$ne':null}}})[_0x0baf('0x9')](function(_0x310240){var _0x27c3ee=moment()[_0x0baf('0x39')](_0x0baf('0x3a'));for(var _0x54ed41=0x0,_0x2a0924=_0x310240[_0x0baf('0x38')];_0x54ed41<_0x2a0924;_0x54ed41+=0x1){_0x310240[_0x54ed41][_0x0baf('0x3b')]({'exitAt':_0x27c3ee});}});for(var _0x1522b0=0x0;_0x1522b0<_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')];_0x1522b0+=0x1){db['MemberReport'][_0x0baf('0x3c')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':'INTERACTION','uniqueid':_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x1522b0],'exitAt':null},'defaults':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'interface':_[_0x0baf('0x12')](_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')])?util['format'](_0x0baf('0x3e'),_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]):_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')],'type':_0x0baf('0x37'),'enterAt':moment()[_0x0baf('0x39')](_0x0baf('0x3a')),'role':_0x0baf('0x3f'),'internal':_0x57b581[_0x0baf('0x33')][_0x0baf('0x40')],'uniqueid':_0x57b581['body']['interaction'][_0x504031][_0x1522b0]}});}}}}return respondWithRpcPromise(_0x0baf('0x41'),{'id':_0x57b581[_0x0baf('0x1b')]['id'],'capacity':_0x57b581[_0x0baf('0x31')][_0x0baf('0x42')]},routingClient)[_0x0baf('0x9')](respondWithResult(_0x23ad34,null))[_0x0baf('0x16')](handleError(_0x23ad34,null));};exports[_0x0baf('0x43')]=function(_0x4b492c,_0x3fe534){return respondWithRpcPromise(_0x0baf('0x44'),_0x4b492c[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x3fe534,null))[_0x0baf('0x16')](handleError(_0x3fe534,null));};exports[_0x0baf('0x45')]=function(_0x5e1849,_0x3eebe5){return respondWithRpcPromise('Trunks',_0x5e1849[_0x0baf('0x1a')])['then'](respondWithResult(_0x3eebe5,null))[_0x0baf('0x16')](handleError(_0x3eebe5,null));};exports['campaigns']=function(_0x35b1a5,_0x4c035b){return respondWithRpcPromise(_0x0baf('0x46'),_0x35b1a5[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x4c035b,null))[_0x0baf('0x16')](handleError(_0x4c035b,null));};exports[_0x0baf('0x47')]=function(_0x576475,_0x21f179){return respondWithRpcPromise(_0x0baf('0x48'),_0x576475[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21f179,null))[_0x0baf('0x16')](handleError(_0x21f179,null));};exports[_0x0baf('0x49')]=function(_0x480834,_0x402f4d){return respondWithRpcPromise(_0x0baf('0x48'),_0x480834[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x480834[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x402f4d,null))[_0x0baf('0x16')](handleError(_0x402f4d,null));};exports['mailQueues']=function(_0x48e855,_0x23f6ea){return respondWithRpcPromise(_0x0baf('0x4a'),_0x48e855[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x23f6ea,null))[_0x0baf('0x16')](handleError(_0x23f6ea,null));};exports[_0x0baf('0x4b')]=function(_0xaa4293,_0x14a667){return respondWithRpcPromise(_0x0baf('0x4a'),_0xaa4293['query'],routingClient)[_0x0baf('0x9')](findById(_0xaa4293[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x14a667,null))[_0x0baf('0x16')](handleError(_0x14a667,null));};exports[_0x0baf('0x4c')]=function(_0xebfc0c,_0x26f5c9){return respondWithRpcPromise('MailAccounts',_0xebfc0c[_0x0baf('0x1a')],mailClient)[_0x0baf('0x9')](respondWithResult(_0x26f5c9,null))[_0x0baf('0x16')](handleError(_0x26f5c9,null));};exports[_0x0baf('0x4d')]=function(_0x1c7d88,_0x1a6d22){return respondWithRpcPromise(_0x0baf('0x4e'),_0x1c7d88[_0x0baf('0x1a')],routingClient)['then'](respondWithResult(_0x1a6d22,null))[_0x0baf('0x16')](handleError(_0x1a6d22,null));};exports['showOpenchannelQueues']=function(_0x3c00e7,_0x5f2fbe){return respondWithRpcPromise('OpenchannelQueues',_0x3c00e7[_0x0baf('0x1a')],routingClient)['then'](findById(_0x3c00e7[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x5f2fbe,null))['catch'](handleError(_0x5f2fbe,null));};exports[_0x0baf('0x4f')]=function(_0xfb6708,_0x156572){return respondWithRpcPromise('SmsQueues',_0xfb6708['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x156572,null))[_0x0baf('0x16')](handleError(_0x156572,null));};exports[_0x0baf('0x50')]=function(_0x7f49e,_0x784e1a){return respondWithRpcPromise('SmsQueues',_0x7f49e[_0x0baf('0x1a')],routingClient)['then'](findById(_0x7f49e['params']['id']))['then'](respondWithResult(_0x784e1a,null))[_0x0baf('0x16')](handleError(_0x784e1a,null));};exports['whatsappQueues']=function(_0x4946d4,_0x11a81e){return respondWithRpcPromise(_0x0baf('0x51'),_0x4946d4[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x11a81e,null))[_0x0baf('0x16')](handleError(_0x11a81e,null));};exports[_0x0baf('0x52')]=function(_0x4c05d6,_0xec3b32){return respondWithRpcPromise(_0x0baf('0x51'),_0x4c05d6[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x4c05d6[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0xec3b32,null))['catch'](handleError(_0xec3b32,null));};exports[_0x0baf('0x53')]=function(_0x468363,_0x29fd46){return respondWithRpcPromise('FaxQueues',_0x468363[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x29fd46,null))[_0x0baf('0x16')](handleError(_0x29fd46,null));};exports[_0x0baf('0x54')]=function(_0x125906,_0x27a959){return respondWithRpcPromise(_0x0baf('0x55'),_0x125906['query'],routingClient)['then'](findById(_0x125906['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x27a959,null))[_0x0baf('0x16')](handleError(_0x27a959,null));};exports[_0x0baf('0x56')]=function(_0x12b9b5,_0x3e65d4){return respondWithRpcPromise(_0x0baf('0x57'),_0x12b9b5['query'])['then'](respondWithResult(_0x3e65d4,null))[_0x0baf('0x16')](handleError(_0x3e65d4,null));};exports['chatQueuesWaitingInteractions']=function(_0x22cd07,_0x3e9b79){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x22cd07[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x3e9b79,null))[_0x0baf('0x16')](handleError(_0x3e9b79,null));};exports[_0x0baf('0x58')]=function(_0x115ff5,_0x33a5af){return respondWithRpcPromise(_0x0baf('0x59'),_0x115ff5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x33a5af,null))['catch'](handleError(_0x33a5af,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x58a079,_0x493784){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x58a079[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x493784,null))[_0x0baf('0x16')](handleError(_0x493784,null));};exports[_0x0baf('0x5a')]=function(_0x5093f5,_0x1be7f2){return respondWithRpcPromise(_0x0baf('0x5b'),_0x5093f5['query'],routingClient)['then'](function(_0x43aecd){if(_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')]!==undefined){var _0x442e5f=_(_0x43aecd[_0x0baf('0x13')])[_0x0baf('0x5d')]([_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')],_0x5093f5['params']['id']])[_0x0baf('0x5e')](_0x0baf('0x5f'))['uniq']()[_0x0baf('0x60')]();return _0x43aecd[_0x0baf('0x13')]['filter'](function(_0x97d385){return _0x442e5f[_0x0baf('0x61')](_0x97d385[_0x0baf('0x5f')])>-0x1;});}else{return _0x43aecd[_0x0baf('0x13')][_0x0baf('0x5d')](function(_0x4fc5af){return _0x4fc5af['queue_id']===parseInt(_0x5093f5[_0x0baf('0x1b')]['id']);});}})[_0x0baf('0x9')](respondWithResult(_0x1be7f2,null))['catch'](handleError(_0x1be7f2,null));};exports[_0x0baf('0x62')]=function(_0x59dad5,_0x21ad25){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x59dad5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21ad25,null))[_0x0baf('0x16')](handleError(_0x21ad25,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3c2bc1,_0x5008c5){return respondWithRpcPromise(_0x0baf('0x63'),_0x3c2bc1[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x5008c5,null))[_0x0baf('0x16')](handleError(_0x5008c5,null));};exports[_0x0baf('0x64')]=function(_0x52e845,_0x866e6e){return respondWithRpcPromise(_0x0baf('0x65'),_0x52e845['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x866e6e,null))[_0x0baf('0x16')](handleError(_0x866e6e,null));};exports[_0x0baf('0x66')]=function(_0x379c54){return function(_0x1cbbcc,_0x250df2){var _0xa4fd1b,_0x1cda78;var _0x44ef57=_[_0x0baf('0x67')](_0x379c54);var _0x3b7abf=_0x379c54===_0x0baf('0x68')?'Website':'Account';return db[_0x44ef57+_0x0baf('0x69')][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1cbbcc[_0x0baf('0x1b')]['id']}})['then'](function(_0x507783){if(_[_0x0baf('0x12')](_0x507783)){throw new Error(_0x44ef57+_0x0baf('0x6b'));}_0xa4fd1b=_0x507783;return db[_0x44ef57+_0x0baf('0x6c')][_0x0baf('0x6a')]({'where':{'id':_0x1cbbcc[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x44ef57+_0x0baf('0x6e')],'as':_0x0baf('0x6e')},{'model':db[_0x44ef57+_0x3b7abf],'as':_0x0baf('0x6f')}]});})['then'](function(_0x1590a5){if(_[_0x0baf('0x12')](_0x1590a5)){throw new Error(_0x44ef57+_0x0baf('0x70'));}_0x1cda78=_0x1590a5;return _0x1590a5[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5d26e6={'uniqueid':_0x379c54+'.'+_0x1cda78['id']+'.'+_0x1cda78['Interaction']['id'],'FromUserId':_0x1cbbcc[_0x0baf('0x33')]['id'],'type':_0x0baf('0x72')};_0x5d26e6[_0x44ef57+'MessageId']=_0x1cda78['id'];_0x5d26e6[_0x44ef57+'InteractionId']=_0x1cda78[_0x0baf('0x6e')]['id'];_0x5d26e6[_0x0baf('0x73')+_0x44ef57+_0x3b7abf+'Id']=_0x1cda78['Account']['id'];_0x5d26e6['To'+_0x44ef57+_0x0baf('0x74')]=_0xa4fd1b['id'];return db[_0x44ef57+_0x0baf('0x75')][_0x0baf('0x76')](_0x5d26e6);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x379c54,'interaction':_0x1cda78[_0x0baf('0x6e')],'message':_0x1cda78,'account':_0x1cda78[_0x0baf('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0baf('0x72'),'appdata':_0xa4fd1b[_0x0baf('0x11')]+','+(_0x1cda78[_0x0baf('0x6f')][_0x0baf('0x78')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x250df2,null))[_0x0baf('0x16')](handleError(_0x250df2,null));};};exports[_0x0baf('0x7a')]=function(_0x1e1adb,_0x3bd15b){var _0x3c37b4,_0x195303;if(_['isNil'](_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x7b')])){throw new Error(_0x0baf('0x7c'));}var _0x457ae8=_0x1e1adb[_0x0baf('0x31')]['channel'];var _0x3761b5=_[_0x0baf('0x67')](_0x457ae8);var _0x2eae1b=_0x457ae8===_0x0baf('0x68')?_0x0baf('0x7d'):'Account';return db['User'][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1e1adb['params']['id'],'role':_0x0baf('0x3f')}})['then'](function(_0x32d8b6){if(_[_0x0baf('0x12')](_0x32d8b6)){throw new Error(_0x0baf('0x7e'));}_0x3c37b4=_0x32d8b6;return db[_0x3761b5+_0x0baf('0x6c')]['findOne']({'where':{'id':_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x3761b5+_0x0baf('0x6e')],'as':'Interaction'},{'model':db[_0x3761b5+_0x2eae1b],'as':'Account'}]});})['then'](function(_0x4d4884){if(_[_0x0baf('0x12')](_0x4d4884)){throw new Error(_0x3761b5+_0x0baf('0x70'));}_0x195303=_0x4d4884;return _0x4d4884[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0baf('0x9')](function(){var _0x597830={'uniqueid':_0x457ae8+'.'+_0x195303['id']+'.'+_0x195303[_0x0baf('0x6e')]['id'],'FromUserId':_0x1e1adb[_0x0baf('0x33')]['id'],'type':_0x0baf('0x3f'),'ToUserId':_0x3c37b4['id']};_0x597830[_0x3761b5+'MessageId']=_0x195303['id'];_0x597830[_0x3761b5+_0x0baf('0x7f')]=_0x195303[_0x0baf('0x6e')]['id'];_0x597830['From'+_0x3761b5+_0x2eae1b+'Id']=_0x195303[_0x0baf('0x6f')]['id'];return db[_0x3761b5+'TransferReport'][_0x0baf('0x76')](_0x597830);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x457ae8,'interaction':_0x195303[_0x0baf('0x6e')],'message':_0x195303,'account':_0x195303['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x3c37b4[_0x0baf('0x11')]+','+(_0x195303['Account'][_0x0baf('0x80')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})[_0x0baf('0x9')](respondWithResult(_0x3bd15b,null))[_0x0baf('0x16')](handleError(_0x3bd15b,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 766454b..68cf89d 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 _0xf537=['get','/:id','/:id/run','post','create','update','delete','destroy','util','path','connect-timeout','Router','../../config/environment','./schedule.controller','isAuthenticated','index'];(function(_0x27d958,_0x29ef87){var _0x53e63e=function(_0x4130ec){while(--_0x4130ec){_0x27d958['push'](_0x27d958['shift']());}};_0x53e63e(++_0x29ef87);}(_0xf537,0x78));var _0x7f53=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf537[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x7f53('0x0'));var path=require(_0x7f53('0x1'));var timeout=require(_0x7f53('0x2'));var express=require('express');var router=express[_0x7f53('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7f53('0x4'));var controller=require(_0x7f53('0x5'));router['get']('/',auth[_0x7f53('0x6')](),controller[_0x7f53('0x7')]);router[_0x7f53('0x8')](_0x7f53('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x7f53('0x8')](_0x7f53('0xa'),auth[_0x7f53('0x6')](),controller['run']);router[_0x7f53('0xb')]('/',auth['isAuthenticated'](),controller[_0x7f53('0xc')]);router['put'](_0x7f53('0x9'),auth['isAuthenticated'](),controller[_0x7f53('0xd')]);router[_0x7f53('0xe')](_0x7f53('0x9'),auth[_0x7f53('0x6')](),controller[_0x7f53('0xf')]);module['exports']=router; \ No newline at end of file +var _0x54b8=['util','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','multer'];(function(_0x4d01f6,_0x20b3a4){var _0x41ffe3=function(_0x2737be){while(--_0x2737be){_0x4d01f6['push'](_0x4d01f6['shift']());}};_0x41ffe3(++_0x20b3a4);}(_0x54b8,0x6f));var _0x854b=function(_0x172f77,_0x2a78c6){_0x172f77=_0x172f77-0x0;var _0x516f32=_0x54b8[_0x172f77];return _0x516f32;};'use strict';var multer=require(_0x854b('0x0'));var util=require(_0x854b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x854b('0x2')]();var fs_extra=require(_0x854b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x854b('0x4'));var config=require(_0x854b('0x5'));var controller=require('./schedule.controller');router[_0x854b('0x6')]('/',auth[_0x854b('0x7')](),controller[_0x854b('0x8')]);router[_0x854b('0x6')](_0x854b('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x854b('0x6')]('/:id/run',auth[_0x854b('0x7')](),controller['run']);router[_0x854b('0xa')]('/',auth[_0x854b('0x7')](),controller[_0x854b('0xb')]);router[_0x854b('0xc')](_0x854b('0x9'),auth[_0x854b('0x7')](),controller[_0x854b('0xd')]);router[_0x854b('0xe')]('/:id',auth[_0x854b('0x7')](),controller[_0x854b('0xf')]);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 d28572c..0c0e54f 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 _0xe227=['pdf','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','years','quarters','months','weeks','days','hours','minutes','ENUM','csv'];(function(_0x3ebff4,_0x5efe9a){var _0x6331b7=function(_0x4860d6){while(--_0x4860d6){_0x3ebff4['push'](_0x3ebff4['shift']());}};_0x6331b7(++_0x5efe9a);}(_0xe227,0x82));var _0x7e22=function(_0xbb9dbf,_0x5dafa4){_0xbb9dbf=_0xbb9dbf-0x0;var _0x30223c=_0xe227[_0xbb9dbf];return _0x30223c;};'use strict';var Sequelize=require(_0x7e22('0x0'));module[_0x7e22('0x1')]={'name':{'type':Sequelize[_0x7e22('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7e22('0x2')]},'active':{'type':Sequelize[_0x7e22('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x7e22('0x2')],'allowNull':![],'defaultValue':_0x7e22('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x7e22('0x5'),_0x7e22('0x6'),_0x7e22('0x7'),_0x7e22('0x8'),_0x7e22('0x9'),_0x7e22('0xa'),_0x7e22('0xb')),'allowNull':![],'defaultValue':_0x7e22('0x9')},'output':{'type':Sequelize[_0x7e22('0xc')](_0x7e22('0xd'),_0x7e22('0xe'),'xlsx'),'allowNull':![],'defaultValue':_0x7e22('0xd')},'type':{'type':Sequelize[_0x7e22('0xc')](_0x7e22('0xf'),_0x7e22('0x10')),'allowNull':![],'defaultValue':_0x7e22('0xf')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x7e22('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x7e22('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x7e22('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x5c35=['quarters','months','weeks','days','hours','minutes','ENUM','csv','pdf','xlsx','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER'];(function(_0x467cb0,_0x303070){var _0x2153f7=function(_0x51775a){while(--_0x51775a){_0x467cb0['push'](_0x467cb0['shift']());}};_0x2153f7(++_0x303070);}(_0x5c35,0x1cd));var _0x55c3=function(_0x1ae442,_0x43b836){_0x1ae442=_0x1ae442-0x0;var _0x2e5fc0=_0x5c35[_0x1ae442];return _0x2e5fc0;};'use strict';var Sequelize=require(_0x55c3('0x0'));module[_0x55c3('0x1')]={'name':{'type':Sequelize[_0x55c3('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x55c3('0x2')]},'active':{'type':Sequelize[_0x55c3('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x55c3('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x55c3('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x55c3('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years',_0x55c3('0x7'),_0x55c3('0x8'),_0x55c3('0x9'),_0x55c3('0xa'),_0x55c3('0xb'),_0x55c3('0xc')),'allowNull':![],'defaultValue':_0x55c3('0xa')},'output':{'type':Sequelize[_0x55c3('0xd')](_0x55c3('0xe'),_0x55c3('0xf'),_0x55c3('0x10')),'allowNull':![],'defaultValue':_0x55c3('0xe')},'type':{'type':Sequelize[_0x55c3('0xd')]('custom','default'),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x55c3('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x55c3('0x2')]},'cc':{'type':Sequelize[_0x55c3('0x11')]},'bcc':{'type':Sequelize[_0x55c3('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x55c3('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 806e686..d69c73a 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 _0xfd41=['query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','Schedule','includeAll','include','findAll','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','ejs','fs-extra','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','map','type','key','model','name'];(function(_0x565656,_0x4e268e){var _0x57aaae=function(_0x5346de){while(--_0x5346de){_0x565656['push'](_0x565656['shift']());}};_0x57aaae(++_0x4e268e);}(_0xfd41,0x1af));var _0x1fd4=function(_0xa4928c,_0x16b89c){_0xa4928c=_0xa4928c-0x0;var _0x27cc29=_0xfd41[_0xa4928c];return _0x27cc29;};'use strict';var emlformat=require(_0x1fd4('0x0'));var rimraf=require(_0x1fd4('0x1'));var zipdir=require(_0x1fd4('0x2'));var jsonpatch=require(_0x1fd4('0x3'));var rp=require(_0x1fd4('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1fd4('0x5'));var util=require('util');var path=require(_0x1fd4('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1fd4('0x7'));var fs=require('fs');var fs_extra=require(_0x1fd4('0x8'));var _=require('lodash');var squel=require(_0x1fd4('0x9'));var crypto=require('crypto');var jsforce=require(_0x1fd4('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x1fd4('0xb'));var querystring=require(_0x1fd4('0xc'));var Papa=require('papaparse');var Redis=require(_0x1fd4('0xd'));var authService=require(_0x1fd4('0xe'));var qs=require(_0x1fd4('0xf'));var as=require(_0x1fd4('0x10'));var hardwareService=require(_0x1fd4('0x11'));var logger=require(_0x1fd4('0x12'))(_0x1fd4('0x13'));var utils=require(_0x1fd4('0x14'));var config=require(_0x1fd4('0x15'));var licenseUtil=require(_0x1fd4('0x16'));var db=require(_0x1fd4('0x17'))['db'];function respondWithStatusCode(_0x137cb8,_0x3fea0e){_0x3fea0e=_0x3fea0e||0xcc;return function(_0x2fdf9f){if(_0x2fdf9f){return _0x137cb8[_0x1fd4('0x18')](_0x3fea0e);}return _0x137cb8[_0x1fd4('0x19')](_0x3fea0e)[_0x1fd4('0x1a')]();};}function respondWithResult(_0x12223f,_0x14f0b5){_0x14f0b5=_0x14f0b5||0xc8;return function(_0x2d0ccc){if(_0x2d0ccc){return _0x12223f[_0x1fd4('0x19')](_0x14f0b5)[_0x1fd4('0x1b')](_0x2d0ccc);}};}function respondWithFilteredResult(_0x324aea,_0x425417){return function(_0x28fef1){if(_0x28fef1){var _0x50ac15=typeof _0x425417[_0x1fd4('0x1c')]==='undefined'&&typeof _0x425417[_0x1fd4('0x1d')]===_0x1fd4('0x1e');var _0xc5b118=_0x28fef1['count'];var _0x126a79=_0x50ac15?0x0:_0x425417[_0x1fd4('0x1c')];var _0x34dd83=_0x50ac15?_0x28fef1[_0x1fd4('0x1f')]:_0x425417[_0x1fd4('0x1c')]+_0x425417[_0x1fd4('0x1d')];var _0x515165;if(_0x34dd83>=_0xc5b118){_0x34dd83=_0xc5b118;_0x515165=0xc8;}else{_0x515165=0xce;}_0x324aea[_0x1fd4('0x19')](_0x515165);return _0x324aea[_0x1fd4('0x20')](_0x1fd4('0x21'),_0x126a79+'-'+_0x34dd83+'/'+_0xc5b118)[_0x1fd4('0x1b')](_0x28fef1);}return null;};}function patchUpdates(_0x26044d){return function(_0x2a20d1){try{jsonpatch[_0x1fd4('0x22')](_0x2a20d1,_0x26044d,!![]);}catch(_0x1355c2){return BPromise[_0x1fd4('0x23')](_0x1355c2);}return _0x2a20d1['save']();};}function saveUpdates(_0x1f135f,_0x36475a){return function(_0x505d8c){if(_0x505d8c){return _0x505d8c[_0x1fd4('0x24')](_0x1f135f)[_0x1fd4('0x25')](function(_0x2aea31){return _0x2aea31;});}return null;};}function removeEntity(_0x14a5ae,_0x502fca){return function(_0x40980c){if(_0x40980c){return _0x40980c[_0x1fd4('0x26')]()['then'](function(){var _0x2ebe55=_0x40980c[_0x1fd4('0x27')]({'plain':!![]});var _0x272b3b=_0x1fd4('0x28');return db[_0x1fd4('0x29')][_0x1fd4('0x26')]({'where':{'type':_0x272b3b,'resourceId':_0x2ebe55['id']}})['then'](function(){return _0x40980c;});})[_0x1fd4('0x25')](function(){_0x14a5ae[_0x1fd4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x211cb9,_0xbfc7e5){return function(_0x1d3102){if(!_0x1d3102){_0x211cb9[_0x1fd4('0x18')](0x194);}return _0x1d3102;};}function handleError(_0x17c9d1,_0x1c4752){_0x1c4752=_0x1c4752||0x1f4;return function(_0x424907){logger[_0x1fd4('0x2a')](_0x424907[_0x1fd4('0x2b')]);if(_0x424907['name']){delete _0x424907['name'];}_0x17c9d1[_0x1fd4('0x19')](_0x1c4752)['send'](_0x424907);};}exports['index']=function(_0x5dc56d,_0xa65356){var _0x562bc9={},_0x132e70={},_0x3c7865={'count':0x0,'rows':[]};var _0x14a1a5=_[_0x1fd4('0x2c')](db['Schedule']['rawAttributes'],function(_0x55868e){return{'name':_0x55868e['fieldName'],'type':_0x55868e[_0x1fd4('0x2d')][_0x1fd4('0x2e')]};});_0x132e70[_0x1fd4('0x2f')]=_[_0x1fd4('0x2c')](_0x14a1a5,_0x1fd4('0x30'));_0x132e70['query']=_['keys'](_0x5dc56d[_0x1fd4('0x31')]);_0x132e70['filters']=_['intersection'](_0x132e70['model'],_0x132e70['query']);_0x562bc9[_0x1fd4('0x32')]=_[_0x1fd4('0x33')](_0x132e70[_0x1fd4('0x2f')],qs[_0x1fd4('0x34')](_0x5dc56d[_0x1fd4('0x31')][_0x1fd4('0x34')]));_0x562bc9['attributes']=_0x562bc9[_0x1fd4('0x32')][_0x1fd4('0x35')]?_0x562bc9[_0x1fd4('0x32')]:_0x132e70[_0x1fd4('0x2f')];if(!_0x5dc56d[_0x1fd4('0x31')][_0x1fd4('0x36')](_0x1fd4('0x37'))){_0x562bc9[_0x1fd4('0x1d')]=qs[_0x1fd4('0x1d')](_0x5dc56d[_0x1fd4('0x31')][_0x1fd4('0x1d')]);_0x562bc9[_0x1fd4('0x1c')]=qs[_0x1fd4('0x1c')](_0x5dc56d['query'][_0x1fd4('0x1c')]);}_0x562bc9[_0x1fd4('0x38')]=qs[_0x1fd4('0x39')](_0x5dc56d[_0x1fd4('0x31')][_0x1fd4('0x39')]);_0x562bc9[_0x1fd4('0x3a')]=qs[_0x1fd4('0x3b')](_['pick'](_0x5dc56d[_0x1fd4('0x31')],_0x132e70[_0x1fd4('0x3b')]),_0x14a1a5);if(_0x5dc56d[_0x1fd4('0x31')][_0x1fd4('0x3c')]){_0x562bc9[_0x1fd4('0x3a')]=_[_0x1fd4('0x3d')](_0x562bc9[_0x1fd4('0x3a')],{'$or':_[_0x1fd4('0x2c')](_0x14a1a5,function(_0x521702){if(_0x521702[_0x1fd4('0x2d')]!==_0x1fd4('0x3e')){var _0xe0085c={};_0xe0085c[_0x521702[_0x1fd4('0x30')]]={'$like':'%'+_0x5dc56d[_0x1fd4('0x31')][_0x1fd4('0x3c')]+'%'};return _0xe0085c;}})});}_0x562bc9=_[_0x1fd4('0x3d')]({},_0x562bc9,_0x5dc56d[_0x1fd4('0x3f')]);var _0x566881={'where':_0x562bc9[_0x1fd4('0x3a')]};return db[_0x1fd4('0x40')]['count'](_0x566881)[_0x1fd4('0x25')](function(_0x196e4b){_0x3c7865[_0x1fd4('0x1f')]=_0x196e4b;if(_0x5dc56d['query'][_0x1fd4('0x41')]){_0x562bc9[_0x1fd4('0x42')]=[{'all':!![]}];}return db['Schedule'][_0x1fd4('0x43')](_0x562bc9);})[_0x1fd4('0x25')](function(_0x32cc15){_0x3c7865['rows']=_0x32cc15;return _0x3c7865;})['then'](respondWithFilteredResult(_0xa65356,_0x562bc9))[_0x1fd4('0x44')](handleError(_0xa65356,null));};exports['show']=function(_0x31f359,_0x14cc5e){var _0x2d04e6={'raw':![],'where':{'id':_0x31f359[_0x1fd4('0x45')]['id']}},_0x4cc190={};_0x4cc190[_0x1fd4('0x2f')]=_[_0x1fd4('0x46')](db['Schedule']['rawAttributes']);_0x4cc190['query']=_[_0x1fd4('0x46')](_0x31f359[_0x1fd4('0x31')]);_0x4cc190[_0x1fd4('0x3b')]=_[_0x1fd4('0x33')](_0x4cc190[_0x1fd4('0x2f')],_0x4cc190[_0x1fd4('0x31')]);_0x2d04e6[_0x1fd4('0x32')]=_[_0x1fd4('0x33')](_0x4cc190[_0x1fd4('0x2f')],qs[_0x1fd4('0x34')](_0x31f359[_0x1fd4('0x31')][_0x1fd4('0x34')]));_0x2d04e6[_0x1fd4('0x32')]=_0x2d04e6[_0x1fd4('0x32')][_0x1fd4('0x35')]?_0x2d04e6[_0x1fd4('0x32')]:_0x4cc190[_0x1fd4('0x2f')];if(_0x31f359[_0x1fd4('0x31')][_0x1fd4('0x41')]){_0x2d04e6[_0x1fd4('0x42')]=[{'all':!![]}];}_0x2d04e6=_['merge']({},_0x2d04e6,_0x31f359[_0x1fd4('0x3f')]);return db[_0x1fd4('0x40')][_0x1fd4('0x47')](_0x2d04e6)['then'](handleEntityNotFound(_0x14cc5e,null))[_0x1fd4('0x25')](respondWithResult(_0x14cc5e,null))[_0x1fd4('0x44')](handleError(_0x14cc5e,null));};exports['create']=function(_0x23be13,_0x61646a){return db[_0x1fd4('0x40')][_0x1fd4('0x48')](_0x23be13[_0x1fd4('0x49')],{})[_0x1fd4('0x25')](function(_0x2bf2c3){var _0x10eb4a=_0x23be13[_0x1fd4('0x4a')][_0x1fd4('0x27')]({'plain':!![]});if(!_0x10eb4a)throw new Error(_0x1fd4('0x4b'));if(_0x10eb4a[_0x1fd4('0x4c')]===_0x1fd4('0x4a')){var _0xb3637=_0x2bf2c3[_0x1fd4('0x27')]({'plain':!![]});var _0x444273='Scheduler';return db['UserProfileSection']['find']({'where':{'name':_0x444273,'userProfileId':_0x10eb4a[_0x1fd4('0x4d')]},'raw':!![]})['then'](function(_0x4e35ea){if(_0x4e35ea&&_0x4e35ea['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xb3637[_0x1fd4('0x30')],'resourceId':_0xb3637['id'],'type':_0x4e35ea[_0x1fd4('0x30')],'sectionId':_0x4e35ea['id']},{})['then'](function(){return _0x2bf2c3;});}else{return _0x2bf2c3;}})[_0x1fd4('0x44')](function(_0x21131c){logger[_0x1fd4('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x21131c);throw _0x21131c;});}return _0x2bf2c3;})[_0x1fd4('0x25')](respondWithResult(_0x61646a,0xc9))['catch'](handleError(_0x61646a,null));};exports['update']=function(_0x121b24,_0x4892af){if(_0x121b24['body']['id']){delete _0x121b24[_0x1fd4('0x49')]['id'];}return db[_0x1fd4('0x40')]['find']({'where':{'id':_0x121b24[_0x1fd4('0x45')]['id']}})[_0x1fd4('0x25')](handleEntityNotFound(_0x4892af,null))[_0x1fd4('0x25')](saveUpdates(_0x121b24['body'],null))[_0x1fd4('0x25')](respondWithResult(_0x4892af,null))['catch'](handleError(_0x4892af,null));};exports[_0x1fd4('0x26')]=function(_0x4c884a,_0x4099f8){return db[_0x1fd4('0x40')][_0x1fd4('0x47')]({'where':{'id':_0x4c884a['params']['id']}})[_0x1fd4('0x25')](handleEntityNotFound(_0x4099f8,null))[_0x1fd4('0x25')](removeEntity(_0x4099f8,null))[_0x1fd4('0x44')](handleError(_0x4099f8,null));};exports[_0x1fd4('0x4e')]=function(_0x223ea4,_0x2c4c1c,_0xbc21ee){var _0x5f56cf=require(_0x1fd4('0x4f'));return db[_0x1fd4('0x40')][_0x1fd4('0x47')]({'where':{'id':_0x223ea4[_0x1fd4('0x45')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2c4c1c,null))[_0x1fd4('0x25')](function(){_0x5f56cf[_0x1fd4('0x4e')](_0x223ea4[_0x1fd4('0x45')]['id']);})['then'](respondWithStatusCode(_0x2c4c1c,null))[_0x1fd4('0x44')](handleError(_0x2c4c1c,null));}; \ No newline at end of file +var _0x2d54=['rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','index','map','Schedule','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','merge','where','VIRTUAL','filter','options','includeAll','findAll','show','params','include','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','catch','update','run','../../config/schedule','eml-format'];(function(_0x4c10a0,_0x547ecb){var _0x3a7e0a=function(_0x454ebd){while(--_0x454ebd){_0x4c10a0['push'](_0x4c10a0['shift']());}};_0x3a7e0a(++_0x547ecb);}(_0x2d54,0x147));var _0x42d5=function(_0x5cd65a,_0x301f8f){_0x5cd65a=_0x5cd65a-0x0;var _0x1606f8=_0x2d54[_0x5cd65a];return _0x1606f8;};'use strict';var emlformat=require(_0x42d5('0x0'));var rimraf=require(_0x42d5('0x1'));var zipdir=require(_0x42d5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x42d5('0x3'));var BPromise=require(_0x42d5('0x4'));var Mustache=require('mustache');var util=require(_0x42d5('0x5'));var path=require(_0x42d5('0x6'));var sox=require(_0x42d5('0x7'));var csv=require(_0x42d5('0x8'));var ejs=require(_0x42d5('0x9'));var fs=require('fs');var fs_extra=require(_0x42d5('0xa'));var _=require(_0x42d5('0xb'));var squel=require(_0x42d5('0xc'));var crypto=require('crypto');var jsforce=require(_0x42d5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x42d5('0x8'));var querystring=require(_0x42d5('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x42d5('0xf'));var qs=require(_0x42d5('0x10'));var as=require(_0x42d5('0x11'));var hardwareService=require(_0x42d5('0x12'));var logger=require(_0x42d5('0x13'))(_0x42d5('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x42d5('0x15'));var db=require(_0x42d5('0x16'))['db'];function respondWithStatusCode(_0x4945b0,_0x1a0829){_0x1a0829=_0x1a0829||0xcc;return function(_0x4b9ace){if(_0x4b9ace){return _0x4945b0[_0x42d5('0x17')](_0x1a0829);}return _0x4945b0[_0x42d5('0x18')](_0x1a0829)['end']();};}function respondWithResult(_0x34aed2,_0x385620){_0x385620=_0x385620||0xc8;return function(_0x376a9f){if(_0x376a9f){return _0x34aed2['status'](_0x385620)[_0x42d5('0x19')](_0x376a9f);}};}function respondWithFilteredResult(_0x305bc9,_0x325645){return function(_0x4ae738){if(_0x4ae738){var _0x1bf223=typeof _0x325645[_0x42d5('0x1a')]===_0x42d5('0x1b')&&typeof _0x325645['limit']===_0x42d5('0x1b');var _0x288288=_0x4ae738['count'];var _0x232bfd=_0x1bf223?0x0:_0x325645['offset'];var _0x18c60b=_0x1bf223?_0x4ae738[_0x42d5('0x1c')]:_0x325645[_0x42d5('0x1a')]+_0x325645[_0x42d5('0x1d')];var _0x35a59c;if(_0x18c60b>=_0x288288){_0x18c60b=_0x288288;_0x35a59c=0xc8;}else{_0x35a59c=0xce;}_0x305bc9['status'](_0x35a59c);return _0x305bc9['set'](_0x42d5('0x1e'),_0x232bfd+'-'+_0x18c60b+'/'+_0x288288)[_0x42d5('0x19')](_0x4ae738);}return null;};}function patchUpdates(_0x5bf52e){return function(_0x533b22){try{jsonpatch[_0x42d5('0x1f')](_0x533b22,_0x5bf52e,!![]);}catch(_0x3b97eb){return BPromise[_0x42d5('0x20')](_0x3b97eb);}return _0x533b22[_0x42d5('0x21')]();};}function saveUpdates(_0x71bb44,_0x5db1f8){return function(_0x3dd547){if(_0x3dd547){return _0x3dd547['update'](_0x71bb44)[_0x42d5('0x22')](function(_0x498e4f){return _0x498e4f;});}return null;};}function removeEntity(_0x4a2748,_0x2fc626){return function(_0x3eec39){if(_0x3eec39){return _0x3eec39[_0x42d5('0x23')]()[_0x42d5('0x22')](function(){var _0x151d0d=_0x3eec39[_0x42d5('0x24')]({'plain':!![]});var _0x1f98a0=_0x42d5('0x25');return db[_0x42d5('0x26')]['destroy']({'where':{'type':_0x1f98a0,'resourceId':_0x151d0d['id']}})[_0x42d5('0x22')](function(){return _0x3eec39;});})[_0x42d5('0x22')](function(){_0x4a2748[_0x42d5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d387e,_0xe7d6e3){return function(_0x2562c5){if(!_0x2562c5){_0x3d387e[_0x42d5('0x17')](0x194);}return _0x2562c5;};}function handleError(_0x4cf14b,_0x4698ed){_0x4698ed=_0x4698ed||0x1f4;return function(_0x213264){logger[_0x42d5('0x27')](_0x213264[_0x42d5('0x28')]);if(_0x213264[_0x42d5('0x29')]){delete _0x213264['name'];}_0x4cf14b[_0x42d5('0x18')](_0x4698ed)[_0x42d5('0x2a')](_0x213264);};}exports[_0x42d5('0x2b')]=function(_0x22b9c2,_0x47c745){var _0x1bbbb4={},_0x26e564={},_0x4569d9={'count':0x0,'rows':[]};var _0x46b942=_[_0x42d5('0x2c')](db[_0x42d5('0x2d')][_0x42d5('0x2e')],function(_0x5e56d0){return{'name':_0x5e56d0['fieldName'],'type':_0x5e56d0[_0x42d5('0x2f')][_0x42d5('0x30')]};});_0x26e564[_0x42d5('0x31')]=_[_0x42d5('0x2c')](_0x46b942,_0x42d5('0x29'));_0x26e564[_0x42d5('0x32')]=_[_0x42d5('0x33')](_0x22b9c2['query']);_0x26e564[_0x42d5('0x34')]=_[_0x42d5('0x35')](_0x26e564[_0x42d5('0x31')],_0x26e564[_0x42d5('0x32')]);_0x1bbbb4['attributes']=_[_0x42d5('0x35')](_0x26e564[_0x42d5('0x31')],qs['fields'](_0x22b9c2[_0x42d5('0x32')][_0x42d5('0x36')]));_0x1bbbb4[_0x42d5('0x37')]=_0x1bbbb4[_0x42d5('0x37')][_0x42d5('0x38')]?_0x1bbbb4[_0x42d5('0x37')]:_0x26e564[_0x42d5('0x31')];if(!_0x22b9c2[_0x42d5('0x32')][_0x42d5('0x39')]('nolimit')){_0x1bbbb4['limit']=qs[_0x42d5('0x1d')](_0x22b9c2[_0x42d5('0x32')]['limit']);_0x1bbbb4['offset']=qs[_0x42d5('0x1a')](_0x22b9c2[_0x42d5('0x32')]['offset']);}_0x1bbbb4[_0x42d5('0x3a')]=qs['sort'](_0x22b9c2[_0x42d5('0x32')][_0x42d5('0x3b')]);_0x1bbbb4['where']=qs[_0x42d5('0x34')](_['pick'](_0x22b9c2[_0x42d5('0x32')],_0x26e564[_0x42d5('0x34')]),_0x46b942);if(_0x22b9c2[_0x42d5('0x32')]['filter']){_0x1bbbb4['where']=_[_0x42d5('0x3c')](_0x1bbbb4[_0x42d5('0x3d')],{'$or':_['map'](_0x46b942,function(_0x4a982b){if(_0x4a982b[_0x42d5('0x2f')]!==_0x42d5('0x3e')){var _0x252373={};_0x252373[_0x4a982b[_0x42d5('0x29')]]={'$like':'%'+_0x22b9c2[_0x42d5('0x32')][_0x42d5('0x3f')]+'%'};return _0x252373;}})});}_0x1bbbb4=_[_0x42d5('0x3c')]({},_0x1bbbb4,_0x22b9c2[_0x42d5('0x40')]);var _0x5cee61={'where':_0x1bbbb4[_0x42d5('0x3d')]};return db[_0x42d5('0x2d')][_0x42d5('0x1c')](_0x5cee61)[_0x42d5('0x22')](function(_0x469a8c){_0x4569d9[_0x42d5('0x1c')]=_0x469a8c;if(_0x22b9c2[_0x42d5('0x32')][_0x42d5('0x41')]){_0x1bbbb4['include']=[{'all':!![]}];}return db[_0x42d5('0x2d')][_0x42d5('0x42')](_0x1bbbb4);})['then'](function(_0x29a514){_0x4569d9['rows']=_0x29a514;return _0x4569d9;})[_0x42d5('0x22')](respondWithFilteredResult(_0x47c745,_0x1bbbb4))['catch'](handleError(_0x47c745,null));};exports[_0x42d5('0x43')]=function(_0x9deb8e,_0x7b96b6){var _0x3b13e6={'raw':![],'where':{'id':_0x9deb8e[_0x42d5('0x44')]['id']}},_0x405eef={};_0x405eef['model']=_['keys'](db['Schedule'][_0x42d5('0x2e')]);_0x405eef[_0x42d5('0x32')]=_['keys'](_0x9deb8e['query']);_0x405eef[_0x42d5('0x34')]=_[_0x42d5('0x35')](_0x405eef[_0x42d5('0x31')],_0x405eef[_0x42d5('0x32')]);_0x3b13e6[_0x42d5('0x37')]=_[_0x42d5('0x35')](_0x405eef[_0x42d5('0x31')],qs['fields'](_0x9deb8e[_0x42d5('0x32')][_0x42d5('0x36')]));_0x3b13e6[_0x42d5('0x37')]=_0x3b13e6['attributes'][_0x42d5('0x38')]?_0x3b13e6['attributes']:_0x405eef[_0x42d5('0x31')];if(_0x9deb8e[_0x42d5('0x32')][_0x42d5('0x41')]){_0x3b13e6[_0x42d5('0x45')]=[{'all':!![]}];}_0x3b13e6=_['merge']({},_0x3b13e6,_0x9deb8e[_0x42d5('0x40')]);return db['Schedule'][_0x42d5('0x46')](_0x3b13e6)[_0x42d5('0x22')](handleEntityNotFound(_0x7b96b6,null))['then'](respondWithResult(_0x7b96b6,null))['catch'](handleError(_0x7b96b6,null));};exports[_0x42d5('0x47')]=function(_0x57b740,_0x457900){return db[_0x42d5('0x2d')][_0x42d5('0x47')](_0x57b740[_0x42d5('0x48')],{})[_0x42d5('0x22')](function(_0x1a788f){var _0x5f2d07=_0x57b740['user']['get']({'plain':!![]});if(!_0x5f2d07)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f2d07[_0x42d5('0x49')]===_0x42d5('0x4a')){var _0x38f957=_0x1a788f['get']({'plain':!![]});var _0x2e762d=_0x42d5('0x25');return db[_0x42d5('0x4b')][_0x42d5('0x46')]({'where':{'name':_0x2e762d,'userProfileId':_0x5f2d07[_0x42d5('0x4c')]},'raw':!![]})[_0x42d5('0x22')](function(_0x20f281){if(_0x20f281&&_0x20f281[_0x42d5('0x4d')]===0x0){return db[_0x42d5('0x26')][_0x42d5('0x47')]({'name':_0x38f957['name'],'resourceId':_0x38f957['id'],'type':_0x20f281[_0x42d5('0x29')],'sectionId':_0x20f281['id']},{})[_0x42d5('0x22')](function(){return _0x1a788f;});}else{return _0x1a788f;}})[_0x42d5('0x4e')](function(_0x2deebf){logger[_0x42d5('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2deebf);throw _0x2deebf;});}return _0x1a788f;})[_0x42d5('0x22')](respondWithResult(_0x457900,0xc9))['catch'](handleError(_0x457900,null));};exports[_0x42d5('0x4f')]=function(_0x520b84,_0x35dee2){if(_0x520b84[_0x42d5('0x48')]['id']){delete _0x520b84[_0x42d5('0x48')]['id'];}return db['Schedule'][_0x42d5('0x46')]({'where':{'id':_0x520b84[_0x42d5('0x44')]['id']}})['then'](handleEntityNotFound(_0x35dee2,null))[_0x42d5('0x22')](saveUpdates(_0x520b84[_0x42d5('0x48')],null))['then'](respondWithResult(_0x35dee2,null))['catch'](handleError(_0x35dee2,null));};exports[_0x42d5('0x23')]=function(_0x267927,_0x391294){return db[_0x42d5('0x2d')][_0x42d5('0x46')]({'where':{'id':_0x267927[_0x42d5('0x44')]['id']}})[_0x42d5('0x22')](handleEntityNotFound(_0x391294,null))[_0x42d5('0x22')](removeEntity(_0x391294,null))[_0x42d5('0x4e')](handleError(_0x391294,null));};exports[_0x42d5('0x50')]=function(_0x4aa927,_0x3d2c2d,_0x2f6ae9){var _0x267888=require(_0x42d5('0x51'));return db[_0x42d5('0x2d')][_0x42d5('0x46')]({'where':{'id':_0x4aa927[_0x42d5('0x44')]['id']},'raw':!![]})[_0x42d5('0x22')](handleEntityNotFound(_0x3d2c2d,null))['then'](function(){_0x267888[_0x42d5('0x50')](_0x4aa927[_0x42d5('0x44')]['id']);})['then'](respondWithStatusCode(_0x3d2c2d,null))[_0x42d5('0x4e')](handleError(_0x3d2c2d,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index c586cd0..680499c 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 _0x3a0b=['define','tools_schedules','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes'];(function(_0x3436d1,_0x5ed71e){var _0x2b83e0=function(_0xdcd6ce){while(--_0xdcd6ce){_0x3436d1['push'](_0x3436d1['shift']());}};_0x2b83e0(++_0x5ed71e);}(_0x3a0b,0xc2));var _0xb3a0=function(_0x456b57,_0x58691a){_0x456b57=_0x456b57-0x0;var _0x18f49f=_0x3a0b[_0x456b57];return _0x18f49f;};'use strict';var _=require('lodash');var util=require(_0xb3a0('0x0'));var logger=require(_0xb3a0('0x1'))(_0xb3a0('0x2'));var moment=require(_0xb3a0('0x3'));var BPromise=require(_0xb3a0('0x4'));var rp=require(_0xb3a0('0x5'));var fs=require('fs');var path=require(_0xb3a0('0x6'));var rimraf=require(_0xb3a0('0x7'));var config=require(_0xb3a0('0x8'));var attributes=require(_0xb3a0('0x9'));module['exports']=function(_0x41ed00,_0x4f88af){return _0x41ed00[_0xb3a0('0xa')]('Schedule',attributes,{'tableName':_0xb3a0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79d3=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Schedule','tools_schedules','lodash','api'];(function(_0x18776a,_0x4fecab){var _0x484e4a=function(_0x2c8722){while(--_0x2c8722){_0x18776a['push'](_0x18776a['shift']());}};_0x484e4a(++_0x4fecab);}(_0x79d3,0x17e));var _0x379d=function(_0x2233be,_0xd10120){_0x2233be=_0x2233be-0x0;var _0x1a6468=_0x79d3[_0x2233be];return _0x1a6468;};'use strict';var _=require(_0x379d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x379d('0x1'));var moment=require(_0x379d('0x2'));var BPromise=require(_0x379d('0x3'));var rp=require(_0x379d('0x4'));var fs=require('fs');var path=require(_0x379d('0x5'));var rimraf=require(_0x379d('0x6'));var config=require(_0x379d('0x7'));var attributes=require('./schedule.attributes');module[_0x379d('0x8')]=function(_0x4b6d27,_0x1fb70e){return _0x4b6d27[_0x379d('0x9')](_0x379d('0xa'),attributes,{'tableName':_0x379d('0xb'),'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 55e4dbe..f0e593d 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 _0x0d95=['Schedule,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x417e47,_0x3e1d39){var _0x375fe3=function(_0xa13a2b){while(--_0xa13a2b){_0x417e47['push'](_0x417e47['shift']());}};_0x375fe3(++_0x3e1d39);}(_0x0d95,0x12d));var _0x50d9=function(_0x404159,_0x17eae4){_0x404159=_0x404159-0x0;var _0x4edde1=_0x0d95[_0x404159];return _0x4edde1;};'use strict';var _=require(_0x50d9('0x0'));var util=require('util');var moment=require(_0x50d9('0x1'));var BPromise=require('bluebird');var rs=require(_0x50d9('0x2'));var fs=require('fs');var Redis=require(_0x50d9('0x3'));var db=require(_0x50d9('0x4'))['db'];var utils=require(_0x50d9('0x5'));var logger=require(_0x50d9('0x6'))('rpc');var config=require(_0x50d9('0x7'));var jayson=require(_0x50d9('0x8'));var client=jayson[_0x50d9('0x9')][_0x50d9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4dd923,_0x101d3e,_0x47ea1c){return new BPromise(function(_0x316891,_0x3f66a5){return client[_0x50d9('0xb')](_0x4dd923,_0x47ea1c)[_0x50d9('0xc')](function(_0x353d5e){logger[_0x50d9('0xd')](_0x50d9('0xe'),_0x101d3e,_0x50d9('0xf'));logger['debug']('Schedule,\x20%s,\x20%s,\x20%s',_0x101d3e,_0x50d9('0xf'),JSON[_0x50d9('0x10')](_0x353d5e));if(_0x353d5e[_0x50d9('0x11')]){if(_0x353d5e[_0x50d9('0x11')][_0x50d9('0x12')]===0x1f4){logger[_0x50d9('0x11')](_0x50d9('0xe'),_0x101d3e,_0x353d5e['error'][_0x50d9('0x13')]);return _0x3f66a5(_0x353d5e[_0x50d9('0x11')][_0x50d9('0x13')]);}logger['error']('Schedule,\x20%s,\x20%s',_0x101d3e,_0x353d5e[_0x50d9('0x11')][_0x50d9('0x13')]);return _0x316891(_0x353d5e[_0x50d9('0x11')][_0x50d9('0x13')]);}else{logger[_0x50d9('0xd')](_0x50d9('0xe'),_0x101d3e,'request\x20sent');_0x316891(_0x353d5e['result'][_0x50d9('0x13')]);}})[_0x50d9('0x14')](function(_0x337044){logger[_0x50d9('0x11')](_0x50d9('0xe'),_0x101d3e,_0x337044);_0x3f66a5(_0x337044);});});} \ No newline at end of file +var _0x3660=['client','http','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3577ca,_0x3f64dc){var _0x16bf9a=function(_0xf71fff){while(--_0xf71fff){_0x3577ca['push'](_0x3577ca['shift']());}};_0x16bf9a(++_0x3f64dc);}(_0x3660,0xbd));var _0x0366=function(_0x182d90,_0x1570cc){_0x182d90=_0x182d90-0x0;var _0x4872f0=_0x3660[_0x182d90];return _0x4872f0;};'use strict';var _=require(_0x0366('0x0'));var util=require(_0x0366('0x1'));var moment=require('moment');var BPromise=require(_0x0366('0x2'));var rs=require(_0x0366('0x3'));var fs=require('fs');var Redis=require(_0x0366('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0366('0x5'));var logger=require(_0x0366('0x6'))(_0x0366('0x7'));var config=require('../../config/environment');var jayson=require(_0x0366('0x8'));var client=jayson[_0x0366('0x9')][_0x0366('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xcf28b6,_0xc20807,_0x120dd5){return new BPromise(function(_0x2f144e,_0x3466f4){return client['request'](_0xcf28b6,_0x120dd5)[_0x0366('0xb')](function(_0xc9f52e){logger[_0x0366('0xc')](_0x0366('0xd'),_0xc20807,_0x0366('0xe'));logger[_0x0366('0xf')](_0x0366('0x10'),_0xc20807,_0x0366('0xe'),JSON[_0x0366('0x11')](_0xc9f52e));if(_0xc9f52e[_0x0366('0x12')]){if(_0xc9f52e[_0x0366('0x12')][_0x0366('0x13')]===0x1f4){logger['error'](_0x0366('0xd'),_0xc20807,_0xc9f52e['error'][_0x0366('0x14')]);return _0x3466f4(_0xc9f52e[_0x0366('0x12')][_0x0366('0x14')]);}logger[_0x0366('0x12')](_0x0366('0xd'),_0xc20807,_0xc9f52e['error'][_0x0366('0x14')]);return _0x2f144e(_0xc9f52e[_0x0366('0x12')][_0x0366('0x14')]);}else{logger[_0x0366('0xc')](_0x0366('0xd'),_0xc20807,_0x0366('0xe'));_0x2f144e(_0xc9f52e['result'][_0x0366('0x14')]);}})[_0x0366('0x15')](function(_0x7ab65e){logger[_0x0366('0x12')](_0x0366('0xd'),_0xc20807,_0x7ab65e);_0x3466f4(_0x7ab65e);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 31637be..2ae2c7b 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 _0xccd8=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','put','update'];(function(_0x5d1044,_0x18f656){var _0x3cd90e=function(_0x3c40be){while(--_0x3c40be){_0x5d1044['push'](_0x5d1044['shift']());}};_0x3cd90e(++_0x18f656);}(_0xccd8,0x10b));var _0x8ccd=function(_0x2ce2ac,_0x31f105){_0x2ce2ac=_0x2ce2ac-0x0;var _0x384c0d=_0xccd8[_0x2ce2ac];return _0x384c0d;};'use strict';var multer=require(_0x8ccd('0x0'));var util=require(_0x8ccd('0x1'));var path=require(_0x8ccd('0x2'));var timeout=require(_0x8ccd('0x3'));var express=require(_0x8ccd('0x4'));var router=express[_0x8ccd('0x5')]();var fs_extra=require(_0x8ccd('0x6'));var auth=require(_0x8ccd('0x7'));var interaction=require(_0x8ccd('0x8'));var config=require(_0x8ccd('0x9'));var controller=require(_0x8ccd('0xa'));router[_0x8ccd('0xb')]('/',auth[_0x8ccd('0xc')](),controller[_0x8ccd('0xd')]);router[_0x8ccd('0xb')](_0x8ccd('0xe'),auth[_0x8ccd('0xc')](),controller[_0x8ccd('0xf')]);router[_0x8ccd('0xb')](_0x8ccd('0x10'),auth[_0x8ccd('0xc')](),controller[_0x8ccd('0x11')]);router['get'](_0x8ccd('0x12'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x8ccd('0xc')](),controller['create']);router[_0x8ccd('0x13')](_0x8ccd('0x10'),auth[_0x8ccd('0xc')](),controller[_0x8ccd('0x14')]);router[_0x8ccd('0x15')](_0x8ccd('0x10'),auth[_0x8ccd('0xc')](),controller[_0x8ccd('0x16')]);module[_0x8ccd('0x17')]=router; \ No newline at end of file +var _0xa5aa=['/describe','describe','/:id','show','download','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','./screenRecording.controller','get','isAuthenticated','index'];(function(_0x1ab313,_0x12bccc){var _0x2d73f4=function(_0x225f28){while(--_0x225f28){_0x1ab313['push'](_0x1ab313['shift']());}};_0x2d73f4(++_0x12bccc);}(_0xa5aa,0x107));var _0xaa5a=function(_0x1b1fb1,_0x3b3688){_0x1b1fb1=_0x1b1fb1-0x0;var _0x2c75bc=_0xa5aa[_0x1b1fb1];return _0x2c75bc;};'use strict';var multer=require(_0xaa5a('0x0'));var util=require('util');var path=require(_0xaa5a('0x1'));var timeout=require(_0xaa5a('0x2'));var express=require(_0xaa5a('0x3'));var router=express['Router']();var fs_extra=require(_0xaa5a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xaa5a('0x5'));var config=require('../../config/environment');var controller=require(_0xaa5a('0x6'));router[_0xaa5a('0x7')]('/',auth[_0xaa5a('0x8')](),controller[_0xaa5a('0x9')]);router[_0xaa5a('0x7')](_0xaa5a('0xa'),auth[_0xaa5a('0x8')](),controller[_0xaa5a('0xb')]);router[_0xaa5a('0x7')](_0xaa5a('0xc'),auth['isAuthenticated'](),controller[_0xaa5a('0xd')]);router[_0xaa5a('0x7')]('/:id/download',auth[_0xaa5a('0x8')](),controller[_0xaa5a('0xe')]);router[_0xaa5a('0xf')]('/',auth[_0xaa5a('0x8')](),controller['create']);router[_0xaa5a('0x10')](_0xaa5a('0xc'),auth[_0xaa5a('0x8')](),controller[_0xaa5a('0x11')]);router[_0xaa5a('0x12')](_0xaa5a('0xc'),auth['isAuthenticated'](),controller[_0xaa5a('0x13')]);module[_0xaa5a('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 abca896..554027c 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 _0x8212=['moment','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','INTEGER','startedAt','subtract','duration','DATE','toString','closedAt','format','MM-DD-YYYY\x20HH:mm','updatedAt','sequelize'];(function(_0x2f2d88,_0x32815c){var _0x4742ee=function(_0x19b8ba){while(--_0x19b8ba){_0x2f2d88['push'](_0x2f2d88['shift']());}};_0x4742ee(++_0x32815c);}(_0x8212,0xb3));var _0x2821=function(_0x4d9475,_0x1a6c26){_0x4d9475=_0x4d9475-0x0;var _0x23aa82=_0x8212[_0x4d9475];return _0x23aa82;};'use strict';var Sequelize=require(_0x2821('0x0'));var moment=require(_0x2821('0x1'));var path=require('path');var config=require(_0x2821('0x2'));module[_0x2821('0x3')]={'format':{'type':Sequelize[_0x2821('0x4')],'get':function(){return this[_0x2821('0x5')](_0x2821('0x6'))?path[_0x2821('0x7')](this[_0x2821('0x5')](_0x2821('0x6'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x2821('0x8')]},'value':{'type':Sequelize['STRING'],'set':function(_0x376c57){var _0x1dc078=_0x376c57['replace'](/\\/g,'/');this[_0x2821('0x9')](_0x2821('0x6'),_0x1dc078);}},'rating':{'type':Sequelize[_0x2821('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x2821('0xa')],'set':function(_0x16003f){this[_0x2821('0x9')](_0x2821('0xb'),moment()[_0x2821('0xc')](_0x16003f,'ms'));this[_0x2821('0x9')]('closedAt',moment());this[_0x2821('0x9')](_0x2821('0xd'),_0x16003f);}},'startedAt':{'type':Sequelize[_0x2821('0xe')],'get':function(){return moment(this['getDataValue']('startedAt'))['format']('MM-DD-YYYY\x20HH:mm')[_0x2821('0xf')]();}},'closedAt':{'type':Sequelize[_0x2821('0xe')],'get':function(){return moment(this[_0x2821('0x5')](_0x2821('0x10')))[_0x2821('0x11')](_0x2821('0x12'))['toString']();}},'createdAt':{'type':Sequelize[_0x2821('0xe')],'get':function(){return moment(this['getDataValue']('createdAt'))[_0x2821('0x11')](_0x2821('0x12'))[_0x2821('0xf')]();}},'updatedAt':{'type':Sequelize[_0x2821('0xe')],'get':function(){return moment(this['getDataValue'](_0x2821('0x13')))['format'](_0x2821('0x12'))[_0x2821('0xf')]();}}}; \ No newline at end of file +var _0x7669=['path','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','subtract','closedAt','duration','startedAt','toString','format','MM-DD-YYYY\x20HH:mm','DATE','createdAt','sequelize','moment'];(function(_0x309ebd,_0x4abc6d){var _0x3a634f=function(_0x43b7b3){while(--_0x43b7b3){_0x309ebd['push'](_0x309ebd['shift']());}};_0x3a634f(++_0x4abc6d);}(_0x7669,0xe5));var _0x9766=function(_0x59d77a,_0x3dc3d8){_0x59d77a=_0x59d77a-0x0;var _0x35ca1a=_0x7669[_0x59d77a];return _0x35ca1a;};'use strict';var Sequelize=require(_0x9766('0x0'));var moment=require(_0x9766('0x1'));var path=require(_0x9766('0x2'));var config=require('../../config/environment');module[_0x9766('0x3')]={'format':{'type':Sequelize[_0x9766('0x4')],'get':function(){return this[_0x9766('0x5')](_0x9766('0x6'))?path[_0x9766('0x7')](this[_0x9766('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x9766('0x8')]},'channel':{'type':Sequelize[_0x9766('0x8')]},'value':{'type':Sequelize[_0x9766('0x8')],'set':function(_0x251329){var _0x4f85e7=_0x251329[_0x9766('0x9')](/\\/g,'/');this[_0x9766('0xa')](_0x9766('0x6'),_0x4f85e7);}},'rating':{'type':Sequelize[_0x9766('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x9766('0xb')],'set':function(_0x5cb787){this[_0x9766('0xa')]('startedAt',moment()[_0x9766('0xc')](_0x5cb787,'ms'));this['setDataValue'](_0x9766('0xd'),moment());this['setDataValue'](_0x9766('0xe'),_0x5cb787);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x9766('0x5')](_0x9766('0xf')))['format']('MM-DD-YYYY\x20HH:mm')[_0x9766('0x10')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x9766('0x5')]('closedAt'))[_0x9766('0x11')](_0x9766('0x12'))['toString']();}},'createdAt':{'type':Sequelize[_0x9766('0x13')],'get':function(){return moment(this['getDataValue'](_0x9766('0x14')))[_0x9766('0x11')](_0x9766('0x12'))[_0x9766('0x10')]();}},'updatedAt':{'type':Sequelize[_0x9766('0x13')],'get':function(){return moment(this[_0x9766('0x5')]('updatedAt'))[_0x9766('0x11')](_0x9766('0x12'))[_0x9766('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 3292655..231bc31 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 _0x3eea=['filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','merge','find','create','body','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','join','format','existsSync','decryptFile','secrets','recording','server/files/screen_recordings','Sequelize','ValidationError','ScreenRecording\x20not\x20found','download','filename','extname','Not\x20found','isNil','root','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','query','keys'];(function(_0x1c9327,_0x473b1f){var _0x2d49b5=function(_0x23432f){while(--_0x23432f){_0x1c9327['push'](_0x1c9327['shift']());}};_0x2d49b5(++_0x473b1f);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x48cb3e,_0x1e498d){_0x48cb3e=_0x48cb3e-0x0;var _0x5e407e=_0x3eea[_0x48cb3e];return _0x5e407e;};'use strict';var emlformat=require(_0xa3ee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa3ee('0x1'));var jsonpatch=require(_0xa3ee('0x2'));var rp=require(_0xa3ee('0x3'));var moment=require(_0xa3ee('0x4'));var BPromise=require(_0xa3ee('0x5'));var Mustache=require(_0xa3ee('0x6'));var util=require(_0xa3ee('0x7'));var path=require(_0xa3ee('0x8'));var sox=require(_0xa3ee('0x9'));var csv=require(_0xa3ee('0xa'));var ejs=require(_0xa3ee('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa3ee('0xc'));var crypto=require('crypto');var jsforce=require(_0xa3ee('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa3ee('0xa'));var querystring=require('querystring');var Papa=require(_0xa3ee('0xe'));var Redis=require('ioredis');var authService=require(_0xa3ee('0xf'));var qs=require(_0xa3ee('0x10'));var as=require(_0xa3ee('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa3ee('0x12'))(_0xa3ee('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa3ee('0x14'));var db=require(_0xa3ee('0x15'))['db'];function respondWithStatusCode(_0x403518,_0x4363d1){_0x4363d1=_0x4363d1||0xcc;return function(_0x594c88){if(_0x594c88){return _0x403518[_0xa3ee('0x16')](_0x4363d1);}return _0x403518['status'](_0x4363d1)[_0xa3ee('0x17')]();};}function respondWithResult(_0x20535f,_0x2c34cf){_0x2c34cf=_0x2c34cf||0xc8;return function(_0x150e20){if(_0x150e20){return _0x20535f['status'](_0x2c34cf)[_0xa3ee('0x18')](_0x150e20);}};}function respondWithFilteredResult(_0x23df7d,_0x5da681){return function(_0x5358aa){if(_0x5358aa){var _0x4b2c66=typeof _0x5da681[_0xa3ee('0x19')]===_0xa3ee('0x1a')&&typeof _0x5da681[_0xa3ee('0x1b')]===_0xa3ee('0x1a');var _0x4cc8bb=_0x5358aa[_0xa3ee('0x1c')];var _0x40ffdb=_0x4b2c66?0x0:_0x5da681[_0xa3ee('0x19')];var _0x299b1e=_0x4b2c66?_0x5358aa[_0xa3ee('0x1c')]:_0x5da681['offset']+_0x5da681[_0xa3ee('0x1b')];var _0x18b738;if(_0x299b1e>=_0x4cc8bb){_0x299b1e=_0x4cc8bb;_0x18b738=0xc8;}else{_0x18b738=0xce;}_0x23df7d[_0xa3ee('0x1d')](_0x18b738);return _0x23df7d[_0xa3ee('0x1e')](_0xa3ee('0x1f'),_0x40ffdb+'-'+_0x299b1e+'/'+_0x4cc8bb)[_0xa3ee('0x18')](_0x5358aa);}return null;};}function patchUpdates(_0x4f8c56){return function(_0x3f5d70){try{jsonpatch[_0xa3ee('0x20')](_0x3f5d70,_0x4f8c56,!![]);}catch(_0x4b8445){return BPromise[_0xa3ee('0x21')](_0x4b8445);}return _0x3f5d70['save']();};}function saveUpdates(_0x2fab5,_0x29df43){return function(_0x1d3022){if(_0x1d3022){return _0x1d3022[_0xa3ee('0x22')](_0x2fab5)[_0xa3ee('0x23')](function(_0x47108f){return _0x47108f;});}return null;};}function removeEntity(_0x3ce61b,_0x12108e){return function(_0x5ae0a1){if(_0x5ae0a1){return _0x5ae0a1[_0xa3ee('0x24')]()['then'](function(){_0x3ce61b[_0xa3ee('0x1d')](0xcc)[_0xa3ee('0x17')]();});}};}function handleEntityNotFound(_0x157071,_0x1fe4b4){return function(_0x2c48db){if(!_0x2c48db){_0x157071['sendStatus'](0x194);}return _0x2c48db;};}function handleError(_0x3c68f9,_0x1b766e){_0x1b766e=_0x1b766e||0x1f4;return function(_0x146493){logger[_0xa3ee('0x25')](_0x146493[_0xa3ee('0x26')]);if(_0x146493[_0xa3ee('0x27')]){delete _0x146493[_0xa3ee('0x27')];}_0x3c68f9[_0xa3ee('0x1d')](_0x1b766e)[_0xa3ee('0x28')](_0x146493);};}exports[_0xa3ee('0x29')]=function(_0x59c6f9,_0x5ba571){var _0x4abf49={},_0x78e581={},_0x481358={'count':0x0,'rows':[]};var _0x3fa094=_[_0xa3ee('0x2a')](db[_0xa3ee('0x2b')][_0xa3ee('0x2c')],function(_0x26b222){return{'name':_0x26b222[_0xa3ee('0x2d')],'type':_0x26b222[_0xa3ee('0x2e')][_0xa3ee('0x2f')]};});_0x78e581[_0xa3ee('0x30')]=_[_0xa3ee('0x31')](_['map'](_0x3fa094,_0xa3ee('0x27')),['format']);_0x78e581[_0xa3ee('0x32')]=_[_0xa3ee('0x33')](_0x59c6f9['query']);_0x78e581[_0xa3ee('0x34')]=_['intersection'](_0x78e581[_0xa3ee('0x30')],_0x78e581['query']);_0x4abf49[_0xa3ee('0x35')]=_[_0xa3ee('0x36')](_0x78e581[_0xa3ee('0x30')],qs[_0xa3ee('0x37')](_0x59c6f9[_0xa3ee('0x32')]['fields']));_0x4abf49[_0xa3ee('0x35')]=_0x4abf49[_0xa3ee('0x35')][_0xa3ee('0x38')]?_0x4abf49['attributes']:_0x78e581[_0xa3ee('0x30')];if(!_0x59c6f9['query'][_0xa3ee('0x39')]('nolimit')){_0x4abf49[_0xa3ee('0x1b')]=qs['limit'](_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x1b')]);_0x4abf49[_0xa3ee('0x19')]=qs[_0xa3ee('0x19')](_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x19')]);}_0x4abf49[_0xa3ee('0x3a')]=qs[_0xa3ee('0x3b')](_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x3b')]);_0x4abf49[_0xa3ee('0x3c')]=qs[_0xa3ee('0x34')](_[_0xa3ee('0x3d')](_0x59c6f9['query'],_0x78e581[_0xa3ee('0x34')]),_0x3fa094);if(_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x3e')]){_0x4abf49[_0xa3ee('0x3c')]=_['merge'](_0x4abf49[_0xa3ee('0x3c')],{'$or':_[_0xa3ee('0x2a')](_0x3fa094,function(_0x1a9b63){if(_0x1a9b63['type']!==_0xa3ee('0x3f')){var _0x3554eb={};_0x3554eb[_0x1a9b63['name']]={'$like':'%'+_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x3e')]+'%'};return _0x3554eb;}})});}_0x4abf49=_['merge']({},_0x4abf49,_0x59c6f9[_0xa3ee('0x40')]);var _0x6dd235={'where':_0x4abf49[_0xa3ee('0x3c')]};return db[_0xa3ee('0x2b')][_0xa3ee('0x1c')](_0x6dd235)[_0xa3ee('0x23')](function(_0x2ca04f){_0x481358[_0xa3ee('0x1c')]=_0x2ca04f;if(_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x41')]){_0x4abf49[_0xa3ee('0x42')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x4abf49);})['then'](function(_0x45aeec){_0x481358[_0xa3ee('0x43')]=_0x45aeec;return _0x481358;})['then'](respondWithFilteredResult(_0x5ba571,_0x4abf49))[_0xa3ee('0x44')](handleError(_0x5ba571,null));};exports[_0xa3ee('0x45')]=function(_0x279834,_0x55f47f){var _0x1af10b={'raw':![],'where':{'id':_0x279834[_0xa3ee('0x46')]['id']}},_0x559cc1={};_0x559cc1[_0xa3ee('0x30')]=_[_0xa3ee('0x33')](db[_0xa3ee('0x2b')][_0xa3ee('0x2c')]);_0x559cc1[_0xa3ee('0x32')]=_[_0xa3ee('0x33')](_0x279834[_0xa3ee('0x32')]);_0x559cc1[_0xa3ee('0x34')]=_[_0xa3ee('0x36')](_0x559cc1[_0xa3ee('0x30')],_0x559cc1[_0xa3ee('0x32')]);_0x1af10b[_0xa3ee('0x35')]=_[_0xa3ee('0x36')](_0x559cc1[_0xa3ee('0x30')],qs[_0xa3ee('0x37')](_0x279834[_0xa3ee('0x32')][_0xa3ee('0x37')]));_0x1af10b['attributes']=_0x1af10b[_0xa3ee('0x35')][_0xa3ee('0x38')]?_0x1af10b[_0xa3ee('0x35')]:_0x559cc1[_0xa3ee('0x30')];if(_0x279834['query'][_0xa3ee('0x41')]){_0x1af10b['include']=[{'all':!![]}];}_0x1af10b=_[_0xa3ee('0x47')]({},_0x1af10b,_0x279834[_0xa3ee('0x40')]);return db[_0xa3ee('0x2b')][_0xa3ee('0x48')](_0x1af10b)[_0xa3ee('0x23')](handleEntityNotFound(_0x55f47f,null))[_0xa3ee('0x23')](respondWithResult(_0x55f47f,null))[_0xa3ee('0x44')](handleError(_0x55f47f,null));};exports[_0xa3ee('0x49')]=function(_0x3c3677,_0xd6160e){return db['ScreenRecording'][_0xa3ee('0x49')](_0x3c3677['body'],{})['then'](respondWithResult(_0xd6160e,0xc9))[_0xa3ee('0x44')](handleError(_0xd6160e,null));};exports[_0xa3ee('0x22')]=function(_0x45029f,_0x1ec479){if(_0x45029f[_0xa3ee('0x4a')]['id']){delete _0x45029f[_0xa3ee('0x4a')]['id'];}delete _0x45029f[_0xa3ee('0x4a')]['duration'];delete _0x45029f[_0xa3ee('0x4a')][_0xa3ee('0x4b')];delete _0x45029f['body'][_0xa3ee('0x4c')];delete _0x45029f[_0xa3ee('0x4a')][_0xa3ee('0x4d')];return db['ScreenRecording']['find']({'where':{'id':_0x45029f[_0xa3ee('0x46')]['id']}})[_0xa3ee('0x23')](handleEntityNotFound(_0x1ec479,null))[_0xa3ee('0x23')](saveUpdates(_0x45029f[_0xa3ee('0x4a')],null))[_0xa3ee('0x23')](respondWithResult(_0x1ec479,null))['catch'](handleError(_0x1ec479,null));};exports['describe']=function(_0x15b55e,_0x441b23){return db['ScreenRecording'][_0xa3ee('0x4e')]()[_0xa3ee('0x23')](respondWithResult(_0x441b23,null))[_0xa3ee('0x44')](handleError(_0x441b23,null));};exports['download']=function(_0x505444,_0x2388f7,_0x49057c){var _0x172a73=require(_0xa3ee('0x4f'));var _0x5b8e79=![];var _0x4232e0={};if(_0x505444[_0xa3ee('0x32')][_0xa3ee('0x2e')]&&_0x505444['query'][_0xa3ee('0x2e')]===_0xa3ee('0x50')){_0x4232e0['uniqueid']=_0x505444[_0xa3ee('0x46')]['id'];}else{_0x4232e0['id']=_0x505444[_0xa3ee('0x46')]['id'];}return db[_0xa3ee('0x2b')]['find']({'where':_0x4232e0,'attributes':['id','value'],'raw':!![]})[_0xa3ee('0x23')](handleEntityNotFound(_0x2388f7,null))[_0xa3ee('0x23')](function(_0x4a1a2f){if(_0x4a1a2f){var _0x1f9913=path[_0xa3ee('0x51')](config['root'],'server/files/screen_recordings',_0x4a1a2f[_0xa3ee('0x4d')]);var _0x659491=util[_0xa3ee('0x52')]('%s.cypher',_0x1f9913);if(fs[_0xa3ee('0x53')](_0x659491)){_0x5b8e79=!![];return _0x172a73[_0xa3ee('0x54')](_0x659491,_0x1f9913,config[_0xa3ee('0x55')][_0xa3ee('0x56')])[_0xa3ee('0x23')](function(){return _0x4a1a2f;});}return _0x4a1a2f;}})[_0xa3ee('0x23')](function(_0x497be4){if(_0x497be4){var _0x10f508=path[_0xa3ee('0x51')](config['root'],_0xa3ee('0x57'),_0x497be4[_0xa3ee('0x4d')]);if(!fs[_0xa3ee('0x53')](_0x10f508)){throw new db[(_0xa3ee('0x58'))][(_0xa3ee('0x59'))](_0xa3ee('0x5a'));}if(_0x497be4['filename']){return _0x2388f7[_0xa3ee('0x5b')](_0x10f508,_0x497be4[_0xa3ee('0x5c')]+path[_0xa3ee('0x5d')](_0x10f508),function(){if(_0x5b8e79){fs['unlink'](_0x10f508);}});}else{return _0x2388f7[_0xa3ee('0x5b')](_0x10f508,function(_0x13b81b){if(_0x5b8e79){fs['unlink'](_0x10f508);}});}}})['catch'](function(_0x4df186){if(_0x4df186['message']===_0xa3ee('0x5a')){_0x2388f7[_0xa3ee('0x1d')](0x194)[_0xa3ee('0x28')](_0xa3ee('0x5e'));}else{return handleError(_0x2388f7,null);}});};exports[_0xa3ee('0x24')]=function(_0x18a164,_0x4000ee){return db['ScreenRecording'][_0xa3ee('0x48')]({'where':{'id':_0x18a164[_0xa3ee('0x46')]['id']}})[_0xa3ee('0x23')](function(_0xaff641){if(_[_0xa3ee('0x5f')](_0xaff641)){throw new ReferenceError('Entity\x20not\x20found');}return _0xaff641;})['then'](function(_0x7b1e97){var _0x303b71=path[_0xa3ee('0x51')](config[_0xa3ee('0x60')],_0xa3ee('0x57'),_0x7b1e97[_0xa3ee('0x4d')]);logger[_0xa3ee('0x61')](_0xa3ee('0x62'),_0x303b71);if(!_[_0xa3ee('0x5f')](_0x7b1e97[_0xa3ee('0x4d')])&&fs[_0xa3ee('0x53')](_0x303b71)){logger[_0xa3ee('0x61')](_0xa3ee('0x63')+_0x303b71+_0xa3ee('0x64'));fs[_0xa3ee('0x65')](_0x303b71);}_0x303b71=_0x303b71+'.cypher';if(!_[_0xa3ee('0x5f')](_0x7b1e97['value'])&&fs['existsSync'](_0x303b71)){logger[_0xa3ee('0x61')]('File:\x20\x22'+_0x303b71+_0xa3ee('0x64'));fs[_0xa3ee('0x65')](_0x303b71);}return _0x7b1e97;})[_0xa3ee('0x23')](function(_0x221deb){if(!_0x221deb)throw new InternalError();return _0x221deb['destroy']();})[_0xa3ee('0x23')](function(){_0x4000ee[_0xa3ee('0x1d')](0xcc)[_0xa3ee('0x17')]();})[_0xa3ee('0x44')](handleError(_0x4000ee,null));}; \ No newline at end of file +var _0xe14b=['include','findAll','catch','show','fields','length','includeAll','find','create','body','duration','closedAt','value','params','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','error','stack','name','send','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options'];(function(_0x11192e,_0x33f6b1){var _0x15cc39=function(_0x470fef){while(--_0x470fef){_0x11192e['push'](_0x11192e['shift']());}};_0x15cc39(++_0x33f6b1);}(_0xe14b,0x93));var _0xbe14=function(_0x21a8ea,_0x21c007){_0x21a8ea=_0x21a8ea-0x0;var _0x9b1eda=_0xe14b[_0x21a8ea];return _0x9b1eda;};'use strict';var emlformat=require(_0xbe14('0x0'));var rimraf=require(_0xbe14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbe14('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbe14('0x5'));var csv=require(_0xbe14('0x6'));var ejs=require(_0xbe14('0x7'));var fs=require('fs');var fs_extra=require(_0xbe14('0x8'));var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=typeof _0x3dc4a9['offset']===_0xbe14('0x19')&&typeof _0x3dc4a9[_0xbe14('0x1a')]===_0xbe14('0x19');var _0x123ede=_0xf4ac9[_0xbe14('0x1b')];var _0x29ab73=_0x37ce4e?0x0:_0x3dc4a9[_0xbe14('0x1c')];var _0x5ea1f8=_0x37ce4e?_0xf4ac9[_0xbe14('0x1b')]:_0x3dc4a9[_0xbe14('0x1c')]+_0x3dc4a9[_0xbe14('0x1a')];var _0x433459;if(_0x5ea1f8>=_0x123ede){_0x5ea1f8=_0x123ede;_0x433459=0xc8;}else{_0x433459=0xce;}_0x3f58f5[_0xbe14('0x17')](_0x433459);return _0x3f58f5[_0xbe14('0x1d')]('Content-Range',_0x29ab73+'-'+_0x5ea1f8+'/'+_0x123ede)[_0xbe14('0x1e')](_0xf4ac9);}return null;};}function patchUpdates(_0x4a1bbd){return function(_0x417c8d){try{jsonpatch[_0xbe14('0x1f')](_0x417c8d,_0x4a1bbd,!![]);}catch(_0x188ec4){return BPromise['reject'](_0x188ec4);}return _0x417c8d[_0xbe14('0x20')]();};}function saveUpdates(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')](_0x56d845)['then'](function(_0x274018){return _0x274018;});}return null;};}function removeEntity(_0x3d3608,_0x505dbd){return function(_0x2da350){if(_0x2da350){return _0x2da350['destroy']()[_0xbe14('0x22')](function(){_0x3d3608['status'](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x5fa043,_0x1ee9c1){return function(_0x39cc81){if(!_0x39cc81){_0x5fa043[_0xbe14('0x16')](0x194);}return _0x39cc81;};}function handleError(_0x2703f5,_0x55d001){_0x55d001=_0x55d001||0x1f4;return function(_0x1822e0){logger[_0xbe14('0x23')](_0x1822e0[_0xbe14('0x24')]);if(_0x1822e0[_0xbe14('0x25')]){delete _0x1822e0['name'];}_0x2703f5[_0xbe14('0x17')](_0x55d001)[_0xbe14('0x26')](_0x1822e0);};}exports['index']=function(_0x3c3613,_0x3b3e84){var _0x1c7cc7={},_0x19252f={},_0x34d648={'count':0x0,'rows':[]};var _0x36d4b2=_[_0xbe14('0x27')](db[_0xbe14('0x28')][_0xbe14('0x29')],function(_0x16a159){return{'name':_0x16a159[_0xbe14('0x2a')],'type':_0x16a159[_0xbe14('0x2b')][_0xbe14('0x2c')]};});_0x19252f[_0xbe14('0x2d')]=_[_0xbe14('0x2e')](_[_0xbe14('0x27')](_0x36d4b2,_0xbe14('0x25')),[_0xbe14('0x2f')]);_0x19252f[_0xbe14('0x30')]=_[_0xbe14('0x31')](_0x3c3613['query']);_0x19252f[_0xbe14('0x32')]=_['intersection'](_0x19252f['model'],_0x19252f[_0xbe14('0x30')]);_0x1c7cc7['attributes']=_[_0xbe14('0x33')](_0x19252f[_0xbe14('0x2d')],qs['fields'](_0x3c3613['query']['fields']));_0x1c7cc7[_0xbe14('0x34')]=_0x1c7cc7[_0xbe14('0x34')]['length']?_0x1c7cc7[_0xbe14('0x34')]:_0x19252f[_0xbe14('0x2d')];if(!_0x3c3613[_0xbe14('0x30')][_0xbe14('0x35')](_0xbe14('0x36'))){_0x1c7cc7['limit']=qs['limit'](_0x3c3613[_0xbe14('0x30')]['limit']);_0x1c7cc7['offset']=qs['offset'](_0x3c3613[_0xbe14('0x30')][_0xbe14('0x1c')]);}_0x1c7cc7[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x3c3613[_0xbe14('0x30')][_0xbe14('0x38')]);_0x1c7cc7[_0xbe14('0x39')]=qs[_0xbe14('0x32')](_[_0xbe14('0x3a')](_0x3c3613[_0xbe14('0x30')],_0x19252f[_0xbe14('0x32')]),_0x36d4b2);if(_0x3c3613[_0xbe14('0x30')]['filter']){_0x1c7cc7['where']=_[_0xbe14('0x3b')](_0x1c7cc7[_0xbe14('0x39')],{'$or':_[_0xbe14('0x27')](_0x36d4b2,function(_0x520e09){if(_0x520e09[_0xbe14('0x2b')]!==_0xbe14('0x3c')){var _0xeda70e={};_0xeda70e[_0x520e09[_0xbe14('0x25')]]={'$like':'%'+_0x3c3613[_0xbe14('0x30')][_0xbe14('0x3d')]+'%'};return _0xeda70e;}})});}_0x1c7cc7=_[_0xbe14('0x3b')]({},_0x1c7cc7,_0x3c3613[_0xbe14('0x3e')]);var _0x1b2608={'where':_0x1c7cc7['where']};return db[_0xbe14('0x28')][_0xbe14('0x1b')](_0x1b2608)[_0xbe14('0x22')](function(_0x1b3118){_0x34d648[_0xbe14('0x1b')]=_0x1b3118;if(_0x3c3613[_0xbe14('0x30')]['includeAll']){_0x1c7cc7[_0xbe14('0x3f')]=[{'all':!![]}];}return db[_0xbe14('0x28')][_0xbe14('0x40')](_0x1c7cc7);})[_0xbe14('0x22')](function(_0x5cf713){_0x34d648['rows']=_0x5cf713;return _0x34d648;})[_0xbe14('0x22')](respondWithFilteredResult(_0x3b3e84,_0x1c7cc7))[_0xbe14('0x41')](handleError(_0x3b3e84,null));};exports[_0xbe14('0x42')]=function(_0x51c859,_0x5d5318){var _0x6b6aa8={'raw':![],'where':{'id':_0x51c859['params']['id']}},_0x59ae4d={};_0x59ae4d[_0xbe14('0x2d')]=_[_0xbe14('0x31')](db[_0xbe14('0x28')]['rawAttributes']);_0x59ae4d['query']=_['keys'](_0x51c859[_0xbe14('0x30')]);_0x59ae4d[_0xbe14('0x32')]=_[_0xbe14('0x33')](_0x59ae4d['model'],_0x59ae4d[_0xbe14('0x30')]);_0x6b6aa8[_0xbe14('0x34')]=_[_0xbe14('0x33')](_0x59ae4d[_0xbe14('0x2d')],qs['fields'](_0x51c859['query'][_0xbe14('0x43')]));_0x6b6aa8[_0xbe14('0x34')]=_0x6b6aa8[_0xbe14('0x34')][_0xbe14('0x44')]?_0x6b6aa8[_0xbe14('0x34')]:_0x59ae4d['model'];if(_0x51c859['query'][_0xbe14('0x45')]){_0x6b6aa8[_0xbe14('0x3f')]=[{'all':!![]}];}_0x6b6aa8=_[_0xbe14('0x3b')]({},_0x6b6aa8,_0x51c859[_0xbe14('0x3e')]);return db['ScreenRecording'][_0xbe14('0x46')](_0x6b6aa8)[_0xbe14('0x22')](handleEntityNotFound(_0x5d5318,null))['then'](respondWithResult(_0x5d5318,null))[_0xbe14('0x41')](handleError(_0x5d5318,null));};exports[_0xbe14('0x47')]=function(_0x2d6ee8,_0x36c20c){return db['ScreenRecording']['create'](_0x2d6ee8[_0xbe14('0x48')],{})[_0xbe14('0x22')](respondWithResult(_0x36c20c,0xc9))['catch'](handleError(_0x36c20c,null));};exports['update']=function(_0xca8cdb,_0x5d3726){if(_0xca8cdb[_0xbe14('0x48')]['id']){delete _0xca8cdb[_0xbe14('0x48')]['id'];}delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x49')];delete _0xca8cdb[_0xbe14('0x48')]['createdAt'];delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x4a')];delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x4b')];return db[_0xbe14('0x28')]['find']({'where':{'id':_0xca8cdb[_0xbe14('0x4c')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x5d3726,null))[_0xbe14('0x22')](saveUpdates(_0xca8cdb[_0xbe14('0x48')],null))[_0xbe14('0x22')](respondWithResult(_0x5d3726,null))[_0xbe14('0x41')](handleError(_0x5d3726,null));};exports['describe']=function(_0x5aeea9,_0x3a49f7){return db[_0xbe14('0x28')][_0xbe14('0x4d')]()['then'](respondWithResult(_0x3a49f7,null))['catch'](handleError(_0x3a49f7,null));};exports[_0xbe14('0x4e')]=function(_0x134878,_0x50d78f,_0x339a86){var _0x32496a=require('../../components/encryptor');var _0x28f995=![];var _0x4a40d2={};if(_0x134878[_0xbe14('0x30')][_0xbe14('0x2b')]&&_0x134878[_0xbe14('0x30')]['type']===_0xbe14('0x4f')){_0x4a40d2[_0xbe14('0x4f')]=_0x134878['params']['id'];}else{_0x4a40d2['id']=_0x134878[_0xbe14('0x4c')]['id'];}return db[_0xbe14('0x28')][_0xbe14('0x46')]({'where':_0x4a40d2,'attributes':['id',_0xbe14('0x4b')],'raw':!![]})[_0xbe14('0x22')](handleEntityNotFound(_0x50d78f,null))['then'](function(_0x42a346){if(_0x42a346){var _0x34cd66=path[_0xbe14('0x50')](config[_0xbe14('0x51')],_0xbe14('0x52'),_0x42a346[_0xbe14('0x4b')]);var _0x1dd6c7=util['format'](_0xbe14('0x53'),_0x34cd66);if(fs[_0xbe14('0x54')](_0x1dd6c7)){_0x28f995=!![];return _0x32496a[_0xbe14('0x55')](_0x1dd6c7,_0x34cd66,config[_0xbe14('0x56')][_0xbe14('0x57')])[_0xbe14('0x22')](function(){return _0x42a346;});}return _0x42a346;}})[_0xbe14('0x22')](function(_0x32df3c){if(_0x32df3c){var _0x285b6e=path[_0xbe14('0x50')](config[_0xbe14('0x51')],'server/files/screen_recordings',_0x32df3c['value']);if(!fs['existsSync'](_0x285b6e)){throw new db[(_0xbe14('0x58'))][(_0xbe14('0x59'))](_0xbe14('0x5a'));}if(_0x32df3c[_0xbe14('0x5b')]){return _0x50d78f[_0xbe14('0x4e')](_0x285b6e,_0x32df3c[_0xbe14('0x5b')]+path[_0xbe14('0x5c')](_0x285b6e),function(){if(_0x28f995){fs[_0xbe14('0x5d')](_0x285b6e);}});}else{return _0x50d78f[_0xbe14('0x4e')](_0x285b6e,function(_0x451b0b){if(_0x28f995){fs[_0xbe14('0x5d')](_0x285b6e);}});}}})[_0xbe14('0x41')](function(_0x2088e4){if(_0x2088e4[_0xbe14('0x5e')]===_0xbe14('0x5a')){_0x50d78f[_0xbe14('0x17')](0x194)[_0xbe14('0x26')](_0xbe14('0x5f'));}else{return handleError(_0x50d78f,null);}});};exports[_0xbe14('0x60')]=function(_0x1a945b,_0x5f394c){return db[_0xbe14('0x28')][_0xbe14('0x46')]({'where':{'id':_0x1a945b[_0xbe14('0x4c')]['id']}})[_0xbe14('0x22')](function(_0x3ee6b7){if(_[_0xbe14('0x61')](_0x3ee6b7)){throw new ReferenceError(_0xbe14('0x62'));}return _0x3ee6b7;})[_0xbe14('0x22')](function(_0x23cb36){var _0x100d43=path['join'](config[_0xbe14('0x51')],_0xbe14('0x52'),_0x23cb36[_0xbe14('0x4b')]);logger[_0xbe14('0x63')](_0xbe14('0x64'),_0x100d43);if(!_['isNil'](_0x23cb36[_0xbe14('0x4b')])&&fs[_0xbe14('0x54')](_0x100d43)){logger[_0xbe14('0x63')](_0xbe14('0x65')+_0x100d43+_0xbe14('0x66'));fs['unlinkSync'](_0x100d43);}_0x100d43=_0x100d43+_0xbe14('0x67');if(!_[_0xbe14('0x61')](_0x23cb36[_0xbe14('0x4b')])&&fs[_0xbe14('0x54')](_0x100d43)){logger[_0xbe14('0x63')](_0xbe14('0x65')+_0x100d43+_0xbe14('0x66'));fs[_0xbe14('0x68')](_0x100d43);}return _0x23cb36;})['then'](function(_0x1bb588){if(!_0x1bb588)throw new InternalError();return _0x1bb588[_0xbe14('0x60')]();})[_0xbe14('0x22')](function(){_0x5f394c[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();})[_0xbe14('0x41')](handleError(_0x5f394c,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 020bf72..4711e66 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 _0x8161=['./screenRecording.attributes','exports','define','interactionid','util','../../config/logger','api','bluebird','path'];(function(_0x30c684,_0x391514){var _0x3bc4ac=function(_0x22c1f0){while(--_0x22c1f0){_0x30c684['push'](_0x30c684['shift']());}};_0x3bc4ac(++_0x391514);}(_0x8161,0xc1));var _0x1816=function(_0x782701,_0x3bd97a){_0x782701=_0x782701-0x0;var _0x403dcb=_0x8161[_0x782701];return _0x403dcb;};'use strict';var _=require('lodash');var util=require(_0x1816('0x0'));var logger=require(_0x1816('0x1'))(_0x1816('0x2'));var moment=require('moment');var BPromise=require(_0x1816('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1816('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1816('0x5'));module[_0x1816('0x6')]=function(_0x3743e6,_0x5df573){return _0x3743e6[_0x1816('0x7')]('ScreenRecording',attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x1816('0x8'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6fd5=['screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','ScreenRecording'];(function(_0xaaddd2,_0x4df1f6){var _0x351bf4=function(_0x1830c5){while(--_0x1830c5){_0xaaddd2['push'](_0xaaddd2['shift']());}};_0x351bf4(++_0x4df1f6);}(_0x6fd5,0x72));var _0x56fd=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x6fd5[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0x56fd('0x0'));var util=require(_0x56fd('0x1'));var logger=require(_0x56fd('0x2'))(_0x56fd('0x3'));var moment=require(_0x56fd('0x4'));var BPromise=require('bluebird');var rp=require(_0x56fd('0x5'));var fs=require('fs');var path=require(_0x56fd('0x6'));var rimraf=require(_0x56fd('0x7'));var config=require(_0x56fd('0x8'));var attributes=require(_0x56fd('0x9'));module[_0x56fd('0xa')]=function(_0x353619,_0x37f200){return _0x353619['define'](_0x56fd('0xb'),attributes,{'tableName':_0x56fd('0xc'),'paranoid':![],'indexes':[{'name':_0x56fd('0xd'),'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 fd283d8..f8e9275 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 _0x8be6=['ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8be6,0x176));var _0x68be=function(_0x50b31a,_0x2f611f){_0x50b31a=_0x50b31a-0x0;var _0x2b2a56=_0x8be6[_0x50b31a];return _0x2b2a56;};'use strict';var _=require('lodash');var util=require(_0x68be('0x0'));var moment=require(_0x68be('0x1'));var BPromise=require(_0x68be('0x2'));var rs=require(_0x68be('0x3'));var fs=require('fs');var Redis=require(_0x68be('0x4'));var db=require(_0x68be('0x5'))['db'];var utils=require(_0x68be('0x6'));var logger=require('../../config/logger')(_0x68be('0x7'));var config=require('../../config/environment');var jayson=require(_0x68be('0x8'));var client=jayson[_0x68be('0x9')][_0x68be('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48b2f1,_0x1118d4,_0x37c07b){return new BPromise(function(_0x113ba4,_0xe26bfe){return client[_0x68be('0xb')](_0x48b2f1,_0x37c07b)[_0x68be('0xc')](function(_0xfcfb94){logger[_0x68be('0xd')](_0x68be('0xe'),_0x1118d4,_0x68be('0xf'));logger[_0x68be('0x10')](_0x68be('0x11'),_0x1118d4,'request\x20sent',JSON['stringify'](_0xfcfb94));if(_0xfcfb94[_0x68be('0x12')]){if(_0xfcfb94['error'][_0x68be('0x13')]===0x1f4){logger['error'](_0x68be('0xe'),_0x1118d4,_0xfcfb94['error'][_0x68be('0x14')]);return _0xe26bfe(_0xfcfb94['error']['message']);}logger[_0x68be('0x12')](_0x68be('0xe'),_0x1118d4,_0xfcfb94[_0x68be('0x12')][_0x68be('0x14')]);return _0x113ba4(_0xfcfb94['error'][_0x68be('0x14')]);}else{logger[_0x68be('0xd')](_0x68be('0xe'),_0x1118d4,_0x68be('0xf'));_0x113ba4(_0xfcfb94[_0x68be('0x15')][_0x68be('0x14')]);}})[_0x68be('0x16')](function(_0x3925fb){logger[_0x68be('0x12')](_0x68be('0xe'),_0x1118d4,_0x3925fb);_0xe26bfe(_0x3925fb);});});} \ No newline at end of file +var _0xe70b=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result'];(function(_0x1cd715,_0x593c35){var _0x28bb11=function(_0x5cf160){while(--_0x5cf160){_0x1cd715['push'](_0x1cd715['shift']());}};_0x28bb11(++_0x593c35);}(_0xe70b,0xc1));var _0xbe70=function(_0x223645,_0x220bba){_0x223645=_0x223645-0x0;var _0x24f28c=_0xe70b[_0x223645];return _0x24f28c;};'use strict';var _=require(_0xbe70('0x0'));var util=require('util');var moment=require(_0xbe70('0x1'));var BPromise=require(_0xbe70('0x2'));var rs=require(_0xbe70('0x3'));var fs=require('fs');var Redis=require(_0xbe70('0x4'));var db=require(_0xbe70('0x5'))['db'];var utils=require(_0xbe70('0x6'));var logger=require(_0xbe70('0x7'))('rpc');var config=require(_0xbe70('0x8'));var jayson=require(_0xbe70('0x9'));var client=jayson[_0xbe70('0xa')][_0xbe70('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2906b3,_0x1c4083,_0x1f5cca){return new BPromise(function(_0x13fd2c,_0x5ab1b5){return client[_0xbe70('0xc')](_0x2906b3,_0x1f5cca)[_0xbe70('0xd')](function(_0x56fb9f){logger['info'](_0xbe70('0xe'),_0x1c4083,_0xbe70('0xf'));logger[_0xbe70('0x10')](_0xbe70('0x11'),_0x1c4083,_0xbe70('0xf'),JSON[_0xbe70('0x12')](_0x56fb9f));if(_0x56fb9f['error']){if(_0x56fb9f[_0xbe70('0x13')]['code']===0x1f4){logger[_0xbe70('0x13')](_0xbe70('0xe'),_0x1c4083,_0x56fb9f[_0xbe70('0x13')][_0xbe70('0x14')]);return _0x5ab1b5(_0x56fb9f[_0xbe70('0x13')]['message']);}logger[_0xbe70('0x13')](_0xbe70('0xe'),_0x1c4083,_0x56fb9f[_0xbe70('0x13')][_0xbe70('0x14')]);return _0x13fd2c(_0x56fb9f['error']['message']);}else{logger[_0xbe70('0x15')](_0xbe70('0xe'),_0x1c4083,_0xbe70('0xf'));_0x13fd2c(_0x56fb9f[_0xbe70('0x16')][_0xbe70('0x14')]);}})[_0xbe70('0x17')](function(_0x34c5d9){logger['error'](_0xbe70('0xe'),_0x1c4083,_0x34c5d9);_0x5ab1b5(_0x34c5d9);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 1ecc41b..f80c30e 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 _0x21e6=['logo','post','single','file','addLogo','diskStorage','server/files/images/logos/','addLogoLogin','%s%s','preferred','extname','addPreferred','root','favicon','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','getDate','/:id','getLogo','/:id/logo_login','getLogoLogin','gdpr','/:id/preferred','getPreferred','/:id/favicon','join','format'];(function(_0x3df822,_0x299495){var _0x4e457d=function(_0x68a45f){while(--_0x68a45f){_0x3df822['push'](_0x3df822['shift']());}};_0x4e457d(++_0x299495);}(_0x21e6,0x19a));var _0x621e=function(_0x315add,_0x5e9ace){_0x315add=_0x315add-0x0;var _0x40956b=_0x21e6[_0x315add];return _0x40956b;};'use strict';var multer=require(_0x621e('0x0'));var util=require(_0x621e('0x1'));var path=require(_0x621e('0x2'));var timeout=require(_0x621e('0x3'));var express=require(_0x621e('0x4'));var router=express[_0x621e('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x621e('0x6'));var config=require(_0x621e('0x7'));var controller=require('./setting.controller');router[_0x621e('0x8')]('/',auth[_0x621e('0x9')](),controller[_0x621e('0xa')]);router[_0x621e('0x8')]('/now',controller[_0x621e('0xb')]);router[_0x621e('0x8')](_0x621e('0xc'),controller['show']);router['get']('/:id/logo',controller[_0x621e('0xd')]);router['get'](_0x621e('0xe'),controller[_0x621e('0xf')]);router['get']('/:id/gdpr',controller[_0x621e('0x10')]);router['get'](_0x621e('0x11'),controller[_0x621e('0x12')]);router[_0x621e('0x8')](_0x621e('0x13'),controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x27a48f,_0x4ea2a6,_0xde2962){_0xde2962(null,path[_0x621e('0x14')](config['root'],'server/files/images/logos/'));},'filename':function(_0x1ce2f4,_0x1b654b,_0x27ee33){_0x27ee33(null,util[_0x621e('0x15')]('%s%s',_0x621e('0x16'),path['extname'](_0x1b654b['originalname'])));}})});router[_0x621e('0x17')]('/:id/logo',upload[_0x621e('0x18')](_0x621e('0x19')),controller[_0x621e('0x1a')]);var upload=multer({'storage':multer[_0x621e('0x1b')]({'destination':function(_0x27da52,_0x37269e,_0x38c953){_0x38c953(null,path['join'](config['root'],_0x621e('0x1c')));},'filename':function(_0x42d509,_0x509cf4,_0x38c216){_0x38c216(null,util[_0x621e('0x15')]('%s%s','logologin',path['extname'](_0x509cf4['originalname'])));}})});router[_0x621e('0x17')](_0x621e('0xe'),upload['single'](_0x621e('0x19')),controller[_0x621e('0x1d')]);var upload=multer({'storage':multer[_0x621e('0x1b')]({'destination':function(_0x181d98,_0x2344df,_0x30d688){_0x30d688(null,path[_0x621e('0x14')](config['root'],_0x621e('0x1c')));},'filename':function(_0x555e17,_0x52ee98,_0x31d375){_0x31d375(null,util[_0x621e('0x15')](_0x621e('0x1e'),_0x621e('0x1f'),path[_0x621e('0x20')](_0x52ee98['originalname'])));}})});router[_0x621e('0x17')](_0x621e('0x11'),upload[_0x621e('0x18')](_0x621e('0x19')),controller[_0x621e('0x21')]);var upload=multer({'storage':multer[_0x621e('0x1b')]({'destination':function(_0x4a292b,_0x1c5671,_0x12ef24){_0x12ef24(null,path['join'](config[_0x621e('0x22')],_0x621e('0x1c')));},'filename':function(_0x2064fb,_0x3b3ebe,_0x44a9af){_0x44a9af(null,util['format'](_0x621e('0x1e'),_0x621e('0x23'),path[_0x621e('0x20')](_0x3b3ebe['originalname'])));}})});router[_0x621e('0x17')](_0x621e('0x13'),upload[_0x621e('0x18')](_0x621e('0x19')),controller['addFavicon']);router['put'](_0x621e('0xc'),auth[_0x621e('0x9')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x7c03=['/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','%s%s','logo','extname','originalname','post','single','file','addLogo','format','logologin','preferred','addPreferred','favicon','put','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./setting.controller','get','isAuthenticated','index','/now'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7c03,0x73));var _0x37c0=function(_0x53d2f6,_0x2a467a){_0x53d2f6=_0x53d2f6-0x0;var _0x5b6b27=_0x7c03[_0x53d2f6];return _0x5b6b27;};'use strict';var multer=require(_0x37c0('0x0'));var util=require(_0x37c0('0x1'));var path=require(_0x37c0('0x2'));var timeout=require(_0x37c0('0x3'));var express=require(_0x37c0('0x4'));var router=express[_0x37c0('0x5')]();var fs_extra=require(_0x37c0('0x6'));var auth=require(_0x37c0('0x7'));var interaction=require(_0x37c0('0x8'));var config=require('../../config/environment');var controller=require(_0x37c0('0x9'));router[_0x37c0('0xa')]('/',auth[_0x37c0('0xb')](),controller[_0x37c0('0xc')]);router[_0x37c0('0xa')](_0x37c0('0xd'),controller['getDate']);router['get']('/:id',controller['show']);router[_0x37c0('0xa')](_0x37c0('0xe'),controller[_0x37c0('0xf')]);router['get'](_0x37c0('0x10'),controller[_0x37c0('0x11')]);router[_0x37c0('0xa')](_0x37c0('0x12'),controller[_0x37c0('0x13')]);router[_0x37c0('0xa')](_0x37c0('0x14'),controller[_0x37c0('0x15')]);router[_0x37c0('0xa')](_0x37c0('0x16'),controller[_0x37c0('0x17')]);var upload=multer({'storage':multer[_0x37c0('0x18')]({'destination':function(_0x1f1416,_0x408d32,_0x5ca3d4){_0x5ca3d4(null,path[_0x37c0('0x19')](config[_0x37c0('0x1a')],'server/files/images/logos/'));},'filename':function(_0x535ffa,_0x24c516,_0x55567e){_0x55567e(null,util['format'](_0x37c0('0x1b'),_0x37c0('0x1c'),path[_0x37c0('0x1d')](_0x24c516[_0x37c0('0x1e')])));}})});router[_0x37c0('0x1f')](_0x37c0('0xe'),upload[_0x37c0('0x20')](_0x37c0('0x21')),controller[_0x37c0('0x22')]);var upload=multer({'storage':multer[_0x37c0('0x18')]({'destination':function(_0x24f568,_0x1c82c5,_0x961435){_0x961435(null,path[_0x37c0('0x19')](config[_0x37c0('0x1a')],'server/files/images/logos/'));},'filename':function(_0x286ae0,_0x564683,_0x319217){_0x319217(null,util[_0x37c0('0x23')](_0x37c0('0x1b'),_0x37c0('0x24'),path['extname'](_0x564683[_0x37c0('0x1e')])));}})});router[_0x37c0('0x1f')](_0x37c0('0x10'),upload[_0x37c0('0x20')](_0x37c0('0x21')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x37c0('0x18')]({'destination':function(_0x42fb5f,_0x5d9eec,_0x2ce1a2){_0x2ce1a2(null,path[_0x37c0('0x19')](config[_0x37c0('0x1a')],'server/files/images/logos/'));},'filename':function(_0x128408,_0x2f3529,_0x262311){_0x262311(null,util['format']('%s%s',_0x37c0('0x25'),path[_0x37c0('0x1d')](_0x2f3529[_0x37c0('0x1e')])));}})});router['post'](_0x37c0('0x14'),upload[_0x37c0('0x20')](_0x37c0('0x21')),controller[_0x37c0('0x26')]);var upload=multer({'storage':multer[_0x37c0('0x18')]({'destination':function(_0x45df57,_0x4629e4,_0x3bf481){_0x3bf481(null,path[_0x37c0('0x19')](config[_0x37c0('0x1a')],'server/files/images/logos/'));},'filename':function(_0x1f5b11,_0x983a9,_0x3f5c40){_0x3f5c40(null,util[_0x37c0('0x23')](_0x37c0('0x1b'),_0x37c0('0x27'),path['extname'](_0x983a9[_0x37c0('0x1e')])));}})});router[_0x37c0('0x1f')](_0x37c0('0x16'),upload[_0x37c0('0x20')]('file'),controller['addFavicon']);router[_0x37c0('0x28')](_0x37c0('0x29'),auth[_0x37c0('0xb')](),controller['update']);module[_0x37c0('0x2a')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 561be09..0bbb881 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 _0x8b81=['sequelize','exports','min_internal','INTEGER','min_mailbox','/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED'];(function(_0x272433,_0x4b081f){var _0x587054=function(_0x48b831){while(--_0x48b831){_0x272433['push'](_0x272433['shift']());}};_0x587054(++_0x4b081f);}(_0x8b81,0x1f4));var _0x18b8=function(_0x1543d2,_0x1bfbcf){_0x1543d2=_0x1543d2-0x0;var _0x5eac89=_0x8b81[_0x1543d2];return _0x5eac89;};'use strict';var Sequelize=require(_0x18b8('0x0'));module[_0x18b8('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x18b8('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x18b8('0x3')](0xb),'unique':_0x18b8('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x18b8('0x5')},'logo':{'type':Sequelize[_0x18b8('0x6')]},'defaultLogo':{'type':Sequelize[_0x18b8('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x18b8('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x18b8('0x6')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x18b8('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x18b8('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x18b8('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x18b8('0x6')]},'turnpassword':{'type':Sequelize[_0x18b8('0x6')]},'pageTitle':{'type':Sequelize[_0x18b8('0x6')]},'defaultPageTitle':{'type':Sequelize[_0x18b8('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x18b8('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x18b8('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x18b8('0x6')],'defaultValue':_0x18b8('0x8')},'enableEmailPreview':{'type':Sequelize[_0x18b8('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x18b8('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x18b8('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x18b8('0x3')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x18b8('0x3')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x18b8('0x6')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x18b8('0x3')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x18b8('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x18b8('0x6')]},'defaultPreferred':{'type':Sequelize[_0x18b8('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x18b8('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x18b8('0x3')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x18b8('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x18b8('0x6')]},'defaultFavicon':{'type':Sequelize[_0x18b8('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x18b8('0x3')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x18b8('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x18b8('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x18b8('0x3')]},'transcribeRegion':{'type':Sequelize[_0x18b8('0x6')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x18b8('0x3')]},'sentimentRegion':{'type':Sequelize[_0x18b8('0x6')]},'language':{'type':Sequelize[_0x18b8('0x6')]},'bucket':{'type':Sequelize[_0x18b8('0x6')]},'googleSsoEnabled':{'type':Sequelize[_0x18b8('0x7')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x18b8('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x18b8('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x18b8('0x3')](0x2)[_0x18b8('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x18b8('0x3')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x18b8('0x3')](0x2)[_0x18b8('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x18b8('0x3')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x18b8('0x3')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x18b8('0x3')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x18b8('0x3')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x18b8('0x3')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x18b8('0x7')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x18b8('0x7')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x18b8('0x3')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x18b8('0x7')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x18b8('0x3')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x18b8('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0xf383=['INTEGER','min_mailbox','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','exports'];(function(_0x5dcd9e,_0x2c8921){var _0x155848=function(_0x3cc0bb){while(--_0x3cc0bb){_0x5dcd9e['push'](_0x5dcd9e['shift']());}};_0x155848(++_0x2c8921);}(_0xf383,0xc3));var _0x3f38=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xf383[_0x599f41];return _0x2e4d58;};'use strict';var Sequelize=require('sequelize');module[_0x3f38('0x0')]={'min_internal':{'type':Sequelize[_0x3f38('0x1')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x3f38('0x1')](0xb),'unique':_0x3f38('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x3f38('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x3f38('0x3')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x3f38('0x3')]},'defaultLogo':{'type':Sequelize[_0x3f38('0x4')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x3f38('0x3')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x3f38('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x3f38('0x4')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x3f38('0x4')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x3f38('0x4')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x3f38('0x3')]},'turnaddr':{'type':Sequelize[_0x3f38('0x3')]},'turnusername':{'type':Sequelize[_0x3f38('0x3')]},'turnpassword':{'type':Sequelize[_0x3f38('0x3')]},'pageTitle':{'type':Sequelize[_0x3f38('0x3')]},'defaultPageTitle':{'type':Sequelize[_0x3f38('0x4')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x3f38('0x4')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x3f38('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x3f38('0x4')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x3f38('0x3')],'defaultValue':_0x3f38('0x5')},'enableEmailPreview':{'type':Sequelize[_0x3f38('0x4')],'defaultValue':![]},'split':{'type':Sequelize[_0x3f38('0x4')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x3f38('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x3f38('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x3f38('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x3f38('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x3f38('0x4')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x3f38('0x3')]},'defaultPreferred':{'type':Sequelize[_0x3f38('0x4')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x3f38('0x4')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x3f38('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0x3f38('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x3f38('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x3f38('0x3')]},'defaultFavicon':{'type':Sequelize[_0x3f38('0x4')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x3f38('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x3f38('0x1')]},'transcribeRegion':{'type':Sequelize[_0x3f38('0x3')]},'sentiment':{'type':Sequelize[_0x3f38('0x4')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x3f38('0x1')]},'sentimentRegion':{'type':Sequelize[_0x3f38('0x3')]},'language':{'type':Sequelize[_0x3f38('0x3')]},'bucket':{'type':Sequelize[_0x3f38('0x3')]},'googleSsoEnabled':{'type':Sequelize[_0x3f38('0x4')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x3f38('0x4')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x3f38('0x4')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x3f38('0x1')](0x2)[_0x3f38('0x6')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x3f38('0x1')](0x2)[_0x3f38('0x6')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x3f38('0x1')](0x2)[_0x3f38('0x6')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x3f38('0x4')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x3f38('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x3f38('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x3f38('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x3f38('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x3f38('0x4')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x3f38('0x1')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x3f38('0x4')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x3f38('0x1')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x3f38('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 6f7c5bf..d207883 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 _0x5c88=['end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','Setting','includeAll','include','rows','catch','show','params','options','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','favicon','defaultLogo','defaultPreferred','join','root','toLower','default_logo.svg','default','custom','Sequelize','ValidationError','upperFirst','download','getLogoLogin','defaultLoginLogo','defaultFavicon','existsSync','default_loginLogo.svg','\x20not\x20found','securePassword','addPreferred','preferred','getPreferred','default_preferred.png','getFavicon','default_favicon.ico','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Setting,\x20%s,\x20%s','info'];(function(_0x2cc806,_0x50b4ed){var _0x39aa0a=function(_0x587666){while(--_0x587666){_0x2cc806['push'](_0x2cc806['shift']());}};_0x39aa0a(++_0x50b4ed);}(_0x5c88,0x158));var _0x85c8=function(_0xa6209,_0x13d19a){_0xa6209=_0xa6209-0x0;var _0x5717ef=_0x5c88[_0xa6209];return _0x5717ef;};'use strict';var emlformat=require(_0x85c8('0x0'));var rimraf=require(_0x85c8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x85c8('0x2'));var rp=require(_0x85c8('0x3'));var moment=require(_0x85c8('0x4'));var BPromise=require(_0x85c8('0x5'));var Mustache=require(_0x85c8('0x6'));var util=require(_0x85c8('0x7'));var path=require(_0x85c8('0x8'));var sox=require('sox');var csv=require(_0x85c8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x85c8('0xa'));var _=require(_0x85c8('0xb'));var squel=require(_0x85c8('0xc'));var crypto=require(_0x85c8('0xd'));var jsforce=require(_0x85c8('0xe'));var deskjs=require(_0x85c8('0xf'));var toCsv=require(_0x85c8('0x9'));var querystring=require('querystring');var Papa=require(_0x85c8('0x10'));var Redis=require(_0x85c8('0x11'));var authService=require(_0x85c8('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x85c8('0x13'));var logger=require(_0x85c8('0x14'))(_0x85c8('0x15'));var utils=require(_0x85c8('0x16'));var config=require(_0x85c8('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x85c8('0x18'));var client=jayson['client'][_0x85c8('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x59a1d3,_0x342293,_0x358dd2,_0x480662){return new BPromise(function(_0x45b83f,_0x2cc2c5){var _0x837683=_0x480662||client;return _0x837683[_0x85c8('0x1a')](_0x59a1d3,_0x358dd2)[_0x85c8('0x1b')](function(_0x85fd30){logger['info']('Setting,\x20%s,\x20%s',_0x342293,_0x85c8('0x1c'));logger[_0x85c8('0x1d')](_0x85c8('0x1e'),_0x342293,_0x85c8('0x1c'),JSON[_0x85c8('0x1f')](_0x85fd30));if(_0x85fd30[_0x85c8('0x20')]){if(_0x85fd30[_0x85c8('0x20')][_0x85c8('0x21')]===0x1f4){logger[_0x85c8('0x20')]('Setting,\x20%s,\x20%s',_0x342293,_0x85fd30[_0x85c8('0x20')]['message']);return _0x2cc2c5(_0x85fd30[_0x85c8('0x20')][_0x85c8('0x22')]);}logger[_0x85c8('0x20')](_0x85c8('0x23'),_0x342293,_0x85fd30[_0x85c8('0x20')][_0x85c8('0x22')]);return _0x45b83f(_0x85fd30[_0x85c8('0x20')][_0x85c8('0x22')]);}else{logger[_0x85c8('0x24')](_0x85c8('0x23'),_0x342293,'request\x20sent');_0x45b83f(_0x85fd30['result'][_0x85c8('0x22')]);}})['catch'](function(_0x44049b){logger[_0x85c8('0x20')]('Setting,\x20%s,\x20%s',_0x342293,_0x44049b);_0x2cc2c5(_0x44049b);});});}function respondWithStatusCode(_0x45357b,_0x2d9f5d){_0x2d9f5d=_0x2d9f5d||0xcc;return function(_0x39c28c){if(_0x39c28c){return _0x45357b['sendStatus'](_0x2d9f5d);}return _0x45357b['status'](_0x2d9f5d)[_0x85c8('0x25')]();};}function respondWithResult(_0x4dbc0f,_0x4a4cef){_0x4a4cef=_0x4a4cef||0xc8;return function(_0x230daf){if(_0x230daf){return _0x4dbc0f[_0x85c8('0x26')](_0x4a4cef)[_0x85c8('0x27')](_0x230daf);}};}function respondWithFilteredResult(_0x5a5e3f,_0x82112d){return function(_0x1bec22){if(_0x1bec22){var _0xef6131=typeof _0x82112d[_0x85c8('0x28')]===_0x85c8('0x29')&&typeof _0x82112d[_0x85c8('0x2a')]==='undefined';var _0x1fc87b=_0x1bec22[_0x85c8('0x2b')];var _0x443487=_0xef6131?0x0:_0x82112d[_0x85c8('0x28')];var _0x420168=_0xef6131?_0x1bec22[_0x85c8('0x2b')]:_0x82112d[_0x85c8('0x28')]+_0x82112d[_0x85c8('0x2a')];var _0x5e7ace;if(_0x420168>=_0x1fc87b){_0x420168=_0x1fc87b;_0x5e7ace=0xc8;}else{_0x5e7ace=0xce;}_0x5a5e3f[_0x85c8('0x26')](_0x5e7ace);return _0x5a5e3f[_0x85c8('0x2c')](_0x85c8('0x2d'),_0x443487+'-'+_0x420168+'/'+_0x1fc87b)[_0x85c8('0x27')](_0x1bec22);}return null;};}function patchUpdates(_0x48b467){return function(_0x217208){try{jsonpatch[_0x85c8('0x2e')](_0x217208,_0x48b467,!![]);}catch(_0x516259){return BPromise[_0x85c8('0x2f')](_0x516259);}return _0x217208[_0x85c8('0x30')]();};}function saveUpdates(_0x569730,_0x33a19e){return function(_0x2ea875){if(_0x2ea875){return _0x2ea875['update'](_0x569730)['then'](function(_0x489039){return _0x489039;});}return null;};}function removeEntity(_0x9fbddb,_0x594a1c){return function(_0x14ae7d){if(_0x14ae7d){return _0x14ae7d[_0x85c8('0x31')]()[_0x85c8('0x1b')](function(){_0x9fbddb[_0x85c8('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x516daf,_0xd36e21){return function(_0x3619ff){if(!_0x3619ff){_0x516daf[_0x85c8('0x32')](0x194);}return _0x3619ff;};}function handleError(_0x121b93,_0x26130f){_0x26130f=_0x26130f||0x1f4;return function(_0x46966c){logger['error'](_0x46966c[_0x85c8('0x33')]);if(_0x46966c[_0x85c8('0x34')]){delete _0x46966c['name'];}_0x121b93[_0x85c8('0x26')](_0x26130f)[_0x85c8('0x35')](_0x46966c);};}exports[_0x85c8('0x36')]=function(_0x3ab238,_0xc931d4){var _0x23ed0e={},_0x39aaa7={},_0x14f504={'count':0x0,'rows':[]};var _0xd921e9=_[_0x85c8('0x37')](db['Setting'][_0x85c8('0x38')],function(_0x5296a9){return{'name':_0x5296a9[_0x85c8('0x39')],'type':_0x5296a9[_0x85c8('0x3a')][_0x85c8('0x3b')]};});_0x39aaa7[_0x85c8('0x3c')]=_['map'](_0xd921e9,'name');_0x39aaa7[_0x85c8('0x3d')]=_[_0x85c8('0x3e')](_0x3ab238[_0x85c8('0x3d')]);_0x39aaa7[_0x85c8('0x3f')]=_[_0x85c8('0x40')](_0x39aaa7[_0x85c8('0x3c')],_0x39aaa7[_0x85c8('0x3d')]);_0x23ed0e[_0x85c8('0x41')]=_[_0x85c8('0x40')](_0x39aaa7['model'],qs[_0x85c8('0x42')](_0x3ab238[_0x85c8('0x3d')][_0x85c8('0x42')]));_0x23ed0e['attributes']=_0x23ed0e['attributes'][_0x85c8('0x43')]?_0x23ed0e[_0x85c8('0x41')]:_0x39aaa7[_0x85c8('0x3c')];if(!_0x3ab238[_0x85c8('0x3d')][_0x85c8('0x44')](_0x85c8('0x45'))){_0x23ed0e[_0x85c8('0x2a')]=qs['limit'](_0x3ab238[_0x85c8('0x3d')]['limit']);_0x23ed0e[_0x85c8('0x28')]=qs[_0x85c8('0x28')](_0x3ab238[_0x85c8('0x3d')][_0x85c8('0x28')]);}_0x23ed0e[_0x85c8('0x46')]=qs[_0x85c8('0x47')](_0x3ab238[_0x85c8('0x3d')][_0x85c8('0x47')]);_0x23ed0e[_0x85c8('0x48')]=qs[_0x85c8('0x3f')](_[_0x85c8('0x49')](_0x3ab238['query'],_0x39aaa7[_0x85c8('0x3f')]),_0xd921e9);if(_0x3ab238['query'][_0x85c8('0x4a')]){_0x23ed0e[_0x85c8('0x48')]=_[_0x85c8('0x4b')](_0x23ed0e[_0x85c8('0x48')],{'$or':_[_0x85c8('0x37')](_0xd921e9,function(_0x4aad33){if(_0x4aad33[_0x85c8('0x3a')]!==_0x85c8('0x4c')){var _0x396e98={};_0x396e98[_0x4aad33[_0x85c8('0x34')]]={'$like':'%'+_0x3ab238[_0x85c8('0x3d')][_0x85c8('0x4a')]+'%'};return _0x396e98;}})});}_0x23ed0e=_[_0x85c8('0x4b')]({},_0x23ed0e,_0x3ab238['options']);var _0x5174e6={'where':_0x23ed0e[_0x85c8('0x48')]};return db[_0x85c8('0x4d')][_0x85c8('0x2b')](_0x5174e6)['then'](function(_0xb3d906){_0x14f504[_0x85c8('0x2b')]=_0xb3d906;if(_0x3ab238['query'][_0x85c8('0x4e')]){_0x23ed0e[_0x85c8('0x4f')]=[{'all':!![]}];}return db[_0x85c8('0x4d')]['findAll'](_0x23ed0e);})[_0x85c8('0x1b')](function(_0xdf6d69){_0x14f504[_0x85c8('0x50')]=_0xdf6d69;return _0x14f504;})[_0x85c8('0x1b')](respondWithFilteredResult(_0xc931d4,_0x23ed0e))[_0x85c8('0x51')](handleError(_0xc931d4,null));};exports[_0x85c8('0x52')]=function(_0x47cfe0,_0x2dda89){var _0xc3c9ad={'raw':![],'where':{'id':_0x47cfe0[_0x85c8('0x53')]['id']}},_0x59413e={};_0x59413e['model']=_['keys'](db[_0x85c8('0x4d')]['rawAttributes']);_0x59413e[_0x85c8('0x3d')]=_[_0x85c8('0x3e')](_0x47cfe0[_0x85c8('0x3d')]);_0x59413e[_0x85c8('0x3f')]=_[_0x85c8('0x40')](_0x59413e[_0x85c8('0x3c')],_0x59413e[_0x85c8('0x3d')]);_0xc3c9ad[_0x85c8('0x41')]=_['intersection'](_0x59413e[_0x85c8('0x3c')],qs[_0x85c8('0x42')](_0x47cfe0[_0x85c8('0x3d')][_0x85c8('0x42')]));_0xc3c9ad['attributes']=_0xc3c9ad[_0x85c8('0x41')][_0x85c8('0x43')]?_0xc3c9ad[_0x85c8('0x41')]:_0x59413e[_0x85c8('0x3c')];if(_0x47cfe0['query'][_0x85c8('0x4e')]){_0xc3c9ad[_0x85c8('0x4f')]=[{'all':!![]}];}_0xc3c9ad=_[_0x85c8('0x4b')]({},_0xc3c9ad,_0x47cfe0[_0x85c8('0x54')]);return db[_0x85c8('0x4d')][_0x85c8('0x55')](_0xc3c9ad)[_0x85c8('0x1b')](handleEntityNotFound(_0x2dda89,null))[_0x85c8('0x1b')](respondWithResult(_0x2dda89,null))['catch'](handleError(_0x2dda89,null));};exports['update']=function(_0x1fbc4e,_0x3788c9){if(_0x1fbc4e[_0x85c8('0x56')]['id']){delete _0x1fbc4e['body']['id'];}return db[_0x85c8('0x4d')][_0x85c8('0x55')]({'where':{'id':_0x1fbc4e['params']['id']}})[_0x85c8('0x1b')](handleEntityNotFound(_0x3788c9,null))['then'](saveUpdates(_0x1fbc4e[_0x85c8('0x56')],null))[_0x85c8('0x1b')](respondWithResult(_0x3788c9,null))[_0x85c8('0x51')](handleError(_0x3788c9,null));};exports[_0x85c8('0x57')]=function(_0x1c0a31,_0x404693,_0x388bd5){if(_0x1c0a31['file']&&_0x1c0a31[_0x85c8('0x58')][_0x85c8('0x59')]){_0x1c0a31[_0x85c8('0x56')][_0x85c8('0x5a')]=_0x1c0a31[_0x85c8('0x58')]['filename'];}return db[_0x85c8('0x4d')]['find']({'where':{'id':_0x1c0a31[_0x85c8('0x53')]['id']}})[_0x85c8('0x1b')](handleEntityNotFound(_0x404693,null))[_0x85c8('0x1b')](saveUpdates(_0x1c0a31[_0x85c8('0x56')],null))[_0x85c8('0x1b')](respondWithResult(_0x404693,null))[_0x85c8('0x51')](handleError(_0x404693,null));};exports[_0x85c8('0x5b')]=function(_0x879641,_0xfdb6d,_0x551e42){if(_0x879641[_0x85c8('0x58')]&&_0x879641['file'][_0x85c8('0x59')]){_0x879641[_0x85c8('0x56')][_0x85c8('0x5c')]=_0x879641['file'][_0x85c8('0x59')];}return db['Setting'][_0x85c8('0x55')]({'where':{'id':_0x879641[_0x85c8('0x53')]['id']}})['then'](handleEntityNotFound(_0xfdb6d,null))[_0x85c8('0x1b')](saveUpdates(_0x879641['body'],null))[_0x85c8('0x1b')](respondWithResult(_0xfdb6d,null))['catch'](handleError(_0xfdb6d,null));};var utilLicense=require(_0x85c8('0x5d'));exports[_0x85c8('0x5e')]=function(_0x159154,_0x22cf37,_0xa79fa3){var _0x4b1efb=_0x85c8('0x5f');var _0x43e42a={'custom':![]};return utilLicense[_0x85c8('0x60')]()[_0x85c8('0x1b')](function(_0x1b46e0){if(_0x1b46e0){_0x43e42a=_0x1b46e0;}return db[_0x85c8('0x4d')][_0x85c8('0x55')]({'where':{'id':_0x159154[_0x85c8('0x53')]['id']},'attributes':[_0x85c8('0x5a'),'loginLogo','preferred',_0x85c8('0x61'),_0x85c8('0x62'),'defaultLoginLogo',_0x85c8('0x63'),'defaultFavicon'],'raw':!![]});})[_0x85c8('0x1b')](handleEntityNotFound(_0x22cf37,null))[_0x85c8('0x1b')](function(_0x2355eb){if(_0x2355eb){var _0x4c7965=_0x2355eb[_0x85c8('0x5a')]&&fs['existsSync'](path[_0x85c8('0x64')](config[_0x85c8('0x65')],_0x4b1efb,_[_0x85c8('0x66')](_0x2355eb[_0x85c8('0x5a')])))?path[_0x85c8('0x64')](config['root'],_0x4b1efb,_[_0x85c8('0x66')](_0x2355eb[_0x85c8('0x5a')])):path[_0x85c8('0x64')](config['root'],_0x4b1efb,_['toLower'](_0x85c8('0x67')));var _0x1caa82=_0x85c8('0x68')+_['upperFirst'](_0x85c8('0x5a'));if(_0x2355eb[_0x1caa82]||!_0x43e42a[_0x85c8('0x69')]){_0x4c7965=path[_0x85c8('0x64')](config[_0x85c8('0x65')],_0x4b1efb,_[_0x85c8('0x66')](_0x85c8('0x67')));}if(!fs['existsSync'](_0x4c7965)){throw new db[(_0x85c8('0x6a'))][(_0x85c8('0x6b'))](_[_0x85c8('0x6c')](_0x85c8('0x5a'))+'\x20not\x20found');}return _0x22cf37[_0x85c8('0x6d')](_0x4c7965);}})['catch'](handleError(_0x22cf37,null));};var utilLicense=require(_0x85c8('0x5d'));exports[_0x85c8('0x6e')]=function(_0x4f766d,_0x1f34d8,_0x37ce79){var _0x23091c='server/files/images/logos';var _0x39ae24={'custom':![]};return utilLicense[_0x85c8('0x60')]()[_0x85c8('0x1b')](function(_0x212acf){if(_0x212acf){_0x39ae24=_0x212acf;}return db[_0x85c8('0x4d')][_0x85c8('0x55')]({'where':{'id':_0x4f766d['params']['id']},'attributes':['logo',_0x85c8('0x5c'),'preferred',_0x85c8('0x61'),_0x85c8('0x62'),_0x85c8('0x6f'),'defaultPreferred',_0x85c8('0x70')],'raw':!![]});})[_0x85c8('0x1b')](handleEntityNotFound(_0x1f34d8,null))[_0x85c8('0x1b')](function(_0x4ce349){if(_0x4ce349){var _0x4057c0=_0x4ce349[_0x85c8('0x5c')]&&fs[_0x85c8('0x71')](path[_0x85c8('0x64')](config[_0x85c8('0x65')],_0x23091c,_[_0x85c8('0x66')](_0x4ce349[_0x85c8('0x5c')])))?path[_0x85c8('0x64')](config['root'],_0x23091c,_[_0x85c8('0x66')](_0x4ce349[_0x85c8('0x5c')])):path[_0x85c8('0x64')](config[_0x85c8('0x65')],_0x23091c,_[_0x85c8('0x66')](_0x85c8('0x72')));var _0x268ce5=_0x85c8('0x68')+_['upperFirst'](_0x85c8('0x5c'));if(_0x4ce349[_0x268ce5]||!_0x39ae24[_0x85c8('0x69')]){_0x4057c0=path[_0x85c8('0x64')](config['root'],_0x23091c,_[_0x85c8('0x66')](_0x85c8('0x72')));}if(!fs['existsSync'](_0x4057c0)){throw new db[(_0x85c8('0x6a'))]['ValidationError'](_['upperFirst'](_0x85c8('0x5c'))+_0x85c8('0x73'));}return _0x1f34d8[_0x85c8('0x6d')](_0x4057c0);}})[_0x85c8('0x51')](handleError(_0x1f34d8,null));};exports['gdpr']=function(_0x4d9a5e,_0x51d788){return db[_0x85c8('0x4d')][_0x85c8('0x55')]({'where':{'id':_0x4d9a5e[_0x85c8('0x53')]['id']},'attributes':[_0x85c8('0x74')]})['then'](respondWithResult(_0x51d788,null))[_0x85c8('0x51')](handleError(_0x51d788,null));};exports[_0x85c8('0x75')]=function(_0x31d5dc,_0x38d240,_0x43c836){if(_0x31d5dc[_0x85c8('0x58')]&&_0x31d5dc[_0x85c8('0x58')]['filename']){_0x31d5dc['body'][_0x85c8('0x76')]=_0x31d5dc[_0x85c8('0x58')][_0x85c8('0x59')];}return db['Setting'][_0x85c8('0x55')]({'where':{'id':_0x31d5dc[_0x85c8('0x53')]['id']}})[_0x85c8('0x1b')](handleEntityNotFound(_0x38d240,null))['then'](saveUpdates(_0x31d5dc['body'],null))[_0x85c8('0x1b')](respondWithResult(_0x38d240,null))[_0x85c8('0x51')](handleError(_0x38d240,null));};var utilLicense=require(_0x85c8('0x5d'));exports[_0x85c8('0x77')]=function(_0x332998,_0xb6f546,_0x5ed564){var _0x649d=_0x85c8('0x5f');var _0x23eac4={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x412e0e){if(_0x412e0e){_0x23eac4=_0x412e0e;}return db[_0x85c8('0x4d')][_0x85c8('0x55')]({'where':{'id':_0x332998[_0x85c8('0x53')]['id']},'attributes':['logo','loginLogo',_0x85c8('0x76'),'favicon',_0x85c8('0x62'),_0x85c8('0x6f'),_0x85c8('0x63'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0xb6f546,null))[_0x85c8('0x1b')](function(_0x2e80ad){if(_0x2e80ad){var _0x259446=_0x2e80ad[_0x85c8('0x76')]&&fs['existsSync'](path[_0x85c8('0x64')](config[_0x85c8('0x65')],_0x649d,_[_0x85c8('0x66')](_0x2e80ad[_0x85c8('0x76')])))?path[_0x85c8('0x64')](config[_0x85c8('0x65')],_0x649d,_[_0x85c8('0x66')](_0x2e80ad[_0x85c8('0x76')])):path['join'](config[_0x85c8('0x65')],_0x649d,_['toLower'](_0x85c8('0x78')));var _0x2b6d91=_0x85c8('0x68')+_[_0x85c8('0x6c')]('preferred');if(_0x2e80ad[_0x2b6d91]||!_0x23eac4['custom']||!_0x23eac4[_0x85c8('0x76')]){_0x259446=path['join'](config['root'],_0x649d,_[_0x85c8('0x66')](_0x85c8('0x78')));}if(!fs['existsSync'](_0x259446)){throw new db[(_0x85c8('0x6a'))]['ValidationError'](_[_0x85c8('0x6c')](_0x85c8('0x76'))+_0x85c8('0x73'));}return _0xb6f546[_0x85c8('0x6d')](_0x259446);}})[_0x85c8('0x51')](handleError(_0xb6f546,null));};exports['addFavicon']=function(_0x54cfc6,_0x23d610,_0x71e68c){if(_0x54cfc6[_0x85c8('0x58')]&&_0x54cfc6[_0x85c8('0x58')]['filename']){_0x54cfc6['body'][_0x85c8('0x61')]=_0x54cfc6[_0x85c8('0x58')][_0x85c8('0x59')];}return db[_0x85c8('0x4d')][_0x85c8('0x55')]({'where':{'id':_0x54cfc6[_0x85c8('0x53')]['id']}})['then'](handleEntityNotFound(_0x23d610,null))[_0x85c8('0x1b')](saveUpdates(_0x54cfc6[_0x85c8('0x56')],null))[_0x85c8('0x1b')](respondWithResult(_0x23d610,null))[_0x85c8('0x51')](handleError(_0x23d610,null));};var utilLicense=require(_0x85c8('0x5d'));exports[_0x85c8('0x79')]=function(_0x3a28ba,_0x540f27,_0x43498f){var _0x261e7a=_0x85c8('0x5f');var _0x506eb2={'custom':![]};return utilLicense[_0x85c8('0x60')]()[_0x85c8('0x1b')](function(_0x4ff943){if(_0x4ff943){_0x506eb2=_0x4ff943;}return db[_0x85c8('0x4d')][_0x85c8('0x55')]({'where':{'id':_0x3a28ba[_0x85c8('0x53')]['id']},'attributes':[_0x85c8('0x5a'),_0x85c8('0x5c'),_0x85c8('0x76'),_0x85c8('0x61'),'defaultLogo',_0x85c8('0x6f'),_0x85c8('0x63'),_0x85c8('0x70')],'raw':!![]});})[_0x85c8('0x1b')](handleEntityNotFound(_0x540f27,null))['then'](function(_0x3af171){if(_0x3af171){var _0x1b3c4f=_0x3af171['favicon']&&fs['existsSync'](path[_0x85c8('0x64')](config[_0x85c8('0x65')],_0x261e7a,_[_0x85c8('0x66')](_0x3af171[_0x85c8('0x61')])))?path[_0x85c8('0x64')](config[_0x85c8('0x65')],_0x261e7a,_[_0x85c8('0x66')](_0x3af171['favicon'])):path['join'](config[_0x85c8('0x65')],_0x261e7a,_[_0x85c8('0x66')](_0x85c8('0x7a')));var _0x237a20=_0x85c8('0x68')+_[_0x85c8('0x6c')](_0x85c8('0x61'));if(_0x3af171[_0x237a20]||!_0x506eb2[_0x85c8('0x69')]){_0x1b3c4f=path[_0x85c8('0x64')](config[_0x85c8('0x65')],_0x261e7a,_['toLower'](_0x85c8('0x7a')));}if(!fs[_0x85c8('0x71')](_0x1b3c4f)){throw new db[(_0x85c8('0x6a'))][(_0x85c8('0x6b'))](_[_0x85c8('0x6c')](_0x85c8('0x61'))+_0x85c8('0x73'));}return _0x540f27[_0x85c8('0x6d')](_0x1b3c4f);}})['catch'](handleError(_0x540f27,null));};exports['getDate']=function(_0x2fae4c,_0x79dc17){var _0x2ce035={'offset':moment()[_0x85c8('0x7b')]()};_0x2ce035[_0x85c8('0x7c')]=moment()[_0x85c8('0x7b')](_0x2ce035[_0x85c8('0x28')])[_0x85c8('0x7d')](_0x85c8('0x7e'));return _0x79dc17['status'](0xc8)[_0x85c8('0x35')](_0x2ce035);}; \ No newline at end of file +var _0x4e92=['mustache','path','sox','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/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','save','update','destroy','stack','name','send','map','Setting','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','merge','find','body','file','filename','logo','addLogoLogin','loginLogo','getLogo','getLicense','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','default','upperFirst','custom','ValidationError','\x20not\x20found','getLogoLogin','server/files/images/logos','favicon','default_loginLogo.svg','Sequelize','download','gdpr','securePassword','preferred','getPreferred','default_preferred.png','addFavicon','default_favicon.ico','getDate','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','request-promise','moment','bluebird'];(function(_0x429370,_0x46ff4c){var _0x41a3ad=function(_0x47d51e){while(--_0x47d51e){_0x429370['push'](_0x429370['shift']());}};_0x41a3ad(++_0x46ff4c);}(_0x4e92,0xed));var _0x24e9=function(_0x559a80,_0x3d193d){_0x559a80=_0x559a80-0x0;var _0x42f555=_0x4e92[_0x559a80];return _0x42f555;};'use strict';var emlformat=require(_0x24e9('0x0'));var rimraf=require(_0x24e9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x24e9('0x2'));var moment=require(_0x24e9('0x3'));var BPromise=require(_0x24e9('0x4'));var Mustache=require(_0x24e9('0x5'));var util=require('util');var path=require(_0x24e9('0x6'));var sox=require(_0x24e9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x24e9('0x8'));var _=require(_0x24e9('0x9'));var squel=require(_0x24e9('0xa'));var crypto=require(_0x24e9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x24e9('0xc'));var toCsv=require('to-csv');var querystring=require(_0x24e9('0xd'));var Papa=require(_0x24e9('0xe'));var Redis=require(_0x24e9('0xf'));var authService=require(_0x24e9('0x10'));var qs=require(_0x24e9('0x11'));var as=require(_0x24e9('0x12'));var hardwareService=require(_0x24e9('0x13'));var logger=require(_0x24e9('0x14'))(_0x24e9('0x15'));var utils=require(_0x24e9('0x16'));var config=require(_0x24e9('0x17'));var licenseUtil=require(_0x24e9('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x24e9('0x19'));var client=jayson[_0x24e9('0x1a')][_0x24e9('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x48f6bd,_0x5a80c1,_0x218a2c,_0x44bd53){return new BPromise(function(_0x355869,_0x571d56){var _0x94f813=_0x44bd53||client;return _0x94f813[_0x24e9('0x1c')](_0x48f6bd,_0x218a2c)[_0x24e9('0x1d')](function(_0x5a640a){logger['info'](_0x24e9('0x1e'),_0x5a80c1,_0x24e9('0x1f'));logger[_0x24e9('0x20')]('Setting,\x20%s,\x20%s,\x20%s',_0x5a80c1,_0x24e9('0x1f'),JSON['stringify'](_0x5a640a));if(_0x5a640a[_0x24e9('0x21')]){if(_0x5a640a[_0x24e9('0x21')][_0x24e9('0x22')]===0x1f4){logger[_0x24e9('0x21')](_0x24e9('0x1e'),_0x5a80c1,_0x5a640a[_0x24e9('0x21')][_0x24e9('0x23')]);return _0x571d56(_0x5a640a[_0x24e9('0x21')]['message']);}logger[_0x24e9('0x21')](_0x24e9('0x1e'),_0x5a80c1,_0x5a640a[_0x24e9('0x21')][_0x24e9('0x23')]);return _0x355869(_0x5a640a[_0x24e9('0x21')][_0x24e9('0x23')]);}else{logger[_0x24e9('0x24')](_0x24e9('0x1e'),_0x5a80c1,_0x24e9('0x1f'));_0x355869(_0x5a640a[_0x24e9('0x25')]['message']);}})[_0x24e9('0x26')](function(_0x454aac){logger[_0x24e9('0x21')](_0x24e9('0x1e'),_0x5a80c1,_0x454aac);_0x571d56(_0x454aac);});});}function respondWithStatusCode(_0x49e3ed,_0x22e819){_0x22e819=_0x22e819||0xcc;return function(_0x483241){if(_0x483241){return _0x49e3ed[_0x24e9('0x27')](_0x22e819);}return _0x49e3ed[_0x24e9('0x28')](_0x22e819)[_0x24e9('0x29')]();};}function respondWithResult(_0xff918a,_0x16d514){_0x16d514=_0x16d514||0xc8;return function(_0x134e2a){if(_0x134e2a){return _0xff918a[_0x24e9('0x28')](_0x16d514)['json'](_0x134e2a);}};}function respondWithFilteredResult(_0x348c88,_0x50f8b0){return function(_0x49935d){if(_0x49935d){var _0x48f229=typeof _0x50f8b0[_0x24e9('0x2a')]===_0x24e9('0x2b')&&typeof _0x50f8b0[_0x24e9('0x2c')]===_0x24e9('0x2b');var _0x34371e=_0x49935d[_0x24e9('0x2d')];var _0x528366=_0x48f229?0x0:_0x50f8b0[_0x24e9('0x2a')];var _0xc7be59=_0x48f229?_0x49935d['count']:_0x50f8b0[_0x24e9('0x2a')]+_0x50f8b0[_0x24e9('0x2c')];var _0x195f81;if(_0xc7be59>=_0x34371e){_0xc7be59=_0x34371e;_0x195f81=0xc8;}else{_0x195f81=0xce;}_0x348c88[_0x24e9('0x28')](_0x195f81);return _0x348c88['set'](_0x24e9('0x2e'),_0x528366+'-'+_0xc7be59+'/'+_0x34371e)['json'](_0x49935d);}return null;};}function patchUpdates(_0x46ef89){return function(_0x150b94){try{jsonpatch['apply'](_0x150b94,_0x46ef89,!![]);}catch(_0x2d6dc6){return BPromise['reject'](_0x2d6dc6);}return _0x150b94[_0x24e9('0x2f')]();};}function saveUpdates(_0x3c353b,_0x32b850){return function(_0x2a5ad5){if(_0x2a5ad5){return _0x2a5ad5[_0x24e9('0x30')](_0x3c353b)[_0x24e9('0x1d')](function(_0x4a8248){return _0x4a8248;});}return null;};}function removeEntity(_0x25c026,_0x51dc09){return function(_0x167500){if(_0x167500){return _0x167500[_0x24e9('0x31')]()[_0x24e9('0x1d')](function(){_0x25c026[_0x24e9('0x28')](0xcc)[_0x24e9('0x29')]();});}};}function handleEntityNotFound(_0x569366,_0x15e8f0){return function(_0x112082){if(!_0x112082){_0x569366[_0x24e9('0x27')](0x194);}return _0x112082;};}function handleError(_0xfbfcd1,_0x3025f7){_0x3025f7=_0x3025f7||0x1f4;return function(_0x219720){logger[_0x24e9('0x21')](_0x219720[_0x24e9('0x32')]);if(_0x219720[_0x24e9('0x33')]){delete _0x219720[_0x24e9('0x33')];}_0xfbfcd1[_0x24e9('0x28')](_0x3025f7)[_0x24e9('0x34')](_0x219720);};}exports['index']=function(_0x38f430,_0x1d6edf){var _0x5a9d8e={},_0x4e0573={},_0x531f4e={'count':0x0,'rows':[]};var _0x172d84=_[_0x24e9('0x35')](db[_0x24e9('0x36')][_0x24e9('0x37')],function(_0x2cdda5){return{'name':_0x2cdda5[_0x24e9('0x38')],'type':_0x2cdda5['type'][_0x24e9('0x39')]};});_0x4e0573[_0x24e9('0x3a')]=_[_0x24e9('0x35')](_0x172d84,_0x24e9('0x33'));_0x4e0573[_0x24e9('0x3b')]=_['keys'](_0x38f430[_0x24e9('0x3b')]);_0x4e0573[_0x24e9('0x3c')]=_['intersection'](_0x4e0573[_0x24e9('0x3a')],_0x4e0573[_0x24e9('0x3b')]);_0x5a9d8e[_0x24e9('0x3d')]=_[_0x24e9('0x3e')](_0x4e0573[_0x24e9('0x3a')],qs[_0x24e9('0x3f')](_0x38f430[_0x24e9('0x3b')][_0x24e9('0x3f')]));_0x5a9d8e[_0x24e9('0x3d')]=_0x5a9d8e['attributes'][_0x24e9('0x40')]?_0x5a9d8e['attributes']:_0x4e0573[_0x24e9('0x3a')];if(!_0x38f430[_0x24e9('0x3b')][_0x24e9('0x41')](_0x24e9('0x42'))){_0x5a9d8e[_0x24e9('0x2c')]=qs[_0x24e9('0x2c')](_0x38f430[_0x24e9('0x3b')][_0x24e9('0x2c')]);_0x5a9d8e[_0x24e9('0x2a')]=qs[_0x24e9('0x2a')](_0x38f430[_0x24e9('0x3b')][_0x24e9('0x2a')]);}_0x5a9d8e[_0x24e9('0x43')]=qs[_0x24e9('0x44')](_0x38f430[_0x24e9('0x3b')][_0x24e9('0x44')]);_0x5a9d8e[_0x24e9('0x45')]=qs[_0x24e9('0x3c')](_['pick'](_0x38f430[_0x24e9('0x3b')],_0x4e0573[_0x24e9('0x3c')]),_0x172d84);if(_0x38f430['query']['filter']){_0x5a9d8e[_0x24e9('0x45')]=_['merge'](_0x5a9d8e[_0x24e9('0x45')],{'$or':_[_0x24e9('0x35')](_0x172d84,function(_0x2cbf7a){if(_0x2cbf7a['type']!==_0x24e9('0x46')){var _0x54983a={};_0x54983a[_0x2cbf7a[_0x24e9('0x33')]]={'$like':'%'+_0x38f430[_0x24e9('0x3b')][_0x24e9('0x47')]+'%'};return _0x54983a;}})});}_0x5a9d8e=_['merge']({},_0x5a9d8e,_0x38f430[_0x24e9('0x48')]);var _0x2457e5={'where':_0x5a9d8e[_0x24e9('0x45')]};return db[_0x24e9('0x36')]['count'](_0x2457e5)['then'](function(_0x43b48f){_0x531f4e[_0x24e9('0x2d')]=_0x43b48f;if(_0x38f430[_0x24e9('0x3b')][_0x24e9('0x49')]){_0x5a9d8e[_0x24e9('0x4a')]=[{'all':!![]}];}return db[_0x24e9('0x36')][_0x24e9('0x4b')](_0x5a9d8e);})[_0x24e9('0x1d')](function(_0x2ee4d1){_0x531f4e[_0x24e9('0x4c')]=_0x2ee4d1;return _0x531f4e;})['then'](respondWithFilteredResult(_0x1d6edf,_0x5a9d8e))['catch'](handleError(_0x1d6edf,null));};exports[_0x24e9('0x4d')]=function(_0x3ebdcd,_0x27c6bd){var _0x22492c={'raw':![],'where':{'id':_0x3ebdcd[_0x24e9('0x4e')]['id']}},_0x2ae9e2={};_0x2ae9e2['model']=_[_0x24e9('0x4f')](db[_0x24e9('0x36')][_0x24e9('0x37')]);_0x2ae9e2['query']=_[_0x24e9('0x4f')](_0x3ebdcd[_0x24e9('0x3b')]);_0x2ae9e2[_0x24e9('0x3c')]=_[_0x24e9('0x3e')](_0x2ae9e2[_0x24e9('0x3a')],_0x2ae9e2[_0x24e9('0x3b')]);_0x22492c[_0x24e9('0x3d')]=_[_0x24e9('0x3e')](_0x2ae9e2[_0x24e9('0x3a')],qs[_0x24e9('0x3f')](_0x3ebdcd[_0x24e9('0x3b')][_0x24e9('0x3f')]));_0x22492c['attributes']=_0x22492c[_0x24e9('0x3d')][_0x24e9('0x40')]?_0x22492c['attributes']:_0x2ae9e2['model'];if(_0x3ebdcd[_0x24e9('0x3b')][_0x24e9('0x49')]){_0x22492c[_0x24e9('0x4a')]=[{'all':!![]}];}_0x22492c=_[_0x24e9('0x50')]({},_0x22492c,_0x3ebdcd['options']);return db['Setting'][_0x24e9('0x51')](_0x22492c)[_0x24e9('0x1d')](handleEntityNotFound(_0x27c6bd,null))[_0x24e9('0x1d')](respondWithResult(_0x27c6bd,null))[_0x24e9('0x26')](handleError(_0x27c6bd,null));};exports['update']=function(_0x1ed3ef,_0x4608e2){if(_0x1ed3ef[_0x24e9('0x52')]['id']){delete _0x1ed3ef[_0x24e9('0x52')]['id'];}return db[_0x24e9('0x36')]['find']({'where':{'id':_0x1ed3ef[_0x24e9('0x4e')]['id']}})[_0x24e9('0x1d')](handleEntityNotFound(_0x4608e2,null))[_0x24e9('0x1d')](saveUpdates(_0x1ed3ef[_0x24e9('0x52')],null))['then'](respondWithResult(_0x4608e2,null))['catch'](handleError(_0x4608e2,null));};exports['addLogo']=function(_0x52355b,_0x4ba7d2,_0x2ea134){if(_0x52355b[_0x24e9('0x53')]&&_0x52355b['file'][_0x24e9('0x54')]){_0x52355b[_0x24e9('0x52')][_0x24e9('0x55')]=_0x52355b['file'][_0x24e9('0x54')];}return db[_0x24e9('0x36')][_0x24e9('0x51')]({'where':{'id':_0x52355b[_0x24e9('0x4e')]['id']}})[_0x24e9('0x1d')](handleEntityNotFound(_0x4ba7d2,null))[_0x24e9('0x1d')](saveUpdates(_0x52355b['body'],null))[_0x24e9('0x1d')](respondWithResult(_0x4ba7d2,null))[_0x24e9('0x26')](handleError(_0x4ba7d2,null));};exports[_0x24e9('0x56')]=function(_0x150c66,_0x573cf0,_0x5c9c34){if(_0x150c66[_0x24e9('0x53')]&&_0x150c66['file'][_0x24e9('0x54')]){_0x150c66[_0x24e9('0x52')][_0x24e9('0x57')]=_0x150c66[_0x24e9('0x53')][_0x24e9('0x54')];}return db[_0x24e9('0x36')][_0x24e9('0x51')]({'where':{'id':_0x150c66[_0x24e9('0x4e')]['id']}})[_0x24e9('0x1d')](handleEntityNotFound(_0x573cf0,null))[_0x24e9('0x1d')](saveUpdates(_0x150c66[_0x24e9('0x52')],null))[_0x24e9('0x1d')](respondWithResult(_0x573cf0,null))[_0x24e9('0x26')](handleError(_0x573cf0,null));};var utilLicense=require(_0x24e9('0x18'));exports[_0x24e9('0x58')]=function(_0x3b1673,_0x19b6ef,_0x3cf26f){var _0x6414e8='server/files/images/logos';var _0x29016c={'custom':![]};return utilLicense[_0x24e9('0x59')]()[_0x24e9('0x1d')](function(_0xd752d5){if(_0xd752d5){_0x29016c=_0xd752d5;}return db[_0x24e9('0x36')][_0x24e9('0x51')]({'where':{'id':_0x3b1673[_0x24e9('0x4e')]['id']},'attributes':[_0x24e9('0x55'),_0x24e9('0x57'),'preferred','favicon',_0x24e9('0x5a'),_0x24e9('0x5b'),_0x24e9('0x5c'),_0x24e9('0x5d')],'raw':!![]});})[_0x24e9('0x1d')](handleEntityNotFound(_0x19b6ef,null))['then'](function(_0x3e872e){if(_0x3e872e){var _0x14d596=_0x3e872e['logo']&&fs[_0x24e9('0x5e')](path[_0x24e9('0x5f')](config['root'],_0x6414e8,_[_0x24e9('0x60')](_0x3e872e[_0x24e9('0x55')])))?path[_0x24e9('0x5f')](config[_0x24e9('0x61')],_0x6414e8,_['toLower'](_0x3e872e[_0x24e9('0x55')])):path[_0x24e9('0x5f')](config[_0x24e9('0x61')],_0x6414e8,_[_0x24e9('0x60')](_0x24e9('0x62')));var _0x19d980=_0x24e9('0x63')+_[_0x24e9('0x64')](_0x24e9('0x55'));if(_0x3e872e[_0x19d980]||!_0x29016c[_0x24e9('0x65')]){_0x14d596=path[_0x24e9('0x5f')](config[_0x24e9('0x61')],_0x6414e8,_['toLower'](_0x24e9('0x62')));}if(!fs[_0x24e9('0x5e')](_0x14d596)){throw new db['Sequelize'][(_0x24e9('0x66'))](_[_0x24e9('0x64')](_0x24e9('0x55'))+_0x24e9('0x67'));}return _0x19b6ef['download'](_0x14d596);}})[_0x24e9('0x26')](handleError(_0x19b6ef,null));};var utilLicense=require(_0x24e9('0x18'));exports[_0x24e9('0x68')]=function(_0x58f36c,_0x30cc21,_0x3a7fe0){var _0x90184b=_0x24e9('0x69');var _0x535d66={'custom':![]};return utilLicense[_0x24e9('0x59')]()['then'](function(_0x450896){if(_0x450896){_0x535d66=_0x450896;}return db['Setting'][_0x24e9('0x51')]({'where':{'id':_0x58f36c[_0x24e9('0x4e')]['id']},'attributes':[_0x24e9('0x55'),_0x24e9('0x57'),'preferred',_0x24e9('0x6a'),'defaultLogo',_0x24e9('0x5b'),_0x24e9('0x5c'),_0x24e9('0x5d')],'raw':!![]});})[_0x24e9('0x1d')](handleEntityNotFound(_0x30cc21,null))[_0x24e9('0x1d')](function(_0x481577){if(_0x481577){var _0x5b64bf=_0x481577[_0x24e9('0x57')]&&fs[_0x24e9('0x5e')](path['join'](config[_0x24e9('0x61')],_0x90184b,_[_0x24e9('0x60')](_0x481577[_0x24e9('0x57')])))?path['join'](config[_0x24e9('0x61')],_0x90184b,_[_0x24e9('0x60')](_0x481577[_0x24e9('0x57')])):path[_0x24e9('0x5f')](config[_0x24e9('0x61')],_0x90184b,_['toLower'](_0x24e9('0x6b')));var _0x5f5b2c='default'+_[_0x24e9('0x64')](_0x24e9('0x57'));if(_0x481577[_0x5f5b2c]||!_0x535d66['custom']){_0x5b64bf=path[_0x24e9('0x5f')](config[_0x24e9('0x61')],_0x90184b,_[_0x24e9('0x60')]('default_loginLogo.svg'));}if(!fs['existsSync'](_0x5b64bf)){throw new db[(_0x24e9('0x6c'))]['ValidationError'](_[_0x24e9('0x64')](_0x24e9('0x57'))+_0x24e9('0x67'));}return _0x30cc21[_0x24e9('0x6d')](_0x5b64bf);}})[_0x24e9('0x26')](handleError(_0x30cc21,null));};exports[_0x24e9('0x6e')]=function(_0x4f2def,_0x5e3f2e){return db[_0x24e9('0x36')][_0x24e9('0x51')]({'where':{'id':_0x4f2def[_0x24e9('0x4e')]['id']},'attributes':[_0x24e9('0x6f')]})[_0x24e9('0x1d')](respondWithResult(_0x5e3f2e,null))[_0x24e9('0x26')](handleError(_0x5e3f2e,null));};exports['addPreferred']=function(_0x168c6d,_0x3941f7,_0x54d420){if(_0x168c6d[_0x24e9('0x53')]&&_0x168c6d['file']['filename']){_0x168c6d[_0x24e9('0x52')][_0x24e9('0x70')]=_0x168c6d[_0x24e9('0x53')][_0x24e9('0x54')];}return db[_0x24e9('0x36')][_0x24e9('0x51')]({'where':{'id':_0x168c6d[_0x24e9('0x4e')]['id']}})[_0x24e9('0x1d')](handleEntityNotFound(_0x3941f7,null))[_0x24e9('0x1d')](saveUpdates(_0x168c6d[_0x24e9('0x52')],null))[_0x24e9('0x1d')](respondWithResult(_0x3941f7,null))[_0x24e9('0x26')](handleError(_0x3941f7,null));};var utilLicense=require(_0x24e9('0x18'));exports[_0x24e9('0x71')]=function(_0xf0ffca,_0x7fb90e,_0x3a0c35){var _0x1c15fd=_0x24e9('0x69');var _0x362eb8={'custom':![]};return utilLicense[_0x24e9('0x59')]()[_0x24e9('0x1d')](function(_0x2b805c){if(_0x2b805c){_0x362eb8=_0x2b805c;}return db['Setting'][_0x24e9('0x51')]({'where':{'id':_0xf0ffca['params']['id']},'attributes':[_0x24e9('0x55'),_0x24e9('0x57'),_0x24e9('0x70'),_0x24e9('0x6a'),_0x24e9('0x5a'),_0x24e9('0x5b'),_0x24e9('0x5c'),_0x24e9('0x5d')],'raw':!![]});})['then'](handleEntityNotFound(_0x7fb90e,null))[_0x24e9('0x1d')](function(_0xee4785){if(_0xee4785){var _0x1253dc=_0xee4785[_0x24e9('0x70')]&&fs[_0x24e9('0x5e')](path['join'](config[_0x24e9('0x61')],_0x1c15fd,_[_0x24e9('0x60')](_0xee4785[_0x24e9('0x70')])))?path['join'](config['root'],_0x1c15fd,_[_0x24e9('0x60')](_0xee4785[_0x24e9('0x70')])):path['join'](config[_0x24e9('0x61')],_0x1c15fd,_[_0x24e9('0x60')](_0x24e9('0x72')));var _0x116468=_0x24e9('0x63')+_[_0x24e9('0x64')](_0x24e9('0x70'));if(_0xee4785[_0x116468]||!_0x362eb8[_0x24e9('0x65')]||!_0x362eb8[_0x24e9('0x70')]){_0x1253dc=path[_0x24e9('0x5f')](config[_0x24e9('0x61')],_0x1c15fd,_[_0x24e9('0x60')](_0x24e9('0x72')));}if(!fs[_0x24e9('0x5e')](_0x1253dc)){throw new db[(_0x24e9('0x6c'))][(_0x24e9('0x66'))](_[_0x24e9('0x64')](_0x24e9('0x70'))+'\x20not\x20found');}return _0x7fb90e['download'](_0x1253dc);}})[_0x24e9('0x26')](handleError(_0x7fb90e,null));};exports[_0x24e9('0x73')]=function(_0x332557,_0x30f1e6,_0x405671){if(_0x332557['file']&&_0x332557['file'][_0x24e9('0x54')]){_0x332557['body'][_0x24e9('0x6a')]=_0x332557[_0x24e9('0x53')][_0x24e9('0x54')];}return db['Setting'][_0x24e9('0x51')]({'where':{'id':_0x332557[_0x24e9('0x4e')]['id']}})[_0x24e9('0x1d')](handleEntityNotFound(_0x30f1e6,null))[_0x24e9('0x1d')](saveUpdates(_0x332557[_0x24e9('0x52')],null))[_0x24e9('0x1d')](respondWithResult(_0x30f1e6,null))[_0x24e9('0x26')](handleError(_0x30f1e6,null));};var utilLicense=require('../../config/license/util');exports['getFavicon']=function(_0x15377e,_0x10d83f,_0x1cc396){var _0x424021=_0x24e9('0x69');var _0x2892a3={'custom':![]};return utilLicense[_0x24e9('0x59')]()[_0x24e9('0x1d')](function(_0x438075){if(_0x438075){_0x2892a3=_0x438075;}return db[_0x24e9('0x36')][_0x24e9('0x51')]({'where':{'id':_0x15377e[_0x24e9('0x4e')]['id']},'attributes':[_0x24e9('0x55'),_0x24e9('0x57'),_0x24e9('0x70'),'favicon',_0x24e9('0x5a'),_0x24e9('0x5b'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x24e9('0x1d')](handleEntityNotFound(_0x10d83f,null))[_0x24e9('0x1d')](function(_0x417027){if(_0x417027){var _0x3ed9cf=_0x417027[_0x24e9('0x6a')]&&fs[_0x24e9('0x5e')](path[_0x24e9('0x5f')](config[_0x24e9('0x61')],_0x424021,_[_0x24e9('0x60')](_0x417027[_0x24e9('0x6a')])))?path[_0x24e9('0x5f')](config[_0x24e9('0x61')],_0x424021,_['toLower'](_0x417027[_0x24e9('0x6a')])):path[_0x24e9('0x5f')](config[_0x24e9('0x61')],_0x424021,_[_0x24e9('0x60')](_0x24e9('0x74')));var _0x1d026d=_0x24e9('0x63')+_['upperFirst'](_0x24e9('0x6a'));if(_0x417027[_0x1d026d]||!_0x2892a3['custom']){_0x3ed9cf=path[_0x24e9('0x5f')](config[_0x24e9('0x61')],_0x424021,_['toLower'](_0x24e9('0x74')));}if(!fs[_0x24e9('0x5e')](_0x3ed9cf)){throw new db['Sequelize'][(_0x24e9('0x66'))](_['upperFirst'](_0x24e9('0x6a'))+_0x24e9('0x67'));}return _0x10d83f[_0x24e9('0x6d')](_0x3ed9cf);}})[_0x24e9('0x26')](handleError(_0x10d83f,null));};exports[_0x24e9('0x75')]=function(_0x44eec1,_0xb014f0){var _0x7bee48={'offset':moment()['utcOffset']()};_0x7bee48[_0x24e9('0x76')]=moment()['utcOffset'](_0x7bee48[_0x24e9('0x2a')])[_0x24e9('0x77')](_0x24e9('0x78'));return _0xb014f0['status'](0xc8)['send'](_0x7bee48);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index f0fe587..6b4e7c1 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1a7550,_0x1edace){var _0x426e22=function(_0x1c10a1){while(--_0x1c10a1){_0x1a7550['push'](_0x1a7550['shift']());}};_0x426e22(++_0x1edace);}(_0x7217,0x19e));var _0x7721=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x7217[_0x25bea7];return _0x175952;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x53afa6,_0x59e786){var _0x51f86a=function(_0x368385){while(--_0x368385){_0x53afa6['push'](_0x53afa6['shift']());}};_0x51f86a(++_0x59e786);}(_0x008c,0x188));var _0xc008=function(_0x16b334,_0x58bd7f){_0x16b334=_0x16b334-0x0;var _0x54aff2=_0x008c[_0x16b334];return _0x54aff2;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 81624cc..e615bc2 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 _0xf645=['error','code','Setting,\x20%s,\x20%s','message','result','catch','ShowSetting','Setting','find','options','raw','where','attributes','include','model','map','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf645,0x143));var _0x5f64=function(_0xd719d2,_0x88d330){_0xd719d2=_0xd719d2-0x0;var _0x2c1995=_0xf645[_0xd719d2];return _0x2c1995;};'use strict';var _=require(_0x5f64('0x0'));var util=require(_0x5f64('0x1'));var moment=require(_0x5f64('0x2'));var BPromise=require(_0x5f64('0x3'));var rs=require(_0x5f64('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5f64('0x5'))['db'];var utils=require(_0x5f64('0x6'));var logger=require(_0x5f64('0x7'))(_0x5f64('0x8'));var config=require(_0x5f64('0x9'));var jayson=require(_0x5f64('0xa'));var client=jayson['client'][_0x5f64('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1070c6,_0x3873b0,_0x2e299e){return new BPromise(function(_0x1b5b78,_0x52373e){return client['request'](_0x1070c6,_0x2e299e)[_0x5f64('0xc')](function(_0x3777a7){logger[_0x5f64('0xd')]('Setting,\x20%s,\x20%s',_0x3873b0,_0x5f64('0xe'));logger['debug'](_0x5f64('0xf'),_0x3873b0,_0x5f64('0xe'),JSON[_0x5f64('0x10')](_0x3777a7));if(_0x3777a7[_0x5f64('0x11')]){if(_0x3777a7[_0x5f64('0x11')][_0x5f64('0x12')]===0x1f4){logger[_0x5f64('0x11')](_0x5f64('0x13'),_0x3873b0,_0x3777a7[_0x5f64('0x11')][_0x5f64('0x14')]);return _0x52373e(_0x3777a7[_0x5f64('0x11')][_0x5f64('0x14')]);}logger['error']('Setting,\x20%s,\x20%s',_0x3873b0,_0x3777a7[_0x5f64('0x11')][_0x5f64('0x14')]);return _0x1b5b78(_0x3777a7[_0x5f64('0x11')]['message']);}else{logger['info'](_0x5f64('0x13'),_0x3873b0,'request\x20sent');_0x1b5b78(_0x3777a7[_0x5f64('0x15')]['message']);}})[_0x5f64('0x16')](function(_0x444947){logger['error'](_0x5f64('0x13'),_0x3873b0,_0x444947);_0x52373e(_0x444947);});});}exports[_0x5f64('0x17')]=function(_0x5adce4){var _0x4da2c1=this;return new Promise(function(_0x2032b1,_0x3df660){return db[_0x5f64('0x18')][_0x5f64('0x19')]({'raw':_0x5adce4[_0x5f64('0x1a')]?_0x5adce4[_0x5f64('0x1a')][_0x5f64('0x1b')]===undefined?!![]:![]:!![],'where':_0x5adce4[_0x5f64('0x1a')]?_0x5adce4[_0x5f64('0x1a')][_0x5f64('0x1c')]||null:null,'attributes':_0x5adce4[_0x5f64('0x1a')]?_0x5adce4[_0x5f64('0x1a')][_0x5f64('0x1d')]||null:null,'include':_0x5adce4[_0x5f64('0x1a')]?_0x5adce4['options']['include']?_['map'](_0x5adce4['options'][_0x5f64('0x1e')],function(_0x2a3cf1){return{'model':db[_0x2a3cf1[_0x5f64('0x1f')]],'as':_0x2a3cf1['as'],'attributes':_0x2a3cf1['attributes'],'include':_0x2a3cf1[_0x5f64('0x1e')]?_[_0x5f64('0x20')](_0x2a3cf1[_0x5f64('0x1e')],function(_0xeb43c0){return{'model':db[_0xeb43c0['model']],'as':_0xeb43c0['as'],'attributes':_0xeb43c0['attributes'],'include':_0xeb43c0[_0x5f64('0x1e')]?_['map'](_0xeb43c0[_0x5f64('0x1e')],function(_0x596702){return{'model':db[_0x596702['model']],'as':_0x596702['as'],'attributes':_0x596702[_0x5f64('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5f64('0xc')](function(_0x487dc5){logger['info'](_0x5f64('0x17'),_0x5adce4);logger[_0x5f64('0x21')]('ShowSetting',_0x5adce4,JSON[_0x5f64('0x10')](_0x487dc5));_0x2032b1(_0x487dc5);})[_0x5f64('0x16')](function(_0x3e7f8a){logger[_0x5f64('0x11')](_0x5f64('0x17'),_0x3e7f8a[_0x5f64('0x14')],_0x5adce4);_0x3df660(_0x4da2c1[_0x5f64('0x11')](0x1f4,_0x3e7f8a[_0x5f64('0x14')]));});});}; \ No newline at end of file +var _0xa79a=['request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','Setting,\x20%s,\x20%s','message','result','catch','find','options','where','attributes','include','map','model','ShowSetting','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info'];(function(_0x172ec1,_0x5758e3){var _0x136daa=function(_0x3202e0){while(--_0x3202e0){_0x172ec1['push'](_0x172ec1['shift']());}};_0x136daa(++_0x5758e3);}(_0xa79a,0x132));var _0xaa79=function(_0x101f80,_0x5f3561){_0x101f80=_0x101f80-0x0;var _0x21bab9=_0xa79a[_0x101f80];return _0x21bab9;};'use strict';var _=require(_0xaa79('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaa79('0x1'));var rs=require(_0xaa79('0x2'));var fs=require('fs');var Redis=require(_0xaa79('0x3'));var db=require(_0xaa79('0x4'))['db'];var utils=require(_0xaa79('0x5'));var logger=require(_0xaa79('0x6'))(_0xaa79('0x7'));var config=require('../../config/environment');var jayson=require(_0xaa79('0x8'));var client=jayson[_0xaa79('0x9')][_0xaa79('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x528a93,_0x3e8d83,_0x15c275){return new BPromise(function(_0x2a92a3,_0x573738){return client['request'](_0x528a93,_0x15c275)[_0xaa79('0xb')](function(_0x111ea9){logger[_0xaa79('0xc')]('Setting,\x20%s,\x20%s',_0x3e8d83,_0xaa79('0xd'));logger[_0xaa79('0xe')](_0xaa79('0xf'),_0x3e8d83,_0xaa79('0xd'),JSON['stringify'](_0x111ea9));if(_0x111ea9[_0xaa79('0x10')]){if(_0x111ea9[_0xaa79('0x10')]['code']===0x1f4){logger['error'](_0xaa79('0x11'),_0x3e8d83,_0x111ea9['error'][_0xaa79('0x12')]);return _0x573738(_0x111ea9[_0xaa79('0x10')]['message']);}logger[_0xaa79('0x10')]('Setting,\x20%s,\x20%s',_0x3e8d83,_0x111ea9[_0xaa79('0x10')][_0xaa79('0x12')]);return _0x2a92a3(_0x111ea9[_0xaa79('0x10')][_0xaa79('0x12')]);}else{logger[_0xaa79('0xc')](_0xaa79('0x11'),_0x3e8d83,_0xaa79('0xd'));_0x2a92a3(_0x111ea9[_0xaa79('0x13')][_0xaa79('0x12')]);}})[_0xaa79('0x14')](function(_0x58bac0){logger[_0xaa79('0x10')](_0xaa79('0x11'),_0x3e8d83,_0x58bac0);_0x573738(_0x58bac0);});});}exports['ShowSetting']=function(_0x289342){var _0x56e915=this;return new Promise(function(_0x56ae34,_0x5129ae){return db['Setting'][_0xaa79('0x15')]({'raw':_0x289342[_0xaa79('0x16')]?_0x289342['options']['raw']===undefined?!![]:![]:!![],'where':_0x289342[_0xaa79('0x16')]?_0x289342[_0xaa79('0x16')][_0xaa79('0x17')]||null:null,'attributes':_0x289342['options']?_0x289342[_0xaa79('0x16')][_0xaa79('0x18')]||null:null,'include':_0x289342[_0xaa79('0x16')]?_0x289342[_0xaa79('0x16')][_0xaa79('0x19')]?_[_0xaa79('0x1a')](_0x289342['options'][_0xaa79('0x19')],function(_0x4e94e3){return{'model':db[_0x4e94e3['model']],'as':_0x4e94e3['as'],'attributes':_0x4e94e3[_0xaa79('0x18')],'include':_0x4e94e3[_0xaa79('0x19')]?_[_0xaa79('0x1a')](_0x4e94e3['include'],function(_0x37af4e){return{'model':db[_0x37af4e[_0xaa79('0x1b')]],'as':_0x37af4e['as'],'attributes':_0x37af4e[_0xaa79('0x18')],'include':_0x37af4e['include']?_['map'](_0x37af4e[_0xaa79('0x19')],function(_0x587b2e){return{'model':db[_0x587b2e[_0xaa79('0x1b')]],'as':_0x587b2e['as'],'attributes':_0x587b2e[_0xaa79('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x526f29){logger[_0xaa79('0xc')]('ShowSetting',_0x289342);logger[_0xaa79('0xe')]('ShowSetting',_0x289342,JSON['stringify'](_0x526f29));_0x56ae34(_0x526f29);})[_0xaa79('0x14')](function(_0x1142b8){logger['error'](_0xaa79('0x1c'),_0x1142b8[_0xaa79('0x12')],_0x289342);_0x5129ae(_0x56e915[_0xaa79('0x10')](0x1f4,_0x1142b8['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index c5219b4..1780f57 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(_0x284506,_0x191316){var _0x1e9ee5=function(_0xe7eaa){while(--_0xe7eaa){_0x284506['push'](_0x284506['shift']());}};_0x1e9ee5(++_0x191316);}(_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 +var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x4f0ea1,_0x35f0da){var _0x40f568=function(_0x3e464d){while(--_0x3e464d){_0x4f0ea1['push'](_0x4f0ea1['shift']());}};_0x40f568(++_0x35f0da);}(_0x7a54,0x106));var _0x47a5=function(_0x4bb285,_0x15bc1a){_0x4bb285=_0x4bb285-0x0;var _0x360d14=_0x7a54[_0x4bb285];return _0x360d14;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 651cd82..d008da2 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 _0x0ebc=['STRING','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports'];(function(_0xf8de64,_0xe99c30){var _0x2e720e=function(_0x2e91e5){while(--_0x2e91e5){_0xf8de64['push'](_0xf8de64['shift']());}};_0x2e720e(++_0xe99c30);}(_0x0ebc,0x1b2));var _0xc0eb=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x0ebc[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0xc0eb('0x0'));var rs=require(_0xc0eb('0x1'));module[_0xc0eb('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xc0eb('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xc0eb('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xc0eb('0x3')],'defaultValue':function(){return rs[_0xc0eb('0x4')]();}},'phone':{'type':Sequelize[_0xc0eb('0x3')]},'type':{'type':Sequelize[_0xc0eb('0x5')](_0xc0eb('0x6'),_0xc0eb('0x7'),_0xc0eb('0x8'),_0xc0eb('0x9'),_0xc0eb('0xa'),_0xc0eb('0xb'),_0xc0eb('0xc'),_0xc0eb('0xd'),'infobip',_0xc0eb('0xe'))},'accountSid':{'type':Sequelize[_0xc0eb('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xc0eb('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xc0eb('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xc0eb('0x3')]},'applicationId':{'type':Sequelize[_0xc0eb('0x3')]},'accountId':{'type':Sequelize[_0xc0eb('0x3')]},'senderString':{'type':Sequelize[_0xc0eb('0x3')]},'deliveryReport':{'type':Sequelize[_0xc0eb('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0xc0eb('0x3')]},'notificationTemplate':{'type':Sequelize[_0xc0eb('0x10')],'defaultValue':function(){return _0xc0eb('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc0eb('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc0eb('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xc0eb('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc0eb('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc0eb('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc0eb('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xc0eb('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc0eb('0x12')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xc0eb('0xf')],'defaultValue':![],'comment':_0xc0eb('0x13'),'set':function(_0x2ef4c7){if(!_0x2ef4c7)this[_0xc0eb('0x14')](_0xc0eb('0x15'),null);this[_0xc0eb('0x14')](_0xc0eb('0x16'),_0x2ef4c7);}}}; \ No newline at end of file +var _0x514b=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING','name','generate','twilio','skebby','connectel','clicksend','plivo','clickatell','csc','infobip','ENUM','BOOLEAN','TEXT'];(function(_0x3518b6,_0x1d6005){var _0x55a221=function(_0x25ebfa){while(--_0x25ebfa){_0x3518b6['push'](_0x3518b6['shift']());}};_0x55a221(++_0x1d6005);}(_0x514b,0x1a8));var _0xb514=function(_0x1df2db,_0x5b4c4a){_0x1df2db=_0x1df2db-0x0;var _0x3df480=_0x514b[_0x1df2db];return _0x3df480;};'use strict';var Sequelize=require(_0xb514('0x0'));var rs=require(_0xb514('0x1'));module['exports']={'name':{'type':Sequelize[_0xb514('0x2')],'unique':_0xb514('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xb514('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xb514('0x2')],'defaultValue':function(){return rs[_0xb514('0x4')]();}},'phone':{'type':Sequelize[_0xb514('0x2')]},'type':{'type':Sequelize['ENUM'](_0xb514('0x5'),_0xb514('0x6'),_0xb514('0x7'),_0xb514('0x8'),_0xb514('0x9'),_0xb514('0xa'),'bandwidth',_0xb514('0xb'),_0xb514('0xc'),'intelepeer')},'accountSid':{'type':Sequelize[_0xb514('0x2')]},'authId':{'type':Sequelize[_0xb514('0x2')]},'authToken':{'type':Sequelize[_0xb514('0x2')]},'smsMethod':{'type':Sequelize[_0xb514('0xd')]('SI','TI','GP')},'username':{'type':Sequelize[_0xb514('0x2')]},'password':{'type':Sequelize[_0xb514('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0xb514('0x2')]},'accountId':{'type':Sequelize[_0xb514('0x2')]},'senderString':{'type':Sequelize[_0xb514('0x2')]},'deliveryReport':{'type':Sequelize[_0xb514('0xe')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xb514('0xf')],'defaultValue':function(){return _0xb514('0x10');}},'notificationSound':{'type':Sequelize[_0xb514('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb514('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xb514('0x11')],'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[_0xb514('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb514('0x11')],'comment':_0xb514('0x12')},'mandatoryDisposition':{'type':Sequelize[_0xb514('0xe')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x510bef){if(!_0x510bef)this['setDataValue'](_0xb514('0x13'),null);this[_0xb514('0x14')](_0xb514('0x15'),_0x510bef);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 150ba85..06579b3 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 _0xb096=['inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','destroy','SmsAccounts','UserProfileResource','stack','name','index','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','show','params','Pause','keys','include','options','find','create','body','user','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','SmsAccountId','getDispositions','findOne','Disposition','findAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','Body','skebby','text','connectel','clicksend','messageId','message_id','plivo','Text','MessageUUID','infobip','results','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','SmsInteraction','spread','interaction','created','autoclose','push','unmanaged','*,*,*,*','SmsMessage','AttachmentId','UserId','unshift','queueId','queue','waitForTheAssignedQueue','Start','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','set','Content-Type','text/xml','send','\x0a','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','priority','finally','sendStatus','getApplications','Contact','Owner','internal','Tag','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','requestid','statusInt','status_code','groupName','redif','DELIVERED'];(function(_0x4695ba,_0x5a7f2a){var _0x524b7d=function(_0xfc9707){while(--_0xfc9707){_0x4695ba['push'](_0x4695ba['shift']());}};_0x524b7d(++_0x5a7f2a);}(_0xb096,0xf5));var _0x6b09=function(_0x20a28a,_0x1ba379){_0x20a28a=_0x20a28a-0x0;var _0x4b55b0=_0xb096[_0x20a28a];return _0x4b55b0;};'use strict';var emlformat=require(_0x6b09('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6b09('0x1'));var jsonpatch=require(_0x6b09('0x2'));var rp=require(_0x6b09('0x3'));var moment=require(_0x6b09('0x4'));var BPromise=require(_0x6b09('0x5'));var Mustache=require(_0x6b09('0x6'));var util=require('util');var path=require(_0x6b09('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6b09('0x8'));var _=require(_0x6b09('0x9'));var squel=require('squel');var crypto=require(_0x6b09('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6b09('0xb'));var querystring=require(_0x6b09('0xc'));var Papa=require('papaparse');var Redis=require(_0x6b09('0xd'));var authService=require(_0x6b09('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x6b09('0xf'));var hardwareService=require(_0x6b09('0x10'));var logger=require('../../config/logger')(_0x6b09('0x11'));var utils=require(_0x6b09('0x12'));var config=require(_0x6b09('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x6b09('0x14'))['db'];config['redis']=_[_0x6b09('0x15')](config[_0x6b09('0x16')],{'host':_0x6b09('0x17'),'port':0x18eb});var socket=require(_0x6b09('0x18'))(new Redis(config[_0x6b09('0x16')]));require(_0x6b09('0x19'))[_0x6b09('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x6b09('0x1b')][_0x6b09('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x321866,_0x3cd918,_0x3fa0b4,_0x44be53){return new BPromise(function(_0x388f2f,_0x14da98){var _0x55e26d=_0x44be53||client;return _0x55e26d[_0x6b09('0x1d')](_0x321866,_0x3fa0b4)[_0x6b09('0x1e')](function(_0x2baf37){logger[_0x6b09('0x1f')](_0x6b09('0x20'),_0x3cd918,_0x6b09('0x21'));logger[_0x6b09('0x22')](_0x6b09('0x23'),_0x3cd918,'request\x20sent',JSON[_0x6b09('0x24')](_0x2baf37));if(_0x2baf37[_0x6b09('0x25')]){if(_0x2baf37[_0x6b09('0x25')][_0x6b09('0x26')]===0x1f4){logger['error'](_0x6b09('0x20'),_0x3cd918,_0x2baf37[_0x6b09('0x25')]['message']);return _0x14da98(_0x2baf37[_0x6b09('0x25')][_0x6b09('0x27')]);}logger[_0x6b09('0x25')]('SmsAccount,\x20%s,\x20%s',_0x3cd918,_0x2baf37['error'][_0x6b09('0x27')]);return _0x388f2f(_0x2baf37[_0x6b09('0x25')][_0x6b09('0x27')]);}else{logger[_0x6b09('0x1f')](_0x6b09('0x20'),_0x3cd918,_0x6b09('0x21'));_0x388f2f(_0x2baf37[_0x6b09('0x28')][_0x6b09('0x27')]);}})[_0x6b09('0x29')](function(_0x426df3){logger[_0x6b09('0x25')]('SmsAccount,\x20%s,\x20%s',_0x3cd918,_0x426df3);_0x14da98(_0x426df3);});});}function respondWithStatusCode(_0x47f31a,_0x189c00){_0x189c00=_0x189c00||0xcc;return function(_0x3697ec){if(_0x3697ec){return _0x47f31a['sendStatus'](_0x189c00);}return _0x47f31a[_0x6b09('0x2a')](_0x189c00)[_0x6b09('0x2b')]();};}function respondWithResult(_0x6a90c0,_0x5e9f5f){_0x5e9f5f=_0x5e9f5f||0xc8;return function(_0x46abe3){if(_0x46abe3){return _0x6a90c0[_0x6b09('0x2a')](_0x5e9f5f)[_0x6b09('0x2c')](_0x46abe3);}};}function respondWithFilteredResult(_0x1b60c2,_0x10a6c9){return function(_0x5afc17){if(_0x5afc17){var _0x4cff9b=typeof _0x10a6c9[_0x6b09('0x2d')]===_0x6b09('0x2e')&&typeof _0x10a6c9['limit']===_0x6b09('0x2e');var _0x37ad59=_0x5afc17[_0x6b09('0x2f')];var _0xed564=_0x4cff9b?0x0:_0x10a6c9[_0x6b09('0x2d')];var _0x21346f=_0x4cff9b?_0x5afc17[_0x6b09('0x2f')]:_0x10a6c9[_0x6b09('0x2d')]+_0x10a6c9['limit'];var _0xcd8bd4;if(_0x21346f>=_0x37ad59){_0x21346f=_0x37ad59;_0xcd8bd4=0xc8;}else{_0xcd8bd4=0xce;}_0x1b60c2['status'](_0xcd8bd4);return _0x1b60c2['set'](_0x6b09('0x30'),_0xed564+'-'+_0x21346f+'/'+_0x37ad59)[_0x6b09('0x2c')](_0x5afc17);}return null;};}function patchUpdates(_0x4d79a8){return function(_0x58e64d){try{jsonpatch[_0x6b09('0x31')](_0x58e64d,_0x4d79a8,!![]);}catch(_0x3550da){return BPromise[_0x6b09('0x32')](_0x3550da);}return _0x58e64d[_0x6b09('0x33')]();};}function saveUpdates(_0x443c69,_0x37c56f){return function(_0x361cd0){if(_0x361cd0){return _0x361cd0['update'](_0x443c69)['then'](function(_0x39e56e){return _0x39e56e;});}return null;};}function removeEntity(_0x1392d0,_0x430cd3){return function(_0x2061b4){if(_0x2061b4){return _0x2061b4[_0x6b09('0x34')]()[_0x6b09('0x1e')](function(){var _0x4bcf9e=_0x2061b4['get']({'plain':!![]});var _0x14e87c=_0x6b09('0x35');return db[_0x6b09('0x36')][_0x6b09('0x34')]({'where':{'type':_0x14e87c,'resourceId':_0x4bcf9e['id']}})[_0x6b09('0x1e')](function(){return _0x2061b4;});})['then'](function(){_0x1392d0[_0x6b09('0x2a')](0xcc)[_0x6b09('0x2b')]();});}};}function handleEntityNotFound(_0x32f3a1,_0x53150a){return function(_0x29755b){if(!_0x29755b){_0x32f3a1['sendStatus'](0x194);}return _0x29755b;};}function handleError(_0x2c95bc,_0x27d31f){_0x27d31f=_0x27d31f||0x1f4;return function(_0x45862d){logger[_0x6b09('0x25')](_0x45862d[_0x6b09('0x37')]);if(_0x45862d[_0x6b09('0x38')]){delete _0x45862d['name'];}_0x2c95bc[_0x6b09('0x2a')](_0x27d31f)['send'](_0x45862d);};}exports[_0x6b09('0x39')]=function(_0x446812,_0x4966cc){var _0x31fa91={'include':[{'model':db['Pause'],'as':_0x6b09('0x3a')}]},_0x3688b6={},_0x12c675={'count':0x0,'rows':[]};var _0x200512=_[_0x6b09('0x3b')](db[_0x6b09('0x3c')][_0x6b09('0x3d')],function(_0x16758c){return{'name':_0x16758c[_0x6b09('0x3e')],'type':_0x16758c[_0x6b09('0x3f')][_0x6b09('0x40')]};});_0x3688b6[_0x6b09('0x41')]=_[_0x6b09('0x3b')](_0x200512,'name');_0x3688b6[_0x6b09('0x42')]=_['keys'](_0x446812['query']);_0x3688b6[_0x6b09('0x43')]=_[_0x6b09('0x44')](_0x3688b6[_0x6b09('0x41')],_0x3688b6['query']);_0x31fa91[_0x6b09('0x45')]=_[_0x6b09('0x44')](_0x3688b6[_0x6b09('0x41')],qs[_0x6b09('0x46')](_0x446812[_0x6b09('0x42')][_0x6b09('0x46')]));_0x31fa91[_0x6b09('0x45')]=_0x31fa91['attributes'][_0x6b09('0x47')]?_0x31fa91['attributes']:_0x3688b6['model'];if(!_0x446812[_0x6b09('0x42')][_0x6b09('0x48')](_0x6b09('0x49'))){_0x31fa91[_0x6b09('0x4a')]=qs[_0x6b09('0x4a')](_0x446812[_0x6b09('0x42')][_0x6b09('0x4a')]);_0x31fa91[_0x6b09('0x2d')]=qs[_0x6b09('0x2d')](_0x446812[_0x6b09('0x42')][_0x6b09('0x2d')]);}_0x31fa91[_0x6b09('0x4b')]=qs[_0x6b09('0x4c')](_0x446812[_0x6b09('0x42')]['sort']);_0x31fa91['where']=qs[_0x6b09('0x43')](_[_0x6b09('0x4d')](_0x446812[_0x6b09('0x42')],_0x3688b6[_0x6b09('0x43')]),_0x200512);if(_0x446812['query'][_0x6b09('0x4e')]){_0x31fa91[_0x6b09('0x4f')]=_[_0x6b09('0x50')](_0x31fa91['where'],{'$or':_['map'](_0x200512,function(_0x2ceb5b){if(_0x2ceb5b[_0x6b09('0x3f')]!==_0x6b09('0x51')){var _0x41b1a0={};_0x41b1a0[_0x2ceb5b['name']]={'$like':'%'+_0x446812[_0x6b09('0x42')][_0x6b09('0x4e')]+'%'};return _0x41b1a0;}})});}_0x31fa91=_[_0x6b09('0x50')]({},_0x31fa91,_0x446812['options']);var _0x3fa507={'where':_0x31fa91[_0x6b09('0x4f')]};return db[_0x6b09('0x3c')][_0x6b09('0x2f')](_0x3fa507)[_0x6b09('0x1e')](function(_0x28067e){_0x12c675[_0x6b09('0x2f')]=_0x28067e;if(_0x446812[_0x6b09('0x42')][_0x6b09('0x52')]){_0x31fa91['include']=[{'all':!![]}];}return db[_0x6b09('0x3c')]['findAll'](_0x31fa91);})[_0x6b09('0x1e')](function(_0x9d66dd){_0x12c675[_0x6b09('0x53')]=_0x9d66dd;return _0x12c675;})['then'](respondWithFilteredResult(_0x4966cc,_0x31fa91))['catch'](handleError(_0x4966cc,null));};exports[_0x6b09('0x54')]=function(_0x8114d7,_0x22f3c3){var _0x33141b={'raw':![],'where':{'id':_0x8114d7[_0x6b09('0x55')]['id']},'include':[{'model':db[_0x6b09('0x56')],'as':_0x6b09('0x3a')}]},_0x5550f6={};_0x5550f6['model']=_[_0x6b09('0x57')](db['SmsAccount'][_0x6b09('0x3d')]);_0x5550f6[_0x6b09('0x42')]=_[_0x6b09('0x57')](_0x8114d7[_0x6b09('0x42')]);_0x5550f6['filters']=_[_0x6b09('0x44')](_0x5550f6[_0x6b09('0x41')],_0x5550f6[_0x6b09('0x42')]);_0x33141b['attributes']=_['intersection'](_0x5550f6[_0x6b09('0x41')],qs[_0x6b09('0x46')](_0x8114d7[_0x6b09('0x42')][_0x6b09('0x46')]));_0x33141b[_0x6b09('0x45')]=_0x33141b[_0x6b09('0x45')][_0x6b09('0x47')]?_0x33141b['attributes']:_0x5550f6[_0x6b09('0x41')];if(_0x8114d7[_0x6b09('0x42')][_0x6b09('0x52')]){_0x33141b[_0x6b09('0x58')]=[{'all':!![]}];}_0x33141b=_[_0x6b09('0x50')]({},_0x33141b,_0x8114d7[_0x6b09('0x59')]);return db[_0x6b09('0x3c')][_0x6b09('0x5a')](_0x33141b)['then'](handleEntityNotFound(_0x22f3c3,null))[_0x6b09('0x1e')](respondWithResult(_0x22f3c3,null))['catch'](handleError(_0x22f3c3,null));};exports[_0x6b09('0x5b')]=function(_0x3c264e,_0x310af2){return db[_0x6b09('0x3c')][_0x6b09('0x5b')](_0x3c264e[_0x6b09('0x5c')],{})[_0x6b09('0x1e')](function(_0x3e3130){var _0x14186e=_0x3c264e[_0x6b09('0x5d')][_0x6b09('0x5e')]({'plain':!![]});if(!_0x14186e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14186e['role']===_0x6b09('0x5d')){var _0x322f7c=_0x3e3130[_0x6b09('0x5e')]({'plain':!![]});var _0x36e6eb=_0x6b09('0x35');return db[_0x6b09('0x5f')][_0x6b09('0x5a')]({'where':{'name':_0x36e6eb,'userProfileId':_0x14186e[_0x6b09('0x60')]},'raw':!![]})['then'](function(_0xfae5ed){if(_0xfae5ed&&_0xfae5ed['autoAssociation']===0x0){return db[_0x6b09('0x36')]['create']({'name':_0x322f7c[_0x6b09('0x38')],'resourceId':_0x322f7c['id'],'type':_0xfae5ed['name'],'sectionId':_0xfae5ed['id']},{})[_0x6b09('0x1e')](function(){return _0x3e3130;});}else{return _0x3e3130;}})[_0x6b09('0x29')](function(_0x368f6e){logger[_0x6b09('0x25')](_0x6b09('0x61'),_0x368f6e);throw _0x368f6e;});}return _0x3e3130;})['then'](respondWithResult(_0x310af2,0xc9))['catch'](handleError(_0x310af2,null));};exports[_0x6b09('0x62')]=function(_0x25388b,_0x2845f8){if(_0x25388b[_0x6b09('0x5c')]['id']){delete _0x25388b[_0x6b09('0x5c')]['id'];}return db[_0x6b09('0x3c')][_0x6b09('0x5a')]({'where':{'id':_0x25388b[_0x6b09('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x6b09('0x3a')}]})[_0x6b09('0x1e')](handleEntityNotFound(_0x2845f8,null))[_0x6b09('0x1e')](saveUpdates(_0x25388b[_0x6b09('0x5c')],null))[_0x6b09('0x1e')](respondWithResult(_0x2845f8,null))[_0x6b09('0x29')](handleError(_0x2845f8,null));};exports['destroy']=function(_0x5b8f9d,_0x156eef){return db[_0x6b09('0x3c')]['find']({'where':{'id':_0x5b8f9d[_0x6b09('0x55')]['id']}})['then'](handleEntityNotFound(_0x156eef,null))[_0x6b09('0x1e')](removeEntity(_0x156eef,null))[_0x6b09('0x29')](handleError(_0x156eef,null));};exports[_0x6b09('0x63')]=function(_0x3d7806,_0x4f9adb){return db['SmsAccount'][_0x6b09('0x63')]()[_0x6b09('0x1e')](respondWithResult(_0x4f9adb,null))[_0x6b09('0x29')](handleError(_0x4f9adb,null));};exports['addDisposition']=function(_0x248ba4,_0x21948a,_0x359a84){if(_0x248ba4[_0x6b09('0x5c')]['id']){delete _0x248ba4[_0x6b09('0x5c')]['id'];}return db[_0x6b09('0x3c')][_0x6b09('0x5a')]({'where':{'id':_0x248ba4[_0x6b09('0x55')]['id']}})[_0x6b09('0x1e')](handleEntityNotFound(_0x21948a,null))['then'](function(_0x47cee3){if(_0x47cee3){_0x248ba4[_0x6b09('0x5c')][_0x6b09('0x64')]=_0x47cee3['id'];return db['Disposition']['create'](_0x248ba4['body']);}})[_0x6b09('0x1e')](respondWithResult(_0x21948a,null))[_0x6b09('0x29')](handleError(_0x21948a,null));};exports[_0x6b09('0x65')]=function(_0x33a90d,_0x2940ec,_0x213f81){var _0x4b451b={'raw':![],'where':{}};var _0x197a88={};var _0xacf1e2={'count':0x0,'rows':[]};return db[_0x6b09('0x3c')][_0x6b09('0x66')]({'where':{'id':_0x33a90d[_0x6b09('0x55')]['id']}})[_0x6b09('0x1e')](handleEntityNotFound(_0x2940ec,null))[_0x6b09('0x1e')](function(_0x465052){if(_0x465052){_0x197a88['model']=_[_0x6b09('0x57')](db[_0x6b09('0x67')][_0x6b09('0x3d')]);_0x197a88['query']=_['keys'](_0x33a90d[_0x6b09('0x42')]);_0x197a88['filters']=_[_0x6b09('0x44')](_0x197a88['model'],_0x197a88[_0x6b09('0x42')]);_0x4b451b['attributes']=_['intersection'](_0x197a88['model'],qs['fields'](_0x33a90d[_0x6b09('0x42')][_0x6b09('0x46')]));_0x4b451b[_0x6b09('0x45')]=_0x4b451b[_0x6b09('0x45')]['length']?_0x4b451b['attributes']:_0x197a88[_0x6b09('0x41')];if(!_0x33a90d[_0x6b09('0x42')][_0x6b09('0x48')]('nolimit')){_0x4b451b[_0x6b09('0x4a')]=qs[_0x6b09('0x4a')](_0x33a90d[_0x6b09('0x42')][_0x6b09('0x4a')]);_0x4b451b[_0x6b09('0x2d')]=qs['offset'](_0x33a90d['query']['offset']);}_0x4b451b[_0x6b09('0x4b')]=qs['sort'](_0x33a90d['query']['sort']);_0x4b451b[_0x6b09('0x4f')]=qs['filters'](_[_0x6b09('0x4d')](_0x33a90d[_0x6b09('0x42')],_0x197a88[_0x6b09('0x43')]));_0x4b451b[_0x6b09('0x4f')]['SmsAccountId']=_0x465052['id'];if(_0x33a90d[_0x6b09('0x42')][_0x6b09('0x4e')]){_0x4b451b[_0x6b09('0x4f')]=_['merge'](_0x4b451b[_0x6b09('0x4f')],{'$or':_[_0x6b09('0x3b')](_0x4b451b[_0x6b09('0x45')],function(_0x31d0c0){var _0x5b958b={};_0x5b958b[_0x31d0c0]={'$like':'%'+_0x33a90d[_0x6b09('0x42')][_0x6b09('0x4e')]+'%'};return _0x5b958b;})});}_0x4b451b=_['merge']({},_0x4b451b,_0x33a90d[_0x6b09('0x59')]);return db[_0x6b09('0x67')][_0x6b09('0x2f')]({'where':_0x4b451b['where']})[_0x6b09('0x1e')](function(_0x1e2609){_0xacf1e2[_0x6b09('0x2f')]=_0x1e2609;if(_0x33a90d[_0x6b09('0x42')][_0x6b09('0x52')]){_0x4b451b[_0x6b09('0x58')]=[{'all':!![]}];}return db['Disposition'][_0x6b09('0x68')](_0x4b451b);})[_0x6b09('0x1e')](function(_0x3dc101){_0xacf1e2[_0x6b09('0x53')]=_0x3dc101;return _0xacf1e2;});}})[_0x6b09('0x1e')](respondWithFilteredResult(_0x2940ec,_0x4b451b))[_0x6b09('0x29')](handleError(_0x2940ec,null));};exports[_0x6b09('0x69')]=function(_0xc930fb,_0x3a37d1,_0x313cc9){return db['SmsAccount'][_0x6b09('0x5a')]({'where':{'id':_0xc930fb[_0x6b09('0x55')]['id']}})[_0x6b09('0x1e')](handleEntityNotFound(_0x3a37d1,null))[_0x6b09('0x1e')](function(_0x2b8eda){if(_0x2b8eda){return _0x2b8eda[_0x6b09('0x69')](_0xc930fb[_0x6b09('0x42')][_0x6b09('0x6a')]);}})[_0x6b09('0x1e')](respondWithStatusCode(_0x3a37d1,null))['catch'](handleError(_0x3a37d1,null));};exports[_0x6b09('0x6b')]=function(_0x1abb54,_0x344c7d,_0xbd26f6){if(_0x1abb54[_0x6b09('0x5c')]['id']){delete _0x1abb54['body']['id'];}return db[_0x6b09('0x3c')][_0x6b09('0x5a')]({'where':{'id':_0x1abb54['params']['id']}})['then'](handleEntityNotFound(_0x344c7d,null))[_0x6b09('0x1e')](function(_0x54612a){if(_0x54612a){_0x1abb54[_0x6b09('0x5c')][_0x6b09('0x64')]=_0x54612a['id'];return db['CannedAnswer']['create'](_0x1abb54[_0x6b09('0x5c')]);}})[_0x6b09('0x1e')](respondWithResult(_0x344c7d,null))['catch'](handleError(_0x344c7d,null));};exports[_0x6b09('0x6c')]=function(_0x5e9fa3,_0x20438d,_0x5d5388){var _0x1d1d63={'raw':![],'where':{}};var _0xd9b061={};var _0x42a59b={'count':0x0,'rows':[]};return db['SmsAccount'][_0x6b09('0x66')]({'where':{'id':_0x5e9fa3[_0x6b09('0x55')]['id']}})['then'](handleEntityNotFound(_0x20438d,null))[_0x6b09('0x1e')](function(_0x387560){if(_0x387560){_0xd9b061['model']=_['keys'](db[_0x6b09('0x6d')][_0x6b09('0x3d')]);_0xd9b061[_0x6b09('0x42')]=_['keys'](_0x5e9fa3[_0x6b09('0x42')]);_0xd9b061[_0x6b09('0x43')]=_[_0x6b09('0x44')](_0xd9b061['model'],_0xd9b061['query']);_0x1d1d63[_0x6b09('0x45')]=_[_0x6b09('0x44')](_0xd9b061[_0x6b09('0x41')],qs[_0x6b09('0x46')](_0x5e9fa3[_0x6b09('0x42')][_0x6b09('0x46')]));_0x1d1d63[_0x6b09('0x45')]=_0x1d1d63['attributes'][_0x6b09('0x47')]?_0x1d1d63[_0x6b09('0x45')]:_0xd9b061[_0x6b09('0x41')];if(!_0x5e9fa3[_0x6b09('0x42')]['hasOwnProperty'](_0x6b09('0x49'))){_0x1d1d63[_0x6b09('0x4a')]=qs[_0x6b09('0x4a')](_0x5e9fa3[_0x6b09('0x42')][_0x6b09('0x4a')]);_0x1d1d63['offset']=qs[_0x6b09('0x2d')](_0x5e9fa3[_0x6b09('0x42')]['offset']);}_0x1d1d63[_0x6b09('0x4b')]=qs['sort'](_0x5e9fa3[_0x6b09('0x42')][_0x6b09('0x4c')]);_0x1d1d63[_0x6b09('0x4f')]=qs[_0x6b09('0x43')](_[_0x6b09('0x4d')](_0x5e9fa3[_0x6b09('0x42')],_0xd9b061[_0x6b09('0x43')]));_0x1d1d63[_0x6b09('0x4f')][_0x6b09('0x64')]=_0x387560['id'];if(_0x5e9fa3['query'][_0x6b09('0x4e')]){_0x1d1d63[_0x6b09('0x4f')]=_[_0x6b09('0x50')](_0x1d1d63[_0x6b09('0x4f')],{'$or':_[_0x6b09('0x3b')](_0x1d1d63[_0x6b09('0x45')],function(_0x520242){var _0x4a6576={};_0x4a6576[_0x520242]={'$like':'%'+_0x5e9fa3[_0x6b09('0x42')][_0x6b09('0x4e')]+'%'};return _0x4a6576;})});}_0x1d1d63=_[_0x6b09('0x50')]({},_0x1d1d63,_0x5e9fa3[_0x6b09('0x59')]);return db[_0x6b09('0x6d')][_0x6b09('0x2f')]({'where':_0x1d1d63[_0x6b09('0x4f')]})[_0x6b09('0x1e')](function(_0x575a2a){_0x42a59b[_0x6b09('0x2f')]=_0x575a2a;if(_0x5e9fa3[_0x6b09('0x42')][_0x6b09('0x52')]){_0x1d1d63['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x1d1d63);})[_0x6b09('0x1e')](function(_0x2d91d0){_0x42a59b[_0x6b09('0x53')]=_0x2d91d0;return _0x42a59b;});}})[_0x6b09('0x1e')](respondWithFilteredResult(_0x20438d,_0x1d1d63))[_0x6b09('0x29')](handleError(_0x20438d,null));};exports[_0x6b09('0x6e')]=function(_0x576336,_0x1f2b33,_0xc6ca82){return db[_0x6b09('0x3c')][_0x6b09('0x5a')]({'where':{'id':_0x576336[_0x6b09('0x55')]['id']}})[_0x6b09('0x1e')](handleEntityNotFound(_0x1f2b33,null))[_0x6b09('0x1e')](function(_0x1e1775){if(_0x1e1775){return _0x1e1775[_0x6b09('0x6e')](_0x576336[_0x6b09('0x42')][_0x6b09('0x6a')]);}})[_0x6b09('0x1e')](respondWithStatusCode(_0x1f2b33,null))[_0x6b09('0x29')](handleError(_0x1f2b33,null));};exports[_0x6b09('0x6f')]=function(_0x2f292e,_0x5c79e9,_0x5b7063){var _0x1983ef={'channel':_0x6b09('0x70')};var _0x528e97=[];var _0x4dc0ad=[];var _0x1dc001={};return db['SmsAccount'][_0x6b09('0x5a')]({'where':{'id':_0x2f292e[_0x6b09('0x55')]['id']},'include':[{'model':db[_0x6b09('0x71')],'as':_0x6b09('0x72')}]})[_0x6b09('0x1e')](handleEntityNotFound(_0x5c79e9,null))[_0x6b09('0x1e')](function(_0x25d567){_0x1983ef[_0x6b09('0x73')]=_0x25d567;_0x1983ef[_0x6b09('0x74')]=_[_0x6b09('0x75')](_0x25d567[_0x6b09('0x72')],['priority'],['asc']);if(_0x1983ef[_0x6b09('0x73')][_0x6b09('0x72')]){delete _0x1983ef[_0x6b09('0x73')]['Applications'];}return db[_0x6b09('0x76')][_0x6b09('0x63')]();})[_0x6b09('0x1e')](function(_0x3cb8d4){if(!_0x3cb8d4){throw new db[(_0x6b09('0x77'))][(_0x6b09('0x78'))]('no\x20available\x20attributes');}_0x528e97=_[_0x6b09('0x79')](_[_0x6b09('0x57')](_0x3cb8d4),[_0x6b09('0x7a'),_0x6b09('0x7b')]);_0x4dc0ad=_['difference'](_[_0x6b09('0x57')](_0x3cb8d4),[_0x6b09('0x7a'),'updatedAt',_0x6b09('0x7c'),_0x6b09('0x7d')]);_0x1983ef[_0x6b09('0x5c')]={'mapKey':_0x6b09('0x7e')};if(_0x1983ef[_0x6b09('0x73')][_0x6b09('0x3f')]){switch(_0x1983ef['account'][_0x6b09('0x3f')]){case'twilio':_0x1983ef[_0x6b09('0x5c')][_0x6b09('0x7f')]=_0x2f292e[_0x6b09('0x5c')][_0x6b09('0x80')];_0x1983ef['body'][_0x6b09('0x5c')]=_0x2f292e[_0x6b09('0x5c')][_0x6b09('0x81')];_0x1983ef[_0x6b09('0x5c')]['messageId']=_0x2f292e[_0x6b09('0x5c')]['MessageSid'];break;case _0x6b09('0x82'):_0x1983ef[_0x6b09('0x5c')][_0x6b09('0x7f')]='+'+_0x2f292e[_0x6b09('0x5c')]['sender'];_0x1983ef[_0x6b09('0x5c')][_0x6b09('0x5c')]=_0x2f292e[_0x6b09('0x5c')][_0x6b09('0x83')];break;case _0x6b09('0x84'):_0x1983ef[_0x6b09('0x5c')][_0x6b09('0x7f')]=_0x2f292e[_0x6b09('0x5c')]['from'];_0x1983ef['body'][_0x6b09('0x5c')]=_0x2f292e[_0x6b09('0x5c')]['message'];break;case _0x6b09('0x85'):_0x1983ef[_0x6b09('0x5c')][_0x6b09('0x7f')]=_0x2f292e[_0x6b09('0x5c')]['from'];_0x1983ef[_0x6b09('0x5c')][_0x6b09('0x5c')]=_0x2f292e[_0x6b09('0x5c')][_0x6b09('0x5c')];_0x1983ef[_0x6b09('0x5c')][_0x6b09('0x86')]=_0x2f292e[_0x6b09('0x5c')][_0x6b09('0x87')];break;case _0x6b09('0x88'):_0x1983ef[_0x6b09('0x5c')][_0x6b09('0x7f')]=_0x2f292e[_0x6b09('0x5c')]['From'];_0x1983ef[_0x6b09('0x5c')][_0x6b09('0x5c')]=_0x2f292e[_0x6b09('0x5c')][_0x6b09('0x89')];_0x1983ef[_0x6b09('0x5c')][_0x6b09('0x86')]=_0x2f292e[_0x6b09('0x5c')][_0x6b09('0x8a')];break;case _0x6b09('0x8b'):_0x1983ef[_0x6b09('0x5c')][_0x6b09('0x7f')]='+'+_0x2f292e[_0x6b09('0x5c')][_0x6b09('0x8c')][0x0][_0x6b09('0x7f')];_0x1983ef[_0x6b09('0x5c')][_0x6b09('0x5c')]=_0x2f292e[_0x6b09('0x5c')][_0x6b09('0x8c')][0x0][_0x6b09('0x83')];_0x1983ef[_0x6b09('0x5c')][_0x6b09('0x86')]=_0x2f292e[_0x6b09('0x5c')]['results'][0x0][_0x6b09('0x86')];break;case _0x6b09('0x8d'):_0x1983ef[_0x6b09('0x5c')]['from']=_0x2f292e[_0x6b09('0x5c')]['originatingAddress'];_0x1983ef[_0x6b09('0x5c')][_0x6b09('0x5c')]=_0x2f292e[_0x6b09('0x5c')][_0x6b09('0x8e')][_0x6b09('0x27')];break;case _0x6b09('0x8f'):_0x1983ef[_0x6b09('0x5c')][_0x6b09('0x7f')]=_0x2f292e['body'][_0x6b09('0x90')];_0x1983ef[_0x6b09('0x5c')][_0x6b09('0x5c')]=_0x2f292e[_0x6b09('0x5c')][_0x6b09('0x83')];_0x1983ef['body'][_0x6b09('0x86')]=_0x2f292e[_0x6b09('0x5c')][_0x6b09('0x91')];break;case _0x6b09('0x92'):_0x1983ef[_0x6b09('0x5c')][_0x6b09('0x86')]=_0x2f292e[_0x6b09('0x5c')][0x0][_0x6b09('0x27')]['id'];_0x1983ef[_0x6b09('0x5c')][_0x6b09('0x7f')]=_0x2f292e[_0x6b09('0x5c')][0x0]['message']['from'];_0x1983ef[_0x6b09('0x5c')][_0x6b09('0x5c')]=_0x2f292e[_0x6b09('0x5c')][0x0][_0x6b09('0x27')][_0x6b09('0x83')];break;case _0x6b09('0x93'):_0x1983ef[_0x6b09('0x5c')]['from']=_0x2f292e[_0x6b09('0x5c')]['from'];_0x1983ef[_0x6b09('0x5c')][_0x6b09('0x5c')]=_0x2f292e[_0x6b09('0x5c')][_0x6b09('0x27')];_0x1983ef[_0x6b09('0x5c')][_0x6b09('0x86')]=_0x2f292e[_0x6b09('0x5c')]['refid'];break;}}if(_0x1983ef[_0x6b09('0x5c')]['id']){delete _0x1983ef[_0x6b09('0x5c')]['id'];}if(_['isNil'](_0x1983ef[_0x6b09('0x5c')][_0x6b09('0x7f')])){throw new db[(_0x6b09('0x77'))]['ValidationError'](_0x6b09('0x94'));}if(_['isNil'](_0x1983ef[_0x6b09('0x5c')][_0x6b09('0x5c')])||_0x1983ef['body']['body']===''){throw new db[(_0x6b09('0x77'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x6b09('0x95')](_0x1983ef[_0x6b09('0x5c')][_0x6b09('0x96')])){throw new db[(_0x6b09('0x77'))]['ValidationError'](_0x6b09('0x97')+_0x4dc0ad);}if(!_[_0x6b09('0x98')](_0x4dc0ad,_0x1983ef[_0x6b09('0x5c')][_0x6b09('0x96')])){throw new db[(_0x6b09('0x77'))][(_0x6b09('0x78'))](_0x6b09('0x99')+_0x4dc0ad);}_0x1dc001[_0x1983ef[_0x6b09('0x5c')][_0x6b09('0x96')]]=_0x1983ef[_0x6b09('0x5c')]['from'];return db[_0x6b09('0x9a')]['find']({'where':{'id':_0x1983ef['account'][_0x6b09('0x7d')]},'include':[{'model':db[_0x6b09('0x76')],'as':_0x6b09('0x9b'),'where':_0x1dc001,'limit':0x1,'order':[[_0x6b09('0x7b'),_0x6b09('0x9c')]]}]});})['then'](handleEntityNotFound(_0x5c79e9,null))['then'](function(_0x4e0014){if(_0x4e0014){_0x1983ef[_0x6b09('0x9d')]=_[_0x6b09('0x9e')](_0x4e0014,[_0x6b09('0x9b')]);if(_0x4e0014[_0x6b09('0x9b')][_0x6b09('0x47')]){return _0x4e0014[_0x6b09('0x9b')][0x0];}var _0x12c221=_[_0x6b09('0x15')](_0x1983ef[_0x6b09('0x5c')],{'firstName':_0x1983ef['body'][_0x6b09('0x7f')],'ListId':_0x4e0014['id']});_0x12c221[_0x1983ef[_0x6b09('0x5c')][_0x6b09('0x96')]]=_0x1983ef[_0x6b09('0x5c')][_0x6b09('0x7f')];return db[_0x6b09('0x76')][_0x6b09('0x5b')](_0x12c221,{'fields':_0x528e97,'raw':!![]});}})[_0x6b09('0x1e')](handleEntityNotFound(_0x5c79e9,null))[_0x6b09('0x1e')](function(_0x3a9e37){if(_0x3a9e37){_0x1983ef['contact']=_0x3a9e37;var _0x3b5f74={'ContactId':_0x3a9e37['id'],'phone':_0x1983ef[_0x6b09('0x5c')][_0x6b09('0x7f')],'SmsAccountId':_0x2f292e[_0x6b09('0x55')]['id']};var _0x21570c={'ContactId':_0x3a9e37['id'],'SmsAccountId':_0x2f292e[_0x6b09('0x55')]['id'],'closed':![]};return db[_0x6b09('0x9f')][_0x6b09('0x5a')]({'where':_0x21570c})[_0x6b09('0x1e')](function(_0x59d4d8){if(_0x59d4d8){return[_0x59d4d8,![]];}return db[_0x6b09('0x9f')][_0x6b09('0x5b')](_0x3b5f74)[_0x6b09('0x1e')](function(_0x5ff073){return[_0x5ff073,!![]];});});}})[_0x6b09('0xa0')](function(_0x4eee4d,_0x31e1b3){_0x1983ef[_0x6b09('0xa1')]=_0x4eee4d[_0x6b09('0x5e')]({'plain':!![]});_0x1983ef[_0x6b09('0xa1')][_0x6b09('0xa2')]=![];if(_0x31e1b3){if(_0x1983ef[_0x6b09('0x73')][_0x6b09('0xa3')]){_0x1983ef['applications'][_0x6b09('0xa4')]({'id':0x0,'priority':_0x1983ef['applications'][_0x6b09('0x47')]+0x1,'app':'close','appdata':_0x6b09('0xa5'),'interval':_0x6b09('0xa6')});}_0x1983ef[_0x6b09('0xa1')][_0x6b09('0xa2')]=!![];}return db[_0x6b09('0xa7')]['create']({'phone':_0x1983ef['body'][_0x6b09('0x7f')],'messageId':_0x1983ef[_0x6b09('0x5c')][_0x6b09('0x86')],'body':_0x1983ef['body'][_0x6b09('0x5c')],'SmsAccountId':_0x2f292e[_0x6b09('0x55')]['id'],'SmsInteractionId':_0x4eee4d['id'],'direction':'in','ContactId':_0x4eee4d['ContactId'],'AttachmentId':_0x1983ef[_0x6b09('0x5c')][_0x6b09('0xa8')]});})[_0x6b09('0x1e')](function(_0x3b8a82){_0x1983ef[_0x6b09('0x27')]=_0x3b8a82;if(!_0x1983ef[_0x6b09('0xa1')][_0x6b09('0xa9')])return;return db['User']['find']({'attributes':['id',_0x6b09('0x38')],'where':{'id':_0x1983ef['interaction'][_0x6b09('0xa9')]}});})['then'](function(_0x3d8a3f){if(_0x3d8a3f){_0x1983ef[_0x6b09('0x74')][_0x6b09('0xaa')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3d8a3f[_0x6b09('0x38')]+','+(_0x1983ef[_0x6b09('0x73')]['waitForTheAssignedAgent']||0xa),'interval':_0x6b09('0xa6')});}if(!_0x1983ef[_0x6b09('0xa1')][_0x6b09('0xab')])return;return db['SmsQueue']['find']({'attributes':['id',_0x6b09('0x38')],'where':{'id':_0x1983ef[_0x6b09('0xa1')][_0x6b09('0xab')]}});})[_0x6b09('0x1e')](function(_0x588864){if(_0x588864){_0x1983ef['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0x6b09('0xac'),'appdata':_0x588864['name']+','+(_0x1983ef[_0x6b09('0x73')][_0x6b09('0xad')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x6b09('0xae'),'startRouting',_0x1983ef);})[_0x6b09('0x1e')](function(_0x245d82){if(_0x245d82){var _0x12680d=0xc8;var _0x4f5b93='receiveMessage';logger[_0x6b09('0x1f')](_0x6b09('0x23'),_0x4f5b93,_0x12680d,_0x6b09('0xaf'));logger['debug'](_0x6b09('0xb0'),_0x4f5b93,_0x12680d,_0x6b09('0xaf'),JSON['stringify'](_0x245d82));if(_0x1983ef[_0x6b09('0x73')][_0x6b09('0x3f')]===_0x6b09('0xb1')){return _0x5c79e9[_0x6b09('0x2a')](_0x12680d)[_0x6b09('0xb2')](_0x6b09('0xb3'),_0x6b09('0xb4'))[_0x6b09('0xb5')](_0x6b09('0xb6'));}else{return _0x5c79e9[_0x6b09('0x2a')](_0x12680d)[_0x6b09('0x2c')](_0x245d82);}}})[_0x6b09('0x29')](handleError(_0x5c79e9,null));};exports[_0x6b09('0xb7')]=function(_0x461c80,_0x133f14){var _0xc21f4f=_0x461c80[_0x6b09('0x55')]['id'];var _0x3af0f6=_0x461c80[_0x6b09('0x5c')];var _0x4a9911=0xc8;var _0x5c0a24=null;return db['sequelize'][_0x6b09('0xb8')]({'isolationLevel':db[_0x6b09('0xb9')][_0x6b09('0xba')][_0x6b09('0xbb')]['READ_COMMITTED']},function(_0x13ba3d){return db[_0x6b09('0x3c')][_0x6b09('0x66')]({'where':{'id':_0xc21f4f},'transaction':_0x13ba3d})[_0x6b09('0x1e')](function(_0x483bdc){if(_0x483bdc){return db[_0x6b09('0x71')]['destroy']({'where':{'SmsAccountId':_0xc21f4f},'transaction':_0x13ba3d})['then'](function(){var _0x197cab=_[_0x6b09('0x3b')](_0x3af0f6,function(_0x3000d1){_0x3000d1[_0x6b09('0x64')]=_0xc21f4f;return _0x3000d1;});return db[_0x6b09('0x71')][_0x6b09('0xbc')](_0x197cab,{'transaction':_0x13ba3d});});}else{_0x4a9911=0x194;_0x5c0a24=[];}});})['then'](function(){if(_0x4a9911!==0x194){return db[_0x6b09('0x71')][_0x6b09('0xbd')]({'where':{'SmsAccountId':_0xc21f4f},'order':_0x6b09('0xbe')})['then'](function(_0xcdd10){_0x5c0a24=_0xcdd10;});}})[_0x6b09('0x29')](function(_0x214af9){_0x4a9911=0x1f4;logger[_0x6b09('0x25')](_0x214af9[_0x6b09('0x37')]);if(_0x214af9[_0x6b09('0x38')]){delete _0x214af9[_0x6b09('0x38')];}_0x5c0a24=_0x214af9;})[_0x6b09('0xbf')](function(){if(_0x5c0a24===null){_0x133f14[_0x6b09('0xc0')](_0x4a9911);}else{if(_0x4a9911===0x1f4){_0x133f14[_0x6b09('0x2a')](_0x4a9911)[_0x6b09('0xb5')](_0x5c0a24);}else{_0x133f14[_0x6b09('0x2a')](_0x4a9911)[_0x6b09('0x2c')](_0x5c0a24);}}});};exports[_0x6b09('0xc1')]=function(_0x2e8bc8,_0x9191f2,_0x57afb9){var _0x5ae6b0={};var _0x4d379e={};var _0xc6f2af;var _0x3764a7;return db[_0x6b09('0x3c')][_0x6b09('0x66')]({'where':{'id':_0x2e8bc8['params']['id']}})[_0x6b09('0x1e')](handleEntityNotFound(_0x9191f2,null))[_0x6b09('0x1e')](function(_0x454647){if(_0x454647){_0xc6f2af=_0x454647;_0x4d379e['model']=_[_0x6b09('0x57')](db[_0x6b09('0x71')]['rawAttributes']);_0x4d379e['query']=_[_0x6b09('0x57')](_0x2e8bc8['query']);_0x4d379e[_0x6b09('0x43')]=_[_0x6b09('0x44')](_0x4d379e['model'],_0x4d379e[_0x6b09('0x42')]);_0x5ae6b0['attributes']=_[_0x6b09('0x44')](_0x4d379e[_0x6b09('0x41')],qs['fields'](_0x2e8bc8['query'][_0x6b09('0x46')]));_0x5ae6b0[_0x6b09('0x45')]=_0x5ae6b0['attributes'][_0x6b09('0x47')]?_0x5ae6b0[_0x6b09('0x45')]:_0x4d379e[_0x6b09('0x41')];_0x5ae6b0[_0x6b09('0x4b')]=qs[_0x6b09('0x4c')](_0x2e8bc8['query'][_0x6b09('0x4c')]);_0x5ae6b0['where']=qs[_0x6b09('0x43')](_[_0x6b09('0x4d')](_0x2e8bc8[_0x6b09('0x42')],_0x4d379e[_0x6b09('0x43')]));if(_0x2e8bc8[_0x6b09('0x42')][_0x6b09('0x4e')]){_0x5ae6b0['where']=_[_0x6b09('0x50')](_0x5ae6b0[_0x6b09('0x4f')],{'$or':_[_0x6b09('0x3b')](_0x5ae6b0['attributes'],function(_0x42b26d){var _0x25d981={};_0x25d981[_0x42b26d]={'$like':'%'+_0x2e8bc8[_0x6b09('0x42')][_0x6b09('0x4e')]+'%'};return _0x25d981;})});}_0x5ae6b0=_['merge']({},_0x5ae6b0,_0x2e8bc8[_0x6b09('0x59')]);return _0xc6f2af[_0x6b09('0xc1')](_0x5ae6b0);}})[_0x6b09('0x1e')](function(_0x26552c){if(_0x26552c){_0x3764a7=_0x26552c[_0x6b09('0x47')];if(!_0x2e8bc8[_0x6b09('0x42')]['hasOwnProperty'](_0x6b09('0x49'))){_0x5ae6b0[_0x6b09('0x4a')]=qs[_0x6b09('0x4a')](_0x2e8bc8[_0x6b09('0x42')][_0x6b09('0x4a')]);_0x5ae6b0['offset']=qs['offset'](_0x2e8bc8[_0x6b09('0x42')]['offset']);}return _0xc6f2af['getApplications'](_0x5ae6b0);}})[_0x6b09('0x1e')](function(_0x35d86a){if(_0x35d86a){return _0x35d86a?{'count':_0x3764a7,'rows':_0x35d86a}:null;}})[_0x6b09('0x1e')](respondWithResult(_0x9191f2,null))[_0x6b09('0x29')](handleError(_0x9191f2,null));};exports['getInteractions']=function(_0x362512,_0x43dec4,_0x8f19a9){var _0x4c081b={'raw':![],'where':{}};var _0x11a618={};var _0x5e8458={'count':0x0,'rows':[]};return db[_0x6b09('0x3c')]['findOne']({'where':{'id':_0x362512['params']['id']}})[_0x6b09('0x1e')](handleEntityNotFound(_0x43dec4,null))['then'](function(_0x4a352c){if(_0x4a352c){_0x11a618[_0x6b09('0x41')]=_['keys'](db[_0x6b09('0x9f')][_0x6b09('0x3d')]);_0x11a618['query']=_[_0x6b09('0x57')](_0x362512[_0x6b09('0x42')]);_0x11a618[_0x6b09('0x43')]=_[_0x6b09('0x44')](_0x11a618[_0x6b09('0x41')],_0x11a618[_0x6b09('0x42')]);_0x4c081b[_0x6b09('0x45')]=_['intersection'](_0x11a618[_0x6b09('0x41')],qs[_0x6b09('0x46')](_0x362512[_0x6b09('0x42')][_0x6b09('0x46')]));_0x4c081b[_0x6b09('0x45')]=_0x4c081b[_0x6b09('0x45')][_0x6b09('0x47')]?_0x4c081b[_0x6b09('0x45')]:_0x11a618[_0x6b09('0x41')];if(!_0x362512[_0x6b09('0x42')][_0x6b09('0x48')](_0x6b09('0x49'))){_0x4c081b['limit']=qs[_0x6b09('0x4a')](_0x362512[_0x6b09('0x42')]['limit']);_0x4c081b[_0x6b09('0x2d')]=qs[_0x6b09('0x2d')](_0x362512[_0x6b09('0x42')][_0x6b09('0x2d')]);}_0x4c081b['order']=qs[_0x6b09('0x4c')](_0x362512['query'][_0x6b09('0x4c')]);_0x4c081b['where']=qs[_0x6b09('0x43')](_['pick'](_0x362512[_0x6b09('0x42')],_0x11a618[_0x6b09('0x43')]));_0x4c081b[_0x6b09('0x4f')][_0x6b09('0x64')]=_0x4a352c['id'];if(_0x362512[_0x6b09('0x42')]['filter']){_0x4c081b[_0x6b09('0x4f')]=_[_0x6b09('0x50')](_0x4c081b['where'],{'$or':_[_0x6b09('0x3b')](_0x4c081b[_0x6b09('0x45')],function(_0x2ed0e2){var _0x1f78ac={};_0x1f78ac[_0x2ed0e2]={'$like':'%'+_0x362512[_0x6b09('0x42')][_0x6b09('0x4e')]+'%'};return _0x1f78ac;})});}_0x4c081b=_[_0x6b09('0x50')]({},_0x4c081b,_0x362512[_0x6b09('0x59')]);return db[_0x6b09('0x9f')][_0x6b09('0x2f')]({'where':_0x4c081b[_0x6b09('0x4f')]})['then'](function(_0x1b09f6){_0x5e8458[_0x6b09('0x2f')]=_0x1b09f6;if(_0x362512[_0x6b09('0x42')]['includeAll']){_0x4c081b[_0x6b09('0x58')]=[{'model':db[_0x6b09('0x76')],'as':_0x6b09('0xc2'),'required':![]},{'model':db['User'],'as':_0x6b09('0xc3'),'attributes':[_0x6b09('0x38'),'fullname',_0x6b09('0xc4')],'required':![]},{'model':db[_0x6b09('0xc5')],'as':'Tags','attributes':['id',_0x6b09('0x38'),_0x6b09('0xc6')],'where':_0x362512[_0x6b09('0x42')][_0x6b09('0xc7')]?{'id':_0x362512[_0x6b09('0x42')]['tag']}:undefined,'required':_0x362512['query'][_0x6b09('0xc7')]?!![]:![]}];}return db['SmsInteraction'][_0x6b09('0x68')](_0x4c081b);})[_0x6b09('0x1e')](function(_0x168412){_0x5e8458[_0x6b09('0x53')]=_0x168412;return _0x5e8458;});}})[_0x6b09('0x1e')](respondWithFilteredResult(_0x43dec4,_0x4c081b))[_0x6b09('0x29')](handleError(_0x43dec4,null));};exports[_0x6b09('0xb5')]=function(_0x494a46,_0x2ce72f,_0x2b812b){var _0x387852,_0x3c7379,_0xfc4433;if(_['isNil'](_0x494a46[_0x6b09('0x5c')][_0x6b09('0x5c')])||_0x494a46[_0x6b09('0x5c')]['body']===''){throw new db[(_0x6b09('0x77'))]['ValidationError'](_0x6b09('0xc8'));}if(_[_0x6b09('0x95')](_0x494a46[_0x6b09('0x5c')]['to'])){throw new db['Sequelize'][(_0x6b09('0x78'))](_0x6b09('0xc9'));}_0x387852=_0x494a46[_0x6b09('0x5c')]['to'];return db[_0x6b09('0x3c')]['find']({'where':{'id':_0x494a46[_0x6b09('0x55')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x6b09('0x9b'),'where':{'mobile':_0x387852},'limit':0x1,'order':[[_0x6b09('0x7b'),'DESC']]}]}]})[_0x6b09('0x1e')](handleEntityNotFound(_0x2ce72f,null))[_0x6b09('0x1e')](function(_0x5b8546){if(_0x5b8546&&_0x5b8546['List']){_0x3c7379=_0x5b8546[_0x6b09('0x5e')]({'plain':!![]});if(_0x3c7379[_0x6b09('0xca')]&&_0x3c7379[_0x6b09('0xca')][_0x6b09('0x9b')][_0x6b09('0x47')]){return _0x3c7379[_0x6b09('0xca')][_0x6b09('0x9b')][0x0];}return db[_0x6b09('0x76')][_0x6b09('0x5b')](_[_0x6b09('0x15')](_0x494a46[_0x6b09('0x5c')],{'firstName':_0x387852,'mobile':_0x387852,'phone':_0x387852,'ListId':_0x3c7379[_0x6b09('0x7d')]}));}})[_0x6b09('0x1e')](handleEntityNotFound(_0x2ce72f,null))[_0x6b09('0x1e')](function(_0x20f699){if(_0x20f699){_0xfc4433=_0x20f699;return db['SmsInteraction'][_0x6b09('0x5a')]({'where':{'ContactId':_0xfc4433['id'],'closed':![],'SmsAccountId':_0x3c7379['id']}})[_0x6b09('0x1e')](function(_0x4743ab){if(_0x4743ab){return[_0x4743ab,![]];}return db['SmsInteraction'][_0x6b09('0x5b')]({'UserId':_0x494a46[_0x6b09('0x5d')]['id'],'ContactId':_0xfc4433['id'],'SmsAccountId':_0x3c7379['id'],'phone':_0x387852,'firstMsgDirection':_0x6b09('0xcb'),'Messages':[_[_0x6b09('0x50')](_0x494a46[_0x6b09('0x5c')],{'read':![],'body':_0x494a46[_0x6b09('0x5c')]['body'],'phone':_0x387852,'SmsAccountId':_0x3c7379['id'],'UserId':_0x494a46[_0x6b09('0x5d')]['id'],'ContactId':_0xfc4433['id']})]},{'include':[{'model':db[_0x6b09('0xa7')],'as':_0x6b09('0xcc')}]})[_0x6b09('0x1e')](function(_0x5ed605){return[_0x5ed605,!![]];});});}})[_0x6b09('0xa0')](function(_0x1b55f5,_0x54a831){if(_0x54a831){return _0x1b55f5;}return db[_0x6b09('0xa7')][_0x6b09('0x5b')](_[_0x6b09('0x50')](_0x494a46[_0x6b09('0x5c')],{'read':![],'body':_0x494a46[_0x6b09('0x5c')][_0x6b09('0x5c')],'phone':_0x387852,'SmsAccountId':_0x3c7379['id'],'SmsInteractionId':_0x1b55f5['id'],'UserId':_0x494a46[_0x6b09('0x5d')]['id'],'ContactId':_0xfc4433['id']}))[_0x6b09('0x1e')](function(_0x329938){_0x1b55f5['dataValues'][_0x6b09('0xcc')]=[];_0x1b55f5['dataValues'][_0x6b09('0xcc')][_0x6b09('0xa4')](_0x329938[_0x6b09('0xcd')]);return _0x1b55f5;});})[_0x6b09('0x1e')](respondWithResult(_0x2ce72f,null))[_0x6b09('0x29')](handleError(_0x2ce72f,null));};exports['status']=function(_0x3a82dd,_0x5015d6,_0xc85c00){if(_0x3a82dd[_0x6b09('0x5c')]['id']){delete _0x3a82dd[_0x6b09('0x5c')]['id'];}var _0x39968d,_0x5dae7a,_0x44ed1f;return db[_0x6b09('0x3c')][_0x6b09('0x5a')]({'where':{'id':_0x3a82dd[_0x6b09('0x55')]['id']}})[_0x6b09('0x1e')](handleEntityNotFound(_0x5015d6,null))[_0x6b09('0x1e')](function(_0xd844e3){if(_0xd844e3){_0x44ed1f=_0xd844e3;logger['debug'](_0x6b09('0x23'),'status',_0x6b09('0xce'),_0xd844e3[_0x6b09('0x3f')],util['inspect'](_0x3a82dd[_0x6b09('0x5c')],{'showHidden':![],'depth':null}));switch(_0xd844e3[_0x6b09('0x3f')]){case _0x6b09('0x82'):if(_0x3a82dd['body']['skebby_dispatch_id']&&_0x3a82dd[_0x6b09('0x5c')]['status']){_0x5dae7a=_0x3a82dd[_0x6b09('0x5c')]['status'];return db[_0x6b09('0xa7')][_0x6b09('0x5a')]({'where':{'messageId':_0x3a82dd[_0x6b09('0x5c')]['skebby_dispatch_id']}});}break;case'connectel':if(_0x3a82dd['body'][_0x6b09('0xcf')]&&_0x3a82dd['body'][_0x6b09('0xd0')]){_0x5dae7a=_0x3a82dd[_0x6b09('0x5c')][_0x6b09('0xd0')];return db[_0x6b09('0xa7')][_0x6b09('0x5a')]({'where':{'messageId':_0x3a82dd['body'][_0x6b09('0xcf')]}});}break;case _0x6b09('0x85'):if(_0x3a82dd[_0x6b09('0x5c')]['message_id']&&_0x3a82dd[_0x6b09('0x5c')][_0x6b09('0xd1')]){_0x5dae7a=_0x3a82dd[_0x6b09('0x5c')][_0x6b09('0xd1')];return db['SmsMessage'][_0x6b09('0x5a')]({'where':{'messageId':_0x3a82dd[_0x6b09('0x5c')]['message_id']}});}break;case'infobip':var _0x185364=_0x3a82dd[_0x6b09('0x5c')][_0x6b09('0x8c')][0x0];if(_0x185364[_0x6b09('0x86')]&&_0x185364['status'][_0x6b09('0xd2')]==='DELIVERED'){_0x5dae7a=_0x185364[_0x6b09('0x2a')][_0x6b09('0xd2')];return db['SmsMessage'][_0x6b09('0x5a')]({'where':{'messageId':_0x185364[_0x6b09('0x86')]}});}break;case'clickatell':if(_0x3a82dd[_0x6b09('0x5c')][_0x6b09('0x86')]&&_0x3a82dd[_0x6b09('0x5c')][_0x6b09('0x2a')]){_0x5dae7a=_0x3a82dd[_0x6b09('0x5c')]['status'];return db[_0x6b09('0xa7')][_0x6b09('0x5a')]({'where':{'messageId':_0x3a82dd[_0x6b09('0x5c')][_0x6b09('0x86')]}});}break;case _0x6b09('0x92'):if(_0x3a82dd[_0x6b09('0x5c')][0x0]['message']['id']){_0x5dae7a=_0x3a82dd[_0x6b09('0x5c')][0x0][_0x6b09('0x3f')];return db[_0x6b09('0xa7')][_0x6b09('0x5a')]({'where':{'messageId':_0x3a82dd[_0x6b09('0x5c')][0x0][_0x6b09('0x27')]['id']}});}break;case _0x6b09('0x93'):if(_0x3a82dd['body'][_0x6b09('0xd3')]&&_0x3a82dd[_0x6b09('0x5c')][_0x6b09('0x2a')]){_0x5dae7a=_0x3a82dd[_0x6b09('0x5c')]['status'];return db[_0x6b09('0xa7')][_0x6b09('0x5a')]({'where':{'messageId':_0x3a82dd['body'][_0x6b09('0xd3')]}});}break;}}})[_0x6b09('0x1e')](handleEntityNotFound(_0x5015d6,null))[_0x6b09('0x1e')](function(_0x29ee2f){if(_0x29ee2f){_0x39968d=_0x29ee2f;switch(_0x44ed1f[_0x6b09('0x3f')]){case _0x6b09('0x82'):if(_0x5dae7a===_0x6b09('0xd4')){return _0x39968d['update']({'read':!![]});}else{logger['error'](_0x6b09('0x23'),_0x6b09('0x2a'),_0x6b09('0x82'),util[_0x6b09('0xd5')](_0x3a82dd[_0x6b09('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x6b09('0x84'):if(_0x5dae7a==='1'){return _0x39968d['update']({'read':!![]});}else{logger[_0x6b09('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6b09('0x2a'),_0x6b09('0x82'),util['inspect'](_0x3a82dd[_0x6b09('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x6b09('0x85'):if(!_0x3a82dd[_0x6b09('0x5c')][_0x6b09('0xd6')]&&_0x5dae7a>=0xc8&&_0x5dae7a<=0xce){return _0x39968d[_0x6b09('0x62')]({'read':!![]});}else{logger['error'](_0x6b09('0x23'),_0x6b09('0x2a'),'clicksend',util[_0x6b09('0xd5')](_0x3a82dd['body'],{'showHidden':![],'depth':null}));}break;case _0x6b09('0x8b'):var _0x3d08c9=_0x3a82dd['body'][_0x6b09('0x8c')][0x0];if(_0x3d08c9[_0x6b09('0x2a')][_0x6b09('0xd2')]===_0x6b09('0xd4')){return _0x39968d[_0x6b09('0x62')]({'read':!![]});}else{logger[_0x6b09('0x25')](_0x6b09('0x23'),'status',_0x6b09('0x8b'),util[_0x6b09('0xd5')](_0x3a82dd[_0x6b09('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x6b09('0x8f'):if(_0x5dae7a==_0x6b09('0xd7')||_0x5dae7a==_0x6b09('0xd8')){return _0x39968d[_0x6b09('0x62')]({'read':!![]});}else{logger[_0x6b09('0x25')](_0x6b09('0x23'),_0x6b09('0x2a'),_0x6b09('0x8f'),util['inspect'](_0x3a82dd[_0x6b09('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x6b09('0x92'):if(_0x5dae7a==_0x6b09('0xd9')){return _0x39968d[_0x6b09('0x62')]({'read':!![]});}else{logger[_0x6b09('0x25')](_0x6b09('0x23'),_0x6b09('0x2a'),_0x6b09('0x92'),util[_0x6b09('0xd5')](_0x3a82dd['body'],{'showHidden':![],'depth':null}));}break;case _0x6b09('0x93'):if(_0x5dae7a===_0x6b09('0xda')||_0x5dae7a===_0x6b09('0xdb')){return _0x39968d[_0x6b09('0x62')]({'read':!![]});}else{logger[_0x6b09('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x6b09('0x93'),util[_0x6b09('0xd5')](_0x3a82dd[_0x6b09('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x39968d;}})[_0x6b09('0x1e')](respondWithResult(_0x5015d6,null))[_0x6b09('0x29')](handleError(_0x5015d6,null));};exports[_0x6b09('0xdc')]=function(_0x55aef1,_0x3f35c1,_0x98e1de){var _0x2913c0,_0x3f0a13,_0x16e626;return db[_0x6b09('0x3c')][_0x6b09('0x5a')]({'where':{'id':_0x55aef1[_0x6b09('0x55')]['id']}})[_0x6b09('0x1e')](handleEntityNotFound(_0x3f35c1,null))['then'](function(_0x1671b9){if(_0x1671b9){_0x16e626=_0x1671b9;logger[_0x6b09('0x22')](_0x6b09('0x23'),'status',_0x6b09('0xce'),_0x1671b9[_0x6b09('0x3f')],util[_0x6b09('0xd5')](_0x55aef1[_0x6b09('0x42')],{'showHidden':![],'depth':null}));switch(_0x1671b9[_0x6b09('0x3f')]){case _0x6b09('0x8d'):if(_0x55aef1[_0x6b09('0x42')][_0x6b09('0xdd')]&&_0x55aef1[_0x6b09('0x42')][_0x6b09('0xde')]){_0x3f0a13=_0x55aef1[_0x6b09('0x42')][_0x6b09('0xde')];return db[_0x6b09('0xa7')][_0x6b09('0x5a')]({'where':{'messageId':_0x55aef1[_0x6b09('0x42')][_0x6b09('0xdd')]}});}break;}}})[_0x6b09('0x1e')](handleEntityNotFound(_0x3f35c1,null))[_0x6b09('0x1e')](function(_0x3382cd){if(_0x3382cd){_0x2913c0=_0x3382cd;switch(_0x16e626['type']){case _0x6b09('0x8d'):if(_0x3f0a13==='2'||_0x3f0a13==='6'){return _0x2913c0[_0x6b09('0x62')]({'read':!![]});}else{logger[_0x6b09('0x25')](_0x6b09('0x23'),_0x6b09('0x2a'),_0x6b09('0x8d'),util[_0x6b09('0xd5')](_0x55aef1['query'],{'showHidden':![],'depth':null}));};break;}return _0x2913c0;}})[_0x6b09('0x1e')](respondWithResult(_0x3f35c1,null))[_0x6b09('0x29')](handleError(_0x3f35c1,null));};exports[_0x6b09('0xdf')]=function(_0xde07f0,_0x54c36c,_0x3b103d){return db['SmsAccount'][_0x6b09('0x5a')]({'where':{'id':_0xde07f0[_0x6b09('0x55')]['id']}})[_0x6b09('0x1e')](handleEntityNotFound(_0x54c36c,null))[_0x6b09('0x1e')](function(_0x2664b6){if(_0x2664b6){return _0x2664b6[_0x6b09('0xdf')](_0xde07f0[_0x6b09('0x5c')][_0x6b09('0x6a')],_[_0x6b09('0x9e')](_0xde07f0[_0x6b09('0x5c')],[_0x6b09('0x6a'),'id'])||{})[_0x6b09('0xa0')](function(_0x2911e0){for(var _0x1c7d55=0x0;_0x1c7d55<_0xde07f0[_0x6b09('0x5c')][_0x6b09('0x6a')][_0x6b09('0x47')];_0x1c7d55+=0x1){socket[_0x6b09('0xe0')]('userSmsAccount:save',{'UserId':Number(_0xde07f0[_0x6b09('0x5c')][_0x6b09('0x6a')][_0x1c7d55]),'SmsAccountId':Number(_0xde07f0[_0x6b09('0x55')]['id'])});}return _0x2911e0;});}})[_0x6b09('0x1e')](respondWithResult(_0x54c36c,null))[_0x6b09('0x29')](handleError(_0x54c36c,null));};exports[_0x6b09('0xe1')]=function(_0x7bd108,_0x2d2868,_0x571070){return db[_0x6b09('0x3c')]['find']({'where':{'id':_0x7bd108[_0x6b09('0x55')]['id']}})[_0x6b09('0x1e')](handleEntityNotFound(_0x2d2868,null))[_0x6b09('0x1e')](function(_0x2621cc){if(_0x2621cc){return _0x2621cc[_0x6b09('0xe1')](_0x7bd108['query'][_0x6b09('0x6a')])[_0x6b09('0x1e')](function(){if(_[_0x6b09('0xe2')](_0x7bd108[_0x6b09('0x42')][_0x6b09('0x6a')])){for(var _0x126ed2=0x0;_0x126ed2<_0x7bd108[_0x6b09('0x42')][_0x6b09('0x6a')]['length'];_0x126ed2+=0x1){socket['emit'](_0x6b09('0xe3'),{'UserId':Number(_0x7bd108[_0x6b09('0x42')][_0x6b09('0x6a')][_0x126ed2]),'SmsAccountId':Number(_0x7bd108[_0x6b09('0x55')]['id'])});}}else{socket[_0x6b09('0xe0')](_0x6b09('0xe3'),{'UserId':Number(_0x7bd108[_0x6b09('0x42')][_0x6b09('0x6a')]),'SmsAccountId':Number(_0x7bd108[_0x6b09('0x55')]['id'])});}});}})[_0x6b09('0x1e')](respondWithStatusCode(_0x2d2868,null))['catch'](handleError(_0x2d2868,null));};exports['getAgents']=function(_0x4f3a18,_0x477e4c,_0x3d57f1){var _0x15a300={};var _0x1f87ff={};var _0x48a26a;var _0x4674d2;return db['SmsAccount']['findOne']({'where':{'id':_0x4f3a18[_0x6b09('0x55')]['id']}})['then'](handleEntityNotFound(_0x477e4c,null))[_0x6b09('0x1e')](function(_0x49fc33){if(_0x49fc33){_0x48a26a=_0x49fc33;_0x1f87ff[_0x6b09('0x41')]=_[_0x6b09('0x57')](db['User'][_0x6b09('0x3d')]);_0x1f87ff[_0x6b09('0x42')]=_['keys'](_0x4f3a18[_0x6b09('0x42')]);_0x1f87ff[_0x6b09('0x43')]=_[_0x6b09('0x44')](_0x1f87ff[_0x6b09('0x41')],_0x1f87ff[_0x6b09('0x42')]);_0x15a300[_0x6b09('0x45')]=_['intersection'](_0x1f87ff['model'],qs[_0x6b09('0x46')](_0x4f3a18[_0x6b09('0x42')][_0x6b09('0x46')]));_0x15a300[_0x6b09('0x45')]=_0x15a300[_0x6b09('0x45')][_0x6b09('0x47')]?_0x15a300[_0x6b09('0x45')]:_0x1f87ff['model'];_0x15a300['order']=qs[_0x6b09('0x4c')](_0x4f3a18[_0x6b09('0x42')]['sort']);_0x15a300['where']=qs[_0x6b09('0x43')](_[_0x6b09('0x4d')](_0x4f3a18[_0x6b09('0x42')],_0x1f87ff[_0x6b09('0x43')]));if(_0x4f3a18[_0x6b09('0x42')]['filter']){_0x15a300['where']=_[_0x6b09('0x50')](_0x15a300['where'],{'$or':_[_0x6b09('0x3b')](_0x15a300[_0x6b09('0x45')],function(_0x3bc9c0){var _0x3f3bef={};_0x3f3bef[_0x3bc9c0]={'$like':'%'+_0x4f3a18[_0x6b09('0x42')][_0x6b09('0x4e')]+'%'};return _0x3f3bef;})});}_0x15a300=_[_0x6b09('0x50')]({},_0x15a300,_0x4f3a18[_0x6b09('0x59')]);return _0x48a26a[_0x6b09('0xe4')](_0x15a300);}})['then'](function(_0x133fea){if(_0x133fea){_0x4674d2=_0x133fea[_0x6b09('0x47')];if(!_0x4f3a18[_0x6b09('0x42')][_0x6b09('0x48')](_0x6b09('0x49'))){_0x15a300[_0x6b09('0x4a')]=qs[_0x6b09('0x4a')](_0x4f3a18[_0x6b09('0x42')][_0x6b09('0x4a')]);_0x15a300['offset']=qs[_0x6b09('0x2d')](_0x4f3a18[_0x6b09('0x42')][_0x6b09('0x2d')]);}return _0x48a26a[_0x6b09('0xe4')](_0x15a300);}})[_0x6b09('0x1e')](function(_0x51529f){if(_0x51529f){return _0x51529f?{'count':_0x4674d2,'rows':_0x51529f}:null;}})[_0x6b09('0x1e')](respondWithResult(_0x477e4c,null))['catch'](handleError(_0x477e4c,null));}; \ No newline at end of file +var _0x4419=['clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','isNil','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','list','omit','Contacts','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','SmsMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','SmsQueue','queue','waitForTheAssignedQueue','Start','startRouting','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','text/xml','send','\x0a','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','Tag','color','tag','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','clicksend','status_code','groupName','redif','error_code','DELIVERED','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','jayson/promise','client','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','get','SmsAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','findAll','rows','show','params','keys','includeAll','include','find','create','body','user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','getDispositions','pick','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','notify','sms','SmsApplication','account','applications','Applications','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','mobile','twilio','From','Body','messageId','MessageSid','skebby','from','text','message_id','Text','MessageUUID','infobip','results','csc','segmentedMessage'];(function(_0x491faa,_0x4f2907){var _0x414440=function(_0x310864){while(--_0x310864){_0x491faa['push'](_0x491faa['shift']());}};_0x414440(++_0x4f2907);}(_0x4419,0x146));var _0x9441=function(_0x20d51e,_0x2e03e0){_0x20d51e=_0x20d51e-0x0;var _0x4d1106=_0x4419[_0x20d51e];return _0x4d1106;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9441('0x0'));var zipdir=require(_0x9441('0x1'));var jsonpatch=require(_0x9441('0x2'));var rp=require(_0x9441('0x3'));var moment=require(_0x9441('0x4'));var BPromise=require(_0x9441('0x5'));var Mustache=require(_0x9441('0x6'));var util=require(_0x9441('0x7'));var path=require('path');var sox=require(_0x9441('0x8'));var csv=require(_0x9441('0x9'));var ejs=require(_0x9441('0xa'));var fs=require('fs');var fs_extra=require(_0x9441('0xb'));var _=require(_0x9441('0xc'));var squel=require('squel');var crypto=require(_0x9441('0xd'));var jsforce=require(_0x9441('0xe'));var deskjs=require(_0x9441('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9441('0x10'));var Papa=require(_0x9441('0x11'));var Redis=require(_0x9441('0x12'));var authService=require(_0x9441('0x13'));var qs=require(_0x9441('0x14'));var as=require(_0x9441('0x15'));var hardwareService=require(_0x9441('0x16'));var logger=require(_0x9441('0x17'))('api');var utils=require(_0x9441('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x9441('0x19'));var db=require(_0x9441('0x1a'))['db'];config['redis']=_[_0x9441('0x1b')](config[_0x9441('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x9441('0x1d'))(new Redis(config['redis']));require('./smsAccount.socket')[_0x9441('0x1e')](socket);var jayson=require(_0x9441('0x1f'));var client=jayson[_0x9441('0x20')][_0x9441('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x223c24,_0xdf4261,_0x5d8ad8,_0x5c206b){return new BPromise(function(_0x51820a,_0x4774d5){var _0x1dbcac=_0x5c206b||client;return _0x1dbcac['request'](_0x223c24,_0x5d8ad8)[_0x9441('0x22')](function(_0x5cdfc7){logger[_0x9441('0x23')](_0x9441('0x24'),_0xdf4261,_0x9441('0x25'));logger[_0x9441('0x26')](_0x9441('0x27'),_0xdf4261,'request\x20sent',JSON['stringify'](_0x5cdfc7));if(_0x5cdfc7[_0x9441('0x28')]){if(_0x5cdfc7['error'][_0x9441('0x29')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0xdf4261,_0x5cdfc7[_0x9441('0x28')][_0x9441('0x2a')]);return _0x4774d5(_0x5cdfc7['error'][_0x9441('0x2a')]);}logger[_0x9441('0x28')]('SmsAccount,\x20%s,\x20%s',_0xdf4261,_0x5cdfc7[_0x9441('0x28')][_0x9441('0x2a')]);return _0x51820a(_0x5cdfc7[_0x9441('0x28')]['message']);}else{logger[_0x9441('0x23')](_0x9441('0x24'),_0xdf4261,_0x9441('0x25'));_0x51820a(_0x5cdfc7[_0x9441('0x2b')][_0x9441('0x2a')]);}})[_0x9441('0x2c')](function(_0x4b0c47){logger['error'](_0x9441('0x24'),_0xdf4261,_0x4b0c47);_0x4774d5(_0x4b0c47);});});}function respondWithStatusCode(_0x29904c,_0x5c8ce4){_0x5c8ce4=_0x5c8ce4||0xcc;return function(_0xff8a48){if(_0xff8a48){return _0x29904c[_0x9441('0x2d')](_0x5c8ce4);}return _0x29904c[_0x9441('0x2e')](_0x5c8ce4)[_0x9441('0x2f')]();};}function respondWithResult(_0xaa93a2,_0x34a46c){_0x34a46c=_0x34a46c||0xc8;return function(_0x353ebb){if(_0x353ebb){return _0xaa93a2[_0x9441('0x2e')](_0x34a46c)[_0x9441('0x30')](_0x353ebb);}};}function respondWithFilteredResult(_0x24301c,_0x1fb7a7){return function(_0x4eae26){if(_0x4eae26){var _0x3b4ad4=typeof _0x1fb7a7[_0x9441('0x31')]===_0x9441('0x32')&&typeof _0x1fb7a7[_0x9441('0x33')]===_0x9441('0x32');var _0x5a2e08=_0x4eae26['count'];var _0x278deb=_0x3b4ad4?0x0:_0x1fb7a7[_0x9441('0x31')];var _0x4030bc=_0x3b4ad4?_0x4eae26[_0x9441('0x34')]:_0x1fb7a7[_0x9441('0x31')]+_0x1fb7a7['limit'];var _0xd19905;if(_0x4030bc>=_0x5a2e08){_0x4030bc=_0x5a2e08;_0xd19905=0xc8;}else{_0xd19905=0xce;}_0x24301c[_0x9441('0x2e')](_0xd19905);return _0x24301c[_0x9441('0x35')](_0x9441('0x36'),_0x278deb+'-'+_0x4030bc+'/'+_0x5a2e08)['json'](_0x4eae26);}return null;};}function patchUpdates(_0x229124){return function(_0x1c6080){try{jsonpatch[_0x9441('0x37')](_0x1c6080,_0x229124,!![]);}catch(_0x2f3e98){return BPromise[_0x9441('0x38')](_0x2f3e98);}return _0x1c6080['save']();};}function saveUpdates(_0x5395c4,_0x81efcc){return function(_0x372f99){if(_0x372f99){return _0x372f99[_0x9441('0x39')](_0x5395c4)[_0x9441('0x22')](function(_0x85905){return _0x85905;});}return null;};}function removeEntity(_0x5514c8,_0x1b4cb9){return function(_0x118164){if(_0x118164){return _0x118164[_0x9441('0x3a')]()[_0x9441('0x22')](function(){var _0x2b3490=_0x118164[_0x9441('0x3b')]({'plain':!![]});var _0x541a13=_0x9441('0x3c');return db[_0x9441('0x3d')]['destroy']({'where':{'type':_0x541a13,'resourceId':_0x2b3490['id']}})[_0x9441('0x22')](function(){return _0x118164;});})['then'](function(){_0x5514c8[_0x9441('0x2e')](0xcc)[_0x9441('0x2f')]();});}};}function handleEntityNotFound(_0x568ed5,_0x4e8d67){return function(_0x212e18){if(!_0x212e18){_0x568ed5[_0x9441('0x2d')](0x194);}return _0x212e18;};}function handleError(_0x26efce,_0x24cb6d){_0x24cb6d=_0x24cb6d||0x1f4;return function(_0xadcf53){logger[_0x9441('0x28')](_0xadcf53[_0x9441('0x3e')]);if(_0xadcf53[_0x9441('0x3f')]){delete _0xadcf53[_0x9441('0x3f')];}_0x26efce[_0x9441('0x2e')](_0x24cb6d)['send'](_0xadcf53);};}exports[_0x9441('0x40')]=function(_0x302846,_0x22b54a){var _0x36e2d2={'include':[{'model':db[_0x9441('0x41')],'as':_0x9441('0x42')}]},_0x51ccb3={},_0x1164c8={'count':0x0,'rows':[]};var _0xfd7f6d=_[_0x9441('0x43')](db[_0x9441('0x44')][_0x9441('0x45')],function(_0x12d09a){return{'name':_0x12d09a[_0x9441('0x46')],'type':_0x12d09a[_0x9441('0x47')][_0x9441('0x48')]};});_0x51ccb3[_0x9441('0x49')]=_[_0x9441('0x43')](_0xfd7f6d,_0x9441('0x3f'));_0x51ccb3['query']=_['keys'](_0x302846['query']);_0x51ccb3[_0x9441('0x4a')]=_[_0x9441('0x4b')](_0x51ccb3[_0x9441('0x49')],_0x51ccb3[_0x9441('0x4c')]);_0x36e2d2[_0x9441('0x4d')]=_['intersection'](_0x51ccb3[_0x9441('0x49')],qs[_0x9441('0x4e')](_0x302846[_0x9441('0x4c')][_0x9441('0x4e')]));_0x36e2d2[_0x9441('0x4d')]=_0x36e2d2[_0x9441('0x4d')][_0x9441('0x4f')]?_0x36e2d2['attributes']:_0x51ccb3[_0x9441('0x49')];if(!_0x302846[_0x9441('0x4c')][_0x9441('0x50')](_0x9441('0x51'))){_0x36e2d2[_0x9441('0x33')]=qs[_0x9441('0x33')](_0x302846[_0x9441('0x4c')][_0x9441('0x33')]);_0x36e2d2['offset']=qs[_0x9441('0x31')](_0x302846[_0x9441('0x4c')][_0x9441('0x31')]);}_0x36e2d2[_0x9441('0x52')]=qs[_0x9441('0x53')](_0x302846[_0x9441('0x4c')][_0x9441('0x53')]);_0x36e2d2['where']=qs['filters'](_['pick'](_0x302846[_0x9441('0x4c')],_0x51ccb3[_0x9441('0x4a')]),_0xfd7f6d);if(_0x302846['query'][_0x9441('0x54')]){_0x36e2d2['where']=_[_0x9441('0x55')](_0x36e2d2[_0x9441('0x56')],{'$or':_['map'](_0xfd7f6d,function(_0x9d764d){if(_0x9d764d[_0x9441('0x47')]!==_0x9441('0x57')){var _0x46aaf3={};_0x46aaf3[_0x9d764d[_0x9441('0x3f')]]={'$like':'%'+_0x302846[_0x9441('0x4c')]['filter']+'%'};return _0x46aaf3;}})});}_0x36e2d2=_[_0x9441('0x55')]({},_0x36e2d2,_0x302846[_0x9441('0x58')]);var _0x23abec={'where':_0x36e2d2[_0x9441('0x56')]};return db['SmsAccount'][_0x9441('0x34')](_0x23abec)['then'](function(_0x421491){_0x1164c8['count']=_0x421491;if(_0x302846['query']['includeAll']){_0x36e2d2['include']=[{'all':!![]}];}return db['SmsAccount'][_0x9441('0x59')](_0x36e2d2);})['then'](function(_0x282e02){_0x1164c8[_0x9441('0x5a')]=_0x282e02;return _0x1164c8;})[_0x9441('0x22')](respondWithFilteredResult(_0x22b54a,_0x36e2d2))[_0x9441('0x2c')](handleError(_0x22b54a,null));};exports[_0x9441('0x5b')]=function(_0xa03f79,_0x54679){var _0x5ab0bf={'raw':![],'where':{'id':_0xa03f79[_0x9441('0x5c')]['id']},'include':[{'model':db[_0x9441('0x41')],'as':_0x9441('0x42')}]},_0x3fd881={};_0x3fd881[_0x9441('0x49')]=_[_0x9441('0x5d')](db[_0x9441('0x44')][_0x9441('0x45')]);_0x3fd881[_0x9441('0x4c')]=_[_0x9441('0x5d')](_0xa03f79[_0x9441('0x4c')]);_0x3fd881['filters']=_[_0x9441('0x4b')](_0x3fd881[_0x9441('0x49')],_0x3fd881['query']);_0x5ab0bf[_0x9441('0x4d')]=_[_0x9441('0x4b')](_0x3fd881['model'],qs['fields'](_0xa03f79[_0x9441('0x4c')][_0x9441('0x4e')]));_0x5ab0bf[_0x9441('0x4d')]=_0x5ab0bf['attributes'][_0x9441('0x4f')]?_0x5ab0bf['attributes']:_0x3fd881['model'];if(_0xa03f79[_0x9441('0x4c')][_0x9441('0x5e')]){_0x5ab0bf[_0x9441('0x5f')]=[{'all':!![]}];}_0x5ab0bf=_[_0x9441('0x55')]({},_0x5ab0bf,_0xa03f79[_0x9441('0x58')]);return db['SmsAccount'][_0x9441('0x60')](_0x5ab0bf)[_0x9441('0x22')](handleEntityNotFound(_0x54679,null))[_0x9441('0x22')](respondWithResult(_0x54679,null))[_0x9441('0x2c')](handleError(_0x54679,null));};exports[_0x9441('0x61')]=function(_0x47e88b,_0xfa56df){return db[_0x9441('0x44')][_0x9441('0x61')](_0x47e88b[_0x9441('0x62')],{})[_0x9441('0x22')](function(_0x2f9e69){var _0x2f6167=_0x47e88b[_0x9441('0x63')][_0x9441('0x3b')]({'plain':!![]});if(!_0x2f6167)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f6167[_0x9441('0x64')]==='user'){var _0x2c9a1e=_0x2f9e69[_0x9441('0x3b')]({'plain':!![]});var _0x29114f=_0x9441('0x3c');return db['UserProfileSection'][_0x9441('0x60')]({'where':{'name':_0x29114f,'userProfileId':_0x2f6167[_0x9441('0x65')]},'raw':!![]})[_0x9441('0x22')](function(_0x40076c){if(_0x40076c&&_0x40076c['autoAssociation']===0x0){return db[_0x9441('0x3d')]['create']({'name':_0x2c9a1e[_0x9441('0x3f')],'resourceId':_0x2c9a1e['id'],'type':_0x40076c[_0x9441('0x3f')],'sectionId':_0x40076c['id']},{})[_0x9441('0x22')](function(){return _0x2f9e69;});}else{return _0x2f9e69;}})['catch'](function(_0x11c74c){logger['error'](_0x9441('0x66'),_0x11c74c);throw _0x11c74c;});}return _0x2f9e69;})[_0x9441('0x22')](respondWithResult(_0xfa56df,0xc9))[_0x9441('0x2c')](handleError(_0xfa56df,null));};exports[_0x9441('0x39')]=function(_0x471b4f,_0x403cd6){if(_0x471b4f['body']['id']){delete _0x471b4f[_0x9441('0x62')]['id'];}return db[_0x9441('0x44')]['find']({'where':{'id':_0x471b4f[_0x9441('0x5c')]['id']},'include':[{'model':db[_0x9441('0x41')],'as':'mandatoryDispositionPause'}]})[_0x9441('0x22')](handleEntityNotFound(_0x403cd6,null))[_0x9441('0x22')](saveUpdates(_0x471b4f['body'],null))[_0x9441('0x22')](respondWithResult(_0x403cd6,null))['catch'](handleError(_0x403cd6,null));};exports[_0x9441('0x3a')]=function(_0x3a929e,_0x18a06d){return db[_0x9441('0x44')][_0x9441('0x60')]({'where':{'id':_0x3a929e[_0x9441('0x5c')]['id']}})['then'](handleEntityNotFound(_0x18a06d,null))[_0x9441('0x22')](removeEntity(_0x18a06d,null))[_0x9441('0x2c')](handleError(_0x18a06d,null));};exports[_0x9441('0x67')]=function(_0x444545,_0x3004d2){return db[_0x9441('0x44')][_0x9441('0x67')]()[_0x9441('0x22')](respondWithResult(_0x3004d2,null))[_0x9441('0x2c')](handleError(_0x3004d2,null));};exports[_0x9441('0x68')]=function(_0xb625,_0x5bafc9,_0xd9bde0){if(_0xb625[_0x9441('0x62')]['id']){delete _0xb625[_0x9441('0x62')]['id'];}return db[_0x9441('0x44')][_0x9441('0x60')]({'where':{'id':_0xb625[_0x9441('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5bafc9,null))[_0x9441('0x22')](function(_0x551a92){if(_0x551a92){_0xb625[_0x9441('0x62')][_0x9441('0x69')]=_0x551a92['id'];return db['Disposition'][_0x9441('0x61')](_0xb625[_0x9441('0x62')]);}})[_0x9441('0x22')](respondWithResult(_0x5bafc9,null))[_0x9441('0x2c')](handleError(_0x5bafc9,null));};exports[_0x9441('0x6a')]=function(_0x8559f1,_0x3e1e97,_0x251192){var _0x46aa1c={'raw':![],'where':{}};var _0x4d684e={};var _0x1a0f77={'count':0x0,'rows':[]};return db[_0x9441('0x44')]['findOne']({'where':{'id':_0x8559f1[_0x9441('0x5c')]['id']}})[_0x9441('0x22')](handleEntityNotFound(_0x3e1e97,null))[_0x9441('0x22')](function(_0x4acb44){if(_0x4acb44){_0x4d684e['model']=_[_0x9441('0x5d')](db['Disposition'][_0x9441('0x45')]);_0x4d684e[_0x9441('0x4c')]=_[_0x9441('0x5d')](_0x8559f1[_0x9441('0x4c')]);_0x4d684e[_0x9441('0x4a')]=_[_0x9441('0x4b')](_0x4d684e[_0x9441('0x49')],_0x4d684e[_0x9441('0x4c')]);_0x46aa1c[_0x9441('0x4d')]=_['intersection'](_0x4d684e[_0x9441('0x49')],qs[_0x9441('0x4e')](_0x8559f1[_0x9441('0x4c')]['fields']));_0x46aa1c[_0x9441('0x4d')]=_0x46aa1c[_0x9441('0x4d')][_0x9441('0x4f')]?_0x46aa1c['attributes']:_0x4d684e[_0x9441('0x49')];if(!_0x8559f1['query'][_0x9441('0x50')](_0x9441('0x51'))){_0x46aa1c[_0x9441('0x33')]=qs[_0x9441('0x33')](_0x8559f1['query'][_0x9441('0x33')]);_0x46aa1c[_0x9441('0x31')]=qs[_0x9441('0x31')](_0x8559f1['query'][_0x9441('0x31')]);}_0x46aa1c[_0x9441('0x52')]=qs[_0x9441('0x53')](_0x8559f1['query']['sort']);_0x46aa1c[_0x9441('0x56')]=qs[_0x9441('0x4a')](_[_0x9441('0x6b')](_0x8559f1['query'],_0x4d684e[_0x9441('0x4a')]));_0x46aa1c[_0x9441('0x56')][_0x9441('0x69')]=_0x4acb44['id'];if(_0x8559f1[_0x9441('0x4c')][_0x9441('0x54')]){_0x46aa1c[_0x9441('0x56')]=_['merge'](_0x46aa1c['where'],{'$or':_['map'](_0x46aa1c[_0x9441('0x4d')],function(_0x32f7e9){var _0x3cf545={};_0x3cf545[_0x32f7e9]={'$like':'%'+_0x8559f1[_0x9441('0x4c')][_0x9441('0x54')]+'%'};return _0x3cf545;})});}_0x46aa1c=_[_0x9441('0x55')]({},_0x46aa1c,_0x8559f1[_0x9441('0x58')]);return db[_0x9441('0x6c')][_0x9441('0x34')]({'where':_0x46aa1c['where']})[_0x9441('0x22')](function(_0x4827d1){_0x1a0f77[_0x9441('0x34')]=_0x4827d1;if(_0x8559f1[_0x9441('0x4c')][_0x9441('0x5e')]){_0x46aa1c[_0x9441('0x5f')]=[{'all':!![]}];}return db[_0x9441('0x6c')]['findAll'](_0x46aa1c);})[_0x9441('0x22')](function(_0x3f80de){_0x1a0f77[_0x9441('0x5a')]=_0x3f80de;return _0x1a0f77;});}})['then'](respondWithFilteredResult(_0x3e1e97,_0x46aa1c))['catch'](handleError(_0x3e1e97,null));};exports[_0x9441('0x6d')]=function(_0x384ab5,_0xb19df3,_0x3ae784){return db[_0x9441('0x44')][_0x9441('0x60')]({'where':{'id':_0x384ab5[_0x9441('0x5c')]['id']}})[_0x9441('0x22')](handleEntityNotFound(_0xb19df3,null))[_0x9441('0x22')](function(_0x4e1f54){if(_0x4e1f54){return _0x4e1f54['removeDispositions'](_0x384ab5[_0x9441('0x4c')][_0x9441('0x6e')]);}})[_0x9441('0x22')](respondWithStatusCode(_0xb19df3,null))[_0x9441('0x2c')](handleError(_0xb19df3,null));};exports[_0x9441('0x6f')]=function(_0x3f9fd8,_0x2339f7,_0x167297){if(_0x3f9fd8[_0x9441('0x62')]['id']){delete _0x3f9fd8[_0x9441('0x62')]['id'];}return db[_0x9441('0x44')][_0x9441('0x60')]({'where':{'id':_0x3f9fd8[_0x9441('0x5c')]['id']}})[_0x9441('0x22')](handleEntityNotFound(_0x2339f7,null))['then'](function(_0x17ebdb){if(_0x17ebdb){_0x3f9fd8[_0x9441('0x62')][_0x9441('0x69')]=_0x17ebdb['id'];return db[_0x9441('0x70')][_0x9441('0x61')](_0x3f9fd8[_0x9441('0x62')]);}})['then'](respondWithResult(_0x2339f7,null))[_0x9441('0x2c')](handleError(_0x2339f7,null));};exports[_0x9441('0x71')]=function(_0x2dae22,_0x2fc058,_0x1d80de){var _0x593372={'raw':![],'where':{}};var _0x594c21={};var _0x158c01={'count':0x0,'rows':[]};return db[_0x9441('0x44')][_0x9441('0x72')]({'where':{'id':_0x2dae22[_0x9441('0x5c')]['id']}})[_0x9441('0x22')](handleEntityNotFound(_0x2fc058,null))[_0x9441('0x22')](function(_0x367c8d){if(_0x367c8d){_0x594c21[_0x9441('0x49')]=_['keys'](db[_0x9441('0x70')][_0x9441('0x45')]);_0x594c21[_0x9441('0x4c')]=_['keys'](_0x2dae22[_0x9441('0x4c')]);_0x594c21[_0x9441('0x4a')]=_[_0x9441('0x4b')](_0x594c21[_0x9441('0x49')],_0x594c21[_0x9441('0x4c')]);_0x593372[_0x9441('0x4d')]=_[_0x9441('0x4b')](_0x594c21['model'],qs[_0x9441('0x4e')](_0x2dae22[_0x9441('0x4c')][_0x9441('0x4e')]));_0x593372[_0x9441('0x4d')]=_0x593372[_0x9441('0x4d')]['length']?_0x593372[_0x9441('0x4d')]:_0x594c21[_0x9441('0x49')];if(!_0x2dae22[_0x9441('0x4c')][_0x9441('0x50')](_0x9441('0x51'))){_0x593372['limit']=qs[_0x9441('0x33')](_0x2dae22['query'][_0x9441('0x33')]);_0x593372[_0x9441('0x31')]=qs['offset'](_0x2dae22[_0x9441('0x4c')][_0x9441('0x31')]);}_0x593372[_0x9441('0x52')]=qs[_0x9441('0x53')](_0x2dae22[_0x9441('0x4c')][_0x9441('0x53')]);_0x593372[_0x9441('0x56')]=qs[_0x9441('0x4a')](_[_0x9441('0x6b')](_0x2dae22[_0x9441('0x4c')],_0x594c21[_0x9441('0x4a')]));_0x593372[_0x9441('0x56')][_0x9441('0x69')]=_0x367c8d['id'];if(_0x2dae22[_0x9441('0x4c')][_0x9441('0x54')]){_0x593372[_0x9441('0x56')]=_[_0x9441('0x55')](_0x593372[_0x9441('0x56')],{'$or':_[_0x9441('0x43')](_0x593372[_0x9441('0x4d')],function(_0x1139f0){var _0x5279c2={};_0x5279c2[_0x1139f0]={'$like':'%'+_0x2dae22[_0x9441('0x4c')][_0x9441('0x54')]+'%'};return _0x5279c2;})});}_0x593372=_[_0x9441('0x55')]({},_0x593372,_0x2dae22[_0x9441('0x58')]);return db['CannedAnswer'][_0x9441('0x34')]({'where':_0x593372['where']})[_0x9441('0x22')](function(_0x1aa535){_0x158c01[_0x9441('0x34')]=_0x1aa535;if(_0x2dae22['query'][_0x9441('0x5e')]){_0x593372[_0x9441('0x5f')]=[{'all':!![]}];}return db[_0x9441('0x70')][_0x9441('0x59')](_0x593372);})[_0x9441('0x22')](function(_0x5d2ede){_0x158c01[_0x9441('0x5a')]=_0x5d2ede;return _0x158c01;});}})[_0x9441('0x22')](respondWithFilteredResult(_0x2fc058,_0x593372))[_0x9441('0x2c')](handleError(_0x2fc058,null));};exports[_0x9441('0x73')]=function(_0x350c2a,_0x42d9d2,_0x2f1862){return db[_0x9441('0x44')][_0x9441('0x60')]({'where':{'id':_0x350c2a[_0x9441('0x5c')]['id']}})[_0x9441('0x22')](handleEntityNotFound(_0x42d9d2,null))[_0x9441('0x22')](function(_0x362afb){if(_0x362afb){return _0x362afb[_0x9441('0x73')](_0x350c2a[_0x9441('0x4c')][_0x9441('0x6e')]);}})[_0x9441('0x22')](respondWithStatusCode(_0x42d9d2,null))[_0x9441('0x2c')](handleError(_0x42d9d2,null));};exports[_0x9441('0x74')]=function(_0xe9c08f,_0x3d8a90,_0x1f138f){var _0x4a5241={'channel':_0x9441('0x75')};var _0x4af5af=[];var _0x2b472d=[];var _0x4e8463={};return db[_0x9441('0x44')][_0x9441('0x60')]({'where':{'id':_0xe9c08f[_0x9441('0x5c')]['id']},'include':[{'model':db[_0x9441('0x76')],'as':'Applications'}]})[_0x9441('0x22')](handleEntityNotFound(_0x3d8a90,null))['then'](function(_0x23daaa){_0x4a5241[_0x9441('0x77')]=_0x23daaa;_0x4a5241[_0x9441('0x78')]=_['orderBy'](_0x23daaa[_0x9441('0x79')],[_0x9441('0x7a')],[_0x9441('0x7b')]);if(_0x4a5241[_0x9441('0x77')][_0x9441('0x79')]){delete _0x4a5241['account']['Applications'];}return db[_0x9441('0x7c')]['describe']();})[_0x9441('0x22')](function(_0x25682d){if(!_0x25682d){throw new db[(_0x9441('0x7d'))][(_0x9441('0x7e'))](_0x9441('0x7f'));}_0x4af5af=_['difference'](_['keys'](_0x25682d),[_0x9441('0x80'),_0x9441('0x81')]);_0x2b472d=_[_0x9441('0x82')](_[_0x9441('0x5d')](_0x25682d),[_0x9441('0x80'),'updatedAt',_0x9441('0x83'),'ListId']);_0x4a5241[_0x9441('0x62')]={'mapKey':_0x9441('0x84')};if(_0x4a5241[_0x9441('0x77')][_0x9441('0x47')]){switch(_0x4a5241['account'][_0x9441('0x47')]){case _0x9441('0x85'):_0x4a5241[_0x9441('0x62')]['from']=_0xe9c08f[_0x9441('0x62')][_0x9441('0x86')];_0x4a5241[_0x9441('0x62')]['body']=_0xe9c08f[_0x9441('0x62')][_0x9441('0x87')];_0x4a5241[_0x9441('0x62')][_0x9441('0x88')]=_0xe9c08f[_0x9441('0x62')][_0x9441('0x89')];break;case _0x9441('0x8a'):_0x4a5241['body'][_0x9441('0x8b')]='+'+_0xe9c08f[_0x9441('0x62')]['sender'];_0x4a5241[_0x9441('0x62')][_0x9441('0x62')]=_0xe9c08f[_0x9441('0x62')][_0x9441('0x8c')];break;case'connectel':_0x4a5241['body']['from']=_0xe9c08f[_0x9441('0x62')]['from'];_0x4a5241[_0x9441('0x62')]['body']=_0xe9c08f[_0x9441('0x62')][_0x9441('0x2a')];break;case'clicksend':_0x4a5241[_0x9441('0x62')][_0x9441('0x8b')]=_0xe9c08f[_0x9441('0x62')][_0x9441('0x8b')];_0x4a5241['body'][_0x9441('0x62')]=_0xe9c08f['body'][_0x9441('0x62')];_0x4a5241[_0x9441('0x62')]['messageId']=_0xe9c08f[_0x9441('0x62')][_0x9441('0x8d')];break;case'plivo':_0x4a5241['body']['from']=_0xe9c08f[_0x9441('0x62')][_0x9441('0x86')];_0x4a5241[_0x9441('0x62')][_0x9441('0x62')]=_0xe9c08f[_0x9441('0x62')][_0x9441('0x8e')];_0x4a5241['body'][_0x9441('0x88')]=_0xe9c08f[_0x9441('0x62')][_0x9441('0x8f')];break;case _0x9441('0x90'):_0x4a5241[_0x9441('0x62')][_0x9441('0x8b')]='+'+_0xe9c08f[_0x9441('0x62')][_0x9441('0x91')][0x0][_0x9441('0x8b')];_0x4a5241['body'][_0x9441('0x62')]=_0xe9c08f['body'][_0x9441('0x91')][0x0][_0x9441('0x8c')];_0x4a5241[_0x9441('0x62')][_0x9441('0x88')]=_0xe9c08f['body']['results'][0x0][_0x9441('0x88')];break;case _0x9441('0x92'):_0x4a5241[_0x9441('0x62')][_0x9441('0x8b')]=_0xe9c08f['body']['originatingAddress'];_0x4a5241[_0x9441('0x62')][_0x9441('0x62')]=_0xe9c08f[_0x9441('0x62')][_0x9441('0x93')][_0x9441('0x2a')];break;case _0x9441('0x94'):_0x4a5241[_0x9441('0x62')][_0x9441('0x8b')]=_0xe9c08f[_0x9441('0x62')][_0x9441('0x95')];_0x4a5241[_0x9441('0x62')][_0x9441('0x62')]=_0xe9c08f[_0x9441('0x62')][_0x9441('0x8c')];_0x4a5241['body'][_0x9441('0x88')]=_0xe9c08f[_0x9441('0x62')][_0x9441('0x96')];break;case _0x9441('0x97'):_0x4a5241[_0x9441('0x62')][_0x9441('0x88')]=_0xe9c08f[_0x9441('0x62')][0x0][_0x9441('0x2a')]['id'];_0x4a5241[_0x9441('0x62')][_0x9441('0x8b')]=_0xe9c08f['body'][0x0]['message']['from'];_0x4a5241[_0x9441('0x62')][_0x9441('0x62')]=_0xe9c08f[_0x9441('0x62')][0x0]['message'][_0x9441('0x8c')];break;case _0x9441('0x98'):_0x4a5241['body'][_0x9441('0x8b')]=_0xe9c08f[_0x9441('0x62')]['from'];_0x4a5241['body'][_0x9441('0x62')]=_0xe9c08f[_0x9441('0x62')]['message'];_0x4a5241[_0x9441('0x62')][_0x9441('0x88')]=_0xe9c08f[_0x9441('0x62')]['refid'];break;}}if(_0x4a5241['body']['id']){delete _0x4a5241[_0x9441('0x62')]['id'];}if(_[_0x9441('0x99')](_0x4a5241['body'][_0x9441('0x8b')])){throw new db['Sequelize']['ValidationError'](_0x9441('0x9a'));}if(_[_0x9441('0x99')](_0x4a5241[_0x9441('0x62')][_0x9441('0x62')])||_0x4a5241['body']['body']===''){throw new db[(_0x9441('0x7d'))][(_0x9441('0x7e'))](_0x9441('0x9b'));}if(_[_0x9441('0x99')](_0x4a5241[_0x9441('0x62')][_0x9441('0x9c')])){throw new db[(_0x9441('0x7d'))][(_0x9441('0x7e'))](_0x9441('0x9d')+_0x2b472d);}if(!_[_0x9441('0x9e')](_0x2b472d,_0x4a5241['body'][_0x9441('0x9c')])){throw new db[(_0x9441('0x7d'))][(_0x9441('0x7e'))](_0x9441('0x9f')+_0x2b472d);}_0x4e8463[_0x4a5241[_0x9441('0x62')][_0x9441('0x9c')]]=_0x4a5241['body']['from'];return db[_0x9441('0xa0')]['find']({'where':{'id':_0x4a5241[_0x9441('0x77')]['ListId']},'include':[{'model':db[_0x9441('0x7c')],'as':'Contacts','where':_0x4e8463,'limit':0x1,'order':[[_0x9441('0x81'),'DESC']]}]});})[_0x9441('0x22')](handleEntityNotFound(_0x3d8a90,null))[_0x9441('0x22')](function(_0x249cb5){if(_0x249cb5){_0x4a5241[_0x9441('0xa1')]=_[_0x9441('0xa2')](_0x249cb5,[_0x9441('0xa3')]);if(_0x249cb5[_0x9441('0xa3')][_0x9441('0x4f')]){return _0x249cb5['Contacts'][0x0];}var _0x4a6657=_[_0x9441('0x1b')](_0x4a5241[_0x9441('0x62')],{'firstName':_0x4a5241['body'][_0x9441('0x8b')],'ListId':_0x249cb5['id']});_0x4a6657[_0x4a5241[_0x9441('0x62')][_0x9441('0x9c')]]=_0x4a5241['body'][_0x9441('0x8b')];return db[_0x9441('0x7c')][_0x9441('0x61')](_0x4a6657,{'fields':_0x4af5af,'raw':!![]});}})['then'](handleEntityNotFound(_0x3d8a90,null))[_0x9441('0x22')](function(_0x441dcb){if(_0x441dcb){_0x4a5241[_0x9441('0xa4')]=_0x441dcb;var _0x501187={'ContactId':_0x441dcb['id'],'phone':_0x4a5241[_0x9441('0x62')][_0x9441('0x8b')],'SmsAccountId':_0xe9c08f[_0x9441('0x5c')]['id']};var _0x8bb367={'ContactId':_0x441dcb['id'],'SmsAccountId':_0xe9c08f[_0x9441('0x5c')]['id'],'closed':![]};return db[_0x9441('0xa5')][_0x9441('0x60')]({'where':_0x8bb367})[_0x9441('0x22')](function(_0x25065d){if(_0x25065d){return[_0x25065d,![]];}return db[_0x9441('0xa5')]['create'](_0x501187)[_0x9441('0x22')](function(_0x584f){return[_0x584f,!![]];});});}})[_0x9441('0xa6')](function(_0x2647fe,_0x48b61a){_0x4a5241[_0x9441('0xa7')]=_0x2647fe[_0x9441('0x3b')]({'plain':!![]});_0x4a5241[_0x9441('0xa7')][_0x9441('0xa8')]=![];if(_0x48b61a){if(_0x4a5241[_0x9441('0x77')][_0x9441('0xa9')]){_0x4a5241[_0x9441('0x78')][_0x9441('0xaa')]({'id':0x0,'priority':_0x4a5241[_0x9441('0x78')][_0x9441('0x4f')]+0x1,'app':_0x9441('0xab'),'appdata':_0x9441('0xac'),'interval':'*,*,*,*'});}_0x4a5241[_0x9441('0xa7')][_0x9441('0xa8')]=!![];}return db[_0x9441('0xad')][_0x9441('0x61')]({'phone':_0x4a5241['body'][_0x9441('0x8b')],'messageId':_0x4a5241[_0x9441('0x62')][_0x9441('0x88')],'body':_0x4a5241['body'][_0x9441('0x62')],'SmsAccountId':_0xe9c08f[_0x9441('0x5c')]['id'],'SmsInteractionId':_0x2647fe['id'],'direction':'in','ContactId':_0x2647fe['ContactId'],'AttachmentId':_0x4a5241['body'][_0x9441('0xae')]});})[_0x9441('0x22')](function(_0x576959){_0x4a5241[_0x9441('0x2a')]=_0x576959;if(!_0x4a5241[_0x9441('0xa7')][_0x9441('0xaf')])return;return db[_0x9441('0xb0')][_0x9441('0x60')]({'attributes':['id',_0x9441('0x3f')],'where':{'id':_0x4a5241[_0x9441('0xa7')]['UserId']}});})[_0x9441('0x22')](function(_0x5c44f2){if(_0x5c44f2){_0x4a5241[_0x9441('0x78')][_0x9441('0xb1')]({'id':0x0,'priority':0x0,'app':_0x9441('0xb2'),'appdata':_0x5c44f2[_0x9441('0x3f')]+','+(_0x4a5241['account'][_0x9441('0xb3')]||0xa),'interval':_0x9441('0xb4')});}if(!_0x4a5241[_0x9441('0xa7')][_0x9441('0xb5')])return;return db[_0x9441('0xb6')][_0x9441('0x60')]({'attributes':['id',_0x9441('0x3f')],'where':{'id':_0x4a5241[_0x9441('0xa7')][_0x9441('0xb5')]}});})[_0x9441('0x22')](function(_0x3344c1){if(_0x3344c1){_0x4a5241[_0x9441('0x78')]['unshift']({'id':0x0,'priority':0x1,'app':_0x9441('0xb7'),'appdata':_0x3344c1['name']+','+(_0x4a5241[_0x9441('0x77')][_0x9441('0xb8')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x9441('0xb9'),_0x9441('0xba'),_0x4a5241);})[_0x9441('0x22')](function(_0x2a0639){if(_0x2a0639){var _0x15111d=0xc8;var _0x4fd8f4='receiveMessage';logger[_0x9441('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4fd8f4,_0x15111d,_0x9441('0xbb'));logger['debug'](_0x9441('0xbc'),_0x4fd8f4,_0x15111d,_0x9441('0xbb'),JSON[_0x9441('0xbd')](_0x2a0639));if(_0x4a5241['account'][_0x9441('0x47')]===_0x9441('0x85')){return _0x3d8a90['status'](_0x15111d)[_0x9441('0x35')]('Content-Type',_0x9441('0xbe'))[_0x9441('0xbf')](_0x9441('0xc0'));}else{return _0x3d8a90[_0x9441('0x2e')](_0x15111d)[_0x9441('0x30')](_0x2a0639);}}})['catch'](handleError(_0x3d8a90,null));};exports[_0x9441('0xc1')]=function(_0x25a052,_0x2fe841){var _0xba56e5=_0x25a052[_0x9441('0x5c')]['id'];var _0x24bfa8=_0x25a052[_0x9441('0x62')];var _0x2803f4=0xc8;var _0x2b8501=null;return db[_0x9441('0xc2')][_0x9441('0xc3')]({'isolationLevel':db['sequelize']['Transaction'][_0x9441('0xc4')][_0x9441('0xc5')]},function(_0x244c96){return db['SmsAccount'][_0x9441('0x72')]({'where':{'id':_0xba56e5},'transaction':_0x244c96})['then'](function(_0x12592a){if(_0x12592a){return db[_0x9441('0x76')]['destroy']({'where':{'SmsAccountId':_0xba56e5},'transaction':_0x244c96})[_0x9441('0x22')](function(){var _0x1f5929=_[_0x9441('0x43')](_0x24bfa8,function(_0x3a432f){_0x3a432f['SmsAccountId']=_0xba56e5;return _0x3a432f;});return db[_0x9441('0x76')][_0x9441('0xc6')](_0x1f5929,{'transaction':_0x244c96});});}else{_0x2803f4=0x194;_0x2b8501=[];}});})[_0x9441('0x22')](function(){if(_0x2803f4!==0x194){return db['SmsApplication'][_0x9441('0xc7')]({'where':{'SmsAccountId':_0xba56e5},'order':'priority'})[_0x9441('0x22')](function(_0x56838e){_0x2b8501=_0x56838e;});}})[_0x9441('0x2c')](function(_0x559a5f){_0x2803f4=0x1f4;logger[_0x9441('0x28')](_0x559a5f[_0x9441('0x3e')]);if(_0x559a5f[_0x9441('0x3f')]){delete _0x559a5f[_0x9441('0x3f')];}_0x2b8501=_0x559a5f;})[_0x9441('0xc8')](function(){if(_0x2b8501===null){_0x2fe841[_0x9441('0x2d')](_0x2803f4);}else{if(_0x2803f4===0x1f4){_0x2fe841[_0x9441('0x2e')](_0x2803f4)[_0x9441('0xbf')](_0x2b8501);}else{_0x2fe841[_0x9441('0x2e')](_0x2803f4)[_0x9441('0x30')](_0x2b8501);}}});};exports[_0x9441('0xc9')]=function(_0x53576b,_0x2ceffc,_0x268a98){var _0x26b8b0={};var _0x32efe7={};var _0x2c4961;var _0x367c60;return db['SmsAccount'][_0x9441('0x72')]({'where':{'id':_0x53576b[_0x9441('0x5c')]['id']}})[_0x9441('0x22')](handleEntityNotFound(_0x2ceffc,null))[_0x9441('0x22')](function(_0x3930cc){if(_0x3930cc){_0x2c4961=_0x3930cc;_0x32efe7[_0x9441('0x49')]=_['keys'](db[_0x9441('0x76')][_0x9441('0x45')]);_0x32efe7[_0x9441('0x4c')]=_['keys'](_0x53576b[_0x9441('0x4c')]);_0x32efe7[_0x9441('0x4a')]=_['intersection'](_0x32efe7['model'],_0x32efe7[_0x9441('0x4c')]);_0x26b8b0[_0x9441('0x4d')]=_[_0x9441('0x4b')](_0x32efe7['model'],qs[_0x9441('0x4e')](_0x53576b[_0x9441('0x4c')][_0x9441('0x4e')]));_0x26b8b0[_0x9441('0x4d')]=_0x26b8b0[_0x9441('0x4d')][_0x9441('0x4f')]?_0x26b8b0[_0x9441('0x4d')]:_0x32efe7[_0x9441('0x49')];_0x26b8b0[_0x9441('0x52')]=qs['sort'](_0x53576b['query']['sort']);_0x26b8b0['where']=qs[_0x9441('0x4a')](_['pick'](_0x53576b[_0x9441('0x4c')],_0x32efe7[_0x9441('0x4a')]));if(_0x53576b[_0x9441('0x4c')][_0x9441('0x54')]){_0x26b8b0['where']=_[_0x9441('0x55')](_0x26b8b0[_0x9441('0x56')],{'$or':_[_0x9441('0x43')](_0x26b8b0[_0x9441('0x4d')],function(_0x13db2d){var _0x3a3ae7={};_0x3a3ae7[_0x13db2d]={'$like':'%'+_0x53576b[_0x9441('0x4c')][_0x9441('0x54')]+'%'};return _0x3a3ae7;})});}_0x26b8b0=_[_0x9441('0x55')]({},_0x26b8b0,_0x53576b[_0x9441('0x58')]);return _0x2c4961[_0x9441('0xc9')](_0x26b8b0);}})[_0x9441('0x22')](function(_0x2d5988){if(_0x2d5988){_0x367c60=_0x2d5988[_0x9441('0x4f')];if(!_0x53576b['query'][_0x9441('0x50')](_0x9441('0x51'))){_0x26b8b0[_0x9441('0x33')]=qs[_0x9441('0x33')](_0x53576b[_0x9441('0x4c')][_0x9441('0x33')]);_0x26b8b0[_0x9441('0x31')]=qs[_0x9441('0x31')](_0x53576b[_0x9441('0x4c')][_0x9441('0x31')]);}return _0x2c4961[_0x9441('0xc9')](_0x26b8b0);}})['then'](function(_0x2f0142){if(_0x2f0142){return _0x2f0142?{'count':_0x367c60,'rows':_0x2f0142}:null;}})[_0x9441('0x22')](respondWithResult(_0x2ceffc,null))['catch'](handleError(_0x2ceffc,null));};exports[_0x9441('0xca')]=function(_0x1c516e,_0x1dab1a,_0x379039){var _0x210711={'raw':![],'where':{}};var _0xc4260a={};var _0x30f87d={'count':0x0,'rows':[]};return db[_0x9441('0x44')][_0x9441('0x72')]({'where':{'id':_0x1c516e[_0x9441('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1dab1a,null))[_0x9441('0x22')](function(_0xefe30f){if(_0xefe30f){_0xc4260a[_0x9441('0x49')]=_[_0x9441('0x5d')](db[_0x9441('0xa5')][_0x9441('0x45')]);_0xc4260a[_0x9441('0x4c')]=_[_0x9441('0x5d')](_0x1c516e[_0x9441('0x4c')]);_0xc4260a[_0x9441('0x4a')]=_[_0x9441('0x4b')](_0xc4260a[_0x9441('0x49')],_0xc4260a[_0x9441('0x4c')]);_0x210711['attributes']=_[_0x9441('0x4b')](_0xc4260a[_0x9441('0x49')],qs['fields'](_0x1c516e[_0x9441('0x4c')][_0x9441('0x4e')]));_0x210711[_0x9441('0x4d')]=_0x210711[_0x9441('0x4d')][_0x9441('0x4f')]?_0x210711[_0x9441('0x4d')]:_0xc4260a[_0x9441('0x49')];if(!_0x1c516e['query'][_0x9441('0x50')](_0x9441('0x51'))){_0x210711[_0x9441('0x33')]=qs[_0x9441('0x33')](_0x1c516e['query']['limit']);_0x210711[_0x9441('0x31')]=qs[_0x9441('0x31')](_0x1c516e[_0x9441('0x4c')][_0x9441('0x31')]);}_0x210711[_0x9441('0x52')]=qs[_0x9441('0x53')](_0x1c516e[_0x9441('0x4c')]['sort']);_0x210711[_0x9441('0x56')]=qs[_0x9441('0x4a')](_[_0x9441('0x6b')](_0x1c516e[_0x9441('0x4c')],_0xc4260a[_0x9441('0x4a')]));_0x210711['where'][_0x9441('0x69')]=_0xefe30f['id'];if(_0x1c516e[_0x9441('0x4c')]['filter']){_0x210711['where']=_[_0x9441('0x55')](_0x210711[_0x9441('0x56')],{'$or':_[_0x9441('0x43')](_0x210711[_0x9441('0x4d')],function(_0x121fbb){var _0x567f39={};_0x567f39[_0x121fbb]={'$like':'%'+_0x1c516e[_0x9441('0x4c')][_0x9441('0x54')]+'%'};return _0x567f39;})});}_0x210711=_['merge']({},_0x210711,_0x1c516e['options']);return db['SmsInteraction'][_0x9441('0x34')]({'where':_0x210711[_0x9441('0x56')]})[_0x9441('0x22')](function(_0x33f61e){_0x30f87d[_0x9441('0x34')]=_0x33f61e;if(_0x1c516e[_0x9441('0x4c')][_0x9441('0x5e')]){_0x210711[_0x9441('0x5f')]=[{'model':db['CmContact'],'as':_0x9441('0xcb'),'required':![]},{'model':db[_0x9441('0xb0')],'as':_0x9441('0xcc'),'attributes':[_0x9441('0x3f'),_0x9441('0xcd'),'internal'],'required':![]},{'model':db[_0x9441('0xce')],'as':'Tags','attributes':['id','name',_0x9441('0xcf')],'where':_0x1c516e[_0x9441('0x4c')][_0x9441('0xd0')]?{'id':_0x1c516e['query'][_0x9441('0xd0')]}:undefined,'required':_0x1c516e['query']['tag']?!![]:![]}];}return db[_0x9441('0xa5')]['findAll'](_0x210711);})[_0x9441('0x22')](function(_0x4d3f39){_0x30f87d[_0x9441('0x5a')]=_0x4d3f39;return _0x30f87d;});}})['then'](respondWithFilteredResult(_0x1dab1a,_0x210711))['catch'](handleError(_0x1dab1a,null));};exports[_0x9441('0xbf')]=function(_0x1d99d6,_0x4009c3,_0xf7fa48){var _0x4ca3de,_0x5565d4,_0x39ac32;if(_[_0x9441('0x99')](_0x1d99d6[_0x9441('0x62')]['body'])||_0x1d99d6[_0x9441('0x62')][_0x9441('0x62')]===''){throw new db['Sequelize'][(_0x9441('0x7e'))](_0x9441('0x9b'));}if(_[_0x9441('0x99')](_0x1d99d6[_0x9441('0x62')]['to'])){throw new db[(_0x9441('0x7d'))][(_0x9441('0x7e'))]('to\x20is\x20mandatory');}_0x4ca3de=_0x1d99d6['body']['to'];return db['SmsAccount'][_0x9441('0x60')]({'where':{'id':_0x1d99d6[_0x9441('0x5c')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x9441('0x7c')],'as':_0x9441('0xa3'),'where':{'mobile':_0x4ca3de},'limit':0x1,'order':[[_0x9441('0x81'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x4009c3,null))['then'](function(_0x1838cb){if(_0x1838cb&&_0x1838cb[_0x9441('0xd1')]){_0x5565d4=_0x1838cb[_0x9441('0x3b')]({'plain':!![]});if(_0x5565d4[_0x9441('0xd1')]&&_0x5565d4[_0x9441('0xd1')][_0x9441('0xa3')]['length']){return _0x5565d4[_0x9441('0xd1')][_0x9441('0xa3')][0x0];}return db[_0x9441('0x7c')][_0x9441('0x61')](_[_0x9441('0x1b')](_0x1d99d6[_0x9441('0x62')],{'firstName':_0x4ca3de,'mobile':_0x4ca3de,'phone':_0x4ca3de,'ListId':_0x5565d4['ListId']}));}})[_0x9441('0x22')](handleEntityNotFound(_0x4009c3,null))[_0x9441('0x22')](function(_0x210c7b){if(_0x210c7b){_0x39ac32=_0x210c7b;return db[_0x9441('0xa5')][_0x9441('0x60')]({'where':{'ContactId':_0x39ac32['id'],'closed':![],'SmsAccountId':_0x5565d4['id']}})[_0x9441('0x22')](function(_0x2d3d9e){if(_0x2d3d9e){return[_0x2d3d9e,![]];}return db[_0x9441('0xa5')][_0x9441('0x61')]({'UserId':_0x1d99d6[_0x9441('0x63')]['id'],'ContactId':_0x39ac32['id'],'SmsAccountId':_0x5565d4['id'],'phone':_0x4ca3de,'firstMsgDirection':_0x9441('0xd2'),'Messages':[_[_0x9441('0x55')](_0x1d99d6['body'],{'read':![],'body':_0x1d99d6[_0x9441('0x62')][_0x9441('0x62')],'phone':_0x4ca3de,'SmsAccountId':_0x5565d4['id'],'UserId':_0x1d99d6[_0x9441('0x63')]['id'],'ContactId':_0x39ac32['id']})]},{'include':[{'model':db[_0x9441('0xad')],'as':_0x9441('0xd3')}]})[_0x9441('0x22')](function(_0x169f6b){return[_0x169f6b,!![]];});});}})['spread'](function(_0x19b468,_0x17afc0){if(_0x17afc0){return _0x19b468;}return db[_0x9441('0xad')]['create'](_['merge'](_0x1d99d6['body'],{'read':![],'body':_0x1d99d6[_0x9441('0x62')][_0x9441('0x62')],'phone':_0x4ca3de,'SmsAccountId':_0x5565d4['id'],'SmsInteractionId':_0x19b468['id'],'UserId':_0x1d99d6[_0x9441('0x63')]['id'],'ContactId':_0x39ac32['id']}))[_0x9441('0x22')](function(_0x43c963){_0x19b468[_0x9441('0xd4')][_0x9441('0xd3')]=[];_0x19b468[_0x9441('0xd4')]['Messages'][_0x9441('0xaa')](_0x43c963[_0x9441('0xd4')]);return _0x19b468;});})[_0x9441('0x22')](respondWithResult(_0x4009c3,null))[_0x9441('0x2c')](handleError(_0x4009c3,null));};exports['status']=function(_0x475d77,_0x5def9a,_0x6be916){if(_0x475d77['body']['id']){delete _0x475d77['body']['id'];}var _0x352354,_0x229819,_0x1e0943;return db['SmsAccount']['find']({'where':{'id':_0x475d77[_0x9441('0x5c')]['id']}})[_0x9441('0x22')](handleEntityNotFound(_0x5def9a,null))['then'](function(_0x35af97){if(_0x35af97){_0x1e0943=_0x35af97;logger[_0x9441('0x26')](_0x9441('0x27'),_0x9441('0x2e'),_0x9441('0xd5'),_0x35af97[_0x9441('0x47')],util[_0x9441('0xd6')](_0x475d77['body'],{'showHidden':![],'depth':null}));switch(_0x35af97[_0x9441('0x47')]){case _0x9441('0x8a'):if(_0x475d77['body'][_0x9441('0xd7')]&&_0x475d77['body'][_0x9441('0x2e')]){_0x229819=_0x475d77[_0x9441('0x62')][_0x9441('0x2e')];return db[_0x9441('0xad')][_0x9441('0x60')]({'where':{'messageId':_0x475d77[_0x9441('0x62')][_0x9441('0xd7')]}});}break;case _0x9441('0xd8'):if(_0x475d77['body'][_0x9441('0xd9')]&&_0x475d77['body'][_0x9441('0xda')]){_0x229819=_0x475d77['body'][_0x9441('0xda')];return db[_0x9441('0xad')][_0x9441('0x60')]({'where':{'messageId':_0x475d77[_0x9441('0x62')][_0x9441('0xd9')]}});}break;case _0x9441('0xdb'):if(_0x475d77['body'][_0x9441('0x8d')]&&_0x475d77[_0x9441('0x62')][_0x9441('0xdc')]){_0x229819=_0x475d77['body'][_0x9441('0xdc')];return db[_0x9441('0xad')][_0x9441('0x60')]({'where':{'messageId':_0x475d77['body'][_0x9441('0x8d')]}});}break;case _0x9441('0x90'):var _0x6b9a2d=_0x475d77[_0x9441('0x62')]['results'][0x0];if(_0x6b9a2d[_0x9441('0x88')]&&_0x6b9a2d[_0x9441('0x2e')][_0x9441('0xdd')]==='DELIVERED'){_0x229819=_0x6b9a2d[_0x9441('0x2e')]['groupName'];return db[_0x9441('0xad')][_0x9441('0x60')]({'where':{'messageId':_0x6b9a2d[_0x9441('0x88')]}});}break;case _0x9441('0x94'):if(_0x475d77['body'][_0x9441('0x88')]&&_0x475d77[_0x9441('0x62')][_0x9441('0x2e')]){_0x229819=_0x475d77[_0x9441('0x62')]['status'];return db['SmsMessage'][_0x9441('0x60')]({'where':{'messageId':_0x475d77['body'][_0x9441('0x88')]}});}break;case'bandwidth':if(_0x475d77[_0x9441('0x62')][0x0][_0x9441('0x2a')]['id']){_0x229819=_0x475d77[_0x9441('0x62')][0x0][_0x9441('0x47')];return db[_0x9441('0xad')]['find']({'where':{'messageId':_0x475d77[_0x9441('0x62')][0x0][_0x9441('0x2a')]['id']}});}break;case _0x9441('0x98'):if(_0x475d77[_0x9441('0x62')]['redif']&&_0x475d77[_0x9441('0x62')][_0x9441('0x2e')]){_0x229819=_0x475d77['body'][_0x9441('0x2e')];return db['SmsMessage'][_0x9441('0x60')]({'where':{'messageId':_0x475d77['body'][_0x9441('0xde')]}});}break;}}})[_0x9441('0x22')](handleEntityNotFound(_0x5def9a,null))['then'](function(_0x1056c5){if(_0x1056c5){_0x352354=_0x1056c5;switch(_0x1e0943[_0x9441('0x47')]){case'skebby':if(_0x229819==='DELIVERED'){return _0x352354[_0x9441('0x39')]({'read':!![]});}else{logger[_0x9441('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9441('0x2e'),'skebby',util[_0x9441('0xd6')](_0x475d77[_0x9441('0x62')],{'showHidden':![],'depth':null}));}break;case _0x9441('0xd8'):if(_0x229819==='1'){return _0x352354[_0x9441('0x39')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status','skebby',util['inspect'](_0x475d77[_0x9441('0x62')],{'showHidden':![],'depth':null}));}break;case _0x9441('0xdb'):if(!_0x475d77['body'][_0x9441('0xdf')]&&_0x229819>=0xc8&&_0x229819<=0xce){return _0x352354[_0x9441('0x39')]({'read':!![]});}else{logger[_0x9441('0x28')](_0x9441('0x27'),_0x9441('0x2e'),_0x9441('0xdb'),util[_0x9441('0xd6')](_0x475d77[_0x9441('0x62')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x35fa3a=_0x475d77[_0x9441('0x62')]['results'][0x0];if(_0x35fa3a[_0x9441('0x2e')][_0x9441('0xdd')]===_0x9441('0xe0')){return _0x352354[_0x9441('0x39')]({'read':!![]});}else{logger[_0x9441('0x28')](_0x9441('0x27'),'status','infobip',util['inspect'](_0x475d77[_0x9441('0x62')],{'showHidden':![],'depth':null}));}break;case _0x9441('0x94'):if(_0x229819==_0x9441('0xe1')||_0x229819==_0x9441('0xe2')){return _0x352354['update']({'read':!![]});}else{logger[_0x9441('0x28')](_0x9441('0x27'),_0x9441('0x2e'),_0x9441('0x94'),util[_0x9441('0xd6')](_0x475d77[_0x9441('0x62')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x229819==_0x9441('0xe3')){return _0x352354[_0x9441('0x39')]({'read':!![]});}else{logger[_0x9441('0x28')](_0x9441('0x27'),'status',_0x9441('0x97'),util[_0x9441('0xd6')](_0x475d77['body'],{'showHidden':![],'depth':null}));}break;case _0x9441('0x98'):if(_0x229819==='DELIVRD'||_0x229819===_0x9441('0xe4')){return _0x352354['update']({'read':!![]});}else{logger[_0x9441('0x28')](_0x9441('0x27'),_0x9441('0x2e'),_0x9441('0x98'),util['inspect'](_0x475d77[_0x9441('0x62')],{'showHidden':![],'depth':null}));}break;}return _0x352354;}})[_0x9441('0x22')](respondWithResult(_0x5def9a,null))['catch'](handleError(_0x5def9a,null));};exports['statusGet']=function(_0x48e4a7,_0x126b61,_0x473e2f){var _0x1ca30e,_0x36f288,_0x28aac3;return db[_0x9441('0x44')][_0x9441('0x60')]({'where':{'id':_0x48e4a7[_0x9441('0x5c')]['id']}})[_0x9441('0x22')](handleEntityNotFound(_0x126b61,null))[_0x9441('0x22')](function(_0x5586d7){if(_0x5586d7){_0x28aac3=_0x5586d7;logger[_0x9441('0x26')](_0x9441('0x27'),_0x9441('0x2e'),'received\x20delivery\x20report\x20from',_0x5586d7[_0x9441('0x47')],util['inspect'](_0x48e4a7[_0x9441('0x4c')],{'showHidden':![],'depth':null}));switch(_0x5586d7[_0x9441('0x47')]){case _0x9441('0x92'):if(_0x48e4a7[_0x9441('0x4c')][_0x9441('0xe5')]&&_0x48e4a7['query'][_0x9441('0xe6')]){_0x36f288=_0x48e4a7[_0x9441('0x4c')][_0x9441('0xe6')];return db['SmsMessage']['find']({'where':{'messageId':_0x48e4a7['query'][_0x9441('0xe5')]}});}break;}}})[_0x9441('0x22')](handleEntityNotFound(_0x126b61,null))['then'](function(_0x4a787c){if(_0x4a787c){_0x1ca30e=_0x4a787c;switch(_0x28aac3[_0x9441('0x47')]){case _0x9441('0x92'):if(_0x36f288==='2'||_0x36f288==='6'){return _0x1ca30e[_0x9441('0x39')]({'read':!![]});}else{logger[_0x9441('0x28')](_0x9441('0x27'),_0x9441('0x2e'),_0x9441('0x92'),util[_0x9441('0xd6')](_0x48e4a7[_0x9441('0x4c')],{'showHidden':![],'depth':null}));};break;}return _0x1ca30e;}})[_0x9441('0x22')](respondWithResult(_0x126b61,null))[_0x9441('0x2c')](handleError(_0x126b61,null));};exports['addAgents']=function(_0x199c90,_0x16576f,_0x33ed7c){return db['SmsAccount'][_0x9441('0x60')]({'where':{'id':_0x199c90['params']['id']}})[_0x9441('0x22')](handleEntityNotFound(_0x16576f,null))[_0x9441('0x22')](function(_0x37c098){if(_0x37c098){return _0x37c098[_0x9441('0xe7')](_0x199c90[_0x9441('0x62')][_0x9441('0x6e')],_['omit'](_0x199c90['body'],[_0x9441('0x6e'),'id'])||{})[_0x9441('0xa6')](function(_0x2c47c7){for(var _0x5a4314=0x0;_0x5a4314<_0x199c90['body']['ids'][_0x9441('0x4f')];_0x5a4314+=0x1){socket[_0x9441('0xe8')](_0x9441('0xe9'),{'UserId':Number(_0x199c90[_0x9441('0x62')][_0x9441('0x6e')][_0x5a4314]),'SmsAccountId':Number(_0x199c90[_0x9441('0x5c')]['id'])});}return _0x2c47c7;});}})[_0x9441('0x22')](respondWithResult(_0x16576f,null))[_0x9441('0x2c')](handleError(_0x16576f,null));};exports[_0x9441('0xea')]=function(_0x3deff2,_0x1d874d,_0x590140){return db[_0x9441('0x44')][_0x9441('0x60')]({'where':{'id':_0x3deff2[_0x9441('0x5c')]['id']}})[_0x9441('0x22')](handleEntityNotFound(_0x1d874d,null))[_0x9441('0x22')](function(_0x4a6aef){if(_0x4a6aef){return _0x4a6aef[_0x9441('0xea')](_0x3deff2[_0x9441('0x4c')][_0x9441('0x6e')])[_0x9441('0x22')](function(){if(_['isArray'](_0x3deff2[_0x9441('0x4c')][_0x9441('0x6e')])){for(var _0x2ef111=0x0;_0x2ef111<_0x3deff2[_0x9441('0x4c')]['ids']['length'];_0x2ef111+=0x1){socket[_0x9441('0xe8')](_0x9441('0xeb'),{'UserId':Number(_0x3deff2[_0x9441('0x4c')][_0x9441('0x6e')][_0x2ef111]),'SmsAccountId':Number(_0x3deff2['params']['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x3deff2[_0x9441('0x4c')][_0x9441('0x6e')]),'SmsAccountId':Number(_0x3deff2[_0x9441('0x5c')]['id'])});}});}})[_0x9441('0x22')](respondWithStatusCode(_0x1d874d,null))['catch'](handleError(_0x1d874d,null));};exports[_0x9441('0xec')]=function(_0x4ecc76,_0x464d6e,_0x465e96){var _0x525179={};var _0x464d2d={};var _0x4a6e30;var _0x319337;return db[_0x9441('0x44')][_0x9441('0x72')]({'where':{'id':_0x4ecc76['params']['id']}})[_0x9441('0x22')](handleEntityNotFound(_0x464d6e,null))[_0x9441('0x22')](function(_0x3f58df){if(_0x3f58df){_0x4a6e30=_0x3f58df;_0x464d2d['model']=_[_0x9441('0x5d')](db[_0x9441('0xb0')]['rawAttributes']);_0x464d2d[_0x9441('0x4c')]=_[_0x9441('0x5d')](_0x4ecc76[_0x9441('0x4c')]);_0x464d2d[_0x9441('0x4a')]=_[_0x9441('0x4b')](_0x464d2d[_0x9441('0x49')],_0x464d2d[_0x9441('0x4c')]);_0x525179[_0x9441('0x4d')]=_[_0x9441('0x4b')](_0x464d2d[_0x9441('0x49')],qs[_0x9441('0x4e')](_0x4ecc76[_0x9441('0x4c')]['fields']));_0x525179[_0x9441('0x4d')]=_0x525179[_0x9441('0x4d')]['length']?_0x525179[_0x9441('0x4d')]:_0x464d2d[_0x9441('0x49')];_0x525179['order']=qs[_0x9441('0x53')](_0x4ecc76[_0x9441('0x4c')][_0x9441('0x53')]);_0x525179[_0x9441('0x56')]=qs[_0x9441('0x4a')](_[_0x9441('0x6b')](_0x4ecc76['query'],_0x464d2d['filters']));if(_0x4ecc76[_0x9441('0x4c')][_0x9441('0x54')]){_0x525179[_0x9441('0x56')]=_[_0x9441('0x55')](_0x525179['where'],{'$or':_[_0x9441('0x43')](_0x525179[_0x9441('0x4d')],function(_0xf9347){var _0xe24600={};_0xe24600[_0xf9347]={'$like':'%'+_0x4ecc76[_0x9441('0x4c')][_0x9441('0x54')]+'%'};return _0xe24600;})});}_0x525179=_[_0x9441('0x55')]({},_0x525179,_0x4ecc76['options']);return _0x4a6e30[_0x9441('0xec')](_0x525179);}})[_0x9441('0x22')](function(_0x423954){if(_0x423954){_0x319337=_0x423954['length'];if(!_0x4ecc76[_0x9441('0x4c')][_0x9441('0x50')](_0x9441('0x51'))){_0x525179[_0x9441('0x33')]=qs['limit'](_0x4ecc76[_0x9441('0x4c')]['limit']);_0x525179['offset']=qs[_0x9441('0x31')](_0x4ecc76[_0x9441('0x4c')][_0x9441('0x31')]);}return _0x4a6e30['getAgents'](_0x525179);}})[_0x9441('0x22')](function(_0x2d9d6b){if(_0x2d9d6b){return _0x2d9d6b?{'count':_0x319337,'rows':_0x2d9d6b}:null;}})['then'](respondWithResult(_0x464d6e,null))[_0x9441('0x2c')](handleError(_0x464d6e,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 85e7866..2bbf6fa 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 _0x58c6=['remove','emit','hasOwnProperty','hook','exports','events','SmsAccount','setMaxListeners','save','update'];(function(_0x2f0521,_0x54bbff){var _0x764f36=function(_0x47ad76){while(--_0x47ad76){_0x2f0521['push'](_0x2f0521['shift']());}};_0x764f36(++_0x54bbff);}(_0x58c6,0x69));var _0x658c=function(_0x36d25e,_0x1a047d){_0x36d25e=_0x36d25e-0x0;var _0x4b95b8=_0x58c6[_0x36d25e];return _0x4b95b8;};'use strict';var EventEmitter=require(_0x658c('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x658c('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x658c('0x2')](0x0);var events={'afterCreate':_0x658c('0x3'),'afterUpdate':_0x658c('0x4'),'afterDestroy':_0x658c('0x5')};function emitEvent(_0x8468fc){return function(_0x7ff908,_0x46689a,_0x1c3b1b){SmsAccountEvents[_0x658c('0x6')](_0x8468fc+':'+_0x7ff908['id'],_0x7ff908);SmsAccountEvents[_0x658c('0x6')](_0x8468fc,_0x7ff908);_0x1c3b1b(null);};}for(var e in events){if(events[_0x658c('0x7')](e)){var event=events[e];SmsAccount[_0x658c('0x8')](e,emitEvent(event));}}module[_0x658c('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0xf229=['exports','../../mysqldb','SmsAccount','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x2ab4bc,_0x12e3bc){var _0x52c36a=function(_0x140d25){while(--_0x140d25){_0x2ab4bc['push'](_0x2ab4bc['shift']());}};_0x52c36a(++_0x12e3bc);}(_0xf229,0xf1));var _0x9f22=function(_0x744757,_0x18214f){_0x744757=_0x744757-0x0;var _0x28cd18=_0xf229[_0x744757];return _0x28cd18;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x9f22('0x0'))['db'][_0x9f22('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x9f22('0x2')](0x0);var events={'afterCreate':_0x9f22('0x3'),'afterUpdate':'update','afterDestroy':_0x9f22('0x4')};function emitEvent(_0x5072c4){return function(_0x4624dc,_0x5353f7,_0x2a5bc6){SmsAccountEvents[_0x9f22('0x5')](_0x5072c4+':'+_0x4624dc['id'],_0x4624dc);SmsAccountEvents['emit'](_0x5072c4,_0x4624dc);_0x2a5bc6(null);};}for(var e in events){if(events[_0x9f22('0x6')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x9f22('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 5aa686b..240b8c5 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 _0x123d=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','define'];(function(_0x73a09c,_0x3957ea){var _0xb1a553=function(_0x302d61){while(--_0x302d61){_0x73a09c['push'](_0x73a09c['shift']());}};_0xb1a553(++_0x3957ea);}(_0x123d,0x172));var _0xd123=function(_0x41478a,_0x23ebe2){_0x41478a=_0x41478a-0x0;var _0x4d17e1=_0x123d[_0x41478a];return _0x4d17e1;};'use strict';var _=require(_0xd123('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd123('0x1'));var moment=require(_0xd123('0x2'));var BPromise=require(_0xd123('0x3'));var rp=require(_0xd123('0x4'));var fs=require('fs');var path=require(_0xd123('0x5'));var rimraf=require(_0xd123('0x6'));var config=require(_0xd123('0x7'));var attributes=require(_0xd123('0x8'));module['exports']=function(_0x3a5295,_0x36beae){return _0x3a5295[_0xd123('0x9')]('SmsAccount',attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf8e5=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','define','SmsAccount','sms_accounts'];(function(_0x7d6eca,_0x59d54a){var _0x128263=function(_0x4019d6){while(--_0x4019d6){_0x7d6eca['push'](_0x7d6eca['shift']());}};_0x128263(++_0x59d54a);}(_0xf8e5,0x188));var _0x5f8e=function(_0x27da33,_0x10ee22){_0x27da33=_0x27da33-0x0;var _0x527369=_0xf8e5[_0x27da33];return _0x527369;};'use strict';var _=require(_0x5f8e('0x0'));var util=require(_0x5f8e('0x1'));var logger=require(_0x5f8e('0x2'))(_0x5f8e('0x3'));var moment=require(_0x5f8e('0x4'));var BPromise=require(_0x5f8e('0x5'));var rp=require(_0x5f8e('0x6'));var fs=require('fs');var path=require(_0x5f8e('0x7'));var rimraf=require(_0x5f8e('0x8'));var config=require(_0x5f8e('0x9'));var attributes=require(_0x5f8e('0xa'));module['exports']=function(_0x3fb98f,_0xb587d0){return _0x3fb98f[_0x5f8e('0xb')](_0x5f8e('0xc'),attributes,{'tableName':_0x5f8e('0xd'),'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 cc596e5..b6da649 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 _0x4146=['redis','socket.io-emitter','./smsAccount.socket','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','SmsAccount','find','options','where','map','model','attributes','include','ShowSmsAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4353a0,_0x5a7a4b){var _0x4a19c2=function(_0x298729){while(--_0x298729){_0x4353a0['push'](_0x4353a0['shift']());}};_0x4a19c2(++_0x5a7a4b);}(_0x4146,0x114));var _0x6414=function(_0x12240b,_0x51d996){_0x12240b=_0x12240b-0x0;var _0x5c7294=_0x4146[_0x12240b];return _0x5c7294;};'use strict';var _=require(_0x6414('0x0'));var util=require(_0x6414('0x1'));var moment=require(_0x6414('0x2'));var BPromise=require(_0x6414('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6414('0x4'));var db=require(_0x6414('0x5'))['db'];var utils=require(_0x6414('0x6'));var logger=require('../../config/logger')(_0x6414('0x7'));var config=require(_0x6414('0x8'));var jayson=require(_0x6414('0x9'));var client=jayson[_0x6414('0xa')][_0x6414('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x6414('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x6414('0xd'))(new Redis(config[_0x6414('0xc')]));require(_0x6414('0xe'))['register'](socket);function respondWithRpcPromise(_0x321c4b,_0x1ca43d,_0x3ee5d8){return new BPromise(function(_0xa3d660,_0x25cc1f){return client['request'](_0x321c4b,_0x3ee5d8)['then'](function(_0x35c467){logger[_0x6414('0xf')](_0x6414('0x10'),_0x1ca43d,_0x6414('0x11'));logger[_0x6414('0x12')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1ca43d,_0x6414('0x11'),JSON[_0x6414('0x13')](_0x35c467));if(_0x35c467['error']){if(_0x35c467['error']['code']===0x1f4){logger[_0x6414('0x14')](_0x6414('0x10'),_0x1ca43d,_0x35c467['error'][_0x6414('0x15')]);return _0x25cc1f(_0x35c467[_0x6414('0x14')][_0x6414('0x15')]);}logger[_0x6414('0x14')]('SmsAccount,\x20%s,\x20%s',_0x1ca43d,_0x35c467['error']['message']);return _0xa3d660(_0x35c467[_0x6414('0x14')][_0x6414('0x15')]);}else{logger['info'](_0x6414('0x10'),_0x1ca43d,'request\x20sent');_0xa3d660(_0x35c467['result']['message']);}})[_0x6414('0x16')](function(_0x3d210f){logger['error']('SmsAccount,\x20%s,\x20%s',_0x1ca43d,_0x3d210f);_0x25cc1f(_0x3d210f);});});}exports['ShowSmsAccount']=function(_0x461922){var _0x1faa4c=this;return new Promise(function(_0x2a775d,_0x5d63a8){return db[_0x6414('0x17')][_0x6414('0x18')]({'raw':_0x461922[_0x6414('0x19')]?_0x461922[_0x6414('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x461922[_0x6414('0x19')]?_0x461922[_0x6414('0x19')][_0x6414('0x1a')]||null:null,'attributes':_0x461922[_0x6414('0x19')]?_0x461922[_0x6414('0x19')]['attributes']||null:null,'include':_0x461922[_0x6414('0x19')]?_0x461922[_0x6414('0x19')]['include']?_[_0x6414('0x1b')](_0x461922[_0x6414('0x19')]['include'],function(_0x15e6df){return{'model':db[_0x15e6df[_0x6414('0x1c')]],'as':_0x15e6df['as'],'attributes':_0x15e6df[_0x6414('0x1d')],'include':_0x15e6df['include']?_[_0x6414('0x1b')](_0x15e6df[_0x6414('0x1e')],function(_0x4b32c5){return{'model':db[_0x4b32c5[_0x6414('0x1c')]],'as':_0x4b32c5['as'],'attributes':_0x4b32c5['attributes'],'include':_0x4b32c5[_0x6414('0x1e')]?_[_0x6414('0x1b')](_0x4b32c5[_0x6414('0x1e')],function(_0x2769d5){return{'model':db[_0x2769d5['model']],'as':_0x2769d5['as'],'attributes':_0x2769d5[_0x6414('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x522fc6){logger[_0x6414('0xf')](_0x6414('0x1f'),_0x461922);logger[_0x6414('0x12')](_0x6414('0x1f'),_0x461922,JSON[_0x6414('0x13')](_0x522fc6));_0x2a775d(_0x522fc6);})['catch'](function(_0x347f45){logger[_0x6414('0x14')](_0x6414('0x1f'),_0x347f45[_0x6414('0x15')],_0x461922);_0x5d63a8(_0x1faa4c[_0x6414('0x14')](0x1f4,_0x347f45[_0x6414('0x15')]));});});}; \ No newline at end of file +var _0xb314=['map','model','include','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','options','where','attributes'];(function(_0x498f22,_0x36fd46){var _0x1080a5=function(_0x1b861e){while(--_0x1b861e){_0x498f22['push'](_0x498f22['shift']());}};_0x1080a5(++_0x36fd46);}(_0xb314,0xb7));var _0x4b31=function(_0x5154c2,_0xe0b9ac){_0x5154c2=_0x5154c2-0x0;var _0x621670=_0xb314[_0x5154c2];return _0x621670;};'use strict';var _=require(_0x4b31('0x0'));var util=require(_0x4b31('0x1'));var moment=require('moment');var BPromise=require(_0x4b31('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4b31('0x3'));var db=require(_0x4b31('0x4'))['db'];var utils=require(_0x4b31('0x5'));var logger=require(_0x4b31('0x6'))('rpc');var config=require(_0x4b31('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4b31('0x8')][_0x4b31('0x9')]({'port':0x232a});config[_0x4b31('0xa')]=_[_0x4b31('0xb')](config[_0x4b31('0xa')],{'host':_0x4b31('0xc'),'port':0x18eb});var socket=require(_0x4b31('0xd'))(new Redis(config[_0x4b31('0xa')]));require('./smsAccount.socket')[_0x4b31('0xe')](socket);function respondWithRpcPromise(_0xb58aa9,_0x450804,_0x362111){return new BPromise(function(_0x3f6699,_0xa7c6d0){return client[_0x4b31('0xf')](_0xb58aa9,_0x362111)[_0x4b31('0x10')](function(_0x3d0b5f){logger[_0x4b31('0x11')](_0x4b31('0x12'),_0x450804,_0x4b31('0x13'));logger[_0x4b31('0x14')](_0x4b31('0x15'),_0x450804,_0x4b31('0x13'),JSON[_0x4b31('0x16')](_0x3d0b5f));if(_0x3d0b5f[_0x4b31('0x17')]){if(_0x3d0b5f[_0x4b31('0x17')][_0x4b31('0x18')]===0x1f4){logger['error'](_0x4b31('0x12'),_0x450804,_0x3d0b5f[_0x4b31('0x17')][_0x4b31('0x19')]);return _0xa7c6d0(_0x3d0b5f['error'][_0x4b31('0x19')]);}logger[_0x4b31('0x17')](_0x4b31('0x12'),_0x450804,_0x3d0b5f[_0x4b31('0x17')][_0x4b31('0x19')]);return _0x3f6699(_0x3d0b5f[_0x4b31('0x17')]['message']);}else{logger[_0x4b31('0x11')](_0x4b31('0x12'),_0x450804,_0x4b31('0x13'));_0x3f6699(_0x3d0b5f[_0x4b31('0x1a')][_0x4b31('0x19')]);}})[_0x4b31('0x1b')](function(_0x52398c){logger[_0x4b31('0x17')]('SmsAccount,\x20%s,\x20%s',_0x450804,_0x52398c);_0xa7c6d0(_0x52398c);});});}exports[_0x4b31('0x1c')]=function(_0x3e2603){var _0xba55c4=this;return new Promise(function(_0xe915f0,_0x2103d7){return db[_0x4b31('0x1d')]['find']({'raw':_0x3e2603[_0x4b31('0x1e')]?_0x3e2603[_0x4b31('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3e2603['options']?_0x3e2603[_0x4b31('0x1e')][_0x4b31('0x1f')]||null:null,'attributes':_0x3e2603['options']?_0x3e2603[_0x4b31('0x1e')][_0x4b31('0x20')]||null:null,'include':_0x3e2603[_0x4b31('0x1e')]?_0x3e2603[_0x4b31('0x1e')]['include']?_[_0x4b31('0x21')](_0x3e2603[_0x4b31('0x1e')]['include'],function(_0x360113){return{'model':db[_0x360113[_0x4b31('0x22')]],'as':_0x360113['as'],'attributes':_0x360113[_0x4b31('0x20')],'include':_0x360113[_0x4b31('0x23')]?_[_0x4b31('0x21')](_0x360113[_0x4b31('0x23')],function(_0x539dbc){return{'model':db[_0x539dbc[_0x4b31('0x22')]],'as':_0x539dbc['as'],'attributes':_0x539dbc[_0x4b31('0x20')],'include':_0x539dbc['include']?_[_0x4b31('0x21')](_0x539dbc[_0x4b31('0x23')],function(_0x19c087){return{'model':db[_0x19c087['model']],'as':_0x19c087['as'],'attributes':_0x19c087['attributes']};}):[]};}):[]};}):[]:[]})[_0x4b31('0x10')](function(_0x876a7c){logger[_0x4b31('0x11')](_0x4b31('0x1c'),_0x3e2603);logger[_0x4b31('0x14')](_0x4b31('0x1c'),_0x3e2603,JSON[_0x4b31('0x16')](_0x876a7c));_0xe915f0(_0x876a7c);})[_0x4b31('0x1b')](function(_0x54ebf6){logger[_0x4b31('0x17')](_0x4b31('0x1c'),_0x54ebf6[_0x4b31('0x19')],_0x3e2603);_0x2103d7(_0xba55c4[_0x4b31('0x17')](0x1f4,_0x54ebf6[_0x4b31('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 7a38af4..a6fe4f5 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 c55ad7e..32098c2 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x2590a7,_0xe5dbed){var _0x234749=function(_0x48d7a6){while(--_0x48d7a6){_0x2590a7['push'](_0x2590a7['shift']());}};_0x234749(++_0xe5dbed);}(_0x3e74,0x175));var _0x43e7=function(_0x45f664,_0x248762){_0x45f664=_0x45f664-0x0;var _0x10fe3e=_0x3e74[_0x45f664];return _0x10fe3e;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file +var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x54de48,_0x2310da){var _0x4e8dec=function(_0x1b91f9){while(--_0x1b91f9){_0x54de48['push'](_0x54de48['shift']());}};_0x4e8dec(++_0x2310da);}(_0x3e74,0x175));var _0x43e7=function(_0x54bf4b,_0x1b0c0c){_0x54bf4b=_0x54bf4b-0x0;var _0x24d23f=_0x3e74[_0x54bf4b];return _0x24d23f;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 9a2392c..4fd7280 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 _0xc789=['*,*,*,*','exports','STRING','noop','TEXT'];(function(_0x56441c,_0x274fb5){var _0x194552=function(_0x45bcdf){while(--_0x45bcdf){_0x56441c['push'](_0x56441c['shift']());}};_0x194552(++_0x274fb5);}(_0xc789,0xd8));var _0x9c78=function(_0x15bb5d,_0x9d29a4){_0x15bb5d=_0x15bb5d-0x0;var _0x18b3ee=_0xc789[_0x15bb5d];return _0x18b3ee;};'use strict';var Sequelize=require('sequelize');module[_0x9c78('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9c78('0x1')],'allowNull':![],'defaultValue':_0x9c78('0x2')},'appdata':{'type':Sequelize[_0x9c78('0x3')]()},'description':{'type':Sequelize[_0x9c78('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9c78('0x4')}}; \ No newline at end of file +var _0x8735=['sequelize','exports','INTEGER','noop','STRING','*,*,*,*'];(function(_0x314f57,_0x546626){var _0x3fc92c=function(_0x59fc25){while(--_0x59fc25){_0x314f57['push'](_0x314f57['shift']());}};_0x3fc92c(++_0x546626);}(_0x8735,0xe4));var _0x5873=function(_0x321930,_0x33ed35){_0x321930=_0x321930-0x0;var _0x30ce44=_0x8735[_0x321930];return _0x30ce44;};'use strict';var Sequelize=require(_0x5873('0x0'));module[_0x5873('0x1')]={'priority':{'type':Sequelize[_0x5873('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5873('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x5873('0x4')]},'interval':{'type':Sequelize[_0x5873('0x4')],'defaultValue':_0x5873('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 595d2f4..b664569 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 _0x0d87=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','stack','name','send','map','SmsApplication','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','include','catch','params','rawAttributes','intersection','create','update','body','find'];(function(_0x14476b,_0xd1a7a4){var _0x24e2e8=function(_0x52ed26){while(--_0x52ed26){_0x14476b['push'](_0x14476b['shift']());}};_0x24e2e8(++_0xd1a7a4);}(_0x0d87,0x16d));var _0x70d8=function(_0x425496,_0x20ed8f){_0x425496=_0x425496-0x0;var _0x428293=_0x0d87[_0x425496];return _0x428293;};'use strict';var emlformat=require(_0x70d8('0x0'));var rimraf=require(_0x70d8('0x1'));var zipdir=require(_0x70d8('0x2'));var jsonpatch=require(_0x70d8('0x3'));var rp=require(_0x70d8('0x4'));var moment=require('moment');var BPromise=require(_0x70d8('0x5'));var Mustache=require(_0x70d8('0x6'));var util=require(_0x70d8('0x7'));var path=require(_0x70d8('0x8'));var sox=require(_0x70d8('0x9'));var csv=require(_0x70d8('0xa'));var ejs=require(_0x70d8('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x70d8('0xc'));var squel=require('squel');var crypto=require(_0x70d8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x70d8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x70d8('0xf'));var Papa=require(_0x70d8('0x10'));var Redis=require(_0x70d8('0x11'));var authService=require(_0x70d8('0x12'));var qs=require(_0x70d8('0x13'));var as=require(_0x70d8('0x14'));var hardwareService=require(_0x70d8('0x15'));var logger=require(_0x70d8('0x16'))(_0x70d8('0x17'));var utils=require(_0x70d8('0x18'));var config=require(_0x70d8('0x19'));var licenseUtil=require(_0x70d8('0x1a'));var db=require(_0x70d8('0x1b'))['db'];function respondWithStatusCode(_0x4d2bce,_0x5ef8e7){_0x5ef8e7=_0x5ef8e7||0xcc;return function(_0x3ab2ea){if(_0x3ab2ea){return _0x4d2bce[_0x70d8('0x1c')](_0x5ef8e7);}return _0x4d2bce[_0x70d8('0x1d')](_0x5ef8e7)[_0x70d8('0x1e')]();};}function respondWithResult(_0x49cc58,_0x4dfbde){_0x4dfbde=_0x4dfbde||0xc8;return function(_0x3911c1){if(_0x3911c1){return _0x49cc58[_0x70d8('0x1d')](_0x4dfbde)[_0x70d8('0x1f')](_0x3911c1);}};}function respondWithFilteredResult(_0x1925d3,_0x28fd39){return function(_0x592d84){if(_0x592d84){var _0x2cad1d=typeof _0x28fd39[_0x70d8('0x20')]===_0x70d8('0x21')&&typeof _0x28fd39['limit']==='undefined';var _0x46d6b3=_0x592d84[_0x70d8('0x22')];var _0x504d94=_0x2cad1d?0x0:_0x28fd39['offset'];var _0x371754=_0x2cad1d?_0x592d84['count']:_0x28fd39['offset']+_0x28fd39[_0x70d8('0x23')];var _0x54ef71;if(_0x371754>=_0x46d6b3){_0x371754=_0x46d6b3;_0x54ef71=0xc8;}else{_0x54ef71=0xce;}_0x1925d3[_0x70d8('0x1d')](_0x54ef71);return _0x1925d3[_0x70d8('0x24')](_0x70d8('0x25'),_0x504d94+'-'+_0x371754+'/'+_0x46d6b3)['json'](_0x592d84);}return null;};}function patchUpdates(_0xdf39ca){return function(_0x3a634c){try{jsonpatch[_0x70d8('0x26')](_0x3a634c,_0xdf39ca,!![]);}catch(_0xab4136){return BPromise['reject'](_0xab4136);}return _0x3a634c[_0x70d8('0x27')]();};}function saveUpdates(_0x313db5,_0x561935){return function(_0x5e5db8){if(_0x5e5db8){return _0x5e5db8['update'](_0x313db5)[_0x70d8('0x28')](function(_0x19c97d){return _0x19c97d;});}return null;};}function removeEntity(_0x205caf,_0x1d7cdb){return function(_0x222169){if(_0x222169){return _0x222169[_0x70d8('0x29')]()[_0x70d8('0x28')](function(){_0x205caf[_0x70d8('0x1d')](0xcc)[_0x70d8('0x1e')]();});}};}function handleEntityNotFound(_0x593909,_0x289d0b){return function(_0x1500b7){if(!_0x1500b7){_0x593909['sendStatus'](0x194);}return _0x1500b7;};}function handleError(_0x5000fb,_0xee3149){_0xee3149=_0xee3149||0x1f4;return function(_0x422157){logger['error'](_0x422157[_0x70d8('0x2a')]);if(_0x422157[_0x70d8('0x2b')]){delete _0x422157[_0x70d8('0x2b')];}_0x5000fb[_0x70d8('0x1d')](_0xee3149)[_0x70d8('0x2c')](_0x422157);};}exports['index']=function(_0x5669cf,_0x5f3f1b){var _0x2b2b60={},_0x5341b7={},_0x1483c2={'count':0x0,'rows':[]};var _0x421d7f=_[_0x70d8('0x2d')](db[_0x70d8('0x2e')]['rawAttributes'],function(_0x51f83d){return{'name':_0x51f83d['fieldName'],'type':_0x51f83d[_0x70d8('0x2f')][_0x70d8('0x30')]};});_0x5341b7['model']=_[_0x70d8('0x2d')](_0x421d7f,_0x70d8('0x2b'));_0x5341b7[_0x70d8('0x31')]=_[_0x70d8('0x32')](_0x5669cf[_0x70d8('0x31')]);_0x5341b7[_0x70d8('0x33')]=_['intersection'](_0x5341b7[_0x70d8('0x34')],_0x5341b7[_0x70d8('0x31')]);_0x2b2b60[_0x70d8('0x35')]=_['intersection'](_0x5341b7[_0x70d8('0x34')],qs[_0x70d8('0x36')](_0x5669cf[_0x70d8('0x31')]['fields']));_0x2b2b60[_0x70d8('0x35')]=_0x2b2b60[_0x70d8('0x35')][_0x70d8('0x37')]?_0x2b2b60[_0x70d8('0x35')]:_0x5341b7[_0x70d8('0x34')];if(!_0x5669cf[_0x70d8('0x31')][_0x70d8('0x38')]('nolimit')){_0x2b2b60[_0x70d8('0x23')]=qs[_0x70d8('0x23')](_0x5669cf[_0x70d8('0x31')][_0x70d8('0x23')]);_0x2b2b60['offset']=qs[_0x70d8('0x20')](_0x5669cf['query']['offset']);}_0x2b2b60[_0x70d8('0x39')]=qs['sort'](_0x5669cf[_0x70d8('0x31')][_0x70d8('0x3a')]);_0x2b2b60[_0x70d8('0x3b')]=qs[_0x70d8('0x33')](_[_0x70d8('0x3c')](_0x5669cf[_0x70d8('0x31')],_0x5341b7['filters']),_0x421d7f);if(_0x5669cf[_0x70d8('0x31')]['filter']){_0x2b2b60[_0x70d8('0x3b')]=_[_0x70d8('0x3d')](_0x2b2b60[_0x70d8('0x3b')],{'$or':_[_0x70d8('0x2d')](_0x421d7f,function(_0x5939f3){if(_0x5939f3['type']!=='VIRTUAL'){var _0x3c8e37={};_0x3c8e37[_0x5939f3[_0x70d8('0x2b')]]={'$like':'%'+_0x5669cf[_0x70d8('0x31')][_0x70d8('0x3e')]+'%'};return _0x3c8e37;}})});}_0x2b2b60=_['merge']({},_0x2b2b60,_0x5669cf[_0x70d8('0x3f')]);var _0x5e492c={'where':_0x2b2b60[_0x70d8('0x3b')]};return db['SmsApplication'][_0x70d8('0x22')](_0x5e492c)[_0x70d8('0x28')](function(_0x52fbe6){_0x1483c2[_0x70d8('0x22')]=_0x52fbe6;if(_0x5669cf[_0x70d8('0x31')]['includeAll']){_0x2b2b60[_0x70d8('0x40')]=[{'all':!![]}];}return db[_0x70d8('0x2e')]['findAll'](_0x2b2b60);})[_0x70d8('0x28')](function(_0x434aba){_0x1483c2['rows']=_0x434aba;return _0x1483c2;})['then'](respondWithFilteredResult(_0x5f3f1b,_0x2b2b60))[_0x70d8('0x41')](handleError(_0x5f3f1b,null));};exports['show']=function(_0x482d74,_0x18853d){var _0x10a1b1={'raw':!![],'where':{'id':_0x482d74[_0x70d8('0x42')]['id']}},_0x170cdf={};_0x170cdf[_0x70d8('0x34')]=_[_0x70d8('0x32')](db['SmsApplication'][_0x70d8('0x43')]);_0x170cdf[_0x70d8('0x31')]=_['keys'](_0x482d74[_0x70d8('0x31')]);_0x170cdf['filters']=_['intersection'](_0x170cdf[_0x70d8('0x34')],_0x170cdf[_0x70d8('0x31')]);_0x10a1b1['attributes']=_[_0x70d8('0x44')](_0x170cdf['model'],qs['fields'](_0x482d74['query'][_0x70d8('0x36')]));_0x10a1b1[_0x70d8('0x35')]=_0x10a1b1[_0x70d8('0x35')]['length']?_0x10a1b1[_0x70d8('0x35')]:_0x170cdf[_0x70d8('0x34')];if(_0x482d74[_0x70d8('0x31')]['includeAll']){_0x10a1b1[_0x70d8('0x40')]=[{'all':!![]}];}_0x10a1b1=_[_0x70d8('0x3d')]({},_0x10a1b1,_0x482d74[_0x70d8('0x3f')]);return db[_0x70d8('0x2e')]['find'](_0x10a1b1)[_0x70d8('0x28')](handleEntityNotFound(_0x18853d,null))['then'](respondWithResult(_0x18853d,null))['catch'](handleError(_0x18853d,null));};exports[_0x70d8('0x45')]=function(_0x20ce95,_0x59adec){return db['SmsApplication'][_0x70d8('0x45')](_0x20ce95['body'],{})['then'](respondWithResult(_0x59adec,0xc9))['catch'](handleError(_0x59adec,null));};exports[_0x70d8('0x46')]=function(_0x343e52,_0x44e552){if(_0x343e52['body']['id']){delete _0x343e52[_0x70d8('0x47')]['id'];}return db[_0x70d8('0x2e')][_0x70d8('0x48')]({'where':{'id':_0x343e52['params']['id']}})[_0x70d8('0x28')](handleEntityNotFound(_0x44e552,null))['then'](saveUpdates(_0x343e52[_0x70d8('0x47')],null))[_0x70d8('0x28')](respondWithResult(_0x44e552,null))['catch'](handleError(_0x44e552,null));};exports[_0x70d8('0x29')]=function(_0x136127,_0x32bc2e){return db[_0x70d8('0x2e')][_0x70d8('0x48')]({'where':{'id':_0x136127['params']['id']}})[_0x70d8('0x28')](handleEntityNotFound(_0x32bc2e,null))[_0x70d8('0x28')](removeEntity(_0x32bc2e,null))[_0x70d8('0x41')](handleError(_0x32bc2e,null));}; \ No newline at end of file +var _0xcd5d=['end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','SmsApplication','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','params','keys','rawAttributes','include','find','create','body','catch','eml-format','zip-dir','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x415e8c,_0x12fdd7){var _0x235b48=function(_0x123e33){while(--_0x123e33){_0x415e8c['push'](_0x415e8c['shift']());}};_0x235b48(++_0x12fdd7);}(_0xcd5d,0x10c));var _0xdcd5=function(_0xb605f7,_0x3c6c19){_0xb605f7=_0xb605f7-0x0;var _0x3530ff=_0xcd5d[_0xb605f7];return _0x3530ff;};'use strict';var emlformat=require(_0xdcd5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdcd5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdcd5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdcd5('0x3'));var util=require(_0xdcd5('0x4'));var path=require('path');var sox=require(_0xdcd5('0x5'));var csv=require(_0xdcd5('0x6'));var ejs=require(_0xdcd5('0x7'));var fs=require('fs');var fs_extra=require(_0xdcd5('0x8'));var _=require(_0xdcd5('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdcd5('0xa'));var deskjs=require(_0xdcd5('0xb'));var toCsv=require(_0xdcd5('0x6'));var querystring=require(_0xdcd5('0xc'));var Papa=require(_0xdcd5('0xd'));var Redis=require(_0xdcd5('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xdcd5('0xf'));var as=require(_0xdcd5('0x10'));var hardwareService=require(_0xdcd5('0x11'));var logger=require(_0xdcd5('0x12'))(_0xdcd5('0x13'));var utils=require('../../config/utils');var config=require(_0xdcd5('0x14'));var licenseUtil=require(_0xdcd5('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11dc89,_0x4b3ba0){_0x4b3ba0=_0x4b3ba0||0xcc;return function(_0x1fc2e2){if(_0x1fc2e2){return _0x11dc89[_0xdcd5('0x16')](_0x4b3ba0);}return _0x11dc89[_0xdcd5('0x17')](_0x4b3ba0)[_0xdcd5('0x18')]();};}function respondWithResult(_0x58df05,_0x51e7b3){_0x51e7b3=_0x51e7b3||0xc8;return function(_0x1afeb8){if(_0x1afeb8){return _0x58df05['status'](_0x51e7b3)[_0xdcd5('0x19')](_0x1afeb8);}};}function respondWithFilteredResult(_0x356c08,_0x31e872){return function(_0x5e406b){if(_0x5e406b){var _0x213d0c=typeof _0x31e872['offset']==='undefined'&&typeof _0x31e872[_0xdcd5('0x1a')]===_0xdcd5('0x1b');var _0x362d6a=_0x5e406b[_0xdcd5('0x1c')];var _0x5a5c70=_0x213d0c?0x0:_0x31e872[_0xdcd5('0x1d')];var _0x59ec78=_0x213d0c?_0x5e406b[_0xdcd5('0x1c')]:_0x31e872[_0xdcd5('0x1d')]+_0x31e872[_0xdcd5('0x1a')];var _0x43c1eb;if(_0x59ec78>=_0x362d6a){_0x59ec78=_0x362d6a;_0x43c1eb=0xc8;}else{_0x43c1eb=0xce;}_0x356c08['status'](_0x43c1eb);return _0x356c08[_0xdcd5('0x1e')](_0xdcd5('0x1f'),_0x5a5c70+'-'+_0x59ec78+'/'+_0x362d6a)['json'](_0x5e406b);}return null;};}function patchUpdates(_0x50f7f6){return function(_0x340f29){try{jsonpatch[_0xdcd5('0x20')](_0x340f29,_0x50f7f6,!![]);}catch(_0x4de867){return BPromise[_0xdcd5('0x21')](_0x4de867);}return _0x340f29[_0xdcd5('0x22')]();};}function saveUpdates(_0x16f2dc,_0x28ab3a){return function(_0xfc9113){if(_0xfc9113){return _0xfc9113[_0xdcd5('0x23')](_0x16f2dc)[_0xdcd5('0x24')](function(_0x19aeba){return _0x19aeba;});}return null;};}function removeEntity(_0x40fd16,_0x4ffc86){return function(_0x392f7b){if(_0x392f7b){return _0x392f7b[_0xdcd5('0x25')]()[_0xdcd5('0x24')](function(){_0x40fd16[_0xdcd5('0x17')](0xcc)[_0xdcd5('0x18')]();});}};}function handleEntityNotFound(_0x13a566,_0x4b1a5c){return function(_0x5580bd){if(!_0x5580bd){_0x13a566[_0xdcd5('0x16')](0x194);}return _0x5580bd;};}function handleError(_0xe8c198,_0x423649){_0x423649=_0x423649||0x1f4;return function(_0x262d38){logger[_0xdcd5('0x26')](_0x262d38[_0xdcd5('0x27')]);if(_0x262d38[_0xdcd5('0x28')]){delete _0x262d38['name'];}_0xe8c198[_0xdcd5('0x17')](_0x423649)[_0xdcd5('0x29')](_0x262d38);};}exports['index']=function(_0x260722,_0x253b69){var _0x5240d9={},_0xa769c8={},_0x29d418={'count':0x0,'rows':[]};var _0x5128c3=_['map'](db[_0xdcd5('0x2a')]['rawAttributes'],function(_0x29d648){return{'name':_0x29d648[_0xdcd5('0x2b')],'type':_0x29d648[_0xdcd5('0x2c')][_0xdcd5('0x2d')]};});_0xa769c8['model']=_[_0xdcd5('0x2e')](_0x5128c3,_0xdcd5('0x28'));_0xa769c8[_0xdcd5('0x2f')]=_['keys'](_0x260722[_0xdcd5('0x2f')]);_0xa769c8[_0xdcd5('0x30')]=_[_0xdcd5('0x31')](_0xa769c8[_0xdcd5('0x32')],_0xa769c8['query']);_0x5240d9[_0xdcd5('0x33')]=_[_0xdcd5('0x31')](_0xa769c8['model'],qs[_0xdcd5('0x34')](_0x260722[_0xdcd5('0x2f')][_0xdcd5('0x34')]));_0x5240d9[_0xdcd5('0x33')]=_0x5240d9[_0xdcd5('0x33')]['length']?_0x5240d9['attributes']:_0xa769c8[_0xdcd5('0x32')];if(!_0x260722[_0xdcd5('0x2f')][_0xdcd5('0x35')](_0xdcd5('0x36'))){_0x5240d9[_0xdcd5('0x1a')]=qs[_0xdcd5('0x1a')](_0x260722[_0xdcd5('0x2f')][_0xdcd5('0x1a')]);_0x5240d9['offset']=qs[_0xdcd5('0x1d')](_0x260722[_0xdcd5('0x2f')]['offset']);}_0x5240d9[_0xdcd5('0x37')]=qs[_0xdcd5('0x38')](_0x260722[_0xdcd5('0x2f')][_0xdcd5('0x38')]);_0x5240d9[_0xdcd5('0x39')]=qs['filters'](_[_0xdcd5('0x3a')](_0x260722['query'],_0xa769c8[_0xdcd5('0x30')]),_0x5128c3);if(_0x260722[_0xdcd5('0x2f')][_0xdcd5('0x3b')]){_0x5240d9[_0xdcd5('0x39')]=_[_0xdcd5('0x3c')](_0x5240d9[_0xdcd5('0x39')],{'$or':_['map'](_0x5128c3,function(_0x52a867){if(_0x52a867[_0xdcd5('0x2c')]!=='VIRTUAL'){var _0x4e47af={};_0x4e47af[_0x52a867[_0xdcd5('0x28')]]={'$like':'%'+_0x260722['query'][_0xdcd5('0x3b')]+'%'};return _0x4e47af;}})});}_0x5240d9=_[_0xdcd5('0x3c')]({},_0x5240d9,_0x260722[_0xdcd5('0x3d')]);var _0x550dc9={'where':_0x5240d9['where']};return db['SmsApplication']['count'](_0x550dc9)[_0xdcd5('0x24')](function(_0x3f56c8){_0x29d418[_0xdcd5('0x1c')]=_0x3f56c8;if(_0x260722[_0xdcd5('0x2f')][_0xdcd5('0x3e')]){_0x5240d9['include']=[{'all':!![]}];}return db['SmsApplication'][_0xdcd5('0x3f')](_0x5240d9);})[_0xdcd5('0x24')](function(_0x41bc43){_0x29d418[_0xdcd5('0x40')]=_0x41bc43;return _0x29d418;})[_0xdcd5('0x24')](respondWithFilteredResult(_0x253b69,_0x5240d9))['catch'](handleError(_0x253b69,null));};exports['show']=function(_0x372844,_0x532e97){var _0x450ad5={'raw':!![],'where':{'id':_0x372844[_0xdcd5('0x41')]['id']}},_0x14ded3={};_0x14ded3['model']=_[_0xdcd5('0x42')](db[_0xdcd5('0x2a')][_0xdcd5('0x43')]);_0x14ded3[_0xdcd5('0x2f')]=_[_0xdcd5('0x42')](_0x372844[_0xdcd5('0x2f')]);_0x14ded3['filters']=_[_0xdcd5('0x31')](_0x14ded3[_0xdcd5('0x32')],_0x14ded3[_0xdcd5('0x2f')]);_0x450ad5[_0xdcd5('0x33')]=_[_0xdcd5('0x31')](_0x14ded3['model'],qs['fields'](_0x372844['query'][_0xdcd5('0x34')]));_0x450ad5[_0xdcd5('0x33')]=_0x450ad5[_0xdcd5('0x33')]['length']?_0x450ad5[_0xdcd5('0x33')]:_0x14ded3[_0xdcd5('0x32')];if(_0x372844[_0xdcd5('0x2f')][_0xdcd5('0x3e')]){_0x450ad5[_0xdcd5('0x44')]=[{'all':!![]}];}_0x450ad5=_[_0xdcd5('0x3c')]({},_0x450ad5,_0x372844[_0xdcd5('0x3d')]);return db['SmsApplication'][_0xdcd5('0x45')](_0x450ad5)['then'](handleEntityNotFound(_0x532e97,null))['then'](respondWithResult(_0x532e97,null))['catch'](handleError(_0x532e97,null));};exports[_0xdcd5('0x46')]=function(_0x2d348d,_0x2905e0){return db[_0xdcd5('0x2a')][_0xdcd5('0x46')](_0x2d348d[_0xdcd5('0x47')],{})['then'](respondWithResult(_0x2905e0,0xc9))['catch'](handleError(_0x2905e0,null));};exports[_0xdcd5('0x23')]=function(_0x519c29,_0x3f361a){if(_0x519c29[_0xdcd5('0x47')]['id']){delete _0x519c29[_0xdcd5('0x47')]['id'];}return db[_0xdcd5('0x2a')][_0xdcd5('0x45')]({'where':{'id':_0x519c29[_0xdcd5('0x41')]['id']}})['then'](handleEntityNotFound(_0x3f361a,null))[_0xdcd5('0x24')](saveUpdates(_0x519c29['body'],null))[_0xdcd5('0x24')](respondWithResult(_0x3f361a,null))[_0xdcd5('0x48')](handleError(_0x3f361a,null));};exports[_0xdcd5('0x25')]=function(_0x5c3baf,_0x150675){return db[_0xdcd5('0x2a')][_0xdcd5('0x45')]({'where':{'id':_0x5c3baf[_0xdcd5('0x41')]['id']}})[_0xdcd5('0x24')](handleEntityNotFound(_0x150675,null))[_0xdcd5('0x24')](removeEntity(_0x150675,null))[_0xdcd5('0x48')](handleError(_0x150675,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 5070323..171653b 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 _0x50df=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsApplication','sms_applications','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x50df,0x168));var _0xf50d=function(_0x1eb1de,_0x52472d){_0x1eb1de=_0x1eb1de-0x0;var _0x3b4c3e=_0x50df[_0x1eb1de];return _0x3b4c3e;};'use strict';var _=require(_0xf50d('0x0'));var util=require('util');var logger=require(_0xf50d('0x1'))(_0xf50d('0x2'));var moment=require(_0xf50d('0x3'));var BPromise=require(_0xf50d('0x4'));var rp=require(_0xf50d('0x5'));var fs=require('fs');var path=require(_0xf50d('0x6'));var rimraf=require(_0xf50d('0x7'));var config=require(_0xf50d('0x8'));var attributes=require('./smsApplication.attributes');module[_0xf50d('0x9')]=function(_0x4226d0,_0x1e25f1){return _0x4226d0[_0xf50d('0xa')](_0xf50d('0xb'),attributes,{'tableName':_0xf50d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf50d('0xd')});}; \ No newline at end of file +var _0x5225=['exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','path','rimraf','../../config/environment','./smsApplication.attributes'];(function(_0x370929,_0x2c345c){var _0xa50350=function(_0xf5a4e7){while(--_0xf5a4e7){_0x370929['push'](_0x370929['shift']());}};_0xa50350(++_0x2c345c);}(_0x5225,0x19b));var _0x5522=function(_0x3f4a8e,_0x507c39){_0x3f4a8e=_0x3f4a8e-0x0;var _0x7f68fd=_0x5225[_0x3f4a8e];return _0x7f68fd;};'use strict';var _=require(_0x5522('0x0'));var util=require('util');var logger=require(_0x5522('0x1'))('api');var moment=require(_0x5522('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5522('0x3'));var rimraf=require(_0x5522('0x4'));var config=require(_0x5522('0x5'));var attributes=require(_0x5522('0x6'));module[_0x5522('0x7')]=function(_0x40442c,_0x327f1d){return _0x40442c[_0x5522('0x8')]('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5522('0x9'),'collate':_0x5522('0xa')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index df352ad..5884fb8 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 _0x38b8=['client','http','request','then','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','ioredis','../../config/logger','rpc'];(function(_0x2b152a,_0x3dd988){var _0x2ad4c7=function(_0x2fa97c){while(--_0x2fa97c){_0x2b152a['push'](_0x2b152a['shift']());}};_0x2ad4c7(++_0x3dd988);}(_0x38b8,0x7f));var _0x838b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x38b8[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x838b('0x0'));var util=require('util');var moment=require(_0x838b('0x1'));var BPromise=require(_0x838b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x838b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x838b('0x4'))(_0x838b('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x838b('0x6')][_0x838b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5c516c,_0x2d3e96,_0x15184b){return new BPromise(function(_0x4b9530,_0x552245){return client[_0x838b('0x8')](_0x5c516c,_0x15184b)[_0x838b('0x9')](function(_0x31ba84){logger['info'](_0x838b('0xa'),_0x2d3e96,'request\x20sent');logger[_0x838b('0xb')](_0x838b('0xc'),_0x2d3e96,_0x838b('0xd'),JSON[_0x838b('0xe')](_0x31ba84));if(_0x31ba84[_0x838b('0xf')]){if(_0x31ba84[_0x838b('0xf')]['code']===0x1f4){logger[_0x838b('0xf')](_0x838b('0xa'),_0x2d3e96,_0x31ba84[_0x838b('0xf')][_0x838b('0x10')]);return _0x552245(_0x31ba84[_0x838b('0xf')][_0x838b('0x10')]);}logger[_0x838b('0xf')](_0x838b('0xa'),_0x2d3e96,_0x31ba84[_0x838b('0xf')]['message']);return _0x4b9530(_0x31ba84[_0x838b('0xf')]['message']);}else{logger['info']('SmsApplication,\x20%s,\x20%s',_0x2d3e96,_0x838b('0xd'));_0x4b9530(_0x31ba84[_0x838b('0x11')][_0x838b('0x10')]);}})[_0x838b('0x12')](function(_0x94e893){logger['error'](_0x838b('0xa'),_0x2d3e96,_0x94e893);_0x552245(_0x94e893);});});} \ No newline at end of file +var _0x23db=['debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x4d7a61,_0x3fb6e6){var _0x186f73=function(_0x4eeeeb){while(--_0x4eeeeb){_0x4d7a61['push'](_0x4d7a61['shift']());}};_0x186f73(++_0x3fb6e6);}(_0x23db,0x141));var _0xb23d=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x23db[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0xb23d('0x0'));var util=require(_0xb23d('0x1'));var moment=require(_0xb23d('0x2'));var BPromise=require(_0xb23d('0x3'));var rs=require(_0xb23d('0x4'));var fs=require('fs');var Redis=require(_0xb23d('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb23d('0x6'))(_0xb23d('0x7'));var config=require('../../config/environment');var jayson=require(_0xb23d('0x8'));var client=jayson[_0xb23d('0x9')][_0xb23d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2056b6,_0x39799c,_0x38bed9){return new BPromise(function(_0x460fa0,_0x466785){return client[_0xb23d('0xb')](_0x2056b6,_0x38bed9)['then'](function(_0x2f91f0){logger[_0xb23d('0xc')](_0xb23d('0xd'),_0x39799c,_0xb23d('0xe'));logger[_0xb23d('0xf')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x39799c,'request\x20sent',JSON['stringify'](_0x2f91f0));if(_0x2f91f0[_0xb23d('0x10')]){if(_0x2f91f0['error'][_0xb23d('0x11')]===0x1f4){logger[_0xb23d('0x10')](_0xb23d('0xd'),_0x39799c,_0x2f91f0[_0xb23d('0x10')][_0xb23d('0x12')]);return _0x466785(_0x2f91f0[_0xb23d('0x10')][_0xb23d('0x12')]);}logger['error'](_0xb23d('0xd'),_0x39799c,_0x2f91f0[_0xb23d('0x10')][_0xb23d('0x12')]);return _0x460fa0(_0x2f91f0[_0xb23d('0x10')][_0xb23d('0x12')]);}else{logger[_0xb23d('0xc')]('SmsApplication,\x20%s,\x20%s',_0x39799c,'request\x20sent');_0x460fa0(_0x2f91f0[_0xb23d('0x13')][_0xb23d('0x12')]);}})[_0xb23d('0x14')](function(_0x9e5eb3){logger[_0xb23d('0x10')](_0xb23d('0xd'),_0x39799c,_0x9e5eb3);_0x466785(_0x9e5eb3);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 8073f21..55146ee 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 _0x6e6c=['create','addMessage','tracked','sms','smsinteraction:addtags','addTags','/:id','smsinteraction:update','update','smsinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id/messages','getMessages','/:id/download','download','post'];(function(_0x368a43,_0x1038a2){var _0x1870b6=function(_0x425fb4){while(--_0x425fb4){_0x368a43['push'](_0x368a43['shift']());}};_0x1870b6(++_0x1038a2);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e6c[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var path=require('path');var timeout=require(_0xc6e6('0x2'));var express=require(_0xc6e6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc6e6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc6e6('0x5'));var controller=require('./smsInteraction.controller');router[_0xc6e6('0x6')]('/',auth[_0xc6e6('0x7')](),controller['index']);router[_0xc6e6('0x6')](_0xc6e6('0x8'),auth['isAuthenticated'](),controller[_0xc6e6('0x9')]);router[_0xc6e6('0x6')]('/:id',auth[_0xc6e6('0x7')](),controller['show']);router[_0xc6e6('0x6')](_0xc6e6('0xa'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xb')]);router[_0xc6e6('0x6')](_0xc6e6('0xc'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xd')]);router[_0xc6e6('0xe')]('/',auth['isAuthenticated'](),controller[_0xc6e6('0xf')]);router['post'](_0xc6e6('0xa'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0x10')]);router[_0xc6e6('0xe')]('/:id/tags',auth[_0xc6e6('0x7')](),interaction[_0xc6e6('0x11')](_0xc6e6('0x12'),_0xc6e6('0x13')),controller[_0xc6e6('0x14')]);router['put'](_0xc6e6('0x15'),auth[_0xc6e6('0x7')](),interaction['tracked'](_0xc6e6('0x12'),_0xc6e6('0x16')),controller[_0xc6e6('0x17')]);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0xc6e6('0x11')]('sms',_0xc6e6('0x18')),controller[_0xc6e6('0x19')]);router[_0xc6e6('0x1a')](_0xc6e6('0x1b'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0x1c')]);module[_0xc6e6('0x1d')]=router; \ No newline at end of file +var _0xa571=['get','isAuthenticated','index','/describe','/:id','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','tracked','destroy','/:id/tags','removeTags','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa571,0x107));var _0x1a57=function(_0x1a5486,_0x26eb12){_0x1a5486=_0x1a5486-0x0;var _0x432d61=_0xa571[_0x1a5486];return _0x432d61;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./smsInteraction.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['describe']);router[_0x1a57('0x7')](_0x1a57('0xb'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0x7')](_0x1a57('0xc'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0x7')](_0x1a57('0xe'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1a57('0x10')]);router[_0x1a57('0x11')](_0x1a57('0xc'),auth['isAuthenticated'](),controller[_0x1a57('0x12')]);router[_0x1a57('0x11')]('/:id/tags',auth[_0x1a57('0x8')](),interaction['tracked'](_0x1a57('0x13'),_0x1a57('0x14')),controller[_0x1a57('0x15')]);router[_0x1a57('0x16')]('/:id',auth[_0x1a57('0x8')](),interaction['tracked']('sms',_0x1a57('0x17')),controller[_0x1a57('0x18')]);router[_0x1a57('0x19')]('/:id',auth[_0x1a57('0x8')](),interaction[_0x1a57('0x1a')](_0x1a57('0x13'),'smsinteraction:destroy'),controller[_0x1a57('0x1b')]);router[_0x1a57('0x19')](_0x1a57('0x1c'),auth[_0x1a57('0x8')](),controller[_0x1a57('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 867d069..b68e842 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 _0x13cc=['out','ENUM','INTEGER','exports','BOOLEAN','STRING','DATE'];(function(_0x1c6dc4,_0x40a088){var _0x8a65c=function(_0x2fe808){while(--_0x2fe808){_0x1c6dc4['push'](_0x1c6dc4['shift']());}};_0x8a65c(++_0x40a088);}(_0x13cc,0x161));var _0xc13c=function(_0x345b02,_0x454869){_0x345b02=_0x345b02-0x0;var _0x51483b=_0x13cc[_0x345b02];return _0x51483b;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xc13c('0x0')]={'closed':{'type':Sequelize[_0xc13c('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xc13c('0x2')]},'secondDisposition':{'type':Sequelize[_0xc13c('0x2')]},'thirdDisposition':{'type':Sequelize[_0xc13c('0x2')]},'note':{'type':Sequelize[_0xc13c('0x2')]},'phone':{'type':Sequelize[_0xc13c('0x2')]},'read1stAt':{'type':Sequelize[_0xc13c('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xc13c('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xc13c('0x5')]('in',_0xc13c('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc13c('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xc13c('0x6')]}}; \ No newline at end of file +var _0xdfdd=['moment','exports','BOOLEAN','STRING','DATE','ENUM','out','INTEGER','sequelize'];(function(_0x419cea,_0x14b897){var _0x2d3bea=function(_0x359db9){while(--_0x359db9){_0x419cea['push'](_0x419cea['shift']());}};_0x2d3bea(++_0x14b897);}(_0xdfdd,0x104));var _0xddfd=function(_0x4a7e38,_0x253bfe){_0x4a7e38=_0x4a7e38-0x0;var _0x4ae5a6=_0xdfdd[_0x4a7e38];return _0x4ae5a6;};'use strict';var Sequelize=require(_0xddfd('0x0'));var moment=require(_0xddfd('0x1'));module[_0xddfd('0x2')]={'closed':{'type':Sequelize[_0xddfd('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xddfd('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xddfd('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xddfd('0x4')]},'read1stAt':{'type':Sequelize[_0xddfd('0x5')]},'firstMsgDirection':{'type':Sequelize[_0xddfd('0x6')]('in',_0xddfd('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xddfd('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xddfd('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xddfd('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 6352627..015d5aa 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 _0x751a=['Contact','firstName','out','renderFile','downloadInteraction.ejs','transcript-','.pdf','download','log','err','unlinkSync','rimraf','moment','bluebird','util','lodash','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','status','end','json','offset','undefined','count','set','Content-Range','update','then','destroy','sendStatus','stack','name','index','map','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','user','catch','params','model','keys','filters','intersection','attributes','fields','length','include','merge','options','find','create','body','describe','addMessage','omit','ids','getMessages','findOne','SmsMessage','nolimit','limit','order','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','emit','removeTags','unix','toString','root','server','files','tmp','transcript-%d-%s.zip','join','User','push','CmContact','Messages','secret','read','SmsAccount','Account','fullname','get','mkdirSync','Sms','Owner','N.A.','createdAt','closedAt','disposition','System'];(function(_0x1f31e5,_0x124795){var _0x427fd6=function(_0x17b405){while(--_0x17b405){_0x1f31e5['push'](_0x1f31e5['shift']());}};_0x427fd6(++_0x124795);}(_0x751a,0x1e7));var _0xa751=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x751a[_0x58dc25];return _0x21b0a7;};'use strict';var rimraf=require(_0xa751('0x0'));var zipdir=require('zip-dir');var moment=require(_0xa751('0x1'));var BPromise=require(_0xa751('0x2'));var util=require(_0xa751('0x3'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa751('0x4'));var Redis=require('ioredis');var interaction=require(_0xa751('0x5'));var qs=require('../../components/parsers/qs');var pdf=require(_0xa751('0x6'));var logger=require(_0xa751('0x7'))(_0xa751('0x8'));var config=require(_0xa751('0x9'));var db=require(_0xa751('0xa'))['db'];config[_0xa751('0xb')]=_[_0xa751('0xc')](config[_0xa751('0xb')],{'host':_0xa751('0xd'),'port':0x18eb});var socket=require(_0xa751('0xe'))(new Redis(config[_0xa751('0xb')]));require(_0xa751('0xf'))[_0xa751('0x10')](socket);function respondWithStatusCode(_0xf0cbc2,_0x167bcc){_0x167bcc=_0x167bcc||0xcc;return function(_0x2b1f63){if(_0x2b1f63){return _0xf0cbc2['sendStatus'](_0x167bcc);}return _0xf0cbc2[_0xa751('0x11')](_0x167bcc)[_0xa751('0x12')]();};}function respondWithResult(_0x30a127,_0x29d711){_0x29d711=_0x29d711||0xc8;return function(_0x28792f){if(_0x28792f){return _0x30a127[_0xa751('0x11')](_0x29d711)[_0xa751('0x13')](_0x28792f);}};}function respondWithFilteredResult(_0x185af6,_0x4d7903){return function(_0x2bc3d7){if(_0x2bc3d7){var _0x2ba5f5=typeof _0x4d7903[_0xa751('0x14')]==='undefined'&&typeof _0x4d7903['limit']===_0xa751('0x15');var _0xa6d241=_0x2bc3d7[_0xa751('0x16')];var _0x89d597=_0x2ba5f5?0x0:_0x4d7903[_0xa751('0x14')];var _0x485fb4=_0x2ba5f5?_0x2bc3d7[_0xa751('0x16')]:_0x4d7903['offset']+_0x4d7903['limit'];var _0x1a3f20;if(_0x485fb4>=_0xa6d241){_0x485fb4=_0xa6d241;_0x1a3f20=0xc8;}else{_0x1a3f20=0xce;}_0x185af6['status'](_0x1a3f20);return _0x185af6[_0xa751('0x17')](_0xa751('0x18'),_0x89d597+'-'+_0x485fb4+'/'+_0xa6d241)[_0xa751('0x13')](_0x2bc3d7);}return null;};}function saveUpdates(_0x24b6ad){return function(_0x1667a7){if(_0x1667a7){return _0x1667a7[_0xa751('0x19')](_0x24b6ad)[_0xa751('0x1a')](function(_0x5a51e8){return _0x5a51e8;});}return null;};}function removeEntity(_0x2b4ec8){return function(_0x5d6833){if(_0x5d6833){return _0x5d6833[_0xa751('0x1b')]()[_0xa751('0x1a')](function(){_0x2b4ec8['status'](0xcc)[_0xa751('0x12')]();});}};}function handleEntityNotFound(_0x1bd936){return function(_0x2da24e){if(!_0x2da24e){_0x1bd936[_0xa751('0x1c')](0x194);}return _0x2da24e;};}function handleError(_0x25b27d,_0x30a6e7){_0x30a6e7=_0x30a6e7||0x1f4;return function(_0x100ea6){logger['error'](_0x100ea6[_0xa751('0x1d')]);if(_0x100ea6[_0xa751('0x1e')]){delete _0x100ea6['name'];}_0x25b27d['status'](_0x30a6e7)['send'](_0x100ea6);};}exports[_0xa751('0x1f')]=function(_0x6a550e,_0x48ccb8){var _0x3d7941={};var _0x2e5ce9=_[_0xa751('0x20')](db[_0xa751('0x21')][_0xa751('0x22')],function(_0x25ecf7){return{'name':_0x25ecf7[_0xa751('0x23')],'type':_0x25ecf7[_0xa751('0x24')][_0xa751('0x25')]};});_0x3d7941=qs[_0xa751('0x26')](_0x2e5ce9,_0x6a550e);return interaction[_0xa751('0x27')](_0xa751('0x28'),_0x6a550e[_0xa751('0x29')],_0x6a550e[_0xa751('0x2a')],_0x3d7941,_0x2e5ce9)['then'](respondWithFilteredResult(_0x48ccb8,_0x3d7941))[_0xa751('0x2b')](handleError(_0x48ccb8,null));};exports['show']=function(_0x3d56d6,_0x103844){var _0x54d79e={'raw':![],'where':{'id':_0x3d56d6[_0xa751('0x2c')]['id']}},_0x45085d={};_0x45085d[_0xa751('0x2d')]=_[_0xa751('0x2e')](db[_0xa751('0x21')][_0xa751('0x22')]);_0x45085d['query']=_[_0xa751('0x2e')](_0x3d56d6[_0xa751('0x29')]);_0x45085d[_0xa751('0x2f')]=_[_0xa751('0x30')](_0x45085d[_0xa751('0x2d')],_0x45085d[_0xa751('0x29')]);_0x54d79e[_0xa751('0x31')]=_['intersection'](_0x45085d[_0xa751('0x2d')],qs[_0xa751('0x32')](_0x3d56d6['query'][_0xa751('0x32')]));_0x54d79e['attributes']=_0x54d79e[_0xa751('0x31')][_0xa751('0x33')]?_0x54d79e['attributes']:_0x45085d[_0xa751('0x2d')];if(_0x3d56d6[_0xa751('0x29')]['includeAll']){_0x54d79e[_0xa751('0x34')]=[{'all':!![]}];}_0x54d79e=_[_0xa751('0x35')]({},_0x54d79e,_0x3d56d6[_0xa751('0x36')]);return db['SmsInteraction'][_0xa751('0x37')](_0x54d79e)[_0xa751('0x1a')](handleEntityNotFound(_0x103844,null))['then'](respondWithResult(_0x103844,null))[_0xa751('0x2b')](handleError(_0x103844,null));};exports[_0xa751('0x38')]=function(_0x22c5b2,_0x123108){return db[_0xa751('0x21')]['create'](_0x22c5b2[_0xa751('0x39')],{})[_0xa751('0x1a')](respondWithResult(_0x123108,0xc9))[_0xa751('0x2b')](handleError(_0x123108,null));};exports['update']=function(_0x98a257,_0x22d7b4){if(_0x98a257[_0xa751('0x39')]['id']){delete _0x98a257[_0xa751('0x39')]['id'];}return db[_0xa751('0x21')][_0xa751('0x37')]({'where':{'id':_0x98a257[_0xa751('0x2c')]['id']}})[_0xa751('0x1a')](handleEntityNotFound(_0x22d7b4,null))[_0xa751('0x1a')](saveUpdates(_0x98a257[_0xa751('0x39')],null))[_0xa751('0x1a')](respondWithResult(_0x22d7b4,null))['catch'](handleError(_0x22d7b4,null));};exports[_0xa751('0x1b')]=function(_0x4f5fe9,_0x38be9d){return db['SmsInteraction']['find']({'where':{'id':_0x4f5fe9[_0xa751('0x2c')]['id']}})[_0xa751('0x1a')](handleEntityNotFound(_0x38be9d,null))[_0xa751('0x1a')](removeEntity(_0x38be9d,null))[_0xa751('0x2b')](handleError(_0x38be9d,null));};exports[_0xa751('0x3a')]=function(_0x439859,_0x41a6ef){return db[_0xa751('0x21')]['describe']()[_0xa751('0x1a')](respondWithResult(_0x41a6ef,null))[_0xa751('0x2b')](handleError(_0x41a6ef,null));};exports[_0xa751('0x3b')]=function(_0x26e89a,_0x5d09e6){return db['SmsMessage']['find']({'where':{'id':_0x26e89a[_0xa751('0x2c')]['id']}})[_0xa751('0x1a')](handleEntityNotFound(_0x5d09e6,null))[_0xa751('0x1a')](function(_0x59babf){if(_0x59babf){return _0x59babf['addMessage'](_0x26e89a['body']['ids'],_[_0xa751('0x3c')](_0x26e89a['body'],[_0xa751('0x3d'),'id'])||{});}})[_0xa751('0x1a')](respondWithResult(_0x5d09e6,null))['catch'](handleError(_0x5d09e6,null));};exports[_0xa751('0x3e')]=function(_0x59f9e9,_0x1a8577){var _0x1aa699={'raw':![],'where':{}};var _0x4227d3={};var _0x25d04f={'count':0x0,'rows':[]};return db[_0xa751('0x21')][_0xa751('0x3f')]({'where':{'id':_0x59f9e9[_0xa751('0x2c')]['id']}})[_0xa751('0x1a')](handleEntityNotFound(_0x1a8577,null))[_0xa751('0x1a')](function(_0xe60daa){if(_0xe60daa){_0x4227d3['model']=_['keys'](db[_0xa751('0x40')][_0xa751('0x22')]);_0x4227d3[_0xa751('0x29')]=_[_0xa751('0x2e')](_0x59f9e9[_0xa751('0x29')]);_0x4227d3[_0xa751('0x2f')]=_[_0xa751('0x30')](_0x4227d3[_0xa751('0x2d')],_0x4227d3['query']);_0x1aa699[_0xa751('0x31')]=_[_0xa751('0x30')](_0x4227d3[_0xa751('0x2d')],qs['fields'](_0x59f9e9[_0xa751('0x29')][_0xa751('0x32')]));_0x1aa699['attributes']=_0x1aa699['attributes'][_0xa751('0x33')]?_0x1aa699[_0xa751('0x31')]:_0x4227d3['model'];if(!_0x59f9e9[_0xa751('0x29')]['hasOwnProperty'](_0xa751('0x41'))){_0x1aa699['limit']=qs[_0xa751('0x42')](_0x59f9e9['query'][_0xa751('0x42')]);_0x1aa699[_0xa751('0x14')]=qs[_0xa751('0x14')](_0x59f9e9['query'][_0xa751('0x14')]);}_0x1aa699[_0xa751('0x43')]=qs[_0xa751('0x44')](_0x59f9e9[_0xa751('0x29')][_0xa751('0x44')]);_0x1aa699[_0xa751('0x45')]=qs[_0xa751('0x2f')](_[_0xa751('0x46')](_0x59f9e9['query'],_0x4227d3[_0xa751('0x2f')]));_0x1aa699[_0xa751('0x45')]['SmsInteractionId']=_0xe60daa['id'];if(_0x59f9e9[_0xa751('0x29')]['filter']){_0x1aa699[_0xa751('0x45')]=_['merge'](_0x1aa699[_0xa751('0x45')],{'$or':_[_0xa751('0x20')](_0x1aa699['attributes'],function(_0x1d30d2){var _0x39249b={};_0x39249b[_0x1d30d2]={'$like':'%'+_0x59f9e9['query'][_0xa751('0x47')]+'%'};return _0x39249b;})});}if(_0x59f9e9[_0xa751('0x29')][_0xa751('0x48')]){var _0x5a5d0a=_0x59f9e9[_0xa751('0x29')][_0xa751('0x48')][_0xa751('0x49')](',');var _0x2c27b2={};_0x2c27b2[_0x5a5d0a[0x0]]={'$gte':moment(_0x5a5d0a[0x1])[_0xa751('0x4a')](_0xa751('0x4b'))};_0x1aa699[_0xa751('0x45')]=_[_0xa751('0x35')](_0x1aa699[_0xa751('0x45')],_0x2c27b2);}_0x1aa699=_[_0xa751('0x35')]({},_0x1aa699,_0x59f9e9['options']);return db['SmsMessage'][_0xa751('0x16')]({'where':_0x1aa699[_0xa751('0x45')]})['then'](function(_0x5a2130){_0x25d04f[_0xa751('0x16')]=_0x5a2130;if(_0x59f9e9[_0xa751('0x29')]['includeAll']){_0x1aa699[_0xa751('0x34')]=[{'all':!![]}];}return db[_0xa751('0x40')][_0xa751('0x27')](_0x1aa699);})['then'](function(_0x370cc8){_0x25d04f[_0xa751('0x4c')]=_0x370cc8;return _0x25d04f;});}})[_0xa751('0x1a')](respondWithFilteredResult(_0x1a8577,_0x1aa699))[_0xa751('0x2b')](handleError(_0x1a8577,null));};exports[_0xa751('0x4d')]=function(_0x394520,_0x47a520){return db[_0xa751('0x21')][_0xa751('0x37')]({'where':{'id':_0x394520[_0xa751('0x2c')]['id']}})[_0xa751('0x1a')](handleEntityNotFound(_0x47a520,null))[_0xa751('0x1a')](function(_0x2b0dbb){if(_0x2b0dbb){return _0x2b0dbb[_0xa751('0x4e')](_0x394520[_0xa751('0x39')]['ids'],_['omit'](_0x394520[_0xa751('0x39')],[_0xa751('0x3d'),'id'])||{})[_0xa751('0x4f')](function(){return db['Tag'][_0xa751('0x27')]({'attributes':['id',_0xa751('0x1e'),'color'],'where':{'id':_0x394520[_0xa751('0x39')][_0xa751('0x3d')]}});})[_0xa751('0x1a')](function(_0x5e6bfc){socket[_0xa751('0x50')]('smsInteractionTags:save',{'id':Number(_0x394520[_0xa751('0x2c')]['id']),'tags':_0x5e6bfc||[]});return{'id':Number(_0x394520[_0xa751('0x2c')]['id']),'tags':_0x5e6bfc||[]};});}})[_0xa751('0x1a')](respondWithResult(_0x47a520,null))[_0xa751('0x2b')](handleError(_0x47a520,null));};exports[_0xa751('0x51')]=function(_0x59f139,_0x5446fc){return db[_0xa751('0x21')][_0xa751('0x37')]({'where':{'id':_0x59f139[_0xa751('0x2c')]['id']}})['then'](handleEntityNotFound(_0x5446fc,null))[_0xa751('0x1a')](function(_0x1ba1ee){if(_0x1ba1ee){return _0x1ba1ee[_0xa751('0x51')](_0x59f139[_0xa751('0x29')][_0xa751('0x3d')]);}})['then'](respondWithStatusCode(_0x5446fc,null))[_0xa751('0x2b')](handleError(_0x5446fc,null));};exports['download']=function(_0x464b67,_0x43b622){var _0xc35c50=moment()[_0xa751('0x52')]()[_0xa751('0x53')]();var _0x468c00=path['join'](config[_0xa751('0x54')],_0xa751('0x55'),_0xa751('0x56'),_0xa751('0x57'));var _0x258749=path['join'](_0x468c00,_0xc35c50);var _0xdb90ee=util[_0xa751('0x4a')](_0xa751('0x58'),_0x464b67['params']['id'],_0xc35c50);var _0x5d8103=path[_0xa751('0x59')](_0x468c00,_0xdb90ee);var _0x146525=[];_0x146525['push']({'model':db[_0xa751('0x5a')],'as':_0xa751('0x5a'),'attributes':['id','fullname'],'raw':!![]});_0x146525[_0xa751('0x5b')]({'model':db[_0xa751('0x5c')],'as':'Contact','attributes':['id','firstName','lastName'],'raw':!![]});var _0x402578=[{'model':db[_0xa751('0x40')],'as':_0xa751('0x5d'),'attributes':['id',_0xa751('0x39'),'createdAt','direction',_0xa751('0x5e'),_0xa751('0x5f')],'include':_0x146525}];_0x402578[_0xa751('0x5b')]({'model':db[_0xa751('0x60')],'as':_0xa751('0x61'),'attributes':['id',_0xa751('0x1e')]});_0x402578[_0xa751('0x5b')]({'model':db[_0xa751('0x5a')],'as':'Owner','attributes':['id',_0xa751('0x62')]});return db[_0xa751('0x21')][_0xa751('0x37')]({'where':{'id':_0x464b67[_0xa751('0x2c')]['id']},'include':_0x402578})[_0xa751('0x1a')](handleEntityNotFound(_0x43b622,null))[_0xa751('0x1a')](function(_0x24122a){if(_0x24122a){var _0x1d6489=_0x24122a[_0xa751('0x63')]({'plain':!![]});fs[_0xa751('0x64')](_0x258749);var _0x422a00={'channel':_0xa751('0x65'),'account':_0x1d6489['Account'][_0xa751('0x1e')],'agent':_0x1d6489[_0xa751('0x66')]?_0x1d6489['Owner'][_0xa751('0x62')]:_0xa751('0x67'),'createdAt':moment(_0x1d6489[_0xa751('0x68')])[_0xa751('0x4a')](_0xa751('0x4b'))[_0xa751('0x53')](),'closedAt':_0x1d6489['closed']?moment(_0x1d6489[_0xa751('0x69')])[_0xa751('0x4a')](_0xa751('0x4b'))[_0xa751('0x53')]():'','disposition':_0x1d6489[_0xa751('0x6a')],'messages':_(_0x1d6489['Messages'])[_0xa751('0x47')]({'secret':![]})[_0xa751('0x20')](function(_0x3c6291){return{'date':moment(_0x3c6291[_0xa751('0x68')])['format'](_0xa751('0x4b'))[_0xa751('0x53')](),'sender':_0x3c6291['direction']==='out'?_0x3c6291[_0xa751('0x5a')]?_0x3c6291[_0xa751('0x5a')][_0xa751('0x62')]:_0xa751('0x6b'):_0x3c6291[_0xa751('0x6c')][_0xa751('0x6d')]+(_0x3c6291[_0xa751('0x6c')]['lastName']?'\x20'+_0x3c6291[_0xa751('0x6c')]['lastName']:''),'body':_0x3c6291['body'],'direction':_0x3c6291['direction']===_0xa751('0x6e')?'A':'C','secret':_0x3c6291['secret'],'read':_0x3c6291[_0xa751('0x5f')]};})['value']()};return ejs[_0xa751('0x6f')](path[_0xa751('0x59')](config['root'],_0xa751('0x55'),'views',_0xa751('0x70')),{'interaction':_0x422a00})[_0xa751('0x1a')](function(_0x4b1bca){var _0x4a7eda=path[_0xa751('0x59')](_0x258749,_0xa751('0x71')+_0x1d6489['id']+'-'+_0xc35c50+_0xa751('0x72'));var _0x3a0768={'path':_0x4a7eda,'channel':_0xa751('0x65'),'interactionId':_0x1d6489['id']};return pdf['createPdfFromHTML'](_0x4b1bca,_0x3a0768);})['then'](function(){return new BPromise(function(_0x5459ce,_0x4a8bdf){zipdir(_0x258749,{'saveTo':_0x5d8103},function(_0x1c14c7,_0x575542){if(_0x1c14c7)return _0x4a8bdf(_0x1c14c7);return _0x5459ce(_0x575542);});})[_0xa751('0x1a')](function(){return new BPromise(function(_0x46734f,_0x5dbc62){rimraf(_0x258749,function(_0x40d7a7){if(_0x40d7a7)_0x5dbc62(_0x40d7a7);return _0x46734f();});});})['then'](function(){return _0x43b622[_0xa751('0x73')](_0x5d8103,_0xdb90ee,function(_0x47fe6b){if(_0x47fe6b){console[_0xa751('0x74')](_0xa751('0x75'),_0x47fe6b);}else{fs[_0xa751('0x76')](_0x5d8103);}});});});}else{return _0x43b622[_0xa751('0x1c')](0xc8);}})[_0xa751('0x2b')](handleError(_0x43b622,null));}; \ No newline at end of file +var _0x4196=['ids','omit','getMessages','findOne','SmsMessage','hasOwnProperty','order','sort','where','pick','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','count','addTags','setTags','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','root','tmp','join','push','User','CmContact','Contact','lastName','createdAt','direction','secret','read','SmsAccount','Account','fullname','get','mkdirSync','Sms','Owner','N.A.','closed','closedAt','disposition','Messages','out','System','firstName','value','server','views','downloadInteraction.ejs','createPdfFromHTML','log','rimraf','zip-dir','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','key','findAll','sms','query','params','keys','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','create','body','catch','describe','addMessage'];(function(_0xbdf67b,_0x4fb55e){var _0x2dd938=function(_0x32e2f8){while(--_0x32e2f8){_0xbdf67b['push'](_0xbdf67b['shift']());}};_0x2dd938(++_0x4fb55e);}(_0x4196,0xb6));var _0x6419=function(_0x22023e,_0x252931){_0x22023e=_0x22023e-0x0;var _0x47ce9b=_0x4196[_0x22023e];return _0x47ce9b;};'use strict';var rimraf=require(_0x6419('0x0'));var zipdir=require(_0x6419('0x1'));var moment=require('moment');var BPromise=require(_0x6419('0x2'));var util=require(_0x6419('0x3'));var path=require(_0x6419('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6419('0x5'));var Redis=require(_0x6419('0x6'));var interaction=require(_0x6419('0x7'));var qs=require(_0x6419('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0x6419('0x9'))(_0x6419('0xa'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x6419('0xb')]=_[_0x6419('0xc')](config[_0x6419('0xb')],{'host':_0x6419('0xd'),'port':0x18eb});var socket=require(_0x6419('0xe'))(new Redis(config[_0x6419('0xb')]));require(_0x6419('0xf'))['register'](socket);function respondWithStatusCode(_0x2339b1,_0x6d55d8){_0x6d55d8=_0x6d55d8||0xcc;return function(_0x2e1fea){if(_0x2e1fea){return _0x2339b1[_0x6419('0x10')](_0x6d55d8);}return _0x2339b1[_0x6419('0x11')](_0x6d55d8)[_0x6419('0x12')]();};}function respondWithResult(_0xe3f708,_0x48c830){_0x48c830=_0x48c830||0xc8;return function(_0x4616da){if(_0x4616da){return _0xe3f708[_0x6419('0x11')](_0x48c830)[_0x6419('0x13')](_0x4616da);}};}function respondWithFilteredResult(_0x5916ba,_0x4023c6){return function(_0x532d6f){if(_0x532d6f){var _0x3c1d65=typeof _0x4023c6[_0x6419('0x14')]===_0x6419('0x15')&&typeof _0x4023c6['limit']===_0x6419('0x15');var _0x1ef784=_0x532d6f['count'];var _0x14b731=_0x3c1d65?0x0:_0x4023c6['offset'];var _0x3481fc=_0x3c1d65?_0x532d6f['count']:_0x4023c6[_0x6419('0x14')]+_0x4023c6[_0x6419('0x16')];var _0x24e6f6;if(_0x3481fc>=_0x1ef784){_0x3481fc=_0x1ef784;_0x24e6f6=0xc8;}else{_0x24e6f6=0xce;}_0x5916ba[_0x6419('0x11')](_0x24e6f6);return _0x5916ba[_0x6419('0x17')](_0x6419('0x18'),_0x14b731+'-'+_0x3481fc+'/'+_0x1ef784)[_0x6419('0x13')](_0x532d6f);}return null;};}function saveUpdates(_0x9c3d81){return function(_0x2c3110){if(_0x2c3110){return _0x2c3110[_0x6419('0x19')](_0x9c3d81)[_0x6419('0x1a')](function(_0x5af81e){return _0x5af81e;});}return null;};}function removeEntity(_0x13fc3d){return function(_0x14630c){if(_0x14630c){return _0x14630c[_0x6419('0x1b')]()[_0x6419('0x1a')](function(){_0x13fc3d[_0x6419('0x11')](0xcc)[_0x6419('0x12')]();});}};}function handleEntityNotFound(_0x355943){return function(_0x3bd2c7){if(!_0x3bd2c7){_0x355943[_0x6419('0x10')](0x194);}return _0x3bd2c7;};}function handleError(_0x4fe8f8,_0x31520a){_0x31520a=_0x31520a||0x1f4;return function(_0x6728d4){logger[_0x6419('0x1c')](_0x6728d4[_0x6419('0x1d')]);if(_0x6728d4[_0x6419('0x1e')]){delete _0x6728d4[_0x6419('0x1e')];}_0x4fe8f8['status'](_0x31520a)[_0x6419('0x1f')](_0x6728d4);};}exports[_0x6419('0x20')]=function(_0x2384ac,_0xdee6cf){var _0xa6957={};var _0x5c187b=_[_0x6419('0x21')](db[_0x6419('0x22')][_0x6419('0x23')],function(_0x3309b3){return{'name':_0x3309b3[_0x6419('0x24')],'type':_0x3309b3[_0x6419('0x25')][_0x6419('0x26')]};});_0xa6957=qs['getOptions'](_0x5c187b,_0x2384ac);return interaction[_0x6419('0x27')](_0x6419('0x28'),_0x2384ac[_0x6419('0x29')],_0x2384ac['user'],_0xa6957,_0x5c187b)[_0x6419('0x1a')](respondWithFilteredResult(_0xdee6cf,_0xa6957))['catch'](handleError(_0xdee6cf,null));};exports['show']=function(_0x3a1ab3,_0x22fcf5){var _0x2774ef={'raw':![],'where':{'id':_0x3a1ab3[_0x6419('0x2a')]['id']}},_0x2cfd7d={};_0x2cfd7d['model']=_['keys'](db['SmsInteraction'][_0x6419('0x23')]);_0x2cfd7d[_0x6419('0x29')]=_[_0x6419('0x2b')](_0x3a1ab3['query']);_0x2cfd7d[_0x6419('0x2c')]=_[_0x6419('0x2d')](_0x2cfd7d[_0x6419('0x2e')],_0x2cfd7d[_0x6419('0x29')]);_0x2774ef[_0x6419('0x2f')]=_['intersection'](_0x2cfd7d[_0x6419('0x2e')],qs[_0x6419('0x30')](_0x3a1ab3['query']['fields']));_0x2774ef['attributes']=_0x2774ef['attributes'][_0x6419('0x31')]?_0x2774ef[_0x6419('0x2f')]:_0x2cfd7d[_0x6419('0x2e')];if(_0x3a1ab3[_0x6419('0x29')][_0x6419('0x32')]){_0x2774ef[_0x6419('0x33')]=[{'all':!![]}];}_0x2774ef=_[_0x6419('0x34')]({},_0x2774ef,_0x3a1ab3[_0x6419('0x35')]);return db[_0x6419('0x22')][_0x6419('0x36')](_0x2774ef)[_0x6419('0x1a')](handleEntityNotFound(_0x22fcf5,null))[_0x6419('0x1a')](respondWithResult(_0x22fcf5,null))['catch'](handleError(_0x22fcf5,null));};exports[_0x6419('0x37')]=function(_0x267654,_0x1d7a12){return db[_0x6419('0x22')]['create'](_0x267654[_0x6419('0x38')],{})[_0x6419('0x1a')](respondWithResult(_0x1d7a12,0xc9))[_0x6419('0x39')](handleError(_0x1d7a12,null));};exports['update']=function(_0x1be3cb,_0x52668e){if(_0x1be3cb[_0x6419('0x38')]['id']){delete _0x1be3cb[_0x6419('0x38')]['id'];}return db['SmsInteraction'][_0x6419('0x36')]({'where':{'id':_0x1be3cb[_0x6419('0x2a')]['id']}})[_0x6419('0x1a')](handleEntityNotFound(_0x52668e,null))['then'](saveUpdates(_0x1be3cb[_0x6419('0x38')],null))[_0x6419('0x1a')](respondWithResult(_0x52668e,null))[_0x6419('0x39')](handleError(_0x52668e,null));};exports[_0x6419('0x1b')]=function(_0x49aacb,_0x44d5ba){return db[_0x6419('0x22')][_0x6419('0x36')]({'where':{'id':_0x49aacb['params']['id']}})['then'](handleEntityNotFound(_0x44d5ba,null))[_0x6419('0x1a')](removeEntity(_0x44d5ba,null))['catch'](handleError(_0x44d5ba,null));};exports[_0x6419('0x3a')]=function(_0x49905e,_0x1f9c63){return db['SmsInteraction']['describe']()[_0x6419('0x1a')](respondWithResult(_0x1f9c63,null))[_0x6419('0x39')](handleError(_0x1f9c63,null));};exports['addMessage']=function(_0x5ef7c2,_0x4aa1c9){return db['SmsMessage'][_0x6419('0x36')]({'where':{'id':_0x5ef7c2['params']['id']}})[_0x6419('0x1a')](handleEntityNotFound(_0x4aa1c9,null))[_0x6419('0x1a')](function(_0x212941){if(_0x212941){return _0x212941[_0x6419('0x3b')](_0x5ef7c2['body'][_0x6419('0x3c')],_[_0x6419('0x3d')](_0x5ef7c2['body'],[_0x6419('0x3c'),'id'])||{});}})[_0x6419('0x1a')](respondWithResult(_0x4aa1c9,null))[_0x6419('0x39')](handleError(_0x4aa1c9,null));};exports[_0x6419('0x3e')]=function(_0x331a7c,_0x4d1a64){var _0x34c0ee={'raw':![],'where':{}};var _0x268bcf={};var _0x44fb0a={'count':0x0,'rows':[]};return db[_0x6419('0x22')][_0x6419('0x3f')]({'where':{'id':_0x331a7c[_0x6419('0x2a')]['id']}})['then'](handleEntityNotFound(_0x4d1a64,null))['then'](function(_0x449568){if(_0x449568){_0x268bcf[_0x6419('0x2e')]=_[_0x6419('0x2b')](db[_0x6419('0x40')]['rawAttributes']);_0x268bcf[_0x6419('0x29')]=_['keys'](_0x331a7c['query']);_0x268bcf[_0x6419('0x2c')]=_[_0x6419('0x2d')](_0x268bcf[_0x6419('0x2e')],_0x268bcf[_0x6419('0x29')]);_0x34c0ee[_0x6419('0x2f')]=_[_0x6419('0x2d')](_0x268bcf[_0x6419('0x2e')],qs[_0x6419('0x30')](_0x331a7c[_0x6419('0x29')][_0x6419('0x30')]));_0x34c0ee[_0x6419('0x2f')]=_0x34c0ee[_0x6419('0x2f')][_0x6419('0x31')]?_0x34c0ee[_0x6419('0x2f')]:_0x268bcf[_0x6419('0x2e')];if(!_0x331a7c['query'][_0x6419('0x41')]('nolimit')){_0x34c0ee[_0x6419('0x16')]=qs['limit'](_0x331a7c['query'][_0x6419('0x16')]);_0x34c0ee[_0x6419('0x14')]=qs[_0x6419('0x14')](_0x331a7c[_0x6419('0x29')][_0x6419('0x14')]);}_0x34c0ee[_0x6419('0x42')]=qs['sort'](_0x331a7c[_0x6419('0x29')][_0x6419('0x43')]);_0x34c0ee[_0x6419('0x44')]=qs['filters'](_[_0x6419('0x45')](_0x331a7c[_0x6419('0x29')],_0x268bcf[_0x6419('0x2c')]));_0x34c0ee[_0x6419('0x44')][_0x6419('0x46')]=_0x449568['id'];if(_0x331a7c[_0x6419('0x29')][_0x6419('0x47')]){_0x34c0ee[_0x6419('0x44')]=_[_0x6419('0x34')](_0x34c0ee[_0x6419('0x44')],{'$or':_[_0x6419('0x21')](_0x34c0ee['attributes'],function(_0x5234ef){var _0x3f1760={};_0x3f1760[_0x5234ef]={'$like':'%'+_0x331a7c[_0x6419('0x29')][_0x6419('0x47')]+'%'};return _0x3f1760;})});}if(_0x331a7c[_0x6419('0x29')][_0x6419('0x48')]){var _0x52c5fb=_0x331a7c[_0x6419('0x29')][_0x6419('0x48')][_0x6419('0x49')](',');var _0x540670={};_0x540670[_0x52c5fb[0x0]]={'$gte':moment(_0x52c5fb[0x1])[_0x6419('0x4a')](_0x6419('0x4b'))};_0x34c0ee[_0x6419('0x44')]=_[_0x6419('0x34')](_0x34c0ee[_0x6419('0x44')],_0x540670);}_0x34c0ee=_[_0x6419('0x34')]({},_0x34c0ee,_0x331a7c[_0x6419('0x35')]);return db[_0x6419('0x40')][_0x6419('0x4c')]({'where':_0x34c0ee['where']})[_0x6419('0x1a')](function(_0x503b0c){_0x44fb0a[_0x6419('0x4c')]=_0x503b0c;if(_0x331a7c[_0x6419('0x29')]['includeAll']){_0x34c0ee[_0x6419('0x33')]=[{'all':!![]}];}return db[_0x6419('0x40')][_0x6419('0x27')](_0x34c0ee);})['then'](function(_0x31f2a3){_0x44fb0a['rows']=_0x31f2a3;return _0x44fb0a;});}})[_0x6419('0x1a')](respondWithFilteredResult(_0x4d1a64,_0x34c0ee))[_0x6419('0x39')](handleError(_0x4d1a64,null));};exports[_0x6419('0x4d')]=function(_0x120a48,_0x3dc182){return db[_0x6419('0x22')][_0x6419('0x36')]({'where':{'id':_0x120a48[_0x6419('0x2a')]['id']}})[_0x6419('0x1a')](handleEntityNotFound(_0x3dc182,null))['then'](function(_0x20a769){if(_0x20a769){return _0x20a769[_0x6419('0x4e')](_0x120a48['body'][_0x6419('0x3c')],_[_0x6419('0x3d')](_0x120a48[_0x6419('0x38')],[_0x6419('0x3c'),'id'])||{})[_0x6419('0x4f')](function(){return db[_0x6419('0x50')][_0x6419('0x27')]({'attributes':['id',_0x6419('0x1e'),_0x6419('0x51')],'where':{'id':_0x120a48[_0x6419('0x38')]['ids']}});})[_0x6419('0x1a')](function(_0x3a1999){socket[_0x6419('0x52')](_0x6419('0x53'),{'id':Number(_0x120a48[_0x6419('0x2a')]['id']),'tags':_0x3a1999||[]});return{'id':Number(_0x120a48[_0x6419('0x2a')]['id']),'tags':_0x3a1999||[]};});}})[_0x6419('0x1a')](respondWithResult(_0x3dc182,null))[_0x6419('0x39')](handleError(_0x3dc182,null));};exports[_0x6419('0x54')]=function(_0x4eb15e,_0x3354f1){return db[_0x6419('0x22')]['find']({'where':{'id':_0x4eb15e[_0x6419('0x2a')]['id']}})[_0x6419('0x1a')](handleEntityNotFound(_0x3354f1,null))[_0x6419('0x1a')](function(_0x410e55){if(_0x410e55){return _0x410e55['removeTags'](_0x4eb15e[_0x6419('0x29')][_0x6419('0x3c')]);}})['then'](respondWithStatusCode(_0x3354f1,null))['catch'](handleError(_0x3354f1,null));};exports[_0x6419('0x55')]=function(_0x26e7f6,_0x370105){var _0x4c75ea=moment()[_0x6419('0x56')]()[_0x6419('0x57')]();var _0x3d07ce=path['join'](config[_0x6419('0x58')],'server','files',_0x6419('0x59'));var _0x4fa89b=path[_0x6419('0x5a')](_0x3d07ce,_0x4c75ea);var _0x1c8cd6=util[_0x6419('0x4a')]('transcript-%d-%s.zip',_0x26e7f6[_0x6419('0x2a')]['id'],_0x4c75ea);var _0x478ba1=path[_0x6419('0x5a')](_0x3d07ce,_0x1c8cd6);var _0x249aa3=[];_0x249aa3[_0x6419('0x5b')]({'model':db[_0x6419('0x5c')],'as':_0x6419('0x5c'),'attributes':['id','fullname'],'raw':!![]});_0x249aa3['push']({'model':db[_0x6419('0x5d')],'as':_0x6419('0x5e'),'attributes':['id','firstName',_0x6419('0x5f')],'raw':!![]});var _0x48e189=[{'model':db[_0x6419('0x40')],'as':'Messages','attributes':['id',_0x6419('0x38'),_0x6419('0x60'),_0x6419('0x61'),_0x6419('0x62'),_0x6419('0x63')],'include':_0x249aa3}];_0x48e189[_0x6419('0x5b')]({'model':db[_0x6419('0x64')],'as':_0x6419('0x65'),'attributes':['id',_0x6419('0x1e')]});_0x48e189[_0x6419('0x5b')]({'model':db[_0x6419('0x5c')],'as':'Owner','attributes':['id',_0x6419('0x66')]});return db[_0x6419('0x22')][_0x6419('0x36')]({'where':{'id':_0x26e7f6[_0x6419('0x2a')]['id']},'include':_0x48e189})['then'](handleEntityNotFound(_0x370105,null))[_0x6419('0x1a')](function(_0x34bd8b){if(_0x34bd8b){var _0x525761=_0x34bd8b[_0x6419('0x67')]({'plain':!![]});fs[_0x6419('0x68')](_0x4fa89b);var _0x2261e0={'channel':_0x6419('0x69'),'account':_0x525761[_0x6419('0x65')][_0x6419('0x1e')],'agent':_0x525761[_0x6419('0x6a')]?_0x525761['Owner'][_0x6419('0x66')]:_0x6419('0x6b'),'createdAt':moment(_0x525761['createdAt'])[_0x6419('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')[_0x6419('0x57')](),'closedAt':_0x525761[_0x6419('0x6c')]?moment(_0x525761[_0x6419('0x6d')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x6419('0x57')]():'','disposition':_0x525761[_0x6419('0x6e')],'messages':_(_0x525761[_0x6419('0x6f')])[_0x6419('0x47')]({'secret':![]})[_0x6419('0x21')](function(_0x17595d){return{'date':moment(_0x17595d[_0x6419('0x60')])[_0x6419('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')[_0x6419('0x57')](),'sender':_0x17595d[_0x6419('0x61')]===_0x6419('0x70')?_0x17595d['User']?_0x17595d[_0x6419('0x5c')][_0x6419('0x66')]:_0x6419('0x71'):_0x17595d[_0x6419('0x5e')][_0x6419('0x72')]+(_0x17595d['Contact'][_0x6419('0x5f')]?'\x20'+_0x17595d[_0x6419('0x5e')][_0x6419('0x5f')]:''),'body':_0x17595d[_0x6419('0x38')],'direction':_0x17595d[_0x6419('0x61')]===_0x6419('0x70')?'A':'C','secret':_0x17595d[_0x6419('0x62')],'read':_0x17595d[_0x6419('0x63')]};})[_0x6419('0x73')]()};return ejs['renderFile'](path[_0x6419('0x5a')](config[_0x6419('0x58')],_0x6419('0x74'),_0x6419('0x75'),_0x6419('0x76')),{'interaction':_0x2261e0})[_0x6419('0x1a')](function(_0x3448dd){var _0x240dea=path[_0x6419('0x5a')](_0x4fa89b,'transcript-'+_0x525761['id']+'-'+_0x4c75ea+'.pdf');var _0x3e0ae0={'path':_0x240dea,'channel':_0x6419('0x69'),'interactionId':_0x525761['id']};return pdf[_0x6419('0x77')](_0x3448dd,_0x3e0ae0);})[_0x6419('0x1a')](function(){return new BPromise(function(_0x535d2b,_0xa4b57b){zipdir(_0x4fa89b,{'saveTo':_0x478ba1},function(_0x145e8,_0x1a6061){if(_0x145e8)return _0xa4b57b(_0x145e8);return _0x535d2b(_0x1a6061);});})['then'](function(){return new BPromise(function(_0x39327c,_0x72cf5a){rimraf(_0x4fa89b,function(_0x5e05c4){if(_0x5e05c4)_0x72cf5a(_0x5e05c4);return _0x39327c();});});})['then'](function(){return _0x370105['download'](_0x478ba1,_0x1c8cd6,function(_0x59757b){if(_0x59757b){console[_0x6419('0x78')]('err',_0x59757b);}else{fs['unlinkSync'](_0x478ba1);}});});});}else{return _0x370105[_0x6419('0x10')](0xc8);}})['catch'](handleError(_0x370105,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index c4cd9e0..13cdb87 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(_0x535e98,_0xce0971){var _0x9d2a28=function(_0x5e6fac){while(--_0x5e6fac){_0x535e98['push'](_0x535e98['shift']());}};_0x9d2a28(++_0xce0971);}(_0x1399,0x16c));var _0x9139=function(_0xdb027c,_0x555595){_0xdb027c=_0xdb027c-0x0;var _0x7b4cf3=_0x1399[_0xdb027c];return _0x7b4cf3;};'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 _0x02ce=['setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','save','update','remove','getUsers','then','Users','map','findAll'];(function(_0x46d1ad,_0x19a4cf){var _0x37d8e3=function(_0x59ad04){while(--_0x59ad04){_0x46d1ad['push'](_0x46d1ad['shift']());}};_0x37d8e3(++_0x19a4cf);}(_0x02ce,0x1ac));var _0xe02c=function(_0x19cee4,_0x3acf3c){_0x19cee4=_0x19cee4-0x0;var _0x5abcfd=_0x02ce[_0x19cee4];return _0x5abcfd;};'use strict';var EventEmitter=require(_0xe02c('0x0'));var SmsInteraction=require(_0xe02c('0x1'))['db'][_0xe02c('0x2')];var SmsMessage=require('../../mysqldb')['db'][_0xe02c('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe02c('0x4'),'afterUpdate':_0xe02c('0x5'),'afterDestroy':_0xe02c('0x6')};function emitEvent(_0xf4b764){return function(_0x41b41c,_0x229653,_0x3f7436){_0x41b41c[_0xe02c('0x7')]({'attributes':['id'],'raw':!![]})[_0xe02c('0x8')](function(_0x4fecb3){_0x41b41c['setDataValue'](_0xe02c('0x9'),_0x4fecb3[_0xe02c('0xa')](function(_0x469932){return{'id':_0x469932['id']};}));return SmsMessage[_0xe02c('0xb')]({'where':{'SmsInteractionId':_0x41b41c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe02c('0x8')](function(_0x18a398){_0x41b41c[_0xe02c('0xc')](_0xe02c('0xd'),_0x18a398[_0xe02c('0xe')]);SmsInteractionEvents[_0xe02c('0xf')](_0xf4b764+':'+_0x41b41c['id'],_0x41b41c);SmsInteractionEvents[_0xe02c('0xf')](_0xf4b764,_0x41b41c);_0x3f7436(null);})[_0xe02c('0x10')](_0x3f7436(null));};}for(var e in events){if(events[_0xe02c('0x11')](e)){var event=events[e];SmsInteraction[_0xe02c('0x12')](e,emitEvent(event));}}module[_0xe02c('0x13')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 1571e48..1be54b0 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 _0xf03b=['exports','SmsInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','bluebird','rimraf','../../config/environment','./smsInteraction.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf03b,0x171));var _0xbf03=function(_0x5e025a,_0x35a5f3){_0x5e025a=_0x5e025a-0x0;var _0x38e4e3=_0xf03b[_0x5e025a];return _0x38e4e3;};'use strict';var _=require(_0xbf03('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbf03('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbf03('0x2'));var config=require(_0xbf03('0x3'));var attributes=require(_0xbf03('0x4'));module[_0xbf03('0x5')]=function(_0x4cb511,_0x29a1e7){return _0x4cb511['define'](_0xbf03('0x6'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2c1a1e,_0x1d90d8,_0x22a77e){if(_0x2c1a1e['changed'](_0xbf03('0x7'))){_0x2c1a1e[_0xbf03('0x8')]=moment()[_0xbf03('0x9')](_0xbf03('0xa'));}_0x22a77e(null,_0x2c1a1e);}}});}; \ No newline at end of file +var _0x33b9=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','sms_interactions','changed'];(function(_0x18ca4e,_0x483b70){var _0x277a8=function(_0x3e1675){while(--_0x3e1675){_0x18ca4e['push'](_0x18ca4e['shift']());}};_0x277a8(++_0x483b70);}(_0x33b9,0x103));var _0x933b=function(_0x28839d,_0x2386ae){_0x28839d=_0x28839d-0x0;var _0xe355e0=_0x33b9[_0x28839d];return _0xe355e0;};'use strict';var _=require('lodash');var util=require(_0x933b('0x0'));var logger=require(_0x933b('0x1'))('api');var moment=require(_0x933b('0x2'));var BPromise=require(_0x933b('0x3'));var rp=require(_0x933b('0x4'));var fs=require('fs');var path=require(_0x933b('0x5'));var rimraf=require(_0x933b('0x6'));var config=require(_0x933b('0x7'));var attributes=require(_0x933b('0x8'));module[_0x933b('0x9')]=function(_0x5bbf9d,_0x27ffcf){return _0x5bbf9d[_0x933b('0xa')]('SmsInteraction',attributes,{'tableName':_0x933b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x43c8c1,_0x4e84e6,_0x11ed14){if(_0x43c8c1[_0x933b('0xc')](_0x933b('0xd'))){_0x43c8c1[_0x933b('0xe')]=moment()[_0x933b('0xf')](_0x933b('0x10'));}_0x11ed14(null,_0x43c8c1);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 72c78b7..6617a18 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 _0x4fde=['http','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','debug','AddTagsToSmsInteraction','find','addTags','ids','omit','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1520bc,_0x41a425){var _0x5994f6=function(_0x29619d){while(--_0x29619d){_0x1520bc['push'](_0x1520bc['shift']());}};_0x5994f6(++_0x41a425);}(_0x4fde,0xf7));var _0xe4fd=function(_0x2fb87c,_0x2dee49){_0x2fb87c=_0x2fb87c-0x0;var _0x43038b=_0x4fde[_0x2fb87c];return _0x43038b;};'use strict';var _=require('lodash');var util=require(_0xe4fd('0x0'));var moment=require(_0xe4fd('0x1'));var BPromise=require(_0xe4fd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe4fd('0x3'));var db=require(_0xe4fd('0x4'))['db'];var utils=require(_0xe4fd('0x5'));var logger=require(_0xe4fd('0x6'))(_0xe4fd('0x7'));var config=require(_0xe4fd('0x8'));var jayson=require(_0xe4fd('0x9'));var client=jayson[_0xe4fd('0xa')][_0xe4fd('0xb')]({'port':0x232a});config[_0xe4fd('0xc')]=_[_0xe4fd('0xd')](config[_0xe4fd('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xe4fd('0xe'))(new Redis(config['redis']));require(_0xe4fd('0xf'))[_0xe4fd('0x10')](socket);function respondWithRpcPromise(_0x14f42f,_0x30872c,_0x1d218c){return new BPromise(function(_0x31bb13,_0x1d03e9){return client[_0xe4fd('0x11')](_0x14f42f,_0x1d218c)[_0xe4fd('0x12')](function(_0x26a35c){logger[_0xe4fd('0x13')](_0xe4fd('0x14'),_0x30872c,_0xe4fd('0x15'));logger['debug'](_0xe4fd('0x16'),_0x30872c,_0xe4fd('0x15'),JSON[_0xe4fd('0x17')](_0x26a35c));if(_0x26a35c[_0xe4fd('0x18')]){if(_0x26a35c['error'][_0xe4fd('0x19')]===0x1f4){logger[_0xe4fd('0x18')](_0xe4fd('0x14'),_0x30872c,_0x26a35c[_0xe4fd('0x18')]['message']);return _0x1d03e9(_0x26a35c[_0xe4fd('0x18')][_0xe4fd('0x1a')]);}logger[_0xe4fd('0x18')](_0xe4fd('0x14'),_0x30872c,_0x26a35c['error'][_0xe4fd('0x1a')]);return _0x31bb13(_0x26a35c['error']['message']);}else{logger[_0xe4fd('0x13')](_0xe4fd('0x14'),_0x30872c,_0xe4fd('0x15'));_0x31bb13(_0x26a35c['result'][_0xe4fd('0x1a')]);}})[_0xe4fd('0x1b')](function(_0x36fc84){logger['error'](_0xe4fd('0x14'),_0x30872c,_0x36fc84);_0x1d03e9(_0x36fc84);});});}exports[_0xe4fd('0x1c')]=function(_0x1d9885){var _0x225cda=this;return new Promise(function(_0x2c6174,_0x88ec44){return db[_0xe4fd('0x1d')][_0xe4fd('0x1e')](_0x1d9885[_0xe4fd('0x1f')],{'raw':_0x1d9885[_0xe4fd('0x20')]?_0x1d9885[_0xe4fd('0x20')][_0xe4fd('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d9885[_0xe4fd('0x20')]?_0x1d9885[_0xe4fd('0x20')][_0xe4fd('0x22')]||null:null,'attributes':_0x1d9885[_0xe4fd('0x20')]?_0x1d9885['options'][_0xe4fd('0x23')]||null:null,'limit':_0x1d9885[_0xe4fd('0x20')]?_0x1d9885[_0xe4fd('0x20')]['limit']||null:null})[_0xe4fd('0x12')](function(_0x21e6ac){logger[_0xe4fd('0x13')]('UpdateSmsInteraction',_0x1d9885);logger[_0xe4fd('0x24')](_0xe4fd('0x1c'),_0x1d9885,JSON['stringify'](_0x21e6ac));_0x2c6174(_0x21e6ac);})[_0xe4fd('0x1b')](function(_0x1d9f3e){logger[_0xe4fd('0x18')]('UpdateSmsInteraction',_0x1d9f3e['message'],_0x1d9885);_0x88ec44(_0x225cda[_0xe4fd('0x18')](0x1f4,_0x1d9f3e[_0xe4fd('0x1a')]));});});};exports[_0xe4fd('0x25')]=function(_0x2af370){return new Promise(function(_0x128109,_0x269fa7){return db['SmsInteraction'][_0xe4fd('0x26')]({'where':_0x2af370[_0xe4fd('0x20')]?_0x2af370[_0xe4fd('0x20')][_0xe4fd('0x22')]||null:null})[_0xe4fd('0x12')](function(_0x498ac0){if(_0x498ac0){return _0x498ac0[_0xe4fd('0x27')](_0x2af370[_0xe4fd('0x1f')][_0xe4fd('0x28')],_[_0xe4fd('0x29')](_0x2af370[_0xe4fd('0x1f')],[_0xe4fd('0x28'),'id'])||{});}})['spread'](function(_0x22505c){logger[_0xe4fd('0x13')]('AddTags',_0x2af370);logger[_0xe4fd('0x24')](_0xe4fd('0x2a'),_0x2af370,JSON['stringify'](_0x22505c));_0x128109(_0x22505c);})[_0xe4fd('0x1b')](function(_0x2e72e0){logger[_0xe4fd('0x18')]('AddTags',_0x2e72e0[_0xe4fd('0x1a')],_0x2af370);_0x269fa7(_this[_0xe4fd('0x18')](0x1f4,_0x2e72e0[_0xe4fd('0x1a')]));});});}; \ No newline at end of file +var _0x2f8f=['attributes','limit','info','catch','find','addTags','omit','ids','spread','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where'];(function(_0x1d918a,_0x8cd6de){var _0x2f0501=function(_0x275770){while(--_0x275770){_0x1d918a['push'](_0x1d918a['shift']());}};_0x2f0501(++_0x8cd6de);}(_0x2f8f,0x1b8));var _0xf2f8=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x2f8f[_0x363ef8];return _0x148822;};'use strict';var _=require('lodash');var util=require(_0xf2f8('0x0'));var moment=require(_0xf2f8('0x1'));var BPromise=require(_0xf2f8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf2f8('0x3'));var db=require(_0xf2f8('0x4'))['db'];var utils=require(_0xf2f8('0x5'));var logger=require(_0xf2f8('0x6'))(_0xf2f8('0x7'));var config=require(_0xf2f8('0x8'));var jayson=require(_0xf2f8('0x9'));var client=jayson['client'][_0xf2f8('0xa')]({'port':0x232a});config[_0xf2f8('0xb')]=_[_0xf2f8('0xc')](config[_0xf2f8('0xb')],{'host':_0xf2f8('0xd'),'port':0x18eb});var socket=require(_0xf2f8('0xe'))(new Redis(config[_0xf2f8('0xb')]));require(_0xf2f8('0xf'))[_0xf2f8('0x10')](socket);function respondWithRpcPromise(_0x5f27b4,_0x508bc3,_0x2676fe){return new BPromise(function(_0x42db05,_0x258351){return client['request'](_0x5f27b4,_0x2676fe)[_0xf2f8('0x11')](function(_0x5764b4){logger['info'](_0xf2f8('0x12'),_0x508bc3,_0xf2f8('0x13'));logger[_0xf2f8('0x14')](_0xf2f8('0x15'),_0x508bc3,_0xf2f8('0x13'),JSON[_0xf2f8('0x16')](_0x5764b4));if(_0x5764b4[_0xf2f8('0x17')]){if(_0x5764b4[_0xf2f8('0x17')][_0xf2f8('0x18')]===0x1f4){logger[_0xf2f8('0x17')](_0xf2f8('0x12'),_0x508bc3,_0x5764b4[_0xf2f8('0x17')][_0xf2f8('0x19')]);return _0x258351(_0x5764b4[_0xf2f8('0x17')][_0xf2f8('0x19')]);}logger[_0xf2f8('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x508bc3,_0x5764b4[_0xf2f8('0x17')][_0xf2f8('0x19')]);return _0x42db05(_0x5764b4[_0xf2f8('0x17')][_0xf2f8('0x19')]);}else{logger['info'](_0xf2f8('0x12'),_0x508bc3,_0xf2f8('0x13'));_0x42db05(_0x5764b4['result'][_0xf2f8('0x19')]);}})['catch'](function(_0x180198){logger['error'](_0xf2f8('0x12'),_0x508bc3,_0x180198);_0x258351(_0x180198);});});}exports[_0xf2f8('0x1a')]=function(_0x205c61){var _0x1c4c5d=this;return new Promise(function(_0x1f19df,_0xc61110){return db[_0xf2f8('0x1b')][_0xf2f8('0x1c')](_0x205c61[_0xf2f8('0x1d')],{'raw':_0x205c61[_0xf2f8('0x1e')]?_0x205c61[_0xf2f8('0x1e')][_0xf2f8('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x205c61[_0xf2f8('0x1e')]?_0x205c61[_0xf2f8('0x1e')][_0xf2f8('0x20')]||null:null,'attributes':_0x205c61[_0xf2f8('0x1e')]?_0x205c61[_0xf2f8('0x1e')][_0xf2f8('0x21')]||null:null,'limit':_0x205c61[_0xf2f8('0x1e')]?_0x205c61[_0xf2f8('0x1e')][_0xf2f8('0x22')]||null:null})[_0xf2f8('0x11')](function(_0x14bd0c){logger[_0xf2f8('0x23')]('UpdateSmsInteraction',_0x205c61);logger[_0xf2f8('0x14')]('UpdateSmsInteraction',_0x205c61,JSON[_0xf2f8('0x16')](_0x14bd0c));_0x1f19df(_0x14bd0c);})[_0xf2f8('0x24')](function(_0x3e2100){logger[_0xf2f8('0x17')]('UpdateSmsInteraction',_0x3e2100[_0xf2f8('0x19')],_0x205c61);_0xc61110(_0x1c4c5d[_0xf2f8('0x17')](0x1f4,_0x3e2100[_0xf2f8('0x19')]));});});};exports['AddTagsToSmsInteraction']=function(_0x143e82){return new Promise(function(_0x38737a,_0x2c306e){return db[_0xf2f8('0x1b')][_0xf2f8('0x25')]({'where':_0x143e82['options']?_0x143e82[_0xf2f8('0x1e')][_0xf2f8('0x20')]||null:null})[_0xf2f8('0x11')](function(_0x3ebea2){if(_0x3ebea2){return _0x3ebea2[_0xf2f8('0x26')](_0x143e82[_0xf2f8('0x1d')]['ids'],_[_0xf2f8('0x27')](_0x143e82[_0xf2f8('0x1d')],[_0xf2f8('0x28'),'id'])||{});}})[_0xf2f8('0x29')](function(_0x52811f){logger[_0xf2f8('0x23')]('AddTags',_0x143e82);logger['debug']('AddTags',_0x143e82,JSON[_0xf2f8('0x16')](_0x52811f));_0x38737a(_0x52811f);})[_0xf2f8('0x24')](function(_0x39d635){logger[_0xf2f8('0x17')](_0xf2f8('0x2a'),_0x39d635[_0xf2f8('0x19')],_0x143e82);_0x2c306e(_this[_0xf2f8('0x17')](0x1f4,_0x39d635['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index e0be6b2..04ef415 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 _0xd022=['emit','removeListener','register','length','smsInteraction:','./smsInteraction.events','save','remove'];(function(_0xfab565,_0x83a93){var _0x7d0d6e=function(_0x25f493){while(--_0x25f493){_0xfab565['push'](_0xfab565['shift']());}};_0x7d0d6e(++_0x83a93);}(_0xd022,0x12d));var _0x2d02=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xd022[_0x2b7764];return _0x848dcb;};'use strict';var SmsInteractionEvents=require(_0x2d02('0x0'));var events=[_0x2d02('0x1'),_0x2d02('0x2'),'update'];function createListener(_0x528cb2,_0x15f081){return function(_0x547964){_0x15f081[_0x2d02('0x3')](_0x528cb2,_0x547964);};}function removeListener(_0x5a0053,_0x4d58a8){return function(){SmsInteractionEvents[_0x2d02('0x4')](_0x5a0053,_0x4d58a8);};}exports[_0x2d02('0x5')]=function(_0x1fd84a){for(var _0x569dd4=0x0,_0x10bb26=events[_0x2d02('0x6')];_0x569dd4<_0x10bb26;_0x569dd4++){var _0x1d44f0=events[_0x569dd4];var _0x2e501f=createListener(_0x2d02('0x7')+_0x1d44f0,_0x1fd84a);SmsInteractionEvents['on'](_0x1d44f0,_0x2e501f);}}; \ No newline at end of file +var _0xc486=['smsInteraction:','./smsInteraction.events','update','removeListener','register','length'];(function(_0xb833b1,_0x1c3d3f){var _0x1ab87a=function(_0x1c9f6c){while(--_0x1c9f6c){_0xb833b1['push'](_0xb833b1['shift']());}};_0x1ab87a(++_0x1c3d3f);}(_0xc486,0xf1));var _0x6c48=function(_0x3b6d58,_0xb29c70){_0x3b6d58=_0x3b6d58-0x0;var _0x64d7dc=_0xc486[_0x3b6d58];return _0x64d7dc;};'use strict';var SmsInteractionEvents=require(_0x6c48('0x0'));var events=['save','remove',_0x6c48('0x1')];function createListener(_0x2cffba,_0x2b58dc){return function(_0x2391ce){_0x2b58dc['emit'](_0x2cffba,_0x2391ce);};}function removeListener(_0x76572f,_0x43b547){return function(){SmsInteractionEvents[_0x6c48('0x2')](_0x76572f,_0x43b547);};}exports[_0x6c48('0x3')]=function(_0x35b9f3){for(var _0x3084e7=0x0,_0x3f1529=events[_0x6c48('0x4')];_0x3084e7<_0x3f1529;_0x3084e7++){var _0x2b4522=events[_0x3084e7];var _0xb06ac0=createListener(_0x6c48('0x5')+_0x2b4522,_0x35b9f3);SmsInteractionEvents['on'](_0x2b4522,_0xb06ac0);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 9428079..324fafa 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 _0x0641=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','tracked','sms','create','/:id/status','status','put','update','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1a1e21,_0x490c57){var _0x1f49f6=function(_0x7c05b2){while(--_0x7c05b2){_0x1a1e21['push'](_0x1a1e21['shift']());}};_0x1f49f6(++_0x490c57);}(_0x0641,0x1ac));var _0x1064=function(_0x41c8f8,_0x23be4d){_0x41c8f8=_0x41c8f8-0x0;var _0xbc785a=_0x0641[_0x41c8f8];return _0xbc785a;};'use strict';var multer=require(_0x1064('0x0'));var util=require(_0x1064('0x1'));var path=require(_0x1064('0x2'));var timeout=require(_0x1064('0x3'));var express=require('express');var router=express[_0x1064('0x4')]();var fs_extra=require(_0x1064('0x5'));var auth=require(_0x1064('0x6'));var interaction=require(_0x1064('0x7'));var config=require(_0x1064('0x8'));var controller=require('./smsMessage.controller');router[_0x1064('0x9')]('/',auth['isAuthenticated'](),controller[_0x1064('0xa')]);router[_0x1064('0x9')](_0x1064('0xb'),auth[_0x1064('0xc')](),controller[_0x1064('0xd')]);router['get'](_0x1064('0xe'),auth[_0x1064('0xc')](),controller['show']);router['post']('/',auth[_0x1064('0xc')](),interaction[_0x1064('0xf')](_0x1064('0x10'),'smsmessage:create'),controller[_0x1064('0x11')]);router['post'](_0x1064('0x12'),controller[_0x1064('0x13')]);router[_0x1064('0x14')](_0x1064('0xe'),auth[_0x1064('0xc')](),controller[_0x1064('0x15')]);router[_0x1064('0x14')]('/:id/accept',auth['isAuthenticated'](),controller[_0x1064('0x16')]);router[_0x1064('0x14')](_0x1064('0x17'),auth[_0x1064('0xc')](),controller[_0x1064('0x18')]);router['delete']('/:id',auth[_0x1064('0xc')](),controller[_0x1064('0x19')]);module[_0x1064('0x1a')]=router; \ No newline at end of file +var _0x46d9=['get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create','create','status','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsMessage.controller'];(function(_0x402add,_0x39a16d){var _0x25cf28=function(_0x27923a){while(--_0x27923a){_0x402add['push'](_0x402add['shift']());}};_0x25cf28(++_0x39a16d);}(_0x46d9,0x16a));var _0x946d=function(_0x15d608,_0x34ad9e){_0x15d608=_0x15d608-0x0;var _0x330489=_0x46d9[_0x15d608];return _0x330489;};'use strict';var multer=require(_0x946d('0x0'));var util=require(_0x946d('0x1'));var path=require(_0x946d('0x2'));var timeout=require(_0x946d('0x3'));var express=require(_0x946d('0x4'));var router=express[_0x946d('0x5')]();var fs_extra=require(_0x946d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x946d('0x7'));var config=require(_0x946d('0x8'));var controller=require(_0x946d('0x9'));router[_0x946d('0xa')]('/',auth[_0x946d('0xb')](),controller[_0x946d('0xc')]);router[_0x946d('0xa')](_0x946d('0xd'),auth['isAuthenticated'](),controller[_0x946d('0xe')]);router[_0x946d('0xa')](_0x946d('0xf'),auth[_0x946d('0xb')](),controller[_0x946d('0x10')]);router[_0x946d('0x11')]('/',auth[_0x946d('0xb')](),interaction[_0x946d('0x12')](_0x946d('0x13'),_0x946d('0x14')),controller[_0x946d('0x15')]);router['post']('/:id/status',controller[_0x946d('0x16')]);router[_0x946d('0x17')](_0x946d('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x946d('0x17')](_0x946d('0x18'),auth[_0x946d('0xb')](),controller[_0x946d('0x19')]);router[_0x946d('0x17')](_0x946d('0x1a'),auth[_0x946d('0xb')](),controller[_0x946d('0x1b')]);router[_0x946d('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x946d('0x1d')]);module[_0x946d('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 9d93ba7..76566ed 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 _0xa108=['medium','out','STRING','BOOLEAN','sequelize'];(function(_0x31ed8a,_0x1945f8){var _0xf2ca0a=function(_0x4ec979){while(--_0x4ec979){_0x31ed8a['push'](_0x31ed8a['shift']());}};_0xf2ca0a(++_0x1945f8);}(_0xa108,0x130));var _0x8a10=function(_0x2aa291,_0xda03df){_0x2aa291=_0x2aa291-0x0;var _0x2eb822=_0xa108[_0x2aa291];return _0x2eb822;};'use strict';var Sequelize=require(_0x8a10('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x8a10('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x8a10('0x2')),'defaultValue':_0x8a10('0x2'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8a10('0x3')](0xbe)},'phone':{'type':Sequelize[_0x8a10('0x3')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x8a10('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x8a10('0x3')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x5b4a=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0xc41f9d,_0x55aae6){var _0x326701=function(_0xe6c552){while(--_0xe6c552){_0xc41f9d['push'](_0xc41f9d['shift']());}};_0x326701(++_0x55aae6);}(_0x5b4a,0x1d1));var _0xa5b4=function(_0x39aeeb,_0x373b84){_0x39aeeb=_0x39aeeb-0x0;var _0x4f6428=_0x5b4a[_0x39aeeb];return _0x4f6428;};'use strict';var Sequelize=require(_0xa5b4('0x0'));module[_0xa5b4('0x1')]={'body':{'type':Sequelize[_0xa5b4('0x2')](_0xa5b4('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xa5b4('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa5b4('0x5')]('in',_0xa5b4('0x6')),'defaultValue':_0xa5b4('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xa5b4('0x7')]},'secret':{'type':Sequelize[_0xa5b4('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xa5b4('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index ffa097c..391922d 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 _0x7732=['register','jayson/promise','client','http','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','sendStatus','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','SmsMessage','includeAll','findAll','rows','show','params','find','body','describe','sms-interactions','accept','sms','readAt','YYYY-MM-DD\x20HH:mm:ss','user','agent','SmsInteraction','UserId','isNil','read1stAt','format','role','interaction','null','AcceptMessage','acceptMessage','sequelize','QueryTypes','SELECT','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','../../config/logger','reject','get','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','contact','User','fullname','internal','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','delivered','Status','plivio','results','groupName','infobip','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./smsMessage.socket'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x7732,0x7d));var _0x2773=function(_0x4e697a,_0x56a14b){_0x4e697a=_0x4e697a-0x0;var _0x88850c=_0x7732[_0x4e697a];return _0x88850c;};'use strict';var emlformat=require(_0x2773('0x0'));var rimraf=require(_0x2773('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2773('0x2'));var rp=require(_0x2773('0x3'));var moment=require(_0x2773('0x4'));var BPromise=require(_0x2773('0x5'));var Mustache=require(_0x2773('0x6'));var util=require(_0x2773('0x7'));var path=require(_0x2773('0x8'));var sox=require(_0x2773('0x9'));var csv=require('to-csv');var ejs=require(_0x2773('0xa'));var fs=require('fs');var fs_extra=require(_0x2773('0xb'));var _=require('lodash');var squel=require(_0x2773('0xc'));var crypto=require(_0x2773('0xd'));var jsforce=require(_0x2773('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2773('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2773('0x10'));var qs=require(_0x2773('0x11'));var as=require(_0x2773('0x12'));var hardwareService=require(_0x2773('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x2773('0x14'));var config=require(_0x2773('0x15'));var licenseUtil=require(_0x2773('0x16'));var db=require(_0x2773('0x17'))['db'];config['redis']=_[_0x2773('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2773('0x19'))(new Redis(config[_0x2773('0x1a')]));require(_0x2773('0x1b'))[_0x2773('0x1c')](socket);var jayson=require(_0x2773('0x1d'));var client=jayson[_0x2773('0x1e')][_0x2773('0x1f')]({'port':0x232c});var client9002=jayson[_0x2773('0x1e')][_0x2773('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x421c9b,_0x26ce19,_0x25d884,_0x238c9a){return new BPromise(function(_0x50fefe,_0x490719){var _0xa44f8d=_0x238c9a||client;return _0xa44f8d[_0x2773('0x20')](_0x421c9b,_0x25d884)['then'](function(_0x1b450e){logger[_0x2773('0x21')](_0x2773('0x22'),_0x26ce19,_0x2773('0x23'));logger[_0x2773('0x24')](_0x2773('0x25'),_0x26ce19,_0x2773('0x23'),JSON['stringify'](_0x1b450e));if(_0x1b450e[_0x2773('0x26')]){if(_0x1b450e[_0x2773('0x26')][_0x2773('0x27')]===0x1f4){logger[_0x2773('0x26')](_0x2773('0x22'),_0x26ce19,_0x1b450e['error'][_0x2773('0x28')]);return _0x490719(_0x1b450e[_0x2773('0x26')][_0x2773('0x28')]);}logger['error'](_0x2773('0x22'),_0x26ce19,_0x1b450e[_0x2773('0x26')][_0x2773('0x28')]);return _0x50fefe(_0x1b450e['error'][_0x2773('0x28')]);}else{logger['info'](_0x2773('0x22'),_0x26ce19,_0x2773('0x23'));_0x50fefe(_0x1b450e[_0x2773('0x29')]['message']);}})[_0x2773('0x2a')](function(_0x579b20){logger[_0x2773('0x26')](_0x2773('0x22'),_0x26ce19,_0x579b20);_0x490719(_0x579b20);});});}function respondWithStatusCode(_0x3d3283,_0x493ca3){_0x493ca3=_0x493ca3||0xcc;return function(_0xd2ac85){if(_0xd2ac85){return _0x3d3283['sendStatus'](_0x493ca3);}return _0x3d3283[_0x2773('0x2b')](_0x493ca3)['end']();};}function respondWithResult(_0x3aa282,_0x149790){_0x149790=_0x149790||0xc8;return function(_0x211d9c){if(_0x211d9c){return _0x3aa282[_0x2773('0x2b')](_0x149790)[_0x2773('0x2c')](_0x211d9c);}};}function respondWithFilteredResult(_0xe02608,_0x596935){return function(_0x5499a7){if(_0x5499a7){var _0x49d035=typeof _0x596935[_0x2773('0x2d')]===_0x2773('0x2e')&&typeof _0x596935[_0x2773('0x2f')]==='undefined';var _0x428f13=_0x5499a7[_0x2773('0x30')];var _0x286edb=_0x49d035?0x0:_0x596935['offset'];var _0x18c1e6=_0x49d035?_0x5499a7['count']:_0x596935[_0x2773('0x2d')]+_0x596935[_0x2773('0x2f')];var _0x5c8427;if(_0x18c1e6>=_0x428f13){_0x18c1e6=_0x428f13;_0x5c8427=0xc8;}else{_0x5c8427=0xce;}_0xe02608[_0x2773('0x2b')](_0x5c8427);return _0xe02608[_0x2773('0x31')](_0x2773('0x32'),_0x286edb+'-'+_0x18c1e6+'/'+_0x428f13)[_0x2773('0x2c')](_0x5499a7);}return null;};}function patchUpdates(_0xe2a092){return function(_0x206d67){try{jsonpatch[_0x2773('0x33')](_0x206d67,_0xe2a092,!![]);}catch(_0x48d172){return BPromise['reject'](_0x48d172);}return _0x206d67[_0x2773('0x34')]();};}function saveUpdates(_0x165c0e,_0x2c091e){return function(_0x54136c){if(_0x54136c){return _0x54136c[_0x2773('0x35')](_0x165c0e)[_0x2773('0x36')](function(_0x43136d){return _0x43136d;});}return null;};}function removeEntity(_0x2c50e9,_0x26d089){return function(_0x1b183f){if(_0x1b183f){return _0x1b183f[_0x2773('0x37')]()['then'](function(){_0x2c50e9[_0x2773('0x2b')](0xcc)[_0x2773('0x38')]();});}};}function handleEntityNotFound(_0x4f7a84,_0x37e52d){return function(_0x4af1f8){if(!_0x4af1f8){_0x4f7a84[_0x2773('0x39')](0x194);}return _0x4af1f8;};}function handleError(_0x227112,_0x2b375a){_0x2b375a=_0x2b375a||0x1f4;return function(_0x3f6023){logger['error'](_0x3f6023[_0x2773('0x3a')]);if(_0x3f6023[_0x2773('0x3b')]){delete _0x3f6023[_0x2773('0x3b')];}_0x227112[_0x2773('0x2b')](_0x2b375a)[_0x2773('0x3c')](_0x3f6023);};}exports[_0x2773('0x3d')]=function(_0x27ee68,_0x105e8){var _0x2ea479={},_0x3c8051={},_0x16c78a={'count':0x0,'rows':[]};var _0x4c15b1=_['map'](db['SmsMessage'][_0x2773('0x3e')],function(_0x2a00f6){return{'name':_0x2a00f6[_0x2773('0x3f')],'type':_0x2a00f6['type'][_0x2773('0x40')]};});_0x3c8051[_0x2773('0x41')]=_[_0x2773('0x42')](_0x4c15b1,_0x2773('0x3b'));_0x3c8051[_0x2773('0x43')]=_[_0x2773('0x44')](_0x27ee68[_0x2773('0x43')]);_0x3c8051[_0x2773('0x45')]=_[_0x2773('0x46')](_0x3c8051[_0x2773('0x41')],_0x3c8051[_0x2773('0x43')]);_0x2ea479['attributes']=_[_0x2773('0x46')](_0x3c8051[_0x2773('0x41')],qs[_0x2773('0x47')](_0x27ee68['query'][_0x2773('0x47')]));_0x2ea479['attributes']=_0x2ea479[_0x2773('0x48')][_0x2773('0x49')]?_0x2ea479[_0x2773('0x48')]:_0x3c8051[_0x2773('0x41')];if(!_0x27ee68[_0x2773('0x43')][_0x2773('0x4a')](_0x2773('0x4b'))){_0x2ea479[_0x2773('0x2f')]=qs[_0x2773('0x2f')](_0x27ee68[_0x2773('0x43')][_0x2773('0x2f')]);_0x2ea479['offset']=qs[_0x2773('0x2d')](_0x27ee68[_0x2773('0x43')][_0x2773('0x2d')]);}_0x2ea479[_0x2773('0x4c')]=qs[_0x2773('0x4d')](_0x27ee68[_0x2773('0x43')]['sort']);_0x2ea479[_0x2773('0x4e')]=qs[_0x2773('0x45')](_[_0x2773('0x4f')](_0x27ee68[_0x2773('0x43')],_0x3c8051[_0x2773('0x45')]),_0x4c15b1);if(_0x27ee68['query'][_0x2773('0x50')]){_0x2ea479[_0x2773('0x4e')]=_[_0x2773('0x51')](_0x2ea479[_0x2773('0x4e')],{'$or':_[_0x2773('0x42')](_0x4c15b1,function(_0x21b4be){if(_0x21b4be[_0x2773('0x52')]!==_0x2773('0x53')){var _0x493551={};_0x493551[_0x21b4be[_0x2773('0x3b')]]={'$like':'%'+_0x27ee68['query'][_0x2773('0x50')]+'%'};return _0x493551;}})});}_0x2ea479=_[_0x2773('0x51')]({},_0x2ea479,_0x27ee68[_0x2773('0x54')]);var _0x622fa8={'where':_0x2ea479['where']};return db[_0x2773('0x55')]['count'](_0x622fa8)[_0x2773('0x36')](function(_0x71eb83){_0x16c78a['count']=_0x71eb83;if(_0x27ee68[_0x2773('0x43')][_0x2773('0x56')]){_0x2ea479['include']=[{'all':!![]}];}return db[_0x2773('0x55')][_0x2773('0x57')](_0x2ea479);})[_0x2773('0x36')](function(_0x41fdd8){_0x16c78a[_0x2773('0x58')]=_0x41fdd8;return _0x16c78a;})['then'](respondWithFilteredResult(_0x105e8,_0x2ea479))[_0x2773('0x2a')](handleError(_0x105e8,null));};exports[_0x2773('0x59')]=function(_0xc84295,_0x259491){var _0x16fc79={'raw':!![],'where':{'id':_0xc84295[_0x2773('0x5a')]['id']}},_0x865fad={};_0x865fad[_0x2773('0x41')]=_[_0x2773('0x44')](db[_0x2773('0x55')][_0x2773('0x3e')]);_0x865fad[_0x2773('0x43')]=_['keys'](_0xc84295[_0x2773('0x43')]);_0x865fad[_0x2773('0x45')]=_[_0x2773('0x46')](_0x865fad[_0x2773('0x41')],_0x865fad[_0x2773('0x43')]);_0x16fc79[_0x2773('0x48')]=_[_0x2773('0x46')](_0x865fad[_0x2773('0x41')],qs[_0x2773('0x47')](_0xc84295[_0x2773('0x43')][_0x2773('0x47')]));_0x16fc79[_0x2773('0x48')]=_0x16fc79[_0x2773('0x48')][_0x2773('0x49')]?_0x16fc79['attributes']:_0x865fad[_0x2773('0x41')];if(_0xc84295['query'][_0x2773('0x56')]){_0x16fc79['include']=[{'all':!![]}];}_0x16fc79=_[_0x2773('0x51')]({},_0x16fc79,_0xc84295['options']);return db[_0x2773('0x55')][_0x2773('0x5b')](_0x16fc79)['then'](handleEntityNotFound(_0x259491,null))[_0x2773('0x36')](respondWithResult(_0x259491,null))[_0x2773('0x2a')](handleError(_0x259491,null));};exports['create']=function(_0x3d8c2d,_0x5e4da9){return db[_0x2773('0x55')]['create'](_0x3d8c2d[_0x2773('0x5c')],{})[_0x2773('0x36')](respondWithResult(_0x5e4da9,0xc9))[_0x2773('0x2a')](handleError(_0x5e4da9,null));};exports[_0x2773('0x35')]=function(_0x58a634,_0x3150f7){if(_0x58a634[_0x2773('0x5c')]['id']){delete _0x58a634[_0x2773('0x5c')]['id'];}return db[_0x2773('0x55')][_0x2773('0x5b')]({'where':{'id':_0x58a634[_0x2773('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3150f7,null))[_0x2773('0x36')](saveUpdates(_0x58a634[_0x2773('0x5c')],null))[_0x2773('0x36')](respondWithResult(_0x3150f7,null))['catch'](handleError(_0x3150f7,null));};exports[_0x2773('0x37')]=function(_0x3c5a38,_0x57a0d0){return db[_0x2773('0x55')]['find']({'where':{'id':_0x3c5a38[_0x2773('0x5a')]['id']}})[_0x2773('0x36')](handleEntityNotFound(_0x57a0d0,null))['then'](removeEntity(_0x57a0d0,null))[_0x2773('0x2a')](handleError(_0x57a0d0,null));};exports[_0x2773('0x5d')]=function(_0x109384,_0x408adf){return db[_0x2773('0x55')]['describe']()[_0x2773('0x36')](respondWithResult(_0x408adf,null))[_0x2773('0x2a')](handleError(_0x408adf,null));};var interaction_log=require('../../config/logger')(_0x2773('0x5e'));exports[_0x2773('0x5f')]=function(_0x3cfcdb,_0x4b2641,_0x16ef40){var _0x510743={'agent':{},'channel':_0x2773('0x60')};if(_0x3cfcdb[_0x2773('0x5c')]['id']){delete _0x3cfcdb[_0x2773('0x5c')]['id'];}_0x3cfcdb['body']['read']=!![];_0x3cfcdb[_0x2773('0x5c')][_0x2773('0x61')]=moment()['format'](_0x2773('0x62'));_0x3cfcdb[_0x2773('0x5c')]['UserId']=_0x3cfcdb['body']['UserId']||_0x3cfcdb[_0x2773('0x63')]['id'];_0x510743[_0x2773('0x64')]['id']=_0x3cfcdb['body']['UserId'];return db[_0x2773('0x55')][_0x2773('0x5b')]({'where':{'id':_0x3cfcdb[_0x2773('0x5a')]['id'],'UserId':null}})[_0x2773('0x36')](handleEntityNotFound(_0x4b2641,null))[_0x2773('0x36')](saveUpdates(_0x3cfcdb[_0x2773('0x5c')],null))['then'](function(_0x15c06b){if(_0x15c06b){_0x510743[_0x2773('0x28')]=_0x15c06b['get']({'plain':!![]});return db[_0x2773('0x65')]['find']({'where':{'id':_0x15c06b['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4b2641,null))[_0x2773('0x36')](function(_0x315666){if(_0x315666){return _0x315666[_0x2773('0x35')]({'UserId':_0x3cfcdb[_0x2773('0x5c')][_0x2773('0x66')],'read1stAt':_[_0x2773('0x67')](_0x315666[_0x2773('0x68')])?moment()[_0x2773('0x69')](_0x2773('0x62')):undefined});}return null;})[_0x2773('0x36')](function(_0x2c10dd){if(_0x2c10dd){_0x510743['interaction']=_0x2c10dd['get']({'plain':!![]});interaction_log[_0x2773('0x21')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3cfcdb[_0x2773('0x63')]['id'],_0x3cfcdb[_0x2773('0x63')][_0x2773('0x3b')],_0x3cfcdb[_0x2773('0x63')][_0x2773('0x6a')],_0x510743[_0x2773('0x6b')]['id'],_0x3cfcdb[_0x2773('0x5c')]?JSON['stringify'](_0x3cfcdb[_0x2773('0x5c')]):_0x2773('0x6c'));return respondWithRpcPromise(_0x2773('0x6d'),_0x2773('0x6e'),_0x510743);}return null;})[_0x2773('0x36')](function(_0x19072e){var _0x42e8a3='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x19072e[_0x2773('0x28')]['ContactId'];return db[_0x2773('0x6f')]['query'](_0x42e8a3,{'type':db['Sequelize'][_0x2773('0x70')][_0x2773('0x71')],'raw':!![]})[_0x2773('0x36')](function(_0x54835e){return _0x54835e;});})[_0x2773('0x36')](function(_0x4a314f){if(_0x4a314f){_0x510743[_0x2773('0x28')]['contact']=_0x4a314f[0x0];if(!_0x3cfcdb[_0x2773('0x5c')][_0x2773('0x66')])return;return db['User'][_0x2773('0x5b')]({'where':{'id':_0x3cfcdb[_0x2773('0x5c')][_0x2773('0x66')],'role':'agent'},'attributes':['id',_0x2773('0x3b'),'fullname',_0x2773('0x72'),'internal'],'raw':!![]});}return null;})[_0x2773('0x36')](function(_0x3c7e76){if(!_0x3c7e76)return null;_0x510743['message'][_0x2773('0x64')]=_0x3c7e76;return _0x510743;})['then'](function(_0x54b7be){if(_0x54b7be){if(_0x3cfcdb[_0x2773('0x5c')][_0x2773('0x73')]){_0x510743[_0x2773('0x28')][_0x2773('0x74')]=util[_0x2773('0x69')](_0x2773('0x75'),_0x3cfcdb['user'][_0x2773('0x3b')]);_0x510743[_0x2773('0x28')][_0x2773('0x76')]=_0x510743[_0x2773('0x76')];_0x510743[_0x2773('0x28')][_0x2773('0x77')]=_0x510743[_0x2773('0x76')];_0x510743[_0x2773('0x28')][_0x2773('0x78')]=_0x2773('0x5f');return respondWithRpcPromise('EventManager',_0x2773('0x79'),{'event':_0x2773('0x7a'),'message':_0x510743[_0x2773('0x28')]},client9002)['then'](function(){return _0x510743;});}return _0x510743;}return null;})[_0x2773('0x36')](respondWithResult(_0x4b2641,null))[_0x2773('0x2a')](handleError(_0x4b2641,null));};var interaction_log=require(_0x2773('0x7b'))(_0x2773('0x5e'));exports[_0x2773('0x7c')]=function(_0x29bb0a,_0xdf4b04,_0x59c225){var _0x5829ca={'agent':{},'channel':'sms'};if(_0x29bb0a[_0x2773('0x5c')]['id']){delete _0x29bb0a['body']['id'];}_0x29bb0a[_0x2773('0x5c')][_0x2773('0x66')]=_0x29bb0a[_0x2773('0x5c')][_0x2773('0x66')]||_0x29bb0a[_0x2773('0x63')]['id'];_0x5829ca[_0x2773('0x64')]['id']=_0x29bb0a['body'][_0x2773('0x66')];return db[_0x2773('0x55')][_0x2773('0x5b')]({'where':{'id':_0x29bb0a['params']['id'],'UserId':null}})[_0x2773('0x36')](handleEntityNotFound(_0xdf4b04,null))[_0x2773('0x36')](function(_0x222ff8){if(_0x222ff8){_0x5829ca[_0x2773('0x28')]=_0x222ff8[_0x2773('0x7d')]({'plain':!![]});return db[_0x2773('0x65')][_0x2773('0x5b')]({'where':{'id':_0x222ff8[_0x2773('0x7e')]}});}return null;})[_0x2773('0x36')](handleEntityNotFound(_0xdf4b04,null))[_0x2773('0x36')](function(_0x18b166){if(_0x18b166){_0x5829ca['interaction']=_0x18b166['get']({'plain':!![]});interaction_log[_0x2773('0x21')](_0x2773('0x7f'),_0x29bb0a[_0x2773('0x63')]['id'],_0x29bb0a[_0x2773('0x63')][_0x2773('0x3b')],_0x29bb0a[_0x2773('0x63')][_0x2773('0x6a')],_0x5829ca[_0x2773('0x6b')]['id'],_0x29bb0a[_0x2773('0x5c')]?JSON[_0x2773('0x80')](_0x29bb0a[_0x2773('0x5c')]):_0x2773('0x6c'));return respondWithRpcPromise('RejectMessage',_0x2773('0x81'),_0x5829ca);}return null;})[_0x2773('0x36')](function(_0x416bd7){var _0xf57cdb=_0x2773('0x82')+_0x416bd7[_0x2773('0x28')][_0x2773('0x83')];return db[_0x2773('0x6f')][_0x2773('0x43')](_0xf57cdb,{'type':db[_0x2773('0x84')]['QueryTypes'][_0x2773('0x71')],'raw':!![]})['then'](function(_0x1d427f){return _0x1d427f;});})[_0x2773('0x36')](function(_0x16eeba){if(_0x16eeba){_0x5829ca[_0x2773('0x28')][_0x2773('0x85')]=_0x16eeba[0x0];if(!_0x29bb0a[_0x2773('0x5c')][_0x2773('0x66')])return;return db[_0x2773('0x86')]['find']({'where':{'id':_0x29bb0a['body'][_0x2773('0x66')],'role':_0x2773('0x64')},'attributes':['id','name',_0x2773('0x87'),'email',_0x2773('0x88')],'raw':!![]});}return null;})[_0x2773('0x36')](function(_0x962729){if(!_0x962729)return null;_0x5829ca[_0x2773('0x28')][_0x2773('0x64')]=_0x962729;return _0x5829ca;})[_0x2773('0x36')](function(_0x3fff6f){if(_0x3fff6f){_0x3fff6f['message'][_0x2773('0x74')]=util[_0x2773('0x69')](_0x2773('0x75'),_0x29bb0a[_0x2773('0x63')][_0x2773('0x3b')]);_0x3fff6f[_0x2773('0x28')][_0x2773('0x76')]=_0x5829ca[_0x2773('0x76')];_0x3fff6f[_0x2773('0x28')]['motionChannel']=_0x5829ca['channel'];_0x3fff6f['message'][_0x2773('0x78')]='reject';respondWithRpcPromise(_0x2773('0x79'),'EventManager',{'event':'rejectmessage','message':_0x3fff6f[_0x2773('0x28')]},client9002);return _0x5829ca;}return null;})[_0x2773('0x36')](respondWithResult(_0xdf4b04,null))[_0x2773('0x2a')](handleError(_0xdf4b04,null));};exports[_0x2773('0x2b')]=function(_0x45ad74,_0xa6f2d5,_0x1fecbb){if(_0x45ad74[_0x2773('0x5c')]['id']){delete _0x45ad74[_0x2773('0x5c')]['id'];}var _0x14f525;return db['SmsMessage'][_0x2773('0x5b')]({'where':{'id':_0x45ad74[_0x2773('0x5a')]['id']}})['then'](handleEntityNotFound(_0xa6f2d5,null))['then'](function(_0x3323f1){if(_0x3323f1){_0x14f525=_0x3323f1;return db[_0x2773('0x89')][_0x2773('0x5b')]({'where':{'id':_0x3323f1[_0x2773('0x8a')]}});}})[_0x2773('0x36')](handleEntityNotFound(_0xa6f2d5,null))[_0x2773('0x36')](function(_0x36d317){if(_0x36d317){logger['debug'](_0x2773('0x25'),_0x2773('0x2b'),_0x2773('0x8b'),_0x36d317[_0x2773('0x52')],util[_0x2773('0x8c')](_0x45ad74[_0x2773('0x5c')],{'showHidden':![],'depth':null}));switch(_0x36d317[_0x2773('0x52')]){case _0x2773('0x8d'):if(_0x45ad74['body'][_0x2773('0x8e')]&&_0x45ad74[_0x2773('0x5c')][_0x2773('0x8e')]===_0x14f525[_0x2773('0x8f')]){return _0x14f525['update']({'read':!![]});}else{logger['error'](_0x2773('0x90'),_0x2773('0x2b'),_0x2773('0x8d'),util['inspect'](_0x45ad74[_0x2773('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x2773('0x91'):if(_0x45ad74[_0x2773('0x5c')][_0x2773('0x92')]&&_0x45ad74[_0x2773('0x5c')][_0x2773('0x92')]===_0x14f525['messageId']&&_['indexOf'](['sent',_0x2773('0x93')],_0x45ad74[_0x2773('0x5c')][_0x2773('0x94')])>=0x0){return _0x14f525['update']({'read':!![]});}else{logger[_0x2773('0x26')](_0x2773('0x90'),_0x2773('0x2b'),_0x2773('0x95'),util[_0x2773('0x8c')](_0x45ad74[_0x2773('0x5c')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x2d8bea=_0x45ad74['body'][_0x2773('0x96')][0x0];if(_0x2d8bea[_0x2773('0x2b')][_0x2773('0x97')]==='DELIVERED'){return _0x14f525[_0x2773('0x35')]({'read':!![]});}else{logger[_0x2773('0x26')](_0x2773('0x90'),'status',_0x2773('0x98'),util[_0x2773('0x8c')](_0x45ad74[_0x2773('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x14f525;}})[_0x2773('0x36')](respondWithResult(_0xa6f2d5,null))[_0x2773('0x2a')](handleError(_0xa6f2d5,null));}; \ No newline at end of file +var _0xbc95=['reject','save','update','destroy','stack','name','send','index','map','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','SmsMessage','includeAll','include','findAll','params','find','create','body','describe','sms-interactions','accept','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','SmsInteraction','SmsInteractionId','isNil','read1stAt','format','interaction','get','null','AcceptMessage','ContactId','Sequelize','contact','User','agent','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','QueryTypes','SELECT','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','messageId','indexOf','sent','Status','inspect','infobip','groupName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','fs-extra','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','client','http','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range'];(function(_0x1f7ce6,_0x3a0a91){var _0x5b43a1=function(_0x20c166){while(--_0x20c166){_0x1f7ce6['push'](_0x1f7ce6['shift']());}};_0x5b43a1(++_0x3a0a91);}(_0xbc95,0x1f4));var _0x5bc9=function(_0x55456f,_0x3f561a){_0x55456f=_0x55456f-0x0;var _0x34d223=_0xbc95[_0x55456f];return _0x34d223;};'use strict';var emlformat=require(_0x5bc9('0x0'));var rimraf=require(_0x5bc9('0x1'));var zipdir=require(_0x5bc9('0x2'));var jsonpatch=require(_0x5bc9('0x3'));var rp=require(_0x5bc9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5bc9('0x5'));var path=require(_0x5bc9('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5bc9('0x7'));var _=require('lodash');var squel=require(_0x5bc9('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5bc9('0x9'));var toCsv=require(_0x5bc9('0xa'));var querystring=require(_0x5bc9('0xb'));var Papa=require(_0x5bc9('0xc'));var Redis=require(_0x5bc9('0xd'));var authService=require(_0x5bc9('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x5bc9('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5bc9('0x10'));var utils=require('../../config/utils');var config=require(_0x5bc9('0x11'));var licenseUtil=require(_0x5bc9('0x12'));var db=require(_0x5bc9('0x13'))['db'];config[_0x5bc9('0x14')]=_[_0x5bc9('0x15')](config['redis'],{'host':_0x5bc9('0x16'),'port':0x18eb});var socket=require(_0x5bc9('0x17'))(new Redis(config['redis']));require(_0x5bc9('0x18'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x5bc9('0x19')][_0x5bc9('0x1a')]({'port':0x232c});var client9002=jayson[_0x5bc9('0x19')][_0x5bc9('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x443185,_0x33053f,_0x5db036,_0x49e2a2){return new BPromise(function(_0x617dad,_0x2db6af){var _0x59e5f1=_0x49e2a2||client;return _0x59e5f1[_0x5bc9('0x1b')](_0x443185,_0x5db036)[_0x5bc9('0x1c')](function(_0x20e02d){logger['info'](_0x5bc9('0x1d'),_0x33053f,_0x5bc9('0x1e'));logger[_0x5bc9('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x33053f,_0x5bc9('0x1e'),JSON['stringify'](_0x20e02d));if(_0x20e02d[_0x5bc9('0x20')]){if(_0x20e02d[_0x5bc9('0x20')][_0x5bc9('0x21')]===0x1f4){logger[_0x5bc9('0x20')](_0x5bc9('0x1d'),_0x33053f,_0x20e02d['error']['message']);return _0x2db6af(_0x20e02d[_0x5bc9('0x20')][_0x5bc9('0x22')]);}logger[_0x5bc9('0x20')](_0x5bc9('0x1d'),_0x33053f,_0x20e02d[_0x5bc9('0x20')][_0x5bc9('0x22')]);return _0x617dad(_0x20e02d[_0x5bc9('0x20')][_0x5bc9('0x22')]);}else{logger[_0x5bc9('0x23')]('SmsMessage,\x20%s,\x20%s',_0x33053f,_0x5bc9('0x1e'));_0x617dad(_0x20e02d[_0x5bc9('0x24')][_0x5bc9('0x22')]);}})[_0x5bc9('0x25')](function(_0x4f6e4b){logger[_0x5bc9('0x20')]('SmsMessage,\x20%s,\x20%s',_0x33053f,_0x4f6e4b);_0x2db6af(_0x4f6e4b);});});}function respondWithStatusCode(_0x358ae1,_0x2a8f25){_0x2a8f25=_0x2a8f25||0xcc;return function(_0x2d0db2){if(_0x2d0db2){return _0x358ae1[_0x5bc9('0x26')](_0x2a8f25);}return _0x358ae1['status'](_0x2a8f25)[_0x5bc9('0x27')]();};}function respondWithResult(_0x5b5cbc,_0x4cb942){_0x4cb942=_0x4cb942||0xc8;return function(_0x1b64c4){if(_0x1b64c4){return _0x5b5cbc['status'](_0x4cb942)[_0x5bc9('0x28')](_0x1b64c4);}};}function respondWithFilteredResult(_0x49d8a3,_0x5e16a9){return function(_0x347fb0){if(_0x347fb0){var _0x3982e4=typeof _0x5e16a9[_0x5bc9('0x29')]===_0x5bc9('0x2a')&&typeof _0x5e16a9[_0x5bc9('0x2b')]===_0x5bc9('0x2a');var _0x485012=_0x347fb0['count'];var _0x5c41df=_0x3982e4?0x0:_0x5e16a9['offset'];var _0x4003ca=_0x3982e4?_0x347fb0[_0x5bc9('0x2c')]:_0x5e16a9[_0x5bc9('0x29')]+_0x5e16a9[_0x5bc9('0x2b')];var _0x160c60;if(_0x4003ca>=_0x485012){_0x4003ca=_0x485012;_0x160c60=0xc8;}else{_0x160c60=0xce;}_0x49d8a3[_0x5bc9('0x2d')](_0x160c60);return _0x49d8a3[_0x5bc9('0x2e')](_0x5bc9('0x2f'),_0x5c41df+'-'+_0x4003ca+'/'+_0x485012)['json'](_0x347fb0);}return null;};}function patchUpdates(_0x232552){return function(_0x59c5cc){try{jsonpatch['apply'](_0x59c5cc,_0x232552,!![]);}catch(_0x30b048){return BPromise[_0x5bc9('0x30')](_0x30b048);}return _0x59c5cc[_0x5bc9('0x31')]();};}function saveUpdates(_0x5440cc,_0x5ca1a3){return function(_0x5f4a18){if(_0x5f4a18){return _0x5f4a18[_0x5bc9('0x32')](_0x5440cc)[_0x5bc9('0x1c')](function(_0x13c959){return _0x13c959;});}return null;};}function removeEntity(_0x14f047,_0x768ab){return function(_0x4318ba){if(_0x4318ba){return _0x4318ba[_0x5bc9('0x33')]()[_0x5bc9('0x1c')](function(){_0x14f047['status'](0xcc)[_0x5bc9('0x27')]();});}};}function handleEntityNotFound(_0x2af20a,_0x234717){return function(_0x43f827){if(!_0x43f827){_0x2af20a[_0x5bc9('0x26')](0x194);}return _0x43f827;};}function handleError(_0x26a9e8,_0x2f7d19){_0x2f7d19=_0x2f7d19||0x1f4;return function(_0x54d724){logger['error'](_0x54d724[_0x5bc9('0x34')]);if(_0x54d724[_0x5bc9('0x35')]){delete _0x54d724[_0x5bc9('0x35')];}_0x26a9e8[_0x5bc9('0x2d')](_0x2f7d19)[_0x5bc9('0x36')](_0x54d724);};}exports[_0x5bc9('0x37')]=function(_0x447b74,_0x2fa6a9){var _0x36562d={},_0x549813={},_0x1bc264={'count':0x0,'rows':[]};var _0xc2a95b=_[_0x5bc9('0x38')](db['SmsMessage']['rawAttributes'],function(_0xc7f256){return{'name':_0xc7f256[_0x5bc9('0x39')],'type':_0xc7f256[_0x5bc9('0x3a')]['key']};});_0x549813['model']=_[_0x5bc9('0x38')](_0xc2a95b,'name');_0x549813[_0x5bc9('0x3b')]=_[_0x5bc9('0x3c')](_0x447b74['query']);_0x549813[_0x5bc9('0x3d')]=_[_0x5bc9('0x3e')](_0x549813['model'],_0x549813['query']);_0x36562d[_0x5bc9('0x3f')]=_[_0x5bc9('0x3e')](_0x549813[_0x5bc9('0x40')],qs[_0x5bc9('0x41')](_0x447b74[_0x5bc9('0x3b')][_0x5bc9('0x41')]));_0x36562d[_0x5bc9('0x3f')]=_0x36562d['attributes'][_0x5bc9('0x42')]?_0x36562d['attributes']:_0x549813[_0x5bc9('0x40')];if(!_0x447b74['query'][_0x5bc9('0x43')]('nolimit')){_0x36562d['limit']=qs[_0x5bc9('0x2b')](_0x447b74['query'][_0x5bc9('0x2b')]);_0x36562d[_0x5bc9('0x29')]=qs['offset'](_0x447b74[_0x5bc9('0x3b')][_0x5bc9('0x29')]);}_0x36562d['order']=qs[_0x5bc9('0x44')](_0x447b74[_0x5bc9('0x3b')]['sort']);_0x36562d[_0x5bc9('0x45')]=qs[_0x5bc9('0x3d')](_[_0x5bc9('0x46')](_0x447b74[_0x5bc9('0x3b')],_0x549813[_0x5bc9('0x3d')]),_0xc2a95b);if(_0x447b74[_0x5bc9('0x3b')][_0x5bc9('0x47')]){_0x36562d[_0x5bc9('0x45')]=_['merge'](_0x36562d[_0x5bc9('0x45')],{'$or':_[_0x5bc9('0x38')](_0xc2a95b,function(_0x29f69c){if(_0x29f69c[_0x5bc9('0x3a')]!==_0x5bc9('0x48')){var _0x35ae69={};_0x35ae69[_0x29f69c[_0x5bc9('0x35')]]={'$like':'%'+_0x447b74[_0x5bc9('0x3b')][_0x5bc9('0x47')]+'%'};return _0x35ae69;}})});}_0x36562d=_[_0x5bc9('0x49')]({},_0x36562d,_0x447b74[_0x5bc9('0x4a')]);var _0x74e07b={'where':_0x36562d[_0x5bc9('0x45')]};return db[_0x5bc9('0x4b')]['count'](_0x74e07b)[_0x5bc9('0x1c')](function(_0x149d25){_0x1bc264[_0x5bc9('0x2c')]=_0x149d25;if(_0x447b74[_0x5bc9('0x3b')][_0x5bc9('0x4c')]){_0x36562d[_0x5bc9('0x4d')]=[{'all':!![]}];}return db['SmsMessage'][_0x5bc9('0x4e')](_0x36562d);})[_0x5bc9('0x1c')](function(_0x5af48e){_0x1bc264['rows']=_0x5af48e;return _0x1bc264;})[_0x5bc9('0x1c')](respondWithFilteredResult(_0x2fa6a9,_0x36562d))[_0x5bc9('0x25')](handleError(_0x2fa6a9,null));};exports['show']=function(_0x2bfab4,_0x3030b4){var _0x1337bf={'raw':!![],'where':{'id':_0x2bfab4[_0x5bc9('0x4f')]['id']}},_0x42537e={};_0x42537e[_0x5bc9('0x40')]=_[_0x5bc9('0x3c')](db['SmsMessage']['rawAttributes']);_0x42537e[_0x5bc9('0x3b')]=_[_0x5bc9('0x3c')](_0x2bfab4[_0x5bc9('0x3b')]);_0x42537e[_0x5bc9('0x3d')]=_[_0x5bc9('0x3e')](_0x42537e[_0x5bc9('0x40')],_0x42537e['query']);_0x1337bf['attributes']=_['intersection'](_0x42537e[_0x5bc9('0x40')],qs[_0x5bc9('0x41')](_0x2bfab4['query'][_0x5bc9('0x41')]));_0x1337bf[_0x5bc9('0x3f')]=_0x1337bf[_0x5bc9('0x3f')][_0x5bc9('0x42')]?_0x1337bf[_0x5bc9('0x3f')]:_0x42537e[_0x5bc9('0x40')];if(_0x2bfab4[_0x5bc9('0x3b')][_0x5bc9('0x4c')]){_0x1337bf[_0x5bc9('0x4d')]=[{'all':!![]}];}_0x1337bf=_[_0x5bc9('0x49')]({},_0x1337bf,_0x2bfab4[_0x5bc9('0x4a')]);return db[_0x5bc9('0x4b')][_0x5bc9('0x50')](_0x1337bf)['then'](handleEntityNotFound(_0x3030b4,null))[_0x5bc9('0x1c')](respondWithResult(_0x3030b4,null))['catch'](handleError(_0x3030b4,null));};exports['create']=function(_0x4ebd6c,_0x2cd18f){return db['SmsMessage'][_0x5bc9('0x51')](_0x4ebd6c[_0x5bc9('0x52')],{})[_0x5bc9('0x1c')](respondWithResult(_0x2cd18f,0xc9))[_0x5bc9('0x25')](handleError(_0x2cd18f,null));};exports[_0x5bc9('0x32')]=function(_0x907ff,_0x57cba7){if(_0x907ff[_0x5bc9('0x52')]['id']){delete _0x907ff[_0x5bc9('0x52')]['id'];}return db[_0x5bc9('0x4b')][_0x5bc9('0x50')]({'where':{'id':_0x907ff[_0x5bc9('0x4f')]['id']}})[_0x5bc9('0x1c')](handleEntityNotFound(_0x57cba7,null))[_0x5bc9('0x1c')](saveUpdates(_0x907ff[_0x5bc9('0x52')],null))[_0x5bc9('0x1c')](respondWithResult(_0x57cba7,null))[_0x5bc9('0x25')](handleError(_0x57cba7,null));};exports[_0x5bc9('0x33')]=function(_0x2d1812,_0x317284){return db[_0x5bc9('0x4b')][_0x5bc9('0x50')]({'where':{'id':_0x2d1812[_0x5bc9('0x4f')]['id']}})[_0x5bc9('0x1c')](handleEntityNotFound(_0x317284,null))['then'](removeEntity(_0x317284,null))['catch'](handleError(_0x317284,null));};exports[_0x5bc9('0x53')]=function(_0x1bbb2b,_0x334119){return db['SmsMessage'][_0x5bc9('0x53')]()['then'](respondWithResult(_0x334119,null))['catch'](handleError(_0x334119,null));};var interaction_log=require('../../config/logger')(_0x5bc9('0x54'));exports[_0x5bc9('0x55')]=function(_0x46aca6,_0x17b951,_0x5928e6){var _0x2128dd={'agent':{},'channel':'sms'};if(_0x46aca6[_0x5bc9('0x52')]['id']){delete _0x46aca6[_0x5bc9('0x52')]['id'];}_0x46aca6['body'][_0x5bc9('0x56')]=!![];_0x46aca6[_0x5bc9('0x52')]['readAt']=moment()['format'](_0x5bc9('0x57'));_0x46aca6[_0x5bc9('0x52')][_0x5bc9('0x58')]=_0x46aca6[_0x5bc9('0x52')][_0x5bc9('0x58')]||_0x46aca6[_0x5bc9('0x59')]['id'];_0x2128dd['agent']['id']=_0x46aca6[_0x5bc9('0x52')]['UserId'];return db['SmsMessage']['find']({'where':{'id':_0x46aca6[_0x5bc9('0x4f')]['id'],'UserId':null}})[_0x5bc9('0x1c')](handleEntityNotFound(_0x17b951,null))[_0x5bc9('0x1c')](saveUpdates(_0x46aca6['body'],null))['then'](function(_0x2b17b5){if(_0x2b17b5){_0x2128dd[_0x5bc9('0x22')]=_0x2b17b5['get']({'plain':!![]});return db[_0x5bc9('0x5a')][_0x5bc9('0x50')]({'where':{'id':_0x2b17b5[_0x5bc9('0x5b')]}});}return null;})[_0x5bc9('0x1c')](handleEntityNotFound(_0x17b951,null))[_0x5bc9('0x1c')](function(_0xaba68){if(_0xaba68){return _0xaba68[_0x5bc9('0x32')]({'UserId':_0x46aca6[_0x5bc9('0x52')][_0x5bc9('0x58')],'read1stAt':_[_0x5bc9('0x5c')](_0xaba68[_0x5bc9('0x5d')])?moment()[_0x5bc9('0x5e')](_0x5bc9('0x57')):undefined});}return null;})['then'](function(_0x51835e){if(_0x51835e){_0x2128dd[_0x5bc9('0x5f')]=_0x51835e[_0x5bc9('0x60')]({'plain':!![]});interaction_log[_0x5bc9('0x23')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x46aca6[_0x5bc9('0x59')]['id'],_0x46aca6[_0x5bc9('0x59')][_0x5bc9('0x35')],_0x46aca6[_0x5bc9('0x59')]['role'],_0x2128dd[_0x5bc9('0x5f')]['id'],_0x46aca6['body']?JSON['stringify'](_0x46aca6[_0x5bc9('0x52')]):_0x5bc9('0x61'));return respondWithRpcPromise(_0x5bc9('0x62'),'acceptMessage',_0x2128dd);}return null;})['then'](function(_0x58f25b){var _0x81b6d7='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x58f25b[_0x5bc9('0x22')][_0x5bc9('0x63')];return db['sequelize'][_0x5bc9('0x3b')](_0x81b6d7,{'type':db[_0x5bc9('0x64')]['QueryTypes']['SELECT'],'raw':!![]})[_0x5bc9('0x1c')](function(_0x34d818){return _0x34d818;});})[_0x5bc9('0x1c')](function(_0x256fb1){if(_0x256fb1){_0x2128dd['message'][_0x5bc9('0x65')]=_0x256fb1[0x0];if(!_0x46aca6[_0x5bc9('0x52')][_0x5bc9('0x58')])return;return db[_0x5bc9('0x66')][_0x5bc9('0x50')]({'where':{'id':_0x46aca6[_0x5bc9('0x52')][_0x5bc9('0x58')],'role':_0x5bc9('0x67')},'attributes':['id',_0x5bc9('0x35'),_0x5bc9('0x68'),_0x5bc9('0x69'),'internal'],'raw':!![]});}return null;})['then'](function(_0xd53ab0){if(!_0xd53ab0)return null;_0x2128dd[_0x5bc9('0x22')][_0x5bc9('0x67')]=_0xd53ab0;return _0x2128dd;})[_0x5bc9('0x1c')](function(_0x423283){if(_0x423283){if(_0x46aca6['body'][_0x5bc9('0x6a')]){_0x2128dd['message'][_0x5bc9('0x6b')]=util[_0x5bc9('0x5e')](_0x5bc9('0x6c'),_0x46aca6[_0x5bc9('0x59')][_0x5bc9('0x35')]);_0x2128dd[_0x5bc9('0x22')][_0x5bc9('0x6d')]=_0x2128dd[_0x5bc9('0x6d')];_0x2128dd[_0x5bc9('0x22')][_0x5bc9('0x6e')]=_0x2128dd['channel'];_0x2128dd['message'][_0x5bc9('0x6f')]=_0x5bc9('0x55');return respondWithRpcPromise(_0x5bc9('0x70'),_0x5bc9('0x70'),{'event':_0x5bc9('0x71'),'message':_0x2128dd[_0x5bc9('0x22')]},client9002)[_0x5bc9('0x1c')](function(){return _0x2128dd;});}return _0x2128dd;}return null;})[_0x5bc9('0x1c')](respondWithResult(_0x17b951,null))[_0x5bc9('0x25')](handleError(_0x17b951,null));};var interaction_log=require('../../config/logger')(_0x5bc9('0x54'));exports[_0x5bc9('0x30')]=function(_0x4e7286,_0xa7acbf,_0x1baf67){var _0x3d8a9b={'agent':{},'channel':_0x5bc9('0x72')};if(_0x4e7286[_0x5bc9('0x52')]['id']){delete _0x4e7286['body']['id'];}_0x4e7286['body'][_0x5bc9('0x58')]=_0x4e7286[_0x5bc9('0x52')][_0x5bc9('0x58')]||_0x4e7286['user']['id'];_0x3d8a9b[_0x5bc9('0x67')]['id']=_0x4e7286['body'][_0x5bc9('0x58')];return db[_0x5bc9('0x4b')]['find']({'where':{'id':_0x4e7286['params']['id'],'UserId':null}})[_0x5bc9('0x1c')](handleEntityNotFound(_0xa7acbf,null))[_0x5bc9('0x1c')](function(_0x4cce77){if(_0x4cce77){_0x3d8a9b[_0x5bc9('0x22')]=_0x4cce77['get']({'plain':!![]});return db[_0x5bc9('0x5a')]['find']({'where':{'id':_0x4cce77[_0x5bc9('0x5b')]}});}return null;})[_0x5bc9('0x1c')](handleEntityNotFound(_0xa7acbf,null))[_0x5bc9('0x1c')](function(_0x312294){if(_0x312294){_0x3d8a9b['interaction']=_0x312294[_0x5bc9('0x60')]({'plain':!![]});interaction_log[_0x5bc9('0x23')](_0x5bc9('0x73'),_0x4e7286[_0x5bc9('0x59')]['id'],_0x4e7286[_0x5bc9('0x59')][_0x5bc9('0x35')],_0x4e7286[_0x5bc9('0x59')][_0x5bc9('0x74')],_0x3d8a9b[_0x5bc9('0x5f')]['id'],_0x4e7286[_0x5bc9('0x52')]?JSON['stringify'](_0x4e7286[_0x5bc9('0x52')]):'null');return respondWithRpcPromise(_0x5bc9('0x75'),_0x5bc9('0x76'),_0x3d8a9b);}return null;})[_0x5bc9('0x1c')](function(_0x581ab0){var _0x12a20b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x581ab0[_0x5bc9('0x22')][_0x5bc9('0x63')];return db['sequelize'][_0x5bc9('0x3b')](_0x12a20b,{'type':db[_0x5bc9('0x64')][_0x5bc9('0x77')][_0x5bc9('0x78')],'raw':!![]})['then'](function(_0xb1fdb4){return _0xb1fdb4;});})[_0x5bc9('0x1c')](function(_0x164554){if(_0x164554){_0x3d8a9b['message'][_0x5bc9('0x65')]=_0x164554[0x0];if(!_0x4e7286[_0x5bc9('0x52')][_0x5bc9('0x58')])return;return db['User'][_0x5bc9('0x50')]({'where':{'id':_0x4e7286[_0x5bc9('0x52')][_0x5bc9('0x58')],'role':_0x5bc9('0x67')},'attributes':['id','name',_0x5bc9('0x68'),_0x5bc9('0x69'),'internal'],'raw':!![]});}return null;})[_0x5bc9('0x1c')](function(_0x120fc7){if(!_0x120fc7)return null;_0x3d8a9b[_0x5bc9('0x22')]['agent']=_0x120fc7;return _0x3d8a9b;})[_0x5bc9('0x1c')](function(_0x33f3a3){if(_0x33f3a3){_0x33f3a3[_0x5bc9('0x22')][_0x5bc9('0x6b')]=util[_0x5bc9('0x5e')](_0x5bc9('0x6c'),_0x4e7286[_0x5bc9('0x59')]['name']);_0x33f3a3[_0x5bc9('0x22')][_0x5bc9('0x6d')]=_0x3d8a9b[_0x5bc9('0x6d')];_0x33f3a3[_0x5bc9('0x22')]['motionChannel']=_0x3d8a9b[_0x5bc9('0x6d')];_0x33f3a3['message'][_0x5bc9('0x6f')]=_0x5bc9('0x30');respondWithRpcPromise(_0x5bc9('0x70'),_0x5bc9('0x70'),{'event':'rejectmessage','message':_0x33f3a3[_0x5bc9('0x22')]},client9002);return _0x3d8a9b;}return null;})['then'](respondWithResult(_0xa7acbf,null))[_0x5bc9('0x25')](handleError(_0xa7acbf,null));};exports['status']=function(_0x8d22a0,_0x1ee67d,_0x5cf8ea){if(_0x8d22a0[_0x5bc9('0x52')]['id']){delete _0x8d22a0[_0x5bc9('0x52')]['id'];}var _0x7e5ae5;return db[_0x5bc9('0x4b')]['find']({'where':{'id':_0x8d22a0[_0x5bc9('0x4f')]['id']}})[_0x5bc9('0x1c')](handleEntityNotFound(_0x1ee67d,null))[_0x5bc9('0x1c')](function(_0x3bb694){if(_0x3bb694){_0x7e5ae5=_0x3bb694;return db[_0x5bc9('0x79')][_0x5bc9('0x50')]({'where':{'id':_0x3bb694[_0x5bc9('0x7a')]}});}})[_0x5bc9('0x1c')](handleEntityNotFound(_0x1ee67d,null))[_0x5bc9('0x1c')](function(_0x45e671){if(_0x45e671){logger[_0x5bc9('0x1f')](_0x5bc9('0x7b'),_0x5bc9('0x2d'),_0x5bc9('0x7c'),_0x45e671[_0x5bc9('0x3a')],util['inspect'](_0x8d22a0[_0x5bc9('0x52')],{'showHidden':![],'depth':null}));switch(_0x45e671[_0x5bc9('0x3a')]){case _0x5bc9('0x7d'):if(_0x8d22a0[_0x5bc9('0x52')][_0x5bc9('0x7e')]&&_0x8d22a0[_0x5bc9('0x52')][_0x5bc9('0x7e')]===_0x7e5ae5['messageId']){return _0x7e5ae5[_0x5bc9('0x32')]({'read':!![]});}else{logger['error'](_0x5bc9('0x7f'),_0x5bc9('0x2d'),'twilio',util['inspect'](_0x8d22a0[_0x5bc9('0x52')],{'showHidden':![],'depth':null}));}break;case _0x5bc9('0x80'):if(_0x8d22a0[_0x5bc9('0x52')][_0x5bc9('0x81')]&&_0x8d22a0[_0x5bc9('0x52')][_0x5bc9('0x81')]===_0x7e5ae5[_0x5bc9('0x82')]&&_[_0x5bc9('0x83')]([_0x5bc9('0x84'),'delivered'],_0x8d22a0[_0x5bc9('0x52')][_0x5bc9('0x85')])>=0x0){return _0x7e5ae5[_0x5bc9('0x32')]({'read':!![]});}else{logger[_0x5bc9('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5bc9('0x2d'),'plivio',util[_0x5bc9('0x86')](_0x8d22a0['body'],{'showHidden':![],'depth':null}));}break;case _0x5bc9('0x87'):var _0x3fd463=_0x8d22a0['body']['results'][0x0];if(_0x3fd463[_0x5bc9('0x2d')][_0x5bc9('0x88')]==='DELIVERED'){return _0x7e5ae5[_0x5bc9('0x32')]({'read':!![]});}else{logger['error'](_0x5bc9('0x7f'),_0x5bc9('0x2d'),_0x5bc9('0x87'),util[_0x5bc9('0x86')](_0x8d22a0['body'],{'showHidden':![],'depth':null}));}break;}return _0x7e5ae5;}})[_0x5bc9('0x1c')](respondWithResult(_0x1ee67d,null))[_0x5bc9('0x25')](handleError(_0x1ee67d,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index a0aece4..906389b 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 _0x8f0f=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','SmsMessage','save','update'];(function(_0x397bfb,_0x589665){var _0x16c9b9=function(_0x13ce8a){while(--_0x13ce8a){_0x397bfb['push'](_0x397bfb['shift']());}};_0x16c9b9(++_0x589665);}(_0x8f0f,0x1f3));var _0xf8f0=function(_0x25ba50,_0x5d4aa8){_0x25ba50=_0x25ba50-0x0;var _0x169fa8=_0x8f0f[_0x25ba50];return _0x169fa8;};'use strict';var EventEmitter=require(_0xf8f0('0x0'));var SmsMessage=require(_0xf8f0('0x1'))['db'][_0xf8f0('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf8f0('0x3'),'afterUpdate':_0xf8f0('0x4'),'afterDestroy':_0xf8f0('0x5')};function emitEvent(_0x4392b6){return function(_0x36fe86,_0x2c3332,_0x314029){SmsMessageEvents[_0xf8f0('0x6')](_0x4392b6+':'+_0x36fe86['id'],_0x36fe86);SmsMessageEvents['emit'](_0x4392b6,_0x36fe86);_0x314029(null);};}for(var e in events){if(events[_0xf8f0('0x7')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xf8f0('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0xdea9=['remove','emit','exports','../../mysqldb','SmsMessage','setMaxListeners','save','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdea9,0x17b));var _0x9dea=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xdea9[_0x2d7f0e];return _0x110b07;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x9dea('0x0'))['db'][_0x9dea('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x9dea('0x2')](0x0);var events={'afterCreate':_0x9dea('0x3'),'afterUpdate':_0x9dea('0x4'),'afterDestroy':_0x9dea('0x5')};function emitEvent(_0x5ba350){return function(_0x2bcf3c,_0x20692a,_0x484ec5){SmsMessageEvents['emit'](_0x5ba350+':'+_0x2bcf3c['id'],_0x2bcf3c);SmsMessageEvents[_0x9dea('0x6')](_0x5ba350,_0x2bcf3c);_0x484ec5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x9dea('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index b95de46..8313fdf 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 _0x7b7c=['utf8mb4_unicode_ci','lodash','util','moment','path','rimraf','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','UserId','isNil','SmsInteractionId','findOne','update','catch','SmsAccount','find','SmsAccountId','then','twilio','accountSid','authToken','create','phone','/api/sms/messages/','token','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','error','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','username','smsMethod','sender','&password=','password','GET','sms','user_key','session_key','total_sent','internal_order_id','read','skebby','connectel','POST','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','clicksend','xCALLY\x20Motion','senderString','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','messages','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','remote','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','login','text','timestamp','keys','length','apiKey','createHash','digest','hex','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','bandwidth','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','message','refid','status','intelepeer','utf8mb4'];(function(_0x362d42,_0xc6c041){var _0x2a2fdc=function(_0x12477a){while(--_0x12477a){_0x362d42['push'](_0x362d42['shift']());}};_0x2a2fdc(++_0xc6c041);}(_0x7b7c,0x1f1));var _0xc7b7=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x7b7c[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0xc7b7('0x0'));var util=require(_0xc7b7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc7b7('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc7b7('0x3'));var rimraf=require(_0xc7b7('0x4'));var config=require('../../config/environment');var attributes=require(_0xc7b7('0x5'));module[_0xc7b7('0x6')]=function(_0x2db845,_0x4e8614){return _0x2db845[_0xc7b7('0x7')](_0xc7b7('0x8'),attributes,{'tableName':_0xc7b7('0x9'),'paranoid':![],'indexes':[{'name':_0xc7b7('0xa'),'fields':[_0xc7b7('0xa')]},{'name':_0xc7b7('0xb'),'fields':[_0xc7b7('0xc')],'type':_0xc7b7('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x30037f,_0x1acada,_0x229314){var _0x40aff5=_0x2db845[_0xc7b7('0xe')];var _0x335994=_0x30037f[_0xc7b7('0xf')]({'plain':!![]});if(_0x335994['direction'][_0xc7b7('0x10')]()==='in'||_0x335994[_0xc7b7('0x11')]['toLowerCase']()===_0xc7b7('0x12')&&!_0x335994[_0xc7b7('0x13')]&&!_['isNil'](_0x335994[_0xc7b7('0x14')])&&!_[_0xc7b7('0x15')](_0x335994[_0xc7b7('0x16')])){_0x40aff5['SmsInteraction'][_0xc7b7('0x17')]({'where':{'id':_0x335994[_0xc7b7('0x16')]}})['then'](function(_0x172390){if(_0x172390){_0x172390[_0xc7b7('0x18')]({'lastMsgAt':_0x335994['createdAt'],'lastMsgDirection':_0x335994[_0xc7b7('0x11')][_0xc7b7('0x10')]()});}})[_0xc7b7('0x19')](function(_0x4cad79){console['error'](_0x4cad79);});}if(_0x335994[_0xc7b7('0x11')]===_0xc7b7('0x12')&&!_0x335994[_0xc7b7('0x13')]){var _0x11ec1a;_0x40aff5[_0xc7b7('0x1a')][_0xc7b7('0x1b')]({'where':{'id':_0x335994[_0xc7b7('0x1c')]},'raw':!![]})[_0xc7b7('0x1d')](function(_0xf1d623){_0x11ec1a=_0xf1d623;if(_0x11ec1a&&_0x11ec1a['type']){switch(_0x11ec1a['type']){case _0xc7b7('0x1e'):var _0x8e365c=require('twilio');if(_0x11ec1a[_0xc7b7('0x1f')]&&_0x11ec1a[_0xc7b7('0x20')]&&_0x11ec1a['phone']){var _0x312ca3=new _0x8e365c(_0x11ec1a[_0xc7b7('0x1f')],_0x11ec1a[_0xc7b7('0x20')]);_0x312ca3['messages'][_0xc7b7('0x21')]({'body':_0x335994[_0xc7b7('0xc')],'to':_0x335994[_0xc7b7('0x22')],'from':_0x11ec1a[_0xc7b7('0x22')],'statusCallback':_0x11ec1a['remote']+_0xc7b7('0x23')+_0x335994['id']+'/status?token='+_0x11ec1a[_0xc7b7('0x24')]})[_0xc7b7('0x1d')](function(_0x2c0644){if(_0x2c0644['sid']){return _0x30037f[_0xc7b7('0x18')]({'messageId':_0x2c0644['sid']});}})[_0xc7b7('0x19')](function(_0x3ebfd4){logger['error'](_0xc7b7('0x25'),_0xc7b7('0x26'),_0xc7b7('0x1e'),util[_0xc7b7('0x27')](_0x3ebfd4,{'showHidden':![],'depth':null}));});}else{logger[_0xc7b7('0x28')](_0xc7b7('0x25'),_0xc7b7('0x26'),_0xc7b7('0x1e'),_0xc7b7('0x29'));}break;case'skebby':var _0x1ae8f5='https://api.skebby.it/API/v1.0/REST/';if(_0x11ec1a[_0xc7b7('0x2a')]&&_0x11ec1a['password']){var _0x29c18c={'recipient':[_0x335994[_0xc7b7('0x22')]],'message':_0x335994['body'],'message_type':_0x11ec1a[_0xc7b7('0x2b')]};if(_0x11ec1a[_0xc7b7('0x2b')]&&_0x11ec1a[_0xc7b7('0x2b')]!=='SI'){_0x29c18c[_0xc7b7('0x2c')]=_0x11ec1a[_0xc7b7('0x22')];}var _0x5a3cac={'url':_0x1ae8f5+'login?username='+_0x11ec1a['username']+_0xc7b7('0x2d')+_0x11ec1a[_0xc7b7('0x2e')],'method':_0xc7b7('0x2f')};rp(_0x5a3cac)[_0xc7b7('0x1d')](function(_0x47abea){var _0x10f927=_0x47abea['split'](';');var _0x18646d={'user_key':_0x10f927[0x0],'session_key':_0x10f927[0x1]};_0x5a3cac={'url':_0x1ae8f5+_0xc7b7('0x30'),'method':'POST','headers':{'user_key':_0x18646d[_0xc7b7('0x31')],'Session_key':_0x18646d[_0xc7b7('0x32')]},'json':!![],'body':_0x29c18c};return rp(_0x5a3cac);})[_0xc7b7('0x1d')](function(_0x15e8c7){if(_0x15e8c7[_0xc7b7('0x33')]>=0x1){var _0xfa2900={'messageId':_0x15e8c7[_0xc7b7('0x34')]};if(_0x11ec1a[_0xc7b7('0x2b')]!=='GP'||!_0x11ec1a['deliveryReport']){_0xfa2900[_0xc7b7('0x35')]=!![];}return _0x30037f['update'](_0xfa2900);}else{return logger[_0xc7b7('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc7b7('0x26'),_0xc7b7('0x36'),util[_0xc7b7('0x27')](_0x15e8c7,{'showHidden':![],'depth':null}));}})[_0xc7b7('0x19')](function(_0x321950){return logger[_0xc7b7('0x28')](_0xc7b7('0x25'),_0xc7b7('0x26'),_0xc7b7('0x36'),util[_0xc7b7('0x27')](_0x321950,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xc7b7('0x36'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xc7b7('0x37'):if(_0x11ec1a['authToken']){var _0x43c416={'recipient':_0x335994[_0xc7b7('0x22')],'message':_0x335994['body'],'sender':_0x11ec1a['senderString']||_0x11ec1a[_0xc7b7('0x22')],'authorization':_0x11ec1a[_0xc7b7('0x20')]};var _0x1acada={'method':_0xc7b7('0x38'),'uri':_0xc7b7('0x39'),'body':_0x43c416,'json':!![]};rp(_0x1acada)[_0xc7b7('0x1d')](function(_0xd3e5a9){var _0xd8b069={'messageId':_0xd3e5a9[_0xc7b7('0x3a')]};if(!_0x11ec1a[_0xc7b7('0x3b')]){_0xd8b069[_0xc7b7('0x35')]=!![];}return _0x30037f['update'](_0xd8b069);})['catch'](function(_0x33f248){logger[_0xc7b7('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc7b7('0x26'),_0xc7b7('0x37'),util['inspect'](_0x33f248,{'showHidden':![],'depth':null}));});}else{logger[_0xc7b7('0x28')](_0xc7b7('0x25'),_0xc7b7('0x26'),_0xc7b7('0x37'),'Missing\x20parameters:\x20authToken');}break;case _0xc7b7('0x3c'):if(_0x11ec1a[_0xc7b7('0x2a')]&&_0x11ec1a[_0xc7b7('0x2e')]){var _0x43c416={'messages':[{'source':_0xc7b7('0x3d'),'to':_0x335994[_0xc7b7('0x22')],'body':_0x335994['body'],'from':_0x11ec1a[_0xc7b7('0x3e')]||_0x11ec1a[_0xc7b7('0x22')]}]};var _0x1715a3=util[_0xc7b7('0x3f')](_0xc7b7('0x40'),_0x11ec1a['username'],_0x11ec1a[_0xc7b7('0x2e')]);var _0x1acada={'method':_0xc7b7('0x38'),'uri':_0xc7b7('0x41'),'body':_0x43c416,'headers':{'Authorization':util[_0xc7b7('0x3f')](_0xc7b7('0x42'),new Buffer(_0x1715a3)[_0xc7b7('0x43')](_0xc7b7('0x44')))},'json':!![]};rp(_0x1acada)[_0xc7b7('0x1d')](function(_0x4a4caf){if(_0x4a4caf[_0xc7b7('0x45')]>=0xc8&&_0x4a4caf['http_code']<=0xce){if(_0x4a4caf[_0xc7b7('0x46')]&&_0x4a4caf[_0xc7b7('0x46')][_0xc7b7('0x47')]>0x0){var _0x27e105=_[_0xc7b7('0x48')](_0x4a4caf[_0xc7b7('0x46')][_0xc7b7('0x49')]);var _0xffdb6a={'messageId':_0x27e105[_0xc7b7('0x4a')]};if(!_0x11ec1a[_0xc7b7('0x3b')]){_0xffdb6a[_0xc7b7('0x35')]=!![];}return _0x30037f[_0xc7b7('0x18')](_0xffdb6a);}else{logger[_0xc7b7('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc7b7('0x26'),'clickSend',util[_0xc7b7('0x27')](_0x4a4caf,{'showHidden':![],'depth':null}));}}else{logger[_0xc7b7('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc7b7('0x26'),'clickSend',util[_0xc7b7('0x27')](_0x4a4caf,{'showHidden':![],'depth':null}));}})[_0xc7b7('0x19')](function(_0x7be6a6){logger[_0xc7b7('0x28')](_0xc7b7('0x25'),_0xc7b7('0x26'),_0xc7b7('0x4b'),util['inspect'](_0x7be6a6,{'showHidden':![],'depth':null}));});}else{logger[_0xc7b7('0x28')](_0xc7b7('0x25'),_0xc7b7('0x26'),_0xc7b7('0x4b'),_0xc7b7('0x4c'));}break;case _0xc7b7('0x4d'):if(_0x11ec1a[_0xc7b7('0x4e')]&&_0x11ec1a[_0xc7b7('0x20')]){var _0x43c416={'dst':_0x335994[_0xc7b7('0x22')],'text':_0x335994['body'],'src':_0x11ec1a[_0xc7b7('0x3e')]||_0x11ec1a['phone'],'url':_0x11ec1a[_0xc7b7('0x4f')]+'/api/sms/messages/'+_0x335994['id']+_0xc7b7('0x50')+_0x11ec1a[_0xc7b7('0x24')]};var _0x1715a3=util[_0xc7b7('0x3f')]('%s:%s',_0x11ec1a[_0xc7b7('0x4e')],_0x11ec1a[_0xc7b7('0x20')]);var _0x1acada={'method':_0xc7b7('0x38'),'uri':util[_0xc7b7('0x3f')](_0xc7b7('0x51'),_0x11ec1a[_0xc7b7('0x4e')]),'body':_0x43c416,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x1715a3)[_0xc7b7('0x43')]('base64'))},'json':!![]};rp(_0x1acada)[_0xc7b7('0x1d')](function(_0x460f9c){var _0x44f8fe={'messageId':_0x460f9c[_0xc7b7('0x52')][0x0]};return _0x30037f[_0xc7b7('0x18')](_0x44f8fe);})[_0xc7b7('0x19')](function(_0x179d0a){logger[_0xc7b7('0x28')](_0xc7b7('0x25'),_0xc7b7('0x26'),_0xc7b7('0x4d'),util[_0xc7b7('0x27')](_0x179d0a,{'showHidden':![],'depth':null}));});}else{logger[_0xc7b7('0x28')](_0xc7b7('0x25'),_0xc7b7('0x26'),_0xc7b7('0x4d'),_0xc7b7('0x53'));}break;case _0xc7b7('0x54'):if(_0x11ec1a[_0xc7b7('0x2a')]&&_0x11ec1a[_0xc7b7('0x2e')]){if(_0x11ec1a[_0xc7b7('0x55')]){var _0x4027cd={'method':_0xc7b7('0x38'),'uri':_0x11ec1a[_0xc7b7('0x55')]+_0xc7b7('0x56'),'body':{'username':_0x11ec1a[_0xc7b7('0x2a')],'password':_0x11ec1a['password']},'json':!![]};return rp(_0x4027cd)[_0xc7b7('0x1d')](function(_0x4fc877){var _0x10c897={'method':_0xc7b7('0x38'),'uri':_0x11ec1a[_0xc7b7('0x55')]+_0xc7b7('0x57'),'body':{'messages':[{'from':_0x11ec1a[_0xc7b7('0x22')],'destinations':[{'to':_0x335994[_0xc7b7('0x22')]}],'text':_0x335994[_0xc7b7('0xc')],'notifyUrl':_0x11ec1a[_0xc7b7('0x4f')]+_0xc7b7('0x23')+_0x335994['id']+'/status?token='+_0x11ec1a[_0xc7b7('0x24')],'notifyContentType':'application/json','callbackData':_0x11ec1a[_0xc7b7('0x22')]+';'+_0x335994[_0xc7b7('0xc')]}]},'headers':{'Authorization':_0xc7b7('0x58')+_0x4fc877[_0xc7b7('0x24')]},'json':!![]};return rp(_0x10c897)['then'](function(_0x4c9021){if(_0x4c9021['messages']){var _0x3c9766={'messageId':_0x4c9021['messages'][0x0][_0xc7b7('0xa')]};if(!_0x11ec1a[_0xc7b7('0x3b')]){_0x3c9766[_0xc7b7('0x35')]=!![];}return _0x30037f[_0xc7b7('0x18')](_0x3c9766);}else{return logger[_0xc7b7('0x28')](_0xc7b7('0x25'),_0xc7b7('0x26'),_0xc7b7('0x54'),util[_0xc7b7('0x27')](_0x4c9021,{'showHidden':![],'depth':null}));}});})[_0xc7b7('0x19')](function(_0x5a7b86){return logger['error'](_0xc7b7('0x25'),'afterCreate','infobip',util[_0xc7b7('0x27')](_0x5a7b86,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xc7b7('0x25'),_0xc7b7('0x26'),_0xc7b7('0x54'),_0xc7b7('0x59'));}}else{logger[_0xc7b7('0x28')](_0xc7b7('0x25'),'afterCreate','infobip',_0xc7b7('0x4c'));}break;case _0xc7b7('0x5a'):var _0x2bbe3d=require(_0xc7b7('0x5b'));if(_0x11ec1a['apiKey']){var _0x53d2a1={};_0x53d2a1[_0xc7b7('0x5c')]=_0x11ec1a[_0xc7b7('0x2a')];_0x53d2a1[_0xc7b7('0x22')]=_0x335994[_0xc7b7('0x22')];_0x53d2a1[_0xc7b7('0x2c')]=_0x11ec1a['phone'];_0x53d2a1[_0xc7b7('0x5d')]=_0x335994['body'];_0x53d2a1[_0xc7b7('0x5e')]=+new Date();var _0x1a2e58='';var _0x3e8042='';var _0x308e12=Object[_0xc7b7('0x5f')](_0x53d2a1);_0x308e12['sort']();for(var _0x2f489c=0x0;_0x2f489c<_0x308e12[_0xc7b7('0x60')];_0x2f489c++){if(_0x1a2e58!=''){_0x1a2e58+='&';}_0x1a2e58+=_0x308e12[_0x2f489c]+'='+encodeURIComponent(_0x53d2a1[_0x308e12[_0x2f489c]]);_0x3e8042+=_0x53d2a1[_0x308e12[_0x2f489c]];}_0x3e8042+=_0x11ec1a[_0xc7b7('0x61')];_0x3e8042=_0x2bbe3d[_0xc7b7('0x62')]('md5')['update'](_0x3e8042)[_0xc7b7('0x63')](_0xc7b7('0x64'));if(_0x1a2e58!==''){_0x1a2e58+='&';}_0x1a2e58+='signature='+_0x3e8042;var _0x5a3cac={'method':_0xc7b7('0x2f'),'uri':_0x11ec1a[_0xc7b7('0x55')]+_0xc7b7('0x65')+_0x1a2e58,'json':!![]};return rp(_0x5a3cac)[_0xc7b7('0x1d')](function(_0x2b3160){var _0x3506bf=Object['keys'](_0x2b3160);if(_0x2b3160[_0x3506bf[0x0]][_0xc7b7('0x28')]&&parseInt(_0x2b3160[_0x3506bf[0x0]]['error'])===0x0){var _0x352ab4={'messageId':_0x2b3160[_0x3506bf[0x0]][_0xc7b7('0x66')]};if(!_0x11ec1a[_0xc7b7('0x3b')]){_0x352ab4[_0xc7b7('0x35')]=!![];}return _0x30037f['update'](_0x352ab4);}else{return logger[_0xc7b7('0x28')](_0xc7b7('0x25'),_0xc7b7('0x26'),_0xc7b7('0x5a'),util['inspect'](_0x2b3160[_0xc7b7('0x28')],{'showHidden':![],'depth':null}));}})[_0xc7b7('0x19')](function(_0x14bed7){return logger[_0xc7b7('0x28')](_0xc7b7('0x25'),'afterCreate','csc',util['inspect'](_0x14bed7,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xc7b7('0x25'),'afterCreate','csc',_0xc7b7('0x67'));}break;case _0xc7b7('0x68'):if(_0x11ec1a[_0xc7b7('0x61')]){var _0x119176={'method':_0xc7b7('0x38'),'uri':_0xc7b7('0x69'),'headers':{'Authorization':_0x11ec1a[_0xc7b7('0x61')]},'body':{'content':_0x335994[_0xc7b7('0xc')],'to':[_0x335994[_0xc7b7('0x22')]],'from':_0x11ec1a[_0xc7b7('0x22')],'binary':![],'clientMessageId':_0xc7b7('0x6a'),'charset':_0xc7b7('0x6b')},'json':!![]};rp(_0x119176)[_0xc7b7('0x1d')](function(_0x1808b6){if(!_0x1808b6[_0xc7b7('0x28')]){var _0x56b053={'messageId':_0x1808b6['messages'][0x0][_0xc7b7('0x6c')]};if(!_0x11ec1a[_0xc7b7('0x3b')]){_0x56b053[_0xc7b7('0x35')]=!![];}return _0x30037f[_0xc7b7('0x18')](_0x56b053);}else{return logger[_0xc7b7('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc7b7('0x26'),'clickatell',util[_0xc7b7('0x27')](_0x1808b6['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x1ce5a6){return logger[_0xc7b7('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xc7b7('0x68'),util[_0xc7b7('0x27')](_0x1ce5a6,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xc7b7('0x25'),_0xc7b7('0x26'),_0xc7b7('0x68'),_0xc7b7('0x67'));}break;case'bandwidth':if(_0x11ec1a[_0xc7b7('0x2a')]&&_0x11ec1a['password']){var _0x1715a3=util[_0xc7b7('0x3f')](_0xc7b7('0x40'),_0x11ec1a['username'],_0x11ec1a[_0xc7b7('0x2e')]);var _0x1acada={'method':_0xc7b7('0x38'),'uri':_0xc7b7('0x6d')+_0x11ec1a[_0xc7b7('0x6e')]+_0xc7b7('0x6f'),'body':{'to':[_0x335994[_0xc7b7('0x22')]],'text':_0x335994[_0xc7b7('0xc')],'from':_0x11ec1a[_0xc7b7('0x22')],'applicationId':_0x11ec1a[_0xc7b7('0x70')]},'headers':{'Authorization':util['format'](_0xc7b7('0x42'),new Buffer(_0x1715a3)[_0xc7b7('0x43')](_0xc7b7('0x44')))},'json':!![]};rp(_0x1acada)[_0xc7b7('0x1d')](function(_0x403ca2){if(_0x403ca2['id']){var _0x489311={'messageId':_0x403ca2['id']};return _0x30037f[_0xc7b7('0x18')](_0x489311);}else{logger[_0xc7b7('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc7b7('0x26'),_0xc7b7('0x71'),util[_0xc7b7('0x27')](_0x403ca2,{'showHidden':![],'depth':null}));}})[_0xc7b7('0x19')](function(_0x10ec10){logger['error'](_0xc7b7('0x25'),_0xc7b7('0x26'),_0xc7b7('0x71'),util[_0xc7b7('0x27')](_0x10ec10,{'showHidden':![],'depth':null}));});}else{logger[_0xc7b7('0x28')](_0xc7b7('0x25'),_0xc7b7('0x26'),_0xc7b7('0x71'),_0xc7b7('0x4c'));}break;case'intelepeer':if(_0x11ec1a[_0xc7b7('0x61')]){var _0x2cf47e={};var _0x5a3cac={'method':'POST','uri':_0xc7b7('0x72'),'headers':{'Authorization':_0xc7b7('0x73')+_0x11ec1a[_0xc7b7('0x61')],'Content-Type':_0xc7b7('0x74')},'body':{'from':_0x11ec1a[_0xc7b7('0x22')],'to':_0x335994[_0xc7b7('0x22')],'text':_0x335994['body']},'json':!![]};return rp(_0x5a3cac)['then'](function(_0x3f5d1e){if(_0x3f5d1e[_0xc7b7('0x75')]==0xca){_0x2cf47e[_0xc7b7('0x76')]=_0x3f5d1e;var _0xbbf8f7={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xc7b7('0x73')+_0x11ec1a[_0xc7b7('0x61')],'Content-Type':_0xc7b7('0x74')},'body':{'refid':_0x2cf47e[_0xc7b7('0x76')][_0xc7b7('0x77')]},'json':!![]};return rp(_0xbbf8f7)[_0xc7b7('0x1d')](function(_0x1d9ac3){_0x2cf47e[_0xc7b7('0x78')]=_0x1d9ac3;var _0x4af69c={'messageId':_0x2cf47e[_0xc7b7('0x76')][_0xc7b7('0x77')],'read':!![]};return _0x30037f[_0xc7b7('0x18')](_0x4af69c);});}else{return logger[_0xc7b7('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc7b7('0x26'),'intelepeer',util['inspect'](_0x3f5d1e,{'showHidden':![],'depth':null}));}})[_0xc7b7('0x19')](function(_0x5a44ab){return logger[_0xc7b7('0x28')](_0xc7b7('0x25'),'afterCreate',_0xc7b7('0x79'),util[_0xc7b7('0x27')](_0x5a44ab,{'showHidden':![],'depth':null}));});}else{return logger[_0xc7b7('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc7b7('0x26'),_0xc7b7('0x79'),'Token\x20not\x20received');}break;}}})['finally'](function(){_0x229314();});}else{_0x229314();}}},'charset':_0xc7b7('0x7a'),'collate':_0xc7b7('0x7b')});}; \ No newline at end of file +var _0x004c=['%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','message_id','clickSend','plivo','token','authId','https://api.plivo.com/v1/Account/%s/Message/','base64','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','messages','Missing\x20parameters:\x20base_url','apiKey','timestamp','sort','length','createHash','md5','digest','signature=','csc','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','Bearer\x20','refid','status','Token\x20not\x20received','finally','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','request-promise','rimraf','./smsMessage.attributes','exports','define','messageId','fti_sms_messages','body','get','toLowerCase','direction','out','secret','isNil','SmsInteraction','findOne','SmsInteractionId','then','catch','error','SmsAccount','find','type','twilio','authToken','phone','accountSid','create','remote','/api/sms/messages/','/status?token=','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','password','smsMethod','sender','login?username=','&password=','GET','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','clicksend','username','xCALLY\x20Motion','format'];(function(_0x270a54,_0x307ff6){var _0x4d07d0=function(_0x59ac5a){while(--_0x59ac5a){_0x270a54['push'](_0x270a54['shift']());}};_0x4d07d0(++_0x307ff6);}(_0x004c,0x185));var _0xc004=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x004c[_0x616290];return _0x453879;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc004('0x0'))('api');var moment=require(_0xc004('0x1'));var BPromise=require(_0xc004('0x2'));var rp=require(_0xc004('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc004('0x4'));var config=require('../../config/environment');var attributes=require(_0xc004('0x5'));module[_0xc004('0x6')]=function(_0x106973,_0x3170e9){return _0x106973[_0xc004('0x7')]('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xc004('0x8'),'fields':[_0xc004('0x8')]},{'name':_0xc004('0x9'),'fields':[_0xc004('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x34be9,_0x38c67e,_0x54bb36){var _0x267f77=_0x106973['models'];var _0x586b98=_0x34be9[_0xc004('0xb')]({'plain':!![]});if(_0x586b98['direction'][_0xc004('0xc')]()==='in'||_0x586b98[_0xc004('0xd')][_0xc004('0xc')]()===_0xc004('0xe')&&!_0x586b98[_0xc004('0xf')]&&!_[_0xc004('0x10')](_0x586b98['UserId'])&&!_[_0xc004('0x10')](_0x586b98['SmsInteractionId'])){_0x267f77[_0xc004('0x11')][_0xc004('0x12')]({'where':{'id':_0x586b98[_0xc004('0x13')]}})[_0xc004('0x14')](function(_0x15765e){if(_0x15765e){_0x15765e['update']({'lastMsgAt':_0x586b98['createdAt'],'lastMsgDirection':_0x586b98[_0xc004('0xd')][_0xc004('0xc')]()});}})[_0xc004('0x15')](function(_0x272bd5){console[_0xc004('0x16')](_0x272bd5);});}if(_0x586b98[_0xc004('0xd')]===_0xc004('0xe')&&!_0x586b98[_0xc004('0xf')]){var _0x5402a6;_0x267f77[_0xc004('0x17')][_0xc004('0x18')]({'where':{'id':_0x586b98['SmsAccountId']},'raw':!![]})[_0xc004('0x14')](function(_0x463a57){_0x5402a6=_0x463a57;if(_0x5402a6&&_0x5402a6[_0xc004('0x19')]){switch(_0x5402a6[_0xc004('0x19')]){case _0xc004('0x1a'):var _0x3bb930=require(_0xc004('0x1a'));if(_0x5402a6['accountSid']&&_0x5402a6[_0xc004('0x1b')]&&_0x5402a6[_0xc004('0x1c')]){var _0xae90e=new _0x3bb930(_0x5402a6[_0xc004('0x1d')],_0x5402a6[_0xc004('0x1b')]);_0xae90e['messages'][_0xc004('0x1e')]({'body':_0x586b98[_0xc004('0xa')],'to':_0x586b98[_0xc004('0x1c')],'from':_0x5402a6[_0xc004('0x1c')],'statusCallback':_0x5402a6[_0xc004('0x1f')]+_0xc004('0x20')+_0x586b98['id']+_0xc004('0x21')+_0x5402a6['token']})[_0xc004('0x14')](function(_0x1715fc){if(_0x1715fc[_0xc004('0x22')]){return _0x34be9[_0xc004('0x23')]({'messageId':_0x1715fc['sid']});}})[_0xc004('0x15')](function(_0x183271){logger[_0xc004('0x16')](_0xc004('0x24'),_0xc004('0x25'),_0xc004('0x1a'),util['inspect'](_0x183271,{'showHidden':![],'depth':null}));});}else{logger[_0xc004('0x16')](_0xc004('0x24'),'afterCreate',_0xc004('0x1a'),_0xc004('0x26'));}break;case _0xc004('0x27'):var _0x330d66='https://api.skebby.it/API/v1.0/REST/';if(_0x5402a6['username']&&_0x5402a6[_0xc004('0x28')]){var _0x99ff2e={'recipient':[_0x586b98[_0xc004('0x1c')]],'message':_0x586b98[_0xc004('0xa')],'message_type':_0x5402a6[_0xc004('0x29')]};if(_0x5402a6['smsMethod']&&_0x5402a6[_0xc004('0x29')]!=='SI'){_0x99ff2e[_0xc004('0x2a')]=_0x5402a6[_0xc004('0x1c')];}var _0x514019={'url':_0x330d66+_0xc004('0x2b')+_0x5402a6['username']+_0xc004('0x2c')+_0x5402a6[_0xc004('0x28')],'method':_0xc004('0x2d')};rp(_0x514019)[_0xc004('0x14')](function(_0x44c084){var _0x346663=_0x44c084['split'](';');var _0x19f866={'user_key':_0x346663[0x0],'session_key':_0x346663[0x1]};_0x514019={'url':_0x330d66+'sms','method':'POST','headers':{'user_key':_0x19f866[_0xc004('0x2e')],'Session_key':_0x19f866[_0xc004('0x2f')]},'json':!![],'body':_0x99ff2e};return rp(_0x514019);})[_0xc004('0x14')](function(_0x45b342){if(_0x45b342[_0xc004('0x30')]>=0x1){var _0x283ff7={'messageId':_0x45b342[_0xc004('0x31')]};if(_0x5402a6[_0xc004('0x29')]!=='GP'||!_0x5402a6[_0xc004('0x32')]){_0x283ff7[_0xc004('0x33')]=!![];}return _0x34be9['update'](_0x283ff7);}else{return logger['error'](_0xc004('0x24'),'afterCreate',_0xc004('0x27'),util[_0xc004('0x34')](_0x45b342,{'showHidden':![],'depth':null}));}})[_0xc004('0x15')](function(_0x2e8c97){return logger[_0xc004('0x16')](_0xc004('0x24'),_0xc004('0x25'),_0xc004('0x27'),util[_0xc004('0x34')](_0x2e8c97,{'showHidden':![],'depth':null}));});}else{logger[_0xc004('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc004('0x25'),_0xc004('0x27'),_0xc004('0x35'));}break;case _0xc004('0x36'):if(_0x5402a6[_0xc004('0x1b')]){var _0xa4af9={'recipient':_0x586b98[_0xc004('0x1c')],'message':_0x586b98[_0xc004('0xa')],'sender':_0x5402a6[_0xc004('0x37')]||_0x5402a6[_0xc004('0x1c')],'authorization':_0x5402a6[_0xc004('0x1b')]};var _0x38c67e={'method':_0xc004('0x38'),'uri':_0xc004('0x39'),'body':_0xa4af9,'json':!![]};rp(_0x38c67e)[_0xc004('0x14')](function(_0x1b53a4){var _0x1d3315={'messageId':_0x1b53a4[_0xc004('0x3a')]};if(!_0x5402a6['deliveryReport']){_0x1d3315[_0xc004('0x33')]=!![];}return _0x34be9[_0xc004('0x23')](_0x1d3315);})[_0xc004('0x15')](function(_0x835e00){logger['error'](_0xc004('0x24'),_0xc004('0x25'),_0xc004('0x36'),util[_0xc004('0x34')](_0x835e00,{'showHidden':![],'depth':null}));});}else{logger[_0xc004('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc004('0x25'),_0xc004('0x36'),'Missing\x20parameters:\x20authToken');}break;case _0xc004('0x3b'):if(_0x5402a6[_0xc004('0x3c')]&&_0x5402a6[_0xc004('0x28')]){var _0xa4af9={'messages':[{'source':_0xc004('0x3d'),'to':_0x586b98[_0xc004('0x1c')],'body':_0x586b98[_0xc004('0xa')],'from':_0x5402a6[_0xc004('0x37')]||_0x5402a6[_0xc004('0x1c')]}]};var _0x5b973c=util[_0xc004('0x3e')](_0xc004('0x3f'),_0x5402a6['username'],_0x5402a6[_0xc004('0x28')]);var _0x38c67e={'method':'POST','uri':_0xc004('0x40'),'body':_0xa4af9,'headers':{'Authorization':util[_0xc004('0x3e')](_0xc004('0x41'),new Buffer(_0x5b973c)[_0xc004('0x42')]('base64'))},'json':!![]};rp(_0x38c67e)['then'](function(_0x56be36){if(_0x56be36[_0xc004('0x43')]>=0xc8&&_0x56be36[_0xc004('0x43')]<=0xce){if(_0x56be36['data']&&_0x56be36[_0xc004('0x44')][_0xc004('0x45')]>0x0){var _0x162469=_[_0xc004('0x46')](_0x56be36[_0xc004('0x44')]['messages']);var _0x159336={'messageId':_0x162469[_0xc004('0x47')]};if(!_0x5402a6[_0xc004('0x32')]){_0x159336['read']=!![];}return _0x34be9[_0xc004('0x23')](_0x159336);}else{logger[_0xc004('0x16')](_0xc004('0x24'),_0xc004('0x25'),'clickSend',util[_0xc004('0x34')](_0x56be36,{'showHidden':![],'depth':null}));}}else{logger[_0xc004('0x16')](_0xc004('0x24'),'afterCreate',_0xc004('0x48'),util['inspect'](_0x56be36,{'showHidden':![],'depth':null}));}})[_0xc004('0x15')](function(_0x4c32ec){logger['error'](_0xc004('0x24'),_0xc004('0x25'),_0xc004('0x48'),util[_0xc004('0x34')](_0x4c32ec,{'showHidden':![],'depth':null}));});}else{logger[_0xc004('0x16')](_0xc004('0x24'),'afterCreate',_0xc004('0x48'),_0xc004('0x35'));}break;case _0xc004('0x49'):if(_0x5402a6['authId']&&_0x5402a6[_0xc004('0x1b')]){var _0xa4af9={'dst':_0x586b98[_0xc004('0x1c')],'text':_0x586b98[_0xc004('0xa')],'src':_0x5402a6[_0xc004('0x37')]||_0x5402a6[_0xc004('0x1c')],'url':_0x5402a6[_0xc004('0x1f')]+_0xc004('0x20')+_0x586b98['id']+_0xc004('0x21')+_0x5402a6[_0xc004('0x4a')]};var _0x5b973c=util[_0xc004('0x3e')]('%s:%s',_0x5402a6[_0xc004('0x4b')],_0x5402a6['authToken']);var _0x38c67e={'method':_0xc004('0x38'),'uri':util['format'](_0xc004('0x4c'),_0x5402a6[_0xc004('0x4b')]),'body':_0xa4af9,'headers':{'Authorization':util[_0xc004('0x3e')]('Basic\x20%s',new Buffer(_0x5b973c)[_0xc004('0x42')](_0xc004('0x4d')))},'json':!![]};rp(_0x38c67e)['then'](function(_0x4bb38b){var _0x53656e={'messageId':_0x4bb38b['message_uuid'][0x0]};return _0x34be9[_0xc004('0x23')](_0x53656e);})[_0xc004('0x15')](function(_0x384283){logger[_0xc004('0x16')](_0xc004('0x24'),_0xc004('0x25'),_0xc004('0x49'),util[_0xc004('0x34')](_0x384283,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xc004('0x24'),'afterCreate',_0xc004('0x49'),_0xc004('0x4e'));}break;case _0xc004('0x4f'):if(_0x5402a6[_0xc004('0x3c')]&&_0x5402a6[_0xc004('0x28')]){if(_0x5402a6['baseUrl']){var _0x2bbdf0={'method':_0xc004('0x38'),'uri':_0x5402a6[_0xc004('0x50')]+_0xc004('0x51'),'body':{'username':_0x5402a6[_0xc004('0x3c')],'password':_0x5402a6[_0xc004('0x28')]},'json':!![]};return rp(_0x2bbdf0)[_0xc004('0x14')](function(_0x11d4f8){var _0x59fa12={'method':_0xc004('0x38'),'uri':_0x5402a6[_0xc004('0x50')]+_0xc004('0x52'),'body':{'messages':[{'from':_0x5402a6[_0xc004('0x1c')],'destinations':[{'to':_0x586b98[_0xc004('0x1c')]}],'text':_0x586b98['body'],'notifyUrl':_0x5402a6[_0xc004('0x1f')]+_0xc004('0x20')+_0x586b98['id']+_0xc004('0x21')+_0x5402a6['token'],'notifyContentType':_0xc004('0x53'),'callbackData':_0x5402a6[_0xc004('0x1c')]+';'+_0x586b98[_0xc004('0xa')]}]},'headers':{'Authorization':_0xc004('0x54')+_0x11d4f8[_0xc004('0x4a')]},'json':!![]};return rp(_0x59fa12)['then'](function(_0x102f15){if(_0x102f15['messages']){var _0x4329d9={'messageId':_0x102f15[_0xc004('0x55')][0x0]['messageId']};if(!_0x5402a6[_0xc004('0x32')]){_0x4329d9['read']=!![];}return _0x34be9['update'](_0x4329d9);}else{return logger[_0xc004('0x16')](_0xc004('0x24'),_0xc004('0x25'),'infobip',util[_0xc004('0x34')](_0x102f15,{'showHidden':![],'depth':null}));}});})[_0xc004('0x15')](function(_0x327ef1){return logger[_0xc004('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc004('0x25'),_0xc004('0x4f'),util[_0xc004('0x34')](_0x327ef1,{'showHidden':![],'depth':null}));});}else{logger[_0xc004('0x16')](_0xc004('0x24'),_0xc004('0x25'),_0xc004('0x4f'),_0xc004('0x56'));}}else{logger[_0xc004('0x16')](_0xc004('0x24'),_0xc004('0x25'),_0xc004('0x4f'),'Missing\x20parameters:\x20username,\x20password');}break;case'csc':var _0x67e352=require('crypto');if(_0x5402a6[_0xc004('0x57')]){var _0x340ece={};_0x340ece['login']=_0x5402a6[_0xc004('0x3c')];_0x340ece['phone']=_0x586b98[_0xc004('0x1c')];_0x340ece[_0xc004('0x2a')]=_0x5402a6['phone'];_0x340ece['text']=_0x586b98['body'];_0x340ece[_0xc004('0x58')]=+new Date();var _0x1168ce='';var _0x479060='';var _0xcd86f0=Object['keys'](_0x340ece);_0xcd86f0[_0xc004('0x59')]();for(var _0x3a5848=0x0;_0x3a5848<_0xcd86f0[_0xc004('0x5a')];_0x3a5848++){if(_0x1168ce!=''){_0x1168ce+='&';}_0x1168ce+=_0xcd86f0[_0x3a5848]+'='+encodeURIComponent(_0x340ece[_0xcd86f0[_0x3a5848]]);_0x479060+=_0x340ece[_0xcd86f0[_0x3a5848]];}_0x479060+=_0x5402a6[_0xc004('0x57')];_0x479060=_0x67e352[_0xc004('0x5b')](_0xc004('0x5c'))[_0xc004('0x23')](_0x479060)[_0xc004('0x5d')]('hex');if(_0x1168ce!==''){_0x1168ce+='&';}_0x1168ce+=_0xc004('0x5e')+_0x479060;var _0x514019={'method':_0xc004('0x2d'),'uri':_0x5402a6['baseUrl']+'/external/get/send.php?'+_0x1168ce,'json':!![]};return rp(_0x514019)[_0xc004('0x14')](function(_0x32089e){var _0x173e07=Object['keys'](_0x32089e);if(_0x32089e[_0x173e07[0x0]][_0xc004('0x16')]&&parseInt(_0x32089e[_0x173e07[0x0]][_0xc004('0x16')])===0x0){var _0x517fb6={'messageId':_0x32089e[_0x173e07[0x0]]['id_sms']};if(!_0x5402a6[_0xc004('0x32')]){_0x517fb6[_0xc004('0x33')]=!![];}return _0x34be9['update'](_0x517fb6);}else{return logger[_0xc004('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc004('0x25'),_0xc004('0x5f'),util[_0xc004('0x34')](_0x32089e[_0xc004('0x16')],{'showHidden':![],'depth':null}));}})[_0xc004('0x15')](function(_0xc69656){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc004('0x25'),_0xc004('0x5f'),util[_0xc004('0x34')](_0xc69656,{'showHidden':![],'depth':null}));});}else{logger[_0xc004('0x16')](_0xc004('0x24'),_0xc004('0x25'),_0xc004('0x5f'),_0xc004('0x60'));}break;case'clickatell':if(_0x5402a6['apiKey']){var _0x3e7a7f={'method':_0xc004('0x38'),'uri':_0xc004('0x61'),'headers':{'Authorization':_0x5402a6['apiKey']},'body':{'content':_0x586b98[_0xc004('0xa')],'to':[_0x586b98[_0xc004('0x1c')]],'from':_0x5402a6[_0xc004('0x1c')],'binary':![],'clientMessageId':_0xc004('0x62'),'charset':'UTF-8'},'json':!![]};rp(_0x3e7a7f)[_0xc004('0x14')](function(_0x423d45){if(!_0x423d45[_0xc004('0x16')]){var _0x10f6e1={'messageId':_0x423d45[_0xc004('0x55')][0x0]['apiMessageId']};if(!_0x5402a6[_0xc004('0x32')]){_0x10f6e1['read']=!![];}return _0x34be9['update'](_0x10f6e1);}else{return logger[_0xc004('0x16')](_0xc004('0x24'),'afterCreate',_0xc004('0x63'),util[_0xc004('0x34')](_0x423d45[_0xc004('0x16')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x371503){return logger[_0xc004('0x16')](_0xc004('0x24'),_0xc004('0x25'),_0xc004('0x63'),util[_0xc004('0x34')](_0x371503,{'showHidden':![],'depth':null}));});}else{logger[_0xc004('0x16')](_0xc004('0x24'),_0xc004('0x25'),_0xc004('0x63'),_0xc004('0x60'));}break;case _0xc004('0x64'):if(_0x5402a6[_0xc004('0x3c')]&&_0x5402a6['password']){var _0x5b973c=util[_0xc004('0x3e')]('%s:%s',_0x5402a6['username'],_0x5402a6['password']);var _0x38c67e={'method':_0xc004('0x38'),'uri':_0xc004('0x65')+_0x5402a6['accountId']+'/messages','body':{'to':[_0x586b98['phone']],'text':_0x586b98['body'],'from':_0x5402a6[_0xc004('0x1c')],'applicationId':_0x5402a6[_0xc004('0x66')]},'headers':{'Authorization':util['format'](_0xc004('0x41'),new Buffer(_0x5b973c)['toString']('base64'))},'json':!![]};rp(_0x38c67e)[_0xc004('0x14')](function(_0x44bf1e){if(_0x44bf1e['id']){var _0x59e467={'messageId':_0x44bf1e['id']};return _0x34be9[_0xc004('0x23')](_0x59e467);}else{logger[_0xc004('0x16')](_0xc004('0x24'),'afterCreate',_0xc004('0x64'),util[_0xc004('0x34')](_0x44bf1e,{'showHidden':![],'depth':null}));}})[_0xc004('0x15')](function(_0xfbda7e){logger[_0xc004('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xc004('0x64'),util[_0xc004('0x34')](_0xfbda7e,{'showHidden':![],'depth':null}));});}else{logger[_0xc004('0x16')](_0xc004('0x24'),_0xc004('0x25'),_0xc004('0x64'),_0xc004('0x35'));}break;case _0xc004('0x67'):if(_0x5402a6[_0xc004('0x57')]){var _0x53bac7={};var _0x514019={'method':'POST','uri':_0xc004('0x68'),'headers':{'Authorization':'Bearer\x20'+_0x5402a6['apiKey'],'Content-Type':_0xc004('0x53')},'body':{'from':_0x5402a6[_0xc004('0x1c')],'to':_0x586b98[_0xc004('0x1c')],'text':_0x586b98[_0xc004('0xa')]},'json':!![]};return rp(_0x514019)['then'](function(_0x584240){if(_0x584240[_0xc004('0x69')]==0xca){_0x53bac7[_0xc004('0x6a')]=_0x584240;var _0x55a682={'method':_0xc004('0x38'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xc004('0x6b')+_0x5402a6[_0xc004('0x57')],'Content-Type':_0xc004('0x53')},'body':{'refid':_0x53bac7[_0xc004('0x6a')][_0xc004('0x6c')]},'json':!![]};return rp(_0x55a682)[_0xc004('0x14')](function(_0x287c0a){_0x53bac7[_0xc004('0x6d')]=_0x287c0a;var _0x18afbb={'messageId':_0x53bac7[_0xc004('0x6a')][_0xc004('0x6c')],'read':!![]};return _0x34be9[_0xc004('0x23')](_0x18afbb);});}else{return logger[_0xc004('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc004('0x25'),'intelepeer',util['inspect'](_0x584240,{'showHidden':![],'depth':null}));}})[_0xc004('0x15')](function(_0x4a576f){return logger[_0xc004('0x16')](_0xc004('0x24'),_0xc004('0x25'),_0xc004('0x67'),util[_0xc004('0x34')](_0x4a576f,{'showHidden':![],'depth':null}));});}else{return logger[_0xc004('0x16')](_0xc004('0x24'),_0xc004('0x25'),'intelepeer',_0xc004('0x6e'));}break;}}})[_0xc004('0x6f')](function(){_0x54bb36();});}else{_0x54bb36();}}},'charset':'utf8mb4','collate':_0xc004('0x70')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 53317db..a52e4f2 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 _0x261a=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','request\x20sent','debug','stringify','error','SmsMessage,\x20%s,\x20%s','message','result','CreateSmsMessage','create','options','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x2aa47b,_0x2d19f0){var _0x4b05d5=function(_0xe6e71){while(--_0xe6e71){_0x2aa47b['push'](_0x2aa47b['shift']());}};_0x4b05d5(++_0x2d19f0);}(_0x261a,0x131));var _0xa261=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x261a[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xa261('0x0'));var util=require(_0xa261('0x1'));var moment=require('moment');var BPromise=require(_0xa261('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa261('0x3'));var db=require(_0xa261('0x4'))['db'];var utils=require(_0xa261('0x5'));var logger=require(_0xa261('0x6'))(_0xa261('0x7'));var config=require(_0xa261('0x8'));var jayson=require(_0xa261('0x9'));var client=jayson[_0xa261('0xa')][_0xa261('0xb')]({'port':0x232a});config[_0xa261('0xc')]=_[_0xa261('0xd')](config['redis'],{'host':_0xa261('0xe'),'port':0x18eb});var socket=require(_0xa261('0xf'))(new Redis(config[_0xa261('0xc')]));require(_0xa261('0x10'))[_0xa261('0x11')](socket);function respondWithRpcPromise(_0x3b01d6,_0x58288b,_0x435960){return new BPromise(function(_0x5b7bd7,_0x23170b){return client[_0xa261('0x12')](_0x3b01d6,_0x435960)[_0xa261('0x13')](function(_0x242758){logger[_0xa261('0x14')]('SmsMessage,\x20%s,\x20%s',_0x58288b,_0xa261('0x15'));logger[_0xa261('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x58288b,_0xa261('0x15'),JSON[_0xa261('0x17')](_0x242758));if(_0x242758['error']){if(_0x242758[_0xa261('0x18')]['code']===0x1f4){logger['error'](_0xa261('0x19'),_0x58288b,_0x242758[_0xa261('0x18')]['message']);return _0x23170b(_0x242758[_0xa261('0x18')][_0xa261('0x1a')]);}logger['error'](_0xa261('0x19'),_0x58288b,_0x242758[_0xa261('0x18')]['message']);return _0x5b7bd7(_0x242758[_0xa261('0x18')]['message']);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x58288b,_0xa261('0x15'));_0x5b7bd7(_0x242758[_0xa261('0x1b')][_0xa261('0x1a')]);}})['catch'](function(_0x35bdc4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x58288b,_0x35bdc4);_0x23170b(_0x35bdc4);});});}exports[_0xa261('0x1c')]=function(_0x355053){var _0x1fd651=this;return new Promise(function(_0x54d3f4,_0x5a6efe){return db['SmsMessage'][_0xa261('0x1d')](_0x355053['body'],{'raw':_0x355053[_0xa261('0x1e')]?_0x355053[_0xa261('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xa261('0x13')](function(_0x52e403){logger[_0xa261('0x14')](_0xa261('0x1c'),_0x355053);logger[_0xa261('0x16')](_0xa261('0x1c'),_0x355053,JSON['stringify'](_0x52e403));_0x54d3f4(_0x52e403);})['catch'](function(_0x185025){logger[_0xa261('0x18')](_0xa261('0x1c'),_0x185025[_0xa261('0x1a')],_0x355053);_0x5a6efe(_0x1fd651[_0xa261('0x18')](0x1f4,_0x185025[_0xa261('0x1a')]));});});}; \ No newline at end of file +var _0x0043=['http','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x26a3b2,_0x5b9254){var _0x49e753=function(_0x32ea3f){while(--_0x32ea3f){_0x26a3b2['push'](_0x26a3b2['shift']());}};_0x49e753(++_0x5b9254);}(_0x0043,0x82));var _0x3004=function(_0x12ca5f,_0x223d98){_0x12ca5f=_0x12ca5f-0x0;var _0xfc3ae9=_0x0043[_0x12ca5f];return _0xfc3ae9;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3004('0x0'));var rs=require(_0x3004('0x1'));var fs=require('fs');var Redis=require(_0x3004('0x2'));var db=require(_0x3004('0x3'))['db'];var utils=require(_0x3004('0x4'));var logger=require(_0x3004('0x5'))(_0x3004('0x6'));var config=require(_0x3004('0x7'));var jayson=require(_0x3004('0x8'));var client=jayson[_0x3004('0x9')][_0x3004('0xa')]({'port':0x232a});config['redis']=_[_0x3004('0xb')](config[_0x3004('0xc')],{'host':_0x3004('0xd'),'port':0x18eb});var socket=require(_0x3004('0xe'))(new Redis(config[_0x3004('0xc')]));require(_0x3004('0xf'))[_0x3004('0x10')](socket);function respondWithRpcPromise(_0x44113d,_0x3669bd,_0x1b822a){return new BPromise(function(_0x56117a,_0x43f010){return client[_0x3004('0x11')](_0x44113d,_0x1b822a)[_0x3004('0x12')](function(_0xea3f0e){logger[_0x3004('0x13')](_0x3004('0x14'),_0x3669bd,_0x3004('0x15'));logger[_0x3004('0x16')](_0x3004('0x17'),_0x3669bd,_0x3004('0x15'),JSON[_0x3004('0x18')](_0xea3f0e));if(_0xea3f0e[_0x3004('0x19')]){if(_0xea3f0e[_0x3004('0x19')][_0x3004('0x1a')]===0x1f4){logger[_0x3004('0x19')](_0x3004('0x14'),_0x3669bd,_0xea3f0e[_0x3004('0x19')][_0x3004('0x1b')]);return _0x43f010(_0xea3f0e[_0x3004('0x19')][_0x3004('0x1b')]);}logger[_0x3004('0x19')]('SmsMessage,\x20%s,\x20%s',_0x3669bd,_0xea3f0e[_0x3004('0x19')][_0x3004('0x1b')]);return _0x56117a(_0xea3f0e[_0x3004('0x19')]['message']);}else{logger[_0x3004('0x13')]('SmsMessage,\x20%s,\x20%s',_0x3669bd,_0x3004('0x15'));_0x56117a(_0xea3f0e['result'][_0x3004('0x1b')]);}})[_0x3004('0x1c')](function(_0x1ba25e){logger[_0x3004('0x19')](_0x3004('0x14'),_0x3669bd,_0x1ba25e);_0x43f010(_0x1ba25e);});});}exports[_0x3004('0x1d')]=function(_0x238b58){var _0x4267be=this;return new Promise(function(_0x5dcc0b,_0x4381c5){return db[_0x3004('0x1e')][_0x3004('0x1f')](_0x238b58[_0x3004('0x20')],{'raw':_0x238b58[_0x3004('0x21')]?_0x238b58['options'][_0x3004('0x22')]===undefined?!![]:![]:!![]})[_0x3004('0x12')](function(_0x4f4645){logger[_0x3004('0x13')](_0x3004('0x1d'),_0x238b58);logger[_0x3004('0x16')](_0x3004('0x1d'),_0x238b58,JSON['stringify'](_0x4f4645));_0x5dcc0b(_0x4f4645);})[_0x3004('0x1c')](function(_0x128000){logger[_0x3004('0x19')](_0x3004('0x1d'),_0x128000['message'],_0x238b58);_0x4381c5(_0x4267be['error'](0x1f4,_0x128000[_0x3004('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 15c0189..e9606e0 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 _0x7fd5=['save','remove','update','emit','removeListener','length','smsMessage:','./smsMessage.events'];(function(_0x51ed62,_0x574379){var _0x34aee3=function(_0x2958bc){while(--_0x2958bc){_0x51ed62['push'](_0x51ed62['shift']());}};_0x34aee3(++_0x574379);}(_0x7fd5,0x1cf));var _0x57fd=function(_0x1085db,_0x41e087){_0x1085db=_0x1085db-0x0;var _0x392a60=_0x7fd5[_0x1085db];return _0x392a60;};'use strict';var SmsMessageEvents=require(_0x57fd('0x0'));var events=[_0x57fd('0x1'),_0x57fd('0x2'),_0x57fd('0x3')];function createListener(_0x52a2c3,_0x29da1d){return function(_0x277e33){_0x29da1d[_0x57fd('0x4')](_0x52a2c3,_0x277e33);};}function removeListener(_0x558ea3,_0x1d045f){return function(){SmsMessageEvents[_0x57fd('0x5')](_0x558ea3,_0x1d045f);};}exports['register']=function(_0xe18b9b){for(var _0x40e206=0x0,_0x35efc8=events[_0x57fd('0x6')];_0x40e206<_0x35efc8;_0x40e206++){var _0xefd498=events[_0x40e206];var _0x302799=createListener(_0x57fd('0x7')+_0xefd498,_0xe18b9b);SmsMessageEvents['on'](_0xefd498,_0x302799);}}; \ No newline at end of file +var _0xc5c2=['save','remove','emit','removeListener','register','length','./smsMessage.events'];(function(_0x56e0e5,_0x2e3937){var _0x27bb15=function(_0x186336){while(--_0x186336){_0x56e0e5['push'](_0x56e0e5['shift']());}};_0x27bb15(++_0x2e3937);}(_0xc5c2,0x179));var _0x2c5c=function(_0x1b9728,_0x330a8e){_0x1b9728=_0x1b9728-0x0;var _0x3db79c=_0xc5c2[_0x1b9728];return _0x3db79c;};'use strict';var SmsMessageEvents=require(_0x2c5c('0x0'));var events=[_0x2c5c('0x1'),_0x2c5c('0x2'),'update'];function createListener(_0x2586bd,_0x296c74){return function(_0x336c20){_0x296c74[_0x2c5c('0x3')](_0x2586bd,_0x336c20);};}function removeListener(_0x12ad8f,_0x27a411){return function(){SmsMessageEvents[_0x2c5c('0x4')](_0x12ad8f,_0x27a411);};}exports[_0x2c5c('0x5')]=function(_0x5d2a13){for(var _0x574fe8=0x0,_0x1d7a24=events[_0x2c5c('0x6')];_0x574fe8<_0x1d7a24;_0x574fe8++){var _0x22c498=events[_0x574fe8];var _0x4d99f9=createListener('smsMessage:'+_0x22c498,_0x5d2a13);SmsMessageEvents['on'](_0x22c498,_0x4d99f9);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 6e5ff13..a623bdc 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 _0xfdf2=['put','/:id','destroy','delete','removeTeams','exports','multer','util','path','fs-extra','../../config/environment','./smsQueue.controller','isAuthenticated','index','/describe','describe','show','/:id/members','get','/:id/users','getAgents','post','create','/:id/teams','addTeams'];(function(_0x39f797,_0x2e96c5){var _0x5c3a5d=function(_0x4c6230){while(--_0x4c6230){_0x39f797['push'](_0x39f797['shift']());}};_0x5c3a5d(++_0x2e96c5);}(_0xfdf2,0xce));var _0x2fdf=function(_0x54e3d3,_0x50b01e){_0x54e3d3=_0x54e3d3-0x0;var _0x5c3bc0=_0xfdf2[_0x54e3d3];return _0x5c3bc0;};'use strict';var multer=require(_0x2fdf('0x0'));var util=require(_0x2fdf('0x1'));var path=require(_0x2fdf('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x2fdf('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2fdf('0x4'));var controller=require(_0x2fdf('0x5'));router['get']('/',auth[_0x2fdf('0x6')](),controller[_0x2fdf('0x7')]);router['get'](_0x2fdf('0x8'),auth[_0x2fdf('0x6')](),controller[_0x2fdf('0x9')]);router['get']('/:id',auth[_0x2fdf('0x6')](),controller[_0x2fdf('0xa')]);router['get'](_0x2fdf('0xb'),auth[_0x2fdf('0x6')](),controller['getMembers']);router[_0x2fdf('0xc')]('/:id/teams',auth[_0x2fdf('0x6')](),controller['getTeams']);router[_0x2fdf('0xc')](_0x2fdf('0xd'),auth['isAuthenticated'](),controller[_0x2fdf('0xe')]);router[_0x2fdf('0xf')]('/',auth[_0x2fdf('0x6')](),controller[_0x2fdf('0x10')]);router[_0x2fdf('0xf')](_0x2fdf('0x11'),auth[_0x2fdf('0x6')](),controller[_0x2fdf('0x12')]);router[_0x2fdf('0xf')](_0x2fdf('0xd'),auth['isAuthenticated'](),controller['addAgents']);router[_0x2fdf('0x13')](_0x2fdf('0x14'),auth[_0x2fdf('0x6')](),controller['update']);router['delete'](_0x2fdf('0x14'),auth['isAuthenticated'](),controller[_0x2fdf('0x15')]);router[_0x2fdf('0x16')]('/:id/teams',auth[_0x2fdf('0x6')](),controller[_0x2fdf('0x17')]);router[_0x2fdf('0x16')]('/:id/users',auth[_0x2fdf('0x6')](),controller['removeAgents']);module[_0x2fdf('0x18')]=router; \ No newline at end of file +var _0xdb22=['/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','addTeams','post','addAgents','put','delete','destroy','removeAgents','exports','multer','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0xdb22,0x114));var _0x2db2=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xdb22[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x2db2('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2db2('0x1'));var router=express[_0x2db2('0x2')]();var fs_extra=require(_0x2db2('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2db2('0x4'));var controller=require('./smsQueue.controller');router[_0x2db2('0x5')]('/',auth[_0x2db2('0x6')](),controller[_0x2db2('0x7')]);router[_0x2db2('0x5')](_0x2db2('0x8'),auth[_0x2db2('0x6')](),controller[_0x2db2('0x9')]);router[_0x2db2('0x5')](_0x2db2('0xa'),auth[_0x2db2('0x6')](),controller['show']);router[_0x2db2('0x5')](_0x2db2('0xb'),auth[_0x2db2('0x6')](),controller[_0x2db2('0xc')]);router['get'](_0x2db2('0xd'),auth[_0x2db2('0x6')](),controller[_0x2db2('0xe')]);router[_0x2db2('0x5')](_0x2db2('0xf'),auth[_0x2db2('0x6')](),controller[_0x2db2('0x10')]);router['post']('/',auth[_0x2db2('0x6')](),controller[_0x2db2('0x11')]);router['post']('/:id/teams',auth[_0x2db2('0x6')](),controller[_0x2db2('0x12')]);router[_0x2db2('0x13')]('/:id/users',auth[_0x2db2('0x6')](),controller[_0x2db2('0x14')]);router[_0x2db2('0x15')](_0x2db2('0xa'),auth[_0x2db2('0x6')](),controller['update']);router[_0x2db2('0x16')]('/:id',auth[_0x2db2('0x6')](),controller[_0x2db2('0x17')]);router[_0x2db2('0x16')](_0x2db2('0xd'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x2db2('0x16')]('/:id/users',auth[_0x2db2('0x6')](),controller[_0x2db2('0x18')]);module[_0x2db2('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 8867775..575f9b5 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 _0xd573=['INTEGER','ENUM','roundrobin','sequelize','STRING','name'];(function(_0x12c034,_0x2559e2){var _0x1f3434=function(_0x1c286c){while(--_0x1c286c){_0x12c034['push'](_0x12c034['shift']());}};_0x1f3434(++_0x2559e2);}(_0xd573,0x105));var _0x3d57=function(_0x205fa3,_0x147053){_0x205fa3=_0x205fa3-0x0;var _0x2c19fa=_0xd573[_0x205fa3];return _0x2c19fa;};'use strict';var Sequelize=require(_0x3d57('0x0'));module['exports']={'name':{'type':Sequelize[_0x3d57('0x1')],'unique':_0x3d57('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3d57('0x1')]},'timeout':{'type':Sequelize[_0x3d57('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3d57('0x4')]('rrmemory','beepall',_0x3d57('0x5'))}}; \ No newline at end of file +var _0x8666=['name','INTEGER','ENUM','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x269459,_0x40d131){var _0x408bfc=function(_0x591526){while(--_0x591526){_0x269459['push'](_0x269459['shift']());}};_0x408bfc(++_0x40d131);}(_0x8666,0x15d));var _0x6866=function(_0x126a52,_0x260dd4){_0x126a52=_0x126a52-0x0;var _0x3ae233=_0x8666[_0x126a52];return _0x3ae233;};'use strict';var Sequelize=require(_0x6866('0x0'));module[_0x6866('0x1')]={'name':{'type':Sequelize[_0x6866('0x2')],'unique':_0x6866('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6866('0x2')]},'timeout':{'type':Sequelize[_0x6866('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6866('0x5')]('rrmemory',_0x6866('0x6'),_0x6866('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 484dcee..6a65d59 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 _0x5f66=['show','params','model','keys','intersection','attributes','fields','includeAll','merge','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','rawAttributes','filters','hasOwnProperty','order','sort','pick','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','length','filter','nolimit','ids','Team','Agents','interface','flatMap','sequelize','transaction','addTeams','forEach','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','includes','all','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','isArray','findOne','getAgents','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','./smsQueue.socket','register','end','json','offset','limit','undefined','count','status','update','then','UserProfileResource','destroy','sendStatus','stack','name','send','index','fieldName','key','getOptions','where','SmsQueue','include','query','findAll','catch'];(function(_0x5a9e32,_0x3197fd){var _0x521b3f=function(_0x55f4f9){while(--_0x55f4f9){_0x5a9e32['push'](_0x5a9e32['shift']());}};_0x521b3f(++_0x3197fd);}(_0x5f66,0x1a0));var _0x65f6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5f66[_0x126558];return _0x1f6d14;};'use strict';var BPromise=require('bluebird');var util=require(_0x65f6('0x0'));var _=require('lodash');var squel=require(_0x65f6('0x1'));var Redis=require(_0x65f6('0x2'));var qs=require(_0x65f6('0x3'));var logger=require(_0x65f6('0x4'))(_0x65f6('0x5'));var config=require('../../config/environment');var db=require(_0x65f6('0x6'))['db'];config['redis']=_[_0x65f6('0x7')](config[_0x65f6('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x65f6('0x8')]));require(_0x65f6('0x9'))[_0x65f6('0xa')](socket);function respondWithStatusCode(_0x8f6451,_0xc44c70){_0xc44c70=_0xc44c70||0xcc;return function(_0x14f4c7){if(_0x14f4c7){return _0x8f6451['sendStatus'](_0xc44c70);}return _0x8f6451['status'](_0xc44c70)[_0x65f6('0xb')]();};}function respondWithResult(_0x2f6d5b,_0x264647){_0x264647=_0x264647||0xc8;return function(_0x25c416){if(_0x25c416){return _0x2f6d5b['status'](_0x264647)[_0x65f6('0xc')](_0x25c416);}};}function respondWithFilteredResult(_0x571436,_0x497cf3){return function(_0x2d2dfa){if(_0x2d2dfa){var _0x576875=typeof _0x497cf3[_0x65f6('0xd')]==='undefined'&&typeof _0x497cf3[_0x65f6('0xe')]===_0x65f6('0xf');var _0x2c4ee5=_0x2d2dfa[_0x65f6('0x10')];var _0x369f96=_0x576875?0x0:_0x497cf3[_0x65f6('0xd')];var _0x44144b=_0x576875?_0x2d2dfa[_0x65f6('0x10')]:_0x497cf3[_0x65f6('0xd')]+_0x497cf3[_0x65f6('0xe')];var _0x59154e;if(_0x44144b>=_0x2c4ee5){_0x44144b=_0x2c4ee5;_0x59154e=0xc8;}else{_0x59154e=0xce;}_0x571436[_0x65f6('0x11')](_0x59154e);return _0x571436['set']('Content-Range',_0x369f96+'-'+_0x44144b+'/'+_0x2c4ee5)[_0x65f6('0xc')](_0x2d2dfa);}return null;};}function saveUpdates(_0x5c69f8){return function(_0x37330d){if(_0x37330d){return _0x37330d[_0x65f6('0x12')](_0x5c69f8)[_0x65f6('0x13')](function(_0x1f974c){return _0x1f974c;});}return null;};}function removeEntity(_0xc8660c){return function(_0x18380e){if(_0x18380e){return _0x18380e['destroy']()['then'](function(){var _0x2d538c=_0x18380e['get']({'plain':!![]});var _0x4c81f3='SmsQueues';return db[_0x65f6('0x14')][_0x65f6('0x15')]({'where':{'type':_0x4c81f3,'resourceId':_0x2d538c['id']}})['then'](function(){return _0x18380e;});})[_0x65f6('0x13')](function(){_0xc8660c[_0x65f6('0x11')](0xcc)[_0x65f6('0xb')]();});}};}function handleEntityNotFound(_0x3876ed){return function(_0x219ab2){if(!_0x219ab2){_0x3876ed[_0x65f6('0x16')](0x194);}return _0x219ab2;};}function handleError(_0x581374,_0x197a49){_0x197a49=_0x197a49||0x1f4;return function(_0x4bb39e){logger['error'](_0x4bb39e[_0x65f6('0x17')]);if(_0x4bb39e[_0x65f6('0x18')]){delete _0x4bb39e['name'];}_0x581374[_0x65f6('0x11')](_0x197a49)[_0x65f6('0x19')](_0x4bb39e);};}exports[_0x65f6('0x1a')]=function(_0x2774a1,_0x4f5a69){var _0x9d7bb0={};var _0x59ea32={'count':0x0,'rows':[]};var _0x20a161=_['map'](db['SmsQueue']['rawAttributes'],function(_0x29abdb){return{'name':_0x29abdb[_0x65f6('0x1b')],'type':_0x29abdb['type'][_0x65f6('0x1c')]};});_0x9d7bb0=qs[_0x65f6('0x1d')](_0x20a161,_0x2774a1);var _0x52277c={'where':_0x9d7bb0[_0x65f6('0x1e')]};return db[_0x65f6('0x1f')][_0x65f6('0x10')](_0x52277c)['then'](function(_0x4ac04b){_0x59ea32['count']=_0x4ac04b;_0x9d7bb0[_0x65f6('0x20')]=qs[_0x65f6('0x20')](_0x2774a1[_0x65f6('0x21')]);return db[_0x65f6('0x1f')][_0x65f6('0x22')](_0x9d7bb0);})[_0x65f6('0x13')](function(_0x144e55){_0x59ea32['rows']=_0x144e55;return _0x59ea32;})['then'](respondWithFilteredResult(_0x4f5a69,_0x9d7bb0))[_0x65f6('0x23')](handleError(_0x4f5a69,null));};exports[_0x65f6('0x24')]=function(_0x5878bc,_0x4e50c0){var _0x10b368={'raw':!![],'where':{'id':_0x5878bc[_0x65f6('0x25')]['id']}},_0x1ce43c={};_0x1ce43c[_0x65f6('0x26')]=_[_0x65f6('0x27')](db[_0x65f6('0x1f')]['rawAttributes']);_0x1ce43c[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x5878bc[_0x65f6('0x21')]);_0x1ce43c['filters']=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],_0x1ce43c[_0x65f6('0x21')]);_0x10b368[_0x65f6('0x29')]=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],qs['fields'](_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x10b368['attributes']=_0x10b368[_0x65f6('0x29')]['length']?_0x10b368[_0x65f6('0x29')]:_0x1ce43c['model'];if(_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2b')]){_0x10b368['include']=[{'all':!![]}];}_0x10b368=_[_0x65f6('0x2c')]({},_0x10b368,_0x5878bc[_0x65f6('0x2d')]);return db[_0x65f6('0x1f')]['find'](_0x10b368)['then'](handleEntityNotFound(_0x4e50c0,null))[_0x65f6('0x13')](respondWithResult(_0x4e50c0,null))['catch'](handleError(_0x4e50c0,null));};exports[_0x65f6('0x2e')]=function(_0x4e6653,_0x22d760){return db[_0x65f6('0x1f')]['create'](_0x4e6653[_0x65f6('0x2f')],{})['then'](function(_0x5edd04){var _0x71b16b=_0x4e6653[_0x65f6('0x30')][_0x65f6('0x31')]({'plain':!![]});if(!_0x71b16b)throw new Error(_0x65f6('0x32'));if(_0x71b16b[_0x65f6('0x33')]===_0x65f6('0x30')){var _0x1a55da=_0x5edd04[_0x65f6('0x31')]({'plain':!![]});var _0x4f933b=_0x65f6('0x34');return db['UserProfileSection'][_0x65f6('0x35')]({'where':{'name':_0x4f933b,'userProfileId':_0x71b16b[_0x65f6('0x36')]},'raw':!![]})[_0x65f6('0x13')](function(_0x2ea7f7){if(_0x2ea7f7&&_0x2ea7f7['autoAssociation']===0x0){return db[_0x65f6('0x14')][_0x65f6('0x2e')]({'name':_0x1a55da[_0x65f6('0x18')],'resourceId':_0x1a55da['id'],'type':_0x2ea7f7[_0x65f6('0x18')],'sectionId':_0x2ea7f7['id']},{})[_0x65f6('0x13')](function(){return _0x5edd04;});}else{return _0x5edd04;}})[_0x65f6('0x23')](function(_0xed4c96){logger[_0x65f6('0x37')](_0x65f6('0x38'),_0xed4c96);throw _0xed4c96;});}return _0x5edd04;})['then'](respondWithResult(_0x22d760,0xc9))[_0x65f6('0x23')](handleError(_0x22d760,null));};exports[_0x65f6('0x12')]=function(_0x377ae5,_0x181798){if(_0x377ae5[_0x65f6('0x2f')]['id']){delete _0x377ae5[_0x65f6('0x2f')]['id'];}return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x377ae5[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x181798,null))[_0x65f6('0x13')](saveUpdates(_0x377ae5[_0x65f6('0x2f')],null))[_0x65f6('0x13')](respondWithResult(_0x181798,null))[_0x65f6('0x23')](handleError(_0x181798,null));};exports[_0x65f6('0x15')]=function(_0x2cb38d,_0x5119ee){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x2cb38d[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x5119ee,null))['then'](removeEntity(_0x5119ee,null))[_0x65f6('0x23')](handleError(_0x5119ee,null));};exports[_0x65f6('0x39')]=function(_0x2b01eb,_0x5e69b4){return db[_0x65f6('0x1f')][_0x65f6('0x39')]()[_0x65f6('0x13')](respondWithResult(_0x5e69b4,null))[_0x65f6('0x23')](handleError(_0x5e69b4,null));};exports['getMembers']=function(_0x2ec114,_0x512527){var _0x3f1baa={'raw':!![],'where':{}},_0x6968b={},_0x577c93;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x2ec114[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x512527,null))[_0x65f6('0x13')](function(_0xc0db01){if(_0xc0db01){_0x577c93=_0xc0db01[_0x65f6('0x31')]({'plain':!![]});_0x6968b[_0x65f6('0x26')]=_['keys'](db['UserSmsQueue'][_0x65f6('0x3a')]);_0x6968b[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x2ec114[_0x65f6('0x21')]);_0x6968b[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x6968b[_0x65f6('0x26')],_0x6968b[_0x65f6('0x21')]);_0x3f1baa[_0x65f6('0x29')]=_['intersection'](_0x6968b[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x2ec114[_0x65f6('0x21')]['fields']));_0x3f1baa[_0x65f6('0x29')]=_0x3f1baa[_0x65f6('0x29')]['length']?_0x3f1baa[_0x65f6('0x29')]:_0x6968b[_0x65f6('0x26')];if(!_0x2ec114['query'][_0x65f6('0x3c')]('nolimit')){_0x3f1baa[_0x65f6('0xe')]=qs[_0x65f6('0xe')](_0x2ec114[_0x65f6('0x21')]['limit']);_0x3f1baa[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x2ec114['query'][_0x65f6('0xd')]);}_0x3f1baa[_0x65f6('0x3d')]=qs['sort'](_0x2ec114[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x3f1baa[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x2ec114[_0x65f6('0x21')],_0x6968b[_0x65f6('0x3b')]));_0x3f1baa[_0x65f6('0x1e')]['SmsQueueId']=_0xc0db01['id'];if(_0x2ec114['query']['filter']){_0x3f1baa[_0x65f6('0x1e')]=_[_0x65f6('0x2c')](_0x3f1baa[_0x65f6('0x1e')],{'$or':_[_0x65f6('0x40')](_0x3f1baa['attributes'],function(_0x183c08){var _0x2032b9={};_0x2032b9[_0x183c08]={'$like':'%'+_0x2ec114[_0x65f6('0x21')]['filter']+'%'};return _0x2032b9;})});}_0x3f1baa=_[_0x65f6('0x2c')]({},_0x3f1baa,_0x2ec114[_0x65f6('0x2d')]);return db[_0x65f6('0x41')]['findAll'](_0x3f1baa);}})['then'](function(_0x1d337d){if(_0x1d337d){return db[_0x65f6('0x42')][_0x65f6('0x43')]({'where':{'id':_[_0x65f6('0x40')](_0x1d337d,_0x65f6('0x44')),'role':_0x65f6('0x45')},'attributes':['id',_0x65f6('0x18'),_0x65f6('0x46'),_0x65f6('0x47'),_0x65f6('0x48')]});}})[_0x65f6('0x13')](function(_0x141fcc){if(_0x141fcc){return{'count':_0x141fcc[_0x65f6('0x10')],'rows':_[_0x65f6('0x40')](_0x141fcc['rows'],function(_0x47610a){return{'membername':_0x47610a[_0x65f6('0x18')],'UserId':_0x47610a['id'],'queue_name':_0x577c93[_0x65f6('0x18')],'SmsQueueId':_0x577c93['id'],'interface':util['format'](_0x65f6('0x49'),_0x65f6('0x4a'),_0x47610a[_0x65f6('0x18')]),'penalty':0x0,'paused':_0x47610a[_0x65f6('0x46')],'createdAt':_0x47610a['createdAt'],'updatedAt':_0x47610a[_0x65f6('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x65f6('0x13')](respondWithFilteredResult(_0x512527,_0x3f1baa))[_0x65f6('0x23')](handleError(_0x512527,null));};exports[_0x65f6('0x4b')]=function(_0x553ff0,_0x2923ff){var _0x2fc20f={};var _0x5c55e4={};var _0x28682b;var _0x26481e;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x553ff0[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x2923ff,null))[_0x65f6('0x13')](function(_0x3c23e3){if(_0x3c23e3){_0x28682b=_0x3c23e3;_0x5c55e4[_0x65f6('0x26')]=_[_0x65f6('0x27')](db['Team']['rawAttributes']);_0x5c55e4['query']=_[_0x65f6('0x27')](_0x553ff0[_0x65f6('0x21')]);_0x5c55e4[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],_0x5c55e4[_0x65f6('0x21')]);_0x2fc20f['attributes']=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],qs['fields'](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x2fc20f[_0x65f6('0x29')]=_0x2fc20f['attributes'][_0x65f6('0x4c')]?_0x2fc20f[_0x65f6('0x29')]:_0x5c55e4['model'];_0x2fc20f[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x2fc20f[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x553ff0['query'],_0x5c55e4['filters']));if(_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x2fc20f['where']=_[_0x65f6('0x2c')](_0x2fc20f['where'],{'$or':_[_0x65f6('0x40')](_0x2fc20f['attributes'],function(_0x440df1){var _0xdc8989={};_0xdc8989[_0x440df1]={'$like':'%'+_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0xdc8989;})});}_0x2fc20f=_[_0x65f6('0x2c')]({},_0x2fc20f,_0x553ff0[_0x65f6('0x2d')]);return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})[_0x65f6('0x13')](function(_0x2405a7){if(_0x2405a7){_0x26481e=_0x2405a7['length'];if(!_0x553ff0['query'][_0x65f6('0x3c')](_0x65f6('0x4e'))){_0x2fc20f[_0x65f6('0xe')]=qs['limit'](_0x553ff0['query'][_0x65f6('0xe')]);_0x2fc20f[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0xd')]);}return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})['then'](function(_0x4f42ae){if(_0x4f42ae){return _0x4f42ae?{'count':_0x26481e,'rows':_0x4f42ae}:null;}})[_0x65f6('0x13')](respondWithResult(_0x2923ff,null))[_0x65f6('0x23')](handleError(_0x2923ff,null));};exports['addTeams']=function(_0x219bf8,_0x4a8b60){var _0x254e9f=_0x219bf8[_0x65f6('0x2f')][_0x65f6('0x4f')];return db[_0x65f6('0x50')]['findAll']({'where':{'id':_0x254e9f},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id',_0x65f6('0x18'),'online','voicePause',_0x65f6('0x52')],'raw':!![]}]})['then'](function(_0x305967){if(_0x305967){var _0xf6de=_[_0x65f6('0x53')](_0x305967,function(_0x354b90){var _0x512776=_0x354b90['get']({'plain':!![]});return _0x512776['Agents'];});return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x219bf8[_0x65f6('0x25')]['id']}})['then'](function(_0x46cbde){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x49cee2){return _0x46cbde[_0x65f6('0x56')](_0x254e9f,{'transaction':_0x49cee2})[_0x65f6('0x13')](function(){return BPromise['each'](_0xf6de,function(_0x758e80){return db[_0x65f6('0x41')]['findOrCreate']({'where':{'UserId':_0x758e80['id'],'SmsQueueId':_0x219bf8[_0x65f6('0x25')]['id']},'transaction':_0x49cee2});});})['then'](function(){_0xf6de[_0x65f6('0x57')](function(_0x55ea91){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':_0x55ea91['id'],'SmsQueueId':_0x46cbde['id']});});});});});}})['then'](respondWithStatusCode(_0x4a8b60,null))[_0x65f6('0x23')](handleError(_0x4a8b60,null));};exports[_0x65f6('0x5a')]=function(_0x2a700b,_0x299b85){return db[_0x65f6('0x50')][_0x65f6('0x22')]({'where':{'id':_0x2a700b[_0x65f6('0x21')][_0x65f6('0x4f')]},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id'],'raw':!![]}]})[_0x65f6('0x13')](handleEntityNotFound(_0x299b85,null))['then'](function(_0x10a661){var _0x1cf1bd=_[_0x65f6('0x40')](_0x10a661,'id');var _0x219e42=[];var _0x5694f9=[];var _0x453080=squel[_0x65f6('0x5b')]();_0x453080['field'](_0x65f6('0x5c'))['from'](_0x65f6('0x5d'),'tq')['join'](_0x65f6('0x5e'),'ut',_0x65f6('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x2a700b[_0x65f6('0x25')]['id']);for(var _0x413c21=0x0;_0x413c21<_0x10a661['length'];_0x413c21+=0x1){let _0x2d86c8=_0x10a661[_0x413c21];for(var _0x3b3bd5=0x0;_0x3b3bd5<_0x2d86c8[_0x65f6('0x51')]['length'];_0x3b3bd5+=0x1){let _0x1348ec=_0x2d86c8[_0x65f6('0x51')][_0x3b3bd5];var _0x5889dc=_0x453080[_0x65f6('0x60')]();_0x5889dc['where'](_0x65f6('0x61'),_0x1348ec['id']);_0x5694f9['push'](db['sequelize'][_0x65f6('0x21')](_0x5889dc[_0x65f6('0x62')](),{'type':db[_0x65f6('0x54')][_0x65f6('0x63')][_0x65f6('0x64')]})[_0x65f6('0x13')](function(_0x1ac46f){if(_0x1ac46f[_0x65f6('0x4c')]===0x1){return _0x1348ec['id'];}else{var _0x4d66fe=_['every'](_[_0x65f6('0x40')](_0x1ac46f,'TeamId'),function(_0x1ee28a){return _[_0x65f6('0x65')](_0x1cf1bd,_0x1ee28a);});if(_0x4d66fe){return _0x1348ec['id'];}}}));}}return BPromise[_0x65f6('0x66')](_0x5694f9)[_0x65f6('0x13')](function(_0x43127b){_0x219e42=_(_0x219e42)['union'](_0x43127b)[_0x65f6('0x67')]()[_0x65f6('0x68')]();return db[_0x65f6('0x1f')]['find']({'where':{'id':_0x2a700b[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](function(_0x4254c2){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x16bf93){return _0x4254c2['removeTeams'](_0x2a700b['query'][_0x65f6('0x4f')],{'transaction':_0x16bf93})[_0x65f6('0x13')](function(){if(!_[_0x65f6('0x69')](_0x219e42)){return _0x4254c2[_0x65f6('0x6a')](_0x219e42,{'transaction':_0x16bf93});}})['then'](function(){_0x219e42['forEach'](function(_0x336076){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':_0x336076,'SmsQueueId':_0x4254c2['id']});});});});});});})[_0x65f6('0x13')](respondWithStatusCode(_0x299b85,null))[_0x65f6('0x23')](handleError(_0x299b85,null));};exports[_0x65f6('0x6c')]=function(_0x5daaf4,_0x4d607a){return db['SmsQueue'][_0x65f6('0x35')]({'where':{'id':_0x5daaf4[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x4d607a,null))[_0x65f6('0x13')](function(_0x53b11c){if(_0x53b11c){return _0x53b11c['addAgents'](_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')],_['omit'](_0x5daaf4[_0x65f6('0x2f')],['ids','id'])||{})[_0x65f6('0x6d')](function(_0x4f3ef8){for(var _0x3a30ed=0x0;_0x3a30ed<_0x5daaf4[_0x65f6('0x2f')]['ids'][_0x65f6('0x4c')];_0x3a30ed+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':Number(_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')][_0x3a30ed]),'SmsQueueId':Number(_0x5daaf4[_0x65f6('0x25')]['id'])});}return _0x4f3ef8;});}})['then'](respondWithResult(_0x4d607a,null))[_0x65f6('0x23')](handleError(_0x4d607a,null));};exports['removeAgents']=function(_0x24495c,_0x56336a){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x24495c[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x56336a,null))['then'](function(_0x2b6f98){if(_0x2b6f98){return _0x2b6f98[_0x65f6('0x6a')](_0x24495c[_0x65f6('0x21')]['ids'])['then'](function(){if(_[_0x65f6('0x6e')](_0x24495c[_0x65f6('0x21')]['ids'])){for(var _0x180cde=0x0;_0x180cde<_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]['length'];_0x180cde+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':Number(_0x24495c['query'][_0x65f6('0x4f')][_0x180cde]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}}else{socket[_0x65f6('0x58')]('userSmsQueue:remove',{'UserId':Number(_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}});}})['then'](respondWithStatusCode(_0x56336a,null))[_0x65f6('0x23')](handleError(_0x56336a,null));};exports['getAgents']=function(_0x1beaa7,_0x87a9e4){var _0x31ec61={};var _0x22be6e={};var _0x29b2de;var _0x430fb8;return db['SmsQueue'][_0x65f6('0x6f')]({'where':{'id':_0x1beaa7[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x87a9e4,null))[_0x65f6('0x13')](function(_0x207d15){if(_0x207d15){_0x29b2de=_0x207d15;_0x22be6e['model']=_['keys'](db['User'][_0x65f6('0x3a')]);_0x22be6e[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x1beaa7['query']);_0x22be6e[_0x65f6('0x3b')]=_['intersection'](_0x22be6e['model'],_0x22be6e[_0x65f6('0x21')]);_0x31ec61[_0x65f6('0x29')]=_['intersection'](_0x22be6e[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x31ec61[_0x65f6('0x29')]=_0x31ec61[_0x65f6('0x29')][_0x65f6('0x4c')]?_0x31ec61[_0x65f6('0x29')]:_0x22be6e[_0x65f6('0x26')];_0x31ec61[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x1beaa7[_0x65f6('0x21')]['sort']);_0x31ec61[_0x65f6('0x1e')]=qs['filters'](_['pick'](_0x1beaa7[_0x65f6('0x21')],_0x22be6e[_0x65f6('0x3b')]));if(_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x31ec61['where']=_[_0x65f6('0x2c')](_0x31ec61['where'],{'$or':_['map'](_0x31ec61[_0x65f6('0x29')],function(_0x99fe6e){var _0x1a7e52={};_0x1a7e52[_0x99fe6e]={'$like':'%'+_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0x1a7e52;})});}_0x31ec61=_[_0x65f6('0x2c')]({},_0x31ec61,_0x1beaa7['options']);return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})['then'](function(_0x1ef2a0){if(_0x1ef2a0){_0x430fb8=_0x1ef2a0[_0x65f6('0x4c')];if(!_0x1beaa7[_0x65f6('0x21')]['hasOwnProperty'](_0x65f6('0x4e'))){_0x31ec61['limit']=qs['limit'](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0xe')]);_0x31ec61[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x1beaa7[_0x65f6('0x21')]['offset']);}return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})[_0x65f6('0x13')](function(_0x3bebe3){if(_0x3bebe3){return _0x3bebe3?{'count':_0x430fb8,'rows':_0x3bebe3}:null;}})[_0x65f6('0x13')](respondWithResult(_0x87a9e4,null))['catch'](handleError(_0x87a9e4,null));}; \ No newline at end of file +var _0x2032=['offset','limit','set','Content-Range','json','update','then','get','SmsQueues','UserProfileResource','destroy','error','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','getOptions','where','include','query','rows','show','keys','filters','intersection','attributes','model','fields','options','find','catch','body','user','UserProfileSection','autoAssociation','params','describe','findOne','UserSmsQueue','hasOwnProperty','order','sort','SmsQueueId','filter','merge','findAll','User','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','pick','nolimit','addTeams','Agents','online','voicePause','interface','sequelize','each','findOrCreate','forEach','userSmsQueue:save','removeTeams','ids','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','length','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','value','transaction','isEmpty','emit','userSmsQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','util','lodash','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','end','status','count'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x2032,0xd9));var _0x2203=function(_0x4938c4,_0x14e1ab){_0x4938c4=_0x4938c4-0x0;var _0x26f147=_0x2032[_0x4938c4];return _0x26f147;};'use strict';var BPromise=require('bluebird');var util=require(_0x2203('0x0'));var _=require(_0x2203('0x1'));var squel=require(_0x2203('0x2'));var Redis=require('ioredis');var qs=require(_0x2203('0x3'));var logger=require(_0x2203('0x4'))('api');var config=require(_0x2203('0x5'));var db=require(_0x2203('0x6'))['db'];config[_0x2203('0x7')]=_[_0x2203('0x8')](config[_0x2203('0x7')],{'host':_0x2203('0x9'),'port':0x18eb});var socket=require(_0x2203('0xa'))(new Redis(config[_0x2203('0x7')]));require(_0x2203('0xb'))[_0x2203('0xc')](socket);function respondWithStatusCode(_0x2999ed,_0x5ecf9e){_0x5ecf9e=_0x5ecf9e||0xcc;return function(_0x526ae0){if(_0x526ae0){return _0x2999ed[_0x2203('0xd')](_0x5ecf9e);}return _0x2999ed['status'](_0x5ecf9e)[_0x2203('0xe')]();};}function respondWithResult(_0x2972f3,_0x6339c4){_0x6339c4=_0x6339c4||0xc8;return function(_0x5b19df){if(_0x5b19df){return _0x2972f3[_0x2203('0xf')](_0x6339c4)['json'](_0x5b19df);}};}function respondWithFilteredResult(_0x3f690a,_0x4b73be){return function(_0x297459){if(_0x297459){var _0x1abb51=typeof _0x4b73be['offset']==='undefined'&&typeof _0x4b73be['limit']==='undefined';var _0x4bad7c=_0x297459[_0x2203('0x10')];var _0x538b30=_0x1abb51?0x0:_0x4b73be['offset'];var _0x21a3af=_0x1abb51?_0x297459[_0x2203('0x10')]:_0x4b73be[_0x2203('0x11')]+_0x4b73be[_0x2203('0x12')];var _0x226209;if(_0x21a3af>=_0x4bad7c){_0x21a3af=_0x4bad7c;_0x226209=0xc8;}else{_0x226209=0xce;}_0x3f690a[_0x2203('0xf')](_0x226209);return _0x3f690a[_0x2203('0x13')](_0x2203('0x14'),_0x538b30+'-'+_0x21a3af+'/'+_0x4bad7c)[_0x2203('0x15')](_0x297459);}return null;};}function saveUpdates(_0x3053f3){return function(_0x5129fb){if(_0x5129fb){return _0x5129fb[_0x2203('0x16')](_0x3053f3)[_0x2203('0x17')](function(_0x4893ff){return _0x4893ff;});}return null;};}function removeEntity(_0x3f9ef6){return function(_0x8906e1){if(_0x8906e1){return _0x8906e1['destroy']()[_0x2203('0x17')](function(){var _0x5ee83c=_0x8906e1[_0x2203('0x18')]({'plain':!![]});var _0x310b8c=_0x2203('0x19');return db[_0x2203('0x1a')][_0x2203('0x1b')]({'where':{'type':_0x310b8c,'resourceId':_0x5ee83c['id']}})[_0x2203('0x17')](function(){return _0x8906e1;});})['then'](function(){_0x3f9ef6[_0x2203('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ac866){return function(_0x15f543){if(!_0x15f543){_0x5ac866['sendStatus'](0x194);}return _0x15f543;};}function handleError(_0x3b8ef9,_0x5bfe61){_0x5bfe61=_0x5bfe61||0x1f4;return function(_0x5d4c4e){logger[_0x2203('0x1c')](_0x5d4c4e['stack']);if(_0x5d4c4e['name']){delete _0x5d4c4e[_0x2203('0x1d')];}_0x3b8ef9[_0x2203('0xf')](_0x5bfe61)[_0x2203('0x1e')](_0x5d4c4e);};}exports[_0x2203('0x1f')]=function(_0x1244f4,_0x3114ef){var _0x49c12={};var _0x250349={'count':0x0,'rows':[]};var _0x576378=_[_0x2203('0x20')](db[_0x2203('0x21')][_0x2203('0x22')],function(_0x5f11bf){return{'name':_0x5f11bf[_0x2203('0x23')],'type':_0x5f11bf[_0x2203('0x24')]['key']};});_0x49c12=qs[_0x2203('0x25')](_0x576378,_0x1244f4);var _0xd91f5d={'where':_0x49c12[_0x2203('0x26')]};return db[_0x2203('0x21')][_0x2203('0x10')](_0xd91f5d)[_0x2203('0x17')](function(_0x9c53f){_0x250349['count']=_0x9c53f;_0x49c12[_0x2203('0x27')]=qs[_0x2203('0x27')](_0x1244f4[_0x2203('0x28')]);return db[_0x2203('0x21')]['findAll'](_0x49c12);})[_0x2203('0x17')](function(_0x21ff0d){_0x250349[_0x2203('0x29')]=_0x21ff0d;return _0x250349;})[_0x2203('0x17')](respondWithFilteredResult(_0x3114ef,_0x49c12))['catch'](handleError(_0x3114ef,null));};exports[_0x2203('0x2a')]=function(_0x50aa17,_0x5e6560){var _0x5c0157={'raw':!![],'where':{'id':_0x50aa17['params']['id']}},_0x1d5f74={};_0x1d5f74['model']=_[_0x2203('0x2b')](db[_0x2203('0x21')][_0x2203('0x22')]);_0x1d5f74[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x50aa17['query']);_0x1d5f74[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x1d5f74['model'],_0x1d5f74[_0x2203('0x28')]);_0x5c0157[_0x2203('0x2e')]=_[_0x2203('0x2d')](_0x1d5f74[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x50aa17[_0x2203('0x28')][_0x2203('0x30')]));_0x5c0157[_0x2203('0x2e')]=_0x5c0157[_0x2203('0x2e')]['length']?_0x5c0157[_0x2203('0x2e')]:_0x1d5f74[_0x2203('0x2f')];if(_0x50aa17['query']['includeAll']){_0x5c0157[_0x2203('0x27')]=[{'all':!![]}];}_0x5c0157=_['merge']({},_0x5c0157,_0x50aa17[_0x2203('0x31')]);return db[_0x2203('0x21')][_0x2203('0x32')](_0x5c0157)['then'](handleEntityNotFound(_0x5e6560,null))['then'](respondWithResult(_0x5e6560,null))[_0x2203('0x33')](handleError(_0x5e6560,null));};exports['create']=function(_0x2d0365,_0x5cfe5e){return db[_0x2203('0x21')]['create'](_0x2d0365[_0x2203('0x34')],{})[_0x2203('0x17')](function(_0x4311d1){var _0x40a793=_0x2d0365[_0x2203('0x35')]['get']({'plain':!![]});if(!_0x40a793)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40a793['role']===_0x2203('0x35')){var _0x25a2dc=_0x4311d1[_0x2203('0x18')]({'plain':!![]});var _0x3b0c7a=_0x2203('0x19');return db[_0x2203('0x36')][_0x2203('0x32')]({'where':{'name':_0x3b0c7a,'userProfileId':_0x40a793['userProfileId']},'raw':!![]})[_0x2203('0x17')](function(_0x1b12c3){if(_0x1b12c3&&_0x1b12c3[_0x2203('0x37')]===0x0){return db[_0x2203('0x1a')]['create']({'name':_0x25a2dc['name'],'resourceId':_0x25a2dc['id'],'type':_0x1b12c3[_0x2203('0x1d')],'sectionId':_0x1b12c3['id']},{})['then'](function(){return _0x4311d1;});}else{return _0x4311d1;}})[_0x2203('0x33')](function(_0x446209){logger[_0x2203('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x446209);throw _0x446209;});}return _0x4311d1;})['then'](respondWithResult(_0x5cfe5e,0xc9))[_0x2203('0x33')](handleError(_0x5cfe5e,null));};exports[_0x2203('0x16')]=function(_0x368444,_0x1e09f3){if(_0x368444[_0x2203('0x34')]['id']){delete _0x368444[_0x2203('0x34')]['id'];}return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x368444[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x1e09f3,null))[_0x2203('0x17')](saveUpdates(_0x368444[_0x2203('0x34')],null))[_0x2203('0x17')](respondWithResult(_0x1e09f3,null))[_0x2203('0x33')](handleError(_0x1e09f3,null));};exports[_0x2203('0x1b')]=function(_0x36b8e4,_0x1e34a0){return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x36b8e4[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x1e34a0,null))[_0x2203('0x17')](removeEntity(_0x1e34a0,null))['catch'](handleError(_0x1e34a0,null));};exports['describe']=function(_0x1c6661,_0x48129c){return db[_0x2203('0x21')][_0x2203('0x39')]()[_0x2203('0x17')](respondWithResult(_0x48129c,null))[_0x2203('0x33')](handleError(_0x48129c,null));};exports['getMembers']=function(_0x289146,_0x102803){var _0x5cd8c6={'raw':!![],'where':{}},_0x29bd91={},_0x381b3e;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x289146['params']['id']}})['then'](handleEntityNotFound(_0x102803,null))[_0x2203('0x17')](function(_0x5707c8){if(_0x5707c8){_0x381b3e=_0x5707c8['get']({'plain':!![]});_0x29bd91[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x3b')]['rawAttributes']);_0x29bd91['query']=_[_0x2203('0x2b')](_0x289146[_0x2203('0x28')]);_0x29bd91[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x29bd91[_0x2203('0x2f')],_0x29bd91[_0x2203('0x28')]);_0x5cd8c6['attributes']=_[_0x2203('0x2d')](_0x29bd91['model'],qs[_0x2203('0x30')](_0x289146[_0x2203('0x28')][_0x2203('0x30')]));_0x5cd8c6[_0x2203('0x2e')]=_0x5cd8c6['attributes']['length']?_0x5cd8c6[_0x2203('0x2e')]:_0x29bd91[_0x2203('0x2f')];if(!_0x289146[_0x2203('0x28')][_0x2203('0x3c')]('nolimit')){_0x5cd8c6['limit']=qs['limit'](_0x289146[_0x2203('0x28')][_0x2203('0x12')]);_0x5cd8c6['offset']=qs[_0x2203('0x11')](_0x289146[_0x2203('0x28')]['offset']);}_0x5cd8c6[_0x2203('0x3d')]=qs[_0x2203('0x3e')](_0x289146[_0x2203('0x28')][_0x2203('0x3e')]);_0x5cd8c6['where']=qs[_0x2203('0x2c')](_['pick'](_0x289146[_0x2203('0x28')],_0x29bd91[_0x2203('0x2c')]));_0x5cd8c6['where'][_0x2203('0x3f')]=_0x5707c8['id'];if(_0x289146[_0x2203('0x28')][_0x2203('0x40')]){_0x5cd8c6[_0x2203('0x26')]=_[_0x2203('0x41')](_0x5cd8c6[_0x2203('0x26')],{'$or':_['map'](_0x5cd8c6['attributes'],function(_0x2f2537){var _0x524356={};_0x524356[_0x2f2537]={'$like':'%'+_0x289146['query'][_0x2203('0x40')]+'%'};return _0x524356;})});}_0x5cd8c6=_[_0x2203('0x41')]({},_0x5cd8c6,_0x289146[_0x2203('0x31')]);return db['UserSmsQueue'][_0x2203('0x42')](_0x5cd8c6);}})['then'](function(_0x5ddf9e){if(_0x5ddf9e){return db[_0x2203('0x43')]['findAndCountAll']({'where':{'id':_['map'](_0x5ddf9e,'UserId'),'role':_0x2203('0x44')},'attributes':['id',_0x2203('0x1d'),_0x2203('0x45'),_0x2203('0x46'),_0x2203('0x47')]});}})[_0x2203('0x17')](function(_0x2baea2){if(_0x2baea2){return{'count':_0x2baea2[_0x2203('0x10')],'rows':_[_0x2203('0x20')](_0x2baea2[_0x2203('0x29')],function(_0x384a59){return{'membername':_0x384a59[_0x2203('0x1d')],'UserId':_0x384a59['id'],'queue_name':_0x381b3e['name'],'SmsQueueId':_0x381b3e['id'],'interface':util['format'](_0x2203('0x48'),_0x2203('0x49'),_0x384a59[_0x2203('0x1d')]),'penalty':0x0,'paused':_0x384a59[_0x2203('0x45')],'createdAt':_0x384a59[_0x2203('0x47')],'updatedAt':_0x384a59[_0x2203('0x46')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x102803,_0x5cd8c6))['catch'](handleError(_0x102803,null));};exports[_0x2203('0x4a')]=function(_0x34358e,_0x21ee59){var _0x1e6d21={};var _0xcab922={};var _0x7b0b9c;var _0x133d22;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x34358e[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x21ee59,null))['then'](function(_0x1ea97a){if(_0x1ea97a){_0x7b0b9c=_0x1ea97a;_0xcab922[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x4b')][_0x2203('0x22')]);_0xcab922[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x34358e[_0x2203('0x28')]);_0xcab922[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0xcab922[_0x2203('0x2f')],_0xcab922[_0x2203('0x28')]);_0x1e6d21[_0x2203('0x2e')]=_[_0x2203('0x2d')](_0xcab922[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x34358e[_0x2203('0x28')][_0x2203('0x30')]));_0x1e6d21[_0x2203('0x2e')]=_0x1e6d21[_0x2203('0x2e')]['length']?_0x1e6d21[_0x2203('0x2e')]:_0xcab922[_0x2203('0x2f')];_0x1e6d21[_0x2203('0x3d')]=qs['sort'](_0x34358e[_0x2203('0x28')][_0x2203('0x3e')]);_0x1e6d21[_0x2203('0x26')]=qs[_0x2203('0x2c')](_[_0x2203('0x4c')](_0x34358e['query'],_0xcab922[_0x2203('0x2c')]));if(_0x34358e[_0x2203('0x28')][_0x2203('0x40')]){_0x1e6d21['where']=_['merge'](_0x1e6d21['where'],{'$or':_['map'](_0x1e6d21['attributes'],function(_0x418d48){var _0xbc9f88={};_0xbc9f88[_0x418d48]={'$like':'%'+_0x34358e[_0x2203('0x28')][_0x2203('0x40')]+'%'};return _0xbc9f88;})});}_0x1e6d21=_[_0x2203('0x41')]({},_0x1e6d21,_0x34358e[_0x2203('0x31')]);return _0x7b0b9c[_0x2203('0x4a')](_0x1e6d21);}})[_0x2203('0x17')](function(_0x56dcbe){if(_0x56dcbe){_0x133d22=_0x56dcbe['length'];if(!_0x34358e[_0x2203('0x28')][_0x2203('0x3c')](_0x2203('0x4d'))){_0x1e6d21[_0x2203('0x12')]=qs[_0x2203('0x12')](_0x34358e[_0x2203('0x28')][_0x2203('0x12')]);_0x1e6d21[_0x2203('0x11')]=qs[_0x2203('0x11')](_0x34358e[_0x2203('0x28')][_0x2203('0x11')]);}return _0x7b0b9c[_0x2203('0x4a')](_0x1e6d21);}})[_0x2203('0x17')](function(_0xae45a5){if(_0xae45a5){return _0xae45a5?{'count':_0x133d22,'rows':_0xae45a5}:null;}})[_0x2203('0x17')](respondWithResult(_0x21ee59,null))[_0x2203('0x33')](handleError(_0x21ee59,null));};exports[_0x2203('0x4e')]=function(_0x173ac1,_0xa15021){var _0x4b2e4f=_0x173ac1[_0x2203('0x34')]['ids'];return db[_0x2203('0x4b')]['findAll']({'where':{'id':_0x4b2e4f},'attributes':['id'],'include':[{'model':db[_0x2203('0x43')],'as':_0x2203('0x4f'),'attributes':['id',_0x2203('0x1d'),_0x2203('0x50'),_0x2203('0x51'),_0x2203('0x52')],'raw':!![]}]})[_0x2203('0x17')](function(_0x2eab08){if(_0x2eab08){var _0x4e9a01=_['flatMap'](_0x2eab08,function(_0x38903b){var _0x34593a=_0x38903b[_0x2203('0x18')]({'plain':!![]});return _0x34593a['Agents'];});return db['SmsQueue']['find']({'where':{'id':_0x173ac1[_0x2203('0x38')]['id']}})[_0x2203('0x17')](function(_0x20385b){return db[_0x2203('0x53')]['transaction'](function(_0x2f7850){return _0x20385b['addTeams'](_0x4b2e4f,{'transaction':_0x2f7850})[_0x2203('0x17')](function(){return BPromise[_0x2203('0x54')](_0x4e9a01,function(_0xe3bee5){return db[_0x2203('0x3b')][_0x2203('0x55')]({'where':{'UserId':_0xe3bee5['id'],'SmsQueueId':_0x173ac1['params']['id']},'transaction':_0x2f7850});});})[_0x2203('0x17')](function(){_0x4e9a01[_0x2203('0x56')](function(_0x18663f){socket['emit'](_0x2203('0x57'),{'UserId':_0x18663f['id'],'SmsQueueId':_0x20385b['id']});});});});});}})[_0x2203('0x17')](respondWithStatusCode(_0xa15021,null))[_0x2203('0x33')](handleError(_0xa15021,null));};exports[_0x2203('0x58')]=function(_0x1c65f9,_0x4356fe){return db[_0x2203('0x4b')][_0x2203('0x42')]({'where':{'id':_0x1c65f9[_0x2203('0x28')][_0x2203('0x59')]},'attributes':['id'],'include':[{'model':db[_0x2203('0x43')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2203('0x17')](handleEntityNotFound(_0x4356fe,null))[_0x2203('0x17')](function(_0x21b755){var _0x2da37c=_[_0x2203('0x20')](_0x21b755,'id');var _0x52c35e=[];var _0x23f7b1=[];var _0x2a5a4b=squel[_0x2203('0x5a')]();_0x2a5a4b[_0x2203('0x5b')](_0x2203('0x5c'))[_0x2203('0x5d')]('team_has_sms_queues','tq')['join'](_0x2203('0x5e'),'ut',_0x2203('0x5f'))[_0x2203('0x26')](_0x2203('0x60'),_0x1c65f9[_0x2203('0x38')]['id']);for(var _0x4fd029=0x0;_0x4fd029<_0x21b755[_0x2203('0x61')];_0x4fd029+=0x1){let _0x3cb792=_0x21b755[_0x4fd029];for(var _0x4e539b=0x0;_0x4e539b<_0x3cb792['Agents']['length'];_0x4e539b+=0x1){let _0x4fc51a=_0x3cb792['Agents'][_0x4e539b];var _0x2952fc=_0x2a5a4b[_0x2203('0x62')]();_0x2952fc[_0x2203('0x26')]('ut.UserId\x20=\x20?',_0x4fc51a['id']);_0x23f7b1['push'](db['sequelize'][_0x2203('0x28')](_0x2952fc[_0x2203('0x63')](),{'type':db[_0x2203('0x53')][_0x2203('0x64')][_0x2203('0x65')]})[_0x2203('0x17')](function(_0x3d1797){if(_0x3d1797['length']===0x1){return _0x4fc51a['id'];}else{var _0x3bf2c9=_[_0x2203('0x66')](_[_0x2203('0x20')](_0x3d1797,_0x2203('0x67')),function(_0x35ff6b){return _[_0x2203('0x68')](_0x2da37c,_0x35ff6b);});if(_0x3bf2c9){return _0x4fc51a['id'];}}}));}}return BPromise[_0x2203('0x69')](_0x23f7b1)['then'](function(_0x188722){_0x52c35e=_(_0x52c35e)['union'](_0x188722)['compact']()[_0x2203('0x6a')]();return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x1c65f9[_0x2203('0x38')]['id']}})['then'](function(_0x29d545){return db[_0x2203('0x53')][_0x2203('0x6b')](function(_0x461f90){return _0x29d545[_0x2203('0x58')](_0x1c65f9[_0x2203('0x28')]['ids'],{'transaction':_0x461f90})[_0x2203('0x17')](function(){if(!_[_0x2203('0x6c')](_0x52c35e)){return _0x29d545['removeAgents'](_0x52c35e,{'transaction':_0x461f90});}})['then'](function(){_0x52c35e[_0x2203('0x56')](function(_0x3fe71b){socket[_0x2203('0x6d')](_0x2203('0x6e'),{'UserId':_0x3fe71b,'SmsQueueId':_0x29d545['id']});});});});});});})[_0x2203('0x17')](respondWithStatusCode(_0x4356fe,null))[_0x2203('0x33')](handleError(_0x4356fe,null));};exports[_0x2203('0x6f')]=function(_0x3c41bf,_0x4749df){return db[_0x2203('0x21')][_0x2203('0x32')]({'where':{'id':_0x3c41bf[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x4749df,null))[_0x2203('0x17')](function(_0x7589a7){if(_0x7589a7){return _0x7589a7[_0x2203('0x6f')](_0x3c41bf['body']['ids'],_[_0x2203('0x70')](_0x3c41bf[_0x2203('0x34')],['ids','id'])||{})[_0x2203('0x71')](function(_0x447a95){for(var _0x5b5e95=0x0;_0x5b5e95<_0x3c41bf[_0x2203('0x34')][_0x2203('0x59')]['length'];_0x5b5e95+=0x1){socket[_0x2203('0x6d')](_0x2203('0x57'),{'UserId':Number(_0x3c41bf['body'][_0x2203('0x59')][_0x5b5e95]),'SmsQueueId':Number(_0x3c41bf[_0x2203('0x38')]['id'])});}return _0x447a95;});}})[_0x2203('0x17')](respondWithResult(_0x4749df,null))[_0x2203('0x33')](handleError(_0x4749df,null));};exports['removeAgents']=function(_0x511c66,_0x2df837){return db[_0x2203('0x21')][_0x2203('0x32')]({'where':{'id':_0x511c66['params']['id']}})['then'](handleEntityNotFound(_0x2df837,null))[_0x2203('0x17')](function(_0x199bec){if(_0x199bec){return _0x199bec[_0x2203('0x72')](_0x511c66['query']['ids'])[_0x2203('0x17')](function(){if(_[_0x2203('0x73')](_0x511c66['query'][_0x2203('0x59')])){for(var _0x2de64d=0x0;_0x2de64d<_0x511c66['query'][_0x2203('0x59')]['length'];_0x2de64d+=0x1){socket[_0x2203('0x6d')]('userSmsQueue:remove',{'UserId':Number(_0x511c66['query']['ids'][_0x2de64d]),'SmsQueueId':Number(_0x511c66[_0x2203('0x38')]['id'])});}}else{socket[_0x2203('0x6d')]('userSmsQueue:remove',{'UserId':Number(_0x511c66[_0x2203('0x28')][_0x2203('0x59')]),'SmsQueueId':Number(_0x511c66[_0x2203('0x38')]['id'])});}});}})['then'](respondWithStatusCode(_0x2df837,null))[_0x2203('0x33')](handleError(_0x2df837,null));};exports['getAgents']=function(_0x3f31e0,_0x3edb38){var _0x486563={};var _0x4358c1={};var _0x4096f4;var _0x5bd4e4;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x3f31e0[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x3edb38,null))[_0x2203('0x17')](function(_0x5d73a7){if(_0x5d73a7){_0x4096f4=_0x5d73a7;_0x4358c1[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x43')][_0x2203('0x22')]);_0x4358c1[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x3f31e0['query']);_0x4358c1[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x4358c1['model'],_0x4358c1[_0x2203('0x28')]);_0x486563['attributes']=_[_0x2203('0x2d')](_0x4358c1[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x3f31e0['query'][_0x2203('0x30')]));_0x486563[_0x2203('0x2e')]=_0x486563[_0x2203('0x2e')][_0x2203('0x61')]?_0x486563[_0x2203('0x2e')]:_0x4358c1[_0x2203('0x2f')];_0x486563[_0x2203('0x3d')]=qs['sort'](_0x3f31e0['query'][_0x2203('0x3e')]);_0x486563[_0x2203('0x26')]=qs[_0x2203('0x2c')](_[_0x2203('0x4c')](_0x3f31e0[_0x2203('0x28')],_0x4358c1[_0x2203('0x2c')]));if(_0x3f31e0[_0x2203('0x28')]['filter']){_0x486563[_0x2203('0x26')]=_[_0x2203('0x41')](_0x486563['where'],{'$or':_[_0x2203('0x20')](_0x486563['attributes'],function(_0xc3dac5){var _0xbd1866={};_0xbd1866[_0xc3dac5]={'$like':'%'+_0x3f31e0['query'][_0x2203('0x40')]+'%'};return _0xbd1866;})});}_0x486563=_[_0x2203('0x41')]({},_0x486563,_0x3f31e0[_0x2203('0x31')]);return _0x4096f4[_0x2203('0x74')](_0x486563);}})[_0x2203('0x17')](function(_0x36ab7f){if(_0x36ab7f){_0x5bd4e4=_0x36ab7f[_0x2203('0x61')];if(!_0x3f31e0[_0x2203('0x28')][_0x2203('0x3c')](_0x2203('0x4d'))){_0x486563[_0x2203('0x12')]=qs[_0x2203('0x12')](_0x3f31e0['query'][_0x2203('0x12')]);_0x486563['offset']=qs[_0x2203('0x11')](_0x3f31e0[_0x2203('0x28')][_0x2203('0x11')]);}return _0x4096f4[_0x2203('0x74')](_0x486563);}})[_0x2203('0x17')](function(_0x2159a5){if(_0x2159a5){return _0x2159a5?{'count':_0x5bd4e4,'rows':_0x2159a5}:null;}})[_0x2203('0x17')](respondWithResult(_0x3edb38,null))[_0x2203('0x33')](handleError(_0x3edb38,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index e986493..0278e66 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 _0x8c30=['emit','hasOwnProperty','hook','events','SmsQueue','setMaxListeners','save','update','remove'];(function(_0x1e8b1e,_0x407bbd){var _0x4a0fde=function(_0x4fd2be){while(--_0x4fd2be){_0x1e8b1e['push'](_0x1e8b1e['shift']());}};_0x4a0fde(++_0x407bbd);}(_0x8c30,0x18f));var _0x08c3=function(_0x14d515,_0x13abf5){_0x14d515=_0x14d515-0x0;var _0x4a4258=_0x8c30[_0x14d515];return _0x4a4258;};'use strict';var EventEmitter=require(_0x08c3('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x08c3('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x08c3('0x2')](0x0);var events={'afterCreate':_0x08c3('0x3'),'afterUpdate':_0x08c3('0x4'),'afterDestroy':_0x08c3('0x5')};function emitEvent(_0x39b539){return function(_0x399d76,_0x356f75,_0x299384){SmsQueueEvents['emit'](_0x39b539+':'+_0x399d76['id'],_0x399d76);SmsQueueEvents[_0x08c3('0x6')](_0x39b539,_0x399d76);_0x299384(null);};}for(var e in events){if(events[_0x08c3('0x7')](e)){var event=events[e];SmsQueue[_0x08c3('0x8')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x4da2=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x154931,_0x31855f){var _0x4044c4=function(_0x1fdcce){while(--_0x1fdcce){_0x154931['push'](_0x154931['shift']());}};_0x4044c4(++_0x31855f);}(_0x4da2,0xe9));var _0x24da=function(_0x3d58a0,_0x22e3ac){_0x3d58a0=_0x3d58a0-0x0;var _0x578656=_0x4da2[_0x3d58a0];return _0x578656;};'use strict';var EventEmitter=require(_0x24da('0x0'));var SmsQueue=require(_0x24da('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x24da('0x2')](0x0);var events={'afterCreate':_0x24da('0x3'),'afterUpdate':_0x24da('0x4'),'afterDestroy':_0x24da('0x5')};function emitEvent(_0x5e080c){return function(_0x5be647,_0x1fe5f3,_0x34ac88){SmsQueueEvents[_0x24da('0x6')](_0x5e080c+':'+_0x5be647['id'],_0x5be647);SmsQueueEvents[_0x24da('0x6')](_0x5e080c,_0x5be647);_0x34ac88(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x24da('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index c5ed80e..6c4565d 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 _0x2fc3=['request-promise','path','../../config/environment','./smsQueue.attributes','exports','define','sms_queues','util','../../config/logger','moment'];(function(_0x55bd10,_0xe4c71f){var _0x25057a=function(_0x4ac3f0){while(--_0x4ac3f0){_0x55bd10['push'](_0x55bd10['shift']());}};_0x25057a(++_0xe4c71f);}(_0x2fc3,0x147));var _0x32fc=function(_0x3d3cb1,_0x221263){_0x3d3cb1=_0x3d3cb1-0x0;var _0x1f4353=_0x2fc3[_0x3d3cb1];return _0x1f4353;};'use strict';var _=require('lodash');var util=require(_0x32fc('0x0'));var logger=require(_0x32fc('0x1'))('api');var moment=require(_0x32fc('0x2'));var BPromise=require('bluebird');var rp=require(_0x32fc('0x3'));var fs=require('fs');var path=require(_0x32fc('0x4'));var rimraf=require('rimraf');var config=require(_0x32fc('0x5'));var attributes=require(_0x32fc('0x6'));module[_0x32fc('0x7')]=function(_0x20fe22,_0x1daf5b){return _0x20fe22[_0x32fc('0x8')]('SmsQueue',attributes,{'tableName':_0x32fc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd691=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x2f3b6e,_0x234eb0){var _0x532318=function(_0x5dbc1e){while(--_0x5dbc1e){_0x2f3b6e['push'](_0x2f3b6e['shift']());}};_0x532318(++_0x234eb0);}(_0xd691,0xcd));var _0x1d69=function(_0x5a6e32,_0x573b46){_0x5a6e32=_0x5a6e32-0x0;var _0x168e07=_0xd691[_0x5a6e32];return _0x168e07;};'use strict';var _=require(_0x1d69('0x0'));var util=require(_0x1d69('0x1'));var logger=require(_0x1d69('0x2'))(_0x1d69('0x3'));var moment=require(_0x1d69('0x4'));var BPromise=require(_0x1d69('0x5'));var rp=require(_0x1d69('0x6'));var fs=require('fs');var path=require(_0x1d69('0x7'));var rimraf=require(_0x1d69('0x8'));var config=require(_0x1d69('0x9'));var attributes=require(_0x1d69('0xa'));module[_0x1d69('0xb')]=function(_0x3a7abe,_0x27f826){return _0x3a7abe[_0x1d69('0xc')]('SmsQueue',attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index d1c950e..72fb49c 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 _0xe56c=['error','code','message','info','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','include','model','map','find','ShowSmsQueue','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsQueue.socket','register','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x1b70e3,_0x3a15b1){var _0x1452ab=function(_0x692883){while(--_0x692883){_0x1b70e3['push'](_0x1b70e3['shift']());}};_0x1452ab(++_0x3a15b1);}(_0xe56c,0x84));var _0xce56=function(_0x2cc7f2,_0x546901){_0x2cc7f2=_0x2cc7f2-0x0;var _0x395840=_0xe56c[_0x2cc7f2];return _0x395840;};'use strict';var _=require('lodash');var util=require(_0xce56('0x0'));var moment=require(_0xce56('0x1'));var BPromise=require(_0xce56('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xce56('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xce56('0x4'));var logger=require('../../config/logger')(_0xce56('0x5'));var config=require(_0xce56('0x6'));var jayson=require(_0xce56('0x7'));var client=jayson[_0xce56('0x8')][_0xce56('0x9')]({'port':0x232a});config[_0xce56('0xa')]=_['defaults'](config[_0xce56('0xa')],{'host':_0xce56('0xb'),'port':0x18eb});var socket=require(_0xce56('0xc'))(new Redis(config['redis']));require(_0xce56('0xd'))[_0xce56('0xe')](socket);function respondWithRpcPromise(_0x199221,_0x3b7143,_0x24480a){return new BPromise(function(_0x1e8a52,_0x29f177){return client['request'](_0x199221,_0x24480a)[_0xce56('0xf')](function(_0x4f4162){logger['info'](_0xce56('0x10'),_0x3b7143,_0xce56('0x11'));logger[_0xce56('0x12')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x3b7143,'request\x20sent',JSON[_0xce56('0x13')](_0x4f4162));if(_0x4f4162['error']){if(_0x4f4162[_0xce56('0x14')][_0xce56('0x15')]===0x1f4){logger[_0xce56('0x14')](_0xce56('0x10'),_0x3b7143,_0x4f4162['error']['message']);return _0x29f177(_0x4f4162['error']['message']);}logger[_0xce56('0x14')](_0xce56('0x10'),_0x3b7143,_0x4f4162['error']['message']);return _0x1e8a52(_0x4f4162['error'][_0xce56('0x16')]);}else{logger[_0xce56('0x17')](_0xce56('0x10'),_0x3b7143,_0xce56('0x11'));_0x1e8a52(_0x4f4162[_0xce56('0x18')][_0xce56('0x16')]);}})[_0xce56('0x19')](function(_0x3f65c8){logger['error']('SmsQueue,\x20%s,\x20%s',_0x3b7143,_0x3f65c8);_0x29f177(_0x3f65c8);});});}exports[_0xce56('0x1a')]=function(_0x4abff7){var _0x12a811=this;return new Promise(function(_0x4080d6,_0x308454){return db[_0xce56('0x1b')][_0xce56('0x1c')]({'raw':_0x4abff7['options']?_0x4abff7[_0xce56('0x1d')][_0xce56('0x1e')]===undefined?!![]:![]:!![],'where':_0x4abff7[_0xce56('0x1d')]?_0x4abff7[_0xce56('0x1d')][_0xce56('0x1f')]||null:null,'attributes':_0x4abff7['options']?_0x4abff7[_0xce56('0x1d')][_0xce56('0x20')]||null:null,'limit':_0x4abff7[_0xce56('0x1d')]?_0x4abff7['options']['limit']||null:null,'include':_0x4abff7[_0xce56('0x1d')]?_0x4abff7[_0xce56('0x1d')][_0xce56('0x21')]?_['map'](_0x4abff7['options'][_0xce56('0x21')],function(_0x18a696){return{'model':db[_0x18a696[_0xce56('0x22')]],'as':_0x18a696['as'],'attributes':_0x18a696[_0xce56('0x20')],'include':_0x18a696[_0xce56('0x21')]?_[_0xce56('0x23')](_0x18a696[_0xce56('0x21')],function(_0x67030f){return{'model':db[_0x67030f['model']],'as':_0x67030f['as'],'attributes':_0x67030f[_0xce56('0x20')],'include':_0x67030f['include']?_[_0xce56('0x23')](_0x67030f['include'],function(_0x4a973f){return{'model':db[_0x4a973f['model']],'as':_0x4a973f['as'],'attributes':_0x4a973f[_0xce56('0x20')]};}):[]};}):[]};}):[]:[]})[_0xce56('0xf')](function(_0x3a0163){logger['info'](_0xce56('0x1a'),_0x4abff7);logger[_0xce56('0x12')](_0xce56('0x1a'),_0x4abff7,JSON['stringify'](_0x3a0163));_0x4080d6(_0x3a0163);})[_0xce56('0x19')](function(_0x3aa8ba){logger['error'](_0xce56('0x1a'),_0x3aa8ba[_0xce56('0x16')],_0x4abff7);_0x308454(_0x12a811['error'](0x1f4,_0x3aa8ba[_0xce56('0x16')]));});});};exports['ShowSmsQueue']=function(_0x50181d){var _0x4e0ad7=this;return new Promise(function(_0x553be1,_0x25ead2){return db[_0xce56('0x1b')][_0xce56('0x24')]({'raw':_0x50181d[_0xce56('0x1d')]?_0x50181d[_0xce56('0x1d')][_0xce56('0x1e')]===undefined?!![]:![]:!![],'where':_0x50181d[_0xce56('0x1d')]?_0x50181d[_0xce56('0x1d')][_0xce56('0x1f')]||null:null,'attributes':_0x50181d[_0xce56('0x1d')]?_0x50181d[_0xce56('0x1d')][_0xce56('0x20')]||null:null,'include':_0x50181d[_0xce56('0x1d')]?_0x50181d[_0xce56('0x1d')][_0xce56('0x21')]?_[_0xce56('0x23')](_0x50181d[_0xce56('0x1d')]['include'],function(_0x30727c){return{'model':db[_0x30727c[_0xce56('0x22')]],'as':_0x30727c['as'],'attributes':_0x30727c['attributes'],'include':_0x30727c[_0xce56('0x21')]?_['map'](_0x30727c['include'],function(_0x36158b){return{'model':db[_0x36158b[_0xce56('0x22')]],'as':_0x36158b['as'],'attributes':_0x36158b['attributes'],'include':_0x36158b[_0xce56('0x21')]?_[_0xce56('0x23')](_0x36158b[_0xce56('0x21')],function(_0xc4dafc){return{'model':db[_0xc4dafc[_0xce56('0x22')]],'as':_0xc4dafc['as'],'attributes':_0xc4dafc[_0xce56('0x20')]};}):[]};}):[]};}):[]:[]})[_0xce56('0xf')](function(_0x1c2daa){logger[_0xce56('0x17')](_0xce56('0x25'),_0x50181d);logger[_0xce56('0x12')](_0xce56('0x25'),_0x50181d,JSON[_0xce56('0x13')](_0x1c2daa));_0x553be1(_0x1c2daa);})[_0xce56('0x19')](function(_0x2f1975){logger['error'](_0xce56('0x25'),_0x2f1975['message'],_0x50181d);_0x25ead2(_0x4e0ad7[_0xce56('0x14')](0x1f4,_0x2f1975['message']));});});}; \ No newline at end of file +var _0x5e79=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsQueue','findAll','options','raw','attributes','limit','include','model','map','GetSmsQueue','find','where','ShowSmsQueue','lodash'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5e79,0x1eb));var _0x95e7=function(_0x1f5102,_0x601f96){_0x1f5102=_0x1f5102-0x0;var _0x4f5545=_0x5e79[_0x1f5102];return _0x4f5545;};'use strict';var _=require(_0x95e7('0x0'));var util=require(_0x95e7('0x1'));var moment=require('moment');var BPromise=require(_0x95e7('0x2'));var rs=require(_0x95e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x95e7('0x4'))['db'];var utils=require(_0x95e7('0x5'));var logger=require(_0x95e7('0x6'))('rpc');var config=require(_0x95e7('0x7'));var jayson=require(_0x95e7('0x8'));var client=jayson[_0x95e7('0x9')][_0x95e7('0xa')]({'port':0x232a});config[_0x95e7('0xb')]=_[_0x95e7('0xc')](config[_0x95e7('0xb')],{'host':_0x95e7('0xd'),'port':0x18eb});var socket=require(_0x95e7('0xe'))(new Redis(config[_0x95e7('0xb')]));require('./smsQueue.socket')[_0x95e7('0xf')](socket);function respondWithRpcPromise(_0x237383,_0x3485a4,_0x119d21){return new BPromise(function(_0x6e572b,_0x2fe6f2){return client['request'](_0x237383,_0x119d21)[_0x95e7('0x10')](function(_0x631662){logger[_0x95e7('0x11')](_0x95e7('0x12'),_0x3485a4,_0x95e7('0x13'));logger[_0x95e7('0x14')](_0x95e7('0x15'),_0x3485a4,_0x95e7('0x13'),JSON[_0x95e7('0x16')](_0x631662));if(_0x631662['error']){if(_0x631662[_0x95e7('0x17')][_0x95e7('0x18')]===0x1f4){logger['error'](_0x95e7('0x12'),_0x3485a4,_0x631662[_0x95e7('0x17')][_0x95e7('0x19')]);return _0x2fe6f2(_0x631662[_0x95e7('0x17')][_0x95e7('0x19')]);}logger[_0x95e7('0x17')]('SmsQueue,\x20%s,\x20%s',_0x3485a4,_0x631662['error']['message']);return _0x6e572b(_0x631662['error'][_0x95e7('0x19')]);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x3485a4,_0x95e7('0x13'));_0x6e572b(_0x631662[_0x95e7('0x1a')][_0x95e7('0x19')]);}})[_0x95e7('0x1b')](function(_0x590314){logger[_0x95e7('0x17')]('SmsQueue,\x20%s,\x20%s',_0x3485a4,_0x590314);_0x2fe6f2(_0x590314);});});}exports['GetSmsQueue']=function(_0x2e15c3){var _0x1bb80c=this;return new Promise(function(_0x4aaa19,_0x587061){return db[_0x95e7('0x1c')][_0x95e7('0x1d')]({'raw':_0x2e15c3[_0x95e7('0x1e')]?_0x2e15c3[_0x95e7('0x1e')][_0x95e7('0x1f')]===undefined?!![]:![]:!![],'where':_0x2e15c3['options']?_0x2e15c3[_0x95e7('0x1e')]['where']||null:null,'attributes':_0x2e15c3[_0x95e7('0x1e')]?_0x2e15c3[_0x95e7('0x1e')][_0x95e7('0x20')]||null:null,'limit':_0x2e15c3[_0x95e7('0x1e')]?_0x2e15c3['options'][_0x95e7('0x21')]||null:null,'include':_0x2e15c3[_0x95e7('0x1e')]?_0x2e15c3[_0x95e7('0x1e')][_0x95e7('0x22')]?_['map'](_0x2e15c3['options'][_0x95e7('0x22')],function(_0x3a1866){return{'model':db[_0x3a1866[_0x95e7('0x23')]],'as':_0x3a1866['as'],'attributes':_0x3a1866[_0x95e7('0x20')],'include':_0x3a1866[_0x95e7('0x22')]?_[_0x95e7('0x24')](_0x3a1866[_0x95e7('0x22')],function(_0x4df553){return{'model':db[_0x4df553[_0x95e7('0x23')]],'as':_0x4df553['as'],'attributes':_0x4df553['attributes'],'include':_0x4df553['include']?_[_0x95e7('0x24')](_0x4df553['include'],function(_0x50b4fd){return{'model':db[_0x50b4fd['model']],'as':_0x50b4fd['as'],'attributes':_0x50b4fd[_0x95e7('0x20')]};}):[]};}):[]};}):[]:[]})[_0x95e7('0x10')](function(_0xe9285c){logger[_0x95e7('0x11')](_0x95e7('0x25'),_0x2e15c3);logger[_0x95e7('0x14')](_0x95e7('0x25'),_0x2e15c3,JSON[_0x95e7('0x16')](_0xe9285c));_0x4aaa19(_0xe9285c);})[_0x95e7('0x1b')](function(_0x5321be){logger['error'](_0x95e7('0x25'),_0x5321be['message'],_0x2e15c3);_0x587061(_0x1bb80c[_0x95e7('0x17')](0x1f4,_0x5321be[_0x95e7('0x19')]));});});};exports['ShowSmsQueue']=function(_0xb55834){var _0x2a93c7=this;return new Promise(function(_0x472a61,_0x4637f7){return db[_0x95e7('0x1c')][_0x95e7('0x26')]({'raw':_0xb55834[_0x95e7('0x1e')]?_0xb55834[_0x95e7('0x1e')][_0x95e7('0x1f')]===undefined?!![]:![]:!![],'where':_0xb55834['options']?_0xb55834[_0x95e7('0x1e')][_0x95e7('0x27')]||null:null,'attributes':_0xb55834[_0x95e7('0x1e')]?_0xb55834[_0x95e7('0x1e')][_0x95e7('0x20')]||null:null,'include':_0xb55834[_0x95e7('0x1e')]?_0xb55834[_0x95e7('0x1e')][_0x95e7('0x22')]?_[_0x95e7('0x24')](_0xb55834[_0x95e7('0x1e')][_0x95e7('0x22')],function(_0x568cfe){return{'model':db[_0x568cfe[_0x95e7('0x23')]],'as':_0x568cfe['as'],'attributes':_0x568cfe[_0x95e7('0x20')],'include':_0x568cfe['include']?_[_0x95e7('0x24')](_0x568cfe[_0x95e7('0x22')],function(_0x5cb140){return{'model':db[_0x5cb140[_0x95e7('0x23')]],'as':_0x5cb140['as'],'attributes':_0x5cb140[_0x95e7('0x20')],'include':_0x5cb140[_0x95e7('0x22')]?_[_0x95e7('0x24')](_0x5cb140[_0x95e7('0x22')],function(_0x1d601c){return{'model':db[_0x1d601c[_0x95e7('0x23')]],'as':_0x1d601c['as'],'attributes':_0x1d601c[_0x95e7('0x20')]};}):[]};}):[]};}):[]:[]})[_0x95e7('0x10')](function(_0x58d505){logger[_0x95e7('0x11')](_0x95e7('0x28'),_0xb55834);logger[_0x95e7('0x14')](_0x95e7('0x28'),_0xb55834,JSON['stringify'](_0x58d505));_0x472a61(_0x58d505);})[_0x95e7('0x1b')](function(_0x49bc2c){logger[_0x95e7('0x17')](_0x95e7('0x28'),_0x49bc2c[_0x95e7('0x19')],_0xb55834);_0x4637f7(_0x2a93c7['error'](0x1f4,_0x49bc2c[_0x95e7('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 2cfbecc..167791c 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 _0x7304=['remove','removeListener','register','length','smsQueue:','./smsQueue.events','save'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x7304,0x1da));var _0x4730=function(_0x845505,_0x19e5f3){_0x845505=_0x845505-0x0;var _0x2513b9=_0x7304[_0x845505];return _0x2513b9;};'use strict';var SmsQueueEvents=require(_0x4730('0x0'));var events=[_0x4730('0x1'),_0x4730('0x2'),'update'];function createListener(_0x1ae1d5,_0x17999c){return function(_0x572517){_0x17999c['emit'](_0x1ae1d5,_0x572517);};}function removeListener(_0x15a6a6,_0x3594fd){return function(){SmsQueueEvents[_0x4730('0x3')](_0x15a6a6,_0x3594fd);};}exports[_0x4730('0x4')]=function(_0x3eeb5c){for(var _0x5ee127=0x0,_0x333ef3=events[_0x4730('0x5')];_0x5ee127<_0x333ef3;_0x5ee127++){var _0x117c22=events[_0x5ee127];var _0x229b30=createListener(_0x4730('0x6')+_0x117c22,_0x3eeb5c);SmsQueueEvents['on'](_0x117c22,_0x229b30);}}; \ No newline at end of file +var _0x9631=['emit','removeListener','register','length','smsQueue:','./smsQueue.events','remove','update'];(function(_0x469106,_0x245827){var _0x3caff1=function(_0x50faa4){while(--_0x50faa4){_0x469106['push'](_0x469106['shift']());}};_0x3caff1(++_0x245827);}(_0x9631,0x1a5));var _0x1963=function(_0x5927ba,_0x34792d){_0x5927ba=_0x5927ba-0x0;var _0x1975d6=_0x9631[_0x5927ba];return _0x1975d6;};'use strict';var SmsQueueEvents=require(_0x1963('0x0'));var events=['save',_0x1963('0x1'),_0x1963('0x2')];function createListener(_0x5501c9,_0x47fc64){return function(_0x1180a4){_0x47fc64[_0x1963('0x3')](_0x5501c9,_0x1180a4);};}function removeListener(_0xaa8726,_0x5605e1){return function(){SmsQueueEvents[_0x1963('0x4')](_0xaa8726,_0x5605e1);};}exports[_0x1963('0x5')]=function(_0x1395f2){for(var _0x36d86d=0x0,_0x5424ba=events[_0x1963('0x6')];_0x36d86d<_0x5424ba;_0x36d86d++){var _0x4c9eb3=events[_0x36d86d];var _0x3ca458=createListener(_0x1963('0x7')+_0x4c9eb3,_0x1395f2);SmsQueueEvents['on'](_0x4c9eb3,_0x3ca458);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 849d2a1..dab52d9 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 _0xb190=['delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','get','isAuthenticated','index','/describe','/:id','show','post','create','update'];(function(_0x28c9f2,_0x19cab5){var _0x2333d1=function(_0x15c122){while(--_0x15c122){_0x28c9f2['push'](_0x28c9f2['shift']());}};_0x2333d1(++_0x19cab5);}(_0xb190,0xce));var _0x0b19=function(_0x401189,_0x41600c){_0x401189=_0x401189-0x0;var _0x1cb062=_0xb190[_0x401189];return _0x1cb062;};'use strict';var multer=require(_0x0b19('0x0'));var util=require(_0x0b19('0x1'));var path=require(_0x0b19('0x2'));var timeout=require(_0x0b19('0x3'));var express=require('express');var router=express[_0x0b19('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0b19('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router[_0x0b19('0x6')]('/',auth[_0x0b19('0x7')](),controller[_0x0b19('0x8')]);router['get'](_0x0b19('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x0b19('0xa'),auth[_0x0b19('0x7')](),controller[_0x0b19('0xb')]);router[_0x0b19('0xc')]('/',auth[_0x0b19('0x7')](),controller[_0x0b19('0xd')]);router['put'](_0x0b19('0xa'),auth[_0x0b19('0x7')](),controller[_0x0b19('0xe')]);router[_0x0b19('0xf')]('/:id',auth[_0x0b19('0x7')](),controller['destroy']);module[_0x0b19('0x10')]=router; \ No newline at end of file +var _0xc57c=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc57c,0x9f));var _0xcc57=function(_0x3acbc1,_0x129107){_0x3acbc1=_0x3acbc1-0x0;var _0x3f66df=_0xc57c[_0x3acbc1];return _0x3f66df;};'use strict';var multer=require(_0xcc57('0x0'));var util=require('util');var path=require(_0xcc57('0x1'));var timeout=require(_0xcc57('0x2'));var express=require(_0xcc57('0x3'));var router=express[_0xcc57('0x4')]();var fs_extra=require(_0xcc57('0x5'));var auth=require(_0xcc57('0x6'));var interaction=require(_0xcc57('0x7'));var config=require(_0xcc57('0x8'));var controller=require(_0xcc57('0x9'));router['get']('/',auth[_0xcc57('0xa')](),controller[_0xcc57('0xb')]);router['get'](_0xcc57('0xc'),auth[_0xcc57('0xa')](),controller[_0xcc57('0xd')]);router['get'](_0xcc57('0xe'),auth[_0xcc57('0xa')](),controller[_0xcc57('0xf')]);router[_0xcc57('0x10')]('/',auth[_0xcc57('0xa')](),controller[_0xcc57('0x11')]);router[_0xcc57('0x12')]('/:id',auth[_0xcc57('0xa')](),controller[_0xcc57('0x13')]);router[_0xcc57('0x14')](_0xcc57('0xe'),auth[_0xcc57('0xa')](),controller[_0xcc57('0x15')]);module[_0xcc57('0x16')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index f61d425..0256cd8 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 _0xdf67=['sequelize','exports','STRING','DATE','moment'];(function(_0x1d8ffe,_0x56b8c1){var _0x2c56ae=function(_0x43d452){while(--_0x43d452){_0x1d8ffe['push'](_0x1d8ffe['shift']());}};_0x2c56ae(++_0x56b8c1);}(_0xdf67,0x117));var _0x7df6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf67[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x7df6('0x0'));var Sequelize=require(_0x7df6('0x1'));module[_0x7df6('0x2')]={'uniqueid':{'type':Sequelize[_0x7df6('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x7df6('0x4')]},'leaveAt':{'type':Sequelize[_0x7df6('0x4')]},'acceptAt':{'type':Sequelize[_0x7df6('0x4')]},'exitAt':{'type':Sequelize[_0x7df6('0x4')]},'reason':{'type':Sequelize[_0x7df6('0x3')]}}; \ No newline at end of file +var _0x3757=['sequelize','exports','STRING','DATE'];(function(_0x119cd8,_0x556b73){var _0x7072a3=function(_0x5908d1){while(--_0x5908d1){_0x119cd8['push'](_0x119cd8['shift']());}};_0x7072a3(++_0x556b73);}(_0x3757,0xf8));var _0x7375=function(_0xb5779a,_0x2ef35a){_0xb5779a=_0xb5779a-0x0;var _0x17602f=_0x3757[_0xb5779a];return _0x17602f;};'use strict';var moment=require('moment');var Sequelize=require(_0x7375('0x0'));module[_0x7375('0x1')]={'uniqueid':{'type':Sequelize[_0x7375('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7375('0x2')]},'joinAt':{'type':Sequelize[_0x7375('0x3')]},'leaveAt':{'type':Sequelize[_0x7375('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x7375('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index d2f7518..0a094fd 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 _0xf9d4=['map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','destroy','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','error','stack','name','send','index'];(function(_0x15c8b7,_0x39bdb4){var _0xaadd9b=function(_0x20edb8){while(--_0x20edb8){_0x15c8b7['push'](_0x15c8b7['shift']());}};_0xaadd9b(++_0x39bdb4);}(_0xf9d4,0x16a));var _0x4f9d=function(_0x4736c4,_0x2f7c1a){_0x4736c4=_0x4736c4-0x0;var _0x4264ab=_0xf9d4[_0x4736c4];return _0x4264ab;};'use strict';var emlformat=require(_0x4f9d('0x0'));var rimraf=require(_0x4f9d('0x1'));var zipdir=require(_0x4f9d('0x2'));var jsonpatch=require(_0x4f9d('0x3'));var rp=require(_0x4f9d('0x4'));var moment=require(_0x4f9d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4f9d('0x6'));var util=require(_0x4f9d('0x7'));var path=require(_0x4f9d('0x8'));var sox=require(_0x4f9d('0x9'));var csv=require('to-csv');var ejs=require(_0x4f9d('0xa'));var fs=require('fs');var fs_extra=require(_0x4f9d('0xb'));var _=require(_0x4f9d('0xc'));var squel=require(_0x4f9d('0xd'));var crypto=require(_0x4f9d('0xe'));var jsforce=require(_0x4f9d('0xf'));var deskjs=require(_0x4f9d('0x10'));var toCsv=require(_0x4f9d('0x11'));var querystring=require(_0x4f9d('0x12'));var Papa=require(_0x4f9d('0x13'));var Redis=require('ioredis');var authService=require(_0x4f9d('0x14'));var qs=require(_0x4f9d('0x15'));var as=require(_0x4f9d('0x16'));var hardwareService=require(_0x4f9d('0x17'));var logger=require(_0x4f9d('0x18'))(_0x4f9d('0x19'));var utils=require(_0x4f9d('0x1a'));var config=require(_0x4f9d('0x1b'));var licenseUtil=require(_0x4f9d('0x1c'));var db=require(_0x4f9d('0x1d'))['db'];function respondWithStatusCode(_0x345a8f,_0x5e650c){_0x5e650c=_0x5e650c||0xcc;return function(_0x43761a){if(_0x43761a){return _0x345a8f[_0x4f9d('0x1e')](_0x5e650c);}return _0x345a8f[_0x4f9d('0x1f')](_0x5e650c)[_0x4f9d('0x20')]();};}function respondWithResult(_0x2138cb,_0xe81707){_0xe81707=_0xe81707||0xc8;return function(_0x5cc508){if(_0x5cc508){return _0x2138cb[_0x4f9d('0x1f')](_0xe81707)[_0x4f9d('0x21')](_0x5cc508);}};}function respondWithFilteredResult(_0x355102,_0x45d970){return function(_0x53c627){if(_0x53c627){var _0x22b9cf=typeof _0x45d970[_0x4f9d('0x22')]===_0x4f9d('0x23')&&typeof _0x45d970[_0x4f9d('0x24')]===_0x4f9d('0x23');var _0x18a96d=_0x53c627['count'];var _0x13d584=_0x22b9cf?0x0:_0x45d970[_0x4f9d('0x22')];var _0x173c13=_0x22b9cf?_0x53c627[_0x4f9d('0x25')]:_0x45d970[_0x4f9d('0x22')]+_0x45d970[_0x4f9d('0x24')];var _0x137dee;if(_0x173c13>=_0x18a96d){_0x173c13=_0x18a96d;_0x137dee=0xc8;}else{_0x137dee=0xce;}_0x355102['status'](_0x137dee);return _0x355102[_0x4f9d('0x26')](_0x4f9d('0x27'),_0x13d584+'-'+_0x173c13+'/'+_0x18a96d)['json'](_0x53c627);}return null;};}function patchUpdates(_0x3af6a2){return function(_0x21f55c){try{jsonpatch['apply'](_0x21f55c,_0x3af6a2,!![]);}catch(_0x14ff97){return BPromise[_0x4f9d('0x28')](_0x14ff97);}return _0x21f55c['save']();};}function saveUpdates(_0x3d0f5c,_0x4229fd){return function(_0x412793){if(_0x412793){return _0x412793[_0x4f9d('0x29')](_0x3d0f5c)[_0x4f9d('0x2a')](function(_0x3e40ce){return _0x3e40ce;});}return null;};}function removeEntity(_0x3e0842,_0x3bec31){return function(_0x147f94){if(_0x147f94){return _0x147f94['destroy']()[_0x4f9d('0x2a')](function(){_0x3e0842[_0x4f9d('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x358c0d,_0x1b109b){return function(_0x25e9e3){if(!_0x25e9e3){_0x358c0d[_0x4f9d('0x1e')](0x194);}return _0x25e9e3;};}function handleError(_0x50e835,_0xd76c43){_0xd76c43=_0xd76c43||0x1f4;return function(_0x5993b5){logger[_0x4f9d('0x2b')](_0x5993b5[_0x4f9d('0x2c')]);if(_0x5993b5[_0x4f9d('0x2d')]){delete _0x5993b5['name'];}_0x50e835[_0x4f9d('0x1f')](_0xd76c43)[_0x4f9d('0x2e')](_0x5993b5);};}exports[_0x4f9d('0x2f')]=function(_0x59a917,_0x226be9){var _0x505d65={},_0x5a6fb5={},_0xf02d64={'count':0x0,'rows':[]};var _0x2df519=_[_0x4f9d('0x30')](db[_0x4f9d('0x31')][_0x4f9d('0x32')],function(_0x557bfa){return{'name':_0x557bfa[_0x4f9d('0x33')],'type':_0x557bfa[_0x4f9d('0x34')][_0x4f9d('0x35')]};});_0x5a6fb5[_0x4f9d('0x36')]=_[_0x4f9d('0x30')](_0x2df519,_0x4f9d('0x2d'));_0x5a6fb5[_0x4f9d('0x37')]=_[_0x4f9d('0x38')](_0x59a917[_0x4f9d('0x37')]);_0x5a6fb5[_0x4f9d('0x39')]=_['intersection'](_0x5a6fb5[_0x4f9d('0x36')],_0x5a6fb5[_0x4f9d('0x37')]);_0x505d65['attributes']=_[_0x4f9d('0x3a')](_0x5a6fb5[_0x4f9d('0x36')],qs['fields'](_0x59a917['query'][_0x4f9d('0x3b')]));_0x505d65[_0x4f9d('0x3c')]=_0x505d65[_0x4f9d('0x3c')]['length']?_0x505d65[_0x4f9d('0x3c')]:_0x5a6fb5['model'];if(!_0x59a917[_0x4f9d('0x37')]['hasOwnProperty'](_0x4f9d('0x3d'))){_0x505d65[_0x4f9d('0x24')]=qs[_0x4f9d('0x24')](_0x59a917['query']['limit']);_0x505d65[_0x4f9d('0x22')]=qs['offset'](_0x59a917['query'][_0x4f9d('0x22')]);}_0x505d65[_0x4f9d('0x3e')]=qs['sort'](_0x59a917['query'][_0x4f9d('0x3f')]);_0x505d65[_0x4f9d('0x40')]=qs[_0x4f9d('0x39')](_[_0x4f9d('0x41')](_0x59a917['query'],_0x5a6fb5[_0x4f9d('0x39')]),_0x2df519);if(_0x59a917[_0x4f9d('0x37')][_0x4f9d('0x42')]){_0x505d65[_0x4f9d('0x40')]=_[_0x4f9d('0x43')](_0x505d65['where'],{'$or':_[_0x4f9d('0x30')](_0x2df519,function(_0x8113ee){if(_0x8113ee[_0x4f9d('0x34')]!=='VIRTUAL'){var _0x25b930={};_0x25b930[_0x8113ee[_0x4f9d('0x2d')]]={'$like':'%'+_0x59a917[_0x4f9d('0x37')][_0x4f9d('0x42')]+'%'};return _0x25b930;}})});}_0x505d65=_['merge']({},_0x505d65,_0x59a917[_0x4f9d('0x44')]);var _0x284249={'where':_0x505d65[_0x4f9d('0x40')]};return db[_0x4f9d('0x31')][_0x4f9d('0x25')](_0x284249)[_0x4f9d('0x2a')](function(_0x172d9f){_0xf02d64['count']=_0x172d9f;if(_0x59a917[_0x4f9d('0x37')][_0x4f9d('0x45')]){_0x505d65[_0x4f9d('0x46')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x4f9d('0x47')](_0x505d65);})['then'](function(_0x33ff74){_0xf02d64[_0x4f9d('0x48')]=_0x33ff74;return _0xf02d64;})[_0x4f9d('0x2a')](respondWithFilteredResult(_0x226be9,_0x505d65))[_0x4f9d('0x49')](handleError(_0x226be9,null));};exports[_0x4f9d('0x4a')]=function(_0x35cd7b,_0x2c1fbb){var _0x3959be={'raw':!![],'where':{'id':_0x35cd7b[_0x4f9d('0x4b')]['id']}},_0x311a77={};_0x311a77[_0x4f9d('0x36')]=_[_0x4f9d('0x38')](db[_0x4f9d('0x31')]['rawAttributes']);_0x311a77[_0x4f9d('0x37')]=_[_0x4f9d('0x38')](_0x35cd7b[_0x4f9d('0x37')]);_0x311a77[_0x4f9d('0x39')]=_[_0x4f9d('0x3a')](_0x311a77['model'],_0x311a77['query']);_0x3959be['attributes']=_[_0x4f9d('0x3a')](_0x311a77['model'],qs[_0x4f9d('0x3b')](_0x35cd7b[_0x4f9d('0x37')][_0x4f9d('0x3b')]));_0x3959be[_0x4f9d('0x3c')]=_0x3959be['attributes'][_0x4f9d('0x4c')]?_0x3959be[_0x4f9d('0x3c')]:_0x311a77[_0x4f9d('0x36')];if(_0x35cd7b[_0x4f9d('0x37')]['includeAll']){_0x3959be['include']=[{'all':!![]}];}_0x3959be=_[_0x4f9d('0x43')]({},_0x3959be,_0x35cd7b[_0x4f9d('0x44')]);return db['SmsQueueReport']['find'](_0x3959be)[_0x4f9d('0x2a')](handleEntityNotFound(_0x2c1fbb,null))[_0x4f9d('0x2a')](respondWithResult(_0x2c1fbb,null))[_0x4f9d('0x49')](handleError(_0x2c1fbb,null));};exports[_0x4f9d('0x4d')]=function(_0x40696c,_0x2194cd){return db[_0x4f9d('0x31')][_0x4f9d('0x4d')](_0x40696c[_0x4f9d('0x4e')],{})[_0x4f9d('0x2a')](respondWithResult(_0x2194cd,0xc9))['catch'](handleError(_0x2194cd,null));};exports[_0x4f9d('0x29')]=function(_0x3aaf65,_0x96723f){if(_0x3aaf65['body']['id']){delete _0x3aaf65[_0x4f9d('0x4e')]['id'];}return db[_0x4f9d('0x31')]['find']({'where':{'id':_0x3aaf65[_0x4f9d('0x4b')]['id']}})[_0x4f9d('0x2a')](handleEntityNotFound(_0x96723f,null))[_0x4f9d('0x2a')](saveUpdates(_0x3aaf65[_0x4f9d('0x4e')],null))[_0x4f9d('0x2a')](respondWithResult(_0x96723f,null))[_0x4f9d('0x49')](handleError(_0x96723f,null));};exports[_0x4f9d('0x4f')]=function(_0xa7b06f,_0x43afd3){return db['SmsQueueReport'][_0x4f9d('0x50')]({'where':{'id':_0xa7b06f[_0x4f9d('0x4b')]['id']}})[_0x4f9d('0x2a')](handleEntityNotFound(_0x43afd3,null))[_0x4f9d('0x2a')](removeEntity(_0x43afd3,null))[_0x4f9d('0x49')](handleError(_0x43afd3,null));};exports[_0x4f9d('0x51')]=function(_0x538862,_0x247f46){return db[_0x4f9d('0x31')][_0x4f9d('0x51')]()[_0x4f9d('0x2a')](respondWithResult(_0x247f46,null))[_0x4f9d('0x49')](handleError(_0x247f46,null));}; \ No newline at end of file +var _0x0274=['rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','SmsQueueReport'];(function(_0x3edcf0,_0x2dfeff){var _0xcd8301=function(_0x16fdb0){while(--_0x16fdb0){_0x3edcf0['push'](_0x3edcf0['shift']());}};_0xcd8301(++_0x2dfeff);}(_0x0274,0xb7));var _0x4027=function(_0x83420c,_0x50fd91){_0x83420c=_0x83420c-0x0;var _0x1057d7=_0x0274[_0x83420c];return _0x1057d7;};'use strict';var emlformat=require(_0x4027('0x0'));var rimraf=require(_0x4027('0x1'));var zipdir=require(_0x4027('0x2'));var jsonpatch=require(_0x4027('0x3'));var rp=require(_0x4027('0x4'));var moment=require(_0x4027('0x5'));var BPromise=require(_0x4027('0x6'));var Mustache=require(_0x4027('0x7'));var util=require(_0x4027('0x8'));var path=require('path');var sox=require(_0x4027('0x9'));var csv=require('to-csv');var ejs=require(_0x4027('0xa'));var fs=require('fs');var fs_extra=require(_0x4027('0xb'));var _=require(_0x4027('0xc'));var squel=require('squel');var crypto=require(_0x4027('0xd'));var jsforce=require(_0x4027('0xe'));var deskjs=require(_0x4027('0xf'));var toCsv=require(_0x4027('0x10'));var querystring=require('querystring');var Papa=require(_0x4027('0x11'));var Redis=require(_0x4027('0x12'));var authService=require(_0x4027('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4027('0x14'));var hardwareService=require(_0x4027('0x15'));var logger=require(_0x4027('0x16'))(_0x4027('0x17'));var utils=require('../../config/utils');var config=require(_0x4027('0x18'));var licenseUtil=require(_0x4027('0x19'));var db=require(_0x4027('0x1a'))['db'];function respondWithStatusCode(_0xd55b75,_0x28006e){_0x28006e=_0x28006e||0xcc;return function(_0x56aa56){if(_0x56aa56){return _0xd55b75[_0x4027('0x1b')](_0x28006e);}return _0xd55b75[_0x4027('0x1c')](_0x28006e)[_0x4027('0x1d')]();};}function respondWithResult(_0x394151,_0x51985d){_0x51985d=_0x51985d||0xc8;return function(_0x1c0fb9){if(_0x1c0fb9){return _0x394151[_0x4027('0x1c')](_0x51985d)[_0x4027('0x1e')](_0x1c0fb9);}};}function respondWithFilteredResult(_0xc6c277,_0x1dc04a){return function(_0x4431c7){if(_0x4431c7){var _0x16ec58=typeof _0x1dc04a['offset']===_0x4027('0x1f')&&typeof _0x1dc04a[_0x4027('0x20')]===_0x4027('0x1f');var _0x52dd71=_0x4431c7[_0x4027('0x21')];var _0x1a742d=_0x16ec58?0x0:_0x1dc04a['offset'];var _0x5120e4=_0x16ec58?_0x4431c7[_0x4027('0x21')]:_0x1dc04a[_0x4027('0x22')]+_0x1dc04a['limit'];var _0x7666a;if(_0x5120e4>=_0x52dd71){_0x5120e4=_0x52dd71;_0x7666a=0xc8;}else{_0x7666a=0xce;}_0xc6c277['status'](_0x7666a);return _0xc6c277[_0x4027('0x23')](_0x4027('0x24'),_0x1a742d+'-'+_0x5120e4+'/'+_0x52dd71)[_0x4027('0x1e')](_0x4431c7);}return null;};}function patchUpdates(_0x5dfc31){return function(_0x3000d8){try{jsonpatch[_0x4027('0x25')](_0x3000d8,_0x5dfc31,!![]);}catch(_0x432d9b){return BPromise[_0x4027('0x26')](_0x432d9b);}return _0x3000d8[_0x4027('0x27')]();};}function saveUpdates(_0x5ac518,_0x17a620){return function(_0x3c4482){if(_0x3c4482){return _0x3c4482['update'](_0x5ac518)[_0x4027('0x28')](function(_0x3b8e06){return _0x3b8e06;});}return null;};}function removeEntity(_0x22d75f,_0xe5a337){return function(_0x4771b){if(_0x4771b){return _0x4771b['destroy']()[_0x4027('0x28')](function(){_0x22d75f[_0x4027('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bbaf1,_0x2bffa7){return function(_0x5338ba){if(!_0x5338ba){_0x5bbaf1['sendStatus'](0x194);}return _0x5338ba;};}function handleError(_0xe357c5,_0x6da4d8){_0x6da4d8=_0x6da4d8||0x1f4;return function(_0x54c514){logger[_0x4027('0x29')](_0x54c514[_0x4027('0x2a')]);if(_0x54c514[_0x4027('0x2b')]){delete _0x54c514[_0x4027('0x2b')];}_0xe357c5['status'](_0x6da4d8)[_0x4027('0x2c')](_0x54c514);};}exports[_0x4027('0x2d')]=function(_0x25192e,_0x197d31){var _0x59548e={},_0x4c7828={},_0x55ecc9={'count':0x0,'rows':[]};var _0x5c73e2=_[_0x4027('0x2e')](db[_0x4027('0x2f')][_0x4027('0x30')],function(_0x4b4188){return{'name':_0x4b4188[_0x4027('0x31')],'type':_0x4b4188[_0x4027('0x32')]['key']};});_0x4c7828[_0x4027('0x33')]=_['map'](_0x5c73e2,_0x4027('0x2b'));_0x4c7828['query']=_[_0x4027('0x34')](_0x25192e['query']);_0x4c7828[_0x4027('0x35')]=_[_0x4027('0x36')](_0x4c7828[_0x4027('0x33')],_0x4c7828[_0x4027('0x37')]);_0x59548e[_0x4027('0x38')]=_[_0x4027('0x36')](_0x4c7828[_0x4027('0x33')],qs[_0x4027('0x39')](_0x25192e[_0x4027('0x37')]['fields']));_0x59548e['attributes']=_0x59548e[_0x4027('0x38')]['length']?_0x59548e[_0x4027('0x38')]:_0x4c7828[_0x4027('0x33')];if(!_0x25192e[_0x4027('0x37')]['hasOwnProperty'](_0x4027('0x3a'))){_0x59548e[_0x4027('0x20')]=qs[_0x4027('0x20')](_0x25192e['query'][_0x4027('0x20')]);_0x59548e[_0x4027('0x22')]=qs['offset'](_0x25192e[_0x4027('0x37')][_0x4027('0x22')]);}_0x59548e[_0x4027('0x3b')]=qs['sort'](_0x25192e[_0x4027('0x37')][_0x4027('0x3c')]);_0x59548e[_0x4027('0x3d')]=qs['filters'](_['pick'](_0x25192e['query'],_0x4c7828[_0x4027('0x35')]),_0x5c73e2);if(_0x25192e['query'][_0x4027('0x3e')]){_0x59548e[_0x4027('0x3d')]=_[_0x4027('0x3f')](_0x59548e[_0x4027('0x3d')],{'$or':_['map'](_0x5c73e2,function(_0x29f097){if(_0x29f097[_0x4027('0x32')]!=='VIRTUAL'){var _0x4137e9={};_0x4137e9[_0x29f097[_0x4027('0x2b')]]={'$like':'%'+_0x25192e['query'][_0x4027('0x3e')]+'%'};return _0x4137e9;}})});}_0x59548e=_[_0x4027('0x3f')]({},_0x59548e,_0x25192e[_0x4027('0x40')]);var _0x280899={'where':_0x59548e['where']};return db[_0x4027('0x2f')][_0x4027('0x21')](_0x280899)['then'](function(_0x6ae455){_0x55ecc9[_0x4027('0x21')]=_0x6ae455;if(_0x25192e['query'][_0x4027('0x41')]){_0x59548e[_0x4027('0x42')]=[{'all':!![]}];}return db[_0x4027('0x2f')][_0x4027('0x43')](_0x59548e);})['then'](function(_0x44eb9c){_0x55ecc9[_0x4027('0x44')]=_0x44eb9c;return _0x55ecc9;})[_0x4027('0x28')](respondWithFilteredResult(_0x197d31,_0x59548e))[_0x4027('0x45')](handleError(_0x197d31,null));};exports[_0x4027('0x46')]=function(_0x517366,_0x234486){var _0x26db30={'raw':!![],'where':{'id':_0x517366[_0x4027('0x47')]['id']}},_0x6908e0={};_0x6908e0[_0x4027('0x33')]=_[_0x4027('0x34')](db[_0x4027('0x2f')][_0x4027('0x30')]);_0x6908e0[_0x4027('0x37')]=_[_0x4027('0x34')](_0x517366['query']);_0x6908e0[_0x4027('0x35')]=_[_0x4027('0x36')](_0x6908e0[_0x4027('0x33')],_0x6908e0['query']);_0x26db30[_0x4027('0x38')]=_[_0x4027('0x36')](_0x6908e0[_0x4027('0x33')],qs[_0x4027('0x39')](_0x517366[_0x4027('0x37')][_0x4027('0x39')]));_0x26db30[_0x4027('0x38')]=_0x26db30[_0x4027('0x38')][_0x4027('0x48')]?_0x26db30[_0x4027('0x38')]:_0x6908e0[_0x4027('0x33')];if(_0x517366['query']['includeAll']){_0x26db30[_0x4027('0x42')]=[{'all':!![]}];}_0x26db30=_[_0x4027('0x3f')]({},_0x26db30,_0x517366['options']);return db[_0x4027('0x2f')][_0x4027('0x49')](_0x26db30)['then'](handleEntityNotFound(_0x234486,null))[_0x4027('0x28')](respondWithResult(_0x234486,null))[_0x4027('0x45')](handleError(_0x234486,null));};exports[_0x4027('0x4a')]=function(_0x2653b6,_0x46def7){return db[_0x4027('0x2f')][_0x4027('0x4a')](_0x2653b6['body'],{})[_0x4027('0x28')](respondWithResult(_0x46def7,0xc9))[_0x4027('0x45')](handleError(_0x46def7,null));};exports['update']=function(_0x211838,_0x225ffb){if(_0x211838[_0x4027('0x4b')]['id']){delete _0x211838[_0x4027('0x4b')]['id'];}return db[_0x4027('0x2f')][_0x4027('0x49')]({'where':{'id':_0x211838[_0x4027('0x47')]['id']}})[_0x4027('0x28')](handleEntityNotFound(_0x225ffb,null))[_0x4027('0x28')](saveUpdates(_0x211838['body'],null))[_0x4027('0x28')](respondWithResult(_0x225ffb,null))['catch'](handleError(_0x225ffb,null));};exports['destroy']=function(_0x5973a1,_0x4981ee){return db['SmsQueueReport'][_0x4027('0x49')]({'where':{'id':_0x5973a1['params']['id']}})['then'](handleEntityNotFound(_0x4981ee,null))[_0x4027('0x28')](removeEntity(_0x4981ee,null))['catch'](handleError(_0x4981ee,null));};exports['describe']=function(_0x1d7154,_0x59e4a2){return db[_0x4027('0x2f')][_0x4027('0x4c')]()[_0x4027('0x28')](respondWithResult(_0x59e4a2,null))[_0x4027('0x45')](handleError(_0x59e4a2,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index c70fa00..4fff6a4 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 _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x51d5da,_0x478c36){var _0x3f4838=function(_0x2d4fd5){while(--_0x2d4fd5){_0x51d5da['push'](_0x51d5da['shift']());}};_0x3f4838(++_0x478c36);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x471174,_0x35dbba){var _0x19ee13=function(_0x520b0c){while(--_0x520b0c){_0x471174['push'](_0x471174['shift']());}};_0x19ee13(++_0x35dbba);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 1064b18..6afc5e5 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 _0xaa0f=['raw','where','attributes','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','client','http','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','CreateSmsQueueReport','body','options','catch','UpdateSmsQueueReport','SmsQueueReport','update'];(function(_0x3eff40,_0x1cdf9e){var _0x4ee4fb=function(_0x4b7170){while(--_0x4b7170){_0x3eff40['push'](_0x3eff40['shift']());}};_0x4ee4fb(++_0x1cdf9e);}(_0xaa0f,0x7c));var _0xfaa0=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0xaa0f[_0x4dc7b9];return _0x3ab114;};'use strict';var _=require('lodash');var util=require(_0xfaa0('0x0'));var moment=require(_0xfaa0('0x1'));var BPromise=require(_0xfaa0('0x2'));var rs=require(_0xfaa0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfaa0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfaa0('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfaa0('0x6')][_0xfaa0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xe61217,_0x3f4c92,_0x521e73){return new BPromise(function(_0x5ef308,_0x290f1a){return client['request'](_0xe61217,_0x521e73)[_0xfaa0('0x8')](function(_0x23657c){logger[_0xfaa0('0x9')](_0xfaa0('0xa'),_0x3f4c92,_0xfaa0('0xb'));logger[_0xfaa0('0xc')](_0xfaa0('0xd'),_0x3f4c92,'request\x20sent',JSON[_0xfaa0('0xe')](_0x23657c));if(_0x23657c['error']){if(_0x23657c['error'][_0xfaa0('0xf')]===0x1f4){logger[_0xfaa0('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x3f4c92,_0x23657c['error'][_0xfaa0('0x11')]);return _0x290f1a(_0x23657c[_0xfaa0('0x10')][_0xfaa0('0x11')]);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x3f4c92,_0x23657c['error'][_0xfaa0('0x11')]);return _0x5ef308(_0x23657c[_0xfaa0('0x10')][_0xfaa0('0x11')]);}else{logger[_0xfaa0('0x9')](_0xfaa0('0xa'),_0x3f4c92,_0xfaa0('0xb'));_0x5ef308(_0x23657c[_0xfaa0('0x12')][_0xfaa0('0x11')]);}})['catch'](function(_0x40e1b3){logger['error'](_0xfaa0('0xa'),_0x3f4c92,_0x40e1b3);_0x290f1a(_0x40e1b3);});});}exports[_0xfaa0('0x13')]=function(_0x2281f9){var _0x113c90=this;return new Promise(function(_0x21b0ab,_0x46979c){return db['SmsQueueReport']['create'](_0x2281f9[_0xfaa0('0x14')],{'raw':_0x2281f9['options']?_0x2281f9[_0xfaa0('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xfaa0('0x8')](function(_0x9be4c5){logger[_0xfaa0('0x9')](_0xfaa0('0x13'),_0x2281f9);logger[_0xfaa0('0xc')](_0xfaa0('0x13'),_0x2281f9,JSON[_0xfaa0('0xe')](_0x9be4c5));_0x21b0ab(_0x9be4c5);})[_0xfaa0('0x16')](function(_0x4bc1da){logger['error']('CreateSmsQueueReport',_0x4bc1da['message'],_0x2281f9);_0x46979c(_0x113c90[_0xfaa0('0x10')](0x1f4,_0x4bc1da['message']));});});};exports[_0xfaa0('0x17')]=function(_0x54d70f){var _0x4f30c9=this;return new Promise(function(_0x1e1889,_0x19889b){return db[_0xfaa0('0x18')][_0xfaa0('0x19')](_0x54d70f[_0xfaa0('0x14')],{'raw':_0x54d70f[_0xfaa0('0x15')]?_0x54d70f[_0xfaa0('0x15')][_0xfaa0('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54d70f['options']?_0x54d70f[_0xfaa0('0x15')][_0xfaa0('0x1b')]||null:null,'attributes':_0x54d70f[_0xfaa0('0x15')]?_0x54d70f[_0xfaa0('0x15')][_0xfaa0('0x1c')]||null:null,'limit':_0x54d70f['options']?_0x54d70f['options'][_0xfaa0('0x1d')]||null:null})[_0xfaa0('0x8')](function(_0x2d7ea4){logger[_0xfaa0('0x9')](_0xfaa0('0x17'),_0x54d70f);logger[_0xfaa0('0xc')](_0xfaa0('0x17'),_0x54d70f,JSON[_0xfaa0('0xe')](_0x2d7ea4));_0x1e1889(_0x2d7ea4);})[_0xfaa0('0x16')](function(_0x476e77){logger[_0xfaa0('0x10')](_0xfaa0('0x17'),_0x476e77[_0xfaa0('0x11')],_0x54d70f);_0x19889b(_0x4f30c9[_0xfaa0('0x10')](0x1f4,_0x476e77[_0xfaa0('0x11')]));});});}; \ No newline at end of file +var _0x0332=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','error','code','SmsQueueReport,\x20%s,\x20%s','message','CreateSmsQueueReport','SmsQueueReport','body','options','raw','catch','UpdateSmsQueueReport','update','attributes','limit','stringify','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x0332,0xb4));var _0x2033=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0x0332[_0x2adbeb];return _0x5e18a6;};'use strict';var _=require('lodash');var util=require(_0x2033('0x0'));var moment=require(_0x2033('0x1'));var BPromise=require(_0x2033('0x2'));var rs=require(_0x2033('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2033('0x4'))['db'];var utils=require(_0x2033('0x5'));var logger=require(_0x2033('0x6'))(_0x2033('0x7'));var config=require(_0x2033('0x8'));var jayson=require(_0x2033('0x9'));var client=jayson[_0x2033('0xa')][_0x2033('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x385985,_0x10ef6e,_0xb7c93b){return new BPromise(function(_0x598e28,_0x258d3b){return client[_0x2033('0xc')](_0x385985,_0xb7c93b)[_0x2033('0xd')](function(_0xc2c47f){logger[_0x2033('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x10ef6e,'request\x20sent');logger[_0x2033('0xf')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x10ef6e,'request\x20sent',JSON['stringify'](_0xc2c47f));if(_0xc2c47f[_0x2033('0x10')]){if(_0xc2c47f[_0x2033('0x10')][_0x2033('0x11')]===0x1f4){logger['error'](_0x2033('0x12'),_0x10ef6e,_0xc2c47f[_0x2033('0x10')]['message']);return _0x258d3b(_0xc2c47f[_0x2033('0x10')][_0x2033('0x13')]);}logger[_0x2033('0x10')](_0x2033('0x12'),_0x10ef6e,_0xc2c47f[_0x2033('0x10')][_0x2033('0x13')]);return _0x598e28(_0xc2c47f['error']['message']);}else{logger[_0x2033('0xe')](_0x2033('0x12'),_0x10ef6e,'request\x20sent');_0x598e28(_0xc2c47f['result'][_0x2033('0x13')]);}})['catch'](function(_0x2f3beb){logger[_0x2033('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x10ef6e,_0x2f3beb);_0x258d3b(_0x2f3beb);});});}exports[_0x2033('0x14')]=function(_0x5bf227){var _0x49d6f7=this;return new Promise(function(_0xe1c202,_0x263176){return db[_0x2033('0x15')]['create'](_0x5bf227[_0x2033('0x16')],{'raw':_0x5bf227[_0x2033('0x17')]?_0x5bf227[_0x2033('0x17')][_0x2033('0x18')]===undefined?!![]:![]:!![]})[_0x2033('0xd')](function(_0x24a18e){logger[_0x2033('0xe')](_0x2033('0x14'),_0x5bf227);logger['debug'](_0x2033('0x14'),_0x5bf227,JSON['stringify'](_0x24a18e));_0xe1c202(_0x24a18e);})[_0x2033('0x19')](function(_0x363c02){logger[_0x2033('0x10')](_0x2033('0x14'),_0x363c02['message'],_0x5bf227);_0x263176(_0x49d6f7[_0x2033('0x10')](0x1f4,_0x363c02[_0x2033('0x13')]));});});};exports[_0x2033('0x1a')]=function(_0x26b3a8){var _0x298ec8=this;return new Promise(function(_0x1a0d6b,_0x24fed9){return db[_0x2033('0x15')][_0x2033('0x1b')](_0x26b3a8['body'],{'raw':_0x26b3a8[_0x2033('0x17')]?_0x26b3a8[_0x2033('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26b3a8[_0x2033('0x17')]?_0x26b3a8[_0x2033('0x17')]['where']||null:null,'attributes':_0x26b3a8[_0x2033('0x17')]?_0x26b3a8[_0x2033('0x17')][_0x2033('0x1c')]||null:null,'limit':_0x26b3a8[_0x2033('0x17')]?_0x26b3a8['options'][_0x2033('0x1d')]||null:null})['then'](function(_0x6eeaf8){logger[_0x2033('0xe')](_0x2033('0x1a'),_0x26b3a8);logger[_0x2033('0xf')](_0x2033('0x1a'),_0x26b3a8,JSON[_0x2033('0x1e')](_0x6eeaf8));_0x1a0d6b(_0x6eeaf8);})[_0x2033('0x19')](function(_0x5e4685){logger['error'](_0x2033('0x1a'),_0x5e4685[_0x2033('0x13')],_0x26b3a8);_0x24fed9(_0x298ec8[_0x2033('0x10')](0x1f4,_0x5e4685[_0x2033('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 94f0c1a..3601ea6 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 _0x90b5=['/describe','describe','/:id','show','post','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x5c3cec,_0x42659f){var _0x3c4f65=function(_0x3e92e7){while(--_0x3e92e7){_0x5c3cec['push'](_0x5c3cec['shift']());}};_0x3c4f65(++_0x42659f);}(_0x90b5,0x139));var _0x590b=function(_0x5151ab,_0x5d0dd9){_0x5151ab=_0x5151ab-0x0;var _0x5b6c0a=_0x90b5[_0x5151ab];return _0x5b6c0a;};'use strict';var multer=require(_0x590b('0x0'));var util=require('util');var path=require(_0x590b('0x1'));var timeout=require(_0x590b('0x2'));var express=require(_0x590b('0x3'));var router=express[_0x590b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x590b('0x5'));var config=require(_0x590b('0x6'));var controller=require('./smsTransferReport.controller');router[_0x590b('0x7')]('/',auth[_0x590b('0x8')](),controller[_0x590b('0x9')]);router['get'](_0x590b('0xa'),auth[_0x590b('0x8')](),controller[_0x590b('0xb')]);router[_0x590b('0x7')](_0x590b('0xc'),auth[_0x590b('0x8')](),controller[_0x590b('0xd')]);router[_0x590b('0xe')]('/',auth[_0x590b('0x8')](),controller['create']);router[_0x590b('0xf')](_0x590b('0xc'),auth['isAuthenticated'](),controller[_0x590b('0x10')]);router['delete'](_0x590b('0xc'),auth[_0x590b('0x8')](),controller[_0x590b('0x11')]);module[_0x590b('0x12')]=router; \ No newline at end of file +var _0x7d9f=['isAuthenticated','describe','/:id','show','post','put','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','index','get'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x3d16ad,_0x36675c){_0x3d16ad=_0x3d16ad-0x0;var _0x5ebf92=_0x7d9f[_0x3d16ad];return _0x5ebf92;};'use strict';var multer=require(_0xf7d9('0x0'));var util=require(_0xf7d9('0x1'));var path=require(_0xf7d9('0x2'));var timeout=require(_0xf7d9('0x3'));var express=require(_0xf7d9('0x4'));var router=express['Router']();var fs_extra=require(_0xf7d9('0x5'));var auth=require(_0xf7d9('0x6'));var interaction=require(_0xf7d9('0x7'));var config=require(_0xf7d9('0x8'));var controller=require(_0xf7d9('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf7d9('0xa')]);router[_0xf7d9('0xb')]('/describe',auth[_0xf7d9('0xc')](),controller[_0xf7d9('0xd')]);router['get'](_0xf7d9('0xe'),auth['isAuthenticated'](),controller[_0xf7d9('0xf')]);router[_0xf7d9('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf7d9('0x11')](_0xf7d9('0xe'),auth[_0xf7d9('0xc')](),controller['update']);router['delete'](_0xf7d9('0xe'),auth[_0xf7d9('0xc')](),controller[_0xf7d9('0x12')]);module[_0xf7d9('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index e6de908..a6a88ab 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0xf32c6d,_0x372704){var _0x156c11=function(_0x34ef76){while(--_0x34ef76){_0xf32c6d['push'](_0xf32c6d['shift']());}};_0x156c11(++_0x372704);}(_0x9c44,0x178));var _0x49c4=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x9c44[_0x6cf19c];return _0xce14f3;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x2aaed6,_0x2ebd88){var _0x35ac2b=function(_0x292fa8){while(--_0x292fa8){_0x2aaed6['push'](_0x2aaed6['shift']());}};_0x35ac2b(++_0x2ebd88);}(_0xaa88,0x137));var _0x8aa8=function(_0x120376,_0x571898){_0x120376=_0x120376-0x0;var _0x28c529=_0xaa88[_0x120376];return _0x28c529;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 2ce1c08..486d540 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 _0xea81=['includeAll','options','find','catch','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','order','sort','where','pick','merge','type','VIRTUAL','filter','SmsTransferReport','include','findAll','length'];(function(_0x2bf57c,_0x4563b2){var _0x28a61f=function(_0x47ef0a){while(--_0x47ef0a){_0x2bf57c['push'](_0x2bf57c['shift']());}};_0x28a61f(++_0x4563b2);}(_0xea81,0x130));var _0x1ea8=function(_0x2250eb,_0x22b566){_0x2250eb=_0x2250eb-0x0;var _0x1b99d6=_0xea81[_0x2250eb];return _0x1b99d6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1ea8('0x0'));var zipdir=require(_0x1ea8('0x1'));var jsonpatch=require(_0x1ea8('0x2'));var rp=require(_0x1ea8('0x3'));var moment=require(_0x1ea8('0x4'));var BPromise=require(_0x1ea8('0x5'));var Mustache=require(_0x1ea8('0x6'));var util=require(_0x1ea8('0x7'));var path=require(_0x1ea8('0x8'));var sox=require(_0x1ea8('0x9'));var csv=require(_0x1ea8('0xa'));var ejs=require(_0x1ea8('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1ea8('0xc'));var jsforce=require(_0x1ea8('0xd'));var deskjs=require(_0x1ea8('0xe'));var toCsv=require(_0x1ea8('0xa'));var querystring=require(_0x1ea8('0xf'));var Papa=require('papaparse');var Redis=require(_0x1ea8('0x10'));var authService=require(_0x1ea8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1ea8('0x12'));var hardwareService=require(_0x1ea8('0x13'));var logger=require('../../config/logger')(_0x1ea8('0x14'));var utils=require(_0x1ea8('0x15'));var config=require(_0x1ea8('0x16'));var licenseUtil=require(_0x1ea8('0x17'));var db=require(_0x1ea8('0x18'))['db'];function respondWithStatusCode(_0x1944aa,_0x366298){_0x366298=_0x366298||0xcc;return function(_0x8c52f9){if(_0x8c52f9){return _0x1944aa[_0x1ea8('0x19')](_0x366298);}return _0x1944aa[_0x1ea8('0x1a')](_0x366298)[_0x1ea8('0x1b')]();};}function respondWithResult(_0x16deca,_0x178fcf){_0x178fcf=_0x178fcf||0xc8;return function(_0x620e43){if(_0x620e43){return _0x16deca[_0x1ea8('0x1a')](_0x178fcf)['json'](_0x620e43);}};}function respondWithFilteredResult(_0x4af394,_0x4dd12d){return function(_0x37071f){if(_0x37071f){var _0x551bac=typeof _0x4dd12d[_0x1ea8('0x1c')]===_0x1ea8('0x1d')&&typeof _0x4dd12d['limit']==='undefined';var _0x15b209=_0x37071f['count'];var _0x3f6103=_0x551bac?0x0:_0x4dd12d['offset'];var _0x56940a=_0x551bac?_0x37071f[_0x1ea8('0x1e')]:_0x4dd12d['offset']+_0x4dd12d[_0x1ea8('0x1f')];var _0x95909e;if(_0x56940a>=_0x15b209){_0x56940a=_0x15b209;_0x95909e=0xc8;}else{_0x95909e=0xce;}_0x4af394[_0x1ea8('0x1a')](_0x95909e);return _0x4af394[_0x1ea8('0x20')](_0x1ea8('0x21'),_0x3f6103+'-'+_0x56940a+'/'+_0x15b209)['json'](_0x37071f);}return null;};}function patchUpdates(_0x3a07bd){return function(_0x2e69ac){try{jsonpatch[_0x1ea8('0x22')](_0x2e69ac,_0x3a07bd,!![]);}catch(_0x371f98){return BPromise[_0x1ea8('0x23')](_0x371f98);}return _0x2e69ac['save']();};}function saveUpdates(_0x2e32a8,_0x32ff25){return function(_0x18fc28){if(_0x18fc28){return _0x18fc28[_0x1ea8('0x24')](_0x2e32a8)[_0x1ea8('0x25')](function(_0x546246){return _0x546246;});}return null;};}function removeEntity(_0x1c6b1d,_0x47c8bd){return function(_0x48b171){if(_0x48b171){return _0x48b171[_0x1ea8('0x26')]()[_0x1ea8('0x25')](function(){_0x1c6b1d[_0x1ea8('0x1a')](0xcc)[_0x1ea8('0x1b')]();});}};}function handleEntityNotFound(_0x227500,_0x40916b){return function(_0xc77d7b){if(!_0xc77d7b){_0x227500[_0x1ea8('0x19')](0x194);}return _0xc77d7b;};}function handleError(_0x1547de,_0x28f90f){_0x28f90f=_0x28f90f||0x1f4;return function(_0x43bde8){logger[_0x1ea8('0x27')](_0x43bde8[_0x1ea8('0x28')]);if(_0x43bde8[_0x1ea8('0x29')]){delete _0x43bde8[_0x1ea8('0x29')];}_0x1547de['status'](_0x28f90f)['send'](_0x43bde8);};}exports[_0x1ea8('0x2a')]=function(_0x521851,_0xcae658){var _0xf29c2b={},_0x5c2d4c={},_0x5e260a={'count':0x0,'rows':[]};var _0x1faf8d=_[_0x1ea8('0x2b')](db['SmsTransferReport'][_0x1ea8('0x2c')],function(_0xfbcd){return{'name':_0xfbcd[_0x1ea8('0x2d')],'type':_0xfbcd['type'][_0x1ea8('0x2e')]};});_0x5c2d4c[_0x1ea8('0x2f')]=_[_0x1ea8('0x2b')](_0x1faf8d,_0x1ea8('0x29'));_0x5c2d4c[_0x1ea8('0x30')]=_[_0x1ea8('0x31')](_0x521851['query']);_0x5c2d4c[_0x1ea8('0x32')]=_[_0x1ea8('0x33')](_0x5c2d4c[_0x1ea8('0x2f')],_0x5c2d4c[_0x1ea8('0x30')]);_0xf29c2b['attributes']=_[_0x1ea8('0x33')](_0x5c2d4c[_0x1ea8('0x2f')],qs[_0x1ea8('0x34')](_0x521851[_0x1ea8('0x30')][_0x1ea8('0x34')]));_0xf29c2b[_0x1ea8('0x35')]=_0xf29c2b[_0x1ea8('0x35')]['length']?_0xf29c2b[_0x1ea8('0x35')]:_0x5c2d4c[_0x1ea8('0x2f')];if(!_0x521851[_0x1ea8('0x30')]['hasOwnProperty']('nolimit')){_0xf29c2b[_0x1ea8('0x1f')]=qs[_0x1ea8('0x1f')](_0x521851[_0x1ea8('0x30')]['limit']);_0xf29c2b[_0x1ea8('0x1c')]=qs[_0x1ea8('0x1c')](_0x521851['query']['offset']);}_0xf29c2b[_0x1ea8('0x36')]=qs[_0x1ea8('0x37')](_0x521851[_0x1ea8('0x30')][_0x1ea8('0x37')]);_0xf29c2b[_0x1ea8('0x38')]=qs[_0x1ea8('0x32')](_[_0x1ea8('0x39')](_0x521851['query'],_0x5c2d4c['filters']),_0x1faf8d);if(_0x521851['query']['filter']){_0xf29c2b[_0x1ea8('0x38')]=_[_0x1ea8('0x3a')](_0xf29c2b['where'],{'$or':_[_0x1ea8('0x2b')](_0x1faf8d,function(_0x49195c){if(_0x49195c[_0x1ea8('0x3b')]!==_0x1ea8('0x3c')){var _0x40034f={};_0x40034f[_0x49195c[_0x1ea8('0x29')]]={'$like':'%'+_0x521851['query'][_0x1ea8('0x3d')]+'%'};return _0x40034f;}})});}_0xf29c2b=_[_0x1ea8('0x3a')]({},_0xf29c2b,_0x521851['options']);var _0x2eb1cb={'where':_0xf29c2b[_0x1ea8('0x38')]};return db[_0x1ea8('0x3e')][_0x1ea8('0x1e')](_0x2eb1cb)[_0x1ea8('0x25')](function(_0x5055ea){_0x5e260a[_0x1ea8('0x1e')]=_0x5055ea;if(_0x521851[_0x1ea8('0x30')]['includeAll']){_0xf29c2b[_0x1ea8('0x3f')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x1ea8('0x40')](_0xf29c2b);})[_0x1ea8('0x25')](function(_0x5303d6){_0x5e260a['rows']=_0x5303d6;return _0x5e260a;})[_0x1ea8('0x25')](respondWithFilteredResult(_0xcae658,_0xf29c2b))['catch'](handleError(_0xcae658,null));};exports['show']=function(_0x3b4f7b,_0x286c38){var _0x571204={'raw':!![],'where':{'id':_0x3b4f7b['params']['id']}},_0x4745ae={};_0x4745ae['model']=_[_0x1ea8('0x31')](db['SmsTransferReport'][_0x1ea8('0x2c')]);_0x4745ae[_0x1ea8('0x30')]=_[_0x1ea8('0x31')](_0x3b4f7b['query']);_0x4745ae[_0x1ea8('0x32')]=_[_0x1ea8('0x33')](_0x4745ae[_0x1ea8('0x2f')],_0x4745ae[_0x1ea8('0x30')]);_0x571204[_0x1ea8('0x35')]=_[_0x1ea8('0x33')](_0x4745ae['model'],qs[_0x1ea8('0x34')](_0x3b4f7b['query'][_0x1ea8('0x34')]));_0x571204[_0x1ea8('0x35')]=_0x571204[_0x1ea8('0x35')][_0x1ea8('0x41')]?_0x571204[_0x1ea8('0x35')]:_0x4745ae[_0x1ea8('0x2f')];if(_0x3b4f7b[_0x1ea8('0x30')][_0x1ea8('0x42')]){_0x571204[_0x1ea8('0x3f')]=[{'all':!![]}];}_0x571204=_[_0x1ea8('0x3a')]({},_0x571204,_0x3b4f7b[_0x1ea8('0x43')]);return db[_0x1ea8('0x3e')][_0x1ea8('0x44')](_0x571204)[_0x1ea8('0x25')](handleEntityNotFound(_0x286c38,null))[_0x1ea8('0x25')](respondWithResult(_0x286c38,null))[_0x1ea8('0x45')](handleError(_0x286c38,null));};exports[_0x1ea8('0x46')]=function(_0x590882,_0x423607){return db[_0x1ea8('0x3e')][_0x1ea8('0x46')](_0x590882[_0x1ea8('0x47')],{})['then'](respondWithResult(_0x423607,0xc9))[_0x1ea8('0x45')](handleError(_0x423607,null));};exports[_0x1ea8('0x24')]=function(_0x174b6d,_0x2e1436){if(_0x174b6d['body']['id']){delete _0x174b6d['body']['id'];}return db['SmsTransferReport'][_0x1ea8('0x44')]({'where':{'id':_0x174b6d[_0x1ea8('0x48')]['id']}})['then'](handleEntityNotFound(_0x2e1436,null))[_0x1ea8('0x25')](saveUpdates(_0x174b6d[_0x1ea8('0x47')],null))['then'](respondWithResult(_0x2e1436,null))[_0x1ea8('0x45')](handleError(_0x2e1436,null));};exports[_0x1ea8('0x26')]=function(_0x4fdc86,_0x231663){return db[_0x1ea8('0x3e')][_0x1ea8('0x44')]({'where':{'id':_0x4fdc86['params']['id']}})[_0x1ea8('0x25')](handleEntityNotFound(_0x231663,null))[_0x1ea8('0x25')](removeEntity(_0x231663,null))[_0x1ea8('0x45')](handleError(_0x231663,null));};exports[_0x1ea8('0x49')]=function(_0x5306df,_0x466100){return db[_0x1ea8('0x3e')]['describe']()[_0x1ea8('0x25')](respondWithResult(_0x466100,null))[_0x1ea8('0x45')](handleError(_0x466100,null));}; \ No newline at end of file +var _0xeb0e=['query','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','SmsTransferReport','includeAll','include','findAll','rows','catch','show','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','Content-Range','apply','reject','save','then','destroy','error','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection'];(function(_0x1fb864,_0x27d93d){var _0x23fc4c=function(_0x4cde2f){while(--_0x4cde2f){_0x1fb864['push'](_0x1fb864['shift']());}};_0x23fc4c(++_0x27d93d);}(_0xeb0e,0x1ef));var _0xeeb0=function(_0x4b7976,_0x55e10b){_0x4b7976=_0x4b7976-0x0;var _0x422298=_0xeb0e[_0x4b7976];return _0x422298;};'use strict';var emlformat=require(_0xeeb0('0x0'));var rimraf=require(_0xeeb0('0x1'));var zipdir=require(_0xeeb0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeeb0('0x3'));var moment=require(_0xeeb0('0x4'));var BPromise=require(_0xeeb0('0x5'));var Mustache=require(_0xeeb0('0x6'));var util=require(_0xeeb0('0x7'));var path=require(_0xeeb0('0x8'));var sox=require(_0xeeb0('0x9'));var csv=require('to-csv');var ejs=require(_0xeeb0('0xa'));var fs=require('fs');var fs_extra=require(_0xeeb0('0xb'));var _=require(_0xeeb0('0xc'));var squel=require(_0xeeb0('0xd'));var crypto=require(_0xeeb0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xeeb0('0xf'));var toCsv=require(_0xeeb0('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeeb0('0x11'));var authService=require(_0xeeb0('0x12'));var qs=require(_0xeeb0('0x13'));var as=require(_0xeeb0('0x14'));var hardwareService=require(_0xeeb0('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xeeb0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xeeb0('0x17'));var db=require(_0xeeb0('0x18'))['db'];function respondWithStatusCode(_0x339ccf,_0x31702e){_0x31702e=_0x31702e||0xcc;return function(_0x539279){if(_0x539279){return _0x339ccf[_0xeeb0('0x19')](_0x31702e);}return _0x339ccf[_0xeeb0('0x1a')](_0x31702e)[_0xeeb0('0x1b')]();};}function respondWithResult(_0x2ab706,_0xe2a793){_0xe2a793=_0xe2a793||0xc8;return function(_0x6edcbb){if(_0x6edcbb){return _0x2ab706[_0xeeb0('0x1a')](_0xe2a793)[_0xeeb0('0x1c')](_0x6edcbb);}};}function respondWithFilteredResult(_0x4c48e9,_0x4e9750){return function(_0x56b1b6){if(_0x56b1b6){var _0x2fab3a=typeof _0x4e9750['offset']===_0xeeb0('0x1d')&&typeof _0x4e9750['limit']==='undefined';var _0x472c5a=_0x56b1b6['count'];var _0x1a1fe1=_0x2fab3a?0x0:_0x4e9750[_0xeeb0('0x1e')];var _0x41657f=_0x2fab3a?_0x56b1b6[_0xeeb0('0x1f')]:_0x4e9750[_0xeeb0('0x1e')]+_0x4e9750['limit'];var _0x18ad0c;if(_0x41657f>=_0x472c5a){_0x41657f=_0x472c5a;_0x18ad0c=0xc8;}else{_0x18ad0c=0xce;}_0x4c48e9[_0xeeb0('0x1a')](_0x18ad0c);return _0x4c48e9['set'](_0xeeb0('0x20'),_0x1a1fe1+'-'+_0x41657f+'/'+_0x472c5a)[_0xeeb0('0x1c')](_0x56b1b6);}return null;};}function patchUpdates(_0x1939c5){return function(_0x22fb05){try{jsonpatch[_0xeeb0('0x21')](_0x22fb05,_0x1939c5,!![]);}catch(_0x598b5d){return BPromise[_0xeeb0('0x22')](_0x598b5d);}return _0x22fb05[_0xeeb0('0x23')]();};}function saveUpdates(_0x39c798,_0x4541d7){return function(_0x2c46a9){if(_0x2c46a9){return _0x2c46a9['update'](_0x39c798)[_0xeeb0('0x24')](function(_0xd78cda){return _0xd78cda;});}return null;};}function removeEntity(_0x5a21d5,_0x4fac78){return function(_0x8c4cad){if(_0x8c4cad){return _0x8c4cad[_0xeeb0('0x25')]()[_0xeeb0('0x24')](function(){_0x5a21d5['status'](0xcc)[_0xeeb0('0x1b')]();});}};}function handleEntityNotFound(_0x14af77,_0x1376b5){return function(_0x4ae6a2){if(!_0x4ae6a2){_0x14af77[_0xeeb0('0x19')](0x194);}return _0x4ae6a2;};}function handleError(_0x53c570,_0x1913ed){_0x1913ed=_0x1913ed||0x1f4;return function(_0x1b14cc){logger[_0xeeb0('0x26')](_0x1b14cc['stack']);if(_0x1b14cc[_0xeeb0('0x27')]){delete _0x1b14cc['name'];}_0x53c570[_0xeeb0('0x1a')](_0x1913ed)[_0xeeb0('0x28')](_0x1b14cc);};}exports[_0xeeb0('0x29')]=function(_0x10345,_0x5008c8){var _0x5b7df0={},_0x2e9f71={},_0x37a3d7={'count':0x0,'rows':[]};var _0x4d541b=_['map'](db['SmsTransferReport'][_0xeeb0('0x2a')],function(_0x57dc19){return{'name':_0x57dc19[_0xeeb0('0x2b')],'type':_0x57dc19[_0xeeb0('0x2c')][_0xeeb0('0x2d')]};});_0x2e9f71[_0xeeb0('0x2e')]=_[_0xeeb0('0x2f')](_0x4d541b,_0xeeb0('0x27'));_0x2e9f71['query']=_[_0xeeb0('0x30')](_0x10345['query']);_0x2e9f71[_0xeeb0('0x31')]=_[_0xeeb0('0x32')](_0x2e9f71[_0xeeb0('0x2e')],_0x2e9f71[_0xeeb0('0x33')]);_0x5b7df0['attributes']=_[_0xeeb0('0x32')](_0x2e9f71[_0xeeb0('0x2e')],qs[_0xeeb0('0x34')](_0x10345[_0xeeb0('0x33')][_0xeeb0('0x34')]));_0x5b7df0[_0xeeb0('0x35')]=_0x5b7df0[_0xeeb0('0x35')][_0xeeb0('0x36')]?_0x5b7df0['attributes']:_0x2e9f71['model'];if(!_0x10345[_0xeeb0('0x33')][_0xeeb0('0x37')](_0xeeb0('0x38'))){_0x5b7df0[_0xeeb0('0x39')]=qs['limit'](_0x10345[_0xeeb0('0x33')]['limit']);_0x5b7df0['offset']=qs[_0xeeb0('0x1e')](_0x10345[_0xeeb0('0x33')][_0xeeb0('0x1e')]);}_0x5b7df0['order']=qs[_0xeeb0('0x3a')](_0x10345[_0xeeb0('0x33')][_0xeeb0('0x3a')]);_0x5b7df0[_0xeeb0('0x3b')]=qs['filters'](_[_0xeeb0('0x3c')](_0x10345[_0xeeb0('0x33')],_0x2e9f71[_0xeeb0('0x31')]),_0x4d541b);if(_0x10345[_0xeeb0('0x33')][_0xeeb0('0x3d')]){_0x5b7df0[_0xeeb0('0x3b')]=_[_0xeeb0('0x3e')](_0x5b7df0[_0xeeb0('0x3b')],{'$or':_[_0xeeb0('0x2f')](_0x4d541b,function(_0x21d6c6){if(_0x21d6c6[_0xeeb0('0x2c')]!==_0xeeb0('0x3f')){var _0x34ff9e={};_0x34ff9e[_0x21d6c6['name']]={'$like':'%'+_0x10345[_0xeeb0('0x33')][_0xeeb0('0x3d')]+'%'};return _0x34ff9e;}})});}_0x5b7df0=_[_0xeeb0('0x3e')]({},_0x5b7df0,_0x10345[_0xeeb0('0x40')]);var _0x9c7771={'where':_0x5b7df0[_0xeeb0('0x3b')]};return db[_0xeeb0('0x41')][_0xeeb0('0x1f')](_0x9c7771)[_0xeeb0('0x24')](function(_0x14cadc){_0x37a3d7[_0xeeb0('0x1f')]=_0x14cadc;if(_0x10345[_0xeeb0('0x33')][_0xeeb0('0x42')]){_0x5b7df0[_0xeeb0('0x43')]=[{'all':!![]}];}return db[_0xeeb0('0x41')][_0xeeb0('0x44')](_0x5b7df0);})[_0xeeb0('0x24')](function(_0x229df5){_0x37a3d7[_0xeeb0('0x45')]=_0x229df5;return _0x37a3d7;})[_0xeeb0('0x24')](respondWithFilteredResult(_0x5008c8,_0x5b7df0))[_0xeeb0('0x46')](handleError(_0x5008c8,null));};exports[_0xeeb0('0x47')]=function(_0x2ce46e,_0x18585d){var _0x16f20d={'raw':!![],'where':{'id':_0x2ce46e['params']['id']}},_0x2204c0={};_0x2204c0['model']=_[_0xeeb0('0x30')](db[_0xeeb0('0x41')]['rawAttributes']);_0x2204c0[_0xeeb0('0x33')]=_[_0xeeb0('0x30')](_0x2ce46e['query']);_0x2204c0['filters']=_[_0xeeb0('0x32')](_0x2204c0[_0xeeb0('0x2e')],_0x2204c0[_0xeeb0('0x33')]);_0x16f20d['attributes']=_[_0xeeb0('0x32')](_0x2204c0[_0xeeb0('0x2e')],qs['fields'](_0x2ce46e['query'][_0xeeb0('0x34')]));_0x16f20d[_0xeeb0('0x35')]=_0x16f20d[_0xeeb0('0x35')]['length']?_0x16f20d[_0xeeb0('0x35')]:_0x2204c0['model'];if(_0x2ce46e[_0xeeb0('0x33')]['includeAll']){_0x16f20d[_0xeeb0('0x43')]=[{'all':!![]}];}_0x16f20d=_[_0xeeb0('0x3e')]({},_0x16f20d,_0x2ce46e[_0xeeb0('0x40')]);return db[_0xeeb0('0x41')][_0xeeb0('0x48')](_0x16f20d)['then'](handleEntityNotFound(_0x18585d,null))[_0xeeb0('0x24')](respondWithResult(_0x18585d,null))[_0xeeb0('0x46')](handleError(_0x18585d,null));};exports['create']=function(_0x40b89,_0x1e4913){return db['SmsTransferReport'][_0xeeb0('0x49')](_0x40b89[_0xeeb0('0x4a')],{})[_0xeeb0('0x24')](respondWithResult(_0x1e4913,0xc9))['catch'](handleError(_0x1e4913,null));};exports[_0xeeb0('0x4b')]=function(_0x164518,_0x5951bc){if(_0x164518[_0xeeb0('0x4a')]['id']){delete _0x164518['body']['id'];}return db[_0xeeb0('0x41')][_0xeeb0('0x48')]({'where':{'id':_0x164518[_0xeeb0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5951bc,null))[_0xeeb0('0x24')](saveUpdates(_0x164518['body'],null))['then'](respondWithResult(_0x5951bc,null))[_0xeeb0('0x46')](handleError(_0x5951bc,null));};exports[_0xeeb0('0x25')]=function(_0x37a692,_0x3a2984){return db[_0xeeb0('0x41')][_0xeeb0('0x48')]({'where':{'id':_0x37a692[_0xeeb0('0x4c')]['id']}})[_0xeeb0('0x24')](handleEntityNotFound(_0x3a2984,null))[_0xeeb0('0x24')](removeEntity(_0x3a2984,null))[_0xeeb0('0x46')](handleError(_0x3a2984,null));};exports[_0xeeb0('0x4d')]=function(_0xc27101,_0x34d462){return db['SmsTransferReport'][_0xeeb0('0x4d')]()[_0xeeb0('0x24')](respondWithResult(_0x34d462,null))[_0xeeb0('0x46')](handleError(_0x34d462,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 0a352ba..b56b31e 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 _0x25b0=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util'];(function(_0x36d780,_0x493be1){var _0x491eda=function(_0x5c741e){while(--_0x5c741e){_0x36d780['push'](_0x36d780['shift']());}};_0x491eda(++_0x493be1);}(_0x25b0,0x140));var _0x025b=function(_0x24b477,_0x30393b){_0x24b477=_0x24b477-0x0;var _0x4041a6=_0x25b0[_0x24b477];return _0x4041a6;};'use strict';var _=require(_0x025b('0x0'));var util=require(_0x025b('0x1'));var logger=require(_0x025b('0x2'))(_0x025b('0x3'));var moment=require(_0x025b('0x4'));var BPromise=require(_0x025b('0x5'));var rp=require(_0x025b('0x6'));var fs=require('fs');var path=require(_0x025b('0x7'));var rimraf=require(_0x025b('0x8'));var config=require(_0x025b('0x9'));var attributes=require('./smsTransferReport.attributes');module[_0x025b('0xa')]=function(_0x41b88b,_0x41d8a4){return _0x41b88b['define'](_0x025b('0xb'),attributes,{'tableName':_0x025b('0xc'),'paranoid':![],'indexes':[{'name':_0x025b('0xd'),'fields':[_0x025b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x09f4=['rimraf','../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport','report_sms_transfer','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x67dfbd,_0x5f579b){var _0x34d18a=function(_0x44b3ac){while(--_0x44b3ac){_0x67dfbd['push'](_0x67dfbd['shift']());}};_0x34d18a(++_0x5f579b);}(_0x09f4,0xe4));var _0x409f=function(_0x155303,_0x4e1b90){_0x155303=_0x155303-0x0;var _0x545d2e=_0x09f4[_0x155303];return _0x545d2e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x409f('0x0'))(_0x409f('0x1'));var moment=require(_0x409f('0x2'));var BPromise=require(_0x409f('0x3'));var rp=require(_0x409f('0x4'));var fs=require('fs');var path=require(_0x409f('0x5'));var rimraf=require(_0x409f('0x6'));var config=require(_0x409f('0x7'));var attributes=require(_0x409f('0x8'));module[_0x409f('0x9')]=function(_0x2ca9ed,_0x4a17e8){return _0x2ca9ed['define'](_0x409f('0xa'),attributes,{'tableName':_0x409f('0xb'),'paranoid':![],'indexes':[{'name':_0x409f('0xc'),'fields':[_0x409f('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 a453188..245f767 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 _0xb957=['info','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','SmsTransferReport,\x20%s,\x20%s','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x10cdec,_0x1acbcb){var _0x109d46=function(_0x15623f){while(--_0x15623f){_0x10cdec['push'](_0x10cdec['shift']());}};_0x109d46(++_0x1acbcb);}(_0xb957,0x6d));var _0x7b95=function(_0xc0140,_0x259b9f){_0xc0140=_0xc0140-0x0;var _0x383a12=_0xb957[_0xc0140];return _0x383a12;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7b95('0x0'));var BPromise=require('bluebird');var rs=require(_0x7b95('0x1'));var fs=require('fs');var Redis=require(_0x7b95('0x2'));var db=require(_0x7b95('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b95('0x4'))(_0x7b95('0x5'));var config=require(_0x7b95('0x6'));var jayson=require(_0x7b95('0x7'));var client=jayson[_0x7b95('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2912d5,_0x16b05a,_0x161768){return new BPromise(function(_0x495bea,_0x5e1421){return client[_0x7b95('0x9')](_0x2912d5,_0x161768)[_0x7b95('0xa')](function(_0x2e82e6){logger[_0x7b95('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x16b05a,'request\x20sent');logger['debug'](_0x7b95('0xc'),_0x16b05a,_0x7b95('0xd'),JSON['stringify'](_0x2e82e6));if(_0x2e82e6['error']){if(_0x2e82e6[_0x7b95('0xe')][_0x7b95('0xf')]===0x1f4){logger[_0x7b95('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0x16b05a,_0x2e82e6['error'][_0x7b95('0x10')]);return _0x5e1421(_0x2e82e6['error'][_0x7b95('0x10')]);}logger[_0x7b95('0xe')](_0x7b95('0x11'),_0x16b05a,_0x2e82e6[_0x7b95('0xe')]['message']);return _0x495bea(_0x2e82e6['error'][_0x7b95('0x10')]);}else{logger[_0x7b95('0xb')](_0x7b95('0x11'),_0x16b05a,_0x7b95('0xd'));_0x495bea(_0x2e82e6[_0x7b95('0x12')][_0x7b95('0x10')]);}})[_0x7b95('0x13')](function(_0x44e836){logger[_0x7b95('0xe')](_0x7b95('0x11'),_0x16b05a,_0x44e836);_0x5e1421(_0x44e836);});});} \ No newline at end of file +var _0x3c17=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','randomstring'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x3c17,0x1a1));var _0x73c1=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x3c17[_0x25bea7];return _0x175952;};'use strict';var _=require(_0x73c1('0x0'));var util=require('util');var moment=require(_0x73c1('0x1'));var BPromise=require('bluebird');var rs=require(_0x73c1('0x2'));var fs=require('fs');var Redis=require(_0x73c1('0x3'));var db=require(_0x73c1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x73c1('0x5'))(_0x73c1('0x6'));var config=require(_0x73c1('0x7'));var jayson=require(_0x73c1('0x8'));var client=jayson['client'][_0x73c1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58151c,_0x4433e0,_0x42ca06){return new BPromise(function(_0x422176,_0x5155aa){return client['request'](_0x58151c,_0x42ca06)[_0x73c1('0xa')](function(_0x2eb6fe){logger[_0x73c1('0xb')](_0x73c1('0xc'),_0x4433e0,_0x73c1('0xd'));logger[_0x73c1('0xe')](_0x73c1('0xf'),_0x4433e0,'request\x20sent',JSON['stringify'](_0x2eb6fe));if(_0x2eb6fe[_0x73c1('0x10')]){if(_0x2eb6fe[_0x73c1('0x10')][_0x73c1('0x11')]===0x1f4){logger[_0x73c1('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x4433e0,_0x2eb6fe[_0x73c1('0x10')]['message']);return _0x5155aa(_0x2eb6fe[_0x73c1('0x10')]['message']);}logger[_0x73c1('0x10')](_0x73c1('0xc'),_0x4433e0,_0x2eb6fe['error']['message']);return _0x422176(_0x2eb6fe[_0x73c1('0x10')]['message']);}else{logger[_0x73c1('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x4433e0,_0x73c1('0xd'));_0x422176(_0x2eb6fe['result'][_0x73c1('0x12')]);}})[_0x73c1('0x13')](function(_0x39256e){logger[_0x73c1('0x10')](_0x73c1('0xc'),_0x4433e0,_0x39256e);_0x5155aa(_0x39256e);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 54c8a24..0f5cba0 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 _0x9853=['download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','post','single','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show'];(function(_0x2b415a,_0x25a7fc){var _0x373cd5=function(_0x135986){while(--_0x135986){_0x2b415a['push'](_0x2b415a['shift']());}};_0x373cd5(++_0x25a7fc);}(_0x9853,0x6b));var _0x3985=function(_0x5d4ca7,_0x19113b){_0x5d4ca7=_0x5d4ca7-0x0;var _0x3efc03=_0x9853[_0x5d4ca7];return _0x3efc03;};'use strict';var multer=require(_0x3985('0x0'));var util=require('util');var path=require(_0x3985('0x1'));var timeout=require(_0x3985('0x2'));var express=require(_0x3985('0x3'));var router=express[_0x3985('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3985('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3985('0x6'));var controller=require(_0x3985('0x7'));router[_0x3985('0x8')]('/',auth[_0x3985('0x9')](),controller[_0x3985('0xa')]);router[_0x3985('0x8')](_0x3985('0xb'),auth[_0x3985('0x9')](),controller[_0x3985('0xc')]);router[_0x3985('0x8')]('/:id/download',auth[_0x3985('0x9')](),controller[_0x3985('0xd')]);var upload=multer({'storage':multer[_0x3985('0xe')]({'destination':function(_0x5c8375,_0x5d1ccd,_0x1375d1){_0x1375d1(null,path[_0x3985('0xf')](config[_0x3985('0x10')],_0x3985('0x11')));},'filename':function(_0x3ebcce,_0x5246ab,_0x4275a9){_0x5246ab[_0x3985('0x12')]=_0x5246ab[_0x3985('0x12')][_0x3985('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4275a9(null,util[_0x3985('0x14')](_0x3985('0x15'),path[_0x3985('0x16')](_0x5246ab[_0x3985('0x12')],path['extname'](_0x5246ab[_0x3985('0x12')])),Date['now'](),path['extname'](_0x5246ab[_0x3985('0x12')])));}})});router[_0x3985('0x17')]('/',upload[_0x3985('0x18')]('file'),controller[_0x3985('0x19')]);router[_0x3985('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x3985('0x1b')]);router[_0x3985('0x1c')](_0x3985('0xb'),auth[_0x3985('0x9')](),controller[_0x3985('0x1c')]);module[_0x3985('0x1d')]=router; \ No newline at end of file +var _0x44e8=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','get','index','/:id','isAuthenticated','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','extname','now','post','single','file','create','put','delete','exports','multer','connect-timeout'];(function(_0x45c10a,_0x4b9090){var _0x3f680=function(_0x26243e){while(--_0x26243e){_0x45c10a['push'](_0x45c10a['shift']());}};_0x3f680(++_0x4b9090);}(_0x44e8,0xd7));var _0x844e=function(_0x561de1,_0x517bdf){_0x561de1=_0x561de1-0x0;var _0x1f661d=_0x44e8[_0x561de1];return _0x1f661d;};'use strict';var multer=require(_0x844e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x844e('0x1'));var express=require(_0x844e('0x2'));var router=express[_0x844e('0x3')]();var fs_extra=require(_0x844e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x844e('0x5'));var config=require(_0x844e('0x6'));var controller=require(_0x844e('0x7'));router[_0x844e('0x8')]('/',auth['isAuthenticated'](),controller[_0x844e('0x9')]);router[_0x844e('0x8')](_0x844e('0xa'),auth[_0x844e('0xb')](),controller['show']);router[_0x844e('0x8')](_0x844e('0xc'),auth[_0x844e('0xb')](),controller[_0x844e('0xd')]);var upload=multer({'storage':multer[_0x844e('0xe')]({'destination':function(_0x1f9921,_0x536601,_0x39ef28){_0x39ef28(null,path[_0x844e('0xf')](config[_0x844e('0x10')],_0x844e('0x11')));},'filename':function(_0x14909f,_0x37b2a3,_0x1bcd27){_0x37b2a3['originalname']=_0x37b2a3[_0x844e('0x12')][_0x844e('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1bcd27(null,util['format'](_0x844e('0x14'),path[_0x844e('0x15')](_0x37b2a3['originalname'],path[_0x844e('0x16')](_0x37b2a3[_0x844e('0x12')])),Date[_0x844e('0x17')](),path['extname'](_0x37b2a3[_0x844e('0x12')])));}})});router[_0x844e('0x18')]('/',upload[_0x844e('0x19')](_0x844e('0x1a')),controller[_0x844e('0x1b')]);router[_0x844e('0x1c')](_0x844e('0xa'),auth[_0x844e('0xb')](),controller['update']);router[_0x844e('0x1d')]('/:id',auth[_0x844e('0xb')](),controller['delete']);module[_0x844e('0x1e')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index bbb3414..34bc574 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 _0xe42b=['BIGINT','INTEGER','sequelize','STRING','name','FLOAT'];(function(_0x42d41d,_0x17b8ea){var _0x2e6184=function(_0x3104f0){while(--_0x3104f0){_0x42d41d['push'](_0x42d41d['shift']());}};_0x2e6184(++_0x17b8ea);}(_0xe42b,0xfe));var _0xbe42=function(_0x231829,_0x376ec3){_0x231829=_0x231829-0x0;var _0x5b6c7d=_0xe42b[_0x231829];return _0x5b6c7d;};'use strict';var Sequelize=require(_0xbe42('0x0'));module['exports']={'name':{'type':Sequelize[_0xbe42('0x1')],'unique':_0xbe42('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0xbe42('0x1')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0xbe42('0x1')]},'original_duration':{'type':Sequelize[_0xbe42('0x3')]},'original_sampleCount':{'type':Sequelize[_0xbe42('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xbe42('0x5')]},'converted_format':{'type':Sequelize[_0xbe42('0x1')]},'converted_duration':{'type':Sequelize[_0xbe42('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xbe42('0x5')]},'converted_bitRate':{'type':Sequelize[_0xbe42('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xbe42('0x5')]}}; \ No newline at end of file +var _0x41e7=['exports','STRING','name','BIGINT','FLOAT','INTEGER','sequelize'];(function(_0x55a3b4,_0x47088b){var _0x4fe7f2=function(_0x596e64){while(--_0x596e64){_0x55a3b4['push'](_0x55a3b4['shift']());}};_0x4fe7f2(++_0x47088b);}(_0x41e7,0x6f));var _0x741e=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x41e7[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x741e('0x0'));module[_0x741e('0x1')]={'name':{'type':Sequelize[_0x741e('0x2')],'unique':_0x741e('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x741e('0x2')]},'display_name':{'type':Sequelize[_0x741e('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x741e('0x2')]},'original_format':{'type':Sequelize[_0x741e('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x741e('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x741e('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x741e('0x5')]},'converted_sampleCount':{'type':Sequelize[_0x741e('0x4')]},'converted_channelCount':{'type':Sequelize[_0x741e('0x6')]},'converted_bitRate':{'type':Sequelize[_0x741e('0x4')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index cfb9628..a5ea6a8 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 _0xb7a1=['reject','update','then','destroy','get','Sounds','UserProfileResource','stack','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','Sound','includeAll','include','rows','catch','show','params','rawAttributes','options','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','format','%s.%s','basename','file','extname','originalname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','user','UserProfileSection','find','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','delete','original_format','end','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply'];(function(_0x2b5a81,_0xbcf7b){var _0xc957b7=function(_0x87e2b5){while(--_0x87e2b5){_0x2b5a81['push'](_0x2b5a81['shift']());}};_0xc957b7(++_0xbcf7b);}(_0xb7a1,0x1e1));var _0x1b7a=function(_0x482723,_0x4d6dcf){_0x482723=_0x482723-0x0;var _0x166670=_0xb7a1[_0x482723];return _0x166670;};'use strict';var emlformat=require(_0x1b7a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1b7a('0x1'));var jsonpatch=require(_0x1b7a('0x2'));var rp=require(_0x1b7a('0x3'));var moment=require(_0x1b7a('0x4'));var BPromise=require(_0x1b7a('0x5'));var Mustache=require(_0x1b7a('0x6'));var util=require(_0x1b7a('0x7'));var path=require(_0x1b7a('0x8'));var sox=require(_0x1b7a('0x9'));var csv=require(_0x1b7a('0xa'));var ejs=require(_0x1b7a('0xb'));var fs=require('fs');var fs_extra=require(_0x1b7a('0xc'));var _=require(_0x1b7a('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1b7a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1b7a('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1b7a('0xf'));var authService=require(_0x1b7a('0x10'));var qs=require(_0x1b7a('0x11'));var as=require(_0x1b7a('0x12'));var hardwareService=require(_0x1b7a('0x13'));var logger=require(_0x1b7a('0x14'))(_0x1b7a('0x15'));var utils=require(_0x1b7a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1b7a('0x17'));var db=require(_0x1b7a('0x18'))['db'];function respondWithStatusCode(_0x25cb29,_0x1d2972){_0x1d2972=_0x1d2972||0xcc;return function(_0x40a365){if(_0x40a365){return _0x25cb29[_0x1b7a('0x19')](_0x1d2972);}return _0x25cb29['status'](_0x1d2972)['end']();};}function respondWithResult(_0x14d083,_0x1c8ccf){_0x1c8ccf=_0x1c8ccf||0xc8;return function(_0x35a662){if(_0x35a662){return _0x14d083[_0x1b7a('0x1a')](_0x1c8ccf)[_0x1b7a('0x1b')](_0x35a662);}};}function respondWithFilteredResult(_0x339802,_0x49a66e){return function(_0x171b83){if(_0x171b83){var _0x42d8f5=typeof _0x49a66e[_0x1b7a('0x1c')]===_0x1b7a('0x1d')&&typeof _0x49a66e['limit']==='undefined';var _0x35773a=_0x171b83[_0x1b7a('0x1e')];var _0x195b51=_0x42d8f5?0x0:_0x49a66e[_0x1b7a('0x1c')];var _0x3d6657=_0x42d8f5?_0x171b83[_0x1b7a('0x1e')]:_0x49a66e['offset']+_0x49a66e[_0x1b7a('0x1f')];var _0x34d8a4;if(_0x3d6657>=_0x35773a){_0x3d6657=_0x35773a;_0x34d8a4=0xc8;}else{_0x34d8a4=0xce;}_0x339802[_0x1b7a('0x1a')](_0x34d8a4);return _0x339802[_0x1b7a('0x20')](_0x1b7a('0x21'),_0x195b51+'-'+_0x3d6657+'/'+_0x35773a)['json'](_0x171b83);}return null;};}function patchUpdates(_0x1caae8){return function(_0x2b5dcb){try{jsonpatch[_0x1b7a('0x22')](_0x2b5dcb,_0x1caae8,!![]);}catch(_0x45e6dd){return BPromise[_0x1b7a('0x23')](_0x45e6dd);}return _0x2b5dcb['save']();};}function saveUpdates(_0x3190c1,_0x57e79f){return function(_0x28d6b7){if(_0x28d6b7){return _0x28d6b7[_0x1b7a('0x24')](_0x3190c1)[_0x1b7a('0x25')](function(_0x22d0b1){return _0x22d0b1;});}return null;};}function removeEntity(_0x5b3b38,_0x358d43){return function(_0x3ee349){if(_0x3ee349){return _0x3ee349[_0x1b7a('0x26')]()[_0x1b7a('0x25')](function(){var _0x393751=_0x3ee349[_0x1b7a('0x27')]({'plain':!![]});var _0x23a19b=_0x1b7a('0x28');return db[_0x1b7a('0x29')][_0x1b7a('0x26')]({'where':{'type':_0x23a19b,'resourceId':_0x393751['id']}})['then'](function(){return _0x3ee349;});})['then'](function(){_0x5b3b38['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x21002d,_0x5cbe67){return function(_0x1a35cb){if(!_0x1a35cb){_0x21002d[_0x1b7a('0x19')](0x194);}return _0x1a35cb;};}function handleError(_0x1eb108,_0x1cd4d1){_0x1cd4d1=_0x1cd4d1||0x1f4;return function(_0x4dacdf){logger['error'](_0x4dacdf[_0x1b7a('0x2a')]);if(_0x4dacdf[_0x1b7a('0x2b')]){delete _0x4dacdf['name'];}_0x1eb108[_0x1b7a('0x1a')](_0x1cd4d1)[_0x1b7a('0x2c')](_0x4dacdf);};}exports['index']=function(_0x1f2010,_0x417473){var _0x1cc519={},_0x11b997={},_0x4fd185={'count':0x0,'rows':[]};var _0x387bca=_[_0x1b7a('0x2d')](db['Sound']['rawAttributes'],function(_0x11ae81){return{'name':_0x11ae81[_0x1b7a('0x2e')],'type':_0x11ae81[_0x1b7a('0x2f')][_0x1b7a('0x30')]};});_0x11b997[_0x1b7a('0x31')]=_[_0x1b7a('0x2d')](_0x387bca,'name');_0x11b997[_0x1b7a('0x32')]=_[_0x1b7a('0x33')](_0x1f2010[_0x1b7a('0x32')]);_0x11b997[_0x1b7a('0x34')]=_[_0x1b7a('0x35')](_0x11b997[_0x1b7a('0x31')],_0x11b997[_0x1b7a('0x32')]);_0x1cc519[_0x1b7a('0x36')]=_['intersection'](_0x11b997['model'],qs[_0x1b7a('0x37')](_0x1f2010[_0x1b7a('0x32')]['fields']));_0x1cc519[_0x1b7a('0x36')]=_0x1cc519[_0x1b7a('0x36')][_0x1b7a('0x38')]?_0x1cc519['attributes']:_0x11b997[_0x1b7a('0x31')];if(!_0x1f2010[_0x1b7a('0x32')][_0x1b7a('0x39')](_0x1b7a('0x3a'))){_0x1cc519[_0x1b7a('0x1f')]=qs[_0x1b7a('0x1f')](_0x1f2010['query'][_0x1b7a('0x1f')]);_0x1cc519[_0x1b7a('0x1c')]=qs[_0x1b7a('0x1c')](_0x1f2010[_0x1b7a('0x32')][_0x1b7a('0x1c')]);}_0x1cc519['order']=qs[_0x1b7a('0x3b')](_0x1f2010[_0x1b7a('0x32')][_0x1b7a('0x3b')]);_0x1cc519[_0x1b7a('0x3c')]=qs[_0x1b7a('0x34')](_['pick'](_0x1f2010['query'],_0x11b997['filters']),_0x387bca);if(_0x1f2010[_0x1b7a('0x32')][_0x1b7a('0x3d')]){_0x1cc519[_0x1b7a('0x3c')]=_['merge'](_0x1cc519[_0x1b7a('0x3c')],{'$or':_[_0x1b7a('0x2d')](_0x387bca,function(_0x5ee1ca){if(_0x5ee1ca[_0x1b7a('0x2f')]!==_0x1b7a('0x3e')){var _0x5661ee={};_0x5661ee[_0x5ee1ca[_0x1b7a('0x2b')]]={'$like':'%'+_0x1f2010[_0x1b7a('0x32')]['filter']+'%'};return _0x5661ee;}})});}_0x1cc519=_[_0x1b7a('0x3f')]({},_0x1cc519,_0x1f2010['options']);var _0x16b8bf={'where':_0x1cc519[_0x1b7a('0x3c')]};return db[_0x1b7a('0x40')][_0x1b7a('0x1e')](_0x16b8bf)[_0x1b7a('0x25')](function(_0x59c3a8){_0x4fd185['count']=_0x59c3a8;if(_0x1f2010[_0x1b7a('0x32')][_0x1b7a('0x41')]){_0x1cc519[_0x1b7a('0x42')]=[{'all':!![]}];}return db[_0x1b7a('0x40')]['findAll'](_0x1cc519);})[_0x1b7a('0x25')](function(_0x293aba){_0x4fd185[_0x1b7a('0x43')]=_0x293aba;return _0x4fd185;})[_0x1b7a('0x25')](respondWithFilteredResult(_0x417473,_0x1cc519))[_0x1b7a('0x44')](handleError(_0x417473,null));};exports[_0x1b7a('0x45')]=function(_0x244862,_0x546cc6){var _0x509c8b={'raw':!![],'where':{'id':_0x244862[_0x1b7a('0x46')]['id']}},_0x2f8074={};_0x2f8074[_0x1b7a('0x31')]=_[_0x1b7a('0x33')](db[_0x1b7a('0x40')][_0x1b7a('0x47')]);_0x2f8074[_0x1b7a('0x32')]=_[_0x1b7a('0x33')](_0x244862[_0x1b7a('0x32')]);_0x2f8074[_0x1b7a('0x34')]=_[_0x1b7a('0x35')](_0x2f8074[_0x1b7a('0x31')],_0x2f8074['query']);_0x509c8b[_0x1b7a('0x36')]=_[_0x1b7a('0x35')](_0x2f8074[_0x1b7a('0x31')],qs[_0x1b7a('0x37')](_0x244862['query'][_0x1b7a('0x37')]));_0x509c8b[_0x1b7a('0x36')]=_0x509c8b['attributes'][_0x1b7a('0x38')]?_0x509c8b[_0x1b7a('0x36')]:_0x2f8074[_0x1b7a('0x31')];if(_0x244862[_0x1b7a('0x32')][_0x1b7a('0x41')]){_0x509c8b[_0x1b7a('0x42')]=[{'all':!![]}];}_0x509c8b=_['merge']({},_0x509c8b,_0x244862[_0x1b7a('0x48')]);return db[_0x1b7a('0x40')]['find'](_0x509c8b)[_0x1b7a('0x25')](handleEntityNotFound(_0x546cc6,null))[_0x1b7a('0x25')](respondWithResult(_0x546cc6,null))[_0x1b7a('0x44')](handleError(_0x546cc6,null));};exports[_0x1b7a('0x49')]=function(_0x1834b1,_0x219001,_0x2b3de6){return db[_0x1b7a('0x40')]['find']({'where':{'id':_0x1834b1[_0x1b7a('0x46')]['id']},'attributes':[_0x1b7a('0x2b'),_0x1b7a('0x4a'),_0x1b7a('0x4b')],'raw':!![]})[_0x1b7a('0x25')](handleEntityNotFound(_0x219001,null))[_0x1b7a('0x25')](function(_0x50eeef){if(_0x50eeef){if(!fs[_0x1b7a('0x4c')](path[_0x1b7a('0x4d')](config[_0x1b7a('0x4e')],_0x1b7a('0x4f'),_0x50eeef['save_name']+'.'+_0x50eeef['converted_format']))){throw new db[(_0x1b7a('0x50'))]['ValidationError'](_0x1b7a('0x51'));}return _0x219001[_0x1b7a('0x49')](path['join'](config[_0x1b7a('0x4e')],_0x1b7a('0x4f'),util[_0x1b7a('0x52')](_0x1b7a('0x53'),_0x50eeef[_0x1b7a('0x4a')],_0x50eeef[_0x1b7a('0x4b')])),util['format'](_0x1b7a('0x53'),_0x50eeef[_0x1b7a('0x2b')],_0x50eeef[_0x1b7a('0x4b')]));}return null;})[_0x1b7a('0x44')](handleError(_0x219001,null));};exports['create']=function(_0x12102f,_0x1b8530,_0x27470c){var _0x4f3085={'name':path[_0x1b7a('0x54')](_0x12102f[_0x1b7a('0x55')]['originalname'],path[_0x1b7a('0x56')](_0x12102f[_0x1b7a('0x55')][_0x1b7a('0x57')])),'save_name':path[_0x1b7a('0x54')](_0x12102f[_0x1b7a('0x55')][_0x1b7a('0x58')],path['extname'](_0x12102f[_0x1b7a('0x55')]['filename'])),'original_format':path[_0x1b7a('0x56')](_0x12102f[_0x1b7a('0x55')][_0x1b7a('0x57')])[_0x1b7a('0x59')](0x1),'converted_format':_0x1b7a('0x5a')};var _0x155624=path[_0x1b7a('0x4d')](config[_0x1b7a('0x4e')],_0x1b7a('0x5b'),_0x12102f['file'][_0x1b7a('0x58')]);var _0x5983f8=path[_0x1b7a('0x4d')](config[_0x1b7a('0x4e')],_0x1b7a('0x4f'),util[_0x1b7a('0x52')]('%s.%s',path[_0x1b7a('0x54')](_0x12102f[_0x1b7a('0x55')][_0x1b7a('0x58')],path['extname'](_0x12102f[_0x1b7a('0x55')][_0x1b7a('0x58')])),_0x4f3085['converted_format']));logger[_0x1b7a('0x5c')](_0x1b7a('0x5d'),_0x155624);logger[_0x1b7a('0x5c')](_0x1b7a('0x5e'),_0x5983f8);try{fs[_0x1b7a('0x5f')](_0x155624,parseInt(_0x1b7a('0x60'),0x8));var _0x5d65ae=sox[_0x1b7a('0x61')](_0x155624,_0x5983f8,{'sampleRate':0x1f40,'format':_0x1b7a('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5d65ae['on']('error',function(_0x185515){fs[_0x1b7a('0x62')](_0x155624);_0x1b8530[_0x1b7a('0x1a')](0x1f4)[_0x1b7a('0x2c')](_0x185515);});_0x5d65ae['on'](_0x1b7a('0x63'),function(_0x29e079){_0x4f3085[_0x1b7a('0x64')]=isNaN(_0x29e079[_0x1b7a('0x65')])?null:_0x29e079['duration']*0x3e8;_0x4f3085['original_sampleCount']=isNaN(_0x29e079[_0x1b7a('0x66')])?null:_0x29e079[_0x1b7a('0x66')];_0x4f3085[_0x1b7a('0x67')]=isNaN(_0x29e079[_0x1b7a('0x68')])?null:_0x29e079[_0x1b7a('0x68')];_0x4f3085[_0x1b7a('0x69')]=isNaN(_0x29e079['bitRate'])?null:_0x29e079[_0x1b7a('0x6a')];_0x4f3085['original_sampleRate']=isNaN(_0x29e079[_0x1b7a('0x6b')])?null:_0x29e079[_0x1b7a('0x6b')];});_0x5d65ae['on']('dest',function(_0x40650e){_0x4f3085[_0x1b7a('0x6c')]=isNaN(_0x40650e['duration'])?null:_0x40650e['duration']*0x3e8;_0x4f3085[_0x1b7a('0x6d')]=isNaN(_0x40650e[_0x1b7a('0x66')])?null:_0x40650e['sampleCount'];_0x4f3085[_0x1b7a('0x6e')]=isNaN(_0x40650e['channelCount'])?null:_0x40650e[_0x1b7a('0x68')];_0x4f3085[_0x1b7a('0x6f')]=isNaN(_0x40650e[_0x1b7a('0x6a')])?null:_0x40650e[_0x1b7a('0x6a')];_0x4f3085[_0x1b7a('0x70')]=isNaN(_0x40650e['sampleRate'])?null:_0x40650e['sampleRate'];});_0x5d65ae['on']('end',function(){fs[_0x1b7a('0x5f')](_0x5983f8,parseInt(_0x1b7a('0x60'),0x8));return db[_0x1b7a('0x40')]['create'](_0x4f3085)[_0x1b7a('0x25')](function(_0x49839f){var _0x3c9019={'role':_0x12102f[_0x1b7a('0x71')][_0x1b7a('0x72')],'userProfileId':_0x12102f['body'][_0x1b7a('0x73')]};if(!_0x3c9019)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c9019[_0x1b7a('0x72')]===_0x1b7a('0x74')){var _0x51efa2=_0x49839f[_0x1b7a('0x27')]({'plain':!![]});return db[_0x1b7a('0x75')][_0x1b7a('0x76')]({'where':{'name':_0x1b7a('0x28'),'userProfileId':_0x3c9019[_0x1b7a('0x73')]},'raw':!![]})['then'](function(_0xcee3e6){if(_0xcee3e6&&_0xcee3e6[_0x1b7a('0x77')]===0x0){return db[_0x1b7a('0x29')][_0x1b7a('0x78')]({'name':_0x51efa2[_0x1b7a('0x2b')],'resourceId':_0x51efa2['id'],'type':_0xcee3e6[_0x1b7a('0x2b')],'sectionId':_0xcee3e6['id']},{})[_0x1b7a('0x25')](function(){return _0x49839f;});}else{return _0x49839f;}})[_0x1b7a('0x44')](function(_0x5772cd){logger[_0x1b7a('0x79')](_0x1b7a('0x7a'),_0x5772cd);throw _0x5772cd;});}return _0x49839f;})['then'](respondWithResult(_0x1b8530,null))[_0x1b7a('0x44')](handleError(_0x1b8530,null));});_0x5d65ae[_0x1b7a('0x7b')]();}catch(_0x1b5333){_0x1b8530[_0x1b7a('0x1a')](0x1f4)['send'](_0x1b5333);}};exports[_0x1b7a('0x24')]=function(_0x3ccde1,_0x2c0fc2,_0x3fb9fb){return db[_0x1b7a('0x40')][_0x1b7a('0x76')]({'where':{'id':_0x3ccde1[_0x1b7a('0x46')]['id']}})[_0x1b7a('0x25')](handleEntityNotFound(_0x2c0fc2,null))[_0x1b7a('0x25')](saveUpdates(_[_0x1b7a('0x7c')](_0x3ccde1[_0x1b7a('0x71')],[_0x1b7a('0x2b'),_0x1b7a('0x7d')]),null))[_0x1b7a('0x25')](respondWithResult(_0x2c0fc2,null))[_0x1b7a('0x44')](handleError(_0x2c0fc2,null));};exports[_0x1b7a('0x7e')]=function(_0x3023ca,_0x4f6927,_0x13459e){return db[_0x1b7a('0x40')][_0x1b7a('0x76')]({'where':{'id':_0x3023ca[_0x1b7a('0x46')]['id']}})[_0x1b7a('0x25')](function(_0x902727){if(_0x902727){return _0x902727[_0x1b7a('0x26')]();}})[_0x1b7a('0x25')](function(_0x16db74){var _0x4020aa=path[_0x1b7a('0x4d')](config['root'],_0x1b7a('0x5b'),util[_0x1b7a('0x52')](_0x1b7a('0x53'),_0x16db74[_0x1b7a('0x4a')],_0x16db74[_0x1b7a('0x7f')]));var _0x59857c=path[_0x1b7a('0x4d')](config[_0x1b7a('0x4e')],_0x1b7a('0x4f'),util[_0x1b7a('0x52')]('%s.%s',_0x16db74[_0x1b7a('0x4a')],_0x16db74[_0x1b7a('0x4b')]));fs[_0x1b7a('0x62')](_0x4020aa);fs[_0x1b7a('0x62')](_0x59857c);return _0x16db74;})[_0x1b7a('0x25')](function(_0x4774b6){if(_0x4774b6){return _0x4f6927[_0x1b7a('0x1a')](0xcc)[_0x1b7a('0x80')]();}})[_0x1b7a('0x25')](handleEntityNotFound(_0x4f6927,null))[_0x1b7a('0x44')](handleError(_0x4f6927,null));}; \ No newline at end of file +var _0x0f33=['Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_channelCount','converted_bitRate','converted_sampleRate','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','server/files/sounds/original','original_format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','get','Sounds','UserProfileResource','destroy','error','stack','name','send','index','map','Sound','rawAttributes','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','download','existsSync','join','root','converted_format','Sequelize','ValidationError','server/files/sounds/converted','save_name','format','%s.%s','create','file','originalname','extname','basename','filename','substring','wav','info'];(function(_0x22093a,_0xa7acf1){var _0x2f4989=function(_0x5bf12b){while(--_0x5bf12b){_0x22093a['push'](_0x22093a['shift']());}};_0x2f4989(++_0xa7acf1);}(_0x0f33,0x1a4));var _0x30f3=function(_0x4706b1,_0x2f3a48){_0x4706b1=_0x4706b1-0x0;var _0x429add=_0x0f33[_0x4706b1];return _0x429add;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x30f3('0x0'));var zipdir=require(_0x30f3('0x1'));var jsonpatch=require(_0x30f3('0x2'));var rp=require(_0x30f3('0x3'));var moment=require(_0x30f3('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x30f3('0x5'));var path=require(_0x30f3('0x6'));var sox=require(_0x30f3('0x7'));var csv=require(_0x30f3('0x8'));var ejs=require(_0x30f3('0x9'));var fs=require('fs');var fs_extra=require(_0x30f3('0xa'));var _=require(_0x30f3('0xb'));var squel=require(_0x30f3('0xc'));var crypto=require(_0x30f3('0xd'));var jsforce=require(_0x30f3('0xe'));var deskjs=require(_0x30f3('0xf'));var toCsv=require('to-csv');var querystring=require(_0x30f3('0x10'));var Papa=require(_0x30f3('0x11'));var Redis=require('ioredis');var authService=require(_0x30f3('0x12'));var qs=require(_0x30f3('0x13'));var as=require(_0x30f3('0x14'));var hardwareService=require(_0x30f3('0x15'));var logger=require(_0x30f3('0x16'))(_0x30f3('0x17'));var utils=require(_0x30f3('0x18'));var config=require(_0x30f3('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x30f3('0x1a'))['db'];function respondWithStatusCode(_0x1dc1df,_0x3e7e6e){_0x3e7e6e=_0x3e7e6e||0xcc;return function(_0x2c97b2){if(_0x2c97b2){return _0x1dc1df[_0x30f3('0x1b')](_0x3e7e6e);}return _0x1dc1df[_0x30f3('0x1c')](_0x3e7e6e)[_0x30f3('0x1d')]();};}function respondWithResult(_0x5e44e0,_0x6ec29b){_0x6ec29b=_0x6ec29b||0xc8;return function(_0x31b194){if(_0x31b194){return _0x5e44e0[_0x30f3('0x1c')](_0x6ec29b)[_0x30f3('0x1e')](_0x31b194);}};}function respondWithFilteredResult(_0x4b71b7,_0x557f6f){return function(_0x243bda){if(_0x243bda){var _0x1dac78=typeof _0x557f6f['offset']==='undefined'&&typeof _0x557f6f[_0x30f3('0x1f')]===_0x30f3('0x20');var _0x3aeb5b=_0x243bda[_0x30f3('0x21')];var _0x4431bb=_0x1dac78?0x0:_0x557f6f[_0x30f3('0x22')];var _0x5a9c9f=_0x1dac78?_0x243bda['count']:_0x557f6f[_0x30f3('0x22')]+_0x557f6f[_0x30f3('0x1f')];var _0x16aa5c;if(_0x5a9c9f>=_0x3aeb5b){_0x5a9c9f=_0x3aeb5b;_0x16aa5c=0xc8;}else{_0x16aa5c=0xce;}_0x4b71b7[_0x30f3('0x1c')](_0x16aa5c);return _0x4b71b7[_0x30f3('0x23')](_0x30f3('0x24'),_0x4431bb+'-'+_0x5a9c9f+'/'+_0x3aeb5b)[_0x30f3('0x1e')](_0x243bda);}return null;};}function patchUpdates(_0x2c4fe7){return function(_0x5ce830){try{jsonpatch[_0x30f3('0x25')](_0x5ce830,_0x2c4fe7,!![]);}catch(_0x4957d6){return BPromise[_0x30f3('0x26')](_0x4957d6);}return _0x5ce830[_0x30f3('0x27')]();};}function saveUpdates(_0x30a816,_0x4bf039){return function(_0xb3c1a1){if(_0xb3c1a1){return _0xb3c1a1[_0x30f3('0x28')](_0x30a816)[_0x30f3('0x29')](function(_0x2d0377){return _0x2d0377;});}return null;};}function removeEntity(_0x4b330a,_0x13f400){return function(_0x1f17ac){if(_0x1f17ac){return _0x1f17ac['destroy']()[_0x30f3('0x29')](function(){var _0x3625fb=_0x1f17ac[_0x30f3('0x2a')]({'plain':!![]});var _0x3913bf=_0x30f3('0x2b');return db[_0x30f3('0x2c')][_0x30f3('0x2d')]({'where':{'type':_0x3913bf,'resourceId':_0x3625fb['id']}})['then'](function(){return _0x1f17ac;});})[_0x30f3('0x29')](function(){_0x4b330a[_0x30f3('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44d2c1,_0x4b8ae9){return function(_0xe6597e){if(!_0xe6597e){_0x44d2c1[_0x30f3('0x1b')](0x194);}return _0xe6597e;};}function handleError(_0x28ef1e,_0x2b9133){_0x2b9133=_0x2b9133||0x1f4;return function(_0x1f217a){logger[_0x30f3('0x2e')](_0x1f217a[_0x30f3('0x2f')]);if(_0x1f217a[_0x30f3('0x30')]){delete _0x1f217a[_0x30f3('0x30')];}_0x28ef1e[_0x30f3('0x1c')](_0x2b9133)[_0x30f3('0x31')](_0x1f217a);};}exports[_0x30f3('0x32')]=function(_0x1a5ab7,_0xf1ba1){var _0x1434fb={},_0x308c97={},_0x4d53fb={'count':0x0,'rows':[]};var _0x45f090=_[_0x30f3('0x33')](db[_0x30f3('0x34')][_0x30f3('0x35')],function(_0x5d8ca0){return{'name':_0x5d8ca0['fieldName'],'type':_0x5d8ca0['type'][_0x30f3('0x36')]};});_0x308c97['model']=_[_0x30f3('0x33')](_0x45f090,_0x30f3('0x30'));_0x308c97[_0x30f3('0x37')]=_[_0x30f3('0x38')](_0x1a5ab7[_0x30f3('0x37')]);_0x308c97[_0x30f3('0x39')]=_[_0x30f3('0x3a')](_0x308c97['model'],_0x308c97[_0x30f3('0x37')]);_0x1434fb[_0x30f3('0x3b')]=_[_0x30f3('0x3a')](_0x308c97[_0x30f3('0x3c')],qs[_0x30f3('0x3d')](_0x1a5ab7[_0x30f3('0x37')][_0x30f3('0x3d')]));_0x1434fb[_0x30f3('0x3b')]=_0x1434fb[_0x30f3('0x3b')][_0x30f3('0x3e')]?_0x1434fb[_0x30f3('0x3b')]:_0x308c97[_0x30f3('0x3c')];if(!_0x1a5ab7[_0x30f3('0x37')]['hasOwnProperty'](_0x30f3('0x3f'))){_0x1434fb[_0x30f3('0x1f')]=qs[_0x30f3('0x1f')](_0x1a5ab7[_0x30f3('0x37')]['limit']);_0x1434fb[_0x30f3('0x22')]=qs[_0x30f3('0x22')](_0x1a5ab7[_0x30f3('0x37')][_0x30f3('0x22')]);}_0x1434fb[_0x30f3('0x40')]=qs['sort'](_0x1a5ab7['query'][_0x30f3('0x41')]);_0x1434fb['where']=qs[_0x30f3('0x39')](_[_0x30f3('0x42')](_0x1a5ab7[_0x30f3('0x37')],_0x308c97['filters']),_0x45f090);if(_0x1a5ab7[_0x30f3('0x37')][_0x30f3('0x43')]){_0x1434fb[_0x30f3('0x44')]=_[_0x30f3('0x45')](_0x1434fb[_0x30f3('0x44')],{'$or':_['map'](_0x45f090,function(_0x68e68c){if(_0x68e68c[_0x30f3('0x46')]!==_0x30f3('0x47')){var _0x35d0dc={};_0x35d0dc[_0x68e68c[_0x30f3('0x30')]]={'$like':'%'+_0x1a5ab7['query'][_0x30f3('0x43')]+'%'};return _0x35d0dc;}})});}_0x1434fb=_[_0x30f3('0x45')]({},_0x1434fb,_0x1a5ab7[_0x30f3('0x48')]);var _0x3a1272={'where':_0x1434fb[_0x30f3('0x44')]};return db['Sound'][_0x30f3('0x21')](_0x3a1272)['then'](function(_0x537614){_0x4d53fb[_0x30f3('0x21')]=_0x537614;if(_0x1a5ab7[_0x30f3('0x37')]['includeAll']){_0x1434fb[_0x30f3('0x49')]=[{'all':!![]}];}return db['Sound'][_0x30f3('0x4a')](_0x1434fb);})[_0x30f3('0x29')](function(_0x4ee238){_0x4d53fb[_0x30f3('0x4b')]=_0x4ee238;return _0x4d53fb;})[_0x30f3('0x29')](respondWithFilteredResult(_0xf1ba1,_0x1434fb))[_0x30f3('0x4c')](handleError(_0xf1ba1,null));};exports['show']=function(_0x39d6f4,_0x2a7415){var _0x4aea22={'raw':!![],'where':{'id':_0x39d6f4[_0x30f3('0x4d')]['id']}},_0x2f1a90={};_0x2f1a90['model']=_[_0x30f3('0x38')](db[_0x30f3('0x34')][_0x30f3('0x35')]);_0x2f1a90[_0x30f3('0x37')]=_[_0x30f3('0x38')](_0x39d6f4[_0x30f3('0x37')]);_0x2f1a90[_0x30f3('0x39')]=_[_0x30f3('0x3a')](_0x2f1a90[_0x30f3('0x3c')],_0x2f1a90['query']);_0x4aea22[_0x30f3('0x3b')]=_[_0x30f3('0x3a')](_0x2f1a90[_0x30f3('0x3c')],qs[_0x30f3('0x3d')](_0x39d6f4[_0x30f3('0x37')][_0x30f3('0x3d')]));_0x4aea22[_0x30f3('0x3b')]=_0x4aea22['attributes'][_0x30f3('0x3e')]?_0x4aea22['attributes']:_0x2f1a90['model'];if(_0x39d6f4[_0x30f3('0x37')][_0x30f3('0x4e')]){_0x4aea22[_0x30f3('0x49')]=[{'all':!![]}];}_0x4aea22=_[_0x30f3('0x45')]({},_0x4aea22,_0x39d6f4[_0x30f3('0x48')]);return db[_0x30f3('0x34')][_0x30f3('0x4f')](_0x4aea22)[_0x30f3('0x29')](handleEntityNotFound(_0x2a7415,null))[_0x30f3('0x29')](respondWithResult(_0x2a7415,null))[_0x30f3('0x4c')](handleError(_0x2a7415,null));};exports[_0x30f3('0x50')]=function(_0x20cdf9,_0x110ae2,_0x580837){return db[_0x30f3('0x34')][_0x30f3('0x4f')]({'where':{'id':_0x20cdf9[_0x30f3('0x4d')]['id']},'attributes':[_0x30f3('0x30'),'save_name','converted_format'],'raw':!![]})[_0x30f3('0x29')](handleEntityNotFound(_0x110ae2,null))[_0x30f3('0x29')](function(_0x1a567b){if(_0x1a567b){if(!fs[_0x30f3('0x51')](path[_0x30f3('0x52')](config[_0x30f3('0x53')],'server/files/sounds/converted',_0x1a567b['save_name']+'.'+_0x1a567b[_0x30f3('0x54')]))){throw new db[(_0x30f3('0x55'))][(_0x30f3('0x56'))]('Sound\x20not\x20found');}return _0x110ae2[_0x30f3('0x50')](path[_0x30f3('0x52')](config[_0x30f3('0x53')],_0x30f3('0x57'),util['format']('%s.%s',_0x1a567b[_0x30f3('0x58')],_0x1a567b[_0x30f3('0x54')])),util[_0x30f3('0x59')](_0x30f3('0x5a'),_0x1a567b[_0x30f3('0x30')],_0x1a567b[_0x30f3('0x54')]));}return null;})['catch'](handleError(_0x110ae2,null));};exports[_0x30f3('0x5b')]=function(_0x4a77fb,_0x4ef1e0,_0x49fe3e){var _0x45a050={'name':path['basename'](_0x4a77fb[_0x30f3('0x5c')][_0x30f3('0x5d')],path[_0x30f3('0x5e')](_0x4a77fb[_0x30f3('0x5c')]['originalname'])),'save_name':path[_0x30f3('0x5f')](_0x4a77fb[_0x30f3('0x5c')][_0x30f3('0x60')],path[_0x30f3('0x5e')](_0x4a77fb[_0x30f3('0x5c')][_0x30f3('0x60')])),'original_format':path[_0x30f3('0x5e')](_0x4a77fb['file'][_0x30f3('0x5d')])[_0x30f3('0x61')](0x1),'converted_format':_0x30f3('0x62')};var _0x5c8487=path[_0x30f3('0x52')](config[_0x30f3('0x53')],'server/files/sounds/original',_0x4a77fb[_0x30f3('0x5c')][_0x30f3('0x60')]);var _0x2cca09=path[_0x30f3('0x52')](config[_0x30f3('0x53')],_0x30f3('0x57'),util[_0x30f3('0x59')](_0x30f3('0x5a'),path['basename'](_0x4a77fb[_0x30f3('0x5c')][_0x30f3('0x60')],path['extname'](_0x4a77fb['file']['filename'])),_0x45a050['converted_format']));logger[_0x30f3('0x63')](_0x30f3('0x64'),_0x5c8487);logger[_0x30f3('0x63')](_0x30f3('0x65'),_0x2cca09);try{fs[_0x30f3('0x66')](_0x5c8487,parseInt(_0x30f3('0x67'),0x8));var _0x511f1a=sox[_0x30f3('0x68')](_0x5c8487,_0x2cca09,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x511f1a['on']('error',function(_0xb63335){fs[_0x30f3('0x69')](_0x5c8487);_0x4ef1e0[_0x30f3('0x1c')](0x1f4)[_0x30f3('0x31')](_0xb63335);});_0x511f1a['on']('src',function(_0x37d382){_0x45a050['original_duration']=isNaN(_0x37d382[_0x30f3('0x6a')])?null:_0x37d382[_0x30f3('0x6a')]*0x3e8;_0x45a050[_0x30f3('0x6b')]=isNaN(_0x37d382['sampleCount'])?null:_0x37d382[_0x30f3('0x6c')];_0x45a050[_0x30f3('0x6d')]=isNaN(_0x37d382[_0x30f3('0x6e')])?null:_0x37d382[_0x30f3('0x6e')];_0x45a050[_0x30f3('0x6f')]=isNaN(_0x37d382['bitRate'])?null:_0x37d382[_0x30f3('0x70')];_0x45a050[_0x30f3('0x71')]=isNaN(_0x37d382[_0x30f3('0x72')])?null:_0x37d382[_0x30f3('0x72')];});_0x511f1a['on']('dest',function(_0x2c074d){_0x45a050['converted_duration']=isNaN(_0x2c074d[_0x30f3('0x6a')])?null:_0x2c074d[_0x30f3('0x6a')]*0x3e8;_0x45a050['converted_sampleCount']=isNaN(_0x2c074d[_0x30f3('0x6c')])?null:_0x2c074d[_0x30f3('0x6c')];_0x45a050[_0x30f3('0x73')]=isNaN(_0x2c074d[_0x30f3('0x6e')])?null:_0x2c074d[_0x30f3('0x6e')];_0x45a050[_0x30f3('0x74')]=isNaN(_0x2c074d[_0x30f3('0x70')])?null:_0x2c074d['bitRate'];_0x45a050[_0x30f3('0x75')]=isNaN(_0x2c074d[_0x30f3('0x72')])?null:_0x2c074d['sampleRate'];});_0x511f1a['on'](_0x30f3('0x1d'),function(){fs['chmodSync'](_0x2cca09,parseInt(_0x30f3('0x67'),0x8));return db[_0x30f3('0x34')][_0x30f3('0x5b')](_0x45a050)[_0x30f3('0x29')](function(_0x2bffe1){var _0x25c282={'role':_0x4a77fb['body'][_0x30f3('0x76')],'userProfileId':_0x4a77fb[_0x30f3('0x77')][_0x30f3('0x78')]};if(!_0x25c282)throw new Error(_0x30f3('0x79'));if(_0x25c282[_0x30f3('0x76')]==='user'){var _0x1e4d33=_0x2bffe1[_0x30f3('0x2a')]({'plain':!![]});return db[_0x30f3('0x7a')][_0x30f3('0x4f')]({'where':{'name':_0x30f3('0x2b'),'userProfileId':_0x25c282[_0x30f3('0x78')]},'raw':!![]})['then'](function(_0x36d226){if(_0x36d226&&_0x36d226[_0x30f3('0x7b')]===0x0){return db[_0x30f3('0x2c')][_0x30f3('0x5b')]({'name':_0x1e4d33[_0x30f3('0x30')],'resourceId':_0x1e4d33['id'],'type':_0x36d226[_0x30f3('0x30')],'sectionId':_0x36d226['id']},{})['then'](function(){return _0x2bffe1;});}else{return _0x2bffe1;}})['catch'](function(_0x124449){logger[_0x30f3('0x2e')](_0x30f3('0x7c'),_0x124449);throw _0x124449;});}return _0x2bffe1;})['then'](respondWithResult(_0x4ef1e0,null))[_0x30f3('0x4c')](handleError(_0x4ef1e0,null));});_0x511f1a[_0x30f3('0x7d')]();}catch(_0x4d5746){_0x4ef1e0[_0x30f3('0x1c')](0x1f4)[_0x30f3('0x31')](_0x4d5746);}};exports[_0x30f3('0x28')]=function(_0xbef676,_0x2d4f34,_0x45b50e){return db[_0x30f3('0x34')][_0x30f3('0x4f')]({'where':{'id':_0xbef676['params']['id']}})[_0x30f3('0x29')](handleEntityNotFound(_0x2d4f34,null))[_0x30f3('0x29')](saveUpdates(_[_0x30f3('0x42')](_0xbef676[_0x30f3('0x77')],[_0x30f3('0x30'),_0x30f3('0x7e')]),null))[_0x30f3('0x29')](respondWithResult(_0x2d4f34,null))[_0x30f3('0x4c')](handleError(_0x2d4f34,null));};exports[_0x30f3('0x7f')]=function(_0x1d68a8,_0x300896,_0x50c637){return db[_0x30f3('0x34')][_0x30f3('0x4f')]({'where':{'id':_0x1d68a8[_0x30f3('0x4d')]['id']}})[_0x30f3('0x29')](function(_0x59ef58){if(_0x59ef58){return _0x59ef58[_0x30f3('0x2d')]();}})[_0x30f3('0x29')](function(_0x5a4e5f){var _0x219df6=path[_0x30f3('0x52')](config[_0x30f3('0x53')],_0x30f3('0x80'),util[_0x30f3('0x59')](_0x30f3('0x5a'),_0x5a4e5f[_0x30f3('0x58')],_0x5a4e5f[_0x30f3('0x81')]));var _0x1b76a8=path[_0x30f3('0x52')](config['root'],_0x30f3('0x57'),util[_0x30f3('0x59')](_0x30f3('0x5a'),_0x5a4e5f[_0x30f3('0x58')],_0x5a4e5f['converted_format']));fs[_0x30f3('0x69')](_0x219df6);fs['unlinkSync'](_0x1b76a8);return _0x5a4e5f;})[_0x30f3('0x29')](function(_0x36062f){if(_0x36062f){return _0x300896[_0x30f3('0x1c')](0xcc)[_0x30f3('0x1d')]();}})['then'](handleEntityNotFound(_0x300896,null))['catch'](handleError(_0x300896,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index a2da1ef..56257ae 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 _0xa8e8=['../../config/logger','api','moment','./sound.attributes','exports','define','tools_sounds','lodash'];(function(_0x4e5eb8,_0x224fac){var _0xde25cb=function(_0x2f66e2){while(--_0x2f66e2){_0x4e5eb8['push'](_0x4e5eb8['shift']());}};_0xde25cb(++_0x224fac);}(_0xa8e8,0x1bf));var _0x8a8e=function(_0x3b231a,_0x53a00d){_0x3b231a=_0x3b231a-0x0;var _0x18d67a=_0xa8e8[_0x3b231a];return _0x18d67a;};'use strict';var _=require(_0x8a8e('0x0'));var util=require('util');var logger=require(_0x8a8e('0x1'))(_0x8a8e('0x2'));var moment=require(_0x8a8e('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('../../config/environment');var attributes=require(_0x8a8e('0x4'));module[_0x8a8e('0x5')]=function(_0x45ef94,_0x2d2eed){return _0x45ef94[_0x8a8e('0x6')]('Sound',attributes,{'tableName':_0x8a8e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb79=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports','define','Sound'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xfb79,0x134));var _0x9fb7=function(_0x3d07f2,_0x19854d){_0x3d07f2=_0x3d07f2-0x0;var _0x26052a=_0xfb79[_0x3d07f2];return _0x26052a;};'use strict';var _=require(_0x9fb7('0x0'));var util=require(_0x9fb7('0x1'));var logger=require(_0x9fb7('0x2'))(_0x9fb7('0x3'));var moment=require(_0x9fb7('0x4'));var BPromise=require('bluebird');var rp=require(_0x9fb7('0x5'));var fs=require('fs');var path=require(_0x9fb7('0x6'));var rimraf=require(_0x9fb7('0x7'));var config=require('../../config/environment');var attributes=require('./sound.attributes');module[_0x9fb7('0x8')]=function(_0x17e2c4,_0x5bfa81){return _0x17e2c4[_0x9fb7('0x9')](_0x9fb7('0xa'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 2e47405..fd95a7f 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 _0xb8d5=['Sound','options','where','include','model','attributes','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSound'];(function(_0x32d406,_0x2cde0c){var _0x26d871=function(_0xcfacac){while(--_0xcfacac){_0x32d406['push'](_0x32d406['shift']());}};_0x26d871(++_0x2cde0c);}(_0xb8d5,0x67));var _0x5b8d=function(_0x4f0323,_0x3d0da4){_0x4f0323=_0x4f0323-0x0;var _0x5701dc=_0xb8d5[_0x4f0323];return _0x5701dc;};'use strict';var _=require(_0x5b8d('0x0'));var util=require(_0x5b8d('0x1'));var moment=require(_0x5b8d('0x2'));var BPromise=require(_0x5b8d('0x3'));var rs=require(_0x5b8d('0x4'));var fs=require('fs');var Redis=require(_0x5b8d('0x5'));var db=require(_0x5b8d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5b8d('0x7'))('rpc');var config=require(_0x5b8d('0x8'));var jayson=require(_0x5b8d('0x9'));var client=jayson[_0x5b8d('0xa')][_0x5b8d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54d3c6,_0x102cc7,_0x283080){return new BPromise(function(_0x372e3f,_0x3d8669){return client[_0x5b8d('0xc')](_0x54d3c6,_0x283080)[_0x5b8d('0xd')](function(_0xb1adfe){logger[_0x5b8d('0xe')](_0x5b8d('0xf'),_0x102cc7,_0x5b8d('0x10'));logger[_0x5b8d('0x11')](_0x5b8d('0x12'),_0x102cc7,_0x5b8d('0x10'),JSON[_0x5b8d('0x13')](_0xb1adfe));if(_0xb1adfe[_0x5b8d('0x14')]){if(_0xb1adfe[_0x5b8d('0x14')][_0x5b8d('0x15')]===0x1f4){logger[_0x5b8d('0x14')](_0x5b8d('0xf'),_0x102cc7,_0xb1adfe['error']['message']);return _0x3d8669(_0xb1adfe['error'][_0x5b8d('0x16')]);}logger[_0x5b8d('0x14')](_0x5b8d('0xf'),_0x102cc7,_0xb1adfe[_0x5b8d('0x14')][_0x5b8d('0x16')]);return _0x372e3f(_0xb1adfe[_0x5b8d('0x14')][_0x5b8d('0x16')]);}else{logger[_0x5b8d('0xe')]('Sound,\x20%s,\x20%s',_0x102cc7,_0x5b8d('0x10'));_0x372e3f(_0xb1adfe['result']['message']);}})[_0x5b8d('0x17')](function(_0x7ecbed){logger[_0x5b8d('0x14')](_0x5b8d('0xf'),_0x102cc7,_0x7ecbed);_0x3d8669(_0x7ecbed);});});}exports[_0x5b8d('0x18')]=function(_0x335b1e){var _0x4bc4c9=this;return new Promise(function(_0x37631e,_0x27c0ed){return db[_0x5b8d('0x19')]['find']({'raw':_0x335b1e[_0x5b8d('0x1a')]?_0x335b1e[_0x5b8d('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x335b1e[_0x5b8d('0x1a')]?_0x335b1e[_0x5b8d('0x1a')][_0x5b8d('0x1b')]||null:null,'attributes':_0x335b1e['options']?_0x335b1e['options']['attributes']||null:null,'include':_0x335b1e[_0x5b8d('0x1a')]?_0x335b1e['options']['include']?_['map'](_0x335b1e['options'][_0x5b8d('0x1c')],function(_0x1e6907){return{'model':db[_0x1e6907[_0x5b8d('0x1d')]],'as':_0x1e6907['as'],'attributes':_0x1e6907[_0x5b8d('0x1e')],'include':_0x1e6907[_0x5b8d('0x1c')]?_['map'](_0x1e6907['include'],function(_0x44c2ee){return{'model':db[_0x44c2ee[_0x5b8d('0x1d')]],'as':_0x44c2ee['as'],'attributes':_0x44c2ee[_0x5b8d('0x1e')],'include':_0x44c2ee[_0x5b8d('0x1c')]?_[_0x5b8d('0x1f')](_0x44c2ee[_0x5b8d('0x1c')],function(_0x55c5b6){return{'model':db[_0x55c5b6[_0x5b8d('0x1d')]],'as':_0x55c5b6['as'],'attributes':_0x55c5b6[_0x5b8d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5b8d('0xd')](function(_0x997b74){logger['info']('ShowSound',_0x335b1e);logger[_0x5b8d('0x11')](_0x5b8d('0x18'),_0x335b1e,JSON[_0x5b8d('0x13')](_0x997b74));_0x37631e(_0x997b74);})[_0x5b8d('0x17')](function(_0xbbde7b){logger[_0x5b8d('0x14')](_0x5b8d('0x18'),_0xbbde7b[_0x5b8d('0x16')],_0x335b1e);_0x27c0ed(_0x4bc4c9[_0x5b8d('0x14')](0x1f4,_0xbbde7b['message']));});});}; \ No newline at end of file +var _0x4dba=['request\x20sent','stringify','error','code','message','catch','ShowSound','Sound','find','options','raw','attributes','map','model','include','debug','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Sound,\x20%s,\x20%s'];(function(_0x37916c,_0x5d4d15){var _0x1f9816=function(_0x34e5e7){while(--_0x34e5e7){_0x37916c['push'](_0x37916c['shift']());}};_0x1f9816(++_0x5d4d15);}(_0x4dba,0xe2));var _0xa4db=function(_0x56d5ba,_0x5d205f){_0x56d5ba=_0x56d5ba-0x0;var _0x416538=_0x4dba[_0x56d5ba];return _0x416538;};'use strict';var _=require(_0xa4db('0x0'));var util=require(_0xa4db('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa4db('0x2'));var db=require(_0xa4db('0x3'))['db'];var utils=require(_0xa4db('0x4'));var logger=require(_0xa4db('0x5'))(_0xa4db('0x6'));var config=require(_0xa4db('0x7'));var jayson=require(_0xa4db('0x8'));var client=jayson['client'][_0xa4db('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58f88c,_0x24bab4,_0xc1e5a2){return new BPromise(function(_0x991cfc,_0x21417e){return client[_0xa4db('0xa')](_0x58f88c,_0xc1e5a2)[_0xa4db('0xb')](function(_0x4045eb){logger[_0xa4db('0xc')](_0xa4db('0xd'),_0x24bab4,_0xa4db('0xe'));logger['debug']('Sound,\x20%s,\x20%s,\x20%s',_0x24bab4,_0xa4db('0xe'),JSON[_0xa4db('0xf')](_0x4045eb));if(_0x4045eb[_0xa4db('0x10')]){if(_0x4045eb[_0xa4db('0x10')][_0xa4db('0x11')]===0x1f4){logger[_0xa4db('0x10')](_0xa4db('0xd'),_0x24bab4,_0x4045eb['error'][_0xa4db('0x12')]);return _0x21417e(_0x4045eb[_0xa4db('0x10')]['message']);}logger[_0xa4db('0x10')](_0xa4db('0xd'),_0x24bab4,_0x4045eb['error'][_0xa4db('0x12')]);return _0x991cfc(_0x4045eb[_0xa4db('0x10')][_0xa4db('0x12')]);}else{logger[_0xa4db('0xc')](_0xa4db('0xd'),_0x24bab4,_0xa4db('0xe'));_0x991cfc(_0x4045eb['result'][_0xa4db('0x12')]);}})[_0xa4db('0x13')](function(_0x4140f8){logger[_0xa4db('0x10')](_0xa4db('0xd'),_0x24bab4,_0x4140f8);_0x21417e(_0x4140f8);});});}exports[_0xa4db('0x14')]=function(_0x73d0f0){var _0x22ddee=this;return new Promise(function(_0x48a804,_0x216ca4){return db[_0xa4db('0x15')][_0xa4db('0x16')]({'raw':_0x73d0f0[_0xa4db('0x17')]?_0x73d0f0['options'][_0xa4db('0x18')]===undefined?!![]:![]:!![],'where':_0x73d0f0['options']?_0x73d0f0[_0xa4db('0x17')]['where']||null:null,'attributes':_0x73d0f0[_0xa4db('0x17')]?_0x73d0f0['options'][_0xa4db('0x19')]||null:null,'include':_0x73d0f0[_0xa4db('0x17')]?_0x73d0f0[_0xa4db('0x17')]['include']?_[_0xa4db('0x1a')](_0x73d0f0[_0xa4db('0x17')]['include'],function(_0x2c2301){return{'model':db[_0x2c2301[_0xa4db('0x1b')]],'as':_0x2c2301['as'],'attributes':_0x2c2301[_0xa4db('0x19')],'include':_0x2c2301[_0xa4db('0x1c')]?_['map'](_0x2c2301[_0xa4db('0x1c')],function(_0x55c9ee){return{'model':db[_0x55c9ee[_0xa4db('0x1b')]],'as':_0x55c9ee['as'],'attributes':_0x55c9ee[_0xa4db('0x19')],'include':_0x55c9ee[_0xa4db('0x1c')]?_['map'](_0x55c9ee[_0xa4db('0x1c')],function(_0xb9c9b6){return{'model':db[_0xb9c9b6[_0xa4db('0x1b')]],'as':_0xb9c9b6['as'],'attributes':_0xb9c9b6['attributes']};}):[]};}):[]};}):[]:[]})[_0xa4db('0xb')](function(_0x78bd1b){logger[_0xa4db('0xc')](_0xa4db('0x14'),_0x73d0f0);logger[_0xa4db('0x1d')]('ShowSound',_0x73d0f0,JSON[_0xa4db('0xf')](_0x78bd1b));_0x48a804(_0x78bd1b);})['catch'](function(_0x4002d2){logger[_0xa4db('0x10')](_0xa4db('0x14'),_0x4002d2['message'],_0x73d0f0);_0x216ca4(_0x22ddee[_0xa4db('0x10')](0x1f4,_0x4002d2[_0xa4db('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index b0ee8f0..f3a365b 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 _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0x3782f1,_0xdb9da7){var _0x59aa2c=function(_0x3ecfb1){while(--_0x3ecfb1){_0x3782f1['push'](_0x3782f1['shift']());}};_0x59aa2c(++_0xdb9da7);}(_0x4fc2,0x111));var _0x24fc=function(_0x71435,_0x5627a7){_0x71435=_0x71435-0x0;var _0x40de4f=_0x4fc2[_0x71435];return _0x40de4f;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file +var _0x8603=['../../components/interaction/service','./squareMessage.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x5f382f,_0x3f1432){var _0x3bb11b=function(_0x4daf9b){while(--_0x4daf9b){_0x5f382f['push'](_0x5f382f['shift']());}};_0x3bb11b(++_0x3f1432);}(_0x8603,0x190));var _0x3860=function(_0x285cd3,_0xb5dc59){_0x285cd3=_0x285cd3-0x0;var _0x21cc67=_0x8603[_0x285cd3];return _0x21cc67;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xd')]);router['delete'](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['destroy']);module[_0x3860('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 8fbb60f..b6cc301 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 _0x1c6c=['out','STRING','exports','TEXT','medium'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x1c6c,0x75));var _0xc1c6=function(_0x40dc5c,_0x24f401){_0x40dc5c=_0x40dc5c-0x0;var _0x14ef46=_0x1c6c[_0x40dc5c];return _0x14ef46;};'use strict';var Sequelize=require('sequelize');module[_0xc1c6('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xc1c6('0x1')](_0xc1c6('0x2')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xc1c6('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0xc1c6('0x4')]},'providerResponse':{'type':Sequelize[_0xc1c6('0x1')]}}; \ No newline at end of file +var _0x8151=['STRING','TEXT','medium','ENUM','out','sequelize'];(function(_0x5b7f23,_0x5dde90){var _0x2c0161=function(_0x4a223f){while(--_0x4a223f){_0x5b7f23['push'](_0x5b7f23['shift']());}};_0x2c0161(++_0x5dde90);}(_0x8151,0x83));var _0x1815=function(_0x35d4e9,_0x298c61){_0x35d4e9=_0x35d4e9-0x0;var _0x5c2770=_0x8151[_0x35d4e9];return _0x5c2770;};'use strict';var Sequelize=require(_0x1815('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x1815('0x1')]},'body':{'type':Sequelize[_0x1815('0x2')](_0x1815('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x1815('0x4')]('in',_0x1815('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x1815('0x1')]},'providerResponse':{'type':Sequelize[_0x1815('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 4a0bcc7..6c51464 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 _0x7033=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','then','findAll','rows','catch','show','includeAll','include','find','create','update','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','destroy','sendStatus','error','stack','name','send','map','SquareMessage','rawAttributes','fieldName','type','key','model','query'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7033,0x19e));var _0x3703=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x7033[_0x1d1779];return _0x2377e9;};'use strict';var emlformat=require(_0x3703('0x0'));var rimraf=require(_0x3703('0x1'));var zipdir=require(_0x3703('0x2'));var jsonpatch=require(_0x3703('0x3'));var rp=require('request-promise');var moment=require(_0x3703('0x4'));var BPromise=require(_0x3703('0x5'));var Mustache=require(_0x3703('0x6'));var util=require(_0x3703('0x7'));var path=require(_0x3703('0x8'));var sox=require(_0x3703('0x9'));var csv=require(_0x3703('0xa'));var ejs=require(_0x3703('0xb'));var fs=require('fs');var fs_extra=require(_0x3703('0xc'));var _=require(_0x3703('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3703('0xe'));var toCsv=require(_0x3703('0xa'));var querystring=require(_0x3703('0xf'));var Papa=require(_0x3703('0x10'));var Redis=require(_0x3703('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3703('0x12'));var as=require(_0x3703('0x13'));var hardwareService=require(_0x3703('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x3703('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3703('0x16'));var db=require(_0x3703('0x17'))['db'];function respondWithStatusCode(_0x31c0df,_0x41af55){_0x41af55=_0x41af55||0xcc;return function(_0x520ce3){if(_0x520ce3){return _0x31c0df['sendStatus'](_0x41af55);}return _0x31c0df[_0x3703('0x18')](_0x41af55)[_0x3703('0x19')]();};}function respondWithResult(_0x44d586,_0x6318f2){_0x6318f2=_0x6318f2||0xc8;return function(_0x25d3ef){if(_0x25d3ef){return _0x44d586[_0x3703('0x18')](_0x6318f2)[_0x3703('0x1a')](_0x25d3ef);}};}function respondWithFilteredResult(_0x12d16c,_0x23b04e){return function(_0x2457c1){if(_0x2457c1){var _0x3a8a89=typeof _0x23b04e[_0x3703('0x1b')]===_0x3703('0x1c')&&typeof _0x23b04e[_0x3703('0x1d')]==='undefined';var _0x3cbbce=_0x2457c1['count'];var _0x10ff16=_0x3a8a89?0x0:_0x23b04e['offset'];var _0x433d67=_0x3a8a89?_0x2457c1['count']:_0x23b04e[_0x3703('0x1b')]+_0x23b04e[_0x3703('0x1d')];var _0x5deb5b;if(_0x433d67>=_0x3cbbce){_0x433d67=_0x3cbbce;_0x5deb5b=0xc8;}else{_0x5deb5b=0xce;}_0x12d16c[_0x3703('0x18')](_0x5deb5b);return _0x12d16c[_0x3703('0x1e')](_0x3703('0x1f'),_0x10ff16+'-'+_0x433d67+'/'+_0x3cbbce)[_0x3703('0x1a')](_0x2457c1);}return null;};}function patchUpdates(_0x2a4983){return function(_0x51b1c8){try{jsonpatch[_0x3703('0x20')](_0x51b1c8,_0x2a4983,!![]);}catch(_0xc45c46){return BPromise[_0x3703('0x21')](_0xc45c46);}return _0x51b1c8['save']();};}function saveUpdates(_0x386c4a,_0x255266){return function(_0x10c74d){if(_0x10c74d){return _0x10c74d['update'](_0x386c4a)['then'](function(_0x4b9d6f){return _0x4b9d6f;});}return null;};}function removeEntity(_0x425388,_0x34aaf8){return function(_0x306905){if(_0x306905){return _0x306905[_0x3703('0x22')]()['then'](function(){_0x425388['status'](0xcc)[_0x3703('0x19')]();});}};}function handleEntityNotFound(_0x5e68f2,_0x5a48c5){return function(_0x45dccc){if(!_0x45dccc){_0x5e68f2[_0x3703('0x23')](0x194);}return _0x45dccc;};}function handleError(_0x480df6,_0x21a95c){_0x21a95c=_0x21a95c||0x1f4;return function(_0x35d577){logger[_0x3703('0x24')](_0x35d577[_0x3703('0x25')]);if(_0x35d577[_0x3703('0x26')]){delete _0x35d577['name'];}_0x480df6['status'](_0x21a95c)[_0x3703('0x27')](_0x35d577);};}exports['index']=function(_0x1e280c,_0x1b8211){var _0x5f31df={},_0x5cda62={},_0x1f912d={'count':0x0,'rows':[]};var _0x216818=_[_0x3703('0x28')](db[_0x3703('0x29')][_0x3703('0x2a')],function(_0x2be412){return{'name':_0x2be412[_0x3703('0x2b')],'type':_0x2be412[_0x3703('0x2c')][_0x3703('0x2d')]};});_0x5cda62[_0x3703('0x2e')]=_[_0x3703('0x28')](_0x216818,'name');_0x5cda62[_0x3703('0x2f')]=_[_0x3703('0x30')](_0x1e280c[_0x3703('0x2f')]);_0x5cda62[_0x3703('0x31')]=_[_0x3703('0x32')](_0x5cda62[_0x3703('0x2e')],_0x5cda62[_0x3703('0x2f')]);_0x5f31df[_0x3703('0x33')]=_[_0x3703('0x32')](_0x5cda62[_0x3703('0x2e')],qs[_0x3703('0x34')](_0x1e280c[_0x3703('0x2f')][_0x3703('0x34')]));_0x5f31df[_0x3703('0x33')]=_0x5f31df[_0x3703('0x33')][_0x3703('0x35')]?_0x5f31df[_0x3703('0x33')]:_0x5cda62[_0x3703('0x2e')];if(!_0x1e280c[_0x3703('0x2f')][_0x3703('0x36')](_0x3703('0x37'))){_0x5f31df[_0x3703('0x1d')]=qs['limit'](_0x1e280c[_0x3703('0x2f')]['limit']);_0x5f31df[_0x3703('0x1b')]=qs['offset'](_0x1e280c[_0x3703('0x2f')][_0x3703('0x1b')]);}_0x5f31df[_0x3703('0x38')]=qs[_0x3703('0x39')](_0x1e280c[_0x3703('0x2f')]['sort']);_0x5f31df[_0x3703('0x3a')]=qs['filters'](_[_0x3703('0x3b')](_0x1e280c[_0x3703('0x2f')],_0x5cda62[_0x3703('0x31')]),_0x216818);if(_0x1e280c['query'][_0x3703('0x3c')]){_0x5f31df['where']=_[_0x3703('0x3d')](_0x5f31df[_0x3703('0x3a')],{'$or':_[_0x3703('0x28')](_0x216818,function(_0x1e72b5){if(_0x1e72b5[_0x3703('0x2c')]!==_0x3703('0x3e')){var _0x5f4006={};_0x5f4006[_0x1e72b5['name']]={'$like':'%'+_0x1e280c[_0x3703('0x2f')][_0x3703('0x3c')]+'%'};return _0x5f4006;}})});}_0x5f31df=_['merge']({},_0x5f31df,_0x1e280c[_0x3703('0x3f')]);var _0x1f537a={'where':_0x5f31df[_0x3703('0x3a')]};return db[_0x3703('0x29')][_0x3703('0x40')](_0x1f537a)[_0x3703('0x41')](function(_0x1e2341){_0x1f912d[_0x3703('0x40')]=_0x1e2341;if(_0x1e280c[_0x3703('0x2f')]['includeAll']){_0x5f31df['include']=[{'all':!![]}];}return db[_0x3703('0x29')][_0x3703('0x42')](_0x5f31df);})['then'](function(_0x39760d){_0x1f912d[_0x3703('0x43')]=_0x39760d;return _0x1f912d;})[_0x3703('0x41')](respondWithFilteredResult(_0x1b8211,_0x5f31df))[_0x3703('0x44')](handleError(_0x1b8211,null));};exports[_0x3703('0x45')]=function(_0x30b20f,_0x2e6986){var _0xb54e6c={'raw':!![],'where':{'id':_0x30b20f['params']['id']}},_0x1d39c7={};_0x1d39c7['model']=_[_0x3703('0x30')](db['SquareMessage']['rawAttributes']);_0x1d39c7[_0x3703('0x2f')]=_[_0x3703('0x30')](_0x30b20f[_0x3703('0x2f')]);_0x1d39c7[_0x3703('0x31')]=_[_0x3703('0x32')](_0x1d39c7[_0x3703('0x2e')],_0x1d39c7[_0x3703('0x2f')]);_0xb54e6c['attributes']=_[_0x3703('0x32')](_0x1d39c7[_0x3703('0x2e')],qs[_0x3703('0x34')](_0x30b20f[_0x3703('0x2f')]['fields']));_0xb54e6c['attributes']=_0xb54e6c[_0x3703('0x33')][_0x3703('0x35')]?_0xb54e6c[_0x3703('0x33')]:_0x1d39c7[_0x3703('0x2e')];if(_0x30b20f[_0x3703('0x2f')][_0x3703('0x46')]){_0xb54e6c[_0x3703('0x47')]=[{'all':!![]}];}_0xb54e6c=_['merge']({},_0xb54e6c,_0x30b20f[_0x3703('0x3f')]);return db[_0x3703('0x29')][_0x3703('0x48')](_0xb54e6c)[_0x3703('0x41')](handleEntityNotFound(_0x2e6986,null))['then'](respondWithResult(_0x2e6986,null))['catch'](handleError(_0x2e6986,null));};exports['create']=function(_0x55bd5b,_0x34d3b2){return db[_0x3703('0x29')][_0x3703('0x49')](_0x55bd5b['body'],{})[_0x3703('0x41')](respondWithResult(_0x34d3b2,0xc9))['catch'](handleError(_0x34d3b2,null));};exports[_0x3703('0x4a')]=function(_0x2ab470,_0x2e19f6){if(_0x2ab470['body']['id']){delete _0x2ab470[_0x3703('0x4b')]['id'];}return db[_0x3703('0x29')][_0x3703('0x48')]({'where':{'id':_0x2ab470[_0x3703('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2e19f6,null))['then'](saveUpdates(_0x2ab470['body'],null))[_0x3703('0x41')](respondWithResult(_0x2e19f6,null))['catch'](handleError(_0x2e19f6,null));};exports[_0x3703('0x22')]=function(_0x528db8,_0x2b30d7){return db['SquareMessage'][_0x3703('0x48')]({'where':{'id':_0x528db8[_0x3703('0x4c')]['id']}})[_0x3703('0x41')](handleEntityNotFound(_0x2b30d7,null))['then'](removeEntity(_0x2b30d7,null))[_0x3703('0x44')](handleError(_0x2b30d7,null));}; \ No newline at end of file +var _0xc5c0=['stack','name','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','limit','order','sort','where','filters','pick','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','create','body','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error'];(function(_0x3609cb,_0x5d560f){var _0x284ee7=function(_0x41afb0){while(--_0x41afb0){_0x3609cb['push'](_0x3609cb['shift']());}};_0x284ee7(++_0x5d560f);}(_0xc5c0,0x6c));var _0x0c5c=function(_0x2cc234,_0x3362ea){_0x2cc234=_0x2cc234-0x0;var _0x261f3e=_0xc5c0[_0x2cc234];return _0x261f3e;};'use strict';var emlformat=require(_0x0c5c('0x0'));var rimraf=require(_0x0c5c('0x1'));var zipdir=require(_0x0c5c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0c5c('0x3'));var BPromise=require(_0x0c5c('0x4'));var Mustache=require('mustache');var util=require(_0x0c5c('0x5'));var path=require(_0x0c5c('0x6'));var sox=require(_0x0c5c('0x7'));var csv=require(_0x0c5c('0x8'));var ejs=require(_0x0c5c('0x9'));var fs=require('fs');var fs_extra=require(_0x0c5c('0xa'));var _=require(_0x0c5c('0xb'));var squel=require('squel');var crypto=require(_0x0c5c('0xc'));var jsforce=require(_0x0c5c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0c5c('0x8'));var querystring=require(_0x0c5c('0xe'));var Papa=require(_0x0c5c('0xf'));var Redis=require(_0x0c5c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0c5c('0x11'));var as=require(_0x0c5c('0x12'));var hardwareService=require(_0x0c5c('0x13'));var logger=require(_0x0c5c('0x14'))(_0x0c5c('0x15'));var utils=require('../../config/utils');var config=require(_0x0c5c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c5c('0x17'))['db'];function respondWithStatusCode(_0x2a6faa,_0x1dcb7a){_0x1dcb7a=_0x1dcb7a||0xcc;return function(_0x2f9a2f){if(_0x2f9a2f){return _0x2a6faa[_0x0c5c('0x18')](_0x1dcb7a);}return _0x2a6faa[_0x0c5c('0x19')](_0x1dcb7a)[_0x0c5c('0x1a')]();};}function respondWithResult(_0x35a896,_0x30f123){_0x30f123=_0x30f123||0xc8;return function(_0x35e7e3){if(_0x35e7e3){return _0x35a896['status'](_0x30f123)[_0x0c5c('0x1b')](_0x35e7e3);}};}function respondWithFilteredResult(_0x5edd7f,_0x56b0c7){return function(_0x375e9d){if(_0x375e9d){var _0x189c00=typeof _0x56b0c7['offset']===_0x0c5c('0x1c')&&typeof _0x56b0c7['limit']===_0x0c5c('0x1c');var _0x3cef4c=_0x375e9d[_0x0c5c('0x1d')];var _0x5b8105=_0x189c00?0x0:_0x56b0c7[_0x0c5c('0x1e')];var _0x38cd95=_0x189c00?_0x375e9d[_0x0c5c('0x1d')]:_0x56b0c7[_0x0c5c('0x1e')]+_0x56b0c7['limit'];var _0x273a5a;if(_0x38cd95>=_0x3cef4c){_0x38cd95=_0x3cef4c;_0x273a5a=0xc8;}else{_0x273a5a=0xce;}_0x5edd7f[_0x0c5c('0x19')](_0x273a5a);return _0x5edd7f[_0x0c5c('0x1f')](_0x0c5c('0x20'),_0x5b8105+'-'+_0x38cd95+'/'+_0x3cef4c)[_0x0c5c('0x1b')](_0x375e9d);}return null;};}function patchUpdates(_0x17af12){return function(_0x616c62){try{jsonpatch[_0x0c5c('0x21')](_0x616c62,_0x17af12,!![]);}catch(_0x480efe){return BPromise[_0x0c5c('0x22')](_0x480efe);}return _0x616c62[_0x0c5c('0x23')]();};}function saveUpdates(_0xeb244e,_0x2cd15f){return function(_0xe0534d){if(_0xe0534d){return _0xe0534d[_0x0c5c('0x24')](_0xeb244e)['then'](function(_0xb1ea94){return _0xb1ea94;});}return null;};}function removeEntity(_0x4f5c8a,_0x12bc50){return function(_0x4356fa){if(_0x4356fa){return _0x4356fa[_0x0c5c('0x25')]()[_0x0c5c('0x26')](function(){_0x4f5c8a[_0x0c5c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19f49e,_0x1ae0de){return function(_0x26cf9d){if(!_0x26cf9d){_0x19f49e[_0x0c5c('0x18')](0x194);}return _0x26cf9d;};}function handleError(_0xd00782,_0x2fa786){_0x2fa786=_0x2fa786||0x1f4;return function(_0xc4358c){logger[_0x0c5c('0x27')](_0xc4358c[_0x0c5c('0x28')]);if(_0xc4358c[_0x0c5c('0x29')]){delete _0xc4358c[_0x0c5c('0x29')];}_0xd00782[_0x0c5c('0x19')](_0x2fa786)['send'](_0xc4358c);};}exports['index']=function(_0xf56822,_0x45139f){var _0x8d6d={},_0x41d083={},_0x3c9cd5={'count':0x0,'rows':[]};var _0x2a5310=_[_0x0c5c('0x2a')](db[_0x0c5c('0x2b')][_0x0c5c('0x2c')],function(_0x1b88c1){return{'name':_0x1b88c1[_0x0c5c('0x2d')],'type':_0x1b88c1[_0x0c5c('0x2e')][_0x0c5c('0x2f')]};});_0x41d083[_0x0c5c('0x30')]=_[_0x0c5c('0x2a')](_0x2a5310,_0x0c5c('0x29'));_0x41d083[_0x0c5c('0x31')]=_[_0x0c5c('0x32')](_0xf56822[_0x0c5c('0x31')]);_0x41d083['filters']=_[_0x0c5c('0x33')](_0x41d083[_0x0c5c('0x30')],_0x41d083[_0x0c5c('0x31')]);_0x8d6d['attributes']=_[_0x0c5c('0x33')](_0x41d083[_0x0c5c('0x30')],qs[_0x0c5c('0x34')](_0xf56822['query'][_0x0c5c('0x34')]));_0x8d6d['attributes']=_0x8d6d[_0x0c5c('0x35')]['length']?_0x8d6d[_0x0c5c('0x35')]:_0x41d083[_0x0c5c('0x30')];if(!_0xf56822[_0x0c5c('0x31')][_0x0c5c('0x36')]('nolimit')){_0x8d6d[_0x0c5c('0x37')]=qs['limit'](_0xf56822['query'][_0x0c5c('0x37')]);_0x8d6d[_0x0c5c('0x1e')]=qs[_0x0c5c('0x1e')](_0xf56822[_0x0c5c('0x31')][_0x0c5c('0x1e')]);}_0x8d6d[_0x0c5c('0x38')]=qs[_0x0c5c('0x39')](_0xf56822['query'][_0x0c5c('0x39')]);_0x8d6d[_0x0c5c('0x3a')]=qs[_0x0c5c('0x3b')](_[_0x0c5c('0x3c')](_0xf56822['query'],_0x41d083['filters']),_0x2a5310);if(_0xf56822[_0x0c5c('0x31')]['filter']){_0x8d6d[_0x0c5c('0x3a')]=_[_0x0c5c('0x3d')](_0x8d6d[_0x0c5c('0x3a')],{'$or':_['map'](_0x2a5310,function(_0x1cf7bf){if(_0x1cf7bf[_0x0c5c('0x2e')]!==_0x0c5c('0x3e')){var _0x500425={};_0x500425[_0x1cf7bf[_0x0c5c('0x29')]]={'$like':'%'+_0xf56822[_0x0c5c('0x31')]['filter']+'%'};return _0x500425;}})});}_0x8d6d=_[_0x0c5c('0x3d')]({},_0x8d6d,_0xf56822['options']);var _0x13acd9={'where':_0x8d6d['where']};return db['SquareMessage'][_0x0c5c('0x1d')](_0x13acd9)[_0x0c5c('0x26')](function(_0x125337){_0x3c9cd5[_0x0c5c('0x1d')]=_0x125337;if(_0xf56822[_0x0c5c('0x31')][_0x0c5c('0x3f')]){_0x8d6d[_0x0c5c('0x40')]=[{'all':!![]}];}return db[_0x0c5c('0x2b')][_0x0c5c('0x41')](_0x8d6d);})[_0x0c5c('0x26')](function(_0x17f971){_0x3c9cd5[_0x0c5c('0x42')]=_0x17f971;return _0x3c9cd5;})[_0x0c5c('0x26')](respondWithFilteredResult(_0x45139f,_0x8d6d))[_0x0c5c('0x43')](handleError(_0x45139f,null));};exports[_0x0c5c('0x44')]=function(_0x4ae738,_0x1bda16){var _0x4bb6f1={'raw':!![],'where':{'id':_0x4ae738[_0x0c5c('0x45')]['id']}},_0x570364={};_0x570364[_0x0c5c('0x30')]=_[_0x0c5c('0x32')](db[_0x0c5c('0x2b')]['rawAttributes']);_0x570364[_0x0c5c('0x31')]=_[_0x0c5c('0x32')](_0x4ae738[_0x0c5c('0x31')]);_0x570364['filters']=_['intersection'](_0x570364[_0x0c5c('0x30')],_0x570364['query']);_0x4bb6f1['attributes']=_[_0x0c5c('0x33')](_0x570364[_0x0c5c('0x30')],qs[_0x0c5c('0x34')](_0x4ae738[_0x0c5c('0x31')][_0x0c5c('0x34')]));_0x4bb6f1[_0x0c5c('0x35')]=_0x4bb6f1[_0x0c5c('0x35')][_0x0c5c('0x46')]?_0x4bb6f1[_0x0c5c('0x35')]:_0x570364[_0x0c5c('0x30')];if(_0x4ae738[_0x0c5c('0x31')][_0x0c5c('0x3f')]){_0x4bb6f1[_0x0c5c('0x40')]=[{'all':!![]}];}_0x4bb6f1=_['merge']({},_0x4bb6f1,_0x4ae738[_0x0c5c('0x47')]);return db[_0x0c5c('0x2b')]['find'](_0x4bb6f1)[_0x0c5c('0x26')](handleEntityNotFound(_0x1bda16,null))[_0x0c5c('0x26')](respondWithResult(_0x1bda16,null))[_0x0c5c('0x43')](handleError(_0x1bda16,null));};exports['create']=function(_0x11a686,_0x5c8519){return db[_0x0c5c('0x2b')][_0x0c5c('0x48')](_0x11a686[_0x0c5c('0x49')],{})[_0x0c5c('0x26')](respondWithResult(_0x5c8519,0xc9))[_0x0c5c('0x43')](handleError(_0x5c8519,null));};exports[_0x0c5c('0x24')]=function(_0x1c7235,_0x5688db){if(_0x1c7235[_0x0c5c('0x49')]['id']){delete _0x1c7235[_0x0c5c('0x49')]['id'];}return db[_0x0c5c('0x2b')]['find']({'where':{'id':_0x1c7235[_0x0c5c('0x45')]['id']}})['then'](handleEntityNotFound(_0x5688db,null))[_0x0c5c('0x26')](saveUpdates(_0x1c7235['body'],null))[_0x0c5c('0x26')](respondWithResult(_0x5688db,null))[_0x0c5c('0x43')](handleError(_0x5688db,null));};exports[_0x0c5c('0x25')]=function(_0x291564,_0x48327b){return db[_0x0c5c('0x2b')]['find']({'where':{'id':_0x291564[_0x0c5c('0x45')]['id']}})[_0x0c5c('0x26')](handleEntityNotFound(_0x48327b,null))['then'](removeEntity(_0x48327b,null))[_0x0c5c('0x43')](handleError(_0x48327b,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 70622b8..0ccd977 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 _0x4167=['define','SquareMessage','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4167,0x86));var _0x7416=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4167[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7416('0x0'));var logger=require(_0x7416('0x1'))('api');var moment=require(_0x7416('0x2'));var BPromise=require(_0x7416('0x3'));var rp=require(_0x7416('0x4'));var fs=require('fs');var path=require(_0x7416('0x5'));var rimraf=require(_0x7416('0x6'));var config=require(_0x7416('0x7'));var attributes=require('./squareMessage.attributes');module[_0x7416('0x8')]=function(_0x354dfa,_0x2b8440){return _0x354dfa[_0x7416('0x9')](_0x7416('0xa'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda72=['SquareMessage','square_messages','util','../../config/logger','api','moment','bluebird','../../config/environment','./squareMessage.attributes','define'];(function(_0xc0d8e7,_0x1c73f4){var _0x29c7c5=function(_0x4601b3){while(--_0x4601b3){_0xc0d8e7['push'](_0xc0d8e7['shift']());}};_0x29c7c5(++_0x1c73f4);}(_0xda72,0xd4));var _0x2da7=function(_0x271ed2,_0xe40bf7){_0x271ed2=_0x271ed2-0x0;var _0x5186cc=_0xda72[_0x271ed2];return _0x5186cc;};'use strict';var _=require('lodash');var util=require(_0x2da7('0x0'));var logger=require(_0x2da7('0x1'))(_0x2da7('0x2'));var moment=require(_0x2da7('0x3'));var BPromise=require(_0x2da7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2da7('0x5'));var attributes=require(_0x2da7('0x6'));module['exports']=function(_0x4bbe01,_0xd2440a){return _0x4bbe01[_0x2da7('0x7')](_0x2da7('0x8'),attributes,{'tableName':_0x2da7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 119595c..b19397c 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 _0x21af=['info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x2d7a63,_0x596e4c){var _0x94f1c=function(_0x18cffe){while(--_0x18cffe){_0x2d7a63['push'](_0x2d7a63['shift']());}};_0x94f1c(++_0x596e4c);}(_0x21af,0x15a));var _0xf21a=function(_0x2c9f32,_0x24b4aa){_0x2c9f32=_0x2c9f32-0x0;var _0x236b83=_0x21af[_0x2c9f32];return _0x236b83;};'use strict';var _=require(_0xf21a('0x0'));var util=require(_0xf21a('0x1'));var moment=require(_0xf21a('0x2'));var BPromise=require(_0xf21a('0x3'));var rs=require(_0xf21a('0x4'));var fs=require('fs');var Redis=require(_0xf21a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf21a('0x6'));var logger=require(_0xf21a('0x7'))(_0xf21a('0x8'));var config=require(_0xf21a('0x9'));var jayson=require(_0xf21a('0xa'));var client=jayson[_0xf21a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57951,_0x33423a,_0x328e28){return new BPromise(function(_0x500dc0,_0x3ffb3c){return client[_0xf21a('0xc')](_0x57951,_0x328e28)[_0xf21a('0xd')](function(_0x3503a6){logger[_0xf21a('0xe')](_0xf21a('0xf'),_0x33423a,_0xf21a('0x10'));logger[_0xf21a('0x11')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x33423a,'request\x20sent',JSON[_0xf21a('0x12')](_0x3503a6));if(_0x3503a6[_0xf21a('0x13')]){if(_0x3503a6[_0xf21a('0x13')][_0xf21a('0x14')]===0x1f4){logger['error'](_0xf21a('0xf'),_0x33423a,_0x3503a6[_0xf21a('0x13')]['message']);return _0x3ffb3c(_0x3503a6[_0xf21a('0x13')][_0xf21a('0x15')]);}logger[_0xf21a('0x13')]('SquareMessage,\x20%s,\x20%s',_0x33423a,_0x3503a6[_0xf21a('0x13')][_0xf21a('0x15')]);return _0x500dc0(_0x3503a6[_0xf21a('0x13')]['message']);}else{logger[_0xf21a('0xe')]('SquareMessage,\x20%s,\x20%s',_0x33423a,_0xf21a('0x10'));_0x500dc0(_0x3503a6[_0xf21a('0x16')]['message']);}})[_0xf21a('0x17')](function(_0x3f4c92){logger[_0xf21a('0x13')](_0xf21a('0xf'),_0x33423a,_0x3f4c92);_0x3ffb3c(_0x3f4c92);});});}exports[_0xf21a('0x18')]=function(_0x4a6747){var _0x2f6fd1=this;return new Promise(function(_0x1d438e,_0x53e8bd){return db[_0xf21a('0x19')][_0xf21a('0x1a')](_0x4a6747[_0xf21a('0x1b')],{'raw':_0x4a6747[_0xf21a('0x1c')]?_0x4a6747[_0xf21a('0x1c')][_0xf21a('0x1d')]===undefined?!![]:![]:!![]})[_0xf21a('0xd')](function(_0x3cc614){logger[_0xf21a('0xe')](_0xf21a('0x18'),_0x4a6747);logger[_0xf21a('0x11')](_0xf21a('0x18'),_0x4a6747,JSON['stringify'](_0x3cc614));_0x1d438e(_0x3cc614);})['catch'](function(_0x72aa5){logger['error'](_0xf21a('0x18'),_0x72aa5[_0xf21a('0x15')],_0x4a6747);_0x53e8bd(_0x2f6fd1[_0xf21a('0x13')](0x1f4,_0x72aa5[_0xf21a('0x15')]));});});}; \ No newline at end of file +var _0x6cf6=['code','message','catch','CreateSquareMessage','SquareMessage','create','body','options','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0x36ed59,_0x26c368){var _0x3badb6=function(_0x374a59){while(--_0x374a59){_0x36ed59['push'](_0x36ed59['shift']());}};_0x3badb6(++_0x26c368);}(_0x6cf6,0x1bc));var _0x66cf=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x6cf6[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x66cf('0x0'));var util=require('util');var moment=require(_0x66cf('0x1'));var BPromise=require(_0x66cf('0x2'));var rs=require(_0x66cf('0x3'));var fs=require('fs');var Redis=require(_0x66cf('0x4'));var db=require(_0x66cf('0x5'))['db'];var utils=require(_0x66cf('0x6'));var logger=require(_0x66cf('0x7'))('rpc');var config=require(_0x66cf('0x8'));var jayson=require(_0x66cf('0x9'));var client=jayson[_0x66cf('0xa')][_0x66cf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f12e9,_0xcf28cb,_0x1b1440){return new BPromise(function(_0x47e543,_0x227ec8){return client[_0x66cf('0xc')](_0x3f12e9,_0x1b1440)[_0x66cf('0xd')](function(_0x36c751){logger[_0x66cf('0xe')](_0x66cf('0xf'),_0xcf28cb,_0x66cf('0x10'));logger[_0x66cf('0x11')](_0x66cf('0x12'),_0xcf28cb,_0x66cf('0x10'),JSON['stringify'](_0x36c751));if(_0x36c751[_0x66cf('0x13')]){if(_0x36c751[_0x66cf('0x13')][_0x66cf('0x14')]===0x1f4){logger[_0x66cf('0x13')](_0x66cf('0xf'),_0xcf28cb,_0x36c751[_0x66cf('0x13')][_0x66cf('0x15')]);return _0x227ec8(_0x36c751[_0x66cf('0x13')][_0x66cf('0x15')]);}logger[_0x66cf('0x13')](_0x66cf('0xf'),_0xcf28cb,_0x36c751['error'][_0x66cf('0x15')]);return _0x47e543(_0x36c751[_0x66cf('0x13')][_0x66cf('0x15')]);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0xcf28cb,_0x66cf('0x10'));_0x47e543(_0x36c751['result'][_0x66cf('0x15')]);}})[_0x66cf('0x16')](function(_0x2bae50){logger[_0x66cf('0x13')](_0x66cf('0xf'),_0xcf28cb,_0x2bae50);_0x227ec8(_0x2bae50);});});}exports[_0x66cf('0x17')]=function(_0x699b18){var _0x392466=this;return new Promise(function(_0x4dce77,_0x484d2d){return db[_0x66cf('0x18')][_0x66cf('0x19')](_0x699b18[_0x66cf('0x1a')],{'raw':_0x699b18[_0x66cf('0x1b')]?_0x699b18['options']['raw']===undefined?!![]:![]:!![]})[_0x66cf('0xd')](function(_0x54d86a){logger[_0x66cf('0xe')](_0x66cf('0x17'),_0x699b18);logger[_0x66cf('0x11')](_0x66cf('0x17'),_0x699b18,JSON[_0x66cf('0x1c')](_0x54d86a));_0x4dce77(_0x54d86a);})['catch'](function(_0x382a22){logger['error'](_0x66cf('0x17'),_0x382a22[_0x66cf('0x15')],_0x699b18);_0x484d2d(_0x392466[_0x66cf('0x13')](0x1f4,_0x382a22[_0x66cf('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 6fe8295..797fc8d 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 _0x3e52=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/test','test','post','put','update','destroy','exports','multer'];(function(_0x59a205,_0x3fc4be){var _0x4979d0=function(_0x319862){while(--_0x319862){_0x59a205['push'](_0x59a205['shift']());}};_0x4979d0(++_0x3fc4be);}(_0x3e52,0xbc));var _0x23e5=function(_0xe734f7,_0x52c2ff){_0xe734f7=_0xe734f7-0x0;var _0x3a77ec=_0x3e52[_0xe734f7];return _0x3a77ec;};'use strict';var multer=require(_0x23e5('0x0'));var util=require(_0x23e5('0x1'));var path=require(_0x23e5('0x2'));var timeout=require(_0x23e5('0x3'));var express=require(_0x23e5('0x4'));var router=express[_0x23e5('0x5')]();var fs_extra=require(_0x23e5('0x6'));var auth=require(_0x23e5('0x7'));var interaction=require(_0x23e5('0x8'));var config=require(_0x23e5('0x9'));var controller=require('./squareOdbc.controller');router[_0x23e5('0xa')]('/',auth[_0x23e5('0xb')](),controller[_0x23e5('0xc')]);router[_0x23e5('0xa')](_0x23e5('0xd'),auth[_0x23e5('0xb')](),controller['show']);router[_0x23e5('0xa')](_0x23e5('0xe'),auth[_0x23e5('0xb')](),timeout('15s'),controller[_0x23e5('0xf')]);router[_0x23e5('0x10')]('/',auth[_0x23e5('0xb')](),controller['create']);router[_0x23e5('0x11')](_0x23e5('0xd'),auth[_0x23e5('0xb')](),controller[_0x23e5('0x12')]);router['delete'](_0x23e5('0xd'),auth[_0x23e5('0xb')](),controller[_0x23e5('0x13')]);module[_0x23e5('0x14')]=router; \ No newline at end of file +var _0x6d98=['../../config/environment','./squareOdbc.controller','isAuthenticated','index','get','/:id','/:id/test','15s','test','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x11ad37,_0x348e76){var _0x39bda0=function(_0x41d948){while(--_0x41d948){_0x11ad37['push'](_0x11ad37['shift']());}};_0x39bda0(++_0x348e76);}(_0x6d98,0x185));var _0x86d9=function(_0x5988b6,_0x4e0b38){_0x5988b6=_0x5988b6-0x0;var _0x1b3047=_0x6d98[_0x5988b6];return _0x1b3047;};'use strict';var multer=require(_0x86d9('0x0'));var util=require('util');var path=require(_0x86d9('0x1'));var timeout=require(_0x86d9('0x2'));var express=require(_0x86d9('0x3'));var router=express['Router']();var fs_extra=require(_0x86d9('0x4'));var auth=require(_0x86d9('0x5'));var interaction=require(_0x86d9('0x6'));var config=require(_0x86d9('0x7'));var controller=require(_0x86d9('0x8'));router['get']('/',auth[_0x86d9('0x9')](),controller[_0x86d9('0xa')]);router[_0x86d9('0xb')](_0x86d9('0xc'),auth[_0x86d9('0x9')](),controller['show']);router[_0x86d9('0xb')](_0x86d9('0xd'),auth[_0x86d9('0x9')](),timeout(_0x86d9('0xe')),controller[_0x86d9('0xf')]);router[_0x86d9('0x10')]('/',auth[_0x86d9('0x9')](),controller[_0x86d9('0x11')]);router['put'](_0x86d9('0xc'),auth['isAuthenticated'](),controller[_0x86d9('0x12')]);router[_0x86d9('0x13')](_0x86d9('0xc'),auth['isAuthenticated'](),controller[_0x86d9('0x14')]);module[_0x86d9('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index b04c6b5..a7df06d 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 _0x8294=['exports','STRING','name','sequelize'];(function(_0x36d910,_0x2e8f99){var _0x4bba9e=function(_0x4255a7){while(--_0x4255a7){_0x36d910['push'](_0x36d910['shift']());}};_0x4bba9e(++_0x2e8f99);}(_0x8294,0xbf));var _0x4829=function(_0x2a0fde,_0x31df5d){_0x2a0fde=_0x2a0fde-0x0;var _0x20b510=_0x8294[_0x2a0fde];return _0x20b510;};'use strict';var Sequelize=require(_0x4829('0x0'));module[_0x4829('0x1')]={'name':{'type':Sequelize[_0x4829('0x2')],'unique':_0x4829('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb800=['sequelize','STRING','name'];(function(_0x13774e,_0x11a769){var _0x6e8453=function(_0x58ab62){while(--_0x58ab62){_0x13774e['push'](_0x13774e['shift']());}};_0x6e8453(++_0x11a769);}(_0xb800,0x1f2));var _0x0b80=function(_0x15f555,_0x588991){_0x15f555=_0x15f555-0x0;var _0x10ac92=_0xb800[_0x15f555];return _0x10ac92;};'use strict';var Sequelize=require(_0x0b80('0x0'));module['exports']={'name':{'type':Sequelize[_0x0b80('0x1')],'unique':_0x0b80('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x0b80('0x1')]},'description':{'type':Sequelize[_0x0b80('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 4833dc6..8e76499 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 _0x652e=['end','json','offset','limit','count','status','apply','reject','save','then','destroy','get','ODBC','UserProfileResource','error','stack','name','send','index','SquareOdbc','fieldName','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','type','options','include','rows','show','params','keys','length','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','test','dsn','closeSync','eml-format','rimraf','request-promise','moment','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','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x652e,0x134));var _0xe652=function(_0x56936d,_0x4c8db0){_0x56936d=_0x56936d-0x0;var _0x30c07b=_0x652e[_0x56936d];return _0x30c07b;};'use strict';var emlformat=require(_0xe652('0x0'));var rimraf=require(_0xe652('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe652('0x2'));var moment=require(_0xe652('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xe652('0x4'));var sox=require(_0xe652('0x5'));var csv=require(_0xe652('0x6'));var ejs=require(_0xe652('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe652('0x8'));var squel=require(_0xe652('0x9'));var crypto=require('crypto');var jsforce=require(_0xe652('0xa'));var deskjs=require(_0xe652('0xb'));var toCsv=require(_0xe652('0x6'));var querystring=require('querystring');var Papa=require(_0xe652('0xc'));var Redis=require(_0xe652('0xd'));var authService=require(_0xe652('0xe'));var qs=require(_0xe652('0xf'));var as=require(_0xe652('0x10'));var hardwareService=require(_0xe652('0x11'));var logger=require(_0xe652('0x12'))(_0xe652('0x13'));var utils=require(_0xe652('0x14'));var config=require(_0xe652('0x15'));var licenseUtil=require(_0xe652('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x182b2e,_0x58ef94){_0x58ef94=_0x58ef94||0xcc;return function(_0x383601){if(_0x383601){return _0x182b2e[_0xe652('0x17')](_0x58ef94);}return _0x182b2e['status'](_0x58ef94)[_0xe652('0x18')]();};}function respondWithResult(_0x1250b6,_0x462eeb){_0x462eeb=_0x462eeb||0xc8;return function(_0x1275e9){if(_0x1275e9){return _0x1250b6['status'](_0x462eeb)[_0xe652('0x19')](_0x1275e9);}};}function respondWithFilteredResult(_0x4206d5,_0x381e83){return function(_0x10da77){if(_0x10da77){var _0x26bc9b=typeof _0x381e83[_0xe652('0x1a')]==='undefined'&&typeof _0x381e83[_0xe652('0x1b')]==='undefined';var _0xb929a0=_0x10da77['count'];var _0xcf74b0=_0x26bc9b?0x0:_0x381e83[_0xe652('0x1a')];var _0x591925=_0x26bc9b?_0x10da77[_0xe652('0x1c')]:_0x381e83['offset']+_0x381e83['limit'];var _0x202d8c;if(_0x591925>=_0xb929a0){_0x591925=_0xb929a0;_0x202d8c=0xc8;}else{_0x202d8c=0xce;}_0x4206d5[_0xe652('0x1d')](_0x202d8c);return _0x4206d5['set']('Content-Range',_0xcf74b0+'-'+_0x591925+'/'+_0xb929a0)[_0xe652('0x19')](_0x10da77);}return null;};}function patchUpdates(_0x428ec5){return function(_0x55d7dc){try{jsonpatch[_0xe652('0x1e')](_0x55d7dc,_0x428ec5,!![]);}catch(_0x350a28){return BPromise[_0xe652('0x1f')](_0x350a28);}return _0x55d7dc[_0xe652('0x20')]();};}function saveUpdates(_0x5e2dcf,_0x36d2ae){return function(_0x27aada){if(_0x27aada){return _0x27aada['update'](_0x5e2dcf)[_0xe652('0x21')](function(_0x19e13e){return _0x19e13e;});}return null;};}function removeEntity(_0xe7d820,_0x4085b1){return function(_0x597d84){if(_0x597d84){return _0x597d84[_0xe652('0x22')]()['then'](function(){var _0x498fa2=_0x597d84[_0xe652('0x23')]({'plain':!![]});var _0x45bd8a=_0xe652('0x24');return db[_0xe652('0x25')]['destroy']({'where':{'type':_0x45bd8a,'resourceId':_0x498fa2['id']}})[_0xe652('0x21')](function(){return _0x597d84;});})[_0xe652('0x21')](function(){_0xe7d820['status'](0xcc)[_0xe652('0x18')]();});}};}function handleEntityNotFound(_0x6c0f49,_0x539f3b){return function(_0x32b350){if(!_0x32b350){_0x6c0f49[_0xe652('0x17')](0x194);}return _0x32b350;};}function handleError(_0x46aae6,_0xf893b8){_0xf893b8=_0xf893b8||0x1f4;return function(_0x33d221){logger[_0xe652('0x26')](_0x33d221[_0xe652('0x27')]);if(_0x33d221[_0xe652('0x28')]){delete _0x33d221[_0xe652('0x28')];}_0x46aae6[_0xe652('0x1d')](_0xf893b8)[_0xe652('0x29')](_0x33d221);};}exports[_0xe652('0x2a')]=function(_0x51ae53,_0x129692){var _0x4dce7c={},_0x597943={},_0x4dd733={'count':0x0,'rows':[]};var _0x3139dd=_['map'](db[_0xe652('0x2b')]['rawAttributes'],function(_0x2b3c79){return{'name':_0x2b3c79[_0xe652('0x2c')],'type':_0x2b3c79['type'][_0xe652('0x2d')]};});_0x597943[_0xe652('0x2e')]=_[_0xe652('0x2f')](_0x3139dd,'name');_0x597943[_0xe652('0x30')]=_['keys'](_0x51ae53['query']);_0x597943[_0xe652('0x31')]=_[_0xe652('0x32')](_0x597943[_0xe652('0x2e')],_0x597943[_0xe652('0x30')]);_0x4dce7c[_0xe652('0x33')]=_[_0xe652('0x32')](_0x597943[_0xe652('0x2e')],qs[_0xe652('0x34')](_0x51ae53[_0xe652('0x30')][_0xe652('0x34')]));_0x4dce7c[_0xe652('0x33')]=_0x4dce7c['attributes']['length']?_0x4dce7c[_0xe652('0x33')]:_0x597943[_0xe652('0x2e')];if(!_0x51ae53[_0xe652('0x30')][_0xe652('0x35')]('nolimit')){_0x4dce7c['limit']=qs[_0xe652('0x1b')](_0x51ae53[_0xe652('0x30')]['limit']);_0x4dce7c['offset']=qs['offset'](_0x51ae53[_0xe652('0x30')][_0xe652('0x1a')]);}_0x4dce7c[_0xe652('0x36')]=qs[_0xe652('0x37')](_0x51ae53[_0xe652('0x30')][_0xe652('0x37')]);_0x4dce7c['where']=qs[_0xe652('0x31')](_[_0xe652('0x38')](_0x51ae53[_0xe652('0x30')],_0x597943[_0xe652('0x31')]),_0x3139dd);if(_0x51ae53['query'][_0xe652('0x39')]){_0x4dce7c[_0xe652('0x3a')]=_[_0xe652('0x3b')](_0x4dce7c[_0xe652('0x3a')],{'$or':_[_0xe652('0x2f')](_0x3139dd,function(_0x377355){if(_0x377355[_0xe652('0x3c')]!=='VIRTUAL'){var _0x341949={};_0x341949[_0x377355[_0xe652('0x28')]]={'$like':'%'+_0x51ae53['query'][_0xe652('0x39')]+'%'};return _0x341949;}})});}_0x4dce7c=_['merge']({},_0x4dce7c,_0x51ae53[_0xe652('0x3d')]);var _0x1419c9={'where':_0x4dce7c['where']};return db[_0xe652('0x2b')][_0xe652('0x1c')](_0x1419c9)[_0xe652('0x21')](function(_0x3b3a8d){_0x4dd733[_0xe652('0x1c')]=_0x3b3a8d;if(_0x51ae53[_0xe652('0x30')]['includeAll']){_0x4dce7c[_0xe652('0x3e')]=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x4dce7c);})['then'](function(_0xd6a5b5){_0x4dd733[_0xe652('0x3f')]=_0xd6a5b5;return _0x4dd733;})['then'](respondWithFilteredResult(_0x129692,_0x4dce7c))['catch'](handleError(_0x129692,null));};exports[_0xe652('0x40')]=function(_0x5e0066,_0x17b13e){var _0x32355b={'raw':!![],'where':{'id':_0x5e0066[_0xe652('0x41')]['id']}},_0x196e3f={};_0x196e3f[_0xe652('0x2e')]=_[_0xe652('0x42')](db[_0xe652('0x2b')]['rawAttributes']);_0x196e3f['query']=_[_0xe652('0x42')](_0x5e0066[_0xe652('0x30')]);_0x196e3f[_0xe652('0x31')]=_[_0xe652('0x32')](_0x196e3f['model'],_0x196e3f[_0xe652('0x30')]);_0x32355b[_0xe652('0x33')]=_['intersection'](_0x196e3f[_0xe652('0x2e')],qs['fields'](_0x5e0066[_0xe652('0x30')][_0xe652('0x34')]));_0x32355b['attributes']=_0x32355b['attributes'][_0xe652('0x43')]?_0x32355b[_0xe652('0x33')]:_0x196e3f[_0xe652('0x2e')];if(_0x5e0066['query'][_0xe652('0x44')]){_0x32355b['include']=[{'all':!![]}];}_0x32355b=_[_0xe652('0x3b')]({},_0x32355b,_0x5e0066[_0xe652('0x3d')]);return db['SquareOdbc']['find'](_0x32355b)[_0xe652('0x21')](handleEntityNotFound(_0x17b13e,null))[_0xe652('0x21')](respondWithResult(_0x17b13e,null))[_0xe652('0x45')](handleError(_0x17b13e,null));};exports[_0xe652('0x46')]=function(_0x4297b6,_0x2c4c9b){return db[_0xe652('0x2b')]['create'](_0x4297b6[_0xe652('0x47')],{})[_0xe652('0x21')](function(_0x12f77e){var _0x112647=_0x4297b6[_0xe652('0x48')][_0xe652('0x23')]({'plain':!![]});if(!_0x112647)throw new Error(_0xe652('0x49'));if(_0x112647[_0xe652('0x4a')]===_0xe652('0x48')){var _0x5752af=_0x12f77e[_0xe652('0x23')]({'plain':!![]});var _0x213084=_0xe652('0x24');return db[_0xe652('0x4b')][_0xe652('0x4c')]({'where':{'name':_0x213084,'userProfileId':_0x112647['userProfileId']},'raw':!![]})['then'](function(_0xcce5ea){if(_0xcce5ea&&_0xcce5ea[_0xe652('0x4d')]===0x0){return db[_0xe652('0x25')]['create']({'name':_0x5752af[_0xe652('0x28')],'resourceId':_0x5752af['id'],'type':_0xcce5ea[_0xe652('0x28')],'sectionId':_0xcce5ea['id']},{})[_0xe652('0x21')](function(){return _0x12f77e;});}else{return _0x12f77e;}})[_0xe652('0x45')](function(_0x508a11){logger[_0xe652('0x26')](_0xe652('0x4e'),_0x508a11);throw _0x508a11;});}return _0x12f77e;})[_0xe652('0x21')](respondWithResult(_0x2c4c9b,0xc9))[_0xe652('0x45')](handleError(_0x2c4c9b,null));};exports[_0xe652('0x4f')]=function(_0x44e86d,_0x1943b6){if(_0x44e86d[_0xe652('0x47')]['id']){delete _0x44e86d['body']['id'];}return db[_0xe652('0x2b')][_0xe652('0x4c')]({'where':{'id':_0x44e86d[_0xe652('0x41')]['id']}})[_0xe652('0x21')](handleEntityNotFound(_0x1943b6,null))[_0xe652('0x21')](saveUpdates(_0x44e86d[_0xe652('0x47')],null))[_0xe652('0x21')](respondWithResult(_0x1943b6,null))['catch'](handleError(_0x1943b6,null));};exports[_0xe652('0x22')]=function(_0x4b9255,_0x13b7e7){return db[_0xe652('0x2b')][_0xe652('0x4c')]({'where':{'id':_0x4b9255[_0xe652('0x41')]['id']}})[_0xe652('0x21')](handleEntityNotFound(_0x13b7e7,null))[_0xe652('0x21')](removeEntity(_0x13b7e7,null))[_0xe652('0x45')](handleError(_0x13b7e7,null));};exports[_0xe652('0x50')]=function(_0x2614c1,_0x2b1eec,_0x4bb1b2){var _0x41a89c;return db[_0xe652('0x2b')][_0xe652('0x4c')]({'where':{'id':_0x2614c1[_0xe652('0x41')]['id']},'attributes':['id',_0xe652('0x51')]})['then'](handleEntityNotFound(_0x2b1eec,null))[_0xe652('0x21')](function(_0x49acad){if(_0x49acad){var _0x1b75c5=require('odbc')();_0x1b75c5['openSync'](_0x49acad[_0xe652('0x51')]);_0x1b75c5[_0xe652('0x52')]();return _0x49acad;}})['then'](respondWithResult(_0x2b1eec,null))[_0xe652('0x45')](handleError(_0x2b1eec,null));}; \ No newline at end of file +var _0xdc39=['fast-json-patch','request-promise','moment','bluebird','util','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','get','ODBC','UserProfileResource','end','error','stack','name','send','map','SquareOdbc','fieldName','type','model','query','keys','intersection','fields','attributes','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','filters','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','openSync','dsn','closeSync','eml-format','rimraf','zip-dir'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc39,0x141));var _0x9dc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc39[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9dc3('0x0'));var rimraf=require(_0x9dc3('0x1'));var zipdir=require(_0x9dc3('0x2'));var jsonpatch=require(_0x9dc3('0x3'));var rp=require(_0x9dc3('0x4'));var moment=require(_0x9dc3('0x5'));var BPromise=require(_0x9dc3('0x6'));var Mustache=require('mustache');var util=require(_0x9dc3('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x9dc3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9dc3('0x9'));var crypto=require('crypto');var jsforce=require(_0x9dc3('0xa'));var deskjs=require(_0x9dc3('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9dc3('0xc'));var Papa=require(_0x9dc3('0xd'));var Redis=require(_0x9dc3('0xe'));var authService=require(_0x9dc3('0xf'));var qs=require(_0x9dc3('0x10'));var as=require(_0x9dc3('0x11'));var hardwareService=require(_0x9dc3('0x12'));var logger=require('../../config/logger')(_0x9dc3('0x13'));var utils=require('../../config/utils');var config=require(_0x9dc3('0x14'));var licenseUtil=require(_0x9dc3('0x15'));var db=require(_0x9dc3('0x16'))['db'];function respondWithStatusCode(_0x1ac8f3,_0x1fb24b){_0x1fb24b=_0x1fb24b||0xcc;return function(_0x47d599){if(_0x47d599){return _0x1ac8f3[_0x9dc3('0x17')](_0x1fb24b);}return _0x1ac8f3[_0x9dc3('0x18')](_0x1fb24b)['end']();};}function respondWithResult(_0xe8099d,_0x1da446){_0x1da446=_0x1da446||0xc8;return function(_0x57ae70){if(_0x57ae70){return _0xe8099d['status'](_0x1da446)[_0x9dc3('0x19')](_0x57ae70);}};}function respondWithFilteredResult(_0x22edff,_0x1411ba){return function(_0x660ced){if(_0x660ced){var _0x3fd136=typeof _0x1411ba[_0x9dc3('0x1a')]==='undefined'&&typeof _0x1411ba['limit']===_0x9dc3('0x1b');var _0xcb95ce=_0x660ced[_0x9dc3('0x1c')];var _0x5d303e=_0x3fd136?0x0:_0x1411ba['offset'];var _0x555bed=_0x3fd136?_0x660ced[_0x9dc3('0x1c')]:_0x1411ba[_0x9dc3('0x1a')]+_0x1411ba[_0x9dc3('0x1d')];var _0xb8bffb;if(_0x555bed>=_0xcb95ce){_0x555bed=_0xcb95ce;_0xb8bffb=0xc8;}else{_0xb8bffb=0xce;}_0x22edff[_0x9dc3('0x18')](_0xb8bffb);return _0x22edff['set'](_0x9dc3('0x1e'),_0x5d303e+'-'+_0x555bed+'/'+_0xcb95ce)[_0x9dc3('0x19')](_0x660ced);}return null;};}function patchUpdates(_0xd6d4f1){return function(_0x2fe27e){try{jsonpatch[_0x9dc3('0x1f')](_0x2fe27e,_0xd6d4f1,!![]);}catch(_0x4b45e3){return BPromise[_0x9dc3('0x20')](_0x4b45e3);}return _0x2fe27e[_0x9dc3('0x21')]();};}function saveUpdates(_0x28bbf4,_0x43cb2b){return function(_0x51272b){if(_0x51272b){return _0x51272b[_0x9dc3('0x22')](_0x28bbf4)['then'](function(_0x5e768b){return _0x5e768b;});}return null;};}function removeEntity(_0x127fc2,_0x236984){return function(_0x468543){if(_0x468543){return _0x468543['destroy']()[_0x9dc3('0x23')](function(){var _0x337ff3=_0x468543[_0x9dc3('0x24')]({'plain':!![]});var _0x3df728=_0x9dc3('0x25');return db[_0x9dc3('0x26')]['destroy']({'where':{'type':_0x3df728,'resourceId':_0x337ff3['id']}})[_0x9dc3('0x23')](function(){return _0x468543;});})[_0x9dc3('0x23')](function(){_0x127fc2[_0x9dc3('0x18')](0xcc)[_0x9dc3('0x27')]();});}};}function handleEntityNotFound(_0x576b35,_0x141ac8){return function(_0x15821a){if(!_0x15821a){_0x576b35[_0x9dc3('0x17')](0x194);}return _0x15821a;};}function handleError(_0x1f9454,_0xcf0d4b){_0xcf0d4b=_0xcf0d4b||0x1f4;return function(_0x72c3a9){logger[_0x9dc3('0x28')](_0x72c3a9[_0x9dc3('0x29')]);if(_0x72c3a9[_0x9dc3('0x2a')]){delete _0x72c3a9['name'];}_0x1f9454[_0x9dc3('0x18')](_0xcf0d4b)[_0x9dc3('0x2b')](_0x72c3a9);};}exports['index']=function(_0x4e22bf,_0x39a206){var _0x4aaa98={},_0x31e5da={},_0x9f4a97={'count':0x0,'rows':[]};var _0x2dfb6a=_[_0x9dc3('0x2c')](db[_0x9dc3('0x2d')]['rawAttributes'],function(_0x3c2a00){return{'name':_0x3c2a00[_0x9dc3('0x2e')],'type':_0x3c2a00[_0x9dc3('0x2f')]['key']};});_0x31e5da[_0x9dc3('0x30')]=_['map'](_0x2dfb6a,'name');_0x31e5da[_0x9dc3('0x31')]=_[_0x9dc3('0x32')](_0x4e22bf['query']);_0x31e5da['filters']=_[_0x9dc3('0x33')](_0x31e5da[_0x9dc3('0x30')],_0x31e5da[_0x9dc3('0x31')]);_0x4aaa98['attributes']=_[_0x9dc3('0x33')](_0x31e5da[_0x9dc3('0x30')],qs[_0x9dc3('0x34')](_0x4e22bf['query'][_0x9dc3('0x34')]));_0x4aaa98[_0x9dc3('0x35')]=_0x4aaa98[_0x9dc3('0x35')]['length']?_0x4aaa98[_0x9dc3('0x35')]:_0x31e5da[_0x9dc3('0x30')];if(!_0x4e22bf[_0x9dc3('0x31')]['hasOwnProperty'](_0x9dc3('0x36'))){_0x4aaa98['limit']=qs[_0x9dc3('0x1d')](_0x4e22bf[_0x9dc3('0x31')][_0x9dc3('0x1d')]);_0x4aaa98[_0x9dc3('0x1a')]=qs[_0x9dc3('0x1a')](_0x4e22bf['query'][_0x9dc3('0x1a')]);}_0x4aaa98['order']=qs[_0x9dc3('0x37')](_0x4e22bf[_0x9dc3('0x31')]['sort']);_0x4aaa98[_0x9dc3('0x38')]=qs['filters'](_[_0x9dc3('0x39')](_0x4e22bf[_0x9dc3('0x31')],_0x31e5da['filters']),_0x2dfb6a);if(_0x4e22bf['query'][_0x9dc3('0x3a')]){_0x4aaa98[_0x9dc3('0x38')]=_['merge'](_0x4aaa98['where'],{'$or':_['map'](_0x2dfb6a,function(_0x4d497b){if(_0x4d497b[_0x9dc3('0x2f')]!==_0x9dc3('0x3b')){var _0x297aba={};_0x297aba[_0x4d497b[_0x9dc3('0x2a')]]={'$like':'%'+_0x4e22bf['query']['filter']+'%'};return _0x297aba;}})});}_0x4aaa98=_['merge']({},_0x4aaa98,_0x4e22bf[_0x9dc3('0x3c')]);var _0x3f5ba0={'where':_0x4aaa98[_0x9dc3('0x38')]};return db[_0x9dc3('0x2d')][_0x9dc3('0x1c')](_0x3f5ba0)[_0x9dc3('0x23')](function(_0x4f2a52){_0x9f4a97['count']=_0x4f2a52;if(_0x4e22bf[_0x9dc3('0x31')][_0x9dc3('0x3d')]){_0x4aaa98[_0x9dc3('0x3e')]=[{'all':!![]}];}return db[_0x9dc3('0x2d')]['findAll'](_0x4aaa98);})[_0x9dc3('0x23')](function(_0x5963a5){_0x9f4a97[_0x9dc3('0x3f')]=_0x5963a5;return _0x9f4a97;})[_0x9dc3('0x23')](respondWithFilteredResult(_0x39a206,_0x4aaa98))[_0x9dc3('0x40')](handleError(_0x39a206,null));};exports[_0x9dc3('0x41')]=function(_0x20c89a,_0x5e5c4f){var _0x7a7685={'raw':!![],'where':{'id':_0x20c89a[_0x9dc3('0x42')]['id']}},_0x5046d7={};_0x5046d7['model']=_[_0x9dc3('0x32')](db['SquareOdbc'][_0x9dc3('0x43')]);_0x5046d7['query']=_[_0x9dc3('0x32')](_0x20c89a['query']);_0x5046d7[_0x9dc3('0x44')]=_['intersection'](_0x5046d7[_0x9dc3('0x30')],_0x5046d7['query']);_0x7a7685[_0x9dc3('0x35')]=_[_0x9dc3('0x33')](_0x5046d7[_0x9dc3('0x30')],qs[_0x9dc3('0x34')](_0x20c89a[_0x9dc3('0x31')]['fields']));_0x7a7685[_0x9dc3('0x35')]=_0x7a7685['attributes'][_0x9dc3('0x45')]?_0x7a7685[_0x9dc3('0x35')]:_0x5046d7[_0x9dc3('0x30')];if(_0x20c89a[_0x9dc3('0x31')][_0x9dc3('0x3d')]){_0x7a7685[_0x9dc3('0x3e')]=[{'all':!![]}];}_0x7a7685=_['merge']({},_0x7a7685,_0x20c89a[_0x9dc3('0x3c')]);return db['SquareOdbc']['find'](_0x7a7685)[_0x9dc3('0x23')](handleEntityNotFound(_0x5e5c4f,null))[_0x9dc3('0x23')](respondWithResult(_0x5e5c4f,null))[_0x9dc3('0x40')](handleError(_0x5e5c4f,null));};exports[_0x9dc3('0x46')]=function(_0xfa6a6d,_0x58b46f){return db[_0x9dc3('0x2d')][_0x9dc3('0x46')](_0xfa6a6d[_0x9dc3('0x47')],{})['then'](function(_0x20a4a5){var _0x505cd8=_0xfa6a6d[_0x9dc3('0x48')][_0x9dc3('0x24')]({'plain':!![]});if(!_0x505cd8)throw new Error(_0x9dc3('0x49'));if(_0x505cd8['role']===_0x9dc3('0x48')){var _0x450f31=_0x20a4a5[_0x9dc3('0x24')]({'plain':!![]});var _0x18c201=_0x9dc3('0x25');return db['UserProfileSection'][_0x9dc3('0x4a')]({'where':{'name':_0x18c201,'userProfileId':_0x505cd8[_0x9dc3('0x4b')]},'raw':!![]})[_0x9dc3('0x23')](function(_0x54af64){if(_0x54af64&&_0x54af64['autoAssociation']===0x0){return db[_0x9dc3('0x26')][_0x9dc3('0x46')]({'name':_0x450f31[_0x9dc3('0x2a')],'resourceId':_0x450f31['id'],'type':_0x54af64[_0x9dc3('0x2a')],'sectionId':_0x54af64['id']},{})[_0x9dc3('0x23')](function(){return _0x20a4a5;});}else{return _0x20a4a5;}})[_0x9dc3('0x40')](function(_0x13c06d){logger[_0x9dc3('0x28')](_0x9dc3('0x4c'),_0x13c06d);throw _0x13c06d;});}return _0x20a4a5;})[_0x9dc3('0x23')](respondWithResult(_0x58b46f,0xc9))[_0x9dc3('0x40')](handleError(_0x58b46f,null));};exports['update']=function(_0x2eadec,_0x2084f6){if(_0x2eadec[_0x9dc3('0x47')]['id']){delete _0x2eadec[_0x9dc3('0x47')]['id'];}return db[_0x9dc3('0x2d')][_0x9dc3('0x4a')]({'where':{'id':_0x2eadec[_0x9dc3('0x42')]['id']}})[_0x9dc3('0x23')](handleEntityNotFound(_0x2084f6,null))[_0x9dc3('0x23')](saveUpdates(_0x2eadec[_0x9dc3('0x47')],null))['then'](respondWithResult(_0x2084f6,null))[_0x9dc3('0x40')](handleError(_0x2084f6,null));};exports['destroy']=function(_0x35e701,_0xa58f7c){return db[_0x9dc3('0x2d')][_0x9dc3('0x4a')]({'where':{'id':_0x35e701[_0x9dc3('0x42')]['id']}})['then'](handleEntityNotFound(_0xa58f7c,null))['then'](removeEntity(_0xa58f7c,null))[_0x9dc3('0x40')](handleError(_0xa58f7c,null));};exports[_0x9dc3('0x4d')]=function(_0x4ab1e9,_0x360695,_0x5af1f4){var _0x1ae4d8;return db[_0x9dc3('0x2d')][_0x9dc3('0x4a')]({'where':{'id':_0x4ab1e9[_0x9dc3('0x42')]['id']},'attributes':['id','dsn']})[_0x9dc3('0x23')](handleEntityNotFound(_0x360695,null))[_0x9dc3('0x23')](function(_0x3e0261){if(_0x3e0261){var _0x349a06=require('odbc')();_0x349a06[_0x9dc3('0x4e')](_0x3e0261[_0x9dc3('0x4f')]);_0x349a06[_0x9dc3('0x50')]();return _0x3e0261;}})[_0x9dc3('0x23')](respondWithResult(_0x360695,null))[_0x9dc3('0x40')](handleError(_0x360695,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 1a6d8b7..733ac4a 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 _0xe658=['square_odbc','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./squareOdbc.attributes','define'];(function(_0x457bc6,_0x431adc){var _0x337f06=function(_0x158788){while(--_0x158788){_0x457bc6['push'](_0x457bc6['shift']());}};_0x337f06(++_0x431adc);}(_0xe658,0x123));var _0x8e65=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xe658[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x8e65('0x0'));var util=require(_0x8e65('0x1'));var logger=require('../../config/logger')(_0x8e65('0x2'));var moment=require('moment');var BPromise=require(_0x8e65('0x3'));var rp=require(_0x8e65('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8e65('0x5'));var config=require(_0x8e65('0x6'));var attributes=require(_0x8e65('0x7'));module['exports']=function(_0x5c2bf5,_0x27b972){return _0x5c2bf5[_0x8e65('0x8')]('SquareOdbc',attributes,{'tableName':_0x8e65('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57d2=['rimraf','../../config/environment','exports','define','square_odbc','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x3b96cf,_0x1592f2){var _0x2e315a=function(_0x21fa50){while(--_0x21fa50){_0x3b96cf['push'](_0x3b96cf['shift']());}};_0x2e315a(++_0x1592f2);}(_0x57d2,0x185));var _0x257d=function(_0x582116,_0xfdf46b){_0x582116=_0x582116-0x0;var _0x5aedf8=_0x57d2[_0x582116];return _0x5aedf8;};'use strict';var _=require(_0x257d('0x0'));var util=require(_0x257d('0x1'));var logger=require(_0x257d('0x2'))(_0x257d('0x3'));var moment=require(_0x257d('0x4'));var BPromise=require(_0x257d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x257d('0x6'));var rimraf=require(_0x257d('0x7'));var config=require(_0x257d('0x8'));var attributes=require('./squareOdbc.attributes');module[_0x257d('0x9')]=function(_0x543b8f,_0x326479){return _0x543b8f[_0x257d('0xa')]('SquareOdbc',attributes,{'tableName':_0x257d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index c1692ff..56ca08c 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 _0xfeb6=['SquareOdbc,\x20%s,\x20%s','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','attributes','map','include','model','stringify','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x32b69e,_0xc154fe){var _0x36fb0b=function(_0x138d95){while(--_0x138d95){_0x32b69e['push'](_0x32b69e['shift']());}};_0x36fb0b(++_0xc154fe);}(_0xfeb6,0x1b1));var _0x6feb=function(_0x677f1a,_0x2cc284){_0x677f1a=_0x677f1a-0x0;var _0xe1cad7=_0xfeb6[_0x677f1a];return _0xe1cad7;};'use strict';var _=require('lodash');var util=require(_0x6feb('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6feb('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6feb('0x2'))['db'];var utils=require(_0x6feb('0x3'));var logger=require(_0x6feb('0x4'))('rpc');var config=require(_0x6feb('0x5'));var jayson=require(_0x6feb('0x6'));var client=jayson[_0x6feb('0x7')][_0x6feb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45314d,_0x6ba066,_0x570536){return new BPromise(function(_0x339cfc,_0x456d47){return client[_0x6feb('0x9')](_0x45314d,_0x570536)['then'](function(_0x23c3ca){logger[_0x6feb('0xa')]('SquareOdbc,\x20%s,\x20%s',_0x6ba066,'request\x20sent');logger[_0x6feb('0xb')](_0x6feb('0xc'),_0x6ba066,_0x6feb('0xd'),JSON['stringify'](_0x23c3ca));if(_0x23c3ca[_0x6feb('0xe')]){if(_0x23c3ca[_0x6feb('0xe')]['code']===0x1f4){logger[_0x6feb('0xe')](_0x6feb('0xf'),_0x6ba066,_0x23c3ca['error'][_0x6feb('0x10')]);return _0x456d47(_0x23c3ca[_0x6feb('0xe')][_0x6feb('0x10')]);}logger[_0x6feb('0xe')](_0x6feb('0xf'),_0x6ba066,_0x23c3ca[_0x6feb('0xe')]['message']);return _0x339cfc(_0x23c3ca[_0x6feb('0xe')][_0x6feb('0x10')]);}else{logger[_0x6feb('0xa')](_0x6feb('0xf'),_0x6ba066,_0x6feb('0xd'));_0x339cfc(_0x23c3ca[_0x6feb('0x11')][_0x6feb('0x10')]);}})[_0x6feb('0x12')](function(_0x13b8d6){logger[_0x6feb('0xe')](_0x6feb('0xf'),_0x6ba066,_0x13b8d6);_0x456d47(_0x13b8d6);});});}exports[_0x6feb('0x13')]=function(_0xe8498a){var _0x729bb8=this;return new Promise(function(_0x2ced4b,_0x1868ef){return db[_0x6feb('0x14')][_0x6feb('0x15')]({'raw':_0xe8498a[_0x6feb('0x16')]?_0xe8498a[_0x6feb('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xe8498a['options']?_0xe8498a[_0x6feb('0x16')]['where']||null:null,'attributes':_0xe8498a[_0x6feb('0x16')]?_0xe8498a[_0x6feb('0x16')][_0x6feb('0x17')]||null:null,'include':_0xe8498a[_0x6feb('0x16')]?_0xe8498a['options']['include']?_[_0x6feb('0x18')](_0xe8498a[_0x6feb('0x16')][_0x6feb('0x19')],function(_0x4c0fef){return{'model':db[_0x4c0fef[_0x6feb('0x1a')]],'as':_0x4c0fef['as'],'attributes':_0x4c0fef['attributes'],'include':_0x4c0fef[_0x6feb('0x19')]?_['map'](_0x4c0fef[_0x6feb('0x19')],function(_0x4e0873){return{'model':db[_0x4e0873['model']],'as':_0x4e0873['as'],'attributes':_0x4e0873[_0x6feb('0x17')],'include':_0x4e0873[_0x6feb('0x19')]?_[_0x6feb('0x18')](_0x4e0873[_0x6feb('0x19')],function(_0x336c02){return{'model':db[_0x336c02['model']],'as':_0x336c02['as'],'attributes':_0x336c02[_0x6feb('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x7477d9){logger[_0x6feb('0xa')]('ShowSquareOdbc',_0xe8498a);logger['debug'](_0x6feb('0x13'),_0xe8498a,JSON[_0x6feb('0x1b')](_0x7477d9));_0x2ced4b(_0x7477d9);})[_0x6feb('0x12')](function(_0x172daf){logger[_0x6feb('0xe')](_0x6feb('0x13'),_0x172daf['message'],_0xe8498a);_0x1868ef(_0x729bb8['error'](0x1f4,_0x172daf[_0x6feb('0x10')]));});});}; \ No newline at end of file +var _0x280f=['message','info','result','catch','options','raw','where','include','map','model','attributes','ShowSquareOdbc','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x73f908,_0x543682){var _0x4210e8=function(_0x4846d8){while(--_0x4846d8){_0x73f908['push'](_0x73f908['shift']());}};_0x4210e8(++_0x543682);}(_0x280f,0x12c));var _0xf280=function(_0x2ff739,_0x1c8e0f){_0x2ff739=_0x2ff739-0x0;var _0x12dc13=_0x280f[_0x2ff739];return _0x12dc13;};'use strict';var _=require(_0xf280('0x0'));var util=require(_0xf280('0x1'));var moment=require(_0xf280('0x2'));var BPromise=require(_0xf280('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf280('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf280('0x5'));var logger=require(_0xf280('0x6'))(_0xf280('0x7'));var config=require(_0xf280('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf280('0x9')][_0xf280('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40f78e,_0x4bfbeb,_0x5756d5){return new BPromise(function(_0x3169f8,_0x392fba){return client[_0xf280('0xb')](_0x40f78e,_0x5756d5)[_0xf280('0xc')](function(_0x5075fc){logger['info'](_0xf280('0xd'),_0x4bfbeb,_0xf280('0xe'));logger[_0xf280('0xf')](_0xf280('0x10'),_0x4bfbeb,_0xf280('0xe'),JSON[_0xf280('0x11')](_0x5075fc));if(_0x5075fc[_0xf280('0x12')]){if(_0x5075fc[_0xf280('0x12')][_0xf280('0x13')]===0x1f4){logger[_0xf280('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x4bfbeb,_0x5075fc[_0xf280('0x12')][_0xf280('0x14')]);return _0x392fba(_0x5075fc[_0xf280('0x12')][_0xf280('0x14')]);}logger[_0xf280('0x12')](_0xf280('0xd'),_0x4bfbeb,_0x5075fc[_0xf280('0x12')][_0xf280('0x14')]);return _0x3169f8(_0x5075fc[_0xf280('0x12')][_0xf280('0x14')]);}else{logger[_0xf280('0x15')](_0xf280('0xd'),_0x4bfbeb,'request\x20sent');_0x3169f8(_0x5075fc[_0xf280('0x16')][_0xf280('0x14')]);}})[_0xf280('0x17')](function(_0x381515){logger[_0xf280('0x12')](_0xf280('0xd'),_0x4bfbeb,_0x381515);_0x392fba(_0x381515);});});}exports['ShowSquareOdbc']=function(_0x2398dc){var _0x268914=this;return new Promise(function(_0x11dfd6,_0x52c8f7){return db['SquareOdbc']['find']({'raw':_0x2398dc[_0xf280('0x18')]?_0x2398dc[_0xf280('0x18')][_0xf280('0x19')]===undefined?!![]:![]:!![],'where':_0x2398dc['options']?_0x2398dc[_0xf280('0x18')][_0xf280('0x1a')]||null:null,'attributes':_0x2398dc[_0xf280('0x18')]?_0x2398dc[_0xf280('0x18')]['attributes']||null:null,'include':_0x2398dc[_0xf280('0x18')]?_0x2398dc['options'][_0xf280('0x1b')]?_['map'](_0x2398dc[_0xf280('0x18')][_0xf280('0x1b')],function(_0x13eb6c){return{'model':db[_0x13eb6c['model']],'as':_0x13eb6c['as'],'attributes':_0x13eb6c['attributes'],'include':_0x13eb6c['include']?_[_0xf280('0x1c')](_0x13eb6c[_0xf280('0x1b')],function(_0x1ea7f7){return{'model':db[_0x1ea7f7[_0xf280('0x1d')]],'as':_0x1ea7f7['as'],'attributes':_0x1ea7f7[_0xf280('0x1e')],'include':_0x1ea7f7['include']?_[_0xf280('0x1c')](_0x1ea7f7[_0xf280('0x1b')],function(_0x2703da){return{'model':db[_0x2703da['model']],'as':_0x2703da['as'],'attributes':_0x2703da[_0xf280('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57f3bd){logger[_0xf280('0x15')](_0xf280('0x1f'),_0x2398dc);logger[_0xf280('0xf')](_0xf280('0x1f'),_0x2398dc,JSON[_0xf280('0x11')](_0x57f3bd));_0x11dfd6(_0x57f3bd);})[_0xf280('0x17')](function(_0x491e2b){logger[_0xf280('0x12')](_0xf280('0x1f'),_0x491e2b[_0xf280('0x14')],_0x2398dc);_0x52c8f7(_0x268914[_0xf280('0x12')](0x1f4,_0x491e2b[_0xf280('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 35b7869..acfbb72 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 _0x6d80=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports'];(function(_0x1c5cd2,_0x277ceb){var _0x895e35=function(_0x4b4307){while(--_0x4b4307){_0x1c5cd2['push'](_0x1c5cd2['shift']());}};_0x895e35(++_0x277ceb);}(_0x6d80,0x85));var _0x06d8=function(_0x1d5ff1,_0x5b6320){_0x1d5ff1=_0x1d5ff1-0x0;var _0x2c485d=_0x6d80[_0x1d5ff1];return _0x2c485d;};'use strict';var multer=require(_0x06d8('0x0'));var util=require(_0x06d8('0x1'));var path=require(_0x06d8('0x2'));var timeout=require(_0x06d8('0x3'));var express=require(_0x06d8('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x06d8('0x5'));var interaction=require(_0x06d8('0x6'));var config=require(_0x06d8('0x7'));var controller=require(_0x06d8('0x8'));router[_0x06d8('0x9')]('/',auth[_0x06d8('0xa')](),controller[_0x06d8('0xb')]);router['get'](_0x06d8('0xc'),auth[_0x06d8('0xa')](),controller[_0x06d8('0xd')]);router[_0x06d8('0xe')]('/',auth['isAuthenticated'](),controller[_0x06d8('0xf')]);router[_0x06d8('0x10')](_0x06d8('0xc'),auth[_0x06d8('0xa')](),controller['update']);router['delete']('/:id',auth[_0x06d8('0xa')](),controller[_0x06d8('0x11')]);module[_0x06d8('0x12')]=router; \ No newline at end of file +var _0xbb60=['../../config/environment','./squareProject.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5b48c9,_0x18cea4){var _0x72226f=function(_0xbe676){while(--_0xbe676){_0x5b48c9['push'](_0x5b48c9['shift']());}};_0x72226f(++_0x18cea4);}(_0xbb60,0x17c));var _0x0bb6=function(_0x250342,_0x343e45){_0x250342=_0x250342-0x0;var _0xadca24=_0xbb60[_0x250342];return _0xadca24;};'use strict';var multer=require(_0x0bb6('0x0'));var util=require(_0x0bb6('0x1'));var path=require(_0x0bb6('0x2'));var timeout=require(_0x0bb6('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0bb6('0x4'));var controller=require(_0x0bb6('0x5'));router[_0x0bb6('0x6')]('/',auth[_0x0bb6('0x7')](),controller['index']);router['get'](_0x0bb6('0x8'),auth[_0x0bb6('0x7')](),controller[_0x0bb6('0x9')]);router[_0x0bb6('0xa')]('/',auth[_0x0bb6('0x7')](),controller[_0x0bb6('0xb')]);router[_0x0bb6('0xc')](_0x0bb6('0x8'),auth[_0x0bb6('0x7')](),controller['update']);router[_0x0bb6('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x0bb6('0xe')]);module[_0x0bb6('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 4fb1d61..0d84eb3 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 _0x8aad=['BLOB','preproduction','toString','utf8','getDataValue','production','DATE','sequelize','exports','name','TEXT'];(function(_0x23f75c,_0x3b6a63){var _0x5b2352=function(_0x441b6c){while(--_0x441b6c){_0x23f75c['push'](_0x23f75c['shift']());}};_0x5b2352(++_0x3b6a63);}(_0x8aad,0x146));var _0xd8aa=function(_0x1262ca,_0x2489ab){_0x1262ca=_0x1262ca-0x0;var _0x4979e0=_0x8aad[_0x1262ca];return _0x4979e0;};'use strict';var Sequelize=require(_0xd8aa('0x0'));module[_0xd8aa('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd8aa('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xd8aa('0x3')]},'preproduction':{'type':Sequelize[_0xd8aa('0x4')]('long'),'get':function(){if(this['getDataValue'](_0xd8aa('0x5'))){return this['getDataValue']('preproduction')[_0xd8aa('0x6')](_0xd8aa('0x7'));}}},'production':{'type':Sequelize[_0xd8aa('0x4')]('long'),'get':function(){if(this[_0xd8aa('0x8')](_0xd8aa('0x9'))){return this[_0xd8aa('0x8')](_0xd8aa('0x9'))['toString']('utf8');}}},'savedAt':{'type':Sequelize[_0xd8aa('0xa')]},'publishedAt':{'type':Sequelize[_0xd8aa('0xa')]}}; \ No newline at end of file +var _0x429b=['BLOB','production','utf8','DATE','sequelize','exports','STRING','TEXT','long','getDataValue','preproduction','toString'];(function(_0x47877c,_0x3106d9){var _0x1677a6=function(_0x29de74){while(--_0x29de74){_0x47877c['push'](_0x47877c['shift']());}};_0x1677a6(++_0x3106d9);}(_0x429b,0x70));var _0xb429=function(_0x1568bc,_0x1b515b){_0x1568bc=_0x1568bc-0x0;var _0x3ee44f=_0x429b[_0x1568bc];return _0x3ee44f;};'use strict';var Sequelize=require(_0xb429('0x0'));module[_0xb429('0x1')]={'name':{'type':Sequelize[_0xb429('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xb429('0x2')]},'notes':{'type':Sequelize[_0xb429('0x3')]},'preproduction':{'type':Sequelize['BLOB'](_0xb429('0x4')),'get':function(){if(this[_0xb429('0x5')](_0xb429('0x6'))){return this[_0xb429('0x5')](_0xb429('0x6'))[_0xb429('0x7')]('utf8');}}},'production':{'type':Sequelize[_0xb429('0x8')](_0xb429('0x4')),'get':function(){if(this[_0xb429('0x5')](_0xb429('0x9'))){return this['getDataValue'](_0xb429('0x9'))[_0xb429('0x7')](_0xb429('0xa'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xb429('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 29bd5d1..605343b 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 _0x49b2=['rows','catch','show','params','length','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','stringify','production','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','status','json','undefined','count','offset','limit','set','Content-Range','update','then','destroy','get','SquareProjects','UserProfileResource','end','sendStatus','error','stack','name','send','index','SquareProject','rawAttributes','type','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','includeAll','include','findAll'];(function(_0x23a1f0,_0x36c8fd){var _0x2cf328=function(_0x4a0da0){while(--_0x4a0da0){_0x23a1f0['push'](_0x23a1f0['shift']());}};_0x2cf328(++_0x36c8fd);}(_0x49b2,0x1bb));var _0x249b=function(_0x50e697,_0x5b4e4b){_0x50e697=_0x50e697-0x0;var _0x14ec31=_0x49b2[_0x50e697];return _0x14ec31;};'use strict';var _=require('lodash');var Redis=require(_0x249b('0x0'));var qs=require(_0x249b('0x1'));var logger=require(_0x249b('0x2'))(_0x249b('0x3'));var config=require(_0x249b('0x4'));var db=require(_0x249b('0x5'))['db'];config[_0x249b('0x6')]=_[_0x249b('0x7')](config[_0x249b('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x249b('0x8'))(new Redis(config['redis']));require(_0x249b('0x9'))['register'](socket);function respondWithResult(_0x5bcb16,_0x11d760){_0x11d760=_0x11d760||0xc8;return function(_0x15e882){if(_0x15e882){return _0x5bcb16[_0x249b('0xa')](_0x11d760)[_0x249b('0xb')](_0x15e882);}};}function respondWithFilteredResult(_0x339372,_0x4d5623){return function(_0xd018e5){if(_0xd018e5){var _0x227dbe=typeof _0x4d5623['offset']===_0x249b('0xc')&&typeof _0x4d5623['limit']==='undefined';var _0x20266d=_0xd018e5[_0x249b('0xd')];var _0x11cefa=_0x227dbe?0x0:_0x4d5623[_0x249b('0xe')];var _0x24345b=_0x227dbe?_0xd018e5['count']:_0x4d5623['offset']+_0x4d5623[_0x249b('0xf')];var _0x49b88d;if(_0x24345b>=_0x20266d){_0x24345b=_0x20266d;_0x49b88d=0xc8;}else{_0x49b88d=0xce;}_0x339372[_0x249b('0xa')](_0x49b88d);return _0x339372[_0x249b('0x10')](_0x249b('0x11'),_0x11cefa+'-'+_0x24345b+'/'+_0x20266d)[_0x249b('0xb')](_0xd018e5);}return null;};}function saveUpdates(_0x550936){return function(_0x1a5b0f){if(_0x1a5b0f){return _0x1a5b0f[_0x249b('0x12')](_0x550936)[_0x249b('0x13')](function(_0x2b900a){return _0x2b900a;});}return null;};}function removeEntity(_0x490ccd){return function(_0x561872){if(_0x561872){return _0x561872[_0x249b('0x14')]()[_0x249b('0x13')](function(){var _0x1f02f6=_0x561872[_0x249b('0x15')]({'plain':!![]});var _0x1ed026=_0x249b('0x16');return db[_0x249b('0x17')][_0x249b('0x14')]({'where':{'type':_0x1ed026,'resourceId':_0x1f02f6['id']}})[_0x249b('0x13')](function(){return _0x561872;});})[_0x249b('0x13')](function(){var _0x41b67c=new Redis(config[_0x249b('0x6')]);_0x41b67c['publish']('agi',JSON['stringify']({'id':_0x561872['id'],'deleted':!![]}));})[_0x249b('0x13')](function(){_0x490ccd[_0x249b('0xa')](0xcc)[_0x249b('0x18')]();});}};}function handleEntityNotFound(_0x310f8e){return function(_0x1b42ee){if(!_0x1b42ee){_0x310f8e[_0x249b('0x19')](0x194);}return _0x1b42ee;};}function handleError(_0x3f2294,_0x1ed9c1){_0x1ed9c1=_0x1ed9c1||0x1f4;return function(_0x2e7d50){logger[_0x249b('0x1a')](_0x2e7d50[_0x249b('0x1b')]);if(_0x2e7d50[_0x249b('0x1c')]){delete _0x2e7d50[_0x249b('0x1c')];}_0x3f2294[_0x249b('0xa')](_0x1ed9c1)[_0x249b('0x1d')](_0x2e7d50);};}exports[_0x249b('0x1e')]=function(_0x264a82,_0x9094d5){var _0x223eea={},_0x255eb5={},_0xb415c7={'count':0x0,'rows':[]};var _0x3c8957=_['map'](db[_0x249b('0x1f')][_0x249b('0x20')],function(_0x94411c){return{'name':_0x94411c['fieldName'],'type':_0x94411c[_0x249b('0x21')][_0x249b('0x22')]};});_0x255eb5[_0x249b('0x23')]=_[_0x249b('0x24')](_0x3c8957,_0x249b('0x1c'));_0x255eb5[_0x249b('0x25')]=_[_0x249b('0x26')](_0x264a82[_0x249b('0x25')]);_0x255eb5['filters']=_[_0x249b('0x27')](_0x255eb5[_0x249b('0x23')],_0x255eb5[_0x249b('0x25')]);_0x223eea['attributes']=_['intersection'](_0x255eb5[_0x249b('0x23')],qs[_0x249b('0x28')](_0x264a82[_0x249b('0x25')]['fields']));_0x223eea[_0x249b('0x29')]=_0x223eea['attributes']['length']?_0x223eea[_0x249b('0x29')]:_0x255eb5[_0x249b('0x23')];if(!_0x264a82['query'][_0x249b('0x2a')](_0x249b('0x2b'))){_0x223eea[_0x249b('0xf')]=qs['limit'](_0x264a82[_0x249b('0x25')]['limit']);_0x223eea['offset']=qs[_0x249b('0xe')](_0x264a82['query'][_0x249b('0xe')]);}_0x223eea[_0x249b('0x2c')]=qs[_0x249b('0x2d')](_0x264a82[_0x249b('0x25')][_0x249b('0x2d')]);_0x223eea[_0x249b('0x2e')]=qs['filters'](_[_0x249b('0x2f')](_0x264a82['query'],_0x255eb5[_0x249b('0x30')]),_0x3c8957);if(_0x264a82[_0x249b('0x25')][_0x249b('0x31')]){_0x223eea[_0x249b('0x2e')]=_[_0x249b('0x32')](_0x223eea[_0x249b('0x2e')],{'$or':_[_0x249b('0x24')](_0x3c8957,function(_0x837d49){if(_0x837d49['type']!=='VIRTUAL'){var _0x5cf40f={};_0x5cf40f[_0x837d49[_0x249b('0x1c')]]={'$like':'%'+_0x264a82[_0x249b('0x25')][_0x249b('0x31')]+'%'};return _0x5cf40f;}})});}_0x223eea=_['merge']({},_0x223eea,_0x264a82['options']);var _0x521af5={'where':_0x223eea[_0x249b('0x2e')]};return db[_0x249b('0x1f')][_0x249b('0xd')](_0x521af5)[_0x249b('0x13')](function(_0x270066){_0xb415c7[_0x249b('0xd')]=_0x270066;if(_0x264a82['query'][_0x249b('0x33')]){_0x223eea[_0x249b('0x34')]=[{'all':!![]}];}return db[_0x249b('0x1f')][_0x249b('0x35')](_0x223eea);})[_0x249b('0x13')](function(_0x8c3e49){_0xb415c7[_0x249b('0x36')]=_0x8c3e49;return _0xb415c7;})[_0x249b('0x13')](respondWithFilteredResult(_0x9094d5,_0x223eea))[_0x249b('0x37')](handleError(_0x9094d5,null));};exports[_0x249b('0x38')]=function(_0xf2648,_0x5667ec){var _0x44f6b1={'raw':![],'where':{'id':_0xf2648[_0x249b('0x39')]['id']}},_0xbbac3c={};_0xbbac3c[_0x249b('0x23')]=_[_0x249b('0x26')](db[_0x249b('0x1f')][_0x249b('0x20')]);_0xbbac3c['query']=_[_0x249b('0x26')](_0xf2648[_0x249b('0x25')]);_0xbbac3c['filters']=_[_0x249b('0x27')](_0xbbac3c[_0x249b('0x23')],_0xbbac3c[_0x249b('0x25')]);_0x44f6b1[_0x249b('0x29')]=_[_0x249b('0x27')](_0xbbac3c[_0x249b('0x23')],qs[_0x249b('0x28')](_0xf2648[_0x249b('0x25')][_0x249b('0x28')]));_0x44f6b1['attributes']=_0x44f6b1[_0x249b('0x29')][_0x249b('0x3a')]?_0x44f6b1[_0x249b('0x29')]:_0xbbac3c[_0x249b('0x23')];if(_0xf2648[_0x249b('0x25')][_0x249b('0x33')]){_0x44f6b1[_0x249b('0x34')]=[{'all':!![]}];}_0x44f6b1=_[_0x249b('0x32')]({},_0x44f6b1,_0xf2648[_0x249b('0x3b')]);return db[_0x249b('0x1f')][_0x249b('0x3c')](_0x44f6b1)[_0x249b('0x13')](handleEntityNotFound(_0x5667ec,null))[_0x249b('0x13')](respondWithResult(_0x5667ec,null))['catch'](handleError(_0x5667ec,null));};exports['create']=function(_0x9a9e2b,_0x598948){return db[_0x249b('0x1f')][_0x249b('0x3d')](_0x9a9e2b['body'],{})['then'](function(_0x5ce8de){var _0x1d664a=_0x9a9e2b[_0x249b('0x3e')]['get']({'plain':!![]});if(!_0x1d664a)throw new Error(_0x249b('0x3f'));if(_0x1d664a[_0x249b('0x40')]==='user'){var _0x168ff9=_0x5ce8de['get']({'plain':!![]});var _0x2408de='SquareProjects';return db[_0x249b('0x41')]['find']({'where':{'name':_0x2408de,'userProfileId':_0x1d664a['userProfileId']},'raw':!![]})['then'](function(_0x24099e){if(_0x24099e&&_0x24099e[_0x249b('0x42')]===0x0){return db['UserProfileResource'][_0x249b('0x3d')]({'name':_0x168ff9[_0x249b('0x1c')],'resourceId':_0x168ff9['id'],'type':_0x24099e['name'],'sectionId':_0x24099e['id']},{})['then'](function(){return _0x5ce8de;});}else{return _0x5ce8de;}})[_0x249b('0x37')](function(_0x660a9f){logger['error'](_0x249b('0x43'),_0x660a9f);throw _0x660a9f;});}return _0x5ce8de;})[_0x249b('0x13')](respondWithResult(_0x598948,0xc9))[_0x249b('0x37')](handleError(_0x598948,null));};exports[_0x249b('0x12')]=function(_0x30e2df,_0x37d6d2){if(_0x30e2df[_0x249b('0x44')]['id']){delete _0x30e2df[_0x249b('0x44')]['id'];}return db[_0x249b('0x1f')][_0x249b('0x3c')]({'where':{'id':_0x30e2df[_0x249b('0x39')]['id']}})['then'](handleEntityNotFound(_0x37d6d2,null))['then'](saveUpdates(_0x30e2df[_0x249b('0x44')],null))[_0x249b('0x13')](function(_0x5b9516){if(!_0x5b9516)return;var _0x12676a=_0x5b9516[_0x249b('0x15')]({'plain':!![]});return _0x12676a;})[_0x249b('0x13')](function(_0x36d391){var _0x295049=new Redis(config[_0x249b('0x6')]);_0x295049['publish']('agi',JSON[_0x249b('0x45')](_[_0x249b('0x2f')](_0x36d391,['id',_0x249b('0x1c'),_0x249b('0x46')])));return _0x36d391;})[_0x249b('0x13')](respondWithResult(_0x37d6d2,null))[_0x249b('0x37')](handleError(_0x37d6d2,null));};exports[_0x249b('0x14')]=function(_0x5e60bc,_0x9c0ab7){return db[_0x249b('0x1f')][_0x249b('0x3c')]({'where':{'id':_0x5e60bc['params']['id']}})[_0x249b('0x13')](handleEntityNotFound(_0x9c0ab7,null))[_0x249b('0x13')](removeEntity(_0x9c0ab7,null))[_0x249b('0x37')](handleError(_0x9c0ab7,null));}; \ No newline at end of file +var _0x7e25=['index','map','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','SquareProject','includeAll','include','findAll','rows','catch','show','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','params','publish','stringify','production','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','localhost','./squareProject.socket','json','offset','undefined','limit','count','status','set','Content-Range','update','then','destroy','SquareProjects','UserProfileResource','agi','end','sendStatus','error','name'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x7e25,0x178));var _0x57e2=function(_0x4503df,_0xfec122){_0x4503df=_0x4503df-0x0;var _0x3f1b2b=_0x7e25[_0x4503df];return _0x3f1b2b;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0x57e2('0x0'));var logger=require(_0x57e2('0x1'))(_0x57e2('0x2'));var config=require('../../config/environment');var db=require(_0x57e2('0x3'))['db'];config['redis']=_[_0x57e2('0x4')](config[_0x57e2('0x5')],{'host':_0x57e2('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x57e2('0x5')]));require(_0x57e2('0x7'))['register'](socket);function respondWithResult(_0x59dc8b,_0x357883){_0x357883=_0x357883||0xc8;return function(_0x1f7a10){if(_0x1f7a10){return _0x59dc8b['status'](_0x357883)[_0x57e2('0x8')](_0x1f7a10);}};}function respondWithFilteredResult(_0x7ae708,_0x2b5101){return function(_0x59d04c){if(_0x59d04c){var _0x5f0906=typeof _0x2b5101[_0x57e2('0x9')]===_0x57e2('0xa')&&typeof _0x2b5101[_0x57e2('0xb')]==='undefined';var _0x533dd6=_0x59d04c[_0x57e2('0xc')];var _0x1862be=_0x5f0906?0x0:_0x2b5101[_0x57e2('0x9')];var _0x3d7cdb=_0x5f0906?_0x59d04c[_0x57e2('0xc')]:_0x2b5101[_0x57e2('0x9')]+_0x2b5101['limit'];var _0x270cfb;if(_0x3d7cdb>=_0x533dd6){_0x3d7cdb=_0x533dd6;_0x270cfb=0xc8;}else{_0x270cfb=0xce;}_0x7ae708[_0x57e2('0xd')](_0x270cfb);return _0x7ae708[_0x57e2('0xe')](_0x57e2('0xf'),_0x1862be+'-'+_0x3d7cdb+'/'+_0x533dd6)[_0x57e2('0x8')](_0x59d04c);}return null;};}function saveUpdates(_0x44ecbe){return function(_0x186256){if(_0x186256){return _0x186256[_0x57e2('0x10')](_0x44ecbe)[_0x57e2('0x11')](function(_0x17279f){return _0x17279f;});}return null;};}function removeEntity(_0x12ed69){return function(_0x33520a){if(_0x33520a){return _0x33520a[_0x57e2('0x12')]()[_0x57e2('0x11')](function(){var _0x9088d1=_0x33520a['get']({'plain':!![]});var _0x5dd9fa=_0x57e2('0x13');return db[_0x57e2('0x14')][_0x57e2('0x12')]({'where':{'type':_0x5dd9fa,'resourceId':_0x9088d1['id']}})[_0x57e2('0x11')](function(){return _0x33520a;});})[_0x57e2('0x11')](function(){var _0x576d7e=new Redis(config[_0x57e2('0x5')]);_0x576d7e['publish'](_0x57e2('0x15'),JSON['stringify']({'id':_0x33520a['id'],'deleted':!![]}));})['then'](function(){_0x12ed69[_0x57e2('0xd')](0xcc)[_0x57e2('0x16')]();});}};}function handleEntityNotFound(_0x1e0161){return function(_0x25bf60){if(!_0x25bf60){_0x1e0161[_0x57e2('0x17')](0x194);}return _0x25bf60;};}function handleError(_0x32ef37,_0x3cfd21){_0x3cfd21=_0x3cfd21||0x1f4;return function(_0x5473a1){logger[_0x57e2('0x18')](_0x5473a1['stack']);if(_0x5473a1[_0x57e2('0x19')]){delete _0x5473a1[_0x57e2('0x19')];}_0x32ef37[_0x57e2('0xd')](_0x3cfd21)['send'](_0x5473a1);};}exports[_0x57e2('0x1a')]=function(_0x4c4cdf,_0x3359b3){var _0x2e0dc3={},_0x22753f={},_0x2daec9={'count':0x0,'rows':[]};var _0x1d0caf=_[_0x57e2('0x1b')](db['SquareProject'][_0x57e2('0x1c')],function(_0x36413b){return{'name':_0x36413b['fieldName'],'type':_0x36413b[_0x57e2('0x1d')][_0x57e2('0x1e')]};});_0x22753f['model']=_[_0x57e2('0x1b')](_0x1d0caf,_0x57e2('0x19'));_0x22753f[_0x57e2('0x1f')]=_[_0x57e2('0x20')](_0x4c4cdf[_0x57e2('0x1f')]);_0x22753f[_0x57e2('0x21')]=_['intersection'](_0x22753f[_0x57e2('0x22')],_0x22753f[_0x57e2('0x1f')]);_0x2e0dc3[_0x57e2('0x23')]=_[_0x57e2('0x24')](_0x22753f[_0x57e2('0x22')],qs[_0x57e2('0x25')](_0x4c4cdf[_0x57e2('0x1f')]['fields']));_0x2e0dc3[_0x57e2('0x23')]=_0x2e0dc3[_0x57e2('0x23')][_0x57e2('0x26')]?_0x2e0dc3[_0x57e2('0x23')]:_0x22753f['model'];if(!_0x4c4cdf[_0x57e2('0x1f')][_0x57e2('0x27')](_0x57e2('0x28'))){_0x2e0dc3[_0x57e2('0xb')]=qs[_0x57e2('0xb')](_0x4c4cdf['query'][_0x57e2('0xb')]);_0x2e0dc3['offset']=qs[_0x57e2('0x9')](_0x4c4cdf[_0x57e2('0x1f')][_0x57e2('0x9')]);}_0x2e0dc3[_0x57e2('0x29')]=qs[_0x57e2('0x2a')](_0x4c4cdf[_0x57e2('0x1f')][_0x57e2('0x2a')]);_0x2e0dc3['where']=qs[_0x57e2('0x21')](_['pick'](_0x4c4cdf[_0x57e2('0x1f')],_0x22753f['filters']),_0x1d0caf);if(_0x4c4cdf[_0x57e2('0x1f')][_0x57e2('0x2b')]){_0x2e0dc3[_0x57e2('0x2c')]=_['merge'](_0x2e0dc3[_0x57e2('0x2c')],{'$or':_['map'](_0x1d0caf,function(_0x13932){if(_0x13932[_0x57e2('0x1d')]!==_0x57e2('0x2d')){var _0x3ffff7={};_0x3ffff7[_0x13932[_0x57e2('0x19')]]={'$like':'%'+_0x4c4cdf['query'][_0x57e2('0x2b')]+'%'};return _0x3ffff7;}})});}_0x2e0dc3=_[_0x57e2('0x2e')]({},_0x2e0dc3,_0x4c4cdf[_0x57e2('0x2f')]);var _0x5abf9c={'where':_0x2e0dc3[_0x57e2('0x2c')]};return db[_0x57e2('0x30')]['count'](_0x5abf9c)[_0x57e2('0x11')](function(_0x8c8308){_0x2daec9[_0x57e2('0xc')]=_0x8c8308;if(_0x4c4cdf[_0x57e2('0x1f')][_0x57e2('0x31')]){_0x2e0dc3[_0x57e2('0x32')]=[{'all':!![]}];}return db[_0x57e2('0x30')][_0x57e2('0x33')](_0x2e0dc3);})[_0x57e2('0x11')](function(_0x5754db){_0x2daec9[_0x57e2('0x34')]=_0x5754db;return _0x2daec9;})[_0x57e2('0x11')](respondWithFilteredResult(_0x3359b3,_0x2e0dc3))[_0x57e2('0x35')](handleError(_0x3359b3,null));};exports[_0x57e2('0x36')]=function(_0x5de457,_0x5e5333){var _0x21a632={'raw':![],'where':{'id':_0x5de457['params']['id']}},_0x5bd0f7={};_0x5bd0f7[_0x57e2('0x22')]=_[_0x57e2('0x20')](db['SquareProject']['rawAttributes']);_0x5bd0f7[_0x57e2('0x1f')]=_[_0x57e2('0x20')](_0x5de457[_0x57e2('0x1f')]);_0x5bd0f7[_0x57e2('0x21')]=_['intersection'](_0x5bd0f7[_0x57e2('0x22')],_0x5bd0f7[_0x57e2('0x1f')]);_0x21a632[_0x57e2('0x23')]=_[_0x57e2('0x24')](_0x5bd0f7['model'],qs['fields'](_0x5de457['query'][_0x57e2('0x25')]));_0x21a632[_0x57e2('0x23')]=_0x21a632[_0x57e2('0x23')][_0x57e2('0x26')]?_0x21a632[_0x57e2('0x23')]:_0x5bd0f7[_0x57e2('0x22')];if(_0x5de457[_0x57e2('0x1f')][_0x57e2('0x31')]){_0x21a632[_0x57e2('0x32')]=[{'all':!![]}];}_0x21a632=_[_0x57e2('0x2e')]({},_0x21a632,_0x5de457[_0x57e2('0x2f')]);return db['SquareProject'][_0x57e2('0x37')](_0x21a632)[_0x57e2('0x11')](handleEntityNotFound(_0x5e5333,null))['then'](respondWithResult(_0x5e5333,null))[_0x57e2('0x35')](handleError(_0x5e5333,null));};exports[_0x57e2('0x38')]=function(_0x98ec44,_0x555e84){return db['SquareProject'][_0x57e2('0x38')](_0x98ec44[_0x57e2('0x39')],{})[_0x57e2('0x11')](function(_0x21943a){var _0x4ca263=_0x98ec44['user'][_0x57e2('0x3a')]({'plain':!![]});if(!_0x4ca263)throw new Error(_0x57e2('0x3b'));if(_0x4ca263[_0x57e2('0x3c')]==='user'){var _0x4f04f6=_0x21943a[_0x57e2('0x3a')]({'plain':!![]});var _0x55e0ea=_0x57e2('0x13');return db['UserProfileSection'][_0x57e2('0x37')]({'where':{'name':_0x55e0ea,'userProfileId':_0x4ca263[_0x57e2('0x3d')]},'raw':!![]})[_0x57e2('0x11')](function(_0x2be39f){if(_0x2be39f&&_0x2be39f[_0x57e2('0x3e')]===0x0){return db[_0x57e2('0x14')]['create']({'name':_0x4f04f6[_0x57e2('0x19')],'resourceId':_0x4f04f6['id'],'type':_0x2be39f[_0x57e2('0x19')],'sectionId':_0x2be39f['id']},{})[_0x57e2('0x11')](function(){return _0x21943a;});}else{return _0x21943a;}})[_0x57e2('0x35')](function(_0x16cf1c){logger[_0x57e2('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16cf1c);throw _0x16cf1c;});}return _0x21943a;})[_0x57e2('0x11')](respondWithResult(_0x555e84,0xc9))['catch'](handleError(_0x555e84,null));};exports[_0x57e2('0x10')]=function(_0x528b1e,_0x2f365d){if(_0x528b1e[_0x57e2('0x39')]['id']){delete _0x528b1e[_0x57e2('0x39')]['id'];}return db[_0x57e2('0x30')][_0x57e2('0x37')]({'where':{'id':_0x528b1e[_0x57e2('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2f365d,null))['then'](saveUpdates(_0x528b1e['body'],null))[_0x57e2('0x11')](function(_0x33569c){if(!_0x33569c)return;var _0x2d8e02=_0x33569c[_0x57e2('0x3a')]({'plain':!![]});return _0x2d8e02;})[_0x57e2('0x11')](function(_0x56e1a8){var _0x2f230d=new Redis(config[_0x57e2('0x5')]);_0x2f230d[_0x57e2('0x40')](_0x57e2('0x15'),JSON[_0x57e2('0x41')](_['pick'](_0x56e1a8,['id','name',_0x57e2('0x42')])));return _0x56e1a8;})['then'](respondWithResult(_0x2f365d,null))[_0x57e2('0x35')](handleError(_0x2f365d,null));};exports[_0x57e2('0x12')]=function(_0x178c89,_0x2caf4a){return db[_0x57e2('0x30')]['find']({'where':{'id':_0x178c89[_0x57e2('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2caf4a,null))[_0x57e2('0x11')](removeEntity(_0x2caf4a,null))[_0x57e2('0x35')](handleError(_0x2caf4a,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 5dfaaf2..5a5b58b 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 _0x7331=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','SquareProject','setMaxListeners','save'];(function(_0x44afa4,_0x5be27b){var _0xcad289=function(_0x206272){while(--_0x206272){_0x44afa4['push'](_0x44afa4['shift']());}};_0xcad289(++_0x5be27b);}(_0x7331,0xc3));var _0x1733=function(_0x40a38e,_0x2b405c){_0x40a38e=_0x40a38e-0x0;var _0x39e784=_0x7331[_0x40a38e];return _0x39e784;};'use strict';var EventEmitter=require(_0x1733('0x0'));var SquareProject=require(_0x1733('0x1'))['db'][_0x1733('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x1733('0x3')](0x0);var events={'afterCreate':_0x1733('0x4'),'afterUpdate':_0x1733('0x5'),'afterDestroy':_0x1733('0x6')};function emitEvent(_0x5d8976){return function(_0x18b614,_0x1ceead,_0x7d2558){SquareProjectEvents[_0x1733('0x7')](_0x5d8976+':'+_0x18b614['id'],_0x18b614);SquareProjectEvents[_0x1733('0x7')](_0x5d8976,_0x18b614);_0x7d2558(null);};}for(var e in events){if(events[_0x1733('0x8')](e)){var event=events[e];SquareProject[_0x1733('0x9')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0xf13a=['hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit'];(function(_0x100b96,_0x1bac2c){var _0x44bbcf=function(_0x3ed853){while(--_0x3ed853){_0x100b96['push'](_0x100b96['shift']());}};_0x44bbcf(++_0x1bac2c);}(_0xf13a,0x156));var _0xaf13=function(_0x28b0a1,_0x99bd0a){_0x28b0a1=_0x28b0a1-0x0;var _0x21470c=_0xf13a[_0x28b0a1];return _0x21470c;};'use strict';var EventEmitter=require(_0xaf13('0x0'));var SquareProject=require(_0xaf13('0x1'))['db'][_0xaf13('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xaf13('0x3')](0x0);var events={'afterCreate':_0xaf13('0x4'),'afterUpdate':_0xaf13('0x5'),'afterDestroy':_0xaf13('0x6')};function emitEvent(_0x4317a5){return function(_0xf98caf,_0x241aa2,_0x4b19eb){SquareProjectEvents['emit'](_0x4317a5+':'+_0xf98caf['id'],_0xf98caf);SquareProjectEvents[_0xaf13('0x7')](_0x4317a5,_0xf98caf);_0x4b19eb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0xaf13('0x8')](e,emitEvent(event));}}module[_0xaf13('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index e39e09e..c750b42 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 _0x8b51=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','changed','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','format','lodash'];(function(_0x900b8b,_0x126fc5){var _0x102af7=function(_0x59a023){while(--_0x59a023){_0x900b8b['push'](_0x900b8b['shift']());}};_0x102af7(++_0x126fc5);}(_0x8b51,0xef));var _0x18b5=function(_0x3f6f86,_0x39431e){_0x3f6f86=_0x3f6f86-0x0;var _0x1d6821=_0x8b51[_0x3f6f86];return _0x1d6821;};'use strict';var _=require(_0x18b5('0x0'));var util=require(_0x18b5('0x1'));var logger=require(_0x18b5('0x2'))(_0x18b5('0x3'));var moment=require(_0x18b5('0x4'));var BPromise=require(_0x18b5('0x5'));var rp=require(_0x18b5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x18b5('0x7'));var config=require(_0x18b5('0x8'));var attributes=require(_0x18b5('0x9'));module['exports']=function(_0x1ad597,_0xc69761){return _0x1ad597[_0x18b5('0xa')](_0x18b5('0xb'),attributes,{'tableName':_0x18b5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x395783,_0x21521a,_0x4eb759){if(_0x395783[_0x18b5('0xd')](_0x18b5('0xe'))){_0x395783[_0x18b5('0xf')]=moment()['format'](_0x18b5('0x10'));}if(_0x395783['changed'](_0x18b5('0x11'))){_0x395783[_0x18b5('0x12')]=moment()[_0x18b5('0x13')](_0x18b5('0x10'));}_0x4eb759(null,_0x395783);}}});}; \ No newline at end of file +var _0x493a=['changed','preproduction','savedAt','production','publishedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','square_projects'];(function(_0x5ec664,_0x4c4d9f){var _0x12e77e=function(_0x5afdb2){while(--_0x5afdb2){_0x5ec664['push'](_0x5ec664['shift']());}};_0x12e77e(++_0x4c4d9f);}(_0x493a,0x9f));var _0xa493=function(_0x5e5658,_0x5ceb37){_0x5e5658=_0x5e5658-0x0;var _0x501ff8=_0x493a[_0x5e5658];return _0x501ff8;};'use strict';var _=require(_0xa493('0x0'));var util=require(_0xa493('0x1'));var logger=require('../../config/logger')(_0xa493('0x2'));var moment=require('moment');var BPromise=require(_0xa493('0x3'));var rp=require(_0xa493('0x4'));var fs=require('fs');var path=require(_0xa493('0x5'));var rimraf=require(_0xa493('0x6'));var config=require(_0xa493('0x7'));var attributes=require(_0xa493('0x8'));module[_0xa493('0x9')]=function(_0x43c3e0,_0x4c5336){return _0x43c3e0[_0xa493('0xa')]('SquareProject',attributes,{'tableName':_0xa493('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1c6ae2,_0x5f1401,_0x5eb9cd){if(_0x1c6ae2[_0xa493('0xc')](_0xa493('0xd'))){_0x1c6ae2[_0xa493('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x1c6ae2[_0xa493('0xc')](_0xa493('0xf'))){_0x1c6ae2[_0xa493('0x10')]=moment()[_0xa493('0x11')](_0xa493('0x12'));}_0x5eb9cd(null,_0x1c6ae2);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index c0f9549..ed81815 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 _0x7923=['limit','map','include','model','info','debug','GetSquareProjects','stringify','catch','error','message','ShowSquareProject','SquareProject','find','lodash','../../mysqldb','rpc','../../config/environment','defaults','redis','./squareProject.socket','register','findAll','options','where','attributes'];(function(_0x55490b,_0x3e464b){var _0x8432cb=function(_0x1c7b6c){while(--_0x1c7b6c){_0x55490b['push'](_0x55490b['shift']());}};_0x8432cb(++_0x3e464b);}(_0x7923,0x146));var _0x3792=function(_0x2abe88,_0x1b598b){_0x2abe88=_0x2abe88-0x0;var _0x11dcd5=_0x7923[_0x2abe88];return _0x11dcd5;};'use strict';var _=require(_0x3792('0x0'));var Redis=require('ioredis');var db=require(_0x3792('0x1'))['db'];var logger=require('../../config/logger')(_0x3792('0x2'));var config=require(_0x3792('0x3'));config['redis']=_[_0x3792('0x4')](config[_0x3792('0x5')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3792('0x5')]));require(_0x3792('0x6'))[_0x3792('0x7')](socket);exports['GetSquareProjects']=function(_0x23d81a){var _0x583867=this;return new Promise(function(_0x35117b,_0x29b08a){return db['SquareProject'][_0x3792('0x8')]({'raw':_0x23d81a[_0x3792('0x9')]?_0x23d81a[_0x3792('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x23d81a[_0x3792('0x9')]?_0x23d81a['options'][_0x3792('0xa')]||null:null,'attributes':_0x23d81a[_0x3792('0x9')]?_0x23d81a['options'][_0x3792('0xb')]||null:null,'limit':_0x23d81a[_0x3792('0x9')]?_0x23d81a[_0x3792('0x9')][_0x3792('0xc')]||null:null,'include':_0x23d81a['options']?_0x23d81a[_0x3792('0x9')]['include']?_[_0x3792('0xd')](_0x23d81a[_0x3792('0x9')][_0x3792('0xe')],function(_0x566c87){return{'model':db[_0x566c87[_0x3792('0xf')]],'as':_0x566c87['as'],'attributes':_0x566c87[_0x3792('0xb')],'include':_0x566c87[_0x3792('0xe')]?_[_0x3792('0xd')](_0x566c87[_0x3792('0xe')],function(_0x187886){return{'model':db[_0x187886[_0x3792('0xf')]],'as':_0x187886['as'],'attributes':_0x187886[_0x3792('0xb')],'include':_0x187886['include']?_[_0x3792('0xd')](_0x187886[_0x3792('0xe')],function(_0x3123e3){return{'model':db[_0x3123e3[_0x3792('0xf')]],'as':_0x3123e3['as'],'attributes':_0x3123e3[_0x3792('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5cc9aa){logger[_0x3792('0x10')]('GetSquareProjects',_0x23d81a);logger[_0x3792('0x11')](_0x3792('0x12'),_0x23d81a,JSON[_0x3792('0x13')](_0x5cc9aa));_0x35117b(_0x5cc9aa);})[_0x3792('0x14')](function(_0x5c87cc){logger[_0x3792('0x15')](_0x3792('0x12'),_0x5c87cc[_0x3792('0x16')],_0x23d81a);_0x29b08a(_0x583867['error'](0x1f4,_0x5c87cc[_0x3792('0x16')]));});});};exports[_0x3792('0x17')]=function(_0x8686e3){var _0x395aab=this;return new Promise(function(_0x214350,_0x16c3be){return db[_0x3792('0x18')][_0x3792('0x19')]({'raw':_0x8686e3[_0x3792('0x9')]?_0x8686e3[_0x3792('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x8686e3[_0x3792('0x9')]?_0x8686e3['options'][_0x3792('0xa')]||null:null,'attributes':_0x8686e3[_0x3792('0x9')]?_0x8686e3[_0x3792('0x9')][_0x3792('0xb')]||null:null,'include':_0x8686e3[_0x3792('0x9')]?_0x8686e3[_0x3792('0x9')][_0x3792('0xe')]?_['map'](_0x8686e3['options'][_0x3792('0xe')],function(_0x313f16){return{'model':db[_0x313f16[_0x3792('0xf')]],'as':_0x313f16['as'],'attributes':_0x313f16[_0x3792('0xb')],'include':_0x313f16[_0x3792('0xe')]?_[_0x3792('0xd')](_0x313f16['include'],function(_0x13ba17){return{'model':db[_0x13ba17[_0x3792('0xf')]],'as':_0x13ba17['as'],'attributes':_0x13ba17[_0x3792('0xb')],'include':_0x13ba17[_0x3792('0xe')]?_[_0x3792('0xd')](_0x13ba17[_0x3792('0xe')],function(_0x5ad72c){return{'model':db[_0x5ad72c[_0x3792('0xf')]],'as':_0x5ad72c['as'],'attributes':_0x5ad72c[_0x3792('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4463c6){logger['info']('ShowSquareProject',_0x8686e3);logger[_0x3792('0x11')]('ShowSquareProject',_0x8686e3,JSON['stringify'](_0x4463c6));_0x214350(_0x4463c6);})[_0x3792('0x14')](function(_0xeb7b3){logger['error'](_0x3792('0x17'),_0xeb7b3[_0x3792('0x16')],_0x8686e3);_0x16c3be(_0x395aab[_0x3792('0x15')](0x1f4,_0xeb7b3[_0x3792('0x16')]));});});}; \ No newline at end of file +var _0x62eb=['defaults','redis','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','where','attributes','limit','include','map','model','then','info','debug','catch','error','message','ShowSquareProject','find','raw','stringify','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x50881d,_0x4e35fd){var _0x10d745=function(_0x254371){while(--_0x254371){_0x50881d['push'](_0x50881d['shift']());}};_0x10d745(++_0x4e35fd);}(_0x62eb,0x90));var _0xb62e=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x62eb[_0x17406a];return _0x1501ff;};'use strict';var _=require(_0xb62e('0x0'));var Redis=require(_0xb62e('0x1'));var db=require(_0xb62e('0x2'))['db'];var logger=require(_0xb62e('0x3'))(_0xb62e('0x4'));var config=require(_0xb62e('0x5'));config['redis']=_[_0xb62e('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb62e('0x7')]));require(_0xb62e('0x8'))[_0xb62e('0x9')](socket);exports[_0xb62e('0xa')]=function(_0x3f8530){var _0xa366e0=this;return new Promise(function(_0x2fd7f2,_0x3ca79c){return db[_0xb62e('0xb')][_0xb62e('0xc')]({'raw':_0x3f8530[_0xb62e('0xd')]?_0x3f8530[_0xb62e('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0x3f8530[_0xb62e('0xd')]?_0x3f8530['options'][_0xb62e('0xe')]||null:null,'attributes':_0x3f8530['options']?_0x3f8530['options'][_0xb62e('0xf')]||null:null,'limit':_0x3f8530[_0xb62e('0xd')]?_0x3f8530['options'][_0xb62e('0x10')]||null:null,'include':_0x3f8530['options']?_0x3f8530[_0xb62e('0xd')][_0xb62e('0x11')]?_[_0xb62e('0x12')](_0x3f8530[_0xb62e('0xd')]['include'],function(_0x7880e5){return{'model':db[_0x7880e5[_0xb62e('0x13')]],'as':_0x7880e5['as'],'attributes':_0x7880e5['attributes'],'include':_0x7880e5[_0xb62e('0x11')]?_[_0xb62e('0x12')](_0x7880e5[_0xb62e('0x11')],function(_0x36ffcd){return{'model':db[_0x36ffcd[_0xb62e('0x13')]],'as':_0x36ffcd['as'],'attributes':_0x36ffcd['attributes'],'include':_0x36ffcd['include']?_[_0xb62e('0x12')](_0x36ffcd[_0xb62e('0x11')],function(_0x349ea4){return{'model':db[_0x349ea4[_0xb62e('0x13')]],'as':_0x349ea4['as'],'attributes':_0x349ea4['attributes']};}):[]};}):[]};}):[]:[]})[_0xb62e('0x14')](function(_0x434ac8){logger[_0xb62e('0x15')](_0xb62e('0xa'),_0x3f8530);logger[_0xb62e('0x16')](_0xb62e('0xa'),_0x3f8530,JSON['stringify'](_0x434ac8));_0x2fd7f2(_0x434ac8);})[_0xb62e('0x17')](function(_0x53c13e){logger[_0xb62e('0x18')]('GetSquareProjects',_0x53c13e[_0xb62e('0x19')],_0x3f8530);_0x3ca79c(_0xa366e0['error'](0x1f4,_0x53c13e[_0xb62e('0x19')]));});});};exports[_0xb62e('0x1a')]=function(_0x29bc88){var _0x588042=this;return new Promise(function(_0x2b82df,_0x2cbe8b){return db[_0xb62e('0xb')][_0xb62e('0x1b')]({'raw':_0x29bc88[_0xb62e('0xd')]?_0x29bc88[_0xb62e('0xd')][_0xb62e('0x1c')]===undefined?!![]:![]:!![],'where':_0x29bc88['options']?_0x29bc88[_0xb62e('0xd')][_0xb62e('0xe')]||null:null,'attributes':_0x29bc88[_0xb62e('0xd')]?_0x29bc88[_0xb62e('0xd')][_0xb62e('0xf')]||null:null,'include':_0x29bc88['options']?_0x29bc88[_0xb62e('0xd')]['include']?_['map'](_0x29bc88[_0xb62e('0xd')][_0xb62e('0x11')],function(_0x4a2942){return{'model':db[_0x4a2942[_0xb62e('0x13')]],'as':_0x4a2942['as'],'attributes':_0x4a2942[_0xb62e('0xf')],'include':_0x4a2942[_0xb62e('0x11')]?_[_0xb62e('0x12')](_0x4a2942[_0xb62e('0x11')],function(_0x5cad44){return{'model':db[_0x5cad44[_0xb62e('0x13')]],'as':_0x5cad44['as'],'attributes':_0x5cad44[_0xb62e('0xf')],'include':_0x5cad44[_0xb62e('0x11')]?_['map'](_0x5cad44[_0xb62e('0x11')],function(_0x4ddded){return{'model':db[_0x4ddded[_0xb62e('0x13')]],'as':_0x4ddded['as'],'attributes':_0x4ddded[_0xb62e('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44952e){logger[_0xb62e('0x15')](_0xb62e('0x1a'),_0x29bc88);logger[_0xb62e('0x16')](_0xb62e('0x1a'),_0x29bc88,JSON[_0xb62e('0x1d')](_0x44952e));_0x2b82df(_0x44952e);})[_0xb62e('0x17')](function(_0x4941c6){logger[_0xb62e('0x18')]('ShowSquareProject',_0x4941c6[_0xb62e('0x19')],_0x29bc88);_0x2cbe8b(_0x588042[_0xb62e('0x18')](0x1f4,_0x4941c6[_0xb62e('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 7532683..4143a90 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 _0x8617=['save','remove','update','emit','removeListener','register','squareProject:','./squareProject.events'];(function(_0x2bd1ec,_0x3fe65f){var _0x2f7577=function(_0x5234fb){while(--_0x5234fb){_0x2bd1ec['push'](_0x2bd1ec['shift']());}};_0x2f7577(++_0x3fe65f);}(_0x8617,0x1af));var _0x7861=function(_0x1a144b,_0x49bc99){_0x1a144b=_0x1a144b-0x0;var _0x24bbbe=_0x8617[_0x1a144b];return _0x24bbbe;};'use strict';var SquareProjectEvents=require(_0x7861('0x0'));var events=[_0x7861('0x1'),_0x7861('0x2'),_0x7861('0x3')];function createListener(_0x2fe745,_0x3cb5c3){return function(_0x2eac96){_0x3cb5c3[_0x7861('0x4')](_0x2fe745,_0x2eac96);};}function removeListener(_0x465a7f,_0x54702c){return function(){SquareProjectEvents[_0x7861('0x5')](_0x465a7f,_0x54702c);};}exports[_0x7861('0x6')]=function(_0x11b4ef){for(var _0x59962a=0x0,_0x5dddac=events['length'];_0x59962a<_0x5dddac;_0x59962a++){var _0x10e638=events[_0x59962a];var _0x17443f=createListener(_0x7861('0x7')+_0x10e638,_0x11b4ef);SquareProjectEvents['on'](_0x10e638,_0x17443f);}}; \ No newline at end of file +var _0xb795=['register','length','squareProject:','./squareProject.events','update','emit','removeListener'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb795,0x1ca));var _0x5b79=function(_0x5d431c,_0x340df3){_0x5d431c=_0x5d431c-0x0;var _0x5453b4=_0xb795[_0x5d431c];return _0x5453b4;};'use strict';var SquareProjectEvents=require(_0x5b79('0x0'));var events=['save','remove',_0x5b79('0x1')];function createListener(_0x5e6170,_0x42cee4){return function(_0x55cb78){_0x42cee4[_0x5b79('0x2')](_0x5e6170,_0x55cb78);};}function removeListener(_0x168bbe,_0x4098b1){return function(){SquareProjectEvents[_0x5b79('0x3')](_0x168bbe,_0x4098b1);};}exports[_0x5b79('0x4')]=function(_0x16bd3d){for(var _0x136d68=0x0,_0x115bd2=events[_0x5b79('0x5')];_0x136d68<_0x115bd2;_0x136d68++){var _0x2e48bb=events[_0x136d68];var _0xe50509=createListener(_0x5b79('0x6')+_0x2e48bb,_0x16bd3d);SquareProjectEvents['on'](_0x2e48bb,_0xe50509);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index d3d7de0..3734e4b 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 _0x7fbe=['/:id','show','/:id/download','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index'];(function(_0x4556f6,_0x22d951){var _0x3cc8c7=function(_0x1afae8){while(--_0x1afae8){_0x4556f6['push'](_0x4556f6['shift']());}};_0x3cc8c7(++_0x22d951);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x14cb58,_0x214d62){_0x14cb58=_0x14cb58-0x0;var _0x5f097e=_0x7fbe[_0x14cb58];return _0x5f097e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['download']);router['post']('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x11')]);router[_0xe7fb('0x12')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x13')]);module[_0xe7fb('0x14')]=router; \ No newline at end of file +var _0x5fc3=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','show','/:id/download','download','post','create','put','update','/:id','multer','util','connect-timeout'];(function(_0x31cc43,_0x43d636){var _0xeeba3b=function(_0x36e34c){while(--_0x36e34c){_0x31cc43['push'](_0x31cc43['shift']());}};_0xeeba3b(++_0x43d636);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5ebc04,_0x14a363){_0x5ebc04=_0x5ebc04-0x0;var _0x17845c=_0x5fc3[_0x5ebc04];return _0x17845c;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')]('/',auth['isAuthenticated'](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router['delete'](_0x35fc('0x12'),auth[_0x35fc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 9f41811..a298a94 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 _0x2d17=['VIRTUAL','getDataValue','savePath','lastIndexOf','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d17,0x17e));var _0x72d1=function(_0x5d9123,_0x39e794){_0x5d9123=_0x5d9123-0x0;var _0x509220=_0x2d17[_0x5d9123];return _0x509220;};'use strict';var Sequelize=require(_0x72d1('0x0'));module[_0x72d1('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x72d1('0x2')]},'calleridname':{'type':Sequelize[_0x72d1('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x72d1('0x2')]},'priority':{'type':Sequelize[_0x72d1('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x72d1('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x72d1('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x72d1('0x2')]},'format':{'type':Sequelize[_0x72d1('0x3')],'get':function(){var _0x5b40a9='';var _0x477264=this[_0x72d1('0x4')](_0x72d1('0x5'));if(_0x477264){_0x5b40a9=_0x477264['substring'](_0x477264[_0x72d1('0x6')]('.'));}return _0x5b40a9;}}}; \ No newline at end of file +var _0xf2ca=['getDataValue','substring','sequelize','exports','STRING','VIRTUAL'];(function(_0x253e56,_0x47a7fd){var _0x12b3bd=function(_0x4dfe68){while(--_0x4dfe68){_0x253e56['push'](_0x253e56['shift']());}};_0x12b3bd(++_0x47a7fd);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x324f55,_0x2e6ca4){_0x324f55=_0x324f55-0x0;var _0x284952=_0xf2ca[_0x324f55];return _0x284952;};'use strict';var Sequelize=require(_0xaf2c('0x0'));module[_0xaf2c('0x1')]={'uniqueid':{'type':Sequelize[_0xaf2c('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xaf2c('0x2')]},'context':{'type':Sequelize[_0xaf2c('0x2')]},'extension':{'type':Sequelize[_0xaf2c('0x2')]},'priority':{'type':Sequelize[_0xaf2c('0x2')]},'accountcode':{'type':Sequelize[_0xaf2c('0x2')]},'dnid':{'type':Sequelize[_0xaf2c('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0xaf2c('0x2')]},'filename':{'type':Sequelize[_0xaf2c('0x2')]},'savePath':{'type':Sequelize[_0xaf2c('0x2')]},'format':{'type':Sequelize[_0xaf2c('0x3')],'get':function(){var _0x58351f='';var _0x37fedd=this[_0xaf2c('0x4')]('savePath');if(_0x37fedd){_0x58351f=_0x37fedd[_0xaf2c('0x5')](_0x37fedd['lastIndexOf']('.'));}return _0x58351f;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 66fbdc7..3c70bcf 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 _0x3c2b=['mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','params','keys','fields','includeAll','catch','body','download','uniqueid','savePath','format','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','filename','extname','unlink','SquareRecording\x20not\x20found','send','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x4c446e,_0x19a934){var _0x367191=function(_0x42a399){while(--_0x42a399){_0x4c446e['push'](_0x4c446e['shift']());}};_0x367191(++_0x19a934);}(_0x3c2b,0x16f));var _0xb3c2=function(_0x1a3884,_0x25d611){_0x1a3884=_0x1a3884-0x0;var _0xdcdc56=_0x3c2b[_0x1a3884];return _0xdcdc56;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb3c2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb3c2('0x1'));var rp=require(_0xb3c2('0x2'));var moment=require(_0xb3c2('0x3'));var BPromise=require(_0xb3c2('0x4'));var Mustache=require(_0xb3c2('0x5'));var util=require(_0xb3c2('0x6'));var path=require(_0xb3c2('0x7'));var sox=require(_0xb3c2('0x8'));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(_0xb3c2('0x9'));var crypto=require(_0xb3c2('0xa'));var jsforce=require(_0xb3c2('0xb'));var deskjs=require(_0xb3c2('0xc'));var toCsv=require(_0xb3c2('0xd'));var querystring=require(_0xb3c2('0xe'));var Papa=require('papaparse');var Redis=require(_0xb3c2('0xf'));var authService=require(_0xb3c2('0x10'));var qs=require(_0xb3c2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb3c2('0x12'));var utils=require('../../config/utils');var config=require(_0xb3c2('0x13'));var licenseUtil=require(_0xb3c2('0x14'));var db=require(_0xb3c2('0x15'))['db'];function respondWithStatusCode(_0xc6fe5b,_0x1547b3){_0x1547b3=_0x1547b3||0xcc;return function(_0x50704b){if(_0x50704b){return _0xc6fe5b['sendStatus'](_0x1547b3);}return _0xc6fe5b[_0xb3c2('0x16')](_0x1547b3)[_0xb3c2('0x17')]();};}function respondWithResult(_0x2987d4,_0xf3e051){_0xf3e051=_0xf3e051||0xc8;return function(_0x239631){if(_0x239631){return _0x2987d4[_0xb3c2('0x16')](_0xf3e051)[_0xb3c2('0x18')](_0x239631);}};}function respondWithFilteredResult(_0x5929cf,_0x43816f){return function(_0x2454dd){if(_0x2454dd){var _0x3f50e8=typeof _0x43816f[_0xb3c2('0x19')]===_0xb3c2('0x1a')&&typeof _0x43816f[_0xb3c2('0x1b')]===_0xb3c2('0x1a');var _0x581bb0=_0x2454dd[_0xb3c2('0x1c')];var _0x4d208e=_0x3f50e8?0x0:_0x43816f[_0xb3c2('0x19')];var _0x216966=_0x3f50e8?_0x2454dd[_0xb3c2('0x1c')]:_0x43816f['offset']+_0x43816f[_0xb3c2('0x1b')];var _0x2ecc44;if(_0x216966>=_0x581bb0){_0x216966=_0x581bb0;_0x2ecc44=0xc8;}else{_0x2ecc44=0xce;}_0x5929cf[_0xb3c2('0x16')](_0x2ecc44);return _0x5929cf[_0xb3c2('0x1d')](_0xb3c2('0x1e'),_0x4d208e+'-'+_0x216966+'/'+_0x581bb0)[_0xb3c2('0x18')](_0x2454dd);}return null;};}function patchUpdates(_0x11e122){return function(_0x2d70d6){try{jsonpatch['apply'](_0x2d70d6,_0x11e122,!![]);}catch(_0x4f0b1d){return BPromise[_0xb3c2('0x1f')](_0x4f0b1d);}return _0x2d70d6[_0xb3c2('0x20')]();};}function saveUpdates(_0x1a0bcc,_0x19c24b){return function(_0x4a0652){if(_0x4a0652){return _0x4a0652[_0xb3c2('0x21')](_0x1a0bcc)[_0xb3c2('0x22')](function(_0x2a72c5){return _0x2a72c5;});}return null;};}function removeEntity(_0x2fffe6,_0x239c1d){return function(_0x73eb48){if(_0x73eb48){return _0x73eb48[_0xb3c2('0x23')]()['then'](function(){_0x2fffe6[_0xb3c2('0x16')](0xcc)[_0xb3c2('0x17')]();});}};}function handleEntityNotFound(_0x574472,_0x17d17e){return function(_0x45d787){if(!_0x45d787){_0x574472[_0xb3c2('0x24')](0x194);}return _0x45d787;};}function handleError(_0x26d608,_0x1745e3){_0x1745e3=_0x1745e3||0x1f4;return function(_0x306fda){logger[_0xb3c2('0x25')](_0x306fda[_0xb3c2('0x26')]);if(_0x306fda[_0xb3c2('0x27')]){delete _0x306fda['name'];}_0x26d608[_0xb3c2('0x16')](_0x1745e3)['send'](_0x306fda);};}exports[_0xb3c2('0x28')]=function(_0x28377c,_0xc87ee){var _0x3034a6={},_0x47fbb1={},_0xe0542f={'count':0x0,'rows':[]};var _0x5641b5=_[_0xb3c2('0x29')](db[_0xb3c2('0x2a')][_0xb3c2('0x2b')],function(_0x36f1bf){return{'name':_0x36f1bf[_0xb3c2('0x2c')],'type':_0x36f1bf[_0xb3c2('0x2d')][_0xb3c2('0x2e')]};});_0x47fbb1[_0xb3c2('0x2f')]=_[_0xb3c2('0x29')](_0x5641b5,_0xb3c2('0x27'));_0x47fbb1[_0xb3c2('0x30')]=_['keys'](_0x28377c['query']);_0x47fbb1[_0xb3c2('0x31')]=_[_0xb3c2('0x32')](_0x47fbb1[_0xb3c2('0x2f')],_0x47fbb1[_0xb3c2('0x30')]);_0x3034a6[_0xb3c2('0x33')]=_[_0xb3c2('0x32')](_0x47fbb1[_0xb3c2('0x2f')],qs['fields'](_0x28377c[_0xb3c2('0x30')]['fields']));_0x3034a6[_0xb3c2('0x33')]=_0x3034a6[_0xb3c2('0x33')][_0xb3c2('0x34')]?_0x3034a6[_0xb3c2('0x33')]:_0x47fbb1[_0xb3c2('0x2f')];if(!_0x28377c[_0xb3c2('0x30')][_0xb3c2('0x35')](_0xb3c2('0x36'))){_0x3034a6['limit']=qs[_0xb3c2('0x1b')](_0x28377c['query'][_0xb3c2('0x1b')]);_0x3034a6[_0xb3c2('0x19')]=qs[_0xb3c2('0x19')](_0x28377c[_0xb3c2('0x30')][_0xb3c2('0x19')]);}_0x3034a6[_0xb3c2('0x37')]=qs['sort'](_0x28377c[_0xb3c2('0x30')][_0xb3c2('0x38')]);_0x3034a6[_0xb3c2('0x39')]=qs[_0xb3c2('0x31')](_[_0xb3c2('0x3a')](_0x28377c['query'],_0x47fbb1[_0xb3c2('0x31')]),_0x5641b5);if(_0x28377c[_0xb3c2('0x30')][_0xb3c2('0x3b')]){_0x3034a6[_0xb3c2('0x39')]=_[_0xb3c2('0x3c')](_0x3034a6['where'],{'$or':_[_0xb3c2('0x29')](_0x5641b5,function(_0x62ea2b){if(_0x62ea2b[_0xb3c2('0x2d')]!=='VIRTUAL'){var _0x424ded={};_0x424ded[_0x62ea2b[_0xb3c2('0x27')]]={'$like':'%'+_0x28377c['query'][_0xb3c2('0x3b')]+'%'};return _0x424ded;}})});}_0x3034a6=_[_0xb3c2('0x3c')]({},_0x3034a6,_0x28377c[_0xb3c2('0x3d')]);var _0x3db9c8={'where':_0x3034a6[_0xb3c2('0x39')]};return db[_0xb3c2('0x2a')][_0xb3c2('0x1c')](_0x3db9c8)['then'](function(_0xd26a23){_0xe0542f[_0xb3c2('0x1c')]=_0xd26a23;if(_0x28377c[_0xb3c2('0x30')]['includeAll']){_0x3034a6[_0xb3c2('0x3e')]=[{'all':!![]}];}return db[_0xb3c2('0x2a')][_0xb3c2('0x3f')](_0x3034a6);})[_0xb3c2('0x22')](function(_0x331aad){_0xe0542f[_0xb3c2('0x40')]=_0x331aad;return _0xe0542f;})['then'](respondWithFilteredResult(_0xc87ee,_0x3034a6))['catch'](handleError(_0xc87ee,null));};exports['show']=function(_0x6075b3,_0x54d030){var _0x294506={'raw':!![],'where':{'id':_0x6075b3[_0xb3c2('0x41')]['id']}},_0x5c774f={};_0x5c774f[_0xb3c2('0x2f')]=_[_0xb3c2('0x42')](db['SquareRecording'][_0xb3c2('0x2b')]);_0x5c774f[_0xb3c2('0x30')]=_[_0xb3c2('0x42')](_0x6075b3['query']);_0x5c774f['filters']=_[_0xb3c2('0x32')](_0x5c774f[_0xb3c2('0x2f')],_0x5c774f['query']);_0x294506[_0xb3c2('0x33')]=_['intersection'](_0x5c774f[_0xb3c2('0x2f')],qs[_0xb3c2('0x43')](_0x6075b3['query'][_0xb3c2('0x43')]));_0x294506[_0xb3c2('0x33')]=_0x294506[_0xb3c2('0x33')]['length']?_0x294506[_0xb3c2('0x33')]:_0x5c774f['model'];if(_0x6075b3['query'][_0xb3c2('0x44')]){_0x294506[_0xb3c2('0x3e')]=[{'all':!![]}];}_0x294506=_[_0xb3c2('0x3c')]({},_0x294506,_0x6075b3['options']);return db['SquareRecording']['find'](_0x294506)[_0xb3c2('0x22')](handleEntityNotFound(_0x54d030,null))[_0xb3c2('0x22')](respondWithResult(_0x54d030,null))[_0xb3c2('0x45')](handleError(_0x54d030,null));};exports['create']=function(_0x2ce548,_0x5a9a29){return db[_0xb3c2('0x2a')]['create'](_0x2ce548['body'],{})[_0xb3c2('0x22')](respondWithResult(_0x5a9a29,0xc9))[_0xb3c2('0x45')](handleError(_0x5a9a29,null));};exports[_0xb3c2('0x21')]=function(_0x97c476,_0x1d799d){if(_0x97c476[_0xb3c2('0x46')]['id']){delete _0x97c476[_0xb3c2('0x46')]['id'];}return db[_0xb3c2('0x2a')]['find']({'where':{'id':_0x97c476['params']['id']}})[_0xb3c2('0x22')](handleEntityNotFound(_0x1d799d,null))[_0xb3c2('0x22')](saveUpdates(_0x97c476['body'],null))['then'](respondWithResult(_0x1d799d,null))[_0xb3c2('0x45')](handleError(_0x1d799d,null));};exports[_0xb3c2('0x47')]=function(_0x355c25,_0x272e42,_0x52f566){var _0x1ff266=require('../../components/encryptor');var _0x32335e=![];var _0x5f5123={};if(_0x355c25[_0xb3c2('0x30')][_0xb3c2('0x2d')]&&_0x355c25[_0xb3c2('0x30')][_0xb3c2('0x2d')]===_0xb3c2('0x48')){_0x5f5123[_0xb3c2('0x48')]=_0x355c25[_0xb3c2('0x41')]['id'];}else{_0x5f5123['id']=_0x355c25[_0xb3c2('0x41')]['id'];}return db[_0xb3c2('0x2a')]['find']({'where':_0x5f5123,'attributes':['id','savePath','filename'],'raw':!![]})[_0xb3c2('0x22')](handleEntityNotFound(_0x272e42,null))['then'](function(_0x244561){if(_0x244561){var _0xf59dee=_0x244561[_0xb3c2('0x49')];var _0x3f8fd3=util[_0xb3c2('0x4a')]('%s.cypher',_0xf59dee);if(fs[_0xb3c2('0x4b')](_0x3f8fd3)){_0x32335e=!![];return _0x1ff266[_0xb3c2('0x4c')](_0x3f8fd3,_0xf59dee,config[_0xb3c2('0x4d')][_0xb3c2('0x4e')])[_0xb3c2('0x22')](function(){return _0x244561;});}return _0x244561;}})[_0xb3c2('0x22')](function(_0x5e0d67){if(_0x5e0d67){var _0xde8b12=_0x5e0d67[_0xb3c2('0x49')];if(!fs[_0xb3c2('0x4b')](_0xde8b12)){throw new db[(_0xb3c2('0x4f'))][(_0xb3c2('0x50'))]('SquareRecording\x20not\x20found');}if(_0x5e0d67[_0xb3c2('0x51')]){return _0x272e42[_0xb3c2('0x47')](_0xde8b12,_0x5e0d67['filename']+path[_0xb3c2('0x52')](_0xde8b12),function(){if(_0x32335e){fs['unlink'](_0xde8b12);}});}else{return _0x272e42[_0xb3c2('0x47')](_0xde8b12,function(_0x51b5da){if(_0x32335e){fs[_0xb3c2('0x53')](_0xde8b12);}});}}})[_0xb3c2('0x45')](function(_0x2e5fcb){if(_0x2e5fcb['message']===_0xb3c2('0x54')){_0x272e42[_0xb3c2('0x16')](0x194)[_0xb3c2('0x55')](_0xb3c2('0x56'));}else{return handleError(_0x272e42,null);}});};exports['destroy']=function(_0x296599,_0x5d0aef){return db[_0xb3c2('0x2a')]['find']({'where':{'id':_0x296599['params']['id']}})[_0xb3c2('0x22')](function(_0x29426b){if(_[_0xb3c2('0x57')](_0x29426b)){throw new ReferenceError('Entity\x20not\x20found');}return _0x29426b;})[_0xb3c2('0x22')](function(_0x26f230){var _0x3446b0=_0x26f230[_0xb3c2('0x49')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x3446b0);if(!_['isNil'](_0x26f230[_0xb3c2('0x49')])&&fs[_0xb3c2('0x4b')](_0x3446b0)){logger[_0xb3c2('0x58')](_0xb3c2('0x59')+_0x3446b0+_0xb3c2('0x5a'));fs['unlinkSync'](_0x3446b0);}_0x3446b0=_0x3446b0+_0xb3c2('0x5b');if(!_[_0xb3c2('0x57')](_0x26f230[_0xb3c2('0x49')])&&fs[_0xb3c2('0x4b')](_0x3446b0)){logger[_0xb3c2('0x58')]('File:\x20\x22'+_0x3446b0+_0xb3c2('0x5a'));fs[_0xb3c2('0x5c')](_0x3446b0);}return _0x26f230;})[_0xb3c2('0x22')](function(_0x5355d9){if(!_0x5355d9)throw new InternalError();return _0x5355d9['destroy']();})[_0xb3c2('0x22')](function(){_0x5d0aef[_0xb3c2('0x16')](0xcc)[_0xb3c2('0x17')]();})[_0xb3c2('0x45')](handleError(_0x5d0aef,null));}; \ No newline at end of file +var _0x1edd=['name','send','index','map','SquareRecording','fieldName','type','key','model','query','keys','attributes','fields','length','sort','filters','filter','where','merge','includeAll','include','rows','catch','show','params','rawAttributes','intersection','options','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','eml-format','rimraf','zip-dir','request-promise','bluebird','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','reject','save','update','destroy','then','stack'];(function(_0x5b4269,_0x34fb22){var _0x3ef12a=function(_0x5c2667){while(--_0x5c2667){_0x5b4269['push'](_0x5b4269['shift']());}};_0x3ef12a(++_0x34fb22);}(_0x1edd,0x1b7));var _0xd1ed=function(_0x4e4519,_0x392ae){_0x4e4519=_0x4e4519-0x0;var _0x340044=_0x1edd[_0x4e4519];return _0x340044;};'use strict';var emlformat=require(_0xd1ed('0x0'));var rimraf=require(_0xd1ed('0x1'));var zipdir=require(_0xd1ed('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd1ed('0x3'));var moment=require('moment');var BPromise=require(_0xd1ed('0x4'));var Mustache=require('mustache');var util=require(_0xd1ed('0x5'));var path=require(_0xd1ed('0x6'));var sox=require(_0xd1ed('0x7'));var csv=require('to-csv');var ejs=require(_0xd1ed('0x8'));var fs=require('fs');var fs_extra=require(_0xd1ed('0x9'));var _=require(_0xd1ed('0xa'));var squel=require('squel');var crypto=require(_0xd1ed('0xb'));var jsforce=require(_0xd1ed('0xc'));var deskjs=require(_0xd1ed('0xd'));var toCsv=require(_0xd1ed('0xe'));var querystring=require(_0xd1ed('0xf'));var Papa=require('papaparse');var Redis=require(_0xd1ed('0x10'));var authService=require(_0xd1ed('0x11'));var qs=require(_0xd1ed('0x12'));var as=require(_0xd1ed('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd1ed('0x14'))(_0xd1ed('0x15'));var utils=require(_0xd1ed('0x16'));var config=require(_0xd1ed('0x17'));var licenseUtil=require(_0xd1ed('0x18'));var db=require(_0xd1ed('0x19'))['db'];function respondWithStatusCode(_0xf511a3,_0x304013){_0x304013=_0x304013||0xcc;return function(_0x21266b){if(_0x21266b){return _0xf511a3[_0xd1ed('0x1a')](_0x304013);}return _0xf511a3[_0xd1ed('0x1b')](_0x304013)[_0xd1ed('0x1c')]();};}function respondWithResult(_0x4c1fc0,_0x51979f){_0x51979f=_0x51979f||0xc8;return function(_0x42288c){if(_0x42288c){return _0x4c1fc0[_0xd1ed('0x1b')](_0x51979f)[_0xd1ed('0x1d')](_0x42288c);}};}function respondWithFilteredResult(_0xb465fb,_0x50b4dd){return function(_0x12b363){if(_0x12b363){var _0xbefd=typeof _0x50b4dd['offset']===_0xd1ed('0x1e')&&typeof _0x50b4dd[_0xd1ed('0x1f')]===_0xd1ed('0x1e');var _0x3c7f31=_0x12b363['count'];var _0xc24939=_0xbefd?0x0:_0x50b4dd[_0xd1ed('0x20')];var _0x504f63=_0xbefd?_0x12b363[_0xd1ed('0x21')]:_0x50b4dd['offset']+_0x50b4dd[_0xd1ed('0x1f')];var _0x4f278f;if(_0x504f63>=_0x3c7f31){_0x504f63=_0x3c7f31;_0x4f278f=0xc8;}else{_0x4f278f=0xce;}_0xb465fb['status'](_0x4f278f);return _0xb465fb['set'](_0xd1ed('0x22'),_0xc24939+'-'+_0x504f63+'/'+_0x3c7f31)[_0xd1ed('0x1d')](_0x12b363);}return null;};}function patchUpdates(_0x507830){return function(_0x274151){try{jsonpatch['apply'](_0x274151,_0x507830,!![]);}catch(_0x5b4902){return BPromise[_0xd1ed('0x23')](_0x5b4902);}return _0x274151[_0xd1ed('0x24')]();};}function saveUpdates(_0x4a64a4,_0x4a503d){return function(_0x53345e){if(_0x53345e){return _0x53345e[_0xd1ed('0x25')](_0x4a64a4)['then'](function(_0x4cc65b){return _0x4cc65b;});}return null;};}function removeEntity(_0x13d542,_0xedf6e){return function(_0x69c03a){if(_0x69c03a){return _0x69c03a[_0xd1ed('0x26')]()[_0xd1ed('0x27')](function(){_0x13d542['status'](0xcc)[_0xd1ed('0x1c')]();});}};}function handleEntityNotFound(_0x3c7f45,_0x38ed60){return function(_0x1b338b){if(!_0x1b338b){_0x3c7f45[_0xd1ed('0x1a')](0x194);}return _0x1b338b;};}function handleError(_0x4b56e4,_0x1f0d6b){_0x1f0d6b=_0x1f0d6b||0x1f4;return function(_0x30a3d5){logger['error'](_0x30a3d5[_0xd1ed('0x28')]);if(_0x30a3d5[_0xd1ed('0x29')]){delete _0x30a3d5[_0xd1ed('0x29')];}_0x4b56e4['status'](_0x1f0d6b)[_0xd1ed('0x2a')](_0x30a3d5);};}exports[_0xd1ed('0x2b')]=function(_0x110655,_0x273a3a){var _0x475cfb={},_0x11cd77={},_0x188026={'count':0x0,'rows':[]};var _0x5ab68a=_[_0xd1ed('0x2c')](db[_0xd1ed('0x2d')]['rawAttributes'],function(_0x37a26d){return{'name':_0x37a26d[_0xd1ed('0x2e')],'type':_0x37a26d[_0xd1ed('0x2f')][_0xd1ed('0x30')]};});_0x11cd77[_0xd1ed('0x31')]=_[_0xd1ed('0x2c')](_0x5ab68a,_0xd1ed('0x29'));_0x11cd77[_0xd1ed('0x32')]=_[_0xd1ed('0x33')](_0x110655['query']);_0x11cd77['filters']=_['intersection'](_0x11cd77['model'],_0x11cd77[_0xd1ed('0x32')]);_0x475cfb[_0xd1ed('0x34')]=_['intersection'](_0x11cd77[_0xd1ed('0x31')],qs[_0xd1ed('0x35')](_0x110655[_0xd1ed('0x32')][_0xd1ed('0x35')]));_0x475cfb[_0xd1ed('0x34')]=_0x475cfb['attributes'][_0xd1ed('0x36')]?_0x475cfb['attributes']:_0x11cd77[_0xd1ed('0x31')];if(!_0x110655['query']['hasOwnProperty']('nolimit')){_0x475cfb[_0xd1ed('0x1f')]=qs[_0xd1ed('0x1f')](_0x110655[_0xd1ed('0x32')]['limit']);_0x475cfb[_0xd1ed('0x20')]=qs[_0xd1ed('0x20')](_0x110655['query'][_0xd1ed('0x20')]);}_0x475cfb['order']=qs['sort'](_0x110655['query'][_0xd1ed('0x37')]);_0x475cfb['where']=qs[_0xd1ed('0x38')](_['pick'](_0x110655[_0xd1ed('0x32')],_0x11cd77[_0xd1ed('0x38')]),_0x5ab68a);if(_0x110655[_0xd1ed('0x32')][_0xd1ed('0x39')]){_0x475cfb[_0xd1ed('0x3a')]=_[_0xd1ed('0x3b')](_0x475cfb[_0xd1ed('0x3a')],{'$or':_[_0xd1ed('0x2c')](_0x5ab68a,function(_0xd0898e){if(_0xd0898e['type']!=='VIRTUAL'){var _0x431129={};_0x431129[_0xd0898e['name']]={'$like':'%'+_0x110655['query'][_0xd1ed('0x39')]+'%'};return _0x431129;}})});}_0x475cfb=_[_0xd1ed('0x3b')]({},_0x475cfb,_0x110655['options']);var _0x50a927={'where':_0x475cfb[_0xd1ed('0x3a')]};return db[_0xd1ed('0x2d')][_0xd1ed('0x21')](_0x50a927)[_0xd1ed('0x27')](function(_0x2c6646){_0x188026[_0xd1ed('0x21')]=_0x2c6646;if(_0x110655[_0xd1ed('0x32')][_0xd1ed('0x3c')]){_0x475cfb[_0xd1ed('0x3d')]=[{'all':!![]}];}return db[_0xd1ed('0x2d')]['findAll'](_0x475cfb);})[_0xd1ed('0x27')](function(_0x672afd){_0x188026[_0xd1ed('0x3e')]=_0x672afd;return _0x188026;})[_0xd1ed('0x27')](respondWithFilteredResult(_0x273a3a,_0x475cfb))[_0xd1ed('0x3f')](handleError(_0x273a3a,null));};exports[_0xd1ed('0x40')]=function(_0x217066,_0x11319e){var _0x30ae8b={'raw':!![],'where':{'id':_0x217066[_0xd1ed('0x41')]['id']}},_0x426778={};_0x426778[_0xd1ed('0x31')]=_[_0xd1ed('0x33')](db[_0xd1ed('0x2d')][_0xd1ed('0x42')]);_0x426778[_0xd1ed('0x32')]=_['keys'](_0x217066[_0xd1ed('0x32')]);_0x426778[_0xd1ed('0x38')]=_['intersection'](_0x426778['model'],_0x426778[_0xd1ed('0x32')]);_0x30ae8b[_0xd1ed('0x34')]=_[_0xd1ed('0x43')](_0x426778['model'],qs[_0xd1ed('0x35')](_0x217066[_0xd1ed('0x32')]['fields']));_0x30ae8b[_0xd1ed('0x34')]=_0x30ae8b['attributes'][_0xd1ed('0x36')]?_0x30ae8b[_0xd1ed('0x34')]:_0x426778['model'];if(_0x217066[_0xd1ed('0x32')][_0xd1ed('0x3c')]){_0x30ae8b['include']=[{'all':!![]}];}_0x30ae8b=_[_0xd1ed('0x3b')]({},_0x30ae8b,_0x217066[_0xd1ed('0x44')]);return db[_0xd1ed('0x2d')][_0xd1ed('0x45')](_0x30ae8b)['then'](handleEntityNotFound(_0x11319e,null))[_0xd1ed('0x27')](respondWithResult(_0x11319e,null))[_0xd1ed('0x3f')](handleError(_0x11319e,null));};exports[_0xd1ed('0x46')]=function(_0x325df3,_0x16b762){return db[_0xd1ed('0x2d')][_0xd1ed('0x46')](_0x325df3[_0xd1ed('0x47')],{})['then'](respondWithResult(_0x16b762,0xc9))['catch'](handleError(_0x16b762,null));};exports[_0xd1ed('0x25')]=function(_0x4240cf,_0x447e0f){if(_0x4240cf[_0xd1ed('0x47')]['id']){delete _0x4240cf[_0xd1ed('0x47')]['id'];}return db['SquareRecording'][_0xd1ed('0x45')]({'where':{'id':_0x4240cf['params']['id']}})[_0xd1ed('0x27')](handleEntityNotFound(_0x447e0f,null))[_0xd1ed('0x27')](saveUpdates(_0x4240cf[_0xd1ed('0x47')],null))['then'](respondWithResult(_0x447e0f,null))[_0xd1ed('0x3f')](handleError(_0x447e0f,null));};exports[_0xd1ed('0x48')]=function(_0x4caf32,_0x4be6f3,_0x50d58d){var _0x1be565=require(_0xd1ed('0x49'));var _0x317b3e=![];var _0x1f98ef={};if(_0x4caf32[_0xd1ed('0x32')]['type']&&_0x4caf32[_0xd1ed('0x32')]['type']===_0xd1ed('0x4a')){_0x1f98ef[_0xd1ed('0x4a')]=_0x4caf32[_0xd1ed('0x41')]['id'];}else{_0x1f98ef['id']=_0x4caf32[_0xd1ed('0x41')]['id'];}return db[_0xd1ed('0x2d')][_0xd1ed('0x45')]({'where':_0x1f98ef,'attributes':['id',_0xd1ed('0x4b'),_0xd1ed('0x4c')],'raw':!![]})[_0xd1ed('0x27')](handleEntityNotFound(_0x4be6f3,null))['then'](function(_0x3a363c){if(_0x3a363c){var _0x484ef1=_0x3a363c['savePath'];var _0x4a1db4=util[_0xd1ed('0x4d')](_0xd1ed('0x4e'),_0x484ef1);if(fs[_0xd1ed('0x4f')](_0x4a1db4)){_0x317b3e=!![];return _0x1be565[_0xd1ed('0x50')](_0x4a1db4,_0x484ef1,config[_0xd1ed('0x51')]['recording'])[_0xd1ed('0x27')](function(){return _0x3a363c;});}return _0x3a363c;}})[_0xd1ed('0x27')](function(_0x4bcd40){if(_0x4bcd40){var _0x1fa4a2=_0x4bcd40[_0xd1ed('0x4b')];if(!fs[_0xd1ed('0x4f')](_0x1fa4a2)){throw new db[(_0xd1ed('0x52'))][(_0xd1ed('0x53'))](_0xd1ed('0x54'));}if(_0x4bcd40[_0xd1ed('0x4c')]){return _0x4be6f3[_0xd1ed('0x48')](_0x1fa4a2,_0x4bcd40[_0xd1ed('0x4c')]+path['extname'](_0x1fa4a2),function(){if(_0x317b3e){fs[_0xd1ed('0x55')](_0x1fa4a2);}});}else{return _0x4be6f3['download'](_0x1fa4a2,function(_0x2df66c){if(_0x317b3e){fs[_0xd1ed('0x55')](_0x1fa4a2);}});}}})[_0xd1ed('0x3f')](function(_0x3f50c5){if(_0x3f50c5[_0xd1ed('0x56')]===_0xd1ed('0x54')){_0x4be6f3['status'](0x194)['send'](_0xd1ed('0x57'));}else{return handleError(_0x4be6f3,null);}});};exports[_0xd1ed('0x26')]=function(_0x55e2b8,_0x212bd9){return db[_0xd1ed('0x2d')][_0xd1ed('0x45')]({'where':{'id':_0x55e2b8[_0xd1ed('0x41')]['id']}})[_0xd1ed('0x27')](function(_0x389584){if(_['isNil'](_0x389584)){throw new ReferenceError(_0xd1ed('0x58'));}return _0x389584;})[_0xd1ed('0x27')](function(_0xe9a53){var _0x4837aa=_0xe9a53[_0xd1ed('0x4b')];logger[_0xd1ed('0x59')](_0xd1ed('0x5a'),_0x4837aa);if(!_['isNil'](_0xe9a53['savePath'])&&fs['existsSync'](_0x4837aa)){logger[_0xd1ed('0x59')](_0xd1ed('0x5b')+_0x4837aa+_0xd1ed('0x5c'));fs[_0xd1ed('0x5d')](_0x4837aa);}_0x4837aa=_0x4837aa+_0xd1ed('0x5e');if(!_[_0xd1ed('0x5f')](_0xe9a53['savePath'])&&fs[_0xd1ed('0x4f')](_0x4837aa)){logger[_0xd1ed('0x59')](_0xd1ed('0x5b')+_0x4837aa+_0xd1ed('0x5c'));fs['unlinkSync'](_0x4837aa);}return _0xe9a53;})[_0xd1ed('0x27')](function(_0x4a1b5e){if(!_0x4a1b5e)throw new InternalError();return _0x4a1b5e['destroy']();})[_0xd1ed('0x27')](function(){_0x212bd9[_0xd1ed('0x1b')](0xcc)[_0xd1ed('0x1c')]();})['catch'](handleError(_0x212bd9,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 6618159..fad2788 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 _0x4279=['moment','bluebird','request-promise','path','../../config/environment','exports','define','SquareRecording','square_recordings','util','../../config/logger'];(function(_0x531e48,_0x4bb96b){var _0x202971=function(_0x403bf5){while(--_0x403bf5){_0x531e48['push'](_0x531e48['shift']());}};_0x202971(++_0x4bb96b);}(_0x4279,0x8d));var _0x9427=function(_0x18b8f2,_0x3d36d8){_0x18b8f2=_0x18b8f2-0x0;var _0x52ab44=_0x4279[_0x18b8f2];return _0x52ab44;};'use strict';var _=require('lodash');var util=require(_0x9427('0x0'));var logger=require(_0x9427('0x1'))('api');var moment=require(_0x9427('0x2'));var BPromise=require(_0x9427('0x3'));var rp=require(_0x9427('0x4'));var fs=require('fs');var path=require(_0x9427('0x5'));var rimraf=require('rimraf');var config=require(_0x9427('0x6'));var attributes=require('./squareRecording.attributes');module[_0x9427('0x7')]=function(_0x2a0b3e,_0x5e9d1e){return _0x2a0b3e[_0x9427('0x8')](_0x9427('0x9'),attributes,{'tableName':_0x9427('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b77=['../../config/environment','./squareRecording.attributes','exports','define','square_recordings','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2b16bb,_0x49b2bd){var _0x1c89e6=function(_0x468001){while(--_0x468001){_0x2b16bb['push'](_0x2b16bb['shift']());}};_0x1c89e6(++_0x49b2bd);}(_0x7b77,0x179));var _0x77b7=function(_0xf84870,_0x4dc38f){_0xf84870=_0xf84870-0x0;var _0x4541a4=_0x7b77[_0xf84870];return _0x4541a4;};'use strict';var _=require(_0x77b7('0x0'));var util=require(_0x77b7('0x1'));var logger=require(_0x77b7('0x2'))(_0x77b7('0x3'));var moment=require('moment');var BPromise=require(_0x77b7('0x4'));var rp=require(_0x77b7('0x5'));var fs=require('fs');var path=require(_0x77b7('0x6'));var rimraf=require('rimraf');var config=require(_0x77b7('0x7'));var attributes=require(_0x77b7('0x8'));module[_0x77b7('0x9')]=function(_0x3d97f0,_0x4556c1){return _0x3d97f0[_0x77b7('0xa')]('SquareRecording',attributes,{'tableName':_0x77b7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 3396416..4fcc4a2 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 _0x3b0c=['SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareRecording','SquareRecording','body','options','raw','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x26bc61,_0x36840d){var _0x249aff=function(_0x2bd42c){while(--_0x2bd42c){_0x26bc61['push'](_0x26bc61['shift']());}};_0x249aff(++_0x36840d);}(_0x3b0c,0x113));var _0xc3b0=function(_0xca8230,_0xbcaeff){_0xca8230=_0xca8230-0x0;var _0x330cf5=_0x3b0c[_0xca8230];return _0x330cf5;};'use strict';var _=require('lodash');var util=require(_0xc3b0('0x0'));var moment=require('moment');var BPromise=require(_0xc3b0('0x1'));var rs=require(_0xc3b0('0x2'));var fs=require('fs');var Redis=require(_0xc3b0('0x3'));var db=require(_0xc3b0('0x4'))['db'];var utils=require(_0xc3b0('0x5'));var logger=require(_0xc3b0('0x6'))(_0xc3b0('0x7'));var config=require(_0xc3b0('0x8'));var jayson=require(_0xc3b0('0x9'));var client=jayson[_0xc3b0('0xa')][_0xc3b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6a350f,_0x11c96a,_0x117d47){return new BPromise(function(_0x1565ab,_0x3e44f1){return client[_0xc3b0('0xc')](_0x6a350f,_0x117d47)[_0xc3b0('0xd')](function(_0x14b604){logger[_0xc3b0('0xe')](_0xc3b0('0xf'),_0x11c96a,_0xc3b0('0x10'));logger[_0xc3b0('0x11')](_0xc3b0('0x12'),_0x11c96a,_0xc3b0('0x10'),JSON[_0xc3b0('0x13')](_0x14b604));if(_0x14b604[_0xc3b0('0x14')]){if(_0x14b604['error'][_0xc3b0('0x15')]===0x1f4){logger['error'](_0xc3b0('0xf'),_0x11c96a,_0x14b604[_0xc3b0('0x14')][_0xc3b0('0x16')]);return _0x3e44f1(_0x14b604[_0xc3b0('0x14')][_0xc3b0('0x16')]);}logger[_0xc3b0('0x14')](_0xc3b0('0xf'),_0x11c96a,_0x14b604[_0xc3b0('0x14')][_0xc3b0('0x16')]);return _0x1565ab(_0x14b604[_0xc3b0('0x14')]['message']);}else{logger['info']('SquareRecording,\x20%s,\x20%s',_0x11c96a,_0xc3b0('0x10'));_0x1565ab(_0x14b604['result'][_0xc3b0('0x16')]);}})[_0xc3b0('0x17')](function(_0xb74759){logger[_0xc3b0('0x14')](_0xc3b0('0xf'),_0x11c96a,_0xb74759);_0x3e44f1(_0xb74759);});});}exports[_0xc3b0('0x18')]=function(_0x57697a){var _0x433c14=this;return new Promise(function(_0x32410b,_0x2be841){return db[_0xc3b0('0x19')]['create'](_0x57697a[_0xc3b0('0x1a')],{'raw':_0x57697a[_0xc3b0('0x1b')]?_0x57697a[_0xc3b0('0x1b')][_0xc3b0('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x2b0118){logger[_0xc3b0('0xe')](_0xc3b0('0x18'),_0x57697a);logger[_0xc3b0('0x11')](_0xc3b0('0x18'),_0x57697a,JSON[_0xc3b0('0x13')](_0x2b0118));_0x32410b(_0x2b0118);})[_0xc3b0('0x17')](function(_0x2ac127){logger['error'](_0xc3b0('0x18'),_0x2ac127[_0xc3b0('0x16')],_0x57697a);_0x2be841(_0x433c14[_0xc3b0('0x14')](0x1f4,_0x2ac127[_0xc3b0('0x16')]));});});}; \ No newline at end of file +var _0x8ec1=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','request','info','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','catch','CreateSquareRecording','SquareRecording','create','options','raw','then','debug'];(function(_0x1fa381,_0x758c2a){var _0x47eefe=function(_0x127f8c){while(--_0x127f8c){_0x1fa381['push'](_0x1fa381['shift']());}};_0x47eefe(++_0x758c2a);}(_0x8ec1,0x15e));var _0x18ec=function(_0x3c4a7c,_0x2f4e3c){_0x3c4a7c=_0x3c4a7c-0x0;var _0xf13d1e=_0x8ec1[_0x3c4a7c];return _0xf13d1e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x18ec('0x0'));var BPromise=require(_0x18ec('0x1'));var rs=require(_0x18ec('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x18ec('0x3'))['db'];var utils=require(_0x18ec('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x18ec('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x18ec('0x6')][_0x18ec('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4c5864,_0x4ea00b,_0x4c485a){return new BPromise(function(_0x100e9c,_0x281e1f){return client[_0x18ec('0x8')](_0x4c5864,_0x4c485a)['then'](function(_0x1259f2){logger[_0x18ec('0x9')]('SquareRecording,\x20%s,\x20%s',_0x4ea00b,_0x18ec('0xa'));logger['debug'](_0x18ec('0xb'),_0x4ea00b,'request\x20sent',JSON[_0x18ec('0xc')](_0x1259f2));if(_0x1259f2['error']){if(_0x1259f2[_0x18ec('0xd')][_0x18ec('0xe')]===0x1f4){logger[_0x18ec('0xd')](_0x18ec('0xf'),_0x4ea00b,_0x1259f2['error'][_0x18ec('0x10')]);return _0x281e1f(_0x1259f2['error']['message']);}logger['error'](_0x18ec('0xf'),_0x4ea00b,_0x1259f2[_0x18ec('0xd')][_0x18ec('0x10')]);return _0x100e9c(_0x1259f2['error']['message']);}else{logger[_0x18ec('0x9')](_0x18ec('0xf'),_0x4ea00b,_0x18ec('0xa'));_0x100e9c(_0x1259f2['result']['message']);}})[_0x18ec('0x11')](function(_0x5be0eb){logger[_0x18ec('0xd')](_0x18ec('0xf'),_0x4ea00b,_0x5be0eb);_0x281e1f(_0x5be0eb);});});}exports[_0x18ec('0x12')]=function(_0x3866b9){var _0x3e58dd=this;return new Promise(function(_0xbc2a57,_0x528cef){return db[_0x18ec('0x13')][_0x18ec('0x14')](_0x3866b9['body'],{'raw':_0x3866b9['options']?_0x3866b9[_0x18ec('0x15')][_0x18ec('0x16')]===undefined?!![]:![]:!![]})[_0x18ec('0x17')](function(_0x377eb3){logger['info'](_0x18ec('0x12'),_0x3866b9);logger[_0x18ec('0x18')](_0x18ec('0x12'),_0x3866b9,JSON[_0x18ec('0xc')](_0x377eb3));_0xbc2a57(_0x377eb3);})['catch'](function(_0x5e9819){logger[_0x18ec('0xd')](_0x18ec('0x12'),_0x5e9819['message'],_0x3866b9);_0x528cef(_0x3e58dd['error'](0x1f4,_0x5e9819[_0x18ec('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index c5a89f0..385220a 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x3b9e5f,_0x4798fc){var _0x4ae0e9=function(_0x44ff6e){while(--_0x44ff6e){_0x3b9e5f['push'](_0x3b9e5f['shift']());}};_0x4ae0e9(++_0x4798fc);}(_0xe706,0xa3));var _0x6e70=function(_0x2f3412,_0x2b8d24){_0x2f3412=_0x2f3412-0x0;var _0x4071d6=_0xe706[_0x2f3412];return _0x4071d6;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _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(_0x4cb9aa,_0x58b44f){var _0x2eff51=function(_0x18a09c){while(--_0x18a09c){_0x4cb9aa['push'](_0x4cb9aa['shift']());}};_0x2eff51(++_0x58b44f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 0a7a03a..7f100c9 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 _0x8786=['exports','STRING','BOOLEAN','sequelize'];(function(_0x3db122,_0x5e6bee){var _0x325b67=function(_0x5095af){while(--_0x5095af){_0x3db122['push'](_0x3db122['shift']());}};_0x325b67(++_0x5e6bee);}(_0x8786,0x153));var _0x6878=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x8786[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require(_0x6878('0x0'));module[_0x6878('0x1')]={'network':{'type':Sequelize[_0x6878('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x6878('0x2')]},'channel':{'type':Sequelize[_0x6878('0x2')]},'language':{'type':Sequelize[_0x6878('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x6878('0x2')]},'version':{'type':Sequelize[_0x6878('0x2')]},'callerid':{'type':Sequelize[_0x6878('0x2')]},'calleridname':{'type':Sequelize[_0x6878('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x6878('0x2')]},'callington':{'type':Sequelize[_0x6878('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x6878('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x6878('0x2')]},'extension':{'type':Sequelize[_0x6878('0x2')]},'priority':{'type':Sequelize[_0x6878('0x2')]},'enhanced':{'type':Sequelize[_0x6878('0x2')]},'accountcode':{'type':Sequelize[_0x6878('0x2')]},'threadid':{'type':Sequelize[_0x6878('0x2')]},'project_name':{'type':Sequelize[_0x6878('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x6878('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xf534=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x51ac15,_0xeee98c){var _0x5c90ad=function(_0x5d01e6){while(--_0x5d01e6){_0x51ac15['push'](_0x51ac15['shift']());}};_0x5c90ad(++_0xeee98c);}(_0xf534,0x9f));var _0x4f53=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf534[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x4f53('0x0'));module[_0x4f53('0x1')]={'network':{'type':Sequelize[_0x4f53('0x2')]},'network_script':{'type':Sequelize[_0x4f53('0x2')]},'request':{'type':Sequelize[_0x4f53('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x4f53('0x2')]},'type':{'type':Sequelize[_0x4f53('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x4f53('0x2')]},'callerid':{'type':Sequelize[_0x4f53('0x2')]},'calleridname':{'type':Sequelize[_0x4f53('0x2')]},'callingpres':{'type':Sequelize[_0x4f53('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x4f53('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x4f53('0x2')]},'rdnis':{'type':Sequelize[_0x4f53('0x2')]},'context':{'type':Sequelize[_0x4f53('0x2')]},'extension':{'type':Sequelize[_0x4f53('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x4f53('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x4f53('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x4f53('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 9c0fede..b23e119 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 _0x186a=['papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','Content-Range','apply','reject','then','destroy','error','stack','name','index','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareReport','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js'];(function(_0x36782c,_0x38c321){var _0xd4e417=function(_0x105817){while(--_0x105817){_0x36782c['push'](_0x36782c['shift']());}};_0xd4e417(++_0x38c321);}(_0x186a,0x168));var _0xa186=function(_0x274f14,_0x27dd7f){_0x274f14=_0x274f14-0x0;var _0x13b97e=_0x186a[_0x274f14];return _0x13b97e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa186('0x0'));var zipdir=require(_0xa186('0x1'));var jsonpatch=require(_0xa186('0x2'));var rp=require(_0xa186('0x3'));var moment=require(_0xa186('0x4'));var BPromise=require(_0xa186('0x5'));var Mustache=require(_0xa186('0x6'));var util=require(_0xa186('0x7'));var path=require(_0xa186('0x8'));var sox=require(_0xa186('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa186('0xa'));var _=require('lodash');var squel=require(_0xa186('0xb'));var crypto=require(_0xa186('0xc'));var jsforce=require(_0xa186('0xd'));var deskjs=require(_0xa186('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa186('0xf'));var Redis=require(_0xa186('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa186('0x11'));var hardwareService=require(_0xa186('0x12'));var logger=require(_0xa186('0x13'))(_0xa186('0x14'));var utils=require(_0xa186('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa186('0x16'));var db=require(_0xa186('0x17'))['db'];function respondWithStatusCode(_0x151fe3,_0x450d0b){_0x450d0b=_0x450d0b||0xcc;return function(_0x455f0a){if(_0x455f0a){return _0x151fe3[_0xa186('0x18')](_0x450d0b);}return _0x151fe3[_0xa186('0x19')](_0x450d0b)[_0xa186('0x1a')]();};}function respondWithResult(_0x2823f0,_0x2c51fd){_0x2c51fd=_0x2c51fd||0xc8;return function(_0x446e3d){if(_0x446e3d){return _0x2823f0[_0xa186('0x19')](_0x2c51fd)[_0xa186('0x1b')](_0x446e3d);}};}function respondWithFilteredResult(_0xf43335,_0xa0f5d2){return function(_0x812ea9){if(_0x812ea9){var _0x50474b=typeof _0xa0f5d2['offset']==='undefined'&&typeof _0xa0f5d2[_0xa186('0x1c')]==='undefined';var _0x52de78=_0x812ea9[_0xa186('0x1d')];var _0x31ae63=_0x50474b?0x0:_0xa0f5d2['offset'];var _0x26f01f=_0x50474b?_0x812ea9['count']:_0xa0f5d2['offset']+_0xa0f5d2[_0xa186('0x1c')];var _0x56bdf4;if(_0x26f01f>=_0x52de78){_0x26f01f=_0x52de78;_0x56bdf4=0xc8;}else{_0x56bdf4=0xce;}_0xf43335[_0xa186('0x19')](_0x56bdf4);return _0xf43335['set'](_0xa186('0x1e'),_0x31ae63+'-'+_0x26f01f+'/'+_0x52de78)[_0xa186('0x1b')](_0x812ea9);}return null;};}function patchUpdates(_0x131a21){return function(_0x5899f7){try{jsonpatch[_0xa186('0x1f')](_0x5899f7,_0x131a21,!![]);}catch(_0x6acfe7){return BPromise[_0xa186('0x20')](_0x6acfe7);}return _0x5899f7['save']();};}function saveUpdates(_0x146e75,_0x49a014){return function(_0x3e1295){if(_0x3e1295){return _0x3e1295['update'](_0x146e75)[_0xa186('0x21')](function(_0x5ec650){return _0x5ec650;});}return null;};}function removeEntity(_0x71030b,_0x397141){return function(_0x766c9f){if(_0x766c9f){return _0x766c9f[_0xa186('0x22')]()[_0xa186('0x21')](function(){_0x71030b[_0xa186('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3eb4c6,_0x4a4446){return function(_0x50ef14){if(!_0x50ef14){_0x3eb4c6['sendStatus'](0x194);}return _0x50ef14;};}function handleError(_0x4a3941,_0x2703c5){_0x2703c5=_0x2703c5||0x1f4;return function(_0x2adb55){logger[_0xa186('0x23')](_0x2adb55[_0xa186('0x24')]);if(_0x2adb55[_0xa186('0x25')]){delete _0x2adb55['name'];}_0x4a3941[_0xa186('0x19')](_0x2703c5)['send'](_0x2adb55);};}exports[_0xa186('0x26')]=function(_0x576b66,_0x2331a1){var _0x5398b8={},_0x1c54e2={},_0x565083={'count':0x0,'rows':[]};var _0x6c9458=_['map'](db['SquareReport']['rawAttributes'],function(_0x58c123){return{'name':_0x58c123[_0xa186('0x27')],'type':_0x58c123[_0xa186('0x28')][_0xa186('0x29')]};});_0x1c54e2['model']=_['map'](_0x6c9458,_0xa186('0x25'));_0x1c54e2[_0xa186('0x2a')]=_[_0xa186('0x2b')](_0x576b66[_0xa186('0x2a')]);_0x1c54e2[_0xa186('0x2c')]=_[_0xa186('0x2d')](_0x1c54e2[_0xa186('0x2e')],_0x1c54e2[_0xa186('0x2a')]);_0x5398b8['attributes']=_[_0xa186('0x2d')](_0x1c54e2['model'],qs[_0xa186('0x2f')](_0x576b66[_0xa186('0x2a')]['fields']));_0x5398b8[_0xa186('0x30')]=_0x5398b8[_0xa186('0x30')][_0xa186('0x31')]?_0x5398b8['attributes']:_0x1c54e2[_0xa186('0x2e')];if(!_0x576b66[_0xa186('0x2a')][_0xa186('0x32')](_0xa186('0x33'))){_0x5398b8[_0xa186('0x1c')]=qs[_0xa186('0x1c')](_0x576b66['query']['limit']);_0x5398b8[_0xa186('0x34')]=qs['offset'](_0x576b66[_0xa186('0x2a')][_0xa186('0x34')]);}_0x5398b8[_0xa186('0x35')]=qs[_0xa186('0x36')](_0x576b66[_0xa186('0x2a')]['sort']);_0x5398b8[_0xa186('0x37')]=qs['filters'](_[_0xa186('0x38')](_0x576b66[_0xa186('0x2a')],_0x1c54e2['filters']),_0x6c9458);if(_0x576b66[_0xa186('0x2a')][_0xa186('0x39')]){_0x5398b8[_0xa186('0x37')]=_[_0xa186('0x3a')](_0x5398b8['where'],{'$or':_['map'](_0x6c9458,function(_0x58a7e9){if(_0x58a7e9[_0xa186('0x28')]!==_0xa186('0x3b')){var _0x1e7898={};_0x1e7898[_0x58a7e9[_0xa186('0x25')]]={'$like':'%'+_0x576b66['query'][_0xa186('0x39')]+'%'};return _0x1e7898;}})});}_0x5398b8=_[_0xa186('0x3a')]({},_0x5398b8,_0x576b66[_0xa186('0x3c')]);var _0x324bee={'where':_0x5398b8[_0xa186('0x37')]};return db[_0xa186('0x3d')]['count'](_0x324bee)[_0xa186('0x21')](function(_0x13f3a4){_0x565083['count']=_0x13f3a4;if(_0x576b66[_0xa186('0x2a')][_0xa186('0x3e')]){_0x5398b8[_0xa186('0x3f')]=[{'all':!![]}];}return db[_0xa186('0x3d')][_0xa186('0x40')](_0x5398b8);})[_0xa186('0x21')](function(_0x4f0e12){_0x565083[_0xa186('0x41')]=_0x4f0e12;return _0x565083;})[_0xa186('0x21')](respondWithFilteredResult(_0x2331a1,_0x5398b8))['catch'](handleError(_0x2331a1,null));};exports[_0xa186('0x42')]=function(_0xf9b140,_0x349280){var _0x597c9d={'raw':!![],'where':{'id':_0xf9b140[_0xa186('0x43')]['id']}},_0x39c8eb={};_0x39c8eb[_0xa186('0x2e')]=_[_0xa186('0x2b')](db['SquareReport'][_0xa186('0x44')]);_0x39c8eb[_0xa186('0x2a')]=_['keys'](_0xf9b140[_0xa186('0x2a')]);_0x39c8eb[_0xa186('0x2c')]=_['intersection'](_0x39c8eb['model'],_0x39c8eb[_0xa186('0x2a')]);_0x597c9d['attributes']=_[_0xa186('0x2d')](_0x39c8eb['model'],qs['fields'](_0xf9b140['query'][_0xa186('0x2f')]));_0x597c9d['attributes']=_0x597c9d[_0xa186('0x30')][_0xa186('0x31')]?_0x597c9d[_0xa186('0x30')]:_0x39c8eb[_0xa186('0x2e')];if(_0xf9b140[_0xa186('0x2a')]['includeAll']){_0x597c9d['include']=[{'all':!![]}];}_0x597c9d=_[_0xa186('0x3a')]({},_0x597c9d,_0xf9b140['options']);return db['SquareReport'][_0xa186('0x45')](_0x597c9d)[_0xa186('0x21')](handleEntityNotFound(_0x349280,null))[_0xa186('0x21')](respondWithResult(_0x349280,null))[_0xa186('0x46')](handleError(_0x349280,null));};exports[_0xa186('0x47')]=function(_0x22c62a,_0x2c2b6f){return db[_0xa186('0x3d')]['create'](_0x22c62a[_0xa186('0x48')],{})[_0xa186('0x21')](respondWithResult(_0x2c2b6f,0xc9))['catch'](handleError(_0x2c2b6f,null));};exports[_0xa186('0x49')]=function(_0x5b7f88,_0x4d636b){if(_0x5b7f88['body']['id']){delete _0x5b7f88[_0xa186('0x48')]['id'];}return db['SquareReport'][_0xa186('0x45')]({'where':{'id':_0x5b7f88[_0xa186('0x43')]['id']}})[_0xa186('0x21')](handleEntityNotFound(_0x4d636b,null))[_0xa186('0x21')](saveUpdates(_0x5b7f88[_0xa186('0x48')],null))['then'](respondWithResult(_0x4d636b,null))[_0xa186('0x46')](handleError(_0x4d636b,null));};exports[_0xa186('0x22')]=function(_0x15a915,_0x19e532){return db['SquareReport'][_0xa186('0x45')]({'where':{'id':_0x15a915[_0xa186('0x43')]['id']}})[_0xa186('0x21')](handleEntityNotFound(_0x19e532,null))[_0xa186('0x21')](removeEntity(_0x19e532,null))[_0xa186('0x46')](handleError(_0x19e532,null));};exports['describe']=function(_0x2a0ad1,_0x47d4b9){return db[_0xa186('0x3d')][_0xa186('0x4a')]()[_0xa186('0x21')](respondWithResult(_0x47d4b9,null))['catch'](handleError(_0x47d4b9,null));}; \ No newline at end of file +var _0xc354=['nolimit','sort','where','pick','merge','type','VIRTUAL','options','then','includeAll','include','catch','show','params','keys','intersection','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','fs-extra','lodash','crypto','jsforce','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','reject','save','update','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length','hasOwnProperty'];(function(_0x1f55d0,_0x3211ea){var _0x58c81b=function(_0x43c36c){while(--_0x43c36c){_0x1f55d0['push'](_0x1f55d0['shift']());}};_0x58c81b(++_0x3211ea);}(_0xc354,0x18c));var _0x4c35=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc354[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x4c35('0x0'));var rimraf=require(_0x4c35('0x1'));var zipdir=require(_0x4c35('0x2'));var jsonpatch=require(_0x4c35('0x3'));var rp=require(_0x4c35('0x4'));var moment=require(_0x4c35('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4c35('0x6'));var path=require(_0x4c35('0x7'));var sox=require('sox');var csv=require(_0x4c35('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4c35('0x9'));var _=require(_0x4c35('0xa'));var squel=require('squel');var crypto=require(_0x4c35('0xb'));var jsforce=require(_0x4c35('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4c35('0xd'));var Papa=require(_0x4c35('0xe'));var Redis=require(_0x4c35('0xf'));var authService=require(_0x4c35('0x10'));var qs=require(_0x4c35('0x11'));var as=require(_0x4c35('0x12'));var hardwareService=require(_0x4c35('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x4c35('0x14'));var config=require(_0x4c35('0x15'));var licenseUtil=require(_0x4c35('0x16'));var db=require(_0x4c35('0x17'))['db'];function respondWithStatusCode(_0x4726fe,_0x3aa655){_0x3aa655=_0x3aa655||0xcc;return function(_0x36460f){if(_0x36460f){return _0x4726fe[_0x4c35('0x18')](_0x3aa655);}return _0x4726fe[_0x4c35('0x19')](_0x3aa655)[_0x4c35('0x1a')]();};}function respondWithResult(_0xbf9459,_0x10feec){_0x10feec=_0x10feec||0xc8;return function(_0x3e9a7d){if(_0x3e9a7d){return _0xbf9459[_0x4c35('0x19')](_0x10feec)[_0x4c35('0x1b')](_0x3e9a7d);}};}function respondWithFilteredResult(_0x5ca775,_0x1dd201){return function(_0x422a84){if(_0x422a84){var _0x40a7bd=typeof _0x1dd201[_0x4c35('0x1c')]===_0x4c35('0x1d')&&typeof _0x1dd201[_0x4c35('0x1e')]===_0x4c35('0x1d');var _0x57c860=_0x422a84[_0x4c35('0x1f')];var _0xfd0400=_0x40a7bd?0x0:_0x1dd201[_0x4c35('0x1c')];var _0x23536a=_0x40a7bd?_0x422a84['count']:_0x1dd201['offset']+_0x1dd201[_0x4c35('0x1e')];var _0x3c9cd4;if(_0x23536a>=_0x57c860){_0x23536a=_0x57c860;_0x3c9cd4=0xc8;}else{_0x3c9cd4=0xce;}_0x5ca775['status'](_0x3c9cd4);return _0x5ca775[_0x4c35('0x20')](_0x4c35('0x21'),_0xfd0400+'-'+_0x23536a+'/'+_0x57c860)['json'](_0x422a84);}return null;};}function patchUpdates(_0x4e41fe){return function(_0x4c5a92){try{jsonpatch['apply'](_0x4c5a92,_0x4e41fe,!![]);}catch(_0x3896c6){return BPromise[_0x4c35('0x22')](_0x3896c6);}return _0x4c5a92[_0x4c35('0x23')]();};}function saveUpdates(_0x116863,_0x3f6452){return function(_0x52ec0f){if(_0x52ec0f){return _0x52ec0f[_0x4c35('0x24')](_0x116863)['then'](function(_0x5bee23){return _0x5bee23;});}return null;};}function removeEntity(_0x572c3c,_0x549f9a){return function(_0xe16e53){if(_0xe16e53){return _0xe16e53['destroy']()['then'](function(){_0x572c3c[_0x4c35('0x19')](0xcc)[_0x4c35('0x1a')]();});}};}function handleEntityNotFound(_0x494af2,_0x205c25){return function(_0x446ad9){if(!_0x446ad9){_0x494af2[_0x4c35('0x18')](0x194);}return _0x446ad9;};}function handleError(_0x57a1d1,_0x42e680){_0x42e680=_0x42e680||0x1f4;return function(_0xb31302){logger[_0x4c35('0x25')](_0xb31302[_0x4c35('0x26')]);if(_0xb31302[_0x4c35('0x27')]){delete _0xb31302[_0x4c35('0x27')];}_0x57a1d1[_0x4c35('0x19')](_0x42e680)[_0x4c35('0x28')](_0xb31302);};}exports[_0x4c35('0x29')]=function(_0x19412b,_0x44f6c5){var _0x968ec1={},_0x476867={},_0x1db2c3={'count':0x0,'rows':[]};var _0x182bb8=_[_0x4c35('0x2a')](db[_0x4c35('0x2b')][_0x4c35('0x2c')],function(_0x392b71){return{'name':_0x392b71[_0x4c35('0x2d')],'type':_0x392b71['type'][_0x4c35('0x2e')]};});_0x476867[_0x4c35('0x2f')]=_[_0x4c35('0x2a')](_0x182bb8,_0x4c35('0x27'));_0x476867['query']=_['keys'](_0x19412b[_0x4c35('0x30')]);_0x476867[_0x4c35('0x31')]=_['intersection'](_0x476867[_0x4c35('0x2f')],_0x476867['query']);_0x968ec1[_0x4c35('0x32')]=_['intersection'](_0x476867['model'],qs[_0x4c35('0x33')](_0x19412b[_0x4c35('0x30')][_0x4c35('0x33')]));_0x968ec1[_0x4c35('0x32')]=_0x968ec1[_0x4c35('0x32')][_0x4c35('0x34')]?_0x968ec1[_0x4c35('0x32')]:_0x476867[_0x4c35('0x2f')];if(!_0x19412b[_0x4c35('0x30')][_0x4c35('0x35')](_0x4c35('0x36'))){_0x968ec1[_0x4c35('0x1e')]=qs['limit'](_0x19412b[_0x4c35('0x30')][_0x4c35('0x1e')]);_0x968ec1[_0x4c35('0x1c')]=qs[_0x4c35('0x1c')](_0x19412b['query'][_0x4c35('0x1c')]);}_0x968ec1['order']=qs[_0x4c35('0x37')](_0x19412b[_0x4c35('0x30')][_0x4c35('0x37')]);_0x968ec1[_0x4c35('0x38')]=qs[_0x4c35('0x31')](_[_0x4c35('0x39')](_0x19412b[_0x4c35('0x30')],_0x476867['filters']),_0x182bb8);if(_0x19412b[_0x4c35('0x30')]['filter']){_0x968ec1['where']=_[_0x4c35('0x3a')](_0x968ec1[_0x4c35('0x38')],{'$or':_[_0x4c35('0x2a')](_0x182bb8,function(_0x4f3668){if(_0x4f3668[_0x4c35('0x3b')]!==_0x4c35('0x3c')){var _0x54729c={};_0x54729c[_0x4f3668[_0x4c35('0x27')]]={'$like':'%'+_0x19412b[_0x4c35('0x30')]['filter']+'%'};return _0x54729c;}})});}_0x968ec1=_[_0x4c35('0x3a')]({},_0x968ec1,_0x19412b[_0x4c35('0x3d')]);var _0x3a1255={'where':_0x968ec1['where']};return db[_0x4c35('0x2b')][_0x4c35('0x1f')](_0x3a1255)[_0x4c35('0x3e')](function(_0x1b5bca){_0x1db2c3[_0x4c35('0x1f')]=_0x1b5bca;if(_0x19412b[_0x4c35('0x30')][_0x4c35('0x3f')]){_0x968ec1[_0x4c35('0x40')]=[{'all':!![]}];}return db['SquareReport']['findAll'](_0x968ec1);})[_0x4c35('0x3e')](function(_0x364eaf){_0x1db2c3['rows']=_0x364eaf;return _0x1db2c3;})[_0x4c35('0x3e')](respondWithFilteredResult(_0x44f6c5,_0x968ec1))[_0x4c35('0x41')](handleError(_0x44f6c5,null));};exports[_0x4c35('0x42')]=function(_0x34a446,_0x591459){var _0x8cac43={'raw':!![],'where':{'id':_0x34a446[_0x4c35('0x43')]['id']}},_0x2f80f7={};_0x2f80f7[_0x4c35('0x2f')]=_[_0x4c35('0x44')](db[_0x4c35('0x2b')][_0x4c35('0x2c')]);_0x2f80f7[_0x4c35('0x30')]=_['keys'](_0x34a446[_0x4c35('0x30')]);_0x2f80f7['filters']=_[_0x4c35('0x45')](_0x2f80f7[_0x4c35('0x2f')],_0x2f80f7[_0x4c35('0x30')]);_0x8cac43[_0x4c35('0x32')]=_['intersection'](_0x2f80f7[_0x4c35('0x2f')],qs['fields'](_0x34a446[_0x4c35('0x30')][_0x4c35('0x33')]));_0x8cac43[_0x4c35('0x32')]=_0x8cac43['attributes'][_0x4c35('0x34')]?_0x8cac43[_0x4c35('0x32')]:_0x2f80f7[_0x4c35('0x2f')];if(_0x34a446[_0x4c35('0x30')]['includeAll']){_0x8cac43[_0x4c35('0x40')]=[{'all':!![]}];}_0x8cac43=_['merge']({},_0x8cac43,_0x34a446[_0x4c35('0x3d')]);return db[_0x4c35('0x2b')][_0x4c35('0x46')](_0x8cac43)['then'](handleEntityNotFound(_0x591459,null))['then'](respondWithResult(_0x591459,null))[_0x4c35('0x41')](handleError(_0x591459,null));};exports[_0x4c35('0x47')]=function(_0x270940,_0x2bc3d4){return db[_0x4c35('0x2b')][_0x4c35('0x47')](_0x270940['body'],{})[_0x4c35('0x3e')](respondWithResult(_0x2bc3d4,0xc9))[_0x4c35('0x41')](handleError(_0x2bc3d4,null));};exports['update']=function(_0x3c2ac6,_0x1cf60e){if(_0x3c2ac6[_0x4c35('0x48')]['id']){delete _0x3c2ac6[_0x4c35('0x48')]['id'];}return db['SquareReport']['find']({'where':{'id':_0x3c2ac6[_0x4c35('0x43')]['id']}})[_0x4c35('0x3e')](handleEntityNotFound(_0x1cf60e,null))[_0x4c35('0x3e')](saveUpdates(_0x3c2ac6[_0x4c35('0x48')],null))[_0x4c35('0x3e')](respondWithResult(_0x1cf60e,null))[_0x4c35('0x41')](handleError(_0x1cf60e,null));};exports[_0x4c35('0x49')]=function(_0x490828,_0x3bae5a){return db['SquareReport'][_0x4c35('0x46')]({'where':{'id':_0x490828['params']['id']}})[_0x4c35('0x3e')](handleEntityNotFound(_0x3bae5a,null))[_0x4c35('0x3e')](removeEntity(_0x3bae5a,null))[_0x4c35('0x41')](handleError(_0x3bae5a,null));};exports[_0x4c35('0x4a')]=function(_0x43ec95,_0x333449){return db[_0x4c35('0x2b')][_0x4c35('0x4a')]()[_0x4c35('0x3e')](respondWithResult(_0x333449,null))[_0x4c35('0x41')](handleError(_0x333449,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 1c90a03..07cad4e 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 _0xf3af=['api','moment','bluebird','rimraf','exports','SquareReport','report_square','uid_pname','project_name','leaveAt','lodash','util'];(function(_0x24868b,_0x12284f){var _0x13cb8e=function(_0x3cecfb){while(--_0x3cecfb){_0x24868b['push'](_0x24868b['shift']());}};_0x13cb8e(++_0x12284f);}(_0xf3af,0x9a));var _0xff3a=function(_0x5bbe7e,_0x19c08f){_0x5bbe7e=_0x5bbe7e-0x0;var _0x6ebda1=_0xf3af[_0x5bbe7e];return _0x6ebda1;};'use strict';var _=require(_0xff3a('0x0'));var util=require(_0xff3a('0x1'));var logger=require('../../config/logger')(_0xff3a('0x2'));var moment=require(_0xff3a('0x3'));var BPromise=require(_0xff3a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xff3a('0x5'));var config=require('../../config/environment');var attributes=require('./squareReport.attributes');module[_0xff3a('0x6')]=function(_0x52e397,_0x253352){return _0x52e397['define'](_0xff3a('0x7'),attributes,{'tableName':_0xff3a('0x8'),'paranoid':![],'indexes':[{'name':_0xff3a('0x9'),'fields':['uniqueid',_0xff3a('0xa')]},{'name':_0xff3a('0xb'),'fields':[_0xff3a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb2fd=['leaveAt','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name'];(function(_0x2e2681,_0x4089c1){var _0x368a64=function(_0x267262){while(--_0x267262){_0x2e2681['push'](_0x2e2681['shift']());}};_0x368a64(++_0x4089c1);}(_0xb2fd,0xb1));var _0xdb2f=function(_0x3e8af2,_0x430bda){_0x3e8af2=_0x3e8af2-0x0;var _0x175dd8=_0xb2fd[_0x3e8af2];return _0x175dd8;};'use strict';var _=require(_0xdb2f('0x0'));var util=require(_0xdb2f('0x1'));var logger=require(_0xdb2f('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdb2f('0x3'));var fs=require('fs');var path=require(_0xdb2f('0x4'));var rimraf=require(_0xdb2f('0x5'));var config=require(_0xdb2f('0x6'));var attributes=require(_0xdb2f('0x7'));module[_0xdb2f('0x8')]=function(_0x13db35,_0x45a160){return _0x13db35[_0xdb2f('0x9')](_0xdb2f('0xa'),attributes,{'tableName':_0xdb2f('0xb'),'paranoid':![],'indexes':[{'name':_0xdb2f('0xc'),'fields':[_0xdb2f('0xd'),_0xdb2f('0xe')]},{'name':_0xdb2f('0xf'),'fields':[_0xdb2f('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 5d1a6f2..505f281 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 _0x9b6c=['create','options','raw','debug','UpdateSquareReport','update','body','where','attributes','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareReport,\x20%s,\x20%s','message','info','result','catch','CreateSquareReport','SquareReport'];(function(_0x42fd0b,_0x62bc3){var _0x1bb0bd=function(_0x45e402){while(--_0x45e402){_0x42fd0b['push'](_0x42fd0b['shift']());}};_0x1bb0bd(++_0x62bc3);}(_0x9b6c,0x1e6));var _0xc9b6=function(_0x3335a0,_0x167419){_0x3335a0=_0x3335a0-0x0;var _0x2d44fe=_0x9b6c[_0x3335a0];return _0x2d44fe;};'use strict';var _=require(_0xc9b6('0x0'));var util=require('util');var moment=require(_0xc9b6('0x1'));var BPromise=require(_0xc9b6('0x2'));var rs=require(_0xc9b6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc9b6('0x4'))['db'];var utils=require(_0xc9b6('0x5'));var logger=require(_0xc9b6('0x6'))(_0xc9b6('0x7'));var config=require('../../config/environment');var jayson=require(_0xc9b6('0x8'));var client=jayson['client'][_0xc9b6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c3e26,_0xaaf8d0,_0x5c447b){return new BPromise(function(_0x2de0c7,_0x45ea11){return client[_0xc9b6('0xa')](_0x4c3e26,_0x5c447b)[_0xc9b6('0xb')](function(_0x1c41ad){logger['info']('SquareReport,\x20%s,\x20%s',_0xaaf8d0,_0xc9b6('0xc'));logger['debug'](_0xc9b6('0xd'),_0xaaf8d0,_0xc9b6('0xc'),JSON[_0xc9b6('0xe')](_0x1c41ad));if(_0x1c41ad[_0xc9b6('0xf')]){if(_0x1c41ad['error'][_0xc9b6('0x10')]===0x1f4){logger[_0xc9b6('0xf')](_0xc9b6('0x11'),_0xaaf8d0,_0x1c41ad[_0xc9b6('0xf')][_0xc9b6('0x12')]);return _0x45ea11(_0x1c41ad[_0xc9b6('0xf')][_0xc9b6('0x12')]);}logger[_0xc9b6('0xf')](_0xc9b6('0x11'),_0xaaf8d0,_0x1c41ad[_0xc9b6('0xf')]['message']);return _0x2de0c7(_0x1c41ad[_0xc9b6('0xf')]['message']);}else{logger[_0xc9b6('0x13')](_0xc9b6('0x11'),_0xaaf8d0,'request\x20sent');_0x2de0c7(_0x1c41ad[_0xc9b6('0x14')][_0xc9b6('0x12')]);}})[_0xc9b6('0x15')](function(_0x41bab9){logger[_0xc9b6('0xf')](_0xc9b6('0x11'),_0xaaf8d0,_0x41bab9);_0x45ea11(_0x41bab9);});});}exports[_0xc9b6('0x16')]=function(_0x56d734){var _0x1ef399=this;return new Promise(function(_0x114867,_0x3a04c9){return db[_0xc9b6('0x17')][_0xc9b6('0x18')](_0x56d734['body'],{'raw':_0x56d734['options']?_0x56d734[_0xc9b6('0x19')][_0xc9b6('0x1a')]===undefined?!![]:![]:!![]})[_0xc9b6('0xb')](function(_0x3b2181){logger['info']('CreateSquareReport',_0x56d734);logger[_0xc9b6('0x1b')]('CreateSquareReport',_0x56d734,JSON[_0xc9b6('0xe')](_0x3b2181));_0x114867(_0x3b2181);})[_0xc9b6('0x15')](function(_0x37da37){logger['error'](_0xc9b6('0x16'),_0x37da37[_0xc9b6('0x12')],_0x56d734);_0x3a04c9(_0x1ef399['error'](0x1f4,_0x37da37['message']));});});};exports[_0xc9b6('0x1c')]=function(_0x53b556){var _0x2fd650=this;return new Promise(function(_0xd17788,_0x33d2df){return db[_0xc9b6('0x17')][_0xc9b6('0x1d')](_0x53b556[_0xc9b6('0x1e')],{'raw':_0x53b556[_0xc9b6('0x19')]?_0x53b556[_0xc9b6('0x19')][_0xc9b6('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53b556[_0xc9b6('0x19')]?_0x53b556['options'][_0xc9b6('0x1f')]||null:null,'attributes':_0x53b556[_0xc9b6('0x19')]?_0x53b556[_0xc9b6('0x19')][_0xc9b6('0x20')]||null:null,'limit':_0x53b556[_0xc9b6('0x19')]?_0x53b556[_0xc9b6('0x19')][_0xc9b6('0x21')]||null:null})['then'](function(_0x4c8e29){logger['info'](_0xc9b6('0x1c'),_0x53b556);logger[_0xc9b6('0x1b')]('UpdateSquareReport',_0x53b556,JSON[_0xc9b6('0xe')](_0x4c8e29));_0xd17788(_0x4c8e29);})[_0xc9b6('0x15')](function(_0x10898a){logger[_0xc9b6('0xf')](_0xc9b6('0x1c'),_0x10898a[_0xc9b6('0x12')],_0x53b556);_0x33d2df(_0x2fd650[_0xc9b6('0xf')](0x1f4,_0x10898a['message']));});});}; \ No newline at end of file +var _0xd370=['rpc','jayson/promise','client','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','code','message','SquareReport,\x20%s,\x20%s','result','CreateSquareReport','SquareReport','body','options','stringify','UpdateSquareReport','update','raw','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x10611d,_0x201d0c){var _0x5f15ab=function(_0x168d52){while(--_0x168d52){_0x10611d['push'](_0x10611d['shift']());}};_0x5f15ab(++_0x201d0c);}(_0xd370,0x158));var _0x0d37=function(_0x27a900,_0x1cc305){_0x27a900=_0x27a900-0x0;var _0xea9b1f=_0xd370[_0x27a900];return _0xea9b1f;};'use strict';var _=require(_0x0d37('0x0'));var util=require(_0x0d37('0x1'));var moment=require('moment');var BPromise=require(_0x0d37('0x2'));var rs=require(_0x0d37('0x3'));var fs=require('fs');var Redis=require(_0x0d37('0x4'));var db=require(_0x0d37('0x5'))['db'];var utils=require(_0x0d37('0x6'));var logger=require(_0x0d37('0x7'))(_0x0d37('0x8'));var config=require('../../config/environment');var jayson=require(_0x0d37('0x9'));var client=jayson[_0x0d37('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x554bcd,_0x4b85c1,_0xf78563){return new BPromise(function(_0x4b3579,_0x5e8ded){return client['request'](_0x554bcd,_0xf78563)[_0x0d37('0xb')](function(_0xbe72e9){logger[_0x0d37('0xc')]('SquareReport,\x20%s,\x20%s',_0x4b85c1,_0x0d37('0xd'));logger[_0x0d37('0xe')](_0x0d37('0xf'),_0x4b85c1,_0x0d37('0xd'),JSON['stringify'](_0xbe72e9));if(_0xbe72e9['error']){if(_0xbe72e9[_0x0d37('0x10')][_0x0d37('0x11')]===0x1f4){logger[_0x0d37('0x10')]('SquareReport,\x20%s,\x20%s',_0x4b85c1,_0xbe72e9[_0x0d37('0x10')]['message']);return _0x5e8ded(_0xbe72e9['error'][_0x0d37('0x12')]);}logger['error'](_0x0d37('0x13'),_0x4b85c1,_0xbe72e9['error']['message']);return _0x4b3579(_0xbe72e9[_0x0d37('0x10')][_0x0d37('0x12')]);}else{logger[_0x0d37('0xc')]('SquareReport,\x20%s,\x20%s',_0x4b85c1,_0x0d37('0xd'));_0x4b3579(_0xbe72e9[_0x0d37('0x14')]['message']);}})['catch'](function(_0x3f7759){logger['error'](_0x0d37('0x13'),_0x4b85c1,_0x3f7759);_0x5e8ded(_0x3f7759);});});}exports[_0x0d37('0x15')]=function(_0x5f4196){var _0x165540=this;return new Promise(function(_0x5a2264,_0x19ba07){return db[_0x0d37('0x16')]['create'](_0x5f4196[_0x0d37('0x17')],{'raw':_0x5f4196[_0x0d37('0x18')]?_0x5f4196['options']['raw']===undefined?!![]:![]:!![]})[_0x0d37('0xb')](function(_0x279ee3){logger['info'](_0x0d37('0x15'),_0x5f4196);logger['debug']('CreateSquareReport',_0x5f4196,JSON[_0x0d37('0x19')](_0x279ee3));_0x5a2264(_0x279ee3);})['catch'](function(_0x542713){logger[_0x0d37('0x10')](_0x0d37('0x15'),_0x542713['message'],_0x5f4196);_0x19ba07(_0x165540[_0x0d37('0x10')](0x1f4,_0x542713[_0x0d37('0x12')]));});});};exports[_0x0d37('0x1a')]=function(_0x514ca5){var _0x248866=this;return new Promise(function(_0xccbaa7,_0x384cdb){return db[_0x0d37('0x16')][_0x0d37('0x1b')](_0x514ca5[_0x0d37('0x17')],{'raw':_0x514ca5[_0x0d37('0x18')]?_0x514ca5[_0x0d37('0x18')][_0x0d37('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x514ca5[_0x0d37('0x18')]?_0x514ca5[_0x0d37('0x18')][_0x0d37('0x1d')]||null:null,'attributes':_0x514ca5[_0x0d37('0x18')]?_0x514ca5['options'][_0x0d37('0x1e')]||null:null,'limit':_0x514ca5['options']?_0x514ca5['options'][_0x0d37('0x1f')]||null:null})[_0x0d37('0xb')](function(_0x58be2b){logger[_0x0d37('0xc')](_0x0d37('0x1a'),_0x514ca5);logger[_0x0d37('0xe')](_0x0d37('0x1a'),_0x514ca5,JSON[_0x0d37('0x19')](_0x58be2b));_0xccbaa7(_0x58be2b);})['catch'](function(_0x56ac93){logger[_0x0d37('0x10')](_0x0d37('0x1a'),_0x56ac93[_0x0d37('0x12')],_0x514ca5);_0x384cdb(_0x248866[_0x0d37('0x10')](0x1f4,_0x56ac93[_0x0d37('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 2f752e2..788a05c 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 _0x34bc=['show','post','create','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x303f6a,_0xe67b05){var _0x5cfcb1=function(_0x335a02){while(--_0x335a02){_0x303f6a['push'](_0x303f6a['shift']());}};_0x5cfcb1(++_0xe67b05);}(_0x34bc,0x10c));var _0xc34b=function(_0x11154a,_0x583ade){_0x11154a=_0x11154a-0x0;var _0x2b6d88=_0x34bc[_0x11154a];return _0x2b6d88;};'use strict';var multer=require(_0xc34b('0x0'));var util=require('util');var path=require(_0xc34b('0x1'));var timeout=require('connect-timeout');var express=require(_0xc34b('0x2'));var router=express[_0xc34b('0x3')]();var fs_extra=require(_0xc34b('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc34b('0x5'));var controller=require(_0xc34b('0x6'));router[_0xc34b('0x7')]('/',auth[_0xc34b('0x8')](),controller[_0xc34b('0x9')]);router['get']('/describe',auth[_0xc34b('0x8')](),controller[_0xc34b('0xa')]);router['get'](_0xc34b('0xb'),auth['isAuthenticated'](),controller[_0xc34b('0xc')]);router[_0xc34b('0xd')]('/',auth['isAuthenticated'](),controller[_0xc34b('0xe')]);router[_0xc34b('0xf')](_0xc34b('0xb'),auth[_0xc34b('0x8')](),controller[_0xc34b('0x10')]);router[_0xc34b('0x11')]('/:id',auth[_0xc34b('0x8')](),controller[_0xc34b('0x12')]);module[_0xc34b('0x13')]=router; \ No newline at end of file +var _0x92b8=['delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show','update'];(function(_0x2c9d96,_0x18b8cf){var _0xc784c4=function(_0x115d5e){while(--_0x115d5e){_0x2c9d96['push'](_0x2c9d96['shift']());}};_0xc784c4(++_0x18b8cf);}(_0x92b8,0xa8));var _0x892b=function(_0x550623,_0x27909b){_0x550623=_0x550623-0x0;var _0x5148c8=_0x92b8[_0x550623];return _0x5148c8;};'use strict';var multer=require(_0x892b('0x0'));var util=require(_0x892b('0x1'));var path=require('path');var timeout=require(_0x892b('0x2'));var express=require('express');var router=express[_0x892b('0x3')]();var fs_extra=require(_0x892b('0x4'));var auth=require(_0x892b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0x892b('0x6')]('/',auth[_0x892b('0x7')](),controller[_0x892b('0x8')]);router[_0x892b('0x6')]('/describe',auth[_0x892b('0x7')](),controller['describe']);router['get'](_0x892b('0x9'),auth[_0x892b('0x7')](),controller[_0x892b('0xa')]);router['post']('/',auth[_0x892b('0x7')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x892b('0xb')]);router[_0x892b('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x892b('0xd')]);module[_0x892b('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index c0ee58e..8d08a38 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 _0x1bc9=['TEXT','sequelize','STRING'];(function(_0x2f25aa,_0x3af6d1){var _0x2a99a2=function(_0x13d179){while(--_0x13d179){_0x2f25aa['push'](_0x2f25aa['shift']());}};_0x2a99a2(++_0x3af6d1);}(_0x1bc9,0x1c3));var _0x91bc=function(_0x335dda,_0x572399){_0x335dda=_0x335dda-0x0;var _0x3a2c49=_0x1bc9[_0x335dda];return _0x3a2c49;};'use strict';var Sequelize=require(_0x91bc('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x91bc('0x1')]},'node':{'type':Sequelize[_0x91bc('0x1')]},'application':{'type':Sequelize[_0x91bc('0x1')]},'data':{'type':Sequelize[_0x91bc('0x2')]},'project_name':{'type':Sequelize[_0x91bc('0x1')]},'callerid':{'type':Sequelize[_0x91bc('0x1')]}}; \ No newline at end of file +var _0xaac5=['STRING','TEXT','exports'];(function(_0x1401f9,_0x5c7874){var _0x201870=function(_0x10a1c9){while(--_0x10a1c9){_0x1401f9['push'](_0x1401f9['shift']());}};_0x201870(++_0x5c7874);}(_0xaac5,0x1b5));var _0x5aac=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xaac5[_0x46aff0];return _0x9d78cf;};'use strict';var Sequelize=require('sequelize');module[_0x5aac('0x0')]={'uniqueid':{'type':Sequelize[_0x5aac('0x1')]},'node':{'type':Sequelize[_0x5aac('0x1')]},'application':{'type':Sequelize[_0x5aac('0x1')]},'data':{'type':Sequelize[_0x5aac('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x5aac('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index ce55def..f16a988 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 _0xf81b=['catch','find','create','body','params','destroy','describe','eml-format','zip-dir','fast-json-patch','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','merge','map','options','SquareDetailsReport','includeAll','include','findAll','rows'];(function(_0x2353ff,_0x4af5cf){var _0x225402=function(_0x2ce5f9){while(--_0x2ce5f9){_0x2353ff['push'](_0x2353ff['shift']());}};_0x225402(++_0x4af5cf);}(_0xf81b,0xdc));var _0xbf81=function(_0x1f7efa,_0x29ac4e){_0x1f7efa=_0x1f7efa-0x0;var _0xd5e854=_0xf81b[_0x1f7efa];return _0xd5e854;};'use strict';var emlformat=require(_0xbf81('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbf81('0x1'));var jsonpatch=require(_0xbf81('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbf81('0x3'));var util=require(_0xbf81('0x4'));var path=require(_0xbf81('0x5'));var sox=require(_0xbf81('0x6'));var csv=require('to-csv');var ejs=require(_0xbf81('0x7'));var fs=require('fs');var fs_extra=require(_0xbf81('0x8'));var _=require('lodash');var squel=require(_0xbf81('0x9'));var crypto=require(_0xbf81('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xbf81('0xb'));var toCsv=require('to-csv');var querystring=require(_0xbf81('0xc'));var Papa=require(_0xbf81('0xd'));var Redis=require('ioredis');var authService=require(_0xbf81('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbf81('0xf'));var hardwareService=require(_0xbf81('0x10'));var logger=require(_0xbf81('0x11'))(_0xbf81('0x12'));var utils=require(_0xbf81('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xbf81('0x14'));var db=require(_0xbf81('0x15'))['db'];function respondWithStatusCode(_0x3d3ee3,_0x55c8c7){_0x55c8c7=_0x55c8c7||0xcc;return function(_0x4ad04b){if(_0x4ad04b){return _0x3d3ee3[_0xbf81('0x16')](_0x55c8c7);}return _0x3d3ee3[_0xbf81('0x17')](_0x55c8c7)[_0xbf81('0x18')]();};}function respondWithResult(_0x1273ed,_0x59b350){_0x59b350=_0x59b350||0xc8;return function(_0x13b8f8){if(_0x13b8f8){return _0x1273ed[_0xbf81('0x17')](_0x59b350)[_0xbf81('0x19')](_0x13b8f8);}};}function respondWithFilteredResult(_0x1de479,_0x51a558){return function(_0x284347){if(_0x284347){var _0x15db00=typeof _0x51a558[_0xbf81('0x1a')]==='undefined'&&typeof _0x51a558[_0xbf81('0x1b')]===_0xbf81('0x1c');var _0x226374=_0x284347[_0xbf81('0x1d')];var _0x338569=_0x15db00?0x0:_0x51a558[_0xbf81('0x1a')];var _0x49a0ca=_0x15db00?_0x284347[_0xbf81('0x1d')]:_0x51a558['offset']+_0x51a558['limit'];var _0x15864e;if(_0x49a0ca>=_0x226374){_0x49a0ca=_0x226374;_0x15864e=0xc8;}else{_0x15864e=0xce;}_0x1de479[_0xbf81('0x17')](_0x15864e);return _0x1de479[_0xbf81('0x1e')]('Content-Range',_0x338569+'-'+_0x49a0ca+'/'+_0x226374)[_0xbf81('0x19')](_0x284347);}return null;};}function patchUpdates(_0x4f7342){return function(_0x5cd4ce){try{jsonpatch[_0xbf81('0x1f')](_0x5cd4ce,_0x4f7342,!![]);}catch(_0x4d6c2b){return BPromise['reject'](_0x4d6c2b);}return _0x5cd4ce['save']();};}function saveUpdates(_0x5678c9,_0x21ef23){return function(_0x2e0923){if(_0x2e0923){return _0x2e0923[_0xbf81('0x20')](_0x5678c9)[_0xbf81('0x21')](function(_0x551b52){return _0x551b52;});}return null;};}function removeEntity(_0x33731f,_0xd8d4ca){return function(_0xdbdf4d){if(_0xdbdf4d){return _0xdbdf4d['destroy']()[_0xbf81('0x21')](function(){_0x33731f[_0xbf81('0x17')](0xcc)[_0xbf81('0x18')]();});}};}function handleEntityNotFound(_0x1e0a4f,_0x15a9d0){return function(_0x1d89c6){if(!_0x1d89c6){_0x1e0a4f[_0xbf81('0x16')](0x194);}return _0x1d89c6;};}function handleError(_0x59ed06,_0x6046d3){_0x6046d3=_0x6046d3||0x1f4;return function(_0x207d86){logger[_0xbf81('0x22')](_0x207d86[_0xbf81('0x23')]);if(_0x207d86[_0xbf81('0x24')]){delete _0x207d86[_0xbf81('0x24')];}_0x59ed06[_0xbf81('0x17')](_0x6046d3)[_0xbf81('0x25')](_0x207d86);};}exports[_0xbf81('0x26')]=function(_0x3ebee4,_0x883587){var _0x2cb23d={},_0x1b353d={},_0x71d0ef={'count':0x0,'rows':[]};var _0xb4532e=_['map'](db['SquareDetailsReport'][_0xbf81('0x27')],function(_0x3bca7f){return{'name':_0x3bca7f[_0xbf81('0x28')],'type':_0x3bca7f[_0xbf81('0x29')][_0xbf81('0x2a')]};});_0x1b353d[_0xbf81('0x2b')]=_['map'](_0xb4532e,_0xbf81('0x24'));_0x1b353d[_0xbf81('0x2c')]=_[_0xbf81('0x2d')](_0x3ebee4[_0xbf81('0x2c')]);_0x1b353d[_0xbf81('0x2e')]=_[_0xbf81('0x2f')](_0x1b353d[_0xbf81('0x2b')],_0x1b353d[_0xbf81('0x2c')]);_0x2cb23d[_0xbf81('0x30')]=_[_0xbf81('0x2f')](_0x1b353d[_0xbf81('0x2b')],qs['fields'](_0x3ebee4[_0xbf81('0x2c')][_0xbf81('0x31')]));_0x2cb23d[_0xbf81('0x30')]=_0x2cb23d[_0xbf81('0x30')][_0xbf81('0x32')]?_0x2cb23d[_0xbf81('0x30')]:_0x1b353d['model'];if(!_0x3ebee4[_0xbf81('0x2c')]['hasOwnProperty'](_0xbf81('0x33'))){_0x2cb23d[_0xbf81('0x1b')]=qs[_0xbf81('0x1b')](_0x3ebee4['query']['limit']);_0x2cb23d[_0xbf81('0x1a')]=qs[_0xbf81('0x1a')](_0x3ebee4['query']['offset']);}_0x2cb23d['order']=qs['sort'](_0x3ebee4[_0xbf81('0x2c')][_0xbf81('0x34')]);_0x2cb23d['where']=qs[_0xbf81('0x2e')](_[_0xbf81('0x35')](_0x3ebee4['query'],_0x1b353d[_0xbf81('0x2e')]),_0xb4532e);if(_0x3ebee4[_0xbf81('0x2c')][_0xbf81('0x36')]){_0x2cb23d[_0xbf81('0x37')]=_[_0xbf81('0x38')](_0x2cb23d[_0xbf81('0x37')],{'$or':_[_0xbf81('0x39')](_0xb4532e,function(_0x384120){if(_0x384120[_0xbf81('0x29')]!=='VIRTUAL'){var _0x229337={};_0x229337[_0x384120[_0xbf81('0x24')]]={'$like':'%'+_0x3ebee4['query']['filter']+'%'};return _0x229337;}})});}_0x2cb23d=_['merge']({},_0x2cb23d,_0x3ebee4[_0xbf81('0x3a')]);var _0x12f04e={'where':_0x2cb23d[_0xbf81('0x37')]};return db[_0xbf81('0x3b')][_0xbf81('0x1d')](_0x12f04e)['then'](function(_0x55c045){_0x71d0ef[_0xbf81('0x1d')]=_0x55c045;if(_0x3ebee4[_0xbf81('0x2c')][_0xbf81('0x3c')]){_0x2cb23d[_0xbf81('0x3d')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0xbf81('0x3e')](_0x2cb23d);})['then'](function(_0x1df87a){_0x71d0ef[_0xbf81('0x3f')]=_0x1df87a;return _0x71d0ef;})[_0xbf81('0x21')](respondWithFilteredResult(_0x883587,_0x2cb23d))[_0xbf81('0x40')](handleError(_0x883587,null));};exports['show']=function(_0xed6217,_0x3f9797){var _0x4268e7={'raw':!![],'where':{'id':_0xed6217['params']['id']}},_0x194be1={};_0x194be1[_0xbf81('0x2b')]=_['keys'](db[_0xbf81('0x3b')][_0xbf81('0x27')]);_0x194be1[_0xbf81('0x2c')]=_['keys'](_0xed6217[_0xbf81('0x2c')]);_0x194be1[_0xbf81('0x2e')]=_[_0xbf81('0x2f')](_0x194be1['model'],_0x194be1[_0xbf81('0x2c')]);_0x4268e7[_0xbf81('0x30')]=_[_0xbf81('0x2f')](_0x194be1['model'],qs[_0xbf81('0x31')](_0xed6217[_0xbf81('0x2c')][_0xbf81('0x31')]));_0x4268e7[_0xbf81('0x30')]=_0x4268e7[_0xbf81('0x30')][_0xbf81('0x32')]?_0x4268e7[_0xbf81('0x30')]:_0x194be1[_0xbf81('0x2b')];if(_0xed6217[_0xbf81('0x2c')][_0xbf81('0x3c')]){_0x4268e7[_0xbf81('0x3d')]=[{'all':!![]}];}_0x4268e7=_['merge']({},_0x4268e7,_0xed6217[_0xbf81('0x3a')]);return db[_0xbf81('0x3b')][_0xbf81('0x41')](_0x4268e7)['then'](handleEntityNotFound(_0x3f9797,null))['then'](respondWithResult(_0x3f9797,null))[_0xbf81('0x40')](handleError(_0x3f9797,null));};exports['create']=function(_0x256a25,_0x47b981){return db[_0xbf81('0x3b')][_0xbf81('0x42')](_0x256a25[_0xbf81('0x43')],{})[_0xbf81('0x21')](respondWithResult(_0x47b981,0xc9))[_0xbf81('0x40')](handleError(_0x47b981,null));};exports[_0xbf81('0x20')]=function(_0x553b7d,_0x296698){if(_0x553b7d['body']['id']){delete _0x553b7d[_0xbf81('0x43')]['id'];}return db[_0xbf81('0x3b')][_0xbf81('0x41')]({'where':{'id':_0x553b7d[_0xbf81('0x44')]['id']}})[_0xbf81('0x21')](handleEntityNotFound(_0x296698,null))[_0xbf81('0x21')](saveUpdates(_0x553b7d[_0xbf81('0x43')],null))['then'](respondWithResult(_0x296698,null))['catch'](handleError(_0x296698,null));};exports[_0xbf81('0x45')]=function(_0x39e6c8,_0x294ba7){return db['SquareDetailsReport'][_0xbf81('0x41')]({'where':{'id':_0x39e6c8[_0xbf81('0x44')]['id']}})[_0xbf81('0x21')](handleEntityNotFound(_0x294ba7,null))['then'](removeEntity(_0x294ba7,null))[_0xbf81('0x40')](handleError(_0x294ba7,null));};exports[_0xbf81('0x46')]=function(_0x4cece9,_0x997a23){return db[_0xbf81('0x3b')][_0xbf81('0x46')]()['then'](respondWithResult(_0x997a23,null))[_0xbf81('0x40')](handleError(_0x997a23,null));}; \ No newline at end of file +var _0xb5aa=['save','destroy','then','error','stack','name','index','rawAttributes','type','key','map','keys','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','SquareDetailsReport','rows','catch','show','length','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','count','limit','status','Content-Range','reject'];(function(_0x1aba25,_0x1faed1){var _0x47d997=function(_0x4f9e11){while(--_0x4f9e11){_0x1aba25['push'](_0x1aba25['shift']());}};_0x47d997(++_0x1faed1);}(_0xb5aa,0x1e7));var _0xab5a=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xb5aa[_0x5f3f88];return _0xd08119;};'use strict';var emlformat=require(_0xab5a('0x0'));var rimraf=require(_0xab5a('0x1'));var zipdir=require(_0xab5a('0x2'));var jsonpatch=require(_0xab5a('0x3'));var rp=require(_0xab5a('0x4'));var moment=require(_0xab5a('0x5'));var BPromise=require(_0xab5a('0x6'));var Mustache=require(_0xab5a('0x7'));var util=require('util');var path=require(_0xab5a('0x8'));var sox=require(_0xab5a('0x9'));var csv=require('to-csv');var ejs=require(_0xab5a('0xa'));var fs=require('fs');var fs_extra=require(_0xab5a('0xb'));var _=require(_0xab5a('0xc'));var squel=require(_0xab5a('0xd'));var crypto=require(_0xab5a('0xe'));var jsforce=require(_0xab5a('0xf'));var deskjs=require(_0xab5a('0x10'));var toCsv=require(_0xab5a('0x11'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xab5a('0x12'));var authService=require(_0xab5a('0x13'));var qs=require(_0xab5a('0x14'));var as=require(_0xab5a('0x15'));var hardwareService=require(_0xab5a('0x16'));var logger=require(_0xab5a('0x17'))(_0xab5a('0x18'));var utils=require(_0xab5a('0x19'));var config=require(_0xab5a('0x1a'));var licenseUtil=require(_0xab5a('0x1b'));var db=require(_0xab5a('0x1c'))['db'];function respondWithStatusCode(_0x17383d,_0x1167e6){_0x1167e6=_0x1167e6||0xcc;return function(_0x115571){if(_0x115571){return _0x17383d[_0xab5a('0x1d')](_0x1167e6);}return _0x17383d['status'](_0x1167e6)[_0xab5a('0x1e')]();};}function respondWithResult(_0x2da301,_0x2d073a){_0x2d073a=_0x2d073a||0xc8;return function(_0x3ed75f){if(_0x3ed75f){return _0x2da301['status'](_0x2d073a)['json'](_0x3ed75f);}};}function respondWithFilteredResult(_0x47a375,_0x348091){return function(_0x490c20){if(_0x490c20){var _0x3ab6ab=typeof _0x348091[_0xab5a('0x1f')]===_0xab5a('0x20')&&typeof _0x348091['limit']===_0xab5a('0x20');var _0x28c45d=_0x490c20[_0xab5a('0x21')];var _0x142db3=_0x3ab6ab?0x0:_0x348091[_0xab5a('0x1f')];var _0x4163ff=_0x3ab6ab?_0x490c20['count']:_0x348091[_0xab5a('0x1f')]+_0x348091[_0xab5a('0x22')];var _0x29b74c;if(_0x4163ff>=_0x28c45d){_0x4163ff=_0x28c45d;_0x29b74c=0xc8;}else{_0x29b74c=0xce;}_0x47a375[_0xab5a('0x23')](_0x29b74c);return _0x47a375['set'](_0xab5a('0x24'),_0x142db3+'-'+_0x4163ff+'/'+_0x28c45d)['json'](_0x490c20);}return null;};}function patchUpdates(_0x396df1){return function(_0x3cc0dd){try{jsonpatch['apply'](_0x3cc0dd,_0x396df1,!![]);}catch(_0x218f20){return BPromise[_0xab5a('0x25')](_0x218f20);}return _0x3cc0dd[_0xab5a('0x26')]();};}function saveUpdates(_0x51099f,_0x35fd2e){return function(_0x22eea8){if(_0x22eea8){return _0x22eea8['update'](_0x51099f)['then'](function(_0x382c16){return _0x382c16;});}return null;};}function removeEntity(_0x220d74,_0x2538d7){return function(_0x240ef3){if(_0x240ef3){return _0x240ef3[_0xab5a('0x27')]()[_0xab5a('0x28')](function(){_0x220d74[_0xab5a('0x23')](0xcc)[_0xab5a('0x1e')]();});}};}function handleEntityNotFound(_0x25ff07,_0x44f5e9){return function(_0x5de842){if(!_0x5de842){_0x25ff07[_0xab5a('0x1d')](0x194);}return _0x5de842;};}function handleError(_0x23b783,_0x3e4de1){_0x3e4de1=_0x3e4de1||0x1f4;return function(_0x5dd8e4){logger[_0xab5a('0x29')](_0x5dd8e4[_0xab5a('0x2a')]);if(_0x5dd8e4[_0xab5a('0x2b')]){delete _0x5dd8e4[_0xab5a('0x2b')];}_0x23b783[_0xab5a('0x23')](_0x3e4de1)['send'](_0x5dd8e4);};}exports[_0xab5a('0x2c')]=function(_0x14d1a2,_0x4a59ff){var _0xe5def5={},_0x49550d={},_0x22725d={'count':0x0,'rows':[]};var _0x5c472d=_['map'](db['SquareDetailsReport'][_0xab5a('0x2d')],function(_0x35e7de){return{'name':_0x35e7de['fieldName'],'type':_0x35e7de[_0xab5a('0x2e')][_0xab5a('0x2f')]};});_0x49550d['model']=_[_0xab5a('0x30')](_0x5c472d,_0xab5a('0x2b'));_0x49550d['query']=_[_0xab5a('0x31')](_0x14d1a2[_0xab5a('0x32')]);_0x49550d[_0xab5a('0x33')]=_[_0xab5a('0x34')](_0x49550d[_0xab5a('0x35')],_0x49550d[_0xab5a('0x32')]);_0xe5def5[_0xab5a('0x36')]=_[_0xab5a('0x34')](_0x49550d[_0xab5a('0x35')],qs['fields'](_0x14d1a2[_0xab5a('0x32')][_0xab5a('0x37')]));_0xe5def5[_0xab5a('0x36')]=_0xe5def5[_0xab5a('0x36')]['length']?_0xe5def5['attributes']:_0x49550d['model'];if(!_0x14d1a2['query']['hasOwnProperty'](_0xab5a('0x38'))){_0xe5def5['limit']=qs[_0xab5a('0x22')](_0x14d1a2[_0xab5a('0x32')][_0xab5a('0x22')]);_0xe5def5[_0xab5a('0x1f')]=qs[_0xab5a('0x1f')](_0x14d1a2['query']['offset']);}_0xe5def5[_0xab5a('0x39')]=qs[_0xab5a('0x3a')](_0x14d1a2[_0xab5a('0x32')]['sort']);_0xe5def5[_0xab5a('0x3b')]=qs[_0xab5a('0x33')](_[_0xab5a('0x3c')](_0x14d1a2[_0xab5a('0x32')],_0x49550d[_0xab5a('0x33')]),_0x5c472d);if(_0x14d1a2[_0xab5a('0x32')]['filter']){_0xe5def5[_0xab5a('0x3b')]=_['merge'](_0xe5def5['where'],{'$or':_['map'](_0x5c472d,function(_0x340039){if(_0x340039[_0xab5a('0x2e')]!==_0xab5a('0x3d')){var _0x35dde3={};_0x35dde3[_0x340039[_0xab5a('0x2b')]]={'$like':'%'+_0x14d1a2[_0xab5a('0x32')][_0xab5a('0x3e')]+'%'};return _0x35dde3;}})});}_0xe5def5=_['merge']({},_0xe5def5,_0x14d1a2[_0xab5a('0x3f')]);var _0x23a803={'where':_0xe5def5[_0xab5a('0x3b')]};return db['SquareDetailsReport'][_0xab5a('0x21')](_0x23a803)[_0xab5a('0x28')](function(_0x55c9e8){_0x22725d[_0xab5a('0x21')]=_0x55c9e8;if(_0x14d1a2[_0xab5a('0x32')][_0xab5a('0x40')]){_0xe5def5[_0xab5a('0x41')]=[{'all':!![]}];}return db[_0xab5a('0x42')]['findAll'](_0xe5def5);})[_0xab5a('0x28')](function(_0x3ef1c5){_0x22725d[_0xab5a('0x43')]=_0x3ef1c5;return _0x22725d;})[_0xab5a('0x28')](respondWithFilteredResult(_0x4a59ff,_0xe5def5))[_0xab5a('0x44')](handleError(_0x4a59ff,null));};exports[_0xab5a('0x45')]=function(_0x30a76f,_0x36ca55){var _0x3cd8f6={'raw':!![],'where':{'id':_0x30a76f['params']['id']}},_0x29fe53={};_0x29fe53[_0xab5a('0x35')]=_['keys'](db[_0xab5a('0x42')][_0xab5a('0x2d')]);_0x29fe53['query']=_[_0xab5a('0x31')](_0x30a76f['query']);_0x29fe53[_0xab5a('0x33')]=_['intersection'](_0x29fe53[_0xab5a('0x35')],_0x29fe53[_0xab5a('0x32')]);_0x3cd8f6[_0xab5a('0x36')]=_['intersection'](_0x29fe53[_0xab5a('0x35')],qs[_0xab5a('0x37')](_0x30a76f[_0xab5a('0x32')]['fields']));_0x3cd8f6[_0xab5a('0x36')]=_0x3cd8f6[_0xab5a('0x36')][_0xab5a('0x46')]?_0x3cd8f6[_0xab5a('0x36')]:_0x29fe53[_0xab5a('0x35')];if(_0x30a76f[_0xab5a('0x32')][_0xab5a('0x40')]){_0x3cd8f6[_0xab5a('0x41')]=[{'all':!![]}];}_0x3cd8f6=_['merge']({},_0x3cd8f6,_0x30a76f[_0xab5a('0x3f')]);return db['SquareDetailsReport'][_0xab5a('0x47')](_0x3cd8f6)[_0xab5a('0x28')](handleEntityNotFound(_0x36ca55,null))[_0xab5a('0x28')](respondWithResult(_0x36ca55,null))['catch'](handleError(_0x36ca55,null));};exports[_0xab5a('0x48')]=function(_0x44ef03,_0x31b328){return db[_0xab5a('0x42')][_0xab5a('0x48')](_0x44ef03[_0xab5a('0x49')],{})[_0xab5a('0x28')](respondWithResult(_0x31b328,0xc9))[_0xab5a('0x44')](handleError(_0x31b328,null));};exports['update']=function(_0x460796,_0x1068a1){if(_0x460796[_0xab5a('0x49')]['id']){delete _0x460796[_0xab5a('0x49')]['id'];}return db[_0xab5a('0x42')][_0xab5a('0x47')]({'where':{'id':_0x460796[_0xab5a('0x4a')]['id']}})[_0xab5a('0x28')](handleEntityNotFound(_0x1068a1,null))[_0xab5a('0x28')](saveUpdates(_0x460796[_0xab5a('0x49')],null))['then'](respondWithResult(_0x1068a1,null))['catch'](handleError(_0x1068a1,null));};exports[_0xab5a('0x27')]=function(_0x226dac,_0x23ea7e){return db[_0xab5a('0x42')][_0xab5a('0x47')]({'where':{'id':_0x226dac[_0xab5a('0x4a')]['id']}})[_0xab5a('0x28')](handleEntityNotFound(_0x23ea7e,null))[_0xab5a('0x28')](removeEntity(_0x23ea7e,null))['catch'](handleError(_0x23ea7e,null));};exports['describe']=function(_0x57f349,_0x21195f){return db[_0xab5a('0x42')]['describe']()[_0xab5a('0x28')](respondWithResult(_0x21195f,null))['catch'](handleError(_0x21195f,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 59a5fc7..1769d02 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 _0x1f02=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details'];(function(_0xaf3247,_0x39e1bf){var _0x4eea43=function(_0x1225dd){while(--_0x1225dd){_0xaf3247['push'](_0xaf3247['shift']());}};_0x4eea43(++_0x39e1bf);}(_0x1f02,0x120));var _0x21f0=function(_0x536c7b,_0x3a92e1){_0x536c7b=_0x536c7b-0x0;var _0x54ab48=_0x1f02[_0x536c7b];return _0x54ab48;};'use strict';var _=require('lodash');var util=require(_0x21f0('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x21f0('0x1'));var BPromise=require(_0x21f0('0x2'));var rp=require(_0x21f0('0x3'));var fs=require('fs');var path=require(_0x21f0('0x4'));var rimraf=require(_0x21f0('0x5'));var config=require(_0x21f0('0x6'));var attributes=require(_0x21f0('0x7'));module[_0x21f0('0x8')]=function(_0x2aad88,_0x56d1cb){return _0x2aad88[_0x21f0('0x9')](_0x21f0('0xa'),attributes,{'tableName':_0x21f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d1c=['./squareReportDetail.attributes','exports','define','SquareDetailsReport','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2b7d3f,_0x245981){var _0x3acff6=function(_0x324e5b){while(--_0x324e5b){_0x2b7d3f['push'](_0x2b7d3f['shift']());}};_0x3acff6(++_0x245981);}(_0x6d1c,0x1d2));var _0xc6d1=function(_0x43a6cd,_0x503d1a){_0x43a6cd=_0x43a6cd-0x0;var _0x5acb36=_0x6d1c[_0x43a6cd];return _0x5acb36;};'use strict';var _=require('lodash');var util=require(_0xc6d1('0x0'));var logger=require(_0xc6d1('0x1'))('api');var moment=require(_0xc6d1('0x2'));var BPromise=require(_0xc6d1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc6d1('0x4'));var rimraf=require(_0xc6d1('0x5'));var config=require(_0xc6d1('0x6'));var attributes=require(_0xc6d1('0x7'));module[_0xc6d1('0x8')]=function(_0x73ebe0,_0x459627){return _0x73ebe0[_0xc6d1('0x9')](_0xc6d1('0xa'),attributes,{'tableName':'report_square_details','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 0401f38..5138cdf 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 _0xb62e=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','then','lodash','util'];(function(_0x275362,_0x14f7a3){var _0x290e67=function(_0x47487b){while(--_0x47487b){_0x275362['push'](_0x275362['shift']());}};_0x290e67(++_0x14f7a3);}(_0xb62e,0x1de));var _0xeb62=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb62e[_0x3bf83f];return _0x22c4a9;};'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')]('SquareDetailsReport,\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')]['create'](_0x39b138[_0xeb62('0x1a')],{'raw':_0x39b138[_0xeb62('0x1b')]?_0x39b138[_0xeb62('0x1b')][_0xeb62('0x1c')]===undefined?!![]:![]:!![]})[_0xeb62('0x1d')](function(_0x24cbf3){logger[_0xeb62('0xd')]('CreateSquareDetailsReport',_0x39b138);logger['debug'](_0xeb62('0x18'),_0x39b138,JSON[_0xeb62('0x12')](_0x24cbf3));_0x27efc8(_0x24cbf3);})[_0xeb62('0x17')](function(_0x13243f){logger[_0xeb62('0x13')]('CreateSquareDetailsReport',_0x13243f['message'],_0x39b138);_0x11d516(_0x27fd84[_0xeb62('0x13')](0x1f4,_0x13243f[_0xeb62('0x15')]));});});}; \ No newline at end of file +var _0xa478=['rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','error','code','message','SquareDetailsReport,\x20%s,\x20%s','result','catch','CreateSquareDetailsReport','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2f6d9f,_0x21249b){var _0x259839=function(_0x3b97a9){while(--_0x3b97a9){_0x2f6d9f['push'](_0x2f6d9f['shift']());}};_0x259839(++_0x21249b);}(_0xa478,0x136));var _0x8a47=function(_0x5f382f,_0x3f1432){_0x5f382f=_0x5f382f-0x0;var _0x3bb11b=_0xa478[_0x5f382f];return _0x3bb11b;};'use strict';var _=require(_0x8a47('0x0'));var util=require(_0x8a47('0x1'));var moment=require(_0x8a47('0x2'));var BPromise=require(_0x8a47('0x3'));var rs=require(_0x8a47('0x4'));var fs=require('fs');var Redis=require(_0x8a47('0x5'));var db=require(_0x8a47('0x6'))['db'];var utils=require(_0x8a47('0x7'));var logger=require(_0x8a47('0x8'))(_0x8a47('0x9'));var config=require(_0x8a47('0xa'));var jayson=require(_0x8a47('0xb'));var client=jayson['client'][_0x8a47('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d62a6,_0x3de815,_0x3cb340){return new BPromise(function(_0x56884b,_0x384886){return client['request'](_0x2d62a6,_0x3cb340)[_0x8a47('0xd')](function(_0x369fc9){logger[_0x8a47('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x3de815,_0x8a47('0xf'));logger[_0x8a47('0x10')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x3de815,_0x8a47('0xf'),JSON['stringify'](_0x369fc9));if(_0x369fc9[_0x8a47('0x11')]){if(_0x369fc9[_0x8a47('0x11')][_0x8a47('0x12')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x3de815,_0x369fc9['error'][_0x8a47('0x13')]);return _0x384886(_0x369fc9[_0x8a47('0x11')]['message']);}logger[_0x8a47('0x11')](_0x8a47('0x14'),_0x3de815,_0x369fc9[_0x8a47('0x11')][_0x8a47('0x13')]);return _0x56884b(_0x369fc9[_0x8a47('0x11')][_0x8a47('0x13')]);}else{logger[_0x8a47('0xe')](_0x8a47('0x14'),_0x3de815,_0x8a47('0xf'));_0x56884b(_0x369fc9[_0x8a47('0x15')][_0x8a47('0x13')]);}})[_0x8a47('0x16')](function(_0x2917d9){logger['error'](_0x8a47('0x14'),_0x3de815,_0x2917d9);_0x384886(_0x2917d9);});});}exports[_0x8a47('0x17')]=function(_0x3f9093){var _0x5f5884=this;return new Promise(function(_0x341089,_0x5c62eb){return db['SquareDetailsReport'][_0x8a47('0x18')](_0x3f9093[_0x8a47('0x19')],{'raw':_0x3f9093[_0x8a47('0x1a')]?_0x3f9093[_0x8a47('0x1a')][_0x8a47('0x1b')]===undefined?!![]:![]:!![]})[_0x8a47('0xd')](function(_0x44e119){logger[_0x8a47('0xe')](_0x8a47('0x17'),_0x3f9093);logger[_0x8a47('0x10')]('CreateSquareDetailsReport',_0x3f9093,JSON[_0x8a47('0x1c')](_0x44e119));_0x341089(_0x44e119);})['catch'](function(_0x289f28){logger[_0x8a47('0x11')](_0x8a47('0x17'),_0x289f28[_0x8a47('0x13')],_0x3f9093);_0x5c62eb(_0x5f5884['error'](0x1f4,_0x289f28[_0x8a47('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 952547d..47a1fa9 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 _0x71cc=['index','killProcess','exports','express','Router','./system.controller','get','isAuthenticated'];(function(_0x195223,_0x121404){var _0x3a62dd=function(_0x3adeda){while(--_0x3adeda){_0x195223['push'](_0x195223['shift']());}};_0x3a62dd(++_0x121404);}(_0x71cc,0x1d3));var _0xc71c=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0x71cc[_0x5a79e2];return _0x266c45;};'use strict';var express=require(_0xc71c('0x0'));var router=express[_0xc71c('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xc71c('0x2'));router[_0xc71c('0x3')]('/',auth[_0xc71c('0x4')](),controller[_0xc71c('0x5')]);router[_0xc71c('0x3')]('/process/:pid/kill',auth[_0xc71c('0x4')](),controller[_0xc71c('0x6')]);module[_0xc71c('0x7')]=router; \ No newline at end of file +var _0x4c21=['./system.controller','isAuthenticated','/process/:pid/kill','killProcess','Router','../../components/auth/service'];(function(_0x4f938b,_0x3073c7){var _0x40846d=function(_0x501b64){while(--_0x501b64){_0x4f938b['push'](_0x4f938b['shift']());}};_0x40846d(++_0x3073c7);}(_0x4c21,0x82));var _0x14c2=function(_0x164df2,_0x4083ee){_0x164df2=_0x164df2-0x0;var _0x4abfa1=_0x4c21[_0x164df2];return _0x4abfa1;};'use strict';var express=require('express');var router=express[_0x14c2('0x0')]();var auth=require(_0x14c2('0x1'));var controller=require(_0x14c2('0x2'));router['get']('/',auth[_0x14c2('0x3')](),controller['index']);router['get'](_0x14c2('0x4'),auth[_0x14c2('0x3')](),controller[_0x14c2('0x5')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 069268c..d46b414 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 _0xbc71=['<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','index','then','json','catch','killProcess','components/import/cm','format','params','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','api','bluebird'];(function(_0x282ccc,_0x5d66a1){var _0x27c2dd=function(_0x58431a){while(--_0x58431a){_0x282ccc['push'](_0x282ccc['shift']());}};_0x27c2dd(++_0x5d66a1);}(_0xbc71,0x86));var _0x1bc7=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xbc71[_0x1e7b16];return _0x37fadc;};'use strict';var info=require(_0x1bc7('0x0'));var exec=require('child_process')[_0x1bc7('0x1')];var logger=require('../../config/logger')(_0x1bc7('0x2'));var util=require('util');var BPromise=require(_0x1bc7('0x3'));var _=require('lodash');function handleError(_0x53114e,_0x3d1933,_0x44b683){_0x3d1933=_0x3d1933||0x1f4;return function(_0x8dc633){logger['error'](_0x1bc7('0x4'),_0x44b683,_0x3d1933,util[_0x1bc7('0x5')](_0x8dc633,{'showHidden':![],'depth':null}));delete _0x8dc633[_0x1bc7('0x6')];_0x53114e[_0x1bc7('0x7')](_0x3d1933)['send'](_0x8dc633);};}exports[_0x1bc7('0x8')]=function(_0x5bd4b4,_0x31be00){return info['getAllData']()[_0x1bc7('0x9')](function(_0x3ccd0d){return _0x31be00['status'](0xc8)[_0x1bc7('0xa')](_0x3ccd0d);})[_0x1bc7('0xb')](function(_0xe56a1b){return _0x31be00[_0x1bc7('0x7')](0x1f4)['json'](_0xe56a1b);});};exports[_0x1bc7('0xc')]=function(_0x31429d,_0x578584){var _0x25d68c=[_0x1bc7('0xd')];return new BPromise(function(_0x617145,_0x253f89){return exec(util[_0x1bc7('0xe')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x31429d[_0x1bc7('0xf')]['pid']),function(_0x49b1e3,_0x5ce0ac,_0x2d94d3){if(_0x49b1e3){return _0x253f89(_0x49b1e3);}return _0x617145(_0x5ce0ac);});})[_0x1bc7('0x9')](function(_0x4802fa){var _0x1ee9d4=![];var _0x5d3e1f=_0x4802fa[_0x1bc7('0x10')](/\n/);for(var _0x5d8045=0x0,_0x5806f1=_0x25d68c[_0x1bc7('0x11')];_0x5d8045<_0x5806f1,_0x1ee9d4===![];_0x5d8045+=0x1){if(_0x4802fa[_0x1bc7('0x12')](_0x25d68c[_0x5d8045])>=0x0){_0x1ee9d4=!![];}}if(!_0x1ee9d4){throw new Error(util[_0x1bc7('0xe')](_0x1bc7('0x13'),_0x31429d[_0x1bc7('0xf')][_0x1bc7('0x14')]));}process[_0x1bc7('0x15')](_0x31429d[_0x1bc7('0xf')][_0x1bc7('0x14')],'SIGINT');return _0x578584[_0x1bc7('0x7')](0xc8)[_0x1bc7('0xa')]({'message':util['format'](_0x1bc7('0x16'),_0x31429d[_0x1bc7('0xf')][_0x1bc7('0x14')])});})[_0x1bc7('0xb')](handleError(_0x578584,null,_0x1bc7('0xc')));}; \ No newline at end of file +var _0xd5bd=['getAllData','json','catch','killProcess','format','params','pid','then','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','index'];(function(_0x439cea,_0x115a1c){var _0x55f8a9=function(_0x3ed1cd){while(--_0x3ed1cd){_0x439cea['push'](_0x439cea['shift']());}};_0x55f8a9(++_0x115a1c);}(_0xd5bd,0xfe));var _0xdd5b=function(_0x6be190,_0x25e8dd){_0x6be190=_0x6be190-0x0;var _0x3867df=_0xd5bd[_0x6be190];return _0x3867df;};'use strict';var info=require(_0xdd5b('0x0'));var exec=require('child_process')['exec'];var logger=require('../../config/logger')('api');var util=require(_0xdd5b('0x1'));var BPromise=require(_0xdd5b('0x2'));var _=require(_0xdd5b('0x3'));function handleError(_0x5f4ae2,_0x5192f1,_0xa35fa3){_0x5192f1=_0x5192f1||0x1f4;return function(_0x4b9d36){logger[_0xdd5b('0x4')](_0xdd5b('0x5'),_0xa35fa3,_0x5192f1,util[_0xdd5b('0x6')](_0x4b9d36,{'showHidden':![],'depth':null}));delete _0x4b9d36[_0xdd5b('0x7')];_0x5f4ae2[_0xdd5b('0x8')](_0x5192f1)['send'](_0x4b9d36);};}exports[_0xdd5b('0x9')]=function(_0x55d0ee,_0x228886){return info[_0xdd5b('0xa')]()['then'](function(_0x662dce){return _0x228886[_0xdd5b('0x8')](0xc8)[_0xdd5b('0xb')](_0x662dce);})[_0xdd5b('0xc')](function(_0x38c3f1){return _0x228886[_0xdd5b('0x8')](0x1f4)[_0xdd5b('0xb')](_0x38c3f1);});};exports[_0xdd5b('0xd')]=function(_0x55004d,_0x17e96c){var _0x291a3e=['components/import/cm'];return new BPromise(function(_0x523ef1,_0x2f8aeb){return exec(util[_0xdd5b('0xe')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x55004d[_0xdd5b('0xf')][_0xdd5b('0x10')]),function(_0x17779e,_0x19d319,_0x126875){if(_0x17779e){return _0x2f8aeb(_0x17779e);}return _0x523ef1(_0x19d319);});})[_0xdd5b('0x11')](function(_0xe4e8e9){var _0x429c26=![];var _0x47d55b=_0xe4e8e9[_0xdd5b('0x12')](/\n/);for(var _0x2b3ebd=0x0,_0xea0036=_0x291a3e['length'];_0x2b3ebd<_0xea0036,_0x429c26===![];_0x2b3ebd+=0x1){if(_0xe4e8e9[_0xdd5b('0x13')](_0x291a3e[_0x2b3ebd])>=0x0){_0x429c26=!![];}}if(!_0x429c26){throw new Error(util[_0xdd5b('0xe')](_0xdd5b('0x14'),_0x55004d['params'][_0xdd5b('0x10')]));}process[_0xdd5b('0x15')](_0x55004d[_0xdd5b('0xf')][_0xdd5b('0x10')],_0xdd5b('0x16'));return _0x17e96c[_0xdd5b('0x8')](0xc8)[_0xdd5b('0xb')]({'message':util['format'](_0xdd5b('0x17'),_0x55004d[_0xdd5b('0xf')][_0xdd5b('0x10')])});})[_0xdd5b('0xc')](handleError(_0x17e96c,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 6f39701..2adddf1 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 _0xd54d=['fs-extra','../../components/interaction/service','./tag.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','path','Router'];(function(_0x5a9ec1,_0x207880){var _0x27927c=function(_0x3869e0){while(--_0x3869e0){_0x5a9ec1['push'](_0x5a9ec1['shift']());}};_0x27927c(++_0x207880);}(_0xd54d,0x6e));var _0xdd54=function(_0xeadb4,_0x19523a){_0xeadb4=_0xeadb4-0x0;var _0xe86888=_0xd54d[_0xeadb4];return _0xe86888;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdd54('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdd54('0x1')]();var fs_extra=require(_0xdd54('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xdd54('0x3'));var config=require('../../config/environment');var controller=require(_0xdd54('0x4'));router[_0xdd54('0x5')]('/',auth[_0xdd54('0x6')](),controller[_0xdd54('0x7')]);router[_0xdd54('0x5')](_0xdd54('0x8'),auth[_0xdd54('0x6')](),controller[_0xdd54('0x9')]);router[_0xdd54('0xa')]('/',auth[_0xdd54('0x6')](),controller[_0xdd54('0xb')]);router[_0xdd54('0xc')](_0xdd54('0x8'),auth[_0xdd54('0x6')](),controller[_0xdd54('0xd')]);router[_0xdd54('0xe')](_0xdd54('0x8'),auth[_0xdd54('0x6')](),controller[_0xdd54('0xf')]);module['exports']=router; \ No newline at end of file +var _0x57d5=['delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','post','create','update'];(function(_0x13949c,_0x6328b9){var _0x260039=function(_0x31f4d5){while(--_0x31f4d5){_0x13949c['push'](_0x13949c['shift']());}};_0x260039(++_0x6328b9);}(_0x57d5,0x192));var _0x557d=function(_0x237546,_0xa81b26){_0x237546=_0x237546-0x0;var _0x233e29=_0x57d5[_0x237546];return _0x233e29;};'use strict';var multer=require(_0x557d('0x0'));var util=require(_0x557d('0x1'));var path=require('path');var timeout=require(_0x557d('0x2'));var express=require(_0x557d('0x3'));var router=express[_0x557d('0x4')]();var fs_extra=require(_0x557d('0x5'));var auth=require(_0x557d('0x6'));var interaction=require(_0x557d('0x7'));var config=require(_0x557d('0x8'));var controller=require(_0x557d('0x9'));router[_0x557d('0xa')]('/',auth[_0x557d('0xb')](),controller[_0x557d('0xc')]);router[_0x557d('0xa')](_0x557d('0xd'),auth[_0x557d('0xb')](),controller[_0x557d('0xe')]);router[_0x557d('0xf')]('/',auth['isAuthenticated'](),controller[_0x557d('0x10')]);router['put']('/:id',auth[_0x557d('0xb')](),controller[_0x557d('0x11')]);router[_0x557d('0x12')](_0x557d('0xd'),auth[_0x557d('0xb')](),controller['destroy']);module[_0x557d('0x13')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index d07144e..f36461f 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 _0x180d=['#0091EA','exports','STRING','name'];(function(_0x3f4315,_0x4ace96){var _0x1945cb=function(_0x45eb1f){while(--_0x45eb1f){_0x3f4315['push'](_0x3f4315['shift']());}};_0x1945cb(++_0x4ace96);}(_0x180d,0xf9));var _0xd180=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x180d[_0x4b7895];return _0x264180;};'use strict';var Sequelize=require('sequelize');module[_0xd180('0x0')]={'name':{'type':Sequelize[_0xd180('0x1')],'unique':_0xd180('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xd180('0x1')],'defaultValue':_0xd180('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x09dd=['STRING','name','#0091EA','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x09dd,0xb7));var _0xd09d=function(_0xf94131,_0x58b63d){_0xf94131=_0xf94131-0x0;var _0xdf5c19=_0x09dd[_0xf94131];return _0xdf5c19;};'use strict';var Sequelize=require(_0xd09d('0x0'));module[_0xd09d('0x1')]={'name':{'type':Sequelize[_0xd09d('0x2')],'unique':_0xd09d('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xd09d('0x2')],'defaultValue':_0xd09d('0x4')},'description':{'type':Sequelize[_0xd09d('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 9094245..3dc4d72 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 _0x6737=['error','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','update','then','destroy','get','Tags','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','options','Tag','include','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6737,0xe2));var _0x7673=function(_0x2dead3,_0x24020c){_0x2dead3=_0x2dead3-0x0;var _0x12a04b=_0x6737[_0x2dead3];return _0x12a04b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7673('0x0'));var zipdir=require(_0x7673('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7673('0x2'));var moment=require(_0x7673('0x3'));var BPromise=require(_0x7673('0x4'));var Mustache=require(_0x7673('0x5'));var util=require('util');var path=require(_0x7673('0x6'));var sox=require(_0x7673('0x7'));var csv=require('to-csv');var ejs=require(_0x7673('0x8'));var fs=require('fs');var fs_extra=require(_0x7673('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7673('0xa'));var toCsv=require('to-csv');var querystring=require(_0x7673('0xb'));var Papa=require(_0x7673('0xc'));var Redis=require('ioredis');var authService=require(_0x7673('0xd'));var qs=require(_0x7673('0xe'));var as=require(_0x7673('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7673('0x10'));var utils=require('../../config/utils');var config=require(_0x7673('0x11'));var licenseUtil=require(_0x7673('0x12'));var db=require(_0x7673('0x13'))['db'];function respondWithStatusCode(_0x451c87,_0x41d6bd){_0x41d6bd=_0x41d6bd||0xcc;return function(_0x119e42){if(_0x119e42){return _0x451c87[_0x7673('0x14')](_0x41d6bd);}return _0x451c87[_0x7673('0x15')](_0x41d6bd)[_0x7673('0x16')]();};}function respondWithResult(_0x20a649,_0x5c8626){_0x5c8626=_0x5c8626||0xc8;return function(_0x26f0c4){if(_0x26f0c4){return _0x20a649[_0x7673('0x15')](_0x5c8626)[_0x7673('0x17')](_0x26f0c4);}};}function respondWithFilteredResult(_0x2c83d,_0x224cea){return function(_0x2e83c4){if(_0x2e83c4){var _0x2a2840=typeof _0x224cea['offset']==='undefined'&&typeof _0x224cea[_0x7673('0x18')]===_0x7673('0x19');var _0x50f8d9=_0x2e83c4[_0x7673('0x1a')];var _0x17699a=_0x2a2840?0x0:_0x224cea['offset'];var _0x33ff7d=_0x2a2840?_0x2e83c4[_0x7673('0x1a')]:_0x224cea[_0x7673('0x1b')]+_0x224cea['limit'];var _0x50f22d;if(_0x33ff7d>=_0x50f8d9){_0x33ff7d=_0x50f8d9;_0x50f22d=0xc8;}else{_0x50f22d=0xce;}_0x2c83d[_0x7673('0x15')](_0x50f22d);return _0x2c83d[_0x7673('0x1c')]('Content-Range',_0x17699a+'-'+_0x33ff7d+'/'+_0x50f8d9)[_0x7673('0x17')](_0x2e83c4);}return null;};}function patchUpdates(_0x29bbd9){return function(_0x2e1260){try{jsonpatch[_0x7673('0x1d')](_0x2e1260,_0x29bbd9,!![]);}catch(_0x4245bf){return BPromise[_0x7673('0x1e')](_0x4245bf);}return _0x2e1260['save']();};}function saveUpdates(_0x557161,_0xea9b37){return function(_0x21774f){if(_0x21774f){return _0x21774f[_0x7673('0x1f')](_0x557161)[_0x7673('0x20')](function(_0x16bb16){return _0x16bb16;});}return null;};}function removeEntity(_0x54f38d,_0x2009e1){return function(_0x3b2a75){if(_0x3b2a75){return _0x3b2a75[_0x7673('0x21')]()[_0x7673('0x20')](function(){var _0x132dc6=_0x3b2a75[_0x7673('0x22')]({'plain':!![]});var _0x538280=_0x7673('0x23');return db[_0x7673('0x24')][_0x7673('0x21')]({'where':{'type':_0x538280,'resourceId':_0x132dc6['id']}})[_0x7673('0x20')](function(){return _0x3b2a75;});})['then'](function(){_0x54f38d['status'](0xcc)[_0x7673('0x16')]();});}};}function handleEntityNotFound(_0x11b42b,_0x291d10){return function(_0x9d9eab){if(!_0x9d9eab){_0x11b42b[_0x7673('0x14')](0x194);}return _0x9d9eab;};}function handleError(_0x45a045,_0x442f42){_0x442f42=_0x442f42||0x1f4;return function(_0x5a59f9){logger['error'](_0x5a59f9[_0x7673('0x25')]);if(_0x5a59f9[_0x7673('0x26')]){delete _0x5a59f9[_0x7673('0x26')];}_0x45a045[_0x7673('0x15')](_0x442f42)[_0x7673('0x27')](_0x5a59f9);};}exports[_0x7673('0x28')]=function(_0x224122,_0x4f12b9){var _0x4fcacc={},_0xe7e528={},_0x36c841={'count':0x0,'rows':[]};var _0x268863=_[_0x7673('0x29')](db['Tag'][_0x7673('0x2a')],function(_0x497760){return{'name':_0x497760[_0x7673('0x2b')],'type':_0x497760[_0x7673('0x2c')][_0x7673('0x2d')]};});_0xe7e528[_0x7673('0x2e')]=_[_0x7673('0x29')](_0x268863,_0x7673('0x26'));_0xe7e528[_0x7673('0x2f')]=_[_0x7673('0x30')](_0x224122[_0x7673('0x2f')]);_0xe7e528[_0x7673('0x31')]=_[_0x7673('0x32')](_0xe7e528[_0x7673('0x2e')],_0xe7e528[_0x7673('0x2f')]);_0x4fcacc['attributes']=_[_0x7673('0x32')](_0xe7e528[_0x7673('0x2e')],qs[_0x7673('0x33')](_0x224122[_0x7673('0x2f')][_0x7673('0x33')]));_0x4fcacc[_0x7673('0x34')]=_0x4fcacc[_0x7673('0x34')]['length']?_0x4fcacc['attributes']:_0xe7e528[_0x7673('0x2e')];if(!_0x224122[_0x7673('0x2f')][_0x7673('0x35')](_0x7673('0x36'))){_0x4fcacc[_0x7673('0x18')]=qs[_0x7673('0x18')](_0x224122[_0x7673('0x2f')]['limit']);_0x4fcacc[_0x7673('0x1b')]=qs[_0x7673('0x1b')](_0x224122['query'][_0x7673('0x1b')]);}_0x4fcacc[_0x7673('0x37')]=qs[_0x7673('0x38')](_0x224122[_0x7673('0x2f')]['sort']);_0x4fcacc[_0x7673('0x39')]=qs[_0x7673('0x31')](_['pick'](_0x224122[_0x7673('0x2f')],_0xe7e528[_0x7673('0x31')]),_0x268863);if(_0x224122[_0x7673('0x2f')]['filter']){_0x4fcacc[_0x7673('0x39')]=_[_0x7673('0x3a')](_0x4fcacc[_0x7673('0x39')],{'$or':_['map'](_0x268863,function(_0x4c6106){if(_0x4c6106[_0x7673('0x2c')]!=='VIRTUAL'){var _0x4ba2b4={};_0x4ba2b4[_0x4c6106[_0x7673('0x26')]]={'$like':'%'+_0x224122[_0x7673('0x2f')]['filter']+'%'};return _0x4ba2b4;}})});}_0x4fcacc=_[_0x7673('0x3a')]({},_0x4fcacc,_0x224122[_0x7673('0x3b')]);var _0x2645a2={'where':_0x4fcacc[_0x7673('0x39')]};return db[_0x7673('0x3c')][_0x7673('0x1a')](_0x2645a2)['then'](function(_0x1edb82){_0x36c841['count']=_0x1edb82;if(_0x224122[_0x7673('0x2f')]['includeAll']){_0x4fcacc[_0x7673('0x3d')]=[{'all':!![]}];}return db[_0x7673('0x3c')]['findAll'](_0x4fcacc);})['then'](function(_0x1cac93){_0x36c841['rows']=_0x1cac93;return _0x36c841;})[_0x7673('0x20')](respondWithFilteredResult(_0x4f12b9,_0x4fcacc))[_0x7673('0x3e')](handleError(_0x4f12b9,null));};exports[_0x7673('0x3f')]=function(_0x3b6223,_0x1895df){var _0x545357={'raw':!![],'where':{'id':_0x3b6223[_0x7673('0x40')]['id']}},_0x4ea8b3={};_0x4ea8b3[_0x7673('0x2e')]=_['keys'](db[_0x7673('0x3c')][_0x7673('0x2a')]);_0x4ea8b3[_0x7673('0x2f')]=_['keys'](_0x3b6223[_0x7673('0x2f')]);_0x4ea8b3[_0x7673('0x31')]=_[_0x7673('0x32')](_0x4ea8b3[_0x7673('0x2e')],_0x4ea8b3[_0x7673('0x2f')]);_0x545357[_0x7673('0x34')]=_[_0x7673('0x32')](_0x4ea8b3[_0x7673('0x2e')],qs[_0x7673('0x33')](_0x3b6223['query'][_0x7673('0x33')]));_0x545357[_0x7673('0x34')]=_0x545357[_0x7673('0x34')][_0x7673('0x41')]?_0x545357[_0x7673('0x34')]:_0x4ea8b3[_0x7673('0x2e')];if(_0x3b6223[_0x7673('0x2f')]['includeAll']){_0x545357[_0x7673('0x3d')]=[{'all':!![]}];}_0x545357=_[_0x7673('0x3a')]({},_0x545357,_0x3b6223[_0x7673('0x3b')]);return db[_0x7673('0x3c')][_0x7673('0x42')](_0x545357)['then'](handleEntityNotFound(_0x1895df,null))[_0x7673('0x20')](respondWithResult(_0x1895df,null))[_0x7673('0x3e')](handleError(_0x1895df,null));};exports[_0x7673('0x43')]=function(_0x2397fb,_0x3f76a3){return db['Tag']['create'](_0x2397fb[_0x7673('0x44')],{})[_0x7673('0x20')](function(_0x510960){var _0x2314e7=_0x2397fb[_0x7673('0x45')][_0x7673('0x22')]({'plain':!![]});if(!_0x2314e7)throw new Error(_0x7673('0x46'));if(_0x2314e7[_0x7673('0x47')]==='user'){var _0x23789d=_0x510960[_0x7673('0x22')]({'plain':!![]});var _0x2a275b=_0x7673('0x23');return db['UserProfileSection'][_0x7673('0x42')]({'where':{'name':_0x2a275b,'userProfileId':_0x2314e7[_0x7673('0x48')]},'raw':!![]})[_0x7673('0x20')](function(_0xa93124){if(_0xa93124&&_0xa93124[_0x7673('0x49')]===0x0){return db[_0x7673('0x24')][_0x7673('0x43')]({'name':_0x23789d[_0x7673('0x26')],'resourceId':_0x23789d['id'],'type':_0xa93124[_0x7673('0x26')],'sectionId':_0xa93124['id']},{})[_0x7673('0x20')](function(){return _0x510960;});}else{return _0x510960;}})[_0x7673('0x3e')](function(_0x572119){logger[_0x7673('0x4a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x572119);throw _0x572119;});}return _0x510960;})[_0x7673('0x20')](respondWithResult(_0x3f76a3,0xc9))[_0x7673('0x3e')](handleError(_0x3f76a3,null));};exports[_0x7673('0x1f')]=function(_0x523698,_0x185ec5){if(_0x523698[_0x7673('0x44')]['id']){delete _0x523698[_0x7673('0x44')]['id'];}return db[_0x7673('0x3c')][_0x7673('0x42')]({'where':{'id':_0x523698[_0x7673('0x40')]['id']}})[_0x7673('0x20')](handleEntityNotFound(_0x185ec5,null))[_0x7673('0x20')](saveUpdates(_0x523698[_0x7673('0x44')],null))[_0x7673('0x20')](respondWithResult(_0x185ec5,null))[_0x7673('0x3e')](handleError(_0x185ec5,null));};exports[_0x7673('0x21')]=function(_0x9be9a4,_0xb3c9e9){return db['Tag'][_0x7673('0x42')]({'where':{'id':_0x9be9a4['params']['id']}})[_0x7673('0x20')](handleEntityNotFound(_0xb3c9e9,null))[_0x7673('0x20')](removeEntity(_0xb3c9e9,null))[_0x7673('0x3e')](handleError(_0xb3c9e9,null));}; \ No newline at end of file +var _0x4746=['error','stack','name','send','index','map','Tag','rawAttributes','model','keys','query','filters','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','type','VIRTUAL','options','includeAll','findAll','catch','params','intersection','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','get','Tags','UserProfileResource'];(function(_0x168794,_0x2abf4a){var _0x5451d7=function(_0x346be9){while(--_0x346be9){_0x168794['push'](_0x168794['shift']());}};_0x5451d7(++_0x2abf4a);}(_0x4746,0xc6));var _0x6474=function(_0x4704f6,_0x40c2ae){_0x4704f6=_0x4704f6-0x0;var _0x35f74f=_0x4746[_0x4704f6];return _0x35f74f;};'use strict';var emlformat=require(_0x6474('0x0'));var rimraf=require(_0x6474('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6474('0x2'));var rp=require('request-promise');var moment=require(_0x6474('0x3'));var BPromise=require(_0x6474('0x4'));var Mustache=require(_0x6474('0x5'));var util=require(_0x6474('0x6'));var path=require(_0x6474('0x7'));var sox=require('sox');var csv=require(_0x6474('0x8'));var ejs=require(_0x6474('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6474('0xa'));var squel=require(_0x6474('0xb'));var crypto=require(_0x6474('0xc'));var jsforce=require(_0x6474('0xd'));var deskjs=require(_0x6474('0xe'));var toCsv=require(_0x6474('0x8'));var querystring=require('querystring');var Papa=require(_0x6474('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6474('0x10'));var as=require(_0x6474('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6474('0x12'))('api');var utils=require(_0x6474('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6474('0x14'));var db=require(_0x6474('0x15'))['db'];function respondWithStatusCode(_0x5509d2,_0x4936c2){_0x4936c2=_0x4936c2||0xcc;return function(_0x5cf0de){if(_0x5cf0de){return _0x5509d2[_0x6474('0x16')](_0x4936c2);}return _0x5509d2[_0x6474('0x17')](_0x4936c2)[_0x6474('0x18')]();};}function respondWithResult(_0xad1ebe,_0x113aba){_0x113aba=_0x113aba||0xc8;return function(_0x37fe08){if(_0x37fe08){return _0xad1ebe[_0x6474('0x17')](_0x113aba)[_0x6474('0x19')](_0x37fe08);}};}function respondWithFilteredResult(_0x29b935,_0x5cf8fa){return function(_0x5ee279){if(_0x5ee279){var _0x583afa=typeof _0x5cf8fa[_0x6474('0x1a')]===_0x6474('0x1b')&&typeof _0x5cf8fa[_0x6474('0x1c')]===_0x6474('0x1b');var _0x195465=_0x5ee279['count'];var _0x1505fc=_0x583afa?0x0:_0x5cf8fa[_0x6474('0x1a')];var _0xb6ecb6=_0x583afa?_0x5ee279[_0x6474('0x1d')]:_0x5cf8fa[_0x6474('0x1a')]+_0x5cf8fa[_0x6474('0x1c')];var _0x2e33f0;if(_0xb6ecb6>=_0x195465){_0xb6ecb6=_0x195465;_0x2e33f0=0xc8;}else{_0x2e33f0=0xce;}_0x29b935[_0x6474('0x17')](_0x2e33f0);return _0x29b935['set'](_0x6474('0x1e'),_0x1505fc+'-'+_0xb6ecb6+'/'+_0x195465)['json'](_0x5ee279);}return null;};}function patchUpdates(_0xd23b18){return function(_0x1df53c){try{jsonpatch[_0x6474('0x1f')](_0x1df53c,_0xd23b18,!![]);}catch(_0x185760){return BPromise[_0x6474('0x20')](_0x185760);}return _0x1df53c[_0x6474('0x21')]();};}function saveUpdates(_0x382ebf,_0x5d0e5c){return function(_0xf3cd65){if(_0xf3cd65){return _0xf3cd65['update'](_0x382ebf)[_0x6474('0x22')](function(_0x4dc277){return _0x4dc277;});}return null;};}function removeEntity(_0x4ba645,_0x58e024){return function(_0xb67896){if(_0xb67896){return _0xb67896[_0x6474('0x23')]()[_0x6474('0x22')](function(){var _0x18c1b3=_0xb67896[_0x6474('0x24')]({'plain':!![]});var _0x4a9cb6=_0x6474('0x25');return db[_0x6474('0x26')][_0x6474('0x23')]({'where':{'type':_0x4a9cb6,'resourceId':_0x18c1b3['id']}})[_0x6474('0x22')](function(){return _0xb67896;});})['then'](function(){_0x4ba645['status'](0xcc)[_0x6474('0x18')]();});}};}function handleEntityNotFound(_0x12d05f,_0xca66ba){return function(_0x39a591){if(!_0x39a591){_0x12d05f['sendStatus'](0x194);}return _0x39a591;};}function handleError(_0x4dc02b,_0x542265){_0x542265=_0x542265||0x1f4;return function(_0x4b81f3){logger[_0x6474('0x27')](_0x4b81f3[_0x6474('0x28')]);if(_0x4b81f3[_0x6474('0x29')]){delete _0x4b81f3[_0x6474('0x29')];}_0x4dc02b['status'](_0x542265)[_0x6474('0x2a')](_0x4b81f3);};}exports[_0x6474('0x2b')]=function(_0xe24477,_0x2e01fa){var _0x2a3ad0={},_0x443f8c={},_0xeb1f90={'count':0x0,'rows':[]};var _0x5f2926=_[_0x6474('0x2c')](db[_0x6474('0x2d')][_0x6474('0x2e')],function(_0x34fea6){return{'name':_0x34fea6['fieldName'],'type':_0x34fea6['type']['key']};});_0x443f8c[_0x6474('0x2f')]=_[_0x6474('0x2c')](_0x5f2926,_0x6474('0x29'));_0x443f8c['query']=_[_0x6474('0x30')](_0xe24477[_0x6474('0x31')]);_0x443f8c[_0x6474('0x32')]=_['intersection'](_0x443f8c[_0x6474('0x2f')],_0x443f8c[_0x6474('0x31')]);_0x2a3ad0[_0x6474('0x33')]=_['intersection'](_0x443f8c[_0x6474('0x2f')],qs[_0x6474('0x34')](_0xe24477['query'][_0x6474('0x34')]));_0x2a3ad0[_0x6474('0x33')]=_0x2a3ad0[_0x6474('0x33')][_0x6474('0x35')]?_0x2a3ad0[_0x6474('0x33')]:_0x443f8c['model'];if(!_0xe24477[_0x6474('0x31')][_0x6474('0x36')]('nolimit')){_0x2a3ad0['limit']=qs[_0x6474('0x1c')](_0xe24477['query'][_0x6474('0x1c')]);_0x2a3ad0[_0x6474('0x1a')]=qs[_0x6474('0x1a')](_0xe24477[_0x6474('0x31')][_0x6474('0x1a')]);}_0x2a3ad0['order']=qs['sort'](_0xe24477[_0x6474('0x31')][_0x6474('0x37')]);_0x2a3ad0[_0x6474('0x38')]=qs['filters'](_[_0x6474('0x39')](_0xe24477['query'],_0x443f8c[_0x6474('0x32')]),_0x5f2926);if(_0xe24477['query']['filter']){_0x2a3ad0['where']=_[_0x6474('0x3a')](_0x2a3ad0[_0x6474('0x38')],{'$or':_[_0x6474('0x2c')](_0x5f2926,function(_0xe2a64c){if(_0xe2a64c[_0x6474('0x3b')]!==_0x6474('0x3c')){var _0x52497f={};_0x52497f[_0xe2a64c[_0x6474('0x29')]]={'$like':'%'+_0xe24477[_0x6474('0x31')]['filter']+'%'};return _0x52497f;}})});}_0x2a3ad0=_[_0x6474('0x3a')]({},_0x2a3ad0,_0xe24477[_0x6474('0x3d')]);var _0x462908={'where':_0x2a3ad0['where']};return db[_0x6474('0x2d')][_0x6474('0x1d')](_0x462908)[_0x6474('0x22')](function(_0x47fa33){_0xeb1f90['count']=_0x47fa33;if(_0xe24477[_0x6474('0x31')][_0x6474('0x3e')]){_0x2a3ad0['include']=[{'all':!![]}];}return db[_0x6474('0x2d')][_0x6474('0x3f')](_0x2a3ad0);})[_0x6474('0x22')](function(_0x1a4bde){_0xeb1f90['rows']=_0x1a4bde;return _0xeb1f90;})['then'](respondWithFilteredResult(_0x2e01fa,_0x2a3ad0))[_0x6474('0x40')](handleError(_0x2e01fa,null));};exports['show']=function(_0x391be9,_0x25cb5b){var _0x1ff044={'raw':!![],'where':{'id':_0x391be9[_0x6474('0x41')]['id']}},_0x54e797={};_0x54e797[_0x6474('0x2f')]=_['keys'](db[_0x6474('0x2d')][_0x6474('0x2e')]);_0x54e797[_0x6474('0x31')]=_[_0x6474('0x30')](_0x391be9[_0x6474('0x31')]);_0x54e797[_0x6474('0x32')]=_[_0x6474('0x42')](_0x54e797['model'],_0x54e797[_0x6474('0x31')]);_0x1ff044[_0x6474('0x33')]=_['intersection'](_0x54e797[_0x6474('0x2f')],qs[_0x6474('0x34')](_0x391be9['query']['fields']));_0x1ff044['attributes']=_0x1ff044['attributes'][_0x6474('0x35')]?_0x1ff044[_0x6474('0x33')]:_0x54e797[_0x6474('0x2f')];if(_0x391be9[_0x6474('0x31')]['includeAll']){_0x1ff044[_0x6474('0x43')]=[{'all':!![]}];}_0x1ff044=_[_0x6474('0x3a')]({},_0x1ff044,_0x391be9[_0x6474('0x3d')]);return db[_0x6474('0x2d')][_0x6474('0x44')](_0x1ff044)[_0x6474('0x22')](handleEntityNotFound(_0x25cb5b,null))['then'](respondWithResult(_0x25cb5b,null))[_0x6474('0x40')](handleError(_0x25cb5b,null));};exports[_0x6474('0x45')]=function(_0x394ff9,_0x495666){return db[_0x6474('0x2d')][_0x6474('0x45')](_0x394ff9['body'],{})[_0x6474('0x22')](function(_0xfc538f){var _0x228a16=_0x394ff9[_0x6474('0x46')][_0x6474('0x24')]({'plain':!![]});if(!_0x228a16)throw new Error(_0x6474('0x47'));if(_0x228a16[_0x6474('0x48')]==='user'){var _0x27ebf9=_0xfc538f[_0x6474('0x24')]({'plain':!![]});var _0x231a02='Tags';return db[_0x6474('0x49')][_0x6474('0x44')]({'where':{'name':_0x231a02,'userProfileId':_0x228a16[_0x6474('0x4a')]},'raw':!![]})['then'](function(_0x5d2c92){if(_0x5d2c92&&_0x5d2c92[_0x6474('0x4b')]===0x0){return db[_0x6474('0x26')]['create']({'name':_0x27ebf9['name'],'resourceId':_0x27ebf9['id'],'type':_0x5d2c92[_0x6474('0x29')],'sectionId':_0x5d2c92['id']},{})['then'](function(){return _0xfc538f;});}else{return _0xfc538f;}})[_0x6474('0x40')](function(_0x409e55){logger[_0x6474('0x27')](_0x6474('0x4c'),_0x409e55);throw _0x409e55;});}return _0xfc538f;})[_0x6474('0x22')](respondWithResult(_0x495666,0xc9))[_0x6474('0x40')](handleError(_0x495666,null));};exports[_0x6474('0x4d')]=function(_0x451080,_0x471372){if(_0x451080[_0x6474('0x4e')]['id']){delete _0x451080[_0x6474('0x4e')]['id'];}return db[_0x6474('0x2d')][_0x6474('0x44')]({'where':{'id':_0x451080['params']['id']}})[_0x6474('0x22')](handleEntityNotFound(_0x471372,null))['then'](saveUpdates(_0x451080['body'],null))[_0x6474('0x22')](respondWithResult(_0x471372,null))[_0x6474('0x40')](handleError(_0x471372,null));};exports[_0x6474('0x23')]=function(_0x2a79d4,_0x5c245d){return db[_0x6474('0x2d')][_0x6474('0x44')]({'where':{'id':_0x2a79d4[_0x6474('0x41')]['id']}})[_0x6474('0x22')](handleEntityNotFound(_0x5c245d,null))[_0x6474('0x22')](removeEntity(_0x5c245d,null))[_0x6474('0x40')](handleError(_0x5c245d,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index ac8aa86..4c804fc 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 _0xa55a=['bluebird','request-promise','path','./tag.attributes','exports','define','Tag','lodash','util','../../config/logger','api'];(function(_0x24f326,_0x616a7){var _0x488e2d=function(_0x293d9a){while(--_0x293d9a){_0x24f326['push'](_0x24f326['shift']());}};_0x488e2d(++_0x616a7);}(_0xa55a,0x1b4));var _0xaa55=function(_0x4686b0,_0x3deb72){_0x4686b0=_0x4686b0-0x0;var _0x295e83=_0xa55a[_0x4686b0];return _0x295e83;};'use strict';var _=require(_0xaa55('0x0'));var util=require(_0xaa55('0x1'));var logger=require(_0xaa55('0x2'))(_0xaa55('0x3'));var moment=require('moment');var BPromise=require(_0xaa55('0x4'));var rp=require(_0xaa55('0x5'));var fs=require('fs');var path=require(_0xaa55('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xaa55('0x7'));module[_0xaa55('0x8')]=function(_0x21eb46,_0x556432){return _0x21eb46[_0xaa55('0x9')](_0xaa55('0xa'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e40=['exports','define','Tag','tools_tags','lodash','util','api','moment','path','rimraf','../../config/environment','./tag.attributes'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x4e40,0x1a8));var _0x04e4=function(_0x59d8af,_0x564bce){_0x59d8af=_0x59d8af-0x0;var _0xde79ad=_0x4e40[_0x59d8af];return _0xde79ad;};'use strict';var _=require(_0x04e4('0x0'));var util=require(_0x04e4('0x1'));var logger=require('../../config/logger')(_0x04e4('0x2'));var moment=require(_0x04e4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x04e4('0x4'));var rimraf=require(_0x04e4('0x5'));var config=require(_0x04e4('0x6'));var attributes=require(_0x04e4('0x7'));module[_0x04e4('0x8')]=function(_0x5449cb,_0x548e85){return _0x5449cb[_0x04e4('0x9')](_0x04e4('0xa'),attributes,{'tableName':_0x04e4('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 7a1ba7e..9f43532 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 _0xad8a=['../../config/environment','jayson/promise','client','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x26f6b9,_0x46e36e){var _0x3815b1=function(_0x35df0a){while(--_0x35df0a){_0x26f6b9['push'](_0x26f6b9['shift']());}};_0x3815b1(++_0x46e36e);}(_0xad8a,0xb0));var _0xaad8=function(_0xa23d93,_0x4d8a82){_0xa23d93=_0xa23d93-0x0;var _0x5c4ba8=_0xad8a[_0xa23d93];return _0x5c4ba8;};'use strict';var _=require(_0xaad8('0x0'));var util=require(_0xaad8('0x1'));var moment=require(_0xaad8('0x2'));var BPromise=require(_0xaad8('0x3'));var rs=require(_0xaad8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaad8('0x5'))['db'];var utils=require(_0xaad8('0x6'));var logger=require(_0xaad8('0x7'))('rpc');var config=require(_0xaad8('0x8'));var jayson=require(_0xaad8('0x9'));var client=jayson[_0xaad8('0xa')][_0xaad8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x95aef9,_0x39c599,_0x28f3a1){return new BPromise(function(_0xf3a6c7,_0x11408a){return client[_0xaad8('0xc')](_0x95aef9,_0x28f3a1)['then'](function(_0x52477f){logger[_0xaad8('0xd')](_0xaad8('0xe'),_0x39c599,_0xaad8('0xf'));logger[_0xaad8('0x10')](_0xaad8('0x11'),_0x39c599,_0xaad8('0xf'),JSON[_0xaad8('0x12')](_0x52477f));if(_0x52477f[_0xaad8('0x13')]){if(_0x52477f[_0xaad8('0x13')]['code']===0x1f4){logger[_0xaad8('0x13')](_0xaad8('0xe'),_0x39c599,_0x52477f[_0xaad8('0x13')][_0xaad8('0x14')]);return _0x11408a(_0x52477f[_0xaad8('0x13')][_0xaad8('0x14')]);}logger[_0xaad8('0x13')](_0xaad8('0xe'),_0x39c599,_0x52477f[_0xaad8('0x13')][_0xaad8('0x14')]);return _0xf3a6c7(_0x52477f[_0xaad8('0x13')][_0xaad8('0x14')]);}else{logger[_0xaad8('0xd')]('Tag,\x20%s,\x20%s',_0x39c599,_0xaad8('0xf'));_0xf3a6c7(_0x52477f[_0xaad8('0x15')]['message']);}})[_0xaad8('0x16')](function(_0x2a8e12){logger[_0xaad8('0x13')](_0xaad8('0xe'),_0x39c599,_0x2a8e12);_0x11408a(_0x2a8e12);});});} \ No newline at end of file +var _0x9009=['Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info'];(function(_0x1502df,_0x12b9bb){var _0x2d2115=function(_0x14854c){while(--_0x14854c){_0x1502df['push'](_0x1502df['shift']());}};_0x2d2115(++_0x12b9bb);}(_0x9009,0x1d4));var _0x9900=function(_0x206a3f,_0x244437){_0x206a3f=_0x206a3f-0x0;var _0x3dd8c9=_0x9009[_0x206a3f];return _0x3dd8c9;};'use strict';var _=require(_0x9900('0x0'));var util=require('util');var moment=require(_0x9900('0x1'));var BPromise=require(_0x9900('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9900('0x3'));var db=require(_0x9900('0x4'))['db'];var utils=require(_0x9900('0x5'));var logger=require(_0x9900('0x6'))('rpc');var config=require(_0x9900('0x7'));var jayson=require(_0x9900('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x16de4e,_0x34fa67,_0x4abe19){return new BPromise(function(_0x2f085b,_0x1f9558){return client[_0x9900('0x9')](_0x16de4e,_0x4abe19)[_0x9900('0xa')](function(_0x51cd3d){logger[_0x9900('0xb')](_0x9900('0xc'),_0x34fa67,_0x9900('0xd'));logger[_0x9900('0xe')](_0x9900('0xf'),_0x34fa67,'request\x20sent',JSON['stringify'](_0x51cd3d));if(_0x51cd3d[_0x9900('0x10')]){if(_0x51cd3d[_0x9900('0x10')]['code']===0x1f4){logger['error'](_0x9900('0xc'),_0x34fa67,_0x51cd3d['error'][_0x9900('0x11')]);return _0x1f9558(_0x51cd3d[_0x9900('0x10')][_0x9900('0x11')]);}logger[_0x9900('0x10')](_0x9900('0xc'),_0x34fa67,_0x51cd3d[_0x9900('0x10')][_0x9900('0x11')]);return _0x2f085b(_0x51cd3d[_0x9900('0x10')][_0x9900('0x11')]);}else{logger[_0x9900('0xb')](_0x9900('0xc'),_0x34fa67,_0x9900('0xd'));_0x2f085b(_0x51cd3d[_0x9900('0x12')][_0x9900('0x11')]);}})[_0x9900('0x13')](function(_0x1bacf3){logger[_0x9900('0x10')]('Tag,\x20%s,\x20%s',_0x34fa67,_0x1bacf3);_0x1f9558(_0x1bacf3);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index f5dbfd0..adf7eae 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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 9d97a38..f02a7d5 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(_0x251e8c,_0x277c33){var _0x1e0c1d=function(_0x20b89c){while(--_0x20b89c){_0x251e8c['push'](_0x251e8c['shift']());}};_0x1e0c1d(++_0x277c33);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'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 _0xbaf0=['name','exports','STRING'];(function(_0x4cce65,_0x40021e){var _0x4d1b45=function(_0x54d290){while(--_0x54d290){_0x4cce65['push'](_0x4cce65['shift']());}};_0x4d1b45(++_0x40021e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 5c3b5fc..7ea35b8 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 _0xbf69=['SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','VoiceQueueId','UserVoiceQueue','UserMailQueue','SmsQueueId','UserSmsQueue','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','TeamVoicePrefix','UserVoicePrefix','UserProfileResource','channel','isValidChannel','ValidationError','toLowerCase','Queue','pick','capitalize','Queues','findOne','Unknown\x20channel','add','ids','removeQueues','remove','addAgents','isArray','Chat','Sms','Fax','Openchannel','Whatsapp','Voice','QueueId','TeamVoiceQueue','User','findOrCreate','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','penalty','all','VoicePrefixId','removeAgents','Mail','emit','Queue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./team.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','json','stack','name','send','map','Team','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','then','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','get','role','Teams','UserProfileSection','userProfileId','error','destroy','sequelize','transaction'];(function(_0x5e48e0,_0x23b05b){var _0xa934c9=function(_0x3b5253){while(--_0x3b5253){_0x5e48e0['push'](_0x5e48e0['shift']());}};_0xa934c9(++_0x23b05b);}(_0xbf69,0xcd));var _0x9bf6=function(_0x3c504b,_0x437693){_0x3c504b=_0x3c504b-0x0;var _0x2e5354=_0xbf69[_0x3c504b];return _0x2e5354;};'use strict';var emlformat=require(_0x9bf6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9bf6('0x1'));var jsonpatch=require(_0x9bf6('0x2'));var rp=require(_0x9bf6('0x3'));var moment=require('moment');var BPromise=require(_0x9bf6('0x4'));var Mustache=require(_0x9bf6('0x5'));var util=require(_0x9bf6('0x6'));var path=require(_0x9bf6('0x7'));var sox=require('sox');var csv=require(_0x9bf6('0x8'));var ejs=require(_0x9bf6('0x9'));var fs=require('fs');var fs_extra=require(_0x9bf6('0xa'));var _=require(_0x9bf6('0xb'));var squel=require(_0x9bf6('0xc'));var crypto=require('crypto');var jsforce=require(_0x9bf6('0xd'));var deskjs=require(_0x9bf6('0xe'));var toCsv=require(_0x9bf6('0x8'));var querystring=require(_0x9bf6('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9bf6('0x10'));var qs=require(_0x9bf6('0x11'));var as=require(_0x9bf6('0x12'));var hardwareService=require(_0x9bf6('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x9bf6('0x14'));var config=require(_0x9bf6('0x15'));var licenseUtil=require(_0x9bf6('0x16'));var db=require(_0x9bf6('0x17'))['db'];config['redis']=_[_0x9bf6('0x18')](config['redis'],{'host':_0x9bf6('0x19'),'port':0x18eb});var socket=require(_0x9bf6('0x1a'))(new Redis(config[_0x9bf6('0x1b')]));require(_0x9bf6('0x1c'))[_0x9bf6('0x1d')](socket);function respondWithStatusCode(_0x5cd0bd,_0x335e8b){_0x335e8b=_0x335e8b||0xcc;return function(_0x508e8d){if(_0x508e8d){return _0x5cd0bd[_0x9bf6('0x1e')](_0x335e8b);}return _0x5cd0bd[_0x9bf6('0x1f')](_0x335e8b)[_0x9bf6('0x20')]();};}function respondWithResult(_0x27e80f,_0x38ae73){_0x38ae73=_0x38ae73||0xc8;return function(_0x2da465){if(_0x2da465){return _0x27e80f[_0x9bf6('0x1f')](_0x38ae73)['json'](_0x2da465);}};}function respondWithFilteredResult(_0x36c801,_0x35b3c2){return function(_0x5cde56){if(_0x5cde56){var _0x5d3922=typeof _0x35b3c2['offset']===_0x9bf6('0x21')&&typeof _0x35b3c2[_0x9bf6('0x22')]===_0x9bf6('0x21');var _0x4649f1=_0x5cde56[_0x9bf6('0x23')];var _0x29f90c=_0x5d3922?0x0:_0x35b3c2[_0x9bf6('0x24')];var _0x323723=_0x5d3922?_0x5cde56[_0x9bf6('0x23')]:_0x35b3c2['offset']+_0x35b3c2[_0x9bf6('0x22')];var _0x1f63ba;if(_0x323723>=_0x4649f1){_0x323723=_0x4649f1;_0x1f63ba=0xc8;}else{_0x1f63ba=0xce;}_0x36c801[_0x9bf6('0x1f')](_0x1f63ba);return _0x36c801[_0x9bf6('0x25')]('Content-Range',_0x29f90c+'-'+_0x323723+'/'+_0x4649f1)[_0x9bf6('0x26')](_0x5cde56);}return null;};}function patchUpdates(_0x4ef02a){return function(_0x34d111){try{jsonpatch['apply'](_0x34d111,_0x4ef02a,!![]);}catch(_0x5c0a81){return BPromise['reject'](_0x5c0a81);}return _0x34d111['save']();};}function saveUpdates(_0x51e9b4,_0x174ce9){return function(_0x59ef8f){if(_0x59ef8f){return _0x59ef8f['update'](_0x51e9b4)['then'](function(_0x51bd9a){return _0x51bd9a;});}return null;};}function handleEntityNotFound(_0x112653,_0x3cef86){return function(_0x3505e5){if(!_0x3505e5){_0x112653[_0x9bf6('0x1e')](0x194);}return _0x3505e5;};}function handleError(_0x2d843a,_0x55cf17){_0x55cf17=_0x55cf17||0x1f4;return function(_0x211b4c){logger['error'](_0x211b4c[_0x9bf6('0x27')]);if(_0x211b4c[_0x9bf6('0x28')]){delete _0x211b4c['name'];}_0x2d843a[_0x9bf6('0x1f')](_0x55cf17)[_0x9bf6('0x29')](_0x211b4c);};}exports['index']=function(_0x1ae611,_0x4bf160){var _0x6f174c={},_0x44498c={},_0xd2bf62={'count':0x0,'rows':[]};var _0x36b18c=_[_0x9bf6('0x2a')](db[_0x9bf6('0x2b')][_0x9bf6('0x2c')],function(_0x234dd6){return{'name':_0x234dd6['fieldName'],'type':_0x234dd6[_0x9bf6('0x2d')][_0x9bf6('0x2e')]};});_0x44498c[_0x9bf6('0x2f')]=_[_0x9bf6('0x2a')](_0x36b18c,_0x9bf6('0x28'));_0x44498c[_0x9bf6('0x30')]=_[_0x9bf6('0x31')](_0x1ae611[_0x9bf6('0x30')]);_0x44498c['filters']=_[_0x9bf6('0x32')](_0x44498c[_0x9bf6('0x2f')],_0x44498c[_0x9bf6('0x30')]);_0x6f174c['attributes']=_[_0x9bf6('0x32')](_0x44498c[_0x9bf6('0x2f')],qs['fields'](_0x1ae611[_0x9bf6('0x30')][_0x9bf6('0x33')]));_0x6f174c[_0x9bf6('0x34')]=_0x6f174c[_0x9bf6('0x34')][_0x9bf6('0x35')]?_0x6f174c['attributes']:_0x44498c[_0x9bf6('0x2f')];if(!_0x1ae611[_0x9bf6('0x30')][_0x9bf6('0x36')](_0x9bf6('0x37'))){_0x6f174c[_0x9bf6('0x22')]=qs['limit'](_0x1ae611[_0x9bf6('0x30')][_0x9bf6('0x22')]);_0x6f174c[_0x9bf6('0x24')]=qs[_0x9bf6('0x24')](_0x1ae611[_0x9bf6('0x30')][_0x9bf6('0x24')]);}_0x6f174c[_0x9bf6('0x38')]=qs[_0x9bf6('0x39')](_0x1ae611[_0x9bf6('0x30')]['sort']);_0x6f174c[_0x9bf6('0x3a')]=qs[_0x9bf6('0x3b')](_['pick'](_0x1ae611[_0x9bf6('0x30')],_0x44498c['filters']),_0x36b18c);if(_0x1ae611[_0x9bf6('0x30')][_0x9bf6('0x3c')]){_0x6f174c[_0x9bf6('0x3a')]=_[_0x9bf6('0x3d')](_0x6f174c[_0x9bf6('0x3a')],{'$or':_[_0x9bf6('0x2a')](_0x36b18c,function(_0x147bd0){if(_0x147bd0[_0x9bf6('0x2d')]!==_0x9bf6('0x3e')){var _0x43738c={};_0x43738c[_0x147bd0[_0x9bf6('0x28')]]={'$like':'%'+_0x1ae611[_0x9bf6('0x30')][_0x9bf6('0x3c')]+'%'};return _0x43738c;}})});}_0x6f174c=_['merge']({},_0x6f174c,_0x1ae611[_0x9bf6('0x3f')]);var _0x4a6e43={'where':_0x6f174c[_0x9bf6('0x3a')]};return db[_0x9bf6('0x2b')]['count'](_0x4a6e43)[_0x9bf6('0x40')](function(_0x7e6065){_0xd2bf62[_0x9bf6('0x23')]=_0x7e6065;if(_0x1ae611[_0x9bf6('0x30')]['includeAll']){_0x6f174c[_0x9bf6('0x41')]=[{'all':!![]}];}return db[_0x9bf6('0x2b')][_0x9bf6('0x42')](_0x6f174c);})[_0x9bf6('0x40')](function(_0x5a985c){_0xd2bf62[_0x9bf6('0x43')]=_0x5a985c;return _0xd2bf62;})['then'](respondWithFilteredResult(_0x4bf160,_0x6f174c))[_0x9bf6('0x44')](handleError(_0x4bf160,null));};exports[_0x9bf6('0x45')]=function(_0x35f764,_0x38c65e){var _0x18227e={'raw':![],'where':{'id':_0x35f764[_0x9bf6('0x46')]['id']}},_0x21730e={};_0x21730e[_0x9bf6('0x2f')]=_[_0x9bf6('0x31')](db[_0x9bf6('0x2b')]['rawAttributes']);_0x21730e[_0x9bf6('0x30')]=_[_0x9bf6('0x31')](_0x35f764[_0x9bf6('0x30')]);_0x21730e[_0x9bf6('0x3b')]=_[_0x9bf6('0x32')](_0x21730e[_0x9bf6('0x2f')],_0x21730e[_0x9bf6('0x30')]);_0x18227e[_0x9bf6('0x34')]=_[_0x9bf6('0x32')](_0x21730e[_0x9bf6('0x2f')],qs['fields'](_0x35f764[_0x9bf6('0x30')][_0x9bf6('0x33')]));_0x18227e['attributes']=_0x18227e[_0x9bf6('0x34')]['length']?_0x18227e[_0x9bf6('0x34')]:_0x21730e['model'];if(_0x35f764[_0x9bf6('0x30')][_0x9bf6('0x47')]){_0x18227e[_0x9bf6('0x41')]=[{'all':!![]}];}_0x18227e=_[_0x9bf6('0x3d')]({},_0x18227e,_0x35f764[_0x9bf6('0x3f')]);return db[_0x9bf6('0x2b')][_0x9bf6('0x48')](_0x18227e)[_0x9bf6('0x40')](handleEntityNotFound(_0x38c65e,null))['then'](respondWithResult(_0x38c65e,null))[_0x9bf6('0x44')](handleError(_0x38c65e,null));};exports[_0x9bf6('0x49')]=function(_0x39bf67,_0x1cdfe1){return db[_0x9bf6('0x2b')][_0x9bf6('0x49')](_0x39bf67[_0x9bf6('0x4a')],{})['then'](function(_0x6d603b){var _0x2cc49b=_0x39bf67[_0x9bf6('0x4b')][_0x9bf6('0x4c')]({'plain':!![]});if(!_0x2cc49b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2cc49b[_0x9bf6('0x4d')]===_0x9bf6('0x4b')){var _0x59f53f=_0x6d603b[_0x9bf6('0x4c')]({'plain':!![]});var _0x506dd3=_0x9bf6('0x4e');return db[_0x9bf6('0x4f')][_0x9bf6('0x48')]({'where':{'name':_0x506dd3,'userProfileId':_0x2cc49b[_0x9bf6('0x50')]},'raw':!![]})[_0x9bf6('0x40')](function(_0x546a82){if(_0x546a82&&_0x546a82['autoAssociation']===0x0){return db['UserProfileResource'][_0x9bf6('0x49')]({'name':_0x59f53f['name'],'resourceId':_0x59f53f['id'],'type':_0x546a82[_0x9bf6('0x28')],'sectionId':_0x546a82['id']},{})[_0x9bf6('0x40')](function(){return _0x6d603b;});}else{return _0x6d603b;}})[_0x9bf6('0x44')](function(_0x51f448){logger[_0x9bf6('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x51f448);throw _0x51f448;});}return _0x6d603b;})[_0x9bf6('0x40')](respondWithResult(_0x1cdfe1,0xc9))[_0x9bf6('0x44')](handleError(_0x1cdfe1,null));};exports['update']=function(_0x543fec,_0x1375a9){if(_0x543fec['body']['id']){delete _0x543fec[_0x9bf6('0x4a')]['id'];}return db[_0x9bf6('0x2b')][_0x9bf6('0x48')]({'where':{'id':_0x543fec['params']['id']}})[_0x9bf6('0x40')](handleEntityNotFound(_0x1375a9,null))[_0x9bf6('0x40')](saveUpdates(_0x543fec[_0x9bf6('0x4a')],null))[_0x9bf6('0x40')](respondWithResult(_0x1375a9,null))[_0x9bf6('0x44')](handleError(_0x1375a9,null));};exports[_0x9bf6('0x52')]=function(_0x47fd52,_0x57626a){var _0x5e28b5=_0x47fd52['params']['id'];var _0x2fb960=[];return db[_0x9bf6('0x53')][_0x9bf6('0x54')](function(_0x4cdd44){var _0x29eb68=_0x9bf6('0x55')+_0x5e28b5;return db[_0x9bf6('0x53')][_0x9bf6('0x30')](_0x29eb68,{'type':db[_0x9bf6('0x56')][_0x9bf6('0x57')]['SELECT'],'raw':!![],'transaction':_0x4cdd44})[_0x9bf6('0x40')](function(_0x28d592){_0x2fb960=_[_0x9bf6('0x2a')](_0x28d592,function(_0x4eaba6){return Number(_0x4eaba6['UserId']);});})[_0x9bf6('0x40')](function(){var _0x9283a2=_0x9bf6('0x58')+_0x5e28b5;return db[_0x9bf6('0x53')][_0x9bf6('0x30')](_0x9283a2,{'type':db[_0x9bf6('0x56')][_0x9bf6('0x57')][_0x9bf6('0x59')],'raw':!![],'transaction':_0x4cdd44});})[_0x9bf6('0x40')](function(_0x4873ab){var _0x403e44=_['map'](_0x4873ab,function(_0x515651){return Number(_0x515651[_0x9bf6('0x5a')]);});return db[_0x9bf6('0x5b')][_0x9bf6('0x52')]({'where':{'UserId':{'$in':_0x2fb960},'VoiceQueueId':{'$in':_0x403e44}},'transaction':_0x4cdd44});})[_0x9bf6('0x40')](function(){var _0x207dd7='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5e28b5;return db[_0x9bf6('0x53')][_0x9bf6('0x30')](_0x207dd7,{'type':db[_0x9bf6('0x56')][_0x9bf6('0x57')][_0x9bf6('0x59')],'raw':!![],'transaction':_0x4cdd44});})[_0x9bf6('0x40')](function(_0x2bae69){var _0x571f9b=_['map'](_0x2bae69,function(_0x561765){return Number(_0x561765['MailQueueId']);});return db[_0x9bf6('0x5c')]['destroy']({'where':{'UserId':{'$in':_0x2fb960},'MailQueueId':{'$in':_0x571f9b}},'transaction':_0x4cdd44});})['then'](function(){var _0x515a0f='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5e28b5;return db[_0x9bf6('0x53')][_0x9bf6('0x30')](_0x515a0f,{'type':db[_0x9bf6('0x56')][_0x9bf6('0x57')][_0x9bf6('0x59')],'raw':!![],'transaction':_0x4cdd44});})[_0x9bf6('0x40')](function(_0xfbf9c4){var _0x436567=_[_0x9bf6('0x2a')](_0xfbf9c4,function(_0x841314){return Number(_0x841314[_0x9bf6('0x5d')]);});return db[_0x9bf6('0x5e')]['destroy']({'where':{'UserId':{'$in':_0x2fb960},'SmsQueueId':{'$in':_0x436567}},'transaction':_0x4cdd44});})[_0x9bf6('0x40')](function(){var _0x53f2d5='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5e28b5;return db['sequelize'][_0x9bf6('0x30')](_0x53f2d5,{'type':db[_0x9bf6('0x56')]['QueryTypes'][_0x9bf6('0x59')],'raw':!![],'transaction':_0x4cdd44});})[_0x9bf6('0x40')](function(_0x3847bd){var _0x1510d1=_['map'](_0x3847bd,function(_0x5ccc28){return Number(_0x5ccc28[_0x9bf6('0x5f')]);});return db[_0x9bf6('0x60')][_0x9bf6('0x52')]({'where':{'UserId':{'$in':_0x2fb960},'ChatQueueId':{'$in':_0x1510d1}},'transaction':_0x4cdd44});})[_0x9bf6('0x40')](function(){var _0x1b79af=_0x9bf6('0x61')+_0x5e28b5;return db['sequelize']['query'](_0x1b79af,{'type':db[_0x9bf6('0x56')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x4cdd44});})[_0x9bf6('0x40')](function(_0x498daa){var _0x2e13a8=_['map'](_0x498daa,function(_0x31e9fd){return Number(_0x31e9fd[_0x9bf6('0x62')]);});return db['UserFaxQueue'][_0x9bf6('0x52')]({'where':{'UserId':{'$in':_0x2fb960},'FaxQueueId':{'$in':_0x2e13a8}},'transaction':_0x4cdd44});})[_0x9bf6('0x40')](function(){var _0x598d9c=_0x9bf6('0x63')+_0x5e28b5;return db[_0x9bf6('0x53')][_0x9bf6('0x30')](_0x598d9c,{'type':db[_0x9bf6('0x56')][_0x9bf6('0x57')]['SELECT'],'raw':!![],'transaction':_0x4cdd44});})[_0x9bf6('0x40')](function(_0x493d50){var _0x309453=_[_0x9bf6('0x2a')](_0x493d50,function(_0x556235){return Number(_0x556235['OpenchannelQueueId']);});return db[_0x9bf6('0x64')][_0x9bf6('0x52')]({'where':{'UserId':{'$in':_0x2fb960},'OpenchannelQueueId':{'$in':_0x309453}},'transaction':_0x4cdd44});})['then'](function(){var _0xeae916=_0x9bf6('0x65')+_0x5e28b5;return db[_0x9bf6('0x53')][_0x9bf6('0x30')](_0xeae916,{'type':db[_0x9bf6('0x56')][_0x9bf6('0x57')]['SELECT'],'raw':!![],'transaction':_0x4cdd44});})[_0x9bf6('0x40')](function(_0x46a5d9){var _0x3f25fd=_[_0x9bf6('0x2a')](_0x46a5d9,function(_0x2db9cb){return Number(_0x2db9cb['WhatsappQueueId']);});return db['UserWhatsappQueue'][_0x9bf6('0x52')]({'where':{'UserId':{'$in':_0x2fb960},'WhatsappQueueId':{'$in':_0x3f25fd}},'transaction':_0x4cdd44});})[_0x9bf6('0x40')](function(){return db[_0x9bf6('0x66')]['find']({'where':{'TeamId':_0x5e28b5}});})[_0x9bf6('0x40')](function(_0x46a434){if(_0x46a434===null){return;}return db[_0x9bf6('0x67')][_0x9bf6('0x52')]({'where':{'UserId':{'$in':_0x2fb960},'VoicePrefixId':_0x46a434['VoicePrefixId']},'transaction':_0x4cdd44});})[_0x9bf6('0x40')](function(){return db[_0x9bf6('0x2b')]['destroy']({'where':{'id':_0x5e28b5},'cascade':!![],'transaction':_0x4cdd44});})['then'](function(_0xa015fd){if(_0xa015fd===0x0){_0x57626a[_0x9bf6('0x1e')](0x194);}else{return db[_0x9bf6('0x68')][_0x9bf6('0x52')]({'where':{'type':_0x9bf6('0x4e'),'resourceId':_0x5e28b5},'cascade':!![],'transaction':_0x4cdd44})[_0x9bf6('0x40')](function(){_0x57626a['status'](0xcc)[_0x9bf6('0x20')]();});}})[_0x9bf6('0x44')](function(_0x4482ab){_0x57626a[_0x9bf6('0x1f')](0x1f4)[_0x9bf6('0x29')](_0x4482ab);});});};exports['getQueues']=function(_0x41c8aa,_0x1ada52,_0x55c969){return db[_0x9bf6('0x2b')]['findOne']({'where':{'id':_0x41c8aa[_0x9bf6('0x46')]['id']}})['then'](handleEntityNotFound(_0x1ada52,null))[_0x9bf6('0x40')](function(_0x4db32a){if(!_0x41c8aa[_0x9bf6('0x30')][_0x9bf6('0x69')]||!utils[_0x9bf6('0x6a')](_0x41c8aa['query'][_0x9bf6('0x69')])){throw new db['Sequelize'][(_0x9bf6('0x6b'))]('Unknown\x20channel');}var _0x2876c0={};var _0x20a87e={};_0x20a87e[_0x9bf6('0x2f')]=_[_0x9bf6('0x31')](db[_['capitalize'](_0x41c8aa[_0x9bf6('0x30')]['channel'][_0x9bf6('0x6c')]())+_0x9bf6('0x6d')]['rawAttributes']);_0x20a87e[_0x9bf6('0x30')]=_[_0x9bf6('0x31')](_0x41c8aa[_0x9bf6('0x30')]);_0x20a87e['filters']=_['intersection'](_0x20a87e[_0x9bf6('0x2f')],_0x20a87e[_0x9bf6('0x30')]);_0x2876c0['attributes']=_['intersection'](_0x20a87e[_0x9bf6('0x2f')],qs[_0x9bf6('0x33')](_0x41c8aa[_0x9bf6('0x30')]['fields']));_0x2876c0[_0x9bf6('0x34')]=_0x2876c0[_0x9bf6('0x34')][_0x9bf6('0x35')]?_0x2876c0['attributes']:_0x20a87e[_0x9bf6('0x2f')];_0x2876c0[_0x9bf6('0x22')]=qs[_0x9bf6('0x22')](_0x41c8aa[_0x9bf6('0x30')][_0x9bf6('0x22')]);_0x2876c0[_0x9bf6('0x24')]=qs[_0x9bf6('0x24')](_0x41c8aa[_0x9bf6('0x30')]['offset']);_0x2876c0[_0x9bf6('0x38')]=qs[_0x9bf6('0x39')](_0x41c8aa[_0x9bf6('0x30')]['sort']);_0x2876c0[_0x9bf6('0x3a')]=qs[_0x9bf6('0x3b')](_[_0x9bf6('0x6e')](_0x41c8aa['query'],_0x20a87e[_0x9bf6('0x3b')]));_0x2876c0=_[_0x9bf6('0x3d')]({},_0x2876c0,_0x41c8aa[_0x9bf6('0x3f')]);return _0x4db32a[_0x9bf6('0x4c')+_[_0x9bf6('0x6f')](_0x41c8aa[_0x9bf6('0x30')]['channel'][_0x9bf6('0x6c')]())+_0x9bf6('0x70')](_0x2876c0);})['then'](respondWithResult(_0x1ada52,null))[_0x9bf6('0x44')](handleError(_0x1ada52,null));};exports['addQueues']=function(_0x17c396,_0x160b9d,_0x48307e){return db['Team'][_0x9bf6('0x71')]({'where':{'id':_0x17c396[_0x9bf6('0x46')]['id']}})['then'](function(_0x38dde0){if(_0x38dde0){if(!_0x17c396['body'][_0x9bf6('0x69')]||!utils[_0x9bf6('0x6a')](_0x17c396['body']['channel'])){throw new db[(_0x9bf6('0x56'))]['ValidationError'](_0x9bf6('0x72'));}return _0x38dde0[_0x9bf6('0x73')+_[_0x9bf6('0x6f')](_0x17c396[_0x9bf6('0x4a')][_0x9bf6('0x69')][_0x9bf6('0x6c')]())+_0x9bf6('0x70')](_0x17c396['body'][_0x9bf6('0x74')]);}return null;})[_0x9bf6('0x40')](handleEntityNotFound(_0x160b9d,null))['then'](respondWithStatusCode(_0x160b9d,null))[_0x9bf6('0x44')](handleError(_0x160b9d,null));};exports[_0x9bf6('0x75')]=function(_0x381344,_0x81d309,_0x467508){return db[_0x9bf6('0x2b')][_0x9bf6('0x71')]({'where':{'id':_0x381344[_0x9bf6('0x46')]['id']}})[_0x9bf6('0x40')](function(_0xf8f52d){if(_0xf8f52d){if(!_0x381344[_0x9bf6('0x30')]['channel']||!utils[_0x9bf6('0x6a')](_0x381344[_0x9bf6('0x30')][_0x9bf6('0x69')])){throw new db[(_0x9bf6('0x56'))][(_0x9bf6('0x6b'))]('Unknown\x20channel');}return _0xf8f52d[_0x9bf6('0x76')+_[_0x9bf6('0x6f')](_0x381344[_0x9bf6('0x30')][_0x9bf6('0x69')][_0x9bf6('0x6c')]())+_0x9bf6('0x70')](_0x381344[_0x9bf6('0x30')][_0x9bf6('0x74')]);}return null;})[_0x9bf6('0x40')](handleEntityNotFound(_0x81d309,null))[_0x9bf6('0x40')](respondWithStatusCode(_0x81d309,null))[_0x9bf6('0x44')](handleError(_0x81d309,null));};exports[_0x9bf6('0x77')]=function(_0x594dbc,_0x3ce335){var _0x13fec1=_[_0x9bf6('0x78')](_0x594dbc[_0x9bf6('0x4a')]['ids'])?_0x594dbc['body'][_0x9bf6('0x74')]:[_0x594dbc[_0x9bf6('0x4a')][_0x9bf6('0x74')]];var _0x2265a2=_0x594dbc['params']['id'];return db[_0x9bf6('0x2b')][_0x9bf6('0x48')]({'where':{'id':_0x2265a2}})['then'](handleEntityNotFound(_0x3ce335,null))[_0x9bf6('0x40')](function(_0x45b977){if(_0x45b977){var _0x2dade5=['Voice',_0x9bf6('0x79'),'Mail',_0x9bf6('0x7a'),_0x9bf6('0x7b'),_0x9bf6('0x7c'),_0x9bf6('0x7d')];return db['sequelize'][_0x9bf6('0x54')](function(_0x92d56a){var _0x92ad7f=_['map'](_0x2dade5,function(_0x362393){var _0x2f451d={'attributes':['id','name']};if(_0x362393===_0x9bf6('0x7e')){_0x2f451d['through']={'attributes':['penalty']};}return _0x45b977[_0x9bf6('0x4c')+_0x362393+'Queues'](_0x2f451d)[_0x9bf6('0x40')](function(_0x59862d){var _0x22f61b=_[_0x9bf6('0x2a')](_0x59862d,function(_0x35cafa){var _0x2451ed=_[_0x9bf6('0x2a')](_0x13fec1,function(_0x15773b){var _0x308abd={'where':{'UserId':_0x15773b,[_0x362393+_0x9bf6('0x7f')]:_0x35cafa['id']},'transaction':_0x92d56a};if(_0x362393==='Voice'){_0x308abd[_0x9bf6('0x18')]={'penalty':_0x35cafa[_0x9bf6('0x80')]['penalty']};}return db[_0x9bf6('0x81')+_0x362393+_0x9bf6('0x6d')][_0x9bf6('0x82')](_0x308abd)['then'](function(){socket['emit'](_0x9bf6('0x4b')+_0x362393+'Queue:save',{'UserId':_0x15773b,[_0x362393+'QueueId']:_0x35cafa['id']});if(_0x362393!==_0x9bf6('0x7e')){return;}return db[_0x9bf6('0x81')][_0x9bf6('0x42')]({'where':{'id':_0x13fec1,'online':0x1},'attributes':['id','name',_0x9bf6('0x83'),_0x9bf6('0x84'),_0x9bf6('0x85')],'raw':!![]})[_0x9bf6('0x40')](function(_0x361530){var _0x44670a=_[_0x9bf6('0x2a')](_0x361530,function(_0x2f56c9){return db[_0x9bf6('0x86')][_0x9bf6('0x87')]({'membername':_0x2f56c9[_0x9bf6('0x28')],'UserId':_0x2f56c9['id'],'queue_name':_0x35cafa['name'],'VoiceQueueId':_0x35cafa['id'],'interface':_[_0x9bf6('0x88')](_0x2f56c9[_0x9bf6('0x85')])?util['format']('SIP/%s',_0x2f56c9[_0x9bf6('0x28')]):_0x2f56c9[_0x9bf6('0x85')],'paused':_0x2f56c9[_0x9bf6('0x84')]||![],'penalty':_0x35cafa['TeamVoiceQueue'][_0x9bf6('0x89')]},{'transaction':_0x92d56a});});return Promise[_0x9bf6('0x8a')](_0x44670a);});});});return Promise[_0x9bf6('0x8a')](_0x2451ed);});return Promise[_0x9bf6('0x8a')](_0x22f61b);})['then'](function(){return db[_0x9bf6('0x66')][_0x9bf6('0x71')]({'where':{'teamId':_0x2265a2}})['then'](function(_0x530364){if(_0x530364){var _0x1ed5de=_[_0x9bf6('0x2a')](_0x13fec1,function(_0x2d117d){db[_0x9bf6('0x67')][_0x9bf6('0x87')]({'UserId':_0x2d117d,'VoicePrefixId':_0x530364[_0x9bf6('0x8b')]});});return Promise['all'](_0x1ed5de);}});});});return Promise['all'](_0x92ad7f)[_0x9bf6('0x40')](function(){return _0x45b977[_0x9bf6('0x77')](_0x13fec1,{'transaction':_0x92d56a})['spread'](function(_0x40434d){return _0x40434d;});});});}})[_0x9bf6('0x40')](respondWithResult(_0x3ce335,null))[_0x9bf6('0x44')](handleError(_0x3ce335,null));};exports[_0x9bf6('0x8c')]=function(_0x5e042d,_0x51c3ef){var _0x15685a=_[_0x9bf6('0x78')](_0x5e042d[_0x9bf6('0x30')][_0x9bf6('0x74')])?_0x5e042d[_0x9bf6('0x30')][_0x9bf6('0x74')]:[_0x5e042d[_0x9bf6('0x30')][_0x9bf6('0x74')]];var _0x432268=_0x5e042d[_0x9bf6('0x46')]['id'];return db[_0x9bf6('0x2b')]['find']({'where':{'id':_0x432268}})['then'](handleEntityNotFound(_0x51c3ef,null))[_0x9bf6('0x40')](function(_0x1c5c47){if(_0x1c5c47){var _0x249385=['Voice',_0x9bf6('0x79'),_0x9bf6('0x8d'),_0x9bf6('0x7a'),_0x9bf6('0x7b'),_0x9bf6('0x7c'),_0x9bf6('0x7d')];return db[_0x9bf6('0x53')][_0x9bf6('0x54')](function(_0x519d9f){var _0x37cd9f=_['map'](_0x249385,function(_0xba1bd4){var _0x43f996={'attributes':['id',_0x9bf6('0x28')]};return _0x1c5c47[_0x9bf6('0x4c')+_0xba1bd4+'Queues'](_0x43f996)[_0x9bf6('0x40')](function(_0x514590){var _0x23bdf0=_[_0x9bf6('0x2a')](_0x514590,function(_0x18283d){return _0x18283d['removeAgents'](_0x15685a,{'transaction':_0x519d9f})[_0x9bf6('0x40')](function(){var _0x3c6b14=_[_0x9bf6('0x2a')](_0x15685a,function(_0x19dcf7){socket[_0x9bf6('0x8e')](_0x9bf6('0x4b')+_0xba1bd4+_0x9bf6('0x8f'),{'UserId':Number(_0x19dcf7),[_0xba1bd4+_0x9bf6('0x7f')]:_0x18283d['id']});if(_0xba1bd4!==_0x9bf6('0x7e')){return;}return db['UserVoiceQueueRt'][_0x9bf6('0x52')]({'where':{'VoiceQueueId':_0x18283d['id'],'UserId':_0x19dcf7},'transaction':_0x519d9f});});return Promise[_0x9bf6('0x8a')](_0x3c6b14);});});return Promise['all'](_0x23bdf0);});});return Promise['all'](_0x37cd9f)[_0x9bf6('0x40')](function(){return _0x1c5c47[_0x9bf6('0x8c')](_0x15685a,{'transaction':_0x519d9f});})[_0x9bf6('0x40')](function(){return db[_0x9bf6('0x66')][_0x9bf6('0x71')]({'where':{'teamId':_0x432268}})[_0x9bf6('0x40')](function(_0x13330a){if(_0x13330a){var _0x1062f2=_[_0x9bf6('0x2a')](_0x15685a,function(_0x12a300){db[_0x9bf6('0x67')][_0x9bf6('0x52')]({'where':{'UserId':_0x12a300,'VoicePrefixId':_0x13330a['VoicePrefixId']}});});return Promise[_0x9bf6('0x8a')](_0x1062f2);}});});});}})[_0x9bf6('0x40')](respondWithStatusCode(_0x51c3ef,null))['catch'](handleError(_0x51c3ef,null));};exports[_0x9bf6('0x90')]=function(_0x3fe02a,_0x433fb3,_0x49d804){var _0xc44c9b={};var _0x354a50={};var _0x42a30f;var _0x4247ac;return db[_0x9bf6('0x2b')][_0x9bf6('0x71')]({'where':{'id':_0x3fe02a['params']['id']}})[_0x9bf6('0x40')](handleEntityNotFound(_0x433fb3,null))[_0x9bf6('0x40')](function(_0x38d3fb){if(_0x38d3fb){_0x42a30f=_0x38d3fb;_0x354a50['model']=_[_0x9bf6('0x31')](db[_0x9bf6('0x81')][_0x9bf6('0x2c')]);_0x354a50[_0x9bf6('0x30')]=_['keys'](_0x3fe02a[_0x9bf6('0x30')]);_0x354a50[_0x9bf6('0x3b')]=_[_0x9bf6('0x32')](_0x354a50['model'],_0x354a50[_0x9bf6('0x30')]);_0xc44c9b[_0x9bf6('0x34')]=_['intersection'](_0x354a50[_0x9bf6('0x2f')],qs[_0x9bf6('0x33')](_0x3fe02a['query'][_0x9bf6('0x33')]));_0xc44c9b['attributes']=_0xc44c9b[_0x9bf6('0x34')]['length']?_0xc44c9b['attributes']:_0x354a50[_0x9bf6('0x2f')];_0xc44c9b[_0x9bf6('0x38')]=qs[_0x9bf6('0x39')](_0x3fe02a['query'][_0x9bf6('0x39')]);_0xc44c9b[_0x9bf6('0x3a')]=qs[_0x9bf6('0x3b')](_[_0x9bf6('0x6e')](_0x3fe02a[_0x9bf6('0x30')],_0x354a50['filters']));if(_0x3fe02a['query']['filter']){_0xc44c9b[_0x9bf6('0x3a')]=_[_0x9bf6('0x3d')](_0xc44c9b[_0x9bf6('0x3a')],{'$or':_[_0x9bf6('0x2a')](_0xc44c9b['attributes'],function(_0x5048e8){var _0x4ae000={};_0x4ae000[_0x5048e8]={'$like':'%'+_0x3fe02a[_0x9bf6('0x30')][_0x9bf6('0x3c')]+'%'};return _0x4ae000;})});}_0xc44c9b=_[_0x9bf6('0x3d')]({},_0xc44c9b,_0x3fe02a['options']);return _0x42a30f[_0x9bf6('0x90')](_0xc44c9b);}})[_0x9bf6('0x40')](function(_0x5c8181){if(_0x5c8181){_0x4247ac=_0x5c8181[_0x9bf6('0x35')];if(!_0x3fe02a[_0x9bf6('0x30')]['hasOwnProperty'](_0x9bf6('0x37'))){_0xc44c9b['limit']=qs['limit'](_0x3fe02a['query'][_0x9bf6('0x22')]);_0xc44c9b['offset']=qs[_0x9bf6('0x24')](_0x3fe02a['query']['offset']);}return _0x42a30f['getAgents'](_0xc44c9b);}})['then'](function(_0xaa2bd0){if(_0xaa2bd0){return _0xaa2bd0?{'count':_0x4247ac,'rows':_0xaa2bd0}:null;}})['then'](respondWithResult(_0x433fb3,null))['catch'](handleError(_0x433fb3,null));}; \ No newline at end of file +var _0xb5d5=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./team.socket','register','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','then','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','VoiceQueueId','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','Queue','length','toLowerCase','Queues','removeQueues','ids','addAgents','isArray','Voice','Chat','Fax','Openchannel','Whatsapp','through','penalty','QueueId','TeamVoiceQueue','findOrCreate','emit','Queue:save','User','online','voicePause','isNil','interface','format','SIP/%s','all','upsert','removeAgents','Mail','Sms','UserVoiceQueueRt','getAgents','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto'];(function(_0x31edbe,_0x34d231){var _0x37fcee=function(_0x17ecba){while(--_0x17ecba){_0x31edbe['push'](_0x31edbe['shift']());}};_0x37fcee(++_0x34d231);}(_0xb5d5,0x93));var _0x5b5d=function(_0x1f639e,_0x560d72){_0x1f639e=_0x1f639e-0x0;var _0x5a3b4c=_0xb5d5[_0x1f639e];return _0x5a3b4c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5b5d('0x0'));var zipdir=require(_0x5b5d('0x1'));var jsonpatch=require(_0x5b5d('0x2'));var rp=require(_0x5b5d('0x3'));var moment=require(_0x5b5d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5b5d('0x5'));var util=require(_0x5b5d('0x6'));var path=require(_0x5b5d('0x7'));var sox=require(_0x5b5d('0x8'));var csv=require(_0x5b5d('0x9'));var ejs=require(_0x5b5d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5b5d('0xb'));var crypto=require(_0x5b5d('0xc'));var jsforce=require(_0x5b5d('0xd'));var deskjs=require(_0x5b5d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5b5d('0xf'));var Papa=require('papaparse');var Redis=require(_0x5b5d('0x10'));var authService=require(_0x5b5d('0x11'));var qs=require(_0x5b5d('0x12'));var as=require(_0x5b5d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5b5d('0x14'))('api');var utils=require(_0x5b5d('0x15'));var config=require(_0x5b5d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5b5d('0x17'))['db'];config['redis']=_[_0x5b5d('0x18')](config[_0x5b5d('0x19')],{'host':_0x5b5d('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5b5d('0x19')]));require(_0x5b5d('0x1b'))[_0x5b5d('0x1c')](socket);function respondWithStatusCode(_0x17235e,_0x3c8bc2){_0x3c8bc2=_0x3c8bc2||0xcc;return function(_0x125ded){if(_0x125ded){return _0x17235e[_0x5b5d('0x1d')](_0x3c8bc2);}return _0x17235e['status'](_0x3c8bc2)[_0x5b5d('0x1e')]();};}function respondWithResult(_0x1280a6,_0x5955d5){_0x5955d5=_0x5955d5||0xc8;return function(_0x174171){if(_0x174171){return _0x1280a6[_0x5b5d('0x1f')](_0x5955d5)['json'](_0x174171);}};}function respondWithFilteredResult(_0x19c619,_0x513426){return function(_0x4a5e2d){if(_0x4a5e2d){var _0x32466c=typeof _0x513426['offset']===_0x5b5d('0x20')&&typeof _0x513426[_0x5b5d('0x21')]===_0x5b5d('0x20');var _0xc716c0=_0x4a5e2d[_0x5b5d('0x22')];var _0x5b8a1d=_0x32466c?0x0:_0x513426['offset'];var _0x389afa=_0x32466c?_0x4a5e2d[_0x5b5d('0x22')]:_0x513426[_0x5b5d('0x23')]+_0x513426['limit'];var _0x2d7ec7;if(_0x389afa>=_0xc716c0){_0x389afa=_0xc716c0;_0x2d7ec7=0xc8;}else{_0x2d7ec7=0xce;}_0x19c619[_0x5b5d('0x1f')](_0x2d7ec7);return _0x19c619[_0x5b5d('0x24')](_0x5b5d('0x25'),_0x5b8a1d+'-'+_0x389afa+'/'+_0xc716c0)[_0x5b5d('0x26')](_0x4a5e2d);}return null;};}function patchUpdates(_0x316088){return function(_0x28370d){try{jsonpatch[_0x5b5d('0x27')](_0x28370d,_0x316088,!![]);}catch(_0x48821f){return BPromise[_0x5b5d('0x28')](_0x48821f);}return _0x28370d['save']();};}function saveUpdates(_0x295b77,_0x3d464c){return function(_0x30f402){if(_0x30f402){return _0x30f402[_0x5b5d('0x29')](_0x295b77)[_0x5b5d('0x2a')](function(_0x4ede6b){return _0x4ede6b;});}return null;};}function handleEntityNotFound(_0x213258,_0x8cc335){return function(_0x4c0bf9){if(!_0x4c0bf9){_0x213258[_0x5b5d('0x1d')](0x194);}return _0x4c0bf9;};}function handleError(_0xc7f015,_0x5a6c17){_0x5a6c17=_0x5a6c17||0x1f4;return function(_0x1defed){logger[_0x5b5d('0x2b')](_0x1defed[_0x5b5d('0x2c')]);if(_0x1defed[_0x5b5d('0x2d')]){delete _0x1defed[_0x5b5d('0x2d')];}_0xc7f015[_0x5b5d('0x1f')](_0x5a6c17)[_0x5b5d('0x2e')](_0x1defed);};}exports[_0x5b5d('0x2f')]=function(_0x20c0ca,_0x442703){var _0x31dd74={},_0x2ac550={},_0x3e5087={'count':0x0,'rows':[]};var _0x455e85=_[_0x5b5d('0x30')](db[_0x5b5d('0x31')][_0x5b5d('0x32')],function(_0x39f4b2){return{'name':_0x39f4b2[_0x5b5d('0x33')],'type':_0x39f4b2[_0x5b5d('0x34')][_0x5b5d('0x35')]};});_0x2ac550[_0x5b5d('0x36')]=_[_0x5b5d('0x30')](_0x455e85,'name');_0x2ac550[_0x5b5d('0x37')]=_[_0x5b5d('0x38')](_0x20c0ca[_0x5b5d('0x37')]);_0x2ac550['filters']=_[_0x5b5d('0x39')](_0x2ac550[_0x5b5d('0x36')],_0x2ac550[_0x5b5d('0x37')]);_0x31dd74['attributes']=_[_0x5b5d('0x39')](_0x2ac550['model'],qs[_0x5b5d('0x3a')](_0x20c0ca[_0x5b5d('0x37')][_0x5b5d('0x3a')]));_0x31dd74[_0x5b5d('0x3b')]=_0x31dd74['attributes']['length']?_0x31dd74[_0x5b5d('0x3b')]:_0x2ac550[_0x5b5d('0x36')];if(!_0x20c0ca['query'][_0x5b5d('0x3c')]('nolimit')){_0x31dd74[_0x5b5d('0x21')]=qs[_0x5b5d('0x21')](_0x20c0ca['query'][_0x5b5d('0x21')]);_0x31dd74[_0x5b5d('0x23')]=qs[_0x5b5d('0x23')](_0x20c0ca[_0x5b5d('0x37')]['offset']);}_0x31dd74[_0x5b5d('0x3d')]=qs[_0x5b5d('0x3e')](_0x20c0ca[_0x5b5d('0x37')][_0x5b5d('0x3e')]);_0x31dd74[_0x5b5d('0x3f')]=qs[_0x5b5d('0x40')](_[_0x5b5d('0x41')](_0x20c0ca[_0x5b5d('0x37')],_0x2ac550[_0x5b5d('0x40')]),_0x455e85);if(_0x20c0ca[_0x5b5d('0x37')][_0x5b5d('0x42')]){_0x31dd74[_0x5b5d('0x3f')]=_['merge'](_0x31dd74[_0x5b5d('0x3f')],{'$or':_[_0x5b5d('0x30')](_0x455e85,function(_0x89a79e){if(_0x89a79e[_0x5b5d('0x34')]!==_0x5b5d('0x43')){var _0x580ae1={};_0x580ae1[_0x89a79e['name']]={'$like':'%'+_0x20c0ca[_0x5b5d('0x37')]['filter']+'%'};return _0x580ae1;}})});}_0x31dd74=_['merge']({},_0x31dd74,_0x20c0ca[_0x5b5d('0x44')]);var _0x5e8e3e={'where':_0x31dd74[_0x5b5d('0x3f')]};return db[_0x5b5d('0x31')][_0x5b5d('0x22')](_0x5e8e3e)[_0x5b5d('0x2a')](function(_0x3a25d3){_0x3e5087[_0x5b5d('0x22')]=_0x3a25d3;if(_0x20c0ca[_0x5b5d('0x37')][_0x5b5d('0x45')]){_0x31dd74[_0x5b5d('0x46')]=[{'all':!![]}];}return db[_0x5b5d('0x31')][_0x5b5d('0x47')](_0x31dd74);})[_0x5b5d('0x2a')](function(_0x2750a6){_0x3e5087[_0x5b5d('0x48')]=_0x2750a6;return _0x3e5087;})['then'](respondWithFilteredResult(_0x442703,_0x31dd74))[_0x5b5d('0x49')](handleError(_0x442703,null));};exports[_0x5b5d('0x4a')]=function(_0x5b5bf3,_0x181e47){var _0x1392da={'raw':![],'where':{'id':_0x5b5bf3[_0x5b5d('0x4b')]['id']}},_0x212e7b={};_0x212e7b[_0x5b5d('0x36')]=_[_0x5b5d('0x38')](db['Team'][_0x5b5d('0x32')]);_0x212e7b['query']=_[_0x5b5d('0x38')](_0x5b5bf3[_0x5b5d('0x37')]);_0x212e7b[_0x5b5d('0x40')]=_['intersection'](_0x212e7b[_0x5b5d('0x36')],_0x212e7b[_0x5b5d('0x37')]);_0x1392da[_0x5b5d('0x3b')]=_[_0x5b5d('0x39')](_0x212e7b[_0x5b5d('0x36')],qs[_0x5b5d('0x3a')](_0x5b5bf3['query'][_0x5b5d('0x3a')]));_0x1392da[_0x5b5d('0x3b')]=_0x1392da[_0x5b5d('0x3b')]['length']?_0x1392da['attributes']:_0x212e7b[_0x5b5d('0x36')];if(_0x5b5bf3['query'][_0x5b5d('0x45')]){_0x1392da['include']=[{'all':!![]}];}_0x1392da=_[_0x5b5d('0x4c')]({},_0x1392da,_0x5b5bf3[_0x5b5d('0x44')]);return db[_0x5b5d('0x31')][_0x5b5d('0x4d')](_0x1392da)['then'](handleEntityNotFound(_0x181e47,null))[_0x5b5d('0x2a')](respondWithResult(_0x181e47,null))[_0x5b5d('0x49')](handleError(_0x181e47,null));};exports[_0x5b5d('0x4e')]=function(_0x2b82d3,_0x2fbfb3){return db[_0x5b5d('0x31')][_0x5b5d('0x4e')](_0x2b82d3[_0x5b5d('0x4f')],{})['then'](function(_0x1cb36f){var _0x34f9a8=_0x2b82d3[_0x5b5d('0x50')][_0x5b5d('0x51')]({'plain':!![]});if(!_0x34f9a8)throw new Error(_0x5b5d('0x52'));if(_0x34f9a8[_0x5b5d('0x53')]===_0x5b5d('0x50')){var _0xc96172=_0x1cb36f[_0x5b5d('0x51')]({'plain':!![]});var _0x414b52=_0x5b5d('0x54');return db[_0x5b5d('0x55')][_0x5b5d('0x4d')]({'where':{'name':_0x414b52,'userProfileId':_0x34f9a8[_0x5b5d('0x56')]},'raw':!![]})[_0x5b5d('0x2a')](function(_0x2a5331){if(_0x2a5331&&_0x2a5331[_0x5b5d('0x57')]===0x0){return db[_0x5b5d('0x58')][_0x5b5d('0x4e')]({'name':_0xc96172[_0x5b5d('0x2d')],'resourceId':_0xc96172['id'],'type':_0x2a5331[_0x5b5d('0x2d')],'sectionId':_0x2a5331['id']},{})[_0x5b5d('0x2a')](function(){return _0x1cb36f;});}else{return _0x1cb36f;}})[_0x5b5d('0x49')](function(_0xbdee41){logger[_0x5b5d('0x2b')](_0x5b5d('0x59'),_0xbdee41);throw _0xbdee41;});}return _0x1cb36f;})[_0x5b5d('0x2a')](respondWithResult(_0x2fbfb3,0xc9))['catch'](handleError(_0x2fbfb3,null));};exports[_0x5b5d('0x29')]=function(_0x682464,_0x2811c5){if(_0x682464[_0x5b5d('0x4f')]['id']){delete _0x682464[_0x5b5d('0x4f')]['id'];}return db[_0x5b5d('0x31')][_0x5b5d('0x4d')]({'where':{'id':_0x682464['params']['id']}})[_0x5b5d('0x2a')](handleEntityNotFound(_0x2811c5,null))[_0x5b5d('0x2a')](saveUpdates(_0x682464['body'],null))['then'](respondWithResult(_0x2811c5,null))[_0x5b5d('0x49')](handleError(_0x2811c5,null));};exports['destroy']=function(_0x5be3a5,_0xc1f365){var _0x1b2269=_0x5be3a5[_0x5b5d('0x4b')]['id'];var _0x53fed1=[];return db[_0x5b5d('0x5a')][_0x5b5d('0x5b')](function(_0x1b84b4){var _0x114794=_0x5b5d('0x5c')+_0x1b2269;return db[_0x5b5d('0x5a')][_0x5b5d('0x37')](_0x114794,{'type':db[_0x5b5d('0x5d')]['QueryTypes'][_0x5b5d('0x5e')],'raw':!![],'transaction':_0x1b84b4})[_0x5b5d('0x2a')](function(_0x2b2ca1){_0x53fed1=_['map'](_0x2b2ca1,function(_0x2781d5){return Number(_0x2781d5[_0x5b5d('0x5f')]);});})[_0x5b5d('0x2a')](function(){var _0x13f3c8=_0x5b5d('0x60')+_0x1b2269;return db[_0x5b5d('0x5a')]['query'](_0x13f3c8,{'type':db[_0x5b5d('0x5d')][_0x5b5d('0x61')]['SELECT'],'raw':!![],'transaction':_0x1b84b4});})[_0x5b5d('0x2a')](function(_0x578b9f){var _0x135094=_[_0x5b5d('0x30')](_0x578b9f,function(_0x816e8){return Number(_0x816e8[_0x5b5d('0x62')]);});return db[_0x5b5d('0x63')][_0x5b5d('0x64')]({'where':{'UserId':{'$in':_0x53fed1},'VoiceQueueId':{'$in':_0x135094}},'transaction':_0x1b84b4});})[_0x5b5d('0x2a')](function(){var _0x139ee5=_0x5b5d('0x65')+_0x1b2269;return db['sequelize'][_0x5b5d('0x37')](_0x139ee5,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x1b84b4});})[_0x5b5d('0x2a')](function(_0x476e72){var _0x1473af=_[_0x5b5d('0x30')](_0x476e72,function(_0x2c9510){return Number(_0x2c9510['MailQueueId']);});return db[_0x5b5d('0x66')][_0x5b5d('0x64')]({'where':{'UserId':{'$in':_0x53fed1},'MailQueueId':{'$in':_0x1473af}},'transaction':_0x1b84b4});})[_0x5b5d('0x2a')](function(){var _0x32084f='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1b2269;return db['sequelize']['query'](_0x32084f,{'type':db[_0x5b5d('0x5d')][_0x5b5d('0x61')][_0x5b5d('0x5e')],'raw':!![],'transaction':_0x1b84b4});})[_0x5b5d('0x2a')](function(_0x3f73b9){var _0x4f0f21=_['map'](_0x3f73b9,function(_0x33d300){return Number(_0x33d300[_0x5b5d('0x67')]);});return db[_0x5b5d('0x68')][_0x5b5d('0x64')]({'where':{'UserId':{'$in':_0x53fed1},'SmsQueueId':{'$in':_0x4f0f21}},'transaction':_0x1b84b4});})[_0x5b5d('0x2a')](function(){var _0x4fa89e=_0x5b5d('0x69')+_0x1b2269;return db[_0x5b5d('0x5a')]['query'](_0x4fa89e,{'type':db[_0x5b5d('0x5d')][_0x5b5d('0x61')][_0x5b5d('0x5e')],'raw':!![],'transaction':_0x1b84b4});})[_0x5b5d('0x2a')](function(_0x3f715c){var _0x1080ba=_[_0x5b5d('0x30')](_0x3f715c,function(_0x25217b){return Number(_0x25217b[_0x5b5d('0x6a')]);});return db[_0x5b5d('0x6b')]['destroy']({'where':{'UserId':{'$in':_0x53fed1},'ChatQueueId':{'$in':_0x1080ba}},'transaction':_0x1b84b4});})[_0x5b5d('0x2a')](function(){var _0x1ad0b2=_0x5b5d('0x6c')+_0x1b2269;return db[_0x5b5d('0x5a')][_0x5b5d('0x37')](_0x1ad0b2,{'type':db['Sequelize'][_0x5b5d('0x61')][_0x5b5d('0x5e')],'raw':!![],'transaction':_0x1b84b4});})[_0x5b5d('0x2a')](function(_0x2c24b1){var _0x5c8074=_[_0x5b5d('0x30')](_0x2c24b1,function(_0x185f71){return Number(_0x185f71['FaxQueueId']);});return db[_0x5b5d('0x6d')]['destroy']({'where':{'UserId':{'$in':_0x53fed1},'FaxQueueId':{'$in':_0x5c8074}},'transaction':_0x1b84b4});})[_0x5b5d('0x2a')](function(){var _0x27c510=_0x5b5d('0x6e')+_0x1b2269;return db[_0x5b5d('0x5a')]['query'](_0x27c510,{'type':db[_0x5b5d('0x5d')]['QueryTypes'][_0x5b5d('0x5e')],'raw':!![],'transaction':_0x1b84b4});})[_0x5b5d('0x2a')](function(_0x4b50e0){var _0xd3dfa7=_[_0x5b5d('0x30')](_0x4b50e0,function(_0x49e1cf){return Number(_0x49e1cf[_0x5b5d('0x6f')]);});return db[_0x5b5d('0x70')][_0x5b5d('0x64')]({'where':{'UserId':{'$in':_0x53fed1},'OpenchannelQueueId':{'$in':_0xd3dfa7}},'transaction':_0x1b84b4});})[_0x5b5d('0x2a')](function(){var _0x7cbdf4=_0x5b5d('0x71')+_0x1b2269;return db[_0x5b5d('0x5a')]['query'](_0x7cbdf4,{'type':db[_0x5b5d('0x5d')][_0x5b5d('0x61')][_0x5b5d('0x5e')],'raw':!![],'transaction':_0x1b84b4});})[_0x5b5d('0x2a')](function(_0x8e13bf){var _0x23d01e=_[_0x5b5d('0x30')](_0x8e13bf,function(_0x55244a){return Number(_0x55244a[_0x5b5d('0x72')]);});return db['UserWhatsappQueue'][_0x5b5d('0x64')]({'where':{'UserId':{'$in':_0x53fed1},'WhatsappQueueId':{'$in':_0x23d01e}},'transaction':_0x1b84b4});})[_0x5b5d('0x2a')](function(){return db[_0x5b5d('0x73')][_0x5b5d('0x4d')]({'where':{'TeamId':_0x1b2269}});})[_0x5b5d('0x2a')](function(_0x5c86a7){if(_0x5c86a7===null){return;}return db[_0x5b5d('0x74')]['destroy']({'where':{'UserId':{'$in':_0x53fed1},'VoicePrefixId':_0x5c86a7[_0x5b5d('0x75')]},'transaction':_0x1b84b4});})['then'](function(){return db[_0x5b5d('0x31')][_0x5b5d('0x64')]({'where':{'id':_0x1b2269},'cascade':!![],'transaction':_0x1b84b4});})[_0x5b5d('0x2a')](function(_0x174f9c){if(_0x174f9c===0x0){_0xc1f365[_0x5b5d('0x1d')](0x194);}else{return db[_0x5b5d('0x58')][_0x5b5d('0x64')]({'where':{'type':_0x5b5d('0x54'),'resourceId':_0x1b2269},'cascade':!![],'transaction':_0x1b84b4})[_0x5b5d('0x2a')](function(){_0xc1f365[_0x5b5d('0x1f')](0xcc)['end']();});}})[_0x5b5d('0x49')](function(_0x35a4a3){_0xc1f365[_0x5b5d('0x1f')](0x1f4)[_0x5b5d('0x2e')](_0x35a4a3);});});};exports[_0x5b5d('0x76')]=function(_0x293c2f,_0x1819a2,_0x508859){return db[_0x5b5d('0x31')][_0x5b5d('0x77')]({'where':{'id':_0x293c2f[_0x5b5d('0x4b')]['id']}})[_0x5b5d('0x2a')](handleEntityNotFound(_0x1819a2,null))[_0x5b5d('0x2a')](function(_0x5b447c){if(!_0x293c2f[_0x5b5d('0x37')][_0x5b5d('0x78')]||!utils[_0x5b5d('0x79')](_0x293c2f[_0x5b5d('0x37')][_0x5b5d('0x78')])){throw new db['Sequelize'][(_0x5b5d('0x7a'))](_0x5b5d('0x7b'));}var _0x2831b3={};var _0x5bae61={};_0x5bae61[_0x5b5d('0x36')]=_['keys'](db[_[_0x5b5d('0x7c')](_0x293c2f[_0x5b5d('0x37')][_0x5b5d('0x78')]['toLowerCase']())+_0x5b5d('0x7d')][_0x5b5d('0x32')]);_0x5bae61[_0x5b5d('0x37')]=_[_0x5b5d('0x38')](_0x293c2f['query']);_0x5bae61[_0x5b5d('0x40')]=_['intersection'](_0x5bae61[_0x5b5d('0x36')],_0x5bae61['query']);_0x2831b3[_0x5b5d('0x3b')]=_['intersection'](_0x5bae61['model'],qs['fields'](_0x293c2f[_0x5b5d('0x37')]['fields']));_0x2831b3[_0x5b5d('0x3b')]=_0x2831b3[_0x5b5d('0x3b')][_0x5b5d('0x7e')]?_0x2831b3[_0x5b5d('0x3b')]:_0x5bae61[_0x5b5d('0x36')];_0x2831b3[_0x5b5d('0x21')]=qs['limit'](_0x293c2f[_0x5b5d('0x37')][_0x5b5d('0x21')]);_0x2831b3['offset']=qs[_0x5b5d('0x23')](_0x293c2f[_0x5b5d('0x37')]['offset']);_0x2831b3['order']=qs[_0x5b5d('0x3e')](_0x293c2f[_0x5b5d('0x37')][_0x5b5d('0x3e')]);_0x2831b3['where']=qs['filters'](_[_0x5b5d('0x41')](_0x293c2f['query'],_0x5bae61['filters']));_0x2831b3=_[_0x5b5d('0x4c')]({},_0x2831b3,_0x293c2f[_0x5b5d('0x44')]);return _0x5b447c[_0x5b5d('0x51')+_[_0x5b5d('0x7c')](_0x293c2f[_0x5b5d('0x37')][_0x5b5d('0x78')][_0x5b5d('0x7f')]())+_0x5b5d('0x80')](_0x2831b3);})[_0x5b5d('0x2a')](respondWithResult(_0x1819a2,null))[_0x5b5d('0x49')](handleError(_0x1819a2,null));};exports['addQueues']=function(_0x5d3d7d,_0xdce5d2,_0x81718e){return db[_0x5b5d('0x31')]['findOne']({'where':{'id':_0x5d3d7d[_0x5b5d('0x4b')]['id']}})[_0x5b5d('0x2a')](function(_0x409b8a){if(_0x409b8a){if(!_0x5d3d7d['body'][_0x5b5d('0x78')]||!utils[_0x5b5d('0x79')](_0x5d3d7d[_0x5b5d('0x4f')][_0x5b5d('0x78')])){throw new db[(_0x5b5d('0x5d'))][(_0x5b5d('0x7a'))](_0x5b5d('0x7b'));}return _0x409b8a['add'+_[_0x5b5d('0x7c')](_0x5d3d7d['body']['channel'][_0x5b5d('0x7f')]())+_0x5b5d('0x80')](_0x5d3d7d[_0x5b5d('0x4f')]['ids']);}return null;})[_0x5b5d('0x2a')](handleEntityNotFound(_0xdce5d2,null))[_0x5b5d('0x2a')](respondWithStatusCode(_0xdce5d2,null))[_0x5b5d('0x49')](handleError(_0xdce5d2,null));};exports[_0x5b5d('0x81')]=function(_0x188297,_0x280d43,_0x244855){return db[_0x5b5d('0x31')]['findOne']({'where':{'id':_0x188297[_0x5b5d('0x4b')]['id']}})[_0x5b5d('0x2a')](function(_0x2caeb4){if(_0x2caeb4){if(!_0x188297[_0x5b5d('0x37')][_0x5b5d('0x78')]||!utils[_0x5b5d('0x79')](_0x188297['query'][_0x5b5d('0x78')])){throw new db[(_0x5b5d('0x5d'))]['ValidationError'](_0x5b5d('0x7b'));}return _0x2caeb4['remove'+_[_0x5b5d('0x7c')](_0x188297[_0x5b5d('0x37')][_0x5b5d('0x78')][_0x5b5d('0x7f')]())+_0x5b5d('0x80')](_0x188297[_0x5b5d('0x37')][_0x5b5d('0x82')]);}return null;})[_0x5b5d('0x2a')](handleEntityNotFound(_0x280d43,null))[_0x5b5d('0x2a')](respondWithStatusCode(_0x280d43,null))[_0x5b5d('0x49')](handleError(_0x280d43,null));};exports[_0x5b5d('0x83')]=function(_0xf08264,_0x38f6aa){var _0x4e589d=_[_0x5b5d('0x84')](_0xf08264[_0x5b5d('0x4f')][_0x5b5d('0x82')])?_0xf08264[_0x5b5d('0x4f')][_0x5b5d('0x82')]:[_0xf08264[_0x5b5d('0x4f')][_0x5b5d('0x82')]];var _0x27ebbd=_0xf08264[_0x5b5d('0x4b')]['id'];return db[_0x5b5d('0x31')][_0x5b5d('0x4d')]({'where':{'id':_0x27ebbd}})[_0x5b5d('0x2a')](handleEntityNotFound(_0x38f6aa,null))[_0x5b5d('0x2a')](function(_0x5e8a29){if(_0x5e8a29){var _0x25046d=[_0x5b5d('0x85'),_0x5b5d('0x86'),'Mail','Sms',_0x5b5d('0x87'),_0x5b5d('0x88'),_0x5b5d('0x89')];return db[_0x5b5d('0x5a')][_0x5b5d('0x5b')](function(_0x356500){var _0xf47cf2=_[_0x5b5d('0x30')](_0x25046d,function(_0x135b11){var _0x47f172={'attributes':['id',_0x5b5d('0x2d')]};if(_0x135b11===_0x5b5d('0x85')){_0x47f172[_0x5b5d('0x8a')]={'attributes':[_0x5b5d('0x8b')]};}return _0x5e8a29['get'+_0x135b11+_0x5b5d('0x80')](_0x47f172)[_0x5b5d('0x2a')](function(_0x2fd9e8){var _0x23fad1=_[_0x5b5d('0x30')](_0x2fd9e8,function(_0x39b65a){var _0x49ed16=_[_0x5b5d('0x30')](_0x4e589d,function(_0x289a53){var _0x16af7b={'where':{'UserId':_0x289a53,[_0x135b11+_0x5b5d('0x8c')]:_0x39b65a['id']},'transaction':_0x356500};if(_0x135b11==='Voice'){_0x16af7b['defaults']={'penalty':_0x39b65a[_0x5b5d('0x8d')][_0x5b5d('0x8b')]};}return db['User'+_0x135b11+'Queue'][_0x5b5d('0x8e')](_0x16af7b)[_0x5b5d('0x2a')](function(){socket[_0x5b5d('0x8f')]('user'+_0x135b11+_0x5b5d('0x90'),{'UserId':_0x289a53,[_0x135b11+_0x5b5d('0x8c')]:_0x39b65a['id']});if(_0x135b11!==_0x5b5d('0x85')){return;}return db[_0x5b5d('0x91')][_0x5b5d('0x47')]({'where':{'id':_0x4e589d,'online':0x1},'attributes':['id',_0x5b5d('0x2d'),_0x5b5d('0x92'),_0x5b5d('0x93'),'interface'],'raw':!![]})[_0x5b5d('0x2a')](function(_0x2af20b){var _0x56ca31=_['map'](_0x2af20b,function(_0x512e78){return db['UserVoiceQueueRt']['upsert']({'membername':_0x512e78[_0x5b5d('0x2d')],'UserId':_0x512e78['id'],'queue_name':_0x39b65a[_0x5b5d('0x2d')],'VoiceQueueId':_0x39b65a['id'],'interface':_[_0x5b5d('0x94')](_0x512e78[_0x5b5d('0x95')])?util[_0x5b5d('0x96')](_0x5b5d('0x97'),_0x512e78[_0x5b5d('0x2d')]):_0x512e78[_0x5b5d('0x95')],'paused':_0x512e78[_0x5b5d('0x93')]||![],'penalty':_0x39b65a[_0x5b5d('0x8d')][_0x5b5d('0x8b')]},{'transaction':_0x356500});});return Promise[_0x5b5d('0x98')](_0x56ca31);});});});return Promise['all'](_0x49ed16);});return Promise[_0x5b5d('0x98')](_0x23fad1);})['then'](function(){return db[_0x5b5d('0x73')]['findOne']({'where':{'teamId':_0x27ebbd}})['then'](function(_0x3af7c6){if(_0x3af7c6){var _0x33b7af=_['map'](_0x4e589d,function(_0x7886){db[_0x5b5d('0x74')][_0x5b5d('0x99')]({'UserId':_0x7886,'VoicePrefixId':_0x3af7c6[_0x5b5d('0x75')]});});return Promise[_0x5b5d('0x98')](_0x33b7af);}});});});return Promise[_0x5b5d('0x98')](_0xf47cf2)[_0x5b5d('0x2a')](function(){return _0x5e8a29['addAgents'](_0x4e589d,{'transaction':_0x356500})['spread'](function(_0x531512){return _0x531512;});});});}})['then'](respondWithResult(_0x38f6aa,null))[_0x5b5d('0x49')](handleError(_0x38f6aa,null));};exports[_0x5b5d('0x9a')]=function(_0x228a98,_0x2174a1){var _0x205ecf=_['isArray'](_0x228a98[_0x5b5d('0x37')][_0x5b5d('0x82')])?_0x228a98[_0x5b5d('0x37')]['ids']:[_0x228a98[_0x5b5d('0x37')]['ids']];var _0x35a033=_0x228a98['params']['id'];return db[_0x5b5d('0x31')][_0x5b5d('0x4d')]({'where':{'id':_0x35a033}})[_0x5b5d('0x2a')](handleEntityNotFound(_0x2174a1,null))[_0x5b5d('0x2a')](function(_0x143975){if(_0x143975){var _0x313252=[_0x5b5d('0x85'),'Chat',_0x5b5d('0x9b'),_0x5b5d('0x9c'),_0x5b5d('0x87'),_0x5b5d('0x88'),_0x5b5d('0x89')];return db[_0x5b5d('0x5a')]['transaction'](function(_0x39c258){var _0x12e341=_[_0x5b5d('0x30')](_0x313252,function(_0x271e26){var _0x5e55c4={'attributes':['id',_0x5b5d('0x2d')]};return _0x143975[_0x5b5d('0x51')+_0x271e26+_0x5b5d('0x80')](_0x5e55c4)[_0x5b5d('0x2a')](function(_0x57797b){var _0x510b78=_[_0x5b5d('0x30')](_0x57797b,function(_0x18eb7b){return _0x18eb7b['removeAgents'](_0x205ecf,{'transaction':_0x39c258})[_0x5b5d('0x2a')](function(){var _0x589632=_[_0x5b5d('0x30')](_0x205ecf,function(_0x1839db){socket[_0x5b5d('0x8f')](_0x5b5d('0x50')+_0x271e26+'Queue:remove',{'UserId':Number(_0x1839db),[_0x271e26+'QueueId']:_0x18eb7b['id']});if(_0x271e26!=='Voice'){return;}return db[_0x5b5d('0x9d')]['destroy']({'where':{'VoiceQueueId':_0x18eb7b['id'],'UserId':_0x1839db},'transaction':_0x39c258});});return Promise[_0x5b5d('0x98')](_0x589632);});});return Promise[_0x5b5d('0x98')](_0x510b78);});});return Promise['all'](_0x12e341)[_0x5b5d('0x2a')](function(){return _0x143975[_0x5b5d('0x9a')](_0x205ecf,{'transaction':_0x39c258});})['then'](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x35a033}})[_0x5b5d('0x2a')](function(_0x3bc825){if(_0x3bc825){var _0x46ce67=_['map'](_0x205ecf,function(_0x4f37ab){db[_0x5b5d('0x74')]['destroy']({'where':{'UserId':_0x4f37ab,'VoicePrefixId':_0x3bc825[_0x5b5d('0x75')]}});});return Promise[_0x5b5d('0x98')](_0x46ce67);}});});});}})[_0x5b5d('0x2a')](respondWithStatusCode(_0x2174a1,null))[_0x5b5d('0x49')](handleError(_0x2174a1,null));};exports[_0x5b5d('0x9e')]=function(_0x549f97,_0x2001f7,_0x2f9618){var _0x28b328={};var _0x44bfaa={};var _0x520d23;var _0x236609;return db[_0x5b5d('0x31')]['findOne']({'where':{'id':_0x549f97[_0x5b5d('0x4b')]['id']}})[_0x5b5d('0x2a')](handleEntityNotFound(_0x2001f7,null))['then'](function(_0x2b0129){if(_0x2b0129){_0x520d23=_0x2b0129;_0x44bfaa[_0x5b5d('0x36')]=_[_0x5b5d('0x38')](db[_0x5b5d('0x91')][_0x5b5d('0x32')]);_0x44bfaa['query']=_['keys'](_0x549f97[_0x5b5d('0x37')]);_0x44bfaa[_0x5b5d('0x40')]=_[_0x5b5d('0x39')](_0x44bfaa[_0x5b5d('0x36')],_0x44bfaa[_0x5b5d('0x37')]);_0x28b328[_0x5b5d('0x3b')]=_[_0x5b5d('0x39')](_0x44bfaa['model'],qs[_0x5b5d('0x3a')](_0x549f97['query']['fields']));_0x28b328[_0x5b5d('0x3b')]=_0x28b328[_0x5b5d('0x3b')][_0x5b5d('0x7e')]?_0x28b328['attributes']:_0x44bfaa['model'];_0x28b328[_0x5b5d('0x3d')]=qs[_0x5b5d('0x3e')](_0x549f97[_0x5b5d('0x37')][_0x5b5d('0x3e')]);_0x28b328[_0x5b5d('0x3f')]=qs[_0x5b5d('0x40')](_[_0x5b5d('0x41')](_0x549f97[_0x5b5d('0x37')],_0x44bfaa[_0x5b5d('0x40')]));if(_0x549f97[_0x5b5d('0x37')][_0x5b5d('0x42')]){_0x28b328[_0x5b5d('0x3f')]=_['merge'](_0x28b328['where'],{'$or':_[_0x5b5d('0x30')](_0x28b328['attributes'],function(_0x53af17){var _0x624d10={};_0x624d10[_0x53af17]={'$like':'%'+_0x549f97[_0x5b5d('0x37')][_0x5b5d('0x42')]+'%'};return _0x624d10;})});}_0x28b328=_['merge']({},_0x28b328,_0x549f97[_0x5b5d('0x44')]);return _0x520d23[_0x5b5d('0x9e')](_0x28b328);}})[_0x5b5d('0x2a')](function(_0x69890f){if(_0x69890f){_0x236609=_0x69890f['length'];if(!_0x549f97['query'][_0x5b5d('0x3c')](_0x5b5d('0x9f'))){_0x28b328[_0x5b5d('0x21')]=qs[_0x5b5d('0x21')](_0x549f97[_0x5b5d('0x37')][_0x5b5d('0x21')]);_0x28b328[_0x5b5d('0x23')]=qs['offset'](_0x549f97[_0x5b5d('0x37')][_0x5b5d('0x23')]);}return _0x520d23[_0x5b5d('0x9e')](_0x28b328);}})[_0x5b5d('0x2a')](function(_0x5c48de){if(_0x5c48de){return _0x5c48de?{'count':_0x236609,'rows':_0x5c48de}:null;}})[_0x5b5d('0x2a')](respondWithResult(_0x2001f7,null))[_0x5b5d('0x49')](handleError(_0x2001f7,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index d62daac..a23673c 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 _0xca72=['hasOwnProperty','exports','events','../../mysqldb','Team','setMaxListeners','save','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca72,0x14f));var _0x2ca7=function(_0x13342f,_0x3d6303){_0x13342f=_0x13342f-0x0;var _0x2fc1fc=_0xca72[_0x13342f];return _0x2fc1fc;};'use strict';var EventEmitter=require(_0x2ca7('0x0'));var Team=require(_0x2ca7('0x1'))['db'][_0x2ca7('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x2ca7('0x3')](0x0);var events={'afterCreate':_0x2ca7('0x4'),'afterUpdate':_0x2ca7('0x5'),'afterDestroy':'remove'};function emitEvent(_0x176898){return function(_0x9d1acf,_0x3657d4,_0x5d52e0){TeamEvents[_0x2ca7('0x6')](_0x176898+':'+_0x9d1acf['id'],_0x9d1acf);TeamEvents[_0x2ca7('0x6')](_0x176898,_0x9d1acf);_0x5d52e0(null);};}for(var e in events){if(events[_0x2ca7('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x2ca7('0x8')]=TeamEvents; \ No newline at end of file +var _0x8792=['setMaxListeners','remove','emit','hasOwnProperty','events'];(function(_0xd1a252,_0x16396f){var _0x560ee1=function(_0x35dd90){while(--_0x35dd90){_0xd1a252['push'](_0xd1a252['shift']());}};_0x560ee1(++_0x16396f);}(_0x8792,0x86));var _0x2879=function(_0x39de9a,_0x5aec1c){_0x39de9a=_0x39de9a-0x0;var _0x403b93=_0x8792[_0x39de9a];return _0x403b93;};'use strict';var EventEmitter=require(_0x2879('0x0'));var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x2879('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2879('0x2')};function emitEvent(_0x122962){return function(_0xf54113,_0x117cf3,_0x53b928){TeamEvents['emit'](_0x122962+':'+_0xf54113['id'],_0xf54113);TeamEvents[_0x2879('0x3')](_0x122962,_0xf54113);_0x53b928(null);};}for(var e in events){if(events[_0x2879('0x4')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 52fbb82..6a36de8 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 _0xafd1=['Queues','then','setDataValue','channel','catch','exports','define','Team','Chat','Fax','Mail','Openchannel','Sms','Voice','resolve','map','lodash','./team.attributes','get'];(function(_0xcd105c,_0x180210){var _0x35154c=function(_0x44f151){while(--_0x44f151){_0xcd105c['push'](_0xcd105c['shift']());}};_0x35154c(++_0x180210);}(_0xafd1,0x140));var _0x1afd=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xafd1[_0xf71120];return _0xbe2fd3;};'use strict';var _=require(_0x1afd('0x0'));var attributes=require(_0x1afd('0x1'));function getQueuesByChannel(_0x42839e,_0x467c8f){var _0x29f6f4=_0x1afd('0x2')+_0x467c8f+_0x1afd('0x3');return _0x42839e[_0x29f6f4]()[_0x1afd('0x4')](function(_0x3b98aa){return _['map'](_0x3b98aa,function(_0x4e6704){_0x4e6704[_0x1afd('0x5')](_0x1afd('0x6'),_0x467c8f);return _0x4e6704;});})[_0x1afd('0x7')](function(_0x290476){throw _0x290476;});}module[_0x1afd('0x8')]=function(_0x11adff){return _0x11adff[_0x1afd('0x9')](_0x1afd('0xa'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x2038b0=this;var _0x3c75db=[_0x1afd('0xb'),_0x1afd('0xc'),_0x1afd('0xd'),_0x1afd('0xe'),_0x1afd('0xf'),_0x1afd('0x10'),'Whatsapp'];return Promise[_0x1afd('0x11')]()[_0x1afd('0x4')](function(){var _0x5aa294=_[_0x1afd('0x12')](_0x3c75db,function(_0x4b6fdf){return getQueuesByChannel(_0x2038b0,_0x4b6fdf);});return Promise['all'](_0x5aa294);})[_0x1afd('0x7')](function(_0x5b2dcd){throw _0x5b2dcd;});}}});}; \ No newline at end of file +var _0xc165=['Sms','resolve','all','lodash','then','map','channel','catch','exports','define','Team','Chat','Mail','Openchannel'];(function(_0x4c7908,_0x57ff9c){var _0x5781b6=function(_0x5cd56d){while(--_0x5cd56d){_0x4c7908['push'](_0x4c7908['shift']());}};_0x5781b6(++_0x57ff9c);}(_0xc165,0x1a7));var _0x5c16=function(_0x32ca62,_0x18fe6a){_0x32ca62=_0x32ca62-0x0;var _0x175d88=_0xc165[_0x32ca62];return _0x175d88;};'use strict';var _=require(_0x5c16('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x50b645,_0x16d1ca){var _0x2535eb='get'+_0x16d1ca+'Queues';return _0x50b645[_0x2535eb]()[_0x5c16('0x1')](function(_0x144660){return _[_0x5c16('0x2')](_0x144660,function(_0x292b34){_0x292b34['setDataValue'](_0x5c16('0x3'),_0x16d1ca);return _0x292b34;});})[_0x5c16('0x4')](function(_0xcc93e4){throw _0xcc93e4;});}module[_0x5c16('0x5')]=function(_0x5d910d){return _0x5d910d[_0x5c16('0x6')](_0x5c16('0x7'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x5513f5=this;var _0x26cc13=[_0x5c16('0x8'),'Fax',_0x5c16('0x9'),_0x5c16('0xa'),_0x5c16('0xb'),'Voice','Whatsapp'];return Promise[_0x5c16('0xc')]()[_0x5c16('0x1')](function(){var _0x2f171e=_[_0x5c16('0x2')](_0x26cc13,function(_0x400800){return getQueuesByChannel(_0x5513f5,_0x400800);});return Promise[_0x5c16('0xd')](_0x2f171e);})[_0x5c16('0x4')](function(_0x3cdc61){throw _0x3cdc61;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 10ad83a..5b471e4 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 _0xcb9f=['code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x405f56,_0x53f8cb){var _0x49eb89=function(_0x1d2d5e){while(--_0x1d2d5e){_0x405f56['push'](_0x405f56['shift']());}};_0x49eb89(++_0x53f8cb);}(_0xcb9f,0x1d4));var _0xfcb9=function(_0x5a95d5,_0x196667){_0x5a95d5=_0x5a95d5-0x0;var _0x83489e=_0xcb9f[_0x5a95d5];return _0x83489e;};'use strict';var _=require(_0xfcb9('0x0'));var util=require(_0xfcb9('0x1'));var moment=require(_0xfcb9('0x2'));var BPromise=require(_0xfcb9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfcb9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfcb9('0x5'))(_0xfcb9('0x6'));var config=require(_0xfcb9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfcb9('0x8')][_0xfcb9('0x9')]({'port':0x232a});config[_0xfcb9('0xa')]=_[_0xfcb9('0xb')](config[_0xfcb9('0xa')],{'host':_0xfcb9('0xc'),'port':0x18eb});var socket=require(_0xfcb9('0xd'))(new Redis(config[_0xfcb9('0xa')]));require(_0xfcb9('0xe'))[_0xfcb9('0xf')](socket);function respondWithRpcPromise(_0x2fcfea,_0x25158a,_0x3f8175){return new BPromise(function(_0x267b25,_0x15bf49){return client[_0xfcb9('0x10')](_0x2fcfea,_0x3f8175)[_0xfcb9('0x11')](function(_0x39d51d){logger[_0xfcb9('0x12')](_0xfcb9('0x13'),_0x25158a,_0xfcb9('0x14'));logger[_0xfcb9('0x15')](_0xfcb9('0x16'),_0x25158a,_0xfcb9('0x14'),JSON[_0xfcb9('0x17')](_0x39d51d));if(_0x39d51d[_0xfcb9('0x18')]){if(_0x39d51d['error'][_0xfcb9('0x19')]===0x1f4){logger[_0xfcb9('0x18')](_0xfcb9('0x13'),_0x25158a,_0x39d51d['error'][_0xfcb9('0x1a')]);return _0x15bf49(_0x39d51d[_0xfcb9('0x18')][_0xfcb9('0x1a')]);}logger[_0xfcb9('0x18')](_0xfcb9('0x13'),_0x25158a,_0x39d51d['error'][_0xfcb9('0x1a')]);return _0x267b25(_0x39d51d[_0xfcb9('0x18')]['message']);}else{logger[_0xfcb9('0x12')]('Team,\x20%s,\x20%s',_0x25158a,'request\x20sent');_0x267b25(_0x39d51d[_0xfcb9('0x1b')][_0xfcb9('0x1a')]);}})[_0xfcb9('0x1c')](function(_0x41ae78){logger[_0xfcb9('0x18')](_0xfcb9('0x13'),_0x25158a,_0x41ae78);_0x15bf49(_0x41ae78);});});} \ No newline at end of file +var _0xd73c=['Team,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./team.socket','register','request','info','Team,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0xd73c,0x148));var _0xcd73=function(_0x1e894e,_0x1f8472){_0x1e894e=_0x1e894e-0x0;var _0x4207c1=_0xd73c[_0x1e894e];return _0x4207c1;};'use strict';var _=require(_0xcd73('0x0'));var util=require(_0xcd73('0x1'));var moment=require(_0xcd73('0x2'));var BPromise=require(_0xcd73('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcd73('0x4'));var db=require(_0xcd73('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd73('0x6'))(_0xcd73('0x7'));var config=require(_0xcd73('0x8'));var jayson=require(_0xcd73('0x9'));var client=jayson[_0xcd73('0xa')][_0xcd73('0xb')]({'port':0x232a});config['redis']=_[_0xcd73('0xc')](config['redis'],{'host':_0xcd73('0xd'),'port':0x18eb});var socket=require(_0xcd73('0xe'))(new Redis(config[_0xcd73('0xf')]));require(_0xcd73('0x10'))[_0xcd73('0x11')](socket);function respondWithRpcPromise(_0x14ae3f,_0x17ba24,_0x41ee4e){return new BPromise(function(_0x4e83a0,_0x2e8ced){return client[_0xcd73('0x12')](_0x14ae3f,_0x41ee4e)['then'](function(_0x5826c2){logger[_0xcd73('0x13')](_0xcd73('0x14'),_0x17ba24,_0xcd73('0x15'));logger[_0xcd73('0x16')](_0xcd73('0x17'),_0x17ba24,_0xcd73('0x15'),JSON['stringify'](_0x5826c2));if(_0x5826c2[_0xcd73('0x18')]){if(_0x5826c2[_0xcd73('0x18')]['code']===0x1f4){logger[_0xcd73('0x18')](_0xcd73('0x14'),_0x17ba24,_0x5826c2[_0xcd73('0x18')][_0xcd73('0x19')]);return _0x2e8ced(_0x5826c2['error'][_0xcd73('0x19')]);}logger[_0xcd73('0x18')](_0xcd73('0x14'),_0x17ba24,_0x5826c2[_0xcd73('0x18')][_0xcd73('0x19')]);return _0x4e83a0(_0x5826c2[_0xcd73('0x18')]['message']);}else{logger['info'](_0xcd73('0x14'),_0x17ba24,_0xcd73('0x15'));_0x4e83a0(_0x5826c2[_0xcd73('0x1a')][_0xcd73('0x19')]);}})['catch'](function(_0x28df1a){logger[_0xcd73('0x18')](_0xcd73('0x14'),_0x17ba24,_0x28df1a);_0x2e8ced(_0x28df1a);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 7dfaf9c..080aa84 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 _0xcd89=['update','emit','removeListener','register','team:','save','remove'];(function(_0x108d5f,_0x33f82d){var _0x456ea3=function(_0x228200){while(--_0x228200){_0x108d5f['push'](_0x108d5f['shift']());}};_0x456ea3(++_0x33f82d);}(_0xcd89,0x67));var _0x9cd8=function(_0x48cdc1,_0x3a8edd){_0x48cdc1=_0x48cdc1-0x0;var _0x3e4eca=_0xcd89[_0x48cdc1];return _0x3e4eca;};'use strict';var TeamEvents=require('./team.events');var events=[_0x9cd8('0x0'),_0x9cd8('0x1'),_0x9cd8('0x2')];function createListener(_0x5979c0,_0x2b510c){return function(_0x3de308){_0x2b510c[_0x9cd8('0x3')](_0x5979c0,_0x3de308);};}function removeListener(_0x4dac43,_0x2b0512){return function(){TeamEvents[_0x9cd8('0x4')](_0x4dac43,_0x2b0512);};}exports[_0x9cd8('0x5')]=function(_0x599052){for(var _0xbb4637=0x0,_0x1198a5=events['length'];_0xbb4637<_0x1198a5;_0xbb4637++){var _0x40c3b1=events[_0xbb4637];var _0x33d8c1=createListener(_0x9cd8('0x6')+_0x40c3b1,_0x599052);TeamEvents['on'](_0x40c3b1,_0x33d8c1);}}; \ No newline at end of file +var _0x652b=['team:','./team.events','remove','update','length'];(function(_0x5eda6d,_0x170be0){var _0x113332=function(_0x10a0a6){while(--_0x10a0a6){_0x5eda6d['push'](_0x5eda6d['shift']());}};_0x113332(++_0x170be0);}(_0x652b,0xd8));var _0xb652=function(_0x146484,_0x27a7f0){_0x146484=_0x146484-0x0;var _0x4c7aa3=_0x652b[_0x146484];return _0x4c7aa3;};'use strict';var TeamEvents=require(_0xb652('0x0'));var events=['save',_0xb652('0x1'),_0xb652('0x2')];function createListener(_0x4775d3,_0x1eae1c){return function(_0x351dbe){_0x1eae1c['emit'](_0x4775d3,_0x351dbe);};}function removeListener(_0x432d9b,_0x5468f7){return function(){TeamEvents['removeListener'](_0x432d9b,_0x5468f7);};}exports['register']=function(_0x4438a9){for(var _0x35c493=0x0,_0x47da9d=events[_0xb652('0x3')];_0x35c493<_0x47da9d;_0x35c493++){var _0x162e97=events[_0x35c493];var _0xc036c=createListener(_0xb652('0x4')+_0x162e97,_0x4438a9);TeamEvents['on'](_0x162e97,_0xc036c);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 9ccb276..d1f1f47 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 _0x34e5=['exports','INTEGER'];(function(_0x7a4b16,_0x2c3b70){var _0x59e441=function(_0xfc8375){while(--_0xfc8375){_0x7a4b16['push'](_0x7a4b16['shift']());}};_0x59e441(++_0x2c3b70);}(_0x34e5,0x172));var _0x534e=function(_0x6bc46f,_0x339730){_0x6bc46f=_0x6bc46f-0x0;var _0x35e76c=_0x34e5[_0x6bc46f];return _0x35e76c;};'use strict';var Sequelize=require('sequelize');module[_0x534e('0x0')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x534e('0x1')]}}; \ No newline at end of file +var _0x3238=['sequelize','INTEGER'];(function(_0x49e584,_0x2886f8){var _0x58b1be=function(_0x40397c){while(--_0x40397c){_0x49e584['push'](_0x49e584['shift']());}};_0x58b1be(++_0x2886f8);}(_0x3238,0x13e));var _0x8323=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3238[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8323('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x8323('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x8323('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 62457cb..4ab949d 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 _0x9bc3=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x491277,_0x295688){var _0x3bdf82=function(_0xf83ba7){while(--_0xf83ba7){_0x491277['push'](_0x491277['shift']());}};_0x3bdf82(++_0x295688);}(_0x9bc3,0x137));var _0x39bc=function(_0x41e393,_0x35417e){_0x41e393=_0x41e393-0x0;var _0x27db09=_0x9bc3[_0x41e393];return _0x27db09;};'use strict';var _=require(_0x39bc('0x0'));var util=require(_0x39bc('0x1'));var logger=require(_0x39bc('0x2'))('api');var moment=require(_0x39bc('0x3'));var BPromise=require(_0x39bc('0x4'));var rp=require(_0x39bc('0x5'));var fs=require('fs');var path=require(_0x39bc('0x6'));var rimraf=require('rimraf');var config=require(_0x39bc('0x7'));var attributes=require(_0x39bc('0x8'));module[_0x39bc('0x9')]=function(_0x442ec9,_0x5805da){return _0x442ec9[_0x39bc('0xa')](_0x39bc('0xb'),attributes,{'tableName':_0x39bc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c2c=['bluebird','path','rimraf','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc9c2('0x0'));var util=require(_0xc9c2('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc9c2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc9c2('0x3'));var rimraf=require(_0xc9c2('0x4'));var config=require('../../config/environment');var attributes=require('./teamVoicePrefix.attributes');module[_0xc9c2('0x5')]=function(_0x5140a8,_0x30f3d6){return _0x5140a8[_0xc9c2('0x6')](_0xc9c2('0x7'),attributes,{'tableName':_0xc9c2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index d92ed2f..839106e 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x478927,_0x137268){var _0x37223f=function(_0x16faf8){while(--_0x16faf8){_0x478927['push'](_0x478927['shift']());}};_0x37223f(++_0x137268);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x592290,_0x4ef008){var _0x726e7e=function(_0x5b49db){while(--_0x5b49db){_0x592290['push'](_0x592290['shift']());}};_0x726e7e(++_0x4ef008);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4be8ba,_0x5d10ba){_0x4be8ba=_0x4be8ba-0x0;var _0x1af822=_0xcb91[_0x4be8ba];return _0x1af822;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 1252600..f707f34 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 _0x1a6b=['INTEGER','sequelize','exports'];(function(_0x1ce02d,_0x317495){var _0x14f24e=function(_0x116713){while(--_0x116713){_0x1ce02d['push'](_0x1ce02d['shift']());}};_0x14f24e(++_0x317495);}(_0x1a6b,0x94));var _0xb1a6=function(_0x5526ea,_0x1909cd){_0x5526ea=_0x5526ea-0x0;var _0x570fb9=_0x1a6b[_0x5526ea];return _0x570fb9;};'use strict';var Sequelize=require(_0xb1a6('0x0'));module[_0xb1a6('0x1')]={'penalty':{'type':Sequelize[_0xb1a6('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x728d=['sequelize','exports','INTEGER'];(function(_0xdbc13,_0x1925de){var _0x45ff7b=function(_0x334c2f){while(--_0x334c2f){_0xdbc13['push'](_0xdbc13['shift']());}};_0x45ff7b(++_0x1925de);}(_0x728d,0x1c2));var _0xd728=function(_0xdeefbd,_0x9e1b3d){_0xdeefbd=_0xdeefbd-0x0;var _0x4ff63f=_0x728d[_0xdeefbd];return _0x4ff63f;};'use strict';var Sequelize=require(_0xd728('0x0'));module[_0xd728('0x1')]={'penalty':{'type':Sequelize[_0xd728('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 8aacf04..32dbced 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 _0xd04b=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xd04b,0x145));var _0xbd04=function(_0x52e8ea,_0x23a97a){_0x52e8ea=_0x52e8ea-0x0;var _0x40ddc5=_0xd04b[_0x52e8ea];return _0x40ddc5;};'use strict';var _=require(_0xbd04('0x0'));var util=require(_0xbd04('0x1'));var logger=require(_0xbd04('0x2'))('api');var moment=require(_0xbd04('0x3'));var BPromise=require('bluebird');var rp=require(_0xbd04('0x4'));var fs=require('fs');var path=require(_0xbd04('0x5'));var rimraf=require(_0xbd04('0x6'));var config=require(_0xbd04('0x7'));var attributes=require(_0xbd04('0x8'));module[_0xbd04('0x9')]=function(_0x11d6ce,_0x2d8811){return _0x11d6ce[_0xbd04('0xa')](_0xbd04('0xb'),attributes,{'tableName':_0xbd04('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd246=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util'];(function(_0xcc53a,_0x1f6a0b){var _0x412e81=function(_0x47f8a2){while(--_0x47f8a2){_0xcc53a['push'](_0xcc53a['shift']());}};_0x412e81(++_0x1f6a0b);}(_0xd246,0xf5));var _0x6d24=function(_0x41ba41,_0x145412){_0x41ba41=_0x41ba41-0x0;var _0x22d385=_0xd246[_0x41ba41];return _0x22d385;};'use strict';var _=require(_0x6d24('0x0'));var util=require(_0x6d24('0x1'));var logger=require(_0x6d24('0x2'))(_0x6d24('0x3'));var moment=require(_0x6d24('0x4'));var BPromise=require(_0x6d24('0x5'));var rp=require(_0x6d24('0x6'));var fs=require('fs');var path=require(_0x6d24('0x7'));var rimraf=require('rimraf');var config=require(_0x6d24('0x8'));var attributes=require('./teamVoiceQueue.attributes');module[_0x6d24('0x9')]=function(_0x536c95,_0xa72e6e){return _0x536c95[_0x6d24('0xa')](_0x6d24('0xb'),attributes,{'tableName':_0x6d24('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 9653e19..abb649e 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 _0xe600=['rpc','../../config/environment','jayson/promise','client','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1cbdf9,_0x238562){var _0x8870be=function(_0x46e92e){while(--_0x46e92e){_0x1cbdf9['push'](_0x1cbdf9['shift']());}};_0x8870be(++_0x238562);}(_0xe600,0x159));var _0x0e60=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe600[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x0e60('0x0'));var moment=require('moment');var BPromise=require(_0x0e60('0x1'));var rs=require(_0x0e60('0x2'));var fs=require('fs');var Redis=require(_0x0e60('0x3'));var db=require(_0x0e60('0x4'))['db'];var utils=require(_0x0e60('0x5'));var logger=require(_0x0e60('0x6'))(_0x0e60('0x7'));var config=require(_0x0e60('0x8'));var jayson=require(_0x0e60('0x9'));var client=jayson[_0x0e60('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d7563,_0x497a61,_0x6727dd){return new BPromise(function(_0x30eaed,_0x5ba123){return client[_0x0e60('0xb')](_0x1d7563,_0x6727dd)[_0x0e60('0xc')](function(_0x238537){logger[_0x0e60('0xd')](_0x0e60('0xe'),_0x497a61,_0x0e60('0xf'));logger['debug'](_0x0e60('0x10'),_0x497a61,_0x0e60('0xf'),JSON[_0x0e60('0x11')](_0x238537));if(_0x238537[_0x0e60('0x12')]){if(_0x238537[_0x0e60('0x12')][_0x0e60('0x13')]===0x1f4){logger[_0x0e60('0x12')](_0x0e60('0xe'),_0x497a61,_0x238537['error'][_0x0e60('0x14')]);return _0x5ba123(_0x238537[_0x0e60('0x12')][_0x0e60('0x14')]);}logger[_0x0e60('0x12')](_0x0e60('0xe'),_0x497a61,_0x238537[_0x0e60('0x12')]['message']);return _0x30eaed(_0x238537[_0x0e60('0x12')]['message']);}else{logger[_0x0e60('0xd')](_0x0e60('0xe'),_0x497a61,_0x0e60('0xf'));_0x30eaed(_0x238537['result'][_0x0e60('0x14')]);}})[_0x0e60('0x15')](function(_0xdb7760){logger[_0x0e60('0x12')](_0x0e60('0xe'),_0x497a61,_0xdb7760);_0x5ba123(_0xdb7760);});});} \ No newline at end of file +var _0x79de=['TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x79de,0x1a8));var _0xe79d=function(_0x2ed1a0,_0xa24cd3){_0x2ed1a0=_0x2ed1a0-0x0;var _0x3b4bad=_0x79de[_0x2ed1a0];return _0x3b4bad;};'use strict';var _=require(_0xe79d('0x0'));var util=require('util');var moment=require(_0xe79d('0x1'));var BPromise=require(_0xe79d('0x2'));var rs=require(_0xe79d('0x3'));var fs=require('fs');var Redis=require(_0xe79d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe79d('0x5'))(_0xe79d('0x6'));var config=require(_0xe79d('0x7'));var jayson=require(_0xe79d('0x8'));var client=jayson[_0xe79d('0x9')][_0xe79d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa3af86,_0x2171bd,_0x3e780f){return new BPromise(function(_0x18cf11,_0x8f2446){return client['request'](_0xa3af86,_0x3e780f)[_0xe79d('0xb')](function(_0x2eb47b){logger[_0xe79d('0xc')](_0xe79d('0xd'),_0x2171bd,_0xe79d('0xe'));logger[_0xe79d('0xf')](_0xe79d('0x10'),_0x2171bd,_0xe79d('0xe'),JSON[_0xe79d('0x11')](_0x2eb47b));if(_0x2eb47b['error']){if(_0x2eb47b[_0xe79d('0x12')][_0xe79d('0x13')]===0x1f4){logger[_0xe79d('0x12')](_0xe79d('0xd'),_0x2171bd,_0x2eb47b[_0xe79d('0x12')]['message']);return _0x8f2446(_0x2eb47b[_0xe79d('0x12')]['message']);}logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x2171bd,_0x2eb47b[_0xe79d('0x12')][_0xe79d('0x14')]);return _0x18cf11(_0x2eb47b[_0xe79d('0x12')][_0xe79d('0x14')]);}else{logger[_0xe79d('0xc')](_0xe79d('0xd'),_0x2171bd,_0xe79d('0xe'));_0x18cf11(_0x2eb47b[_0xe79d('0x15')]['message']);}})[_0xe79d('0x16')](function(_0x369cac){logger[_0xe79d('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2171bd,_0x369cac);_0x8f2446(_0x369cac);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index b0abc71..58ca943 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 _0x751c=['put','update','destroy','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','/:id','show','post','create'];(function(_0x2aa4c8,_0x1f65b4){var _0x29edb8=function(_0x77caef){while(--_0x77caef){_0x2aa4c8['push'](_0x2aa4c8['shift']());}};_0x29edb8(++_0x1f65b4);}(_0x751c,0x69));var _0xc751=function(_0x251538,_0x505bd9){_0x251538=_0x251538-0x0;var _0x2cd58b=_0x751c[_0x251538];return _0x2cd58b;};'use strict';var multer=require(_0xc751('0x0'));var util=require(_0xc751('0x1'));var path=require(_0xc751('0x2'));var timeout=require('connect-timeout');var express=require(_0xc751('0x3'));var router=express['Router']();var fs_extra=require(_0xc751('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc751('0x5'));var config=require(_0xc751('0x6'));var controller=require(_0xc751('0x7'));router[_0xc751('0x8')]('/',auth[_0xc751('0x9')](),controller['index']);router[_0xc751('0x8')](_0xc751('0xa'),auth['isAuthenticated'](),controller[_0xc751('0xb')]);router[_0xc751('0xc')]('/',auth['isAuthenticated'](),controller[_0xc751('0xd')]);router[_0xc751('0xe')](_0xc751('0xa'),auth[_0xc751('0x9')](),controller[_0xc751('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc751('0x10')]);module['exports']=router; \ No newline at end of file +var _0x5ed9=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','isAuthenticated','get','/:id','show','post','put'];(function(_0x3035d7,_0x38d7fe){var _0x20b50d=function(_0x5f5c58){while(--_0x5f5c58){_0x3035d7['push'](_0x3035d7['shift']());}};_0x20b50d(++_0x38d7fe);}(_0x5ed9,0x1e9));var _0x95ed=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5ed9[_0x278e3c];return _0x3e2d9b;};'use strict';var multer=require(_0x95ed('0x0'));var util=require(_0x95ed('0x1'));var path=require('path');var timeout=require(_0x95ed('0x2'));var express=require(_0x95ed('0x3'));var router=express[_0x95ed('0x4')]();var fs_extra=require(_0x95ed('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x95ed('0x6'));var config=require(_0x95ed('0x7'));var controller=require(_0x95ed('0x8'));router['get']('/',auth[_0x95ed('0x9')](),controller['index']);router[_0x95ed('0xa')](_0x95ed('0xb'),auth[_0x95ed('0x9')](),controller[_0x95ed('0xc')]);router[_0x95ed('0xd')]('/',auth[_0x95ed('0x9')](),controller['create']);router[_0x95ed('0xe')](_0x95ed('0xb'),auth[_0x95ed('0x9')](),controller['update']);router[_0x95ed('0xf')]('/:id',auth[_0x95ed('0x9')](),controller[_0x95ed('0x10')]);module[_0x95ed('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index e9b70e5..fc69f7a 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 _0xf910=['TEXT','sequelize','exports','STRING'];(function(_0x4edfec,_0x581a4a){var _0x22c10b=function(_0x6c3054){while(--_0x6c3054){_0x4edfec['push'](_0x4edfec['shift']());}};_0x22c10b(++_0x581a4a);}(_0xf910,0xd9));var _0x0f91=function(_0x571097,_0x5b56ac){_0x571097=_0x571097-0x0;var _0x30fc4d=_0xf910[_0x571097];return _0x30fc4d;};'use strict';var Sequelize=require(_0x0f91('0x0'));module[_0x0f91('0x1')]={'name':{'type':Sequelize[_0x0f91('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x0f91('0x3')]}}; \ No newline at end of file +var _0x844e=['TEXT','sequelize','exports','STRING'];(function(_0x4c2b04,_0x2e6a15){var _0x4630a5=function(_0x4c0e9f){while(--_0x4c0e9f){_0x4c2b04['push'](_0x4c2b04['shift']());}};_0x4630a5(++_0x2e6a15);}(_0x844e,0x65));var _0xe844=function(_0x4b47b0,_0x1122f3){_0x4b47b0=_0x4b47b0-0x0;var _0x200dad=_0x844e[_0x4b47b0];return _0x200dad;};'use strict';var Sequelize=require(_0xe844('0x0'));module[_0xe844('0x1')]={'name':{'type':Sequelize[_0xe844('0x2')]},'description':{'type':Sequelize[_0xe844('0x2')]},'html':{'type':Sequelize[_0xe844('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 5f78c26..b6d9988 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 _0x9bbc=['type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','filter','where','merge','findAll','rows','catch','show','params','includeAll','options','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','error','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','then','Templates','UserProfileResource','destroy','stack','name','send','index','map','Template','rawAttributes','fieldName'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x9bbc,0xcd));var _0xc9bb=function(_0x254b10,_0x534a17){_0x254b10=_0x254b10-0x0;var _0x1ce7d6=_0x9bbc[_0x254b10];return _0x1ce7d6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc9bb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc9bb('0x1'));var rp=require(_0xc9bb('0x2'));var moment=require(_0xc9bb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc9bb('0x4'));var util=require(_0xc9bb('0x5'));var path=require('path');var sox=require(_0xc9bb('0x6'));var csv=require(_0xc9bb('0x7'));var ejs=require(_0xc9bb('0x8'));var fs=require('fs');var fs_extra=require(_0xc9bb('0x9'));var _=require(_0xc9bb('0xa'));var squel=require(_0xc9bb('0xb'));var crypto=require(_0xc9bb('0xc'));var jsforce=require(_0xc9bb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc9bb('0x7'));var querystring=require(_0xc9bb('0xe'));var Papa=require(_0xc9bb('0xf'));var Redis=require(_0xc9bb('0x10'));var authService=require(_0xc9bb('0x11'));var qs=require(_0xc9bb('0x12'));var as=require(_0xc9bb('0x13'));var hardwareService=require(_0xc9bb('0x14'));var logger=require('../../config/logger')(_0xc9bb('0x15'));var utils=require(_0xc9bb('0x16'));var config=require(_0xc9bb('0x17'));var licenseUtil=require(_0xc9bb('0x18'));var db=require(_0xc9bb('0x19'))['db'];function respondWithStatusCode(_0x110288,_0x486145){_0x486145=_0x486145||0xcc;return function(_0x5e8e53){if(_0x5e8e53){return _0x110288[_0xc9bb('0x1a')](_0x486145);}return _0x110288[_0xc9bb('0x1b')](_0x486145)[_0xc9bb('0x1c')]();};}function respondWithResult(_0x3513e1,_0x16a8c9){_0x16a8c9=_0x16a8c9||0xc8;return function(_0x37ea1d){if(_0x37ea1d){return _0x3513e1[_0xc9bb('0x1b')](_0x16a8c9)[_0xc9bb('0x1d')](_0x37ea1d);}};}function respondWithFilteredResult(_0x1d1827,_0x439355){return function(_0x4fef9b){if(_0x4fef9b){var _0x29bb23=typeof _0x439355[_0xc9bb('0x1e')]==='undefined'&&typeof _0x439355['limit']===_0xc9bb('0x1f');var _0x410a21=_0x4fef9b[_0xc9bb('0x20')];var _0x3e73c3=_0x29bb23?0x0:_0x439355['offset'];var _0x23b76f=_0x29bb23?_0x4fef9b[_0xc9bb('0x20')]:_0x439355[_0xc9bb('0x1e')]+_0x439355['limit'];var _0xfa6912;if(_0x23b76f>=_0x410a21){_0x23b76f=_0x410a21;_0xfa6912=0xc8;}else{_0xfa6912=0xce;}_0x1d1827['status'](_0xfa6912);return _0x1d1827[_0xc9bb('0x21')](_0xc9bb('0x22'),_0x3e73c3+'-'+_0x23b76f+'/'+_0x410a21)[_0xc9bb('0x1d')](_0x4fef9b);}return null;};}function patchUpdates(_0x4e092b){return function(_0x553ed5){try{jsonpatch['apply'](_0x553ed5,_0x4e092b,!![]);}catch(_0x4bde24){return BPromise[_0xc9bb('0x23')](_0x4bde24);}return _0x553ed5[_0xc9bb('0x24')]();};}function saveUpdates(_0x3ddae3,_0x518f50){return function(_0x53a3f3){if(_0x53a3f3){return _0x53a3f3[_0xc9bb('0x25')](_0x3ddae3)[_0xc9bb('0x26')](function(_0x5542fa){return _0x5542fa;});}return null;};}function removeEntity(_0x128e6b,_0x5d836c){return function(_0xb40bd8){if(_0xb40bd8){return _0xb40bd8['destroy']()['then'](function(){var _0x3c9436=_0xb40bd8['get']({'plain':!![]});var _0x1ec684=_0xc9bb('0x27');return db[_0xc9bb('0x28')][_0xc9bb('0x29')]({'where':{'type':_0x1ec684,'resourceId':_0x3c9436['id']}})[_0xc9bb('0x26')](function(){return _0xb40bd8;});})['then'](function(){_0x128e6b[_0xc9bb('0x1b')](0xcc)[_0xc9bb('0x1c')]();});}};}function handleEntityNotFound(_0x183b96,_0x18e86d){return function(_0x52b2a3){if(!_0x52b2a3){_0x183b96[_0xc9bb('0x1a')](0x194);}return _0x52b2a3;};}function handleError(_0x1870d2,_0x40c95e){_0x40c95e=_0x40c95e||0x1f4;return function(_0x4ff916){logger['error'](_0x4ff916[_0xc9bb('0x2a')]);if(_0x4ff916['name']){delete _0x4ff916[_0xc9bb('0x2b')];}_0x1870d2[_0xc9bb('0x1b')](_0x40c95e)[_0xc9bb('0x2c')](_0x4ff916);};}exports[_0xc9bb('0x2d')]=function(_0x5ab119,_0x5c255e){var _0x3b7526={},_0x64935d={},_0x35411a={'count':0x0,'rows':[]};var _0x4413fd=_[_0xc9bb('0x2e')](db[_0xc9bb('0x2f')][_0xc9bb('0x30')],function(_0x12e744){return{'name':_0x12e744[_0xc9bb('0x31')],'type':_0x12e744[_0xc9bb('0x32')][_0xc9bb('0x33')]};});_0x64935d[_0xc9bb('0x34')]=_[_0xc9bb('0x2e')](_0x4413fd,_0xc9bb('0x2b'));_0x64935d[_0xc9bb('0x35')]=_[_0xc9bb('0x36')](_0x5ab119[_0xc9bb('0x35')]);_0x64935d['filters']=_[_0xc9bb('0x37')](_0x64935d[_0xc9bb('0x34')],_0x64935d['query']);_0x3b7526[_0xc9bb('0x38')]=_[_0xc9bb('0x37')](_0x64935d['model'],qs[_0xc9bb('0x39')](_0x5ab119['query'][_0xc9bb('0x39')]));_0x3b7526['attributes']=_0x3b7526[_0xc9bb('0x38')][_0xc9bb('0x3a')]?_0x3b7526[_0xc9bb('0x38')]:_0x64935d[_0xc9bb('0x34')];if(!_0x5ab119[_0xc9bb('0x35')][_0xc9bb('0x3b')](_0xc9bb('0x3c'))){_0x3b7526[_0xc9bb('0x3d')]=qs[_0xc9bb('0x3d')](_0x5ab119[_0xc9bb('0x35')][_0xc9bb('0x3d')]);_0x3b7526[_0xc9bb('0x1e')]=qs[_0xc9bb('0x1e')](_0x5ab119[_0xc9bb('0x35')][_0xc9bb('0x1e')]);}_0x3b7526[_0xc9bb('0x3e')]=qs[_0xc9bb('0x3f')](_0x5ab119[_0xc9bb('0x35')]['sort']);_0x3b7526['where']=qs[_0xc9bb('0x40')](_['pick'](_0x5ab119['query'],_0x64935d[_0xc9bb('0x40')]),_0x4413fd);if(_0x5ab119['query'][_0xc9bb('0x41')]){_0x3b7526[_0xc9bb('0x42')]=_[_0xc9bb('0x43')](_0x3b7526['where'],{'$or':_[_0xc9bb('0x2e')](_0x4413fd,function(_0x2735f8){if(_0x2735f8['type']!=='VIRTUAL'){var _0x49cb67={};_0x49cb67[_0x2735f8['name']]={'$like':'%'+_0x5ab119[_0xc9bb('0x35')][_0xc9bb('0x41')]+'%'};return _0x49cb67;}})});}_0x3b7526=_['merge']({},_0x3b7526,_0x5ab119['options']);var _0x3e2b76={'where':_0x3b7526[_0xc9bb('0x42')]};return db[_0xc9bb('0x2f')]['count'](_0x3e2b76)[_0xc9bb('0x26')](function(_0x46dc72){_0x35411a[_0xc9bb('0x20')]=_0x46dc72;if(_0x5ab119[_0xc9bb('0x35')]['includeAll']){_0x3b7526['include']=[{'all':!![]}];}return db[_0xc9bb('0x2f')][_0xc9bb('0x44')](_0x3b7526);})['then'](function(_0xca257d){_0x35411a[_0xc9bb('0x45')]=_0xca257d;return _0x35411a;})['then'](respondWithFilteredResult(_0x5c255e,_0x3b7526))[_0xc9bb('0x46')](handleError(_0x5c255e,null));};exports[_0xc9bb('0x47')]=function(_0x417743,_0x110fb8){var _0x3f3930={'raw':!![],'where':{'id':_0x417743[_0xc9bb('0x48')]['id']}},_0x130cf6={};_0x130cf6[_0xc9bb('0x34')]=_[_0xc9bb('0x36')](db[_0xc9bb('0x2f')][_0xc9bb('0x30')]);_0x130cf6[_0xc9bb('0x35')]=_[_0xc9bb('0x36')](_0x417743[_0xc9bb('0x35')]);_0x130cf6[_0xc9bb('0x40')]=_[_0xc9bb('0x37')](_0x130cf6[_0xc9bb('0x34')],_0x130cf6[_0xc9bb('0x35')]);_0x3f3930[_0xc9bb('0x38')]=_[_0xc9bb('0x37')](_0x130cf6[_0xc9bb('0x34')],qs['fields'](_0x417743['query'][_0xc9bb('0x39')]));_0x3f3930[_0xc9bb('0x38')]=_0x3f3930[_0xc9bb('0x38')][_0xc9bb('0x3a')]?_0x3f3930['attributes']:_0x130cf6[_0xc9bb('0x34')];if(_0x417743['query'][_0xc9bb('0x49')]){_0x3f3930['include']=[{'all':!![]}];}_0x3f3930=_[_0xc9bb('0x43')]({},_0x3f3930,_0x417743[_0xc9bb('0x4a')]);return db[_0xc9bb('0x2f')][_0xc9bb('0x4b')](_0x3f3930)[_0xc9bb('0x26')](handleEntityNotFound(_0x110fb8,null))['then'](respondWithResult(_0x110fb8,null))['catch'](handleError(_0x110fb8,null));};exports['create']=function(_0x116f33,_0x404ab0){return db[_0xc9bb('0x2f')]['create'](_0x116f33[_0xc9bb('0x4c')],{})[_0xc9bb('0x26')](function(_0x585863){var _0x6fac2a=_0x116f33['user'][_0xc9bb('0x4d')]({'plain':!![]});if(!_0x6fac2a)throw new Error(_0xc9bb('0x4e'));if(_0x6fac2a[_0xc9bb('0x4f')]==='user'){var _0x384f92=_0x585863[_0xc9bb('0x4d')]({'plain':!![]});var _0xd86fb6=_0xc9bb('0x27');return db[_0xc9bb('0x50')][_0xc9bb('0x4b')]({'where':{'name':_0xd86fb6,'userProfileId':_0x6fac2a[_0xc9bb('0x51')]},'raw':!![]})[_0xc9bb('0x26')](function(_0x212392){if(_0x212392&&_0x212392[_0xc9bb('0x52')]===0x0){return db[_0xc9bb('0x28')][_0xc9bb('0x53')]({'name':_0x384f92[_0xc9bb('0x2b')],'resourceId':_0x384f92['id'],'type':_0x212392[_0xc9bb('0x2b')],'sectionId':_0x212392['id']},{})['then'](function(){return _0x585863;});}else{return _0x585863;}})[_0xc9bb('0x46')](function(_0x9cf9eb){logger[_0xc9bb('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9cf9eb);throw _0x9cf9eb;});}return _0x585863;})[_0xc9bb('0x26')](respondWithResult(_0x404ab0,0xc9))[_0xc9bb('0x46')](handleError(_0x404ab0,null));};exports[_0xc9bb('0x25')]=function(_0x1fc613,_0x53df45){if(_0x1fc613[_0xc9bb('0x4c')]['id']){delete _0x1fc613[_0xc9bb('0x4c')]['id'];}return db[_0xc9bb('0x2f')][_0xc9bb('0x4b')]({'where':{'id':_0x1fc613['params']['id']}})['then'](handleEntityNotFound(_0x53df45,null))[_0xc9bb('0x26')](saveUpdates(_0x1fc613[_0xc9bb('0x4c')],null))[_0xc9bb('0x26')](respondWithResult(_0x53df45,null))[_0xc9bb('0x46')](handleError(_0x53df45,null));};exports[_0xc9bb('0x29')]=function(_0x18a7ef,_0x36c381){return db[_0xc9bb('0x2f')]['find']({'where':{'id':_0x18a7ef['params']['id']}})[_0xc9bb('0x26')](handleEntityNotFound(_0x36c381,null))[_0xc9bb('0x26')](removeEntity(_0x36c381,null))[_0xc9bb('0x46')](handleError(_0x36c381,null));}; \ No newline at end of file +var _0x80fb=['intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','findAll','rows','catch','show','params','keys','include','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','body','rimraf','zip-dir','request-promise','moment','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','destroy','get','Templates','UserProfileResource','then','error','name','send','index','map','Template','rawAttributes','fieldName','key','query','filters'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x80fb,0x1a1));var _0xb80f=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x80fb[_0xa6cc5c];return _0x44803d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb80f('0x0'));var zipdir=require(_0xb80f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb80f('0x2'));var moment=require(_0xb80f('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xb80f('0x4'));var sox=require(_0xb80f('0x5'));var csv=require(_0xb80f('0x6'));var ejs=require(_0xb80f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb80f('0x8'));var crypto=require(_0xb80f('0x9'));var jsforce=require(_0xb80f('0xa'));var deskjs=require(_0xb80f('0xb'));var toCsv=require(_0xb80f('0x6'));var querystring=require(_0xb80f('0xc'));var Papa=require(_0xb80f('0xd'));var Redis=require(_0xb80f('0xe'));var authService=require(_0xb80f('0xf'));var qs=require(_0xb80f('0x10'));var as=require(_0xb80f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb80f('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xb80f('0x13'));var licenseUtil=require(_0xb80f('0x14'));var db=require(_0xb80f('0x15'))['db'];function respondWithStatusCode(_0x620da2,_0x481c9f){_0x481c9f=_0x481c9f||0xcc;return function(_0x585f62){if(_0x585f62){return _0x620da2[_0xb80f('0x16')](_0x481c9f);}return _0x620da2['status'](_0x481c9f)[_0xb80f('0x17')]();};}function respondWithResult(_0x3ae18d,_0xd7f0c3){_0xd7f0c3=_0xd7f0c3||0xc8;return function(_0x54e291){if(_0x54e291){return _0x3ae18d['status'](_0xd7f0c3)[_0xb80f('0x18')](_0x54e291);}};}function respondWithFilteredResult(_0x2a8c21,_0x44e84b){return function(_0x4b3004){if(_0x4b3004){var _0x3dc786=typeof _0x44e84b[_0xb80f('0x19')]===_0xb80f('0x1a')&&typeof _0x44e84b[_0xb80f('0x1b')]===_0xb80f('0x1a');var _0x41c2ee=_0x4b3004[_0xb80f('0x1c')];var _0xdd3e67=_0x3dc786?0x0:_0x44e84b[_0xb80f('0x19')];var _0x5ed264=_0x3dc786?_0x4b3004[_0xb80f('0x1c')]:_0x44e84b[_0xb80f('0x19')]+_0x44e84b[_0xb80f('0x1b')];var _0x2ad567;if(_0x5ed264>=_0x41c2ee){_0x5ed264=_0x41c2ee;_0x2ad567=0xc8;}else{_0x2ad567=0xce;}_0x2a8c21[_0xb80f('0x1d')](_0x2ad567);return _0x2a8c21[_0xb80f('0x1e')]('Content-Range',_0xdd3e67+'-'+_0x5ed264+'/'+_0x41c2ee)[_0xb80f('0x18')](_0x4b3004);}return null;};}function patchUpdates(_0x39db7){return function(_0x56ebfc){try{jsonpatch[_0xb80f('0x1f')](_0x56ebfc,_0x39db7,!![]);}catch(_0x4f6f89){return BPromise[_0xb80f('0x20')](_0x4f6f89);}return _0x56ebfc[_0xb80f('0x21')]();};}function saveUpdates(_0x555fd7,_0x529d23){return function(_0x46aa4f){if(_0x46aa4f){return _0x46aa4f[_0xb80f('0x22')](_0x555fd7)['then'](function(_0x91fc44){return _0x91fc44;});}return null;};}function removeEntity(_0x171bcd,_0x474012){return function(_0x366577){if(_0x366577){return _0x366577[_0xb80f('0x23')]()['then'](function(){var _0x5811d3=_0x366577[_0xb80f('0x24')]({'plain':!![]});var _0xaf864=_0xb80f('0x25');return db[_0xb80f('0x26')][_0xb80f('0x23')]({'where':{'type':_0xaf864,'resourceId':_0x5811d3['id']}})[_0xb80f('0x27')](function(){return _0x366577;});})['then'](function(){_0x171bcd[_0xb80f('0x1d')](0xcc)[_0xb80f('0x17')]();});}};}function handleEntityNotFound(_0x30fae7,_0x867c68){return function(_0x3e59af){if(!_0x3e59af){_0x30fae7[_0xb80f('0x16')](0x194);}return _0x3e59af;};}function handleError(_0x32b64f,_0xc93e8b){_0xc93e8b=_0xc93e8b||0x1f4;return function(_0x193f53){logger[_0xb80f('0x28')](_0x193f53['stack']);if(_0x193f53[_0xb80f('0x29')]){delete _0x193f53['name'];}_0x32b64f['status'](_0xc93e8b)[_0xb80f('0x2a')](_0x193f53);};}exports[_0xb80f('0x2b')]=function(_0x47dc26,_0x56d726){var _0x4e9f0f={},_0x5664e0={},_0x3e92ac={'count':0x0,'rows':[]};var _0x312150=_[_0xb80f('0x2c')](db[_0xb80f('0x2d')][_0xb80f('0x2e')],function(_0x4f5093){return{'name':_0x4f5093[_0xb80f('0x2f')],'type':_0x4f5093['type'][_0xb80f('0x30')]};});_0x5664e0['model']=_['map'](_0x312150,_0xb80f('0x29'));_0x5664e0['query']=_['keys'](_0x47dc26[_0xb80f('0x31')]);_0x5664e0[_0xb80f('0x32')]=_[_0xb80f('0x33')](_0x5664e0[_0xb80f('0x34')],_0x5664e0['query']);_0x4e9f0f['attributes']=_[_0xb80f('0x33')](_0x5664e0['model'],qs[_0xb80f('0x35')](_0x47dc26[_0xb80f('0x31')][_0xb80f('0x35')]));_0x4e9f0f[_0xb80f('0x36')]=_0x4e9f0f[_0xb80f('0x36')][_0xb80f('0x37')]?_0x4e9f0f['attributes']:_0x5664e0['model'];if(!_0x47dc26[_0xb80f('0x31')][_0xb80f('0x38')](_0xb80f('0x39'))){_0x4e9f0f['limit']=qs[_0xb80f('0x1b')](_0x47dc26[_0xb80f('0x31')][_0xb80f('0x1b')]);_0x4e9f0f[_0xb80f('0x19')]=qs[_0xb80f('0x19')](_0x47dc26[_0xb80f('0x31')][_0xb80f('0x19')]);}_0x4e9f0f[_0xb80f('0x3a')]=qs['sort'](_0x47dc26[_0xb80f('0x31')][_0xb80f('0x3b')]);_0x4e9f0f[_0xb80f('0x3c')]=qs[_0xb80f('0x32')](_['pick'](_0x47dc26['query'],_0x5664e0[_0xb80f('0x32')]),_0x312150);if(_0x47dc26[_0xb80f('0x31')][_0xb80f('0x3d')]){_0x4e9f0f['where']=_['merge'](_0x4e9f0f[_0xb80f('0x3c')],{'$or':_['map'](_0x312150,function(_0x28ccf7){if(_0x28ccf7['type']!=='VIRTUAL'){var _0x29f3d1={};_0x29f3d1[_0x28ccf7[_0xb80f('0x29')]]={'$like':'%'+_0x47dc26['query'][_0xb80f('0x3d')]+'%'};return _0x29f3d1;}})});}_0x4e9f0f=_[_0xb80f('0x3e')]({},_0x4e9f0f,_0x47dc26['options']);var _0x3a0156={'where':_0x4e9f0f[_0xb80f('0x3c')]};return db['Template']['count'](_0x3a0156)[_0xb80f('0x27')](function(_0x8523ae){_0x3e92ac['count']=_0x8523ae;if(_0x47dc26[_0xb80f('0x31')][_0xb80f('0x3f')]){_0x4e9f0f['include']=[{'all':!![]}];}return db['Template'][_0xb80f('0x40')](_0x4e9f0f);})['then'](function(_0x36c2a9){_0x3e92ac[_0xb80f('0x41')]=_0x36c2a9;return _0x3e92ac;})[_0xb80f('0x27')](respondWithFilteredResult(_0x56d726,_0x4e9f0f))[_0xb80f('0x42')](handleError(_0x56d726,null));};exports[_0xb80f('0x43')]=function(_0x3be76e,_0x4c40d7){var _0x432889={'raw':!![],'where':{'id':_0x3be76e[_0xb80f('0x44')]['id']}},_0x3f66c8={};_0x3f66c8[_0xb80f('0x34')]=_[_0xb80f('0x45')](db[_0xb80f('0x2d')][_0xb80f('0x2e')]);_0x3f66c8['query']=_['keys'](_0x3be76e['query']);_0x3f66c8[_0xb80f('0x32')]=_['intersection'](_0x3f66c8[_0xb80f('0x34')],_0x3f66c8[_0xb80f('0x31')]);_0x432889[_0xb80f('0x36')]=_[_0xb80f('0x33')](_0x3f66c8[_0xb80f('0x34')],qs[_0xb80f('0x35')](_0x3be76e[_0xb80f('0x31')][_0xb80f('0x35')]));_0x432889[_0xb80f('0x36')]=_0x432889[_0xb80f('0x36')][_0xb80f('0x37')]?_0x432889[_0xb80f('0x36')]:_0x3f66c8[_0xb80f('0x34')];if(_0x3be76e['query']['includeAll']){_0x432889[_0xb80f('0x46')]=[{'all':!![]}];}_0x432889=_['merge']({},_0x432889,_0x3be76e[_0xb80f('0x47')]);return db[_0xb80f('0x2d')][_0xb80f('0x48')](_0x432889)[_0xb80f('0x27')](handleEntityNotFound(_0x4c40d7,null))[_0xb80f('0x27')](respondWithResult(_0x4c40d7,null))[_0xb80f('0x42')](handleError(_0x4c40d7,null));};exports[_0xb80f('0x49')]=function(_0x2c4448,_0x553da9){return db[_0xb80f('0x2d')]['create'](_0x2c4448['body'],{})[_0xb80f('0x27')](function(_0xf88b31){var _0xb347ff=_0x2c4448['user'][_0xb80f('0x24')]({'plain':!![]});if(!_0xb347ff)throw new Error(_0xb80f('0x4a'));if(_0xb347ff['role']===_0xb80f('0x4b')){var _0x5c9657=_0xf88b31[_0xb80f('0x24')]({'plain':!![]});var _0x366883=_0xb80f('0x25');return db['UserProfileSection'][_0xb80f('0x48')]({'where':{'name':_0x366883,'userProfileId':_0xb347ff[_0xb80f('0x4c')]},'raw':!![]})[_0xb80f('0x27')](function(_0x209133){if(_0x209133&&_0x209133['autoAssociation']===0x0){return db[_0xb80f('0x26')]['create']({'name':_0x5c9657[_0xb80f('0x29')],'resourceId':_0x5c9657['id'],'type':_0x209133['name'],'sectionId':_0x209133['id']},{})['then'](function(){return _0xf88b31;});}else{return _0xf88b31;}})[_0xb80f('0x42')](function(_0x4b8df){logger[_0xb80f('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b8df);throw _0x4b8df;});}return _0xf88b31;})['then'](respondWithResult(_0x553da9,0xc9))['catch'](handleError(_0x553da9,null));};exports[_0xb80f('0x22')]=function(_0x652303,_0x492b20){if(_0x652303[_0xb80f('0x4d')]['id']){delete _0x652303[_0xb80f('0x4d')]['id'];}return db[_0xb80f('0x2d')]['find']({'where':{'id':_0x652303[_0xb80f('0x44')]['id']}})[_0xb80f('0x27')](handleEntityNotFound(_0x492b20,null))['then'](saveUpdates(_0x652303['body'],null))['then'](respondWithResult(_0x492b20,null))[_0xb80f('0x42')](handleError(_0x492b20,null));};exports['destroy']=function(_0x26465e,_0x3813bd){return db[_0xb80f('0x2d')][_0xb80f('0x48')]({'where':{'id':_0x26465e['params']['id']}})['then'](handleEntityNotFound(_0x3813bd,null))[_0xb80f('0x27')](removeEntity(_0x3813bd,null))[_0xb80f('0x42')](handleError(_0x3813bd,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index cd1dc18..21e3703 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 _0xe611=['Template','tools_templates','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./template.attributes','exports','define'];(function(_0x1129d2,_0x3123ec){var _0x1b063f=function(_0x1c0025){while(--_0x1c0025){_0x1129d2['push'](_0x1129d2['shift']());}};_0x1b063f(++_0x3123ec);}(_0xe611,0x9e));var _0x1e61=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xe611[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0x1e61('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1e61('0x1'));var moment=require(_0x1e61('0x2'));var BPromise=require(_0x1e61('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1e61('0x4'));var rimraf=require(_0x1e61('0x5'));var config=require(_0x1e61('0x6'));var attributes=require(_0x1e61('0x7'));module[_0x1e61('0x8')]=function(_0x215cf1,_0x595850){return _0x215cf1[_0x1e61('0x9')](_0x1e61('0xa'),attributes,{'tableName':_0x1e61('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c6d=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x6ffa12,_0x45a92a){var _0x17b047=function(_0x1bf1f6){while(--_0x1bf1f6){_0x6ffa12['push'](_0x6ffa12['shift']());}};_0x17b047(++_0x45a92a);}(_0x8c6d,0x154));var _0xd8c6=function(_0x433d44,_0x5e333a){_0x433d44=_0x433d44-0x0;var _0x3a9a47=_0x8c6d[_0x433d44];return _0x3a9a47;};'use strict';var _=require(_0xd8c6('0x0'));var util=require(_0xd8c6('0x1'));var logger=require(_0xd8c6('0x2'))(_0xd8c6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd8c6('0x4'));var fs=require('fs');var path=require(_0xd8c6('0x5'));var rimraf=require(_0xd8c6('0x6'));var config=require(_0xd8c6('0x7'));var attributes=require('./template.attributes');module[_0xd8c6('0x8')]=function(_0x44a173,_0x4aab13){return _0x44a173[_0xd8c6('0x9')]('Template',attributes,{'tableName':'tools_templates','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 acae979..bf8c87d 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 _0xe46f=['message','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','include','map','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x1bf8c8,_0xbc71c4){var _0x90273c=function(_0x3c51ac){while(--_0x3c51ac){_0x1bf8c8['push'](_0x1bf8c8['shift']());}};_0x90273c(++_0xbc71c4);}(_0xe46f,0x157));var _0xfe46=function(_0x1b51ea,_0x394fd9){_0x1b51ea=_0x1b51ea-0x0;var _0x18bbdc=_0xe46f[_0x1b51ea];return _0x18bbdc;};'use strict';var _=require('lodash');var util=require(_0xfe46('0x0'));var moment=require(_0xfe46('0x1'));var BPromise=require(_0xfe46('0x2'));var rs=require(_0xfe46('0x3'));var fs=require('fs');var Redis=require(_0xfe46('0x4'));var db=require(_0xfe46('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfe46('0x6'));var config=require(_0xfe46('0x7'));var jayson=require(_0xfe46('0x8'));var client=jayson[_0xfe46('0x9')][_0xfe46('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44b15f,_0x9c47c2,_0x1e7b50){return new BPromise(function(_0x948f53,_0x576837){return client[_0xfe46('0xb')](_0x44b15f,_0x1e7b50)[_0xfe46('0xc')](function(_0x9e2333){logger[_0xfe46('0xd')](_0xfe46('0xe'),_0x9c47c2,_0xfe46('0xf'));logger[_0xfe46('0x10')]('Template,\x20%s,\x20%s,\x20%s',_0x9c47c2,_0xfe46('0xf'),JSON[_0xfe46('0x11')](_0x9e2333));if(_0x9e2333[_0xfe46('0x12')]){if(_0x9e2333[_0xfe46('0x12')][_0xfe46('0x13')]===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x9c47c2,_0x9e2333[_0xfe46('0x12')][_0xfe46('0x14')]);return _0x576837(_0x9e2333['error'][_0xfe46('0x14')]);}logger['error'](_0xfe46('0xe'),_0x9c47c2,_0x9e2333[_0xfe46('0x12')]['message']);return _0x948f53(_0x9e2333[_0xfe46('0x12')][_0xfe46('0x14')]);}else{logger['info']('Template,\x20%s,\x20%s',_0x9c47c2,'request\x20sent');_0x948f53(_0x9e2333[_0xfe46('0x15')][_0xfe46('0x14')]);}})[_0xfe46('0x16')](function(_0x3bd643){logger[_0xfe46('0x12')](_0xfe46('0xe'),_0x9c47c2,_0x3bd643);_0x576837(_0x3bd643);});});}exports[_0xfe46('0x17')]=function(_0x134589){var _0x51e8c6=this;return new Promise(function(_0x194496,_0x56786a){return db[_0xfe46('0x18')][_0xfe46('0x19')]({'raw':_0x134589[_0xfe46('0x1a')]?_0x134589[_0xfe46('0x1a')][_0xfe46('0x1b')]===undefined?!![]:![]:!![],'where':_0x134589['options']?_0x134589[_0xfe46('0x1a')][_0xfe46('0x1c')]||null:null,'attributes':_0x134589[_0xfe46('0x1a')]?_0x134589[_0xfe46('0x1a')][_0xfe46('0x1d')]||null:null,'limit':_0x134589['options']?_0x134589[_0xfe46('0x1a')]['limit']||null:null,'include':_0x134589[_0xfe46('0x1a')]?_0x134589[_0xfe46('0x1a')][_0xfe46('0x1e')]?_[_0xfe46('0x1f')](_0x134589[_0xfe46('0x1a')][_0xfe46('0x1e')],function(_0x43c41a){return{'model':db[_0x43c41a[_0xfe46('0x20')]],'as':_0x43c41a['as'],'attributes':_0x43c41a[_0xfe46('0x1d')],'include':_0x43c41a[_0xfe46('0x1e')]?_[_0xfe46('0x1f')](_0x43c41a[_0xfe46('0x1e')],function(_0x520d4f){return{'model':db[_0x520d4f[_0xfe46('0x20')]],'as':_0x520d4f['as'],'attributes':_0x520d4f[_0xfe46('0x1d')],'include':_0x520d4f[_0xfe46('0x1e')]?_[_0xfe46('0x1f')](_0x520d4f[_0xfe46('0x1e')],function(_0x4f06e2){return{'model':db[_0x4f06e2[_0xfe46('0x20')]],'as':_0x4f06e2['as'],'attributes':_0x4f06e2[_0xfe46('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfe46('0xc')](function(_0x3b6ef4){logger[_0xfe46('0xd')](_0xfe46('0x17'),_0x134589);logger[_0xfe46('0x10')]('GetTemplate',_0x134589,JSON[_0xfe46('0x11')](_0x3b6ef4));_0x194496(_0x3b6ef4);})['catch'](function(_0x23f4dd){logger[_0xfe46('0x12')](_0xfe46('0x17'),_0x23f4dd[_0xfe46('0x14')],_0x134589);_0x56786a(_0x51e8c6[_0xfe46('0x12')](0x1f4,_0x23f4dd[_0xfe46('0x14')]));});});}; \ No newline at end of file +var _0x15b0=['options','raw','attributes','limit','include','map','GetTemplate','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','request','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','Template','findAll'];(function(_0x7ef3cf,_0x3d7eec){var _0x4070c5=function(_0x32ad51){while(--_0x32ad51){_0x7ef3cf['push'](_0x7ef3cf['shift']());}};_0x4070c5(++_0x3d7eec);}(_0x15b0,0x146));var _0x015b=function(_0x3bab53,_0x46230f){_0x3bab53=_0x3bab53-0x0;var _0x1a969e=_0x15b0[_0x3bab53];return _0x1a969e;};'use strict';var _=require(_0x015b('0x0'));var util=require(_0x015b('0x1'));var moment=require(_0x015b('0x2'));var BPromise=require(_0x015b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x015b('0x4'));var db=require(_0x015b('0x5'))['db'];var utils=require(_0x015b('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x015b('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x487854,_0x122e9d,_0x56160a){return new BPromise(function(_0x20c78e,_0x35ecd2){return client[_0x015b('0x8')](_0x487854,_0x56160a)['then'](function(_0x4e6401){logger['info'](_0x015b('0x9'),_0x122e9d,_0x015b('0xa'));logger[_0x015b('0xb')](_0x015b('0xc'),_0x122e9d,_0x015b('0xa'),JSON[_0x015b('0xd')](_0x4e6401));if(_0x4e6401['error']){if(_0x4e6401['error'][_0x015b('0xe')]===0x1f4){logger[_0x015b('0xf')](_0x015b('0x9'),_0x122e9d,_0x4e6401[_0x015b('0xf')]['message']);return _0x35ecd2(_0x4e6401['error'][_0x015b('0x10')]);}logger[_0x015b('0xf')]('Template,\x20%s,\x20%s',_0x122e9d,_0x4e6401['error']['message']);return _0x20c78e(_0x4e6401[_0x015b('0xf')][_0x015b('0x10')]);}else{logger[_0x015b('0x11')](_0x015b('0x9'),_0x122e9d,_0x015b('0xa'));_0x20c78e(_0x4e6401[_0x015b('0x12')][_0x015b('0x10')]);}})[_0x015b('0x13')](function(_0x80a87e){logger[_0x015b('0xf')]('Template,\x20%s,\x20%s',_0x122e9d,_0x80a87e);_0x35ecd2(_0x80a87e);});});}exports['GetTemplate']=function(_0x3d1ea1){var _0x1a9d88=this;return new Promise(function(_0x267325,_0x3016d4){return db[_0x015b('0x14')][_0x015b('0x15')]({'raw':_0x3d1ea1['options']?_0x3d1ea1[_0x015b('0x16')][_0x015b('0x17')]===undefined?!![]:![]:!![],'where':_0x3d1ea1[_0x015b('0x16')]?_0x3d1ea1[_0x015b('0x16')]['where']||null:null,'attributes':_0x3d1ea1[_0x015b('0x16')]?_0x3d1ea1[_0x015b('0x16')][_0x015b('0x18')]||null:null,'limit':_0x3d1ea1[_0x015b('0x16')]?_0x3d1ea1[_0x015b('0x16')][_0x015b('0x19')]||null:null,'include':_0x3d1ea1['options']?_0x3d1ea1['options'][_0x015b('0x1a')]?_[_0x015b('0x1b')](_0x3d1ea1[_0x015b('0x16')][_0x015b('0x1a')],function(_0x4ada75){return{'model':db[_0x4ada75['model']],'as':_0x4ada75['as'],'attributes':_0x4ada75[_0x015b('0x18')],'include':_0x4ada75['include']?_[_0x015b('0x1b')](_0x4ada75[_0x015b('0x1a')],function(_0x34742f){return{'model':db[_0x34742f['model']],'as':_0x34742f['as'],'attributes':_0x34742f[_0x015b('0x18')],'include':_0x34742f['include']?_[_0x015b('0x1b')](_0x34742f[_0x015b('0x1a')],function(_0x3c3dfc){return{'model':db[_0x3c3dfc['model']],'as':_0x3c3dfc['as'],'attributes':_0x3c3dfc[_0x015b('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x345f04){logger[_0x015b('0x11')](_0x015b('0x1c'),_0x3d1ea1);logger[_0x015b('0xb')]('GetTemplate',_0x3d1ea1,JSON[_0x015b('0xd')](_0x345f04));_0x267325(_0x345f04);})['catch'](function(_0xc091d5){logger[_0x015b('0xf')]('GetTemplate',_0xc091d5[_0x015b('0x10')],_0x3d1ea1);_0x3016d4(_0x1a9d88[_0x015b('0xf')](0x1f4,_0xc091d5[_0x015b('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 4508c9c..93fd9d4 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 _0x0e6b=['/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','addAction','put','/:id','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0e6b,0x17d));var _0xb0e6=function(_0x4828b1,_0x5c8cf3){_0x4828b1=_0x4828b1-0x0;var _0x1fec1b=_0x0e6b[_0x4828b1];return _0x1fec1b;};'use strict';var multer=require(_0xb0e6('0x0'));var util=require('util');var path=require(_0xb0e6('0x1'));var timeout=require('connect-timeout');var express=require(_0xb0e6('0x2'));var router=express[_0xb0e6('0x3')]();var fs_extra=require(_0xb0e6('0x4'));var auth=require(_0xb0e6('0x5'));var interaction=require(_0xb0e6('0x6'));var config=require(_0xb0e6('0x7'));var controller=require('./trigger.controller');router[_0xb0e6('0x8')]('/',auth[_0xb0e6('0x9')](),controller[_0xb0e6('0xa')]);router[_0xb0e6('0x8')]('/:id',auth[_0xb0e6('0x9')](),controller['show']);router[_0xb0e6('0x8')](_0xb0e6('0xb'),auth[_0xb0e6('0x9')](),controller[_0xb0e6('0xc')]);router[_0xb0e6('0x8')](_0xb0e6('0xd'),auth['isAuthenticated'](),controller[_0xb0e6('0xe')]);router['get'](_0xb0e6('0xf'),auth[_0xb0e6('0x9')](),controller[_0xb0e6('0x10')]);router[_0xb0e6('0x11')]('/',auth[_0xb0e6('0x9')](),controller[_0xb0e6('0x12')]);router['post'](_0xb0e6('0xb'),auth['isAuthenticated'](),controller[_0xb0e6('0x13')]);router[_0xb0e6('0x11')]('/:id/any_conditions',auth[_0xb0e6('0x9')](),controller[_0xb0e6('0x14')]);router[_0xb0e6('0x11')](_0xb0e6('0xf'),auth[_0xb0e6('0x9')](),controller[_0xb0e6('0x15')]);router[_0xb0e6('0x16')](_0xb0e6('0x17'),auth['isAuthenticated'](),controller[_0xb0e6('0x18')]);router[_0xb0e6('0x19')](_0xb0e6('0x17'),auth[_0xb0e6('0x9')](),controller[_0xb0e6('0x1a')]);module[_0xb0e6('0x1b')]=router; \ No newline at end of file +var _0x7871=['index','show','/:id/all_conditions','getAnyConditions','/:id/actions','getActions','post','addAllCondition','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trigger.controller','get','isAuthenticated'];(function(_0x4fd585,_0x1fdea2){var _0xc7c132=function(_0xa81e43){while(--_0xa81e43){_0x4fd585['push'](_0x4fd585['shift']());}};_0xc7c132(++_0x1fdea2);}(_0x7871,0xb5));var _0x1787=function(_0x242e05,_0x49252c){_0x242e05=_0x242e05-0x0;var _0x16ffb3=_0x7871[_0x242e05];return _0x16ffb3;};'use strict';var multer=require(_0x1787('0x0'));var util=require('util');var path=require(_0x1787('0x1'));var timeout=require(_0x1787('0x2'));var express=require(_0x1787('0x3'));var router=express[_0x1787('0x4')]();var fs_extra=require(_0x1787('0x5'));var auth=require(_0x1787('0x6'));var interaction=require(_0x1787('0x7'));var config=require('../../config/environment');var controller=require(_0x1787('0x8'));router[_0x1787('0x9')]('/',auth[_0x1787('0xa')](),controller[_0x1787('0xb')]);router[_0x1787('0x9')]('/:id',auth[_0x1787('0xa')](),controller[_0x1787('0xc')]);router[_0x1787('0x9')](_0x1787('0xd'),auth[_0x1787('0xa')](),controller['getAllConditions']);router[_0x1787('0x9')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0x1787('0xe')]);router[_0x1787('0x9')](_0x1787('0xf'),auth['isAuthenticated'](),controller[_0x1787('0x10')]);router[_0x1787('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1787('0x11')](_0x1787('0xd'),auth[_0x1787('0xa')](),controller[_0x1787('0x12')]);router['post']('/:id/any_conditions',auth['isAuthenticated'](),controller['addAnyCondition']);router[_0x1787('0x11')]('/:id/actions',auth[_0x1787('0xa')](),controller['addAction']);router[_0x1787('0x13')](_0x1787('0x14'),auth['isAuthenticated'](),controller[_0x1787('0x15')]);router[_0x1787('0x16')](_0x1787('0x14'),auth[_0x1787('0xa')](),controller[_0x1787('0x17')]);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 639e43f..ec8003e 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 _0x8e4f=['BOOLEAN','exports','STRING'];(function(_0x17ad2a,_0xf4c1f2){var _0x59ae96=function(_0x28625e){while(--_0x28625e){_0x17ad2a['push'](_0x17ad2a['shift']());}};_0x59ae96(++_0xf4c1f2);}(_0x8e4f,0x160));var _0xf8e4=function(_0x44a12a,_0x40f902){_0x44a12a=_0x44a12a-0x0;var _0x1dc36f=_0x8e4f[_0x44a12a];return _0x1dc36f;};'use strict';var Sequelize=require('sequelize');module[_0xf8e4('0x0')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xf8e4('0x1')]},'description':{'type':Sequelize[_0xf8e4('0x1')]},'status':{'type':Sequelize[_0xf8e4('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xd065=['sequelize','BOOLEAN'];(function(_0xdae6b9,_0x370831){var _0x4f7567=function(_0x2b96b6){while(--_0x2b96b6){_0xdae6b9['push'](_0xdae6b9['shift']());}};_0x4f7567(++_0x370831);}(_0xd065,0xe2));var _0x5d06=function(_0x1c53ff,_0x29c6ce){_0x1c53ff=_0x1c53ff-0x0;var _0x3935bf=_0xd065[_0x1c53ff];return _0x3935bf;};'use strict';var Sequelize=require(_0x5d06('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x5d06('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 55fa01f..0903ddf 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 _0x8071=['options','includeAll','include','findAll','rows','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','TriggerAnyId','findOne','pick','getAllConditions','hasOwnProperty','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','Triggers','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','type','merge'];(function(_0xa5f4e0,_0x5990b5){var _0x10fcd5=function(_0xf1cc42){while(--_0xf1cc42){_0xa5f4e0['push'](_0xa5f4e0['shift']());}};_0x10fcd5(++_0x5990b5);}(_0x8071,0xe2));var _0x1807=function(_0xc66597,_0x4a9b7b){_0xc66597=_0xc66597-0x0;var _0x1cf738=_0x8071[_0xc66597];return _0x1cf738;};'use strict';var emlformat=require(_0x1807('0x0'));var rimraf=require(_0x1807('0x1'));var zipdir=require(_0x1807('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1807('0x3'));var moment=require(_0x1807('0x4'));var BPromise=require(_0x1807('0x5'));var Mustache=require(_0x1807('0x6'));var util=require('util');var path=require(_0x1807('0x7'));var sox=require('sox');var csv=require(_0x1807('0x8'));var ejs=require(_0x1807('0x9'));var fs=require('fs');var fs_extra=require(_0x1807('0xa'));var _=require('lodash');var squel=require(_0x1807('0xb'));var crypto=require(_0x1807('0xc'));var jsforce=require(_0x1807('0xd'));var deskjs=require(_0x1807('0xe'));var toCsv=require(_0x1807('0x8'));var querystring=require(_0x1807('0xf'));var Papa=require(_0x1807('0x10'));var Redis=require(_0x1807('0x11'));var authService=require(_0x1807('0x12'));var qs=require(_0x1807('0x13'));var as=require(_0x1807('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1807('0x15'))(_0x1807('0x16'));var utils=require(_0x1807('0x17'));var config=require(_0x1807('0x18'));var licenseUtil=require(_0x1807('0x19'));var db=require(_0x1807('0x1a'))['db'];function respondWithStatusCode(_0x299c58,_0x53a6b7){_0x53a6b7=_0x53a6b7||0xcc;return function(_0x51deb8){if(_0x51deb8){return _0x299c58[_0x1807('0x1b')](_0x53a6b7);}return _0x299c58[_0x1807('0x1c')](_0x53a6b7)[_0x1807('0x1d')]();};}function respondWithResult(_0x528787,_0x12cd9b){_0x12cd9b=_0x12cd9b||0xc8;return function(_0x33ce54){if(_0x33ce54){return _0x528787[_0x1807('0x1c')](_0x12cd9b)[_0x1807('0x1e')](_0x33ce54);}};}function respondWithFilteredResult(_0x41474d,_0x27cba7){return function(_0x117492){if(_0x117492){var _0x7f727f=typeof _0x27cba7[_0x1807('0x1f')]==='undefined'&&typeof _0x27cba7[_0x1807('0x20')]===_0x1807('0x21');var _0x1b855f=_0x117492[_0x1807('0x22')];var _0x27c81e=_0x7f727f?0x0:_0x27cba7[_0x1807('0x1f')];var _0x1e148d=_0x7f727f?_0x117492[_0x1807('0x22')]:_0x27cba7['offset']+_0x27cba7[_0x1807('0x20')];var _0x1d6dbe;if(_0x1e148d>=_0x1b855f){_0x1e148d=_0x1b855f;_0x1d6dbe=0xc8;}else{_0x1d6dbe=0xce;}_0x41474d[_0x1807('0x1c')](_0x1d6dbe);return _0x41474d[_0x1807('0x23')]('Content-Range',_0x27c81e+'-'+_0x1e148d+'/'+_0x1b855f)[_0x1807('0x1e')](_0x117492);}return null;};}function patchUpdates(_0x4fde8a){return function(_0x5ec326){try{jsonpatch[_0x1807('0x24')](_0x5ec326,_0x4fde8a,!![]);}catch(_0x42ade0){return BPromise[_0x1807('0x25')](_0x42ade0);}return _0x5ec326[_0x1807('0x26')]();};}function saveUpdates(_0x5219c1,_0x4a609b){return function(_0x26c9fc){if(_0x26c9fc){return _0x26c9fc[_0x1807('0x27')](_0x5219c1)[_0x1807('0x28')](function(_0x8ceb4b){return _0x8ceb4b;});}return null;};}function removeEntity(_0x2fc5cd,_0x4767ab){return function(_0x367146){if(_0x367146){return _0x367146[_0x1807('0x29')]()[_0x1807('0x28')](function(){var _0x4e9e5d=_0x367146['get']({'plain':!![]});var _0x12cca9=_0x1807('0x2a');return db['UserProfileResource'][_0x1807('0x29')]({'where':{'type':_0x12cca9,'resourceId':_0x4e9e5d['id']}})['then'](function(){return _0x367146;});})[_0x1807('0x28')](function(){_0x2fc5cd[_0x1807('0x1c')](0xcc)[_0x1807('0x1d')]();});}};}function handleEntityNotFound(_0x27ebcb,_0x445087){return function(_0x471ea8){if(!_0x471ea8){_0x27ebcb[_0x1807('0x1b')](0x194);}return _0x471ea8;};}function handleError(_0xa65462,_0x4a9bd3){_0x4a9bd3=_0x4a9bd3||0x1f4;return function(_0x3194dd){logger[_0x1807('0x2b')](_0x3194dd[_0x1807('0x2c')]);if(_0x3194dd[_0x1807('0x2d')]){delete _0x3194dd[_0x1807('0x2d')];}_0xa65462['status'](_0x4a9bd3)[_0x1807('0x2e')](_0x3194dd);};}exports[_0x1807('0x2f')]=function(_0x1b744a,_0x9a077d){var _0x4b8f54={},_0x4410c1={},_0x36f02f={'count':0x0,'rows':[]};var _0x4c0509=_[_0x1807('0x30')](db[_0x1807('0x31')][_0x1807('0x32')],function(_0x1976e0){return{'name':_0x1976e0[_0x1807('0x33')],'type':_0x1976e0['type'][_0x1807('0x34')]};});_0x4410c1['model']=_['map'](_0x4c0509,_0x1807('0x2d'));_0x4410c1[_0x1807('0x35')]=_[_0x1807('0x36')](_0x1b744a[_0x1807('0x35')]);_0x4410c1[_0x1807('0x37')]=_[_0x1807('0x38')](_0x4410c1[_0x1807('0x39')],_0x4410c1[_0x1807('0x35')]);_0x4b8f54[_0x1807('0x3a')]=_[_0x1807('0x38')](_0x4410c1[_0x1807('0x39')],qs['fields'](_0x1b744a[_0x1807('0x35')][_0x1807('0x3b')]));_0x4b8f54[_0x1807('0x3a')]=_0x4b8f54[_0x1807('0x3a')][_0x1807('0x3c')]?_0x4b8f54[_0x1807('0x3a')]:_0x4410c1[_0x1807('0x39')];if(!_0x1b744a[_0x1807('0x35')]['hasOwnProperty'](_0x1807('0x3d'))){_0x4b8f54[_0x1807('0x20')]=qs[_0x1807('0x20')](_0x1b744a['query'][_0x1807('0x20')]);_0x4b8f54['offset']=qs[_0x1807('0x1f')](_0x1b744a['query']['offset']);}_0x4b8f54[_0x1807('0x3e')]=qs[_0x1807('0x3f')](_0x1b744a[_0x1807('0x35')][_0x1807('0x3f')]);_0x4b8f54[_0x1807('0x40')]=qs[_0x1807('0x37')](_['pick'](_0x1b744a[_0x1807('0x35')],_0x4410c1[_0x1807('0x37')]),_0x4c0509);if(_0x1b744a[_0x1807('0x35')][_0x1807('0x41')]){_0x4b8f54[_0x1807('0x40')]=_['merge'](_0x4b8f54['where'],{'$or':_[_0x1807('0x30')](_0x4c0509,function(_0x42c11f){if(_0x42c11f[_0x1807('0x42')]!=='VIRTUAL'){var _0x1b9bdb={};_0x1b9bdb[_0x42c11f[_0x1807('0x2d')]]={'$like':'%'+_0x1b744a[_0x1807('0x35')]['filter']+'%'};return _0x1b9bdb;}})});}_0x4b8f54=_[_0x1807('0x43')]({},_0x4b8f54,_0x1b744a[_0x1807('0x44')]);var _0xea3d87={'where':_0x4b8f54['where']};return db[_0x1807('0x31')][_0x1807('0x22')](_0xea3d87)[_0x1807('0x28')](function(_0x118178){_0x36f02f[_0x1807('0x22')]=_0x118178;if(_0x1b744a[_0x1807('0x35')][_0x1807('0x45')]){_0x4b8f54[_0x1807('0x46')]=[{'all':!![]}];}return db['Trigger'][_0x1807('0x47')](_0x4b8f54);})[_0x1807('0x28')](function(_0x24f41c){_0x36f02f[_0x1807('0x48')]=_0x24f41c;return _0x36f02f;})[_0x1807('0x28')](respondWithFilteredResult(_0x9a077d,_0x4b8f54))[_0x1807('0x49')](handleError(_0x9a077d,null));};exports['show']=function(_0x4df4d9,_0x44790e){var _0x511335={'raw':![],'where':{'id':_0x4df4d9[_0x1807('0x4a')]['id']}},_0x32bc20={};_0x32bc20['model']=_[_0x1807('0x36')](db[_0x1807('0x31')][_0x1807('0x32')]);_0x32bc20[_0x1807('0x35')]=_[_0x1807('0x36')](_0x4df4d9[_0x1807('0x35')]);_0x32bc20['filters']=_[_0x1807('0x38')](_0x32bc20[_0x1807('0x39')],_0x32bc20[_0x1807('0x35')]);_0x511335[_0x1807('0x3a')]=_[_0x1807('0x38')](_0x32bc20['model'],qs[_0x1807('0x3b')](_0x4df4d9['query'][_0x1807('0x3b')]));_0x511335[_0x1807('0x3a')]=_0x511335[_0x1807('0x3a')][_0x1807('0x3c')]?_0x511335[_0x1807('0x3a')]:_0x32bc20[_0x1807('0x39')];if(_0x4df4d9[_0x1807('0x35')]['includeAll']){_0x511335['include']=[{'all':!![]}];}_0x511335=_[_0x1807('0x43')]({},_0x511335,_0x4df4d9[_0x1807('0x44')]);return db['Trigger']['find'](_0x511335)[_0x1807('0x28')](handleEntityNotFound(_0x44790e,null))['then'](respondWithResult(_0x44790e,null))['catch'](handleError(_0x44790e,null));};exports['create']=function(_0xaca335,_0x303092){return db[_0x1807('0x31')][_0x1807('0x4b')](_0xaca335[_0x1807('0x4c')],{})[_0x1807('0x28')](function(_0x885b8f){var _0x19c273=_0xaca335[_0x1807('0x4d')]['get']({'plain':!![]});if(!_0x19c273)throw new Error(_0x1807('0x4e'));if(_0x19c273['role']===_0x1807('0x4d')){var _0x543d0c=_0x885b8f[_0x1807('0x4f')]({'plain':!![]});var _0x519796=_0x1807('0x2a');return db[_0x1807('0x50')][_0x1807('0x51')]({'where':{'name':_0x519796,'userProfileId':_0x19c273[_0x1807('0x52')]},'raw':!![]})['then'](function(_0x498ed7){if(_0x498ed7&&_0x498ed7['autoAssociation']===0x0){return db[_0x1807('0x53')][_0x1807('0x4b')]({'name':_0x543d0c[_0x1807('0x2d')],'resourceId':_0x543d0c['id'],'type':_0x498ed7[_0x1807('0x2d')],'sectionId':_0x498ed7['id']},{})[_0x1807('0x28')](function(){return _0x885b8f;});}else{return _0x885b8f;}})[_0x1807('0x49')](function(_0x1b567b){logger[_0x1807('0x2b')](_0x1807('0x54'),_0x1b567b);throw _0x1b567b;});}return _0x885b8f;})['then'](respondWithResult(_0x303092,0xc9))['catch'](handleError(_0x303092,null));};exports['update']=function(_0x52cfaa,_0x4086f7){if(_0x52cfaa[_0x1807('0x4c')]['id']){delete _0x52cfaa[_0x1807('0x4c')]['id'];}return db['Trigger'][_0x1807('0x51')]({'where':{'id':_0x52cfaa[_0x1807('0x4a')]['id']}})[_0x1807('0x28')](handleEntityNotFound(_0x4086f7,null))[_0x1807('0x28')](saveUpdates(_0x52cfaa[_0x1807('0x4c')],null))['then'](respondWithResult(_0x4086f7,null))[_0x1807('0x49')](handleError(_0x4086f7,null));};exports[_0x1807('0x29')]=function(_0x3a274c,_0x219a63){return db[_0x1807('0x31')][_0x1807('0x51')]({'where':{'id':_0x3a274c['params']['id']}})['then'](handleEntityNotFound(_0x219a63,null))[_0x1807('0x28')](removeEntity(_0x219a63,null))[_0x1807('0x49')](handleError(_0x219a63,null));};exports[_0x1807('0x55')]=function(_0x13be51,_0x467cae,_0x318490){if(_0x13be51[_0x1807('0x4c')]['id']){delete _0x13be51[_0x1807('0x4c')]['id'];}return db[_0x1807('0x31')][_0x1807('0x51')]({'where':{'id':_0x13be51[_0x1807('0x4a')]['id']}})[_0x1807('0x28')](handleEntityNotFound(_0x467cae,null))[_0x1807('0x28')](function(_0x4578f1){if(_0x4578f1){_0x13be51[_0x1807('0x4c')][_0x1807('0x56')]=_0x4578f1['id'];return db[_0x1807('0x57')][_0x1807('0x4b')](_0x13be51[_0x1807('0x4c')]);}})[_0x1807('0x28')](respondWithResult(_0x467cae,null))['catch'](handleError(_0x467cae,null));};exports['addAnyCondition']=function(_0x5e5a48,_0x1ca5b8,_0x4dfd2a){if(_0x5e5a48['body']['id']){delete _0x5e5a48[_0x1807('0x4c')]['id'];}return db[_0x1807('0x31')][_0x1807('0x51')]({'where':{'id':_0x5e5a48[_0x1807('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1ca5b8,null))[_0x1807('0x28')](function(_0x423459){if(_0x423459){_0x5e5a48[_0x1807('0x4c')][_0x1807('0x58')]=_0x423459['id'];return db[_0x1807('0x57')][_0x1807('0x4b')](_0x5e5a48[_0x1807('0x4c')]);}})['then'](respondWithResult(_0x1ca5b8,null))['catch'](handleError(_0x1ca5b8,null));};exports['getAllConditions']=function(_0x3a043a,_0x3e4a04,_0x296666){var _0x23bf74={};var _0x3d118c={};var _0x3c3754;var _0x2c9d74;return db['Trigger'][_0x1807('0x59')]({'where':{'id':_0x3a043a[_0x1807('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3e4a04,null))[_0x1807('0x28')](function(_0x45b297){if(_0x45b297){_0x3c3754=_0x45b297;_0x3d118c['model']=_[_0x1807('0x36')](db['Condition'][_0x1807('0x32')]);_0x3d118c[_0x1807('0x35')]=_[_0x1807('0x36')](_0x3a043a[_0x1807('0x35')]);_0x3d118c[_0x1807('0x37')]=_[_0x1807('0x38')](_0x3d118c[_0x1807('0x39')],_0x3d118c['query']);_0x23bf74[_0x1807('0x3a')]=_[_0x1807('0x38')](_0x3d118c[_0x1807('0x39')],qs[_0x1807('0x3b')](_0x3a043a[_0x1807('0x35')]['fields']));_0x23bf74['attributes']=_0x23bf74[_0x1807('0x3a')][_0x1807('0x3c')]?_0x23bf74[_0x1807('0x3a')]:_0x3d118c[_0x1807('0x39')];_0x23bf74[_0x1807('0x3e')]=qs[_0x1807('0x3f')](_0x3a043a[_0x1807('0x35')]['sort']);_0x23bf74[_0x1807('0x40')]=qs[_0x1807('0x37')](_[_0x1807('0x5a')](_0x3a043a[_0x1807('0x35')],_0x3d118c[_0x1807('0x37')]));if(_0x3a043a[_0x1807('0x35')][_0x1807('0x41')]){_0x23bf74[_0x1807('0x40')]=_['merge'](_0x23bf74['where'],{'$or':_[_0x1807('0x30')](_0x23bf74[_0x1807('0x3a')],function(_0x51ba3f){var _0x535c60={};_0x535c60[_0x51ba3f]={'$like':'%'+_0x3a043a['query'][_0x1807('0x41')]+'%'};return _0x535c60;})});}_0x23bf74=_[_0x1807('0x43')]({},_0x23bf74,_0x3a043a[_0x1807('0x44')]);return _0x3c3754[_0x1807('0x5b')](_0x23bf74);}})[_0x1807('0x28')](function(_0x96bc67){if(_0x96bc67){_0x2c9d74=_0x96bc67[_0x1807('0x3c')];if(!_0x3a043a[_0x1807('0x35')][_0x1807('0x5c')](_0x1807('0x3d'))){_0x23bf74[_0x1807('0x20')]=qs[_0x1807('0x20')](_0x3a043a[_0x1807('0x35')][_0x1807('0x20')]);_0x23bf74[_0x1807('0x1f')]=qs[_0x1807('0x1f')](_0x3a043a[_0x1807('0x35')][_0x1807('0x1f')]);}return _0x3c3754[_0x1807('0x5b')](_0x23bf74);}})['then'](function(_0x30617f){if(_0x30617f){return _0x30617f?{'count':_0x2c9d74,'rows':_0x30617f}:null;}})[_0x1807('0x28')](respondWithResult(_0x3e4a04,null))['catch'](handleError(_0x3e4a04,null));};exports['getAnyConditions']=function(_0x5e5a83,_0x3f2fe7,_0x2deafe){var _0x4d13e0={};var _0x5b9e37={};var _0x589586;var _0x571142;return db[_0x1807('0x31')]['findOne']({'where':{'id':_0x5e5a83['params']['id']}})[_0x1807('0x28')](handleEntityNotFound(_0x3f2fe7,null))[_0x1807('0x28')](function(_0x5bd142){if(_0x5bd142){_0x589586=_0x5bd142;_0x5b9e37[_0x1807('0x39')]=_[_0x1807('0x36')](db[_0x1807('0x57')][_0x1807('0x32')]);_0x5b9e37[_0x1807('0x35')]=_[_0x1807('0x36')](_0x5e5a83[_0x1807('0x35')]);_0x5b9e37[_0x1807('0x37')]=_['intersection'](_0x5b9e37[_0x1807('0x39')],_0x5b9e37[_0x1807('0x35')]);_0x4d13e0['attributes']=_[_0x1807('0x38')](_0x5b9e37[_0x1807('0x39')],qs['fields'](_0x5e5a83[_0x1807('0x35')][_0x1807('0x3b')]));_0x4d13e0[_0x1807('0x3a')]=_0x4d13e0['attributes']['length']?_0x4d13e0['attributes']:_0x5b9e37[_0x1807('0x39')];_0x4d13e0['order']=qs[_0x1807('0x3f')](_0x5e5a83[_0x1807('0x35')][_0x1807('0x3f')]);_0x4d13e0[_0x1807('0x40')]=qs[_0x1807('0x37')](_[_0x1807('0x5a')](_0x5e5a83[_0x1807('0x35')],_0x5b9e37[_0x1807('0x37')]));if(_0x5e5a83[_0x1807('0x35')][_0x1807('0x41')]){_0x4d13e0[_0x1807('0x40')]=_[_0x1807('0x43')](_0x4d13e0[_0x1807('0x40')],{'$or':_['map'](_0x4d13e0[_0x1807('0x3a')],function(_0x2e6edc){var _0xfaaa1d={};_0xfaaa1d[_0x2e6edc]={'$like':'%'+_0x5e5a83[_0x1807('0x35')][_0x1807('0x41')]+'%'};return _0xfaaa1d;})});}_0x4d13e0=_[_0x1807('0x43')]({},_0x4d13e0,_0x5e5a83['options']);return _0x589586[_0x1807('0x5d')](_0x4d13e0);}})[_0x1807('0x28')](function(_0x466c10){if(_0x466c10){_0x571142=_0x466c10[_0x1807('0x3c')];if(!_0x5e5a83[_0x1807('0x35')][_0x1807('0x5c')]('nolimit')){_0x4d13e0[_0x1807('0x20')]=qs[_0x1807('0x20')](_0x5e5a83[_0x1807('0x35')][_0x1807('0x20')]);_0x4d13e0[_0x1807('0x1f')]=qs['offset'](_0x5e5a83[_0x1807('0x35')][_0x1807('0x1f')]);}return _0x589586['getAnyConditions'](_0x4d13e0);}})[_0x1807('0x28')](function(_0x5ae6b7){if(_0x5ae6b7){return _0x5ae6b7?{'count':_0x571142,'rows':_0x5ae6b7}:null;}})[_0x1807('0x28')](respondWithResult(_0x3f2fe7,null))[_0x1807('0x49')](handleError(_0x3f2fe7,null));};exports[_0x1807('0x5e')]=function(_0x69896d,_0x554f50,_0x5f227b){if(_0x69896d[_0x1807('0x4c')]['id']){delete _0x69896d[_0x1807('0x4c')]['id'];}return db[_0x1807('0x31')]['find']({'where':{'id':_0x69896d[_0x1807('0x4a')]['id']}})[_0x1807('0x28')](handleEntityNotFound(_0x554f50,null))['then'](function(_0x45dbce){if(_0x45dbce){_0x69896d[_0x1807('0x4c')][_0x1807('0x5f')]=_0x45dbce['id'];return db[_0x1807('0x60')][_0x1807('0x4b')](_0x69896d[_0x1807('0x4c')]);}})['then'](respondWithResult(_0x554f50,null))['catch'](handleError(_0x554f50,null));};exports[_0x1807('0x61')]=function(_0x4a0b8b,_0x367429,_0x277bf8){var _0x17e8a2={};var _0x30faeb={};var _0x58208c;var _0x539c1d;return db[_0x1807('0x31')][_0x1807('0x59')]({'where':{'id':_0x4a0b8b['params']['id']}})[_0x1807('0x28')](handleEntityNotFound(_0x367429,null))['then'](function(_0x398620){if(_0x398620){_0x58208c=_0x398620;_0x30faeb[_0x1807('0x39')]=_[_0x1807('0x36')](db[_0x1807('0x60')][_0x1807('0x32')]);_0x30faeb[_0x1807('0x35')]=_['keys'](_0x4a0b8b[_0x1807('0x35')]);_0x30faeb[_0x1807('0x37')]=_[_0x1807('0x38')](_0x30faeb[_0x1807('0x39')],_0x30faeb[_0x1807('0x35')]);_0x17e8a2['attributes']=_[_0x1807('0x38')](_0x30faeb[_0x1807('0x39')],qs[_0x1807('0x3b')](_0x4a0b8b[_0x1807('0x35')][_0x1807('0x3b')]));_0x17e8a2[_0x1807('0x3a')]=_0x17e8a2[_0x1807('0x3a')][_0x1807('0x3c')]?_0x17e8a2['attributes']:_0x30faeb['model'];_0x17e8a2['order']=qs[_0x1807('0x3f')](_0x4a0b8b[_0x1807('0x35')]['sort']);_0x17e8a2['where']=qs[_0x1807('0x37')](_[_0x1807('0x5a')](_0x4a0b8b['query'],_0x30faeb[_0x1807('0x37')]));if(_0x4a0b8b[_0x1807('0x35')]['filter']){_0x17e8a2['where']=_['merge'](_0x17e8a2[_0x1807('0x40')],{'$or':_[_0x1807('0x30')](_0x17e8a2[_0x1807('0x3a')],function(_0x5d5525){var _0x384b5d={};_0x384b5d[_0x5d5525]={'$like':'%'+_0x4a0b8b[_0x1807('0x35')][_0x1807('0x41')]+'%'};return _0x384b5d;})});}_0x17e8a2=_[_0x1807('0x43')]({},_0x17e8a2,_0x4a0b8b[_0x1807('0x44')]);return _0x58208c[_0x1807('0x61')](_0x17e8a2);}})[_0x1807('0x28')](function(_0x260c16){if(_0x260c16){_0x539c1d=_0x260c16['length'];if(!_0x4a0b8b[_0x1807('0x35')][_0x1807('0x5c')]('nolimit')){_0x17e8a2['limit']=qs[_0x1807('0x20')](_0x4a0b8b[_0x1807('0x35')][_0x1807('0x20')]);_0x17e8a2[_0x1807('0x1f')]=qs['offset'](_0x4a0b8b[_0x1807('0x35')][_0x1807('0x1f')]);}return _0x58208c[_0x1807('0x61')](_0x17e8a2);}})[_0x1807('0x28')](function(_0x4c28de){if(_0x4c28de){return _0x4c28de?{'count':_0x539c1d,'rows':_0x4c28de}:null;}})['then'](respondWithResult(_0x367429,null))['catch'](handleError(_0x367429,null));}; \ No newline at end of file +var _0xa229=['offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','get','then','error','stack','name','send','map','Trigger','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','params','keys','find','create','body','user','role','Triggers','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','nolimit','getAnyConditions','findOne','hasOwnProperty','addAction','TriggerId','Action','getActions','eml-format','bluebird','util','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end'];(function(_0x281353,_0x5d53a9){var _0x4f4e7b=function(_0x43ade6){while(--_0x43ade6){_0x281353['push'](_0x281353['shift']());}};_0x4f4e7b(++_0x5d53a9);}(_0xa229,0x195));var _0x9a22=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa229[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9a22('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9a22('0x1'));var Mustache=require('mustache');var util=require(_0x9a22('0x2'));var path=require('path');var sox=require('sox');var csv=require(_0x9a22('0x3'));var ejs=require(_0x9a22('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9a22('0x5'));var crypto=require(_0x9a22('0x6'));var jsforce=require(_0x9a22('0x7'));var deskjs=require(_0x9a22('0x8'));var toCsv=require(_0x9a22('0x3'));var querystring=require('querystring');var Papa=require(_0x9a22('0x9'));var Redis=require('ioredis');var authService=require(_0x9a22('0xa'));var qs=require('../../components/parsers/qs');var as=require(_0x9a22('0xb'));var hardwareService=require(_0x9a22('0xc'));var logger=require('../../config/logger')(_0x9a22('0xd'));var utils=require(_0x9a22('0xe'));var config=require(_0x9a22('0xf'));var licenseUtil=require(_0x9a22('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4443d2,_0x304ecf){_0x304ecf=_0x304ecf||0xcc;return function(_0x15be05){if(_0x15be05){return _0x4443d2[_0x9a22('0x11')](_0x304ecf);}return _0x4443d2[_0x9a22('0x12')](_0x304ecf)[_0x9a22('0x13')]();};}function respondWithResult(_0x536ce8,_0x439e41){_0x439e41=_0x439e41||0xc8;return function(_0x19e0fb){if(_0x19e0fb){return _0x536ce8[_0x9a22('0x12')](_0x439e41)['json'](_0x19e0fb);}};}function respondWithFilteredResult(_0x33ed28,_0x4e5b52){return function(_0x38685f){if(_0x38685f){var _0x4cba52=typeof _0x4e5b52[_0x9a22('0x14')]===_0x9a22('0x15')&&typeof _0x4e5b52[_0x9a22('0x16')]==='undefined';var _0x239615=_0x38685f[_0x9a22('0x17')];var _0x4fbc2c=_0x4cba52?0x0:_0x4e5b52[_0x9a22('0x14')];var _0x4fcdf4=_0x4cba52?_0x38685f[_0x9a22('0x17')]:_0x4e5b52[_0x9a22('0x14')]+_0x4e5b52['limit'];var _0x216126;if(_0x4fcdf4>=_0x239615){_0x4fcdf4=_0x239615;_0x216126=0xc8;}else{_0x216126=0xce;}_0x33ed28['status'](_0x216126);return _0x33ed28[_0x9a22('0x18')](_0x9a22('0x19'),_0x4fbc2c+'-'+_0x4fcdf4+'/'+_0x239615)[_0x9a22('0x1a')](_0x38685f);}return null;};}function patchUpdates(_0xcb81c2){return function(_0x103fd6){try{jsonpatch[_0x9a22('0x1b')](_0x103fd6,_0xcb81c2,!![]);}catch(_0x2f7a85){return BPromise[_0x9a22('0x1c')](_0x2f7a85);}return _0x103fd6['save']();};}function saveUpdates(_0x442d91,_0x274d77){return function(_0x5958a3){if(_0x5958a3){return _0x5958a3[_0x9a22('0x1d')](_0x442d91)['then'](function(_0x443882){return _0x443882;});}return null;};}function removeEntity(_0x42a091,_0x2ca4dc){return function(_0x49fb88){if(_0x49fb88){return _0x49fb88[_0x9a22('0x1e')]()['then'](function(){var _0x191b70=_0x49fb88[_0x9a22('0x1f')]({'plain':!![]});var _0x44efe='Triggers';return db['UserProfileResource'][_0x9a22('0x1e')]({'where':{'type':_0x44efe,'resourceId':_0x191b70['id']}})['then'](function(){return _0x49fb88;});})[_0x9a22('0x20')](function(){_0x42a091[_0x9a22('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d59e5,_0x21e458){return function(_0x39b095){if(!_0x39b095){_0x3d59e5[_0x9a22('0x11')](0x194);}return _0x39b095;};}function handleError(_0xb437a5,_0x5b8051){_0x5b8051=_0x5b8051||0x1f4;return function(_0x5202b9){logger[_0x9a22('0x21')](_0x5202b9[_0x9a22('0x22')]);if(_0x5202b9[_0x9a22('0x23')]){delete _0x5202b9[_0x9a22('0x23')];}_0xb437a5[_0x9a22('0x12')](_0x5b8051)[_0x9a22('0x24')](_0x5202b9);};}exports['index']=function(_0x59ccba,_0x2d3414){var _0x26b4bc={},_0xcf9010={},_0x4ff64c={'count':0x0,'rows':[]};var _0x3b1379=_[_0x9a22('0x25')](db[_0x9a22('0x26')][_0x9a22('0x27')],function(_0x35fdac){return{'name':_0x35fdac['fieldName'],'type':_0x35fdac[_0x9a22('0x28')]['key']};});_0xcf9010[_0x9a22('0x29')]=_['map'](_0x3b1379,_0x9a22('0x23'));_0xcf9010[_0x9a22('0x2a')]=_['keys'](_0x59ccba[_0x9a22('0x2a')]);_0xcf9010[_0x9a22('0x2b')]=_[_0x9a22('0x2c')](_0xcf9010['model'],_0xcf9010['query']);_0x26b4bc['attributes']=_['intersection'](_0xcf9010[_0x9a22('0x29')],qs['fields'](_0x59ccba[_0x9a22('0x2a')][_0x9a22('0x2d')]));_0x26b4bc['attributes']=_0x26b4bc[_0x9a22('0x2e')][_0x9a22('0x2f')]?_0x26b4bc[_0x9a22('0x2e')]:_0xcf9010[_0x9a22('0x29')];if(!_0x59ccba[_0x9a22('0x2a')]['hasOwnProperty']('nolimit')){_0x26b4bc[_0x9a22('0x16')]=qs[_0x9a22('0x16')](_0x59ccba[_0x9a22('0x2a')][_0x9a22('0x16')]);_0x26b4bc['offset']=qs[_0x9a22('0x14')](_0x59ccba[_0x9a22('0x2a')][_0x9a22('0x14')]);}_0x26b4bc[_0x9a22('0x30')]=qs[_0x9a22('0x31')](_0x59ccba['query'][_0x9a22('0x31')]);_0x26b4bc[_0x9a22('0x32')]=qs['filters'](_[_0x9a22('0x33')](_0x59ccba[_0x9a22('0x2a')],_0xcf9010['filters']),_0x3b1379);if(_0x59ccba['query']['filter']){_0x26b4bc[_0x9a22('0x32')]=_['merge'](_0x26b4bc[_0x9a22('0x32')],{'$or':_['map'](_0x3b1379,function(_0x179dcb){if(_0x179dcb[_0x9a22('0x28')]!==_0x9a22('0x34')){var _0x5e53bb={};_0x5e53bb[_0x179dcb['name']]={'$like':'%'+_0x59ccba[_0x9a22('0x2a')][_0x9a22('0x35')]+'%'};return _0x5e53bb;}})});}_0x26b4bc=_[_0x9a22('0x36')]({},_0x26b4bc,_0x59ccba[_0x9a22('0x37')]);var _0x24ff86={'where':_0x26b4bc[_0x9a22('0x32')]};return db['Trigger'][_0x9a22('0x17')](_0x24ff86)[_0x9a22('0x20')](function(_0x3f73ce){_0x4ff64c[_0x9a22('0x17')]=_0x3f73ce;if(_0x59ccba[_0x9a22('0x2a')][_0x9a22('0x38')]){_0x26b4bc[_0x9a22('0x39')]=[{'all':!![]}];}return db['Trigger']['findAll'](_0x26b4bc);})[_0x9a22('0x20')](function(_0x2d65bb){_0x4ff64c[_0x9a22('0x3a')]=_0x2d65bb;return _0x4ff64c;})[_0x9a22('0x20')](respondWithFilteredResult(_0x2d3414,_0x26b4bc))[_0x9a22('0x3b')](handleError(_0x2d3414,null));};exports['show']=function(_0x5521a2,_0x1447d4){var _0x354a3f={'raw':![],'where':{'id':_0x5521a2[_0x9a22('0x3c')]['id']}},_0x1bfa93={};_0x1bfa93[_0x9a22('0x29')]=_[_0x9a22('0x3d')](db[_0x9a22('0x26')][_0x9a22('0x27')]);_0x1bfa93[_0x9a22('0x2a')]=_['keys'](_0x5521a2['query']);_0x1bfa93['filters']=_[_0x9a22('0x2c')](_0x1bfa93[_0x9a22('0x29')],_0x1bfa93[_0x9a22('0x2a')]);_0x354a3f[_0x9a22('0x2e')]=_['intersection'](_0x1bfa93['model'],qs[_0x9a22('0x2d')](_0x5521a2['query'][_0x9a22('0x2d')]));_0x354a3f['attributes']=_0x354a3f['attributes'][_0x9a22('0x2f')]?_0x354a3f[_0x9a22('0x2e')]:_0x1bfa93['model'];if(_0x5521a2[_0x9a22('0x2a')]['includeAll']){_0x354a3f[_0x9a22('0x39')]=[{'all':!![]}];}_0x354a3f=_[_0x9a22('0x36')]({},_0x354a3f,_0x5521a2[_0x9a22('0x37')]);return db[_0x9a22('0x26')][_0x9a22('0x3e')](_0x354a3f)[_0x9a22('0x20')](handleEntityNotFound(_0x1447d4,null))['then'](respondWithResult(_0x1447d4,null))['catch'](handleError(_0x1447d4,null));};exports[_0x9a22('0x3f')]=function(_0x71851e,_0x53df5a){return db[_0x9a22('0x26')]['create'](_0x71851e[_0x9a22('0x40')],{})['then'](function(_0x549a91){var _0x51e4c9=_0x71851e[_0x9a22('0x41')][_0x9a22('0x1f')]({'plain':!![]});if(!_0x51e4c9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x51e4c9[_0x9a22('0x42')]===_0x9a22('0x41')){var _0xd67303=_0x549a91[_0x9a22('0x1f')]({'plain':!![]});var _0x5caeec=_0x9a22('0x43');return db[_0x9a22('0x44')]['find']({'where':{'name':_0x5caeec,'userProfileId':_0x51e4c9[_0x9a22('0x45')]},'raw':!![]})['then'](function(_0x33c467){if(_0x33c467&&_0x33c467[_0x9a22('0x46')]===0x0){return db['UserProfileResource'][_0x9a22('0x3f')]({'name':_0xd67303[_0x9a22('0x23')],'resourceId':_0xd67303['id'],'type':_0x33c467['name'],'sectionId':_0x33c467['id']},{})[_0x9a22('0x20')](function(){return _0x549a91;});}else{return _0x549a91;}})[_0x9a22('0x3b')](function(_0x1e79b2){logger[_0x9a22('0x21')](_0x9a22('0x47'),_0x1e79b2);throw _0x1e79b2;});}return _0x549a91;})['then'](respondWithResult(_0x53df5a,0xc9))[_0x9a22('0x3b')](handleError(_0x53df5a,null));};exports['update']=function(_0x2deadb,_0x4cf3e9){if(_0x2deadb[_0x9a22('0x40')]['id']){delete _0x2deadb[_0x9a22('0x40')]['id'];}return db[_0x9a22('0x26')]['find']({'where':{'id':_0x2deadb['params']['id']}})['then'](handleEntityNotFound(_0x4cf3e9,null))[_0x9a22('0x20')](saveUpdates(_0x2deadb[_0x9a22('0x40')],null))['then'](respondWithResult(_0x4cf3e9,null))[_0x9a22('0x3b')](handleError(_0x4cf3e9,null));};exports[_0x9a22('0x1e')]=function(_0x223ecf,_0x489972){return db[_0x9a22('0x26')]['find']({'where':{'id':_0x223ecf[_0x9a22('0x3c')]['id']}})[_0x9a22('0x20')](handleEntityNotFound(_0x489972,null))[_0x9a22('0x20')](removeEntity(_0x489972,null))['catch'](handleError(_0x489972,null));};exports[_0x9a22('0x48')]=function(_0x2501dc,_0x10b7da,_0x3dfce1){if(_0x2501dc[_0x9a22('0x40')]['id']){delete _0x2501dc['body']['id'];}return db[_0x9a22('0x26')][_0x9a22('0x3e')]({'where':{'id':_0x2501dc[_0x9a22('0x3c')]['id']}})[_0x9a22('0x20')](handleEntityNotFound(_0x10b7da,null))[_0x9a22('0x20')](function(_0x40a0cb){if(_0x40a0cb){_0x2501dc['body'][_0x9a22('0x49')]=_0x40a0cb['id'];return db[_0x9a22('0x4a')][_0x9a22('0x3f')](_0x2501dc[_0x9a22('0x40')]);}})[_0x9a22('0x20')](respondWithResult(_0x10b7da,null))['catch'](handleError(_0x10b7da,null));};exports[_0x9a22('0x4b')]=function(_0x2c677f,_0x2bb46e,_0x2805f2){if(_0x2c677f[_0x9a22('0x40')]['id']){delete _0x2c677f[_0x9a22('0x40')]['id'];}return db[_0x9a22('0x26')]['find']({'where':{'id':_0x2c677f['params']['id']}})[_0x9a22('0x20')](handleEntityNotFound(_0x2bb46e,null))[_0x9a22('0x20')](function(_0x203837){if(_0x203837){_0x2c677f['body']['TriggerAnyId']=_0x203837['id'];return db[_0x9a22('0x4a')][_0x9a22('0x3f')](_0x2c677f[_0x9a22('0x40')]);}})[_0x9a22('0x20')](respondWithResult(_0x2bb46e,null))[_0x9a22('0x3b')](handleError(_0x2bb46e,null));};exports[_0x9a22('0x4c')]=function(_0x569aa7,_0x12bea9,_0x46db7a){var _0x33434e={};var _0x4e77a0={};var _0x3d2867;var _0x1cdc5e;return db[_0x9a22('0x26')]['findOne']({'where':{'id':_0x569aa7[_0x9a22('0x3c')]['id']}})[_0x9a22('0x20')](handleEntityNotFound(_0x12bea9,null))[_0x9a22('0x20')](function(_0x36ca38){if(_0x36ca38){_0x3d2867=_0x36ca38;_0x4e77a0['model']=_['keys'](db['Condition'][_0x9a22('0x27')]);_0x4e77a0['query']=_['keys'](_0x569aa7[_0x9a22('0x2a')]);_0x4e77a0[_0x9a22('0x2b')]=_[_0x9a22('0x2c')](_0x4e77a0[_0x9a22('0x29')],_0x4e77a0[_0x9a22('0x2a')]);_0x33434e['attributes']=_[_0x9a22('0x2c')](_0x4e77a0[_0x9a22('0x29')],qs[_0x9a22('0x2d')](_0x569aa7['query'][_0x9a22('0x2d')]));_0x33434e[_0x9a22('0x2e')]=_0x33434e['attributes'][_0x9a22('0x2f')]?_0x33434e[_0x9a22('0x2e')]:_0x4e77a0[_0x9a22('0x29')];_0x33434e[_0x9a22('0x30')]=qs[_0x9a22('0x31')](_0x569aa7[_0x9a22('0x2a')][_0x9a22('0x31')]);_0x33434e[_0x9a22('0x32')]=qs['filters'](_[_0x9a22('0x33')](_0x569aa7['query'],_0x4e77a0[_0x9a22('0x2b')]));if(_0x569aa7['query'][_0x9a22('0x35')]){_0x33434e[_0x9a22('0x32')]=_['merge'](_0x33434e[_0x9a22('0x32')],{'$or':_[_0x9a22('0x25')](_0x33434e[_0x9a22('0x2e')],function(_0x13ecab){var _0x19b9b6={};_0x19b9b6[_0x13ecab]={'$like':'%'+_0x569aa7[_0x9a22('0x2a')]['filter']+'%'};return _0x19b9b6;})});}_0x33434e=_[_0x9a22('0x36')]({},_0x33434e,_0x569aa7['options']);return _0x3d2867['getAllConditions'](_0x33434e);}})[_0x9a22('0x20')](function(_0x3bfac6){if(_0x3bfac6){_0x1cdc5e=_0x3bfac6[_0x9a22('0x2f')];if(!_0x569aa7[_0x9a22('0x2a')]['hasOwnProperty'](_0x9a22('0x4d'))){_0x33434e['limit']=qs['limit'](_0x569aa7['query'][_0x9a22('0x16')]);_0x33434e['offset']=qs[_0x9a22('0x14')](_0x569aa7[_0x9a22('0x2a')][_0x9a22('0x14')]);}return _0x3d2867[_0x9a22('0x4c')](_0x33434e);}})[_0x9a22('0x20')](function(_0x533c56){if(_0x533c56){return _0x533c56?{'count':_0x1cdc5e,'rows':_0x533c56}:null;}})[_0x9a22('0x20')](respondWithResult(_0x12bea9,null))[_0x9a22('0x3b')](handleError(_0x12bea9,null));};exports[_0x9a22('0x4e')]=function(_0x4b1793,_0xca3a70,_0x14254d){var _0x4064a4={};var _0x458ace={};var _0x11abc6;var _0x180bad;return db[_0x9a22('0x26')][_0x9a22('0x4f')]({'where':{'id':_0x4b1793['params']['id']}})[_0x9a22('0x20')](handleEntityNotFound(_0xca3a70,null))[_0x9a22('0x20')](function(_0x3e40ec){if(_0x3e40ec){_0x11abc6=_0x3e40ec;_0x458ace['model']=_[_0x9a22('0x3d')](db['Condition']['rawAttributes']);_0x458ace[_0x9a22('0x2a')]=_[_0x9a22('0x3d')](_0x4b1793['query']);_0x458ace['filters']=_[_0x9a22('0x2c')](_0x458ace[_0x9a22('0x29')],_0x458ace[_0x9a22('0x2a')]);_0x4064a4[_0x9a22('0x2e')]=_[_0x9a22('0x2c')](_0x458ace[_0x9a22('0x29')],qs[_0x9a22('0x2d')](_0x4b1793[_0x9a22('0x2a')][_0x9a22('0x2d')]));_0x4064a4[_0x9a22('0x2e')]=_0x4064a4[_0x9a22('0x2e')]['length']?_0x4064a4[_0x9a22('0x2e')]:_0x458ace['model'];_0x4064a4[_0x9a22('0x30')]=qs[_0x9a22('0x31')](_0x4b1793[_0x9a22('0x2a')][_0x9a22('0x31')]);_0x4064a4[_0x9a22('0x32')]=qs[_0x9a22('0x2b')](_[_0x9a22('0x33')](_0x4b1793['query'],_0x458ace[_0x9a22('0x2b')]));if(_0x4b1793[_0x9a22('0x2a')][_0x9a22('0x35')]){_0x4064a4['where']=_[_0x9a22('0x36')](_0x4064a4[_0x9a22('0x32')],{'$or':_[_0x9a22('0x25')](_0x4064a4['attributes'],function(_0x5150b4){var _0x1635f3={};_0x1635f3[_0x5150b4]={'$like':'%'+_0x4b1793[_0x9a22('0x2a')][_0x9a22('0x35')]+'%'};return _0x1635f3;})});}_0x4064a4=_[_0x9a22('0x36')]({},_0x4064a4,_0x4b1793[_0x9a22('0x37')]);return _0x11abc6[_0x9a22('0x4e')](_0x4064a4);}})[_0x9a22('0x20')](function(_0x4a26a0){if(_0x4a26a0){_0x180bad=_0x4a26a0[_0x9a22('0x2f')];if(!_0x4b1793[_0x9a22('0x2a')][_0x9a22('0x50')](_0x9a22('0x4d'))){_0x4064a4[_0x9a22('0x16')]=qs[_0x9a22('0x16')](_0x4b1793['query'][_0x9a22('0x16')]);_0x4064a4[_0x9a22('0x14')]=qs[_0x9a22('0x14')](_0x4b1793[_0x9a22('0x2a')][_0x9a22('0x14')]);}return _0x11abc6[_0x9a22('0x4e')](_0x4064a4);}})[_0x9a22('0x20')](function(_0x2219ab){if(_0x2219ab){return _0x2219ab?{'count':_0x180bad,'rows':_0x2219ab}:null;}})['then'](respondWithResult(_0xca3a70,null))[_0x9a22('0x3b')](handleError(_0xca3a70,null));};exports[_0x9a22('0x51')]=function(_0x3b355d,_0x1b24af,_0x933558){if(_0x3b355d[_0x9a22('0x40')]['id']){delete _0x3b355d[_0x9a22('0x40')]['id'];}return db[_0x9a22('0x26')][_0x9a22('0x3e')]({'where':{'id':_0x3b355d['params']['id']}})[_0x9a22('0x20')](handleEntityNotFound(_0x1b24af,null))['then'](function(_0x19f6ee){if(_0x19f6ee){_0x3b355d[_0x9a22('0x40')][_0x9a22('0x52')]=_0x19f6ee['id'];return db[_0x9a22('0x53')]['create'](_0x3b355d['body']);}})['then'](respondWithResult(_0x1b24af,null))[_0x9a22('0x3b')](handleError(_0x1b24af,null));};exports['getActions']=function(_0x44d601,_0x50c1e2,_0x578e06){var _0x23eaf9={};var _0x53f42f={};var _0x12790b;var _0x371600;return db[_0x9a22('0x26')][_0x9a22('0x4f')]({'where':{'id':_0x44d601[_0x9a22('0x3c')]['id']}})[_0x9a22('0x20')](handleEntityNotFound(_0x50c1e2,null))[_0x9a22('0x20')](function(_0x255c4e){if(_0x255c4e){_0x12790b=_0x255c4e;_0x53f42f[_0x9a22('0x29')]=_[_0x9a22('0x3d')](db[_0x9a22('0x53')][_0x9a22('0x27')]);_0x53f42f['query']=_['keys'](_0x44d601[_0x9a22('0x2a')]);_0x53f42f[_0x9a22('0x2b')]=_[_0x9a22('0x2c')](_0x53f42f['model'],_0x53f42f[_0x9a22('0x2a')]);_0x23eaf9[_0x9a22('0x2e')]=_[_0x9a22('0x2c')](_0x53f42f[_0x9a22('0x29')],qs['fields'](_0x44d601[_0x9a22('0x2a')][_0x9a22('0x2d')]));_0x23eaf9['attributes']=_0x23eaf9[_0x9a22('0x2e')][_0x9a22('0x2f')]?_0x23eaf9[_0x9a22('0x2e')]:_0x53f42f[_0x9a22('0x29')];_0x23eaf9[_0x9a22('0x30')]=qs[_0x9a22('0x31')](_0x44d601[_0x9a22('0x2a')][_0x9a22('0x31')]);_0x23eaf9[_0x9a22('0x32')]=qs[_0x9a22('0x2b')](_[_0x9a22('0x33')](_0x44d601['query'],_0x53f42f['filters']));if(_0x44d601[_0x9a22('0x2a')][_0x9a22('0x35')]){_0x23eaf9['where']=_[_0x9a22('0x36')](_0x23eaf9['where'],{'$or':_[_0x9a22('0x25')](_0x23eaf9[_0x9a22('0x2e')],function(_0x4c0860){var _0x487bfe={};_0x487bfe[_0x4c0860]={'$like':'%'+_0x44d601[_0x9a22('0x2a')][_0x9a22('0x35')]+'%'};return _0x487bfe;})});}_0x23eaf9=_['merge']({},_0x23eaf9,_0x44d601[_0x9a22('0x37')]);return _0x12790b[_0x9a22('0x54')](_0x23eaf9);}})[_0x9a22('0x20')](function(_0x43d00f){if(_0x43d00f){_0x371600=_0x43d00f[_0x9a22('0x2f')];if(!_0x44d601[_0x9a22('0x2a')][_0x9a22('0x50')](_0x9a22('0x4d'))){_0x23eaf9[_0x9a22('0x16')]=qs[_0x9a22('0x16')](_0x44d601['query'][_0x9a22('0x16')]);_0x23eaf9[_0x9a22('0x14')]=qs[_0x9a22('0x14')](_0x44d601[_0x9a22('0x2a')][_0x9a22('0x14')]);}return _0x12790b['getActions'](_0x23eaf9);}})['then'](function(_0x516079){if(_0x516079){return _0x516079?{'count':_0x371600,'rows':_0x516079}:null;}})[_0x9a22('0x20')](respondWithResult(_0x50c1e2,null))[_0x9a22('0x3b')](handleError(_0x50c1e2,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 4657d04..346c1a8 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 _0x15cb=['exports','define','Trigger','tools_triggers','util','api','bluebird','request-promise','path','rimraf','./trigger.attributes'];(function(_0x4bde3e,_0x5e222b){var _0x5a0e8d=function(_0x48de3f){while(--_0x48de3f){_0x4bde3e['push'](_0x4bde3e['shift']());}};_0x5a0e8d(++_0x5e222b);}(_0x15cb,0x16f));var _0xb15c=function(_0x5eb9a1,_0x3dcf64){_0x5eb9a1=_0x5eb9a1-0x0;var _0x5a2f8d=_0x15cb[_0x5eb9a1];return _0x5a2f8d;};'use strict';var _=require('lodash');var util=require(_0xb15c('0x0'));var logger=require('../../config/logger')(_0xb15c('0x1'));var moment=require('moment');var BPromise=require(_0xb15c('0x2'));var rp=require(_0xb15c('0x3'));var fs=require('fs');var path=require(_0xb15c('0x4'));var rimraf=require(_0xb15c('0x5'));var config=require('../../config/environment');var attributes=require(_0xb15c('0x6'));module[_0xb15c('0x7')]=function(_0x50ea76,_0x5a1b40){return _0x50ea76[_0xb15c('0x8')](_0xb15c('0x9'),attributes,{'tableName':_0xb15c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12cc=['bluebird','rimraf','../../config/environment','define','Trigger','util','../../config/logger','api','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x12cc,0xc2));var _0xc12c=function(_0x408285,_0x46418f){_0x408285=_0x408285-0x0;var _0x4eeab4=_0x12cc[_0x408285];return _0x4eeab4;};'use strict';var _=require('lodash');var util=require(_0xc12c('0x0'));var logger=require(_0xc12c('0x1'))(_0xc12c('0x2'));var moment=require(_0xc12c('0x3'));var BPromise=require(_0xc12c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc12c('0x5'));var config=require(_0xc12c('0x6'));var attributes=require('./trigger.attributes');module['exports']=function(_0x4990f4,_0x152fcd){return _0x4990f4[_0xc12c('0x7')](_0xc12c('0x8'),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 f6d54d8..2f7f92b 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 _0xa9c2=['request','info','request\x20sent','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','findAll','options','raw','where','attributes','map','include','model','then','ShowTrigger','Trigger','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http'];(function(_0x3b1e3d,_0x521157){var _0xc5e0a=function(_0x3348fe){while(--_0x3348fe){_0x3b1e3d['push'](_0x3b1e3d['shift']());}};_0xc5e0a(++_0x521157);}(_0xa9c2,0x1d6));var _0x2a9c=function(_0xd7556a,_0x14d7a1){_0xd7556a=_0xd7556a-0x0;var _0x34e5a5=_0xa9c2[_0xd7556a];return _0x34e5a5;};'use strict';var _=require(_0x2a9c('0x0'));var util=require(_0x2a9c('0x1'));var moment=require(_0x2a9c('0x2'));var BPromise=require('bluebird');var rs=require(_0x2a9c('0x3'));var fs=require('fs');var Redis=require(_0x2a9c('0x4'));var db=require(_0x2a9c('0x5'))['db'];var utils=require(_0x2a9c('0x6'));var logger=require('../../config/logger')(_0x2a9c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2a9c('0x8')][_0x2a9c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31b289,_0x42d5b0,_0x26a2c7){return new BPromise(function(_0x1b07d1,_0x25d12d){return client[_0x2a9c('0xa')](_0x31b289,_0x26a2c7)['then'](function(_0x4c3f54){logger[_0x2a9c('0xb')]('Trigger,\x20%s,\x20%s',_0x42d5b0,_0x2a9c('0xc'));logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0x42d5b0,_0x2a9c('0xc'),JSON[_0x2a9c('0xd')](_0x4c3f54));if(_0x4c3f54[_0x2a9c('0xe')]){if(_0x4c3f54['error'][_0x2a9c('0xf')]===0x1f4){logger[_0x2a9c('0xe')](_0x2a9c('0x10'),_0x42d5b0,_0x4c3f54[_0x2a9c('0xe')][_0x2a9c('0x11')]);return _0x25d12d(_0x4c3f54[_0x2a9c('0xe')][_0x2a9c('0x11')]);}logger['error'](_0x2a9c('0x10'),_0x42d5b0,_0x4c3f54[_0x2a9c('0xe')][_0x2a9c('0x11')]);return _0x1b07d1(_0x4c3f54['error']['message']);}else{logger['info'](_0x2a9c('0x10'),_0x42d5b0,'request\x20sent');_0x1b07d1(_0x4c3f54[_0x2a9c('0x12')][_0x2a9c('0x11')]);}})[_0x2a9c('0x13')](function(_0x3e68de){logger[_0x2a9c('0xe')]('Trigger,\x20%s,\x20%s',_0x42d5b0,_0x3e68de);_0x25d12d(_0x3e68de);});});}exports[_0x2a9c('0x14')]=function(_0x151486){var _0x16acd7=this;return new Promise(function(_0xccd4cc,_0x3a4639){return db['Trigger'][_0x2a9c('0x15')]({'raw':_0x151486[_0x2a9c('0x16')]?_0x151486['options'][_0x2a9c('0x17')]===undefined?!![]:![]:!![],'where':_0x151486[_0x2a9c('0x16')]?_0x151486[_0x2a9c('0x16')][_0x2a9c('0x18')]||null:null,'attributes':_0x151486['options']?_0x151486['options'][_0x2a9c('0x19')]||null:null,'limit':_0x151486['options']?_0x151486[_0x2a9c('0x16')]['limit']||null:null,'include':_0x151486[_0x2a9c('0x16')]?_0x151486['options']['include']?_[_0x2a9c('0x1a')](_0x151486[_0x2a9c('0x16')][_0x2a9c('0x1b')],function(_0x392a69){return{'model':db[_0x392a69[_0x2a9c('0x1c')]],'as':_0x392a69['as'],'attributes':_0x392a69[_0x2a9c('0x19')],'include':_0x392a69['include']?_['map'](_0x392a69[_0x2a9c('0x1b')],function(_0x3cb057){return{'model':db[_0x3cb057[_0x2a9c('0x1c')]],'as':_0x3cb057['as'],'attributes':_0x3cb057[_0x2a9c('0x19')],'include':_0x3cb057[_0x2a9c('0x1b')]?_[_0x2a9c('0x1a')](_0x3cb057[_0x2a9c('0x1b')],function(_0x4b0963){return{'model':db[_0x4b0963['model']],'as':_0x4b0963['as'],'attributes':_0x4b0963[_0x2a9c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2a9c('0x1d')](function(_0x5a7079){logger['info']('GetTrigger',_0x151486);logger['debug'](_0x2a9c('0x14'),_0x151486,JSON[_0x2a9c('0xd')](_0x5a7079));_0xccd4cc(_0x5a7079);})['catch'](function(_0xe69a9a){logger['error'](_0x2a9c('0x14'),_0xe69a9a[_0x2a9c('0x11')],_0x151486);_0x3a4639(_0x16acd7[_0x2a9c('0xe')](0x1f4,_0xe69a9a[_0x2a9c('0x11')]));});});};exports[_0x2a9c('0x1e')]=function(_0x46f811){var _0x3c9f4b=this;return new Promise(function(_0x24a551,_0x21aad4){return db[_0x2a9c('0x1f')]['find']({'raw':_0x46f811[_0x2a9c('0x16')]?_0x46f811['options'][_0x2a9c('0x17')]===undefined?!![]:![]:!![],'where':_0x46f811['options']?_0x46f811[_0x2a9c('0x16')][_0x2a9c('0x18')]||null:null,'attributes':_0x46f811[_0x2a9c('0x16')]?_0x46f811[_0x2a9c('0x16')]['attributes']||null:null,'include':_0x46f811[_0x2a9c('0x16')]?_0x46f811[_0x2a9c('0x16')]['include']?_[_0x2a9c('0x1a')](_0x46f811['options'][_0x2a9c('0x1b')],function(_0x4eff19){return{'model':db[_0x4eff19[_0x2a9c('0x1c')]],'as':_0x4eff19['as'],'attributes':_0x4eff19[_0x2a9c('0x19')],'include':_0x4eff19['include']?_['map'](_0x4eff19[_0x2a9c('0x1b')],function(_0x44eeaf){return{'model':db[_0x44eeaf[_0x2a9c('0x1c')]],'as':_0x44eeaf['as'],'attributes':_0x44eeaf['attributes'],'include':_0x44eeaf['include']?_['map'](_0x44eeaf[_0x2a9c('0x1b')],function(_0x264ee0){return{'model':db[_0x264ee0[_0x2a9c('0x1c')]],'as':_0x264ee0['as'],'attributes':_0x264ee0['attributes']};}):[]};}):[]};}):[]:[]})[_0x2a9c('0x1d')](function(_0x1476e3){logger[_0x2a9c('0xb')](_0x2a9c('0x1e'),_0x46f811);logger['debug'](_0x2a9c('0x1e'),_0x46f811,JSON[_0x2a9c('0xd')](_0x1476e3));_0x24a551(_0x1476e3);})['catch'](function(_0x21635d){logger['error'](_0x2a9c('0x1e'),_0x21635d[_0x2a9c('0x11')],_0x46f811);_0x21aad4(_0x3c9f4b['error'](0x1f4,_0x21635d[_0x2a9c('0x11')]));});});}; \ No newline at end of file +var _0x00b3=['options','raw','where','limit','include','map','model','attributes','ShowTrigger','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','request\x20sent','result','catch','GetTrigger','Trigger','findAll'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x00b3,0x157));var _0x300b=function(_0x535743,_0x31c49e){_0x535743=_0x535743-0x0;var _0x300f1b=_0x00b3[_0x535743];return _0x300f1b;};'use strict';var _=require(_0x300b('0x0'));var util=require(_0x300b('0x1'));var moment=require(_0x300b('0x2'));var BPromise=require(_0x300b('0x3'));var rs=require(_0x300b('0x4'));var fs=require('fs');var Redis=require(_0x300b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x300b('0x6'));var logger=require(_0x300b('0x7'))('rpc');var config=require(_0x300b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x300b('0x9')][_0x300b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2533d3,_0x2caa7c,_0x291829){return new BPromise(function(_0x5501f7,_0x3aa555){return client[_0x300b('0xb')](_0x2533d3,_0x291829)[_0x300b('0xc')](function(_0xe6e730){logger[_0x300b('0xd')]('Trigger,\x20%s,\x20%s',_0x2caa7c,'request\x20sent');logger[_0x300b('0xe')](_0x300b('0xf'),_0x2caa7c,'request\x20sent',JSON[_0x300b('0x10')](_0xe6e730));if(_0xe6e730[_0x300b('0x11')]){if(_0xe6e730['error'][_0x300b('0x12')]===0x1f4){logger[_0x300b('0x11')](_0x300b('0x13'),_0x2caa7c,_0xe6e730[_0x300b('0x11')][_0x300b('0x14')]);return _0x3aa555(_0xe6e730[_0x300b('0x11')][_0x300b('0x14')]);}logger[_0x300b('0x11')](_0x300b('0x13'),_0x2caa7c,_0xe6e730['error']['message']);return _0x5501f7(_0xe6e730[_0x300b('0x11')][_0x300b('0x14')]);}else{logger['info']('Trigger,\x20%s,\x20%s',_0x2caa7c,_0x300b('0x15'));_0x5501f7(_0xe6e730[_0x300b('0x16')][_0x300b('0x14')]);}})[_0x300b('0x17')](function(_0x438bf4){logger[_0x300b('0x11')](_0x300b('0x13'),_0x2caa7c,_0x438bf4);_0x3aa555(_0x438bf4);});});}exports[_0x300b('0x18')]=function(_0x5be041){var _0x3909a3=this;return new Promise(function(_0x3860ab,_0x1a0224){return db[_0x300b('0x19')][_0x300b('0x1a')]({'raw':_0x5be041[_0x300b('0x1b')]?_0x5be041['options'][_0x300b('0x1c')]===undefined?!![]:![]:!![],'where':_0x5be041['options']?_0x5be041[_0x300b('0x1b')][_0x300b('0x1d')]||null:null,'attributes':_0x5be041['options']?_0x5be041[_0x300b('0x1b')]['attributes']||null:null,'limit':_0x5be041[_0x300b('0x1b')]?_0x5be041['options'][_0x300b('0x1e')]||null:null,'include':_0x5be041[_0x300b('0x1b')]?_0x5be041['options'][_0x300b('0x1f')]?_[_0x300b('0x20')](_0x5be041['options'][_0x300b('0x1f')],function(_0x516c25){return{'model':db[_0x516c25[_0x300b('0x21')]],'as':_0x516c25['as'],'attributes':_0x516c25[_0x300b('0x22')],'include':_0x516c25[_0x300b('0x1f')]?_[_0x300b('0x20')](_0x516c25[_0x300b('0x1f')],function(_0x29ba9e){return{'model':db[_0x29ba9e[_0x300b('0x21')]],'as':_0x29ba9e['as'],'attributes':_0x29ba9e['attributes'],'include':_0x29ba9e[_0x300b('0x1f')]?_[_0x300b('0x20')](_0x29ba9e['include'],function(_0x42913a){return{'model':db[_0x42913a['model']],'as':_0x42913a['as'],'attributes':_0x42913a[_0x300b('0x22')]};}):[]};}):[]};}):[]:[]})[_0x300b('0xc')](function(_0x3b4b5b){logger[_0x300b('0xd')](_0x300b('0x18'),_0x5be041);logger[_0x300b('0xe')](_0x300b('0x18'),_0x5be041,JSON['stringify'](_0x3b4b5b));_0x3860ab(_0x3b4b5b);})[_0x300b('0x17')](function(_0x395066){logger[_0x300b('0x11')](_0x300b('0x18'),_0x395066[_0x300b('0x14')],_0x5be041);_0x1a0224(_0x3909a3[_0x300b('0x11')](0x1f4,_0x395066['message']));});});};exports[_0x300b('0x23')]=function(_0x3c0d46){var _0x363261=this;return new Promise(function(_0x2390b5,_0x3e37a1){return db['Trigger'][_0x300b('0x24')]({'raw':_0x3c0d46[_0x300b('0x1b')]?_0x3c0d46[_0x300b('0x1b')][_0x300b('0x1c')]===undefined?!![]:![]:!![],'where':_0x3c0d46[_0x300b('0x1b')]?_0x3c0d46['options'][_0x300b('0x1d')]||null:null,'attributes':_0x3c0d46[_0x300b('0x1b')]?_0x3c0d46[_0x300b('0x1b')][_0x300b('0x22')]||null:null,'include':_0x3c0d46[_0x300b('0x1b')]?_0x3c0d46[_0x300b('0x1b')][_0x300b('0x1f')]?_['map'](_0x3c0d46['options'][_0x300b('0x1f')],function(_0x54978c){return{'model':db[_0x54978c[_0x300b('0x21')]],'as':_0x54978c['as'],'attributes':_0x54978c['attributes'],'include':_0x54978c['include']?_[_0x300b('0x20')](_0x54978c[_0x300b('0x1f')],function(_0x4c5832){return{'model':db[_0x4c5832[_0x300b('0x21')]],'as':_0x4c5832['as'],'attributes':_0x4c5832['attributes'],'include':_0x4c5832[_0x300b('0x1f')]?_[_0x300b('0x20')](_0x4c5832['include'],function(_0xc5a0af){return{'model':db[_0xc5a0af['model']],'as':_0xc5a0af['as'],'attributes':_0xc5a0af['attributes']};}):[]};}):[]};}):[]:[]})[_0x300b('0xc')](function(_0x4bd4e6){logger[_0x300b('0xd')](_0x300b('0x23'),_0x3c0d46);logger[_0x300b('0xe')](_0x300b('0x23'),_0x3c0d46,JSON[_0x300b('0x10')](_0x4bd4e6));_0x2390b5(_0x4bd4e6);})['catch'](function(_0x34b42e){logger['error'](_0x300b('0x23'),_0x34b42e['message'],_0x3c0d46);_0x3e37a1(_0x363261[_0x300b('0x11')](0x1f4,_0x34b42e[_0x300b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 10782cc..2f207b9 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 _0xa62c=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','/:id/clone','clone','create','put','update','destroy','exports','multer','util','path'];(function(_0x2ce1e2,_0x422716){var _0x29ea19=function(_0x2240f6){while(--_0x2240f6){_0x2ce1e2['push'](_0x2ce1e2['shift']());}};_0x29ea19(++_0x422716);}(_0xa62c,0xe4));var _0xca62=function(_0x52684f,_0xff73fc){_0x52684f=_0x52684f-0x0;var _0x4a55f0=_0xa62c[_0x52684f];return _0x4a55f0;};'use strict';var multer=require(_0xca62('0x0'));var util=require(_0xca62('0x1'));var path=require(_0xca62('0x2'));var timeout=require('connect-timeout');var express=require(_0xca62('0x3'));var router=express[_0xca62('0x4')]();var fs_extra=require(_0xca62('0x5'));var auth=require(_0xca62('0x6'));var interaction=require(_0xca62('0x7'));var config=require(_0xca62('0x8'));var controller=require('./trunk.controller');router[_0xca62('0x9')]('/',auth[_0xca62('0xa')](),controller[_0xca62('0xb')]);router[_0xca62('0x9')](_0xca62('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xca62('0xd')](_0xca62('0xe'),auth[_0xca62('0xa')](),controller[_0xca62('0xf')]);router[_0xca62('0xd')]('/',auth[_0xca62('0xa')](),controller[_0xca62('0x10')]);router[_0xca62('0x11')](_0xca62('0xc'),auth[_0xca62('0xa')](),controller[_0xca62('0x12')]);router['delete'](_0xca62('0xc'),auth[_0xca62('0xa')](),controller[_0xca62('0x13')]);module[_0xca62('0x14')]=router; \ No newline at end of file +var _0xc142=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','/:id/clone','clone','post','create','put','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x467dfc,_0x3fb370){var _0x159d9b=function(_0x1c09b8){while(--_0x1c09b8){_0x467dfc['push'](_0x467dfc['shift']());}};_0x159d9b(++_0x3fb370);}(_0xc142,0x6b));var _0x2c14=function(_0x547456,_0x1de17e){_0x547456=_0x547456-0x0;var _0xc1fd7b=_0xc142[_0x547456];return _0xc1fd7b;};'use strict';var multer=require(_0x2c14('0x0'));var util=require('util');var path=require(_0x2c14('0x1'));var timeout=require(_0x2c14('0x2'));var express=require('express');var router=express[_0x2c14('0x3')]();var fs_extra=require(_0x2c14('0x4'));var auth=require(_0x2c14('0x5'));var interaction=require(_0x2c14('0x6'));var config=require(_0x2c14('0x7'));var controller=require(_0x2c14('0x8'));router[_0x2c14('0x9')]('/',auth[_0x2c14('0xa')](),controller[_0x2c14('0xb')]);router['get'](_0x2c14('0xc'),auth['isAuthenticated'](),controller[_0x2c14('0xd')]);router['post'](_0x2c14('0xe'),auth[_0x2c14('0xa')](),controller[_0x2c14('0xf')]);router[_0x2c14('0x10')]('/',auth[_0x2c14('0xa')](),controller[_0x2c14('0x11')]);router[_0x2c14('0x12')](_0x2c14('0xc'),auth[_0x2c14('0xa')](),controller['update']);router[_0x2c14('0x13')](_0x2c14('0xc'),auth[_0x2c14('0xa')](),controller[_0x2c14('0x14')]);module[_0x2c14('0x15')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 03cf14a..881016f 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 _0xb006=['ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','ENUM','rfc2833','info','shortinfo','inband','auto','yes','nonat','outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','accept','refuse','originate','uac','uas','pai','certificate','active','passive','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','friend','peer','from-voip-provider'];(function(_0x59b439,_0x14ae7b){var _0x521ea3=function(_0x5af627){while(--_0x5af627){_0x59b439['push'](_0x59b439['shift']());}};_0x521ea3(++_0x14ae7b);}(_0xb006,0xd1));var _0x6b00=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0xb006[_0x51c819];return _0x15c5d2;};'use strict';var Sequelize=require(_0x6b00('0x0'));module[_0x6b00('0x1')]={'name':{'type':Sequelize[_0x6b00('0x2')],'allowNull':![],'unique':_0x6b00('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x6b00('0x4'),'user',_0x6b00('0x5')),'allowNull':![],'defaultValue':_0x6b00('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6b00('0x6')},'callingpres':{'type':Sequelize['ENUM'](_0x6b00('0x7'),_0x6b00('0x8'),_0x6b00('0x9'),_0x6b00('0xa'),_0x6b00('0xb'),_0x6b00('0xc'),_0x6b00('0xd'),_0x6b00('0xe'))},'deny':{'type':Sequelize[_0x6b00('0x2')]},'permit':{'type':Sequelize[_0x6b00('0x2')]},'secret':{'type':Sequelize[_0x6b00('0x2')]},'md5secret':{'type':Sequelize[_0x6b00('0x2')]},'remotesecret':{'type':Sequelize[_0x6b00('0x2')]},'transport':{'type':Sequelize[_0x6b00('0x2')],'defaultValue':'udp','set':function(_0x1d4aff){this[_0x6b00('0xf')]('transport',_0x1d4aff?_0x1d4aff['join'](','):null);},'get':function(){return this[_0x6b00('0x10')](_0x6b00('0x11'))?this[_0x6b00('0x10')](_0x6b00('0x11'))[_0x6b00('0x12')](','):null;},'comment':_0x6b00('0x13')},'dtmfmode':{'type':Sequelize[_0x6b00('0x14')](_0x6b00('0x15'),_0x6b00('0x16'),_0x6b00('0x17'),_0x6b00('0x18'),_0x6b00('0x19')),'defaultValue':_0x6b00('0x15')},'directmedia':{'type':Sequelize[_0x6b00('0x14')](_0x6b00('0x1a'),'no',_0x6b00('0x1b'),'update',_0x6b00('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x6b00('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x6b00('0x2')]},'directmediadeny':{'type':Sequelize[_0x6b00('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x6b00('0x1d'),'set':function(_0x4c15e8){this[_0x6b00('0xf')](_0x6b00('0x1e'),_0x4c15e8?_0x4c15e8[_0x6b00('0x1f')](','):null);},'get':function(){return this[_0x6b00('0x10')]('nat')?this['getDataValue'](_0x6b00('0x1e'))['split'](','):null;},'comment':_0x6b00('0x20')},'callgroup':{'type':Sequelize[_0x6b00('0x2')]},'namedcallgroup':{'type':Sequelize[_0x6b00('0x2')]},'pickupgroup':{'type':Sequelize[_0x6b00('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x6b00('0x2')]},'language':{'type':Sequelize[_0x6b00('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x6b00('0x2')],'defaultValue':_0x6b00('0x21')},'allow':{'type':Sequelize[_0x6b00('0x2')],'allowNull':![],'defaultValue':_0x6b00('0x22'),'set':function(_0x535932){this[_0x6b00('0xf')]('allow',_0x535932?_0x535932[_0x6b00('0x1f')](';'):_0x6b00('0x22'));},'get':function(){return this[_0x6b00('0x10')](_0x6b00('0x23'))?this[_0x6b00('0x10')](_0x6b00('0x23'))[_0x6b00('0x12')](';'):null;},'comment':_0x6b00('0x24')},'autoframing':{'type':Sequelize['ENUM'](_0x6b00('0x1a'),'no')},'insecure':{'type':Sequelize[_0x6b00('0x2')],'defaultValue':'port,invite','set':function(_0x32a910){this[_0x6b00('0xf')](_0x6b00('0x25'),_0x32a910?_0x32a910['join'](','):null);},'get':function(){return this[_0x6b00('0x10')](_0x6b00('0x25'))?this[_0x6b00('0x10')](_0x6b00('0x25'))['split'](','):null;},'comment':_0x6b00('0x26')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6b00('0x14')](_0x6b00('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x6b00('0x14')](_0x6b00('0x1a'),'no',_0x6b00('0x27'))},'promiscredir':{'type':Sequelize[_0x6b00('0x14')](_0x6b00('0x1a'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x6b00('0x1a'),'no')},'accountcode':{'type':Sequelize[_0x6b00('0x28')](0xb)},'setvar':{'type':Sequelize[_0x6b00('0x2')]},'callerid':{'type':Sequelize[_0x6b00('0x2')],'defaultValue':_0x6b00('0x29')},'amaflags':{'type':Sequelize[_0x6b00('0x2')]},'callcounter':{'type':Sequelize[_0x6b00('0x14')](_0x6b00('0x1a'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x6b00('0x28')](0xb)},'allowoverlap':{'type':Sequelize[_0x6b00('0x14')](_0x6b00('0x1a'),'no')},'allowsubscribe':{'type':Sequelize[_0x6b00('0x14')](_0x6b00('0x1a'),'no')},'allowtransfer':{'type':Sequelize[_0x6b00('0x14')](_0x6b00('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x6b00('0x1a'),'no')},'subscribecontext':{'type':Sequelize[_0x6b00('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x6b00('0x14')]('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x6b00('0x28')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x6b00('0x14')]('yes','no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x6b00('0x14')](_0x6b00('0x2a'),_0x6b00('0x2b'),_0x6b00('0x2c'))},'session_expires':{'type':Sequelize[_0x6b00('0x28')](0xb)},'session_minse':{'type':Sequelize[_0x6b00('0x28')](0xb)},'session_refresher':{'type':Sequelize[_0x6b00('0x14')](_0x6b00('0x2d'),_0x6b00('0x2e')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x6b00('0x2')]},'regexten':{'type':Sequelize[_0x6b00('0x2')]},'fromdomain':{'type':Sequelize[_0x6b00('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x6b00('0x14')](_0x6b00('0x1a'),'no'),'defaultValue':_0x6b00('0x1a')},'keepalive':{'type':Sequelize[_0x6b00('0x28')](0xb)},'defaultip':{'type':Sequelize[_0x6b00('0x2')]},'defaultuser':{'type':Sequelize[_0x6b00('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x6b00('0x28')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x6b00('0x28')](0xb)},'sendrpid':{'type':Sequelize[_0x6b00('0x14')]('yes','no',_0x6b00('0x2f')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x6b00('0x2')]},'callbackextension':{'type':Sequelize[_0x6b00('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x6b00('0x28')](0xb)},'contactpermit':{'type':Sequelize[_0x6b00('0x2')]},'contactdeny':{'type':Sequelize[_0x6b00('0x2')]},'contactacl':{'type':Sequelize[_0x6b00('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x6b00('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x6b00('0x28')](0xb)},'encryption':{'type':Sequelize[_0x6b00('0x14')](_0x6b00('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x6b00('0x14')](_0x6b00('0x1a'),'no')},'force_avp':{'type':Sequelize[_0x6b00('0x14')](_0x6b00('0x1a'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x6b00('0x1a'),'no')},'dtlsenable':{'type':Sequelize[_0x6b00('0x14')](_0x6b00('0x1a'),'no')},'dtlsverify':{'type':Sequelize[_0x6b00('0x14')](_0x6b00('0x1a'),'no','fingerprint',_0x6b00('0x30'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x6b00('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x6b00('0x2')]},'dtlscafile':{'type':Sequelize[_0x6b00('0x2')]},'dtlscapath':{'type':Sequelize[_0x6b00('0x2')]},'dtlssetup':{'type':Sequelize[_0x6b00('0x14')](_0x6b00('0x31'),_0x6b00('0x32'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x6b00('0x2')]},'usereqphone':{'type':Sequelize[_0x6b00('0x14')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x6b00('0x2')]},'recordofffeature':{'type':Sequelize[_0x6b00('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize[_0x6b00('0x14')](_0x6b00('0x1a'),'no')},'vmexten':{'type':Sequelize[_0x6b00('0x2')]},'mohinterpret':{'type':Sequelize[_0x6b00('0x2')]},'mohsuggest':{'type':Sequelize[_0x6b00('0x2')]},'parkinglot':{'type':Sequelize[_0x6b00('0x2')]},'description':{'type':Sequelize[_0x6b00('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x6b00('0x33')},'canreinvite':{'type':Sequelize[_0x6b00('0x14')]('yes','no',_0x6b00('0x1b'),'update',_0x6b00('0x34')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x6b00('0x2')]},'otherFields':{'type':Sequelize[_0x6b00('0x2')]},'active':{'type':Sequelize[_0x6b00('0x35')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x6b00('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x2395=['ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','update','outgoing','yes','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','join','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','setDataValue','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','active','passive','nonat','update,nonat','BOOLEAN','exports','STRING','ENUM','user','peer','from-voip-provider'];(function(_0x35e92e,_0x21581b){var _0x1205a8=function(_0x4325d8){while(--_0x4325d8){_0x35e92e['push'](_0x35e92e['shift']());}};_0x1205a8(++_0x21581b);}(_0x2395,0x1c5));var _0x5239=function(_0x13b481,_0x3ace3a){_0x13b481=_0x13b481-0x0;var _0x2ec319=_0x2395[_0x13b481];return _0x2ec319;};'use strict';var Sequelize=require('sequelize');module[_0x5239('0x0')]={'name':{'type':Sequelize[_0x5239('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x5239('0x2')]('friend',_0x5239('0x3'),_0x5239('0x4')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5239('0x5')},'callingpres':{'type':Sequelize['ENUM'](_0x5239('0x6'),_0x5239('0x7'),_0x5239('0x8'),_0x5239('0x9'),'PROHIB_NOT_SCREENED',_0x5239('0xa'),_0x5239('0xb'),'PROHIB')},'deny':{'type':Sequelize[_0x5239('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x5239('0x1')]},'md5secret':{'type':Sequelize[_0x5239('0x1')]},'remotesecret':{'type':Sequelize[_0x5239('0x1')]},'transport':{'type':Sequelize[_0x5239('0x1')],'defaultValue':'udp','set':function(_0x2d7e4e){this['setDataValue'](_0x5239('0xc'),_0x2d7e4e?_0x2d7e4e['join'](','):null);},'get':function(){return this[_0x5239('0xd')](_0x5239('0xc'))?this[_0x5239('0xd')]('transport')[_0x5239('0xe')](','):null;},'comment':_0x5239('0xf')},'dtmfmode':{'type':Sequelize['ENUM'](_0x5239('0x10'),_0x5239('0x11'),_0x5239('0x12'),_0x5239('0x13'),_0x5239('0x14')),'defaultValue':_0x5239('0x10')},'directmedia':{'type':Sequelize[_0x5239('0x2')]('yes','no','nonat',_0x5239('0x15'),_0x5239('0x16')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x5239('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x5239('0x1')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x114fe2){this['setDataValue'](_0x5239('0x18'),_0x114fe2?_0x114fe2['join'](','):null);},'get':function(){return this['getDataValue'](_0x5239('0x18'))?this[_0x5239('0xd')]('nat')['split'](','):null;},'comment':_0x5239('0x19')},'callgroup':{'type':Sequelize[_0x5239('0x1')]},'namedcallgroup':{'type':Sequelize[_0x5239('0x1')]},'pickupgroup':{'type':Sequelize[_0x5239('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x5239('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x5239('0x1')],'defaultValue':_0x5239('0x1a')},'allow':{'type':Sequelize[_0x5239('0x1')],'allowNull':![],'defaultValue':_0x5239('0x1b'),'set':function(_0x44786){this['setDataValue']('allow',_0x44786?_0x44786[_0x5239('0x1c')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x5239('0xd')](_0x5239('0x1d'))?this[_0x5239('0xd')](_0x5239('0x1d'))[_0x5239('0xe')](';'):null;},'comment':_0x5239('0x1e')},'autoframing':{'type':Sequelize[_0x5239('0x2')](_0x5239('0x17'),'no')},'insecure':{'type':Sequelize[_0x5239('0x1')],'defaultValue':_0x5239('0x1f'),'set':function(_0x1a3cb8){this[_0x5239('0x20')]('insecure',_0x1a3cb8?_0x1a3cb8[_0x5239('0x1c')](','):null);},'get':function(){return this[_0x5239('0xd')](_0x5239('0x21'))?this[_0x5239('0xd')](_0x5239('0x21'))['split'](','):null;},'comment':_0x5239('0x22')},'trustrpid':{'type':Sequelize['ENUM'](_0x5239('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x5239('0x2')](_0x5239('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x5239('0x2')](_0x5239('0x17'),'no',_0x5239('0x23'))},'promiscredir':{'type':Sequelize['ENUM'](_0x5239('0x17'),'no')},'useclientcode':{'type':Sequelize[_0x5239('0x2')](_0x5239('0x17'),'no')},'accountcode':{'type':Sequelize[_0x5239('0x24')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x5239('0x25')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x5239('0x2')](_0x5239('0x17'),'no'),'defaultValue':_0x5239('0x17')},'busylevel':{'type':Sequelize[_0x5239('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x5239('0x2')](_0x5239('0x17'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x5239('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0x5239('0x2')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x5239('0x2')](_0x5239('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0x5239('0x1')]},'template':{'type':Sequelize[_0x5239('0x1')]},'videosupport':{'type':Sequelize[_0x5239('0x2')](_0x5239('0x17'),'no',_0x5239('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x5239('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x5239('0x17'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize['ENUM'](_0x5239('0x27'),_0x5239('0x28'),_0x5239('0x29'))},'session_expires':{'type':Sequelize[_0x5239('0x24')](0xb)},'session_minse':{'type':Sequelize[_0x5239('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0x5239('0x2')](_0x5239('0x2a'),_0x5239('0x2b')),'defaultValue':_0x5239('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0x5239('0x1')]},'regexten':{'type':Sequelize[_0x5239('0x1')]},'fromdomain':{'type':Sequelize[_0x5239('0x1')]},'fromuser':{'type':Sequelize[_0x5239('0x1')]},'port':{'type':Sequelize[_0x5239('0x24')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x5239('0x17'),'no'),'defaultValue':_0x5239('0x17')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x5239('0x1')]},'defaultuser':{'type':Sequelize[_0x5239('0x1')]},'rtptimeout':{'type':Sequelize[_0x5239('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x5239('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x5239('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0x5239('0x2')](_0x5239('0x17'),'no',_0x5239('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x5239('0x1')]},'callbackextension':{'type':Sequelize[_0x5239('0x1')]},'timert1':{'type':Sequelize[_0x5239('0x24')](0xb)},'timerb':{'type':Sequelize[_0x5239('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0x5239('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0x5239('0x1')]},'contactdeny':{'type':Sequelize[_0x5239('0x1')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x5239('0x1')]},'use_q850_reason':{'type':Sequelize[_0x5239('0x1')]},'maxforwards':{'type':Sequelize[_0x5239('0x24')](0xb)},'encryption':{'type':Sequelize[_0x5239('0x2')](_0x5239('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x5239('0x2')](_0x5239('0x17'),'no')},'force_avp':{'type':Sequelize[_0x5239('0x2')]('yes','no')},'icesupport':{'type':Sequelize[_0x5239('0x2')](_0x5239('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0x5239('0x2')](_0x5239('0x17'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x5239('0x17'),'no',_0x5239('0x2d'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x5239('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0x5239('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x5239('0x1')]},'dtlscipher':{'type':Sequelize[_0x5239('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x5239('0x1')]},'dtlssetup':{'type':Sequelize[_0x5239('0x2')](_0x5239('0x2e'),_0x5239('0x2f'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x5239('0x1')]},'usereqphone':{'type':Sequelize[_0x5239('0x2')](_0x5239('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x5239('0x1')]},'recordofffeature':{'type':Sequelize[_0x5239('0x1')]},'call_limit':{'type':Sequelize[_0x5239('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x5239('0x2')](_0x5239('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0x5239('0x2')]('yes','no')},'vmexten':{'type':Sequelize[_0x5239('0x1')]},'mohinterpret':{'type':Sequelize[_0x5239('0x1')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x5239('0x1')]},'description':{'type':Sequelize[_0x5239('0x1')]},'host':{'type':Sequelize[_0x5239('0x1')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x5239('0x2')](_0x5239('0x17'),'no',_0x5239('0x30'),_0x5239('0x15'),_0x5239('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x5239('0x1')]},'otherFields':{'type':Sequelize[_0x5239('0x1')]},'active':{'type':Sequelize[_0x5239('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x5239('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index aa74af5..b3c3856 100644 --- a/server/api/trunk/trunk.controller.js +++ b/server/api/trunk/trunk.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x98a8=['../../mysqldb','jayson/promise','client','request','Trunk,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','Trunks','UserProfileResource','stack','name','map','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Trunk','include','show','params','keys','rawAttributes','includeAll','clone','find','createdAt','updatedAt','body','omit','create','user','role','UserProfileSection','userProfileId','autoAssociation','findAll','readFileSync','root','server/files/templates/trunk.ejs','join','server/files/templates/registry.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x5b3fb1,_0x1f8307){var _0x4222e1=function(_0x46d38b){while(--_0x46d38b){_0x5b3fb1['push'](_0x5b3fb1['shift']());}};_0x4222e1(++_0x1f8307);}(_0x98a8,0x12c));var _0x898a=function(_0x3f1691,_0x201077){_0x3f1691=_0x3f1691-0x0;var _0x32a9a5=_0x98a8[_0x3f1691];return _0x32a9a5;};'use strict';var emlformat=require(_0x898a('0x0'));var rimraf=require(_0x898a('0x1'));var zipdir=require(_0x898a('0x2'));var jsonpatch=require(_0x898a('0x3'));var rp=require(_0x898a('0x4'));var moment=require(_0x898a('0x5'));var BPromise=require(_0x898a('0x6'));var Mustache=require('mustache');var util=require(_0x898a('0x7'));var path=require(_0x898a('0x8'));var sox=require(_0x898a('0x9'));var csv=require(_0x898a('0xa'));var ejs=require(_0x898a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xa'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];var jayson=require(_0x898a('0x19'));var client=jayson[_0x898a('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bfded,_0x5b5c9c,_0x373d53,_0x1f5be4){return new BPromise(function(_0xb24335,_0x116fbe){var _0x1873e9=_0x1f5be4||client;return _0x1873e9[_0x898a('0x1b')](_0x5bfded,_0x373d53)['then'](function(_0x47033c){logger['info'](_0x898a('0x1c'),_0x5b5c9c,'request\x20sent');logger[_0x898a('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x5b5c9c,_0x898a('0x1e'),JSON['stringify'](_0x47033c));if(_0x47033c[_0x898a('0x1f')]){if(_0x47033c[_0x898a('0x1f')][_0x898a('0x20')]===0x1f4){logger['error'](_0x898a('0x1c'),_0x5b5c9c,_0x47033c['error']['message']);return _0x116fbe(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5b5c9c,_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);return _0xb24335(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}else{logger[_0x898a('0x22')](_0x898a('0x1c'),_0x5b5c9c,_0x898a('0x1e'));_0xb24335(_0x47033c['result'][_0x898a('0x21')]);}})[_0x898a('0x23')](function(_0x11cae2){logger[_0x898a('0x1f')](_0x898a('0x1c'),_0x5b5c9c,_0x11cae2);_0x116fbe(_0x11cae2);});});}function respondWithStatusCode(_0x310bfa,_0x4e254d){_0x4e254d=_0x4e254d||0xcc;return function(_0x274cdf){if(_0x274cdf){return _0x310bfa[_0x898a('0x24')](_0x4e254d);}return _0x310bfa[_0x898a('0x25')](_0x4e254d)[_0x898a('0x26')]();};}function respondWithResult(_0x3901ab,_0x1426e3){_0x1426e3=_0x1426e3||0xc8;return function(_0x5b7719){if(_0x5b7719){return _0x3901ab[_0x898a('0x25')](_0x1426e3)['json'](_0x5b7719);}};}function respondWithFilteredResult(_0x513c6b,_0x53ddb2){return function(_0x3678be){if(_0x3678be){var _0x1f4d86=typeof _0x53ddb2[_0x898a('0x27')]===_0x898a('0x28')&&typeof _0x53ddb2[_0x898a('0x29')]===_0x898a('0x28');var _0x398e98=_0x3678be[_0x898a('0x2a')];var _0xd31922=_0x1f4d86?0x0:_0x53ddb2['offset'];var _0x4b3e68=_0x1f4d86?_0x3678be['count']:_0x53ddb2[_0x898a('0x27')]+_0x53ddb2[_0x898a('0x29')];var _0x3b7704;if(_0x4b3e68>=_0x398e98){_0x4b3e68=_0x398e98;_0x3b7704=0xc8;}else{_0x3b7704=0xce;}_0x513c6b[_0x898a('0x25')](_0x3b7704);return _0x513c6b[_0x898a('0x2b')](_0x898a('0x2c'),_0xd31922+'-'+_0x4b3e68+'/'+_0x398e98)[_0x898a('0x2d')](_0x3678be);}return null;};}function patchUpdates(_0xf74645){return function(_0x18773a){try{jsonpatch[_0x898a('0x2e')](_0x18773a,_0xf74645,!![]);}catch(_0x44c5d2){return BPromise[_0x898a('0x2f')](_0x44c5d2);}return _0x18773a['save']();};}function saveUpdates(_0x7a1eb5,_0x17a5f3){return function(_0x26eead){if(_0x26eead){return _0x26eead[_0x898a('0x30')](_0x7a1eb5)[_0x898a('0x31')](function(_0x47af5b){return _0x47af5b;});}return null;};}function removeEntity(_0x48cefb,_0x20a3fe){return function(_0x1e2fd4){if(_0x1e2fd4){return _0x1e2fd4[_0x898a('0x32')]()['then'](function(){var _0x105477=_0x1e2fd4[_0x898a('0x33')]({'plain':!![]});var _0x5eafc7=_0x898a('0x34');return db[_0x898a('0x35')][_0x898a('0x32')]({'where':{'type':_0x5eafc7,'resourceId':_0x105477['id']}})[_0x898a('0x31')](function(){return _0x1e2fd4;});})[_0x898a('0x31')](function(){_0x48cefb['status'](0xcc)[_0x898a('0x26')]();});}};}function handleEntityNotFound(_0x5baf5b,_0x573eb3){return function(_0x14e2dc){if(!_0x14e2dc){_0x5baf5b['sendStatus'](0x194);}return _0x14e2dc;};}function handleError(_0x3c9588,_0x4b3aac){_0x4b3aac=_0x4b3aac||0x1f4;return function(_0x37cb11){logger['error'](_0x37cb11[_0x898a('0x36')]);if(_0x37cb11[_0x898a('0x37')]){delete _0x37cb11[_0x898a('0x37')];}_0x3c9588['status'](_0x4b3aac)['send'](_0x37cb11);};}exports['index']=function(_0x1575d2,_0x429c32){var _0x5a228f={},_0xdd019d={},_0x3d3463={'count':0x0,'rows':[]};var _0xe84f7e=_[_0x898a('0x38')](db['Trunk']['rawAttributes'],function(_0x3aed01){return{'name':_0x3aed01[_0x898a('0x39')],'type':_0x3aed01['type']['key']};});_0xdd019d[_0x898a('0x3a')]=_[_0x898a('0x38')](_0xe84f7e,_0x898a('0x37'));_0xdd019d[_0x898a('0x3b')]=_['keys'](_0x1575d2[_0x898a('0x3b')]);_0xdd019d[_0x898a('0x3c')]=_['intersection'](_0xdd019d['model'],_0xdd019d['query']);_0x5a228f[_0x898a('0x3d')]=_[_0x898a('0x3e')](_0xdd019d[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x3f')]));_0x5a228f[_0x898a('0x3d')]=_0x5a228f[_0x898a('0x3d')][_0x898a('0x40')]?_0x5a228f[_0x898a('0x3d')]:_0xdd019d[_0x898a('0x3a')];if(!_0x1575d2[_0x898a('0x3b')][_0x898a('0x41')](_0x898a('0x42'))){_0x5a228f[_0x898a('0x29')]=qs['limit'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x29')]);_0x5a228f[_0x898a('0x27')]=qs['offset'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x27')]);}_0x5a228f[_0x898a('0x43')]=qs[_0x898a('0x44')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x44')]);_0x5a228f[_0x898a('0x45')]=qs[_0x898a('0x3c')](_['pick'](_0x1575d2[_0x898a('0x3b')],_0xdd019d[_0x898a('0x3c')]),_0xe84f7e);if(_0x1575d2[_0x898a('0x3b')][_0x898a('0x46')]){_0x5a228f['where']=_[_0x898a('0x47')](_0x5a228f[_0x898a('0x45')],{'$or':_['map'](_0xe84f7e,function(_0x241677){if(_0x241677['type']!==_0x898a('0x48')){var _0x5137c4={};_0x5137c4[_0x241677['name']]={'$like':'%'+_0x1575d2[_0x898a('0x3b')]['filter']+'%'};return _0x5137c4;}})});}_0x5a228f=_[_0x898a('0x47')]({},_0x5a228f,_0x1575d2[_0x898a('0x49')]);var _0x4d6ac0={'where':_0x5a228f[_0x898a('0x45')]};return db[_0x898a('0x4a')]['count'](_0x4d6ac0)[_0x898a('0x31')](function(_0x199437){_0x3d3463[_0x898a('0x2a')]=_0x199437;if(_0x1575d2[_0x898a('0x3b')]['includeAll']){_0x5a228f[_0x898a('0x4b')]=[{'all':!![]}];}return db[_0x898a('0x4a')]['findAll'](_0x5a228f);})[_0x898a('0x31')](function(_0x1d8c16){_0x3d3463['rows']=_0x1d8c16;return _0x3d3463;})[_0x898a('0x31')](respondWithFilteredResult(_0x429c32,_0x5a228f))['catch'](handleError(_0x429c32,null));};exports[_0x898a('0x4c')]=function(_0x41f291,_0x32ccb9){var _0x50f9e3={'raw':![],'where':{'id':_0x41f291[_0x898a('0x4d')]['id']}},_0x2f6cb3={};_0x2f6cb3[_0x898a('0x3a')]=_[_0x898a('0x4e')](db['Trunk'][_0x898a('0x4f')]);_0x2f6cb3['query']=_[_0x898a('0x4e')](_0x41f291[_0x898a('0x3b')]);_0x2f6cb3[_0x898a('0x3c')]=_['intersection'](_0x2f6cb3[_0x898a('0x3a')],_0x2f6cb3[_0x898a('0x3b')]);_0x50f9e3[_0x898a('0x3d')]=_['intersection'](_0x2f6cb3['model'],qs[_0x898a('0x3f')](_0x41f291[_0x898a('0x3b')][_0x898a('0x3f')]));_0x50f9e3[_0x898a('0x3d')]=_0x50f9e3[_0x898a('0x3d')][_0x898a('0x40')]?_0x50f9e3[_0x898a('0x3d')]:_0x2f6cb3[_0x898a('0x3a')];if(_0x41f291[_0x898a('0x3b')][_0x898a('0x50')]){_0x50f9e3[_0x898a('0x4b')]=[{'all':!![]}];}_0x50f9e3=_['merge']({},_0x50f9e3,_0x41f291[_0x898a('0x49')]);return db[_0x898a('0x4a')]['find'](_0x50f9e3)[_0x898a('0x31')](handleEntityNotFound(_0x32ccb9,null))['then'](respondWithResult(_0x32ccb9,null))['catch'](handleError(_0x32ccb9,null));};exports[_0x898a('0x51')]=function(_0x124f9b,_0x209529){var _0x5bfd61={'where':{'id':_0x124f9b[_0x898a('0x4d')]['id']}},_0x556fd8={};_0x556fd8[_0x898a('0x3a')]=_['keys'](db[_0x898a('0x4a')][_0x898a('0x4f')]);_0x5bfd61['attributes']=_[_0x898a('0x3e')](_0x556fd8[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x124f9b['query'][_0x898a('0x3f')]));_0x5bfd61[_0x898a('0x3d')]=_0x5bfd61[_0x898a('0x3d')][_0x898a('0x40')]?_0x5bfd61[_0x898a('0x3d')]:_0x556fd8[_0x898a('0x3a')];if(_0x124f9b['query'][_0x898a('0x50')]){_0x5bfd61['include']=[{'all':!![]}];}_0x5bfd61=_[_0x898a('0x47')]({},_0x5bfd61,_0x124f9b[_0x898a('0x49')]);return db[_0x898a('0x4a')][_0x898a('0x52')](_0x5bfd61)[_0x898a('0x31')](handleEntityNotFound(_0x209529,null))[_0x898a('0x31')](function(_0x2486a5){if(_0x2486a5){var _0x75ff57=_0x2486a5[_0x898a('0x33')]({'plain':!![]});_0x75ff57=qs['omit'](_0x75ff57,['id',_0x898a('0x53'),_0x898a('0x54')]);_0x124f9b[_0x898a('0x55')]=_[_0x898a('0x56')](_0x124f9b[_0x898a('0x55')],['id',_0x898a('0x53'),_0x898a('0x54')]);return db[_0x898a('0x4a')][_0x898a('0x57')](_[_0x898a('0x47')](_0x75ff57,_0x124f9b[_0x898a('0x55')]),{'include':_0x124f9b[_0x898a('0x3b')][_0x898a('0x50')]?[{'all':!![]}]:undefined})[_0x898a('0x31')](function(_0x22f9ba){var _0x5f42ae=_0x124f9b[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x5f42ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f42ae[_0x898a('0x59')]===_0x898a('0x58')){var _0x5f0944=_0x22f9ba[_0x898a('0x33')]({'plain':!![]});var _0x1daecd=_0x898a('0x34');return db[_0x898a('0x5a')]['find']({'where':{'name':_0x1daecd,'userProfileId':_0x5f42ae[_0x898a('0x5b')]},'raw':!![]})[_0x898a('0x31')](function(_0x137935){if(_0x137935&&_0x137935[_0x898a('0x5c')]===0x0){return db['UserProfileResource'][_0x898a('0x57')]({'name':_0x5f0944[_0x898a('0x37')],'resourceId':_0x5f0944['id'],'type':_0x137935['name'],'sectionId':_0x137935['id']},{})[_0x898a('0x31')](function(){return _0x22f9ba;});}else{return _0x22f9ba;}})[_0x898a('0x23')](function(_0x5b7019){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b7019);throw _0x5b7019;});}return _0x22f9ba;});}})[_0x898a('0x31')](respondWithResult(_0x209529,0xc9))['catch'](handleError(_0x209529,null));};exports['create']=function(_0x5ed35e,_0xfdd6d8,_0x473f5c){var _0x3909c5;return db[_0x898a('0x4a')]['create'](_0x5ed35e['body'],{'raw':!![]})[_0x898a('0x31')](function(_0x232be0){_0x3909c5=_0x232be0;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x41cf94){var _0x30051d=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x42fda8=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),_0x898a('0x63'));var _0x3bcc3d=ejs[_0x898a('0x64')](_0x30051d,{'trunks':_0x41cf94||[]});fs[_0x898a('0x65')](_0x898a('0x66'),_0x3bcc3d);if(_0x3909c5[_0x898a('0x67')]){var _0x307849=ejs[_0x898a('0x64')](_0x42fda8,{'trunks':_0x41cf94||[]});fs['writeFileSync'](_0x898a('0x68'),_0x307849);}})['then'](function(){return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x57'),{'module':_0x898a('0x6a')});})['then'](function(){var _0x31102d=_0x5ed35e[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x31102d)throw new Error(_0x898a('0x6b'));if(_0x31102d[_0x898a('0x59')]==='user'){var _0x4b9487=_0x3909c5[_0x898a('0x33')]({'plain':!![]});return db[_0x898a('0x5a')][_0x898a('0x52')]({'where':{'name':_0x898a('0x34'),'userProfileId':_0x31102d['userProfileId']},'raw':!![]})[_0x898a('0x31')](function(_0x3d3451){if(_0x3d3451&&_0x3d3451[_0x898a('0x5c')]===0x0){return db[_0x898a('0x35')][_0x898a('0x57')]({'name':_0x4b9487[_0x898a('0x37')],'resourceId':_0x4b9487['id'],'type':_0x3d3451[_0x898a('0x37')],'sectionId':_0x3d3451['id']},{})[_0x898a('0x31')](function(){return _0x3909c5;});}else{return _0x3909c5;}})['catch'](function(_0x32a207){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32a207);throw _0x32a207;});}return _0x3909c5;})[_0x898a('0x31')](respondWithResult(_0xfdd6d8,0xc9))['catch'](handleError(_0xfdd6d8,null));};exports[_0x898a('0x30')]=function(_0x4b2575,_0x2471d8,_0x387f2c){var _0x3b07dc;return db[_0x898a('0x4a')][_0x898a('0x52')]({'where':{'id':_0x4b2575[_0x898a('0x4d')]['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x2471d8,null))[_0x898a('0x31')](saveUpdates(_0x4b2575[_0x898a('0x55')],null))['then'](function(_0x3fe54b){if(_0x3fe54b){_0x3b07dc=_0x3fe54b;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});}})[_0x898a('0x31')](function(_0x290972){if(_0x290972){var _0x1d594b=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x4fad03=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config['root'],'server/files/templates/registry.ejs'),_0x898a('0x63'));var _0x4a79a4=ejs[_0x898a('0x64')](_0x1d594b,{'trunks':_0x290972||[]});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4a79a4);var _0x3f6815=ejs[_0x898a('0x64')](_0x4fad03,{'trunks':_0x290972||[]});fs[_0x898a('0x65')](_0x898a('0x68'),_0x3f6815);return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x30'),{'module':_0x898a('0x6a')});}return null;})['then'](function(_0x3237e8){if(_0x3237e8){return _0x3b07dc;}})[_0x898a('0x31')](respondWithResult(_0x2471d8,null))[_0x898a('0x23')](handleError(_0x2471d8,null));};exports['destroy']=function(_0x27560f,_0x61247c,_0x5c6247){var _0x39e917;return db['Trunk']['find']({'where':{'id':_0x27560f['params']['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x61247c,null))[_0x898a('0x31')](removeEntity(_0x61247c,null))[_0x898a('0x31')](function(){return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x12e54b){var _0x50dd52=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x24670c=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),'utf8');var _0x5847cb=ejs['render'](_0x50dd52,{'trunks':_0x12e54b});var _0x3b8fb5=ejs[_0x898a('0x64')](_0x24670c,{'trunks':_0x12e54b});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5847cb);fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_registers.conf',_0x3b8fb5);return respondWithRpcPromise('Reload',_0x898a('0x32'),{'module':_0x898a('0x6a')});})[_0x898a('0x23')](handleError(_0x61247c,null));}; \ No newline at end of file +var _0x34e8=['limit','count','set','Content-Range','json','apply','save','update','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','key','query','keys','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','length','find','clone','rawAttributes','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','render','Reload','chan_sip.so','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','end','offset','undefined'];(function(_0x38d64b,_0x56a8ac){var _0x58868c=function(_0x4a06e0){while(--_0x4a06e0){_0x38d64b['push'](_0x38d64b['shift']());}};_0x58868c(++_0x56a8ac);}(_0x34e8,0x12c));var _0x834e=function(_0x2adeb3,_0x2d456a){_0x2adeb3=_0x2adeb3-0x0;var _0x2ed81c=_0x34e8[_0x2adeb3];return _0x2ed81c;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];var jayson=require(_0x834e('0x1c'));var client=jayson[_0x834e('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23848e,_0x2d95f2,_0x28e659,_0x21cc0a){return new BPromise(function(_0x50e860,_0x43156c){var _0x302cbd=_0x21cc0a||client;return _0x302cbd['request'](_0x23848e,_0x28e659)[_0x834e('0x1e')](function(_0x4a9cdc){logger[_0x834e('0x1f')](_0x834e('0x20'),_0x2d95f2,'request\x20sent');logger[_0x834e('0x21')](_0x834e('0x22'),_0x2d95f2,_0x834e('0x23'),JSON['stringify'](_0x4a9cdc));if(_0x4a9cdc[_0x834e('0x24')]){if(_0x4a9cdc[_0x834e('0x24')][_0x834e('0x25')]===0x1f4){logger[_0x834e('0x24')](_0x834e('0x20'),_0x2d95f2,_0x4a9cdc[_0x834e('0x24')][_0x834e('0x26')]);return _0x43156c(_0x4a9cdc['error'][_0x834e('0x26')]);}logger[_0x834e('0x24')](_0x834e('0x20'),_0x2d95f2,_0x4a9cdc[_0x834e('0x24')]['message']);return _0x50e860(_0x4a9cdc[_0x834e('0x24')][_0x834e('0x26')]);}else{logger['info'](_0x834e('0x20'),_0x2d95f2,_0x834e('0x23'));_0x50e860(_0x4a9cdc[_0x834e('0x27')]['message']);}})['catch'](function(_0x231619){logger[_0x834e('0x24')]('Trunk,\x20%s,\x20%s',_0x2d95f2,_0x231619);_0x43156c(_0x231619);});});}function respondWithStatusCode(_0x25ee1d,_0x1dc1e0){_0x1dc1e0=_0x1dc1e0||0xcc;return function(_0x58f4fd){if(_0x58f4fd){return _0x25ee1d[_0x834e('0x28')](_0x1dc1e0);}return _0x25ee1d[_0x834e('0x29')](_0x1dc1e0)[_0x834e('0x2a')]();};}function respondWithResult(_0x561cd2,_0x24fcf7){_0x24fcf7=_0x24fcf7||0xc8;return function(_0x3e310f){if(_0x3e310f){return _0x561cd2['status'](_0x24fcf7)['json'](_0x3e310f);}};}function respondWithFilteredResult(_0x1e713a,_0x508a1d){return function(_0x2826ec){if(_0x2826ec){var _0x3f1b0b=typeof _0x508a1d[_0x834e('0x2b')]===_0x834e('0x2c')&&typeof _0x508a1d[_0x834e('0x2d')]===_0x834e('0x2c');var _0x491919=_0x2826ec['count'];var _0x4dc64a=_0x3f1b0b?0x0:_0x508a1d['offset'];var _0x2c7a8d=_0x3f1b0b?_0x2826ec[_0x834e('0x2e')]:_0x508a1d[_0x834e('0x2b')]+_0x508a1d['limit'];var _0xb5bc06;if(_0x2c7a8d>=_0x491919){_0x2c7a8d=_0x491919;_0xb5bc06=0xc8;}else{_0xb5bc06=0xce;}_0x1e713a[_0x834e('0x29')](_0xb5bc06);return _0x1e713a[_0x834e('0x2f')](_0x834e('0x30'),_0x4dc64a+'-'+_0x2c7a8d+'/'+_0x491919)[_0x834e('0x31')](_0x2826ec);}return null;};}function patchUpdates(_0x390119){return function(_0x3d149d){try{jsonpatch[_0x834e('0x32')](_0x3d149d,_0x390119,!![]);}catch(_0x278db3){return BPromise['reject'](_0x278db3);}return _0x3d149d[_0x834e('0x33')]();};}function saveUpdates(_0x5cad11,_0x2c75c2){return function(_0x3787b0){if(_0x3787b0){return _0x3787b0[_0x834e('0x34')](_0x5cad11)[_0x834e('0x1e')](function(_0x444366){return _0x444366;});}return null;};}function removeEntity(_0x4689c2,_0x4696a1){return function(_0x38cd29){if(_0x38cd29){return _0x38cd29[_0x834e('0x35')]()[_0x834e('0x1e')](function(){var _0x5bd232=_0x38cd29[_0x834e('0x36')]({'plain':!![]});var _0x2f408a=_0x834e('0x37');return db[_0x834e('0x38')]['destroy']({'where':{'type':_0x2f408a,'resourceId':_0x5bd232['id']}})[_0x834e('0x1e')](function(){return _0x38cd29;});})[_0x834e('0x1e')](function(){_0x4689c2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59385a,_0x3e58fa){return function(_0x41bf4d){if(!_0x41bf4d){_0x59385a[_0x834e('0x28')](0x194);}return _0x41bf4d;};}function handleError(_0x34fefb,_0x339e28){_0x339e28=_0x339e28||0x1f4;return function(_0x1b76dd){logger['error'](_0x1b76dd[_0x834e('0x39')]);if(_0x1b76dd['name']){delete _0x1b76dd[_0x834e('0x3a')];}_0x34fefb[_0x834e('0x29')](_0x339e28)['send'](_0x1b76dd);};}exports[_0x834e('0x3b')]=function(_0x2f56c7,_0x491c28){var _0x481f70={},_0x388711={},_0xd0d43a={'count':0x0,'rows':[]};var _0x2e9383=_[_0x834e('0x3c')](db[_0x834e('0x3d')]['rawAttributes'],function(_0x1c5ed6){return{'name':_0x1c5ed6['fieldName'],'type':_0x1c5ed6['type'][_0x834e('0x3e')]};});_0x388711['model']=_[_0x834e('0x3c')](_0x2e9383,_0x834e('0x3a'));_0x388711[_0x834e('0x3f')]=_[_0x834e('0x40')](_0x2f56c7[_0x834e('0x3f')]);_0x388711['filters']=_[_0x834e('0x41')](_0x388711[_0x834e('0x42')],_0x388711[_0x834e('0x3f')]);_0x481f70['attributes']=_[_0x834e('0x41')](_0x388711[_0x834e('0x42')],qs['fields'](_0x2f56c7[_0x834e('0x3f')]['fields']));_0x481f70[_0x834e('0x43')]=_0x481f70[_0x834e('0x43')]['length']?_0x481f70['attributes']:_0x388711[_0x834e('0x42')];if(!_0x2f56c7[_0x834e('0x3f')][_0x834e('0x44')](_0x834e('0x45'))){_0x481f70[_0x834e('0x2d')]=qs[_0x834e('0x2d')](_0x2f56c7[_0x834e('0x3f')]['limit']);_0x481f70[_0x834e('0x2b')]=qs['offset'](_0x2f56c7[_0x834e('0x3f')]['offset']);}_0x481f70[_0x834e('0x46')]=qs['sort'](_0x2f56c7[_0x834e('0x3f')][_0x834e('0x47')]);_0x481f70['where']=qs[_0x834e('0x48')](_[_0x834e('0x49')](_0x2f56c7[_0x834e('0x3f')],_0x388711[_0x834e('0x48')]),_0x2e9383);if(_0x2f56c7[_0x834e('0x3f')][_0x834e('0x4a')]){_0x481f70[_0x834e('0x4b')]=_[_0x834e('0x4c')](_0x481f70[_0x834e('0x4b')],{'$or':_[_0x834e('0x3c')](_0x2e9383,function(_0x5f3943){if(_0x5f3943[_0x834e('0x4d')]!==_0x834e('0x4e')){var _0x47a8a9={};_0x47a8a9[_0x5f3943[_0x834e('0x3a')]]={'$like':'%'+_0x2f56c7[_0x834e('0x3f')][_0x834e('0x4a')]+'%'};return _0x47a8a9;}})});}_0x481f70=_[_0x834e('0x4c')]({},_0x481f70,_0x2f56c7[_0x834e('0x4f')]);var _0x4264b8={'where':_0x481f70['where']};return db['Trunk'][_0x834e('0x2e')](_0x4264b8)[_0x834e('0x1e')](function(_0x30568e){_0xd0d43a[_0x834e('0x2e')]=_0x30568e;if(_0x2f56c7[_0x834e('0x3f')][_0x834e('0x50')]){_0x481f70[_0x834e('0x51')]=[{'all':!![]}];}return db[_0x834e('0x3d')][_0x834e('0x52')](_0x481f70);})[_0x834e('0x1e')](function(_0xf02f0d){_0xd0d43a[_0x834e('0x53')]=_0xf02f0d;return _0xd0d43a;})[_0x834e('0x1e')](respondWithFilteredResult(_0x491c28,_0x481f70))[_0x834e('0x54')](handleError(_0x491c28,null));};exports[_0x834e('0x55')]=function(_0x1a3855,_0x3df078){var _0x32b8f7={'raw':![],'where':{'id':_0x1a3855[_0x834e('0x56')]['id']}},_0x420841={};_0x420841['model']=_[_0x834e('0x40')](db[_0x834e('0x3d')]['rawAttributes']);_0x420841[_0x834e('0x3f')]=_[_0x834e('0x40')](_0x1a3855['query']);_0x420841[_0x834e('0x48')]=_[_0x834e('0x41')](_0x420841[_0x834e('0x42')],_0x420841[_0x834e('0x3f')]);_0x32b8f7[_0x834e('0x43')]=_[_0x834e('0x41')](_0x420841[_0x834e('0x42')],qs['fields'](_0x1a3855[_0x834e('0x3f')][_0x834e('0x57')]));_0x32b8f7[_0x834e('0x43')]=_0x32b8f7[_0x834e('0x43')][_0x834e('0x58')]?_0x32b8f7[_0x834e('0x43')]:_0x420841[_0x834e('0x42')];if(_0x1a3855[_0x834e('0x3f')]['includeAll']){_0x32b8f7[_0x834e('0x51')]=[{'all':!![]}];}_0x32b8f7=_['merge']({},_0x32b8f7,_0x1a3855[_0x834e('0x4f')]);return db['Trunk'][_0x834e('0x59')](_0x32b8f7)['then'](handleEntityNotFound(_0x3df078,null))['then'](respondWithResult(_0x3df078,null))[_0x834e('0x54')](handleError(_0x3df078,null));};exports[_0x834e('0x5a')]=function(_0x5291ae,_0x5be43d){var _0x2c8155={'where':{'id':_0x5291ae[_0x834e('0x56')]['id']}},_0x2452b4={};_0x2452b4[_0x834e('0x42')]=_[_0x834e('0x40')](db[_0x834e('0x3d')][_0x834e('0x5b')]);_0x2c8155[_0x834e('0x43')]=_['intersection'](_0x2452b4[_0x834e('0x42')],qs[_0x834e('0x57')](_0x5291ae['query'][_0x834e('0x57')]));_0x2c8155['attributes']=_0x2c8155[_0x834e('0x43')][_0x834e('0x58')]?_0x2c8155['attributes']:_0x2452b4[_0x834e('0x42')];if(_0x5291ae[_0x834e('0x3f')][_0x834e('0x50')]){_0x2c8155[_0x834e('0x51')]=[{'all':!![]}];}_0x2c8155=_['merge']({},_0x2c8155,_0x5291ae[_0x834e('0x4f')]);return db[_0x834e('0x3d')][_0x834e('0x59')](_0x2c8155)['then'](handleEntityNotFound(_0x5be43d,null))[_0x834e('0x1e')](function(_0x1fcae9){if(_0x1fcae9){var _0x3a7683=_0x1fcae9[_0x834e('0x36')]({'plain':!![]});_0x3a7683=qs[_0x834e('0x5c')](_0x3a7683,['id',_0x834e('0x5d'),_0x834e('0x5e')]);_0x5291ae[_0x834e('0x5f')]=_[_0x834e('0x5c')](_0x5291ae[_0x834e('0x5f')],['id',_0x834e('0x5d'),_0x834e('0x5e')]);return db[_0x834e('0x3d')][_0x834e('0x60')](_[_0x834e('0x4c')](_0x3a7683,_0x5291ae[_0x834e('0x5f')]),{'include':_0x5291ae[_0x834e('0x3f')][_0x834e('0x50')]?[{'all':!![]}]:undefined})[_0x834e('0x1e')](function(_0x3e3467){var _0xed4081=_0x5291ae[_0x834e('0x61')]['get']({'plain':!![]});if(!_0xed4081)throw new Error(_0x834e('0x62'));if(_0xed4081[_0x834e('0x63')]===_0x834e('0x61')){var _0x36cc14=_0x3e3467['get']({'plain':!![]});var _0x30faa8='Trunks';return db['UserProfileSection'][_0x834e('0x59')]({'where':{'name':_0x30faa8,'userProfileId':_0xed4081[_0x834e('0x64')]},'raw':!![]})[_0x834e('0x1e')](function(_0xe79465){if(_0xe79465&&_0xe79465[_0x834e('0x65')]===0x0){return db[_0x834e('0x38')][_0x834e('0x60')]({'name':_0x36cc14[_0x834e('0x3a')],'resourceId':_0x36cc14['id'],'type':_0xe79465['name'],'sectionId':_0xe79465['id']},{})[_0x834e('0x1e')](function(){return _0x3e3467;});}else{return _0x3e3467;}})['catch'](function(_0x17e223){logger[_0x834e('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17e223);throw _0x17e223;});}return _0x3e3467;});}})['then'](respondWithResult(_0x5be43d,0xc9))[_0x834e('0x54')](handleError(_0x5be43d,null));};exports[_0x834e('0x60')]=function(_0x363cc2,_0x2cca07,_0x2c41bd){var _0x5a4854;return db[_0x834e('0x3d')][_0x834e('0x60')](_0x363cc2[_0x834e('0x5f')],{'raw':!![]})[_0x834e('0x1e')](function(_0x3181af){_0x5a4854=_0x3181af;return db[_0x834e('0x3d')][_0x834e('0x52')]({'raw':!![]});})[_0x834e('0x1e')](function(_0x376f72){var _0x324f67=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0x51cfab=fs[_0x834e('0x6a')](path['join'](config['root'],'server/files/templates/registry.ejs'),_0x834e('0x69'));var _0x332d8f=ejs['render'](_0x324f67,{'trunks':_0x376f72||[]});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x332d8f);if(_0x5a4854['registry']){var _0x353246=ejs[_0x834e('0x6d')](_0x51cfab,{'trunks':_0x376f72||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x353246);}})[_0x834e('0x1e')](function(){return respondWithRpcPromise(_0x834e('0x6e'),_0x834e('0x60'),{'module':_0x834e('0x6f')});})[_0x834e('0x1e')](function(){var _0x493239=_0x363cc2[_0x834e('0x61')]['get']({'plain':!![]});if(!_0x493239)throw new Error(_0x834e('0x62'));if(_0x493239[_0x834e('0x63')]===_0x834e('0x61')){var _0x5afb41=_0x5a4854[_0x834e('0x36')]({'plain':!![]});return db[_0x834e('0x70')]['find']({'where':{'name':_0x834e('0x37'),'userProfileId':_0x493239[_0x834e('0x64')]},'raw':!![]})[_0x834e('0x1e')](function(_0x50d0a3){if(_0x50d0a3&&_0x50d0a3[_0x834e('0x65')]===0x0){return db[_0x834e('0x38')][_0x834e('0x60')]({'name':_0x5afb41[_0x834e('0x3a')],'resourceId':_0x5afb41['id'],'type':_0x50d0a3[_0x834e('0x3a')],'sectionId':_0x50d0a3['id']},{})[_0x834e('0x1e')](function(){return _0x5a4854;});}else{return _0x5a4854;}})[_0x834e('0x54')](function(_0x23b5d9){logger[_0x834e('0x24')](_0x834e('0x71'),_0x23b5d9);throw _0x23b5d9;});}return _0x5a4854;})['then'](respondWithResult(_0x2cca07,0xc9))['catch'](handleError(_0x2cca07,null));};exports['update']=function(_0x36ede9,_0x1135a5,_0x313c03){var _0x37fa2c;return db[_0x834e('0x3d')]['find']({'where':{'id':_0x36ede9['params']['id']}})[_0x834e('0x1e')](handleEntityNotFound(_0x1135a5,null))[_0x834e('0x1e')](saveUpdates(_0x36ede9[_0x834e('0x5f')],null))[_0x834e('0x1e')](function(_0x40a705){if(_0x40a705){_0x37fa2c=_0x40a705;return db['Trunk'][_0x834e('0x52')]({'raw':!![]});}})[_0x834e('0x1e')](function(_0x113714){if(_0x113714){var _0x4e1735=fs[_0x834e('0x6a')](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0x585d02=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],'server/files/templates/registry.ejs'),_0x834e('0x69'));var _0x509427=ejs[_0x834e('0x6d')](_0x4e1735,{'trunks':_0x113714||[]});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x509427);var _0x53012d=ejs[_0x834e('0x6d')](_0x585d02,{'trunks':_0x113714||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x53012d);return respondWithRpcPromise('Reload',_0x834e('0x34'),{'module':_0x834e('0x6f')});}return null;})[_0x834e('0x1e')](function(_0x1d76c6){if(_0x1d76c6){return _0x37fa2c;}})[_0x834e('0x1e')](respondWithResult(_0x1135a5,null))[_0x834e('0x54')](handleError(_0x1135a5,null));};exports[_0x834e('0x35')]=function(_0x179892,_0x17e61a,_0x53f6e3){var _0x2f775a;return db['Trunk'][_0x834e('0x59')]({'where':{'id':_0x179892[_0x834e('0x56')]['id']}})[_0x834e('0x1e')](handleEntityNotFound(_0x17e61a,null))[_0x834e('0x1e')](removeEntity(_0x17e61a,null))[_0x834e('0x1e')](function(){return db[_0x834e('0x3d')]['findAll']({'raw':!![]});})['then'](function(_0xeb096d){var _0x2a854a=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0xc75f5e=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x5ede29=ejs[_0x834e('0x6d')](_0x2a854a,{'trunks':_0xeb096d});var _0x1f3e26=ejs['render'](_0xc75f5e,{'trunks':_0xeb096d});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x5ede29);fs['writeFileSync'](_0x834e('0x72'),_0x1f3e26);return respondWithRpcPromise('Reload','destroy',{'module':_0x834e('0x6f')});})[_0x834e('0x54')](handleError(_0x17e61a,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index ebdc6ca..a0177c6 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 _0x51e1=['../../config/environment','./trunk.attributes','exports','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x1b2844,_0x24f744){var _0x477498=function(_0x2b45a3){while(--_0x2b45a3){_0x1b2844['push'](_0x1b2844['shift']());}};_0x477498(++_0x24f744);}(_0x51e1,0x16c));var _0x151e=function(_0x3c04ef,_0x9d110c){_0x3c04ef=_0x3c04ef-0x0;var _0x6a3a69=_0x51e1[_0x3c04ef];return _0x6a3a69;};'use strict';var _=require(_0x151e('0x0'));var util=require(_0x151e('0x1'));var logger=require(_0x151e('0x2'))(_0x151e('0x3'));var moment=require(_0x151e('0x4'));var BPromise=require(_0x151e('0x5'));var rp=require(_0x151e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x151e('0x7'));var config=require(_0x151e('0x8'));var attributes=require(_0x151e('0x9'));module[_0x151e('0xa')]=function(_0x3b8d08,_0x31d72b){return _0x3b8d08['define']('Trunk',attributes,{'tableName':_0x151e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x93d4=['rimraf','../../config/environment','exports','define','tools_trunks','lodash','util','api','moment','request-promise'];(function(_0x1edfd5,_0x4379a2){var _0x2cfe40=function(_0x4d6d7a){while(--_0x4d6d7a){_0x1edfd5['push'](_0x1edfd5['shift']());}};_0x2cfe40(++_0x4379a2);}(_0x93d4,0x1b3));var _0x493d=function(_0xec673d,_0x38b799){_0xec673d=_0xec673d-0x0;var _0x3b2215=_0x93d4[_0xec673d];return _0x3b2215;};'use strict';var _=require(_0x493d('0x0'));var util=require(_0x493d('0x1'));var logger=require('../../config/logger')(_0x493d('0x2'));var moment=require(_0x493d('0x3'));var BPromise=require('bluebird');var rp=require(_0x493d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x493d('0x5'));var config=require(_0x493d('0x6'));var attributes=require('./trunk.attributes');module[_0x493d('0x7')]=function(_0x17f950,_0x4a4b40){return _0x17f950[_0x493d('0x8')]('Trunk',attributes,{'tableName':_0x493d('0x9'),'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 c4a1537..49a68bf 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 _0x5715=['limit','include','map','model','ShowTrunk','find','where','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrunk','Trunk','findAll','options','raw','attributes'];(function(_0x41a321,_0x56b843){var _0x2459bd=function(_0x3ff83c){while(--_0x3ff83c){_0x41a321['push'](_0x41a321['shift']());}};_0x2459bd(++_0x56b843);}(_0x5715,0x1e3));var _0x5571=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x5715[_0x2df507];return _0x1f7167;};'use strict';var _=require(_0x5571('0x0'));var util=require('util');var moment=require(_0x5571('0x1'));var BPromise=require(_0x5571('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5571('0x3'));var db=require(_0x5571('0x4'))['db'];var utils=require(_0x5571('0x5'));var logger=require(_0x5571('0x6'))('rpc');var config=require(_0x5571('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5571('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x379d76,_0x535560,_0x17b890){return new BPromise(function(_0x1333d4,_0x504e54){return client[_0x5571('0x9')](_0x379d76,_0x17b890)[_0x5571('0xa')](function(_0x3b5dd3){logger[_0x5571('0xb')](_0x5571('0xc'),_0x535560,_0x5571('0xd'));logger['debug'](_0x5571('0xe'),_0x535560,_0x5571('0xd'),JSON[_0x5571('0xf')](_0x3b5dd3));if(_0x3b5dd3[_0x5571('0x10')]){if(_0x3b5dd3['error'][_0x5571('0x11')]===0x1f4){logger['error'](_0x5571('0xc'),_0x535560,_0x3b5dd3[_0x5571('0x10')][_0x5571('0x12')]);return _0x504e54(_0x3b5dd3['error'][_0x5571('0x12')]);}logger[_0x5571('0x10')]('Trunk,\x20%s,\x20%s',_0x535560,_0x3b5dd3[_0x5571('0x10')][_0x5571('0x12')]);return _0x1333d4(_0x3b5dd3['error']['message']);}else{logger[_0x5571('0xb')]('Trunk,\x20%s,\x20%s',_0x535560,_0x5571('0xd'));_0x1333d4(_0x3b5dd3[_0x5571('0x13')]['message']);}})[_0x5571('0x14')](function(_0x1eab59){logger[_0x5571('0x10')]('Trunk,\x20%s,\x20%s',_0x535560,_0x1eab59);_0x504e54(_0x1eab59);});});}exports[_0x5571('0x15')]=function(_0x20847f){var _0x2518e6=this;return new Promise(function(_0x5512fc,_0x18243c){return db[_0x5571('0x16')][_0x5571('0x17')]({'raw':_0x20847f['options']?_0x20847f[_0x5571('0x18')][_0x5571('0x19')]===undefined?!![]:![]:!![],'where':_0x20847f['options']?_0x20847f[_0x5571('0x18')]['where']||null:null,'attributes':_0x20847f[_0x5571('0x18')]?_0x20847f[_0x5571('0x18')][_0x5571('0x1a')]||null:null,'limit':_0x20847f[_0x5571('0x18')]?_0x20847f['options'][_0x5571('0x1b')]||null:null,'include':_0x20847f['options']?_0x20847f[_0x5571('0x18')][_0x5571('0x1c')]?_[_0x5571('0x1d')](_0x20847f[_0x5571('0x18')]['include'],function(_0x55d3db){return{'model':db[_0x55d3db['model']],'as':_0x55d3db['as'],'attributes':_0x55d3db[_0x5571('0x1a')],'include':_0x55d3db[_0x5571('0x1c')]?_[_0x5571('0x1d')](_0x55d3db[_0x5571('0x1c')],function(_0x45d564){return{'model':db[_0x45d564['model']],'as':_0x45d564['as'],'attributes':_0x45d564[_0x5571('0x1a')],'include':_0x45d564['include']?_[_0x5571('0x1d')](_0x45d564['include'],function(_0x3d7dde){return{'model':db[_0x3d7dde[_0x5571('0x1e')]],'as':_0x3d7dde['as'],'attributes':_0x3d7dde[_0x5571('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5571('0xa')](function(_0x3c2dc1){logger[_0x5571('0xb')]('GetTrunk',_0x20847f);logger['debug']('GetTrunk',_0x20847f,JSON['stringify'](_0x3c2dc1));_0x5512fc(_0x3c2dc1);})[_0x5571('0x14')](function(_0x587377){logger[_0x5571('0x10')](_0x5571('0x15'),_0x587377[_0x5571('0x12')],_0x20847f);_0x18243c(_0x2518e6['error'](0x1f4,_0x587377[_0x5571('0x12')]));});});};exports[_0x5571('0x1f')]=function(_0x3f2cb2){var _0xe7bb2a=this;return new Promise(function(_0x489f43,_0x4b3639){return db[_0x5571('0x16')][_0x5571('0x20')]({'raw':_0x3f2cb2['options']?_0x3f2cb2[_0x5571('0x18')][_0x5571('0x19')]===undefined?!![]:![]:!![],'where':_0x3f2cb2[_0x5571('0x18')]?_0x3f2cb2[_0x5571('0x18')][_0x5571('0x21')]||null:null,'attributes':_0x3f2cb2['options']?_0x3f2cb2['options'][_0x5571('0x1a')]||null:null,'include':_0x3f2cb2[_0x5571('0x18')]?_0x3f2cb2[_0x5571('0x18')][_0x5571('0x1c')]?_[_0x5571('0x1d')](_0x3f2cb2[_0x5571('0x18')]['include'],function(_0x1818f3){return{'model':db[_0x1818f3[_0x5571('0x1e')]],'as':_0x1818f3['as'],'attributes':_0x1818f3[_0x5571('0x1a')],'include':_0x1818f3['include']?_['map'](_0x1818f3[_0x5571('0x1c')],function(_0x23345e){return{'model':db[_0x23345e[_0x5571('0x1e')]],'as':_0x23345e['as'],'attributes':_0x23345e['attributes'],'include':_0x23345e[_0x5571('0x1c')]?_[_0x5571('0x1d')](_0x23345e[_0x5571('0x1c')],function(_0x1ab32a){return{'model':db[_0x1ab32a[_0x5571('0x1e')]],'as':_0x1ab32a['as'],'attributes':_0x1ab32a[_0x5571('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x415d72){logger[_0x5571('0xb')]('ShowTrunk',_0x3f2cb2);logger['debug'](_0x5571('0x1f'),_0x3f2cb2,JSON[_0x5571('0xf')](_0x415d72));_0x489f43(_0x415d72);})[_0x5571('0x14')](function(_0x40d278){logger[_0x5571('0x10')](_0x5571('0x1f'),_0x40d278['message'],_0x3f2cb2);_0x4b3639(_0xe7bb2a[_0x5571('0x10')](0x1f4,_0x40d278[_0x5571('0x12')]));});});}; \ No newline at end of file +var _0x2319=['request','info','request\x20sent','debug','code','error','message','Trunk,\x20%s,\x20%s','result','catch','findAll','options','raw','attributes','limit','include','model','map','GetTrunk','stringify','Trunk','find','where','then','ShowTrunk','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2319,0xd2));var _0x9231=function(_0x28a4e0,_0x2da4a0){_0x28a4e0=_0x28a4e0-0x0;var _0x4c7503=_0x2319[_0x28a4e0];return _0x4c7503;};'use strict';var _=require(_0x9231('0x0'));var util=require(_0x9231('0x1'));var moment=require(_0x9231('0x2'));var BPromise=require(_0x9231('0x3'));var rs=require(_0x9231('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9231('0x5'));var logger=require(_0x9231('0x6'))(_0x9231('0x7'));var config=require(_0x9231('0x8'));var jayson=require(_0x9231('0x9'));var client=jayson[_0x9231('0xa')][_0x9231('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a02ad,_0x348adf,_0xfc8334){return new BPromise(function(_0x162b6e,_0x406c38){return client[_0x9231('0xc')](_0x2a02ad,_0xfc8334)['then'](function(_0x52e29d){logger[_0x9231('0xd')]('Trunk,\x20%s,\x20%s',_0x348adf,_0x9231('0xe'));logger[_0x9231('0xf')]('Trunk,\x20%s,\x20%s,\x20%s',_0x348adf,_0x9231('0xe'),JSON['stringify'](_0x52e29d));if(_0x52e29d['error']){if(_0x52e29d['error'][_0x9231('0x10')]===0x1f4){logger[_0x9231('0x11')]('Trunk,\x20%s,\x20%s',_0x348adf,_0x52e29d[_0x9231('0x11')][_0x9231('0x12')]);return _0x406c38(_0x52e29d[_0x9231('0x11')]['message']);}logger[_0x9231('0x11')](_0x9231('0x13'),_0x348adf,_0x52e29d[_0x9231('0x11')][_0x9231('0x12')]);return _0x162b6e(_0x52e29d['error'][_0x9231('0x12')]);}else{logger[_0x9231('0xd')](_0x9231('0x13'),_0x348adf,_0x9231('0xe'));_0x162b6e(_0x52e29d[_0x9231('0x14')]['message']);}})[_0x9231('0x15')](function(_0xce6805){logger[_0x9231('0x11')]('Trunk,\x20%s,\x20%s',_0x348adf,_0xce6805);_0x406c38(_0xce6805);});});}exports['GetTrunk']=function(_0x1240c1){var _0x48393b=this;return new Promise(function(_0x3fba71,_0x457a0e){return db['Trunk'][_0x9231('0x16')]({'raw':_0x1240c1[_0x9231('0x17')]?_0x1240c1[_0x9231('0x17')][_0x9231('0x18')]===undefined?!![]:![]:!![],'where':_0x1240c1[_0x9231('0x17')]?_0x1240c1[_0x9231('0x17')]['where']||null:null,'attributes':_0x1240c1[_0x9231('0x17')]?_0x1240c1['options'][_0x9231('0x19')]||null:null,'limit':_0x1240c1[_0x9231('0x17')]?_0x1240c1[_0x9231('0x17')][_0x9231('0x1a')]||null:null,'include':_0x1240c1[_0x9231('0x17')]?_0x1240c1[_0x9231('0x17')]['include']?_['map'](_0x1240c1[_0x9231('0x17')][_0x9231('0x1b')],function(_0x518784){return{'model':db[_0x518784[_0x9231('0x1c')]],'as':_0x518784['as'],'attributes':_0x518784['attributes'],'include':_0x518784[_0x9231('0x1b')]?_[_0x9231('0x1d')](_0x518784[_0x9231('0x1b')],function(_0x32628b){return{'model':db[_0x32628b[_0x9231('0x1c')]],'as':_0x32628b['as'],'attributes':_0x32628b['attributes'],'include':_0x32628b['include']?_[_0x9231('0x1d')](_0x32628b[_0x9231('0x1b')],function(_0x46eca1){return{'model':db[_0x46eca1[_0x9231('0x1c')]],'as':_0x46eca1['as'],'attributes':_0x46eca1[_0x9231('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23694a){logger[_0x9231('0xd')]('GetTrunk',_0x1240c1);logger[_0x9231('0xf')](_0x9231('0x1e'),_0x1240c1,JSON[_0x9231('0x1f')](_0x23694a));_0x3fba71(_0x23694a);})['catch'](function(_0x29e8c9){logger[_0x9231('0x11')](_0x9231('0x1e'),_0x29e8c9['message'],_0x1240c1);_0x457a0e(_0x48393b['error'](0x1f4,_0x29e8c9['message']));});});};exports['ShowTrunk']=function(_0x193b58){var _0x2e446=this;return new Promise(function(_0x567e66,_0x373103){return db[_0x9231('0x20')][_0x9231('0x21')]({'raw':_0x193b58['options']?_0x193b58['options'][_0x9231('0x18')]===undefined?!![]:![]:!![],'where':_0x193b58[_0x9231('0x17')]?_0x193b58[_0x9231('0x17')][_0x9231('0x22')]||null:null,'attributes':_0x193b58['options']?_0x193b58[_0x9231('0x17')][_0x9231('0x19')]||null:null,'include':_0x193b58['options']?_0x193b58[_0x9231('0x17')][_0x9231('0x1b')]?_[_0x9231('0x1d')](_0x193b58[_0x9231('0x17')][_0x9231('0x1b')],function(_0x98eb1){return{'model':db[_0x98eb1[_0x9231('0x1c')]],'as':_0x98eb1['as'],'attributes':_0x98eb1[_0x9231('0x19')],'include':_0x98eb1[_0x9231('0x1b')]?_['map'](_0x98eb1['include'],function(_0x1ca833){return{'model':db[_0x1ca833[_0x9231('0x1c')]],'as':_0x1ca833['as'],'attributes':_0x1ca833[_0x9231('0x19')],'include':_0x1ca833['include']?_[_0x9231('0x1d')](_0x1ca833[_0x9231('0x1b')],function(_0x1ca6f1){return{'model':db[_0x1ca6f1['model']],'as':_0x1ca6f1['as'],'attributes':_0x1ca6f1[_0x9231('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9231('0x23')](function(_0x14cab4){logger['info'](_0x9231('0x24'),_0x193b58);logger['debug'](_0x9231('0x24'),_0x193b58,JSON['stringify'](_0x14cab4));_0x567e66(_0x14cab4);})[_0x9231('0x15')](function(_0x48a238){logger[_0x9231('0x11')](_0x9231('0x24'),_0x48a238[_0x9231('0x12')],_0x193b58);_0x373103(_0x2e446[_0x9231('0x11')](0x1f4,_0x48a238[_0x9231('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index ced460f..04a1508 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 _0x29f3=['/:id','isAuthenticated','exports','../../components/auth/service','./user-setting.controller'];(function(_0x59b14a,_0x1be3a6){var _0x174bc5=function(_0xa6cafb){while(--_0xa6cafb){_0x59b14a['push'](_0x59b14a['shift']());}};_0x174bc5(++_0x1be3a6);}(_0x29f3,0x16b));var _0x329f=function(_0x5f3a9a,_0x464476){_0x5f3a9a=_0x5f3a9a-0x0;var _0x543c23=_0x29f3[_0x5f3a9a];return _0x543c23;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x329f('0x0'));var controller=require(_0x329f('0x1'));router['put'](_0x329f('0x2'),auth[_0x329f('0x3')](),controller['update']);module[_0x329f('0x4')]=router; \ No newline at end of file +var _0x924e=['./user-setting.controller','/:id','update','exports','../../components/auth/service'];(function(_0x5e782b,_0x15bdde){var _0x46f9c9=function(_0x283bc7){while(--_0x283bc7){_0x5e782b['push'](_0x5e782b['shift']());}};_0x46f9c9(++_0x15bdde);}(_0x924e,0x1d5));var _0xe924=function(_0x4a0ede,_0x3b6018){_0x4a0ede=_0x4a0ede-0x0;var _0x256e26=_0x924e[_0x4a0ede];return _0x256e26;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xe924('0x0'));var controller=require(_0xe924('0x1'));router['put'](_0xe924('0x2'),auth['isAuthenticated'](),controller[_0xe924('0x3')]);module[_0xe924('0x4')]=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 1b93dd3..2795f0a 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 _0xea37=['exports','ENUM','BOOLEAN','DATE','INTEGER','error','warning','info','debug'];(function(_0x45c489,_0x5a55ac){var _0x4ba812=function(_0x778206){while(--_0x778206){_0x45c489['push'](_0x45c489['shift']());}};_0x4ba812(++_0x5a55ac);}(_0xea37,0xdd));var _0x7ea3=function(_0x385603,_0x1cf762){_0x385603=_0x385603-0x0;var _0x2e10ca=_0xea37[_0x385603];return _0x2e10ca;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x7ea3('0x0'),_0x7ea3('0x1'),_0x7ea3('0x2'),_0x7ea3('0x3')];module[_0x7ea3('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0x7ea3('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x7ea3('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x7ea3('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x7ea3('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x7ea3('0x8')],'unique':'UserId'}}; \ No newline at end of file +var _0x0f0b=['ENUM','TEXT','INTEGER','sequelize','error','warning'];(function(_0x36940e,_0x11f338){var _0x3283f2=function(_0x418008){while(--_0x418008){_0x36940e['push'](_0x36940e['shift']());}};_0x3283f2(++_0x11f338);}(_0x0f0b,0x129));var _0xb0f0=function(_0x1961aa,_0xd9e760){_0x1961aa=_0x1961aa-0x0;var _0x597cb9=_0x0f0b[_0x1961aa];return _0x597cb9;};'use strict';var Sequelize=require(_0xb0f0('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xb0f0('0x1'),_0xb0f0('0x2'),'info','debug'];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0xb0f0('0x3')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xb0f0('0x4')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xb0f0('0x5')],'unique':'UserId'}}; \ 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 5fe1242..c1f481f 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 _0x142c=['sendStatus','error','stack','name','send','update','role','params','Invalid\x20user\x20setting\x20id','UserSetting','find','then','body','catch','lodash','../../config/logger','api','../../config/environment','socket.io-emitter','redis'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x142c,0x86));var _0xc142=function(_0x113de8,_0x12aa03){_0x113de8=_0x113de8-0x0;var _0xd3c67a=_0x142c[_0x113de8];return _0xd3c67a;};'use strict';var _=require(_0xc142('0x0'));var Redis=require('ioredis');var logger=require(_0xc142('0x1'))(_0xc142('0x2'));var config=require(_0xc142('0x3'));var db=require('../../mysqldb')['db'];var socket=require(_0xc142('0x4'))(new Redis(config[_0xc142('0x5')]));require('./user-setting.socket')['register'](socket);config[_0xc142('0x5')]=_['defaults'](config[_0xc142('0x5')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x2d6796,_0x43226a){_0x43226a=_0x43226a||0xc8;return function(_0x30bf01){if(_0x30bf01){return _0x2d6796['status'](_0x43226a)['json'](_0x30bf01);}};}function saveUpdates(_0x27abe2){return function(_0x10ce67){if(_0x10ce67){return _0x10ce67['update'](_0x27abe2)['then'](function(_0x128066){return _0x128066;});}return null;};}function handleEntityNotFound(_0xc9a6a0){return function(_0x565b60){if(!_0x565b60){_0xc9a6a0[_0xc142('0x6')](0x194);}return _0x565b60;};}function handleError(_0x487384,_0x3d404d){_0x3d404d=_0x3d404d||0x1f4;return function(_0x5cf72b){logger[_0xc142('0x7')](_0x5cf72b[_0xc142('0x8')]);if(_0x5cf72b[_0xc142('0x9')]){delete _0x5cf72b[_0xc142('0x9')];}_0x487384['status'](_0x3d404d)[_0xc142('0xa')](_0x5cf72b);};}exports[_0xc142('0xb')]=function(_0x4a6370,_0x252f5f){if(_0x4a6370['user'][_0xc142('0xc')]!=='admin')throw new Error('Unauthorized');if(isNaN(Number(_0x4a6370[_0xc142('0xd')]['id'])))throw new Error(_0xc142('0xe'));return db[_0xc142('0xf')][_0xc142('0x10')]({'where':{'id':_0x4a6370['params']['id']}})[_0xc142('0x11')](handleEntityNotFound(_0x252f5f,null))[_0xc142('0x11')](saveUpdates(_0x4a6370[_0xc142('0x12')],null))[_0xc142('0x11')](respondWithResult(_0x252f5f,null))[_0xc142('0x13')](handleError(_0x252f5f,null));}; \ No newline at end of file +var _0x60c2=['params','Invalid\x20user\x20setting\x20id','find','body','catch','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','status','update','then','stack','name','send','user','admin'];(function(_0x4f443f,_0x45551d){var _0x43a99e=function(_0x5b61c4){while(--_0x5b61c4){_0x4f443f['push'](_0x4f443f['shift']());}};_0x43a99e(++_0x45551d);}(_0x60c2,0x8f));var _0x260c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x60c2[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var Redis=require(_0x260c('0x0'));var logger=require(_0x260c('0x1'))(_0x260c('0x2'));var config=require(_0x260c('0x3'));var db=require(_0x260c('0x4'))['db'];var socket=require(_0x260c('0x5'))(new Redis(config[_0x260c('0x6')]));require(_0x260c('0x7'))[_0x260c('0x8')](socket);config[_0x260c('0x6')]=_[_0x260c('0x9')](config[_0x260c('0x6')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x14fab2,_0x2c2cd8){_0x2c2cd8=_0x2c2cd8||0xc8;return function(_0x3b432d){if(_0x3b432d){return _0x14fab2[_0x260c('0xa')](_0x2c2cd8)['json'](_0x3b432d);}};}function saveUpdates(_0xb36958){return function(_0x3cb2c9){if(_0x3cb2c9){return _0x3cb2c9[_0x260c('0xb')](_0xb36958)[_0x260c('0xc')](function(_0x31ce20){return _0x31ce20;});}return null;};}function handleEntityNotFound(_0x1164e9){return function(_0x152730){if(!_0x152730){_0x1164e9['sendStatus'](0x194);}return _0x152730;};}function handleError(_0x2f4c2c,_0x1943ca){_0x1943ca=_0x1943ca||0x1f4;return function(_0x1652b3){logger['error'](_0x1652b3[_0x260c('0xd')]);if(_0x1652b3[_0x260c('0xe')]){delete _0x1652b3[_0x260c('0xe')];}_0x2f4c2c['status'](_0x1943ca)[_0x260c('0xf')](_0x1652b3);};}exports[_0x260c('0xb')]=function(_0x43085e,_0x280270){if(_0x43085e[_0x260c('0x10')]['role']!==_0x260c('0x11'))throw new Error('Unauthorized');if(isNaN(Number(_0x43085e[_0x260c('0x12')]['id'])))throw new Error(_0x260c('0x13'));return db['UserSetting'][_0x260c('0x14')]({'where':{'id':_0x43085e['params']['id']}})[_0x260c('0xc')](handleEntityNotFound(_0x280270,null))[_0x260c('0xc')](saveUpdates(_0x43085e[_0x260c('0x15')],null))[_0x260c('0xc')](respondWithResult(_0x280270,null))[_0x260c('0x16')](handleError(_0x280270,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 34266dc..1d05af4 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 _0x20ec=['remove','emit','hasOwnProperty','exports','../../mysqldb','UserSetting','save','update'];(function(_0x999180,_0x265b67){var _0x411528=function(_0x3bc1c5){while(--_0x3bc1c5){_0x999180['push'](_0x999180['shift']());}};_0x411528(++_0x265b67);}(_0x20ec,0x19c));var _0xc20e=function(_0xc82d1a,_0x145c50){_0xc82d1a=_0xc82d1a-0x0;var _0x32fad2=_0x20ec[_0xc82d1a];return _0x32fad2;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0xc20e('0x0'))['db'][_0xc20e('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc20e('0x2'),'afterUpdate':_0xc20e('0x3'),'afterDestroy':_0xc20e('0x4')};function emitEvent(_0x2d0679){return function(_0x2a3492,_0x763628,_0x4ae826){UserSettingEvents[_0xc20e('0x5')](_0x2d0679+':'+_0x2a3492['id'],_0x2a3492);UserSettingEvents[_0xc20e('0x5')](_0x2d0679,_0x2a3492);_0x4ae826(null);};}for(var e in events){if(events[_0xc20e('0x6')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0xc20e('0x7')]=UserSettingEvents; \ No newline at end of file +var _0x5e95=['remove','emit','hasOwnProperty','exports','../../mysqldb','save','update'];(function(_0x3cdfa6,_0x22fb9f){var _0x39bcc9=function(_0x12120a){while(--_0x12120a){_0x3cdfa6['push'](_0x3cdfa6['shift']());}};_0x39bcc9(++_0x22fb9f);}(_0x5e95,0x1ee));var _0x55e9=function(_0x20beaf,_0x23a24d){_0x20beaf=_0x20beaf-0x0;var _0x2bd9a6=_0x5e95[_0x20beaf];return _0x2bd9a6;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x55e9('0x0'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x55e9('0x1'),'afterUpdate':_0x55e9('0x2'),'afterDestroy':_0x55e9('0x3')};function emitEvent(_0xb39548){return function(_0x4c9058,_0x9ccaae,_0x5c03d4){UserSettingEvents[_0x55e9('0x4')](_0xb39548+':'+_0x4c9058['id'],_0x4c9058);UserSettingEvents['emit'](_0xb39548,_0x4c9058);_0x5c03d4(null);};}for(var e in events){if(events[_0x55e9('0x5')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x55e9('0x6')]=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 7a1ed2f..c78c5e2 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 _0xd4dc=['user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','define','UserSetting'];(function(_0x397476,_0x40ebb5){var _0x4473ce=function(_0x669b3a){while(--_0x669b3a){_0x397476['push'](_0x397476['shift']());}};_0x4473ce(++_0x40ebb5);}(_0xd4dc,0xff));var _0xcd4d=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xd4dc[_0x59ee6f];return _0x4c0979;};'use strict';var attributes=require(_0xcd4d('0x0'));module['exports']=function(_0x2712ce){return _0x2712ce[_0xcd4d('0x1')](_0xcd4d('0x2'),attributes,{'tableName':_0xcd4d('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1e7c24){if(!_0x1e7c24[_0xcd4d('0x4')])_0x1e7c24[_0xcd4d('0x5')]=null;else if(_0x1e7c24['clientSideLoggingEnabledSince']===null)_0x1e7c24[_0xcd4d('0x5')]=new Date();}}});}; \ No newline at end of file +var _0x1491=['clientSideLoggingEnabledSince','./user-setting.attributes','exports','define','user_settings','clientSideLoggingEnabled'];(function(_0x38f136,_0x152627){var _0x2c5115=function(_0x4b90fd){while(--_0x4b90fd){_0x38f136['push'](_0x38f136['shift']());}};_0x2c5115(++_0x152627);}(_0x1491,0x1b1));var _0x1149=function(_0x54c51e,_0x2a7547){_0x54c51e=_0x54c51e-0x0;var _0x527506=_0x1491[_0x54c51e];return _0x527506;};'use strict';var attributes=require(_0x1149('0x0'));module[_0x1149('0x1')]=function(_0x2660c5){return _0x2660c5[_0x1149('0x2')]('UserSetting',attributes,{'tableName':_0x1149('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2e6865){if(!_0x2e6865[_0x1149('0x4')])_0x2e6865[_0x1149('0x5')]=null;else if(_0x2e6865[_0x1149('0x5')]===null)_0x2e6865[_0x1149('0x5')]=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 5eb859b..b0449de 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 _0x7ee6=['length','user-setting:','save','remove','update','user-setting:update','emit','user-setting:update:user-','UserId'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7ee6,0x1a0));var _0x67ee=function(_0x4c1f27,_0x2eb028){_0x4c1f27=_0x4c1f27-0x0;var _0x28849b=_0x7ee6[_0x4c1f27];return _0x28849b;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x67ee('0x0'),_0x67ee('0x1'),_0x67ee('0x2')];function createListener(_0x5e73ec,_0x46ac51){return function(_0x331af4){_0x46ac51['emit'](_0x5e73ec,_0x331af4);if(_0x5e73ec===_0x67ee('0x3')){_0x46ac51[_0x67ee('0x4')](_0x67ee('0x5')+_0x331af4[_0x67ee('0x6')],_0x331af4);}};}exports['register']=function(_0x5a1216){for(var _0x1e4e9e=0x0,_0x2bef52=events[_0x67ee('0x7')];_0x1e4e9e<_0x2bef52;_0x1e4e9e++){var _0x4047fc=events[_0x1e4e9e];var _0x1551ab=createListener(_0x67ee('0x8')+_0x4047fc,_0x5a1216);UserSettingEvents['on'](_0x4047fc,_0x1551ab);}}; \ No newline at end of file +var _0x9574=['save','update','emit','user-setting:update:user-','UserId'];(function(_0x4c3409,_0x2194fe){var _0x35a402=function(_0x11b8c7){while(--_0x11b8c7){_0x4c3409['push'](_0x4c3409['shift']());}};_0x35a402(++_0x2194fe);}(_0x9574,0x186));var _0x4957=function(_0x2a48c2,_0x14cdaa){_0x2a48c2=_0x2a48c2-0x0;var _0x44e111=_0x9574[_0x2a48c2];return _0x44e111;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x4957('0x0'),'remove',_0x4957('0x1')];function createListener(_0x419ca2,_0x580276){return function(_0xf260d){_0x580276[_0x4957('0x2')](_0x419ca2,_0xf260d);if(_0x419ca2==='user-setting:update'){_0x580276[_0x4957('0x2')](_0x4957('0x3')+_0xf260d[_0x4957('0x4')],_0xf260d);}};}exports['register']=function(_0xbfe42e){for(var _0x535a1f=0x0,_0x3e00ef=events['length'];_0x535a1f<_0x3e00ef;_0x535a1f++){var _0x439fb4=events[_0x535a1f];var _0xdc32a9=createListener('user-setting:'+_0x439fb4,_0xbfe42e);UserSettingEvents['on'](_0x439fb4,_0xdc32a9);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 378fc3c..95282a6 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 _0x652d=['/:id/sms_interactions','addSmsInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','/:id','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeChatWebsites','removeWhatsappAccounts','messengerSoundNotification','exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','/describe','describe','/whoami','whoami','getPresence','/:id/avatar','getOpenTabs','getContacts','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','getAgents','/:id/prefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/api_key','/:id/contacts','addContacts','create','post','/create_many','bulkCreate','/:id/queues','addQueues','diskStorage','join','root','server/files/images/','%s-%s','now','originalname','single','addAvatar','login','/:id/logout','logout','/:id/pause','pause','unpause','/:id/mail_interactions','addMailInteractions'];(function(_0x52893b,_0x12b7da){var _0x2c3bbc=function(_0x41e383){while(--_0x41e383){_0x52893b['push'](_0x52893b['shift']());}};_0x2c3bbc(++_0x12b7da);}(_0x652d,0x1a0));var _0xd652=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x652d[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require(_0xd652('0x0'));var path=require(_0xd652('0x1'));var timeout=require(_0xd652('0x2'));var express=require(_0xd652('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd652('0x4'));var config=require(_0xd652('0x5'));var controller=require(_0xd652('0x6'));router['get']('/',auth[_0xd652('0x7')](),controller[_0xd652('0x8')]);router[_0xd652('0x9')](_0xd652('0xa'),auth['isAuthenticated'](),controller[_0xd652('0xb')]);router[_0xd652('0x9')](_0xd652('0xc'),auth[_0xd652('0x7')](),controller[_0xd652('0xd')]);router[_0xd652('0x9')]('/presence',auth['isAuthenticated'](),controller[_0xd652('0xe')]);router[_0xd652('0x9')]('/:id',auth[_0xd652('0x7')](),controller['show']);router[_0xd652('0x9')](_0xd652('0xf'),controller['getAvatar']);router[_0xd652('0x9')]('/:id/open_tabs',auth[_0xd652('0x7')](),controller[_0xd652('0x10')]);router[_0xd652('0x9')]('/:id/contacts',auth[_0xd652('0x7')](),controller[_0xd652('0x11')]);router[_0xd652('0x9')]('/:id/queues',auth[_0xd652('0x7')](),controller['getQueues']);router[_0xd652('0x9')](_0xd652('0x12'),auth[_0xd652('0x7')](),controller[_0xd652('0x13')]);router[_0xd652('0x9')](_0xd652('0x14'),auth['isAuthenticated'](),controller[_0xd652('0x15')]);router['get']('/:id/recordings',auth[_0xd652('0x7')](),controller[_0xd652('0x16')]);router[_0xd652('0x9')]('/:id/screen_recordings',auth[_0xd652('0x7')](),controller[_0xd652('0x17')]);router[_0xd652('0x9')](_0xd652('0x18'),auth[_0xd652('0x7')](),controller[_0xd652('0x19')]);router[_0xd652('0x9')]('/:id/openchannel/interactions',auth[_0xd652('0x7')](),controller[_0xd652('0x1a')]);router[_0xd652('0x9')](_0xd652('0x1b'),auth[_0xd652('0x7')](),controller[_0xd652('0x1c')]);router['get'](_0xd652('0x1d'),auth[_0xd652('0x7')](),controller[_0xd652('0x1e')]);router[_0xd652('0x9')](_0xd652('0x1f'),auth[_0xd652('0x7')](),controller[_0xd652('0x20')]);router['get'](_0xd652('0x21'),auth[_0xd652('0x7')](),controller[_0xd652('0x22')]);router[_0xd652('0x9')](_0xd652('0x23'),auth['isAuthenticated'](),controller['getTeams']);router['get'](_0xd652('0x24'),auth[_0xd652('0x7')](),controller[_0xd652('0x25')]);router[_0xd652('0x9')]('/:id/agents',auth['isAuthenticated'](),controller[_0xd652('0x26')]);router[_0xd652('0x9')](_0xd652('0x27'),auth[_0xd652('0x7')](),controller['getVoicePrefixes']);router[_0xd652('0x9')](_0xd652('0x28'),auth[_0xd652('0x7')](),controller['getFaxAccounts']);router[_0xd652('0x9')](_0xd652('0x29'),auth[_0xd652('0x7')](),controller[_0xd652('0x2a')]);router['get'](_0xd652('0x2b'),auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router[_0xd652('0x9')](_0xd652('0x2c'),auth[_0xd652('0x7')](),controller['getSmsAccounts']);router[_0xd652('0x9')](_0xd652('0x2d'),auth['isAuthenticated'](),controller[_0xd652('0x2e')]);router[_0xd652('0x9')](_0xd652('0x2f'),auth[_0xd652('0x7')](),controller['getWhatsappAccounts']);router[_0xd652('0x9')]('/:id/scheduled_calls',auth['isAuthenticated'](),controller['getScheduledCalls']);router[_0xd652('0x9')](_0xd652('0x30'),auth[_0xd652('0x7')](),controller['getApiKey']);router['post'](_0xd652('0x31'),auth[_0xd652('0x7')](),controller[_0xd652('0x32')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd652('0x33')]);router[_0xd652('0x34')](_0xd652('0x35'),auth['isAuthenticated'](),controller[_0xd652('0x36')]);router['post'](_0xd652('0x37'),auth['isAuthenticated'](),controller[_0xd652('0x38')]);var upload=multer({'storage':multer[_0xd652('0x39')]({'destination':function(_0x5bef9e,_0x3df1df,_0x38a2b4){_0x38a2b4(null,path[_0xd652('0x3a')](config[_0xd652('0x3b')],_0xd652('0x3c')));},'filename':function(_0x41552e,_0x18f69d,_0x2d655d){_0x2d655d(null,util['format'](_0xd652('0x3d'),Date[_0xd652('0x3e')](),_0x18f69d[_0xd652('0x3f')]));}})});router[_0xd652('0x34')]('/:id/avatar',upload[_0xd652('0x40')]('file'),controller[_0xd652('0x41')]);router[_0xd652('0x34')]('/:id/login',auth[_0xd652('0x7')](),controller[_0xd652('0x42')]);router[_0xd652('0x34')](_0xd652('0x43'),auth[_0xd652('0x7')](),controller[_0xd652('0x44')]);router[_0xd652('0x34')](_0xd652('0x45'),auth[_0xd652('0x7')](),controller[_0xd652('0x46')]);router[_0xd652('0x34')]('/:id/unpause',auth[_0xd652('0x7')](),controller[_0xd652('0x47')]);router[_0xd652('0x34')]('/:id/teams',auth[_0xd652('0x7')](),controller['addTeams']);router[_0xd652('0x34')]('/:id/chat_interactions',auth['isAuthenticated'](),controller['addChatInteractions']);router['post'](_0xd652('0x48'),auth['isAuthenticated'](),controller[_0xd652('0x49')]);router[_0xd652('0x34')]('/:id/fax_interactions',auth[_0xd652('0x7')](),controller['addFaxInteractions']);router[_0xd652('0x34')](_0xd652('0x4a'),auth[_0xd652('0x7')](),controller[_0xd652('0x4b')]);router[_0xd652('0x34')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller['addOpenchannelInteractions']);router[_0xd652('0x34')](_0xd652('0x4c'),auth[_0xd652('0x7')](),controller[_0xd652('0x4d')]);router['post']('/:id/fax_accounts',auth['isAuthenticated'](),controller['addFaxAccounts']);router[_0xd652('0x34')]('/:id/mail_accounts',auth[_0xd652('0x7')](),controller['addMailAccounts']);router['post']('/:id/openchannel_accounts',auth[_0xd652('0x7')](),controller['addOpenchannelAccounts']);router[_0xd652('0x34')]('/:id/sms_accounts',auth['isAuthenticated'](),controller['addSmsAccounts']);router[_0xd652('0x34')](_0xd652('0x2d'),auth['isAuthenticated'](),controller['addChatWebsites']);router['post']('/:id/whatsapp_accounts',auth[_0xd652('0x7')](),controller['addWhatsappAccounts']);router[_0xd652('0x34')]('/:id/api_key',auth[_0xd652('0x7')](),controller['createApiKey']);router[_0xd652('0x4e')]('/:id',auth['isAuthenticated'](),controller[_0xd652('0x4f')]);router[_0xd652('0x4e')](_0xd652('0x50'),auth[_0xd652('0x7')](),controller[_0xd652('0x51')]);router[_0xd652('0x52')]('/:id/queues',auth[_0xd652('0x7')](),controller[_0xd652('0x53')]);router[_0xd652('0x52')](_0xd652('0x23'),auth['isAuthenticated'](),controller[_0xd652('0x54')]);router[_0xd652('0x52')](_0xd652('0x55'),auth[_0xd652('0x7')](),controller['destroy']);router[_0xd652('0x52')]('/:id/chat_interactions',auth[_0xd652('0x7')](),controller['removeChatInteractions']);router[_0xd652('0x52')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0xd652('0x56')]);router[_0xd652('0x52')](_0xd652('0x57'),auth[_0xd652('0x7')](),controller[_0xd652('0x58')]);router[_0xd652('0x52')](_0xd652('0x4a'),auth[_0xd652('0x7')](),controller[_0xd652('0x59')]);router['delete'](_0xd652('0x5a'),auth[_0xd652('0x7')](),controller[_0xd652('0x5b')]);router[_0xd652('0x52')](_0xd652('0x4c'),auth[_0xd652('0x7')](),controller['removeWhatsappInteractions']);router[_0xd652('0x52')](_0xd652('0x28'),auth[_0xd652('0x7')](),controller[_0xd652('0x5c')]);router[_0xd652('0x52')](_0xd652('0x29'),auth[_0xd652('0x7')](),controller[_0xd652('0x5d')]);router[_0xd652('0x52')](_0xd652('0x2b'),auth[_0xd652('0x7')](),controller['removeOpenchannelAccounts']);router[_0xd652('0x52')](_0xd652('0x2c'),auth[_0xd652('0x7')](),controller['removeSmsAccounts']);router[_0xd652('0x52')]('/:id/chat_websites',auth[_0xd652('0x7')](),controller[_0xd652('0x5e')]);router[_0xd652('0x52')](_0xd652('0x2f'),auth['isAuthenticated'](),controller[_0xd652('0x5f')]);router[_0xd652('0x52')](_0xd652('0x30'),auth['isAuthenticated'](),controller['removeApiKey']);router[_0xd652('0x34')]('/:id/messengerSoundNotification',auth[_0xd652('0x7')](),controller[_0xd652('0x60')]);module[_0xd652('0x61')]=router; \ No newline at end of file +var _0x758a=['/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','/:id/password','delete','removeQueues','removeTeams','destroy','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','multer','util','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','describe','/whoami','whoami','/presence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','addQueues','join','format','%s-%s','originalname','single','file','addAvatar','/:id/login','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites'];(function(_0x185084,_0x9e4d22){var _0x43aab0=function(_0x136210){while(--_0x136210){_0x185084['push'](_0x185084['shift']());}};_0x43aab0(++_0x9e4d22);}(_0x758a,0x1d1));var _0xa758=function(_0x4de4d4,_0x140bea){_0x4de4d4=_0x4de4d4-0x0;var _0x41e533=_0x758a[_0x4de4d4];return _0x41e533;};'use strict';var multer=require(_0xa758('0x0'));var util=require(_0xa758('0x1'));var path=require(_0xa758('0x2'));var timeout=require(_0xa758('0x3'));var express=require(_0xa758('0x4'));var router=express[_0xa758('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa758('0x6'));var controller=require('./user.controller');router[_0xa758('0x7')]('/',auth[_0xa758('0x8')](),controller[_0xa758('0x9')]);router['get']('/describe',auth[_0xa758('0x8')](),controller[_0xa758('0xa')]);router[_0xa758('0x7')](_0xa758('0xb'),auth[_0xa758('0x8')](),controller[_0xa758('0xc')]);router['get'](_0xa758('0xd'),auth['isAuthenticated'](),controller['getPresence']);router[_0xa758('0x7')](_0xa758('0xe'),auth['isAuthenticated'](),controller[_0xa758('0xf')]);router[_0xa758('0x7')](_0xa758('0x10'),controller[_0xa758('0x11')]);router[_0xa758('0x7')](_0xa758('0x12'),auth[_0xa758('0x8')](),controller['getOpenTabs']);router['get'](_0xa758('0x13'),auth['isAuthenticated'](),controller['getContacts']);router[_0xa758('0x7')](_0xa758('0x14'),auth[_0xa758('0x8')](),controller['getQueues']);router['get'](_0xa758('0x15'),auth['isAuthenticated'](),controller[_0xa758('0x16')]);router['get'](_0xa758('0x17'),auth['isAuthenticated'](),controller[_0xa758('0x18')]);router[_0xa758('0x7')](_0xa758('0x19'),auth[_0xa758('0x8')](),controller[_0xa758('0x1a')]);router[_0xa758('0x7')](_0xa758('0x1b'),auth['isAuthenticated'](),controller[_0xa758('0x1c')]);router['get'](_0xa758('0x1d'),auth[_0xa758('0x8')](),controller[_0xa758('0x1e')]);router[_0xa758('0x7')]('/:id/openchannel/interactions',auth[_0xa758('0x8')](),controller['getOpenchannelInteractions']);router['get'](_0xa758('0x1f'),auth[_0xa758('0x8')](),controller[_0xa758('0x20')]);router['get'](_0xa758('0x21'),auth['isAuthenticated'](),controller[_0xa758('0x22')]);router['get'](_0xa758('0x23'),auth['isAuthenticated'](),controller[_0xa758('0x24')]);router['get'](_0xa758('0x25'),auth['isAuthenticated'](),controller[_0xa758('0x26')]);router[_0xa758('0x7')](_0xa758('0x27'),auth[_0xa758('0x8')](),controller[_0xa758('0x28')]);router[_0xa758('0x7')](_0xa758('0x29'),auth[_0xa758('0x8')](),controller['getLists']);router['get']('/:id/agents',auth['isAuthenticated'](),controller[_0xa758('0x2a')]);router[_0xa758('0x7')]('/:id/prefixes',auth[_0xa758('0x8')](),controller[_0xa758('0x2b')]);router[_0xa758('0x7')](_0xa758('0x2c'),auth[_0xa758('0x8')](),controller[_0xa758('0x2d')]);router[_0xa758('0x7')](_0xa758('0x2e'),auth[_0xa758('0x8')](),controller[_0xa758('0x2f')]);router['get'](_0xa758('0x30'),auth[_0xa758('0x8')](),controller[_0xa758('0x31')]);router[_0xa758('0x7')](_0xa758('0x32'),auth['isAuthenticated'](),controller[_0xa758('0x33')]);router[_0xa758('0x7')]('/:id/chat_websites',auth['isAuthenticated'](),controller['getChatWebsites']);router[_0xa758('0x7')]('/:id/whatsapp_accounts',auth[_0xa758('0x8')](),controller[_0xa758('0x34')]);router['get'](_0xa758('0x35'),auth['isAuthenticated'](),controller[_0xa758('0x36')]);router[_0xa758('0x7')](_0xa758('0x37'),auth['isAuthenticated'](),controller[_0xa758('0x38')]);router[_0xa758('0x39')](_0xa758('0x13'),auth[_0xa758('0x8')](),controller[_0xa758('0x3a')]);router[_0xa758('0x39')]('/',auth[_0xa758('0x8')](),controller[_0xa758('0x3b')]);router[_0xa758('0x39')](_0xa758('0x3c'),auth[_0xa758('0x8')](),controller['bulkCreate']);router['post']('/:id/queues',auth[_0xa758('0x8')](),controller[_0xa758('0x3d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xa4fcf2,_0x3b295f,_0xaa0369){_0xaa0369(null,path[_0xa758('0x3e')](config['root'],'server/files/images/'));},'filename':function(_0x2a1db5,_0x57dd2b,_0x2ba3c5){_0x2ba3c5(null,util[_0xa758('0x3f')](_0xa758('0x40'),Date['now'](),_0x57dd2b[_0xa758('0x41')]));}})});router[_0xa758('0x39')](_0xa758('0x10'),upload[_0xa758('0x42')](_0xa758('0x43')),controller[_0xa758('0x44')]);router[_0xa758('0x39')](_0xa758('0x45'),auth[_0xa758('0x8')](),controller['login']);router[_0xa758('0x39')]('/:id/logout',auth[_0xa758('0x8')](),controller[_0xa758('0x46')]);router[_0xa758('0x39')](_0xa758('0x47'),auth['isAuthenticated'](),controller[_0xa758('0x48')]);router[_0xa758('0x39')](_0xa758('0x49'),auth[_0xa758('0x8')](),controller[_0xa758('0x4a')]);router[_0xa758('0x39')](_0xa758('0x27'),auth[_0xa758('0x8')](),controller[_0xa758('0x4b')]);router[_0xa758('0x39')](_0xa758('0x4c'),auth[_0xa758('0x8')](),controller[_0xa758('0x4d')]);router[_0xa758('0x39')]('/:id/mail_interactions',auth[_0xa758('0x8')](),controller[_0xa758('0x4e')]);router[_0xa758('0x39')](_0xa758('0x4f'),auth[_0xa758('0x8')](),controller[_0xa758('0x50')]);router[_0xa758('0x39')](_0xa758('0x51'),auth[_0xa758('0x8')](),controller['addSmsInteractions']);router['post'](_0xa758('0x52'),auth[_0xa758('0x8')](),controller[_0xa758('0x53')]);router[_0xa758('0x39')](_0xa758('0x54'),auth['isAuthenticated'](),controller[_0xa758('0x55')]);router[_0xa758('0x39')](_0xa758('0x2c'),auth[_0xa758('0x8')](),controller[_0xa758('0x56')]);router['post'](_0xa758('0x2e'),auth[_0xa758('0x8')](),controller['addMailAccounts']);router[_0xa758('0x39')]('/:id/openchannel_accounts',auth[_0xa758('0x8')](),controller[_0xa758('0x57')]);router[_0xa758('0x39')]('/:id/sms_accounts',auth[_0xa758('0x8')](),controller[_0xa758('0x58')]);router[_0xa758('0x39')](_0xa758('0x59'),auth[_0xa758('0x8')](),controller['addChatWebsites']);router[_0xa758('0x39')](_0xa758('0x5a'),auth['isAuthenticated'](),controller[_0xa758('0x5b')]);router[_0xa758('0x39')](_0xa758('0x37'),auth[_0xa758('0x8')](),controller[_0xa758('0x5c')]);router['put'](_0xa758('0xe'),auth[_0xa758('0x8')](),controller['update']);router['put'](_0xa758('0x5d'),auth[_0xa758('0x8')](),controller['changePassword']);router[_0xa758('0x5e')]('/:id/queues',auth[_0xa758('0x8')](),controller[_0xa758('0x5f')]);router[_0xa758('0x5e')](_0xa758('0x27'),auth['isAuthenticated'](),controller[_0xa758('0x60')]);router[_0xa758('0x5e')]('/:id',auth[_0xa758('0x8')](),controller[_0xa758('0x61')]);router['delete'](_0xa758('0x4c'),auth[_0xa758('0x8')](),controller[_0xa758('0x62')]);router[_0xa758('0x5e')](_0xa758('0x63'),auth[_0xa758('0x8')](),controller[_0xa758('0x64')]);router[_0xa758('0x5e')](_0xa758('0x4f'),auth[_0xa758('0x8')](),controller['removeFaxInteractions']);router[_0xa758('0x5e')](_0xa758('0x51'),auth[_0xa758('0x8')](),controller[_0xa758('0x65')]);router['delete']('/:id/openchannel_interactions',auth[_0xa758('0x8')](),controller[_0xa758('0x66')]);router['delete']('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router[_0xa758('0x5e')](_0xa758('0x2c'),auth['isAuthenticated'](),controller[_0xa758('0x67')]);router['delete'](_0xa758('0x2e'),auth[_0xa758('0x8')](),controller[_0xa758('0x68')]);router[_0xa758('0x5e')](_0xa758('0x30'),auth['isAuthenticated'](),controller[_0xa758('0x69')]);router[_0xa758('0x5e')](_0xa758('0x32'),auth['isAuthenticated'](),controller[_0xa758('0x6a')]);router[_0xa758('0x5e')](_0xa758('0x59'),auth[_0xa758('0x8')](),controller['removeChatWebsites']);router[_0xa758('0x5e')]('/:id/whatsapp_accounts',auth[_0xa758('0x8')](),controller[_0xa758('0x6b')]);router[_0xa758('0x5e')](_0xa758('0x37'),auth[_0xa758('0x8')](),controller[_0xa758('0x6c')]);router[_0xa758('0x39')](_0xa758('0x6d'),auth['isAuthenticated'](),controller[_0xa758('0x6e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index a207999..a88123c 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 _0xca06=['exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','toLowerCase','ENUM','admin','user','local','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','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','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','refuse','originate','uac','uas','certificate','active','actpass','update,nonat','TEXT','showWebBar','get','encryption','avpf','force_avp','icesupport','dtlsenable','dtlssetup','dtlsprivatekey','dtlsverify','dtlscertfile','/etc/pki/tls/private/motion.key','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','loginAttempts','sequelize','moment','util','lodash'];(function(_0x469ac7,_0xd1f270){var _0x4e6051=function(_0x4a56ad){while(--_0x4a56ad){_0x469ac7['push'](_0x469ac7['shift']());}};_0x4e6051(++_0xd1f270);}(_0xca06,0x10a));var _0x6ca0=function(_0x42d552,_0x59abeb){_0x42d552=_0x42d552-0x0;var _0x4dacf5=_0xca06[_0x42d552];return _0x4dacf5;};'use strict';var Sequelize=require(_0x6ca0('0x0'));var moment=require(_0x6ca0('0x1'));var util=require(_0x6ca0('0x2'));var _=require(_0x6ca0('0x3'));module[_0x6ca0('0x4')]={'name':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':![],'unique':_0x6ca0('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x332f12){this['setDataValue'](_0x6ca0('0x6'),_0x332f12);this[_0x6ca0('0x7')](_0x6ca0('0x8'),_0x332f12);},'comment':_0x6ca0('0x9')},'fullname':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':![],'set':function(_0x30b6f6){this['setDataValue'](_0x6ca0('0xa'),_0x30b6f6);this['setDataValue'](_0x6ca0('0xb'),util[_0x6ca0('0xc')](_0x6ca0('0xd'),_0x30b6f6,this[_0x6ca0('0xe')](_0x6ca0('0xf'))));}},'alias':{'type':Sequelize[_0x6ca0('0x5')]},'email':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x59df87){if(_0x59df87){this[_0x6ca0('0x7')]('email',_0x59df87[_0x6ca0('0x10')]());}}},'role':{'type':Sequelize[_0x6ca0('0x11')](_0x6ca0('0x12'),_0x6ca0('0x13'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x6ca0('0x14')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x6ca0('0xf'),'set':function(_0x213699){this[_0x6ca0('0x7')]('internal',_0x213699);this[_0x6ca0('0x7')](_0x6ca0('0x15'),_0x213699);this[_0x6ca0('0x7')](_0x6ca0('0xb'),util[_0x6ca0('0xc')](_0x6ca0('0xd'),this[_0x6ca0('0xe')](_0x6ca0('0xa')),_0x213699));}},'salt':{'type':Sequelize[_0x6ca0('0x5')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x6ca0('0x5')]},'address':{'type':Sequelize[_0x6ca0('0x5')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x6ca0('0x5')]},'country':{'type':Sequelize[_0x6ca0('0x5')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x6ca0('0x16')]},'voicePause':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x6ca0('0x18')},'lastPauseAt':{'type':Sequelize[_0x6ca0('0x16')]},'chatCapacity':{'type':Sequelize[_0x6ca0('0x19')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x6ca0('0x19')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x6ca0('0x19')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x6ca0('0x19')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x6ca0('0x19')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x6ca0('0x19')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x6ca0('0x19')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x6ca0('0x19')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x6ca0('0x19')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x6ca0('0x1a')},'ipaddr':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x6ca0('0x19')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x6ca0('0x19')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x6ca0('0x1b'),_0x6ca0('0x13'),_0x6ca0('0x1c')),'allowNull':!![],'defaultValue':_0x6ca0('0x1b')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x6ca0('0x1d')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0x6ca0('0x1e'),_0x6ca0('0x1f'),_0x6ca0('0x20'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0x6ca0('0x21'),_0x6ca0('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![],'defaultValue':_0x6ca0('0x23'),'set':function(_0x13c1e3){this[_0x6ca0('0x7')](_0x6ca0('0x24'),_0x13c1e3?_0x13c1e3[_0x6ca0('0x25')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x6ca0('0xe')]('transport')[_0x6ca0('0x26')](','):null;},'comment':_0x6ca0('0x27')},'dtmfmode':{'type':Sequelize[_0x6ca0('0x11')]('rfc2833',_0x6ca0('0x28'),_0x6ca0('0x29'),_0x6ca0('0x2a'),_0x6ca0('0x2b')),'allowNull':!![],'defaultValue':_0x6ca0('0x2c')},'directmedia':{'type':Sequelize[_0x6ca0('0x11')](_0x6ca0('0x2d'),'no',_0x6ca0('0x2e'),_0x6ca0('0x2f'),_0x6ca0('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x6ca0('0x11')](_0x6ca0('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![],'defaultValue':_0x6ca0('0x31'),'set':function(_0x3b99c6){this[_0x6ca0('0x7')]('nat',_0x3b99c6?_0x3b99c6['join'](','):null);},'get':function(){return this[_0x6ca0('0xe')]('nat')?this[_0x6ca0('0xe')](_0x6ca0('0x32'))[_0x6ca0('0x26')](','):null;},'comment':_0x6ca0('0x33')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x6ca0('0x5')]},'pickupgroup':{'type':Sequelize[_0x6ca0('0x5')]},'namedpickupgroup':{'type':Sequelize[_0x6ca0('0x5')]},'language':{'type':Sequelize[_0x6ca0('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6ca0('0x5')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6ca0('0x34')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6ca0('0x35'),'set':function(_0x5ab4b2){this[_0x6ca0('0x7')](_0x6ca0('0x36'),_0x5ab4b2?_0x5ab4b2['join'](';'):_0x6ca0('0x35'));},'get':function(){return this[_0x6ca0('0xe')](_0x6ca0('0x36'))?this[_0x6ca0('0xe')](_0x6ca0('0x36'))[_0x6ca0('0x26')](';'):null;},'comment':_0x6ca0('0x37')},'autoframing':{'type':Sequelize[_0x6ca0('0x11')](_0x6ca0('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![],'set':function(_0x566556){this[_0x6ca0('0x7')](_0x6ca0('0x38'),_0x566556?_0x566556[_0x6ca0('0x25')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0x6ca0('0xe')]('insecure')[_0x6ca0('0x26')](','):null;},'comment':_0x6ca0('0x39')},'trustrpid':{'type':Sequelize['ENUM'](_0x6ca0('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6ca0('0x11')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x6ca0('0x2d'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x6ca0('0x11')](_0x6ca0('0x2d'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x6ca0('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x6ca0('0x19')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![],'defaultValue':_0x6ca0('0x3a')},'amaflags':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x6ca0('0x11')](_0x6ca0('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x6ca0('0x2d')},'busylevel':{'type':Sequelize[_0x6ca0('0x19')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x6ca0('0x11')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x6ca0('0x11')](_0x6ca0('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x6ca0('0x11')](_0x6ca0('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x6ca0('0x11')](_0x6ca0('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x6ca0('0x11')]('yes','no',_0x6ca0('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x6ca0('0x19')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x6ca0('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x6ca0('0x11')]('accept',_0x6ca0('0x3c'),_0x6ca0('0x3d')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x6ca0('0x19')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x6ca0('0x19')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x6ca0('0x3e'),_0x6ca0('0x3f')),'allowNull':!![],'defaultValue':_0x6ca0('0x3f')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x6ca0('0x11')](_0x6ca0('0x2d'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x6ca0('0x19')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x6ca0('0x19')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x6ca0('0x19')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x6ca0('0x11')](_0x6ca0('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x6ca0('0x19')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x6ca0('0x19')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x6ca0('0x19')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x6ca0('0x11')](_0x6ca0('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x6ca0('0x11')](_0x6ca0('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x6ca0('0x11')](_0x6ca0('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x6ca0('0x11')](_0x6ca0('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x6ca0('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x6ca0('0x11')](_0x6ca0('0x2d'),'no','fingerprint',_0x6ca0('0x40')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x6ca0('0x19')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x6ca0('0x11')](_0x6ca0('0x41'),'passive',_0x6ca0('0x42')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x6ca0('0x11')](_0x6ca0('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x6ca0('0x19')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x6ca0('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x6ca0('0x11')](_0x6ca0('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x6ca0('0x11')](_0x6ca0('0x2d'),'no',_0x6ca0('0x2e'),'update',_0x6ca0('0x43')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x6ca0('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x6ca0('0x44')]},'showWebBar':{'type':Sequelize[_0x6ca0('0x19')],'defaultValue':0x0,'set':function(_0x237f10){this['setDataValue'](_0x6ca0('0x45'),_0x237f10);var _0x160960=this[_0x6ca0('0x46')]({'plain':!![]});switch(_0x237f10){case 0x0:case 0x1:var _0x2ba658=_0x160960[_0x6ca0('0x24')]?_['isArray'](_0x160960[_0x6ca0('0x24')])?_0x160960[_0x6ca0('0x24')][_0x6ca0('0x25')]():_0x160960[_0x6ca0('0x24')]:_0x6ca0('0x23');if(_0x2ba658==='wss'){_0x2ba658='udp';}this[_0x6ca0('0x7')](_0x6ca0('0x24'),_0x2ba658);this[_0x6ca0('0x7')](_0x6ca0('0x47'),'no');this['setDataValue'](_0x6ca0('0x48'),null);this['setDataValue'](_0x6ca0('0x49'),null);this['setDataValue'](_0x6ca0('0x4a'),null);this[_0x6ca0('0x7')](_0x6ca0('0x4b'),null);this[_0x6ca0('0x7')]('dtlsverify',null);this[_0x6ca0('0x7')](_0x6ca0('0x4c'),null);this['setDataValue']('dtlscertfile',null);this[_0x6ca0('0x7')](_0x6ca0('0x4d'),null);this[_0x6ca0('0x7')]('rtcp_mux','no');break;case 0x2:this[_0x6ca0('0x7')](_0x6ca0('0x24'),'wss');this[_0x6ca0('0x7')](_0x6ca0('0x47'),_0x6ca0('0x2d'));this[_0x6ca0('0x7')](_0x6ca0('0x48'),'yes');this[_0x6ca0('0x7')](_0x6ca0('0x49'),'yes');this[_0x6ca0('0x7')]('icesupport',_0x6ca0('0x2d'));this[_0x6ca0('0x7')](_0x6ca0('0x4b'),'yes');this[_0x6ca0('0x7')](_0x6ca0('0x4e'),'no');this[_0x6ca0('0x7')](_0x6ca0('0x4c'),_0x6ca0('0x42'));this[_0x6ca0('0x7')](_0x6ca0('0x4f'),_0x160960[_0x6ca0('0x4f')]||'/etc/pki/tls/certs/motion.crt');this[_0x6ca0('0x7')](_0x6ca0('0x4d'),_0x160960[_0x6ca0('0x4d')]||_0x6ca0('0x50'));this['setDataValue']('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize[_0x6ca0('0x44')],'set':function(_0x4bb314){this[_0x6ca0('0x7')]('permissions',_0x4bb314?_0x4bb314[_0x6ca0('0x25')](','):[]);},'get':function(){return this['getDataValue'](_0x6ca0('0x51'))?_[_0x6ca0('0x52')](this[_0x6ca0('0xe')](_0x6ca0('0x51'))[_0x6ca0('0x26')](','),function(_0x4b1247){return parseInt(_0x4b1247,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x6ca0('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x6ca0('0x11')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x6ca0('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x6ca0('0xe')](_0x6ca0('0x53'))?this[_0x6ca0('0xe')](_0x6ca0('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x6ca0('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x6ca0('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':![],'set':function(_0x4b9ee7){if(typeof _0x4b9ee7===_0x6ca0('0x54')){var _0x9b4d9b=_0x4b9ee7==='1'?!![]:_0x4b9ee7==='0'?![]:_0x4b9ee7===_0x6ca0('0x55')?!![]:_0x4b9ee7===_0x6ca0('0x56')?![]:![];this[_0x6ca0('0x7')](_0x6ca0('0x57'),_0x9b4d9b);}else{this[_0x6ca0('0x7')](_0x6ca0('0x57'),_0x4b9ee7);}}},'blocked':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':![],'set':function(_0x307825){this[_0x6ca0('0x7')]('blocked',_0x307825);if(_0x307825===!![]){this[_0x6ca0('0x7')](_0x6ca0('0x58'),moment());this[_0x6ca0('0x7')](_0x6ca0('0x59'),0x0);}else{this['setDataValue'](_0x6ca0('0x58'),null);}}},'blockedAt':{'type':Sequelize[_0x6ca0('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x6ca0('0x19')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x6ca0('0x19')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x6ca0('0x19')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x6ca0('0x19')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x6ca0('0x17')],'defaultValue':![]}}; \ No newline at end of file +var _0xd36d=['auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','accept','originate','uac','uas','fingerprint','certificate','passive','actpass','TEXT','showWebBar','get','wss','encryption','avpf','force_avp','dtlsenable','dtlssetup','dtlscertfile','dtlsprivatekey','icesupport','/etc/pki/tls/certs/motion.crt','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','toLowerCase','ENUM','admin','agent','telephone','local','INTEGER','accountcode','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo'];(function(_0x4ee140,_0xddce08){var _0x1c14bd=function(_0x6dd0b3){while(--_0x6dd0b3){_0x4ee140['push'](_0x4ee140['shift']());}};_0x1c14bd(++_0xddce08);}(_0xd36d,0x1a9));var _0xdd36=function(_0x2fc3bf,_0x313b39){_0x2fc3bf=_0x2fc3bf-0x0;var _0x2ae89f=_0xd36d[_0x2fc3bf];return _0x2ae89f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xdd36('0x0'));var util=require(_0xdd36('0x1'));var _=require(_0xdd36('0x2'));module[_0xdd36('0x3')]={'name':{'type':Sequelize[_0xdd36('0x4')],'allowNull':![],'unique':_0xdd36('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x38c8f9){this[_0xdd36('0x6')](_0xdd36('0x5'),_0x38c8f9);this['setDataValue'](_0xdd36('0x7'),_0x38c8f9);},'comment':_0xdd36('0x8')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x561de6){this[_0xdd36('0x6')]('fullname',_0x561de6);this[_0xdd36('0x6')](_0xdd36('0x9'),util[_0xdd36('0xa')](_0xdd36('0xb'),_0x561de6,this[_0xdd36('0xc')](_0xdd36('0xd'))));}},'alias':{'type':Sequelize[_0xdd36('0x4')]},'email':{'type':Sequelize[_0xdd36('0x4')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x12b2c3){if(_0x12b2c3){this[_0xdd36('0x6')]('email',_0x12b2c3[_0xdd36('0xe')]());}}},'role':{'type':Sequelize[_0xdd36('0xf')](_0xdd36('0x10'),'user',_0xdd36('0x11'),_0xdd36('0x12')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0xdd36('0x13')},'internal':{'type':Sequelize[_0xdd36('0x14')](0xb),'allowNull':![],'unique':'internal','set':function(_0x1f46bb){this['setDataValue'](_0xdd36('0xd'),_0x1f46bb);this[_0xdd36('0x6')](_0xdd36('0x15'),_0x1f46bb);this[_0xdd36('0x6')](_0xdd36('0x9'),util[_0xdd36('0xa')]('\x22%s\x22\x20<%s>',this['getDataValue'](_0xdd36('0x16')),_0x1f46bb));}},'salt':{'type':Sequelize[_0xdd36('0x4')]},'phone':{'type':Sequelize[_0xdd36('0x4')]},'mobile':{'type':Sequelize[_0xdd36('0x4')]},'address':{'type':Sequelize[_0xdd36('0x4')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xdd36('0x4')]},'city':{'type':Sequelize[_0xdd36('0x4')]},'country':{'type':Sequelize[_0xdd36('0x4')]},'online':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xdd36('0x18')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0xdd36('0x19')},'lastPauseAt':{'type':Sequelize[_0xdd36('0x18')]},'chatCapacity':{'type':Sequelize[_0xdd36('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xdd36('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xdd36('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xdd36('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xdd36('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xdd36('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xdd36('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xdd36('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xdd36('0x1a')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0xdd36('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xdd36('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xdd36('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xdd36('0xf')](_0xdd36('0x1b'),'user',_0xdd36('0x1c')),'allowNull':!![],'defaultValue':_0xdd36('0x1b')},'context':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![],'defaultValue':_0xdd36('0x1d')},'callingpres':{'type':Sequelize[_0xdd36('0xf')](_0xdd36('0x1e'),_0xdd36('0x1f'),_0xdd36('0x20'),_0xdd36('0x21'),_0xdd36('0x22'),_0xdd36('0x23'),'PROHIB_FAILED_SCREEN',_0xdd36('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![],'defaultValue':_0xdd36('0x25'),'set':function(_0xbe2c17){this[_0xdd36('0x6')](_0xdd36('0x26'),_0xbe2c17?_0xbe2c17[_0xdd36('0x27')](','):null);},'get':function(){return this[_0xdd36('0xc')]('transport')?this[_0xdd36('0xc')]('transport')[_0xdd36('0x28')](','):null;},'comment':_0xdd36('0x29')},'dtmfmode':{'type':Sequelize[_0xdd36('0xf')](_0xdd36('0x2a'),_0xdd36('0x2b'),_0xdd36('0x2c'),'inband',_0xdd36('0x2d')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xdd36('0xf')](_0xdd36('0x2e'),'no',_0xdd36('0x2f'),_0xdd36('0x30'),_0xdd36('0x31')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xdd36('0xf')](_0xdd36('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xdd36('0x32'),'set':function(_0x504ce2){this[_0xdd36('0x6')](_0xdd36('0x33'),_0x504ce2?_0x504ce2[_0xdd36('0x27')](','):null);},'get':function(){return this[_0xdd36('0xc')](_0xdd36('0x33'))?this['getDataValue'](_0xdd36('0x33'))[_0xdd36('0x28')](','):null;},'comment':_0xdd36('0x34')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xdd36('0x4')]},'pickupgroup':{'type':Sequelize[_0xdd36('0x4')]},'namedpickupgroup':{'type':Sequelize[_0xdd36('0x4')]},'language':{'type':Sequelize[_0xdd36('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xdd36('0x4')]},'disallow':{'type':Sequelize[_0xdd36('0x4')],'allowNull':![],'defaultValue':_0xdd36('0x35')},'allow':{'type':Sequelize[_0xdd36('0x4')],'allowNull':![],'defaultValue':_0xdd36('0x36'),'set':function(_0x597c5f){this[_0xdd36('0x6')](_0xdd36('0x37'),_0x597c5f?_0x597c5f[_0xdd36('0x27')](';'):_0xdd36('0x36'));},'get':function(){return this[_0xdd36('0xc')](_0xdd36('0x37'))?this[_0xdd36('0xc')](_0xdd36('0x37'))[_0xdd36('0x28')](';'):null;},'comment':_0xdd36('0x38')},'autoframing':{'type':Sequelize[_0xdd36('0xf')](_0xdd36('0x2e'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x1564d3){this['setDataValue'](_0xdd36('0x39'),_0x1564d3?_0x1564d3[_0xdd36('0x27')](','):null);},'get':function(){return this[_0xdd36('0xc')](_0xdd36('0x39'))?this[_0xdd36('0xc')]('insecure')['split'](','):null;},'comment':_0xdd36('0x3a')},'trustrpid':{'type':Sequelize[_0xdd36('0xf')](_0xdd36('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xdd36('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xdd36('0xf')]('yes','no',_0xdd36('0x3b')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xdd36('0x2e'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xdd36('0x2e'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xdd36('0x2e'),'no'),'allowNull':!![],'defaultValue':_0xdd36('0x2e')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xdd36('0xf')](_0xdd36('0x2e'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xdd36('0xf')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xdd36('0xf')](_0xdd36('0x2e'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xdd36('0xf')](_0xdd36('0x2e'),'no',_0xdd36('0x3c')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xdd36('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xdd36('0xf')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xdd36('0xf')](_0xdd36('0x3d'),'refuse',_0xdd36('0x3e')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xdd36('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xdd36('0xf')](_0xdd36('0x3f'),_0xdd36('0x40')),'allowNull':!![],'defaultValue':_0xdd36('0x40')},'t38pt_usertpsource':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xdd36('0xf')](_0xdd36('0x2e'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xdd36('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xdd36('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xdd36('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xdd36('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xdd36('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xdd36('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xdd36('0xf')](_0xdd36('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xdd36('0xf')](_0xdd36('0x2e'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xdd36('0xf')](_0xdd36('0x2e'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xdd36('0x2e'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xdd36('0xf')](_0xdd36('0x2e'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xdd36('0xf')]('yes','no',_0xdd36('0x41'),_0xdd36('0x42')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xdd36('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xdd36('0xf')]('active',_0xdd36('0x43'),_0xdd36('0x44')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xdd36('0xf')](_0xdd36('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xdd36('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xdd36('0xf')](_0xdd36('0x2e'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xdd36('0x2e'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xdd36('0xf')](_0xdd36('0x2e'),'no','nonat','update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xdd36('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0xdd36('0x18')]},'passwordResetAt':{'type':Sequelize[_0xdd36('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xdd36('0x45')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x42f54c){this['setDataValue'](_0xdd36('0x46'),_0x42f54c);var _0x14136a=this[_0xdd36('0x47')]({'plain':!![]});switch(_0x42f54c){case 0x0:case 0x1:var _0x346d32=_0x14136a[_0xdd36('0x26')]?_['isArray'](_0x14136a['transport'])?_0x14136a[_0xdd36('0x26')][_0xdd36('0x27')]():_0x14136a[_0xdd36('0x26')]:_0xdd36('0x25');if(_0x346d32===_0xdd36('0x48')){_0x346d32=_0xdd36('0x25');}this[_0xdd36('0x6')](_0xdd36('0x26'),_0x346d32);this[_0xdd36('0x6')](_0xdd36('0x49'),'no');this[_0xdd36('0x6')](_0xdd36('0x4a'),null);this['setDataValue'](_0xdd36('0x4b'),null);this[_0xdd36('0x6')]('icesupport',null);this[_0xdd36('0x6')](_0xdd36('0x4c'),null);this[_0xdd36('0x6')]('dtlsverify',null);this[_0xdd36('0x6')](_0xdd36('0x4d'),null);this['setDataValue'](_0xdd36('0x4e'),null);this[_0xdd36('0x6')](_0xdd36('0x4f'),null);this[_0xdd36('0x6')]('rtcp_mux','no');break;case 0x2:this[_0xdd36('0x6')](_0xdd36('0x26'),_0xdd36('0x48'));this[_0xdd36('0x6')]('encryption',_0xdd36('0x2e'));this[_0xdd36('0x6')]('avpf',_0xdd36('0x2e'));this[_0xdd36('0x6')](_0xdd36('0x4b'),_0xdd36('0x2e'));this['setDataValue'](_0xdd36('0x50'),_0xdd36('0x2e'));this[_0xdd36('0x6')](_0xdd36('0x4c'),'yes');this['setDataValue']('dtlsverify','no');this[_0xdd36('0x6')]('dtlssetup',_0xdd36('0x44'));this[_0xdd36('0x6')](_0xdd36('0x4e'),_0x14136a[_0xdd36('0x4e')]||_0xdd36('0x51'));this[_0xdd36('0x6')](_0xdd36('0x4f'),_0x14136a[_0xdd36('0x4f')]||'/etc/pki/tls/private/motion.key');this[_0xdd36('0x6')](_0xdd36('0x52'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0xdd36('0x45')],'set':function(_0x5ecb69){this['setDataValue'](_0xdd36('0x53'),_0x5ecb69?_0x5ecb69[_0xdd36('0x27')](','):[]);},'get':function(){return this[_0xdd36('0xc')](_0xdd36('0x53'))?_[_0xdd36('0x54')](this['getDataValue']('permissions')[_0xdd36('0x28')](','),function(_0x3021f9){return parseInt(_0x3021f9,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0xdd36('0x4')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xdd36('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xdd36('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xdd36('0xf')](_0xdd36('0x2e'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xdd36('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xdd36('0x55')],'get':function(){return this[_0xdd36('0xc')](_0xdd36('0x56'))?this[_0xdd36('0xc')](_0xdd36('0x56')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0xdd36('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xdd36('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':![],'set':function(_0x1de9c0){if(typeof _0x1de9c0==='string'){var _0x38bfab=_0x1de9c0==='1'?!![]:_0x1de9c0==='0'?![]:_0x1de9c0===_0xdd36('0x57')?!![]:_0x1de9c0===_0xdd36('0x58')?![]:![];this[_0xdd36('0x6')](_0xdd36('0x59'),_0x38bfab);}else{this[_0xdd36('0x6')](_0xdd36('0x59'),_0x1de9c0);}}},'blocked':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':![],'set':function(_0x3fb086){this[_0xdd36('0x6')](_0xdd36('0x5a'),_0x3fb086);if(_0x3fb086===!![]){this[_0xdd36('0x6')](_0xdd36('0x5b'),moment());this[_0xdd36('0x6')](_0xdd36('0x5c'),0x0);}else{this[_0xdd36('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0xdd36('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xdd36('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0xdd36('0x5d')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xdd36('0x14')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xdd36('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xdd36('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xdd36('0x14')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xdd36('0x17')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 9eb00cb..afc7c44 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 _0x39cb=['$lte','$not','$notBetween','$in','$like','$notLike','$iLike','$overlap','$contains','lastName','CmContact','Contact','getApiKey','token','No\x20API\x20access\x20key\x20found!','createApiKey','generateApiKey','nonce','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','idle','unknown','ringing','teams','queues','inbound','flatten','lower','col','asc','substring','offline','voiceStatus','unavailable','busy','charAt','toUpperCase','select','field','ui.','ui.createdAt','user_has_','_interactions','toString','messengerSoundNotification','enabled','moment','util','path','lodash','squel','ioredis','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../components/realtime/agents','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','APIBadRequestError','../../errors/api','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','./user.socket','redis','defaults','localhost','status','json','offset','limit','undefined','count','set','Content-Range','update','then','role','agent','emit','destroy','get','admin','Users','user','Agents','Telephones','telephone','filter','ignore','map','value','includes','find','name','UserProfileResource','end','sendStatus','error','send','User','rawAttributes','fieldName','type','key','previousPasswords','resetPasswordToken','resetPasswordExpires','md5secret','where','query','includeAll','userSetting','true','include','UserSetting','attributes','push','rows','openTabs','length','chat','dataValues','sms','fax','mail','whatsapp','catch','show','params','getOptions','merge','options','all','body','addContacts','ids','omit','internal','Setting','findById','securePassword','password','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','permissions','101','102','103','113','110','105','106','108','109','100','111','115','create','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Unauthorized','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','isEmpty','compact','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','enforcePasswordHistory','validatePasswordPattern','passwordHistoryLimit','addQueues','channel','online','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','Queues','penalty','spread','QueueId','toLowerCase','Queue:save','VoiceQueue','findAll','voice','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','remove','Queue:remove','userpic','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','existsSync','server/files/images/','openchannel','CHAT','createdAt','FaxOpenTabs','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','concat','getContacts','findOne','User\x20with\x20id\x20%s\x20not\x20found','describe','hasOwnProperty','List','Tag','color','tag','model','keys','Queue','filters','intersection','fields','order','pick','Unknown\x20role','nolimit','sort','getVoiceQueuesRt','ChatGroup','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','FaxInteraction','getFaxInteractions','getWhatsappInteractions','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','loginInPause','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','LOGININPAUSE','bulkCreate','isMiddleware','resolve','logout','pause','updateAttributes','getChannels','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','openchannelPause','whatsappPause','pauseType','lastPauseAt','getTeams','Team','Body\x20parameter\x20\x27ids\x27\x20is\x20required','addTeams','getAssociatedQueues','flattenDeep','addAgent','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','removeAgent','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','isArray','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','$and','$or','$gte','$lt'];(function(_0x90ad81,_0x369e09){var _0x34f6e5=function(_0x53ffdd){while(--_0x53ffdd){_0x90ad81['push'](_0x90ad81['shift']());}};_0x34f6e5(++_0x369e09);}(_0x39cb,0x1b7));var _0xb39c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x39cb[_0x167cc1];return _0x10bc4b;};'use strict';var moment=require(_0xb39c('0x0'));var util=require(_0xb39c('0x1'));var path=require(_0xb39c('0x2'));var fs=require('fs');var _=require(_0xb39c('0x3'));var squel=require(_0xb39c('0x4'));var Redis=require(_0xb39c('0x5'));var authService=require(_0xb39c('0x6'));var contacts=require(_0xb39c('0x7'));var qs=require(_0xb39c('0x8'));var rta=require(_0xb39c('0x9'));var logger=require(_0xb39c('0xa'))(_0xb39c('0xb'));var utils=require(_0xb39c('0xc'));var config=require(_0xb39c('0xd'));var licenseUtil=require(_0xb39c('0xe'));var APIBadRequestError=require('../../errors/api')[_0xb39c('0xf')];var APINotFoundError=require(_0xb39c('0x10'))[_0xb39c('0x11')];var APIHandleError=require(_0xb39c('0x10'))[_0xb39c('0x12')];var db=require(_0xb39c('0x13'))['db'];var socket=require(_0xb39c('0x14'))(new Redis(config['redis']));require(_0xb39c('0x15'))['register'](socket);config[_0xb39c('0x16')]=_[_0xb39c('0x17')](config[_0xb39c('0x16')],{'host':_0xb39c('0x18'),'port':0x18eb});var values;function respondWithStatusCode(_0x10f91c,_0x123f37){_0x123f37=_0x123f37||0xcc;return function(_0x42a7ec){if(_0x42a7ec){return _0x10f91c['sendStatus'](_0x123f37);}return _0x10f91c['status'](_0x123f37)['end']();};}function respondWithResult(_0x2f19ef,_0x287df8){_0x287df8=_0x287df8||0xc8;return function(_0x39b3df){if(_0x39b3df){return _0x2f19ef[_0xb39c('0x19')](_0x287df8)[_0xb39c('0x1a')](_0x39b3df);}};}function respondWithFilteredResult(_0x3f0901,_0x6fa634){return function(_0x365c06){if(_0x365c06){var _0xba4553=typeof _0x6fa634[_0xb39c('0x1b')]==='undefined'&&typeof _0x6fa634[_0xb39c('0x1c')]===_0xb39c('0x1d');var _0x4f7dbd=_0x365c06[_0xb39c('0x1e')];var _0x45bc85=_0xba4553?0x0:_0x6fa634[_0xb39c('0x1b')];var _0x4b2350=_0xba4553?_0x365c06[_0xb39c('0x1e')]:_0x6fa634['offset']+_0x6fa634[_0xb39c('0x1c')];var _0x194926;if(_0x4b2350>=_0x4f7dbd){_0x4b2350=_0x4f7dbd;_0x194926=0xc8;}else{_0x194926=0xce;}_0x3f0901[_0xb39c('0x19')](_0x194926);return _0x3f0901[_0xb39c('0x1f')](_0xb39c('0x20'),_0x45bc85+'-'+_0x4b2350+'/'+_0x4f7dbd)[_0xb39c('0x1a')](_0x365c06);}return null;};}function saveUpdates(_0x121b09){return function(_0x528f44){if(_0x528f44){return _0x528f44[_0xb39c('0x21')](_0x121b09)[_0xb39c('0x22')](function(_0xa65989){if(_0xa65989[_0xb39c('0x23')]===_0xb39c('0x24')){socket[_0xb39c('0x25')]('userNotification:recalc:'+_0xa65989['id'],_0xa65989);}return _0xa65989;});}return null;};}function removeEntity(_0x59cb22){return function(_0x35831a){if(_0x35831a){return _0x35831a[_0xb39c('0x26')]()['then'](function(){var _0x300cb1=_0x35831a[_0xb39c('0x27')]({'plain':!![]});if(_0x300cb1[_0xb39c('0x23')]===_0xb39c('0x28'))return;var _0x41657c=[{'name':_0xb39c('0x29'),'value':_0xb39c('0x2a'),'ignore':!![]},{'name':_0xb39c('0x2b'),'value':_0xb39c('0x24'),'ignore':![]},{'name':_0xb39c('0x2c'),'value':_0xb39c('0x2d'),'ignore':![]}];var _0xdac2b3=_(_0x41657c)[_0xb39c('0x2e')](_0xb39c('0x2f'))[_0xb39c('0x30')](_0xb39c('0x31'))[_0xb39c('0x31')]();if(_[_0xb39c('0x32')](_0xdac2b3,_0x300cb1[_0xb39c('0x23')])){return;}var _0x3681c1=_[_0xb39c('0x33')](_0x41657c,['value',_0x300cb1[_0xb39c('0x23')]])[_0xb39c('0x34')];return db[_0xb39c('0x35')][_0xb39c('0x26')]({'where':{'type':_0x3681c1,'resourceId':_0x300cb1['id']}})[_0xb39c('0x22')](function(){return _0x35831a;});})[_0xb39c('0x22')](function(){_0x59cb22[_0xb39c('0x19')](0xcc)[_0xb39c('0x36')]();});}};}function handleEntityNotFound(_0x2fe921){return function(_0x356a57){if(!_0x356a57){_0x2fe921[_0xb39c('0x37')](0x194);}return _0x356a57;};}function handleError(_0x218c98,_0x6d217a){_0x6d217a=_0x6d217a||0x1f4;return function(_0x35462a){logger[_0xb39c('0x38')](_0x35462a['stack']);if(_0x35462a['name']){delete _0x35462a['name'];}_0x218c98[_0xb39c('0x19')](_0x6d217a)[_0xb39c('0x39')](_0x35462a);};}function getUserAttributes(){return _(db[_0xb39c('0x3a')][_0xb39c('0x3b')])[_0xb39c('0x30')](function(_0x4e3bab){return{'name':_0x4e3bab[_0xb39c('0x3c')],'type':_0x4e3bab[_0xb39c('0x3d')][_0xb39c('0x3e')]};})['filter'](function(_0x1c45ed){return!['password','salt',_0xb39c('0x3f'),_0xb39c('0x40'),_0xb39c('0x41'),_0xb39c('0x42')][_0xb39c('0x32')](_0x1c45ed['name']);})['value']();}exports['index']=function(_0x2beb44,_0x31852a){var _0x4e2a26={},_0x42f55a={'count':0x0,'rows':[]};var _0x4c77be=getUserAttributes();_0x4e2a26=qs['getOptions'](_0x4c77be,_0x2beb44);var _0x25bcc3={'where':_0x4e2a26[_0xb39c('0x43')]};return db[_0xb39c('0x3a')][_0xb39c('0x1e')](_0x25bcc3)['then'](function(_0x56219c){_0x42f55a[_0xb39c('0x1e')]=_0x56219c;if(_0x2beb44[_0xb39c('0x44')][_0xb39c('0x45')]){_0x4e2a26['include']=[{'all':!![]}];}if(_0x2beb44[_0xb39c('0x44')][_0xb39c('0x46')]===_0xb39c('0x47')){_0x4e2a26[_0xb39c('0x48')]=[{'model':db[_0xb39c('0x49')],'as':_0xb39c('0x46')}];}if(!_[_0xb39c('0x32')](_0x4e2a26['attributes'],'id')){_0x4e2a26[_0xb39c('0x4a')][_0xb39c('0x4b')]('id');}return db[_0xb39c('0x3a')]['findAll'](_0x4e2a26);})['then'](function(_0x34ab98){_0x42f55a[_0xb39c('0x4c')]=_0x34ab98;if(_0x2beb44['query'][_0xb39c('0x4d')]==='true'){var _0x13f521=[];for(var _0x561266=0x0;_0x561266<_0x42f55a[_0xb39c('0x4c')][_0xb39c('0x4e')];_0x561266++){_0x13f521[_0xb39c('0x4b')](get_open_tabs(_0xb39c('0x4f'),_0x42f55a[_0xb39c('0x4c')][_0x561266][_0xb39c('0x50')]));_0x13f521[_0xb39c('0x4b')](get_open_tabs(_0xb39c('0x51'),_0x42f55a[_0xb39c('0x4c')][_0x561266]['dataValues']));_0x13f521['push'](get_open_tabs(_0xb39c('0x52'),_0x42f55a[_0xb39c('0x4c')][_0x561266][_0xb39c('0x50')]));_0x13f521[_0xb39c('0x4b')](get_open_tabs(_0xb39c('0x53'),_0x42f55a[_0xb39c('0x4c')][_0x561266]['dataValues']));_0x13f521[_0xb39c('0x4b')](get_open_tabs('openchannel',_0x42f55a[_0xb39c('0x4c')][_0x561266]['dataValues']));_0x13f521['push'](get_open_tabs(_0xb39c('0x54'),_0x42f55a[_0xb39c('0x4c')][_0x561266][_0xb39c('0x50')]));}return Promise['all'](_0x13f521)['then'](function(){return _0x42f55a;});}else{return _0x42f55a;}})['then'](respondWithFilteredResult(_0x31852a,_0x4e2a26))[_0xb39c('0x55')](handleError(_0x31852a,null));};exports[_0xb39c('0x56')]=function(_0x54dc95,_0x129f2e){var _0x4b76d7=getUserAttributes();_0x54dc95[_0xb39c('0x44')]['id']=_0x54dc95[_0xb39c('0x57')]['id'];var _0x2fee98=qs[_0xb39c('0x58')](_0x4b76d7,_0x54dc95);if(_0x54dc95[_0xb39c('0x44')][_0xb39c('0x45')]){_0x2fee98[_0xb39c('0x48')]=[{'all':!![]}];}if(_0x54dc95['query']['userSetting']===_0xb39c('0x47')){_0x2fee98[_0xb39c('0x48')]=[{'model':db[_0xb39c('0x49')],'as':'userSetting'}];}_0x2fee98=_[_0xb39c('0x59')]({},_0x2fee98,_0x54dc95[_0xb39c('0x5a')]);if(!_[_0xb39c('0x32')](_0x2fee98[_0xb39c('0x4a')],'id')){_0x2fee98[_0xb39c('0x4a')][_0xb39c('0x4b')]('id');}return db[_0xb39c('0x3a')][_0xb39c('0x33')](_0x2fee98)[_0xb39c('0x22')](handleEntityNotFound(_0x129f2e,null))[_0xb39c('0x22')](function(_0x3594e7){var _0x2c22ff=[];values=_0x3594e7;if(_0x54dc95[_0xb39c('0x44')]['openTabs']===_0xb39c('0x47')){_0x2c22ff[_0xb39c('0x4b')](get_open_tabs('chat',_0x3594e7[_0xb39c('0x50')]));_0x2c22ff[_0xb39c('0x4b')](get_open_tabs(_0xb39c('0x51'),_0x3594e7[_0xb39c('0x50')]));_0x2c22ff[_0xb39c('0x4b')](get_open_tabs('openchannel',_0x3594e7[_0xb39c('0x50')]));_0x2c22ff[_0xb39c('0x4b')](get_open_tabs('whatsapp',_0x3594e7[_0xb39c('0x50')]));_0x2c22ff[_0xb39c('0x4b')](get_open_tabs(_0xb39c('0x52'),_0x3594e7[_0xb39c('0x50')]));_0x2c22ff[_0xb39c('0x4b')](get_open_tabs(_0xb39c('0x53'),_0x3594e7[_0xb39c('0x50')]));return Promise[_0xb39c('0x5b')](_0x2c22ff);}else{return values;}})[_0xb39c('0x22')](function(){return values;})['then'](respondWithResult(_0x129f2e,null))[_0xb39c('0x55')](handleError(_0x129f2e,null));};exports[_0xb39c('0x21')]=function(_0x9a4b7c,_0x570e2a){if(_0x9a4b7c['body']['id']){delete _0x9a4b7c[_0xb39c('0x5c')]['id'];}delete _0x9a4b7c['body'][_0xb39c('0x23')];return db[_0xb39c('0x3a')][_0xb39c('0x33')]({'where':{'id':_0x9a4b7c[_0xb39c('0x57')]['id']}})[_0xb39c('0x22')](handleEntityNotFound(_0x570e2a,null))[_0xb39c('0x22')](saveUpdates(_0x9a4b7c['body'],null))['then'](respondWithResult(_0x570e2a,null))[_0xb39c('0x55')](handleError(_0x570e2a,null));};exports['describe']=function(_0x5f5d37,_0x3b9111){return db[_0xb39c('0x3a')]['describe']()[_0xb39c('0x22')](respondWithResult(_0x3b9111,null))[_0xb39c('0x55')](handleError(_0x3b9111,null));};exports[_0xb39c('0x5d')]=function(_0x1e16ac,_0x4b5461){return db['User']['find']({'where':{'id':_0x1e16ac[_0xb39c('0x57')]['id']}})[_0xb39c('0x22')](handleEntityNotFound(_0x4b5461,null))[_0xb39c('0x22')](function(_0x5325a8){if(_0x5325a8){return _0x5325a8['addContacts'](_0x1e16ac[_0xb39c('0x5c')][_0xb39c('0x5e')],_[_0xb39c('0x5f')](_0x1e16ac[_0xb39c('0x5c')],[_0xb39c('0x5e'),'id'])||{});}})[_0xb39c('0x22')](respondWithResult(_0x4b5461,null))[_0xb39c('0x55')](handleError(_0x4b5461,null));};function validateUser(_0x57f769){return new Promise(function(_0x26be34,_0x350bd8){if(_0x57f769[_0xb39c('0x60')])return _0x26be34(_0x57f769);return db[_0xb39c('0x61')][_0xb39c('0x62')](0x1)['then'](function(_0x233835){if(_0x233835[_0xb39c('0x63')])authService['validatePasswordPattern'](_0x57f769[_0xb39c('0x64')]);db[_0xb39c('0x3a')][_0xb39c('0x65')](_0xb39c('0x60'))['then'](function(_0x38bd70){if(_[_0xb39c('0x66')](_0x38bd70)){_0x57f769[_0xb39c('0x60')]=_0x233835[_0xb39c('0x67')]||0x1;return;}if(_[_0xb39c('0x66')](_0x233835[_0xb39c('0x67')])||_0x233835[_0xb39c('0x67')]===_0x38bd70){_0x57f769[_0xb39c('0x60')]=_0x38bd70+0x1;return;}if(_0x233835[_0xb39c('0x67')]>_0x38bd70){_0x57f769[_0xb39c('0x60')]=_0x233835['min_internal'];return;}return db[_0xb39c('0x68')]['query'](_0xb39c('0x69'),{'type':db[_0xb39c('0x68')][_0xb39c('0x6a')][_0xb39c('0x6b')]})['then'](function(_0x4f8ea3){if(_0x4f8ea3&&_0x4f8ea3['length']){for(var _0x46e5f6=0x0,_0xd06917=_0x4f8ea3[_0xb39c('0x4e')];_0x46e5f6<_0xd06917&&_[_0xb39c('0x66')](_0x57f769[_0xb39c('0x60')]);_0x46e5f6++){if(_0x233835['min_internal']<=_0x4f8ea3[_0x46e5f6][_0xb39c('0x6c')]){_0x57f769[_0xb39c('0x60')]=_0x4f8ea3[_0x46e5f6][_0xb39c('0x6c')];}else if(_0x233835[_0xb39c('0x67')]>_0x4f8ea3[_0x46e5f6][_0xb39c('0x6c')]&&_0x233835['min_internal']<=_0x4f8ea3[_0x46e5f6]['to']){_0x57f769[_0xb39c('0x60')]=_0x233835[_0xb39c('0x67')];}}}if(_[_0xb39c('0x66')](_0x57f769[_0xb39c('0x60')])){_0x57f769['internal']=_0x38bd70+0x1;}return _0x26be34(_0x57f769);});});})[_0xb39c('0x55')](function(_0x585899){_0x350bd8(_0x585899);});});}function updateUser(_0x273af5){return new Promise(function(_0x260623,_0x29f345){try{if(_0x273af5[_0xb39c('0x6d')]){_0x273af5[_0xb39c('0x6e')]=_0x273af5['internal'];_0x273af5[_0xb39c('0x6f')]={'mailbox':_0x273af5[_0xb39c('0x60')],'password':_0x273af5['password'],'fullname':_0x273af5['fullname'],'email':_0x273af5['email']};}if(_0x273af5['role']==='agent'){if(!_0x273af5['permissions'])_0x273af5[_0xb39c('0x70')]=[_0xb39c('0x71'),_0xb39c('0x72'),_0xb39c('0x73'),_0xb39c('0x74'),_0xb39c('0x75'),'104',_0xb39c('0x76'),_0xb39c('0x77'),'107',_0xb39c('0x78'),_0xb39c('0x79'),_0xb39c('0x7a'),_0xb39c('0x7b'),'114',_0xb39c('0x7c')];}_0x260623(_0x273af5);}catch(_0x8563){_0x29f345(_0x8563);}});}exports[_0xb39c('0x7d')]=function(_0x5624f8,_0x30bcbe){if(_0x5624f8[_0xb39c('0x2a')][_0xb39c('0x23')]==='agent')throw new Error('Unauthorized');if(_0x5624f8['body'][_0xb39c('0x23')]===_0xb39c('0x2a')&&_0x5624f8['user'][_0xb39c('0x23')]!=='admin'){throw new Error(_0xb39c('0x7e'));}if(_0x5624f8['body']['role']===_0xb39c('0x28')&&_0x5624f8[_0xb39c('0x2a')][_0xb39c('0x23')]!=='admin'){throw new Error(_0xb39c('0x7f'));}return licenseUtil[_0xb39c('0x80')]([_0x5624f8[_0xb39c('0x5c')]])['then'](function(){return validateUser(_0x5624f8['body']);})[_0xb39c('0x22')](function(_0x14fe44){return updateUser(_0x14fe44)[_0xb39c('0x22')](function(_0x1e6c68){if(_0x1e6c68[_0xb39c('0x23')]===_0xb39c('0x28')){_0x1e6c68[_0xb39c('0x81')]=_0x5624f8[_0xb39c('0x2a')][_0xb39c('0x81')];delete _0x1e6c68[_0xb39c('0x82')];}return _0x1e6c68;});})[_0xb39c('0x22')](function(_0x3b3975){return db[_0xb39c('0x3a')][_0xb39c('0x7d')](_0x3b3975,{'include':[{'model':db[_0xb39c('0x6f')],'as':_0xb39c('0x6f')}]});})[_0xb39c('0x22')](function(_0x399e62){if(_0x5624f8[_0xb39c('0x5c')]['role']===_0xb39c('0x2a'))return _0x399e62;if(_0x5624f8[_0xb39c('0x2a')][_0xb39c('0x23')]!==_0xb39c('0x2a'))return _0x399e62;return db[_0xb39c('0x83')][_0xb39c('0x33')]({'where':{'name':_0x399e62['role']===_0xb39c('0x24')?_0xb39c('0x2b'):_0xb39c('0x2c'),'userProfileId':_0x5624f8[_0xb39c('0x2a')][_0xb39c('0x82')]},'raw':!![]})[_0xb39c('0x22')](function(_0x160ac9){if(!_0x160ac9||_0x160ac9[_0xb39c('0x84')]!=0x0)return _0x399e62;return db[_0xb39c('0x35')]['create']({'name':_0x399e62[_0xb39c('0x34')],'resourceId':_0x399e62['id'],'type':_0x160ac9[_0xb39c('0x34')],'sectionId':_0x160ac9['id']},{})[_0xb39c('0x22')](function(){return _0x399e62;});})[_0xb39c('0x55')](function(_0x22012e){logger['error'](_0xb39c('0x85'),_0x22012e);throw _0x22012e;});})[_0xb39c('0x22')](respondWithResult(_0x30bcbe,0xc9))[_0xb39c('0x55')](handleError(_0x30bcbe,null));};exports['bulkCreate']=function(_0x520a26,_0x2285b6){var _0x5af4d8=_0x520a26['body'];var _0x46c3c4=[];if(_0x520a26[_0xb39c('0x2a')][_0xb39c('0x23')]===_0xb39c('0x24'))throw new Error(_0xb39c('0x86'));if(_['some'](_0x5af4d8,[_0xb39c('0x23'),'user'])&&_0x520a26[_0xb39c('0x2a')][_0xb39c('0x23')]!==_0xb39c('0x28')){throw new Error(_0xb39c('0x7e'));}if(_[_0xb39c('0x87')](_0x5af4d8,['role','admin'])&&_0x520a26[_0xb39c('0x2a')][_0xb39c('0x23')]!==_0xb39c('0x28')){throw new Error(_0xb39c('0x88'));}return licenseUtil[_0xb39c('0x80')](_0x5af4d8)['then'](function(){return validateUser(_0x5af4d8[0x0]);})[_0xb39c('0x22')](function(){for(var _0x26a12f=0x1;_0x26a12f<_0x5af4d8[_0xb39c('0x4e')];_0x26a12f++){var _0x100091=_0x5af4d8[_0x26a12f-0x1]['internal'];if(!_0x5af4d8[_0x26a12f][_0xb39c('0x60')])_0x5af4d8[_0x26a12f]['internal']=_0x100091+0x1;_0x46c3c4[_0xb39c('0x4b')](validateUser(_0x5af4d8[_0x26a12f]));}return Promise[_0xb39c('0x5b')](_0x46c3c4);})[_0xb39c('0x22')](function(){_0x46c3c4=[];for(var _0x15d91e=0x0;_0x15d91e<_0x5af4d8[_0xb39c('0x4e')];_0x15d91e++){_0x46c3c4[_0xb39c('0x4b')](updateUser(_0x5af4d8[_0x15d91e]));}return Promise[_0xb39c('0x5b')](_0x46c3c4);})[_0xb39c('0x22')](function(){_0x46c3c4=_0x5af4d8[_0xb39c('0x30')](function(_0x3963e8){return db[_0xb39c('0x3a')][_0xb39c('0x7d')](_0x3963e8,{'include':[{'model':db[_0xb39c('0x6f')],'as':'VoiceMail'}]})[_0xb39c('0x22')](function(_0x41e95a){_0x3963e8['id']=_0x41e95a['id'];return _0x3963e8;});});return Promise['all'](_0x46c3c4);})[_0xb39c('0x22')](function(_0x5d1be1){if(_0x520a26['body'][_0xb39c('0x23')]===_0xb39c('0x2a'))return _0x5d1be1;if(_0x520a26['user'][_0xb39c('0x23')]!==_0xb39c('0x2a'))return _0x5d1be1;var _0x593b03=_['some'](_0x5d1be1,function(_0x56c2b9){return _0x56c2b9[_0xb39c('0x23')]===_0xb39c('0x24')||_0x56c2b9['role']==='telephone';});if(!_0x593b03)return _0x5d1be1;return db[_0xb39c('0x83')]['findAll']({'where':{'name':{'$or':[_0xb39c('0x2b'),_0xb39c('0x2c')]},'userProfileId':_0x520a26[_0xb39c('0x2a')][_0xb39c('0x82')]},'raw':!![]})[_0xb39c('0x22')](function(_0x5ef788){if(_[_0xb39c('0x89')](_0x5ef788)||!_['some'](_0x5ef788,[_0xb39c('0x84'),0x0]))return _0x5d1be1;_0x46c3c4=[];var _0x4cf459=_(_0x5ef788)[_0xb39c('0x30')](function(_0x3a8a12){if(_0x3a8a12['autoAssociation']===0x1)return;return _0x3a8a12[_0xb39c('0x34')]==='Agents'?_0xb39c('0x24'):_0xb39c('0x2d');})[_0xb39c('0x8a')]()[_0xb39c('0x31')]();for(var _0x5da5b4=0x0;_0x5da5b4<_0x5d1be1[_0xb39c('0x4e')];_0x5da5b4++){if(!_[_0xb39c('0x32')](_0x4cf459,_0x5d1be1[_0x5da5b4][_0xb39c('0x23')]))return;var _0x2c937f=_0x5d1be1[_0x5da5b4][_0xb39c('0x23')]===_0xb39c('0x24')?_0xb39c('0x2b'):'Telephones';_0x46c3c4['push'](db[_0xb39c('0x35')][_0xb39c('0x7d')]({'name':_0x5d1be1[_0x5da5b4]['name'],'resourceId':_0x5d1be1[_0x5da5b4]['id'],'type':_0x2c937f,'sectionId':_[_0xb39c('0x33')](_0x5ef788,['name',_0x2c937f])['id']},{}));}return Promise[_0xb39c('0x5b')](_0x46c3c4);});})['then'](respondWithResult(_0x2285b6,0xc9))[_0xb39c('0x55')](handleError(_0x2285b6,null));};exports['changePassword']=function(_0x60b469,_0x30cf68){if(_0x60b469[_0xb39c('0x5c')]['id']){delete _0x60b469['body']['id'];}return db[_0xb39c('0x3a')]['find']({'where':{'id':_0x60b469[_0xb39c('0x57')]['id']}})[_0xb39c('0x22')](function(_0x5867dd){if(!_0x5867dd)return null;if(_0x5867dd['id']===_0x60b469[_0xb39c('0x2a')]['id']){if(!_0x60b469['body'][_0xb39c('0x8b')]||!_0x60b469[_0xb39c('0x5c')][_0xb39c('0x8c')]){throw new db[(_0xb39c('0x8d'))][(_0xb39c('0x8e'))](_0xb39c('0x8f'));}if(!_0x5867dd[_0xb39c('0x90')](_0x60b469[_0xb39c('0x5c')][_0xb39c('0x8b')])){throw new db[(_0xb39c('0x8d'))]['ValidationError'](_0xb39c('0x91'));}if(_0x60b469[_0xb39c('0x5c')][_0xb39c('0x8b')]===_0x60b469[_0xb39c('0x5c')][_0xb39c('0x8c')]){throw new db[(_0xb39c('0x8d'))][(_0xb39c('0x8e'))](_0xb39c('0x92'));}}else if(_0x60b469['user'][_0xb39c('0x23')]==='admin'){if(!_0x60b469[_0xb39c('0x5c')]['newPassword']){throw new db[(_0xb39c('0x8d'))][(_0xb39c('0x8e'))](_0xb39c('0x93'));}}else if(_0x60b469[_0xb39c('0x2a')][_0xb39c('0x23')]===_0xb39c('0x2a')){if(!_0x60b469[_0xb39c('0x5c')]['newPassword']){throw new db[(_0xb39c('0x8d'))][(_0xb39c('0x8e'))](_0xb39c('0x93'));}if(_0x5867dd[_0xb39c('0x23')]!==_0xb39c('0x24')){throw new db[(_0xb39c('0x8d'))]['ValidationError'](_0xb39c('0x86'));}}else{throw new db[(_0xb39c('0x8d'))]['ValidationError'](_0xb39c('0x86'));}return _0x5867dd;})['then'](handleEntityNotFound(_0x30cf68,null))['then'](function(_0x3103c0){return db[_0xb39c('0x61')]['findOne']({'attributes':['id',_0xb39c('0x63'),_0xb39c('0x94'),'passwordHistoryLimit']})[_0xb39c('0x22')](function(_0xa868f1){if(_0xa868f1[_0xb39c('0x63')])authService[_0xb39c('0x95')](_0x60b469['body'][_0xb39c('0x8c')]);if(!_0xa868f1[_0xb39c('0x94')]||!_0x3103c0[_0xb39c('0x3f')])return _0x3103c0;authService['validatePasswordHistory'](_0x60b469[_0xb39c('0x5c')][_0xb39c('0x8c')],_0x3103c0[_0xb39c('0x3f')],_0xa868f1[_0xb39c('0x96')]);return _0x3103c0;})['then'](saveUpdates({'password':_0x60b469[_0xb39c('0x5c')][_0xb39c('0x8c')],'passwordResetAt':_0x60b469[_0xb39c('0x2a')]['id']==_0x60b469['params']['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x60b469[_0xb39c('0x5c')]['newPassword'],_0x3103c0[_0xb39c('0x3f')])},null));})[_0xb39c('0x22')](respondWithResult(_0x30cf68,null))[_0xb39c('0x55')](handleError(_0x30cf68,null));};exports[_0xb39c('0x97')]=function(_0x4a93db,_0x3a09ce){var _0x1aba2c=_0x4a93db[_0xb39c('0x5c')][_0xb39c('0x98')];return db[_0xb39c('0x3a')][_0xb39c('0x33')]({'where':{'id':_0x4a93db[_0xb39c('0x57')]['id']},'attributes':['id',_0xb39c('0x34'),_0xb39c('0x23'),_0xb39c('0x99'),'loginInPause',_0xb39c('0x9a'),_0xb39c('0x9b')]})[_0xb39c('0x22')](handleEntityNotFound(_0x3a09ce,null))['then'](function(_0x4e6272){if(_0x4e6272){if(!utils[_0xb39c('0x9c')](_0x1aba2c)){throw new db[(_0xb39c('0x8d'))]['ValidationError'](_0xb39c('0x9d'));}return _0x4e6272[_0xb39c('0x9e')+_[_0xb39c('0x9f')](_0x1aba2c['toLowerCase']())+_0xb39c('0xa0')](_0x4a93db['body']['ids'],{'penalty':_0x4a93db[_0xb39c('0x5c')][_0xb39c('0xa1')]||0x0})[_0xb39c('0xa2')](function(_0x2884c1){for(var _0x455f0f=0x0;_0x455f0f<_0x4a93db[_0xb39c('0x5c')][_0xb39c('0x5e')][_0xb39c('0x4e')];_0x455f0f+=0x1){var _0x36b558={'UserId':Number(_0x4a93db[_0xb39c('0x57')]['id'])};_0x36b558[_[_0xb39c('0x9f')](_0x1aba2c['toLowerCase']())+_0xb39c('0xa3')]=Number(_0x4a93db[_0xb39c('0x5c')][_0xb39c('0x5e')][_0x455f0f]);socket['emit'](_0xb39c('0x2a')+_[_0xb39c('0x9f')](_0x1aba2c[_0xb39c('0xa4')]())+_0xb39c('0xa5'),_0x36b558);}return _0x2884c1;})[_0xb39c('0x22')](function(){if(_0x1aba2c==='voice'){return db[_0xb39c('0xa6')][_0xb39c('0xa7')]({'where':{'id':_0x4a93db[_0xb39c('0x5c')][_0xb39c('0x5e')]||[]},'raw':!![],'attributes':['id','name']});}})[_0xb39c('0x22')](function(_0x202630){var _0x7fa817=_0x4e6272[_0xb39c('0x27')]({'plain':!![]});var _0xbbc5d7=[];if(_0x1aba2c===_0xb39c('0xa8')&&_0x7fa817[_0xb39c('0x23')]===_0xb39c('0x24')&&_0x7fa817[_0xb39c('0x99')]){for(let _0x58ce68=0x0;_0x58ce68<_0x202630[_0xb39c('0x4e')];_0x58ce68+=0x1){_0xbbc5d7[_0xb39c('0x4b')]({'membername':_0x7fa817[_0xb39c('0x34')],'UserId':_0x7fa817['id'],'queue_name':_0x202630[_0x58ce68][_0xb39c('0x34')],'VoiceQueueId':_0x202630[_0x58ce68]['id'],'interface':_[_0xb39c('0x66')](_0x7fa817['interface'])?util[_0xb39c('0xa9')](_0xb39c('0xaa'),_0x7fa817['name']):_0x7fa817[_0xb39c('0x9b')],'paused':_0x7fa817[_0xb39c('0x9a')]||![],'penalty':_0x4a93db[_0xb39c('0x5c')][_0xb39c('0xa1')]||0x0});}return Promise['all'](_0xbbc5d7[_0xb39c('0x30')](function(_0xcc02f4){return db[_0xb39c('0xab')][_0xb39c('0xac')](_0xcc02f4);}));}return _0x4e6272;});}})[_0xb39c('0x22')](respondWithStatusCode(_0x3a09ce,null))[_0xb39c('0x55')](handleError(_0x3a09ce,null));};exports[_0xb39c('0xad')]=function(_0x497722,_0x1ba15e){var _0x9e7645,_0x5841c7;return db[_0xb39c('0x3a')][_0xb39c('0x33')]({'where':{'id':_0x497722[_0xb39c('0x57')]['id']},'attributes':['id',_0xb39c('0x34'),'role']})['then'](handleEntityNotFound(_0x1ba15e,null))[_0xb39c('0x22')](function(_0x33a8b4){if(_0x33a8b4){_0x9e7645=_0x33a8b4;if(!_0x497722[_0xb39c('0x44')][_0xb39c('0x98')]||!utils[_0xb39c('0x9c')](_0x497722['query'][_0xb39c('0x98')])){throw new db[(_0xb39c('0x8d'))]['ValidationError']('Unknown\x20channel');}return _0x33a8b4[_0xb39c('0xae')+_[_0xb39c('0x9f')](_0x497722[_0xb39c('0x44')][_0xb39c('0x98')]['toLowerCase']())+_0xb39c('0xa0')](_0x497722[_0xb39c('0x44')][_0xb39c('0x5e')]);}})[_0xb39c('0x22')](function(_0x1a4af3){if(_['isArray'](_0x497722[_0xb39c('0x44')][_0xb39c('0x5e')])){for(var _0x1305e4=0x0;_0x1305e4<_0x497722[_0xb39c('0x44')][_0xb39c('0x5e')][_0xb39c('0x4e')];_0x1305e4+=0x1){_0x5841c7={'UserId':Number(_0x497722[_0xb39c('0x57')]['id'])};_0x5841c7[_[_0xb39c('0x9f')](_0x497722[_0xb39c('0x44')][_0xb39c('0x98')][_0xb39c('0xa4')]())+_0xb39c('0xa3')]=Number(_0x497722[_0xb39c('0x44')][_0xb39c('0x5e')][_0x1305e4]);socket['emit'](_0xb39c('0x2a')+_[_0xb39c('0x9f')](_0x497722[_0xb39c('0x44')]['channel'][_0xb39c('0xa4')]())+'Queue:remove',_0x5841c7);}}else{_0x5841c7={'UserId':Number(_0x497722[_0xb39c('0x57')]['id'])};_0x5841c7[_[_0xb39c('0x9f')](_0x497722['query']['channel'][_0xb39c('0xa4')]())+_0xb39c('0xa3')]=Number(_0x497722[_0xb39c('0x44')]['ids']);socket[_0xb39c('0x25')]('user'+_['capitalize'](_0x497722[_0xb39c('0x44')]['channel'][_0xb39c('0xa4')]())+_0xb39c('0xaf'),_0x5841c7);}return _0x1a4af3;})[_0xb39c('0x22')](function(){if(_0x497722['query']['channel']==='voice'){return db['UserVoiceQueueRt'][_0xb39c('0x26')]({'where':{'UserId':_0x497722['params']['id'],'VoiceQueueId':_0x497722[_0xb39c('0x44')][_0xb39c('0x5e')]},'individualHooks':!![]})[_0xb39c('0x22')](function(){return _0x9e7645;});}return _0x9e7645;})[_0xb39c('0x22')](respondWithStatusCode(_0x1ba15e,null))[_0xb39c('0x55')](handleError(_0x1ba15e,null));};exports['addAvatar']=function(_0x3483e6,_0x56096b){_0x3483e6[_0xb39c('0x5c')][_0xb39c('0xb0')]=_0x3483e6['file'][_0xb39c('0xb1')];return db[_0xb39c('0x3a')][_0xb39c('0x33')]({'where':{'id':_0x3483e6[_0xb39c('0x57')]['id']}})[_0xb39c('0x22')](handleEntityNotFound(_0x56096b,null))[_0xb39c('0x22')](saveUpdates(_0x3483e6[_0xb39c('0x5c')],null))[_0xb39c('0x22')](respondWithResult(_0x56096b,null))['catch'](handleError(_0x56096b,null));};exports[_0xb39c('0xb2')]=function(_0x289883,_0x2f7e0a){var _0x120461=path[_0xb39c('0xb3')](config[_0xb39c('0xb4')],_0xb39c('0xb5'));return db[_0xb39c('0x3a')][_0xb39c('0x33')]({'where':{'id':_0x289883[_0xb39c('0x57')]['id']},'attributes':['id',_0xb39c('0xb0')],'raw':!![]})[_0xb39c('0x22')](handleEntityNotFound(_0x2f7e0a,null))[_0xb39c('0x22')](function(_0x2a17f2){if(_0x2a17f2){if(_[_0xb39c('0x66')](_0x2a17f2[_0xb39c('0xb0')])){return _0x2f7e0a['download'](_0x120461);}else{if(!fs[_0xb39c('0xb6')](path['join'](config[_0xb39c('0xb4')],_0xb39c('0xb7'),_0x2a17f2[_0xb39c('0xb0')]))){return _0x2f7e0a['download'](_0x120461);}return _0x2f7e0a['download'](path[_0xb39c('0xb3')](config[_0xb39c('0xb4')],_0xb39c('0xb7'),_0x2a17f2[_0xb39c('0xb0')]));}}})['catch'](handleError(_0x2f7e0a,null));};exports['getOpenTabs']=function(_0x11ba32,_0x350148){return db['User']['find']({'where':{'id':_0x11ba32[_0xb39c('0x57')]['id']},'attributes':['id']})[_0xb39c('0x22')](handleEntityNotFound(_0x350148,null))[_0xb39c('0x22')](function(_0x5e119e){var _0x457840=[];values=_0x5e119e[_0xb39c('0x50')];_0x457840['push'](get_open_tabs(_0xb39c('0x4f'),_0x5e119e['dataValues']));_0x457840[_0xb39c('0x4b')](get_open_tabs(_0xb39c('0x51'),_0x5e119e[_0xb39c('0x50')]));_0x457840['push'](get_open_tabs(_0xb39c('0xb8'),_0x5e119e[_0xb39c('0x50')]));_0x457840[_0xb39c('0x4b')](get_open_tabs(_0xb39c('0x54'),_0x5e119e['dataValues']));_0x457840[_0xb39c('0x4b')](get_open_tabs(_0xb39c('0x52'),_0x5e119e['dataValues']));_0x457840[_0xb39c('0x4b')](get_open_tabs('mail',_0x5e119e[_0xb39c('0x50')]));return Promise[_0xb39c('0x5b')](_0x457840);})[_0xb39c('0x22')](function(_0x3378c9){if(_0x3378c9){var _0x455b31=_[_0xb39c('0x30')](values['ChatOpenTabs'],function(_0x44ed94){return{'channel':_0xb39c('0xb9'),'id':_0x44ed94['id'],'createdAt':_0x44ed94[_0xb39c('0xba')]};});var _0xbdd661=_[_0xb39c('0x30')](values[_0xb39c('0xbb')],function(_0x42bcfc){return{'channel':'FAX','id':_0x42bcfc['id'],'createdAt':_0x42bcfc[_0xb39c('0xba')]};});var _0x397249=_['map'](values[_0xb39c('0xbc')],function(_0x3d859b){return{'channel':_0xb39c('0xbd'),'id':_0x3d859b['id'],'createdAt':_0x3d859b[_0xb39c('0xba')]};});var _0x3b7a5b=_[_0xb39c('0x30')](values[_0xb39c('0xbe')],function(_0x3c7933){return{'channel':_0xb39c('0xbf'),'id':_0x3c7933['id'],'createdAt':_0x3c7933[_0xb39c('0xba')]};});var _0x25ae4a=_[_0xb39c('0x30')](values[_0xb39c('0xc0')],function(_0x1c6951){return{'channel':_0xb39c('0xc1'),'id':_0x1c6951['id'],'createdAt':_0x1c6951[_0xb39c('0xba')]};});var _0x508715=_[_0xb39c('0x30')](values[_0xb39c('0xc2')],function(_0x34fa89){return{'channel':'WHATSAPP','id':_0x34fa89['id'],'createdAt':_0x34fa89[_0xb39c('0xba')]};});var _0x268b2b=_[_0xb39c('0xc3')](_0x455b31,_0xbdd661,_0x397249,_0x3b7a5b,_0x25ae4a,_0x508715);var _0x23855d={'count':_0x268b2b['length'],'rows':_0x268b2b};return _0x23855d;}else return null;})[_0xb39c('0x22')](respondWithResult(_0x350148,null))[_0xb39c('0x55')](handleError(_0x350148,null));};exports[_0xb39c('0xc4')]=function(_0x13d4b8,_0x514bee){var _0x4a1ed1={};return db[_0xb39c('0x3a')][_0xb39c('0xc5')]({'where':{'id':_0x13d4b8[_0xb39c('0x57')]['id']}})[_0xb39c('0x22')](function(_0x2af0f5){if(!_0x2af0f5){throw new APINotFoundError(util['format'](_0xb39c('0xc6'),_0x13d4b8[_0xb39c('0x57')]['id']));}return contacts[_0xb39c('0xc7')]();})[_0xb39c('0x22')](function(_0x23f88e){_0x13d4b8[_0xb39c('0x44')][_0xb39c('0x3a')]=_0x13d4b8['params']['id'];_0x4a1ed1=qs[_0xb39c('0x58')](_0x23f88e,_0x13d4b8);if(_0x13d4b8[_0xb39c('0x44')][_0xb39c('0xc8')]('includeAll')){_0x4a1ed1[_0xb39c('0x48')]=[{'model':db['CmList'],'as':_0xb39c('0xc9'),'required':![]},{'model':db[_0xb39c('0xca')],'as':'Tags','attributes':['id',_0xb39c('0x34'),_0xb39c('0xcb')],'where':_0x13d4b8[_0xb39c('0x44')][_0xb39c('0xcc')]?{'id':_0x13d4b8[_0xb39c('0x44')][_0xb39c('0xcc')]}:undefined,'required':_0x13d4b8[_0xb39c('0x44')][_0xb39c('0xcc')]?!![]:![]}];}return contacts['findAll'](_0x13d4b8[_0xb39c('0x44')],_0x13d4b8['user'],_0x4a1ed1,_0x23f88e);})[_0xb39c('0x22')](respondWithFilteredResult(_0x514bee,_0x4a1ed1))[_0xb39c('0x55')](APIHandleError(_0x514bee));};exports['getQueues']=function(_0x56af57,_0x16d2b9){var _0x65debe;var _0x1e0391={};var _0x8bf788;return db[_0xb39c('0x3a')][_0xb39c('0xc5')]({'where':{'id':_0x56af57[_0xb39c('0x57')]['id']},'attributes':['id',_0xb39c('0x34'),_0xb39c('0x23')]})[_0xb39c('0x22')](handleEntityNotFound(_0x16d2b9,null))['then'](function(_0xe20459){if(!utils[_0xb39c('0x9c')](_0x56af57[_0xb39c('0x44')][_0xb39c('0x98')])){throw new db['Sequelize']['ValidationError'](_0xb39c('0x9d'));}_0x65debe=_0xe20459;var _0x43b54a={};_0x43b54a[_0xb39c('0xcd')]=_[_0xb39c('0xce')](db[_[_0xb39c('0x9f')](_0x56af57[_0xb39c('0x44')][_0xb39c('0x98')])+_0xb39c('0xcf')][_0xb39c('0x3b')]);_0x43b54a[_0xb39c('0x44')]=_[_0xb39c('0xce')](_0x56af57['query']);_0x43b54a[_0xb39c('0xd0')]=_['intersection'](_0x43b54a[_0xb39c('0xcd')],_0x43b54a[_0xb39c('0x44')]);_0x1e0391[_0xb39c('0x4a')]=_[_0xb39c('0xd1')](_0x43b54a['model'],qs[_0xb39c('0xd2')](_0x56af57[_0xb39c('0x44')][_0xb39c('0xd2')]));_0x1e0391[_0xb39c('0x4a')]=_0x1e0391[_0xb39c('0x4a')][_0xb39c('0x4e')]?_0x1e0391[_0xb39c('0x4a')]:_0x43b54a[_0xb39c('0xcd')];_0x1e0391[_0xb39c('0xd3')]=qs['sort'](_0x56af57[_0xb39c('0x44')]['sort']);_0x1e0391[_0xb39c('0x43')]=qs[_0xb39c('0xd0')](_[_0xb39c('0xd4')](_0x56af57[_0xb39c('0x44')],_0x43b54a[_0xb39c('0xd0')]));if(_0x56af57[_0xb39c('0x44')][_0xb39c('0x2e')]){_0x1e0391[_0xb39c('0x43')]=_[_0xb39c('0x59')](_0x1e0391[_0xb39c('0x43')],{'$or':_[_0xb39c('0x30')](_0x1e0391[_0xb39c('0x4a')],function(_0x372f8f){var _0x3eb918={};_0x3eb918[_0x372f8f]={'$like':'%'+_0x56af57[_0xb39c('0x44')][_0xb39c('0x2e')]+'%'};return _0x3eb918;})});}_0x1e0391=_[_0xb39c('0x59')]({},_0x1e0391,_0x56af57[_0xb39c('0x5a')]);switch(_0x65debe['role']){case _0xb39c('0x28'):return db[_[_0xb39c('0x9f')](_0x56af57[_0xb39c('0x44')][_0xb39c('0x98')])+_0xb39c('0xcf')][_0xb39c('0xa7')](_0x1e0391);case'user':case _0xb39c('0x24'):return _0x65debe[_0xb39c('0x27')+_['capitalize'](_0x56af57[_0xb39c('0x44')][_0xb39c('0x98')])+_0xb39c('0xa0')](_0x1e0391);default:throw new db[(_0xb39c('0x8d'))]['ValidationError'](_0xb39c('0xd5'));}})[_0xb39c('0x22')](function(_0x23d099){_0x8bf788=_0x23d099[_0xb39c('0x4e')];if(!_0x56af57[_0xb39c('0x44')][_0xb39c('0xc8')](_0xb39c('0xd6'))){_0x1e0391[_0xb39c('0x1c')]=qs[_0xb39c('0x1c')](_0x56af57['query'][_0xb39c('0x1c')]);_0x1e0391[_0xb39c('0x1b')]=qs[_0xb39c('0x1b')](_0x56af57[_0xb39c('0x44')]['offset']);}switch(_0x65debe['role']){case _0xb39c('0x28'):return db[_[_0xb39c('0x9f')](_0x56af57[_0xb39c('0x44')][_0xb39c('0x98')])+_0xb39c('0xcf')][_0xb39c('0xa7')](_0x1e0391);case'user':case _0xb39c('0x24'):return _0x65debe[_0xb39c('0x27')+_[_0xb39c('0x9f')](_0x56af57[_0xb39c('0x44')][_0xb39c('0x98')])+_0xb39c('0xa0')](_0x1e0391);}})['then'](function(_0x52d36b){return{'count':_0x8bf788,'rows':_0x52d36b};})[_0xb39c('0x22')](respondWithResult(_0x16d2b9,null))['catch'](handleError(_0x16d2b9,null));};exports['getVoiceQueuesRt']=function(_0x2794ea,_0x20178a){var _0x124c75={};var _0x4554e7={};var _0x23a766;var _0x4f5001;return db[_0xb39c('0x3a')][_0xb39c('0xc5')]({'where':{'id':_0x2794ea[_0xb39c('0x57')]['id']}})[_0xb39c('0x22')](handleEntityNotFound(_0x20178a,null))['then'](function(_0x42a75c){if(_0x42a75c){_0x23a766=_0x42a75c;_0x4554e7[_0xb39c('0xcd')]=_['keys'](db[_0xb39c('0xab')]['rawAttributes']);_0x4554e7[_0xb39c('0x44')]=_['keys'](_0x2794ea[_0xb39c('0x44')]);_0x4554e7[_0xb39c('0xd0')]=_[_0xb39c('0xd1')](_0x4554e7[_0xb39c('0xcd')],_0x4554e7[_0xb39c('0x44')]);_0x124c75['attributes']=_[_0xb39c('0xd1')](_0x4554e7[_0xb39c('0xcd')],qs[_0xb39c('0xd2')](_0x2794ea[_0xb39c('0x44')][_0xb39c('0xd2')]));_0x124c75[_0xb39c('0x4a')]=_0x124c75[_0xb39c('0x4a')]['length']?_0x124c75[_0xb39c('0x4a')]:_0x4554e7[_0xb39c('0xcd')];_0x124c75[_0xb39c('0xd3')]=qs[_0xb39c('0xd7')](_0x2794ea[_0xb39c('0x44')][_0xb39c('0xd7')]);_0x124c75[_0xb39c('0x43')]=qs[_0xb39c('0xd0')](_[_0xb39c('0xd4')](_0x2794ea['query'],_0x4554e7[_0xb39c('0xd0')]));if(_0x2794ea[_0xb39c('0x44')][_0xb39c('0x2e')]){_0x124c75[_0xb39c('0x43')]=_[_0xb39c('0x59')](_0x124c75['where'],{'$or':_[_0xb39c('0x30')](_0x124c75[_0xb39c('0x4a')],function(_0x179219){var _0x23b461={};_0x23b461[_0x179219]={'$like':'%'+_0x2794ea[_0xb39c('0x44')]['filter']+'%'};return _0x23b461;})});}_0x124c75=_[_0xb39c('0x59')]({},_0x124c75,_0x2794ea['options']);return _0x23a766[_0xb39c('0xd8')](_0x124c75);}})[_0xb39c('0x22')](function(_0x339c47){if(_0x339c47){_0x4f5001=_0x339c47[_0xb39c('0x4e')];if(!_0x2794ea['query'][_0xb39c('0xc8')](_0xb39c('0xd6'))){_0x124c75['limit']=qs[_0xb39c('0x1c')](_0x2794ea[_0xb39c('0x44')][_0xb39c('0x1c')]);_0x124c75[_0xb39c('0x1b')]=qs[_0xb39c('0x1b')](_0x2794ea[_0xb39c('0x44')]['offset']);}return _0x23a766[_0xb39c('0xd8')](_0x124c75);}})['then'](function(_0x310502){if(_0x310502){return _0x310502?{'count':_0x4f5001,'rows':_0x310502}:null;}})['then'](respondWithResult(_0x20178a,null))[_0xb39c('0x55')](handleError(_0x20178a,null));};exports['getGroups']=function(_0xb7266a,_0x534020){var _0x1676ec={};var _0x5595b2={};var _0xf91113;var _0x59893d;return db[_0xb39c('0x3a')][_0xb39c('0xc5')]({'where':{'id':_0xb7266a[_0xb39c('0x57')]['id']}})[_0xb39c('0x22')](handleEntityNotFound(_0x534020,null))[_0xb39c('0x22')](function(_0xc854bd){if(_0xc854bd){_0xf91113=_0xc854bd;_0x5595b2[_0xb39c('0xcd')]=_[_0xb39c('0xce')](db[_0xb39c('0xd9')][_0xb39c('0x3b')]);_0x5595b2[_0xb39c('0x44')]=_[_0xb39c('0xce')](_0xb7266a[_0xb39c('0x44')]);_0x5595b2[_0xb39c('0xd0')]=_[_0xb39c('0xd1')](_0x5595b2['model'],_0x5595b2['query']);_0x1676ec[_0xb39c('0x4a')]=_[_0xb39c('0xd1')](_0x5595b2[_0xb39c('0xcd')],qs[_0xb39c('0xd2')](_0xb7266a['query'][_0xb39c('0xd2')]));_0x1676ec[_0xb39c('0x4a')]=_0x1676ec[_0xb39c('0x4a')][_0xb39c('0x4e')]?_0x1676ec[_0xb39c('0x4a')]:_0x5595b2[_0xb39c('0xcd')];_0x1676ec['order']=qs[_0xb39c('0xd7')](_0xb7266a[_0xb39c('0x44')][_0xb39c('0xd7')]);_0x1676ec[_0xb39c('0x43')]=qs[_0xb39c('0xd0')](_[_0xb39c('0xd4')](_0xb7266a['query'],_0x5595b2[_0xb39c('0xd0')]));if(_0xb7266a[_0xb39c('0x44')][_0xb39c('0x2e')]){_0x1676ec[_0xb39c('0x43')]=_[_0xb39c('0x59')](_0x1676ec[_0xb39c('0x43')],{'$or':_[_0xb39c('0x30')](_0x1676ec[_0xb39c('0x4a')],function(_0x46b902){var _0x4e7bb3={};_0x4e7bb3[_0x46b902]={'$like':'%'+_0xb7266a['query'][_0xb39c('0x2e')]+'%'};return _0x4e7bb3;})});}_0x1676ec=_['merge']({},_0x1676ec,_0xb7266a[_0xb39c('0x5a')]);return _0xf91113[_0xb39c('0xda')](_0x1676ec);}})[_0xb39c('0x22')](function(_0x477c56){if(_0x477c56){_0x59893d=_0x477c56['length'];if(!_0xb7266a[_0xb39c('0x44')][_0xb39c('0xc8')](_0xb39c('0xd6'))){_0x1676ec['limit']=qs[_0xb39c('0x1c')](_0xb7266a[_0xb39c('0x44')]['limit']);_0x1676ec[_0xb39c('0x1b')]=qs[_0xb39c('0x1b')](_0xb7266a['query'][_0xb39c('0x1b')]);}return _0xf91113['getGroups'](_0x1676ec);}})[_0xb39c('0x22')](function(_0x1c2ab2){if(_0x1c2ab2){return _0x1c2ab2?{'count':_0x59893d,'rows':_0x1c2ab2}:null;}})[_0xb39c('0x22')](respondWithResult(_0x534020,null))['catch'](handleError(_0x534020,null));};exports[_0xb39c('0xdb')]=function(_0x3f52c8,_0xab3d19){var _0x587441={'raw':!![],'where':{}};var _0x50824a={};var _0x2af52e={'count':0x0,'rows':[]};return db[_0xb39c('0x3a')][_0xb39c('0xc5')]({'where':{'id':_0x3f52c8[_0xb39c('0x57')]['id']}})[_0xb39c('0x22')](handleEntityNotFound(_0xab3d19,null))[_0xb39c('0x22')](function(_0x30e68c){if(_0x30e68c){_0x50824a[_0xb39c('0xcd')]=_[_0xb39c('0xce')](db[_0xb39c('0xdc')][_0xb39c('0x3b')]);_0x50824a['query']=_[_0xb39c('0xce')](_0x3f52c8['query']);_0x50824a['filters']=_[_0xb39c('0xd1')](_0x50824a[_0xb39c('0xcd')],_0x50824a['query']);_0x587441[_0xb39c('0x4a')]=_[_0xb39c('0xd1')](_0x50824a['model'],qs[_0xb39c('0xd2')](_0x3f52c8[_0xb39c('0x44')][_0xb39c('0xd2')]));_0x587441[_0xb39c('0x4a')]=_0x587441[_0xb39c('0x4a')][_0xb39c('0x4e')]?_0x587441['attributes']:_0x50824a[_0xb39c('0xcd')];if(!_0x3f52c8[_0xb39c('0x44')]['hasOwnProperty'](_0xb39c('0xd6'))){_0x587441['limit']=qs[_0xb39c('0x1c')](_0x3f52c8[_0xb39c('0x44')][_0xb39c('0x1c')]);_0x587441[_0xb39c('0x1b')]=qs[_0xb39c('0x1b')](_0x3f52c8['query'][_0xb39c('0x1b')]);}_0x587441[_0xb39c('0xd3')]=qs[_0xb39c('0xd7')](_0x3f52c8[_0xb39c('0x44')][_0xb39c('0xd7')]);_0x587441['where']=qs[_0xb39c('0xd0')](_[_0xb39c('0xd4')](_0x3f52c8[_0xb39c('0x44')],_0x50824a[_0xb39c('0xd0')]));_0x587441[_0xb39c('0x43')][_0xb39c('0xdd')]=_0x30e68c['id'];if(_0x3f52c8[_0xb39c('0x44')]['filter']){_0x587441['where']=_['merge'](_0x587441['where'],{'$or':_['map'](_0x587441[_0xb39c('0x4a')],function(_0x35fbaa){var _0x533b4a={};_0x533b4a[_0x35fbaa]={'$like':'%'+_0x3f52c8[_0xb39c('0x44')]['filter']+'%'};return _0x533b4a;})});}_0x587441=_[_0xb39c('0x59')]({},_0x587441,_0x3f52c8['options']);return db[_0xb39c('0xdc')][_0xb39c('0x1e')]({'where':_0x587441[_0xb39c('0x43')]})[_0xb39c('0x22')](function(_0x1f6a34){_0x2af52e[_0xb39c('0x1e')]=_0x1f6a34;if(_0x3f52c8[_0xb39c('0x44')][_0xb39c('0x45')]){_0x587441[_0xb39c('0x48')]=[{'all':!![]}];}return db['VoiceRecording'][_0xb39c('0xa7')](_0x587441);})[_0xb39c('0x22')](function(_0x2cad99){_0x2af52e[_0xb39c('0x4c')]=_0x2cad99;return _0x2af52e;});}})[_0xb39c('0x22')](respondWithFilteredResult(_0xab3d19,_0x587441))[_0xb39c('0x55')](handleError(_0xab3d19,null));};exports[_0xb39c('0xde')]=function(_0x4b3650,_0x33f352){var _0x201e92={'raw':!![],'where':{}};var _0x45ff02={};var _0x4c9870={'count':0x0,'rows':[]};return db['User'][_0xb39c('0xc5')]({'where':{'id':_0x4b3650['params']['id']}})[_0xb39c('0x22')](handleEntityNotFound(_0x33f352,null))[_0xb39c('0x22')](function(_0x35b6bb){if(_0x35b6bb){_0x45ff02[_0xb39c('0xcd')]=_[_0xb39c('0xce')](db[_0xb39c('0xdf')][_0xb39c('0x3b')]);_0x45ff02[_0xb39c('0x44')]=_[_0xb39c('0xce')](_0x4b3650['query']);_0x45ff02[_0xb39c('0xd0')]=_[_0xb39c('0xd1')](_0x45ff02[_0xb39c('0xcd')],_0x45ff02[_0xb39c('0x44')]);_0x201e92['attributes']=_['intersection'](_0x45ff02[_0xb39c('0xcd')],qs[_0xb39c('0xd2')](_0x4b3650[_0xb39c('0x44')]['fields']));_0x201e92[_0xb39c('0x4a')]=_0x201e92['attributes'][_0xb39c('0x4e')]?_0x201e92[_0xb39c('0x4a')]:_0x45ff02[_0xb39c('0xcd')];if(!_0x4b3650[_0xb39c('0x44')][_0xb39c('0xc8')](_0xb39c('0xd6'))){_0x201e92[_0xb39c('0x1c')]=qs[_0xb39c('0x1c')](_0x4b3650[_0xb39c('0x44')][_0xb39c('0x1c')]);_0x201e92[_0xb39c('0x1b')]=qs[_0xb39c('0x1b')](_0x4b3650[_0xb39c('0x44')]['offset']);}_0x201e92[_0xb39c('0xd3')]=qs[_0xb39c('0xd7')](_0x4b3650[_0xb39c('0x44')]['sort']);_0x201e92[_0xb39c('0x43')]=qs[_0xb39c('0xd0')](_[_0xb39c('0xd4')](_0x4b3650[_0xb39c('0x44')],_0x45ff02[_0xb39c('0xd0')]));_0x201e92[_0xb39c('0x43')]['UserId']=_0x35b6bb['id'];if(_0x4b3650[_0xb39c('0x44')][_0xb39c('0x2e')]){_0x201e92[_0xb39c('0x43')]=_[_0xb39c('0x59')](_0x201e92[_0xb39c('0x43')],{'$or':_['map'](_0x201e92[_0xb39c('0x4a')],function(_0x24f95e){var _0x272158={};_0x272158[_0x24f95e]={'$like':'%'+_0x4b3650[_0xb39c('0x44')][_0xb39c('0x2e')]+'%'};return _0x272158;})});}_0x201e92=_[_0xb39c('0x59')]({},_0x201e92,_0x4b3650['options']);return db[_0xb39c('0xdf')][_0xb39c('0x1e')]({'where':_0x201e92[_0xb39c('0x43')]})[_0xb39c('0x22')](function(_0x3af825){_0x4c9870[_0xb39c('0x1e')]=_0x3af825;if(_0x4b3650[_0xb39c('0x44')][_0xb39c('0x45')]){_0x201e92['include']=[{'all':!![]}];}return db[_0xb39c('0xdf')]['findAll'](_0x201e92);})[_0xb39c('0x22')](function(_0x580fb5){_0x4c9870[_0xb39c('0x4c')]=_0x580fb5;return _0x4c9870;});}})['then'](respondWithFilteredResult(_0x33f352,_0x201e92))[_0xb39c('0x55')](handleError(_0x33f352,null));};exports[_0xb39c('0xe0')]=function(_0x354975,_0x2e9689){var _0x425f02={};var _0x1fa1f9={};var _0x462083;var _0x670cf0;return db[_0xb39c('0x3a')]['findOne']({'where':{'id':_0x354975[_0xb39c('0x57')]['id']}})['then'](handleEntityNotFound(_0x2e9689,null))[_0xb39c('0x22')](function(_0xde629f){if(_0xde629f){_0x462083=_0xde629f;_0x1fa1f9[_0xb39c('0xcd')]=_[_0xb39c('0xce')](db[_0xb39c('0xe1')][_0xb39c('0x3b')]);_0x1fa1f9[_0xb39c('0x44')]=_[_0xb39c('0xce')](_0x354975[_0xb39c('0x44')]);_0x1fa1f9[_0xb39c('0xd0')]=_[_0xb39c('0xd1')](_0x1fa1f9[_0xb39c('0xcd')],_0x1fa1f9[_0xb39c('0x44')]);_0x425f02[_0xb39c('0x4a')]=_[_0xb39c('0xd1')](_0x1fa1f9[_0xb39c('0xcd')],qs['fields'](_0x354975[_0xb39c('0x44')][_0xb39c('0xd2')]));_0x425f02[_0xb39c('0x4a')]=_0x425f02['attributes'][_0xb39c('0x4e')]?_0x425f02[_0xb39c('0x4a')]:_0x1fa1f9[_0xb39c('0xcd')];_0x425f02[_0xb39c('0xd3')]=qs[_0xb39c('0xd7')](_0x354975[_0xb39c('0x44')]['sort']);_0x425f02['where']=qs[_0xb39c('0xd0')](_[_0xb39c('0xd4')](_0x354975[_0xb39c('0x44')],_0x1fa1f9[_0xb39c('0xd0')]));if(_0x354975[_0xb39c('0x44')][_0xb39c('0x2e')]){_0x425f02[_0xb39c('0x43')]=_[_0xb39c('0x59')](_0x425f02[_0xb39c('0x43')],{'$or':_[_0xb39c('0x30')](_0x425f02[_0xb39c('0x4a')],function(_0x34fd8e){var _0x930a2={};_0x930a2[_0x34fd8e]={'$like':'%'+_0x354975[_0xb39c('0x44')]['filter']+'%'};return _0x930a2;})});}_0x425f02=_[_0xb39c('0x59')]({},_0x425f02,_0x354975[_0xb39c('0x5a')]);return _0x462083[_0xb39c('0xe0')](_0x425f02);}})[_0xb39c('0x22')](function(_0x2e076c){if(_0x2e076c){_0x670cf0=_0x2e076c[_0xb39c('0x4e')];if(!_0x354975['query'][_0xb39c('0xc8')](_0xb39c('0xd6'))){_0x425f02['limit']=qs[_0xb39c('0x1c')](_0x354975[_0xb39c('0x44')][_0xb39c('0x1c')]);_0x425f02[_0xb39c('0x1b')]=qs[_0xb39c('0x1b')](_0x354975[_0xb39c('0x44')]['offset']);}return _0x462083[_0xb39c('0xe0')](_0x425f02);}})[_0xb39c('0x22')](function(_0x129338){if(_0x129338){return _0x129338?{'count':_0x670cf0,'rows':_0x129338}:null;}})[_0xb39c('0x22')](respondWithResult(_0x2e9689,null))[_0xb39c('0x55')](handleError(_0x2e9689,null));};exports[_0xb39c('0xe2')]=function(_0xf2bb03,_0x1f5dd2){var _0x1cbc89={};var _0x48260a={};var _0x383016;var _0x499f77;return db[_0xb39c('0x3a')][_0xb39c('0xc5')]({'where':{'id':_0xf2bb03[_0xb39c('0x57')]['id']}})['then'](handleEntityNotFound(_0x1f5dd2,null))[_0xb39c('0x22')](function(_0x2cd06a){if(_0x2cd06a){_0x383016=_0x2cd06a;_0x48260a['model']=_[_0xb39c('0xce')](db['OpenchannelInteraction'][_0xb39c('0x3b')]);_0x48260a['query']=_[_0xb39c('0xce')](_0xf2bb03[_0xb39c('0x44')]);_0x48260a[_0xb39c('0xd0')]=_[_0xb39c('0xd1')](_0x48260a[_0xb39c('0xcd')],_0x48260a[_0xb39c('0x44')]);_0x1cbc89['attributes']=_['intersection'](_0x48260a[_0xb39c('0xcd')],qs[_0xb39c('0xd2')](_0xf2bb03['query']['fields']));_0x1cbc89[_0xb39c('0x4a')]=_0x1cbc89[_0xb39c('0x4a')][_0xb39c('0x4e')]?_0x1cbc89['attributes']:_0x48260a[_0xb39c('0xcd')];_0x1cbc89[_0xb39c('0xd3')]=qs[_0xb39c('0xd7')](_0xf2bb03['query'][_0xb39c('0xd7')]);_0x1cbc89['where']=qs[_0xb39c('0xd0')](_[_0xb39c('0xd4')](_0xf2bb03[_0xb39c('0x44')],_0x48260a[_0xb39c('0xd0')]));if(_0xf2bb03[_0xb39c('0x44')][_0xb39c('0x2e')]){_0x1cbc89['where']=_[_0xb39c('0x59')](_0x1cbc89[_0xb39c('0x43')],{'$or':_[_0xb39c('0x30')](_0x1cbc89['attributes'],function(_0x3e9d89){var _0x4d3dfa={};_0x4d3dfa[_0x3e9d89]={'$like':'%'+_0xf2bb03['query'][_0xb39c('0x2e')]+'%'};return _0x4d3dfa;})});}_0x1cbc89=_[_0xb39c('0x59')]({},_0x1cbc89,_0xf2bb03[_0xb39c('0x5a')]);return _0x383016[_0xb39c('0xe2')](_0x1cbc89);}})[_0xb39c('0x22')](function(_0x30570f){if(_0x30570f){_0x499f77=_0x30570f['length'];if(!_0xf2bb03[_0xb39c('0x44')][_0xb39c('0xc8')](_0xb39c('0xd6'))){_0x1cbc89[_0xb39c('0x1c')]=qs['limit'](_0xf2bb03[_0xb39c('0x44')][_0xb39c('0x1c')]);_0x1cbc89[_0xb39c('0x1b')]=qs[_0xb39c('0x1b')](_0xf2bb03[_0xb39c('0x44')][_0xb39c('0x1b')]);}return _0x383016[_0xb39c('0xe2')](_0x1cbc89);}})[_0xb39c('0x22')](function(_0x162ce9){if(_0x162ce9){return _0x162ce9?{'count':_0x499f77,'rows':_0x162ce9}:null;}})[_0xb39c('0x22')](respondWithResult(_0x1f5dd2,null))[_0xb39c('0x55')](handleError(_0x1f5dd2,null));};exports[_0xb39c('0xe3')]=function(_0x4305e6,_0x151d36){var _0x3fbee5={'raw':!![],'where':{}};var _0x2603ce={};var _0x12285e={'count':0x0,'rows':[]};return db[_0xb39c('0x3a')][_0xb39c('0xc5')]({'where':{'id':_0x4305e6[_0xb39c('0x57')]['id']}})[_0xb39c('0x22')](handleEntityNotFound(_0x151d36,null))[_0xb39c('0x22')](function(_0x5b38fa){if(_0x5b38fa){_0x2603ce[_0xb39c('0xcd')]=_[_0xb39c('0xce')](db[_0xb39c('0xe4')]['rawAttributes']);_0x2603ce[_0xb39c('0x44')]=_[_0xb39c('0xce')](_0x4305e6['query']);_0x2603ce[_0xb39c('0xd0')]=_[_0xb39c('0xd1')](_0x2603ce[_0xb39c('0xcd')],_0x2603ce[_0xb39c('0x44')]);_0x3fbee5[_0xb39c('0x4a')]=_[_0xb39c('0xd1')](_0x2603ce[_0xb39c('0xcd')],qs[_0xb39c('0xd2')](_0x4305e6[_0xb39c('0x44')]['fields']));_0x3fbee5[_0xb39c('0x4a')]=_0x3fbee5[_0xb39c('0x4a')][_0xb39c('0x4e')]?_0x3fbee5['attributes']:_0x2603ce[_0xb39c('0xcd')];if(!_0x4305e6[_0xb39c('0x44')][_0xb39c('0xc8')](_0xb39c('0xd6'))){_0x3fbee5['limit']=qs[_0xb39c('0x1c')](_0x4305e6['query'][_0xb39c('0x1c')]);_0x3fbee5[_0xb39c('0x1b')]=qs[_0xb39c('0x1b')](_0x4305e6[_0xb39c('0x44')][_0xb39c('0x1b')]);}_0x3fbee5[_0xb39c('0xd3')]=qs[_0xb39c('0xd7')](_0x4305e6[_0xb39c('0x44')][_0xb39c('0xd7')]);_0x3fbee5[_0xb39c('0x43')]=qs['filters'](_[_0xb39c('0xd4')](_0x4305e6[_0xb39c('0x44')],_0x2603ce[_0xb39c('0xd0')]));_0x3fbee5[_0xb39c('0x43')][_0xb39c('0xdd')]=_0x5b38fa['id'];if(_0x4305e6['query']['filter']){_0x3fbee5['where']=_[_0xb39c('0x59')](_0x3fbee5['where'],{'$or':_[_0xb39c('0x30')](_0x3fbee5['attributes'],function(_0x3d5c43){var _0x2eba15={};_0x2eba15[_0x3d5c43]={'$like':'%'+_0x4305e6[_0xb39c('0x44')][_0xb39c('0x2e')]+'%'};return _0x2eba15;})});}_0x3fbee5=_[_0xb39c('0x59')]({},_0x3fbee5,_0x4305e6['options']);return db['MailInteraction'][_0xb39c('0x1e')]({'where':_0x3fbee5[_0xb39c('0x43')]})[_0xb39c('0x22')](function(_0x189432){_0x12285e[_0xb39c('0x1e')]=_0x189432;if(_0x4305e6[_0xb39c('0x44')]['includeAll']){_0x3fbee5['include']=[{'all':!![]}];}return db[_0xb39c('0xe4')][_0xb39c('0xa7')](_0x3fbee5);})[_0xb39c('0x22')](function(_0x277399){_0x12285e[_0xb39c('0x4c')]=_0x277399;return _0x12285e;});}})[_0xb39c('0x22')](respondWithFilteredResult(_0x151d36,_0x3fbee5))['catch'](handleError(_0x151d36,null));};exports[_0xb39c('0xe5')]=function(_0x453c34,_0x174f25){var _0x392cfe={};var _0x4064b9={};var _0x3ffff6;var _0x8f9cbc;return db[_0xb39c('0x3a')]['findOne']({'where':{'id':_0x453c34[_0xb39c('0x57')]['id']}})[_0xb39c('0x22')](handleEntityNotFound(_0x174f25,null))[_0xb39c('0x22')](function(_0xc5958a){if(_0xc5958a){_0x3ffff6=_0xc5958a;_0x4064b9['model']=_['keys'](db[_0xb39c('0xe6')][_0xb39c('0x3b')]);_0x4064b9[_0xb39c('0x44')]=_[_0xb39c('0xce')](_0x453c34[_0xb39c('0x44')]);_0x4064b9[_0xb39c('0xd0')]=_[_0xb39c('0xd1')](_0x4064b9[_0xb39c('0xcd')],_0x4064b9['query']);_0x392cfe[_0xb39c('0x4a')]=_[_0xb39c('0xd1')](_0x4064b9[_0xb39c('0xcd')],qs[_0xb39c('0xd2')](_0x453c34[_0xb39c('0x44')][_0xb39c('0xd2')]));_0x392cfe['attributes']=_0x392cfe[_0xb39c('0x4a')]['length']?_0x392cfe[_0xb39c('0x4a')]:_0x4064b9[_0xb39c('0xcd')];_0x392cfe[_0xb39c('0xd3')]=qs[_0xb39c('0xd7')](_0x453c34[_0xb39c('0x44')][_0xb39c('0xd7')]);_0x392cfe[_0xb39c('0x43')]=qs[_0xb39c('0xd0')](_['pick'](_0x453c34[_0xb39c('0x44')],_0x4064b9[_0xb39c('0xd0')]));if(_0x453c34[_0xb39c('0x44')][_0xb39c('0x2e')]){_0x392cfe[_0xb39c('0x43')]=_[_0xb39c('0x59')](_0x392cfe[_0xb39c('0x43')],{'$or':_['map'](_0x392cfe[_0xb39c('0x4a')],function(_0x4e5c7d){var _0xfa102b={};_0xfa102b[_0x4e5c7d]={'$like':'%'+_0x453c34[_0xb39c('0x44')]['filter']+'%'};return _0xfa102b;})});}_0x392cfe=_[_0xb39c('0x59')]({},_0x392cfe,_0x453c34[_0xb39c('0x5a')]);return _0x3ffff6[_0xb39c('0xe5')](_0x392cfe);}})[_0xb39c('0x22')](function(_0x49758e){if(_0x49758e){_0x8f9cbc=_0x49758e[_0xb39c('0x4e')];if(!_0x453c34[_0xb39c('0x44')][_0xb39c('0xc8')](_0xb39c('0xd6'))){_0x392cfe[_0xb39c('0x1c')]=qs['limit'](_0x453c34[_0xb39c('0x44')]['limit']);_0x392cfe['offset']=qs[_0xb39c('0x1b')](_0x453c34[_0xb39c('0x44')][_0xb39c('0x1b')]);}return _0x3ffff6['getSmsInteractions'](_0x392cfe);}})['then'](function(_0x4f444b){if(_0x4f444b){return _0x4f444b?{'count':_0x8f9cbc,'rows':_0x4f444b}:null;}})[_0xb39c('0x22')](respondWithResult(_0x174f25,null))[_0xb39c('0x55')](handleError(_0x174f25,null));};exports['getFaxInteractions']=function(_0x1fe730,_0x4683bc){var _0x1f56f5={};var _0x44d96e={};var _0x46839d;var _0x4489d0;return db['User'][_0xb39c('0xc5')]({'where':{'id':_0x1fe730[_0xb39c('0x57')]['id']}})[_0xb39c('0x22')](handleEntityNotFound(_0x4683bc,null))[_0xb39c('0x22')](function(_0x4a5b6e){if(_0x4a5b6e){_0x46839d=_0x4a5b6e;_0x44d96e[_0xb39c('0xcd')]=_[_0xb39c('0xce')](db[_0xb39c('0xe7')][_0xb39c('0x3b')]);_0x44d96e['query']=_[_0xb39c('0xce')](_0x1fe730[_0xb39c('0x44')]);_0x44d96e['filters']=_['intersection'](_0x44d96e['model'],_0x44d96e['query']);_0x1f56f5[_0xb39c('0x4a')]=_['intersection'](_0x44d96e['model'],qs[_0xb39c('0xd2')](_0x1fe730[_0xb39c('0x44')]['fields']));_0x1f56f5[_0xb39c('0x4a')]=_0x1f56f5[_0xb39c('0x4a')][_0xb39c('0x4e')]?_0x1f56f5[_0xb39c('0x4a')]:_0x44d96e[_0xb39c('0xcd')];_0x1f56f5['order']=qs[_0xb39c('0xd7')](_0x1fe730[_0xb39c('0x44')][_0xb39c('0xd7')]);_0x1f56f5['where']=qs[_0xb39c('0xd0')](_[_0xb39c('0xd4')](_0x1fe730[_0xb39c('0x44')],_0x44d96e['filters']));if(_0x1fe730['query'][_0xb39c('0x2e')]){_0x1f56f5[_0xb39c('0x43')]=_[_0xb39c('0x59')](_0x1f56f5['where'],{'$or':_[_0xb39c('0x30')](_0x1f56f5[_0xb39c('0x4a')],function(_0xe167cf){var _0x29feae={};_0x29feae[_0xe167cf]={'$like':'%'+_0x1fe730[_0xb39c('0x44')][_0xb39c('0x2e')]+'%'};return _0x29feae;})});}_0x1f56f5=_[_0xb39c('0x59')]({},_0x1f56f5,_0x1fe730['options']);return _0x46839d[_0xb39c('0xe8')](_0x1f56f5);}})[_0xb39c('0x22')](function(_0x2f1504){if(_0x2f1504){_0x4489d0=_0x2f1504['length'];if(!_0x1fe730[_0xb39c('0x44')]['hasOwnProperty'](_0xb39c('0xd6'))){_0x1f56f5[_0xb39c('0x1c')]=qs['limit'](_0x1fe730['query'][_0xb39c('0x1c')]);_0x1f56f5['offset']=qs[_0xb39c('0x1b')](_0x1fe730[_0xb39c('0x44')][_0xb39c('0x1b')]);}return _0x46839d[_0xb39c('0xe8')](_0x1f56f5);}})[_0xb39c('0x22')](function(_0xfa43e6){if(_0xfa43e6){return _0xfa43e6?{'count':_0x4489d0,'rows':_0xfa43e6}:null;}})[_0xb39c('0x22')](respondWithResult(_0x4683bc,null))[_0xb39c('0x55')](handleError(_0x4683bc,null));};exports[_0xb39c('0xe9')]=function(_0x47b409,_0x3fc8bd){var _0x5b0d84={};var _0x3c8dac={};var _0x21c626;var _0x4652e3;return db[_0xb39c('0x3a')][_0xb39c('0xc5')]({'where':{'id':_0x47b409[_0xb39c('0x57')]['id']}})[_0xb39c('0x22')](handleEntityNotFound(_0x3fc8bd,null))[_0xb39c('0x22')](function(_0x434c6d){if(_0x434c6d){_0x21c626=_0x434c6d;_0x3c8dac['model']=_['keys'](db['WhatsappInteraction'][_0xb39c('0x3b')]);_0x3c8dac[_0xb39c('0x44')]=_['keys'](_0x47b409[_0xb39c('0x44')]);_0x3c8dac[_0xb39c('0xd0')]=_['intersection'](_0x3c8dac[_0xb39c('0xcd')],_0x3c8dac[_0xb39c('0x44')]);_0x5b0d84[_0xb39c('0x4a')]=_['intersection'](_0x3c8dac[_0xb39c('0xcd')],qs[_0xb39c('0xd2')](_0x47b409[_0xb39c('0x44')][_0xb39c('0xd2')]));_0x5b0d84[_0xb39c('0x4a')]=_0x5b0d84[_0xb39c('0x4a')]['length']?_0x5b0d84[_0xb39c('0x4a')]:_0x3c8dac[_0xb39c('0xcd')];_0x5b0d84[_0xb39c('0xd3')]=qs[_0xb39c('0xd7')](_0x47b409[_0xb39c('0x44')][_0xb39c('0xd7')]);_0x5b0d84[_0xb39c('0x43')]=qs[_0xb39c('0xd0')](_['pick'](_0x47b409[_0xb39c('0x44')],_0x3c8dac['filters']));if(_0x47b409[_0xb39c('0x44')][_0xb39c('0x2e')]){_0x5b0d84[_0xb39c('0x43')]=_[_0xb39c('0x59')](_0x5b0d84[_0xb39c('0x43')],{'$or':_[_0xb39c('0x30')](_0x5b0d84[_0xb39c('0x4a')],function(_0x534ddc){var _0x2afc38={};_0x2afc38[_0x534ddc]={'$like':'%'+_0x47b409[_0xb39c('0x44')][_0xb39c('0x2e')]+'%'};return _0x2afc38;})});}_0x5b0d84=_[_0xb39c('0x59')]({},_0x5b0d84,_0x47b409[_0xb39c('0x5a')]);return _0x21c626[_0xb39c('0xe9')](_0x5b0d84);}})['then'](function(_0x185320){if(_0x185320){_0x4652e3=_0x185320[_0xb39c('0x4e')];if(!_0x47b409['query'][_0xb39c('0xc8')](_0xb39c('0xd6'))){_0x5b0d84[_0xb39c('0x1c')]=qs[_0xb39c('0x1c')](_0x47b409[_0xb39c('0x44')][_0xb39c('0x1c')]);_0x5b0d84[_0xb39c('0x1b')]=qs[_0xb39c('0x1b')](_0x47b409[_0xb39c('0x44')]['offset']);}return _0x21c626[_0xb39c('0xe9')](_0x5b0d84);}})[_0xb39c('0x22')](function(_0x480284){if(_0x480284){return _0x480284?{'count':_0x4652e3,'rows':_0x480284}:null;}})['then'](respondWithResult(_0x3fc8bd,null))['catch'](handleError(_0x3fc8bd,null));};exports[_0xb39c('0xea')]=function(_0xcde79f,_0x38e1ee,_0x219bcc){var _0x248b2f;var _0x214051;var _0x304d52;var _0x366d99=!_[_0xb39c('0x66')](_0xcde79f[_0xb39c('0x57')]['id'])?_0xcde79f[_0xb39c('0x57')]['id']:!_['isNil'](_0xcde79f[_0xb39c('0x2a')]['id'])?_0xcde79f[_0xb39c('0x2a')]['id']:null;return db[_0xb39c('0x3a')][_0xb39c('0x33')]({'where':{'id':_0x366d99,'role':{'$or':[_0xb39c('0x28'),'user',_0xb39c('0x24')]}},'attributes':['id',_0xb39c('0x34'),_0xb39c('0xeb'),_0xb39c('0xec'),'role',_0xb39c('0x60'),'loginInPause']})['then'](function(_0x1f34d1){if(_0x1f34d1){if(_0x1f34d1[_0xb39c('0x23')]==='agent'){_0x248b2f=_0x1f34d1;if(_0xcde79f[_0xb39c('0x5c')]['interface']){_0x304d52=util['format'](_0xb39c('0xed'),_0x248b2f[_0xcde79f[_0xb39c('0x5c')]['interface']]);}else if(_0xcde79f[_0xb39c('0x5c')][_0xb39c('0xee')]){_0x304d52=util['format']('SIP/%s',_0xcde79f[_0xb39c('0x5c')][_0xb39c('0xee')]);}else{_0x304d52=util[_0xb39c('0xa9')](_0xb39c('0xaa'),_0x248b2f['name']);}socket['to'](util[_0xb39c('0xa9')](_0xb39c('0xef'),_0x248b2f[_0xb39c('0x34')]))[_0xb39c('0x25')]('user:forcelogout',{'user':{'id':_0x248b2f['id'],'name':_0x248b2f[_0xb39c('0x34')]},'ip':_0xcde79f['headers'][_0xb39c('0xf0')]||_0xcde79f[_0xb39c('0xf1')][_0xb39c('0xf2')]||_0xcde79f[_0xb39c('0xf3')][_0xb39c('0xf2')]||_0xcde79f[_0xb39c('0xf1')]['socket'][_0xb39c('0xf2')]});return db[_0xb39c('0xab')][_0xb39c('0x26')]({'where':{'membername':_0x248b2f[_0xb39c('0x34')]},'individualHooks':!![]});}}else{throw new db[(_0xb39c('0x8d'))][(_0xb39c('0x8e'))](_0xb39c('0xf4'));}})[_0xb39c('0x22')](function(){if(_0x248b2f){return _0x248b2f[_0xb39c('0xf5')]({'raw':!![]});}})[_0xb39c('0x22')](function(_0x3ce95d){if(_0x248b2f){if(_0x3ce95d){_0x214051=_0x3ce95d;if(_0x214051[_0xb39c('0x4e')]){var _0x563c6f=_0x214051[_0xb39c('0x30')](function(_0x3b1a6f){var _0x895155={'membername':_0x248b2f[_0xb39c('0x34')],'UserId':_0x248b2f['id'],'queue_name':_0x3b1a6f['name'],'VoiceQueueId':_0x3b1a6f['id'],'interface':_0x304d52,'paused':_0x248b2f[_0xb39c('0xf6')]||![],'penalty':_0x3b1a6f['UserVoiceQueue.penalty']||0x0};return db[_0xb39c('0xab')][_0xb39c('0xac')](_0x895155);});return Promise['all'](_0x563c6f);}}}})[_0xb39c('0x22')](function(){if(_0x248b2f){return db[_0xb39c('0xf7')][_0xb39c('0xa7')]({'where':{'membername':_0x248b2f['name'],'exitAt':null}});}})[_0xb39c('0x22')](function(_0x55b4a6){if(_0x248b2f){var _0x112f8e=[];_0x55b4a6[_0xb39c('0xf8')](function(_0x40b588){_0x112f8e[_0xb39c('0x4b')](_0x40b588[_0xb39c('0x21')]({'exitAt':moment()[_0xb39c('0xa9')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xb39c('0x5b')](_0x112f8e);}})['then'](function(){if(_0x248b2f){var _0x3eb101=[];var _0xa3b107=[];var _0x36342f=utils['getChannels']();var _0x2d8f49={'membername':_0x248b2f[_0xb39c('0x34')],'interface':_0x304d52,'enterAt':moment()[_0xb39c('0xa9')](_0xb39c('0xf9')),'role':_0x248b2f[_0xb39c('0x23')],'internal':_0x248b2f[_0xb39c('0x60')]};_0x36342f[_0xb39c('0xf8')](function(_0x4c7b44){_0x3eb101['push'](_['merge']({'channel':_0x4c7b44,'type':_0xb39c('0xfa'),'data1':_0xcde79f[_0xb39c('0x5c')][_0xb39c('0xfb')],'data2':_0x304d52},_0x2d8f49));if(_0x248b2f[_0xb39c('0xf6')]){_0xa3b107['push'](_[_0xb39c('0x59')]({'channel':_0x4c7b44,'type':_0xb39c('0xfc'),'data1':_0xb39c('0xfd')},_0x2d8f49));}});return db[_0xb39c('0xf7')][_0xb39c('0xfe')](_0x3eb101[_0xb39c('0xc3')](_0xa3b107),{'individualHooks':!![]});}})['then'](function(){if(_0x248b2f){return _0x248b2f[_0xb39c('0x21')]({'online':!![],'lastLoginAt':moment()[_0xb39c('0xa9')](_0xb39c('0xf9')),'voicePause':_0x248b2f[_0xb39c('0xf6')]||![],'mailPause':_0x248b2f[_0xb39c('0xf6')]||![],'chatPause':_0x248b2f[_0xb39c('0xf6')]||![],'faxPause':_0x248b2f[_0xb39c('0xf6')]||![],'smsPause':_0x248b2f[_0xb39c('0xf6')]||![],'openchannelPause':_0x248b2f['loginInPause']||![],'whatsappPause':_0x248b2f[_0xb39c('0xf6')]||![],'pauseType':_0x248b2f[_0xb39c('0xf6')]?_0xb39c('0xfd'):null,'interface':_0x304d52,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xb39c('0x22')](function(_0x1bffb6){if(_0xcde79f[_0xb39c('0xff')]){return _0x219bcc();}else{return Promise[_0xb39c('0x100')](_0x1bffb6)[_0xb39c('0x22')](respondWithResult(_0x38e1ee,null));}})[_0xb39c('0x55')](handleError(_0x38e1ee,null));};exports[_0xb39c('0x101')]=function(_0x253bf3,_0x3f8ea7){var _0x5d2e42;return db['User']['find']({'where':{'id':_0x253bf3['params']['id'],'role':'agent'},'attributes':['id',_0xb39c('0x34'),_0xb39c('0x23')]})['then'](handleEntityNotFound(_0x3f8ea7,null))[_0xb39c('0x22')](function(_0x3f6a6a){if(_0x3f6a6a){_0x5d2e42=_0x3f6a6a;return db[_0xb39c('0xab')]['destroy']({'where':{'membername':_0x5d2e42[_0xb39c('0x34')]},'individualHooks':!![]});}})[_0xb39c('0x22')](function(){return db[_0xb39c('0xf7')][_0xb39c('0xa7')]({'where':{'membername':_0x5d2e42[_0xb39c('0x34')],'exitAt':null}});})['then'](function(_0x39119b){var _0x25f3b5=[];_0x39119b[_0xb39c('0xf8')](function(_0x2620a3){_0x25f3b5[_0xb39c('0x4b')](_0x2620a3['update']({'exitAt':moment()[_0xb39c('0xa9')](_0xb39c('0xf9'))}));});return Promise[_0xb39c('0x5b')](_0x25f3b5);})[_0xb39c('0x22')](function(){return _0x5d2e42[_0xb39c('0x21')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x3f8ea7,null))[_0xb39c('0x55')](handleError(_0x3f8ea7,null));};exports[_0xb39c('0x102')]=function(_0x31cd2b,_0x3ab927){var _0x12baf6;return db[_0xb39c('0xab')][_0xb39c('0x21')]({'paused':0x1},{'where':{'UserId':_0x31cd2b[_0xb39c('0x57')]['id']},'individualHooks':!![]})['then'](function(){return db[_0xb39c('0x3a')][_0xb39c('0x33')]({'where':{'id':_0x31cd2b[_0xb39c('0x57')]['id'],'role':_0xb39c('0x24')},'attributes':['id',_0xb39c('0x34'),'role',_0xb39c('0x60'),_0xb39c('0x9b'),'online']});})[_0xb39c('0x22')](handleEntityNotFound(_0x3ab927,null))['then'](function(_0x94c98e){if(_0x94c98e){_0x12baf6=_0x94c98e;return db[_0xb39c('0xf7')][_0xb39c('0xa7')]({'where':{'membername':_0x12baf6[_0xb39c('0x34')],'type':'PAUSE','exitAt':null}});}})[_0xb39c('0x22')](function(_0x3d7897){if(_0x3d7897[_0xb39c('0x4e')]){var _0xf41cb3=moment()[_0xb39c('0xa9')](_0xb39c('0xf9'));for(var _0x2ab90a=0x0,_0x1a32ae=_0x3d7897[_0xb39c('0x4e')];_0x2ab90a<_0x1a32ae;_0x2ab90a++){_0x3d7897[_0x2ab90a][_0xb39c('0x103')]({'exitAt':_0xf41cb3});}}})[_0xb39c('0x22')](function(){var _0x5a322e=[];var _0x15b051=utils[_0xb39c('0x104')]();_0x15b051[_0xb39c('0xf8')](function(_0x9d242a){_0x5a322e[_0xb39c('0x4b')]({'channel':_0x9d242a,'membername':_0x12baf6[_0xb39c('0x34')],'interface':_['isNil'](_0x12baf6['interface'])?util[_0xb39c('0xa9')](_0xb39c('0xaa'),_0x12baf6[_0xb39c('0x34')]):_0x12baf6['interface'],'type':_0xb39c('0xfc'),'enterAt':moment()[_0xb39c('0xa9')](_0xb39c('0xf9')),'data1':_0x31cd2b[_0xb39c('0x5c')][_0xb39c('0x3d')]||'DEFAULT\x20PAUSE','role':_0x12baf6['role'],'internal':_0x12baf6[_0xb39c('0x60')]});});return db[_0xb39c('0xf7')][_0xb39c('0xfe')](_0x5a322e,{'individualHooks':!![]});})[_0xb39c('0x22')](function(){return _0x12baf6[_0xb39c('0x21')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x31cd2b[_0xb39c('0x5c')][_0xb39c('0x3d')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format'](_0xb39c('0xf9'))});})[_0xb39c('0x22')](respondWithResult(_0x3ab927,null))[_0xb39c('0x55')](handleError(_0x3ab927,null));};exports[_0xb39c('0x105')]=function(_0x223c74,_0x54e7fb){if(_0x223c74[_0xb39c('0x5c')][_0xb39c('0x98')]&&!utils[_0xb39c('0x9c')](_0x223c74[_0xb39c('0x5c')][_0xb39c('0x98')])){throw new APIBadRequestError(util[_0xb39c('0xa9')](_0xb39c('0x106'),_0x223c74['body'][_0xb39c('0x98')]));}return db[_0xb39c('0x3a')]['find']({'where':{'id':_0x223c74[_0xb39c('0x57')]['id']},'attributes':['id','name',_0xb39c('0x23'),_0xb39c('0x60'),_0xb39c('0x9b'),_0xb39c('0x99'),_0xb39c('0x9a'),_0xb39c('0x107'),_0xb39c('0x108'),_0xb39c('0x109'),_0xb39c('0x10a'),'smsPause',_0xb39c('0x10b'),_0xb39c('0x10c'),_0xb39c('0x10d')]})[_0xb39c('0x22')](function(_0x322309){if(!_0x322309){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x223c74['params']['id']));}return _0x322309['unpause'](_0x223c74[_0xb39c('0x5c')][_0xb39c('0x98')]);})[_0xb39c('0x22')](respondWithResult(_0x54e7fb,null))[_0xb39c('0x55')](APIHandleError(_0x54e7fb));};exports[_0xb39c('0x10e')]=function(_0x5afd61,_0x28e0eb){var _0x4952d5={};var _0x21e0de={};var _0x25750a;var _0x237384;return db[_0xb39c('0x3a')][_0xb39c('0xc5')]({'where':{'id':_0x5afd61[_0xb39c('0x57')]['id']}})[_0xb39c('0x22')](handleEntityNotFound(_0x28e0eb,null))[_0xb39c('0x22')](function(_0x47076e){if(_0x47076e){_0x25750a=_0x47076e;_0x21e0de['model']=_['keys'](db[_0xb39c('0x10f')][_0xb39c('0x3b')]);_0x21e0de[_0xb39c('0x44')]=_[_0xb39c('0xce')](_0x5afd61[_0xb39c('0x44')]);_0x21e0de[_0xb39c('0xd0')]=_[_0xb39c('0xd1')](_0x21e0de['model'],_0x21e0de[_0xb39c('0x44')]);_0x4952d5[_0xb39c('0x4a')]=_['intersection'](_0x21e0de[_0xb39c('0xcd')],qs[_0xb39c('0xd2')](_0x5afd61[_0xb39c('0x44')][_0xb39c('0xd2')]));_0x4952d5[_0xb39c('0x4a')]=_0x4952d5[_0xb39c('0x4a')][_0xb39c('0x4e')]?_0x4952d5[_0xb39c('0x4a')]:_0x21e0de['model'];_0x4952d5[_0xb39c('0xd3')]=qs['sort'](_0x5afd61[_0xb39c('0x44')]['sort']);_0x4952d5['where']=qs[_0xb39c('0xd0')](_['pick'](_0x5afd61[_0xb39c('0x44')],_0x21e0de[_0xb39c('0xd0')]));if(_0x5afd61['query'][_0xb39c('0x2e')]){_0x4952d5['where']=_['merge'](_0x4952d5['where'],{'$or':_[_0xb39c('0x30')](_0x4952d5[_0xb39c('0x4a')],function(_0x52c75a){var _0x2b308e={};_0x2b308e[_0x52c75a]={'$like':'%'+_0x5afd61[_0xb39c('0x44')][_0xb39c('0x2e')]+'%'};return _0x2b308e;})});}_0x4952d5=_[_0xb39c('0x59')]({},_0x4952d5,_0x5afd61[_0xb39c('0x5a')]);return _0x25750a[_0xb39c('0x10e')](_0x4952d5);}})[_0xb39c('0x22')](function(_0xc913aa){if(_0xc913aa){_0x237384=_0xc913aa[_0xb39c('0x4e')];if(!_0x5afd61[_0xb39c('0x44')][_0xb39c('0xc8')](_0xb39c('0xd6'))){_0x4952d5[_0xb39c('0x1c')]=qs['limit'](_0x5afd61[_0xb39c('0x44')]['limit']);_0x4952d5[_0xb39c('0x1b')]=qs[_0xb39c('0x1b')](_0x5afd61[_0xb39c('0x44')][_0xb39c('0x1b')]);}return _0x25750a[_0xb39c('0x10e')](_0x4952d5);}})[_0xb39c('0x22')](function(_0x6a2714){if(_0x6a2714){return _0x6a2714?{'count':_0x237384,'rows':_0x6a2714}:null;}})['then'](respondWithResult(_0x28e0eb,null))[_0xb39c('0x55')](handleError(_0x28e0eb,null));};exports['addTeams']=function(_0x3bad26,_0x17ff08){var _0x2af36f=_0x3bad26[_0xb39c('0x57')]['id'];var _0x48e941=_0x3bad26[_0xb39c('0x5c')]?_0x3bad26[_0xb39c('0x5c')]['ids']:null;var _0x1bdc2f=[];return Promise[_0xb39c('0x100')]()['then'](function(){if(!_0x48e941)throw new APIBadRequestError(_0xb39c('0x110'));})[_0xb39c('0x22')](function(){return db[_0xb39c('0x3a')]['findOne']({'where':{'id':_0x2af36f}});})[_0xb39c('0x22')](function(_0x52358a){if(!_0x52358a)throw new APINotFoundError(util['format'](_0xb39c('0xc6'),_0x3bad26[_0xb39c('0x57')]['id']));return db[_0xb39c('0x68')]['transaction'](function(_0x15ca34){return _0x52358a[_0xb39c('0x111')](_0x48e941,{'transaction':_0x15ca34})[_0xb39c('0x22')](function(){return db[_0xb39c('0x10f')]['findAll']({'where':{'id':{'$in':_0x48e941}}});})[_0xb39c('0x22')](function(_0xf234e7){var _0x416f0b=_[_0xb39c('0x30')](_0xf234e7,function(_0x4bd5b3){return _0x4bd5b3[_0xb39c('0x112')]();});return Promise['all'](_0x416f0b);})[_0xb39c('0x22')](function(_0x459d17){_0x1bdc2f=_[_0xb39c('0x113')](_0x459d17);var _0x2552c2=_[_0xb39c('0x30')](_0x1bdc2f,function(_0x4ea5fa){return _0x4ea5fa[_0xb39c('0x114')](_0x52358a['id'],{'transaction':_0x15ca34});});return Promise['all'](_0x2552c2);})['then'](function(){if(!_0x52358a[_0xb39c('0x99')])return;var _0x492860=_[_0xb39c('0x2e')](_0x1bdc2f,function(_0x166841){return _0x166841[_0xb39c('0x115')]('channel')===_0xb39c('0x116');});var _0x717f27=_[_0xb39c('0x30')](_0x492860,function(_0x5570bf){return db[_0xb39c('0xab')][_0xb39c('0xac')]({'membername':_0x52358a[_0xb39c('0x34')],'UserId':_0x52358a['id'],'queue_name':_0x5570bf['name'],'VoiceQueueId':_0x5570bf['id'],'interface':_['isNil'](_0x52358a[_0xb39c('0x9b')])?util['format'](_0xb39c('0xaa'),_0x52358a[_0xb39c('0x34')]):_0x52358a[_0xb39c('0x9b')],'paused':_0x52358a[_0xb39c('0x9a')]||![],'penalty':_0x52358a[_0xb39c('0xa1')]},{'transaction':_0x15ca34});});return Promise[_0xb39c('0x5b')](_0x717f27);})[_0xb39c('0x22')](function(){return db[_0xb39c('0x117')][_0xb39c('0xa7')]({'where':{'teamId':{'$in':_0x48e941}}});})['then'](function(_0x33e728){var _0x23dd8a=_[_0xb39c('0x30')](_0x33e728,function(_0x5a51a8){return db[_0xb39c('0x118')][_0xb39c('0x7d')]({'UserId':_0x52358a['id'],'VoicePrefixId':_0x5a51a8[_0xb39c('0x119')]},{'transaction':_0x15ca34});});return Promise[_0xb39c('0x5b')](_0x23dd8a);});});})['then'](function(){for(var _0x162ca1=0x0;_0x162ca1<_0x1bdc2f[_0xb39c('0x4e')];_0x162ca1++){var _0x2a78b0=_0x1bdc2f[_0x162ca1][_0xb39c('0x115')]('channel');var _0x6d7388=_0x2a78b0+_0xb39c('0xa3');socket['emit'](_0xb39c('0x2a')+_0x2a78b0+_0xb39c('0xa5'),{'UserId':_0x2af36f,['queueField']:_0x1bdc2f[_0x162ca1]['id']});}})['then'](respondWithStatusCode(_0x17ff08,null))['catch'](APIHandleError(_0x17ff08));};exports[_0xb39c('0x11a')]=function(_0x9bb44c,_0x468fa1){var _0x208131=_0x9bb44c[_0xb39c('0x57')]['id'];var _0x331593=null;if(_0x9bb44c[_0xb39c('0x44')][_0xb39c('0x5e')]){_0x331593=_['isArray'](_0x9bb44c[_0xb39c('0x44')][_0xb39c('0x5e')])?_0x9bb44c[_0xb39c('0x44')]['ids']:[_0x9bb44c[_0xb39c('0x44')][_0xb39c('0x5e')]];}var _0x5d7c95=[];return Promise['resolve']()[_0xb39c('0x22')](function(){if(!_0x331593)throw new APIBadRequestError(_0xb39c('0x11b'));})['then'](function(){return db[_0xb39c('0x3a')][_0xb39c('0xc5')]({'where':{'id':_0x208131}});})['then'](function(_0x48e24e){if(!_0x48e24e)throw new APINotFoundError(util[_0xb39c('0xa9')]('User\x20with\x20id\x20%s\x20not\x20found',_0x9bb44c[_0xb39c('0x57')]['id']));return db[_0xb39c('0x68')][_0xb39c('0x11c')](function(_0x456204){return _0x48e24e['removeTeams'](_0x331593,{'transaction':_0x456204})['then'](function(){return db[_0xb39c('0x10f')][_0xb39c('0xa7')]({'where':{'id':{'$in':_0x331593}}});})[_0xb39c('0x22')](function(_0x22a10e){var _0x2a8e7b=_[_0xb39c('0x30')](_0x22a10e,function(_0x1026ce){return _0x1026ce[_0xb39c('0x112')]();});return Promise[_0xb39c('0x5b')](_0x2a8e7b);})[_0xb39c('0x22')](function(_0x486d8a){_0x5d7c95=_[_0xb39c('0x113')](_0x486d8a);var _0x30f365=_[_0xb39c('0x30')](_0x5d7c95,function(_0x34efd2){return _0x34efd2[_0xb39c('0x11d')](_0x48e24e['id'],{'transaction':_0x456204});});return Promise[_0xb39c('0x5b')](_0x30f365);})[_0xb39c('0x22')](function(){if(!_0x48e24e['online'])return;var _0x4a88e6=_[_0xb39c('0x2e')](_0x5d7c95,function(_0x26f268){return _0x26f268[_0xb39c('0x115')](_0xb39c('0x98'))===_0xb39c('0x116');});var _0x2297e6=_[_0xb39c('0x30')](_0x4a88e6,function(_0x15b40a){return db['UserVoiceQueueRt'][_0xb39c('0x26')]({'where':{'VoiceQueueId':_0x15b40a['id'],'UserId':_0x48e24e['id']},'transaction':_0x456204});});return Promise[_0xb39c('0x5b')](_0x2297e6);})[_0xb39c('0x22')](function(){return db[_0xb39c('0x117')]['findAll']({'where':{'teamId':{'$in':_0x331593}}});})[_0xb39c('0x22')](function(_0x1f3023){var _0x52251e=_[_0xb39c('0x30')](_0x1f3023,function(_0x553940){return db[_0xb39c('0x118')][_0xb39c('0x26')]({'where':{'UserId':_0x48e24e['id'],'VoicePrefixId':_0x553940[_0xb39c('0x119')]}},{'transaction':_0x456204});});return Promise[_0xb39c('0x5b')](_0x52251e);});});})['then'](function(){for(var _0x4b8d6a=0x0;_0x4b8d6a<_0x5d7c95[_0xb39c('0x4e')];_0x4b8d6a++){var _0x170d9f=_0x5d7c95[_0x4b8d6a]['getDataValue']('channel');var _0x42d10d=_0x170d9f+_0xb39c('0xa3');socket['emit'](_0xb39c('0x2a')+_0x170d9f+_0xb39c('0xaf'),{'UserId':_0x208131,['queueField']:_0x5d7c95[_0x4b8d6a]['id']});}})['then'](respondWithStatusCode(_0x468fa1,null))[_0xb39c('0x55')](APIHandleError(_0x468fa1));};exports[_0xb39c('0x11e')]=function(_0xfdfed4,_0x259064){var _0x1aa374={};var _0x4d4481={};var _0x466846;var _0x1ce4ef;return db['User'][_0xb39c('0xc5')]({'where':{'id':_0xfdfed4[_0xb39c('0x57')]['id']}})[_0xb39c('0x22')](handleEntityNotFound(_0x259064,null))[_0xb39c('0x22')](function(_0x234a40){if(_0x234a40){_0x466846=_0x234a40;_0x4d4481[_0xb39c('0xcd')]=_['keys'](db['CmList'][_0xb39c('0x3b')]);_0x4d4481[_0xb39c('0x44')]=_[_0xb39c('0xce')](_0xfdfed4[_0xb39c('0x44')]);_0x4d4481['filters']=_['intersection'](_0x4d4481[_0xb39c('0xcd')],_0x4d4481['query']);_0x1aa374['attributes']=_['intersection'](_0x4d4481[_0xb39c('0xcd')],qs[_0xb39c('0xd2')](_0xfdfed4[_0xb39c('0x44')]['fields']));_0x1aa374[_0xb39c('0x4a')]=_0x1aa374[_0xb39c('0x4a')][_0xb39c('0x4e')]?_0x1aa374[_0xb39c('0x4a')]:_0x4d4481['model'];_0x1aa374[_0xb39c('0xd3')]=qs[_0xb39c('0xd7')](_0xfdfed4[_0xb39c('0x44')][_0xb39c('0xd7')]);_0x1aa374[_0xb39c('0x43')]=qs[_0xb39c('0xd0')](_['pick'](_0xfdfed4[_0xb39c('0x44')],_0x4d4481['filters']));if(_0xfdfed4[_0xb39c('0x44')][_0xb39c('0x2e')]){_0x1aa374[_0xb39c('0x43')]=_[_0xb39c('0x59')](_0x1aa374['where'],{'$or':_['map'](_0x1aa374[_0xb39c('0x4a')],function(_0x256024){var _0x3d439a={};_0x3d439a[_0x256024]={'$like':'%'+_0xfdfed4[_0xb39c('0x44')][_0xb39c('0x2e')]+'%'};return _0x3d439a;})});}_0x1aa374=_[_0xb39c('0x59')]({},_0x1aa374,_0xfdfed4[_0xb39c('0x5a')]);return _0x466846[_0xb39c('0x11e')](_0x1aa374);}})[_0xb39c('0x22')](function(_0x3b021b){if(_0x3b021b){_0x1ce4ef=_0x3b021b[_0xb39c('0x4e')];if(!_0xfdfed4['query']['hasOwnProperty']('nolimit')){_0x1aa374[_0xb39c('0x1c')]=qs[_0xb39c('0x1c')](_0xfdfed4[_0xb39c('0x44')][_0xb39c('0x1c')]);_0x1aa374[_0xb39c('0x1b')]=qs[_0xb39c('0x1b')](_0xfdfed4[_0xb39c('0x44')][_0xb39c('0x1b')]);}return _0x466846['getLists'](_0x1aa374);}})[_0xb39c('0x22')](function(_0x41ee91){if(_0x41ee91){return _0x41ee91?{'count':_0x1ce4ef,'rows':_0x41ee91}:null;}})[_0xb39c('0x22')](respondWithResult(_0x259064,null))['catch'](handleError(_0x259064,null));};exports[_0xb39c('0x11f')]=function(_0x54b24a,_0xec71f5){var _0x37a9a9={};var _0x5d2452={};var _0x56f1a1;return db[_0xb39c('0x3a')]['findOne']({'where':{'id':_0x54b24a[_0xb39c('0x57')]['id']}})[_0xb39c('0x22')](handleEntityNotFound(_0xec71f5,null))[_0xb39c('0x22')](function(_0x198cb1){if(_0x198cb1){_0x56f1a1=_0x198cb1;_0x5d2452[_0xb39c('0xcd')]=_[_0xb39c('0xce')](db[_0xb39c('0x3a')]['rawAttributes']);_0x5d2452[_0xb39c('0x44')]=_[_0xb39c('0xce')](_0x54b24a[_0xb39c('0x44')]);_0x5d2452[_0xb39c('0xd0')]=_[_0xb39c('0xd1')](_0x5d2452[_0xb39c('0xcd')],_0x5d2452[_0xb39c('0x44')]);_0x37a9a9[_0xb39c('0x4a')]=_[_0xb39c('0xd1')](_0x5d2452[_0xb39c('0xcd')],qs[_0xb39c('0xd2')](_0x54b24a[_0xb39c('0x44')][_0xb39c('0xd2')]));_0x37a9a9['attributes']=_0x37a9a9[_0xb39c('0x4a')][_0xb39c('0x4e')]?_0x37a9a9[_0xb39c('0x4a')]:_0x5d2452[_0xb39c('0xcd')];_0x37a9a9[_0xb39c('0xd3')]=qs['sort'](_0x54b24a[_0xb39c('0x44')]['sort']);_0x37a9a9[_0xb39c('0x43')]=qs[_0xb39c('0xd0')](_[_0xb39c('0xd4')](_0x54b24a[_0xb39c('0x44')],_0x5d2452['filters']));if(_0x54b24a[_0xb39c('0x44')]['filter']){_0x37a9a9['where']=_[_0xb39c('0x59')](_0x37a9a9[_0xb39c('0x43')],{'$or':_['map'](_0x37a9a9[_0xb39c('0x4a')],function(_0x231694){var _0x411d92={};_0x411d92[_0x231694]={'$like':'%'+_0x54b24a['query'][_0xb39c('0x2e')]+'%'};return _0x411d92;})});}_0x37a9a9[_0xb39c('0xcd')]=db[_0xb39c('0x3a')];_0x37a9a9['as']=_0xb39c('0x2b');_0x37a9a9=_['merge']({},_0x37a9a9,_0x54b24a[_0xb39c('0x5a')]);return _0x56f1a1[_0xb39c('0xf5')]({'include':[_0x37a9a9]});}})[_0xb39c('0x22')](function(_0xa69e3e){if(_0xa69e3e){var _0x4815d5={},_0x22224f=[];for(var _0x4711e6=0x0;_0x4711e6<_0xa69e3e[_0xb39c('0x4e')];_0x4711e6+=0x1){for(var _0x2ddf3d=0x0,_0x3dfdf5;_0x2ddf3d<_0xa69e3e[_0x4711e6][_0xb39c('0x2b')][_0xb39c('0x4e')];_0x2ddf3d+=0x1){_0x3dfdf5=_0xa69e3e[_0x4711e6]['Agents'][_0x2ddf3d][_0xb39c('0x27')]({'plain':!![]});_0x4815d5[_0x3dfdf5['id']]=_0x3dfdf5;}}_0x4815d5=_[_0xb39c('0x120')](_0x4815d5);for(var _0x5d69a5=qs['offset'](_0x54b24a[_0xb39c('0x44')][_0xb39c('0x1b')]);_0x5d69a5<_0x4815d5[_0xb39c('0x4e')]&&_0x22224f[_0xb39c('0x4e')]=_0x43f78d){_0x35e49e=_0x43f78d;_0xa4bf7=0xc8;}else{_0xa4bf7=0xce;}_0x46210e['status'](_0xa4bf7);return _0x46210e[_0xf680('0x18')](_0xf680('0x19'),_0x2feaad+'-'+_0x35e49e+'/'+_0x43f78d)['json'](_0x109c8e);}return null;};}function saveUpdates(_0xc2d482){return function(_0x19771d){if(_0x19771d){return _0x19771d[_0xf680('0x1a')](_0xc2d482)['then'](function(_0x5799c0){if(_0x5799c0[_0xf680('0x1b')]===_0xf680('0x1c')){socket[_0xf680('0x1d')](_0xf680('0x1e')+_0x5799c0['id'],_0x5799c0);}return _0x5799c0;});}return null;};}function removeEntity(_0xefc35e){return function(_0xc0aca7){if(_0xc0aca7){return _0xc0aca7['destroy']()['then'](function(){var _0x5781f5=_0xc0aca7[_0xf680('0x1f')]({'plain':!![]});if(_0x5781f5[_0xf680('0x1b')]===_0xf680('0x20'))return;var _0xba919e=[{'name':'Users','value':'user','ignore':!![]},{'name':_0xf680('0x21'),'value':_0xf680('0x1c'),'ignore':![]},{'name':'Telephones','value':_0xf680('0x22'),'ignore':![]}];var _0x185eb7=_(_0xba919e)[_0xf680('0x23')](_0xf680('0x24'))[_0xf680('0x25')]('value')['value']();if(_['includes'](_0x185eb7,_0x5781f5[_0xf680('0x1b')])){return;}var _0x2dcd97=_[_0xf680('0x26')](_0xba919e,[_0xf680('0x27'),_0x5781f5[_0xf680('0x1b')]])[_0xf680('0x28')];return db[_0xf680('0x29')][_0xf680('0x2a')]({'where':{'type':_0x2dcd97,'resourceId':_0x5781f5['id']}})[_0xf680('0x2b')](function(){return _0xc0aca7;});})['then'](function(){_0xefc35e[_0xf680('0x12')](0xcc)[_0xf680('0x13')]();});}};}function handleEntityNotFound(_0xf10922){return function(_0x31d376){if(!_0x31d376){_0xf10922['sendStatus'](0x194);}return _0x31d376;};}function handleError(_0x19015d,_0x174e07){_0x174e07=_0x174e07||0x1f4;return function(_0x43907e){logger['error'](_0x43907e[_0xf680('0x2c')]);if(_0x43907e[_0xf680('0x28')]){delete _0x43907e['name'];}_0x19015d[_0xf680('0x12')](_0x174e07)['send'](_0x43907e);};}function getUserAttributes(){return _(db['User'][_0xf680('0x2d')])[_0xf680('0x25')](function(_0x329ba7){return{'name':_0x329ba7[_0xf680('0x2e')],'type':_0x329ba7[_0xf680('0x2f')][_0xf680('0x30')]};})[_0xf680('0x23')](function(_0x6a4e5a){return![_0xf680('0x31'),'salt',_0xf680('0x32'),_0xf680('0x33'),'resetPasswordExpires','md5secret'][_0xf680('0x34')](_0x6a4e5a[_0xf680('0x28')]);})[_0xf680('0x27')]();}exports[_0xf680('0x35')]=function(_0x3bcf15,_0x17a1f3){var _0x5f5bc7={},_0x172105={'count':0x0,'rows':[]};var _0x5ac484=getUserAttributes();_0x5f5bc7=qs[_0xf680('0x36')](_0x5ac484,_0x3bcf15);var _0x5bcee4={'where':_0x5f5bc7[_0xf680('0x37')]};return db['User'][_0xf680('0x17')](_0x5bcee4)['then'](function(_0x581d57){_0x172105[_0xf680('0x17')]=_0x581d57;if(_0x3bcf15[_0xf680('0x38')][_0xf680('0x39')]){_0x5f5bc7[_0xf680('0x3a')]=[{'all':!![]}];}if(_0x3bcf15['query'][_0xf680('0x3b')]===_0xf680('0x3c')){_0x5f5bc7['include']=[{'model':db[_0xf680('0x3d')],'as':_0xf680('0x3b')}];}if(!_['includes'](_0x5f5bc7[_0xf680('0x3e')],'id')){_0x5f5bc7[_0xf680('0x3e')][_0xf680('0x3f')]('id');}return db[_0xf680('0x40')]['findAll'](_0x5f5bc7);})[_0xf680('0x2b')](function(_0x34c0b4){_0x172105[_0xf680('0x41')]=_0x34c0b4;if(_0x3bcf15[_0xf680('0x38')][_0xf680('0x42')]===_0xf680('0x3c')){var _0x767013=[];for(var _0x4f45ad=0x0;_0x4f45ad<_0x172105[_0xf680('0x41')][_0xf680('0x43')];_0x4f45ad++){_0x767013[_0xf680('0x3f')](get_open_tabs(_0xf680('0x44'),_0x172105['rows'][_0x4f45ad]['dataValues']));_0x767013[_0xf680('0x3f')](get_open_tabs(_0xf680('0x45'),_0x172105['rows'][_0x4f45ad][_0xf680('0x46')]));_0x767013[_0xf680('0x3f')](get_open_tabs(_0xf680('0x47'),_0x172105[_0xf680('0x41')][_0x4f45ad][_0xf680('0x46')]));_0x767013['push'](get_open_tabs(_0xf680('0x48'),_0x172105['rows'][_0x4f45ad][_0xf680('0x46')]));_0x767013['push'](get_open_tabs(_0xf680('0x49'),_0x172105[_0xf680('0x41')][_0x4f45ad][_0xf680('0x46')]));_0x767013['push'](get_open_tabs(_0xf680('0x4a'),_0x172105[_0xf680('0x41')][_0x4f45ad][_0xf680('0x46')]));}return Promise[_0xf680('0x4b')](_0x767013)[_0xf680('0x2b')](function(){return _0x172105;});}else{return _0x172105;}})[_0xf680('0x2b')](respondWithFilteredResult(_0x17a1f3,_0x5f5bc7))[_0xf680('0x4c')](handleError(_0x17a1f3,null));};exports['show']=function(_0x13ff4e,_0x7ac114){var _0x426903=getUserAttributes();_0x13ff4e['query']['id']=_0x13ff4e[_0xf680('0x4d')]['id'];var _0x1966dc=qs[_0xf680('0x36')](_0x426903,_0x13ff4e);if(_0x13ff4e['query']['includeAll']){_0x1966dc[_0xf680('0x3a')]=[{'all':!![]}];}if(_0x13ff4e[_0xf680('0x38')][_0xf680('0x3b')]==='true'){_0x1966dc[_0xf680('0x3a')]=[{'model':db['UserSetting'],'as':_0xf680('0x3b')}];}_0x1966dc=_[_0xf680('0x4e')]({},_0x1966dc,_0x13ff4e[_0xf680('0x4f')]);if(!_['includes'](_0x1966dc[_0xf680('0x3e')],'id')){_0x1966dc[_0xf680('0x3e')][_0xf680('0x3f')]('id');}return db[_0xf680('0x40')][_0xf680('0x26')](_0x1966dc)[_0xf680('0x2b')](handleEntityNotFound(_0x7ac114,null))['then'](function(_0x27486e){var _0x4c1d52=[];values=_0x27486e;if(_0x13ff4e[_0xf680('0x38')][_0xf680('0x42')]===_0xf680('0x3c')){_0x4c1d52[_0xf680('0x3f')](get_open_tabs(_0xf680('0x44'),_0x27486e['dataValues']));_0x4c1d52[_0xf680('0x3f')](get_open_tabs(_0xf680('0x45'),_0x27486e[_0xf680('0x46')]));_0x4c1d52[_0xf680('0x3f')](get_open_tabs(_0xf680('0x49'),_0x27486e[_0xf680('0x46')]));_0x4c1d52[_0xf680('0x3f')](get_open_tabs(_0xf680('0x4a'),_0x27486e[_0xf680('0x46')]));_0x4c1d52[_0xf680('0x3f')](get_open_tabs(_0xf680('0x47'),_0x27486e['dataValues']));_0x4c1d52['push'](get_open_tabs(_0xf680('0x48'),_0x27486e[_0xf680('0x46')]));return Promise['all'](_0x4c1d52);}else{return values;}})[_0xf680('0x2b')](function(){return values;})[_0xf680('0x2b')](respondWithResult(_0x7ac114,null))[_0xf680('0x4c')](handleError(_0x7ac114,null));};exports[_0xf680('0x1a')]=function(_0x113161,_0x10b799){if(_0x113161[_0xf680('0x50')]['id']){delete _0x113161[_0xf680('0x50')]['id'];}delete _0x113161[_0xf680('0x50')][_0xf680('0x1b')];return db[_0xf680('0x40')][_0xf680('0x26')]({'where':{'id':_0x113161['params']['id']}})[_0xf680('0x2b')](handleEntityNotFound(_0x10b799,null))[_0xf680('0x2b')](saveUpdates(_0x113161[_0xf680('0x50')],null))[_0xf680('0x2b')](respondWithResult(_0x10b799,null))[_0xf680('0x4c')](handleError(_0x10b799,null));};exports['describe']=function(_0x20cc8f,_0x4e7414){return db['User'][_0xf680('0x51')]()[_0xf680('0x2b')](respondWithResult(_0x4e7414,null))[_0xf680('0x4c')](handleError(_0x4e7414,null));};exports[_0xf680('0x52')]=function(_0x45e851,_0x3f9b01){return db[_0xf680('0x40')][_0xf680('0x26')]({'where':{'id':_0x45e851[_0xf680('0x4d')]['id']}})[_0xf680('0x2b')](handleEntityNotFound(_0x3f9b01,null))[_0xf680('0x2b')](function(_0x2c5a98){if(_0x2c5a98){return _0x2c5a98['addContacts'](_0x45e851[_0xf680('0x50')][_0xf680('0x53')],_['omit'](_0x45e851['body'],[_0xf680('0x53'),'id'])||{});}})[_0xf680('0x2b')](respondWithResult(_0x3f9b01,null))[_0xf680('0x4c')](handleError(_0x3f9b01,null));};function validateUser(_0x26e5de){return new Promise(function(_0x5c6012,_0x550ef6){if(_0x26e5de['internal'])return _0x5c6012(_0x26e5de);return db[_0xf680('0x54')][_0xf680('0x55')](0x1)[_0xf680('0x2b')](function(_0x341e09){if(_0x341e09[_0xf680('0x56')])authService[_0xf680('0x57')](_0x26e5de[_0xf680('0x31')]);db[_0xf680('0x40')]['max']('internal')[_0xf680('0x2b')](function(_0x45b382){if(_['isNil'](_0x45b382)){_0x26e5de['internal']=_0x341e09[_0xf680('0x58')]||0x1;return;}if(_[_0xf680('0x59')](_0x341e09['min_internal'])||_0x341e09[_0xf680('0x58')]===_0x45b382){_0x26e5de[_0xf680('0x5a')]=_0x45b382+0x1;return;}if(_0x341e09[_0xf680('0x58')]>_0x45b382){_0x26e5de[_0xf680('0x5a')]=_0x341e09[_0xf680('0x58')];return;}return db[_0xf680('0x5b')][_0xf680('0x38')](_0xf680('0x5c'),{'type':db[_0xf680('0x5b')]['QueryTypes'][_0xf680('0x5d')]})['then'](function(_0x1eaebc){if(_0x1eaebc&&_0x1eaebc['length']){for(var _0x4037a5=0x0,_0x441e55=_0x1eaebc['length'];_0x4037a5<_0x441e55&&_['isNil'](_0x26e5de['internal']);_0x4037a5++){if(_0x341e09['min_internal']<=_0x1eaebc[_0x4037a5][_0xf680('0x5e')]){_0x26e5de[_0xf680('0x5a')]=_0x1eaebc[_0x4037a5][_0xf680('0x5e')];}else if(_0x341e09['min_internal']>_0x1eaebc[_0x4037a5][_0xf680('0x5e')]&&_0x341e09[_0xf680('0x58')]<=_0x1eaebc[_0x4037a5]['to']){_0x26e5de['internal']=_0x341e09[_0xf680('0x58')];}}}if(_[_0xf680('0x59')](_0x26e5de[_0xf680('0x5a')])){_0x26e5de[_0xf680('0x5a')]=_0x45b382+0x1;}return _0x5c6012(_0x26e5de);});});})[_0xf680('0x4c')](function(_0x3e0d5d){_0x550ef6(_0x3e0d5d);});});}function updateUser(_0xc91f07){return new Promise(function(_0x35a1cb,_0xd5587c){try{if(_0xc91f07[_0xf680('0x5f')]){_0xc91f07['mailbox']=_0xc91f07[_0xf680('0x5a')];_0xc91f07[_0xf680('0x60')]={'mailbox':_0xc91f07[_0xf680('0x5a')],'password':_0xc91f07[_0xf680('0x31')],'fullname':_0xc91f07[_0xf680('0x61')],'email':_0xc91f07[_0xf680('0x62')]};}if(_0xc91f07[_0xf680('0x1b')]===_0xf680('0x1c')){if(!_0xc91f07[_0xf680('0x63')])_0xc91f07['permissions']=[_0xf680('0x64'),_0xf680('0x65'),_0xf680('0x66'),_0xf680('0x67'),_0xf680('0x68'),_0xf680('0x69'),_0xf680('0x6a'),'106',_0xf680('0x6b'),'108','109',_0xf680('0x6c'),_0xf680('0x6d'),_0xf680('0x6e'),_0xf680('0x6f')];}_0x35a1cb(_0xc91f07);}catch(_0x577b55){_0xd5587c(_0x577b55);}});}exports[_0xf680('0x70')]=function(_0x299616,_0x52ee2d){if(_0x299616[_0xf680('0x71')][_0xf680('0x1b')]==='agent')throw new Error(_0xf680('0x72'));if(_0x299616[_0xf680('0x50')][_0xf680('0x1b')]===_0xf680('0x71')&&_0x299616[_0xf680('0x71')][_0xf680('0x1b')]!==_0xf680('0x20')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x299616[_0xf680('0x50')][_0xf680('0x1b')]===_0xf680('0x20')&&_0x299616['user'][_0xf680('0x1b')]!==_0xf680('0x20')){throw new Error(_0xf680('0x73'));}return licenseUtil[_0xf680('0x74')]([_0x299616[_0xf680('0x50')]])[_0xf680('0x2b')](function(){return validateUser(_0x299616[_0xf680('0x50')]);})[_0xf680('0x2b')](function(_0x4c93d7){return updateUser(_0x4c93d7)[_0xf680('0x2b')](function(_0x227183){if(_0x227183[_0xf680('0x1b')]===_0xf680('0x20')){_0x227183[_0xf680('0x75')]=_0x299616[_0xf680('0x71')]['settingsEnabled'];delete _0x227183['userProfileId'];}return _0x227183;});})[_0xf680('0x2b')](function(_0x35f247){return db[_0xf680('0x40')][_0xf680('0x70')](_0x35f247,{'include':[{'model':db[_0xf680('0x60')],'as':'VoiceMail'}]});})[_0xf680('0x2b')](function(_0x2b32c8){if(_0x299616['body']['role']===_0xf680('0x71'))return _0x2b32c8;if(_0x299616[_0xf680('0x71')]['role']!==_0xf680('0x71'))return _0x2b32c8;return db[_0xf680('0x76')][_0xf680('0x26')]({'where':{'name':_0x2b32c8[_0xf680('0x1b')]===_0xf680('0x1c')?_0xf680('0x21'):_0xf680('0x77'),'userProfileId':_0x299616[_0xf680('0x71')][_0xf680('0x78')]},'raw':!![]})[_0xf680('0x2b')](function(_0xc05481){if(!_0xc05481||_0xc05481[_0xf680('0x79')]!=0x0)return _0x2b32c8;return db[_0xf680('0x29')][_0xf680('0x70')]({'name':_0x2b32c8['name'],'resourceId':_0x2b32c8['id'],'type':_0xc05481[_0xf680('0x28')],'sectionId':_0xc05481['id']},{})[_0xf680('0x2b')](function(){return _0x2b32c8;});})[_0xf680('0x4c')](function(_0x256fa2){logger[_0xf680('0x7a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x256fa2);throw _0x256fa2;});})['then'](respondWithResult(_0x52ee2d,0xc9))[_0xf680('0x4c')](handleError(_0x52ee2d,null));};exports[_0xf680('0x7b')]=function(_0x2a4135,_0x2e5ca6){var _0x54c6c3=_0x2a4135[_0xf680('0x50')];var _0x2e669c=[];if(_0x2a4135[_0xf680('0x71')]['role']===_0xf680('0x1c'))throw new Error('Unauthorized');if(_[_0xf680('0x7c')](_0x54c6c3,['role',_0xf680('0x71')])&&_0x2a4135[_0xf680('0x71')][_0xf680('0x1b')]!==_0xf680('0x20')){throw new Error(_0xf680('0x7d'));}if(_['some'](_0x54c6c3,[_0xf680('0x1b'),_0xf680('0x20')])&&_0x2a4135[_0xf680('0x71')][_0xf680('0x1b')]!==_0xf680('0x20')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0xf680('0x74')](_0x54c6c3)[_0xf680('0x2b')](function(){return validateUser(_0x54c6c3[0x0]);})[_0xf680('0x2b')](function(){for(var _0x148a06=0x1;_0x148a06<_0x54c6c3['length'];_0x148a06++){var _0x170c5b=_0x54c6c3[_0x148a06-0x1][_0xf680('0x5a')];if(!_0x54c6c3[_0x148a06][_0xf680('0x5a')])_0x54c6c3[_0x148a06][_0xf680('0x5a')]=_0x170c5b+0x1;_0x2e669c[_0xf680('0x3f')](validateUser(_0x54c6c3[_0x148a06]));}return Promise[_0xf680('0x4b')](_0x2e669c);})[_0xf680('0x2b')](function(){_0x2e669c=[];for(var _0x1168d2=0x0;_0x1168d2<_0x54c6c3[_0xf680('0x43')];_0x1168d2++){_0x2e669c[_0xf680('0x3f')](updateUser(_0x54c6c3[_0x1168d2]));}return Promise[_0xf680('0x4b')](_0x2e669c);})[_0xf680('0x2b')](function(){_0x2e669c=_0x54c6c3['map'](function(_0x184958){return db[_0xf680('0x40')][_0xf680('0x70')](_0x184958,{'include':[{'model':db[_0xf680('0x60')],'as':_0xf680('0x60')}]})['then'](function(_0x1ff2e5){_0x184958['id']=_0x1ff2e5['id'];return _0x184958;});});return Promise[_0xf680('0x4b')](_0x2e669c);})[_0xf680('0x2b')](function(_0x51a616){if(_0x2a4135[_0xf680('0x50')][_0xf680('0x1b')]===_0xf680('0x71'))return _0x51a616;if(_0x2a4135[_0xf680('0x71')]['role']!==_0xf680('0x71'))return _0x51a616;var _0x30ecec=_[_0xf680('0x7c')](_0x51a616,function(_0x372dd4){return _0x372dd4[_0xf680('0x1b')]==='agent'||_0x372dd4[_0xf680('0x1b')]==='telephone';});if(!_0x30ecec)return _0x51a616;return db[_0xf680('0x76')][_0xf680('0x7e')]({'where':{'name':{'$or':[_0xf680('0x21'),'Telephones']},'userProfileId':_0x2a4135['user'][_0xf680('0x78')]},'raw':!![]})['then'](function(_0x120648){if(_[_0xf680('0x7f')](_0x120648)||!_[_0xf680('0x7c')](_0x120648,[_0xf680('0x79'),0x0]))return _0x51a616;_0x2e669c=[];var _0x47dcbb=_(_0x120648)[_0xf680('0x25')](function(_0x1a8edb){if(_0x1a8edb['autoAssociation']===0x1)return;return _0x1a8edb['name']==='Agents'?_0xf680('0x1c'):_0xf680('0x22');})[_0xf680('0x80')]()['value']();for(var _0x13db4c=0x0;_0x13db4c<_0x51a616[_0xf680('0x43')];_0x13db4c++){if(!_[_0xf680('0x34')](_0x47dcbb,_0x51a616[_0x13db4c][_0xf680('0x1b')]))return;var _0x4421e6=_0x51a616[_0x13db4c][_0xf680('0x1b')]===_0xf680('0x1c')?'Agents':'Telephones';_0x2e669c[_0xf680('0x3f')](db[_0xf680('0x29')]['create']({'name':_0x51a616[_0x13db4c]['name'],'resourceId':_0x51a616[_0x13db4c]['id'],'type':_0x4421e6,'sectionId':_[_0xf680('0x26')](_0x120648,[_0xf680('0x28'),_0x4421e6])['id']},{}));}return Promise[_0xf680('0x4b')](_0x2e669c);});})[_0xf680('0x2b')](respondWithResult(_0x2e5ca6,0xc9))['catch'](handleError(_0x2e5ca6,null));};exports[_0xf680('0x81')]=function(_0x45cb9c,_0x4a791b){if(_0x45cb9c['body']['id']){delete _0x45cb9c[_0xf680('0x50')]['id'];}return db[_0xf680('0x40')][_0xf680('0x26')]({'where':{'id':_0x45cb9c[_0xf680('0x4d')]['id']}})[_0xf680('0x2b')](function(_0x36f2b3){if(!_0x36f2b3)return null;if(_0x36f2b3['id']===_0x45cb9c['user']['id']){if(!_0x45cb9c[_0xf680('0x50')]['oldPassword']||!_0x45cb9c['body']['newPassword']){throw new db[(_0xf680('0x82'))][(_0xf680('0x83'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x36f2b3[_0xf680('0x84')](_0x45cb9c[_0xf680('0x50')][_0xf680('0x85')])){throw new db['Sequelize']['ValidationError']('Wrong\x20credentials');}if(_0x45cb9c['body'][_0xf680('0x85')]===_0x45cb9c[_0xf680('0x50')][_0xf680('0x86')]){throw new db['Sequelize'][(_0xf680('0x83'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x45cb9c[_0xf680('0x71')][_0xf680('0x1b')]===_0xf680('0x20')){if(!_0x45cb9c[_0xf680('0x50')][_0xf680('0x86')]){throw new db['Sequelize'][(_0xf680('0x83'))](_0xf680('0x87'));}}else if(_0x45cb9c[_0xf680('0x71')][_0xf680('0x1b')]==='user'){if(!_0x45cb9c[_0xf680('0x50')][_0xf680('0x86')]){throw new db[(_0xf680('0x82'))][(_0xf680('0x83'))](_0xf680('0x87'));}if(_0x36f2b3[_0xf680('0x1b')]!==_0xf680('0x1c')){throw new db['Sequelize'][(_0xf680('0x83'))](_0xf680('0x72'));}}else{throw new db[(_0xf680('0x82'))]['ValidationError'](_0xf680('0x72'));}return _0x36f2b3;})[_0xf680('0x2b')](handleEntityNotFound(_0x4a791b,null))[_0xf680('0x2b')](function(_0x5aa41c){return db['Setting']['findOne']({'attributes':['id',_0xf680('0x56'),_0xf680('0x88'),_0xf680('0x89')]})['then'](function(_0x298bbd){if(_0x298bbd[_0xf680('0x56')])authService['validatePasswordPattern'](_0x45cb9c[_0xf680('0x50')][_0xf680('0x86')]);if(!_0x298bbd['enforcePasswordHistory']||!_0x5aa41c[_0xf680('0x32')])return _0x5aa41c;authService[_0xf680('0x8a')](_0x45cb9c[_0xf680('0x50')][_0xf680('0x86')],_0x5aa41c[_0xf680('0x32')],_0x298bbd[_0xf680('0x89')]);return _0x5aa41c;})[_0xf680('0x2b')](saveUpdates({'password':_0x45cb9c[_0xf680('0x50')][_0xf680('0x86')],'passwordResetAt':_0x45cb9c[_0xf680('0x71')]['id']==_0x45cb9c['params']['id']?moment():null,'previousPasswords':authService[_0xf680('0x8b')](_0x45cb9c['body'][_0xf680('0x86')],_0x5aa41c['previousPasswords'])},null));})[_0xf680('0x2b')](respondWithResult(_0x4a791b,null))['catch'](handleError(_0x4a791b,null));};exports[_0xf680('0x8c')]=function(_0x2fc0bf,_0x41e6a6){var _0x1c67fb=_0x2fc0bf[_0xf680('0x50')][_0xf680('0x8d')];return db[_0xf680('0x40')][_0xf680('0x26')]({'where':{'id':_0x2fc0bf[_0xf680('0x4d')]['id']},'attributes':['id',_0xf680('0x28'),'role',_0xf680('0x8e'),_0xf680('0x8f'),_0xf680('0x90'),_0xf680('0x91')]})[_0xf680('0x2b')](handleEntityNotFound(_0x41e6a6,null))[_0xf680('0x2b')](function(_0x4dd45b){if(_0x4dd45b){if(!utils[_0xf680('0x92')](_0x1c67fb)){throw new db[(_0xf680('0x82'))][(_0xf680('0x83'))]('Unknown\x20channel');}return _0x4dd45b['add'+_[_0xf680('0x93')](_0x1c67fb[_0xf680('0x94')]())+'Queues'](_0x2fc0bf[_0xf680('0x50')][_0xf680('0x53')],{'penalty':_0x2fc0bf['body']['penalty']||0x0})[_0xf680('0x95')](function(_0x5ef0dd){for(var _0x49559d=0x0;_0x49559d<_0x2fc0bf[_0xf680('0x50')][_0xf680('0x53')][_0xf680('0x43')];_0x49559d+=0x1){var _0x4d08ae={'UserId':Number(_0x2fc0bf['params']['id'])};_0x4d08ae[_[_0xf680('0x93')](_0x1c67fb[_0xf680('0x94')]())+_0xf680('0x96')]=Number(_0x2fc0bf[_0xf680('0x50')]['ids'][_0x49559d]);socket[_0xf680('0x1d')](_0xf680('0x71')+_[_0xf680('0x93')](_0x1c67fb[_0xf680('0x94')]())+_0xf680('0x97'),_0x4d08ae);}return _0x5ef0dd;})[_0xf680('0x2b')](function(){if(_0x1c67fb===_0xf680('0x98')){return db[_0xf680('0x99')][_0xf680('0x7e')]({'where':{'id':_0x2fc0bf[_0xf680('0x50')][_0xf680('0x53')]||[]},'raw':!![],'attributes':['id',_0xf680('0x28')]});}})[_0xf680('0x2b')](function(_0x3718df){var _0x4a0f56=_0x4dd45b[_0xf680('0x1f')]({'plain':!![]});var _0x27dc03=[];if(_0x1c67fb==='voice'&&_0x4a0f56[_0xf680('0x1b')]===_0xf680('0x1c')&&_0x4a0f56[_0xf680('0x8e')]){for(let _0x332ec9=0x0;_0x332ec9<_0x3718df[_0xf680('0x43')];_0x332ec9+=0x1){_0x27dc03[_0xf680('0x3f')]({'membername':_0x4a0f56['name'],'UserId':_0x4a0f56['id'],'queue_name':_0x3718df[_0x332ec9][_0xf680('0x28')],'VoiceQueueId':_0x3718df[_0x332ec9]['id'],'interface':_[_0xf680('0x59')](_0x4a0f56[_0xf680('0x91')])?util['format'](_0xf680('0x9a'),_0x4a0f56[_0xf680('0x28')]):_0x4a0f56[_0xf680('0x91')],'paused':_0x4a0f56[_0xf680('0x90')]||![],'penalty':_0x2fc0bf[_0xf680('0x50')][_0xf680('0x9b')]||0x0});}return Promise['all'](_0x27dc03['map'](function(_0x580d3d){return db[_0xf680('0x9c')][_0xf680('0x9d')](_0x580d3d);}));}return _0x4dd45b;});}})[_0xf680('0x2b')](respondWithStatusCode(_0x41e6a6,null))['catch'](handleError(_0x41e6a6,null));};exports[_0xf680('0x9e')]=function(_0x1c0ad3,_0x94aa63){var _0x46b5eb,_0x2aff16;return db[_0xf680('0x40')]['find']({'where':{'id':_0x1c0ad3['params']['id']},'attributes':['id','name',_0xf680('0x1b')]})['then'](handleEntityNotFound(_0x94aa63,null))['then'](function(_0x566f0b){if(_0x566f0b){_0x46b5eb=_0x566f0b;if(!_0x1c0ad3[_0xf680('0x38')][_0xf680('0x8d')]||!utils[_0xf680('0x92')](_0x1c0ad3[_0xf680('0x38')][_0xf680('0x8d')])){throw new db[(_0xf680('0x82'))][(_0xf680('0x83'))]('Unknown\x20channel');}return _0x566f0b[_0xf680('0x9f')+_['capitalize'](_0x1c0ad3[_0xf680('0x38')]['channel']['toLowerCase']())+_0xf680('0xa0')](_0x1c0ad3[_0xf680('0x38')][_0xf680('0x53')]);}})['then'](function(_0x23b83b){if(_['isArray'](_0x1c0ad3[_0xf680('0x38')][_0xf680('0x53')])){for(var _0x1c2fcc=0x0;_0x1c2fcc<_0x1c0ad3[_0xf680('0x38')][_0xf680('0x53')][_0xf680('0x43')];_0x1c2fcc+=0x1){_0x2aff16={'UserId':Number(_0x1c0ad3[_0xf680('0x4d')]['id'])};_0x2aff16[_[_0xf680('0x93')](_0x1c0ad3[_0xf680('0x38')]['channel'][_0xf680('0x94')]())+_0xf680('0x96')]=Number(_0x1c0ad3[_0xf680('0x38')][_0xf680('0x53')][_0x1c2fcc]);socket['emit']('user'+_[_0xf680('0x93')](_0x1c0ad3['query'][_0xf680('0x8d')][_0xf680('0x94')]())+'Queue:remove',_0x2aff16);}}else{_0x2aff16={'UserId':Number(_0x1c0ad3[_0xf680('0x4d')]['id'])};_0x2aff16[_['capitalize'](_0x1c0ad3['query']['channel'][_0xf680('0x94')]())+_0xf680('0x96')]=Number(_0x1c0ad3[_0xf680('0x38')]['ids']);socket[_0xf680('0x1d')](_0xf680('0x71')+_[_0xf680('0x93')](_0x1c0ad3[_0xf680('0x38')]['channel']['toLowerCase']())+'Queue:remove',_0x2aff16);}return _0x23b83b;})['then'](function(){if(_0x1c0ad3[_0xf680('0x38')]['channel']==='voice'){return db[_0xf680('0x9c')]['destroy']({'where':{'UserId':_0x1c0ad3[_0xf680('0x4d')]['id'],'VoiceQueueId':_0x1c0ad3[_0xf680('0x38')][_0xf680('0x53')]},'individualHooks':!![]})['then'](function(){return _0x46b5eb;});}return _0x46b5eb;})[_0xf680('0x2b')](respondWithStatusCode(_0x94aa63,null))[_0xf680('0x4c')](handleError(_0x94aa63,null));};exports[_0xf680('0xa1')]=function(_0x3b7c26,_0x666a66){_0x3b7c26['body'][_0xf680('0xa2')]=_0x3b7c26[_0xf680('0xa3')][_0xf680('0xa4')];return db['User']['find']({'where':{'id':_0x3b7c26[_0xf680('0x4d')]['id']}})[_0xf680('0x2b')](handleEntityNotFound(_0x666a66,null))[_0xf680('0x2b')](saveUpdates(_0x3b7c26[_0xf680('0x50')],null))[_0xf680('0x2b')](respondWithResult(_0x666a66,null))[_0xf680('0x4c')](handleError(_0x666a66,null));};exports[_0xf680('0xa5')]=function(_0x51c406,_0x2ba4c6){var _0x24d731=path[_0xf680('0xa6')](config[_0xf680('0xa7')],_0xf680('0xa8'));return db['User']['find']({'where':{'id':_0x51c406[_0xf680('0x4d')]['id']},'attributes':['id',_0xf680('0xa2')],'raw':!![]})[_0xf680('0x2b')](handleEntityNotFound(_0x2ba4c6,null))[_0xf680('0x2b')](function(_0x119db5){if(_0x119db5){if(_['isNil'](_0x119db5['userpic'])){return _0x2ba4c6[_0xf680('0xa9')](_0x24d731);}else{if(!fs[_0xf680('0xaa')](path['join'](config[_0xf680('0xa7')],'server/files/images/',_0x119db5['userpic']))){return _0x2ba4c6[_0xf680('0xa9')](_0x24d731);}return _0x2ba4c6[_0xf680('0xa9')](path[_0xf680('0xa6')](config[_0xf680('0xa7')],_0xf680('0xab'),_0x119db5['userpic']));}}})['catch'](handleError(_0x2ba4c6,null));};exports[_0xf680('0xac')]=function(_0x508b09,_0x32a690){return db['User'][_0xf680('0x26')]({'where':{'id':_0x508b09[_0xf680('0x4d')]['id']},'attributes':['id']})[_0xf680('0x2b')](handleEntityNotFound(_0x32a690,null))[_0xf680('0x2b')](function(_0x3bf79f){var _0x1bf21e=[];values=_0x3bf79f[_0xf680('0x46')];_0x1bf21e[_0xf680('0x3f')](get_open_tabs(_0xf680('0x44'),_0x3bf79f[_0xf680('0x46')]));_0x1bf21e['push'](get_open_tabs(_0xf680('0x45'),_0x3bf79f['dataValues']));_0x1bf21e[_0xf680('0x3f')](get_open_tabs(_0xf680('0x49'),_0x3bf79f[_0xf680('0x46')]));_0x1bf21e[_0xf680('0x3f')](get_open_tabs('whatsapp',_0x3bf79f[_0xf680('0x46')]));_0x1bf21e[_0xf680('0x3f')](get_open_tabs(_0xf680('0x47'),_0x3bf79f[_0xf680('0x46')]));_0x1bf21e['push'](get_open_tabs(_0xf680('0x48'),_0x3bf79f[_0xf680('0x46')]));return Promise[_0xf680('0x4b')](_0x1bf21e);})[_0xf680('0x2b')](function(_0x191fa9){if(_0x191fa9){var _0x4a03bc=_['map'](values['ChatOpenTabs'],function(_0x5deb22){return{'channel':_0xf680('0xad'),'id':_0x5deb22['id'],'createdAt':_0x5deb22[_0xf680('0xae')]};});var _0x76e461=_[_0xf680('0x25')](values[_0xf680('0xaf')],function(_0x1de490){return{'channel':_0xf680('0xb0'),'id':_0x1de490['id'],'createdAt':_0x1de490[_0xf680('0xae')]};});var _0x2d8c26=_['map'](values[_0xf680('0xb1')],function(_0x42a9be){return{'channel':_0xf680('0xb2'),'id':_0x42a9be['id'],'createdAt':_0x42a9be['createdAt']};});var _0x3b6950=_[_0xf680('0x25')](values[_0xf680('0xb3')],function(_0x3ee794){return{'channel':_0xf680('0xb4'),'id':_0x3ee794['id'],'createdAt':_0x3ee794[_0xf680('0xae')]};});var _0x4ca204=_['map'](values[_0xf680('0xb5')],function(_0x3350f6){return{'channel':_0xf680('0xb6'),'id':_0x3350f6['id'],'createdAt':_0x3350f6[_0xf680('0xae')]};});var _0x80e005=_['map'](values[_0xf680('0xb7')],function(_0x249b2b){return{'channel':_0xf680('0xb8'),'id':_0x249b2b['id'],'createdAt':_0x249b2b[_0xf680('0xae')]};});var _0x4747a2=_[_0xf680('0xb9')](_0x4a03bc,_0x76e461,_0x2d8c26,_0x3b6950,_0x4ca204,_0x80e005);var _0x5b8820={'count':_0x4747a2[_0xf680('0x43')],'rows':_0x4747a2};return _0x5b8820;}else return null;})[_0xf680('0x2b')](respondWithResult(_0x32a690,null))[_0xf680('0x4c')](handleError(_0x32a690,null));};exports[_0xf680('0xba')]=function(_0xbd39f9,_0x326197){var _0x373c14={};return db['User'][_0xf680('0xbb')]({'where':{'id':_0xbd39f9[_0xf680('0x4d')]['id']}})[_0xf680('0x2b')](function(_0x4a19c6){if(!_0x4a19c6){throw new APINotFoundError(util[_0xf680('0xbc')](_0xf680('0xbd'),_0xbd39f9['params']['id']));}return contacts['describe']();})[_0xf680('0x2b')](function(_0x26794c){_0xbd39f9[_0xf680('0x38')][_0xf680('0x40')]=_0xbd39f9['params']['id'];_0x373c14=qs[_0xf680('0x36')](_0x26794c,_0xbd39f9);if(_0xbd39f9[_0xf680('0x38')]['hasOwnProperty'](_0xf680('0x39'))){_0x373c14['include']=[{'model':db['CmList'],'as':_0xf680('0xbe'),'required':![]},{'model':db[_0xf680('0xbf')],'as':_0xf680('0xc0'),'attributes':['id',_0xf680('0x28'),_0xf680('0xc1')],'where':_0xbd39f9[_0xf680('0x38')][_0xf680('0xc2')]?{'id':_0xbd39f9[_0xf680('0x38')]['tag']}:undefined,'required':_0xbd39f9[_0xf680('0x38')][_0xf680('0xc2')]?!![]:![]}];}return contacts[_0xf680('0x7e')](_0xbd39f9[_0xf680('0x38')],_0xbd39f9['user'],_0x373c14,_0x26794c);})[_0xf680('0x2b')](respondWithFilteredResult(_0x326197,_0x373c14))[_0xf680('0x4c')](APIHandleError(_0x326197));};exports[_0xf680('0xc3')]=function(_0x244e29,_0x2428e8){var _0x25a74d;var _0x3a1f08={};var _0x3d555d;return db[_0xf680('0x40')][_0xf680('0xbb')]({'where':{'id':_0x244e29[_0xf680('0x4d')]['id']},'attributes':['id',_0xf680('0x28'),_0xf680('0x1b')]})[_0xf680('0x2b')](handleEntityNotFound(_0x2428e8,null))[_0xf680('0x2b')](function(_0x2b5151){if(!utils[_0xf680('0x92')](_0x244e29[_0xf680('0x38')][_0xf680('0x8d')])){throw new db['Sequelize'][(_0xf680('0x83'))](_0xf680('0xc4'));}_0x25a74d=_0x2b5151;var _0x538c4d={};_0x538c4d['model']=_[_0xf680('0xc5')](db[_[_0xf680('0x93')](_0x244e29[_0xf680('0x38')][_0xf680('0x8d')])+_0xf680('0xc6')][_0xf680('0x2d')]);_0x538c4d[_0xf680('0x38')]=_[_0xf680('0xc5')](_0x244e29[_0xf680('0x38')]);_0x538c4d[_0xf680('0xc7')]=_['intersection'](_0x538c4d['model'],_0x538c4d[_0xf680('0x38')]);_0x3a1f08[_0xf680('0x3e')]=_[_0xf680('0xc8')](_0x538c4d['model'],qs['fields'](_0x244e29[_0xf680('0x38')]['fields']));_0x3a1f08[_0xf680('0x3e')]=_0x3a1f08['attributes'][_0xf680('0x43')]?_0x3a1f08[_0xf680('0x3e')]:_0x538c4d[_0xf680('0xc9')];_0x3a1f08[_0xf680('0xca')]=qs['sort'](_0x244e29[_0xf680('0x38')][_0xf680('0xcb')]);_0x3a1f08[_0xf680('0x37')]=qs[_0xf680('0xc7')](_[_0xf680('0xcc')](_0x244e29[_0xf680('0x38')],_0x538c4d[_0xf680('0xc7')]));if(_0x244e29[_0xf680('0x38')][_0xf680('0x23')]){_0x3a1f08[_0xf680('0x37')]=_[_0xf680('0x4e')](_0x3a1f08[_0xf680('0x37')],{'$or':_[_0xf680('0x25')](_0x3a1f08['attributes'],function(_0x34df1c){var _0x25dbb7={};_0x25dbb7[_0x34df1c]={'$like':'%'+_0x244e29[_0xf680('0x38')]['filter']+'%'};return _0x25dbb7;})});}_0x3a1f08=_[_0xf680('0x4e')]({},_0x3a1f08,_0x244e29[_0xf680('0x4f')]);switch(_0x25a74d[_0xf680('0x1b')]){case _0xf680('0x20'):return db[_[_0xf680('0x93')](_0x244e29[_0xf680('0x38')][_0xf680('0x8d')])+_0xf680('0xc6')][_0xf680('0x7e')](_0x3a1f08);case'user':case _0xf680('0x1c'):return _0x25a74d[_0xf680('0x1f')+_['capitalize'](_0x244e29[_0xf680('0x38')][_0xf680('0x8d')])+_0xf680('0xa0')](_0x3a1f08);default:throw new db[(_0xf680('0x82'))][(_0xf680('0x83'))](_0xf680('0xcd'));}})[_0xf680('0x2b')](function(_0x170064){_0x3d555d=_0x170064['length'];if(!_0x244e29[_0xf680('0x38')][_0xf680('0xce')](_0xf680('0xcf'))){_0x3a1f08[_0xf680('0x16')]=qs[_0xf680('0x16')](_0x244e29['query'][_0xf680('0x16')]);_0x3a1f08['offset']=qs[_0xf680('0x15')](_0x244e29['query'][_0xf680('0x15')]);}switch(_0x25a74d[_0xf680('0x1b')]){case'admin':return db[_[_0xf680('0x93')](_0x244e29['query'][_0xf680('0x8d')])+_0xf680('0xc6')][_0xf680('0x7e')](_0x3a1f08);case _0xf680('0x71'):case _0xf680('0x1c'):return _0x25a74d[_0xf680('0x1f')+_[_0xf680('0x93')](_0x244e29[_0xf680('0x38')][_0xf680('0x8d')])+_0xf680('0xa0')](_0x3a1f08);}})[_0xf680('0x2b')](function(_0xe87b38){return{'count':_0x3d555d,'rows':_0xe87b38};})[_0xf680('0x2b')](respondWithResult(_0x2428e8,null))['catch'](handleError(_0x2428e8,null));};exports['getVoiceQueuesRt']=function(_0x2d98a7,_0x5877a9){var _0x274d60={};var _0x14f09d={};var _0x2eeb03;var _0x11d100;return db[_0xf680('0x40')][_0xf680('0xbb')]({'where':{'id':_0x2d98a7[_0xf680('0x4d')]['id']}})[_0xf680('0x2b')](handleEntityNotFound(_0x5877a9,null))['then'](function(_0x37ff95){if(_0x37ff95){_0x2eeb03=_0x37ff95;_0x14f09d[_0xf680('0xc9')]=_['keys'](db[_0xf680('0x9c')][_0xf680('0x2d')]);_0x14f09d[_0xf680('0x38')]=_[_0xf680('0xc5')](_0x2d98a7[_0xf680('0x38')]);_0x14f09d['filters']=_[_0xf680('0xc8')](_0x14f09d[_0xf680('0xc9')],_0x14f09d[_0xf680('0x38')]);_0x274d60['attributes']=_[_0xf680('0xc8')](_0x14f09d[_0xf680('0xc9')],qs[_0xf680('0xd0')](_0x2d98a7[_0xf680('0x38')][_0xf680('0xd0')]));_0x274d60[_0xf680('0x3e')]=_0x274d60[_0xf680('0x3e')]['length']?_0x274d60[_0xf680('0x3e')]:_0x14f09d[_0xf680('0xc9')];_0x274d60['order']=qs[_0xf680('0xcb')](_0x2d98a7[_0xf680('0x38')][_0xf680('0xcb')]);_0x274d60[_0xf680('0x37')]=qs[_0xf680('0xc7')](_['pick'](_0x2d98a7[_0xf680('0x38')],_0x14f09d[_0xf680('0xc7')]));if(_0x2d98a7[_0xf680('0x38')][_0xf680('0x23')]){_0x274d60[_0xf680('0x37')]=_[_0xf680('0x4e')](_0x274d60[_0xf680('0x37')],{'$or':_[_0xf680('0x25')](_0x274d60['attributes'],function(_0x3688f3){var _0x2c16fd={};_0x2c16fd[_0x3688f3]={'$like':'%'+_0x2d98a7[_0xf680('0x38')][_0xf680('0x23')]+'%'};return _0x2c16fd;})});}_0x274d60=_[_0xf680('0x4e')]({},_0x274d60,_0x2d98a7[_0xf680('0x4f')]);return _0x2eeb03[_0xf680('0xd1')](_0x274d60);}})[_0xf680('0x2b')](function(_0x4c6e2a){if(_0x4c6e2a){_0x11d100=_0x4c6e2a['length'];if(!_0x2d98a7[_0xf680('0x38')]['hasOwnProperty']('nolimit')){_0x274d60[_0xf680('0x16')]=qs[_0xf680('0x16')](_0x2d98a7[_0xf680('0x38')][_0xf680('0x16')]);_0x274d60['offset']=qs[_0xf680('0x15')](_0x2d98a7[_0xf680('0x38')]['offset']);}return _0x2eeb03['getVoiceQueuesRt'](_0x274d60);}})[_0xf680('0x2b')](function(_0x47c149){if(_0x47c149){return _0x47c149?{'count':_0x11d100,'rows':_0x47c149}:null;}})[_0xf680('0x2b')](respondWithResult(_0x5877a9,null))[_0xf680('0x4c')](handleError(_0x5877a9,null));};exports['getGroups']=function(_0x527e41,_0x7eadb2){var _0x10b2ae={};var _0x44abbb={};var _0x288cee;var _0x5f1261;return db[_0xf680('0x40')][_0xf680('0xbb')]({'where':{'id':_0x527e41[_0xf680('0x4d')]['id']}})[_0xf680('0x2b')](handleEntityNotFound(_0x7eadb2,null))['then'](function(_0x1321d8){if(_0x1321d8){_0x288cee=_0x1321d8;_0x44abbb[_0xf680('0xc9')]=_[_0xf680('0xc5')](db[_0xf680('0xd2')][_0xf680('0x2d')]);_0x44abbb[_0xf680('0x38')]=_[_0xf680('0xc5')](_0x527e41['query']);_0x44abbb[_0xf680('0xc7')]=_[_0xf680('0xc8')](_0x44abbb['model'],_0x44abbb[_0xf680('0x38')]);_0x10b2ae['attributes']=_[_0xf680('0xc8')](_0x44abbb['model'],qs[_0xf680('0xd0')](_0x527e41['query'][_0xf680('0xd0')]));_0x10b2ae[_0xf680('0x3e')]=_0x10b2ae[_0xf680('0x3e')]['length']?_0x10b2ae[_0xf680('0x3e')]:_0x44abbb[_0xf680('0xc9')];_0x10b2ae[_0xf680('0xca')]=qs['sort'](_0x527e41[_0xf680('0x38')][_0xf680('0xcb')]);_0x10b2ae[_0xf680('0x37')]=qs[_0xf680('0xc7')](_[_0xf680('0xcc')](_0x527e41[_0xf680('0x38')],_0x44abbb[_0xf680('0xc7')]));if(_0x527e41['query'][_0xf680('0x23')]){_0x10b2ae[_0xf680('0x37')]=_['merge'](_0x10b2ae[_0xf680('0x37')],{'$or':_[_0xf680('0x25')](_0x10b2ae[_0xf680('0x3e')],function(_0x297e54){var _0x13d79b={};_0x13d79b[_0x297e54]={'$like':'%'+_0x527e41[_0xf680('0x38')][_0xf680('0x23')]+'%'};return _0x13d79b;})});}_0x10b2ae=_[_0xf680('0x4e')]({},_0x10b2ae,_0x527e41[_0xf680('0x4f')]);return _0x288cee[_0xf680('0xd3')](_0x10b2ae);}})[_0xf680('0x2b')](function(_0x5cc535){if(_0x5cc535){_0x5f1261=_0x5cc535['length'];if(!_0x527e41[_0xf680('0x38')][_0xf680('0xce')](_0xf680('0xcf'))){_0x10b2ae[_0xf680('0x16')]=qs['limit'](_0x527e41['query'][_0xf680('0x16')]);_0x10b2ae[_0xf680('0x15')]=qs[_0xf680('0x15')](_0x527e41['query']['offset']);}return _0x288cee[_0xf680('0xd3')](_0x10b2ae);}})[_0xf680('0x2b')](function(_0x1f0ca0){if(_0x1f0ca0){return _0x1f0ca0?{'count':_0x5f1261,'rows':_0x1f0ca0}:null;}})[_0xf680('0x2b')](respondWithResult(_0x7eadb2,null))[_0xf680('0x4c')](handleError(_0x7eadb2,null));};exports[_0xf680('0xd4')]=function(_0x2484ae,_0x43f52e){var _0x252124={'raw':!![],'where':{}};var _0x39efd4={};var _0x3d30a3={'count':0x0,'rows':[]};return db[_0xf680('0x40')][_0xf680('0xbb')]({'where':{'id':_0x2484ae[_0xf680('0x4d')]['id']}})[_0xf680('0x2b')](handleEntityNotFound(_0x43f52e,null))[_0xf680('0x2b')](function(_0x575025){if(_0x575025){_0x39efd4[_0xf680('0xc9')]=_[_0xf680('0xc5')](db[_0xf680('0xd5')][_0xf680('0x2d')]);_0x39efd4[_0xf680('0x38')]=_[_0xf680('0xc5')](_0x2484ae[_0xf680('0x38')]);_0x39efd4[_0xf680('0xc7')]=_[_0xf680('0xc8')](_0x39efd4['model'],_0x39efd4[_0xf680('0x38')]);_0x252124[_0xf680('0x3e')]=_[_0xf680('0xc8')](_0x39efd4[_0xf680('0xc9')],qs[_0xf680('0xd0')](_0x2484ae['query']['fields']));_0x252124['attributes']=_0x252124[_0xf680('0x3e')][_0xf680('0x43')]?_0x252124[_0xf680('0x3e')]:_0x39efd4[_0xf680('0xc9')];if(!_0x2484ae[_0xf680('0x38')]['hasOwnProperty']('nolimit')){_0x252124[_0xf680('0x16')]=qs[_0xf680('0x16')](_0x2484ae[_0xf680('0x38')]['limit']);_0x252124[_0xf680('0x15')]=qs[_0xf680('0x15')](_0x2484ae[_0xf680('0x38')]['offset']);}_0x252124[_0xf680('0xca')]=qs[_0xf680('0xcb')](_0x2484ae[_0xf680('0x38')][_0xf680('0xcb')]);_0x252124[_0xf680('0x37')]=qs['filters'](_[_0xf680('0xcc')](_0x2484ae['query'],_0x39efd4[_0xf680('0xc7')]));_0x252124['where'][_0xf680('0xd6')]=_0x575025['id'];if(_0x2484ae[_0xf680('0x38')][_0xf680('0x23')]){_0x252124['where']=_[_0xf680('0x4e')](_0x252124[_0xf680('0x37')],{'$or':_['map'](_0x252124[_0xf680('0x3e')],function(_0x3da65e){var _0x2879f6={};_0x2879f6[_0x3da65e]={'$like':'%'+_0x2484ae[_0xf680('0x38')][_0xf680('0x23')]+'%'};return _0x2879f6;})});}_0x252124=_[_0xf680('0x4e')]({},_0x252124,_0x2484ae['options']);return db['VoiceRecording'][_0xf680('0x17')]({'where':_0x252124['where']})[_0xf680('0x2b')](function(_0x38361f){_0x3d30a3[_0xf680('0x17')]=_0x38361f;if(_0x2484ae[_0xf680('0x38')][_0xf680('0x39')]){_0x252124['include']=[{'all':!![]}];}return db[_0xf680('0xd5')][_0xf680('0x7e')](_0x252124);})[_0xf680('0x2b')](function(_0x1c5ebe){_0x3d30a3[_0xf680('0x41')]=_0x1c5ebe;return _0x3d30a3;});}})[_0xf680('0x2b')](respondWithFilteredResult(_0x43f52e,_0x252124))[_0xf680('0x4c')](handleError(_0x43f52e,null));};exports['getScreenRecordings']=function(_0x257bc3,_0x4581df){var _0x465fe1={'raw':!![],'where':{}};var _0x3cf2c1={};var _0x348f8b={'count':0x0,'rows':[]};return db['User'][_0xf680('0xbb')]({'where':{'id':_0x257bc3[_0xf680('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4581df,null))[_0xf680('0x2b')](function(_0xbc81d2){if(_0xbc81d2){_0x3cf2c1[_0xf680('0xc9')]=_[_0xf680('0xc5')](db['ScreenRecording'][_0xf680('0x2d')]);_0x3cf2c1['query']=_[_0xf680('0xc5')](_0x257bc3[_0xf680('0x38')]);_0x3cf2c1['filters']=_[_0xf680('0xc8')](_0x3cf2c1[_0xf680('0xc9')],_0x3cf2c1[_0xf680('0x38')]);_0x465fe1[_0xf680('0x3e')]=_[_0xf680('0xc8')](_0x3cf2c1[_0xf680('0xc9')],qs[_0xf680('0xd0')](_0x257bc3[_0xf680('0x38')]['fields']));_0x465fe1[_0xf680('0x3e')]=_0x465fe1[_0xf680('0x3e')][_0xf680('0x43')]?_0x465fe1[_0xf680('0x3e')]:_0x3cf2c1[_0xf680('0xc9')];if(!_0x257bc3[_0xf680('0x38')][_0xf680('0xce')](_0xf680('0xcf'))){_0x465fe1['limit']=qs[_0xf680('0x16')](_0x257bc3[_0xf680('0x38')]['limit']);_0x465fe1[_0xf680('0x15')]=qs[_0xf680('0x15')](_0x257bc3[_0xf680('0x38')][_0xf680('0x15')]);}_0x465fe1[_0xf680('0xca')]=qs[_0xf680('0xcb')](_0x257bc3['query']['sort']);_0x465fe1['where']=qs['filters'](_[_0xf680('0xcc')](_0x257bc3[_0xf680('0x38')],_0x3cf2c1[_0xf680('0xc7')]));_0x465fe1[_0xf680('0x37')][_0xf680('0xd6')]=_0xbc81d2['id'];if(_0x257bc3[_0xf680('0x38')][_0xf680('0x23')]){_0x465fe1[_0xf680('0x37')]=_[_0xf680('0x4e')](_0x465fe1[_0xf680('0x37')],{'$or':_[_0xf680('0x25')](_0x465fe1[_0xf680('0x3e')],function(_0x1d4a19){var _0x3717c9={};_0x3717c9[_0x1d4a19]={'$like':'%'+_0x257bc3['query'][_0xf680('0x23')]+'%'};return _0x3717c9;})});}_0x465fe1=_[_0xf680('0x4e')]({},_0x465fe1,_0x257bc3['options']);return db[_0xf680('0xd7')][_0xf680('0x17')]({'where':_0x465fe1['where']})[_0xf680('0x2b')](function(_0x2919a2){_0x348f8b[_0xf680('0x17')]=_0x2919a2;if(_0x257bc3[_0xf680('0x38')]['includeAll']){_0x465fe1['include']=[{'all':!![]}];}return db[_0xf680('0xd7')][_0xf680('0x7e')](_0x465fe1);})[_0xf680('0x2b')](function(_0x1be4be){_0x348f8b['rows']=_0x1be4be;return _0x348f8b;});}})['then'](respondWithFilteredResult(_0x4581df,_0x465fe1))[_0xf680('0x4c')](handleError(_0x4581df,null));};exports[_0xf680('0xd8')]=function(_0x404a17,_0x375bfc){var _0x13ee3d={};var _0xe40a67={};var _0x1f5a2f;var _0x2a9007;return db[_0xf680('0x40')]['findOne']({'where':{'id':_0x404a17[_0xf680('0x4d')]['id']}})[_0xf680('0x2b')](handleEntityNotFound(_0x375bfc,null))[_0xf680('0x2b')](function(_0x3c20af){if(_0x3c20af){_0x1f5a2f=_0x3c20af;_0xe40a67['model']=_[_0xf680('0xc5')](db[_0xf680('0xd9')][_0xf680('0x2d')]);_0xe40a67['query']=_[_0xf680('0xc5')](_0x404a17['query']);_0xe40a67[_0xf680('0xc7')]=_[_0xf680('0xc8')](_0xe40a67['model'],_0xe40a67['query']);_0x13ee3d[_0xf680('0x3e')]=_[_0xf680('0xc8')](_0xe40a67[_0xf680('0xc9')],qs[_0xf680('0xd0')](_0x404a17['query'][_0xf680('0xd0')]));_0x13ee3d[_0xf680('0x3e')]=_0x13ee3d[_0xf680('0x3e')][_0xf680('0x43')]?_0x13ee3d[_0xf680('0x3e')]:_0xe40a67[_0xf680('0xc9')];_0x13ee3d[_0xf680('0xca')]=qs[_0xf680('0xcb')](_0x404a17[_0xf680('0x38')][_0xf680('0xcb')]);_0x13ee3d[_0xf680('0x37')]=qs[_0xf680('0xc7')](_[_0xf680('0xcc')](_0x404a17[_0xf680('0x38')],_0xe40a67['filters']));if(_0x404a17[_0xf680('0x38')][_0xf680('0x23')]){_0x13ee3d[_0xf680('0x37')]=_['merge'](_0x13ee3d[_0xf680('0x37')],{'$or':_[_0xf680('0x25')](_0x13ee3d[_0xf680('0x3e')],function(_0xfd71a8){var _0x1fe7d8={};_0x1fe7d8[_0xfd71a8]={'$like':'%'+_0x404a17[_0xf680('0x38')][_0xf680('0x23')]+'%'};return _0x1fe7d8;})});}_0x13ee3d=_[_0xf680('0x4e')]({},_0x13ee3d,_0x404a17['options']);return _0x1f5a2f[_0xf680('0xd8')](_0x13ee3d);}})['then'](function(_0x5d396e){if(_0x5d396e){_0x2a9007=_0x5d396e['length'];if(!_0x404a17[_0xf680('0x38')]['hasOwnProperty'](_0xf680('0xcf'))){_0x13ee3d['limit']=qs[_0xf680('0x16')](_0x404a17['query'][_0xf680('0x16')]);_0x13ee3d[_0xf680('0x15')]=qs[_0xf680('0x15')](_0x404a17[_0xf680('0x38')][_0xf680('0x15')]);}return _0x1f5a2f['getChatInteractions'](_0x13ee3d);}})[_0xf680('0x2b')](function(_0x1712e7){if(_0x1712e7){return _0x1712e7?{'count':_0x2a9007,'rows':_0x1712e7}:null;}})[_0xf680('0x2b')](respondWithResult(_0x375bfc,null))[_0xf680('0x4c')](handleError(_0x375bfc,null));};exports[_0xf680('0xda')]=function(_0xb8145b,_0x4fbc6a){var _0x249979={};var _0xe797b={};var _0x51098b;var _0x13f807;return db[_0xf680('0x40')][_0xf680('0xbb')]({'where':{'id':_0xb8145b[_0xf680('0x4d')]['id']}})[_0xf680('0x2b')](handleEntityNotFound(_0x4fbc6a,null))[_0xf680('0x2b')](function(_0x366468){if(_0x366468){_0x51098b=_0x366468;_0xe797b[_0xf680('0xc9')]=_['keys'](db[_0xf680('0xdb')][_0xf680('0x2d')]);_0xe797b[_0xf680('0x38')]=_['keys'](_0xb8145b[_0xf680('0x38')]);_0xe797b[_0xf680('0xc7')]=_['intersection'](_0xe797b[_0xf680('0xc9')],_0xe797b['query']);_0x249979[_0xf680('0x3e')]=_[_0xf680('0xc8')](_0xe797b[_0xf680('0xc9')],qs[_0xf680('0xd0')](_0xb8145b[_0xf680('0x38')][_0xf680('0xd0')]));_0x249979[_0xf680('0x3e')]=_0x249979['attributes'][_0xf680('0x43')]?_0x249979[_0xf680('0x3e')]:_0xe797b[_0xf680('0xc9')];_0x249979['order']=qs['sort'](_0xb8145b[_0xf680('0x38')][_0xf680('0xcb')]);_0x249979[_0xf680('0x37')]=qs[_0xf680('0xc7')](_[_0xf680('0xcc')](_0xb8145b[_0xf680('0x38')],_0xe797b[_0xf680('0xc7')]));if(_0xb8145b[_0xf680('0x38')][_0xf680('0x23')]){_0x249979[_0xf680('0x37')]=_[_0xf680('0x4e')](_0x249979[_0xf680('0x37')],{'$or':_[_0xf680('0x25')](_0x249979[_0xf680('0x3e')],function(_0x3dbfe7){var _0x47b49a={};_0x47b49a[_0x3dbfe7]={'$like':'%'+_0xb8145b['query']['filter']+'%'};return _0x47b49a;})});}_0x249979=_[_0xf680('0x4e')]({},_0x249979,_0xb8145b[_0xf680('0x4f')]);return _0x51098b['getOpenchannelInteractions'](_0x249979);}})[_0xf680('0x2b')](function(_0x3280dc){if(_0x3280dc){_0x13f807=_0x3280dc[_0xf680('0x43')];if(!_0xb8145b['query'][_0xf680('0xce')](_0xf680('0xcf'))){_0x249979[_0xf680('0x16')]=qs[_0xf680('0x16')](_0xb8145b[_0xf680('0x38')][_0xf680('0x16')]);_0x249979[_0xf680('0x15')]=qs['offset'](_0xb8145b[_0xf680('0x38')][_0xf680('0x15')]);}return _0x51098b['getOpenchannelInteractions'](_0x249979);}})[_0xf680('0x2b')](function(_0x4c3234){if(_0x4c3234){return _0x4c3234?{'count':_0x13f807,'rows':_0x4c3234}:null;}})[_0xf680('0x2b')](respondWithResult(_0x4fbc6a,null))['catch'](handleError(_0x4fbc6a,null));};exports[_0xf680('0xdc')]=function(_0x49e135,_0x219e8a){var _0x4cdb5f={'raw':!![],'where':{}};var _0x48ef08={};var _0x256af0={'count':0x0,'rows':[]};return db[_0xf680('0x40')][_0xf680('0xbb')]({'where':{'id':_0x49e135[_0xf680('0x4d')]['id']}})['then'](handleEntityNotFound(_0x219e8a,null))[_0xf680('0x2b')](function(_0x412f49){if(_0x412f49){_0x48ef08[_0xf680('0xc9')]=_['keys'](db['MailInteraction'][_0xf680('0x2d')]);_0x48ef08[_0xf680('0x38')]=_[_0xf680('0xc5')](_0x49e135[_0xf680('0x38')]);_0x48ef08['filters']=_['intersection'](_0x48ef08[_0xf680('0xc9')],_0x48ef08['query']);_0x4cdb5f[_0xf680('0x3e')]=_[_0xf680('0xc8')](_0x48ef08['model'],qs['fields'](_0x49e135['query']['fields']));_0x4cdb5f[_0xf680('0x3e')]=_0x4cdb5f[_0xf680('0x3e')][_0xf680('0x43')]?_0x4cdb5f[_0xf680('0x3e')]:_0x48ef08[_0xf680('0xc9')];if(!_0x49e135['query']['hasOwnProperty']('nolimit')){_0x4cdb5f[_0xf680('0x16')]=qs[_0xf680('0x16')](_0x49e135['query'][_0xf680('0x16')]);_0x4cdb5f[_0xf680('0x15')]=qs[_0xf680('0x15')](_0x49e135[_0xf680('0x38')]['offset']);}_0x4cdb5f[_0xf680('0xca')]=qs['sort'](_0x49e135[_0xf680('0x38')][_0xf680('0xcb')]);_0x4cdb5f[_0xf680('0x37')]=qs[_0xf680('0xc7')](_[_0xf680('0xcc')](_0x49e135[_0xf680('0x38')],_0x48ef08[_0xf680('0xc7')]));_0x4cdb5f[_0xf680('0x37')][_0xf680('0xd6')]=_0x412f49['id'];if(_0x49e135[_0xf680('0x38')]['filter']){_0x4cdb5f[_0xf680('0x37')]=_['merge'](_0x4cdb5f[_0xf680('0x37')],{'$or':_[_0xf680('0x25')](_0x4cdb5f['attributes'],function(_0x496946){var _0x31cafa={};_0x31cafa[_0x496946]={'$like':'%'+_0x49e135[_0xf680('0x38')]['filter']+'%'};return _0x31cafa;})});}_0x4cdb5f=_[_0xf680('0x4e')]({},_0x4cdb5f,_0x49e135[_0xf680('0x4f')]);return db['MailInteraction'][_0xf680('0x17')]({'where':_0x4cdb5f[_0xf680('0x37')]})[_0xf680('0x2b')](function(_0x14d8d3){_0x256af0['count']=_0x14d8d3;if(_0x49e135[_0xf680('0x38')][_0xf680('0x39')]){_0x4cdb5f[_0xf680('0x3a')]=[{'all':!![]}];}return db['MailInteraction']['findAll'](_0x4cdb5f);})[_0xf680('0x2b')](function(_0x504916){_0x256af0[_0xf680('0x41')]=_0x504916;return _0x256af0;});}})[_0xf680('0x2b')](respondWithFilteredResult(_0x219e8a,_0x4cdb5f))['catch'](handleError(_0x219e8a,null));};exports['getSmsInteractions']=function(_0x56029c,_0x825acc){var _0x32c23e={};var _0x44ffb5={};var _0x22a551;var _0x5757f5;return db[_0xf680('0x40')]['findOne']({'where':{'id':_0x56029c['params']['id']}})[_0xf680('0x2b')](handleEntityNotFound(_0x825acc,null))[_0xf680('0x2b')](function(_0xe6815b){if(_0xe6815b){_0x22a551=_0xe6815b;_0x44ffb5['model']=_['keys'](db[_0xf680('0xdd')]['rawAttributes']);_0x44ffb5[_0xf680('0x38')]=_[_0xf680('0xc5')](_0x56029c[_0xf680('0x38')]);_0x44ffb5[_0xf680('0xc7')]=_[_0xf680('0xc8')](_0x44ffb5['model'],_0x44ffb5['query']);_0x32c23e['attributes']=_[_0xf680('0xc8')](_0x44ffb5[_0xf680('0xc9')],qs[_0xf680('0xd0')](_0x56029c[_0xf680('0x38')]['fields']));_0x32c23e[_0xf680('0x3e')]=_0x32c23e[_0xf680('0x3e')][_0xf680('0x43')]?_0x32c23e[_0xf680('0x3e')]:_0x44ffb5[_0xf680('0xc9')];_0x32c23e[_0xf680('0xca')]=qs[_0xf680('0xcb')](_0x56029c[_0xf680('0x38')][_0xf680('0xcb')]);_0x32c23e[_0xf680('0x37')]=qs[_0xf680('0xc7')](_[_0xf680('0xcc')](_0x56029c[_0xf680('0x38')],_0x44ffb5['filters']));if(_0x56029c[_0xf680('0x38')]['filter']){_0x32c23e[_0xf680('0x37')]=_['merge'](_0x32c23e[_0xf680('0x37')],{'$or':_[_0xf680('0x25')](_0x32c23e['attributes'],function(_0x9a8c82){var _0x2c1d98={};_0x2c1d98[_0x9a8c82]={'$like':'%'+_0x56029c[_0xf680('0x38')]['filter']+'%'};return _0x2c1d98;})});}_0x32c23e=_[_0xf680('0x4e')]({},_0x32c23e,_0x56029c[_0xf680('0x4f')]);return _0x22a551[_0xf680('0xde')](_0x32c23e);}})[_0xf680('0x2b')](function(_0x4ed4a0){if(_0x4ed4a0){_0x5757f5=_0x4ed4a0[_0xf680('0x43')];if(!_0x56029c[_0xf680('0x38')][_0xf680('0xce')]('nolimit')){_0x32c23e[_0xf680('0x16')]=qs['limit'](_0x56029c[_0xf680('0x38')]['limit']);_0x32c23e[_0xf680('0x15')]=qs[_0xf680('0x15')](_0x56029c[_0xf680('0x38')]['offset']);}return _0x22a551[_0xf680('0xde')](_0x32c23e);}})['then'](function(_0x22e8f5){if(_0x22e8f5){return _0x22e8f5?{'count':_0x5757f5,'rows':_0x22e8f5}:null;}})[_0xf680('0x2b')](respondWithResult(_0x825acc,null))[_0xf680('0x4c')](handleError(_0x825acc,null));};exports[_0xf680('0xdf')]=function(_0x14370a,_0x163a64){var _0x1ec9a5={};var _0x3b54f5={};var _0x2158fa;var _0x5d7349;return db[_0xf680('0x40')][_0xf680('0xbb')]({'where':{'id':_0x14370a['params']['id']}})['then'](handleEntityNotFound(_0x163a64,null))[_0xf680('0x2b')](function(_0x1765d6){if(_0x1765d6){_0x2158fa=_0x1765d6;_0x3b54f5['model']=_[_0xf680('0xc5')](db['FaxInteraction'][_0xf680('0x2d')]);_0x3b54f5[_0xf680('0x38')]=_[_0xf680('0xc5')](_0x14370a['query']);_0x3b54f5[_0xf680('0xc7')]=_[_0xf680('0xc8')](_0x3b54f5[_0xf680('0xc9')],_0x3b54f5['query']);_0x1ec9a5[_0xf680('0x3e')]=_[_0xf680('0xc8')](_0x3b54f5[_0xf680('0xc9')],qs[_0xf680('0xd0')](_0x14370a[_0xf680('0x38')][_0xf680('0xd0')]));_0x1ec9a5[_0xf680('0x3e')]=_0x1ec9a5['attributes'][_0xf680('0x43')]?_0x1ec9a5['attributes']:_0x3b54f5['model'];_0x1ec9a5[_0xf680('0xca')]=qs[_0xf680('0xcb')](_0x14370a[_0xf680('0x38')][_0xf680('0xcb')]);_0x1ec9a5[_0xf680('0x37')]=qs[_0xf680('0xc7')](_['pick'](_0x14370a['query'],_0x3b54f5[_0xf680('0xc7')]));if(_0x14370a[_0xf680('0x38')][_0xf680('0x23')]){_0x1ec9a5['where']=_[_0xf680('0x4e')](_0x1ec9a5[_0xf680('0x37')],{'$or':_[_0xf680('0x25')](_0x1ec9a5[_0xf680('0x3e')],function(_0x1de236){var _0x13e718={};_0x13e718[_0x1de236]={'$like':'%'+_0x14370a['query']['filter']+'%'};return _0x13e718;})});}_0x1ec9a5=_[_0xf680('0x4e')]({},_0x1ec9a5,_0x14370a[_0xf680('0x4f')]);return _0x2158fa['getFaxInteractions'](_0x1ec9a5);}})[_0xf680('0x2b')](function(_0x555a0c){if(_0x555a0c){_0x5d7349=_0x555a0c[_0xf680('0x43')];if(!_0x14370a['query'][_0xf680('0xce')](_0xf680('0xcf'))){_0x1ec9a5['limit']=qs[_0xf680('0x16')](_0x14370a['query'][_0xf680('0x16')]);_0x1ec9a5[_0xf680('0x15')]=qs[_0xf680('0x15')](_0x14370a[_0xf680('0x38')][_0xf680('0x15')]);}return _0x2158fa['getFaxInteractions'](_0x1ec9a5);}})[_0xf680('0x2b')](function(_0x43f4ac){if(_0x43f4ac){return _0x43f4ac?{'count':_0x5d7349,'rows':_0x43f4ac}:null;}})['then'](respondWithResult(_0x163a64,null))[_0xf680('0x4c')](handleError(_0x163a64,null));};exports[_0xf680('0xe0')]=function(_0x51b264,_0x22bd4a){var _0x573394={};var _0x3b988c={};var _0x38fb8c;var _0x26f15e;return db['User'][_0xf680('0xbb')]({'where':{'id':_0x51b264['params']['id']}})[_0xf680('0x2b')](handleEntityNotFound(_0x22bd4a,null))['then'](function(_0x479f4f){if(_0x479f4f){_0x38fb8c=_0x479f4f;_0x3b988c[_0xf680('0xc9')]=_[_0xf680('0xc5')](db[_0xf680('0xe1')][_0xf680('0x2d')]);_0x3b988c['query']=_[_0xf680('0xc5')](_0x51b264[_0xf680('0x38')]);_0x3b988c[_0xf680('0xc7')]=_['intersection'](_0x3b988c[_0xf680('0xc9')],_0x3b988c[_0xf680('0x38')]);_0x573394[_0xf680('0x3e')]=_['intersection'](_0x3b988c[_0xf680('0xc9')],qs[_0xf680('0xd0')](_0x51b264['query']['fields']));_0x573394['attributes']=_0x573394[_0xf680('0x3e')][_0xf680('0x43')]?_0x573394[_0xf680('0x3e')]:_0x3b988c[_0xf680('0xc9')];_0x573394['order']=qs[_0xf680('0xcb')](_0x51b264[_0xf680('0x38')][_0xf680('0xcb')]);_0x573394[_0xf680('0x37')]=qs[_0xf680('0xc7')](_[_0xf680('0xcc')](_0x51b264[_0xf680('0x38')],_0x3b988c['filters']));if(_0x51b264['query'][_0xf680('0x23')]){_0x573394[_0xf680('0x37')]=_['merge'](_0x573394[_0xf680('0x37')],{'$or':_['map'](_0x573394[_0xf680('0x3e')],function(_0x34ad7a){var _0x316004={};_0x316004[_0x34ad7a]={'$like':'%'+_0x51b264[_0xf680('0x38')][_0xf680('0x23')]+'%'};return _0x316004;})});}_0x573394=_[_0xf680('0x4e')]({},_0x573394,_0x51b264[_0xf680('0x4f')]);return _0x38fb8c['getWhatsappInteractions'](_0x573394);}})[_0xf680('0x2b')](function(_0x52bdaf){if(_0x52bdaf){_0x26f15e=_0x52bdaf[_0xf680('0x43')];if(!_0x51b264[_0xf680('0x38')][_0xf680('0xce')]('nolimit')){_0x573394[_0xf680('0x16')]=qs[_0xf680('0x16')](_0x51b264[_0xf680('0x38')][_0xf680('0x16')]);_0x573394[_0xf680('0x15')]=qs[_0xf680('0x15')](_0x51b264[_0xf680('0x38')][_0xf680('0x15')]);}return _0x38fb8c[_0xf680('0xe0')](_0x573394);}})[_0xf680('0x2b')](function(_0x3c201e){if(_0x3c201e){return _0x3c201e?{'count':_0x26f15e,'rows':_0x3c201e}:null;}})['then'](respondWithResult(_0x22bd4a,null))['catch'](handleError(_0x22bd4a,null));};exports[_0xf680('0xe2')]=function(_0x19e7f5,_0x4fd6f1,_0x28f456){var _0x13503c;var _0xdea9fc;var _0x1a3cf8;var _0x22757b=!_['isNil'](_0x19e7f5['params']['id'])?_0x19e7f5[_0xf680('0x4d')]['id']:!_['isNil'](_0x19e7f5[_0xf680('0x71')]['id'])?_0x19e7f5['user']['id']:null;return db[_0xf680('0x40')]['find']({'where':{'id':_0x22757b,'role':{'$or':[_0xf680('0x20'),_0xf680('0x71'),'agent']}},'attributes':['id',_0xf680('0x28'),_0xf680('0xe3'),'mobile',_0xf680('0x1b'),_0xf680('0x5a'),_0xf680('0x8f')]})[_0xf680('0x2b')](function(_0x2490d4){if(_0x2490d4){if(_0x2490d4[_0xf680('0x1b')]===_0xf680('0x1c')){_0x13503c=_0x2490d4;if(_0x19e7f5[_0xf680('0x50')][_0xf680('0x91')]){_0x1a3cf8=util[_0xf680('0xbc')](_0xf680('0xe4'),_0x13503c[_0x19e7f5['body'][_0xf680('0x91')]]);}else if(_0x19e7f5[_0xf680('0x50')][_0xf680('0xe5')]){_0x1a3cf8=util[_0xf680('0xbc')](_0xf680('0x9a'),_0x19e7f5[_0xf680('0x50')][_0xf680('0xe5')]);}else{_0x1a3cf8=util['format']('SIP/%s',_0x13503c['name']);}socket['to'](util[_0xf680('0xbc')](_0xf680('0xe6'),_0x13503c[_0xf680('0x28')]))['emit'](_0xf680('0xe7'),{'user':{'id':_0x13503c['id'],'name':_0x13503c[_0xf680('0x28')]},'ip':_0x19e7f5[_0xf680('0xe8')][_0xf680('0xe9')]||_0x19e7f5[_0xf680('0xea')]['remoteAddress']||_0x19e7f5[_0xf680('0xeb')][_0xf680('0xec')]||_0x19e7f5['connection'][_0xf680('0xeb')]['remoteAddress']});return db[_0xf680('0x9c')][_0xf680('0x2a')]({'where':{'membername':_0x13503c['name']},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0xf680('0x83'))](_0xf680('0xed'));}})['then'](function(){if(_0x13503c){return _0x13503c['getVoiceQueues']({'raw':!![]});}})[_0xf680('0x2b')](function(_0xd384bf){if(_0x13503c){if(_0xd384bf){_0xdea9fc=_0xd384bf;if(_0xdea9fc[_0xf680('0x43')]){var _0x482631=_0xdea9fc[_0xf680('0x25')](function(_0x72631){var _0x26785d={'membername':_0x13503c[_0xf680('0x28')],'UserId':_0x13503c['id'],'queue_name':_0x72631[_0xf680('0x28')],'VoiceQueueId':_0x72631['id'],'interface':_0x1a3cf8,'paused':_0x13503c['loginInPause']||![],'penalty':_0x72631['UserVoiceQueue.penalty']||0x0};return db[_0xf680('0x9c')][_0xf680('0x9d')](_0x26785d);});return Promise['all'](_0x482631);}}}})[_0xf680('0x2b')](function(){if(_0x13503c){return db[_0xf680('0xee')][_0xf680('0x7e')]({'where':{'membername':_0x13503c[_0xf680('0x28')],'exitAt':null}});}})[_0xf680('0x2b')](function(_0x3cd504){if(_0x13503c){var _0x3cc4e6=[];_0x3cd504['forEach'](function(_0x1ac875){_0x3cc4e6['push'](_0x1ac875['update']({'exitAt':moment()[_0xf680('0xbc')](_0xf680('0xef'))}));});return Promise[_0xf680('0x4b')](_0x3cc4e6);}})[_0xf680('0x2b')](function(){if(_0x13503c){var _0x202c96=[];var _0x54ee1b=[];var _0xab8d0f=utils['getChannels']();var _0x2a0c01={'membername':_0x13503c['name'],'interface':_0x1a3cf8,'enterAt':moment()[_0xf680('0xbc')](_0xf680('0xef')),'role':_0x13503c[_0xf680('0x1b')],'internal':_0x13503c[_0xf680('0x5a')]};_0xab8d0f[_0xf680('0xf0')](function(_0x486410){_0x202c96['push'](_[_0xf680('0x4e')]({'channel':_0x486410,'type':'LOGIN','data1':_0x19e7f5[_0xf680('0x50')][_0xf680('0xf1')],'data2':_0x1a3cf8},_0x2a0c01));if(_0x13503c['loginInPause']){_0x54ee1b[_0xf680('0x3f')](_[_0xf680('0x4e')]({'channel':_0x486410,'type':_0xf680('0xf2'),'data1':'LOGININPAUSE'},_0x2a0c01));}});return db['MemberReport']['bulkCreate'](_0x202c96[_0xf680('0xb9')](_0x54ee1b),{'individualHooks':!![]});}})[_0xf680('0x2b')](function(){if(_0x13503c){return _0x13503c['update']({'online':!![],'lastLoginAt':moment()[_0xf680('0xbc')](_0xf680('0xef')),'voicePause':_0x13503c[_0xf680('0x8f')]||![],'mailPause':_0x13503c[_0xf680('0x8f')]||![],'chatPause':_0x13503c['loginInPause']||![],'faxPause':_0x13503c[_0xf680('0x8f')]||![],'smsPause':_0x13503c['loginInPause']||![],'openchannelPause':_0x13503c[_0xf680('0x8f')]||![],'whatsappPause':_0x13503c['loginInPause']||![],'pauseType':_0x13503c[_0xf680('0x8f')]?'LOGININPAUSE':null,'interface':_0x1a3cf8,'lastPauseAt':moment()[_0xf680('0xbc')](_0xf680('0xef'))});}})[_0xf680('0x2b')](function(_0x3d088b){if(_0x19e7f5['isMiddleware']){return _0x28f456();}else{return Promise[_0xf680('0xf3')](_0x3d088b)[_0xf680('0x2b')](respondWithResult(_0x4fd6f1,null));}})[_0xf680('0x4c')](handleError(_0x4fd6f1,null));};exports['logout']=function(_0x327f6e,_0x3c2bc8){var _0x7fc768;return db['User']['find']({'where':{'id':_0x327f6e[_0xf680('0x4d')]['id'],'role':_0xf680('0x1c')},'attributes':['id',_0xf680('0x28'),'role']})[_0xf680('0x2b')](handleEntityNotFound(_0x3c2bc8,null))[_0xf680('0x2b')](function(_0x475a9d){if(_0x475a9d){_0x7fc768=_0x475a9d;return db[_0xf680('0x9c')][_0xf680('0x2a')]({'where':{'membername':_0x7fc768[_0xf680('0x28')]},'individualHooks':!![]});}})[_0xf680('0x2b')](function(){return db[_0xf680('0xee')][_0xf680('0x7e')]({'where':{'membername':_0x7fc768[_0xf680('0x28')],'exitAt':null}});})[_0xf680('0x2b')](function(_0x4c5f86){var _0x5d4c99=[];_0x4c5f86[_0xf680('0xf0')](function(_0x5e72dc){_0x5d4c99[_0xf680('0x3f')](_0x5e72dc['update']({'exitAt':moment()[_0xf680('0xbc')](_0xf680('0xef'))}));});return Promise[_0xf680('0x4b')](_0x5d4c99);})[_0xf680('0x2b')](function(){return _0x7fc768[_0xf680('0x1a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x3c2bc8,null))['catch'](handleError(_0x3c2bc8,null));};exports[_0xf680('0xf4')]=function(_0x2cd740,_0xaeb0e5){var _0x3e99e0;return db[_0xf680('0x9c')][_0xf680('0x1a')]({'paused':0x1},{'where':{'UserId':_0x2cd740['params']['id']},'individualHooks':!![]})[_0xf680('0x2b')](function(){return db[_0xf680('0x40')][_0xf680('0x26')]({'where':{'id':_0x2cd740['params']['id'],'role':_0xf680('0x1c')},'attributes':['id','name','role',_0xf680('0x5a'),_0xf680('0x91'),_0xf680('0x8e')]});})['then'](handleEntityNotFound(_0xaeb0e5,null))[_0xf680('0x2b')](function(_0x10edba){if(_0x10edba){_0x3e99e0=_0x10edba;return db[_0xf680('0xee')][_0xf680('0x7e')]({'where':{'membername':_0x3e99e0[_0xf680('0x28')],'type':_0xf680('0xf2'),'exitAt':null}});}})['then'](function(_0x1316b7){if(_0x1316b7[_0xf680('0x43')]){var _0x288f6f=moment()[_0xf680('0xbc')](_0xf680('0xef'));for(var _0xd24989=0x0,_0x2b2a35=_0x1316b7[_0xf680('0x43')];_0xd24989<_0x2b2a35;_0xd24989++){_0x1316b7[_0xd24989][_0xf680('0xf5')]({'exitAt':_0x288f6f});}}})[_0xf680('0x2b')](function(){var _0x3841b4=[];var _0x24e591=utils[_0xf680('0xf6')]();_0x24e591[_0xf680('0xf0')](function(_0x26a32b){_0x3841b4[_0xf680('0x3f')]({'channel':_0x26a32b,'membername':_0x3e99e0[_0xf680('0x28')],'interface':_[_0xf680('0x59')](_0x3e99e0[_0xf680('0x91')])?util[_0xf680('0xbc')](_0xf680('0x9a'),_0x3e99e0[_0xf680('0x28')]):_0x3e99e0['interface'],'type':_0xf680('0xf2'),'enterAt':moment()[_0xf680('0xbc')](_0xf680('0xef')),'data1':_0x2cd740[_0xf680('0x50')][_0xf680('0x2f')]||_0xf680('0xf7'),'role':_0x3e99e0['role'],'internal':_0x3e99e0[_0xf680('0x5a')]});});return db[_0xf680('0xee')][_0xf680('0x7b')](_0x3841b4,{'individualHooks':!![]});})[_0xf680('0x2b')](function(){return _0x3e99e0[_0xf680('0x1a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2cd740[_0xf680('0x50')][_0xf680('0x2f')]||_0xf680('0xf7'),'lastPauseAt':moment()[_0xf680('0xbc')](_0xf680('0xef'))});})[_0xf680('0x2b')](respondWithResult(_0xaeb0e5,null))[_0xf680('0x4c')](handleError(_0xaeb0e5,null));};exports['unpause']=function(_0x3f812f,_0x1f6b24){if(_0x3f812f[_0xf680('0x50')]['channel']&&!utils[_0xf680('0x92')](_0x3f812f[_0xf680('0x50')]['channel'])){throw new APIBadRequestError(util[_0xf680('0xbc')](_0xf680('0xf8'),_0x3f812f[_0xf680('0x50')][_0xf680('0x8d')]));}return db[_0xf680('0x40')][_0xf680('0x26')]({'where':{'id':_0x3f812f[_0xf680('0x4d')]['id']},'attributes':['id',_0xf680('0x28'),_0xf680('0x1b'),_0xf680('0x5a'),_0xf680('0x91'),'online','voicePause',_0xf680('0xf9'),_0xf680('0xfa'),_0xf680('0xfb'),_0xf680('0xfc'),'smsPause','whatsappPause',_0xf680('0xfd'),_0xf680('0xfe')]})[_0xf680('0x2b')](function(_0x1e07c3){if(!_0x1e07c3){throw new APINotFoundError(util['format'](_0xf680('0xbd'),_0x3f812f['params']['id']));}return _0x1e07c3[_0xf680('0xff')](_0x3f812f['body'][_0xf680('0x8d')]);})[_0xf680('0x2b')](respondWithResult(_0x1f6b24,null))[_0xf680('0x4c')](APIHandleError(_0x1f6b24));};exports[_0xf680('0x100')]=function(_0x6e73f,_0x5da9f8){var _0x335951={};var _0x20456b={};var _0x3dafa6;var _0x3dc60b;return db[_0xf680('0x40')][_0xf680('0xbb')]({'where':{'id':_0x6e73f[_0xf680('0x4d')]['id']}})[_0xf680('0x2b')](handleEntityNotFound(_0x5da9f8,null))[_0xf680('0x2b')](function(_0x5ca6e1){if(_0x5ca6e1){_0x3dafa6=_0x5ca6e1;_0x20456b[_0xf680('0xc9')]=_[_0xf680('0xc5')](db[_0xf680('0x101')]['rawAttributes']);_0x20456b[_0xf680('0x38')]=_[_0xf680('0xc5')](_0x6e73f['query']);_0x20456b['filters']=_[_0xf680('0xc8')](_0x20456b[_0xf680('0xc9')],_0x20456b[_0xf680('0x38')]);_0x335951['attributes']=_[_0xf680('0xc8')](_0x20456b[_0xf680('0xc9')],qs[_0xf680('0xd0')](_0x6e73f[_0xf680('0x38')][_0xf680('0xd0')]));_0x335951[_0xf680('0x3e')]=_0x335951[_0xf680('0x3e')][_0xf680('0x43')]?_0x335951[_0xf680('0x3e')]:_0x20456b[_0xf680('0xc9')];_0x335951[_0xf680('0xca')]=qs[_0xf680('0xcb')](_0x6e73f['query'][_0xf680('0xcb')]);_0x335951['where']=qs[_0xf680('0xc7')](_[_0xf680('0xcc')](_0x6e73f[_0xf680('0x38')],_0x20456b[_0xf680('0xc7')]));if(_0x6e73f['query'][_0xf680('0x23')]){_0x335951[_0xf680('0x37')]=_[_0xf680('0x4e')](_0x335951[_0xf680('0x37')],{'$or':_[_0xf680('0x25')](_0x335951[_0xf680('0x3e')],function(_0x117a7a){var _0x12f9dd={};_0x12f9dd[_0x117a7a]={'$like':'%'+_0x6e73f[_0xf680('0x38')]['filter']+'%'};return _0x12f9dd;})});}_0x335951=_[_0xf680('0x4e')]({},_0x335951,_0x6e73f['options']);return _0x3dafa6['getTeams'](_0x335951);}})[_0xf680('0x2b')](function(_0x3112b0){if(_0x3112b0){_0x3dc60b=_0x3112b0[_0xf680('0x43')];if(!_0x6e73f['query'][_0xf680('0xce')](_0xf680('0xcf'))){_0x335951[_0xf680('0x16')]=qs['limit'](_0x6e73f[_0xf680('0x38')]['limit']);_0x335951['offset']=qs[_0xf680('0x15')](_0x6e73f[_0xf680('0x38')][_0xf680('0x15')]);}return _0x3dafa6[_0xf680('0x100')](_0x335951);}})[_0xf680('0x2b')](function(_0x312a1b){if(_0x312a1b){return _0x312a1b?{'count':_0x3dc60b,'rows':_0x312a1b}:null;}})[_0xf680('0x2b')](respondWithResult(_0x5da9f8,null))[_0xf680('0x4c')](handleError(_0x5da9f8,null));};exports['addTeams']=function(_0x146b49,_0x248f1c){var _0x50ebf3=_0x146b49[_0xf680('0x4d')]['id'];var _0xf4b558=_0x146b49[_0xf680('0x50')]?_0x146b49[_0xf680('0x50')][_0xf680('0x53')]:null;var _0x48cc6a=[];return Promise['resolve']()[_0xf680('0x2b')](function(){if(!_0xf4b558)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xf680('0x2b')](function(){return db[_0xf680('0x40')][_0xf680('0xbb')]({'where':{'id':_0x50ebf3}});})[_0xf680('0x2b')](function(_0x230ea3){if(!_0x230ea3)throw new APINotFoundError(util[_0xf680('0xbc')](_0xf680('0xbd'),_0x146b49[_0xf680('0x4d')]['id']));return db[_0xf680('0x5b')][_0xf680('0x102')](function(_0x43f168){return _0x230ea3[_0xf680('0x103')](_0xf4b558,{'transaction':_0x43f168})[_0xf680('0x2b')](function(){return db[_0xf680('0x101')][_0xf680('0x7e')]({'where':{'id':{'$in':_0xf4b558}}});})['then'](function(_0x3df453){var _0x41695d=_[_0xf680('0x25')](_0x3df453,function(_0x4572d3){return _0x4572d3[_0xf680('0x104')]();});return Promise[_0xf680('0x4b')](_0x41695d);})['then'](function(_0x16c0cc){_0x48cc6a=_[_0xf680('0x105')](_0x16c0cc);var _0x578004=_[_0xf680('0x25')](_0x48cc6a,function(_0x504a40){return _0x504a40[_0xf680('0x106')](_0x230ea3['id'],{'transaction':_0x43f168});});return Promise[_0xf680('0x4b')](_0x578004);})[_0xf680('0x2b')](function(){if(!_0x230ea3[_0xf680('0x8e')])return;var _0x52a78e=_['filter'](_0x48cc6a,function(_0x32b26f){return _0x32b26f[_0xf680('0x107')](_0xf680('0x8d'))===_0xf680('0x108');});var _0x8676ed=_[_0xf680('0x25')](_0x52a78e,function(_0x7b3b70){return db['UserVoiceQueueRt'][_0xf680('0x9d')]({'membername':_0x230ea3[_0xf680('0x28')],'UserId':_0x230ea3['id'],'queue_name':_0x7b3b70[_0xf680('0x28')],'VoiceQueueId':_0x7b3b70['id'],'interface':_['isNil'](_0x230ea3[_0xf680('0x91')])?util[_0xf680('0xbc')](_0xf680('0x9a'),_0x230ea3[_0xf680('0x28')]):_0x230ea3[_0xf680('0x91')],'paused':_0x230ea3[_0xf680('0x90')]||![],'penalty':_0x230ea3[_0xf680('0x9b')]},{'transaction':_0x43f168});});return Promise[_0xf680('0x4b')](_0x8676ed);})['then'](function(){return db[_0xf680('0x109')][_0xf680('0x7e')]({'where':{'teamId':{'$in':_0xf4b558}}});})[_0xf680('0x2b')](function(_0x5d6008){var _0x3ee422=_[_0xf680('0x25')](_0x5d6008,function(_0x32cbd5){return db[_0xf680('0x10a')][_0xf680('0x70')]({'UserId':_0x230ea3['id'],'VoicePrefixId':_0x32cbd5[_0xf680('0x10b')]},{'transaction':_0x43f168});});return Promise['all'](_0x3ee422);});});})['then'](function(){for(var _0x269232=0x0;_0x269232<_0x48cc6a[_0xf680('0x43')];_0x269232++){var _0xc9a9f8=_0x48cc6a[_0x269232][_0xf680('0x107')](_0xf680('0x8d'));var _0xb10c61=_0xc9a9f8+_0xf680('0x96');socket['emit'](_0xf680('0x71')+_0xc9a9f8+_0xf680('0x97'),{'UserId':_0x50ebf3,['queueField']:_0x48cc6a[_0x269232]['id']});}})['then'](respondWithStatusCode(_0x248f1c,null))[_0xf680('0x4c')](APIHandleError(_0x248f1c));};exports[_0xf680('0x10c')]=function(_0xb13c2e,_0x549528){var _0x50563e=_0xb13c2e[_0xf680('0x4d')]['id'];var _0x323311=null;if(_0xb13c2e['query'][_0xf680('0x53')]){_0x323311=_[_0xf680('0x10d')](_0xb13c2e[_0xf680('0x38')][_0xf680('0x53')])?_0xb13c2e[_0xf680('0x38')][_0xf680('0x53')]:[_0xb13c2e[_0xf680('0x38')][_0xf680('0x53')]];}var _0x57e975=[];return Promise[_0xf680('0xf3')]()[_0xf680('0x2b')](function(){if(!_0x323311)throw new APIBadRequestError(_0xf680('0x10e'));})[_0xf680('0x2b')](function(){return db[_0xf680('0x40')][_0xf680('0xbb')]({'where':{'id':_0x50563e}});})[_0xf680('0x2b')](function(_0x453f12){if(!_0x453f12)throw new APINotFoundError(util[_0xf680('0xbc')](_0xf680('0xbd'),_0xb13c2e[_0xf680('0x4d')]['id']));return db[_0xf680('0x5b')][_0xf680('0x102')](function(_0x366300){return _0x453f12[_0xf680('0x10c')](_0x323311,{'transaction':_0x366300})['then'](function(){return db[_0xf680('0x101')][_0xf680('0x7e')]({'where':{'id':{'$in':_0x323311}}});})['then'](function(_0x44ce3c){var _0x1a5577=_[_0xf680('0x25')](_0x44ce3c,function(_0x523256){return _0x523256['getAssociatedQueues']();});return Promise['all'](_0x1a5577);})[_0xf680('0x2b')](function(_0x1c2141){_0x57e975=_['flattenDeep'](_0x1c2141);var _0x4f9ebe=_[_0xf680('0x25')](_0x57e975,function(_0x164651){return _0x164651['removeAgent'](_0x453f12['id'],{'transaction':_0x366300});});return Promise['all'](_0x4f9ebe);})['then'](function(){if(!_0x453f12[_0xf680('0x8e')])return;var _0x196a1c=_[_0xf680('0x23')](_0x57e975,function(_0x28292d){return _0x28292d['getDataValue'](_0xf680('0x8d'))===_0xf680('0x108');});var _0xcb73b8=_[_0xf680('0x25')](_0x196a1c,function(_0x50b846){return db['UserVoiceQueueRt'][_0xf680('0x2a')]({'where':{'VoiceQueueId':_0x50b846['id'],'UserId':_0x453f12['id']},'transaction':_0x366300});});return Promise[_0xf680('0x4b')](_0xcb73b8);})[_0xf680('0x2b')](function(){return db['TeamVoicePrefix'][_0xf680('0x7e')]({'where':{'teamId':{'$in':_0x323311}}});})['then'](function(_0x37f868){var _0x12969f=_[_0xf680('0x25')](_0x37f868,function(_0x5b0d31){return db[_0xf680('0x10a')]['destroy']({'where':{'UserId':_0x453f12['id'],'VoicePrefixId':_0x5b0d31[_0xf680('0x10b')]}},{'transaction':_0x366300});});return Promise[_0xf680('0x4b')](_0x12969f);});});})[_0xf680('0x2b')](function(){for(var _0x3d0771=0x0;_0x3d0771<_0x57e975[_0xf680('0x43')];_0x3d0771++){var _0x38015c=_0x57e975[_0x3d0771][_0xf680('0x107')]('channel');var _0x40fd31=_0x38015c+_0xf680('0x96');socket[_0xf680('0x1d')](_0xf680('0x71')+_0x38015c+_0xf680('0x10f'),{'UserId':_0x50563e,['queueField']:_0x57e975[_0x3d0771]['id']});}})['then'](respondWithStatusCode(_0x549528,null))[_0xf680('0x4c')](APIHandleError(_0x549528));};exports[_0xf680('0x110')]=function(_0x12823e,_0x334356){var _0xc9507d={};var _0x15d62a={};var _0xa56d6a;var _0x41809a;return db[_0xf680('0x40')]['findOne']({'where':{'id':_0x12823e[_0xf680('0x4d')]['id']}})[_0xf680('0x2b')](handleEntityNotFound(_0x334356,null))['then'](function(_0x2e15a5){if(_0x2e15a5){_0xa56d6a=_0x2e15a5;_0x15d62a[_0xf680('0xc9')]=_[_0xf680('0xc5')](db[_0xf680('0x111')]['rawAttributes']);_0x15d62a[_0xf680('0x38')]=_['keys'](_0x12823e[_0xf680('0x38')]);_0x15d62a['filters']=_[_0xf680('0xc8')](_0x15d62a[_0xf680('0xc9')],_0x15d62a[_0xf680('0x38')]);_0xc9507d['attributes']=_[_0xf680('0xc8')](_0x15d62a['model'],qs[_0xf680('0xd0')](_0x12823e[_0xf680('0x38')]['fields']));_0xc9507d[_0xf680('0x3e')]=_0xc9507d[_0xf680('0x3e')][_0xf680('0x43')]?_0xc9507d[_0xf680('0x3e')]:_0x15d62a[_0xf680('0xc9')];_0xc9507d[_0xf680('0xca')]=qs[_0xf680('0xcb')](_0x12823e[_0xf680('0x38')][_0xf680('0xcb')]);_0xc9507d[_0xf680('0x37')]=qs[_0xf680('0xc7')](_[_0xf680('0xcc')](_0x12823e['query'],_0x15d62a[_0xf680('0xc7')]));if(_0x12823e[_0xf680('0x38')][_0xf680('0x23')]){_0xc9507d[_0xf680('0x37')]=_[_0xf680('0x4e')](_0xc9507d[_0xf680('0x37')],{'$or':_[_0xf680('0x25')](_0xc9507d[_0xf680('0x3e')],function(_0x26e644){var _0x3f4ca0={};_0x3f4ca0[_0x26e644]={'$like':'%'+_0x12823e[_0xf680('0x38')][_0xf680('0x23')]+'%'};return _0x3f4ca0;})});}_0xc9507d=_['merge']({},_0xc9507d,_0x12823e['options']);return _0xa56d6a[_0xf680('0x110')](_0xc9507d);}})[_0xf680('0x2b')](function(_0x27afe4){if(_0x27afe4){_0x41809a=_0x27afe4[_0xf680('0x43')];if(!_0x12823e[_0xf680('0x38')][_0xf680('0xce')](_0xf680('0xcf'))){_0xc9507d['limit']=qs[_0xf680('0x16')](_0x12823e[_0xf680('0x38')][_0xf680('0x16')]);_0xc9507d[_0xf680('0x15')]=qs['offset'](_0x12823e[_0xf680('0x38')][_0xf680('0x15')]);}return _0xa56d6a[_0xf680('0x110')](_0xc9507d);}})[_0xf680('0x2b')](function(_0x40b9d9){if(_0x40b9d9){return _0x40b9d9?{'count':_0x41809a,'rows':_0x40b9d9}:null;}})[_0xf680('0x2b')](respondWithResult(_0x334356,null))['catch'](handleError(_0x334356,null));};exports['getAgents']=function(_0x2402b7,_0x4bdf4e){var _0x178c55={};var _0x2abff1={};var _0x24b215;return db['User'][_0xf680('0xbb')]({'where':{'id':_0x2402b7[_0xf680('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4bdf4e,null))[_0xf680('0x2b')](function(_0x353560){if(_0x353560){_0x24b215=_0x353560;_0x2abff1[_0xf680('0xc9')]=_[_0xf680('0xc5')](db[_0xf680('0x40')][_0xf680('0x2d')]);_0x2abff1['query']=_[_0xf680('0xc5')](_0x2402b7[_0xf680('0x38')]);_0x2abff1[_0xf680('0xc7')]=_[_0xf680('0xc8')](_0x2abff1[_0xf680('0xc9')],_0x2abff1[_0xf680('0x38')]);_0x178c55['attributes']=_[_0xf680('0xc8')](_0x2abff1[_0xf680('0xc9')],qs[_0xf680('0xd0')](_0x2402b7[_0xf680('0x38')][_0xf680('0xd0')]));_0x178c55[_0xf680('0x3e')]=_0x178c55['attributes']['length']?_0x178c55[_0xf680('0x3e')]:_0x2abff1[_0xf680('0xc9')];_0x178c55[_0xf680('0xca')]=qs['sort'](_0x2402b7[_0xf680('0x38')][_0xf680('0xcb')]);_0x178c55[_0xf680('0x37')]=qs['filters'](_['pick'](_0x2402b7['query'],_0x2abff1[_0xf680('0xc7')]));if(_0x2402b7[_0xf680('0x38')][_0xf680('0x23')]){_0x178c55[_0xf680('0x37')]=_[_0xf680('0x4e')](_0x178c55[_0xf680('0x37')],{'$or':_[_0xf680('0x25')](_0x178c55[_0xf680('0x3e')],function(_0x292f20){var _0x35fe71={};_0x35fe71[_0x292f20]={'$like':'%'+_0x2402b7[_0xf680('0x38')][_0xf680('0x23')]+'%'};return _0x35fe71;})});}_0x178c55[_0xf680('0xc9')]=db[_0xf680('0x40')];_0x178c55['as']=_0xf680('0x21');_0x178c55=_['merge']({},_0x178c55,_0x2402b7['options']);return _0x24b215[_0xf680('0x112')]({'include':[_0x178c55]});}})[_0xf680('0x2b')](function(_0x24e520){if(_0x24e520){var _0x569767={},_0x3e2267=[];for(var _0x3ceca5=0x0;_0x3ceca5<_0x24e520[_0xf680('0x43')];_0x3ceca5+=0x1){for(var _0x28cb6f=0x0,_0x3decbb;_0x28cb6f<_0x24e520[_0x3ceca5][_0xf680('0x21')][_0xf680('0x43')];_0x28cb6f+=0x1){_0x3decbb=_0x24e520[_0x3ceca5]['Agents'][_0x28cb6f][_0xf680('0x1f')]({'plain':!![]});_0x569767[_0x3decbb['id']]=_0x3decbb;}}_0x569767=_[_0xf680('0x113')](_0x569767);for(var _0x4a2e48=qs[_0xf680('0x15')](_0x2402b7[_0xf680('0x38')][_0xf680('0x15')]);_0x4a2e48<_0x569767[_0xf680('0x43')]&&_0x3e2267[_0xf680('0x43')]=_0x5e98ae['agents']){throw new Error(_0xd93a('0x4a'));}})[_0xd93a('0x17')](function(){if(_0xc9b99d){return db[_0xd93a('0x4b')]['destroy']({'where':{'membername':_0xc9b99d[_0xd93a('0x26')]},'individualHooks':!![]});}})[_0xd93a('0x17')](function(){if(_0xc9b99d){return _0xc9b99d[_0xd93a('0x4c')]({'raw':!![]});}})[_0xd93a('0x17')](function(_0x20657f){if(_0xc9b99d){if(_0x20657f){var _0x1629e2=[];_0x41af29=_0x20657f;if(_0x41af29['length']){for(var _0x28de05=0x0;_0x28de05<_0x41af29['length'];_0x28de05++){_0x1629e2[_0xd93a('0x2d')](db[_0xd93a('0x4b')][_0xd93a('0x4d')]({'membername':_0xc9b99d[_0xd93a('0x26')],'UserId':_0xc9b99d['id'],'queue_name':_0x41af29[_0x28de05][_0xd93a('0x26')],'VoiceQueueId':_0x41af29[_0x28de05]['id'],'interface':_0x2d38f9,'paused':_0xc9b99d[_0xd93a('0x44')]||![],'penalty':_0x41af29[_0x28de05]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xd93a('0x41')](_0x1629e2);}}}})[_0xd93a('0x17')](function(){if(_0xc9b99d){return db[_0xd93a('0x33')][_0xd93a('0xe')]({'where':{'membername':_0xc9b99d[_0xd93a('0x26')],'exitAt':null}});}})[_0xd93a('0x17')](function(_0x32b6dc){if(_0xc9b99d){if(_0x32b6dc&&_0x32b6dc[_0xd93a('0x29')]){var _0x3c9bc3=[];_0x32b6dc[_0xd93a('0x2c')](function(_0xc54e14){_0x3c9bc3[_0xd93a('0x2d')](_0xc54e14[_0xd93a('0x25')]({'exitAt':moment()[_0xd93a('0x22')](_0xd93a('0x28'))}));});return BPromise[_0xd93a('0x41')](_0x3c9bc3);}}})['then'](function(){if(_0xc9b99d){var _0x9ca0bf=[];var _0x431651=[];var _0x1f6d4e=utils[_0xd93a('0x2b')]();var _0x396363={'membername':_0xc9b99d[_0xd93a('0x26')],'interface':_0x2d38f9,'enterAt':moment()[_0xd93a('0x22')](_0xd93a('0x28')),'role':_0xc9b99d[_0xd93a('0x20')],'internal':_0xc9b99d['internal']};_0x1f6d4e['forEach'](function(_0x279eaa){_0x9ca0bf['push'](_[_0xd93a('0x4e')]({'channel':_0x279eaa,'type':'LOGIN','data1':_0xd93a('0x4f'),'data2':_0x2d38f9},_0x396363));if(_0xc9b99d[_0xd93a('0x44')]){_0x431651[_0xd93a('0x2d')](_[_0xd93a('0x4e')]({'channel':_0x279eaa,'type':_0xd93a('0x27'),'data1':'LOGININPAUSE'},_0x396363));}});return db['MemberReport']['bulkCreate'](_0x9ca0bf[_0xd93a('0x50')](_0x431651),{'individualHooks':!![]});}})[_0xd93a('0x17')](function(){if(_0xc9b99d){return _0xc9b99d[_0xd93a('0x25')]({'online':!![],'lastLoginAt':moment()['format'](_0xd93a('0x28')),'voicePause':_0xc9b99d[_0xd93a('0x44')]||![],'mailPause':_0xc9b99d[_0xd93a('0x44')]||![],'chatPause':_0xc9b99d[_0xd93a('0x44')]||![],'faxPause':_0xc9b99d[_0xd93a('0x44')]||![],'smsPause':_0xc9b99d[_0xd93a('0x44')]||![],'openchannelPause':_0xc9b99d[_0xd93a('0x44')]||![],'pauseType':_0xc9b99d[_0xd93a('0x44')]?'LOGININPAUSE':null,'lastPauseAt':moment()['format'](_0xd93a('0x28')),'interface':_0x2d38f9});}})['then'](function(_0x5418ed){_0x53b1ef(_0x5418ed);})['catch'](function(_0x58a19d){_0x585a2d(_0x26367f[_0xd93a('0x1b')](0x1f4,_0x58a19d[_0xd93a('0x1c')]));});});}; \ No newline at end of file +var _0x262e=['../../config/environment','redis','localhost','./user.socket','register','GetUser','User','options','raw','where','attributes','include','model','map','then','stringify','catch','error','message','find','ShowUser','debug','name','internal','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','update','findAll','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','isNil','interface','type','DEFAULT\x20PAUSE','role','MemberReport','bulkCreate','UnpauseUser','channel','isValidChannel','body','online','mailPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','system','LogoutUser','destroy','forEach','all','LoginUser','findOne','mobile','phone','loginInPause','SIP/%s','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','push','upsert','merge','LOGININPAUSE','concat','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc'];(function(_0xc5eec1,_0x1aec53){var _0x30e3ac=function(_0x4b57f5){while(--_0x4b57f5){_0xc5eec1['push'](_0xc5eec1['shift']());}};_0x30e3ac(++_0x1aec53);}(_0x262e,0x1e5));var _0xe262=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x262e[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xe262('0x0'));var util=require(_0xe262('0x1'));var moment=require(_0xe262('0x2'));var BPromise=require(_0xe262('0x3'));var Redis=require('ioredis');var db=require(_0xe262('0x4'))['db'];var utils=require(_0xe262('0x5'));var logger=require('../../config/logger')(_0xe262('0x6'));var config=require(_0xe262('0x7'));config[_0xe262('0x8')]=_['defaults'](config[_0xe262('0x8')],{'host':_0xe262('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe262('0xa'))[_0xe262('0xb')](socket);exports[_0xe262('0xc')]=function(_0x4a3bed){var _0x4d0483=this;return new Promise(function(_0x5593a7,_0x45c96b){return db[_0xe262('0xd')]['findAll']({'raw':_0x4a3bed[_0xe262('0xe')]?_0x4a3bed['options'][_0xe262('0xf')]===undefined?!![]:![]:!![],'where':_0x4a3bed['options']?_0x4a3bed[_0xe262('0xe')][_0xe262('0x10')]||null:null,'attributes':_0x4a3bed[_0xe262('0xe')]?_0x4a3bed[_0xe262('0xe')][_0xe262('0x11')]||null:null,'limit':_0x4a3bed['options']?_0x4a3bed[_0xe262('0xe')]['limit']||null:null,'include':_0x4a3bed[_0xe262('0xe')]?_0x4a3bed[_0xe262('0xe')][_0xe262('0x12')]?_['map'](_0x4a3bed[_0xe262('0xe')]['include'],function(_0x45a210){return{'model':db[_0x45a210[_0xe262('0x13')]],'as':_0x45a210['as'],'attributes':_0x45a210['attributes'],'include':_0x45a210['include']?_[_0xe262('0x14')](_0x45a210['include'],function(_0x1b88e9){return{'model':db[_0x1b88e9['model']],'as':_0x1b88e9['as'],'attributes':_0x1b88e9[_0xe262('0x11')],'include':_0x1b88e9[_0xe262('0x12')]?_[_0xe262('0x14')](_0x1b88e9[_0xe262('0x12')],function(_0x242e81){return{'model':db[_0x242e81[_0xe262('0x13')]],'as':_0x242e81['as'],'attributes':_0x242e81[_0xe262('0x11')]};}):[]};}):[]};}):[]:[]})[_0xe262('0x15')](function(_0x4d1042){logger['info'](_0xe262('0xc'),_0x4a3bed);logger['debug']('GetUser',_0x4a3bed,JSON[_0xe262('0x16')](_0x4d1042));_0x5593a7(_0x4d1042);})[_0xe262('0x17')](function(_0x5607a6){logger[_0xe262('0x18')]('GetUser',_0x5607a6[_0xe262('0x19')],_0x4a3bed);_0x45c96b(_0x4d0483[_0xe262('0x18')](0x1f4,_0x5607a6[_0xe262('0x19')]));});});};exports['ShowUser']=function(_0x402f65){var _0x28f4eb=this;return new Promise(function(_0xc680e2,_0x1be4d9){return db['User'][_0xe262('0x1a')]({'raw':_0x402f65[_0xe262('0xe')]?_0x402f65[_0xe262('0xe')][_0xe262('0xf')]===undefined?!![]:![]:!![],'where':_0x402f65['options']?_0x402f65['options'][_0xe262('0x10')]||null:null,'attributes':_0x402f65['options']?_0x402f65['options']['attributes']||null:null,'include':_0x402f65['options']?_0x402f65[_0xe262('0xe')][_0xe262('0x12')]?_[_0xe262('0x14')](_0x402f65[_0xe262('0xe')][_0xe262('0x12')],function(_0x216a50){return{'model':db[_0x216a50[_0xe262('0x13')]],'as':_0x216a50['as'],'attributes':_0x216a50[_0xe262('0x11')],'include':_0x216a50[_0xe262('0x12')]?_[_0xe262('0x14')](_0x216a50[_0xe262('0x12')],function(_0xbfda2c){return{'model':db[_0xbfda2c[_0xe262('0x13')]],'as':_0xbfda2c['as'],'attributes':_0xbfda2c[_0xe262('0x11')],'include':_0xbfda2c[_0xe262('0x12')]?_['map'](_0xbfda2c[_0xe262('0x12')],function(_0x62488b){return{'model':db[_0x62488b[_0xe262('0x13')]],'as':_0x62488b['as'],'attributes':_0x62488b[_0xe262('0x11')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59d213){logger['info'](_0xe262('0x1b'),_0x402f65);logger[_0xe262('0x1c')](_0xe262('0x1b'),_0x402f65,JSON[_0xe262('0x16')](_0x59d213));_0xc680e2(_0x59d213);})[_0xe262('0x17')](function(_0xd3c338){logger[_0xe262('0x18')]('ShowUser',_0xd3c338[_0xe262('0x19')],_0x402f65);_0x1be4d9(_0x28f4eb[_0xe262('0x18')](0x1f4,_0xd3c338[_0xe262('0x19')]));});});};exports['PauseUser']=function(_0x41b877){var _0x5da093;return db[_0xe262('0xd')][_0xe262('0x1a')]({'where':_0x41b877[_0xe262('0xe')]['where']||{},'attributes':['id',_0xe262('0x1d'),'role',_0xe262('0x1e'),'interface']})['then'](function(_0x5602c5){if(!_0x5602c5){throw new Error(util[_0xe262('0x1f')](_0xe262('0x20'),_0x41b877[_0xe262('0x21')]['id']));}_0x5da093=_0x5602c5;return db[_0xe262('0x22')][_0xe262('0x23')]({'paused':0x1},{'where':{'UserId':_0x5da093['id']},'individualHooks':!![]});})[_0xe262('0x15')](function(){return db['MemberReport'][_0xe262('0x24')]({'where':{'membername':_0x5da093['name'],'type':_0xe262('0x25'),'exitAt':null}});})[_0xe262('0x15')](function(_0x112770){if(_0x112770&&_0x112770[_0xe262('0x26')]){var _0x301bb5=moment()[_0xe262('0x1f')](_0xe262('0x27'));for(var _0x104857=0x0,_0x116352=_0x112770[_0xe262('0x26')];_0x104857<_0x116352;_0x104857++){_0x112770[_0x104857][_0xe262('0x28')]({'exitAt':_0x301bb5});}}})[_0xe262('0x15')](function(){var _0x9ea462=[];var _0x22595c=utils[_0xe262('0x29')]();_0x22595c['forEach'](function(_0x29e32a){_0x9ea462['push']({'channel':_0x29e32a,'membername':_0x5da093[_0xe262('0x1d')],'interface':_[_0xe262('0x2a')](_0x5da093['interface'])?util['format']('SIP/%s',_0x5da093[_0xe262('0x1d')]):_0x5da093[_0xe262('0x2b')],'type':'PAUSE','enterAt':moment()[_0xe262('0x1f')](_0xe262('0x27')),'data1':_0x41b877['body'][_0xe262('0x2c')]||_0xe262('0x2d'),'role':_0x5da093[_0xe262('0x2e')],'internal':_0x5da093['internal'],'uniqueid':_0x41b877['body']['uniqueid']||null});});return db[_0xe262('0x2f')][_0xe262('0x30')](_0x9ea462,{'individualHooks':!![]});})[_0xe262('0x15')](function(){return _0x5da093[_0xe262('0x23')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x41b877['body'][_0xe262('0x2c')]||_0xe262('0x2d'),'lastPauseAt':moment()[_0xe262('0x1f')]('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0xef5014){throw _0xef5014;});};exports[_0xe262('0x31')]=function(_0x195b56){return Promise['resolve']()[_0xe262('0x15')](function(){if(_0x195b56['body'][_0xe262('0x32')]&&!utils[_0xe262('0x33')](_0x195b56[_0xe262('0x34')]['channel'])){throw new Error(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x195b56[_0xe262('0x34')][_0xe262('0x32')]));}return db[_0xe262('0xd')]['findOne']({'where':_0x195b56['options'][_0xe262('0x10')]||{},'attributes':['id','name',_0xe262('0x2e'),_0xe262('0x1e'),_0xe262('0x2b'),_0xe262('0x35'),'voicePause',_0xe262('0x36'),'chatPause',_0xe262('0x37'),_0xe262('0x38'),_0xe262('0x39'),_0xe262('0x3a'),_0xe262('0x3b'),_0xe262('0x3c')]});})[_0xe262('0x15')](function(_0x42740c){if(!_0x42740c){throw new Error(util[_0xe262('0x1f')](_0xe262('0x20'),_0x195b56[_0xe262('0x21')]['id']));}return _0x42740c['unpause'](_0x195b56[_0xe262('0x34')][_0xe262('0x32')],_0xe262('0x3d'));})['catch'](function(_0xfa728){throw _0xfa728;});};exports[_0xe262('0x3e')]=function(_0x27d03e){var _0x1cb2e4=this;return new Promise(function(_0x321823,_0x2319dc){var _0x4817ef;return db[_0xe262('0xd')]['findOne']({'where':_0x27d03e[_0xe262('0xe')][_0xe262('0x10')]||{},'attributes':['id',_0xe262('0x1d')]})[_0xe262('0x15')](function(_0x40db4e){if(_0x40db4e){_0x4817ef=_0x40db4e;return db[_0xe262('0x22')][_0xe262('0x3f')]({'where':{'membername':_0x4817ef['name']},'individualHooks':!![]});}})[_0xe262('0x15')](function(){if(_0x4817ef){return db[_0xe262('0x2f')][_0xe262('0x24')]({'where':{'membername':_0x4817ef[_0xe262('0x1d')],'exitAt':null}});}})[_0xe262('0x15')](function(_0x28c01e){if(_0x4817ef){if(_0x28c01e&&_0x28c01e[_0xe262('0x26')]){var _0x421c45=[];_0x28c01e[_0xe262('0x40')](function(_0x1cdea1){_0x421c45['push'](_0x1cdea1[_0xe262('0x23')]({'exitAt':moment()[_0xe262('0x1f')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xe262('0x41')](_0x421c45);}}})['then'](function(){if(_0x4817ef){return _0x4817ef['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xe262('0x15')](function(_0x2c6b21){_0x321823(_0x2c6b21);})['catch'](function(_0x48a8d3){_0x2319dc(_0x1cb2e4[_0xe262('0x18')](0x1f4,_0x48a8d3[_0xe262('0x19')]));});});};exports[_0xe262('0x42')]=function(_0x42e80c){var _0x1962be=this;return new Promise(function(_0x4cc9cf,_0x4355f4){var _0x3a43d4;var _0x1e7ae8;var _0x1d375b;var _0x3a1bcf;return db[_0xe262('0xd')][_0xe262('0x43')]({'where':_0x42e80c[_0xe262('0xe')][_0xe262('0x10')]||{},'attributes':['id','name',_0xe262('0x2e'),_0xe262('0x44'),_0xe262('0x45'),_0xe262('0x1e'),_0xe262('0x46'),_0xe262('0x2b')]})[_0xe262('0x15')](function(_0x2a5cfb){if(_0x2a5cfb){_0x3a43d4=_0x2a5cfb;_0x3a1bcf=_0x42e80c['body'][_0xe262('0x2b')]?_0x42e80c[_0xe262('0x34')][_0xe262('0x2b')]:util['format'](_0xe262('0x47'),_0x3a43d4[_0xe262('0x1d')]);return db[_0xe262('0xd')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x3a43d4['id']}}});}})[_0xe262('0x15')](function(_0x2a1eb1){if(_0x2a1eb1){_0x1d375b=_0x2a1eb1;return require(_0xe262('0x48'))[_0xe262('0x49')]();}})[_0xe262('0x15')](function(_0x1e1fe3){if(_0x1e1fe3&&_0x1e1fe3[_0xe262('0x4a')]&&_0x1d375b>=_0x1e1fe3[_0xe262('0x4a')]){throw new Error(_0xe262('0x4b'));}})['then'](function(){if(_0x3a43d4){return db[_0xe262('0x22')][_0xe262('0x3f')]({'where':{'membername':_0x3a43d4[_0xe262('0x1d')]},'individualHooks':!![]});}})[_0xe262('0x15')](function(){if(_0x3a43d4){return _0x3a43d4[_0xe262('0x4c')]({'raw':!![]});}})['then'](function(_0x46f495){if(_0x3a43d4){if(_0x46f495){var _0x1294f7=[];_0x1e7ae8=_0x46f495;if(_0x1e7ae8[_0xe262('0x26')]){for(var _0xf770b3=0x0;_0xf770b3<_0x1e7ae8['length'];_0xf770b3++){_0x1294f7[_0xe262('0x4d')](db['UserVoiceQueueRt'][_0xe262('0x4e')]({'membername':_0x3a43d4[_0xe262('0x1d')],'UserId':_0x3a43d4['id'],'queue_name':_0x1e7ae8[_0xf770b3][_0xe262('0x1d')],'VoiceQueueId':_0x1e7ae8[_0xf770b3]['id'],'interface':_0x3a1bcf,'paused':_0x3a43d4[_0xe262('0x46')]||![],'penalty':_0x1e7ae8[_0xf770b3]['UserVoiceQueue.penalty']||0x0}));}return BPromise['all'](_0x1294f7);}}}})[_0xe262('0x15')](function(){if(_0x3a43d4){return db[_0xe262('0x2f')][_0xe262('0x24')]({'where':{'membername':_0x3a43d4[_0xe262('0x1d')],'exitAt':null}});}})[_0xe262('0x15')](function(_0x1a7bb3){if(_0x3a43d4){if(_0x1a7bb3&&_0x1a7bb3['length']){var _0x199772=[];_0x1a7bb3['forEach'](function(_0x2a2ea5){_0x199772[_0xe262('0x4d')](_0x2a2ea5[_0xe262('0x23')]({'exitAt':moment()['format'](_0xe262('0x27'))}));});return BPromise[_0xe262('0x41')](_0x199772);}}})[_0xe262('0x15')](function(){if(_0x3a43d4){var _0x4a6a4c=[];var _0x56bcc9=[];var _0x41f95a=utils[_0xe262('0x29')]();var _0x102d61={'membername':_0x3a43d4[_0xe262('0x1d')],'interface':_0x3a1bcf,'enterAt':moment()[_0xe262('0x1f')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x3a43d4[_0xe262('0x2e')],'internal':_0x3a43d4[_0xe262('0x1e')]};_0x41f95a['forEach'](function(_0x2daddd){_0x4a6a4c[_0xe262('0x4d')](_[_0xe262('0x4f')]({'channel':_0x2daddd,'type':'LOGIN','data1':'callysquare','data2':_0x3a1bcf},_0x102d61));if(_0x3a43d4[_0xe262('0x46')]){_0x56bcc9[_0xe262('0x4d')](_['merge']({'channel':_0x2daddd,'type':_0xe262('0x25'),'data1':_0xe262('0x50')},_0x102d61));}});return db[_0xe262('0x2f')][_0xe262('0x30')](_0x4a6a4c[_0xe262('0x51')](_0x56bcc9),{'individualHooks':!![]});}})['then'](function(){if(_0x3a43d4){return _0x3a43d4[_0xe262('0x23')]({'online':!![],'lastLoginAt':moment()[_0xe262('0x1f')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x3a43d4[_0xe262('0x46')]||![],'mailPause':_0x3a43d4[_0xe262('0x46')]||![],'chatPause':_0x3a43d4[_0xe262('0x46')]||![],'faxPause':_0x3a43d4[_0xe262('0x46')]||![],'smsPause':_0x3a43d4[_0xe262('0x46')]||![],'openchannelPause':_0x3a43d4[_0xe262('0x46')]||![],'pauseType':_0x3a43d4[_0xe262('0x46')]?_0xe262('0x50'):null,'lastPauseAt':moment()[_0xe262('0x1f')](_0xe262('0x27')),'interface':_0x3a1bcf});}})['then'](function(_0x4fff19){_0x4cc9cf(_0x4fff19);})[_0xe262('0x17')](function(_0x3c31ea){_0x4355f4(_0x1962be[_0xe262('0x18')](0x1f4,_0x3c31ea[_0xe262('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 1887e9a..4c2a7c0 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 _0x17d6=['register','length','user:','./user.events','save','remove','removeListener'];(function(_0x4b0fd6,_0x208dcc){var _0x53f64a=function(_0x466b9b){while(--_0x466b9b){_0x4b0fd6['push'](_0x4b0fd6['shift']());}};_0x53f64a(++_0x208dcc);}(_0x17d6,0x8f));var _0x617d=function(_0x59eb48,_0x31691f){_0x59eb48=_0x59eb48-0x0;var _0x130bab=_0x17d6[_0x59eb48];return _0x130bab;};'use strict';var UserEvents=require(_0x617d('0x0'));var events=[_0x617d('0x1'),_0x617d('0x2'),'update'];function createListener(_0x58c494,_0x31593e){return function(_0xd6eb52){_0x31593e['emit'](_0x58c494,_0xd6eb52);};}function removeListener(_0x255dbb,_0x5a3d96){return function(){UserEvents[_0x617d('0x3')](_0x255dbb,_0x5a3d96);};}exports[_0x617d('0x4')]=function(_0x2ec634){for(var _0x7dcfe8=0x0,_0x1f135a=events[_0x617d('0x5')];_0x7dcfe8<_0x1f135a;_0x7dcfe8++){var _0x5a1afd=events[_0x7dcfe8];var _0x118cce=createListener(_0x617d('0x6')+_0x5a1afd,_0x2ec634);UserEvents['on'](_0x5a1afd,_0x118cce);}}; \ No newline at end of file +var _0x4656=['user:','save','update','emit','removeListener','register','length'];(function(_0xbe40ad,_0x44343c){var _0x50fac9=function(_0xdaed07){while(--_0xdaed07){_0xbe40ad['push'](_0xbe40ad['shift']());}};_0x50fac9(++_0x44343c);}(_0x4656,0x8d));var _0x6465=function(_0x52666e,_0x5b3776){_0x52666e=_0x52666e-0x0;var _0x515330=_0x4656[_0x52666e];return _0x515330;};'use strict';var UserEvents=require('./user.events');var events=[_0x6465('0x0'),'remove',_0x6465('0x1')];function createListener(_0xc368e4,_0x3772a9){return function(_0x401106){_0x3772a9[_0x6465('0x2')](_0xc368e4,_0x401106);};}function removeListener(_0x74b680,_0x3805f0){return function(){UserEvents[_0x6465('0x3')](_0x74b680,_0x3805f0);};}exports[_0x6465('0x4')]=function(_0x3b4050){for(var _0x53c5c1=0x0,_0x35a0cf=events[_0x6465('0x5')];_0x53c5c1<_0x35a0cf;_0x53c5c1++){var _0x2f63f7=events[_0x53c5c1];var _0x6786ac=createListener(_0x6465('0x6')+_0x2f63f7,_0x3b4050);UserEvents['on'](_0x2f63f7,_0x6786ac);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 76c4202..554a67d 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x51a032,_0x43ab93){var _0x59b1f0=function(_0x4b2969){while(--_0x4b2969){_0x51a032['push'](_0x51a032['shift']());}};_0x59b1f0(++_0x43ab93);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x563d9b,_0x4ad30d){var _0x294cac=function(_0x64de90){while(--_0x64de90){_0x563d9b['push'](_0x563d9b['shift']());}};_0x294cac(++_0x4ad30d);}(_0xe706,0xa3));var _0x6e70=function(_0x4c8540,_0x1243ae){_0x4c8540=_0x4c8540-0x0;var _0x32f264=_0xe706[_0x4c8540];return _0x32f264;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 4d1039b..ec453cd 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 _0xf6d8=['sequelize','exports','INTEGER'];(function(_0x4e8401,_0x51b328){var _0x17269f=function(_0x35ac65){while(--_0x35ac65){_0x4e8401['push'](_0x4e8401['shift']());}};_0x17269f(++_0x51b328);}(_0xf6d8,0xb4));var _0x8f6d=function(_0x39438a,_0x4bbf96){_0x39438a=_0x39438a-0x0;var _0x306d09=_0xf6d8[_0x39438a];return _0x306d09;};'use strict';var Sequelize=require(_0x8f6d('0x0'));module[_0x8f6d('0x1')]={'penalty':{'type':Sequelize[_0x8f6d('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x93b6=['exports','sequelize'];(function(_0x8104a8,_0x55d833){var _0x35a52e=function(_0x5bf3fd){while(--_0x5bf3fd){_0x8104a8['push'](_0x8104a8['shift']());}};_0x35a52e(++_0x55d833);}(_0x93b6,0x151));var _0x693b=function(_0x5f0266,_0xe8b21c){_0x5f0266=_0x5f0266-0x0;var _0x3a6a07=_0x93b6[_0x5f0266];return _0x3a6a07;};'use strict';var Sequelize=require(_0x693b('0x0'));module[_0x693b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 5947695..f5c8ed5 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 _0x84f8=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserChatQueue','../../config/logger'];(function(_0x5f0225,_0x52631a){var _0x2cef4b=function(_0x5a29c6){while(--_0x5a29c6){_0x5f0225['push'](_0x5f0225['shift']());}};_0x2cef4b(++_0x52631a);}(_0x84f8,0xba));var _0x884f=function(_0x31a2fb,_0x1996d7){_0x31a2fb=_0x31a2fb-0x0;var _0x2e343b=_0x84f8[_0x31a2fb];return _0x2e343b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x884f('0x0'))(_0x884f('0x1'));var moment=require(_0x884f('0x2'));var BPromise=require(_0x884f('0x3'));var rp=require(_0x884f('0x4'));var fs=require('fs');var path=require(_0x884f('0x5'));var rimraf=require(_0x884f('0x6'));var config=require(_0x884f('0x7'));var attributes=require('./userChatQueue.attributes');module[_0x884f('0x8')]=function(_0x4a7655,_0x292dda){return _0x4a7655[_0x884f('0x9')](_0x884f('0xa'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad94=['request-promise','rimraf','../../config/environment','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api'];(function(_0xd31621,_0x17b567){var _0x2e7ac0=function(_0x3c5a8d){while(--_0x3c5a8d){_0xd31621['push'](_0xd31621['shift']());}};_0x2e7ac0(++_0x17b567);}(_0xad94,0xc2));var _0x4ad9=function(_0xb7d633,_0x2edc42){_0xb7d633=_0xb7d633-0x0;var _0x52ffc2=_0xad94[_0xb7d633];return _0x52ffc2;};'use strict';var _=require(_0x4ad9('0x0'));var util=require(_0x4ad9('0x1'));var logger=require(_0x4ad9('0x2'))(_0x4ad9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4ad9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4ad9('0x5'));var config=require(_0x4ad9('0x6'));var attributes=require('./userChatQueue.attributes');module['exports']=function(_0x38feee,_0x1314e2){return _0x38feee['define'](_0x4ad9('0x7'),attributes,{'tableName':_0x4ad9('0x8'),'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 554b32c..c7f7d49 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 _0x8560=['stringify','error','UserChatQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug'];(function(_0x1f5494,_0x45b5e2){var _0x1b3062=function(_0x2f85f3){while(--_0x2f85f3){_0x1f5494['push'](_0x1f5494['shift']());}};_0x1b3062(++_0x45b5e2);}(_0x8560,0x6e));var _0x0856=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x8560[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require(_0x0856('0x0'));var util=require(_0x0856('0x1'));var moment=require(_0x0856('0x2'));var BPromise=require(_0x0856('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0856('0x4'));var db=require(_0x0856('0x5'))['db'];var utils=require(_0x0856('0x6'));var logger=require(_0x0856('0x7'))(_0x0856('0x8'));var config=require(_0x0856('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0856('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54cddf,_0x10f3c6,_0x3380cb){return new BPromise(function(_0x5cc449,_0x4e1f77){return client[_0x0856('0xb')](_0x54cddf,_0x3380cb)[_0x0856('0xc')](function(_0x8a939e){logger[_0x0856('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x10f3c6,_0x0856('0xe'));logger[_0x0856('0xf')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x10f3c6,'request\x20sent',JSON[_0x0856('0x10')](_0x8a939e));if(_0x8a939e['error']){if(_0x8a939e[_0x0856('0x11')]['code']===0x1f4){logger[_0x0856('0x11')](_0x0856('0x12'),_0x10f3c6,_0x8a939e['error'][_0x0856('0x13')]);return _0x4e1f77(_0x8a939e[_0x0856('0x11')][_0x0856('0x13')]);}logger[_0x0856('0x11')](_0x0856('0x12'),_0x10f3c6,_0x8a939e['error']['message']);return _0x5cc449(_0x8a939e['error'][_0x0856('0x13')]);}else{logger[_0x0856('0xd')](_0x0856('0x12'),_0x10f3c6,_0x0856('0xe'));_0x5cc449(_0x8a939e['result'][_0x0856('0x13')]);}})[_0x0856('0x14')](function(_0x2e9686){logger[_0x0856('0x11')](_0x0856('0x12'),_0x10f3c6,_0x2e9686);_0x4e1f77(_0x2e9686);});});} \ No newline at end of file +var _0x5f07=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','util','moment'];(function(_0x16a43a,_0x504546){var _0x394a67=function(_0x302a81){while(--_0x302a81){_0x16a43a['push'](_0x16a43a['shift']());}};_0x394a67(++_0x504546);}(_0x5f07,0x11c));var _0x75f0=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x5f07[_0x1da04e];return _0xdd8c41;};'use strict';var _=require('lodash');var util=require(_0x75f0('0x0'));var moment=require(_0x75f0('0x1'));var BPromise=require(_0x75f0('0x2'));var rs=require(_0x75f0('0x3'));var fs=require('fs');var Redis=require(_0x75f0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x75f0('0x5'));var logger=require(_0x75f0('0x6'))(_0x75f0('0x7'));var config=require(_0x75f0('0x8'));var jayson=require(_0x75f0('0x9'));var client=jayson[_0x75f0('0xa')][_0x75f0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x340468,_0x4808ac,_0x49570f){return new BPromise(function(_0x547340,_0x357c45){return client[_0x75f0('0xc')](_0x340468,_0x49570f)['then'](function(_0x440974){logger['info'](_0x75f0('0xd'),_0x4808ac,_0x75f0('0xe'));logger[_0x75f0('0xf')](_0x75f0('0x10'),_0x4808ac,'request\x20sent',JSON['stringify'](_0x440974));if(_0x440974[_0x75f0('0x11')]){if(_0x440974[_0x75f0('0x11')][_0x75f0('0x12')]===0x1f4){logger['error'](_0x75f0('0xd'),_0x4808ac,_0x440974[_0x75f0('0x11')][_0x75f0('0x13')]);return _0x357c45(_0x440974['error'][_0x75f0('0x13')]);}logger[_0x75f0('0x11')](_0x75f0('0xd'),_0x4808ac,_0x440974['error'][_0x75f0('0x13')]);return _0x547340(_0x440974[_0x75f0('0x11')][_0x75f0('0x13')]);}else{logger[_0x75f0('0x14')](_0x75f0('0xd'),_0x4808ac,_0x75f0('0xe'));_0x547340(_0x440974[_0x75f0('0x15')][_0x75f0('0x13')]);}})['catch'](function(_0x37bcf4){logger[_0x75f0('0x11')](_0x75f0('0xd'),_0x4808ac,_0x37bcf4);_0x357c45(_0x37bcf4);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 1d310dc..e7a5062 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x283697,_0x43d671){var _0x264030=function(_0x522e2c){while(--_0x522e2c){_0x283697['push'](_0x283697['shift']());}};_0x264030(++_0x43d671);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x134d5e,_0x2a47d8){_0x134d5e=_0x134d5e-0x0;var _0x1e166a=_0xcb91[_0x134d5e];return _0x1e166a;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4ca426,_0x265a46){var _0x23edec=function(_0xe03a6a){while(--_0xe03a6a){_0x4ca426['push'](_0x4ca426['shift']());}};_0x23edec(++_0x265a46);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 78c714b..aafaecf 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 _0xaa9f=['STRING','sequelize','exports','INTEGER'];(function(_0x5bdf54,_0x12cd1b){var _0x59522a=function(_0xb5db52){while(--_0xb5db52){_0x5bdf54['push'](_0x5bdf54['shift']());}};_0x59522a(++_0x12cd1b);}(_0xaa9f,0x1bd));var _0xfaa9=function(_0x1678c8,_0x1c32f4){_0x1678c8=_0x1678c8-0x0;var _0x387aa9=_0xaa9f[_0x1678c8];return _0x387aa9;};'use strict';var Sequelize=require(_0xfaa9('0x0'));module[_0xfaa9('0x1')]={'penalty':{'type':Sequelize[_0xfaa9('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xfaa9('0x3')]}}; \ No newline at end of file +var _0xb416=['sequelize','exports','STRING'];(function(_0x22676f,_0x20b551){var _0x2400e0=function(_0x302148){while(--_0x302148){_0x22676f['push'](_0x22676f['shift']());}};_0x2400e0(++_0x20b551);}(_0xb416,0x16e));var _0x6b41=function(_0x3782af,_0x4c44eb){_0x3782af=_0x3782af-0x0;var _0x4182b5=_0xb416[_0x3782af];return _0x4182b5;};'use strict';var Sequelize=require(_0x6b41('0x0'));module[_0x6b41('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x6b41('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index da69002..1da1449 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 _0x399f=['api','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger'];(function(_0x32c1de,_0x319a95){var _0x1e01d8=function(_0x342f06){while(--_0x342f06){_0x32c1de['push'](_0x32c1de['shift']());}};_0x1e01d8(++_0x319a95);}(_0x399f,0x1c4));var _0xf399=function(_0x240eb3,_0x8022b7){_0x240eb3=_0x240eb3-0x0;var _0x235a7d=_0x399f[_0x240eb3];return _0x235a7d;};'use strict';var _=require(_0xf399('0x0'));var util=require(_0xf399('0x1'));var logger=require(_0xf399('0x2'))(_0xf399('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf399('0x4'));var fs=require('fs');var path=require(_0xf399('0x5'));var rimraf=require(_0xf399('0x6'));var config=require(_0xf399('0x7'));var attributes=require(_0xf399('0x8'));module[_0xf399('0x9')]=function(_0x5c2ab9,_0x1757a1){return _0x5c2ab9[_0xf399('0xa')](_0xf399('0xb'),attributes,{'tableName':_0xf399('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ba6=['rimraf','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2b441f,_0x249bac){var _0x1cc771=function(_0x33b705){while(--_0x33b705){_0x2b441f['push'](_0x2b441f['shift']());}};_0x1cc771(++_0x249bac);}(_0x2ba6,0x1aa));var _0x62ba=function(_0xe4e58,_0x201547){_0xe4e58=_0xe4e58-0x0;var _0x56d67b=_0x2ba6[_0xe4e58];return _0x56d67b;};'use strict';var _=require(_0x62ba('0x0'));var util=require('util');var logger=require(_0x62ba('0x1'))(_0x62ba('0x2'));var moment=require('moment');var BPromise=require(_0x62ba('0x3'));var rp=require(_0x62ba('0x4'));var fs=require('fs');var path=require(_0x62ba('0x5'));var rimraf=require(_0x62ba('0x6'));var config=require('../../config/environment');var attributes=require(_0x62ba('0x7'));module[_0x62ba('0x8')]=function(_0x4cde04,_0x46e875){return _0x4cde04[_0x62ba('0x9')](_0x62ba('0xa'),attributes,{'tableName':_0x62ba('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 36bb4cf..a1f476a 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 _0xf60a=['../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x15658b,_0x32d0e5){var _0x47fa38=function(_0x7e535d){while(--_0x7e535d){_0x15658b['push'](_0x15658b['shift']());}};_0x47fa38(++_0x32d0e5);}(_0xf60a,0xaf));var _0xaf60=function(_0x351ad4,_0x20114a){_0x351ad4=_0x351ad4-0x0;var _0xa3efa3=_0xf60a[_0x351ad4];return _0xa3efa3;};'use strict';var _=require(_0xaf60('0x0'));var util=require(_0xaf60('0x1'));var moment=require(_0xaf60('0x2'));var BPromise=require(_0xaf60('0x3'));var rs=require(_0xaf60('0x4'));var fs=require('fs');var Redis=require(_0xaf60('0x5'));var db=require(_0xaf60('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xaf60('0x7'))(_0xaf60('0x8'));var config=require(_0xaf60('0x9'));var jayson=require(_0xaf60('0xa'));var client=jayson[_0xaf60('0xb')][_0xaf60('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x45735d,_0x315e92,_0xb40fc){return new BPromise(function(_0x5a78ab,_0xab134d){return client[_0xaf60('0xd')](_0x45735d,_0xb40fc)[_0xaf60('0xe')](function(_0x126b4f){logger[_0xaf60('0xf')](_0xaf60('0x10'),_0x315e92,_0xaf60('0x11'));logger[_0xaf60('0x12')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x315e92,_0xaf60('0x11'),JSON[_0xaf60('0x13')](_0x126b4f));if(_0x126b4f['error']){if(_0x126b4f['error']['code']===0x1f4){logger[_0xaf60('0x14')](_0xaf60('0x10'),_0x315e92,_0x126b4f['error'][_0xaf60('0x15')]);return _0xab134d(_0x126b4f[_0xaf60('0x14')]['message']);}logger[_0xaf60('0x14')]('UserFaxQueue,\x20%s,\x20%s',_0x315e92,_0x126b4f['error'][_0xaf60('0x15')]);return _0x5a78ab(_0x126b4f[_0xaf60('0x14')][_0xaf60('0x15')]);}else{logger[_0xaf60('0xf')](_0xaf60('0x10'),_0x315e92,_0xaf60('0x11'));_0x5a78ab(_0x126b4f[_0xaf60('0x16')]['message']);}})['catch'](function(_0x30f7b0){logger[_0xaf60('0x14')]('UserFaxQueue,\x20%s,\x20%s',_0x315e92,_0x30f7b0);_0xab134d(_0x30f7b0);});});} \ No newline at end of file +var _0x2137=['http','then','info','UserFaxQueue,\x20%s,\x20%s','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x2137,0x7b));var _0x7213=function(_0x1d2bc8,_0x2860bc){_0x1d2bc8=_0x1d2bc8-0x0;var _0x1857e1=_0x2137[_0x1d2bc8];return _0x1857e1;};'use strict';var _=require(_0x7213('0x0'));var util=require(_0x7213('0x1'));var moment=require(_0x7213('0x2'));var BPromise=require('bluebird');var rs=require(_0x7213('0x3'));var fs=require('fs');var Redis=require(_0x7213('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7213('0x5'));var logger=require(_0x7213('0x6'))(_0x7213('0x7'));var config=require('../../config/environment');var jayson=require(_0x7213('0x8'));var client=jayson[_0x7213('0x9')][_0x7213('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x451b37,_0x27c3a5,_0x394407){return new BPromise(function(_0x1f4860,_0x32cc99){return client['request'](_0x451b37,_0x394407)[_0x7213('0xb')](function(_0x1585e3){logger[_0x7213('0xc')](_0x7213('0xd'),_0x27c3a5,'request\x20sent');logger['debug'](_0x7213('0xe'),_0x27c3a5,_0x7213('0xf'),JSON[_0x7213('0x10')](_0x1585e3));if(_0x1585e3['error']){if(_0x1585e3[_0x7213('0x11')]['code']===0x1f4){logger[_0x7213('0x11')](_0x7213('0xd'),_0x27c3a5,_0x1585e3[_0x7213('0x11')]['message']);return _0x32cc99(_0x1585e3[_0x7213('0x11')][_0x7213('0x12')]);}logger[_0x7213('0x11')](_0x7213('0xd'),_0x27c3a5,_0x1585e3[_0x7213('0x11')][_0x7213('0x12')]);return _0x1f4860(_0x1585e3[_0x7213('0x11')][_0x7213('0x12')]);}else{logger[_0x7213('0xc')](_0x7213('0xd'),_0x27c3a5,'request\x20sent');_0x1f4860(_0x1585e3['result']['message']);}})['catch'](function(_0x514368){logger[_0x7213('0x11')](_0x7213('0xd'),_0x27c3a5,_0x514368);_0x32cc99(_0x514368);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 3e33983..d34dc76 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3aed67,_0x2822a7){var _0x378176=function(_0x3e6c93){while(--_0x3e6c93){_0x3aed67['push'](_0x3aed67['shift']());}};_0x378176(++_0x2822a7);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x40911a,_0x55ec99){_0x40911a=_0x40911a-0x0;var _0x27e8e3=_0xcb91[_0x40911a];return _0x27e8e3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4bf18e,_0x15aa81){var _0x3a987a=function(_0x534340){while(--_0x534340){_0x4bf18e['push'](_0x4bf18e['shift']());}};_0x3a987a(++_0x15aa81);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x213518,_0x51e022){_0x213518=_0x213518-0x0;var _0x1baf75=_0xcb91[_0x213518];return _0x1baf75;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index c0b76b6..01defd8 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 _0x167b=['INTEGER','sequelize','exports'];(function(_0x5e5f5a,_0x5cb19a){var _0x4141ae=function(_0x4bb2ea){while(--_0x4bb2ea){_0x5e5f5a['push'](_0x5e5f5a['shift']());}};_0x4141ae(++_0x5cb19a);}(_0x167b,0x163));var _0xb167=function(_0x8584d6,_0x5d3337){_0x8584d6=_0x8584d6-0x0;var _0x49f863=_0x167b[_0x8584d6];return _0x49f863;};'use strict';var Sequelize=require(_0xb167('0x0'));module[_0xb167('0x1')]={'penalty':{'type':Sequelize[_0xb167('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf740=['sequelize','exports','INTEGER'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xf740,0xd5));var _0x0f74=function(_0x151381,_0x97b314){_0x151381=_0x151381-0x0;var _0x2afab6=_0xf740[_0x151381];return _0x2afab6;};'use strict';var Sequelize=require(_0x0f74('0x0'));module[_0x0f74('0x1')]={'penalty':{'type':Sequelize[_0x0f74('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 b800157..69fdd83 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 _0x567f=['rimraf','../../config/environment','exports','define','user_has_mail_queues','lodash','util','../../config/logger','api','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x567f,0xe1));var _0xf567=function(_0x20713e,_0x44f710){_0x20713e=_0x20713e-0x0;var _0x7d998b=_0x567f[_0x20713e];return _0x7d998b;};'use strict';var _=require(_0xf567('0x0'));var util=require(_0xf567('0x1'));var logger=require(_0xf567('0x2'))(_0xf567('0x3'));var moment=require('moment');var BPromise=require(_0xf567('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf567('0x5'));var config=require(_0xf567('0x6'));var attributes=require('./userMailQueue.attributes');module[_0xf567('0x7')]=function(_0x3d9585,_0x4400ed){return _0x3d9585[_0xf567('0x8')]('UserMailQueue',attributes,{'tableName':_0xf567('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d02=['path','rimraf','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','util','../../config/logger','api','moment','bluebird'];(function(_0x17fde3,_0x552ee3){var _0x22bc5d=function(_0x388dc4){while(--_0x388dc4){_0x17fde3['push'](_0x17fde3['shift']());}};_0x22bc5d(++_0x552ee3);}(_0x4d02,0x16f));var _0x24d0=function(_0x111d35,_0x1d1bce){_0x111d35=_0x111d35-0x0;var _0x1d4701=_0x4d02[_0x111d35];return _0x1d4701;};'use strict';var _=require('lodash');var util=require(_0x24d0('0x0'));var logger=require(_0x24d0('0x1'))(_0x24d0('0x2'));var moment=require(_0x24d0('0x3'));var BPromise=require(_0x24d0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x24d0('0x5'));var rimraf=require(_0x24d0('0x6'));var config=require('../../config/environment');var attributes=require(_0x24d0('0x7'));module[_0x24d0('0x8')]=function(_0x2d6245,_0x128d89){return _0x2d6245[_0x24d0('0x9')](_0x24d0('0xa'),attributes,{'tableName':_0x24d0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index dd466e2..e11d389 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 _0xf3cd=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserMailQueue,\x20%s,\x20%s','message','result'];(function(_0x279755,_0x42ad77){var _0x138178=function(_0x462033){while(--_0x462033){_0x279755['push'](_0x279755['shift']());}};_0x138178(++_0x42ad77);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x20259c,_0xe43fb2){_0x20259c=_0x20259c-0x0;var _0x4d988e=_0xf3cd[_0x20259c];return _0x4d988e;};'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});function respondWithRpcPromise(_0x1f0601,_0x106021,_0x28edae){return new BPromise(function(_0x52c073,_0x15705d){return client['request'](_0x1f0601,_0x28edae)['then'](function(_0x22d8ae){logger[_0xdf3c('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x106021,_0xdf3c('0xd'));logger[_0xdf3c('0xe')](_0xdf3c('0xf'),_0x106021,_0xdf3c('0xd'),JSON[_0xdf3c('0x10')](_0x22d8ae));if(_0x22d8ae[_0xdf3c('0x11')]){if(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x12')]===0x1f4){logger['error'](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);return _0x15705d(_0x22d8ae[_0xdf3c('0x11')]['message']);}logger[_0xdf3c('0x11')](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')]['message']);return _0x52c073(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);}else{logger[_0xdf3c('0xc')](_0xdf3c('0x13'),_0x106021,_0xdf3c('0xd'));_0x52c073(_0x22d8ae[_0xdf3c('0x15')][_0xdf3c('0x14')]);}})[_0xdf3c('0x16')](function(_0x2986d0){logger[_0xdf3c('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x106021,_0x2986d0);_0x15705d(_0x2986d0);});});} \ No newline at end of file +var _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x1cb9,0x14e));var _0x91cb=function(_0x1d3d2d,_0x5be56f){_0x1d3d2d=_0x1d3d2d-0x0;var _0x512625=_0x1cb9[_0x1d3d2d];return _0x512625;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('UserMailQueue,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index ce8d203..5876be3 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 _0x586a=['../../components/auth/service','../../components/interaction/service','./userNotification.controller','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x22dac7,_0x45d32a){var _0x3e6cfa=function(_0x4c2e9d){while(--_0x4c2e9d){_0x22dac7['push'](_0x22dac7['shift']());}};_0x3e6cfa(++_0x45d32a);}(_0x586a,0x199));var _0xa586=function(_0x44737d,_0x2f74bf){_0x44737d=_0x44737d-0x0;var _0x2b01e1=_0x586a[_0x44737d];return _0x2b01e1;};'use strict';var multer=require(_0xa586('0x0'));var util=require(_0xa586('0x1'));var path=require(_0xa586('0x2'));var timeout=require(_0xa586('0x3'));var express=require(_0xa586('0x4'));var router=express[_0xa586('0x5')]();var fs_extra=require(_0xa586('0x6'));var auth=require(_0xa586('0x7'));var interaction=require(_0xa586('0x8'));var config=require('../../config/environment');var controller=require(_0xa586('0x9'));router['post']('/',auth[_0xa586('0xa')](),controller[_0xa586('0xb')]);module[_0xa586('0xc')]=router; \ No newline at end of file +var _0xcafe=['post','isAuthenticated','sendUserNotification','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x5a2ac1,_0x49d2cf){var _0x3eb4c5=function(_0x58cb4f){while(--_0x58cb4f){_0x5a2ac1['push'](_0x5a2ac1['shift']());}};_0x3eb4c5(++_0x49d2cf);}(_0xcafe,0x1bb));var _0xecaf=function(_0x13d341,_0x491bfb){_0x13d341=_0x13d341-0x0;var _0x266f68=_0xcafe[_0x13d341];return _0x266f68;};'use strict';var multer=require(_0xecaf('0x0'));var util=require('util');var path=require(_0xecaf('0x1'));var timeout=require(_0xecaf('0x2'));var express=require(_0xecaf('0x3'));var router=express[_0xecaf('0x4')]();var fs_extra=require(_0xecaf('0x5'));var auth=require(_0xecaf('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userNotification.controller');router[_0xecaf('0x7')]('/',auth[_0xecaf('0x8')](),controller[_0xecaf('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 3b63aff..f0370ca 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 _0xdeae=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xdeae,0x11d));var _0xedea=function(_0x38b5f7,_0x153d04){_0x38b5f7=_0x38b5f7-0x0;var _0x34595c=_0xdeae[_0x38b5f7];return _0x34595c;};'use strict';var Sequelize=require(_0xedea('0x0'));module[_0xedea('0x1')]={'body':{'type':Sequelize[_0xedea('0x2')]},'senderName':{'type':Sequelize[_0xedea('0x3')]},'recipientsId':{'type':Sequelize[_0xedea('0x2')]},'recipientsDescription':{'type':Sequelize[_0xedea('0x3')]},'beep':{'type':Sequelize[_0xedea('0x4')]}}; \ No newline at end of file +var _0x7f50=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x1ff50f,_0x2a9eb5){var _0xdddc41=function(_0xe7d329){while(--_0xe7d329){_0x1ff50f['push'](_0x1ff50f['shift']());}};_0xdddc41(++_0x2a9eb5);}(_0x7f50,0xf6));var _0x07f5=function(_0x46d36d,_0x340e12){_0x46d36d=_0x46d36d-0x0;var _0x2212b5=_0x7f50[_0x46d36d];return _0x2212b5;};'use strict';var Sequelize=require(_0x07f5('0x0'));module[_0x07f5('0x1')]={'body':{'type':Sequelize[_0x07f5('0x2')]},'senderName':{'type':Sequelize[_0x07f5('0x3')]},'recipientsId':{'type':Sequelize[_0x07f5('0x2')]},'recipientsDescription':{'type':Sequelize[_0x07f5('0x3')]},'beep':{'type':Sequelize[_0x07f5('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 4d4e998..0b1d7d9 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 _0xfbd5=['offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','sendUserNotification','text','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','whatsappqueue','team','user','some','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','sortBy','sequelize','transaction','UserNotification','create','forEach','recipient','userNotification:send','catch','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','html','startCase','User','ids','includes','queue','replace','Queue','push','all','union','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','json'];(function(_0x79d706,_0x4e5e39){var _0x3c8c3d=function(_0x2cf0f4){while(--_0x2cf0f4){_0x79d706['push'](_0x79d706['shift']());}};_0x3c8c3d(++_0x4e5e39);}(_0xfbd5,0x116));var _0x5fbd=function(_0x2ad2c6,_0x31c419){_0x2ad2c6=_0x2ad2c6-0x0;var _0x37fd0b=_0xfbd5[_0x2ad2c6];return _0x37fd0b;};'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(_0x5fbd('0x4'));var moment=require(_0x5fbd('0x5'));var BPromise=require(_0x5fbd('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5fbd('0x7'));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('querystring');var Papa=require(_0x5fbd('0x11'));var Redis=require('ioredis');var authService=require(_0x5fbd('0x12'));var qs=require(_0x5fbd('0x13'));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('../../config/license/util');var db=require(_0x5fbd('0x19'))['db'];config['redis']=_[_0x5fbd('0x1a')](config[_0x5fbd('0x1b')],{'host':_0x5fbd('0x1c'),'port':0x18eb});var socket=require(_0x5fbd('0x1d'))(new Redis(config['redis']));require('./userNotification.socket')[_0x5fbd('0x1e')](socket);function respondWithStatusCode(_0x18c28b,_0x5ad551){_0x5ad551=_0x5ad551||0xcc;return function(_0x31dd9b){if(_0x31dd9b){return _0x18c28b[_0x5fbd('0x1f')](_0x5ad551);}return _0x18c28b[_0x5fbd('0x20')](_0x5ad551)['end']();};}function respondWithResult(_0x479e10,_0x585309){_0x585309=_0x585309||0xc8;return function(_0x4d437f){if(_0x4d437f){return _0x479e10[_0x5fbd('0x20')](_0x585309)[_0x5fbd('0x21')](_0x4d437f);}};}function respondWithFilteredResult(_0x3d0344,_0x4d61aa){return function(_0x5a4405){if(_0x5a4405){var _0x35c648=typeof _0x4d61aa[_0x5fbd('0x22')]===_0x5fbd('0x23')&&typeof _0x4d61aa[_0x5fbd('0x24')]===_0x5fbd('0x23');var _0x2a575c=_0x5a4405[_0x5fbd('0x25')];var _0x2d41b9=_0x35c648?0x0:_0x4d61aa['offset'];var _0x42e9ea=_0x35c648?_0x5a4405[_0x5fbd('0x25')]:_0x4d61aa['offset']+_0x4d61aa[_0x5fbd('0x24')];var _0x432302;if(_0x42e9ea>=_0x2a575c){_0x42e9ea=_0x2a575c;_0x432302=0xc8;}else{_0x432302=0xce;}_0x3d0344[_0x5fbd('0x20')](_0x432302);return _0x3d0344[_0x5fbd('0x26')]('Content-Range',_0x2d41b9+'-'+_0x42e9ea+'/'+_0x2a575c)[_0x5fbd('0x21')](_0x5a4405);}return null;};}function patchUpdates(_0x5f42bd){return function(_0x532ac){try{jsonpatch[_0x5fbd('0x27')](_0x532ac,_0x5f42bd,!![]);}catch(_0x553e39){return BPromise[_0x5fbd('0x28')](_0x553e39);}return _0x532ac[_0x5fbd('0x29')]();};}function saveUpdates(_0x5baf8c,_0x19ac3e){return function(_0x3f2578){if(_0x3f2578){return _0x3f2578[_0x5fbd('0x2a')](_0x5baf8c)[_0x5fbd('0x2b')](function(_0x1a663e){return _0x1a663e;});}return null;};}function removeEntity(_0x4646ee,_0xfb622){return function(_0x271b9a){if(_0x271b9a){return _0x271b9a[_0x5fbd('0x2c')]()[_0x5fbd('0x2b')](function(){_0x4646ee['status'](0xcc)[_0x5fbd('0x2d')]();});}};}function handleEntityNotFound(_0x312895,_0x187566){return function(_0xc4eeea){if(!_0xc4eeea){_0x312895['sendStatus'](0x194);}return _0xc4eeea;};}function handleError(_0x5180d3,_0x36ecd2){_0x36ecd2=_0x36ecd2||0x1f4;return function(_0x39c79d){logger[_0x5fbd('0x2e')](_0x39c79d[_0x5fbd('0x2f')]);if(_0x39c79d[_0x5fbd('0x30')]){delete _0x39c79d[_0x5fbd('0x30')];}_0x5180d3['status'](_0x36ecd2)[_0x5fbd('0x31')](_0x39c79d);};}exports[_0x5fbd('0x32')]=function(_0x3a7df6,_0xad8fdd,_0x5365bf){if(!_0x3a7df6['body']['hasOwnProperty'](_0x5fbd('0x33'))&&!_0x3a7df6[_0x5fbd('0x34')][_0x5fbd('0x35')](_0x5fbd('0x36'))){throw new db[(_0x5fbd('0x37'))][(_0x5fbd('0x38'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x3a7df6[_0x5fbd('0x34')][_0x5fbd('0x35')](_0x5fbd('0x36'))&&!_0x3a7df6[_0x5fbd('0x34')]['hasOwnProperty'](_0x5fbd('0x39'))){throw new db['Sequelize'][(_0x5fbd('0x38'))](_0x5fbd('0x3a'));}if(!_0x3a7df6[_0x5fbd('0x34')]['hasOwnProperty'](_0x5fbd('0x3b'))){throw new db['Sequelize'][(_0x5fbd('0x38'))](_0x5fbd('0x3c'));}else{try{var _0x341815=JSON[_0x5fbd('0x3d')](_0x3a7df6[_0x5fbd('0x34')][_0x5fbd('0x3b')]);}catch(_0xaa5b90){logger[_0x5fbd('0x2e')](_0xaa5b90);throw new db[(_0x5fbd('0x37'))][(_0x5fbd('0x38'))](_0x5fbd('0x3e'));}var _0x231143=[_0x5fbd('0x3f'),_0x5fbd('0x40'),_0x5fbd('0x41'),_0x5fbd('0x42'),'smsqueue','voicequeue',_0x5fbd('0x43'),_0x5fbd('0x44'),_0x5fbd('0x45')];if(_[_0x5fbd('0x46')](_0x341815,function(_0x32b18b){return!_['includes'](_0x231143,_0x32b18b['model'][_0x5fbd('0x47')]());})){throw new db[(_0x5fbd('0x37'))][(_0x5fbd('0x38'))](_0x5fbd('0x48'));}}}var _0x32fe77={};_0x32fe77[_0x5fbd('0x49')]=_0x3a7df6[_0x5fbd('0x34')]['hasOwnProperty']('senderName')?_0x3a7df6[_0x5fbd('0x34')][_0x5fbd('0x49')]:_0x3a7df6['user'][_0x5fbd('0x4a')];_0x32fe77[_0x5fbd('0x4b')]=_[_0x5fbd('0x4c')](_0x3a7df6['body']['recipientsDescription'])?null:_0x3a7df6['body'][_0x5fbd('0x4b')];_0x32fe77['beep']=_0x3a7df6[_0x5fbd('0x34')][_0x5fbd('0x4d')]||![];_0x32fe77[_0x5fbd('0x4e')]=_0x3a7df6[_0x5fbd('0x45')]['id'];return getContent(_0x3a7df6[_0x5fbd('0x34')])['then'](function(_0x10375e){_0x32fe77[_0x5fbd('0x34')]=_0x10375e;return getRecipients(_0x341815);})[_0x5fbd('0x2b')](function(_0x127665){_0x32fe77['recipientsId']=_[_0x5fbd('0x4f')](_0x127665)['join'](',');return db[_0x5fbd('0x50')][_0x5fbd('0x51')](function(_0x383396){return db[_0x5fbd('0x52')][_0x5fbd('0x53')](_0x32fe77,{'raw':!![],'transaction':_0x383396})[_0x5fbd('0x2b')](function(_0x415e65){var _0x44df6a={'sender':_0x32fe77[_0x5fbd('0x49')],'description':_0x32fe77[_0x5fbd('0x4b')],'content':_0x32fe77['body'],'beep':_0x32fe77[_0x5fbd('0x4d')]};_0x127665[_0x5fbd('0x54')](function(_0x482c42){_0x44df6a[_0x5fbd('0x55')]=_0x482c42;socket['emit'](_0x5fbd('0x56'),_0x44df6a);});return _0x415e65;});});})[_0x5fbd('0x2b')](respondWithResult(_0xad8fdd,0xc9))[_0x5fbd('0x57')](handleError(_0xad8fdd,null));};function getContent(_0x1bbaae){return new BPromise(function(_0x279f2e,_0x20a3f2){if(_0x1bbaae['text']){_0x279f2e(_0x1bbaae[_0x5fbd('0x33')]);return;}return db['Template'][_0x5fbd('0x58')]({'attributes':['html'],'where':{'id':_0x1bbaae[_0x5fbd('0x36')]},'raw':!![]})['then'](function(_0x323b37){if(!_0x323b37)throw new db['Sequelize']['ValidationError'](_0x5fbd('0x59'));var _0x5cd242=Mustache['render'](_0x323b37[_0x5fbd('0x5a')],_0x1bbaae[_0x5fbd('0x39')]);_0x279f2e(_0x5cd242);})[_0x5fbd('0x57')](function(_0x503a30){_0x20a3f2(_0x503a30);});});}function getRecipients(_0x355502){return new BPromise(function(_0x18823b,_0xe53baf){var _0x14fb9f=[];var _0x285f20=[];_0x355502[_0x5fbd('0x54')](function(_0x260653){var _0x45df00=_[_0x5fbd('0x5b')](_0x260653['model'][_0x5fbd('0x47')]());if(_0x45df00===_0x5fbd('0x5c')){_0x14fb9f=_['union'](_0x14fb9f,_0x260653[_0x5fbd('0x5d')]);}else{if(_[_0x5fbd('0x5e')](_0x45df00,_0x5fbd('0x5f')))_0x45df00=_0x45df00[_0x5fbd('0x60')](_0x5fbd('0x5f'),_0x5fbd('0x61'));_0x260653[_0x5fbd('0x5d')]['forEach'](function(_0x1ccc51){_0x285f20[_0x5fbd('0x62')](getAgents(_0x45df00,_0x1ccc51));});}});return BPromise[_0x5fbd('0x63')](_0x285f20)[_0x5fbd('0x2b')](function(_0x9da38f){_0x14fb9f=_[_0x5fbd('0x64')](_0x14fb9f,_[_0x5fbd('0x65')](_0x9da38f));_0x18823b(_0x14fb9f);})[_0x5fbd('0x57')](function(_0x400422){_0xe53baf(_0x400422);});});}function getAgents(_0x4c833f,_0x4a1267){return new BPromise(function(_0x2b6512,_0x1e1caa){return db[_0x4c833f][_0x5fbd('0x58')]({'where':{'id':_0x4a1267}})[_0x5fbd('0x2b')](function(_0x288b19){return _0x288b19[_0x5fbd('0x66')]({'attributes':['id'],'raw':!![]})['then'](function(_0x346124){var _0x198dc0=_[_0x5fbd('0x67')](_0x346124,'id');_0x2b6512(_0x198dc0);});})[_0x5fbd('0x57')](function(_0x3b708a){_0x1e1caa(_0x3b708a);});});} \ No newline at end of file +var _0x6faa=['union','flatten','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','sendUserNotification','body','text','hasOwnProperty','TemplateId','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Sequelize','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','team','user','some','senderName','fullname','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','recipientsDescription','forEach','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','User','ids','includes','queue','replace','Queue','push','all'];(function(_0x5e1b44,_0x36f5ef){var _0x3c2089=function(_0x355a66){while(--_0x355a66){_0x5e1b44['push'](_0x5e1b44['shift']());}};_0x3c2089(++_0x36f5ef);}(_0x6faa,0x135));var _0xa6fa=function(_0x383989,_0x20442f){_0x383989=_0x383989-0x0;var _0x2074f3=_0x6faa[_0x383989];return _0x2074f3;};'use strict';var emlformat=require(_0xa6fa('0x0'));var rimraf=require(_0xa6fa('0x1'));var zipdir=require(_0xa6fa('0x2'));var jsonpatch=require(_0xa6fa('0x3'));var rp=require('request-promise');var moment=require(_0xa6fa('0x4'));var BPromise=require(_0xa6fa('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa6fa('0x6'));var sox=require('sox');var csv=require(_0xa6fa('0x7'));var ejs=require(_0xa6fa('0x8'));var fs=require('fs');var fs_extra=require(_0xa6fa('0x9'));var _=require(_0xa6fa('0xa'));var squel=require(_0xa6fa('0xb'));var crypto=require(_0xa6fa('0xc'));var jsforce=require(_0xa6fa('0xd'));var deskjs=require(_0xa6fa('0xe'));var toCsv=require(_0xa6fa('0x7'));var querystring=require(_0xa6fa('0xf'));var Papa=require('papaparse');var Redis=require(_0xa6fa('0x10'));var authService=require(_0xa6fa('0x11'));var qs=require(_0xa6fa('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa6fa('0x13'));var logger=require(_0xa6fa('0x14'))(_0xa6fa('0x15'));var utils=require('../../config/utils');var config=require(_0xa6fa('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa6fa('0x17'))['db'];config[_0xa6fa('0x18')]=_['defaults'](config[_0xa6fa('0x18')],{'host':_0xa6fa('0x19'),'port':0x18eb});var socket=require(_0xa6fa('0x1a'))(new Redis(config[_0xa6fa('0x18')]));require(_0xa6fa('0x1b'))[_0xa6fa('0x1c')](socket);function respondWithStatusCode(_0x170f4d,_0x4b2823){_0x4b2823=_0x4b2823||0xcc;return function(_0x2c6f32){if(_0x2c6f32){return _0x170f4d[_0xa6fa('0x1d')](_0x4b2823);}return _0x170f4d[_0xa6fa('0x1e')](_0x4b2823)[_0xa6fa('0x1f')]();};}function respondWithResult(_0x8b8544,_0x4610c9){_0x4610c9=_0x4610c9||0xc8;return function(_0x37ad13){if(_0x37ad13){return _0x8b8544[_0xa6fa('0x1e')](_0x4610c9)[_0xa6fa('0x20')](_0x37ad13);}};}function respondWithFilteredResult(_0xee2ca1,_0x4a8f30){return function(_0x1572fc){if(_0x1572fc){var _0x2548ab=typeof _0x4a8f30['offset']==='undefined'&&typeof _0x4a8f30[_0xa6fa('0x21')]===_0xa6fa('0x22');var _0x15c0f8=_0x1572fc['count'];var _0x27fb92=_0x2548ab?0x0:_0x4a8f30[_0xa6fa('0x23')];var _0x273b24=_0x2548ab?_0x1572fc[_0xa6fa('0x24')]:_0x4a8f30[_0xa6fa('0x23')]+_0x4a8f30[_0xa6fa('0x21')];var _0x25129f;if(_0x273b24>=_0x15c0f8){_0x273b24=_0x15c0f8;_0x25129f=0xc8;}else{_0x25129f=0xce;}_0xee2ca1['status'](_0x25129f);return _0xee2ca1[_0xa6fa('0x25')](_0xa6fa('0x26'),_0x27fb92+'-'+_0x273b24+'/'+_0x15c0f8)[_0xa6fa('0x20')](_0x1572fc);}return null;};}function patchUpdates(_0x3ee669){return function(_0xb6b79c){try{jsonpatch[_0xa6fa('0x27')](_0xb6b79c,_0x3ee669,!![]);}catch(_0x5e3dbe){return BPromise[_0xa6fa('0x28')](_0x5e3dbe);}return _0xb6b79c['save']();};}function saveUpdates(_0xe42301,_0x340173){return function(_0x11f34d){if(_0x11f34d){return _0x11f34d[_0xa6fa('0x29')](_0xe42301)[_0xa6fa('0x2a')](function(_0x58faa9){return _0x58faa9;});}return null;};}function removeEntity(_0x191796,_0x5dbea5){return function(_0x3623e2){if(_0x3623e2){return _0x3623e2[_0xa6fa('0x2b')]()[_0xa6fa('0x2a')](function(){_0x191796[_0xa6fa('0x1e')](0xcc)[_0xa6fa('0x1f')]();});}};}function handleEntityNotFound(_0x232bbb,_0x8c8354){return function(_0xfe1a65){if(!_0xfe1a65){_0x232bbb[_0xa6fa('0x1d')](0x194);}return _0xfe1a65;};}function handleError(_0x4f8d37,_0x2215db){_0x2215db=_0x2215db||0x1f4;return function(_0x417fed){logger[_0xa6fa('0x2c')](_0x417fed[_0xa6fa('0x2d')]);if(_0x417fed[_0xa6fa('0x2e')]){delete _0x417fed[_0xa6fa('0x2e')];}_0x4f8d37['status'](_0x2215db)[_0xa6fa('0x2f')](_0x417fed);};}exports[_0xa6fa('0x30')]=function(_0x5cc703,_0x4d68f3,_0x50caee){if(!_0x5cc703[_0xa6fa('0x31')]['hasOwnProperty'](_0xa6fa('0x32'))&&!_0x5cc703[_0xa6fa('0x31')][_0xa6fa('0x33')](_0xa6fa('0x34'))){throw new db['Sequelize']['ValidationError'](_0xa6fa('0x35'));}else{if(_0x5cc703['body'][_0xa6fa('0x33')](_0xa6fa('0x34'))&&!_0x5cc703[_0xa6fa('0x31')][_0xa6fa('0x33')](_0xa6fa('0x36'))){throw new db['Sequelize'][(_0xa6fa('0x37'))](_0xa6fa('0x38'));}if(!_0x5cc703[_0xa6fa('0x31')]['hasOwnProperty'](_0xa6fa('0x39'))){throw new db[(_0xa6fa('0x3a'))][(_0xa6fa('0x37'))](_0xa6fa('0x3b'));}else{try{var _0x51f63b=JSON[_0xa6fa('0x3c')](_0x5cc703[_0xa6fa('0x31')]['recipients']);}catch(_0x4d0a8b){logger['error'](_0x4d0a8b);throw new db[(_0xa6fa('0x3a'))][(_0xa6fa('0x37'))](_0xa6fa('0x3d'));}var _0x4c23bd=[_0xa6fa('0x3e'),_0xa6fa('0x3f'),_0xa6fa('0x40'),_0xa6fa('0x41'),_0xa6fa('0x42'),_0xa6fa('0x43'),'whatsappqueue',_0xa6fa('0x44'),_0xa6fa('0x45')];if(_[_0xa6fa('0x46')](_0x51f63b,function(_0x35c724){return!_['includes'](_0x4c23bd,_0x35c724['model']['toLowerCase']());})){throw new db[(_0xa6fa('0x3a'))][(_0xa6fa('0x37'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x5cadf5={};_0x5cadf5[_0xa6fa('0x47')]=_0x5cc703[_0xa6fa('0x31')]['hasOwnProperty'](_0xa6fa('0x47'))?_0x5cc703['body'][_0xa6fa('0x47')]:_0x5cc703[_0xa6fa('0x45')][_0xa6fa('0x48')];_0x5cadf5['recipientsDescription']=_['isEmpty'](_0x5cc703[_0xa6fa('0x31')]['recipientsDescription'])?null:_0x5cc703[_0xa6fa('0x31')]['recipientsDescription'];_0x5cadf5['beep']=_0x5cc703[_0xa6fa('0x31')][_0xa6fa('0x49')]||![];_0x5cadf5[_0xa6fa('0x4a')]=_0x5cc703[_0xa6fa('0x45')]['id'];return getContent(_0x5cc703[_0xa6fa('0x31')])[_0xa6fa('0x2a')](function(_0x284bf5){_0x5cadf5[_0xa6fa('0x31')]=_0x284bf5;return getRecipients(_0x51f63b);})[_0xa6fa('0x2a')](function(_0x3477f7){_0x5cadf5[_0xa6fa('0x4b')]=_[_0xa6fa('0x4c')](_0x3477f7)[_0xa6fa('0x4d')](',');return db[_0xa6fa('0x4e')][_0xa6fa('0x4f')](function(_0x4c6681){return db[_0xa6fa('0x50')]['create'](_0x5cadf5,{'raw':!![],'transaction':_0x4c6681})[_0xa6fa('0x2a')](function(_0x5811f2){var _0x208c62={'sender':_0x5cadf5[_0xa6fa('0x47')],'description':_0x5cadf5[_0xa6fa('0x51')],'content':_0x5cadf5['body'],'beep':_0x5cadf5[_0xa6fa('0x49')]};_0x3477f7[_0xa6fa('0x52')](function(_0x3ec85d){_0x208c62['recipient']=_0x3ec85d;socket[_0xa6fa('0x53')](_0xa6fa('0x54'),_0x208c62);});return _0x5811f2;});});})[_0xa6fa('0x2a')](respondWithResult(_0x4d68f3,0xc9))[_0xa6fa('0x55')](handleError(_0x4d68f3,null));};function getContent(_0x5a4617){return new BPromise(function(_0x1b7a41,_0x31ae47){if(_0x5a4617['text']){_0x1b7a41(_0x5a4617[_0xa6fa('0x32')]);return;}return db[_0xa6fa('0x56')][_0xa6fa('0x57')]({'attributes':[_0xa6fa('0x58')],'where':{'id':_0x5a4617[_0xa6fa('0x34')]},'raw':!![]})[_0xa6fa('0x2a')](function(_0x36a557){if(!_0x36a557)throw new db[(_0xa6fa('0x3a'))][(_0xa6fa('0x37'))](_0xa6fa('0x59'));var _0x390c8f=Mustache[_0xa6fa('0x5a')](_0x36a557[_0xa6fa('0x58')],_0x5a4617[_0xa6fa('0x36')]);_0x1b7a41(_0x390c8f);})[_0xa6fa('0x55')](function(_0x14ca83){_0x31ae47(_0x14ca83);});});}function getRecipients(_0x33f485){return new BPromise(function(_0x52ae8d,_0x523bf0){var _0x1ad893=[];var _0x55dde6=[];_0x33f485[_0xa6fa('0x52')](function(_0xb9c039){var _0xce02c3=_['startCase'](_0xb9c039['model']['toLowerCase']());if(_0xce02c3===_0xa6fa('0x5b')){_0x1ad893=_['union'](_0x1ad893,_0xb9c039[_0xa6fa('0x5c')]);}else{if(_[_0xa6fa('0x5d')](_0xce02c3,_0xa6fa('0x5e')))_0xce02c3=_0xce02c3[_0xa6fa('0x5f')](_0xa6fa('0x5e'),_0xa6fa('0x60'));_0xb9c039[_0xa6fa('0x5c')]['forEach'](function(_0x23d74e){_0x55dde6[_0xa6fa('0x61')](getAgents(_0xce02c3,_0x23d74e));});}});return BPromise[_0xa6fa('0x62')](_0x55dde6)[_0xa6fa('0x2a')](function(_0x790999){_0x1ad893=_[_0xa6fa('0x63')](_0x1ad893,_[_0xa6fa('0x64')](_0x790999));_0x52ae8d(_0x1ad893);})[_0xa6fa('0x55')](function(_0x1f6aab){_0x523bf0(_0x1f6aab);});});}function getAgents(_0x5c2d46,_0x117f04){return new BPromise(function(_0x456046,_0x577d5c){return db[_0x5c2d46][_0xa6fa('0x57')]({'where':{'id':_0x117f04}})[_0xa6fa('0x2a')](function(_0x228de3){return _0x228de3[_0xa6fa('0x65')]({'attributes':['id'],'raw':!![]})[_0xa6fa('0x2a')](function(_0x562162){var _0x344cc4=_['map'](_0x562162,'id');_0x456046(_0x344cc4);});})['catch'](function(_0x43153c){_0x577d5c(_0x43153c);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 80a0b70..01273a5 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 _0x87b2=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification','save','update'];(function(_0x520e85,_0x457525){var _0x57dcc3=function(_0x4d436c){while(--_0x4d436c){_0x520e85['push'](_0x520e85['shift']());}};_0x57dcc3(++_0x457525);}(_0x87b2,0x69));var _0x287b=function(_0x3e5a4a,_0xd61f19){_0x3e5a4a=_0x3e5a4a-0x0;var _0x119bc0=_0x87b2[_0x3e5a4a];return _0x119bc0;};'use strict';var EventEmitter=require(_0x287b('0x0'));var UserNotification=require(_0x287b('0x1'))['db'][_0x287b('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x287b('0x3'),'afterUpdate':_0x287b('0x4'),'afterDestroy':_0x287b('0x5')};function emitEvent(_0x49494d){return function(_0x21233e,_0x253c6d,_0x31ce23){UserNotificationEvents[_0x287b('0x6')](_0x49494d+':'+_0x21233e['id'],_0x21233e);UserNotificationEvents[_0x287b('0x6')](_0x49494d,_0x21233e);_0x31ce23(null);};}for(var e in events){if(events[_0x287b('0x7')](e)){var event=events[e];UserNotification[_0x287b('0x8')](e,emitEvent(event));}}module[_0x287b('0x9')]=UserNotificationEvents; \ No newline at end of file +var _0x2259=['remove','hasOwnProperty','hook','exports','../../mysqldb','UserNotification','setMaxListeners','save','update'];(function(_0x35cc19,_0x1fa3d8){var _0x3f66a2=function(_0x75912a){while(--_0x75912a){_0x35cc19['push'](_0x35cc19['shift']());}};_0x3f66a2(++_0x1fa3d8);}(_0x2259,0x1a2));var _0x9225=function(_0x2cb3bc,_0x4a4f68){_0x2cb3bc=_0x2cb3bc-0x0;var _0x5084ed=_0x2259[_0x2cb3bc];return _0x5084ed;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x9225('0x0'))['db'][_0x9225('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x9225('0x2')](0x0);var events={'afterCreate':_0x9225('0x3'),'afterUpdate':_0x9225('0x4'),'afterDestroy':_0x9225('0x5')};function emitEvent(_0x39df62){return function(_0x3c2d49,_0x49d904,_0x190e00){UserNotificationEvents['emit'](_0x39df62+':'+_0x3c2d49['id'],_0x3c2d49);UserNotificationEvents['emit'](_0x39df62,_0x3c2d49);_0x190e00(null);};}for(var e in events){if(events[_0x9225('0x6')](e)){var event=events[e];UserNotification[_0x9225('0x7')](e,emitEvent(event));}}module[_0x9225('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 832b4fb..390108d 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 _0x99d4=['UserNotification','userNotifications','lodash','../../config/logger','bluebird','request-promise','./userNotification.attributes','exports','define'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x99d4,0x122));var _0x499d=function(_0x4dc6ec,_0x99f444){_0x4dc6ec=_0x4dc6ec-0x0;var _0x3d042a=_0x99d4[_0x4dc6ec];return _0x3d042a;};'use strict';var _=require(_0x499d('0x0'));var util=require('util');var logger=require(_0x499d('0x1'))('api');var moment=require('moment');var BPromise=require(_0x499d('0x2'));var rp=require(_0x499d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x499d('0x4'));module[_0x499d('0x5')]=function(_0x4748bc,_0x53264c){return _0x4748bc[_0x499d('0x6')](_0x499d('0x7'),attributes,{'tableName':_0x499d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf264=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./userNotification.attributes','exports','utf8mb4','utf8mb4_unicode_ci'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf264,0x1c8));var _0x4f26=function(_0x191af8,_0x13244d){_0x191af8=_0x191af8-0x0;var _0x3373ee=_0xf264[_0x191af8];return _0x3373ee;};'use strict';var _=require(_0x4f26('0x0'));var util=require(_0x4f26('0x1'));var logger=require(_0x4f26('0x2'))(_0x4f26('0x3'));var moment=require(_0x4f26('0x4'));var BPromise=require(_0x4f26('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4f26('0x6'));var config=require(_0x4f26('0x7'));var attributes=require(_0x4f26('0x8'));module[_0x4f26('0x9')]=function(_0x26469d,_0x146f18){return _0x26469d['define']('UserNotification',attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4f26('0xa'),'collate':_0x4f26('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index c7fb4a7..cf7dfe9 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 _0xbfcf=['debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','./userNotification.socket','register','then','info','UserNotification,\x20%s,\x20%s','request\x20sent'];(function(_0x40de62,_0x2efb79){var _0x56d2ca=function(_0x119bbf){while(--_0x119bbf){_0x40de62['push'](_0x40de62['shift']());}};_0x56d2ca(++_0x2efb79);}(_0xbfcf,0x126));var _0xfbfc=function(_0x291d3f,_0x3ef99f){_0x291d3f=_0x291d3f-0x0;var _0x242080=_0xbfcf[_0x291d3f];return _0x242080;};'use strict';var _=require(_0xfbfc('0x0'));var util=require(_0xfbfc('0x1'));var moment=require(_0xfbfc('0x2'));var BPromise=require('bluebird');var rs=require(_0xfbfc('0x3'));var fs=require('fs');var Redis=require(_0xfbfc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfbfc('0x5'));var logger=require(_0xfbfc('0x6'))(_0xfbfc('0x7'));var config=require('../../config/environment');var jayson=require(_0xfbfc('0x8'));var client=jayson[_0xfbfc('0x9')]['http']({'port':0x232a});config[_0xfbfc('0xa')]=_['defaults'](config['redis'],{'host':_0xfbfc('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfbfc('0xa')]));require(_0xfbfc('0xc'))[_0xfbfc('0xd')](socket);function respondWithRpcPromise(_0x2b7577,_0x363a7d,_0x4daf7c){return new BPromise(function(_0x41b79c,_0x320625){return client['request'](_0x2b7577,_0x4daf7c)[_0xfbfc('0xe')](function(_0x1660d0){logger[_0xfbfc('0xf')](_0xfbfc('0x10'),_0x363a7d,_0xfbfc('0x11'));logger[_0xfbfc('0x12')](_0xfbfc('0x13'),_0x363a7d,_0xfbfc('0x11'),JSON[_0xfbfc('0x14')](_0x1660d0));if(_0x1660d0[_0xfbfc('0x15')]){if(_0x1660d0['error']['code']===0x1f4){logger['error'](_0xfbfc('0x10'),_0x363a7d,_0x1660d0[_0xfbfc('0x15')][_0xfbfc('0x16')]);return _0x320625(_0x1660d0['error'][_0xfbfc('0x16')]);}logger[_0xfbfc('0x15')](_0xfbfc('0x10'),_0x363a7d,_0x1660d0[_0xfbfc('0x15')][_0xfbfc('0x16')]);return _0x41b79c(_0x1660d0['error'][_0xfbfc('0x16')]);}else{logger[_0xfbfc('0xf')](_0xfbfc('0x10'),_0x363a7d,_0xfbfc('0x11'));_0x41b79c(_0x1660d0['result'][_0xfbfc('0x16')]);}})[_0xfbfc('0x17')](function(_0xde370e){logger[_0xfbfc('0x15')](_0xfbfc('0x10'),_0x363a7d,_0xde370e);_0x320625(_0xde370e);});});} \ No newline at end of file +var _0x508e=['request\x20sent','error','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./userNotification.socket','register','request','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s'];(function(_0x1839fa,_0x2d18ba){var _0x599af0=function(_0x4b1afe){while(--_0x4b1afe){_0x1839fa['push'](_0x1839fa['shift']());}};_0x599af0(++_0x2d18ba);}(_0x508e,0xa1));var _0xe508=function(_0x15d76d,_0x40f4b1){_0x15d76d=_0x15d76d-0x0;var _0x66ae2c=_0x508e[_0x15d76d];return _0x66ae2c;};'use strict';var _=require(_0xe508('0x0'));var util=require(_0xe508('0x1'));var moment=require('moment');var BPromise=require(_0xe508('0x2'));var rs=require(_0xe508('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe508('0x4'))['db'];var utils=require(_0xe508('0x5'));var logger=require(_0xe508('0x6'))(_0xe508('0x7'));var config=require(_0xe508('0x8'));var jayson=require(_0xe508('0x9'));var client=jayson['client'][_0xe508('0xa')]({'port':0x232a});config[_0xe508('0xb')]=_[_0xe508('0xc')](config[_0xe508('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xe508('0xd'))(new Redis(config[_0xe508('0xb')]));require(_0xe508('0xe'))[_0xe508('0xf')](socket);function respondWithRpcPromise(_0x348acb,_0x4eb4e3,_0x5cfc51){return new BPromise(function(_0x46d073,_0x14c1b2){return client[_0xe508('0x10')](_0x348acb,_0x5cfc51)['then'](function(_0x19d5e5){logger[_0xe508('0x11')](_0xe508('0x12'),_0x4eb4e3,'request\x20sent');logger[_0xe508('0x13')](_0xe508('0x14'),_0x4eb4e3,_0xe508('0x15'),JSON['stringify'](_0x19d5e5));if(_0x19d5e5[_0xe508('0x16')]){if(_0x19d5e5[_0xe508('0x16')]['code']===0x1f4){logger[_0xe508('0x16')]('UserNotification,\x20%s,\x20%s',_0x4eb4e3,_0x19d5e5[_0xe508('0x16')]['message']);return _0x14c1b2(_0x19d5e5[_0xe508('0x16')]['message']);}logger[_0xe508('0x16')](_0xe508('0x12'),_0x4eb4e3,_0x19d5e5[_0xe508('0x16')][_0xe508('0x17')]);return _0x46d073(_0x19d5e5[_0xe508('0x16')][_0xe508('0x17')]);}else{logger['info'](_0xe508('0x12'),_0x4eb4e3,_0xe508('0x15'));_0x46d073(_0x19d5e5[_0xe508('0x18')]['message']);}})[_0xe508('0x19')](function(_0xf771cf){logger[_0xe508('0x16')](_0xe508('0x12'),_0x4eb4e3,_0xf771cf);_0x14c1b2(_0xf771cf);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 12a48b7..bb67590 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 _0x708c=['length','userNotification:','./userNotification.events','save','remove','update','emit'];(function(_0x44fce0,_0x92278a){var _0x5c1498=function(_0x2a42b6){while(--_0x2a42b6){_0x44fce0['push'](_0x44fce0['shift']());}};_0x5c1498(++_0x92278a);}(_0x708c,0xe9));var _0xc708=function(_0x364d91,_0x2ff4fa){_0x364d91=_0x364d91-0x0;var _0x432f36=_0x708c[_0x364d91];return _0x432f36;};'use strict';var UserNotificationEvents=require(_0xc708('0x0'));var events=[_0xc708('0x1'),_0xc708('0x2'),_0xc708('0x3')];function createListener(_0x2edca8,_0x13e622){return function(_0x474075){_0x13e622[_0xc708('0x4')](_0x2edca8,_0x474075);};}function removeListener(_0x1e10ce,_0x3c5d1b){return function(){UserNotificationEvents['removeListener'](_0x1e10ce,_0x3c5d1b);};}exports['register']=function(_0x578751){for(var _0x35869a=0x0,_0x3f68d9=events[_0xc708('0x5')];_0x35869a<_0x3f68d9;_0x35869a++){var _0x5ad6e8=events[_0x35869a];var _0xbd494a=createListener(_0xc708('0x6')+_0x5ad6e8,_0x578751);UserNotificationEvents['on'](_0x5ad6e8,_0xbd494a);}}; \ No newline at end of file +var _0x62f4=['save','update','emit','removeListener','register','length','userNotification:'];(function(_0x2491d0,_0x2761bf){var _0xf6e792=function(_0x1ad47c){while(--_0x1ad47c){_0x2491d0['push'](_0x2491d0['shift']());}};_0xf6e792(++_0x2761bf);}(_0x62f4,0x1ce));var _0x462f=function(_0x9148af,_0x2f3ed2){_0x9148af=_0x9148af-0x0;var _0x232d8f=_0x62f4[_0x9148af];return _0x232d8f;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x462f('0x0'),'remove',_0x462f('0x1')];function createListener(_0x2a8e2d,_0x379138){return function(_0x1b4148){_0x379138[_0x462f('0x2')](_0x2a8e2d,_0x1b4148);};}function removeListener(_0x519fc9,_0x97db0f){return function(){UserNotificationEvents[_0x462f('0x3')](_0x519fc9,_0x97db0f);};}exports[_0x462f('0x4')]=function(_0x43bfc7){for(var _0x22c785=0x0,_0x346b7c=events[_0x462f('0x5')];_0x22c785<_0x346b7c;_0x22c785++){var _0x117222=events[_0x22c785];var _0x4be82d=createListener(_0x462f('0x6')+_0x117222,_0x43bfc7);UserNotificationEvents['on'](_0x117222,_0x4be82d);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 119c58e..8bf50d2 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5aca71,_0x583dfa){var _0x375f79=function(_0x3b2d5e){while(--_0x3b2d5e){_0x5aca71['push'](_0x5aca71['shift']());}};_0x375f79(++_0x583dfa);}(_0x9c44,0x178));var _0x49c4=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9c44[_0x17b6e3];return _0x3906f3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x59178c,_0x71d374){var _0x3d30f3=function(_0x5b68a8){while(--_0x5b68a8){_0x59178c['push'](_0x59178c['shift']());}};_0x3d30f3(++_0x71d374);}(_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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 41d01e5..16b7814 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 _0xb56a=['INTEGER','exports'];(function(_0x1e8be5,_0x3fa4b0){var _0x1627c0=function(_0x32bc40){while(--_0x32bc40){_0x1e8be5['push'](_0x1e8be5['shift']());}};_0x1627c0(++_0x3fa4b0);}(_0xb56a,0xab));var _0xab56=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0xb56a[_0x12f688];return _0x59c3de;};'use strict';var Sequelize=require('sequelize');module[_0xab56('0x0')]={'penalty':{'type':Sequelize[_0xab56('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5386=['sequelize','exports','INTEGER'];(function(_0x2039e3,_0x590584){var _0x3c31a3=function(_0x236adc){while(--_0x236adc){_0x2039e3['push'](_0x2039e3['shift']());}};_0x3c31a3(++_0x590584);}(_0x5386,0x1b6));var _0x6538=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x5386[_0xf71120];return _0xbe2fd3;};'use strict';var Sequelize=require(_0x6538('0x0'));module[_0x6538('0x1')]={'penalty':{'type':Sequelize[_0x6538('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 2dcaa2d..ae928b8 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 _0x598e=['rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x548514,_0x517190){var _0x1aa7b9=function(_0x292fde){while(--_0x292fde){_0x548514['push'](_0x548514['shift']());}};_0x1aa7b9(++_0x517190);}(_0x598e,0xd6));var _0xe598=function(_0x47eedd,_0x45ba0a){_0x47eedd=_0x47eedd-0x0;var _0x522ed4=_0x598e[_0x47eedd];return _0x522ed4;};'use strict';var _=require('lodash');var util=require(_0xe598('0x0'));var logger=require(_0xe598('0x1'))('api');var moment=require(_0xe598('0x2'));var BPromise=require(_0xe598('0x3'));var rp=require(_0xe598('0x4'));var fs=require('fs');var path=require(_0xe598('0x5'));var rimraf=require(_0xe598('0x6'));var config=require(_0xe598('0x7'));var attributes=require(_0xe598('0x8'));module[_0xe598('0x9')]=function(_0x2b0fe2,_0x43ada4){return _0x2b0fe2[_0xe598('0xa')]('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6caf=['api','moment','bluebird','request-promise','path','rimraf','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger'];(function(_0x48e86c,_0x9f034d){var _0x54fa11=function(_0x199705){while(--_0x199705){_0x48e86c['push'](_0x48e86c['shift']());}};_0x54fa11(++_0x9f034d);}(_0x6caf,0x169));var _0xf6ca=function(_0xfb0281,_0x3ff38b){_0xfb0281=_0xfb0281-0x0;var _0x408dd3=_0x6caf[_0xfb0281];return _0x408dd3;};'use strict';var _=require(_0xf6ca('0x0'));var util=require(_0xf6ca('0x1'));var logger=require(_0xf6ca('0x2'))(_0xf6ca('0x3'));var moment=require(_0xf6ca('0x4'));var BPromise=require(_0xf6ca('0x5'));var rp=require(_0xf6ca('0x6'));var fs=require('fs');var path=require(_0xf6ca('0x7'));var rimraf=require(_0xf6ca('0x8'));var config=require('../../config/environment');var attributes=require('./userOpenchannelQueue.attributes');module[_0xf6ca('0x9')]=function(_0x2e8435,_0x4b1f1b){return _0x2e8435[_0xf6ca('0xa')](_0xf6ca('0xb'),attributes,{'tableName':_0xf6ca('0xc'),'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 77ee006..e12518c 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 _0x3120=['client','http','request','then','info','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UserOpenchannelQueue,\x20%s,\x20%s','lodash','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x48e645,_0x53cc57){var _0x2902f5=function(_0x2c3d4c){while(--_0x2c3d4c){_0x48e645['push'](_0x48e645['shift']());}};_0x2902f5(++_0x53cc57);}(_0x3120,0x92));var _0x0312=function(_0xa87484,_0x3fa98d){_0xa87484=_0xa87484-0x0;var _0x1b31b9=_0x3120[_0xa87484];return _0x1b31b9;};'use strict';var _=require(_0x0312('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0312('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x0312('0x2'));var logger=require(_0x0312('0x3'))('rpc');var config=require(_0x0312('0x4'));var jayson=require(_0x0312('0x5'));var client=jayson[_0x0312('0x6')][_0x0312('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x464eae,_0x332da7,_0x35ba36){return new BPromise(function(_0x3ff632,_0x2eea60){return client[_0x0312('0x8')](_0x464eae,_0x35ba36)[_0x0312('0x9')](function(_0x1f10c0){logger[_0x0312('0xa')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x332da7,_0x0312('0xb'));logger[_0x0312('0xc')](_0x0312('0xd'),_0x332da7,_0x0312('0xb'),JSON[_0x0312('0xe')](_0x1f10c0));if(_0x1f10c0[_0x0312('0xf')]){if(_0x1f10c0[_0x0312('0xf')]['code']===0x1f4){logger[_0x0312('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x332da7,_0x1f10c0[_0x0312('0xf')][_0x0312('0x10')]);return _0x2eea60(_0x1f10c0[_0x0312('0xf')]['message']);}logger[_0x0312('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x332da7,_0x1f10c0[_0x0312('0xf')][_0x0312('0x10')]);return _0x3ff632(_0x1f10c0[_0x0312('0xf')][_0x0312('0x10')]);}else{logger[_0x0312('0xa')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x332da7,_0x0312('0xb'));_0x3ff632(_0x1f10c0[_0x0312('0x11')][_0x0312('0x10')]);}})['catch'](function(_0x38434f){logger['error'](_0x0312('0x12'),_0x332da7,_0x38434f);_0x2eea60(_0x38434f);});});} \ No newline at end of file +var _0x16bd=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','then','info','request\x20sent','debug','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch'];(function(_0x8b8564,_0x162976){var _0x360c61=function(_0x164cc9){while(--_0x164cc9){_0x8b8564['push'](_0x8b8564['shift']());}};_0x360c61(++_0x162976);}(_0x16bd,0x12c));var _0xd16b=function(_0x1f5143,_0x5e31e6){_0x1f5143=_0x1f5143-0x0;var _0x383a38=_0x16bd[_0x1f5143];return _0x383a38;};'use strict';var _=require(_0xd16b('0x0'));var util=require(_0xd16b('0x1'));var moment=require(_0xd16b('0x2'));var BPromise=require(_0xd16b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd16b('0x4'))['db'];var utils=require(_0xd16b('0x5'));var logger=require(_0xd16b('0x6'))('rpc');var config=require(_0xd16b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x290e58,_0x4ef143,_0x5ae124){return new BPromise(function(_0xbbee0a,_0x2cf209){return client[_0xd16b('0x8')](_0x290e58,_0x5ae124)[_0xd16b('0x9')](function(_0xd75e57){logger[_0xd16b('0xa')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4ef143,_0xd16b('0xb'));logger[_0xd16b('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x4ef143,_0xd16b('0xb'),JSON[_0xd16b('0xd')](_0xd75e57));if(_0xd75e57[_0xd16b('0xe')]){if(_0xd75e57['error'][_0xd16b('0xf')]===0x1f4){logger[_0xd16b('0xe')](_0xd16b('0x10'),_0x4ef143,_0xd75e57[_0xd16b('0xe')][_0xd16b('0x11')]);return _0x2cf209(_0xd75e57[_0xd16b('0xe')]['message']);}logger[_0xd16b('0xe')](_0xd16b('0x10'),_0x4ef143,_0xd75e57[_0xd16b('0xe')][_0xd16b('0x11')]);return _0xbbee0a(_0xd75e57[_0xd16b('0xe')][_0xd16b('0x11')]);}else{logger[_0xd16b('0xa')](_0xd16b('0x10'),_0x4ef143,_0xd16b('0xb'));_0xbbee0a(_0xd75e57[_0xd16b('0x12')][_0xd16b('0x11')]);}})[_0xd16b('0x13')](function(_0x3713da){logger['error'](_0xd16b('0x10'),_0x4ef143,_0x3713da);_0x2cf209(_0x3713da);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index e168f5a..f695eb9 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 _0x29c9=['destroy','removeSections','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/sections','/:id/resources','getResources','create','/:id/clone','clone','post','update','delete'];(function(_0x57dbce,_0x2a4604){var _0x2ab396=function(_0x321f80){while(--_0x321f80){_0x57dbce['push'](_0x57dbce['shift']());}};_0x2ab396(++_0x2a4604);}(_0x29c9,0x85));var _0x929c=function(_0x2ef53e,_0x502c7b){_0x2ef53e=_0x2ef53e-0x0;var _0x533af6=_0x29c9[_0x2ef53e];return _0x533af6;};'use strict';var multer=require(_0x929c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x929c('0x1'));var express=require(_0x929c('0x2'));var router=express[_0x929c('0x3')]();var fs_extra=require(_0x929c('0x4'));var auth=require(_0x929c('0x5'));var interaction=require(_0x929c('0x6'));var config=require('../../config/environment');var controller=require(_0x929c('0x7'));router[_0x929c('0x8')]('/',auth['isAuthenticated'](),controller[_0x929c('0x9')]);router['get'](_0x929c('0xa'),auth[_0x929c('0xb')](),controller['describe']);router['get'](_0x929c('0xc'),auth['isAuthenticated'](),controller[_0x929c('0xd')]);router[_0x929c('0x8')](_0x929c('0xe'),auth[_0x929c('0xb')](),controller['getSections']);router[_0x929c('0x8')](_0x929c('0xf'),auth[_0x929c('0xb')](),controller[_0x929c('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x929c('0x11')]);router['post'](_0x929c('0x12'),auth[_0x929c('0xb')](),controller[_0x929c('0x13')]);router[_0x929c('0x14')](_0x929c('0xe'),auth[_0x929c('0xb')](),controller['addSections']);router[_0x929c('0x14')](_0x929c('0xf'),auth[_0x929c('0xb')](),controller['addResources']);router['put'](_0x929c('0xc'),auth[_0x929c('0xb')](),controller[_0x929c('0x15')]);router[_0x929c('0x16')](_0x929c('0xc'),auth[_0x929c('0xb')](),controller[_0x929c('0x17')]);router[_0x929c('0x16')](_0x929c('0xe'),auth[_0x929c('0xb')](),controller[_0x929c('0x18')]);router['delete'](_0x929c('0xf'),auth['isAuthenticated'](),controller['removeResources']);module[_0x929c('0x19')]=router; \ No newline at end of file +var _0xffaa=['isAuthenticated','index','/describe','describe','/:id','show','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','put','update','delete','destroy','/:id/sections','removeSections','removeResources','exports','util','path','connect-timeout','Router','../../components/interaction/service','get'];(function(_0x57db49,_0x288094){var _0xd0636f=function(_0x227787){while(--_0x227787){_0x57db49['push'](_0x57db49['shift']());}};_0xd0636f(++_0x288094);}(_0xffaa,0x6a));var _0xaffa=function(_0x2847a1,_0x382392){_0x2847a1=_0x2847a1-0x0;var _0x2e465f=_0xffaa[_0x2847a1];return _0x2e465f;};'use strict';var multer=require('multer');var util=require(_0xaffa('0x0'));var path=require(_0xaffa('0x1'));var timeout=require(_0xaffa('0x2'));var express=require('express');var router=express[_0xaffa('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaffa('0x4'));var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0xaffa('0x5')]('/',auth[_0xaffa('0x6')](),controller[_0xaffa('0x7')]);router[_0xaffa('0x5')](_0xaffa('0x8'),auth[_0xaffa('0x6')](),controller[_0xaffa('0x9')]);router['get'](_0xaffa('0xa'),auth[_0xaffa('0x6')](),controller[_0xaffa('0xb')]);router[_0xaffa('0x5')]('/:id/sections',auth[_0xaffa('0x6')](),controller[_0xaffa('0xc')]);router[_0xaffa('0x5')](_0xaffa('0xd'),auth['isAuthenticated'](),controller[_0xaffa('0xe')]);router[_0xaffa('0xf')]('/',auth[_0xaffa('0x6')](),controller[_0xaffa('0x10')]);router['post'](_0xaffa('0x11'),auth[_0xaffa('0x6')](),controller[_0xaffa('0x12')]);router['post']('/:id/sections',auth[_0xaffa('0x6')](),controller[_0xaffa('0x13')]);router['post'](_0xaffa('0xd'),auth[_0xaffa('0x6')](),controller['addResources']);router[_0xaffa('0x14')](_0xaffa('0xa'),auth[_0xaffa('0x6')](),controller[_0xaffa('0x15')]);router[_0xaffa('0x16')](_0xaffa('0xa'),auth['isAuthenticated'](),controller[_0xaffa('0x17')]);router[_0xaffa('0x16')](_0xaffa('0x18'),auth[_0xaffa('0x6')](),controller[_0xaffa('0x19')]);router[_0xaffa('0x16')](_0xaffa('0xd'),auth[_0xaffa('0x6')](),controller[_0xaffa('0x1a')]);module[_0xaffa('0x1b')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 9c628d4..7c3fa7b 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 _0x4f59=['sequelize','STRING','join','getDataValue','crudPermissions','split','BOOLEAN'];(function(_0x103513,_0x3370dd){var _0x44b4d4=function(_0x222ecb){while(--_0x222ecb){_0x103513['push'](_0x103513['shift']());}};_0x44b4d4(++_0x3370dd);}(_0x4f59,0xd2));var _0x94f5=function(_0x474c66,_0xbce925){_0x474c66=_0x474c66-0x0;var _0xcbd9bf=_0x4f59[_0x474c66];return _0xcbd9bf;};'use strict';var Sequelize=require(_0x94f5('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x94f5('0x1')],'set':function(_0x222263){this['setDataValue']('crudPermissions',_0x222263?_0x222263[_0x94f5('0x2')](''):[]);},'get':function(){return this[_0x94f5('0x3')](_0x94f5('0x4'))?this[_0x94f5('0x3')]('crudPermissions')[_0x94f5('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x94f5('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x94f5('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x94f5('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x94f5('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x94f5('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x94f5('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x94f5('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x16bf=['sequelize','exports','STRING','crudPermissions','join','getDataValue','split','BOOLEAN'];(function(_0x4d92b0,_0x5a7e75){var _0x52cb86=function(_0x25d8a4){while(--_0x25d8a4){_0x4d92b0['push'](_0x4d92b0['shift']());}};_0x52cb86(++_0x5a7e75);}(_0x16bf,0x130));var _0xf16b=function(_0x36261e,_0x82924a){_0x36261e=_0x36261e-0x0;var _0x3496e6=_0x16bf[_0x36261e];return _0x3496e6;};'use strict';var Sequelize=require(_0xf16b('0x0'));module[_0xf16b('0x1')]={'name':{'type':Sequelize[_0xf16b('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0xa74bef){this['setDataValue'](_0xf16b('0x3'),_0xa74bef?_0xa74bef[_0xf16b('0x4')](''):[]);},'get':function(){return this[_0xf16b('0x5')](_0xf16b('0x3'))?this[_0xf16b('0x5')](_0xf16b('0x3'))[_0xf16b('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xf16b('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xf16b('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xf16b('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xf16b('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xf16b('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xf16b('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 7883cb3..7757474 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 _0x7520=['fs-extra','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userProfile.socket','register','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','destroy','then','sendStatus','stack','name','send','index','map','UserProfile','fieldName','type','key','model','keys','filters','intersection','query','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','params','fields','find','create','clone','get','updatedAt','crudPermissions','body','omit','createdAt','sequelize','transaction','each','UserProfileResource','findAll','sectionId','Resources','UserProfileSection','describe','userProfileId','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','concat','push','autoAssociation','findOne','Dashboard','forEach','addResources','bulkCreate','removeResources','getResources','section','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs'];(function(_0x11664b,_0x549e6b){var _0x1bd6ee=function(_0x365b04){while(--_0x365b04){_0x11664b['push'](_0x11664b['shift']());}};_0x1bd6ee(++_0x549e6b);}(_0x7520,0x67));var _0x0752=function(_0x3ba8a3,_0x1e575c){_0x3ba8a3=_0x3ba8a3-0x0;var _0x2de759=_0x7520[_0x3ba8a3];return _0x2de759;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0752('0x0'));var zipdir=require(_0x0752('0x1'));var jsonpatch=require(_0x0752('0x2'));var rp=require(_0x0752('0x3'));var moment=require(_0x0752('0x4'));var BPromise=require(_0x0752('0x5'));var Mustache=require(_0x0752('0x6'));var util=require('util');var path=require(_0x0752('0x7'));var sox=require(_0x0752('0x8'));var csv=require(_0x0752('0x9'));var ejs=require(_0x0752('0xa'));var fs=require('fs');var fs_extra=require(_0x0752('0xb'));var _=require('lodash');var squel=require(_0x0752('0xc'));var crypto=require('crypto');var jsforce=require(_0x0752('0xd'));var deskjs=require(_0x0752('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0752('0xf'));var authService=require(_0x0752('0x10'));var qs=require(_0x0752('0x11'));var as=require(_0x0752('0x12'));var hardwareService=require(_0x0752('0x13'));var logger=require(_0x0752('0x14'))(_0x0752('0x15'));var utils=require('../../config/utils');var config=require(_0x0752('0x16'));var licenseUtil=require(_0x0752('0x17'));var db=require(_0x0752('0x18'))['db'];config[_0x0752('0x19')]=_[_0x0752('0x1a')](config[_0x0752('0x19')],{'host':_0x0752('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0752('0x19')]));require(_0x0752('0x1c'))[_0x0752('0x1d')](socket);function respondWithStatusCode(_0x8e1798,_0x177fbd){_0x177fbd=_0x177fbd||0xcc;return function(_0x3496d6){if(_0x3496d6){return _0x8e1798['sendStatus'](_0x177fbd);}return _0x8e1798[_0x0752('0x1e')](_0x177fbd)[_0x0752('0x1f')]();};}function respondWithResult(_0x5b56cc,_0x6080df){_0x6080df=_0x6080df||0xc8;return function(_0x98af7d){if(_0x98af7d){return _0x5b56cc[_0x0752('0x1e')](_0x6080df)[_0x0752('0x20')](_0x98af7d);}};}function respondWithFilteredResult(_0x237494,_0x4d0cc5){return function(_0x597e75){if(_0x597e75){var _0x32dd6c=typeof _0x4d0cc5['offset']===_0x0752('0x21')&&typeof _0x4d0cc5[_0x0752('0x22')]===_0x0752('0x21');var _0x30660e=_0x597e75[_0x0752('0x23')];var _0x3ad120=_0x32dd6c?0x0:_0x4d0cc5[_0x0752('0x24')];var _0x4c8c34=_0x32dd6c?_0x597e75['count']:_0x4d0cc5['offset']+_0x4d0cc5['limit'];var _0x5e38e5;if(_0x4c8c34>=_0x30660e){_0x4c8c34=_0x30660e;_0x5e38e5=0xc8;}else{_0x5e38e5=0xce;}_0x237494[_0x0752('0x1e')](_0x5e38e5);return _0x237494['set'](_0x0752('0x25'),_0x3ad120+'-'+_0x4c8c34+'/'+_0x30660e)[_0x0752('0x20')](_0x597e75);}return null;};}function patchUpdates(_0x31bc72){return function(_0x1ff069){try{jsonpatch[_0x0752('0x26')](_0x1ff069,_0x31bc72,!![]);}catch(_0x6d776a){return BPromise[_0x0752('0x27')](_0x6d776a);}return _0x1ff069['save']();};}function saveUpdates(_0x2c664c,_0xaafddc){return function(_0x58dfec){if(_0x58dfec){return _0x58dfec[_0x0752('0x28')](_0x2c664c)['then'](function(_0x4fa5b4){return _0x4fa5b4;});}return null;};}function removeEntity(_0x1d9905,_0x45d6d2){return function(_0xc8ecd7){if(_0xc8ecd7){return _0xc8ecd7[_0x0752('0x29')]()[_0x0752('0x2a')](function(){_0x1d9905['status'](0xcc)[_0x0752('0x1f')]();});}};}function handleEntityNotFound(_0x60f884,_0x2b8c38){return function(_0x1934ba){if(!_0x1934ba){_0x60f884[_0x0752('0x2b')](0x194);}return _0x1934ba;};}function handleError(_0x58f166,_0x1c7066){_0x1c7066=_0x1c7066||0x1f4;return function(_0x1aa6bd){logger['error'](_0x1aa6bd[_0x0752('0x2c')]);if(_0x1aa6bd[_0x0752('0x2d')]){delete _0x1aa6bd['name'];}_0x58f166[_0x0752('0x1e')](_0x1c7066)[_0x0752('0x2e')](_0x1aa6bd);};}exports[_0x0752('0x2f')]=function(_0x3ba309,_0x5d3f25){var _0x1b3837={},_0x3578a4={},_0x9cdd68={'count':0x0,'rows':[]};var _0x326bf6=_[_0x0752('0x30')](db[_0x0752('0x31')]['rawAttributes'],function(_0x34adaf){return{'name':_0x34adaf[_0x0752('0x32')],'type':_0x34adaf[_0x0752('0x33')][_0x0752('0x34')]};});_0x3578a4[_0x0752('0x35')]=_['map'](_0x326bf6,'name');_0x3578a4['query']=_[_0x0752('0x36')](_0x3ba309['query']);_0x3578a4[_0x0752('0x37')]=_[_0x0752('0x38')](_0x3578a4['model'],_0x3578a4[_0x0752('0x39')]);_0x1b3837[_0x0752('0x3a')]=_[_0x0752('0x38')](_0x3578a4[_0x0752('0x35')],qs['fields'](_0x3ba309[_0x0752('0x39')]['fields']));_0x1b3837[_0x0752('0x3a')]=_0x1b3837[_0x0752('0x3a')][_0x0752('0x3b')]?_0x1b3837['attributes']:_0x3578a4['model'];if(!_0x3ba309['query'][_0x0752('0x3c')]('nolimit')){_0x1b3837['limit']=qs[_0x0752('0x22')](_0x3ba309['query'][_0x0752('0x22')]);_0x1b3837[_0x0752('0x24')]=qs[_0x0752('0x24')](_0x3ba309['query']['offset']);}_0x1b3837[_0x0752('0x3d')]=qs[_0x0752('0x3e')](_0x3ba309[_0x0752('0x39')]['sort']);_0x1b3837[_0x0752('0x3f')]=qs[_0x0752('0x37')](_[_0x0752('0x40')](_0x3ba309[_0x0752('0x39')],_0x3578a4[_0x0752('0x37')]),_0x326bf6);if(_0x3ba309['query'][_0x0752('0x41')]){_0x1b3837[_0x0752('0x3f')]=_['merge'](_0x1b3837[_0x0752('0x3f')],{'$or':_[_0x0752('0x30')](_0x326bf6,function(_0x58d778){if(_0x58d778[_0x0752('0x33')]!==_0x0752('0x42')){var _0x24f383={};_0x24f383[_0x58d778['name']]={'$like':'%'+_0x3ba309[_0x0752('0x39')]['filter']+'%'};return _0x24f383;}})});}_0x1b3837=_[_0x0752('0x43')]({},_0x1b3837,_0x3ba309[_0x0752('0x44')]);var _0x41dedf={'where':_0x1b3837[_0x0752('0x3f')]};return db[_0x0752('0x31')][_0x0752('0x23')](_0x41dedf)[_0x0752('0x2a')](function(_0x55fcf4){_0x9cdd68['count']=_0x55fcf4;if(_0x3ba309[_0x0752('0x39')][_0x0752('0x45')]){_0x1b3837[_0x0752('0x46')]=[{'all':!![]}];}return db[_0x0752('0x31')]['findAll'](_0x1b3837);})[_0x0752('0x2a')](function(_0x4ec01e){_0x9cdd68[_0x0752('0x47')]=_0x4ec01e;return _0x9cdd68;})[_0x0752('0x2a')](respondWithFilteredResult(_0x5d3f25,_0x1b3837))[_0x0752('0x48')](handleError(_0x5d3f25,null));};exports['show']=function(_0x25a710,_0x3fc3e1){var _0x48a8bb={'raw':![],'where':{'id':_0x25a710[_0x0752('0x49')]['id']}},_0x2ab97a={};_0x2ab97a[_0x0752('0x35')]=_['keys'](db['UserProfile']['rawAttributes']);_0x2ab97a[_0x0752('0x39')]=_['keys'](_0x25a710['query']);_0x2ab97a[_0x0752('0x37')]=_[_0x0752('0x38')](_0x2ab97a[_0x0752('0x35')],_0x2ab97a[_0x0752('0x39')]);_0x48a8bb[_0x0752('0x3a')]=_[_0x0752('0x38')](_0x2ab97a[_0x0752('0x35')],qs[_0x0752('0x4a')](_0x25a710[_0x0752('0x39')]['fields']));_0x48a8bb['attributes']=_0x48a8bb[_0x0752('0x3a')][_0x0752('0x3b')]?_0x48a8bb[_0x0752('0x3a')]:_0x2ab97a[_0x0752('0x35')];if(_0x25a710['query'][_0x0752('0x45')]){_0x48a8bb[_0x0752('0x46')]=[{'all':!![]}];}_0x48a8bb=_[_0x0752('0x43')]({},_0x48a8bb,_0x25a710['options']);return db[_0x0752('0x31')][_0x0752('0x4b')](_0x48a8bb)[_0x0752('0x2a')](handleEntityNotFound(_0x3fc3e1,null))[_0x0752('0x2a')](respondWithResult(_0x3fc3e1,null))[_0x0752('0x48')](handleError(_0x3fc3e1,null));};exports[_0x0752('0x4c')]=function(_0x3fef04,_0x38b06b){return db[_0x0752('0x31')][_0x0752('0x4c')](_0x3fef04['body'],{})['then'](respondWithResult(_0x38b06b,0xc9))['catch'](handleError(_0x38b06b,null));};exports[_0x0752('0x4d')]=function(_0x6ae782,_0x63d9bc){var _0x2fb0df={'where':{'id':_0x6ae782[_0x0752('0x49')]['id']}},_0x28d55c={};_0x28d55c[_0x0752('0x35')]=_[_0x0752('0x36')](db[_0x0752('0x31')]['rawAttributes']);_0x2fb0df[_0x0752('0x3a')]=_[_0x0752('0x38')](_0x28d55c['model'],qs[_0x0752('0x4a')](_0x6ae782['query'][_0x0752('0x4a')]));_0x2fb0df[_0x0752('0x3a')]=_0x2fb0df[_0x0752('0x3a')][_0x0752('0x3b')]?_0x2fb0df[_0x0752('0x3a')]:_0x28d55c[_0x0752('0x35')];if(_0x6ae782[_0x0752('0x39')][_0x0752('0x45')]){_0x2fb0df[_0x0752('0x46')]=[{'all':!![]}];}_0x2fb0df=_[_0x0752('0x43')]({},_0x2fb0df,_0x6ae782['options']);return db[_0x0752('0x31')][_0x0752('0x4b')](_0x2fb0df)[_0x0752('0x2a')](handleEntityNotFound(_0x63d9bc,null))[_0x0752('0x2a')](function(_0x5051bc){if(_0x5051bc){var _0x26c9ca=_0x5051bc[_0x0752('0x4e')]({'plain':!![]});_0x26c9ca=qs['omit'](_0x26c9ca,['id','createdAt',_0x0752('0x4f'),_0x0752('0x50')]);_0x6ae782[_0x0752('0x51')]=_[_0x0752('0x52')](_0x6ae782[_0x0752('0x51')],['id',_0x0752('0x53'),_0x0752('0x4f')]);return db[_0x0752('0x54')][_0x0752('0x55')](function(_0x30b48a){return db[_0x0752('0x31')]['create'](_[_0x0752('0x43')](_0x26c9ca,_0x6ae782[_0x0752('0x51')]),{'include':_0x6ae782[_0x0752('0x39')][_0x0752('0x45')]?[{'all':!![]}]:undefined,'transaction':_0x30b48a})[_0x0752('0x2a')](function(_0x323db9){var _0x3fb568=_0x323db9[_0x0752('0x4e')]({'plain':!![]});return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x6ae782[_0x0752('0x49')]['id']},'raw':!![]})['then'](function(_0x4a206f){if(_0x4a206f){return BPromise[_0x0752('0x56')](_0x4a206f,function(_0x1d23d4){return new BPromise(function(_0x403c56,_0x194283){if(_0x1d23d4['autoAssociation']===null||_0x1d23d4['autoAssociation']===0x1)_0x403c56(null);return db[_0x0752('0x57')][_0x0752('0x58')]({'where':{'sectionId':_0x1d23d4['id']},'raw':!![]})[_0x0752('0x2a')](function(_0x100da1){var _0x46422b=_['map'](_0x100da1,function(_0x26c30c){return qs[_0x0752('0x52')](_0x26c30c,['id',_0x0752('0x53'),_0x0752('0x4f'),_0x0752('0x59')]);});_0x403c56(_0x46422b);})[_0x0752('0x48')](function(_0x3b7a6f){_0x194283(_0x3b7a6f);});})[_0x0752('0x2a')](function(_0x1de6ed){var _0x1333d4=qs[_0x0752('0x52')](_0x1d23d4,['id','createdAt',_0x0752('0x4f')]);_0x1333d4['userProfileId']=_0x3fb568['id'];if(_0x1de6ed)_0x1333d4[_0x0752('0x5a')]=_0x1de6ed;return _0x1333d4;})[_0x0752('0x2a')](function(_0x13fc71){return db[_0x0752('0x5b')][_0x0752('0x4c')](_0x13fc71,{'include':[{'model':db['UserProfileResource'],'as':_0x0752('0x5a')}],'raw':!![],'transaction':_0x30b48a});});})[_0x0752('0x2a')](function(){return _0x3fb568;});}});});});}})['then'](respondWithResult(_0x63d9bc,0xc9))[_0x0752('0x48')](handleError(_0x63d9bc,null));};exports['update']=function(_0x2074c3,_0x54878a){if(_0x2074c3[_0x0752('0x51')]['id']){delete _0x2074c3[_0x0752('0x51')]['id'];}return db[_0x0752('0x31')][_0x0752('0x4b')]({'where':{'id':_0x2074c3[_0x0752('0x49')]['id']}})[_0x0752('0x2a')](handleEntityNotFound(_0x54878a,null))[_0x0752('0x2a')](saveUpdates(_0x2074c3[_0x0752('0x51')],null))[_0x0752('0x2a')](respondWithResult(_0x54878a,null))[_0x0752('0x48')](handleError(_0x54878a,null));};exports[_0x0752('0x29')]=function(_0x54c633,_0xa751b3){return db[_0x0752('0x31')][_0x0752('0x4b')]({'where':{'id':_0x54c633[_0x0752('0x49')]['id']}})[_0x0752('0x2a')](handleEntityNotFound(_0xa751b3,null))[_0x0752('0x2a')](removeEntity(_0xa751b3,null))[_0x0752('0x48')](handleError(_0xa751b3,null));};exports[_0x0752('0x5c')]=function(_0x2b9e70,_0x549123){return db[_0x0752('0x31')][_0x0752('0x5c')]()[_0x0752('0x2a')](respondWithResult(_0x549123,null))[_0x0752('0x48')](handleError(_0x549123,null));};exports['addSections']=function(_0x2b5e0a,_0x4d8cf4){var _0x4fdeb5=_0x2b5e0a[_0x0752('0x51')];return db['UserProfile'][_0x0752('0x4b')]({'where':{'id':_0x2b5e0a['params']['id']}})[_0x0752('0x2a')](handleEntityNotFound(_0x4d8cf4,null))[_0x0752('0x2a')](function(_0x102a4d){if(_0x102a4d){return db[_0x0752('0x54')][_0x0752('0x55')](function(_0xc8ef3b){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x2b5e0a['params']['id'],'sectionId':_[_0x0752('0x30')](_0x4fdeb5,function(_0x864617){return _0x864617[_0x0752('0x59')];})},'transaction':_0xc8ef3b})[_0x0752('0x2a')](function(){var _0x2670ab=_['map'](_0x4fdeb5,function(_0x4ae94b){_0x4ae94b[_0x0752('0x5d')]=_0x2b5e0a[_0x0752('0x49')]['id'];return _0x4ae94b;});var _0x48782c=[];return BPromise[_0x0752('0x56')](_0x2670ab,function(_0xe0bb2){return db[_0x0752('0x5b')][_0x0752('0x4c')](_0xe0bb2,{'include':[{'model':db[_0x0752('0x57')],'as':'Resources'}],'raw':!![],'transaction':_0xc8ef3b})[_0x0752('0x2a')](function(_0x28d3bd){_0x48782c['push'](_0x28d3bd[_0x0752('0x4e')]({'plain':!![]}));});})[_0x0752('0x2a')](function(){return _0x48782c;});});});}})[_0x0752('0x2a')](function(_0x2e1527){return _0x2e1527;})[_0x0752('0x2a')](respondWithResult(_0x4d8cf4,null))['catch'](handleError(_0x4d8cf4,null));};exports[_0x0752('0x5e')]=function(_0x256106,_0x684ebe){var _0x24bfa3;return db[_0x0752('0x31')]['find']({'where':{'id':_0x256106[_0x0752('0x49')]['id']},'attributes':['id',_0x0752('0x2d')]})[_0x0752('0x2a')](handleEntityNotFound(_0x684ebe,null))['then'](function(_0x415d8f){if(_0x415d8f){_0x24bfa3=_0x415d8f;return db[_0x0752('0x5b')][_0x0752('0x29')]({'where':{'userProfileId':_0x256106[_0x0752('0x49')]['id'],'sectionId':_0x256106[_0x0752('0x39')][_0x0752('0x5f')]}});}})['then'](function(){return _0x24bfa3;})[_0x0752('0x2a')](respondWithStatusCode(_0x684ebe,null))[_0x0752('0x48')](handleError(_0x684ebe,null));};exports[_0x0752('0x60')]=function(_0x31dd45,_0x349199){var _0x540060=[];var _0x27ddae=[];return db[_0x0752('0x5b')][_0x0752('0x58')]({'where':{'userProfileId':_0x31dd45[_0x0752('0x49')]['id']},'raw':!![]})[_0x0752('0x2a')](function(_0x4592dc){_0x540060=_[_0x0752('0x41')](_0x4592dc,function(_0xea7a2b){return _0xea7a2b[_0x0752('0x61')]===0x1||_['includes']([0x3eb,0x709],_0xea7a2b['sectionId']);});if(!_[_0x0752('0x62')](_0x540060)){return _[_0x0752('0x30')](_0x540060,function(_0x5b8d27){return _0x5b8d27[_0x0752('0x59')];});}else{return;}})[_0x0752('0x2a')](function(_0x5de156){if(_0x5de156)_0x27ddae=_0x5de156;if(_[_0x0752('0x63')](_0x27ddae,0x64)){var _0x5b6bd2=_['find'](_0x540060,{'sectionId':0x64});return hasDefaultDashboard(_0x5b6bd2)['then'](function(_0x1a59d1){return _[_0x0752('0x30')](_0x540060,function(_0x2236c7){if(_0x2236c7[_0x0752('0x59')]===0x64){_0x2236c7[_0x0752('0x64')]=_0x1a59d1;}return _0x2236c7;});});}else{return;}})[_0x0752('0x2a')](function(_0x20372c){if(_0x20372c)_0x540060=_0x20372c;if(_[_0x0752('0x63')](_0x27ddae,0x3eb)){var _0x10dc2a=_[_0x0752('0x4b')](_0x540060,{'sectionId':0x3eb});return getCustomDashboards(_0x10dc2a)[_0x0752('0x2a')](function(_0x2b28f8){return _[_0x0752('0x30')](_0x540060,function(_0x45ad65){if(_0x10dc2a[_0x0752('0x61')]){if(_0x45ad65[_0x0752('0x59')]===0x3eb){_0x45ad65['subsections']=_0x2b28f8;}}else{if(_0x45ad65[_0x0752('0x59')]===0x64){if(!_0x45ad65[_0x0752('0x64')]){_0x45ad65['subsections']=[];}_0x45ad65[_0x0752('0x64')]=_0x45ad65[_0x0752('0x64')][_0x0752('0x65')](_0x2b28f8);}}return _0x45ad65;});});}else{return;}})[_0x0752('0x2a')](function(_0x4b1001){if(_0x4b1001)_0x540060=_0x4b1001;if(_[_0x0752('0x63')](_0x27ddae,0x709)){var _0x2753fd=_[_0x0752('0x4b')](_0x540060,{'sectionId':0x709});return getPlugins(_0x2753fd)[_0x0752('0x2a')](function(_0x10e6f0){if(_0x2753fd[_0x0752('0x61')]){return _[_0x0752('0x30')](_0x540060,function(_0x45055d){if(_0x45055d[_0x0752('0x59')]===0x709){_0x45055d[_0x0752('0x64')]=_0x10e6f0;}return _0x45055d;});}else{var _0x592ab8={'sectionId':0x76c,'enabled':0x1,'subsections':_0x10e6f0};var _0x31dca9=_['map'](_0x540060);_0x31dca9[_0x0752('0x66')](_0x592ab8);return _0x31dca9;}});}else{return;}})[_0x0752('0x2a')](function(_0xc68460){if(_0xc68460)_0x540060=_0xc68460;return _[_0x0752('0x41')](_0x540060,[_0x0752('0x61'),0x1]);})[_0x0752('0x2a')](respondWithResult(_0x349199,null))[_0x0752('0x48')](handleError(_0x349199,null));};function hasDefaultDashboard(_0x514159){var _0x19ceec=[0x65];return new BPromise(function(_0x3e76c8,_0x117743){try{if(_0x514159[_0x0752('0x67')]){_0x3e76c8(_0x19ceec);}else{return db[_0x0752('0x57')][_0x0752('0x68')]({'where':{'sectionId':_0x514159['id']},'raw':!![]})[_0x0752('0x2a')](function(_0x121829){_0x121829?_0x3e76c8(_0x19ceec):_0x3e76c8();});}}catch(_0x1c24f2){_0x117743(_0x1c24f2);}});}function getCustomDashboards(_0x310620){var _0x17e2ed=[];return new BPromise(function(_0x41240e,_0x5c6bb5){try{if(_0x310620[_0x0752('0x67')]){return db[_0x0752('0x69')][_0x0752('0x58')]({'raw':!![]})[_0x0752('0x2a')](function(_0x2d0078){_0x2d0078[_0x0752('0x6a')](function(_0x257cfb){_0x17e2ed[_0x0752('0x66')](_0x257cfb['id']+0x1869f);});_0x41240e(_0x17e2ed);});}else{return db[_0x0752('0x57')]['findAll']({'where':{'sectionId':_0x310620['id']},'raw':!![]})[_0x0752('0x2a')](function(_0x48509b){_0x48509b[_0x0752('0x6a')](function(_0x3c1681){_0x17e2ed[_0x0752('0x66')](_0x3c1681['resourceId']+0x1869f);});_0x41240e(_0x17e2ed);});}}catch(_0x5e8dce){_0x5c6bb5(_0x5e8dce);}});}function getPlugins(_0x36fe5a){var _0x26e977=[];return new BPromise(function(_0x72360,_0x5e855c){try{if(_0x36fe5a[_0x0752('0x67')]){return db['Plugin'][_0x0752('0x58')]({'raw':!![]})[_0x0752('0x2a')](function(_0x33fb08){_0x33fb08[_0x0752('0x6a')](function(_0x4f2ad6){_0x26e977['push'](_0x4f2ad6['id']+0x15b38);});_0x72360(_0x26e977);});}else{return db['UserProfileResource'][_0x0752('0x58')]({'where':{'sectionId':_0x36fe5a['id']},'raw':!![]})['then'](function(_0x992049){_0x992049[_0x0752('0x6a')](function(_0x53ce1d){_0x26e977[_0x0752('0x66')](_0x53ce1d['resourceId']+0x15b38);});_0x72360(_0x26e977);});}}catch(_0x22e79e){_0x5e855c(_0x22e79e);}});}exports[_0x0752('0x6b')]=function(_0xe85184,_0x4eb392){return db[_0x0752('0x31')][_0x0752('0x4b')]({'where':{'id':_0xe85184[_0x0752('0x49')]['id']}})[_0x0752('0x2a')](handleEntityNotFound(_0x4eb392,null))[_0x0752('0x2a')](function(_0x1e6326){if(_0x1e6326){return db[_0x0752('0x54')][_0x0752('0x55')](function(_0x3c0ee0){return db[_0x0752('0x5b')][_0x0752('0x58')]({'where':{'userProfileId':_0xe85184[_0x0752('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0x0752('0x2a')](function(_0x363b74){if(_0x363b74){return db[_0x0752('0x5b')][_0x0752('0x29')]({'where':{'userProfileId':_0xe85184[_0x0752('0x49')]['id'],'id':_[_0x0752('0x30')](_0x363b74,function(_0x1e9242){return _0x1e9242['id'];})},'transaction':_0x3c0ee0});}})[_0x0752('0x2a')](function(_0x12dc54){var _0xfcc2b0=_[_0x0752('0x30')](_0xe85184[_0x0752('0x51')],function(_0x1dcd17){_0x1dcd17['userProfileId']=_0xe85184['params']['id'];return _0x1dcd17;});return db[_0x0752('0x5b')]['bulkCreate'](_0xfcc2b0,{'raw':!![],'transaction':_0x3c0ee0});})[_0x0752('0x2a')](function(_0x446dd8){var _0x274f9f=_[_0x0752('0x41')](_[_0x0752('0x30')](_0x446dd8,function(_0x32fd34){return _0x32fd34[_0x0752('0x4e')]({'plain':!![]});}),{'includeAll':![]});if(_0x274f9f){return db[_0x0752('0x5b')][_0x0752('0x58')]({'where':{'userProfileId':_0xe85184[_0x0752('0x49')]['id'],'sectionId':_[_0x0752('0x30')](_0x274f9f,function(_0x1df655){return _0x1df655[_0x0752('0x59')];})},'attributes':['id',_0x0752('0x59')],'raw':!![]})[_0x0752('0x2a')](function(_0x3488e7){var _0x1b8b1e=_['map'](_0xe85184[_0x0752('0x51')],function(_0x1b5a81){_0x1b5a81[_0x0752('0x5d')]=_0xe85184[_0x0752('0x49')]['id'];return _0x1b5a81;});return db[_0x0752('0x57')][_0x0752('0x6c')](_0x1b8b1e,{'raw':!![],'transaction':_0x3c0ee0});});}})['catch'](handleError(_0x4eb392,null));});}})[_0x0752('0x2a')](function(_0x4390b1){var _0x51296e=_[_0x0752('0x30')](_0x4390b1,function(_0x257d96){return _0x257d96[_0x0752('0x4e')]({'plain':!![]});});})[_0x0752('0x2a')](respondWithResult(_0x4eb392,null))[_0x0752('0x48')](handleError(_0x4eb392,null));};exports[_0x0752('0x6d')]=function(_0x140a02,_0x5b8d0f,_0x37e061){return db[_0x0752('0x31')][_0x0752('0x4b')]({'where':{'id':_0x140a02[_0x0752('0x49')]['id']}})[_0x0752('0x2a')](handleEntityNotFound(_0x5b8d0f,null))[_0x0752('0x2a')](function(_0x43111d){if(_0x43111d){return _0x43111d[_0x0752('0x6d')](_0x140a02[_0x0752('0x39')][_0x0752('0x5f')]);}})[_0x0752('0x2a')](respondWithStatusCode(_0x5b8d0f,null))[_0x0752('0x48')](handleError(_0x5b8d0f,null));};exports[_0x0752('0x6e')]=function(_0x44529e,_0x14d467){var _0x54157e={};if(!_0x44529e[_0x0752('0x39')][_0x0752('0x6f')])throw new Error('Missing\x20section\x20parameter');if(!_0x44529e[_0x0752('0x39')][_0x0752('0x3c')](_0x0752('0x70'))){_0x54157e['limit']=qs[_0x0752('0x22')](_0x44529e[_0x0752('0x39')][_0x0752('0x22')]);_0x54157e['offset']=qs[_0x0752('0x24')](_0x44529e['query'][_0x0752('0x24')]);}return db[_0x0752('0x31')][_0x0752('0x4b')]({'where':{'id':_0x44529e[_0x0752('0x49')]['id']}})['then'](function(_0x2f819c){if(!_0x2f819c)throw new Error(_0x0752('0x71')+_0x44529e[_0x0752('0x49')]['id']);return db[_0x0752('0x31')]['getResources'](_0x44529e);})[_0x0752('0x2a')](respondWithFilteredResult(_0x14d467,_0x54157e))[_0x0752('0x48')](handleError(_0x14d467,null));}; \ No newline at end of file +var _0x90e1=['then','destroy','stack','name','map','UserProfile','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','keys','options','find','create','body','clone','rawAttributes','get','createdAt','updatedAt','omit','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','catch','Resources','update','describe','addSections','sectionId','push','removeSections','ids','getSections','includes','subsections','enabled','concat','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','userProfileId','removeResources','section','Missing\x20section\x20parameter','hasOwnProperty','getResources','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','defaults','redis','localhost','./userProfile.socket','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save'];(function(_0xbe2b03,_0xb1f12e){var _0x50cfb7=function(_0x5b0bb4){while(--_0x5b0bb4){_0xbe2b03['push'](_0xbe2b03['shift']());}};_0x50cfb7(++_0xb1f12e);}(_0x90e1,0x19b));var _0x190e=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x90e1[_0x46698a];return _0x356db0;};'use strict';var emlformat=require(_0x190e('0x0'));var rimraf=require(_0x190e('0x1'));var zipdir=require(_0x190e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x190e('0x3'));var moment=require(_0x190e('0x4'));var BPromise=require(_0x190e('0x5'));var Mustache=require(_0x190e('0x6'));var util=require(_0x190e('0x7'));var path=require('path');var sox=require(_0x190e('0x8'));var csv=require(_0x190e('0x9'));var ejs=require(_0x190e('0xa'));var fs=require('fs');var fs_extra=require(_0x190e('0xb'));var _=require(_0x190e('0xc'));var squel=require(_0x190e('0xd'));var crypto=require(_0x190e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x190e('0xf'));var toCsv=require('to-csv');var querystring=require(_0x190e('0x10'));var Papa=require(_0x190e('0x11'));var Redis=require(_0x190e('0x12'));var authService=require(_0x190e('0x13'));var qs=require(_0x190e('0x14'));var as=require(_0x190e('0x15'));var hardwareService=require(_0x190e('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x190e('0x17'));var config=require(_0x190e('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x190e('0x19')](config[_0x190e('0x1a')],{'host':_0x190e('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x190e('0x1a')]));require(_0x190e('0x1c'))['register'](socket);function respondWithStatusCode(_0x9b4ca2,_0x4fff7a){_0x4fff7a=_0x4fff7a||0xcc;return function(_0x432096){if(_0x432096){return _0x9b4ca2[_0x190e('0x1d')](_0x4fff7a);}return _0x9b4ca2[_0x190e('0x1e')](_0x4fff7a)[_0x190e('0x1f')]();};}function respondWithResult(_0xd1bc94,_0x59c423){_0x59c423=_0x59c423||0xc8;return function(_0x593cdc){if(_0x593cdc){return _0xd1bc94[_0x190e('0x1e')](_0x59c423)[_0x190e('0x20')](_0x593cdc);}};}function respondWithFilteredResult(_0xe37903,_0x4e4d04){return function(_0x3b8814){if(_0x3b8814){var _0x18621f=typeof _0x4e4d04['offset']===_0x190e('0x21')&&typeof _0x4e4d04[_0x190e('0x22')]===_0x190e('0x21');var _0x4a37f9=_0x3b8814[_0x190e('0x23')];var _0x19008e=_0x18621f?0x0:_0x4e4d04[_0x190e('0x24')];var _0x165894=_0x18621f?_0x3b8814[_0x190e('0x23')]:_0x4e4d04[_0x190e('0x24')]+_0x4e4d04[_0x190e('0x22')];var _0x3928a9;if(_0x165894>=_0x4a37f9){_0x165894=_0x4a37f9;_0x3928a9=0xc8;}else{_0x3928a9=0xce;}_0xe37903[_0x190e('0x1e')](_0x3928a9);return _0xe37903['set'](_0x190e('0x25'),_0x19008e+'-'+_0x165894+'/'+_0x4a37f9)[_0x190e('0x20')](_0x3b8814);}return null;};}function patchUpdates(_0x27eb95){return function(_0x20adee){try{jsonpatch[_0x190e('0x26')](_0x20adee,_0x27eb95,!![]);}catch(_0x3f09b8){return BPromise[_0x190e('0x27')](_0x3f09b8);}return _0x20adee[_0x190e('0x28')]();};}function saveUpdates(_0x541e38,_0x2bc3e6){return function(_0x3320c3){if(_0x3320c3){return _0x3320c3['update'](_0x541e38)[_0x190e('0x29')](function(_0x30bcb6){return _0x30bcb6;});}return null;};}function removeEntity(_0x38dfd2,_0x10eb2f){return function(_0xf3e2af){if(_0xf3e2af){return _0xf3e2af[_0x190e('0x2a')]()['then'](function(){_0x38dfd2[_0x190e('0x1e')](0xcc)[_0x190e('0x1f')]();});}};}function handleEntityNotFound(_0x20cc8e,_0x427cb9){return function(_0x4b7315){if(!_0x4b7315){_0x20cc8e[_0x190e('0x1d')](0x194);}return _0x4b7315;};}function handleError(_0x402289,_0xe7fd42){_0xe7fd42=_0xe7fd42||0x1f4;return function(_0x35f508){logger['error'](_0x35f508[_0x190e('0x2b')]);if(_0x35f508['name']){delete _0x35f508[_0x190e('0x2c')];}_0x402289[_0x190e('0x1e')](_0xe7fd42)['send'](_0x35f508);};}exports['index']=function(_0x299a33,_0x48f713){var _0x476c6b={},_0x525b9a={},_0xa70523={'count':0x0,'rows':[]};var _0x4aa20c=_[_0x190e('0x2d')](db[_0x190e('0x2e')]['rawAttributes'],function(_0x4ca90c){return{'name':_0x4ca90c[_0x190e('0x2f')],'type':_0x4ca90c[_0x190e('0x30')][_0x190e('0x31')]};});_0x525b9a[_0x190e('0x32')]=_[_0x190e('0x2d')](_0x4aa20c,_0x190e('0x2c'));_0x525b9a[_0x190e('0x33')]=_['keys'](_0x299a33[_0x190e('0x33')]);_0x525b9a[_0x190e('0x34')]=_['intersection'](_0x525b9a[_0x190e('0x32')],_0x525b9a[_0x190e('0x33')]);_0x476c6b['attributes']=_[_0x190e('0x35')](_0x525b9a['model'],qs['fields'](_0x299a33[_0x190e('0x33')][_0x190e('0x36')]));_0x476c6b[_0x190e('0x37')]=_0x476c6b[_0x190e('0x37')][_0x190e('0x38')]?_0x476c6b[_0x190e('0x37')]:_0x525b9a[_0x190e('0x32')];if(!_0x299a33[_0x190e('0x33')]['hasOwnProperty']('nolimit')){_0x476c6b[_0x190e('0x22')]=qs[_0x190e('0x22')](_0x299a33[_0x190e('0x33')][_0x190e('0x22')]);_0x476c6b[_0x190e('0x24')]=qs[_0x190e('0x24')](_0x299a33['query']['offset']);}_0x476c6b[_0x190e('0x39')]=qs['sort'](_0x299a33[_0x190e('0x33')][_0x190e('0x3a')]);_0x476c6b[_0x190e('0x3b')]=qs[_0x190e('0x34')](_[_0x190e('0x3c')](_0x299a33[_0x190e('0x33')],_0x525b9a[_0x190e('0x34')]),_0x4aa20c);if(_0x299a33[_0x190e('0x33')][_0x190e('0x3d')]){_0x476c6b[_0x190e('0x3b')]=_[_0x190e('0x3e')](_0x476c6b[_0x190e('0x3b')],{'$or':_[_0x190e('0x2d')](_0x4aa20c,function(_0x22672a){if(_0x22672a[_0x190e('0x30')]!=='VIRTUAL'){var _0x148d3c={};_0x148d3c[_0x22672a[_0x190e('0x2c')]]={'$like':'%'+_0x299a33[_0x190e('0x33')][_0x190e('0x3d')]+'%'};return _0x148d3c;}})});}_0x476c6b=_['merge']({},_0x476c6b,_0x299a33['options']);var _0x507321={'where':_0x476c6b[_0x190e('0x3b')]};return db['UserProfile']['count'](_0x507321)['then'](function(_0x2e24f8){_0xa70523[_0x190e('0x23')]=_0x2e24f8;if(_0x299a33[_0x190e('0x33')][_0x190e('0x3f')]){_0x476c6b[_0x190e('0x40')]=[{'all':!![]}];}return db['UserProfile'][_0x190e('0x41')](_0x476c6b);})[_0x190e('0x29')](function(_0x421775){_0xa70523[_0x190e('0x42')]=_0x421775;return _0xa70523;})[_0x190e('0x29')](respondWithFilteredResult(_0x48f713,_0x476c6b))['catch'](handleError(_0x48f713,null));};exports[_0x190e('0x43')]=function(_0x3046c5,_0x54d064){var _0x358773={'raw':![],'where':{'id':_0x3046c5[_0x190e('0x44')]['id']}},_0x243f03={};_0x243f03[_0x190e('0x32')]=_['keys'](db[_0x190e('0x2e')]['rawAttributes']);_0x243f03[_0x190e('0x33')]=_[_0x190e('0x45')](_0x3046c5['query']);_0x243f03['filters']=_[_0x190e('0x35')](_0x243f03[_0x190e('0x32')],_0x243f03[_0x190e('0x33')]);_0x358773['attributes']=_[_0x190e('0x35')](_0x243f03['model'],qs[_0x190e('0x36')](_0x3046c5[_0x190e('0x33')][_0x190e('0x36')]));_0x358773[_0x190e('0x37')]=_0x358773[_0x190e('0x37')][_0x190e('0x38')]?_0x358773[_0x190e('0x37')]:_0x243f03['model'];if(_0x3046c5[_0x190e('0x33')][_0x190e('0x3f')]){_0x358773['include']=[{'all':!![]}];}_0x358773=_['merge']({},_0x358773,_0x3046c5[_0x190e('0x46')]);return db[_0x190e('0x2e')][_0x190e('0x47')](_0x358773)['then'](handleEntityNotFound(_0x54d064,null))[_0x190e('0x29')](respondWithResult(_0x54d064,null))['catch'](handleError(_0x54d064,null));};exports[_0x190e('0x48')]=function(_0x3a8659,_0x51fb3f){return db[_0x190e('0x2e')]['create'](_0x3a8659[_0x190e('0x49')],{})[_0x190e('0x29')](respondWithResult(_0x51fb3f,0xc9))['catch'](handleError(_0x51fb3f,null));};exports[_0x190e('0x4a')]=function(_0x120285,_0x36a5c9){var _0x1f2d7c={'where':{'id':_0x120285[_0x190e('0x44')]['id']}},_0x1e7743={};_0x1e7743['model']=_[_0x190e('0x45')](db[_0x190e('0x2e')][_0x190e('0x4b')]);_0x1f2d7c[_0x190e('0x37')]=_[_0x190e('0x35')](_0x1e7743['model'],qs[_0x190e('0x36')](_0x120285[_0x190e('0x33')][_0x190e('0x36')]));_0x1f2d7c[_0x190e('0x37')]=_0x1f2d7c[_0x190e('0x37')][_0x190e('0x38')]?_0x1f2d7c[_0x190e('0x37')]:_0x1e7743[_0x190e('0x32')];if(_0x120285[_0x190e('0x33')][_0x190e('0x3f')]){_0x1f2d7c['include']=[{'all':!![]}];}_0x1f2d7c=_[_0x190e('0x3e')]({},_0x1f2d7c,_0x120285[_0x190e('0x46')]);return db[_0x190e('0x2e')][_0x190e('0x47')](_0x1f2d7c)[_0x190e('0x29')](handleEntityNotFound(_0x36a5c9,null))[_0x190e('0x29')](function(_0x3fa1f1){if(_0x3fa1f1){var _0x4a8d16=_0x3fa1f1[_0x190e('0x4c')]({'plain':!![]});_0x4a8d16=qs['omit'](_0x4a8d16,['id',_0x190e('0x4d'),_0x190e('0x4e'),'crudPermissions']);_0x120285[_0x190e('0x49')]=_[_0x190e('0x4f')](_0x120285[_0x190e('0x49')],['id',_0x190e('0x4d'),'updatedAt']);return db[_0x190e('0x50')][_0x190e('0x51')](function(_0x4da0ec){return db[_0x190e('0x2e')][_0x190e('0x48')](_['merge'](_0x4a8d16,_0x120285[_0x190e('0x49')]),{'include':_0x120285[_0x190e('0x33')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x4da0ec})[_0x190e('0x29')](function(_0x47bec2){var _0x4c1642=_0x47bec2[_0x190e('0x4c')]({'plain':!![]});return db[_0x190e('0x52')][_0x190e('0x41')]({'where':{'userProfileId':_0x120285[_0x190e('0x44')]['id']},'raw':!![]})['then'](function(_0x19e901){if(_0x19e901){return BPromise[_0x190e('0x53')](_0x19e901,function(_0x2c12a5){return new BPromise(function(_0x376389,_0x9bc1cd){if(_0x2c12a5['autoAssociation']===null||_0x2c12a5[_0x190e('0x54')]===0x1)_0x376389(null);return db[_0x190e('0x55')][_0x190e('0x41')]({'where':{'sectionId':_0x2c12a5['id']},'raw':!![]})['then'](function(_0x2348f7){var _0x8ff4f8=_[_0x190e('0x2d')](_0x2348f7,function(_0x3aa641){return qs['omit'](_0x3aa641,['id',_0x190e('0x4d'),'updatedAt','sectionId']);});_0x376389(_0x8ff4f8);})[_0x190e('0x56')](function(_0x496af1){_0x9bc1cd(_0x496af1);});})[_0x190e('0x29')](function(_0xfe5312){var _0x1657bf=qs[_0x190e('0x4f')](_0x2c12a5,['id',_0x190e('0x4d'),_0x190e('0x4e')]);_0x1657bf['userProfileId']=_0x4c1642['id'];if(_0xfe5312)_0x1657bf[_0x190e('0x57')]=_0xfe5312;return _0x1657bf;})[_0x190e('0x29')](function(_0x4efdba){return db[_0x190e('0x52')]['create'](_0x4efdba,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x4da0ec});});})['then'](function(){return _0x4c1642;});}});});});}})[_0x190e('0x29')](respondWithResult(_0x36a5c9,0xc9))[_0x190e('0x56')](handleError(_0x36a5c9,null));};exports[_0x190e('0x58')]=function(_0x58c01d,_0x10ff35){if(_0x58c01d[_0x190e('0x49')]['id']){delete _0x58c01d[_0x190e('0x49')]['id'];}return db[_0x190e('0x2e')][_0x190e('0x47')]({'where':{'id':_0x58c01d[_0x190e('0x44')]['id']}})[_0x190e('0x29')](handleEntityNotFound(_0x10ff35,null))[_0x190e('0x29')](saveUpdates(_0x58c01d[_0x190e('0x49')],null))[_0x190e('0x29')](respondWithResult(_0x10ff35,null))[_0x190e('0x56')](handleError(_0x10ff35,null));};exports['destroy']=function(_0x218730,_0x14f5db){return db[_0x190e('0x2e')][_0x190e('0x47')]({'where':{'id':_0x218730[_0x190e('0x44')]['id']}})[_0x190e('0x29')](handleEntityNotFound(_0x14f5db,null))[_0x190e('0x29')](removeEntity(_0x14f5db,null))['catch'](handleError(_0x14f5db,null));};exports['describe']=function(_0x3724c4,_0xc4a253){return db[_0x190e('0x2e')][_0x190e('0x59')]()['then'](respondWithResult(_0xc4a253,null))[_0x190e('0x56')](handleError(_0xc4a253,null));};exports[_0x190e('0x5a')]=function(_0x5d88c8,_0x2839a7){var _0x11ab1d=_0x5d88c8[_0x190e('0x49')];return db['UserProfile'][_0x190e('0x47')]({'where':{'id':_0x5d88c8[_0x190e('0x44')]['id']}})[_0x190e('0x29')](handleEntityNotFound(_0x2839a7,null))[_0x190e('0x29')](function(_0x308edb){if(_0x308edb){return db[_0x190e('0x50')][_0x190e('0x51')](function(_0x83e4aa){return db[_0x190e('0x52')]['destroy']({'where':{'userProfileId':_0x5d88c8[_0x190e('0x44')]['id'],'sectionId':_[_0x190e('0x2d')](_0x11ab1d,function(_0x33e43a){return _0x33e43a[_0x190e('0x5b')];})},'transaction':_0x83e4aa})[_0x190e('0x29')](function(){var _0x53a942=_[_0x190e('0x2d')](_0x11ab1d,function(_0x49bb75){_0x49bb75['userProfileId']=_0x5d88c8[_0x190e('0x44')]['id'];return _0x49bb75;});var _0x295b8c=[];return BPromise[_0x190e('0x53')](_0x53a942,function(_0x138b7d){return db[_0x190e('0x52')][_0x190e('0x48')](_0x138b7d,{'include':[{'model':db['UserProfileResource'],'as':_0x190e('0x57')}],'raw':!![],'transaction':_0x83e4aa})['then'](function(_0x2d99e0){_0x295b8c[_0x190e('0x5c')](_0x2d99e0['get']({'plain':!![]}));});})[_0x190e('0x29')](function(){return _0x295b8c;});});});}})[_0x190e('0x29')](function(_0x18303c){return _0x18303c;})[_0x190e('0x29')](respondWithResult(_0x2839a7,null))[_0x190e('0x56')](handleError(_0x2839a7,null));};exports[_0x190e('0x5d')]=function(_0x25920b,_0x2a5b31){var _0x27d165;return db[_0x190e('0x2e')][_0x190e('0x47')]({'where':{'id':_0x25920b['params']['id']},'attributes':['id',_0x190e('0x2c')]})['then'](handleEntityNotFound(_0x2a5b31,null))[_0x190e('0x29')](function(_0x46d304){if(_0x46d304){_0x27d165=_0x46d304;return db[_0x190e('0x52')]['destroy']({'where':{'userProfileId':_0x25920b[_0x190e('0x44')]['id'],'sectionId':_0x25920b[_0x190e('0x33')][_0x190e('0x5e')]}});}})[_0x190e('0x29')](function(){return _0x27d165;})[_0x190e('0x29')](respondWithStatusCode(_0x2a5b31,null))[_0x190e('0x56')](handleError(_0x2a5b31,null));};exports[_0x190e('0x5f')]=function(_0x71b9d2,_0xd748c8){var _0x947024=[];var _0x4b9651=[];return db[_0x190e('0x52')]['findAll']({'where':{'userProfileId':_0x71b9d2[_0x190e('0x44')]['id']},'raw':!![]})[_0x190e('0x29')](function(_0x1c6a1c){_0x947024=_['filter'](_0x1c6a1c,function(_0x4f4df0){return _0x4f4df0['enabled']===0x1||_[_0x190e('0x60')]([0x3eb,0x709],_0x4f4df0[_0x190e('0x5b')]);});if(!_['isEmpty'](_0x947024)){return _[_0x190e('0x2d')](_0x947024,function(_0x7a5f05){return _0x7a5f05[_0x190e('0x5b')];});}else{return;}})[_0x190e('0x29')](function(_0x1d95cf){if(_0x1d95cf)_0x4b9651=_0x1d95cf;if(_['includes'](_0x4b9651,0x64)){var _0x1517f2=_['find'](_0x947024,{'sectionId':0x64});return hasDefaultDashboard(_0x1517f2)[_0x190e('0x29')](function(_0x2b79c1){return _[_0x190e('0x2d')](_0x947024,function(_0x37e39f){if(_0x37e39f['sectionId']===0x64){_0x37e39f[_0x190e('0x61')]=_0x2b79c1;}return _0x37e39f;});});}else{return;}})[_0x190e('0x29')](function(_0x557f91){if(_0x557f91)_0x947024=_0x557f91;if(_['includes'](_0x4b9651,0x3eb)){var _0xb9049b=_[_0x190e('0x47')](_0x947024,{'sectionId':0x3eb});return getCustomDashboards(_0xb9049b)[_0x190e('0x29')](function(_0x3ac265){return _['map'](_0x947024,function(_0x4bca78){if(_0xb9049b[_0x190e('0x62')]){if(_0x4bca78['sectionId']===0x3eb){_0x4bca78[_0x190e('0x61')]=_0x3ac265;}}else{if(_0x4bca78[_0x190e('0x5b')]===0x64){if(!_0x4bca78[_0x190e('0x61')]){_0x4bca78[_0x190e('0x61')]=[];}_0x4bca78[_0x190e('0x61')]=_0x4bca78[_0x190e('0x61')][_0x190e('0x63')](_0x3ac265);}}return _0x4bca78;});});}else{return;}})['then'](function(_0x5685b2){if(_0x5685b2)_0x947024=_0x5685b2;if(_[_0x190e('0x60')](_0x4b9651,0x709)){var _0x43a5e2=_[_0x190e('0x47')](_0x947024,{'sectionId':0x709});return getPlugins(_0x43a5e2)[_0x190e('0x29')](function(_0x3b30d0){if(_0x43a5e2['enabled']){return _[_0x190e('0x2d')](_0x947024,function(_0xb86455){if(_0xb86455[_0x190e('0x5b')]===0x709){_0xb86455[_0x190e('0x61')]=_0x3b30d0;}return _0xb86455;});}else{var _0x3edabf={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3b30d0};var _0x43a776=_[_0x190e('0x2d')](_0x947024);_0x43a776[_0x190e('0x5c')](_0x3edabf);return _0x43a776;}});}else{return;}})['then'](function(_0x5d764f){if(_0x5d764f)_0x947024=_0x5d764f;return _['filter'](_0x947024,['enabled',0x1]);})[_0x190e('0x29')](respondWithResult(_0xd748c8,null))[_0x190e('0x56')](handleError(_0xd748c8,null));};function hasDefaultDashboard(_0x527fcd){var _0x48d327=[0x65];return new BPromise(function(_0x38a075,_0x42432f){try{if(_0x527fcd['autoAssociation']){_0x38a075(_0x48d327);}else{return db['UserProfileResource'][_0x190e('0x64')]({'where':{'sectionId':_0x527fcd['id']},'raw':!![]})[_0x190e('0x29')](function(_0x123d52){_0x123d52?_0x38a075(_0x48d327):_0x38a075();});}}catch(_0x41e83c){_0x42432f(_0x41e83c);}});}function getCustomDashboards(_0x59e282){var _0xa68c06=[];return new BPromise(function(_0x3c0471,_0x4d45fb){try{if(_0x59e282[_0x190e('0x54')]){return db[_0x190e('0x65')][_0x190e('0x41')]({'raw':!![]})[_0x190e('0x29')](function(_0x5bd1eb){_0x5bd1eb[_0x190e('0x66')](function(_0x4c9870){_0xa68c06['push'](_0x4c9870['id']+0x1869f);});_0x3c0471(_0xa68c06);});}else{return db[_0x190e('0x55')][_0x190e('0x41')]({'where':{'sectionId':_0x59e282['id']},'raw':!![]})['then'](function(_0x10a753){_0x10a753['forEach'](function(_0x1ded3d){_0xa68c06[_0x190e('0x5c')](_0x1ded3d[_0x190e('0x67')]+0x1869f);});_0x3c0471(_0xa68c06);});}}catch(_0x3c0051){_0x4d45fb(_0x3c0051);}});}function getPlugins(_0x3a3540){var _0x861c21=[];return new BPromise(function(_0x2c2bc5,_0x4eb796){try{if(_0x3a3540[_0x190e('0x54')]){return db[_0x190e('0x68')]['findAll']({'raw':!![]})['then'](function(_0xed0bbb){_0xed0bbb[_0x190e('0x66')](function(_0x483421){_0x861c21['push'](_0x483421['id']+0x15b38);});_0x2c2bc5(_0x861c21);});}else{return db[_0x190e('0x55')][_0x190e('0x41')]({'where':{'sectionId':_0x3a3540['id']},'raw':!![]})['then'](function(_0xe3bb32){_0xe3bb32[_0x190e('0x66')](function(_0x2207ef){_0x861c21[_0x190e('0x5c')](_0x2207ef[_0x190e('0x67')]+0x15b38);});_0x2c2bc5(_0x861c21);});}}catch(_0x4b95b1){_0x4eb796(_0x4b95b1);}});}exports[_0x190e('0x69')]=function(_0x8948d3,_0x1700b5){return db[_0x190e('0x2e')]['find']({'where':{'id':_0x8948d3[_0x190e('0x44')]['id']}})[_0x190e('0x29')](handleEntityNotFound(_0x1700b5,null))[_0x190e('0x29')](function(_0x245041){if(_0x245041){return db[_0x190e('0x50')]['transaction'](function(_0x3062f0){return db[_0x190e('0x52')][_0x190e('0x41')]({'where':{'userProfileId':_0x8948d3[_0x190e('0x44')]['id']},'attributes':['id'],'raw':!![]})[_0x190e('0x29')](function(_0xe5952c){if(_0xe5952c){return db[_0x190e('0x52')][_0x190e('0x2a')]({'where':{'userProfileId':_0x8948d3[_0x190e('0x44')]['id'],'id':_[_0x190e('0x2d')](_0xe5952c,function(_0x5ce97f){return _0x5ce97f['id'];})},'transaction':_0x3062f0});}})['then'](function(_0x432617){var _0x5a0e1f=_[_0x190e('0x2d')](_0x8948d3[_0x190e('0x49')],function(_0xac14d1){_0xac14d1['userProfileId']=_0x8948d3[_0x190e('0x44')]['id'];return _0xac14d1;});return db[_0x190e('0x52')][_0x190e('0x6a')](_0x5a0e1f,{'raw':!![],'transaction':_0x3062f0});})[_0x190e('0x29')](function(_0x1f48cd){var _0x490552=_[_0x190e('0x3d')](_[_0x190e('0x2d')](_0x1f48cd,function(_0x2e7bdd){return _0x2e7bdd[_0x190e('0x4c')]({'plain':!![]});}),{'includeAll':![]});if(_0x490552){return db[_0x190e('0x52')][_0x190e('0x41')]({'where':{'userProfileId':_0x8948d3[_0x190e('0x44')]['id'],'sectionId':_[_0x190e('0x2d')](_0x490552,function(_0x175758){return _0x175758[_0x190e('0x5b')];})},'attributes':['id',_0x190e('0x5b')],'raw':!![]})['then'](function(_0x4e1d44){var _0x1a8ed1=_[_0x190e('0x2d')](_0x8948d3['body'],function(_0x5df400){_0x5df400[_0x190e('0x6b')]=_0x8948d3['params']['id'];return _0x5df400;});return db[_0x190e('0x55')][_0x190e('0x6a')](_0x1a8ed1,{'raw':!![],'transaction':_0x3062f0});});}})[_0x190e('0x56')](handleError(_0x1700b5,null));});}})[_0x190e('0x29')](function(_0xaece6d){var _0x6cd4e0=_[_0x190e('0x2d')](_0xaece6d,function(_0x56ff35){return _0x56ff35[_0x190e('0x4c')]({'plain':!![]});});})['then'](respondWithResult(_0x1700b5,null))['catch'](handleError(_0x1700b5,null));};exports[_0x190e('0x6c')]=function(_0x32690e,_0x3e8fd7,_0x1e4443){return db[_0x190e('0x2e')]['find']({'where':{'id':_0x32690e['params']['id']}})['then'](handleEntityNotFound(_0x3e8fd7,null))[_0x190e('0x29')](function(_0xff363c){if(_0xff363c){return _0xff363c[_0x190e('0x6c')](_0x32690e[_0x190e('0x33')][_0x190e('0x5e')]);}})[_0x190e('0x29')](respondWithStatusCode(_0x3e8fd7,null))['catch'](handleError(_0x3e8fd7,null));};exports['getResources']=function(_0x5217a5,_0xc399e){var _0x875d40={};if(!_0x5217a5[_0x190e('0x33')][_0x190e('0x6d')])throw new Error(_0x190e('0x6e'));if(!_0x5217a5['query'][_0x190e('0x6f')]('nolimit')){_0x875d40[_0x190e('0x22')]=qs[_0x190e('0x22')](_0x5217a5[_0x190e('0x33')][_0x190e('0x22')]);_0x875d40['offset']=qs[_0x190e('0x24')](_0x5217a5[_0x190e('0x33')][_0x190e('0x24')]);}return db[_0x190e('0x2e')][_0x190e('0x47')]({'where':{'id':_0x5217a5[_0x190e('0x44')]['id']}})[_0x190e('0x29')](function(_0x4a69a7){if(!_0x4a69a7)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x5217a5['params']['id']);return db[_0x190e('0x2e')][_0x190e('0x70')](_0x5217a5);})['then'](respondWithFilteredResult(_0xc399e,_0x875d40))[_0x190e('0x56')](handleError(_0xc399e,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 385c0b3..2f5d094 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 _0x1f2d=['hook','exports','events','../../mysqldb','UserProfile','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0xc47eb1,_0x43a0c6){var _0x1b60c2=function(_0x1747e9){while(--_0x1747e9){_0xc47eb1['push'](_0xc47eb1['shift']());}};_0x1b60c2(++_0x43a0c6);}(_0x1f2d,0x1c4));var _0xd1f2=function(_0x5550b3,_0x2d0ee0){_0x5550b3=_0x5550b3-0x0;var _0x4b8fc4=_0x1f2d[_0x5550b3];return _0x4b8fc4;};'use strict';var EventEmitter=require(_0xd1f2('0x0'));var UserProfile=require(_0xd1f2('0x1'))['db'][_0xd1f2('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xd1f2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd1f2('0x4'),'afterDestroy':_0xd1f2('0x5')};function emitEvent(_0x13626e){return function(_0xd4f928,_0x21f154,_0x194b49){UserProfileEvents[_0xd1f2('0x6')](_0x13626e+':'+_0xd4f928['id'],_0xd4f928);UserProfileEvents[_0xd1f2('0x6')](_0x13626e,_0xd4f928);_0x194b49(null);};}for(var e in events){if(events[_0xd1f2('0x7')](e)){var event=events[e];UserProfile[_0xd1f2('0x8')](e,emitEvent(event));}}module[_0xd1f2('0x9')]=UserProfileEvents; \ No newline at end of file +var _0x77d4=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners'];(function(_0x1c279a,_0x163ccb){var _0x42bbc5=function(_0x1b4d72){while(--_0x1b4d72){_0x1c279a['push'](_0x1c279a['shift']());}};_0x42bbc5(++_0x163ccb);}(_0x77d4,0x108));var _0x477d=function(_0x7abcd6,_0x36548c){_0x7abcd6=_0x7abcd6-0x0;var _0x329aea=_0x77d4[_0x7abcd6];return _0x329aea;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x477d('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x477d('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x477d('0x2'),'afterDestroy':_0x477d('0x3')};function emitEvent(_0x53637c){return function(_0x53e1b8,_0x16213f,_0xf3cde0){UserProfileEvents[_0x477d('0x4')](_0x53637c+':'+_0x53e1b8['id'],_0x53e1b8);UserProfileEvents[_0x477d('0x4')](_0x53637c,_0x53e1b8);_0xf3cde0(null);};}for(var e in events){if(events[_0x477d('0x5')](e)){var event=events[e];UserProfile[_0x477d('0x6')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index e576ef5..099e45b 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 _0x9801=['WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','agents','telephones','admin','user','zendeskaccounts','ZendeskAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','Pause','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','Trunk','variables','Variable','plugins','Plugin','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','SELECT','select','ui.','InteractionId','ui.createdAt','from','_interactions','ui.UserId\x20=\x20?','sequelize','query','OpenTabs','UserProfile','user_profiles','../../components/parsers/qs','raw','section','mergeResources','Invalid\x20section\x20\x27','length','push','UserProfileSection','find','params','all','ignore','isEmpty','union','rawAttributes','keys','filters','attributes','intersection','fields','hasOwnProperty','limit','offset','order','where','pick','merge','key','VIRTUAL','foreignKey','forEach','autoAssociation','includeAll','include','reportType','custom','CustomReports','ids','customSorting','extraQueryConditions','Tags','color','tag','rows','openTabs','dataValues','sms','whatsapp','lodash','./userProfile.attributes','exports','filter','field','value','findAll','associatedResources','catch','model','map','UserProfileResource','then','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','squarerecordings','parentSections','JscriptyProject','CmContact','Lists','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceExtension','contexts','voicemails','VoiceRecording','Agents','name','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','musiconholds','VoiceMusicOnHold','VoiceChanSpy','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts'];(function(_0x13a0ea,_0x18960e){var _0x206bd7=function(_0x5a9711){while(--_0x5a9711){_0x13a0ea['push'](_0x13a0ea['shift']());}};_0x206bd7(++_0x18960e);}(_0x9801,0x128));var _0x1980=function(_0x48753b,_0x51994f){_0x48753b=_0x48753b-0x0;var _0x57400a=_0x9801[_0x48753b];return _0x57400a;};'use strict';var _=require(_0x1980('0x0'));var attributes=require(_0x1980('0x1'));var squel=require('squel');module[_0x1980('0x2')]=function(_0x1a1ee3){var _0x3639e5=_0x1a1ee3['models'];function _0x3df94a(_0x16d6f2,_0x455a4c){return new Promise(function(_0x3214e6,_0x22cdc0){if(!_0x455a4c)return _0x3214e6(null);var _0x113a92=_0x455a4c['filter']?{[_0x455a4c[_0x1980('0x3')][_0x1980('0x4')]]:_0x455a4c[_0x1980('0x3')][_0x1980('0x5')]}:undefined;return _0x3639e5[_0x16d6f2][_0x1980('0x6')]({'where':_0x113a92,'raw':!![]})['then'](function(_0x2b95c6){_0x455a4c[_0x1980('0x7')]=_['map'](_0x2b95c6,'id');_0x3214e6(_0x455a4c);})[_0x1980('0x8')](function(_0x518f27){_0x22cdc0(_0x518f27);});});}function _0x66cab2(_0x18c677,_0x1e6939){return new Promise(function(_0x2f8c77,_0x780d78){var _0x466f44=_0x18c677['filter']?{[_0x18c677[_0x1980('0x3')][_0x1980('0x4')]]:_0x18c677[_0x1980('0x3')][_0x1980('0x5')]}:undefined;return _0x3639e5[_0x18c677[_0x1980('0x9')]][_0x1980('0x6')]({'where':_0x466f44,'raw':!![]})['then'](function(_0xd6eb3c){_0x1e6939['associatedResources']=_[_0x1980('0xa')](_0xd6eb3c,function(_0x2a6e1d){return _0x2a6e1d['name'];});_0x2f8c77(_0x1e6939);})[_0x1980('0x8')](function(_0x21dc48){_0x780d78(_0x21dc48);});});}function _0x11d2c0(_0x480dd7,_0x2222bd,_0x3f6105){if(!_0x2222bd)return Promise['resolve'](null);return new Promise(function(_0x765d1d,_0x3f8d29){return _0x3639e5[_0x1980('0xb')][_0x1980('0x6')]({'where':{'sectionId':_0x2222bd['id']},'raw':!![]})[_0x1980('0xc')](function(_0x297aca){if(_0x480dd7[_0x1980('0x4')]&&_0x480dd7[_0x1980('0x4')]!=='id'){_0x2222bd['associatedResources']=_['map'](_0x297aca,function(_0x5c33e4){return _0x5c33e4[_0x480dd7[_0x1980('0x4')]];});}else{if(_0x3f6105===_0x1980('0xd')){_0x2222bd[_0x1980('0x7')]=_['map'](_0x297aca,function(_0x3968cb){return{'id':_0x3968cb[_0x1980('0xe')],'type':_0x3968cb[_0x1980('0xf')]};});}else{_0x2222bd[_0x1980('0x7')]=_['map'](_0x297aca,function(_0x3b7c7a){return _0x3b7c7a[_0x1980('0xe')];});}}_0x765d1d(_0x2222bd);})[_0x1980('0x8')](function(_0x1679b2){_0x3f8d29(_0x1679b2);});});}function _0x5a2922(_0x2bb322,_0x2e539e){var _0x38cb6d={'parentSections':[]};switch(_0x2bb322[_0x1980('0x10')]()){case _0x1980('0x11'):_0x38cb6d[_0x1980('0x12')]=_0x1980('0x13');break;case _0x1980('0x14'):_0x38cb6d[_0x1980('0x12')]='SquareOdbc';break;case _0x1980('0x15'):_0x38cb6d[_0x1980('0x12')]='SquareRecording';_0x38cb6d[_0x1980('0x16')]=[{'name':'SquareProjects','field':'name','foreignKey':'projectName'}];break;case'projects':_0x38cb6d['childModel']=_0x1980('0x17');break;case'contacts':_0x38cb6d[_0x1980('0x12')]=_0x1980('0x18');_0x38cb6d[_0x1980('0x16')]=[{'name':_0x1980('0x19'),'field':'id','foreignKey':'ListId'}];break;case _0x1980('0x1a'):_0x38cb6d[_0x1980('0x12')]=_0x1980('0x1b');break;case _0x1980('0x1c'):_0x38cb6d[_0x1980('0x12')]=_0x1980('0x1d');break;case _0x1980('0x1e'):_0x38cb6d[_0x1980('0x12')]=_0x1980('0x1f');break;case _0x1980('0x20'):_0x38cb6d[_0x1980('0x12')]=_0x1980('0x21');break;case _0x1980('0x22'):_0x38cb6d[_0x1980('0x12')]=_0x1980('0x23');break;case'faxqueues':_0x38cb6d[_0x1980('0x12')]=_0x1980('0x24');break;case _0x1980('0x25'):_0x38cb6d[_0x1980('0x12')]=_0x1980('0x26');break;case'inboundroutes':case _0x1980('0x27'):case _0x1980('0x28'):_0x38cb6d['childModel']=_0x1980('0x29');break;case _0x1980('0x2a'):_0x38cb6d[_0x1980('0x12')]='VoiceContext';break;case _0x1980('0x2b'):_0x38cb6d[_0x1980('0x12')]='VoiceMail';break;case'voicerecordings':_0x38cb6d[_0x1980('0x12')]=_0x1980('0x2c');_0x38cb6d[_0x1980('0x16')]=[{'name':_0x1980('0x2d'),'field':_0x1980('0x2e'),'foreignKey':_0x1980('0x2f'),'model':_0x1980('0x30'),'filter':{'field':_0x1980('0x31'),'value':[_0x1980('0x32')]}},{'name':_0x1980('0x33'),'field':'name','foreignKey':_0x1980('0x2f'),'model':_0x1980('0x30'),'filter':{'field':'role','value':[_0x1980('0x34')]}},{'name':_0x1980('0x35'),'field':'name','foreignKey':_0x1980('0x36'),'model':_0x1980('0x37'),'filter':{'field':_0x1980('0xf'),'value':[_0x1980('0x38')]}},{'name':_0x1980('0x39'),'field':_0x1980('0x2e'),'foreignKey':_0x1980('0x36'),'model':_0x1980('0x37'),'filter':{'field':_0x1980('0xf'),'value':['outbound']}}];break;case _0x1980('0x3a'):_0x38cb6d['childModel']=_0x1980('0x3b');break;case'chanspies':_0x38cb6d[_0x1980('0x12')]=_0x1980('0x3c');break;case'voiceprefixes':_0x38cb6d[_0x1980('0x12')]='VoicePrefix';break;case _0x1980('0x3d'):_0x38cb6d[_0x1980('0x12')]=_0x1980('0x3e');break;case _0x1980('0x3f'):_0x38cb6d['childModel']=_0x1980('0x40');break;case _0x1980('0x41'):_0x38cb6d[_0x1980('0x12')]='MailAccount';break;case _0x1980('0x42'):_0x38cb6d[_0x1980('0x12')]=_0x1980('0x43');break;case _0x1980('0x44'):_0x38cb6d['childModel']=_0x1980('0x45');break;case'openchannelaccounts':_0x38cb6d[_0x1980('0x12')]=_0x1980('0x46');break;case _0x1980('0x47'):_0x38cb6d[_0x1980('0x12')]=_0x1980('0x48');break;case _0x1980('0x49'):_0x38cb6d[_0x1980('0x12')]='SmsAccount';break;case'whatsappqueues':_0x38cb6d[_0x1980('0x12')]=_0x1980('0x4a');break;case _0x1980('0x4b'):_0x38cb6d[_0x1980('0x12')]='WhatsappAccount';break;case _0x1980('0x4c'):_0x38cb6d[_0x1980('0x12')]=_0x1980('0x4d');break;case _0x1980('0x4e'):case _0x1980('0x4f'):_0x38cb6d[_0x1980('0x12')]=_0x1980('0x37');if(_0x2e539e){_0x38cb6d['parentSections']=[{'name':_0x1980('0x35')},{'name':_0x1980('0x39')}];}break;case'users':case _0x1980('0x50'):case _0x1980('0x51'):_0x38cb6d[_0x1980('0x12')]=_0x1980('0x30');if(_0x2e539e){_0x38cb6d['parentSections']=[{'name':'Users','filter':{'field':_0x1980('0x31'),'value':[_0x1980('0x52'),_0x1980('0x53')]},'ignore':!![]},{'name':_0x1980('0x2d')},{'name':'Telephones'}];}break;case _0x1980('0x54'):_0x38cb6d[_0x1980('0x12')]=_0x1980('0x55');break;case'salesforceaccounts':_0x38cb6d[_0x1980('0x12')]='SalesforceAccount';break;case _0x1980('0x56'):_0x38cb6d[_0x1980('0x12')]=_0x1980('0x57');break;case _0x1980('0x58'):_0x38cb6d[_0x1980('0x12')]=_0x1980('0x59');break;case _0x1980('0x5a'):_0x38cb6d[_0x1980('0x12')]=_0x1980('0x5b');break;case _0x1980('0x5c'):_0x38cb6d['childModel']='ZohoAccount';break;case _0x1980('0x5d'):_0x38cb6d[_0x1980('0x12')]='User';break;case _0x1980('0x5e'):_0x38cb6d[_0x1980('0x12')]=_0x1980('0x5f');break;case _0x1980('0x60'):_0x38cb6d[_0x1980('0x12')]=_0x1980('0x61');break;case _0x1980('0x62'):_0x38cb6d['childModel']='Dashboard';break;case _0x1980('0x63'):_0x38cb6d[_0x1980('0x12')]=_0x1980('0x64');break;case'pauses':_0x38cb6d['childModel']=_0x1980('0x65');break;case'scheduler':_0x38cb6d['childModel']=_0x1980('0x66');break;case _0x1980('0x67'):_0x38cb6d[_0x1980('0x12')]=_0x1980('0x68');break;case _0x1980('0x69'):_0x38cb6d[_0x1980('0x12')]=_0x1980('0x6a');break;case _0x1980('0x6b'):_0x38cb6d['childModel']=_0x1980('0x6c');break;case _0x1980('0x6d'):_0x38cb6d[_0x1980('0x12')]=_0x1980('0x6e');break;case'trunks':_0x38cb6d[_0x1980('0x12')]=_0x1980('0x6f');break;case _0x1980('0x70'):_0x38cb6d['childModel']=_0x1980('0x71');break;case _0x1980('0x72'):_0x38cb6d[_0x1980('0x12')]=_0x1980('0x73');break;case'extractedreports':_0x38cb6d[_0x1980('0x12')]=_0x1980('0xd');_0x38cb6d['parentSections']=[{'name':_0x1980('0x74'),'field':'id','foreignKey':_0x1980('0x75')}];break;case _0x1980('0x76'):_0x38cb6d['childModel']=_0x1980('0x77');break;}return _0x38cb6d;}function _0x2a709c(_0x5e4eb3,_0x4f4815){var _0x17e696=_0x5e4eb3[_0x1980('0x78')](0x0)[_0x1980('0x79')]()+_0x5e4eb3[_0x1980('0x7a')](0x1);var _0x4151ea={'type':_0x3639e5[_0x1980('0x7b')]['QueryTypes'][_0x1980('0x7c')],'raw':!![]};return new Promise(function(_0x4a8604,_0x2679e7){var _0x4e4cfa=squel[_0x1980('0x7d')]()[_0x1980('0x4')](_0x1980('0x7e')+_0x17e696+_0x1980('0x7f'),'id')[_0x1980('0x4')](_0x1980('0x80'))[_0x1980('0x81')]('user_has_'+_0x5e4eb3+_0x1980('0x82'),'ui')['where'](_0x1980('0x83'),_0x4f4815['id']);return _0x3639e5[_0x1980('0x84')][_0x1980('0x85')](_0x4e4cfa['toString'](),_0x4151ea)[_0x1980('0xc')](function(_0x1dfdb2){_0x4f4815[_0x17e696+_0x1980('0x86')]=_0x1dfdb2;_0x4a8604(_0x1dfdb2);})[_0x1980('0x8')](function(_0x1078b6){_0x2679e7(_0x1078b6);});});}return _0x1a1ee3['define'](_0x1980('0x87'),attributes,{'tableName':_0x1980('0x88'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0xb1518){var _0x57d19f=require(_0x1980('0x89'));var _0x479490={'raw':_0xb1518[_0x1980('0x85')][_0x1980('0x8a')],'where':{}};var _0x80f21e={};var _0x3887f4={'count':0x0,'rows':[]};var _0x38e032=_0xb1518[_0x1980('0x85')][_0x1980('0x8b')];var _0x1642d0=_0xb1518['query'][_0x1980('0x8c')]||![];var _0x7afa63=_0x5a2922(_0x38e032,_0x1642d0);if(!_0x7afa63[_0x1980('0x12')])throw new Error(_0x1980('0x8d')+_0x38e032+'\x27');var _0x2cd562=[{'name':_0x38e032}];if(!_['isEmpty'](_0x7afa63[_0x1980('0x16')]))_0x2cd562=_0x7afa63[_0x1980('0x16')];var _0x66642a=[];for(var _0x72e9bb=0x0;_0x72e9bb<_0x2cd562[_0x1980('0x8e')];_0x72e9bb++){_0x66642a[_0x1980('0x8f')](_0x3639e5[_0x1980('0x90')][_0x1980('0x91')]({'where':{'userProfileId':_0xb1518[_0x1980('0x92')]['id'],'name':_0x2cd562[_0x72e9bb][_0x1980('0x2e')]},'raw':!![]}));}return Promise[_0x1980('0x93')](_0x66642a)[_0x1980('0xc')](function(_0x3f3627){var _0xfcabf=_[_0x1980('0x3')](_0x3f3627,function(_0x192ba7){return _0x192ba7?_0x192ba7:undefined;});var _0x3cddd3=_['filter'](_0x2cd562,[_0x1980('0x94'),!![]]);var _0x4cfe91=_['isEmpty'](_0xfcabf)&&_[_0x1980('0x95')](_0x3cddd3)?null:_[_0x1980('0x96')](_0x3cddd3,_0xfcabf);if(!_0x4cfe91)return null;var _0x550717=[];for(var _0x16896b=0x0;_0x16896b<_0x4cfe91[_0x1980('0x8e')];_0x16896b++){var _0x112dda=_[_0x1980('0x91')](_0x2cd562,function(_0x1ec938){return _0x4cfe91[_0x16896b]?_0x1ec938[_0x1980('0x2e')]===_0x4cfe91[_0x16896b][_0x1980('0x2e')]:null;});if(_0x112dda){if(_0x4cfe91[_0x16896b][_0x1980('0x94')]){_0x550717[_0x1980('0x8f')](_0x3df94a(_0x7afa63[_0x1980('0x12')],_0x4cfe91[_0x16896b]));}else{if(!_0x4cfe91[_0x16896b]['autoAssociation']){_0x550717[_0x1980('0x8f')](_0x11d2c0(_0x112dda,_0x4cfe91[_0x16896b],_0x7afa63[_0x1980('0x12')]));}else{if(_0x112dda[_0x1980('0x9')]){_0x550717['push'](_0x66cab2(_0x112dda,_0x4cfe91[_0x16896b]));}}}}}return Promise[_0x1980('0x93')](_0x550717);})[_0x1980('0xc')](function(_0x33a650){var _0x149a25=_0x33a650;var _0x23fe2e=null;if(_0x149a25){_0x23fe2e=_0x149a25[_0x1980('0x8e')]===0x1?_0x149a25[0x0]:null;}if(!_0x23fe2e&&!_0x149a25)return _0x3887f4;var _0x455b63=_0x3639e5[_0x7afa63[_0x1980('0x12')]][_0x1980('0x97')];_0x80f21e[_0x1980('0x9')]=_[_0x1980('0x98')](_0x455b63);_0x80f21e[_0x1980('0x85')]=_[_0x1980('0x98')](_0xb1518['query']);_0x80f21e[_0x1980('0x99')]=_['intersection'](_0x80f21e[_0x1980('0x9')],_0x80f21e[_0x1980('0x85')]);_0x479490[_0x1980('0x9a')]=_[_0x1980('0x9b')](_0x80f21e['model'],_0x57d19f[_0x1980('0x9c')](_0xb1518[_0x1980('0x85')][_0x1980('0x9c')]));_0x479490['attributes']=_0x479490[_0x1980('0x9a')]['length']?_0x479490[_0x1980('0x9a')]:_0x80f21e[_0x1980('0x9')];if(!_0xb1518[_0x1980('0x85')][_0x1980('0x9d')]('nolimit')){_0x479490['limit']=_0x57d19f[_0x1980('0x9e')](_0xb1518[_0x1980('0x85')][_0x1980('0x9e')]);_0x479490[_0x1980('0x9f')]=_0x57d19f[_0x1980('0x9f')](_0xb1518['query']['offset']);}_0x479490[_0x1980('0xa0')]=_0x57d19f['sort'](_0xb1518[_0x1980('0x85')]['sort']);_0x479490[_0x1980('0xa1')]=_0x57d19f[_0x1980('0x99')](_[_0x1980('0xa2')](_0xb1518[_0x1980('0x85')],_0x80f21e[_0x1980('0x99')]));if(_0xb1518[_0x1980('0x85')]['filter']){_0x479490['where']=_[_0x1980('0xa3')](_0x479490[_0x1980('0xa1')],{'$or':_['map'](_0x455b63,function(_0x5c5f7b){if(_0x5c5f7b[_0x1980('0xf')][_0x1980('0xa4')]!==_0x1980('0xa5')){var _0x57e3dd={};_0x57e3dd[_0x5c5f7b[_0x1980('0x4')]]={'$like':'%'+_0xb1518['query']['filter']+'%'};return _0x57e3dd;}})});}var _0x27d4e2=[];var _0x5cfef9=null;var _0x3edef2={};if(_0x23fe2e){_0x5cfef9=_[_0x1980('0x91')](_0x2cd562,[_0x1980('0x2e'),_0x23fe2e['name']]);if(_0x5cfef9[_0x1980('0x4')]){_0x3edef2={};if(_0x7afa63[_0x1980('0x12')]===_0x1980('0xd')){_0x3edef2[_0x5cfef9[_0x1980('0xa6')]]=_['map'](_0x23fe2e[_0x1980('0x7')],'id');}else{_0x3edef2[_0x5cfef9['foreignKey']]=_0x23fe2e[_0x1980('0x7')];}_0x27d4e2[_0x1980('0x8f')](_0x3edef2);}else{_0x479490[_0x1980('0xa1')]['id']=_0x23fe2e[_0x1980('0x7')];}}else{for(var _0x1a24bc=0x0;_0x1a24bc<_0x149a25[_0x1980('0x8e')];_0x1a24bc++){_0x5cfef9=_[_0x1980('0x91')](_0x2cd562,[_0x1980('0x2e'),_0x149a25[_0x1a24bc][_0x1980('0x2e')]]);if(_0x5cfef9['field']){_0x3edef2={};_0x3edef2[_0x5cfef9[_0x1980('0xa6')]]=_0x149a25[_0x1a24bc]['associatedResources'];_0x27d4e2[_0x1980('0x8f')](_0x3edef2);}else{if(!_0x479490['where']['id'])_0x479490[_0x1980('0xa1')]['id']=[];_0x149a25[_0x1a24bc]['associatedResources'][_0x1980('0xa7')](function(_0x42b93e){_0x479490[_0x1980('0xa1')]['id']['push'](_0x42b93e);});}}}if(!_['isEmpty'](_0x27d4e2)){_0x479490[_0x1980('0xa1')]=_[_0x1980('0xa3')](_0x479490[_0x1980('0xa1')],{'$and':{'$or':_0x27d4e2}});}_0x479490=_[_0x1980('0xa3')]({},_0x479490,_0xb1518['options']);if(_0x23fe2e&&!_0x23fe2e[_0x1980('0xa8')]&&_0x7afa63[_0x1980('0x12')]===_0x1980('0xd')){if(_0xb1518[_0x1980('0x85')][_0x1980('0xa9')]){_0x479490[_0x1980('0xaa')]=[{'all':!![]}];}return _0x3639e5[_0x7afa63[_0x1980('0x12')]][_0x1980('0x6')](_0x479490)['then'](function(_0x2d6142){var _0x5bfcf3=[];_0x2d6142['forEach'](function(_0x50bf6b){var _0x25286e;switch(_0x50bf6b[_0x1980('0xab')]){case'default':_0x25286e=_[_0x1980('0x91')](_0x23fe2e[_0x1980('0x7')],function(_0x41b3d0){return _0x41b3d0['id']===_0x50bf6b[_0x1980('0x75')]&&_0x41b3d0[_0x1980('0xf')]==='DefaultReports';});break;case _0x1980('0xac'):_0x25286e=_[_0x1980('0x91')](_0x23fe2e[_0x1980('0x7')],function(_0x19190e){return _0x19190e['id']===_0x50bf6b[_0x1980('0x75')]&&_0x19190e[_0x1980('0xf')]===_0x1980('0xad');});break;}if(_0x25286e)_0x5bfcf3['push'](_0x50bf6b);});_0x3887f4['count']=_0x5bfcf3['length'];_0x3887f4['rows']=_0x5bfcf3;return _0x3887f4;});}else{if(!_[_0x1980('0x95')](_0xb1518[_0x1980('0x85')][_0x1980('0xae')])){_0x479490['where']['id']=_0x479490[_0x1980('0xa1')]['id']?_['intersection'](_0x479490[_0x1980('0xa1')]['id'],_0xb1518['query'][_0x1980('0xae')]):_0xb1518[_0x1980('0x85')]['ids'];if(_0xb1518[_0x1980('0x85')]['customSorting']){_0x479490['order']=_0xb1518[_0x1980('0x85')][_0x1980('0xaf')];}}if(_0xb1518[_0x1980('0x85')][_0x1980('0xb0')]){_0x479490[_0x1980('0xa1')]=_[_0x1980('0xa3')](_0x479490[_0x1980('0xa1')],{'$and':_0xb1518['query']['extraQueryConditions']});}return _0x3639e5[_0x7afa63[_0x1980('0x12')]]['count']({'where':_0x479490['where']})[_0x1980('0xc')](function(_0x5d7e0e){_0x3887f4['count']=_0x5d7e0e;if(_0xb1518[_0x1980('0x85')]['includeAll']){if(_0x7afa63['childModel']===_0x1980('0x18')){_0x479490[_0x1980('0xaa')]=[{'model':_0x3639e5[_0x1980('0x6a')],'as':_0x1980('0xb1'),'attributes':['id',_0x1980('0x2e'),_0x1980('0xb2')],'required':_0xb1518[_0x1980('0x85')][_0x1980('0xb3')]?!![]:![]},{'model':_0x3639e5[_0x1980('0x6a')],'as':'ThroughTags','attributes':['id',_0x1980('0x2e'),'color'],'through':_0xb1518[_0x1980('0x85')][_0x1980('0xb3')]?{'attributes':[],'where':{'TagId':_0xb1518[_0x1980('0x85')][_0x1980('0xb3')]||undefined}}:{},'required':_0xb1518[_0x1980('0x85')][_0x1980('0xb3')]?!![]:![]}];}else{_0x479490[_0x1980('0xaa')]=[{'all':!![]}];}}return _0x3639e5[_0x7afa63[_0x1980('0x12')]][_0x1980('0x6')](_0x479490);})[_0x1980('0xc')](function(_0x10ed50){_0x3887f4[_0x1980('0xb4')]=_0x10ed50;if(_0x38e032===_0x1980('0x2d')&&_0xb1518[_0x1980('0x85')][_0x1980('0xb5')]==='true'){var _0x23765d=[];for(var _0x5c91ce=0x0;_0x5c91ce<_0x3887f4['rows'][_0x1980('0x8e')];_0x5c91ce++){_0x23765d[_0x1980('0x8f')](_0x2a709c('chat',_0x3887f4[_0x1980('0xb4')][_0x5c91ce][_0x1980('0xb6')]));_0x23765d[_0x1980('0x8f')](_0x2a709c(_0x1980('0xb7'),_0x3887f4[_0x1980('0xb4')][_0x5c91ce][_0x1980('0xb6')]));_0x23765d[_0x1980('0x8f')](_0x2a709c('fax',_0x3887f4['rows'][_0x5c91ce][_0x1980('0xb6')]));_0x23765d['push'](_0x2a709c('mail',_0x3887f4['rows'][_0x5c91ce][_0x1980('0xb6')]));_0x23765d[_0x1980('0x8f')](_0x2a709c('openchannel',_0x3887f4['rows'][_0x5c91ce][_0x1980('0xb6')]));_0x23765d[_0x1980('0x8f')](_0x2a709c(_0x1980('0xb8'),_0x3887f4[_0x1980('0xb4')][_0x5c91ce][_0x1980('0xb6')]));}return Promise[_0x1980('0x93')](_0x23765d)[_0x1980('0xc')](function(){return _0x3887f4;});}return _0x3887f4;});}});}}});}; \ No newline at end of file +var _0xcbbd=['voicequeues','VoiceQueues','QueueCampaigns','users','telephones','Users','admin','user','salesforceaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','customdashboards','Dashboard','intervals','Interval','Pause','Schedule','sounds','Sound','Tag','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','AnalyticExtractedReport','Reports','reportId','metrics','AnalyticMetric','charAt','slice','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','_interactions','where','ui.UserId\x20=\x20?','query','toString','OpenTabs','define','UserProfile','../../components/parsers/qs','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','params','all','union','find','ignore','autoAssociation','rawAttributes','filters','attributes','intersection','fields','hasOwnProperty','limit','offset','sort','pick','merge','VIRTUAL','foreignKey','forEach','reportType','default','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','order','extraQueryConditions','Tags','color','tag','include','openTabs','true','chat','dataValues','sms','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','field','then','associatedResources','map','catch','value','model','findAll','UserProfileResource','resourceId','type','toLowerCase','squareprojects','SquareProject','odbc','childModel','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','name','JscriptyProject','CmContact','ListId','lists','companies','CmCompany','ChatQueue','chatwebsites','FaxQueue','FaxAccount','inboundroutes','contexts','voicemails','VoiceMail','voicerecordings','Agents','User','agent','Telephones','membername','role','telephone','queue','VoiceQueue','inbound','outbound','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','MailSubstatus','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams'];(function(_0xeb034b,_0x1023ad){var _0x59edad=function(_0x3a611c){while(--_0x3a611c){_0xeb034b['push'](_0xeb034b['shift']());}};_0x59edad(++_0x1023ad);}(_0xcbbd,0x123));var _0xdcbb=function(_0x2e914,_0x1c7566){_0x2e914=_0x2e914-0x0;var _0x936e45=_0xcbbd[_0x2e914];return _0x936e45;};'use strict';var _=require(_0xdcbb('0x0'));var attributes=require(_0xdcbb('0x1'));var squel=require(_0xdcbb('0x2'));module[_0xdcbb('0x3')]=function(_0x33e6b0){var _0x20d284=_0x33e6b0[_0xdcbb('0x4')];function _0x166dac(_0xd07a8,_0x1f489d){return new Promise(function(_0x1ffcee,_0x43ffad){if(!_0x1f489d)return _0x1ffcee(null);var _0x350a21=_0x1f489d[_0xdcbb('0x5')]?{[_0x1f489d['filter'][_0xdcbb('0x6')]]:_0x1f489d[_0xdcbb('0x5')]['value']}:undefined;return _0x20d284[_0xd07a8]['findAll']({'where':_0x350a21,'raw':!![]})[_0xdcbb('0x7')](function(_0x5798b4){_0x1f489d[_0xdcbb('0x8')]=_[_0xdcbb('0x9')](_0x5798b4,'id');_0x1ffcee(_0x1f489d);})[_0xdcbb('0xa')](function(_0x118d6f){_0x43ffad(_0x118d6f);});});}function _0x341975(_0x842eb3,_0x334c00){return new Promise(function(_0x14b5ba,_0x287ce1){var _0x42d6f1=_0x842eb3[_0xdcbb('0x5')]?{[_0x842eb3[_0xdcbb('0x5')]['field']]:_0x842eb3['filter'][_0xdcbb('0xb')]}:undefined;return _0x20d284[_0x842eb3[_0xdcbb('0xc')]][_0xdcbb('0xd')]({'where':_0x42d6f1,'raw':!![]})[_0xdcbb('0x7')](function(_0x183153){_0x334c00[_0xdcbb('0x8')]=_[_0xdcbb('0x9')](_0x183153,function(_0x2f525b){return _0x2f525b['name'];});_0x14b5ba(_0x334c00);})['catch'](function(_0x3c5618){_0x287ce1(_0x3c5618);});});}function _0x6dd939(_0x4dbed9,_0x5d22ef,_0x4eb93a){if(!_0x5d22ef)return Promise['resolve'](null);return new Promise(function(_0x59536b,_0x1d7f09){return _0x20d284[_0xdcbb('0xe')][_0xdcbb('0xd')]({'where':{'sectionId':_0x5d22ef['id']},'raw':!![]})[_0xdcbb('0x7')](function(_0x1cc3ed){if(_0x4dbed9[_0xdcbb('0x6')]&&_0x4dbed9[_0xdcbb('0x6')]!=='id'){_0x5d22ef[_0xdcbb('0x8')]=_[_0xdcbb('0x9')](_0x1cc3ed,function(_0x253e0c){return _0x253e0c[_0x4dbed9['field']];});}else{if(_0x4eb93a==='AnalyticExtractedReport'){_0x5d22ef[_0xdcbb('0x8')]=_['map'](_0x1cc3ed,function(_0x481f33){return{'id':_0x481f33[_0xdcbb('0xf')],'type':_0x481f33[_0xdcbb('0x10')]};});}else{_0x5d22ef[_0xdcbb('0x8')]=_['map'](_0x1cc3ed,function(_0x4dd679){return _0x4dd679[_0xdcbb('0xf')];});}}_0x59536b(_0x5d22ef);})['catch'](function(_0x200327){_0x1d7f09(_0x200327);});});}function _0x1fe2b2(_0x3df03c,_0x24245c){var _0x3018e7={'parentSections':[]};switch(_0x3df03c[_0xdcbb('0x11')]()){case _0xdcbb('0x12'):_0x3018e7['childModel']=_0xdcbb('0x13');break;case _0xdcbb('0x14'):_0x3018e7[_0xdcbb('0x15')]=_0xdcbb('0x16');break;case _0xdcbb('0x17'):_0x3018e7[_0xdcbb('0x15')]=_0xdcbb('0x18');_0x3018e7[_0xdcbb('0x19')]=[{'name':_0xdcbb('0x1a'),'field':_0xdcbb('0x1b'),'foreignKey':'projectName'}];break;case'projects':_0x3018e7[_0xdcbb('0x15')]=_0xdcbb('0x1c');break;case'contacts':_0x3018e7['childModel']=_0xdcbb('0x1d');_0x3018e7[_0xdcbb('0x19')]=[{'name':'Lists','field':'id','foreignKey':_0xdcbb('0x1e')}];break;case _0xdcbb('0x1f'):_0x3018e7[_0xdcbb('0x15')]='CmList';break;case _0xdcbb('0x20'):_0x3018e7[_0xdcbb('0x15')]=_0xdcbb('0x21');break;case'globalcustomfields':_0x3018e7['childModel']='CmCustomField';break;case'chatqueues':_0x3018e7[_0xdcbb('0x15')]=_0xdcbb('0x22');break;case _0xdcbb('0x23'):_0x3018e7[_0xdcbb('0x15')]='ChatWebsite';break;case'faxqueues':_0x3018e7[_0xdcbb('0x15')]=_0xdcbb('0x24');break;case'faxaccounts':_0x3018e7[_0xdcbb('0x15')]=_0xdcbb('0x25');break;case _0xdcbb('0x26'):case'internalroutes':case'outboundroutes':_0x3018e7[_0xdcbb('0x15')]='VoiceExtension';break;case _0xdcbb('0x27'):_0x3018e7[_0xdcbb('0x15')]='VoiceContext';break;case _0xdcbb('0x28'):_0x3018e7[_0xdcbb('0x15')]=_0xdcbb('0x29');break;case _0xdcbb('0x2a'):_0x3018e7['childModel']='VoiceRecording';_0x3018e7[_0xdcbb('0x19')]=[{'name':_0xdcbb('0x2b'),'field':'name','foreignKey':'membername','model':_0xdcbb('0x2c'),'filter':{'field':'role','value':[_0xdcbb('0x2d')]}},{'name':_0xdcbb('0x2e'),'field':_0xdcbb('0x1b'),'foreignKey':_0xdcbb('0x2f'),'model':_0xdcbb('0x2c'),'filter':{'field':_0xdcbb('0x30'),'value':[_0xdcbb('0x31')]}},{'name':'VoiceQueues','field':_0xdcbb('0x1b'),'foreignKey':_0xdcbb('0x32'),'model':_0xdcbb('0x33'),'filter':{'field':_0xdcbb('0x10'),'value':[_0xdcbb('0x34')]}},{'name':'QueueCampaigns','field':_0xdcbb('0x1b'),'foreignKey':_0xdcbb('0x32'),'model':_0xdcbb('0x33'),'filter':{'field':_0xdcbb('0x10'),'value':[_0xdcbb('0x35')]}}];break;case _0xdcbb('0x36'):_0x3018e7[_0xdcbb('0x15')]=_0xdcbb('0x37');break;case _0xdcbb('0x38'):_0x3018e7[_0xdcbb('0x15')]='VoiceChanSpy';break;case _0xdcbb('0x39'):_0x3018e7[_0xdcbb('0x15')]=_0xdcbb('0x3a');break;case _0xdcbb('0x3b'):_0x3018e7['childModel']=_0xdcbb('0x3c');break;case'mailqueues':_0x3018e7[_0xdcbb('0x15')]=_0xdcbb('0x3d');break;case _0xdcbb('0x3e'):_0x3018e7[_0xdcbb('0x15')]=_0xdcbb('0x3f');break;case'mailsubstatuses':_0x3018e7['childModel']=_0xdcbb('0x40');break;case'openchannelqueues':_0x3018e7[_0xdcbb('0x15')]=_0xdcbb('0x41');break;case'openchannelaccounts':_0x3018e7[_0xdcbb('0x15')]=_0xdcbb('0x42');break;case _0xdcbb('0x43'):_0x3018e7['childModel']=_0xdcbb('0x44');break;case _0xdcbb('0x45'):_0x3018e7[_0xdcbb('0x15')]='SmsAccount';break;case _0xdcbb('0x46'):_0x3018e7[_0xdcbb('0x15')]=_0xdcbb('0x47');break;case _0xdcbb('0x48'):_0x3018e7[_0xdcbb('0x15')]=_0xdcbb('0x49');break;case _0xdcbb('0x4a'):_0x3018e7[_0xdcbb('0x15')]='Team';break;case _0xdcbb('0x4b'):case'queuecampaigns':_0x3018e7['childModel']=_0xdcbb('0x33');if(_0x24245c){_0x3018e7[_0xdcbb('0x19')]=[{'name':_0xdcbb('0x4c')},{'name':_0xdcbb('0x4d')}];}break;case _0xdcbb('0x4e'):case'agents':case _0xdcbb('0x4f'):_0x3018e7[_0xdcbb('0x15')]=_0xdcbb('0x2c');if(_0x24245c){_0x3018e7[_0xdcbb('0x19')]=[{'name':_0xdcbb('0x50'),'filter':{'field':_0xdcbb('0x30'),'value':[_0xdcbb('0x51'),_0xdcbb('0x52')]},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case'zendeskaccounts':_0x3018e7[_0xdcbb('0x15')]='ZendeskAccount';break;case _0xdcbb('0x53'):_0x3018e7[_0xdcbb('0x15')]='SalesforceAccount';break;case'freshdeskaccounts':_0x3018e7[_0xdcbb('0x15')]=_0xdcbb('0x54');break;case _0xdcbb('0x55'):_0x3018e7[_0xdcbb('0x15')]=_0xdcbb('0x56');break;case _0xdcbb('0x57'):_0x3018e7[_0xdcbb('0x15')]=_0xdcbb('0x58');break;case _0xdcbb('0x59'):_0x3018e7[_0xdcbb('0x15')]='ZohoAccount';break;case _0xdcbb('0x5a'):_0x3018e7['childModel']=_0xdcbb('0x2c');break;case _0xdcbb('0x5b'):_0x3018e7[_0xdcbb('0x15')]=_0xdcbb('0x5c');break;case _0xdcbb('0x5d'):_0x3018e7[_0xdcbb('0x15')]='Disposition';break;case _0xdcbb('0x5e'):_0x3018e7['childModel']=_0xdcbb('0x5f');break;case _0xdcbb('0x60'):_0x3018e7[_0xdcbb('0x15')]=_0xdcbb('0x61');break;case'pauses':_0x3018e7[_0xdcbb('0x15')]=_0xdcbb('0x62');break;case'scheduler':_0x3018e7[_0xdcbb('0x15')]=_0xdcbb('0x63');break;case _0xdcbb('0x64'):_0x3018e7[_0xdcbb('0x15')]=_0xdcbb('0x65');break;case'tags':_0x3018e7[_0xdcbb('0x15')]=_0xdcbb('0x66');break;case'templates':_0x3018e7[_0xdcbb('0x15')]='Template';break;case _0xdcbb('0x67'):_0x3018e7[_0xdcbb('0x15')]=_0xdcbb('0x68');break;case _0xdcbb('0x69'):_0x3018e7['childModel']=_0xdcbb('0x6a');break;case _0xdcbb('0x6b'):_0x3018e7[_0xdcbb('0x15')]=_0xdcbb('0x6c');break;case _0xdcbb('0x6d'):_0x3018e7[_0xdcbb('0x15')]=_0xdcbb('0x6e');break;case'extractedreports':_0x3018e7[_0xdcbb('0x15')]=_0xdcbb('0x6f');_0x3018e7[_0xdcbb('0x19')]=[{'name':_0xdcbb('0x70'),'field':'id','foreignKey':_0xdcbb('0x71')}];break;case _0xdcbb('0x72'):_0x3018e7['childModel']=_0xdcbb('0x73');break;}return _0x3018e7;}function _0x5d0ef2(_0x44c55d,_0x5221af){var _0x3de79f=_0x44c55d[_0xdcbb('0x74')](0x0)['toUpperCase']()+_0x44c55d[_0xdcbb('0x75')](0x1);var _0x57b365={'type':_0x20d284['Sequelize'][_0xdcbb('0x76')][_0xdcbb('0x77')],'raw':!![]};return new Promise(function(_0x41d3d8,_0x336f1f){var _0x28ec60=squel[_0xdcbb('0x78')]()['field'](_0xdcbb('0x79')+_0x3de79f+_0xdcbb('0x7a'),'id')[_0xdcbb('0x6')](_0xdcbb('0x7b'))['from']('user_has_'+_0x44c55d+_0xdcbb('0x7c'),'ui')[_0xdcbb('0x7d')](_0xdcbb('0x7e'),_0x5221af['id']);return _0x20d284['sequelize'][_0xdcbb('0x7f')](_0x28ec60[_0xdcbb('0x80')](),_0x57b365)[_0xdcbb('0x7')](function(_0xf7c777){_0x5221af[_0x3de79f+_0xdcbb('0x81')]=_0xf7c777;_0x41d3d8(_0xf7c777);})[_0xdcbb('0xa')](function(_0x4560ad){_0x336f1f(_0x4560ad);});});}return _0x33e6b0[_0xdcbb('0x82')](_0xdcbb('0x83'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x263252){var _0x3d2b41=require(_0xdcbb('0x84'));var _0x4d2ec3={'raw':_0x263252[_0xdcbb('0x7f')]['raw'],'where':{}};var _0x5273a1={};var _0x43c253={'count':0x0,'rows':[]};var _0x222423=_0x263252[_0xdcbb('0x7f')][_0xdcbb('0x85')];var _0xbf9655=_0x263252[_0xdcbb('0x7f')][_0xdcbb('0x86')]||![];var _0x51a163=_0x1fe2b2(_0x222423,_0xbf9655);if(!_0x51a163[_0xdcbb('0x15')])throw new Error(_0xdcbb('0x87')+_0x222423+'\x27');var _0x1b3249=[{'name':_0x222423}];if(!_[_0xdcbb('0x88')](_0x51a163[_0xdcbb('0x19')]))_0x1b3249=_0x51a163[_0xdcbb('0x19')];var _0x1e10fd=[];for(var _0x372923=0x0;_0x372923<_0x1b3249[_0xdcbb('0x89')];_0x372923++){_0x1e10fd[_0xdcbb('0x8a')](_0x20d284[_0xdcbb('0x8b')]['find']({'where':{'userProfileId':_0x263252[_0xdcbb('0x8c')]['id'],'name':_0x1b3249[_0x372923]['name']},'raw':!![]}));}return Promise[_0xdcbb('0x8d')](_0x1e10fd)['then'](function(_0x56ae52){var _0x3898cd=_[_0xdcbb('0x5')](_0x56ae52,function(_0x20e2fe){return _0x20e2fe?_0x20e2fe:undefined;});var _0x590509=_['filter'](_0x1b3249,['ignore',!![]]);var _0x273d4d=_['isEmpty'](_0x3898cd)&&_[_0xdcbb('0x88')](_0x590509)?null:_[_0xdcbb('0x8e')](_0x590509,_0x3898cd);if(!_0x273d4d)return null;var _0x52fa3e=[];for(var _0x575181=0x0;_0x575181<_0x273d4d['length'];_0x575181++){var _0x1ed8b8=_[_0xdcbb('0x8f')](_0x1b3249,function(_0x414473){return _0x273d4d[_0x575181]?_0x414473[_0xdcbb('0x1b')]===_0x273d4d[_0x575181][_0xdcbb('0x1b')]:null;});if(_0x1ed8b8){if(_0x273d4d[_0x575181][_0xdcbb('0x90')]){_0x52fa3e[_0xdcbb('0x8a')](_0x166dac(_0x51a163[_0xdcbb('0x15')],_0x273d4d[_0x575181]));}else{if(!_0x273d4d[_0x575181][_0xdcbb('0x91')]){_0x52fa3e[_0xdcbb('0x8a')](_0x6dd939(_0x1ed8b8,_0x273d4d[_0x575181],_0x51a163[_0xdcbb('0x15')]));}else{if(_0x1ed8b8[_0xdcbb('0xc')]){_0x52fa3e[_0xdcbb('0x8a')](_0x341975(_0x1ed8b8,_0x273d4d[_0x575181]));}}}}}return Promise[_0xdcbb('0x8d')](_0x52fa3e);})[_0xdcbb('0x7')](function(_0x5c57ed){var _0x837533=_0x5c57ed;var _0x3cae1d=null;if(_0x837533){_0x3cae1d=_0x837533[_0xdcbb('0x89')]===0x1?_0x837533[0x0]:null;}if(!_0x3cae1d&&!_0x837533)return _0x43c253;var _0x236a79=_0x20d284[_0x51a163[_0xdcbb('0x15')]][_0xdcbb('0x92')];_0x5273a1[_0xdcbb('0xc')]=_['keys'](_0x236a79);_0x5273a1[_0xdcbb('0x7f')]=_['keys'](_0x263252[_0xdcbb('0x7f')]);_0x5273a1[_0xdcbb('0x93')]=_['intersection'](_0x5273a1[_0xdcbb('0xc')],_0x5273a1[_0xdcbb('0x7f')]);_0x4d2ec3[_0xdcbb('0x94')]=_[_0xdcbb('0x95')](_0x5273a1[_0xdcbb('0xc')],_0x3d2b41[_0xdcbb('0x96')](_0x263252[_0xdcbb('0x7f')][_0xdcbb('0x96')]));_0x4d2ec3[_0xdcbb('0x94')]=_0x4d2ec3[_0xdcbb('0x94')][_0xdcbb('0x89')]?_0x4d2ec3[_0xdcbb('0x94')]:_0x5273a1[_0xdcbb('0xc')];if(!_0x263252['query'][_0xdcbb('0x97')]('nolimit')){_0x4d2ec3[_0xdcbb('0x98')]=_0x3d2b41['limit'](_0x263252[_0xdcbb('0x7f')][_0xdcbb('0x98')]);_0x4d2ec3[_0xdcbb('0x99')]=_0x3d2b41[_0xdcbb('0x99')](_0x263252[_0xdcbb('0x7f')]['offset']);}_0x4d2ec3['order']=_0x3d2b41[_0xdcbb('0x9a')](_0x263252[_0xdcbb('0x7f')][_0xdcbb('0x9a')]);_0x4d2ec3[_0xdcbb('0x7d')]=_0x3d2b41[_0xdcbb('0x93')](_[_0xdcbb('0x9b')](_0x263252[_0xdcbb('0x7f')],_0x5273a1[_0xdcbb('0x93')]));if(_0x263252[_0xdcbb('0x7f')][_0xdcbb('0x5')]){_0x4d2ec3['where']=_[_0xdcbb('0x9c')](_0x4d2ec3['where'],{'$or':_['map'](_0x236a79,function(_0x14bf6a){if(_0x14bf6a[_0xdcbb('0x10')]['key']!==_0xdcbb('0x9d')){var _0x4a8699={};_0x4a8699[_0x14bf6a[_0xdcbb('0x6')]]={'$like':'%'+_0x263252[_0xdcbb('0x7f')][_0xdcbb('0x5')]+'%'};return _0x4a8699;}})});}var _0xdbdaac=[];var _0x131ed5=null;var _0x138351={};if(_0x3cae1d){_0x131ed5=_[_0xdcbb('0x8f')](_0x1b3249,[_0xdcbb('0x1b'),_0x3cae1d[_0xdcbb('0x1b')]]);if(_0x131ed5[_0xdcbb('0x6')]){_0x138351={};if(_0x51a163['childModel']===_0xdcbb('0x6f')){_0x138351[_0x131ed5[_0xdcbb('0x9e')]]=_['map'](_0x3cae1d[_0xdcbb('0x8')],'id');}else{_0x138351[_0x131ed5[_0xdcbb('0x9e')]]=_0x3cae1d[_0xdcbb('0x8')];}_0xdbdaac[_0xdcbb('0x8a')](_0x138351);}else{_0x4d2ec3[_0xdcbb('0x7d')]['id']=_0x3cae1d[_0xdcbb('0x8')];}}else{for(var _0xd6ebbe=0x0;_0xd6ebbe<_0x837533['length'];_0xd6ebbe++){_0x131ed5=_[_0xdcbb('0x8f')](_0x1b3249,['name',_0x837533[_0xd6ebbe][_0xdcbb('0x1b')]]);if(_0x131ed5[_0xdcbb('0x6')]){_0x138351={};_0x138351[_0x131ed5['foreignKey']]=_0x837533[_0xd6ebbe][_0xdcbb('0x8')];_0xdbdaac['push'](_0x138351);}else{if(!_0x4d2ec3['where']['id'])_0x4d2ec3['where']['id']=[];_0x837533[_0xd6ebbe][_0xdcbb('0x8')]['forEach'](function(_0xc58fcd){_0x4d2ec3[_0xdcbb('0x7d')]['id'][_0xdcbb('0x8a')](_0xc58fcd);});}}}if(!_['isEmpty'](_0xdbdaac)){_0x4d2ec3[_0xdcbb('0x7d')]=_['merge'](_0x4d2ec3[_0xdcbb('0x7d')],{'$and':{'$or':_0xdbdaac}});}_0x4d2ec3=_[_0xdcbb('0x9c')]({},_0x4d2ec3,_0x263252['options']);if(_0x3cae1d&&!_0x3cae1d[_0xdcbb('0x91')]&&_0x51a163[_0xdcbb('0x15')]===_0xdcbb('0x6f')){if(_0x263252[_0xdcbb('0x7f')]['includeAll']){_0x4d2ec3['include']=[{'all':!![]}];}return _0x20d284[_0x51a163[_0xdcbb('0x15')]][_0xdcbb('0xd')](_0x4d2ec3)[_0xdcbb('0x7')](function(_0x2955ce){var _0x42c9f8=[];_0x2955ce[_0xdcbb('0x9f')](function(_0x7e97ba){var _0x2f5eb8;switch(_0x7e97ba[_0xdcbb('0xa0')]){case _0xdcbb('0xa1'):_0x2f5eb8=_[_0xdcbb('0x8f')](_0x3cae1d[_0xdcbb('0x8')],function(_0x44c5bd){return _0x44c5bd['id']===_0x7e97ba[_0xdcbb('0x71')]&&_0x44c5bd[_0xdcbb('0x10')]===_0xdcbb('0xa2');});break;case _0xdcbb('0xa3'):_0x2f5eb8=_[_0xdcbb('0x8f')](_0x3cae1d[_0xdcbb('0x8')],function(_0x3918c8){return _0x3918c8['id']===_0x7e97ba[_0xdcbb('0x71')]&&_0x3918c8['type']===_0xdcbb('0xa4');});break;}if(_0x2f5eb8)_0x42c9f8[_0xdcbb('0x8a')](_0x7e97ba);});_0x43c253[_0xdcbb('0xa5')]=_0x42c9f8[_0xdcbb('0x89')];_0x43c253[_0xdcbb('0xa6')]=_0x42c9f8;return _0x43c253;});}else{if(!_[_0xdcbb('0x88')](_0x263252[_0xdcbb('0x7f')][_0xdcbb('0xa7')])){_0x4d2ec3[_0xdcbb('0x7d')]['id']=_0x4d2ec3[_0xdcbb('0x7d')]['id']?_[_0xdcbb('0x95')](_0x4d2ec3[_0xdcbb('0x7d')]['id'],_0x263252[_0xdcbb('0x7f')]['ids']):_0x263252[_0xdcbb('0x7f')][_0xdcbb('0xa7')];if(_0x263252[_0xdcbb('0x7f')][_0xdcbb('0xa8')]){_0x4d2ec3[_0xdcbb('0xa9')]=_0x263252[_0xdcbb('0x7f')][_0xdcbb('0xa8')];}}if(_0x263252[_0xdcbb('0x7f')][_0xdcbb('0xaa')]){_0x4d2ec3[_0xdcbb('0x7d')]=_[_0xdcbb('0x9c')](_0x4d2ec3[_0xdcbb('0x7d')],{'$and':_0x263252[_0xdcbb('0x7f')]['extraQueryConditions']});}return _0x20d284[_0x51a163[_0xdcbb('0x15')]]['count']({'where':_0x4d2ec3[_0xdcbb('0x7d')]})[_0xdcbb('0x7')](function(_0x30bc44){_0x43c253[_0xdcbb('0xa5')]=_0x30bc44;if(_0x263252[_0xdcbb('0x7f')]['includeAll']){if(_0x51a163[_0xdcbb('0x15')]===_0xdcbb('0x1d')){_0x4d2ec3['include']=[{'model':_0x20d284['Tag'],'as':_0xdcbb('0xab'),'attributes':['id',_0xdcbb('0x1b'),_0xdcbb('0xac')],'required':_0x263252['query'][_0xdcbb('0xad')]?!![]:![]},{'model':_0x20d284[_0xdcbb('0x66')],'as':'ThroughTags','attributes':['id',_0xdcbb('0x1b'),_0xdcbb('0xac')],'through':_0x263252[_0xdcbb('0x7f')][_0xdcbb('0xad')]?{'attributes':[],'where':{'TagId':_0x263252[_0xdcbb('0x7f')]['tag']||undefined}}:{},'required':_0x263252[_0xdcbb('0x7f')]['tag']?!![]:![]}];}else{_0x4d2ec3[_0xdcbb('0xae')]=[{'all':!![]}];}}return _0x20d284[_0x51a163[_0xdcbb('0x15')]]['findAll'](_0x4d2ec3);})[_0xdcbb('0x7')](function(_0x1b368c){_0x43c253[_0xdcbb('0xa6')]=_0x1b368c;if(_0x222423==='Agents'&&_0x263252['query'][_0xdcbb('0xaf')]===_0xdcbb('0xb0')){var _0x38e762=[];for(var _0x1ae6de=0x0;_0x1ae6de<_0x43c253[_0xdcbb('0xa6')][_0xdcbb('0x89')];_0x1ae6de++){_0x38e762['push'](_0x5d0ef2(_0xdcbb('0xb1'),_0x43c253[_0xdcbb('0xa6')][_0x1ae6de][_0xdcbb('0xb2')]));_0x38e762[_0xdcbb('0x8a')](_0x5d0ef2(_0xdcbb('0xb3'),_0x43c253['rows'][_0x1ae6de][_0xdcbb('0xb2')]));_0x38e762[_0xdcbb('0x8a')](_0x5d0ef2('fax',_0x43c253[_0xdcbb('0xa6')][_0x1ae6de][_0xdcbb('0xb2')]));_0x38e762['push'](_0x5d0ef2(_0xdcbb('0xb4'),_0x43c253['rows'][_0x1ae6de][_0xdcbb('0xb2')]));_0x38e762[_0xdcbb('0x8a')](_0x5d0ef2(_0xdcbb('0xb5'),_0x43c253[_0xdcbb('0xa6')][_0x1ae6de][_0xdcbb('0xb2')]));_0x38e762[_0xdcbb('0x8a')](_0x5d0ef2(_0xdcbb('0xb6'),_0x43c253[_0xdcbb('0xa6')][_0x1ae6de][_0xdcbb('0xb2')]));}return Promise[_0xdcbb('0x8d')](_0x38e762)[_0xdcbb('0x7')](function(){return _0x43c253;});}return _0x43c253;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 2650539..bb1ee27 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 _0xa7be=['then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','request'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa7be,0xfd));var _0xea7b=function(_0x3736d3,_0x1e2839){_0x3736d3=_0x3736d3-0x0;var _0x15fc1b=_0xa7be[_0x3736d3];return _0x15fc1b;};'use strict';var _=require(_0xea7b('0x0'));var util=require(_0xea7b('0x1'));var moment=require(_0xea7b('0x2'));var BPromise=require(_0xea7b('0x3'));var rs=require(_0xea7b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xea7b('0x5'));var logger=require(_0xea7b('0x6'))(_0xea7b('0x7'));var config=require('../../config/environment');var jayson=require(_0xea7b('0x8'));var client=jayson[_0xea7b('0x9')][_0xea7b('0xa')]({'port':0x232a});config[_0xea7b('0xb')]=_[_0xea7b('0xc')](config[_0xea7b('0xb')],{'host':_0xea7b('0xd'),'port':0x18eb});var socket=require(_0xea7b('0xe'))(new Redis(config[_0xea7b('0xb')]));require(_0xea7b('0xf'))['register'](socket);function respondWithRpcPromise(_0x413c1b,_0x13bdcf,_0x37e035){return new BPromise(function(_0x3675a9,_0x4de636){return client[_0xea7b('0x10')](_0x413c1b,_0x37e035)[_0xea7b('0x11')](function(_0x4a5b29){logger[_0xea7b('0x12')](_0xea7b('0x13'),_0x13bdcf,_0xea7b('0x14'));logger[_0xea7b('0x15')](_0xea7b('0x16'),_0x13bdcf,_0xea7b('0x14'),JSON[_0xea7b('0x17')](_0x4a5b29));if(_0x4a5b29[_0xea7b('0x18')]){if(_0x4a5b29['error']['code']===0x1f4){logger[_0xea7b('0x18')]('UserProfile,\x20%s,\x20%s',_0x13bdcf,_0x4a5b29[_0xea7b('0x18')][_0xea7b('0x19')]);return _0x4de636(_0x4a5b29['error']['message']);}logger[_0xea7b('0x18')]('UserProfile,\x20%s,\x20%s',_0x13bdcf,_0x4a5b29[_0xea7b('0x18')][_0xea7b('0x19')]);return _0x3675a9(_0x4a5b29[_0xea7b('0x18')][_0xea7b('0x19')]);}else{logger[_0xea7b('0x12')]('UserProfile,\x20%s,\x20%s',_0x13bdcf,_0xea7b('0x14'));_0x3675a9(_0x4a5b29[_0xea7b('0x1a')][_0xea7b('0x19')]);}})['catch'](function(_0x1d7c67){logger[_0xea7b('0x18')]('UserProfile,\x20%s,\x20%s',_0x13bdcf,_0x1d7c67);_0x4de636(_0x1d7c67);});});} \ No newline at end of file +var _0x09d2=['jayson/promise','client','http','redis','defaults','socket.io-emitter','./userProfile.socket','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x51ba0c,_0x29048a){var _0xd578f9=function(_0x2aea37){while(--_0x2aea37){_0x51ba0c['push'](_0x51ba0c['shift']());}};_0xd578f9(++_0x29048a);}(_0x09d2,0x1d2));var _0x209d=function(_0x7b6b3f,_0x1713ee){_0x7b6b3f=_0x7b6b3f-0x0;var _0x10934e=_0x09d2[_0x7b6b3f];return _0x10934e;};'use strict';var _=require(_0x209d('0x0'));var util=require(_0x209d('0x1'));var moment=require(_0x209d('0x2'));var BPromise=require(_0x209d('0x3'));var rs=require(_0x209d('0x4'));var fs=require('fs');var Redis=require(_0x209d('0x5'));var db=require(_0x209d('0x6'))['db'];var utils=require(_0x209d('0x7'));var logger=require(_0x209d('0x8'))(_0x209d('0x9'));var config=require('../../config/environment');var jayson=require(_0x209d('0xa'));var client=jayson[_0x209d('0xb')][_0x209d('0xc')]({'port':0x232a});config[_0x209d('0xd')]=_[_0x209d('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x209d('0xf'))(new Redis(config[_0x209d('0xd')]));require(_0x209d('0x10'))['register'](socket);function respondWithRpcPromise(_0x6b5375,_0x580742,_0x33caba){return new BPromise(function(_0x446eb0,_0x3ee1eb){return client[_0x209d('0x11')](_0x6b5375,_0x33caba)[_0x209d('0x12')](function(_0x30052a){logger[_0x209d('0x13')](_0x209d('0x14'),_0x580742,_0x209d('0x15'));logger[_0x209d('0x16')](_0x209d('0x17'),_0x580742,_0x209d('0x15'),JSON['stringify'](_0x30052a));if(_0x30052a[_0x209d('0x18')]){if(_0x30052a[_0x209d('0x18')][_0x209d('0x19')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x580742,_0x30052a[_0x209d('0x18')]['message']);return _0x3ee1eb(_0x30052a['error'][_0x209d('0x1a')]);}logger[_0x209d('0x18')](_0x209d('0x14'),_0x580742,_0x30052a['error'][_0x209d('0x1a')]);return _0x446eb0(_0x30052a[_0x209d('0x18')][_0x209d('0x1a')]);}else{logger[_0x209d('0x13')]('UserProfile,\x20%s,\x20%s',_0x580742,_0x209d('0x15'));_0x446eb0(_0x30052a[_0x209d('0x1b')][_0x209d('0x1a')]);}})['catch'](function(_0x47daf8){logger[_0x209d('0x18')]('UserProfile,\x20%s,\x20%s',_0x580742,_0x47daf8);_0x3ee1eb(_0x47daf8);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 38d4767..bebd837 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 _0x7cc7=['update','emit','removeListener','register','length','./userProfile.events','remove'];(function(_0x2bcdf9,_0x56f338){var _0x582597=function(_0x20940f){while(--_0x20940f){_0x2bcdf9['push'](_0x2bcdf9['shift']());}};_0x582597(++_0x56f338);}(_0x7cc7,0xc2));var _0x77cc=function(_0x416ac3,_0x52e360){_0x416ac3=_0x416ac3-0x0;var _0x2f7668=_0x7cc7[_0x416ac3];return _0x2f7668;};'use strict';var UserProfileEvents=require(_0x77cc('0x0'));var events=['save',_0x77cc('0x1'),_0x77cc('0x2')];function createListener(_0x5c37df,_0x1ad96c){return function(_0x505b8a){_0x1ad96c[_0x77cc('0x3')](_0x5c37df,_0x505b8a);};}function removeListener(_0x5e2046,_0x349f42){return function(){UserProfileEvents[_0x77cc('0x4')](_0x5e2046,_0x349f42);};}exports[_0x77cc('0x5')]=function(_0x19fec0){for(var _0x5acada=0x0,_0x31ca79=events[_0x77cc('0x6')];_0x5acada<_0x31ca79;_0x5acada++){var _0xce7ccc=events[_0x5acada];var _0x16194c=createListener('userProfile:'+_0xce7ccc,_0x19fec0);UserProfileEvents['on'](_0xce7ccc,_0x16194c);}}; \ No newline at end of file +var _0x6610=['userProfile:','save','remove','update','emit','removeListener'];(function(_0xe80dfa,_0x291dcd){var _0xdcc6b5=function(_0xf1b163){while(--_0xf1b163){_0xe80dfa['push'](_0xe80dfa['shift']());}};_0xdcc6b5(++_0x291dcd);}(_0x6610,0xb5));var _0x0661=function(_0x55c406,_0x1f4ec7){_0x55c406=_0x55c406-0x0;var _0x5638bb=_0x6610[_0x55c406];return _0x5638bb;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x0661('0x0'),_0x0661('0x1'),_0x0661('0x2')];function createListener(_0x2a56fc,_0x171c74){return function(_0x2b39af){_0x171c74[_0x0661('0x3')](_0x2a56fc,_0x2b39af);};}function removeListener(_0x139432,_0x21bac9){return function(){UserProfileEvents[_0x0661('0x4')](_0x139432,_0x21bac9);};}exports['register']=function(_0x4880bb){for(var _0x55e1f2=0x0,_0x2af0de=events['length'];_0x55e1f2<_0x2af0de;_0x55e1f2++){var _0x16b94e=events[_0x55e1f2];var _0x788c9=createListener(_0x0661('0x5')+_0x16b94e,_0x4880bb);UserProfileEvents['on'](_0x16b94e,_0x788c9);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 2a41acc..6e1a151 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 _0x13c6=['describe','/:id','show','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller','isAuthenticated','index','get'];(function(_0x174804,_0x204927){var _0x5cfb06=function(_0x44eb65){while(--_0x44eb65){_0x174804['push'](_0x174804['shift']());}};_0x5cfb06(++_0x204927);}(_0x13c6,0x15c));var _0x613c=function(_0x120636,_0x477fb3){_0x120636=_0x120636-0x0;var _0x482238=_0x13c6[_0x120636];return _0x482238;};'use strict';var multer=require(_0x613c('0x0'));var util=require(_0x613c('0x1'));var path=require(_0x613c('0x2'));var timeout=require(_0x613c('0x3'));var express=require(_0x613c('0x4'));var router=express['Router']();var fs_extra=require(_0x613c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x613c('0x6'));var config=require(_0x613c('0x7'));var controller=require(_0x613c('0x8'));router['get']('/',auth[_0x613c('0x9')](),controller[_0x613c('0xa')]);router[_0x613c('0xb')]('/describe',auth[_0x613c('0x9')](),controller[_0x613c('0xc')]);router[_0x613c('0xb')](_0x613c('0xd'),auth[_0x613c('0x9')](),controller[_0x613c('0xe')]);router[_0x613c('0xf')]('/',auth[_0x613c('0x9')](),controller[_0x613c('0x10')]);router['put']('/:id',auth[_0x613c('0x9')](),controller[_0x613c('0x11')]);router['delete']('/:id',auth[_0x613c('0x9')](),controller[_0x613c('0x12')]);module[_0x613c('0x13')]=router; \ No newline at end of file +var _0x6eea=['/:id','destroy','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','describe','show','post','create','put'];(function(_0x5ba2c8,_0x5826ef){var _0x6c177f=function(_0x15ee42){while(--_0x15ee42){_0x5ba2c8['push'](_0x5ba2c8['shift']());}};_0x6c177f(++_0x5826ef);}(_0x6eea,0x1d6));var _0xa6ee=function(_0x5922f7,_0x23885e){_0x5922f7=_0x5922f7-0x0;var _0x145529=_0x6eea[_0x5922f7];return _0x145529;};'use strict';var multer=require('multer');var util=require(_0xa6ee('0x0'));var path=require(_0xa6ee('0x1'));var timeout=require('connect-timeout');var express=require(_0xa6ee('0x2'));var router=express[_0xa6ee('0x3')]();var fs_extra=require(_0xa6ee('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa6ee('0x5'));var config=require(_0xa6ee('0x6'));var controller=require(_0xa6ee('0x7'));router[_0xa6ee('0x8')]('/',auth[_0xa6ee('0x9')](),controller[_0xa6ee('0xa')]);router[_0xa6ee('0x8')]('/describe',auth[_0xa6ee('0x9')](),controller[_0xa6ee('0xb')]);router['get']('/:id',auth[_0xa6ee('0x9')](),controller[_0xa6ee('0xc')]);router[_0xa6ee('0xd')]('/',auth[_0xa6ee('0x9')](),controller[_0xa6ee('0xe')]);router[_0xa6ee('0xf')](_0xa6ee('0x10'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xa6ee('0x10'),auth['isAuthenticated'](),controller[_0xa6ee('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 191bdb9..907c01c 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 _0xaa95=['STRING','INTEGER','sequelize','exports'];(function(_0x324e86,_0x81b1cb){var _0x592846=function(_0x33439c){while(--_0x33439c){_0x324e86['push'](_0x324e86['shift']());}};_0x592846(++_0x81b1cb);}(_0xaa95,0x1ae));var _0x5aa9=function(_0x599044,_0x49c267){_0x599044=_0x599044-0x0;var _0x1358f0=_0xaa95[_0x599044];return _0x1358f0;};'use strict';var Sequelize=require(_0x5aa9('0x0'));module[_0x5aa9('0x1')]={'name':{'type':Sequelize[_0x5aa9('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x5aa9('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x5aa9('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xe3f2=['exports','STRING','INTEGER','sequelize'];(function(_0x1a3b82,_0x146244){var _0x380bc2=function(_0x1172ed){while(--_0x1172ed){_0x1a3b82['push'](_0x1a3b82['shift']());}};_0x380bc2(++_0x146244);}(_0xe3f2,0xcb));var _0x2e3f=function(_0x341af8,_0x491cb0){_0x341af8=_0x341af8-0x0;var _0x55e0ee=_0xe3f2[_0x341af8];return _0x55e0ee;};'use strict';var Sequelize=require(_0x2e3f('0x0'));module[_0x2e3f('0x1')]={'name':{'type':Sequelize[_0x2e3f('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x2e3f('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 deb3136..763ddba 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 _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(_0x376ebf,_0x2c4cd9){var _0x15a932=function(_0x260d20){while(--_0x260d20){_0x376ebf['push'](_0x376ebf['shift']());}};_0x15a932(++_0x2c4cd9);}(_0x33af,0xec));var _0xf33a=function(_0x5e4a4c,_0x1b8d7e){_0x5e4a4c=_0x5e4a4c-0x0;var _0x1afefb=_0x33af[_0x5e4a4c];return _0x1afefb;};'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 +var _0x5fab=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','includeAll','include','findAll','then','rows','show','params','intersection','fields','options','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x5fab,0x177));var _0xb5fa=function(_0x4c6a7f,_0x452cf6){_0x4c6a7f=_0x4c6a7f-0x0;var _0x1a5474=_0x5fab[_0x4c6a7f];return _0x1a5474;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fa('0x2'));var rp=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var BPromise=require(_0xb5fa('0x5'));var Mustache=require(_0xb5fa('0x6'));var util=require(_0xb5fa('0x7'));var path=require(_0xb5fa('0x8'));var sox=require(_0xb5fa('0x9'));var csv=require(_0xb5fa('0xa'));var ejs=require(_0xb5fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xa'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];function respondWithStatusCode(_0x4d3576,_0x2ad830){_0x2ad830=_0x2ad830||0xcc;return function(_0x3dad4d){if(_0x3dad4d){return _0x4d3576['sendStatus'](_0x2ad830);}return _0x4d3576[_0xb5fa('0x1a')](_0x2ad830)['end']();};}function respondWithResult(_0x265992,_0x3fc372){_0x3fc372=_0x3fc372||0xc8;return function(_0x40c914){if(_0x40c914){return _0x265992[_0xb5fa('0x1a')](_0x3fc372)[_0xb5fa('0x1b')](_0x40c914);}};}function respondWithFilteredResult(_0x5371cf,_0x567f31){return function(_0x38e964){if(_0x38e964){var _0x587043=typeof _0x567f31[_0xb5fa('0x1c')]===_0xb5fa('0x1d')&&typeof _0x567f31['limit']==='undefined';var _0x451a55=_0x38e964[_0xb5fa('0x1e')];var _0x32e9e5=_0x587043?0x0:_0x567f31[_0xb5fa('0x1c')];var _0x324ba5=_0x587043?_0x38e964[_0xb5fa('0x1e')]:_0x567f31[_0xb5fa('0x1c')]+_0x567f31[_0xb5fa('0x1f')];var _0xc14dc4;if(_0x324ba5>=_0x451a55){_0x324ba5=_0x451a55;_0xc14dc4=0xc8;}else{_0xc14dc4=0xce;}_0x5371cf[_0xb5fa('0x1a')](_0xc14dc4);return _0x5371cf[_0xb5fa('0x20')](_0xb5fa('0x21'),_0x32e9e5+'-'+_0x324ba5+'/'+_0x451a55)['json'](_0x38e964);}return null;};}function patchUpdates(_0x432bfa){return function(_0x519e20){try{jsonpatch[_0xb5fa('0x22')](_0x519e20,_0x432bfa,!![]);}catch(_0x4a6c04){return BPromise[_0xb5fa('0x23')](_0x4a6c04);}return _0x519e20[_0xb5fa('0x24')]();};}function saveUpdates(_0x4e05c0,_0x40dfdf){return function(_0x3a2ab9){if(_0x3a2ab9){return _0x3a2ab9[_0xb5fa('0x25')](_0x4e05c0)['then'](function(_0x32a85c){return _0x32a85c;});}return null;};}function removeEntity(_0xec108f,_0x444237){return function(_0x542348){if(_0x542348){return _0x542348[_0xb5fa('0x26')]()['then'](function(){_0xec108f[_0xb5fa('0x1a')](0xcc)[_0xb5fa('0x27')]();});}};}function handleEntityNotFound(_0x11053a,_0x543edf){return function(_0x2dbd22){if(!_0x2dbd22){_0x11053a[_0xb5fa('0x28')](0x194);}return _0x2dbd22;};}function handleError(_0x6a455c,_0x20d649){_0x20d649=_0x20d649||0x1f4;return function(_0x568870){logger['error'](_0x568870['stack']);if(_0x568870['name']){delete _0x568870[_0xb5fa('0x29')];}_0x6a455c[_0xb5fa('0x1a')](_0x20d649)[_0xb5fa('0x2a')](_0x568870);};}exports[_0xb5fa('0x2b')]=function(_0x534884,_0x3506a4){var _0x358549={},_0x353314={},_0x409af9={'count':0x0,'rows':[]};var _0x2a5690=_[_0xb5fa('0x2c')](db[_0xb5fa('0x2d')][_0xb5fa('0x2e')],function(_0x1f4380){return{'name':_0x1f4380[_0xb5fa('0x2f')],'type':_0x1f4380[_0xb5fa('0x30')][_0xb5fa('0x31')]};});_0x353314[_0xb5fa('0x32')]=_[_0xb5fa('0x2c')](_0x2a5690,_0xb5fa('0x29'));_0x353314[_0xb5fa('0x33')]=_[_0xb5fa('0x34')](_0x534884[_0xb5fa('0x33')]);_0x353314[_0xb5fa('0x35')]=_['intersection'](_0x353314[_0xb5fa('0x32')],_0x353314['query']);_0x358549['attributes']=_['intersection'](_0x353314[_0xb5fa('0x32')],qs['fields'](_0x534884[_0xb5fa('0x33')]['fields']));_0x358549['attributes']=_0x358549[_0xb5fa('0x36')][_0xb5fa('0x37')]?_0x358549['attributes']:_0x353314['model'];if(!_0x534884[_0xb5fa('0x33')][_0xb5fa('0x38')](_0xb5fa('0x39'))){_0x358549['limit']=qs[_0xb5fa('0x1f')](_0x534884[_0xb5fa('0x33')]['limit']);_0x358549[_0xb5fa('0x1c')]=qs[_0xb5fa('0x1c')](_0x534884[_0xb5fa('0x33')]['offset']);}_0x358549[_0xb5fa('0x3a')]=qs[_0xb5fa('0x3b')](_0x534884[_0xb5fa('0x33')]['sort']);_0x358549[_0xb5fa('0x3c')]=qs[_0xb5fa('0x35')](_[_0xb5fa('0x3d')](_0x534884[_0xb5fa('0x33')],_0x353314['filters']),_0x2a5690);if(_0x534884['query']['filter']){_0x358549['where']=_['merge'](_0x358549['where'],{'$or':_[_0xb5fa('0x2c')](_0x2a5690,function(_0x4c0a4d){if(_0x4c0a4d[_0xb5fa('0x30')]!==_0xb5fa('0x3e')){var _0x36db1a={};_0x36db1a[_0x4c0a4d[_0xb5fa('0x29')]]={'$like':'%'+_0x534884[_0xb5fa('0x33')][_0xb5fa('0x3f')]+'%'};return _0x36db1a;}})});}_0x358549=_['merge']({},_0x358549,_0x534884['options']);var _0x4c4bf0={'where':_0x358549[_0xb5fa('0x3c')]};return db['UserProfileResource'][_0xb5fa('0x1e')](_0x4c4bf0)['then'](function(_0x58aa97){_0x409af9[_0xb5fa('0x1e')]=_0x58aa97;if(_0x534884[_0xb5fa('0x33')][_0xb5fa('0x40')]){_0x358549[_0xb5fa('0x41')]=[{'all':!![]}];}return db[_0xb5fa('0x2d')][_0xb5fa('0x42')](_0x358549);})[_0xb5fa('0x43')](function(_0x83df0b){_0x409af9[_0xb5fa('0x44')]=_0x83df0b;return _0x409af9;})[_0xb5fa('0x43')](respondWithFilteredResult(_0x3506a4,_0x358549))['catch'](handleError(_0x3506a4,null));};exports[_0xb5fa('0x45')]=function(_0x4bc9df,_0x233f90){var _0x39aac3={'raw':![],'where':{'id':_0x4bc9df[_0xb5fa('0x46')]['id']}},_0x2c7c5f={};_0x2c7c5f[_0xb5fa('0x32')]=_[_0xb5fa('0x34')](db[_0xb5fa('0x2d')][_0xb5fa('0x2e')]);_0x2c7c5f['query']=_[_0xb5fa('0x34')](_0x4bc9df[_0xb5fa('0x33')]);_0x2c7c5f['filters']=_[_0xb5fa('0x47')](_0x2c7c5f['model'],_0x2c7c5f[_0xb5fa('0x33')]);_0x39aac3[_0xb5fa('0x36')]=_['intersection'](_0x2c7c5f['model'],qs[_0xb5fa('0x48')](_0x4bc9df[_0xb5fa('0x33')][_0xb5fa('0x48')]));_0x39aac3[_0xb5fa('0x36')]=_0x39aac3[_0xb5fa('0x36')][_0xb5fa('0x37')]?_0x39aac3[_0xb5fa('0x36')]:_0x2c7c5f[_0xb5fa('0x32')];if(_0x4bc9df['query'][_0xb5fa('0x40')]){_0x39aac3[_0xb5fa('0x41')]=[{'all':!![]}];}_0x39aac3=_['merge']({},_0x39aac3,_0x4bc9df[_0xb5fa('0x49')]);return db[_0xb5fa('0x2d')][_0xb5fa('0x4a')](_0x39aac3)[_0xb5fa('0x43')](handleEntityNotFound(_0x233f90,null))[_0xb5fa('0x43')](respondWithResult(_0x233f90,null))[_0xb5fa('0x4b')](handleError(_0x233f90,null));};exports[_0xb5fa('0x4c')]=function(_0x33eb2c,_0x20f5f5){return db[_0xb5fa('0x2d')][_0xb5fa('0x4c')](_0x33eb2c[_0xb5fa('0x4d')],{})[_0xb5fa('0x43')](respondWithResult(_0x20f5f5,0xc9))[_0xb5fa('0x4b')](handleError(_0x20f5f5,null));};exports[_0xb5fa('0x25')]=function(_0x3a39f2,_0x52f5d8){if(_0x3a39f2['body']['id']){delete _0x3a39f2[_0xb5fa('0x4d')]['id'];}return db['UserProfileResource'][_0xb5fa('0x4a')]({'where':{'id':_0x3a39f2[_0xb5fa('0x46')]['id']}})['then'](handleEntityNotFound(_0x52f5d8,null))[_0xb5fa('0x43')](saveUpdates(_0x3a39f2[_0xb5fa('0x4d')],null))[_0xb5fa('0x43')](respondWithResult(_0x52f5d8,null))[_0xb5fa('0x4b')](handleError(_0x52f5d8,null));};exports[_0xb5fa('0x26')]=function(_0x3ffee0,_0x51d5f7){return db[_0xb5fa('0x2d')]['find']({'where':{'id':_0x3ffee0[_0xb5fa('0x46')]['id']}})[_0xb5fa('0x43')](handleEntityNotFound(_0x51d5f7,null))[_0xb5fa('0x43')](removeEntity(_0x51d5f7,null))['catch'](handleError(_0x51d5f7,null));};exports[_0xb5fa('0x4e')]=function(_0x130a0d,_0x4dea87){return db['UserProfileResource'][_0xb5fa('0x4e')]()[_0xb5fa('0x43')](respondWithResult(_0x4dea87,null))[_0xb5fa('0x4b')](handleError(_0x4dea87,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 4de6b6a..1b789c8 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 _0xfbc1=['moment','bluebird','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','util','api'];(function(_0x1abc1c,_0x1e6013){var _0x2e354f=function(_0x2bc1be){while(--_0x2bc1be){_0x1abc1c['push'](_0x1abc1c['shift']());}};_0x2e354f(++_0x1e6013);}(_0xfbc1,0x108));var _0x1fbc=function(_0x1034bb,_0x4e20b3){_0x1034bb=_0x1034bb-0x0;var _0x453fdb=_0xfbc1[_0x1034bb];return _0x453fdb;};'use strict';var _=require('lodash');var util=require(_0x1fbc('0x0'));var logger=require('../../config/logger')(_0x1fbc('0x1'));var moment=require(_0x1fbc('0x2'));var BPromise=require(_0x1fbc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1fbc('0x4'));var config=require(_0x1fbc('0x5'));var attributes=require(_0x1fbc('0x6'));module[_0x1fbc('0x7')]=function(_0x3bea1b,_0x4c0893){return _0x3bea1b[_0x1fbc('0x8')](_0x1fbc('0x9'),attributes,{'tableName':_0x1fbc('0xa'),'paranoid':![],'indexes':[{'name':_0x1fbc('0xb'),'fields':[_0x1fbc('0xc'),_0x1fbc('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x57e1=['define','compositeIndex','resourceId','sectionId','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userProfileResource.attributes','exports'];(function(_0x222a67,_0x3b3a19){var _0xbbd8da=function(_0x45b31c){while(--_0x45b31c){_0x222a67['push'](_0x222a67['shift']());}};_0xbbd8da(++_0x3b3a19);}(_0x57e1,0x1d8));var _0x157e=function(_0x4c5b19,_0x4d16ac){_0x4c5b19=_0x4c5b19-0x0;var _0x245588=_0x57e1[_0x4c5b19];return _0x245588;};'use strict';var _=require(_0x157e('0x0'));var util=require('util');var logger=require(_0x157e('0x1'))(_0x157e('0x2'));var moment=require('moment');var BPromise=require(_0x157e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x157e('0x4'));var rimraf=require(_0x157e('0x5'));var config=require(_0x157e('0x6'));var attributes=require(_0x157e('0x7'));module[_0x157e('0x8')]=function(_0x27b0cb,_0x5369dc){return _0x27b0cb[_0x157e('0x9')]('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x157e('0xa'),'fields':[_0x157e('0xb'),_0x157e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index abab111..949c7df 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 _0xa320=['../../config/environment','jayson/promise','http','then','info','UserProfileResource,\x20%s,\x20%s','debug','request\x20sent','error','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x1e8c3d,_0x378458){var _0x5e29bd=function(_0x1b86cb){while(--_0x1b86cb){_0x1e8c3d['push'](_0x1e8c3d['shift']());}};_0x5e29bd(++_0x378458);}(_0xa320,0x1df));var _0x0a32=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xa320[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0x0a32('0x0'));var util=require(_0x0a32('0x1'));var moment=require(_0x0a32('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a32('0x3'));var db=require(_0x0a32('0x4'))['db'];var utils=require(_0x0a32('0x5'));var logger=require('../../config/logger')(_0x0a32('0x6'));var config=require(_0x0a32('0x7'));var jayson=require(_0x0a32('0x8'));var client=jayson['client'][_0x0a32('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x681322,_0x501d13,_0x3181aa){return new BPromise(function(_0x315683,_0x185774){return client['request'](_0x681322,_0x3181aa)[_0x0a32('0xa')](function(_0x45217a){logger[_0x0a32('0xb')](_0x0a32('0xc'),_0x501d13,'request\x20sent');logger[_0x0a32('0xd')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x501d13,_0x0a32('0xe'),JSON['stringify'](_0x45217a));if(_0x45217a[_0x0a32('0xf')]){if(_0x45217a['error']['code']===0x1f4){logger['error'](_0x0a32('0xc'),_0x501d13,_0x45217a[_0x0a32('0xf')]['message']);return _0x185774(_0x45217a['error'][_0x0a32('0x10')]);}logger[_0x0a32('0xf')](_0x0a32('0xc'),_0x501d13,_0x45217a['error'][_0x0a32('0x10')]);return _0x315683(_0x45217a[_0x0a32('0xf')][_0x0a32('0x10')]);}else{logger[_0x0a32('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x501d13,'request\x20sent');_0x315683(_0x45217a[_0x0a32('0x11')][_0x0a32('0x10')]);}})['catch'](function(_0x4571d4){logger['error'](_0x0a32('0xc'),_0x501d13,_0x4571d4);_0x185774(_0x4571d4);});});} \ No newline at end of file +var _0x60b4=['info','UserProfileResource,\x20%s,\x20%s','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xe27948,_0x5bfa16){var _0x44e57b=function(_0x34654a){while(--_0x34654a){_0xe27948['push'](_0xe27948['shift']());}};_0x44e57b(++_0x5bfa16);}(_0x60b4,0x143));var _0x460b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x60b4[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x460b('0x0'));var util=require(_0x460b('0x1'));var moment=require('moment');var BPromise=require(_0x460b('0x2'));var rs=require(_0x460b('0x3'));var fs=require('fs');var Redis=require(_0x460b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x460b('0x5'));var logger=require(_0x460b('0x6'))(_0x460b('0x7'));var config=require(_0x460b('0x8'));var jayson=require(_0x460b('0x9'));var client=jayson[_0x460b('0xa')][_0x460b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x253ec5,_0x45ccde,_0x2df7ac){return new BPromise(function(_0x58fb17,_0x40bcd6){return client[_0x460b('0xc')](_0x253ec5,_0x2df7ac)['then'](function(_0x5bfcda){logger[_0x460b('0xd')](_0x460b('0xe'),_0x45ccde,'request\x20sent');logger['debug'](_0x460b('0xf'),_0x45ccde,_0x460b('0x10'),JSON[_0x460b('0x11')](_0x5bfcda));if(_0x5bfcda[_0x460b('0x12')]){if(_0x5bfcda['error']['code']===0x1f4){logger[_0x460b('0x12')](_0x460b('0xe'),_0x45ccde,_0x5bfcda[_0x460b('0x12')][_0x460b('0x13')]);return _0x40bcd6(_0x5bfcda[_0x460b('0x12')][_0x460b('0x13')]);}logger[_0x460b('0x12')](_0x460b('0xe'),_0x45ccde,_0x5bfcda['error'][_0x460b('0x13')]);return _0x58fb17(_0x5bfcda['error']['message']);}else{logger['info'](_0x460b('0xe'),_0x45ccde,'request\x20sent');_0x58fb17(_0x5bfcda[_0x460b('0x14')][_0x460b('0x13')]);}})['catch'](function(_0x4adef9){logger[_0x460b('0x12')](_0x460b('0xe'),_0x45ccde,_0x4adef9);_0x40bcd6(_0x4adef9);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index c862f1f..e39d6b1 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 _0x7567=['fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','index','/describe','/:id','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x7567,0x14e));var _0x7756=function(_0x23e83f,_0x587b7e){_0x23e83f=_0x23e83f-0x0;var _0x8e4b15=_0x7567[_0x23e83f];return _0x8e4b15;};'use strict';var multer=require(_0x7756('0x0'));var util=require(_0x7756('0x1'));var path=require(_0x7756('0x2'));var timeout=require(_0x7756('0x3'));var express=require(_0x7756('0x4'));var router=express[_0x7756('0x5')]();var fs_extra=require(_0x7756('0x6'));var auth=require(_0x7756('0x7'));var interaction=require(_0x7756('0x8'));var config=require('../../config/environment');var controller=require(_0x7756('0x9'));router[_0x7756('0xa')]('/',auth[_0x7756('0xb')](),controller[_0x7756('0xc')]);router['get'](_0x7756('0xd'),auth[_0x7756('0xb')](),controller['describe']);router[_0x7756('0xa')](_0x7756('0xe'),auth[_0x7756('0xb')](),controller['show']);router[_0x7756('0xf')]('/',auth[_0x7756('0xb')](),controller['create']);router[_0x7756('0x10')](_0x7756('0xe'),auth[_0x7756('0xb')](),controller[_0x7756('0x11')]);router[_0x7756('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x7756('0x13')]);module['exports']=router; \ No newline at end of file +var _0x8b99=['describe','/:id','show','create','put','delete','destroy','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x8b99,0x1c1));var _0x98b9=function(_0x2e22dd,_0x198bfb){_0x2e22dd=_0x2e22dd-0x0;var _0x35c43d=_0x8b99[_0x2e22dd];return _0x35c43d;};'use strict';var multer=require('multer');var util=require(_0x98b9('0x0'));var path=require('path');var timeout=require(_0x98b9('0x1'));var express=require('express');var router=express[_0x98b9('0x2')]();var fs_extra=require(_0x98b9('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x98b9('0x4'));var config=require(_0x98b9('0x5'));var controller=require(_0x98b9('0x6'));router[_0x98b9('0x7')]('/',auth[_0x98b9('0x8')](),controller[_0x98b9('0x9')]);router[_0x98b9('0x7')]('/describe',auth[_0x98b9('0x8')](),controller[_0x98b9('0xa')]);router[_0x98b9('0x7')](_0x98b9('0xb'),auth[_0x98b9('0x8')](),controller[_0x98b9('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x98b9('0xd')]);router[_0x98b9('0xe')](_0x98b9('0xb'),auth[_0x98b9('0x8')](),controller['update']);router[_0x98b9('0xf')]('/:id',auth[_0x98b9('0x8')](),controller[_0x98b9('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 07fa8e6..a609009 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 _0x9348=['exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize'];(function(_0x404dc0,_0x347716){var _0x5e7e81=function(_0x15d90b){while(--_0x15d90b){_0x404dc0['push'](_0x404dc0['shift']());}};_0x5e7e81(++_0x347716);}(_0x9348,0x10d));var _0x8934=function(_0x4f526c,_0x184e16){_0x4f526c=_0x4f526c-0x0;var _0x5197f9=_0x9348[_0x4f526c];return _0x5197f9;};'use strict';var Sequelize=require(_0x8934('0x0'));module[_0x8934('0x1')]={'name':{'type':Sequelize[_0x8934('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x8934('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x8934('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x8934('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x8934('0x2')],'set':function(_0x5f34d7){this[_0x8934('0x5')](_0x8934('0x6'),_0x5f34d7?_0x5f34d7[_0x8934('0x7')](''):[]);},'get':function(){return this[_0x8934('0x8')](_0x8934('0x6'))?this[_0x8934('0x8')]('crudPermissions')[_0x8934('0x9')](''):[];}}}; \ No newline at end of file +var _0x8f59=['INTEGER','BOOLEAN','setDataValue','crudPermissions','getDataValue','sequelize','exports','STRING'];(function(_0x14e269,_0x375488){var _0x1899c5=function(_0xd0013b){while(--_0xd0013b){_0x14e269['push'](_0x14e269['shift']());}};_0x1899c5(++_0x375488);}(_0x8f59,0x11d));var _0x98f5=function(_0xa5e4cb,_0x5bc810){_0xa5e4cb=_0xa5e4cb-0x0;var _0x41bf88=_0x8f59[_0xa5e4cb];return _0x41bf88;};'use strict';var Sequelize=require(_0x98f5('0x0'));module[_0x98f5('0x1')]={'name':{'type':Sequelize[_0x98f5('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x98f5('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x98f5('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x98f5('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x98f5('0x2')],'set':function(_0x320235){this[_0x98f5('0x5')](_0x98f5('0x6'),_0x320235?_0x320235['join'](''):[]);},'get':function(){return this[_0x98f5('0x7')](_0x98f5('0x6'))?this[_0x98f5('0x7')]('crudPermissions')['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 6da780f..161b70d 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 _0xdc18=['catch','show','params','fields','length','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','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','count','limit','set','Content-Range','save','update','then','destroy','sendStatus','error','stack','send','index','UserProfileSection','rawAttributes','fieldName','type','name','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows'];(function(_0x58a30e,_0x4d4cae){var _0x59840b=function(_0x8c1b47){while(--_0x8c1b47){_0x58a30e['push'](_0x58a30e['shift']());}};_0x59840b(++_0x4d4cae);}(_0xdc18,0x139));var _0x8dc1=function(_0xcb32c0,_0x45d5c1){_0xcb32c0=_0xcb32c0-0x0;var _0x3c757b=_0xdc18[_0xcb32c0];return _0x3c757b;};'use strict';var emlformat=require(_0x8dc1('0x0'));var rimraf=require(_0x8dc1('0x1'));var zipdir=require(_0x8dc1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8dc1('0x3'));var moment=require(_0x8dc1('0x4'));var BPromise=require(_0x8dc1('0x5'));var Mustache=require('mustache');var util=require(_0x8dc1('0x6'));var path=require('path');var sox=require(_0x8dc1('0x7'));var csv=require(_0x8dc1('0x8'));var ejs=require(_0x8dc1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8dc1('0xa'));var squel=require(_0x8dc1('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8dc1('0xc'));var Papa=require(_0x8dc1('0xd'));var Redis=require(_0x8dc1('0xe'));var authService=require(_0x8dc1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8dc1('0x10'));var hardwareService=require(_0x8dc1('0x11'));var logger=require(_0x8dc1('0x12'))(_0x8dc1('0x13'));var utils=require(_0x8dc1('0x14'));var config=require(_0x8dc1('0x15'));var licenseUtil=require(_0x8dc1('0x16'));var db=require(_0x8dc1('0x17'))['db'];function respondWithStatusCode(_0x297a5c,_0x33a75c){_0x33a75c=_0x33a75c||0xcc;return function(_0x279275){if(_0x279275){return _0x297a5c['sendStatus'](_0x33a75c);}return _0x297a5c[_0x8dc1('0x18')](_0x33a75c)[_0x8dc1('0x19')]();};}function respondWithResult(_0x273cf2,_0x4fe3d1){_0x4fe3d1=_0x4fe3d1||0xc8;return function(_0x45deb0){if(_0x45deb0){return _0x273cf2[_0x8dc1('0x18')](_0x4fe3d1)[_0x8dc1('0x1a')](_0x45deb0);}};}function respondWithFilteredResult(_0x25390d,_0x2dd7c2){return function(_0x5e18ce){if(_0x5e18ce){var _0x1907fd=typeof _0x2dd7c2[_0x8dc1('0x1b')]===_0x8dc1('0x1c')&&typeof _0x2dd7c2['limit']===_0x8dc1('0x1c');var _0x22e8d7=_0x5e18ce[_0x8dc1('0x1d')];var _0x57a14d=_0x1907fd?0x0:_0x2dd7c2[_0x8dc1('0x1b')];var _0x3c0e65=_0x1907fd?_0x5e18ce[_0x8dc1('0x1d')]:_0x2dd7c2[_0x8dc1('0x1b')]+_0x2dd7c2[_0x8dc1('0x1e')];var _0xfb4d9;if(_0x3c0e65>=_0x22e8d7){_0x3c0e65=_0x22e8d7;_0xfb4d9=0xc8;}else{_0xfb4d9=0xce;}_0x25390d[_0x8dc1('0x18')](_0xfb4d9);return _0x25390d[_0x8dc1('0x1f')](_0x8dc1('0x20'),_0x57a14d+'-'+_0x3c0e65+'/'+_0x22e8d7)[_0x8dc1('0x1a')](_0x5e18ce);}return null;};}function patchUpdates(_0x376cc7){return function(_0x1e1317){try{jsonpatch['apply'](_0x1e1317,_0x376cc7,!![]);}catch(_0x7b5c24){return BPromise['reject'](_0x7b5c24);}return _0x1e1317[_0x8dc1('0x21')]();};}function saveUpdates(_0x2852b6,_0x2240ef){return function(_0x33f28c){if(_0x33f28c){return _0x33f28c[_0x8dc1('0x22')](_0x2852b6)[_0x8dc1('0x23')](function(_0x4a9d02){return _0x4a9d02;});}return null;};}function removeEntity(_0x1544c5,_0x4164f8){return function(_0x2432b1){if(_0x2432b1){return _0x2432b1[_0x8dc1('0x24')]()['then'](function(){_0x1544c5[_0x8dc1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x119fe4,_0xe7c997){return function(_0x4f71e6){if(!_0x4f71e6){_0x119fe4[_0x8dc1('0x25')](0x194);}return _0x4f71e6;};}function handleError(_0x27effe,_0x3765c0){_0x3765c0=_0x3765c0||0x1f4;return function(_0x4cafd2){logger[_0x8dc1('0x26')](_0x4cafd2[_0x8dc1('0x27')]);if(_0x4cafd2['name']){delete _0x4cafd2['name'];}_0x27effe['status'](_0x3765c0)[_0x8dc1('0x28')](_0x4cafd2);};}exports[_0x8dc1('0x29')]=function(_0x3147ab,_0x180d86){var _0x1c47ea={},_0xaac54c={},_0x400433={'count':0x0,'rows':[]};var _0x2ea40a=_['map'](db[_0x8dc1('0x2a')][_0x8dc1('0x2b')],function(_0x507e07){return{'name':_0x507e07[_0x8dc1('0x2c')],'type':_0x507e07[_0x8dc1('0x2d')]['key']};});_0xaac54c['model']=_['map'](_0x2ea40a,_0x8dc1('0x2e'));_0xaac54c[_0x8dc1('0x2f')]=_[_0x8dc1('0x30')](_0x3147ab['query']);_0xaac54c[_0x8dc1('0x31')]=_[_0x8dc1('0x32')](_0xaac54c[_0x8dc1('0x33')],_0xaac54c['query']);_0x1c47ea['attributes']=_['intersection'](_0xaac54c[_0x8dc1('0x33')],qs['fields'](_0x3147ab[_0x8dc1('0x2f')]['fields']));_0x1c47ea[_0x8dc1('0x34')]=_0x1c47ea['attributes']['length']?_0x1c47ea[_0x8dc1('0x34')]:_0xaac54c['model'];if(!_0x3147ab['query'][_0x8dc1('0x35')](_0x8dc1('0x36'))){_0x1c47ea[_0x8dc1('0x1e')]=qs[_0x8dc1('0x1e')](_0x3147ab['query'][_0x8dc1('0x1e')]);_0x1c47ea[_0x8dc1('0x1b')]=qs['offset'](_0x3147ab[_0x8dc1('0x2f')][_0x8dc1('0x1b')]);}_0x1c47ea['order']=qs[_0x8dc1('0x37')](_0x3147ab[_0x8dc1('0x2f')][_0x8dc1('0x37')]);_0x1c47ea[_0x8dc1('0x38')]=qs[_0x8dc1('0x31')](_[_0x8dc1('0x39')](_0x3147ab[_0x8dc1('0x2f')],_0xaac54c[_0x8dc1('0x31')]),_0x2ea40a);if(_0x3147ab[_0x8dc1('0x2f')]['filter']){_0x1c47ea[_0x8dc1('0x38')]=_[_0x8dc1('0x3a')](_0x1c47ea[_0x8dc1('0x38')],{'$or':_[_0x8dc1('0x3b')](_0x2ea40a,function(_0x2beeb4){if(_0x2beeb4['type']!==_0x8dc1('0x3c')){var _0xe9a328={};_0xe9a328[_0x2beeb4[_0x8dc1('0x2e')]]={'$like':'%'+_0x3147ab['query'][_0x8dc1('0x3d')]+'%'};return _0xe9a328;}})});}_0x1c47ea=_[_0x8dc1('0x3a')]({},_0x1c47ea,_0x3147ab[_0x8dc1('0x3e')]);var _0x444f8d={'where':_0x1c47ea[_0x8dc1('0x38')]};return db[_0x8dc1('0x2a')][_0x8dc1('0x1d')](_0x444f8d)[_0x8dc1('0x23')](function(_0x4c34dc){_0x400433[_0x8dc1('0x1d')]=_0x4c34dc;if(_0x3147ab[_0x8dc1('0x2f')][_0x8dc1('0x3f')]){_0x1c47ea[_0x8dc1('0x40')]=[{'all':!![]}];}return db[_0x8dc1('0x2a')][_0x8dc1('0x41')](_0x1c47ea);})[_0x8dc1('0x23')](function(_0x40367b){_0x400433[_0x8dc1('0x42')]=_0x40367b;return _0x400433;})[_0x8dc1('0x23')](respondWithFilteredResult(_0x180d86,_0x1c47ea))[_0x8dc1('0x43')](handleError(_0x180d86,null));};exports[_0x8dc1('0x44')]=function(_0x486635,_0x434db0){var _0x147168={'raw':![],'where':{'id':_0x486635[_0x8dc1('0x45')]['id']}},_0x479c8e={};_0x479c8e[_0x8dc1('0x33')]=_[_0x8dc1('0x30')](db[_0x8dc1('0x2a')]['rawAttributes']);_0x479c8e['query']=_[_0x8dc1('0x30')](_0x486635[_0x8dc1('0x2f')]);_0x479c8e['filters']=_['intersection'](_0x479c8e[_0x8dc1('0x33')],_0x479c8e['query']);_0x147168[_0x8dc1('0x34')]=_['intersection'](_0x479c8e[_0x8dc1('0x33')],qs[_0x8dc1('0x46')](_0x486635['query'][_0x8dc1('0x46')]));_0x147168[_0x8dc1('0x34')]=_0x147168[_0x8dc1('0x34')][_0x8dc1('0x47')]?_0x147168[_0x8dc1('0x34')]:_0x479c8e[_0x8dc1('0x33')];if(_0x486635[_0x8dc1('0x2f')]['includeAll']){_0x147168[_0x8dc1('0x40')]=[{'all':!![]}];}_0x147168=_['merge']({},_0x147168,_0x486635['options']);return db[_0x8dc1('0x2a')]['find'](_0x147168)[_0x8dc1('0x23')](handleEntityNotFound(_0x434db0,null))[_0x8dc1('0x23')](respondWithResult(_0x434db0,null))[_0x8dc1('0x43')](handleError(_0x434db0,null));};exports[_0x8dc1('0x48')]=function(_0x1a3ab4,_0x2fe052){return db[_0x8dc1('0x2a')][_0x8dc1('0x48')](_0x1a3ab4['body'],{})[_0x8dc1('0x23')](respondWithResult(_0x2fe052,0xc9))[_0x8dc1('0x43')](handleError(_0x2fe052,null));};exports[_0x8dc1('0x22')]=function(_0x43c357,_0x29c12c){if(_0x43c357[_0x8dc1('0x49')]['id']){delete _0x43c357['body']['id'];}return db['UserProfileSection'][_0x8dc1('0x4a')]({'where':{'id':_0x43c357[_0x8dc1('0x45')]['id']}})[_0x8dc1('0x23')](handleEntityNotFound(_0x29c12c,null))['then'](saveUpdates(_0x43c357[_0x8dc1('0x49')],null))[_0x8dc1('0x23')](respondWithResult(_0x29c12c,null))[_0x8dc1('0x43')](handleError(_0x29c12c,null));};exports[_0x8dc1('0x24')]=function(_0x7712dd,_0x466a3d){return db['UserProfileSection'][_0x8dc1('0x4a')]({'where':{'id':_0x7712dd[_0x8dc1('0x45')]['id']}})[_0x8dc1('0x23')](handleEntityNotFound(_0x466a3d,null))[_0x8dc1('0x23')](removeEntity(_0x466a3d,null))[_0x8dc1('0x43')](handleError(_0x466a3d,null));};exports[_0x8dc1('0x4b')]=function(_0xf022f4,_0x36c9ec){return db[_0x8dc1('0x2a')][_0x8dc1('0x4b')]()[_0x8dc1('0x23')](respondWithResult(_0x36c9ec,null))[_0x8dc1('0x43')](handleError(_0x36c9ec,null));}; \ No newline at end of file +var _0xcffe=['VIRTUAL','filter','options','UserProfileSection','includeAll','include','findAll','rows','show','rawAttributes','find','create','body','catch','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','destroy','then','name','send','index','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map'];(function(_0x174570,_0x326c35){var _0x162b65=function(_0x456d18){while(--_0x456d18){_0x174570['push'](_0x174570['shift']());}};_0x162b65(++_0x326c35);}(_0xcffe,0x1cc));var _0xecff=function(_0x2812c2,_0x2b382d){_0x2812c2=_0x2812c2-0x0;var _0x218ac9=_0xcffe[_0x2812c2];return _0x218ac9;};'use strict';var emlformat=require(_0xecff('0x0'));var rimraf=require(_0xecff('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xecff('0x2'));var rp=require(_0xecff('0x3'));var moment=require(_0xecff('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xecff('0x5'));var util=require(_0xecff('0x6'));var path=require('path');var sox=require(_0xecff('0x7'));var csv=require(_0xecff('0x8'));var ejs=require(_0xecff('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xecff('0xa'));var squel=require(_0xecff('0xb'));var crypto=require(_0xecff('0xc'));var jsforce=require(_0xecff('0xd'));var deskjs=require(_0xecff('0xe'));var toCsv=require(_0xecff('0x8'));var querystring=require(_0xecff('0xf'));var Papa=require('papaparse');var Redis=require(_0xecff('0x10'));var authService=require(_0xecff('0x11'));var qs=require(_0xecff('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xecff('0x13'));var logger=require(_0xecff('0x14'))('api');var utils=require(_0xecff('0x15'));var config=require(_0xecff('0x16'));var licenseUtil=require(_0xecff('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33d201,_0x23c46e){_0x23c46e=_0x23c46e||0xcc;return function(_0x369c66){if(_0x369c66){return _0x33d201[_0xecff('0x18')](_0x23c46e);}return _0x33d201[_0xecff('0x19')](_0x23c46e)[_0xecff('0x1a')]();};}function respondWithResult(_0x2a0335,_0x33c346){_0x33c346=_0x33c346||0xc8;return function(_0x22546f){if(_0x22546f){return _0x2a0335[_0xecff('0x19')](_0x33c346)['json'](_0x22546f);}};}function respondWithFilteredResult(_0x50844c,_0x9ab684){return function(_0x274f1d){if(_0x274f1d){var _0x594d96=typeof _0x9ab684[_0xecff('0x1b')]===_0xecff('0x1c')&&typeof _0x9ab684[_0xecff('0x1d')]===_0xecff('0x1c');var _0x44ee65=_0x274f1d[_0xecff('0x1e')];var _0x57b35f=_0x594d96?0x0:_0x9ab684[_0xecff('0x1b')];var _0x45135e=_0x594d96?_0x274f1d['count']:_0x9ab684[_0xecff('0x1b')]+_0x9ab684[_0xecff('0x1d')];var _0x86f42e;if(_0x45135e>=_0x44ee65){_0x45135e=_0x44ee65;_0x86f42e=0xc8;}else{_0x86f42e=0xce;}_0x50844c[_0xecff('0x19')](_0x86f42e);return _0x50844c['set']('Content-Range',_0x57b35f+'-'+_0x45135e+'/'+_0x44ee65)[_0xecff('0x1f')](_0x274f1d);}return null;};}function patchUpdates(_0x3be02b){return function(_0x523877){try{jsonpatch[_0xecff('0x20')](_0x523877,_0x3be02b,!![]);}catch(_0x2fd72f){return BPromise[_0xecff('0x21')](_0x2fd72f);}return _0x523877[_0xecff('0x22')]();};}function saveUpdates(_0x367503,_0x2d4a13){return function(_0x2013e0){if(_0x2013e0){return _0x2013e0['update'](_0x367503)['then'](function(_0x16c966){return _0x16c966;});}return null;};}function removeEntity(_0x57a363,_0x223c85){return function(_0x1b9f77){if(_0x1b9f77){return _0x1b9f77[_0xecff('0x23')]()[_0xecff('0x24')](function(){_0x57a363[_0xecff('0x19')](0xcc)[_0xecff('0x1a')]();});}};}function handleEntityNotFound(_0x589560,_0x52c428){return function(_0x520bf5){if(!_0x520bf5){_0x589560[_0xecff('0x18')](0x194);}return _0x520bf5;};}function handleError(_0x30f777,_0x57a774){_0x57a774=_0x57a774||0x1f4;return function(_0x2989f3){logger['error'](_0x2989f3['stack']);if(_0x2989f3[_0xecff('0x25')]){delete _0x2989f3[_0xecff('0x25')];}_0x30f777[_0xecff('0x19')](_0x57a774)[_0xecff('0x26')](_0x2989f3);};}exports[_0xecff('0x27')]=function(_0xd80c02,_0x7d0de0){var _0x285a10={},_0x20b18c={},_0x426bdb={'count':0x0,'rows':[]};var _0x42f850=_['map'](db['UserProfileSection']['rawAttributes'],function(_0x2b24a6){return{'name':_0x2b24a6['fieldName'],'type':_0x2b24a6[_0xecff('0x28')][_0xecff('0x29')]};});_0x20b18c[_0xecff('0x2a')]=_['map'](_0x42f850,_0xecff('0x25'));_0x20b18c['query']=_[_0xecff('0x2b')](_0xd80c02[_0xecff('0x2c')]);_0x20b18c[_0xecff('0x2d')]=_['intersection'](_0x20b18c[_0xecff('0x2a')],_0x20b18c[_0xecff('0x2c')]);_0x285a10[_0xecff('0x2e')]=_[_0xecff('0x2f')](_0x20b18c[_0xecff('0x2a')],qs['fields'](_0xd80c02['query'][_0xecff('0x30')]));_0x285a10[_0xecff('0x2e')]=_0x285a10['attributes'][_0xecff('0x31')]?_0x285a10[_0xecff('0x2e')]:_0x20b18c[_0xecff('0x2a')];if(!_0xd80c02['query'][_0xecff('0x32')](_0xecff('0x33'))){_0x285a10[_0xecff('0x1d')]=qs[_0xecff('0x1d')](_0xd80c02[_0xecff('0x2c')][_0xecff('0x1d')]);_0x285a10[_0xecff('0x1b')]=qs[_0xecff('0x1b')](_0xd80c02['query'][_0xecff('0x1b')]);}_0x285a10[_0xecff('0x34')]=qs[_0xecff('0x35')](_0xd80c02[_0xecff('0x2c')]['sort']);_0x285a10[_0xecff('0x36')]=qs[_0xecff('0x2d')](_[_0xecff('0x37')](_0xd80c02['query'],_0x20b18c[_0xecff('0x2d')]),_0x42f850);if(_0xd80c02[_0xecff('0x2c')]['filter']){_0x285a10['where']=_[_0xecff('0x38')](_0x285a10[_0xecff('0x36')],{'$or':_[_0xecff('0x39')](_0x42f850,function(_0x5054c1){if(_0x5054c1[_0xecff('0x28')]!==_0xecff('0x3a')){var _0x37fd83={};_0x37fd83[_0x5054c1[_0xecff('0x25')]]={'$like':'%'+_0xd80c02['query'][_0xecff('0x3b')]+'%'};return _0x37fd83;}})});}_0x285a10=_[_0xecff('0x38')]({},_0x285a10,_0xd80c02[_0xecff('0x3c')]);var _0x1a6e2d={'where':_0x285a10[_0xecff('0x36')]};return db[_0xecff('0x3d')][_0xecff('0x1e')](_0x1a6e2d)[_0xecff('0x24')](function(_0x2cc883){_0x426bdb[_0xecff('0x1e')]=_0x2cc883;if(_0xd80c02[_0xecff('0x2c')][_0xecff('0x3e')]){_0x285a10[_0xecff('0x3f')]=[{'all':!![]}];}return db[_0xecff('0x3d')][_0xecff('0x40')](_0x285a10);})[_0xecff('0x24')](function(_0x58db2c){_0x426bdb[_0xecff('0x41')]=_0x58db2c;return _0x426bdb;})['then'](respondWithFilteredResult(_0x7d0de0,_0x285a10))['catch'](handleError(_0x7d0de0,null));};exports[_0xecff('0x42')]=function(_0x561f89,_0x4a78f2){var _0x20b6ae={'raw':![],'where':{'id':_0x561f89['params']['id']}},_0x4b96ac={};_0x4b96ac[_0xecff('0x2a')]=_[_0xecff('0x2b')](db[_0xecff('0x3d')][_0xecff('0x43')]);_0x4b96ac[_0xecff('0x2c')]=_[_0xecff('0x2b')](_0x561f89[_0xecff('0x2c')]);_0x4b96ac[_0xecff('0x2d')]=_[_0xecff('0x2f')](_0x4b96ac[_0xecff('0x2a')],_0x4b96ac[_0xecff('0x2c')]);_0x20b6ae[_0xecff('0x2e')]=_[_0xecff('0x2f')](_0x4b96ac[_0xecff('0x2a')],qs[_0xecff('0x30')](_0x561f89['query'][_0xecff('0x30')]));_0x20b6ae[_0xecff('0x2e')]=_0x20b6ae[_0xecff('0x2e')][_0xecff('0x31')]?_0x20b6ae[_0xecff('0x2e')]:_0x4b96ac[_0xecff('0x2a')];if(_0x561f89[_0xecff('0x2c')]['includeAll']){_0x20b6ae[_0xecff('0x3f')]=[{'all':!![]}];}_0x20b6ae=_[_0xecff('0x38')]({},_0x20b6ae,_0x561f89['options']);return db[_0xecff('0x3d')][_0xecff('0x44')](_0x20b6ae)[_0xecff('0x24')](handleEntityNotFound(_0x4a78f2,null))['then'](respondWithResult(_0x4a78f2,null))['catch'](handleError(_0x4a78f2,null));};exports[_0xecff('0x45')]=function(_0xb6ee49,_0x3ffc1b){return db[_0xecff('0x3d')][_0xecff('0x45')](_0xb6ee49[_0xecff('0x46')],{})[_0xecff('0x24')](respondWithResult(_0x3ffc1b,0xc9))[_0xecff('0x47')](handleError(_0x3ffc1b,null));};exports['update']=function(_0x242d5f,_0x20d095){if(_0x242d5f[_0xecff('0x46')]['id']){delete _0x242d5f['body']['id'];}return db['UserProfileSection'][_0xecff('0x44')]({'where':{'id':_0x242d5f[_0xecff('0x48')]['id']}})[_0xecff('0x24')](handleEntityNotFound(_0x20d095,null))[_0xecff('0x24')](saveUpdates(_0x242d5f['body'],null))['then'](respondWithResult(_0x20d095,null))[_0xecff('0x47')](handleError(_0x20d095,null));};exports['destroy']=function(_0x149be6,_0xf73ef9){return db['UserProfileSection'][_0xecff('0x44')]({'where':{'id':_0x149be6[_0xecff('0x48')]['id']}})[_0xecff('0x24')](handleEntityNotFound(_0xf73ef9,null))[_0xecff('0x24')](removeEntity(_0xf73ef9,null))['catch'](handleError(_0xf73ef9,null));};exports[_0xecff('0x49')]=function(_0x4b08af,_0x33df19){return db[_0xecff('0x3d')][_0xecff('0x49')]()[_0xecff('0x24')](respondWithResult(_0x33df19,null))[_0xecff('0x47')](handleError(_0x33df19,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 809e7a0..89557c5 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 _0x74f4=['userProfileId','util','api','moment','bluebird','../../config/environment','exports','define','UserProfileSection','compositeIndex','sectionId'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x74f4,0x114));var _0x474f=function(_0x323684,_0x25494b){_0x323684=_0x323684-0x0;var _0x32dd90=_0x74f4[_0x323684];return _0x32dd90;};'use strict';var _=require('lodash');var util=require(_0x474f('0x0'));var logger=require('../../config/logger')(_0x474f('0x1'));var moment=require(_0x474f('0x2'));var BPromise=require(_0x474f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x474f('0x4'));var attributes=require('./userProfileSection.attributes');module[_0x474f('0x5')]=function(_0x294759,_0x51f7b7){return _0x294759[_0x474f('0x6')](_0x474f('0x7'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x474f('0x8'),'fields':[_0x474f('0x9'),_0x474f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8a41=['moment','bluebird','rimraf','../../config/environment','./userProfileSection.attributes','exports','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api'];(function(_0x1abd1d,_0x17295d){var _0x48547a=function(_0x2d75e0){while(--_0x2d75e0){_0x1abd1d['push'](_0x1abd1d['shift']());}};_0x48547a(++_0x17295d);}(_0x8a41,0x130));var _0x18a4=function(_0x1d44d2,_0x5d0745){_0x1d44d2=_0x1d44d2-0x0;var _0x843b47=_0x8a41[_0x1d44d2];return _0x843b47;};'use strict';var _=require(_0x18a4('0x0'));var util=require(_0x18a4('0x1'));var logger=require(_0x18a4('0x2'))(_0x18a4('0x3'));var moment=require(_0x18a4('0x4'));var BPromise=require(_0x18a4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x18a4('0x6'));var config=require(_0x18a4('0x7'));var attributes=require(_0x18a4('0x8'));module[_0x18a4('0x9')]=function(_0x5c9231,_0x17f65e){return _0x5c9231['define']('UserProfileSection',attributes,{'tableName':_0x18a4('0xa'),'paranoid':![],'indexes':[{'name':_0x18a4('0xb'),'fields':[_0x18a4('0xc'),_0x18a4('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 29a5392..7d00155 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 _0x0db5=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x8e383e,_0x40bf9a){var _0x196dca=function(_0x3297c5){while(--_0x3297c5){_0x8e383e['push'](_0x8e383e['shift']());}};_0x196dca(++_0x40bf9a);}(_0x0db5,0xae));var _0x50db=function(_0x560b04,_0x4ee106){_0x560b04=_0x560b04-0x0;var _0x12c7f8=_0x0db5[_0x560b04];return _0x12c7f8;};'use strict';var _=require(_0x50db('0x0'));var util=require(_0x50db('0x1'));var moment=require('moment');var BPromise=require(_0x50db('0x2'));var rs=require(_0x50db('0x3'));var fs=require('fs');var Redis=require(_0x50db('0x4'));var db=require(_0x50db('0x5'))['db'];var utils=require(_0x50db('0x6'));var logger=require(_0x50db('0x7'))(_0x50db('0x8'));var config=require(_0x50db('0x9'));var jayson=require(_0x50db('0xa'));var client=jayson[_0x50db('0xb')][_0x50db('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xbf807,_0x2aab96,_0x4362c8){return new BPromise(function(_0x3faa98,_0x132ee3){return client[_0x50db('0xd')](_0xbf807,_0x4362c8)['then'](function(_0x27c85c){logger[_0x50db('0xe')](_0x50db('0xf'),_0x2aab96,_0x50db('0x10'));logger[_0x50db('0x11')](_0x50db('0x12'),_0x2aab96,_0x50db('0x10'),JSON[_0x50db('0x13')](_0x27c85c));if(_0x27c85c[_0x50db('0x14')]){if(_0x27c85c[_0x50db('0x14')][_0x50db('0x15')]===0x1f4){logger['error'](_0x50db('0xf'),_0x2aab96,_0x27c85c[_0x50db('0x14')]['message']);return _0x132ee3(_0x27c85c['error'][_0x50db('0x16')]);}logger[_0x50db('0x14')](_0x50db('0xf'),_0x2aab96,_0x27c85c[_0x50db('0x14')][_0x50db('0x16')]);return _0x3faa98(_0x27c85c[_0x50db('0x14')]['message']);}else{logger[_0x50db('0xe')](_0x50db('0xf'),_0x2aab96,_0x50db('0x10'));_0x3faa98(_0x27c85c[_0x50db('0x17')][_0x50db('0x16')]);}})[_0x50db('0x18')](function(_0x5392ad){logger[_0x50db('0x14')]('UserProfileSection,\x20%s,\x20%s',_0x2aab96,_0x5392ad);_0x132ee3(_0x5392ad);});});} \ No newline at end of file +var _0xa8ce=['request','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','UserProfileSection,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http'];(function(_0x5160f1,_0x574826){var _0x438049=function(_0x128025){while(--_0x128025){_0x5160f1['push'](_0x5160f1['shift']());}};_0x438049(++_0x574826);}(_0xa8ce,0xc7));var _0xea8c=function(_0x12e165,_0x459c7a){_0x12e165=_0x12e165-0x0;var _0x4975c8=_0xa8ce[_0x12e165];return _0x4975c8;};'use strict';var _=require(_0xea8c('0x0'));var util=require(_0xea8c('0x1'));var moment=require(_0xea8c('0x2'));var BPromise=require(_0xea8c('0x3'));var rs=require(_0xea8c('0x4'));var fs=require('fs');var Redis=require(_0xea8c('0x5'));var db=require(_0xea8c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xea8c('0x7'))(_0xea8c('0x8'));var config=require('../../config/environment');var jayson=require(_0xea8c('0x9'));var client=jayson['client'][_0xea8c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c6536,_0x350342,_0x59bbe2){return new BPromise(function(_0x13a553,_0x1cf218){return client[_0xea8c('0xb')](_0x5c6536,_0x59bbe2)['then'](function(_0x2933b2){logger[_0xea8c('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x350342,_0xea8c('0xd'));logger[_0xea8c('0xe')](_0xea8c('0xf'),_0x350342,_0xea8c('0xd'),JSON[_0xea8c('0x10')](_0x2933b2));if(_0x2933b2[_0xea8c('0x11')]){if(_0x2933b2[_0xea8c('0x11')]['code']===0x1f4){logger[_0xea8c('0x11')](_0xea8c('0x12'),_0x350342,_0x2933b2[_0xea8c('0x11')][_0xea8c('0x13')]);return _0x1cf218(_0x2933b2[_0xea8c('0x11')][_0xea8c('0x13')]);}logger[_0xea8c('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x350342,_0x2933b2['error'][_0xea8c('0x13')]);return _0x13a553(_0x2933b2['error'][_0xea8c('0x13')]);}else{logger[_0xea8c('0xc')](_0xea8c('0x12'),_0x350342,_0xea8c('0xd'));_0x13a553(_0x2933b2['result'][_0xea8c('0x13')]);}})[_0xea8c('0x14')](function(_0x17f207){logger[_0xea8c('0x11')](_0xea8c('0x12'),_0x350342,_0x17f207);_0x1cf218(_0x17f207);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 8ab1a69..d07613b 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x171de5,_0x260fd1){var _0x1c2d68=function(_0x111adc){while(--_0x111adc){_0x171de5['push'](_0x171de5['shift']());}};_0x1c2d68(++_0x260fd1);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x243408,_0x3b1fe5){var _0x1a95e3=function(_0x2eaf64){while(--_0x2eaf64){_0x243408['push'](_0x243408['shift']());}};_0x1a95e3(++_0x3b1fe5);}(_0x70e0,0x17b));var _0x070e=function(_0x790d33,_0x53316e){_0x790d33=_0x790d33-0x0;var _0x20551d=_0x70e0[_0x790d33];return _0x20551d;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index a384685..2c6d511 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 _0xb70d=['sequelize','exports','INTEGER'];(function(_0x16051a,_0x5e4326){var _0x35d20d=function(_0x52b02e){while(--_0x52b02e){_0x16051a['push'](_0x16051a['shift']());}};_0x35d20d(++_0x5e4326);}(_0xb70d,0xc6));var _0xdb70=function(_0x24d6a8,_0x5aa3a7){_0x24d6a8=_0x24d6a8-0x0;var _0x4255dc=_0xb70d[_0x24d6a8];return _0x4255dc;};'use strict';var Sequelize=require(_0xdb70('0x0'));module[_0xdb70('0x1')]={'penalty':{'type':Sequelize[_0xdb70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7f84=['INTEGER','sequelize','exports'];(function(_0x6ec16,_0x2e8212){var _0x2b62ac=function(_0x3aa462){while(--_0x3aa462){_0x6ec16['push'](_0x6ec16['shift']());}};_0x2b62ac(++_0x2e8212);}(_0x7f84,0xa6));var _0x47f8=function(_0x8b6f3,_0x94c494){_0x8b6f3=_0x8b6f3-0x0;var _0x38d34d=_0x7f84[_0x8b6f3];return _0x38d34d;};'use strict';var Sequelize=require(_0x47f8('0x0'));module[_0x47f8('0x1')]={'penalty':{'type':Sequelize[_0x47f8('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index dda54b5..c265b1f 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 _0x7046=['path','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x50c7d6,_0x43aaed){var _0x4e1b11=function(_0x247a15){while(--_0x247a15){_0x50c7d6['push'](_0x50c7d6['shift']());}};_0x4e1b11(++_0x43aaed);}(_0x7046,0x144));var _0x6704=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x7046[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var logger=require(_0x6704('0x2'))(_0x6704('0x3'));var moment=require('moment');var BPromise=require(_0x6704('0x4'));var rp=require(_0x6704('0x5'));var fs=require('fs');var path=require(_0x6704('0x6'));var rimraf=require('rimraf');var config=require(_0x6704('0x7'));var attributes=require(_0x6704('0x8'));module[_0x6704('0x9')]=function(_0x626a14,_0x2917be){return _0x626a14['define'](_0x6704('0xa'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb46f=['request-promise','path','../../config/environment','exports','define','UserSmsQueue','lodash','util','api','moment','bluebird'];(function(_0x105128,_0xd88b17){var _0x3c4877=function(_0x335037){while(--_0x335037){_0x105128['push'](_0x105128['shift']());}};_0x3c4877(++_0xd88b17);}(_0xb46f,0xb6));var _0xfb46=function(_0x549af1,_0x205efd){_0x549af1=_0x549af1-0x0;var _0x4760ec=_0xb46f[_0x549af1];return _0x4760ec;};'use strict';var _=require(_0xfb46('0x0'));var util=require(_0xfb46('0x1'));var logger=require('../../config/logger')(_0xfb46('0x2'));var moment=require(_0xfb46('0x3'));var BPromise=require(_0xfb46('0x4'));var rp=require(_0xfb46('0x5'));var fs=require('fs');var path=require(_0xfb46('0x6'));var rimraf=require('rimraf');var config=require(_0xfb46('0x7'));var attributes=require('./userSmsQueue.attributes');module[_0xfb46('0x8')]=function(_0x3a5255,_0x186da6){return _0x3a5255[_0xfb46('0x9')](_0xfb46('0xa'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index a15a625..04c64a1 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 _0xee1c=['http','request','then','info','request\x20sent','debug','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x41780b,_0x19b998){var _0x38c281=function(_0x1b07cc){while(--_0x1b07cc){_0x41780b['push'](_0x41780b['shift']());}};_0x38c281(++_0x19b998);}(_0xee1c,0x1da));var _0xcee1=function(_0x3d4876,_0x366386){_0x3d4876=_0x3d4876-0x0;var _0x58ca9d=_0xee1c[_0x3d4876];return _0x58ca9d;};'use strict';var _=require('lodash');var util=require(_0xcee1('0x0'));var moment=require(_0xcee1('0x1'));var BPromise=require('bluebird');var rs=require(_0xcee1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcee1('0x3'))['db'];var utils=require(_0xcee1('0x4'));var logger=require(_0xcee1('0x5'))('rpc');var config=require(_0xcee1('0x6'));var jayson=require(_0xcee1('0x7'));var client=jayson[_0xcee1('0x8')][_0xcee1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x351356,_0x31415a,_0x46a722){return new BPromise(function(_0x386994,_0x5a557f){return client[_0xcee1('0xa')](_0x351356,_0x46a722)[_0xcee1('0xb')](function(_0x1af5ac){logger[_0xcee1('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x31415a,_0xcee1('0xd'));logger[_0xcee1('0xe')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x31415a,_0xcee1('0xd'),JSON['stringify'](_0x1af5ac));if(_0x1af5ac[_0xcee1('0xf')]){if(_0x1af5ac[_0xcee1('0xf')][_0xcee1('0x10')]===0x1f4){logger[_0xcee1('0xf')](_0xcee1('0x11'),_0x31415a,_0x1af5ac[_0xcee1('0xf')]['message']);return _0x5a557f(_0x1af5ac[_0xcee1('0xf')][_0xcee1('0x12')]);}logger[_0xcee1('0xf')](_0xcee1('0x11'),_0x31415a,_0x1af5ac[_0xcee1('0xf')][_0xcee1('0x12')]);return _0x386994(_0x1af5ac[_0xcee1('0xf')]['message']);}else{logger[_0xcee1('0xc')](_0xcee1('0x11'),_0x31415a,_0xcee1('0xd'));_0x386994(_0x1af5ac[_0xcee1('0x13')]['message']);}})[_0xcee1('0x14')](function(_0x59f25a){logger['error'](_0xcee1('0x11'),_0x31415a,_0x59f25a);_0x5a557f(_0x59f25a);});});} \ No newline at end of file +var _0x3755=['error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4e780d,_0x55c884){var _0x4a8a11=function(_0x4315b2){while(--_0x4315b2){_0x4e780d['push'](_0x4e780d['shift']());}};_0x4a8a11(++_0x55c884);}(_0x3755,0x14f));var _0x5375=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x3755[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x5375('0x0'));var util=require('util');var moment=require(_0x5375('0x1'));var BPromise=require(_0x5375('0x2'));var rs=require(_0x5375('0x3'));var fs=require('fs');var Redis=require(_0x5375('0x4'));var db=require(_0x5375('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5375('0x6'));var config=require(_0x5375('0x7'));var jayson=require(_0x5375('0x8'));var client=jayson[_0x5375('0x9')][_0x5375('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5623b0,_0x2c3fc9,_0x3a42bf){return new BPromise(function(_0x39f5fb,_0x187674){return client[_0x5375('0xb')](_0x5623b0,_0x3a42bf)[_0x5375('0xc')](function(_0xd16239){logger['info'](_0x5375('0xd'),_0x2c3fc9,_0x5375('0xe'));logger['debug'](_0x5375('0xf'),_0x2c3fc9,'request\x20sent',JSON[_0x5375('0x10')](_0xd16239));if(_0xd16239[_0x5375('0x11')]){if(_0xd16239[_0x5375('0x11')]['code']===0x1f4){logger[_0x5375('0x11')](_0x5375('0xd'),_0x2c3fc9,_0xd16239[_0x5375('0x11')][_0x5375('0x12')]);return _0x187674(_0xd16239['error'][_0x5375('0x12')]);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x2c3fc9,_0xd16239['error'][_0x5375('0x12')]);return _0x39f5fb(_0xd16239[_0x5375('0x11')][_0x5375('0x12')]);}else{logger[_0x5375('0x13')](_0x5375('0xd'),_0x2c3fc9,_0x5375('0xe'));_0x39f5fb(_0xd16239[_0x5375('0x14')][_0x5375('0x12')]);}})[_0x5375('0x15')](function(_0x1645fd){logger[_0x5375('0x11')](_0x5375('0xd'),_0x2c3fc9,_0x1645fd);_0x187674(_0x1645fd);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 0e59c53..1133375 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 _0x5b23=['INTEGER','sequelize','exports'];(function(_0x1481b2,_0x3afbd9){var _0x5f4282=function(_0x2b24b8){while(--_0x2b24b8){_0x1481b2['push'](_0x1481b2['shift']());}};_0x5f4282(++_0x3afbd9);}(_0x5b23,0xd9));var _0x35b2=function(_0x420282,_0x1f941f){_0x420282=_0x420282-0x0;var _0x535480=_0x5b23[_0x420282];return _0x535480;};'use strict';var Sequelize=require(_0x35b2('0x0'));module[_0x35b2('0x1')]={'UserId':{'type':Sequelize[_0x35b2('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xf31a=['sequelize','INTEGER'];(function(_0x587693,_0x27fe90){var _0x510a1a=function(_0x290f71){while(--_0x290f71){_0x587693['push'](_0x587693['shift']());}};_0x510a1a(++_0x27fe90);}(_0xf31a,0xfc));var _0xaf31=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xf31a[_0x4b2863];return _0x567d67;};'use strict';var Sequelize=require(_0xaf31('0x0'));module['exports']={'UserId':{'type':Sequelize[_0xaf31('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xaf31('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 8c8db76..37dc05c 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(_0x2117fa,_0x524d1b){var _0x139542=function(_0x4cdad9){while(--_0x4cdad9){_0x2117fa['push'](_0x2117fa['shift']());}};_0x139542(++_0x524d1b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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(_0x39ef91,_0x1574b7){var _0x591ad0=function(_0x3ae300){while(--_0x3ae300){_0x39ef91['push'](_0x39ef91['shift']());}};_0x591ad0(++_0x1574b7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 6799d63..c0cf8a4 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x43ebac,_0x2fc79b){var _0xe417b0=function(_0x251c40){while(--_0x251c40){_0x43ebac['push'](_0x43ebac['shift']());}};_0xe417b0(++_0x2fc79b);}(_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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x40bb88,_0x3e1ad6){var _0x5dba91=function(_0x288134){while(--_0x288134){_0x40bb88['push'](_0x40bb88['shift']());}};_0x5dba91(++_0x3e1ad6);}(_0xe706,0xa3));var _0x6e70=function(_0x1ac15c,_0x273d6e){_0x1ac15c=_0x1ac15c-0x0;var _0x5bfd19=_0xe706[_0x1ac15c];return _0x5bfd19;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 1fed9de..496da28 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 _0xb22e=['sequelize','exports','INTEGER'];(function(_0x47b7c9,_0x3848b2){var _0x435aaf=function(_0x3befc4){while(--_0x3befc4){_0x47b7c9['push'](_0x47b7c9['shift']());}};_0x435aaf(++_0x3848b2);}(_0xb22e,0x81));var _0xeb22=function(_0x2683af,_0xed2c4c){_0x2683af=_0x2683af-0x0;var _0x5bba33=_0xb22e[_0x2683af];return _0x5bba33;};'use strict';var Sequelize=require(_0xeb22('0x0'));module[_0xeb22('0x1')]={'penalty':{'type':Sequelize[_0xeb22('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2718=['sequelize','exports'];(function(_0xcc9a6,_0x329554){var _0x225b08=function(_0x34d8ca){while(--_0x34d8ca){_0xcc9a6['push'](_0xcc9a6['shift']());}};_0x225b08(++_0x329554);}(_0x2718,0xd4));var _0x8271=function(_0x33c331,_0x514566){_0x33c331=_0x33c331-0x0;var _0x4a5f06=_0x2718[_0x33c331];return _0x4a5f06;};'use strict';var Sequelize=require(_0x8271('0x0'));module[_0x8271('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 6aa6a3a..237ce95 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 _0xe8b1=['api','moment','bluebird','request-promise','path','rimraf','./userVoiceQueue.attributes','exports','user_has_voice_queues','lodash','util','../../config/logger'];(function(_0xd63ad8,_0x2f884){var _0x87159a=function(_0x37d9c6){while(--_0x37d9c6){_0xd63ad8['push'](_0xd63ad8['shift']());}};_0x87159a(++_0x2f884);}(_0xe8b1,0x69));var _0x1e8b=function(_0x3dea7d,_0x2cd4ea){_0x3dea7d=_0x3dea7d-0x0;var _0x53919a=_0xe8b1[_0x3dea7d];return _0x53919a;};'use strict';var _=require(_0x1e8b('0x0'));var util=require(_0x1e8b('0x1'));var logger=require(_0x1e8b('0x2'))(_0x1e8b('0x3'));var moment=require(_0x1e8b('0x4'));var BPromise=require(_0x1e8b('0x5'));var rp=require(_0x1e8b('0x6'));var fs=require('fs');var path=require(_0x1e8b('0x7'));var rimraf=require(_0x1e8b('0x8'));var config=require('../../config/environment');var attributes=require(_0x1e8b('0x9'));module[_0x1e8b('0xa')]=function(_0x30aab8,_0x240125){return _0x30aab8['define']('UserVoiceQueue',attributes,{'tableName':_0x1e8b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe0c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','user_has_voice_queues','lodash','util','../../config/logger','api'];(function(_0x836bb4,_0x565f4b){var _0x4f5a56=function(_0x183a19){while(--_0x183a19){_0x836bb4['push'](_0x836bb4['shift']());}};_0x4f5a56(++_0x565f4b);}(_0xbe0c,0xce));var _0xcbe0=function(_0x5d283b,_0x14d1de){_0x5d283b=_0x5d283b-0x0;var _0x3a7d42=_0xbe0c[_0x5d283b];return _0x3a7d42;};'use strict';var _=require(_0xcbe0('0x0'));var util=require(_0xcbe0('0x1'));var logger=require(_0xcbe0('0x2'))(_0xcbe0('0x3'));var moment=require(_0xcbe0('0x4'));var BPromise=require(_0xcbe0('0x5'));var rp=require(_0xcbe0('0x6'));var fs=require('fs');var path=require(_0xcbe0('0x7'));var rimraf=require(_0xcbe0('0x8'));var config=require(_0xcbe0('0x9'));var attributes=require(_0xcbe0('0xa'));module[_0xcbe0('0xb')]=function(_0xbc53e0,_0x47698b){return _0xbc53e0[_0xcbe0('0xc')]('UserVoiceQueue',attributes,{'tableName':_0xcbe0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index bceadee..9a8f9ca 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 _0x3eb8=['stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x3eb8,0x18c));var _0x83eb=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x3eb8[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x83eb('0x0'));var util=require(_0x83eb('0x1'));var moment=require(_0x83eb('0x2'));var BPromise=require('bluebird');var rs=require(_0x83eb('0x3'));var fs=require('fs');var Redis=require(_0x83eb('0x4'));var db=require(_0x83eb('0x5'))['db'];var utils=require(_0x83eb('0x6'));var logger=require('../../config/logger')(_0x83eb('0x7'));var config=require(_0x83eb('0x8'));var jayson=require(_0x83eb('0x9'));var client=jayson[_0x83eb('0xa')][_0x83eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x578430,_0x31d678,_0x40b7fb){return new BPromise(function(_0x154077,_0x5568d1){return client[_0x83eb('0xc')](_0x578430,_0x40b7fb)[_0x83eb('0xd')](function(_0x4c3ae2){logger[_0x83eb('0xe')](_0x83eb('0xf'),_0x31d678,_0x83eb('0x10'));logger['debug'](_0x83eb('0x11'),_0x31d678,_0x83eb('0x10'),JSON[_0x83eb('0x12')](_0x4c3ae2));if(_0x4c3ae2['error']){if(_0x4c3ae2[_0x83eb('0x13')][_0x83eb('0x14')]===0x1f4){logger['error'](_0x83eb('0xf'),_0x31d678,_0x4c3ae2[_0x83eb('0x13')][_0x83eb('0x15')]);return _0x5568d1(_0x4c3ae2[_0x83eb('0x13')][_0x83eb('0x15')]);}logger[_0x83eb('0x13')](_0x83eb('0xf'),_0x31d678,_0x4c3ae2[_0x83eb('0x13')][_0x83eb('0x15')]);return _0x154077(_0x4c3ae2[_0x83eb('0x13')][_0x83eb('0x15')]);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x31d678,'request\x20sent');_0x154077(_0x4c3ae2[_0x83eb('0x16')][_0x83eb('0x15')]);}})['catch'](function(_0x42613f){logger['error'](_0x83eb('0xf'),_0x31d678,_0x42613f);_0x5568d1(_0x42613f);});});} \ No newline at end of file +var _0x50ed=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x284609,_0x386b54){var _0x55116b=function(_0x3cdc4e){while(--_0x3cdc4e){_0x284609['push'](_0x284609['shift']());}};_0x55116b(++_0x386b54);}(_0x50ed,0x14b));var _0xd50e=function(_0x3dc2c5,_0x1ea287){_0x3dc2c5=_0x3dc2c5-0x0;var _0x9da9a9=_0x50ed[_0x3dc2c5];return _0x9da9a9;};'use strict';var _=require(_0xd50e('0x0'));var util=require(_0xd50e('0x1'));var moment=require('moment');var BPromise=require(_0xd50e('0x2'));var rs=require(_0xd50e('0x3'));var fs=require('fs');var Redis=require(_0xd50e('0x4'));var db=require(_0xd50e('0x5'))['db'];var utils=require(_0xd50e('0x6'));var logger=require(_0xd50e('0x7'))(_0xd50e('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd50e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3230,_0x48900d,_0x5493ef){return new BPromise(function(_0x147987,_0x5b1f5a){return client[_0xd50e('0xa')](_0x5b3230,_0x5493ef)[_0xd50e('0xb')](function(_0x46dfb8){logger[_0xd50e('0xc')](_0xd50e('0xd'),_0x48900d,_0xd50e('0xe'));logger['debug'](_0xd50e('0xf'),_0x48900d,_0xd50e('0xe'),JSON[_0xd50e('0x10')](_0x46dfb8));if(_0x46dfb8[_0xd50e('0x11')]){if(_0x46dfb8[_0xd50e('0x11')][_0xd50e('0x12')]===0x1f4){logger[_0xd50e('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x48900d,_0x46dfb8['error'][_0xd50e('0x13')]);return _0x5b1f5a(_0x46dfb8[_0xd50e('0x11')][_0xd50e('0x13')]);}logger[_0xd50e('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x48900d,_0x46dfb8[_0xd50e('0x11')][_0xd50e('0x13')]);return _0x147987(_0x46dfb8[_0xd50e('0x11')][_0xd50e('0x13')]);}else{logger[_0xd50e('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x48900d,_0xd50e('0xe'));_0x147987(_0x46dfb8[_0xd50e('0x14')]['message']);}})[_0xd50e('0x15')](function(_0x5f17e2){logger[_0xd50e('0x11')](_0xd50e('0xd'),_0x48900d,_0x5f17e2);_0x5b1f5a(_0x5f17e2);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 8e4a375..0ad8814 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2c7377,_0x32ade5){var _0x35e181=function(_0x1be1e6){while(--_0x1be1e6){_0x2c7377['push'](_0x2c7377['shift']());}};_0x35e181(++_0x32ade5);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x103994,_0x341732){var _0x4c4988=function(_0x296806){while(--_0x296806){_0x103994['push'](_0x103994['shift']());}};_0x4c4988(++_0x341732);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 9c5ca7e..80147c4 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 _0xfdf4=['exports','INTEGER','Required\x20by\x20Asterisk','queue_interface','STRING'];(function(_0x4d91d4,_0x349ae2){var _0x348829=function(_0x5a1e7c){while(--_0x5a1e7c){_0x4d91d4['push'](_0x4d91d4['shift']());}};_0x348829(++_0x349ae2);}(_0xfdf4,0xb4));var _0x4fdf=function(_0x142c9e,_0x141cd7){_0x142c9e=_0x142c9e-0x0;var _0x6d03b6=_0xfdf4[_0x142c9e];return _0x6d03b6;};'use strict';var Sequelize=require('sequelize');module[_0x4fdf('0x0')]={'uniqueid':{'type':Sequelize[_0x4fdf('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x4fdf('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x4fdf('0x2')},'UserId':{'type':Sequelize[_0x4fdf('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4fdf('0x3'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x4fdf('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x4fdf('0x4')],'allowNull':![],'unique':_0x4fdf('0x3'),'comment':_0x4fdf('0x2')},'penalty':{'type':Sequelize[_0x4fdf('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x4fdf('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x6d5f=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x329664,_0x130748){var _0x4e346e=function(_0x172b0d){while(--_0x172b0d){_0x329664['push'](_0x329664['shift']());}};_0x4e346e(++_0x130748);}(_0x6d5f,0x92));var _0xf6d5=function(_0x53b2cd,_0x18747e){_0x53b2cd=_0x53b2cd-0x0;var _0x100d52=_0x6d5f[_0x53b2cd];return _0x100d52;};'use strict';var Sequelize=require(_0xf6d5('0x0'));module[_0xf6d5('0x1')]={'uniqueid':{'type':Sequelize[_0xf6d5('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xf6d5('0x3')},'membername':{'type':Sequelize[_0xf6d5('0x4')],'allowNull':![],'comment':_0xf6d5('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xf6d5('0x4')],'allowNull':![],'unique':_0xf6d5('0x5'),'comment':_0xf6d5('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xf6d5('0x4')],'allowNull':![],'unique':_0xf6d5('0x5'),'comment':_0xf6d5('0x3')},'penalty':{'type':Sequelize[_0xf6d5('0x2')](0xb),'defaultValue':0x0,'comment':_0xf6d5('0x3')},'paused':{'type':Sequelize[_0xf6d5('0x2')](0xb),'defaultValue':0x0,'comment':_0xf6d5('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index ccbd482..19655db 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 _0x960c=['UserVoiceQueueRt','setMaxListeners','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x3815b2,_0xdeaa84){var _0x2ebd79=function(_0x4ed85a){while(--_0x4ed85a){_0x3815b2['push'](_0x3815b2['shift']());}};_0x2ebd79(++_0xdeaa84);}(_0x960c,0x154));var _0xc960=function(_0x293238,_0x4d7287){_0x293238=_0x293238-0x0;var _0x1e1b5c=_0x960c[_0x293238];return _0x1e1b5c;};'use strict';var EventEmitter=require(_0xc960('0x0'));var UserVoiceQueueRt=require(_0xc960('0x1'))['db'][_0xc960('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xc960('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc960('0x4'),'afterDestroy':_0xc960('0x5')};function emitEvent(_0x117e0b){return function(_0x1d4119,_0x159271,_0x37bc4a){UserVoiceQueueRtEvents['emit'](_0x117e0b+':'+_0x1d4119['id'],_0x1d4119);UserVoiceQueueRtEvents[_0xc960('0x6')](_0x117e0b,_0x1d4119);_0x37bc4a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xc960('0x7')](e,emitEvent(event));}}module[_0xc960('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x972d=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x438e18,_0x52e2c5){var _0x50c6ea=function(_0x7ae358){while(--_0x7ae358){_0x438e18['push'](_0x438e18['shift']());}};_0x50c6ea(++_0x52e2c5);}(_0x972d,0xcb));var _0xd972=function(_0x3d6db1,_0x4358f8){_0x3d6db1=_0x3d6db1-0x0;var _0x5e1cc3=_0x972d[_0x3d6db1];return _0x5e1cc3;};'use strict';var EventEmitter=require(_0xd972('0x0'));var UserVoiceQueueRt=require(_0xd972('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xd972('0x2')](0x0);var events={'afterCreate':_0xd972('0x3'),'afterUpdate':_0xd972('0x4'),'afterDestroy':_0xd972('0x5')};function emitEvent(_0x31e6d2){return function(_0x408ceb,_0x132c6a,_0x3752e6){UserVoiceQueueRtEvents[_0xd972('0x6')](_0x31e6d2+':'+_0x408ceb['id'],_0x408ceb);UserVoiceQueueRtEvents[_0xd972('0x6')](_0x31e6d2,_0x408ceb);_0x3752e6(null);};}for(var e in events){if(events[_0xd972('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xd972('0x8')](e,emitEvent(event));}}module[_0xd972('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 1f30199..b6e98d2 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 _0x6362=['bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','lodash','util','api','moment'];(function(_0x16dbab,_0x3ac1e1){var _0x59b0b2=function(_0x2e13e2){while(--_0x2e13e2){_0x16dbab['push'](_0x16dbab['shift']());}};_0x59b0b2(++_0x3ac1e1);}(_0x6362,0x14e));var _0x2636=function(_0xabb7ba,_0x54612d){_0xabb7ba=_0xabb7ba-0x0;var _0x3fb15e=_0x6362[_0xabb7ba];return _0x3fb15e;};'use strict';var _=require(_0x2636('0x0'));var util=require(_0x2636('0x1'));var logger=require('../../config/logger')(_0x2636('0x2'));var moment=require(_0x2636('0x3'));var BPromise=require(_0x2636('0x4'));var rp=require(_0x2636('0x5'));var fs=require('fs');var path=require(_0x2636('0x6'));var rimraf=require(_0x2636('0x7'));var config=require(_0x2636('0x8'));var attributes=require(_0x2636('0x9'));module[_0x2636('0xa')]=function(_0x252de5,_0x5c49c7){return _0x252de5[_0x2636('0xb')](_0x2636('0xc'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ef2=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x333767,_0x3e6f9c){var _0x51661b=function(_0x46e5d6){while(--_0x46e5d6){_0x333767['push'](_0x333767['shift']());}};_0x51661b(++_0x3e6f9c);}(_0x0ef2,0x8f));var _0x20ef=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0x0ef2[_0x386c3e];return _0x4b8e13;};'use strict';var _=require(_0x20ef('0x0'));var util=require(_0x20ef('0x1'));var logger=require('../../config/logger')(_0x20ef('0x2'));var moment=require('moment');var BPromise=require(_0x20ef('0x3'));var rp=require(_0x20ef('0x4'));var fs=require('fs');var path=require(_0x20ef('0x5'));var rimraf=require(_0x20ef('0x6'));var config=require(_0x20ef('0x7'));var attributes=require(_0x20ef('0x8'));module[_0x20ef('0x9')]=function(_0x22f2a4,_0x33b4ab){return _0x22f2a4[_0x20ef('0xa')](_0x20ef('0xb'),attributes,{'tableName':_0x20ef('0xc'),'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 848db77..d0366dc 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 _0x3901=['UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','findAll','options','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','request\x20sent','debug','stringify','error'];(function(_0x530077,_0x413ea1){var _0x217e25=function(_0x2139f2){while(--_0x2139f2){_0x530077['push'](_0x530077['shift']());}};_0x217e25(++_0x413ea1);}(_0x3901,0x124));var _0x1390=function(_0x2697f3,_0x44084c){_0x2697f3=_0x2697f3-0x0;var _0x558909=_0x3901[_0x2697f3];return _0x558909;};'use strict';var _=require(_0x1390('0x0'));var util=require(_0x1390('0x1'));var moment=require(_0x1390('0x2'));var BPromise=require(_0x1390('0x3'));var rs=require(_0x1390('0x4'));var fs=require('fs');var Redis=require(_0x1390('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1390('0x6'));var logger=require(_0x1390('0x7'))('rpc');var config=require(_0x1390('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1390('0x9')][_0x1390('0xa')]({'port':0x232a});config[_0x1390('0xb')]=_[_0x1390('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1390('0xd'))(new Redis(config[_0x1390('0xb')]));require(_0x1390('0xe'))[_0x1390('0xf')](socket);function respondWithRpcPromise(_0x64815d,_0x4bc9c1,_0x1126bd){return new BPromise(function(_0x9be401,_0x2ed6a3){return client[_0x1390('0x10')](_0x64815d,_0x1126bd)[_0x1390('0x11')](function(_0x29e55d){logger[_0x1390('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x4bc9c1,_0x1390('0x13'));logger[_0x1390('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x4bc9c1,'request\x20sent',JSON[_0x1390('0x15')](_0x29e55d));if(_0x29e55d[_0x1390('0x16')]){if(_0x29e55d['error']['code']===0x1f4){logger[_0x1390('0x16')](_0x1390('0x17'),_0x4bc9c1,_0x29e55d[_0x1390('0x16')][_0x1390('0x18')]);return _0x2ed6a3(_0x29e55d[_0x1390('0x16')][_0x1390('0x18')]);}logger[_0x1390('0x16')](_0x1390('0x17'),_0x4bc9c1,_0x29e55d['error'][_0x1390('0x18')]);return _0x9be401(_0x29e55d['error'][_0x1390('0x18')]);}else{logger[_0x1390('0x12')](_0x1390('0x17'),_0x4bc9c1,_0x1390('0x13'));_0x9be401(_0x29e55d[_0x1390('0x19')]['message']);}})[_0x1390('0x1a')](function(_0x54505e){logger[_0x1390('0x16')](_0x1390('0x17'),_0x4bc9c1,_0x54505e);_0x2ed6a3(_0x54505e);});});}exports['GetVoiceQueueRtPauses']=function(_0x2ed890){var _0x320631=this;return new Promise(function(_0x3d9e1f,_0x462460){return db['UserVoiceQueueRt'][_0x1390('0x1b')]({'raw':_0x2ed890[_0x1390('0x1c')]?_0x2ed890[_0x1390('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x2ed890[_0x1390('0x1c')]?_0x2ed890[_0x1390('0x1c')]['where']||null:null,'attributes':[[db[_0x1390('0x1d')]['fn'](_0x1390('0x1e'),db[_0x1390('0x1d')]['fn']('IF',db[_0x1390('0x1d')][_0x1390('0x1f')](_0x1390('0x20')))),_0x1390('0x21')]]})[_0x1390('0x11')](function(_0x2af430){logger['info']('GetVoiceQueueRtPauses',_0x2ed890);logger[_0x1390('0x14')]('GetVoiceQueueRtPauses',_0x2ed890,JSON[_0x1390('0x15')](_0x2af430));_0x3d9e1f(_0x2af430);})[_0x1390('0x1a')](function(_0x2376a9){logger['error'](_0x1390('0x22'),_0x2376a9[_0x1390('0x18')],_0x2ed890);_0x462460(_0x320631[_0x1390('0x16')](0x1f4,_0x2376a9['message']));});});}; \ No newline at end of file +var _0x45be=['UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','UserVoiceQueueRt','findAll','options','raw','where','COUNT','sequelize','outboundQueuePauses','then','GetVoiceQueueRtPauses','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','info','UserVoiceQueueRt,\x20%s,\x20%s'];(function(_0x551566,_0x5d4629){var _0x3b2b12=function(_0x1ac800){while(--_0x1ac800){_0x551566['push'](_0x551566['shift']());}};_0x3b2b12(++_0x5d4629);}(_0x45be,0xe3));var _0xe45b=function(_0x44a747,_0x21487e){_0x44a747=_0x44a747-0x0;var _0x46b052=_0x45be[_0x44a747];return _0x46b052;};'use strict';var _=require(_0xe45b('0x0'));var util=require(_0xe45b('0x1'));var moment=require(_0xe45b('0x2'));var BPromise=require(_0xe45b('0x3'));var rs=require(_0xe45b('0x4'));var fs=require('fs');var Redis=require(_0xe45b('0x5'));var db=require(_0xe45b('0x6'))['db'];var utils=require(_0xe45b('0x7'));var logger=require(_0xe45b('0x8'))(_0xe45b('0x9'));var config=require(_0xe45b('0xa'));var jayson=require(_0xe45b('0xb'));var client=jayson[_0xe45b('0xc')][_0xe45b('0xd')]({'port':0x232a});config[_0xe45b('0xe')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe45b('0xf'))(new Redis(config[_0xe45b('0xe')]));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0xf6c336,_0x33e3b9,_0x45c920){return new BPromise(function(_0x1e0721,_0x4e9e2b){return client['request'](_0xf6c336,_0x45c920)['then'](function(_0x1aa4e2){logger[_0xe45b('0x10')](_0xe45b('0x11'),_0x33e3b9,'request\x20sent');logger['debug'](_0xe45b('0x12'),_0x33e3b9,_0xe45b('0x13'),JSON[_0xe45b('0x14')](_0x1aa4e2));if(_0x1aa4e2[_0xe45b('0x15')]){if(_0x1aa4e2[_0xe45b('0x15')]['code']===0x1f4){logger[_0xe45b('0x15')](_0xe45b('0x11'),_0x33e3b9,_0x1aa4e2['error'][_0xe45b('0x16')]);return _0x4e9e2b(_0x1aa4e2[_0xe45b('0x15')][_0xe45b('0x16')]);}logger['error'](_0xe45b('0x11'),_0x33e3b9,_0x1aa4e2[_0xe45b('0x15')][_0xe45b('0x16')]);return _0x1e0721(_0x1aa4e2[_0xe45b('0x15')]['message']);}else{logger[_0xe45b('0x10')](_0xe45b('0x11'),_0x33e3b9,_0xe45b('0x13'));_0x1e0721(_0x1aa4e2['result'][_0xe45b('0x16')]);}})['catch'](function(_0x525ccb){logger[_0xe45b('0x15')](_0xe45b('0x11'),_0x33e3b9,_0x525ccb);_0x4e9e2b(_0x525ccb);});});}exports['GetVoiceQueueRtPauses']=function(_0x152cb3){var _0x4b6705=this;return new Promise(function(_0x42615f,_0x55169d){return db[_0xe45b('0x17')][_0xe45b('0x18')]({'raw':_0x152cb3[_0xe45b('0x19')]?_0x152cb3[_0xe45b('0x19')][_0xe45b('0x1a')]===undefined?!![]:![]:!![],'where':_0x152cb3[_0xe45b('0x19')]?_0x152cb3['options'][_0xe45b('0x1b')]||null:null,'attributes':[[db['sequelize']['fn'](_0xe45b('0x1c'),db[_0xe45b('0x1d')]['fn']('IF',db[_0xe45b('0x1d')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0xe45b('0x1e')]]})[_0xe45b('0x1f')](function(_0x599ab4){logger[_0xe45b('0x10')](_0xe45b('0x20'),_0x152cb3);logger[_0xe45b('0x21')](_0xe45b('0x20'),_0x152cb3,JSON[_0xe45b('0x14')](_0x599ab4));_0x42615f(_0x599ab4);})[_0xe45b('0x22')](function(_0x5296c1){logger[_0xe45b('0x15')](_0xe45b('0x20'),_0x5296c1[_0xe45b('0x16')],_0x152cb3);_0x55169d(_0x4b6705[_0xe45b('0x15')](0x1f4,_0x5296c1['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 382b0ba..ed170de 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 _0x7edb=['save','remove','update','emit','removeListener','register','length','userVoiceQueueRt:'];(function(_0x4ffb55,_0x18dc8e){var _0x5625ab=function(_0x471160){while(--_0x471160){_0x4ffb55['push'](_0x4ffb55['shift']());}};_0x5625ab(++_0x18dc8e);}(_0x7edb,0x158));var _0xb7ed=function(_0x548ce2,_0x271f70){_0x548ce2=_0x548ce2-0x0;var _0x4a26b9=_0x7edb[_0x548ce2];return _0x4a26b9;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xb7ed('0x0'),_0xb7ed('0x1'),_0xb7ed('0x2')];function createListener(_0x37440f,_0x15d080){return function(_0x5a485a){_0x15d080[_0xb7ed('0x3')](_0x37440f,_0x5a485a);};}function removeListener(_0x595b65,_0x4c8316){return function(){UserVoiceQueueRtEvents[_0xb7ed('0x4')](_0x595b65,_0x4c8316);};}exports[_0xb7ed('0x5')]=function(_0x2aa67d){for(var _0x246cfa=0x0,_0x85fdf0=events[_0xb7ed('0x6')];_0x246cfa<_0x85fdf0;_0x246cfa++){var _0xac7ffe=events[_0x246cfa];var _0x3c991d=createListener(_0xb7ed('0x7')+_0xac7ffe,_0x2aa67d);UserVoiceQueueRtEvents['on'](_0xac7ffe,_0x3c991d);}}; \ No newline at end of file +var _0xb39f=['remove','update','emit','removeListener','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x33e368,_0x2c721b){var _0x4ea064=function(_0x14d0d2){while(--_0x14d0d2){_0x33e368['push'](_0x33e368['shift']());}};_0x4ea064(++_0x2c721b);}(_0xb39f,0x1e6));var _0xfb39=function(_0x3b6f7d,_0x42b51c){_0x3b6f7d=_0x3b6f7d-0x0;var _0x2c8363=_0xb39f[_0x3b6f7d];return _0x2c8363;};'use strict';var UserVoiceQueueRtEvents=require(_0xfb39('0x0'));var events=[_0xfb39('0x1'),_0xfb39('0x2'),_0xfb39('0x3')];function createListener(_0x5ba2ac,_0x4bc0e0){return function(_0x588127){_0x4bc0e0[_0xfb39('0x4')](_0x5ba2ac,_0x588127);};}function removeListener(_0x50f9a1,_0x3d2ee9){return function(){UserVoiceQueueRtEvents[_0xfb39('0x5')](_0x50f9a1,_0x3d2ee9);};}exports['register']=function(_0x1619f6){for(var _0x455dbe=0x0,_0x45bb1c=events[_0xfb39('0x6')];_0x455dbe<_0x45bb1c;_0x455dbe++){var _0x4ce401=events[_0x455dbe];var _0x4daba2=createListener(_0xfb39('0x7')+_0x4ce401,_0x1619f6);UserVoiceQueueRtEvents['on'](_0x4ce401,_0x4daba2);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 09dcd56..56a1a15 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x28cb54,_0x1e32e0){var _0x4c6ade=function(_0x316769){while(--_0x316769){_0x28cb54['push'](_0x28cb54['shift']());}};_0x4c6ade(++_0x1e32e0);}(_0x70e0,0x17b));var _0x070e=function(_0x4f70fa,_0x352fca){_0x4f70fa=_0x4f70fa-0x0;var _0x19c581=_0x70e0[_0x4f70fa];return _0x19c581;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x591053,_0x523072){var _0x31ab80=function(_0x4a543f){while(--_0x4a543f){_0x591053['push'](_0x591053['shift']());}};_0x31ab80(++_0x523072);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index a840ba3..5eefcfd 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 _0x8d29=['exports','sequelize'];(function(_0x418714,_0x53d445){var _0x3782fb=function(_0xe7ac4){while(--_0xe7ac4){_0x418714['push'](_0x418714['shift']());}};_0x3782fb(++_0x53d445);}(_0x8d29,0x101));var _0x98d2=function(_0x5ef5ad,_0x2ea729){_0x5ef5ad=_0x5ef5ad-0x0;var _0x484ced=_0x8d29[_0x5ef5ad];return _0x484ced;};'use strict';var Sequelize=require(_0x98d2('0x0'));module[_0x98d2('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe491=['sequelize','exports'];(function(_0x56f7ad,_0x19da70){var _0x1eba4c=function(_0x124607){while(--_0x124607){_0x56f7ad['push'](_0x56f7ad['shift']());}};_0x1eba4c(++_0x19da70);}(_0xe491,0x1a0));var _0x1e49=function(_0x8d18d0,_0x52cca3){_0x8d18d0=_0x8d18d0-0x0;var _0x2bc202=_0xe491[_0x8d18d0];return _0x2bc202;};'use strict';var Sequelize=require(_0x1e49('0x0'));module[_0x1e49('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 083ebf5..87e68d3 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 _0x4ae9=['request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes','UserWhatsappQueue','lodash','api','moment','bluebird'];(function(_0xe0ce73,_0x2b5e80){var _0x33d685=function(_0x5875dc){while(--_0x5875dc){_0xe0ce73['push'](_0xe0ce73['shift']());}};_0x33d685(++_0x2b5e80);}(_0x4ae9,0xdd));var _0x94ae=function(_0x52753e,_0x1718bc){_0x52753e=_0x52753e-0x0;var _0x5b2cd5=_0x4ae9[_0x52753e];return _0x5b2cd5;};'use strict';var _=require(_0x94ae('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x94ae('0x1'));var moment=require(_0x94ae('0x2'));var BPromise=require(_0x94ae('0x3'));var rp=require(_0x94ae('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x94ae('0x5'));var config=require(_0x94ae('0x6'));var attributes=require(_0x94ae('0x7'));module['exports']=function(_0x21e939,_0x1ff88c){return _0x21e939['define'](_0x94ae('0x8'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ca2=['define','UserWhatsappQueue','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6ca2,0xff));var _0x26ca=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6ca2[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x26ca('0x0'));var util=require('util');var logger=require(_0x26ca('0x1'))('api');var moment=require(_0x26ca('0x2'));var BPromise=require(_0x26ca('0x3'));var rp=require(_0x26ca('0x4'));var fs=require('fs');var path=require(_0x26ca('0x5'));var rimraf=require(_0x26ca('0x6'));var config=require(_0x26ca('0x7'));var attributes=require('./userWhatsappQueue.attributes');module[_0x26ca('0x8')]=function(_0x1ddd7a,_0xec2454){return _0x1ddd7a[_0x26ca('0x9')](_0x26ca('0xa'),attributes,{'tableName':'user_has_whatsapp_queues','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 9cd7eeb..8100414 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 _0x5164=['jayson/promise','client','http','info','request\x20sent','debug','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1db4c8,_0x47004c){var _0x570c4b=function(_0x5b5ce0){while(--_0x5b5ce0){_0x1db4c8['push'](_0x1db4c8['shift']());}};_0x570c4b(++_0x47004c);}(_0x5164,0x198));var _0x4516=function(_0x453bcc,_0x3bb539){_0x453bcc=_0x453bcc-0x0;var _0x5cd80d=_0x5164[_0x453bcc];return _0x5cd80d;};'use strict';var _=require(_0x4516('0x0'));var util=require(_0x4516('0x1'));var moment=require(_0x4516('0x2'));var BPromise=require(_0x4516('0x3'));var rs=require(_0x4516('0x4'));var fs=require('fs');var Redis=require(_0x4516('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4516('0x6'));var logger=require(_0x4516('0x7'))(_0x4516('0x8'));var config=require(_0x4516('0x9'));var jayson=require(_0x4516('0xa'));var client=jayson[_0x4516('0xb')][_0x4516('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x89e92b,_0x53261f,_0x8a0e39){return new BPromise(function(_0x4bf2e7,_0x565ceb){return client['request'](_0x89e92b,_0x8a0e39)['then'](function(_0x56adad){logger[_0x4516('0xd')]('UserWhatsappQueue,\x20%s,\x20%s',_0x53261f,_0x4516('0xe'));logger[_0x4516('0xf')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x53261f,_0x4516('0xe'),JSON[_0x4516('0x10')](_0x56adad));if(_0x56adad[_0x4516('0x11')]){if(_0x56adad[_0x4516('0x11')][_0x4516('0x12')]===0x1f4){logger['error'](_0x4516('0x13'),_0x53261f,_0x56adad['error'][_0x4516('0x14')]);return _0x565ceb(_0x56adad['error'][_0x4516('0x14')]);}logger[_0x4516('0x11')](_0x4516('0x13'),_0x53261f,_0x56adad[_0x4516('0x11')][_0x4516('0x14')]);return _0x4bf2e7(_0x56adad[_0x4516('0x11')][_0x4516('0x14')]);}else{logger[_0x4516('0xd')](_0x4516('0x13'),_0x53261f,'request\x20sent');_0x4bf2e7(_0x56adad['result']['message']);}})[_0x4516('0x15')](function(_0x16a2c7){logger[_0x4516('0x11')](_0x4516('0x13'),_0x53261f,_0x16a2c7);_0x565ceb(_0x16a2c7);});});} \ No newline at end of file +var _0x68f0=['info','UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x28d9a9,_0x1f3afe){var _0x3533ee=function(_0x463948){while(--_0x463948){_0x28d9a9['push'](_0x28d9a9['shift']());}};_0x3533ee(++_0x1f3afe);}(_0x68f0,0x7d));var _0x068f=function(_0x3dcabf,_0x3af156){_0x3dcabf=_0x3dcabf-0x0;var _0x4ad179=_0x68f0[_0x3dcabf];return _0x4ad179;};'use strict';var _=require(_0x068f('0x0'));var util=require(_0x068f('0x1'));var moment=require('moment');var BPromise=require(_0x068f('0x2'));var rs=require(_0x068f('0x3'));var fs=require('fs');var Redis=require(_0x068f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x068f('0x5'));var logger=require('../../config/logger')(_0x068f('0x6'));var config=require(_0x068f('0x7'));var jayson=require(_0x068f('0x8'));var client=jayson[_0x068f('0x9')][_0x068f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e4215,_0x2a28f3,_0x140906){return new BPromise(function(_0x46fb2f,_0x9208ea){return client[_0x068f('0xb')](_0x2e4215,_0x140906)[_0x068f('0xc')](function(_0x4fff45){logger[_0x068f('0xd')](_0x068f('0xe'),_0x2a28f3,'request\x20sent');logger[_0x068f('0xf')](_0x068f('0x10'),_0x2a28f3,_0x068f('0x11'),JSON['stringify'](_0x4fff45));if(_0x4fff45[_0x068f('0x12')]){if(_0x4fff45[_0x068f('0x12')][_0x068f('0x13')]===0x1f4){logger[_0x068f('0x12')](_0x068f('0xe'),_0x2a28f3,_0x4fff45[_0x068f('0x12')][_0x068f('0x14')]);return _0x9208ea(_0x4fff45[_0x068f('0x12')][_0x068f('0x14')]);}logger[_0x068f('0x12')](_0x068f('0xe'),_0x2a28f3,_0x4fff45[_0x068f('0x12')][_0x068f('0x14')]);return _0x46fb2f(_0x4fff45['error']['message']);}else{logger[_0x068f('0xd')](_0x068f('0xe'),_0x2a28f3,'request\x20sent');_0x46fb2f(_0x4fff45[_0x068f('0x15')][_0x068f('0x14')]);}})[_0x068f('0x16')](function(_0x23ca03){logger['error'](_0x068f('0xe'),_0x2a28f3,_0x23ca03);_0x9208ea(_0x23ca03);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index bf65c8f..64a8caa 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 _0xc874=['put','update','delete','destroy','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./variable.controller','get','index','/:id','isAuthenticated','show'];(function(_0x1630f8,_0x173a13){var _0x22e185=function(_0x3ebfac){while(--_0x3ebfac){_0x1630f8['push'](_0x1630f8['shift']());}};_0x22e185(++_0x173a13);}(_0xc874,0x154));var _0x4c87=function(_0x4d674b,_0x176474){_0x4d674b=_0x4d674b-0x0;var _0x535a1f=_0xc874[_0x4d674b];return _0x535a1f;};'use strict';var multer=require(_0x4c87('0x0'));var util=require('util');var path=require(_0x4c87('0x1'));var timeout=require(_0x4c87('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4c87('0x3'));var auth=require(_0x4c87('0x4'));var interaction=require(_0x4c87('0x5'));var config=require('../../config/environment');var controller=require(_0x4c87('0x6'));router[_0x4c87('0x7')]('/',auth['isAuthenticated'](),controller[_0x4c87('0x8')]);router[_0x4c87('0x7')](_0x4c87('0x9'),auth[_0x4c87('0xa')](),controller[_0x4c87('0xb')]);router['post']('/',auth[_0x4c87('0xa')](),controller['create']);router[_0x4c87('0xc')](_0x4c87('0x9'),auth[_0x4c87('0xa')](),controller[_0x4c87('0xd')]);router[_0x4c87('0xe')]('/:id',auth[_0x4c87('0xa')](),controller[_0x4c87('0xf')]);module['exports']=router; \ No newline at end of file +var _0x0ba7=['create','put','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x3d34da,_0x3abcc1){var _0xcf6af8=function(_0x300a53){while(--_0x300a53){_0x3d34da['push'](_0x3d34da['shift']());}};_0xcf6af8(++_0x3abcc1);}(_0x0ba7,0x16d));var _0x70ba=function(_0x3cda35,_0x425ef0){_0x3cda35=_0x3cda35-0x0;var _0x2071a6=_0x0ba7[_0x3cda35];return _0x2071a6;};'use strict';var multer=require(_0x70ba('0x0'));var util=require('util');var path=require(_0x70ba('0x1'));var timeout=require(_0x70ba('0x2'));var express=require(_0x70ba('0x3'));var router=express[_0x70ba('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x70ba('0x5'));var interaction=require(_0x70ba('0x6'));var config=require(_0x70ba('0x7'));var controller=require(_0x70ba('0x8'));router[_0x70ba('0x9')]('/',auth[_0x70ba('0xa')](),controller[_0x70ba('0xb')]);router[_0x70ba('0x9')](_0x70ba('0xc'),auth[_0x70ba('0xa')](),controller[_0x70ba('0xd')]);router[_0x70ba('0xe')]('/',auth[_0x70ba('0xa')](),controller[_0x70ba('0xf')]);router[_0x70ba('0x10')]('/:id',auth[_0x70ba('0xa')](),controller['update']);router[_0x70ba('0x11')](_0x70ba('0xc'),auth[_0x70ba('0xa')](),controller[_0x70ba('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 398410c..a2950c9 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 _0xca9a=['STRING','sequelize','exports'];(function(_0x3dc473,_0x4b2a0b){var _0x4820a6=function(_0x31cc73){while(--_0x31cc73){_0x3dc473['push'](_0x3dc473['shift']());}};_0x4820a6(++_0x4b2a0b);}(_0xca9a,0x181));var _0xaca9=function(_0x262417,_0xd14a17){_0x262417=_0x262417-0x0;var _0x43a2bb=_0xca9a[_0x262417];return _0x43a2bb;};'use strict';var Sequelize=require(_0xaca9('0x0'));module[_0xaca9('0x1')]={'name':{'type':Sequelize[_0xaca9('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xaca9('0x2')]}}; \ No newline at end of file +var _0x93aa=['name','sequelize','exports','STRING'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x93aa,0xe1));var _0xa93a=function(_0x3a8455,_0x41e5e2){_0x3a8455=_0x3a8455-0x0;var _0xc023b8=_0x93aa[_0x3a8455];return _0xc023b8;};'use strict';var Sequelize=require(_0xa93a('0x0'));module[_0xa93a('0x1')]={'name':{'type':Sequelize[_0xa93a('0x2')],'unique':_0xa93a('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa93a('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 722a9f8..153c4be 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 _0xb713=['eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','update','then','destroy','get','Variables','UserProfileResource','name','index','Variable','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation'];(function(_0x2212d3,_0x324f32){var _0x51c05d=function(_0x376102){while(--_0x376102){_0x2212d3['push'](_0x2212d3['shift']());}};_0x51c05d(++_0x324f32);}(_0xb713,0xa0));var _0x3b71=function(_0x476b00,_0x250877){_0x476b00=_0x476b00-0x0;var _0x44ec8e=_0xb713[_0x476b00];return _0x44ec8e;};'use strict';var emlformat=require(_0x3b71('0x0'));var rimraf=require(_0x3b71('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3b71('0x2'));var moment=require(_0x3b71('0x3'));var BPromise=require(_0x3b71('0x4'));var Mustache=require(_0x3b71('0x5'));var util=require(_0x3b71('0x6'));var path=require(_0x3b71('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3b71('0x8'));var fs=require('fs');var fs_extra=require(_0x3b71('0x9'));var _=require(_0x3b71('0xa'));var squel=require(_0x3b71('0xb'));var crypto=require(_0x3b71('0xc'));var jsforce=require(_0x3b71('0xd'));var deskjs=require(_0x3b71('0xe'));var toCsv=require(_0x3b71('0xf'));var querystring=require(_0x3b71('0x10'));var Papa=require(_0x3b71('0x11'));var Redis=require(_0x3b71('0x12'));var authService=require(_0x3b71('0x13'));var qs=require(_0x3b71('0x14'));var as=require(_0x3b71('0x15'));var hardwareService=require(_0x3b71('0x16'));var logger=require(_0x3b71('0x17'))(_0x3b71('0x18'));var utils=require(_0x3b71('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3b71('0x1a'))['db'];function respondWithStatusCode(_0x5e2e18,_0x13ce84){_0x13ce84=_0x13ce84||0xcc;return function(_0x1a7f38){if(_0x1a7f38){return _0x5e2e18[_0x3b71('0x1b')](_0x13ce84);}return _0x5e2e18[_0x3b71('0x1c')](_0x13ce84)[_0x3b71('0x1d')]();};}function respondWithResult(_0x21d21c,_0x3b7f40){_0x3b7f40=_0x3b7f40||0xc8;return function(_0x4954cd){if(_0x4954cd){return _0x21d21c[_0x3b71('0x1c')](_0x3b7f40)[_0x3b71('0x1e')](_0x4954cd);}};}function respondWithFilteredResult(_0x505e4b,_0xabe91a){return function(_0xfa4f93){if(_0xfa4f93){var _0x175618=typeof _0xabe91a[_0x3b71('0x1f')]===_0x3b71('0x20')&&typeof _0xabe91a['limit']==='undefined';var _0x3aba28=_0xfa4f93[_0x3b71('0x21')];var _0x503a2f=_0x175618?0x0:_0xabe91a[_0x3b71('0x1f')];var _0x3311d2=_0x175618?_0xfa4f93[_0x3b71('0x21')]:_0xabe91a[_0x3b71('0x1f')]+_0xabe91a[_0x3b71('0x22')];var _0x3e26f5;if(_0x3311d2>=_0x3aba28){_0x3311d2=_0x3aba28;_0x3e26f5=0xc8;}else{_0x3e26f5=0xce;}_0x505e4b[_0x3b71('0x1c')](_0x3e26f5);return _0x505e4b['set']('Content-Range',_0x503a2f+'-'+_0x3311d2+'/'+_0x3aba28)[_0x3b71('0x1e')](_0xfa4f93);}return null;};}function patchUpdates(_0x50cc4d){return function(_0x2c0afb){try{jsonpatch['apply'](_0x2c0afb,_0x50cc4d,!![]);}catch(_0x5f2149){return BPromise['reject'](_0x5f2149);}return _0x2c0afb['save']();};}function saveUpdates(_0x2248de,_0x42b7bb){return function(_0x4a7da6){if(_0x4a7da6){return _0x4a7da6[_0x3b71('0x23')](_0x2248de)[_0x3b71('0x24')](function(_0x7a6a0d){return _0x7a6a0d;});}return null;};}function removeEntity(_0x25c638,_0x620c52){return function(_0x5e4b39){if(_0x5e4b39){return _0x5e4b39[_0x3b71('0x25')]()[_0x3b71('0x24')](function(){var _0x49b089=_0x5e4b39[_0x3b71('0x26')]({'plain':!![]});var _0x233c2b=_0x3b71('0x27');return db[_0x3b71('0x28')]['destroy']({'where':{'type':_0x233c2b,'resourceId':_0x49b089['id']}})[_0x3b71('0x24')](function(){return _0x5e4b39;});})[_0x3b71('0x24')](function(){_0x25c638['status'](0xcc)[_0x3b71('0x1d')]();});}};}function handleEntityNotFound(_0x7f98f4,_0x27eca9){return function(_0x4e8af7){if(!_0x4e8af7){_0x7f98f4['sendStatus'](0x194);}return _0x4e8af7;};}function handleError(_0x44ec24,_0x4d8ea7){_0x4d8ea7=_0x4d8ea7||0x1f4;return function(_0x54c6c1){logger['error'](_0x54c6c1['stack']);if(_0x54c6c1[_0x3b71('0x29')]){delete _0x54c6c1[_0x3b71('0x29')];}_0x44ec24[_0x3b71('0x1c')](_0x4d8ea7)['send'](_0x54c6c1);};}exports[_0x3b71('0x2a')]=function(_0x512648,_0x4061be){var _0x2e5701={},_0x10d287={},_0x4aad10={'count':0x0,'rows':[]};var _0x1c7df1=_['map'](db[_0x3b71('0x2b')][_0x3b71('0x2c')],function(_0x56a7bc){return{'name':_0x56a7bc[_0x3b71('0x2d')],'type':_0x56a7bc['type'][_0x3b71('0x2e')]};});_0x10d287[_0x3b71('0x2f')]=_[_0x3b71('0x30')](_0x1c7df1,_0x3b71('0x29'));_0x10d287[_0x3b71('0x31')]=_[_0x3b71('0x32')](_0x512648[_0x3b71('0x31')]);_0x10d287['filters']=_[_0x3b71('0x33')](_0x10d287['model'],_0x10d287[_0x3b71('0x31')]);_0x2e5701[_0x3b71('0x34')]=_[_0x3b71('0x33')](_0x10d287[_0x3b71('0x2f')],qs[_0x3b71('0x35')](_0x512648[_0x3b71('0x31')][_0x3b71('0x35')]));_0x2e5701[_0x3b71('0x34')]=_0x2e5701[_0x3b71('0x34')][_0x3b71('0x36')]?_0x2e5701[_0x3b71('0x34')]:_0x10d287[_0x3b71('0x2f')];if(!_0x512648[_0x3b71('0x31')][_0x3b71('0x37')]('nolimit')){_0x2e5701[_0x3b71('0x22')]=qs[_0x3b71('0x22')](_0x512648[_0x3b71('0x31')][_0x3b71('0x22')]);_0x2e5701[_0x3b71('0x1f')]=qs[_0x3b71('0x1f')](_0x512648[_0x3b71('0x31')][_0x3b71('0x1f')]);}_0x2e5701['order']=qs[_0x3b71('0x38')](_0x512648[_0x3b71('0x31')][_0x3b71('0x38')]);_0x2e5701[_0x3b71('0x39')]=qs['filters'](_[_0x3b71('0x3a')](_0x512648[_0x3b71('0x31')],_0x10d287[_0x3b71('0x3b')]),_0x1c7df1);if(_0x512648['query'][_0x3b71('0x3c')]){_0x2e5701[_0x3b71('0x39')]=_[_0x3b71('0x3d')](_0x2e5701[_0x3b71('0x39')],{'$or':_[_0x3b71('0x30')](_0x1c7df1,function(_0x45d07c){if(_0x45d07c[_0x3b71('0x3e')]!==_0x3b71('0x3f')){var _0x7d465f={};_0x7d465f[_0x45d07c['name']]={'$like':'%'+_0x512648[_0x3b71('0x31')]['filter']+'%'};return _0x7d465f;}})});}_0x2e5701=_[_0x3b71('0x3d')]({},_0x2e5701,_0x512648[_0x3b71('0x40')]);var _0x4521c8={'where':_0x2e5701[_0x3b71('0x39')]};return db['Variable']['count'](_0x4521c8)[_0x3b71('0x24')](function(_0x391125){_0x4aad10[_0x3b71('0x21')]=_0x391125;if(_0x512648['query']['includeAll']){_0x2e5701['include']=[{'all':!![]}];}return db[_0x3b71('0x2b')][_0x3b71('0x41')](_0x2e5701);})[_0x3b71('0x24')](function(_0x2bc54a){_0x4aad10[_0x3b71('0x42')]=_0x2bc54a;return _0x4aad10;})[_0x3b71('0x24')](respondWithFilteredResult(_0x4061be,_0x2e5701))[_0x3b71('0x43')](handleError(_0x4061be,null));};exports[_0x3b71('0x44')]=function(_0x28f9b5,_0xd7818d){var _0x2ed0b3={'raw':!![],'where':{'id':_0x28f9b5[_0x3b71('0x45')]['id']}},_0x1e6f99={};_0x1e6f99[_0x3b71('0x2f')]=_['keys'](db['Variable'][_0x3b71('0x2c')]);_0x1e6f99['query']=_[_0x3b71('0x32')](_0x28f9b5[_0x3b71('0x31')]);_0x1e6f99[_0x3b71('0x3b')]=_['intersection'](_0x1e6f99[_0x3b71('0x2f')],_0x1e6f99[_0x3b71('0x31')]);_0x2ed0b3[_0x3b71('0x34')]=_[_0x3b71('0x33')](_0x1e6f99['model'],qs[_0x3b71('0x35')](_0x28f9b5['query'][_0x3b71('0x35')]));_0x2ed0b3['attributes']=_0x2ed0b3[_0x3b71('0x34')]['length']?_0x2ed0b3[_0x3b71('0x34')]:_0x1e6f99[_0x3b71('0x2f')];if(_0x28f9b5[_0x3b71('0x31')][_0x3b71('0x46')]){_0x2ed0b3['include']=[{'all':!![]}];}_0x2ed0b3=_[_0x3b71('0x3d')]({},_0x2ed0b3,_0x28f9b5['options']);return db['Variable'][_0x3b71('0x47')](_0x2ed0b3)[_0x3b71('0x24')](handleEntityNotFound(_0xd7818d,null))[_0x3b71('0x24')](respondWithResult(_0xd7818d,null))[_0x3b71('0x43')](handleError(_0xd7818d,null));};exports[_0x3b71('0x48')]=function(_0x44c809,_0x3fc510){return db[_0x3b71('0x2b')][_0x3b71('0x48')](_0x44c809[_0x3b71('0x49')],{})['then'](function(_0x4771c3){var _0x4c37db=_0x44c809[_0x3b71('0x4a')][_0x3b71('0x26')]({'plain':!![]});if(!_0x4c37db)throw new Error(_0x3b71('0x4b'));if(_0x4c37db[_0x3b71('0x4c')]==='user'){var _0x3337ca=_0x4771c3[_0x3b71('0x26')]({'plain':!![]});var _0x4ce519=_0x3b71('0x27');return db[_0x3b71('0x4d')][_0x3b71('0x47')]({'where':{'name':_0x4ce519,'userProfileId':_0x4c37db[_0x3b71('0x4e')]},'raw':!![]})['then'](function(_0x24a29f){if(_0x24a29f&&_0x24a29f[_0x3b71('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x3337ca['name'],'resourceId':_0x3337ca['id'],'type':_0x24a29f['name'],'sectionId':_0x24a29f['id']},{})[_0x3b71('0x24')](function(){return _0x4771c3;});}else{return _0x4771c3;}})[_0x3b71('0x43')](function(_0x49a290){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a290);throw _0x49a290;});}return _0x4771c3;})[_0x3b71('0x24')](respondWithResult(_0x3fc510,0xc9))['catch'](handleError(_0x3fc510,null));};exports[_0x3b71('0x23')]=function(_0x40dc6d,_0xf6b2ac){if(_0x40dc6d[_0x3b71('0x49')]['id']){delete _0x40dc6d[_0x3b71('0x49')]['id'];}return db[_0x3b71('0x2b')][_0x3b71('0x47')]({'where':{'id':_0x40dc6d['params']['id']}})[_0x3b71('0x24')](handleEntityNotFound(_0xf6b2ac,null))[_0x3b71('0x24')](saveUpdates(_0x40dc6d[_0x3b71('0x49')],null))[_0x3b71('0x24')](respondWithResult(_0xf6b2ac,null))[_0x3b71('0x43')](handleError(_0xf6b2ac,null));};exports[_0x3b71('0x25')]=function(_0x123681,_0x588f0b){return db[_0x3b71('0x2b')][_0x3b71('0x47')]({'where':{'id':_0x123681[_0x3b71('0x45')]['id']}})['then'](handleEntityNotFound(_0x588f0b,null))[_0x3b71('0x24')](removeEntity(_0x588f0b,null))[_0x3b71('0x43')](handleError(_0x588f0b,null));}; \ No newline at end of file +var _0xcace=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Variables','UserProfileResource','error','name','send','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','Variable','includeAll','include','findAll','rows','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status'];(function(_0x21342f,_0x463e27){var _0x4dd741=function(_0x53a358){while(--_0x53a358){_0x21342f['push'](_0x21342f['shift']());}};_0x4dd741(++_0x463e27);}(_0xcace,0xe3));var _0xecac=function(_0x49fbb1,_0x4e7b6d){_0x49fbb1=_0x49fbb1-0x0;var _0x599efc=_0xcace[_0x49fbb1];return _0x599efc;};'use strict';var emlformat=require(_0xecac('0x0'));var rimraf=require(_0xecac('0x1'));var zipdir=require(_0xecac('0x2'));var jsonpatch=require(_0xecac('0x3'));var rp=require('request-promise');var moment=require(_0xecac('0x4'));var BPromise=require(_0xecac('0x5'));var Mustache=require('mustache');var util=require(_0xecac('0x6'));var path=require(_0xecac('0x7'));var sox=require(_0xecac('0x8'));var csv=require(_0xecac('0x9'));var ejs=require(_0xecac('0xa'));var fs=require('fs');var fs_extra=require(_0xecac('0xb'));var _=require(_0xecac('0xc'));var squel=require(_0xecac('0xd'));var crypto=require(_0xecac('0xe'));var jsforce=require(_0xecac('0xf'));var deskjs=require(_0xecac('0x10'));var toCsv=require(_0xecac('0x9'));var querystring=require(_0xecac('0x11'));var Papa=require(_0xecac('0x12'));var Redis=require('ioredis');var authService=require(_0xecac('0x13'));var qs=require(_0xecac('0x14'));var as=require(_0xecac('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xecac('0x16'))(_0xecac('0x17'));var utils=require(_0xecac('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xecac('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x452b3c,_0x3866e8){_0x3866e8=_0x3866e8||0xcc;return function(_0xe6e8ce){if(_0xe6e8ce){return _0x452b3c[_0xecac('0x1a')](_0x3866e8);}return _0x452b3c[_0xecac('0x1b')](_0x3866e8)[_0xecac('0x1c')]();};}function respondWithResult(_0x111a6b,_0x30e556){_0x30e556=_0x30e556||0xc8;return function(_0x24e685){if(_0x24e685){return _0x111a6b[_0xecac('0x1b')](_0x30e556)[_0xecac('0x1d')](_0x24e685);}};}function respondWithFilteredResult(_0x47f70d,_0x27243e){return function(_0x132732){if(_0x132732){var _0x1ad4ef=typeof _0x27243e[_0xecac('0x1e')]===_0xecac('0x1f')&&typeof _0x27243e[_0xecac('0x20')]===_0xecac('0x1f');var _0x237002=_0x132732[_0xecac('0x21')];var _0x1943e7=_0x1ad4ef?0x0:_0x27243e[_0xecac('0x1e')];var _0x4a6ab0=_0x1ad4ef?_0x132732[_0xecac('0x21')]:_0x27243e[_0xecac('0x1e')]+_0x27243e[_0xecac('0x20')];var _0xd78bb0;if(_0x4a6ab0>=_0x237002){_0x4a6ab0=_0x237002;_0xd78bb0=0xc8;}else{_0xd78bb0=0xce;}_0x47f70d[_0xecac('0x1b')](_0xd78bb0);return _0x47f70d[_0xecac('0x22')](_0xecac('0x23'),_0x1943e7+'-'+_0x4a6ab0+'/'+_0x237002)[_0xecac('0x1d')](_0x132732);}return null;};}function patchUpdates(_0x3c25f4){return function(_0xc9a301){try{jsonpatch[_0xecac('0x24')](_0xc9a301,_0x3c25f4,!![]);}catch(_0x20e48d){return BPromise[_0xecac('0x25')](_0x20e48d);}return _0xc9a301[_0xecac('0x26')]();};}function saveUpdates(_0x45ffcb,_0x2dd160){return function(_0x85d236){if(_0x85d236){return _0x85d236[_0xecac('0x27')](_0x45ffcb)[_0xecac('0x28')](function(_0xa80a23){return _0xa80a23;});}return null;};}function removeEntity(_0x3177d2,_0x4e1ef3){return function(_0x3607d1){if(_0x3607d1){return _0x3607d1[_0xecac('0x29')]()[_0xecac('0x28')](function(){var _0x4b18e6=_0x3607d1['get']({'plain':!![]});var _0x5c3d0a=_0xecac('0x2a');return db[_0xecac('0x2b')][_0xecac('0x29')]({'where':{'type':_0x5c3d0a,'resourceId':_0x4b18e6['id']}})[_0xecac('0x28')](function(){return _0x3607d1;});})['then'](function(){_0x3177d2[_0xecac('0x1b')](0xcc)[_0xecac('0x1c')]();});}};}function handleEntityNotFound(_0x4ee027,_0xd54d1a){return function(_0x536b82){if(!_0x536b82){_0x4ee027['sendStatus'](0x194);}return _0x536b82;};}function handleError(_0x3685dd,_0x4ba27f){_0x4ba27f=_0x4ba27f||0x1f4;return function(_0x296b5a){logger[_0xecac('0x2c')](_0x296b5a['stack']);if(_0x296b5a[_0xecac('0x2d')]){delete _0x296b5a[_0xecac('0x2d')];}_0x3685dd[_0xecac('0x1b')](_0x4ba27f)[_0xecac('0x2e')](_0x296b5a);};}exports['index']=function(_0x341802,_0x18f65e){var _0x4add3b={},_0x1cffa9={},_0x3b1107={'count':0x0,'rows':[]};var _0x4101d2=_['map'](db['Variable'][_0xecac('0x2f')],function(_0x3f71c4){return{'name':_0x3f71c4[_0xecac('0x30')],'type':_0x3f71c4[_0xecac('0x31')][_0xecac('0x32')]};});_0x1cffa9[_0xecac('0x33')]=_[_0xecac('0x34')](_0x4101d2,_0xecac('0x2d'));_0x1cffa9['query']=_[_0xecac('0x35')](_0x341802[_0xecac('0x36')]);_0x1cffa9[_0xecac('0x37')]=_[_0xecac('0x38')](_0x1cffa9['model'],_0x1cffa9[_0xecac('0x36')]);_0x4add3b[_0xecac('0x39')]=_[_0xecac('0x38')](_0x1cffa9[_0xecac('0x33')],qs[_0xecac('0x3a')](_0x341802[_0xecac('0x36')][_0xecac('0x3a')]));_0x4add3b['attributes']=_0x4add3b[_0xecac('0x39')][_0xecac('0x3b')]?_0x4add3b['attributes']:_0x1cffa9[_0xecac('0x33')];if(!_0x341802[_0xecac('0x36')][_0xecac('0x3c')]('nolimit')){_0x4add3b[_0xecac('0x20')]=qs[_0xecac('0x20')](_0x341802[_0xecac('0x36')][_0xecac('0x20')]);_0x4add3b['offset']=qs[_0xecac('0x1e')](_0x341802['query'][_0xecac('0x1e')]);}_0x4add3b[_0xecac('0x3d')]=qs[_0xecac('0x3e')](_0x341802[_0xecac('0x36')]['sort']);_0x4add3b[_0xecac('0x3f')]=qs[_0xecac('0x37')](_['pick'](_0x341802[_0xecac('0x36')],_0x1cffa9['filters']),_0x4101d2);if(_0x341802['query'][_0xecac('0x40')]){_0x4add3b[_0xecac('0x3f')]=_[_0xecac('0x41')](_0x4add3b[_0xecac('0x3f')],{'$or':_[_0xecac('0x34')](_0x4101d2,function(_0x593680){if(_0x593680[_0xecac('0x31')]!=='VIRTUAL'){var _0x2b3acd={};_0x2b3acd[_0x593680[_0xecac('0x2d')]]={'$like':'%'+_0x341802[_0xecac('0x36')][_0xecac('0x40')]+'%'};return _0x2b3acd;}})});}_0x4add3b=_['merge']({},_0x4add3b,_0x341802[_0xecac('0x42')]);var _0x3495b6={'where':_0x4add3b[_0xecac('0x3f')]};return db[_0xecac('0x43')]['count'](_0x3495b6)['then'](function(_0x480dcc){_0x3b1107['count']=_0x480dcc;if(_0x341802[_0xecac('0x36')][_0xecac('0x44')]){_0x4add3b[_0xecac('0x45')]=[{'all':!![]}];}return db[_0xecac('0x43')][_0xecac('0x46')](_0x4add3b);})[_0xecac('0x28')](function(_0x5679cd){_0x3b1107[_0xecac('0x47')]=_0x5679cd;return _0x3b1107;})['then'](respondWithFilteredResult(_0x18f65e,_0x4add3b))[_0xecac('0x48')](handleError(_0x18f65e,null));};exports[_0xecac('0x49')]=function(_0x6e4489,_0x5aac52){var _0x4b41a3={'raw':!![],'where':{'id':_0x6e4489[_0xecac('0x4a')]['id']}},_0x4d51a7={};_0x4d51a7[_0xecac('0x33')]=_[_0xecac('0x35')](db[_0xecac('0x43')][_0xecac('0x2f')]);_0x4d51a7[_0xecac('0x36')]=_[_0xecac('0x35')](_0x6e4489[_0xecac('0x36')]);_0x4d51a7[_0xecac('0x37')]=_[_0xecac('0x38')](_0x4d51a7[_0xecac('0x33')],_0x4d51a7[_0xecac('0x36')]);_0x4b41a3[_0xecac('0x39')]=_[_0xecac('0x38')](_0x4d51a7[_0xecac('0x33')],qs[_0xecac('0x3a')](_0x6e4489['query'][_0xecac('0x3a')]));_0x4b41a3[_0xecac('0x39')]=_0x4b41a3[_0xecac('0x39')][_0xecac('0x3b')]?_0x4b41a3['attributes']:_0x4d51a7[_0xecac('0x33')];if(_0x6e4489[_0xecac('0x36')][_0xecac('0x44')]){_0x4b41a3[_0xecac('0x45')]=[{'all':!![]}];}_0x4b41a3=_[_0xecac('0x41')]({},_0x4b41a3,_0x6e4489[_0xecac('0x42')]);return db[_0xecac('0x43')]['find'](_0x4b41a3)[_0xecac('0x28')](handleEntityNotFound(_0x5aac52,null))['then'](respondWithResult(_0x5aac52,null))['catch'](handleError(_0x5aac52,null));};exports[_0xecac('0x4b')]=function(_0x45d8fa,_0x37bc47){return db[_0xecac('0x43')]['create'](_0x45d8fa[_0xecac('0x4c')],{})[_0xecac('0x28')](function(_0x521ec1){var _0x55faf5=_0x45d8fa[_0xecac('0x4d')][_0xecac('0x4e')]({'plain':!![]});if(!_0x55faf5)throw new Error(_0xecac('0x4f'));if(_0x55faf5[_0xecac('0x50')]===_0xecac('0x4d')){var _0x4cff97=_0x521ec1[_0xecac('0x4e')]({'plain':!![]});var _0x1a2172=_0xecac('0x2a');return db[_0xecac('0x51')][_0xecac('0x52')]({'where':{'name':_0x1a2172,'userProfileId':_0x55faf5['userProfileId']},'raw':!![]})[_0xecac('0x28')](function(_0x582e3e){if(_0x582e3e&&_0x582e3e[_0xecac('0x53')]===0x0){return db[_0xecac('0x2b')][_0xecac('0x4b')]({'name':_0x4cff97[_0xecac('0x2d')],'resourceId':_0x4cff97['id'],'type':_0x582e3e[_0xecac('0x2d')],'sectionId':_0x582e3e['id']},{})[_0xecac('0x28')](function(){return _0x521ec1;});}else{return _0x521ec1;}})['catch'](function(_0x498ca4){logger[_0xecac('0x2c')](_0xecac('0x54'),_0x498ca4);throw _0x498ca4;});}return _0x521ec1;})[_0xecac('0x28')](respondWithResult(_0x37bc47,0xc9))[_0xecac('0x48')](handleError(_0x37bc47,null));};exports['update']=function(_0x5a39f3,_0x4c51b2){if(_0x5a39f3['body']['id']){delete _0x5a39f3[_0xecac('0x4c')]['id'];}return db[_0xecac('0x43')][_0xecac('0x52')]({'where':{'id':_0x5a39f3[_0xecac('0x4a')]['id']}})[_0xecac('0x28')](handleEntityNotFound(_0x4c51b2,null))[_0xecac('0x28')](saveUpdates(_0x5a39f3[_0xecac('0x4c')],null))[_0xecac('0x28')](respondWithResult(_0x4c51b2,null))[_0xecac('0x48')](handleError(_0x4c51b2,null));};exports[_0xecac('0x29')]=function(_0x22e3e6,_0xadd1df){return db[_0xecac('0x43')][_0xecac('0x52')]({'where':{'id':_0x22e3e6[_0xecac('0x4a')]['id']}})[_0xecac('0x28')](handleEntityNotFound(_0xadd1df,null))['then'](removeEntity(_0xadd1df,null))[_0xecac('0x48')](handleError(_0xadd1df,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 23972d4..4f58fb9 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 _0x6ac1=['exports','Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./variable.attributes'];(function(_0xad36ff,_0x4e0bc7){var _0x3b8496=function(_0x265561){while(--_0x265561){_0xad36ff['push'](_0xad36ff['shift']());}};_0x3b8496(++_0x4e0bc7);}(_0x6ac1,0x1bd));var _0x16ac=function(_0x558849,_0x113740){_0x558849=_0x558849-0x0;var _0x4149cd=_0x6ac1[_0x558849];return _0x4149cd;};'use strict';var _=require(_0x16ac('0x0'));var util=require(_0x16ac('0x1'));var logger=require(_0x16ac('0x2'))(_0x16ac('0x3'));var moment=require(_0x16ac('0x4'));var BPromise=require(_0x16ac('0x5'));var rp=require(_0x16ac('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x16ac('0x7'));var config=require(_0x16ac('0x8'));var attributes=require(_0x16ac('0x9'));module[_0x16ac('0xa')]=function(_0x57dded,_0x5424a9){return _0x57dded['define'](_0x16ac('0xb'),attributes,{'tableName':_0x16ac('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2bf=['moment','bluebird','request-promise','path','./variable.attributes','define','tools_variables','lodash','util','../../config/logger','api'];(function(_0x3561f6,_0x11e917){var _0x57b89c=function(_0x92bd){while(--_0x92bd){_0x3561f6['push'](_0x3561f6['shift']());}};_0x57b89c(++_0x11e917);}(_0xd2bf,0x188));var _0xfd2b=function(_0x31b5a5,_0x44376a){_0x31b5a5=_0x31b5a5-0x0;var _0x364cc9=_0xd2bf[_0x31b5a5];return _0x364cc9;};'use strict';var _=require(_0xfd2b('0x0'));var util=require(_0xfd2b('0x1'));var logger=require(_0xfd2b('0x2'))(_0xfd2b('0x3'));var moment=require(_0xfd2b('0x4'));var BPromise=require(_0xfd2b('0x5'));var rp=require(_0xfd2b('0x6'));var fs=require('fs');var path=require(_0xfd2b('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfd2b('0x8'));module['exports']=function(_0x3a1f76,_0x385b46){return _0x3a1f76[_0xfd2b('0x9')]('Variable',attributes,{'tableName':_0xfd2b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 7ede9da..973d067 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa41a=['debug','Variable,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowVariable','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0xa41a,0x6b));var _0xaa41=function(_0x4627fb,_0x23f8a2){_0x4627fb=_0x4627fb-0x0;var _0x5740c4=_0xa41a[_0x4627fb];return _0x5740c4;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});}exports[_0xaa41('0x17')]=function(_0xd20ddf){var _0x29efe5=this;return new Promise(function(_0x46e6d3,_0x150ddf){return db['Variable']['find']({'raw':_0xd20ddf[_0xaa41('0x18')]?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x19')]===undefined?!![]:![]:!![],'where':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1a')]||null:null,'attributes':_0xd20ddf['options']?_0xd20ddf['options'][_0xaa41('0x1b')]||null:null,'include':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')],function(_0x4eb01f){return{'model':db[_0x4eb01f[_0xaa41('0x1e')]],'as':_0x4eb01f['as'],'attributes':_0x4eb01f[_0xaa41('0x1b')],'include':_0x4eb01f[_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0x4eb01f[_0xaa41('0x1c')],function(_0xa1f024){return{'model':db[_0xa1f024['model']],'as':_0xa1f024['as'],'attributes':_0xa1f024['attributes'],'include':_0xa1f024[_0xaa41('0x1c')]?_['map'](_0xa1f024['include'],function(_0x12e362){return{'model':db[_0x12e362['model']],'as':_0x12e362['as'],'attributes':_0x12e362['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa41('0xd')](function(_0x9c8c21){logger[_0xaa41('0xe')](_0xaa41('0x17'),_0xd20ddf);logger[_0xaa41('0x11')](_0xaa41('0x17'),_0xd20ddf,JSON['stringify'](_0x9c8c21));_0x46e6d3(_0x9c8c21);})[_0xaa41('0x16')](function(_0x1f0275){logger[_0xaa41('0x13')](_0xaa41('0x17'),_0x1f0275[_0xaa41('0x14')],_0xd20ddf);_0x150ddf(_0x29efe5[_0xaa41('0x13')](0x1f4,_0x1f0275[_0xaa41('0x14')]));});});}; \ No newline at end of file +var _0xabce=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowVariable','Variable','find','options','attributes','map','include','model','catch','lodash','util'];(function(_0x224794,_0x2ba39b){var _0x123465=function(_0x388464){while(--_0x388464){_0x224794['push'](_0x224794['shift']());}};_0x123465(++_0x2ba39b);}(_0xabce,0x103));var _0xeabc=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xabce[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Variable,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});}exports[_0xeabc('0x14')]=function(_0x58a3c0){var _0x16f08b=this;return new Promise(function(_0x31dd53,_0x31f52a){return db[_0xeabc('0x15')][_0xeabc('0x16')]({'raw':_0x58a3c0['options']?_0x58a3c0[_0xeabc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['where']||null:null,'attributes':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x18')]||null:null,'include':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['include']?_[_0xeabc('0x19')](_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x1a')],function(_0x5bdd57){return{'model':db[_0x5bdd57[_0xeabc('0x1b')]],'as':_0x5bdd57['as'],'attributes':_0x5bdd57[_0xeabc('0x18')],'include':_0x5bdd57[_0xeabc('0x1a')]?_[_0xeabc('0x19')](_0x5bdd57['include'],function(_0x109e1d){return{'model':db[_0x109e1d['model']],'as':_0x109e1d['as'],'attributes':_0x109e1d[_0xeabc('0x18')],'include':_0x109e1d['include']?_[_0xeabc('0x19')](_0x109e1d[_0xeabc('0x1a')],function(_0x269621){return{'model':db[_0x269621[_0xeabc('0x1b')]],'as':_0x269621['as'],'attributes':_0x269621[_0xeabc('0x18')]};}):[]};}):[]};}):[]:[]})[_0xeabc('0x9')](function(_0x131722){logger['info']('ShowVariable',_0x58a3c0);logger[_0xeabc('0xd')]('ShowVariable',_0x58a3c0,JSON[_0xeabc('0xf')](_0x131722));_0x31dd53(_0x131722);})[_0xeabc('0x1c')](function(_0x48fb52){logger[_0xeabc('0x10')](_0xeabc('0x14'),_0x48fb52[_0xeabc('0x12')],_0x58a3c0);_0x31f52a(_0x16f08b[_0xeabc('0x10')](0x1f4,_0x48fb52[_0xeabc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index e717ced..d07c37a 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 _0x62cf=['/restart','restart','/migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','fetch','/reset','canUpdate','reset','/pull'];(function(_0x3a96b8,_0x4142a3){var _0x20fb74=function(_0x3f68c0){while(--_0x3f68c0){_0x3a96b8['push'](_0x3a96b8['shift']());}};_0x20fb74(++_0x4142a3);}(_0x62cf,0x114));var _0xf62c=function(_0x2e68a6,_0x17e06a){_0x2e68a6=_0x2e68a6-0x0;var _0x46ccbe=_0x62cf[_0x2e68a6];return _0x46ccbe;};'use strict';var express=require(_0xf62c('0x0'));var router=express[_0xf62c('0x1')]();var auth=require(_0xf62c('0x2'));var controller=require(_0xf62c('0x3'));router[_0xf62c('0x4')]('/',controller[_0xf62c('0x5')]);router['get'](_0xf62c('0x6'),auth[_0xf62c('0x7')](),auth['canUpdate'](),controller[_0xf62c('0x8')]);router[_0xf62c('0x4')](_0xf62c('0x9'),auth[_0xf62c('0x7')](),auth[_0xf62c('0xa')](),controller[_0xf62c('0xb')]);router[_0xf62c('0x4')](_0xf62c('0xc'),auth['isAuthenticated'](),auth[_0xf62c('0xa')](),controller['pull']);router[_0xf62c('0x4')](_0xf62c('0xd'),auth[_0xf62c('0x7')](),controller[_0xf62c('0xe')]);router[_0xf62c('0x4')](_0xf62c('0xf'),controller['migrations']);module[_0xf62c('0x10')]=router; \ No newline at end of file +var _0x2408=['canUpdate','fetch','/reset','reset','/pull','pull','/restart','restart','/migrations','migrations','exports','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated'];(function(_0x463d31,_0x300f00){var _0x54d42f=function(_0x3b6f3f){while(--_0x3b6f3f){_0x463d31['push'](_0x463d31['shift']());}};_0x54d42f(++_0x300f00);}(_0x2408,0x12c));var _0x8240=function(_0x37d556,_0x10dca8){_0x37d556=_0x37d556-0x0;var _0x3a0560=_0x2408[_0x37d556];return _0x3a0560;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x8240('0x0'));var controller=require(_0x8240('0x1'));router[_0x8240('0x2')]('/',controller[_0x8240('0x3')]);router['get'](_0x8240('0x4'),auth[_0x8240('0x5')](),auth[_0x8240('0x6')](),controller[_0x8240('0x7')]);router['get'](_0x8240('0x8'),auth[_0x8240('0x5')](),auth['canUpdate'](),controller[_0x8240('0x9')]);router[_0x8240('0x2')](_0x8240('0xa'),auth['isAuthenticated'](),auth[_0x8240('0x6')](),controller[_0x8240('0xb')]);router[_0x8240('0x2')](_0x8240('0xc'),auth['isAuthenticated'](),controller[_0x8240('0xd')]);router[_0x8240('0x2')](_0x8240('0xe'),controller[_0x8240('0xf')]);module[_0x8240('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index a386794..3bca867 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 _0x962d=['reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard','pull','npm\x20install\x20--production','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','root','server','length','replace','push','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','.js','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','update','simple-git','index','exports','version','latest','tags','status','json','fetch','origin','master','info'];(function(_0x5badb8,_0x414c2f){var _0xaea164=function(_0x1aa4ac){while(--_0x1aa4ac){_0x5badb8['push'](_0x5badb8['shift']());}};_0xaea164(++_0x414c2f);}(_0x962d,0xb1));var _0xd962=function(_0x5b8b97,_0x6b4dfa){_0x5b8b97=_0x5b8b97-0x0;var _0x1fdf84=_0x962d[_0x5b8b97];return _0x1fdf84;};'use strict';var Umzug=require(_0xd962('0x0'));var path=require(_0xd962('0x1'));var fs=require('fs');var _=require(_0xd962('0x2'));var pkginfo=require(_0xd962('0x3'))(module,'version');var compareVersions=require(_0xd962('0x4'));var exec=require(_0xd962('0x5'))[_0xd962('0x6')];var db=require(_0xd962('0x7'))['db'];var config=require(_0xd962('0x8'));var pm2=require(_0xd962('0x9'));var logger=require('../../config/logger')(_0xd962('0xa'));var git=require(_0xd962('0xb'))(config['root']);exports[_0xd962('0xc')]=function(_0xf54de9,_0x26f18a){var _0x4874d4={'current':module[_0xd962('0xd')][_0xd962('0xe')],'phonebar':0x2};if(_0xf54de9['query']&&_0xf54de9['query'][_0xd962('0xf')]){return git['fetch']()[_0xd962('0x10')](function(_0x1b8ee3,_0x503eed){_0x4874d4[_0xd962('0xf')]=(_0x1b8ee3?module[_0xd962('0xd')][_0xd962('0xe')]:_0x503eed[_0xd962('0xf')])||'2.0.0';return _0x26f18a[_0xd962('0x11')](0xc8)[_0xd962('0x12')](_0x4874d4);});}else{return _0x26f18a['status'](0xc8)[_0xd962('0x12')](_0x4874d4);}};exports['fetch']=function(_0x4c71ad,_0x3c989f){return git[_0xd962('0x13')]([_0xd962('0x14'),_0xd962('0x15')],function(_0x21b5e0){if(_0x21b5e0){logger['error'](_0x21b5e0);return _0x3c989f[_0xd962('0x11')](0x1f4)[_0xd962('0x12')](_0x21b5e0);}logger[_0xd962('0x16')]('git\x20fetch');return _0x3c989f['status'](0xc8)[_0xd962('0x12')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xd962('0x17')]=function(_0x14ad50,_0x44fbbe){return git['reset']([_0xd962('0x18'),_0xd962('0x19')],function(_0x327c58){if(_0x327c58){logger[_0xd962('0x1a')](_0x327c58);return _0x44fbbe['status'](0x1f4)[_0xd962('0x12')](_0x327c58);}logger[_0xd962('0x16')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x44fbbe[_0xd962('0x11')](0xc8)[_0xd962('0x12')]({'output':_0xd962('0x1b')});});};exports[_0xd962('0x1c')]=function(_0x1f45bf,_0x5d83c7){exec(_0xd962('0x1d'),function(_0x2964e3,_0x101332,_0x14ea49){logger[_0xd962('0x16')](_0x101332);logger[_0xd962('0x16')](_0x14ea49);if(_0x2964e3){logger[_0xd962('0x1a')](_0x2964e3);return _0x5d83c7[_0xd962('0x11')](0x1f4)[_0xd962('0x12')](_0x2964e3);}return _0x5d83c7[_0xd962('0x11')](0xc8)[_0xd962('0x12')]({'output':_0x101332});});};exports['restart']=function(_0x37e9b5,_0x3c4e6f){return pm2['restart'](_0xd962('0x1e'))[_0xd962('0x1f')](function(_0x11740b){logger[_0xd962('0x16')](_0xd962('0x20'),_0x11740b);return _0x3c4e6f[_0xd962('0x11')](0xc8)[_0xd962('0x12')]({'output':_0xd962('0x21')});})[_0xd962('0x22')](function(_0x372dcd){logger[_0xd962('0x1a')](_0x372dcd);return _0x3c4e6f[_0xd962('0x11')](0x1f4)[_0xd962('0x12')](_0x372dcd);});};exports[_0xd962('0x23')]=function(_0xb9448c,_0xe6710){var _0x3d2abc=fs['readdirSync'](path[_0xd962('0x24')](config[_0xd962('0x25')],_0xd962('0x26'),_0xd962('0x23')));var _0x33cc00=[];for(var _0x53cf06=0x0;_0x53cf06<_0x3d2abc[_0xd962('0x27')];_0x53cf06++){var _0x52dc2b=_0x3d2abc[_0x53cf06][_0xd962('0x28')]('.js','');if(compareVersions(module[_0xd962('0xd')]['version'],_0x52dc2b)===-0x1){_0x33cc00[_0xd962('0x29')](_0x52dc2b);}}if(_0x33cc00[_0xd962('0x27')]){var _0x1e57c3=_0x33cc00['sort'](compareVersions);var _0x4c924b=new Umzug({'storage':_0xd962('0x2a'),'storageOptions':{'model':db['Migration'],'modelName':_0xd962('0x2b'),'columnName':_0xd962('0xe')},'migrations':{'params':[db[_0xd962('0x2a')][_0xd962('0x2c')](),db[_0xd962('0x2a')][_0xd962('0x2d')],function(){throw new Error(_0xd962('0x2e'));}],'path':path[_0xd962('0x24')](config[_0xd962('0x25')],'server','migrations'),'pattern':/\.js$/}});_0x4c924b['up']({'migrations':_['map'](_0x1e57c3,function(_0x3dd2c5){return _0x3dd2c5+_0xd962('0x2f');})})[_0xd962('0x1f')](function(){return _0xe6710[_0xd962('0x11')](0xc8)[_0xd962('0x12')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0xd962('0xd')][_0xd962('0xe')]+'\x20to\x20'+_['last'](_0x1e57c3),'migrations':_['join'](_0x1e57c3)});})[_0xd962('0x22')](function(_0x1edf9c){if(_0x1edf9c instanceof db[_0xd962('0x2a')][_0xd962('0x30')]){return _0xe6710[_0xd962('0x11')](0xc8)[_0xd962('0x12')]({'output':'Database\x20already\x20up-to-date'});}else{return _0xe6710[_0xd962('0x11')](0x1f4)[_0xd962('0x12')](_0x1edf9c);}});}else{return _0xe6710['status'](0xc8)[_0xd962('0x12')]({'output':_0xd962('0x31')});}}; \ No newline at end of file +var _0x935e=['child_process','exec','../../mysqldb','../../config/environment','../../config/logger','simple-git','index','exports','query','latest','fetch','tags','version','2.0.0','status','origin','master','error','json','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','root','length','replace','push','sort','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','.js','last','Database\x20already\x20up-to-date','path','lodash','pkginfo','compare-versions'];(function(_0xce6f11,_0x3c3137){var _0x35b709=function(_0x1755c6){while(--_0x1755c6){_0xce6f11['push'](_0xce6f11['shift']());}};_0x35b709(++_0x3c3137);}(_0x935e,0x66));var _0xe935=function(_0x39b4c0,_0x2192fd){_0x39b4c0=_0x39b4c0-0x0;var _0x362edb=_0x935e[_0x39b4c0];return _0x362edb;};'use strict';var Umzug=require('umzug');var path=require(_0xe935('0x0'));var fs=require('fs');var _=require(_0xe935('0x1'));var pkginfo=require(_0xe935('0x2'))(module,'version');var compareVersions=require(_0xe935('0x3'));var exec=require(_0xe935('0x4'))[_0xe935('0x5')];var db=require(_0xe935('0x6'))['db'];var config=require(_0xe935('0x7'));var pm2=require('../../config/pm2');var logger=require(_0xe935('0x8'))('update');var git=require(_0xe935('0x9'))(config['root']);exports[_0xe935('0xa')]=function(_0x1f1f53,_0x2f859b){var _0x399308={'current':module[_0xe935('0xb')]['version'],'phonebar':0x2};if(_0x1f1f53[_0xe935('0xc')]&&_0x1f1f53[_0xe935('0xc')][_0xe935('0xd')]){return git[_0xe935('0xe')]()[_0xe935('0xf')](function(_0x3719a2,_0xf0ad77){_0x399308[_0xe935('0xd')]=(_0x3719a2?module[_0xe935('0xb')][_0xe935('0x10')]:_0xf0ad77[_0xe935('0xd')])||_0xe935('0x11');return _0x2f859b['status'](0xc8)['json'](_0x399308);});}else{return _0x2f859b[_0xe935('0x12')](0xc8)['json'](_0x399308);}};exports['fetch']=function(_0x13f57c,_0x353f0b){return git['fetch']([_0xe935('0x13'),_0xe935('0x14')],function(_0xbb6f8c){if(_0xbb6f8c){logger[_0xe935('0x15')](_0xbb6f8c);return _0x353f0b[_0xe935('0x12')](0x1f4)[_0xe935('0x16')](_0xbb6f8c);}logger[_0xe935('0x17')](_0xe935('0x18'));return _0x353f0b[_0xe935('0x12')](0xc8)['json']({'output':_0xe935('0x19')});});};exports[_0xe935('0x1a')]=function(_0x139be6,_0x5bf729){return git[_0xe935('0x1a')]([_0xe935('0x1b'),_0xe935('0x1c')],function(_0x165b35){if(_0x165b35){logger['error'](_0x165b35);return _0x5bf729['status'](0x1f4)[_0xe935('0x16')](_0x165b35);}logger[_0xe935('0x17')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x5bf729[_0xe935('0x12')](0xc8)[_0xe935('0x16')]({'output':_0xe935('0x1d')});});};exports[_0xe935('0x1e')]=function(_0x4accc2,_0x546d84){exec(_0xe935('0x1f'),function(_0x2e68f6,_0x3ba376,_0x202edc){logger[_0xe935('0x17')](_0x3ba376);logger['info'](_0x202edc);if(_0x2e68f6){logger[_0xe935('0x15')](_0x2e68f6);return _0x546d84[_0xe935('0x12')](0x1f4)[_0xe935('0x16')](_0x2e68f6);}return _0x546d84[_0xe935('0x12')](0xc8)[_0xe935('0x16')]({'output':_0x3ba376});});};exports[_0xe935('0x20')]=function(_0x28bf9d,_0xee1f13){return pm2[_0xe935('0x20')]('motion2')[_0xe935('0x21')](function(_0x1cfaca){logger[_0xe935('0x17')](_0xe935('0x22'),_0x1cfaca);return _0xee1f13[_0xe935('0x12')](0xc8)[_0xe935('0x16')]({'output':_0xe935('0x23')});})[_0xe935('0x24')](function(_0x106c31){logger[_0xe935('0x15')](_0x106c31);return _0xee1f13['status'](0x1f4)['json'](_0x106c31);});};exports[_0xe935('0x25')]=function(_0x5f03b0,_0x2a2eed){var _0x5a73c8=fs[_0xe935('0x26')](path[_0xe935('0x27')](config[_0xe935('0x28')],'server',_0xe935('0x25')));var _0x2d0f89=[];for(var _0x61e051=0x0;_0x61e051<_0x5a73c8[_0xe935('0x29')];_0x61e051++){var _0x14799d=_0x5a73c8[_0x61e051][_0xe935('0x2a')]('.js','');if(compareVersions(module['exports'][_0xe935('0x10')],_0x14799d)===-0x1){_0x2d0f89[_0xe935('0x2b')](_0x14799d);}}if(_0x2d0f89[_0xe935('0x29')]){var _0x33e5b7=_0x2d0f89[_0xe935('0x2c')](compareVersions);var _0x2f3c0f=new Umzug({'storage':_0xe935('0x2d'),'storageOptions':{'model':db['Migration'],'modelName':'Migration','columnName':_0xe935('0x10')},'migrations':{'params':[db[_0xe935('0x2d')][_0xe935('0x2e')](),db['sequelize'][_0xe935('0x2f')],function(){throw new Error(_0xe935('0x30'));}],'path':path[_0xe935('0x27')](config['root'],_0xe935('0x31'),_0xe935('0x25')),'pattern':/\.js$/}});_0x2f3c0f['up']({'migrations':_['map'](_0x33e5b7,function(_0x187a9f){return _0x187a9f+_0xe935('0x32');})})[_0xe935('0x21')](function(){return _0x2a2eed[_0xe935('0x12')](0xc8)[_0xe935('0x16')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0xe935('0xb')][_0xe935('0x10')]+'\x20to\x20'+_[_0xe935('0x33')](_0x33e5b7),'migrations':_[_0xe935('0x27')](_0x33e5b7)});})['catch'](function(_0x29584b){if(_0x29584b instanceof db[_0xe935('0x2d')]['UniqueConstraintError']){return _0x2a2eed[_0xe935('0x12')](0xc8)[_0xe935('0x16')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x2a2eed[_0xe935('0x12')](0x1f4)[_0xe935('0x16')](_0x29584b);}});}else{return _0x2a2eed[_0xe935('0x12')](0xc8)['json']({'output':_0xe935('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 6618197..faf8676 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 _0xef11=['show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','get','isAuthenticated','describe','/:id'];(function(_0x3c222b,_0x5d2eb7){var _0xd9fdbb=function(_0x3aa0d2){while(--_0x3aa0d2){_0x3c222b['push'](_0x3c222b['shift']());}};_0xd9fdbb(++_0x5d2eb7);}(_0xef11,0xf5));var _0x1ef1=function(_0x2077c2,_0x275ab5){_0x2077c2=_0x2077c2-0x0;var _0x312f9f=_0xef11[_0x2077c2];return _0x312f9f;};'use strict';var multer=require(_0x1ef1('0x0'));var util=require(_0x1ef1('0x1'));var path=require(_0x1ef1('0x2'));var timeout=require(_0x1ef1('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1ef1('0x4'));var auth=require(_0x1ef1('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router[_0x1ef1('0x6')]('/',auth[_0x1ef1('0x7')](),controller['index']);router[_0x1ef1('0x6')]('/describe',auth[_0x1ef1('0x7')](),controller[_0x1ef1('0x8')]);router[_0x1ef1('0x6')](_0x1ef1('0x9'),auth['isAuthenticated'](),controller[_0x1ef1('0xa')]);router[_0x1ef1('0xb')]('/',auth[_0x1ef1('0x7')](),controller[_0x1ef1('0xc')]);router[_0x1ef1('0xd')](_0x1ef1('0x9'),auth[_0x1ef1('0x7')](),controller['update']);router[_0x1ef1('0xe')](_0x1ef1('0x9'),auth[_0x1ef1('0x7')](),controller[_0x1ef1('0xf')]);module[_0x1ef1('0x10')]=router; \ No newline at end of file +var _0x3a8d=['./voiceAgentReport.controller','get','index','/describe','describe','/:id','isAuthenticated','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x5c9924,_0x39a900){var _0x7b9a86=function(_0x2b7284){while(--_0x2b7284){_0x5c9924['push'](_0x5c9924['shift']());}};_0x7b9a86(++_0x39a900);}(_0x3a8d,0x150));var _0xd3a8=function(_0x334651,_0x6e99f6){_0x334651=_0x334651-0x0;var _0x29657c=_0x3a8d[_0x334651];return _0x29657c;};'use strict';var multer=require(_0xd3a8('0x0'));var util=require('util');var path=require(_0xd3a8('0x1'));var timeout=require(_0xd3a8('0x2'));var express=require(_0xd3a8('0x3'));var router=express['Router']();var fs_extra=require(_0xd3a8('0x4'));var auth=require(_0xd3a8('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd3a8('0x6'));router[_0xd3a8('0x7')]('/',auth['isAuthenticated'](),controller[_0xd3a8('0x8')]);router['get'](_0xd3a8('0x9'),auth['isAuthenticated'](),controller[_0xd3a8('0xa')]);router[_0xd3a8('0x7')](_0xd3a8('0xb'),auth[_0xd3a8('0xc')](),controller['show']);router[_0xd3a8('0xd')]('/',auth[_0xd3a8('0xc')](),controller[_0xd3a8('0xe')]);router[_0xd3a8('0xf')]('/:id',auth[_0xd3a8('0xc')](),controller['update']);router[_0xd3a8('0x10')](_0xd3a8('0xb'),auth[_0xd3a8('0xc')](),controller[_0xd3a8('0x11')]);module[_0xd3a8('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 1b23a0c..8f897a0 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 _0x36ee=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','STRING','DATE','INTEGER'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x36ee,0xe8));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xe36e('0x0')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe36e('0x0')]},'calleridname':{'type':Sequelize[_0xe36e('0x0')]},'queue':{'type':Sequelize[_0xe36e('0x0')]},'interface':{'type':Sequelize[_0xe36e('0x0')]},'membername':{'type':Sequelize[_0xe36e('0x0')]},'agentcalledAt':{'type':Sequelize[_0xe36e('0x1')]},'agentconnectAt':{'type':Sequelize[_0xe36e('0x1')]},'agentcompleteAt':{'type':Sequelize[_0xe36e('0x1')]},'agentringnoanswerAt':{'type':Sequelize[_0xe36e('0x1')]},'agentdumpAt':{'type':Sequelize[_0xe36e('0x1')]},'holdtime':{'type':Sequelize[_0xe36e('0x2')]},'agentcomplete':{'type':Sequelize[_0xe36e('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xe36e('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xe36e('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe36e('0x2')]},'reason':{'type':Sequelize[_0xe36e('0x0')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe36e('0x0')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xe36e('0x0')]},'connectedlinenum':{'type':Sequelize[_0xe36e('0x0')]},'connectedlinename':{'type':Sequelize[_0xe36e('0x0')]},'language':{'type':Sequelize[_0xe36e('0x0')]},'accountcode':{'type':Sequelize[_0xe36e('0x0')]},'context':{'type':Sequelize[_0xe36e('0x0')]},'exten':{'type':Sequelize[_0xe36e('0x0')]},'priority':{'type':Sequelize[_0xe36e('0x0')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xe36e('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xe36e('0x0')]},'destcalleridnum':{'type':Sequelize[_0xe36e('0x0')]},'destcalleridname':{'type':Sequelize[_0xe36e('0x0')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xe36e('0x0')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xe36e('0x0')]},'destexten':{'type':Sequelize[_0xe36e('0x0')]},'destpriority':{'type':Sequelize[_0xe36e('0x0')]},'destuniqueid':{'type':Sequelize[_0xe36e('0x0')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xe36e('0x0')]},'answeredelsewheremembername':{'type':Sequelize[_0xe36e('0x0')]},'transfer':{'type':Sequelize[_0xe36e('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xe36e('0x0')],'comment':_0xe36e('0x4')},'transferexten':{'type':Sequelize[_0xe36e('0x0')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xe36e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb6a6=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x5d4e77,_0xa9900f){var _0x1c361e=function(_0x2441d4){while(--_0x2441d4){_0x5d4e77['push'](_0x5d4e77['shift']());}};_0x1c361e(++_0xa9900f);}(_0xb6a6,0x1a0));var _0x6b6a=function(_0x3c7ab5,_0x19207c){_0x3c7ab5=_0x3c7ab5-0x0;var _0x3d15ce=_0xb6a6[_0x3c7ab5];return _0x3d15ce;};'use strict';var Sequelize=require(_0x6b6a('0x0'));module[_0x6b6a('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6b6a('0x2')]},'calleridname':{'type':Sequelize[_0x6b6a('0x2')]},'queue':{'type':Sequelize[_0x6b6a('0x2')]},'interface':{'type':Sequelize[_0x6b6a('0x2')]},'membername':{'type':Sequelize[_0x6b6a('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x6b6a('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x6b6a('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x6b6a('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x6b6a('0x4')]},'agentcomplete':{'type':Sequelize[_0x6b6a('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x6b6a('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x6b6a('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x6b6a('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x6b6a('0x2')]},'channel':{'type':Sequelize[_0x6b6a('0x2')]},'channelstate':{'type':Sequelize[_0x6b6a('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x6b6a('0x2')]},'language':{'type':Sequelize[_0x6b6a('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x6b6a('0x2')]},'priority':{'type':Sequelize[_0x6b6a('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x6b6a('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x6b6a('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x6b6a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x6b6a('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x6b6a('0x2')]},'destaccountcode':{'type':Sequelize[_0x6b6a('0x2')]},'destcontext':{'type':Sequelize[_0x6b6a('0x2')]},'destexten':{'type':Sequelize[_0x6b6a('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x6b6a('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x6b6a('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x6b6a('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6b6a('0x2')],'comment':_0x6b6a('0x6')},'transferexten':{'type':Sequelize[_0x6b6a('0x2')]},'transferuniqueid':{'type':Sequelize[_0x6b6a('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'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 0b6121c..fe27309 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(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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 26cc107..3a94505 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 _0xf041=['bluebird','path','../../config/environment','define','VoiceAgentReport','report_agent','uniqueid','../../config/logger','api','moment'];(function(_0x541095,_0x582b30){var _0x5a2c40=function(_0xb7650f){while(--_0xb7650f){_0x541095['push'](_0x541095['shift']());}};_0x5a2c40(++_0x582b30);}(_0xf041,0x15b));var _0x1f04=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf041[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1f04('0x0'))(_0x1f04('0x1'));var moment=require(_0x1f04('0x2'));var BPromise=require(_0x1f04('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f04('0x4'));var rimraf=require('rimraf');var config=require(_0x1f04('0x5'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x25d578,_0x504d71){return _0x25d578[_0x1f04('0x6')](_0x1f04('0x7'),attributes,{'tableName':_0x1f04('0x8'),'paranoid':![],'indexes':[{'fields':[_0x1f04('0x9'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8375=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceAgentReport','destuniqueid','lodash'];(function(_0x345d07,_0x3ba133){var _0x2f9181=function(_0x5acc1c){while(--_0x5acc1c){_0x345d07['push'](_0x345d07['shift']());}};_0x2f9181(++_0x3ba133);}(_0x8375,0xa8));var _0x5837=function(_0x52d579,_0x453f9d){_0x52d579=_0x52d579-0x0;var _0x398818=_0x8375[_0x52d579];return _0x398818;};'use strict';var _=require(_0x5837('0x0'));var util=require(_0x5837('0x1'));var logger=require(_0x5837('0x2'))('api');var moment=require(_0x5837('0x3'));var BPromise=require(_0x5837('0x4'));var rp=require(_0x5837('0x5'));var fs=require('fs');var path=require(_0x5837('0x6'));var rimraf=require(_0x5837('0x7'));var config=require(_0x5837('0x8'));var attributes=require('./voiceAgentReport.attributes');module[_0x5837('0x9')]=function(_0x19491e,_0x365da3){return _0x19491e[_0x5837('0xa')](_0x5837('0xb'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':['uniqueid',_0x5837('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 871b033..78b33c7 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 _0x0b0c=['message','info','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','raw','UpdateVoiceAgentReport','update','options','where','limit','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xeee6c7,_0x408226){var _0x35f402=function(_0x2b5bcc){while(--_0x2b5bcc){_0xeee6c7['push'](_0xeee6c7['shift']());}};_0x35f402(++_0x408226);}(_0x0b0c,0xfd));var _0xc0b0=function(_0x25680f,_0x49646a){_0x25680f=_0x25680f-0x0;var _0x135948=_0x0b0c[_0x25680f];return _0x135948;};'use strict';var _=require(_0xc0b0('0x0'));var util=require(_0xc0b0('0x1'));var moment=require(_0xc0b0('0x2'));var BPromise=require(_0xc0b0('0x3'));var rs=require(_0xc0b0('0x4'));var fs=require('fs');var Redis=require(_0xc0b0('0x5'));var db=require(_0xc0b0('0x6'))['db'];var utils=require(_0xc0b0('0x7'));var logger=require(_0xc0b0('0x8'))(_0xc0b0('0x9'));var config=require(_0xc0b0('0xa'));var jayson=require(_0xc0b0('0xb'));var client=jayson[_0xc0b0('0xc')][_0xc0b0('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x183153,_0x1b40e2,_0x3fdf8b){return new BPromise(function(_0x52b7ef,_0x3acf27){return client['request'](_0x183153,_0x3fdf8b)[_0xc0b0('0xe')](function(_0x251eae){logger['info'](_0xc0b0('0xf'),_0x1b40e2,_0xc0b0('0x10'));logger['debug']('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x1b40e2,_0xc0b0('0x10'),JSON[_0xc0b0('0x11')](_0x251eae));if(_0x251eae[_0xc0b0('0x12')]){if(_0x251eae['error']['code']===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x1b40e2,_0x251eae[_0xc0b0('0x12')][_0xc0b0('0x13')]);return _0x3acf27(_0x251eae[_0xc0b0('0x12')][_0xc0b0('0x13')]);}logger[_0xc0b0('0x12')](_0xc0b0('0xf'),_0x1b40e2,_0x251eae[_0xc0b0('0x12')][_0xc0b0('0x13')]);return _0x52b7ef(_0x251eae[_0xc0b0('0x12')]['message']);}else{logger[_0xc0b0('0x14')](_0xc0b0('0xf'),_0x1b40e2,_0xc0b0('0x10'));_0x52b7ef(_0x251eae[_0xc0b0('0x15')][_0xc0b0('0x13')]);}})[_0xc0b0('0x16')](function(_0x285368){logger[_0xc0b0('0x12')](_0xc0b0('0xf'),_0x1b40e2,_0x285368);_0x3acf27(_0x285368);});});}exports[_0xc0b0('0x17')]=function(_0x59232d){var _0x2df71a=this;return new Promise(function(_0x28f4e5,_0x2c1900){return db[_0xc0b0('0x18')][_0xc0b0('0x19')](_0x59232d[_0xc0b0('0x1a')],{'raw':_0x59232d['options']?_0x59232d['options'][_0xc0b0('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x5ab874){logger[_0xc0b0('0x14')]('CreateVoiceAgentReport',_0x59232d);logger['debug'](_0xc0b0('0x17'),_0x59232d,JSON[_0xc0b0('0x11')](_0x5ab874));_0x28f4e5(_0x5ab874);})[_0xc0b0('0x16')](function(_0x511a51){logger['error'](_0xc0b0('0x17'),_0x511a51[_0xc0b0('0x13')],_0x59232d);_0x2c1900(_0x2df71a[_0xc0b0('0x12')](0x1f4,_0x511a51[_0xc0b0('0x13')]));});});};exports[_0xc0b0('0x1c')]=function(_0x58d468){var _0x11516=this;return new Promise(function(_0x5b589c,_0x2466ef){return db[_0xc0b0('0x18')][_0xc0b0('0x1d')](_0x58d468[_0xc0b0('0x1a')],{'raw':_0x58d468['options']?_0x58d468[_0xc0b0('0x1e')][_0xc0b0('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58d468[_0xc0b0('0x1e')]?_0x58d468[_0xc0b0('0x1e')][_0xc0b0('0x1f')]||null:null,'attributes':_0x58d468['options']?_0x58d468[_0xc0b0('0x1e')]['attributes']||null:null,'limit':_0x58d468[_0xc0b0('0x1e')]?_0x58d468[_0xc0b0('0x1e')][_0xc0b0('0x20')]||null:null})['then'](function(_0x4a5b95){logger[_0xc0b0('0x14')](_0xc0b0('0x1c'),_0x58d468);logger[_0xc0b0('0x21')](_0xc0b0('0x1c'),_0x58d468,JSON[_0xc0b0('0x11')](_0x4a5b95));_0x5b589c(_0x4a5b95);})[_0xc0b0('0x16')](function(_0x23fa1b){logger['error'](_0xc0b0('0x1c'),_0x23fa1b[_0xc0b0('0x13')],_0x58d468);_0x2466ef(_0x11516[_0xc0b0('0x12')](0x1f4,_0x23fa1b[_0xc0b0('0x13')]));});});}; \ No newline at end of file +var _0x05bb=['debug','stringify','UpdateVoiceAgentReport','update','where','attributes','limit','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','error','message','VoiceAgentReport,\x20%s,\x20%s','result','CreateVoiceAgentReport','VoiceAgentReport','body','options','raw'];(function(_0x246227,_0x12bfcb){var _0x37bd4a=function(_0x4670f4){while(--_0x4670f4){_0x246227['push'](_0x246227['shift']());}};_0x37bd4a(++_0x12bfcb);}(_0x05bb,0xa3));var _0xb05b=function(_0x1d3c22,_0x8ceb25){_0x1d3c22=_0x1d3c22-0x0;var _0x2573a2=_0x05bb[_0x1d3c22];return _0x2573a2;};'use strict';var _=require(_0xb05b('0x0'));var util=require('util');var moment=require(_0xb05b('0x1'));var BPromise=require('bluebird');var rs=require(_0xb05b('0x2'));var fs=require('fs');var Redis=require(_0xb05b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb05b('0x4'));var logger=require(_0xb05b('0x5'))(_0xb05b('0x6'));var config=require(_0xb05b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb05b('0x8')][_0xb05b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f9095,_0x236225,_0x108cc8){return new BPromise(function(_0x14908b,_0x1d2e55){return client[_0xb05b('0xa')](_0x1f9095,_0x108cc8)[_0xb05b('0xb')](function(_0x7d6aa1){logger[_0xb05b('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x236225,_0xb05b('0xd'));logger['debug']('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x236225,_0xb05b('0xd'),JSON['stringify'](_0x7d6aa1));if(_0x7d6aa1[_0xb05b('0xe')]){if(_0x7d6aa1['error']['code']===0x1f4){logger[_0xb05b('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x236225,_0x7d6aa1[_0xb05b('0xe')][_0xb05b('0xf')]);return _0x1d2e55(_0x7d6aa1[_0xb05b('0xe')][_0xb05b('0xf')]);}logger[_0xb05b('0xe')](_0xb05b('0x10'),_0x236225,_0x7d6aa1['error'][_0xb05b('0xf')]);return _0x14908b(_0x7d6aa1[_0xb05b('0xe')]['message']);}else{logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x236225,_0xb05b('0xd'));_0x14908b(_0x7d6aa1[_0xb05b('0x11')]['message']);}})['catch'](function(_0x21bcc8){logger[_0xb05b('0xe')](_0xb05b('0x10'),_0x236225,_0x21bcc8);_0x1d2e55(_0x21bcc8);});});}exports[_0xb05b('0x12')]=function(_0x28e608){var _0x30b50c=this;return new Promise(function(_0x193a19,_0x209f6e){return db[_0xb05b('0x13')]['create'](_0x28e608[_0xb05b('0x14')],{'raw':_0x28e608['options']?_0x28e608[_0xb05b('0x15')][_0xb05b('0x16')]===undefined?!![]:![]:!![]})[_0xb05b('0xb')](function(_0x2731a0){logger['info'](_0xb05b('0x12'),_0x28e608);logger[_0xb05b('0x17')](_0xb05b('0x12'),_0x28e608,JSON[_0xb05b('0x18')](_0x2731a0));_0x193a19(_0x2731a0);})['catch'](function(_0x4789dc){logger[_0xb05b('0xe')](_0xb05b('0x12'),_0x4789dc[_0xb05b('0xf')],_0x28e608);_0x209f6e(_0x30b50c[_0xb05b('0xe')](0x1f4,_0x4789dc[_0xb05b('0xf')]));});});};exports[_0xb05b('0x19')]=function(_0x407900){var _0x3e5f45=this;return new Promise(function(_0x5e96af,_0x527e4c){return db[_0xb05b('0x13')][_0xb05b('0x1a')](_0x407900['body'],{'raw':_0x407900[_0xb05b('0x15')]?_0x407900['options'][_0xb05b('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x407900['options']?_0x407900[_0xb05b('0x15')][_0xb05b('0x1b')]||null:null,'attributes':_0x407900[_0xb05b('0x15')]?_0x407900[_0xb05b('0x15')][_0xb05b('0x1c')]||null:null,'limit':_0x407900['options']?_0x407900[_0xb05b('0x15')][_0xb05b('0x1d')]||null:null})[_0xb05b('0xb')](function(_0x40a9d3){logger[_0xb05b('0xc')](_0xb05b('0x19'),_0x407900);logger[_0xb05b('0x17')](_0xb05b('0x19'),_0x407900,JSON['stringify'](_0x40a9d3));_0x5e96af(_0x40a9d3);})[_0xb05b('0x1e')](function(_0x389c4e){logger['error'](_0xb05b('0x19'),_0x389c4e[_0xb05b('0xf')],_0x407900);_0x527e4c(_0x3e5f45[_0xb05b('0xe')](0x1f4,_0x389c4e[_0xb05b('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 7e65b8d..945300c 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 _0x5089=['show','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x5089,0x1bb));var _0x9508=function(_0x149f32,_0x4273f7){_0x149f32=_0x149f32-0x0;var _0x11f475=_0x5089[_0x149f32];return _0x11f475;};'use strict';var multer=require(_0x9508('0x0'));var util=require(_0x9508('0x1'));var path=require('path');var timeout=require(_0x9508('0x2'));var express=require(_0x9508('0x3'));var router=express[_0x9508('0x4')]();var fs_extra=require(_0x9508('0x5'));var auth=require(_0x9508('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9508('0x7'));var controller=require('./voiceCallReport.controller');router[_0x9508('0x8')]('/',auth[_0x9508('0x9')](),controller[_0x9508('0xa')]);router['get'](_0x9508('0xb'),auth[_0x9508('0x9')](),controller['describe']);router[_0x9508('0x8')](_0x9508('0xc'),auth['isAuthenticated'](),controller[_0x9508('0xd')]);router['post']('/',auth[_0x9508('0x9')](),controller[_0x9508('0xe')]);router[_0x9508('0xf')](_0x9508('0xc'),auth[_0x9508('0x9')](),controller[_0x9508('0x10')]);router['delete'](_0x9508('0xc'),auth['isAuthenticated'](),controller[_0x9508('0x11')]);module[_0x9508('0x12')]=router; \ No newline at end of file +var _0xe015=['../../components/interaction/service','../../config/environment','./voiceCallReport.controller','isAuthenticated','index','describe','get','/:id','show','put','update','multer','util','path','Router','../../components/auth/service'];(function(_0x1850fb,_0x5081b2){var _0x3d6508=function(_0x25b9d1){while(--_0x25b9d1){_0x1850fb['push'](_0x1850fb['shift']());}};_0x3d6508(++_0x5081b2);}(_0xe015,0x13b));var _0x5e01=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe015[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x5e01('0x0'));var util=require(_0x5e01('0x1'));var path=require(_0x5e01('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5e01('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5e01('0x4'));var interaction=require(_0x5e01('0x5'));var config=require(_0x5e01('0x6'));var controller=require(_0x5e01('0x7'));router['get']('/',auth[_0x5e01('0x8')](),controller[_0x5e01('0x9')]);router['get']('/describe',auth[_0x5e01('0x8')](),controller[_0x5e01('0xa')]);router[_0x5e01('0xb')](_0x5e01('0xc'),auth[_0x5e01('0x8')](),controller[_0x5e01('0xd')]);router['post']('/',auth[_0x5e01('0x8')](),controller['create']);router[_0x5e01('0xe')]('/:id',auth[_0x5e01('0x8')](),controller[_0x5e01('0xf')]);router['delete'](_0x5e01('0xc'),auth[_0x5e01('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 252abdc..e540778 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 _0x25c2=['outbound','outbound-fax','dialer','DATE','INTEGER','sequelize','STRING','ENUM','internal'];(function(_0x80f2f0,_0x50643f){var _0x23a795=function(_0x364fea){while(--_0x364fea){_0x80f2f0['push'](_0x80f2f0['shift']());}};_0x23a795(++_0x50643f);}(_0x25c2,0xdd));var _0x225c=function(_0x18fb16,_0x45edbc){_0x18fb16=_0x18fb16-0x0;var _0x147b0d=_0x25c2[_0x18fb16];return _0x147b0d;};'use strict';var Sequelize=require(_0x225c('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x225c('0x1')]},'type':{'type':Sequelize[_0x225c('0x2')]('inbound',_0x225c('0x3'),_0x225c('0x4'),'inbound-fax',_0x225c('0x5'),_0x225c('0x6'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x225c('0x1')]},'source':{'type':Sequelize[_0x225c('0x1')]},'destination':{'type':Sequelize[_0x225c('0x1')]},'destinationcontext':{'type':Sequelize[_0x225c('0x1')]},'callerid':{'type':Sequelize[_0x225c('0x1')]},'channel':{'type':Sequelize[_0x225c('0x1')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x225c('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x225c('0x7')]},'answertime':{'type':Sequelize[_0x225c('0x7')]},'endtime':{'type':Sequelize[_0x225c('0x7')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x225c('0x8')]},'mohtime':{'type':Sequelize[_0x225c('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x225c('0x1')]},'amaflags':{'type':Sequelize[_0x225c('0x1')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x225c('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x225c('0x1')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x225c('0x1')]},'prefix':{'type':Sequelize[_0x225c('0x1')]},'routeid':{'type':Sequelize[_0x225c('0x8')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0b70=['outbound','inbound-fax','outbound-fax','dialer','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound'];(function(_0xf11b7f,_0x8abffb){var _0x11dfb1=function(_0x3773a0){while(--_0x3773a0){_0xf11b7f['push'](_0xf11b7f['shift']());}};_0x11dfb1(++_0x8abffb);}(_0x0b70,0x192));var _0x00b7=function(_0x1acdd7,_0x33e463){_0x1acdd7=_0x1acdd7-0x0;var _0x261e0b=_0x0b70[_0x1acdd7];return _0x261e0b;};'use strict';var Sequelize=require(_0x00b7('0x0'));module[_0x00b7('0x1')]={'uniqueid':{'type':Sequelize[_0x00b7('0x2')]},'type':{'type':Sequelize[_0x00b7('0x3')](_0x00b7('0x4'),'internal',_0x00b7('0x5'),_0x00b7('0x6'),_0x00b7('0x7'),_0x00b7('0x8'))},'tag':{'type':Sequelize[_0x00b7('0x2')]},'accountcode':{'type':Sequelize[_0x00b7('0x2')]},'source':{'type':Sequelize[_0x00b7('0x2')]},'destination':{'type':Sequelize[_0x00b7('0x2')]},'destinationcontext':{'type':Sequelize[_0x00b7('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x00b7('0x2')]},'destinationchannel':{'type':Sequelize[_0x00b7('0x2')]},'lastapplication':{'type':Sequelize[_0x00b7('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x00b7('0x9')]},'systemanswertime':{'type':Sequelize[_0x00b7('0x9')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x00b7('0x9')]},'duration':{'type':Sequelize[_0x00b7('0xa')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x00b7('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x00b7('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x00b7('0x2')]},'userDisposition':{'type':Sequelize[_0x00b7('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x00b7('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x00b7('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x00b7('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index b6a0604..7b298e4 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 _0x5f2f=['stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','fullname','alias','User','findAll','catch','params','keys','find','create','body','destroy','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x29e3b6,_0x40b0b4){var _0x55d4b0=function(_0x55c58e){while(--_0x55c58e){_0x29e3b6['push'](_0x29e3b6['shift']());}};_0x55d4b0(++_0x40b0b4);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4d63ce,_0x5bfa20){_0x4d63ce=_0x4d63ce-0x0;var _0x376e17=_0x5f2f[_0x4d63ce];return _0x376e17;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'attributes':['id',_0xf5f2('0x26'),_0xf5f2('0x3e'),_0xf5f2('0x3f')],'model':db['User'],'as':_0xf5f2('0x40')}];}return db[_0xf5f2('0x29')][_0xf5f2('0x41')](_0x22c826);})['then'](function(_0x509dbc){_0x11c771['rows']=_0x509dbc;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x42')](handleError(_0x53cb96,null));};exports['show']=function(_0x106272,_0xeed03d){var _0x28e33f={'raw':!![],'where':{'id':_0x106272[_0xf5f2('0x43')]['id']}},_0x31f86c={};_0x31f86c[_0xf5f2('0x31')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x31f86c[_0xf5f2('0x2e')]=_[_0xf5f2('0x44')](_0x106272[_0xf5f2('0x2e')]);_0x31f86c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x31f86c['model'],_0x31f86c[_0xf5f2('0x2e')]);_0x28e33f['attributes']=_[_0xf5f2('0x30')](_0x31f86c[_0xf5f2('0x31')],qs[_0xf5f2('0x33')](_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x28e33f[_0xf5f2('0x32')]=_0x28e33f['attributes'][_0xf5f2('0x34')]?_0x28e33f[_0xf5f2('0x32')]:_0x31f86c[_0xf5f2('0x31')];if(_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x28e33f[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x28e33f=_[_0xf5f2('0x39')]({},_0x28e33f,_0x106272[_0xf5f2('0x3b')]);return db['VoiceCallReport'][_0xf5f2('0x45')](_0x28e33f)[_0xf5f2('0x24')](handleEntityNotFound(_0xeed03d,null))[_0xf5f2('0x24')](respondWithResult(_0xeed03d,null))['catch'](handleError(_0xeed03d,null));};exports[_0xf5f2('0x46')]=function(_0xc91b64,_0x3179a9){return db['VoiceCallReport']['create'](_0xc91b64[_0xf5f2('0x47')],{})[_0xf5f2('0x24')](respondWithResult(_0x3179a9,0xc9))['catch'](handleError(_0x3179a9,null));};exports[_0xf5f2('0x48')]=function(_0x533cca,_0x740321){return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'id':_0x533cca['params']['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x740321,null))[_0xf5f2('0x24')](removeEntity(_0x740321,null))[_0xf5f2('0x42')](handleError(_0x740321,null));};exports[_0xf5f2('0x49')]=function(_0x4fa738,_0x3154c1){return db[_0xf5f2('0x29')]['describe']()['then'](respondWithResult(_0x3154c1,null))[_0xf5f2('0x42')](handleError(_0x3154c1,null));};exports[_0xf5f2('0x4a')]=function(_0x57782c,_0x22b645){if(_0x57782c[_0xf5f2('0x47')][_0xf5f2('0x4b')]){delete _0x57782c[_0xf5f2('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'uniqueid':_0x57782c[_0xf5f2('0x43')]['id'],'UserId':{'$or':[null,_0x57782c['user']['id']]}}})[_0xf5f2('0x24')](handleEntityNotFound(_0x22b645,null))[_0xf5f2('0x24')](saveUpdates(_0x57782c[_0xf5f2('0x47')],null))[_0xf5f2('0x24')](respondWithResult(_0x22b645,null))[_0xf5f2('0x42')](handleError(_0x22b645,null));}; \ No newline at end of file +var _0xdb28=['options','includeAll','fullname','User','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge'];(function(_0x349cb3,_0x46a710){var _0x41aa37=function(_0x38d250){while(--_0x38d250){_0x349cb3['push'](_0x349cb3['shift']());}};_0x41aa37(++_0x46a710);}(_0xdb28,0x106));var _0x8db2=function(_0x28bab6,_0x56c6c2){_0x28bab6=_0x28bab6-0x0;var _0x555d01=_0xdb28[_0x28bab6];return _0x555d01;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'attributes':['id',_0x8db2('0x28'),_0x8db2('0x40'),'alias'],'model':db['User'],'as':_0x8db2('0x41')}];}return db['VoiceCallReport'][_0x8db2('0x42')](_0x21bae5);})[_0x8db2('0x24')](function(_0x313130){_0x3124d5[_0x8db2('0x43')]=_0x313130;return _0x3124d5;})[_0x8db2('0x24')](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x44')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x45')]=function(_0x5c97ef,_0x2f86b1){var _0x3d44de={'raw':!![],'where':{'id':_0x5c97ef[_0x8db2('0x46')]['id']}},_0x40c69e={};_0x40c69e['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x47')]);_0x40c69e[_0x8db2('0x30')]=_['keys'](_0x5c97ef[_0x8db2('0x30')]);_0x40c69e['filters']=_[_0x8db2('0x48')](_0x40c69e[_0x8db2('0x32')],_0x40c69e[_0x8db2('0x30')]);_0x3d44de['attributes']=_['intersection'](_0x40c69e[_0x8db2('0x32')],qs['fields'](_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x33')]));_0x3d44de[_0x8db2('0x34')]=_0x3d44de[_0x8db2('0x34')][_0x8db2('0x35')]?_0x3d44de[_0x8db2('0x34')]:_0x40c69e[_0x8db2('0x32')];if(_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x3d44de[_0x8db2('0x49')]=[{'all':!![]}];}_0x3d44de=_[_0x8db2('0x3d')]({},_0x3d44de,_0x5c97ef[_0x8db2('0x3e')]);return db['VoiceCallReport'][_0x8db2('0x4a')](_0x3d44de)[_0x8db2('0x24')](handleEntityNotFound(_0x2f86b1,null))[_0x8db2('0x24')](respondWithResult(_0x2f86b1,null))[_0x8db2('0x44')](handleError(_0x2f86b1,null));};exports['create']=function(_0x4ffd9d,_0x11c224){return db[_0x8db2('0x2b')][_0x8db2('0x4b')](_0x4ffd9d['body'],{})['then'](respondWithResult(_0x11c224,0xc9))['catch'](handleError(_0x11c224,null));};exports[_0x8db2('0x4c')]=function(_0x368c37,_0x55c7dd){return db[_0x8db2('0x2b')][_0x8db2('0x4a')]({'where':{'id':_0x368c37[_0x8db2('0x46')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x55c7dd,null))['then'](removeEntity(_0x55c7dd,null))['catch'](handleError(_0x55c7dd,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x2b')][_0x8db2('0x4d')]()[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x44')](handleError(_0x2908e4,null));};exports[_0x8db2('0x23')]=function(_0x4187d6,_0x426ae0){if(_0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')]){delete _0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')];}return db[_0x8db2('0x2b')]['find']({'where':{'uniqueid':_0x4187d6[_0x8db2('0x46')]['id'],'UserId':{'$or':[null,_0x4187d6[_0x8db2('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x426ae0,null))[_0x8db2('0x24')](saveUpdates(_0x4187d6[_0x8db2('0x4e')],null))[_0x8db2('0x24')](respondWithResult(_0x426ae0,null))['catch'](handleError(_0x426ae0,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index c0c15e9..01e5c00 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 _0xabe6=['lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','uniqueid'];(function(_0x460050,_0x47f8f4){var _0x274b0d=function(_0x3f4341){while(--_0x3f4341){_0x460050['push'](_0x460050['shift']());}};_0x274b0d(++_0x47f8f4);}(_0xabe6,0x84));var _0x6abe=function(_0x3bf8c1,_0x243384){_0x3bf8c1=_0x3bf8c1-0x0;var _0x105a82=_0xabe6[_0x3bf8c1];return _0x105a82;};'use strict';var _=require(_0x6abe('0x0'));var util=require(_0x6abe('0x1'));var logger=require(_0x6abe('0x2'))(_0x6abe('0x3'));var moment=require(_0x6abe('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6abe('0x5'));var config=require(_0x6abe('0x6'));var attributes=require(_0x6abe('0x7'));module[_0x6abe('0x8')]=function(_0x4c8755,_0x2f50b8){return _0x4c8755[_0x6abe('0x9')](_0x6abe('0xa'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x6abe('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xae95=['exports','VoiceCallReport','report_call','uniqueid','util','../../config/logger','api','request-promise','rimraf','./voiceCallReport.attributes'];(function(_0x270dba,_0x1817d2){var _0x36b83b=function(_0x15a276){while(--_0x15a276){_0x270dba['push'](_0x270dba['shift']());}};_0x36b83b(++_0x1817d2);}(_0xae95,0xcc));var _0x5ae9=function(_0x31570f,_0x13391c){_0x31570f=_0x31570f-0x0;var _0x2db385=_0xae95[_0x31570f];return _0x2db385;};'use strict';var _=require('lodash');var util=require(_0x5ae9('0x0'));var logger=require(_0x5ae9('0x1'))(_0x5ae9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5ae9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5ae9('0x4'));var config=require('../../config/environment');var attributes=require(_0x5ae9('0x5'));module[_0x5ae9('0x6')]=function(_0x438ee1,_0x2662d0){return _0x438ee1['define'](_0x5ae9('0x7'),attributes,{'tableName':_0x5ae9('0x8'),'paranoid':![],'indexes':[{'fields':[_0x5ae9('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index a309266..514ad31 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 _0x0f7c=['model','map','CreateVoiceCallReport','VoiceCallReport','create','body','update','where','UpdateVoiceCallReport','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','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','raw','attributes','limit','include'];(function(_0x35b47c,_0x4669a6){var _0x128d77=function(_0x291c7e){while(--_0x291c7e){_0x35b47c['push'](_0x35b47c['shift']());}};_0x128d77(++_0x4669a6);}(_0x0f7c,0x131));var _0xc0f7=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x0f7c[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xc0f7('0x0'));var util=require(_0xc0f7('0x1'));var moment=require(_0xc0f7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc0f7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc0f7('0x4'));var logger=require(_0xc0f7('0x5'))(_0xc0f7('0x6'));var config=require(_0xc0f7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc0f7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6904d2,_0x49df94,_0x403cd7){return new BPromise(function(_0xb716e7,_0x45e480){return client['request'](_0x6904d2,_0x403cd7)[_0xc0f7('0x9')](function(_0x1f968c){logger[_0xc0f7('0xa')](_0xc0f7('0xb'),_0x49df94,_0xc0f7('0xc'));logger[_0xc0f7('0xd')](_0xc0f7('0xe'),_0x49df94,_0xc0f7('0xc'),JSON[_0xc0f7('0xf')](_0x1f968c));if(_0x1f968c['error']){if(_0x1f968c[_0xc0f7('0x10')][_0xc0f7('0x11')]===0x1f4){logger[_0xc0f7('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x49df94,_0x1f968c[_0xc0f7('0x10')][_0xc0f7('0x12')]);return _0x45e480(_0x1f968c[_0xc0f7('0x10')][_0xc0f7('0x12')]);}logger['error'](_0xc0f7('0xb'),_0x49df94,_0x1f968c[_0xc0f7('0x10')][_0xc0f7('0x12')]);return _0xb716e7(_0x1f968c[_0xc0f7('0x10')][_0xc0f7('0x12')]);}else{logger[_0xc0f7('0xa')](_0xc0f7('0xb'),_0x49df94,_0xc0f7('0xc'));_0xb716e7(_0x1f968c[_0xc0f7('0x13')]['message']);}})[_0xc0f7('0x14')](function(_0x71dfde){logger[_0xc0f7('0x10')](_0xc0f7('0xb'),_0x49df94,_0x71dfde);_0x45e480(_0x71dfde);});});}exports[_0xc0f7('0x15')]=function(_0x1a2f2e){var _0xb0e806=this;return new Promise(function(_0x4aefb,_0x3ebc21){return db['VoiceCallReport'][_0xc0f7('0x16')]({'raw':_0x1a2f2e[_0xc0f7('0x17')]?_0x1a2f2e[_0xc0f7('0x17')][_0xc0f7('0x18')]===undefined?!![]:![]:!![],'where':_0x1a2f2e[_0xc0f7('0x17')]?_0x1a2f2e[_0xc0f7('0x17')]['where']||null:null,'attributes':_0x1a2f2e[_0xc0f7('0x17')]?_0x1a2f2e[_0xc0f7('0x17')][_0xc0f7('0x19')]||null:null,'limit':_0x1a2f2e[_0xc0f7('0x17')]?_0x1a2f2e[_0xc0f7('0x17')][_0xc0f7('0x1a')]||null:null,'include':_0x1a2f2e[_0xc0f7('0x17')]?_0x1a2f2e['options'][_0xc0f7('0x1b')]?_['map'](_0x1a2f2e[_0xc0f7('0x17')][_0xc0f7('0x1b')],function(_0x512570){return{'model':db[_0x512570[_0xc0f7('0x1c')]],'as':_0x512570['as'],'attributes':_0x512570[_0xc0f7('0x19')],'include':_0x512570[_0xc0f7('0x1b')]?_[_0xc0f7('0x1d')](_0x512570[_0xc0f7('0x1b')],function(_0x1dda71){return{'model':db[_0x1dda71[_0xc0f7('0x1c')]],'as':_0x1dda71['as'],'attributes':_0x1dda71[_0xc0f7('0x19')],'include':_0x1dda71['include']?_[_0xc0f7('0x1d')](_0x1dda71[_0xc0f7('0x1b')],function(_0xa02d9a){return{'model':db[_0xa02d9a['model']],'as':_0xa02d9a['as'],'attributes':_0xa02d9a[_0xc0f7('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc0f7('0x9')](function(_0x2598ae){logger[_0xc0f7('0xa')](_0xc0f7('0x15'),_0x1a2f2e);logger[_0xc0f7('0xd')](_0xc0f7('0x15'),_0x1a2f2e,JSON[_0xc0f7('0xf')](_0x2598ae));_0x4aefb(_0x2598ae);})[_0xc0f7('0x14')](function(_0x3bb17a){logger[_0xc0f7('0x10')]('GetVoiceCallReport',_0x3bb17a[_0xc0f7('0x12')],_0x1a2f2e);_0x3ebc21(_0xb0e806['error'](0x1f4,_0x3bb17a[_0xc0f7('0x12')]));});});};exports[_0xc0f7('0x1e')]=function(_0x2ecf7b){var _0x363186=this;return new Promise(function(_0x506d1f,_0x5c7746){return db[_0xc0f7('0x1f')][_0xc0f7('0x20')](_0x2ecf7b[_0xc0f7('0x21')],{'raw':_0x2ecf7b['options']?_0x2ecf7b[_0xc0f7('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xc0f7('0x9')](function(_0x27e052){logger[_0xc0f7('0xa')](_0xc0f7('0x1e'),_0x2ecf7b);logger['debug'](_0xc0f7('0x1e'),_0x2ecf7b,JSON[_0xc0f7('0xf')](_0x27e052));_0x506d1f(_0x27e052);})[_0xc0f7('0x14')](function(_0x1398a4){logger[_0xc0f7('0x10')](_0xc0f7('0x1e'),_0x1398a4[_0xc0f7('0x12')],_0x2ecf7b);_0x5c7746(_0x363186[_0xc0f7('0x10')](0x1f4,_0x1398a4[_0xc0f7('0x12')]));});});};exports['UpdateVoiceCallReport']=function(_0x58f233){var _0x63e92c=this;return new Promise(function(_0x448292,_0x19330f){return db[_0xc0f7('0x1f')][_0xc0f7('0x22')](_0x58f233[_0xc0f7('0x21')],{'raw':_0x58f233['options']?_0x58f233[_0xc0f7('0x17')][_0xc0f7('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58f233['options']?_0x58f233[_0xc0f7('0x17')][_0xc0f7('0x23')]||null:null,'attributes':_0x58f233[_0xc0f7('0x17')]?_0x58f233[_0xc0f7('0x17')]['attributes']||null:null,'limit':_0x58f233[_0xc0f7('0x17')]?_0x58f233[_0xc0f7('0x17')][_0xc0f7('0x1a')]||null:null})['then'](function(_0x3e5d65){logger[_0xc0f7('0xa')](_0xc0f7('0x24'),_0x58f233);logger['debug']('UpdateVoiceCallReport',_0x58f233,JSON[_0xc0f7('0xf')](_0x3e5d65));_0x448292(_0x3e5d65);})[_0xc0f7('0x14')](function(_0x6d5fb9){logger[_0xc0f7('0x10')](_0xc0f7('0x24'),_0x6d5fb9['message'],_0x58f233);_0x19330f(_0x63e92c[_0xc0f7('0x10')](0x1f4,_0x6d5fb9['message']));});});}; \ No newline at end of file +var _0x7540=['jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceCallReport','findAll','options','raw','where','attributes','limit','map','include','model','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','VoiceCallReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x174eb7,_0x199132){var _0x3b1e68=function(_0x2c8ac2){while(--_0x2c8ac2){_0x174eb7['push'](_0x174eb7['shift']());}};_0x3b1e68(++_0x199132);}(_0x7540,0x9a));var _0x0754=function(_0x5ca927,_0x38c385){_0x5ca927=_0x5ca927-0x0;var _0x1eb900=_0x7540[_0x5ca927];return _0x1eb900;};'use strict';var _=require(_0x0754('0x0'));var util=require(_0x0754('0x1'));var moment=require(_0x0754('0x2'));var BPromise=require(_0x0754('0x3'));var rs=require(_0x0754('0x4'));var fs=require('fs');var Redis=require(_0x0754('0x5'));var db=require(_0x0754('0x6'))['db'];var utils=require(_0x0754('0x7'));var logger=require(_0x0754('0x8'))('rpc');var config=require(_0x0754('0x9'));var jayson=require(_0x0754('0xa'));var client=jayson[_0x0754('0xb')][_0x0754('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2fadf0,_0x454e07,_0x516c4a){return new BPromise(function(_0x4d0ae8,_0xb9b4ad){return client[_0x0754('0xd')](_0x2fadf0,_0x516c4a)[_0x0754('0xe')](function(_0x28c643){logger[_0x0754('0xf')](_0x0754('0x10'),_0x454e07,'request\x20sent');logger[_0x0754('0x11')](_0x0754('0x12'),_0x454e07,_0x0754('0x13'),JSON[_0x0754('0x14')](_0x28c643));if(_0x28c643[_0x0754('0x15')]){if(_0x28c643[_0x0754('0x15')][_0x0754('0x16')]===0x1f4){logger[_0x0754('0x15')](_0x0754('0x10'),_0x454e07,_0x28c643['error'][_0x0754('0x17')]);return _0xb9b4ad(_0x28c643[_0x0754('0x15')]['message']);}logger[_0x0754('0x15')]('VoiceCallReport,\x20%s,\x20%s',_0x454e07,_0x28c643['error'][_0x0754('0x17')]);return _0x4d0ae8(_0x28c643[_0x0754('0x15')][_0x0754('0x17')]);}else{logger[_0x0754('0xf')](_0x0754('0x10'),_0x454e07,'request\x20sent');_0x4d0ae8(_0x28c643[_0x0754('0x18')][_0x0754('0x17')]);}})[_0x0754('0x19')](function(_0x29eb45){logger[_0x0754('0x15')](_0x0754('0x10'),_0x454e07,_0x29eb45);_0xb9b4ad(_0x29eb45);});});}exports[_0x0754('0x1a')]=function(_0x3804de){var _0x3330ba=this;return new Promise(function(_0x36fa00,_0x5af5e0){return db['VoiceCallReport'][_0x0754('0x1b')]({'raw':_0x3804de[_0x0754('0x1c')]?_0x3804de[_0x0754('0x1c')][_0x0754('0x1d')]===undefined?!![]:![]:!![],'where':_0x3804de[_0x0754('0x1c')]?_0x3804de[_0x0754('0x1c')][_0x0754('0x1e')]||null:null,'attributes':_0x3804de['options']?_0x3804de[_0x0754('0x1c')][_0x0754('0x1f')]||null:null,'limit':_0x3804de[_0x0754('0x1c')]?_0x3804de['options'][_0x0754('0x20')]||null:null,'include':_0x3804de[_0x0754('0x1c')]?_0x3804de['options']['include']?_[_0x0754('0x21')](_0x3804de[_0x0754('0x1c')][_0x0754('0x22')],function(_0x31f633){return{'model':db[_0x31f633[_0x0754('0x23')]],'as':_0x31f633['as'],'attributes':_0x31f633[_0x0754('0x1f')],'include':_0x31f633['include']?_[_0x0754('0x21')](_0x31f633['include'],function(_0x59a505){return{'model':db[_0x59a505[_0x0754('0x23')]],'as':_0x59a505['as'],'attributes':_0x59a505[_0x0754('0x1f')],'include':_0x59a505[_0x0754('0x22')]?_[_0x0754('0x21')](_0x59a505['include'],function(_0x42447c){return{'model':db[_0x42447c['model']],'as':_0x42447c['as'],'attributes':_0x42447c[_0x0754('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0754('0xe')](function(_0x2d94fd){logger['info'](_0x0754('0x1a'),_0x3804de);logger[_0x0754('0x11')](_0x0754('0x1a'),_0x3804de,JSON['stringify'](_0x2d94fd));_0x36fa00(_0x2d94fd);})[_0x0754('0x19')](function(_0x2137d2){logger[_0x0754('0x15')]('GetVoiceCallReport',_0x2137d2[_0x0754('0x17')],_0x3804de);_0x5af5e0(_0x3330ba[_0x0754('0x15')](0x1f4,_0x2137d2[_0x0754('0x17')]));});});};exports[_0x0754('0x24')]=function(_0x4ff619){var _0x5be1c9=this;return new Promise(function(_0x25aeab,_0x447010){return db['VoiceCallReport'][_0x0754('0x25')](_0x4ff619[_0x0754('0x26')],{'raw':_0x4ff619[_0x0754('0x1c')]?_0x4ff619[_0x0754('0x1c')][_0x0754('0x1d')]===undefined?!![]:![]:!![]})[_0x0754('0xe')](function(_0x12ed42){logger[_0x0754('0xf')](_0x0754('0x24'),_0x4ff619);logger[_0x0754('0x11')](_0x0754('0x24'),_0x4ff619,JSON[_0x0754('0x14')](_0x12ed42));_0x25aeab(_0x12ed42);})[_0x0754('0x19')](function(_0x52b302){logger[_0x0754('0x15')](_0x0754('0x24'),_0x52b302['message'],_0x4ff619);_0x447010(_0x5be1c9[_0x0754('0x15')](0x1f4,_0x52b302['message']));});});};exports[_0x0754('0x27')]=function(_0x1b7aed){var _0x599980=this;return new Promise(function(_0x5bc6da,_0x339c64){return db[_0x0754('0x28')]['update'](_0x1b7aed['body'],{'raw':_0x1b7aed[_0x0754('0x1c')]?_0x1b7aed[_0x0754('0x1c')][_0x0754('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7aed[_0x0754('0x1c')]?_0x1b7aed[_0x0754('0x1c')][_0x0754('0x1e')]||null:null,'attributes':_0x1b7aed[_0x0754('0x1c')]?_0x1b7aed[_0x0754('0x1c')]['attributes']||null:null,'limit':_0x1b7aed[_0x0754('0x1c')]?_0x1b7aed[_0x0754('0x1c')]['limit']||null:null})[_0x0754('0xe')](function(_0x1735b9){logger['info'](_0x0754('0x27'),_0x1b7aed);logger[_0x0754('0x11')](_0x0754('0x27'),_0x1b7aed,JSON[_0x0754('0x14')](_0x1735b9));_0x5bc6da(_0x1735b9);})['catch'](function(_0x34fb8f){logger[_0x0754('0x15')](_0x0754('0x27'),_0x34fb8f[_0x0754('0x17')],_0x1b7aed);_0x339c64(_0x599980['error'](0x1f4,_0x34fb8f[_0x0754('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 56d82e5..757efef 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 _0xc3ee=['post','create','/:id','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','show'];(function(_0x59d7f9,_0x411365){var _0x19f590=function(_0x4add39){while(--_0x4add39){_0x59d7f9['push'](_0x59d7f9['shift']());}};_0x19f590(++_0x411365);}(_0xc3ee,0xd1));var _0xec3e=function(_0x275c3f,_0x5e2069){_0x275c3f=_0x275c3f-0x0;var _0x2df932=_0xc3ee[_0x275c3f];return _0x2df932;};'use strict';var multer=require(_0xec3e('0x0'));var util=require('util');var path=require(_0xec3e('0x1'));var timeout=require(_0xec3e('0x2'));var express=require('express');var router=express[_0xec3e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xec3e('0x4'));var interaction=require(_0xec3e('0x5'));var config=require(_0xec3e('0x6'));var controller=require(_0xec3e('0x7'));router[_0xec3e('0x8')]('/',auth[_0xec3e('0x9')](),controller[_0xec3e('0xa')]);router[_0xec3e('0x8')]('/:id',auth[_0xec3e('0x9')](),controller[_0xec3e('0xb')]);router[_0xec3e('0xc')]('/',auth[_0xec3e('0x9')](),controller[_0xec3e('0xd')]);router['put'](_0xec3e('0xe'),auth[_0xec3e('0x9')](),controller['update']);router['delete']('/:id',auth[_0xec3e('0x9')](),controller[_0xec3e('0xf')]);module[_0xec3e('0x10')]=router; \ No newline at end of file +var _0x1208=['put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','/:id','isAuthenticated','show','post','create'];(function(_0x3e8b50,_0x406a20){var _0x4a8da8=function(_0x347172){while(--_0x347172){_0x3e8b50['push'](_0x3e8b50['shift']());}};_0x4a8da8(++_0x406a20);}(_0x1208,0xaf));var _0x8120=function(_0x1da39a,_0x48d074){_0x1da39a=_0x1da39a-0x0;var _0x2fbb1f=_0x1208[_0x1da39a];return _0x2fbb1f;};'use strict';var multer=require(_0x8120('0x0'));var util=require(_0x8120('0x1'));var path=require(_0x8120('0x2'));var timeout=require(_0x8120('0x3'));var express=require('express');var router=express[_0x8120('0x4')]();var fs_extra=require(_0x8120('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8120('0x6'));var config=require(_0x8120('0x7'));var controller=require(_0x8120('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8120('0x9')](_0x8120('0xa'),auth[_0x8120('0xb')](),controller[_0x8120('0xc')]);router[_0x8120('0xd')]('/',auth[_0x8120('0xb')](),controller[_0x8120('0xe')]);router[_0x8120('0xf')]('/:id',auth[_0x8120('0xb')](),controller[_0x8120('0x10')]);router[_0x8120('0x11')](_0x8120('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x8120('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 940962d..07df6f8 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 _0xe8db=['getDataValue','split','BOOLEAN','sequelize','exports','STRING','setDataValue','options','join'];(function(_0x3b2044,_0x10a5a6){var _0x484ab8=function(_0x371f7e){while(--_0x371f7e){_0x3b2044['push'](_0x3b2044['shift']());}};_0x484ab8(++_0x10a5a6);}(_0xe8db,0x1c5));var _0xbe8d=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0xe8db[_0x580647];return _0x5f0792;};'use strict';var Sequelize=require(_0xbe8d('0x0'));module[_0xbe8d('0x1')]={'name':{'type':Sequelize[_0xbe8d('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xbe8d('0x2')],'set':function(_0x45a428){this[_0xbe8d('0x3')](_0xbe8d('0x4'),_0x45a428?_0x45a428[_0xbe8d('0x5')](''):[]);},'get':function(){return this[_0xbe8d('0x6')](_0xbe8d('0x4'))?this[_0xbe8d('0x6')](_0xbe8d('0x4'))[_0xbe8d('0x7')](''):[];}},'auth':{'type':Sequelize[_0xbe8d('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xbe8d('0x2')]},'description':{'type':Sequelize[_0xbe8d('0x2')]}}; \ No newline at end of file +var _0x0cc9=['name','options','getDataValue','STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0cc9,0x166));var _0x90cc=function(_0x2b0875,_0x21ff12){_0x2b0875=_0x2b0875-0x0;var _0xedb8d7=_0x0cc9[_0x2b0875];return _0xedb8d7;};'use strict';var Sequelize=require(_0x90cc('0x0'));module[_0x90cc('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0x90cc('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x5f258b){this['setDataValue'](_0x90cc('0x3'),_0x5f258b?_0x5f258b['join'](''):[]);},'get':function(){return this['getDataValue'](_0x90cc('0x3'))?this[_0x90cc('0x4')](_0x90cc('0x3'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x90cc('0x5')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 17d9abc..9ce74f4 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 _0x13c0=['reject','then','destroy','ChanSpies','UserProfileResource','stack','name','send','index','map','VoiceChanSpy','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','findAll','rows','catch','show','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json'];(function(_0xfb557c,_0x126b35){var _0x4c066f=function(_0xaf3e66){while(--_0xaf3e66){_0xfb557c['push'](_0xfb557c['shift']());}};_0x4c066f(++_0x126b35);}(_0x13c0,0x79));var _0x013c=function(_0x3e2480,_0x2eed70){_0x3e2480=_0x3e2480-0x0;var _0x652c0=_0x13c0[_0x3e2480];return _0x652c0;};'use strict';var emlformat=require(_0x013c('0x0'));var rimraf=require(_0x013c('0x1'));var zipdir=require(_0x013c('0x2'));var jsonpatch=require(_0x013c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x013c('0x4'));var util=require(_0x013c('0x5'));var path=require(_0x013c('0x6'));var sox=require(_0x013c('0x7'));var csv=require(_0x013c('0x8'));var ejs=require(_0x013c('0x9'));var fs=require('fs');var fs_extra=require(_0x013c('0xa'));var _=require(_0x013c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x013c('0xc'));var toCsv=require(_0x013c('0x8'));var querystring=require('querystring');var Papa=require(_0x013c('0xd'));var Redis=require(_0x013c('0xe'));var authService=require(_0x013c('0xf'));var qs=require(_0x013c('0x10'));var as=require(_0x013c('0x11'));var hardwareService=require(_0x013c('0x12'));var logger=require(_0x013c('0x13'))(_0x013c('0x14'));var utils=require(_0x013c('0x15'));var config=require(_0x013c('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xce456f,_0x4631c5){_0x4631c5=_0x4631c5||0xcc;return function(_0x1ee348){if(_0x1ee348){return _0xce456f[_0x013c('0x17')](_0x4631c5);}return _0xce456f['status'](_0x4631c5)[_0x013c('0x18')]();};}function respondWithResult(_0x2313de,_0xcfe81a){_0xcfe81a=_0xcfe81a||0xc8;return function(_0x17b085){if(_0x17b085){return _0x2313de[_0x013c('0x19')](_0xcfe81a)['json'](_0x17b085);}};}function respondWithFilteredResult(_0x307f34,_0x1c2e11){return function(_0x84244){if(_0x84244){var _0x92c3ca=typeof _0x1c2e11[_0x013c('0x1a')]===_0x013c('0x1b')&&typeof _0x1c2e11[_0x013c('0x1c')]===_0x013c('0x1b');var _0x246f11=_0x84244[_0x013c('0x1d')];var _0x34d59f=_0x92c3ca?0x0:_0x1c2e11[_0x013c('0x1a')];var _0x25eb26=_0x92c3ca?_0x84244['count']:_0x1c2e11['offset']+_0x1c2e11[_0x013c('0x1c')];var _0x153b0a;if(_0x25eb26>=_0x246f11){_0x25eb26=_0x246f11;_0x153b0a=0xc8;}else{_0x153b0a=0xce;}_0x307f34['status'](_0x153b0a);return _0x307f34[_0x013c('0x1e')](_0x013c('0x1f'),_0x34d59f+'-'+_0x25eb26+'/'+_0x246f11)[_0x013c('0x20')](_0x84244);}return null;};}function patchUpdates(_0x38bac2){return function(_0xb87452){try{jsonpatch['apply'](_0xb87452,_0x38bac2,!![]);}catch(_0xb039bc){return BPromise[_0x013c('0x21')](_0xb039bc);}return _0xb87452['save']();};}function saveUpdates(_0x1df9d2,_0x82f9f1){return function(_0x53fbbd){if(_0x53fbbd){return _0x53fbbd['update'](_0x1df9d2)[_0x013c('0x22')](function(_0x1996e6){return _0x1996e6;});}return null;};}function removeEntity(_0x2509f4,_0x447c0b){return function(_0x20aff2){if(_0x20aff2){return _0x20aff2[_0x013c('0x23')]()[_0x013c('0x22')](function(){var _0x1b9bdc=_0x20aff2['get']({'plain':!![]});var _0x468fe7=_0x013c('0x24');return db[_0x013c('0x25')][_0x013c('0x23')]({'where':{'type':_0x468fe7,'resourceId':_0x1b9bdc['id']}})[_0x013c('0x22')](function(){return _0x20aff2;});})[_0x013c('0x22')](function(){_0x2509f4['status'](0xcc)[_0x013c('0x18')]();});}};}function handleEntityNotFound(_0xd85349,_0x21c86e){return function(_0x5f251b){if(!_0x5f251b){_0xd85349[_0x013c('0x17')](0x194);}return _0x5f251b;};}function handleError(_0x4f062f,_0x395081){_0x395081=_0x395081||0x1f4;return function(_0x455b88){logger['error'](_0x455b88[_0x013c('0x26')]);if(_0x455b88[_0x013c('0x27')]){delete _0x455b88[_0x013c('0x27')];}_0x4f062f[_0x013c('0x19')](_0x395081)[_0x013c('0x28')](_0x455b88);};}exports[_0x013c('0x29')]=function(_0x12ba2a,_0x1f0aab){var _0xba783b={},_0x441898={},_0x556bdc={'count':0x0,'rows':[]};var _0x315cd8=_[_0x013c('0x2a')](db[_0x013c('0x2b')][_0x013c('0x2c')],function(_0x330ccf){return{'name':_0x330ccf['fieldName'],'type':_0x330ccf[_0x013c('0x2d')][_0x013c('0x2e')]};});_0x441898[_0x013c('0x2f')]=_[_0x013c('0x2a')](_0x315cd8,'name');_0x441898['query']=_['keys'](_0x12ba2a[_0x013c('0x30')]);_0x441898[_0x013c('0x31')]=_[_0x013c('0x32')](_0x441898[_0x013c('0x2f')],_0x441898[_0x013c('0x30')]);_0xba783b[_0x013c('0x33')]=_[_0x013c('0x32')](_0x441898[_0x013c('0x2f')],qs[_0x013c('0x34')](_0x12ba2a[_0x013c('0x30')][_0x013c('0x34')]));_0xba783b[_0x013c('0x33')]=_0xba783b['attributes']['length']?_0xba783b[_0x013c('0x33')]:_0x441898[_0x013c('0x2f')];if(!_0x12ba2a[_0x013c('0x30')][_0x013c('0x35')]('nolimit')){_0xba783b[_0x013c('0x1c')]=qs[_0x013c('0x1c')](_0x12ba2a[_0x013c('0x30')][_0x013c('0x1c')]);_0xba783b['offset']=qs[_0x013c('0x1a')](_0x12ba2a[_0x013c('0x30')]['offset']);}_0xba783b[_0x013c('0x36')]=qs['sort'](_0x12ba2a[_0x013c('0x30')][_0x013c('0x37')]);_0xba783b[_0x013c('0x38')]=qs[_0x013c('0x31')](_['pick'](_0x12ba2a[_0x013c('0x30')],_0x441898[_0x013c('0x31')]),_0x315cd8);if(_0x12ba2a[_0x013c('0x30')][_0x013c('0x39')]){_0xba783b[_0x013c('0x38')]=_[_0x013c('0x3a')](_0xba783b[_0x013c('0x38')],{'$or':_[_0x013c('0x2a')](_0x315cd8,function(_0x3de22f){if(_0x3de22f['type']!==_0x013c('0x3b')){var _0x3e5e50={};_0x3e5e50[_0x3de22f['name']]={'$like':'%'+_0x12ba2a[_0x013c('0x30')][_0x013c('0x39')]+'%'};return _0x3e5e50;}})});}_0xba783b=_['merge']({},_0xba783b,_0x12ba2a[_0x013c('0x3c')]);var _0x3384da={'where':_0xba783b[_0x013c('0x38')]};return db[_0x013c('0x2b')][_0x013c('0x1d')](_0x3384da)['then'](function(_0x3d0ffd){_0x556bdc['count']=_0x3d0ffd;if(_0x12ba2a['query']['includeAll']){_0xba783b['include']=[{'all':!![]}];}return db[_0x013c('0x2b')][_0x013c('0x3d')](_0xba783b);})[_0x013c('0x22')](function(_0x49db0c){_0x556bdc[_0x013c('0x3e')]=_0x49db0c;return _0x556bdc;})[_0x013c('0x22')](respondWithFilteredResult(_0x1f0aab,_0xba783b))[_0x013c('0x3f')](handleError(_0x1f0aab,null));};exports[_0x013c('0x40')]=function(_0x926ca5,_0x491b30){var _0x465c24={'raw':![],'where':{'id':_0x926ca5['params']['id']}},_0x3bfcd4={};_0x3bfcd4['model']=_['keys'](db['VoiceChanSpy'][_0x013c('0x2c')]);_0x3bfcd4[_0x013c('0x30')]=_['keys'](_0x926ca5[_0x013c('0x30')]);_0x3bfcd4[_0x013c('0x31')]=_['intersection'](_0x3bfcd4[_0x013c('0x2f')],_0x3bfcd4[_0x013c('0x30')]);_0x465c24[_0x013c('0x33')]=_[_0x013c('0x32')](_0x3bfcd4[_0x013c('0x2f')],qs[_0x013c('0x34')](_0x926ca5[_0x013c('0x30')][_0x013c('0x34')]));_0x465c24['attributes']=_0x465c24[_0x013c('0x33')]['length']?_0x465c24[_0x013c('0x33')]:_0x3bfcd4['model'];if(_0x926ca5['query'][_0x013c('0x41')]){_0x465c24['include']=[{'all':!![]}];}_0x465c24=_[_0x013c('0x3a')]({},_0x465c24,_0x926ca5[_0x013c('0x3c')]);return db[_0x013c('0x2b')][_0x013c('0x42')](_0x465c24)['then'](handleEntityNotFound(_0x491b30,null))['then'](respondWithResult(_0x491b30,null))['catch'](handleError(_0x491b30,null));};exports['create']=function(_0x7f4350,_0x5daeda){return db[_0x013c('0x2b')][_0x013c('0x43')](_0x7f4350[_0x013c('0x44')],{})[_0x013c('0x22')](function(_0x104a68){var _0x2e99db=_0x7f4350[_0x013c('0x45')][_0x013c('0x46')]({'plain':!![]});if(!_0x2e99db)throw new Error(_0x013c('0x47'));if(_0x2e99db['role']===_0x013c('0x45')){var _0x5163d8=_0x104a68['get']({'plain':!![]});var _0x12236a='ChanSpies';return db['UserProfileSection'][_0x013c('0x42')]({'where':{'name':_0x12236a,'userProfileId':_0x2e99db[_0x013c('0x48')]},'raw':!![]})['then'](function(_0x435f8e){if(_0x435f8e&&_0x435f8e[_0x013c('0x49')]===0x0){return db[_0x013c('0x25')]['create']({'name':_0x5163d8[_0x013c('0x27')],'resourceId':_0x5163d8['id'],'type':_0x435f8e[_0x013c('0x27')],'sectionId':_0x435f8e['id']},{})[_0x013c('0x22')](function(){return _0x104a68;});}else{return _0x104a68;}})[_0x013c('0x3f')](function(_0x2a64a1){logger['error'](_0x013c('0x4a'),_0x2a64a1);throw _0x2a64a1;});}return _0x104a68;})[_0x013c('0x22')](respondWithResult(_0x5daeda,0xc9))[_0x013c('0x3f')](handleError(_0x5daeda,null));};exports[_0x013c('0x4b')]=function(_0x4a8968,_0x27f877){if(_0x4a8968[_0x013c('0x44')]['id']){delete _0x4a8968[_0x013c('0x44')]['id'];}return db[_0x013c('0x2b')][_0x013c('0x42')]({'where':{'id':_0x4a8968[_0x013c('0x4c')]['id']}})[_0x013c('0x22')](handleEntityNotFound(_0x27f877,null))[_0x013c('0x22')](saveUpdates(_0x4a8968[_0x013c('0x44')],null))['then'](respondWithResult(_0x27f877,null))[_0x013c('0x3f')](handleError(_0x27f877,null));};exports[_0x013c('0x23')]=function(_0x5c8cc9,_0x55bf4a){return db[_0x013c('0x2b')]['find']({'where':{'id':_0x5c8cc9[_0x013c('0x4c')]['id']}})[_0x013c('0x22')](handleEntityNotFound(_0x55bf4a,null))[_0x013c('0x22')](removeEntity(_0x55bf4a,null))[_0x013c('0x3f')](handleError(_0x55bf4a,null));}; \ No newline at end of file +var _0x4d6e=['send','index','map','VoiceChanSpy','rawAttributes','fieldName','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','filter','options','includeAll','include','findAll','catch','show','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','error','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','save','update','then','destroy','get','ChanSpies','UserProfileResource','name'];(function(_0x6d4350,_0x1b4e0c){var _0x4be457=function(_0x41f34a){while(--_0x41f34a){_0x6d4350['push'](_0x6d4350['shift']());}};_0x4be457(++_0x1b4e0c);}(_0x4d6e,0x77));var _0xe4d6=function(_0x27b9a7,_0x215ec2){_0x27b9a7=_0x27b9a7-0x0;var _0x3c38dd=_0x4d6e[_0x27b9a7];return _0x3c38dd;};'use strict';var emlformat=require(_0xe4d6('0x0'));var rimraf=require(_0xe4d6('0x1'));var zipdir=require(_0xe4d6('0x2'));var jsonpatch=require(_0xe4d6('0x3'));var rp=require(_0xe4d6('0x4'));var moment=require('moment');var BPromise=require(_0xe4d6('0x5'));var Mustache=require(_0xe4d6('0x6'));var util=require(_0xe4d6('0x7'));var path=require(_0xe4d6('0x8'));var sox=require(_0xe4d6('0x9'));var csv=require(_0xe4d6('0xa'));var ejs=require(_0xe4d6('0xb'));var fs=require('fs');var fs_extra=require(_0xe4d6('0xc'));var _=require(_0xe4d6('0xd'));var squel=require(_0xe4d6('0xe'));var crypto=require(_0xe4d6('0xf'));var jsforce=require(_0xe4d6('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe4d6('0xa'));var querystring=require(_0xe4d6('0x11'));var Papa=require('papaparse');var Redis=require(_0xe4d6('0x12'));var authService=require(_0xe4d6('0x13'));var qs=require(_0xe4d6('0x14'));var as=require(_0xe4d6('0x15'));var hardwareService=require(_0xe4d6('0x16'));var logger=require(_0xe4d6('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xe4d6('0x18'));var licenseUtil=require(_0xe4d6('0x19'));var db=require(_0xe4d6('0x1a'))['db'];function respondWithStatusCode(_0x5a14e5,_0x1a80eb){_0x1a80eb=_0x1a80eb||0xcc;return function(_0x3f7441){if(_0x3f7441){return _0x5a14e5['sendStatus'](_0x1a80eb);}return _0x5a14e5[_0xe4d6('0x1b')](_0x1a80eb)[_0xe4d6('0x1c')]();};}function respondWithResult(_0x5dbcc5,_0xdc7f40){_0xdc7f40=_0xdc7f40||0xc8;return function(_0x780caa){if(_0x780caa){return _0x5dbcc5[_0xe4d6('0x1b')](_0xdc7f40)[_0xe4d6('0x1d')](_0x780caa);}};}function respondWithFilteredResult(_0x53ca26,_0x2e04a9){return function(_0x28e001){if(_0x28e001){var _0x3dbe31=typeof _0x2e04a9[_0xe4d6('0x1e')]==='undefined'&&typeof _0x2e04a9[_0xe4d6('0x1f')]==='undefined';var _0x526dd6=_0x28e001[_0xe4d6('0x20')];var _0x351a17=_0x3dbe31?0x0:_0x2e04a9[_0xe4d6('0x1e')];var _0x1928f9=_0x3dbe31?_0x28e001[_0xe4d6('0x20')]:_0x2e04a9['offset']+_0x2e04a9[_0xe4d6('0x1f')];var _0x42b261;if(_0x1928f9>=_0x526dd6){_0x1928f9=_0x526dd6;_0x42b261=0xc8;}else{_0x42b261=0xce;}_0x53ca26[_0xe4d6('0x1b')](_0x42b261);return _0x53ca26[_0xe4d6('0x21')](_0xe4d6('0x22'),_0x351a17+'-'+_0x1928f9+'/'+_0x526dd6)[_0xe4d6('0x1d')](_0x28e001);}return null;};}function patchUpdates(_0x26b9b6){return function(_0x27e824){try{jsonpatch['apply'](_0x27e824,_0x26b9b6,!![]);}catch(_0x1afb27){return BPromise['reject'](_0x1afb27);}return _0x27e824[_0xe4d6('0x23')]();};}function saveUpdates(_0x34e7ca,_0x31f569){return function(_0x162b57){if(_0x162b57){return _0x162b57[_0xe4d6('0x24')](_0x34e7ca)[_0xe4d6('0x25')](function(_0x455011){return _0x455011;});}return null;};}function removeEntity(_0x202f67,_0x59233f){return function(_0x404fe1){if(_0x404fe1){return _0x404fe1[_0xe4d6('0x26')]()['then'](function(){var _0xb869f=_0x404fe1[_0xe4d6('0x27')]({'plain':!![]});var _0x2807e7=_0xe4d6('0x28');return db[_0xe4d6('0x29')][_0xe4d6('0x26')]({'where':{'type':_0x2807e7,'resourceId':_0xb869f['id']}})[_0xe4d6('0x25')](function(){return _0x404fe1;});})[_0xe4d6('0x25')](function(){_0x202f67['status'](0xcc)[_0xe4d6('0x1c')]();});}};}function handleEntityNotFound(_0x152d16,_0x4daadb){return function(_0x4ccf6b){if(!_0x4ccf6b){_0x152d16['sendStatus'](0x194);}return _0x4ccf6b;};}function handleError(_0x2b732e,_0x4a7e63){_0x4a7e63=_0x4a7e63||0x1f4;return function(_0x3d2efe){logger['error'](_0x3d2efe['stack']);if(_0x3d2efe[_0xe4d6('0x2a')]){delete _0x3d2efe['name'];}_0x2b732e['status'](_0x4a7e63)[_0xe4d6('0x2b')](_0x3d2efe);};}exports[_0xe4d6('0x2c')]=function(_0x5a0859,_0x580d44){var _0x3fd34f={},_0x4077c1={},_0x4db1fb={'count':0x0,'rows':[]};var _0xc58fcb=_[_0xe4d6('0x2d')](db[_0xe4d6('0x2e')][_0xe4d6('0x2f')],function(_0x279961){return{'name':_0x279961[_0xe4d6('0x30')],'type':_0x279961['type']['key']};});_0x4077c1[_0xe4d6('0x31')]=_[_0xe4d6('0x2d')](_0xc58fcb,'name');_0x4077c1[_0xe4d6('0x32')]=_['keys'](_0x5a0859[_0xe4d6('0x32')]);_0x4077c1['filters']=_['intersection'](_0x4077c1[_0xe4d6('0x31')],_0x4077c1['query']);_0x3fd34f['attributes']=_[_0xe4d6('0x33')](_0x4077c1[_0xe4d6('0x31')],qs[_0xe4d6('0x34')](_0x5a0859[_0xe4d6('0x32')]['fields']));_0x3fd34f[_0xe4d6('0x35')]=_0x3fd34f[_0xe4d6('0x35')][_0xe4d6('0x36')]?_0x3fd34f[_0xe4d6('0x35')]:_0x4077c1[_0xe4d6('0x31')];if(!_0x5a0859[_0xe4d6('0x32')][_0xe4d6('0x37')](_0xe4d6('0x38'))){_0x3fd34f[_0xe4d6('0x1f')]=qs[_0xe4d6('0x1f')](_0x5a0859['query'][_0xe4d6('0x1f')]);_0x3fd34f['offset']=qs[_0xe4d6('0x1e')](_0x5a0859[_0xe4d6('0x32')][_0xe4d6('0x1e')]);}_0x3fd34f[_0xe4d6('0x39')]=qs['sort'](_0x5a0859['query'][_0xe4d6('0x3a')]);_0x3fd34f[_0xe4d6('0x3b')]=qs[_0xe4d6('0x3c')](_[_0xe4d6('0x3d')](_0x5a0859[_0xe4d6('0x32')],_0x4077c1[_0xe4d6('0x3c')]),_0xc58fcb);if(_0x5a0859[_0xe4d6('0x32')]['filter']){_0x3fd34f[_0xe4d6('0x3b')]=_[_0xe4d6('0x3e')](_0x3fd34f['where'],{'$or':_['map'](_0xc58fcb,function(_0x4662c7){if(_0x4662c7[_0xe4d6('0x3f')]!=='VIRTUAL'){var _0x1a577f={};_0x1a577f[_0x4662c7[_0xe4d6('0x2a')]]={'$like':'%'+_0x5a0859[_0xe4d6('0x32')][_0xe4d6('0x40')]+'%'};return _0x1a577f;}})});}_0x3fd34f=_['merge']({},_0x3fd34f,_0x5a0859[_0xe4d6('0x41')]);var _0x222771={'where':_0x3fd34f[_0xe4d6('0x3b')]};return db[_0xe4d6('0x2e')][_0xe4d6('0x20')](_0x222771)[_0xe4d6('0x25')](function(_0x5a32c0){_0x4db1fb['count']=_0x5a32c0;if(_0x5a0859['query'][_0xe4d6('0x42')]){_0x3fd34f[_0xe4d6('0x43')]=[{'all':!![]}];}return db[_0xe4d6('0x2e')][_0xe4d6('0x44')](_0x3fd34f);})['then'](function(_0x3d2516){_0x4db1fb['rows']=_0x3d2516;return _0x4db1fb;})['then'](respondWithFilteredResult(_0x580d44,_0x3fd34f))[_0xe4d6('0x45')](handleError(_0x580d44,null));};exports[_0xe4d6('0x46')]=function(_0x1f3c05,_0x29b3b2){var _0x373bfa={'raw':![],'where':{'id':_0x1f3c05['params']['id']}},_0x978b7c={};_0x978b7c[_0xe4d6('0x31')]=_[_0xe4d6('0x47')](db[_0xe4d6('0x2e')][_0xe4d6('0x2f')]);_0x978b7c[_0xe4d6('0x32')]=_[_0xe4d6('0x47')](_0x1f3c05[_0xe4d6('0x32')]);_0x978b7c[_0xe4d6('0x3c')]=_['intersection'](_0x978b7c[_0xe4d6('0x31')],_0x978b7c[_0xe4d6('0x32')]);_0x373bfa[_0xe4d6('0x35')]=_['intersection'](_0x978b7c['model'],qs[_0xe4d6('0x34')](_0x1f3c05[_0xe4d6('0x32')][_0xe4d6('0x34')]));_0x373bfa[_0xe4d6('0x35')]=_0x373bfa[_0xe4d6('0x35')][_0xe4d6('0x36')]?_0x373bfa[_0xe4d6('0x35')]:_0x978b7c[_0xe4d6('0x31')];if(_0x1f3c05[_0xe4d6('0x32')][_0xe4d6('0x42')]){_0x373bfa[_0xe4d6('0x43')]=[{'all':!![]}];}_0x373bfa=_[_0xe4d6('0x3e')]({},_0x373bfa,_0x1f3c05[_0xe4d6('0x41')]);return db[_0xe4d6('0x2e')][_0xe4d6('0x48')](_0x373bfa)[_0xe4d6('0x25')](handleEntityNotFound(_0x29b3b2,null))['then'](respondWithResult(_0x29b3b2,null))[_0xe4d6('0x45')](handleError(_0x29b3b2,null));};exports[_0xe4d6('0x49')]=function(_0x546a80,_0x2bea52){return db['VoiceChanSpy'][_0xe4d6('0x49')](_0x546a80[_0xe4d6('0x4a')],{})['then'](function(_0x6c991){var _0x48bcdc=_0x546a80['user'][_0xe4d6('0x27')]({'plain':!![]});if(!_0x48bcdc)throw new Error(_0xe4d6('0x4b'));if(_0x48bcdc['role']===_0xe4d6('0x4c')){var _0x338cda=_0x6c991[_0xe4d6('0x27')]({'plain':!![]});var _0x278c96=_0xe4d6('0x28');return db['UserProfileSection'][_0xe4d6('0x48')]({'where':{'name':_0x278c96,'userProfileId':_0x48bcdc[_0xe4d6('0x4d')]},'raw':!![]})['then'](function(_0x57c178){if(_0x57c178&&_0x57c178[_0xe4d6('0x4e')]===0x0){return db[_0xe4d6('0x29')][_0xe4d6('0x49')]({'name':_0x338cda['name'],'resourceId':_0x338cda['id'],'type':_0x57c178[_0xe4d6('0x2a')],'sectionId':_0x57c178['id']},{})[_0xe4d6('0x25')](function(){return _0x6c991;});}else{return _0x6c991;}})[_0xe4d6('0x45')](function(_0x427575){logger[_0xe4d6('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x427575);throw _0x427575;});}return _0x6c991;})[_0xe4d6('0x25')](respondWithResult(_0x2bea52,0xc9))[_0xe4d6('0x45')](handleError(_0x2bea52,null));};exports[_0xe4d6('0x24')]=function(_0x1b22c2,_0x38a427){if(_0x1b22c2['body']['id']){delete _0x1b22c2[_0xe4d6('0x4a')]['id'];}return db[_0xe4d6('0x2e')][_0xe4d6('0x48')]({'where':{'id':_0x1b22c2[_0xe4d6('0x50')]['id']}})[_0xe4d6('0x25')](handleEntityNotFound(_0x38a427,null))[_0xe4d6('0x25')](saveUpdates(_0x1b22c2['body'],null))[_0xe4d6('0x25')](respondWithResult(_0x38a427,null))[_0xe4d6('0x45')](handleError(_0x38a427,null));};exports[_0xe4d6('0x26')]=function(_0x146790,_0x295d37){return db[_0xe4d6('0x2e')][_0xe4d6('0x48')]({'where':{'id':_0x146790[_0xe4d6('0x50')]['id']}})[_0xe4d6('0x25')](handleEntityNotFound(_0x295d37,null))[_0xe4d6('0x25')](removeEntity(_0x295d37,null))[_0xe4d6('0x45')](handleError(_0x295d37,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 4b9e660..7f9c5a7 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 _0x6597=['User','agent','catch','exports','models','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate','destroy','lodash','util','./voiceChanSpy.attributes','context','from-sip','format','%s%s','system','push','Set','chanspy','record','MixMonitor','recordingFormat','auth','merge','Authenticate','password','ChanSpy','options','join','StopMixMonitor','length','concat','internal','name'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x6597,0x1a2));var _0x7659=function(_0x1106fd,_0x3f60f3){_0x1106fd=_0x1106fd-0x0;var _0x1975fb=_0x6597[_0x1106fd];return _0x1975fb;};'use strict';var _=require(_0x7659('0x0'));var util=require(_0x7659('0x1'));var BPromise=require('bluebird');var attributes=require(_0x7659('0x2'));var getUserApplications=function(_0x43525a,_0x4e038e,_0x515926){var _0x99d2ba=0x1;var _0x450f50=[];var _0x389d47={'context':_0x4e038e[_0x7659('0x3')]||_0x7659('0x4'),'exten':util[_0x7659('0x5')](_0x7659('0x6'),_0x43525a['prefix'],_0x515926),'type':_0x7659('0x7'),'isApp':![],'ChanSpyId':_0x43525a['id'],'UserId':_0x4e038e['id']};_0x450f50[_0x7659('0x8')](_['merge']({'app':_0x7659('0x9'),'appdata':util[_0x7659('0x5')]('CDR(type)=%s',_0x7659('0xa')),'priority':_0x99d2ba++},_0x389d47));if(_0x43525a[_0x7659('0xb')]){_0x450f50[_0x7659('0x8')](_['merge']({'app':_0x7659('0xc'),'appdata':util['format']('${UNIQUEID}.%s,a',_0x43525a[_0x7659('0xd')]),'priority':_0x99d2ba++},_0x389d47));}if(_0x43525a[_0x7659('0xe')]){_0x450f50[_0x7659('0x8')](_[_0x7659('0xf')]({'app':_0x7659('0x10'),'appdata':_0x43525a[_0x7659('0x11')],'priority':_0x99d2ba++},_0x389d47));}_0x450f50[_0x7659('0x8')](_[_0x7659('0xf')]({'app':_0x7659('0x12'),'appdata':util[_0x7659('0x5')]('SIP/%s,%s',_0x4e038e['name'],_0x43525a[_0x7659('0x13')]?_0x43525a[_0x7659('0x13')][_0x7659('0x14')](''):''),'priority':_0x99d2ba++},_0x389d47));if(_0x43525a[_0x7659('0xb')]){_0x450f50[_0x7659('0x8')](_[_0x7659('0xf')]({'app':_0x7659('0x15'),'priority':_0x99d2ba++},_0x389d47));}return _0x450f50;};var getChanSpyApplications=function(_0x5005b0,_0x6140e8){var _0x506f61=[];for(var _0x2f60fc=0x0,_0x181b69=0x1;_0x2f60fc<_0x6140e8[_0x7659('0x16')];_0x2f60fc++,_0x181b69=0x1){_0x506f61=_0x506f61[_0x7659('0x17')](getUserApplications(_0x5005b0,_0x6140e8[_0x2f60fc],_0x6140e8[_0x2f60fc][_0x7659('0x18')]));if(_0x6140e8[_0x2f60fc][_0x7659('0x18')]!=_0x6140e8[_0x2f60fc][_0x7659('0x19')]){_0x506f61=_0x506f61['concat'](getUserApplications(_0x5005b0,_0x6140e8[_0x2f60fc],_0x6140e8[_0x2f60fc][_0x7659('0x19')]));}}return _0x506f61;};var getChanSpyPromise=function(_0x2d50c2,_0x3e5327){return new BPromise(function(_0x11a399,_0x37166d){return _0x2d50c2[_0x7659('0x1a')]['findAll']({'attributes':['id',_0x7659('0x19'),_0x7659('0x18')],'where':{'role':_0x7659('0x1b'),'chanspy':!![]},'raw':!![]})['then'](function(_0x3db4ed){if(_0x3db4ed){return _0x11a399(getChanSpyApplications(_0x3e5327,_0x3db4ed));}return _0x11a399([]);})[_0x7659('0x1c')](function(_0x3e6f04){_0x37166d(_0x3e6f04);});});};module[_0x7659('0x1d')]=function(_0x47930b,_0x5550f7){var _0x513f91=_0x47930b[_0x7659('0x1e')];return _0x47930b['define'](_0x7659('0x1f'),attributes,{'tableName':_0x7659('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x347b15,_0xebb2ad,_0x36dbf3){return getChanSpyPromise(_0x513f91,_0x347b15)[_0x7659('0x21')](function(_0x32bfa4){if(_0x32bfa4&&_0x32bfa4[_0x7659('0x16')]){return _0x513f91[_0x7659('0x22')][_0x7659('0x23')](_0x32bfa4);}})[_0x7659('0x21')](function(){_0x36dbf3();})[_0x7659('0x1c')](function(_0x3d38aa){_0x36dbf3(_0x3d38aa);});},'afterUpdate':function(_0x5b5b52,_0x4d6752,_0x58dc20){return _0x513f91[_0x7659('0x22')]['destroy']({'where':{'ChanSpyId':_0x5b5b52['id']}})[_0x7659('0x21')](function(){return getChanSpyPromise(_0x513f91,_0x5b5b52);})[_0x7659('0x21')](function(_0x496dd7){if(_0x496dd7&&_0x496dd7[_0x7659('0x16')]){return _0x513f91[_0x7659('0x22')][_0x7659('0x23')](_0x496dd7);}})[_0x7659('0x21')](function(){_0x58dc20();})[_0x7659('0x1c')](function(_0x571ea9){_0x58dc20(_0x571ea9);});},'afterDestroy':function(_0x42d4cf,_0x36ec7d,_0x4489b8){return _0x513f91[_0x7659('0x22')][_0x7659('0x24')]({'where':{'ChanSpyId':_0x42d4cf['id']}})[_0x7659('0x21')](function(){_0x4489b8();})[_0x7659('0x1c')](function(_0x43ba8b){_0x4489b8(_0x43ba8b);});}}});}; \ No newline at end of file +var _0x26d4=['findAll','agent','catch','exports','models','define','VoiceChanSpy','then','VoiceExtension','bulkCreate','destroy','lodash','./voiceChanSpy.attributes','context','format','%s%s','prefix','system','push','CDR(type)=%s','chanspy','record','merge','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','options','join','StopMixMonitor','length','concat','internal','name','User'];(function(_0x6beefe,_0x3156f){var _0x36530e=function(_0x351735){while(--_0x351735){_0x6beefe['push'](_0x6beefe['shift']());}};_0x36530e(++_0x3156f);}(_0x26d4,0xc4));var _0x426d=function(_0xd272eb,_0x18e404){_0xd272eb=_0xd272eb-0x0;var _0x37a5ab=_0x26d4[_0xd272eb];return _0x37a5ab;};'use strict';var _=require(_0x426d('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require(_0x426d('0x1'));var getUserApplications=function(_0x3c28f3,_0x3b8cf3,_0x17526d){var _0x593242=0x1;var _0x4e1923=[];var _0xa5be9a={'context':_0x3b8cf3[_0x426d('0x2')]||'from-sip','exten':util[_0x426d('0x3')](_0x426d('0x4'),_0x3c28f3[_0x426d('0x5')],_0x17526d),'type':_0x426d('0x6'),'isApp':![],'ChanSpyId':_0x3c28f3['id'],'UserId':_0x3b8cf3['id']};_0x4e1923[_0x426d('0x7')](_['merge']({'app':'Set','appdata':util['format'](_0x426d('0x8'),_0x426d('0x9')),'priority':_0x593242++},_0xa5be9a));if(_0x3c28f3[_0x426d('0xa')]){_0x4e1923['push'](_[_0x426d('0xb')]({'app':'MixMonitor','appdata':util[_0x426d('0x3')](_0x426d('0xc'),_0x3c28f3[_0x426d('0xd')]),'priority':_0x593242++},_0xa5be9a));}if(_0x3c28f3['auth']){_0x4e1923[_0x426d('0x7')](_[_0x426d('0xb')]({'app':_0x426d('0xe'),'appdata':_0x3c28f3[_0x426d('0xf')],'priority':_0x593242++},_0xa5be9a));}_0x4e1923[_0x426d('0x7')](_[_0x426d('0xb')]({'app':_0x426d('0x10'),'appdata':util['format'](_0x426d('0x11'),_0x3b8cf3['name'],_0x3c28f3[_0x426d('0x12')]?_0x3c28f3[_0x426d('0x12')][_0x426d('0x13')](''):''),'priority':_0x593242++},_0xa5be9a));if(_0x3c28f3[_0x426d('0xa')]){_0x4e1923[_0x426d('0x7')](_[_0x426d('0xb')]({'app':_0x426d('0x14'),'priority':_0x593242++},_0xa5be9a));}return _0x4e1923;};var getChanSpyApplications=function(_0x22f4af,_0x1a8202){var _0x5b1882=[];for(var _0x38c0b3=0x0,_0x7607e1=0x1;_0x38c0b3<_0x1a8202[_0x426d('0x15')];_0x38c0b3++,_0x7607e1=0x1){_0x5b1882=_0x5b1882[_0x426d('0x16')](getUserApplications(_0x22f4af,_0x1a8202[_0x38c0b3],_0x1a8202[_0x38c0b3][_0x426d('0x17')]));if(_0x1a8202[_0x38c0b3][_0x426d('0x17')]!=_0x1a8202[_0x38c0b3]['name']){_0x5b1882=_0x5b1882[_0x426d('0x16')](getUserApplications(_0x22f4af,_0x1a8202[_0x38c0b3],_0x1a8202[_0x38c0b3][_0x426d('0x18')]));}}return _0x5b1882;};var getChanSpyPromise=function(_0x3031d1,_0x5765be){return new BPromise(function(_0x480f3b,_0x33a9ee){return _0x3031d1[_0x426d('0x19')][_0x426d('0x1a')]({'attributes':['id',_0x426d('0x18'),'internal'],'where':{'role':_0x426d('0x1b'),'chanspy':!![]},'raw':!![]})['then'](function(_0x14c889){if(_0x14c889){return _0x480f3b(getChanSpyApplications(_0x5765be,_0x14c889));}return _0x480f3b([]);})[_0x426d('0x1c')](function(_0x26a0d4){_0x33a9ee(_0x26a0d4);});});};module[_0x426d('0x1d')]=function(_0x42ccde,_0x598803){var _0x4cd055=_0x42ccde[_0x426d('0x1e')];return _0x42ccde[_0x426d('0x1f')](_0x426d('0x20'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4a984b,_0x421bbb,_0xcf2ef){return getChanSpyPromise(_0x4cd055,_0x4a984b)[_0x426d('0x21')](function(_0x5de3f5){if(_0x5de3f5&&_0x5de3f5[_0x426d('0x15')]){return _0x4cd055[_0x426d('0x22')][_0x426d('0x23')](_0x5de3f5);}})['then'](function(){_0xcf2ef();})[_0x426d('0x1c')](function(_0x54e91a){_0xcf2ef(_0x54e91a);});},'afterUpdate':function(_0x349c09,_0x18d6af,_0x3ffa43){return _0x4cd055[_0x426d('0x22')][_0x426d('0x24')]({'where':{'ChanSpyId':_0x349c09['id']}})[_0x426d('0x21')](function(){return getChanSpyPromise(_0x4cd055,_0x349c09);})['then'](function(_0x38e5ca){if(_0x38e5ca&&_0x38e5ca[_0x426d('0x15')]){return _0x4cd055[_0x426d('0x22')][_0x426d('0x23')](_0x38e5ca);}})['then'](function(){_0x3ffa43();})[_0x426d('0x1c')](function(_0x4148e7){_0x3ffa43(_0x4148e7);});},'afterDestroy':function(_0x1ae046,_0x3b2f34,_0x362e98){return _0x4cd055[_0x426d('0x22')]['destroy']({'where':{'ChanSpyId':_0x1ae046['id']}})[_0x426d('0x21')](function(){_0x362e98();})[_0x426d('0x1c')](function(_0x1e4492){_0x362e98(_0x1e4492);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index ca4e207..5c8cb42 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 _0x2f3a=['http','request','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x3d0477,_0x2d255e){var _0x244db3=function(_0x9e7745){while(--_0x9e7745){_0x3d0477['push'](_0x3d0477['shift']());}};_0x244db3(++_0x2d255e);}(_0x2f3a,0xfb));var _0xa2f3=function(_0x1a13c7,_0x1e6fbd){_0x1a13c7=_0x1a13c7-0x0;var _0x48b1a3=_0x2f3a[_0x1a13c7];return _0x48b1a3;};'use strict';var _=require(_0xa2f3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa2f3('0x1'));var rs=require(_0xa2f3('0x2'));var fs=require('fs');var Redis=require(_0xa2f3('0x3'));var db=require(_0xa2f3('0x4'))['db'];var utils=require(_0xa2f3('0x5'));var logger=require(_0xa2f3('0x6'))('rpc');var config=require(_0xa2f3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa2f3('0x8')][_0xa2f3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4db21d,_0x521ddf,_0x2faf36){return new BPromise(function(_0x3944a0,_0x4405a2){return client[_0xa2f3('0xa')](_0x4db21d,_0x2faf36)['then'](function(_0x358263){logger[_0xa2f3('0xb')](_0xa2f3('0xc'),_0x521ddf,_0xa2f3('0xd'));logger[_0xa2f3('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x521ddf,_0xa2f3('0xd'),JSON[_0xa2f3('0xf')](_0x358263));if(_0x358263['error']){if(_0x358263[_0xa2f3('0x10')][_0xa2f3('0x11')]===0x1f4){logger[_0xa2f3('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x521ddf,_0x358263[_0xa2f3('0x10')][_0xa2f3('0x12')]);return _0x4405a2(_0x358263[_0xa2f3('0x10')][_0xa2f3('0x12')]);}logger[_0xa2f3('0x10')](_0xa2f3('0xc'),_0x521ddf,_0x358263[_0xa2f3('0x10')][_0xa2f3('0x12')]);return _0x3944a0(_0x358263[_0xa2f3('0x10')]['message']);}else{logger[_0xa2f3('0xb')](_0xa2f3('0xc'),_0x521ddf,_0xa2f3('0xd'));_0x3944a0(_0x358263['result'][_0xa2f3('0x12')]);}})[_0xa2f3('0x13')](function(_0x4b138b){logger['error'](_0xa2f3('0xc'),_0x521ddf,_0x4b138b);_0x4405a2(_0x4b138b);});});} \ No newline at end of file +var _0x1bca=['result','catch','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x1a0f96,_0x53d358){var _0x39a842=function(_0x35926b){while(--_0x35926b){_0x1a0f96['push'](_0x1a0f96['shift']());}};_0x39a842(++_0x53d358);}(_0x1bca,0xb6));var _0xa1bc=function(_0x8cfa14,_0x2fd3c6){_0x8cfa14=_0x8cfa14-0x0;var _0x4160fe=_0x1bca[_0x8cfa14];return _0x4160fe;};'use strict';var _=require('lodash');var util=require(_0xa1bc('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa1bc('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa1bc('0x2'))['db'];var utils=require(_0xa1bc('0x3'));var logger=require(_0xa1bc('0x4'))('rpc');var config=require(_0xa1bc('0x5'));var jayson=require(_0xa1bc('0x6'));var client=jayson[_0xa1bc('0x7')][_0xa1bc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x54bffb,_0x43a67,_0x432b65){return new BPromise(function(_0xea5ec8,_0x378061){return client[_0xa1bc('0x9')](_0x54bffb,_0x432b65)[_0xa1bc('0xa')](function(_0x2db364){logger['info'](_0xa1bc('0xb'),_0x43a67,_0xa1bc('0xc'));logger[_0xa1bc('0xd')](_0xa1bc('0xe'),_0x43a67,_0xa1bc('0xc'),JSON[_0xa1bc('0xf')](_0x2db364));if(_0x2db364[_0xa1bc('0x10')]){if(_0x2db364[_0xa1bc('0x10')]['code']===0x1f4){logger['error'](_0xa1bc('0xb'),_0x43a67,_0x2db364[_0xa1bc('0x10')][_0xa1bc('0x11')]);return _0x378061(_0x2db364[_0xa1bc('0x10')][_0xa1bc('0x11')]);}logger[_0xa1bc('0x10')](_0xa1bc('0xb'),_0x43a67,_0x2db364[_0xa1bc('0x10')][_0xa1bc('0x11')]);return _0xea5ec8(_0x2db364[_0xa1bc('0x10')][_0xa1bc('0x11')]);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x43a67,_0xa1bc('0xc'));_0xea5ec8(_0x2db364[_0xa1bc('0x12')][_0xa1bc('0x11')]);}})[_0xa1bc('0x13')](function(_0x2a0438){logger[_0xa1bc('0x10')](_0xa1bc('0xb'),_0x43a67,_0x2a0438);_0x378061(_0x2a0438);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index f1311f1..5f24f7d 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 _0xc402=['Router','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0xae54ea,_0x39bf42){var _0x5c6376=function(_0x45e09e){while(--_0x45e09e){_0xae54ea['push'](_0xae54ea['shift']());}};_0x5c6376(++_0x39bf42);}(_0xc402,0x175));var _0x2c40=function(_0x5b6a54,_0xf393d3){_0x5b6a54=_0x5b6a54-0x0;var _0x2b1a2e=_0xc402[_0x5b6a54];return _0x2b1a2e;};'use strict';var multer=require(_0x2c40('0x0'));var util=require(_0x2c40('0x1'));var path=require(_0x2c40('0x2'));var timeout=require(_0x2c40('0x3'));var express=require(_0x2c40('0x4'));var router=express[_0x2c40('0x5')]();var fs_extra=require(_0x2c40('0x6'));var auth=require(_0x2c40('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2c40('0x8'));var controller=require(_0x2c40('0x9'));router[_0x2c40('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x2c40('0xb')](),controller[_0x2c40('0xc')]);router[_0x2c40('0xd')]('/',auth[_0x2c40('0xb')](),controller[_0x2c40('0xe')]);router[_0x2c40('0xf')](_0x2c40('0x10'),auth[_0x2c40('0xb')](),controller[_0x2c40('0x11')]);router[_0x2c40('0x12')](_0x2c40('0x10'),auth[_0x2c40('0xb')](),controller[_0x2c40('0x13')]);module[_0x2c40('0x14')]=router; \ No newline at end of file +var _0x1338=['isAuthenticated','show','create','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id'];(function(_0xa37a4a,_0x355f61){var _0x363185=function(_0x80471f){while(--_0x80471f){_0xa37a4a['push'](_0xa37a4a['shift']());}};_0x363185(++_0x355f61);}(_0x1338,0x197));var _0x8133=function(_0x353c9b,_0x963d4b){_0x353c9b=_0x353c9b-0x0;var _0x37b8f4=_0x1338[_0x353c9b];return _0x37b8f4;};'use strict';var multer=require('multer');var util=require(_0x8133('0x0'));var path=require(_0x8133('0x1'));var timeout=require('connect-timeout');var express=require(_0x8133('0x2'));var router=express[_0x8133('0x3')]();var fs_extra=require(_0x8133('0x4'));var auth=require(_0x8133('0x5'));var interaction=require(_0x8133('0x6'));var config=require(_0x8133('0x7'));var controller=require('./voiceContext.controller');router[_0x8133('0x8')]('/',auth['isAuthenticated'](),controller[_0x8133('0x9')]);router[_0x8133('0x8')](_0x8133('0xa'),auth[_0x8133('0xb')](),controller[_0x8133('0xc')]);router['post']('/',auth[_0x8133('0xb')](),controller[_0x8133('0xd')]);router[_0x8133('0xe')](_0x8133('0xa'),auth[_0x8133('0xb')](),controller[_0x8133('0xf')]);router[_0x8133('0x10')]('/:id',auth[_0x8133('0xb')](),controller[_0x8133('0x11')]);module[_0x8133('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 6200094..c64deb3 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 _0xa01e=['sequelize','BOOLEAN'];(function(_0x1e2848,_0x589383){var _0x13f296=function(_0x67c59e){while(--_0x67c59e){_0x1e2848['push'](_0x1e2848['shift']());}};_0x13f296(++_0x589383);}(_0xa01e,0x106));var _0xea01=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa01e[_0x4bfac3];return _0x15f0f2;};'use strict';var Sequelize=require(_0xea01('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xea01('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5348=['BOOLEAN','sequelize','STRING'];(function(_0x2d5805,_0x21954e){var _0x1cae4f=function(_0x53ff24){while(--_0x53ff24){_0x2d5805['push'](_0x2d5805['shift']());}};_0x1cae4f(++_0x21954e);}(_0x5348,0x100));var _0x8534=function(_0x2a41c3,_0x1de90f){_0x2a41c3=_0x2a41c3-0x0;var _0x466e25=_0x5348[_0x2a41c3];return _0x466e25;};'use strict';var Sequelize=require(_0x8534('0x0'));module['exports']={'name':{'type':Sequelize[_0x8534('0x1')],'unique':'name'},'description':{'type':Sequelize[_0x8534('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x8534('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 3632bad..4cd14dd 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 _0x5cdf=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','destroy','get','Contexts','end','name','send','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','intersection','find','create','body','readFileSync','join','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','server/files/templates/context.ejs','writeFileSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x5cdf,0xb8));var _0xf5cd=function(_0x782890,_0x52135b){_0x782890=_0x782890-0x0;var _0x428ffa=_0x5cdf[_0x782890];return _0x428ffa;};'use strict';var emlformat=require(_0xf5cd('0x0'));var rimraf=require(_0xf5cd('0x1'));var zipdir=require(_0xf5cd('0x2'));var jsonpatch=require(_0xf5cd('0x3'));var rp=require(_0xf5cd('0x4'));var moment=require(_0xf5cd('0x5'));var BPromise=require(_0xf5cd('0x6'));var Mustache=require(_0xf5cd('0x7'));var util=require(_0xf5cd('0x8'));var path=require(_0xf5cd('0x9'));var sox=require(_0xf5cd('0xa'));var csv=require(_0xf5cd('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf5cd('0xc'));var crypto=require('crypto');var jsforce=require(_0xf5cd('0xd'));var deskjs=require(_0xf5cd('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf5cd('0xf'));var Papa=require(_0xf5cd('0x10'));var Redis=require(_0xf5cd('0x11'));var authService=require(_0xf5cd('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5cd('0x13'));var hardwareService=require(_0xf5cd('0x14'));var logger=require('../../config/logger')(_0xf5cd('0x15'));var utils=require(_0xf5cd('0x16'));var config=require(_0xf5cd('0x17'));var licenseUtil=require(_0xf5cd('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0xf5cd('0x19'));var client=jayson[_0xf5cd('0x1a')][_0xf5cd('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x20acda,_0x131d00,_0x2cb781,_0x32c649){return new BPromise(function(_0x4d3b14,_0x601fd3){var _0x4f37b3=_0x32c649||client;return _0x4f37b3[_0xf5cd('0x1c')](_0x20acda,_0x2cb781)[_0xf5cd('0x1d')](function(_0x2bfa54){logger['info'](_0xf5cd('0x1e'),_0x131d00,_0xf5cd('0x1f'));logger[_0xf5cd('0x20')](_0xf5cd('0x21'),_0x131d00,_0xf5cd('0x1f'),JSON['stringify'](_0x2bfa54));if(_0x2bfa54[_0xf5cd('0x22')]){if(_0x2bfa54['error'][_0xf5cd('0x23')]===0x1f4){logger[_0xf5cd('0x22')](_0xf5cd('0x1e'),_0x131d00,_0x2bfa54['error'][_0xf5cd('0x24')]);return _0x601fd3(_0x2bfa54[_0xf5cd('0x22')][_0xf5cd('0x24')]);}logger[_0xf5cd('0x22')](_0xf5cd('0x1e'),_0x131d00,_0x2bfa54['error'][_0xf5cd('0x24')]);return _0x4d3b14(_0x2bfa54['error']['message']);}else{logger[_0xf5cd('0x25')](_0xf5cd('0x1e'),_0x131d00,_0xf5cd('0x1f'));_0x4d3b14(_0x2bfa54[_0xf5cd('0x26')]['message']);}})[_0xf5cd('0x27')](function(_0x105583){logger[_0xf5cd('0x22')](_0xf5cd('0x1e'),_0x131d00,_0x105583);_0x601fd3(_0x105583);});});}function respondWithStatusCode(_0x4c99b6,_0x747e76){_0x747e76=_0x747e76||0xcc;return function(_0x36a3b6){if(_0x36a3b6){return _0x4c99b6[_0xf5cd('0x28')](_0x747e76);}return _0x4c99b6[_0xf5cd('0x29')](_0x747e76)['end']();};}function respondWithResult(_0x395b9c,_0x13c88c){_0x13c88c=_0x13c88c||0xc8;return function(_0x57b581){if(_0x57b581){return _0x395b9c[_0xf5cd('0x29')](_0x13c88c)[_0xf5cd('0x2a')](_0x57b581);}};}function respondWithFilteredResult(_0x8324e0,_0x47db9a){return function(_0x5d6814){if(_0x5d6814){var _0x15e99=typeof _0x47db9a[_0xf5cd('0x2b')]===_0xf5cd('0x2c')&&typeof _0x47db9a[_0xf5cd('0x2d')]===_0xf5cd('0x2c');var _0x3bf060=_0x5d6814['count'];var _0x388e47=_0x15e99?0x0:_0x47db9a[_0xf5cd('0x2b')];var _0x144fdf=_0x15e99?_0x5d6814[_0xf5cd('0x2e')]:_0x47db9a['offset']+_0x47db9a[_0xf5cd('0x2d')];var _0xbb29c7;if(_0x144fdf>=_0x3bf060){_0x144fdf=_0x3bf060;_0xbb29c7=0xc8;}else{_0xbb29c7=0xce;}_0x8324e0['status'](_0xbb29c7);return _0x8324e0[_0xf5cd('0x2f')]('Content-Range',_0x388e47+'-'+_0x144fdf+'/'+_0x3bf060)['json'](_0x5d6814);}return null;};}function patchUpdates(_0x3238f7){return function(_0x36f1ab){try{jsonpatch[_0xf5cd('0x30')](_0x36f1ab,_0x3238f7,!![]);}catch(_0x5a70ae){return BPromise['reject'](_0x5a70ae);}return _0x36f1ab[_0xf5cd('0x31')]();};}function saveUpdates(_0x33e8f0,_0x380f30){return function(_0x26c0e6){if(_0x26c0e6){return _0x26c0e6[_0xf5cd('0x32')](_0x33e8f0)['then'](function(_0x710152){return _0x710152;});}return null;};}function removeEntity(_0x4f9717,_0x44b0c1){return function(_0x2c58d8){if(_0x2c58d8){return _0x2c58d8[_0xf5cd('0x33')]()[_0xf5cd('0x1d')](function(){var _0x4e4f8f=_0x2c58d8[_0xf5cd('0x34')]({'plain':!![]});var _0x237d0b=_0xf5cd('0x35');return db['UserProfileResource'][_0xf5cd('0x33')]({'where':{'type':_0x237d0b,'resourceId':_0x4e4f8f['id']}})[_0xf5cd('0x1d')](function(){return _0x2c58d8;});})[_0xf5cd('0x1d')](function(){_0x4f9717[_0xf5cd('0x29')](0xcc)[_0xf5cd('0x36')]();});}};}function handleEntityNotFound(_0x40bdc2,_0x49ad0c){return function(_0x34f3b8){if(!_0x34f3b8){_0x40bdc2[_0xf5cd('0x28')](0x194);}return _0x34f3b8;};}function handleError(_0x2d1fe6,_0x2d85b0){_0x2d85b0=_0x2d85b0||0x1f4;return function(_0xb35ce8){logger['error'](_0xb35ce8['stack']);if(_0xb35ce8[_0xf5cd('0x37')]){delete _0xb35ce8[_0xf5cd('0x37')];}_0x2d1fe6[_0xf5cd('0x29')](_0x2d85b0)[_0xf5cd('0x38')](_0xb35ce8);};}exports['index']=function(_0x5ddf0d,_0x1c807b){var _0x5bbe4c={},_0x100e62={},_0x22a78d={'count':0x0,'rows':[]};var _0x2f54d8=_['map'](db[_0xf5cd('0x39')][_0xf5cd('0x3a')],function(_0x520f7f){return{'name':_0x520f7f[_0xf5cd('0x3b')],'type':_0x520f7f[_0xf5cd('0x3c')][_0xf5cd('0x3d')]};});_0x100e62[_0xf5cd('0x3e')]=_['map'](_0x2f54d8,_0xf5cd('0x37'));_0x100e62[_0xf5cd('0x3f')]=_[_0xf5cd('0x40')](_0x5ddf0d['query']);_0x100e62[_0xf5cd('0x41')]=_['intersection'](_0x100e62['model'],_0x100e62[_0xf5cd('0x3f')]);_0x5bbe4c[_0xf5cd('0x42')]=_['intersection'](_0x100e62[_0xf5cd('0x3e')],qs[_0xf5cd('0x43')](_0x5ddf0d[_0xf5cd('0x3f')]['fields']));_0x5bbe4c[_0xf5cd('0x42')]=_0x5bbe4c['attributes'][_0xf5cd('0x44')]?_0x5bbe4c['attributes']:_0x100e62['model'];if(!_0x5ddf0d['query']['hasOwnProperty']('nolimit')){_0x5bbe4c[_0xf5cd('0x2d')]=qs['limit'](_0x5ddf0d[_0xf5cd('0x3f')][_0xf5cd('0x2d')]);_0x5bbe4c[_0xf5cd('0x2b')]=qs[_0xf5cd('0x2b')](_0x5ddf0d[_0xf5cd('0x3f')][_0xf5cd('0x2b')]);}_0x5bbe4c[_0xf5cd('0x45')]=qs[_0xf5cd('0x46')](_0x5ddf0d['query']['sort']);_0x5bbe4c['where']=qs[_0xf5cd('0x41')](_[_0xf5cd('0x47')](_0x5ddf0d['query'],_0x100e62[_0xf5cd('0x41')]),_0x2f54d8);if(_0x5ddf0d[_0xf5cd('0x3f')][_0xf5cd('0x48')]){_0x5bbe4c[_0xf5cd('0x49')]=_[_0xf5cd('0x4a')](_0x5bbe4c['where'],{'$or':_[_0xf5cd('0x4b')](_0x2f54d8,function(_0x4ef78c){if(_0x4ef78c[_0xf5cd('0x3c')]!==_0xf5cd('0x4c')){var _0x144035={};_0x144035[_0x4ef78c['name']]={'$like':'%'+_0x5ddf0d[_0xf5cd('0x3f')]['filter']+'%'};return _0x144035;}})});}_0x5bbe4c=_[_0xf5cd('0x4a')]({},_0x5bbe4c,_0x5ddf0d[_0xf5cd('0x4d')]);var _0x4b00c9={'where':_0x5bbe4c[_0xf5cd('0x49')]};return db[_0xf5cd('0x39')][_0xf5cd('0x2e')](_0x4b00c9)['then'](function(_0x18174d){_0x22a78d['count']=_0x18174d;if(_0x5ddf0d[_0xf5cd('0x3f')][_0xf5cd('0x4e')]){_0x5bbe4c[_0xf5cd('0x4f')]=[{'all':!![]}];}return db['VoiceContext'][_0xf5cd('0x50')](_0x5bbe4c);})[_0xf5cd('0x1d')](function(_0x2a6824){_0x22a78d[_0xf5cd('0x51')]=_0x2a6824;return _0x22a78d;})[_0xf5cd('0x1d')](respondWithFilteredResult(_0x1c807b,_0x5bbe4c))[_0xf5cd('0x27')](handleError(_0x1c807b,null));};exports[_0xf5cd('0x52')]=function(_0x2ad45f,_0x445397){var _0xfa86bb={'raw':![],'where':{'id':_0x2ad45f[_0xf5cd('0x53')]['id']}},_0x534069={};_0x534069[_0xf5cd('0x3e')]=_[_0xf5cd('0x40')](db['VoiceContext'][_0xf5cd('0x3a')]);_0x534069['query']=_[_0xf5cd('0x40')](_0x2ad45f[_0xf5cd('0x3f')]);_0x534069['filters']=_[_0xf5cd('0x54')](_0x534069[_0xf5cd('0x3e')],_0x534069[_0xf5cd('0x3f')]);_0xfa86bb[_0xf5cd('0x42')]=_[_0xf5cd('0x54')](_0x534069[_0xf5cd('0x3e')],qs['fields'](_0x2ad45f['query'][_0xf5cd('0x43')]));_0xfa86bb[_0xf5cd('0x42')]=_0xfa86bb[_0xf5cd('0x42')][_0xf5cd('0x44')]?_0xfa86bb['attributes']:_0x534069[_0xf5cd('0x3e')];if(_0x2ad45f['query'][_0xf5cd('0x4e')]){_0xfa86bb['include']=[{'all':!![]}];}_0xfa86bb=_[_0xf5cd('0x4a')]({},_0xfa86bb,_0x2ad45f['options']);return db['VoiceContext'][_0xf5cd('0x55')](_0xfa86bb)[_0xf5cd('0x1d')](handleEntityNotFound(_0x445397,null))[_0xf5cd('0x1d')](respondWithResult(_0x445397,null))[_0xf5cd('0x27')](handleError(_0x445397,null));};exports['create']=function(_0x41854c,_0x1f3ce9,_0x4dedf4){var _0x1d623f;return db[_0xf5cd('0x39')][_0xf5cd('0x56')](_0x41854c[_0xf5cd('0x57')],{'raw':!![]})[_0xf5cd('0x1d')](function(_0x15c823){_0x1d623f=_0x15c823;return db[_0xf5cd('0x39')][_0xf5cd('0x50')]({'raw':!![]});})[_0xf5cd('0x1d')](function(_0x2e1212){var _0x368a6f=fs[_0xf5cd('0x58')](path[_0xf5cd('0x59')](config['root'],'server/files/templates/context.ejs'),_0xf5cd('0x5a'));var _0x4b21c1=ejs[_0xf5cd('0x5b')](_0x368a6f,{'contexts':_0x2e1212||[]});fs['writeFileSync'](_0xf5cd('0x5c'),_0x4b21c1);})[_0xf5cd('0x1d')](function(){return respondWithRpcPromise(_0xf5cd('0x5d'),_0xf5cd('0x56'),{'module':_0xf5cd('0x5e')});})[_0xf5cd('0x1d')](function(){var _0x392f2b=_0x41854c[_0xf5cd('0x5f')][_0xf5cd('0x34')]({'plain':!![]});if(!_0x392f2b)throw new Error(_0xf5cd('0x60'));if(_0x392f2b['role']===_0xf5cd('0x5f')){var _0x4cd217=_0x1d623f['get']({'plain':!![]});return db['UserProfileSection'][_0xf5cd('0x55')]({'where':{'name':_0xf5cd('0x35'),'userProfileId':_0x392f2b[_0xf5cd('0x61')]},'raw':!![]})[_0xf5cd('0x1d')](function(_0x17aab){if(_0x17aab&&_0x17aab[_0xf5cd('0x62')]===0x0){return db[_0xf5cd('0x63')][_0xf5cd('0x56')]({'name':_0x4cd217[_0xf5cd('0x37')],'resourceId':_0x4cd217['id'],'type':_0x17aab[_0xf5cd('0x37')],'sectionId':_0x17aab['id']},{})[_0xf5cd('0x1d')](function(){return _0x1d623f;});}else{return _0x1d623f;}})[_0xf5cd('0x27')](function(_0x1e41e8){logger[_0xf5cd('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e41e8);throw _0x1e41e8;});}return _0x1d623f;})[_0xf5cd('0x1d')](respondWithResult(_0x1f3ce9,0xc9))['catch'](handleError(_0x1f3ce9,null));};exports[_0xf5cd('0x32')]=function(_0x754dea,_0x2b8397,_0x169379){var _0x1a4b37;return db[_0xf5cd('0x39')][_0xf5cd('0x55')]({'where':{'id':_0x754dea[_0xf5cd('0x53')]['id']}})[_0xf5cd('0x1d')](handleEntityNotFound(_0x2b8397,null))[_0xf5cd('0x1d')](saveUpdates(_0x754dea[_0xf5cd('0x57')],null))[_0xf5cd('0x1d')](function(_0x21756c){if(_0x21756c){_0x1a4b37=_0x21756c;return db[_0xf5cd('0x39')][_0xf5cd('0x50')]({'raw':!![]});}})[_0xf5cd('0x1d')](function(_0xe1881){var _0xbfa04a=fs['readFileSync'](path['join'](config['root'],_0xf5cd('0x64')),_0xf5cd('0x5a'));var _0x3b67dc=ejs[_0xf5cd('0x5b')](_0xbfa04a,{'contexts':_0xe1881||[]});fs[_0xf5cd('0x65')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x3b67dc);})[_0xf5cd('0x1d')](function(){return respondWithRpcPromise('Reload',_0xf5cd('0x32'),{'module':_0xf5cd('0x5e')});})[_0xf5cd('0x1d')](function(){return _0x1a4b37;})[_0xf5cd('0x1d')](respondWithResult(_0x2b8397,null))[_0xf5cd('0x27')](handleError(_0x2b8397,null));};exports['destroy']=function(_0x83b4ae,_0x1b2edd,_0x5aa738){var _0x56ba86;return db[_0xf5cd('0x39')][_0xf5cd('0x55')]({'where':{'id':_0x83b4ae[_0xf5cd('0x53')]['id']}})[_0xf5cd('0x1d')](handleEntityNotFound(_0x1b2edd,null))[_0xf5cd('0x1d')](removeEntity(_0x1b2edd,null))[_0xf5cd('0x1d')](function(){return db['VoiceContext'][_0xf5cd('0x50')]({'raw':!![]});})[_0xf5cd('0x1d')](function(_0x19a964){var _0x51b51a=fs[_0xf5cd('0x58')](path[_0xf5cd('0x59')](config['root'],_0xf5cd('0x64')),_0xf5cd('0x5a'));var _0x3b2503=ejs['render'](_0x51b51a,{'contexts':_0x19a964});fs['writeFileSync'](_0xf5cd('0x5c'),_0x3b2503);return respondWithRpcPromise('Reload','destroy',{'module':_0xf5cd('0x5e')});})[_0xf5cd('0x27')](handleError(_0x1b2edd,null));}; \ No newline at end of file +var _0xa610=['autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','server/files/templates/context.ejs','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','limit','undefined','count','apply','reject','save','then','destroy','get','Contexts','stack','name','send','index','map','VoiceContext','fieldName','key','query','filters','model','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','find','create','body','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x42e4d7,_0x4bd202){var _0x346cd8=function(_0x36c0f6){while(--_0x36c0f6){_0x42e4d7['push'](_0x42e4d7['shift']());}};_0x346cd8(++_0x4bd202);}(_0xa610,0x6a));var _0x0a61=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa610[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x0a61('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0a61('0x1'));var jsonpatch=require(_0x0a61('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0a61('0x3'));var Mustache=require(_0x0a61('0x4'));var util=require(_0x0a61('0x5'));var path=require('path');var sox=require(_0x0a61('0x6'));var csv=require(_0x0a61('0x7'));var ejs=require(_0x0a61('0x8'));var fs=require('fs');var fs_extra=require(_0x0a61('0x9'));var _=require(_0x0a61('0xa'));var squel=require(_0x0a61('0xb'));var crypto=require(_0x0a61('0xc'));var jsforce=require(_0x0a61('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0a61('0x7'));var querystring=require(_0x0a61('0xe'));var Papa=require(_0x0a61('0xf'));var Redis=require('ioredis');var authService=require(_0x0a61('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0a61('0x11'))(_0x0a61('0x12'));var utils=require(_0x0a61('0x13'));var config=require(_0x0a61('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a61('0x15'))['db'];var jayson=require(_0x0a61('0x16'));var client=jayson[_0x0a61('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53d127,_0x50698e,_0x2f54df,_0x4ece2f){return new BPromise(function(_0x3cf56d,_0x410b94){var _0x13ecee=_0x4ece2f||client;return _0x13ecee[_0x0a61('0x18')](_0x53d127,_0x2f54df)['then'](function(_0x58e611){logger[_0x0a61('0x19')](_0x0a61('0x1a'),_0x50698e,_0x0a61('0x1b'));logger[_0x0a61('0x1c')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x50698e,_0x0a61('0x1b'),JSON[_0x0a61('0x1d')](_0x58e611));if(_0x58e611[_0x0a61('0x1e')]){if(_0x58e611[_0x0a61('0x1e')][_0x0a61('0x1f')]===0x1f4){logger['error'](_0x0a61('0x1a'),_0x50698e,_0x58e611[_0x0a61('0x1e')]['message']);return _0x410b94(_0x58e611[_0x0a61('0x1e')][_0x0a61('0x20')]);}logger[_0x0a61('0x1e')](_0x0a61('0x1a'),_0x50698e,_0x58e611[_0x0a61('0x1e')]['message']);return _0x3cf56d(_0x58e611[_0x0a61('0x1e')][_0x0a61('0x20')]);}else{logger[_0x0a61('0x19')](_0x0a61('0x1a'),_0x50698e,_0x0a61('0x1b'));_0x3cf56d(_0x58e611[_0x0a61('0x21')]['message']);}})[_0x0a61('0x22')](function(_0x3ffe23){logger[_0x0a61('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x50698e,_0x3ffe23);_0x410b94(_0x3ffe23);});});}function respondWithStatusCode(_0x522471,_0x2cdda9){_0x2cdda9=_0x2cdda9||0xcc;return function(_0x20bf2b){if(_0x20bf2b){return _0x522471[_0x0a61('0x23')](_0x2cdda9);}return _0x522471['status'](_0x2cdda9)[_0x0a61('0x24')]();};}function respondWithResult(_0x281699,_0x67d554){_0x67d554=_0x67d554||0xc8;return function(_0x3482da){if(_0x3482da){return _0x281699[_0x0a61('0x25')](_0x67d554)[_0x0a61('0x26')](_0x3482da);}};}function respondWithFilteredResult(_0x1eb100,_0x2ed096){return function(_0x3f8cc3){if(_0x3f8cc3){var _0x1152bb=typeof _0x2ed096[_0x0a61('0x27')]==='undefined'&&typeof _0x2ed096[_0x0a61('0x28')]===_0x0a61('0x29');var _0x1d7254=_0x3f8cc3[_0x0a61('0x2a')];var _0x243579=_0x1152bb?0x0:_0x2ed096[_0x0a61('0x27')];var _0x683ffd=_0x1152bb?_0x3f8cc3[_0x0a61('0x2a')]:_0x2ed096[_0x0a61('0x27')]+_0x2ed096[_0x0a61('0x28')];var _0x14f81b;if(_0x683ffd>=_0x1d7254){_0x683ffd=_0x1d7254;_0x14f81b=0xc8;}else{_0x14f81b=0xce;}_0x1eb100[_0x0a61('0x25')](_0x14f81b);return _0x1eb100['set']('Content-Range',_0x243579+'-'+_0x683ffd+'/'+_0x1d7254)[_0x0a61('0x26')](_0x3f8cc3);}return null;};}function patchUpdates(_0x45833c){return function(_0x196971){try{jsonpatch[_0x0a61('0x2b')](_0x196971,_0x45833c,!![]);}catch(_0x5a9b39){return BPromise[_0x0a61('0x2c')](_0x5a9b39);}return _0x196971[_0x0a61('0x2d')]();};}function saveUpdates(_0xf6bfc3,_0x46ca89){return function(_0x42fff3){if(_0x42fff3){return _0x42fff3['update'](_0xf6bfc3)[_0x0a61('0x2e')](function(_0x4a8f7f){return _0x4a8f7f;});}return null;};}function removeEntity(_0x85ecf7,_0x47c2cd){return function(_0x62b5dd){if(_0x62b5dd){return _0x62b5dd[_0x0a61('0x2f')]()[_0x0a61('0x2e')](function(){var _0x26d9a3=_0x62b5dd[_0x0a61('0x30')]({'plain':!![]});var _0x5c8c47=_0x0a61('0x31');return db['UserProfileResource'][_0x0a61('0x2f')]({'where':{'type':_0x5c8c47,'resourceId':_0x26d9a3['id']}})[_0x0a61('0x2e')](function(){return _0x62b5dd;});})[_0x0a61('0x2e')](function(){_0x85ecf7[_0x0a61('0x25')](0xcc)[_0x0a61('0x24')]();});}};}function handleEntityNotFound(_0x574462,_0x48bf37){return function(_0x16269e){if(!_0x16269e){_0x574462['sendStatus'](0x194);}return _0x16269e;};}function handleError(_0x2f85eb,_0x1e1b59){_0x1e1b59=_0x1e1b59||0x1f4;return function(_0xcd62d5){logger[_0x0a61('0x1e')](_0xcd62d5[_0x0a61('0x32')]);if(_0xcd62d5[_0x0a61('0x33')]){delete _0xcd62d5['name'];}_0x2f85eb[_0x0a61('0x25')](_0x1e1b59)[_0x0a61('0x34')](_0xcd62d5);};}exports[_0x0a61('0x35')]=function(_0xd17824,_0xde7e78){var _0x1fca9f={},_0x125271={},_0x4414bd={'count':0x0,'rows':[]};var _0x1649f8=_[_0x0a61('0x36')](db[_0x0a61('0x37')]['rawAttributes'],function(_0x45e9c3){return{'name':_0x45e9c3[_0x0a61('0x38')],'type':_0x45e9c3['type'][_0x0a61('0x39')]};});_0x125271['model']=_['map'](_0x1649f8,_0x0a61('0x33'));_0x125271[_0x0a61('0x3a')]=_['keys'](_0xd17824[_0x0a61('0x3a')]);_0x125271[_0x0a61('0x3b')]=_['intersection'](_0x125271[_0x0a61('0x3c')],_0x125271[_0x0a61('0x3a')]);_0x1fca9f[_0x0a61('0x3d')]=_[_0x0a61('0x3e')](_0x125271[_0x0a61('0x3c')],qs[_0x0a61('0x3f')](_0xd17824[_0x0a61('0x3a')][_0x0a61('0x3f')]));_0x1fca9f[_0x0a61('0x3d')]=_0x1fca9f['attributes'][_0x0a61('0x40')]?_0x1fca9f[_0x0a61('0x3d')]:_0x125271[_0x0a61('0x3c')];if(!_0xd17824['query']['hasOwnProperty'](_0x0a61('0x41'))){_0x1fca9f['limit']=qs[_0x0a61('0x28')](_0xd17824[_0x0a61('0x3a')][_0x0a61('0x28')]);_0x1fca9f[_0x0a61('0x27')]=qs[_0x0a61('0x27')](_0xd17824[_0x0a61('0x3a')][_0x0a61('0x27')]);}_0x1fca9f['order']=qs[_0x0a61('0x42')](_0xd17824[_0x0a61('0x3a')][_0x0a61('0x42')]);_0x1fca9f[_0x0a61('0x43')]=qs[_0x0a61('0x3b')](_[_0x0a61('0x44')](_0xd17824[_0x0a61('0x3a')],_0x125271[_0x0a61('0x3b')]),_0x1649f8);if(_0xd17824[_0x0a61('0x3a')][_0x0a61('0x45')]){_0x1fca9f[_0x0a61('0x43')]=_[_0x0a61('0x46')](_0x1fca9f['where'],{'$or':_['map'](_0x1649f8,function(_0x3e8196){if(_0x3e8196[_0x0a61('0x47')]!==_0x0a61('0x48')){var _0x406456={};_0x406456[_0x3e8196[_0x0a61('0x33')]]={'$like':'%'+_0xd17824['query'][_0x0a61('0x45')]+'%'};return _0x406456;}})});}_0x1fca9f=_[_0x0a61('0x46')]({},_0x1fca9f,_0xd17824[_0x0a61('0x49')]);var _0x14c31e={'where':_0x1fca9f['where']};return db[_0x0a61('0x37')][_0x0a61('0x2a')](_0x14c31e)[_0x0a61('0x2e')](function(_0x3b2109){_0x4414bd[_0x0a61('0x2a')]=_0x3b2109;if(_0xd17824[_0x0a61('0x3a')][_0x0a61('0x4a')]){_0x1fca9f['include']=[{'all':!![]}];}return db[_0x0a61('0x37')][_0x0a61('0x4b')](_0x1fca9f);})['then'](function(_0x139b5f){_0x4414bd[_0x0a61('0x4c')]=_0x139b5f;return _0x4414bd;})[_0x0a61('0x2e')](respondWithFilteredResult(_0xde7e78,_0x1fca9f))[_0x0a61('0x22')](handleError(_0xde7e78,null));};exports[_0x0a61('0x4d')]=function(_0x19be23,_0x309521){var _0x2b9c38={'raw':![],'where':{'id':_0x19be23[_0x0a61('0x4e')]['id']}},_0x88c2ab={};_0x88c2ab['model']=_['keys'](db[_0x0a61('0x37')]['rawAttributes']);_0x88c2ab['query']=_['keys'](_0x19be23['query']);_0x88c2ab[_0x0a61('0x3b')]=_[_0x0a61('0x3e')](_0x88c2ab[_0x0a61('0x3c')],_0x88c2ab['query']);_0x2b9c38[_0x0a61('0x3d')]=_[_0x0a61('0x3e')](_0x88c2ab['model'],qs['fields'](_0x19be23[_0x0a61('0x3a')]['fields']));_0x2b9c38['attributes']=_0x2b9c38[_0x0a61('0x3d')]['length']?_0x2b9c38[_0x0a61('0x3d')]:_0x88c2ab[_0x0a61('0x3c')];if(_0x19be23[_0x0a61('0x3a')]['includeAll']){_0x2b9c38['include']=[{'all':!![]}];}_0x2b9c38=_[_0x0a61('0x46')]({},_0x2b9c38,_0x19be23[_0x0a61('0x49')]);return db[_0x0a61('0x37')][_0x0a61('0x4f')](_0x2b9c38)[_0x0a61('0x2e')](handleEntityNotFound(_0x309521,null))['then'](respondWithResult(_0x309521,null))[_0x0a61('0x22')](handleError(_0x309521,null));};exports[_0x0a61('0x50')]=function(_0x47263a,_0xb58c0f,_0x4972a4){var _0x1fc299;return db['VoiceContext'][_0x0a61('0x50')](_0x47263a[_0x0a61('0x51')],{'raw':!![]})[_0x0a61('0x2e')](function(_0x47a015){_0x1fc299=_0x47a015;return db['VoiceContext'][_0x0a61('0x4b')]({'raw':!![]});})['then'](function(_0x275e33){var _0x1e3f75=fs[_0x0a61('0x52')](path[_0x0a61('0x53')](config[_0x0a61('0x54')],'server/files/templates/context.ejs'),_0x0a61('0x55'));var _0x4171fe=ejs[_0x0a61('0x56')](_0x1e3f75,{'contexts':_0x275e33||[]});fs[_0x0a61('0x57')](_0x0a61('0x58'),_0x4171fe);})[_0x0a61('0x2e')](function(){return respondWithRpcPromise(_0x0a61('0x59'),_0x0a61('0x50'),{'module':_0x0a61('0x5a')});})['then'](function(){var _0x57903c=_0x47263a[_0x0a61('0x5b')][_0x0a61('0x30')]({'plain':!![]});if(!_0x57903c)throw new Error(_0x0a61('0x5c'));if(_0x57903c[_0x0a61('0x5d')]===_0x0a61('0x5b')){var _0x5de0af=_0x1fc299['get']({'plain':!![]});return db[_0x0a61('0x5e')]['find']({'where':{'name':_0x0a61('0x31'),'userProfileId':_0x57903c[_0x0a61('0x5f')]},'raw':!![]})[_0x0a61('0x2e')](function(_0x396b60){if(_0x396b60&&_0x396b60[_0x0a61('0x60')]===0x0){return db[_0x0a61('0x61')][_0x0a61('0x50')]({'name':_0x5de0af['name'],'resourceId':_0x5de0af['id'],'type':_0x396b60[_0x0a61('0x33')],'sectionId':_0x396b60['id']},{})['then'](function(){return _0x1fc299;});}else{return _0x1fc299;}})[_0x0a61('0x22')](function(_0x43bb9b){logger[_0x0a61('0x1e')](_0x0a61('0x62'),_0x43bb9b);throw _0x43bb9b;});}return _0x1fc299;})['then'](respondWithResult(_0xb58c0f,0xc9))[_0x0a61('0x22')](handleError(_0xb58c0f,null));};exports[_0x0a61('0x63')]=function(_0x2b04e5,_0x1d0bb0,_0x143027){var _0x44f3fa;return db[_0x0a61('0x37')][_0x0a61('0x4f')]({'where':{'id':_0x2b04e5[_0x0a61('0x4e')]['id']}})[_0x0a61('0x2e')](handleEntityNotFound(_0x1d0bb0,null))[_0x0a61('0x2e')](saveUpdates(_0x2b04e5[_0x0a61('0x51')],null))['then'](function(_0x29e303){if(_0x29e303){_0x44f3fa=_0x29e303;return db[_0x0a61('0x37')][_0x0a61('0x4b')]({'raw':!![]});}})[_0x0a61('0x2e')](function(_0x562a10){var _0x670424=fs[_0x0a61('0x52')](path['join'](config['root'],_0x0a61('0x64')),_0x0a61('0x55'));var _0x21e110=ejs[_0x0a61('0x56')](_0x670424,{'contexts':_0x562a10||[]});fs[_0x0a61('0x57')](_0x0a61('0x58'),_0x21e110);})[_0x0a61('0x2e')](function(){return respondWithRpcPromise(_0x0a61('0x59'),_0x0a61('0x63'),{'module':_0x0a61('0x5a')});})[_0x0a61('0x2e')](function(){return _0x44f3fa;})['then'](respondWithResult(_0x1d0bb0,null))[_0x0a61('0x22')](handleError(_0x1d0bb0,null));};exports[_0x0a61('0x2f')]=function(_0x2bd09a,_0x44bee0,_0x34a939){var _0x64a013;return db[_0x0a61('0x37')][_0x0a61('0x4f')]({'where':{'id':_0x2bd09a[_0x0a61('0x4e')]['id']}})[_0x0a61('0x2e')](handleEntityNotFound(_0x44bee0,null))[_0x0a61('0x2e')](removeEntity(_0x44bee0,null))['then'](function(){return db[_0x0a61('0x37')]['findAll']({'raw':!![]});})[_0x0a61('0x2e')](function(_0x351853){var _0x3f7bb6=fs[_0x0a61('0x52')](path[_0x0a61('0x53')](config[_0x0a61('0x54')],_0x0a61('0x64')),_0x0a61('0x55'));var _0x5e7cbc=ejs[_0x0a61('0x56')](_0x3f7bb6,{'contexts':_0x351853});fs[_0x0a61('0x57')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x5e7cbc);return respondWithRpcPromise(_0x0a61('0x59'),_0x0a61('0x2f'),{'module':'chan_sip.so'});})[_0x0a61('0x22')](handleError(_0x44bee0,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 8e69160..4ca824b 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 _0x57c0=['../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x49dba6,_0x46b1a7){var _0x2ca633=function(_0x315d66){while(--_0x315d66){_0x49dba6['push'](_0x49dba6['shift']());}};_0x2ca633(++_0x46b1a7);}(_0x57c0,0xa0));var _0x057c=function(_0x343c76,_0x1cac3a){_0x343c76=_0x343c76-0x0;var _0x1bb83=_0x57c0[_0x343c76];return _0x1bb83;};'use strict';var _=require(_0x057c('0x0'));var util=require(_0x057c('0x1'));var logger=require('../../config/logger')(_0x057c('0x2'));var moment=require(_0x057c('0x3'));var BPromise=require(_0x057c('0x4'));var rp=require(_0x057c('0x5'));var fs=require('fs');var path=require(_0x057c('0x6'));var rimraf=require(_0x057c('0x7'));var config=require(_0x057c('0x8'));var attributes=require(_0x057c('0x9'));module[_0x057c('0xa')]=function(_0x406fa6,_0x3ab2ad){return _0x406fa6[_0x057c('0xb')](_0x057c('0xc'),attributes,{'tableName':_0x057c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8014=['exports','define','voice_contexts','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x192d60,_0x4e4703){var _0x4f5dbe=function(_0x4848ed){while(--_0x4848ed){_0x192d60['push'](_0x192d60['shift']());}};_0x4f5dbe(++_0x4e4703);}(_0x8014,0x163));var _0x4801=function(_0x212a37,_0xf35b2e){_0x212a37=_0x212a37-0x0;var _0x5d0bf9=_0x8014[_0x212a37];return _0x5d0bf9;};'use strict';var _=require(_0x4801('0x0'));var util=require('util');var logger=require(_0x4801('0x1'))(_0x4801('0x2'));var moment=require(_0x4801('0x3'));var BPromise=require('bluebird');var rp=require(_0x4801('0x4'));var fs=require('fs');var path=require(_0x4801('0x5'));var rimraf=require(_0x4801('0x6'));var config=require(_0x4801('0x7'));var attributes=require('./voiceContext.attributes');module[_0x4801('0x8')]=function(_0x501a94,_0x26de98){return _0x501a94[_0x4801('0x9')]('VoiceContext',attributes,{'tableName':_0x4801('0xa'),'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 c8a3b64..a8d6e30 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 _0x5269=['../../config/environment','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','ioredis','../../mysqldb','../../config/utils'];(function(_0x750023,_0x367b1f){var _0xf6bc98=function(_0x3ef7b7){while(--_0x3ef7b7){_0x750023['push'](_0x750023['shift']());}};_0xf6bc98(++_0x367b1f);}(_0x5269,0x150));var _0x9526=function(_0x5d06c5,_0x30cdf8){_0x5d06c5=_0x5d06c5-0x0;var _0x1940ad=_0x5269[_0x5d06c5];return _0x1940ad;};'use strict';var _=require(_0x9526('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9526('0x1'));var db=require(_0x9526('0x2'))['db'];var utils=require(_0x9526('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x9526('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x9526('0x5')][_0x9526('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2e217a,_0x2082b4,_0x1d4acf){return new BPromise(function(_0x4569a0,_0x161880){return client[_0x9526('0x7')](_0x2e217a,_0x1d4acf)[_0x9526('0x8')](function(_0x320908){logger[_0x9526('0x9')](_0x9526('0xa'),_0x2082b4,'request\x20sent');logger[_0x9526('0xb')](_0x9526('0xc'),_0x2082b4,'request\x20sent',JSON[_0x9526('0xd')](_0x320908));if(_0x320908[_0x9526('0xe')]){if(_0x320908[_0x9526('0xe')][_0x9526('0xf')]===0x1f4){logger[_0x9526('0xe')](_0x9526('0xa'),_0x2082b4,_0x320908[_0x9526('0xe')]['message']);return _0x161880(_0x320908[_0x9526('0xe')][_0x9526('0x10')]);}logger['error'](_0x9526('0xa'),_0x2082b4,_0x320908[_0x9526('0xe')]['message']);return _0x4569a0(_0x320908['error']['message']);}else{logger[_0x9526('0x9')]('VoiceContext,\x20%s,\x20%s',_0x2082b4,_0x9526('0x11'));_0x4569a0(_0x320908[_0x9526('0x12')][_0x9526('0x10')]);}})[_0x9526('0x13')](function(_0x3108ba){logger[_0x9526('0xe')]('VoiceContext,\x20%s,\x20%s',_0x2082b4,_0x3108ba);_0x161880(_0x3108ba);});});} \ No newline at end of file +var _0xd1d3=['rpc','../../config/environment','client','http','request','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','util','moment','../../mysqldb','../../config/utils'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xd1d3,0x68));var _0x3d1d=function(_0x627b12,_0x46d3f2){_0x627b12=_0x627b12-0x0;var _0x348bc3=_0xd1d3[_0x627b12];return _0x348bc3;};'use strict';var _=require('lodash');var util=require(_0x3d1d('0x0'));var moment=require(_0x3d1d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3d1d('0x2'))['db'];var utils=require(_0x3d1d('0x3'));var logger=require('../../config/logger')(_0x3d1d('0x4'));var config=require(_0x3d1d('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x3d1d('0x6')][_0x3d1d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x11abf9,_0x56b91c,_0x471516){return new BPromise(function(_0x130bbc,_0x5c41d7){return client[_0x3d1d('0x8')](_0x11abf9,_0x471516)['then'](function(_0x7e1ae2){logger['info'](_0x3d1d('0x9'),_0x56b91c,'request\x20sent');logger[_0x3d1d('0xa')](_0x3d1d('0xb'),_0x56b91c,_0x3d1d('0xc'),JSON['stringify'](_0x7e1ae2));if(_0x7e1ae2['error']){if(_0x7e1ae2['error']['code']===0x1f4){logger[_0x3d1d('0xd')]('VoiceContext,\x20%s,\x20%s',_0x56b91c,_0x7e1ae2[_0x3d1d('0xd')][_0x3d1d('0xe')]);return _0x5c41d7(_0x7e1ae2['error'][_0x3d1d('0xe')]);}logger[_0x3d1d('0xd')](_0x3d1d('0x9'),_0x56b91c,_0x7e1ae2[_0x3d1d('0xd')][_0x3d1d('0xe')]);return _0x130bbc(_0x7e1ae2['error'][_0x3d1d('0xe')]);}else{logger[_0x3d1d('0xf')](_0x3d1d('0x9'),_0x56b91c,_0x3d1d('0xc'));_0x130bbc(_0x7e1ae2[_0x3d1d('0x10')][_0x3d1d('0xe')]);}})[_0x3d1d('0x11')](function(_0x51c3a9){logger[_0x3d1d('0xd')](_0x3d1d('0x9'),_0x56b91c,_0x51c3a9);_0x5c41d7(_0x51c3a9);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 00fd55d..94be555 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 _0xb81a=['express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','exports','util'];(function(_0x481e1e,_0x56649c){var _0x50c2ad=function(_0x4ba33a){while(--_0x4ba33a){_0x481e1e['push'](_0x481e1e['shift']());}};_0x50c2ad(++_0x56649c);}(_0xb81a,0x186));var _0xab81=function(_0x1985bf,_0xb3aead){_0x1985bf=_0x1985bf-0x0;var _0x6ca8d=_0xb81a[_0x1985bf];return _0x6ca8d;};'use strict';var multer=require('multer');var util=require(_0xab81('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xab81('0x1'));var router=express[_0xab81('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xab81('0x3'));var config=require(_0xab81('0x4'));var controller=require('./voiceDialReport.controller');router[_0xab81('0x5')]('/',auth[_0xab81('0x6')](),controller['index']);router['get'](_0xab81('0x7'),auth[_0xab81('0x6')](),controller[_0xab81('0x8')]);router[_0xab81('0x5')](_0xab81('0x9'),auth['isAuthenticated'](),controller[_0xab81('0xa')]);router[_0xab81('0xb')]('/',auth['isAuthenticated'](),controller[_0xab81('0xc')]);router[_0xab81('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xab81('0xe')]);router[_0xab81('0xf')](_0xab81('0x9'),auth[_0xab81('0x6')](),controller['destroy']);module[_0xab81('0x10')]=router; \ No newline at end of file +var _0x9751=['destroy','exports','multer','util','connect-timeout','express','fs-extra','../../config/environment','./voiceDialReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','create','put','update'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x9751,0x145));var _0x1975=function(_0xd0e429,_0x35a0af){_0xd0e429=_0xd0e429-0x0;var _0x243b77=_0x9751[_0xd0e429];return _0x243b77;};'use strict';var multer=require(_0x1975('0x0'));var util=require(_0x1975('0x1'));var path=require('path');var timeout=require(_0x1975('0x2'));var express=require(_0x1975('0x3'));var router=express['Router']();var fs_extra=require(_0x1975('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1975('0x5'));var controller=require(_0x1975('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x1975('0x7')]);router[_0x1975('0x8')](_0x1975('0x9'),auth[_0x1975('0xa')](),controller[_0x1975('0xb')]);router['get'](_0x1975('0xc'),auth[_0x1975('0xa')](),controller[_0x1975('0xd')]);router['post']('/',auth[_0x1975('0xa')](),controller[_0x1975('0xe')]);router[_0x1975('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x1975('0x10')]);router['delete']('/:id',auth[_0x1975('0xa')](),controller[_0x1975('0x11')]);module[_0x1975('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index a879f68..fe6628a 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 _0x9957=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x492ddf,_0x95f6ff){var _0x3ae873=function(_0x688052){while(--_0x688052){_0x492ddf['push'](_0x492ddf['shift']());}};_0x3ae873(++_0x95f6ff);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'privilege':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize[_0x7995('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x7995('0x2')]},'calleridnum':{'type':Sequelize[_0x7995('0x2')]},'calleridname':{'type':Sequelize[_0x7995('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'context':{'type':Sequelize[_0x7995('0x2')]},'exten':{'type':Sequelize[_0x7995('0x2')]},'priority':{'type':Sequelize[_0x7995('0x3')]},'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x7995('0x2')]},'destchannelstate':{'type':Sequelize[_0x7995('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x7995('0x2')]},'destcalleridname':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7995('0x2')]},'destlanguage':{'type':Sequelize[_0x7995('0x2')]},'destaccountcode':{'type':Sequelize[_0x7995('0x2')]},'destcontext':{'type':Sequelize[_0x7995('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x7995('0x3')]},'destuniqueid':{'type':Sequelize[_0x7995('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x7995('0x2')]},'dialstatus':{'type':Sequelize[_0x7995('0x2')]},'starttime':{'type':Sequelize[_0x7995('0x4')]},'answertime':{'type':Sequelize[_0x7995('0x4')]},'endtime':{'type':Sequelize[_0x7995('0x4')]},'lastevent':{'type':Sequelize[_0x7995('0x2')],'comment':_0x7995('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x7995('0x3')]},'billableseconds':{'type':Sequelize[_0x7995('0x3')]}}; \ No newline at end of file +var _0x9f62=['exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0x9f62,0x154));var _0x29f6=function(_0x2a64e4,_0x34f803){_0x2a64e4=_0x2a64e4-0x0;var _0xabed1b=_0x9f62[_0x2a64e4];return _0xabed1b;};'use strict';var Sequelize=require('sequelize');module[_0x29f6('0x0')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x29f6('0x1')]},'channelstate':{'type':Sequelize[_0x29f6('0x2')]},'channelstatedesc':{'type':Sequelize[_0x29f6('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x29f6('0x1')]},'connectedlinename':{'type':Sequelize[_0x29f6('0x1')]},'language':{'type':Sequelize[_0x29f6('0x1')]},'accountcode':{'type':Sequelize[_0x29f6('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x29f6('0x1')]},'priority':{'type':Sequelize[_0x29f6('0x2')]},'uniqueid':{'type':Sequelize[_0x29f6('0x1')]},'linkedid':{'type':Sequelize[_0x29f6('0x1')]},'destchannel':{'type':Sequelize[_0x29f6('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x29f6('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x29f6('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x29f6('0x1')]},'destexten':{'type':Sequelize[_0x29f6('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x29f6('0x1')]},'destlinkedid':{'type':Sequelize[_0x29f6('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x29f6('0x3')]},'lastevent':{'type':Sequelize[_0x29f6('0x1')],'comment':_0x29f6('0x4')},'routeId':{'type':Sequelize[_0x29f6('0x2')]},'duration':{'type':Sequelize[_0x29f6('0x2')]},'holdtime':{'type':Sequelize[_0x29f6('0x2')]},'billableseconds':{'type':Sequelize[_0x29f6('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 68e178a..d5c82c1 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 _0x3113=['params','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','options','includeAll','include','rows','catch','show'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x3113,0xe7));var _0x3311=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3113[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x3311('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3311('0x1'));var jsonpatch=require(_0x3311('0x2'));var rp=require('request-promise');var moment=require(_0x3311('0x3'));var BPromise=require(_0x3311('0x4'));var Mustache=require(_0x3311('0x5'));var util=require(_0x3311('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x3311('0x7'));var ejs=require(_0x3311('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3311('0x9'));var squel=require(_0x3311('0xa'));var crypto=require(_0x3311('0xb'));var jsforce=require(_0x3311('0xc'));var deskjs=require(_0x3311('0xd'));var toCsv=require(_0x3311('0x7'));var querystring=require(_0x3311('0xe'));var Papa=require('papaparse');var Redis=require(_0x3311('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3311('0x10'));var as=require(_0x3311('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3311('0x12'))(_0x3311('0x13'));var utils=require(_0x3311('0x14'));var config=require(_0x3311('0x15'));var licenseUtil=require(_0x3311('0x16'));var db=require(_0x3311('0x17'))['db'];function respondWithStatusCode(_0x94b69,_0x31e1f7){_0x31e1f7=_0x31e1f7||0xcc;return function(_0x47d467){if(_0x47d467){return _0x94b69[_0x3311('0x18')](_0x31e1f7);}return _0x94b69[_0x3311('0x19')](_0x31e1f7)[_0x3311('0x1a')]();};}function respondWithResult(_0x461e5e,_0x5c5c28){_0x5c5c28=_0x5c5c28||0xc8;return function(_0x2b4e3d){if(_0x2b4e3d){return _0x461e5e[_0x3311('0x19')](_0x5c5c28)[_0x3311('0x1b')](_0x2b4e3d);}};}function respondWithFilteredResult(_0x374085,_0x334bda){return function(_0x18c98f){if(_0x18c98f){var _0x3b7c98=typeof _0x334bda[_0x3311('0x1c')]===_0x3311('0x1d')&&typeof _0x334bda[_0x3311('0x1e')]==='undefined';var _0x161a3c=_0x18c98f[_0x3311('0x1f')];var _0x344eef=_0x3b7c98?0x0:_0x334bda[_0x3311('0x1c')];var _0x4955e5=_0x3b7c98?_0x18c98f[_0x3311('0x1f')]:_0x334bda[_0x3311('0x1c')]+_0x334bda[_0x3311('0x1e')];var _0x2f4205;if(_0x4955e5>=_0x161a3c){_0x4955e5=_0x161a3c;_0x2f4205=0xc8;}else{_0x2f4205=0xce;}_0x374085[_0x3311('0x19')](_0x2f4205);return _0x374085['set'](_0x3311('0x20'),_0x344eef+'-'+_0x4955e5+'/'+_0x161a3c)['json'](_0x18c98f);}return null;};}function patchUpdates(_0x371169){return function(_0x4ec5ef){try{jsonpatch[_0x3311('0x21')](_0x4ec5ef,_0x371169,!![]);}catch(_0x419bc7){return BPromise[_0x3311('0x22')](_0x419bc7);}return _0x4ec5ef[_0x3311('0x23')]();};}function saveUpdates(_0x2b195c,_0x4567cf){return function(_0x2888f0){if(_0x2888f0){return _0x2888f0[_0x3311('0x24')](_0x2b195c)[_0x3311('0x25')](function(_0x4c3d4e){return _0x4c3d4e;});}return null;};}function removeEntity(_0x171b07,_0x3e2dfe){return function(_0x27bb10){if(_0x27bb10){return _0x27bb10['destroy']()[_0x3311('0x25')](function(){_0x171b07[_0x3311('0x19')](0xcc)[_0x3311('0x1a')]();});}};}function handleEntityNotFound(_0x19fc4b,_0x4d0f82){return function(_0xe58ed6){if(!_0xe58ed6){_0x19fc4b[_0x3311('0x18')](0x194);}return _0xe58ed6;};}function handleError(_0x2b5219,_0x23e906){_0x23e906=_0x23e906||0x1f4;return function(_0x6ca3fc){logger[_0x3311('0x26')](_0x6ca3fc[_0x3311('0x27')]);if(_0x6ca3fc['name']){delete _0x6ca3fc[_0x3311('0x28')];}_0x2b5219['status'](_0x23e906)[_0x3311('0x29')](_0x6ca3fc);};}exports['index']=function(_0x2b58c0,_0x17612b){var _0x13a1a5={},_0x3b286d={},_0x43e9f2={'count':0x0,'rows':[]};var _0x50e746=_[_0x3311('0x2a')](db[_0x3311('0x2b')][_0x3311('0x2c')],function(_0x5c14c6){return{'name':_0x5c14c6[_0x3311('0x2d')],'type':_0x5c14c6[_0x3311('0x2e')][_0x3311('0x2f')]};});_0x3b286d[_0x3311('0x30')]=_[_0x3311('0x2a')](_0x50e746,'name');_0x3b286d[_0x3311('0x31')]=_[_0x3311('0x32')](_0x2b58c0['query']);_0x3b286d[_0x3311('0x33')]=_['intersection'](_0x3b286d[_0x3311('0x30')],_0x3b286d[_0x3311('0x31')]);_0x13a1a5[_0x3311('0x34')]=_[_0x3311('0x35')](_0x3b286d['model'],qs['fields'](_0x2b58c0['query'][_0x3311('0x36')]));_0x13a1a5[_0x3311('0x34')]=_0x13a1a5[_0x3311('0x34')][_0x3311('0x37')]?_0x13a1a5[_0x3311('0x34')]:_0x3b286d[_0x3311('0x30')];if(!_0x2b58c0[_0x3311('0x31')][_0x3311('0x38')](_0x3311('0x39'))){_0x13a1a5[_0x3311('0x1e')]=qs[_0x3311('0x1e')](_0x2b58c0[_0x3311('0x31')][_0x3311('0x1e')]);_0x13a1a5[_0x3311('0x1c')]=qs['offset'](_0x2b58c0['query'][_0x3311('0x1c')]);}_0x13a1a5[_0x3311('0x3a')]=qs['sort'](_0x2b58c0['query']['sort']);_0x13a1a5['where']=qs[_0x3311('0x33')](_[_0x3311('0x3b')](_0x2b58c0[_0x3311('0x31')],_0x3b286d[_0x3311('0x33')]),_0x50e746);if(_0x2b58c0[_0x3311('0x31')][_0x3311('0x3c')]){_0x13a1a5[_0x3311('0x3d')]=_[_0x3311('0x3e')](_0x13a1a5[_0x3311('0x3d')],{'$or':_['map'](_0x50e746,function(_0x129af9){if(_0x129af9[_0x3311('0x2e')]!=='VIRTUAL'){var _0x276e82={};_0x276e82[_0x129af9[_0x3311('0x28')]]={'$like':'%'+_0x2b58c0[_0x3311('0x31')][_0x3311('0x3c')]+'%'};return _0x276e82;}})});}_0x13a1a5=_['merge']({},_0x13a1a5,_0x2b58c0[_0x3311('0x3f')]);var _0x42051a={'where':_0x13a1a5[_0x3311('0x3d')]};return db[_0x3311('0x2b')][_0x3311('0x1f')](_0x42051a)[_0x3311('0x25')](function(_0x298b05){_0x43e9f2['count']=_0x298b05;if(_0x2b58c0['query'][_0x3311('0x40')]){_0x13a1a5[_0x3311('0x41')]=[{'all':!![]}];}return db[_0x3311('0x2b')]['findAll'](_0x13a1a5);})[_0x3311('0x25')](function(_0x56cebb){_0x43e9f2[_0x3311('0x42')]=_0x56cebb;return _0x43e9f2;})[_0x3311('0x25')](respondWithFilteredResult(_0x17612b,_0x13a1a5))[_0x3311('0x43')](handleError(_0x17612b,null));};exports[_0x3311('0x44')]=function(_0x91d5fe,_0xdb1ff0){var _0x30d679={'raw':!![],'where':{'id':_0x91d5fe[_0x3311('0x45')]['id']}},_0x480904={};_0x480904[_0x3311('0x30')]=_['keys'](db[_0x3311('0x2b')][_0x3311('0x2c')]);_0x480904[_0x3311('0x31')]=_[_0x3311('0x32')](_0x91d5fe['query']);_0x480904['filters']=_[_0x3311('0x35')](_0x480904['model'],_0x480904[_0x3311('0x31')]);_0x30d679[_0x3311('0x34')]=_['intersection'](_0x480904[_0x3311('0x30')],qs[_0x3311('0x36')](_0x91d5fe[_0x3311('0x31')][_0x3311('0x36')]));_0x30d679[_0x3311('0x34')]=_0x30d679[_0x3311('0x34')]['length']?_0x30d679[_0x3311('0x34')]:_0x480904[_0x3311('0x30')];if(_0x91d5fe['query'][_0x3311('0x40')]){_0x30d679['include']=[{'all':!![]}];}_0x30d679=_[_0x3311('0x3e')]({},_0x30d679,_0x91d5fe[_0x3311('0x3f')]);return db[_0x3311('0x2b')][_0x3311('0x46')](_0x30d679)['then'](handleEntityNotFound(_0xdb1ff0,null))['then'](respondWithResult(_0xdb1ff0,null))['catch'](handleError(_0xdb1ff0,null));};exports['create']=function(_0x3676ef,_0x507bce){return db['VoiceDialReport'][_0x3311('0x47')](_0x3676ef['body'],{})[_0x3311('0x25')](respondWithResult(_0x507bce,0xc9))[_0x3311('0x43')](handleError(_0x507bce,null));};exports['update']=function(_0x4f8495,_0x11d9e2){if(_0x4f8495[_0x3311('0x48')]['id']){delete _0x4f8495['body']['id'];}return db[_0x3311('0x2b')][_0x3311('0x46')]({'where':{'id':_0x4f8495[_0x3311('0x45')]['id']}})[_0x3311('0x25')](handleEntityNotFound(_0x11d9e2,null))[_0x3311('0x25')](saveUpdates(_0x4f8495['body'],null))[_0x3311('0x25')](respondWithResult(_0x11d9e2,null))[_0x3311('0x43')](handleError(_0x11d9e2,null));};exports[_0x3311('0x49')]=function(_0x3339d7,_0x1feb55){return db[_0x3311('0x2b')][_0x3311('0x46')]({'where':{'id':_0x3339d7[_0x3311('0x45')]['id']}})[_0x3311('0x25')](handleEntityNotFound(_0x1feb55,null))['then'](removeEntity(_0x1feb55,null))[_0x3311('0x43')](handleError(_0x1feb55,null));};exports[_0x3311('0x4a')]=function(_0x169e72,_0x70466b){return db[_0x3311('0x2b')][_0x3311('0x4a')]()['then'](respondWithResult(_0x70466b,null))[_0x3311('0x43')](handleError(_0x70466b,null));}; \ No newline at end of file +var _0x3168=['key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','VoiceDialReport','include','findAll','rows','catch','includeAll','find','create','body','params','describe','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type'];(function(_0x3f223e,_0x57710a){var _0x4d830b=function(_0x32e03b){while(--_0x32e03b){_0x3f223e['push'](_0x3f223e['shift']());}};_0x4d830b(++_0x57710a);}(_0x3168,0xae));var _0x8316=function(_0x5aef69,_0x35841c){_0x5aef69=_0x5aef69-0x0;var _0x22fb2b=_0x3168[_0x5aef69];return _0x22fb2b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8316('0x0'));var jsonpatch=require(_0x8316('0x1'));var rp=require(_0x8316('0x2'));var moment=require(_0x8316('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x8316('0x4'));var sox=require('sox');var csv=require(_0x8316('0x5'));var ejs=require(_0x8316('0x6'));var fs=require('fs');var fs_extra=require(_0x8316('0x7'));var _=require(_0x8316('0x8'));var squel=require(_0x8316('0x9'));var crypto=require(_0x8316('0xa'));var jsforce=require(_0x8316('0xb'));var deskjs=require(_0x8316('0xc'));var toCsv=require(_0x8316('0x5'));var querystring=require(_0x8316('0xd'));var Papa=require('papaparse');var Redis=require(_0x8316('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8316('0xf'));var logger=require(_0x8316('0x10'))(_0x8316('0x11'));var utils=require(_0x8316('0x12'));var config=require(_0x8316('0x13'));var licenseUtil=require(_0x8316('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x409c9d,_0x4658ba){_0x4658ba=_0x4658ba||0xcc;return function(_0x268d45){if(_0x268d45){return _0x409c9d[_0x8316('0x15')](_0x4658ba);}return _0x409c9d['status'](_0x4658ba)[_0x8316('0x16')]();};}function respondWithResult(_0x2250d5,_0x1e1444){_0x1e1444=_0x1e1444||0xc8;return function(_0x508da2){if(_0x508da2){return _0x2250d5[_0x8316('0x17')](_0x1e1444)[_0x8316('0x18')](_0x508da2);}};}function respondWithFilteredResult(_0x1eb6b8,_0x56ab18){return function(_0x5cd34e){if(_0x5cd34e){var _0x25d7ea=typeof _0x56ab18['offset']===_0x8316('0x19')&&typeof _0x56ab18[_0x8316('0x1a')]===_0x8316('0x19');var _0x40764c=_0x5cd34e[_0x8316('0x1b')];var _0x28ea1b=_0x25d7ea?0x0:_0x56ab18[_0x8316('0x1c')];var _0x2e96b5=_0x25d7ea?_0x5cd34e[_0x8316('0x1b')]:_0x56ab18['offset']+_0x56ab18[_0x8316('0x1a')];var _0x58bbaa;if(_0x2e96b5>=_0x40764c){_0x2e96b5=_0x40764c;_0x58bbaa=0xc8;}else{_0x58bbaa=0xce;}_0x1eb6b8[_0x8316('0x17')](_0x58bbaa);return _0x1eb6b8['set'](_0x8316('0x1d'),_0x28ea1b+'-'+_0x2e96b5+'/'+_0x40764c)[_0x8316('0x18')](_0x5cd34e);}return null;};}function patchUpdates(_0x3e3bfe){return function(_0x221e02){try{jsonpatch[_0x8316('0x1e')](_0x221e02,_0x3e3bfe,!![]);}catch(_0x9e3b5c){return BPromise[_0x8316('0x1f')](_0x9e3b5c);}return _0x221e02[_0x8316('0x20')]();};}function saveUpdates(_0x4e828f,_0x58e64e){return function(_0x180d44){if(_0x180d44){return _0x180d44[_0x8316('0x21')](_0x4e828f)[_0x8316('0x22')](function(_0x57c0a2){return _0x57c0a2;});}return null;};}function removeEntity(_0x4d7c1e,_0x47e6e6){return function(_0x3b66dc){if(_0x3b66dc){return _0x3b66dc[_0x8316('0x23')]()[_0x8316('0x22')](function(){_0x4d7c1e[_0x8316('0x17')](0xcc)[_0x8316('0x16')]();});}};}function handleEntityNotFound(_0x5d3de6,_0x33e1ec){return function(_0x446f98){if(!_0x446f98){_0x5d3de6[_0x8316('0x15')](0x194);}return _0x446f98;};}function handleError(_0x400056,_0x1c4ecb){_0x1c4ecb=_0x1c4ecb||0x1f4;return function(_0xe54170){logger[_0x8316('0x24')](_0xe54170[_0x8316('0x25')]);if(_0xe54170[_0x8316('0x26')]){delete _0xe54170[_0x8316('0x26')];}_0x400056[_0x8316('0x17')](_0x1c4ecb)[_0x8316('0x27')](_0xe54170);};}exports[_0x8316('0x28')]=function(_0x1ac40a,_0xfbfc95){var _0x52fcc2={},_0x194b7f={},_0x8e1d2e={'count':0x0,'rows':[]};var _0x4ef94b=_[_0x8316('0x29')](db['VoiceDialReport'][_0x8316('0x2a')],function(_0x265907){return{'name':_0x265907[_0x8316('0x2b')],'type':_0x265907[_0x8316('0x2c')][_0x8316('0x2d')]};});_0x194b7f[_0x8316('0x2e')]=_[_0x8316('0x29')](_0x4ef94b,'name');_0x194b7f[_0x8316('0x2f')]=_[_0x8316('0x30')](_0x1ac40a[_0x8316('0x2f')]);_0x194b7f[_0x8316('0x31')]=_[_0x8316('0x32')](_0x194b7f[_0x8316('0x2e')],_0x194b7f[_0x8316('0x2f')]);_0x52fcc2[_0x8316('0x33')]=_[_0x8316('0x32')](_0x194b7f[_0x8316('0x2e')],qs[_0x8316('0x34')](_0x1ac40a['query'][_0x8316('0x34')]));_0x52fcc2[_0x8316('0x33')]=_0x52fcc2[_0x8316('0x33')][_0x8316('0x35')]?_0x52fcc2[_0x8316('0x33')]:_0x194b7f[_0x8316('0x2e')];if(!_0x1ac40a['query']['hasOwnProperty'](_0x8316('0x36'))){_0x52fcc2['limit']=qs[_0x8316('0x1a')](_0x1ac40a[_0x8316('0x2f')][_0x8316('0x1a')]);_0x52fcc2[_0x8316('0x1c')]=qs[_0x8316('0x1c')](_0x1ac40a[_0x8316('0x2f')]['offset']);}_0x52fcc2['order']=qs[_0x8316('0x37')](_0x1ac40a[_0x8316('0x2f')][_0x8316('0x37')]);_0x52fcc2['where']=qs['filters'](_[_0x8316('0x38')](_0x1ac40a[_0x8316('0x2f')],_0x194b7f[_0x8316('0x31')]),_0x4ef94b);if(_0x1ac40a[_0x8316('0x2f')][_0x8316('0x39')]){_0x52fcc2[_0x8316('0x3a')]=_['merge'](_0x52fcc2[_0x8316('0x3a')],{'$or':_[_0x8316('0x29')](_0x4ef94b,function(_0x5d45f1){if(_0x5d45f1[_0x8316('0x2c')]!==_0x8316('0x3b')){var _0x498a42={};_0x498a42[_0x5d45f1[_0x8316('0x26')]]={'$like':'%'+_0x1ac40a[_0x8316('0x2f')][_0x8316('0x39')]+'%'};return _0x498a42;}})});}_0x52fcc2=_[_0x8316('0x3c')]({},_0x52fcc2,_0x1ac40a[_0x8316('0x3d')]);var _0x5d5b50={'where':_0x52fcc2[_0x8316('0x3a')]};return db[_0x8316('0x3e')]['count'](_0x5d5b50)['then'](function(_0x59513b){_0x8e1d2e[_0x8316('0x1b')]=_0x59513b;if(_0x1ac40a['query']['includeAll']){_0x52fcc2[_0x8316('0x3f')]=[{'all':!![]}];}return db[_0x8316('0x3e')][_0x8316('0x40')](_0x52fcc2);})[_0x8316('0x22')](function(_0x5a2b9f){_0x8e1d2e[_0x8316('0x41')]=_0x5a2b9f;return _0x8e1d2e;})['then'](respondWithFilteredResult(_0xfbfc95,_0x52fcc2))[_0x8316('0x42')](handleError(_0xfbfc95,null));};exports['show']=function(_0x5392a2,_0x2018b0){var _0x243beb={'raw':!![],'where':{'id':_0x5392a2['params']['id']}},_0x290e03={};_0x290e03[_0x8316('0x2e')]=_[_0x8316('0x30')](db[_0x8316('0x3e')][_0x8316('0x2a')]);_0x290e03[_0x8316('0x2f')]=_[_0x8316('0x30')](_0x5392a2['query']);_0x290e03[_0x8316('0x31')]=_['intersection'](_0x290e03[_0x8316('0x2e')],_0x290e03[_0x8316('0x2f')]);_0x243beb[_0x8316('0x33')]=_[_0x8316('0x32')](_0x290e03['model'],qs[_0x8316('0x34')](_0x5392a2['query'][_0x8316('0x34')]));_0x243beb[_0x8316('0x33')]=_0x243beb[_0x8316('0x33')][_0x8316('0x35')]?_0x243beb['attributes']:_0x290e03[_0x8316('0x2e')];if(_0x5392a2['query'][_0x8316('0x43')]){_0x243beb[_0x8316('0x3f')]=[{'all':!![]}];}_0x243beb=_[_0x8316('0x3c')]({},_0x243beb,_0x5392a2[_0x8316('0x3d')]);return db[_0x8316('0x3e')][_0x8316('0x44')](_0x243beb)[_0x8316('0x22')](handleEntityNotFound(_0x2018b0,null))['then'](respondWithResult(_0x2018b0,null))['catch'](handleError(_0x2018b0,null));};exports[_0x8316('0x45')]=function(_0x3c357d,_0x476dd3){return db[_0x8316('0x3e')][_0x8316('0x45')](_0x3c357d[_0x8316('0x46')],{})[_0x8316('0x22')](respondWithResult(_0x476dd3,0xc9))[_0x8316('0x42')](handleError(_0x476dd3,null));};exports['update']=function(_0x511bf6,_0x2b6e0e){if(_0x511bf6[_0x8316('0x46')]['id']){delete _0x511bf6[_0x8316('0x46')]['id'];}return db[_0x8316('0x3e')][_0x8316('0x44')]({'where':{'id':_0x511bf6[_0x8316('0x47')]['id']}})['then'](handleEntityNotFound(_0x2b6e0e,null))['then'](saveUpdates(_0x511bf6[_0x8316('0x46')],null))[_0x8316('0x22')](respondWithResult(_0x2b6e0e,null))[_0x8316('0x42')](handleError(_0x2b6e0e,null));};exports['destroy']=function(_0x3caf55,_0x195ef8){return db[_0x8316('0x3e')][_0x8316('0x44')]({'where':{'id':_0x3caf55[_0x8316('0x47')]['id']}})[_0x8316('0x22')](handleEntityNotFound(_0x195ef8,null))[_0x8316('0x22')](removeEntity(_0x195ef8,null))[_0x8316('0x42')](handleError(_0x195ef8,null));};exports[_0x8316('0x48')]=function(_0x4f83d2,_0x453aeb){return db['VoiceDialReport'][_0x8316('0x48')]()['then'](respondWithResult(_0x453aeb,null))[_0x8316('0x42')](handleError(_0x453aeb,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 1b1c4bf..44bd9d2 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 _0x32f6=['report_dial','uniqueid','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','VoiceDialReport'];(function(_0x21f403,_0x209e8d){var _0x470dec=function(_0x1336eb){while(--_0x1336eb){_0x21f403['push'](_0x21f403['shift']());}};_0x470dec(++_0x209e8d);}(_0x32f6,0xbd));var _0x632f=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x32f6[_0x199572];return _0x13cfa3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x632f('0x0'))(_0x632f('0x1'));var moment=require('moment');var BPromise=require(_0x632f('0x2'));var rp=require(_0x632f('0x3'));var fs=require('fs');var path=require(_0x632f('0x4'));var rimraf=require(_0x632f('0x5'));var config=require(_0x632f('0x6'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x4cead1,_0x5f3464){return _0x4cead1[_0x632f('0x7')](_0x632f('0x8'),attributes,{'tableName':_0x632f('0x9'),'paranoid':![],'indexes':[{'fields':[_0x632f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4ad3=['../../config/environment','exports','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4ad3,0x150));var _0x34ad=function(_0x59d32c,_0x306b7a){_0x59d32c=_0x59d32c-0x0;var _0x26e818=_0x4ad3[_0x59d32c];return _0x26e818;};'use strict';var _=require(_0x34ad('0x0'));var util=require(_0x34ad('0x1'));var logger=require(_0x34ad('0x2'))(_0x34ad('0x3'));var moment=require(_0x34ad('0x4'));var BPromise=require(_0x34ad('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x34ad('0x6'));var attributes=require('./voiceDialReport.attributes');module[_0x34ad('0x7')]=function(_0x3b2317,_0x200d13){return _0x3b2317[_0x34ad('0x8')]('VoiceDialReport',attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 8b365c9..0957d7f 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 _0xacf0=['VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','debug','catch','UpdateVoiceDialReport','where','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','info','request\x20sent'];(function(_0xb1a84d,_0x383b93){var _0x3ef4dc=function(_0x1218af){while(--_0x1218af){_0xb1a84d['push'](_0xb1a84d['shift']());}};_0x3ef4dc(++_0x383b93);}(_0xacf0,0x1c4));var _0x0acf=function(_0x149f24,_0x468c28){_0x149f24=_0x149f24-0x0;var _0x239293=_0xacf0[_0x149f24];return _0x239293;};'use strict';var _=require('lodash');var util=require(_0x0acf('0x0'));var moment=require(_0x0acf('0x1'));var BPromise=require(_0x0acf('0x2'));var rs=require(_0x0acf('0x3'));var fs=require('fs');var Redis=require(_0x0acf('0x4'));var db=require(_0x0acf('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x0acf('0x6'));var jayson=require(_0x0acf('0x7'));var client=jayson[_0x0acf('0x8')][_0x0acf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x147fa8,_0x5ab804,_0x3ca9ed){return new BPromise(function(_0x9c343,_0x4436ed){return client[_0x0acf('0xa')](_0x147fa8,_0x3ca9ed)['then'](function(_0x5b7e3c){logger[_0x0acf('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x5ab804,_0x0acf('0xc'));logger['debug'](_0x0acf('0xd'),_0x5ab804,'request\x20sent',JSON[_0x0acf('0xe')](_0x5b7e3c));if(_0x5b7e3c[_0x0acf('0xf')]){if(_0x5b7e3c['error'][_0x0acf('0x10')]===0x1f4){logger[_0x0acf('0xf')](_0x0acf('0x11'),_0x5ab804,_0x5b7e3c[_0x0acf('0xf')][_0x0acf('0x12')]);return _0x4436ed(_0x5b7e3c[_0x0acf('0xf')]['message']);}logger[_0x0acf('0xf')](_0x0acf('0x11'),_0x5ab804,_0x5b7e3c[_0x0acf('0xf')][_0x0acf('0x12')]);return _0x9c343(_0x5b7e3c['error'][_0x0acf('0x12')]);}else{logger[_0x0acf('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x5ab804,_0x0acf('0xc'));_0x9c343(_0x5b7e3c[_0x0acf('0x13')]['message']);}})['catch'](function(_0x346b00){logger['error'](_0x0acf('0x11'),_0x5ab804,_0x346b00);_0x4436ed(_0x346b00);});});}exports[_0x0acf('0x14')]=function(_0x19f61){var _0x5e0189=this;return new Promise(function(_0x4b8305,_0x3806bf){return db[_0x0acf('0x15')][_0x0acf('0x16')](_0x19f61[_0x0acf('0x17')],{'raw':_0x19f61[_0x0acf('0x18')]?_0x19f61[_0x0acf('0x18')][_0x0acf('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x5a8a89){logger[_0x0acf('0xb')](_0x0acf('0x14'),_0x19f61);logger[_0x0acf('0x1a')]('CreateVoiceDialReport',_0x19f61,JSON['stringify'](_0x5a8a89));_0x4b8305(_0x5a8a89);})[_0x0acf('0x1b')](function(_0xd32844){logger[_0x0acf('0xf')](_0x0acf('0x14'),_0xd32844[_0x0acf('0x12')],_0x19f61);_0x3806bf(_0x5e0189[_0x0acf('0xf')](0x1f4,_0xd32844[_0x0acf('0x12')]));});});};exports[_0x0acf('0x1c')]=function(_0x5a7801){var _0x56fb55=this;return new Promise(function(_0x19a3a9,_0x1a25a9){return db[_0x0acf('0x15')]['update'](_0x5a7801[_0x0acf('0x17')],{'raw':_0x5a7801[_0x0acf('0x18')]?_0x5a7801[_0x0acf('0x18')][_0x0acf('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a7801[_0x0acf('0x18')]?_0x5a7801[_0x0acf('0x18')][_0x0acf('0x1d')]||null:null,'attributes':_0x5a7801[_0x0acf('0x18')]?_0x5a7801[_0x0acf('0x18')]['attributes']||null:null,'limit':_0x5a7801[_0x0acf('0x18')]?_0x5a7801['options']['limit']||null:null})[_0x0acf('0x1e')](function(_0x376d69){logger[_0x0acf('0xb')]('UpdateVoiceDialReport',_0x5a7801);logger[_0x0acf('0x1a')](_0x0acf('0x1c'),_0x5a7801,JSON[_0x0acf('0xe')](_0x376d69));_0x19a3a9(_0x376d69);})['catch'](function(_0x3bbdaa){logger['error'](_0x0acf('0x1c'),_0x3bbdaa[_0x0acf('0x12')],_0x5a7801);_0x1a25a9(_0x56fb55[_0x0acf('0xf')](0x1f4,_0x3bbdaa['message']));});});}; \ No newline at end of file +var _0x3f62=['VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport','body','options','raw','UpdateVoiceDialReport','VoiceDialReport','update','where','limit','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug'];(function(_0x409941,_0xfbac18){var _0x402d0f=function(_0x364877){while(--_0x364877){_0x409941['push'](_0x409941['shift']());}};_0x402d0f(++_0xfbac18);}(_0x3f62,0xf0));var _0x23f6=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x3f62[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x23f6('0x0'));var util=require(_0x23f6('0x1'));var moment=require('moment');var BPromise=require(_0x23f6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x23f6('0x3'));var db=require(_0x23f6('0x4'))['db'];var utils=require(_0x23f6('0x5'));var logger=require(_0x23f6('0x6'))(_0x23f6('0x7'));var config=require(_0x23f6('0x8'));var jayson=require(_0x23f6('0x9'));var client=jayson['client'][_0x23f6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5bfe20,_0x3b65ab,_0x3a95db){return new BPromise(function(_0x441f38,_0x21d9f6){return client[_0x23f6('0xb')](_0x5bfe20,_0x3a95db)[_0x23f6('0xc')](function(_0x362d80){logger[_0x23f6('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x3b65ab,_0x23f6('0xe'));logger[_0x23f6('0xf')](_0x23f6('0x10'),_0x3b65ab,'request\x20sent',JSON[_0x23f6('0x11')](_0x362d80));if(_0x362d80['error']){if(_0x362d80[_0x23f6('0x12')]['code']===0x1f4){logger[_0x23f6('0x12')](_0x23f6('0x13'),_0x3b65ab,_0x362d80[_0x23f6('0x12')][_0x23f6('0x14')]);return _0x21d9f6(_0x362d80[_0x23f6('0x12')][_0x23f6('0x14')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x3b65ab,_0x362d80[_0x23f6('0x12')][_0x23f6('0x14')]);return _0x441f38(_0x362d80[_0x23f6('0x12')][_0x23f6('0x14')]);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x3b65ab,_0x23f6('0xe'));_0x441f38(_0x362d80[_0x23f6('0x15')][_0x23f6('0x14')]);}})[_0x23f6('0x16')](function(_0x41646f){logger[_0x23f6('0x12')](_0x23f6('0x13'),_0x3b65ab,_0x41646f);_0x21d9f6(_0x41646f);});});}exports[_0x23f6('0x17')]=function(_0x29ec7e){var _0x26e5d6=this;return new Promise(function(_0x566d85,_0x59f995){return db['VoiceDialReport']['create'](_0x29ec7e[_0x23f6('0x18')],{'raw':_0x29ec7e[_0x23f6('0x19')]?_0x29ec7e['options'][_0x23f6('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x56f979){logger[_0x23f6('0xd')](_0x23f6('0x17'),_0x29ec7e);logger[_0x23f6('0xf')](_0x23f6('0x17'),_0x29ec7e,JSON[_0x23f6('0x11')](_0x56f979));_0x566d85(_0x56f979);})[_0x23f6('0x16')](function(_0x15952f){logger[_0x23f6('0x12')](_0x23f6('0x17'),_0x15952f[_0x23f6('0x14')],_0x29ec7e);_0x59f995(_0x26e5d6[_0x23f6('0x12')](0x1f4,_0x15952f['message']));});});};exports[_0x23f6('0x1b')]=function(_0x2a7d28){var _0x21e48e=this;return new Promise(function(_0x3f3e08,_0x29c408){return db[_0x23f6('0x1c')][_0x23f6('0x1d')](_0x2a7d28['body'],{'raw':_0x2a7d28['options']?_0x2a7d28[_0x23f6('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a7d28['options']?_0x2a7d28[_0x23f6('0x19')][_0x23f6('0x1e')]||null:null,'attributes':_0x2a7d28[_0x23f6('0x19')]?_0x2a7d28['options']['attributes']||null:null,'limit':_0x2a7d28['options']?_0x2a7d28[_0x23f6('0x19')][_0x23f6('0x1f')]||null:null})[_0x23f6('0xc')](function(_0x35d833){logger[_0x23f6('0xd')](_0x23f6('0x1b'),_0x2a7d28);logger[_0x23f6('0xf')](_0x23f6('0x1b'),_0x2a7d28,JSON[_0x23f6('0x11')](_0x35d833));_0x3f3e08(_0x35d833);})[_0x23f6('0x16')](function(_0x3521df){logger[_0x23f6('0x12')](_0x23f6('0x1b'),_0x3521df[_0x23f6('0x14')],_0x2a7d28);_0x29c408(_0x21e48e['error'](0x1f4,_0x3521df[_0x23f6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index a4664d5..351b6a3 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 _0x4470=['index','/:id','isAuthenticated','show','post','create','addApplications','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get'];(function(_0x39758d,_0x346423){var _0x44ac11=function(_0x175008){while(--_0x175008){_0x39758d['push'](_0x39758d['shift']());}};_0x44ac11(++_0x346423);}(_0x4470,0xe8));var _0x0447=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x4470[_0x3b5250];return _0xc844a1;};'use strict';var multer=require(_0x0447('0x0'));var util=require(_0x0447('0x1'));var path=require(_0x0447('0x2'));var timeout=require('connect-timeout');var express=require(_0x0447('0x3'));var router=express[_0x0447('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0447('0x5'));var interaction=require(_0x0447('0x6'));var config=require(_0x0447('0x7'));var controller=require(_0x0447('0x8'));router[_0x0447('0x9')]('/',auth['isAuthenticated'](),controller[_0x0447('0xa')]);router[_0x0447('0x9')](_0x0447('0xb'),auth[_0x0447('0xc')](),controller[_0x0447('0xd')]);router[_0x0447('0xe')]('/',auth[_0x0447('0xc')](),controller[_0x0447('0xf')]);router[_0x0447('0xe')]('/:id/applications',auth[_0x0447('0xc')](),controller[_0x0447('0x10')]);router[_0x0447('0x11')]('/:id',auth[_0x0447('0xc')](),controller[_0x0447('0x12')]);router[_0x0447('0x13')](_0x0447('0xb'),auth[_0x0447('0xc')](),controller[_0x0447('0x14')]);module[_0x0447('0x15')]=router; \ No newline at end of file +var _0x9987=['create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show'];(function(_0x321575,_0x458292){var _0x147fc3=function(_0x55d3a6){while(--_0x55d3a6){_0x321575['push'](_0x321575['shift']());}};_0x147fc3(++_0x458292);}(_0x9987,0x9d));var _0x7998=function(_0x1e9f3f,_0x48f2bc){_0x1e9f3f=_0x1e9f3f-0x0;var _0x536d4b=_0x9987[_0x1e9f3f];return _0x536d4b;};'use strict';var multer=require(_0x7998('0x0'));var util=require(_0x7998('0x1'));var path=require(_0x7998('0x2'));var timeout=require(_0x7998('0x3'));var express=require('express');var router=express[_0x7998('0x4')]();var fs_extra=require(_0x7998('0x5'));var auth=require(_0x7998('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7998('0x7'));var controller=require(_0x7998('0x8'));router[_0x7998('0x9')]('/',auth[_0x7998('0xa')](),controller[_0x7998('0xb')]);router[_0x7998('0x9')](_0x7998('0xc'),auth[_0x7998('0xa')](),controller[_0x7998('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7998('0xe')]);router['post']('/:id/applications',auth[_0x7998('0xa')](),controller['addApplications']);router[_0x7998('0xf')](_0x7998('0xc'),auth[_0x7998('0xa')](),controller[_0x7998('0x10')]);router['delete'](_0x7998('0xc'),auth[_0x7998('0xa')](),controller[_0x7998('0x11')]);module[_0x7998('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index cb907a4..7494e39 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 _0xc7e4=['getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','outbound-fax','system','any','*,*,*,*','BOOLEAN','INTEGER','wav'];(function(_0xf62d7a,_0x2b2cbc){var _0x479a5d=function(_0x367d32){while(--_0x367d32){_0xf62d7a['push'](_0xf62d7a['shift']());}};_0x479a5d(++_0x2b2cbc);}(_0xc7e4,0x178));var _0x4c7e=function(_0x157c81,_0x2c0224){_0x157c81=_0x157c81-0x0;var _0x1bfb12=_0xc7e4[_0x157c81];return _0x1bfb12;};'use strict';var Sequelize=require(_0x4c7e('0x0'));module[_0x4c7e('0x1')]={'context':{'type':Sequelize[_0x4c7e('0x2')],'allowNull':![],'unique':_0x4c7e('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x4c7e('0x2')],'allowNull':![],'unique':_0x4c7e('0x3')},'priority':{'type':Sequelize[_0x4c7e('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x4c7e('0x3')},'tag':{'type':Sequelize[_0x4c7e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x4c7e('0x2')],'allowNull':![],'defaultValue':_0x4c7e('0x4')},'appdata':{'type':Sequelize[_0x4c7e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x4c7e('0x5'),_0x4c7e('0x6'),_0x4c7e('0x7'),'inbound-fax',_0x4c7e('0x8'),_0x4c7e('0x9'),_0x4c7e('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x4c7e('0x2')]},'interval':{'type':Sequelize[_0x4c7e('0x2')],'allowNull':![],'defaultValue':_0x4c7e('0xb')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x4c7e('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x4c7e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x4c7e('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x4c7e('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x4c7e('0xd')]},'recordingFormat':{'type':Sequelize[_0x4c7e('0x2')],'defaultValue':_0x4c7e('0xe')},'answer':{'type':Sequelize[_0x4c7e('0xc')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1fdf81){return this[_0x4c7e('0xf')](_0x4c7e('0x10'));}},'alias':{'type':Sequelize[_0x4c7e('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xcd3a=['BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','ENUM','inbound','outbound','internal','outbound-fax','any','*,*,*,*'];(function(_0xf1accd,_0x3e6849){var _0xd561ff=function(_0x1b20cd){while(--_0x1b20cd){_0xf1accd['push'](_0xf1accd['shift']());}};_0xd561ff(++_0x3e6849);}(_0xcd3a,0x1b5));var _0xacd3=function(_0x2215a2,_0x2e9688){_0x2215a2=_0x2215a2-0x0;var _0x1c081e=_0xcd3a[_0x2215a2];return _0x1c081e;};'use strict';var Sequelize=require(_0xacd3('0x0'));module[_0xacd3('0x1')]={'context':{'type':Sequelize[_0xacd3('0x2')],'allowNull':![],'unique':_0xacd3('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xacd3('0x2')],'allowNull':![],'unique':_0xacd3('0x3')},'priority':{'type':Sequelize[_0xacd3('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xacd3('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xacd3('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0xacd3('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xacd3('0x4')](_0xacd3('0x5'),_0xacd3('0x6'),_0xacd3('0x7'),'inbound-fax',_0xacd3('0x8'),'system',_0xacd3('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0xacd3('0x2')]},'interval':{'type':Sequelize[_0xacd3('0x2')],'allowNull':![],'defaultValue':_0xacd3('0xa')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0xacd3('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xacd3('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xacd3('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xacd3('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xacd3('0xc')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0xacd3('0xd')],'get':function(_0x5c7a46){return this[_0xacd3('0xe')](_0xacd3('0xf'));}},'alias':{'type':Sequelize[_0xacd3('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 448c804..c30262d 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 _0x7f49=['ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','json','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','internal','map','value','includes','type','find','UserProfileResource','stack','name','send','index','VoiceExtension','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','fields','create','body','exten','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','addApplications','sequelize','transaction','Transaction'];(function(_0x9b9584,_0x35b71c){var _0x3fd9c4=function(_0x400107){while(--_0x400107){_0x9b9584['push'](_0x9b9584['shift']());}};_0x3fd9c4(++_0x35b71c);}(_0x7f49,0x197));var _0x97f4=function(_0x385161,_0xa2d1a4){_0x385161=_0x385161-0x0;var _0x173b0c=_0x7f49[_0x385161];return _0x173b0c;};'use strict';var _=require(_0x97f4('0x0'));var Redis=require(_0x97f4('0x1'));var qs=require(_0x97f4('0x2'));var logger=require(_0x97f4('0x3'))(_0x97f4('0x4'));var config=require(_0x97f4('0x5'));var db=require(_0x97f4('0x6'))['db'];config[_0x97f4('0x7')]=_[_0x97f4('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x97f4('0x9'))(new Redis(config[_0x97f4('0x7')]));require(_0x97f4('0xa'))[_0x97f4('0xb')](socket);function respondWithStatusCode(_0x514a26,_0x113867){_0x113867=_0x113867||0xcc;return function(_0x571f2d){if(_0x571f2d){return _0x514a26[_0x97f4('0xc')](_0x113867);}return _0x514a26[_0x97f4('0xd')](_0x113867)[_0x97f4('0xe')]();};}function respondWithResult(_0x9a008c,_0x5a7e08){_0x5a7e08=_0x5a7e08||0xc8;return function(_0x44d288){if(_0x44d288){return _0x9a008c['status'](_0x5a7e08)['json'](_0x44d288);}};}function respondWithFilteredResult(_0x3655c8,_0xb368b6){return function(_0x3d902a){if(_0x3d902a){var _0x1fef2e=typeof _0xb368b6[_0x97f4('0xf')]===_0x97f4('0x10')&&typeof _0xb368b6['limit']===_0x97f4('0x10');var _0x3e91a0=_0x3d902a[_0x97f4('0x11')];var _0x186cb3=_0x1fef2e?0x0:_0xb368b6['offset'];var _0x5d90ec=_0x1fef2e?_0x3d902a['count']:_0xb368b6[_0x97f4('0xf')]+_0xb368b6[_0x97f4('0x12')];var _0x45f858;if(_0x5d90ec>=_0x3e91a0){_0x5d90ec=_0x3e91a0;_0x45f858=0xc8;}else{_0x45f858=0xce;}_0x3655c8['status'](_0x45f858);return _0x3655c8[_0x97f4('0x13')](_0x97f4('0x14'),_0x186cb3+'-'+_0x5d90ec+'/'+_0x3e91a0)['json'](_0x3d902a);}return null;};}function removeEntity(_0x448a7c){return function(_0x173763){if(_0x173763){return _0x173763[_0x97f4('0x15')]()[_0x97f4('0x16')](function(){var _0x27e39e=_0x173763[_0x97f4('0x17')]({'plain':!![]});var _0x233587=[{'name':_0x97f4('0x18'),'value':_0x97f4('0x19'),'ignore':![]},{'name':_0x97f4('0x1a'),'value':_0x97f4('0x1b'),'ignore':![]},{'name':'InternalRoutes','value':_0x97f4('0x1c'),'ignore':![]}];var _0x4f1ef5=_(_0x233587)['filter']('ignore')[_0x97f4('0x1d')](_0x97f4('0x1e'))['value']();if(_[_0x97f4('0x1f')](_0x4f1ef5,_0x27e39e[_0x97f4('0x20')])){return;}var _0x25347d=_[_0x97f4('0x21')](_0x233587,[_0x97f4('0x1e'),_0x27e39e[_0x97f4('0x20')]])['name'];return db[_0x97f4('0x22')][_0x97f4('0x15')]({'where':{'type':_0x25347d,'resourceId':_0x27e39e['id']}})['then'](function(){return _0x173763;});})[_0x97f4('0x16')](function(){_0x448a7c['status'](0xcc)[_0x97f4('0xe')]();});}};}function handleEntityNotFound(_0x2db9a9){return function(_0x314a31){if(!_0x314a31){_0x2db9a9[_0x97f4('0xc')](0x194);}return _0x314a31;};}function handleError(_0x1b33b9,_0x2e9754){_0x2e9754=_0x2e9754||0x1f4;return function(_0x90e582){logger['error'](_0x90e582[_0x97f4('0x23')]);if(_0x90e582[_0x97f4('0x24')]){delete _0x90e582[_0x97f4('0x24')];}_0x1b33b9[_0x97f4('0xd')](_0x2e9754)[_0x97f4('0x25')](_0x90e582);};}exports[_0x97f4('0x26')]=function(_0x5cee7a,_0x3b8af6){var _0x5e4415={},_0x1befa0={},_0x5ddde8={'count':0x0,'rows':[]};var _0x318e57=_[_0x97f4('0x1d')](db[_0x97f4('0x27')]['rawAttributes'],function(_0x14bee8){return{'name':_0x14bee8['fieldName'],'type':_0x14bee8[_0x97f4('0x20')][_0x97f4('0x28')]};});_0x1befa0[_0x97f4('0x29')]=_[_0x97f4('0x1d')](_0x318e57,_0x97f4('0x24'));_0x1befa0['query']=_['keys'](_0x5cee7a[_0x97f4('0x2a')]);_0x1befa0[_0x97f4('0x2b')]=_[_0x97f4('0x2c')](_0x1befa0[_0x97f4('0x29')],_0x1befa0[_0x97f4('0x2a')]);_0x5e4415[_0x97f4('0x2d')]=_[_0x97f4('0x2c')](_0x1befa0[_0x97f4('0x29')],qs['fields'](_0x5cee7a[_0x97f4('0x2a')]['fields']));_0x5e4415['attributes']=_0x5e4415[_0x97f4('0x2d')][_0x97f4('0x2e')]?_0x5e4415[_0x97f4('0x2d')]:_0x1befa0['model'];if(!_0x5cee7a['query'][_0x97f4('0x2f')](_0x97f4('0x30'))){_0x5e4415[_0x97f4('0x12')]=qs[_0x97f4('0x12')](_0x5cee7a[_0x97f4('0x2a')][_0x97f4('0x12')]);_0x5e4415[_0x97f4('0xf')]=qs['offset'](_0x5cee7a['query'][_0x97f4('0xf')]);}_0x5e4415[_0x97f4('0x31')]=qs[_0x97f4('0x32')](_0x5cee7a[_0x97f4('0x2a')]['sort']);_0x5e4415[_0x97f4('0x33')]=qs['filters'](_['pick'](_0x5cee7a['query'],_0x1befa0['filters']),_0x318e57);if(_0x5cee7a[_0x97f4('0x2a')]['filter']){_0x5e4415[_0x97f4('0x33')]=_[_0x97f4('0x34')](_0x5e4415[_0x97f4('0x33')],{'$or':_[_0x97f4('0x1d')](_0x318e57,function(_0x1d66e2){if(_0x1d66e2['type']!==_0x97f4('0x35')){var _0x2aa19c={};_0x2aa19c[_0x1d66e2[_0x97f4('0x24')]]={'$like':'%'+_0x5cee7a[_0x97f4('0x2a')][_0x97f4('0x36')]+'%'};return _0x2aa19c;}})});}_0x5e4415=_['merge']({},_0x5e4415,_0x5cee7a[_0x97f4('0x37')]);var _0x55f364={'where':_0x5e4415[_0x97f4('0x33')]};return db['VoiceExtension']['count'](_0x55f364)[_0x97f4('0x16')](function(_0x1aa9ac){_0x5ddde8['count']=_0x1aa9ac;if(_0x5cee7a[_0x97f4('0x2a')][_0x97f4('0x38')]){_0x5e4415[_0x97f4('0x39')]=[{'all':!![]}];}return db[_0x97f4('0x27')][_0x97f4('0x3a')](_0x5e4415);})[_0x97f4('0x16')](function(_0x1bbbb6){_0x5ddde8[_0x97f4('0x3b')]=_0x1bbbb6;return _0x5ddde8;})[_0x97f4('0x16')](respondWithFilteredResult(_0x3b8af6,_0x5e4415))[_0x97f4('0x3c')](handleError(_0x3b8af6,null));};exports[_0x97f4('0x3d')]=function(_0x284ab7,_0x2c1228){var _0x182f45={'raw':![],'where':{'id':_0x284ab7[_0x97f4('0x3e')]['id']}},_0x2d1767={};_0x2d1767['model']=_['keys'](db['VoiceExtension'][_0x97f4('0x3f')]);_0x2d1767[_0x97f4('0x2a')]=_[_0x97f4('0x40')](_0x284ab7['query']);_0x2d1767['filters']=_[_0x97f4('0x2c')](_0x2d1767['model'],_0x2d1767[_0x97f4('0x2a')]);_0x182f45[_0x97f4('0x2d')]=_[_0x97f4('0x2c')](_0x2d1767[_0x97f4('0x29')],qs['fields'](_0x284ab7[_0x97f4('0x2a')][_0x97f4('0x41')]));_0x182f45[_0x97f4('0x2d')]=_0x182f45['attributes'][_0x97f4('0x2e')]?_0x182f45[_0x97f4('0x2d')]:_0x2d1767[_0x97f4('0x29')];if(_0x284ab7[_0x97f4('0x2a')][_0x97f4('0x38')]){_0x182f45[_0x97f4('0x39')]=[{'all':!![]}];}_0x182f45=_[_0x97f4('0x34')]({},_0x182f45,_0x284ab7[_0x97f4('0x37')]);return db[_0x97f4('0x27')]['find'](_0x182f45)['then'](handleEntityNotFound(_0x2c1228,null))['then'](respondWithResult(_0x2c1228,null))[_0x97f4('0x3c')](handleError(_0x2c1228,null));};exports[_0x97f4('0x15')]=function(_0x2ac08b,_0x8e9a51){return db[_0x97f4('0x27')][_0x97f4('0x21')]({'where':{'id':_0x2ac08b['params']['id']}})[_0x97f4('0x16')](handleEntityNotFound(_0x8e9a51,null))['then'](removeEntity(_0x8e9a51,null))[_0x97f4('0x3c')](handleError(_0x8e9a51,null));};exports[_0x97f4('0x42')]=function(_0x1a56e1,_0x2b4a85){if(_0x1a56e1[_0x97f4('0x43')][_0x97f4('0x20')]===_0x97f4('0x1b')&&!_['startsWith'](_0x1a56e1['body']['exten'],'_')){_0x1a56e1[_0x97f4('0x43')]['exten']='_'['concat'](_0x1a56e1['body'][_0x97f4('0x44')]);}return db[_0x97f4('0x27')]['create'](_0x1a56e1[_0x97f4('0x43')],{'raw':![]})[_0x97f4('0x16')](function(_0x2bb3be){var _0x527c9e=_0x1a56e1['user'][_0x97f4('0x17')]({'plain':!![]});if(!_0x527c9e)throw new Error(_0x97f4('0x45'));if(_0x527c9e[_0x97f4('0x46')]===_0x97f4('0x47')){var _0x33c076=_0x2bb3be[_0x97f4('0x17')]({'plain':!![]});var _0x500f12=[{'name':_0x97f4('0x18'),'value':_0x97f4('0x19')},{'name':_0x97f4('0x1a'),'value':_0x97f4('0x1b')},{'name':'InternalRoutes','value':'internal'}];var _0x496aee=_[_0x97f4('0x21')](_0x500f12,['value',_0x33c076[_0x97f4('0x20')]])[_0x97f4('0x24')];return db[_0x97f4('0x48')]['find']({'where':{'name':_0x496aee,'userProfileId':_0x527c9e[_0x97f4('0x49')]},'raw':!![]})[_0x97f4('0x16')](function(_0x324f8d){if(_0x324f8d&&_0x324f8d[_0x97f4('0x4a')]===0x0){return db['UserProfileResource'][_0x97f4('0x42')]({'name':_0x33c076[_0x97f4('0x24')],'resourceId':_0x33c076['id'],'type':_0x324f8d[_0x97f4('0x24')],'sectionId':_0x324f8d['id']},{})['then'](function(){return _0x2bb3be;});}else{return _0x2bb3be;}})[_0x97f4('0x3c')](function(_0x4c6c15){logger[_0x97f4('0x4b')](_0x97f4('0x4c'),_0x4c6c15);throw _0x4c6c15;});}return _0x2bb3be;})[_0x97f4('0x16')](respondWithResult(_0x2b4a85,0xc9))[_0x97f4('0x3c')](handleError(_0x2b4a85,null));};exports[_0x97f4('0x4d')]=function(_0x295597,_0x516086){if(_0x295597['body']['id']){delete _0x295597[_0x97f4('0x43')]['id'];}return db['VoiceExtension'][_0x97f4('0x21')]({'where':{'id':_0x295597[_0x97f4('0x3e')]['id']}})['then'](handleEntityNotFound(_0x516086,null))[_0x97f4('0x16')](function(_0x13e672){if(_0x13e672){return db[_0x97f4('0x27')]['update'](_['pick'](_0x295597[_0x97f4('0x43')],[_0x97f4('0x44'),'context',_0x97f4('0x4e'),_0x97f4('0x4f'),_0x97f4('0x50'),_0x97f4('0x51'),_0x97f4('0x52')]),{'where':{'context':_0x13e672[_0x97f4('0x53')],'exten':_0x13e672[_0x97f4('0x44')]},'individualHooks':!![]})[_0x97f4('0x16')](function(_0x1e5946){return _0x1e5946;});}return null;})['then'](respondWithStatusCode(_0x516086,null))['catch'](handleError(_0x516086,null));};exports[_0x97f4('0x54')]=function(_0x56048c,_0x263989){var _0x43c53b=_0x56048c[_0x97f4('0x3e')]['id'];var _0x5d52e0=_0x56048c[_0x97f4('0x43')];var _0x13cb50=0xc8;var _0x5cccf4=null;return db[_0x97f4('0x55')][_0x97f4('0x56')]({'isolationLevel':db[_0x97f4('0x55')][_0x97f4('0x57')][_0x97f4('0x58')][_0x97f4('0x59')]},function(_0x151fec){return db[_0x97f4('0x27')][_0x97f4('0x5a')]({'where':{'id':_0x43c53b},'transaction':_0x151fec})[_0x97f4('0x16')](function(_0x323731){if(_0x323731){return db[_0x97f4('0x27')][_0x97f4('0x15')]({'where':{'VoiceExtensionId':_0x43c53b},'transaction':_0x151fec})['then'](function(){var _0x283179=_[_0x97f4('0x1d')](_0x5d52e0,function(_0x4d6455){_0x4d6455[_0x97f4('0x5b')]=_0x43c53b;_0x4d6455[_0x97f4('0x5c')]=!![];return _0x4d6455;});return _0x323731[_0x97f4('0x5d')](_0x283179);})['then'](function(_0x1a7193){return db[_0x97f4('0x27')][_0x97f4('0x5e')](_0x1a7193,{'transaction':_0x151fec});});}else{_0x13cb50=0x194;_0x5cccf4=[];}});})['then'](function(){if(_0x13cb50!==0x194){return db[_0x97f4('0x27')][_0x97f4('0x5f')]({'where':{'isApp':!![],'VoiceExtensionId':_0x43c53b},'order':_0x97f4('0x60')})[_0x97f4('0x16')](function(_0xd52066){_0x5cccf4=_0xd52066;});}})[_0x97f4('0x3c')](function(_0x5a8710){_0x13cb50=0x1f4;logger['error'](_0x5a8710[_0x97f4('0x23')]);if(_0x5a8710['name']){delete _0x5a8710[_0x97f4('0x24')];}_0x5cccf4=_0x5a8710;})[_0x97f4('0x61')](function(){if(_0x5cccf4===null){_0x263989['sendStatus'](_0x13cb50);}else{if(_0x13cb50===0x1f4){_0x263989[_0x97f4('0xd')](_0x13cb50)[_0x97f4('0x25')](_0x5cccf4);}else{_0x263989[_0x97f4('0xd')](_0x13cb50)[_0x97f4('0x62')](_0x5cccf4);}}});}; \ No newline at end of file +var _0xc75a=['VoiceExtensionId','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','status','limit','undefined','count','offset','set','Content-Range','json','destroy','then','inbound','outbound','internal','filter','ignore','map','value','includes','find','type','name','end','sendStatus','error','send','VoiceExtension','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','body','startsWith','exten','concat','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','InboundRoutes','OutboundRoutes','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','findOne'];(function(_0x1b8eba,_0x5cc021){var _0x2bd986=function(_0x5ec2ff){while(--_0x5ec2ff){_0x1b8eba['push'](_0x1b8eba['shift']());}};_0x2bd986(++_0x5cc021);}(_0xc75a,0xcd));var _0xac75=function(_0x349367,_0x1cede2){_0x349367=_0x349367-0x0;var _0x14179b=_0xc75a[_0x349367];return _0x14179b;};'use strict';var _=require(_0xac75('0x0'));var Redis=require(_0xac75('0x1'));var qs=require(_0xac75('0x2'));var logger=require(_0xac75('0x3'))(_0xac75('0x4'));var config=require(_0xac75('0x5'));var db=require(_0xac75('0x6'))['db'];config[_0xac75('0x7')]=_[_0xac75('0x8')](config['redis'],{'host':_0xac75('0x9'),'port':0x18eb});var socket=require(_0xac75('0xa'))(new Redis(config[_0xac75('0x7')]));require(_0xac75('0xb'))['register'](socket);function respondWithStatusCode(_0x360845,_0xab92ee){_0xab92ee=_0xab92ee||0xcc;return function(_0x539ba1){if(_0x539ba1){return _0x360845['sendStatus'](_0xab92ee);}return _0x360845[_0xac75('0xc')](_0xab92ee)['end']();};}function respondWithResult(_0x87db02,_0x493070){_0x493070=_0x493070||0xc8;return function(_0x503e94){if(_0x503e94){return _0x87db02['status'](_0x493070)['json'](_0x503e94);}};}function respondWithFilteredResult(_0x40a199,_0x5363b4){return function(_0x3e5071){if(_0x3e5071){var _0x31483a=typeof _0x5363b4['offset']==='undefined'&&typeof _0x5363b4[_0xac75('0xd')]===_0xac75('0xe');var _0xcfba7=_0x3e5071[_0xac75('0xf')];var _0x5f0e75=_0x31483a?0x0:_0x5363b4['offset'];var _0x59069f=_0x31483a?_0x3e5071['count']:_0x5363b4[_0xac75('0x10')]+_0x5363b4[_0xac75('0xd')];var _0x583841;if(_0x59069f>=_0xcfba7){_0x59069f=_0xcfba7;_0x583841=0xc8;}else{_0x583841=0xce;}_0x40a199[_0xac75('0xc')](_0x583841);return _0x40a199[_0xac75('0x11')](_0xac75('0x12'),_0x5f0e75+'-'+_0x59069f+'/'+_0xcfba7)[_0xac75('0x13')](_0x3e5071);}return null;};}function removeEntity(_0x191297){return function(_0x2be6b9){if(_0x2be6b9){return _0x2be6b9[_0xac75('0x14')]()[_0xac75('0x15')](function(){var _0x366fd1=_0x2be6b9['get']({'plain':!![]});var _0x3e1509=[{'name':'InboundRoutes','value':_0xac75('0x16'),'ignore':![]},{'name':'OutboundRoutes','value':_0xac75('0x17'),'ignore':![]},{'name':'InternalRoutes','value':_0xac75('0x18'),'ignore':![]}];var _0x45d517=_(_0x3e1509)[_0xac75('0x19')](_0xac75('0x1a'))[_0xac75('0x1b')](_0xac75('0x1c'))[_0xac75('0x1c')]();if(_[_0xac75('0x1d')](_0x45d517,_0x366fd1['type'])){return;}var _0x5c2872=_[_0xac75('0x1e')](_0x3e1509,[_0xac75('0x1c'),_0x366fd1[_0xac75('0x1f')]])[_0xac75('0x20')];return db['UserProfileResource'][_0xac75('0x14')]({'where':{'type':_0x5c2872,'resourceId':_0x366fd1['id']}})['then'](function(){return _0x2be6b9;});})[_0xac75('0x15')](function(){_0x191297['status'](0xcc)[_0xac75('0x21')]();});}};}function handleEntityNotFound(_0x57f3db){return function(_0x45da88){if(!_0x45da88){_0x57f3db[_0xac75('0x22')](0x194);}return _0x45da88;};}function handleError(_0x82878b,_0x8f08c1){_0x8f08c1=_0x8f08c1||0x1f4;return function(_0x459856){logger[_0xac75('0x23')](_0x459856['stack']);if(_0x459856[_0xac75('0x20')]){delete _0x459856[_0xac75('0x20')];}_0x82878b[_0xac75('0xc')](_0x8f08c1)[_0xac75('0x24')](_0x459856);};}exports['index']=function(_0x1f75e1,_0x880987){var _0x2d7db9={},_0x260fcb={},_0x4389b6={'count':0x0,'rows':[]};var _0x471dea=_[_0xac75('0x1b')](db[_0xac75('0x25')][_0xac75('0x26')],function(_0x159fbd){return{'name':_0x159fbd[_0xac75('0x27')],'type':_0x159fbd['type']['key']};});_0x260fcb[_0xac75('0x28')]=_['map'](_0x471dea,'name');_0x260fcb[_0xac75('0x29')]=_[_0xac75('0x2a')](_0x1f75e1[_0xac75('0x29')]);_0x260fcb[_0xac75('0x2b')]=_['intersection'](_0x260fcb[_0xac75('0x28')],_0x260fcb[_0xac75('0x29')]);_0x2d7db9[_0xac75('0x2c')]=_[_0xac75('0x2d')](_0x260fcb[_0xac75('0x28')],qs[_0xac75('0x2e')](_0x1f75e1[_0xac75('0x29')][_0xac75('0x2e')]));_0x2d7db9[_0xac75('0x2c')]=_0x2d7db9[_0xac75('0x2c')][_0xac75('0x2f')]?_0x2d7db9[_0xac75('0x2c')]:_0x260fcb[_0xac75('0x28')];if(!_0x1f75e1['query'][_0xac75('0x30')](_0xac75('0x31'))){_0x2d7db9[_0xac75('0xd')]=qs['limit'](_0x1f75e1[_0xac75('0x29')]['limit']);_0x2d7db9[_0xac75('0x10')]=qs['offset'](_0x1f75e1[_0xac75('0x29')]['offset']);}_0x2d7db9[_0xac75('0x32')]=qs[_0xac75('0x33')](_0x1f75e1[_0xac75('0x29')][_0xac75('0x33')]);_0x2d7db9[_0xac75('0x34')]=qs[_0xac75('0x2b')](_[_0xac75('0x35')](_0x1f75e1[_0xac75('0x29')],_0x260fcb[_0xac75('0x2b')]),_0x471dea);if(_0x1f75e1['query'][_0xac75('0x19')]){_0x2d7db9[_0xac75('0x34')]=_[_0xac75('0x36')](_0x2d7db9[_0xac75('0x34')],{'$or':_['map'](_0x471dea,function(_0x1010a2){if(_0x1010a2[_0xac75('0x1f')]!==_0xac75('0x37')){var _0x9d7635={};_0x9d7635[_0x1010a2['name']]={'$like':'%'+_0x1f75e1[_0xac75('0x29')][_0xac75('0x19')]+'%'};return _0x9d7635;}})});}_0x2d7db9=_[_0xac75('0x36')]({},_0x2d7db9,_0x1f75e1['options']);var _0x44bc3d={'where':_0x2d7db9[_0xac75('0x34')]};return db['VoiceExtension'][_0xac75('0xf')](_0x44bc3d)[_0xac75('0x15')](function(_0x380d6e){_0x4389b6[_0xac75('0xf')]=_0x380d6e;if(_0x1f75e1[_0xac75('0x29')][_0xac75('0x38')]){_0x2d7db9[_0xac75('0x39')]=[{'all':!![]}];}return db['VoiceExtension'][_0xac75('0x3a')](_0x2d7db9);})[_0xac75('0x15')](function(_0x9874c4){_0x4389b6['rows']=_0x9874c4;return _0x4389b6;})[_0xac75('0x15')](respondWithFilteredResult(_0x880987,_0x2d7db9))[_0xac75('0x3b')](handleError(_0x880987,null));};exports[_0xac75('0x3c')]=function(_0x3030a0,_0x1da355){var _0x4b382f={'raw':![],'where':{'id':_0x3030a0[_0xac75('0x3d')]['id']}},_0x25534f={};_0x25534f['model']=_[_0xac75('0x2a')](db[_0xac75('0x25')][_0xac75('0x26')]);_0x25534f[_0xac75('0x29')]=_[_0xac75('0x2a')](_0x3030a0[_0xac75('0x29')]);_0x25534f['filters']=_[_0xac75('0x2d')](_0x25534f[_0xac75('0x28')],_0x25534f[_0xac75('0x29')]);_0x4b382f[_0xac75('0x2c')]=_[_0xac75('0x2d')](_0x25534f[_0xac75('0x28')],qs[_0xac75('0x2e')](_0x3030a0['query'][_0xac75('0x2e')]));_0x4b382f[_0xac75('0x2c')]=_0x4b382f['attributes']['length']?_0x4b382f[_0xac75('0x2c')]:_0x25534f[_0xac75('0x28')];if(_0x3030a0['query'][_0xac75('0x38')]){_0x4b382f['include']=[{'all':!![]}];}_0x4b382f=_[_0xac75('0x36')]({},_0x4b382f,_0x3030a0[_0xac75('0x3e')]);return db['VoiceExtension'][_0xac75('0x1e')](_0x4b382f)[_0xac75('0x15')](handleEntityNotFound(_0x1da355,null))[_0xac75('0x15')](respondWithResult(_0x1da355,null))['catch'](handleError(_0x1da355,null));};exports['destroy']=function(_0x5388a5,_0x327c3c){return db[_0xac75('0x25')][_0xac75('0x1e')]({'where':{'id':_0x5388a5['params']['id']}})[_0xac75('0x15')](handleEntityNotFound(_0x327c3c,null))[_0xac75('0x15')](removeEntity(_0x327c3c,null))[_0xac75('0x3b')](handleError(_0x327c3c,null));};exports['create']=function(_0x1d813b,_0x282e1f){if(_0x1d813b[_0xac75('0x3f')]['type']===_0xac75('0x17')&&!_[_0xac75('0x40')](_0x1d813b['body'][_0xac75('0x41')],'_')){_0x1d813b[_0xac75('0x3f')]['exten']='_'[_0xac75('0x42')](_0x1d813b[_0xac75('0x3f')][_0xac75('0x41')]);}return db[_0xac75('0x25')][_0xac75('0x43')](_0x1d813b[_0xac75('0x3f')],{'raw':![]})['then'](function(_0x2b939b){var _0x3d741f=_0x1d813b[_0xac75('0x44')]['get']({'plain':!![]});if(!_0x3d741f)throw new Error(_0xac75('0x45'));if(_0x3d741f[_0xac75('0x46')]===_0xac75('0x44')){var _0x3f7e6e=_0x2b939b[_0xac75('0x47')]({'plain':!![]});var _0x1fac2a=[{'name':_0xac75('0x48'),'value':_0xac75('0x16')},{'name':_0xac75('0x49'),'value':_0xac75('0x17')},{'name':'InternalRoutes','value':_0xac75('0x18')}];var _0x1476e3=_[_0xac75('0x1e')](_0x1fac2a,[_0xac75('0x1c'),_0x3f7e6e[_0xac75('0x1f')]])['name'];return db[_0xac75('0x4a')][_0xac75('0x1e')]({'where':{'name':_0x1476e3,'userProfileId':_0x3d741f[_0xac75('0x4b')]},'raw':!![]})[_0xac75('0x15')](function(_0x3184a2){if(_0x3184a2&&_0x3184a2[_0xac75('0x4c')]===0x0){return db[_0xac75('0x4d')][_0xac75('0x43')]({'name':_0x3f7e6e[_0xac75('0x20')],'resourceId':_0x3f7e6e['id'],'type':_0x3184a2['name'],'sectionId':_0x3184a2['id']},{})[_0xac75('0x15')](function(){return _0x2b939b;});}else{return _0x2b939b;}})[_0xac75('0x3b')](function(_0x12a144){logger['error'](_0xac75('0x4e'),_0x12a144);throw _0x12a144;});}return _0x2b939b;})['then'](respondWithResult(_0x282e1f,0xc9))[_0xac75('0x3b')](handleError(_0x282e1f,null));};exports[_0xac75('0x4f')]=function(_0x424e67,_0x3bb111){if(_0x424e67[_0xac75('0x3f')]['id']){delete _0x424e67[_0xac75('0x3f')]['id'];}return db[_0xac75('0x25')]['find']({'where':{'id':_0x424e67[_0xac75('0x3d')]['id']}})[_0xac75('0x15')](handleEntityNotFound(_0x3bb111,null))[_0xac75('0x15')](function(_0x135783){if(_0x135783){return db[_0xac75('0x25')][_0xac75('0x4f')](_[_0xac75('0x35')](_0x424e67['body'],[_0xac75('0x41'),_0xac75('0x50'),_0xac75('0x51'),_0xac75('0x52'),_0xac75('0x53'),_0xac75('0x54'),_0xac75('0x55')]),{'where':{'context':_0x135783[_0xac75('0x50')],'exten':_0x135783[_0xac75('0x41')]},'individualHooks':!![]})[_0xac75('0x15')](function(_0x425259){return _0x425259;});}return null;})[_0xac75('0x15')](respondWithStatusCode(_0x3bb111,null))[_0xac75('0x3b')](handleError(_0x3bb111,null));};exports[_0xac75('0x56')]=function(_0x22da46,_0x1dadcf){var _0x487517=_0x22da46[_0xac75('0x3d')]['id'];var _0x1afd4d=_0x22da46[_0xac75('0x3f')];var _0x207171=0xc8;var _0xe705c8=null;return db[_0xac75('0x57')][_0xac75('0x58')]({'isolationLevel':db[_0xac75('0x57')][_0xac75('0x59')]['ISOLATION_LEVELS'][_0xac75('0x5a')]},function(_0x3909ae){return db['VoiceExtension'][_0xac75('0x5b')]({'where':{'id':_0x487517},'transaction':_0x3909ae})[_0xac75('0x15')](function(_0x329367){if(_0x329367){return db[_0xac75('0x25')][_0xac75('0x14')]({'where':{'VoiceExtensionId':_0x487517},'transaction':_0x3909ae})[_0xac75('0x15')](function(){var _0xce2367=_[_0xac75('0x1b')](_0x1afd4d,function(_0x1e1652){_0x1e1652[_0xac75('0x5c')]=_0x487517;_0x1e1652[_0xac75('0x5d')]=!![];return _0x1e1652;});return _0x329367['createRouting'](_0xce2367);})[_0xac75('0x15')](function(_0x2cc90c){return db[_0xac75('0x25')][_0xac75('0x5e')](_0x2cc90c,{'transaction':_0x3909ae});});}else{_0x207171=0x194;_0xe705c8=[];}});})[_0xac75('0x15')](function(){if(_0x207171!==0x194){return db[_0xac75('0x25')][_0xac75('0x5f')]({'where':{'isApp':!![],'VoiceExtensionId':_0x487517},'order':_0xac75('0x60')})[_0xac75('0x15')](function(_0x35b8d3){_0xe705c8=_0x35b8d3;});}})['catch'](function(_0x4c643b){_0x207171=0x1f4;logger[_0xac75('0x23')](_0x4c643b[_0xac75('0x61')]);if(_0x4c643b['name']){delete _0x4c643b[_0xac75('0x20')];}_0xe705c8=_0x4c643b;})[_0xac75('0x62')](function(){if(_0xe705c8===null){_0x1dadcf['sendStatus'](_0x207171);}else{if(_0x207171===0x1f4){_0x1dadcf[_0xac75('0xc')](_0x207171)[_0xac75('0x24')](_0xe705c8);}else{_0x1dadcf[_0xac75('0xc')](_0x207171)['json'](_0xe705c8);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 3c1c88d..9d57713 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 _0x4138=['exports','events','VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x411e51,_0x272bdb){var _0x16b571=function(_0x209624){while(--_0x209624){_0x411e51['push'](_0x411e51['shift']());}};_0x16b571(++_0x272bdb);}(_0x4138,0xa3));var _0x8413=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4138[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require(_0x8413('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x8413('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x8413('0x2')](0x0);var events={'afterCreate':_0x8413('0x3'),'afterUpdate':_0x8413('0x4'),'afterDestroy':_0x8413('0x5')};function emitEvent(_0x2d2ba0){return function(_0x5965fb,_0xf2f1cd,_0x26a5b3){VoiceExtensionEvents[_0x8413('0x6')](_0x2d2ba0+':'+_0x5965fb['id'],_0x5965fb);VoiceExtensionEvents[_0x8413('0x6')](_0x2d2ba0,_0x5965fb);_0x26a5b3(null);};}for(var e in events){if(events[_0x8413('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x8413('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x008c=['remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x308375,_0x3a93cc){var _0x18d40c=function(_0x21bbbf){while(--_0x21bbbf){_0x308375['push'](_0x308375['shift']());}};_0x18d40c(++_0x3a93cc);}(_0x008c,0x174));var _0xc008=function(_0x2f97ec,_0x20480d){_0x2f97ec=_0x2f97ec-0x0;var _0x15df31=_0x008c[_0x2f97ec];return _0x15df31;};'use strict';var EventEmitter=require(_0xc008('0x0'));var VoiceExtension=require(_0xc008('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xc008('0x2')](0x0);var events={'afterCreate':_0xc008('0x3'),'afterUpdate':'update','afterDestroy':_0xc008('0x4')};function emitEvent(_0x43d94a){return function(_0x39b983,_0x357de0,_0x2784f5){VoiceExtensionEvents['emit'](_0x43d94a+':'+_0x39b983['id'],_0x39b983);VoiceExtensionEvents[_0xc008('0x5')](_0x43d94a,_0x39b983);_0x2784f5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xc008('0x6')](e,emitEvent(event));}}module[_0xc008('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 6bdcc22..b26ad16 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 _0xd2c6=['trunk','timeout','options','url','split','name','phone','param','prefix','${EXTEN}','SIP','join','indexOf','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','interval','IntervalId','then','length','*,*,*,*','intervals','map','filter','toLowerCase','hasOwnProperty','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','queue','playback','includes','app','appType','answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','appdata','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','last','priority','concat','catch','define','VoiceExtension','voice_extensions','Hangup','lodash','./voiceExtension.attributes','exten','type','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','push','Set','context','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','${EXTEN:','cutdigits','CDR(routeid)=','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav'];(function(_0xd6640b,_0x475e47){var _0x4c843e=function(_0x11040f){while(--_0x11040f){_0xd6640b['push'](_0xd6640b['shift']());}};_0x4c843e(++_0x475e47);}(_0xd2c6,0x171));var _0x6d2c=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0xd2c6[_0x4ed520];return _0x4415a6;};'use strict';var _=require(_0x6d2c('0x0'));var attributes=require(_0x6d2c('0x1'));module['exports']=function(_0x3e72e3){var _0x4a3f59=_0x3e72e3['models'];function _0x2768e1(_0x1c9217){var _0x3659ce=0x2;var _0x51efd6=[{'type':_0x1c9217['type'],'app':'Set','appdata':'CDR(type)='+_0x1c9217['type'],'context':_0x1c9217['context'],'exten':_0x1c9217[_0x6d2c('0x2')],'priority':_0x3659ce++,'VoiceExtensionId':_0x1c9217['id']},{'type':_0x1c9217[_0x6d2c('0x3')],'app':_0x1c9217[_0x6d2c('0x4')]?'Set':_0x6d2c('0x5'),'appdata':_0x1c9217['alias']?_0x6d2c('0x6')+_0x1c9217[_0x6d2c('0x4')]:_0x6d2c('0x7'),'context':_0x1c9217['context'],'exten':_0x1c9217[_0x6d2c('0x2')],'priority':_0x3659ce++,'VoiceExtensionId':_0x1c9217['id']}];if(_0x1c9217[_0x6d2c('0x3')]==='inbound'){_0x51efd6[_0x6d2c('0x8')]({'type':'inbound','app':_0x6d2c('0x9'),'appdata':'CDR(routeid)='+_0x1c9217['id'],'context':_0x1c9217[_0x6d2c('0xa')],'exten':_0x1c9217[_0x6d2c('0x2')],'priority':_0x3659ce++,'VoiceExtensionId':_0x1c9217['id']});}_0x51efd6[_0x6d2c('0x8')]({'type':_0x1c9217[_0x6d2c('0x3')],'app':_0x6d2c('0x9'),'appdata':_0x6d2c('0xb'),'context':_0x1c9217[_0x6d2c('0xa')],'exten':_0x1c9217['exten'],'priority':_0x3659ce++,'VoiceExtensionId':_0x1c9217['id']},{'type':_0x1c9217[_0x6d2c('0x3')],'app':_0x6d2c('0x9'),'appdata':_0x6d2c('0xc'),'context':_0x1c9217[_0x6d2c('0xa')],'exten':_0x1c9217[_0x6d2c('0x2')],'priority':_0x3659ce++,'VoiceExtensionId':_0x1c9217['id']},{'type':_0x1c9217[_0x6d2c('0x3')],'app':'Set','appdata':_0x6d2c('0xd'),'context':_0x1c9217[_0x6d2c('0xa')],'exten':_0x1c9217['exten'],'priority':_0x3659ce++,'VoiceExtensionId':_0x1c9217['id']});return _0x51efd6;}function _0x4d0f7a(_0x35733d){var _0x48407d=0x2;var _0x403d2a=[{'type':_0x6d2c('0xe'),'app':_0x6d2c('0x9'),'appdata':_0x6d2c('0xf'),'context':_0x35733d[_0x6d2c('0xa')],'exten':_0x35733d['exten'],'priority':_0x48407d++,'VoiceExtensionId':_0x35733d['id']},{'type':_0x6d2c('0xe'),'app':_0x35733d[_0x6d2c('0x4')]?_0x6d2c('0x9'):_0x6d2c('0x5'),'appdata':_0x35733d['alias']?_0x6d2c('0x6')+_0x35733d[_0x6d2c('0x4')]:_0x6d2c('0x7'),'context':_0x35733d[_0x6d2c('0xa')],'exten':_0x35733d['exten'],'priority':_0x48407d++,'VoiceExtensionId':_0x35733d['id']},{'type':'outbound','app':'Set','appdata':'CDR(destination)='+(_0x35733d['cutdigits']?_0x6d2c('0x10')+_0x35733d[_0x6d2c('0x11')]+'}':'${EXTEN}'),'context':_0x35733d['context'],'exten':_0x35733d[_0x6d2c('0x2')],'priority':_0x48407d++,'VoiceExtensionId':_0x35733d['id']},{'type':_0x6d2c('0xe'),'app':_0x6d2c('0x9'),'appdata':_0x6d2c('0x12')+_0x35733d['id'],'context':_0x35733d[_0x6d2c('0xa')],'exten':_0x35733d['exten'],'priority':_0x48407d++,'VoiceExtensionId':_0x35733d['id']},{'type':_0x6d2c('0xe'),'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x48407d+0x2)+_0x6d2c('0x13')+(_0x48407d+0x1)+')','context':_0x35733d[_0x6d2c('0xa')],'exten':_0x35733d[_0x6d2c('0x2')],'priority':_0x48407d++,'VoiceExtensionId':_0x35733d['id']},{'type':_0x6d2c('0xe'),'app':_0x6d2c('0x9'),'appdata':_0x35733d['cutdigits']?_0x6d2c('0x14')+_0x35733d[_0x6d2c('0x11')]+'}':_0x6d2c('0x15'),'context':_0x35733d['context'],'exten':_0x35733d[_0x6d2c('0x2')],'priority':_0x48407d++,'VoiceExtensionId':_0x35733d['id']},{'type':'outbound','app':_0x6d2c('0x9'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x35733d[_0x6d2c('0xa')],'exten':_0x35733d[_0x6d2c('0x2')],'priority':_0x48407d++,'VoiceExtensionId':_0x35733d['id']},{'type':'outbound','app':_0x6d2c('0x9'),'appdata':_0x6d2c('0xc'),'context':_0x35733d[_0x6d2c('0xa')],'exten':_0x35733d[_0x6d2c('0x2')],'priority':_0x48407d++,'VoiceExtensionId':_0x35733d['id']},{'type':'outbound','app':_0x6d2c('0x9'),'appdata':_0x6d2c('0xd'),'context':_0x35733d['context'],'exten':_0x35733d[_0x6d2c('0x2')],'priority':_0x48407d++,'VoiceExtensionId':_0x35733d['id']},{'type':'outbound','app':_0x6d2c('0x9'),'appdata':'outboundrouteid='+_0x35733d['id'],'context':_0x35733d[_0x6d2c('0xa')],'exten':_0x35733d['exten'],'priority':_0x48407d++,'VoiceExtensionId':_0x35733d['id']}];if(_0x35733d['hasOwnProperty'](_0x6d2c('0x16'))&&_0x35733d[_0x6d2c('0x16')]!==_0x6d2c('0x17')){_0x403d2a['push']({'type':'outbound','app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x35733d[_0x6d2c('0xa')],'exten':_0x35733d['exten'],'priority':_0x48407d++,'VoiceExtensionId':_0x35733d['id']},{'type':_0x6d2c('0xe'),'app':_0x6d2c('0x9'),'appdata':_0x6d2c('0x18')+_0x35733d[_0x6d2c('0x16')]||_0x6d2c('0x19'),'context':_0x35733d[_0x6d2c('0xa')],'exten':_0x35733d[_0x6d2c('0x2')],'priority':_0x48407d++,'VoiceExtensionId':_0x35733d['id']});}return _0x403d2a;}function _0x29bfad(_0x8a0364,_0x190ae9){var _0x533f9d=[{'name':_0x6d2c('0x1a'),'param':0x0},{'name':_0x6d2c('0x1b'),'param':0x1},{'name':_0x6d2c('0x1c'),'param':0x2},{'name':_0x6d2c('0x1d'),'param':0x3}];var _0x17dbaa={};var _0x25a15e=_0x190ae9[_0x6d2c('0x1e')](',');var _0x483d69=[];for(var _0x9c036f=0x0;_0x9c036f<_0x533f9d['length'];_0x9c036f++){switch(_0x533f9d[_0x9c036f][_0x6d2c('0x1f')]){case _0x6d2c('0x1a'):_0x17dbaa[_0x6d2c('0x1a')]=_0x25a15e[_0x533f9d[_0x9c036f]['param']][_0x6d2c('0x1e')]('/')[0x1];_0x17dbaa[_0x6d2c('0x20')]=_0x25a15e[_0x533f9d[_0x9c036f][_0x6d2c('0x21')]][_0x6d2c('0x1e')]('/')[0x2];_0x17dbaa[_0x6d2c('0x22')]=_0x17dbaa[_0x6d2c('0x20')]?_0x17dbaa[_0x6d2c('0x20')][_0x6d2c('0x1e')]('$')[0x0]:undefined;_0x17dbaa['phone']=_0x8a0364[_0x6d2c('0x11')]?(_0x17dbaa[_0x6d2c('0x22')]||'')+_0x6d2c('0x10')+_0x8a0364[_0x6d2c('0x11')]+'}':(_0x17dbaa[_0x6d2c('0x22')]||'')+_0x6d2c('0x23');_0x483d69[_0x533f9d[_0x9c036f][_0x6d2c('0x21')]]=[_0x6d2c('0x24'),_0x17dbaa['trunk'],_0x17dbaa[_0x6d2c('0x20')]][_0x6d2c('0x25')]('/');break;case _0x6d2c('0x1c'):_0x17dbaa[_0x6d2c('0x1c')]=_0x25a15e[_0x533f9d[_0x9c036f][_0x6d2c('0x21')]];if(_0x8a0364[_0x6d2c('0x16')]!==_0x6d2c('0x17')){if(_0x17dbaa[_0x6d2c('0x1c')][_0x6d2c('0x26')](_0x6d2c('0x27'))<0x0){_0x17dbaa[_0x6d2c('0x1c')]+=_0x6d2c('0x27');}}else{_0x17dbaa[_0x6d2c('0x1c')]=_0x17dbaa['options']['replace'](_0x6d2c('0x27'),'');}_0x483d69[_0x533f9d[_0x9c036f]['param']]=_0x17dbaa[_0x6d2c('0x1c')];break;default:_0x483d69[_0x533f9d[_0x9c036f][_0x6d2c('0x21')]]=_0x25a15e[_0x533f9d[_0x9c036f][_0x6d2c('0x21')]];}}return _0x483d69[_0x6d2c('0x25')](',');}function _0x5e8c4b(_0x39ad25,_0x3737d9,_0x54a4fd){return new Promise(function(_0x1f3a36,_0x62dad2){var _0x482334=[];if(_[_0x6d2c('0x28')](_0x3737d9))return _0x1f3a36(_0x482334);_0x4a3f59[_0x6d2c('0x29')][_0x6d2c('0x2a')]({'attributes':['id',_0x6d2c('0x2b'),_0x6d2c('0x2c')],'raw':!![]})[_0x6d2c('0x2d')](function(_0x400ace){for(var _0x390aa4=0x0,_0x3a94d6=0x0;_0x390aa4<_0x3737d9[_0x6d2c('0x2e')];_0x390aa4++,_0x3a94d6=0x0){var _0x3133e6=_0x3737d9[_0x390aa4];var _0x44a9e5=[];var _0x2a4ec7=[];delete _0x3133e6['id'];if(_0x3133e6['interval']!==_0x6d2c('0x2f')){_0x3133e6[_0x6d2c('0x30')]=[_0x3133e6[_0x6d2c('0x2b')]];}else{_0x3133e6[_0x6d2c('0x30')]=_0x3133e6[_0x6d2c('0x2c')]?_[_0x6d2c('0x31')](_[_0x6d2c('0x32')](_0x400ace,{'IntervalId':_0x3133e6[_0x6d2c('0x2c')]}),_0x6d2c('0x2b')):[];}_0x3133e6['context']=_0x39ad25[_0x6d2c('0xa')];_0x3133e6[_0x6d2c('0x2')]=_0x39ad25[_0x6d2c('0x2')];if(_0x3133e6[_0x6d2c('0x3')])_0x3133e6['type']=_0x3133e6['type'][_0x6d2c('0x33')]();if(_0x39ad25[_0x6d2c('0x3')]==='outbound'){if(_0x3133e6[_0x6d2c('0x34')](_0x6d2c('0x35'))&&_0x3133e6[_0x6d2c('0x35')]&&_0x3133e6[_0x6d2c('0x35')]!=='--'){_0x44a9e5[_0x6d2c('0x8')]({'type':_0x3133e6[_0x6d2c('0x3')][_0x6d2c('0x33')](),'app':'Set','appdata':_0x6d2c('0x36')+_0x3133e6[_0x6d2c('0x35')],'context':_0x39ad25[_0x6d2c('0xa')],'exten':_0x39ad25[_0x6d2c('0x2')],'priority':_0x3133e6['intervals'][_0x6d2c('0x2e')]+_0x54a4fd+_0x3a94d6++,'VoiceExtensionId':_0x39ad25['id']});}_0x44a9e5[_0x6d2c('0x8')]({'type':_0x3133e6['type'][_0x6d2c('0x33')](),'app':_0x6d2c('0x37'),'appdata':_0x6d2c('0x38')+(_0x3133e6[_0x6d2c('0x39')]?'Set(CALLERID(all)='+_0x3133e6['callerID']+')':'NoOp(No\x20number\x20available)'),'context':_0x39ad25[_0x6d2c('0xa')],'exten':_0x39ad25[_0x6d2c('0x2')],'priority':_0x3133e6[_0x6d2c('0x30')][_0x6d2c('0x2e')]+_0x54a4fd+_0x3a94d6++,'VoiceExtensionId':_0x39ad25['id']});}else{if(_0x3133e6[_0x6d2c('0x34')]('answer')){if([_0x6d2c('0x3a'),_0x6d2c('0x3b')][_0x6d2c('0x3c')](_0x3133e6[_0x6d2c('0x3d')][_0x6d2c('0x33')]())&&_0x3133e6[_0x6d2c('0x3e')]!=='custom'){if(_0x3133e6[_0x6d2c('0x3f')]){_0x44a9e5[_0x6d2c('0x8')]({'type':_0x3133e6[_0x6d2c('0x3')]['toLowerCase'](),'app':_0x6d2c('0x37'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x39ad25['context'],'exten':_0x39ad25[_0x6d2c('0x2')],'priority':_0x3133e6[_0x6d2c('0x30')]['length']+_0x54a4fd+_0x3a94d6++,'VoiceExtensionId':_0x39ad25['id']});_0x44a9e5[_0x6d2c('0x8')]({'type':_0x3133e6['type']['toLowerCase'](),'app':'Set','appdata':_0x6d2c('0x40'),'context':_0x39ad25[_0x6d2c('0xa')],'exten':_0x39ad25[_0x6d2c('0x2')],'priority':_0x3133e6[_0x6d2c('0x30')][_0x6d2c('0x2e')]+_0x54a4fd+_0x3a94d6++,'VoiceExtensionId':_0x39ad25['id']});}else{_0x44a9e5[_0x6d2c('0x8')]({'type':_0x3133e6[_0x6d2c('0x3')][_0x6d2c('0x33')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x39ad25[_0x6d2c('0xa')],'exten':_0x39ad25[_0x6d2c('0x2')],'priority':_0x3133e6[_0x6d2c('0x30')][_0x6d2c('0x2e')]+_0x54a4fd+_0x3a94d6++,'VoiceExtensionId':_0x39ad25['id']});_0x44a9e5[_0x6d2c('0x8')]({'type':_0x3133e6[_0x6d2c('0x3')][_0x6d2c('0x33')](),'app':_0x6d2c('0x9'),'appdata':_0x6d2c('0x41'),'context':_0x39ad25[_0x6d2c('0xa')],'exten':_0x39ad25[_0x6d2c('0x2')],'priority':_0x3133e6[_0x6d2c('0x30')][_0x6d2c('0x2e')]+_0x54a4fd+_0x3a94d6++,'VoiceExtensionId':_0x39ad25['id']});}}}}for(var _0x1095c4=0x0;_0x1095c4<_0x3133e6[_0x6d2c('0x30')][_0x6d2c('0x2e')];_0x1095c4++){var _0x4d7350=_0x54a4fd+_0x3133e6[_0x6d2c('0x30')][_0x6d2c('0x2e')];var _0x3685d8=_0x1095c4===_0x3133e6[_0x6d2c('0x30')]['length']-0x1?_0x54a4fd+_0x44a9e5[_0x6d2c('0x2e')]+_0x2a4ec7[_0x6d2c('0x2e')]+0x2:_0x54a4fd+_0x1095c4+0x1;_0x44a9e5['splice'](_0x1095c4,0x0,{'type':_0x39ad25[_0x6d2c('0x3')],'app':_0x6d2c('0x42'),'appdata':_0x3133e6[_0x6d2c('0x30')][_0x1095c4]+'?'+_0x39ad25['context']+_0x6d2c('0x43')+_0x4d7350+':'+_0x39ad25['context']+_0x6d2c('0x43')+_0x3685d8,'exten':_0x39ad25[_0x6d2c('0x2')],'context':_0x39ad25[_0x6d2c('0xa')],'priority':_0x54a4fd+_0x1095c4,'VoiceExtensionId':_0x39ad25['id']});}if(_0x3133e6['appType']===_0x6d2c('0x44')){_0x3133e6[_0x6d2c('0x45')]=_0x29bfad(_0x39ad25,_0x3133e6['appdata']);}if(_0x3133e6[_0x6d2c('0x3e')]==='agi'){_0x44a9e5[_0x6d2c('0x8')]({'type':_0x3133e6['type']['toLowerCase'](),'app':_0x6d2c('0x9'),'appdata':_0x6d2c('0x46'),'context':_0x39ad25[_0x6d2c('0xa')],'exten':_0x39ad25[_0x6d2c('0x2')],'priority':_0x3133e6[_0x6d2c('0x30')][_0x6d2c('0x2e')]+_0x54a4fd+_0x3a94d6++,'VoiceExtensionId':_0x39ad25['id']});}_0x3133e6['priority']=_0x44a9e5['length']?_[_0x6d2c('0x47')](_0x44a9e5)[_0x6d2c('0x48')]+0x1:_0x54a4fd;_0x482334=_[_0x6d2c('0x49')](_0x482334,_0x44a9e5,[_0x3133e6],_0x2a4ec7);_0x54a4fd=_[_0x6d2c('0x47')](_0x482334)['priority']+0x1;}return _0x1f3a36(_0x482334);})[_0x6d2c('0x4a')](function(_0x42be54){_0x62dad2(_0x42be54);});});}return _0x3e72e3[_0x6d2c('0x4b')](_0x6d2c('0x4c'),attributes,{'tableName':_0x6d2c('0x4d'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x262b8e){var _0x3e3f15=this['get']({'plain':!![]});var _0x42abbf=_0x3e3f15['type']===_0x6d2c('0xe')?_0x4d0f7a(_0x3e3f15):_0x2768e1(_0x3e3f15);return _0x5e8c4b(_0x3e3f15,_0x262b8e,_[_0x6d2c('0x47')](_0x42abbf)[_0x6d2c('0x48')]+0x1)[_0x6d2c('0x2d')](function(_0x4111e6){var _0x11c21a=_['concat'](_0x42abbf,_0x4111e6);_0x11c21a[_0x6d2c('0x8')]({'type':_0x3e3f15[_0x6d2c('0x3')],'app':_0x6d2c('0x4e'),'exten':_0x3e3f15[_0x6d2c('0x2')],'context':_0x3e3f15[_0x6d2c('0xa')],'priority':_[_0x6d2c('0x47')](_0x11c21a)[_0x6d2c('0x48')]+0x1,'VoiceExtensionId':_0x3e3f15['id']});return _0x11c21a;});}}});}; \ No newline at end of file +var _0xbd70=['XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','timeout','options','url','split','param','phone','prefix','SIP','indexOf','U(xcally-mixmonitor-context)','replace','join','isEmpty','Interval','findAll','IntervalId','then','length','interval','map','filter','tag','toLowerCase','CDR(tag)=','intervals','callerID','NoOp(No\x20number\x20available)','answer','queue','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','concat','last','VoiceExtension','voice_extensions','Hangup','lodash','exports','type','CDR(type)=','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','exten','inbound','push','Set','CDR(routeid)=','context'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xbd70,0xe5));var _0x0bd7=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xbd70[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x0bd7('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x0bd7('0x1')]=function(_0x94c857){var _0x2d9480=_0x94c857['models'];function _0x5ae5de(_0x5b6985){var _0x5e3f7d=0x2;var _0x4b13be=[{'type':_0x5b6985[_0x0bd7('0x2')],'app':'Set','appdata':_0x0bd7('0x3')+_0x5b6985[_0x0bd7('0x2')],'context':_0x5b6985['context'],'exten':_0x5b6985['exten'],'priority':_0x5e3f7d++,'VoiceExtensionId':_0x5b6985['id']},{'type':_0x5b6985[_0x0bd7('0x2')],'app':_0x5b6985[_0x0bd7('0x4')]?'Set':_0x0bd7('0x5'),'appdata':_0x5b6985[_0x0bd7('0x4')]?_0x0bd7('0x6')+_0x5b6985['alias']:_0x0bd7('0x7'),'context':_0x5b6985['context'],'exten':_0x5b6985[_0x0bd7('0x8')],'priority':_0x5e3f7d++,'VoiceExtensionId':_0x5b6985['id']}];if(_0x5b6985[_0x0bd7('0x2')]===_0x0bd7('0x9')){_0x4b13be[_0x0bd7('0xa')]({'type':'inbound','app':_0x0bd7('0xb'),'appdata':_0x0bd7('0xc')+_0x5b6985['id'],'context':_0x5b6985[_0x0bd7('0xd')],'exten':_0x5b6985[_0x0bd7('0x8')],'priority':_0x5e3f7d++,'VoiceExtensionId':_0x5b6985['id']});}_0x4b13be[_0x0bd7('0xa')]({'type':_0x5b6985['type'],'app':'Set','appdata':_0x0bd7('0xe'),'context':_0x5b6985[_0x0bd7('0xd')],'exten':_0x5b6985[_0x0bd7('0x8')],'priority':_0x5e3f7d++,'VoiceExtensionId':_0x5b6985['id']},{'type':_0x5b6985['type'],'app':_0x0bd7('0xb'),'appdata':_0x0bd7('0xf'),'context':_0x5b6985[_0x0bd7('0xd')],'exten':_0x5b6985[_0x0bd7('0x8')],'priority':_0x5e3f7d++,'VoiceExtensionId':_0x5b6985['id']},{'type':_0x5b6985[_0x0bd7('0x2')],'app':_0x0bd7('0xb'),'appdata':_0x0bd7('0x10'),'context':_0x5b6985[_0x0bd7('0xd')],'exten':_0x5b6985['exten'],'priority':_0x5e3f7d++,'VoiceExtensionId':_0x5b6985['id']});return _0x4b13be;}function _0x5c8d65(_0x4ca17d){var _0x364cbb=0x2;var _0x5e751f=[{'type':_0x0bd7('0x11'),'app':_0x0bd7('0xb'),'appdata':_0x0bd7('0x12'),'context':_0x4ca17d['context'],'exten':_0x4ca17d[_0x0bd7('0x8')],'priority':_0x364cbb++,'VoiceExtensionId':_0x4ca17d['id']},{'type':_0x0bd7('0x11'),'app':_0x4ca17d[_0x0bd7('0x4')]?'Set':_0x0bd7('0x5'),'appdata':_0x4ca17d[_0x0bd7('0x4')]?_0x0bd7('0x6')+_0x4ca17d[_0x0bd7('0x4')]:_0x0bd7('0x7'),'context':_0x4ca17d[_0x0bd7('0xd')],'exten':_0x4ca17d[_0x0bd7('0x8')],'priority':_0x364cbb++,'VoiceExtensionId':_0x4ca17d['id']},{'type':_0x0bd7('0x11'),'app':_0x0bd7('0xb'),'appdata':_0x0bd7('0x13')+(_0x4ca17d['cutdigits']?_0x0bd7('0x14')+_0x4ca17d['cutdigits']+'}':_0x0bd7('0x15')),'context':_0x4ca17d[_0x0bd7('0xd')],'exten':_0x4ca17d[_0x0bd7('0x8')],'priority':_0x364cbb++,'VoiceExtensionId':_0x4ca17d['id']},{'type':'outbound','app':'Set','appdata':_0x0bd7('0xc')+_0x4ca17d['id'],'context':_0x4ca17d[_0x0bd7('0xd')],'exten':_0x4ca17d[_0x0bd7('0x8')],'priority':_0x364cbb++,'VoiceExtensionId':_0x4ca17d['id']},{'type':_0x0bd7('0x11'),'app':_0x0bd7('0x16'),'appdata':_0x0bd7('0x17')+(_0x364cbb+0x2)+_0x0bd7('0x18')+(_0x364cbb+0x1)+')','context':_0x4ca17d[_0x0bd7('0xd')],'exten':_0x4ca17d['exten'],'priority':_0x364cbb++,'VoiceExtensionId':_0x4ca17d['id']},{'type':_0x0bd7('0x11'),'app':'Set','appdata':_0x4ca17d[_0x0bd7('0x19')]?_0x0bd7('0x1a')+_0x4ca17d['cutdigits']+'}':_0x0bd7('0x1b'),'context':_0x4ca17d[_0x0bd7('0xd')],'exten':_0x4ca17d[_0x0bd7('0x8')],'priority':_0x364cbb++,'VoiceExtensionId':_0x4ca17d['id']},{'type':_0x0bd7('0x11'),'app':_0x0bd7('0xb'),'appdata':_0x0bd7('0xe'),'context':_0x4ca17d[_0x0bd7('0xd')],'exten':_0x4ca17d['exten'],'priority':_0x364cbb++,'VoiceExtensionId':_0x4ca17d['id']},{'type':_0x0bd7('0x11'),'app':_0x0bd7('0xb'),'appdata':_0x0bd7('0xf'),'context':_0x4ca17d[_0x0bd7('0xd')],'exten':_0x4ca17d[_0x0bd7('0x8')],'priority':_0x364cbb++,'VoiceExtensionId':_0x4ca17d['id']},{'type':_0x0bd7('0x11'),'app':_0x0bd7('0xb'),'appdata':_0x0bd7('0x10'),'context':_0x4ca17d['context'],'exten':_0x4ca17d[_0x0bd7('0x8')],'priority':_0x364cbb++,'VoiceExtensionId':_0x4ca17d['id']},{'type':_0x0bd7('0x11'),'app':_0x0bd7('0xb'),'appdata':'outboundrouteid='+_0x4ca17d['id'],'context':_0x4ca17d[_0x0bd7('0xd')],'exten':_0x4ca17d[_0x0bd7('0x8')],'priority':_0x364cbb++,'VoiceExtensionId':_0x4ca17d['id']}];if(_0x4ca17d[_0x0bd7('0x1c')](_0x0bd7('0x1d'))&&_0x4ca17d['recordingFormat']!==_0x0bd7('0x1e')){_0x5e751f[_0x0bd7('0xa')]({'type':_0x0bd7('0x11'),'app':_0x0bd7('0xb'),'appdata':_0x0bd7('0x1f'),'context':_0x4ca17d[_0x0bd7('0xd')],'exten':_0x4ca17d[_0x0bd7('0x8')],'priority':_0x364cbb++,'VoiceExtensionId':_0x4ca17d['id']},{'type':'outbound','app':_0x0bd7('0xb'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x4ca17d[_0x0bd7('0x1d')]||_0x0bd7('0x20'),'context':_0x4ca17d[_0x0bd7('0xd')],'exten':_0x4ca17d[_0x0bd7('0x8')],'priority':_0x364cbb++,'VoiceExtensionId':_0x4ca17d['id']});}return _0x5e751f;}function _0x2adb73(_0xc16c71,_0x11d35e){var _0x4db11f=[{'name':_0x0bd7('0x21'),'param':0x0},{'name':_0x0bd7('0x22'),'param':0x1},{'name':_0x0bd7('0x23'),'param':0x2},{'name':_0x0bd7('0x24'),'param':0x3}];var _0xbf2399={};var _0x8f35f6=_0x11d35e[_0x0bd7('0x25')](',');var _0x5198fd=[];for(var _0x1f9669=0x0;_0x1f9669<_0x4db11f['length'];_0x1f9669++){switch(_0x4db11f[_0x1f9669]['name']){case _0x0bd7('0x21'):_0xbf2399[_0x0bd7('0x21')]=_0x8f35f6[_0x4db11f[_0x1f9669][_0x0bd7('0x26')]][_0x0bd7('0x25')]('/')[0x1];_0xbf2399[_0x0bd7('0x27')]=_0x8f35f6[_0x4db11f[_0x1f9669][_0x0bd7('0x26')]][_0x0bd7('0x25')]('/')[0x2];_0xbf2399['prefix']=_0xbf2399[_0x0bd7('0x27')]?_0xbf2399[_0x0bd7('0x27')][_0x0bd7('0x25')]('$')[0x0]:undefined;_0xbf2399[_0x0bd7('0x27')]=_0xc16c71[_0x0bd7('0x19')]?(_0xbf2399['prefix']||'')+_0x0bd7('0x14')+_0xc16c71[_0x0bd7('0x19')]+'}':(_0xbf2399[_0x0bd7('0x28')]||'')+'${EXTEN}';_0x5198fd[_0x4db11f[_0x1f9669][_0x0bd7('0x26')]]=[_0x0bd7('0x29'),_0xbf2399[_0x0bd7('0x21')],_0xbf2399[_0x0bd7('0x27')]]['join']('/');break;case _0x0bd7('0x23'):_0xbf2399[_0x0bd7('0x23')]=_0x8f35f6[_0x4db11f[_0x1f9669][_0x0bd7('0x26')]];if(_0xc16c71[_0x0bd7('0x1d')]!==_0x0bd7('0x1e')){if(_0xbf2399[_0x0bd7('0x23')][_0x0bd7('0x2a')](_0x0bd7('0x2b'))<0x0){_0xbf2399[_0x0bd7('0x23')]+=_0x0bd7('0x2b');}}else{_0xbf2399[_0x0bd7('0x23')]=_0xbf2399['options'][_0x0bd7('0x2c')](_0x0bd7('0x2b'),'');}_0x5198fd[_0x4db11f[_0x1f9669]['param']]=_0xbf2399['options'];break;default:_0x5198fd[_0x4db11f[_0x1f9669][_0x0bd7('0x26')]]=_0x8f35f6[_0x4db11f[_0x1f9669]['param']];}}return _0x5198fd[_0x0bd7('0x2d')](',');}function _0x3fc1cc(_0x20f57f,_0x3ba693,_0x1007fb){return new Promise(function(_0x338145,_0x1fc982){var _0x1b11fd=[];if(_[_0x0bd7('0x2e')](_0x3ba693))return _0x338145(_0x1b11fd);_0x2d9480[_0x0bd7('0x2f')][_0x0bd7('0x30')]({'attributes':['id','interval',_0x0bd7('0x31')],'raw':!![]})[_0x0bd7('0x32')](function(_0x3b7c5d){for(var _0x4f6e81=0x0,_0x4f66d7=0x0;_0x4f6e81<_0x3ba693[_0x0bd7('0x33')];_0x4f6e81++,_0x4f66d7=0x0){var _0x492fae=_0x3ba693[_0x4f6e81];var _0x177add=[];var _0xb574f4=[];delete _0x492fae['id'];if(_0x492fae['interval']!=='*,*,*,*'){_0x492fae['intervals']=[_0x492fae[_0x0bd7('0x34')]];}else{_0x492fae['intervals']=_0x492fae['IntervalId']?_[_0x0bd7('0x35')](_[_0x0bd7('0x36')](_0x3b7c5d,{'IntervalId':_0x492fae[_0x0bd7('0x31')]}),_0x0bd7('0x34')):[];}_0x492fae['context']=_0x20f57f[_0x0bd7('0xd')];_0x492fae[_0x0bd7('0x8')]=_0x20f57f[_0x0bd7('0x8')];if(_0x492fae[_0x0bd7('0x2')])_0x492fae[_0x0bd7('0x2')]=_0x492fae[_0x0bd7('0x2')]['toLowerCase']();if(_0x20f57f['type']==='outbound'){if(_0x492fae['hasOwnProperty']('tag')&&_0x492fae[_0x0bd7('0x37')]&&_0x492fae['tag']!=='--'){_0x177add['push']({'type':_0x492fae['type'][_0x0bd7('0x38')](),'app':_0x0bd7('0xb'),'appdata':_0x0bd7('0x39')+_0x492fae['tag'],'context':_0x20f57f[_0x0bd7('0xd')],'exten':_0x20f57f[_0x0bd7('0x8')],'priority':_0x492fae[_0x0bd7('0x3a')][_0x0bd7('0x33')]+_0x1007fb+_0x4f66d7++,'VoiceExtensionId':_0x20f57f['id']});}_0x177add['push']({'type':_0x492fae[_0x0bd7('0x2')][_0x0bd7('0x38')](),'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x492fae[_0x0bd7('0x3b')]?'Set(CALLERID(all)='+_0x492fae['callerID']+')':_0x0bd7('0x3c')),'context':_0x20f57f[_0x0bd7('0xd')],'exten':_0x20f57f[_0x0bd7('0x8')],'priority':_0x492fae['intervals'][_0x0bd7('0x33')]+_0x1007fb+_0x4f66d7++,'VoiceExtensionId':_0x20f57f['id']});}else{if(_0x492fae[_0x0bd7('0x1c')](_0x0bd7('0x3d'))){if([_0x0bd7('0x3e'),'playback']['includes'](_0x492fae[_0x0bd7('0x3f')]['toLowerCase']())&&_0x492fae[_0x0bd7('0x40')]!==_0x0bd7('0x41')){if(_0x492fae[_0x0bd7('0x3d')]){_0x177add[_0x0bd7('0xa')]({'type':_0x492fae[_0x0bd7('0x2')][_0x0bd7('0x38')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x20f57f['context'],'exten':_0x20f57f['exten'],'priority':_0x492fae[_0x0bd7('0x3a')][_0x0bd7('0x33')]+_0x1007fb+_0x4f66d7++,'VoiceExtensionId':_0x20f57f['id']});_0x177add['push']({'type':_0x492fae['type']['toLowerCase'](),'app':_0x0bd7('0xb'),'appdata':_0x0bd7('0x42'),'context':_0x20f57f[_0x0bd7('0xd')],'exten':_0x20f57f[_0x0bd7('0x8')],'priority':_0x492fae['intervals'][_0x0bd7('0x33')]+_0x1007fb+_0x4f66d7++,'VoiceExtensionId':_0x20f57f['id']});}else{_0x177add[_0x0bd7('0xa')]({'type':_0x492fae[_0x0bd7('0x2')][_0x0bd7('0x38')](),'app':_0x0bd7('0x16'),'appdata':_0x0bd7('0x43'),'context':_0x20f57f[_0x0bd7('0xd')],'exten':_0x20f57f[_0x0bd7('0x8')],'priority':_0x492fae[_0x0bd7('0x3a')][_0x0bd7('0x33')]+_0x1007fb+_0x4f66d7++,'VoiceExtensionId':_0x20f57f['id']});_0x177add[_0x0bd7('0xa')]({'type':_0x492fae[_0x0bd7('0x2')][_0x0bd7('0x38')](),'app':_0x0bd7('0xb'),'appdata':_0x0bd7('0x44'),'context':_0x20f57f[_0x0bd7('0xd')],'exten':_0x20f57f[_0x0bd7('0x8')],'priority':_0x492fae[_0x0bd7('0x3a')][_0x0bd7('0x33')]+_0x1007fb+_0x4f66d7++,'VoiceExtensionId':_0x20f57f['id']});}}}}for(var _0x25fd64=0x0;_0x25fd64<_0x492fae[_0x0bd7('0x3a')][_0x0bd7('0x33')];_0x25fd64++){var _0x555677=_0x1007fb+_0x492fae[_0x0bd7('0x3a')][_0x0bd7('0x33')];var _0x388b3b=_0x25fd64===_0x492fae[_0x0bd7('0x3a')]['length']-0x1?_0x1007fb+_0x177add['length']+_0xb574f4['length']+0x2:_0x1007fb+_0x25fd64+0x1;_0x177add[_0x0bd7('0x45')](_0x25fd64,0x0,{'type':_0x20f57f[_0x0bd7('0x2')],'app':_0x0bd7('0x46'),'appdata':_0x492fae['intervals'][_0x25fd64]+'?'+_0x20f57f['context']+_0x0bd7('0x47')+_0x555677+':'+_0x20f57f[_0x0bd7('0xd')]+_0x0bd7('0x47')+_0x388b3b,'exten':_0x20f57f['exten'],'context':_0x20f57f[_0x0bd7('0xd')],'priority':_0x1007fb+_0x25fd64,'VoiceExtensionId':_0x20f57f['id']});}if(_0x492fae[_0x0bd7('0x40')]==='outboundDial'){_0x492fae[_0x0bd7('0x48')]=_0x2adb73(_0x20f57f,_0x492fae['appdata']);}if(_0x492fae['appType']===_0x0bd7('0x49')){_0x177add[_0x0bd7('0xa')]({'type':_0x492fae[_0x0bd7('0x2')][_0x0bd7('0x38')](),'app':_0x0bd7('0xb'),'appdata':_0x0bd7('0x4a'),'context':_0x20f57f[_0x0bd7('0xd')],'exten':_0x20f57f[_0x0bd7('0x8')],'priority':_0x492fae[_0x0bd7('0x3a')][_0x0bd7('0x33')]+_0x1007fb+_0x4f66d7++,'VoiceExtensionId':_0x20f57f['id']});}_0x492fae[_0x0bd7('0x4b')]=_0x177add[_0x0bd7('0x33')]?_['last'](_0x177add)[_0x0bd7('0x4b')]+0x1:_0x1007fb;_0x1b11fd=_[_0x0bd7('0x4c')](_0x1b11fd,_0x177add,[_0x492fae],_0xb574f4);_0x1007fb=_[_0x0bd7('0x4d')](_0x1b11fd)[_0x0bd7('0x4b')]+0x1;}return _0x338145(_0x1b11fd);})['catch'](function(_0x5da905){_0x1fc982(_0x5da905);});});}return _0x94c857['define'](_0x0bd7('0x4e'),attributes,{'tableName':_0x0bd7('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x14a919){var _0x34d61a=this['get']({'plain':!![]});var _0x35fe48=_0x34d61a[_0x0bd7('0x2')]==='outbound'?_0x5c8d65(_0x34d61a):_0x5ae5de(_0x34d61a);return _0x3fc1cc(_0x34d61a,_0x14a919,_[_0x0bd7('0x4d')](_0x35fe48)[_0x0bd7('0x4b')]+0x1)[_0x0bd7('0x32')](function(_0x1b8909){var _0xa44114=_[_0x0bd7('0x4c')](_0x35fe48,_0x1b8909);_0xa44114[_0x0bd7('0xa')]({'type':_0x34d61a['type'],'app':_0x0bd7('0x50'),'exten':_0x34d61a[_0x0bd7('0x8')],'context':_0x34d61a[_0x0bd7('0xd')],'priority':_[_0x0bd7('0x4d')](_0xa44114)[_0x0bd7('0x4b')]+0x1,'VoiceExtensionId':_0x34d61a['id']});return _0xa44114;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index d6b0b46..652a090 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 _0x36bb=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','where','attributes','limit','map','model','include','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x20f635,_0x2237d4){var _0x38be5f=function(_0x420b2f){while(--_0x420b2f){_0x20f635['push'](_0x20f635['shift']());}};_0x38be5f(++_0x2237d4);}(_0x36bb,0xe6));var _0xb36b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36bb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb36b('0x0'));var util=require(_0xb36b('0x1'));var moment=require(_0xb36b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb36b('0x3'));var fs=require('fs');var Redis=require(_0xb36b('0x4'));var db=require(_0xb36b('0x5'))['db'];var utils=require(_0xb36b('0x6'));var logger=require(_0xb36b('0x7'))(_0xb36b('0x8'));var config=require(_0xb36b('0x9'));var jayson=require(_0xb36b('0xa'));var client=jayson[_0xb36b('0xb')][_0xb36b('0xc')]({'port':0x232a});config[_0xb36b('0xd')]=_[_0xb36b('0xe')](config[_0xb36b('0xd')],{'host':_0xb36b('0xf'),'port':0x18eb});var socket=require(_0xb36b('0x10'))(new Redis(config[_0xb36b('0xd')]));require(_0xb36b('0x11'))[_0xb36b('0x12')](socket);function respondWithRpcPromise(_0x18dea6,_0x5b70e7,_0x2323b0){return new BPromise(function(_0x2b26c4,_0x2bd78b){return client['request'](_0x18dea6,_0x2323b0)[_0xb36b('0x13')](function(_0x449056){logger[_0xb36b('0x14')](_0xb36b('0x15'),_0x5b70e7,_0xb36b('0x16'));logger[_0xb36b('0x17')](_0xb36b('0x18'),_0x5b70e7,_0xb36b('0x16'),JSON[_0xb36b('0x19')](_0x449056));if(_0x449056[_0xb36b('0x1a')]){if(_0x449056[_0xb36b('0x1a')]['code']===0x1f4){logger[_0xb36b('0x1a')]('VoiceExtension,\x20%s,\x20%s',_0x5b70e7,_0x449056['error'][_0xb36b('0x1b')]);return _0x2bd78b(_0x449056[_0xb36b('0x1a')][_0xb36b('0x1b')]);}logger[_0xb36b('0x1a')](_0xb36b('0x15'),_0x5b70e7,_0x449056[_0xb36b('0x1a')]['message']);return _0x2b26c4(_0x449056[_0xb36b('0x1a')][_0xb36b('0x1b')]);}else{logger[_0xb36b('0x14')](_0xb36b('0x15'),_0x5b70e7,'request\x20sent');_0x2b26c4(_0x449056[_0xb36b('0x1c')][_0xb36b('0x1b')]);}})[_0xb36b('0x1d')](function(_0x57a7b2){logger[_0xb36b('0x1a')]('VoiceExtension,\x20%s,\x20%s',_0x5b70e7,_0x57a7b2);_0x2bd78b(_0x57a7b2);});});}exports[_0xb36b('0x1e')]=function(_0xac85bd){var _0x27979d=this;return new Promise(function(_0x3eba4b,_0x4049fa){return db[_0xb36b('0x1f')][_0xb36b('0x20')]({'raw':_0xac85bd['options']?_0xac85bd[_0xb36b('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0xac85bd[_0xb36b('0x21')]?_0xac85bd['options'][_0xb36b('0x22')]||null:null,'attributes':_0xac85bd[_0xb36b('0x21')]?_0xac85bd[_0xb36b('0x21')][_0xb36b('0x23')]||null:null,'limit':_0xac85bd[_0xb36b('0x21')]?_0xac85bd['options'][_0xb36b('0x24')]||null:null,'include':_0xac85bd[_0xb36b('0x21')]?_0xac85bd[_0xb36b('0x21')]['include']?_[_0xb36b('0x25')](_0xac85bd['options']['include'],function(_0x50e8e4){return{'model':db[_0x50e8e4[_0xb36b('0x26')]],'as':_0x50e8e4['as'],'attributes':_0x50e8e4[_0xb36b('0x23')],'include':_0x50e8e4[_0xb36b('0x27')]?_[_0xb36b('0x25')](_0x50e8e4[_0xb36b('0x27')],function(_0x46dfc){return{'model':db[_0x46dfc[_0xb36b('0x26')]],'as':_0x46dfc['as'],'attributes':_0x46dfc[_0xb36b('0x23')],'include':_0x46dfc['include']?_['map'](_0x46dfc[_0xb36b('0x27')],function(_0x2724bf){return{'model':db[_0x2724bf[_0xb36b('0x26')]],'as':_0x2724bf['as'],'attributes':_0x2724bf[_0xb36b('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x492a96){logger[_0xb36b('0x14')]('GetVoiceExtension',_0xac85bd);logger[_0xb36b('0x17')](_0xb36b('0x1e'),_0xac85bd,JSON['stringify'](_0x492a96));_0x3eba4b(_0x492a96);})[_0xb36b('0x1d')](function(_0x24f8bc){logger[_0xb36b('0x1a')](_0xb36b('0x1e'),_0x24f8bc[_0xb36b('0x1b')],_0xac85bd);_0x4049fa(_0x27979d[_0xb36b('0x1a')](0x1f4,_0x24f8bc[_0xb36b('0x1b')]));});});}; \ No newline at end of file +var _0x7046=['jayson/promise','client','http','defaults','socket.io-emitter','register','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceExtension','findAll','options','where','attributes','limit','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x373687,_0x31dca2){var _0x400a92=function(_0x175c59){while(--_0x175c59){_0x373687['push'](_0x373687['shift']());}};_0x400a92(++_0x31dca2);}(_0x7046,0x144));var _0x6704=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7046[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var moment=require(_0x6704('0x2'));var BPromise=require(_0x6704('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6704('0x4'));var db=require(_0x6704('0x5'))['db'];var utils=require(_0x6704('0x6'));var logger=require('../../config/logger')(_0x6704('0x7'));var config=require(_0x6704('0x8'));var jayson=require(_0x6704('0x9'));var client=jayson[_0x6704('0xa')][_0x6704('0xb')]({'port':0x232a});config['redis']=_[_0x6704('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6704('0xd'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0x6704('0xe')](socket);function respondWithRpcPromise(_0x394ef4,_0x37a1ad,_0x454bd5){return new BPromise(function(_0x356687,_0x40d57d){return client[_0x6704('0xf')](_0x394ef4,_0x454bd5)[_0x6704('0x10')](function(_0x58cc09){logger[_0x6704('0x11')](_0x6704('0x12'),_0x37a1ad,'request\x20sent');logger[_0x6704('0x13')](_0x6704('0x14'),_0x37a1ad,_0x6704('0x15'),JSON[_0x6704('0x16')](_0x58cc09));if(_0x58cc09[_0x6704('0x17')]){if(_0x58cc09[_0x6704('0x17')][_0x6704('0x18')]===0x1f4){logger[_0x6704('0x17')](_0x6704('0x12'),_0x37a1ad,_0x58cc09['error'][_0x6704('0x19')]);return _0x40d57d(_0x58cc09[_0x6704('0x17')][_0x6704('0x19')]);}logger['error'](_0x6704('0x12'),_0x37a1ad,_0x58cc09[_0x6704('0x17')][_0x6704('0x19')]);return _0x356687(_0x58cc09[_0x6704('0x17')][_0x6704('0x19')]);}else{logger['info'](_0x6704('0x12'),_0x37a1ad,_0x6704('0x15'));_0x356687(_0x58cc09[_0x6704('0x1a')][_0x6704('0x19')]);}})[_0x6704('0x1b')](function(_0x5df2df){logger[_0x6704('0x17')](_0x6704('0x12'),_0x37a1ad,_0x5df2df);_0x40d57d(_0x5df2df);});});}exports[_0x6704('0x1c')]=function(_0x156106){var _0x35eb99=this;return new Promise(function(_0x301fea,_0x42b27f){return db['VoiceExtension'][_0x6704('0x1d')]({'raw':_0x156106[_0x6704('0x1e')]?_0x156106[_0x6704('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x156106['options']?_0x156106[_0x6704('0x1e')][_0x6704('0x1f')]||null:null,'attributes':_0x156106[_0x6704('0x1e')]?_0x156106[_0x6704('0x1e')][_0x6704('0x20')]||null:null,'limit':_0x156106['options']?_0x156106[_0x6704('0x1e')][_0x6704('0x21')]||null:null,'include':_0x156106[_0x6704('0x1e')]?_0x156106[_0x6704('0x1e')][_0x6704('0x22')]?_[_0x6704('0x23')](_0x156106[_0x6704('0x1e')][_0x6704('0x22')],function(_0x896227){return{'model':db[_0x896227[_0x6704('0x24')]],'as':_0x896227['as'],'attributes':_0x896227[_0x6704('0x20')],'include':_0x896227[_0x6704('0x22')]?_[_0x6704('0x23')](_0x896227['include'],function(_0x5ac014){return{'model':db[_0x5ac014[_0x6704('0x24')]],'as':_0x5ac014['as'],'attributes':_0x5ac014[_0x6704('0x20')],'include':_0x5ac014[_0x6704('0x22')]?_[_0x6704('0x23')](_0x5ac014['include'],function(_0x1def46){return{'model':db[_0x1def46[_0x6704('0x24')]],'as':_0x1def46['as'],'attributes':_0x1def46['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x16e749){logger['info'](_0x6704('0x1c'),_0x156106);logger['debug']('GetVoiceExtension',_0x156106,JSON[_0x6704('0x16')](_0x16e749));_0x301fea(_0x16e749);})[_0x6704('0x1b')](function(_0x45a286){logger['error'](_0x6704('0x1c'),_0x45a286[_0x6704('0x19')],_0x156106);_0x42b27f(_0x35eb99[_0x6704('0x17')](0x1f4,_0x45a286[_0x6704('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 29c192b..9e9fe1c 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 _0x53ec=['length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x2cf57f,_0x4ecf6a){var _0x18e5d3=function(_0x109420){while(--_0x109420){_0x2cf57f['push'](_0x2cf57f['shift']());}};_0x18e5d3(++_0x4ecf6a);}(_0x53ec,0x192));var _0xc53e=function(_0x50068c,_0x38a87a){_0x50068c=_0x50068c-0x0;var _0x11826a=_0x53ec[_0x50068c];return _0x11826a;};'use strict';var VoiceExtensionEvents=require(_0xc53e('0x0'));var events=[_0xc53e('0x1'),_0xc53e('0x2'),_0xc53e('0x3')];function createListener(_0x1b04cc,_0xe45c6d){return function(_0x51c435){_0xe45c6d[_0xc53e('0x4')](_0x1b04cc,_0x51c435);};}function removeListener(_0x4e954a,_0x2b90f6){return function(){VoiceExtensionEvents[_0xc53e('0x5')](_0x4e954a,_0x2b90f6);};}exports['register']=function(_0x2f1414){for(var _0x4f989b=0x0,_0x41a9e8=events[_0xc53e('0x6')];_0x4f989b<_0x41a9e8;_0x4f989b++){var _0x5d3b28=events[_0x4f989b];var _0x1616ac=createListener(_0xc53e('0x7')+_0x5d3b28,_0x2f1414);VoiceExtensionEvents['on'](_0x5d3b28,_0x1616ac);}}; \ No newline at end of file +var _0x0295=['emit','removeListener','register','voiceExtension:','./voiceExtension.events','update'];(function(_0x3d0f28,_0x2fbe27){var _0x2123d1=function(_0x367781){while(--_0x367781){_0x3d0f28['push'](_0x3d0f28['shift']());}};_0x2123d1(++_0x2fbe27);}(_0x0295,0x1f0));var _0x5029=function(_0x44f470,_0x74d1a8){_0x44f470=_0x44f470-0x0;var _0x54f0f5=_0x0295[_0x44f470];return _0x54f0f5;};'use strict';var VoiceExtensionEvents=require(_0x5029('0x0'));var events=['save','remove',_0x5029('0x1')];function createListener(_0x4f552a,_0x53c2e1){return function(_0x315589){_0x53c2e1[_0x5029('0x2')](_0x4f552a,_0x315589);};}function removeListener(_0x157a4f,_0x3d0af1){return function(){VoiceExtensionEvents[_0x5029('0x3')](_0x157a4f,_0x3d0af1);};}exports[_0x5029('0x4')]=function(_0x200217){for(var _0x215955=0x0,_0x5b3cd=events['length'];_0x215955<_0x5b3cd;_0x215955++){var _0x54978f=events[_0x215955];var _0x4ee867=createListener(_0x5029('0x5')+_0x54978f,_0x200217);VoiceExtensionEvents['on'](_0x54978f,_0x4ee867);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index d5be904..02b6036 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 _0x4137=['getMessages','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','/:id','isAuthenticated','/:id/messages'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x4137,0xf8));var _0x7413=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x4137[_0x27af45];return _0x18df21;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var fs_extra=require(_0x7413('0x6'));var auth=require(_0x7413('0x7'));var interaction=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var controller=require(_0x7413('0xa'));router[_0x7413('0xb')]('/',auth['isAuthenticated'](),controller[_0x7413('0xc')]);router[_0x7413('0xb')](_0x7413('0xd'),auth[_0x7413('0xe')](),controller['show']);router[_0x7413('0xb')](_0x7413('0xf'),auth['isAuthenticated'](),controller[_0x7413('0x10')]);router[_0x7413('0x11')]('/',auth['isAuthenticated'](),controller[_0x7413('0x12')]);router[_0x7413('0x13')](_0x7413('0xd'),auth[_0x7413('0xe')](),controller[_0x7413('0x14')]);router['delete'](_0x7413('0xd'),auth[_0x7413('0xe')](),controller['destroy']);module[_0x7413('0x15')]=router; \ No newline at end of file +var _0x4137=['getMessages','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','/:id','isAuthenticated','/:id/messages'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x4137,0xf8));var _0x7413=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x4137[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var fs_extra=require(_0x7413('0x6'));var auth=require(_0x7413('0x7'));var interaction=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var controller=require(_0x7413('0xa'));router[_0x7413('0xb')]('/',auth['isAuthenticated'](),controller[_0x7413('0xc')]);router[_0x7413('0xb')](_0x7413('0xd'),auth[_0x7413('0xe')](),controller['show']);router[_0x7413('0xb')](_0x7413('0xf'),auth['isAuthenticated'](),controller[_0x7413('0x10')]);router[_0x7413('0x11')]('/',auth['isAuthenticated'](),controller[_0x7413('0x12')]);router[_0x7413('0x13')](_0x7413('0xd'),auth[_0x7413('0xe')](),controller[_0x7413('0x14')]);router['delete'](_0x7413('0xd'),auth[_0x7413('0xe')](),controller['destroy']);module[_0x7413('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index e4dd84d..24a9034 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 _0xa536=['contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue','mailbox','sequelize','STRING','from-voicemail'];(function(_0x57362e,_0x168f94){var _0x2255ab=function(_0x3959ad){while(--_0x3959ad){_0x57362e['push'](_0x57362e['shift']());}};_0x2255ab(++_0x168f94);}(_0xa536,0x173));var _0x6a53=function(_0x728e60,_0x432cd8){_0x728e60=_0x728e60-0x0;var _0x4cff82=_0xa536[_0x728e60];return _0x4cff82;};'use strict';var Sequelize=require(_0x6a53('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x6a53('0x1')],'defaultValue':_0x6a53('0x2'),'unique':_0x6a53('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x6a53('0x1')]},'fullname':{'type':Sequelize[_0x6a53('0x1')]},'email':{'type':Sequelize[_0x6a53('0x1')],'validate':{'isEmail':!![]},'set':function(_0x326e53){this[_0x6a53('0x4')](_0x6a53('0x5'),typeof _0x326e53===_0x6a53('0x6')&&_0x326e53[_0x6a53('0x7')]()?_0x326e53[_0x6a53('0x7')]():null);}},'pager':{'type':Sequelize[_0x6a53('0x1')]},'tz':{'type':Sequelize[_0x6a53('0x1')],'defaultValue':_0x6a53('0x8')},'attach':{'type':Sequelize[_0x6a53('0x9')](_0x6a53('0xa'),'no'),'defaultValue':_0x6a53('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x6a53('0x9')](_0x6a53('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x6a53('0x1')]},'review':{'type':Sequelize[_0x6a53('0x9')](_0x6a53('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x6a53('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x6a53('0x9')](_0x6a53('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x6a53('0x9')](_0x6a53('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x6a53('0x9')](_0x6a53('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x6a53('0x9')]('yes','no'),'defaultValue':_0x6a53('0xa'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x6a53('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x6a53('0x9')](_0x6a53('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x6a53('0x9')](_0x6a53('0xa'),'no'),'defaultValue':_0x6a53('0xa'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x6a53('0x1')]},'emailbody':{'type':Sequelize[_0x6a53('0x1')]},'maxsecs':{'type':Sequelize[_0x6a53('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x6a53('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x6a53('0xc')],'get':function(){return this['getDataValue'](_0x6a53('0xd'))+_0x6a53('0xe')+this[_0x6a53('0xf')](_0x6a53('0x10'));}}}; \ No newline at end of file +var _0x64e6=['STRING','contest_mailbox','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','\x20-\x20','exports'];(function(_0xa71ab,_0xd58b6e){var _0x19f3e7=function(_0x48be05){while(--_0x48be05){_0xa71ab['push'](_0xa71ab['shift']());}};_0x19f3e7(++_0xd58b6e);}(_0x64e6,0x99));var _0x664e=function(_0x493eae,_0x4cc2d4){_0x493eae=_0x493eae-0x0;var _0x1dc975=_0x64e6[_0x493eae];return _0x1dc975;};'use strict';var Sequelize=require('sequelize');module[_0x664e('0x0')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x664e('0x1')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x664e('0x1')],'defaultValue':'','allowNull':![],'unique':_0x664e('0x2')},'password':{'type':Sequelize[_0x664e('0x1')]},'fullname':{'type':Sequelize[_0x664e('0x1')]},'email':{'type':Sequelize[_0x664e('0x1')],'validate':{'isEmail':!![]},'set':function(_0x4c7709){this['setDataValue'](_0x664e('0x3'),typeof _0x4c7709===_0x664e('0x4')&&_0x4c7709[_0x664e('0x5')]()?_0x4c7709[_0x664e('0x5')]():null);}},'pager':{'type':Sequelize[_0x664e('0x1')]},'tz':{'type':Sequelize[_0x664e('0x1')],'defaultValue':_0x664e('0x6')},'attach':{'type':Sequelize[_0x664e('0x7')](_0x664e('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x664e('0x7')](_0x664e('0x8'),'no'),'defaultValue':_0x664e('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x664e('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM'](_0x664e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x664e('0x7')](_0x664e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x664e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x664e('0x7')](_0x664e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x664e('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x664e('0x7')](_0x664e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x664e('0x7')](_0x664e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x664e('0x7')](_0x664e('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x664e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x664e('0x7')](_0x664e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x664e('0x8'),'no'),'defaultValue':_0x664e('0x8'),'allowNull':![]},'stamp':{'type':_0x664e('0xa')},'emailsubject':{'type':Sequelize[_0x664e('0x1')]},'emailbody':{'type':Sequelize[_0x664e('0x1')]},'maxsecs':{'type':Sequelize[_0x664e('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x664e('0xc')],'get':function(){return this['getDataValue']('fullname')+_0x664e('0xd')+this['getDataValue']('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index ed07f76..f0098da 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 _0xf4eb=['fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy','Voicemails','UserProfileResource','error','stack','name','send','index','map','VoiceMail','fieldName','key','model','keys','filters','intersection','attributes','fields','query','length','order','sort','pick','where','merge','type','VIRTUAL','filter','options','include','rows','catch','show','rawAttributes','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','getMessages','VoiceMailMessage','hasOwnProperty','nolimit','mailbox','eml-format','moment','util','path','sox','to-csv','ejs'];(function(_0x1259c4,_0x14cb41){var _0x27eba2=function(_0x3b3ba6){while(--_0x3b3ba6){_0x1259c4['push'](_0x1259c4['shift']());}};_0x27eba2(++_0x14cb41);}(_0xf4eb,0xec));var _0xbf4e=function(_0x8229e5,_0x4e9ddb){_0x8229e5=_0x8229e5-0x0;var _0x3eddfe=_0xf4eb[_0x8229e5];return _0x3eddfe;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){var _0x3a5d72=_0x30994d['get']({'plain':!![]});var _0x90635e=_0xbf4e('0x21');return db[_0xbf4e('0x22')]['destroy']({'where':{'type':_0x90635e,'resourceId':_0x3a5d72['id']}})[_0xbf4e('0x1f')](function(){return _0x30994d;});})['then'](function(){_0x51648c['status'](0xcc)[_0xbf4e('0x15')]();});}};}function handleEntityNotFound(_0x5a0a9b,_0x38c923){return function(_0x315df3){if(!_0x315df3){_0x5a0a9b[_0xbf4e('0x13')](0x194);}return _0x315df3;};}function handleError(_0x41f918,_0x5c912f){_0x5c912f=_0x5c912f||0x1f4;return function(_0x2d4686){logger[_0xbf4e('0x23')](_0x2d4686[_0xbf4e('0x24')]);if(_0x2d4686['name']){delete _0x2d4686[_0xbf4e('0x25')];}_0x41f918['status'](_0x5c912f)[_0xbf4e('0x26')](_0x2d4686);};}exports[_0xbf4e('0x27')]=function(_0xb8b58e,_0x498dbd){var _0x1d12e2={},_0x362716={},_0x2f3cf8={'count':0x0,'rows':[]};var _0xc7ca87=_[_0xbf4e('0x28')](db[_0xbf4e('0x29')]['rawAttributes'],function(_0x35c82d){return{'name':_0x35c82d[_0xbf4e('0x2a')],'type':_0x35c82d['type'][_0xbf4e('0x2b')]};});_0x362716[_0xbf4e('0x2c')]=_['map'](_0xc7ca87,_0xbf4e('0x25'));_0x362716['query']=_[_0xbf4e('0x2d')](_0xb8b58e['query']);_0x362716[_0xbf4e('0x2e')]=_[_0xbf4e('0x2f')](_0x362716[_0xbf4e('0x2c')],_0x362716['query']);_0x1d12e2[_0xbf4e('0x30')]=_[_0xbf4e('0x2f')](_0x362716[_0xbf4e('0x2c')],qs[_0xbf4e('0x31')](_0xb8b58e[_0xbf4e('0x32')][_0xbf4e('0x31')]));_0x1d12e2['attributes']=_0x1d12e2[_0xbf4e('0x30')][_0xbf4e('0x33')]?_0x1d12e2[_0xbf4e('0x30')]:_0x362716[_0xbf4e('0x2c')];if(!_0xb8b58e[_0xbf4e('0x32')]['hasOwnProperty']('nolimit')){_0x1d12e2['limit']=qs['limit'](_0xb8b58e[_0xbf4e('0x32')][_0xbf4e('0x18')]);_0x1d12e2[_0xbf4e('0x16')]=qs[_0xbf4e('0x16')](_0xb8b58e[_0xbf4e('0x32')][_0xbf4e('0x16')]);}_0x1d12e2[_0xbf4e('0x34')]=qs[_0xbf4e('0x35')](_0xb8b58e[_0xbf4e('0x32')]['sort']);_0x1d12e2['where']=qs[_0xbf4e('0x2e')](_[_0xbf4e('0x36')](_0xb8b58e[_0xbf4e('0x32')],_0x362716['filters']),_0xc7ca87);if(_0xb8b58e[_0xbf4e('0x32')]['filter']){_0x1d12e2[_0xbf4e('0x37')]=_[_0xbf4e('0x38')](_0x1d12e2[_0xbf4e('0x37')],{'$or':_[_0xbf4e('0x28')](_0xc7ca87,function(_0x5ce339){if(_0x5ce339[_0xbf4e('0x39')]!==_0xbf4e('0x3a')){var _0x3aa308={};_0x3aa308[_0x5ce339[_0xbf4e('0x25')]]={'$like':'%'+_0xb8b58e['query'][_0xbf4e('0x3b')]+'%'};return _0x3aa308;}})});}_0x1d12e2=_[_0xbf4e('0x38')]({},_0x1d12e2,_0xb8b58e[_0xbf4e('0x3c')]);var _0x29fe9d={'where':_0x1d12e2[_0xbf4e('0x37')]};return db[_0xbf4e('0x29')][_0xbf4e('0x19')](_0x29fe9d)['then'](function(_0x176166){_0x2f3cf8[_0xbf4e('0x19')]=_0x176166;if(_0xb8b58e['query']['includeAll']){_0x1d12e2[_0xbf4e('0x3d')]=[{'all':!![]}];}return db[_0xbf4e('0x29')]['findAll'](_0x1d12e2);})['then'](function(_0x2b1bf4){_0x2f3cf8[_0xbf4e('0x3e')]=_0x2b1bf4;return _0x2f3cf8;})[_0xbf4e('0x1f')](respondWithFilteredResult(_0x498dbd,_0x1d12e2))[_0xbf4e('0x3f')](handleError(_0x498dbd,null));};exports[_0xbf4e('0x40')]=function(_0x3ad0a4,_0x5a03c6){var _0x3ecc15={'raw':!![],'where':{'id':_0x3ad0a4['params']['id']}},_0x7bd91={};_0x7bd91['model']=_['keys'](db['VoiceMail'][_0xbf4e('0x41')]);_0x7bd91['query']=_[_0xbf4e('0x2d')](_0x3ad0a4[_0xbf4e('0x32')]);_0x7bd91['filters']=_['intersection'](_0x7bd91[_0xbf4e('0x2c')],_0x7bd91[_0xbf4e('0x32')]);_0x3ecc15[_0xbf4e('0x30')]=_[_0xbf4e('0x2f')](_0x7bd91[_0xbf4e('0x2c')],qs['fields'](_0x3ad0a4[_0xbf4e('0x32')][_0xbf4e('0x31')]));_0x3ecc15[_0xbf4e('0x30')]=_0x3ecc15[_0xbf4e('0x30')][_0xbf4e('0x33')]?_0x3ecc15[_0xbf4e('0x30')]:_0x7bd91[_0xbf4e('0x2c')];if(_0x3ad0a4[_0xbf4e('0x32')]['includeAll']){_0x3ecc15[_0xbf4e('0x3d')]=[{'all':!![]}];}_0x3ecc15=_[_0xbf4e('0x38')]({},_0x3ecc15,_0x3ad0a4[_0xbf4e('0x3c')]);return db[_0xbf4e('0x29')][_0xbf4e('0x42')](_0x3ecc15)[_0xbf4e('0x1f')](handleEntityNotFound(_0x5a03c6,null))[_0xbf4e('0x1f')](respondWithResult(_0x5a03c6,null))[_0xbf4e('0x3f')](handleError(_0x5a03c6,null));};exports[_0xbf4e('0x43')]=function(_0x3447ab,_0x2fdba9){return db[_0xbf4e('0x29')][_0xbf4e('0x43')](_0x3447ab[_0xbf4e('0x44')],{})[_0xbf4e('0x1f')](function(_0x2892ce){var _0x10bc23=_0x3447ab['user'][_0xbf4e('0x45')]({'plain':!![]});if(!_0x10bc23)throw new Error(_0xbf4e('0x46'));if(_0x10bc23[_0xbf4e('0x47')]==='user'){var _0x33ab9a=_0x2892ce['get']({'plain':!![]});var _0x4a050e=_0xbf4e('0x21');return db[_0xbf4e('0x48')]['find']({'where':{'name':_0x4a050e,'userProfileId':_0x10bc23[_0xbf4e('0x49')]},'raw':!![]})[_0xbf4e('0x1f')](function(_0x31d779){if(_0x31d779&&_0x31d779[_0xbf4e('0x4a')]===0x0){return db[_0xbf4e('0x22')][_0xbf4e('0x43')]({'name':_0x33ab9a[_0xbf4e('0x25')],'resourceId':_0x33ab9a['id'],'type':_0x31d779[_0xbf4e('0x25')],'sectionId':_0x31d779['id']},{})[_0xbf4e('0x1f')](function(){return _0x2892ce;});}else{return _0x2892ce;}})[_0xbf4e('0x3f')](function(_0x271ad2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x271ad2);throw _0x271ad2;});}return _0x2892ce;})[_0xbf4e('0x1f')](respondWithResult(_0x2fdba9,0xc9))[_0xbf4e('0x3f')](handleError(_0x2fdba9,null));};exports[_0xbf4e('0x4b')]=function(_0x586f5d,_0x339ce6){if(_0x586f5d[_0xbf4e('0x44')]['id']){delete _0x586f5d['body']['id'];}return db['VoiceMail'][_0xbf4e('0x42')]({'where':{'id':_0x586f5d['params']['id']}})['then'](handleEntityNotFound(_0x339ce6,null))[_0xbf4e('0x1f')](saveUpdates(_0x586f5d[_0xbf4e('0x44')],null))[_0xbf4e('0x1f')](respondWithResult(_0x339ce6,null))[_0xbf4e('0x3f')](handleError(_0x339ce6,null));};exports[_0xbf4e('0x20')]=function(_0x5ec2d9,_0x242a75){return db['VoiceMail'][_0xbf4e('0x42')]({'where':{'id':_0x5ec2d9['params']['id']}})[_0xbf4e('0x1f')](handleEntityNotFound(_0x242a75,null))['then'](removeEntity(_0x242a75,null))[_0xbf4e('0x3f')](handleError(_0x242a75,null));};exports[_0xbf4e('0x4c')]=function(_0x3e60e7,_0x16592f,_0xfd54c){return db['VoiceMail']['findOne']({'where':{'id':_0x3e60e7['params']['id']}})['then'](handleEntityNotFound(_0x16592f,null))[_0xbf4e('0x1f')](function(_0x453411){var _0x5cfc26;var _0x200096={},_0x23c335={};_0x23c335[_0xbf4e('0x2c')]=_[_0xbf4e('0x2d')](db[_0xbf4e('0x4d')][_0xbf4e('0x41')]);_0x23c335[_0xbf4e('0x32')]=_['keys'](_0x3e60e7[_0xbf4e('0x32')]);_0x23c335[_0xbf4e('0x2e')]=_[_0xbf4e('0x2f')](_0x23c335['model'],_0x23c335['query']);_0x200096[_0xbf4e('0x30')]=_[_0xbf4e('0x2f')](_0x23c335[_0xbf4e('0x2c')],qs['fields'](_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x31')]));_0x200096[_0xbf4e('0x30')]=_0x200096[_0xbf4e('0x30')][_0xbf4e('0x33')]?_0x200096[_0xbf4e('0x30')]:_0x23c335[_0xbf4e('0x2c')];if(!_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x4e')](_0xbf4e('0x4f'))){_0x200096[_0xbf4e('0x18')]=qs[_0xbf4e('0x18')](_0x3e60e7['query'][_0xbf4e('0x18')]);_0x200096['offset']=qs[_0xbf4e('0x16')](_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x16')]);}_0x200096[_0xbf4e('0x34')]=qs[_0xbf4e('0x35')](_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x35')]);_0x200096[_0xbf4e('0x37')]=qs['filters'](_[_0xbf4e('0x36')](_0x3e60e7[_0xbf4e('0x32')],_0x23c335[_0xbf4e('0x2e')]));if(_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x3b')]){_0x200096['where']=_[_0xbf4e('0x38')](_0x200096[_0xbf4e('0x37')],{'$or':_[_0xbf4e('0x28')](_0x200096[_0xbf4e('0x30')],function(_0x12f19f){var _0x2c606b={};_0x2c606b[_0x12f19f]={'$like':'%'+_0x3e60e7['query'][_0xbf4e('0x3b')]+'%'};return _0x2c606b;})});}_0x200096['where']=_[_0xbf4e('0x38')](_0x200096[_0xbf4e('0x37')],{'mailboxuser':_0x453411[_0xbf4e('0x50')]});_0x200096=_[_0xbf4e('0x38')]({},_0x200096,_0x3e60e7['options']);return db[_0xbf4e('0x4d')]['findAndCountAll'](_0x200096)['then'](respondWithFilteredResult(_0x16592f,_0x200096));})[_0xbf4e('0x3f')](handleError(_0x16592f,null));}; \ No newline at end of file +var _0xb7e7=['sort','where','pick','filter','options','show','params','keys','rawAttributes','intersection','includeAll','include','merge','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','VoiceMailMessage','findAndCountAll','eml-format','zip-dir','request-promise','bluebird','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','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','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','destroy','error','name','send','index','VoiceMail','fieldName','type','key','model','map','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0xcf99b9,_0x38ac5e){var _0x1153b8=function(_0x4f30ff){while(--_0x4f30ff){_0xcf99b9['push'](_0xcf99b9['shift']());}};_0x1153b8(++_0x38ac5e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xb7e7[_0x3c4737];return _0x2bb926;};'use strict';var emlformat=require(_0x7b7e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b7e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b7e('0x2'));var moment=require('moment');var BPromise=require(_0x7b7e('0x3'));var Mustache=require('mustache');var util=require(_0x7b7e('0x4'));var path=require(_0x7b7e('0x5'));var sox=require(_0x7b7e('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7b7e('0x7'));var _=require(_0x7b7e('0x8'));var squel=require(_0x7b7e('0x9'));var crypto=require('crypto');var jsforce=require(_0x7b7e('0xa'));var deskjs=require(_0x7b7e('0xb'));var toCsv=require(_0x7b7e('0xc'));var querystring=require(_0x7b7e('0xd'));var Papa=require(_0x7b7e('0xe'));var Redis=require(_0x7b7e('0xf'));var authService=require(_0x7b7e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b7e('0x11'));var hardwareService=require(_0x7b7e('0x12'));var logger=require(_0x7b7e('0x13'))(_0x7b7e('0x14'));var utils=require(_0x7b7e('0x15'));var config=require(_0x7b7e('0x16'));var licenseUtil=require(_0x7b7e('0x17'));var db=require(_0x7b7e('0x18'))['db'];function respondWithStatusCode(_0xaadda,_0x54d8ce){_0x54d8ce=_0x54d8ce||0xcc;return function(_0x267446){if(_0x267446){return _0xaadda[_0x7b7e('0x19')](_0x54d8ce);}return _0xaadda['status'](_0x54d8ce)[_0x7b7e('0x1a')]();};}function respondWithResult(_0x5976ac,_0x4c6011){_0x4c6011=_0x4c6011||0xc8;return function(_0x2889ed){if(_0x2889ed){return _0x5976ac[_0x7b7e('0x1b')](_0x4c6011)[_0x7b7e('0x1c')](_0x2889ed);}};}function respondWithFilteredResult(_0x457ec5,_0x3d2fb2){return function(_0x5703fd){if(_0x5703fd){var _0x51baf6=typeof _0x3d2fb2[_0x7b7e('0x1d')]===_0x7b7e('0x1e')&&typeof _0x3d2fb2[_0x7b7e('0x1f')]===_0x7b7e('0x1e');var _0x2cc400=_0x5703fd[_0x7b7e('0x20')];var _0x242368=_0x51baf6?0x0:_0x3d2fb2[_0x7b7e('0x1d')];var _0x2acb8c=_0x51baf6?_0x5703fd[_0x7b7e('0x20')]:_0x3d2fb2[_0x7b7e('0x1d')]+_0x3d2fb2[_0x7b7e('0x1f')];var _0x448980;if(_0x2acb8c>=_0x2cc400){_0x2acb8c=_0x2cc400;_0x448980=0xc8;}else{_0x448980=0xce;}_0x457ec5[_0x7b7e('0x1b')](_0x448980);return _0x457ec5[_0x7b7e('0x21')](_0x7b7e('0x22'),_0x242368+'-'+_0x2acb8c+'/'+_0x2cc400)[_0x7b7e('0x1c')](_0x5703fd);}return null;};}function patchUpdates(_0x49eddb){return function(_0x69262b){try{jsonpatch[_0x7b7e('0x23')](_0x69262b,_0x49eddb,!![]);}catch(_0x24718c){return BPromise['reject'](_0x24718c);}return _0x69262b[_0x7b7e('0x24')]();};}function saveUpdates(_0xbf0cb3,_0x14243b){return function(_0x200156){if(_0x200156){return _0x200156[_0x7b7e('0x25')](_0xbf0cb3)[_0x7b7e('0x26')](function(_0x28bf43){return _0x28bf43;});}return null;};}function removeEntity(_0x10a66a,_0x53bbb3){return function(_0x5d6215){if(_0x5d6215){return _0x5d6215['destroy']()[_0x7b7e('0x26')](function(){var _0x22598e=_0x5d6215[_0x7b7e('0x27')]({'plain':!![]});var _0x483c6f='Voicemails';return db['UserProfileResource'][_0x7b7e('0x28')]({'where':{'type':_0x483c6f,'resourceId':_0x22598e['id']}})[_0x7b7e('0x26')](function(){return _0x5d6215;});})[_0x7b7e('0x26')](function(){_0x10a66a[_0x7b7e('0x1b')](0xcc)[_0x7b7e('0x1a')]();});}};}function handleEntityNotFound(_0x48fad1,_0x6a1e71){return function(_0x21a15){if(!_0x21a15){_0x48fad1['sendStatus'](0x194);}return _0x21a15;};}function handleError(_0x57b9da,_0x4e5de7){_0x4e5de7=_0x4e5de7||0x1f4;return function(_0x12ef0b){logger[_0x7b7e('0x29')](_0x12ef0b['stack']);if(_0x12ef0b[_0x7b7e('0x2a')]){delete _0x12ef0b['name'];}_0x57b9da[_0x7b7e('0x1b')](_0x4e5de7)[_0x7b7e('0x2b')](_0x12ef0b);};}exports[_0x7b7e('0x2c')]=function(_0x5515ca,_0x3960b8){var _0xe31336={},_0x35602a={},_0x326dd2={'count':0x0,'rows':[]};var _0x33f9a1=_['map'](db[_0x7b7e('0x2d')]['rawAttributes'],function(_0x23a453){return{'name':_0x23a453[_0x7b7e('0x2e')],'type':_0x23a453[_0x7b7e('0x2f')][_0x7b7e('0x30')]};});_0x35602a[_0x7b7e('0x31')]=_[_0x7b7e('0x32')](_0x33f9a1,_0x7b7e('0x2a'));_0x35602a['query']=_['keys'](_0x5515ca[_0x7b7e('0x33')]);_0x35602a[_0x7b7e('0x34')]=_['intersection'](_0x35602a[_0x7b7e('0x31')],_0x35602a[_0x7b7e('0x33')]);_0xe31336[_0x7b7e('0x35')]=_['intersection'](_0x35602a[_0x7b7e('0x31')],qs[_0x7b7e('0x36')](_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x36')]));_0xe31336[_0x7b7e('0x35')]=_0xe31336[_0x7b7e('0x35')][_0x7b7e('0x37')]?_0xe31336[_0x7b7e('0x35')]:_0x35602a[_0x7b7e('0x31')];if(!_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x38')](_0x7b7e('0x39'))){_0xe31336[_0x7b7e('0x1f')]=qs[_0x7b7e('0x1f')](_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x1f')]);_0xe31336['offset']=qs[_0x7b7e('0x1d')](_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x1d')]);}_0xe31336[_0x7b7e('0x3a')]=qs[_0x7b7e('0x3b')](_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x3b')]);_0xe31336[_0x7b7e('0x3c')]=qs[_0x7b7e('0x34')](_[_0x7b7e('0x3d')](_0x5515ca['query'],_0x35602a[_0x7b7e('0x34')]),_0x33f9a1);if(_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x3e')]){_0xe31336[_0x7b7e('0x3c')]=_['merge'](_0xe31336[_0x7b7e('0x3c')],{'$or':_[_0x7b7e('0x32')](_0x33f9a1,function(_0x3d5280){if(_0x3d5280['type']!=='VIRTUAL'){var _0x22651e={};_0x22651e[_0x3d5280['name']]={'$like':'%'+_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x3e')]+'%'};return _0x22651e;}})});}_0xe31336=_['merge']({},_0xe31336,_0x5515ca[_0x7b7e('0x3f')]);var _0x2074d1={'where':_0xe31336[_0x7b7e('0x3c')]};return db[_0x7b7e('0x2d')][_0x7b7e('0x20')](_0x2074d1)[_0x7b7e('0x26')](function(_0xc888e4){_0x326dd2[_0x7b7e('0x20')]=_0xc888e4;if(_0x5515ca[_0x7b7e('0x33')]['includeAll']){_0xe31336['include']=[{'all':!![]}];}return db[_0x7b7e('0x2d')]['findAll'](_0xe31336);})[_0x7b7e('0x26')](function(_0x5e8b5d){_0x326dd2['rows']=_0x5e8b5d;return _0x326dd2;})[_0x7b7e('0x26')](respondWithFilteredResult(_0x3960b8,_0xe31336))['catch'](handleError(_0x3960b8,null));};exports[_0x7b7e('0x40')]=function(_0x52051c,_0xa8521d){var _0x3e58be={'raw':!![],'where':{'id':_0x52051c[_0x7b7e('0x41')]['id']}},_0x7ea84c={};_0x7ea84c['model']=_[_0x7b7e('0x42')](db[_0x7b7e('0x2d')][_0x7b7e('0x43')]);_0x7ea84c[_0x7b7e('0x33')]=_[_0x7b7e('0x42')](_0x52051c[_0x7b7e('0x33')]);_0x7ea84c['filters']=_['intersection'](_0x7ea84c['model'],_0x7ea84c[_0x7b7e('0x33')]);_0x3e58be[_0x7b7e('0x35')]=_[_0x7b7e('0x44')](_0x7ea84c[_0x7b7e('0x31')],qs[_0x7b7e('0x36')](_0x52051c[_0x7b7e('0x33')]['fields']));_0x3e58be[_0x7b7e('0x35')]=_0x3e58be[_0x7b7e('0x35')]['length']?_0x3e58be['attributes']:_0x7ea84c[_0x7b7e('0x31')];if(_0x52051c[_0x7b7e('0x33')][_0x7b7e('0x45')]){_0x3e58be[_0x7b7e('0x46')]=[{'all':!![]}];}_0x3e58be=_[_0x7b7e('0x47')]({},_0x3e58be,_0x52051c[_0x7b7e('0x3f')]);return db['VoiceMail'][_0x7b7e('0x48')](_0x3e58be)['then'](handleEntityNotFound(_0xa8521d,null))[_0x7b7e('0x26')](respondWithResult(_0xa8521d,null))[_0x7b7e('0x49')](handleError(_0xa8521d,null));};exports[_0x7b7e('0x4a')]=function(_0x5874e2,_0x58e4e6){return db[_0x7b7e('0x2d')][_0x7b7e('0x4a')](_0x5874e2[_0x7b7e('0x4b')],{})[_0x7b7e('0x26')](function(_0x1f9d0f){var _0x5cce7c=_0x5874e2[_0x7b7e('0x4c')][_0x7b7e('0x27')]({'plain':!![]});if(!_0x5cce7c)throw new Error(_0x7b7e('0x4d'));if(_0x5cce7c[_0x7b7e('0x4e')]===_0x7b7e('0x4c')){var _0x5a9697=_0x1f9d0f[_0x7b7e('0x27')]({'plain':!![]});var _0x29024e=_0x7b7e('0x4f');return db[_0x7b7e('0x50')][_0x7b7e('0x48')]({'where':{'name':_0x29024e,'userProfileId':_0x5cce7c[_0x7b7e('0x51')]},'raw':!![]})[_0x7b7e('0x26')](function(_0x4a7be0){if(_0x4a7be0&&_0x4a7be0[_0x7b7e('0x52')]===0x0){return db['UserProfileResource'][_0x7b7e('0x4a')]({'name':_0x5a9697[_0x7b7e('0x2a')],'resourceId':_0x5a9697['id'],'type':_0x4a7be0['name'],'sectionId':_0x4a7be0['id']},{})[_0x7b7e('0x26')](function(){return _0x1f9d0f;});}else{return _0x1f9d0f;}})[_0x7b7e('0x49')](function(_0x16c81d){logger[_0x7b7e('0x29')](_0x7b7e('0x53'),_0x16c81d);throw _0x16c81d;});}return _0x1f9d0f;})[_0x7b7e('0x26')](respondWithResult(_0x58e4e6,0xc9))[_0x7b7e('0x49')](handleError(_0x58e4e6,null));};exports['update']=function(_0xbf044d,_0x3ff731){if(_0xbf044d[_0x7b7e('0x4b')]['id']){delete _0xbf044d[_0x7b7e('0x4b')]['id'];}return db['VoiceMail']['find']({'where':{'id':_0xbf044d['params']['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x3ff731,null))[_0x7b7e('0x26')](saveUpdates(_0xbf044d[_0x7b7e('0x4b')],null))['then'](respondWithResult(_0x3ff731,null))['catch'](handleError(_0x3ff731,null));};exports[_0x7b7e('0x28')]=function(_0x39efb5,_0x4fecf7){return db[_0x7b7e('0x2d')][_0x7b7e('0x48')]({'where':{'id':_0x39efb5[_0x7b7e('0x41')]['id']}})['then'](handleEntityNotFound(_0x4fecf7,null))[_0x7b7e('0x26')](removeEntity(_0x4fecf7,null))[_0x7b7e('0x49')](handleError(_0x4fecf7,null));};exports['getMessages']=function(_0x25c933,_0x441c3c,_0x1d7db1){return db[_0x7b7e('0x2d')][_0x7b7e('0x54')]({'where':{'id':_0x25c933[_0x7b7e('0x41')]['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x441c3c,null))[_0x7b7e('0x26')](function(_0x45fff9){var _0x5509ad;var _0x29d0af={},_0x20108a={};_0x20108a['model']=_[_0x7b7e('0x42')](db[_0x7b7e('0x55')][_0x7b7e('0x43')]);_0x20108a['query']=_[_0x7b7e('0x42')](_0x25c933['query']);_0x20108a[_0x7b7e('0x34')]=_[_0x7b7e('0x44')](_0x20108a['model'],_0x20108a[_0x7b7e('0x33')]);_0x29d0af[_0x7b7e('0x35')]=_['intersection'](_0x20108a[_0x7b7e('0x31')],qs[_0x7b7e('0x36')](_0x25c933[_0x7b7e('0x33')][_0x7b7e('0x36')]));_0x29d0af['attributes']=_0x29d0af[_0x7b7e('0x35')][_0x7b7e('0x37')]?_0x29d0af[_0x7b7e('0x35')]:_0x20108a[_0x7b7e('0x31')];if(!_0x25c933[_0x7b7e('0x33')][_0x7b7e('0x38')](_0x7b7e('0x39'))){_0x29d0af[_0x7b7e('0x1f')]=qs[_0x7b7e('0x1f')](_0x25c933[_0x7b7e('0x33')]['limit']);_0x29d0af[_0x7b7e('0x1d')]=qs['offset'](_0x25c933['query'][_0x7b7e('0x1d')]);}_0x29d0af[_0x7b7e('0x3a')]=qs[_0x7b7e('0x3b')](_0x25c933[_0x7b7e('0x33')]['sort']);_0x29d0af[_0x7b7e('0x3c')]=qs[_0x7b7e('0x34')](_[_0x7b7e('0x3d')](_0x25c933[_0x7b7e('0x33')],_0x20108a[_0x7b7e('0x34')]));if(_0x25c933[_0x7b7e('0x33')]['filter']){_0x29d0af[_0x7b7e('0x3c')]=_['merge'](_0x29d0af['where'],{'$or':_[_0x7b7e('0x32')](_0x29d0af['attributes'],function(_0x47aa4c){var _0x4a2378={};_0x4a2378[_0x47aa4c]={'$like':'%'+_0x25c933[_0x7b7e('0x33')][_0x7b7e('0x3e')]+'%'};return _0x4a2378;})});}_0x29d0af['where']=_[_0x7b7e('0x47')](_0x29d0af[_0x7b7e('0x3c')],{'mailboxuser':_0x45fff9['mailbox']});_0x29d0af=_[_0x7b7e('0x47')]({},_0x29d0af,_0x25c933[_0x7b7e('0x3f')]);return db[_0x7b7e('0x55')][_0x7b7e('0x56')](_0x29d0af)[_0x7b7e('0x26')](respondWithFilteredResult(_0x441c3c,_0x29d0af));})[_0x7b7e('0x49')](handleError(_0x441c3c,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 53c2100..532dcc3 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 _0xaa47=['moment','bluebird','request-promise','path','../../config/environment','./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox_context','mailbox','util'];(function(_0x96a2cb,_0x51f751){var _0x4bccfa=function(_0x175691){while(--_0x175691){_0x96a2cb['push'](_0x96a2cb['shift']());}};_0x4bccfa(++_0x51f751);}(_0xaa47,0x12b));var _0x7aa4=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xaa47[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x7aa4('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x7aa4('0x1'));var BPromise=require(_0x7aa4('0x2'));var rp=require(_0x7aa4('0x3'));var fs=require('fs');var path=require(_0x7aa4('0x4'));var rimraf=require('rimraf');var config=require(_0x7aa4('0x5'));var attributes=require(_0x7aa4('0x6'));module[_0x7aa4('0x7')]=function(_0x1d4e4e,_0xbde8bd){return _0x1d4e4e['define'](_0x7aa4('0x8'),attributes,{'tableName':_0x7aa4('0x9'),'paranoid':![],'indexes':[{'name':_0x7aa4('0xa'),'fields':[_0x7aa4('0xb'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0db1=['path','rimraf','exports','VoiceMail','voice_voicemail','context','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4dcb2f,_0x455157){var _0x1ce18d=function(_0x2ee12f){while(--_0x2ee12f){_0x4dcb2f['push'](_0x4dcb2f['shift']());}};_0x1ce18d(++_0x455157);}(_0x0db1,0xba));var _0x10db=function(_0x21d340,_0x11aee5){_0x21d340=_0x21d340-0x0;var _0x35f57c=_0x0db1[_0x21d340];return _0x35f57c;};'use strict';var _=require('lodash');var util=require(_0x10db('0x0'));var logger=require(_0x10db('0x1'))(_0x10db('0x2'));var moment=require(_0x10db('0x3'));var BPromise=require(_0x10db('0x4'));var rp=require(_0x10db('0x5'));var fs=require('fs');var path=require(_0x10db('0x6'));var rimraf=require(_0x10db('0x7'));var config=require('../../config/environment');var attributes=require('./voiceMail.attributes');module[_0x10db('0x8')]=function(_0x3fb9b2,_0x246e25){return _0x3fb9b2['define'](_0x10db('0x9'),attributes,{'tableName':_0x10db('0xa'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox',_0x10db('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index d9f70a2..7c6954c 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 _0x1da9=['then','info','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1da9,0x164));var _0x91da=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x1da9[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x91da('0x0'));var util=require(_0x91da('0x1'));var moment=require(_0x91da('0x2'));var BPromise=require('bluebird');var rs=require(_0x91da('0x3'));var fs=require('fs');var Redis=require(_0x91da('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91da('0x5'));var logger=require('../../config/logger')(_0x91da('0x6'));var config=require(_0x91da('0x7'));var jayson=require(_0x91da('0x8'));var client=jayson[_0x91da('0x9')][_0x91da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xba35b1,_0x1f30ac,_0x59ff7d){return new BPromise(function(_0x5359da,_0x51789c){return client[_0x91da('0xb')](_0xba35b1,_0x59ff7d)[_0x91da('0xc')](function(_0x2885e5){logger[_0x91da('0xd')](_0x91da('0xe'),_0x1f30ac,'request\x20sent');logger[_0x91da('0xf')](_0x91da('0x10'),_0x1f30ac,_0x91da('0x11'),JSON[_0x91da('0x12')](_0x2885e5));if(_0x2885e5[_0x91da('0x13')]){if(_0x2885e5['error']['code']===0x1f4){logger[_0x91da('0x13')]('VoiceMail,\x20%s,\x20%s',_0x1f30ac,_0x2885e5['error'][_0x91da('0x14')]);return _0x51789c(_0x2885e5['error'][_0x91da('0x14')]);}logger[_0x91da('0x13')](_0x91da('0xe'),_0x1f30ac,_0x2885e5[_0x91da('0x13')][_0x91da('0x14')]);return _0x5359da(_0x2885e5[_0x91da('0x13')][_0x91da('0x14')]);}else{logger[_0x91da('0xd')](_0x91da('0xe'),_0x1f30ac,_0x91da('0x11'));_0x5359da(_0x2885e5[_0x91da('0x15')][_0x91da('0x14')]);}})[_0x91da('0x16')](function(_0x2241e4){logger['error'](_0x91da('0xe'),_0x1f30ac,_0x2241e4);_0x51789c(_0x2241e4);});});} \ No newline at end of file +var _0x3aff=['../../config/environment','jayson/promise','client','http','then','info','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x222688,_0x46c5eb){var _0x437433=function(_0x29958c){while(--_0x29958c){_0x222688['push'](_0x222688['shift']());}};_0x437433(++_0x46c5eb);}(_0x3aff,0xf5));var _0xf3af=function(_0x25bf4d,_0x260bae){_0x25bf4d=_0x25bf4d-0x0;var _0x33980e=_0x3aff[_0x25bf4d];return _0x33980e;};'use strict';var _=require(_0xf3af('0x0'));var util=require(_0xf3af('0x1'));var moment=require(_0xf3af('0x2'));var BPromise=require(_0xf3af('0x3'));var rs=require(_0xf3af('0x4'));var fs=require('fs');var Redis=require(_0xf3af('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf3af('0x6'))('rpc');var config=require(_0xf3af('0x7'));var jayson=require(_0xf3af('0x8'));var client=jayson[_0xf3af('0x9')][_0xf3af('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f0346,_0x934469,_0x3d7a73){return new BPromise(function(_0x408963,_0x484559){return client['request'](_0x4f0346,_0x3d7a73)[_0xf3af('0xb')](function(_0xba6e0e){logger[_0xf3af('0xc')](_0xf3af('0xd'),_0x934469,'request\x20sent');logger[_0xf3af('0xe')](_0xf3af('0xf'),_0x934469,_0xf3af('0x10'),JSON[_0xf3af('0x11')](_0xba6e0e));if(_0xba6e0e[_0xf3af('0x12')]){if(_0xba6e0e[_0xf3af('0x12')][_0xf3af('0x13')]===0x1f4){logger[_0xf3af('0x12')](_0xf3af('0xd'),_0x934469,_0xba6e0e[_0xf3af('0x12')][_0xf3af('0x14')]);return _0x484559(_0xba6e0e['error']['message']);}logger[_0xf3af('0x12')](_0xf3af('0xd'),_0x934469,_0xba6e0e[_0xf3af('0x12')]['message']);return _0x408963(_0xba6e0e[_0xf3af('0x12')]['message']);}else{logger[_0xf3af('0xc')](_0xf3af('0xd'),_0x934469,'request\x20sent');_0x408963(_0xba6e0e['result'][_0xf3af('0x14')]);}})['catch'](function(_0x37e37f){logger[_0xf3af('0x12')](_0xf3af('0xd'),_0x934469,_0x37e37f);_0x484559(_0x37e37f);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 1ebb447..68919d1 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 _0x3497=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','get','/:id','show','/:id/download','post','put','update'];(function(_0x8fc9dd,_0x1c5712){var _0x2fae6b=function(_0x4d13bc){while(--_0x4d13bc){_0x8fc9dd['push'](_0x8fc9dd['shift']());}};_0x2fae6b(++_0x1c5712);}(_0x3497,0xc0));var _0x7349=function(_0x456200,_0x3d4c03){_0x456200=_0x456200-0x0;var _0x551f2e=_0x3497[_0x456200];return _0x551f2e;};'use strict';var multer=require(_0x7349('0x0'));var util=require(_0x7349('0x1'));var path=require(_0x7349('0x2'));var timeout=require(_0x7349('0x3'));var express=require('express');var router=express[_0x7349('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7349('0x5'));var interaction=require(_0x7349('0x6'));var config=require(_0x7349('0x7'));var controller=require(_0x7349('0x8'));router['get']('/',auth[_0x7349('0x9')](),controller['index']);router[_0x7349('0xa')](_0x7349('0xb'),auth[_0x7349('0x9')](),controller[_0x7349('0xc')]);router[_0x7349('0xa')](_0x7349('0xd'),auth[_0x7349('0x9')](),controller['download']);router[_0x7349('0xe')]('/',auth[_0x7349('0x9')](),controller['create']);router[_0x7349('0xf')](_0x7349('0xb'),auth['isAuthenticated'](),controller[_0x7349('0x10')]);router['delete'](_0x7349('0xb'),auth['isAuthenticated'](),controller[_0x7349('0x11')]);module[_0x7349('0x12')]=router; \ No newline at end of file +var _0x1e53=['../../config/environment','isAuthenticated','show','download','post','create','put','update','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5b1949,_0xf7334){var _0x536205=function(_0x247d1d){while(--_0x247d1d){_0x5b1949['push'](_0x5b1949['shift']());}};_0x536205(++_0xf7334);}(_0x1e53,0xad));var _0x31e5=function(_0x449b80,_0x50f499){_0x449b80=_0x449b80-0x0;var _0x4fa318=_0x1e53[_0x449b80];return _0x4fa318;};'use strict';var multer=require(_0x31e5('0x0'));var util=require(_0x31e5('0x1'));var path=require(_0x31e5('0x2'));var timeout=require(_0x31e5('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x31e5('0x4'));var auth=require(_0x31e5('0x5'));var interaction=require(_0x31e5('0x6'));var config=require(_0x31e5('0x7'));var controller=require('./voiceMailMessage.controller');router['get']('/',auth[_0x31e5('0x8')](),controller['index']);router['get']('/:id',auth[_0x31e5('0x8')](),controller[_0x31e5('0x9')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x31e5('0xa')]);router[_0x31e5('0xb')]('/',auth['isAuthenticated'](),controller[_0x31e5('0xc')]);router[_0x31e5('0xd')]('/:id',auth[_0x31e5('0x8')](),controller[_0x31e5('0xe')]);router['delete']('/:id',auth[_0x31e5('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index c25ee50..6cbd4be 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 _0x083b=['sequelize','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x083b,0x9a));var _0xb083=function(_0x5ad190,_0xd39c9e){_0x5ad190=_0x5ad190-0x0;var _0x518ed3=_0x083b[_0x5ad190];return _0x518ed3;};'use strict';var Sequelize=require(_0xb083('0x0'));module['exports']={'name':{'type':Sequelize[_0xb083('0x1')],'get':function(_0x2f62f8){return this[_0xb083('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xb083('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xb083('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xb083('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xb083('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xb083('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xb083('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xb083('0x5')](_0xb083('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xb083('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize['literal']('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0xf269=['BLOB','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL','INTEGER','STRING'];(function(_0x1e489f,_0x458bf2){var _0x4ae3a5=function(_0x41519d){while(--_0x41519d){_0x1e489f['push'](_0x1e489f['shift']());}};_0x4ae3a5(++_0x458bf2);}(_0xf269,0x1ee));var _0x9f26=function(_0x6723fa,_0x45ef22){_0x6723fa=_0x6723fa-0x0;var _0x475eb6=_0xf269[_0x6723fa];return _0x475eb6;};'use strict';var Sequelize=require('sequelize');module[_0x9f26('0x0')]={'name':{'type':Sequelize[_0x9f26('0x1')],'get':function(_0x516464){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x9f26('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x9f26('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x9f26('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x9f26('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x9f26('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x9f26('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x9f26('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x9f26('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x9f26('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize['literal'](_0x9f26('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 72e71e4..254bb12 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 _0x034e=['bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','apply','reject','update','then','destroy','error','name','send','index','map','rawAttributes','type','key','differenceBy','query','keys','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','merge','where','filter','VoiceMailMessage','includeAll','include','findAll','catch','params','options','find','create','body','download','msg_id','recording','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x217d33,_0x39dc74){var _0x197f95=function(_0x2cd696){while(--_0x2cd696){_0x217d33['push'](_0x217d33['shift']());}};_0x197f95(++_0x39dc74);}(_0x034e,0xe7));var _0xe034=function(_0x1325ca,_0x21c3ab){_0x1325ca=_0x1325ca-0x0;var _0x40fde5=_0x034e[_0x1325ca];return _0x40fde5;};'use strict';var emlformat=require(_0xe034('0x0'));var rimraf=require(_0xe034('0x1'));var zipdir=require(_0xe034('0x2'));var jsonpatch=require(_0xe034('0x3'));var rp=require(_0xe034('0x4'));var moment=require(_0xe034('0x5'));var BPromise=require(_0xe034('0x6'));var Mustache=require(_0xe034('0x7'));var util=require(_0xe034('0x8'));var path=require(_0xe034('0x9'));var sox=require('sox');var csv=require(_0xe034('0xa'));var ejs=require(_0xe034('0xb'));var fs=require('fs');var fs_extra=require(_0xe034('0xc'));var _=require(_0xe034('0xd'));var squel=require(_0xe034('0xe'));var crypto=require('crypto');var jsforce=require(_0xe034('0xf'));var deskjs=require(_0xe034('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe034('0x11'));var qs=require(_0xe034('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe034('0x13'));var logger=require(_0xe034('0x14'))(_0xe034('0x15'));var utils=require(_0xe034('0x16'));var config=require(_0xe034('0x17'));var licenseUtil=require(_0xe034('0x18'));var db=require(_0xe034('0x19'))['db'];function respondWithStatusCode(_0x5e19e4,_0x1dd9da){_0x1dd9da=_0x1dd9da||0xcc;return function(_0xc2460b){if(_0xc2460b){return _0x5e19e4[_0xe034('0x1a')](_0x1dd9da);}return _0x5e19e4[_0xe034('0x1b')](_0x1dd9da)[_0xe034('0x1c')]();};}function respondWithResult(_0x300fd9,_0x14671f){_0x14671f=_0x14671f||0xc8;return function(_0x343c43){if(_0x343c43){return _0x300fd9[_0xe034('0x1b')](_0x14671f)[_0xe034('0x1d')](_0x343c43);}};}function respondWithFilteredResult(_0x12c86d,_0x12981e){return function(_0xfc211a){if(_0xfc211a){var _0x18f37c=typeof _0x12981e['offset']==='undefined'&&typeof _0x12981e[_0xe034('0x1e')]==='undefined';var _0x1a9091=_0xfc211a[_0xe034('0x1f')];var _0x121399=_0x18f37c?0x0:_0x12981e[_0xe034('0x20')];var _0x19c98c=_0x18f37c?_0xfc211a[_0xe034('0x1f')]:_0x12981e[_0xe034('0x20')]+_0x12981e[_0xe034('0x1e')];var _0x3c1526;if(_0x19c98c>=_0x1a9091){_0x19c98c=_0x1a9091;_0x3c1526=0xc8;}else{_0x3c1526=0xce;}_0x12c86d['status'](_0x3c1526);return _0x12c86d[_0xe034('0x21')]('Content-Range',_0x121399+'-'+_0x19c98c+'/'+_0x1a9091)[_0xe034('0x1d')](_0xfc211a);}return null;};}function patchUpdates(_0x53352c){return function(_0x521439){try{jsonpatch[_0xe034('0x22')](_0x521439,_0x53352c,!![]);}catch(_0x186b8b){return BPromise[_0xe034('0x23')](_0x186b8b);}return _0x521439['save']();};}function saveUpdates(_0x1210a5,_0x439949){return function(_0x26ec15){if(_0x26ec15){return _0x26ec15[_0xe034('0x24')](_0x1210a5)[_0xe034('0x25')](function(_0x4b8e36){return _0x4b8e36;});}return null;};}function removeEntity(_0x5de8e4,_0x3615d7){return function(_0xf4463f){if(_0xf4463f){return _0xf4463f[_0xe034('0x26')]()['then'](function(){_0x5de8e4[_0xe034('0x1b')](0xcc)[_0xe034('0x1c')]();});}};}function handleEntityNotFound(_0x196f09,_0x133eb5){return function(_0xfa793){if(!_0xfa793){_0x196f09[_0xe034('0x1a')](0x194);}return _0xfa793;};}function handleError(_0x37eee9,_0x44722){_0x44722=_0x44722||0x1f4;return function(_0x1f40fe){logger[_0xe034('0x27')](_0x1f40fe['stack']);if(_0x1f40fe[_0xe034('0x28')]){delete _0x1f40fe[_0xe034('0x28')];}_0x37eee9[_0xe034('0x1b')](_0x44722)[_0xe034('0x29')](_0x1f40fe);};}exports[_0xe034('0x2a')]=function(_0x1728d7,_0xf5ed38){var _0x38a8be={},_0x232714={},_0x162711={'count':0x0,'rows':[]};var _0x2ff10b=_[_0xe034('0x2b')](db['VoiceMailMessage'][_0xe034('0x2c')],function(_0x2fbbd7){return{'name':_0x2fbbd7['fieldName'],'type':_0x2fbbd7[_0xe034('0x2d')][_0xe034('0x2e')]};});_0x232714['model']=_[_0xe034('0x2f')](_[_0xe034('0x2b')](_0x2ff10b,'name'),[_0xe034('0x28')]);_0x232714[_0xe034('0x30')]=_[_0xe034('0x31')](_0x1728d7[_0xe034('0x30')]);_0x232714['filters']=_['intersection'](_0x232714[_0xe034('0x32')],_0x232714[_0xe034('0x30')]);_0x38a8be[_0xe034('0x33')]=_[_0xe034('0x34')](_0x232714['model'],qs[_0xe034('0x35')](_0x1728d7[_0xe034('0x30')][_0xe034('0x35')]));_0x38a8be[_0xe034('0x33')]=_0x38a8be[_0xe034('0x33')]['length']?_0x38a8be[_0xe034('0x33')]:_0x232714[_0xe034('0x32')];if(!_0x1728d7[_0xe034('0x30')][_0xe034('0x36')](_0xe034('0x37'))){_0x38a8be[_0xe034('0x1e')]=qs[_0xe034('0x1e')](_0x1728d7[_0xe034('0x30')][_0xe034('0x1e')]);_0x38a8be['offset']=qs[_0xe034('0x20')](_0x1728d7[_0xe034('0x30')]['offset']);}_0x38a8be[_0xe034('0x38')]=qs['sort'](_0x1728d7[_0xe034('0x30')][_0xe034('0x39')]);_0x38a8be['where']=qs[_0xe034('0x3a')](_['pick'](_0x1728d7[_0xe034('0x30')],_0x232714['filters']),_0x2ff10b);if(_0x1728d7[_0xe034('0x30')]['filter']){_0x38a8be['where']=_[_0xe034('0x3b')](_0x38a8be[_0xe034('0x3c')],{'$or':_['map'](_0x2ff10b,function(_0x15b5ec){if(_0x15b5ec[_0xe034('0x2d')]!=='VIRTUAL'){var _0x34ba51={};_0x34ba51[_0x15b5ec[_0xe034('0x28')]]={'$like':'%'+_0x1728d7[_0xe034('0x30')][_0xe034('0x3d')]+'%'};return _0x34ba51;}})});}_0x38a8be=_[_0xe034('0x3b')]({},_0x38a8be,_0x1728d7['options']);var _0x333193={'where':_0x38a8be[_0xe034('0x3c')]};return db[_0xe034('0x3e')]['count'](_0x333193)[_0xe034('0x25')](function(_0x4d3e8b){_0x162711[_0xe034('0x1f')]=_0x4d3e8b;if(_0x1728d7[_0xe034('0x30')][_0xe034('0x3f')]){_0x38a8be[_0xe034('0x40')]=[{'all':!![]}];}return db[_0xe034('0x3e')][_0xe034('0x41')](_0x38a8be);})[_0xe034('0x25')](function(_0x4cc4fa){_0x162711['rows']=_0x4cc4fa;return _0x162711;})['then'](respondWithFilteredResult(_0xf5ed38,_0x38a8be))[_0xe034('0x42')](handleError(_0xf5ed38,null));};exports['show']=function(_0x1adc21,_0x33e391){var _0x4200b7={'raw':!![],'where':{'id':_0x1adc21[_0xe034('0x43')]['id']}},_0x533da9={};_0x533da9[_0xe034('0x32')]=_[_0xe034('0x31')](db[_0xe034('0x3e')][_0xe034('0x2c')]);_0x533da9[_0xe034('0x30')]=_[_0xe034('0x31')](_0x1adc21[_0xe034('0x30')]);_0x533da9['filters']=_['intersection'](_0x533da9[_0xe034('0x32')],_0x533da9[_0xe034('0x30')]);_0x4200b7[_0xe034('0x33')]=_[_0xe034('0x34')](_0x533da9[_0xe034('0x32')],qs[_0xe034('0x35')](_0x1adc21[_0xe034('0x30')][_0xe034('0x35')]));_0x4200b7[_0xe034('0x33')]=_0x4200b7[_0xe034('0x33')]['length']?_0x4200b7[_0xe034('0x33')]:_0x533da9[_0xe034('0x32')];if(_0x1adc21[_0xe034('0x30')][_0xe034('0x3f')]){_0x4200b7[_0xe034('0x40')]=[{'all':!![]}];}_0x4200b7=_[_0xe034('0x3b')]({},_0x4200b7,_0x1adc21[_0xe034('0x44')]);return db['VoiceMailMessage'][_0xe034('0x45')](_0x4200b7)['then'](handleEntityNotFound(_0x33e391,null))[_0xe034('0x25')](respondWithResult(_0x33e391,null))[_0xe034('0x42')](handleError(_0x33e391,null));};exports[_0xe034('0x46')]=function(_0x4a1657,_0x54029d){return db[_0xe034('0x3e')][_0xe034('0x46')](_0x4a1657['body'],{})[_0xe034('0x25')](respondWithResult(_0x54029d,0xc9))[_0xe034('0x42')](handleError(_0x54029d,null));};exports[_0xe034('0x24')]=function(_0x2c042d,_0x449f01){if(_0x2c042d[_0xe034('0x47')]['id']){delete _0x2c042d['body']['id'];}return db[_0xe034('0x3e')]['find']({'where':{'id':_0x2c042d['params']['id']}})[_0xe034('0x25')](handleEntityNotFound(_0x449f01,null))['then'](saveUpdates(_0x2c042d[_0xe034('0x47')],null))[_0xe034('0x25')](respondWithResult(_0x449f01,null))[_0xe034('0x42')](handleError(_0x449f01,null));};exports[_0xe034('0x26')]=function(_0x440236,_0x13e3b8){return db['VoiceMailMessage'][_0xe034('0x45')]({'where':{'id':_0x440236['params']['id']}})[_0xe034('0x25')](handleEntityNotFound(_0x13e3b8,null))['then'](removeEntity(_0x13e3b8,null))[_0xe034('0x42')](handleError(_0x13e3b8,null));};exports[_0xe034('0x48')]=function(_0x31cd8a,_0x51949b,_0x49520c){return db[_0xe034('0x3e')][_0xe034('0x45')]({'where':{'id':_0x31cd8a[_0xe034('0x43')]['id']},'attributes':['id','recording',_0xe034('0x49')]})[_0xe034('0x25')](handleEntityNotFound(_0x51949b,null))[_0xe034('0x25')](function(_0x40266c){if(_0x40266c){if(!_0x40266c[_0xe034('0x4a')]){throw new db['Sequelize'][(_0xe034('0x4b'))](_0xe034('0x4c'));}var _0x54110a={'Content-Type':_0xe034('0x4d'),'Content-Disposition':'attachment'};if(_0x40266c[_0xe034('0x49')]){_0x54110a['Content-Disposition']='attachment;\x20filename=\x22'+_0x40266c['msg_id']+_0xe034('0x4e');}_0x51949b[_0xe034('0x21')](_0x54110a);return _0x51949b[_0xe034('0x29')](new Buffer(_0x40266c[_0xe034('0x4a')]));}})[_0xe034('0x42')](handleError(_0x51949b,null));}; \ No newline at end of file +var _0x09d5=['params','keys','include','find','catch','create','body','update','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment','attachment;\x20filename=\x22','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show'];(function(_0x3513f0,_0x3b7f27){var _0x44d293=function(_0x504498){while(--_0x504498){_0x3513f0['push'](_0x3513f0['shift']());}};_0x44d293(++_0x3b7f27);}(_0x09d5,0x15b));var _0x509d=function(_0x5af21b,_0x550e70){_0x5af21b=_0x5af21b-0x0;var _0x2da5ce=_0x09d5[_0x5af21b];return _0x2da5ce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x509d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x509d('0x1'));var rp=require(_0x509d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x509d('0x3'));var util=require(_0x509d('0x4'));var path=require(_0x509d('0x5'));var sox=require(_0x509d('0x6'));var csv=require(_0x509d('0x7'));var ejs=require(_0x509d('0x8'));var fs=require('fs');var fs_extra=require(_0x509d('0x9'));var _=require(_0x509d('0xa'));var squel=require(_0x509d('0xb'));var crypto=require(_0x509d('0xc'));var jsforce=require(_0x509d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x509d('0x7'));var querystring=require(_0x509d('0xe'));var Papa=require(_0x509d('0xf'));var Redis=require(_0x509d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x509d('0x11'));var as=require(_0x509d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x509d('0x13'));var utils=require(_0x509d('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x509d('0x15'));var db=require(_0x509d('0x16'))['db'];function respondWithStatusCode(_0x2c9baa,_0x2a8ee0){_0x2a8ee0=_0x2a8ee0||0xcc;return function(_0x3a959f){if(_0x3a959f){return _0x2c9baa[_0x509d('0x17')](_0x2a8ee0);}return _0x2c9baa['status'](_0x2a8ee0)[_0x509d('0x18')]();};}function respondWithResult(_0x312ce0,_0x5768c7){_0x5768c7=_0x5768c7||0xc8;return function(_0x5e177e){if(_0x5e177e){return _0x312ce0[_0x509d('0x19')](_0x5768c7)['json'](_0x5e177e);}};}function respondWithFilteredResult(_0x492a58,_0x21bcdf){return function(_0x3450b5){if(_0x3450b5){var _0xce28e4=typeof _0x21bcdf[_0x509d('0x1a')]===_0x509d('0x1b')&&typeof _0x21bcdf[_0x509d('0x1c')]==='undefined';var _0x16fc4f=_0x3450b5[_0x509d('0x1d')];var _0x1c4da2=_0xce28e4?0x0:_0x21bcdf[_0x509d('0x1a')];var _0x6632ba=_0xce28e4?_0x3450b5[_0x509d('0x1d')]:_0x21bcdf['offset']+_0x21bcdf[_0x509d('0x1c')];var _0x344a8a;if(_0x6632ba>=_0x16fc4f){_0x6632ba=_0x16fc4f;_0x344a8a=0xc8;}else{_0x344a8a=0xce;}_0x492a58['status'](_0x344a8a);return _0x492a58['set'](_0x509d('0x1e'),_0x1c4da2+'-'+_0x6632ba+'/'+_0x16fc4f)['json'](_0x3450b5);}return null;};}function patchUpdates(_0x1c7352){return function(_0x3f4e38){try{jsonpatch[_0x509d('0x1f')](_0x3f4e38,_0x1c7352,!![]);}catch(_0x17a5ea){return BPromise[_0x509d('0x20')](_0x17a5ea);}return _0x3f4e38[_0x509d('0x21')]();};}function saveUpdates(_0x556ef7,_0x5c5d8){return function(_0x753b0e){if(_0x753b0e){return _0x753b0e['update'](_0x556ef7)[_0x509d('0x22')](function(_0x4c41a6){return _0x4c41a6;});}return null;};}function removeEntity(_0x39c92f,_0x3bed66){return function(_0x427c84){if(_0x427c84){return _0x427c84[_0x509d('0x23')]()[_0x509d('0x22')](function(){_0x39c92f['status'](0xcc)[_0x509d('0x18')]();});}};}function handleEntityNotFound(_0x574c7d,_0x2874c3){return function(_0x47ec9e){if(!_0x47ec9e){_0x574c7d[_0x509d('0x17')](0x194);}return _0x47ec9e;};}function handleError(_0x45208e,_0x223580){_0x223580=_0x223580||0x1f4;return function(_0x169025){logger[_0x509d('0x24')](_0x169025[_0x509d('0x25')]);if(_0x169025['name']){delete _0x169025[_0x509d('0x26')];}_0x45208e['status'](_0x223580)[_0x509d('0x27')](_0x169025);};}exports[_0x509d('0x28')]=function(_0x4a4f98,_0x2d8b43){var _0x4d4850={},_0x5d4503={},_0x1aece3={'count':0x0,'rows':[]};var _0x5ccef4=_[_0x509d('0x29')](db[_0x509d('0x2a')][_0x509d('0x2b')],function(_0x5efb86){return{'name':_0x5efb86[_0x509d('0x2c')],'type':_0x5efb86[_0x509d('0x2d')][_0x509d('0x2e')]};});_0x5d4503[_0x509d('0x2f')]=_[_0x509d('0x30')](_[_0x509d('0x29')](_0x5ccef4,_0x509d('0x26')),[_0x509d('0x26')]);_0x5d4503['query']=_['keys'](_0x4a4f98[_0x509d('0x31')]);_0x5d4503[_0x509d('0x32')]=_[_0x509d('0x33')](_0x5d4503[_0x509d('0x2f')],_0x5d4503[_0x509d('0x31')]);_0x4d4850[_0x509d('0x34')]=_[_0x509d('0x33')](_0x5d4503['model'],qs[_0x509d('0x35')](_0x4a4f98['query'][_0x509d('0x35')]));_0x4d4850[_0x509d('0x34')]=_0x4d4850[_0x509d('0x34')][_0x509d('0x36')]?_0x4d4850[_0x509d('0x34')]:_0x5d4503[_0x509d('0x2f')];if(!_0x4a4f98[_0x509d('0x31')][_0x509d('0x37')](_0x509d('0x38'))){_0x4d4850[_0x509d('0x1c')]=qs[_0x509d('0x1c')](_0x4a4f98[_0x509d('0x31')][_0x509d('0x1c')]);_0x4d4850[_0x509d('0x1a')]=qs[_0x509d('0x1a')](_0x4a4f98[_0x509d('0x31')][_0x509d('0x1a')]);}_0x4d4850[_0x509d('0x39')]=qs[_0x509d('0x3a')](_0x4a4f98['query'][_0x509d('0x3a')]);_0x4d4850[_0x509d('0x3b')]=qs[_0x509d('0x32')](_[_0x509d('0x3c')](_0x4a4f98['query'],_0x5d4503[_0x509d('0x32')]),_0x5ccef4);if(_0x4a4f98[_0x509d('0x31')][_0x509d('0x3d')]){_0x4d4850[_0x509d('0x3b')]=_[_0x509d('0x3e')](_0x4d4850[_0x509d('0x3b')],{'$or':_['map'](_0x5ccef4,function(_0x27a47c){if(_0x27a47c[_0x509d('0x2d')]!=='VIRTUAL'){var _0x3ebc66={};_0x3ebc66[_0x27a47c['name']]={'$like':'%'+_0x4a4f98[_0x509d('0x31')]['filter']+'%'};return _0x3ebc66;}})});}_0x4d4850=_[_0x509d('0x3e')]({},_0x4d4850,_0x4a4f98[_0x509d('0x3f')]);var _0x23f4c3={'where':_0x4d4850[_0x509d('0x3b')]};return db[_0x509d('0x2a')][_0x509d('0x1d')](_0x23f4c3)['then'](function(_0x181a8d){_0x1aece3[_0x509d('0x1d')]=_0x181a8d;if(_0x4a4f98['query'][_0x509d('0x40')]){_0x4d4850['include']=[{'all':!![]}];}return db[_0x509d('0x2a')][_0x509d('0x41')](_0x4d4850);})[_0x509d('0x22')](function(_0x3ff142){_0x1aece3[_0x509d('0x42')]=_0x3ff142;return _0x1aece3;})['then'](respondWithFilteredResult(_0x2d8b43,_0x4d4850))['catch'](handleError(_0x2d8b43,null));};exports[_0x509d('0x43')]=function(_0x33adc3,_0x12d0e5){var _0x1bc106={'raw':!![],'where':{'id':_0x33adc3[_0x509d('0x44')]['id']}},_0x3235af={};_0x3235af[_0x509d('0x2f')]=_['keys'](db[_0x509d('0x2a')][_0x509d('0x2b')]);_0x3235af['query']=_[_0x509d('0x45')](_0x33adc3['query']);_0x3235af[_0x509d('0x32')]=_[_0x509d('0x33')](_0x3235af['model'],_0x3235af[_0x509d('0x31')]);_0x1bc106['attributes']=_[_0x509d('0x33')](_0x3235af[_0x509d('0x2f')],qs[_0x509d('0x35')](_0x33adc3['query'][_0x509d('0x35')]));_0x1bc106[_0x509d('0x34')]=_0x1bc106[_0x509d('0x34')][_0x509d('0x36')]?_0x1bc106[_0x509d('0x34')]:_0x3235af['model'];if(_0x33adc3[_0x509d('0x31')][_0x509d('0x40')]){_0x1bc106[_0x509d('0x46')]=[{'all':!![]}];}_0x1bc106=_['merge']({},_0x1bc106,_0x33adc3[_0x509d('0x3f')]);return db['VoiceMailMessage'][_0x509d('0x47')](_0x1bc106)[_0x509d('0x22')](handleEntityNotFound(_0x12d0e5,null))[_0x509d('0x22')](respondWithResult(_0x12d0e5,null))[_0x509d('0x48')](handleError(_0x12d0e5,null));};exports['create']=function(_0x29e003,_0x34a935){return db['VoiceMailMessage'][_0x509d('0x49')](_0x29e003[_0x509d('0x4a')],{})['then'](respondWithResult(_0x34a935,0xc9))['catch'](handleError(_0x34a935,null));};exports[_0x509d('0x4b')]=function(_0x826205,_0x1f4fc9){if(_0x826205['body']['id']){delete _0x826205[_0x509d('0x4a')]['id'];}return db[_0x509d('0x2a')]['find']({'where':{'id':_0x826205[_0x509d('0x44')]['id']}})[_0x509d('0x22')](handleEntityNotFound(_0x1f4fc9,null))['then'](saveUpdates(_0x826205[_0x509d('0x4a')],null))['then'](respondWithResult(_0x1f4fc9,null))['catch'](handleError(_0x1f4fc9,null));};exports['destroy']=function(_0x3bf067,_0x2b28f0){return db[_0x509d('0x2a')][_0x509d('0x47')]({'where':{'id':_0x3bf067[_0x509d('0x44')]['id']}})['then'](handleEntityNotFound(_0x2b28f0,null))['then'](removeEntity(_0x2b28f0,null))['catch'](handleError(_0x2b28f0,null));};exports['download']=function(_0x46dcce,_0x397910,_0xefd1cb){return db[_0x509d('0x2a')][_0x509d('0x47')]({'where':{'id':_0x46dcce[_0x509d('0x44')]['id']},'attributes':['id',_0x509d('0x4c'),_0x509d('0x4d')]})[_0x509d('0x22')](handleEntityNotFound(_0x397910,null))['then'](function(_0x461309){if(_0x461309){if(!_0x461309[_0x509d('0x4c')]){throw new db[(_0x509d('0x4e'))][(_0x509d('0x4f'))](_0x509d('0x50'));}var _0x5192eb={'Content-Type':'audio/wav','Content-Disposition':_0x509d('0x51')};if(_0x461309['msg_id']){_0x5192eb['Content-Disposition']=_0x509d('0x52')+_0x461309[_0x509d('0x4d')]+'.wav\x22';}_0x397910['set'](_0x5192eb);return _0x397910[_0x509d('0x27')](new Buffer(_0x461309['recording']));}})[_0x509d('0x48')](handleError(_0x397910,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 0ff2363..488118e 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 _0x11b6=['../../config/environment','./voiceMailMessage.attributes','exports','define','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x51951b,_0x5d1a16){var _0x17dc1a=function(_0x5d6ea9){while(--_0x5d6ea9){_0x51951b['push'](_0x51951b['shift']());}};_0x17dc1a(++_0x5d1a16);}(_0x11b6,0x8d));var _0x611b=function(_0x4d8942,_0x1aa5b1){_0x4d8942=_0x4d8942-0x0;var _0x374d29=_0x11b6[_0x4d8942];return _0x374d29;};'use strict';var _=require(_0x611b('0x0'));var util=require(_0x611b('0x1'));var logger=require(_0x611b('0x2'))(_0x611b('0x3'));var moment=require(_0x611b('0x4'));var BPromise=require(_0x611b('0x5'));var rp=require(_0x611b('0x6'));var fs=require('fs');var path=require(_0x611b('0x7'));var rimraf=require(_0x611b('0x8'));var config=require(_0x611b('0x9'));var attributes=require(_0x611b('0xa'));module[_0x611b('0xb')]=function(_0x24ef09,_0xd259a1){return _0x24ef09[_0x611b('0xc')]('VoiceMailMessage',attributes,{'tableName':_0x611b('0xd'),'paranoid':![],'indexes':[{'name':_0x611b('0xe'),'fields':[_0x611b('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x1b4f=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash'];(function(_0x1f7928,_0xdafed0){var _0x498443=function(_0x2da729){while(--_0x2da729){_0x1f7928['push'](_0x1f7928['shift']());}};_0x498443(++_0xdafed0);}(_0x1b4f,0x1b2));var _0xf1b4=function(_0x498e5,_0x4fd940){_0x498e5=_0x498e5-0x0;var _0x18f4ec=_0x1b4f[_0x498e5];return _0x18f4ec;};'use strict';var _=require(_0xf1b4('0x0'));var util=require(_0xf1b4('0x1'));var logger=require(_0xf1b4('0x2'))(_0xf1b4('0x3'));var moment=require(_0xf1b4('0x4'));var BPromise=require(_0xf1b4('0x5'));var rp=require(_0xf1b4('0x6'));var fs=require('fs');var path=require(_0xf1b4('0x7'));var rimraf=require(_0xf1b4('0x8'));var config=require('../../config/environment');var attributes=require(_0xf1b4('0x9'));module[_0xf1b4('0xa')]=function(_0x6678a3,_0x48bb5e){return _0x6678a3[_0xf1b4('0xb')](_0xf1b4('0xc'),attributes,{'tableName':_0xf1b4('0xd'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0xf1b4('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index f16e809..5453a9e 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 _0x3516=['request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','VoiceMailMessage,\x20%s,\x20%s'];(function(_0x14f4f0,_0x6559ae){var _0x3b8cad=function(_0x3d19ba){while(--_0x3d19ba){_0x14f4f0['push'](_0x14f4f0['shift']());}};_0x3b8cad(++_0x6559ae);}(_0x3516,0xaf));var _0x6351=function(_0x121736,_0x11d49b){_0x121736=_0x121736-0x0;var _0x439395=_0x3516[_0x121736];return _0x439395;};'use strict';var _=require(_0x6351('0x0'));var util=require(_0x6351('0x1'));var moment=require(_0x6351('0x2'));var BPromise=require('bluebird');var rs=require(_0x6351('0x3'));var fs=require('fs');var Redis=require(_0x6351('0x4'));var db=require(_0x6351('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6351('0x6'))(_0x6351('0x7'));var config=require(_0x6351('0x8'));var jayson=require(_0x6351('0x9'));var client=jayson['client'][_0x6351('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7cea07,_0x2ef58d,_0xa55c8f){return new BPromise(function(_0x20a6db,_0x2d919e){return client['request'](_0x7cea07,_0xa55c8f)[_0x6351('0xb')](function(_0xf19a86){logger[_0x6351('0xc')](_0x6351('0xd'),_0x2ef58d,_0x6351('0xe'));logger[_0x6351('0xf')](_0x6351('0x10'),_0x2ef58d,_0x6351('0xe'),JSON['stringify'](_0xf19a86));if(_0xf19a86[_0x6351('0x11')]){if(_0xf19a86[_0x6351('0x11')][_0x6351('0x12')]===0x1f4){logger[_0x6351('0x11')](_0x6351('0xd'),_0x2ef58d,_0xf19a86[_0x6351('0x11')][_0x6351('0x13')]);return _0x2d919e(_0xf19a86[_0x6351('0x11')][_0x6351('0x13')]);}logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x2ef58d,_0xf19a86[_0x6351('0x11')][_0x6351('0x13')]);return _0x20a6db(_0xf19a86[_0x6351('0x11')][_0x6351('0x13')]);}else{logger[_0x6351('0xc')](_0x6351('0xd'),_0x2ef58d,_0x6351('0xe'));_0x20a6db(_0xf19a86['result'][_0x6351('0x13')]);}})[_0x6351('0x14')](function(_0xb1e8ab){logger[_0x6351('0x11')](_0x6351('0xd'),_0x2ef58d,_0xb1e8ab);_0x2d919e(_0xb1e8ab);});});} \ No newline at end of file +var _0x042a=['rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x15bf58,_0x170ea4){var _0x5d6c96=function(_0x2c5454){while(--_0x2c5454){_0x15bf58['push'](_0x15bf58['shift']());}};_0x5d6c96(++_0x170ea4);}(_0x042a,0x185));var _0xa042=function(_0x53c6d4,_0x42f5ba){_0x53c6d4=_0x53c6d4-0x0;var _0x5cc908=_0x042a[_0x53c6d4];return _0x5cc908;};'use strict';var _=require(_0xa042('0x0'));var util=require('util');var moment=require(_0xa042('0x1'));var BPromise=require(_0xa042('0x2'));var rs=require(_0xa042('0x3'));var fs=require('fs');var Redis=require(_0xa042('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa042('0x5'));var logger=require(_0xa042('0x6'))(_0xa042('0x7'));var config=require(_0xa042('0x8'));var jayson=require(_0xa042('0x9'));var client=jayson[_0xa042('0xa')][_0xa042('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37b979,_0x4985a3,_0x53d501){return new BPromise(function(_0x39f167,_0xb3efac){return client[_0xa042('0xc')](_0x37b979,_0x53d501)['then'](function(_0x177e14){logger[_0xa042('0xd')](_0xa042('0xe'),_0x4985a3,_0xa042('0xf'));logger[_0xa042('0x10')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x4985a3,'request\x20sent',JSON[_0xa042('0x11')](_0x177e14));if(_0x177e14['error']){if(_0x177e14[_0xa042('0x12')][_0xa042('0x13')]===0x1f4){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x4985a3,_0x177e14[_0xa042('0x12')][_0xa042('0x14')]);return _0xb3efac(_0x177e14['error'][_0xa042('0x14')]);}logger[_0xa042('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x4985a3,_0x177e14['error']['message']);return _0x39f167(_0x177e14['error'][_0xa042('0x14')]);}else{logger['info'](_0xa042('0xe'),_0x4985a3,_0xa042('0xf'));_0x39f167(_0x177e14[_0xa042('0x15')][_0xa042('0x14')]);}})['catch'](function(_0x3c4075){logger[_0xa042('0x12')](_0xa042('0xe'),_0x4985a3,_0x3c4075);_0xb3efac(_0x3c4075);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 3ae76b6..2af30ca 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 _0xc249=['removeSound','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','/:id/sounds','getSounds','post','create','addSound','put','/:id','update','delete','destroy','/:id/sounds/:id2'];(function(_0x1e1c40,_0x33d5a0){var _0x266d00=function(_0x4b5860){while(--_0x4b5860){_0x1e1c40['push'](_0x1e1c40['shift']());}};_0x266d00(++_0x33d5a0);}(_0xc249,0x189));var _0x9c24=function(_0x453ccf,_0x4ed71d){_0x453ccf=_0x453ccf-0x0;var _0x1c6582=_0xc249[_0x453ccf];return _0x1c6582;};'use strict';var multer=require('multer');var util=require(_0x9c24('0x0'));var path=require(_0x9c24('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x9c24('0x2'));var auth=require(_0x9c24('0x3'));var interaction=require(_0x9c24('0x4'));var config=require(_0x9c24('0x5'));var controller=require('./voiceMusicOnHold.controller');router[_0x9c24('0x6')]('/',auth['isAuthenticated'](),controller[_0x9c24('0x7')]);router[_0x9c24('0x6')]('/:id',auth[_0x9c24('0x8')](),controller[_0x9c24('0x9')]);router[_0x9c24('0x6')](_0x9c24('0xa'),auth['isAuthenticated'](),controller[_0x9c24('0xb')]);router[_0x9c24('0xc')]('/',auth[_0x9c24('0x8')](),controller[_0x9c24('0xd')]);router[_0x9c24('0xc')]('/:id/sounds',auth[_0x9c24('0x8')](),controller[_0x9c24('0xe')]);router[_0x9c24('0xf')](_0x9c24('0x10'),auth[_0x9c24('0x8')](),controller[_0x9c24('0x11')]);router[_0x9c24('0x12')](_0x9c24('0x10'),auth[_0x9c24('0x8')](),controller[_0x9c24('0x13')]);router[_0x9c24('0x12')](_0x9c24('0x14'),auth['isAuthenticated'](),controller[_0x9c24('0x15')]);module[_0x9c24('0x16')]=router; \ No newline at end of file +var _0xdf96=['destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','getSounds','create','/:id/sounds','addSound','put','update','delete'];(function(_0x18c6a1,_0x58f1c8){var _0x341080=function(_0x2538a8){while(--_0x2538a8){_0x18c6a1['push'](_0x18c6a1['shift']());}};_0x341080(++_0x58f1c8);}(_0xdf96,0x101));var _0x6df9=function(_0x15c950,_0x26bc5b){_0x15c950=_0x15c950-0x0;var _0x178358=_0xdf96[_0x15c950];return _0x178358;};'use strict';var multer=require(_0x6df9('0x0'));var util=require(_0x6df9('0x1'));var path=require(_0x6df9('0x2'));var timeout=require(_0x6df9('0x3'));var express=require(_0x6df9('0x4'));var router=express[_0x6df9('0x5')]();var fs_extra=require(_0x6df9('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x6df9('0x7'));var config=require(_0x6df9('0x8'));var controller=require('./voiceMusicOnHold.controller');router['get']('/',auth[_0x6df9('0x9')](),controller[_0x6df9('0xa')]);router['get'](_0x6df9('0xb'),auth[_0x6df9('0x9')](),controller['show']);router['get']('/:id/sounds',auth[_0x6df9('0x9')](),controller[_0x6df9('0xc')]);router['post']('/',auth[_0x6df9('0x9')](),controller[_0x6df9('0xd')]);router['post'](_0x6df9('0xe'),auth[_0x6df9('0x9')](),controller[_0x6df9('0xf')]);router[_0x6df9('0x10')](_0x6df9('0xb'),auth[_0x6df9('0x9')](),controller[_0x6df9('0x11')]);router[_0x6df9('0x12')]('/:id',auth[_0x6df9('0x9')](),controller[_0x6df9('0x13')]);router[_0x6df9('0x12')](_0x6df9('0x14'),auth[_0x6df9('0x9')](),controller[_0x6df9('0x15')]);module[_0x6df9('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 554ada6..ac90c08 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 _0xba02=['files','mp3nb','quietmp3nb','mp3','BOOLEAN','STRING','name'];(function(_0x420a4d,_0x4d1a77){var _0x3018e3=function(_0x587fa2){while(--_0x587fa2){_0x420a4d['push'](_0x420a4d['shift']());}};_0x3018e3(++_0x4d1a77);}(_0xba02,0xc2));var _0x2ba0=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xba02[_0x5f3f88];return _0xd08119;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2ba0('0x0')],'allowNull':![],'unique':_0x2ba0('0x1')},'mode':{'type':Sequelize['ENUM']('custom',_0x2ba0('0x2'),_0x2ba0('0x3'),_0x2ba0('0x4'),'quietmp3',_0x2ba0('0x5')),'allowNull':!![],'defaultValue':_0x2ba0('0x2')},'directory':{'type':Sequelize[_0x2ba0('0x0')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x2ba0('0x0')],'allowNull':!![]},'sort':{'type':Sequelize[_0x2ba0('0x0')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x2ba0('0x0')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x2ba0('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9e74=['files','quietmp3nb','quietmp3','mp3','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x9e74,0x166));var _0x49e7=function(_0x1db15c,_0xb7e2bd){_0x1db15c=_0x1db15c-0x0;var _0x45932e=_0x9e74[_0x1db15c];return _0x45932e;};'use strict';var Sequelize=require(_0x49e7('0x0'));module[_0x49e7('0x1')]={'name':{'type':Sequelize[_0x49e7('0x2')],'allowNull':![],'unique':_0x49e7('0x3')},'mode':{'type':Sequelize[_0x49e7('0x4')]('custom',_0x49e7('0x5'),'mp3nb',_0x49e7('0x6'),_0x49e7('0x7'),_0x49e7('0x8')),'allowNull':!![],'defaultValue':_0x49e7('0x5')},'directory':{'type':Sequelize[_0x49e7('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x49e7('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x49e7('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x49e7('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x49e7('0x9')},'defaultEntry':{'type':Sequelize[_0x49e7('0xa')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index baf644e..e491486 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 _0x818f=['transaction','mode','files','directory','join','root','create','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','%s.%s','basename','extname','server/files/moh','format','symlinkSync','Sequelize','removeSound','id2','getSounds','pick','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','MusicOnHolds','destroy','error','stack','send','index','VoiceMusicOnHold','rawAttributes','fieldName','key','map','name','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','find','catch','body','params','sequelize'];(function(_0x50eab9,_0x1a6d00){var _0x102a2f=function(_0x5af23c){while(--_0x5af23c){_0x50eab9['push'](_0x50eab9['shift']());}};_0x102a2f(++_0x1a6d00);}(_0x818f,0x190));var _0xf818=function(_0x5bd718,_0xb0327){_0x5bd718=_0x5bd718-0x0;var _0x36a95b=_0x818f[_0x5bd718];return _0x36a95b;};'use strict';var emlformat=require(_0xf818('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf818('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf818('0x2'));var BPromise=require(_0xf818('0x3'));var Mustache=require(_0xf818('0x4'));var util=require(_0xf818('0x5'));var path=require(_0xf818('0x6'));var sox=require(_0xf818('0x7'));var csv=require(_0xf818('0x8'));var ejs=require(_0xf818('0x9'));var fs=require('fs');var fs_extra=require(_0xf818('0xa'));var _=require(_0xf818('0xb'));var squel=require(_0xf818('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf818('0xd'));var toCsv=require(_0xf818('0x8'));var querystring=require(_0xf818('0xe'));var Papa=require(_0xf818('0xf'));var Redis=require(_0xf818('0x10'));var authService=require(_0xf818('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf818('0x12'));var hardwareService=require(_0xf818('0x13'));var logger=require(_0xf818('0x14'))(_0xf818('0x15'));var utils=require(_0xf818('0x16'));var config=require(_0xf818('0x17'));var licenseUtil=require(_0xf818('0x18'));var db=require(_0xf818('0x19'))['db'];function respondWithStatusCode(_0x276a67,_0x4d0418){_0x4d0418=_0x4d0418||0xcc;return function(_0x6d0f4d){if(_0x6d0f4d){return _0x276a67[_0xf818('0x1a')](_0x4d0418);}return _0x276a67['status'](_0x4d0418)[_0xf818('0x1b')]();};}function respondWithResult(_0xb914d7,_0x17a7e3){_0x17a7e3=_0x17a7e3||0xc8;return function(_0x196dbc){if(_0x196dbc){return _0xb914d7[_0xf818('0x1c')](_0x17a7e3)[_0xf818('0x1d')](_0x196dbc);}};}function respondWithFilteredResult(_0x2c4fa3,_0x29b960){return function(_0x4bdfa9){if(_0x4bdfa9){var _0x5e0ab0=typeof _0x29b960[_0xf818('0x1e')]==='undefined'&&typeof _0x29b960[_0xf818('0x1f')]===_0xf818('0x20');var _0x3ff379=_0x4bdfa9[_0xf818('0x21')];var _0x587a0b=_0x5e0ab0?0x0:_0x29b960['offset'];var _0x947879=_0x5e0ab0?_0x4bdfa9[_0xf818('0x21')]:_0x29b960[_0xf818('0x1e')]+_0x29b960['limit'];var _0x40ca9a;if(_0x947879>=_0x3ff379){_0x947879=_0x3ff379;_0x40ca9a=0xc8;}else{_0x40ca9a=0xce;}_0x2c4fa3[_0xf818('0x1c')](_0x40ca9a);return _0x2c4fa3[_0xf818('0x22')](_0xf818('0x23'),_0x587a0b+'-'+_0x947879+'/'+_0x3ff379)[_0xf818('0x1d')](_0x4bdfa9);}return null;};}function patchUpdates(_0xe96b9d){return function(_0x2ba4e8){try{jsonpatch[_0xf818('0x24')](_0x2ba4e8,_0xe96b9d,!![]);}catch(_0x26ecbf){return BPromise[_0xf818('0x25')](_0x26ecbf);}return _0x2ba4e8[_0xf818('0x26')]();};}function saveUpdates(_0x2384f3,_0xf259cb){return function(_0xcc8c1f){if(_0xcc8c1f){return _0xcc8c1f[_0xf818('0x27')](_0x2384f3)[_0xf818('0x28')](function(_0x3c62f2){return _0x3c62f2;});}return null;};}function removeEntity(_0x53879b,_0x5694a4){return function(_0x9fcaae){if(_0x9fcaae){return _0x9fcaae['destroy']()[_0xf818('0x28')](function(){var _0x4f8842=_0x9fcaae[_0xf818('0x29')]({'plain':!![]});var _0x2abe85=_0xf818('0x2a');return db['UserProfileResource'][_0xf818('0x2b')]({'where':{'type':_0x2abe85,'resourceId':_0x4f8842['id']}})[_0xf818('0x28')](function(){return _0x9fcaae;});})[_0xf818('0x28')](function(){_0x53879b[_0xf818('0x1c')](0xcc)[_0xf818('0x1b')]();});}};}function handleEntityNotFound(_0x4c0ea0,_0x30f58d){return function(_0x5291e2){if(!_0x5291e2){_0x4c0ea0['sendStatus'](0x194);}return _0x5291e2;};}function handleError(_0x2a6f29,_0x32d25f){_0x32d25f=_0x32d25f||0x1f4;return function(_0x3ded3d){logger[_0xf818('0x2c')](_0x3ded3d[_0xf818('0x2d')]);if(_0x3ded3d['name']){delete _0x3ded3d['name'];}_0x2a6f29[_0xf818('0x1c')](_0x32d25f)[_0xf818('0x2e')](_0x3ded3d);};}exports[_0xf818('0x2f')]=function(_0x57f21c,_0x93bd5e){var _0x59d8fd={},_0x13f912={},_0x418f73={'count':0x0,'rows':[]};var _0x22805c=_['map'](db[_0xf818('0x30')][_0xf818('0x31')],function(_0x2ec482){return{'name':_0x2ec482[_0xf818('0x32')],'type':_0x2ec482['type'][_0xf818('0x33')]};});_0x13f912['model']=_[_0xf818('0x34')](_0x22805c,_0xf818('0x35'));_0x13f912[_0xf818('0x36')]=_[_0xf818('0x37')](_0x57f21c[_0xf818('0x36')]);_0x13f912[_0xf818('0x38')]=_['intersection'](_0x13f912[_0xf818('0x39')],_0x13f912['query']);_0x59d8fd[_0xf818('0x3a')]=_[_0xf818('0x3b')](_0x13f912[_0xf818('0x39')],qs[_0xf818('0x3c')](_0x57f21c['query'][_0xf818('0x3c')]));_0x59d8fd[_0xf818('0x3a')]=_0x59d8fd[_0xf818('0x3a')][_0xf818('0x3d')]?_0x59d8fd['attributes']:_0x13f912[_0xf818('0x39')];if(!_0x57f21c[_0xf818('0x36')]['hasOwnProperty'](_0xf818('0x3e'))){_0x59d8fd[_0xf818('0x1f')]=qs[_0xf818('0x1f')](_0x57f21c[_0xf818('0x36')]['limit']);_0x59d8fd['offset']=qs[_0xf818('0x1e')](_0x57f21c[_0xf818('0x36')][_0xf818('0x1e')]);}_0x59d8fd[_0xf818('0x3f')]=qs['sort'](_0x57f21c[_0xf818('0x36')][_0xf818('0x40')]);delete _0x57f21c[_0xf818('0x36')][_0xf818('0x40')];_0x59d8fd[_0xf818('0x41')]=qs[_0xf818('0x38')](_['pick'](_0x57f21c[_0xf818('0x36')],_0x13f912[_0xf818('0x38')]),_0x22805c);if(_0x57f21c[_0xf818('0x36')]['filter']){_0x59d8fd[_0xf818('0x41')]=_[_0xf818('0x42')](_0x59d8fd[_0xf818('0x41')],{'$or':_[_0xf818('0x34')](_0x22805c,function(_0x4eb24a){if(_0x4eb24a[_0xf818('0x43')]!==_0xf818('0x44')){var _0x435020={};_0x435020[_0x4eb24a[_0xf818('0x35')]]={'$like':'%'+_0x57f21c[_0xf818('0x36')][_0xf818('0x45')]+'%'};return _0x435020;}})});}_0x59d8fd=_[_0xf818('0x42')]({},_0x59d8fd,_0x57f21c[_0xf818('0x46')]);var _0xc1c10c={'where':_0x59d8fd[_0xf818('0x41')]};return db[_0xf818('0x30')][_0xf818('0x21')](_0xc1c10c)[_0xf818('0x28')](function(_0x51705a){_0x418f73['count']=_0x51705a;if(_0x57f21c[_0xf818('0x36')][_0xf818('0x47')]){_0x59d8fd[_0xf818('0x48')]=[{'all':!![]}];}return db[_0xf818('0x30')][_0xf818('0x49')](_0x59d8fd);})[_0xf818('0x28')](function(_0x1249da){_0x418f73[_0xf818('0x4a')]=_0x1249da;return _0x418f73;})[_0xf818('0x28')](respondWithFilteredResult(_0x93bd5e,_0x59d8fd))['catch'](handleError(_0x93bd5e,null));};exports['show']=function(_0xb335a,_0xdac2b0){var _0x360088={'raw':![],'where':{'id':_0xb335a['params']['id']}},_0x3d9945={};_0x3d9945[_0xf818('0x39')]=_[_0xf818('0x37')](db[_0xf818('0x30')]['rawAttributes']);_0x3d9945[_0xf818('0x36')]=_[_0xf818('0x37')](_0xb335a[_0xf818('0x36')]);_0x3d9945[_0xf818('0x38')]=_['intersection'](_0x3d9945[_0xf818('0x39')],_0x3d9945[_0xf818('0x36')]);_0x360088['attributes']=_[_0xf818('0x3b')](_0x3d9945['model'],qs[_0xf818('0x3c')](_0xb335a[_0xf818('0x36')][_0xf818('0x3c')]));_0x360088['attributes']=_0x360088[_0xf818('0x3a')][_0xf818('0x3d')]?_0x360088[_0xf818('0x3a')]:_0x3d9945[_0xf818('0x39')];if(_0xb335a[_0xf818('0x36')]['includeAll']){_0x360088[_0xf818('0x48')]=[{'all':!![]}];}_0x360088=_['merge']({},_0x360088,_0xb335a['options']);return db['VoiceMusicOnHold'][_0xf818('0x4b')](_0x360088)[_0xf818('0x28')](handleEntityNotFound(_0xdac2b0,null))[_0xf818('0x28')](respondWithResult(_0xdac2b0,null))[_0xf818('0x4c')](handleError(_0xdac2b0,null));};exports[_0xf818('0x27')]=function(_0x2728ab,_0x56329a){if(_0x2728ab[_0xf818('0x4d')]['id']){delete _0x2728ab[_0xf818('0x4d')]['id'];}return db[_0xf818('0x30')]['find']({'where':{'id':_0x2728ab[_0xf818('0x4e')]['id']}})[_0xf818('0x28')](handleEntityNotFound(_0x56329a,null))[_0xf818('0x28')](saveUpdates(_0x2728ab[_0xf818('0x4d')],null))['then'](respondWithResult(_0x56329a,null))['catch'](handleError(_0x56329a,null));};exports['create']=function(_0x24733c,_0x289997,_0x5b1c3b){return db[_0xf818('0x4f')][_0xf818('0x50')](function(_0x274f8c){if(_0x24733c[_0xf818('0x4d')][_0xf818('0x51')]===_0xf818('0x52')){_0x24733c[_0xf818('0x4d')][_0xf818('0x53')]=path[_0xf818('0x54')](config[_0xf818('0x55')],'server/files/moh',_0x24733c['body'][_0xf818('0x35')]);}return db[_0xf818('0x30')][_0xf818('0x56')](_0x24733c[_0xf818('0x4d')],{'transaction':_0x274f8c})[_0xf818('0x28')](function(_0x59de31){if(_0x24733c[_0xf818('0x4d')]['mode']===_0xf818('0x52')){fs[_0xf818('0x57')](_0x59de31[_0xf818('0x53')],parseInt(_0xf818('0x58'),0x8));}var _0x578fa8=_0x24733c[_0xf818('0x59')]['get']({'plain':!![]});if(!_0x578fa8)throw new Error(_0xf818('0x5a'));if(_0x578fa8['role']===_0xf818('0x59')){var _0x575631=_0x59de31[_0xf818('0x29')]({'plain':!![]});return db[_0xf818('0x5b')][_0xf818('0x4b')]({'where':{'name':_0xf818('0x2a'),'userProfileId':_0x578fa8[_0xf818('0x5c')]},'raw':!![]})[_0xf818('0x28')](function(_0x4fb880){if(_0x4fb880&&_0x4fb880[_0xf818('0x5d')]===0x0){return db[_0xf818('0x5e')]['create']({'name':_0x575631[_0xf818('0x35')],'resourceId':_0x575631['id'],'type':_0x4fb880[_0xf818('0x35')],'sectionId':_0x4fb880['id']},{})['then'](function(){return _0x59de31;});}else{return _0x59de31;}})[_0xf818('0x4c')](function(_0x222939){logger[_0xf818('0x2c')](_0xf818('0x5f'),_0x222939);});}return _0x59de31;});})[_0xf818('0x28')](respondWithResult(_0x289997,0xc9))[_0xf818('0x4c')](handleError(_0x289997,null));};exports[_0xf818('0x2b')]=function(_0x10ffd9,_0x7fc398,_0x5a4ac7){var _0x395c89;return db[_0xf818('0x30')][_0xf818('0x4b')]({'where':{'id':_0x10ffd9[_0xf818('0x4e')]['id']}})['then'](function(_0x4d14fc){if(_0x4d14fc){return db[_0xf818('0x4f')][_0xf818('0x50')](function(_0x2df8a1){return _0x4d14fc[_0xf818('0x2b')]({'transaction':_0x2df8a1,'raw':!![]})[_0xf818('0x28')](function(_0x202ec8){if(_0x202ec8[_0xf818('0x53')]){fs[_0xf818('0x60')](_0x202ec8[_0xf818('0x53')])[_0xf818('0x61')](function(_0x3d84bf){fs[_0xf818('0x62')](path[_0xf818('0x54')](_0x202ec8[_0xf818('0x53')],_0x3d84bf));});fs[_0xf818('0x63')](_0x202ec8[_0xf818('0x53')]);}return _0x202ec8;});})[_0xf818('0x4c')](function(_0x3ec1ae){throw new db['Sequelize'][(_0xf818('0x64'))](_0x3ec1ae[_0xf818('0x65')]);});}})[_0xf818('0x28')](handleEntityNotFound(_0x7fc398,null))['then'](removeEntity(_0x7fc398,null))[_0xf818('0x4c')](handleError(_0x7fc398,null));};exports[_0xf818('0x66')]=function(_0x28ed72,_0x4f6d14,_0x576e43){return db[_0xf818('0x4f')]['transaction'](function(_0x5309ad){var _0x4627a5;return db[_0xf818('0x30')][_0xf818('0x4b')]({'where':{'id':_0x28ed72[_0xf818('0x4e')]['id']}})[_0xf818('0x28')](function(_0x449d78){if(_0x449d78){_0x4627a5=_0x449d78;return _0x449d78['addSound'](_0x28ed72['body']['id'],{'transaction':_0x5309ad});}})['then'](function(_0x32ecbb){if(_0x32ecbb){return db[_0xf818('0x67')][_0xf818('0x68')]({'where':{'id':_0x28ed72[_0xf818('0x4d')]['id']},'attributes':['id','name',_0xf818('0x69'),_0xf818('0x6a'),_0xf818('0x6b')],'raw':!![]});}})['then'](function(_0x3797b8){if(_0x3797b8){var _0x1e6e32=path[_0xf818('0x54')](config[_0xf818('0x55')],_0xf818('0x6c'),util['format'](_0xf818('0x6d'),path[_0xf818('0x6e')](_0x3797b8[_0xf818('0x69')],path[_0xf818('0x6f')](_0x3797b8[_0xf818('0x69')])),_0x3797b8[_0xf818('0x6a')]));var _0x2802bf=path[_0xf818('0x54')](config[_0xf818('0x55')],_0xf818('0x70'),_0x4627a5[_0xf818('0x35')],util[_0xf818('0x71')](_0xf818('0x6d'),_0x3797b8[_0xf818('0x35')],_0x3797b8[_0xf818('0x6a')]));fs[_0xf818('0x72')](_0x1e6e32,_0x2802bf);return _0x3797b8;}})[_0xf818('0x4c')](function(_0x120d2d){throw new db[(_0xf818('0x73'))][(_0xf818('0x64'))](_0x120d2d[_0xf818('0x65')]);});})[_0xf818('0x28')](handleEntityNotFound(_0x4f6d14,null))[_0xf818('0x28')](respondWithResult(_0x4f6d14,0xc9))[_0xf818('0x4c')](handleError(_0x4f6d14,null));};exports[_0xf818('0x74')]=function(_0x2b0850,_0x51add9,_0x16146e){return db['sequelize'][_0xf818('0x50')](function(_0x103abd){var _0x34e9ec;return db[_0xf818('0x30')]['findOne']({'where':{'id':_0x2b0850[_0xf818('0x4e')]['id']}})[_0xf818('0x28')](handleEntityNotFound(_0x51add9,null))[_0xf818('0x28')](function(_0xadc42d){if(_0xadc42d){_0x34e9ec=_0xadc42d;return _0xadc42d[_0xf818('0x74')](_0x2b0850[_0xf818('0x4e')][_0xf818('0x75')]);}})[_0xf818('0x28')](function(_0x59a174){if(_0x59a174){return db[_0xf818('0x67')]['findOne']({'where':{'id':_0x2b0850[_0xf818('0x4e')]['id2']},'attributes':['id',_0xf818('0x35'),_0xf818('0x69'),'converted_format',_0xf818('0x6b')],'raw':!![]});}})[_0xf818('0x28')](function(_0x132d22){if(_0x132d22){fs[_0xf818('0x62')](path[_0xf818('0x54')](_0x34e9ec['directory'],util[_0xf818('0x71')]('%s.%s',_0x132d22[_0xf818('0x35')],_0x132d22['converted_format'])));return _0x132d22;}})[_0xf818('0x4c')](function(_0x305d98){throw new db[(_0xf818('0x73'))][(_0xf818('0x64'))](_0x305d98[_0xf818('0x65')]);});})['then'](handleEntityNotFound(_0x51add9,null))[_0xf818('0x28')](respondWithStatusCode(_0x51add9,0xcc))[_0xf818('0x4c')](handleError(_0x51add9,null));};exports[_0xf818('0x76')]=function(_0x6ae14c,_0x272f2d,_0xbf41f5){var _0x190ac5={};var _0x4d903f={};var _0x561690;var _0xc01cdb;return db['VoiceMusicOnHold'][_0xf818('0x68')]({'where':{'id':_0x6ae14c[_0xf818('0x4e')]['id']}})[_0xf818('0x28')](handleEntityNotFound(_0x272f2d,null))[_0xf818('0x28')](function(_0x28c897){if(_0x28c897){_0x561690=_0x28c897;_0x4d903f[_0xf818('0x39')]=_[_0xf818('0x37')](db[_0xf818('0x67')][_0xf818('0x31')]);_0x4d903f[_0xf818('0x36')]=_[_0xf818('0x37')](_0x6ae14c[_0xf818('0x36')]);_0x4d903f['filters']=_[_0xf818('0x3b')](_0x4d903f['model'],_0x4d903f[_0xf818('0x36')]);_0x190ac5[_0xf818('0x3a')]=_[_0xf818('0x3b')](_0x4d903f[_0xf818('0x39')],qs[_0xf818('0x3c')](_0x6ae14c[_0xf818('0x36')][_0xf818('0x3c')]));_0x190ac5[_0xf818('0x3a')]=_0x190ac5[_0xf818('0x3a')][_0xf818('0x3d')]?_0x190ac5[_0xf818('0x3a')]:_0x4d903f[_0xf818('0x39')];_0x190ac5[_0xf818('0x3f')]=qs['sort'](_0x6ae14c[_0xf818('0x36')]['sort']);_0x190ac5[_0xf818('0x41')]=qs[_0xf818('0x38')](_[_0xf818('0x77')](_0x6ae14c[_0xf818('0x36')],_0x4d903f[_0xf818('0x38')]));if(_0x6ae14c[_0xf818('0x36')][_0xf818('0x45')]){_0x190ac5[_0xf818('0x41')]=_[_0xf818('0x42')](_0x190ac5['where'],{'$or':_['map'](_0x190ac5[_0xf818('0x3a')],function(_0x3c49c7){var _0x509b98={};_0x509b98[_0x3c49c7]={'$like':'%'+_0x6ae14c[_0xf818('0x36')]['filter']+'%'};return _0x509b98;})});}_0x190ac5=_[_0xf818('0x42')]({},_0x190ac5,_0x6ae14c[_0xf818('0x46')]);return _0x561690['getSounds'](_0x190ac5);}})[_0xf818('0x28')](function(_0x442da0){if(_0x442da0){_0xc01cdb=_0x442da0['length'];if(!_0x6ae14c['query']['hasOwnProperty'](_0xf818('0x3e'))){_0x190ac5[_0xf818('0x1f')]=qs[_0xf818('0x1f')](_0x6ae14c[_0xf818('0x36')]['limit']);_0x190ac5[_0xf818('0x1e')]=qs['offset'](_0x6ae14c['query'][_0xf818('0x1e')]);}return _0x561690[_0xf818('0x76')](_0x190ac5);}})[_0xf818('0x28')](function(_0x4280c7){if(_0x4280c7){return _0x4280c7?{'count':_0xc01cdb,'rows':_0x4280c7}:null;}})[_0xf818('0x28')](respondWithResult(_0x272f2d,null))[_0xf818('0x4c')](handleError(_0x272f2d,null));}; \ No newline at end of file +var _0x133e=['extname','format','findOne','removeSound','id2','ValidationError','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','body','create','mode','directory','join','root','server/files/moh','files','mkdirSync','user','role','UserProfileSection','MusicOnHolds','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','transaction','readdirSync','unlinkSync','Sequelize','message','addSound','Sound','converted_format','createdAt','server/files/sounds/converted','%s.%s','basename','save_name'];(function(_0x4f6f8b,_0xfc074f){var _0x448e2c=function(_0x294d12){while(--_0x294d12){_0x4f6f8b['push'](_0x4f6f8b['shift']());}};_0x448e2c(++_0xfc074f);}(_0x133e,0x15d));var _0xe133=function(_0x4664db,_0x1de672){_0x4664db=_0x4664db-0x0;var _0x5615b4=_0x133e[_0x4664db];return _0x5615b4;};'use strict';var emlformat=require(_0xe133('0x0'));var rimraf=require(_0xe133('0x1'));var zipdir=require(_0xe133('0x2'));var jsonpatch=require(_0xe133('0x3'));var rp=require(_0xe133('0x4'));var moment=require('moment');var BPromise=require(_0xe133('0x5'));var Mustache=require(_0xe133('0x6'));var util=require(_0xe133('0x7'));var path=require(_0xe133('0x8'));var sox=require(_0xe133('0x9'));var csv=require(_0xe133('0xa'));var ejs=require(_0xe133('0xb'));var fs=require('fs');var fs_extra=require(_0xe133('0xc'));var _=require(_0xe133('0xd'));var squel=require(_0xe133('0xe'));var crypto=require(_0xe133('0xf'));var jsforce=require(_0xe133('0x10'));var deskjs=require(_0xe133('0x11'));var toCsv=require(_0xe133('0xa'));var querystring=require('querystring');var Papa=require(_0xe133('0x12'));var Redis=require(_0xe133('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe133('0x14'));var hardwareService=require(_0xe133('0x15'));var logger=require('../../config/logger')(_0xe133('0x16'));var utils=require('../../config/utils');var config=require(_0xe133('0x17'));var licenseUtil=require(_0xe133('0x18'));var db=require(_0xe133('0x19'))['db'];function respondWithStatusCode(_0x3b9590,_0x569803){_0x569803=_0x569803||0xcc;return function(_0x1d41e6){if(_0x1d41e6){return _0x3b9590[_0xe133('0x1a')](_0x569803);}return _0x3b9590['status'](_0x569803)[_0xe133('0x1b')]();};}function respondWithResult(_0x1c7533,_0x1db12a){_0x1db12a=_0x1db12a||0xc8;return function(_0x2bfb79){if(_0x2bfb79){return _0x1c7533[_0xe133('0x1c')](_0x1db12a)[_0xe133('0x1d')](_0x2bfb79);}};}function respondWithFilteredResult(_0x49a65a,_0x2c22a6){return function(_0x4604d2){if(_0x4604d2){var _0x38bdc4=typeof _0x2c22a6[_0xe133('0x1e')]==='undefined'&&typeof _0x2c22a6[_0xe133('0x1f')]===_0xe133('0x20');var _0x277c9d=_0x4604d2[_0xe133('0x21')];var _0x7a9193=_0x38bdc4?0x0:_0x2c22a6[_0xe133('0x1e')];var _0x2d33ed=_0x38bdc4?_0x4604d2[_0xe133('0x21')]:_0x2c22a6[_0xe133('0x1e')]+_0x2c22a6['limit'];var _0x5b0905;if(_0x2d33ed>=_0x277c9d){_0x2d33ed=_0x277c9d;_0x5b0905=0xc8;}else{_0x5b0905=0xce;}_0x49a65a['status'](_0x5b0905);return _0x49a65a[_0xe133('0x22')]('Content-Range',_0x7a9193+'-'+_0x2d33ed+'/'+_0x277c9d)['json'](_0x4604d2);}return null;};}function patchUpdates(_0x2e649c){return function(_0x59e2c6){try{jsonpatch[_0xe133('0x23')](_0x59e2c6,_0x2e649c,!![]);}catch(_0xdb1a48){return BPromise['reject'](_0xdb1a48);}return _0x59e2c6[_0xe133('0x24')]();};}function saveUpdates(_0x4c5c87,_0xf0e8b){return function(_0x34e375){if(_0x34e375){return _0x34e375[_0xe133('0x25')](_0x4c5c87)[_0xe133('0x26')](function(_0x11368c){return _0x11368c;});}return null;};}function removeEntity(_0x44eca2,_0x5a408a){return function(_0x1b4d3f){if(_0x1b4d3f){return _0x1b4d3f[_0xe133('0x27')]()['then'](function(){var _0x4ea8c1=_0x1b4d3f[_0xe133('0x28')]({'plain':!![]});var _0x5efa2d='MusicOnHolds';return db[_0xe133('0x29')][_0xe133('0x27')]({'where':{'type':_0x5efa2d,'resourceId':_0x4ea8c1['id']}})['then'](function(){return _0x1b4d3f;});})[_0xe133('0x26')](function(){_0x44eca2['status'](0xcc)[_0xe133('0x1b')]();});}};}function handleEntityNotFound(_0x2fca81,_0x17bd11){return function(_0x21d418){if(!_0x21d418){_0x2fca81[_0xe133('0x1a')](0x194);}return _0x21d418;};}function handleError(_0x3a647d,_0x346f6a){_0x346f6a=_0x346f6a||0x1f4;return function(_0x5f460c){logger[_0xe133('0x2a')](_0x5f460c[_0xe133('0x2b')]);if(_0x5f460c[_0xe133('0x2c')]){delete _0x5f460c[_0xe133('0x2c')];}_0x3a647d[_0xe133('0x1c')](_0x346f6a)[_0xe133('0x2d')](_0x5f460c);};}exports['index']=function(_0x1a77a0,_0x5c1128){var _0x25cec2={},_0x20aec9={},_0x291aa3={'count':0x0,'rows':[]};var _0x4c3b89=_[_0xe133('0x2e')](db[_0xe133('0x2f')][_0xe133('0x30')],function(_0x208eda){return{'name':_0x208eda[_0xe133('0x31')],'type':_0x208eda[_0xe133('0x32')][_0xe133('0x33')]};});_0x20aec9['model']=_[_0xe133('0x2e')](_0x4c3b89,'name');_0x20aec9[_0xe133('0x34')]=_['keys'](_0x1a77a0[_0xe133('0x34')]);_0x20aec9[_0xe133('0x35')]=_[_0xe133('0x36')](_0x20aec9[_0xe133('0x37')],_0x20aec9[_0xe133('0x34')]);_0x25cec2['attributes']=_[_0xe133('0x36')](_0x20aec9[_0xe133('0x37')],qs[_0xe133('0x38')](_0x1a77a0[_0xe133('0x34')][_0xe133('0x38')]));_0x25cec2[_0xe133('0x39')]=_0x25cec2[_0xe133('0x39')][_0xe133('0x3a')]?_0x25cec2[_0xe133('0x39')]:_0x20aec9[_0xe133('0x37')];if(!_0x1a77a0['query'][_0xe133('0x3b')](_0xe133('0x3c'))){_0x25cec2[_0xe133('0x1f')]=qs['limit'](_0x1a77a0[_0xe133('0x34')][_0xe133('0x1f')]);_0x25cec2[_0xe133('0x1e')]=qs[_0xe133('0x1e')](_0x1a77a0[_0xe133('0x34')][_0xe133('0x1e')]);}_0x25cec2[_0xe133('0x3d')]=qs['sort'](_0x1a77a0[_0xe133('0x34')][_0xe133('0x3e')]);delete _0x1a77a0[_0xe133('0x34')][_0xe133('0x3e')];_0x25cec2[_0xe133('0x3f')]=qs[_0xe133('0x35')](_[_0xe133('0x40')](_0x1a77a0[_0xe133('0x34')],_0x20aec9[_0xe133('0x35')]),_0x4c3b89);if(_0x1a77a0[_0xe133('0x34')]['filter']){_0x25cec2[_0xe133('0x3f')]=_['merge'](_0x25cec2[_0xe133('0x3f')],{'$or':_[_0xe133('0x2e')](_0x4c3b89,function(_0x22c790){if(_0x22c790[_0xe133('0x32')]!==_0xe133('0x41')){var _0x45d28f={};_0x45d28f[_0x22c790[_0xe133('0x2c')]]={'$like':'%'+_0x1a77a0[_0xe133('0x34')][_0xe133('0x42')]+'%'};return _0x45d28f;}})});}_0x25cec2=_[_0xe133('0x43')]({},_0x25cec2,_0x1a77a0[_0xe133('0x44')]);var _0x1ed225={'where':_0x25cec2[_0xe133('0x3f')]};return db[_0xe133('0x2f')][_0xe133('0x21')](_0x1ed225)[_0xe133('0x26')](function(_0x27b5c8){_0x291aa3[_0xe133('0x21')]=_0x27b5c8;if(_0x1a77a0[_0xe133('0x34')][_0xe133('0x45')]){_0x25cec2[_0xe133('0x46')]=[{'all':!![]}];}return db[_0xe133('0x2f')][_0xe133('0x47')](_0x25cec2);})[_0xe133('0x26')](function(_0xbd8c58){_0x291aa3[_0xe133('0x48')]=_0xbd8c58;return _0x291aa3;})['then'](respondWithFilteredResult(_0x5c1128,_0x25cec2))[_0xe133('0x49')](handleError(_0x5c1128,null));};exports[_0xe133('0x4a')]=function(_0x3a1d20,_0x415065){var _0x511264={'raw':![],'where':{'id':_0x3a1d20[_0xe133('0x4b')]['id']}},_0x2efcd5={};_0x2efcd5[_0xe133('0x37')]=_[_0xe133('0x4c')](db['VoiceMusicOnHold'][_0xe133('0x30')]);_0x2efcd5['query']=_[_0xe133('0x4c')](_0x3a1d20['query']);_0x2efcd5['filters']=_[_0xe133('0x36')](_0x2efcd5[_0xe133('0x37')],_0x2efcd5[_0xe133('0x34')]);_0x511264['attributes']=_[_0xe133('0x36')](_0x2efcd5['model'],qs[_0xe133('0x38')](_0x3a1d20[_0xe133('0x34')][_0xe133('0x38')]));_0x511264[_0xe133('0x39')]=_0x511264[_0xe133('0x39')]['length']?_0x511264[_0xe133('0x39')]:_0x2efcd5['model'];if(_0x3a1d20['query'][_0xe133('0x45')]){_0x511264[_0xe133('0x46')]=[{'all':!![]}];}_0x511264=_[_0xe133('0x43')]({},_0x511264,_0x3a1d20[_0xe133('0x44')]);return db[_0xe133('0x2f')][_0xe133('0x4d')](_0x511264)[_0xe133('0x26')](handleEntityNotFound(_0x415065,null))[_0xe133('0x26')](respondWithResult(_0x415065,null))['catch'](handleError(_0x415065,null));};exports[_0xe133('0x25')]=function(_0x32baeb,_0x4c6675){if(_0x32baeb['body']['id']){delete _0x32baeb[_0xe133('0x4e')]['id'];}return db[_0xe133('0x2f')]['find']({'where':{'id':_0x32baeb[_0xe133('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4c6675,null))[_0xe133('0x26')](saveUpdates(_0x32baeb[_0xe133('0x4e')],null))[_0xe133('0x26')](respondWithResult(_0x4c6675,null))[_0xe133('0x49')](handleError(_0x4c6675,null));};exports[_0xe133('0x4f')]=function(_0x2f7b92,_0x45715e,_0x1a52e2){return db['sequelize']['transaction'](function(_0x4ce4aa){if(_0x2f7b92[_0xe133('0x4e')][_0xe133('0x50')]==='files'){_0x2f7b92[_0xe133('0x4e')][_0xe133('0x51')]=path[_0xe133('0x52')](config[_0xe133('0x53')],_0xe133('0x54'),_0x2f7b92[_0xe133('0x4e')][_0xe133('0x2c')]);}return db['VoiceMusicOnHold'][_0xe133('0x4f')](_0x2f7b92[_0xe133('0x4e')],{'transaction':_0x4ce4aa})[_0xe133('0x26')](function(_0xe8e6a0){if(_0x2f7b92[_0xe133('0x4e')][_0xe133('0x50')]===_0xe133('0x55')){fs[_0xe133('0x56')](_0xe8e6a0[_0xe133('0x51')],parseInt('0777',0x8));}var _0x2b8777=_0x2f7b92[_0xe133('0x57')][_0xe133('0x28')]({'plain':!![]});if(!_0x2b8777)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b8777[_0xe133('0x58')]==='user'){var _0x1694c5=_0xe8e6a0['get']({'plain':!![]});return db[_0xe133('0x59')][_0xe133('0x4d')]({'where':{'name':_0xe133('0x5a'),'userProfileId':_0x2b8777[_0xe133('0x5b')]},'raw':!![]})[_0xe133('0x26')](function(_0x364202){if(_0x364202&&_0x364202['autoAssociation']===0x0){return db['UserProfileResource'][_0xe133('0x4f')]({'name':_0x1694c5[_0xe133('0x2c')],'resourceId':_0x1694c5['id'],'type':_0x364202['name'],'sectionId':_0x364202['id']},{})['then'](function(){return _0xe8e6a0;});}else{return _0xe8e6a0;}})[_0xe133('0x49')](function(_0x1e837d){logger[_0xe133('0x2a')](_0xe133('0x5c'),_0x1e837d);});}return _0xe8e6a0;});})['then'](respondWithResult(_0x45715e,0xc9))[_0xe133('0x49')](handleError(_0x45715e,null));};exports[_0xe133('0x27')]=function(_0x5d8576,_0x37e4c3,_0x3599aa){var _0x2eb9a3;return db['VoiceMusicOnHold'][_0xe133('0x4d')]({'where':{'id':_0x5d8576['params']['id']}})['then'](function(_0x370ced){if(_0x370ced){return db[_0xe133('0x5d')][_0xe133('0x5e')](function(_0x40d377){return _0x370ced[_0xe133('0x27')]({'transaction':_0x40d377,'raw':!![]})['then'](function(_0x34a44c){if(_0x34a44c[_0xe133('0x51')]){fs[_0xe133('0x5f')](_0x34a44c[_0xe133('0x51')])['forEach'](function(_0x34da79){fs[_0xe133('0x60')](path[_0xe133('0x52')](_0x34a44c[_0xe133('0x51')],_0x34da79));});fs['rmdirSync'](_0x34a44c[_0xe133('0x51')]);}return _0x34a44c;});})[_0xe133('0x49')](function(_0x695de){throw new db[(_0xe133('0x61'))]['ValidationError'](_0x695de[_0xe133('0x62')]);});}})[_0xe133('0x26')](handleEntityNotFound(_0x37e4c3,null))[_0xe133('0x26')](removeEntity(_0x37e4c3,null))[_0xe133('0x49')](handleError(_0x37e4c3,null));};exports[_0xe133('0x63')]=function(_0x74e70,_0x4212bf,_0x7e5589){return db['sequelize'][_0xe133('0x5e')](function(_0x58b877){var _0x496606;return db['VoiceMusicOnHold'][_0xe133('0x4d')]({'where':{'id':_0x74e70[_0xe133('0x4b')]['id']}})['then'](function(_0x2f9022){if(_0x2f9022){_0x496606=_0x2f9022;return _0x2f9022['addSound'](_0x74e70[_0xe133('0x4e')]['id'],{'transaction':_0x58b877});}})['then'](function(_0x64e021){if(_0x64e021){return db[_0xe133('0x64')]['findOne']({'where':{'id':_0x74e70['body']['id']},'attributes':['id',_0xe133('0x2c'),'save_name',_0xe133('0x65'),_0xe133('0x66')],'raw':!![]});}})[_0xe133('0x26')](function(_0x11f117){if(_0x11f117){var _0x259f33=path[_0xe133('0x52')](config['root'],_0xe133('0x67'),util['format'](_0xe133('0x68'),path[_0xe133('0x69')](_0x11f117[_0xe133('0x6a')],path[_0xe133('0x6b')](_0x11f117[_0xe133('0x6a')])),_0x11f117[_0xe133('0x65')]));var _0x2ccd71=path[_0xe133('0x52')](config[_0xe133('0x53')],_0xe133('0x54'),_0x496606['name'],util[_0xe133('0x6c')]('%s.%s',_0x11f117[_0xe133('0x2c')],_0x11f117[_0xe133('0x65')]));fs['symlinkSync'](_0x259f33,_0x2ccd71);return _0x11f117;}})[_0xe133('0x49')](function(_0x69e9bb){throw new db[(_0xe133('0x61'))]['ValidationError'](_0x69e9bb[_0xe133('0x62')]);});})[_0xe133('0x26')](handleEntityNotFound(_0x4212bf,null))[_0xe133('0x26')](respondWithResult(_0x4212bf,0xc9))[_0xe133('0x49')](handleError(_0x4212bf,null));};exports['removeSound']=function(_0x328e37,_0x17f3a1,_0x56d0ec){return db[_0xe133('0x5d')][_0xe133('0x5e')](function(_0x4a02a0){var _0x160b3d;return db[_0xe133('0x2f')][_0xe133('0x6d')]({'where':{'id':_0x328e37[_0xe133('0x4b')]['id']}})[_0xe133('0x26')](handleEntityNotFound(_0x17f3a1,null))[_0xe133('0x26')](function(_0x15d301){if(_0x15d301){_0x160b3d=_0x15d301;return _0x15d301[_0xe133('0x6e')](_0x328e37[_0xe133('0x4b')]['id2']);}})[_0xe133('0x26')](function(_0x54e84f){if(_0x54e84f){return db[_0xe133('0x64')][_0xe133('0x6d')]({'where':{'id':_0x328e37['params'][_0xe133('0x6f')]},'attributes':['id',_0xe133('0x2c'),_0xe133('0x6a'),_0xe133('0x65'),'createdAt'],'raw':!![]});}})['then'](function(_0x8137e6){if(_0x8137e6){fs['unlinkSync'](path[_0xe133('0x52')](_0x160b3d[_0xe133('0x51')],util[_0xe133('0x6c')]('%s.%s',_0x8137e6['name'],_0x8137e6[_0xe133('0x65')])));return _0x8137e6;}})[_0xe133('0x49')](function(_0x352265){throw new db[(_0xe133('0x61'))][(_0xe133('0x70'))](_0x352265['message']);});})[_0xe133('0x26')](handleEntityNotFound(_0x17f3a1,null))[_0xe133('0x26')](respondWithStatusCode(_0x17f3a1,0xcc))['catch'](handleError(_0x17f3a1,null));};exports['getSounds']=function(_0x37a8a9,_0x2be0f7,_0x27921a){var _0x501762={};var _0x36e584={};var _0x6a99b1;var _0x298814;return db['VoiceMusicOnHold'][_0xe133('0x6d')]({'where':{'id':_0x37a8a9[_0xe133('0x4b')]['id']}})[_0xe133('0x26')](handleEntityNotFound(_0x2be0f7,null))[_0xe133('0x26')](function(_0xb47548){if(_0xb47548){_0x6a99b1=_0xb47548;_0x36e584['model']=_['keys'](db[_0xe133('0x64')][_0xe133('0x30')]);_0x36e584[_0xe133('0x34')]=_[_0xe133('0x4c')](_0x37a8a9[_0xe133('0x34')]);_0x36e584['filters']=_[_0xe133('0x36')](_0x36e584[_0xe133('0x37')],_0x36e584[_0xe133('0x34')]);_0x501762[_0xe133('0x39')]=_[_0xe133('0x36')](_0x36e584[_0xe133('0x37')],qs[_0xe133('0x38')](_0x37a8a9[_0xe133('0x34')][_0xe133('0x38')]));_0x501762[_0xe133('0x39')]=_0x501762['attributes'][_0xe133('0x3a')]?_0x501762[_0xe133('0x39')]:_0x36e584[_0xe133('0x37')];_0x501762[_0xe133('0x3d')]=qs[_0xe133('0x3e')](_0x37a8a9[_0xe133('0x34')]['sort']);_0x501762[_0xe133('0x3f')]=qs[_0xe133('0x35')](_[_0xe133('0x40')](_0x37a8a9[_0xe133('0x34')],_0x36e584['filters']));if(_0x37a8a9[_0xe133('0x34')][_0xe133('0x42')]){_0x501762[_0xe133('0x3f')]=_['merge'](_0x501762[_0xe133('0x3f')],{'$or':_[_0xe133('0x2e')](_0x501762[_0xe133('0x39')],function(_0x256ea1){var _0x4fd7c0={};_0x4fd7c0[_0x256ea1]={'$like':'%'+_0x37a8a9[_0xe133('0x34')][_0xe133('0x42')]+'%'};return _0x4fd7c0;})});}_0x501762=_['merge']({},_0x501762,_0x37a8a9[_0xe133('0x44')]);return _0x6a99b1[_0xe133('0x71')](_0x501762);}})[_0xe133('0x26')](function(_0x22b0db){if(_0x22b0db){_0x298814=_0x22b0db[_0xe133('0x3a')];if(!_0x37a8a9['query'][_0xe133('0x3b')]('nolimit')){_0x501762['limit']=qs[_0xe133('0x1f')](_0x37a8a9[_0xe133('0x34')][_0xe133('0x1f')]);_0x501762[_0xe133('0x1e')]=qs['offset'](_0x37a8a9[_0xe133('0x34')]['offset']);}return _0x6a99b1[_0xe133('0x71')](_0x501762);}})['then'](function(_0xfb395a){if(_0xfb395a){return _0xfb395a?{'count':_0x298814,'rows':_0xfb395a}:null;}})[_0xe133('0x26')](respondWithResult(_0x2be0f7,null))[_0xe133('0x49')](handleError(_0x2be0f7,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 2d5142d..9a4e79a 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 _0x9113=['define','VoiceMusicOnHold','voice_musiconhold','util','moment','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x9113,0x12c));var _0x3911=function(_0x16b52a,_0x141ba2){_0x16b52a=_0x16b52a-0x0;var _0x5bc265=_0x9113[_0x16b52a];return _0x5bc265;};'use strict';var _=require('lodash');var util=require(_0x3911('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3911('0x1'));var BPromise=require('bluebird');var rp=require(_0x3911('0x2'));var fs=require('fs');var path=require(_0x3911('0x3'));var rimraf=require(_0x3911('0x4'));var config=require(_0x3911('0x5'));var attributes=require(_0x3911('0x6'));module[_0x3911('0x7')]=function(_0x24f987,_0x13b075){return _0x24f987[_0x3911('0x8')](_0x3911('0x9'),attributes,{'tableName':_0x3911('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x92e4=['util','../../config/logger','api','bluebird','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','lodash'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x92e4,0xa4));var _0x492e=function(_0xe67be4,_0x522f1e){_0xe67be4=_0xe67be4-0x0;var _0x4647c6=_0x92e4[_0xe67be4];return _0x4647c6;};'use strict';var _=require(_0x492e('0x0'));var util=require(_0x492e('0x1'));var logger=require(_0x492e('0x2'))(_0x492e('0x3'));var moment=require('moment');var BPromise=require(_0x492e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x492e('0x5'));var config=require(_0x492e('0x6'));var attributes=require(_0x492e('0x7'));module[_0x492e('0x8')]=function(_0x4008e6,_0x1c64ae){return _0x4008e6[_0x492e('0x9')](_0x492e('0xa'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 00a54e1..c8d399b 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(_0x2b5e4a,_0x57007e){var _0x220179=function(_0x3cb6a3){while(--_0x3cb6a3){_0x2b5e4a['push'](_0x2b5e4a['shift']());}};_0x220179(++_0x57007e);}(_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 _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(_0x73095f,_0xeae31e){var _0x2df032=function(_0x51ced9){while(--_0x51ced9){_0x73095f['push'](_0x73095f['shift']());}};_0x2df032(++_0xeae31e);}(_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 diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index b69773e..b04ec3a 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 _0x1294=['describe','show','getAgents','post','addAgents','/:id/teams','addTeams','put','/:id','update','destroy','delete','/:id/users','removeAgents','removeTeams','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe'];(function(_0x52d5b4,_0x329039){var _0x3464b5=function(_0x1ac9d8){while(--_0x1ac9d8){_0x52d5b4['push'](_0x52d5b4['shift']());}};_0x3464b5(++_0x329039);}(_0x1294,0xb8));var _0x4129=function(_0x1979d8,_0x10d8f2){_0x1979d8=_0x1979d8-0x0;var _0x1d5bb3=_0x1294[_0x1979d8];return _0x1d5bb3;};'use strict';var multer=require(_0x4129('0x0'));var util=require('util');var path=require(_0x4129('0x1'));var timeout=require('connect-timeout');var express=require(_0x4129('0x2'));var router=express[_0x4129('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4129('0x4'));var interaction=require(_0x4129('0x5'));var config=require(_0x4129('0x6'));var controller=require(_0x4129('0x7'));router[_0x4129('0x8')]('/',auth[_0x4129('0x9')](),controller[_0x4129('0xa')]);router[_0x4129('0x8')](_0x4129('0xb'),auth[_0x4129('0x9')](),controller[_0x4129('0xc')]);router[_0x4129('0x8')]('/:id',auth[_0x4129('0x9')](),controller[_0x4129('0xd')]);router[_0x4129('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x4129('0xe')]);router[_0x4129('0x8')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x4129('0xf')]('/:id/users',auth[_0x4129('0x9')](),controller[_0x4129('0x10')]);router[_0x4129('0xf')](_0x4129('0x11'),auth[_0x4129('0x9')](),controller[_0x4129('0x12')]);router[_0x4129('0x13')](_0x4129('0x14'),auth[_0x4129('0x9')](),controller[_0x4129('0x15')]);router['delete'](_0x4129('0x14'),auth['isAuthenticated'](),controller[_0x4129('0x16')]);router[_0x4129('0x17')](_0x4129('0x18'),auth[_0x4129('0x9')](),controller[_0x4129('0x19')]);router[_0x4129('0x17')](_0x4129('0x11'),auth['isAuthenticated'](),controller[_0x4129('0x1a')]);module[_0x4129('0x1b')]=router; \ No newline at end of file +var _0x572b=['./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','/:id/teams','getTeams','create','addAgents','addTeams','destroy','removeAgents','delete','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x32a503,_0x1824e0){var _0x6d71f=function(_0x36bb89){while(--_0x36bb89){_0x32a503['push'](_0x32a503['shift']());}};_0x6d71f(++_0x1824e0);}(_0x572b,0x1b2));var _0xb572=function(_0x4b12ae,_0xf2b3b){_0x4b12ae=_0x4b12ae-0x0;var _0x16957b=_0x572b[_0x4b12ae];return _0x16957b;};'use strict';var multer=require(_0xb572('0x0'));var util=require(_0xb572('0x1'));var path=require(_0xb572('0x2'));var timeout=require(_0xb572('0x3'));var express=require(_0xb572('0x4'));var router=express['Router']();var fs_extra=require(_0xb572('0x5'));var auth=require(_0xb572('0x6'));var interaction=require(_0xb572('0x7'));var config=require('../../config/environment');var controller=require(_0xb572('0x8'));router[_0xb572('0x9')]('/',auth[_0xb572('0xa')](),controller[_0xb572('0xb')]);router[_0xb572('0x9')](_0xb572('0xc'),auth[_0xb572('0xa')](),controller[_0xb572('0xd')]);router[_0xb572('0x9')](_0xb572('0xe'),auth['isAuthenticated'](),controller[_0xb572('0xf')]);router['get'](_0xb572('0x10'),auth[_0xb572('0xa')](),controller['getAgents']);router['get'](_0xb572('0x11'),auth[_0xb572('0xa')](),controller[_0xb572('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb572('0x13')]);router['post'](_0xb572('0x10'),auth[_0xb572('0xa')](),controller[_0xb572('0x14')]);router['post'](_0xb572('0x11'),auth[_0xb572('0xa')](),controller[_0xb572('0x15')]);router['put'](_0xb572('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xb572('0xe'),auth[_0xb572('0xa')](),controller[_0xb572('0x16')]);router['delete'](_0xb572('0x10'),auth[_0xb572('0xa')](),controller[_0xb572('0x17')]);router[_0xb572('0x18')]('/:id/teams',auth[_0xb572('0xa')](),controller[_0xb572('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 065a002..ebd9b34 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 _0x797a=['system-','STRING','INTEGER','sequelize','exports','name','VIRTUAL'];(function(_0x1d294e,_0x5c50e9){var _0x264294=function(_0x30871e){while(--_0x30871e){_0x1d294e['push'](_0x1d294e['shift']());}};_0x264294(++_0x5c50e9);}(_0x797a,0x6c));var _0xa797=function(_0x2b8ead,_0x2caf25){_0x2b8ead=_0x2b8ead-0x0;var _0x5e364e=_0x797a[_0x2b8ead];return _0x5e364e;};'use strict';var Sequelize=require(_0xa797('0x0'));module[_0xa797('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa797('0x2')},'prefix':{'type':Sequelize[_0xa797('0x3')],'get':function(_0xbbec44){return _0xa797('0x4')+this['getDataValue'](_0xa797('0x2'))+'-';}},'description':{'type':Sequelize[_0xa797('0x5')]},'callerIdAll':{'type':Sequelize[_0xa797('0x5')]},'VoiceExtensionId':{'type':Sequelize[_0xa797('0x6')]}}; \ No newline at end of file +var _0x672d=['VIRTUAL','getDataValue','exports','STRING'];(function(_0x19fa95,_0x1cca0a){var _0x58a835=function(_0x3e1957){while(--_0x3e1957){_0x19fa95['push'](_0x19fa95['shift']());}};_0x58a835(++_0x1cca0a);}(_0x672d,0x1e2));var _0xd672=function(_0x4ddb09,_0x1b3360){_0x4ddb09=_0x4ddb09-0x0;var _0x27b9c5=_0x672d[_0x4ddb09];return _0x27b9c5;};'use strict';var Sequelize=require('sequelize');module[_0xd672('0x0')]={'name':{'type':Sequelize[_0xd672('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xd672('0x2')],'get':function(_0x549624){return'system-'+this[_0xd672('0x3')]('name')+'-';}},'description':{'type':Sequelize[_0xd672('0x1')]},'callerIdAll':{'type':Sequelize[_0xd672('0x1')]},'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 79f8d19..2616ff6 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 _0x1775=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','VoicePrefixes','UserProfileResource','then','error','stack','name','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','params','keys','includeAll','include','describe','create','sequelize','body','VoiceExtension','find','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','description','appdata','prefix','NoOp','VoicePrefixId','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','transaction','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','User','getAgents','hasOwnProperty','nolimit','getTeams','Team','addTeams','Agents','online','voicePause','interface','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','all','union','compact','value','isEmpty','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x2d3095,_0x1d4806){var _0x48efa4=function(_0x146ac2){while(--_0x146ac2){_0x2d3095['push'](_0x2d3095['shift']());}};_0x48efa4(++_0x1d4806);}(_0x1775,0x1db));var _0x5177=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1775[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5177('0x0'));var zipdir=require(_0x5177('0x1'));var jsonpatch=require(_0x5177('0x2'));var rp=require(_0x5177('0x3'));var moment=require(_0x5177('0x4'));var BPromise=require(_0x5177('0x5'));var Mustache=require(_0x5177('0x6'));var util=require(_0x5177('0x7'));var path=require(_0x5177('0x8'));var sox=require(_0x5177('0x9'));var csv=require(_0x5177('0xa'));var ejs=require(_0x5177('0xb'));var fs=require('fs');var fs_extra=require(_0x5177('0xc'));var _=require(_0x5177('0xd'));var squel=require(_0x5177('0xe'));var crypto=require(_0x5177('0xf'));var jsforce=require(_0x5177('0x10'));var deskjs=require(_0x5177('0x11'));var toCsv=require(_0x5177('0xa'));var querystring=require(_0x5177('0x12'));var Papa=require(_0x5177('0x13'));var Redis=require(_0x5177('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5177('0x15'));var hardwareService=require(_0x5177('0x16'));var logger=require(_0x5177('0x17'))(_0x5177('0x18'));var utils=require(_0x5177('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x5177('0x1a'));var db=require(_0x5177('0x1b'))['db'];config[_0x5177('0x1c')]=_[_0x5177('0x1d')](config[_0x5177('0x1c')],{'host':_0x5177('0x1e'),'port':0x18eb});var socket=require(_0x5177('0x1f'))(new Redis(config[_0x5177('0x1c')]));require(_0x5177('0x20'))[_0x5177('0x21')](socket);function respondWithStatusCode(_0x41bef4,_0x2bf5bb){_0x2bf5bb=_0x2bf5bb||0xcc;return function(_0x29cd2c){if(_0x29cd2c){return _0x41bef4[_0x5177('0x22')](_0x2bf5bb);}return _0x41bef4[_0x5177('0x23')](_0x2bf5bb)[_0x5177('0x24')]();};}function respondWithResult(_0x2ab5e5,_0x7dba6f){_0x7dba6f=_0x7dba6f||0xc8;return function(_0xe6dcf6){if(_0xe6dcf6){return _0x2ab5e5['status'](_0x7dba6f)[_0x5177('0x25')](_0xe6dcf6);}};}function respondWithFilteredResult(_0x41e687,_0x3f5ab5){return function(_0x1b4102){if(_0x1b4102){var _0x5f5bd4=typeof _0x3f5ab5[_0x5177('0x26')]===_0x5177('0x27')&&typeof _0x3f5ab5[_0x5177('0x28')]==='undefined';var _0x86f5f8=_0x1b4102['count'];var _0xc2b2b5=_0x5f5bd4?0x0:_0x3f5ab5[_0x5177('0x26')];var _0x219744=_0x5f5bd4?_0x1b4102[_0x5177('0x29')]:_0x3f5ab5[_0x5177('0x26')]+_0x3f5ab5[_0x5177('0x28')];var _0x174c4f;if(_0x219744>=_0x86f5f8){_0x219744=_0x86f5f8;_0x174c4f=0xc8;}else{_0x174c4f=0xce;}_0x41e687[_0x5177('0x23')](_0x174c4f);return _0x41e687[_0x5177('0x2a')](_0x5177('0x2b'),_0xc2b2b5+'-'+_0x219744+'/'+_0x86f5f8)[_0x5177('0x25')](_0x1b4102);}return null;};}function patchUpdates(_0x3b0c37){return function(_0x5d9a9c){try{jsonpatch[_0x5177('0x2c')](_0x5d9a9c,_0x3b0c37,!![]);}catch(_0x556f96){return BPromise[_0x5177('0x2d')](_0x556f96);}return _0x5d9a9c[_0x5177('0x2e')]();};}function saveUpdates(_0x3b39b5,_0x2d51d0){return function(_0x4bc8e2){if(_0x4bc8e2){return _0x4bc8e2[_0x5177('0x2f')](_0x3b39b5)['then'](function(_0x564139){return _0x564139;});}return null;};}function removeEntity(_0x19a0c2,_0x15cb93){return function(_0x577bf7){if(_0x577bf7){return _0x577bf7[_0x5177('0x30')]()['then'](function(){var _0x231d35=_0x577bf7[_0x5177('0x31')]({'plain':!![]});var _0x58846c=_0x5177('0x32');return db[_0x5177('0x33')][_0x5177('0x30')]({'where':{'type':_0x58846c,'resourceId':_0x231d35['id']}})[_0x5177('0x34')](function(){return _0x577bf7;});})[_0x5177('0x34')](function(){_0x19a0c2[_0x5177('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x498fcd,_0x45cf20){return function(_0x1c660e){if(!_0x1c660e){_0x498fcd[_0x5177('0x22')](0x194);}return _0x1c660e;};}function handleError(_0x174f7a,_0x2e1985){_0x2e1985=_0x2e1985||0x1f4;return function(_0x8134f9){logger[_0x5177('0x35')](_0x8134f9[_0x5177('0x36')]);if(_0x8134f9['name']){delete _0x8134f9[_0x5177('0x37')];}_0x174f7a[_0x5177('0x23')](_0x2e1985)['send'](_0x8134f9);};}exports[_0x5177('0x38')]=function(_0x5e4c48,_0x172b36){var _0x1a2c46={},_0x1ba51c={},_0x5e2e5a={'count':0x0,'rows':[]};var _0x4f70df=_[_0x5177('0x39')](db[_0x5177('0x3a')][_0x5177('0x3b')],function(_0x3735e9){return{'name':_0x3735e9[_0x5177('0x3c')],'type':_0x3735e9[_0x5177('0x3d')][_0x5177('0x3e')]};});_0x1ba51c[_0x5177('0x3f')]=_['map'](_0x4f70df,_0x5177('0x37'));_0x1ba51c[_0x5177('0x40')]=_['keys'](_0x5e4c48[_0x5177('0x40')]);_0x1ba51c[_0x5177('0x41')]=_[_0x5177('0x42')](_0x1ba51c[_0x5177('0x3f')],_0x1ba51c[_0x5177('0x40')]);_0x1a2c46[_0x5177('0x43')]=_['intersection'](_0x1ba51c[_0x5177('0x3f')],qs[_0x5177('0x44')](_0x5e4c48[_0x5177('0x40')][_0x5177('0x44')]));_0x1a2c46[_0x5177('0x43')]=_0x1a2c46[_0x5177('0x43')][_0x5177('0x45')]?_0x1a2c46['attributes']:_0x1ba51c[_0x5177('0x3f')];if(!_0x5e4c48[_0x5177('0x40')]['hasOwnProperty']('nolimit')){_0x1a2c46[_0x5177('0x28')]=qs[_0x5177('0x28')](_0x5e4c48[_0x5177('0x40')][_0x5177('0x28')]);_0x1a2c46[_0x5177('0x26')]=qs[_0x5177('0x26')](_0x5e4c48[_0x5177('0x40')][_0x5177('0x26')]);}_0x1a2c46[_0x5177('0x46')]=qs[_0x5177('0x47')](_0x5e4c48[_0x5177('0x40')][_0x5177('0x47')]);_0x1a2c46[_0x5177('0x48')]=qs['filters'](_[_0x5177('0x49')](_0x5e4c48[_0x5177('0x40')],_0x1ba51c['filters']),_0x4f70df);if(_0x5e4c48[_0x5177('0x40')]['filter']){_0x1a2c46[_0x5177('0x48')]=_[_0x5177('0x4a')](_0x1a2c46[_0x5177('0x48')],{'$or':_['map'](_0x4f70df,function(_0x56eba4){if(_0x56eba4[_0x5177('0x3d')]!==_0x5177('0x4b')){var _0x1a149b={};_0x1a149b[_0x56eba4[_0x5177('0x37')]]={'$like':'%'+_0x5e4c48[_0x5177('0x40')][_0x5177('0x4c')]+'%'};return _0x1a149b;}})});}_0x1a2c46=_[_0x5177('0x4a')]({},_0x1a2c46,_0x5e4c48[_0x5177('0x4d')]);var _0x4e287e={'where':_0x1a2c46[_0x5177('0x48')]};return db['VoicePrefix']['count'](_0x4e287e)[_0x5177('0x34')](function(_0x17dc98){_0x5e2e5a['count']=_0x17dc98;if(_0x5e4c48[_0x5177('0x40')]['includeAll']){_0x1a2c46['include']=[{'all':!![]}];}return db[_0x5177('0x3a')][_0x5177('0x4e')](_0x1a2c46);})[_0x5177('0x34')](function(_0x3776b8){_0x5e2e5a[_0x5177('0x4f')]=_0x3776b8;return _0x5e2e5a;})[_0x5177('0x34')](respondWithFilteredResult(_0x172b36,_0x1a2c46))[_0x5177('0x50')](handleError(_0x172b36,null));};exports['show']=function(_0x5396cc,_0x12b70){var _0x511dc0={'raw':![],'where':{'id':_0x5396cc[_0x5177('0x51')]['id']}},_0x23be2a={};_0x23be2a[_0x5177('0x3f')]=_[_0x5177('0x52')](db['VoicePrefix'][_0x5177('0x3b')]);_0x23be2a[_0x5177('0x40')]=_[_0x5177('0x52')](_0x5396cc[_0x5177('0x40')]);_0x23be2a[_0x5177('0x41')]=_[_0x5177('0x42')](_0x23be2a[_0x5177('0x3f')],_0x23be2a[_0x5177('0x40')]);_0x511dc0[_0x5177('0x43')]=_[_0x5177('0x42')](_0x23be2a[_0x5177('0x3f')],qs['fields'](_0x5396cc[_0x5177('0x40')]['fields']));_0x511dc0['attributes']=_0x511dc0['attributes'][_0x5177('0x45')]?_0x511dc0[_0x5177('0x43')]:_0x23be2a['model'];if(_0x5396cc[_0x5177('0x40')][_0x5177('0x53')]){_0x511dc0[_0x5177('0x54')]=[{'all':!![]}];}_0x511dc0=_['merge']({},_0x511dc0,_0x5396cc[_0x5177('0x4d')]);return db['VoicePrefix']['find'](_0x511dc0)['then'](handleEntityNotFound(_0x12b70,null))[_0x5177('0x34')](respondWithResult(_0x12b70,null))[_0x5177('0x50')](handleError(_0x12b70,null));};exports[_0x5177('0x30')]=function(_0x5a1f8b,_0x4e53e4){return db[_0x5177('0x3a')]['find']({'where':{'id':_0x5a1f8b[_0x5177('0x51')]['id']}})[_0x5177('0x34')](handleEntityNotFound(_0x4e53e4,null))[_0x5177('0x34')](removeEntity(_0x4e53e4,null))[_0x5177('0x50')](handleError(_0x4e53e4,null));};exports[_0x5177('0x55')]=function(_0xa0edd7,_0x26bac0){return db[_0x5177('0x3a')][_0x5177('0x55')]()[_0x5177('0x34')](respondWithResult(_0x26bac0,null))[_0x5177('0x50')](handleError(_0x26bac0,null));};exports[_0x5177('0x56')]=function(_0x422d6c,_0x4c2068){var _0x59376b;return db[_0x5177('0x57')]['transaction'](function(_0x649c6f){return db['VoicePrefix'][_0x5177('0x56')](_0x422d6c[_0x5177('0x58')],{'transaction':_0x649c6f})[_0x5177('0x34')](function(_0x55a0b6){_0x59376b=_0x55a0b6['get']({'plain':!![]});return db[_0x5177('0x59')][_0x5177('0x5a')]({'where':{'id':_0x59376b[_0x5177('0x5b')]},'raw':!![]})[_0x5177('0x34')](function(_0x4a4758){return createVoicePrefixExtensions(_0x59376b,_0x4a4758,_0x649c6f);});});})['then'](function(){var _0x3f0e89=_0x422d6c[_0x5177('0x5c')][_0x5177('0x31')]({'plain':!![]});if(!_0x3f0e89)throw new Error(_0x5177('0x5d'));if(_0x3f0e89['role']===_0x5177('0x5c')){var _0x143aff=_0x59376b;return db[_0x5177('0x5e')]['find']({'where':{'name':_0x5177('0x32'),'userProfileId':_0x3f0e89[_0x5177('0x5f')]},'raw':!![]})[_0x5177('0x34')](function(_0x49e3e3){if(_0x49e3e3&&_0x49e3e3[_0x5177('0x60')]===0x0){return db['UserProfileResource'][_0x5177('0x56')]({'name':_0x143aff[_0x5177('0x37')],'resourceId':_0x143aff['id'],'type':_0x49e3e3[_0x5177('0x37')],'sectionId':_0x49e3e3['id']},{})['then'](function(){return _0x59376b;});}else{return _0x59376b;}})[_0x5177('0x50')](function(_0x161e03){logger[_0x5177('0x35')](_0x5177('0x61'),_0x161e03);throw _0x161e03;});}return _0x59376b;})[_0x5177('0x34')](respondWithResult(_0x4c2068,null))[_0x5177('0x50')](handleError(_0x4c2068,null));};function Extension(_0x37380c,_0x267599,_0x5ceed2,_0x5d96ce){this['context']=_0x5177('0x62');this[_0x5177('0x63')]=_0x37380c;this[_0x5177('0x64')]=_0x5ceed2;this[_0x5177('0x3d')]=_0x5177('0x65');this[_0x5177('0x66')]='Voice\x20Prefix\x20Extension';this['priority']=_0x267599;this[_0x5177('0x67')]=_0x5d96ce;}function createVoicePrefixExtensions(_0x23eb6e,_0x1f294e,_0x336017){return new BPromise(function(_0x123d40,_0x1b1778){var _0x2d1745=new Extension(formatPrefixName(_0x23eb6e[_0x5177('0x68')]),0x1,_0x5177('0x69'),'Voice\x20Prefix');_0x2d1745[_0x5177('0x6a')]=_0x23eb6e['id'];return db[_0x5177('0x59')]['create'](_0x2d1745,{'transaction':_0x336017})[_0x5177('0x34')](function(_0x4481b6){var _0x4edebc=_0x4481b6[_0x5177('0x31')]({'plain':!![]});var _0x2f3344=_[_0x5177('0x39')](addVoicePrefixExtensions(_0x23eb6e,_0x1f294e),function(_0x4be4b2){_0x4be4b2[_0x5177('0x5b')]=_0x4edebc['id'];_0x4be4b2[_0x5177('0x6a')]=_0x23eb6e['id'];return _0x4be4b2;});return db['VoiceExtension']['bulkCreate'](_0x2f3344,{'transaction':_0x336017})[_0x5177('0x34')](function(_0x4f76d7){if(!_0x4f76d7){return _0x1b1778(_0x5177('0x6b'));}else{return _0x123d40(_0x4f76d7);}})['catch'](function(_0x2771fa){return _0x1b1778(_0x2771fa);});});;});};function addVoicePrefixExtensions(_0x16f17c,_0x5a8ada){var _0x2af938=[];var _0x3b090d=formatPrefixName(_0x16f17c[_0x5177('0x68')]);_0x2af938[_0x5177('0x6c')](new Extension(_0x3b090d,0x2,_0x5177('0x6d'),_0x5177('0x6e')+_0x16f17c[_0x5177('0x37')]));if(_0x16f17c['callerIdAll']){_0x2af938[_0x5177('0x6c')](new Extension(_0x3b090d,0x3,'Set','PREFIX-CALLERIDALL='+_0x16f17c[_0x5177('0x6f')]));}else{_0x2af938[_0x5177('0x6c')](new Extension(_0x3b090d,0x3,'NoOp',_0x5177('0x70')));}_0x2af938[_0x5177('0x6c')](new Extension(_0x3b090d,0x4,_0x5177('0x71'),_0x5a8ada[_0x5177('0x72')]+','+_0x5177('0x73')+(0x8+_0x16f17c[_0x5177('0x37')][_0x5177('0x45')])+'}'+','+0x1));return _0x2af938;}function formatPrefixName(_0x3b26f4){var _0x478d5e='_';for(var _0x54b28f=0x0;_0x54b28f<_0x3b26f4[_0x5177('0x45')];_0x54b28f++){if(_0x3b26f4[_0x5177('0x74')](_0x54b28f)=='-'){_0x478d5e+=_0x3b26f4[_0x5177('0x74')](_0x54b28f);}else{_0x478d5e+='['+_0x3b26f4[_0x5177('0x74')](_0x54b28f)+']';}}_0x478d5e+='.';return _0x478d5e;}exports[_0x5177('0x2f')]=function(_0x3dd58f,_0x4fc289,_0x3692b2){var _0x397b75=_0x3dd58f[_0x5177('0x58')];_0x397b75[_0x5177('0x68')]='system-'+_0x397b75[_0x5177('0x37')]+'-';return db[_0x5177('0x57')][_0x5177('0x75')](function(_0x22da9d){return db[_0x5177('0x3a')]['update'](_0x397b75,{'where':{'id':_0x397b75['id']},'transaction':_0x22da9d})[_0x5177('0x34')](function(){return db['VoiceExtension'][_0x5177('0x30')]({'where':{'VoicePrefixId':_0x397b75['id']},'transaction':_0x22da9d})[_0x5177('0x34')](function(){return db['VoiceExtension'][_0x5177('0x5a')]({'where':{'id':_0x397b75[_0x5177('0x5b')]},'raw':!![]})[_0x5177('0x34')](function(_0x44ed82){return createVoicePrefixExtensions(_0x397b75,_0x44ed82,_0x22da9d);});});});})['then'](function(){return db[_0x5177('0x3a')][_0x5177('0x76')](_0x397b75['id']);})[_0x5177('0x34')](respondWithResult(_0x4fc289,null))[_0x5177('0x50')](handleError(_0x4fc289,null));};exports['addAgents']=function(_0x16b85b,_0x17456b,_0x3502dd){return db['VoicePrefix']['find']({'where':{'id':_0x16b85b[_0x5177('0x51')]['id']}})[_0x5177('0x34')](handleEntityNotFound(_0x17456b,null))[_0x5177('0x34')](function(_0x170e25){if(_0x170e25){return _0x170e25[_0x5177('0x77')](_0x16b85b[_0x5177('0x58')][_0x5177('0x78')],_[_0x5177('0x79')](_0x16b85b[_0x5177('0x58')],['ids','id'])||{})['spread'](function(_0x597a84){for(var _0x290315=0x0;_0x290315<_0x16b85b['body'][_0x5177('0x78')][_0x5177('0x45')];_0x290315+=0x1){socket[_0x5177('0x7a')](_0x5177('0x7b'),{'UserId':Number(_0x16b85b[_0x5177('0x58')]['ids'][_0x290315]),'VoicePrefixId':Number(_0x16b85b[_0x5177('0x51')]['id'])});}return _0x597a84;});}})[_0x5177('0x34')](respondWithResult(_0x17456b,null))[_0x5177('0x50')](handleError(_0x17456b,null));};exports['removeAgents']=function(_0x3d845e,_0x484762,_0x3d95df){return db[_0x5177('0x3a')]['find']({'where':{'id':_0x3d845e[_0x5177('0x51')]['id']}})[_0x5177('0x34')](handleEntityNotFound(_0x484762,null))['then'](function(_0x5f0141){if(_0x5f0141){return _0x5f0141[_0x5177('0x7c')](_0x3d845e['query'][_0x5177('0x78')])[_0x5177('0x34')](function(){if(_['isArray'](_0x3d845e[_0x5177('0x40')][_0x5177('0x78')])){for(var _0xcbbb73=0x0;_0xcbbb73<_0x3d845e[_0x5177('0x40')][_0x5177('0x78')][_0x5177('0x45')];_0xcbbb73+=0x1){socket[_0x5177('0x7a')](_0x5177('0x7d'),{'UserId':Number(_0x3d845e['query'][_0x5177('0x78')][_0xcbbb73]),'VoicePrefixId':Number(_0x3d845e['params']['id'])});}}else{socket[_0x5177('0x7a')](_0x5177('0x7d'),{'UserId':Number(_0x3d845e[_0x5177('0x40')][_0x5177('0x78')]),'VoicePrefixId':Number(_0x3d845e['params']['id'])});}});}})[_0x5177('0x34')](respondWithStatusCode(_0x484762,null))[_0x5177('0x50')](handleError(_0x484762,null));};exports['getAgents']=function(_0x17efe1,_0x30c2dc,_0x523012){var _0x33e1a6={};var _0x5f57bc={};var _0x3f1aad;var _0x558e04;return db['VoicePrefix']['findOne']({'where':{'id':_0x17efe1[_0x5177('0x51')]['id']}})[_0x5177('0x34')](handleEntityNotFound(_0x30c2dc,null))[_0x5177('0x34')](function(_0x516d0b){if(_0x516d0b){_0x3f1aad=_0x516d0b;_0x5f57bc[_0x5177('0x3f')]=_[_0x5177('0x52')](db[_0x5177('0x7e')][_0x5177('0x3b')]);_0x5f57bc[_0x5177('0x40')]=_['keys'](_0x17efe1[_0x5177('0x40')]);_0x5f57bc[_0x5177('0x41')]=_['intersection'](_0x5f57bc[_0x5177('0x3f')],_0x5f57bc['query']);_0x33e1a6[_0x5177('0x43')]=_['intersection'](_0x5f57bc[_0x5177('0x3f')],qs[_0x5177('0x44')](_0x17efe1[_0x5177('0x40')][_0x5177('0x44')]));_0x33e1a6[_0x5177('0x43')]=_0x33e1a6[_0x5177('0x43')]['length']?_0x33e1a6['attributes']:_0x5f57bc[_0x5177('0x3f')];_0x33e1a6[_0x5177('0x46')]=qs[_0x5177('0x47')](_0x17efe1['query'][_0x5177('0x47')]);_0x33e1a6[_0x5177('0x48')]=qs['filters'](_[_0x5177('0x49')](_0x17efe1['query'],_0x5f57bc[_0x5177('0x41')]));if(_0x17efe1[_0x5177('0x40')][_0x5177('0x4c')]){_0x33e1a6['where']=_[_0x5177('0x4a')](_0x33e1a6['where'],{'$or':_[_0x5177('0x39')](_0x33e1a6[_0x5177('0x43')],function(_0x5a40f1){var _0x5a8146={};_0x5a8146[_0x5a40f1]={'$like':'%'+_0x17efe1['query'][_0x5177('0x4c')]+'%'};return _0x5a8146;})});}_0x33e1a6=_['merge']({},_0x33e1a6,_0x17efe1[_0x5177('0x4d')]);return _0x3f1aad[_0x5177('0x7f')](_0x33e1a6);}})[_0x5177('0x34')](function(_0x57adf4){if(_0x57adf4){_0x558e04=_0x57adf4['length'];if(!_0x17efe1['query'][_0x5177('0x80')](_0x5177('0x81'))){_0x33e1a6[_0x5177('0x28')]=qs['limit'](_0x17efe1[_0x5177('0x40')][_0x5177('0x28')]);_0x33e1a6['offset']=qs[_0x5177('0x26')](_0x17efe1['query'][_0x5177('0x26')]);}return _0x3f1aad['getAgents'](_0x33e1a6);}})['then'](function(_0x5910a8){if(_0x5910a8){return _0x5910a8?{'count':_0x558e04,'rows':_0x5910a8}:null;}})[_0x5177('0x34')](respondWithResult(_0x30c2dc,null))['catch'](handleError(_0x30c2dc,null));};exports[_0x5177('0x82')]=function(_0x450c61,_0x1d351b,_0x1372ad){var _0x3b4cab={};var _0x197377={};var _0x580d34;var _0x1e76cf;return db[_0x5177('0x3a')]['findOne']({'where':{'id':_0x450c61[_0x5177('0x51')]['id']}})[_0x5177('0x34')](handleEntityNotFound(_0x1d351b,null))[_0x5177('0x34')](function(_0x51f7ce){if(_0x51f7ce){_0x580d34=_0x51f7ce;_0x197377['model']=_['keys'](db[_0x5177('0x83')][_0x5177('0x3b')]);_0x197377[_0x5177('0x40')]=_[_0x5177('0x52')](_0x450c61[_0x5177('0x40')]);_0x197377[_0x5177('0x41')]=_[_0x5177('0x42')](_0x197377[_0x5177('0x3f')],_0x197377[_0x5177('0x40')]);_0x3b4cab[_0x5177('0x43')]=_[_0x5177('0x42')](_0x197377[_0x5177('0x3f')],qs['fields'](_0x450c61[_0x5177('0x40')]['fields']));_0x3b4cab[_0x5177('0x43')]=_0x3b4cab[_0x5177('0x43')][_0x5177('0x45')]?_0x3b4cab['attributes']:_0x197377[_0x5177('0x3f')];_0x3b4cab[_0x5177('0x46')]=qs[_0x5177('0x47')](_0x450c61[_0x5177('0x40')][_0x5177('0x47')]);_0x3b4cab[_0x5177('0x48')]=qs[_0x5177('0x41')](_[_0x5177('0x49')](_0x450c61['query'],_0x197377['filters']));if(_0x450c61[_0x5177('0x40')]['filter']){_0x3b4cab[_0x5177('0x48')]=_[_0x5177('0x4a')](_0x3b4cab['where'],{'$or':_[_0x5177('0x39')](_0x3b4cab[_0x5177('0x43')],function(_0x54efd0){var _0x3e8a29={};_0x3e8a29[_0x54efd0]={'$like':'%'+_0x450c61[_0x5177('0x40')][_0x5177('0x4c')]+'%'};return _0x3e8a29;})});}_0x3b4cab=_[_0x5177('0x4a')]({},_0x3b4cab,_0x450c61[_0x5177('0x4d')]);return _0x580d34[_0x5177('0x82')](_0x3b4cab);}})[_0x5177('0x34')](function(_0x7a67fb){if(_0x7a67fb){_0x1e76cf=_0x7a67fb[_0x5177('0x45')];if(!_0x450c61[_0x5177('0x40')][_0x5177('0x80')](_0x5177('0x81'))){_0x3b4cab[_0x5177('0x28')]=qs['limit'](_0x450c61[_0x5177('0x40')][_0x5177('0x28')]);_0x3b4cab[_0x5177('0x26')]=qs['offset'](_0x450c61[_0x5177('0x40')][_0x5177('0x26')]);}return _0x580d34['getTeams'](_0x3b4cab);}})[_0x5177('0x34')](function(_0x5cbc48){if(_0x5cbc48){return _0x5cbc48?{'count':_0x1e76cf,'rows':_0x5cbc48}:null;}})['then'](respondWithResult(_0x1d351b,null))[_0x5177('0x50')](handleError(_0x1d351b,null));};exports[_0x5177('0x84')]=function(_0xd8f8f3,_0x40ded0,_0x356874){var _0x219a7c=_0xd8f8f3['body'][_0x5177('0x78')];var _0xcb831c;return db['Team'][_0x5177('0x4e')]({'where':{'id':_0x219a7c},'attributes':['id'],'include':[{'model':db[_0x5177('0x7e')],'as':_0x5177('0x85'),'attributes':['id',_0x5177('0x37'),_0x5177('0x86'),_0x5177('0x87'),_0x5177('0x88')],'raw':!![]}]})[_0x5177('0x34')](function(_0x4e60b2){if(_0x4e60b2){_0xcb831c=_0x4e60b2;var _0x193dbf=_['flatMap'](_0x4e60b2,function(_0xecd419){var _0x4970b3=_0xecd419[_0x5177('0x31')]({'plain':!![]});return _0x4970b3[_0x5177('0x85')];});return db[_0x5177('0x3a')][_0x5177('0x5a')]({'where':{'id':_0xd8f8f3['params']['id']}})[_0x5177('0x34')](function(_0x1b7c52){return db[_0x5177('0x57')][_0x5177('0x75')](function(_0x4e8c0c){return _0x1b7c52['addTeams'](_0x219a7c,{'transaction':_0x4e8c0c})['then'](function(){return BPromise['each'](_0xcb831c,function(_0xaafc9f){return db['TeamVoicePrefix'][_0x5177('0x89')]({'TeamId':_0xaafc9f['id'],'VoicePrefixId':_0xd8f8f3['params']['id']},{'transaction':_0x4e8c0c});});})[_0x5177('0x34')](function(){return BPromise['each'](_0x193dbf,function(_0x384af7){return db[_0x5177('0x8a')][_0x5177('0x8b')]({'where':{'UserId':_0x384af7['id'],'VoicePrefixId':_0xd8f8f3[_0x5177('0x51')]['id']},'transaction':_0x4e8c0c});});})[_0x5177('0x34')](function(){_0x193dbf[_0x5177('0x8c')](function(_0x3a9c65){socket[_0x5177('0x7a')](_0x5177('0x7b'),{'UserId':_0x3a9c65['id'],'VoicePrefixId':_0x1b7c52['id']});});});});});}})[_0x5177('0x34')](respondWithStatusCode(_0x40ded0,null))['catch'](handleError(_0x40ded0,null));};exports[_0x5177('0x8d')]=function(_0x13fa90,_0x3475c3,_0x5ed46a){return db[_0x5177('0x83')][_0x5177('0x4e')]({'where':{'id':_0x13fa90[_0x5177('0x40')][_0x5177('0x78')]},'attributes':['id'],'include':[{'model':db[_0x5177('0x7e')],'as':_0x5177('0x85'),'attributes':['id'],'raw':!![]}]})[_0x5177('0x34')](handleEntityNotFound(_0x3475c3,null))[_0x5177('0x34')](function(_0xb8f7de){var _0x1bc4cb=_[_0x5177('0x39')](_0xb8f7de,'id');var _0x4d29b7=[];var _0x1f8c26=[];var _0x365b68=squel[_0x5177('0x8e')]();_0x365b68['field'](_0x5177('0x8f'))[_0x5177('0x90')]('team_has_voice_prefixes','tq')[_0x5177('0x91')](_0x5177('0x92'),'ut',_0x5177('0x93'))['where'](_0x5177('0x94'),_0x13fa90[_0x5177('0x51')]['id']);for(var _0x3b8c79=0x0;_0x3b8c79<_0xb8f7de[_0x5177('0x45')];_0x3b8c79+=0x1){let _0x2a16ed=_0xb8f7de[_0x3b8c79];for(var _0x5d1909=0x0;_0x5d1909<_0x2a16ed['Agents'][_0x5177('0x45')];_0x5d1909+=0x1){let _0x61ead2=_0x2a16ed['Agents'][_0x5d1909];var _0x2ffb25=_0x365b68[_0x5177('0x95')]();_0x2ffb25['where'](_0x5177('0x96'),_0x61ead2['id']);_0x1f8c26[_0x5177('0x6c')](db['sequelize']['query'](_0x2ffb25[_0x5177('0x97')](),{'type':db['sequelize']['QueryTypes'][_0x5177('0x98')]})[_0x5177('0x34')](function(_0x58170f){if(_0x58170f[_0x5177('0x45')]===0x1){return _0x61ead2['id'];}else{var _0xdc5504=_[_0x5177('0x99')](_[_0x5177('0x39')](_0x58170f,_0x5177('0x9a')),function(_0x2fa026){return _['includes'](_0x1bc4cb,_0x2fa026);});if(_0xdc5504){return _0x61ead2['id'];}}}));}}return BPromise[_0x5177('0x9b')](_0x1f8c26)['then'](function(_0x55e914){_0x4d29b7=_(_0x4d29b7)[_0x5177('0x9c')](_0x55e914)[_0x5177('0x9d')]()[_0x5177('0x9e')]();return db['VoicePrefix'][_0x5177('0x5a')]({'where':{'id':_0x13fa90[_0x5177('0x51')]['id']}})[_0x5177('0x34')](function(_0x3873ca){return db[_0x5177('0x57')][_0x5177('0x75')](function(_0x10698d){return _0x3873ca[_0x5177('0x8d')](_0x13fa90[_0x5177('0x40')][_0x5177('0x78')],{'transaction':_0x10698d})[_0x5177('0x34')](function(){if(!_[_0x5177('0x9f')](_0x4d29b7)){return _0x3873ca['removeAgents'](_0x4d29b7,{'transaction':_0x10698d});}})[_0x5177('0x34')](function(){_0x4d29b7[_0x5177('0x8c')](function(_0x38f0f4){socket[_0x5177('0x7a')]('userVoicePrefix:remove',{'UserId':_0x38f0f4,'VoicePrefixId':_0x3873ca['id']});});});});});});})['then'](respondWithStatusCode(_0x3475c3,null))['catch'](handleError(_0x3475c3,null));}; \ No newline at end of file +var _0x4325=['every','TeamId','includes','union','compact','value','removeTeams','isEmpty','removeAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','undefined','limit','count','offset','apply','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','VoicePrefix','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','describe','sequelize','create','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','map','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','system-','transaction','find','findById','addAgents','ids','omit','spread','userVoicePrefix:save','userVoicePrefix:remove','emit','getAgents','getTeams','Team','addTeams','User','Agents','online','interface','each','TeamVoicePrefix','upsert','UserVoicePrefix','forEach','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT'];(function(_0x19d90b,_0x391372){var _0x181a2a=function(_0x5c307d){while(--_0x5c307d){_0x19d90b['push'](_0x19d90b['shift']());}};_0x181a2a(++_0x391372);}(_0x4325,0x1da));var _0x5432=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4325[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0x5432('0x0'));var rimraf=require(_0x5432('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5432('0x2'));var rp=require(_0x5432('0x3'));var moment=require(_0x5432('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5432('0x5'));var path=require(_0x5432('0x6'));var sox=require(_0x5432('0x7'));var csv=require('to-csv');var ejs=require(_0x5432('0x8'));var fs=require('fs');var fs_extra=require(_0x5432('0x9'));var _=require('lodash');var squel=require(_0x5432('0xa'));var crypto=require('crypto');var jsforce=require(_0x5432('0xb'));var deskjs=require(_0x5432('0xc'));var toCsv=require(_0x5432('0xd'));var querystring=require(_0x5432('0xe'));var Papa=require(_0x5432('0xf'));var Redis=require('ioredis');var authService=require(_0x5432('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5432('0x11'));var hardwareService=require(_0x5432('0x12'));var logger=require(_0x5432('0x13'))(_0x5432('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5432('0x15'));var db=require(_0x5432('0x16'))['db'];config['redis']=_[_0x5432('0x17')](config[_0x5432('0x18')],{'host':_0x5432('0x19'),'port':0x18eb});var socket=require(_0x5432('0x1a'))(new Redis(config[_0x5432('0x18')]));require(_0x5432('0x1b'))['register'](socket);function respondWithStatusCode(_0x5617ce,_0x43bb16){_0x43bb16=_0x43bb16||0xcc;return function(_0x44e70c){if(_0x44e70c){return _0x5617ce[_0x5432('0x1c')](_0x43bb16);}return _0x5617ce[_0x5432('0x1d')](_0x43bb16)[_0x5432('0x1e')]();};}function respondWithResult(_0x11db3c,_0x5e18e8){_0x5e18e8=_0x5e18e8||0xc8;return function(_0x2cf409){if(_0x2cf409){return _0x11db3c['status'](_0x5e18e8)[_0x5432('0x1f')](_0x2cf409);}};}function respondWithFilteredResult(_0x3de07a,_0x333152){return function(_0x32fe60){if(_0x32fe60){var _0x4221a8=typeof _0x333152['offset']===_0x5432('0x20')&&typeof _0x333152[_0x5432('0x21')]===_0x5432('0x20');var _0x2bfe04=_0x32fe60[_0x5432('0x22')];var _0x451de4=_0x4221a8?0x0:_0x333152[_0x5432('0x23')];var _0x5da6ea=_0x4221a8?_0x32fe60[_0x5432('0x22')]:_0x333152[_0x5432('0x23')]+_0x333152[_0x5432('0x21')];var _0xa6c864;if(_0x5da6ea>=_0x2bfe04){_0x5da6ea=_0x2bfe04;_0xa6c864=0xc8;}else{_0xa6c864=0xce;}_0x3de07a[_0x5432('0x1d')](_0xa6c864);return _0x3de07a['set']('Content-Range',_0x451de4+'-'+_0x5da6ea+'/'+_0x2bfe04)['json'](_0x32fe60);}return null;};}function patchUpdates(_0x61827e){return function(_0xb900f2){try{jsonpatch[_0x5432('0x24')](_0xb900f2,_0x61827e,!![]);}catch(_0x1f4870){return BPromise['reject'](_0x1f4870);}return _0xb900f2['save']();};}function saveUpdates(_0x3e0b66,_0x8ed74b){return function(_0x4a40fc){if(_0x4a40fc){return _0x4a40fc[_0x5432('0x25')](_0x3e0b66)[_0x5432('0x26')](function(_0x637582){return _0x637582;});}return null;};}function removeEntity(_0x4b6ea5,_0xd9928a){return function(_0xccefeb){if(_0xccefeb){return _0xccefeb[_0x5432('0x27')]()['then'](function(){var _0x4ab09d=_0xccefeb[_0x5432('0x28')]({'plain':!![]});var _0x2114b8='VoicePrefixes';return db[_0x5432('0x29')][_0x5432('0x27')]({'where':{'type':_0x2114b8,'resourceId':_0x4ab09d['id']}})[_0x5432('0x26')](function(){return _0xccefeb;});})['then'](function(){_0x4b6ea5[_0x5432('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4821be,_0x6fc7f5){return function(_0x4a52ba){if(!_0x4a52ba){_0x4821be[_0x5432('0x1c')](0x194);}return _0x4a52ba;};}function handleError(_0x578281,_0x59a866){_0x59a866=_0x59a866||0x1f4;return function(_0x465a09){logger[_0x5432('0x2a')](_0x465a09[_0x5432('0x2b')]);if(_0x465a09['name']){delete _0x465a09[_0x5432('0x2c')];}_0x578281[_0x5432('0x1d')](_0x59a866)[_0x5432('0x2d')](_0x465a09);};}exports[_0x5432('0x2e')]=function(_0x1a5612,_0x308b4c){var _0x431765={},_0x444178={},_0x34a152={'count':0x0,'rows':[]};var _0x5abaf7=_['map'](db[_0x5432('0x2f')][_0x5432('0x30')],function(_0x2ebffa){return{'name':_0x2ebffa[_0x5432('0x31')],'type':_0x2ebffa[_0x5432('0x32')]['key']};});_0x444178[_0x5432('0x33')]=_['map'](_0x5abaf7,_0x5432('0x2c'));_0x444178[_0x5432('0x34')]=_[_0x5432('0x35')](_0x1a5612[_0x5432('0x34')]);_0x444178[_0x5432('0x36')]=_[_0x5432('0x37')](_0x444178['model'],_0x444178[_0x5432('0x34')]);_0x431765[_0x5432('0x38')]=_[_0x5432('0x37')](_0x444178[_0x5432('0x33')],qs['fields'](_0x1a5612[_0x5432('0x34')][_0x5432('0x39')]));_0x431765[_0x5432('0x38')]=_0x431765[_0x5432('0x38')][_0x5432('0x3a')]?_0x431765[_0x5432('0x38')]:_0x444178[_0x5432('0x33')];if(!_0x1a5612[_0x5432('0x34')][_0x5432('0x3b')](_0x5432('0x3c'))){_0x431765[_0x5432('0x21')]=qs[_0x5432('0x21')](_0x1a5612[_0x5432('0x34')][_0x5432('0x21')]);_0x431765['offset']=qs[_0x5432('0x23')](_0x1a5612['query'][_0x5432('0x23')]);}_0x431765[_0x5432('0x3d')]=qs[_0x5432('0x3e')](_0x1a5612[_0x5432('0x34')]['sort']);_0x431765['where']=qs['filters'](_[_0x5432('0x3f')](_0x1a5612[_0x5432('0x34')],_0x444178[_0x5432('0x36')]),_0x5abaf7);if(_0x1a5612[_0x5432('0x34')]['filter']){_0x431765[_0x5432('0x40')]=_[_0x5432('0x41')](_0x431765[_0x5432('0x40')],{'$or':_['map'](_0x5abaf7,function(_0x219ddc){if(_0x219ddc[_0x5432('0x32')]!=='VIRTUAL'){var _0x3eb446={};_0x3eb446[_0x219ddc[_0x5432('0x2c')]]={'$like':'%'+_0x1a5612['query'][_0x5432('0x42')]+'%'};return _0x3eb446;}})});}_0x431765=_['merge']({},_0x431765,_0x1a5612[_0x5432('0x43')]);var _0x2d4cb0={'where':_0x431765[_0x5432('0x40')]};return db[_0x5432('0x2f')]['count'](_0x2d4cb0)[_0x5432('0x26')](function(_0x4b93b4){_0x34a152[_0x5432('0x22')]=_0x4b93b4;if(_0x1a5612[_0x5432('0x34')][_0x5432('0x44')]){_0x431765[_0x5432('0x45')]=[{'all':!![]}];}return db[_0x5432('0x2f')][_0x5432('0x46')](_0x431765);})[_0x5432('0x26')](function(_0x4ab024){_0x34a152[_0x5432('0x47')]=_0x4ab024;return _0x34a152;})[_0x5432('0x26')](respondWithFilteredResult(_0x308b4c,_0x431765))[_0x5432('0x48')](handleError(_0x308b4c,null));};exports[_0x5432('0x49')]=function(_0x24f090,_0x29a39d){var _0x2134c9={'raw':![],'where':{'id':_0x24f090[_0x5432('0x4a')]['id']}},_0x5d183a={};_0x5d183a[_0x5432('0x33')]=_[_0x5432('0x35')](db[_0x5432('0x2f')][_0x5432('0x30')]);_0x5d183a['query']=_[_0x5432('0x35')](_0x24f090['query']);_0x5d183a[_0x5432('0x36')]=_[_0x5432('0x37')](_0x5d183a['model'],_0x5d183a[_0x5432('0x34')]);_0x2134c9['attributes']=_[_0x5432('0x37')](_0x5d183a[_0x5432('0x33')],qs['fields'](_0x24f090['query'][_0x5432('0x39')]));_0x2134c9[_0x5432('0x38')]=_0x2134c9[_0x5432('0x38')][_0x5432('0x3a')]?_0x2134c9[_0x5432('0x38')]:_0x5d183a[_0x5432('0x33')];if(_0x24f090[_0x5432('0x34')]['includeAll']){_0x2134c9[_0x5432('0x45')]=[{'all':!![]}];}_0x2134c9=_[_0x5432('0x41')]({},_0x2134c9,_0x24f090[_0x5432('0x43')]);return db['VoicePrefix']['find'](_0x2134c9)['then'](handleEntityNotFound(_0x29a39d,null))['then'](respondWithResult(_0x29a39d,null))[_0x5432('0x48')](handleError(_0x29a39d,null));};exports[_0x5432('0x27')]=function(_0x21d39b,_0xaeae36){return db[_0x5432('0x2f')]['find']({'where':{'id':_0x21d39b[_0x5432('0x4a')]['id']}})[_0x5432('0x26')](handleEntityNotFound(_0xaeae36,null))[_0x5432('0x26')](removeEntity(_0xaeae36,null))['catch'](handleError(_0xaeae36,null));};exports[_0x5432('0x4b')]=function(_0x9e921,_0x2c2bce){return db[_0x5432('0x2f')][_0x5432('0x4b')]()['then'](respondWithResult(_0x2c2bce,null))[_0x5432('0x48')](handleError(_0x2c2bce,null));};exports['create']=function(_0x2fd527,_0x56090e){var _0x1f4d0c;return db[_0x5432('0x4c')]['transaction'](function(_0x7129e2){return db['VoicePrefix'][_0x5432('0x4d')](_0x2fd527[_0x5432('0x4e')],{'transaction':_0x7129e2})[_0x5432('0x26')](function(_0x7af1aa){_0x1f4d0c=_0x7af1aa['get']({'plain':!![]});return db[_0x5432('0x4f')]['find']({'where':{'id':_0x1f4d0c[_0x5432('0x50')]},'raw':!![]})['then'](function(_0x1c5c5c){return createVoicePrefixExtensions(_0x1f4d0c,_0x1c5c5c,_0x7129e2);});});})[_0x5432('0x26')](function(){var _0x37d69b=_0x2fd527[_0x5432('0x51')][_0x5432('0x28')]({'plain':!![]});if(!_0x37d69b)throw new Error(_0x5432('0x52'));if(_0x37d69b[_0x5432('0x53')]===_0x5432('0x51')){var _0x3e0259=_0x1f4d0c;return db[_0x5432('0x54')]['find']({'where':{'name':_0x5432('0x55'),'userProfileId':_0x37d69b[_0x5432('0x56')]},'raw':!![]})['then'](function(_0x324691){if(_0x324691&&_0x324691[_0x5432('0x57')]===0x0){return db[_0x5432('0x29')][_0x5432('0x4d')]({'name':_0x3e0259[_0x5432('0x2c')],'resourceId':_0x3e0259['id'],'type':_0x324691['name'],'sectionId':_0x324691['id']},{})['then'](function(){return _0x1f4d0c;});}else{return _0x1f4d0c;}})['catch'](function(_0x567f91){logger[_0x5432('0x2a')](_0x5432('0x58'),_0x567f91);throw _0x567f91;});}return _0x1f4d0c;})[_0x5432('0x26')](respondWithResult(_0x56090e,null))['catch'](handleError(_0x56090e,null));};function Extension(_0xb6f66a,_0x12768f,_0x304f4f,_0x3d39f7){this[_0x5432('0x59')]=_0x5432('0x5a');this[_0x5432('0x5b')]=_0xb6f66a;this[_0x5432('0x5c')]=_0x304f4f;this[_0x5432('0x32')]=_0x5432('0x5d');this[_0x5432('0x5e')]='Voice\x20Prefix\x20Extension';this[_0x5432('0x5f')]=_0x12768f;this[_0x5432('0x60')]=_0x3d39f7;}function createVoicePrefixExtensions(_0xa070cb,_0x46c8b4,_0x197df9){return new BPromise(function(_0x4a60e7,_0x24d570){var _0x524e2a=new Extension(formatPrefixName(_0xa070cb[_0x5432('0x61')]),0x1,_0x5432('0x62'),_0x5432('0x63'));_0x524e2a[_0x5432('0x64')]=_0xa070cb['id'];return db[_0x5432('0x4f')][_0x5432('0x4d')](_0x524e2a,{'transaction':_0x197df9})[_0x5432('0x26')](function(_0x119c47){var _0x388600=_0x119c47[_0x5432('0x28')]({'plain':!![]});var _0x131fc1=_[_0x5432('0x65')](addVoicePrefixExtensions(_0xa070cb,_0x46c8b4),function(_0x18d05c){_0x18d05c[_0x5432('0x50')]=_0x388600['id'];_0x18d05c[_0x5432('0x64')]=_0xa070cb['id'];return _0x18d05c;});return db[_0x5432('0x4f')][_0x5432('0x66')](_0x131fc1,{'transaction':_0x197df9})[_0x5432('0x26')](function(_0x521c0c){if(!_0x521c0c){return _0x24d570(_0x5432('0x67'));}else{return _0x4a60e7(_0x521c0c);}})['catch'](function(_0x1d5412){return _0x24d570(_0x1d5412);});});;});};function addVoicePrefixExtensions(_0x281684,_0x5aebe8){var _0x32fdfc=[];var _0x33d39a=formatPrefixName(_0x281684[_0x5432('0x61')]);_0x32fdfc[_0x5432('0x68')](new Extension(_0x33d39a,0x2,'Set',_0x5432('0x69')+_0x281684['name']));if(_0x281684[_0x5432('0x6a')]){_0x32fdfc[_0x5432('0x68')](new Extension(_0x33d39a,0x3,_0x5432('0x6b'),_0x5432('0x6c')+_0x281684[_0x5432('0x6a')]));}else{_0x32fdfc[_0x5432('0x68')](new Extension(_0x33d39a,0x3,'NoOp',_0x5432('0x6d')));}_0x32fdfc[_0x5432('0x68')](new Extension(_0x33d39a,0x4,'goto',_0x5aebe8['context']+','+_0x5432('0x6e')+(0x8+_0x281684['name'][_0x5432('0x3a')])+'}'+','+0x1));return _0x32fdfc;}function formatPrefixName(_0x53318b){var _0x67ff0e='_';for(var _0x5237b1=0x0;_0x5237b1<_0x53318b[_0x5432('0x3a')];_0x5237b1++){if(_0x53318b['charAt'](_0x5237b1)=='-'){_0x67ff0e+=_0x53318b['charAt'](_0x5237b1);}else{_0x67ff0e+='['+_0x53318b[_0x5432('0x6f')](_0x5237b1)+']';}}_0x67ff0e+='.';return _0x67ff0e;}exports[_0x5432('0x25')]=function(_0x22e052,_0x50b478,_0x4c3e6f){var _0x571d27=_0x22e052[_0x5432('0x4e')];_0x571d27[_0x5432('0x61')]=_0x5432('0x70')+_0x571d27['name']+'-';return db['sequelize'][_0x5432('0x71')](function(_0x433a50){return db[_0x5432('0x2f')][_0x5432('0x25')](_0x571d27,{'where':{'id':_0x571d27['id']},'transaction':_0x433a50})[_0x5432('0x26')](function(){return db[_0x5432('0x4f')][_0x5432('0x27')]({'where':{'VoicePrefixId':_0x571d27['id']},'transaction':_0x433a50})[_0x5432('0x26')](function(){return db['VoiceExtension'][_0x5432('0x72')]({'where':{'id':_0x571d27['VoiceExtensionId']},'raw':!![]})[_0x5432('0x26')](function(_0x1d9833){return createVoicePrefixExtensions(_0x571d27,_0x1d9833,_0x433a50);});});});})[_0x5432('0x26')](function(){return db[_0x5432('0x2f')][_0x5432('0x73')](_0x571d27['id']);})[_0x5432('0x26')](respondWithResult(_0x50b478,null))[_0x5432('0x48')](handleError(_0x50b478,null));};exports['addAgents']=function(_0x32a25d,_0x2b199f,_0x585a31){return db[_0x5432('0x2f')]['find']({'where':{'id':_0x32a25d[_0x5432('0x4a')]['id']}})[_0x5432('0x26')](handleEntityNotFound(_0x2b199f,null))[_0x5432('0x26')](function(_0x1da26a){if(_0x1da26a){return _0x1da26a[_0x5432('0x74')](_0x32a25d[_0x5432('0x4e')][_0x5432('0x75')],_[_0x5432('0x76')](_0x32a25d['body'],[_0x5432('0x75'),'id'])||{})[_0x5432('0x77')](function(_0x57f0c5){for(var _0xb2495d=0x0;_0xb2495d<_0x32a25d[_0x5432('0x4e')][_0x5432('0x75')][_0x5432('0x3a')];_0xb2495d+=0x1){socket['emit'](_0x5432('0x78'),{'UserId':Number(_0x32a25d[_0x5432('0x4e')][_0x5432('0x75')][_0xb2495d]),'VoicePrefixId':Number(_0x32a25d[_0x5432('0x4a')]['id'])});}return _0x57f0c5;});}})[_0x5432('0x26')](respondWithResult(_0x2b199f,null))[_0x5432('0x48')](handleError(_0x2b199f,null));};exports['removeAgents']=function(_0x48c72d,_0x5ab0ba,_0x5550ed){return db[_0x5432('0x2f')]['find']({'where':{'id':_0x48c72d[_0x5432('0x4a')]['id']}})[_0x5432('0x26')](handleEntityNotFound(_0x5ab0ba,null))['then'](function(_0x5c0af1){if(_0x5c0af1){return _0x5c0af1['removeAgents'](_0x48c72d['query'][_0x5432('0x75')])[_0x5432('0x26')](function(){if(_['isArray'](_0x48c72d[_0x5432('0x34')][_0x5432('0x75')])){for(var _0x2f7984=0x0;_0x2f7984<_0x48c72d['query'][_0x5432('0x75')][_0x5432('0x3a')];_0x2f7984+=0x1){socket['emit'](_0x5432('0x79'),{'UserId':Number(_0x48c72d['query'][_0x5432('0x75')][_0x2f7984]),'VoicePrefixId':Number(_0x48c72d[_0x5432('0x4a')]['id'])});}}else{socket[_0x5432('0x7a')](_0x5432('0x79'),{'UserId':Number(_0x48c72d[_0x5432('0x34')][_0x5432('0x75')]),'VoicePrefixId':Number(_0x48c72d['params']['id'])});}});}})[_0x5432('0x26')](respondWithStatusCode(_0x5ab0ba,null))[_0x5432('0x48')](handleError(_0x5ab0ba,null));};exports['getAgents']=function(_0x45b0bb,_0x2e4b88,_0x2dd2d8){var _0x247340={};var _0x287302={};var _0x3aad8f;var _0x4ef243;return db[_0x5432('0x2f')]['findOne']({'where':{'id':_0x45b0bb['params']['id']}})['then'](handleEntityNotFound(_0x2e4b88,null))[_0x5432('0x26')](function(_0x4e9aae){if(_0x4e9aae){_0x3aad8f=_0x4e9aae;_0x287302['model']=_[_0x5432('0x35')](db['User'][_0x5432('0x30')]);_0x287302[_0x5432('0x34')]=_[_0x5432('0x35')](_0x45b0bb[_0x5432('0x34')]);_0x287302[_0x5432('0x36')]=_[_0x5432('0x37')](_0x287302[_0x5432('0x33')],_0x287302[_0x5432('0x34')]);_0x247340[_0x5432('0x38')]=_[_0x5432('0x37')](_0x287302[_0x5432('0x33')],qs[_0x5432('0x39')](_0x45b0bb['query'][_0x5432('0x39')]));_0x247340['attributes']=_0x247340[_0x5432('0x38')][_0x5432('0x3a')]?_0x247340[_0x5432('0x38')]:_0x287302['model'];_0x247340[_0x5432('0x3d')]=qs[_0x5432('0x3e')](_0x45b0bb[_0x5432('0x34')][_0x5432('0x3e')]);_0x247340[_0x5432('0x40')]=qs['filters'](_[_0x5432('0x3f')](_0x45b0bb[_0x5432('0x34')],_0x287302[_0x5432('0x36')]));if(_0x45b0bb[_0x5432('0x34')][_0x5432('0x42')]){_0x247340[_0x5432('0x40')]=_[_0x5432('0x41')](_0x247340[_0x5432('0x40')],{'$or':_[_0x5432('0x65')](_0x247340[_0x5432('0x38')],function(_0x70a811){var _0x76baf6={};_0x76baf6[_0x70a811]={'$like':'%'+_0x45b0bb[_0x5432('0x34')][_0x5432('0x42')]+'%'};return _0x76baf6;})});}_0x247340=_['merge']({},_0x247340,_0x45b0bb[_0x5432('0x43')]);return _0x3aad8f['getAgents'](_0x247340);}})[_0x5432('0x26')](function(_0x4a1f88){if(_0x4a1f88){_0x4ef243=_0x4a1f88[_0x5432('0x3a')];if(!_0x45b0bb[_0x5432('0x34')][_0x5432('0x3b')](_0x5432('0x3c'))){_0x247340['limit']=qs[_0x5432('0x21')](_0x45b0bb[_0x5432('0x34')][_0x5432('0x21')]);_0x247340[_0x5432('0x23')]=qs[_0x5432('0x23')](_0x45b0bb[_0x5432('0x34')][_0x5432('0x23')]);}return _0x3aad8f[_0x5432('0x7b')](_0x247340);}})[_0x5432('0x26')](function(_0x57c88d){if(_0x57c88d){return _0x57c88d?{'count':_0x4ef243,'rows':_0x57c88d}:null;}})[_0x5432('0x26')](respondWithResult(_0x2e4b88,null))[_0x5432('0x48')](handleError(_0x2e4b88,null));};exports[_0x5432('0x7c')]=function(_0x123f20,_0x1452e2,_0x7d64ee){var _0x928200={};var _0x5700e0={};var _0x109c7c;var _0x258dbf;return db[_0x5432('0x2f')]['findOne']({'where':{'id':_0x123f20[_0x5432('0x4a')]['id']}})[_0x5432('0x26')](handleEntityNotFound(_0x1452e2,null))[_0x5432('0x26')](function(_0x1e5890){if(_0x1e5890){_0x109c7c=_0x1e5890;_0x5700e0[_0x5432('0x33')]=_[_0x5432('0x35')](db[_0x5432('0x7d')][_0x5432('0x30')]);_0x5700e0[_0x5432('0x34')]=_[_0x5432('0x35')](_0x123f20[_0x5432('0x34')]);_0x5700e0[_0x5432('0x36')]=_[_0x5432('0x37')](_0x5700e0['model'],_0x5700e0[_0x5432('0x34')]);_0x928200[_0x5432('0x38')]=_[_0x5432('0x37')](_0x5700e0['model'],qs[_0x5432('0x39')](_0x123f20['query'][_0x5432('0x39')]));_0x928200[_0x5432('0x38')]=_0x928200[_0x5432('0x38')]['length']?_0x928200[_0x5432('0x38')]:_0x5700e0[_0x5432('0x33')];_0x928200[_0x5432('0x3d')]=qs[_0x5432('0x3e')](_0x123f20[_0x5432('0x34')][_0x5432('0x3e')]);_0x928200['where']=qs['filters'](_[_0x5432('0x3f')](_0x123f20[_0x5432('0x34')],_0x5700e0['filters']));if(_0x123f20['query'][_0x5432('0x42')]){_0x928200['where']=_['merge'](_0x928200[_0x5432('0x40')],{'$or':_[_0x5432('0x65')](_0x928200[_0x5432('0x38')],function(_0x1eeb50){var _0xd8b0ac={};_0xd8b0ac[_0x1eeb50]={'$like':'%'+_0x123f20['query'][_0x5432('0x42')]+'%'};return _0xd8b0ac;})});}_0x928200=_[_0x5432('0x41')]({},_0x928200,_0x123f20[_0x5432('0x43')]);return _0x109c7c[_0x5432('0x7c')](_0x928200);}})[_0x5432('0x26')](function(_0x2c9bc4){if(_0x2c9bc4){_0x258dbf=_0x2c9bc4[_0x5432('0x3a')];if(!_0x123f20[_0x5432('0x34')][_0x5432('0x3b')](_0x5432('0x3c'))){_0x928200[_0x5432('0x21')]=qs[_0x5432('0x21')](_0x123f20[_0x5432('0x34')]['limit']);_0x928200[_0x5432('0x23')]=qs['offset'](_0x123f20[_0x5432('0x34')][_0x5432('0x23')]);}return _0x109c7c[_0x5432('0x7c')](_0x928200);}})[_0x5432('0x26')](function(_0x13705e){if(_0x13705e){return _0x13705e?{'count':_0x258dbf,'rows':_0x13705e}:null;}})[_0x5432('0x26')](respondWithResult(_0x1452e2,null))[_0x5432('0x48')](handleError(_0x1452e2,null));};exports[_0x5432('0x7e')]=function(_0x5705f6,_0x362987,_0x2392e0){var _0x2b788b=_0x5705f6[_0x5432('0x4e')]['ids'];var _0xa5f72b;return db[_0x5432('0x7d')][_0x5432('0x46')]({'where':{'id':_0x2b788b},'attributes':['id'],'include':[{'model':db[_0x5432('0x7f')],'as':_0x5432('0x80'),'attributes':['id',_0x5432('0x2c'),_0x5432('0x81'),'voicePause',_0x5432('0x82')],'raw':!![]}]})[_0x5432('0x26')](function(_0x5da672){if(_0x5da672){_0xa5f72b=_0x5da672;var _0x15596b=_['flatMap'](_0x5da672,function(_0x24aa72){var _0x6f1b4c=_0x24aa72[_0x5432('0x28')]({'plain':!![]});return _0x6f1b4c[_0x5432('0x80')];});return db[_0x5432('0x2f')]['find']({'where':{'id':_0x5705f6[_0x5432('0x4a')]['id']}})['then'](function(_0x57ae36){return db[_0x5432('0x4c')][_0x5432('0x71')](function(_0x4f0aa2){return _0x57ae36[_0x5432('0x7e')](_0x2b788b,{'transaction':_0x4f0aa2})[_0x5432('0x26')](function(){return BPromise[_0x5432('0x83')](_0xa5f72b,function(_0x5c7dc5){return db[_0x5432('0x84')][_0x5432('0x85')]({'TeamId':_0x5c7dc5['id'],'VoicePrefixId':_0x5705f6[_0x5432('0x4a')]['id']},{'transaction':_0x4f0aa2});});})[_0x5432('0x26')](function(){return BPromise[_0x5432('0x83')](_0x15596b,function(_0x121470){return db[_0x5432('0x86')]['findOrCreate']({'where':{'UserId':_0x121470['id'],'VoicePrefixId':_0x5705f6[_0x5432('0x4a')]['id']},'transaction':_0x4f0aa2});});})[_0x5432('0x26')](function(){_0x15596b[_0x5432('0x87')](function(_0x30a9dd){socket['emit']('userVoicePrefix:save',{'UserId':_0x30a9dd['id'],'VoicePrefixId':_0x57ae36['id']});});});});});}})['then'](respondWithStatusCode(_0x362987,null))['catch'](handleError(_0x362987,null));};exports['removeTeams']=function(_0x51c579,_0x4ee5e3,_0x554b3a){return db['Team'][_0x5432('0x46')]({'where':{'id':_0x51c579[_0x5432('0x34')]['ids']},'attributes':['id'],'include':[{'model':db[_0x5432('0x7f')],'as':_0x5432('0x80'),'attributes':['id'],'raw':!![]}]})[_0x5432('0x26')](handleEntityNotFound(_0x4ee5e3,null))[_0x5432('0x26')](function(_0x5b3282){var _0x2911cd=_[_0x5432('0x65')](_0x5b3282,'id');var _0x2e6e58=[];var _0x31411e=[];var _0x2f528d=squel['select']();_0x2f528d['field'](_0x5432('0x88'))['from']('team_has_voice_prefixes','tq')[_0x5432('0x89')](_0x5432('0x8a'),'ut',_0x5432('0x8b'))['where'](_0x5432('0x8c'),_0x51c579['params']['id']);for(var _0x7e34f=0x0;_0x7e34f<_0x5b3282[_0x5432('0x3a')];_0x7e34f+=0x1){let _0x55bafc=_0x5b3282[_0x7e34f];for(var _0x159697=0x0;_0x159697<_0x55bafc[_0x5432('0x80')][_0x5432('0x3a')];_0x159697+=0x1){let _0x3806e7=_0x55bafc['Agents'][_0x159697];var _0x1a25ad=_0x2f528d[_0x5432('0x8d')]();_0x1a25ad[_0x5432('0x40')](_0x5432('0x8e'),_0x3806e7['id']);_0x31411e[_0x5432('0x68')](db[_0x5432('0x4c')][_0x5432('0x34')](_0x1a25ad[_0x5432('0x8f')](),{'type':db[_0x5432('0x4c')][_0x5432('0x90')][_0x5432('0x91')]})['then'](function(_0x5c2521){if(_0x5c2521[_0x5432('0x3a')]===0x1){return _0x3806e7['id'];}else{var _0x4a0122=_[_0x5432('0x92')](_[_0x5432('0x65')](_0x5c2521,_0x5432('0x93')),function(_0x1d294d){return _[_0x5432('0x94')](_0x2911cd,_0x1d294d);});if(_0x4a0122){return _0x3806e7['id'];}}}));}}return BPromise['all'](_0x31411e)['then'](function(_0x5c0b87){_0x2e6e58=_(_0x2e6e58)[_0x5432('0x95')](_0x5c0b87)[_0x5432('0x96')]()[_0x5432('0x97')]();return db['VoicePrefix'][_0x5432('0x72')]({'where':{'id':_0x51c579[_0x5432('0x4a')]['id']}})[_0x5432('0x26')](function(_0x54284e){return db[_0x5432('0x4c')][_0x5432('0x71')](function(_0x20a20d){return _0x54284e[_0x5432('0x98')](_0x51c579['query']['ids'],{'transaction':_0x20a20d})[_0x5432('0x26')](function(){if(!_[_0x5432('0x99')](_0x2e6e58)){return _0x54284e[_0x5432('0x9a')](_0x2e6e58,{'transaction':_0x20a20d});}})[_0x5432('0x26')](function(){_0x2e6e58['forEach'](function(_0xbdbc76){socket[_0x5432('0x7a')](_0x5432('0x79'),{'UserId':_0xbdbc76,'VoicePrefixId':_0x54284e['id']});});});});});});})['then'](respondWithStatusCode(_0x4ee5e3,null))[_0x5432('0x48')](handleError(_0x4ee5e3,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 64cef51..9c4a4e8 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 _0x829d=['remove','emit','hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0x2a2069,_0xb5f258){var _0x4b8f9a=function(_0x106595){while(--_0x106595){_0x2a2069['push'](_0x2a2069['shift']());}};_0x4b8f9a(++_0xb5f258);}(_0x829d,0x1e4));var _0xd829=function(_0x596def,_0x432257){_0x596def=_0x596def-0x0;var _0x3e382c=_0x829d[_0x596def];return _0x3e382c;};'use strict';var EventEmitter=require(_0xd829('0x0'));var VoicePrefix=require(_0xd829('0x1'))['db'][_0xd829('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xd829('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd829('0x4')};function emitEvent(_0x240f25){return function(_0x347c0f,_0x38f261,_0x4f1fa7){VoicePrefixEvents['emit'](_0x240f25+':'+_0x347c0f['id'],_0x347c0f);VoicePrefixEvents[_0xd829('0x5')](_0x240f25,_0x347c0f);_0x4f1fa7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0xd829('0x6')](e,emitEvent(event));}}module[_0xd829('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0x9795=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','remove'];(function(_0xd8a8af,_0x1e93f0){var _0x5b7278=function(_0x458800){while(--_0x458800){_0xd8a8af['push'](_0xd8a8af['shift']());}};_0x5b7278(++_0x1e93f0);}(_0x9795,0x175));var _0x5979=function(_0x18443e,_0x4156e7){_0x18443e=_0x18443e-0x0;var _0x5b45e6=_0x9795[_0x18443e];return _0x5b45e6;};'use strict';var EventEmitter=require(_0x5979('0x0'));var VoicePrefix=require(_0x5979('0x1'))['db'][_0x5979('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x5979('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5979('0x4')};function emitEvent(_0x24e7db){return function(_0x5e4b2a,_0x8ed5e6,_0x158378){VoicePrefixEvents[_0x5979('0x5')](_0x24e7db+':'+_0x5e4b2a['id'],_0x5e4b2a);VoicePrefixEvents[_0x5979('0x5')](_0x24e7db,_0x5e4b2a);_0x158378(null);};}for(var e in events){if(events[_0x5979('0x6')](e)){var event=events[e];VoicePrefix[_0x5979('0x7')](e,emitEvent(event));}}module[_0x5979('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 14dfe75..ea72977 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 _0xe809=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','voice_prefixes','lodash','util'];(function(_0xd942c6,_0x57e645){var _0x430f21=function(_0x34a8c4){while(--_0x34a8c4){_0xd942c6['push'](_0xd942c6['shift']());}};_0x430f21(++_0x57e645);}(_0xe809,0xca));var _0x9e80=function(_0x2a43a0,_0xace59f){_0x2a43a0=_0x2a43a0-0x0;var _0x2b4877=_0xe809[_0x2a43a0];return _0x2b4877;};'use strict';var _=require(_0x9e80('0x0'));var util=require(_0x9e80('0x1'));var logger=require(_0x9e80('0x2'))(_0x9e80('0x3'));var moment=require(_0x9e80('0x4'));var BPromise=require(_0x9e80('0x5'));var rp=require(_0x9e80('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9e80('0x7'));var config=require(_0x9e80('0x8'));var attributes=require('./voicePrefix.attributes');module[_0x9e80('0x9')]=function(_0x574994,_0x9e9fa2){return _0x574994[_0x9e80('0xa')]('VoicePrefix',attributes,{'tableName':_0x9e80('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a27=['request-promise','path','rimraf','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','bluebird'];(function(_0x1e5b4a,_0xcd95cd){var _0x5bf5b1=function(_0x15f343){while(--_0x15f343){_0x1e5b4a['push'](_0x1e5b4a['shift']());}};_0x5bf5b1(++_0xcd95cd);}(_0x5a27,0x195));var _0x75a2=function(_0x59d835,_0x3daf60){_0x59d835=_0x59d835-0x0;var _0x2c7cad=_0x5a27[_0x59d835];return _0x2c7cad;};'use strict';var _=require(_0x75a2('0x0'));var util=require(_0x75a2('0x1'));var logger=require(_0x75a2('0x2'))(_0x75a2('0x3'));var moment=require('moment');var BPromise=require(_0x75a2('0x4'));var rp=require(_0x75a2('0x5'));var fs=require('fs');var path=require(_0x75a2('0x6'));var rimraf=require(_0x75a2('0x7'));var config=require('../../config/environment');var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x507e13,_0x2bb2cd){return _0x507e13['define'](_0x75a2('0x8'),attributes,{'tableName':_0x75a2('0x9'),'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 77b02f0..cebd7b1 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 _0x672a=['then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request'];(function(_0x56cdff,_0x33eab2){var _0x93c557=function(_0x20f590){while(--_0x20f590){_0x56cdff['push'](_0x56cdff['shift']());}};_0x93c557(++_0x33eab2);}(_0x672a,0x122));var _0xa672=function(_0x1c9ffa,_0x4fd275){_0x1c9ffa=_0x1c9ffa-0x0;var _0xd94b95=_0x672a[_0x1c9ffa];return _0xd94b95;};'use strict';var _=require(_0xa672('0x0'));var util=require(_0xa672('0x1'));var moment=require(_0xa672('0x2'));var BPromise=require(_0xa672('0x3'));var rs=require(_0xa672('0x4'));var fs=require('fs');var Redis=require(_0xa672('0x5'));var db=require(_0xa672('0x6'))['db'];var utils=require(_0xa672('0x7'));var logger=require(_0xa672('0x8'))(_0xa672('0x9'));var config=require(_0xa672('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xa672('0xb')][_0xa672('0xc')]({'port':0x232a});config[_0xa672('0xd')]=_[_0xa672('0xe')](config[_0xa672('0xd')],{'host':_0xa672('0xf'),'port':0x18eb});var socket=require(_0xa672('0x10'))(new Redis(config[_0xa672('0xd')]));require(_0xa672('0x11'))[_0xa672('0x12')](socket);function respondWithRpcPromise(_0x215c43,_0x2f2b63,_0x2c1de6){return new BPromise(function(_0x351025,_0x5ae63c){return client[_0xa672('0x13')](_0x215c43,_0x2c1de6)[_0xa672('0x14')](function(_0x59fd41){logger[_0xa672('0x15')](_0xa672('0x16'),_0x2f2b63,_0xa672('0x17'));logger[_0xa672('0x18')](_0xa672('0x19'),_0x2f2b63,_0xa672('0x17'),JSON[_0xa672('0x1a')](_0x59fd41));if(_0x59fd41[_0xa672('0x1b')]){if(_0x59fd41[_0xa672('0x1b')]['code']===0x1f4){logger[_0xa672('0x1b')](_0xa672('0x16'),_0x2f2b63,_0x59fd41['error']['message']);return _0x5ae63c(_0x59fd41[_0xa672('0x1b')]['message']);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x2f2b63,_0x59fd41[_0xa672('0x1b')]['message']);return _0x351025(_0x59fd41['error'][_0xa672('0x1c')]);}else{logger[_0xa672('0x15')](_0xa672('0x16'),_0x2f2b63,_0xa672('0x17'));_0x351025(_0x59fd41[_0xa672('0x1d')][_0xa672('0x1c')]);}})[_0xa672('0x1e')](function(_0x21817d){logger[_0xa672('0x1b')](_0xa672('0x16'),_0x2f2b63,_0x21817d);_0x5ae63c(_0x21817d);});});} \ No newline at end of file +var _0xbb61=['code','VoicePrefix,\x20%s,\x20%s','message','info','request\x20sent','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','then','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb61,0x131));var _0x1bb6=function(_0x4ed4d2,_0x47acf7){_0x4ed4d2=_0x4ed4d2-0x0;var _0x15ae2e=_0xbb61[_0x4ed4d2];return _0x15ae2e;};'use strict';var _=require(_0x1bb6('0x0'));var util=require('util');var moment=require(_0x1bb6('0x1'));var BPromise=require(_0x1bb6('0x2'));var rs=require(_0x1bb6('0x3'));var fs=require('fs');var Redis=require(_0x1bb6('0x4'));var db=require(_0x1bb6('0x5'))['db'];var utils=require(_0x1bb6('0x6'));var logger=require(_0x1bb6('0x7'))('rpc');var config=require(_0x1bb6('0x8'));var jayson=require(_0x1bb6('0x9'));var client=jayson[_0x1bb6('0xa')]['http']({'port':0x232a});config[_0x1bb6('0xb')]=_[_0x1bb6('0xc')](config[_0x1bb6('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1bb6('0xd'))(new Redis(config[_0x1bb6('0xb')]));require(_0x1bb6('0xe'))[_0x1bb6('0xf')](socket);function respondWithRpcPromise(_0x1a18bf,_0x359a49,_0x5c8d00){return new BPromise(function(_0xe24210,_0x29ee41){return client['request'](_0x1a18bf,_0x5c8d00)[_0x1bb6('0x10')](function(_0x5988f4){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x359a49,'request\x20sent');logger[_0x1bb6('0x11')](_0x1bb6('0x12'),_0x359a49,'request\x20sent',JSON['stringify'](_0x5988f4));if(_0x5988f4[_0x1bb6('0x13')]){if(_0x5988f4[_0x1bb6('0x13')][_0x1bb6('0x14')]===0x1f4){logger[_0x1bb6('0x13')](_0x1bb6('0x15'),_0x359a49,_0x5988f4[_0x1bb6('0x13')][_0x1bb6('0x16')]);return _0x29ee41(_0x5988f4[_0x1bb6('0x13')]['message']);}logger[_0x1bb6('0x13')](_0x1bb6('0x15'),_0x359a49,_0x5988f4[_0x1bb6('0x13')][_0x1bb6('0x16')]);return _0xe24210(_0x5988f4[_0x1bb6('0x13')]['message']);}else{logger[_0x1bb6('0x17')](_0x1bb6('0x15'),_0x359a49,_0x1bb6('0x18'));_0xe24210(_0x5988f4['result'][_0x1bb6('0x16')]);}})['catch'](function(_0x203f2b){logger['error'](_0x1bb6('0x15'),_0x359a49,_0x203f2b);_0x29ee41(_0x203f2b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 9fc7ae8..c4b8e03 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 _0x41bb=['save','update','emit','removeListener','register','./voicePrefix.events'];(function(_0x3149a9,_0x471df5){var _0x3b63b3=function(_0x240756){while(--_0x240756){_0x3149a9['push'](_0x3149a9['shift']());}};_0x3b63b3(++_0x471df5);}(_0x41bb,0xc5));var _0xb41b=function(_0x430b47,_0x4c0b51){_0x430b47=_0x430b47-0x0;var _0xdc5277=_0x41bb[_0x430b47];return _0xdc5277;};'use strict';var VoicePrefixEvents=require(_0xb41b('0x0'));var events=[_0xb41b('0x1'),'remove',_0xb41b('0x2')];function createListener(_0x4d5578,_0x30ea75){return function(_0x1c9d36){_0x30ea75[_0xb41b('0x3')](_0x4d5578,_0x1c9d36);};}function removeListener(_0x448c8e,_0x4ee21b){return function(){VoicePrefixEvents[_0xb41b('0x4')](_0x448c8e,_0x4ee21b);};}exports[_0xb41b('0x5')]=function(_0x2dbaa3){for(var _0x50bc62=0x0,_0x5455ce=events['length'];_0x50bc62<_0x5455ce;_0x50bc62++){var _0x2704f0=events[_0x50bc62];var _0x29c30d=createListener('voicePrefix:'+_0x2704f0,_0x2dbaa3);VoicePrefixEvents['on'](_0x2704f0,_0x29c30d);}}; \ No newline at end of file +var _0xd8cc=['removeListener','length','voicePrefix:','./voicePrefix.events','save','emit'];(function(_0x2fad37,_0x357ddc){var _0x4a1997=function(_0x117932){while(--_0x117932){_0x2fad37['push'](_0x2fad37['shift']());}};_0x4a1997(++_0x357ddc);}(_0xd8cc,0xc9));var _0xcd8c=function(_0x319e2e,_0x2f727f){_0x319e2e=_0x319e2e-0x0;var _0x302524=_0xd8cc[_0x319e2e];return _0x302524;};'use strict';var VoicePrefixEvents=require(_0xcd8c('0x0'));var events=[_0xcd8c('0x1'),'remove','update'];function createListener(_0x1576d8,_0x7f40a7){return function(_0x1a1e1e){_0x7f40a7[_0xcd8c('0x2')](_0x1576d8,_0x1a1e1e);};}function removeListener(_0x58d2c9,_0x2dad29){return function(){VoicePrefixEvents[_0xcd8c('0x3')](_0x58d2c9,_0x2dad29);};}exports['register']=function(_0x5776fc){for(var _0x233d52=0x0,_0x55c4ed=events[_0xcd8c('0x4')];_0x233d52<_0x55c4ed;_0x233d52++){var _0x5814b4=events[_0x233d52];var _0x4740bf=createListener(_0xcd8c('0x5')+_0x5814b4,_0x5776fc);VoicePrefixEvents['on'](_0x5814b4,_0x4740bf);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index bb9bdb7..fa03d7a 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x1bf4bb,_0x435c71){var _0xf6c59a=function(_0x1baf3c){while(--_0x1baf3c){_0x1bf4bb['push'](_0x1bf4bb['shift']());}};_0xf6c59a(++_0x435c71);}(_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['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xb10b,0x12a));var _0xbb10=function(_0x12ca5f,_0x223d98){_0x12ca5f=_0x12ca5f-0x0;var _0xfc3ae9=_0xb10b[_0x12ca5f];return _0xfc3ae9;};'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 e1fe59b..c4d46bf 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 _0xef24=['07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\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)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','exports','STRING','ENUM','outbound','default','ringall','leastrecent','rrmemory','wrandom','setDataValue','strategy','getDataValue','dialMethod','preview','roundrobin','includes','INTEGER','yes','once','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','progressive','power','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','UNSIGNED','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'];(function(_0x3f01b8,_0x44115b){var _0x27377e=function(_0x2969b3){while(--_0x2969b3){_0x3f01b8['push'](_0x3f01b8['shift']());}};_0x27377e(++_0x44115b);}(_0xef24,0x18d));var _0x4ef2=function(_0x32d7c4,_0x25cb15){_0x32d7c4=_0x32d7c4-0x0;var _0x48b422=_0xef24[_0x32d7c4];return _0x48b422;};'use strict';var Sequelize=require(_0x4ef2('0x0'));module[_0x4ef2('0x1')]={'name':{'type':Sequelize[_0x4ef2('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x4ef2('0x3')]('inbound',_0x4ef2('0x4')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x4ef2('0x2')],'defaultValue':_0x4ef2('0x5')},'announce':{'type':Sequelize[_0x4ef2('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x4ef2('0x3')]('rr',_0x4ef2('0x6'),_0x4ef2('0x7'),'fewestcalls','random',_0x4ef2('0x8'),'linear',_0x4ef2('0x9'),'rrordered'),'allowNull':![],'defaultValue':_0x4ef2('0x6'),'set':function(_0x4309d7){this[_0x4ef2('0xa')](_0x4ef2('0xb'),_0x4309d7?_0x4309d7:_0x4ef2('0x8'));},'get':function(){var _0x21e855=this[_0x4ef2('0xc')]('type');var _0x259045=this[_0x4ef2('0xc')](_0x4ef2('0xd'));var _0x45098e=this[_0x4ef2('0xc')](_0x4ef2('0xb'));if(_0x21e855===_0x4ef2('0x4')){if(_0x259045===_0x4ef2('0xe')){return null;}if(_0x259045==='booked'&&![_0x4ef2('0x8'),_0x4ef2('0xf')][_0x4ef2('0x10')](_0x45098e)){this[_0x4ef2('0xa')]('strategy',_0x4ef2('0x8'));}}return _0x45098e;}},'servicelevel':{'type':Sequelize[_0x4ef2('0x11')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x4ef2('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x4ef2('0x11')](0xb)},'timeout':{'type':Sequelize[_0x4ef2('0x11')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x4ef2('0x11')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x4ef2('0x11')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x4ef2('0x11')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x4ef2('0x3')](_0x4ef2('0x12'),'no'),'defaultValue':_0x4ef2('0x12')},'autopause':{'type':Sequelize[_0x4ef2('0x3')](_0x4ef2('0x12'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x4ef2('0x11')](0xb)},'autopausebusy':{'type':Sequelize[_0x4ef2('0x3')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x4ef2('0x12'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x4ef2('0x11')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x4ef2('0x3')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x4ef2('0x3')](_0x4ef2('0x12'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x4ef2('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x4ef2('0x3')](_0x4ef2('0x12'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x4ef2('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x4ef2('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x4ef2('0x11')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x4ef2('0x11')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x4ef2('0x11')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x4ef2('0x3')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x4ef2('0x3')](_0x4ef2('0x12'),'no'),'defaultValue':_0x4ef2('0x12')},'announce_holdtime':{'type':Sequelize['ENUM']('yes','no',_0x4ef2('0x13')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x4ef2('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x4ef2('0x12'),'no')},'announce_position_limit':{'type':Sequelize[_0x4ef2('0x11')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x4ef2('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x4ef2('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x4ef2('0x2')]},'queue_youarenext':{'type':Sequelize[_0x4ef2('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x4ef2('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x4ef2('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x4ef2('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x4ef2('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x4ef2('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x4ef2('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x4ef2('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x4ef2('0x2')]},'queue_quantity1':{'type':Sequelize[_0x4ef2('0x2')]},'queue_quantity2':{'type':Sequelize[_0x4ef2('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x4ef2('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x318298){this[_0x4ef2('0xa')]('periodic_announce',_0x318298?_0x318298[_0x4ef2('0x14')](','):[]);},'get':function(){return this['getDataValue'](_0x4ef2('0x15'))?this[_0x4ef2('0xc')](_0x4ef2('0x15'))[_0x4ef2('0x16')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x4ef2('0x12'),'set':function(_0x4be1bf){this[_0x4ef2('0xa')](_0x4ef2('0x17'),_0x4be1bf?_0x4be1bf[_0x4ef2('0x14')](','):undefined);},'get':function(){return this['getDataValue'](_0x4ef2('0x17'))?this[_0x4ef2('0xc')](_0x4ef2('0x17'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x4ef2('0x2')],'defaultValue':'no','set':function(_0x56c3f0){this[_0x4ef2('0xa')](_0x4ef2('0x18'),_0x56c3f0?_0x56c3f0['join'](','):undefined);},'get':function(){return this[_0x4ef2('0xc')](_0x4ef2('0x18'))?this[_0x4ef2('0xc')](_0x4ef2('0x18'))[_0x4ef2('0x16')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x4ef2('0x3')](_0x4ef2('0x12'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x4ef2('0x3')](_0x4ef2('0x12'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x4ef2('0x11')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x4ef2('0x3')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x4ef2('0x2')]},'description':{'type':Sequelize[_0x4ef2('0x2')]},'acw':{'type':Sequelize[_0x4ef2('0x19')],'defaultValue':0x0,'set':function(_0x3c82a6){this[_0x4ef2('0xa')]('acw',_0x3c82a6);if(_0x3c82a6){if(this['getDataValue'](_0x4ef2('0x1a'))<0x2){this['setDataValue'](_0x4ef2('0x1a'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x4ef2('0x3')](_0x4ef2('0xe'),_0x4ef2('0x1b'),_0x4ef2('0x1c'),'predictive','booked'),'defaultValue':_0x4ef2('0x1b'),'comment':_0x4ef2('0x1d')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x4ef2('0x1e')},'dialLimitQueue':{'type':Sequelize[_0x4ef2('0x11')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x4ef2('0x1f')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x4ef2('0x20')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x4ef2('0x21')},'dialPredictiveOptimization':{'type':Sequelize[_0x4ef2('0x3')](_0x4ef2('0x22'),_0x4ef2('0x23')),'defaultValue':_0x4ef2('0x23'),'comment':_0x4ef2('0x24')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x4ef2('0x25')](0x2)[_0x4ef2('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x4ef2('0x26')},'dialPredictiveInterval':{'type':Sequelize[_0x4ef2('0x11')](0x3)[_0x4ef2('0x20')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x4ef2('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x4ef2('0x11')](0x3)[_0x4ef2('0x20')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x4ef2('0x2')],'defaultValue':_0x4ef2('0x27'),'comment':_0x4ef2('0x28')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x4ef2('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ef2('0x29')},'dialQueueProject':{'type':Sequelize[_0x4ef2('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x4ef2('0x11')](0x3)[_0x4ef2('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x4ef2('0x11')](0x5)[_0x4ef2('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4ef2('0x2a')},'dialBusyMaxRetry':{'type':Sequelize[_0x4ef2('0x11')](0x3)[_0x4ef2('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ef2('0x2b')},'dialBusyRetryFrequency':{'type':Sequelize[_0x4ef2('0x11')](0x5)[_0x4ef2('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4ef2('0x2c')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x4ef2('0x11')](0x3)[_0x4ef2('0x20')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x4ef2('0x11')](0x5)[_0x4ef2('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4ef2('0x2d')},'dialGlobalMaxRetry':{'type':Sequelize[_0x4ef2('0x11')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x4ef2('0x2e')},'dialTimezone':{'type':Sequelize[_0x4ef2('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x4ef2('0x2')],'defaultValue':_0x4ef2('0x2f')},'dialPrefix':{'type':Sequelize[_0x4ef2('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x4ef2('0x30'),_0x4ef2('0x31'),_0x4ef2('0x32')),'defaultValue':_0x4ef2('0x30')},'dialAMDActive':{'type':Sequelize[_0x4ef2('0x19')],'defaultValue':0x0,'comment':_0x4ef2('0x33')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x4ef2('0x11')](0x9)[_0x4ef2('0x20')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x4ef2('0x34')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x4ef2('0x11')](0x9)[_0x4ef2('0x20')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x4ef2('0x35')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x4ef2('0x11')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4ef2('0x36')},'dialAMDMinWordLength':{'type':Sequelize[_0x4ef2('0x11')](0x9)[_0x4ef2('0x20')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x4ef2('0x37')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x4ef2('0x20')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x4ef2('0x38')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x4ef2('0x11')](0x9)[_0x4ef2('0x20')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x4ef2('0x11')](0x5)[_0x4ef2('0x20')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x4ef2('0x39')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x4ef2('0x11')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4ef2('0x3a')},'dialRecallMeTimeout':{'type':Sequelize[_0x4ef2('0x11')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x4ef2('0x3b')},'dialRecallInQueue':{'type':Sequelize[_0x4ef2('0x19')],'defaultValue':0x0,'comment':_0x4ef2('0x3c')},'dialOrderByScheduledAt':{'type':Sequelize[_0x4ef2('0x3')](_0x4ef2('0x3d'),_0x4ef2('0x3e')),'defaultValue':_0x4ef2('0x3d')},'dialQueueProject2':{'type':Sequelize[_0x4ef2('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x4ef2('0x19')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x4ef2('0x19')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x4ef2('0x11')](0x3)[_0x4ef2('0x20')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4ef2('0x3f')},'dialCutDigit':{'type':Sequelize[_0x4ef2('0x11')](0x3)[_0x4ef2('0x20')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4ef2('0x40')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x4ef2('0x11')](0x3)[_0x4ef2('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ef2('0x41')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x4ef2('0x11')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4ef2('0x42')},'dialDropMaxRetry':{'type':Sequelize[_0x4ef2('0x11')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ef2('0x43')},'dialDropRetryFrequency':{'type':Sequelize[_0x4ef2('0x11')](0x5)[_0x4ef2('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4ef2('0x44')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x4ef2('0x11')](0x3)[_0x4ef2('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x4ef2('0x11')](0x5)[_0x4ef2('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x4ef2('0x11')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ef2('0x45')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4ef2('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x4ef2('0x11')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ef2('0x46')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4ef2('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4ef2('0x47')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4ef2('0x11')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x4ef2('0x19')],'defaultValue':![],'comment':_0x4ef2('0x48'),'set':function(_0x5a4c05){if(!_0x5a4c05)this[_0x4ef2('0xa')](_0x4ef2('0x49'),null);this[_0x4ef2('0xa')]('mandatoryDisposition',_0x5a4c05);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x4ef2('0x11')](0x3)[_0x4ef2('0x20')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x4ef2('0x11')](0x3)[_0x4ef2('0x20')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x4ef2('0x11')](0x3)[_0x4ef2('0x20')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x4ef2('0x19')],'defaultValue':![]}}; \ No newline at end of file +var _0x3bdf=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','ENUM','inbound','STRING','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','getDataValue','type','outbound','preview','roundrobin','includes','setDataValue','strategy','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','progressive','power','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x346e4a,_0x30672d){var _0x2278c0=function(_0x346c12){while(--_0x346c12){_0x346e4a['push'](_0x346e4a['shift']());}};_0x2278c0(++_0x30672d);}(_0x3bdf,0x197));var _0xf3bd=function(_0x3cbf58,_0xdd616e){_0x3cbf58=_0x3cbf58-0x0;var _0x3a5e58=_0x3bdf[_0x3cbf58];return _0x3a5e58;};'use strict';var Sequelize=require(_0xf3bd('0x0'));module[_0xf3bd('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf3bd('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xf3bd('0x3')](_0xf3bd('0x4'),'outbound'),'allowNull':![],'defaultValue':_0xf3bd('0x4')},'musiconhold':{'type':Sequelize[_0xf3bd('0x5')],'defaultValue':'default'},'announce':{'type':Sequelize[_0xf3bd('0x5')],'defaultValue':''},'strategy':{'type':Sequelize[_0xf3bd('0x3')]('rr',_0xf3bd('0x6'),_0xf3bd('0x7'),_0xf3bd('0x8'),_0xf3bd('0x9'),_0xf3bd('0xa'),_0xf3bd('0xb'),_0xf3bd('0xc'),_0xf3bd('0xd')),'allowNull':![],'defaultValue':'ringall','set':function(_0x1908e6){this['setDataValue']('strategy',_0x1908e6?_0x1908e6:'rrmemory');},'get':function(){var _0xcd2056=this[_0xf3bd('0xe')](_0xf3bd('0xf'));var _0x841947=this['getDataValue']('dialMethod');var _0x35d998=this[_0xf3bd('0xe')]('strategy');if(_0xcd2056===_0xf3bd('0x10')){if(_0x841947===_0xf3bd('0x11')){return null;}if(_0x841947==='booked'&&!['rrmemory',_0xf3bd('0x12')][_0xf3bd('0x13')](_0x35d998)){this[_0xf3bd('0x14')](_0xf3bd('0x15'),_0xf3bd('0xa'));}}return _0x35d998;}},'servicelevel':{'type':Sequelize[_0xf3bd('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xf3bd('0x16')](0xb)},'timeout':{'type':Sequelize[_0xf3bd('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xf3bd('0x5')]},'weight':{'type':Sequelize[_0xf3bd('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xf3bd('0x3')](_0xf3bd('0x17'),'no'),'defaultValue':_0xf3bd('0x17')},'autopause':{'type':Sequelize[_0xf3bd('0x3')](_0xf3bd('0x17'),'no',_0xf3bd('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0xf3bd('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xf3bd('0x3')](_0xf3bd('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xf3bd('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xf3bd('0x3')](_0xf3bd('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xf3bd('0x3')](_0xf3bd('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xf3bd('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xf3bd('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xf3bd('0x5')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xf3bd('0x5')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xf3bd('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xf3bd('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xf3bd('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xf3bd('0x3')](_0xf3bd('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0xf3bd('0x17'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0xf3bd('0x3')](_0xf3bd('0x17'),'no',_0xf3bd('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xf3bd('0x5')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize[_0xf3bd('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xf3bd('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xf3bd('0x5')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xf3bd('0x5')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xf3bd('0x5')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xf3bd('0x5')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xf3bd('0x5')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xf3bd('0x5')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xf3bd('0x5')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xf3bd('0x5')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xf3bd('0x5')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xf3bd('0x5')]},'queue_periodic_announce':{'type':Sequelize[_0xf3bd('0x5')]},'queue_less_than':{'type':Sequelize[_0xf3bd('0x5')]},'periodic_announce':{'type':Sequelize[_0xf3bd('0x1a')],'set':function(_0x4a21b1){this['setDataValue'](_0xf3bd('0x1b'),_0x4a21b1?_0x4a21b1[_0xf3bd('0x1c')](','):[]);},'get':function(){return this['getDataValue']('periodic_announce')?this[_0xf3bd('0xe')](_0xf3bd('0x1b'))[_0xf3bd('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0xf3bd('0x5')],'defaultValue':'yes','set':function(_0x1a5c87){this[_0xf3bd('0x14')](_0xf3bd('0x1e'),_0x1a5c87?_0x1a5c87[_0xf3bd('0x1c')](','):undefined);},'get':function(){return this[_0xf3bd('0xe')](_0xf3bd('0x1e'))?this[_0xf3bd('0xe')](_0xf3bd('0x1e'))[_0xf3bd('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xf3bd('0x5')],'defaultValue':'no','set':function(_0x4351b9){this[_0xf3bd('0x14')](_0xf3bd('0x1f'),_0x4351b9?_0x4351b9['join'](','):undefined);},'get':function(){return this[_0xf3bd('0xe')](_0xf3bd('0x1f'))?this[_0xf3bd('0xe')](_0xf3bd('0x1f'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xf3bd('0x3')](_0xf3bd('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0xf3bd('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xf3bd('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0xf3bd('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xf3bd('0x5')]},'description':{'type':Sequelize[_0xf3bd('0x5')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x1b9eb7){this[_0xf3bd('0x14')](_0xf3bd('0x20'),_0x1b9eb7);if(_0x1b9eb7){if(this[_0xf3bd('0xe')](_0xf3bd('0x21'))<0x2){this['setDataValue']('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xf3bd('0x22')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0xf3bd('0x3')](_0xf3bd('0x11'),_0xf3bd('0x23'),_0xf3bd('0x24'),'predictive','booked'),'defaultValue':'progressive','comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0xf3bd('0x16')](0x4)[_0xf3bd('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xf3bd('0x26')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0xf3bd('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xf3bd('0x27')},'dialPowerLevel':{'type':Sequelize[_0xf3bd('0x28')](0x2)[_0xf3bd('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0xf3bd('0x3')](_0xf3bd('0x29'),_0xf3bd('0x2a')),'defaultValue':'dropRate','comment':_0xf3bd('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xf3bd('0x28')](0x2)[_0xf3bd('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xf3bd('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0xf3bd('0x16')](0x3)[_0xf3bd('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xf3bd('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize[_0xf3bd('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xf3bd('0x5')]},'dialOriginateTimeout':{'type':Sequelize[_0xf3bd('0x16')](0x3)[_0xf3bd('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0xf3bd('0x5')],'defaultValue':_0xf3bd('0x2e'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xf3bd('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf3bd('0x2f')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0xf3bd('0x30')},'dialCongestionMaxRetry':{'type':Sequelize[_0xf3bd('0x16')](0x3)[_0xf3bd('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf3bd('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xf3bd('0x16')](0x5)[_0xf3bd('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf3bd('0x32')},'dialBusyMaxRetry':{'type':Sequelize[_0xf3bd('0x16')](0x3)[_0xf3bd('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf3bd('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf3bd('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xf3bd('0x16')](0x3)[_0xf3bd('0x25')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xf3bd('0x16')](0x5)[_0xf3bd('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf3bd('0x34')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xf3bd('0x35')},'dialTimezone':{'type':Sequelize[_0xf3bd('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xf3bd('0x5')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0xf3bd('0x5')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xf3bd('0x36'),_0xf3bd('0x37'),_0xf3bd('0x38')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xf3bd('0x22')],'defaultValue':0x0,'comment':_0xf3bd('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0xf3bd('0x16')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xf3bd('0x3a')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xf3bd('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xf3bd('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xf3bd('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xf3bd('0x16')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xf3bd('0x16')](0x9)[_0xf3bd('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xf3bd('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xf3bd('0x16')](0x9)[_0xf3bd('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xf3bd('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xf3bd('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xf3bd('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xf3bd('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xf3bd('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xf3bd('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf3bd('0x41')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xf3bd('0x42')},'dialRecallInQueue':{'type':Sequelize[_0xf3bd('0x22')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0xf3bd('0x3')](_0xf3bd('0x43'),_0xf3bd('0x44')),'defaultValue':_0xf3bd('0x43')},'dialQueueProject2':{'type':Sequelize[_0xf3bd('0x5')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0xf3bd('0x22')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xf3bd('0x22')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xf3bd('0x16')](0x3)[_0xf3bd('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf3bd('0x45')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf3bd('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xf3bd('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf3bd('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xf3bd('0x16')](0x5)[_0xf3bd('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf3bd('0x48')},'dialDropMaxRetry':{'type':Sequelize[_0xf3bd('0x16')](0x3)[_0xf3bd('0x25')],'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[_0xf3bd('0x16')](0x3)[_0xf3bd('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf3bd('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xf3bd('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf3bd('0x4a')},'dialMachineMaxRetry':{'type':Sequelize[_0xf3bd('0x16')](0x3)[_0xf3bd('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xf3bd('0x16')](0x5)[_0xf3bd('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf3bd('0x4b')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xf3bd('0x16')](0x3)[_0xf3bd('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf3bd('0x4c')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xf3bd('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf3bd('0x4d')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xf3bd('0x4e'),'set':function(_0x4b9193){if(!_0x4b9193)this[_0xf3bd('0x14')](_0xf3bd('0x4f'),null);this[_0xf3bd('0x14')](_0xf3bd('0x50'),_0x4b9193);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xf3bd('0x16')](0x3)[_0xf3bd('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xf3bd('0x16')](0x3)[_0xf3bd('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xf3bd('0x22')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xf3bd('0x16')](0x3)[_0xf3bd('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xf3bd('0x22')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 78eaab2..49f82e0 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 _0x7fbe=['send','VoiceQueue','rawAttributes','fieldName','key','where','include','query','findAll','rows','catch','show','params','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','inbound','outbound','update','getHoppers','findOne','hasOwnProperty','nolimit','order','sort','VoiceQueueId','CmHopper','CmHopperHistory','pick','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','Agents','forEach','penalty','sequelize','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','interface','format','SIP/%s','voicePause','userVoiceQueue:save','removeTeams','ids','User','select','field','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','transaction','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','emit','online','isNil','isArray','getAgents','getMembers','CmList','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','CmListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','cm_contacts','phone\x20IS\x20NOT\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.OrderBy+1','cm_contact_has_items','join','h.ContactId=ci.CmContactId','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','get','VoiceQueues','QueueCampaigns','filter','map','value','type','name','sendStatus','error'];(function(_0x37e069,_0x5edc46){var _0x5cb67e=function(_0x33a3f4){while(--_0x33a3f4){_0x37e069['push'](_0x37e069['shift']());}};_0x5cb67e(++_0x5edc46);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x41bdd4,_0x3d5c76){_0x41bdd4=_0x41bdd4-0x0;var _0x5c03a6=_0x7fbe[_0x41bdd4];return _0x5c03a6;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xe7fb('0x0'));var _=require(_0xe7fb('0x1'));var squel=require(_0xe7fb('0x2'));var Redis=require(_0xe7fb('0x3'));var qs=require(_0xe7fb('0x4'));var logger=require(_0xe7fb('0x5'))(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var db=require(_0xe7fb('0x8'))['db'];config[_0xe7fb('0x9')]=_[_0xe7fb('0xa')](config[_0xe7fb('0x9')],{'host':_0xe7fb('0xb'),'port':0x18eb});var socket=require(_0xe7fb('0xc'))(new Redis(config['redis']));require(_0xe7fb('0xd'))[_0xe7fb('0xe')](socket);function respondWithStatusCode(_0x1d0741,_0x190a7a){_0x190a7a=_0x190a7a||0xcc;return function(_0x4ba197){if(_0x4ba197){return _0x1d0741['sendStatus'](_0x190a7a);}return _0x1d0741[_0xe7fb('0xf')](_0x190a7a)[_0xe7fb('0x10')]();};}function respondWithResult(_0x41a514,_0x348a73){_0x348a73=_0x348a73||0xc8;return function(_0x2a2223){if(_0x2a2223){return _0x41a514[_0xe7fb('0xf')](_0x348a73)[_0xe7fb('0x11')](_0x2a2223);}};}function respondWithFilteredResult(_0x3c07f3,_0x325035){return function(_0x2fe8ab){if(_0x2fe8ab){var _0x2437d4=typeof _0x325035[_0xe7fb('0x12')]===_0xe7fb('0x13')&&typeof _0x325035[_0xe7fb('0x14')]===_0xe7fb('0x13');var _0x598729=_0x2fe8ab[_0xe7fb('0x15')];var _0x2225e5=_0x2437d4?0x0:_0x325035['offset'];var _0x30015a=_0x2437d4?_0x2fe8ab[_0xe7fb('0x15')]:_0x325035['offset']+_0x325035[_0xe7fb('0x14')];var _0x559129;if(_0x30015a>=_0x598729){_0x30015a=_0x598729;_0x559129=0xc8;}else{_0x559129=0xce;}_0x3c07f3[_0xe7fb('0xf')](_0x559129);return _0x3c07f3[_0xe7fb('0x16')](_0xe7fb('0x17'),_0x2225e5+'-'+_0x30015a+'/'+_0x598729)[_0xe7fb('0x11')](_0x2fe8ab);}return null;};}function saveUpdates(_0x562262){return function(_0x892b0f){if(_0x892b0f){return _0x892b0f['update'](_0x562262)[_0xe7fb('0x18')](function(_0x546463){return _0x546463;});}return null;};}function removeEntity(_0x1e77fd){return function(_0x4708f7){if(_0x4708f7){return _0x4708f7[_0xe7fb('0x19')]()[_0xe7fb('0x18')](function(){var _0x5df1a1=_0x4708f7[_0xe7fb('0x1a')]({'plain':!![]});var _0x5d1c87=[{'name':_0xe7fb('0x1b'),'value':'inbound','ignore':![]},{'name':_0xe7fb('0x1c'),'value':'outbound','ignore':![]}];var _0xa5af01=_(_0x5d1c87)[_0xe7fb('0x1d')]('ignore')[_0xe7fb('0x1e')](_0xe7fb('0x1f'))[_0xe7fb('0x1f')]();if(_['includes'](_0xa5af01,_0x5df1a1[_0xe7fb('0x20')])){return;}var _0x469ead=_['find'](_0x5d1c87,['value',_0x5df1a1['type']])[_0xe7fb('0x21')];return db['UserProfileResource']['destroy']({'where':{'type':_0x469ead,'resourceId':_0x5df1a1['id']}})[_0xe7fb('0x18')](function(){return _0x4708f7;});})[_0xe7fb('0x18')](function(){_0x1e77fd[_0xe7fb('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6c930){return function(_0x2b69c4){if(!_0x2b69c4){_0x6c930[_0xe7fb('0x22')](0x194);}return _0x2b69c4;};}function handleError(_0x1ceed8,_0x392d75){_0x392d75=_0x392d75||0x1f4;return function(_0x16237a){logger[_0xe7fb('0x23')](_0x16237a['stack']);if(_0x16237a['name']){delete _0x16237a[_0xe7fb('0x21')];}_0x1ceed8[_0xe7fb('0xf')](_0x392d75)[_0xe7fb('0x24')](_0x16237a);};}exports['index']=function(_0xb1f2f4,_0x251807){var _0xd3fffe={};var _0x5f265f={'count':0x0,'rows':[]};var _0x219554=_[_0xe7fb('0x1e')](db[_0xe7fb('0x25')][_0xe7fb('0x26')],function(_0x4ce993){return{'name':_0x4ce993[_0xe7fb('0x27')],'type':_0x4ce993[_0xe7fb('0x20')][_0xe7fb('0x28')]};});_0xd3fffe=qs['getOptions'](_0x219554,_0xb1f2f4);var _0x517d70={'where':_0xd3fffe[_0xe7fb('0x29')]};return db['VoiceQueue'][_0xe7fb('0x15')](_0x517d70)[_0xe7fb('0x18')](function(_0xe49053){_0x5f265f[_0xe7fb('0x15')]=_0xe49053;_0xd3fffe['include']=qs[_0xe7fb('0x2a')](_0xb1f2f4[_0xe7fb('0x2b')]);return db[_0xe7fb('0x25')][_0xe7fb('0x2c')](_0xd3fffe);})[_0xe7fb('0x18')](function(_0x480819){_0x5f265f[_0xe7fb('0x2d')]=_0x480819;return _0x5f265f;})[_0xe7fb('0x18')](respondWithFilteredResult(_0x251807,_0xd3fffe))[_0xe7fb('0x2e')](handleError(_0x251807,null));};exports[_0xe7fb('0x2f')]=function(_0x46f430,_0x25e925){var _0x1bc72d={'raw':![],'where':{'id':_0x46f430[_0xe7fb('0x30')]['id']}},_0x147eb1={};_0x147eb1['model']=_[_0xe7fb('0x31')](db[_0xe7fb('0x25')][_0xe7fb('0x26')]);_0x147eb1['query']=_[_0xe7fb('0x31')](_0x46f430[_0xe7fb('0x2b')]);_0x147eb1[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x147eb1[_0xe7fb('0x34')],_0x147eb1[_0xe7fb('0x2b')]);_0x1bc72d[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x147eb1[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x46f430[_0xe7fb('0x2b')][_0xe7fb('0x36')]));_0x1bc72d[_0xe7fb('0x35')]=_0x1bc72d[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x1bc72d[_0xe7fb('0x35')]:_0x147eb1[_0xe7fb('0x34')];if(_0x46f430[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0x1bc72d['include']=[{'all':!![]}];}_0x1bc72d=_[_0xe7fb('0x39')]({},_0x1bc72d,_0x46f430[_0xe7fb('0x3a')]);return db[_0xe7fb('0x25')][_0xe7fb('0x3b')](_0x1bc72d)['then'](handleEntityNotFound(_0x25e925,null))[_0xe7fb('0x18')](respondWithResult(_0x25e925,null))[_0xe7fb('0x2e')](handleError(_0x25e925,null));};exports[_0xe7fb('0x3c')]=function(_0x413a13,_0x49fe9d){return db[_0xe7fb('0x25')][_0xe7fb('0x3c')](_0x413a13[_0xe7fb('0x3d')],{})[_0xe7fb('0x18')](function(_0x468d16){var _0xb729fc=_0x413a13['user'][_0xe7fb('0x1a')]({'plain':!![]});if(!_0xb729fc)throw new Error(_0xe7fb('0x3e'));if(_0xb729fc[_0xe7fb('0x3f')]==='user'){var _0x36a341=_0x468d16[_0xe7fb('0x1a')]({'plain':!![]});var _0x5d42ac=[{'name':'VoiceQueues','value':'inbound'},{'name':'QueueCampaigns','value':'outbound'}];var _0x900d67=_[_0xe7fb('0x3b')](_0x5d42ac,[_0xe7fb('0x1f'),_0x36a341['type']])[_0xe7fb('0x21')];return db['UserProfileSection'][_0xe7fb('0x3b')]({'where':{'name':_0x900d67,'userProfileId':_0xb729fc[_0xe7fb('0x40')]},'raw':!![]})['then'](function(_0x108a16){if(_0x108a16&&_0x108a16[_0xe7fb('0x41')]===0x0){return db[_0xe7fb('0x42')][_0xe7fb('0x3c')]({'name':_0x36a341['name'],'resourceId':_0x36a341['id'],'type':_0x108a16[_0xe7fb('0x21')],'sectionId':_0x108a16['id']},{})[_0xe7fb('0x18')](function(){return _0x468d16;});}else{return _0x468d16;}})[_0xe7fb('0x2e')](function(_0x56a84f){logger[_0xe7fb('0x23')](_0xe7fb('0x43'),_0x56a84f);throw _0x56a84f;});}return _0x468d16;})[_0xe7fb('0x18')](respondWithResult(_0x49fe9d,0xc9))[_0xe7fb('0x2e')](handleError(_0x49fe9d,null));};exports[_0xe7fb('0x44')]=function(_0x5a1ce1,_0x2eb999){var _0x4df4aa={'where':{'id':_0x5a1ce1[_0xe7fb('0x30')]['id']}},_0x2c72dd={};_0x2c72dd[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db[_0xe7fb('0x25')]['rawAttributes']);_0x4df4aa[_0xe7fb('0x35')]=_['intersection'](_0x2c72dd['model'],qs[_0xe7fb('0x36')](_0x5a1ce1[_0xe7fb('0x2b')][_0xe7fb('0x36')]));_0x4df4aa['attributes']=_0x4df4aa[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x4df4aa['attributes']:_0x2c72dd['model'];if(_0x5a1ce1[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0x4df4aa[_0xe7fb('0x2a')]=[{'all':!![]}];}_0x4df4aa=_[_0xe7fb('0x39')]({},_0x4df4aa,_0x5a1ce1[_0xe7fb('0x3a')]);return db[_0xe7fb('0x25')][_0xe7fb('0x3b')](_0x4df4aa)[_0xe7fb('0x18')](handleEntityNotFound(_0x2eb999,null))['then'](function(_0x925a5e){if(_0x925a5e){var _0x5cc28f=_0x925a5e[_0xe7fb('0x1a')]({'plain':!![]});_0x5cc28f=qs[_0xe7fb('0x45')](_0x5cc28f,['id','createdAt',_0xe7fb('0x46')]);_0x5a1ce1['body']=_[_0xe7fb('0x45')](_0x5a1ce1['body'],['id',_0xe7fb('0x47'),'updatedAt']);return db[_0xe7fb('0x25')]['create'](_[_0xe7fb('0x39')](_0x5cc28f,_0x5a1ce1[_0xe7fb('0x3d')]),{'include':_0x5a1ce1[_0xe7fb('0x2b')][_0xe7fb('0x38')]?[{'all':!![]}]:undefined})[_0xe7fb('0x18')](function(_0x2f959d){var _0x2f4760=_0x5a1ce1['user']['get']({'plain':!![]});if(!_0x2f4760)throw new Error(_0xe7fb('0x3e'));if(_0x2f4760['role']==='user'){var _0x4c3eb7=_0x2f959d['get']({'plain':!![]});var _0x539252=[{'name':_0xe7fb('0x1b'),'value':_0xe7fb('0x48')},{'name':_0xe7fb('0x1c'),'value':_0xe7fb('0x49')}];var _0x59c92d=_[_0xe7fb('0x3b')](_0x539252,[_0xe7fb('0x1f'),_0x4c3eb7[_0xe7fb('0x20')]])['name'];return db['UserProfileSection'][_0xe7fb('0x3b')]({'where':{'name':_0x59c92d,'userProfileId':_0x2f4760[_0xe7fb('0x40')]},'raw':!![]})[_0xe7fb('0x18')](function(_0x4f4ba3){if(_0x4f4ba3&&_0x4f4ba3[_0xe7fb('0x41')]===0x0){return db[_0xe7fb('0x42')][_0xe7fb('0x3c')]({'name':_0x4c3eb7[_0xe7fb('0x21')],'resourceId':_0x4c3eb7['id'],'type':_0x4f4ba3['name'],'sectionId':_0x4f4ba3['id']},{})['then'](function(){return _0x2f959d;});}else{return _0x2f959d;}})[_0xe7fb('0x2e')](function(_0x3104c2){logger[_0xe7fb('0x23')](_0xe7fb('0x43'),_0x3104c2);throw _0x3104c2;});}return _0x2f959d;});}})[_0xe7fb('0x18')](respondWithResult(_0x2eb999,0xc9))['catch'](handleError(_0x2eb999,null));};exports[_0xe7fb('0x4a')]=function(_0x349a2a,_0x23755b){if(_0x349a2a['body']['id']){delete _0x349a2a['body']['id'];}return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x349a2a[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x23755b,null))[_0xe7fb('0x18')](saveUpdates(_0x349a2a[_0xe7fb('0x3d')],null))['then'](respondWithResult(_0x23755b,null))[_0xe7fb('0x2e')](handleError(_0x23755b,null));};exports[_0xe7fb('0x19')]=function(_0x2cd4e5,_0x1aef59){return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x2cd4e5['params']['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x1aef59,null))['then'](removeEntity(_0x1aef59,null))[_0xe7fb('0x2e')](handleError(_0x1aef59,null));};exports[_0xe7fb('0x4b')]=function(_0x116c7e,_0x1b24fd){var _0x5925e6={'raw':![],'where':{}};var _0x47ac92={};var _0x2789a4={'count':0x0,'rows':[]};return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0x116c7e[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x1b24fd,null))['then'](function(_0x4096d4){if(_0x4096d4){_0x47ac92['model']=_[_0xe7fb('0x31')](db['CmHopper']['rawAttributes']);_0x47ac92[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x116c7e[_0xe7fb('0x2b')]);_0x47ac92['filters']=_[_0xe7fb('0x33')](_0x47ac92[_0xe7fb('0x34')],_0x47ac92[_0xe7fb('0x2b')]);_0x5925e6[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x47ac92['model'],qs[_0xe7fb('0x36')](_0x116c7e[_0xe7fb('0x2b')]['fields']));_0x5925e6[_0xe7fb('0x35')]=_0x5925e6[_0xe7fb('0x35')]['length']?_0x5925e6[_0xe7fb('0x35')]:_0x47ac92['model'];if(!_0x116c7e[_0xe7fb('0x2b')][_0xe7fb('0x4d')](_0xe7fb('0x4e'))){_0x5925e6['limit']=qs[_0xe7fb('0x14')](_0x116c7e[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x5925e6[_0xe7fb('0x12')]=qs[_0xe7fb('0x12')](_0x116c7e[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}_0x5925e6[_0xe7fb('0x4f')]=qs['sort'](_0x116c7e['query'][_0xe7fb('0x50')]);_0x5925e6[_0xe7fb('0x29')]=qs[_0xe7fb('0x32')](_['pick'](_0x116c7e['query'],_0x47ac92[_0xe7fb('0x32')]));_0x5925e6[_0xe7fb('0x29')][_0xe7fb('0x51')]=_0x4096d4['id'];if(_0x116c7e[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0x5925e6[_0xe7fb('0x29')]=_[_0xe7fb('0x39')](_0x5925e6[_0xe7fb('0x29')],{'$or':_[_0xe7fb('0x1e')](_0x5925e6[_0xe7fb('0x35')],function(_0x1ff5e7){var _0xf423ab={};_0xf423ab[_0x1ff5e7]={'$like':'%'+_0x116c7e[_0xe7fb('0x2b')]['filter']+'%'};return _0xf423ab;})});}_0x5925e6=_['merge']({},_0x5925e6,_0x116c7e[_0xe7fb('0x3a')]);return db[_0xe7fb('0x52')][_0xe7fb('0x15')]({'where':_0x5925e6[_0xe7fb('0x29')]})[_0xe7fb('0x18')](function(_0x562493){_0x2789a4[_0xe7fb('0x15')]=_0x562493;if(_0x116c7e[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0x5925e6[_0xe7fb('0x2a')]=[{'all':!![]}];}return db[_0xe7fb('0x52')][_0xe7fb('0x2c')](_0x5925e6);})[_0xe7fb('0x18')](function(_0x1e6256){_0x2789a4[_0xe7fb('0x2d')]=_0x1e6256;return _0x2789a4;});}})['then'](respondWithFilteredResult(_0x1b24fd,_0x5925e6))[_0xe7fb('0x2e')](handleError(_0x1b24fd,null));};exports['getHopperHistories']=function(_0x279663,_0x2f13f2){var _0x2a2079={'raw':!![],'where':{}};var _0x31c159={};var _0x318d06={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xe7fb('0x4c')]({'where':{'id':_0x279663[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x2f13f2,null))[_0xe7fb('0x18')](function(_0x15d881){if(_0x15d881){_0x31c159[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db[_0xe7fb('0x53')][_0xe7fb('0x26')]);_0x31c159[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x279663[_0xe7fb('0x2b')]);_0x31c159[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x31c159['model'],_0x31c159['query']);_0x2a2079['attributes']=_[_0xe7fb('0x33')](_0x31c159[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x279663[_0xe7fb('0x2b')]['fields']));_0x2a2079[_0xe7fb('0x35')]=_0x2a2079[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x2a2079[_0xe7fb('0x35')]:_0x31c159['model'];if(!_0x279663[_0xe7fb('0x2b')]['hasOwnProperty'](_0xe7fb('0x4e'))){_0x2a2079[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x279663[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x2a2079['offset']=qs[_0xe7fb('0x12')](_0x279663['query'][_0xe7fb('0x12')]);}_0x2a2079['order']=qs[_0xe7fb('0x50')](_0x279663[_0xe7fb('0x2b')]['sort']);_0x2a2079[_0xe7fb('0x29')]=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0x279663[_0xe7fb('0x2b')],_0x31c159['filters']));_0x2a2079[_0xe7fb('0x29')][_0xe7fb('0x51')]=_0x15d881['id'];if(_0x279663[_0xe7fb('0x2b')]['filter']){_0x2a2079[_0xe7fb('0x29')]=_['merge'](_0x2a2079['where'],{'$or':_['map'](_0x2a2079[_0xe7fb('0x35')],function(_0x27019a){var _0x4a8a65={};_0x4a8a65[_0x27019a]={'$like':'%'+_0x279663[_0xe7fb('0x2b')][_0xe7fb('0x1d')]+'%'};return _0x4a8a65;})});}_0x2a2079=_[_0xe7fb('0x39')]({},_0x2a2079,_0x279663[_0xe7fb('0x3a')]);return db[_0xe7fb('0x53')][_0xe7fb('0x15')]({'where':_0x2a2079[_0xe7fb('0x29')]})[_0xe7fb('0x18')](function(_0x42190e){_0x318d06[_0xe7fb('0x15')]=_0x42190e;if(_0x279663[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0x2a2079[_0xe7fb('0x2a')]=[{'all':!![]}];}return db[_0xe7fb('0x53')][_0xe7fb('0x2c')](_0x2a2079);})[_0xe7fb('0x18')](function(_0x3c5bd9){_0x318d06[_0xe7fb('0x2d')]=_0x3c5bd9;return _0x318d06;});}})[_0xe7fb('0x18')](respondWithFilteredResult(_0x2f13f2,_0x2a2079))[_0xe7fb('0x2e')](handleError(_0x2f13f2,null));};exports['getHopperFinals']=function(_0x47568c,_0x185ac0){var _0xc3958f={'raw':!![],'where':{}};var _0x1b8fdb={};var _0x19fe06={'count':0x0,'rows':[]};return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0x47568c['params']['id']}})['then'](handleEntityNotFound(_0x185ac0,null))[_0xe7fb('0x18')](function(_0x4e1865){if(_0x4e1865){_0x1b8fdb[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db['CmHopperFinal'][_0xe7fb('0x26')]);_0x1b8fdb[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x47568c[_0xe7fb('0x2b')]);_0x1b8fdb[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x1b8fdb['model'],_0x1b8fdb[_0xe7fb('0x2b')]);_0xc3958f[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x1b8fdb[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x47568c[_0xe7fb('0x2b')]['fields']));_0xc3958f['attributes']=_0xc3958f['attributes'][_0xe7fb('0x37')]?_0xc3958f[_0xe7fb('0x35')]:_0x1b8fdb[_0xe7fb('0x34')];if(!_0x47568c['query'][_0xe7fb('0x4d')]('nolimit')){_0xc3958f[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0xc3958f['offset']=qs[_0xe7fb('0x12')](_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}_0xc3958f[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x50')]);_0xc3958f[_0xe7fb('0x29')]=qs['filters'](_['pick'](_0x47568c[_0xe7fb('0x2b')],_0x1b8fdb['filters']));_0xc3958f[_0xe7fb('0x29')][_0xe7fb('0x51')]=_0x4e1865['id'];if(_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0xc3958f['where']=_['merge'](_0xc3958f[_0xe7fb('0x29')],{'$or':_[_0xe7fb('0x1e')](_0xc3958f['attributes'],function(_0x21cb12){var _0x431d21={};_0x431d21[_0x21cb12]={'$like':'%'+_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x1d')]+'%'};return _0x431d21;})});}_0xc3958f=_[_0xe7fb('0x39')]({},_0xc3958f,_0x47568c[_0xe7fb('0x3a')]);return db['CmHopperFinal'][_0xe7fb('0x15')]({'where':_0xc3958f[_0xe7fb('0x29')]})[_0xe7fb('0x18')](function(_0x2607b9){_0x19fe06[_0xe7fb('0x15')]=_0x2607b9;if(_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0xc3958f[_0xe7fb('0x2a')]=[{'all':!![]}];}return db[_0xe7fb('0x55')][_0xe7fb('0x2c')](_0xc3958f);})[_0xe7fb('0x18')](function(_0x3b1a90){_0x19fe06[_0xe7fb('0x2d')]=_0x3b1a90;return _0x19fe06;});}})[_0xe7fb('0x18')](respondWithFilteredResult(_0x185ac0,_0xc3958f))[_0xe7fb('0x2e')](handleError(_0x185ac0,null));};exports[_0xe7fb('0x56')]=function(_0x27c100,_0x19e86f){var _0x4b4cf6={'raw':!![],'where':{}};var _0x173d85={};var _0xa1368a={'count':0x0,'rows':[]};return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0x27c100['params']['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x19e86f,null))[_0xe7fb('0x18')](function(_0x4ca09c){if(_0x4ca09c){_0x173d85[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db[_0xe7fb('0x57')]['rawAttributes']);_0x173d85[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x27c100['query']);_0x173d85['filters']=_[_0xe7fb('0x33')](_0x173d85[_0xe7fb('0x34')],_0x173d85[_0xe7fb('0x2b')]);_0x4b4cf6[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x173d85[_0xe7fb('0x34')],qs['fields'](_0x27c100[_0xe7fb('0x2b')][_0xe7fb('0x36')]));_0x4b4cf6[_0xe7fb('0x35')]=_0x4b4cf6['attributes'][_0xe7fb('0x37')]?_0x4b4cf6[_0xe7fb('0x35')]:_0x173d85[_0xe7fb('0x34')];if(!_0x27c100[_0xe7fb('0x2b')]['hasOwnProperty'](_0xe7fb('0x4e'))){_0x4b4cf6[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x27c100['query'][_0xe7fb('0x14')]);_0x4b4cf6[_0xe7fb('0x12')]=qs[_0xe7fb('0x12')](_0x27c100[_0xe7fb('0x2b')]['offset']);}_0x4b4cf6[_0xe7fb('0x4f')]=qs['sort'](_0x27c100[_0xe7fb('0x2b')]['sort']);_0x4b4cf6[_0xe7fb('0x29')]=qs[_0xe7fb('0x32')](_['pick'](_0x27c100['query'],_0x173d85[_0xe7fb('0x32')]));_0x4b4cf6['where'][_0xe7fb('0x51')]=_0x4ca09c['id'];if(_0x27c100[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0x4b4cf6[_0xe7fb('0x29')]=_['merge'](_0x4b4cf6[_0xe7fb('0x29')],{'$or':_[_0xe7fb('0x1e')](_0x4b4cf6[_0xe7fb('0x35')],function(_0x27a822){var _0x5505e5={};_0x5505e5[_0x27a822]={'$like':'%'+_0x27c100[_0xe7fb('0x2b')][_0xe7fb('0x1d')]+'%'};return _0x5505e5;})});}_0x4b4cf6=_[_0xe7fb('0x39')]({},_0x4b4cf6,_0x27c100[_0xe7fb('0x3a')]);return db[_0xe7fb('0x57')]['count']({'where':_0x4b4cf6[_0xe7fb('0x29')]})[_0xe7fb('0x18')](function(_0x54233){_0xa1368a[_0xe7fb('0x15')]=_0x54233;if(_0x27c100[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0x4b4cf6[_0xe7fb('0x2a')]=[{'all':!![]}];}return db[_0xe7fb('0x57')][_0xe7fb('0x2c')](_0x4b4cf6);})['then'](function(_0x795e32){_0xa1368a[_0xe7fb('0x2d')]=_0x795e32;return _0xa1368a;});}})[_0xe7fb('0x18')](respondWithFilteredResult(_0x19e86f,_0x4b4cf6))[_0xe7fb('0x2e')](handleError(_0x19e86f,null));};exports[_0xe7fb('0x58')]=function(_0x16f2b1,_0x3a8154){var _0x51335c={};var _0x4f4772={};var _0x4ef7b4;var _0x1bcee7;return db['VoiceQueue'][_0xe7fb('0x4c')]({'where':{'id':_0x16f2b1['params']['id']}})['then'](handleEntityNotFound(_0x3a8154,null))[_0xe7fb('0x18')](function(_0x5bd869){if(_0x5bd869){_0x4ef7b4=_0x5bd869;_0x4f4772[_0xe7fb('0x34')]=_['keys'](db[_0xe7fb('0x59')][_0xe7fb('0x26')]);_0x4f4772[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x16f2b1[_0xe7fb('0x2b')]);_0x4f4772[_0xe7fb('0x32')]=_['intersection'](_0x4f4772[_0xe7fb('0x34')],_0x4f4772[_0xe7fb('0x2b')]);_0x51335c[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x4f4772[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x16f2b1[_0xe7fb('0x2b')]['fields']));_0x51335c[_0xe7fb('0x35')]=_0x51335c[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x51335c[_0xe7fb('0x35')]:_0x4f4772['model'];_0x51335c[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0x16f2b1[_0xe7fb('0x2b')][_0xe7fb('0x50')]);_0x51335c[_0xe7fb('0x29')]=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0x16f2b1['query'],_0x4f4772['filters']));if(_0x16f2b1[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0x51335c['where']=_[_0xe7fb('0x39')](_0x51335c['where'],{'$or':_[_0xe7fb('0x1e')](_0x51335c[_0xe7fb('0x35')],function(_0x220d72){var _0x5ea91d={};_0x5ea91d[_0x220d72]={'$like':'%'+_0x16f2b1['query'][_0xe7fb('0x1d')]+'%'};return _0x5ea91d;})});}_0x51335c=_['merge']({},_0x51335c,_0x16f2b1['options']);return _0x4ef7b4[_0xe7fb('0x58')](_0x51335c);}})[_0xe7fb('0x18')](function(_0x3b073e){if(_0x3b073e){_0x1bcee7=_0x3b073e[_0xe7fb('0x37')];if(!_0x16f2b1[_0xe7fb('0x2b')][_0xe7fb('0x4d')](_0xe7fb('0x4e'))){_0x51335c[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x16f2b1[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x51335c[_0xe7fb('0x12')]=qs[_0xe7fb('0x12')](_0x16f2b1[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}return _0x4ef7b4[_0xe7fb('0x58')](_0x51335c);}})[_0xe7fb('0x18')](function(_0x249d6f){if(_0x249d6f){return _0x249d6f?{'count':_0x1bcee7,'rows':_0x249d6f}:null;}})[_0xe7fb('0x18')](respondWithResult(_0x3a8154,null))['catch'](handleError(_0x3a8154,null));};exports[_0xe7fb('0x5a')]=function(_0x19ebe2,_0x3406ed){var _0x1631cc=_0x19ebe2['body'][_0xe7fb('0x5b')];var _0x21ee89=_[_0xe7fb('0x1e')](_0x1631cc,'id');return db[_0xe7fb('0x59')][_0xe7fb('0x2c')]({'where':{'id':_0x21ee89},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xe7fb('0x21'),'online','voicePause','interface'],'raw':!![]}]})[_0xe7fb('0x18')](function(_0x5a97c8){if(_0x5a97c8){var _0x503ae2=_['flatMap'](_0x5a97c8,function(_0x2ccf71){var _0x35be16=_0x2ccf71[_0xe7fb('0x1a')]({'plain':!![]});_0x35be16[_0xe7fb('0x5c')][_0xe7fb('0x5d')](function(_0x1db971){_0x1db971['penalty']=_['find'](_0x1631cc,{'id':_0x35be16['id']})[_0xe7fb('0x5e')];});return _0x35be16['Agents'];});return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x19ebe2[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](function(_0x3891ed){return db[_0xe7fb('0x5f')]['transaction'](function(_0x4aa499){return _0x3891ed[_0xe7fb('0x5a')](_0x21ee89,{'transaction':_0x4aa499})[_0xe7fb('0x18')](function(){return BPromise[_0xe7fb('0x60')](_0x1631cc,function(_0x7a7a6b){return db[_0xe7fb('0x61')][_0xe7fb('0x62')]({'TeamId':_0x7a7a6b['id'],'VoiceQueueId':_0x19ebe2['params']['id'],'penalty':_0x7a7a6b[_0xe7fb('0x5e')]},{'transaction':_0x4aa499});});})[_0xe7fb('0x18')](function(){return BPromise[_0xe7fb('0x60')](_0x503ae2,function(_0x33d638){return db[_0xe7fb('0x63')]['findOrCreate']({'where':{'UserId':_0x33d638['id'],'VoiceQueueId':_0x19ebe2[_0xe7fb('0x30')]['id']},'defaults':{'penalty':_0x33d638[_0xe7fb('0x5e')]},'transaction':_0x4aa499});});})[_0xe7fb('0x18')](function(){return BPromise['each'](_['filter'](_0x503ae2,{'online':!![]}),function(_0x5d30ef){return db[_0xe7fb('0x64')]['upsert']({'membername':_0x5d30ef['name'],'UserId':_0x5d30ef['id'],'queue_name':_0x3891ed[_0xe7fb('0x21')],'VoiceQueueId':_0x3891ed['id'],'interface':_['isNil'](_0x5d30ef[_0xe7fb('0x65')])?util[_0xe7fb('0x66')](_0xe7fb('0x67'),_0x5d30ef[_0xe7fb('0x21')]):_0x5d30ef[_0xe7fb('0x65')],'paused':_0x5d30ef[_0xe7fb('0x68')]||![],'penalty':_0x5d30ef[_0xe7fb('0x5e')]},{'transaction':_0x4aa499});});})['then'](function(){_0x503ae2[_0xe7fb('0x5d')](function(_0x16e9d4){socket['emit'](_0xe7fb('0x69'),{'UserId':_0x16e9d4['id'],'VoiceQueueId':_0x3891ed['id']});});});});});}})[_0xe7fb('0x18')](respondWithStatusCode(_0x3406ed,null))[_0xe7fb('0x2e')](handleError(_0x3406ed,null));};exports[_0xe7fb('0x6a')]=function(_0x366acb,_0x4d2c92){return db['Team'][_0xe7fb('0x2c')]({'where':{'id':_0x366acb[_0xe7fb('0x2b')][_0xe7fb('0x6b')]},'attributes':['id'],'include':[{'model':db[_0xe7fb('0x6c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe7fb('0x18')](handleEntityNotFound(_0x4d2c92,null))[_0xe7fb('0x18')](function(_0x2e276c){var _0x4efcdc=_[_0xe7fb('0x1e')](_0x2e276c,'id');var _0x146fc9=[];var _0x470718=[];var _0x55048c=squel[_0xe7fb('0x6d')]();_0x55048c[_0xe7fb('0x6e')]('tq.TeamId')[_0xe7fb('0x6f')](_0xe7fb('0x70'),'tq')['join'](_0xe7fb('0x71'),'ut',_0xe7fb('0x72'))[_0xe7fb('0x29')](_0xe7fb('0x73'),_0x366acb[_0xe7fb('0x30')]['id']);for(var _0x5d9b58=0x0;_0x5d9b58<_0x2e276c['length'];_0x5d9b58+=0x1){let _0x5986f1=_0x2e276c[_0x5d9b58];for(var _0x23ec12=0x0;_0x23ec12<_0x5986f1[_0xe7fb('0x5c')][_0xe7fb('0x37')];_0x23ec12+=0x1){let _0x36be03=_0x5986f1['Agents'][_0x23ec12];var _0x29de1e=_0x55048c[_0xe7fb('0x44')]();_0x29de1e['where']('ut.UserId\x20=\x20?',_0x36be03['id']);_0x470718[_0xe7fb('0x74')](db[_0xe7fb('0x5f')][_0xe7fb('0x2b')](_0x29de1e[_0xe7fb('0x75')](),{'type':db[_0xe7fb('0x5f')]['QueryTypes'][_0xe7fb('0x76')]})[_0xe7fb('0x18')](function(_0xe52155){if(_0xe52155['length']===0x1){return _0x36be03['id'];}else{var _0x20b1fc=_[_0xe7fb('0x77')](_['map'](_0xe52155,_0xe7fb('0x78')),function(_0x6ec6b6){return _[_0xe7fb('0x79')](_0x4efcdc,_0x6ec6b6);});if(_0x20b1fc){return _0x36be03['id'];}}}));}}return BPromise[_0xe7fb('0x7a')](_0x470718)['then'](function(_0x4ed327){_0x146fc9=_(_0x146fc9)[_0xe7fb('0x7b')](_0x4ed327)[_0xe7fb('0x7c')]()[_0xe7fb('0x1f')]();return db['VoiceQueue'][_0xe7fb('0x3b')]({'where':{'id':_0x366acb[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](function(_0x49fb4b){return db[_0xe7fb('0x5f')][_0xe7fb('0x7d')](function(_0x362fe1){return _0x49fb4b['removeTeams'](_0x366acb[_0xe7fb('0x2b')][_0xe7fb('0x6b')],{'transaction':_0x362fe1})[_0xe7fb('0x18')](function(){if(!_[_0xe7fb('0x7e')](_0x146fc9)){return _0x49fb4b[_0xe7fb('0x7f')](_0x146fc9,{'transaction':_0x362fe1})[_0xe7fb('0x18')](function(){return db[_0xe7fb('0x64')][_0xe7fb('0x19')]({'where':{'VoiceQueueId':_0x366acb['params']['id'],'UserId':_0x146fc9},'transaction':_0x362fe1});});}})[_0xe7fb('0x18')](function(){_0x146fc9[_0xe7fb('0x5d')](function(_0x5dadac){socket['emit'](_0xe7fb('0x80'),{'UserId':_0x5dadac,'VoiceQueueId':_0x49fb4b['id']});});});});});});})[_0xe7fb('0x18')](respondWithStatusCode(_0x4d2c92,null))[_0xe7fb('0x2e')](handleError(_0x4d2c92,null));};exports[_0xe7fb('0x81')]=function(_0x4b58de,_0x4386ea){var _0x41c771,_0x489c9d;return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x4b58de[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x4386ea,null))[_0xe7fb('0x18')](function(_0x39fef6){if(_0x39fef6){_0x489c9d=_0x39fef6;return _0x39fef6[_0xe7fb('0x81')](_0x4b58de['body'][_0xe7fb('0x6b')],_['omit'](_0x4b58de[_0xe7fb('0x3d')],['ids','id'])||{})['spread'](function(_0x260067){for(var _0xed4af4=0x0;_0xed4af4<_0x4b58de[_0xe7fb('0x3d')][_0xe7fb('0x6b')][_0xe7fb('0x37')];_0xed4af4+=0x1){socket[_0xe7fb('0x82')](_0xe7fb('0x69'),{'UserId':Number(_0x4b58de['body'][_0xe7fb('0x6b')][_0xed4af4]),'VoiceQueueId':Number(_0x4b58de[_0xe7fb('0x30')]['id'])});}return _0x260067;});}})[_0xe7fb('0x18')](function(_0x19a7ec){_0x41c771=_0x19a7ec||[];if(_0x489c9d){return db[_0xe7fb('0x6c')][_0xe7fb('0x2c')]({'where':{'id':_0x4b58de[_0xe7fb('0x3d')]['ids']},'attributes':['id',_0xe7fb('0x21'),_0xe7fb('0x83'),_0xe7fb('0x68'),'interface'],'raw':!![]});}})[_0xe7fb('0x18')](function(_0x52c758){if(!_['isEmpty'](_0x52c758)){var _0x4930c6=[];for(var _0x1a3d44=0x0;_0x1a3d44<_0x52c758[_0xe7fb('0x37')];_0x1a3d44++){if(_0x52c758[_0x1a3d44]['online']){_0x4930c6[_0xe7fb('0x74')](db[_0xe7fb('0x64')]['upsert']({'membername':_0x52c758[_0x1a3d44]['name'],'UserId':_0x52c758[_0x1a3d44]['id'],'queue_name':_0x489c9d[_0xe7fb('0x21')],'VoiceQueueId':_0x489c9d['id'],'interface':_[_0xe7fb('0x84')](_0x52c758[_0x1a3d44][_0xe7fb('0x65')])?util['format'](_0xe7fb('0x67'),_0x52c758[_0x1a3d44][_0xe7fb('0x21')]):_0x52c758[_0x1a3d44]['interface'],'paused':_0x52c758[_0x1a3d44]['voicePause']||![],'penalty':_0x4b58de[_0xe7fb('0x3d')]['penalty']||0x0}));}}return BPromise['all'](_0x4930c6);}})['then'](function(){return _0x41c771;})[_0xe7fb('0x18')](respondWithResult(_0x4386ea,null))[_0xe7fb('0x2e')](handleError(_0x4386ea,null));};exports['removeAgents']=function(_0x35b5ad,_0x55c935){return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x35b5ad[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x55c935,null))[_0xe7fb('0x18')](function(_0x4736bf){if(_0x4736bf){return _0x4736bf[_0xe7fb('0x7f')](_0x35b5ad[_0xe7fb('0x2b')][_0xe7fb('0x6b')])[_0xe7fb('0x18')](function(){if(_[_0xe7fb('0x85')](_0x35b5ad[_0xe7fb('0x2b')][_0xe7fb('0x6b')])){for(var _0x5744a8=0x0;_0x5744a8<_0x35b5ad[_0xe7fb('0x2b')][_0xe7fb('0x6b')]['length'];_0x5744a8+=0x1){socket['emit'](_0xe7fb('0x80'),{'UserId':Number(_0x35b5ad['query'][_0xe7fb('0x6b')][_0x5744a8]),'VoiceQueueId':Number(_0x35b5ad[_0xe7fb('0x30')]['id'])});}}else{socket[_0xe7fb('0x82')](_0xe7fb('0x80'),{'UserId':Number(_0x35b5ad[_0xe7fb('0x2b')]['ids']),'VoiceQueueId':Number(_0x35b5ad['params']['id'])});}});}})[_0xe7fb('0x18')](function(_0x27b153){return db[_0xe7fb('0x64')][_0xe7fb('0x19')]({'where':{'VoiceQueueId':_0x35b5ad[_0xe7fb('0x30')]['id'],'UserId':_0x35b5ad['query'][_0xe7fb('0x6b')]}})['then'](function(){return _0x27b153;});})[_0xe7fb('0x18')](respondWithStatusCode(_0x55c935,null))[_0xe7fb('0x2e')](handleError(_0x55c935,null));};exports['getAgents']=function(_0x5d0f05,_0x519e35){var _0x16ae95={};var _0xb1a3fa={};var _0x59e676;var _0x577895;return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0x5d0f05['params']['id']}})['then'](handleEntityNotFound(_0x519e35,null))[_0xe7fb('0x18')](function(_0xe1613c){if(_0xe1613c){_0x59e676=_0xe1613c;_0xb1a3fa[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db['User'][_0xe7fb('0x26')]);_0xb1a3fa[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x5d0f05[_0xe7fb('0x2b')]);_0xb1a3fa[_0xe7fb('0x32')]=_['intersection'](_0xb1a3fa['model'],_0xb1a3fa[_0xe7fb('0x2b')]);_0x16ae95[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0xb1a3fa[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x5d0f05['query'][_0xe7fb('0x36')]));_0x16ae95['attributes']=_0x16ae95['attributes'][_0xe7fb('0x37')]?_0x16ae95[_0xe7fb('0x35')]:_0xb1a3fa[_0xe7fb('0x34')];_0x16ae95[_0xe7fb('0x4f')]=qs['sort'](_0x5d0f05[_0xe7fb('0x2b')]['sort']);_0x16ae95['where']=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0x5d0f05[_0xe7fb('0x2b')],_0xb1a3fa[_0xe7fb('0x32')]));if(_0x5d0f05[_0xe7fb('0x2b')]['filter']){_0x16ae95['where']=_[_0xe7fb('0x39')](_0x16ae95['where'],{'$or':_['map'](_0x16ae95[_0xe7fb('0x35')],function(_0x5763dd){var _0x4cab2f={};_0x4cab2f[_0x5763dd]={'$like':'%'+_0x5d0f05[_0xe7fb('0x2b')][_0xe7fb('0x1d')]+'%'};return _0x4cab2f;})});}_0x16ae95=_[_0xe7fb('0x39')]({},_0x16ae95,_0x5d0f05[_0xe7fb('0x3a')]);return _0x59e676[_0xe7fb('0x86')](_0x16ae95);}})['then'](function(_0xcf6d2){if(_0xcf6d2){_0x577895=_0xcf6d2['length'];if(!_0x5d0f05['query'][_0xe7fb('0x4d')](_0xe7fb('0x4e'))){_0x16ae95[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x5d0f05[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x16ae95[_0xe7fb('0x12')]=qs['offset'](_0x5d0f05['query'][_0xe7fb('0x12')]);}return _0x59e676['getAgents'](_0x16ae95);}})[_0xe7fb('0x18')](function(_0x51ff1e){if(_0x51ff1e){return _0x51ff1e?{'count':_0x577895,'rows':_0x51ff1e}:null;}})[_0xe7fb('0x18')](respondWithResult(_0x519e35,null))['catch'](handleError(_0x519e35,null));};exports[_0xe7fb('0x87')]=function(_0x4407ee,_0x56869b){var _0x2139e3={};var _0x2e0e13={};var _0x23e1db;var _0x2a2fa6;return db['VoiceQueue'][_0xe7fb('0x4c')]({'where':{'id':_0x4407ee[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x56869b,null))[_0xe7fb('0x18')](function(_0x454ef0){if(_0x454ef0){_0x23e1db=_0x454ef0;_0x2e0e13['model']=_[_0xe7fb('0x31')](db[_0xe7fb('0x64')][_0xe7fb('0x26')]);_0x2e0e13[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x4407ee[_0xe7fb('0x2b')]);_0x2e0e13[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x2e0e13[_0xe7fb('0x34')],_0x2e0e13[_0xe7fb('0x2b')]);_0x2139e3[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x2e0e13[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x4407ee[_0xe7fb('0x2b')]['fields']));_0x2139e3['attributes']=_0x2139e3[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x2139e3[_0xe7fb('0x35')]:_0x2e0e13[_0xe7fb('0x34')];_0x2139e3[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0x4407ee[_0xe7fb('0x2b')][_0xe7fb('0x50')]);_0x2139e3['where']=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0x4407ee[_0xe7fb('0x2b')],_0x2e0e13[_0xe7fb('0x32')]));if(_0x4407ee[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0x2139e3['where']=_[_0xe7fb('0x39')](_0x2139e3[_0xe7fb('0x29')],{'$or':_['map'](_0x2139e3[_0xe7fb('0x35')],function(_0x5dde83){var _0x21d86e={};_0x21d86e[_0x5dde83]={'$like':'%'+_0x4407ee['query'][_0xe7fb('0x1d')]+'%'};return _0x21d86e;})});}_0x2139e3=_[_0xe7fb('0x39')]({},_0x2139e3,_0x4407ee['options']);return _0x23e1db[_0xe7fb('0x87')](_0x2139e3);}})[_0xe7fb('0x18')](function(_0x5892cd){if(_0x5892cd){_0x2a2fa6=_0x5892cd['length'];if(!_0x4407ee['query']['hasOwnProperty'](_0xe7fb('0x4e'))){_0x2139e3[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x4407ee[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x2139e3[_0xe7fb('0x12')]=qs['offset'](_0x4407ee[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}return _0x23e1db[_0xe7fb('0x87')](_0x2139e3);}})['then'](function(_0x3c56ad){return _0x3c56ad?{'count':_0x2a2fa6,'rows':_0x3c56ad}:null;})['then'](respondWithResult(_0x56869b,null))[_0xe7fb('0x2e')](handleError(_0x56869b,null));};exports['getLists']=function(_0x4880a7,_0x27669f){var _0x3d8b9a={};var _0x3503ac={};var _0x413843;var _0x55ce0f;return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0x4880a7[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x27669f,null))[_0xe7fb('0x18')](function(_0x21d9b0){if(_0x21d9b0){_0x413843=_0x21d9b0;_0x3503ac[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db[_0xe7fb('0x88')][_0xe7fb('0x26')]);_0x3503ac[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x4880a7[_0xe7fb('0x2b')]);_0x3503ac[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x3503ac[_0xe7fb('0x34')],_0x3503ac[_0xe7fb('0x2b')]);_0x3d8b9a['attributes']=_[_0xe7fb('0x33')](_0x3503ac[_0xe7fb('0x34')],qs['fields'](_0x4880a7[_0xe7fb('0x2b')][_0xe7fb('0x36')]));_0x3d8b9a[_0xe7fb('0x35')]=_0x3d8b9a['attributes'][_0xe7fb('0x37')]?_0x3d8b9a[_0xe7fb('0x35')]:_0x3503ac[_0xe7fb('0x34')];_0x3d8b9a[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0x4880a7[_0xe7fb('0x2b')]['sort']);_0x3d8b9a[_0xe7fb('0x29')]=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0x4880a7['query'],_0x3503ac[_0xe7fb('0x32')]));if(_0x4880a7[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0x3d8b9a[_0xe7fb('0x29')]=_['merge'](_0x3d8b9a[_0xe7fb('0x29')],{'$or':_[_0xe7fb('0x1e')](_0x3d8b9a[_0xe7fb('0x35')],function(_0x39ffed){var _0x47e833={};_0x47e833[_0x39ffed]={'$like':'%'+_0x4880a7['query'][_0xe7fb('0x1d')]+'%'};return _0x47e833;})});}_0x3d8b9a=_[_0xe7fb('0x39')]({},_0x3d8b9a,_0x4880a7[_0xe7fb('0x3a')]);return _0x413843[_0xe7fb('0x89')](_0x3d8b9a);}})['then'](function(_0x57750a){if(_0x57750a){_0x55ce0f=_0x57750a[_0xe7fb('0x37')];if(!_0x4880a7['query'][_0xe7fb('0x4d')]('nolimit')){_0x3d8b9a[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x4880a7[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x3d8b9a[_0xe7fb('0x12')]=qs[_0xe7fb('0x12')](_0x4880a7[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}return _0x413843[_0xe7fb('0x89')](_0x3d8b9a);}})[_0xe7fb('0x18')](function(_0x14014d){if(_0x14014d){return _0x14014d?{'count':_0x55ce0f,'rows':_0x14014d}:null;}})[_0xe7fb('0x18')](respondWithResult(_0x27669f,null))[_0xe7fb('0x2e')](handleError(_0x27669f,null));};exports[_0xe7fb('0x8a')]=function(_0x4d9a76,_0x23a49e){var _0x30651f=moment()[_0xe7fb('0x66')](_0xe7fb('0x8b'));var _0x582862,_0x5b6da5;return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x4d9a76[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x23a49e,null))['then'](function(_0x4e09d8){if(_0x4e09d8){_0x5b6da5=_0x4e09d8;return _0x4e09d8[_0xe7fb('0x8a')](_0x4d9a76[_0xe7fb('0x3d')][_0xe7fb('0x6b')],_[_0xe7fb('0x45')](_0x4d9a76[_0xe7fb('0x3d')],[_0xe7fb('0x6b'),'id'])||{});}return null;})[_0xe7fb('0x8c')](function(_0x2e2167){var _0xd7f440;_0x582862=_0x2e2167||[];var _0xc8055f=[];if(_0x2e2167){for(var _0x45b449=0x0;_0x45b449<_0x2e2167['length'];_0x45b449+=0x1){var _0x366c06=_0x2e2167[_0x45b449][_0xe7fb('0x1a')]({'plain':!![]});_0x5b6da5[_0xe7fb('0x8d')]=_0x4d9a76[_0xe7fb('0x3d')][_0xe7fb('0x8d')]?_0x4d9a76[_0xe7fb('0x3d')][_0xe7fb('0x8d')]:_0x5b6da5[_0xe7fb('0x8d')];switch(_0x5b6da5['dialCheckDuplicateType']){case _0xe7fb('0x8e'):_0xd7f440=squel[_0xe7fb('0x8f')]()[_0xe7fb('0x90')](_0xe7fb('0x91'))['fromQuery']([_0xe7fb('0x92'),_0xe7fb('0x93'),_0xe7fb('0x94'),_0xe7fb('0x95'),_0xe7fb('0x51'),_0xe7fb('0x47'),_0xe7fb('0x46')],squel[_0xe7fb('0x6d')]()['field'](_0xe7fb('0x92'),_0xe7fb('0x92'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x93'))['field']('id',_0xe7fb('0x94'))[_0xe7fb('0x6e')](_0x366c06[_0xe7fb('0x96')][_0xe7fb('0x75')](),_0xe7fb('0x95'))[_0xe7fb('0x6e')](_0x4d9a76[_0xe7fb('0x30')]['id']['toString'](),'VoiceQueueId')[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27','createdAt')['field']('\x27'+_0x30651f+'\x27',_0xe7fb('0x46'))[_0xe7fb('0x6f')]('cm_contacts')[_0xe7fb('0x29')](_0xe7fb('0x97'))['where'](_0xe7fb('0x98'),_0x366c06['CmListId'][_0xe7fb('0x75')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xe7fb('0x29')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xe7fb('0x6e')](_0xe7fb('0x99'))['from'](_0xe7fb('0x9a'))[_0xe7fb('0x29')](_0xe7fb('0x73'),_0x4d9a76[_0xe7fb('0x30')]['id'][_0xe7fb('0x75')]()))[_0xe7fb('0x29')](_0xe7fb('0x9b'),squel['select']()['field'](_0xe7fb('0x9c'))['from']('cm_hopper')[_0xe7fb('0x29')]('VoiceQueueId\x20=\x20?',_0x4d9a76['params']['id'][_0xe7fb('0x75')]())))['toString']();break;case _0xe7fb('0x9d'):_0xd7f440=squel[_0xe7fb('0x8f')]()[_0xe7fb('0x90')](_0xe7fb('0x91'))[_0xe7fb('0x9e')]([_0xe7fb('0x92'),'scheduledAt',_0xe7fb('0x94'),_0xe7fb('0x95'),_0xe7fb('0x51'),_0xe7fb('0x47'),_0xe7fb('0x46')],squel[_0xe7fb('0x6d')]()[_0xe7fb('0x6e')](_0xe7fb('0x92'),_0xe7fb('0x92'))['field']('\x27'+_0x30651f+'\x27',_0xe7fb('0x93'))[_0xe7fb('0x6e')]('id',_0xe7fb('0x94'))[_0xe7fb('0x6e')](_0x366c06[_0xe7fb('0x96')][_0xe7fb('0x75')](),_0xe7fb('0x95'))['field'](_0x4d9a76['params']['id']['toString'](),_0xe7fb('0x51'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x47'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x46'))[_0xe7fb('0x6f')](_0xe7fb('0x9f'))['where'](_0xe7fb('0x97'))[_0xe7fb('0x29')](_0xe7fb('0x98'),_0x366c06['CmListId']['toString']())[_0xe7fb('0x29')](_0xe7fb('0xa0'))[_0xe7fb('0x29')](_0xe7fb('0x9b'),squel[_0xe7fb('0x6d')]()[_0xe7fb('0x6e')](_0xe7fb('0x9c'))['from'](_0xe7fb('0x91'))[_0xe7fb('0x29')](_0xe7fb('0x73'),_0x4d9a76['params']['id'][_0xe7fb('0x75')]())))['toString']();break;default:_0xd7f440=squel[_0xe7fb('0x8f')]()['into'](_0xe7fb('0x91'))[_0xe7fb('0x9e')]([_0xe7fb('0x92'),_0xe7fb('0x93'),_0xe7fb('0x94'),'ListId',_0xe7fb('0x51'),'createdAt','updatedAt'],squel['select']()[_0xe7fb('0x6e')]('phone','phone')['field']('\x27'+_0x30651f+'\x27',_0xe7fb('0x93'))[_0xe7fb('0x6e')]('id','ContactId')[_0xe7fb('0x6e')](_0x366c06[_0xe7fb('0x96')]['toString'](),_0xe7fb('0x95'))['field'](_0x4d9a76[_0xe7fb('0x30')]['id'][_0xe7fb('0x75')](),_0xe7fb('0x51'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x47'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x46'))[_0xe7fb('0x6f')](_0xe7fb('0x9f'))['where'](_0xe7fb('0x97'))[_0xe7fb('0x29')](_0xe7fb('0x98'),_0x366c06[_0xe7fb('0x96')]['toString']())[_0xe7fb('0x29')](_0xe7fb('0xa0')))['toString']();}_0xc8055f['push'](db[_0xe7fb('0x5f')]['query'](_0xd7f440));}return BPromise[_0xe7fb('0x7a')](_0xc8055f);}})[_0xe7fb('0x18')](function(){var _0x20b22f=[];var _0x2e22c1=squel[_0xe7fb('0x8f')]()['into'](_0xe7fb('0xa1'))['fromQuery']([_0xe7fb('0xa2'),_0xe7fb('0x92'),_0xe7fb('0xa3'),'createdAt',_0xe7fb('0x46')],squel[_0xe7fb('0x6d')]()[_0xe7fb('0x6e')](_0xe7fb('0xa4'))[_0xe7fb('0x6e')]('ci.item')[_0xe7fb('0x6e')](_0xe7fb('0xa5'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x47'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x46'))[_0xe7fb('0x6f')](_0xe7fb('0xa6'),'ci')[_0xe7fb('0xa7')]('cm_hopper','h',_0xe7fb('0xa8'))[_0xe7fb('0x29')]('h.scheduledat=?',_0x30651f)[_0xe7fb('0x29')]('ci.ItemClass=?',_0xe7fb('0xa9')))[_0xe7fb('0x75')]();_0x20b22f[_0xe7fb('0x74')](db[_0xe7fb('0x5f')][_0xe7fb('0x2b')](_0x2e22c1));return BPromise[_0xe7fb('0x7a')](_0x20b22f);})[_0xe7fb('0x18')](function(){return _0x582862;})['then'](respondWithResult(_0x23a49e,null))[_0xe7fb('0x2e')](handleError(_0x23a49e,null));};exports[_0xe7fb('0xaa')]=function(_0x3c04f4,_0x290cc3){return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x3c04f4['params']['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x290cc3,null))[_0xe7fb('0x18')](function(_0x3ed48f){if(_0x3ed48f){return _0x3ed48f['removeLists'](_0x3c04f4[_0xe7fb('0x2b')][_0xe7fb('0x6b')]);}})[_0xe7fb('0x18')](function(_0x2eeff4){if(_0x2eeff4){return db[_0xe7fb('0x52')]['destroy']({'where':{'ListId':_0x3c04f4[_0xe7fb('0x2b')][_0xe7fb('0x6b')],'VoiceQueueId':_0x3c04f4[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](function(){return _0x2eeff4;});}})[_0xe7fb('0x18')](respondWithStatusCode(_0x290cc3,null))[_0xe7fb('0x2e')](handleError(_0x290cc3,null));};exports[_0xe7fb('0xab')]=function(_0xcaad94,_0x5b88bd){var _0x143dbb={};var _0x715444={};var _0x92a316;var _0x30a834;return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0xcaad94[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x5b88bd,null))[_0xe7fb('0x18')](function(_0x1b1818){if(_0x1b1818){_0x92a316=_0x1b1818;_0x715444[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db[_0xe7fb('0x88')][_0xe7fb('0x26')]);_0x715444[_0xe7fb('0x2b')]=_['keys'](_0xcaad94[_0xe7fb('0x2b')]);_0x715444[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x715444[_0xe7fb('0x34')],_0x715444[_0xe7fb('0x2b')]);_0x143dbb['attributes']=_[_0xe7fb('0x33')](_0x715444[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0xcaad94['query']['fields']));_0x143dbb[_0xe7fb('0x35')]=_0x143dbb[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x143dbb[_0xe7fb('0x35')]:_0x715444['model'];_0x143dbb[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0xcaad94[_0xe7fb('0x2b')][_0xe7fb('0x50')]);_0x143dbb['where']=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0xcaad94['query'],_0x715444[_0xe7fb('0x32')]));if(_0xcaad94[_0xe7fb('0x2b')]['filter']){_0x143dbb['where']=_[_0xe7fb('0x39')](_0x143dbb[_0xe7fb('0x29')],{'$or':_[_0xe7fb('0x1e')](_0x143dbb['attributes'],function(_0x3b2375){var _0x170347={};_0x170347[_0x3b2375]={'$like':'%'+_0xcaad94[_0xe7fb('0x2b')][_0xe7fb('0x1d')]+'%'};return _0x170347;})});}_0x143dbb=_['merge']({},_0x143dbb,_0xcaad94[_0xe7fb('0x3a')]);return _0x92a316[_0xe7fb('0xab')](_0x143dbb);}})[_0xe7fb('0x18')](function(_0x2a984e){if(_0x2a984e){_0x30a834=_0x2a984e[_0xe7fb('0x37')];if(!_0xcaad94[_0xe7fb('0x2b')]['hasOwnProperty']('nolimit')){_0x143dbb[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0xcaad94[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x143dbb[_0xe7fb('0x12')]=qs['offset'](_0xcaad94[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}return _0x92a316[_0xe7fb('0xab')](_0x143dbb);}})[_0xe7fb('0x18')](function(_0x286382){if(_0x286382){return _0x286382?{'count':_0x30a834,'rows':_0x286382}:null;}})[_0xe7fb('0x18')](respondWithResult(_0x5b88bd,null))[_0xe7fb('0x2e')](handleError(_0x5b88bd,null));};exports[_0xe7fb('0xac')]=function(_0x325c7b,_0x38472b){var _0x1a33f8;return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x325c7b[_0xe7fb('0x30')]['id']}})['then'](handleEntityNotFound(_0x38472b,null))[_0xe7fb('0x18')](function(_0x291a8d){if(_0x291a8d){return _0x291a8d['addBlackLists'](_0x325c7b[_0xe7fb('0x3d')]['ids'],_[_0xe7fb('0x45')](_0x325c7b[_0xe7fb('0x3d')],[_0xe7fb('0x6b'),'id'])||{});}return null;})[_0xe7fb('0x8c')](function(_0x3ade81){var _0x1b9ea2;_0x1a33f8=_0x3ade81||[];var _0x418561=[];if(_0x3ade81){for(var _0x3ec66a=0x0;_0x3ec66a<_0x3ade81[_0xe7fb('0x37')];_0x3ec66a+=0x1){var _0x1c76a1=_0x3ade81[_0x3ec66a][_0xe7fb('0x1a')]({'plain':!![]});_0x1b9ea2=squel[_0xe7fb('0x8f')]()[_0xe7fb('0x90')](_0xe7fb('0xad'))[_0xe7fb('0x9e')]([_0xe7fb('0x92'),_0xe7fb('0x94'),_0xe7fb('0x95'),_0xe7fb('0x51'),_0xe7fb('0x47'),_0xe7fb('0x46')],squel[_0xe7fb('0x6d')]()[_0xe7fb('0x6e')]('phone',_0xe7fb('0x92'))[_0xe7fb('0x6e')]('id',_0xe7fb('0x94'))['field'](_0x1c76a1[_0xe7fb('0x96')][_0xe7fb('0x75')](),_0xe7fb('0x95'))[_0xe7fb('0x6e')](_0x325c7b[_0xe7fb('0x30')]['id'][_0xe7fb('0x75')](),'VoiceQueueId')[_0xe7fb('0x6e')](_0xe7fb('0xae'),_0xe7fb('0x47'))[_0xe7fb('0x6e')]('NOW()',_0xe7fb('0x46'))[_0xe7fb('0x6f')](_0xe7fb('0x9f'))[_0xe7fb('0x29')]('deletedAt\x20IS\x20NULL')[_0xe7fb('0x29')](_0xe7fb('0x98'),_0x1c76a1[_0xe7fb('0x96')][_0xe7fb('0x75')]())[_0xe7fb('0x29')](_0xe7fb('0xa0')))['toString']();_0x418561[_0xe7fb('0x74')](db[_0xe7fb('0x5f')]['query'](_0x1b9ea2));}return BPromise[_0xe7fb('0x7a')](_0x418561);}})[_0xe7fb('0x18')](function(){return _0x1a33f8;})['then'](respondWithResult(_0x38472b,null))[_0xe7fb('0x2e')](handleError(_0x38472b,null));};exports['removeBlackLists']=function(_0x127051,_0x4d9376){return db[_0xe7fb('0x25')]['find']({'where':{'id':_0x127051['params']['id']}})['then'](handleEntityNotFound(_0x4d9376,null))['then'](function(_0x547d29){if(_0x547d29){return _0x547d29[_0xe7fb('0xaf')](_0x127051[_0xe7fb('0x2b')]['ids']);}})[_0xe7fb('0x18')](function(_0x5c0baf){if(_0x5c0baf){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x127051['query'][_0xe7fb('0x6b')],'VoiceQueueId':_0x127051[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](function(){return _0x5c0baf;});}})['then'](respondWithStatusCode(_0x4d9376,null))[_0xe7fb('0x2e')](handleError(_0x4d9376,null));}; \ No newline at end of file +var _0xa41a=['createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','CmHopper','filters','nolimit','order','sort','pick','VoiceQueueId','getHopperHistories','CmHopperHistory','hasOwnProperty','getHopperFinals','findOne','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','User','Agents','online','voicePause','interface','forEach','penalty','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','ids','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','removeTeams','isEmpty','removeAgents','addAgents','spread','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','CmListId','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./voiceQueue.socket','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','then','get','inbound','QueueCampaigns','filter','map','value','includes','type','find','name','UserProfileResource','destroy','error','stack','send','index','rawAttributes','key','where','include','VoiceQueue','findAll','rows','catch','params','model','query','keys','attributes','intersection','fields','length','merge','options','create','body','user','role','VoiceQueues','outbound','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit'];(function(_0x3ed719,_0x57aeb5){var _0x56ea0b=function(_0x56f767){while(--_0x56f767){_0x3ed719['push'](_0x3ed719['shift']());}};_0x56ea0b(++_0x57aeb5);}(_0xa41a,0x6b));var _0xaa41=function(_0x4a0119,_0x34c1ca){_0x4a0119=_0x4a0119-0x0;var _0x17ed1d=_0xa41a[_0x4a0119];return _0x17ed1d;};'use strict';var moment=require(_0xaa41('0x0'));var BPromise=require(_0xaa41('0x1'));var util=require('util');var _=require(_0xaa41('0x2'));var squel=require(_0xaa41('0x3'));var Redis=require(_0xaa41('0x4'));var qs=require(_0xaa41('0x5'));var logger=require(_0xaa41('0x6'))(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var db=require(_0xaa41('0x9'))['db'];config['redis']=_[_0xaa41('0xa')](config[_0xaa41('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa41('0xb')]));require(_0xaa41('0xc'))['register'](socket);function respondWithStatusCode(_0x31df43,_0x33f66b){_0x33f66b=_0x33f66b||0xcc;return function(_0x409dab){if(_0x409dab){return _0x31df43[_0xaa41('0xd')](_0x33f66b);}return _0x31df43[_0xaa41('0xe')](_0x33f66b)[_0xaa41('0xf')]();};}function respondWithResult(_0x806f08,_0x423a19){_0x423a19=_0x423a19||0xc8;return function(_0x1c291e){if(_0x1c291e){return _0x806f08['status'](_0x423a19)[_0xaa41('0x10')](_0x1c291e);}};}function respondWithFilteredResult(_0x10cda9,_0x524cab){return function(_0x54827c){if(_0x54827c){var _0x1d0a54=typeof _0x524cab['offset']===_0xaa41('0x11')&&typeof _0x524cab[_0xaa41('0x12')]===_0xaa41('0x11');var _0x889d44=_0x54827c[_0xaa41('0x13')];var _0x4eaf81=_0x1d0a54?0x0:_0x524cab[_0xaa41('0x14')];var _0x178170=_0x1d0a54?_0x54827c[_0xaa41('0x13')]:_0x524cab[_0xaa41('0x14')]+_0x524cab[_0xaa41('0x12')];var _0x2005ae;if(_0x178170>=_0x889d44){_0x178170=_0x889d44;_0x2005ae=0xc8;}else{_0x2005ae=0xce;}_0x10cda9[_0xaa41('0xe')](_0x2005ae);return _0x10cda9['set'](_0xaa41('0x15'),_0x4eaf81+'-'+_0x178170+'/'+_0x889d44)[_0xaa41('0x10')](_0x54827c);}return null;};}function saveUpdates(_0x4210fa){return function(_0x391b01){if(_0x391b01){return _0x391b01[_0xaa41('0x16')](_0x4210fa)[_0xaa41('0x17')](function(_0x29efe5){return _0x29efe5;});}return null;};}function removeEntity(_0x46e6d3){return function(_0x150ddf){if(_0x150ddf){return _0x150ddf['destroy']()['then'](function(){var _0x1f502a=_0x150ddf[_0xaa41('0x18')]({'plain':!![]});var _0x35c753=[{'name':'VoiceQueues','value':_0xaa41('0x19'),'ignore':![]},{'name':_0xaa41('0x1a'),'value':'outbound','ignore':![]}];var _0x513c61=_(_0x35c753)[_0xaa41('0x1b')]('ignore')[_0xaa41('0x1c')](_0xaa41('0x1d'))[_0xaa41('0x1d')]();if(_[_0xaa41('0x1e')](_0x513c61,_0x1f502a[_0xaa41('0x1f')])){return;}var _0x4eb01f=_[_0xaa41('0x20')](_0x35c753,[_0xaa41('0x1d'),_0x1f502a[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db[_0xaa41('0x22')][_0xaa41('0x23')]({'where':{'type':_0x4eb01f,'resourceId':_0x1f502a['id']}})['then'](function(){return _0x150ddf;});})['then'](function(){_0x46e6d3[_0xaa41('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x493a10){return function(_0x12e362){if(!_0x12e362){_0x493a10['sendStatus'](0x194);}return _0x12e362;};}function handleError(_0x536bed,_0x2d0ac0){_0x2d0ac0=_0x2d0ac0||0x1f4;return function(_0x9c8c21){logger[_0xaa41('0x24')](_0x9c8c21[_0xaa41('0x25')]);if(_0x9c8c21[_0xaa41('0x21')]){delete _0x9c8c21[_0xaa41('0x21')];}_0x536bed['status'](_0x2d0ac0)[_0xaa41('0x26')](_0x9c8c21);};}exports[_0xaa41('0x27')]=function(_0x63c18c,_0x9a16e3){var _0x1d8c2b={};var _0x4466a3={'count':0x0,'rows':[]};var _0x30f88e=_[_0xaa41('0x1c')](db['VoiceQueue'][_0xaa41('0x28')],function(_0x48b48b){return{'name':_0x48b48b['fieldName'],'type':_0x48b48b[_0xaa41('0x1f')][_0xaa41('0x29')]};});_0x1d8c2b=qs['getOptions'](_0x30f88e,_0x63c18c);var _0x392b5d={'where':_0x1d8c2b[_0xaa41('0x2a')]};return db['VoiceQueue']['count'](_0x392b5d)['then'](function(_0x1cf3da){_0x4466a3[_0xaa41('0x13')]=_0x1cf3da;_0x1d8c2b[_0xaa41('0x2b')]=qs[_0xaa41('0x2b')](_0x63c18c['query']);return db[_0xaa41('0x2c')][_0xaa41('0x2d')](_0x1d8c2b);})[_0xaa41('0x17')](function(_0x4de770){_0x4466a3[_0xaa41('0x2e')]=_0x4de770;return _0x4466a3;})[_0xaa41('0x17')](respondWithFilteredResult(_0x9a16e3,_0x1d8c2b))[_0xaa41('0x2f')](handleError(_0x9a16e3,null));};exports['show']=function(_0x252c62,_0x374117){var _0x57fe1d={'raw':![],'where':{'id':_0x252c62[_0xaa41('0x30')]['id']}},_0x23eb50={};_0x23eb50[_0xaa41('0x31')]=_['keys'](db[_0xaa41('0x2c')]['rawAttributes']);_0x23eb50[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x252c62[_0xaa41('0x32')]);_0x23eb50['filters']=_['intersection'](_0x23eb50['model'],_0x23eb50[_0xaa41('0x32')]);_0x57fe1d[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x23eb50[_0xaa41('0x31')],qs['fields'](_0x252c62['query'][_0xaa41('0x36')]));_0x57fe1d[_0xaa41('0x34')]=_0x57fe1d[_0xaa41('0x34')][_0xaa41('0x37')]?_0x57fe1d[_0xaa41('0x34')]:_0x23eb50[_0xaa41('0x31')];if(_0x252c62[_0xaa41('0x32')]['includeAll']){_0x57fe1d[_0xaa41('0x2b')]=[{'all':!![]}];}_0x57fe1d=_[_0xaa41('0x38')]({},_0x57fe1d,_0x252c62[_0xaa41('0x39')]);return db[_0xaa41('0x2c')]['find'](_0x57fe1d)['then'](handleEntityNotFound(_0x374117,null))[_0xaa41('0x17')](respondWithResult(_0x374117,null))[_0xaa41('0x2f')](handleError(_0x374117,null));};exports['create']=function(_0x4101ab,_0x563687){return db[_0xaa41('0x2c')][_0xaa41('0x3a')](_0x4101ab[_0xaa41('0x3b')],{})[_0xaa41('0x17')](function(_0x3e6cac){var _0x12ba1a=_0x4101ab[_0xaa41('0x3c')][_0xaa41('0x18')]({'plain':!![]});if(!_0x12ba1a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12ba1a[_0xaa41('0x3d')]===_0xaa41('0x3c')){var _0x35c685=_0x3e6cac[_0xaa41('0x18')]({'plain':!![]});var _0xc84fb8=[{'name':_0xaa41('0x3e'),'value':'inbound'},{'name':'QueueCampaigns','value':_0xaa41('0x3f')}];var _0x4f9086=_[_0xaa41('0x20')](_0xc84fb8,[_0xaa41('0x1d'),_0x35c685[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db[_0xaa41('0x40')][_0xaa41('0x20')]({'where':{'name':_0x4f9086,'userProfileId':_0x12ba1a[_0xaa41('0x41')]},'raw':!![]})['then'](function(_0x124992){if(_0x124992&&_0x124992['autoAssociation']===0x0){return db['UserProfileResource'][_0xaa41('0x3a')]({'name':_0x35c685['name'],'resourceId':_0x35c685['id'],'type':_0x124992['name'],'sectionId':_0x124992['id']},{})['then'](function(){return _0x3e6cac;});}else{return _0x3e6cac;}})[_0xaa41('0x2f')](function(_0x525b09){logger[_0xaa41('0x24')](_0xaa41('0x42'),_0x525b09);throw _0x525b09;});}return _0x3e6cac;})['then'](respondWithResult(_0x563687,0xc9))['catch'](handleError(_0x563687,null));};exports[_0xaa41('0x43')]=function(_0x1b7b97,_0x1bb973){var _0x2af8ba={'where':{'id':_0x1b7b97[_0xaa41('0x30')]['id']}},_0x3fe1a9={};_0x3fe1a9[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x2c')]['rawAttributes']);_0x2af8ba[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x3fe1a9[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x1b7b97[_0xaa41('0x32')][_0xaa41('0x36')]));_0x2af8ba['attributes']=_0x2af8ba[_0xaa41('0x34')][_0xaa41('0x37')]?_0x2af8ba[_0xaa41('0x34')]:_0x3fe1a9[_0xaa41('0x31')];if(_0x1b7b97['query'][_0xaa41('0x44')]){_0x2af8ba['include']=[{'all':!![]}];}_0x2af8ba=_['merge']({},_0x2af8ba,_0x1b7b97[_0xaa41('0x39')]);return db[_0xaa41('0x2c')][_0xaa41('0x20')](_0x2af8ba)['then'](handleEntityNotFound(_0x1bb973,null))[_0xaa41('0x17')](function(_0x3e1a73){if(_0x3e1a73){var _0x853ccb=_0x3e1a73['get']({'plain':!![]});_0x853ccb=qs[_0xaa41('0x45')](_0x853ccb,['id',_0xaa41('0x46'),_0xaa41('0x47')]);_0x1b7b97[_0xaa41('0x3b')]=_[_0xaa41('0x45')](_0x1b7b97[_0xaa41('0x3b')],['id',_0xaa41('0x46'),_0xaa41('0x47')]);return db['VoiceQueue'][_0xaa41('0x3a')](_['merge'](_0x853ccb,_0x1b7b97['body']),{'include':_0x1b7b97[_0xaa41('0x32')][_0xaa41('0x44')]?[{'all':!![]}]:undefined})[_0xaa41('0x17')](function(_0x11f7d9){var _0x14aab0=_0x1b7b97[_0xaa41('0x3c')][_0xaa41('0x18')]({'plain':!![]});if(!_0x14aab0)throw new Error(_0xaa41('0x48'));if(_0x14aab0['role']===_0xaa41('0x3c')){var _0x14b0f0=_0x11f7d9[_0xaa41('0x18')]({'plain':!![]});var _0x4f9e92=[{'name':_0xaa41('0x3e'),'value':_0xaa41('0x19')},{'name':'QueueCampaigns','value':_0xaa41('0x3f')}];var _0xd36d1a=_[_0xaa41('0x20')](_0x4f9e92,['value',_0x14b0f0[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db['UserProfileSection']['find']({'where':{'name':_0xd36d1a,'userProfileId':_0x14aab0[_0xaa41('0x41')]},'raw':!![]})[_0xaa41('0x17')](function(_0x3a29d2){if(_0x3a29d2&&_0x3a29d2['autoAssociation']===0x0){return db[_0xaa41('0x22')][_0xaa41('0x3a')]({'name':_0x14b0f0[_0xaa41('0x21')],'resourceId':_0x14b0f0['id'],'type':_0x3a29d2[_0xaa41('0x21')],'sectionId':_0x3a29d2['id']},{})[_0xaa41('0x17')](function(){return _0x11f7d9;});}else{return _0x11f7d9;}})['catch'](function(_0x2ae70c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ae70c);throw _0x2ae70c;});}return _0x11f7d9;});}})[_0xaa41('0x17')](respondWithResult(_0x1bb973,0xc9))['catch'](handleError(_0x1bb973,null));};exports[_0xaa41('0x16')]=function(_0xbbf261,_0x169ddf){if(_0xbbf261['body']['id']){delete _0xbbf261[_0xaa41('0x3b')]['id'];}return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0xbbf261[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x169ddf,null))[_0xaa41('0x17')](saveUpdates(_0xbbf261[_0xaa41('0x3b')],null))[_0xaa41('0x17')](respondWithResult(_0x169ddf,null))[_0xaa41('0x2f')](handleError(_0x169ddf,null));};exports['destroy']=function(_0x35a09e,_0x40cdfc){return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x35a09e[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x40cdfc,null))[_0xaa41('0x17')](removeEntity(_0x40cdfc,null))[_0xaa41('0x2f')](handleError(_0x40cdfc,null));};exports[_0xaa41('0x49')]=function(_0xfbe748,_0x320ce7){var _0x5ea056={'raw':![],'where':{}};var _0x55a85c={};var _0x5cb34d={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0xfbe748['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x320ce7,null))['then'](function(_0x576e6e){if(_0x576e6e){_0x55a85c[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x4a')][_0xaa41('0x28')]);_0x55a85c['query']=_[_0xaa41('0x33')](_0xfbe748[_0xaa41('0x32')]);_0x55a85c[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x55a85c[_0xaa41('0x31')],_0x55a85c[_0xaa41('0x32')]);_0x5ea056[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x55a85c[_0xaa41('0x31')],qs['fields'](_0xfbe748[_0xaa41('0x32')][_0xaa41('0x36')]));_0x5ea056['attributes']=_0x5ea056['attributes']['length']?_0x5ea056[_0xaa41('0x34')]:_0x55a85c['model'];if(!_0xfbe748[_0xaa41('0x32')]['hasOwnProperty'](_0xaa41('0x4c'))){_0x5ea056[_0xaa41('0x12')]=qs['limit'](_0xfbe748[_0xaa41('0x32')][_0xaa41('0x12')]);_0x5ea056[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0xfbe748['query']['offset']);}_0x5ea056[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xfbe748['query']['sort']);_0x5ea056[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xfbe748[_0xaa41('0x32')],_0x55a85c[_0xaa41('0x4b')]));_0x5ea056['where'][_0xaa41('0x50')]=_0x576e6e['id'];if(_0xfbe748['query']['filter']){_0x5ea056['where']=_[_0xaa41('0x38')](_0x5ea056[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x5ea056['attributes'],function(_0x229297){var _0x2adf93={};_0x2adf93[_0x229297]={'$like':'%'+_0xfbe748[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x2adf93;})});}_0x5ea056=_[_0xaa41('0x38')]({},_0x5ea056,_0xfbe748[_0xaa41('0x39')]);return db[_0xaa41('0x4a')]['count']({'where':_0x5ea056[_0xaa41('0x2a')]})[_0xaa41('0x17')](function(_0x40b47c){_0x5cb34d[_0xaa41('0x13')]=_0x40b47c;if(_0xfbe748['query'][_0xaa41('0x44')]){_0x5ea056['include']=[{'all':!![]}];}return db[_0xaa41('0x4a')][_0xaa41('0x2d')](_0x5ea056);})[_0xaa41('0x17')](function(_0x143ef0){_0x5cb34d['rows']=_0x143ef0;return _0x5cb34d;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x320ce7,_0x5ea056))[_0xaa41('0x2f')](handleError(_0x320ce7,null));};exports[_0xaa41('0x51')]=function(_0x304aad,_0x59052d){var _0x140d78={'raw':!![],'where':{}};var _0x50197b={};var _0x55d380={'count':0x0,'rows':[]};return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0x304aad[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x59052d,null))[_0xaa41('0x17')](function(_0x582d79){if(_0x582d79){_0x50197b[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x52')][_0xaa41('0x28')]);_0x50197b[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x304aad[_0xaa41('0x32')]);_0x50197b['filters']=_[_0xaa41('0x35')](_0x50197b[_0xaa41('0x31')],_0x50197b[_0xaa41('0x32')]);_0x140d78['attributes']=_['intersection'](_0x50197b[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x304aad['query'][_0xaa41('0x36')]));_0x140d78[_0xaa41('0x34')]=_0x140d78['attributes'][_0xaa41('0x37')]?_0x140d78[_0xaa41('0x34')]:_0x50197b[_0xaa41('0x31')];if(!_0x304aad[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x140d78[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x304aad['query']['limit']);_0x140d78[_0xaa41('0x14')]=qs['offset'](_0x304aad[_0xaa41('0x32')][_0xaa41('0x14')]);}_0x140d78[_0xaa41('0x4d')]=qs['sort'](_0x304aad[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x140d78[_0xaa41('0x2a')]=qs['filters'](_[_0xaa41('0x4f')](_0x304aad[_0xaa41('0x32')],_0x50197b['filters']));_0x140d78[_0xaa41('0x2a')]['VoiceQueueId']=_0x582d79['id'];if(_0x304aad['query'][_0xaa41('0x1b')]){_0x140d78[_0xaa41('0x2a')]=_['merge'](_0x140d78['where'],{'$or':_[_0xaa41('0x1c')](_0x140d78[_0xaa41('0x34')],function(_0x3c189d){var _0x447183={};_0x447183[_0x3c189d]={'$like':'%'+_0x304aad['query'][_0xaa41('0x1b')]+'%'};return _0x447183;})});}_0x140d78=_[_0xaa41('0x38')]({},_0x140d78,_0x304aad[_0xaa41('0x39')]);return db['CmHopperHistory'][_0xaa41('0x13')]({'where':_0x140d78[_0xaa41('0x2a')]})[_0xaa41('0x17')](function(_0x5697b6){_0x55d380[_0xaa41('0x13')]=_0x5697b6;if(_0x304aad['query']['includeAll']){_0x140d78[_0xaa41('0x2b')]=[{'all':!![]}];}return db[_0xaa41('0x52')]['findAll'](_0x140d78);})[_0xaa41('0x17')](function(_0x9e8ebb){_0x55d380[_0xaa41('0x2e')]=_0x9e8ebb;return _0x55d380;});}})['then'](respondWithFilteredResult(_0x59052d,_0x140d78))[_0xaa41('0x2f')](handleError(_0x59052d,null));};exports[_0xaa41('0x54')]=function(_0x1a2deb,_0x16dcac){var _0x38f5d0={'raw':!![],'where':{}};var _0x4e087d={};var _0x24eb2e={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xaa41('0x55')]({'where':{'id':_0x1a2deb[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x16dcac,null))[_0xaa41('0x17')](function(_0x33ec81){if(_0x33ec81){_0x4e087d[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x56')][_0xaa41('0x28')]);_0x4e087d[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x1a2deb['query']);_0x4e087d[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x4e087d['model'],_0x4e087d[_0xaa41('0x32')]);_0x38f5d0['attributes']=_[_0xaa41('0x35')](_0x4e087d[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x36')]));_0x38f5d0[_0xaa41('0x34')]=_0x38f5d0[_0xaa41('0x34')]['length']?_0x38f5d0[_0xaa41('0x34')]:_0x4e087d[_0xaa41('0x31')];if(!_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x53')]('nolimit')){_0x38f5d0[_0xaa41('0x12')]=qs['limit'](_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x12')]);_0x38f5d0[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x1a2deb[_0xaa41('0x32')]['offset']);}_0x38f5d0[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x1a2deb['query'][_0xaa41('0x4e')]);_0x38f5d0[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x1a2deb[_0xaa41('0x32')],_0x4e087d[_0xaa41('0x4b')]));_0x38f5d0[_0xaa41('0x2a')][_0xaa41('0x50')]=_0x33ec81['id'];if(_0x1a2deb['query'][_0xaa41('0x1b')]){_0x38f5d0[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x38f5d0[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x38f5d0[_0xaa41('0x34')],function(_0x5489be){var _0x56f5ff={};_0x56f5ff[_0x5489be]={'$like':'%'+_0x1a2deb['query'][_0xaa41('0x1b')]+'%'};return _0x56f5ff;})});}_0x38f5d0=_[_0xaa41('0x38')]({},_0x38f5d0,_0x1a2deb['options']);return db[_0xaa41('0x56')][_0xaa41('0x13')]({'where':_0x38f5d0['where']})[_0xaa41('0x17')](function(_0x1da898){_0x24eb2e[_0xaa41('0x13')]=_0x1da898;if(_0x1a2deb[_0xaa41('0x32')]['includeAll']){_0x38f5d0[_0xaa41('0x2b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xaa41('0x2d')](_0x38f5d0);})[_0xaa41('0x17')](function(_0x374873){_0x24eb2e[_0xaa41('0x2e')]=_0x374873;return _0x24eb2e;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x16dcac,_0x38f5d0))[_0xaa41('0x2f')](handleError(_0x16dcac,null));};exports[_0xaa41('0x57')]=function(_0x27363e,_0x25cac8){var _0x5381d5={'raw':!![],'where':{}};var _0x276013={};var _0x3135c3={'count':0x0,'rows':[]};return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0x27363e[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x25cac8,null))[_0xaa41('0x17')](function(_0x408d95){if(_0x408d95){_0x276013[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x58')][_0xaa41('0x28')]);_0x276013[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x27363e[_0xaa41('0x32')]);_0x276013['filters']=_[_0xaa41('0x35')](_0x276013[_0xaa41('0x31')],_0x276013[_0xaa41('0x32')]);_0x5381d5[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x276013['model'],qs['fields'](_0x27363e[_0xaa41('0x32')][_0xaa41('0x36')]));_0x5381d5['attributes']=_0x5381d5[_0xaa41('0x34')][_0xaa41('0x37')]?_0x5381d5['attributes']:_0x276013['model'];if(!_0x27363e['query'][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x5381d5[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x27363e[_0xaa41('0x32')][_0xaa41('0x12')]);_0x5381d5[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x27363e[_0xaa41('0x32')][_0xaa41('0x14')]);}_0x5381d5[_0xaa41('0x4d')]=qs['sort'](_0x27363e['query'][_0xaa41('0x4e')]);_0x5381d5[_0xaa41('0x2a')]=qs['filters'](_[_0xaa41('0x4f')](_0x27363e['query'],_0x276013[_0xaa41('0x4b')]));_0x5381d5[_0xaa41('0x2a')][_0xaa41('0x50')]=_0x408d95['id'];if(_0x27363e[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x5381d5[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x5381d5[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x5381d5['attributes'],function(_0x56bd21){var _0x56661a={};_0x56661a[_0x56bd21]={'$like':'%'+_0x27363e[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x56661a;})});}_0x5381d5=_['merge']({},_0x5381d5,_0x27363e['options']);return db[_0xaa41('0x58')][_0xaa41('0x13')]({'where':_0x5381d5['where']})['then'](function(_0xf651b7){_0x3135c3['count']=_0xf651b7;if(_0x27363e[_0xaa41('0x32')][_0xaa41('0x44')]){_0x5381d5[_0xaa41('0x2b')]=[{'all':!![]}];}return db[_0xaa41('0x58')][_0xaa41('0x2d')](_0x5381d5);})[_0xaa41('0x17')](function(_0x211455){_0x3135c3[_0xaa41('0x2e')]=_0x211455;return _0x3135c3;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x25cac8,_0x5381d5))['catch'](handleError(_0x25cac8,null));};exports['getTeams']=function(_0x38884d,_0x25d938){var _0x337655={};var _0x415705={};var _0x3efb43;var _0xae746;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0x38884d[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x25d938,null))[_0xaa41('0x17')](function(_0x17442e){if(_0x17442e){_0x3efb43=_0x17442e;_0x415705[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x59')]['rawAttributes']);_0x415705[_0xaa41('0x32')]=_['keys'](_0x38884d[_0xaa41('0x32')]);_0x415705[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x415705[_0xaa41('0x31')],_0x415705[_0xaa41('0x32')]);_0x337655[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x415705[_0xaa41('0x31')],qs['fields'](_0x38884d[_0xaa41('0x32')][_0xaa41('0x36')]));_0x337655[_0xaa41('0x34')]=_0x337655[_0xaa41('0x34')][_0xaa41('0x37')]?_0x337655[_0xaa41('0x34')]:_0x415705[_0xaa41('0x31')];_0x337655[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x38884d[_0xaa41('0x32')]['sort']);_0x337655['where']=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x38884d[_0xaa41('0x32')],_0x415705[_0xaa41('0x4b')]));if(_0x38884d[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x337655[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x337655[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x337655['attributes'],function(_0x49b468){var _0x17018e={};_0x17018e[_0x49b468]={'$like':'%'+_0x38884d[_0xaa41('0x32')]['filter']+'%'};return _0x17018e;})});}_0x337655=_[_0xaa41('0x38')]({},_0x337655,_0x38884d['options']);return _0x3efb43[_0xaa41('0x5a')](_0x337655);}})[_0xaa41('0x17')](function(_0x50e03d){if(_0x50e03d){_0xae746=_0x50e03d['length'];if(!_0x38884d[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x337655['limit']=qs['limit'](_0x38884d[_0xaa41('0x32')]['limit']);_0x337655[_0xaa41('0x14')]=qs['offset'](_0x38884d[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x3efb43[_0xaa41('0x5a')](_0x337655);}})[_0xaa41('0x17')](function(_0x182b0b){if(_0x182b0b){return _0x182b0b?{'count':_0xae746,'rows':_0x182b0b}:null;}})[_0xaa41('0x17')](respondWithResult(_0x25d938,null))[_0xaa41('0x2f')](handleError(_0x25d938,null));};exports['addTeams']=function(_0x4363b5,_0x1fa1f5){var _0x50883c=_0x4363b5[_0xaa41('0x3b')][_0xaa41('0x5b')];var _0x1c3d7f=_[_0xaa41('0x1c')](_0x50883c,'id');return db['Team'][_0xaa41('0x2d')]({'where':{'id':_0x1c3d7f},'attributes':['id'],'include':[{'model':db[_0xaa41('0x5c')],'as':_0xaa41('0x5d'),'attributes':['id',_0xaa41('0x21'),_0xaa41('0x5e'),_0xaa41('0x5f'),_0xaa41('0x60')],'raw':!![]}]})[_0xaa41('0x17')](function(_0xe2574a){if(_0xe2574a){var _0x4d83ce=_['flatMap'](_0xe2574a,function(_0x214ebe){var _0x2df75c=_0x214ebe[_0xaa41('0x18')]({'plain':!![]});_0x2df75c[_0xaa41('0x5d')][_0xaa41('0x61')](function(_0x401586){_0x401586['penalty']=_[_0xaa41('0x20')](_0x50883c,{'id':_0x2df75c['id']})[_0xaa41('0x62')];});return _0x2df75c[_0xaa41('0x5d')];});return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x4363b5[_0xaa41('0x30')]['id']}})['then'](function(_0xe8076e){return db[_0xaa41('0x63')][_0xaa41('0x64')](function(_0x4cf0c5){return _0xe8076e[_0xaa41('0x65')](_0x1c3d7f,{'transaction':_0x4cf0c5})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_0x50883c,function(_0x255e76){return db[_0xaa41('0x67')][_0xaa41('0x68')]({'TeamId':_0x255e76['id'],'VoiceQueueId':_0x4363b5[_0xaa41('0x30')]['id'],'penalty':_0x255e76[_0xaa41('0x62')]},{'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_0x4d83ce,function(_0x19a42c){return db[_0xaa41('0x69')][_0xaa41('0x6a')]({'where':{'UserId':_0x19a42c['id'],'VoiceQueueId':_0x4363b5['params']['id']},'defaults':{'penalty':_0x19a42c['penalty']},'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_[_0xaa41('0x1b')](_0x4d83ce,{'online':!![]}),function(_0x2c4595){return db[_0xaa41('0x6b')][_0xaa41('0x68')]({'membername':_0x2c4595[_0xaa41('0x21')],'UserId':_0x2c4595['id'],'queue_name':_0xe8076e['name'],'VoiceQueueId':_0xe8076e['id'],'interface':_[_0xaa41('0x6c')](_0x2c4595[_0xaa41('0x60')])?util[_0xaa41('0x6d')](_0xaa41('0x6e'),_0x2c4595[_0xaa41('0x21')]):_0x2c4595[_0xaa41('0x60')],'paused':_0x2c4595[_0xaa41('0x5f')]||![],'penalty':_0x2c4595[_0xaa41('0x62')]},{'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){_0x4d83ce[_0xaa41('0x61')](function(_0x3f2dbb){socket[_0xaa41('0x6f')]('userVoiceQueue:save',{'UserId':_0x3f2dbb['id'],'VoiceQueueId':_0xe8076e['id']});});});});});}})[_0xaa41('0x17')](respondWithStatusCode(_0x1fa1f5,null))[_0xaa41('0x2f')](handleError(_0x1fa1f5,null));};exports['removeTeams']=function(_0x33f008,_0x1489fe){return db[_0xaa41('0x59')][_0xaa41('0x2d')]({'where':{'id':_0x33f008['query'][_0xaa41('0x70')]},'attributes':['id'],'include':[{'model':db[_0xaa41('0x5c')],'as':_0xaa41('0x5d'),'attributes':['id'],'raw':!![]}]})[_0xaa41('0x17')](handleEntityNotFound(_0x1489fe,null))[_0xaa41('0x17')](function(_0x4baae3){var _0xc59a12=_['map'](_0x4baae3,'id');var _0x50a526=[];var _0x3dd3fa=[];var _0x552493=squel['select']();_0x552493[_0xaa41('0x71')](_0xaa41('0x72'))[_0xaa41('0x73')]('team_has_voice_queues','tq')[_0xaa41('0x74')](_0xaa41('0x75'),'ut',_0xaa41('0x76'))[_0xaa41('0x2a')](_0xaa41('0x77'),_0x33f008[_0xaa41('0x30')]['id']);for(var _0x29d34a=0x0;_0x29d34a<_0x4baae3[_0xaa41('0x37')];_0x29d34a+=0x1){let _0x48e2cf=_0x4baae3[_0x29d34a];for(var _0x410d6e=0x0;_0x410d6e<_0x48e2cf[_0xaa41('0x5d')][_0xaa41('0x37')];_0x410d6e+=0x1){let _0x3361f5=_0x48e2cf[_0xaa41('0x5d')][_0x410d6e];var _0x4f1bcb=_0x552493['clone']();_0x4f1bcb[_0xaa41('0x2a')](_0xaa41('0x78'),_0x3361f5['id']);_0x3dd3fa[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x4f1bcb[_0xaa41('0x7a')](),{'type':db['sequelize'][_0xaa41('0x7b')][_0xaa41('0x7c')]})['then'](function(_0x40f4ce){if(_0x40f4ce[_0xaa41('0x37')]===0x1){return _0x3361f5['id'];}else{var _0x95300a=_[_0xaa41('0x7d')](_[_0xaa41('0x1c')](_0x40f4ce,_0xaa41('0x7e')),function(_0x1926bd){return _['includes'](_0xc59a12,_0x1926bd);});if(_0x95300a){return _0x3361f5['id'];}}}));}}return BPromise[_0xaa41('0x7f')](_0x3dd3fa)[_0xaa41('0x17')](function(_0x5404cd){_0x50a526=_(_0x50a526)[_0xaa41('0x80')](_0x5404cd)[_0xaa41('0x81')]()[_0xaa41('0x1d')]();return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x33f008[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(_0x339537){return db[_0xaa41('0x63')][_0xaa41('0x64')](function(_0x4b84bc){return _0x339537[_0xaa41('0x82')](_0x33f008[_0xaa41('0x32')]['ids'],{'transaction':_0x4b84bc})['then'](function(){if(!_[_0xaa41('0x83')](_0x50a526)){return _0x339537[_0xaa41('0x84')](_0x50a526,{'transaction':_0x4b84bc})[_0xaa41('0x17')](function(){return db[_0xaa41('0x6b')][_0xaa41('0x23')]({'where':{'VoiceQueueId':_0x33f008[_0xaa41('0x30')]['id'],'UserId':_0x50a526},'transaction':_0x4b84bc});});}})['then'](function(){_0x50a526['forEach'](function(_0x395323){socket[_0xaa41('0x6f')]('userVoiceQueue:remove',{'UserId':_0x395323,'VoiceQueueId':_0x339537['id']});});});});});});})['then'](respondWithStatusCode(_0x1489fe,null))[_0xaa41('0x2f')](handleError(_0x1489fe,null));};exports[_0xaa41('0x85')]=function(_0x2fe50f,_0x520b50){var _0x50122d,_0x1d609e;return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x2fe50f['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x520b50,null))[_0xaa41('0x17')](function(_0x5a0791){if(_0x5a0791){_0x1d609e=_0x5a0791;return _0x5a0791['addAgents'](_0x2fe50f[_0xaa41('0x3b')]['ids'],_[_0xaa41('0x45')](_0x2fe50f[_0xaa41('0x3b')],[_0xaa41('0x70'),'id'])||{})[_0xaa41('0x86')](function(_0x1d7c2e){for(var _0xdc0493=0x0;_0xdc0493<_0x2fe50f[_0xaa41('0x3b')]['ids'][_0xaa41('0x37')];_0xdc0493+=0x1){socket[_0xaa41('0x6f')]('userVoiceQueue:save',{'UserId':Number(_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x70')][_0xdc0493]),'VoiceQueueId':Number(_0x2fe50f[_0xaa41('0x30')]['id'])});}return _0x1d7c2e;});}})[_0xaa41('0x17')](function(_0x2af16e){_0x50122d=_0x2af16e||[];if(_0x1d609e){return db[_0xaa41('0x5c')]['findAll']({'where':{'id':_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x70')]},'attributes':['id',_0xaa41('0x21'),_0xaa41('0x5e'),_0xaa41('0x5f'),_0xaa41('0x60')],'raw':!![]});}})[_0xaa41('0x17')](function(_0x5083ff){if(!_[_0xaa41('0x83')](_0x5083ff)){var _0x3c4e89=[];for(var _0x415acc=0x0;_0x415acc<_0x5083ff['length'];_0x415acc++){if(_0x5083ff[_0x415acc]['online']){_0x3c4e89['push'](db[_0xaa41('0x6b')][_0xaa41('0x68')]({'membername':_0x5083ff[_0x415acc][_0xaa41('0x21')],'UserId':_0x5083ff[_0x415acc]['id'],'queue_name':_0x1d609e[_0xaa41('0x21')],'VoiceQueueId':_0x1d609e['id'],'interface':_[_0xaa41('0x6c')](_0x5083ff[_0x415acc]['interface'])?util[_0xaa41('0x6d')](_0xaa41('0x6e'),_0x5083ff[_0x415acc][_0xaa41('0x21')]):_0x5083ff[_0x415acc][_0xaa41('0x60')],'paused':_0x5083ff[_0x415acc][_0xaa41('0x5f')]||![],'penalty':_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x62')]||0x0}));}}return BPromise['all'](_0x3c4e89);}})[_0xaa41('0x17')](function(){return _0x50122d;})[_0xaa41('0x17')](respondWithResult(_0x520b50,null))[_0xaa41('0x2f')](handleError(_0x520b50,null));};exports['removeAgents']=function(_0x16a173,_0x53a519){return db['VoiceQueue'][_0xaa41('0x20')]({'where':{'id':_0x16a173['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x53a519,null))[_0xaa41('0x17')](function(_0x366705){if(_0x366705){return _0x366705[_0xaa41('0x84')](_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')])[_0xaa41('0x17')](function(){if(_['isArray'](_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')])){for(var _0x3ee9e3=0x0;_0x3ee9e3<_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')][_0xaa41('0x37')];_0x3ee9e3+=0x1){socket[_0xaa41('0x6f')](_0xaa41('0x87'),{'UserId':Number(_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')][_0x3ee9e3]),'VoiceQueueId':Number(_0x16a173[_0xaa41('0x30')]['id'])});}}else{socket[_0xaa41('0x6f')](_0xaa41('0x87'),{'UserId':Number(_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')]),'VoiceQueueId':Number(_0x16a173[_0xaa41('0x30')]['id'])});}});}})['then'](function(_0x29b27e){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x16a173['params']['id'],'UserId':_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')]}})['then'](function(){return _0x29b27e;});})[_0xaa41('0x17')](respondWithStatusCode(_0x53a519,null))[_0xaa41('0x2f')](handleError(_0x53a519,null));};exports[_0xaa41('0x88')]=function(_0x15bb60,_0x232732){var _0x34d857={};var _0x239f1b={};var _0x445925;var _0x1e8591;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0x15bb60[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x232732,null))[_0xaa41('0x17')](function(_0x7bae82){if(_0x7bae82){_0x445925=_0x7bae82;_0x239f1b[_0xaa41('0x31')]=_[_0xaa41('0x33')](db['User'][_0xaa41('0x28')]);_0x239f1b[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x15bb60[_0xaa41('0x32')]);_0x239f1b['filters']=_[_0xaa41('0x35')](_0x239f1b[_0xaa41('0x31')],_0x239f1b['query']);_0x34d857[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x239f1b[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x15bb60[_0xaa41('0x32')][_0xaa41('0x36')]));_0x34d857[_0xaa41('0x34')]=_0x34d857[_0xaa41('0x34')][_0xaa41('0x37')]?_0x34d857[_0xaa41('0x34')]:_0x239f1b['model'];_0x34d857[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x15bb60[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x34d857[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_['pick'](_0x15bb60[_0xaa41('0x32')],_0x239f1b['filters']));if(_0x15bb60[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x34d857[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x34d857[_0xaa41('0x2a')],{'$or':_['map'](_0x34d857[_0xaa41('0x34')],function(_0x345002){var _0x5f39b4={};_0x5f39b4[_0x345002]={'$like':'%'+_0x15bb60[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x5f39b4;})});}_0x34d857=_[_0xaa41('0x38')]({},_0x34d857,_0x15bb60[_0xaa41('0x39')]);return _0x445925[_0xaa41('0x88')](_0x34d857);}})[_0xaa41('0x17')](function(_0x38b3be){if(_0x38b3be){_0x1e8591=_0x38b3be[_0xaa41('0x37')];if(!_0x15bb60[_0xaa41('0x32')][_0xaa41('0x53')]('nolimit')){_0x34d857[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x15bb60[_0xaa41('0x32')]['limit']);_0x34d857['offset']=qs[_0xaa41('0x14')](_0x15bb60['query']['offset']);}return _0x445925[_0xaa41('0x88')](_0x34d857);}})[_0xaa41('0x17')](function(_0xa4dbd3){if(_0xa4dbd3){return _0xa4dbd3?{'count':_0x1e8591,'rows':_0xa4dbd3}:null;}})[_0xaa41('0x17')](respondWithResult(_0x232732,null))['catch'](handleError(_0x232732,null));};exports['getMembers']=function(_0xa63e60,_0xf4f13f){var _0xef0e44={};var _0x46d37f={};var _0x6a6081;var _0x5e3bb2;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0xa63e60['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0xf4f13f,null))[_0xaa41('0x17')](function(_0x4b4a4a){if(_0x4b4a4a){_0x6a6081=_0x4b4a4a;_0x46d37f[_0xaa41('0x31')]=_[_0xaa41('0x33')](db['UserVoiceQueueRt'][_0xaa41('0x28')]);_0x46d37f[_0xaa41('0x32')]=_['keys'](_0xa63e60[_0xaa41('0x32')]);_0x46d37f['filters']=_['intersection'](_0x46d37f[_0xaa41('0x31')],_0x46d37f[_0xaa41('0x32')]);_0xef0e44[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x46d37f[_0xaa41('0x31')],qs['fields'](_0xa63e60[_0xaa41('0x32')]['fields']));_0xef0e44['attributes']=_0xef0e44[_0xaa41('0x34')][_0xaa41('0x37')]?_0xef0e44[_0xaa41('0x34')]:_0x46d37f[_0xaa41('0x31')];_0xef0e44[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xa63e60[_0xaa41('0x32')]['sort']);_0xef0e44[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xa63e60[_0xaa41('0x32')],_0x46d37f[_0xaa41('0x4b')]));if(_0xa63e60[_0xaa41('0x32')][_0xaa41('0x1b')]){_0xef0e44[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0xef0e44[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0xef0e44[_0xaa41('0x34')],function(_0x5a2ba0){var _0x4fc7d6={};_0x4fc7d6[_0x5a2ba0]={'$like':'%'+_0xa63e60[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x4fc7d6;})});}_0xef0e44=_[_0xaa41('0x38')]({},_0xef0e44,_0xa63e60['options']);return _0x6a6081[_0xaa41('0x89')](_0xef0e44);}})[_0xaa41('0x17')](function(_0x15bc15){if(_0x15bc15){_0x5e3bb2=_0x15bc15[_0xaa41('0x37')];if(!_0xa63e60[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0xef0e44[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0xa63e60[_0xaa41('0x32')][_0xaa41('0x12')]);_0xef0e44[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0xa63e60[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x6a6081['getMembers'](_0xef0e44);}})[_0xaa41('0x17')](function(_0x28c109){return _0x28c109?{'count':_0x5e3bb2,'rows':_0x28c109}:null;})[_0xaa41('0x17')](respondWithResult(_0xf4f13f,null))['catch'](handleError(_0xf4f13f,null));};exports[_0xaa41('0x8a')]=function(_0xfc1e24,_0x35c48f){var _0x2b0bf9={};var _0x21c0c6={};var _0x1138d0;var _0x394987;return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0xfc1e24[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x35c48f,null))[_0xaa41('0x17')](function(_0x2fc4b1){if(_0x2fc4b1){_0x1138d0=_0x2fc4b1;_0x21c0c6[_0xaa41('0x31')]=_['keys'](db[_0xaa41('0x8b')]['rawAttributes']);_0x21c0c6[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0xfc1e24[_0xaa41('0x32')]);_0x21c0c6[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x21c0c6[_0xaa41('0x31')],_0x21c0c6[_0xaa41('0x32')]);_0x2b0bf9[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x21c0c6[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0xfc1e24[_0xaa41('0x32')]['fields']));_0x2b0bf9['attributes']=_0x2b0bf9[_0xaa41('0x34')][_0xaa41('0x37')]?_0x2b0bf9[_0xaa41('0x34')]:_0x21c0c6[_0xaa41('0x31')];_0x2b0bf9[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xfc1e24['query'][_0xaa41('0x4e')]);_0x2b0bf9['where']=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xfc1e24[_0xaa41('0x32')],_0x21c0c6[_0xaa41('0x4b')]));if(_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x2b0bf9['where']=_['merge'](_0x2b0bf9[_0xaa41('0x2a')],{'$or':_['map'](_0x2b0bf9[_0xaa41('0x34')],function(_0x3f8296){var _0x438fcf={};_0x438fcf[_0x3f8296]={'$like':'%'+_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x438fcf;})});}_0x2b0bf9=_[_0xaa41('0x38')]({},_0x2b0bf9,_0xfc1e24[_0xaa41('0x39')]);return _0x1138d0[_0xaa41('0x8a')](_0x2b0bf9);}})[_0xaa41('0x17')](function(_0x2667bd){if(_0x2667bd){_0x394987=_0x2667bd[_0xaa41('0x37')];if(!_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x2b0bf9['limit']=qs[_0xaa41('0x12')](_0xfc1e24['query'][_0xaa41('0x12')]);_0x2b0bf9['offset']=qs[_0xaa41('0x14')](_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x1138d0[_0xaa41('0x8a')](_0x2b0bf9);}})[_0xaa41('0x17')](function(_0x3dafc6){if(_0x3dafc6){return _0x3dafc6?{'count':_0x394987,'rows':_0x3dafc6}:null;}})[_0xaa41('0x17')](respondWithResult(_0x35c48f,null))['catch'](handleError(_0x35c48f,null));};exports[_0xaa41('0x8c')]=function(_0x533f4b,_0x47ca9d){var _0xd1f9ba=moment()[_0xaa41('0x6d')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2c4930,_0x1285ed;return db['VoiceQueue'][_0xaa41('0x20')]({'where':{'id':_0x533f4b[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x47ca9d,null))['then'](function(_0x3ecde6){if(_0x3ecde6){_0x1285ed=_0x3ecde6;return _0x3ecde6['addLists'](_0x533f4b[_0xaa41('0x3b')][_0xaa41('0x70')],_[_0xaa41('0x45')](_0x533f4b[_0xaa41('0x3b')],['ids','id'])||{});}return null;})[_0xaa41('0x86')](function(_0x32a07e){var _0x2b8b73;_0x2c4930=_0x32a07e||[];var _0x49e4a5=[];if(_0x32a07e){for(var _0xda8e73=0x0;_0xda8e73<_0x32a07e[_0xaa41('0x37')];_0xda8e73+=0x1){var _0x25f5ba=_0x32a07e[_0xda8e73][_0xaa41('0x18')]({'plain':!![]});_0x1285ed[_0xaa41('0x8d')]=_0x533f4b[_0xaa41('0x3b')][_0xaa41('0x8d')]?_0x533f4b[_0xaa41('0x3b')]['dialCheckDuplicateType']:_0x1285ed[_0xaa41('0x8d')];switch(_0x1285ed['dialCheckDuplicateType']){case _0xaa41('0x8e'):_0x2b8b73=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')](_0xaa41('0x91'))[_0xaa41('0x92')]([_0xaa41('0x93'),_0xaa41('0x94'),_0xaa41('0x95'),_0xaa41('0x96'),_0xaa41('0x50'),_0xaa41('0x46'),_0xaa41('0x47')],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')](),'ListId')[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))['where']('deletedAt\x20IS\x20NULL')['where'](_0xaa41('0x9a'),_0x25f5ba[_0xaa41('0x98')]['toString']())[_0xaa41('0x2a')](_0xaa41('0x9b'))['where'](_0xaa41('0x9c'),squel['select']()[_0xaa41('0x71')](_0xaa41('0x9d'))[_0xaa41('0x73')](_0xaa41('0x9e'))[_0xaa41('0x2a')]('VoiceQueueId\x20=\x20?',_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')]()))[_0xaa41('0x2a')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xaa41('0x71')](_0xaa41('0x9f'))['from'](_0xaa41('0x91'))[_0xaa41('0x2a')](_0xaa41('0x77'),_0x533f4b['params']['id'][_0xaa41('0x7a')]())))[_0xaa41('0x7a')]();break;case _0xaa41('0xa0'):_0x2b8b73=squel['insert']()[_0xaa41('0x90')](_0xaa41('0x91'))['fromQuery'](['phone',_0xaa41('0x94'),_0xaa41('0x95'),_0xaa41('0x96'),_0xaa41('0x50'),'createdAt',_0xaa41('0x47')],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))['field']('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')](),_0xaa41('0x96'))[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27','createdAt')[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))[_0xaa41('0x2a')]('deletedAt\x20IS\x20NULL')[_0xaa41('0x2a')]('ListId\x20=\x20?',_0x25f5ba[_0xaa41('0x98')]['toString']())['where'](_0xaa41('0x9b'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xaa41('0x97')]()[_0xaa41('0x71')](_0xaa41('0x9f'))[_0xaa41('0x73')](_0xaa41('0x91'))[_0xaa41('0x2a')]('VoiceQueueId\x20=\x20?',_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')]())))[_0xaa41('0x7a')]();break;default:_0x2b8b73=squel['insert']()[_0xaa41('0x90')]('cm_hopper')[_0xaa41('0x92')]([_0xaa41('0x93'),_0xaa41('0x94'),_0xaa41('0x95'),'ListId','VoiceQueueId',_0xaa41('0x46'),_0xaa41('0x47')],squel['select']()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')]['toString'](),_0xaa41('0x96'))[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))['field']('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))['field']('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))['from'](_0xaa41('0x99'))[_0xaa41('0x2a')](_0xaa41('0xa1'))['where'](_0xaa41('0x9a'),_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')]())[_0xaa41('0x2a')](_0xaa41('0x9b')))[_0xaa41('0x7a')]();}_0x49e4a5[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x2b8b73));}return BPromise[_0xaa41('0x7f')](_0x49e4a5);}})['then'](function(){var _0x58f009=[];var _0x405eba=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')]('cm_hopper_additional_phones')[_0xaa41('0x92')]([_0xaa41('0xa2'),_0xaa41('0x93'),_0xaa41('0xa3'),_0xaa41('0x46'),_0xaa41('0x47')],squel['select']()[_0xaa41('0x71')](_0xaa41('0xa4'))[_0xaa41('0x71')](_0xaa41('0xa5'))['field'](_0xaa41('0xa6'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))['field']('\x27'+_0xd1f9ba+'\x27','updatedAt')[_0xaa41('0x73')](_0xaa41('0xa7'),'ci')[_0xaa41('0x74')]('cm_hopper','h','h.ContactId=ci.CmContactId')[_0xaa41('0x2a')](_0xaa41('0xa8'),_0xd1f9ba)[_0xaa41('0x2a')](_0xaa41('0xa9'),_0xaa41('0xaa')))[_0xaa41('0x7a')]();_0x58f009['push'](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x405eba));return BPromise[_0xaa41('0x7f')](_0x58f009);})[_0xaa41('0x17')](function(){return _0x2c4930;})[_0xaa41('0x17')](respondWithResult(_0x47ca9d,null))[_0xaa41('0x2f')](handleError(_0x47ca9d,null));};exports[_0xaa41('0xab')]=function(_0x718a84,_0x151c5f){return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x718a84['params']['id']}})['then'](handleEntityNotFound(_0x151c5f,null))[_0xaa41('0x17')](function(_0x293a1d){if(_0x293a1d){return _0x293a1d['removeLists'](_0x718a84[_0xaa41('0x32')][_0xaa41('0x70')]);}})['then'](function(_0x490a6c){if(_0x490a6c){return db[_0xaa41('0x4a')][_0xaa41('0x23')]({'where':{'ListId':_0x718a84[_0xaa41('0x32')]['ids'],'VoiceQueueId':_0x718a84[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(){return _0x490a6c;});}})['then'](respondWithStatusCode(_0x151c5f,null))[_0xaa41('0x2f')](handleError(_0x151c5f,null));};exports[_0xaa41('0xac')]=function(_0x536cdb,_0x431b75){var _0x18499f={};var _0x49cbd7={};var _0x515f91;var _0x4b5953;return db['VoiceQueue'][_0xaa41('0x55')]({'where':{'id':_0x536cdb[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x431b75,null))[_0xaa41('0x17')](function(_0x4ca8f7){if(_0x4ca8f7){_0x515f91=_0x4ca8f7;_0x49cbd7['model']=_[_0xaa41('0x33')](db['CmList'][_0xaa41('0x28')]);_0x49cbd7[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x536cdb[_0xaa41('0x32')]);_0x49cbd7['filters']=_[_0xaa41('0x35')](_0x49cbd7[_0xaa41('0x31')],_0x49cbd7[_0xaa41('0x32')]);_0x18499f[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x49cbd7[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x536cdb[_0xaa41('0x32')]['fields']));_0x18499f['attributes']=_0x18499f[_0xaa41('0x34')][_0xaa41('0x37')]?_0x18499f[_0xaa41('0x34')]:_0x49cbd7[_0xaa41('0x31')];_0x18499f[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x536cdb[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x18499f[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x536cdb[_0xaa41('0x32')],_0x49cbd7[_0xaa41('0x4b')]));if(_0x536cdb['query'][_0xaa41('0x1b')]){_0x18499f[_0xaa41('0x2a')]=_['merge'](_0x18499f[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x18499f[_0xaa41('0x34')],function(_0x5cd79d){var _0x558583={};_0x558583[_0x5cd79d]={'$like':'%'+_0x536cdb[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x558583;})});}_0x18499f=_['merge']({},_0x18499f,_0x536cdb['options']);return _0x515f91[_0xaa41('0xac')](_0x18499f);}})[_0xaa41('0x17')](function(_0x117841){if(_0x117841){_0x4b5953=_0x117841[_0xaa41('0x37')];if(!_0x536cdb[_0xaa41('0x32')]['hasOwnProperty'](_0xaa41('0x4c'))){_0x18499f[_0xaa41('0x12')]=qs['limit'](_0x536cdb['query'][_0xaa41('0x12')]);_0x18499f[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x536cdb[_0xaa41('0x32')]['offset']);}return _0x515f91[_0xaa41('0xac')](_0x18499f);}})[_0xaa41('0x17')](function(_0x1be3c1){if(_0x1be3c1){return _0x1be3c1?{'count':_0x4b5953,'rows':_0x1be3c1}:null;}})[_0xaa41('0x17')](respondWithResult(_0x431b75,null))[_0xaa41('0x2f')](handleError(_0x431b75,null));};exports[_0xaa41('0xad')]=function(_0x42ae0c,_0x4fa4ca){var _0x1e41b5;return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x42ae0c[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x4fa4ca,null))[_0xaa41('0x17')](function(_0x135f31){if(_0x135f31){return _0x135f31[_0xaa41('0xad')](_0x42ae0c[_0xaa41('0x3b')][_0xaa41('0x70')],_[_0xaa41('0x45')](_0x42ae0c['body'],[_0xaa41('0x70'),'id'])||{});}return null;})['spread'](function(_0x5eac30){var _0x3e28b7;_0x1e41b5=_0x5eac30||[];var _0x1ac854=[];if(_0x5eac30){for(var _0x187bf9=0x0;_0x187bf9<_0x5eac30['length'];_0x187bf9+=0x1){var _0x50fa22=_0x5eac30[_0x187bf9][_0xaa41('0x18')]({'plain':!![]});_0x3e28b7=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')](_0xaa41('0xae'))['fromQuery']([_0xaa41('0x93'),'ContactId',_0xaa41('0x96'),_0xaa41('0x50'),_0xaa41('0x46'),'updatedAt'],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x50fa22['CmListId'][_0xaa41('0x7a')](),'ListId')['field'](_0x42ae0c['params']['id'][_0xaa41('0x7a')](),'VoiceQueueId')[_0xaa41('0x71')]('NOW()','createdAt')[_0xaa41('0x71')](_0xaa41('0xaf'),_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))[_0xaa41('0x2a')](_0xaa41('0xa1'))[_0xaa41('0x2a')](_0xaa41('0x9a'),_0x50fa22['CmListId'][_0xaa41('0x7a')]())[_0xaa41('0x2a')](_0xaa41('0x9b')))['toString']();_0x1ac854[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x3e28b7));}return BPromise['all'](_0x1ac854);}})[_0xaa41('0x17')](function(){return _0x1e41b5;})[_0xaa41('0x17')](respondWithResult(_0x4fa4ca,null))['catch'](handleError(_0x4fa4ca,null));};exports[_0xaa41('0xb0')]=function(_0x2edb93,_0x4e34c2){return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x2edb93[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x4e34c2,null))[_0xaa41('0x17')](function(_0x17b359){if(_0x17b359){return _0x17b359['removeBlackLists'](_0x2edb93['query']['ids']);}})['then'](function(_0x5b820b){if(_0x5b820b){return db[_0xaa41('0x58')][_0xaa41('0x23')]({'where':{'ListId':_0x2edb93[_0xaa41('0x32')][_0xaa41('0x70')],'VoiceQueueId':_0x2edb93[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(){return _0x5b820b;});}})[_0xaa41('0x17')](respondWithStatusCode(_0x4e34c2,null))[_0xaa41('0x2f')](handleError(_0x4e34c2,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index a08dc25..d6f467d 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 _0x4c23=['hook','exports','events','../../mysqldb','VoiceQueue','save','update','remove','hasOwnProperty'];(function(_0x4fa916,_0x3ec36a){var _0x576439=function(_0x5692e0){while(--_0x5692e0){_0x4fa916['push'](_0x4fa916['shift']());}};_0x576439(++_0x3ec36a);}(_0x4c23,0x1b2));var _0x34c2=function(_0x240af0,_0x1b2ade){_0x240af0=_0x240af0-0x0;var _0x120aec=_0x4c23[_0x240af0];return _0x120aec;};'use strict';var EventEmitter=require(_0x34c2('0x0'));var VoiceQueue=require(_0x34c2('0x1'))['db'][_0x34c2('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x34c2('0x3'),'afterUpdate':_0x34c2('0x4'),'afterDestroy':_0x34c2('0x5')};function emitEvent(_0x2b2079){return function(_0x33ab19,_0x54d477,_0x44d866){VoiceQueueEvents['emit'](_0x2b2079+':'+_0x33ab19['id'],_0x33ab19);VoiceQueueEvents['emit'](_0x2b2079,_0x33ab19);_0x44d866(null);};}for(var e in events){if(events[_0x34c2('0x6')](e)){var event=events[e];VoiceQueue[_0x34c2('0x7')](e,emitEvent(event));}}module[_0x34c2('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x7e0d=['setMaxListeners','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x1a1f2a,_0x719591){var _0x4b9da8=function(_0x3fad07){while(--_0x3fad07){_0x1a1f2a['push'](_0x1a1f2a['shift']());}};_0x4b9da8(++_0x719591);}(_0x7e0d,0x88));var _0xd7e0=function(_0x20edfd,_0x3deafb){_0x20edfd=_0x20edfd-0x0;var _0x343295=_0x7e0d[_0x20edfd];return _0x343295;};'use strict';var EventEmitter=require(_0xd7e0('0x0'));var VoiceQueue=require(_0xd7e0('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xd7e0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2dfe10){return function(_0x540177,_0x172669,_0x1f38de){VoiceQueueEvents[_0xd7e0('0x3')](_0x2dfe10+':'+_0x540177['id'],_0x540177);VoiceQueueEvents[_0xd7e0('0x3')](_0x2dfe10,_0x540177);_0x1f38de(null);};}for(var e in events){if(events[_0xd7e0('0x4')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xd7e0('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 73b7ad0..90458bc 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x5504fb,_0x270144){var _0x38776d=function(_0x21032b){while(--_0x21032b){_0x5504fb['push'](_0x5504fb['shift']());}};_0x38776d(++_0x270144);}(_0x34e8,0x12c));var _0x834e=function(_0x50cfdb,_0x41ba17){_0x50cfdb=_0x50cfdb-0x0;var _0x13d112=_0x34e8[_0x50cfdb];return _0x13d112;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x1c0757,_0x1557d0){var _0xd57bf7=function(_0x4e43d1){while(--_0x4e43d1){_0x1c0757['push'](_0x1c0757['shift']());}};_0xd57bf7(++_0x1557d0);}(_0xedd9,0xfc));var _0x9edd=function(_0x5a85a6,_0x43a58f){_0x5a85a6=_0x5a85a6-0x0;var _0x5742e2=_0xedd9[_0x5a85a6];return _0x5742e2;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 610d85c..4553874 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 _0x3eac=['where','attributes','limit','include','model','map','stringify','ShowVoiceQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','./voiceQueue.socket','request','then','VoiceQueue,\x20%s,\x20%s','debug','error','message','info','request\x20sent','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw'];(function(_0x5985f0,_0x273df9){var _0x285f54=function(_0x8780af){while(--_0x8780af){_0x5985f0['push'](_0x5985f0['shift']());}};_0x285f54(++_0x273df9);}(_0x3eac,0x185));var _0xc3ea=function(_0x217c2e,_0x358f06){_0x217c2e=_0x217c2e-0x0;var _0x22b7d8=_0x3eac[_0x217c2e];return _0x22b7d8;};'use strict';var _=require(_0xc3ea('0x0'));var util=require(_0xc3ea('0x1'));var moment=require(_0xc3ea('0x2'));var BPromise=require(_0xc3ea('0x3'));var rs=require(_0xc3ea('0x4'));var fs=require('fs');var Redis=require(_0xc3ea('0x5'));var db=require(_0xc3ea('0x6'))['db'];var utils=require(_0xc3ea('0x7'));var logger=require(_0xc3ea('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc3ea('0x9'));var client=jayson[_0xc3ea('0xa')][_0xc3ea('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xc3ea('0xc')],{'host':_0xc3ea('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc3ea('0xc')]));require(_0xc3ea('0xe'))['register'](socket);function respondWithRpcPromise(_0x5e3a25,_0x53eb09,_0x57e902){return new BPromise(function(_0x3af7d9,_0x460138){return client[_0xc3ea('0xf')](_0x5e3a25,_0x57e902)[_0xc3ea('0x10')](function(_0x4844c1){logger['info'](_0xc3ea('0x11'),_0x53eb09,'request\x20sent');logger[_0xc3ea('0x12')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x53eb09,'request\x20sent',JSON['stringify'](_0x4844c1));if(_0x4844c1[_0xc3ea('0x13')]){if(_0x4844c1[_0xc3ea('0x13')]['code']===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x53eb09,_0x4844c1[_0xc3ea('0x13')][_0xc3ea('0x14')]);return _0x460138(_0x4844c1['error'][_0xc3ea('0x14')]);}logger[_0xc3ea('0x13')](_0xc3ea('0x11'),_0x53eb09,_0x4844c1[_0xc3ea('0x13')][_0xc3ea('0x14')]);return _0x3af7d9(_0x4844c1['error'][_0xc3ea('0x14')]);}else{logger[_0xc3ea('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x53eb09,_0xc3ea('0x16'));_0x3af7d9(_0x4844c1['result'][_0xc3ea('0x14')]);}})[_0xc3ea('0x17')](function(_0x5d5a37){logger['error'](_0xc3ea('0x11'),_0x53eb09,_0x5d5a37);_0x460138(_0x5d5a37);});});}exports[_0xc3ea('0x18')]=function(_0x137cc2){var _0x37daee=this;return new Promise(function(_0x3ebdc2,_0x17d9cb){return db[_0xc3ea('0x19')][_0xc3ea('0x1a')]({'raw':_0x137cc2[_0xc3ea('0x1b')]?_0x137cc2[_0xc3ea('0x1b')][_0xc3ea('0x1c')]===undefined?!![]:![]:!![],'where':_0x137cc2['options']?_0x137cc2[_0xc3ea('0x1b')][_0xc3ea('0x1d')]||null:null,'attributes':_0x137cc2[_0xc3ea('0x1b')]?_0x137cc2[_0xc3ea('0x1b')][_0xc3ea('0x1e')]||null:null,'limit':_0x137cc2[_0xc3ea('0x1b')]?_0x137cc2[_0xc3ea('0x1b')][_0xc3ea('0x1f')]||null:null,'include':_0x137cc2['options']?_0x137cc2['options'][_0xc3ea('0x20')]?_['map'](_0x137cc2['options'][_0xc3ea('0x20')],function(_0x22b58a){return{'model':db[_0x22b58a[_0xc3ea('0x21')]],'as':_0x22b58a['as'],'attributes':_0x22b58a['attributes'],'include':_0x22b58a['include']?_[_0xc3ea('0x22')](_0x22b58a[_0xc3ea('0x20')],function(_0x333e31){return{'model':db[_0x333e31[_0xc3ea('0x21')]],'as':_0x333e31['as'],'attributes':_0x333e31[_0xc3ea('0x1e')],'include':_0x333e31['include']?_[_0xc3ea('0x22')](_0x333e31['include'],function(_0x380b64){return{'model':db[_0x380b64['model']],'as':_0x380b64['as'],'attributes':_0x380b64[_0xc3ea('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc3ea('0x10')](function(_0x138d73){logger['info'](_0xc3ea('0x18'),_0x137cc2);logger[_0xc3ea('0x12')]('GetVoiceQueue',_0x137cc2,JSON[_0xc3ea('0x23')](_0x138d73));_0x3ebdc2(_0x138d73);})[_0xc3ea('0x17')](function(_0x27671b){logger[_0xc3ea('0x13')](_0xc3ea('0x18'),_0x27671b[_0xc3ea('0x14')],_0x137cc2);_0x17d9cb(_0x37daee[_0xc3ea('0x13')](0x1f4,_0x27671b[_0xc3ea('0x14')]));});});};exports[_0xc3ea('0x24')]=function(_0x2665db){var _0x1edaa1=this;return new Promise(function(_0x1313d2,_0x52457d){return db['VoiceQueue'][_0xc3ea('0x25')]({'raw':_0x2665db['options']?_0x2665db['options'][_0xc3ea('0x1c')]===undefined?!![]:![]:!![],'where':_0x2665db[_0xc3ea('0x1b')]?_0x2665db['options'][_0xc3ea('0x1d')]||null:null,'attributes':_0x2665db[_0xc3ea('0x1b')]?_0x2665db['options']['attributes']||null:null,'include':_0x2665db[_0xc3ea('0x1b')]?_0x2665db[_0xc3ea('0x1b')][_0xc3ea('0x20')]?_[_0xc3ea('0x22')](_0x2665db[_0xc3ea('0x1b')][_0xc3ea('0x20')],function(_0x5d366a){return{'model':db[_0x5d366a['model']],'as':_0x5d366a['as'],'attributes':_0x5d366a[_0xc3ea('0x1e')],'include':_0x5d366a[_0xc3ea('0x20')]?_['map'](_0x5d366a[_0xc3ea('0x20')],function(_0x1c02b5){return{'model':db[_0x1c02b5[_0xc3ea('0x21')]],'as':_0x1c02b5['as'],'attributes':_0x1c02b5[_0xc3ea('0x1e')],'include':_0x1c02b5['include']?_[_0xc3ea('0x22')](_0x1c02b5[_0xc3ea('0x20')],function(_0x56fda5){return{'model':db[_0x56fda5[_0xc3ea('0x21')]],'as':_0x56fda5['as'],'attributes':_0x56fda5[_0xc3ea('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc3ea('0x10')](function(_0x446d34){logger[_0xc3ea('0x15')](_0xc3ea('0x24'),_0x2665db);logger[_0xc3ea('0x12')]('ShowVoiceQueue',_0x2665db,JSON[_0xc3ea('0x23')](_0x446d34));_0x1313d2(_0x446d34);})[_0xc3ea('0x17')](function(_0x49876e){logger[_0xc3ea('0x13')](_0xc3ea('0x24'),_0x49876e['message'],_0x2665db);_0x52457d(_0x1edaa1['error'](0x1f4,_0x49876e[_0xc3ea('0x14')]));});});}; \ No newline at end of file +var _0xf681=['defaults','localhost','./voiceQueue.socket','register','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','include','model','map','ShowVoiceQueue','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x1fcd2b,_0x9bdcc9){var _0x35b2d4=function(_0x4433a5){while(--_0x4433a5){_0x1fcd2b['push'](_0x1fcd2b['shift']());}};_0x35b2d4(++_0x9bdcc9);}(_0xf681,0x184));var _0x1f68=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xf681[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x1f68('0x0'));var util=require(_0x1f68('0x1'));var moment=require('moment');var BPromise=require(_0x1f68('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f68('0x3'));var db=require(_0x1f68('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f68('0x5'))(_0x1f68('0x6'));var config=require(_0x1f68('0x7'));var jayson=require(_0x1f68('0x8'));var client=jayson[_0x1f68('0x9')][_0x1f68('0xa')]({'port':0x232a});config[_0x1f68('0xb')]=_[_0x1f68('0xc')](config[_0x1f68('0xb')],{'host':_0x1f68('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1f68('0xe'))[_0x1f68('0xf')](socket);function respondWithRpcPromise(_0xa75baa,_0x14415e,_0x42dd42){return new BPromise(function(_0x18cf4c,_0x5c01fb){return client[_0x1f68('0x10')](_0xa75baa,_0x42dd42)[_0x1f68('0x11')](function(_0xdde5cc){logger['info'](_0x1f68('0x12'),_0x14415e,_0x1f68('0x13'));logger[_0x1f68('0x14')](_0x1f68('0x15'),_0x14415e,_0x1f68('0x13'),JSON[_0x1f68('0x16')](_0xdde5cc));if(_0xdde5cc['error']){if(_0xdde5cc[_0x1f68('0x17')][_0x1f68('0x18')]===0x1f4){logger[_0x1f68('0x17')](_0x1f68('0x12'),_0x14415e,_0xdde5cc[_0x1f68('0x17')]['message']);return _0x5c01fb(_0xdde5cc[_0x1f68('0x17')][_0x1f68('0x19')]);}logger[_0x1f68('0x17')](_0x1f68('0x12'),_0x14415e,_0xdde5cc['error']['message']);return _0x18cf4c(_0xdde5cc[_0x1f68('0x17')][_0x1f68('0x19')]);}else{logger[_0x1f68('0x1a')](_0x1f68('0x12'),_0x14415e,_0x1f68('0x13'));_0x18cf4c(_0xdde5cc[_0x1f68('0x1b')][_0x1f68('0x19')]);}})[_0x1f68('0x1c')](function(_0x1d84ca){logger[_0x1f68('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x14415e,_0x1d84ca);_0x5c01fb(_0x1d84ca);});});}exports[_0x1f68('0x1d')]=function(_0x9b1ab4){var _0x192df5=this;return new Promise(function(_0x2eb273,_0x1bdbe8){return db[_0x1f68('0x1e')][_0x1f68('0x1f')]({'raw':_0x9b1ab4[_0x1f68('0x20')]?_0x9b1ab4[_0x1f68('0x20')][_0x1f68('0x21')]===undefined?!![]:![]:!![],'where':_0x9b1ab4['options']?_0x9b1ab4[_0x1f68('0x20')][_0x1f68('0x22')]||null:null,'attributes':_0x9b1ab4[_0x1f68('0x20')]?_0x9b1ab4[_0x1f68('0x20')][_0x1f68('0x23')]||null:null,'limit':_0x9b1ab4[_0x1f68('0x20')]?_0x9b1ab4['options']['limit']||null:null,'include':_0x9b1ab4['options']?_0x9b1ab4[_0x1f68('0x20')]['include']?_['map'](_0x9b1ab4[_0x1f68('0x20')][_0x1f68('0x24')],function(_0x1dd987){return{'model':db[_0x1dd987[_0x1f68('0x25')]],'as':_0x1dd987['as'],'attributes':_0x1dd987[_0x1f68('0x23')],'include':_0x1dd987[_0x1f68('0x24')]?_[_0x1f68('0x26')](_0x1dd987[_0x1f68('0x24')],function(_0x31c70f){return{'model':db[_0x31c70f[_0x1f68('0x25')]],'as':_0x31c70f['as'],'attributes':_0x31c70f[_0x1f68('0x23')],'include':_0x31c70f[_0x1f68('0x24')]?_[_0x1f68('0x26')](_0x31c70f[_0x1f68('0x24')],function(_0x58df7d){return{'model':db[_0x58df7d[_0x1f68('0x25')]],'as':_0x58df7d['as'],'attributes':_0x58df7d[_0x1f68('0x23')]};}):[]};}):[]};}):[]:[]})[_0x1f68('0x11')](function(_0x5d6481){logger[_0x1f68('0x1a')](_0x1f68('0x1d'),_0x9b1ab4);logger[_0x1f68('0x14')](_0x1f68('0x1d'),_0x9b1ab4,JSON['stringify'](_0x5d6481));_0x2eb273(_0x5d6481);})[_0x1f68('0x1c')](function(_0x417497){logger[_0x1f68('0x17')](_0x1f68('0x1d'),_0x417497[_0x1f68('0x19')],_0x9b1ab4);_0x1bdbe8(_0x192df5[_0x1f68('0x17')](0x1f4,_0x417497[_0x1f68('0x19')]));});});};exports[_0x1f68('0x27')]=function(_0x383f55){var _0x27c450=this;return new Promise(function(_0x55da76,_0x390d12){return db[_0x1f68('0x1e')]['find']({'raw':_0x383f55[_0x1f68('0x20')]?_0x383f55['options'][_0x1f68('0x21')]===undefined?!![]:![]:!![],'where':_0x383f55[_0x1f68('0x20')]?_0x383f55['options'][_0x1f68('0x22')]||null:null,'attributes':_0x383f55[_0x1f68('0x20')]?_0x383f55[_0x1f68('0x20')][_0x1f68('0x23')]||null:null,'include':_0x383f55[_0x1f68('0x20')]?_0x383f55[_0x1f68('0x20')][_0x1f68('0x24')]?_[_0x1f68('0x26')](_0x383f55[_0x1f68('0x20')][_0x1f68('0x24')],function(_0x2c4a04){return{'model':db[_0x2c4a04[_0x1f68('0x25')]],'as':_0x2c4a04['as'],'attributes':_0x2c4a04[_0x1f68('0x23')],'include':_0x2c4a04[_0x1f68('0x24')]?_[_0x1f68('0x26')](_0x2c4a04[_0x1f68('0x24')],function(_0xe7f1f6){return{'model':db[_0xe7f1f6[_0x1f68('0x25')]],'as':_0xe7f1f6['as'],'attributes':_0xe7f1f6['attributes'],'include':_0xe7f1f6[_0x1f68('0x24')]?_[_0x1f68('0x26')](_0xe7f1f6[_0x1f68('0x24')],function(_0x3ff25b){return{'model':db[_0x3ff25b[_0x1f68('0x25')]],'as':_0x3ff25b['as'],'attributes':_0x3ff25b[_0x1f68('0x23')]};}):[]};}):[]};}):[]:[]})[_0x1f68('0x11')](function(_0x2d0c89){logger[_0x1f68('0x1a')](_0x1f68('0x27'),_0x383f55);logger[_0x1f68('0x14')]('ShowVoiceQueue',_0x383f55,JSON[_0x1f68('0x16')](_0x2d0c89));_0x55da76(_0x2d0c89);})[_0x1f68('0x1c')](function(_0x344de3){logger['error']('ShowVoiceQueue',_0x344de3[_0x1f68('0x19')],_0x383f55);_0x390d12(_0x27c450[_0x1f68('0x17')](0x1f4,_0x344de3[_0x1f68('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index a22a508..b280136 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 _0x12d7=['length','voiceQueue:','./voiceQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x57b1cb,_0x2b84ef){var _0x4df9bc=function(_0x5b9cd1){while(--_0x5b9cd1){_0x57b1cb['push'](_0x57b1cb['shift']());}};_0x4df9bc(++_0x2b84ef);}(_0x12d7,0x1c4));var _0x712d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x12d7[_0x3dd15e];return _0x231fd0;};'use strict';var VoiceQueueEvents=require(_0x712d('0x0'));var events=[_0x712d('0x1'),_0x712d('0x2'),_0x712d('0x3')];function createListener(_0xe022eb,_0x1efa45){return function(_0x5625d2){_0x1efa45[_0x712d('0x4')](_0xe022eb,_0x5625d2);};}function removeListener(_0x25839d,_0x590c5a){return function(){VoiceQueueEvents[_0x712d('0x5')](_0x25839d,_0x590c5a);};}exports[_0x712d('0x6')]=function(_0x1ce368){for(var _0x3a0f50=0x0,_0x2ad5e0=events[_0x712d('0x7')];_0x3a0f50<_0x2ad5e0;_0x3a0f50++){var _0x44f00f=events[_0x3a0f50];var _0x2ec2d9=createListener(_0x712d('0x8')+_0x44f00f,_0x1ce368);VoiceQueueEvents['on'](_0x44f00f,_0x2ec2d9);}}; \ No newline at end of file +var _0x3710=['voiceQueue:','save','remove','emit','removeListener','register','length'];(function(_0xebdb63,_0x3f0c83){var _0x198505=function(_0x4e65a1){while(--_0x4e65a1){_0xebdb63['push'](_0xebdb63['shift']());}};_0x198505(++_0x3f0c83);}(_0x3710,0x1cf));var _0x0371=function(_0x264f1e,_0x3a9581){_0x264f1e=_0x264f1e-0x0;var _0x4903dc=_0x3710[_0x264f1e];return _0x4903dc;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x0371('0x0'),_0x0371('0x1'),'update'];function createListener(_0x2de07e,_0x58fa1f){return function(_0x4628cc){_0x58fa1f[_0x0371('0x2')](_0x2de07e,_0x4628cc);};}function removeListener(_0x3aabcb,_0xe2cf6){return function(){VoiceQueueEvents[_0x0371('0x3')](_0x3aabcb,_0xe2cf6);};}exports[_0x0371('0x4')]=function(_0x10a9ac){for(var _0x46a2c6=0x0,_0x291aba=events[_0x0371('0x5')];_0x46a2c6<_0x291aba;_0x46a2c6++){var _0x324bfe=events[_0x46a2c6];var _0xed32fd=createListener(_0x0371('0x6')+_0x324bfe,_0x10a9ac);VoiceQueueEvents['on'](_0x324bfe,_0xed32fd);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index cf7c1fe..8f8318c 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 _0x2713=['isAuthenticated','describe','/index','getVoiceQueuesReport','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get'];(function(_0x290ef5,_0x32cfa7){var _0x450d92=function(_0x4308db){while(--_0x4308db){_0x290ef5['push'](_0x290ef5['shift']());}};_0x450d92(++_0x32cfa7);}(_0x2713,0x91));var _0x3271=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2713[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x3271('0x0'));var util=require(_0x3271('0x1'));var path=require(_0x3271('0x2'));var timeout=require('connect-timeout');var express=require(_0x3271('0x3'));var router=express['Router']();var fs_extra=require(_0x3271('0x4'));var auth=require(_0x3271('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3271('0x6'));var controller=require(_0x3271('0x7'));router[_0x3271('0x8')]('/',auth[_0x3271('0x9')](),controller['index']);router['get']('/describe',auth[_0x3271('0x9')](),controller[_0x3271('0xa')]);router[_0x3271('0x8')](_0x3271('0xb'),auth[_0x3271('0x9')](),controller[_0x3271('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3271('0xd')]);router[_0x3271('0xe')]('/',auth[_0x3271('0x9')](),controller[_0x3271('0xf')]);router[_0x3271('0x10')](_0x3271('0x11'),auth[_0x3271('0x9')](),controller[_0x3271('0x12')]);router[_0x3271('0x13')](_0x3271('0x11'),auth[_0x3271('0x9')](),controller[_0x3271('0x14')]);module[_0x3271('0x15')]=router; \ No newline at end of file +var _0x47eb=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x47eb,0x69));var _0xb47e=function(_0x3e478c,_0x152670){_0x3e478c=_0x3e478c-0x0;var _0x29ef89=_0x47eb[_0x3e478c];return _0x29ef89;};'use strict';var multer=require(_0xb47e('0x0'));var util=require(_0xb47e('0x1'));var path=require(_0xb47e('0x2'));var timeout=require(_0xb47e('0x3'));var express=require(_0xb47e('0x4'));var router=express[_0xb47e('0x5')]();var fs_extra=require(_0xb47e('0x6'));var auth=require(_0xb47e('0x7'));var interaction=require(_0xb47e('0x8'));var config=require('../../config/environment');var controller=require('./voiceQueueReport.controller');router[_0xb47e('0x9')]('/',auth[_0xb47e('0xa')](),controller[_0xb47e('0xb')]);router[_0xb47e('0x9')](_0xb47e('0xc'),auth['isAuthenticated'](),controller[_0xb47e('0xd')]);router[_0xb47e('0x9')]('/index',auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router['get'](_0xb47e('0xe'),auth['isAuthenticated'](),controller[_0xb47e('0xf')]);router[_0xb47e('0x10')]('/',auth[_0xb47e('0xa')](),controller[_0xb47e('0x11')]);router[_0xb47e('0x12')]('/:id',auth[_0xb47e('0xa')](),controller[_0xb47e('0x13')]);router[_0xb47e('0x14')]('/:id',auth[_0xb47e('0xa')](),controller['destroy']);module[_0xb47e('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 46f4ea2..0dc0bbc 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 _0x3bd1=['queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','seconds','setDataValue'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3bd1,0x1a8));var _0x13bd=function(_0x4a4d6d,_0x150bfb){_0x4a4d6d=_0x4a4d6d-0x0;var _0x45f689=_0x3bd1[_0x4a4d6d];return _0x45f689;};'use strict';var Sequelize=require(_0x13bd('0x0'));var moment=require('moment');module[_0x13bd('0x1')]={'type':{'type':Sequelize[_0x13bd('0x2')]},'uniqueid':{'type':Sequelize[_0x13bd('0x2')]},'calleridnum':{'type':Sequelize[_0x13bd('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x13bd('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x13bd('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0xc8c063){var _0x991420=moment(_0xc8c063);var _0x14f9c0=moment(this[_0x13bd('0x4')](_0x13bd('0x5')))[_0x13bd('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x67031c=_0x991420[_0x13bd('0x7')](_0x14f9c0,_0x13bd('0x8'));this[_0x13bd('0x9')](_0x13bd('0xa'),_0xc8c063);this[_0x13bd('0x9')](_0x13bd('0xb'),_0x67031c||null);}},'position':{'type':Sequelize[_0x13bd('0xc')]},'count':{'type':Sequelize[_0x13bd('0xc')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x13bd('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x13bd('0x3')]},'queuecallerexit':{'type':Sequelize[_0x13bd('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x13bd('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x13bd('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x13bd('0xc')]},'channel':{'type':Sequelize[_0x13bd('0x2')]},'connectedlinenum':{'type':Sequelize[_0x13bd('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x13bd('0x2')]},'context':{'type':Sequelize[_0x13bd('0x2')]},'exten':{'type':Sequelize[_0x13bd('0x2')]},'priority':{'type':Sequelize[_0x13bd('0x2')]},'holdtime':{'type':Sequelize[_0x13bd('0xc')]},'mohtime':{'type':Sequelize[_0x13bd('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x13bd('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x13bd('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x13bd('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x13bd('0x2')]},'transferuniqueid':{'type':Sequelize[_0x13bd('0x2')]},'disposition':{'type':Sequelize[_0x13bd('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x13bd('0xc')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x16d6=['INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x16d6,0x129));var _0x616d=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x16d6[_0x47aa64];return _0x549c7a;};'use strict';var Sequelize=require(_0x616d('0x0'));var moment=require('moment');module[_0x616d('0x1')]={'type':{'type':Sequelize[_0x616d('0x2')]},'uniqueid':{'type':Sequelize[_0x616d('0x2')]},'calleridnum':{'type':Sequelize[_0x616d('0x2')]},'calleridname':{'type':Sequelize[_0x616d('0x2')]},'queue':{'type':Sequelize[_0x616d('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x616d('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x616d('0x3')],'set':function(_0x517652){var _0x108028=moment(_0x517652);var _0x8ec43=moment(this[_0x616d('0x4')](_0x616d('0x5')))['format'](_0x616d('0x6'));var _0x5bb547=_0x108028[_0x616d('0x7')](_0x8ec43,_0x616d('0x8'));this[_0x616d('0x9')]('queuecallerleaveAt',_0x517652);this[_0x616d('0x9')](_0x616d('0xa'),_0x5bb547||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x616d('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x616d('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x616d('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x616d('0x3')]},'queuecallerexit':{'type':Sequelize[_0x616d('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x616d('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x616d('0x2')],'comment':_0x616d('0xd')},'originalposition':{'type':Sequelize[_0x616d('0xb')]},'channel':{'type':Sequelize[_0x616d('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x616d('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x616d('0x2')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x616d('0xb')]},'mohtime':{'type':Sequelize[_0x616d('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x616d('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x616d('0x2')]},'transfer':{'type':Sequelize[_0x616d('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x616d('0x2')]},'transferuniqueid':{'type':Sequelize[_0x616d('0x2')]},'disposition':{'type':Sequelize[_0x616d('0x2')]},'secondDisposition':{'type':Sequelize[_0x616d('0x2')]},'thirdDisposition':{'type':Sequelize[_0x616d('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x616d('0xb')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 7f01bd6..782b974 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 _0xc56a=['rows','catch','show','params','keys','length','include','create','body','find','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','sendStatus','end','status','undefined','limit','count','offset','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','VoiceQueueReport','includeAll','findAll'];(function(_0x17f65a,_0x24ec2e){var _0x523b7c=function(_0x7b2ce7){while(--_0x7b2ce7){_0x17f65a['push'](_0x17f65a['shift']());}};_0x523b7c(++_0x24ec2e);}(_0xc56a,0xb1));var _0xac56=function(_0x4eb86a,_0x592362){_0x4eb86a=_0x4eb86a-0x0;var _0x1258d9=_0xc56a[_0x4eb86a];return _0x1258d9;};'use strict';var emlformat=require(_0xac56('0x0'));var rimraf=require(_0xac56('0x1'));var zipdir=require(_0xac56('0x2'));var jsonpatch=require(_0xac56('0x3'));var rp=require(_0xac56('0x4'));var moment=require(_0xac56('0x5'));var BPromise=require(_0xac56('0x6'));var Mustache=require(_0xac56('0x7'));var util=require(_0xac56('0x8'));var path=require('path');var sox=require(_0xac56('0x9'));var csv=require(_0xac56('0xa'));var ejs=require(_0xac56('0xb'));var fs=require('fs');var fs_extra=require(_0xac56('0xc'));var _=require(_0xac56('0xd'));var squel=require('squel');var crypto=require(_0xac56('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xac56('0xf'));var toCsv=require(_0xac56('0xa'));var querystring=require('querystring');var Papa=require(_0xac56('0x10'));var Redis=require(_0xac56('0x11'));var authService=require(_0xac56('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xac56('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac56('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xac56('0x15'));var licenseUtil=require(_0xac56('0x16'));var db=require(_0xac56('0x17'))['db'];config[_0xac56('0x18')]=_[_0xac56('0x19')](config[_0xac56('0x18')],{'host':_0xac56('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac56('0x18')]));require(_0xac56('0x1b'))[_0xac56('0x1c')](socket);function respondWithStatusCode(_0x5a634a,_0x2163d9){_0x2163d9=_0x2163d9||0xcc;return function(_0x14472c){if(_0x14472c){return _0x5a634a[_0xac56('0x1d')](_0x2163d9);}return _0x5a634a['status'](_0x2163d9)[_0xac56('0x1e')]();};}function respondWithResult(_0xcd7400,_0x4587bd){_0x4587bd=_0x4587bd||0xc8;return function(_0xfdd97a){if(_0xfdd97a){return _0xcd7400[_0xac56('0x1f')](_0x4587bd)['json'](_0xfdd97a);}};}function respondWithFilteredResult(_0x592b06,_0x39f17c){return function(_0x490a76){if(_0x490a76){var _0x47c33e=typeof _0x39f17c['offset']===_0xac56('0x20')&&typeof _0x39f17c[_0xac56('0x21')]===_0xac56('0x20');var _0x28758b=_0x490a76[_0xac56('0x22')];var _0x8c0779=_0x47c33e?0x0:_0x39f17c[_0xac56('0x23')];var _0x414a8b=_0x47c33e?_0x490a76[_0xac56('0x22')]:_0x39f17c[_0xac56('0x23')]+_0x39f17c[_0xac56('0x21')];var _0x365ee9;if(_0x414a8b>=_0x28758b){_0x414a8b=_0x28758b;_0x365ee9=0xc8;}else{_0x365ee9=0xce;}_0x592b06[_0xac56('0x1f')](_0x365ee9);return _0x592b06[_0xac56('0x24')]('Content-Range',_0x8c0779+'-'+_0x414a8b+'/'+_0x28758b)[_0xac56('0x25')](_0x490a76);}return null;};}function patchUpdates(_0x2f060e){return function(_0xe59403){try{jsonpatch[_0xac56('0x26')](_0xe59403,_0x2f060e,!![]);}catch(_0x563903){return BPromise[_0xac56('0x27')](_0x563903);}return _0xe59403[_0xac56('0x28')]();};}function saveUpdates(_0x18f544,_0x52a705){return function(_0x1328cb){if(_0x1328cb){return _0x1328cb[_0xac56('0x29')](_0x18f544)[_0xac56('0x2a')](function(_0x45d2db){return _0x45d2db;});}return null;};}function removeEntity(_0x313011,_0x87ed05){return function(_0x54ed33){if(_0x54ed33){return _0x54ed33[_0xac56('0x2b')]()[_0xac56('0x2a')](function(){_0x313011[_0xac56('0x1f')](0xcc)[_0xac56('0x1e')]();});}};}function handleEntityNotFound(_0x42c65d,_0x3a2158){return function(_0x26f871){if(!_0x26f871){_0x42c65d[_0xac56('0x1d')](0x194);}return _0x26f871;};}function handleError(_0x360ca6,_0x5d711e){_0x5d711e=_0x5d711e||0x1f4;return function(_0xfe11a3){logger[_0xac56('0x2c')](_0xfe11a3[_0xac56('0x2d')]);if(_0xfe11a3[_0xac56('0x2e')]){delete _0xfe11a3['name'];}_0x360ca6['status'](_0x5d711e)[_0xac56('0x2f')](_0xfe11a3);};}exports[_0xac56('0x30')]=function(_0x15b2e8,_0x35f669){var _0x432448={},_0x4730fb={},_0x19162e={'count':0x0,'rows':[]};var _0x480313=_[_0xac56('0x31')](db['VoiceQueueReport'][_0xac56('0x32')],function(_0x36dbf5){return{'name':_0x36dbf5[_0xac56('0x33')],'type':_0x36dbf5['type'][_0xac56('0x34')]};});_0x4730fb['model']=_[_0xac56('0x31')](_0x480313,_0xac56('0x2e'));_0x4730fb[_0xac56('0x35')]=_['keys'](_0x15b2e8[_0xac56('0x35')]);_0x4730fb[_0xac56('0x36')]=_[_0xac56('0x37')](_0x4730fb[_0xac56('0x38')],_0x4730fb[_0xac56('0x35')]);_0x432448[_0xac56('0x39')]=_[_0xac56('0x37')](_0x4730fb[_0xac56('0x38')],qs['fields'](_0x15b2e8[_0xac56('0x35')][_0xac56('0x3a')]));_0x432448['attributes']=_0x432448[_0xac56('0x39')]['length']?_0x432448[_0xac56('0x39')]:_0x4730fb[_0xac56('0x38')];if(!_0x15b2e8[_0xac56('0x35')][_0xac56('0x3b')]('nolimit')){_0x432448['limit']=qs[_0xac56('0x21')](_0x15b2e8[_0xac56('0x35')][_0xac56('0x21')]);_0x432448[_0xac56('0x23')]=qs[_0xac56('0x23')](_0x15b2e8[_0xac56('0x35')]['offset']);}_0x432448[_0xac56('0x3c')]=qs[_0xac56('0x3d')](_0x15b2e8['query'][_0xac56('0x3d')]);_0x432448[_0xac56('0x3e')]=qs[_0xac56('0x36')](_[_0xac56('0x3f')](_0x15b2e8[_0xac56('0x35')],_0x4730fb[_0xac56('0x36')]),_0x480313);if(_0x15b2e8[_0xac56('0x35')][_0xac56('0x40')]){_0x432448[_0xac56('0x3e')]=_[_0xac56('0x41')](_0x432448[_0xac56('0x3e')],{'$or':_[_0xac56('0x31')](_0x480313,function(_0x14c8cf){if(_0x14c8cf[_0xac56('0x42')]!==_0xac56('0x43')){var _0xfd545e={};_0xfd545e[_0x14c8cf[_0xac56('0x2e')]]={'$like':'%'+_0x15b2e8['query']['filter']+'%'};return _0xfd545e;}})});}_0x432448=_[_0xac56('0x41')]({},_0x432448,_0x15b2e8[_0xac56('0x44')]);var _0x463343={'where':_0x432448[_0xac56('0x3e')]};return db[_0xac56('0x45')][_0xac56('0x22')](_0x463343)[_0xac56('0x2a')](function(_0x54499c){_0x19162e['count']=_0x54499c;if(_0x15b2e8[_0xac56('0x35')][_0xac56('0x46')]){_0x432448['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0xac56('0x47')](_0x432448);})[_0xac56('0x2a')](function(_0x4712df){_0x19162e[_0xac56('0x48')]=_0x4712df;return _0x19162e;})[_0xac56('0x2a')](respondWithFilteredResult(_0x35f669,_0x432448))[_0xac56('0x49')](handleError(_0x35f669,null));};exports[_0xac56('0x4a')]=function(_0x12e1e3,_0x3d15e2){var _0x3dcafe={'raw':![],'where':{'id':_0x12e1e3[_0xac56('0x4b')]['id']}},_0x2ecf61={};_0x2ecf61[_0xac56('0x38')]=_['keys'](db['VoiceQueueReport'][_0xac56('0x32')]);_0x2ecf61['query']=_[_0xac56('0x4c')](_0x12e1e3[_0xac56('0x35')]);_0x2ecf61[_0xac56('0x36')]=_['intersection'](_0x2ecf61[_0xac56('0x38')],_0x2ecf61[_0xac56('0x35')]);_0x3dcafe[_0xac56('0x39')]=_[_0xac56('0x37')](_0x2ecf61[_0xac56('0x38')],qs[_0xac56('0x3a')](_0x12e1e3[_0xac56('0x35')][_0xac56('0x3a')]));_0x3dcafe[_0xac56('0x39')]=_0x3dcafe[_0xac56('0x39')][_0xac56('0x4d')]?_0x3dcafe[_0xac56('0x39')]:_0x2ecf61[_0xac56('0x38')];if(_0x12e1e3[_0xac56('0x35')][_0xac56('0x46')]){_0x3dcafe[_0xac56('0x4e')]=[{'all':!![]}];}_0x3dcafe=_[_0xac56('0x41')]({},_0x3dcafe,_0x12e1e3[_0xac56('0x44')]);return db['VoiceQueueReport']['find'](_0x3dcafe)[_0xac56('0x2a')](handleEntityNotFound(_0x3d15e2,null))[_0xac56('0x2a')](respondWithResult(_0x3d15e2,null))['catch'](handleError(_0x3d15e2,null));};exports[_0xac56('0x4f')]=function(_0x2fd5c1,_0x143fbf){return db['VoiceQueueReport'][_0xac56('0x4f')](_0x2fd5c1[_0xac56('0x50')],{})[_0xac56('0x2a')](respondWithResult(_0x143fbf,0xc9))[_0xac56('0x49')](handleError(_0x143fbf,null));};exports['update']=function(_0x38b1ea,_0x1381bb){if(_0x38b1ea[_0xac56('0x50')]['id']){delete _0x38b1ea[_0xac56('0x50')]['id'];}return db[_0xac56('0x45')][_0xac56('0x51')]({'where':{'id':_0x38b1ea[_0xac56('0x4b')]['id']}})[_0xac56('0x2a')](handleEntityNotFound(_0x1381bb,null))[_0xac56('0x2a')](saveUpdates(_0x38b1ea[_0xac56('0x50')],null))['then'](respondWithResult(_0x1381bb,null))['catch'](handleError(_0x1381bb,null));};exports[_0xac56('0x2b')]=function(_0xf027ad,_0x3b47ef){return db[_0xac56('0x45')][_0xac56('0x51')]({'where':{'id':_0xf027ad[_0xac56('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3b47ef,null))['then'](removeEntity(_0x3b47ef,null))['catch'](handleError(_0x3b47ef,null));};exports['describe']=function(_0xe547b0,_0x354b01){return db[_0xac56('0x45')]['describe']()[_0xac56('0x2a')](respondWithResult(_0x354b01,null))[_0xac56('0x49')](handleError(_0x354b01,null));};exports[_0xac56('0x52')]=function(_0x9b36b,_0x1e42da){var _0x1f055b={},_0x28da6e={},_0x13e7c6={'count':0x0,'rows':[]};_0x28da6e['model']=_[_0xac56('0x4c')](db['VoiceQueueReport']['rawAttributes']);_0x28da6e['query']=_[_0xac56('0x4c')](_0x9b36b[_0xac56('0x35')]);_0x28da6e[_0xac56('0x36')]=_[_0xac56('0x37')](_0x28da6e[_0xac56('0x38')],_0x28da6e[_0xac56('0x35')]);_0x1f055b[_0xac56('0x39')]=_[_0xac56('0x37')](_0x28da6e['model'],qs[_0xac56('0x3a')](_0x9b36b[_0xac56('0x35')][_0xac56('0x3a')]));_0x1f055b[_0xac56('0x39')]=_0x1f055b[_0xac56('0x39')][_0xac56('0x4d')]?_0x1f055b[_0xac56('0x39')]:_0x28da6e[_0xac56('0x38')];if(!_0x9b36b[_0xac56('0x35')][_0xac56('0x3b')]('nolimit')){_0x1f055b[_0xac56('0x21')]=qs[_0xac56('0x21')](_0x9b36b['query'][_0xac56('0x21')]);_0x1f055b['offset']=qs[_0xac56('0x23')](_0x9b36b['query']['offset']);}_0x1f055b['order']=qs[_0xac56('0x3d')](_0x9b36b[_0xac56('0x35')]['sort']);_0x1f055b[_0xac56('0x3e')]=qs[_0xac56('0x36')](_[_0xac56('0x3f')](_0x9b36b['query'],_0x28da6e[_0xac56('0x36')]));if(_0x9b36b['query'][_0xac56('0x40')]){_0x1f055b[_0xac56('0x3e')]=_[_0xac56('0x41')](_0x1f055b['where'],{'$or':_['map'](_0x1f055b['attributes'],function(_0x3baea0){var _0x32d7b3={};_0x32d7b3[_0x3baea0]={'$like':'%'+_0x9b36b['query']['filter']+'%'};return _0x32d7b3;})});}_0x1f055b=_['merge']({},_0x1f055b,_0x9b36b['options']);var _0x12269a={'where':_0x1f055b[_0xac56('0x3e')]};return db['VoiceQueueReport'][_0xac56('0x22')](_0x12269a)[_0xac56('0x2a')](function(_0x3eb5d9){_0x13e7c6[_0xac56('0x22')]=_0x3eb5d9;if(_0x9b36b[_0xac56('0x35')][_0xac56('0x46')]){_0x1f055b[_0xac56('0x4e')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x1f055b);})[_0xac56('0x2a')](function(_0x858fc){_0x13e7c6['rows']=_0x858fc;return _0x13e7c6;})[_0xac56('0x2a')](respondWithFilteredResult(_0x1e42da,_0x1f055b,_0xac56('0x52')))[_0xac56('0x49')](handleError(_0x1e42da,null,_0xac56('0x52')));}; \ No newline at end of file +var _0xc211=['attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','findAll','show','rawAttributes','intersection','length','options','find','create','body','catch','params','describe','getVoiceQueuesReport','rows','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','update','then','end','error','stack','name','index','VoiceQueueReport','type','key','model','map','keys','query','fields'];(function(_0x24f273,_0x5e9445){var _0x15262e=function(_0x106ec9){while(--_0x106ec9){_0x24f273['push'](_0x24f273['shift']());}};_0x15262e(++_0x5e9445);}(_0xc211,0x1ab));var _0x1c21=function(_0x31b4e4,_0xbd3f27){_0x31b4e4=_0x31b4e4-0x0;var _0x80bd2d=_0xc211[_0x31b4e4];return _0x80bd2d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1c21('0x0'));var zipdir=require(_0x1c21('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1c21('0x2'));var moment=require(_0x1c21('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1c21('0x4'));var path=require(_0x1c21('0x5'));var sox=require(_0x1c21('0x6'));var csv=require(_0x1c21('0x7'));var ejs=require(_0x1c21('0x8'));var fs=require('fs');var fs_extra=require(_0x1c21('0x9'));var _=require(_0x1c21('0xa'));var squel=require(_0x1c21('0xb'));var crypto=require(_0x1c21('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1c21('0xd'));var toCsv=require(_0x1c21('0x7'));var querystring=require('querystring');var Papa=require(_0x1c21('0xe'));var Redis=require(_0x1c21('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1c21('0x10'));var as=require(_0x1c21('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1c21('0x12'))(_0x1c21('0x13'));var utils=require(_0x1c21('0x14'));var config=require(_0x1c21('0x15'));var licenseUtil=require(_0x1c21('0x16'));var db=require(_0x1c21('0x17'))['db'];config[_0x1c21('0x18')]=_[_0x1c21('0x19')](config['redis'],{'host':_0x1c21('0x1a'),'port':0x18eb});var socket=require(_0x1c21('0x1b'))(new Redis(config[_0x1c21('0x18')]));require('./voiceQueueReport.socket')[_0x1c21('0x1c')](socket);function respondWithStatusCode(_0x3aff5e,_0x5a0535){_0x5a0535=_0x5a0535||0xcc;return function(_0x196c18){if(_0x196c18){return _0x3aff5e[_0x1c21('0x1d')](_0x5a0535);}return _0x3aff5e[_0x1c21('0x1e')](_0x5a0535)['end']();};}function respondWithResult(_0xea54cd,_0x39df6c){_0x39df6c=_0x39df6c||0xc8;return function(_0x16aded){if(_0x16aded){return _0xea54cd['status'](_0x39df6c)[_0x1c21('0x1f')](_0x16aded);}};}function respondWithFilteredResult(_0x5f5db3,_0x20e511){return function(_0xadf51b){if(_0xadf51b){var _0x239f61=typeof _0x20e511[_0x1c21('0x20')]===_0x1c21('0x21')&&typeof _0x20e511[_0x1c21('0x22')]==='undefined';var _0xfca082=_0xadf51b[_0x1c21('0x23')];var _0x42807e=_0x239f61?0x0:_0x20e511['offset'];var _0x3ec807=_0x239f61?_0xadf51b['count']:_0x20e511[_0x1c21('0x20')]+_0x20e511['limit'];var _0x2fb948;if(_0x3ec807>=_0xfca082){_0x3ec807=_0xfca082;_0x2fb948=0xc8;}else{_0x2fb948=0xce;}_0x5f5db3[_0x1c21('0x1e')](_0x2fb948);return _0x5f5db3[_0x1c21('0x24')]('Content-Range',_0x42807e+'-'+_0x3ec807+'/'+_0xfca082)[_0x1c21('0x1f')](_0xadf51b);}return null;};}function patchUpdates(_0x5953af){return function(_0xc3e85b){try{jsonpatch[_0x1c21('0x25')](_0xc3e85b,_0x5953af,!![]);}catch(_0x267ff6){return BPromise['reject'](_0x267ff6);}return _0xc3e85b['save']();};}function saveUpdates(_0x204c17,_0x54c6cb){return function(_0x57f3a7){if(_0x57f3a7){return _0x57f3a7[_0x1c21('0x26')](_0x204c17)[_0x1c21('0x27')](function(_0x583c85){return _0x583c85;});}return null;};}function removeEntity(_0x5e3304,_0x2b4dea){return function(_0xee8885){if(_0xee8885){return _0xee8885['destroy']()[_0x1c21('0x27')](function(){_0x5e3304[_0x1c21('0x1e')](0xcc)[_0x1c21('0x28')]();});}};}function handleEntityNotFound(_0x6215e9,_0x14466f){return function(_0x3f8f33){if(!_0x3f8f33){_0x6215e9[_0x1c21('0x1d')](0x194);}return _0x3f8f33;};}function handleError(_0x1ec9b2,_0x2000c7){_0x2000c7=_0x2000c7||0x1f4;return function(_0x9bf0df){logger[_0x1c21('0x29')](_0x9bf0df[_0x1c21('0x2a')]);if(_0x9bf0df[_0x1c21('0x2b')]){delete _0x9bf0df['name'];}_0x1ec9b2[_0x1c21('0x1e')](_0x2000c7)['send'](_0x9bf0df);};}exports[_0x1c21('0x2c')]=function(_0x36fc49,_0x170116){var _0x1373a6={},_0xa1ece2={},_0x332eea={'count':0x0,'rows':[]};var _0x250acd=_['map'](db[_0x1c21('0x2d')]['rawAttributes'],function(_0x4ac0c3){return{'name':_0x4ac0c3['fieldName'],'type':_0x4ac0c3[_0x1c21('0x2e')][_0x1c21('0x2f')]};});_0xa1ece2[_0x1c21('0x30')]=_[_0x1c21('0x31')](_0x250acd,_0x1c21('0x2b'));_0xa1ece2['query']=_[_0x1c21('0x32')](_0x36fc49[_0x1c21('0x33')]);_0xa1ece2['filters']=_['intersection'](_0xa1ece2[_0x1c21('0x30')],_0xa1ece2['query']);_0x1373a6['attributes']=_['intersection'](_0xa1ece2[_0x1c21('0x30')],qs[_0x1c21('0x34')](_0x36fc49[_0x1c21('0x33')][_0x1c21('0x34')]));_0x1373a6['attributes']=_0x1373a6['attributes']['length']?_0x1373a6[_0x1c21('0x35')]:_0xa1ece2[_0x1c21('0x30')];if(!_0x36fc49[_0x1c21('0x33')][_0x1c21('0x36')](_0x1c21('0x37'))){_0x1373a6[_0x1c21('0x22')]=qs[_0x1c21('0x22')](_0x36fc49[_0x1c21('0x33')]['limit']);_0x1373a6[_0x1c21('0x20')]=qs[_0x1c21('0x20')](_0x36fc49[_0x1c21('0x33')][_0x1c21('0x20')]);}_0x1373a6[_0x1c21('0x38')]=qs[_0x1c21('0x39')](_0x36fc49['query'][_0x1c21('0x39')]);_0x1373a6[_0x1c21('0x3a')]=qs[_0x1c21('0x3b')](_[_0x1c21('0x3c')](_0x36fc49[_0x1c21('0x33')],_0xa1ece2[_0x1c21('0x3b')]),_0x250acd);if(_0x36fc49[_0x1c21('0x33')][_0x1c21('0x3d')]){_0x1373a6[_0x1c21('0x3a')]=_['merge'](_0x1373a6[_0x1c21('0x3a')],{'$or':_['map'](_0x250acd,function(_0x2bac6e){if(_0x2bac6e[_0x1c21('0x2e')]!==_0x1c21('0x3e')){var _0x5b0a43={};_0x5b0a43[_0x2bac6e[_0x1c21('0x2b')]]={'$like':'%'+_0x36fc49[_0x1c21('0x33')][_0x1c21('0x3d')]+'%'};return _0x5b0a43;}})});}_0x1373a6=_[_0x1c21('0x3f')]({},_0x1373a6,_0x36fc49['options']);var _0x2b35f6={'where':_0x1373a6[_0x1c21('0x3a')]};return db[_0x1c21('0x2d')][_0x1c21('0x23')](_0x2b35f6)['then'](function(_0x1cd834){_0x332eea['count']=_0x1cd834;if(_0x36fc49[_0x1c21('0x33')][_0x1c21('0x40')]){_0x1373a6[_0x1c21('0x41')]=[{'all':!![]}];}return db[_0x1c21('0x2d')][_0x1c21('0x42')](_0x1373a6);})[_0x1c21('0x27')](function(_0x25692a){_0x332eea['rows']=_0x25692a;return _0x332eea;})[_0x1c21('0x27')](respondWithFilteredResult(_0x170116,_0x1373a6))['catch'](handleError(_0x170116,null));};exports[_0x1c21('0x43')]=function(_0x563d70,_0x990e30){var _0x4949ba={'raw':![],'where':{'id':_0x563d70['params']['id']}},_0x247901={};_0x247901[_0x1c21('0x30')]=_[_0x1c21('0x32')](db[_0x1c21('0x2d')][_0x1c21('0x44')]);_0x247901['query']=_[_0x1c21('0x32')](_0x563d70['query']);_0x247901[_0x1c21('0x3b')]=_[_0x1c21('0x45')](_0x247901[_0x1c21('0x30')],_0x247901[_0x1c21('0x33')]);_0x4949ba[_0x1c21('0x35')]=_[_0x1c21('0x45')](_0x247901[_0x1c21('0x30')],qs[_0x1c21('0x34')](_0x563d70[_0x1c21('0x33')]['fields']));_0x4949ba[_0x1c21('0x35')]=_0x4949ba[_0x1c21('0x35')][_0x1c21('0x46')]?_0x4949ba[_0x1c21('0x35')]:_0x247901[_0x1c21('0x30')];if(_0x563d70[_0x1c21('0x33')][_0x1c21('0x40')]){_0x4949ba[_0x1c21('0x41')]=[{'all':!![]}];}_0x4949ba=_['merge']({},_0x4949ba,_0x563d70[_0x1c21('0x47')]);return db['VoiceQueueReport'][_0x1c21('0x48')](_0x4949ba)[_0x1c21('0x27')](handleEntityNotFound(_0x990e30,null))[_0x1c21('0x27')](respondWithResult(_0x990e30,null))['catch'](handleError(_0x990e30,null));};exports[_0x1c21('0x49')]=function(_0x621d27,_0x1771ba){return db['VoiceQueueReport'][_0x1c21('0x49')](_0x621d27[_0x1c21('0x4a')],{})[_0x1c21('0x27')](respondWithResult(_0x1771ba,0xc9))[_0x1c21('0x4b')](handleError(_0x1771ba,null));};exports['update']=function(_0x1ab553,_0x3dc14c){if(_0x1ab553[_0x1c21('0x4a')]['id']){delete _0x1ab553[_0x1c21('0x4a')]['id'];}return db[_0x1c21('0x2d')][_0x1c21('0x48')]({'where':{'id':_0x1ab553[_0x1c21('0x4c')]['id']}})[_0x1c21('0x27')](handleEntityNotFound(_0x3dc14c,null))[_0x1c21('0x27')](saveUpdates(_0x1ab553['body'],null))[_0x1c21('0x27')](respondWithResult(_0x3dc14c,null))[_0x1c21('0x4b')](handleError(_0x3dc14c,null));};exports['destroy']=function(_0x41448e,_0x252f13){return db[_0x1c21('0x2d')][_0x1c21('0x48')]({'where':{'id':_0x41448e[_0x1c21('0x4c')]['id']}})['then'](handleEntityNotFound(_0x252f13,null))[_0x1c21('0x27')](removeEntity(_0x252f13,null))[_0x1c21('0x4b')](handleError(_0x252f13,null));};exports[_0x1c21('0x4d')]=function(_0x86bb31,_0x267639){return db['VoiceQueueReport']['describe']()['then'](respondWithResult(_0x267639,null))[_0x1c21('0x4b')](handleError(_0x267639,null));};exports[_0x1c21('0x4e')]=function(_0x21c93c,_0x47a610){var _0x2eb383={},_0x546afe={},_0x39bdbc={'count':0x0,'rows':[]};_0x546afe['model']=_[_0x1c21('0x32')](db[_0x1c21('0x2d')][_0x1c21('0x44')]);_0x546afe[_0x1c21('0x33')]=_[_0x1c21('0x32')](_0x21c93c[_0x1c21('0x33')]);_0x546afe[_0x1c21('0x3b')]=_['intersection'](_0x546afe[_0x1c21('0x30')],_0x546afe[_0x1c21('0x33')]);_0x2eb383[_0x1c21('0x35')]=_[_0x1c21('0x45')](_0x546afe[_0x1c21('0x30')],qs[_0x1c21('0x34')](_0x21c93c['query'][_0x1c21('0x34')]));_0x2eb383[_0x1c21('0x35')]=_0x2eb383[_0x1c21('0x35')][_0x1c21('0x46')]?_0x2eb383['attributes']:_0x546afe[_0x1c21('0x30')];if(!_0x21c93c[_0x1c21('0x33')][_0x1c21('0x36')](_0x1c21('0x37'))){_0x2eb383[_0x1c21('0x22')]=qs[_0x1c21('0x22')](_0x21c93c['query'][_0x1c21('0x22')]);_0x2eb383[_0x1c21('0x20')]=qs[_0x1c21('0x20')](_0x21c93c[_0x1c21('0x33')][_0x1c21('0x20')]);}_0x2eb383['order']=qs[_0x1c21('0x39')](_0x21c93c[_0x1c21('0x33')][_0x1c21('0x39')]);_0x2eb383[_0x1c21('0x3a')]=qs['filters'](_[_0x1c21('0x3c')](_0x21c93c[_0x1c21('0x33')],_0x546afe[_0x1c21('0x3b')]));if(_0x21c93c['query'][_0x1c21('0x3d')]){_0x2eb383[_0x1c21('0x3a')]=_[_0x1c21('0x3f')](_0x2eb383[_0x1c21('0x3a')],{'$or':_[_0x1c21('0x31')](_0x2eb383[_0x1c21('0x35')],function(_0x3fb5cd){var _0x423ac5={};_0x423ac5[_0x3fb5cd]={'$like':'%'+_0x21c93c[_0x1c21('0x33')]['filter']+'%'};return _0x423ac5;})});}_0x2eb383=_[_0x1c21('0x3f')]({},_0x2eb383,_0x21c93c['options']);var _0x45a6c2={'where':_0x2eb383[_0x1c21('0x3a')]};return db[_0x1c21('0x2d')][_0x1c21('0x23')](_0x45a6c2)[_0x1c21('0x27')](function(_0x43b426){_0x39bdbc[_0x1c21('0x23')]=_0x43b426;if(_0x21c93c[_0x1c21('0x33')]['includeAll']){_0x2eb383[_0x1c21('0x41')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x2eb383);})[_0x1c21('0x27')](function(_0x5900a0){_0x39bdbc[_0x1c21('0x4f')]=_0x5900a0;return _0x39bdbc;})[_0x1c21('0x27')](respondWithFilteredResult(_0x47a610,_0x2eb383,_0x1c21('0x4e')))[_0x1c21('0x4b')](handleError(_0x47a610,null,_0x1c21('0x4e')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 51e6241..ecf6d76 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 _0xaddf=['setMaxListeners','save','emit','hasOwnProperty','hook','events','../../mysqldb','VoiceQueueReport'];(function(_0x534b46,_0x5cdd4d){var _0x525eb8=function(_0x278711){while(--_0x278711){_0x534b46['push'](_0x534b46['shift']());}};_0x525eb8(++_0x5cdd4d);}(_0xaddf,0x14d));var _0xfadd=function(_0x5ea6d3,_0x5be0cc){_0x5ea6d3=_0x5ea6d3-0x0;var _0x505843=_0xaddf[_0x5ea6d3];return _0x505843;};'use strict';var EventEmitter=require(_0xfadd('0x0'));var VoiceQueueReport=require(_0xfadd('0x1'))['db'][_0xfadd('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xfadd('0x3')](0x0);var events={'afterCreate':_0xfadd('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3ad94a){return function(_0x5321e3,_0x43ed2d,_0x2505db){VoiceQueueReportEvents[_0xfadd('0x5')](_0x3ad94a+':'+_0x5321e3['id'],_0x5321e3);VoiceQueueReportEvents['emit'](_0x3ad94a,_0x5321e3);_0x2505db(null);};}for(var e in events){if(events[_0xfadd('0x6')](e)){var event=events[e];VoiceQueueReport[_0xfadd('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0xead8=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save'];(function(_0x5f402c,_0x52d4fb){var _0x33bc5f=function(_0x4d1b97){while(--_0x4d1b97){_0x5f402c['push'](_0x5f402c['shift']());}};_0x33bc5f(++_0x52d4fb);}(_0xead8,0x1bd));var _0x8ead=function(_0x43a65b,_0xf6f770){_0x43a65b=_0x43a65b-0x0;var _0x201e50=_0xead8[_0x43a65b];return _0x201e50;};'use strict';var EventEmitter=require(_0x8ead('0x0'));var VoiceQueueReport=require(_0x8ead('0x1'))['db'][_0x8ead('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x8ead('0x3')](0x0);var events={'afterCreate':_0x8ead('0x4'),'afterUpdate':'update','afterDestroy':_0x8ead('0x5')};function emitEvent(_0x58ae97){return function(_0x13d61f,_0x3ab127,_0x44290f){VoiceQueueReportEvents[_0x8ead('0x6')](_0x58ae97+':'+_0x13d61f['id'],_0x13d61f);VoiceQueueReportEvents[_0x8ead('0x6')](_0x58ae97,_0x13d61f);_0x44290f(null);};}for(var e in events){if(events[_0x8ead('0x7')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x8ead('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 84b2fe3..3ff5953 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 _0xe994=['moment','request-promise','../../config/environment','./voiceQueueReport.attributes','report_queue','calleridnum','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe994,0xe6));var _0x4e99=function(_0x2fb356,_0x567092){_0x2fb356=_0x2fb356-0x0;var _0x27fb4b=_0xe994[_0x2fb356];return _0x27fb4b;};'use strict';var _=require('lodash');var util=require(_0x4e99('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x4e99('0x1'));var BPromise=require('bluebird');var rp=require(_0x4e99('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4e99('0x3'));var attributes=require(_0x4e99('0x4'));module['exports']=function(_0x3698a8,_0x9f0742){return _0x3698a8['define']('VoiceQueueReport',attributes,{'tableName':_0x4e99('0x5'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x4e99('0x6')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf35f=['../../config/environment','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xf35f,0x13e));var _0xff35=function(_0x4ffe6c,_0x1be001){_0x4ffe6c=_0x4ffe6c-0x0;var _0x2bdfc9=_0xf35f[_0x4ffe6c];return _0x2bdfc9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xff35('0x0'))(_0xff35('0x1'));var moment=require(_0xff35('0x2'));var BPromise=require('bluebird');var rp=require(_0xff35('0x3'));var fs=require('fs');var path=require(_0xff35('0x4'));var rimraf=require(_0xff35('0x5'));var config=require(_0xff35('0x6'));var attributes=require('./voiceQueueReport.attributes');module[_0xff35('0x7')]=function(_0x4016b5,_0x25169d){return _0x4016b5['define'](_0xff35('0x8'),attributes,{'tableName':_0xff35('0x9'),'paranoid':![],'indexes':[{'fields':[_0xff35('0xa')]},{'fields':[_0xff35('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 9e3ba9c..3bdbf61 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 _0x2e3c=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','findAll','options','raw','attributes','limit','include','model','map','GetVoiceQueueReport','catch','VoiceQueueReport','create','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','where','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x26333a,_0x3c5363){var _0x2c3ba4=function(_0x3323a9){while(--_0x3323a9){_0x26333a['push'](_0x26333a['shift']());}};_0x2c3ba4(++_0x3c5363);}(_0x2e3c,0xa7));var _0xc2e3=function(_0x1bf617,_0x37ca04){_0x1bf617=_0x1bf617-0x0;var _0x2aa87f=_0x2e3c[_0x1bf617];return _0x2aa87f;};'use strict';var _=require(_0xc2e3('0x0'));var util=require(_0xc2e3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc2e3('0x2'));var fs=require('fs');var Redis=require(_0xc2e3('0x3'));var db=require(_0xc2e3('0x4'))['db'];var utils=require(_0xc2e3('0x5'));var logger=require(_0xc2e3('0x6'))('rpc');var config=require(_0xc2e3('0x7'));var jayson=require(_0xc2e3('0x8'));var client=jayson[_0xc2e3('0x9')][_0xc2e3('0xa')]({'port':0x232a});config[_0xc2e3('0xb')]=_['defaults'](config[_0xc2e3('0xb')],{'host':_0xc2e3('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0xc2e3('0xd')](socket);function respondWithRpcPromise(_0x2c21ea,_0x3e51b5,_0x1db5fb){return new BPromise(function(_0x5d5534,_0x54b312){return client[_0xc2e3('0xe')](_0x2c21ea,_0x1db5fb)[_0xc2e3('0xf')](function(_0x410c93){logger[_0xc2e3('0x10')](_0xc2e3('0x11'),_0x3e51b5,_0xc2e3('0x12'));logger[_0xc2e3('0x13')](_0xc2e3('0x14'),_0x3e51b5,'request\x20sent',JSON[_0xc2e3('0x15')](_0x410c93));if(_0x410c93['error']){if(_0x410c93[_0xc2e3('0x16')][_0xc2e3('0x17')]===0x1f4){logger['error'](_0xc2e3('0x11'),_0x3e51b5,_0x410c93[_0xc2e3('0x16')][_0xc2e3('0x18')]);return _0x54b312(_0x410c93[_0xc2e3('0x16')][_0xc2e3('0x18')]);}logger[_0xc2e3('0x16')](_0xc2e3('0x11'),_0x3e51b5,_0x410c93[_0xc2e3('0x16')][_0xc2e3('0x18')]);return _0x5d5534(_0x410c93[_0xc2e3('0x16')][_0xc2e3('0x18')]);}else{logger[_0xc2e3('0x10')](_0xc2e3('0x11'),_0x3e51b5,'request\x20sent');_0x5d5534(_0x410c93[_0xc2e3('0x19')][_0xc2e3('0x18')]);}})['catch'](function(_0x53b670){logger['error'](_0xc2e3('0x11'),_0x3e51b5,_0x53b670);_0x54b312(_0x53b670);});});}exports['GetVoiceQueueReport']=function(_0x47e15e){var _0x5f01d6=this;return new Promise(function(_0x50ed2c,_0x5f2534){return db['VoiceQueueReport'][_0xc2e3('0x1a')]({'raw':_0x47e15e['options']?_0x47e15e[_0xc2e3('0x1b')][_0xc2e3('0x1c')]===undefined?!![]:![]:!![],'where':_0x47e15e[_0xc2e3('0x1b')]?_0x47e15e[_0xc2e3('0x1b')]['where']||null:null,'attributes':_0x47e15e[_0xc2e3('0x1b')]?_0x47e15e[_0xc2e3('0x1b')][_0xc2e3('0x1d')]||null:null,'limit':_0x47e15e[_0xc2e3('0x1b')]?_0x47e15e['options'][_0xc2e3('0x1e')]||null:null,'include':_0x47e15e[_0xc2e3('0x1b')]?_0x47e15e[_0xc2e3('0x1b')][_0xc2e3('0x1f')]?_['map'](_0x47e15e[_0xc2e3('0x1b')][_0xc2e3('0x1f')],function(_0x15752c){return{'model':db[_0x15752c[_0xc2e3('0x20')]],'as':_0x15752c['as'],'attributes':_0x15752c['attributes'],'include':_0x15752c['include']?_[_0xc2e3('0x21')](_0x15752c['include'],function(_0x1ed91c){return{'model':db[_0x1ed91c[_0xc2e3('0x20')]],'as':_0x1ed91c['as'],'attributes':_0x1ed91c[_0xc2e3('0x1d')],'include':_0x1ed91c[_0xc2e3('0x1f')]?_[_0xc2e3('0x21')](_0x1ed91c[_0xc2e3('0x1f')],function(_0x346b1e){return{'model':db[_0x346b1e['model']],'as':_0x346b1e['as'],'attributes':_0x346b1e[_0xc2e3('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc2e3('0xf')](function(_0x39b9bd){logger['info'](_0xc2e3('0x22'),_0x47e15e);logger[_0xc2e3('0x13')](_0xc2e3('0x22'),_0x47e15e,JSON['stringify'](_0x39b9bd));_0x50ed2c(_0x39b9bd);})[_0xc2e3('0x23')](function(_0x148eb3){logger['error'](_0xc2e3('0x22'),_0x148eb3[_0xc2e3('0x18')],_0x47e15e);_0x5f2534(_0x5f01d6[_0xc2e3('0x16')](0x1f4,_0x148eb3[_0xc2e3('0x18')]));});});};exports['CreateVoiceQueueReport']=function(_0x24bf34){var _0x52fc79=this;return new Promise(function(_0x3cd899,_0xbae789){return db[_0xc2e3('0x24')][_0xc2e3('0x25')](_0x24bf34[_0xc2e3('0x26')],{'raw':_0x24bf34[_0xc2e3('0x1b')]?_0x24bf34[_0xc2e3('0x1b')][_0xc2e3('0x1c')]===undefined?!![]:![]:!![]})[_0xc2e3('0xf')](function(_0x1203af){logger[_0xc2e3('0x10')](_0xc2e3('0x27'),_0x24bf34);logger[_0xc2e3('0x13')]('CreateVoiceQueueReport',_0x24bf34,JSON[_0xc2e3('0x15')](_0x1203af));_0x3cd899(_0x1203af);})[_0xc2e3('0x23')](function(_0x1efa52){logger[_0xc2e3('0x16')](_0xc2e3('0x27'),_0x1efa52[_0xc2e3('0x18')],_0x24bf34);_0xbae789(_0x52fc79[_0xc2e3('0x16')](0x1f4,_0x1efa52['message']));});});};exports[_0xc2e3('0x28')]=function(_0x4ed3ce){var _0x4cdd74=this;return new Promise(function(_0x397536,_0x88f3d1){return db['VoiceQueueReport'][_0xc2e3('0x29')](_0x4ed3ce[_0xc2e3('0x26')],{'raw':_0x4ed3ce[_0xc2e3('0x1b')]?_0x4ed3ce[_0xc2e3('0x1b')][_0xc2e3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ed3ce['options']?_0x4ed3ce['options'][_0xc2e3('0x2a')]||null:null,'attributes':_0x4ed3ce['options']?_0x4ed3ce['options'][_0xc2e3('0x1d')]||null:null,'limit':_0x4ed3ce[_0xc2e3('0x1b')]?_0x4ed3ce[_0xc2e3('0x1b')][_0xc2e3('0x1e')]||null:null})[_0xc2e3('0xf')](function(_0x21df7d){logger[_0xc2e3('0x10')](_0xc2e3('0x28'),_0x4ed3ce);logger[_0xc2e3('0x13')](_0xc2e3('0x28'),_0x4ed3ce,JSON[_0xc2e3('0x15')](_0x21df7d));_0x397536(_0x21df7d);})[_0xc2e3('0x23')](function(_0x40250b){logger[_0xc2e3('0x16')]('UpdateVoiceQueueReport',_0x40250b[_0xc2e3('0x18')],_0x4ed3ce);_0x88f3d1(_0x4cdd74['error'](0x1f4,_0x40250b[_0xc2e3('0x18')]));});});}; \ No newline at end of file +var _0x37b5=['raw','where','limit','include','map','model','attributes','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options'];(function(_0x5ed05a,_0xc10910){var _0x239668=function(_0x5f31b0){while(--_0x5f31b0){_0x5ed05a['push'](_0x5ed05a['shift']());}};_0x239668(++_0xc10910);}(_0x37b5,0x185));var _0x537b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x37b5[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x537b('0x0'));var util=require(_0x537b('0x1'));var moment=require(_0x537b('0x2'));var BPromise=require(_0x537b('0x3'));var rs=require(_0x537b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x537b('0x5'))['db'];var utils=require(_0x537b('0x6'));var logger=require(_0x537b('0x7'))(_0x537b('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x537b('0x9')][_0x537b('0xa')]({'port':0x232a});config[_0x537b('0xb')]=_[_0x537b('0xc')](config[_0x537b('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x537b('0xd'))(new Redis(config['redis']));require(_0x537b('0xe'))[_0x537b('0xf')](socket);function respondWithRpcPromise(_0x1112ab,_0x18694c,_0x49f4dd){return new BPromise(function(_0x12eba3,_0x4bab40){return client[_0x537b('0x10')](_0x1112ab,_0x49f4dd)[_0x537b('0x11')](function(_0x1914ac){logger['info'](_0x537b('0x12'),_0x18694c,_0x537b('0x13'));logger[_0x537b('0x14')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x18694c,_0x537b('0x13'),JSON[_0x537b('0x15')](_0x1914ac));if(_0x1914ac[_0x537b('0x16')]){if(_0x1914ac[_0x537b('0x16')]['code']===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x18694c,_0x1914ac[_0x537b('0x16')]['message']);return _0x4bab40(_0x1914ac[_0x537b('0x16')][_0x537b('0x17')]);}logger[_0x537b('0x16')](_0x537b('0x12'),_0x18694c,_0x1914ac[_0x537b('0x16')][_0x537b('0x17')]);return _0x12eba3(_0x1914ac[_0x537b('0x16')][_0x537b('0x17')]);}else{logger[_0x537b('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x18694c,_0x537b('0x13'));_0x12eba3(_0x1914ac[_0x537b('0x19')][_0x537b('0x17')]);}})[_0x537b('0x1a')](function(_0x5382c0){logger[_0x537b('0x16')](_0x537b('0x12'),_0x18694c,_0x5382c0);_0x4bab40(_0x5382c0);});});}exports[_0x537b('0x1b')]=function(_0x116d59){var _0x1053ab=this;return new Promise(function(_0x26fa40,_0x1b18aa){return db[_0x537b('0x1c')][_0x537b('0x1d')]({'raw':_0x116d59[_0x537b('0x1e')]?_0x116d59[_0x537b('0x1e')][_0x537b('0x1f')]===undefined?!![]:![]:!![],'where':_0x116d59[_0x537b('0x1e')]?_0x116d59[_0x537b('0x1e')][_0x537b('0x20')]||null:null,'attributes':_0x116d59[_0x537b('0x1e')]?_0x116d59[_0x537b('0x1e')]['attributes']||null:null,'limit':_0x116d59[_0x537b('0x1e')]?_0x116d59['options'][_0x537b('0x21')]||null:null,'include':_0x116d59[_0x537b('0x1e')]?_0x116d59[_0x537b('0x1e')][_0x537b('0x22')]?_[_0x537b('0x23')](_0x116d59[_0x537b('0x1e')][_0x537b('0x22')],function(_0x5f2d37){return{'model':db[_0x5f2d37[_0x537b('0x24')]],'as':_0x5f2d37['as'],'attributes':_0x5f2d37[_0x537b('0x25')],'include':_0x5f2d37['include']?_[_0x537b('0x23')](_0x5f2d37[_0x537b('0x22')],function(_0x211c39){return{'model':db[_0x211c39[_0x537b('0x24')]],'as':_0x211c39['as'],'attributes':_0x211c39[_0x537b('0x25')],'include':_0x211c39['include']?_[_0x537b('0x23')](_0x211c39['include'],function(_0x19dfe0){return{'model':db[_0x19dfe0[_0x537b('0x24')]],'as':_0x19dfe0['as'],'attributes':_0x19dfe0[_0x537b('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x254cf1){logger[_0x537b('0x18')](_0x537b('0x1b'),_0x116d59);logger[_0x537b('0x14')](_0x537b('0x1b'),_0x116d59,JSON[_0x537b('0x15')](_0x254cf1));_0x26fa40(_0x254cf1);})[_0x537b('0x1a')](function(_0x6b2448){logger[_0x537b('0x16')](_0x537b('0x1b'),_0x6b2448[_0x537b('0x17')],_0x116d59);_0x1b18aa(_0x1053ab[_0x537b('0x16')](0x1f4,_0x6b2448[_0x537b('0x17')]));});});};exports['CreateVoiceQueueReport']=function(_0x12463a){var _0x2c124d=this;return new Promise(function(_0x3bfef1,_0x245b6a){return db[_0x537b('0x1c')]['create'](_0x12463a[_0x537b('0x26')],{'raw':_0x12463a['options']?_0x12463a[_0x537b('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x537b('0x11')](function(_0x1a2d67){logger[_0x537b('0x18')]('CreateVoiceQueueReport',_0x12463a);logger[_0x537b('0x14')]('CreateVoiceQueueReport',_0x12463a,JSON[_0x537b('0x15')](_0x1a2d67));_0x3bfef1(_0x1a2d67);})['catch'](function(_0x22f7d2){logger['error'](_0x537b('0x27'),_0x22f7d2['message'],_0x12463a);_0x245b6a(_0x2c124d['error'](0x1f4,_0x22f7d2[_0x537b('0x17')]));});});};exports[_0x537b('0x28')]=function(_0x1f4343){var _0x291026=this;return new Promise(function(_0x59992c,_0x15d4fb){return db[_0x537b('0x1c')][_0x537b('0x29')](_0x1f4343['body'],{'raw':_0x1f4343[_0x537b('0x1e')]?_0x1f4343[_0x537b('0x1e')][_0x537b('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f4343[_0x537b('0x1e')]?_0x1f4343['options'][_0x537b('0x20')]||null:null,'attributes':_0x1f4343['options']?_0x1f4343[_0x537b('0x1e')]['attributes']||null:null,'limit':_0x1f4343[_0x537b('0x1e')]?_0x1f4343['options'][_0x537b('0x21')]||null:null})['then'](function(_0x3cc45c){logger['info'](_0x537b('0x28'),_0x1f4343);logger[_0x537b('0x14')]('UpdateVoiceQueueReport',_0x1f4343,JSON[_0x537b('0x15')](_0x3cc45c));_0x59992c(_0x3cc45c);})[_0x537b('0x1a')](function(_0x470897){logger['error'](_0x537b('0x28'),_0x470897[_0x537b('0x17')],_0x1f4343);_0x15d4fb(_0x291026[_0x537b('0x16')](0x1f4,_0x470897['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index c76b9c3..684afcd 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 _0x031f=['length','voiceQueueReport:','./voiceQueueReport.events','remove','emit','removeListener','register'];(function(_0x8074ef,_0x7560bf){var _0x5c0c56=function(_0x46aeca){while(--_0x46aeca){_0x8074ef['push'](_0x8074ef['shift']());}};_0x5c0c56(++_0x7560bf);}(_0x031f,0x1c2));var _0xf031=function(_0x43afcd,_0xc54395){_0x43afcd=_0x43afcd-0x0;var _0x3b5ce7=_0x031f[_0x43afcd];return _0x3b5ce7;};'use strict';var VoiceQueueReportEvents=require(_0xf031('0x0'));var events=['save',_0xf031('0x1'),'update'];function createListener(_0x41ba47,_0x82a41a){return function(_0x14a69c){_0x82a41a[_0xf031('0x2')](_0x41ba47,_0x14a69c);};}function removeListener(_0x4901fd,_0x363a55){return function(){VoiceQueueReportEvents[_0xf031('0x3')](_0x4901fd,_0x363a55);};}exports[_0xf031('0x4')]=function(_0x503c4b){for(var _0x4582af=0x0,_0x32aa5c=events[_0xf031('0x5')];_0x4582af<_0x32aa5c;_0x4582af++){var _0x506616=events[_0x4582af];var _0x3f27ee=createListener(_0xf031('0x6')+_0x506616,_0x503c4b);VoiceQueueReportEvents['on'](_0x506616,_0x3f27ee);}}; \ No newline at end of file +var _0x6f7b=['save','remove','update','emit','register','voiceQueueReport:'];(function(_0x124c5e,_0x4b5e09){var _0x56cfca=function(_0xf98104){while(--_0xf98104){_0x124c5e['push'](_0x124c5e['shift']());}};_0x56cfca(++_0x4b5e09);}(_0x6f7b,0x168));var _0xb6f7=function(_0x26df16,_0xfac097){_0x26df16=_0x26df16-0x0;var _0x17e54e=_0x6f7b[_0x26df16];return _0x17e54e;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xb6f7('0x0'),_0xb6f7('0x1'),_0xb6f7('0x2')];function createListener(_0x2a90d2,_0x39639e){return function(_0xada16f){_0x39639e[_0xb6f7('0x3')](_0x2a90d2,_0xada16f);};}function removeListener(_0x572ba4,_0x284b07){return function(){VoiceQueueReportEvents['removeListener'](_0x572ba4,_0x284b07);};}exports[_0xb6f7('0x4')]=function(_0x25cec3){for(var _0x59b2d9=0x0,_0x11eefa=events['length'];_0x59b2d9<_0x11eefa;_0x59b2d9++){var _0x26b4cb=events[_0x59b2d9];var _0x10cbc1=createListener(_0xb6f7('0x5')+_0x26b4cb,_0x25cec3);VoiceQueueReportEvents['on'](_0x26b4cb,_0x10cbc1);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index ac95048..bfb6990 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 _0x7722=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','post','create','delete'];(function(_0x387dc1,_0x3ba649){var _0x17567c=function(_0x4690aa){while(--_0x4690aa){_0x387dc1['push'](_0x387dc1['shift']());}};_0x17567c(++_0x3ba649);}(_0x7722,0xdd));var _0x2772=function(_0x561aa9,_0x4c70ed){_0x561aa9=_0x561aa9-0x0;var _0x3dc0b6=_0x7722[_0x561aa9];return _0x3dc0b6;};'use strict';var multer=require(_0x2772('0x0'));var util=require(_0x2772('0x1'));var path=require(_0x2772('0x2'));var timeout=require('connect-timeout');var express=require(_0x2772('0x3'));var router=express[_0x2772('0x4')]();var fs_extra=require(_0x2772('0x5'));var auth=require(_0x2772('0x6'));var interaction=require(_0x2772('0x7'));var config=require(_0x2772('0x8'));var controller=require(_0x2772('0x9'));router[_0x2772('0xa')]('/',auth[_0x2772('0xb')](),controller[_0x2772('0xc')]);router['get'](_0x2772('0xd'),auth[_0x2772('0xb')](),controller['show']);router[_0x2772('0xe')]('/',auth[_0x2772('0xb')](),controller[_0x2772('0xf')]);router['put'](_0x2772('0xd'),auth[_0x2772('0xb')](),controller['update']);router[_0x2772('0x10')](_0x2772('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2b51=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','create','update'];(function(_0x253d2b,_0x49a0fb){var _0x3ce8bd=function(_0x3fcafe){while(--_0x3fcafe){_0x253d2b['push'](_0x253d2b['shift']());}};_0x3ce8bd(++_0x49a0fb);}(_0x2b51,0x1c5));var _0x12b5=function(_0x4809c1,_0x9bb768){_0x4809c1=_0x4809c1-0x0;var _0x4359a8=_0x2b51[_0x4809c1];return _0x4359a8;};'use strict';var multer=require(_0x12b5('0x0'));var util=require(_0x12b5('0x1'));var path=require(_0x12b5('0x2'));var timeout=require(_0x12b5('0x3'));var express=require(_0x12b5('0x4'));var router=express[_0x12b5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x12b5('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x12b5('0x7'));router[_0x12b5('0x8')]('/',auth[_0x12b5('0x9')](),controller[_0x12b5('0xa')]);router[_0x12b5('0x8')](_0x12b5('0xb'),auth[_0x12b5('0x9')](),controller[_0x12b5('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x12b5('0xd')]);router['put'](_0x12b5('0xb'),auth['isAuthenticated'](),controller[_0x12b5('0xe')]);router[_0x12b5('0xf')](_0x12b5('0xb'),auth[_0x12b5('0x9')](),controller[_0x12b5('0x10')]);module[_0x12b5('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 6f7da99..a2e0456 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 _0x907b=['DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','STRING'];(function(_0x3965b3,_0x472ff8){var _0x566f01=function(_0x19bb65){while(--_0x19bb65){_0x3965b3['push'](_0x3965b3['shift']());}};_0x566f01(++_0x472ff8);}(_0x907b,0xf9));var _0xb907=function(_0x2ac87c,_0x1b07b4){_0x2ac87c=_0x2ac87c-0x0;var _0x41a0b5=_0x907b[_0x2ac87c];return _0x41a0b5;};'use strict';var Sequelize=require(_0xb907('0x0'));var moment=require(_0xb907('0x1'));module['exports']={'time':{'type':Sequelize[_0xb907('0x2')]},'callid':{'type':Sequelize[_0xb907('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xb907('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xb907('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xb907('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xb907('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xb907('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xb907('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xb907('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xb907('0x4')](_0xb907('0x5'))}}; \ No newline at end of file +var _0xad95=['DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','moment','exports','STRING'];(function(_0x554f31,_0x2ec81e){var _0x2189a4=function(_0x24d6ab){while(--_0x24d6ab){_0x554f31['push'](_0x554f31['shift']());}};_0x2189a4(++_0x2ec81e);}(_0xad95,0x105));var _0x5ad9=function(_0x4376eb,_0x515e1f){_0x4376eb=_0x4376eb-0x0;var _0x49acdc=_0xad95[_0x4376eb];return _0x49acdc;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5ad9('0x0'));module[_0x5ad9('0x1')]={'time':{'type':Sequelize[_0x5ad9('0x2')]},'callid':{'type':Sequelize[_0x5ad9('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x5ad9('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x5ad9('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x5ad9('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x5ad9('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x5ad9('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x5ad9('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x5ad9('0x3')],'allowNull':![],'defaultValue':Sequelize[_0x5ad9('0x4')](_0x5ad9('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 23a8552..b68ea0d 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 _0x10cf=['reject','update','then','destroy','error','stack','name','send','index','VoiceQueuesLog','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','set','Content-Range'];(function(_0x3c08c9,_0x137365){var _0x343f10=function(_0x236592){while(--_0x236592){_0x3c08c9['push'](_0x3c08c9['shift']());}};_0x343f10(++_0x137365);}(_0x10cf,0x1ea));var _0xf10c=function(_0xd7df61,_0x330080){_0xd7df61=_0xd7df61-0x0;var _0x5c2433=_0x10cf[_0xd7df61];return _0x5c2433;};'use strict';var emlformat=require(_0xf10c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf10c('0x1'));var jsonpatch=require(_0xf10c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf10c('0x3'));var Mustache=require(_0xf10c('0x4'));var util=require(_0xf10c('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xf10c('0x6'));var ejs=require(_0xf10c('0x7'));var fs=require('fs');var fs_extra=require(_0xf10c('0x8'));var _=require(_0xf10c('0x9'));var squel=require(_0xf10c('0xa'));var crypto=require(_0xf10c('0xb'));var jsforce=require(_0xf10c('0xc'));var deskjs=require(_0xf10c('0xd'));var toCsv=require(_0xf10c('0x6'));var querystring=require(_0xf10c('0xe'));var Papa=require(_0xf10c('0xf'));var Redis=require(_0xf10c('0x10'));var authService=require(_0xf10c('0x11'));var qs=require(_0xf10c('0x12'));var as=require(_0xf10c('0x13'));var hardwareService=require(_0xf10c('0x14'));var logger=require(_0xf10c('0x15'))(_0xf10c('0x16'));var utils=require(_0xf10c('0x17'));var config=require(_0xf10c('0x18'));var licenseUtil=require(_0xf10c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29f80b,_0x11febd){_0x11febd=_0x11febd||0xcc;return function(_0x5f3788){if(_0x5f3788){return _0x29f80b['sendStatus'](_0x11febd);}return _0x29f80b[_0xf10c('0x1a')](_0x11febd)[_0xf10c('0x1b')]();};}function respondWithResult(_0x4c2c19,_0x220d1b){_0x220d1b=_0x220d1b||0xc8;return function(_0xc21a6f){if(_0xc21a6f){return _0x4c2c19[_0xf10c('0x1a')](_0x220d1b)[_0xf10c('0x1c')](_0xc21a6f);}};}function respondWithFilteredResult(_0x4af66f,_0x354f46){return function(_0xbb8dc8){if(_0xbb8dc8){var _0x913e44=typeof _0x354f46['offset']===_0xf10c('0x1d')&&typeof _0x354f46[_0xf10c('0x1e')]===_0xf10c('0x1d');var _0xb268c2=_0xbb8dc8[_0xf10c('0x1f')];var _0x1d77fb=_0x913e44?0x0:_0x354f46[_0xf10c('0x20')];var _0x1a4f3c=_0x913e44?_0xbb8dc8[_0xf10c('0x1f')]:_0x354f46[_0xf10c('0x20')]+_0x354f46[_0xf10c('0x1e')];var _0x54abce;if(_0x1a4f3c>=_0xb268c2){_0x1a4f3c=_0xb268c2;_0x54abce=0xc8;}else{_0x54abce=0xce;}_0x4af66f['status'](_0x54abce);return _0x4af66f[_0xf10c('0x21')](_0xf10c('0x22'),_0x1d77fb+'-'+_0x1a4f3c+'/'+_0xb268c2)[_0xf10c('0x1c')](_0xbb8dc8);}return null;};}function patchUpdates(_0x5af3ad){return function(_0x43f00a){try{jsonpatch['apply'](_0x43f00a,_0x5af3ad,!![]);}catch(_0x35ef98){return BPromise[_0xf10c('0x23')](_0x35ef98);}return _0x43f00a['save']();};}function saveUpdates(_0x4fe598,_0x4f6a96){return function(_0x1e6979){if(_0x1e6979){return _0x1e6979[_0xf10c('0x24')](_0x4fe598)[_0xf10c('0x25')](function(_0x28331d){return _0x28331d;});}return null;};}function removeEntity(_0x41bc2c,_0x4935fd){return function(_0x1b3fdb){if(_0x1b3fdb){return _0x1b3fdb[_0xf10c('0x26')]()['then'](function(){_0x41bc2c[_0xf10c('0x1a')](0xcc)[_0xf10c('0x1b')]();});}};}function handleEntityNotFound(_0x10db27,_0x37999e){return function(_0x182eb3){if(!_0x182eb3){_0x10db27['sendStatus'](0x194);}return _0x182eb3;};}function handleError(_0x598ee6,_0x181f97){_0x181f97=_0x181f97||0x1f4;return function(_0x3b9488){logger[_0xf10c('0x27')](_0x3b9488[_0xf10c('0x28')]);if(_0x3b9488[_0xf10c('0x29')]){delete _0x3b9488['name'];}_0x598ee6[_0xf10c('0x1a')](_0x181f97)[_0xf10c('0x2a')](_0x3b9488);};}exports[_0xf10c('0x2b')]=function(_0x141f97,_0x5befc2){var _0xc6eab4={},_0x3bb639={},_0x4e54b7={'count':0x0,'rows':[]};var _0x5778d3=_['map'](db[_0xf10c('0x2c')][_0xf10c('0x2d')],function(_0xfdcac5){return{'name':_0xfdcac5['fieldName'],'type':_0xfdcac5[_0xf10c('0x2e')][_0xf10c('0x2f')]};});_0x3bb639[_0xf10c('0x30')]=_[_0xf10c('0x31')](_0x5778d3,'name');_0x3bb639[_0xf10c('0x32')]=_['keys'](_0x141f97['query']);_0x3bb639[_0xf10c('0x33')]=_[_0xf10c('0x34')](_0x3bb639[_0xf10c('0x30')],_0x3bb639[_0xf10c('0x32')]);_0xc6eab4[_0xf10c('0x35')]=_['intersection'](_0x3bb639['model'],qs[_0xf10c('0x36')](_0x141f97[_0xf10c('0x32')][_0xf10c('0x36')]));_0xc6eab4[_0xf10c('0x35')]=_0xc6eab4[_0xf10c('0x35')][_0xf10c('0x37')]?_0xc6eab4['attributes']:_0x3bb639['model'];if(!_0x141f97['query'][_0xf10c('0x38')]('nolimit')){_0xc6eab4[_0xf10c('0x1e')]=qs[_0xf10c('0x1e')](_0x141f97['query'][_0xf10c('0x1e')]);_0xc6eab4[_0xf10c('0x20')]=qs[_0xf10c('0x20')](_0x141f97[_0xf10c('0x32')][_0xf10c('0x20')]);}_0xc6eab4[_0xf10c('0x39')]=qs[_0xf10c('0x3a')](_0x141f97[_0xf10c('0x32')]['sort']);_0xc6eab4[_0xf10c('0x3b')]=qs['filters'](_[_0xf10c('0x3c')](_0x141f97[_0xf10c('0x32')],_0x3bb639[_0xf10c('0x33')]),_0x5778d3);if(_0x141f97[_0xf10c('0x32')][_0xf10c('0x3d')]){_0xc6eab4['where']=_[_0xf10c('0x3e')](_0xc6eab4[_0xf10c('0x3b')],{'$or':_[_0xf10c('0x31')](_0x5778d3,function(_0x2eb104){if(_0x2eb104[_0xf10c('0x2e')]!==_0xf10c('0x3f')){var _0x45d091={};_0x45d091[_0x2eb104[_0xf10c('0x29')]]={'$like':'%'+_0x141f97[_0xf10c('0x32')]['filter']+'%'};return _0x45d091;}})});}_0xc6eab4=_['merge']({},_0xc6eab4,_0x141f97[_0xf10c('0x40')]);var _0x29a68b={'where':_0xc6eab4['where']};return db['VoiceQueuesLog'][_0xf10c('0x1f')](_0x29a68b)[_0xf10c('0x25')](function(_0x51beff){_0x4e54b7[_0xf10c('0x1f')]=_0x51beff;if(_0x141f97[_0xf10c('0x32')][_0xf10c('0x41')]){_0xc6eab4[_0xf10c('0x42')]=[{'all':!![]}];}return db[_0xf10c('0x2c')][_0xf10c('0x43')](_0xc6eab4);})[_0xf10c('0x25')](function(_0x4913ba){_0x4e54b7['rows']=_0x4913ba;return _0x4e54b7;})[_0xf10c('0x25')](respondWithFilteredResult(_0x5befc2,_0xc6eab4))[_0xf10c('0x44')](handleError(_0x5befc2,null));};exports[_0xf10c('0x45')]=function(_0x5b42f0,_0x3acf8f){var _0x32b22b={'raw':!![],'where':{'id':_0x5b42f0[_0xf10c('0x46')]['id']}},_0x263405={};_0x263405[_0xf10c('0x30')]=_[_0xf10c('0x47')](db[_0xf10c('0x2c')][_0xf10c('0x2d')]);_0x263405[_0xf10c('0x32')]=_['keys'](_0x5b42f0[_0xf10c('0x32')]);_0x263405[_0xf10c('0x33')]=_[_0xf10c('0x34')](_0x263405['model'],_0x263405['query']);_0x32b22b[_0xf10c('0x35')]=_['intersection'](_0x263405[_0xf10c('0x30')],qs['fields'](_0x5b42f0[_0xf10c('0x32')][_0xf10c('0x36')]));_0x32b22b[_0xf10c('0x35')]=_0x32b22b[_0xf10c('0x35')][_0xf10c('0x37')]?_0x32b22b[_0xf10c('0x35')]:_0x263405[_0xf10c('0x30')];if(_0x5b42f0['query'][_0xf10c('0x41')]){_0x32b22b[_0xf10c('0x42')]=[{'all':!![]}];}_0x32b22b=_[_0xf10c('0x3e')]({},_0x32b22b,_0x5b42f0[_0xf10c('0x40')]);return db['VoiceQueuesLog'][_0xf10c('0x48')](_0x32b22b)[_0xf10c('0x25')](handleEntityNotFound(_0x3acf8f,null))[_0xf10c('0x25')](respondWithResult(_0x3acf8f,null))['catch'](handleError(_0x3acf8f,null));};exports[_0xf10c('0x49')]=function(_0x1068db,_0x1dc4cc){return db[_0xf10c('0x2c')][_0xf10c('0x49')](_0x1068db[_0xf10c('0x4a')],{})['then'](respondWithResult(_0x1dc4cc,0xc9))[_0xf10c('0x44')](handleError(_0x1dc4cc,null));};exports[_0xf10c('0x24')]=function(_0x3850fb,_0x3de241){if(_0x3850fb['body']['id']){delete _0x3850fb[_0xf10c('0x4a')]['id'];}return db['VoiceQueuesLog'][_0xf10c('0x48')]({'where':{'id':_0x3850fb[_0xf10c('0x46')]['id']}})['then'](handleEntityNotFound(_0x3de241,null))['then'](saveUpdates(_0x3850fb[_0xf10c('0x4a')],null))[_0xf10c('0x25')](respondWithResult(_0x3de241,null))[_0xf10c('0x44')](handleError(_0x3de241,null));};exports['destroy']=function(_0x2b93b8,_0x3f3327){return db[_0xf10c('0x2c')][_0xf10c('0x48')]({'where':{'id':_0x2b93b8[_0xf10c('0x46')]['id']}})[_0xf10c('0x25')](handleEntityNotFound(_0x3f3327,null))[_0xf10c('0x25')](removeEntity(_0x3f3327,null))[_0xf10c('0x44')](handleError(_0x3f3327,null));}; \ No newline at end of file +var _0xa4f7=['findAll','catch','show','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','VoiceQueuesLog','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x4dd30c,_0x5212a7){var _0x520019=function(_0x373daa){while(--_0x373daa){_0x4dd30c['push'](_0x4dd30c['shift']());}};_0x520019(++_0x5212a7);}(_0xa4f7,0x9d));var _0x7a4f=function(_0x2f71df,_0x1cb940){_0x2f71df=_0x2f71df-0x0;var _0x5f00ce=_0xa4f7[_0x2f71df];return _0x5f00ce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7a4f('0x0'));var zipdir=require(_0x7a4f('0x1'));var jsonpatch=require(_0x7a4f('0x2'));var rp=require(_0x7a4f('0x3'));var moment=require('moment');var BPromise=require(_0x7a4f('0x4'));var Mustache=require(_0x7a4f('0x5'));var util=require(_0x7a4f('0x6'));var path=require('path');var sox=require(_0x7a4f('0x7'));var csv=require(_0x7a4f('0x8'));var ejs=require(_0x7a4f('0x9'));var fs=require('fs');var fs_extra=require(_0x7a4f('0xa'));var _=require(_0x7a4f('0xb'));var squel=require(_0x7a4f('0xc'));var crypto=require(_0x7a4f('0xd'));var jsforce=require(_0x7a4f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7a4f('0x8'));var querystring=require(_0x7a4f('0xf'));var Papa=require(_0x7a4f('0x10'));var Redis=require(_0x7a4f('0x11'));var authService=require(_0x7a4f('0x12'));var qs=require(_0x7a4f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a4f('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x7a4f('0x15'));var config=require(_0x7a4f('0x16'));var licenseUtil=require(_0x7a4f('0x17'));var db=require(_0x7a4f('0x18'))['db'];function respondWithStatusCode(_0x2279c2,_0x8cd605){_0x8cd605=_0x8cd605||0xcc;return function(_0xc2aee1){if(_0xc2aee1){return _0x2279c2[_0x7a4f('0x19')](_0x8cd605);}return _0x2279c2['status'](_0x8cd605)['end']();};}function respondWithResult(_0x28e484,_0x265876){_0x265876=_0x265876||0xc8;return function(_0x116e0e){if(_0x116e0e){return _0x28e484[_0x7a4f('0x1a')](_0x265876)['json'](_0x116e0e);}};}function respondWithFilteredResult(_0xa54276,_0x2b0cd8){return function(_0x2ad55d){if(_0x2ad55d){var _0x4f5aec=typeof _0x2b0cd8[_0x7a4f('0x1b')]==='undefined'&&typeof _0x2b0cd8[_0x7a4f('0x1c')]==='undefined';var _0x4abf10=_0x2ad55d[_0x7a4f('0x1d')];var _0xaec8f4=_0x4f5aec?0x0:_0x2b0cd8[_0x7a4f('0x1b')];var _0x3b3d79=_0x4f5aec?_0x2ad55d[_0x7a4f('0x1d')]:_0x2b0cd8[_0x7a4f('0x1b')]+_0x2b0cd8[_0x7a4f('0x1c')];var _0x4ead85;if(_0x3b3d79>=_0x4abf10){_0x3b3d79=_0x4abf10;_0x4ead85=0xc8;}else{_0x4ead85=0xce;}_0xa54276['status'](_0x4ead85);return _0xa54276['set'](_0x7a4f('0x1e'),_0xaec8f4+'-'+_0x3b3d79+'/'+_0x4abf10)['json'](_0x2ad55d);}return null;};}function patchUpdates(_0x58b221){return function(_0x3fd683){try{jsonpatch[_0x7a4f('0x1f')](_0x3fd683,_0x58b221,!![]);}catch(_0x49e2e0){return BPromise[_0x7a4f('0x20')](_0x49e2e0);}return _0x3fd683[_0x7a4f('0x21')]();};}function saveUpdates(_0x2dc883,_0x49b34d){return function(_0x8e5bb1){if(_0x8e5bb1){return _0x8e5bb1[_0x7a4f('0x22')](_0x2dc883)[_0x7a4f('0x23')](function(_0x39ce69){return _0x39ce69;});}return null;};}function removeEntity(_0x509f89,_0x340b84){return function(_0x1fedc9){if(_0x1fedc9){return _0x1fedc9[_0x7a4f('0x24')]()[_0x7a4f('0x23')](function(){_0x509f89[_0x7a4f('0x1a')](0xcc)[_0x7a4f('0x25')]();});}};}function handleEntityNotFound(_0x3ea9ac,_0x3b8298){return function(_0x44afdf){if(!_0x44afdf){_0x3ea9ac[_0x7a4f('0x19')](0x194);}return _0x44afdf;};}function handleError(_0x3ed163,_0x5bc3ed){_0x5bc3ed=_0x5bc3ed||0x1f4;return function(_0x112a3c){logger[_0x7a4f('0x26')](_0x112a3c[_0x7a4f('0x27')]);if(_0x112a3c['name']){delete _0x112a3c[_0x7a4f('0x28')];}_0x3ed163[_0x7a4f('0x1a')](_0x5bc3ed)[_0x7a4f('0x29')](_0x112a3c);};}exports[_0x7a4f('0x2a')]=function(_0xb0e2b4,_0x2813dd){var _0x22862a={},_0x38fbd8={},_0x47dd4e={'count':0x0,'rows':[]};var _0x1761b5=_['map'](db[_0x7a4f('0x2b')][_0x7a4f('0x2c')],function(_0x531f3a){return{'name':_0x531f3a[_0x7a4f('0x2d')],'type':_0x531f3a[_0x7a4f('0x2e')][_0x7a4f('0x2f')]};});_0x38fbd8['model']=_[_0x7a4f('0x30')](_0x1761b5,_0x7a4f('0x28'));_0x38fbd8[_0x7a4f('0x31')]=_[_0x7a4f('0x32')](_0xb0e2b4[_0x7a4f('0x31')]);_0x38fbd8['filters']=_['intersection'](_0x38fbd8['model'],_0x38fbd8[_0x7a4f('0x31')]);_0x22862a['attributes']=_[_0x7a4f('0x33')](_0x38fbd8[_0x7a4f('0x34')],qs['fields'](_0xb0e2b4[_0x7a4f('0x31')][_0x7a4f('0x35')]));_0x22862a[_0x7a4f('0x36')]=_0x22862a['attributes'][_0x7a4f('0x37')]?_0x22862a['attributes']:_0x38fbd8['model'];if(!_0xb0e2b4[_0x7a4f('0x31')][_0x7a4f('0x38')](_0x7a4f('0x39'))){_0x22862a[_0x7a4f('0x1c')]=qs[_0x7a4f('0x1c')](_0xb0e2b4[_0x7a4f('0x31')]['limit']);_0x22862a[_0x7a4f('0x1b')]=qs[_0x7a4f('0x1b')](_0xb0e2b4[_0x7a4f('0x31')][_0x7a4f('0x1b')]);}_0x22862a[_0x7a4f('0x3a')]=qs[_0x7a4f('0x3b')](_0xb0e2b4['query']['sort']);_0x22862a[_0x7a4f('0x3c')]=qs[_0x7a4f('0x3d')](_['pick'](_0xb0e2b4[_0x7a4f('0x31')],_0x38fbd8['filters']),_0x1761b5);if(_0xb0e2b4[_0x7a4f('0x31')][_0x7a4f('0x3e')]){_0x22862a[_0x7a4f('0x3c')]=_[_0x7a4f('0x3f')](_0x22862a['where'],{'$or':_[_0x7a4f('0x30')](_0x1761b5,function(_0x592e1e){if(_0x592e1e[_0x7a4f('0x2e')]!==_0x7a4f('0x40')){var _0xca4d66={};_0xca4d66[_0x592e1e[_0x7a4f('0x28')]]={'$like':'%'+_0xb0e2b4['query'][_0x7a4f('0x3e')]+'%'};return _0xca4d66;}})});}_0x22862a=_[_0x7a4f('0x3f')]({},_0x22862a,_0xb0e2b4[_0x7a4f('0x41')]);var _0xf3d76a={'where':_0x22862a['where']};return db[_0x7a4f('0x2b')][_0x7a4f('0x1d')](_0xf3d76a)[_0x7a4f('0x23')](function(_0x143770){_0x47dd4e[_0x7a4f('0x1d')]=_0x143770;if(_0xb0e2b4['query'][_0x7a4f('0x42')]){_0x22862a[_0x7a4f('0x43')]=[{'all':!![]}];}return db[_0x7a4f('0x2b')][_0x7a4f('0x44')](_0x22862a);})[_0x7a4f('0x23')](function(_0x293956){_0x47dd4e['rows']=_0x293956;return _0x47dd4e;})[_0x7a4f('0x23')](respondWithFilteredResult(_0x2813dd,_0x22862a))[_0x7a4f('0x45')](handleError(_0x2813dd,null));};exports[_0x7a4f('0x46')]=function(_0x21b29a,_0x6655dc){var _0x1faec3={'raw':!![],'where':{'id':_0x21b29a['params']['id']}},_0xe4a989={};_0xe4a989[_0x7a4f('0x34')]=_[_0x7a4f('0x32')](db[_0x7a4f('0x2b')]['rawAttributes']);_0xe4a989[_0x7a4f('0x31')]=_[_0x7a4f('0x32')](_0x21b29a[_0x7a4f('0x31')]);_0xe4a989[_0x7a4f('0x3d')]=_['intersection'](_0xe4a989['model'],_0xe4a989['query']);_0x1faec3[_0x7a4f('0x36')]=_[_0x7a4f('0x33')](_0xe4a989[_0x7a4f('0x34')],qs['fields'](_0x21b29a['query'][_0x7a4f('0x35')]));_0x1faec3[_0x7a4f('0x36')]=_0x1faec3['attributes'][_0x7a4f('0x37')]?_0x1faec3[_0x7a4f('0x36')]:_0xe4a989[_0x7a4f('0x34')];if(_0x21b29a[_0x7a4f('0x31')][_0x7a4f('0x42')]){_0x1faec3['include']=[{'all':!![]}];}_0x1faec3=_['merge']({},_0x1faec3,_0x21b29a['options']);return db[_0x7a4f('0x2b')][_0x7a4f('0x47')](_0x1faec3)[_0x7a4f('0x23')](handleEntityNotFound(_0x6655dc,null))['then'](respondWithResult(_0x6655dc,null))[_0x7a4f('0x45')](handleError(_0x6655dc,null));};exports['create']=function(_0x472c0a,_0x2149a3){return db['VoiceQueuesLog'][_0x7a4f('0x48')](_0x472c0a['body'],{})[_0x7a4f('0x23')](respondWithResult(_0x2149a3,0xc9))[_0x7a4f('0x45')](handleError(_0x2149a3,null));};exports[_0x7a4f('0x22')]=function(_0x30ff0e,_0x48da9e){if(_0x30ff0e['body']['id']){delete _0x30ff0e[_0x7a4f('0x49')]['id'];}return db[_0x7a4f('0x2b')]['find']({'where':{'id':_0x30ff0e[_0x7a4f('0x4a')]['id']}})[_0x7a4f('0x23')](handleEntityNotFound(_0x48da9e,null))[_0x7a4f('0x23')](saveUpdates(_0x30ff0e[_0x7a4f('0x49')],null))['then'](respondWithResult(_0x48da9e,null))[_0x7a4f('0x45')](handleError(_0x48da9e,null));};exports[_0x7a4f('0x24')]=function(_0x1402af,_0x4d3c42){return db[_0x7a4f('0x2b')][_0x7a4f('0x47')]({'where':{'id':_0x1402af['params']['id']}})[_0x7a4f('0x23')](handleEntityNotFound(_0x4d3c42,null))[_0x7a4f('0x23')](removeEntity(_0x4d3c42,null))['catch'](handleError(_0x4d3c42,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 6854df4..32b4896 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 _0xe978=['../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x516871,_0x89bbe1){var _0x59e298=function(_0x102a25){while(--_0x102a25){_0x516871['push'](_0x516871['shift']());}};_0x59e298(++_0x89bbe1);}(_0xe978,0x1b1));var _0x8e97=function(_0x58110f,_0x9b3c86){_0x58110f=_0x58110f-0x0;var _0x5282c6=_0xe978[_0x58110f];return _0x5282c6;};'use strict';var _=require(_0x8e97('0x0'));var util=require(_0x8e97('0x1'));var logger=require(_0x8e97('0x2'))(_0x8e97('0x3'));var moment=require(_0x8e97('0x4'));var BPromise=require(_0x8e97('0x5'));var rp=require(_0x8e97('0x6'));var fs=require('fs');var path=require(_0x8e97('0x7'));var rimraf=require(_0x8e97('0x8'));var config=require(_0x8e97('0x9'));var attributes=require('./voiceQueuesLog.attributes');module[_0x8e97('0xa')]=function(_0xe5b994,_0x122e29){return _0xe5b994[_0x8e97('0xb')](_0x8e97('0xc'),attributes,{'tableName':_0x8e97('0xd'),'paranoid':![],'indexes':[{'name':_0x8e97('0xe'),'fields':[_0x8e97('0xf'),_0x8e97('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x278b=['../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','dtm','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5da1b2,_0x462b50){var _0x552e28=function(_0x26dd5f){while(--_0x26dd5f){_0x5da1b2['push'](_0x5da1b2['shift']());}};_0x552e28(++_0x462b50);}(_0x278b,0xcb));var _0xb278=function(_0xe8129c,_0x2fb03c){_0xe8129c=_0xe8129c-0x0;var _0x709fc5=_0x278b[_0xe8129c];return _0x709fc5;};'use strict';var _=require('lodash');var util=require(_0xb278('0x0'));var logger=require(_0xb278('0x1'))(_0xb278('0x2'));var moment=require(_0xb278('0x3'));var BPromise=require(_0xb278('0x4'));var rp=require(_0xb278('0x5'));var fs=require('fs');var path=require(_0xb278('0x6'));var rimraf=require('rimraf');var config=require(_0xb278('0x7'));var attributes=require(_0xb278('0x8'));module[_0xb278('0x9')]=function(_0x256430,_0x11d151){return _0x256430[_0xb278('0xa')](_0xb278('0xb'),attributes,{'tableName':_0xb278('0xc'),'paranoid':![],'indexes':[{'name':_0xb278('0xd'),'fields':['event',_0xb278('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index bb72285..aba9ef1 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 _0xde5d=['VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceQueuesLog,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xde5d,0xd7));var _0xdde5=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xde5d[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xdde5('0x0'));var util=require('util');var moment=require(_0xdde5('0x1'));var BPromise=require(_0xdde5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdde5('0x3'))['db'];var utils=require(_0xdde5('0x4'));var logger=require(_0xdde5('0x5'))('rpc');var config=require(_0xdde5('0x6'));var jayson=require(_0xdde5('0x7'));var client=jayson[_0xdde5('0x8')][_0xdde5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4feada,_0x35d8e8,_0x57402f){return new BPromise(function(_0x39b7f0,_0x560b14){return client[_0xdde5('0xa')](_0x4feada,_0x57402f)[_0xdde5('0xb')](function(_0x501ef0){logger[_0xdde5('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x35d8e8,_0xdde5('0xd'));logger[_0xdde5('0xe')](_0xdde5('0xf'),_0x35d8e8,'request\x20sent',JSON[_0xdde5('0x10')](_0x501ef0));if(_0x501ef0[_0xdde5('0x11')]){if(_0x501ef0[_0xdde5('0x11')][_0xdde5('0x12')]===0x1f4){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x35d8e8,_0x501ef0[_0xdde5('0x11')][_0xdde5('0x13')]);return _0x560b14(_0x501ef0[_0xdde5('0x11')]['message']);}logger['error'](_0xdde5('0x14'),_0x35d8e8,_0x501ef0[_0xdde5('0x11')]['message']);return _0x39b7f0(_0x501ef0['error'][_0xdde5('0x13')]);}else{logger[_0xdde5('0xc')](_0xdde5('0x14'),_0x35d8e8,'request\x20sent');_0x39b7f0(_0x501ef0[_0xdde5('0x15')]['message']);}})[_0xdde5('0x16')](function(_0x29fd36){logger[_0xdde5('0x11')](_0xdde5('0x14'),_0x35d8e8,_0x29fd36);_0x560b14(_0x29fd36);});});} \ 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(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x9d3d,0x96));var _0xd9d3=function(_0xb3237d,_0x47870d){_0xb3237d=_0xb3237d-0x0;var _0x284faf=_0x9d3d[_0xb3237d];return _0x284faf;};'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 c8886bf..0035917 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 _0xbb6f=['get','isAuthenticated','index','/describe','describe','/:id','/:id/download','download','/:id/downloads','/:id/transcribe','downloadTranscribe','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller'];(function(_0x4bf575,_0x2c03f5){var _0x5a07ff=function(_0x7568d7){while(--_0x7568d7){_0x4bf575['push'](_0x4bf575['shift']());}};_0x5a07ff(++_0x2c03f5);}(_0xbb6f,0x1a6));var _0xfbb6=function(_0x4dcf0c,_0x30a636){_0x4dcf0c=_0x4dcf0c-0x0;var _0x1691b7=_0xbb6f[_0x4dcf0c];return _0x1691b7;};'use strict';var multer=require(_0xfbb6('0x0'));var util=require(_0xfbb6('0x1'));var path=require('path');var timeout=require(_0xfbb6('0x2'));var express=require(_0xfbb6('0x3'));var router=express[_0xfbb6('0x4')]();var fs_extra=require(_0xfbb6('0x5'));var auth=require(_0xfbb6('0x6'));var interaction=require(_0xfbb6('0x7'));var config=require(_0xfbb6('0x8'));var controller=require(_0xfbb6('0x9'));router[_0xfbb6('0xa')]('/',auth[_0xfbb6('0xb')](),controller[_0xfbb6('0xc')]);router['get'](_0xfbb6('0xd'),auth[_0xfbb6('0xb')](),controller[_0xfbb6('0xe')]);router[_0xfbb6('0xa')](_0xfbb6('0xf'),auth[_0xfbb6('0xb')](),controller['show']);router[_0xfbb6('0xa')](_0xfbb6('0x10'),auth['isAuthenticated'](),controller[_0xfbb6('0x11')]);router['get'](_0xfbb6('0x12'),controller['downloads']);router[_0xfbb6('0xa')](_0xfbb6('0x13'),auth[_0xfbb6('0xb')](),controller[_0xfbb6('0x14')]);router[_0xfbb6('0x15')]('/',auth[_0xfbb6('0xb')](),controller[_0xfbb6('0x16')]);router[_0xfbb6('0x15')](_0xfbb6('0x13'),auth['isAuthenticated'](),controller['runTranscribe']);router[_0xfbb6('0x17')](_0xfbb6('0xf'),auth[_0xfbb6('0xb')](),controller['update']);router[_0xfbb6('0x18')](_0xfbb6('0xf'),auth[_0xfbb6('0xb')](),controller[_0xfbb6('0x19')]);module[_0xfbb6('0x1a')]=router; \ No newline at end of file +var _0x3998=['/:id/downloads','/:id/transcribe','downloadTranscribe','create','runTranscribe','delete','destroy','exports','path','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','download'];(function(_0x5880c5,_0x56fe81){var _0xb666cb=function(_0x41a2ff){while(--_0x41a2ff){_0x5880c5['push'](_0x5880c5['shift']());}};_0xb666cb(++_0x56fe81);}(_0x3998,0x148));var _0x8399=function(_0x365d9c,_0x2f9b29){_0x365d9c=_0x365d9c-0x0;var _0x20ca95=_0x3998[_0x365d9c];return _0x20ca95;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8399('0x0'));var timeout=require('connect-timeout');var express=require(_0x8399('0x1'));var router=express['Router']();var fs_extra=require(_0x8399('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x8399('0x3'));var config=require(_0x8399('0x4'));var controller=require('./voiceRecording.controller');router['get']('/',auth[_0x8399('0x5')](),controller[_0x8399('0x6')]);router[_0x8399('0x7')](_0x8399('0x8'),auth['isAuthenticated'](),controller[_0x8399('0x9')]);router['get'](_0x8399('0xa'),auth[_0x8399('0x5')](),controller['show']);router[_0x8399('0x7')]('/:id/download',auth[_0x8399('0x5')](),controller[_0x8399('0xb')]);router[_0x8399('0x7')](_0x8399('0xc'),controller['downloads']);router[_0x8399('0x7')](_0x8399('0xd'),auth[_0x8399('0x5')](),controller[_0x8399('0xe')]);router['post']('/',auth[_0x8399('0x5')](),controller[_0x8399('0xf')]);router['post'](_0x8399('0xd'),auth[_0x8399('0x5')](),controller[_0x8399('0x10')]);router['put'](_0x8399('0xa'),auth[_0x8399('0x5')](),controller['update']);router[_0x8399('0x11')](_0x8399('0xa'),auth[_0x8399('0x5')](),controller[_0x8399('0x12')]);module[_0x8399('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index d38d5d0..b151931 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(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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 5957736..585fe56 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 _0x6f44=['createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','runTranscribe','findOne','Setting','transcribeAccountId','transcribeRegion','language','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','data2','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','fieldName','type','differenceBy','format','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','VoiceRecording','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','params','describe','download','../../components/encryptor','value','%s.cypher','decryptFile','secrets','existsSync','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','Not\x20found','downloads','sequelize','uniqueid','token','$and','push','recording','Sequelize','extname','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','unlinkSync','.cypher','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets'];(function(_0x260fa3,_0x491c80){var _0x142101=function(_0xb10631){while(--_0xb10631){_0x260fa3['push'](_0x260fa3['shift']());}};_0x142101(++_0x491c80);}(_0x6f44,0x164));var _0x46f4=function(_0x10e787,_0x738603){_0x10e787=_0x10e787-0x0;var _0x350dfe=_0x6f44[_0x10e787];return _0x350dfe;};'use strict';var emlformat=require(_0x46f4('0x0'));var rimraf=require(_0x46f4('0x1'));var zipdir=require(_0x46f4('0x2'));var jsonpatch=require(_0x46f4('0x3'));var rp=require(_0x46f4('0x4'));var moment=require(_0x46f4('0x5'));var BPromise=require(_0x46f4('0x6'));var Mustache=require(_0x46f4('0x7'));var util=require('util');var path=require('path');var sox=require(_0x46f4('0x8'));var csv=require(_0x46f4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x46f4('0xa'));var _=require(_0x46f4('0xb'));var squel=require('squel');var crypto=require(_0x46f4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x46f4('0xd'));var toCsv=require(_0x46f4('0x9'));var querystring=require(_0x46f4('0xe'));var Papa=require(_0x46f4('0xf'));var AWS=require(_0x46f4('0x10'));var uuidv4=require(_0x46f4('0x11'));var Redis=require(_0x46f4('0x12'));var authService=require(_0x46f4('0x13'));var qs=require(_0x46f4('0x14'));var as=require(_0x46f4('0x15'));var hardwareService=require(_0x46f4('0x16'));var logger=require(_0x46f4('0x17'))(_0x46f4('0x18'));var utils=require('../../config/utils');var config=require(_0x46f4('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x46f4('0x1a'))['db'];function respondWithStatusCode(_0x4bfc28,_0x81bb2d){_0x81bb2d=_0x81bb2d||0xcc;return function(_0xa7951a){if(_0xa7951a){return _0x4bfc28['sendStatus'](_0x81bb2d);}return _0x4bfc28[_0x46f4('0x1b')](_0x81bb2d)[_0x46f4('0x1c')]();};}function respondWithResult(_0x58eee9,_0x2e2b07){_0x2e2b07=_0x2e2b07||0xc8;return function(_0x40232d){if(_0x40232d){return _0x58eee9[_0x46f4('0x1b')](_0x2e2b07)[_0x46f4('0x1d')](_0x40232d);}};}function respondWithFilteredResult(_0x3e397a,_0x366bc9){return function(_0x1714b9){if(_0x1714b9){var _0x18f0f7=typeof _0x366bc9[_0x46f4('0x1e')]===_0x46f4('0x1f')&&typeof _0x366bc9[_0x46f4('0x20')]===_0x46f4('0x1f');var _0xd57d51=_0x1714b9[_0x46f4('0x21')];var _0x463932=_0x18f0f7?0x0:_0x366bc9[_0x46f4('0x1e')];var _0x28baf=_0x18f0f7?_0x1714b9['count']:_0x366bc9[_0x46f4('0x1e')]+_0x366bc9[_0x46f4('0x20')];var _0x30953f;if(_0x28baf>=_0xd57d51){_0x28baf=_0xd57d51;_0x30953f=0xc8;}else{_0x30953f=0xce;}_0x3e397a[_0x46f4('0x1b')](_0x30953f);return _0x3e397a[_0x46f4('0x22')](_0x46f4('0x23'),_0x463932+'-'+_0x28baf+'/'+_0xd57d51)[_0x46f4('0x1d')](_0x1714b9);}return null;};}function patchUpdates(_0x7db00d){return function(_0x12866b){try{jsonpatch[_0x46f4('0x24')](_0x12866b,_0x7db00d,!![]);}catch(_0x457cee){return BPromise[_0x46f4('0x25')](_0x457cee);}return _0x12866b[_0x46f4('0x26')]();};}function saveUpdates(_0x44c570,_0x3134f6){return function(_0x1ccf60){if(_0x1ccf60){return _0x1ccf60[_0x46f4('0x27')](_0x44c570)[_0x46f4('0x28')](function(_0xf4cfc9){return _0xf4cfc9;});}return null;};}function removeEntity(_0x23702f,_0x427355){return function(_0xc007e6){if(_0xc007e6){return _0xc007e6[_0x46f4('0x29')]()[_0x46f4('0x28')](function(){_0x23702f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b44c5,_0x573ce9){return function(_0x433c97){if(!_0x433c97){_0x4b44c5[_0x46f4('0x2a')](0x194);}return _0x433c97;};}function handleError(_0x3b9898,_0x38a1d6){_0x38a1d6=_0x38a1d6||0x1f4;return function(_0x1e1235){logger[_0x46f4('0x2b')](_0x1e1235['stack']);if(_0x1e1235[_0x46f4('0x2c')]){delete _0x1e1235['name'];}_0x3b9898[_0x46f4('0x1b')](_0x38a1d6)[_0x46f4('0x2d')](_0x1e1235);};}exports[_0x46f4('0x2e')]=function(_0x4531af,_0x365c45){var _0xefabb3={},_0x5bbdef={},_0x3e6dfa={'count':0x0,'rows':[]};var _0x42b59a=_[_0x46f4('0x2f')](db['VoiceRecording']['rawAttributes'],function(_0x5442a5){return{'name':_0x5442a5[_0x46f4('0x30')],'type':_0x5442a5[_0x46f4('0x31')]['key']};});_0x5bbdef['model']=_[_0x46f4('0x32')](_['map'](_0x42b59a,_0x46f4('0x2c')),[_0x46f4('0x33')]);_0x5bbdef[_0x46f4('0x34')]=_[_0x46f4('0x35')](_0x4531af[_0x46f4('0x34')]);_0x5bbdef['filters']=_['intersection'](_0x5bbdef[_0x46f4('0x36')],_0x5bbdef[_0x46f4('0x34')]);_0xefabb3[_0x46f4('0x37')]=_[_0x46f4('0x38')](_0x5bbdef[_0x46f4('0x36')],qs[_0x46f4('0x39')](_0x4531af[_0x46f4('0x34')][_0x46f4('0x39')]));_0xefabb3[_0x46f4('0x37')]=_0xefabb3[_0x46f4('0x37')][_0x46f4('0x3a')]?_0xefabb3['attributes']:_0x5bbdef[_0x46f4('0x36')];if(!_0x4531af[_0x46f4('0x34')][_0x46f4('0x3b')](_0x46f4('0x3c'))){_0xefabb3[_0x46f4('0x20')]=qs[_0x46f4('0x20')](_0x4531af['query'][_0x46f4('0x20')]);_0xefabb3[_0x46f4('0x1e')]=qs[_0x46f4('0x1e')](_0x4531af['query'][_0x46f4('0x1e')]);}_0xefabb3[_0x46f4('0x3d')]=qs[_0x46f4('0x3e')](_0x4531af[_0x46f4('0x34')][_0x46f4('0x3e')]);_0xefabb3[_0x46f4('0x3f')]=qs[_0x46f4('0x40')](_[_0x46f4('0x41')](_0x4531af[_0x46f4('0x34')],_0x5bbdef[_0x46f4('0x40')]),_0x42b59a);if(_0x4531af[_0x46f4('0x34')][_0x46f4('0x42')]){_0xefabb3[_0x46f4('0x3f')]=_['merge'](_0xefabb3['where'],{'$or':_[_0x46f4('0x2f')](_0x42b59a,function(_0x59bc6f){if(_0x59bc6f[_0x46f4('0x31')]!=='VIRTUAL'){var _0x48c595={};_0x48c595[_0x59bc6f[_0x46f4('0x2c')]]={'$like':'%'+_0x4531af[_0x46f4('0x34')][_0x46f4('0x42')]+'%'};return _0x48c595;}})});}_0xefabb3=_[_0x46f4('0x43')]({},_0xefabb3,_0x4531af[_0x46f4('0x44')]);var _0x1fc39c={'where':_0xefabb3[_0x46f4('0x3f')]};return db[_0x46f4('0x45')][_0x46f4('0x21')](_0x1fc39c)[_0x46f4('0x28')](function(_0x42c4c9){_0x3e6dfa[_0x46f4('0x21')]=_0x42c4c9;if(_0x4531af[_0x46f4('0x34')][_0x46f4('0x46')]){_0xefabb3['include']=[{'all':!![]}];}return db[_0x46f4('0x45')][_0x46f4('0x47')](_0xefabb3);})[_0x46f4('0x28')](function(_0xec9356){_0x3e6dfa[_0x46f4('0x48')]=_0xec9356;return _0x3e6dfa;})[_0x46f4('0x28')](respondWithFilteredResult(_0x365c45,_0xefabb3))[_0x46f4('0x49')](handleError(_0x365c45,null));};exports[_0x46f4('0x4a')]=function(_0x26ef14,_0xa13d8f){var _0x5901c0={'raw':![],'where':{'id':_0x26ef14['params']['id']}},_0x59ad46={};_0x59ad46[_0x46f4('0x36')]=_[_0x46f4('0x35')](db[_0x46f4('0x45')][_0x46f4('0x4b')]);_0x59ad46[_0x46f4('0x34')]=_[_0x46f4('0x35')](_0x26ef14['query']);_0x59ad46['filters']=_[_0x46f4('0x38')](_0x59ad46[_0x46f4('0x36')],_0x59ad46[_0x46f4('0x34')]);_0x5901c0['attributes']=_[_0x46f4('0x38')](_0x59ad46[_0x46f4('0x36')],qs[_0x46f4('0x39')](_0x26ef14[_0x46f4('0x34')][_0x46f4('0x39')]));_0x5901c0[_0x46f4('0x37')]=_0x5901c0[_0x46f4('0x37')][_0x46f4('0x3a')]?_0x5901c0[_0x46f4('0x37')]:_0x59ad46[_0x46f4('0x36')];if(_0x26ef14[_0x46f4('0x34')][_0x46f4('0x46')]){_0x5901c0[_0x46f4('0x4c')]=[{'all':!![]}];}_0x5901c0=_[_0x46f4('0x43')]({},_0x5901c0,_0x26ef14[_0x46f4('0x44')]);return db[_0x46f4('0x45')][_0x46f4('0x4d')](_0x5901c0)[_0x46f4('0x28')](handleEntityNotFound(_0xa13d8f,null))[_0x46f4('0x28')](respondWithResult(_0xa13d8f,null))[_0x46f4('0x49')](handleError(_0xa13d8f,null));};exports[_0x46f4('0x4e')]=function(_0x2119be,_0x2abbc4){return db[_0x46f4('0x45')][_0x46f4('0x4e')](_0x2119be[_0x46f4('0x4f')],{})['then'](respondWithResult(_0x2abbc4,0xc9))[_0x46f4('0x49')](handleError(_0x2abbc4,null));};exports[_0x46f4('0x27')]=function(_0x4df1eb,_0x127703){if(_0x4df1eb[_0x46f4('0x4f')]['id']){delete _0x4df1eb['body']['id'];}return db[_0x46f4('0x45')][_0x46f4('0x4d')]({'where':{'id':_0x4df1eb[_0x46f4('0x50')]['id']}})[_0x46f4('0x28')](handleEntityNotFound(_0x127703,null))[_0x46f4('0x28')](saveUpdates(_0x4df1eb[_0x46f4('0x4f')],null))['then'](respondWithResult(_0x127703,null))['catch'](handleError(_0x127703,null));};exports[_0x46f4('0x51')]=function(_0x45cddf,_0x2f3f67){return db['VoiceRecording'][_0x46f4('0x51')]()['then'](respondWithResult(_0x2f3f67,null))[_0x46f4('0x49')](handleError(_0x2f3f67,null));};exports[_0x46f4('0x52')]=function(_0x15c021,_0x23504c,_0xc2b382){var _0x17c50f=require(_0x46f4('0x53'));var _0x1fdf79=![];var _0xa6c76e={};if(_0x15c021[_0x46f4('0x34')][_0x46f4('0x31')]&&_0x15c021[_0x46f4('0x34')][_0x46f4('0x31')]==='uniqueid'){_0xa6c76e['uniqueid']=_0x15c021[_0x46f4('0x50')]['id'];}else{_0xa6c76e['id']=_0x15c021[_0x46f4('0x50')]['id'];}return db['VoiceRecording']['find']({'where':_0xa6c76e,'attributes':['id',_0x46f4('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x23504c,null))[_0x46f4('0x28')](function(_0xe82b74){if(_0xe82b74){var _0x2b333a=_0xe82b74['value'];var _0x25b3ac=util[_0x46f4('0x33')](_0x46f4('0x55'),_0x2b333a);if(fs['existsSync'](_0x25b3ac)){_0x1fdf79=!![];return _0x17c50f[_0x46f4('0x56')](_0x25b3ac,_0x2b333a,config[_0x46f4('0x57')]['recording'])['then'](function(){return _0xe82b74;});}return _0xe82b74;}})[_0x46f4('0x28')](function(_0x45fa26){if(_0x45fa26){var _0x44b507=_0x45fa26[_0x46f4('0x54')];if(!fs[_0x46f4('0x58')](_0x44b507)){throw new db['Sequelize'][(_0x46f4('0x59'))](_0x46f4('0x5a'));}if(_0x45fa26[_0x46f4('0x5b')]){return _0x23504c[_0x46f4('0x52')](_0x44b507,_0x45fa26[_0x46f4('0x5b')]+path['extname'](_0x44b507),function(){if(_0x1fdf79){fs[_0x46f4('0x5c')](_0x44b507);}});}else{return _0x23504c[_0x46f4('0x52')](_0x44b507,function(_0x5da085){if(_0x1fdf79){fs[_0x46f4('0x5c')](_0x44b507);}});}}})[_0x46f4('0x49')](function(_0x39006f){if(_0x39006f['message']===_0x46f4('0x5a')){_0x23504c[_0x46f4('0x1b')](0x194)['send'](_0x46f4('0x5d'));}else{return handleError(_0x23504c,null);}});};exports[_0x46f4('0x5e')]=function(_0x1fccfa,_0x19760f,_0x2ab07a){var _0x6ba34=require(_0x46f4('0x53'));var _0x5bcb1f=![];var _0x13f44e={'$and':[db[_0x46f4('0x5f')][_0x46f4('0x3f')](db[_0x46f4('0x5f')]['fn']('MD5',db[_0x46f4('0x5f')]['col'](_0x46f4('0x60'))),_0x1fccfa['query'][_0x46f4('0x61')])]};if(_0x1fccfa[_0x46f4('0x34')][_0x46f4('0x31')]&&_0x1fccfa[_0x46f4('0x34')]['type']===_0x46f4('0x60')){_0x13f44e[_0x46f4('0x62')][_0x46f4('0x63')]({'uniqueid':_0x1fccfa['params']['id']});}else{_0x13f44e[_0x46f4('0x62')][_0x46f4('0x63')]({'id':_0x1fccfa[_0x46f4('0x50')]['id']});}return db['VoiceRecording'][_0x46f4('0x4d')]({'where':_0x13f44e,'attributes':['id','value'],'raw':!![]})[_0x46f4('0x28')](handleEntityNotFound(_0x19760f,null))[_0x46f4('0x28')](function(_0x25a120){if(_0x25a120){var _0x5eb900=util[_0x46f4('0x33')](_0x46f4('0x55'),_0x25a120[_0x46f4('0x54')]);if(fs[_0x46f4('0x58')](_0x5eb900)){_0x5bcb1f=!![];return _0x6ba34[_0x46f4('0x56')](_0x5eb900,_0x25a120[_0x46f4('0x54')],config[_0x46f4('0x57')][_0x46f4('0x64')])[_0x46f4('0x28')](function(){return _0x25a120;});}return _0x25a120;}})['then'](function(_0x2b5108){if(_0x2b5108){if(!fs['existsSync'](_0x2b5108[_0x46f4('0x54')])){throw new db[(_0x46f4('0x65'))][(_0x46f4('0x59'))]('VoiceRecording\x20not\x20found');}if(_0x2b5108[_0x46f4('0x5b')]){return _0x19760f[_0x46f4('0x52')](_0x2b5108[_0x46f4('0x54')],_0x2b5108[_0x46f4('0x5b')]+path[_0x46f4('0x66')](_0x2b5108[_0x46f4('0x54')]),function(){if(_0x5bcb1f){fs[_0x46f4('0x5c')](_0x2b5108[_0x46f4('0x54')]);}});}else{return _0x19760f['download'](_0x2b5108[_0x46f4('0x54')],function(_0x6a62a){if(_0x5bcb1f){fs[_0x46f4('0x5c')](_0x2b5108[_0x46f4('0x54')]);}});}}})[_0x46f4('0x49')](handleError(_0x19760f,null));};exports[_0x46f4('0x29')]=function(_0x3f9abb,_0x2f9bbb){return db['VoiceRecording'][_0x46f4('0x4d')]({'where':{'id':_0x3f9abb[_0x46f4('0x50')]['id']}})[_0x46f4('0x28')](function(_0x2b3efe){if(_[_0x46f4('0x67')](_0x2b3efe)){throw new ReferenceError(_0x46f4('0x68'));}return _0x2b3efe;})[_0x46f4('0x28')](function(_0x5eebb4){var _0x3f8e63=_0x5eebb4[_0x46f4('0x54')];logger[_0x46f4('0x69')](_0x46f4('0x6a'),_0x3f8e63);if(!_[_0x46f4('0x67')](_0x5eebb4['value'])&&fs[_0x46f4('0x58')](_0x3f8e63)){logger['info']('File:\x20\x22'+_0x3f8e63+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x46f4('0x6b')](_0x3f8e63);}_0x3f8e63=_0x3f8e63+_0x46f4('0x6c');if(!_[_0x46f4('0x67')](_0x5eebb4[_0x46f4('0x54')])&&fs['existsSync'](_0x3f8e63)){logger['info'](_0x46f4('0x6d')+_0x3f8e63+_0x46f4('0x6e'));fs[_0x46f4('0x6b')](_0x3f8e63);}return _0x5eebb4;})[_0x46f4('0x28')](function(_0x1f9db0){if(!_0x1f9db0)throw new InternalError();return _0x1f9db0[_0x46f4('0x29')]();})[_0x46f4('0x28')](function(){_0x2f9bbb['status'](0xcc)[_0x46f4('0x1c')]();})['catch'](handleError(_0x2f9bbb,null));};function getBucketslist(_0xb9597,_0x5d566c,_0x33096d){return new Promise(function(_0x4a2cb0,_0x2358b1){var _0x4a9bd9=new AWS['S3']({'accessKeyId':_0x5d566c,'secretAccessKey':_0xb9597,'region':_0x33096d});_0x4a9bd9[_0x46f4('0x6f')]({},function(_0x388a3b,_0x418cf1){if(_0x388a3b){return _0x2358b1(_0x388a3b);}else{return _0x4a2cb0(_0x418cf1);}});});}function createBucket(_0x3cd35b,_0xb64215,_0x3bc63f,_0x49c9d5){return new Promise(function(_0x2aee28,_0x18b0fb){var _0x39c64d=new AWS['S3']({'accessKeyId':_0xb64215,'secretAccessKey':_0x3cd35b,'region':_0x3bc63f});_0x39c64d[_0x46f4('0x70')]({'Bucket':_0x49c9d5},function(_0x5c9046,_0x5d847a){if(_0x5c9046){return _0x18b0fb(_0x5c9046);}else{return _0x2aee28(_0x5d847a);}});});}function uploadFile(_0x3294df,_0x116e12,_0x226bf6,_0x52b0ea,_0x432e9f,_0x513d70){return new Promise(function(_0x580065,_0x1e0f8c){var _0x4d5a04=new AWS['S3']({'accessKeyId':_0x116e12,'secretAccessKey':_0x3294df,'region':_0x226bf6});_0x4d5a04[_0x46f4('0x71')]({'Bucket':_0x52b0ea,'Key':_0x432e9f,'Body':_0x513d70},function(_0x3d7431,_0x2f8259){if(_0x3d7431){return _0x1e0f8c(_0x3d7431);}else{return _0x580065(_0x2f8259);}});});}function startTranscribe(_0x14bbed,_0x5415a7,_0x5378da,_0x38b5ba,_0x113814,_0x1520fd){return new Promise(function(_0x4b83e1,_0xb6cc4c){var _0x11ad04=new AWS[(_0x46f4('0x72'))]({'accessKeyId':_0x5415a7,'secretAccessKey':_0x14bbed,'region':_0x5378da});_0x11ad04[_0x46f4('0x73')]({'TranscriptionJobName':_0x38b5ba,'LanguageCode':_0x113814,'Media':{'MediaFileUri':_0x1520fd}},function(_0x50b247,_0x32624c){if(_0x50b247){return _0xb6cc4c(_0x50b247);}else{return _0x4b83e1(_0x32624c);}});});}function transcribe(_0x1dbd26,_0x176c43,_0x1e9f10,_0x4cf126,_0x3f5df4,_0x7e3f15,_0x7fb5b3){return new Promise(function(_0x5af7d2,_0x132f15){var _0x55fe7c={};logger[_0x46f4('0x69')](util['format'](_0x46f4('0x74'),_0x1dbd26,_0x3f5df4));return uploadFile(_0x176c43,_0x1e9f10,_0x4cf126,_0x3f5df4,path[_0x46f4('0x75')](_0x7e3f15),fs[_0x46f4('0x76')](_0x7e3f15))[_0x46f4('0x28')](function(_0x57803b){logger[_0x46f4('0x69')](util[_0x46f4('0x33')](_0x46f4('0x77'),_0x1dbd26,_0x3f5df4,_0x57803b[_0x46f4('0x78')]));_0x55fe7c['bucket']=_0x57803b[_0x46f4('0x79')];_0x55fe7c[_0x46f4('0x7a')]=_0x57803b[_0x46f4('0x78')];logger[_0x46f4('0x69')](util[_0x46f4('0x33')](_0x46f4('0x7b'),_0x1dbd26));return startTranscribe(_0x176c43,_0x1e9f10,_0x4cf126,uuidv4(),_0x7fb5b3,_0x57803b['Location']);})[_0x46f4('0x28')](function(_0x1aec6a){logger['info'](util[_0x46f4('0x33')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x1dbd26,_0x1aec6a[_0x46f4('0x7c')][_0x46f4('0x7d')]));_0x55fe7c[_0x46f4('0x7e')]=_0x1aec6a['TranscriptionJob'][_0x46f4('0x7d')];_0x55fe7c[_0x46f4('0x7f')]=_0x1aec6a[_0x46f4('0x7c')]['TranscriptionJobStatus'];return _0x5af7d2(_0x55fe7c);})['catch'](function(_0x468725){return _0x132f15(_0x468725);});});}exports[_0x46f4('0x80')]=function(_0x23a25f,_0x2f01cb,_0x3412f0){var _0x3b85f1;var _0x182c27;var _0x38746a;var _0x53cb96=require(_0x46f4('0x53'));return db[_0x46f4('0x45')][_0x46f4('0x81')]({'where':{'id':_0x23a25f[_0x46f4('0x50')]['id']}})[_0x46f4('0x28')](function(_0xc39b75){if(_0xc39b75){var _0x454503=util['format'](_0x46f4('0x55'),_0xc39b75[_0x46f4('0x54')]);if(fs[_0x46f4('0x58')](_0x454503)){cypher=!![];return _0x53cb96['decryptFile'](_0x454503,_0xc39b75[_0x46f4('0x54')],config['secrets'][_0x46f4('0x64')])[_0x46f4('0x28')](function(){return _0xc39b75;});}return _0xc39b75;}})['then'](function(_0x23d230){if(!_0x23d230){throw new db[(_0x46f4('0x65'))][(_0x46f4('0x59'))]('Voice\x20Recording\x20not\x20found');}_0x182c27=_0x23d230;return db[_0x46f4('0x82')][_0x46f4('0x81')]({'where':{'id':0x1}});})[_0x46f4('0x28')](handleEntityNotFound(_0x2f01cb,null))[_0x46f4('0x28')](function(_0x327349){if(_0x327349){_0x3b85f1=_0x327349;if(!_0x3b85f1['transcribe']||!_0x3b85f1[_0x46f4('0x83')]||!_0x3b85f1[_0x46f4('0x84')]||!_0x3b85f1[_0x46f4('0x85')]||!_0x3b85f1[_0x46f4('0x86')]){throw new db['Sequelize'][(_0x46f4('0x59'))](_0x46f4('0x87'));}if(_0x23a25f[_0x46f4('0x4f')][_0x46f4('0x88')]&&(!_0x3b85f1[_0x46f4('0x89')]||!_0x3b85f1['sentimentAccountId']||!_0x3b85f1[_0x46f4('0x8a')]||!_0x3b85f1[_0x46f4('0x85')]||!_0x3b85f1['bucket'])){throw new db[(_0x46f4('0x65'))][(_0x46f4('0x59'))](_0x46f4('0x8b'));}return db[_0x46f4('0x8c')][_0x46f4('0x81')]({'where':{'id':_0x3b85f1[_0x46f4('0x83')]}});}})[_0x46f4('0x28')](function(_0x5d5e68){if(!_0x5d5e68){throw new db[(_0x46f4('0x65'))][(_0x46f4('0x59'))](_0x46f4('0x8d'));}if(!_0x5d5e68['data1']||!_0x5d5e68['data2']){throw new db['Sequelize'][(_0x46f4('0x59'))]('Cloud\x20Provider\x20not\x20configured');}_0x38746a=_0x5d5e68;return getBucketslist(_0x38746a[_0x46f4('0x8e')],_0x38746a['data2'],_0x3b85f1['transcribeRegion']);})[_0x46f4('0x28')](function(_0x5b6145){if(_0x5b6145&&_0x5b6145[_0x46f4('0x8f')]){var _0x1ee583=_[_0x46f4('0x4d')](_0x5b6145[_0x46f4('0x8f')],function(_0x1b92f5){return _0x1b92f5['Name']===_0x3b85f1[_0x46f4('0x86')];});if(!_0x1ee583){logger['info'](util[_0x46f4('0x33')](_0x46f4('0x90'),_0x23a25f[_0x46f4('0x50')]['id'],_0x3b85f1[_0x46f4('0x86')]));return createBucket(_0x38746a['data1'],_0x38746a['data2'],_0x3b85f1[_0x46f4('0x84')],_0x3b85f1[_0x46f4('0x86')]);}logger['info'](util['format'](_0x46f4('0x91'),_0x23a25f[_0x46f4('0x50')]['id'],_0x3b85f1['bucket']));return;}})[_0x46f4('0x28')](function(_0x2d699a){if(_0x182c27['transcribeStatus']===_0x46f4('0x92')){return transcribe(_0x23a25f[_0x46f4('0x50')]['id'],_0x38746a[_0x46f4('0x8e')],_0x38746a[_0x46f4('0x93')],_0x3b85f1[_0x46f4('0x84')],_0x3b85f1[_0x46f4('0x86')],_0x182c27[_0x46f4('0x54')],_0x3b85f1[_0x46f4('0x85')]);}else{logger[_0x46f4('0x69')](util['format'](_0x46f4('0x94'),_0x23a25f[_0x46f4('0x50')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x46f4('0x28')](function(_0x5030b6){if(_0x5030b6){_0x5030b6[_0x46f4('0x95')]=_0x23a25f[_0x46f4('0x4f')][_0x46f4('0x88')];return _0x182c27[_0x46f4('0x96')](_0x5030b6);}})[_0x46f4('0x28')](respondWithResult(_0x2f01cb,null))[_0x46f4('0x49')](handleError(_0x2f01cb,null));};function writeFile(_0x732836,_0x2aa4bc){return new Promise(function(_0x3ae316,_0x2b6106){fs[_0x46f4('0x97')](_0x2aa4bc,_0x732836,function(_0x3bdacd,_0x4db54b){if(_0x3bdacd){return _0x2b6106(_0x3bdacd);}else{return _0x3ae316(_0x4db54b);}});});}exports['downloadTranscribe']=function(_0x392fd9,_0x2fa36e,_0x508e78){return db[_0x46f4('0x45')]['findOne']({'where':{'id':_0x392fd9[_0x46f4('0x50')]['id']}})[_0x46f4('0x28')](handleEntityNotFound(_0x2fa36e))[_0x46f4('0x28')](function(_0x328d9f){if(_0x328d9f&&_0x328d9f[_0x46f4('0x98')]){var _0x378c41=_0x328d9f[_0x46f4('0x98')];var _0x50773d=config[_0x46f4('0x99')]+_0x46f4('0x9a')+_0x328d9f['id']+_0x46f4('0x9b');if(fs[_0x46f4('0x58')](_0x50773d)){return _0x50773d;}return writeFile(_0x378c41,_0x50773d)[_0x46f4('0x28')](function(){return _0x50773d;});}else{throw new db[(_0x46f4('0x65'))][(_0x46f4('0x59'))]('Transcript\x20not\x20available');}})[_0x46f4('0x28')](function(_0x41dd8b){return _0x2fa36e['download'](_0x41dd8b);})['catch'](handleError(_0x2fa36e));}; \ No newline at end of file +var _0xb60a=['save','destroy','end','stack','name','send','map','VoiceRecording','rawAttributes','fieldName','type','model','differenceBy','format','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','filter','options','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','download','uniqueid','value','%s.cypher','existsSync','decryptFile','recording','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','../../components/encryptor','sequelize','MD5','col','push','$and','Sequelize','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','secrets','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','apply','reject'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb60a,0x110));var _0xab60=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xb60a[_0x1d1779];return _0x2377e9;};'use strict';var emlformat=require(_0xab60('0x0'));var rimraf=require(_0xab60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xab60('0x2'));var rp=require(_0xab60('0x3'));var moment=require(_0xab60('0x4'));var BPromise=require(_0xab60('0x5'));var Mustache=require('mustache');var util=require(_0xab60('0x6'));var path=require('path');var sox=require(_0xab60('0x7'));var csv=require(_0xab60('0x8'));var ejs=require(_0xab60('0x9'));var fs=require('fs');var fs_extra=require(_0xab60('0xa'));var _=require(_0xab60('0xb'));var squel=require(_0xab60('0xc'));var crypto=require(_0xab60('0xd'));var jsforce=require(_0xab60('0xe'));var deskjs=require(_0xab60('0xf'));var toCsv=require(_0xab60('0x8'));var querystring=require('querystring');var Papa=require(_0xab60('0x10'));var AWS=require(_0xab60('0x11'));var uuidv4=require(_0xab60('0x12'));var Redis=require(_0xab60('0x13'));var authService=require(_0xab60('0x14'));var qs=require(_0xab60('0x15'));var as=require(_0xab60('0x16'));var hardwareService=require(_0xab60('0x17'));var logger=require(_0xab60('0x18'))(_0xab60('0x19'));var utils=require(_0xab60('0x1a'));var config=require(_0xab60('0x1b'));var licenseUtil=require(_0xab60('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c4480,_0x28d92a){_0x28d92a=_0x28d92a||0xcc;return function(_0x2861df){if(_0x2861df){return _0x4c4480['sendStatus'](_0x28d92a);}return _0x4c4480[_0xab60('0x1d')](_0x28d92a)['end']();};}function respondWithResult(_0x43d41e,_0x3bb6f4){_0x3bb6f4=_0x3bb6f4||0xc8;return function(_0x2c5370){if(_0x2c5370){return _0x43d41e['status'](_0x3bb6f4)[_0xab60('0x1e')](_0x2c5370);}};}function respondWithFilteredResult(_0x219dd3,_0x4002de){return function(_0x23170e){if(_0x23170e){var _0x129174=typeof _0x4002de[_0xab60('0x1f')]===_0xab60('0x20')&&typeof _0x4002de[_0xab60('0x21')]===_0xab60('0x20');var _0x22ba5b=_0x23170e[_0xab60('0x22')];var _0x3a97f2=_0x129174?0x0:_0x4002de['offset'];var _0x3adbca=_0x129174?_0x23170e[_0xab60('0x22')]:_0x4002de[_0xab60('0x1f')]+_0x4002de[_0xab60('0x21')];var _0x9198ad;if(_0x3adbca>=_0x22ba5b){_0x3adbca=_0x22ba5b;_0x9198ad=0xc8;}else{_0x9198ad=0xce;}_0x219dd3['status'](_0x9198ad);return _0x219dd3[_0xab60('0x23')]('Content-Range',_0x3a97f2+'-'+_0x3adbca+'/'+_0x22ba5b)[_0xab60('0x1e')](_0x23170e);}return null;};}function patchUpdates(_0x355609){return function(_0x15e0e7){try{jsonpatch[_0xab60('0x24')](_0x15e0e7,_0x355609,!![]);}catch(_0x3ab0d7){return BPromise[_0xab60('0x25')](_0x3ab0d7);}return _0x15e0e7[_0xab60('0x26')]();};}function saveUpdates(_0x9ad25f,_0x3cbc36){return function(_0x4ba9f3){if(_0x4ba9f3){return _0x4ba9f3['update'](_0x9ad25f)['then'](function(_0x6ed377){return _0x6ed377;});}return null;};}function removeEntity(_0x24094a,_0x384603){return function(_0x159b80){if(_0x159b80){return _0x159b80[_0xab60('0x27')]()['then'](function(){_0x24094a[_0xab60('0x1d')](0xcc)[_0xab60('0x28')]();});}};}function handleEntityNotFound(_0x55dd4a,_0x1d8663){return function(_0xedb74c){if(!_0xedb74c){_0x55dd4a['sendStatus'](0x194);}return _0xedb74c;};}function handleError(_0x8a9ffc,_0x1f0877){_0x1f0877=_0x1f0877||0x1f4;return function(_0x261ac0){logger['error'](_0x261ac0[_0xab60('0x29')]);if(_0x261ac0['name']){delete _0x261ac0[_0xab60('0x2a')];}_0x8a9ffc[_0xab60('0x1d')](_0x1f0877)[_0xab60('0x2b')](_0x261ac0);};}exports['index']=function(_0xf30dab,_0x3b3baa){var _0xe9099a={},_0x9c77f0={},_0x788edb={'count':0x0,'rows':[]};var _0x2e900d=_[_0xab60('0x2c')](db[_0xab60('0x2d')][_0xab60('0x2e')],function(_0x37d9b6){return{'name':_0x37d9b6[_0xab60('0x2f')],'type':_0x37d9b6[_0xab60('0x30')]['key']};});_0x9c77f0[_0xab60('0x31')]=_[_0xab60('0x32')](_[_0xab60('0x2c')](_0x2e900d,_0xab60('0x2a')),[_0xab60('0x33')]);_0x9c77f0[_0xab60('0x34')]=_[_0xab60('0x35')](_0xf30dab[_0xab60('0x34')]);_0x9c77f0['filters']=_[_0xab60('0x36')](_0x9c77f0[_0xab60('0x31')],_0x9c77f0[_0xab60('0x34')]);_0xe9099a['attributes']=_[_0xab60('0x36')](_0x9c77f0[_0xab60('0x31')],qs[_0xab60('0x37')](_0xf30dab[_0xab60('0x34')]['fields']));_0xe9099a[_0xab60('0x38')]=_0xe9099a['attributes'][_0xab60('0x39')]?_0xe9099a[_0xab60('0x38')]:_0x9c77f0[_0xab60('0x31')];if(!_0xf30dab['query']['hasOwnProperty'](_0xab60('0x3a'))){_0xe9099a[_0xab60('0x21')]=qs[_0xab60('0x21')](_0xf30dab[_0xab60('0x34')][_0xab60('0x21')]);_0xe9099a[_0xab60('0x1f')]=qs[_0xab60('0x1f')](_0xf30dab[_0xab60('0x34')][_0xab60('0x1f')]);}_0xe9099a[_0xab60('0x3b')]=qs[_0xab60('0x3c')](_0xf30dab['query']['sort']);_0xe9099a[_0xab60('0x3d')]=qs[_0xab60('0x3e')](_[_0xab60('0x3f')](_0xf30dab[_0xab60('0x34')],_0x9c77f0['filters']),_0x2e900d);if(_0xf30dab[_0xab60('0x34')]['filter']){_0xe9099a[_0xab60('0x3d')]=_[_0xab60('0x40')](_0xe9099a[_0xab60('0x3d')],{'$or':_[_0xab60('0x2c')](_0x2e900d,function(_0x2cc719){if(_0x2cc719[_0xab60('0x30')]!=='VIRTUAL'){var _0x3e5fbc={};_0x3e5fbc[_0x2cc719['name']]={'$like':'%'+_0xf30dab['query'][_0xab60('0x41')]+'%'};return _0x3e5fbc;}})});}_0xe9099a=_['merge']({},_0xe9099a,_0xf30dab[_0xab60('0x42')]);var _0x2af631={'where':_0xe9099a[_0xab60('0x3d')]};return db['VoiceRecording'][_0xab60('0x22')](_0x2af631)[_0xab60('0x43')](function(_0x2487c9){_0x788edb[_0xab60('0x22')]=_0x2487c9;if(_0xf30dab[_0xab60('0x34')][_0xab60('0x44')]){_0xe9099a[_0xab60('0x45')]=[{'all':!![]}];}return db[_0xab60('0x2d')][_0xab60('0x46')](_0xe9099a);})[_0xab60('0x43')](function(_0x22bc92){_0x788edb[_0xab60('0x47')]=_0x22bc92;return _0x788edb;})[_0xab60('0x43')](respondWithFilteredResult(_0x3b3baa,_0xe9099a))[_0xab60('0x48')](handleError(_0x3b3baa,null));};exports[_0xab60('0x49')]=function(_0x41efde,_0x5b255d){var _0x113203={'raw':![],'where':{'id':_0x41efde[_0xab60('0x4a')]['id']}},_0x205e52={};_0x205e52[_0xab60('0x31')]=_[_0xab60('0x35')](db[_0xab60('0x2d')][_0xab60('0x2e')]);_0x205e52[_0xab60('0x34')]=_[_0xab60('0x35')](_0x41efde['query']);_0x205e52[_0xab60('0x3e')]=_[_0xab60('0x36')](_0x205e52[_0xab60('0x31')],_0x205e52['query']);_0x113203[_0xab60('0x38')]=_[_0xab60('0x36')](_0x205e52[_0xab60('0x31')],qs[_0xab60('0x37')](_0x41efde['query'][_0xab60('0x37')]));_0x113203[_0xab60('0x38')]=_0x113203[_0xab60('0x38')][_0xab60('0x39')]?_0x113203[_0xab60('0x38')]:_0x205e52[_0xab60('0x31')];if(_0x41efde[_0xab60('0x34')]['includeAll']){_0x113203[_0xab60('0x45')]=[{'all':!![]}];}_0x113203=_[_0xab60('0x40')]({},_0x113203,_0x41efde[_0xab60('0x42')]);return db[_0xab60('0x2d')][_0xab60('0x4b')](_0x113203)['then'](handleEntityNotFound(_0x5b255d,null))[_0xab60('0x43')](respondWithResult(_0x5b255d,null))[_0xab60('0x48')](handleError(_0x5b255d,null));};exports[_0xab60('0x4c')]=function(_0x504715,_0x4f1b1a){return db[_0xab60('0x2d')][_0xab60('0x4c')](_0x504715[_0xab60('0x4d')],{})[_0xab60('0x43')](respondWithResult(_0x4f1b1a,0xc9))[_0xab60('0x48')](handleError(_0x4f1b1a,null));};exports[_0xab60('0x4e')]=function(_0x25d3f9,_0x2d5ccb){if(_0x25d3f9[_0xab60('0x4d')]['id']){delete _0x25d3f9[_0xab60('0x4d')]['id'];}return db[_0xab60('0x2d')][_0xab60('0x4b')]({'where':{'id':_0x25d3f9[_0xab60('0x4a')]['id']}})[_0xab60('0x43')](handleEntityNotFound(_0x2d5ccb,null))[_0xab60('0x43')](saveUpdates(_0x25d3f9[_0xab60('0x4d')],null))[_0xab60('0x43')](respondWithResult(_0x2d5ccb,null))['catch'](handleError(_0x2d5ccb,null));};exports[_0xab60('0x4f')]=function(_0xc38b5c,_0xd53e07){return db['VoiceRecording']['describe']()['then'](respondWithResult(_0xd53e07,null))['catch'](handleError(_0xd53e07,null));};exports[_0xab60('0x50')]=function(_0x2ec3ba,_0x16df4d,_0x5159dc){var _0x3c5575=require('../../components/encryptor');var _0x313f78=![];var _0x51eb0a={};if(_0x2ec3ba[_0xab60('0x34')][_0xab60('0x30')]&&_0x2ec3ba[_0xab60('0x34')][_0xab60('0x30')]===_0xab60('0x51')){_0x51eb0a[_0xab60('0x51')]=_0x2ec3ba[_0xab60('0x4a')]['id'];}else{_0x51eb0a['id']=_0x2ec3ba[_0xab60('0x4a')]['id'];}return db[_0xab60('0x2d')][_0xab60('0x4b')]({'where':_0x51eb0a,'attributes':['id',_0xab60('0x52')],'raw':!![]})[_0xab60('0x43')](handleEntityNotFound(_0x16df4d,null))['then'](function(_0xff33ac){if(_0xff33ac){var _0x456b59=_0xff33ac[_0xab60('0x52')];var _0x2344b8=util['format'](_0xab60('0x53'),_0x456b59);if(fs[_0xab60('0x54')](_0x2344b8)){_0x313f78=!![];return _0x3c5575[_0xab60('0x55')](_0x2344b8,_0x456b59,config['secrets'][_0xab60('0x56')])[_0xab60('0x43')](function(){return _0xff33ac;});}return _0xff33ac;}})['then'](function(_0x34209d){if(_0x34209d){var _0x48c0a8=_0x34209d[_0xab60('0x52')];if(!fs['existsSync'](_0x48c0a8)){throw new db['Sequelize'][(_0xab60('0x57'))](_0xab60('0x58'));}if(_0x34209d[_0xab60('0x59')]){return _0x16df4d[_0xab60('0x50')](_0x48c0a8,_0x34209d[_0xab60('0x59')]+path[_0xab60('0x5a')](_0x48c0a8),function(){if(_0x313f78){fs[_0xab60('0x5b')](_0x48c0a8);}});}else{return _0x16df4d['download'](_0x48c0a8,function(_0x5c40e6){if(_0x313f78){fs[_0xab60('0x5b')](_0x48c0a8);}});}}})[_0xab60('0x48')](function(_0x2b0d8c){if(_0x2b0d8c[_0xab60('0x5c')]===_0xab60('0x58')){_0x16df4d[_0xab60('0x1d')](0x194)[_0xab60('0x2b')](_0xab60('0x5d'));}else{return handleError(_0x16df4d,null);}});};exports[_0xab60('0x5e')]=function(_0x8fac0f,_0x4f8373,_0x56b8d4){var _0x48079a=require(_0xab60('0x5f'));var _0x3e382b=![];var _0x4b05f2={'$and':[db[_0xab60('0x60')][_0xab60('0x3d')](db['sequelize']['fn'](_0xab60('0x61'),db[_0xab60('0x60')][_0xab60('0x62')](_0xab60('0x51'))),_0x8fac0f[_0xab60('0x34')]['token'])]};if(_0x8fac0f['query']['type']&&_0x8fac0f['query'][_0xab60('0x30')]===_0xab60('0x51')){_0x4b05f2['$and'][_0xab60('0x63')]({'uniqueid':_0x8fac0f['params']['id']});}else{_0x4b05f2[_0xab60('0x64')][_0xab60('0x63')]({'id':_0x8fac0f[_0xab60('0x4a')]['id']});}return db[_0xab60('0x2d')][_0xab60('0x4b')]({'where':_0x4b05f2,'attributes':['id',_0xab60('0x52')],'raw':!![]})[_0xab60('0x43')](handleEntityNotFound(_0x4f8373,null))[_0xab60('0x43')](function(_0x42e72d){if(_0x42e72d){var _0x413bf6=util['format']('%s.cypher',_0x42e72d['value']);if(fs[_0xab60('0x54')](_0x413bf6)){_0x3e382b=!![];return _0x48079a[_0xab60('0x55')](_0x413bf6,_0x42e72d[_0xab60('0x52')],config['secrets']['recording'])[_0xab60('0x43')](function(){return _0x42e72d;});}return _0x42e72d;}})['then'](function(_0x3921df){if(_0x3921df){if(!fs[_0xab60('0x54')](_0x3921df[_0xab60('0x52')])){throw new db[(_0xab60('0x65'))][(_0xab60('0x57'))](_0xab60('0x58'));}if(_0x3921df[_0xab60('0x59')]){return _0x4f8373[_0xab60('0x50')](_0x3921df[_0xab60('0x52')],_0x3921df['filename']+path[_0xab60('0x5a')](_0x3921df['value']),function(){if(_0x3e382b){fs[_0xab60('0x5b')](_0x3921df[_0xab60('0x52')]);}});}else{return _0x4f8373['download'](_0x3921df[_0xab60('0x52')],function(_0x4e512e){if(_0x3e382b){fs[_0xab60('0x5b')](_0x3921df[_0xab60('0x52')]);}});}}})['catch'](handleError(_0x4f8373,null));};exports[_0xab60('0x27')]=function(_0x9697b,_0x286803){return db[_0xab60('0x2d')]['find']({'where':{'id':_0x9697b['params']['id']}})[_0xab60('0x43')](function(_0x5a49bf){if(_[_0xab60('0x66')](_0x5a49bf)){throw new ReferenceError(_0xab60('0x67'));}return _0x5a49bf;})[_0xab60('0x43')](function(_0x5b0d03){var _0x5c1679=_0x5b0d03[_0xab60('0x52')];logger['info'](_0xab60('0x68'),_0x5c1679);if(!_[_0xab60('0x66')](_0x5b0d03['value'])&&fs[_0xab60('0x54')](_0x5c1679)){logger[_0xab60('0x69')](_0xab60('0x6a')+_0x5c1679+_0xab60('0x6b'));fs[_0xab60('0x6c')](_0x5c1679);}_0x5c1679=_0x5c1679+'.cypher';if(!_[_0xab60('0x66')](_0x5b0d03[_0xab60('0x52')])&&fs['existsSync'](_0x5c1679)){logger[_0xab60('0x69')]('File:\x20\x22'+_0x5c1679+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xab60('0x6c')](_0x5c1679);}return _0x5b0d03;})[_0xab60('0x43')](function(_0x4796f9){if(!_0x4796f9)throw new InternalError();return _0x4796f9['destroy']();})[_0xab60('0x43')](function(){_0x286803['status'](0xcc)[_0xab60('0x28')]();})[_0xab60('0x48')](handleError(_0x286803,null));};function getBucketslist(_0x2e7576,_0x3df1ec,_0x132961){return new Promise(function(_0x4ddea0,_0x2999ca){var _0x5d29c5=new AWS['S3']({'accessKeyId':_0x3df1ec,'secretAccessKey':_0x2e7576,'region':_0x132961});_0x5d29c5[_0xab60('0x6d')]({},function(_0x17f586,_0x3ddaf2){if(_0x17f586){return _0x2999ca(_0x17f586);}else{return _0x4ddea0(_0x3ddaf2);}});});}function createBucket(_0x11f6c0,_0x12f88c,_0x544814,_0x3a294c){return new Promise(function(_0xe5ae0f,_0x52c465){var _0x58bfe8=new AWS['S3']({'accessKeyId':_0x12f88c,'secretAccessKey':_0x11f6c0,'region':_0x544814});_0x58bfe8[_0xab60('0x6e')]({'Bucket':_0x3a294c},function(_0x574fe1,_0x57eddb){if(_0x574fe1){return _0x52c465(_0x574fe1);}else{return _0xe5ae0f(_0x57eddb);}});});}function uploadFile(_0x57787c,_0x29f3f8,_0x402a5d,_0x36e520,_0x352fc7,_0x2ecae6){return new Promise(function(_0x53cbc2,_0x1b72ef){var _0x1d7d4f=new AWS['S3']({'accessKeyId':_0x29f3f8,'secretAccessKey':_0x57787c,'region':_0x402a5d});_0x1d7d4f[_0xab60('0x6f')]({'Bucket':_0x36e520,'Key':_0x352fc7,'Body':_0x2ecae6},function(_0x1d53ab,_0x8f2a3d){if(_0x1d53ab){return _0x1b72ef(_0x1d53ab);}else{return _0x53cbc2(_0x8f2a3d);}});});}function startTranscribe(_0x1020aa,_0x69a3ce,_0x2a8fe7,_0x1ab1d9,_0x4676e9,_0x1f09c3){return new Promise(function(_0x1ab271,_0x4fe06f){var _0x218639=new AWS[(_0xab60('0x70'))]({'accessKeyId':_0x69a3ce,'secretAccessKey':_0x1020aa,'region':_0x2a8fe7});_0x218639[_0xab60('0x71')]({'TranscriptionJobName':_0x1ab1d9,'LanguageCode':_0x4676e9,'Media':{'MediaFileUri':_0x1f09c3}},function(_0x5c853d,_0x12bef3){if(_0x5c853d){return _0x4fe06f(_0x5c853d);}else{return _0x1ab271(_0x12bef3);}});});}function transcribe(_0x444aca,_0x52755d,_0x5e718,_0x12e841,_0x3b44ac,_0x41249c,_0x3ed21b){return new Promise(function(_0x3c7438,_0x5d69c5){var _0x3f495b={};logger['info'](util[_0xab60('0x33')](_0xab60('0x72'),_0x444aca,_0x3b44ac));return uploadFile(_0x52755d,_0x5e718,_0x12e841,_0x3b44ac,path[_0xab60('0x73')](_0x41249c),fs['readFileSync'](_0x41249c))['then'](function(_0x4eaae7){logger[_0xab60('0x69')](util[_0xab60('0x33')](_0xab60('0x74'),_0x444aca,_0x3b44ac,_0x4eaae7[_0xab60('0x75')]));_0x3f495b[_0xab60('0x76')]=_0x4eaae7[_0xab60('0x77')];_0x3f495b[_0xab60('0x78')]=_0x4eaae7['Location'];logger[_0xab60('0x69')](util[_0xab60('0x33')](_0xab60('0x79'),_0x444aca));return startTranscribe(_0x52755d,_0x5e718,_0x12e841,uuidv4(),_0x3ed21b,_0x4eaae7[_0xab60('0x75')]);})[_0xab60('0x43')](function(_0x186223){logger[_0xab60('0x69')](util[_0xab60('0x33')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x444aca,_0x186223[_0xab60('0x7a')][_0xab60('0x7b')]));_0x3f495b['transcribeName']=_0x186223[_0xab60('0x7a')][_0xab60('0x7b')];_0x3f495b[_0xab60('0x7c')]=_0x186223[_0xab60('0x7a')][_0xab60('0x7d')];return _0x3c7438(_0x3f495b);})[_0xab60('0x48')](function(_0x1f8aba){return _0x5d69c5(_0x1f8aba);});});}exports['runTranscribe']=function(_0x30e7ea,_0x148181,_0x2ff70a){var _0x6eccaf;var _0x44a0b2;var _0x537b7f;var _0x402259=require(_0xab60('0x5f'));return db[_0xab60('0x2d')]['findOne']({'where':{'id':_0x30e7ea[_0xab60('0x4a')]['id']}})[_0xab60('0x43')](function(_0x561bb9){if(_0x561bb9){var _0xc765fb=util['format']('%s.cypher',_0x561bb9['value']);if(fs[_0xab60('0x54')](_0xc765fb)){cypher=!![];return _0x402259[_0xab60('0x55')](_0xc765fb,_0x561bb9[_0xab60('0x52')],config[_0xab60('0x7e')][_0xab60('0x56')])[_0xab60('0x43')](function(){return _0x561bb9;});}return _0x561bb9;}})[_0xab60('0x43')](function(_0x478d0e){if(!_0x478d0e){throw new db['Sequelize'][(_0xab60('0x57'))](_0xab60('0x7f'));}_0x44a0b2=_0x478d0e;return db[_0xab60('0x80')][_0xab60('0x81')]({'where':{'id':0x1}});})[_0xab60('0x43')](handleEntityNotFound(_0x148181,null))[_0xab60('0x43')](function(_0x3ca388){if(_0x3ca388){_0x6eccaf=_0x3ca388;if(!_0x6eccaf[_0xab60('0x82')]||!_0x6eccaf[_0xab60('0x83')]||!_0x6eccaf[_0xab60('0x84')]||!_0x6eccaf[_0xab60('0x85')]||!_0x6eccaf[_0xab60('0x76')]){throw new db[(_0xab60('0x65'))][(_0xab60('0x57'))](_0xab60('0x86'));}if(_0x30e7ea[_0xab60('0x4d')][_0xab60('0x87')]&&(!_0x6eccaf[_0xab60('0x88')]||!_0x6eccaf[_0xab60('0x89')]||!_0x6eccaf[_0xab60('0x8a')]||!_0x6eccaf[_0xab60('0x85')]||!_0x6eccaf[_0xab60('0x76')])){throw new db['Sequelize'][(_0xab60('0x57'))](_0xab60('0x8b'));}return db['CloudProvider'][_0xab60('0x81')]({'where':{'id':_0x6eccaf[_0xab60('0x83')]}});}})['then'](function(_0x573b9d){if(!_0x573b9d){throw new db[(_0xab60('0x65'))][(_0xab60('0x57'))](_0xab60('0x8c'));}if(!_0x573b9d[_0xab60('0x8d')]||!_0x573b9d['data2']){throw new db[(_0xab60('0x65'))]['ValidationError'](_0xab60('0x8e'));}_0x537b7f=_0x573b9d;return getBucketslist(_0x537b7f[_0xab60('0x8d')],_0x537b7f[_0xab60('0x8f')],_0x6eccaf[_0xab60('0x84')]);})[_0xab60('0x43')](function(_0x61b00a){if(_0x61b00a&&_0x61b00a[_0xab60('0x90')]){var _0x31dd81=_[_0xab60('0x4b')](_0x61b00a[_0xab60('0x90')],function(_0x4f8e36){return _0x4f8e36['Name']===_0x6eccaf[_0xab60('0x76')];});if(!_0x31dd81){logger['info'](util[_0xab60('0x33')](_0xab60('0x91'),_0x30e7ea['params']['id'],_0x6eccaf[_0xab60('0x76')]));return createBucket(_0x537b7f[_0xab60('0x8d')],_0x537b7f['data2'],_0x6eccaf[_0xab60('0x84')],_0x6eccaf[_0xab60('0x76')]);}logger[_0xab60('0x69')](util[_0xab60('0x33')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x30e7ea[_0xab60('0x4a')]['id'],_0x6eccaf['bucket']));return;}})[_0xab60('0x43')](function(_0x3d7f60){if(_0x44a0b2[_0xab60('0x7c')]===_0xab60('0x92')){return transcribe(_0x30e7ea['params']['id'],_0x537b7f['data1'],_0x537b7f[_0xab60('0x8f')],_0x6eccaf['transcribeRegion'],_0x6eccaf[_0xab60('0x76')],_0x44a0b2[_0xab60('0x52')],_0x6eccaf[_0xab60('0x85')]);}else{logger[_0xab60('0x69')](util[_0xab60('0x33')](_0xab60('0x93'),_0x30e7ea[_0xab60('0x4a')]['id']));return{'transcribeStatus':_0xab60('0x94')};}})['then'](function(_0x2e8642){if(_0x2e8642){_0x2e8642['tempSentiment']=_0x30e7ea['body'][_0xab60('0x87')];return _0x44a0b2['updateAttributes'](_0x2e8642);}})['then'](respondWithResult(_0x148181,null))[_0xab60('0x48')](handleError(_0x148181,null));};function writeFile(_0x26ee99,_0x2de0c8){return new Promise(function(_0x2daa05,_0x5ade94){fs['writeFile'](_0x2de0c8,_0x26ee99,function(_0x377c25,_0xd500d2){if(_0x377c25){return _0x5ade94(_0x377c25);}else{return _0x2daa05(_0xd500d2);}});});}exports[_0xab60('0x95')]=function(_0x2573f5,_0xc0a0b4,_0x13c7c0){return db[_0xab60('0x2d')]['findOne']({'where':{'id':_0x2573f5['params']['id']}})['then'](handleEntityNotFound(_0xc0a0b4))[_0xab60('0x43')](function(_0x504158){if(_0x504158&&_0x504158[_0xab60('0x96')]){var _0x52ec75=_0x504158[_0xab60('0x96')];var _0x501549=config[_0xab60('0x97')]+_0xab60('0x98')+_0x504158['id']+_0xab60('0x99');if(fs[_0xab60('0x54')](_0x501549)){return _0x501549;}return writeFile(_0x52ec75,_0x501549)[_0xab60('0x43')](function(){return _0x501549;});}else{throw new db['Sequelize']['ValidationError'](_0xab60('0x9a'));}})[_0xab60('0x43')](function(_0x116911){return _0xc0a0b4[_0xab60('0x50')](_0x116911);})[_0xab60('0x48')](handleError(_0xc0a0b4));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index a022d52..dade812 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 _0x21a3=['./voiceRecording.attributes','define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0x21a3,0x66));var _0x321a=function(_0x29a707,_0x342505){_0x29a707=_0x29a707-0x0;var _0x229e83=_0x21a3[_0x29a707];return _0x229e83;};'use strict';var attributes=require(_0x321a('0x0'));module['exports']=function(_0x2b85b5,_0x19e537){return _0x2b85b5[_0x321a('0x1')](_0x321a('0x2'),attributes,{'tableName':_0x321a('0x3'),'paranoid':![],'indexes':[{'name':_0x321a('0x4'),'fields':['uniqueid']},{'name':'transcribeStatus','fields':[_0x321a('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7f42=['transcribeStatus','./voiceRecording.attributes','VoiceRecording','uniqueid'];(function(_0x4df3c7,_0x520d68){var _0x2081c9=function(_0x345f8d){while(--_0x345f8d){_0x4df3c7['push'](_0x4df3c7['shift']());}};_0x2081c9(++_0x520d68);}(_0x7f42,0x1dd));var _0x27f4=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x7f42[_0x59ee6f];return _0x4c0979;};'use strict';var attributes=require(_0x27f4('0x0'));module['exports']=function(_0x26ace2,_0xd1035c){return _0x26ace2['define'](_0x27f4('0x1'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x27f4('0x2'),'fields':['uniqueid']},{'name':_0x27f4('0x3'),'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 08b3557..b9be483 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 _0x1893=['http','request','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','then','existsSync','value','format','%s.cypher','secrets','unlink','CreateVoiceRecording\x20file\x20encrypted','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x496a49,_0x5430cd){var _0x3f7705=function(_0x13a9cb){while(--_0x13a9cb){_0x496a49['push'](_0x496a49['shift']());}};_0x3f7705(++_0x5430cd);}(_0x1893,0xa2));var _0x3189=function(_0x2c2954,_0x3cadf4){_0x2c2954=_0x2c2954-0x0;var _0x1e834e=_0x1893[_0x2c2954];return _0x1e834e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3189('0x0'));var BPromise=require(_0x3189('0x1'));var rs=require(_0x3189('0x2'));var fs=require('fs');var Redis=require(_0x3189('0x3'));var db=require(_0x3189('0x4'))['db'];var utils=require(_0x3189('0x5'));var logger=require(_0x3189('0x6'))('rpc');var config=require(_0x3189('0x7'));var jayson=require(_0x3189('0x8'));var client=jayson[_0x3189('0x9')][_0x3189('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x77c566,_0x118970,_0x14d84b){return new BPromise(function(_0x1f6764,_0x5312a3){return client[_0x3189('0xb')](_0x77c566,_0x14d84b)['then'](function(_0x127449){logger['info'](_0x3189('0xc'),_0x118970,_0x3189('0xd'));logger[_0x3189('0xe')](_0x3189('0xf'),_0x118970,'request\x20sent',JSON[_0x3189('0x10')](_0x127449));if(_0x127449[_0x3189('0x11')]){if(_0x127449[_0x3189('0x11')][_0x3189('0x12')]===0x1f4){logger[_0x3189('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x118970,_0x127449[_0x3189('0x11')][_0x3189('0x13')]);return _0x5312a3(_0x127449[_0x3189('0x11')][_0x3189('0x13')]);}logger[_0x3189('0x11')](_0x3189('0xc'),_0x118970,_0x127449[_0x3189('0x11')][_0x3189('0x13')]);return _0x1f6764(_0x127449['error'][_0x3189('0x13')]);}else{logger[_0x3189('0x14')](_0x3189('0xc'),_0x118970,_0x3189('0xd'));_0x1f6764(_0x127449['result'][_0x3189('0x13')]);}})['catch'](function(_0x55f432){logger[_0x3189('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x118970,_0x55f432);_0x5312a3(_0x55f432);});});}exports[_0x3189('0x15')]=function(_0xf8aed7){var _0x22c7ba=this;return new Promise(function(_0x9905c4,_0x4c4d9b){return db[_0x3189('0x16')][_0x3189('0x17')](_0xf8aed7[_0x3189('0x18')],{'raw':_0xf8aed7['options']?_0xf8aed7[_0x3189('0x19')][_0x3189('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf8aed7[_0x3189('0x19')]?_0xf8aed7[_0x3189('0x19')][_0x3189('0x1b')]||null:null,'attributes':_0xf8aed7['options']?_0xf8aed7[_0x3189('0x19')][_0x3189('0x1c')]||null:null,'limit':_0xf8aed7[_0x3189('0x19')]?_0xf8aed7['options'][_0x3189('0x1d')]||null:null})['then'](function(_0x4bfc03){logger[_0x3189('0x14')](_0x3189('0x15'),_0xf8aed7);logger[_0x3189('0xe')](_0x3189('0x15'),_0xf8aed7,JSON[_0x3189('0x10')](_0x4bfc03));_0x9905c4(_0x4bfc03);})['catch'](function(_0x4b03ad){logger[_0x3189('0x11')](_0x3189('0x15'),_0x4b03ad[_0x3189('0x13')],_0xf8aed7);_0x4c4d9b(_0x22c7ba[_0x3189('0x11')](0x1f4,_0x4b03ad[_0x3189('0x13')]));});});};exports[_0x3189('0x1e')]=function(_0xdda38b){var _0x379a48=this;return new Promise(function(_0x17b540,_0x5ec0ac){var _0x5ce5f5=require('../../components/encryptor');var _0x5aa34a;return db[_0x3189('0x1f')][_0x3189('0x20')]({'attributes':['id',_0x3189('0x21')],'where':{'id':0x1},'raw':!![]})[_0x3189('0x22')](function(_0x36b258){_0x5aa34a=_0x36b258;return db[_0x3189('0x16')]['create'](_0xdda38b[_0x3189('0x18')]);})[_0x3189('0x22')](function(_0x4bd677){if(_0x5aa34a[_0x3189('0x21')]&&fs[_0x3189('0x23')](_0x4bd677[_0x3189('0x24')])){var _0x5c7a36=util[_0x3189('0x25')](_0x3189('0x26'),_0x4bd677[_0x3189('0x24')]);return _0x5ce5f5['encryptFile'](_0x4bd677[_0x3189('0x24')],_0x5c7a36,config[_0x3189('0x27')]['recording'])[_0x3189('0x22')](function(){fs[_0x3189('0x28')](_0x4bd677[_0x3189('0x24')]);logger[_0x3189('0x14')](_0x3189('0x29'));return _0x4bd677;});}return _0x4bd677;})['then'](function(_0x544c49){logger[_0x3189('0x14')]('CreateVoiceRecording',_0xdda38b);logger[_0x3189('0xe')](_0x3189('0x1e'),_0xdda38b,JSON[_0x3189('0x10')](_0x544c49));_0x17b540(_0x544c49);})[_0x3189('0x2a')](function(_0x231d72){logger[_0x3189('0x11')](_0x3189('0x1e'),_0x231d72[_0x3189('0x13')],_0xdda38b);_0x5ec0ac(_0x379a48[_0x3189('0x11')](0x1f4,_0x231d72['message']));});});}; \ No newline at end of file +var _0xffd6=['catch','UpdateVoiceRecording','update','body','options','raw','where','attributes','CreateVoiceRecording','../../components/encryptor','Setting','VoiceRecording','create','callRecordingEncryption','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x1f35c8,_0x4ff43f){var _0x280bb1=function(_0x319c07){while(--_0x319c07){_0x1f35c8['push'](_0x1f35c8['shift']());}};_0x280bb1(++_0x4ff43f);}(_0xffd6,0x97));var _0x6ffd=function(_0x2074db,_0x10b81b){_0x2074db=_0x2074db-0x0;var _0x27324c=_0xffd6[_0x2074db];return _0x27324c;};'use strict';var _=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var moment=require(_0x6ffd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ffd('0x3'));var db=require(_0x6ffd('0x4'))['db'];var utils=require(_0x6ffd('0x5'));var logger=require('../../config/logger')(_0x6ffd('0x6'));var config=require(_0x6ffd('0x7'));var jayson=require(_0x6ffd('0x8'));var client=jayson[_0x6ffd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x122b71,_0xeefe34,_0x2445a0){return new BPromise(function(_0x1fbbe6,_0x1d8b50){return client['request'](_0x122b71,_0x2445a0)[_0x6ffd('0xa')](function(_0x417f34){logger['info'](_0x6ffd('0xb'),_0xeefe34,_0x6ffd('0xc'));logger[_0x6ffd('0xd')](_0x6ffd('0xe'),_0xeefe34,_0x6ffd('0xc'),JSON[_0x6ffd('0xf')](_0x417f34));if(_0x417f34[_0x6ffd('0x10')]){if(_0x417f34['error'][_0x6ffd('0x11')]===0x1f4){logger[_0x6ffd('0x10')]('VoiceRecording,\x20%s,\x20%s',_0xeefe34,_0x417f34[_0x6ffd('0x10')][_0x6ffd('0x12')]);return _0x1d8b50(_0x417f34[_0x6ffd('0x10')][_0x6ffd('0x12')]);}logger['error'](_0x6ffd('0xb'),_0xeefe34,_0x417f34['error'][_0x6ffd('0x12')]);return _0x1fbbe6(_0x417f34['error'][_0x6ffd('0x12')]);}else{logger[_0x6ffd('0x13')](_0x6ffd('0xb'),_0xeefe34,'request\x20sent');_0x1fbbe6(_0x417f34[_0x6ffd('0x14')][_0x6ffd('0x12')]);}})[_0x6ffd('0x15')](function(_0x3394b2){logger[_0x6ffd('0x10')](_0x6ffd('0xb'),_0xeefe34,_0x3394b2);_0x1d8b50(_0x3394b2);});});}exports[_0x6ffd('0x16')]=function(_0x889a4b){var _0x545576=this;return new Promise(function(_0x11a609,_0x56c541){return db['VoiceRecording'][_0x6ffd('0x17')](_0x889a4b[_0x6ffd('0x18')],{'raw':_0x889a4b['options']?_0x889a4b[_0x6ffd('0x19')][_0x6ffd('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x889a4b['options']?_0x889a4b['options'][_0x6ffd('0x1b')]||null:null,'attributes':_0x889a4b[_0x6ffd('0x19')]?_0x889a4b['options'][_0x6ffd('0x1c')]||null:null,'limit':_0x889a4b[_0x6ffd('0x19')]?_0x889a4b[_0x6ffd('0x19')]['limit']||null:null})[_0x6ffd('0xa')](function(_0x2efeb5){logger['info'](_0x6ffd('0x16'),_0x889a4b);logger[_0x6ffd('0xd')]('UpdateVoiceRecording',_0x889a4b,JSON[_0x6ffd('0xf')](_0x2efeb5));_0x11a609(_0x2efeb5);})[_0x6ffd('0x15')](function(_0xb504e5){logger['error'](_0x6ffd('0x16'),_0xb504e5[_0x6ffd('0x12')],_0x889a4b);_0x56c541(_0x545576[_0x6ffd('0x10')](0x1f4,_0xb504e5['message']));});});};exports[_0x6ffd('0x1d')]=function(_0x5a55e2){var _0x41ab4a=this;return new Promise(function(_0x43269c,_0x56c6de){var _0x520258=require(_0x6ffd('0x1e'));var _0x2a0391;return db[_0x6ffd('0x1f')]['findOne']({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x6ffd('0xa')](function(_0x48feb4){_0x2a0391=_0x48feb4;return db[_0x6ffd('0x20')][_0x6ffd('0x21')](_0x5a55e2['body']);})[_0x6ffd('0xa')](function(_0xc790b2){if(_0x2a0391[_0x6ffd('0x22')]&&fs[_0x6ffd('0x23')](_0xc790b2[_0x6ffd('0x24')])){var _0x31c609=util[_0x6ffd('0x25')](_0x6ffd('0x26'),_0xc790b2[_0x6ffd('0x24')]);return _0x520258[_0x6ffd('0x27')](_0xc790b2[_0x6ffd('0x24')],_0x31c609,config[_0x6ffd('0x28')][_0x6ffd('0x29')])['then'](function(){fs['unlink'](_0xc790b2['value']);logger[_0x6ffd('0x13')](_0x6ffd('0x2a'));return _0xc790b2;});}return _0xc790b2;})[_0x6ffd('0xa')](function(_0x528a3f){logger[_0x6ffd('0x13')](_0x6ffd('0x1d'),_0x5a55e2);logger[_0x6ffd('0xd')](_0x6ffd('0x1d'),_0x5a55e2,JSON[_0x6ffd('0xf')](_0x528a3f));_0x43269c(_0x528a3f);})[_0x6ffd('0x15')](function(_0x26394c){logger[_0x6ffd('0x10')](_0x6ffd('0x1d'),_0x26394c['message'],_0x5a55e2);_0x56c6de(_0x41ab4a[_0x6ffd('0x10')](0x1f4,_0x26394c[_0x6ffd('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index eba34e5..ec0f7aa 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 _0x4005=['/:id','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4005,0x1da));var _0x5400=function(_0x3fe26d,_0x331cc9){_0x3fe26d=_0x3fe26d-0x0;var _0x27eddd=_0x4005[_0x3fe26d];return _0x27eddd;};'use strict';var multer=require(_0x5400('0x0'));var util=require(_0x5400('0x1'));var path=require(_0x5400('0x2'));var timeout=require(_0x5400('0x3'));var express=require(_0x5400('0x4'));var router=express[_0x5400('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5400('0x6'));var config=require('../../config/environment');var controller=require(_0x5400('0x7'));router[_0x5400('0x8')]('/',auth[_0x5400('0x9')](),controller[_0x5400('0xa')]);router[_0x5400('0x8')](_0x5400('0xb'),auth[_0x5400('0x9')](),controller['describe']);router['get'](_0x5400('0xc'),auth[_0x5400('0x9')](),controller['show']);router[_0x5400('0xd')]('/',auth[_0x5400('0x9')](),controller[_0x5400('0xe')]);router[_0x5400('0xf')]('/:id',auth[_0x5400('0x9')](),controller['update']);router[_0x5400('0x10')](_0x5400('0xc'),auth['isAuthenticated'](),controller[_0x5400('0x11')]);module['exports']=router; \ No newline at end of file +var _0x65c5=['index','get','/describe','describe','/:id','show','put','update','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x65c5,0x100));var _0x565c=function(_0x510672,_0xc61c8d){_0x510672=_0x510672-0x0;var _0x197dea=_0x65c5[_0x510672];return _0x197dea;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x565c('0x0'));var timeout=require(_0x565c('0x1'));var express=require(_0x565c('0x2'));var router=express[_0x565c('0x3')]();var fs_extra=require(_0x565c('0x4'));var auth=require(_0x565c('0x5'));var interaction=require(_0x565c('0x6'));var config=require(_0x565c('0x7'));var controller=require(_0x565c('0x8'));router['get']('/',auth[_0x565c('0x9')](),controller[_0x565c('0xa')]);router[_0x565c('0xb')](_0x565c('0xc'),auth[_0x565c('0x9')](),controller[_0x565c('0xd')]);router[_0x565c('0xb')](_0x565c('0xe'),auth[_0x565c('0x9')](),controller[_0x565c('0xf')]);router['post']('/',auth[_0x565c('0x9')](),controller['create']);router[_0x565c('0x10')](_0x565c('0xe'),auth[_0x565c('0x9')](),controller[_0x565c('0x11')]);router['delete'](_0x565c('0xe'),auth[_0x565c('0x9')](),controller['destroy']);module[_0x565c('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 80b1d84..28bdbeb 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 _0x979d=['ENUM','blind','attended','STRING','moment','exports'];(function(_0x10c51f,_0x11270f){var _0x56a0cd=function(_0x563ac6){while(--_0x563ac6){_0x10c51f['push'](_0x10c51f['shift']());}};_0x56a0cd(++_0x11270f);}(_0x979d,0x7c));var _0xd979=function(_0x477b50,_0x2dea04){_0x477b50=_0x477b50-0x0;var _0x2f7d9d=_0x979d[_0x477b50];return _0x2f7d9d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd979('0x0'));module[_0xd979('0x1')]={'type':{'type':Sequelize[_0xd979('0x2')](_0xd979('0x3'),_0xd979('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xd979('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xd979('0x5')]},'transferercalleridname':{'type':Sequelize[_0xd979('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xd979('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xd979('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xd979('0x5')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xd979('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xd979('0x5')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xd979('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xd979('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xd979('0x5')]},'transfereecontext':{'type':Sequelize[_0xd979('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xd979('0x2')]('Yes','No')},'context':{'type':Sequelize[_0xd979('0x5')]},'extension':{'type':Sequelize[_0xd979('0x5')]}}; \ No newline at end of file +var _0xf5b5=['attended','STRING','ENUM','Yes','sequelize','moment','blind'];(function(_0x12fe4e,_0x3ac605){var _0x2eadd3=function(_0x257c25){while(--_0x257c25){_0x12fe4e['push'](_0x12fe4e['shift']());}};_0x2eadd3(++_0x3ac605);}(_0xf5b5,0x9e));var _0x5f5b=function(_0x54bcc7,_0x138924){_0x54bcc7=_0x54bcc7-0x0;var _0x263ead=_0xf5b5[_0x54bcc7];return _0x263ead;};'use strict';var Sequelize=require(_0x5f5b('0x0'));var moment=require(_0x5f5b('0x1'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x5f5b('0x2'),_0x5f5b('0x3'))},'result':{'type':Sequelize[_0x5f5b('0x4')]},'transfererchannel':{'type':Sequelize[_0x5f5b('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x5f5b('0x4')]},'transferercalleridname':{'type':Sequelize[_0x5f5b('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x5f5b('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x5f5b('0x4')]},'transferercontext':{'type':Sequelize[_0x5f5b('0x4')]},'transfererexten':{'type':Sequelize[_0x5f5b('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x5f5b('0x4')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x5f5b('0x4')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x5f5b('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x5f5b('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x5f5b('0x4')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x5f5b('0x4')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x5f5b('0x5')](_0x5f5b('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x5f5b('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index e0ae43a..9e2633d 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 _0x3b0e=['count','set','apply','save','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','VoiceTransferReport','create','update','body','find','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x3b0e,0x1db));var _0xe3b0=function(_0x254877,_0x539228){_0x254877=_0x254877-0x0;var _0x3f7da9=_0x3b0e[_0x254877];return _0x3f7da9;};'use strict';var emlformat=require(_0xe3b0('0x0'));var rimraf=require(_0xe3b0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe3b0('0x2'));var rp=require('request-promise');var moment=require(_0xe3b0('0x3'));var BPromise=require(_0xe3b0('0x4'));var Mustache=require('mustache');var util=require(_0xe3b0('0x5'));var path=require(_0xe3b0('0x6'));var sox=require(_0xe3b0('0x7'));var csv=require('to-csv');var ejs=require(_0xe3b0('0x8'));var fs=require('fs');var fs_extra=require(_0xe3b0('0x9'));var _=require(_0xe3b0('0xa'));var squel=require(_0xe3b0('0xb'));var crypto=require(_0xe3b0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe3b0('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe3b0('0xe'));var Redis=require('ioredis');var authService=require(_0xe3b0('0xf'));var qs=require(_0xe3b0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe3b0('0x11'))(_0xe3b0('0x12'));var utils=require(_0xe3b0('0x13'));var config=require(_0xe3b0('0x14'));var licenseUtil=require(_0xe3b0('0x15'));var db=require(_0xe3b0('0x16'))['db'];function respondWithStatusCode(_0x37cc36,_0x783689){_0x783689=_0x783689||0xcc;return function(_0x3b71af){if(_0x3b71af){return _0x37cc36[_0xe3b0('0x17')](_0x783689);}return _0x37cc36[_0xe3b0('0x18')](_0x783689)['end']();};}function respondWithResult(_0x29b750,_0x2419fe){_0x2419fe=_0x2419fe||0xc8;return function(_0x550bd7){if(_0x550bd7){return _0x29b750[_0xe3b0('0x18')](_0x2419fe)[_0xe3b0('0x19')](_0x550bd7);}};}function respondWithFilteredResult(_0x3a6401,_0x3039c8){return function(_0x2dce0a){if(_0x2dce0a){var _0x618d06=typeof _0x3039c8[_0xe3b0('0x1a')]===_0xe3b0('0x1b')&&typeof _0x3039c8[_0xe3b0('0x1c')]===_0xe3b0('0x1b');var _0x32fa8e=_0x2dce0a['count'];var _0x5f075a=_0x618d06?0x0:_0x3039c8[_0xe3b0('0x1a')];var _0x205975=_0x618d06?_0x2dce0a[_0xe3b0('0x1d')]:_0x3039c8[_0xe3b0('0x1a')]+_0x3039c8[_0xe3b0('0x1c')];var _0x51847e;if(_0x205975>=_0x32fa8e){_0x205975=_0x32fa8e;_0x51847e=0xc8;}else{_0x51847e=0xce;}_0x3a6401[_0xe3b0('0x18')](_0x51847e);return _0x3a6401[_0xe3b0('0x1e')]('Content-Range',_0x5f075a+'-'+_0x205975+'/'+_0x32fa8e)[_0xe3b0('0x19')](_0x2dce0a);}return null;};}function patchUpdates(_0x573d59){return function(_0x10b1fd){try{jsonpatch[_0xe3b0('0x1f')](_0x10b1fd,_0x573d59,!![]);}catch(_0x27ef54){return BPromise['reject'](_0x27ef54);}return _0x10b1fd[_0xe3b0('0x20')]();};}function saveUpdates(_0x253c50,_0x10a523){return function(_0x47a9ea){if(_0x47a9ea){return _0x47a9ea['update'](_0x253c50)['then'](function(_0x16c3fe){return _0x16c3fe;});}return null;};}function removeEntity(_0x41d61c,_0x3a29b8){return function(_0x24ef7e){if(_0x24ef7e){return _0x24ef7e[_0xe3b0('0x21')]()[_0xe3b0('0x22')](function(){_0x41d61c[_0xe3b0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44f473,_0x28f957){return function(_0x4459db){if(!_0x4459db){_0x44f473[_0xe3b0('0x17')](0x194);}return _0x4459db;};}function handleError(_0xf66062,_0x3ea971){_0x3ea971=_0x3ea971||0x1f4;return function(_0x4a1179){logger[_0xe3b0('0x23')](_0x4a1179[_0xe3b0('0x24')]);if(_0x4a1179[_0xe3b0('0x25')]){delete _0x4a1179[_0xe3b0('0x25')];}_0xf66062[_0xe3b0('0x18')](_0x3ea971)[_0xe3b0('0x26')](_0x4a1179);};}exports['index']=function(_0x5e34ed,_0x2106d3){var _0x4484c3={},_0x2868fe={},_0x4f483e={'count':0x0,'rows':[]};var _0x119fb2=_[_0xe3b0('0x27')](db['VoiceTransferReport'][_0xe3b0('0x28')],function(_0x3e5580){return{'name':_0x3e5580[_0xe3b0('0x29')],'type':_0x3e5580[_0xe3b0('0x2a')][_0xe3b0('0x2b')]};});_0x2868fe[_0xe3b0('0x2c')]=_[_0xe3b0('0x27')](_0x119fb2,_0xe3b0('0x25'));_0x2868fe[_0xe3b0('0x2d')]=_[_0xe3b0('0x2e')](_0x5e34ed[_0xe3b0('0x2d')]);_0x2868fe['filters']=_[_0xe3b0('0x2f')](_0x2868fe[_0xe3b0('0x2c')],_0x2868fe[_0xe3b0('0x2d')]);_0x4484c3[_0xe3b0('0x30')]=_['intersection'](_0x2868fe['model'],qs[_0xe3b0('0x31')](_0x5e34ed[_0xe3b0('0x2d')][_0xe3b0('0x31')]));_0x4484c3[_0xe3b0('0x30')]=_0x4484c3[_0xe3b0('0x30')][_0xe3b0('0x32')]?_0x4484c3[_0xe3b0('0x30')]:_0x2868fe[_0xe3b0('0x2c')];if(!_0x5e34ed[_0xe3b0('0x2d')]['hasOwnProperty'](_0xe3b0('0x33'))){_0x4484c3[_0xe3b0('0x1c')]=qs[_0xe3b0('0x1c')](_0x5e34ed[_0xe3b0('0x2d')]['limit']);_0x4484c3[_0xe3b0('0x1a')]=qs[_0xe3b0('0x1a')](_0x5e34ed[_0xe3b0('0x2d')][_0xe3b0('0x1a')]);}_0x4484c3[_0xe3b0('0x34')]=qs[_0xe3b0('0x35')](_0x5e34ed['query'][_0xe3b0('0x35')]);_0x4484c3[_0xe3b0('0x36')]=qs['filters'](_['pick'](_0x5e34ed[_0xe3b0('0x2d')],_0x2868fe[_0xe3b0('0x37')]),_0x119fb2);if(_0x5e34ed[_0xe3b0('0x2d')]['filter']){_0x4484c3['where']=_[_0xe3b0('0x38')](_0x4484c3[_0xe3b0('0x36')],{'$or':_['map'](_0x119fb2,function(_0x16ad58){if(_0x16ad58[_0xe3b0('0x2a')]!==_0xe3b0('0x39')){var _0x3571a2={};_0x3571a2[_0x16ad58[_0xe3b0('0x25')]]={'$like':'%'+_0x5e34ed[_0xe3b0('0x2d')][_0xe3b0('0x3a')]+'%'};return _0x3571a2;}})});}_0x4484c3=_[_0xe3b0('0x38')]({},_0x4484c3,_0x5e34ed[_0xe3b0('0x3b')]);var _0x576a18={'where':_0x4484c3[_0xe3b0('0x36')]};return db['VoiceTransferReport']['count'](_0x576a18)['then'](function(_0x40145f){_0x4f483e[_0xe3b0('0x1d')]=_0x40145f;if(_0x5e34ed[_0xe3b0('0x2d')][_0xe3b0('0x3c')]){_0x4484c3[_0xe3b0('0x3d')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0xe3b0('0x3e')](_0x4484c3);})[_0xe3b0('0x22')](function(_0x254efd){_0x4f483e['rows']=_0x254efd;return _0x4f483e;})['then'](respondWithFilteredResult(_0x2106d3,_0x4484c3))[_0xe3b0('0x3f')](handleError(_0x2106d3,null));};exports[_0xe3b0('0x40')]=function(_0x2d6411,_0x5820d2){var _0x2a24e3={'raw':!![],'where':{'id':_0x2d6411[_0xe3b0('0x41')]['id']}},_0x2c8c52={};_0x2c8c52[_0xe3b0('0x2c')]=_[_0xe3b0('0x2e')](db[_0xe3b0('0x42')][_0xe3b0('0x28')]);_0x2c8c52[_0xe3b0('0x2d')]=_[_0xe3b0('0x2e')](_0x2d6411[_0xe3b0('0x2d')]);_0x2c8c52[_0xe3b0('0x37')]=_[_0xe3b0('0x2f')](_0x2c8c52[_0xe3b0('0x2c')],_0x2c8c52[_0xe3b0('0x2d')]);_0x2a24e3['attributes']=_[_0xe3b0('0x2f')](_0x2c8c52[_0xe3b0('0x2c')],qs[_0xe3b0('0x31')](_0x2d6411[_0xe3b0('0x2d')]['fields']));_0x2a24e3[_0xe3b0('0x30')]=_0x2a24e3['attributes'][_0xe3b0('0x32')]?_0x2a24e3[_0xe3b0('0x30')]:_0x2c8c52[_0xe3b0('0x2c')];if(_0x2d6411[_0xe3b0('0x2d')][_0xe3b0('0x3c')]){_0x2a24e3['include']=[{'all':!![]}];}_0x2a24e3=_['merge']({},_0x2a24e3,_0x2d6411[_0xe3b0('0x3b')]);return db[_0xe3b0('0x42')]['find'](_0x2a24e3)[_0xe3b0('0x22')](handleEntityNotFound(_0x5820d2,null))[_0xe3b0('0x22')](respondWithResult(_0x5820d2,null))['catch'](handleError(_0x5820d2,null));};exports[_0xe3b0('0x43')]=function(_0x8812c6,_0x45bf2b){return db[_0xe3b0('0x42')][_0xe3b0('0x43')](_0x8812c6['body'],{})[_0xe3b0('0x22')](respondWithResult(_0x45bf2b,0xc9))['catch'](handleError(_0x45bf2b,null));};exports[_0xe3b0('0x44')]=function(_0x5d295d,_0x264a4d){if(_0x5d295d[_0xe3b0('0x45')]['id']){delete _0x5d295d[_0xe3b0('0x45')]['id'];}return db['VoiceTransferReport'][_0xe3b0('0x46')]({'where':{'id':_0x5d295d['params']['id']}})['then'](handleEntityNotFound(_0x264a4d,null))['then'](saveUpdates(_0x5d295d[_0xe3b0('0x45')],null))[_0xe3b0('0x22')](respondWithResult(_0x264a4d,null))[_0xe3b0('0x3f')](handleError(_0x264a4d,null));};exports[_0xe3b0('0x21')]=function(_0x53b789,_0x31ea23){return db['VoiceTransferReport']['find']({'where':{'id':_0x53b789[_0xe3b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x31ea23,null))[_0xe3b0('0x22')](removeEntity(_0x31ea23,null))[_0xe3b0('0x3f')](handleError(_0x31ea23,null));};exports[_0xe3b0('0x47')]=function(_0x428e55,_0x3a9a6f){return db[_0xe3b0('0x42')][_0xe3b0('0x47')]()[_0xe3b0('0x22')](respondWithResult(_0x3a9a6f,null))[_0xe3b0('0x3f')](handleError(_0x3a9a6f,null));}; \ No newline at end of file +var _0xd442=['map','VoiceTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','nolimit','order','where','pick','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','rows','show','find','catch','create','body','params','describe','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','save','destroy','error','stack','name','send','index'];(function(_0x2a60cb,_0x1a9335){var _0x1aafe2=function(_0x1f1950){while(--_0x1f1950){_0x2a60cb['push'](_0x2a60cb['shift']());}};_0x1aafe2(++_0x1a9335);}(_0xd442,0x1d2));var _0x2d44=function(_0x15353e,_0x44670f){_0x15353e=_0x15353e-0x0;var _0x4f128b=_0xd442[_0x15353e];return _0x4f128b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2d44('0x0'));var jsonpatch=require(_0x2d44('0x1'));var rp=require(_0x2d44('0x2'));var moment=require(_0x2d44('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2d44('0x4'));var util=require(_0x2d44('0x5'));var path=require(_0x2d44('0x6'));var sox=require(_0x2d44('0x7'));var csv=require(_0x2d44('0x8'));var ejs=require(_0x2d44('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d44('0xa'));var squel=require(_0x2d44('0xb'));var crypto=require(_0x2d44('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2d44('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2d44('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2d44('0xf'));var qs=require(_0x2d44('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2d44('0x11'));var logger=require(_0x2d44('0x12'))(_0x2d44('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24e1a8,_0x9f9fce){_0x9f9fce=_0x9f9fce||0xcc;return function(_0x2e2b92){if(_0x2e2b92){return _0x24e1a8[_0x2d44('0x14')](_0x9f9fce);}return _0x24e1a8['status'](_0x9f9fce)[_0x2d44('0x15')]();};}function respondWithResult(_0x4365ac,_0x4e775d){_0x4e775d=_0x4e775d||0xc8;return function(_0xe62bc9){if(_0xe62bc9){return _0x4365ac['status'](_0x4e775d)[_0x2d44('0x16')](_0xe62bc9);}};}function respondWithFilteredResult(_0x21fcd9,_0x15e83f){return function(_0x7a526e){if(_0x7a526e){var _0x22a0aa=typeof _0x15e83f[_0x2d44('0x17')]===_0x2d44('0x18')&&typeof _0x15e83f['limit']===_0x2d44('0x18');var _0x42d7b9=_0x7a526e[_0x2d44('0x19')];var _0x55c628=_0x22a0aa?0x0:_0x15e83f[_0x2d44('0x17')];var _0x425b8a=_0x22a0aa?_0x7a526e['count']:_0x15e83f[_0x2d44('0x17')]+_0x15e83f[_0x2d44('0x1a')];var _0x5c041d;if(_0x425b8a>=_0x42d7b9){_0x425b8a=_0x42d7b9;_0x5c041d=0xc8;}else{_0x5c041d=0xce;}_0x21fcd9[_0x2d44('0x1b')](_0x5c041d);return _0x21fcd9[_0x2d44('0x1c')](_0x2d44('0x1d'),_0x55c628+'-'+_0x425b8a+'/'+_0x42d7b9)['json'](_0x7a526e);}return null;};}function patchUpdates(_0x1a2946){return function(_0x75b6d5){try{jsonpatch[_0x2d44('0x1e')](_0x75b6d5,_0x1a2946,!![]);}catch(_0x64f124){return BPromise['reject'](_0x64f124);}return _0x75b6d5[_0x2d44('0x1f')]();};}function saveUpdates(_0x2d6566,_0x1f3c8c){return function(_0x16af1d){if(_0x16af1d){return _0x16af1d['update'](_0x2d6566)['then'](function(_0x4df648){return _0x4df648;});}return null;};}function removeEntity(_0x1c7720,_0x4d539f){return function(_0x53bc59){if(_0x53bc59){return _0x53bc59[_0x2d44('0x20')]()['then'](function(){_0x1c7720['status'](0xcc)[_0x2d44('0x15')]();});}};}function handleEntityNotFound(_0xa34163,_0x436d2e){return function(_0x5677e2){if(!_0x5677e2){_0xa34163[_0x2d44('0x14')](0x194);}return _0x5677e2;};}function handleError(_0x47ed99,_0x59202b){_0x59202b=_0x59202b||0x1f4;return function(_0x3a8571){logger[_0x2d44('0x21')](_0x3a8571[_0x2d44('0x22')]);if(_0x3a8571['name']){delete _0x3a8571[_0x2d44('0x23')];}_0x47ed99['status'](_0x59202b)[_0x2d44('0x24')](_0x3a8571);};}exports[_0x2d44('0x25')]=function(_0x19a203,_0x4a313a){var _0x200be6={},_0x14f68f={},_0x4ea296={'count':0x0,'rows':[]};var _0x3c08e2=_[_0x2d44('0x26')](db[_0x2d44('0x27')][_0x2d44('0x28')],function(_0x6c556e){return{'name':_0x6c556e[_0x2d44('0x29')],'type':_0x6c556e[_0x2d44('0x2a')][_0x2d44('0x2b')]};});_0x14f68f['model']=_[_0x2d44('0x26')](_0x3c08e2,_0x2d44('0x23'));_0x14f68f[_0x2d44('0x2c')]=_[_0x2d44('0x2d')](_0x19a203['query']);_0x14f68f[_0x2d44('0x2e')]=_['intersection'](_0x14f68f['model'],_0x14f68f[_0x2d44('0x2c')]);_0x200be6[_0x2d44('0x2f')]=_[_0x2d44('0x30')](_0x14f68f[_0x2d44('0x31')],qs[_0x2d44('0x32')](_0x19a203['query'][_0x2d44('0x32')]));_0x200be6[_0x2d44('0x2f')]=_0x200be6[_0x2d44('0x2f')][_0x2d44('0x33')]?_0x200be6[_0x2d44('0x2f')]:_0x14f68f[_0x2d44('0x31')];if(!_0x19a203[_0x2d44('0x2c')]['hasOwnProperty'](_0x2d44('0x34'))){_0x200be6[_0x2d44('0x1a')]=qs[_0x2d44('0x1a')](_0x19a203['query']['limit']);_0x200be6[_0x2d44('0x17')]=qs['offset'](_0x19a203['query'][_0x2d44('0x17')]);}_0x200be6[_0x2d44('0x35')]=qs['sort'](_0x19a203['query']['sort']);_0x200be6[_0x2d44('0x36')]=qs[_0x2d44('0x2e')](_[_0x2d44('0x37')](_0x19a203[_0x2d44('0x2c')],_0x14f68f[_0x2d44('0x2e')]),_0x3c08e2);if(_0x19a203[_0x2d44('0x2c')]['filter']){_0x200be6[_0x2d44('0x36')]=_[_0x2d44('0x38')](_0x200be6[_0x2d44('0x36')],{'$or':_['map'](_0x3c08e2,function(_0x3a1073){if(_0x3a1073[_0x2d44('0x2a')]!==_0x2d44('0x39')){var _0x1f6150={};_0x1f6150[_0x3a1073[_0x2d44('0x23')]]={'$like':'%'+_0x19a203[_0x2d44('0x2c')][_0x2d44('0x3a')]+'%'};return _0x1f6150;}})});}_0x200be6=_[_0x2d44('0x38')]({},_0x200be6,_0x19a203[_0x2d44('0x3b')]);var _0x228950={'where':_0x200be6['where']};return db[_0x2d44('0x27')][_0x2d44('0x19')](_0x228950)[_0x2d44('0x3c')](function(_0x18babe){_0x4ea296[_0x2d44('0x19')]=_0x18babe;if(_0x19a203[_0x2d44('0x2c')][_0x2d44('0x3d')]){_0x200be6[_0x2d44('0x3e')]=[{'all':!![]}];}return db[_0x2d44('0x27')][_0x2d44('0x3f')](_0x200be6);})['then'](function(_0x5b0463){_0x4ea296[_0x2d44('0x40')]=_0x5b0463;return _0x4ea296;})['then'](respondWithFilteredResult(_0x4a313a,_0x200be6))['catch'](handleError(_0x4a313a,null));};exports[_0x2d44('0x41')]=function(_0xd9baf5,_0xdd3ee9){var _0x4fbc95={'raw':!![],'where':{'id':_0xd9baf5['params']['id']}},_0x912d1a={};_0x912d1a['model']=_[_0x2d44('0x2d')](db[_0x2d44('0x27')][_0x2d44('0x28')]);_0x912d1a[_0x2d44('0x2c')]=_[_0x2d44('0x2d')](_0xd9baf5[_0x2d44('0x2c')]);_0x912d1a[_0x2d44('0x2e')]=_[_0x2d44('0x30')](_0x912d1a['model'],_0x912d1a[_0x2d44('0x2c')]);_0x4fbc95[_0x2d44('0x2f')]=_[_0x2d44('0x30')](_0x912d1a[_0x2d44('0x31')],qs['fields'](_0xd9baf5[_0x2d44('0x2c')][_0x2d44('0x32')]));_0x4fbc95[_0x2d44('0x2f')]=_0x4fbc95[_0x2d44('0x2f')]['length']?_0x4fbc95[_0x2d44('0x2f')]:_0x912d1a[_0x2d44('0x31')];if(_0xd9baf5[_0x2d44('0x2c')][_0x2d44('0x3d')]){_0x4fbc95[_0x2d44('0x3e')]=[{'all':!![]}];}_0x4fbc95=_[_0x2d44('0x38')]({},_0x4fbc95,_0xd9baf5[_0x2d44('0x3b')]);return db[_0x2d44('0x27')][_0x2d44('0x42')](_0x4fbc95)['then'](handleEntityNotFound(_0xdd3ee9,null))[_0x2d44('0x3c')](respondWithResult(_0xdd3ee9,null))[_0x2d44('0x43')](handleError(_0xdd3ee9,null));};exports[_0x2d44('0x44')]=function(_0x644eab,_0x418bb7){return db['VoiceTransferReport'][_0x2d44('0x44')](_0x644eab[_0x2d44('0x45')],{})[_0x2d44('0x3c')](respondWithResult(_0x418bb7,0xc9))[_0x2d44('0x43')](handleError(_0x418bb7,null));};exports['update']=function(_0x215fdb,_0x17ad43){if(_0x215fdb[_0x2d44('0x45')]['id']){delete _0x215fdb[_0x2d44('0x45')]['id'];}return db[_0x2d44('0x27')][_0x2d44('0x42')]({'where':{'id':_0x215fdb[_0x2d44('0x46')]['id']}})['then'](handleEntityNotFound(_0x17ad43,null))[_0x2d44('0x3c')](saveUpdates(_0x215fdb['body'],null))['then'](respondWithResult(_0x17ad43,null))[_0x2d44('0x43')](handleError(_0x17ad43,null));};exports[_0x2d44('0x20')]=function(_0x39dfea,_0x264116){return db[_0x2d44('0x27')]['find']({'where':{'id':_0x39dfea['params']['id']}})['then'](handleEntityNotFound(_0x264116,null))[_0x2d44('0x3c')](removeEntity(_0x264116,null))[_0x2d44('0x43')](handleError(_0x264116,null));};exports[_0x2d44('0x47')]=function(_0x42c971,_0x2f6bab){return db['VoiceTransferReport'][_0x2d44('0x47')]()[_0x2d44('0x3c')](respondWithResult(_0x2f6bab,null))[_0x2d44('0x43')](handleError(_0x2f6bab,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 30dfb2f..6e9996f 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 _0xbfaf=['bluebird','request-promise','path','rimraf','exports','define','report_call_transfer','util','../../config/logger','api'];(function(_0x7261e6,_0x3e3bf7){var _0x20d5ed=function(_0x522641){while(--_0x522641){_0x7261e6['push'](_0x7261e6['shift']());}};_0x20d5ed(++_0x3e3bf7);}(_0xbfaf,0xbb));var _0xfbfa=function(_0x56825b,_0x172b8d){_0x56825b=_0x56825b-0x0;var _0x69ce77=_0xbfaf[_0x56825b];return _0x69ce77;};'use strict';var _=require('lodash');var util=require(_0xfbfa('0x0'));var logger=require(_0xfbfa('0x1'))(_0xfbfa('0x2'));var moment=require('moment');var BPromise=require(_0xfbfa('0x3'));var rp=require(_0xfbfa('0x4'));var fs=require('fs');var path=require(_0xfbfa('0x5'));var rimraf=require(_0xfbfa('0x6'));var config=require('../../config/environment');var attributes=require('./voiceTransferReport.attributes');module[_0xfbfa('0x7')]=function(_0x89edcd,_0x5725f9){return _0x89edcd[_0xfbfa('0x8')]('VoiceTransferReport',attributes,{'tableName':_0xfbfa('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd61=['path','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger'];(function(_0x524a73,_0x2f3ba6){var _0x6ef9e=function(_0x4282e7){while(--_0x4282e7){_0x524a73['push'](_0x524a73['shift']());}};_0x6ef9e(++_0x2f3ba6);}(_0xdd61,0x1dd));var _0x1dd6=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0xdd61[_0x369151];return _0x4292d5;};'use strict';var _=require(_0x1dd6('0x0'));var util=require(_0x1dd6('0x1'));var logger=require(_0x1dd6('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1dd6('0x3'));var rimraf=require('rimraf');var config=require(_0x1dd6('0x4'));var attributes=require(_0x1dd6('0x5'));module[_0x1dd6('0x6')]=function(_0x483a32,_0x160f7a){return _0x483a32[_0x1dd6('0x7')](_0x1dd6('0x8'),attributes,{'tableName':_0x1dd6('0x9'),'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 0c59e02..99ef1ae 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 _0xb3d4=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','then','lodash','util','moment'];(function(_0x27792a,_0x45903a){var _0x58ce92=function(_0x30b873){while(--_0x30b873){_0x27792a['push'](_0x27792a['shift']());}};_0x58ce92(++_0x45903a);}(_0xb3d4,0x102));var _0x4b3d=function(_0x79e903,_0x1ee075){_0x79e903=_0x79e903-0x0;var _0x285ba1=_0xb3d4[_0x79e903];return _0x285ba1;};'use strict';var _=require(_0x4b3d('0x0'));var util=require(_0x4b3d('0x1'));var moment=require(_0x4b3d('0x2'));var BPromise=require(_0x4b3d('0x3'));var rs=require(_0x4b3d('0x4'));var fs=require('fs');var Redis=require(_0x4b3d('0x5'));var db=require(_0x4b3d('0x6'))['db'];var utils=require(_0x4b3d('0x7'));var logger=require(_0x4b3d('0x8'))(_0x4b3d('0x9'));var config=require(_0x4b3d('0xa'));var jayson=require(_0x4b3d('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x107624,_0x3f1f7b,_0x59ee79){return new BPromise(function(_0x22866c,_0x5571aa){return client[_0x4b3d('0xc')](_0x107624,_0x59ee79)['then'](function(_0xdabc6c){logger[_0x4b3d('0xd')](_0x4b3d('0xe'),_0x3f1f7b,'request\x20sent');logger[_0x4b3d('0xf')](_0x4b3d('0x10'),_0x3f1f7b,_0x4b3d('0x11'),JSON['stringify'](_0xdabc6c));if(_0xdabc6c[_0x4b3d('0x12')]){if(_0xdabc6c[_0x4b3d('0x12')][_0x4b3d('0x13')]===0x1f4){logger[_0x4b3d('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x3f1f7b,_0xdabc6c[_0x4b3d('0x12')]['message']);return _0x5571aa(_0xdabc6c[_0x4b3d('0x12')][_0x4b3d('0x14')]);}logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x3f1f7b,_0xdabc6c['error']['message']);return _0x22866c(_0xdabc6c[_0x4b3d('0x12')][_0x4b3d('0x14')]);}else{logger[_0x4b3d('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x3f1f7b,'request\x20sent');_0x22866c(_0xdabc6c[_0x4b3d('0x15')][_0x4b3d('0x14')]);}})[_0x4b3d('0x16')](function(_0x14bd5a){logger[_0x4b3d('0x12')](_0x4b3d('0xe'),_0x3f1f7b,_0x14bd5a);_0x5571aa(_0x14bd5a);});});}exports[_0x4b3d('0x17')]=function(_0x5516bc){var _0x549845=this;return new Promise(function(_0x11be1c,_0x338542){return db[_0x4b3d('0x18')][_0x4b3d('0x19')](_0x5516bc[_0x4b3d('0x1a')],{'raw':_0x5516bc[_0x4b3d('0x1b')]?_0x5516bc[_0x4b3d('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x4b3d('0x1c')](function(_0x4027e9){logger[_0x4b3d('0xd')](_0x4b3d('0x17'),_0x5516bc);logger[_0x4b3d('0xf')]('CreateVoiceTransferReport',_0x5516bc,JSON['stringify'](_0x4027e9));_0x11be1c(_0x4027e9);})['catch'](function(_0x6dcfba){logger[_0x4b3d('0x12')](_0x4b3d('0x17'),_0x6dcfba[_0x4b3d('0x14')],_0x5516bc);_0x338542(_0x549845[_0x4b3d('0x12')](0x1f4,_0x6dcfba[_0x4b3d('0x14')]));});});}; \ No newline at end of file +var _0xa4fe=['moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','raw'];(function(_0x1c9801,_0x17b7a2){var _0x3fd117=function(_0x50e93b){while(--_0x50e93b){_0x1c9801['push'](_0x1c9801['shift']());}};_0x3fd117(++_0x17b7a2);}(_0xa4fe,0x15f));var _0xea4f=function(_0x381007,_0x4b94b5){_0x381007=_0x381007-0x0;var _0x72765=_0xa4fe[_0x381007];return _0x72765;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xea4f('0x0'));var BPromise=require('bluebird');var rs=require(_0xea4f('0x1'));var fs=require('fs');var Redis=require(_0xea4f('0x2'));var db=require(_0xea4f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xea4f('0x4'))(_0xea4f('0x5'));var config=require(_0xea4f('0x6'));var jayson=require(_0xea4f('0x7'));var client=jayson[_0xea4f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x447093,_0x3a9a3d,_0x300bad){return new BPromise(function(_0x2cf531,_0x5e191f){return client[_0xea4f('0x9')](_0x447093,_0x300bad)[_0xea4f('0xa')](function(_0x5cdaeb){logger[_0xea4f('0xb')](_0xea4f('0xc'),_0x3a9a3d,_0xea4f('0xd'));logger[_0xea4f('0xe')](_0xea4f('0xf'),_0x3a9a3d,'request\x20sent',JSON[_0xea4f('0x10')](_0x5cdaeb));if(_0x5cdaeb['error']){if(_0x5cdaeb[_0xea4f('0x11')][_0xea4f('0x12')]===0x1f4){logger[_0xea4f('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x3a9a3d,_0x5cdaeb[_0xea4f('0x11')][_0xea4f('0x13')]);return _0x5e191f(_0x5cdaeb[_0xea4f('0x11')][_0xea4f('0x13')]);}logger[_0xea4f('0x11')](_0xea4f('0xc'),_0x3a9a3d,_0x5cdaeb[_0xea4f('0x11')][_0xea4f('0x13')]);return _0x2cf531(_0x5cdaeb[_0xea4f('0x11')][_0xea4f('0x13')]);}else{logger['info'](_0xea4f('0xc'),_0x3a9a3d,_0xea4f('0xd'));_0x2cf531(_0x5cdaeb[_0xea4f('0x14')][_0xea4f('0x13')]);}})[_0xea4f('0x15')](function(_0xe5a107){logger[_0xea4f('0x11')](_0xea4f('0xc'),_0x3a9a3d,_0xe5a107);_0x5e191f(_0xe5a107);});});}exports[_0xea4f('0x16')]=function(_0x3577cc){var _0x310811=this;return new Promise(function(_0x2c153b,_0x386821){return db[_0xea4f('0x17')]['create'](_0x3577cc[_0xea4f('0x18')],{'raw':_0x3577cc[_0xea4f('0x19')]?_0x3577cc['options'][_0xea4f('0x1a')]===undefined?!![]:![]:!![]})[_0xea4f('0xa')](function(_0x3e4d21){logger['info'](_0xea4f('0x16'),_0x3577cc);logger[_0xea4f('0xe')]('CreateVoiceTransferReport',_0x3577cc,JSON[_0xea4f('0x10')](_0x3e4d21));_0x2c153b(_0x3e4d21);})['catch'](function(_0x323c28){logger[_0xea4f('0x11')](_0xea4f('0x16'),_0x323c28[_0xea4f('0x13')],_0x3577cc);_0x386821(_0x310811[_0xea4f('0x11')](0x1f4,_0x323c28[_0xea4f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 7b69f38..ff1979c 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 _0xf109=['/transfer','transfer','express','Router','../../components/auth/service','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','/unhold','/calls','calls'];(function(_0x1bd63b,_0x55eb21){var _0x41606c=function(_0x35cf51){while(--_0x35cf51){_0x1bd63b['push'](_0x1bd63b['shift']());}};_0x41606c(++_0x55eb21);}(_0xf109,0xce));var _0x9f10=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0xf109[_0x36ed3c];return _0x52a2e0;};'use strict';var express=require(_0x9f10('0x0'));var router=express[_0x9f10('0x1')]();var auth=require(_0x9f10('0x2'));var controller=require('./webbar.controller');router['post']('/originate',auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x5')]);router[_0x9f10('0x6')](_0x9f10('0x7'),auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x8')]);router[_0x9f10('0x6')](_0x9f10('0x9'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller[_0x9f10('0xa')]);router[_0x9f10('0x6')](_0x9f10('0xb'),auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller['hold']);router[_0x9f10('0x6')](_0x9f10('0xc'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller['unhold']);router[_0x9f10('0x6')](_0x9f10('0xd'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller[_0x9f10('0xe')]);router[_0x9f10('0x6')](_0x9f10('0xf'),auth['isAuthenticated'](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x10')]);module['exports']=router; \ No newline at end of file +var _0xb821=['/unhold','unhold','/calls','calls','/transfer','Router','../../components/auth/service','/originate','originate','post','/hangup','isAuthenticated','hangup','/answer','isWebrtcLicence','answer','/hold','hold'];(function(_0x502ea4,_0x56ae9d){var _0x159978=function(_0x236054){while(--_0x236054){_0x502ea4['push'](_0x502ea4['shift']());}};_0x159978(++_0x56ae9d);}(_0xb821,0xa7));var _0x1b82=function(_0xa8ee81,_0x2e9adf){_0xa8ee81=_0xa8ee81-0x0;var _0x382d28=_0xb821[_0xa8ee81];return _0x382d28;};'use strict';var express=require('express');var router=express[_0x1b82('0x0')]();var auth=require(_0x1b82('0x1'));var controller=require('./webbar.controller');router['post'](_0x1b82('0x2'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x1b82('0x3')]);router[_0x1b82('0x4')](_0x1b82('0x5'),auth[_0x1b82('0x6')](),auth['isWebrtcLicence'](),controller[_0x1b82('0x7')]);router[_0x1b82('0x4')](_0x1b82('0x8'),auth[_0x1b82('0x6')](),auth[_0x1b82('0x9')](),controller[_0x1b82('0xa')]);router[_0x1b82('0x4')](_0x1b82('0xb'),auth[_0x1b82('0x6')](),auth['isWebrtcLicence'](),controller[_0x1b82('0xc')]);router[_0x1b82('0x4')](_0x1b82('0xd'),auth[_0x1b82('0x6')](),auth[_0x1b82('0x9')](),controller[_0x1b82('0xe')]);router[_0x1b82('0x4')](_0x1b82('0xf'),auth['isAuthenticated'](),auth[_0x1b82('0x9')](),controller[_0x1b82('0x10')]);router[_0x1b82('0x4')](_0x1b82('0x11'),auth['isAuthenticated'](),auth[_0x1b82('0x9')](),controller['transfer']);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 2207e2a..b4ace05 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 _0xda55=['sessionId\x20','\x20not\x20found!','originate','info','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','originate\x20executed!','catch','hangup','hangup\x20fired:','sessionId','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','UserId','conference','webbar:conference','transfer','transfer\x20fired:','path','lodash','util','bluebird','jayson/promise','client','http','webbarapi','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','log','handleError:','stack','name','status','send','NotFound','then','error','code','message','result','User','VoiceChannels','all','filter','rows','length'];(function(_0x34d346,_0x4c6502){var _0x122d76=function(_0x22a5fd){while(--_0x22a5fd){_0x34d346['push'](_0x34d346['shift']());}};_0x122d76(++_0x4c6502);}(_0xda55,0x6d));var _0x5da5=function(_0x5c6ceb,_0x4ed099){_0x5c6ceb=_0x5c6ceb-0x0;var _0x28821b=_0xda55[_0x5c6ceb];return _0x28821b;};'use strict';var path=require(_0x5da5('0x0'));var fs=require('fs');var _=require(_0x5da5('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require(_0x5da5('0x2'));var BPromise=require(_0x5da5('0x3'));var jayson=require(_0x5da5('0x4'));var amiClient=jayson[_0x5da5('0x5')][_0x5da5('0x6')]({'port':0x232a});var logger=require('../../config/logger')(_0x5da5('0x7'));var Redis=require('ioredis');config[_0x5da5('0x8')]=_['defaults'](config[_0x5da5('0x8')],{'host':_0x5da5('0x9'),'port':0x18eb});var io=require(_0x5da5('0xa'))(new Redis(config[_0x5da5('0x8')]));var Schema=require(_0x5da5('0xb'));var originateValidation=new Schema({'userId':{'type':_0x5da5('0xc'),'required':[!![],_0x5da5('0xd')]},'callNumber':{'type':_0x5da5('0xe'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x5da5('0xe')},'callbackUrl':{'type':_0x5da5('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x5da5('0xc'),'required':[!![],_0x5da5('0xd')]},'sessionId':{'type':_0x5da5('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x5da5('0xc'),'required':[!![],_0x5da5('0xd')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x5da5('0xc'),'required':[!![],_0x5da5('0xd')]},'sessionId':{'type':'string','required':[!![],_0x5da5('0xf')]},'transferNumber':{'type':_0x5da5('0xe'),'required':[!![],_0x5da5('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0x5da5('0xc'),'required':[!![],_0x5da5('0xd')]},'sessionId':{'type':_0x5da5('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x5da5('0xc'),'required':[!![],_0x5da5('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0x5da5('0xc'),'required':[!![],_0x5da5('0xd')]}});function emit(_0x11bd3,_0x134afa,_0x3aff51){logger['info'](_0x11bd3,_0x134afa,JSON[_0x5da5('0x11')](_0x3aff51));io['to'](_0x11bd3)[_0x5da5('0x12')](_0x134afa,_0x3aff51);}function handleError(_0x1a4849){return function(_0x16b11f){console[_0x5da5('0x13')](_0x5da5('0x14'),_0x16b11f,_0x16b11f instanceof RangeError);logger['error'](_0x16b11f[_0x5da5('0x15')]);if(_0x16b11f instanceof RangeError){if(_0x16b11f[_0x5da5('0x16')]){delete _0x16b11f[_0x5da5('0x16')];}_0x1a4849[_0x5da5('0x17')](0x194)[_0x5da5('0x18')](_0x16b11f);}else{if(_0x16b11f['name']){delete _0x16b11f[_0x5da5('0x16')];}_0x1a4849[_0x5da5('0x17')](0x1f4)[_0x5da5('0x18')](_0x16b11f);}};}function checkError(){return function(_0x560ea7){if(!_0x560ea7){throw new RangeError(_0x5da5('0x19'));}return _0x560ea7;};}function respondWithRpcPromise(_0x15aa62,_0x20c8a6){return new BPromise(function(_0x2e68d5,_0xec69f2){var _0x436960=amiClient;return _0x436960['request'](_0x15aa62,_0x20c8a6)[_0x5da5('0x1a')](function(_0x568ddf){if(_0x568ddf[_0x5da5('0x1b')]){if(_0x568ddf[_0x5da5('0x1b')][_0x5da5('0x1c')]===0x1f4){return _0xec69f2(_0x568ddf['error'][_0x5da5('0x1d')]);}return _0x2e68d5(_0x568ddf[_0x5da5('0x1b')][_0x5da5('0x1d')]);}else{_0x2e68d5(_0x568ddf[_0x5da5('0x1e')]);}})['catch'](function(_0x5b0b43){_0xec69f2(_0x5b0b43);});});}function getAgent(_0x50aadc){return db[_0x5da5('0x1f')]['findOne']({'where':{'id':_0x50aadc,'role':'agent'}})[_0x5da5('0x1a')](checkError());}function getAgentCheckSession(_0x3974d8,_0x5740a7){return new BPromise(function(_0x1798ae,_0x1ab83e){var _0x558b12=respondWithRpcPromise(_0x5da5('0x20'));var _0x27de55=getAgent(_0x3974d8);Promise[_0x5da5('0x21')]([_0x558b12,_0x27de55])[_0x5da5('0x1a')](function(_0x766ed9){var _0x5734ce=_0x766ed9[0x0];var _0x3ae664=_0x766ed9[0x1];var _0x2e3c5d=_[_0x5da5('0x22')](_0x5734ce[_0x5da5('0x23')],function(_0x55e2bf){return _0x55e2bf['UserId']==_0x3ae664['id']&&_0x55e2bf['sessionId']==_0x5740a7;});if(_0x2e3c5d[_0x5da5('0x24')]==0x1){_0x1798ae(_0x3ae664);}else{_0x1ab83e(new RangeError(_0x5da5('0x25')+_0x5740a7+_0x5da5('0x26')));}});});}exports[_0x5da5('0x27')]=function(_0x51b712,_0x585298){logger[_0x5da5('0x28')]('originate\x20fired:',_0x51b712['body']);var _0x2dd4b6=originateValidation['validate'](_0x51b712[_0x5da5('0x29')]);if(_0x2dd4b6[_0x5da5('0x24')]>0x0){return _0x585298[_0x5da5('0x17')](0x190)[_0x5da5('0x2a')](_0x2dd4b6);}var _0x6c556d=_0x51b712[_0x5da5('0x29')][_0x5da5('0x2b')];var _0x3dc66a=_0x51b712['body'][_0x5da5('0x2c')];var _0x48de0b=_0x51b712[_0x5da5('0x29')][_0x5da5('0x2d')];var _0x28c5eb=_0x51b712[_0x5da5('0x29')][_0x5da5('0x2e')];return getAgent(_0x6c556d)[_0x5da5('0x1a')](function(_0x325ccd){logger[_0x5da5('0x28')](_0x5da5('0x2f'),_0x325ccd[_0x5da5('0x16')]);emit(util[_0x5da5('0x30')](_0x5da5('0x31'),_0x325ccd[_0x5da5('0x16')]),'webbar:originate',{'callNumber':_0x3dc66a,'callerId':_0x48de0b,'callbackUrl':_0x28c5eb});return _0x585298[_0x5da5('0x17')](0xc8)['json']({'error':![],'message':_0x5da5('0x32')});})[_0x5da5('0x33')](handleError(_0x585298));};exports[_0x5da5('0x34')]=function(_0x24842c,_0x59c92e){logger[_0x5da5('0x28')](_0x5da5('0x35'),_0x24842c[_0x5da5('0x29')]);var _0x56fd57=hangupValidation[_0x5da5('0xb')](_0x24842c[_0x5da5('0x29')]);if(_0x56fd57['length']>0x0){return _0x59c92e[_0x5da5('0x17')](0x190)[_0x5da5('0x2a')](_0x56fd57);}var _0xe9888e=_0x24842c[_0x5da5('0x29')][_0x5da5('0x2b')];var _0x664a8d=_0x24842c['body'][_0x5da5('0x36')];return getAgent(_0xe9888e)[_0x5da5('0x1a')](function(_0x14c3f5){logger[_0x5da5('0x28')](_0x5da5('0x2f'),_0x14c3f5['name']);emit(util[_0x5da5('0x30')](_0x5da5('0x31'),_0x14c3f5['name']),_0x5da5('0x37'),{'sessionId':_0x664a8d});return _0x59c92e['status'](0xc8)['json']({'error':![],'message':_0x5da5('0x38')});})[_0x5da5('0x33')](handleError(_0x59c92e));};exports[_0x5da5('0x39')]=function(_0x29d9a7,_0x52b618){logger[_0x5da5('0x28')](_0x5da5('0x3a'),_0x29d9a7[_0x5da5('0x29')]);var _0x40cf69=answerValidation[_0x5da5('0xb')](_0x29d9a7[_0x5da5('0x29')]);if(_0x40cf69[_0x5da5('0x24')]>0x0){return _0x52b618[_0x5da5('0x17')](0x190)[_0x5da5('0x2a')](_0x40cf69);}var _0x284d40=_0x29d9a7[_0x5da5('0x29')][_0x5da5('0x2b')];var _0x4464a7=_0x29d9a7[_0x5da5('0x29')][_0x5da5('0x36')];return getAgent(_0x284d40)['then'](function(_0x485326){logger[_0x5da5('0x28')](_0x5da5('0x2f'),_0x485326['name']);emit(util[_0x5da5('0x30')](_0x5da5('0x31'),_0x485326[_0x5da5('0x16')]),_0x5da5('0x3b'),{'sessionId':_0x4464a7});return _0x52b618[_0x5da5('0x17')](0xc8)[_0x5da5('0x2a')]({'error':![],'message':_0x5da5('0x3c')});})[_0x5da5('0x33')](handleError(_0x52b618));};exports[_0x5da5('0x3d')]=function(_0x44de08,_0x4fc584){logger[_0x5da5('0x28')]('hold\x20fired:',_0x44de08['body']);var _0x2a0fb6=holdValidation[_0x5da5('0xb')](_0x44de08[_0x5da5('0x29')]);if(_0x2a0fb6[_0x5da5('0x24')]>0x0){return _0x4fc584[_0x5da5('0x17')](0x190)[_0x5da5('0x2a')](_0x2a0fb6);}var _0x5aa561=_0x44de08[_0x5da5('0x29')]['userId'];var _0x5325ad=_0x44de08[_0x5da5('0x29')][_0x5da5('0x36')];return getAgent(_0x5aa561)['then'](function(_0x419d74){logger[_0x5da5('0x28')](_0x5da5('0x2f'),_0x419d74[_0x5da5('0x16')]);emit(util[_0x5da5('0x30')]('user:%s',_0x419d74[_0x5da5('0x16')]),'webbar:hold',{'sessionId':_0x5325ad});return _0x4fc584['status'](0xc8)[_0x5da5('0x2a')]({'error':![],'message':'hold\x20executed!'});})[_0x5da5('0x33')](handleError(_0x4fc584));};exports[_0x5da5('0x3e')]=function(_0x17581a,_0x1ec725){logger[_0x5da5('0x28')](_0x5da5('0x3f'),_0x17581a['body']);var _0x5cb8d8=unholdValidation[_0x5da5('0xb')](_0x17581a[_0x5da5('0x29')]);if(_0x5cb8d8['length']>0x0){return _0x1ec725['status'](0x190)[_0x5da5('0x2a')](_0x5cb8d8);}var _0x4c1321=_0x17581a[_0x5da5('0x29')]['userId'];var _0x505ea4=_0x17581a[_0x5da5('0x29')][_0x5da5('0x36')];return getAgent(_0x4c1321)[_0x5da5('0x1a')](function(_0x39d428){logger['info'](_0x5da5('0x2f'),_0x39d428[_0x5da5('0x16')]);emit(util[_0x5da5('0x30')]('user:%s',_0x39d428[_0x5da5('0x16')]),_0x5da5('0x40'),{'sessionId':_0x505ea4});return _0x1ec725[_0x5da5('0x17')](0xc8)[_0x5da5('0x2a')]({'error':![],'message':_0x5da5('0x41')});})[_0x5da5('0x33')](handleError(_0x1ec725));};exports[_0x5da5('0x42')]=function(_0x53c7dd,_0x3d1a54){logger[_0x5da5('0x28')](_0x5da5('0x43'),_0x3d1a54[_0x5da5('0x29')]);var _0x211b80=callsValidation[_0x5da5('0xb')](_0x53c7dd[_0x5da5('0x29')]);if(_0x211b80[_0x5da5('0x24')]>0x0){return _0x3d1a54[_0x5da5('0x17')](0x190)[_0x5da5('0x2a')](_0x211b80);}var _0x191691=_0x53c7dd[_0x5da5('0x29')][_0x5da5('0x2b')];var _0x4cc539=respondWithRpcPromise(_0x5da5('0x20'));var _0x35939b=getAgent(_0x191691);return Promise['all']([_0x4cc539,_0x35939b])['then'](function(_0x509c9e){var _0x1959af=_0x509c9e[0x0];var _0x469907=_0x509c9e[0x1];var _0x20c269=_['filter'](_0x1959af['rows'],function(_0x462317){return _0x462317[_0x5da5('0x44')]==_0x469907['id'];});return _0x3d1a54[_0x5da5('0x17')](0xc8)[_0x5da5('0x2a')]({'count':_0x20c269['length'],'rows':_0x20c269});})[_0x5da5('0x33')](handleError(_0x3d1a54));};exports[_0x5da5('0x45')]=function(_0x34b4b0,_0x4e4ffa){logger[_0x5da5('0x28')]('conference\x20fired:',_0x34b4b0[_0x5da5('0x29')]);var _0x4496d2=conferenceValidation[_0x5da5('0xb')](_0x34b4b0[_0x5da5('0x29')]);if(_0x4496d2[_0x5da5('0x24')]>0x0){return _0x4e4ffa[_0x5da5('0x17')](0x190)[_0x5da5('0x2a')](_0x4496d2);}var _0x2c13f1=_0x34b4b0[_0x5da5('0x29')][_0x5da5('0x2b')];return getAgent(_0x2c13f1)[_0x5da5('0x1a')](function(_0xe3fc79){logger[_0x5da5('0x28')](_0x5da5('0x2f'),_0xe3fc79[_0x5da5('0x16')]);emit(util[_0x5da5('0x30')](_0x5da5('0x31'),_0xe3fc79[_0x5da5('0x16')]),_0x5da5('0x46'));return _0x4e4ffa[_0x5da5('0x17')](0xc8)[_0x5da5('0x2a')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x4e4ffa));};exports[_0x5da5('0x47')]=function(_0x35cca1,_0x4041e8){logger['info'](_0x5da5('0x48'),_0x35cca1[_0x5da5('0x29')]);var _0x43b55e=transferValidation[_0x5da5('0xb')](_0x35cca1['body']);if(_0x43b55e[_0x5da5('0x24')]>0x0){return _0x4041e8['status'](0x190)[_0x5da5('0x2a')](_0x43b55e);}var _0x5f862f=_0x35cca1[_0x5da5('0x29')][_0x5da5('0x2b')];var _0x57966d=_0x35cca1[_0x5da5('0x29')][_0x5da5('0x36')];var _0x512f01=_0x35cca1['body']['transferNumber'];return getAgent(_0x5f862f)[_0x5da5('0x1a')](function(_0x446241){logger[_0x5da5('0x28')](_0x5da5('0x2f'),_0x446241[_0x5da5('0x16')]);emit(util[_0x5da5('0x30')](_0x5da5('0x31'),_0x446241[_0x5da5('0x16')]),'webbar:transfer',{'sessionId':_0x57966d,'transferNumber':_0x512f01});return _0x4041e8[_0x5da5('0x17')](0xc8)[_0x5da5('0x2a')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x4041e8));}; \ No newline at end of file +var _0x579c=['redis','defaults','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','result','catch','User','VoiceChannels','filter','rows','UserId','sessionId','length','\x20not\x20found!','originate','body','json','callbackUrl','user:%s','originate\x20executed!','hangup','hangup\x20fired:','entityFound:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','format','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold','userId','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','jayson/promise','http','../../config/logger','webbarapi','ioredis'];(function(_0x55718e,_0x504d34){var _0x3140a4=function(_0x30b5aa){while(--_0x30b5aa){_0x55718e['push'](_0x55718e['shift']());}};_0x3140a4(++_0x504d34);}(_0x579c,0xda));var _0xc579=function(_0x213000,_0x159d84){_0x213000=_0x213000-0x0;var _0x493fa5=_0x579c[_0x213000];return _0x493fa5;};'use strict';var path=require(_0xc579('0x0'));var fs=require('fs');var _=require(_0xc579('0x1'));var db=require(_0xc579('0x2'))['db'];var config=require(_0xc579('0x3'));var util=require(_0xc579('0x4'));var BPromise=require('bluebird');var jayson=require(_0xc579('0x5'));var amiClient=jayson['client'][_0xc579('0x6')]({'port':0x232a});var logger=require(_0xc579('0x7'))(_0xc579('0x8'));var Redis=require(_0xc579('0x9'));config[_0xc579('0xa')]=_[_0xc579('0xb')](config[_0xc579('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xc579('0xc'))(new Redis(config[_0xc579('0xa')]));var Schema=require(_0xc579('0xd'));var originateValidation=new Schema({'userId':{'type':_0xc579('0xe'),'required':[!![],_0xc579('0xf')]},'callNumber':{'type':_0xc579('0x10'),'required':[!![],_0xc579('0x11')]},'callerId':{'type':_0xc579('0x10')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xc579('0xe'),'required':[!![],_0xc579('0xf')]},'sessionId':{'type':_0xc579('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xc579('0xe'),'required':[!![],_0xc579('0xf')]},'sessionId':{'type':_0xc579('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xc579('0xe'),'required':[!![],_0xc579('0xf')]},'sessionId':{'type':_0xc579('0x10'),'required':[!![],_0xc579('0x12')]},'transferNumber':{'type':_0xc579('0x10'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xc579('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xc579('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xc579('0xf')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xc579('0xe'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xc579('0xe'),'required':[!![],_0xc579('0xf')]}});function emit(_0x567de5,_0x54557b,_0x3f5d14){logger[_0xc579('0x13')](_0x567de5,_0x54557b,JSON[_0xc579('0x14')](_0x3f5d14));io['to'](_0x567de5)[_0xc579('0x15')](_0x54557b,_0x3f5d14);}function handleError(_0x7d5865){return function(_0x33d341){console[_0xc579('0x16')](_0xc579('0x17'),_0x33d341,_0x33d341 instanceof RangeError);logger[_0xc579('0x18')](_0x33d341[_0xc579('0x19')]);if(_0x33d341 instanceof RangeError){if(_0x33d341['name']){delete _0x33d341[_0xc579('0x1a')];}_0x7d5865[_0xc579('0x1b')](0x194)['send'](_0x33d341);}else{if(_0x33d341[_0xc579('0x1a')]){delete _0x33d341[_0xc579('0x1a')];}_0x7d5865[_0xc579('0x1b')](0x1f4)[_0xc579('0x1c')](_0x33d341);}};}function checkError(){return function(_0x13188a){if(!_0x13188a){throw new RangeError(_0xc579('0x1d'));}return _0x13188a;};}function respondWithRpcPromise(_0x147bb6,_0x1b214d){return new BPromise(function(_0x55781e,_0x92657f){var _0xad4889=amiClient;return _0xad4889[_0xc579('0x1e')](_0x147bb6,_0x1b214d)[_0xc579('0x1f')](function(_0x1da86e){if(_0x1da86e['error']){if(_0x1da86e[_0xc579('0x18')][_0xc579('0x20')]===0x1f4){return _0x92657f(_0x1da86e[_0xc579('0x18')]['message']);}return _0x55781e(_0x1da86e[_0xc579('0x18')]['message']);}else{_0x55781e(_0x1da86e[_0xc579('0x21')]);}})[_0xc579('0x22')](function(_0x4d758a){_0x92657f(_0x4d758a);});});}function getAgent(_0x5935e9){return db[_0xc579('0x23')]['findOne']({'where':{'id':_0x5935e9,'role':'agent'}})['then'](checkError());}function getAgentCheckSession(_0x540d90,_0x3f7363){return new BPromise(function(_0xfdbb73,_0x2ddebd){var _0x206e39=respondWithRpcPromise(_0xc579('0x24'));var _0x45fef4=getAgent(_0x540d90);Promise['all']([_0x206e39,_0x45fef4])['then'](function(_0x4a5f6){var _0x4897a1=_0x4a5f6[0x0];var _0x314daa=_0x4a5f6[0x1];var _0x56224e=_[_0xc579('0x25')](_0x4897a1[_0xc579('0x26')],function(_0x1ad8f7){return _0x1ad8f7[_0xc579('0x27')]==_0x314daa['id']&&_0x1ad8f7[_0xc579('0x28')]==_0x3f7363;});if(_0x56224e[_0xc579('0x29')]==0x1){_0xfdbb73(_0x314daa);}else{_0x2ddebd(new RangeError('sessionId\x20'+_0x3f7363+_0xc579('0x2a')));}});});}exports[_0xc579('0x2b')]=function(_0x1ace71,_0x333fa4){logger['info']('originate\x20fired:',_0x1ace71[_0xc579('0x2c')]);var _0x560e3b=originateValidation[_0xc579('0xd')](_0x1ace71[_0xc579('0x2c')]);if(_0x560e3b[_0xc579('0x29')]>0x0){return _0x333fa4[_0xc579('0x1b')](0x190)[_0xc579('0x2d')](_0x560e3b);}var _0x552c3a=_0x1ace71[_0xc579('0x2c')]['userId'];var _0x172409=_0x1ace71[_0xc579('0x2c')]['callNumber'];var _0x3535af=_0x1ace71[_0xc579('0x2c')]['callerId'];var _0x499229=_0x1ace71[_0xc579('0x2c')][_0xc579('0x2e')];return getAgent(_0x552c3a)['then'](function(_0x3775d7){logger[_0xc579('0x13')]('entityFound:',_0x3775d7[_0xc579('0x1a')]);emit(util['format'](_0xc579('0x2f'),_0x3775d7[_0xc579('0x1a')]),'webbar:originate',{'callNumber':_0x172409,'callerId':_0x3535af,'callbackUrl':_0x499229});return _0x333fa4[_0xc579('0x1b')](0xc8)[_0xc579('0x2d')]({'error':![],'message':_0xc579('0x30')});})[_0xc579('0x22')](handleError(_0x333fa4));};exports[_0xc579('0x31')]=function(_0x324b51,_0x59ae89){logger[_0xc579('0x13')](_0xc579('0x32'),_0x324b51['body']);var _0xc21792=hangupValidation[_0xc579('0xd')](_0x324b51[_0xc579('0x2c')]);if(_0xc21792[_0xc579('0x29')]>0x0){return _0x59ae89['status'](0x190)[_0xc579('0x2d')](_0xc21792);}var _0x2864de=_0x324b51[_0xc579('0x2c')]['userId'];var _0x500b0d=_0x324b51['body'][_0xc579('0x28')];return getAgent(_0x2864de)[_0xc579('0x1f')](function(_0x3349e0){logger[_0xc579('0x13')](_0xc579('0x33'),_0x3349e0[_0xc579('0x1a')]);emit(util['format'](_0xc579('0x2f'),_0x3349e0['name']),_0xc579('0x34'),{'sessionId':_0x500b0d});return _0x59ae89[_0xc579('0x1b')](0xc8)[_0xc579('0x2d')]({'error':![],'message':_0xc579('0x35')});})[_0xc579('0x22')](handleError(_0x59ae89));};exports[_0xc579('0x36')]=function(_0x120410,_0x44f77e){logger['info'](_0xc579('0x37'),_0x120410[_0xc579('0x2c')]);var _0x74b63d=answerValidation[_0xc579('0xd')](_0x120410[_0xc579('0x2c')]);if(_0x74b63d[_0xc579('0x29')]>0x0){return _0x44f77e['status'](0x190)[_0xc579('0x2d')](_0x74b63d);}var _0x290493=_0x120410[_0xc579('0x2c')]['userId'];var _0x3e66c0=_0x120410[_0xc579('0x2c')][_0xc579('0x28')];return getAgent(_0x290493)['then'](function(_0x3a5b10){logger['info'](_0xc579('0x33'),_0x3a5b10[_0xc579('0x1a')]);emit(util[_0xc579('0x38')]('user:%s',_0x3a5b10[_0xc579('0x1a')]),_0xc579('0x39'),{'sessionId':_0x3e66c0});return _0x44f77e['status'](0xc8)['json']({'error':![],'message':_0xc579('0x3a')});})[_0xc579('0x22')](handleError(_0x44f77e));};exports[_0xc579('0x3b')]=function(_0x3964df,_0x524daa){logger['info'](_0xc579('0x3c'),_0x3964df[_0xc579('0x2c')]);var _0x292b95=holdValidation[_0xc579('0xd')](_0x3964df['body']);if(_0x292b95[_0xc579('0x29')]>0x0){return _0x524daa[_0xc579('0x1b')](0x190)['json'](_0x292b95);}var _0x40d790=_0x3964df['body']['userId'];var _0x5b2929=_0x3964df[_0xc579('0x2c')][_0xc579('0x28')];return getAgent(_0x40d790)[_0xc579('0x1f')](function(_0x90a0d3){logger[_0xc579('0x13')]('entityFound:',_0x90a0d3[_0xc579('0x1a')]);emit(util[_0xc579('0x38')](_0xc579('0x2f'),_0x90a0d3['name']),'webbar:hold',{'sessionId':_0x5b2929});return _0x524daa[_0xc579('0x1b')](0xc8)[_0xc579('0x2d')]({'error':![],'message':_0xc579('0x3d')});})[_0xc579('0x22')](handleError(_0x524daa));};exports[_0xc579('0x3e')]=function(_0xe1a1d7,_0x138ab2){logger['info']('unhold\x20fired:',_0xe1a1d7[_0xc579('0x2c')]);var _0x349c65=unholdValidation['validate'](_0xe1a1d7[_0xc579('0x2c')]);if(_0x349c65['length']>0x0){return _0x138ab2[_0xc579('0x1b')](0x190)[_0xc579('0x2d')](_0x349c65);}var _0x3cb0f7=_0xe1a1d7[_0xc579('0x2c')][_0xc579('0x3f')];var _0x297b54=_0xe1a1d7['body'][_0xc579('0x28')];return getAgent(_0x3cb0f7)[_0xc579('0x1f')](function(_0x20bd2a){logger['info'](_0xc579('0x33'),_0x20bd2a['name']);emit(util[_0xc579('0x38')](_0xc579('0x2f'),_0x20bd2a[_0xc579('0x1a')]),_0xc579('0x40'),{'sessionId':_0x297b54});return _0x138ab2['status'](0xc8)['json']({'error':![],'message':_0xc579('0x41')});})['catch'](handleError(_0x138ab2));};exports[_0xc579('0x42')]=function(_0x3737f1,_0x2aafde){logger['info'](_0xc579('0x43'),_0x2aafde[_0xc579('0x2c')]);var _0x4a2701=callsValidation[_0xc579('0xd')](_0x3737f1[_0xc579('0x2c')]);if(_0x4a2701[_0xc579('0x29')]>0x0){return _0x2aafde[_0xc579('0x1b')](0x190)[_0xc579('0x2d')](_0x4a2701);}var _0x50e98a=_0x3737f1['body'][_0xc579('0x3f')];var _0x409948=respondWithRpcPromise(_0xc579('0x24'));var _0x56c482=getAgent(_0x50e98a);return Promise['all']([_0x409948,_0x56c482])[_0xc579('0x1f')](function(_0x4554a2){var _0x4fb2fb=_0x4554a2[0x0];var _0x1d1d5b=_0x4554a2[0x1];var _0x43d2b1=_[_0xc579('0x25')](_0x4fb2fb[_0xc579('0x26')],function(_0x2b5325){return _0x2b5325[_0xc579('0x27')]==_0x1d1d5b['id'];});return _0x2aafde[_0xc579('0x1b')](0xc8)['json']({'count':_0x43d2b1[_0xc579('0x29')],'rows':_0x43d2b1});})[_0xc579('0x22')](handleError(_0x2aafde));};exports[_0xc579('0x44')]=function(_0x59579b,_0x27678a){logger['info'](_0xc579('0x45'),_0x59579b[_0xc579('0x2c')]);var _0x119faa=conferenceValidation[_0xc579('0xd')](_0x59579b[_0xc579('0x2c')]);if(_0x119faa['length']>0x0){return _0x27678a[_0xc579('0x1b')](0x190)[_0xc579('0x2d')](_0x119faa);}var _0x2844b2=_0x59579b[_0xc579('0x2c')][_0xc579('0x3f')];return getAgent(_0x2844b2)[_0xc579('0x1f')](function(_0x5c4d32){logger[_0xc579('0x13')](_0xc579('0x33'),_0x5c4d32[_0xc579('0x1a')]);emit(util[_0xc579('0x38')](_0xc579('0x2f'),_0x5c4d32[_0xc579('0x1a')]),_0xc579('0x46'));return _0x27678a[_0xc579('0x1b')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0xc579('0x22')](handleError(_0x27678a));};exports[_0xc579('0x47')]=function(_0x98f60,_0x1d05dd){logger[_0xc579('0x13')](_0xc579('0x48'),_0x98f60[_0xc579('0x2c')]);var _0x10981b=transferValidation[_0xc579('0xd')](_0x98f60[_0xc579('0x2c')]);if(_0x10981b[_0xc579('0x29')]>0x0){return _0x1d05dd[_0xc579('0x1b')](0x190)[_0xc579('0x2d')](_0x10981b);}var _0x33109f=_0x98f60['body'][_0xc579('0x3f')];var _0x2a45d7=_0x98f60['body'][_0xc579('0x28')];var _0x1ff618=_0x98f60['body'][_0xc579('0x49')];return getAgent(_0x33109f)[_0xc579('0x1f')](function(_0x1ab782){logger[_0xc579('0x13')](_0xc579('0x33'),_0x1ab782[_0xc579('0x1a')]);emit(util[_0xc579('0x38')](_0xc579('0x2f'),_0x1ab782[_0xc579('0x1a')]),_0xc579('0x4a'),{'sessionId':_0x2a45d7,'transferNumber':_0x1ff618});return _0x1d05dd[_0xc579('0x1b')](0xc8)[_0xc579('0x2d')]({'error':![],'message':_0xc579('0x4b')});})['catch'](handleError(_0x1d05dd));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index de6fc70..1c90279 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 _0xb4d7=['index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAgents','/:id/applications','getApplications','post','create','addAnswer','/:id/users','addAgents','notify','/:id/send','send','put','update','destroy','removeDispositions','removeAnswers','delete','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','isAuthenticated'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb4d7,0x7b));var _0x7b4d=function(_0x2e0567,_0x129d0e){_0x2e0567=_0x2e0567-0x0;var _0x33246f=_0xb4d7[_0x2e0567];return _0x33246f;};'use strict';var multer=require(_0x7b4d('0x0'));var util=require(_0x7b4d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7b4d('0x2'));var router=express['Router']();var fs_extra=require(_0x7b4d('0x3'));var auth=require(_0x7b4d('0x4'));var interaction=require(_0x7b4d('0x5'));var config=require('../../config/environment');var controller=require(_0x7b4d('0x6'));router[_0x7b4d('0x7')]('/',auth[_0x7b4d('0x8')](),controller[_0x7b4d('0x9')]);router[_0x7b4d('0x7')](_0x7b4d('0xa'),auth['isAuthenticated'](),controller[_0x7b4d('0xb')]);router[_0x7b4d('0x7')](_0x7b4d('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x7b4d('0x7')](_0x7b4d('0xd'),auth['isAuthenticated'](),controller[_0x7b4d('0xe')]);router['get'](_0x7b4d('0xf'),auth[_0x7b4d('0x8')](),controller['getAnswers']);router[_0x7b4d('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0x7b4d('0x10')]);router['get'](_0x7b4d('0x11'),auth[_0x7b4d('0x8')](),controller[_0x7b4d('0x12')]);router[_0x7b4d('0x13')]('/',auth[_0x7b4d('0x8')](),controller[_0x7b4d('0x14')]);router[_0x7b4d('0x13')](_0x7b4d('0xd'),auth[_0x7b4d('0x8')](),controller['addDisposition']);router[_0x7b4d('0x13')](_0x7b4d('0xf'),auth[_0x7b4d('0x8')](),controller[_0x7b4d('0x15')]);router[_0x7b4d('0x13')](_0x7b4d('0x16'),auth[_0x7b4d('0x8')](),controller[_0x7b4d('0x17')]);router[_0x7b4d('0x13')](_0x7b4d('0x11'),auth[_0x7b4d('0x8')](),controller['addApplications']);router['post']('/:id/notify',controller[_0x7b4d('0x18')]);router[_0x7b4d('0x13')](_0x7b4d('0x19'),auth[_0x7b4d('0x8')](),controller[_0x7b4d('0x1a')]);router[_0x7b4d('0x1b')](_0x7b4d('0xc'),auth['isAuthenticated'](),controller[_0x7b4d('0x1c')]);router['delete'](_0x7b4d('0xc'),auth['isAuthenticated'](),controller[_0x7b4d('0x1d')]);router['delete']('/:id/dispositions',auth[_0x7b4d('0x8')](),controller[_0x7b4d('0x1e')]);router['delete'](_0x7b4d('0xf'),auth['isAuthenticated'](),controller[_0x7b4d('0x1f')]);router[_0x7b4d('0x20')]('/:id/users',auth[_0x7b4d('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xe46d=['index','/describe','isAuthenticated','describe','/:id','/:id/dispositions','/:id/canned_answers','getAnswers','getAgents','/:id/applications','getApplications','post','addDisposition','/:id/users','addAgents','addApplications','/:id/notify','notify','/:id/send','put','update','delete','destroy','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get'];(function(_0x118170,_0x10363f){var _0x18fd8e=function(_0x5e967b){while(--_0x5e967b){_0x118170['push'](_0x118170['shift']());}};_0x18fd8e(++_0x10363f);}(_0xe46d,0x14b));var _0xde46=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe46d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xde46('0x0'));var util=require(_0xde46('0x1'));var path=require(_0xde46('0x2'));var timeout=require(_0xde46('0x3'));var express=require(_0xde46('0x4'));var router=express[_0xde46('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xde46('0x6'));var interaction=require(_0xde46('0x7'));var config=require('../../config/environment');var controller=require('./whatsappAccount.controller');router[_0xde46('0x8')]('/',auth['isAuthenticated'](),controller[_0xde46('0x9')]);router[_0xde46('0x8')](_0xde46('0xa'),auth[_0xde46('0xb')](),controller[_0xde46('0xc')]);router['get'](_0xde46('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xde46('0x8')](_0xde46('0xe'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xde46('0x8')](_0xde46('0xf'),auth['isAuthenticated'](),controller[_0xde46('0x10')]);router[_0xde46('0x8')]('/:id/users',auth[_0xde46('0xb')](),controller[_0xde46('0x11')]);router[_0xde46('0x8')](_0xde46('0x12'),auth[_0xde46('0xb')](),controller[_0xde46('0x13')]);router['post']('/',auth[_0xde46('0xb')](),controller['create']);router[_0xde46('0x14')](_0xde46('0xe'),auth[_0xde46('0xb')](),controller[_0xde46('0x15')]);router[_0xde46('0x14')](_0xde46('0xf'),auth[_0xde46('0xb')](),controller['addAnswer']);router[_0xde46('0x14')](_0xde46('0x16'),auth[_0xde46('0xb')](),controller[_0xde46('0x17')]);router[_0xde46('0x14')](_0xde46('0x12'),auth[_0xde46('0xb')](),controller[_0xde46('0x18')]);router[_0xde46('0x14')](_0xde46('0x19'),controller[_0xde46('0x1a')]);router[_0xde46('0x14')](_0xde46('0x1b'),auth[_0xde46('0xb')](),controller['send']);router[_0xde46('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0xde46('0x1d')]);router[_0xde46('0x1e')](_0xde46('0xd'),auth[_0xde46('0xb')](),controller[_0xde46('0x1f')]);router['delete'](_0xde46('0xe'),auth[_0xde46('0xb')](),controller['removeDispositions']);router[_0xde46('0x1e')](_0xde46('0xf'),auth[_0xde46('0xb')](),controller[_0xde46('0x20')]);router[_0xde46('0x1e')](_0xde46('0x16'),auth[_0xde46('0xb')](),controller['removeAgents']);module[_0xde46('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 45d3298..054634d 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 _0xe0c5=['setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','twilio','sinch','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId'];(function(_0x29d2d6,_0x1d4256){var _0x4a2611=function(_0x1ad66f){while(--_0x1ad66f){_0x29d2d6['push'](_0x29d2d6['shift']());}};_0x4a2611(++_0x1d4256);}(_0xe0c5,0x1bc));var _0x5e0c=function(_0x33cdf9,_0x5a291d){_0x33cdf9=_0x33cdf9-0x0;var _0x1026b1=_0xe0c5[_0x33cdf9];return _0x1026b1;};'use strict';var Sequelize=require(_0x5e0c('0x0'));var rs=require('randomstring');module[_0x5e0c('0x1')]={'name':{'type':Sequelize[_0x5e0c('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x5e0c('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x5e0c('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x5e0c('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5e0c('0x3')](_0x5e0c('0x4'),_0x5e0c('0x5'))},'accountSid':{'type':Sequelize[_0x5e0c('0x2')]},'baseUrl':{'type':Sequelize[_0x5e0c('0x2')]},'authToken':{'type':Sequelize[_0x5e0c('0x2')]},'notificationTemplate':{'type':Sequelize[_0x5e0c('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x5e0c('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5e0c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5e0c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5e0c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5e0c('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5e0c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5e0c('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x5e0c('0x7')],'defaultValue':![],'comment':_0x5e0c('0x9'),'set':function(_0x2d586a){if(!_0x2d586a){this['setDataValue'](_0x5e0c('0xa'),null);}this[_0x5e0c('0xb')](_0x5e0c('0xc'),_0x2d586a);}},'description':{'type':Sequelize[_0x5e0c('0x2')]}}; \ No newline at end of file +var _0x6e04=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','name','STRING','ENUM','twilio','sinch'];(function(_0x15066d,_0x39fb06){var _0x2c146c=function(_0x2bbed5){while(--_0x2bbed5){_0x15066d['push'](_0x15066d['shift']());}};_0x2c146c(++_0x39fb06);}(_0x6e04,0x1bb));var _0x46e0=function(_0x4914e2,_0x48be8f){_0x4914e2=_0x4914e2-0x0;var _0x2dcd07=_0x6e04[_0x4914e2];return _0x2dcd07;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x46e0('0x0'));module[_0x46e0('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x46e0('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x46e0('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x46e0('0x3')]},'type':{'type':Sequelize[_0x46e0('0x4')](_0x46e0('0x5'),_0x46e0('0x6'))},'accountSid':{'type':Sequelize[_0x46e0('0x3')]},'baseUrl':{'type':Sequelize[_0x46e0('0x3')]},'authToken':{'type':Sequelize[_0x46e0('0x3')]},'notificationTemplate':{'type':Sequelize[_0x46e0('0x7')],'defaultValue':function(){return _0x46e0('0x8');}},'notificationSound':{'type':Sequelize[_0x46e0('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x46e0('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x46e0('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x46e0('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x46e0('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x46e0('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x46e0('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x46e0('0xa')],'comment':_0x46e0('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x46e0('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x311d41){if(!_0x311d41){this[_0x46e0('0xc')](_0x46e0('0xd'),null);}this[_0x46e0('0xc')](_0x46e0('0xe'),_0x311d41);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 008c87a..1a15270 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 _0x0e16=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','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','redis','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','http','request','then','WhatsappAccount,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','end','stack','name','send','Pause','map','WhatsappAccount','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','mandatoryDispositionPause','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','params','describe','WhatsappAccountId','Disposition','getDispositions','rows','removeDispositions','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','ids','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','finally','getApplications','account','type','sinch','statuses','WhatsappMessage','message_id','orderBy','asc','Applications','CmContact','Sequelize','no\x20available\x20attributes','updatedAt','difference','CompanyId','ListId','mobile','twilio','from','whatsapp:','Body','MessageSid','notifications','messageId','isNil','ValidationError','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','omit','defaults','contact','WhatsappInteraction','interaction','autoclose','applications','push','unmanaged','created','AttachmentId','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','queueId','WhatsappQueue','waitForTheAssignedQueue','startRouting','receiveMessage','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','DESC','out','dataValues','Messages','eml-format'];(function(_0x4ce213,_0x33f3de){var _0x572a87=function(_0xe0227c){while(--_0xe0227c){_0x4ce213['push'](_0x4ce213['shift']());}};_0x572a87(++_0x33f3de);}(_0x0e16,0x183));var _0x60e1=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x0e16[_0x4243a3];return _0x1b2a33;};'use strict';var emlformat=require(_0x60e1('0x0'));var rimraf=require(_0x60e1('0x1'));var zipdir=require(_0x60e1('0x2'));var jsonpatch=require(_0x60e1('0x3'));var rp=require(_0x60e1('0x4'));var moment=require(_0x60e1('0x5'));var BPromise=require(_0x60e1('0x6'));var Mustache=require(_0x60e1('0x7'));var util=require(_0x60e1('0x8'));var path=require(_0x60e1('0x9'));var sox=require(_0x60e1('0xa'));var csv=require(_0x60e1('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x60e1('0xc'));var _=require('lodash');var squel=require(_0x60e1('0xd'));var crypto=require(_0x60e1('0xe'));var jsforce=require(_0x60e1('0xf'));var deskjs=require(_0x60e1('0x10'));var toCsv=require(_0x60e1('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x60e1('0x11'));var authService=require(_0x60e1('0x12'));var qs=require(_0x60e1('0x13'));var as=require(_0x60e1('0x14'));var hardwareService=require(_0x60e1('0x15'));var logger=require(_0x60e1('0x16'))(_0x60e1('0x17'));var utils=require(_0x60e1('0x18'));var config=require(_0x60e1('0x19'));var licenseUtil=require(_0x60e1('0x1a'));var db=require(_0x60e1('0x1b'))['db'];config[_0x60e1('0x1c')]=_['defaults'](config[_0x60e1('0x1c')],{'host':_0x60e1('0x1d'),'port':0x18eb});var socket=require(_0x60e1('0x1e'))(new Redis(config[_0x60e1('0x1c')]));require(_0x60e1('0x1f'))['register'](socket);var jayson=require(_0x60e1('0x20'));var client=jayson['client'][_0x60e1('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x5979cc,_0x43b094,_0x1e782b,_0x4813e1){return new BPromise(function(_0x192f38,_0xa510f9){var _0xa6a09a=_0x4813e1||client;return _0xa6a09a[_0x60e1('0x22')](_0x5979cc,_0x1e782b)[_0x60e1('0x23')](function(_0x5a18bb){logger['info'](_0x60e1('0x24'),_0x43b094,'request\x20sent');logger['debug'](_0x60e1('0x25'),_0x43b094,'request\x20sent',JSON['stringify'](_0x5a18bb));if(_0x5a18bb[_0x60e1('0x26')]){if(_0x5a18bb['error'][_0x60e1('0x27')]===0x1f4){logger[_0x60e1('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x43b094,_0x5a18bb[_0x60e1('0x26')][_0x60e1('0x28')]);return _0xa510f9(_0x5a18bb[_0x60e1('0x26')][_0x60e1('0x28')]);}logger[_0x60e1('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x43b094,_0x5a18bb[_0x60e1('0x26')]['message']);return _0x192f38(_0x5a18bb['error'][_0x60e1('0x28')]);}else{logger[_0x60e1('0x29')](_0x60e1('0x24'),_0x43b094,_0x60e1('0x2a'));_0x192f38(_0x5a18bb[_0x60e1('0x2b')][_0x60e1('0x28')]);}})[_0x60e1('0x2c')](function(_0x2848ff){logger[_0x60e1('0x26')](_0x60e1('0x24'),_0x43b094,_0x2848ff);_0xa510f9(_0x2848ff);});});}function respondWithStatusCode(_0x297733,_0x2565a2){_0x2565a2=_0x2565a2||0xcc;return function(_0x5ea803){if(_0x5ea803){return _0x297733[_0x60e1('0x2d')](_0x2565a2);}return _0x297733[_0x60e1('0x2e')](_0x2565a2)['end']();};}function respondWithResult(_0x361b2c,_0x36e803){_0x36e803=_0x36e803||0xc8;return function(_0x2127a6){if(_0x2127a6){return _0x361b2c[_0x60e1('0x2e')](_0x36e803)[_0x60e1('0x2f')](_0x2127a6);}};}function respondWithFilteredResult(_0x1be296,_0x584435){return function(_0x48527d){if(_0x48527d){var _0x17defe=typeof _0x584435[_0x60e1('0x30')]===_0x60e1('0x31')&&typeof _0x584435[_0x60e1('0x32')]==='undefined';var _0x1ab3af=_0x48527d[_0x60e1('0x33')];var _0x239f30=_0x17defe?0x0:_0x584435[_0x60e1('0x30')];var _0x5c4987=_0x17defe?_0x48527d['count']:_0x584435[_0x60e1('0x30')]+_0x584435[_0x60e1('0x32')];var _0x8735c2;if(_0x5c4987>=_0x1ab3af){_0x5c4987=_0x1ab3af;_0x8735c2=0xc8;}else{_0x8735c2=0xce;}_0x1be296[_0x60e1('0x2e')](_0x8735c2);return _0x1be296[_0x60e1('0x34')]('Content-Range',_0x239f30+'-'+_0x5c4987+'/'+_0x1ab3af)[_0x60e1('0x2f')](_0x48527d);}return null;};}function patchUpdates(_0x2dd391){return function(_0x110944){try{jsonpatch[_0x60e1('0x35')](_0x110944,_0x2dd391,!![]);}catch(_0x37875a){return BPromise[_0x60e1('0x36')](_0x37875a);}return _0x110944[_0x60e1('0x37')]();};}function saveUpdates(_0x2b9ed,_0x110950){return function(_0x5170ba){if(_0x5170ba){return _0x5170ba[_0x60e1('0x38')](_0x2b9ed)[_0x60e1('0x23')](function(_0x5be4cc){return _0x5be4cc;});}return null;};}function removeEntity(_0x5e348a,_0x44af28){return function(_0x176efc){if(_0x176efc){return _0x176efc[_0x60e1('0x39')]()['then'](function(){var _0xba3af7=_0x176efc[_0x60e1('0x3a')]({'plain':!![]});var _0x305bee=_0x60e1('0x3b');return db[_0x60e1('0x3c')][_0x60e1('0x39')]({'where':{'type':_0x305bee,'resourceId':_0xba3af7['id']}})[_0x60e1('0x23')](function(){return _0x176efc;});})[_0x60e1('0x23')](function(){_0x5e348a[_0x60e1('0x2e')](0xcc)[_0x60e1('0x3d')]();});}};}function handleEntityNotFound(_0x3e3d0c,_0x1cf4b5){return function(_0x197108){if(!_0x197108){_0x3e3d0c[_0x60e1('0x2d')](0x194);}return _0x197108;};}function handleError(_0x481814,_0x2b5e40){_0x2b5e40=_0x2b5e40||0x1f4;return function(_0xe8c2cf){logger[_0x60e1('0x26')](_0xe8c2cf[_0x60e1('0x3e')]);if(_0xe8c2cf[_0x60e1('0x3f')]){delete _0xe8c2cf[_0x60e1('0x3f')];}_0x481814[_0x60e1('0x2e')](_0x2b5e40)[_0x60e1('0x40')](_0xe8c2cf);};}exports['index']=function(_0x20cd9f,_0x53a224){var _0x5db919={'include':[{'model':db[_0x60e1('0x41')],'as':'mandatoryDispositionPause'}]},_0x244c61={},_0x492097={'count':0x0,'rows':[]};var _0x23b931=_[_0x60e1('0x42')](db[_0x60e1('0x43')][_0x60e1('0x44')],function(_0x4179c4){return{'name':_0x4179c4[_0x60e1('0x45')],'type':_0x4179c4['type'][_0x60e1('0x46')]};});_0x244c61['model']=_[_0x60e1('0x42')](_0x23b931,_0x60e1('0x3f'));_0x244c61[_0x60e1('0x47')]=_[_0x60e1('0x48')](_0x20cd9f[_0x60e1('0x47')]);_0x244c61[_0x60e1('0x49')]=_[_0x60e1('0x4a')](_0x244c61['model'],_0x244c61[_0x60e1('0x47')]);_0x5db919[_0x60e1('0x4b')]=_[_0x60e1('0x4a')](_0x244c61[_0x60e1('0x4c')],qs[_0x60e1('0x4d')](_0x20cd9f['query'][_0x60e1('0x4d')]));_0x5db919[_0x60e1('0x4b')]=_0x5db919[_0x60e1('0x4b')][_0x60e1('0x4e')]?_0x5db919[_0x60e1('0x4b')]:_0x244c61['model'];if(!_0x20cd9f[_0x60e1('0x47')][_0x60e1('0x4f')](_0x60e1('0x50'))){_0x5db919[_0x60e1('0x32')]=qs[_0x60e1('0x32')](_0x20cd9f[_0x60e1('0x47')]['limit']);_0x5db919[_0x60e1('0x30')]=qs[_0x60e1('0x30')](_0x20cd9f[_0x60e1('0x47')]['offset']);}_0x5db919[_0x60e1('0x51')]=qs['sort'](_0x20cd9f[_0x60e1('0x47')][_0x60e1('0x52')]);_0x5db919[_0x60e1('0x53')]=qs[_0x60e1('0x49')](_[_0x60e1('0x54')](_0x20cd9f[_0x60e1('0x47')],_0x244c61[_0x60e1('0x49')]),_0x23b931);if(_0x20cd9f[_0x60e1('0x47')][_0x60e1('0x55')]){_0x5db919[_0x60e1('0x53')]=_[_0x60e1('0x56')](_0x5db919[_0x60e1('0x53')],{'$or':_[_0x60e1('0x42')](_0x23b931,function(_0x2e296d){if(_0x2e296d['type']!=='VIRTUAL'){var _0x224fda={};_0x224fda[_0x2e296d['name']]={'$like':'%'+_0x20cd9f[_0x60e1('0x47')][_0x60e1('0x55')]+'%'};return _0x224fda;}})});}_0x5db919=_['merge']({},_0x5db919,_0x20cd9f[_0x60e1('0x57')]);var _0x1d8f82={'where':_0x5db919['where']};return db[_0x60e1('0x43')][_0x60e1('0x33')](_0x1d8f82)[_0x60e1('0x23')](function(_0x589920){_0x492097[_0x60e1('0x33')]=_0x589920;if(_0x20cd9f[_0x60e1('0x47')][_0x60e1('0x58')]){_0x5db919[_0x60e1('0x59')]=[{'all':!![]}];}return db[_0x60e1('0x43')][_0x60e1('0x5a')](_0x5db919);})[_0x60e1('0x23')](function(_0x256612){_0x492097['rows']=_0x256612;return _0x492097;})['then'](respondWithFilteredResult(_0x53a224,_0x5db919))[_0x60e1('0x2c')](handleError(_0x53a224,null));};exports[_0x60e1('0x5b')]=function(_0x4a354f,_0x42e244){var _0x441c24={'raw':![],'where':{'id':_0x4a354f['params']['id']},'include':[{'model':db['Pause'],'as':_0x60e1('0x5c')}]},_0x2e0db5={};_0x2e0db5[_0x60e1('0x4c')]=_[_0x60e1('0x48')](db[_0x60e1('0x43')][_0x60e1('0x44')]);_0x2e0db5[_0x60e1('0x47')]=_['keys'](_0x4a354f[_0x60e1('0x47')]);_0x2e0db5[_0x60e1('0x49')]=_[_0x60e1('0x4a')](_0x2e0db5['model'],_0x2e0db5[_0x60e1('0x47')]);_0x441c24[_0x60e1('0x4b')]=_[_0x60e1('0x4a')](_0x2e0db5[_0x60e1('0x4c')],qs[_0x60e1('0x4d')](_0x4a354f['query'][_0x60e1('0x4d')]));_0x441c24[_0x60e1('0x4b')]=_0x441c24['attributes']['length']?_0x441c24[_0x60e1('0x4b')]:_0x2e0db5['model'];if(_0x4a354f['query'][_0x60e1('0x58')]){_0x441c24[_0x60e1('0x59')]=[{'all':!![]}];}_0x441c24=_['merge']({},_0x441c24,_0x4a354f[_0x60e1('0x57')]);return db[_0x60e1('0x43')][_0x60e1('0x5d')](_0x441c24)['then'](handleEntityNotFound(_0x42e244,null))['then'](respondWithResult(_0x42e244,null))['catch'](handleError(_0x42e244,null));};exports[_0x60e1('0x5e')]=function(_0x53c813,_0x80cd2){return db['WhatsappAccount']['create'](_0x53c813[_0x60e1('0x5f')],{})['then'](function(_0x2ec5d4){var _0x289095=_0x53c813['user'][_0x60e1('0x3a')]({'plain':!![]});if(!_0x289095)throw new Error(_0x60e1('0x60'));if(_0x289095['role']===_0x60e1('0x61')){var _0x157eec=_0x2ec5d4[_0x60e1('0x3a')]({'plain':!![]});var _0x2930f9=_0x60e1('0x3b');return db[_0x60e1('0x62')]['find']({'where':{'name':_0x2930f9,'userProfileId':_0x289095[_0x60e1('0x63')]},'raw':!![]})[_0x60e1('0x23')](function(_0x5900a6){if(_0x5900a6&&_0x5900a6[_0x60e1('0x64')]===0x0){return db[_0x60e1('0x3c')]['create']({'name':_0x157eec['name'],'resourceId':_0x157eec['id'],'type':_0x5900a6[_0x60e1('0x3f')],'sectionId':_0x5900a6['id']},{})[_0x60e1('0x23')](function(){return _0x2ec5d4;});}else{return _0x2ec5d4;}})[_0x60e1('0x2c')](function(_0x5e037a){logger[_0x60e1('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e037a);throw _0x5e037a;});}return _0x2ec5d4;})['then'](respondWithResult(_0x80cd2,0xc9))['catch'](handleError(_0x80cd2,null));};exports[_0x60e1('0x38')]=function(_0x3a050b,_0x2163e2){if(_0x3a050b[_0x60e1('0x5f')]['id']){delete _0x3a050b[_0x60e1('0x5f')]['id'];}return db[_0x60e1('0x43')][_0x60e1('0x5d')]({'where':{'id':_0x3a050b['params']['id']},'include':[{'model':db[_0x60e1('0x41')],'as':_0x60e1('0x5c')}]})['then'](handleEntityNotFound(_0x2163e2,null))[_0x60e1('0x23')](saveUpdates(_0x3a050b[_0x60e1('0x5f')],null))[_0x60e1('0x23')](respondWithResult(_0x2163e2,null))['catch'](handleError(_0x2163e2,null));};exports[_0x60e1('0x39')]=function(_0x5705cc,_0x5264e9){return db[_0x60e1('0x43')][_0x60e1('0x5d')]({'where':{'id':_0x5705cc[_0x60e1('0x65')]['id']}})['then'](handleEntityNotFound(_0x5264e9,null))['then'](removeEntity(_0x5264e9,null))[_0x60e1('0x2c')](handleError(_0x5264e9,null));};exports['describe']=function(_0x3f9b4c,_0x5d2879){return db['WhatsappAccount'][_0x60e1('0x66')]()['then'](respondWithResult(_0x5d2879,null))[_0x60e1('0x2c')](handleError(_0x5d2879,null));};exports['addDisposition']=function(_0x3067d3,_0x77a451,_0xb8cdbe){if(_0x3067d3[_0x60e1('0x5f')]['id']){delete _0x3067d3[_0x60e1('0x5f')]['id'];}return db[_0x60e1('0x43')]['find']({'where':{'id':_0x3067d3[_0x60e1('0x65')]['id']}})[_0x60e1('0x23')](handleEntityNotFound(_0x77a451,null))['then'](function(_0x18b7e2){if(_0x18b7e2){_0x3067d3[_0x60e1('0x5f')][_0x60e1('0x67')]=_0x18b7e2['id'];return db[_0x60e1('0x68')][_0x60e1('0x5e')](_0x3067d3[_0x60e1('0x5f')]);}})[_0x60e1('0x23')](respondWithResult(_0x77a451,null))[_0x60e1('0x2c')](handleError(_0x77a451,null));};exports[_0x60e1('0x69')]=function(_0x5de41d,_0x30f9a2,_0x2ca52d){var _0x4a0148={'raw':![],'where':{}};var _0x1599c4={};var _0x201b1b={'count':0x0,'rows':[]};return db[_0x60e1('0x43')]['findOne']({'where':{'id':_0x5de41d[_0x60e1('0x65')]['id']}})[_0x60e1('0x23')](handleEntityNotFound(_0x30f9a2,null))['then'](function(_0x54e9ec){if(_0x54e9ec){_0x1599c4[_0x60e1('0x4c')]=_['keys'](db['Disposition'][_0x60e1('0x44')]);_0x1599c4[_0x60e1('0x47')]=_['keys'](_0x5de41d[_0x60e1('0x47')]);_0x1599c4[_0x60e1('0x49')]=_[_0x60e1('0x4a')](_0x1599c4[_0x60e1('0x4c')],_0x1599c4['query']);_0x4a0148[_0x60e1('0x4b')]=_[_0x60e1('0x4a')](_0x1599c4[_0x60e1('0x4c')],qs['fields'](_0x5de41d[_0x60e1('0x47')]['fields']));_0x4a0148[_0x60e1('0x4b')]=_0x4a0148[_0x60e1('0x4b')][_0x60e1('0x4e')]?_0x4a0148['attributes']:_0x1599c4[_0x60e1('0x4c')];if(!_0x5de41d['query'][_0x60e1('0x4f')](_0x60e1('0x50'))){_0x4a0148[_0x60e1('0x32')]=qs[_0x60e1('0x32')](_0x5de41d['query'][_0x60e1('0x32')]);_0x4a0148[_0x60e1('0x30')]=qs['offset'](_0x5de41d[_0x60e1('0x47')][_0x60e1('0x30')]);}_0x4a0148['order']=qs[_0x60e1('0x52')](_0x5de41d[_0x60e1('0x47')][_0x60e1('0x52')]);_0x4a0148[_0x60e1('0x53')]=qs[_0x60e1('0x49')](_['pick'](_0x5de41d[_0x60e1('0x47')],_0x1599c4[_0x60e1('0x49')]));_0x4a0148[_0x60e1('0x53')][_0x60e1('0x67')]=_0x54e9ec['id'];if(_0x5de41d[_0x60e1('0x47')][_0x60e1('0x55')]){_0x4a0148['where']=_['merge'](_0x4a0148[_0x60e1('0x53')],{'$or':_['map'](_0x4a0148[_0x60e1('0x4b')],function(_0x7330bf){var _0x2397d5={};_0x2397d5[_0x7330bf]={'$like':'%'+_0x5de41d[_0x60e1('0x47')]['filter']+'%'};return _0x2397d5;})});}_0x4a0148=_[_0x60e1('0x56')]({},_0x4a0148,_0x5de41d[_0x60e1('0x57')]);return db[_0x60e1('0x68')]['count']({'where':_0x4a0148[_0x60e1('0x53')]})['then'](function(_0x3b67a1){_0x201b1b[_0x60e1('0x33')]=_0x3b67a1;if(_0x5de41d[_0x60e1('0x47')][_0x60e1('0x58')]){_0x4a0148[_0x60e1('0x59')]=[{'all':!![]}];}return db[_0x60e1('0x68')][_0x60e1('0x5a')](_0x4a0148);})[_0x60e1('0x23')](function(_0xa063cf){_0x201b1b[_0x60e1('0x6a')]=_0xa063cf;return _0x201b1b;});}})[_0x60e1('0x23')](respondWithFilteredResult(_0x30f9a2,_0x4a0148))[_0x60e1('0x2c')](handleError(_0x30f9a2,null));};exports[_0x60e1('0x6b')]=function(_0x5ce9e0,_0x322e4e,_0x4a474a){return db[_0x60e1('0x43')][_0x60e1('0x5d')]({'where':{'id':_0x5ce9e0[_0x60e1('0x65')]['id']}})[_0x60e1('0x23')](handleEntityNotFound(_0x322e4e,null))[_0x60e1('0x23')](function(_0x4dbf1a){if(_0x4dbf1a){return _0x4dbf1a[_0x60e1('0x6b')](_0x5ce9e0[_0x60e1('0x47')]['ids']);}})['then'](respondWithStatusCode(_0x322e4e,null))[_0x60e1('0x2c')](handleError(_0x322e4e,null));};exports[_0x60e1('0x6c')]=function(_0x1c62ce,_0xddd6b9,_0x2410be){if(_0x1c62ce[_0x60e1('0x5f')]['id']){delete _0x1c62ce['body']['id'];}return db[_0x60e1('0x43')][_0x60e1('0x5d')]({'where':{'id':_0x1c62ce[_0x60e1('0x65')]['id']}})[_0x60e1('0x23')](handleEntityNotFound(_0xddd6b9,null))[_0x60e1('0x23')](function(_0x10ed96){if(_0x10ed96){_0x1c62ce[_0x60e1('0x5f')][_0x60e1('0x67')]=_0x10ed96['id'];return db['CannedAnswer'][_0x60e1('0x5e')](_0x1c62ce[_0x60e1('0x5f')]);}})[_0x60e1('0x23')](respondWithResult(_0xddd6b9,null))[_0x60e1('0x2c')](handleError(_0xddd6b9,null));};exports[_0x60e1('0x6d')]=function(_0x322106,_0x5a1ecd,_0x1ae438){var _0x481854={'raw':![],'where':{}};var _0x7a26f4={};var _0x3651e5={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x60e1('0x6e')]({'where':{'id':_0x322106['params']['id']}})[_0x60e1('0x23')](handleEntityNotFound(_0x5a1ecd,null))[_0x60e1('0x23')](function(_0x5d538c){if(_0x5d538c){_0x7a26f4[_0x60e1('0x4c')]=_[_0x60e1('0x48')](db[_0x60e1('0x6f')][_0x60e1('0x44')]);_0x7a26f4[_0x60e1('0x47')]=_[_0x60e1('0x48')](_0x322106[_0x60e1('0x47')]);_0x7a26f4[_0x60e1('0x49')]=_[_0x60e1('0x4a')](_0x7a26f4[_0x60e1('0x4c')],_0x7a26f4[_0x60e1('0x47')]);_0x481854[_0x60e1('0x4b')]=_[_0x60e1('0x4a')](_0x7a26f4[_0x60e1('0x4c')],qs['fields'](_0x322106[_0x60e1('0x47')][_0x60e1('0x4d')]));_0x481854[_0x60e1('0x4b')]=_0x481854['attributes'][_0x60e1('0x4e')]?_0x481854[_0x60e1('0x4b')]:_0x7a26f4[_0x60e1('0x4c')];if(!_0x322106['query'][_0x60e1('0x4f')](_0x60e1('0x50'))){_0x481854[_0x60e1('0x32')]=qs['limit'](_0x322106[_0x60e1('0x47')][_0x60e1('0x32')]);_0x481854[_0x60e1('0x30')]=qs['offset'](_0x322106[_0x60e1('0x47')][_0x60e1('0x30')]);}_0x481854['order']=qs[_0x60e1('0x52')](_0x322106[_0x60e1('0x47')][_0x60e1('0x52')]);_0x481854[_0x60e1('0x53')]=qs['filters'](_[_0x60e1('0x54')](_0x322106['query'],_0x7a26f4[_0x60e1('0x49')]));_0x481854[_0x60e1('0x53')][_0x60e1('0x67')]=_0x5d538c['id'];if(_0x322106['query'][_0x60e1('0x55')]){_0x481854[_0x60e1('0x53')]=_[_0x60e1('0x56')](_0x481854[_0x60e1('0x53')],{'$or':_['map'](_0x481854[_0x60e1('0x4b')],function(_0x1343d9){var _0x531d59={};_0x531d59[_0x1343d9]={'$like':'%'+_0x322106[_0x60e1('0x47')][_0x60e1('0x55')]+'%'};return _0x531d59;})});}_0x481854=_[_0x60e1('0x56')]({},_0x481854,_0x322106[_0x60e1('0x57')]);return db[_0x60e1('0x6f')][_0x60e1('0x33')]({'where':_0x481854[_0x60e1('0x53')]})[_0x60e1('0x23')](function(_0x473306){_0x3651e5['count']=_0x473306;if(_0x322106[_0x60e1('0x47')][_0x60e1('0x58')]){_0x481854[_0x60e1('0x59')]=[{'all':!![]}];}return db['CannedAnswer'][_0x60e1('0x5a')](_0x481854);})[_0x60e1('0x23')](function(_0x33f8e0){_0x3651e5[_0x60e1('0x6a')]=_0x33f8e0;return _0x3651e5;});}})['then'](respondWithFilteredResult(_0x5a1ecd,_0x481854))['catch'](handleError(_0x5a1ecd,null));};exports['removeAnswers']=function(_0x31ad3b,_0x4c09a9,_0x1f3eb1){return db['WhatsappAccount'][_0x60e1('0x5d')]({'where':{'id':_0x31ad3b[_0x60e1('0x65')]['id']}})[_0x60e1('0x23')](handleEntityNotFound(_0x4c09a9,null))['then'](function(_0x5eacc9){if(_0x5eacc9){return _0x5eacc9[_0x60e1('0x70')](_0x31ad3b[_0x60e1('0x47')][_0x60e1('0x71')]);}})[_0x60e1('0x23')](respondWithStatusCode(_0x4c09a9,null))[_0x60e1('0x2c')](handleError(_0x4c09a9,null));};exports[_0x60e1('0x72')]=function(_0x557db1,_0x5795c3,_0x506cdc){return db[_0x60e1('0x43')]['find']({'where':{'id':_0x557db1[_0x60e1('0x65')]['id']}})[_0x60e1('0x23')](handleEntityNotFound(_0x5795c3,null))[_0x60e1('0x23')](function(_0x102476){if(_0x102476){return _0x102476[_0x60e1('0x72')](_0x557db1[_0x60e1('0x5f')][_0x60e1('0x71')],_['omit'](_0x557db1[_0x60e1('0x5f')],[_0x60e1('0x71'),'id'])||{})[_0x60e1('0x73')](function(_0x10c784){for(var _0x348687=0x0;_0x348687<_0x557db1[_0x60e1('0x5f')][_0x60e1('0x71')][_0x60e1('0x4e')];_0x348687+=0x1){socket[_0x60e1('0x74')](_0x60e1('0x75'),{'UserId':Number(_0x557db1[_0x60e1('0x5f')][_0x60e1('0x71')][_0x348687]),'WhatsappAccountId':Number(_0x557db1[_0x60e1('0x65')]['id'])});}return _0x10c784;});}})[_0x60e1('0x23')](respondWithResult(_0x5795c3,null))['catch'](handleError(_0x5795c3,null));};exports[_0x60e1('0x76')]=function(_0x59875f,_0x544a44,_0x58c1d1){return db[_0x60e1('0x43')][_0x60e1('0x5d')]({'where':{'id':_0x59875f[_0x60e1('0x65')]['id']}})[_0x60e1('0x23')](handleEntityNotFound(_0x544a44,null))['then'](function(_0x4a0531){if(_0x4a0531){return _0x4a0531[_0x60e1('0x76')](_0x59875f[_0x60e1('0x47')][_0x60e1('0x71')])['then'](function(){if(_[_0x60e1('0x77')](_0x59875f[_0x60e1('0x47')][_0x60e1('0x71')])){for(var _0x30b05a=0x0;_0x30b05a<_0x59875f[_0x60e1('0x47')][_0x60e1('0x71')][_0x60e1('0x4e')];_0x30b05a+=0x1){socket[_0x60e1('0x74')](_0x60e1('0x78'),{'UserId':Number(_0x59875f['query']['ids'][_0x30b05a]),'WhatsappAccountId':Number(_0x59875f[_0x60e1('0x65')]['id'])});}}else{socket[_0x60e1('0x74')](_0x60e1('0x78'),{'UserId':Number(_0x59875f[_0x60e1('0x47')][_0x60e1('0x71')]),'WhatsappAccountId':Number(_0x59875f['params']['id'])});}});}})[_0x60e1('0x23')](respondWithStatusCode(_0x544a44,null))[_0x60e1('0x2c')](handleError(_0x544a44,null));};exports[_0x60e1('0x79')]=function(_0x583677,_0x4e8ce8,_0xe8b49f){var _0xb73a52={};var _0x329476={};var _0x58f65e;var _0x4105b4;return db[_0x60e1('0x43')][_0x60e1('0x6e')]({'where':{'id':_0x583677[_0x60e1('0x65')]['id']}})[_0x60e1('0x23')](handleEntityNotFound(_0x4e8ce8,null))[_0x60e1('0x23')](function(_0x1215d9){if(_0x1215d9){_0x58f65e=_0x1215d9;_0x329476['model']=_['keys'](db['User']['rawAttributes']);_0x329476['query']=_[_0x60e1('0x48')](_0x583677[_0x60e1('0x47')]);_0x329476[_0x60e1('0x49')]=_[_0x60e1('0x4a')](_0x329476['model'],_0x329476[_0x60e1('0x47')]);_0xb73a52[_0x60e1('0x4b')]=_[_0x60e1('0x4a')](_0x329476[_0x60e1('0x4c')],qs[_0x60e1('0x4d')](_0x583677[_0x60e1('0x47')]['fields']));_0xb73a52[_0x60e1('0x4b')]=_0xb73a52[_0x60e1('0x4b')][_0x60e1('0x4e')]?_0xb73a52[_0x60e1('0x4b')]:_0x329476[_0x60e1('0x4c')];_0xb73a52['order']=qs[_0x60e1('0x52')](_0x583677[_0x60e1('0x47')]['sort']);_0xb73a52[_0x60e1('0x53')]=qs[_0x60e1('0x49')](_[_0x60e1('0x54')](_0x583677['query'],_0x329476[_0x60e1('0x49')]));if(_0x583677[_0x60e1('0x47')][_0x60e1('0x55')]){_0xb73a52[_0x60e1('0x53')]=_[_0x60e1('0x56')](_0xb73a52['where'],{'$or':_['map'](_0xb73a52['attributes'],function(_0x419339){var _0x1ccec0={};_0x1ccec0[_0x419339]={'$like':'%'+_0x583677[_0x60e1('0x47')]['filter']+'%'};return _0x1ccec0;})});}_0xb73a52=_['merge']({},_0xb73a52,_0x583677['options']);return _0x58f65e[_0x60e1('0x79')](_0xb73a52);}})[_0x60e1('0x23')](function(_0x5404ea){if(_0x5404ea){_0x4105b4=_0x5404ea[_0x60e1('0x4e')];if(!_0x583677['query']['hasOwnProperty'](_0x60e1('0x50'))){_0xb73a52[_0x60e1('0x32')]=qs['limit'](_0x583677[_0x60e1('0x47')][_0x60e1('0x32')]);_0xb73a52[_0x60e1('0x30')]=qs['offset'](_0x583677[_0x60e1('0x47')][_0x60e1('0x30')]);}return _0x58f65e[_0x60e1('0x79')](_0xb73a52);}})[_0x60e1('0x23')](function(_0xa16d9f){if(_0xa16d9f){return _0xa16d9f?{'count':_0x4105b4,'rows':_0xa16d9f}:null;}})['then'](respondWithResult(_0x4e8ce8,null))[_0x60e1('0x2c')](handleError(_0x4e8ce8,null));};exports[_0x60e1('0x7a')]=function(_0x3e6d05,_0x270e1a){var _0x2d1603=_0x3e6d05[_0x60e1('0x65')]['id'];var _0x335605=_0x3e6d05['body'];var _0x1d33d8=0xc8;var _0x5ecd1d=null;return db[_0x60e1('0x7b')][_0x60e1('0x7c')]({'isolationLevel':db[_0x60e1('0x7b')][_0x60e1('0x7d')][_0x60e1('0x7e')][_0x60e1('0x7f')]},function(_0x2b39c8){return db['WhatsappAccount'][_0x60e1('0x6e')]({'where':{'id':_0x2d1603},'transaction':_0x2b39c8})[_0x60e1('0x23')](function(_0x1a88dd){if(_0x1a88dd){return db[_0x60e1('0x80')][_0x60e1('0x39')]({'where':{'WhatsappAccountId':_0x2d1603},'transaction':_0x2b39c8})['then'](function(){var _0x1ccb60=_[_0x60e1('0x42')](_0x335605,function(_0x4319d1){_0x4319d1[_0x60e1('0x67')]=_0x2d1603;return _0x4319d1;});return db[_0x60e1('0x80')][_0x60e1('0x81')](_0x1ccb60,{'transaction':_0x2b39c8});});}else{_0x1d33d8=0x194;_0x5ecd1d=[];}});})[_0x60e1('0x23')](function(){if(_0x1d33d8!==0x194){return db[_0x60e1('0x80')][_0x60e1('0x82')]({'where':{'WhatsappAccountId':_0x2d1603},'order':'priority'})[_0x60e1('0x23')](function(_0x34ede8){_0x5ecd1d=_0x34ede8;});}})[_0x60e1('0x2c')](function(_0x5b5904){_0x1d33d8=0x1f4;logger[_0x60e1('0x26')](_0x5b5904['stack']);if(_0x5b5904[_0x60e1('0x3f')]){delete _0x5b5904[_0x60e1('0x3f')];}_0x5ecd1d=_0x5b5904;})[_0x60e1('0x83')](function(){if(_0x5ecd1d===null){_0x270e1a['sendStatus'](_0x1d33d8);}else{if(_0x1d33d8===0x1f4){_0x270e1a[_0x60e1('0x2e')](_0x1d33d8)['send'](_0x5ecd1d);}else{_0x270e1a[_0x60e1('0x2e')](_0x1d33d8)[_0x60e1('0x2f')](_0x5ecd1d);}}});};exports[_0x60e1('0x84')]=function(_0x4811cd,_0x922943,_0x4b5f66){var _0x14266c={};var _0x21c6d5={};var _0x930a24;var _0x57cf95;return db[_0x60e1('0x43')][_0x60e1('0x6e')]({'where':{'id':_0x4811cd[_0x60e1('0x65')]['id']}})[_0x60e1('0x23')](handleEntityNotFound(_0x922943,null))[_0x60e1('0x23')](function(_0x1b3174){if(_0x1b3174){_0x930a24=_0x1b3174;_0x21c6d5[_0x60e1('0x4c')]=_[_0x60e1('0x48')](db[_0x60e1('0x80')]['rawAttributes']);_0x21c6d5[_0x60e1('0x47')]=_[_0x60e1('0x48')](_0x4811cd[_0x60e1('0x47')]);_0x21c6d5[_0x60e1('0x49')]=_['intersection'](_0x21c6d5[_0x60e1('0x4c')],_0x21c6d5[_0x60e1('0x47')]);_0x14266c['attributes']=_[_0x60e1('0x4a')](_0x21c6d5['model'],qs[_0x60e1('0x4d')](_0x4811cd[_0x60e1('0x47')][_0x60e1('0x4d')]));_0x14266c['attributes']=_0x14266c[_0x60e1('0x4b')][_0x60e1('0x4e')]?_0x14266c[_0x60e1('0x4b')]:_0x21c6d5[_0x60e1('0x4c')];_0x14266c[_0x60e1('0x51')]=qs[_0x60e1('0x52')](_0x4811cd[_0x60e1('0x47')][_0x60e1('0x52')]);_0x14266c[_0x60e1('0x53')]=qs[_0x60e1('0x49')](_['pick'](_0x4811cd['query'],_0x21c6d5[_0x60e1('0x49')]));if(_0x4811cd[_0x60e1('0x47')][_0x60e1('0x55')]){_0x14266c[_0x60e1('0x53')]=_[_0x60e1('0x56')](_0x14266c[_0x60e1('0x53')],{'$or':_[_0x60e1('0x42')](_0x14266c[_0x60e1('0x4b')],function(_0x3f7c1d){var _0x3eefb6={};_0x3eefb6[_0x3f7c1d]={'$like':'%'+_0x4811cd[_0x60e1('0x47')][_0x60e1('0x55')]+'%'};return _0x3eefb6;})});}_0x14266c=_[_0x60e1('0x56')]({},_0x14266c,_0x4811cd[_0x60e1('0x57')]);return _0x930a24['getApplications'](_0x14266c);}})[_0x60e1('0x23')](function(_0x41be4a){if(_0x41be4a){_0x57cf95=_0x41be4a['length'];if(!_0x4811cd[_0x60e1('0x47')][_0x60e1('0x4f')](_0x60e1('0x50'))){_0x14266c[_0x60e1('0x32')]=qs[_0x60e1('0x32')](_0x4811cd[_0x60e1('0x47')][_0x60e1('0x32')]);_0x14266c[_0x60e1('0x30')]=qs[_0x60e1('0x30')](_0x4811cd[_0x60e1('0x47')]['offset']);}return _0x930a24[_0x60e1('0x84')](_0x14266c);}})[_0x60e1('0x23')](function(_0x3977b6){if(_0x3977b6){return _0x3977b6?{'count':_0x57cf95,'rows':_0x3977b6}:null;}})[_0x60e1('0x23')](respondWithResult(_0x922943,null))[_0x60e1('0x2c')](handleError(_0x922943,null));};exports['notify']=function(_0x738ca3,_0x39b762,_0x4dc514){var _0x38ef0c={'channel':'whatsapp'};var _0x5f3841=[];var _0x393b15=[];var _0x47fdc6={};return db['WhatsappAccount'][_0x60e1('0x5d')]({'where':{'id':_0x738ca3[_0x60e1('0x65')]['id']},'include':[{'model':db[_0x60e1('0x80')],'as':'Applications'}]})[_0x60e1('0x23')](handleEntityNotFound(_0x39b762,null))[_0x60e1('0x23')](function(_0x2f85e1){_0x38ef0c['account']=_0x2f85e1;if(_0x38ef0c['account']&&_0x38ef0c[_0x60e1('0x85')][_0x60e1('0x86')]===_0x60e1('0x87')&&_0x738ca3[_0x60e1('0x5f')]['statuses']){if(_0x738ca3[_0x60e1('0x5f')][_0x60e1('0x88')][_0x60e1('0x4e')]===0x0)return;if(_0x738ca3['body'][_0x60e1('0x88')][0x0]['state']!=='read')return;return db[_0x60e1('0x89')][_0x60e1('0x38')]({'read':!![],'readAt':_0x738ca3[_0x60e1('0x5f')][_0x60e1('0x88')][0x0]['timestamp']},{'where':{'messageId':_0x738ca3[_0x60e1('0x5f')][_0x60e1('0x88')][0x0][_0x60e1('0x8a')]},'individualHooks':!![]})[_0x60e1('0x23')](function(_0x4f46eb){return _0x39b762[_0x60e1('0x2e')](0xc8)[_0x60e1('0x2f')](_0x4f46eb);});}_0x38ef0c['applications']=_[_0x60e1('0x8b')](_0x2f85e1['Applications'],['priority'],[_0x60e1('0x8c')]);if(_0x38ef0c[_0x60e1('0x85')][_0x60e1('0x8d')]){delete _0x38ef0c[_0x60e1('0x85')][_0x60e1('0x8d')];}return db[_0x60e1('0x8e')]['describe']()[_0x60e1('0x23')](function(_0x216d25){if(!_0x216d25){throw new db[(_0x60e1('0x8f'))]['ValidationError'](_0x60e1('0x90'));}_0x5f3841=_['difference'](_['keys'](_0x216d25),['createdAt',_0x60e1('0x91')]);_0x393b15=_[_0x60e1('0x92')](_['keys'](_0x216d25),['createdAt',_0x60e1('0x91'),_0x60e1('0x93'),_0x60e1('0x94')]);_0x38ef0c[_0x60e1('0x5f')]={'mapKey':_0x60e1('0x95')};if(_0x38ef0c['account']&&_0x38ef0c[_0x60e1('0x85')]['type']===_0x60e1('0x96')){_0x38ef0c['body'][_0x60e1('0x97')]=_0x738ca3[_0x60e1('0x5f')]['From']['replace'](_0x60e1('0x98'),'');_0x38ef0c[_0x60e1('0x5f')][_0x60e1('0x5f')]=_0x738ca3[_0x60e1('0x5f')][_0x60e1('0x99')];_0x38ef0c[_0x60e1('0x5f')]['messageId']=_0x738ca3['body'][_0x60e1('0x9a')];}if(_0x38ef0c[_0x60e1('0x85')]&&_0x38ef0c[_0x60e1('0x85')]['type']===_0x60e1('0x87')){_0x38ef0c[_0x60e1('0x5f')]['from']=_0x738ca3[_0x60e1('0x5f')][_0x60e1('0x9b')][0x0][_0x60e1('0x97')];_0x38ef0c['body'][_0x60e1('0x5f')]=_0x738ca3[_0x60e1('0x5f')][_0x60e1('0x9b')][0x0][_0x60e1('0x28')]['body'];_0x38ef0c[_0x60e1('0x5f')][_0x60e1('0x9c')]=_0x738ca3[_0x60e1('0x5f')][_0x60e1('0x9b')][0x0][_0x60e1('0x8a')];}if(_0x38ef0c[_0x60e1('0x5f')]['id']){delete _0x38ef0c[_0x60e1('0x5f')]['id'];}if(_[_0x60e1('0x9d')](_0x38ef0c[_0x60e1('0x5f')][_0x60e1('0x97')])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_[_0x60e1('0x9d')](_0x38ef0c[_0x60e1('0x5f')][_0x60e1('0x5f')])||_0x38ef0c[_0x60e1('0x5f')]['body']===''){throw new db['Sequelize'][(_0x60e1('0x9e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x60e1('0x9d')](_0x38ef0c[_0x60e1('0x5f')][_0x60e1('0x9f')])){throw new db[(_0x60e1('0x8f'))][(_0x60e1('0x9e'))](_0x60e1('0xa0')+_0x393b15);}if(!_['includes'](_0x393b15,_0x38ef0c['body'][_0x60e1('0x9f')])){throw new db[(_0x60e1('0x8f'))][(_0x60e1('0x9e'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x393b15);}_0x47fdc6[_0x38ef0c['body'][_0x60e1('0x9f')]]=_0x38ef0c[_0x60e1('0x5f')][_0x60e1('0x97')];return db[_0x60e1('0xa1')][_0x60e1('0x5d')]({'where':{'id':_0x38ef0c[_0x60e1('0x85')][_0x60e1('0x94')]},'include':[{'model':db[_0x60e1('0x8e')],'as':_0x60e1('0xa2'),'where':_0x47fdc6,'limit':0x1,'order':[[_0x60e1('0x91'),'DESC']]}]});})[_0x60e1('0x23')](handleEntityNotFound(_0x39b762,null))[_0x60e1('0x23')](function(_0x4ef1a7){if(_0x4ef1a7){_0x38ef0c['list']=_[_0x60e1('0xa3')](_0x4ef1a7,[_0x60e1('0xa2')]);if(_0x4ef1a7[_0x60e1('0xa2')][_0x60e1('0x4e')]){return _0x4ef1a7[_0x60e1('0xa2')][0x0];}var _0xd79461=_[_0x60e1('0xa4')](_0x38ef0c[_0x60e1('0x5f')],{'firstName':_0x38ef0c['body']['from'],'ListId':_0x4ef1a7['id']});_0xd79461[_0x38ef0c['body'][_0x60e1('0x9f')]]=_0x38ef0c[_0x60e1('0x5f')]['from'];return db['CmContact'][_0x60e1('0x5e')](_0xd79461,{'fields':_0x5f3841,'raw':!![]});}})['then'](handleEntityNotFound(_0x39b762,null))[_0x60e1('0x23')](function(_0x28fd08){if(_0x28fd08){_0x38ef0c[_0x60e1('0xa5')]=_0x28fd08;var _0x50e4f5={'ContactId':_0x28fd08['id'],'phone':_0x38ef0c[_0x60e1('0x5f')][_0x60e1('0x97')],'WhatsappAccountId':_0x738ca3[_0x60e1('0x65')]['id']};var _0xf4a156={'ContactId':_0x28fd08['id'],'WhatsappAccountId':_0x738ca3[_0x60e1('0x65')]['id'],'closed':![]};return db[_0x60e1('0xa6')][_0x60e1('0x5d')]({'where':_0xf4a156})['then'](function(_0x453162){if(_0x453162){return[_0x453162,![]];}return db[_0x60e1('0xa6')][_0x60e1('0x5e')](_0x50e4f5)[_0x60e1('0x23')](function(_0x50551d){return[_0x50551d,!![]];});});}})[_0x60e1('0x73')](function(_0x2c7d6b,_0x394d34){_0x38ef0c[_0x60e1('0xa7')]=_0x2c7d6b[_0x60e1('0x3a')]({'plain':!![]});_0x38ef0c['interaction']['created']=![];if(_0x394d34){if(_0x38ef0c['account'][_0x60e1('0xa8')]){_0x38ef0c[_0x60e1('0xa9')][_0x60e1('0xaa')]({'id':0x0,'priority':_0x38ef0c[_0x60e1('0xa9')][_0x60e1('0x4e')]+0x1,'app':'close','appdata':_0x60e1('0xab'),'interval':'*,*,*,*'});}_0x38ef0c[_0x60e1('0xa7')][_0x60e1('0xac')]=!![];}return db['WhatsappMessage'][_0x60e1('0x5e')]({'phone':_0x38ef0c['body'][_0x60e1('0x97')],'messageId':_0x38ef0c[_0x60e1('0x5f')]['messageId'],'body':_0x38ef0c['body'][_0x60e1('0x5f')],'WhatsappAccountId':_0x738ca3[_0x60e1('0x65')]['id'],'WhatsappInteractionId':_0x2c7d6b['id'],'direction':'in','ContactId':_0x2c7d6b['ContactId'],'AttachmentId':_0x38ef0c[_0x60e1('0x5f')][_0x60e1('0xad')]});})[_0x60e1('0x23')](function(_0x2bc8d6){_0x38ef0c[_0x60e1('0x28')]=_0x2bc8d6;if(!_0x38ef0c[_0x60e1('0xa7')][_0x60e1('0xae')])return;return db['User'][_0x60e1('0x5d')]({'attributes':['id',_0x60e1('0x3f')],'where':{'id':_0x38ef0c[_0x60e1('0xa7')][_0x60e1('0xae')]}});})[_0x60e1('0x23')](function(_0x149d07){if(_0x149d07){_0x38ef0c[_0x60e1('0xa9')][_0x60e1('0xaf')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x149d07[_0x60e1('0x3f')]+','+(_0x38ef0c['account'][_0x60e1('0xb0')]||0xa),'interval':_0x60e1('0xb1')});}if(!_0x38ef0c['interaction'][_0x60e1('0xb2')])return;return db[_0x60e1('0xb3')]['find']({'attributes':['id','name'],'where':{'id':_0x38ef0c[_0x60e1('0xa7')][_0x60e1('0xb2')]}});})[_0x60e1('0x23')](function(_0x4568d0){if(_0x4568d0){_0x38ef0c[_0x60e1('0xa9')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4568d0[_0x60e1('0x3f')]+','+(_0x38ef0c['account'][_0x60e1('0xb4')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x60e1('0xb5'),_0x38ef0c);})[_0x60e1('0x23')](function(_0x2cfb05){if(_0x2cfb05){var _0x3b96e2=0xc8;var _0x52dc22=_0x60e1('0xb6');logger[_0x60e1('0x29')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x52dc22,_0x3b96e2,_0x60e1('0xb7'));logger[_0x60e1('0xb8')](_0x60e1('0xb9'),_0x52dc22,_0x3b96e2,_0x60e1('0xb7'),JSON['stringify'](_0x2cfb05));if(_0x38ef0c[_0x60e1('0x85')][_0x60e1('0x86')]==='twilio'){return _0x39b762[_0x60e1('0x2e')](_0x3b96e2)[_0x60e1('0x34')]('Content-Type','text/xml')['send'](_0x60e1('0xba'));}else{return _0x39b762[_0x60e1('0x2e')](_0x3b96e2)['json'](_0x2cfb05);}}});})[_0x60e1('0x2c')](handleError(_0x39b762,null));};exports[_0x60e1('0x40')]=function(_0x2e9f46,_0x140323,_0x287b77){var _0x389fba,_0x6a5dcd,_0x43315c;if(_['isNil'](_0x2e9f46[_0x60e1('0x5f')][_0x60e1('0x5f')])||_0x2e9f46[_0x60e1('0x5f')]['body']===''){throw new db[(_0x60e1('0x8f'))][(_0x60e1('0x9e'))](_0x60e1('0xbb'));}if(_[_0x60e1('0x9d')](_0x2e9f46[_0x60e1('0x5f')]['to'])){throw new db[(_0x60e1('0x8f'))][(_0x60e1('0x9e'))](_0x60e1('0xbc'));}_0x389fba=_0x2e9f46['body']['to'];return db[_0x60e1('0x43')][_0x60e1('0x5d')]({'where':{'id':_0x2e9f46['params']['id']},'include':[{'model':db['CmList'],'as':_0x60e1('0xbd'),'include':[{'model':db[_0x60e1('0x8e')],'as':_0x60e1('0xa2'),'where':{'mobile':_0x389fba},'limit':0x1,'order':[[_0x60e1('0x91'),_0x60e1('0xbe')]]}]}]})['then'](handleEntityNotFound(_0x140323,null))[_0x60e1('0x23')](function(_0x423b89){if(_0x423b89&&_0x423b89['List']){_0x6a5dcd=_0x423b89[_0x60e1('0x3a')]({'plain':!![]});if(_0x6a5dcd[_0x60e1('0xbd')]&&_0x6a5dcd[_0x60e1('0xbd')][_0x60e1('0xa2')][_0x60e1('0x4e')]){return _0x6a5dcd['List']['Contacts'][0x0];}return db[_0x60e1('0x8e')][_0x60e1('0x5e')](_[_0x60e1('0xa4')](_0x2e9f46[_0x60e1('0x5f')],{'firstName':_0x389fba,'mobile':_0x389fba,'phone':_0x389fba,'ListId':_0x6a5dcd[_0x60e1('0x94')]}));}})[_0x60e1('0x23')](handleEntityNotFound(_0x140323,null))[_0x60e1('0x23')](function(_0x39ff42){if(_0x39ff42){_0x43315c=_0x39ff42;return db[_0x60e1('0xa6')][_0x60e1('0x5d')]({'where':{'ContactId':_0x43315c['id'],'closed':![],'WhatsappAccountId':_0x6a5dcd['id']}})[_0x60e1('0x23')](function(_0x188813){if(_0x188813){return[_0x188813,![]];}return db[_0x60e1('0xa6')][_0x60e1('0x5e')]({'UserId':_0x2e9f46[_0x60e1('0x61')]['id'],'ContactId':_0x43315c['id'],'WhatsappAccountId':_0x6a5dcd['id'],'phone':_0x389fba,'firstMsgDirection':_0x60e1('0xbf'),'Messages':[_[_0x60e1('0x56')](_0x2e9f46['body'],{'read':![],'body':_0x2e9f46[_0x60e1('0x5f')][_0x60e1('0x5f')],'phone':_0x389fba,'WhatsappAccountId':_0x6a5dcd['id'],'UserId':_0x2e9f46['user']['id'],'ContactId':_0x43315c['id']})]},{'include':[{'model':db[_0x60e1('0x89')],'as':'Messages'}]})['then'](function(_0xdebaea){return[_0xdebaea,!![]];});});}})[_0x60e1('0x73')](function(_0x289779,_0x50d087){if(_0x50d087){return _0x289779;}return db['WhatsappMessage'][_0x60e1('0x5e')](_[_0x60e1('0x56')](_0x2e9f46['body'],{'read':![],'body':_0x2e9f46[_0x60e1('0x5f')][_0x60e1('0x5f')],'phone':_0x389fba,'WhatsappAccountId':_0x6a5dcd['id'],'WhatsappInteractionId':_0x289779['id'],'UserId':_0x2e9f46[_0x60e1('0x61')]['id'],'ContactId':_0x43315c['id']}))['then'](function(_0x764b20){_0x289779[_0x60e1('0xc0')][_0x60e1('0xc1')]=[];_0x289779[_0x60e1('0xc0')][_0x60e1('0xc1')][_0x60e1('0xaa')](_0x764b20[_0x60e1('0xc0')]);return _0x289779;});})[_0x60e1('0x23')](respondWithResult(_0x140323,null))['catch'](handleError(_0x140323,null));}; \ No newline at end of file +var _0x6fba=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','get','WhatsappAccounts','UserProfileResource','name','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','order','sort','filter','where','merge','VIRTUAL','options','WhatsappAccount','includeAll','include','findAll','rows','show','params','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition','Disposition','hasOwnProperty','nolimit','pick','WhatsappAccountId','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','spread','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','findOne','User','addApplications','sequelize','Transaction','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','stack','finally','send','getApplications','whatsapp','Applications','account','sinch','statuses','state','read','timestamp','message_id','applications','orderBy','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','replace','whatsapp:','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','omit','contact','WhatsappInteraction','interaction','created','autoclose','push','close','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','queueId','waitForTheAssignedQueue','startRouting','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','DESC','Messages','WhatsappMessage','dataValues','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','sendStatus','status','end'];(function(_0x12c4c6,_0x33ffa4){var _0x4c4c51=function(_0x4b2890){while(--_0x4b2890){_0x12c4c6['push'](_0x12c4c6['shift']());}};_0x4c4c51(++_0x33ffa4);}(_0x6fba,0x97));var _0xa6fb=function(_0x24b59e,_0x40f716){_0x24b59e=_0x24b59e-0x0;var _0x19dfc0=_0x6fba[_0x24b59e];return _0x19dfc0;};'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('request-promise');var moment=require(_0xa6fb('0x0'));var BPromise=require(_0xa6fb('0x1'));var Mustache=require(_0xa6fb('0x2'));var util=require(_0xa6fb('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0xa6fb('0x4'));var ejs=require(_0xa6fb('0x5'));var fs=require('fs');var fs_extra=require(_0xa6fb('0x6'));var _=require(_0xa6fb('0x7'));var squel=require(_0xa6fb('0x8'));var crypto=require(_0xa6fb('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xa6fb('0xa'));var toCsv=require(_0xa6fb('0x4'));var querystring=require(_0xa6fb('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa6fb('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xa6fb('0xd'));var hardwareService=require(_0xa6fb('0xe'));var logger=require(_0xa6fb('0xf'))(_0xa6fb('0x10'));var utils=require(_0xa6fb('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xa6fb('0x12'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xa6fb('0x13')](config[_0xa6fb('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0xa6fb('0x15'))(new Redis(config[_0xa6fb('0x14')]));require(_0xa6fb('0x16'))[_0xa6fb('0x17')](socket);var jayson=require(_0xa6fb('0x18'));var client=jayson[_0xa6fb('0x19')]['http']({'port':0x232c});function respondWithRpcPromise(_0x3228c6,_0x40bd8e,_0x3e7208,_0x26a6d1){return new BPromise(function(_0x38c946,_0x211d31){var _0x357405=_0x26a6d1||client;return _0x357405[_0xa6fb('0x1a')](_0x3228c6,_0x3e7208)[_0xa6fb('0x1b')](function(_0x5de719){logger['info'](_0xa6fb('0x1c'),_0x40bd8e,_0xa6fb('0x1d'));logger[_0xa6fb('0x1e')](_0xa6fb('0x1f'),_0x40bd8e,_0xa6fb('0x1d'),JSON['stringify'](_0x5de719));if(_0x5de719[_0xa6fb('0x20')]){if(_0x5de719[_0xa6fb('0x20')][_0xa6fb('0x21')]===0x1f4){logger[_0xa6fb('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x40bd8e,_0x5de719[_0xa6fb('0x20')][_0xa6fb('0x22')]);return _0x211d31(_0x5de719[_0xa6fb('0x20')][_0xa6fb('0x22')]);}logger['error'](_0xa6fb('0x1c'),_0x40bd8e,_0x5de719[_0xa6fb('0x20')][_0xa6fb('0x22')]);return _0x38c946(_0x5de719['error'][_0xa6fb('0x22')]);}else{logger[_0xa6fb('0x23')](_0xa6fb('0x1c'),_0x40bd8e,'request\x20sent');_0x38c946(_0x5de719['result']['message']);}})[_0xa6fb('0x24')](function(_0x5058c3){logger['error'](_0xa6fb('0x1c'),_0x40bd8e,_0x5058c3);_0x211d31(_0x5058c3);});});}function respondWithStatusCode(_0x35aef6,_0x5bbb08){_0x5bbb08=_0x5bbb08||0xcc;return function(_0x422801){if(_0x422801){return _0x35aef6[_0xa6fb('0x25')](_0x5bbb08);}return _0x35aef6[_0xa6fb('0x26')](_0x5bbb08)[_0xa6fb('0x27')]();};}function respondWithResult(_0x5ca2d1,_0x272e01){_0x272e01=_0x272e01||0xc8;return function(_0x1c6455){if(_0x1c6455){return _0x5ca2d1[_0xa6fb('0x26')](_0x272e01)[_0xa6fb('0x28')](_0x1c6455);}};}function respondWithFilteredResult(_0x3a5967,_0x594eff){return function(_0x209aef){if(_0x209aef){var _0x4f178e=typeof _0x594eff[_0xa6fb('0x29')]===_0xa6fb('0x2a')&&typeof _0x594eff[_0xa6fb('0x2b')]===_0xa6fb('0x2a');var _0x2198d6=_0x209aef['count'];var _0x57b270=_0x4f178e?0x0:_0x594eff[_0xa6fb('0x29')];var _0x185e09=_0x4f178e?_0x209aef[_0xa6fb('0x2c')]:_0x594eff['offset']+_0x594eff[_0xa6fb('0x2b')];var _0x59f5d5;if(_0x185e09>=_0x2198d6){_0x185e09=_0x2198d6;_0x59f5d5=0xc8;}else{_0x59f5d5=0xce;}_0x3a5967[_0xa6fb('0x26')](_0x59f5d5);return _0x3a5967[_0xa6fb('0x2d')](_0xa6fb('0x2e'),_0x57b270+'-'+_0x185e09+'/'+_0x2198d6)['json'](_0x209aef);}return null;};}function patchUpdates(_0x58d244){return function(_0x347ee5){try{jsonpatch[_0xa6fb('0x2f')](_0x347ee5,_0x58d244,!![]);}catch(_0x5b7e52){return BPromise[_0xa6fb('0x30')](_0x5b7e52);}return _0x347ee5['save']();};}function saveUpdates(_0x37a7a9,_0x339921){return function(_0x111c81){if(_0x111c81){return _0x111c81[_0xa6fb('0x31')](_0x37a7a9)['then'](function(_0x4b0d45){return _0x4b0d45;});}return null;};}function removeEntity(_0x13fa02,_0x4a58da){return function(_0x256809){if(_0x256809){return _0x256809[_0xa6fb('0x32')]()[_0xa6fb('0x1b')](function(){var _0x1af32c=_0x256809[_0xa6fb('0x33')]({'plain':!![]});var _0x4bf3b8=_0xa6fb('0x34');return db[_0xa6fb('0x35')][_0xa6fb('0x32')]({'where':{'type':_0x4bf3b8,'resourceId':_0x1af32c['id']}})[_0xa6fb('0x1b')](function(){return _0x256809;});})[_0xa6fb('0x1b')](function(){_0x13fa02[_0xa6fb('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e9fbe,_0xda7bf3){return function(_0x5b9637){if(!_0x5b9637){_0x5e9fbe['sendStatus'](0x194);}return _0x5b9637;};}function handleError(_0xbd7618,_0xaf5622){_0xaf5622=_0xaf5622||0x1f4;return function(_0x19fff1){logger[_0xa6fb('0x20')](_0x19fff1['stack']);if(_0x19fff1[_0xa6fb('0x36')]){delete _0x19fff1[_0xa6fb('0x36')];}_0xbd7618['status'](_0xaf5622)['send'](_0x19fff1);};}exports['index']=function(_0x16473f,_0x25efe4){var _0x254e39={'include':[{'model':db[_0xa6fb('0x37')],'as':_0xa6fb('0x38')}]},_0x23198d={},_0x16336b={'count':0x0,'rows':[]};var _0x1dee0e=_[_0xa6fb('0x39')](db['WhatsappAccount'][_0xa6fb('0x3a')],function(_0x5aea51){return{'name':_0x5aea51[_0xa6fb('0x3b')],'type':_0x5aea51[_0xa6fb('0x3c')][_0xa6fb('0x3d')]};});_0x23198d[_0xa6fb('0x3e')]=_[_0xa6fb('0x39')](_0x1dee0e,'name');_0x23198d[_0xa6fb('0x3f')]=_[_0xa6fb('0x40')](_0x16473f[_0xa6fb('0x3f')]);_0x23198d[_0xa6fb('0x41')]=_[_0xa6fb('0x42')](_0x23198d['model'],_0x23198d[_0xa6fb('0x3f')]);_0x254e39['attributes']=_[_0xa6fb('0x42')](_0x23198d[_0xa6fb('0x3e')],qs[_0xa6fb('0x43')](_0x16473f[_0xa6fb('0x3f')][_0xa6fb('0x43')]));_0x254e39['attributes']=_0x254e39[_0xa6fb('0x44')]['length']?_0x254e39[_0xa6fb('0x44')]:_0x23198d['model'];if(!_0x16473f[_0xa6fb('0x3f')]['hasOwnProperty']('nolimit')){_0x254e39['limit']=qs[_0xa6fb('0x2b')](_0x16473f['query']['limit']);_0x254e39[_0xa6fb('0x29')]=qs['offset'](_0x16473f[_0xa6fb('0x3f')][_0xa6fb('0x29')]);}_0x254e39[_0xa6fb('0x45')]=qs[_0xa6fb('0x46')](_0x16473f['query'][_0xa6fb('0x46')]);_0x254e39['where']=qs['filters'](_['pick'](_0x16473f[_0xa6fb('0x3f')],_0x23198d[_0xa6fb('0x41')]),_0x1dee0e);if(_0x16473f[_0xa6fb('0x3f')][_0xa6fb('0x47')]){_0x254e39[_0xa6fb('0x48')]=_[_0xa6fb('0x49')](_0x254e39[_0xa6fb('0x48')],{'$or':_['map'](_0x1dee0e,function(_0x3d95aa){if(_0x3d95aa[_0xa6fb('0x3c')]!==_0xa6fb('0x4a')){var _0x152115={};_0x152115[_0x3d95aa['name']]={'$like':'%'+_0x16473f[_0xa6fb('0x3f')][_0xa6fb('0x47')]+'%'};return _0x152115;}})});}_0x254e39=_[_0xa6fb('0x49')]({},_0x254e39,_0x16473f[_0xa6fb('0x4b')]);var _0x54f746={'where':_0x254e39[_0xa6fb('0x48')]};return db[_0xa6fb('0x4c')][_0xa6fb('0x2c')](_0x54f746)['then'](function(_0x2a4e3b){_0x16336b[_0xa6fb('0x2c')]=_0x2a4e3b;if(_0x16473f['query'][_0xa6fb('0x4d')]){_0x254e39[_0xa6fb('0x4e')]=[{'all':!![]}];}return db[_0xa6fb('0x4c')][_0xa6fb('0x4f')](_0x254e39);})[_0xa6fb('0x1b')](function(_0x21ce06){_0x16336b[_0xa6fb('0x50')]=_0x21ce06;return _0x16336b;})[_0xa6fb('0x1b')](respondWithFilteredResult(_0x25efe4,_0x254e39))[_0xa6fb('0x24')](handleError(_0x25efe4,null));};exports[_0xa6fb('0x51')]=function(_0x4d83d0,_0xbd632f){var _0x5ee37d={'raw':![],'where':{'id':_0x4d83d0[_0xa6fb('0x52')]['id']},'include':[{'model':db[_0xa6fb('0x37')],'as':_0xa6fb('0x38')}]},_0x803f16={};_0x803f16[_0xa6fb('0x3e')]=_[_0xa6fb('0x40')](db['WhatsappAccount']['rawAttributes']);_0x803f16['query']=_[_0xa6fb('0x40')](_0x4d83d0['query']);_0x803f16[_0xa6fb('0x41')]=_[_0xa6fb('0x42')](_0x803f16[_0xa6fb('0x3e')],_0x803f16[_0xa6fb('0x3f')]);_0x5ee37d[_0xa6fb('0x44')]=_['intersection'](_0x803f16['model'],qs['fields'](_0x4d83d0[_0xa6fb('0x3f')]['fields']));_0x5ee37d['attributes']=_0x5ee37d[_0xa6fb('0x44')][_0xa6fb('0x53')]?_0x5ee37d[_0xa6fb('0x44')]:_0x803f16['model'];if(_0x4d83d0[_0xa6fb('0x3f')][_0xa6fb('0x4d')]){_0x5ee37d[_0xa6fb('0x4e')]=[{'all':!![]}];}_0x5ee37d=_['merge']({},_0x5ee37d,_0x4d83d0[_0xa6fb('0x4b')]);return db[_0xa6fb('0x4c')]['find'](_0x5ee37d)[_0xa6fb('0x1b')](handleEntityNotFound(_0xbd632f,null))[_0xa6fb('0x1b')](respondWithResult(_0xbd632f,null))[_0xa6fb('0x24')](handleError(_0xbd632f,null));};exports[_0xa6fb('0x54')]=function(_0x46b06c,_0x4cf456){return db[_0xa6fb('0x4c')][_0xa6fb('0x54')](_0x46b06c[_0xa6fb('0x55')],{})[_0xa6fb('0x1b')](function(_0x37f55c){var _0x43b407=_0x46b06c['user']['get']({'plain':!![]});if(!_0x43b407)throw new Error(_0xa6fb('0x56'));if(_0x43b407['role']===_0xa6fb('0x57')){var _0x5667fd=_0x37f55c[_0xa6fb('0x33')]({'plain':!![]});var _0x2e8a41=_0xa6fb('0x34');return db[_0xa6fb('0x58')]['find']({'where':{'name':_0x2e8a41,'userProfileId':_0x43b407[_0xa6fb('0x59')]},'raw':!![]})[_0xa6fb('0x1b')](function(_0xabb923){if(_0xabb923&&_0xabb923[_0xa6fb('0x5a')]===0x0){return db[_0xa6fb('0x35')][_0xa6fb('0x54')]({'name':_0x5667fd[_0xa6fb('0x36')],'resourceId':_0x5667fd['id'],'type':_0xabb923[_0xa6fb('0x36')],'sectionId':_0xabb923['id']},{})[_0xa6fb('0x1b')](function(){return _0x37f55c;});}else{return _0x37f55c;}})[_0xa6fb('0x24')](function(_0x1f87da){logger[_0xa6fb('0x20')](_0xa6fb('0x5b'),_0x1f87da);throw _0x1f87da;});}return _0x37f55c;})['then'](respondWithResult(_0x4cf456,0xc9))[_0xa6fb('0x24')](handleError(_0x4cf456,null));};exports[_0xa6fb('0x31')]=function(_0x368726,_0x2eb05c){if(_0x368726[_0xa6fb('0x55')]['id']){delete _0x368726['body']['id'];}return db['WhatsappAccount'][_0xa6fb('0x5c')]({'where':{'id':_0x368726[_0xa6fb('0x52')]['id']},'include':[{'model':db['Pause'],'as':_0xa6fb('0x38')}]})['then'](handleEntityNotFound(_0x2eb05c,null))[_0xa6fb('0x1b')](saveUpdates(_0x368726['body'],null))[_0xa6fb('0x1b')](respondWithResult(_0x2eb05c,null))[_0xa6fb('0x24')](handleError(_0x2eb05c,null));};exports[_0xa6fb('0x32')]=function(_0x498a6d,_0x4b97bc){return db['WhatsappAccount'][_0xa6fb('0x5c')]({'where':{'id':_0x498a6d[_0xa6fb('0x52')]['id']}})[_0xa6fb('0x1b')](handleEntityNotFound(_0x4b97bc,null))[_0xa6fb('0x1b')](removeEntity(_0x4b97bc,null))[_0xa6fb('0x24')](handleError(_0x4b97bc,null));};exports['describe']=function(_0x5161a2,_0x32922a){return db[_0xa6fb('0x4c')][_0xa6fb('0x5d')]()[_0xa6fb('0x1b')](respondWithResult(_0x32922a,null))[_0xa6fb('0x24')](handleError(_0x32922a,null));};exports[_0xa6fb('0x5e')]=function(_0x278d8f,_0x5453ff,_0x5aecfd){if(_0x278d8f['body']['id']){delete _0x278d8f[_0xa6fb('0x55')]['id'];}return db['WhatsappAccount'][_0xa6fb('0x5c')]({'where':{'id':_0x278d8f[_0xa6fb('0x52')]['id']}})[_0xa6fb('0x1b')](handleEntityNotFound(_0x5453ff,null))['then'](function(_0x171092){if(_0x171092){_0x278d8f[_0xa6fb('0x55')]['WhatsappAccountId']=_0x171092['id'];return db[_0xa6fb('0x5f')]['create'](_0x278d8f[_0xa6fb('0x55')]);}})['then'](respondWithResult(_0x5453ff,null))[_0xa6fb('0x24')](handleError(_0x5453ff,null));};exports['getDispositions']=function(_0xab74b8,_0x56a075,_0x140465){var _0x29f491={'raw':![],'where':{}};var _0x2c2b19={};var _0xba717c={'count':0x0,'rows':[]};return db[_0xa6fb('0x4c')]['findOne']({'where':{'id':_0xab74b8[_0xa6fb('0x52')]['id']}})[_0xa6fb('0x1b')](handleEntityNotFound(_0x56a075,null))[_0xa6fb('0x1b')](function(_0x66d4d3){if(_0x66d4d3){_0x2c2b19[_0xa6fb('0x3e')]=_[_0xa6fb('0x40')](db[_0xa6fb('0x5f')]['rawAttributes']);_0x2c2b19['query']=_['keys'](_0xab74b8[_0xa6fb('0x3f')]);_0x2c2b19[_0xa6fb('0x41')]=_[_0xa6fb('0x42')](_0x2c2b19['model'],_0x2c2b19['query']);_0x29f491[_0xa6fb('0x44')]=_['intersection'](_0x2c2b19['model'],qs[_0xa6fb('0x43')](_0xab74b8[_0xa6fb('0x3f')][_0xa6fb('0x43')]));_0x29f491[_0xa6fb('0x44')]=_0x29f491[_0xa6fb('0x44')][_0xa6fb('0x53')]?_0x29f491[_0xa6fb('0x44')]:_0x2c2b19[_0xa6fb('0x3e')];if(!_0xab74b8[_0xa6fb('0x3f')][_0xa6fb('0x60')](_0xa6fb('0x61'))){_0x29f491[_0xa6fb('0x2b')]=qs['limit'](_0xab74b8[_0xa6fb('0x3f')]['limit']);_0x29f491[_0xa6fb('0x29')]=qs[_0xa6fb('0x29')](_0xab74b8[_0xa6fb('0x3f')][_0xa6fb('0x29')]);}_0x29f491[_0xa6fb('0x45')]=qs[_0xa6fb('0x46')](_0xab74b8['query'][_0xa6fb('0x46')]);_0x29f491[_0xa6fb('0x48')]=qs['filters'](_[_0xa6fb('0x62')](_0xab74b8['query'],_0x2c2b19[_0xa6fb('0x41')]));_0x29f491[_0xa6fb('0x48')][_0xa6fb('0x63')]=_0x66d4d3['id'];if(_0xab74b8['query'][_0xa6fb('0x47')]){_0x29f491['where']=_[_0xa6fb('0x49')](_0x29f491[_0xa6fb('0x48')],{'$or':_[_0xa6fb('0x39')](_0x29f491[_0xa6fb('0x44')],function(_0x4ddcff){var _0x29765d={};_0x29765d[_0x4ddcff]={'$like':'%'+_0xab74b8[_0xa6fb('0x3f')]['filter']+'%'};return _0x29765d;})});}_0x29f491=_[_0xa6fb('0x49')]({},_0x29f491,_0xab74b8[_0xa6fb('0x4b')]);return db[_0xa6fb('0x5f')][_0xa6fb('0x2c')]({'where':_0x29f491[_0xa6fb('0x48')]})[_0xa6fb('0x1b')](function(_0x444fce){_0xba717c[_0xa6fb('0x2c')]=_0x444fce;if(_0xab74b8[_0xa6fb('0x3f')][_0xa6fb('0x4d')]){_0x29f491[_0xa6fb('0x4e')]=[{'all':!![]}];}return db[_0xa6fb('0x5f')][_0xa6fb('0x4f')](_0x29f491);})[_0xa6fb('0x1b')](function(_0x4c95c3){_0xba717c['rows']=_0x4c95c3;return _0xba717c;});}})[_0xa6fb('0x1b')](respondWithFilteredResult(_0x56a075,_0x29f491))['catch'](handleError(_0x56a075,null));};exports['removeDispositions']=function(_0x19e399,_0x28abdd,_0x2cae06){return db[_0xa6fb('0x4c')][_0xa6fb('0x5c')]({'where':{'id':_0x19e399[_0xa6fb('0x52')]['id']}})[_0xa6fb('0x1b')](handleEntityNotFound(_0x28abdd,null))[_0xa6fb('0x1b')](function(_0x43d995){if(_0x43d995){return _0x43d995[_0xa6fb('0x64')](_0x19e399[_0xa6fb('0x3f')][_0xa6fb('0x65')]);}})[_0xa6fb('0x1b')](respondWithStatusCode(_0x28abdd,null))['catch'](handleError(_0x28abdd,null));};exports[_0xa6fb('0x66')]=function(_0x117a82,_0x2e20aa,_0x442fff){if(_0x117a82[_0xa6fb('0x55')]['id']){delete _0x117a82['body']['id'];}return db[_0xa6fb('0x4c')][_0xa6fb('0x5c')]({'where':{'id':_0x117a82[_0xa6fb('0x52')]['id']}})[_0xa6fb('0x1b')](handleEntityNotFound(_0x2e20aa,null))[_0xa6fb('0x1b')](function(_0x44fae9){if(_0x44fae9){_0x117a82[_0xa6fb('0x55')][_0xa6fb('0x63')]=_0x44fae9['id'];return db['CannedAnswer'][_0xa6fb('0x54')](_0x117a82['body']);}})[_0xa6fb('0x1b')](respondWithResult(_0x2e20aa,null))[_0xa6fb('0x24')](handleError(_0x2e20aa,null));};exports[_0xa6fb('0x67')]=function(_0x9cd1b0,_0x1b05eb,_0x4a82f1){var _0xbf33e7={'raw':![],'where':{}};var _0x371e61={};var _0x211d4b={'count':0x0,'rows':[]};return db[_0xa6fb('0x4c')]['findOne']({'where':{'id':_0x9cd1b0[_0xa6fb('0x52')]['id']}})[_0xa6fb('0x1b')](handleEntityNotFound(_0x1b05eb,null))['then'](function(_0x3f1a6f){if(_0x3f1a6f){_0x371e61[_0xa6fb('0x3e')]=_[_0xa6fb('0x40')](db[_0xa6fb('0x68')][_0xa6fb('0x3a')]);_0x371e61[_0xa6fb('0x3f')]=_[_0xa6fb('0x40')](_0x9cd1b0[_0xa6fb('0x3f')]);_0x371e61[_0xa6fb('0x41')]=_['intersection'](_0x371e61[_0xa6fb('0x3e')],_0x371e61[_0xa6fb('0x3f')]);_0xbf33e7[_0xa6fb('0x44')]=_[_0xa6fb('0x42')](_0x371e61['model'],qs['fields'](_0x9cd1b0[_0xa6fb('0x3f')][_0xa6fb('0x43')]));_0xbf33e7[_0xa6fb('0x44')]=_0xbf33e7['attributes']['length']?_0xbf33e7[_0xa6fb('0x44')]:_0x371e61[_0xa6fb('0x3e')];if(!_0x9cd1b0['query'][_0xa6fb('0x60')](_0xa6fb('0x61'))){_0xbf33e7[_0xa6fb('0x2b')]=qs['limit'](_0x9cd1b0[_0xa6fb('0x3f')][_0xa6fb('0x2b')]);_0xbf33e7[_0xa6fb('0x29')]=qs['offset'](_0x9cd1b0[_0xa6fb('0x3f')][_0xa6fb('0x29')]);}_0xbf33e7[_0xa6fb('0x45')]=qs['sort'](_0x9cd1b0[_0xa6fb('0x3f')]['sort']);_0xbf33e7[_0xa6fb('0x48')]=qs['filters'](_[_0xa6fb('0x62')](_0x9cd1b0[_0xa6fb('0x3f')],_0x371e61[_0xa6fb('0x41')]));_0xbf33e7['where'][_0xa6fb('0x63')]=_0x3f1a6f['id'];if(_0x9cd1b0[_0xa6fb('0x3f')][_0xa6fb('0x47')]){_0xbf33e7[_0xa6fb('0x48')]=_['merge'](_0xbf33e7[_0xa6fb('0x48')],{'$or':_[_0xa6fb('0x39')](_0xbf33e7[_0xa6fb('0x44')],function(_0x2987cd){var _0x3d27fe={};_0x3d27fe[_0x2987cd]={'$like':'%'+_0x9cd1b0[_0xa6fb('0x3f')][_0xa6fb('0x47')]+'%'};return _0x3d27fe;})});}_0xbf33e7=_[_0xa6fb('0x49')]({},_0xbf33e7,_0x9cd1b0[_0xa6fb('0x4b')]);return db[_0xa6fb('0x68')][_0xa6fb('0x2c')]({'where':_0xbf33e7[_0xa6fb('0x48')]})[_0xa6fb('0x1b')](function(_0x12f932){_0x211d4b[_0xa6fb('0x2c')]=_0x12f932;if(_0x9cd1b0[_0xa6fb('0x3f')][_0xa6fb('0x4d')]){_0xbf33e7[_0xa6fb('0x4e')]=[{'all':!![]}];}return db[_0xa6fb('0x68')][_0xa6fb('0x4f')](_0xbf33e7);})[_0xa6fb('0x1b')](function(_0xac9359){_0x211d4b['rows']=_0xac9359;return _0x211d4b;});}})[_0xa6fb('0x1b')](respondWithFilteredResult(_0x1b05eb,_0xbf33e7))[_0xa6fb('0x24')](handleError(_0x1b05eb,null));};exports[_0xa6fb('0x69')]=function(_0x1b1f96,_0x4f8e41,_0x11de7d){return db[_0xa6fb('0x4c')]['find']({'where':{'id':_0x1b1f96['params']['id']}})[_0xa6fb('0x1b')](handleEntityNotFound(_0x4f8e41,null))[_0xa6fb('0x1b')](function(_0x49466f){if(_0x49466f){return _0x49466f[_0xa6fb('0x69')](_0x1b1f96[_0xa6fb('0x3f')]['ids']);}})['then'](respondWithStatusCode(_0x4f8e41,null))[_0xa6fb('0x24')](handleError(_0x4f8e41,null));};exports['addAgents']=function(_0x2b4bc7,_0xef6a7a,_0x2c27d8){return db[_0xa6fb('0x4c')][_0xa6fb('0x5c')]({'where':{'id':_0x2b4bc7['params']['id']}})[_0xa6fb('0x1b')](handleEntityNotFound(_0xef6a7a,null))[_0xa6fb('0x1b')](function(_0x11a400){if(_0x11a400){return _0x11a400['addAgents'](_0x2b4bc7[_0xa6fb('0x55')][_0xa6fb('0x65')],_['omit'](_0x2b4bc7[_0xa6fb('0x55')],[_0xa6fb('0x65'),'id'])||{})[_0xa6fb('0x6a')](function(_0x2f2e95){for(var _0x2ff1b5=0x0;_0x2ff1b5<_0x2b4bc7[_0xa6fb('0x55')]['ids'][_0xa6fb('0x53')];_0x2ff1b5+=0x1){socket['emit'](_0xa6fb('0x6b'),{'UserId':Number(_0x2b4bc7[_0xa6fb('0x55')]['ids'][_0x2ff1b5]),'WhatsappAccountId':Number(_0x2b4bc7[_0xa6fb('0x52')]['id'])});}return _0x2f2e95;});}})[_0xa6fb('0x1b')](respondWithResult(_0xef6a7a,null))[_0xa6fb('0x24')](handleError(_0xef6a7a,null));};exports['removeAgents']=function(_0x10def8,_0x1609f0,_0xcf5098){return db['WhatsappAccount']['find']({'where':{'id':_0x10def8[_0xa6fb('0x52')]['id']}})[_0xa6fb('0x1b')](handleEntityNotFound(_0x1609f0,null))[_0xa6fb('0x1b')](function(_0x1fbfea){if(_0x1fbfea){return _0x1fbfea[_0xa6fb('0x6c')](_0x10def8[_0xa6fb('0x3f')][_0xa6fb('0x65')])['then'](function(){if(_[_0xa6fb('0x6d')](_0x10def8[_0xa6fb('0x3f')]['ids'])){for(var _0x2cc2d1=0x0;_0x2cc2d1<_0x10def8[_0xa6fb('0x3f')]['ids'][_0xa6fb('0x53')];_0x2cc2d1+=0x1){socket['emit'](_0xa6fb('0x6e'),{'UserId':Number(_0x10def8[_0xa6fb('0x3f')][_0xa6fb('0x65')][_0x2cc2d1]),'WhatsappAccountId':Number(_0x10def8[_0xa6fb('0x52')]['id'])});}}else{socket['emit'](_0xa6fb('0x6e'),{'UserId':Number(_0x10def8['query'][_0xa6fb('0x65')]),'WhatsappAccountId':Number(_0x10def8[_0xa6fb('0x52')]['id'])});}});}})[_0xa6fb('0x1b')](respondWithStatusCode(_0x1609f0,null))['catch'](handleError(_0x1609f0,null));};exports[_0xa6fb('0x6f')]=function(_0x5556e8,_0x280e25,_0x1db9ee){var _0x270a8b={};var _0x172305={};var _0xa4d9fa;var _0x363a87;return db[_0xa6fb('0x4c')][_0xa6fb('0x70')]({'where':{'id':_0x5556e8['params']['id']}})[_0xa6fb('0x1b')](handleEntityNotFound(_0x280e25,null))[_0xa6fb('0x1b')](function(_0x18a7db){if(_0x18a7db){_0xa4d9fa=_0x18a7db;_0x172305[_0xa6fb('0x3e')]=_[_0xa6fb('0x40')](db[_0xa6fb('0x71')][_0xa6fb('0x3a')]);_0x172305[_0xa6fb('0x3f')]=_[_0xa6fb('0x40')](_0x5556e8[_0xa6fb('0x3f')]);_0x172305[_0xa6fb('0x41')]=_['intersection'](_0x172305[_0xa6fb('0x3e')],_0x172305[_0xa6fb('0x3f')]);_0x270a8b[_0xa6fb('0x44')]=_['intersection'](_0x172305[_0xa6fb('0x3e')],qs[_0xa6fb('0x43')](_0x5556e8['query'][_0xa6fb('0x43')]));_0x270a8b['attributes']=_0x270a8b[_0xa6fb('0x44')][_0xa6fb('0x53')]?_0x270a8b[_0xa6fb('0x44')]:_0x172305[_0xa6fb('0x3e')];_0x270a8b[_0xa6fb('0x45')]=qs[_0xa6fb('0x46')](_0x5556e8['query'][_0xa6fb('0x46')]);_0x270a8b[_0xa6fb('0x48')]=qs['filters'](_['pick'](_0x5556e8[_0xa6fb('0x3f')],_0x172305[_0xa6fb('0x41')]));if(_0x5556e8[_0xa6fb('0x3f')][_0xa6fb('0x47')]){_0x270a8b['where']=_[_0xa6fb('0x49')](_0x270a8b[_0xa6fb('0x48')],{'$or':_[_0xa6fb('0x39')](_0x270a8b[_0xa6fb('0x44')],function(_0x2cd9b6){var _0x4454fb={};_0x4454fb[_0x2cd9b6]={'$like':'%'+_0x5556e8[_0xa6fb('0x3f')]['filter']+'%'};return _0x4454fb;})});}_0x270a8b=_[_0xa6fb('0x49')]({},_0x270a8b,_0x5556e8[_0xa6fb('0x4b')]);return _0xa4d9fa[_0xa6fb('0x6f')](_0x270a8b);}})[_0xa6fb('0x1b')](function(_0x433ba5){if(_0x433ba5){_0x363a87=_0x433ba5[_0xa6fb('0x53')];if(!_0x5556e8[_0xa6fb('0x3f')][_0xa6fb('0x60')]('nolimit')){_0x270a8b[_0xa6fb('0x2b')]=qs['limit'](_0x5556e8[_0xa6fb('0x3f')][_0xa6fb('0x2b')]);_0x270a8b['offset']=qs[_0xa6fb('0x29')](_0x5556e8['query'][_0xa6fb('0x29')]);}return _0xa4d9fa[_0xa6fb('0x6f')](_0x270a8b);}})[_0xa6fb('0x1b')](function(_0x5de55c){if(_0x5de55c){return _0x5de55c?{'count':_0x363a87,'rows':_0x5de55c}:null;}})['then'](respondWithResult(_0x280e25,null))[_0xa6fb('0x24')](handleError(_0x280e25,null));};exports[_0xa6fb('0x72')]=function(_0x20d5a0,_0x1e324e){var _0xeac468=_0x20d5a0['params']['id'];var _0xa4e70f=_0x20d5a0[_0xa6fb('0x55')];var _0x111df5=0xc8;var _0x666335=null;return db[_0xa6fb('0x73')]['transaction']({'isolationLevel':db[_0xa6fb('0x73')][_0xa6fb('0x74')]['ISOLATION_LEVELS'][_0xa6fb('0x75')]},function(_0x32ee25){return db[_0xa6fb('0x4c')][_0xa6fb('0x70')]({'where':{'id':_0xeac468},'transaction':_0x32ee25})[_0xa6fb('0x1b')](function(_0x50004b){if(_0x50004b){return db['WhatsappApplication']['destroy']({'where':{'WhatsappAccountId':_0xeac468},'transaction':_0x32ee25})['then'](function(){var _0x1e3d34=_[_0xa6fb('0x39')](_0xa4e70f,function(_0x376d64){_0x376d64[_0xa6fb('0x63')]=_0xeac468;return _0x376d64;});return db[_0xa6fb('0x76')][_0xa6fb('0x77')](_0x1e3d34,{'transaction':_0x32ee25});});}else{_0x111df5=0x194;_0x666335=[];}});})[_0xa6fb('0x1b')](function(){if(_0x111df5!==0x194){return db[_0xa6fb('0x76')][_0xa6fb('0x78')]({'where':{'WhatsappAccountId':_0xeac468},'order':_0xa6fb('0x79')})[_0xa6fb('0x1b')](function(_0x3e3507){_0x666335=_0x3e3507;});}})['catch'](function(_0x5cb4ae){_0x111df5=0x1f4;logger[_0xa6fb('0x20')](_0x5cb4ae[_0xa6fb('0x7a')]);if(_0x5cb4ae[_0xa6fb('0x36')]){delete _0x5cb4ae[_0xa6fb('0x36')];}_0x666335=_0x5cb4ae;})[_0xa6fb('0x7b')](function(){if(_0x666335===null){_0x1e324e[_0xa6fb('0x25')](_0x111df5);}else{if(_0x111df5===0x1f4){_0x1e324e[_0xa6fb('0x26')](_0x111df5)[_0xa6fb('0x7c')](_0x666335);}else{_0x1e324e[_0xa6fb('0x26')](_0x111df5)[_0xa6fb('0x28')](_0x666335);}}});};exports[_0xa6fb('0x7d')]=function(_0x34231b,_0x4a9ce8,_0xbd9da){var _0x5b8dd7={};var _0x33ac81={};var _0x5e45b3;var _0xba9ade;return db[_0xa6fb('0x4c')]['findOne']({'where':{'id':_0x34231b[_0xa6fb('0x52')]['id']}})[_0xa6fb('0x1b')](handleEntityNotFound(_0x4a9ce8,null))[_0xa6fb('0x1b')](function(_0x4a1fc2){if(_0x4a1fc2){_0x5e45b3=_0x4a1fc2;_0x33ac81['model']=_[_0xa6fb('0x40')](db[_0xa6fb('0x76')][_0xa6fb('0x3a')]);_0x33ac81[_0xa6fb('0x3f')]=_[_0xa6fb('0x40')](_0x34231b[_0xa6fb('0x3f')]);_0x33ac81[_0xa6fb('0x41')]=_[_0xa6fb('0x42')](_0x33ac81[_0xa6fb('0x3e')],_0x33ac81['query']);_0x5b8dd7[_0xa6fb('0x44')]=_['intersection'](_0x33ac81[_0xa6fb('0x3e')],qs[_0xa6fb('0x43')](_0x34231b[_0xa6fb('0x3f')][_0xa6fb('0x43')]));_0x5b8dd7[_0xa6fb('0x44')]=_0x5b8dd7[_0xa6fb('0x44')][_0xa6fb('0x53')]?_0x5b8dd7[_0xa6fb('0x44')]:_0x33ac81['model'];_0x5b8dd7[_0xa6fb('0x45')]=qs[_0xa6fb('0x46')](_0x34231b[_0xa6fb('0x3f')][_0xa6fb('0x46')]);_0x5b8dd7[_0xa6fb('0x48')]=qs[_0xa6fb('0x41')](_[_0xa6fb('0x62')](_0x34231b[_0xa6fb('0x3f')],_0x33ac81['filters']));if(_0x34231b[_0xa6fb('0x3f')]['filter']){_0x5b8dd7[_0xa6fb('0x48')]=_[_0xa6fb('0x49')](_0x5b8dd7['where'],{'$or':_[_0xa6fb('0x39')](_0x5b8dd7[_0xa6fb('0x44')],function(_0x114685){var _0x4c5f25={};_0x4c5f25[_0x114685]={'$like':'%'+_0x34231b[_0xa6fb('0x3f')][_0xa6fb('0x47')]+'%'};return _0x4c5f25;})});}_0x5b8dd7=_['merge']({},_0x5b8dd7,_0x34231b[_0xa6fb('0x4b')]);return _0x5e45b3[_0xa6fb('0x7d')](_0x5b8dd7);}})[_0xa6fb('0x1b')](function(_0x1db303){if(_0x1db303){_0xba9ade=_0x1db303[_0xa6fb('0x53')];if(!_0x34231b[_0xa6fb('0x3f')][_0xa6fb('0x60')](_0xa6fb('0x61'))){_0x5b8dd7['limit']=qs['limit'](_0x34231b[_0xa6fb('0x3f')]['limit']);_0x5b8dd7[_0xa6fb('0x29')]=qs[_0xa6fb('0x29')](_0x34231b[_0xa6fb('0x3f')]['offset']);}return _0x5e45b3[_0xa6fb('0x7d')](_0x5b8dd7);}})[_0xa6fb('0x1b')](function(_0x1b3d35){if(_0x1b3d35){return _0x1b3d35?{'count':_0xba9ade,'rows':_0x1b3d35}:null;}})[_0xa6fb('0x1b')](respondWithResult(_0x4a9ce8,null))[_0xa6fb('0x24')](handleError(_0x4a9ce8,null));};exports['notify']=function(_0x4d9b0e,_0xe3abd0,_0x5c2d54){var _0x122dbe={'channel':_0xa6fb('0x7e')};var _0x2d5546=[];var _0x22d4fe=[];var _0x4e9fae={};return db['WhatsappAccount'][_0xa6fb('0x5c')]({'where':{'id':_0x4d9b0e[_0xa6fb('0x52')]['id']},'include':[{'model':db[_0xa6fb('0x76')],'as':_0xa6fb('0x7f')}]})[_0xa6fb('0x1b')](handleEntityNotFound(_0xe3abd0,null))[_0xa6fb('0x1b')](function(_0x3dc83c){_0x122dbe['account']=_0x3dc83c;if(_0x122dbe[_0xa6fb('0x80')]&&_0x122dbe[_0xa6fb('0x80')][_0xa6fb('0x3c')]===_0xa6fb('0x81')&&_0x4d9b0e[_0xa6fb('0x55')][_0xa6fb('0x82')]){if(_0x4d9b0e[_0xa6fb('0x55')][_0xa6fb('0x82')][_0xa6fb('0x53')]===0x0)return;if(_0x4d9b0e[_0xa6fb('0x55')][_0xa6fb('0x82')][0x0][_0xa6fb('0x83')]!==_0xa6fb('0x84'))return;return db['WhatsappMessage'][_0xa6fb('0x31')]({'read':!![],'readAt':_0x4d9b0e[_0xa6fb('0x55')][_0xa6fb('0x82')][0x0][_0xa6fb('0x85')]},{'where':{'messageId':_0x4d9b0e[_0xa6fb('0x55')][_0xa6fb('0x82')][0x0][_0xa6fb('0x86')]},'individualHooks':!![]})[_0xa6fb('0x1b')](function(_0x522462){return _0xe3abd0[_0xa6fb('0x26')](0xc8)[_0xa6fb('0x28')](_0x522462);});}_0x122dbe[_0xa6fb('0x87')]=_[_0xa6fb('0x88')](_0x3dc83c[_0xa6fb('0x7f')],[_0xa6fb('0x79')],[_0xa6fb('0x89')]);if(_0x122dbe[_0xa6fb('0x80')][_0xa6fb('0x7f')]){delete _0x122dbe[_0xa6fb('0x80')]['Applications'];}return db['CmContact']['describe']()['then'](function(_0x1bd8ba){if(!_0x1bd8ba){throw new db[(_0xa6fb('0x8a'))][(_0xa6fb('0x8b'))](_0xa6fb('0x8c'));}_0x2d5546=_[_0xa6fb('0x8d')](_[_0xa6fb('0x40')](_0x1bd8ba),[_0xa6fb('0x8e'),'updatedAt']);_0x22d4fe=_[_0xa6fb('0x8d')](_['keys'](_0x1bd8ba),[_0xa6fb('0x8e'),_0xa6fb('0x8f'),_0xa6fb('0x90'),_0xa6fb('0x91')]);_0x122dbe['body']={'mapKey':_0xa6fb('0x92')};if(_0x122dbe[_0xa6fb('0x80')]&&_0x122dbe['account'][_0xa6fb('0x3c')]===_0xa6fb('0x93')){_0x122dbe[_0xa6fb('0x55')][_0xa6fb('0x94')]=_0x4d9b0e[_0xa6fb('0x55')]['From'][_0xa6fb('0x95')](_0xa6fb('0x96'),'');_0x122dbe[_0xa6fb('0x55')][_0xa6fb('0x55')]=_0x4d9b0e['body']['Body'];_0x122dbe[_0xa6fb('0x55')][_0xa6fb('0x97')]=_0x4d9b0e[_0xa6fb('0x55')][_0xa6fb('0x98')];}if(_0x122dbe['account']&&_0x122dbe[_0xa6fb('0x80')][_0xa6fb('0x3c')]==='sinch'){_0x122dbe[_0xa6fb('0x55')][_0xa6fb('0x94')]=_0x4d9b0e[_0xa6fb('0x55')]['notifications'][0x0][_0xa6fb('0x94')];_0x122dbe[_0xa6fb('0x55')][_0xa6fb('0x55')]=_0x4d9b0e[_0xa6fb('0x55')]['notifications'][0x0][_0xa6fb('0x22')][_0xa6fb('0x55')];_0x122dbe[_0xa6fb('0x55')][_0xa6fb('0x97')]=_0x4d9b0e[_0xa6fb('0x55')][_0xa6fb('0x99')][0x0][_0xa6fb('0x86')];}if(_0x122dbe['body']['id']){delete _0x122dbe[_0xa6fb('0x55')]['id'];}if(_[_0xa6fb('0x9a')](_0x122dbe[_0xa6fb('0x55')][_0xa6fb('0x94')])){throw new db[(_0xa6fb('0x8a'))][(_0xa6fb('0x8b'))](_0xa6fb('0x9b'));}if(_[_0xa6fb('0x9a')](_0x122dbe[_0xa6fb('0x55')]['body'])||_0x122dbe[_0xa6fb('0x55')][_0xa6fb('0x55')]===''){throw new db[(_0xa6fb('0x8a'))][(_0xa6fb('0x8b'))](_0xa6fb('0x9c'));}if(_['isNil'](_0x122dbe[_0xa6fb('0x55')][_0xa6fb('0x9d')])){throw new db['Sequelize'][(_0xa6fb('0x8b'))](_0xa6fb('0x9e')+_0x22d4fe);}if(!_['includes'](_0x22d4fe,_0x122dbe[_0xa6fb('0x55')][_0xa6fb('0x9d')])){throw new db[(_0xa6fb('0x8a'))][(_0xa6fb('0x8b'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x22d4fe);}_0x4e9fae[_0x122dbe['body'][_0xa6fb('0x9d')]]=_0x122dbe[_0xa6fb('0x55')][_0xa6fb('0x94')];return db[_0xa6fb('0x9f')][_0xa6fb('0x5c')]({'where':{'id':_0x122dbe[_0xa6fb('0x80')][_0xa6fb('0x91')]},'include':[{'model':db[_0xa6fb('0xa0')],'as':_0xa6fb('0xa1'),'where':_0x4e9fae,'limit':0x1,'order':[[_0xa6fb('0x8f'),'DESC']]}]});})[_0xa6fb('0x1b')](handleEntityNotFound(_0xe3abd0,null))[_0xa6fb('0x1b')](function(_0x30d08b){if(_0x30d08b){_0x122dbe['list']=_[_0xa6fb('0xa2')](_0x30d08b,[_0xa6fb('0xa1')]);if(_0x30d08b[_0xa6fb('0xa1')][_0xa6fb('0x53')]){return _0x30d08b['Contacts'][0x0];}var _0xdc7323=_[_0xa6fb('0x13')](_0x122dbe[_0xa6fb('0x55')],{'firstName':_0x122dbe['body'][_0xa6fb('0x94')],'ListId':_0x30d08b['id']});_0xdc7323[_0x122dbe[_0xa6fb('0x55')][_0xa6fb('0x9d')]]=_0x122dbe[_0xa6fb('0x55')][_0xa6fb('0x94')];return db[_0xa6fb('0xa0')][_0xa6fb('0x54')](_0xdc7323,{'fields':_0x2d5546,'raw':!![]});}})[_0xa6fb('0x1b')](handleEntityNotFound(_0xe3abd0,null))[_0xa6fb('0x1b')](function(_0xf50f8f){if(_0xf50f8f){_0x122dbe[_0xa6fb('0xa3')]=_0xf50f8f;var _0x4a2c6c={'ContactId':_0xf50f8f['id'],'phone':_0x122dbe[_0xa6fb('0x55')]['from'],'WhatsappAccountId':_0x4d9b0e[_0xa6fb('0x52')]['id']};var _0x3d3061={'ContactId':_0xf50f8f['id'],'WhatsappAccountId':_0x4d9b0e[_0xa6fb('0x52')]['id'],'closed':![]};return db[_0xa6fb('0xa4')][_0xa6fb('0x5c')]({'where':_0x3d3061})['then'](function(_0x2157c1){if(_0x2157c1){return[_0x2157c1,![]];}return db[_0xa6fb('0xa4')]['create'](_0x4a2c6c)['then'](function(_0x3ef3c3){return[_0x3ef3c3,!![]];});});}})['spread'](function(_0x12e648,_0x299659){_0x122dbe[_0xa6fb('0xa5')]=_0x12e648[_0xa6fb('0x33')]({'plain':!![]});_0x122dbe['interaction'][_0xa6fb('0xa6')]=![];if(_0x299659){if(_0x122dbe[_0xa6fb('0x80')][_0xa6fb('0xa7')]){_0x122dbe['applications'][_0xa6fb('0xa8')]({'id':0x0,'priority':_0x122dbe[_0xa6fb('0x87')][_0xa6fb('0x53')]+0x1,'app':_0xa6fb('0xa9'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x122dbe[_0xa6fb('0xa5')][_0xa6fb('0xa6')]=!![];}return db['WhatsappMessage'][_0xa6fb('0x54')]({'phone':_0x122dbe[_0xa6fb('0x55')][_0xa6fb('0x94')],'messageId':_0x122dbe[_0xa6fb('0x55')][_0xa6fb('0x97')],'body':_0x122dbe['body'][_0xa6fb('0x55')],'WhatsappAccountId':_0x4d9b0e[_0xa6fb('0x52')]['id'],'WhatsappInteractionId':_0x12e648['id'],'direction':'in','ContactId':_0x12e648[_0xa6fb('0xaa')],'AttachmentId':_0x122dbe['body'][_0xa6fb('0xab')]});})['then'](function(_0x5ce4ff){_0x122dbe[_0xa6fb('0x22')]=_0x5ce4ff;if(!_0x122dbe['interaction'][_0xa6fb('0xac')])return;return db[_0xa6fb('0x71')][_0xa6fb('0x5c')]({'attributes':['id',_0xa6fb('0x36')],'where':{'id':_0x122dbe[_0xa6fb('0xa5')][_0xa6fb('0xac')]}});})[_0xa6fb('0x1b')](function(_0x3acef0){if(_0x3acef0){_0x122dbe[_0xa6fb('0x87')][_0xa6fb('0xad')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3acef0[_0xa6fb('0x36')]+','+(_0x122dbe['account'][_0xa6fb('0xae')]||0xa),'interval':_0xa6fb('0xaf')});}if(!_0x122dbe[_0xa6fb('0xa5')][_0xa6fb('0xb0')])return;return db['WhatsappQueue']['find']({'attributes':['id',_0xa6fb('0x36')],'where':{'id':_0x122dbe[_0xa6fb('0xa5')]['queueId']}});})[_0xa6fb('0x1b')](function(_0x424224){if(_0x424224){_0x122dbe['applications']['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x424224[_0xa6fb('0x36')]+','+(_0x122dbe[_0xa6fb('0x80')][_0xa6fb('0xb1')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xa6fb('0xb2'),_0x122dbe);})['then'](function(_0x10f3cb){if(_0x10f3cb){var _0xaf61b1=0xc8;var _0x2030eb='receiveMessage';logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2030eb,_0xaf61b1,_0xa6fb('0xb3'));logger['debug'](_0xa6fb('0xb4'),_0x2030eb,_0xaf61b1,'entity\x20found',JSON[_0xa6fb('0xb5')](_0x10f3cb));if(_0x122dbe[_0xa6fb('0x80')][_0xa6fb('0x3c')]==='twilio'){return _0xe3abd0[_0xa6fb('0x26')](_0xaf61b1)[_0xa6fb('0x2d')](_0xa6fb('0xb6'),_0xa6fb('0xb7'))[_0xa6fb('0x7c')](_0xa6fb('0xb8'));}else{return _0xe3abd0[_0xa6fb('0x26')](_0xaf61b1)[_0xa6fb('0x28')](_0x10f3cb);}}});})[_0xa6fb('0x24')](handleError(_0xe3abd0,null));};exports[_0xa6fb('0x7c')]=function(_0x2aa55e,_0x4958ab,_0x5cbbb8){var _0x58362d,_0x256159,_0x28ffef;if(_['isNil'](_0x2aa55e[_0xa6fb('0x55')]['body'])||_0x2aa55e['body'][_0xa6fb('0x55')]===''){throw new db[(_0xa6fb('0x8a'))][(_0xa6fb('0x8b'))](_0xa6fb('0x9c'));}if(_[_0xa6fb('0x9a')](_0x2aa55e[_0xa6fb('0x55')]['to'])){throw new db['Sequelize']['ValidationError'](_0xa6fb('0xb9'));}_0x58362d=_0x2aa55e[_0xa6fb('0x55')]['to'];return db['WhatsappAccount'][_0xa6fb('0x5c')]({'where':{'id':_0x2aa55e[_0xa6fb('0x52')]['id']},'include':[{'model':db[_0xa6fb('0x9f')],'as':_0xa6fb('0xba'),'include':[{'model':db['CmContact'],'as':_0xa6fb('0xa1'),'where':{'mobile':_0x58362d},'limit':0x1,'order':[[_0xa6fb('0x8f'),_0xa6fb('0xbb')]]}]}]})[_0xa6fb('0x1b')](handleEntityNotFound(_0x4958ab,null))['then'](function(_0x4bdef0){if(_0x4bdef0&&_0x4bdef0[_0xa6fb('0xba')]){_0x256159=_0x4bdef0[_0xa6fb('0x33')]({'plain':!![]});if(_0x256159[_0xa6fb('0xba')]&&_0x256159[_0xa6fb('0xba')][_0xa6fb('0xa1')]['length']){return _0x256159[_0xa6fb('0xba')]['Contacts'][0x0];}return db['CmContact'][_0xa6fb('0x54')](_[_0xa6fb('0x13')](_0x2aa55e[_0xa6fb('0x55')],{'firstName':_0x58362d,'mobile':_0x58362d,'phone':_0x58362d,'ListId':_0x256159[_0xa6fb('0x91')]}));}})[_0xa6fb('0x1b')](handleEntityNotFound(_0x4958ab,null))[_0xa6fb('0x1b')](function(_0xf50711){if(_0xf50711){_0x28ffef=_0xf50711;return db[_0xa6fb('0xa4')][_0xa6fb('0x5c')]({'where':{'ContactId':_0x28ffef['id'],'closed':![],'WhatsappAccountId':_0x256159['id']}})[_0xa6fb('0x1b')](function(_0x1e7bc8){if(_0x1e7bc8){return[_0x1e7bc8,![]];}return db['WhatsappInteraction']['create']({'UserId':_0x2aa55e[_0xa6fb('0x57')]['id'],'ContactId':_0x28ffef['id'],'WhatsappAccountId':_0x256159['id'],'phone':_0x58362d,'firstMsgDirection':'out','Messages':[_[_0xa6fb('0x49')](_0x2aa55e['body'],{'read':![],'body':_0x2aa55e[_0xa6fb('0x55')]['body'],'phone':_0x58362d,'WhatsappAccountId':_0x256159['id'],'UserId':_0x2aa55e['user']['id'],'ContactId':_0x28ffef['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0xa6fb('0xbc')}]})[_0xa6fb('0x1b')](function(_0x454b39){return[_0x454b39,!![]];});});}})['spread'](function(_0x11c985,_0x18911d){if(_0x18911d){return _0x11c985;}return db[_0xa6fb('0xbd')][_0xa6fb('0x54')](_[_0xa6fb('0x49')](_0x2aa55e[_0xa6fb('0x55')],{'read':![],'body':_0x2aa55e['body'][_0xa6fb('0x55')],'phone':_0x58362d,'WhatsappAccountId':_0x256159['id'],'WhatsappInteractionId':_0x11c985['id'],'UserId':_0x2aa55e['user']['id'],'ContactId':_0x28ffef['id']}))[_0xa6fb('0x1b')](function(_0x1e7943){_0x11c985[_0xa6fb('0xbe')][_0xa6fb('0xbc')]=[];_0x11c985[_0xa6fb('0xbe')][_0xa6fb('0xbc')]['push'](_0x1e7943[_0xa6fb('0xbe')]);return _0x11c985;});})[_0xa6fb('0x1b')](respondWithResult(_0x4958ab,null))[_0xa6fb('0x24')](handleError(_0x4958ab,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 92c58d7..9f4ed73 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 _0x86c7=['WhatsappAccount','save','update','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x41443f,_0x1f0b17){var _0x4e96a1=function(_0x3cfa64){while(--_0x3cfa64){_0x41443f['push'](_0x41443f['shift']());}};_0x4e96a1(++_0x1f0b17);}(_0x86c7,0xe5));var _0x786c=function(_0x24ab64,_0x5b3db1){_0x24ab64=_0x24ab64-0x0;var _0x25f30d=_0x86c7[_0x24ab64];return _0x25f30d;};'use strict';var EventEmitter=require(_0x786c('0x0'));var WhatsappAccount=require(_0x786c('0x1'))['db'][_0x786c('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x786c('0x3'),'afterUpdate':_0x786c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x16365d){return function(_0x12a340,_0x5e41c1,_0xfa87e4){WhatsappAccountEvents['emit'](_0x16365d+':'+_0x12a340['id'],_0x12a340);WhatsappAccountEvents['emit'](_0x16365d,_0x12a340);_0xfa87e4(null);};}for(var e in events){if(events[_0x786c('0x5')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x786c('0x6')]=WhatsappAccountEvents; \ No newline at end of file +var _0x5d4f=['WhatsappAccount','save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x1d492d,_0x214546){var _0x410fe9=function(_0x32d790){while(--_0x32d790){_0x1d492d['push'](_0x1d492d['shift']());}};_0x410fe9(++_0x214546);}(_0x5d4f,0x15e));var _0xf5d4=function(_0x413940,_0x3fe871){_0x413940=_0x413940-0x0;var _0x5d93a6=_0x5d4f[_0x413940];return _0x5d93a6;};'use strict';var EventEmitter=require(_0xf5d4('0x0'));var WhatsappAccount=require(_0xf5d4('0x1'))['db'][_0xf5d4('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf5d4('0x3'),'afterUpdate':_0xf5d4('0x4'),'afterDestroy':_0xf5d4('0x5')};function emitEvent(_0x4d9319){return function(_0x45d74c,_0xe4cb6d,_0x3ab5e9){WhatsappAccountEvents['emit'](_0x4d9319+':'+_0x45d74c['id'],_0x45d74c);WhatsappAccountEvents[_0xf5d4('0x6')](_0x4d9319,_0x45d74c);_0x3ab5e9(null);};}for(var e in events){if(events[_0xf5d4('0x7')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 5767515..a4a71b5 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 _0xf13c=['moment','request-promise','path','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','util','../../config/logger','api'];(function(_0x1fd775,_0x12a1c5){var _0x565b1a=function(_0x32e32a){while(--_0x32e32a){_0x1fd775['push'](_0x1fd775['shift']());}};_0x565b1a(++_0x12a1c5);}(_0xf13c,0x1ad));var _0xcf13=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0xf13c[_0x59d89e];return _0x554e93;};'use strict';var _=require('lodash');var util=require(_0xcf13('0x0'));var logger=require(_0xcf13('0x1'))(_0xcf13('0x2'));var moment=require(_0xcf13('0x3'));var BPromise=require('bluebird');var rp=require(_0xcf13('0x4'));var fs=require('fs');var path=require(_0xcf13('0x5'));var rimraf=require('rimraf');var config=require(_0xcf13('0x6'));var attributes=require(_0xcf13('0x7'));module[_0xcf13('0x8')]=function(_0x32b99f,_0x1aa1e3){return _0x32b99f[_0xcf13('0x9')](_0xcf13('0xa'),attributes,{'tableName':_0xcf13('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d82=['request-promise','rimraf','../../config/environment','./whatsappAccount.attributes','exports','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','bluebird'];(function(_0x18af25,_0x10a9f8){var _0x33fbdc=function(_0x5dc7ab){while(--_0x5dc7ab){_0x18af25['push'](_0x18af25['shift']());}};_0x33fbdc(++_0x10a9f8);}(_0x9d82,0x97));var _0x29d8=function(_0x2b2d15,_0x4c9727){_0x2b2d15=_0x2b2d15-0x0;var _0x54485c=_0x9d82[_0x2b2d15];return _0x54485c;};'use strict';var _=require(_0x29d8('0x0'));var util=require(_0x29d8('0x1'));var logger=require(_0x29d8('0x2'))(_0x29d8('0x3'));var moment=require('moment');var BPromise=require(_0x29d8('0x4'));var rp=require(_0x29d8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x29d8('0x6'));var config=require(_0x29d8('0x7'));var attributes=require(_0x29d8('0x8'));module[_0x29d8('0x9')]=function(_0x2af310,_0x2f0f1e){return _0x2af310['define'](_0x29d8('0xa'),attributes,{'tableName':_0x29d8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 0008e1d..3378503 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 _0xbd00=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','redis','defaults','localhost','./whatsappAccount.socket','request','then','info','request\x20sent','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','attributes','include','map','model','debug','lodash','util'];(function(_0x64a845,_0x13b02c){var _0x4ba250=function(_0x3a467d){while(--_0x3a467d){_0x64a845['push'](_0x64a845['shift']());}};_0x4ba250(++_0x13b02c);}(_0xbd00,0x82));var _0x0bd0=function(_0x4f1d02,_0x4a4694){_0x4f1d02=_0x4f1d02-0x0;var _0x52fda1=_0xbd00[_0x4f1d02];return _0x52fda1;};'use strict';var _=require(_0x0bd0('0x0'));var util=require(_0x0bd0('0x1'));var moment=require(_0x0bd0('0x2'));var BPromise=require(_0x0bd0('0x3'));var rs=require(_0x0bd0('0x4'));var fs=require('fs');var Redis=require(_0x0bd0('0x5'));var db=require(_0x0bd0('0x6'))['db'];var utils=require(_0x0bd0('0x7'));var logger=require('../../config/logger')(_0x0bd0('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x0bd0('0x9')]=_[_0x0bd0('0xa')](config['redis'],{'host':_0x0bd0('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0bd0('0x9')]));require(_0x0bd0('0xc'))['register'](socket);function respondWithRpcPromise(_0x586f26,_0x502e83,_0xa6c823){return new BPromise(function(_0x27120a,_0x176bf1){return client[_0x0bd0('0xd')](_0x586f26,_0xa6c823)[_0x0bd0('0xe')](function(_0x1d9b88){logger[_0x0bd0('0xf')]('WhatsappAccount,\x20%s,\x20%s',_0x502e83,_0x0bd0('0x10'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x502e83,_0x0bd0('0x10'),JSON[_0x0bd0('0x11')](_0x1d9b88));if(_0x1d9b88[_0x0bd0('0x12')]){if(_0x1d9b88[_0x0bd0('0x12')]['code']===0x1f4){logger[_0x0bd0('0x12')](_0x0bd0('0x13'),_0x502e83,_0x1d9b88[_0x0bd0('0x12')]['message']);return _0x176bf1(_0x1d9b88[_0x0bd0('0x12')][_0x0bd0('0x14')]);}logger['error'](_0x0bd0('0x13'),_0x502e83,_0x1d9b88[_0x0bd0('0x12')][_0x0bd0('0x14')]);return _0x27120a(_0x1d9b88[_0x0bd0('0x12')][_0x0bd0('0x14')]);}else{logger[_0x0bd0('0xf')]('WhatsappAccount,\x20%s,\x20%s',_0x502e83,_0x0bd0('0x10'));_0x27120a(_0x1d9b88[_0x0bd0('0x15')][_0x0bd0('0x14')]);}})[_0x0bd0('0x16')](function(_0x538254){logger[_0x0bd0('0x12')](_0x0bd0('0x13'),_0x502e83,_0x538254);_0x176bf1(_0x538254);});});}exports[_0x0bd0('0x17')]=function(_0x376074){var _0x346005=this;return new Promise(function(_0x21c614,_0x3744dc){return db[_0x0bd0('0x18')][_0x0bd0('0x19')]({'raw':_0x376074[_0x0bd0('0x1a')]?_0x376074[_0x0bd0('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x376074[_0x0bd0('0x1a')]?_0x376074[_0x0bd0('0x1a')][_0x0bd0('0x1b')]||null:null,'attributes':_0x376074[_0x0bd0('0x1a')]?_0x376074[_0x0bd0('0x1a')][_0x0bd0('0x1c')]||null:null,'include':_0x376074['options']?_0x376074[_0x0bd0('0x1a')][_0x0bd0('0x1d')]?_[_0x0bd0('0x1e')](_0x376074['options'][_0x0bd0('0x1d')],function(_0x223b37){return{'model':db[_0x223b37[_0x0bd0('0x1f')]],'as':_0x223b37['as'],'attributes':_0x223b37[_0x0bd0('0x1c')],'include':_0x223b37[_0x0bd0('0x1d')]?_[_0x0bd0('0x1e')](_0x223b37[_0x0bd0('0x1d')],function(_0xbc2c2c){return{'model':db[_0xbc2c2c[_0x0bd0('0x1f')]],'as':_0xbc2c2c['as'],'attributes':_0xbc2c2c[_0x0bd0('0x1c')],'include':_0xbc2c2c[_0x0bd0('0x1d')]?_[_0x0bd0('0x1e')](_0xbc2c2c[_0x0bd0('0x1d')],function(_0x8bd41a){return{'model':db[_0x8bd41a[_0x0bd0('0x1f')]],'as':_0x8bd41a['as'],'attributes':_0x8bd41a[_0x0bd0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0bd0('0xe')](function(_0x571360){logger['info'](_0x0bd0('0x17'),_0x376074);logger[_0x0bd0('0x20')](_0x0bd0('0x17'),_0x376074,JSON[_0x0bd0('0x11')](_0x571360));_0x21c614(_0x571360);})[_0x0bd0('0x16')](function(_0x22cf46){logger[_0x0bd0('0x12')]('ShowWhatsappAccount',_0x22cf46[_0x0bd0('0x14')],_0x376074);_0x3744dc(_0x346005[_0x0bd0('0x12')](0x1f4,_0x22cf46['message']));});});}; \ No newline at end of file +var _0xf363=['WhatsappAccount','find','options','where','attributes','map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowWhatsappAccount'];(function(_0x1f27df,_0x4f1a64){var _0x286ee2=function(_0x255ea7){while(--_0x255ea7){_0x1f27df['push'](_0x1f27df['shift']());}};_0x286ee2(++_0x4f1a64);}(_0xf363,0x9c));var _0x3f36=function(_0x59be0b,_0x47a60d){_0x59be0b=_0x59be0b-0x0;var _0x230926=_0xf363[_0x59be0b];return _0x230926;};'use strict';var _=require(_0x3f36('0x0'));var util=require(_0x3f36('0x1'));var moment=require(_0x3f36('0x2'));var BPromise=require(_0x3f36('0x3'));var rs=require(_0x3f36('0x4'));var fs=require('fs');var Redis=require(_0x3f36('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3f36('0x6'));var logger=require(_0x3f36('0x7'))(_0x3f36('0x8'));var config=require(_0x3f36('0x9'));var jayson=require(_0x3f36('0xa'));var client=jayson[_0x3f36('0xb')][_0x3f36('0xc')]({'port':0x232a});config[_0x3f36('0xd')]=_[_0x3f36('0xe')](config[_0x3f36('0xd')],{'host':_0x3f36('0xf'),'port':0x18eb});var socket=require(_0x3f36('0x10'))(new Redis(config['redis']));require(_0x3f36('0x11'))['register'](socket);function respondWithRpcPromise(_0x5aa4e6,_0x3408a7,_0xfc3373){return new BPromise(function(_0xec750,_0x49dce4){return client['request'](_0x5aa4e6,_0xfc3373)[_0x3f36('0x12')](function(_0xca5466){logger[_0x3f36('0x13')](_0x3f36('0x14'),_0x3408a7,'request\x20sent');logger[_0x3f36('0x15')](_0x3f36('0x16'),_0x3408a7,'request\x20sent',JSON[_0x3f36('0x17')](_0xca5466));if(_0xca5466[_0x3f36('0x18')]){if(_0xca5466[_0x3f36('0x18')][_0x3f36('0x19')]===0x1f4){logger[_0x3f36('0x18')](_0x3f36('0x14'),_0x3408a7,_0xca5466[_0x3f36('0x18')][_0x3f36('0x1a')]);return _0x49dce4(_0xca5466[_0x3f36('0x18')][_0x3f36('0x1a')]);}logger['error'](_0x3f36('0x14'),_0x3408a7,_0xca5466['error'][_0x3f36('0x1a')]);return _0xec750(_0xca5466[_0x3f36('0x18')]['message']);}else{logger[_0x3f36('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x3408a7,'request\x20sent');_0xec750(_0xca5466[_0x3f36('0x1b')][_0x3f36('0x1a')]);}})['catch'](function(_0x5d9904){logger[_0x3f36('0x18')](_0x3f36('0x14'),_0x3408a7,_0x5d9904);_0x49dce4(_0x5d9904);});});}exports[_0x3f36('0x1c')]=function(_0x4ab60a){var _0x423d29=this;return new Promise(function(_0x252786,_0x5cafb2){return db[_0x3f36('0x1d')][_0x3f36('0x1e')]({'raw':_0x4ab60a[_0x3f36('0x1f')]?_0x4ab60a[_0x3f36('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x4ab60a['options']?_0x4ab60a[_0x3f36('0x1f')][_0x3f36('0x20')]||null:null,'attributes':_0x4ab60a[_0x3f36('0x1f')]?_0x4ab60a[_0x3f36('0x1f')][_0x3f36('0x21')]||null:null,'include':_0x4ab60a[_0x3f36('0x1f')]?_0x4ab60a[_0x3f36('0x1f')]['include']?_[_0x3f36('0x22')](_0x4ab60a[_0x3f36('0x1f')][_0x3f36('0x23')],function(_0x4fcc3e){return{'model':db[_0x4fcc3e[_0x3f36('0x24')]],'as':_0x4fcc3e['as'],'attributes':_0x4fcc3e[_0x3f36('0x21')],'include':_0x4fcc3e[_0x3f36('0x23')]?_['map'](_0x4fcc3e['include'],function(_0xd60fc5){return{'model':db[_0xd60fc5['model']],'as':_0xd60fc5['as'],'attributes':_0xd60fc5[_0x3f36('0x21')],'include':_0xd60fc5[_0x3f36('0x23')]?_[_0x3f36('0x22')](_0xd60fc5[_0x3f36('0x23')],function(_0x47bb74){return{'model':db[_0x47bb74['model']],'as':_0x47bb74['as'],'attributes':_0x47bb74[_0x3f36('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3f36('0x12')](function(_0x30768b){logger['info']('ShowWhatsappAccount',_0x4ab60a);logger[_0x3f36('0x15')](_0x3f36('0x1c'),_0x4ab60a,JSON['stringify'](_0x30768b));_0x252786(_0x30768b);})['catch'](function(_0x544bf1){logger[_0x3f36('0x18')](_0x3f36('0x1c'),_0x544bf1['message'],_0x4ab60a);_0x5cafb2(_0x423d29[_0x3f36('0x18')](0x1f4,_0x544bf1['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 974d76c..2e53237 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 _0x7b88=['register','length','whatsappAccount:','./whatsappAccount.events','remove','update','emit','removeListener'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7b88,0x11b));var _0x87b8=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x7b88[_0x82129b];return _0x2ae5dc;};'use strict';var WhatsappAccountEvents=require(_0x87b8('0x0'));var events=['save',_0x87b8('0x1'),_0x87b8('0x2')];function createListener(_0x477f7e,_0x48ee68){return function(_0x3657e9){_0x48ee68[_0x87b8('0x3')](_0x477f7e,_0x3657e9);};}function removeListener(_0x2a7888,_0x4da38b){return function(){WhatsappAccountEvents[_0x87b8('0x4')](_0x2a7888,_0x4da38b);};}exports[_0x87b8('0x5')]=function(_0x3d6c04){for(var _0x2fd41d=0x0,_0x46af68=events[_0x87b8('0x6')];_0x2fd41d<_0x46af68;_0x2fd41d++){var _0x27d044=events[_0x2fd41d];var _0x1c3185=createListener(_0x87b8('0x7')+_0x27d044,_0x3d6c04);WhatsappAccountEvents['on'](_0x27d044,_0x1c3185);}}; \ No newline at end of file +var _0xe860=['update','emit','removeListener','register','whatsappAccount:','remove'];(function(_0x11d5b9,_0x2df36a){var _0x2cdd91=function(_0x5ef6a3){while(--_0x5ef6a3){_0x11d5b9['push'](_0x11d5b9['shift']());}};_0x2cdd91(++_0x2df36a);}(_0xe860,0x149));var _0x0e86=function(_0xca0692,_0x3a5898){_0xca0692=_0xca0692-0x0;var _0x3393da=_0xe860[_0xca0692];return _0x3393da;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=['save',_0x0e86('0x0'),_0x0e86('0x1')];function createListener(_0x4dd86b,_0x2c4977){return function(_0x162447){_0x2c4977[_0x0e86('0x2')](_0x4dd86b,_0x162447);};}function removeListener(_0x4784f1,_0x591af8){return function(){WhatsappAccountEvents[_0x0e86('0x3')](_0x4784f1,_0x591af8);};}exports[_0x0e86('0x4')]=function(_0x33dbd8){for(var _0x364661=0x0,_0xcf101a=events['length'];_0x364661<_0xcf101a;_0x364661++){var _0x45c301=events[_0x364661];var _0xbf7291=createListener(_0x0e86('0x5')+_0x45c301,_0x33dbd8);WhatsappAccountEvents['on'](_0x45c301,_0xbf7291);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 7886f75..37e6d1f 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 _0xaa42=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x413b4d,_0xa3459c){var _0x8b810a=function(_0x22d441){while(--_0x22d441){_0x413b4d['push'](_0x413b4d['shift']());}};_0x8b810a(++_0xa3459c);}(_0xaa42,0x19f));var _0x2aa4=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xaa42[_0x1203f];return _0x365f0a;};'use strict';var multer=require(_0x2aa4('0x0'));var util=require(_0x2aa4('0x1'));var path=require(_0x2aa4('0x2'));var timeout=require(_0x2aa4('0x3'));var express=require(_0x2aa4('0x4'));var router=express[_0x2aa4('0x5')]();var fs_extra=require(_0x2aa4('0x6'));var auth=require(_0x2aa4('0x7'));var interaction=require(_0x2aa4('0x8'));var config=require(_0x2aa4('0x9'));var controller=require(_0x2aa4('0xa'));router[_0x2aa4('0xb')]('/',auth[_0x2aa4('0xc')](),controller['index']);router['get'](_0x2aa4('0xd'),auth[_0x2aa4('0xc')](),controller[_0x2aa4('0xe')]);router[_0x2aa4('0xf')]('/',auth[_0x2aa4('0xc')](),controller[_0x2aa4('0x10')]);router[_0x2aa4('0x11')](_0x2aa4('0xd'),auth['isAuthenticated'](),controller[_0x2aa4('0x12')]);router[_0x2aa4('0x13')](_0x2aa4('0xd'),auth[_0x2aa4('0xc')](),controller[_0x2aa4('0x14')]);module[_0x2aa4('0x15')]=router; \ No newline at end of file +var _0x0916=['/:id','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','update','delete'];(function(_0x530171,_0x4b7fd1){var _0x2913e5=function(_0x399b00){while(--_0x399b00){_0x530171['push'](_0x530171['shift']());}};_0x2913e5(++_0x4b7fd1);}(_0x0916,0x120));var _0x6091=function(_0x4adb78,_0xced0c4){_0x4adb78=_0x4adb78-0x0;var _0x27e0af=_0x0916[_0x4adb78];return _0x27e0af;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6091('0x0'));var timeout=require(_0x6091('0x1'));var express=require(_0x6091('0x2'));var router=express[_0x6091('0x3')]();var fs_extra=require(_0x6091('0x4'));var auth=require(_0x6091('0x5'));var interaction=require(_0x6091('0x6'));var config=require(_0x6091('0x7'));var controller=require('./whatsappApplication.controller');router[_0x6091('0x8')]('/',auth[_0x6091('0x9')](),controller[_0x6091('0xa')]);router[_0x6091('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x6091('0xb')]);router[_0x6091('0xc')]('/',auth['isAuthenticated'](),controller[_0x6091('0xd')]);router['put']('/:id',auth[_0x6091('0x9')](),controller[_0x6091('0xe')]);router[_0x6091('0xf')](_0x6091('0x10'),auth[_0x6091('0x9')](),controller[_0x6091('0x11')]);module[_0x6091('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 2c03813..981aa99 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 _0x0ceb=['*,*,*,*','sequelize','exports','STRING','noop','TEXT'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0ceb,0x17b));var _0xb0ce=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x0ceb[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0xb0ce('0x0'));module[_0xb0ce('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb0ce('0x2')],'allowNull':![],'defaultValue':_0xb0ce('0x3')},'appdata':{'type':Sequelize[_0xb0ce('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb0ce('0x2')],'defaultValue':_0xb0ce('0x5')}}; \ No newline at end of file +var _0xe895=['noop','TEXT','STRING','sequelize','exports','INTEGER'];(function(_0x76bf79,_0x2194f5){var _0x52e9d1=function(_0x15a3ee){while(--_0x15a3ee){_0x76bf79['push'](_0x76bf79['shift']());}};_0x52e9d1(++_0x2194f5);}(_0xe895,0x13b));var _0x5e89=function(_0x27b430,_0x21388d){_0x27b430=_0x27b430-0x0;var _0x637da8=_0xe895[_0x27b430];return _0x637da8;};'use strict';var Sequelize=require(_0x5e89('0x0'));module[_0x5e89('0x1')]={'priority':{'type':Sequelize[_0x5e89('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5e89('0x3')},'appdata':{'type':Sequelize[_0x5e89('0x4')]()},'description':{'type':Sequelize[_0x5e89('0x5')]},'interval':{'type':Sequelize[_0x5e89('0x5')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index f21ca5a..b3ff4d2 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 _0xb7ac=['reject','save','update','then','error','stack','name','send','index','WhatsappApplication','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','fields','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','apply'];(function(_0x5b50e3,_0xdc2916){var _0x324f08=function(_0x55d1e3){while(--_0x55d1e3){_0x5b50e3['push'](_0x5b50e3['shift']());}};_0x324f08(++_0xdc2916);}(_0xb7ac,0x18a));var _0xcb7a=function(_0x58d1fc,_0x1ce9b5){_0x58d1fc=_0x58d1fc-0x0;var _0x514740=_0xb7ac[_0x58d1fc];return _0x514740;};'use strict';var emlformat=require(_0xcb7a('0x0'));var rimraf=require(_0xcb7a('0x1'));var zipdir=require(_0xcb7a('0x2'));var jsonpatch=require(_0xcb7a('0x3'));var rp=require(_0xcb7a('0x4'));var moment=require('moment');var BPromise=require(_0xcb7a('0x5'));var Mustache=require('mustache');var util=require(_0xcb7a('0x6'));var path=require(_0xcb7a('0x7'));var sox=require('sox');var csv=require(_0xcb7a('0x8'));var ejs=require(_0xcb7a('0x9'));var fs=require('fs');var fs_extra=require(_0xcb7a('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcb7a('0xb'));var jsforce=require(_0xcb7a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xcb7a('0x8'));var querystring=require(_0xcb7a('0xd'));var Papa=require(_0xcb7a('0xe'));var Redis=require(_0xcb7a('0xf'));var authService=require(_0xcb7a('0x10'));var qs=require(_0xcb7a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb7a('0x12'));var logger=require(_0xcb7a('0x13'))(_0xcb7a('0x14'));var utils=require('../../config/utils');var config=require(_0xcb7a('0x15'));var licenseUtil=require(_0xcb7a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x260f43,_0x3ec2fe){_0x3ec2fe=_0x3ec2fe||0xcc;return function(_0x29a931){if(_0x29a931){return _0x260f43[_0xcb7a('0x17')](_0x3ec2fe);}return _0x260f43[_0xcb7a('0x18')](_0x3ec2fe)[_0xcb7a('0x19')]();};}function respondWithResult(_0x37459c,_0x1050ca){_0x1050ca=_0x1050ca||0xc8;return function(_0x1669ed){if(_0x1669ed){return _0x37459c['status'](_0x1050ca)[_0xcb7a('0x1a')](_0x1669ed);}};}function respondWithFilteredResult(_0x54b0ce,_0x3b3851){return function(_0x38acef){if(_0x38acef){var _0x7f1071=typeof _0x3b3851[_0xcb7a('0x1b')]==='undefined'&&typeof _0x3b3851[_0xcb7a('0x1c')]===_0xcb7a('0x1d');var _0x28d09d=_0x38acef[_0xcb7a('0x1e')];var _0x118dde=_0x7f1071?0x0:_0x3b3851[_0xcb7a('0x1b')];var _0x119bb2=_0x7f1071?_0x38acef['count']:_0x3b3851[_0xcb7a('0x1b')]+_0x3b3851[_0xcb7a('0x1c')];var _0x1c6630;if(_0x119bb2>=_0x28d09d){_0x119bb2=_0x28d09d;_0x1c6630=0xc8;}else{_0x1c6630=0xce;}_0x54b0ce[_0xcb7a('0x18')](_0x1c6630);return _0x54b0ce['set']('Content-Range',_0x118dde+'-'+_0x119bb2+'/'+_0x28d09d)['json'](_0x38acef);}return null;};}function patchUpdates(_0x25a27e){return function(_0x54de2c){try{jsonpatch[_0xcb7a('0x1f')](_0x54de2c,_0x25a27e,!![]);}catch(_0x112d6e){return BPromise[_0xcb7a('0x20')](_0x112d6e);}return _0x54de2c[_0xcb7a('0x21')]();};}function saveUpdates(_0x45e54b,_0x26f4a4){return function(_0x18da58){if(_0x18da58){return _0x18da58[_0xcb7a('0x22')](_0x45e54b)[_0xcb7a('0x23')](function(_0x120bbc){return _0x120bbc;});}return null;};}function removeEntity(_0x63dd64,_0x5a29a7){return function(_0x5c9191){if(_0x5c9191){return _0x5c9191['destroy']()[_0xcb7a('0x23')](function(){_0x63dd64[_0xcb7a('0x18')](0xcc)[_0xcb7a('0x19')]();});}};}function handleEntityNotFound(_0x28682a,_0x4830ff){return function(_0x527ae8){if(!_0x527ae8){_0x28682a[_0xcb7a('0x17')](0x194);}return _0x527ae8;};}function handleError(_0x282350,_0x2c59d8){_0x2c59d8=_0x2c59d8||0x1f4;return function(_0x558c42){logger[_0xcb7a('0x24')](_0x558c42[_0xcb7a('0x25')]);if(_0x558c42['name']){delete _0x558c42[_0xcb7a('0x26')];}_0x282350[_0xcb7a('0x18')](_0x2c59d8)[_0xcb7a('0x27')](_0x558c42);};}exports[_0xcb7a('0x28')]=function(_0x4680ea,_0x5ba723){var _0x3aa77c={},_0x59c56a={},_0x291580={'count':0x0,'rows':[]};var _0x4ebadb=_['map'](db[_0xcb7a('0x29')][_0xcb7a('0x2a')],function(_0x38be8b){return{'name':_0x38be8b[_0xcb7a('0x2b')],'type':_0x38be8b[_0xcb7a('0x2c')]['key']};});_0x59c56a[_0xcb7a('0x2d')]=_[_0xcb7a('0x2e')](_0x4ebadb,_0xcb7a('0x26'));_0x59c56a[_0xcb7a('0x2f')]=_[_0xcb7a('0x30')](_0x4680ea[_0xcb7a('0x2f')]);_0x59c56a[_0xcb7a('0x31')]=_[_0xcb7a('0x32')](_0x59c56a[_0xcb7a('0x2d')],_0x59c56a[_0xcb7a('0x2f')]);_0x3aa77c[_0xcb7a('0x33')]=_[_0xcb7a('0x32')](_0x59c56a[_0xcb7a('0x2d')],qs['fields'](_0x4680ea[_0xcb7a('0x2f')]['fields']));_0x3aa77c[_0xcb7a('0x33')]=_0x3aa77c[_0xcb7a('0x33')][_0xcb7a('0x34')]?_0x3aa77c[_0xcb7a('0x33')]:_0x59c56a['model'];if(!_0x4680ea[_0xcb7a('0x2f')]['hasOwnProperty'](_0xcb7a('0x35'))){_0x3aa77c[_0xcb7a('0x1c')]=qs[_0xcb7a('0x1c')](_0x4680ea['query'][_0xcb7a('0x1c')]);_0x3aa77c[_0xcb7a('0x1b')]=qs['offset'](_0x4680ea[_0xcb7a('0x2f')][_0xcb7a('0x1b')]);}_0x3aa77c[_0xcb7a('0x36')]=qs[_0xcb7a('0x37')](_0x4680ea['query'][_0xcb7a('0x37')]);_0x3aa77c[_0xcb7a('0x38')]=qs[_0xcb7a('0x31')](_['pick'](_0x4680ea[_0xcb7a('0x2f')],_0x59c56a[_0xcb7a('0x31')]),_0x4ebadb);if(_0x4680ea[_0xcb7a('0x2f')][_0xcb7a('0x39')]){_0x3aa77c[_0xcb7a('0x38')]=_[_0xcb7a('0x3a')](_0x3aa77c['where'],{'$or':_[_0xcb7a('0x2e')](_0x4ebadb,function(_0x2d8d71){if(_0x2d8d71[_0xcb7a('0x2c')]!==_0xcb7a('0x3b')){var _0x4c4dfc={};_0x4c4dfc[_0x2d8d71[_0xcb7a('0x26')]]={'$like':'%'+_0x4680ea[_0xcb7a('0x2f')][_0xcb7a('0x39')]+'%'};return _0x4c4dfc;}})});}_0x3aa77c=_[_0xcb7a('0x3a')]({},_0x3aa77c,_0x4680ea[_0xcb7a('0x3c')]);var _0x52c756={'where':_0x3aa77c[_0xcb7a('0x38')]};return db[_0xcb7a('0x29')][_0xcb7a('0x1e')](_0x52c756)[_0xcb7a('0x23')](function(_0x25395b){_0x291580['count']=_0x25395b;if(_0x4680ea['query']['includeAll']){_0x3aa77c[_0xcb7a('0x3d')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xcb7a('0x3e')](_0x3aa77c);})[_0xcb7a('0x23')](function(_0xe6b453){_0x291580['rows']=_0xe6b453;return _0x291580;})[_0xcb7a('0x23')](respondWithFilteredResult(_0x5ba723,_0x3aa77c))[_0xcb7a('0x3f')](handleError(_0x5ba723,null));};exports[_0xcb7a('0x40')]=function(_0xb33841,_0x5363a9){var _0x11e73d={'raw':!![],'where':{'id':_0xb33841[_0xcb7a('0x41')]['id']}},_0x318147={};_0x318147[_0xcb7a('0x2d')]=_['keys'](db[_0xcb7a('0x29')][_0xcb7a('0x2a')]);_0x318147['query']=_[_0xcb7a('0x30')](_0xb33841['query']);_0x318147[_0xcb7a('0x31')]=_['intersection'](_0x318147[_0xcb7a('0x2d')],_0x318147['query']);_0x11e73d['attributes']=_[_0xcb7a('0x32')](_0x318147[_0xcb7a('0x2d')],qs[_0xcb7a('0x42')](_0xb33841['query'][_0xcb7a('0x42')]));_0x11e73d[_0xcb7a('0x33')]=_0x11e73d[_0xcb7a('0x33')][_0xcb7a('0x34')]?_0x11e73d[_0xcb7a('0x33')]:_0x318147['model'];if(_0xb33841[_0xcb7a('0x2f')]['includeAll']){_0x11e73d[_0xcb7a('0x3d')]=[{'all':!![]}];}_0x11e73d=_[_0xcb7a('0x3a')]({},_0x11e73d,_0xb33841[_0xcb7a('0x3c')]);return db[_0xcb7a('0x29')][_0xcb7a('0x43')](_0x11e73d)[_0xcb7a('0x23')](handleEntityNotFound(_0x5363a9,null))[_0xcb7a('0x23')](respondWithResult(_0x5363a9,null))[_0xcb7a('0x3f')](handleError(_0x5363a9,null));};exports[_0xcb7a('0x44')]=function(_0x445d63,_0x3c1f9a){return db[_0xcb7a('0x29')][_0xcb7a('0x44')](_0x445d63[_0xcb7a('0x45')],{})[_0xcb7a('0x23')](respondWithResult(_0x3c1f9a,0xc9))[_0xcb7a('0x3f')](handleError(_0x3c1f9a,null));};exports['update']=function(_0x440c9e,_0xca7b9b){if(_0x440c9e[_0xcb7a('0x45')]['id']){delete _0x440c9e[_0xcb7a('0x45')]['id'];}return db[_0xcb7a('0x29')][_0xcb7a('0x43')]({'where':{'id':_0x440c9e[_0xcb7a('0x41')]['id']}})['then'](handleEntityNotFound(_0xca7b9b,null))[_0xcb7a('0x23')](saveUpdates(_0x440c9e[_0xcb7a('0x45')],null))[_0xcb7a('0x23')](respondWithResult(_0xca7b9b,null))[_0xcb7a('0x3f')](handleError(_0xca7b9b,null));};exports[_0xcb7a('0x46')]=function(_0x2ce33b,_0x147614){return db[_0xcb7a('0x29')][_0xcb7a('0x43')]({'where':{'id':_0x2ce33b[_0xcb7a('0x41')]['id']}})[_0xcb7a('0x23')](handleEntityNotFound(_0x147614,null))[_0xcb7a('0x23')](removeEntity(_0x147614,null))[_0xcb7a('0x3f')](handleError(_0x147614,null));}; \ No newline at end of file +var _0x97ce=['set','apply','reject','save','update','then','destroy','error','stack','name','map','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','WhatsappApplication','count','includeAll','include','findAll','rows','show','params','rawAttributes','options','create','body','catch','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x287890,_0x2a6054){var _0x485f55=function(_0x13b750){while(--_0x13b750){_0x287890['push'](_0x287890['shift']());}};_0x485f55(++_0x2a6054);}(_0x97ce,0x151));var _0xe97c=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x97ce[_0x1da527];return _0x40fc7c;};'use strict';var emlformat=require(_0xe97c('0x0'));var rimraf=require(_0xe97c('0x1'));var zipdir=require(_0xe97c('0x2'));var jsonpatch=require(_0xe97c('0x3'));var rp=require('request-promise');var moment=require(_0xe97c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe97c('0x5'));var util=require('util');var path=require(_0xe97c('0x6'));var sox=require(_0xe97c('0x7'));var csv=require(_0xe97c('0x8'));var ejs=require(_0xe97c('0x9'));var fs=require('fs');var fs_extra=require(_0xe97c('0xa'));var _=require(_0xe97c('0xb'));var squel=require('squel');var crypto=require(_0xe97c('0xc'));var jsforce=require(_0xe97c('0xd'));var deskjs=require(_0xe97c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe97c('0xf'));var Papa=require('papaparse');var Redis=require(_0xe97c('0x10'));var authService=require(_0xe97c('0x11'));var qs=require(_0xe97c('0x12'));var as=require(_0xe97c('0x13'));var hardwareService=require(_0xe97c('0x14'));var logger=require(_0xe97c('0x15'))(_0xe97c('0x16'));var utils=require('../../config/utils');var config=require(_0xe97c('0x17'));var licenseUtil=require(_0xe97c('0x18'));var db=require(_0xe97c('0x19'))['db'];function respondWithStatusCode(_0x15ab00,_0x72d55a){_0x72d55a=_0x72d55a||0xcc;return function(_0x3df200){if(_0x3df200){return _0x15ab00[_0xe97c('0x1a')](_0x72d55a);}return _0x15ab00[_0xe97c('0x1b')](_0x72d55a)[_0xe97c('0x1c')]();};}function respondWithResult(_0x578ffc,_0x4e0b5e){_0x4e0b5e=_0x4e0b5e||0xc8;return function(_0x115559){if(_0x115559){return _0x578ffc['status'](_0x4e0b5e)[_0xe97c('0x1d')](_0x115559);}};}function respondWithFilteredResult(_0x4006a6,_0x5c2cbf){return function(_0x4bf5c7){if(_0x4bf5c7){var _0x220396=typeof _0x5c2cbf[_0xe97c('0x1e')]===_0xe97c('0x1f')&&typeof _0x5c2cbf[_0xe97c('0x20')]==='undefined';var _0x4e2044=_0x4bf5c7['count'];var _0x42d95c=_0x220396?0x0:_0x5c2cbf[_0xe97c('0x1e')];var _0x22054c=_0x220396?_0x4bf5c7['count']:_0x5c2cbf[_0xe97c('0x1e')]+_0x5c2cbf[_0xe97c('0x20')];var _0x6be792;if(_0x22054c>=_0x4e2044){_0x22054c=_0x4e2044;_0x6be792=0xc8;}else{_0x6be792=0xce;}_0x4006a6[_0xe97c('0x1b')](_0x6be792);return _0x4006a6[_0xe97c('0x21')]('Content-Range',_0x42d95c+'-'+_0x22054c+'/'+_0x4e2044)[_0xe97c('0x1d')](_0x4bf5c7);}return null;};}function patchUpdates(_0xdaf874){return function(_0x24a54d){try{jsonpatch[_0xe97c('0x22')](_0x24a54d,_0xdaf874,!![]);}catch(_0x32eb7a){return BPromise[_0xe97c('0x23')](_0x32eb7a);}return _0x24a54d[_0xe97c('0x24')]();};}function saveUpdates(_0x1061e1,_0xc1be51){return function(_0x2f2840){if(_0x2f2840){return _0x2f2840[_0xe97c('0x25')](_0x1061e1)[_0xe97c('0x26')](function(_0x4749a3){return _0x4749a3;});}return null;};}function removeEntity(_0x117d0b,_0x3b957c){return function(_0x3fb93e){if(_0x3fb93e){return _0x3fb93e[_0xe97c('0x27')]()[_0xe97c('0x26')](function(){_0x117d0b[_0xe97c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23ff1d,_0x6e14cc){return function(_0x244835){if(!_0x244835){_0x23ff1d[_0xe97c('0x1a')](0x194);}return _0x244835;};}function handleError(_0x61d473,_0x1bb9d8){_0x1bb9d8=_0x1bb9d8||0x1f4;return function(_0x42729e){logger[_0xe97c('0x28')](_0x42729e[_0xe97c('0x29')]);if(_0x42729e[_0xe97c('0x2a')]){delete _0x42729e[_0xe97c('0x2a')];}_0x61d473[_0xe97c('0x1b')](_0x1bb9d8)['send'](_0x42729e);};}exports['index']=function(_0x132678,_0x1a3f69){var _0x1273a2={},_0x27cfae={},_0x40caf3={'count':0x0,'rows':[]};var _0x6fff8d=_[_0xe97c('0x2b')](db['WhatsappApplication']['rawAttributes'],function(_0x35938e){return{'name':_0x35938e[_0xe97c('0x2c')],'type':_0x35938e[_0xe97c('0x2d')][_0xe97c('0x2e')]};});_0x27cfae['model']=_['map'](_0x6fff8d,_0xe97c('0x2a'));_0x27cfae[_0xe97c('0x2f')]=_[_0xe97c('0x30')](_0x132678['query']);_0x27cfae['filters']=_[_0xe97c('0x31')](_0x27cfae[_0xe97c('0x32')],_0x27cfae[_0xe97c('0x2f')]);_0x1273a2[_0xe97c('0x33')]=_[_0xe97c('0x31')](_0x27cfae[_0xe97c('0x32')],qs[_0xe97c('0x34')](_0x132678['query'][_0xe97c('0x34')]));_0x1273a2[_0xe97c('0x33')]=_0x1273a2['attributes'][_0xe97c('0x35')]?_0x1273a2[_0xe97c('0x33')]:_0x27cfae[_0xe97c('0x32')];if(!_0x132678[_0xe97c('0x2f')][_0xe97c('0x36')](_0xe97c('0x37'))){_0x1273a2[_0xe97c('0x20')]=qs[_0xe97c('0x20')](_0x132678['query']['limit']);_0x1273a2[_0xe97c('0x1e')]=qs[_0xe97c('0x1e')](_0x132678[_0xe97c('0x2f')][_0xe97c('0x1e')]);}_0x1273a2['order']=qs[_0xe97c('0x38')](_0x132678['query'][_0xe97c('0x38')]);_0x1273a2[_0xe97c('0x39')]=qs[_0xe97c('0x3a')](_['pick'](_0x132678[_0xe97c('0x2f')],_0x27cfae[_0xe97c('0x3a')]),_0x6fff8d);if(_0x132678[_0xe97c('0x2f')][_0xe97c('0x3b')]){_0x1273a2[_0xe97c('0x39')]=_['merge'](_0x1273a2[_0xe97c('0x39')],{'$or':_[_0xe97c('0x2b')](_0x6fff8d,function(_0x2e20dd){if(_0x2e20dd['type']!=='VIRTUAL'){var _0x371830={};_0x371830[_0x2e20dd['name']]={'$like':'%'+_0x132678[_0xe97c('0x2f')]['filter']+'%'};return _0x371830;}})});}_0x1273a2=_['merge']({},_0x1273a2,_0x132678['options']);var _0x112ae7={'where':_0x1273a2[_0xe97c('0x39')]};return db[_0xe97c('0x3c')][_0xe97c('0x3d')](_0x112ae7)[_0xe97c('0x26')](function(_0x4ff87e){_0x40caf3[_0xe97c('0x3d')]=_0x4ff87e;if(_0x132678['query'][_0xe97c('0x3e')]){_0x1273a2[_0xe97c('0x3f')]=[{'all':!![]}];}return db[_0xe97c('0x3c')][_0xe97c('0x40')](_0x1273a2);})[_0xe97c('0x26')](function(_0x381e41){_0x40caf3[_0xe97c('0x41')]=_0x381e41;return _0x40caf3;})[_0xe97c('0x26')](respondWithFilteredResult(_0x1a3f69,_0x1273a2))['catch'](handleError(_0x1a3f69,null));};exports[_0xe97c('0x42')]=function(_0x3dd372,_0x20ee1b){var _0x272972={'raw':!![],'where':{'id':_0x3dd372[_0xe97c('0x43')]['id']}},_0x400cde={};_0x400cde[_0xe97c('0x32')]=_[_0xe97c('0x30')](db[_0xe97c('0x3c')][_0xe97c('0x44')]);_0x400cde['query']=_[_0xe97c('0x30')](_0x3dd372[_0xe97c('0x2f')]);_0x400cde['filters']=_[_0xe97c('0x31')](_0x400cde[_0xe97c('0x32')],_0x400cde[_0xe97c('0x2f')]);_0x272972[_0xe97c('0x33')]=_['intersection'](_0x400cde[_0xe97c('0x32')],qs['fields'](_0x3dd372[_0xe97c('0x2f')][_0xe97c('0x34')]));_0x272972[_0xe97c('0x33')]=_0x272972[_0xe97c('0x33')][_0xe97c('0x35')]?_0x272972['attributes']:_0x400cde[_0xe97c('0x32')];if(_0x3dd372[_0xe97c('0x2f')][_0xe97c('0x3e')]){_0x272972[_0xe97c('0x3f')]=[{'all':!![]}];}_0x272972=_['merge']({},_0x272972,_0x3dd372[_0xe97c('0x45')]);return db[_0xe97c('0x3c')]['find'](_0x272972)[_0xe97c('0x26')](handleEntityNotFound(_0x20ee1b,null))[_0xe97c('0x26')](respondWithResult(_0x20ee1b,null))['catch'](handleError(_0x20ee1b,null));};exports['create']=function(_0x1fd875,_0x560fda){return db[_0xe97c('0x3c')][_0xe97c('0x46')](_0x1fd875[_0xe97c('0x47')],{})[_0xe97c('0x26')](respondWithResult(_0x560fda,0xc9))[_0xe97c('0x48')](handleError(_0x560fda,null));};exports[_0xe97c('0x25')]=function(_0x1fefe3,_0x4f7616){if(_0x1fefe3[_0xe97c('0x47')]['id']){delete _0x1fefe3[_0xe97c('0x47')]['id'];}return db[_0xe97c('0x3c')][_0xe97c('0x49')]({'where':{'id':_0x1fefe3['params']['id']}})['then'](handleEntityNotFound(_0x4f7616,null))[_0xe97c('0x26')](saveUpdates(_0x1fefe3[_0xe97c('0x47')],null))[_0xe97c('0x26')](respondWithResult(_0x4f7616,null))[_0xe97c('0x48')](handleError(_0x4f7616,null));};exports['destroy']=function(_0x536cc6,_0x5b1420){return db[_0xe97c('0x3c')][_0xe97c('0x49')]({'where':{'id':_0x536cc6[_0xe97c('0x43')]['id']}})[_0xe97c('0x26')](handleEntityNotFound(_0x5b1420,null))[_0xe97c('0x26')](removeEntity(_0x5b1420,null))[_0xe97c('0x48')](handleError(_0x5b1420,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index ddf57fc..af14112 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 _0xf23b=['request-promise','path','rimraf','./whatsappApplication.attributes','exports','define','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0x3d5a73,_0x2939d2){var _0x7f5050=function(_0x51f456){while(--_0x51f456){_0x3d5a73['push'](_0x3d5a73['shift']());}};_0x7f5050(++_0x2939d2);}(_0xf23b,0x133));var _0xbf23=function(_0x26eb2f,_0x1b7135){_0x26eb2f=_0x26eb2f-0x0;var _0x30509d=_0xf23b[_0x26eb2f];return _0x30509d;};'use strict';var _=require(_0xbf23('0x0'));var util=require(_0xbf23('0x1'));var logger=require(_0xbf23('0x2'))(_0xbf23('0x3'));var moment=require(_0xbf23('0x4'));var BPromise=require('bluebird');var rp=require(_0xbf23('0x5'));var fs=require('fs');var path=require(_0xbf23('0x6'));var rimraf=require(_0xbf23('0x7'));var config=require('../../config/environment');var attributes=require(_0xbf23('0x8'));module[_0xbf23('0x9')]=function(_0xc5e7dd,_0x393a52){return _0xc5e7dd[_0xbf23('0xa')]('WhatsappApplication',attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbf23('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6737=['utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./whatsappApplication.attributes'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x6737,0xe2));var _0x7673=function(_0x35f7ce,_0x25b7e6){_0x35f7ce=_0x35f7ce-0x0;var _0x5b95f1=_0x6737[_0x35f7ce];return _0x5b95f1;};'use strict';var _=require('lodash');var util=require(_0x7673('0x0'));var logger=require(_0x7673('0x1'))('api');var moment=require(_0x7673('0x2'));var BPromise=require(_0x7673('0x3'));var rp=require(_0x7673('0x4'));var fs=require('fs');var path=require(_0x7673('0x5'));var rimraf=require('rimraf');var config=require(_0x7673('0x6'));var attributes=require(_0x7673('0x7'));module['exports']=function(_0x2f5edc,_0x15230f){return _0x2f5edc['define']('WhatsappApplication',attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7673('0x8')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 97fe338..94ea324 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 _0x5fd1=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','WhatsappApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash'];(function(_0x30e9e3,_0x3743a5){var _0x3365d8=function(_0x264ea1){while(--_0x264ea1){_0x30e9e3['push'](_0x30e9e3['shift']());}};_0x3365d8(++_0x3743a5);}(_0x5fd1,0x155));var _0x15fd=function(_0x76c201,_0x49358c){_0x76c201=_0x76c201-0x0;var _0x13ee67=_0x5fd1[_0x76c201];return _0x13ee67;};'use strict';var _=require(_0x15fd('0x0'));var util=require('util');var moment=require(_0x15fd('0x1'));var BPromise=require(_0x15fd('0x2'));var rs=require(_0x15fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x15fd('0x4'));var logger=require(_0x15fd('0x5'))(_0x15fd('0x6'));var config=require('../../config/environment');var jayson=require(_0x15fd('0x7'));var client=jayson[_0x15fd('0x8')][_0x15fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e88bf,_0x225728,_0x534e63){return new BPromise(function(_0x210e90,_0x1ee117){return client[_0x15fd('0xa')](_0x2e88bf,_0x534e63)['then'](function(_0x2d2fbb){logger['info'](_0x15fd('0xb'),_0x225728,_0x15fd('0xc'));logger['debug']('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x225728,'request\x20sent',JSON[_0x15fd('0xd')](_0x2d2fbb));if(_0x2d2fbb[_0x15fd('0xe')]){if(_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0xf')]===0x1f4){logger[_0x15fd('0xe')](_0x15fd('0xb'),_0x225728,_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);return _0x1ee117(_0x2d2fbb[_0x15fd('0xe')]['message']);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x225728,_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);return _0x210e90(_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);}else{logger[_0x15fd('0x11')](_0x15fd('0xb'),_0x225728,_0x15fd('0xc'));_0x210e90(_0x2d2fbb[_0x15fd('0x12')]['message']);}})['catch'](function(_0x25f139){logger['error'](_0x15fd('0xb'),_0x225728,_0x25f139);_0x1ee117(_0x25f139);});});} \ No newline at end of file +var _0x54ef=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x32188f,_0x2e599b){var _0x51d58f=function(_0x39df8a){while(--_0x39df8a){_0x32188f['push'](_0x32188f['shift']());}};_0x51d58f(++_0x2e599b);}(_0x54ef,0x112));var _0xf54e=function(_0x57e649,_0x2c1c37){_0x57e649=_0x57e649-0x0;var _0x779287=_0x54ef[_0x57e649];return _0x779287;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99cf9,_0x2464ae,_0x561870){return new BPromise(function(_0x27e69b,_0x57a1ce){return client[_0xf54e('0xb')](_0x99cf9,_0x561870)[_0xf54e('0xc')](function(_0x47c5e1){logger[_0xf54e('0xd')](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));logger[_0xf54e('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x2464ae,_0xf54e('0xf'),JSON[_0xf54e('0x11')](_0x47c5e1));if(_0x47c5e1[_0xf54e('0x12')]){if(_0x47c5e1[_0xf54e('0x12')]['code']===0x1f4){logger[_0xf54e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2464ae,_0x47c5e1['error'][_0xf54e('0x13')]);return _0x57a1ce(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}logger[_0xf54e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2464ae,_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);return _0x27e69b(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}else{logger['info'](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));_0x27e69b(_0x47c5e1[_0xf54e('0x14')]['message']);}})['catch'](function(_0xd87020){logger[_0xf54e('0x12')](_0xf54e('0xe'),_0x2464ae,_0xd87020);_0x57a1ce(_0xd87020);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index ee8c77c..da3a7db 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 _0x7046=['whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','show','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','whatsapp','addTags','put','/:id','whatsappinteraction:update','update','delete'];(function(_0x540d69,_0x182cab){var _0xafdc12=function(_0x30fec8){while(--_0x30fec8){_0x540d69['push'](_0x540d69['shift']());}};_0xafdc12(++_0x182cab);}(_0x7046,0x144));var _0x6704=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x7046[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var path=require(_0x6704('0x2'));var timeout=require(_0x6704('0x3'));var express=require('express');var router=express[_0x6704('0x4')]();var fs_extra=require(_0x6704('0x5'));var auth=require(_0x6704('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6704('0x7'));var controller=require(_0x6704('0x8'));router[_0x6704('0x9')]('/',auth[_0x6704('0xa')](),controller[_0x6704('0xb')]);router['get'](_0x6704('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x6704('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6704('0xd')]);router[_0x6704('0x9')](_0x6704('0xe'),auth[_0x6704('0xa')](),controller[_0x6704('0xf')]);router[_0x6704('0x9')](_0x6704('0x10'),auth[_0x6704('0xa')](),controller['download']);router[_0x6704('0x11')]('/',auth[_0x6704('0xa')](),controller['create']);router[_0x6704('0x11')](_0x6704('0xe'),auth[_0x6704('0xa')](),controller[_0x6704('0x12')]);router[_0x6704('0x11')](_0x6704('0x13'),auth[_0x6704('0xa')](),interaction[_0x6704('0x14')](_0x6704('0x15'),'whatsappinteraction:addtags'),controller[_0x6704('0x16')]);router[_0x6704('0x17')](_0x6704('0x18'),auth['isAuthenticated'](),interaction[_0x6704('0x14')](_0x6704('0x15'),_0x6704('0x19')),controller[_0x6704('0x1a')]);router[_0x6704('0x1b')]('/:id',auth[_0x6704('0xa')](),interaction[_0x6704('0x14')](_0x6704('0x15'),_0x6704('0x1c')),controller[_0x6704('0x1d')]);router['delete'](_0x6704('0x13'),auth[_0x6704('0xa')](),controller[_0x6704('0x1e')]);module[_0x6704('0x1f')]=router; \ No newline at end of file +var _0x0f4d=['isAuthenticated','/describe','describe','show','/:id/messages','getMessages','download','post','create','addMessage','whatsapp','addTags','tracked','whatsappinteraction:update','update','delete','/:id','destroy','/:id/tags','exports','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get'];(function(_0x2128d0,_0x3e7f05){var _0x5e16b8=function(_0x3199db){while(--_0x3199db){_0x2128d0['push'](_0x2128d0['shift']());}};_0x5e16b8(++_0x3e7f05);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x3ebde4,_0x59c67c){_0x3ebde4=_0x3ebde4-0x0;var _0xe5fb77=_0x0f4d[_0x3ebde4];return _0xe5fb77;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd0f4('0x0'));var express=require('express');var router=express[_0xd0f4('0x1')]();var fs_extra=require(_0xd0f4('0x2'));var auth=require(_0xd0f4('0x3'));var interaction=require(_0xd0f4('0x4'));var config=require(_0xd0f4('0x5'));var controller=require(_0xd0f4('0x6'));router[_0xd0f4('0x7')]('/',auth[_0xd0f4('0x8')](),controller['index']);router[_0xd0f4('0x7')](_0xd0f4('0x9'),auth['isAuthenticated'](),controller[_0xd0f4('0xa')]);router[_0xd0f4('0x7')]('/:id',auth[_0xd0f4('0x8')](),controller[_0xd0f4('0xb')]);router['get'](_0xd0f4('0xc'),auth[_0xd0f4('0x8')](),controller[_0xd0f4('0xd')]);router['get']('/:id/download',auth[_0xd0f4('0x8')](),controller[_0xd0f4('0xe')]);router[_0xd0f4('0xf')]('/',auth[_0xd0f4('0x8')](),controller[_0xd0f4('0x10')]);router[_0xd0f4('0xf')](_0xd0f4('0xc'),auth['isAuthenticated'](),controller[_0xd0f4('0x11')]);router[_0xd0f4('0xf')]('/:id/tags',auth[_0xd0f4('0x8')](),interaction['tracked'](_0xd0f4('0x12'),'whatsappinteraction:addtags'),controller[_0xd0f4('0x13')]);router['put']('/:id',auth['isAuthenticated'](),interaction[_0xd0f4('0x14')](_0xd0f4('0x12'),_0xd0f4('0x15')),controller[_0xd0f4('0x16')]);router[_0xd0f4('0x17')](_0xd0f4('0x18'),auth[_0xd0f4('0x8')](),interaction[_0xd0f4('0x14')](_0xd0f4('0x12'),'whatsappinteraction:destroy'),controller[_0xd0f4('0x19')]);router[_0xd0f4('0x17')](_0xd0f4('0x1a'),auth[_0xd0f4('0x8')](),controller['removeTags']);module[_0xd0f4('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 65eaa4f..2b6baf0 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 _0x315f=['out','ENUM','BOOLEAN','INTEGER','sequelize','exports','STRING','DATE'];(function(_0xb292f9,_0x42a4bc){var _0x366dab=function(_0x3c8359){while(--_0x3c8359){_0xb292f9['push'](_0xb292f9['shift']());}};_0x366dab(++_0x42a4bc);}(_0x315f,0x174));var _0xf315=function(_0x43941d,_0x45fd0d){_0x43941d=_0x43941d-0x0;var _0x27b82a=_0x315f[_0x43941d];return _0x27b82a;};'use strict';var Sequelize=require(_0xf315('0x0'));var moment=require('moment');module[_0xf315('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xf315('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xf315('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xf315('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf315('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xf315('0x5')]('in',_0xf315('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xf315('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xf315('0x7')]}}; \ No newline at end of file +var _0xa467=['moment','exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize'];(function(_0x23eef6,_0xbab2d7){var _0x16bd59=function(_0x186fe4){while(--_0x186fe4){_0x23eef6['push'](_0x23eef6['shift']());}};_0x16bd59(++_0xbab2d7);}(_0xa467,0x143));var _0x7a46=function(_0x122f59,_0x1c6299){_0x122f59=_0x122f59-0x0;var _0x1bbb8e=_0xa467[_0x122f59];return _0x1bbb8e;};'use strict';var Sequelize=require(_0x7a46('0x0'));var moment=require(_0x7a46('0x1'));module[_0x7a46('0x2')]={'closed':{'type':Sequelize[_0x7a46('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7a46('0x4')]},'disposition':{'type':Sequelize[_0x7a46('0x5')]},'secondDisposition':{'type':Sequelize[_0x7a46('0x5')]},'thirdDisposition':{'type':Sequelize[_0x7a46('0x5')]},'note':{'type':Sequelize[_0x7a46('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x7a46('0x6')]('in',_0x7a46('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7a46('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x7a46('0x6')]('in',_0x7a46('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7a46('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 76f042d..5da9ca8 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 _0xecd1=['WhatsappInteraction','rawAttributes','getOptions','findAll','whatsapp','query','catch','show','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','create','body','find','params','destroy','describe','WhatsappMessage','ids','omit','findOne','hasOwnProperty','nolimit','order','sort','pick','WhatsappInteractionId','filter','where','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','rows','setTags','spread','color','whatsappInteractionTags:save','removeTags','download','unix','toString','files','tmp','join','root','server','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','WhatsappAccount','Owner','get','mkdirSync','Whatsapp','Account','N.A.','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','Contact','out','read','value','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','bluebird','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','update','then','end','error','stack','name','send','index','map'];(function(_0x43ed38,_0x507af1){var _0x181497=function(_0x153d8e){while(--_0x153d8e){_0x43ed38['push'](_0x43ed38['shift']());}};_0x181497(++_0x507af1);}(_0xecd1,0x15d));var _0x1ecd=function(_0xa91414,_0x567adf){_0xa91414=_0xa91414-0x0;var _0x49710a=_0xecd1[_0xa91414];return _0x49710a;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x1ecd('0x0'));var util=require(_0x1ecd('0x1'));var path=require(_0x1ecd('0x2'));var ejs=require(_0x1ecd('0x3'));var fs=require('fs');var _=require(_0x1ecd('0x4'));var Redis=require('ioredis');var interaction=require(_0x1ecd('0x5'));var qs=require(_0x1ecd('0x6'));var pdf=require(_0x1ecd('0x7'));var logger=require(_0x1ecd('0x8'))(_0x1ecd('0x9'));var config=require(_0x1ecd('0xa'));var db=require(_0x1ecd('0xb'))['db'];config[_0x1ecd('0xc')]=_[_0x1ecd('0xd')](config['redis'],{'host':_0x1ecd('0xe'),'port':0x18eb});var socket=require(_0x1ecd('0xf'))(new Redis(config[_0x1ecd('0xc')]));require('./whatsappInteraction.socket')[_0x1ecd('0x10')](socket);function respondWithStatusCode(_0x5d7e2b,_0x4a4ccf){_0x4a4ccf=_0x4a4ccf||0xcc;return function(_0x4280ed){if(_0x4280ed){return _0x5d7e2b[_0x1ecd('0x11')](_0x4a4ccf);}return _0x5d7e2b[_0x1ecd('0x12')](_0x4a4ccf)['end']();};}function respondWithResult(_0x38234e,_0x267cb9){_0x267cb9=_0x267cb9||0xc8;return function(_0x9308ab){if(_0x9308ab){return _0x38234e[_0x1ecd('0x12')](_0x267cb9)['json'](_0x9308ab);}};}function respondWithFilteredResult(_0x866b21,_0x43e330){return function(_0x5b4c08){if(_0x5b4c08){var _0x3c743f=typeof _0x43e330[_0x1ecd('0x13')]===_0x1ecd('0x14')&&typeof _0x43e330[_0x1ecd('0x15')]===_0x1ecd('0x14');var _0x310e65=_0x5b4c08[_0x1ecd('0x16')];var _0x5019ab=_0x3c743f?0x0:_0x43e330[_0x1ecd('0x13')];var _0x5370cd=_0x3c743f?_0x5b4c08[_0x1ecd('0x16')]:_0x43e330[_0x1ecd('0x13')]+_0x43e330['limit'];var _0x3a0cd4;if(_0x5370cd>=_0x310e65){_0x5370cd=_0x310e65;_0x3a0cd4=0xc8;}else{_0x3a0cd4=0xce;}_0x866b21[_0x1ecd('0x12')](_0x3a0cd4);return _0x866b21[_0x1ecd('0x17')](_0x1ecd('0x18'),_0x5019ab+'-'+_0x5370cd+'/'+_0x310e65)[_0x1ecd('0x19')](_0x5b4c08);}return null;};}function saveUpdates(_0x183267){return function(_0x13d7ca){if(_0x13d7ca){return _0x13d7ca[_0x1ecd('0x1a')](_0x183267)[_0x1ecd('0x1b')](function(_0x4731f9){return _0x4731f9;});}return null;};}function removeEntity(_0x2bea11){return function(_0x33e78a){if(_0x33e78a){return _0x33e78a['destroy']()[_0x1ecd('0x1b')](function(){_0x2bea11[_0x1ecd('0x12')](0xcc)[_0x1ecd('0x1c')]();});}};}function handleEntityNotFound(_0x350260){return function(_0x1eb08d){if(!_0x1eb08d){_0x350260['sendStatus'](0x194);}return _0x1eb08d;};}function handleError(_0x2bc8aa,_0x8fba98){_0x8fba98=_0x8fba98||0x1f4;return function(_0x21d057){logger[_0x1ecd('0x1d')](_0x21d057[_0x1ecd('0x1e')]);if(_0x21d057[_0x1ecd('0x1f')]){delete _0x21d057[_0x1ecd('0x1f')];}_0x2bc8aa['status'](_0x8fba98)[_0x1ecd('0x20')](_0x21d057);};}exports[_0x1ecd('0x21')]=function(_0x2ee317,_0x7fdad){var _0x3e1fe7={};var _0x1f027b=_[_0x1ecd('0x22')](db[_0x1ecd('0x23')][_0x1ecd('0x24')],function(_0x3373dd){return{'name':_0x3373dd['fieldName'],'type':_0x3373dd['type']['key']};});_0x3e1fe7=qs[_0x1ecd('0x25')](_0x1f027b,_0x2ee317);return interaction[_0x1ecd('0x26')](_0x1ecd('0x27'),_0x2ee317[_0x1ecd('0x28')],_0x2ee317['user'],_0x3e1fe7,_0x1f027b)[_0x1ecd('0x1b')](respondWithFilteredResult(_0x7fdad,_0x3e1fe7))[_0x1ecd('0x29')](handleError(_0x7fdad,null));};exports[_0x1ecd('0x2a')]=function(_0x23d890,_0x1b280e){var _0x2b22e2={'raw':![],'where':{'id':_0x23d890['params']['id']}},_0x3f477c={};_0x3f477c[_0x1ecd('0x2b')]=_[_0x1ecd('0x2c')](db['WhatsappInteraction'][_0x1ecd('0x24')]);_0x3f477c[_0x1ecd('0x28')]=_[_0x1ecd('0x2c')](_0x23d890[_0x1ecd('0x28')]);_0x3f477c[_0x1ecd('0x2d')]=_[_0x1ecd('0x2e')](_0x3f477c[_0x1ecd('0x2b')],_0x3f477c['query']);_0x2b22e2[_0x1ecd('0x2f')]=_[_0x1ecd('0x2e')](_0x3f477c[_0x1ecd('0x2b')],qs['fields'](_0x23d890[_0x1ecd('0x28')][_0x1ecd('0x30')]));_0x2b22e2['attributes']=_0x2b22e2['attributes'][_0x1ecd('0x31')]?_0x2b22e2[_0x1ecd('0x2f')]:_0x3f477c[_0x1ecd('0x2b')];if(_0x23d890['query'][_0x1ecd('0x32')]){_0x2b22e2[_0x1ecd('0x33')]=[{'all':!![]}];}_0x2b22e2=_[_0x1ecd('0x34')]({},_0x2b22e2,_0x23d890['options']);return db[_0x1ecd('0x23')]['find'](_0x2b22e2)[_0x1ecd('0x1b')](handleEntityNotFound(_0x1b280e,null))[_0x1ecd('0x1b')](respondWithResult(_0x1b280e,null))[_0x1ecd('0x29')](handleError(_0x1b280e,null));};exports[_0x1ecd('0x35')]=function(_0x36469b,_0x414a5b){return db[_0x1ecd('0x23')][_0x1ecd('0x35')](_0x36469b[_0x1ecd('0x36')],{})[_0x1ecd('0x1b')](respondWithResult(_0x414a5b,0xc9))[_0x1ecd('0x29')](handleError(_0x414a5b,null));};exports[_0x1ecd('0x1a')]=function(_0xbe1436,_0x34879f){if(_0xbe1436['body']['id']){delete _0xbe1436[_0x1ecd('0x36')]['id'];}return db[_0x1ecd('0x23')][_0x1ecd('0x37')]({'where':{'id':_0xbe1436[_0x1ecd('0x38')]['id']}})[_0x1ecd('0x1b')](handleEntityNotFound(_0x34879f,null))[_0x1ecd('0x1b')](saveUpdates(_0xbe1436[_0x1ecd('0x36')],null))['then'](respondWithResult(_0x34879f,null))[_0x1ecd('0x29')](handleError(_0x34879f,null));};exports[_0x1ecd('0x39')]=function(_0x5d5a7b,_0x2734bf){return db['WhatsappInteraction'][_0x1ecd('0x37')]({'where':{'id':_0x5d5a7b[_0x1ecd('0x38')]['id']}})[_0x1ecd('0x1b')](handleEntityNotFound(_0x2734bf,null))[_0x1ecd('0x1b')](removeEntity(_0x2734bf,null))['catch'](handleError(_0x2734bf,null));};exports[_0x1ecd('0x3a')]=function(_0x1bbb55,_0x55e30a){return db[_0x1ecd('0x23')][_0x1ecd('0x3a')]()['then'](respondWithResult(_0x55e30a,null))[_0x1ecd('0x29')](handleError(_0x55e30a,null));};exports['addMessage']=function(_0x4eeec6,_0x484692){return db[_0x1ecd('0x3b')]['find']({'where':{'id':_0x4eeec6[_0x1ecd('0x38')]['id']}})['then'](handleEntityNotFound(_0x484692,null))[_0x1ecd('0x1b')](function(_0x4ef23b){if(_0x4ef23b){return _0x4ef23b['addMessage'](_0x4eeec6[_0x1ecd('0x36')][_0x1ecd('0x3c')],_[_0x1ecd('0x3d')](_0x4eeec6[_0x1ecd('0x36')],[_0x1ecd('0x3c'),'id'])||{});}})[_0x1ecd('0x1b')](respondWithResult(_0x484692,null))['catch'](handleError(_0x484692,null));};exports['getMessages']=function(_0x1df15a,_0x5729cf){var _0x160f97={'raw':![],'where':{}};var _0xf96bae={};var _0x490f81={'count':0x0,'rows':[]};return db[_0x1ecd('0x23')][_0x1ecd('0x3e')]({'where':{'id':_0x1df15a[_0x1ecd('0x38')]['id']}})['then'](handleEntityNotFound(_0x5729cf,null))[_0x1ecd('0x1b')](function(_0x171e75){if(_0x171e75){_0xf96bae['model']=_['keys'](db['WhatsappMessage'][_0x1ecd('0x24')]);_0xf96bae[_0x1ecd('0x28')]=_[_0x1ecd('0x2c')](_0x1df15a[_0x1ecd('0x28')]);_0xf96bae['filters']=_[_0x1ecd('0x2e')](_0xf96bae[_0x1ecd('0x2b')],_0xf96bae[_0x1ecd('0x28')]);_0x160f97[_0x1ecd('0x2f')]=_[_0x1ecd('0x2e')](_0xf96bae[_0x1ecd('0x2b')],qs[_0x1ecd('0x30')](_0x1df15a[_0x1ecd('0x28')]['fields']));_0x160f97[_0x1ecd('0x2f')]=_0x160f97['attributes'][_0x1ecd('0x31')]?_0x160f97['attributes']:_0xf96bae[_0x1ecd('0x2b')];if(!_0x1df15a[_0x1ecd('0x28')][_0x1ecd('0x3f')](_0x1ecd('0x40'))){_0x160f97[_0x1ecd('0x15')]=qs['limit'](_0x1df15a[_0x1ecd('0x28')][_0x1ecd('0x15')]);_0x160f97[_0x1ecd('0x13')]=qs[_0x1ecd('0x13')](_0x1df15a['query']['offset']);}_0x160f97[_0x1ecd('0x41')]=qs[_0x1ecd('0x42')](_0x1df15a[_0x1ecd('0x28')][_0x1ecd('0x42')]);_0x160f97['where']=qs['filters'](_[_0x1ecd('0x43')](_0x1df15a[_0x1ecd('0x28')],_0xf96bae[_0x1ecd('0x2d')]));_0x160f97['where'][_0x1ecd('0x44')]=_0x171e75['id'];if(_0x1df15a['query'][_0x1ecd('0x45')]){_0x160f97[_0x1ecd('0x46')]=_['merge'](_0x160f97[_0x1ecd('0x46')],{'$or':_['map'](_0x160f97['attributes'],function(_0x18e73d){var _0xadf07c={};_0xadf07c[_0x18e73d]={'$like':'%'+_0x1df15a[_0x1ecd('0x28')][_0x1ecd('0x45')]+'%'};return _0xadf07c;})});}if(_0x1df15a[_0x1ecd('0x28')][_0x1ecd('0x47')]){var _0x15358d=_0x1df15a[_0x1ecd('0x28')][_0x1ecd('0x47')][_0x1ecd('0x48')](',');var _0x37c48f={};_0x37c48f[_0x15358d[0x0]]={'$gte':moment(_0x15358d[0x1])[_0x1ecd('0x49')](_0x1ecd('0x4a'))};_0x160f97[_0x1ecd('0x46')]=_[_0x1ecd('0x34')](_0x160f97[_0x1ecd('0x46')],_0x37c48f);}_0x160f97=_['merge']({},_0x160f97,_0x1df15a[_0x1ecd('0x4b')]);return db[_0x1ecd('0x3b')]['count']({'where':_0x160f97[_0x1ecd('0x46')]})['then'](function(_0xaa4c72){_0x490f81['count']=_0xaa4c72;if(_0x1df15a[_0x1ecd('0x28')]['includeAll']){_0x160f97['include']=[{'all':!![]}];}return db[_0x1ecd('0x3b')][_0x1ecd('0x26')](_0x160f97);})['then'](function(_0x374721){_0x490f81[_0x1ecd('0x4c')]=_0x374721;return _0x490f81;});}})[_0x1ecd('0x1b')](respondWithFilteredResult(_0x5729cf,_0x160f97))[_0x1ecd('0x29')](handleError(_0x5729cf,null));};exports['addTags']=function(_0xc31504,_0x113d66){return db[_0x1ecd('0x23')][_0x1ecd('0x37')]({'where':{'id':_0xc31504['params']['id']}})[_0x1ecd('0x1b')](handleEntityNotFound(_0x113d66,null))[_0x1ecd('0x1b')](function(_0x5c8bd9){if(_0x5c8bd9){return _0x5c8bd9[_0x1ecd('0x4d')](_0xc31504[_0x1ecd('0x36')]['ids'],_['omit'](_0xc31504[_0x1ecd('0x36')],[_0x1ecd('0x3c'),'id'])||{})[_0x1ecd('0x4e')](function(){return db['Tag'][_0x1ecd('0x26')]({'attributes':['id',_0x1ecd('0x1f'),_0x1ecd('0x4f')],'where':{'id':_0xc31504[_0x1ecd('0x36')][_0x1ecd('0x3c')]}});})['then'](function(_0x3287bd){socket['emit'](_0x1ecd('0x50'),{'id':Number(_0xc31504[_0x1ecd('0x38')]['id']),'tags':_0x3287bd||[]});return{'id':Number(_0xc31504[_0x1ecd('0x38')]['id']),'tags':_0x3287bd||[]};});}})[_0x1ecd('0x1b')](respondWithResult(_0x113d66,null))[_0x1ecd('0x29')](handleError(_0x113d66,null));};exports[_0x1ecd('0x51')]=function(_0x552ad9,_0xa7cb56){return db[_0x1ecd('0x23')]['find']({'where':{'id':_0x552ad9[_0x1ecd('0x38')]['id']}})[_0x1ecd('0x1b')](handleEntityNotFound(_0xa7cb56,null))[_0x1ecd('0x1b')](function(_0x45e7b7){if(_0x45e7b7){return _0x45e7b7['removeTags'](_0x552ad9[_0x1ecd('0x28')][_0x1ecd('0x3c')]);}})['then'](respondWithStatusCode(_0xa7cb56,null))[_0x1ecd('0x29')](handleError(_0xa7cb56,null));};exports[_0x1ecd('0x52')]=function(_0x40de25,_0x518a0c){var _0x1f5e73=moment()[_0x1ecd('0x53')]()[_0x1ecd('0x54')]();var _0x49e8b2=path['join'](config['root'],'server',_0x1ecd('0x55'),_0x1ecd('0x56'));var _0x2b144d=path[_0x1ecd('0x57')](config[_0x1ecd('0x58')],_0x1ecd('0x59'),_0x1ecd('0x55'),_0x1ecd('0x5a'));var _0x27578e=path[_0x1ecd('0x57')](_0x49e8b2,_0x1f5e73);var _0x3b2559=util[_0x1ecd('0x49')](_0x1ecd('0x5b'),_0x40de25[_0x1ecd('0x38')]['id'],_0x1f5e73);var _0x250d1c=path[_0x1ecd('0x57')](_0x49e8b2,_0x3b2559);var _0x21adea=[];_0x21adea[_0x1ecd('0x5c')]({'model':db[_0x1ecd('0x5d')],'as':_0x1ecd('0x5d'),'attributes':['id',_0x1ecd('0x5e')],'raw':!![]});_0x21adea[_0x1ecd('0x5c')]({'model':db[_0x1ecd('0x5f')],'as':'Contact','attributes':['id',_0x1ecd('0x60'),_0x1ecd('0x61')],'raw':!![]});if(_0x40de25['query'][_0x1ecd('0x5a')]){_0x21adea['push']({'model':db[_0x1ecd('0x62')],'as':_0x1ecd('0x62'),'raw':!![]});}var _0x1876fc=[{'model':db[_0x1ecd('0x3b')],'as':_0x1ecd('0x63'),'attributes':['id',_0x1ecd('0x36'),_0x1ecd('0x64'),_0x1ecd('0x65'),_0x1ecd('0x66'),'read'],'include':_0x21adea}];_0x1876fc[_0x1ecd('0x5c')]({'model':db[_0x1ecd('0x67')],'as':'Account','attributes':['id',_0x1ecd('0x1f')]});_0x1876fc[_0x1ecd('0x5c')]({'model':db['User'],'as':_0x1ecd('0x68'),'attributes':['id',_0x1ecd('0x5e')]});return db[_0x1ecd('0x23')][_0x1ecd('0x37')]({'where':{'id':_0x40de25[_0x1ecd('0x38')]['id']},'include':_0x1876fc})[_0x1ecd('0x1b')](handleEntityNotFound(_0x518a0c,null))[_0x1ecd('0x1b')](function(_0x5949fc){if(_0x5949fc){var _0x2652b5=_0x5949fc[_0x1ecd('0x69')]({'plain':!![]});fs[_0x1ecd('0x6a')](_0x27578e);var _0x276113={'channel':_0x1ecd('0x6b'),'account':_0x2652b5[_0x1ecd('0x6c')][_0x1ecd('0x1f')],'agent':_0x2652b5[_0x1ecd('0x68')]?_0x2652b5[_0x1ecd('0x68')]['fullname']:_0x1ecd('0x6d'),'createdAt':moment(_0x2652b5[_0x1ecd('0x64')])[_0x1ecd('0x49')](_0x1ecd('0x4a'))[_0x1ecd('0x54')](),'closedAt':_0x2652b5['closed']?moment(_0x2652b5[_0x1ecd('0x6e')])[_0x1ecd('0x49')](_0x1ecd('0x4a'))['toString']():'','disposition':_0x2652b5[_0x1ecd('0x6f')],'messages':_(_0x2652b5['Messages'])[_0x1ecd('0x45')]({'secret':![]})[_0x1ecd('0x22')](function(_0xf5051e){if(_0xf5051e[_0x1ecd('0x62')]){var _0x484c89=path[_0x1ecd('0x57')](_0x2b144d,_0xf5051e[_0x1ecd('0x62')][_0x1ecd('0x70')]);if(fs[_0x1ecd('0x71')](_0x484c89)){fs[_0x1ecd('0x72')](_0x484c89)[_0x1ecd('0x73')](fs[_0x1ecd('0x74')](path[_0x1ecd('0x57')](_0x27578e,_0xf5051e['Attachment']['basename'])));}}return{'date':moment(_0xf5051e[_0x1ecd('0x64')])[_0x1ecd('0x49')]('YYYY-MM-DD\x20HH:mm:ss')[_0x1ecd('0x54')](),'sender':_0xf5051e[_0x1ecd('0x65')]==='out'?_0xf5051e[_0x1ecd('0x5d')]?_0xf5051e[_0x1ecd('0x5d')][_0x1ecd('0x5e')]:'System':_0xf5051e[_0x1ecd('0x75')][_0x1ecd('0x60')]+(_0xf5051e['Contact']['lastName']?'\x20'+_0xf5051e[_0x1ecd('0x75')]['lastName']:''),'body':_0xf5051e[_0x1ecd('0x62')]?_0xf5051e[_0x1ecd('0x62')][_0x1ecd('0x70')]:_0xf5051e['body'],'direction':_0xf5051e['direction']===_0x1ecd('0x76')?'A':'C','secret':_0xf5051e[_0x1ecd('0x66')],'read':_0xf5051e[_0x1ecd('0x77')],'attachment':_0xf5051e[_0x1ecd('0x62')]};})[_0x1ecd('0x78')]()};return ejs['renderFile'](path[_0x1ecd('0x57')](config[_0x1ecd('0x58')],_0x1ecd('0x59'),'views',_0x1ecd('0x79')),{'interaction':_0x276113})[_0x1ecd('0x1b')](function(_0x246a15){var _0x44a4da=path[_0x1ecd('0x57')](_0x27578e,_0x1ecd('0x7a')+_0x2652b5['id']+'-'+_0x1f5e73+_0x1ecd('0x7b'));var _0x5bd9b8={'path':_0x44a4da,'channel':_0x1ecd('0x6b'),'interactionId':_0x2652b5['id']};return pdf[_0x1ecd('0x7c')](_0x246a15,_0x5bd9b8);})[_0x1ecd('0x1b')](function(){return new BPromise(function(_0x16733e,_0x29866c){zipdir(_0x27578e,{'saveTo':_0x250d1c},function(_0x1ac794,_0xf88f1f){if(_0x1ac794)return _0x29866c(_0x1ac794);return _0x16733e(_0xf88f1f);});})['then'](function(){return new BPromise(function(_0x479520,_0x269b6f){rimraf(_0x27578e,function(_0x4ce70e){if(_0x4ce70e)_0x269b6f(_0x4ce70e);return _0x479520();});});})[_0x1ecd('0x1b')](function(){return _0x518a0c[_0x1ecd('0x52')](_0x250d1c,_0x3b2559,function(_0x30a31c){if(_0x30a31c){console[_0x1ecd('0x7d')](_0x1ecd('0x7e'),_0x30a31c);}else{fs[_0x1ecd('0x7f')](_0x250d1c);}});});});}else{return _0x518a0c[_0x1ecd('0x11')](0xc8);}})[_0x1ecd('0x29')](handleError(_0x518a0c,null));}; \ No newline at end of file +var _0x5040=['ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','destroy','then','error','stack','name','send','map','WhatsappInteraction','fieldName','type','findAll','whatsapp','catch','params','model','rawAttributes','query','filters','attributes','intersection','fields','include','merge','create','body','find','describe','WhatsappMessage','addMessage','ids','omit','getMessages','findOne','keys','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','Tag','color','emit','whatsappInteractionTags:save','removeTags','toString','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','firstName','lastName','Attachment','Messages','createdAt','direction','WhatsappAccount','Owner','get','mkdirSync','Whatsapp','Account','N.A.','disposition','basename','createReadStream','createWriteStream','out','System','Contact','read','renderFile','transcript-','.pdf','createPdfFromHTML','log','err','zip-dir','moment','util','ejs','lodash'];(function(_0x2e4891,_0x5a8e66){var _0x1c7d67=function(_0x17f65b){while(--_0x17f65b){_0x2e4891['push'](_0x2e4891['shift']());}};_0x1c7d67(++_0x5a8e66);}(_0x5040,0x70));var _0x0504=function(_0x2998b8,_0x30e024){_0x2998b8=_0x2998b8-0x0;var _0x215ec2=_0x5040[_0x2998b8];return _0x215ec2;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x0504('0x0'));var moment=require(_0x0504('0x1'));var BPromise=require('bluebird');var util=require(_0x0504('0x2'));var path=require('path');var ejs=require(_0x0504('0x3'));var fs=require('fs');var _=require(_0x0504('0x4'));var Redis=require(_0x0504('0x5'));var interaction=require(_0x0504('0x6'));var qs=require(_0x0504('0x7'));var pdf=require(_0x0504('0x8'));var logger=require('../../config/logger')(_0x0504('0x9'));var config=require(_0x0504('0xa'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0504('0xb')](config[_0x0504('0xc')],{'host':_0x0504('0xd'),'port':0x18eb});var socket=require(_0x0504('0xe'))(new Redis(config['redis']));require(_0x0504('0xf'))[_0x0504('0x10')](socket);function respondWithStatusCode(_0x2d5f98,_0x10f7c5){_0x10f7c5=_0x10f7c5||0xcc;return function(_0x152d70){if(_0x152d70){return _0x2d5f98[_0x0504('0x11')](_0x10f7c5);}return _0x2d5f98[_0x0504('0x12')](_0x10f7c5)[_0x0504('0x13')]();};}function respondWithResult(_0x272781,_0xf10bea){_0xf10bea=_0xf10bea||0xc8;return function(_0x4d2d64){if(_0x4d2d64){return _0x272781[_0x0504('0x12')](_0xf10bea)[_0x0504('0x14')](_0x4d2d64);}};}function respondWithFilteredResult(_0x543764,_0x7d0590){return function(_0x2d7564){if(_0x2d7564){var _0x3a25ae=typeof _0x7d0590[_0x0504('0x15')]==='undefined'&&typeof _0x7d0590[_0x0504('0x16')]===_0x0504('0x17');var _0x2f33cf=_0x2d7564['count'];var _0x3730d5=_0x3a25ae?0x0:_0x7d0590[_0x0504('0x15')];var _0x325400=_0x3a25ae?_0x2d7564[_0x0504('0x18')]:_0x7d0590[_0x0504('0x15')]+_0x7d0590[_0x0504('0x16')];var _0x27fb32;if(_0x325400>=_0x2f33cf){_0x325400=_0x2f33cf;_0x27fb32=0xc8;}else{_0x27fb32=0xce;}_0x543764[_0x0504('0x12')](_0x27fb32);return _0x543764[_0x0504('0x19')](_0x0504('0x1a'),_0x3730d5+'-'+_0x325400+'/'+_0x2f33cf)[_0x0504('0x14')](_0x2d7564);}return null;};}function saveUpdates(_0x2041e9){return function(_0x139167){if(_0x139167){return _0x139167['update'](_0x2041e9)['then'](function(_0x5c484d){return _0x5c484d;});}return null;};}function removeEntity(_0x46f450){return function(_0x189920){if(_0x189920){return _0x189920[_0x0504('0x1b')]()[_0x0504('0x1c')](function(){_0x46f450[_0x0504('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31536c){return function(_0x388df0){if(!_0x388df0){_0x31536c[_0x0504('0x11')](0x194);}return _0x388df0;};}function handleError(_0xf6165b,_0x1d02d9){_0x1d02d9=_0x1d02d9||0x1f4;return function(_0x4c6b56){logger[_0x0504('0x1d')](_0x4c6b56[_0x0504('0x1e')]);if(_0x4c6b56[_0x0504('0x1f')]){delete _0x4c6b56['name'];}_0xf6165b[_0x0504('0x12')](_0x1d02d9)[_0x0504('0x20')](_0x4c6b56);};}exports['index']=function(_0x401e25,_0x1eba0b){var _0x382478={};var _0x392987=_[_0x0504('0x21')](db[_0x0504('0x22')]['rawAttributes'],function(_0xfcbee1){return{'name':_0xfcbee1[_0x0504('0x23')],'type':_0xfcbee1[_0x0504('0x24')]['key']};});_0x382478=qs['getOptions'](_0x392987,_0x401e25);return interaction[_0x0504('0x25')](_0x0504('0x26'),_0x401e25['query'],_0x401e25['user'],_0x382478,_0x392987)['then'](respondWithFilteredResult(_0x1eba0b,_0x382478))[_0x0504('0x27')](handleError(_0x1eba0b,null));};exports['show']=function(_0x2e0d7a,_0x274422){var _0x4a58ac={'raw':![],'where':{'id':_0x2e0d7a[_0x0504('0x28')]['id']}},_0x57f2e0={};_0x57f2e0[_0x0504('0x29')]=_['keys'](db[_0x0504('0x22')][_0x0504('0x2a')]);_0x57f2e0[_0x0504('0x2b')]=_['keys'](_0x2e0d7a[_0x0504('0x2b')]);_0x57f2e0[_0x0504('0x2c')]=_['intersection'](_0x57f2e0[_0x0504('0x29')],_0x57f2e0['query']);_0x4a58ac[_0x0504('0x2d')]=_[_0x0504('0x2e')](_0x57f2e0[_0x0504('0x29')],qs['fields'](_0x2e0d7a[_0x0504('0x2b')][_0x0504('0x2f')]));_0x4a58ac[_0x0504('0x2d')]=_0x4a58ac[_0x0504('0x2d')]['length']?_0x4a58ac[_0x0504('0x2d')]:_0x57f2e0[_0x0504('0x29')];if(_0x2e0d7a[_0x0504('0x2b')]['includeAll']){_0x4a58ac[_0x0504('0x30')]=[{'all':!![]}];}_0x4a58ac=_[_0x0504('0x31')]({},_0x4a58ac,_0x2e0d7a['options']);return db[_0x0504('0x22')]['find'](_0x4a58ac)[_0x0504('0x1c')](handleEntityNotFound(_0x274422,null))[_0x0504('0x1c')](respondWithResult(_0x274422,null))[_0x0504('0x27')](handleError(_0x274422,null));};exports['create']=function(_0x5c1776,_0x1246fb){return db[_0x0504('0x22')][_0x0504('0x32')](_0x5c1776[_0x0504('0x33')],{})[_0x0504('0x1c')](respondWithResult(_0x1246fb,0xc9))[_0x0504('0x27')](handleError(_0x1246fb,null));};exports['update']=function(_0x284ce0,_0x41d711){if(_0x284ce0[_0x0504('0x33')]['id']){delete _0x284ce0[_0x0504('0x33')]['id'];}return db[_0x0504('0x22')][_0x0504('0x34')]({'where':{'id':_0x284ce0[_0x0504('0x28')]['id']}})[_0x0504('0x1c')](handleEntityNotFound(_0x41d711,null))[_0x0504('0x1c')](saveUpdates(_0x284ce0['body'],null))[_0x0504('0x1c')](respondWithResult(_0x41d711,null))[_0x0504('0x27')](handleError(_0x41d711,null));};exports[_0x0504('0x1b')]=function(_0x36774d,_0x1c5336){return db[_0x0504('0x22')]['find']({'where':{'id':_0x36774d['params']['id']}})['then'](handleEntityNotFound(_0x1c5336,null))[_0x0504('0x1c')](removeEntity(_0x1c5336,null))['catch'](handleError(_0x1c5336,null));};exports['describe']=function(_0x185cd7,_0x4c55dc){return db[_0x0504('0x22')][_0x0504('0x35')]()[_0x0504('0x1c')](respondWithResult(_0x4c55dc,null))[_0x0504('0x27')](handleError(_0x4c55dc,null));};exports['addMessage']=function(_0x2b892d,_0x434ca7){return db[_0x0504('0x36')]['find']({'where':{'id':_0x2b892d['params']['id']}})['then'](handleEntityNotFound(_0x434ca7,null))[_0x0504('0x1c')](function(_0x2559cf){if(_0x2559cf){return _0x2559cf[_0x0504('0x37')](_0x2b892d[_0x0504('0x33')][_0x0504('0x38')],_[_0x0504('0x39')](_0x2b892d[_0x0504('0x33')],[_0x0504('0x38'),'id'])||{});}})[_0x0504('0x1c')](respondWithResult(_0x434ca7,null))[_0x0504('0x27')](handleError(_0x434ca7,null));};exports[_0x0504('0x3a')]=function(_0x59ac1b,_0x3acc2f){var _0x8b8272={'raw':![],'where':{}};var _0x351dec={};var _0x4fa1a8={'count':0x0,'rows':[]};return db[_0x0504('0x22')][_0x0504('0x3b')]({'where':{'id':_0x59ac1b[_0x0504('0x28')]['id']}})['then'](handleEntityNotFound(_0x3acc2f,null))[_0x0504('0x1c')](function(_0x3b53b6){if(_0x3b53b6){_0x351dec[_0x0504('0x29')]=_[_0x0504('0x3c')](db[_0x0504('0x36')][_0x0504('0x2a')]);_0x351dec[_0x0504('0x2b')]=_[_0x0504('0x3c')](_0x59ac1b[_0x0504('0x2b')]);_0x351dec[_0x0504('0x2c')]=_[_0x0504('0x2e')](_0x351dec[_0x0504('0x29')],_0x351dec[_0x0504('0x2b')]);_0x8b8272[_0x0504('0x2d')]=_['intersection'](_0x351dec['model'],qs['fields'](_0x59ac1b['query'][_0x0504('0x2f')]));_0x8b8272[_0x0504('0x2d')]=_0x8b8272[_0x0504('0x2d')][_0x0504('0x3d')]?_0x8b8272[_0x0504('0x2d')]:_0x351dec[_0x0504('0x29')];if(!_0x59ac1b['query'][_0x0504('0x3e')](_0x0504('0x3f'))){_0x8b8272[_0x0504('0x16')]=qs[_0x0504('0x16')](_0x59ac1b[_0x0504('0x2b')]['limit']);_0x8b8272[_0x0504('0x15')]=qs[_0x0504('0x15')](_0x59ac1b[_0x0504('0x2b')][_0x0504('0x15')]);}_0x8b8272[_0x0504('0x40')]=qs[_0x0504('0x41')](_0x59ac1b[_0x0504('0x2b')][_0x0504('0x41')]);_0x8b8272[_0x0504('0x42')]=qs['filters'](_[_0x0504('0x43')](_0x59ac1b[_0x0504('0x2b')],_0x351dec[_0x0504('0x2c')]));_0x8b8272[_0x0504('0x42')]['WhatsappInteractionId']=_0x3b53b6['id'];if(_0x59ac1b[_0x0504('0x2b')][_0x0504('0x44')]){_0x8b8272['where']=_['merge'](_0x8b8272[_0x0504('0x42')],{'$or':_[_0x0504('0x21')](_0x8b8272[_0x0504('0x2d')],function(_0xbf7f4){var _0x20e4be={};_0x20e4be[_0xbf7f4]={'$like':'%'+_0x59ac1b[_0x0504('0x2b')][_0x0504('0x44')]+'%'};return _0x20e4be;})});}if(_0x59ac1b[_0x0504('0x2b')][_0x0504('0x45')]){var _0x3c4162=_0x59ac1b[_0x0504('0x2b')][_0x0504('0x45')]['split'](',');var _0x5a7418={};_0x5a7418[_0x3c4162[0x0]]={'$gte':moment(_0x3c4162[0x1])[_0x0504('0x46')](_0x0504('0x47'))};_0x8b8272[_0x0504('0x42')]=_[_0x0504('0x31')](_0x8b8272[_0x0504('0x42')],_0x5a7418);}_0x8b8272=_[_0x0504('0x31')]({},_0x8b8272,_0x59ac1b['options']);return db[_0x0504('0x36')][_0x0504('0x18')]({'where':_0x8b8272[_0x0504('0x42')]})['then'](function(_0x286d5b){_0x4fa1a8[_0x0504('0x18')]=_0x286d5b;if(_0x59ac1b[_0x0504('0x2b')]['includeAll']){_0x8b8272[_0x0504('0x30')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x0504('0x25')](_0x8b8272);})[_0x0504('0x1c')](function(_0x26497b){_0x4fa1a8[_0x0504('0x48')]=_0x26497b;return _0x4fa1a8;});}})[_0x0504('0x1c')](respondWithFilteredResult(_0x3acc2f,_0x8b8272))['catch'](handleError(_0x3acc2f,null));};exports['addTags']=function(_0x11f305,_0x14b82d){return db[_0x0504('0x22')][_0x0504('0x34')]({'where':{'id':_0x11f305['params']['id']}})[_0x0504('0x1c')](handleEntityNotFound(_0x14b82d,null))[_0x0504('0x1c')](function(_0x5ed558){if(_0x5ed558){return _0x5ed558['setTags'](_0x11f305['body'][_0x0504('0x38')],_['omit'](_0x11f305[_0x0504('0x33')],[_0x0504('0x38'),'id'])||{})['spread'](function(){return db[_0x0504('0x49')]['findAll']({'attributes':['id','name',_0x0504('0x4a')],'where':{'id':_0x11f305[_0x0504('0x33')][_0x0504('0x38')]}});})[_0x0504('0x1c')](function(_0x4fe237){socket[_0x0504('0x4b')](_0x0504('0x4c'),{'id':Number(_0x11f305[_0x0504('0x28')]['id']),'tags':_0x4fe237||[]});return{'id':Number(_0x11f305[_0x0504('0x28')]['id']),'tags':_0x4fe237||[]};});}})[_0x0504('0x1c')](respondWithResult(_0x14b82d,null))['catch'](handleError(_0x14b82d,null));};exports[_0x0504('0x4d')]=function(_0x4b2098,_0x2bed5e){return db[_0x0504('0x22')][_0x0504('0x34')]({'where':{'id':_0x4b2098['params']['id']}})[_0x0504('0x1c')](handleEntityNotFound(_0x2bed5e,null))[_0x0504('0x1c')](function(_0xaa1692){if(_0xaa1692){return _0xaa1692[_0x0504('0x4d')](_0x4b2098['query'][_0x0504('0x38')]);}})['then'](respondWithStatusCode(_0x2bed5e,null))[_0x0504('0x27')](handleError(_0x2bed5e,null));};exports['download']=function(_0x29bb31,_0x169c77){var _0xff1a91=moment()['unix']()[_0x0504('0x4e')]();var _0x4b64b6=path[_0x0504('0x4f')](config[_0x0504('0x50')],'server',_0x0504('0x51'),_0x0504('0x52'));var _0x882030=path[_0x0504('0x4f')](config[_0x0504('0x50')],_0x0504('0x53'),_0x0504('0x51'),_0x0504('0x54'));var _0x266abb=path['join'](_0x4b64b6,_0xff1a91);var _0x2c3c3f=util[_0x0504('0x46')](_0x0504('0x55'),_0x29bb31[_0x0504('0x28')]['id'],_0xff1a91);var _0x3434d0=path['join'](_0x4b64b6,_0x2c3c3f);var _0x529b82=[];_0x529b82[_0x0504('0x56')]({'model':db[_0x0504('0x57')],'as':_0x0504('0x57'),'attributes':['id',_0x0504('0x58')],'raw':!![]});_0x529b82[_0x0504('0x56')]({'model':db[_0x0504('0x59')],'as':'Contact','attributes':['id',_0x0504('0x5a'),_0x0504('0x5b')],'raw':!![]});if(_0x29bb31[_0x0504('0x2b')][_0x0504('0x54')]){_0x529b82[_0x0504('0x56')]({'model':db[_0x0504('0x5c')],'as':'Attachment','raw':!![]});}var _0x19ced0=[{'model':db['WhatsappMessage'],'as':_0x0504('0x5d'),'attributes':['id',_0x0504('0x33'),_0x0504('0x5e'),_0x0504('0x5f'),'secret','read'],'include':_0x529b82}];_0x19ced0['push']({'model':db[_0x0504('0x60')],'as':'Account','attributes':['id','name']});_0x19ced0[_0x0504('0x56')]({'model':db[_0x0504('0x57')],'as':_0x0504('0x61'),'attributes':['id',_0x0504('0x58')]});return db[_0x0504('0x22')][_0x0504('0x34')]({'where':{'id':_0x29bb31[_0x0504('0x28')]['id']},'include':_0x19ced0})[_0x0504('0x1c')](handleEntityNotFound(_0x169c77,null))[_0x0504('0x1c')](function(_0x560846){if(_0x560846){var _0x50094d=_0x560846[_0x0504('0x62')]({'plain':!![]});fs[_0x0504('0x63')](_0x266abb);var _0x356eaa={'channel':_0x0504('0x64'),'account':_0x50094d[_0x0504('0x65')][_0x0504('0x1f')],'agent':_0x50094d[_0x0504('0x61')]?_0x50094d[_0x0504('0x61')][_0x0504('0x58')]:_0x0504('0x66'),'createdAt':moment(_0x50094d[_0x0504('0x5e')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x50094d['closed']?moment(_0x50094d['closedAt'])['format'](_0x0504('0x47'))['toString']():'','disposition':_0x50094d[_0x0504('0x67')],'messages':_(_0x50094d[_0x0504('0x5d')])[_0x0504('0x44')]({'secret':![]})['map'](function(_0x17409c){if(_0x17409c[_0x0504('0x5c')]){var _0x9c62c8=path[_0x0504('0x4f')](_0x882030,_0x17409c[_0x0504('0x5c')][_0x0504('0x68')]);if(fs['existsSync'](_0x9c62c8)){fs[_0x0504('0x69')](_0x9c62c8)['pipe'](fs[_0x0504('0x6a')](path[_0x0504('0x4f')](_0x266abb,_0x17409c[_0x0504('0x5c')][_0x0504('0x68')])));}}return{'date':moment(_0x17409c[_0x0504('0x5e')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x0504('0x4e')](),'sender':_0x17409c[_0x0504('0x5f')]===_0x0504('0x6b')?_0x17409c[_0x0504('0x57')]?_0x17409c[_0x0504('0x57')][_0x0504('0x58')]:_0x0504('0x6c'):_0x17409c[_0x0504('0x6d')][_0x0504('0x5a')]+(_0x17409c['Contact'][_0x0504('0x5b')]?'\x20'+_0x17409c[_0x0504('0x6d')][_0x0504('0x5b')]:''),'body':_0x17409c['Attachment']?_0x17409c[_0x0504('0x5c')]['basename']:_0x17409c[_0x0504('0x33')],'direction':_0x17409c[_0x0504('0x5f')]===_0x0504('0x6b')?'A':'C','secret':_0x17409c['secret'],'read':_0x17409c[_0x0504('0x6e')],'attachment':_0x17409c[_0x0504('0x5c')]};})['value']()};return ejs[_0x0504('0x6f')](path['join'](config['root'],_0x0504('0x53'),'views','downloadInteraction.ejs'),{'interaction':_0x356eaa})[_0x0504('0x1c')](function(_0x3509a3){var _0x14705c=path[_0x0504('0x4f')](_0x266abb,_0x0504('0x70')+_0x50094d['id']+'-'+_0xff1a91+_0x0504('0x71'));var _0x188813={'path':_0x14705c,'channel':'Whatsapp','interactionId':_0x50094d['id']};return pdf[_0x0504('0x72')](_0x3509a3,_0x188813);})['then'](function(){return new BPromise(function(_0x3c090c,_0x543002){zipdir(_0x266abb,{'saveTo':_0x3434d0},function(_0x922dda,_0x2176f3){if(_0x922dda)return _0x543002(_0x922dda);return _0x3c090c(_0x2176f3);});})[_0x0504('0x1c')](function(){return new BPromise(function(_0xe161de,_0x3a8602){rimraf(_0x266abb,function(_0x1720ee){if(_0x1720ee)_0x3a8602(_0x1720ee);return _0xe161de();});});})[_0x0504('0x1c')](function(){return _0x169c77['download'](_0x3434d0,_0x2c3c3f,function(_0x326f1c){if(_0x326f1c){console[_0x0504('0x73')](_0x0504('0x74'),_0x326f1c);}else{fs['unlinkSync'](_0x3434d0);}});});});}else{return _0x169c77['sendStatus'](0xc8);}})[_0x0504('0x27')](handleError(_0x169c77,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index d10c76d..86fd6a8 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 _0x765b=['map','findAll','emit','catch','hasOwnProperty','exports','../../mysqldb','setMaxListeners','update','remove','then','setDataValue','Users'];(function(_0x1ecfa1,_0x4bce9a){var _0x1a39ca=function(_0x2c5ee3){while(--_0x2c5ee3){_0x1ecfa1['push'](_0x1ecfa1['shift']());}};_0x1a39ca(++_0x4bce9a);}(_0x765b,0x18c));var _0xb765=function(_0x3b711c,_0x4b22dc){_0x3b711c=_0x3b711c-0x0;var _0x2685f0=_0x765b[_0x3b711c];return _0x2685f0;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require('../../mysqldb')['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xb765('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xb765('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb765('0x2'),'afterDestroy':_0xb765('0x3')};function emitEvent(_0x358e6e){return function(_0x57021a,_0x5759de,_0x58195b){_0x57021a['getUsers']({'attributes':['id'],'raw':!![]})[_0xb765('0x4')](function(_0x5b1baf){_0x57021a[_0xb765('0x5')](_0xb765('0x6'),_0x5b1baf[_0xb765('0x7')](function(_0x57dfcf){return{'id':_0x57dfcf['id']};}));return WhatsappMessage[_0xb765('0x8')]({'where':{'WhatsappInteractionId':_0x57021a['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb765('0x4')](function(_0x26ad83){_0x57021a['setDataValue']('unreadMessages',_0x26ad83['length']);WhatsappInteractionEvents[_0xb765('0x9')](_0x358e6e+':'+_0x57021a['id'],_0x57021a);WhatsappInteractionEvents[_0xb765('0x9')](_0x358e6e,_0x57021a);_0x58195b(null);})[_0xb765('0xa')](_0x58195b(null));};}for(var e in events){if(events[_0xb765('0xb')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xb765('0xc')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xa68c=['then','setDataValue','Users','map','findAll','unreadMessages','length','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers'];(function(_0x31b90f,_0x35ef73){var _0x15653b=function(_0x3b992f){while(--_0x3b992f){_0x31b90f['push'](_0x31b90f['shift']());}};_0x15653b(++_0x35ef73);}(_0xa68c,0x187));var _0xca68=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa68c[_0x2b10c6];return _0x3789d2;};'use strict';var EventEmitter=require(_0xca68('0x0'));var WhatsappInteraction=require(_0xca68('0x1'))['db'][_0xca68('0x2')];var WhatsappMessage=require(_0xca68('0x1'))['db'][_0xca68('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xca68('0x4')](0x0);var events={'afterCreate':_0xca68('0x5'),'afterUpdate':_0xca68('0x6'),'afterDestroy':_0xca68('0x7')};function emitEvent(_0x4d75b2){return function(_0x5a3873,_0x1301ac,_0x58d446){_0x5a3873[_0xca68('0x8')]({'attributes':['id'],'raw':!![]})[_0xca68('0x9')](function(_0x3af3d8){_0x5a3873[_0xca68('0xa')](_0xca68('0xb'),_0x3af3d8[_0xca68('0xc')](function(_0x18d389){return{'id':_0x18d389['id']};}));return WhatsappMessage[_0xca68('0xd')]({'where':{'WhatsappInteractionId':_0x5a3873['id'],'direction':'in','read':![]},'raw':!![]});})[_0xca68('0x9')](function(_0x46c62c){_0x5a3873[_0xca68('0xa')](_0xca68('0xe'),_0x46c62c[_0xca68('0xf')]);WhatsappInteractionEvents['emit'](_0x4d75b2+':'+_0x5a3873['id'],_0x5a3873);WhatsappInteractionEvents['emit'](_0x4d75b2,_0x5a3873);_0x58d446(null);})[_0xca68('0x10')](_0x58d446(null));};}for(var e in events){if(events[_0xca68('0x11')](e)){var event=events[e];WhatsappInteraction[_0xca68('0x12')](e,emitEvent(event));}}module[_0xca68('0x13')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index c1bcaf1..fc8d6cc 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 _0xc0aa=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','WhatsappInteraction','whatsapp_interactions','changed','closedAt','format'];(function(_0xbe8c92,_0x5c130c){var _0x1d1e20=function(_0x205257){while(--_0x205257){_0xbe8c92['push'](_0xbe8c92['shift']());}};_0x1d1e20(++_0x5c130c);}(_0xc0aa,0x15f));var _0xac0a=function(_0x3f73bf,_0x26dd02){_0x3f73bf=_0x3f73bf-0x0;var _0x3a1f30=_0xc0aa[_0x3f73bf];return _0x3a1f30;};'use strict';var _=require('lodash');var util=require(_0xac0a('0x0'));var logger=require('../../config/logger')(_0xac0a('0x1'));var moment=require(_0xac0a('0x2'));var BPromise=require(_0xac0a('0x3'));var rp=require(_0xac0a('0x4'));var fs=require('fs');var path=require(_0xac0a('0x5'));var rimraf=require(_0xac0a('0x6'));var config=require(_0xac0a('0x7'));var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x3955cd,_0x1ebf58){return _0x3955cd['define'](_0xac0a('0x8'),attributes,{'tableName':_0xac0a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x43c76e,_0x3647da,_0x34b7e6){if(_0x43c76e[_0xac0a('0xa')]('closed')){_0x43c76e[_0xac0a('0xb')]=moment()[_0xac0a('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x34b7e6(null,_0x43c76e);}}});}; \ No newline at end of file +var _0x6d4a=['exports','WhatsappInteraction','whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes'];(function(_0x1b319f,_0x2598b1){var _0x19dbcf=function(_0x4e10d3){while(--_0x4e10d3){_0x1b319f['push'](_0x1b319f['shift']());}};_0x19dbcf(++_0x2598b1);}(_0x6d4a,0xc7));var _0xa6d4=function(_0x30c642,_0x3bb62e){_0x30c642=_0x30c642-0x0;var _0xe102d5=_0x6d4a[_0x30c642];return _0xe102d5;};'use strict';var _=require(_0xa6d4('0x0'));var util=require(_0xa6d4('0x1'));var logger=require(_0xa6d4('0x2'))('api');var moment=require(_0xa6d4('0x3'));var BPromise=require(_0xa6d4('0x4'));var rp=require(_0xa6d4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa6d4('0x6'));var config=require(_0xa6d4('0x7'));var attributes=require(_0xa6d4('0x8'));module[_0xa6d4('0x9')]=function(_0x4be302,_0x13bec2){return _0x4be302['define'](_0xa6d4('0xa'),attributes,{'tableName':_0xa6d4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x15fc5c,_0x5f0c08,_0xe497a3){if(_0x15fc5c['changed'](_0xa6d4('0xc'))){_0x15fc5c[_0xa6d4('0xd')]=moment()[_0xa6d4('0xe')](_0xa6d4('0xf'));}_0xe497a3(null,_0x15fc5c);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index ebe89b6..7e72097 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 _0xd942=['AddTagsToWhatsappInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','stringify'];(function(_0x45e88b,_0x459427){var _0x19e808=function(_0x5abc24){while(--_0x5abc24){_0x45e88b['push'](_0x45e88b['shift']());}};_0x19e808(++_0x459427);}(_0xd942,0xa7));var _0x2d94=function(_0x3f45f9,_0x484c66){_0x3f45f9=_0x3f45f9-0x0;var _0x3c36b2=_0xd942[_0x3f45f9];return _0x3c36b2;};'use strict';var _=require('lodash');var util=require(_0x2d94('0x0'));var moment=require(_0x2d94('0x1'));var BPromise=require(_0x2d94('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2d94('0x3'));var logger=require(_0x2d94('0x4'))(_0x2d94('0x5'));var config=require(_0x2d94('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2d94('0x7')][_0x2d94('0x8')]({'port':0x232a});config[_0x2d94('0x9')]=_['defaults'](config[_0x2d94('0x9')],{'host':_0x2d94('0xa'),'port':0x18eb});var socket=require(_0x2d94('0xb'))(new Redis(config[_0x2d94('0x9')]));require('./whatsappInteraction.socket')[_0x2d94('0xc')](socket);function respondWithRpcPromise(_0x4f2c9d,_0x38eab0,_0x4092bb){return new BPromise(function(_0xf20d2,_0x57e282){return client['request'](_0x4f2c9d,_0x4092bb)[_0x2d94('0xd')](function(_0x4fc633){logger['info'](_0x2d94('0xe'),_0x38eab0,_0x2d94('0xf'));logger[_0x2d94('0x10')](_0x2d94('0x11'),_0x38eab0,'request\x20sent',JSON['stringify'](_0x4fc633));if(_0x4fc633[_0x2d94('0x12')]){if(_0x4fc633[_0x2d94('0x12')][_0x2d94('0x13')]===0x1f4){logger[_0x2d94('0x12')](_0x2d94('0xe'),_0x38eab0,_0x4fc633[_0x2d94('0x12')][_0x2d94('0x14')]);return _0x57e282(_0x4fc633['error'][_0x2d94('0x14')]);}logger[_0x2d94('0x12')](_0x2d94('0xe'),_0x38eab0,_0x4fc633['error'][_0x2d94('0x14')]);return _0xf20d2(_0x4fc633[_0x2d94('0x12')][_0x2d94('0x14')]);}else{logger[_0x2d94('0x15')](_0x2d94('0xe'),_0x38eab0,_0x2d94('0xf'));_0xf20d2(_0x4fc633[_0x2d94('0x16')][_0x2d94('0x14')]);}})[_0x2d94('0x17')](function(_0x3df34f){logger[_0x2d94('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x38eab0,_0x3df34f);_0x57e282(_0x3df34f);});});}exports[_0x2d94('0x18')]=function(_0x2da636){var _0x415d26=this;return new Promise(function(_0x5480ae,_0x57c88e){return db[_0x2d94('0x19')][_0x2d94('0x1a')](_0x2da636[_0x2d94('0x1b')],{'raw':_0x2da636[_0x2d94('0x1c')]?_0x2da636[_0x2d94('0x1c')][_0x2d94('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2da636[_0x2d94('0x1c')]?_0x2da636[_0x2d94('0x1c')][_0x2d94('0x1e')]||null:null,'attributes':_0x2da636[_0x2d94('0x1c')]?_0x2da636[_0x2d94('0x1c')][_0x2d94('0x1f')]||null:null,'limit':_0x2da636[_0x2d94('0x1c')]?_0x2da636[_0x2d94('0x1c')]['limit']||null:null})['then'](function(_0x5cf274){logger['info'](_0x2d94('0x18'),_0x2da636);logger[_0x2d94('0x10')](_0x2d94('0x18'),_0x2da636,JSON[_0x2d94('0x20')](_0x5cf274));_0x5480ae(_0x5cf274);})[_0x2d94('0x17')](function(_0x1abc27){logger[_0x2d94('0x12')](_0x2d94('0x18'),_0x1abc27['message'],_0x2da636);_0x57c88e(_0x415d26[_0x2d94('0x12')](0x1f4,_0x1abc27[_0x2d94('0x14')]));});});};exports[_0x2d94('0x21')]=function(_0x36e961){return new Promise(function(_0x413200,_0x2f560d){return db[_0x2d94('0x19')][_0x2d94('0x22')]({'where':_0x36e961[_0x2d94('0x1c')]?_0x36e961[_0x2d94('0x1c')][_0x2d94('0x1e')]||null:null})[_0x2d94('0xd')](function(_0x298f29){if(_0x298f29){return _0x298f29[_0x2d94('0x23')](_0x36e961[_0x2d94('0x1b')][_0x2d94('0x24')],_[_0x2d94('0x25')](_0x36e961[_0x2d94('0x1b')],[_0x2d94('0x24'),'id'])||{});}})[_0x2d94('0x26')](function(_0x1020e2){logger['info']('AddTags',_0x36e961);logger[_0x2d94('0x10')](_0x2d94('0x27'),_0x36e961,JSON[_0x2d94('0x20')](_0x1020e2));_0x413200(_0x1020e2);})[_0x2d94('0x17')](function(_0x13702a){logger[_0x2d94('0x12')](_0x2d94('0x27'),_0x13702a[_0x2d94('0x14')],_0x36e961);_0x2f560d(_this[_0x2d94('0x12')](0x1f4,_0x13702a['message']));});});}; \ No newline at end of file +var _0x13b6=['stringify','error','code','message','result','update','body','options','raw','where','attributes','limit','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x1cfe2e,_0x1ebbcd){var _0x39233f=function(_0x48831a){while(--_0x48831a){_0x1cfe2e['push'](_0x1cfe2e['shift']());}};_0x39233f(++_0x1ebbcd);}(_0x13b6,0x1e3));var _0x613b=function(_0x595f2a,_0x3ccac9){_0x595f2a=_0x595f2a-0x0;var _0x414887=_0x13b6[_0x595f2a];return _0x414887;};'use strict';var _=require('lodash');var util=require(_0x613b('0x0'));var moment=require(_0x613b('0x1'));var BPromise=require(_0x613b('0x2'));var rs=require(_0x613b('0x3'));var fs=require('fs');var Redis=require(_0x613b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x613b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x613b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x613b('0x7')]['http']({'port':0x232a});config['redis']=_[_0x613b('0x8')](config[_0x613b('0x9')],{'host':_0x613b('0xa'),'port':0x18eb});var socket=require(_0x613b('0xb'))(new Redis(config[_0x613b('0x9')]));require(_0x613b('0xc'))[_0x613b('0xd')](socket);function respondWithRpcPromise(_0x5ed445,_0x4512aa,_0x3a5358){return new BPromise(function(_0x23edd7,_0xd81eed){return client[_0x613b('0xe')](_0x5ed445,_0x3a5358)[_0x613b('0xf')](function(_0x45c51e){logger[_0x613b('0x10')](_0x613b('0x11'),_0x4512aa,_0x613b('0x12'));logger[_0x613b('0x13')](_0x613b('0x14'),_0x4512aa,_0x613b('0x12'),JSON[_0x613b('0x15')](_0x45c51e));if(_0x45c51e[_0x613b('0x16')]){if(_0x45c51e[_0x613b('0x16')][_0x613b('0x17')]===0x1f4){logger[_0x613b('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x4512aa,_0x45c51e[_0x613b('0x16')][_0x613b('0x18')]);return _0xd81eed(_0x45c51e[_0x613b('0x16')][_0x613b('0x18')]);}logger[_0x613b('0x16')](_0x613b('0x11'),_0x4512aa,_0x45c51e['error'][_0x613b('0x18')]);return _0x23edd7(_0x45c51e[_0x613b('0x16')][_0x613b('0x18')]);}else{logger[_0x613b('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x4512aa,'request\x20sent');_0x23edd7(_0x45c51e[_0x613b('0x19')][_0x613b('0x18')]);}})['catch'](function(_0x121259){logger[_0x613b('0x16')](_0x613b('0x11'),_0x4512aa,_0x121259);_0xd81eed(_0x121259);});});}exports['UpdateWhatsappInteraction']=function(_0x8e210){var _0x4b2b71=this;return new Promise(function(_0x228448,_0x392712){return db['WhatsappInteraction'][_0x613b('0x1a')](_0x8e210[_0x613b('0x1b')],{'raw':_0x8e210[_0x613b('0x1c')]?_0x8e210[_0x613b('0x1c')][_0x613b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8e210['options']?_0x8e210[_0x613b('0x1c')][_0x613b('0x1e')]||null:null,'attributes':_0x8e210['options']?_0x8e210[_0x613b('0x1c')][_0x613b('0x1f')]||null:null,'limit':_0x8e210['options']?_0x8e210[_0x613b('0x1c')][_0x613b('0x20')]||null:null})['then'](function(_0x4d3fb0){logger[_0x613b('0x10')](_0x613b('0x21'),_0x8e210);logger[_0x613b('0x13')]('UpdateWhatsappInteraction',_0x8e210,JSON[_0x613b('0x15')](_0x4d3fb0));_0x228448(_0x4d3fb0);})['catch'](function(_0x325706){logger[_0x613b('0x16')](_0x613b('0x21'),_0x325706[_0x613b('0x18')],_0x8e210);_0x392712(_0x4b2b71[_0x613b('0x16')](0x1f4,_0x325706[_0x613b('0x18')]));});});};exports[_0x613b('0x22')]=function(_0x456cb3){return new Promise(function(_0x115958,_0x19bd5a){return db[_0x613b('0x23')][_0x613b('0x24')]({'where':_0x456cb3[_0x613b('0x1c')]?_0x456cb3[_0x613b('0x1c')]['where']||null:null})[_0x613b('0xf')](function(_0x3ff47d){if(_0x3ff47d){return _0x3ff47d[_0x613b('0x25')](_0x456cb3[_0x613b('0x1b')][_0x613b('0x26')],_[_0x613b('0x27')](_0x456cb3[_0x613b('0x1b')],['ids','id'])||{});}})[_0x613b('0x28')](function(_0x3f5128){logger[_0x613b('0x10')]('AddTags',_0x456cb3);logger[_0x613b('0x13')]('AddTags',_0x456cb3,JSON['stringify'](_0x3f5128));_0x115958(_0x3f5128);})['catch'](function(_0x5e57e6){logger['error'](_0x613b('0x29'),_0x5e57e6['message'],_0x456cb3);_0x19bd5a(_this[_0x613b('0x16')](0x1f4,_0x5e57e6['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index d6bca67..1951af0 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 _0xf2c0=['save','update','emit','register','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xf2c0,0x15b));var _0x0f2c=function(_0x4b3922,_0x56233d){_0x4b3922=_0x4b3922-0x0;var _0x994cbb=_0xf2c0[_0x4b3922];return _0x994cbb;};'use strict';var WhatsappInteractionEvents=require(_0x0f2c('0x0'));var events=[_0x0f2c('0x1'),'remove',_0x0f2c('0x2')];function createListener(_0x17ded6,_0x21ab36){return function(_0x399ea9){_0x21ab36[_0x0f2c('0x3')](_0x17ded6,_0x399ea9);};}function removeListener(_0x5a8d0d,_0x1fefc9){return function(){WhatsappInteractionEvents['removeListener'](_0x5a8d0d,_0x1fefc9);};}exports[_0x0f2c('0x4')]=function(_0x3bb5fa){for(var _0x5154bc=0x0,_0x5b3d19=events['length'];_0x5154bc<_0x5b3d19;_0x5154bc++){var _0xf5e375=events[_0x5154bc];var _0x136b57=createListener(_0x0f2c('0x5')+_0xf5e375,_0x3bb5fa);WhatsappInteractionEvents['on'](_0xf5e375,_0x136b57);}}; \ No newline at end of file +var _0xb10c=['whatsappInteraction:','save','remove','update','removeListener','register','length'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0xb10c,0x1c8));var _0xcb10=function(_0x37f02e,_0x24e12d){_0x37f02e=_0x37f02e-0x0;var _0x546b92=_0xb10c[_0x37f02e];return _0x546b92;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xcb10('0x0'),_0xcb10('0x1'),_0xcb10('0x2')];function createListener(_0x5dc252,_0x56fe39){return function(_0x5e9f57){_0x56fe39['emit'](_0x5dc252,_0x5e9f57);};}function removeListener(_0x573308,_0x5a6631){return function(){WhatsappInteractionEvents[_0xcb10('0x3')](_0x573308,_0x5a6631);};}exports[_0xcb10('0x4')]=function(_0x3a2a34){for(var _0x3ddf30=0x0,_0x12ae4e=events[_0xcb10('0x5')];_0x3ddf30<_0x12ae4e;_0x3ddf30++){var _0x2c626e=events[_0x3ddf30];var _0x507686=createListener(_0xcb10('0x6')+_0x2c626e,_0x3a2a34);WhatsappInteractionEvents['on'](_0x2c626e,_0x507686);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 9a03aa8..834a564 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 _0x9922=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','tracked','whatsapp','whatsappmessage:create','post','/:id/status','put','update','/:id/accept','accept','reject','destroy','exports','multer','path','connect-timeout','express','fs-extra'];(function(_0x5a4f65,_0x57c4ee){var _0x3c5d98=function(_0x40760d){while(--_0x40760d){_0x5a4f65['push'](_0x5a4f65['shift']());}};_0x3c5d98(++_0x57c4ee);}(_0x9922,0x1ef));var _0x2992=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9922[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2992('0x0'));var util=require('util');var path=require(_0x2992('0x1'));var timeout=require(_0x2992('0x2'));var express=require(_0x2992('0x3'));var router=express['Router']();var fs_extra=require(_0x2992('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2992('0x5'));var controller=require('./whatsappMessage.controller');router[_0x2992('0x6')]('/',auth[_0x2992('0x7')](),controller[_0x2992('0x8')]);router[_0x2992('0x6')](_0x2992('0x9'),auth['isAuthenticated'](),controller[_0x2992('0xa')]);router[_0x2992('0x6')](_0x2992('0xb'),auth[_0x2992('0x7')](),controller[_0x2992('0xc')]);router['post']('/',auth[_0x2992('0x7')](),interaction[_0x2992('0xd')](_0x2992('0xe'),_0x2992('0xf')),controller['create']);router[_0x2992('0x10')](_0x2992('0x11'),controller['status']);router[_0x2992('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x2992('0x13')]);router[_0x2992('0x12')](_0x2992('0x14'),auth['isAuthenticated'](),controller[_0x2992('0x15')]);router[_0x2992('0x12')]('/:id/reject',auth['isAuthenticated'](),controller[_0x2992('0x16')]);router['delete'](_0x2992('0xb'),auth['isAuthenticated'](),controller[_0x2992('0x17')]);module[_0x2992('0x18')]=router; \ No newline at end of file +var _0x5377=['Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','status','put','update','/:id/accept','accept','reject','destroy','multer','util','connect-timeout','express'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x5377,0x125));var _0x7537=function(_0x233561,_0x267c61){_0x233561=_0x233561-0x0;var _0x1802a4=_0x5377[_0x233561];return _0x1802a4;};'use strict';var multer=require(_0x7537('0x0'));var util=require(_0x7537('0x1'));var path=require('path');var timeout=require(_0x7537('0x2'));var express=require(_0x7537('0x3'));var router=express[_0x7537('0x4')]();var fs_extra=require(_0x7537('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7537('0x6'));var config=require(_0x7537('0x7'));var controller=require(_0x7537('0x8'));router[_0x7537('0x9')]('/',auth[_0x7537('0xa')](),controller[_0x7537('0xb')]);router[_0x7537('0x9')](_0x7537('0xc'),auth['isAuthenticated'](),controller[_0x7537('0xd')]);router[_0x7537('0x9')](_0x7537('0xe'),auth['isAuthenticated'](),controller[_0x7537('0xf')]);router[_0x7537('0x10')]('/',auth[_0x7537('0xa')](),interaction[_0x7537('0x11')](_0x7537('0x12'),_0x7537('0x13')),controller['create']);router[_0x7537('0x10')]('/:id/status',controller[_0x7537('0x14')]);router[_0x7537('0x15')](_0x7537('0xe'),auth['isAuthenticated'](),controller[_0x7537('0x16')]);router[_0x7537('0x15')](_0x7537('0x17'),auth[_0x7537('0xa')](),controller[_0x7537('0x18')]);router[_0x7537('0x15')]('/:id/reject',auth[_0x7537('0xa')](),controller[_0x7537('0x19')]);router['delete'](_0x7537('0xe'),auth[_0x7537('0xa')](),controller[_0x7537('0x1a')]);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 a5c6b66..01195e5 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 _0x94ce=['sequelize','exports','medium','BOOLEAN','out','STRING'];(function(_0x2a05ce,_0x3a3522){var _0x2921be=function(_0x48738d){while(--_0x48738d){_0x2a05ce['push'](_0x2a05ce['shift']());}};_0x2921be(++_0x3a3522);}(_0x94ce,0x6c));var _0xe94c=function(_0x3d1200,_0x462aac){_0x3d1200=_0x3d1200-0x0;var _0x8ca337=_0x94ce[_0x3d1200];return _0x8ca337;};'use strict';var Sequelize=require(_0xe94c('0x0'));module[_0xe94c('0x1')]={'body':{'type':Sequelize['TEXT'](_0xe94c('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xe94c('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe94c('0x4')),'defaultValue':_0xe94c('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe94c('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xe94c('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x89c3=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize'];(function(_0x146dd7,_0x4d877d){var _0x2af0bb=function(_0x2327bc){while(--_0x2327bc){_0x146dd7['push'](_0x146dd7['shift']());}};_0x2af0bb(++_0x4d877d);}(_0x89c3,0xff));var _0x389c=function(_0x3d01bd,_0x1711eb){_0x3d01bd=_0x3d01bd-0x0;var _0x2b7635=_0x89c3[_0x3d01bd];return _0x2b7635;};'use strict';var Sequelize=require(_0x389c('0x0'));module[_0x389c('0x1')]={'body':{'type':Sequelize[_0x389c('0x2')](_0x389c('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x389c('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x389c('0x5')]('in',_0x389c('0x6')),'defaultValue':_0x389c('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x389c('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x389c('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 8457ebd..0b4deb8 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 _0xead0=['VIRTUAL','WhatsappMessage','count','includeAll','include','rows','show','options','find','create','body','params','describe','whatsapp-interactions','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','User','agent','manual','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','null','RejectMessage','rejectMessage','SELECT','fullname','email','interface','rejectmessage','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','twilio','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','end','status','json','offset','undefined','limit','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge'];(function(_0x210603,_0x4adbac){var _0x1bcb7d=function(_0x2cdf89){while(--_0x2cdf89){_0x210603['push'](_0x210603['shift']());}};_0x1bcb7d(++_0x4adbac);}(_0xead0,0x1de));var _0x0ead=function(_0x33670a,_0x55e188){_0x33670a=_0x33670a-0x0;var _0x36ad1d=_0xead0[_0x33670a];return _0x36ad1d;};'use strict';var emlformat=require(_0x0ead('0x0'));var rimraf=require(_0x0ead('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0ead('0x2'));var rp=require(_0x0ead('0x3'));var moment=require('moment');var BPromise=require(_0x0ead('0x4'));var Mustache=require(_0x0ead('0x5'));var util=require('util');var path=require(_0x0ead('0x6'));var sox=require(_0x0ead('0x7'));var csv=require(_0x0ead('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0ead('0x9'));var _=require(_0x0ead('0xa'));var squel=require(_0x0ead('0xb'));var crypto=require(_0x0ead('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0ead('0xd'));var toCsv=require(_0x0ead('0x8'));var querystring=require(_0x0ead('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0ead('0xf'));var qs=require(_0x0ead('0x10'));var as=require(_0x0ead('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0ead('0x12'))(_0x0ead('0x13'));var utils=require(_0x0ead('0x14'));var config=require(_0x0ead('0x15'));var licenseUtil=require(_0x0ead('0x16'));var db=require(_0x0ead('0x17'))['db'];config[_0x0ead('0x18')]=_[_0x0ead('0x19')](config[_0x0ead('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x0ead('0x1a'))(new Redis(config[_0x0ead('0x18')]));require('./whatsappMessage.socket')[_0x0ead('0x1b')](socket);var jayson=require(_0x0ead('0x1c'));var client=jayson[_0x0ead('0x1d')][_0x0ead('0x1e')]({'port':0x232c});var client9002=jayson[_0x0ead('0x1d')][_0x0ead('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x16c2ac,_0x2b2ce6,_0x6bce58,_0x10d6cb){return new BPromise(function(_0x2707bd,_0x4a9c97){var _0x5c4b72=_0x10d6cb||client;return _0x5c4b72[_0x0ead('0x1f')](_0x16c2ac,_0x6bce58)['then'](function(_0x5f3bc6){logger[_0x0ead('0x20')](_0x0ead('0x21'),_0x2b2ce6,_0x0ead('0x22'));logger[_0x0ead('0x23')](_0x0ead('0x24'),_0x2b2ce6,_0x0ead('0x22'),JSON['stringify'](_0x5f3bc6));if(_0x5f3bc6[_0x0ead('0x25')]){if(_0x5f3bc6[_0x0ead('0x25')][_0x0ead('0x26')]===0x1f4){logger[_0x0ead('0x25')](_0x0ead('0x21'),_0x2b2ce6,_0x5f3bc6[_0x0ead('0x25')][_0x0ead('0x27')]);return _0x4a9c97(_0x5f3bc6['error'][_0x0ead('0x27')]);}logger['error'](_0x0ead('0x21'),_0x2b2ce6,_0x5f3bc6['error'][_0x0ead('0x27')]);return _0x2707bd(_0x5f3bc6[_0x0ead('0x25')][_0x0ead('0x27')]);}else{logger['info'](_0x0ead('0x21'),_0x2b2ce6,_0x0ead('0x22'));_0x2707bd(_0x5f3bc6['result'][_0x0ead('0x27')]);}})[_0x0ead('0x28')](function(_0x212faa){logger[_0x0ead('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x2b2ce6,_0x212faa);_0x4a9c97(_0x212faa);});});}function respondWithStatusCode(_0x3b0e06,_0x3462ca){_0x3462ca=_0x3462ca||0xcc;return function(_0x14bcf8){if(_0x14bcf8){return _0x3b0e06[_0x0ead('0x29')](_0x3462ca);}return _0x3b0e06['status'](_0x3462ca)[_0x0ead('0x2a')]();};}function respondWithResult(_0x215945,_0x462921){_0x462921=_0x462921||0xc8;return function(_0x787fb3){if(_0x787fb3){return _0x215945[_0x0ead('0x2b')](_0x462921)[_0x0ead('0x2c')](_0x787fb3);}};}function respondWithFilteredResult(_0x251f07,_0x27c7d2){return function(_0x4bdaef){if(_0x4bdaef){var _0xb148cf=typeof _0x27c7d2[_0x0ead('0x2d')]===_0x0ead('0x2e')&&typeof _0x27c7d2[_0x0ead('0x2f')]===_0x0ead('0x2e');var _0x49a160=_0x4bdaef['count'];var _0x4aa42e=_0xb148cf?0x0:_0x27c7d2[_0x0ead('0x2d')];var _0x451ad4=_0xb148cf?_0x4bdaef['count']:_0x27c7d2[_0x0ead('0x2d')]+_0x27c7d2['limit'];var _0x10d9df;if(_0x451ad4>=_0x49a160){_0x451ad4=_0x49a160;_0x10d9df=0xc8;}else{_0x10d9df=0xce;}_0x251f07[_0x0ead('0x2b')](_0x10d9df);return _0x251f07['set'](_0x0ead('0x30'),_0x4aa42e+'-'+_0x451ad4+'/'+_0x49a160)[_0x0ead('0x2c')](_0x4bdaef);}return null;};}function patchUpdates(_0xc392d5){return function(_0xbe07df){try{jsonpatch['apply'](_0xbe07df,_0xc392d5,!![]);}catch(_0x305e5d){return BPromise[_0x0ead('0x31')](_0x305e5d);}return _0xbe07df[_0x0ead('0x32')]();};}function saveUpdates(_0x21188c,_0x3eaded){return function(_0x180b8f){if(_0x180b8f){return _0x180b8f[_0x0ead('0x33')](_0x21188c)[_0x0ead('0x34')](function(_0x501cf6){return _0x501cf6;});}return null;};}function removeEntity(_0x288ea4,_0x54a0cc){return function(_0xf2158b){if(_0xf2158b){return _0xf2158b[_0x0ead('0x35')]()['then'](function(){_0x288ea4[_0x0ead('0x2b')](0xcc)[_0x0ead('0x2a')]();});}};}function handleEntityNotFound(_0x2390bc,_0x48206d){return function(_0x160943){if(!_0x160943){_0x2390bc[_0x0ead('0x29')](0x194);}return _0x160943;};}function handleError(_0x47162f,_0x343991){_0x343991=_0x343991||0x1f4;return function(_0x31d85e){logger[_0x0ead('0x25')](_0x31d85e[_0x0ead('0x36')]);if(_0x31d85e[_0x0ead('0x37')]){delete _0x31d85e['name'];}_0x47162f[_0x0ead('0x2b')](_0x343991)[_0x0ead('0x38')](_0x31d85e);};}exports[_0x0ead('0x39')]=function(_0x472c66,_0x24c85f){var _0x4ef5cc={},_0x340cc2={},_0x25c3f8={'count':0x0,'rows':[]};var _0x5a82f7=_[_0x0ead('0x3a')](db['WhatsappMessage'][_0x0ead('0x3b')],function(_0x2d4c85){return{'name':_0x2d4c85[_0x0ead('0x3c')],'type':_0x2d4c85[_0x0ead('0x3d')][_0x0ead('0x3e')]};});_0x340cc2['model']=_[_0x0ead('0x3a')](_0x5a82f7,'name');_0x340cc2[_0x0ead('0x3f')]=_[_0x0ead('0x40')](_0x472c66[_0x0ead('0x3f')]);_0x340cc2[_0x0ead('0x41')]=_['intersection'](_0x340cc2[_0x0ead('0x42')],_0x340cc2[_0x0ead('0x3f')]);_0x4ef5cc[_0x0ead('0x43')]=_[_0x0ead('0x44')](_0x340cc2[_0x0ead('0x42')],qs['fields'](_0x472c66[_0x0ead('0x3f')][_0x0ead('0x45')]));_0x4ef5cc[_0x0ead('0x43')]=_0x4ef5cc[_0x0ead('0x43')][_0x0ead('0x46')]?_0x4ef5cc[_0x0ead('0x43')]:_0x340cc2['model'];if(!_0x472c66['query'][_0x0ead('0x47')](_0x0ead('0x48'))){_0x4ef5cc[_0x0ead('0x2f')]=qs[_0x0ead('0x2f')](_0x472c66['query'][_0x0ead('0x2f')]);_0x4ef5cc['offset']=qs[_0x0ead('0x2d')](_0x472c66[_0x0ead('0x3f')]['offset']);}_0x4ef5cc['order']=qs['sort'](_0x472c66[_0x0ead('0x3f')][_0x0ead('0x49')]);_0x4ef5cc[_0x0ead('0x4a')]=qs[_0x0ead('0x41')](_[_0x0ead('0x4b')](_0x472c66[_0x0ead('0x3f')],_0x340cc2[_0x0ead('0x41')]),_0x5a82f7);if(_0x472c66['query'][_0x0ead('0x4c')]){_0x4ef5cc[_0x0ead('0x4a')]=_[_0x0ead('0x4d')](_0x4ef5cc[_0x0ead('0x4a')],{'$or':_[_0x0ead('0x3a')](_0x5a82f7,function(_0x4e29ec){if(_0x4e29ec['type']!==_0x0ead('0x4e')){var _0x16df26={};_0x16df26[_0x4e29ec[_0x0ead('0x37')]]={'$like':'%'+_0x472c66[_0x0ead('0x3f')][_0x0ead('0x4c')]+'%'};return _0x16df26;}})});}_0x4ef5cc=_['merge']({},_0x4ef5cc,_0x472c66['options']);var _0x732edd={'where':_0x4ef5cc[_0x0ead('0x4a')]};return db[_0x0ead('0x4f')][_0x0ead('0x50')](_0x732edd)['then'](function(_0x2a5bc1){_0x25c3f8[_0x0ead('0x50')]=_0x2a5bc1;if(_0x472c66[_0x0ead('0x3f')][_0x0ead('0x51')]){_0x4ef5cc[_0x0ead('0x52')]=[{'all':!![]}];}return db[_0x0ead('0x4f')]['findAll'](_0x4ef5cc);})[_0x0ead('0x34')](function(_0x4ca9c2){_0x25c3f8[_0x0ead('0x53')]=_0x4ca9c2;return _0x25c3f8;})['then'](respondWithFilteredResult(_0x24c85f,_0x4ef5cc))[_0x0ead('0x28')](handleError(_0x24c85f,null));};exports[_0x0ead('0x54')]=function(_0x1a5900,_0x4cf6b0){var _0x50850b={'raw':!![],'where':{'id':_0x1a5900['params']['id']}},_0xe82de7={};_0xe82de7[_0x0ead('0x42')]=_[_0x0ead('0x40')](db[_0x0ead('0x4f')][_0x0ead('0x3b')]);_0xe82de7[_0x0ead('0x3f')]=_['keys'](_0x1a5900[_0x0ead('0x3f')]);_0xe82de7[_0x0ead('0x41')]=_[_0x0ead('0x44')](_0xe82de7[_0x0ead('0x42')],_0xe82de7[_0x0ead('0x3f')]);_0x50850b['attributes']=_['intersection'](_0xe82de7['model'],qs['fields'](_0x1a5900[_0x0ead('0x3f')][_0x0ead('0x45')]));_0x50850b[_0x0ead('0x43')]=_0x50850b[_0x0ead('0x43')][_0x0ead('0x46')]?_0x50850b['attributes']:_0xe82de7['model'];if(_0x1a5900[_0x0ead('0x3f')]['includeAll']){_0x50850b[_0x0ead('0x52')]=[{'all':!![]}];}_0x50850b=_[_0x0ead('0x4d')]({},_0x50850b,_0x1a5900[_0x0ead('0x55')]);return db[_0x0ead('0x4f')][_0x0ead('0x56')](_0x50850b)[_0x0ead('0x34')](handleEntityNotFound(_0x4cf6b0,null))[_0x0ead('0x34')](respondWithResult(_0x4cf6b0,null))[_0x0ead('0x28')](handleError(_0x4cf6b0,null));};exports[_0x0ead('0x57')]=function(_0x1bc727,_0x490bde){return db[_0x0ead('0x4f')][_0x0ead('0x57')](_0x1bc727['body'],{})['then'](respondWithResult(_0x490bde,0xc9))[_0x0ead('0x28')](handleError(_0x490bde,null));};exports[_0x0ead('0x33')]=function(_0x37983a,_0x466e6f){if(_0x37983a['body']['id']){delete _0x37983a[_0x0ead('0x58')]['id'];}return db[_0x0ead('0x4f')][_0x0ead('0x56')]({'where':{'id':_0x37983a['params']['id']}})['then'](handleEntityNotFound(_0x466e6f,null))[_0x0ead('0x34')](saveUpdates(_0x37983a[_0x0ead('0x58')],null))[_0x0ead('0x34')](respondWithResult(_0x466e6f,null))[_0x0ead('0x28')](handleError(_0x466e6f,null));};exports[_0x0ead('0x35')]=function(_0x590d6b,_0x199093){return db[_0x0ead('0x4f')][_0x0ead('0x56')]({'where':{'id':_0x590d6b[_0x0ead('0x59')]['id']}})[_0x0ead('0x34')](handleEntityNotFound(_0x199093,null))[_0x0ead('0x34')](removeEntity(_0x199093,null))[_0x0ead('0x28')](handleError(_0x199093,null));};exports[_0x0ead('0x5a')]=function(_0x45f8d9,_0x30b4a4){return db[_0x0ead('0x4f')][_0x0ead('0x5a')]()[_0x0ead('0x34')](respondWithResult(_0x30b4a4,null))[_0x0ead('0x28')](handleError(_0x30b4a4,null));};var interaction_log=require('../../config/logger')(_0x0ead('0x5b'));exports['accept']=function(_0x1b098a,_0x7b499,_0x54d741){var _0x35efa8={'agent':{},'channel':_0x0ead('0x5c')};if(_0x1b098a[_0x0ead('0x58')]['id']){delete _0x1b098a[_0x0ead('0x58')]['id'];}_0x1b098a[_0x0ead('0x58')][_0x0ead('0x5d')]=!![];_0x1b098a[_0x0ead('0x58')][_0x0ead('0x5e')]=moment()[_0x0ead('0x5f')](_0x0ead('0x60'));_0x1b098a['body']['UserId']=_0x1b098a[_0x0ead('0x58')][_0x0ead('0x61')]||_0x1b098a[_0x0ead('0x62')]['id'];_0x35efa8['agent']['id']=_0x1b098a['body'][_0x0ead('0x61')];return db[_0x0ead('0x4f')]['find']({'where':{'id':_0x1b098a[_0x0ead('0x59')]['id'],'UserId':null}})[_0x0ead('0x34')](handleEntityNotFound(_0x7b499,null))[_0x0ead('0x34')](saveUpdates(_0x1b098a['body'],null))[_0x0ead('0x34')](function(_0x1bcb0f){if(_0x1bcb0f){_0x35efa8[_0x0ead('0x27')]=_0x1bcb0f['get']({'plain':!![]});return db[_0x0ead('0x63')][_0x0ead('0x56')]({'where':{'id':_0x1bcb0f[_0x0ead('0x64')]}});}return null;})[_0x0ead('0x34')](handleEntityNotFound(_0x7b499,null))[_0x0ead('0x34')](function(_0x56b0cb){if(_0x56b0cb){return _0x56b0cb[_0x0ead('0x33')]({'UserId':_0x1b098a[_0x0ead('0x58')][_0x0ead('0x61')],'read1stAt':_[_0x0ead('0x65')](_0x56b0cb[_0x0ead('0x66')])?moment()[_0x0ead('0x5f')](_0x0ead('0x60')):undefined});}return null;})['then'](function(_0x2fb220){if(_0x2fb220){_0x35efa8[_0x0ead('0x67')]=_0x2fb220[_0x0ead('0x68')]({'plain':!![]});interaction_log[_0x0ead('0x20')](_0x0ead('0x69'),_0x1b098a['user']['id'],_0x1b098a[_0x0ead('0x62')][_0x0ead('0x37')],_0x1b098a['user'][_0x0ead('0x6a')],_0x35efa8[_0x0ead('0x67')]['id'],_0x1b098a[_0x0ead('0x58')]?JSON[_0x0ead('0x6b')](_0x1b098a['body']):'null');return respondWithRpcPromise(_0x0ead('0x6c'),'acceptMessage',_0x35efa8);}return null;})[_0x0ead('0x34')](function(_0x4d621a){var _0x1cb699=_0x0ead('0x6d')+_0x4d621a[_0x0ead('0x27')][_0x0ead('0x6e')];return db['sequelize']['query'](_0x1cb699,{'type':db[_0x0ead('0x6f')][_0x0ead('0x70')]['SELECT'],'raw':!![]})[_0x0ead('0x34')](function(_0x2895f7){return _0x2895f7;});})[_0x0ead('0x34')](function(_0x5549b6){if(_0x5549b6){_0x35efa8[_0x0ead('0x27')][_0x0ead('0x71')]=_0x5549b6[0x0];if(!_0x1b098a[_0x0ead('0x58')][_0x0ead('0x61')])return;return db[_0x0ead('0x72')][_0x0ead('0x56')]({'where':{'id':_0x1b098a['body'][_0x0ead('0x61')],'role':_0x0ead('0x73')},'attributes':['id',_0x0ead('0x37'),'fullname','email','internal'],'raw':!![]});}return null;})['then'](function(_0x1ed32e){if(!_0x1ed32e)return null;_0x35efa8[_0x0ead('0x27')][_0x0ead('0x73')]=_0x1ed32e;return _0x35efa8;})[_0x0ead('0x34')](function(_0x29ec83){if(_0x29ec83){if(_0x1b098a['body'][_0x0ead('0x74')]){_0x35efa8[_0x0ead('0x27')]['interface']=util[_0x0ead('0x5f')](_0x0ead('0x75'),_0x1b098a[_0x0ead('0x62')]['name']);_0x35efa8[_0x0ead('0x27')][_0x0ead('0x76')]=_0x35efa8[_0x0ead('0x76')];_0x35efa8[_0x0ead('0x27')][_0x0ead('0x77')]=_0x35efa8['channel'];_0x35efa8[_0x0ead('0x27')][_0x0ead('0x78')]=_0x0ead('0x79');return respondWithRpcPromise(_0x0ead('0x7a'),_0x0ead('0x7a'),{'event':_0x0ead('0x7b'),'message':_0x35efa8[_0x0ead('0x27')]},client9002)[_0x0ead('0x34')](function(){return _0x35efa8;});}return _0x35efa8;}return null;})['then'](respondWithResult(_0x7b499,null))['catch'](handleError(_0x7b499,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0x0ead('0x31')]=function(_0x306cc1,_0x16fed7,_0x44ce6c){var _0x141e1f={'agent':{},'channel':'whatsapp'};if(_0x306cc1[_0x0ead('0x58')]['id']){delete _0x306cc1[_0x0ead('0x58')]['id'];}_0x306cc1[_0x0ead('0x58')]['UserId']=_0x306cc1[_0x0ead('0x58')]['UserId']||_0x306cc1[_0x0ead('0x62')]['id'];_0x141e1f[_0x0ead('0x73')]['id']=_0x306cc1[_0x0ead('0x58')]['UserId'];return db[_0x0ead('0x4f')][_0x0ead('0x56')]({'where':{'id':_0x306cc1[_0x0ead('0x59')]['id'],'UserId':null}})[_0x0ead('0x34')](handleEntityNotFound(_0x16fed7,null))[_0x0ead('0x34')](function(_0x57e8cf){if(_0x57e8cf){_0x141e1f['message']=_0x57e8cf[_0x0ead('0x68')]({'plain':!![]});return db['WhatsappInteraction'][_0x0ead('0x56')]({'where':{'id':_0x57e8cf[_0x0ead('0x64')]}});}return null;})[_0x0ead('0x34')](handleEntityNotFound(_0x16fed7,null))[_0x0ead('0x34')](function(_0x15fb1c){if(_0x15fb1c){_0x141e1f['interaction']=_0x15fb1c[_0x0ead('0x68')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x306cc1[_0x0ead('0x62')]['id'],_0x306cc1[_0x0ead('0x62')][_0x0ead('0x37')],_0x306cc1[_0x0ead('0x62')][_0x0ead('0x6a')],_0x141e1f[_0x0ead('0x67')]['id'],_0x306cc1[_0x0ead('0x58')]?JSON[_0x0ead('0x6b')](_0x306cc1[_0x0ead('0x58')]):_0x0ead('0x7c'));return respondWithRpcPromise(_0x0ead('0x7d'),_0x0ead('0x7e'),_0x141e1f);}return null;})['then'](function(_0x4983b2){var _0x5ac49c=_0x0ead('0x6d')+_0x4983b2[_0x0ead('0x27')][_0x0ead('0x6e')];return db['sequelize'][_0x0ead('0x3f')](_0x5ac49c,{'type':db[_0x0ead('0x6f')][_0x0ead('0x70')][_0x0ead('0x7f')],'raw':!![]})[_0x0ead('0x34')](function(_0x424f38){return _0x424f38;});})[_0x0ead('0x34')](function(_0x5040bd){if(_0x5040bd){_0x141e1f[_0x0ead('0x27')][_0x0ead('0x71')]=_0x5040bd[0x0];if(!_0x306cc1[_0x0ead('0x58')]['UserId'])return;return db[_0x0ead('0x72')]['find']({'where':{'id':_0x306cc1[_0x0ead('0x58')][_0x0ead('0x61')],'role':_0x0ead('0x73')},'attributes':['id',_0x0ead('0x37'),_0x0ead('0x80'),_0x0ead('0x81'),'internal'],'raw':!![]});}return null;})[_0x0ead('0x34')](function(_0x35362d){if(!_0x35362d)return null;_0x141e1f[_0x0ead('0x27')]['agent']=_0x35362d;return _0x141e1f;})[_0x0ead('0x34')](function(_0x4b4254){if(_0x4b4254){_0x4b4254[_0x0ead('0x27')][_0x0ead('0x82')]=util[_0x0ead('0x5f')](_0x0ead('0x75'),_0x306cc1[_0x0ead('0x62')][_0x0ead('0x37')]);_0x4b4254[_0x0ead('0x27')][_0x0ead('0x76')]=_0x141e1f[_0x0ead('0x76')];_0x4b4254[_0x0ead('0x27')][_0x0ead('0x77')]=_0x141e1f['channel'];_0x4b4254[_0x0ead('0x27')][_0x0ead('0x78')]='reject';respondWithRpcPromise(_0x0ead('0x7a'),_0x0ead('0x7a'),{'event':_0x0ead('0x83'),'message':_0x4b4254[_0x0ead('0x27')]},client9002);return _0x141e1f;}return null;})[_0x0ead('0x34')](respondWithResult(_0x16fed7,null))[_0x0ead('0x28')](handleError(_0x16fed7,null));};exports[_0x0ead('0x2b')]=function(_0x29c640,_0x310010,_0x13212d){if(_0x29c640[_0x0ead('0x58')]['id']){delete _0x29c640[_0x0ead('0x58')]['id'];}var _0x5c0919;return db[_0x0ead('0x4f')][_0x0ead('0x56')]({'where':{'id':_0x29c640['params']['id']}})['then'](handleEntityNotFound(_0x310010,null))['then'](function(_0x2179c9){if(_0x2179c9){_0x5c0919=_0x2179c9;return db[_0x0ead('0x84')][_0x0ead('0x56')]({'where':{'id':_0x2179c9[_0x0ead('0x85')]}});}})[_0x0ead('0x34')](handleEntityNotFound(_0x310010,null))[_0x0ead('0x34')](function(_0x19835e){if(_0x19835e){logger['debug']('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x0ead('0x2b'),_0x0ead('0x86'),_0x19835e['type'],util[_0x0ead('0x87')](_0x29c640[_0x0ead('0x58')],{'showHidden':![],'depth':null}));switch(_0x19835e['type']){case'twilio':if(_0x29c640[_0x0ead('0x58')]['MessageSid']&&_0x29c640['body'][_0x0ead('0x88')]===_0x5c0919[_0x0ead('0x89')]&&_0x29c640[_0x0ead('0x58')]['MessageStatus']&&_0x29c640[_0x0ead('0x58')]['MessageStatus']==='read'){return _0x5c0919[_0x0ead('0x33')]({'read':!![]});}else{logger[_0x0ead('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x0ead('0x2b'),_0x0ead('0x8a'),util[_0x0ead('0x87')](_0x29c640[_0x0ead('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x5c0919;}})[_0x0ead('0x34')](respondWithResult(_0x310010,null))['catch'](handleError(_0x310010,null));}; \ No newline at end of file +var _0x2993=['http','client','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','stack','name','index','map','WhatsappMessage','rawAttributes','fieldName','type','query','keys','filters','attributes','intersection','model','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','fields','includeAll','create','body','find','params','describe','whatsapp-interactions','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','format','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','email','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','jayson/promise'];(function(_0x2b66e4,_0x20575f){var _0x376e94=function(_0x25f782){while(--_0x25f782){_0x2b66e4['push'](_0x2b66e4['shift']());}};_0x376e94(++_0x20575f);}(_0x2993,0xf7));var _0x3299=function(_0x590597,_0x279fb6){_0x590597=_0x590597-0x0;var _0x3eb1dd=_0x2993[_0x590597];return _0x3eb1dd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3299('0x0'));var zipdir=require(_0x3299('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3299('0x2'));var moment=require(_0x3299('0x3'));var BPromise=require(_0x3299('0x4'));var Mustache=require(_0x3299('0x5'));var util=require(_0x3299('0x6'));var path=require('path');var sox=require(_0x3299('0x7'));var csv=require(_0x3299('0x8'));var ejs=require(_0x3299('0x9'));var fs=require('fs');var fs_extra=require(_0x3299('0xa'));var _=require(_0x3299('0xb'));var squel=require(_0x3299('0xc'));var crypto=require('crypto');var jsforce=require(_0x3299('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3299('0xe'));var Papa=require(_0x3299('0xf'));var Redis=require('ioredis');var authService=require(_0x3299('0x10'));var qs=require(_0x3299('0x11'));var as=require(_0x3299('0x12'));var hardwareService=require(_0x3299('0x13'));var logger=require(_0x3299('0x14'))('api');var utils=require(_0x3299('0x15'));var config=require(_0x3299('0x16'));var licenseUtil=require(_0x3299('0x17'));var db=require(_0x3299('0x18'))['db'];config['redis']=_[_0x3299('0x19')](config[_0x3299('0x1a')],{'host':_0x3299('0x1b'),'port':0x18eb});var socket=require(_0x3299('0x1c'))(new Redis(config[_0x3299('0x1a')]));require(_0x3299('0x1d'))['register'](socket);var jayson=require(_0x3299('0x1e'));var client=jayson['client'][_0x3299('0x1f')]({'port':0x232c});var client9002=jayson[_0x3299('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d26ce,_0x1c3baf,_0x371b32,_0x3a6a5c){return new BPromise(function(_0x4c1a71,_0x531f4b){var _0x57aff6=_0x3a6a5c||client;return _0x57aff6[_0x3299('0x21')](_0x3d26ce,_0x371b32)[_0x3299('0x22')](function(_0x5a19c4){logger[_0x3299('0x23')](_0x3299('0x24'),_0x1c3baf,_0x3299('0x25'));logger[_0x3299('0x26')](_0x3299('0x27'),_0x1c3baf,'request\x20sent',JSON[_0x3299('0x28')](_0x5a19c4));if(_0x5a19c4[_0x3299('0x29')]){if(_0x5a19c4['error']['code']===0x1f4){logger[_0x3299('0x29')](_0x3299('0x24'),_0x1c3baf,_0x5a19c4[_0x3299('0x29')][_0x3299('0x2a')]);return _0x531f4b(_0x5a19c4[_0x3299('0x29')][_0x3299('0x2a')]);}logger[_0x3299('0x29')](_0x3299('0x24'),_0x1c3baf,_0x5a19c4[_0x3299('0x29')][_0x3299('0x2a')]);return _0x4c1a71(_0x5a19c4[_0x3299('0x29')]['message']);}else{logger[_0x3299('0x23')](_0x3299('0x24'),_0x1c3baf,_0x3299('0x25'));_0x4c1a71(_0x5a19c4['result'][_0x3299('0x2a')]);}})[_0x3299('0x2b')](function(_0x51f895){logger[_0x3299('0x29')]('WhatsappMessage,\x20%s,\x20%s',_0x1c3baf,_0x51f895);_0x531f4b(_0x51f895);});});}function respondWithStatusCode(_0x185a97,_0x5b4ab8){_0x5b4ab8=_0x5b4ab8||0xcc;return function(_0x33730f){if(_0x33730f){return _0x185a97[_0x3299('0x2c')](_0x5b4ab8);}return _0x185a97[_0x3299('0x2d')](_0x5b4ab8)[_0x3299('0x2e')]();};}function respondWithResult(_0x5af0a0,_0x1d809c){_0x1d809c=_0x1d809c||0xc8;return function(_0x1cd50b){if(_0x1cd50b){return _0x5af0a0[_0x3299('0x2d')](_0x1d809c)['json'](_0x1cd50b);}};}function respondWithFilteredResult(_0x391624,_0x22aee5){return function(_0x14d78b){if(_0x14d78b){var _0x550df1=typeof _0x22aee5['offset']===_0x3299('0x2f')&&typeof _0x22aee5[_0x3299('0x30')]==='undefined';var _0x2a8413=_0x14d78b[_0x3299('0x31')];var _0x1bfe65=_0x550df1?0x0:_0x22aee5['offset'];var _0x1482ed=_0x550df1?_0x14d78b[_0x3299('0x31')]:_0x22aee5[_0x3299('0x32')]+_0x22aee5['limit'];var _0x2c68b6;if(_0x1482ed>=_0x2a8413){_0x1482ed=_0x2a8413;_0x2c68b6=0xc8;}else{_0x2c68b6=0xce;}_0x391624[_0x3299('0x2d')](_0x2c68b6);return _0x391624[_0x3299('0x33')](_0x3299('0x34'),_0x1bfe65+'-'+_0x1482ed+'/'+_0x2a8413)['json'](_0x14d78b);}return null;};}function patchUpdates(_0x16ef54){return function(_0x3db845){try{jsonpatch[_0x3299('0x35')](_0x3db845,_0x16ef54,!![]);}catch(_0x33f83c){return BPromise[_0x3299('0x36')](_0x33f83c);}return _0x3db845[_0x3299('0x37')]();};}function saveUpdates(_0x204647,_0x4738ae){return function(_0xc97cd1){if(_0xc97cd1){return _0xc97cd1[_0x3299('0x38')](_0x204647)[_0x3299('0x22')](function(_0x46a9b7){return _0x46a9b7;});}return null;};}function removeEntity(_0x54563c,_0x4ac90b){return function(_0x32b86a){if(_0x32b86a){return _0x32b86a['destroy']()[_0x3299('0x22')](function(){_0x54563c[_0x3299('0x2d')](0xcc)[_0x3299('0x2e')]();});}};}function handleEntityNotFound(_0x4e885f,_0x22c169){return function(_0x431103){if(!_0x431103){_0x4e885f['sendStatus'](0x194);}return _0x431103;};}function handleError(_0x60e559,_0x3a0319){_0x3a0319=_0x3a0319||0x1f4;return function(_0x46f4a5){logger['error'](_0x46f4a5[_0x3299('0x39')]);if(_0x46f4a5['name']){delete _0x46f4a5[_0x3299('0x3a')];}_0x60e559[_0x3299('0x2d')](_0x3a0319)['send'](_0x46f4a5);};}exports[_0x3299('0x3b')]=function(_0x2d18dd,_0x396182){var _0x540792={},_0x4f0855={},_0x2b5f33={'count':0x0,'rows':[]};var _0x2bf8f2=_[_0x3299('0x3c')](db[_0x3299('0x3d')][_0x3299('0x3e')],function(_0x3a2fc5){return{'name':_0x3a2fc5[_0x3299('0x3f')],'type':_0x3a2fc5[_0x3299('0x40')]['key']};});_0x4f0855['model']=_[_0x3299('0x3c')](_0x2bf8f2,_0x3299('0x3a'));_0x4f0855[_0x3299('0x41')]=_[_0x3299('0x42')](_0x2d18dd[_0x3299('0x41')]);_0x4f0855[_0x3299('0x43')]=_['intersection'](_0x4f0855['model'],_0x4f0855[_0x3299('0x41')]);_0x540792[_0x3299('0x44')]=_[_0x3299('0x45')](_0x4f0855[_0x3299('0x46')],qs['fields'](_0x2d18dd[_0x3299('0x41')]['fields']));_0x540792[_0x3299('0x44')]=_0x540792[_0x3299('0x44')][_0x3299('0x47')]?_0x540792[_0x3299('0x44')]:_0x4f0855[_0x3299('0x46')];if(!_0x2d18dd[_0x3299('0x41')][_0x3299('0x48')](_0x3299('0x49'))){_0x540792[_0x3299('0x30')]=qs[_0x3299('0x30')](_0x2d18dd['query'][_0x3299('0x30')]);_0x540792[_0x3299('0x32')]=qs[_0x3299('0x32')](_0x2d18dd['query']['offset']);}_0x540792[_0x3299('0x4a')]=qs[_0x3299('0x4b')](_0x2d18dd['query']['sort']);_0x540792[_0x3299('0x4c')]=qs['filters'](_[_0x3299('0x4d')](_0x2d18dd['query'],_0x4f0855['filters']),_0x2bf8f2);if(_0x2d18dd['query'][_0x3299('0x4e')]){_0x540792[_0x3299('0x4c')]=_[_0x3299('0x4f')](_0x540792['where'],{'$or':_[_0x3299('0x3c')](_0x2bf8f2,function(_0x3b1c85){if(_0x3b1c85['type']!==_0x3299('0x50')){var _0x54c9d4={};_0x54c9d4[_0x3b1c85[_0x3299('0x3a')]]={'$like':'%'+_0x2d18dd[_0x3299('0x41')][_0x3299('0x4e')]+'%'};return _0x54c9d4;}})});}_0x540792=_[_0x3299('0x4f')]({},_0x540792,_0x2d18dd[_0x3299('0x51')]);var _0xa7cdd4={'where':_0x540792[_0x3299('0x4c')]};return db[_0x3299('0x3d')]['count'](_0xa7cdd4)[_0x3299('0x22')](function(_0x520ef3){_0x2b5f33[_0x3299('0x31')]=_0x520ef3;if(_0x2d18dd[_0x3299('0x41')]['includeAll']){_0x540792[_0x3299('0x52')]=[{'all':!![]}];}return db[_0x3299('0x3d')][_0x3299('0x53')](_0x540792);})[_0x3299('0x22')](function(_0x17e156){_0x2b5f33[_0x3299('0x54')]=_0x17e156;return _0x2b5f33;})[_0x3299('0x22')](respondWithFilteredResult(_0x396182,_0x540792))[_0x3299('0x2b')](handleError(_0x396182,null));};exports['show']=function(_0x3d311e,_0x1664ac){var _0x3df185={'raw':!![],'where':{'id':_0x3d311e['params']['id']}},_0x518f66={};_0x518f66['model']=_[_0x3299('0x42')](db[_0x3299('0x3d')][_0x3299('0x3e')]);_0x518f66['query']=_[_0x3299('0x42')](_0x3d311e[_0x3299('0x41')]);_0x518f66[_0x3299('0x43')]=_[_0x3299('0x45')](_0x518f66['model'],_0x518f66[_0x3299('0x41')]);_0x3df185[_0x3299('0x44')]=_[_0x3299('0x45')](_0x518f66['model'],qs[_0x3299('0x55')](_0x3d311e['query'][_0x3299('0x55')]));_0x3df185[_0x3299('0x44')]=_0x3df185[_0x3299('0x44')][_0x3299('0x47')]?_0x3df185['attributes']:_0x518f66[_0x3299('0x46')];if(_0x3d311e[_0x3299('0x41')][_0x3299('0x56')]){_0x3df185[_0x3299('0x52')]=[{'all':!![]}];}_0x3df185=_[_0x3299('0x4f')]({},_0x3df185,_0x3d311e[_0x3299('0x51')]);return db[_0x3299('0x3d')]['find'](_0x3df185)[_0x3299('0x22')](handleEntityNotFound(_0x1664ac,null))[_0x3299('0x22')](respondWithResult(_0x1664ac,null))[_0x3299('0x2b')](handleError(_0x1664ac,null));};exports[_0x3299('0x57')]=function(_0x3446cf,_0x53da20){return db['WhatsappMessage'][_0x3299('0x57')](_0x3446cf[_0x3299('0x58')],{})[_0x3299('0x22')](respondWithResult(_0x53da20,0xc9))[_0x3299('0x2b')](handleError(_0x53da20,null));};exports[_0x3299('0x38')]=function(_0x10a4f0,_0x547c2c){if(_0x10a4f0[_0x3299('0x58')]['id']){delete _0x10a4f0[_0x3299('0x58')]['id'];}return db[_0x3299('0x3d')][_0x3299('0x59')]({'where':{'id':_0x10a4f0[_0x3299('0x5a')]['id']}})[_0x3299('0x22')](handleEntityNotFound(_0x547c2c,null))[_0x3299('0x22')](saveUpdates(_0x10a4f0[_0x3299('0x58')],null))[_0x3299('0x22')](respondWithResult(_0x547c2c,null))[_0x3299('0x2b')](handleError(_0x547c2c,null));};exports['destroy']=function(_0x4c8afd,_0xa8d236){return db[_0x3299('0x3d')][_0x3299('0x59')]({'where':{'id':_0x4c8afd[_0x3299('0x5a')]['id']}})[_0x3299('0x22')](handleEntityNotFound(_0xa8d236,null))['then'](removeEntity(_0xa8d236,null))['catch'](handleError(_0xa8d236,null));};exports[_0x3299('0x5b')]=function(_0x54614b,_0x4e7631){return db[_0x3299('0x3d')]['describe']()['then'](respondWithResult(_0x4e7631,null))['catch'](handleError(_0x4e7631,null));};var interaction_log=require(_0x3299('0x14'))(_0x3299('0x5c'));exports[_0x3299('0x5d')]=function(_0x44de37,_0x30e6c1,_0x271f91){var _0x29e853={'agent':{},'channel':_0x3299('0x5e')};if(_0x44de37['body']['id']){delete _0x44de37[_0x3299('0x58')]['id'];}_0x44de37[_0x3299('0x58')][_0x3299('0x5f')]=!![];_0x44de37[_0x3299('0x58')][_0x3299('0x60')]=moment()['format'](_0x3299('0x61'));_0x44de37[_0x3299('0x58')][_0x3299('0x62')]=_0x44de37[_0x3299('0x58')][_0x3299('0x62')]||_0x44de37[_0x3299('0x63')]['id'];_0x29e853[_0x3299('0x64')]['id']=_0x44de37[_0x3299('0x58')]['UserId'];return db[_0x3299('0x3d')][_0x3299('0x59')]({'where':{'id':_0x44de37['params']['id'],'UserId':null}})[_0x3299('0x22')](handleEntityNotFound(_0x30e6c1,null))[_0x3299('0x22')](saveUpdates(_0x44de37[_0x3299('0x58')],null))[_0x3299('0x22')](function(_0x4c9318){if(_0x4c9318){_0x29e853[_0x3299('0x2a')]=_0x4c9318[_0x3299('0x65')]({'plain':!![]});return db[_0x3299('0x66')][_0x3299('0x59')]({'where':{'id':_0x4c9318[_0x3299('0x67')]}});}return null;})[_0x3299('0x22')](handleEntityNotFound(_0x30e6c1,null))[_0x3299('0x22')](function(_0x3b961d){if(_0x3b961d){return _0x3b961d[_0x3299('0x38')]({'UserId':_0x44de37[_0x3299('0x58')][_0x3299('0x62')],'read1stAt':_[_0x3299('0x68')](_0x3b961d[_0x3299('0x69')])?moment()['format'](_0x3299('0x61')):undefined});}return null;})[_0x3299('0x22')](function(_0x292129){if(_0x292129){_0x29e853[_0x3299('0x6a')]=_0x292129['get']({'plain':!![]});interaction_log['info'](_0x3299('0x6b'),_0x44de37[_0x3299('0x63')]['id'],_0x44de37[_0x3299('0x63')][_0x3299('0x3a')],_0x44de37['user']['role'],_0x29e853['interaction']['id'],_0x44de37[_0x3299('0x58')]?JSON[_0x3299('0x28')](_0x44de37[_0x3299('0x58')]):_0x3299('0x6c'));return respondWithRpcPromise(_0x3299('0x6d'),'acceptMessage',_0x29e853);}return null;})[_0x3299('0x22')](function(_0x355065){var _0xc45f50=_0x3299('0x6e')+_0x355065[_0x3299('0x2a')]['ContactId'];return db[_0x3299('0x6f')][_0x3299('0x41')](_0xc45f50,{'type':db[_0x3299('0x70')][_0x3299('0x71')][_0x3299('0x72')],'raw':!![]})[_0x3299('0x22')](function(_0xf6302d){return _0xf6302d;});})['then'](function(_0x2c1e9b){if(_0x2c1e9b){_0x29e853[_0x3299('0x2a')][_0x3299('0x73')]=_0x2c1e9b[0x0];if(!_0x44de37[_0x3299('0x58')]['UserId'])return;return db[_0x3299('0x74')][_0x3299('0x59')]({'where':{'id':_0x44de37[_0x3299('0x58')][_0x3299('0x62')],'role':_0x3299('0x64')},'attributes':['id',_0x3299('0x3a'),_0x3299('0x75'),'email',_0x3299('0x76')],'raw':!![]});}return null;})['then'](function(_0x14ce7c){if(!_0x14ce7c)return null;_0x29e853[_0x3299('0x2a')]['agent']=_0x14ce7c;return _0x29e853;})[_0x3299('0x22')](function(_0x20a866){if(_0x20a866){if(_0x44de37[_0x3299('0x58')]['manual']){_0x29e853[_0x3299('0x2a')]['interface']=util[_0x3299('0x77')](_0x3299('0x78'),_0x44de37['user'][_0x3299('0x3a')]);_0x29e853[_0x3299('0x2a')][_0x3299('0x79')]=_0x29e853['channel'];_0x29e853['message'][_0x3299('0x7a')]=_0x29e853[_0x3299('0x79')];_0x29e853[_0x3299('0x2a')][_0x3299('0x7b')]='accept';return respondWithRpcPromise(_0x3299('0x7c'),_0x3299('0x7c'),{'event':_0x3299('0x7d'),'message':_0x29e853['message']},client9002)[_0x3299('0x22')](function(){return _0x29e853;});}return _0x29e853;}return null;})['then'](respondWithResult(_0x30e6c1,null))[_0x3299('0x2b')](handleError(_0x30e6c1,null));};var interaction_log=require(_0x3299('0x14'))(_0x3299('0x5c'));exports[_0x3299('0x36')]=function(_0x5e25b0,_0x5e1a0e,_0x37aeca){var _0x2842e2={'agent':{},'channel':_0x3299('0x5e')};if(_0x5e25b0[_0x3299('0x58')]['id']){delete _0x5e25b0[_0x3299('0x58')]['id'];}_0x5e25b0[_0x3299('0x58')][_0x3299('0x62')]=_0x5e25b0[_0x3299('0x58')][_0x3299('0x62')]||_0x5e25b0['user']['id'];_0x2842e2['agent']['id']=_0x5e25b0['body'][_0x3299('0x62')];return db[_0x3299('0x3d')][_0x3299('0x59')]({'where':{'id':_0x5e25b0[_0x3299('0x5a')]['id'],'UserId':null}})[_0x3299('0x22')](handleEntityNotFound(_0x5e1a0e,null))['then'](function(_0x19f4d3){if(_0x19f4d3){_0x2842e2[_0x3299('0x2a')]=_0x19f4d3['get']({'plain':!![]});return db['WhatsappInteraction'][_0x3299('0x59')]({'where':{'id':_0x19f4d3[_0x3299('0x67')]}});}return null;})[_0x3299('0x22')](handleEntityNotFound(_0x5e1a0e,null))['then'](function(_0x1091bb){if(_0x1091bb){_0x2842e2[_0x3299('0x6a')]=_0x1091bb[_0x3299('0x65')]({'plain':!![]});interaction_log[_0x3299('0x23')](_0x3299('0x7e'),_0x5e25b0[_0x3299('0x63')]['id'],_0x5e25b0[_0x3299('0x63')]['name'],_0x5e25b0[_0x3299('0x63')][_0x3299('0x7f')],_0x2842e2[_0x3299('0x6a')]['id'],_0x5e25b0[_0x3299('0x58')]?JSON[_0x3299('0x28')](_0x5e25b0[_0x3299('0x58')]):'null');return respondWithRpcPromise(_0x3299('0x80'),'rejectMessage',_0x2842e2);}return null;})['then'](function(_0x3b64ea){var _0x119747='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3b64ea['message']['ContactId'];return db['sequelize'][_0x3299('0x41')](_0x119747,{'type':db[_0x3299('0x70')]['QueryTypes'][_0x3299('0x72')],'raw':!![]})[_0x3299('0x22')](function(_0x57cd9d){return _0x57cd9d;});})[_0x3299('0x22')](function(_0x4d8dc5){if(_0x4d8dc5){_0x2842e2[_0x3299('0x2a')][_0x3299('0x73')]=_0x4d8dc5[0x0];if(!_0x5e25b0[_0x3299('0x58')][_0x3299('0x62')])return;return db[_0x3299('0x74')]['find']({'where':{'id':_0x5e25b0[_0x3299('0x58')][_0x3299('0x62')],'role':_0x3299('0x64')},'attributes':['id',_0x3299('0x3a'),_0x3299('0x75'),_0x3299('0x81'),'internal'],'raw':!![]});}return null;})[_0x3299('0x22')](function(_0x2c19b0){if(!_0x2c19b0)return null;_0x2842e2[_0x3299('0x2a')][_0x3299('0x64')]=_0x2c19b0;return _0x2842e2;})[_0x3299('0x22')](function(_0x1a2911){if(_0x1a2911){_0x1a2911[_0x3299('0x2a')]['interface']=util[_0x3299('0x77')](_0x3299('0x78'),_0x5e25b0[_0x3299('0x63')][_0x3299('0x3a')]);_0x1a2911[_0x3299('0x2a')][_0x3299('0x79')]=_0x2842e2[_0x3299('0x79')];_0x1a2911['message'][_0x3299('0x7a')]=_0x2842e2[_0x3299('0x79')];_0x1a2911['message'][_0x3299('0x7b')]='reject';respondWithRpcPromise(_0x3299('0x7c'),_0x3299('0x7c'),{'event':_0x3299('0x82'),'message':_0x1a2911[_0x3299('0x2a')]},client9002);return _0x2842e2;}return null;})[_0x3299('0x22')](respondWithResult(_0x5e1a0e,null))[_0x3299('0x2b')](handleError(_0x5e1a0e,null));};exports[_0x3299('0x2d')]=function(_0x4fe627,_0x3c50ed,_0x1378e0){if(_0x4fe627['body']['id']){delete _0x4fe627[_0x3299('0x58')]['id'];}var _0x247cd4;return db[_0x3299('0x3d')][_0x3299('0x59')]({'where':{'id':_0x4fe627[_0x3299('0x5a')]['id']}})[_0x3299('0x22')](handleEntityNotFound(_0x3c50ed,null))[_0x3299('0x22')](function(_0x293828){if(_0x293828){_0x247cd4=_0x293828;return db['WhatsappAccount'][_0x3299('0x59')]({'where':{'id':_0x293828[_0x3299('0x83')]}});}})[_0x3299('0x22')](handleEntityNotFound(_0x3c50ed,null))[_0x3299('0x22')](function(_0x32967c){if(_0x32967c){logger[_0x3299('0x26')](_0x3299('0x84'),_0x3299('0x2d'),_0x3299('0x85'),_0x32967c[_0x3299('0x40')],util[_0x3299('0x86')](_0x4fe627['body'],{'showHidden':![],'depth':null}));switch(_0x32967c['type']){case _0x3299('0x87'):if(_0x4fe627['body'][_0x3299('0x88')]&&_0x4fe627[_0x3299('0x58')][_0x3299('0x88')]===_0x247cd4[_0x3299('0x89')]&&_0x4fe627[_0x3299('0x58')][_0x3299('0x8a')]&&_0x4fe627[_0x3299('0x58')][_0x3299('0x8a')]==='read'){return _0x247cd4[_0x3299('0x38')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x3299('0x2d'),_0x3299('0x87'),util[_0x3299('0x86')](_0x4fe627[_0x3299('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x247cd4;}})[_0x3299('0x22')](respondWithResult(_0x3c50ed,null))[_0x3299('0x2b')](handleError(_0x3c50ed,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 350e09c..4a79878 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 _0xde2c=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappMessage'];(function(_0xb875ee,_0x583042){var _0x4c7f3a=function(_0x1f6661){while(--_0x1f6661){_0xb875ee['push'](_0xb875ee['shift']());}};_0x4c7f3a(++_0x583042);}(_0xde2c,0x7f));var _0xcde2=function(_0x2b5513,_0x3fe5cd){_0x2b5513=_0x2b5513-0x0;var _0x578fd2=_0xde2c[_0x2b5513];return _0x578fd2;};'use strict';var EventEmitter=require(_0xcde2('0x0'));var WhatsappMessage=require(_0xcde2('0x1'))['db'][_0xcde2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xcde2('0x3')](0x0);var events={'afterCreate':_0xcde2('0x4'),'afterUpdate':_0xcde2('0x5'),'afterDestroy':_0xcde2('0x6')};function emitEvent(_0x3a309f){return function(_0x55c175,_0x4353c8,_0x196898){WhatsappMessageEvents[_0xcde2('0x7')](_0x3a309f+':'+_0x55c175['id'],_0x55c175);WhatsappMessageEvents[_0xcde2('0x7')](_0x3a309f,_0x55c175);_0x196898(null);};}for(var e in events){if(events[_0xcde2('0x8')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xcde2('0x9')]=WhatsappMessageEvents; \ No newline at end of file +var _0x0bb5=['events','../../mysqldb','save','update','remove','emit','hook','exports'];(function(_0x49f8c2,_0x5166b7){var _0x3e63ec=function(_0x575c26){while(--_0x575c26){_0x49f8c2['push'](_0x49f8c2['shift']());}};_0x3e63ec(++_0x5166b7);}(_0x0bb5,0x148));var _0x50bb=function(_0x22fe98,_0xf64134){_0x22fe98=_0x22fe98-0x0;var _0x556026=_0x0bb5[_0x22fe98];return _0x556026;};'use strict';var EventEmitter=require(_0x50bb('0x0'));var WhatsappMessage=require(_0x50bb('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x50bb('0x2'),'afterUpdate':_0x50bb('0x3'),'afterDestroy':_0x50bb('0x4')};function emitEvent(_0x117e36){return function(_0x29c72b,_0xfdc9d4,_0x451b4c){WhatsappMessageEvents[_0x50bb('0x5')](_0x117e36+':'+_0x29c72b['id'],_0x29c72b);WhatsappMessageEvents['emit'](_0x117e36,_0x29c72b);_0x451b4c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x50bb('0x6')](e,emitEvent(event));}}module[_0x50bb('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 613893b..bafd59b 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 _0x2df9=['finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','node-fetch','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','get','direction','toLowerCase','out','secret','isNil','findOne','then','update','createdAt','catch','error','WhatsappAccount','type','twilio','phone','accountSid','messages','whatsapp:','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','authToken','baseUrl','/whatsapp/v1/','/messages/','text','POST','application/json','statuses','message_id','err'];(function(_0x110f5c,_0x36ebfa){var _0x2dc43d=function(_0x22e531){while(--_0x22e531){_0x110f5c['push'](_0x110f5c['shift']());}};_0x2dc43d(++_0x36ebfa);}(_0x2df9,0x14d));var _0x92df=function(_0x315f31,_0x59438e){_0x315f31=_0x315f31-0x0;var _0x120fca=_0x2df9[_0x315f31];return _0x120fca;};'use strict';var _=require(_0x92df('0x0'));var util=require(_0x92df('0x1'));var logger=require(_0x92df('0x2'))(_0x92df('0x3'));var moment=require(_0x92df('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fetch=require(_0x92df('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x92df('0x6'));var config=require(_0x92df('0x7'));var attributes=require('./whatsappMessage.attributes');module[_0x92df('0x8')]=function(_0x2e14a4,_0x45b3fc){return _0x2e14a4[_0x92df('0x9')](_0x92df('0xa'),attributes,{'tableName':_0x92df('0xb'),'paranoid':![],'indexes':[{'name':_0x92df('0xc'),'fields':[_0x92df('0xc')]},{'name':_0x92df('0xd'),'fields':[_0x92df('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x18cd96,_0x1c3d7d,_0x36fa24){var _0x5e9410=_0x2e14a4[_0x92df('0xf')];var _0x4117de=_0x18cd96[_0x92df('0x10')]({'plain':!![]});if(_0x4117de[_0x92df('0x11')]['toLowerCase']()==='in'||_0x4117de[_0x92df('0x11')][_0x92df('0x12')]()===_0x92df('0x13')&&!_0x4117de[_0x92df('0x14')]&&!_[_0x92df('0x15')](_0x4117de['UserId'])){_0x5e9410['WhatsappInteraction'][_0x92df('0x16')]({'where':{'id':_0x4117de['WhatsappInteractionId']}})[_0x92df('0x17')](function(_0x43507){if(_0x43507){_0x43507[_0x92df('0x18')]({'lastMsgAt':_0x4117de[_0x92df('0x19')],'lastMsgDirection':_0x4117de[_0x92df('0x11')][_0x92df('0x12')]()});}})[_0x92df('0x1a')](function(_0x55dab6){console[_0x92df('0x1b')](_0x55dab6);});}if(_0x4117de['direction']===_0x92df('0x13')&&!_0x4117de[_0x92df('0x14')]){var _0x3cb103;_0x5e9410[_0x92df('0x1c')]['find']({'where':{'id':_0x4117de['WhatsappAccountId']},'raw':!![]})['then'](function(_0x3f86e6){_0x3cb103=_0x3f86e6;if(_0x3cb103&&_0x3cb103[_0x92df('0x1d')]){switch(_0x3cb103[_0x92df('0x1d')]){case _0x92df('0x1e'):var _0x7eac6c=require('twilio');if(_0x3cb103['accountSid']&&_0x3cb103['authToken']&&_0x3cb103[_0x92df('0x1f')]){var _0x474ee5=new _0x7eac6c(_0x3cb103[_0x92df('0x20')],_0x3cb103['authToken']);_0x474ee5[_0x92df('0x21')]['create']({'body':_0x4117de[_0x92df('0xe')],'to':_0x92df('0x22')+_0x4117de[_0x92df('0x1f')],'from':_0x92df('0x22')+_0x3cb103[_0x92df('0x1f')],'statusCallback':_0x3cb103['remote']+'/api/whatsapp/messages/'+_0x4117de['id']+'/status?token='+_0x3cb103[_0x92df('0x23')]})[_0x92df('0x17')](function(_0x4b87db){if(_0x4b87db[_0x92df('0x24')]){return _0x18cd96[_0x92df('0x18')]({'messageId':_0x4b87db['sid']});}})[_0x92df('0x1a')](function(_0x5b6abf){logger['error'](_0x92df('0x25'),_0x92df('0x26'),_0x92df('0x1e'),util[_0x92df('0x27')](_0x5b6abf,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x92df('0x25'),_0x92df('0x26'),_0x92df('0x1e'),_0x92df('0x28'));}break;case _0x92df('0x29'):var _0x4e62d3=_0x3cb103[_0x92df('0x20')];var _0x4054bd=_0x3cb103[_0x92df('0x2a')];var _0x189b58=_0x3cb103[_0x92df('0x2b')]+_0x92df('0x2c')+_0x4e62d3+_0x92df('0x2d');var _0x1b4526={'to':[_0x4117de[_0x92df('0x1f')]],'message':{'type':_0x92df('0x2e'),'text':_0x4117de['body']}};var _0x2a0971={'method':_0x92df('0x2f'),'uri':_0x189b58,'headers':{'Authorization':'Bearer\x20'+_0x4054bd,'Content-Type':_0x92df('0x30')},'body':_0x1b4526,'json':!![]};rp(_0x2a0971)[_0x92df('0x17')](function(_0x269827){if(_0x269827[_0x92df('0x31')][0x0][_0x92df('0x32')]){return _0x18cd96[_0x92df('0x18')]({'messageId':_0x269827['statuses'][0x0]['message_id']});}})['catch'](function(_0xe156de){logger[_0x92df('0x33')]('WhatsappMessage,\x20%s',_0xe156de);});break;}}})[_0x92df('0x34')](function(){_0x36fa24();});}else{_0x36fa24();}}},'charset':_0x92df('0x35'),'collate':_0x92df('0x36')});}; \ No newline at end of file +var _0x706c=['create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','update','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','baseUrl','/whatsapp/v1/','/messages/','text','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','toLowerCase','out','secret','isNil','UserId','WhatsappInteractionId','then','direction','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x706c,0x8c));var _0xc706=function(_0x43c62a,_0x125d82){_0x43c62a=_0x43c62a-0x0;var _0x367fb8=_0x706c[_0x43c62a];return _0x367fb8;};'use strict';var _=require(_0xc706('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc706('0x1'));var BPromise=require(_0xc706('0x2'));var rp=require(_0xc706('0x3'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0xc706('0x4'));var rimraf=require(_0xc706('0x5'));var config=require(_0xc706('0x6'));var attributes=require(_0xc706('0x7'));module[_0xc706('0x8')]=function(_0x524399,_0x427046){return _0x524399[_0xc706('0x9')](_0xc706('0xa'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xc706('0xb'),'fields':[_0xc706('0xb')]},{'name':_0xc706('0xc'),'fields':[_0xc706('0xd')],'type':_0xc706('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x57fb7b,_0x59c1e3,_0x3f6a90){var _0x5aaf27=_0x524399[_0xc706('0xf')];var _0x34c31b=_0x57fb7b[_0xc706('0x10')]({'plain':!![]});if(_0x34c31b['direction'][_0xc706('0x11')]()==='in'||_0x34c31b['direction'][_0xc706('0x11')]()===_0xc706('0x12')&&!_0x34c31b[_0xc706('0x13')]&&!_[_0xc706('0x14')](_0x34c31b[_0xc706('0x15')])){_0x5aaf27['WhatsappInteraction']['findOne']({'where':{'id':_0x34c31b[_0xc706('0x16')]}})[_0xc706('0x17')](function(_0x158932){if(_0x158932){_0x158932['update']({'lastMsgAt':_0x34c31b['createdAt'],'lastMsgDirection':_0x34c31b[_0xc706('0x18')][_0xc706('0x11')]()});}})['catch'](function(_0x460b33){console[_0xc706('0x19')](_0x460b33);});}if(_0x34c31b['direction']===_0xc706('0x12')&&!_0x34c31b[_0xc706('0x13')]){var _0x5dcd98;_0x5aaf27[_0xc706('0x1a')][_0xc706('0x1b')]({'where':{'id':_0x34c31b[_0xc706('0x1c')]},'raw':!![]})[_0xc706('0x17')](function(_0x576752){_0x5dcd98=_0x576752;if(_0x5dcd98&&_0x5dcd98[_0xc706('0x1d')]){switch(_0x5dcd98[_0xc706('0x1d')]){case _0xc706('0x1e'):var _0x42919f=require(_0xc706('0x1e'));if(_0x5dcd98[_0xc706('0x1f')]&&_0x5dcd98[_0xc706('0x20')]&&_0x5dcd98[_0xc706('0x21')]){var _0x22e9d1=new _0x42919f(_0x5dcd98['accountSid'],_0x5dcd98[_0xc706('0x20')]);_0x22e9d1['messages'][_0xc706('0x22')]({'body':_0x34c31b[_0xc706('0xd')],'to':_0xc706('0x23')+_0x34c31b['phone'],'from':_0xc706('0x23')+_0x5dcd98[_0xc706('0x21')],'statusCallback':_0x5dcd98[_0xc706('0x24')]+_0xc706('0x25')+_0x34c31b['id']+_0xc706('0x26')+_0x5dcd98['token']})[_0xc706('0x17')](function(_0x283981){if(_0x283981[_0xc706('0x27')]){return _0x57fb7b[_0xc706('0x28')]({'messageId':_0x283981['sid']});}})[_0xc706('0x29')](function(_0x50cfe6){logger[_0xc706('0x19')](_0xc706('0x2a'),_0xc706('0x2b'),_0xc706('0x1e'),util[_0xc706('0x2c')](_0x50cfe6,{'showHidden':![],'depth':null}));});}else{logger[_0xc706('0x19')](_0xc706('0x2a'),_0xc706('0x2b'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'sinch':var _0x34c034=_0x5dcd98['accountSid'];var _0x268b81=_0x5dcd98[_0xc706('0x20')];var _0xabc7fb=_0x5dcd98[_0xc706('0x2d')]+_0xc706('0x2e')+_0x34c034+_0xc706('0x2f');var _0x5bff74={'to':[_0x34c31b[_0xc706('0x21')]],'message':{'type':_0xc706('0x30'),'text':_0x34c31b[_0xc706('0xd')]}};var _0x5ba94e={'method':'POST','uri':_0xabc7fb,'headers':{'Authorization':_0xc706('0x31')+_0x268b81,'Content-Type':_0xc706('0x32')},'body':_0x5bff74,'json':!![]};rp(_0x5ba94e)[_0xc706('0x17')](function(_0x2480ae){if(_0x2480ae[_0xc706('0x33')][0x0][_0xc706('0x34')]){return _0x57fb7b[_0xc706('0x28')]({'messageId':_0x2480ae[_0xc706('0x33')][0x0][_0xc706('0x34')]});}})['catch'](function(_0x88ede2){logger[_0xc706('0x35')](_0xc706('0x36'),_0x88ede2);});break;}}})[_0xc706('0x37')](function(){_0x3f6a90();});}else{_0x3f6a90();}}},'charset':_0xc706('0x38'),'collate':_0xc706('0x39')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 717b9ba..4edac1c 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 _0x324e=['../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','then','info','WhatsappMessage,\x20%s,\x20%s','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x417aa6,_0x401f42){var _0x46e3bc=function(_0x361de5){while(--_0x361de5){_0x417aa6['push'](_0x417aa6['shift']());}};_0x46e3bc(++_0x401f42);}(_0x324e,0xb5));var _0xe324=function(_0x35f6e1,_0x4781ed){_0x35f6e1=_0x35f6e1-0x0;var _0x521b6d=_0x324e[_0x35f6e1];return _0x521b6d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe324('0x0'));var rs=require(_0xe324('0x1'));var fs=require('fs');var Redis=require(_0xe324('0x2'));var db=require(_0xe324('0x3'))['db'];var utils=require(_0xe324('0x4'));var logger=require(_0xe324('0x5'))(_0xe324('0x6'));var config=require(_0xe324('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe324('0x8')][_0xe324('0x9')]({'port':0x232a});config[_0xe324('0xa')]=_[_0xe324('0xb')](config[_0xe324('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xe324('0xc'))(new Redis(config[_0xe324('0xa')]));require('./whatsappMessage.socket')[_0xe324('0xd')](socket);function respondWithRpcPromise(_0x454b59,_0x530c1e,_0x117cd9){return new BPromise(function(_0x2070c3,_0x51a126){return client['request'](_0x454b59,_0x117cd9)[_0xe324('0xe')](function(_0x41f91c){logger[_0xe324('0xf')](_0xe324('0x10'),_0x530c1e,'request\x20sent');logger['debug'](_0xe324('0x11'),_0x530c1e,_0xe324('0x12'),JSON[_0xe324('0x13')](_0x41f91c));if(_0x41f91c[_0xe324('0x14')]){if(_0x41f91c[_0xe324('0x14')][_0xe324('0x15')]===0x1f4){logger[_0xe324('0x14')](_0xe324('0x10'),_0x530c1e,_0x41f91c['error']['message']);return _0x51a126(_0x41f91c['error']['message']);}logger[_0xe324('0x14')](_0xe324('0x10'),_0x530c1e,_0x41f91c[_0xe324('0x14')][_0xe324('0x16')]);return _0x2070c3(_0x41f91c[_0xe324('0x14')][_0xe324('0x16')]);}else{logger['info'](_0xe324('0x10'),_0x530c1e,'request\x20sent');_0x2070c3(_0x41f91c[_0xe324('0x17')]['message']);}})[_0xe324('0x18')](function(_0x369793){logger[_0xe324('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x530c1e,_0x369793);_0x51a126(_0x369793);});});}exports[_0xe324('0x19')]=function(_0x54fc2a){var _0x298834=this;return new Promise(function(_0xc8900e,_0x1a4e7a){return db[_0xe324('0x1a')][_0xe324('0x1b')](_0x54fc2a[_0xe324('0x1c')],{'raw':_0x54fc2a['options']?_0x54fc2a[_0xe324('0x1d')][_0xe324('0x1e')]===undefined?!![]:![]:!![]})[_0xe324('0xe')](function(_0x224942){logger[_0xe324('0xf')](_0xe324('0x19'),_0x54fc2a);logger['debug']('CreateWhatsappMessage',_0x54fc2a,JSON['stringify'](_0x224942));_0xc8900e(_0x224942);})[_0xe324('0x18')](function(_0x1605e9){logger[_0xe324('0x14')](_0xe324('0x19'),_0x1605e9[_0xe324('0x16')],_0x54fc2a);_0x1a4e7a(_0x298834[_0xe324('0x14')](0x1f4,_0x1605e9['message']));});});}; \ No newline at end of file +var _0xed7f=['catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','then','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','request','info','WhatsappMessage,\x20%s,\x20%s','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5eedb0,_0x11c82d){var _0x41c5ba=function(_0x3733e9){while(--_0x3733e9){_0x5eedb0['push'](_0x5eedb0['shift']());}};_0x41c5ba(++_0x11c82d);}(_0xed7f,0x1d0));var _0xfed7=function(_0x4be57c,_0x151881){_0x4be57c=_0x4be57c-0x0;var _0x5901da=_0xed7f[_0x4be57c];return _0x5901da;};'use strict';var _=require(_0xfed7('0x0'));var util=require(_0xfed7('0x1'));var moment=require(_0xfed7('0x2'));var BPromise=require('bluebird');var rs=require(_0xfed7('0x3'));var fs=require('fs');var Redis=require(_0xfed7('0x4'));var db=require(_0xfed7('0x5'))['db'];var utils=require(_0xfed7('0x6'));var logger=require(_0xfed7('0x7'))('rpc');var config=require(_0xfed7('0x8'));var jayson=require(_0xfed7('0x9'));var client=jayson[_0xfed7('0xa')][_0xfed7('0xb')]({'port':0x232a});config[_0xfed7('0xc')]=_[_0xfed7('0xd')](config[_0xfed7('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xfed7('0xe'))(new Redis(config[_0xfed7('0xc')]));require(_0xfed7('0xf'))[_0xfed7('0x10')](socket);function respondWithRpcPromise(_0x3aa472,_0x30672c,_0x58b4e7){return new BPromise(function(_0x355677,_0x3d487c){return client[_0xfed7('0x11')](_0x3aa472,_0x58b4e7)['then'](function(_0x371e71){logger[_0xfed7('0x12')](_0xfed7('0x13'),_0x30672c,'request\x20sent');logger['debug'](_0xfed7('0x14'),_0x30672c,'request\x20sent',JSON[_0xfed7('0x15')](_0x371e71));if(_0x371e71[_0xfed7('0x16')]){if(_0x371e71[_0xfed7('0x16')][_0xfed7('0x17')]===0x1f4){logger['error'](_0xfed7('0x13'),_0x30672c,_0x371e71[_0xfed7('0x16')][_0xfed7('0x18')]);return _0x3d487c(_0x371e71[_0xfed7('0x16')][_0xfed7('0x18')]);}logger[_0xfed7('0x16')](_0xfed7('0x13'),_0x30672c,_0x371e71['error']['message']);return _0x355677(_0x371e71[_0xfed7('0x16')]['message']);}else{logger[_0xfed7('0x12')](_0xfed7('0x13'),_0x30672c,'request\x20sent');_0x355677(_0x371e71[_0xfed7('0x19')][_0xfed7('0x18')]);}})[_0xfed7('0x1a')](function(_0x34fdd9){logger[_0xfed7('0x16')](_0xfed7('0x13'),_0x30672c,_0x34fdd9);_0x3d487c(_0x34fdd9);});});}exports[_0xfed7('0x1b')]=function(_0x2bfda6){var _0x52ab72=this;return new Promise(function(_0x580233,_0x30b6f1){return db[_0xfed7('0x1c')][_0xfed7('0x1d')](_0x2bfda6[_0xfed7('0x1e')],{'raw':_0x2bfda6['options']?_0x2bfda6[_0xfed7('0x1f')][_0xfed7('0x20')]===undefined?!![]:![]:!![]})[_0xfed7('0x21')](function(_0x522b95){logger[_0xfed7('0x12')](_0xfed7('0x1b'),_0x2bfda6);logger[_0xfed7('0x22')](_0xfed7('0x1b'),_0x2bfda6,JSON[_0xfed7('0x15')](_0x522b95));_0x580233(_0x522b95);})[_0xfed7('0x1a')](function(_0x460463){logger[_0xfed7('0x16')](_0xfed7('0x1b'),_0x460463[_0xfed7('0x18')],_0x2bfda6);_0x30b6f1(_0x52ab72[_0xfed7('0x16')](0x1f4,_0x460463[_0xfed7('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index d4b73e1..14325c8 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 _0x734d=['length','whatsappMessage:','./whatsappMessage.events','update','emit','removeListener','register'];(function(_0x59ef66,_0xfa809b){var _0x217f7c=function(_0x51836f){while(--_0x51836f){_0x59ef66['push'](_0x59ef66['shift']());}};_0x217f7c(++_0xfa809b);}(_0x734d,0xb1));var _0xd734=function(_0x4ce3b6,_0x1512d6){_0x4ce3b6=_0x4ce3b6-0x0;var _0x3f3bbb=_0x734d[_0x4ce3b6];return _0x3f3bbb;};'use strict';var WhatsappMessageEvents=require(_0xd734('0x0'));var events=['save','remove',_0xd734('0x1')];function createListener(_0x5e4538,_0xdc9fd2){return function(_0x3f2b19){_0xdc9fd2[_0xd734('0x2')](_0x5e4538,_0x3f2b19);};}function removeListener(_0x43c233,_0x5bc16a){return function(){WhatsappMessageEvents[_0xd734('0x3')](_0x43c233,_0x5bc16a);};}exports[_0xd734('0x4')]=function(_0x41b08c){for(var _0x19f555=0x0,_0x38e8ea=events[_0xd734('0x5')];_0x19f555<_0x38e8ea;_0x19f555++){var _0x357c38=events[_0x19f555];var _0x15e0bd=createListener(_0xd734('0x6')+_0x357c38,_0x41b08c);WhatsappMessageEvents['on'](_0x357c38,_0x15e0bd);}}; \ No newline at end of file +var _0x460f=['register','whatsappMessage:','./whatsappMessage.events','save','update','emit'];(function(_0x3845df,_0x2f9781){var _0x5b78b8=function(_0x3e5a95){while(--_0x3e5a95){_0x3845df['push'](_0x3845df['shift']());}};_0x5b78b8(++_0x2f9781);}(_0x460f,0xce));var _0xf460=function(_0x440e2d,_0x280e27){_0x440e2d=_0x440e2d-0x0;var _0x291767=_0x460f[_0x440e2d];return _0x291767;};'use strict';var WhatsappMessageEvents=require(_0xf460('0x0'));var events=[_0xf460('0x1'),'remove',_0xf460('0x2')];function createListener(_0x92f55e,_0x1c21a9){return function(_0x202a38){_0x1c21a9[_0xf460('0x3')](_0x92f55e,_0x202a38);};}function removeListener(_0x3d93e3,_0xfed687){return function(){WhatsappMessageEvents['removeListener'](_0x3d93e3,_0xfed687);};}exports[_0xf460('0x4')]=function(_0x3e6a9d){for(var _0x4cd267=0x0,_0xa12e4a=events['length'];_0x4cd267<_0xa12e4a;_0x4cd267++){var _0x1ed1c4=events[_0x4cd267];var _0x1f3652=createListener(_0xf460('0x5')+_0x1ed1c4,_0x3e6a9d);WhatsappMessageEvents['on'](_0x1ed1c4,_0x1f3652);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 5e49b21..97ee720 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 _0x5f6f=['/:id/users','getAgents','post','create','addTeams','put','update','delete','removeAgents','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams'];(function(_0x3f7f93,_0x252411){var _0x5a512f=function(_0x3d8516){while(--_0x3d8516){_0x3f7f93['push'](_0x3f7f93['shift']());}};_0x5a512f(++_0x252411);}(_0x5f6f,0x1da));var _0xf5f6=function(_0x3c1d98,_0x5e8a76){_0x3c1d98=_0x3c1d98-0x0;var _0x462c73=_0x5f6f[_0x3c1d98];return _0x462c73;};'use strict';var multer=require(_0xf5f6('0x0'));var util=require(_0xf5f6('0x1'));var path=require('path');var timeout=require(_0xf5f6('0x2'));var express=require('express');var router=express[_0xf5f6('0x3')]();var fs_extra=require(_0xf5f6('0x4'));var auth=require(_0xf5f6('0x5'));var interaction=require(_0xf5f6('0x6'));var config=require(_0xf5f6('0x7'));var controller=require(_0xf5f6('0x8'));router[_0xf5f6('0x9')]('/',auth[_0xf5f6('0xa')](),controller[_0xf5f6('0xb')]);router[_0xf5f6('0x9')](_0xf5f6('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xf5f6('0x9')](_0xf5f6('0xd'),auth['isAuthenticated'](),controller[_0xf5f6('0xe')]);router[_0xf5f6('0x9')](_0xf5f6('0xf'),auth[_0xf5f6('0xa')](),controller[_0xf5f6('0x10')]);router[_0xf5f6('0x9')](_0xf5f6('0x11'),auth['isAuthenticated'](),controller[_0xf5f6('0x12')]);router['get'](_0xf5f6('0x13'),auth[_0xf5f6('0xa')](),controller[_0xf5f6('0x14')]);router[_0xf5f6('0x15')]('/',auth['isAuthenticated'](),controller[_0xf5f6('0x16')]);router[_0xf5f6('0x15')](_0xf5f6('0x11'),auth[_0xf5f6('0xa')](),controller[_0xf5f6('0x17')]);router[_0xf5f6('0x15')]('/:id/users',auth[_0xf5f6('0xa')](),controller['addAgents']);router[_0xf5f6('0x18')]('/:id',auth[_0xf5f6('0xa')](),controller[_0xf5f6('0x19')]);router['delete']('/:id',auth[_0xf5f6('0xa')](),controller['destroy']);router[_0xf5f6('0x1a')](_0xf5f6('0x11'),auth[_0xf5f6('0xa')](),controller['removeTeams']);router[_0xf5f6('0x1a')](_0xf5f6('0x13'),auth[_0xf5f6('0xa')](),controller[_0xf5f6('0x1b')]);module[_0xf5f6('0x1c')]=router; \ No newline at end of file +var _0x8043=['getTeams','getAgents','post','create','addTeams','delete','destroy','removeTeams','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams'];(function(_0x3b19ea,_0x518b6b){var _0x40ece9=function(_0x3a3386){while(--_0x3a3386){_0x3b19ea['push'](_0x3b19ea['shift']());}};_0x40ece9(++_0x518b6b);}(_0x8043,0xf5));var _0x3804=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x8043[_0x4e676e];return _0x336a3c;};'use strict';var multer=require(_0x3804('0x0'));var util=require(_0x3804('0x1'));var path=require(_0x3804('0x2'));var timeout=require(_0x3804('0x3'));var express=require(_0x3804('0x4'));var router=express['Router']();var fs_extra=require(_0x3804('0x5'));var auth=require(_0x3804('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3804('0x7'));var controller=require('./whatsappQueue.controller');router[_0x3804('0x8')]('/',auth[_0x3804('0x9')](),controller['index']);router[_0x3804('0x8')]('/describe',auth[_0x3804('0x9')](),controller[_0x3804('0xa')]);router['get'](_0x3804('0xb'),auth['isAuthenticated'](),controller[_0x3804('0xc')]);router[_0x3804('0x8')]('/:id/members',auth[_0x3804('0x9')](),controller[_0x3804('0xd')]);router[_0x3804('0x8')](_0x3804('0xe'),auth[_0x3804('0x9')](),controller[_0x3804('0xf')]);router['get']('/:id/users',auth[_0x3804('0x9')](),controller[_0x3804('0x10')]);router[_0x3804('0x11')]('/',auth[_0x3804('0x9')](),controller[_0x3804('0x12')]);router['post']('/:id/teams',auth[_0x3804('0x9')](),controller[_0x3804('0x13')]);router[_0x3804('0x11')]('/:id/users',auth[_0x3804('0x9')](),controller['addAgents']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x3804('0x14')]('/:id',auth[_0x3804('0x9')](),controller[_0x3804('0x15')]);router['delete'](_0x3804('0xe'),auth[_0x3804('0x9')](),controller[_0x3804('0x16')]);router[_0x3804('0x14')](_0x3804('0x17'),auth[_0x3804('0x9')](),controller[_0x3804('0x18')]);module[_0x3804('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index fc1e44c..1cdf839 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 _0xaaa2=['name','INTEGER','ENUM','beepall','sequelize','exports','STRING'];(function(_0x2075a6,_0x5a4b04){var _0x4b4348=function(_0x560adc){while(--_0x560adc){_0x2075a6['push'](_0x2075a6['shift']());}};_0x4b4348(++_0x5a4b04);}(_0xaaa2,0xac));var _0x2aaa=function(_0x16dc92,_0x5f05ef){_0x16dc92=_0x16dc92-0x0;var _0x4074a5=_0xaaa2[_0x16dc92];return _0x4074a5;};'use strict';var Sequelize=require(_0x2aaa('0x0'));module[_0x2aaa('0x1')]={'name':{'type':Sequelize[_0x2aaa('0x2')],'unique':_0x2aaa('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x2aaa('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2aaa('0x5')]('rrmemory',_0x2aaa('0x6'),'roundrobin')},'description':{'type':Sequelize[_0x2aaa('0x2')]}}; \ No newline at end of file +var _0xfc65=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x3662d2,_0x47662e){var _0x1e78a1=function(_0xd766e0){while(--_0xd766e0){_0x3662d2['push'](_0x3662d2['shift']());}};_0x1e78a1(++_0x47662e);}(_0xfc65,0x1b4));var _0x5fc6=function(_0x9b5988,_0x383bea){_0x9b5988=_0x9b5988-0x0;var _0x43b336=_0xfc65[_0x9b5988];return _0x43b336;};'use strict';var Sequelize=require(_0x5fc6('0x0'));module[_0x5fc6('0x1')]={'name':{'type':Sequelize[_0x5fc6('0x2')],'unique':_0x5fc6('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x5fc6('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5fc6('0x5')](_0x5fc6('0x6'),_0x5fc6('0x7'),_0x5fc6('0x8'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 6555f68..b246907 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 _0xd919=['addTeams','ids','Team','Agents','online','voicePause','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','select','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','compact','value','transaction','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','isArray','getAgents','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','redis','localhost','./whatsappQueue.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','update','destroy','then','UserProfileResource','error','stack','name','send','map','WhatsappQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','params','keys','filters','intersection','model','attributes','fields','length','merge','options','find','create','body','user','get','role','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','nolimit','order','sort','pick','WhatsappQueueId','filter','User','findAndCountAll','format','SIP','whatsappPause','updatedAt','getTeams'];(function(_0x5a1552,_0x5478df){var _0x88e370=function(_0x5726b8){while(--_0x5726b8){_0x5a1552['push'](_0x5a1552['shift']());}};_0x88e370(++_0x5478df);}(_0xd919,0x181));var _0x9d91=function(_0x3abdf7,_0x5ecbbf){_0x3abdf7=_0x3abdf7-0x0;var _0x49025c=_0xd919[_0x3abdf7];return _0x49025c;};'use strict';var BPromise=require(_0x9d91('0x0'));var util=require('util');var _=require(_0x9d91('0x1'));var squel=require('squel');var Redis=require(_0x9d91('0x2'));var qs=require(_0x9d91('0x3'));var logger=require(_0x9d91('0x4'))('api');var config=require(_0x9d91('0x5'));var db=require('../../mysqldb')['db'];config[_0x9d91('0x6')]=_['defaults'](config['redis'],{'host':_0x9d91('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9d91('0x6')]));require(_0x9d91('0x8'))[_0x9d91('0x9')](socket);function respondWithStatusCode(_0x4375b9,_0x39fa39){_0x39fa39=_0x39fa39||0xcc;return function(_0x11447f){if(_0x11447f){return _0x4375b9[_0x9d91('0xa')](_0x39fa39);}return _0x4375b9['status'](_0x39fa39)[_0x9d91('0xb')]();};}function respondWithResult(_0x167b62,_0x28174d){_0x28174d=_0x28174d||0xc8;return function(_0x344a7d){if(_0x344a7d){return _0x167b62[_0x9d91('0xc')](_0x28174d)[_0x9d91('0xd')](_0x344a7d);}};}function respondWithFilteredResult(_0x41e994,_0xa87610){return function(_0x1faab1){if(_0x1faab1){var _0x2586dc=typeof _0xa87610[_0x9d91('0xe')]==='undefined'&&typeof _0xa87610['limit']===_0x9d91('0xf');var _0x53804f=_0x1faab1[_0x9d91('0x10')];var _0x513ff2=_0x2586dc?0x0:_0xa87610['offset'];var _0x21d0f5=_0x2586dc?_0x1faab1['count']:_0xa87610[_0x9d91('0xe')]+_0xa87610[_0x9d91('0x11')];var _0x342e5a;if(_0x21d0f5>=_0x53804f){_0x21d0f5=_0x53804f;_0x342e5a=0xc8;}else{_0x342e5a=0xce;}_0x41e994['status'](_0x342e5a);return _0x41e994[_0x9d91('0x12')](_0x9d91('0x13'),_0x513ff2+'-'+_0x21d0f5+'/'+_0x53804f)['json'](_0x1faab1);}return null;};}function saveUpdates(_0x280412){return function(_0xd8f9f7){if(_0xd8f9f7){return _0xd8f9f7[_0x9d91('0x14')](_0x280412)['then'](function(_0x1948d5){return _0x1948d5;});}return null;};}function removeEntity(_0x84994a){return function(_0x5665f7){if(_0x5665f7){return _0x5665f7[_0x9d91('0x15')]()[_0x9d91('0x16')](function(){var _0x22cba4=_0x5665f7['get']({'plain':!![]});var _0x53b783='WhatsappQueues';return db[_0x9d91('0x17')][_0x9d91('0x15')]({'where':{'type':_0x53b783,'resourceId':_0x22cba4['id']}})[_0x9d91('0x16')](function(){return _0x5665f7;});})['then'](function(){_0x84994a[_0x9d91('0xc')](0xcc)[_0x9d91('0xb')]();});}};}function handleEntityNotFound(_0x537a46){return function(_0x3ae89a){if(!_0x3ae89a){_0x537a46[_0x9d91('0xa')](0x194);}return _0x3ae89a;};}function handleError(_0xe7767,_0x379158){_0x379158=_0x379158||0x1f4;return function(_0x375208){logger[_0x9d91('0x18')](_0x375208[_0x9d91('0x19')]);if(_0x375208[_0x9d91('0x1a')]){delete _0x375208[_0x9d91('0x1a')];}_0xe7767[_0x9d91('0xc')](_0x379158)[_0x9d91('0x1b')](_0x375208);};}exports['index']=function(_0x2869fb,_0x212f46){var _0x27d718={};var _0xe6b6f0={'count':0x0,'rows':[]};var _0x2309e4=_[_0x9d91('0x1c')](db[_0x9d91('0x1d')][_0x9d91('0x1e')],function(_0xe7c56b){return{'name':_0xe7c56b[_0x9d91('0x1f')],'type':_0xe7c56b[_0x9d91('0x20')][_0x9d91('0x21')]};});_0x27d718=qs[_0x9d91('0x22')](_0x2309e4,_0x2869fb);var _0x38c362={'where':_0x27d718[_0x9d91('0x23')]};return db[_0x9d91('0x1d')]['count'](_0x38c362)[_0x9d91('0x16')](function(_0x2c2abf){_0xe6b6f0[_0x9d91('0x10')]=_0x2c2abf;_0x27d718[_0x9d91('0x24')]=qs[_0x9d91('0x24')](_0x2869fb[_0x9d91('0x25')]);return db[_0x9d91('0x1d')][_0x9d91('0x26')](_0x27d718);})['then'](function(_0x10a332){_0xe6b6f0[_0x9d91('0x27')]=_0x10a332;return _0xe6b6f0;})[_0x9d91('0x16')](respondWithFilteredResult(_0x212f46,_0x27d718))[_0x9d91('0x28')](handleError(_0x212f46,null));};exports['show']=function(_0x506271,_0x58e171){var _0x5268f9={'raw':!![],'where':{'id':_0x506271[_0x9d91('0x29')]['id']}},_0x4bc4ea={};_0x4bc4ea['model']=_[_0x9d91('0x2a')](db[_0x9d91('0x1d')]['rawAttributes']);_0x4bc4ea[_0x9d91('0x25')]=_[_0x9d91('0x2a')](_0x506271['query']);_0x4bc4ea[_0x9d91('0x2b')]=_[_0x9d91('0x2c')](_0x4bc4ea[_0x9d91('0x2d')],_0x4bc4ea[_0x9d91('0x25')]);_0x5268f9[_0x9d91('0x2e')]=_['intersection'](_0x4bc4ea[_0x9d91('0x2d')],qs[_0x9d91('0x2f')](_0x506271[_0x9d91('0x25')][_0x9d91('0x2f')]));_0x5268f9[_0x9d91('0x2e')]=_0x5268f9[_0x9d91('0x2e')][_0x9d91('0x30')]?_0x5268f9[_0x9d91('0x2e')]:_0x4bc4ea[_0x9d91('0x2d')];if(_0x506271[_0x9d91('0x25')]['includeAll']){_0x5268f9[_0x9d91('0x24')]=[{'all':!![]}];}_0x5268f9=_[_0x9d91('0x31')]({},_0x5268f9,_0x506271[_0x9d91('0x32')]);return db['WhatsappQueue'][_0x9d91('0x33')](_0x5268f9)['then'](handleEntityNotFound(_0x58e171,null))[_0x9d91('0x16')](respondWithResult(_0x58e171,null))[_0x9d91('0x28')](handleError(_0x58e171,null));};exports[_0x9d91('0x34')]=function(_0x1d6d5e,_0x1fba3c){return db['WhatsappQueue'][_0x9d91('0x34')](_0x1d6d5e[_0x9d91('0x35')],{})[_0x9d91('0x16')](function(_0x4fd42f){var _0x2d5b20=_0x1d6d5e[_0x9d91('0x36')][_0x9d91('0x37')]({'plain':!![]});if(!_0x2d5b20)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d5b20[_0x9d91('0x38')]===_0x9d91('0x36')){var _0x1baf30=_0x4fd42f[_0x9d91('0x37')]({'plain':!![]});var _0x47c313=_0x9d91('0x39');return db[_0x9d91('0x3a')][_0x9d91('0x33')]({'where':{'name':_0x47c313,'userProfileId':_0x2d5b20[_0x9d91('0x3b')]},'raw':!![]})[_0x9d91('0x16')](function(_0x384365){if(_0x384365&&_0x384365[_0x9d91('0x3c')]===0x0){return db[_0x9d91('0x17')][_0x9d91('0x34')]({'name':_0x1baf30[_0x9d91('0x1a')],'resourceId':_0x1baf30['id'],'type':_0x384365['name'],'sectionId':_0x384365['id']},{})[_0x9d91('0x16')](function(){return _0x4fd42f;});}else{return _0x4fd42f;}})['catch'](function(_0x14638d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14638d);throw _0x14638d;});}return _0x4fd42f;})[_0x9d91('0x16')](respondWithResult(_0x1fba3c,0xc9))[_0x9d91('0x28')](handleError(_0x1fba3c,null));};exports[_0x9d91('0x14')]=function(_0x4250fd,_0x4f0674){if(_0x4250fd[_0x9d91('0x35')]['id']){delete _0x4250fd[_0x9d91('0x35')]['id'];}return db[_0x9d91('0x1d')][_0x9d91('0x33')]({'where':{'id':_0x4250fd[_0x9d91('0x29')]['id']}})[_0x9d91('0x16')](handleEntityNotFound(_0x4f0674,null))[_0x9d91('0x16')](saveUpdates(_0x4250fd['body'],null))[_0x9d91('0x16')](respondWithResult(_0x4f0674,null))[_0x9d91('0x28')](handleError(_0x4f0674,null));};exports['destroy']=function(_0x27933f,_0xebf120){return db[_0x9d91('0x1d')][_0x9d91('0x33')]({'where':{'id':_0x27933f[_0x9d91('0x29')]['id']}})[_0x9d91('0x16')](handleEntityNotFound(_0xebf120,null))[_0x9d91('0x16')](removeEntity(_0xebf120,null))['catch'](handleError(_0xebf120,null));};exports[_0x9d91('0x3d')]=function(_0x570d,_0x24d6a2){return db[_0x9d91('0x1d')][_0x9d91('0x3d')]()['then'](respondWithResult(_0x24d6a2,null))[_0x9d91('0x28')](handleError(_0x24d6a2,null));};exports[_0x9d91('0x3e')]=function(_0x27add4,_0x424474){var _0x232a5a={'raw':!![],'where':{}},_0x35db23={},_0x5d0d83;return db[_0x9d91('0x1d')][_0x9d91('0x3f')]({'where':{'id':_0x27add4['params']['id']}})['then'](handleEntityNotFound(_0x424474,null))[_0x9d91('0x16')](function(_0x4ee2ec){if(_0x4ee2ec){_0x5d0d83=_0x4ee2ec[_0x9d91('0x37')]({'plain':!![]});_0x35db23[_0x9d91('0x2d')]=_[_0x9d91('0x2a')](db[_0x9d91('0x40')][_0x9d91('0x1e')]);_0x35db23[_0x9d91('0x25')]=_['keys'](_0x27add4[_0x9d91('0x25')]);_0x35db23[_0x9d91('0x2b')]=_[_0x9d91('0x2c')](_0x35db23['model'],_0x35db23[_0x9d91('0x25')]);_0x232a5a[_0x9d91('0x2e')]=_[_0x9d91('0x2c')](_0x35db23[_0x9d91('0x2d')],qs['fields'](_0x27add4['query'][_0x9d91('0x2f')]));_0x232a5a[_0x9d91('0x2e')]=_0x232a5a[_0x9d91('0x2e')][_0x9d91('0x30')]?_0x232a5a[_0x9d91('0x2e')]:_0x35db23[_0x9d91('0x2d')];if(!_0x27add4[_0x9d91('0x25')][_0x9d91('0x41')](_0x9d91('0x42'))){_0x232a5a[_0x9d91('0x11')]=qs[_0x9d91('0x11')](_0x27add4[_0x9d91('0x25')][_0x9d91('0x11')]);_0x232a5a[_0x9d91('0xe')]=qs[_0x9d91('0xe')](_0x27add4[_0x9d91('0x25')][_0x9d91('0xe')]);}_0x232a5a[_0x9d91('0x43')]=qs[_0x9d91('0x44')](_0x27add4[_0x9d91('0x25')][_0x9d91('0x44')]);_0x232a5a[_0x9d91('0x23')]=qs[_0x9d91('0x2b')](_[_0x9d91('0x45')](_0x27add4['query'],_0x35db23[_0x9d91('0x2b')]));_0x232a5a['where'][_0x9d91('0x46')]=_0x4ee2ec['id'];if(_0x27add4[_0x9d91('0x25')]['filter']){_0x232a5a['where']=_['merge'](_0x232a5a[_0x9d91('0x23')],{'$or':_[_0x9d91('0x1c')](_0x232a5a[_0x9d91('0x2e')],function(_0x5737ae){var _0x31e33e={};_0x31e33e[_0x5737ae]={'$like':'%'+_0x27add4[_0x9d91('0x25')][_0x9d91('0x47')]+'%'};return _0x31e33e;})});}_0x232a5a=_[_0x9d91('0x31')]({},_0x232a5a,_0x27add4[_0x9d91('0x32')]);return db['UserWhatsappQueue'][_0x9d91('0x26')](_0x232a5a);}})['then'](function(_0x57343e){if(_0x57343e){return db[_0x9d91('0x48')][_0x9d91('0x49')]({'where':{'id':_[_0x9d91('0x1c')](_0x57343e,'UserId'),'role':'agent'},'attributes':['id',_0x9d91('0x1a'),'whatsappPause','updatedAt','createdAt']});}})[_0x9d91('0x16')](function(_0x1e6d0e){if(_0x1e6d0e){return{'count':_0x1e6d0e[_0x9d91('0x10')],'rows':_[_0x9d91('0x1c')](_0x1e6d0e[_0x9d91('0x27')],function(_0x3b4c75){return{'membername':_0x3b4c75['name'],'UserId':_0x3b4c75['id'],'queue_name':_0x5d0d83[_0x9d91('0x1a')],'WhatsappQueueId':_0x5d0d83['id'],'interface':util[_0x9d91('0x4a')]('%s/%s',_0x9d91('0x4b'),_0x3b4c75['name']),'penalty':0x0,'paused':_0x3b4c75[_0x9d91('0x4c')],'createdAt':_0x3b4c75['createdAt'],'updatedAt':_0x3b4c75[_0x9d91('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9d91('0x16')](respondWithFilteredResult(_0x424474,_0x232a5a))['catch'](handleError(_0x424474,null));};exports[_0x9d91('0x4e')]=function(_0x5797b9,_0x4d7874){var _0x2c0ae9={};var _0x4748a0={};var _0x47b77f;var _0x42d3f2;return db['WhatsappQueue'][_0x9d91('0x3f')]({'where':{'id':_0x5797b9['params']['id']}})[_0x9d91('0x16')](handleEntityNotFound(_0x4d7874,null))[_0x9d91('0x16')](function(_0x1afb97){if(_0x1afb97){_0x47b77f=_0x1afb97;_0x4748a0['model']=_[_0x9d91('0x2a')](db['Team'][_0x9d91('0x1e')]);_0x4748a0[_0x9d91('0x25')]=_[_0x9d91('0x2a')](_0x5797b9[_0x9d91('0x25')]);_0x4748a0['filters']=_[_0x9d91('0x2c')](_0x4748a0['model'],_0x4748a0[_0x9d91('0x25')]);_0x2c0ae9[_0x9d91('0x2e')]=_[_0x9d91('0x2c')](_0x4748a0['model'],qs[_0x9d91('0x2f')](_0x5797b9[_0x9d91('0x25')]['fields']));_0x2c0ae9['attributes']=_0x2c0ae9['attributes'][_0x9d91('0x30')]?_0x2c0ae9[_0x9d91('0x2e')]:_0x4748a0['model'];_0x2c0ae9[_0x9d91('0x43')]=qs[_0x9d91('0x44')](_0x5797b9[_0x9d91('0x25')][_0x9d91('0x44')]);_0x2c0ae9[_0x9d91('0x23')]=qs[_0x9d91('0x2b')](_[_0x9d91('0x45')](_0x5797b9[_0x9d91('0x25')],_0x4748a0[_0x9d91('0x2b')]));if(_0x5797b9[_0x9d91('0x25')][_0x9d91('0x47')]){_0x2c0ae9[_0x9d91('0x23')]=_[_0x9d91('0x31')](_0x2c0ae9[_0x9d91('0x23')],{'$or':_['map'](_0x2c0ae9[_0x9d91('0x2e')],function(_0x52d9d4){var _0x3bfea6={};_0x3bfea6[_0x52d9d4]={'$like':'%'+_0x5797b9[_0x9d91('0x25')]['filter']+'%'};return _0x3bfea6;})});}_0x2c0ae9=_[_0x9d91('0x31')]({},_0x2c0ae9,_0x5797b9[_0x9d91('0x32')]);return _0x47b77f['getTeams'](_0x2c0ae9);}})[_0x9d91('0x16')](function(_0x5865bd){if(_0x5865bd){_0x42d3f2=_0x5865bd[_0x9d91('0x30')];if(!_0x5797b9[_0x9d91('0x25')]['hasOwnProperty'](_0x9d91('0x42'))){_0x2c0ae9['limit']=qs[_0x9d91('0x11')](_0x5797b9[_0x9d91('0x25')]['limit']);_0x2c0ae9[_0x9d91('0xe')]=qs[_0x9d91('0xe')](_0x5797b9[_0x9d91('0x25')][_0x9d91('0xe')]);}return _0x47b77f[_0x9d91('0x4e')](_0x2c0ae9);}})[_0x9d91('0x16')](function(_0x83ee48){if(_0x83ee48){return _0x83ee48?{'count':_0x42d3f2,'rows':_0x83ee48}:null;}})[_0x9d91('0x16')](respondWithResult(_0x4d7874,null))['catch'](handleError(_0x4d7874,null));};exports[_0x9d91('0x4f')]=function(_0x2118ea,_0x53f79d){var _0xca79f9=_0x2118ea[_0x9d91('0x35')][_0x9d91('0x50')];return db[_0x9d91('0x51')]['findAll']({'where':{'id':_0xca79f9},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9d91('0x52'),'attributes':['id',_0x9d91('0x1a'),_0x9d91('0x53'),_0x9d91('0x54'),'interface'],'raw':!![]}]})['then'](function(_0x2490f2){if(_0x2490f2){var _0x92683e=_['flatMap'](_0x2490f2,function(_0x3186e5){var _0x1fcc6e=_0x3186e5[_0x9d91('0x37')]({'plain':!![]});return _0x1fcc6e[_0x9d91('0x52')];});return db[_0x9d91('0x1d')][_0x9d91('0x33')]({'where':{'id':_0x2118ea[_0x9d91('0x29')]['id']}})[_0x9d91('0x16')](function(_0x2cafea){return db['sequelize']['transaction'](function(_0x55d394){return _0x2cafea[_0x9d91('0x4f')](_0xca79f9,{'transaction':_0x55d394})[_0x9d91('0x16')](function(){return BPromise[_0x9d91('0x55')](_0x92683e,function(_0x2f59b6){return db[_0x9d91('0x40')][_0x9d91('0x56')]({'where':{'UserId':_0x2f59b6['id'],'WhatsappQueueId':_0x2118ea['params']['id']},'transaction':_0x55d394});});})[_0x9d91('0x16')](function(){_0x92683e['forEach'](function(_0x3b4f7a){socket[_0x9d91('0x57')](_0x9d91('0x58'),{'UserId':_0x3b4f7a['id'],'WhatsappQueueId':_0x2cafea['id']});});});});});}})[_0x9d91('0x16')](respondWithStatusCode(_0x53f79d,null))[_0x9d91('0x28')](handleError(_0x53f79d,null));};exports[_0x9d91('0x59')]=function(_0xb04735,_0x5ef005){return db['Team'][_0x9d91('0x26')]({'where':{'id':_0xb04735[_0x9d91('0x25')][_0x9d91('0x50')]},'attributes':['id'],'include':[{'model':db[_0x9d91('0x48')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x9d91('0x16')](handleEntityNotFound(_0x5ef005,null))[_0x9d91('0x16')](function(_0x31a772){var _0x2bce17=_[_0x9d91('0x1c')](_0x31a772,'id');var _0x3de56d=[];var _0x475018=[];var _0x5e2611=squel[_0x9d91('0x5a')]();_0x5e2611['field'](_0x9d91('0x5b'))[_0x9d91('0x5c')](_0x9d91('0x5d'),'tq')[_0x9d91('0x5e')]('user_has_teams','ut',_0x9d91('0x5f'))['where'](_0x9d91('0x60'),_0xb04735[_0x9d91('0x29')]['id']);for(var _0x5a2d48=0x0;_0x5a2d48<_0x31a772[_0x9d91('0x30')];_0x5a2d48+=0x1){let _0x30a24f=_0x31a772[_0x5a2d48];for(var _0x2e1470=0x0;_0x2e1470<_0x30a24f['Agents']['length'];_0x2e1470+=0x1){let _0x1ce78b=_0x30a24f['Agents'][_0x2e1470];var _0x30a4af=_0x5e2611[_0x9d91('0x61')]();_0x30a4af[_0x9d91('0x23')](_0x9d91('0x62'),_0x1ce78b['id']);_0x475018[_0x9d91('0x63')](db[_0x9d91('0x64')][_0x9d91('0x25')](_0x30a4af[_0x9d91('0x65')](),{'type':db[_0x9d91('0x64')][_0x9d91('0x66')][_0x9d91('0x67')]})[_0x9d91('0x16')](function(_0x58b861){if(_0x58b861[_0x9d91('0x30')]===0x1){return _0x1ce78b['id'];}else{var _0xfbb3ee=_[_0x9d91('0x68')](_[_0x9d91('0x1c')](_0x58b861,'TeamId'),function(_0x5b55ce){return _['includes'](_0x2bce17,_0x5b55ce);});if(_0xfbb3ee){return _0x1ce78b['id'];}}}));}}return BPromise['all'](_0x475018)[_0x9d91('0x16')](function(_0x8869c6){_0x3de56d=_(_0x3de56d)['union'](_0x8869c6)[_0x9d91('0x69')]()[_0x9d91('0x6a')]();return db[_0x9d91('0x1d')][_0x9d91('0x33')]({'where':{'id':_0xb04735[_0x9d91('0x29')]['id']}})[_0x9d91('0x16')](function(_0x2ecb6d){return db[_0x9d91('0x64')][_0x9d91('0x6b')](function(_0x5a1127){return _0x2ecb6d[_0x9d91('0x59')](_0xb04735[_0x9d91('0x25')][_0x9d91('0x50')],{'transaction':_0x5a1127})[_0x9d91('0x16')](function(){if(!_[_0x9d91('0x6c')](_0x3de56d)){return _0x2ecb6d[_0x9d91('0x6d')](_0x3de56d,{'transaction':_0x5a1127});}})['then'](function(){_0x3de56d[_0x9d91('0x6e')](function(_0x17a4a6){socket[_0x9d91('0x57')](_0x9d91('0x6f'),{'UserId':_0x17a4a6,'WhatsappQueueId':_0x2ecb6d['id']});});});});});});})[_0x9d91('0x16')](respondWithStatusCode(_0x5ef005,null))['catch'](handleError(_0x5ef005,null));};exports[_0x9d91('0x70')]=function(_0x53b931,_0x51bb0c){return db[_0x9d91('0x1d')][_0x9d91('0x33')]({'where':{'id':_0x53b931[_0x9d91('0x29')]['id']}})[_0x9d91('0x16')](handleEntityNotFound(_0x51bb0c,null))[_0x9d91('0x16')](function(_0xe905fb){if(_0xe905fb){return _0xe905fb[_0x9d91('0x70')](_0x53b931[_0x9d91('0x35')][_0x9d91('0x50')],_[_0x9d91('0x71')](_0x53b931[_0x9d91('0x35')],['ids','id'])||{})['spread'](function(_0x29d65b){for(var _0x2ccac1=0x0;_0x2ccac1<_0x53b931[_0x9d91('0x35')][_0x9d91('0x50')][_0x9d91('0x30')];_0x2ccac1+=0x1){socket[_0x9d91('0x57')](_0x9d91('0x58'),{'UserId':Number(_0x53b931[_0x9d91('0x35')][_0x9d91('0x50')][_0x2ccac1]),'WhatsappQueueId':Number(_0x53b931[_0x9d91('0x29')]['id'])});}return _0x29d65b;});}})[_0x9d91('0x16')](respondWithResult(_0x51bb0c,null))[_0x9d91('0x28')](handleError(_0x51bb0c,null));};exports['removeAgents']=function(_0x794798,_0x394e25){return db[_0x9d91('0x1d')][_0x9d91('0x33')]({'where':{'id':_0x794798[_0x9d91('0x29')]['id']}})[_0x9d91('0x16')](handleEntityNotFound(_0x394e25,null))[_0x9d91('0x16')](function(_0x894597){if(_0x894597){return _0x894597[_0x9d91('0x6d')](_0x794798[_0x9d91('0x25')]['ids'])[_0x9d91('0x16')](function(){if(_[_0x9d91('0x72')](_0x794798['query'][_0x9d91('0x50')])){for(var _0x3a957d=0x0;_0x3a957d<_0x794798[_0x9d91('0x25')][_0x9d91('0x50')][_0x9d91('0x30')];_0x3a957d+=0x1){socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x794798[_0x9d91('0x25')][_0x9d91('0x50')][_0x3a957d]),'WhatsappQueueId':Number(_0x794798[_0x9d91('0x29')]['id'])});}}else{socket['emit'](_0x9d91('0x6f'),{'UserId':Number(_0x794798['query'][_0x9d91('0x50')]),'WhatsappQueueId':Number(_0x794798[_0x9d91('0x29')]['id'])});}});}})[_0x9d91('0x16')](respondWithStatusCode(_0x394e25,null))['catch'](handleError(_0x394e25,null));};exports[_0x9d91('0x73')]=function(_0x23eed5,_0x48ec52){var _0x14207b={};var _0x4f8693={};var _0x5cb402;var _0x24967a;return db[_0x9d91('0x1d')][_0x9d91('0x3f')]({'where':{'id':_0x23eed5[_0x9d91('0x29')]['id']}})[_0x9d91('0x16')](handleEntityNotFound(_0x48ec52,null))[_0x9d91('0x16')](function(_0x2df8f4){if(_0x2df8f4){_0x5cb402=_0x2df8f4;_0x4f8693[_0x9d91('0x2d')]=_['keys'](db[_0x9d91('0x48')][_0x9d91('0x1e')]);_0x4f8693['query']=_[_0x9d91('0x2a')](_0x23eed5[_0x9d91('0x25')]);_0x4f8693[_0x9d91('0x2b')]=_[_0x9d91('0x2c')](_0x4f8693[_0x9d91('0x2d')],_0x4f8693[_0x9d91('0x25')]);_0x14207b[_0x9d91('0x2e')]=_['intersection'](_0x4f8693[_0x9d91('0x2d')],qs[_0x9d91('0x2f')](_0x23eed5['query'][_0x9d91('0x2f')]));_0x14207b[_0x9d91('0x2e')]=_0x14207b[_0x9d91('0x2e')][_0x9d91('0x30')]?_0x14207b[_0x9d91('0x2e')]:_0x4f8693['model'];_0x14207b['order']=qs[_0x9d91('0x44')](_0x23eed5['query']['sort']);_0x14207b[_0x9d91('0x23')]=qs[_0x9d91('0x2b')](_[_0x9d91('0x45')](_0x23eed5['query'],_0x4f8693['filters']));if(_0x23eed5['query'][_0x9d91('0x47')]){_0x14207b[_0x9d91('0x23')]=_[_0x9d91('0x31')](_0x14207b[_0x9d91('0x23')],{'$or':_['map'](_0x14207b[_0x9d91('0x2e')],function(_0xe81e72){var _0x4225de={};_0x4225de[_0xe81e72]={'$like':'%'+_0x23eed5['query']['filter']+'%'};return _0x4225de;})});}_0x14207b=_[_0x9d91('0x31')]({},_0x14207b,_0x23eed5[_0x9d91('0x32')]);return _0x5cb402[_0x9d91('0x73')](_0x14207b);}})['then'](function(_0x2d7d0e){if(_0x2d7d0e){_0x24967a=_0x2d7d0e[_0x9d91('0x30')];if(!_0x23eed5[_0x9d91('0x25')][_0x9d91('0x41')](_0x9d91('0x42'))){_0x14207b[_0x9d91('0x11')]=qs[_0x9d91('0x11')](_0x23eed5[_0x9d91('0x25')][_0x9d91('0x11')]);_0x14207b[_0x9d91('0xe')]=qs['offset'](_0x23eed5['query'][_0x9d91('0xe')]);}return _0x5cb402[_0x9d91('0x73')](_0x14207b);}})[_0x9d91('0x16')](function(_0xe47bf6){if(_0xe47bf6){return _0xe47bf6?{'count':_0x24967a,'rows':_0xe47bf6}:null;}})[_0x9d91('0x16')](respondWithResult(_0x48ec52,null))[_0x9d91('0x28')](handleError(_0x48ec52,null));}; \ No newline at end of file +var _0xb51f=['online','interface','flatMap','addTeams','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','TeamId','includes','all','union','compact','value','transaction','isEmpty','addAgents','omit','spread','removeAgents','isArray','userWhatsappQueue:remove','getAgents','findOne','pick','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','WhatsappQueues','error','stack','name','send','index','map','type','where','WhatsappQueue','include','query','findAll','rows','show','model','keys','rawAttributes','filters','attributes','intersection','fields','includeAll','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','hasOwnProperty','nolimit','sort','WhatsappQueueId','merge','filter','UserWhatsappQueue','User','findAndCountAll','UserId','agent','whatsappPause','%s/%s','createdAt','updatedAt','getTeams','length','order','ids','Team','Agents'];(function(_0x5d1ccd,_0x194514){var _0x244cb3=function(_0x7360e8){while(--_0x7360e8){_0x5d1ccd['push'](_0x5d1ccd['shift']());}};_0x244cb3(++_0x194514);}(_0xb51f,0xa2));var _0xfb51=function(_0x2ea680,_0x99a563){_0x2ea680=_0x2ea680-0x0;var _0x317396=_0xb51f[_0x2ea680];return _0x317396;};'use strict';var BPromise=require(_0xfb51('0x0'));var util=require(_0xfb51('0x1'));var _=require('lodash');var squel=require(_0xfb51('0x2'));var Redis=require(_0xfb51('0x3'));var qs=require(_0xfb51('0x4'));var logger=require(_0xfb51('0x5'))(_0xfb51('0x6'));var config=require(_0xfb51('0x7'));var db=require(_0xfb51('0x8'))['db'];config['redis']=_[_0xfb51('0x9')](config[_0xfb51('0xa')],{'host':_0xfb51('0xb'),'port':0x18eb});var socket=require(_0xfb51('0xc'))(new Redis(config['redis']));require(_0xfb51('0xd'))[_0xfb51('0xe')](socket);function respondWithStatusCode(_0x126a84,_0x2eefd4){_0x2eefd4=_0x2eefd4||0xcc;return function(_0x245360){if(_0x245360){return _0x126a84[_0xfb51('0xf')](_0x2eefd4);}return _0x126a84[_0xfb51('0x10')](_0x2eefd4)[_0xfb51('0x11')]();};}function respondWithResult(_0x4b37a1,_0x3ab734){_0x3ab734=_0x3ab734||0xc8;return function(_0x3774f6){if(_0x3774f6){return _0x4b37a1['status'](_0x3ab734)[_0xfb51('0x12')](_0x3774f6);}};}function respondWithFilteredResult(_0x4ac43f,_0x327cb9){return function(_0x3cd177){if(_0x3cd177){var _0x5bbfbd=typeof _0x327cb9[_0xfb51('0x13')]===_0xfb51('0x14')&&typeof _0x327cb9[_0xfb51('0x15')]===_0xfb51('0x14');var _0xc7fcd1=_0x3cd177[_0xfb51('0x16')];var _0x48b99e=_0x5bbfbd?0x0:_0x327cb9[_0xfb51('0x13')];var _0x5689c6=_0x5bbfbd?_0x3cd177['count']:_0x327cb9['offset']+_0x327cb9[_0xfb51('0x15')];var _0x36dc79;if(_0x5689c6>=_0xc7fcd1){_0x5689c6=_0xc7fcd1;_0x36dc79=0xc8;}else{_0x36dc79=0xce;}_0x4ac43f[_0xfb51('0x10')](_0x36dc79);return _0x4ac43f['set'](_0xfb51('0x17'),_0x48b99e+'-'+_0x5689c6+'/'+_0xc7fcd1)[_0xfb51('0x12')](_0x3cd177);}return null;};}function saveUpdates(_0x2b7f73){return function(_0x271594){if(_0x271594){return _0x271594[_0xfb51('0x18')](_0x2b7f73)[_0xfb51('0x19')](function(_0x206c8e){return _0x206c8e;});}return null;};}function removeEntity(_0x30c70c){return function(_0x363205){if(_0x363205){return _0x363205[_0xfb51('0x1a')]()[_0xfb51('0x19')](function(){var _0x1cb5b8=_0x363205[_0xfb51('0x1b')]({'plain':!![]});var _0x3d065b=_0xfb51('0x1c');return db['UserProfileResource']['destroy']({'where':{'type':_0x3d065b,'resourceId':_0x1cb5b8['id']}})[_0xfb51('0x19')](function(){return _0x363205;});})['then'](function(){_0x30c70c[_0xfb51('0x10')](0xcc)[_0xfb51('0x11')]();});}};}function handleEntityNotFound(_0x1ef4b2){return function(_0xa60af){if(!_0xa60af){_0x1ef4b2[_0xfb51('0xf')](0x194);}return _0xa60af;};}function handleError(_0x276d59,_0x54f772){_0x54f772=_0x54f772||0x1f4;return function(_0x4d3511){logger[_0xfb51('0x1d')](_0x4d3511[_0xfb51('0x1e')]);if(_0x4d3511[_0xfb51('0x1f')]){delete _0x4d3511[_0xfb51('0x1f')];}_0x276d59[_0xfb51('0x10')](_0x54f772)[_0xfb51('0x20')](_0x4d3511);};}exports[_0xfb51('0x21')]=function(_0x5b395e,_0x10ca66){var _0x517779={};var _0x4109bb={'count':0x0,'rows':[]};var _0x405420=_[_0xfb51('0x22')](db['WhatsappQueue']['rawAttributes'],function(_0x550b37){return{'name':_0x550b37['fieldName'],'type':_0x550b37[_0xfb51('0x23')]['key']};});_0x517779=qs['getOptions'](_0x405420,_0x5b395e);var _0x9689={'where':_0x517779[_0xfb51('0x24')]};return db[_0xfb51('0x25')][_0xfb51('0x16')](_0x9689)[_0xfb51('0x19')](function(_0x4012b7){_0x4109bb[_0xfb51('0x16')]=_0x4012b7;_0x517779[_0xfb51('0x26')]=qs['include'](_0x5b395e[_0xfb51('0x27')]);return db[_0xfb51('0x25')][_0xfb51('0x28')](_0x517779);})[_0xfb51('0x19')](function(_0x302086){_0x4109bb[_0xfb51('0x29')]=_0x302086;return _0x4109bb;})[_0xfb51('0x19')](respondWithFilteredResult(_0x10ca66,_0x517779))['catch'](handleError(_0x10ca66,null));};exports[_0xfb51('0x2a')]=function(_0x5bd53d,_0x35ce73){var _0x5a3685={'raw':!![],'where':{'id':_0x5bd53d['params']['id']}},_0xa13cd1={};_0xa13cd1[_0xfb51('0x2b')]=_[_0xfb51('0x2c')](db[_0xfb51('0x25')][_0xfb51('0x2d')]);_0xa13cd1['query']=_['keys'](_0x5bd53d[_0xfb51('0x27')]);_0xa13cd1[_0xfb51('0x2e')]=_['intersection'](_0xa13cd1[_0xfb51('0x2b')],_0xa13cd1[_0xfb51('0x27')]);_0x5a3685[_0xfb51('0x2f')]=_[_0xfb51('0x30')](_0xa13cd1[_0xfb51('0x2b')],qs[_0xfb51('0x31')](_0x5bd53d['query'][_0xfb51('0x31')]));_0x5a3685[_0xfb51('0x2f')]=_0x5a3685[_0xfb51('0x2f')]['length']?_0x5a3685['attributes']:_0xa13cd1[_0xfb51('0x2b')];if(_0x5bd53d['query'][_0xfb51('0x32')]){_0x5a3685[_0xfb51('0x26')]=[{'all':!![]}];}_0x5a3685=_['merge']({},_0x5a3685,_0x5bd53d[_0xfb51('0x33')]);return db['WhatsappQueue'][_0xfb51('0x34')](_0x5a3685)[_0xfb51('0x19')](handleEntityNotFound(_0x35ce73,null))[_0xfb51('0x19')](respondWithResult(_0x35ce73,null))[_0xfb51('0x35')](handleError(_0x35ce73,null));};exports[_0xfb51('0x36')]=function(_0x59247c,_0x127c07){return db[_0xfb51('0x25')]['create'](_0x59247c[_0xfb51('0x37')],{})[_0xfb51('0x19')](function(_0x5d5e4a){var _0x5a744d=_0x59247c['user'][_0xfb51('0x1b')]({'plain':!![]});if(!_0x5a744d)throw new Error(_0xfb51('0x38'));if(_0x5a744d[_0xfb51('0x39')]===_0xfb51('0x3a')){var _0x6bd45=_0x5d5e4a['get']({'plain':!![]});var _0x17a84d='WhatsappQueues';return db['UserProfileSection'][_0xfb51('0x34')]({'where':{'name':_0x17a84d,'userProfileId':_0x5a744d[_0xfb51('0x3b')]},'raw':!![]})[_0xfb51('0x19')](function(_0x322ce7){if(_0x322ce7&&_0x322ce7[_0xfb51('0x3c')]===0x0){return db[_0xfb51('0x3d')]['create']({'name':_0x6bd45[_0xfb51('0x1f')],'resourceId':_0x6bd45['id'],'type':_0x322ce7[_0xfb51('0x1f')],'sectionId':_0x322ce7['id']},{})[_0xfb51('0x19')](function(){return _0x5d5e4a;});}else{return _0x5d5e4a;}})[_0xfb51('0x35')](function(_0xf0c11d){logger['error'](_0xfb51('0x3e'),_0xf0c11d);throw _0xf0c11d;});}return _0x5d5e4a;})['then'](respondWithResult(_0x127c07,0xc9))[_0xfb51('0x35')](handleError(_0x127c07,null));};exports[_0xfb51('0x18')]=function(_0x1a7d95,_0x3b94d7){if(_0x1a7d95['body']['id']){delete _0x1a7d95[_0xfb51('0x37')]['id'];}return db[_0xfb51('0x25')]['find']({'where':{'id':_0x1a7d95[_0xfb51('0x3f')]['id']}})[_0xfb51('0x19')](handleEntityNotFound(_0x3b94d7,null))[_0xfb51('0x19')](saveUpdates(_0x1a7d95[_0xfb51('0x37')],null))[_0xfb51('0x19')](respondWithResult(_0x3b94d7,null))['catch'](handleError(_0x3b94d7,null));};exports['destroy']=function(_0x2bdd7d,_0x4e3ef7){return db[_0xfb51('0x25')][_0xfb51('0x34')]({'where':{'id':_0x2bdd7d[_0xfb51('0x3f')]['id']}})[_0xfb51('0x19')](handleEntityNotFound(_0x4e3ef7,null))['then'](removeEntity(_0x4e3ef7,null))[_0xfb51('0x35')](handleError(_0x4e3ef7,null));};exports[_0xfb51('0x40')]=function(_0x19a624,_0x5324f1){return db[_0xfb51('0x25')]['describe']()[_0xfb51('0x19')](respondWithResult(_0x5324f1,null))[_0xfb51('0x35')](handleError(_0x5324f1,null));};exports['getMembers']=function(_0x225485,_0x1a0a69){var _0x5a99dc={'raw':!![],'where':{}},_0x3e4dd2={},_0x3e3b39;return db['WhatsappQueue']['findOne']({'where':{'id':_0x225485[_0xfb51('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1a0a69,null))['then'](function(_0x279abf){if(_0x279abf){_0x3e3b39=_0x279abf[_0xfb51('0x1b')]({'plain':!![]});_0x3e4dd2['model']=_[_0xfb51('0x2c')](db['UserWhatsappQueue'][_0xfb51('0x2d')]);_0x3e4dd2[_0xfb51('0x27')]=_[_0xfb51('0x2c')](_0x225485[_0xfb51('0x27')]);_0x3e4dd2['filters']=_[_0xfb51('0x30')](_0x3e4dd2[_0xfb51('0x2b')],_0x3e4dd2[_0xfb51('0x27')]);_0x5a99dc[_0xfb51('0x2f')]=_[_0xfb51('0x30')](_0x3e4dd2[_0xfb51('0x2b')],qs['fields'](_0x225485['query'][_0xfb51('0x31')]));_0x5a99dc['attributes']=_0x5a99dc['attributes']['length']?_0x5a99dc[_0xfb51('0x2f')]:_0x3e4dd2[_0xfb51('0x2b')];if(!_0x225485['query'][_0xfb51('0x41')](_0xfb51('0x42'))){_0x5a99dc['limit']=qs[_0xfb51('0x15')](_0x225485[_0xfb51('0x27')][_0xfb51('0x15')]);_0x5a99dc['offset']=qs['offset'](_0x225485[_0xfb51('0x27')]['offset']);}_0x5a99dc['order']=qs[_0xfb51('0x43')](_0x225485['query'][_0xfb51('0x43')]);_0x5a99dc['where']=qs[_0xfb51('0x2e')](_['pick'](_0x225485[_0xfb51('0x27')],_0x3e4dd2['filters']));_0x5a99dc[_0xfb51('0x24')][_0xfb51('0x44')]=_0x279abf['id'];if(_0x225485[_0xfb51('0x27')]['filter']){_0x5a99dc[_0xfb51('0x24')]=_[_0xfb51('0x45')](_0x5a99dc[_0xfb51('0x24')],{'$or':_[_0xfb51('0x22')](_0x5a99dc[_0xfb51('0x2f')],function(_0xb8b68e){var _0x15a90c={};_0x15a90c[_0xb8b68e]={'$like':'%'+_0x225485[_0xfb51('0x27')][_0xfb51('0x46')]+'%'};return _0x15a90c;})});}_0x5a99dc=_['merge']({},_0x5a99dc,_0x225485[_0xfb51('0x33')]);return db[_0xfb51('0x47')][_0xfb51('0x28')](_0x5a99dc);}})['then'](function(_0x1e43f8){if(_0x1e43f8){return db[_0xfb51('0x48')][_0xfb51('0x49')]({'where':{'id':_['map'](_0x1e43f8,_0xfb51('0x4a')),'role':_0xfb51('0x4b')},'attributes':['id',_0xfb51('0x1f'),_0xfb51('0x4c'),'updatedAt','createdAt']});}})[_0xfb51('0x19')](function(_0x52d48f){if(_0x52d48f){return{'count':_0x52d48f['count'],'rows':_['map'](_0x52d48f[_0xfb51('0x29')],function(_0x140bfc){return{'membername':_0x140bfc['name'],'UserId':_0x140bfc['id'],'queue_name':_0x3e3b39[_0xfb51('0x1f')],'WhatsappQueueId':_0x3e3b39['id'],'interface':util['format'](_0xfb51('0x4d'),'SIP',_0x140bfc[_0xfb51('0x1f')]),'penalty':0x0,'paused':_0x140bfc[_0xfb51('0x4c')],'createdAt':_0x140bfc[_0xfb51('0x4e')],'updatedAt':_0x140bfc[_0xfb51('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1a0a69,_0x5a99dc))[_0xfb51('0x35')](handleError(_0x1a0a69,null));};exports[_0xfb51('0x50')]=function(_0xbf9f20,_0x1b1cc3){var _0xd4cf58={};var _0x654b5f={};var _0x4f938f;var _0x99e9f3;return db[_0xfb51('0x25')]['findOne']({'where':{'id':_0xbf9f20[_0xfb51('0x3f')]['id']}})[_0xfb51('0x19')](handleEntityNotFound(_0x1b1cc3,null))[_0xfb51('0x19')](function(_0x1cd460){if(_0x1cd460){_0x4f938f=_0x1cd460;_0x654b5f[_0xfb51('0x2b')]=_[_0xfb51('0x2c')](db['Team']['rawAttributes']);_0x654b5f['query']=_[_0xfb51('0x2c')](_0xbf9f20[_0xfb51('0x27')]);_0x654b5f[_0xfb51('0x2e')]=_['intersection'](_0x654b5f['model'],_0x654b5f[_0xfb51('0x27')]);_0xd4cf58['attributes']=_[_0xfb51('0x30')](_0x654b5f[_0xfb51('0x2b')],qs[_0xfb51('0x31')](_0xbf9f20['query']['fields']));_0xd4cf58[_0xfb51('0x2f')]=_0xd4cf58[_0xfb51('0x2f')][_0xfb51('0x51')]?_0xd4cf58[_0xfb51('0x2f')]:_0x654b5f[_0xfb51('0x2b')];_0xd4cf58[_0xfb51('0x52')]=qs[_0xfb51('0x43')](_0xbf9f20[_0xfb51('0x27')]['sort']);_0xd4cf58[_0xfb51('0x24')]=qs['filters'](_['pick'](_0xbf9f20['query'],_0x654b5f[_0xfb51('0x2e')]));if(_0xbf9f20[_0xfb51('0x27')][_0xfb51('0x46')]){_0xd4cf58[_0xfb51('0x24')]=_[_0xfb51('0x45')](_0xd4cf58['where'],{'$or':_['map'](_0xd4cf58[_0xfb51('0x2f')],function(_0x3397b2){var _0x51c0e8={};_0x51c0e8[_0x3397b2]={'$like':'%'+_0xbf9f20[_0xfb51('0x27')][_0xfb51('0x46')]+'%'};return _0x51c0e8;})});}_0xd4cf58=_[_0xfb51('0x45')]({},_0xd4cf58,_0xbf9f20[_0xfb51('0x33')]);return _0x4f938f[_0xfb51('0x50')](_0xd4cf58);}})[_0xfb51('0x19')](function(_0x204774){if(_0x204774){_0x99e9f3=_0x204774[_0xfb51('0x51')];if(!_0xbf9f20['query'][_0xfb51('0x41')]('nolimit')){_0xd4cf58['limit']=qs[_0xfb51('0x15')](_0xbf9f20['query']['limit']);_0xd4cf58[_0xfb51('0x13')]=qs['offset'](_0xbf9f20[_0xfb51('0x27')][_0xfb51('0x13')]);}return _0x4f938f[_0xfb51('0x50')](_0xd4cf58);}})['then'](function(_0x3291be){if(_0x3291be){return _0x3291be?{'count':_0x99e9f3,'rows':_0x3291be}:null;}})[_0xfb51('0x19')](respondWithResult(_0x1b1cc3,null))[_0xfb51('0x35')](handleError(_0x1b1cc3,null));};exports['addTeams']=function(_0x49f2c3,_0x18b0a7){var _0x383137=_0x49f2c3['body'][_0xfb51('0x53')];return db[_0xfb51('0x54')][_0xfb51('0x28')]({'where':{'id':_0x383137},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfb51('0x55'),'attributes':['id',_0xfb51('0x1f'),_0xfb51('0x56'),'voicePause',_0xfb51('0x57')],'raw':!![]}]})[_0xfb51('0x19')](function(_0x63e4b8){if(_0x63e4b8){var _0x112ff0=_[_0xfb51('0x58')](_0x63e4b8,function(_0x397fe3){var _0x1f0e66=_0x397fe3['get']({'plain':!![]});return _0x1f0e66[_0xfb51('0x55')];});return db[_0xfb51('0x25')][_0xfb51('0x34')]({'where':{'id':_0x49f2c3[_0xfb51('0x3f')]['id']}})[_0xfb51('0x19')](function(_0x508f8c){return db['sequelize']['transaction'](function(_0x5d8b03){return _0x508f8c[_0xfb51('0x59')](_0x383137,{'transaction':_0x5d8b03})[_0xfb51('0x19')](function(){return BPromise['each'](_0x112ff0,function(_0x1bccec){return db[_0xfb51('0x47')][_0xfb51('0x5a')]({'where':{'UserId':_0x1bccec['id'],'WhatsappQueueId':_0x49f2c3[_0xfb51('0x3f')]['id']},'transaction':_0x5d8b03});});})['then'](function(){_0x112ff0[_0xfb51('0x5b')](function(_0x41ffa9){socket[_0xfb51('0x5c')](_0xfb51('0x5d'),{'UserId':_0x41ffa9['id'],'WhatsappQueueId':_0x508f8c['id']});});});});});}})[_0xfb51('0x19')](respondWithStatusCode(_0x18b0a7,null))[_0xfb51('0x35')](handleError(_0x18b0a7,null));};exports[_0xfb51('0x5e')]=function(_0x311cb4,_0x26a252){return db[_0xfb51('0x54')][_0xfb51('0x28')]({'where':{'id':_0x311cb4['query'][_0xfb51('0x53')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfb51('0x55'),'attributes':['id'],'raw':!![]}]})[_0xfb51('0x19')](handleEntityNotFound(_0x26a252,null))[_0xfb51('0x19')](function(_0x4254a6){var _0x14941c=_[_0xfb51('0x22')](_0x4254a6,'id');var _0x14c95d=[];var _0x1fb04a=[];var _0x5518f4=squel['select']();_0x5518f4['field'](_0xfb51('0x5f'))[_0xfb51('0x60')](_0xfb51('0x61'),'tq')[_0xfb51('0x62')]('user_has_teams','ut',_0xfb51('0x63'))[_0xfb51('0x24')](_0xfb51('0x64'),_0x311cb4[_0xfb51('0x3f')]['id']);for(var _0x3d076a=0x0;_0x3d076a<_0x4254a6[_0xfb51('0x51')];_0x3d076a+=0x1){let _0x500693=_0x4254a6[_0x3d076a];for(var _0x2d4a87=0x0;_0x2d4a87<_0x500693['Agents']['length'];_0x2d4a87+=0x1){let _0x46ec71=_0x500693[_0xfb51('0x55')][_0x2d4a87];var _0x6eb970=_0x5518f4[_0xfb51('0x65')]();_0x6eb970[_0xfb51('0x24')](_0xfb51('0x66'),_0x46ec71['id']);_0x1fb04a[_0xfb51('0x67')](db[_0xfb51('0x68')][_0xfb51('0x27')](_0x6eb970[_0xfb51('0x69')](),{'type':db[_0xfb51('0x68')][_0xfb51('0x6a')]['SELECT']})[_0xfb51('0x19')](function(_0x20e18b){if(_0x20e18b[_0xfb51('0x51')]===0x1){return _0x46ec71['id'];}else{var _0x4b5192=_['every'](_[_0xfb51('0x22')](_0x20e18b,_0xfb51('0x6b')),function(_0x3c99f4){return _[_0xfb51('0x6c')](_0x14941c,_0x3c99f4);});if(_0x4b5192){return _0x46ec71['id'];}}}));}}return BPromise[_0xfb51('0x6d')](_0x1fb04a)[_0xfb51('0x19')](function(_0x5e34a2){_0x14c95d=_(_0x14c95d)[_0xfb51('0x6e')](_0x5e34a2)[_0xfb51('0x6f')]()[_0xfb51('0x70')]();return db['WhatsappQueue'][_0xfb51('0x34')]({'where':{'id':_0x311cb4[_0xfb51('0x3f')]['id']}})['then'](function(_0x4d991e){return db['sequelize'][_0xfb51('0x71')](function(_0x510170){return _0x4d991e['removeTeams'](_0x311cb4['query'][_0xfb51('0x53')],{'transaction':_0x510170})[_0xfb51('0x19')](function(){if(!_[_0xfb51('0x72')](_0x14c95d)){return _0x4d991e['removeAgents'](_0x14c95d,{'transaction':_0x510170});}})[_0xfb51('0x19')](function(){_0x14c95d[_0xfb51('0x5b')](function(_0x2ea068){socket[_0xfb51('0x5c')]('userWhatsappQueue:remove',{'UserId':_0x2ea068,'WhatsappQueueId':_0x4d991e['id']});});});});});});})[_0xfb51('0x19')](respondWithStatusCode(_0x26a252,null))['catch'](handleError(_0x26a252,null));};exports[_0xfb51('0x73')]=function(_0x504544,_0xe427fc){return db[_0xfb51('0x25')][_0xfb51('0x34')]({'where':{'id':_0x504544[_0xfb51('0x3f')]['id']}})[_0xfb51('0x19')](handleEntityNotFound(_0xe427fc,null))[_0xfb51('0x19')](function(_0x5006bf){if(_0x5006bf){return _0x5006bf['addAgents'](_0x504544[_0xfb51('0x37')][_0xfb51('0x53')],_[_0xfb51('0x74')](_0x504544[_0xfb51('0x37')],[_0xfb51('0x53'),'id'])||{})[_0xfb51('0x75')](function(_0xf085f5){for(var _0x535f81=0x0;_0x535f81<_0x504544[_0xfb51('0x37')][_0xfb51('0x53')][_0xfb51('0x51')];_0x535f81+=0x1){socket['emit'](_0xfb51('0x5d'),{'UserId':Number(_0x504544['body'][_0xfb51('0x53')][_0x535f81]),'WhatsappQueueId':Number(_0x504544['params']['id'])});}return _0xf085f5;});}})[_0xfb51('0x19')](respondWithResult(_0xe427fc,null))[_0xfb51('0x35')](handleError(_0xe427fc,null));};exports[_0xfb51('0x76')]=function(_0x15a7a4,_0x30a686){return db['WhatsappQueue'][_0xfb51('0x34')]({'where':{'id':_0x15a7a4[_0xfb51('0x3f')]['id']}})[_0xfb51('0x19')](handleEntityNotFound(_0x30a686,null))[_0xfb51('0x19')](function(_0x10831e){if(_0x10831e){return _0x10831e[_0xfb51('0x76')](_0x15a7a4[_0xfb51('0x27')]['ids'])[_0xfb51('0x19')](function(){if(_[_0xfb51('0x77')](_0x15a7a4[_0xfb51('0x27')][_0xfb51('0x53')])){for(var _0x4155b7=0x0;_0x4155b7<_0x15a7a4[_0xfb51('0x27')][_0xfb51('0x53')]['length'];_0x4155b7+=0x1){socket[_0xfb51('0x5c')]('userWhatsappQueue:remove',{'UserId':Number(_0x15a7a4[_0xfb51('0x27')][_0xfb51('0x53')][_0x4155b7]),'WhatsappQueueId':Number(_0x15a7a4[_0xfb51('0x3f')]['id'])});}}else{socket[_0xfb51('0x5c')](_0xfb51('0x78'),{'UserId':Number(_0x15a7a4[_0xfb51('0x27')][_0xfb51('0x53')]),'WhatsappQueueId':Number(_0x15a7a4[_0xfb51('0x3f')]['id'])});}});}})[_0xfb51('0x19')](respondWithStatusCode(_0x30a686,null))[_0xfb51('0x35')](handleError(_0x30a686,null));};exports[_0xfb51('0x79')]=function(_0x2523a3,_0x1a8a7e){var _0x1e6f6b={};var _0x9ec640={};var _0x53d325;var _0x1c691f;return db[_0xfb51('0x25')][_0xfb51('0x7a')]({'where':{'id':_0x2523a3[_0xfb51('0x3f')]['id']}})[_0xfb51('0x19')](handleEntityNotFound(_0x1a8a7e,null))[_0xfb51('0x19')](function(_0x2fc545){if(_0x2fc545){_0x53d325=_0x2fc545;_0x9ec640[_0xfb51('0x2b')]=_[_0xfb51('0x2c')](db[_0xfb51('0x48')][_0xfb51('0x2d')]);_0x9ec640[_0xfb51('0x27')]=_[_0xfb51('0x2c')](_0x2523a3[_0xfb51('0x27')]);_0x9ec640[_0xfb51('0x2e')]=_[_0xfb51('0x30')](_0x9ec640[_0xfb51('0x2b')],_0x9ec640[_0xfb51('0x27')]);_0x1e6f6b['attributes']=_[_0xfb51('0x30')](_0x9ec640[_0xfb51('0x2b')],qs[_0xfb51('0x31')](_0x2523a3[_0xfb51('0x27')][_0xfb51('0x31')]));_0x1e6f6b[_0xfb51('0x2f')]=_0x1e6f6b[_0xfb51('0x2f')][_0xfb51('0x51')]?_0x1e6f6b['attributes']:_0x9ec640[_0xfb51('0x2b')];_0x1e6f6b['order']=qs[_0xfb51('0x43')](_0x2523a3[_0xfb51('0x27')]['sort']);_0x1e6f6b[_0xfb51('0x24')]=qs[_0xfb51('0x2e')](_[_0xfb51('0x7b')](_0x2523a3[_0xfb51('0x27')],_0x9ec640['filters']));if(_0x2523a3[_0xfb51('0x27')][_0xfb51('0x46')]){_0x1e6f6b[_0xfb51('0x24')]=_['merge'](_0x1e6f6b['where'],{'$or':_[_0xfb51('0x22')](_0x1e6f6b['attributes'],function(_0x14b555){var _0x203d27={};_0x203d27[_0x14b555]={'$like':'%'+_0x2523a3[_0xfb51('0x27')]['filter']+'%'};return _0x203d27;})});}_0x1e6f6b=_[_0xfb51('0x45')]({},_0x1e6f6b,_0x2523a3[_0xfb51('0x33')]);return _0x53d325[_0xfb51('0x79')](_0x1e6f6b);}})['then'](function(_0x18547a){if(_0x18547a){_0x1c691f=_0x18547a[_0xfb51('0x51')];if(!_0x2523a3[_0xfb51('0x27')][_0xfb51('0x41')]('nolimit')){_0x1e6f6b[_0xfb51('0x15')]=qs[_0xfb51('0x15')](_0x2523a3['query']['limit']);_0x1e6f6b[_0xfb51('0x13')]=qs[_0xfb51('0x13')](_0x2523a3[_0xfb51('0x27')][_0xfb51('0x13')]);}return _0x53d325[_0xfb51('0x79')](_0x1e6f6b);}})[_0xfb51('0x19')](function(_0x3524ba){if(_0x3524ba){return _0x3524ba?{'count':_0x1c691f,'rows':_0x3524ba}:null;}})[_0xfb51('0x19')](respondWithResult(_0x1a8a7e,null))[_0xfb51('0x35')](handleError(_0x1a8a7e,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 14825dd..2cfe06d 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 _0xbeed=['hasOwnProperty','exports','events','WhatsappQueue','setMaxListeners','update','remove','emit'];(function(_0x1651f1,_0xd2fd62){var _0x3520ab=function(_0x56cfa0){while(--_0x56cfa0){_0x1651f1['push'](_0x1651f1['shift']());}};_0x3520ab(++_0xd2fd62);}(_0xbeed,0x8a));var _0xdbee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbeed[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xdbee('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0xdbee('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xdbee('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdbee('0x3'),'afterDestroy':_0xdbee('0x4')};function emitEvent(_0x544f66){return function(_0x49888f,_0x2a14c7,_0x3a59b2){WhatsappQueueEvents[_0xdbee('0x5')](_0x544f66+':'+_0x49888f['id'],_0x49888f);WhatsappQueueEvents['emit'](_0x544f66,_0x49888f);_0x3a59b2(null);};}for(var e in events){if(events[_0xdbee('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xdbee('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0x4c67=['emit','hasOwnProperty','events','../../mysqldb','setMaxListeners','save'];(function(_0x72c1bc,_0x4035e3){var _0x234834=function(_0xf3e69c){while(--_0xf3e69c){_0x72c1bc['push'](_0x72c1bc['shift']());}};_0x234834(++_0x4035e3);}(_0x4c67,0x1ca));var _0x74c6=function(_0x8cdfe2,_0x4fe019){_0x8cdfe2=_0x8cdfe2-0x0;var _0x4a168a=_0x4c67[_0x8cdfe2];return _0x4a168a;};'use strict';var EventEmitter=require(_0x74c6('0x0'));var WhatsappQueue=require(_0x74c6('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x74c6('0x2')](0x0);var events={'afterCreate':_0x74c6('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1735a5){return function(_0x3bcd55,_0x481739,_0x491182){WhatsappQueueEvents[_0x74c6('0x4')](_0x1735a5+':'+_0x3bcd55['id'],_0x3bcd55);WhatsappQueueEvents[_0x74c6('0x4')](_0x1735a5,_0x3bcd55);_0x491182(null);};}for(var e in events){if(events[_0x74c6('0x5')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 9e1a11d..2f007cb 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 _0xe3c2=['whatsapp_queues','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','exports','WhatsappQueue'];(function(_0x22cb5f,_0x2cdd63){var _0x274d36=function(_0x421472){while(--_0x421472){_0x22cb5f['push'](_0x22cb5f['shift']());}};_0x274d36(++_0x2cdd63);}(_0xe3c2,0xbf));var _0x2e3c=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xe3c2[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0x2e3c('0x0'));var util=require(_0x2e3c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2e3c('0x2'));var rp=require(_0x2e3c('0x3'));var fs=require('fs');var path=require(_0x2e3c('0x4'));var rimraf=require(_0x2e3c('0x5'));var config=require(_0x2e3c('0x6'));var attributes=require('./whatsappQueue.attributes');module[_0x2e3c('0x7')]=function(_0x33825c,_0x459a76){return _0x33825c['define'](_0x2e3c('0x8'),attributes,{'tableName':_0x2e3c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdfa8=['rimraf','../../config/environment','exports','WhatsappQueue','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3f9ea9,_0x19840d){var _0x291e7f=function(_0x8012b4){while(--_0x8012b4){_0x3f9ea9['push'](_0x3f9ea9['shift']());}};_0x291e7f(++_0x19840d);}(_0xdfa8,0x117));var _0x8dfa=function(_0x505e04,_0x5d425a){_0x505e04=_0x505e04-0x0;var _0x2e419a=_0xdfa8[_0x505e04];return _0x2e419a;};'use strict';var _=require(_0x8dfa('0x0'));var util=require('util');var logger=require(_0x8dfa('0x1'))(_0x8dfa('0x2'));var moment=require(_0x8dfa('0x3'));var BPromise=require(_0x8dfa('0x4'));var rp=require(_0x8dfa('0x5'));var fs=require('fs');var path=require(_0x8dfa('0x6'));var rimraf=require(_0x8dfa('0x7'));var config=require(_0x8dfa('0x8'));var attributes=require('./whatsappQueue.attributes');module[_0x8dfa('0x9')]=function(_0x2cb566,_0x1a5268){return _0x2cb566['define'](_0x8dfa('0xa'),attributes,{'tableName':'whatsapp_queues','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 0401d50..023df50 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 _0x2f7d=['rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','register','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','raw','options','attributes','limit','include','map','model','GetWhatsappQueue','stringify','WhatsappQueue','find','where','ShowWhatsappQueue','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0xf22003,_0x4daaad){var _0x1af727=function(_0x99db67){while(--_0x99db67){_0xf22003['push'](_0xf22003['shift']());}};_0x1af727(++_0x4daaad);}(_0x2f7d,0x1ab));var _0xd2f7=function(_0x2853bf,_0x58296f){_0x2853bf=_0x2853bf-0x0;var _0x1f76e5=_0x2f7d[_0x2853bf];return _0x1f76e5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd2f7('0x0'));var BPromise=require('bluebird');var rs=require(_0xd2f7('0x1'));var fs=require('fs');var Redis=require(_0xd2f7('0x2'));var db=require(_0xd2f7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd2f7('0x4'))(_0xd2f7('0x5'));var config=require(_0xd2f7('0x6'));var jayson=require(_0xd2f7('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xd2f7('0x8')]=_['defaults'](config[_0xd2f7('0x8')],{'host':_0xd2f7('0x9'),'port':0x18eb});var socket=require(_0xd2f7('0xa'))(new Redis(config[_0xd2f7('0x8')]));require('./whatsappQueue.socket')[_0xd2f7('0xb')](socket);function respondWithRpcPromise(_0x205735,_0x59911b,_0x1cec6d){return new BPromise(function(_0x2ca3e0,_0x460fc3){return client['request'](_0x205735,_0x1cec6d)[_0xd2f7('0xc')](function(_0x6db013){logger[_0xd2f7('0xd')](_0xd2f7('0xe'),_0x59911b,_0xd2f7('0xf'));logger[_0xd2f7('0x10')](_0xd2f7('0x11'),_0x59911b,'request\x20sent',JSON['stringify'](_0x6db013));if(_0x6db013[_0xd2f7('0x12')]){if(_0x6db013['error'][_0xd2f7('0x13')]===0x1f4){logger[_0xd2f7('0x12')](_0xd2f7('0xe'),_0x59911b,_0x6db013['error'][_0xd2f7('0x14')]);return _0x460fc3(_0x6db013[_0xd2f7('0x12')]['message']);}logger[_0xd2f7('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x59911b,_0x6db013[_0xd2f7('0x12')]['message']);return _0x2ca3e0(_0x6db013[_0xd2f7('0x12')][_0xd2f7('0x14')]);}else{logger[_0xd2f7('0xd')](_0xd2f7('0xe'),_0x59911b,'request\x20sent');_0x2ca3e0(_0x6db013[_0xd2f7('0x15')][_0xd2f7('0x14')]);}})[_0xd2f7('0x16')](function(_0x470e96){logger[_0xd2f7('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x59911b,_0x470e96);_0x460fc3(_0x470e96);});});}exports['GetWhatsappQueue']=function(_0x27081a){var _0x11dbb5=this;return new Promise(function(_0x3cab78,_0x1102f9){return db['WhatsappQueue']['findAll']({'raw':_0x27081a['options']?_0x27081a['options'][_0xd2f7('0x17')]===undefined?!![]:![]:!![],'where':_0x27081a['options']?_0x27081a['options']['where']||null:null,'attributes':_0x27081a[_0xd2f7('0x18')]?_0x27081a['options'][_0xd2f7('0x19')]||null:null,'limit':_0x27081a['options']?_0x27081a['options'][_0xd2f7('0x1a')]||null:null,'include':_0x27081a['options']?_0x27081a[_0xd2f7('0x18')][_0xd2f7('0x1b')]?_[_0xd2f7('0x1c')](_0x27081a[_0xd2f7('0x18')][_0xd2f7('0x1b')],function(_0x57f9db){return{'model':db[_0x57f9db[_0xd2f7('0x1d')]],'as':_0x57f9db['as'],'attributes':_0x57f9db[_0xd2f7('0x19')],'include':_0x57f9db[_0xd2f7('0x1b')]?_[_0xd2f7('0x1c')](_0x57f9db[_0xd2f7('0x1b')],function(_0x163cc0){return{'model':db[_0x163cc0[_0xd2f7('0x1d')]],'as':_0x163cc0['as'],'attributes':_0x163cc0[_0xd2f7('0x19')],'include':_0x163cc0[_0xd2f7('0x1b')]?_[_0xd2f7('0x1c')](_0x163cc0[_0xd2f7('0x1b')],function(_0x5b1fd5){return{'model':db[_0x5b1fd5[_0xd2f7('0x1d')]],'as':_0x5b1fd5['as'],'attributes':_0x5b1fd5[_0xd2f7('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd2f7('0xc')](function(_0x179afd){logger[_0xd2f7('0xd')](_0xd2f7('0x1e'),_0x27081a);logger[_0xd2f7('0x10')]('GetWhatsappQueue',_0x27081a,JSON[_0xd2f7('0x1f')](_0x179afd));_0x3cab78(_0x179afd);})[_0xd2f7('0x16')](function(_0x5c6f3e){logger[_0xd2f7('0x12')]('GetWhatsappQueue',_0x5c6f3e[_0xd2f7('0x14')],_0x27081a);_0x1102f9(_0x11dbb5['error'](0x1f4,_0x5c6f3e[_0xd2f7('0x14')]));});});};exports['ShowWhatsappQueue']=function(_0x35f030){var _0x288c13=this;return new Promise(function(_0x2e95dc,_0x52f9f0){return db[_0xd2f7('0x20')][_0xd2f7('0x21')]({'raw':_0x35f030['options']?_0x35f030['options'][_0xd2f7('0x17')]===undefined?!![]:![]:!![],'where':_0x35f030[_0xd2f7('0x18')]?_0x35f030['options'][_0xd2f7('0x22')]||null:null,'attributes':_0x35f030[_0xd2f7('0x18')]?_0x35f030[_0xd2f7('0x18')][_0xd2f7('0x19')]||null:null,'include':_0x35f030['options']?_0x35f030[_0xd2f7('0x18')][_0xd2f7('0x1b')]?_['map'](_0x35f030[_0xd2f7('0x18')][_0xd2f7('0x1b')],function(_0x2cd1d8){return{'model':db[_0x2cd1d8[_0xd2f7('0x1d')]],'as':_0x2cd1d8['as'],'attributes':_0x2cd1d8[_0xd2f7('0x19')],'include':_0x2cd1d8['include']?_[_0xd2f7('0x1c')](_0x2cd1d8[_0xd2f7('0x1b')],function(_0x42aaec){return{'model':db[_0x42aaec['model']],'as':_0x42aaec['as'],'attributes':_0x42aaec['attributes'],'include':_0x42aaec[_0xd2f7('0x1b')]?_[_0xd2f7('0x1c')](_0x42aaec[_0xd2f7('0x1b')],function(_0x4ae67d){return{'model':db[_0x4ae67d[_0xd2f7('0x1d')]],'as':_0x4ae67d['as'],'attributes':_0x4ae67d[_0xd2f7('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd2f7('0xc')](function(_0x2adba2){logger['info'](_0xd2f7('0x23'),_0x35f030);logger[_0xd2f7('0x10')](_0xd2f7('0x23'),_0x35f030,JSON['stringify'](_0x2adba2));_0x2e95dc(_0x2adba2);})[_0xd2f7('0x16')](function(_0xb2f1ea){logger[_0xd2f7('0x12')](_0xd2f7('0x23'),_0xb2f1ea[_0xd2f7('0x14')],_0x35f030);_0x52f9f0(_0x288c13['error'](0x1f4,_0xb2f1ea[_0xd2f7('0x14')]));});});}; \ No newline at end of file +var _0xe87d=['raw','options','where','attributes','limit','include','map','model','info','GetWhatsappQueue','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','http','redis','socket.io-emitter','register','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueue'];(function(_0x15cf7d,_0x48f7ad){var _0x46d45a=function(_0x52e6e0){while(--_0x52e6e0){_0x15cf7d['push'](_0x15cf7d['shift']());}};_0x46d45a(++_0x48f7ad);}(_0xe87d,0x1ec));var _0xde87=function(_0x554c0b,_0x25e9fd){_0x554c0b=_0x554c0b-0x0;var _0x151497=_0xe87d[_0x554c0b];return _0x151497;};'use strict';var _=require(_0xde87('0x0'));var util=require(_0xde87('0x1'));var moment=require(_0xde87('0x2'));var BPromise=require(_0xde87('0x3'));var rs=require(_0xde87('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xde87('0x5'));var logger=require('../../config/logger')(_0xde87('0x6'));var config=require('../../config/environment');var jayson=require(_0xde87('0x7'));var client=jayson[_0xde87('0x8')][_0xde87('0x9')]({'port':0x232a});config[_0xde87('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xde87('0xb'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0xde87('0xc')](socket);function respondWithRpcPromise(_0x4143f0,_0x502c0b,_0x3459fd){return new BPromise(function(_0x544d01,_0xb774e0){return client[_0xde87('0xd')](_0x4143f0,_0x3459fd)[_0xde87('0xe')](function(_0x392105){logger['info'](_0xde87('0xf'),_0x502c0b,_0xde87('0x10'));logger[_0xde87('0x11')](_0xde87('0x12'),_0x502c0b,_0xde87('0x10'),JSON[_0xde87('0x13')](_0x392105));if(_0x392105['error']){if(_0x392105[_0xde87('0x14')][_0xde87('0x15')]===0x1f4){logger['error'](_0xde87('0xf'),_0x502c0b,_0x392105[_0xde87('0x14')][_0xde87('0x16')]);return _0xb774e0(_0x392105['error']['message']);}logger[_0xde87('0x14')](_0xde87('0xf'),_0x502c0b,_0x392105[_0xde87('0x14')][_0xde87('0x16')]);return _0x544d01(_0x392105['error'][_0xde87('0x16')]);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x502c0b,_0xde87('0x10'));_0x544d01(_0x392105[_0xde87('0x17')][_0xde87('0x16')]);}})[_0xde87('0x18')](function(_0x169285){logger['error'](_0xde87('0xf'),_0x502c0b,_0x169285);_0xb774e0(_0x169285);});});}exports['GetWhatsappQueue']=function(_0x2d53cc){var _0x23e741=this;return new Promise(function(_0x583ef5,_0x1cc462){return db[_0xde87('0x19')]['findAll']({'raw':_0x2d53cc['options']?_0x2d53cc['options'][_0xde87('0x1a')]===undefined?!![]:![]:!![],'where':_0x2d53cc[_0xde87('0x1b')]?_0x2d53cc[_0xde87('0x1b')][_0xde87('0x1c')]||null:null,'attributes':_0x2d53cc[_0xde87('0x1b')]?_0x2d53cc[_0xde87('0x1b')][_0xde87('0x1d')]||null:null,'limit':_0x2d53cc[_0xde87('0x1b')]?_0x2d53cc['options'][_0xde87('0x1e')]||null:null,'include':_0x2d53cc[_0xde87('0x1b')]?_0x2d53cc[_0xde87('0x1b')][_0xde87('0x1f')]?_[_0xde87('0x20')](_0x2d53cc[_0xde87('0x1b')][_0xde87('0x1f')],function(_0x586258){return{'model':db[_0x586258[_0xde87('0x21')]],'as':_0x586258['as'],'attributes':_0x586258[_0xde87('0x1d')],'include':_0x586258['include']?_[_0xde87('0x20')](_0x586258[_0xde87('0x1f')],function(_0x5e1b11){return{'model':db[_0x5e1b11['model']],'as':_0x5e1b11['as'],'attributes':_0x5e1b11[_0xde87('0x1d')],'include':_0x5e1b11['include']?_[_0xde87('0x20')](_0x5e1b11[_0xde87('0x1f')],function(_0x2ad61d){return{'model':db[_0x2ad61d['model']],'as':_0x2ad61d['as'],'attributes':_0x2ad61d[_0xde87('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57390a){logger[_0xde87('0x22')](_0xde87('0x23'),_0x2d53cc);logger['debug'](_0xde87('0x23'),_0x2d53cc,JSON[_0xde87('0x13')](_0x57390a));_0x583ef5(_0x57390a);})[_0xde87('0x18')](function(_0x3fd3f3){logger['error']('GetWhatsappQueue',_0x3fd3f3[_0xde87('0x16')],_0x2d53cc);_0x1cc462(_0x23e741[_0xde87('0x14')](0x1f4,_0x3fd3f3[_0xde87('0x16')]));});});};exports['ShowWhatsappQueue']=function(_0x1157ab){var _0x2dfe68=this;return new Promise(function(_0x1ee145,_0x2d6795){return db['WhatsappQueue']['find']({'raw':_0x1157ab[_0xde87('0x1b')]?_0x1157ab[_0xde87('0x1b')][_0xde87('0x1a')]===undefined?!![]:![]:!![],'where':_0x1157ab[_0xde87('0x1b')]?_0x1157ab[_0xde87('0x1b')]['where']||null:null,'attributes':_0x1157ab[_0xde87('0x1b')]?_0x1157ab[_0xde87('0x1b')][_0xde87('0x1d')]||null:null,'include':_0x1157ab[_0xde87('0x1b')]?_0x1157ab[_0xde87('0x1b')][_0xde87('0x1f')]?_['map'](_0x1157ab[_0xde87('0x1b')][_0xde87('0x1f')],function(_0x288a60){return{'model':db[_0x288a60[_0xde87('0x21')]],'as':_0x288a60['as'],'attributes':_0x288a60[_0xde87('0x1d')],'include':_0x288a60['include']?_[_0xde87('0x20')](_0x288a60[_0xde87('0x1f')],function(_0xf9a367){return{'model':db[_0xf9a367[_0xde87('0x21')]],'as':_0xf9a367['as'],'attributes':_0xf9a367[_0xde87('0x1d')],'include':_0xf9a367['include']?_[_0xde87('0x20')](_0xf9a367[_0xde87('0x1f')],function(_0x1b1f0e){return{'model':db[_0x1b1f0e[_0xde87('0x21')]],'as':_0x1b1f0e['as'],'attributes':_0x1b1f0e['attributes']};}):[]};}):[]};}):[]:[]})[_0xde87('0xe')](function(_0x59486a){logger[_0xde87('0x22')](_0xde87('0x24'),_0x1157ab);logger[_0xde87('0x11')]('ShowWhatsappQueue',_0x1157ab,JSON[_0xde87('0x13')](_0x59486a));_0x1ee145(_0x59486a);})['catch'](function(_0x596379){logger['error']('ShowWhatsappQueue',_0x596379[_0xde87('0x16')],_0x1157ab);_0x2d6795(_0x2dfe68['error'](0x1f4,_0x596379[_0xde87('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index ff99a8c..f4e2b5c 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 _0x6b5f=['remove','update','emit','removeListener','register','save'];(function(_0x5469e2,_0x1cb459){var _0x5849a2=function(_0x8e818f){while(--_0x8e818f){_0x5469e2['push'](_0x5469e2['shift']());}};_0x5849a2(++_0x1cb459);}(_0x6b5f,0x197));var _0xf6b5=function(_0x612a2a,_0x1a4cdb){_0x612a2a=_0x612a2a-0x0;var _0x25f448=_0x6b5f[_0x612a2a];return _0x25f448;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0xf6b5('0x0'),_0xf6b5('0x1'),_0xf6b5('0x2')];function createListener(_0x28c760,_0x22c2a3){return function(_0x85ec8){_0x22c2a3[_0xf6b5('0x3')](_0x28c760,_0x85ec8);};}function removeListener(_0x13e8c7,_0x2cdb4d){return function(){WhatsappQueueEvents[_0xf6b5('0x4')](_0x13e8c7,_0x2cdb4d);};}exports[_0xf6b5('0x5')]=function(_0x22674a){for(var _0x42ef7f=0x0,_0x55c9c5=events['length'];_0x42ef7f<_0x55c9c5;_0x42ef7f++){var _0x2aec35=events[_0x42ef7f];var _0x506c25=createListener('whatsappQueue:'+_0x2aec35,_0x22674a);WhatsappQueueEvents['on'](_0x2aec35,_0x506c25);}}; \ No newline at end of file +var _0xf624=['register','./whatsappQueue.events','remove','update','emit','removeListener'];(function(_0x6ecc28,_0x4b927a){var _0x232053=function(_0x55513a){while(--_0x55513a){_0x6ecc28['push'](_0x6ecc28['shift']());}};_0x232053(++_0x4b927a);}(_0xf624,0x175));var _0x4f62=function(_0x25dbc5,_0x3454e1){_0x25dbc5=_0x25dbc5-0x0;var _0x1d874a=_0xf624[_0x25dbc5];return _0x1d874a;};'use strict';var WhatsappQueueEvents=require(_0x4f62('0x0'));var events=['save',_0x4f62('0x1'),_0x4f62('0x2')];function createListener(_0x23b548,_0x27029f){return function(_0x548ba7){_0x27029f[_0x4f62('0x3')](_0x23b548,_0x548ba7);};}function removeListener(_0x46d9bd,_0x549cf1){return function(){WhatsappQueueEvents[_0x4f62('0x4')](_0x46d9bd,_0x549cf1);};}exports[_0x4f62('0x5')]=function(_0x4b4e69){for(var _0x395cf8=0x0,_0x573890=events['length'];_0x395cf8<_0x573890;_0x395cf8++){var _0x131c73=events[_0x395cf8];var _0x53a475=createListener('whatsappQueue:'+_0x131c73,_0x4b4e69);WhatsappQueueEvents['on'](_0x131c73,_0x53a475);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 2759c96..3906926 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 _0x673f=['/:id','show','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../config/environment','./whatsappQueueReport.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x673f,0xa8));var _0xf673=function(_0x467b77,_0x4d7b6a){_0x467b77=_0x467b77-0x0;var _0x39e193=_0x673f[_0x467b77];return _0x39e193;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf673('0x0'));var timeout=require(_0xf673('0x1'));var express=require(_0xf673('0x2'));var router=express[_0xf673('0x3')]();var fs_extra=require(_0xf673('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf673('0x5'));var controller=require(_0xf673('0x6'));router[_0xf673('0x7')]('/',auth['isAuthenticated'](),controller[_0xf673('0x8')]);router[_0xf673('0x7')](_0xf673('0x9'),auth[_0xf673('0xa')](),controller[_0xf673('0xb')]);router[_0xf673('0x7')](_0xf673('0xc'),auth[_0xf673('0xa')](),controller[_0xf673('0xd')]);router['post']('/',auth[_0xf673('0xa')](),controller[_0xf673('0xe')]);router[_0xf673('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xf673('0x10')]);router[_0xf673('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xf673('0x12')]);module[_0xf673('0x13')]=router; \ No newline at end of file +var _0x5baf=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete'];(function(_0x546209,_0x19d23f){var _0x52e1b6=function(_0x68ff8a){while(--_0x68ff8a){_0x546209['push'](_0x546209['shift']());}};_0x52e1b6(++_0x19d23f);}(_0x5baf,0xa2));var _0xf5ba=function(_0x28dca4,_0x5369bf){_0x28dca4=_0x28dca4-0x0;var _0x577757=_0x5baf[_0x28dca4];return _0x577757;};'use strict';var multer=require(_0xf5ba('0x0'));var util=require('util');var path=require(_0xf5ba('0x1'));var timeout=require(_0xf5ba('0x2'));var express=require(_0xf5ba('0x3'));var router=express[_0xf5ba('0x4')]();var fs_extra=require(_0xf5ba('0x5'));var auth=require(_0xf5ba('0x6'));var interaction=require(_0xf5ba('0x7'));var config=require(_0xf5ba('0x8'));var controller=require(_0xf5ba('0x9'));router[_0xf5ba('0xa')]('/',auth[_0xf5ba('0xb')](),controller[_0xf5ba('0xc')]);router[_0xf5ba('0xa')](_0xf5ba('0xd'),auth[_0xf5ba('0xb')](),controller[_0xf5ba('0xe')]);router[_0xf5ba('0xa')]('/:id',auth[_0xf5ba('0xb')](),controller[_0xf5ba('0xf')]);router[_0xf5ba('0x10')]('/',auth[_0xf5ba('0xb')](),controller[_0xf5ba('0x11')]);router[_0xf5ba('0x12')](_0xf5ba('0x13'),auth[_0xf5ba('0xb')](),controller[_0xf5ba('0x14')]);router[_0xf5ba('0x15')](_0xf5ba('0x13'),auth[_0xf5ba('0xb')](),controller['destroy']);module[_0xf5ba('0x16')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 1b15842..536226f 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(_0x1ac5ea,_0x32151b){var _0x4cc12f=function(_0x3ee58e){while(--_0x3ee58e){_0x1ac5ea['push'](_0x1ac5ea['shift']());}};_0x4cc12f(++_0x32151b);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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(_0x5a77c9,_0x427c77){var _0x370594=function(_0x4ef785){while(--_0x4ef785){_0x5a77c9['push'](_0x5a77c9['shift']());}};_0x370594(++_0x427c77);}(_0x7a54,0x106));var _0x47a5=function(_0x17fb59,_0x529b51){_0x17fb59=_0x17fb59-0x0;var _0x584ada=_0x7a54[_0x17fb59];return _0x584ada;};'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 c1b1d66..ebd1a58 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 _0x8603=['fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','show','params','includeAll','find','create','body','describe','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','WhatsappQueueReport','rawAttributes'];(function(_0x53c5f0,_0x389849){var _0x5a9986=function(_0x1142a0){while(--_0x1142a0){_0x53c5f0['push'](_0x53c5f0['shift']());}};_0x5a9986(++_0x389849);}(_0x8603,0x190));var _0x3860=function(_0x1578ad,_0x5cdd6c){_0x1578ad=_0x1578ad-0x0;var _0x5b84c2=_0x8603[_0x1578ad];return _0x5b84c2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3860('0x0'));var zipdir=require(_0x3860('0x1'));var jsonpatch=require(_0x3860('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3860('0x3'));var Mustache=require(_0x3860('0x4'));var util=require(_0x3860('0x5'));var path=require('path');var sox=require(_0x3860('0x6'));var csv=require('to-csv');var ejs=require(_0x3860('0x7'));var fs=require('fs');var fs_extra=require(_0x3860('0x8'));var _=require(_0x3860('0x9'));var squel=require(_0x3860('0xa'));var crypto=require(_0x3860('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3860('0xc'));var Papa=require(_0x3860('0xd'));var Redis=require('ioredis');var authService=require(_0x3860('0xe'));var qs=require(_0x3860('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3860('0x10'));var logger=require(_0x3860('0x11'))('api');var utils=require(_0x3860('0x12'));var config=require(_0x3860('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3860('0x14'))['db'];function respondWithStatusCode(_0x8ad61d,_0x2428f6){_0x2428f6=_0x2428f6||0xcc;return function(_0x1ea619){if(_0x1ea619){return _0x8ad61d[_0x3860('0x15')](_0x2428f6);}return _0x8ad61d[_0x3860('0x16')](_0x2428f6)[_0x3860('0x17')]();};}function respondWithResult(_0x12b23b,_0x465d8d){_0x465d8d=_0x465d8d||0xc8;return function(_0x46264d){if(_0x46264d){return _0x12b23b['status'](_0x465d8d)[_0x3860('0x18')](_0x46264d);}};}function respondWithFilteredResult(_0x21eaf1,_0x122e40){return function(_0x37d9ab){if(_0x37d9ab){var _0x1055b3=typeof _0x122e40[_0x3860('0x19')]===_0x3860('0x1a')&&typeof _0x122e40[_0x3860('0x1b')]===_0x3860('0x1a');var _0x3c0d91=_0x37d9ab[_0x3860('0x1c')];var _0x45b799=_0x1055b3?0x0:_0x122e40['offset'];var _0x4863bd=_0x1055b3?_0x37d9ab[_0x3860('0x1c')]:_0x122e40[_0x3860('0x19')]+_0x122e40[_0x3860('0x1b')];var _0x53fc63;if(_0x4863bd>=_0x3c0d91){_0x4863bd=_0x3c0d91;_0x53fc63=0xc8;}else{_0x53fc63=0xce;}_0x21eaf1[_0x3860('0x16')](_0x53fc63);return _0x21eaf1[_0x3860('0x1d')](_0x3860('0x1e'),_0x45b799+'-'+_0x4863bd+'/'+_0x3c0d91)[_0x3860('0x18')](_0x37d9ab);}return null;};}function patchUpdates(_0x20a5b0){return function(_0x45081f){try{jsonpatch[_0x3860('0x1f')](_0x45081f,_0x20a5b0,!![]);}catch(_0x1f8891){return BPromise[_0x3860('0x20')](_0x1f8891);}return _0x45081f[_0x3860('0x21')]();};}function saveUpdates(_0xacd57f,_0x2e0b6e){return function(_0x280ea9){if(_0x280ea9){return _0x280ea9[_0x3860('0x22')](_0xacd57f)[_0x3860('0x23')](function(_0x564efd){return _0x564efd;});}return null;};}function removeEntity(_0xfc10a5,_0x133093){return function(_0x2b91f2){if(_0x2b91f2){return _0x2b91f2[_0x3860('0x24')]()[_0x3860('0x23')](function(){_0xfc10a5['status'](0xcc)[_0x3860('0x17')]();});}};}function handleEntityNotFound(_0x568515,_0x577750){return function(_0xfa9705){if(!_0xfa9705){_0x568515[_0x3860('0x15')](0x194);}return _0xfa9705;};}function handleError(_0x54b5ec,_0x4d9a90){_0x4d9a90=_0x4d9a90||0x1f4;return function(_0x5f42d5){logger[_0x3860('0x25')](_0x5f42d5[_0x3860('0x26')]);if(_0x5f42d5[_0x3860('0x27')]){delete _0x5f42d5[_0x3860('0x27')];}_0x54b5ec[_0x3860('0x16')](_0x4d9a90)[_0x3860('0x28')](_0x5f42d5);};}exports['index']=function(_0x4c4314,_0x389bd0){var _0x1f1809={},_0x5a9af2={},_0x2551f4={'count':0x0,'rows':[]};var _0x3d5143=_[_0x3860('0x29')](db[_0x3860('0x2a')][_0x3860('0x2b')],function(_0x4bbae9){return{'name':_0x4bbae9[_0x3860('0x2c')],'type':_0x4bbae9[_0x3860('0x2d')][_0x3860('0x2e')]};});_0x5a9af2['model']=_[_0x3860('0x29')](_0x3d5143,'name');_0x5a9af2[_0x3860('0x2f')]=_['keys'](_0x4c4314[_0x3860('0x2f')]);_0x5a9af2[_0x3860('0x30')]=_[_0x3860('0x31')](_0x5a9af2['model'],_0x5a9af2[_0x3860('0x2f')]);_0x1f1809[_0x3860('0x32')]=_['intersection'](_0x5a9af2[_0x3860('0x33')],qs['fields'](_0x4c4314[_0x3860('0x2f')][_0x3860('0x34')]));_0x1f1809[_0x3860('0x32')]=_0x1f1809[_0x3860('0x32')][_0x3860('0x35')]?_0x1f1809[_0x3860('0x32')]:_0x5a9af2[_0x3860('0x33')];if(!_0x4c4314['query'][_0x3860('0x36')](_0x3860('0x37'))){_0x1f1809['limit']=qs[_0x3860('0x1b')](_0x4c4314[_0x3860('0x2f')][_0x3860('0x1b')]);_0x1f1809['offset']=qs['offset'](_0x4c4314[_0x3860('0x2f')][_0x3860('0x19')]);}_0x1f1809[_0x3860('0x38')]=qs[_0x3860('0x39')](_0x4c4314['query']['sort']);_0x1f1809[_0x3860('0x3a')]=qs[_0x3860('0x30')](_[_0x3860('0x3b')](_0x4c4314[_0x3860('0x2f')],_0x5a9af2[_0x3860('0x30')]),_0x3d5143);if(_0x4c4314['query'][_0x3860('0x3c')]){_0x1f1809[_0x3860('0x3a')]=_['merge'](_0x1f1809['where'],{'$or':_[_0x3860('0x29')](_0x3d5143,function(_0x148914){if(_0x148914[_0x3860('0x2d')]!==_0x3860('0x3d')){var _0x2b35b2={};_0x2b35b2[_0x148914['name']]={'$like':'%'+_0x4c4314[_0x3860('0x2f')]['filter']+'%'};return _0x2b35b2;}})});}_0x1f1809=_[_0x3860('0x3e')]({},_0x1f1809,_0x4c4314[_0x3860('0x3f')]);var _0x53d443={'where':_0x1f1809[_0x3860('0x3a')]};return db[_0x3860('0x2a')]['count'](_0x53d443)[_0x3860('0x23')](function(_0xc7d34d){_0x2551f4[_0x3860('0x1c')]=_0xc7d34d;if(_0x4c4314[_0x3860('0x2f')]['includeAll']){_0x1f1809[_0x3860('0x40')]=[{'all':!![]}];}return db[_0x3860('0x2a')][_0x3860('0x41')](_0x1f1809);})['then'](function(_0x3a87e5){_0x2551f4['rows']=_0x3a87e5;return _0x2551f4;})[_0x3860('0x23')](respondWithFilteredResult(_0x389bd0,_0x1f1809))[_0x3860('0x42')](handleError(_0x389bd0,null));};exports[_0x3860('0x43')]=function(_0x3f613f,_0x2220c8){var _0x3f4216={'raw':!![],'where':{'id':_0x3f613f[_0x3860('0x44')]['id']}},_0x4e0a44={};_0x4e0a44[_0x3860('0x33')]=_['keys'](db['WhatsappQueueReport'][_0x3860('0x2b')]);_0x4e0a44[_0x3860('0x2f')]=_['keys'](_0x3f613f[_0x3860('0x2f')]);_0x4e0a44[_0x3860('0x30')]=_['intersection'](_0x4e0a44[_0x3860('0x33')],_0x4e0a44[_0x3860('0x2f')]);_0x3f4216[_0x3860('0x32')]=_[_0x3860('0x31')](_0x4e0a44[_0x3860('0x33')],qs[_0x3860('0x34')](_0x3f613f[_0x3860('0x2f')][_0x3860('0x34')]));_0x3f4216[_0x3860('0x32')]=_0x3f4216[_0x3860('0x32')][_0x3860('0x35')]?_0x3f4216[_0x3860('0x32')]:_0x4e0a44[_0x3860('0x33')];if(_0x3f613f['query'][_0x3860('0x45')]){_0x3f4216['include']=[{'all':!![]}];}_0x3f4216=_[_0x3860('0x3e')]({},_0x3f4216,_0x3f613f[_0x3860('0x3f')]);return db[_0x3860('0x2a')][_0x3860('0x46')](_0x3f4216)[_0x3860('0x23')](handleEntityNotFound(_0x2220c8,null))[_0x3860('0x23')](respondWithResult(_0x2220c8,null))[_0x3860('0x42')](handleError(_0x2220c8,null));};exports[_0x3860('0x47')]=function(_0x5a91b2,_0x3cd575){return db[_0x3860('0x2a')][_0x3860('0x47')](_0x5a91b2['body'],{})[_0x3860('0x23')](respondWithResult(_0x3cd575,0xc9))[_0x3860('0x42')](handleError(_0x3cd575,null));};exports[_0x3860('0x22')]=function(_0x3dc957,_0x5ed2db){if(_0x3dc957['body']['id']){delete _0x3dc957[_0x3860('0x48')]['id'];}return db['WhatsappQueueReport'][_0x3860('0x46')]({'where':{'id':_0x3dc957[_0x3860('0x44')]['id']}})[_0x3860('0x23')](handleEntityNotFound(_0x5ed2db,null))['then'](saveUpdates(_0x3dc957[_0x3860('0x48')],null))['then'](respondWithResult(_0x5ed2db,null))[_0x3860('0x42')](handleError(_0x5ed2db,null));};exports['destroy']=function(_0xf9edb4,_0x25d22f){return db[_0x3860('0x2a')]['find']({'where':{'id':_0xf9edb4['params']['id']}})[_0x3860('0x23')](handleEntityNotFound(_0x25d22f,null))[_0x3860('0x23')](removeEntity(_0x25d22f,null))['catch'](handleError(_0x25d22f,null));};exports[_0x3860('0x49')]=function(_0x58237e,_0x3b3bfe){return db[_0x3860('0x2a')][_0x3860('0x49')]()[_0x3860('0x23')](respondWithResult(_0x3b3bfe,null))[_0x3860('0x42')](handleError(_0x3b3bfe,null));}; \ No newline at end of file +var _0x0fd9=['includeAll','include','rows','catch','show','params','create','body','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','WhatsappQueueReport','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options'];(function(_0x5e181e,_0x29650b){var _0x30663b=function(_0x4ceec3){while(--_0x4ceec3){_0x5e181e['push'](_0x5e181e['shift']());}};_0x30663b(++_0x29650b);}(_0x0fd9,0xa3));var _0x90fd=function(_0x3c4a7c,_0x2f4e3c){_0x3c4a7c=_0x3c4a7c-0x0;var _0xf13d1e=_0x0fd9[_0x3c4a7c];return _0xf13d1e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x90fd('0x0'));var zipdir=require(_0x90fd('0x1'));var jsonpatch=require(_0x90fd('0x2'));var rp=require(_0x90fd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x90fd('0x4'));var util=require(_0x90fd('0x5'));var path=require(_0x90fd('0x6'));var sox=require(_0x90fd('0x7'));var csv=require(_0x90fd('0x8'));var ejs=require(_0x90fd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x90fd('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x90fd('0xb'));var toCsv=require(_0x90fd('0x8'));var querystring=require('querystring');var Papa=require(_0x90fd('0xc'));var Redis=require(_0x90fd('0xd'));var authService=require(_0x90fd('0xe'));var qs=require(_0x90fd('0xf'));var as=require(_0x90fd('0x10'));var hardwareService=require(_0x90fd('0x11'));var logger=require(_0x90fd('0x12'))(_0x90fd('0x13'));var utils=require(_0x90fd('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x90fd('0x15'));var db=require(_0x90fd('0x16'))['db'];function respondWithStatusCode(_0x4e8b99,_0x1439ed){_0x1439ed=_0x1439ed||0xcc;return function(_0x37a0f8){if(_0x37a0f8){return _0x4e8b99[_0x90fd('0x17')](_0x1439ed);}return _0x4e8b99['status'](_0x1439ed)[_0x90fd('0x18')]();};}function respondWithResult(_0x48e701,_0x1cae40){_0x1cae40=_0x1cae40||0xc8;return function(_0xb402d9){if(_0xb402d9){return _0x48e701[_0x90fd('0x19')](_0x1cae40)[_0x90fd('0x1a')](_0xb402d9);}};}function respondWithFilteredResult(_0x3c5da8,_0x442a19){return function(_0x296a64){if(_0x296a64){var _0x4eb953=typeof _0x442a19['offset']===_0x90fd('0x1b')&&typeof _0x442a19[_0x90fd('0x1c')]==='undefined';var _0x130489=_0x296a64[_0x90fd('0x1d')];var _0x1fcc87=_0x4eb953?0x0:_0x442a19['offset'];var _0x3f9c76=_0x4eb953?_0x296a64[_0x90fd('0x1d')]:_0x442a19[_0x90fd('0x1e')]+_0x442a19[_0x90fd('0x1c')];var _0x251957;if(_0x3f9c76>=_0x130489){_0x3f9c76=_0x130489;_0x251957=0xc8;}else{_0x251957=0xce;}_0x3c5da8[_0x90fd('0x19')](_0x251957);return _0x3c5da8[_0x90fd('0x1f')](_0x90fd('0x20'),_0x1fcc87+'-'+_0x3f9c76+'/'+_0x130489)[_0x90fd('0x1a')](_0x296a64);}return null;};}function patchUpdates(_0x90197e){return function(_0x19e79b){try{jsonpatch[_0x90fd('0x21')](_0x19e79b,_0x90197e,!![]);}catch(_0x1fb31a){return BPromise[_0x90fd('0x22')](_0x1fb31a);}return _0x19e79b[_0x90fd('0x23')]();};}function saveUpdates(_0x493c26,_0x35ce4e){return function(_0xc4e4e2){if(_0xc4e4e2){return _0xc4e4e2[_0x90fd('0x24')](_0x493c26)[_0x90fd('0x25')](function(_0x411a6a){return _0x411a6a;});}return null;};}function removeEntity(_0x3ad6c6,_0x30f67e){return function(_0x300262){if(_0x300262){return _0x300262['destroy']()[_0x90fd('0x25')](function(){_0x3ad6c6['status'](0xcc)[_0x90fd('0x18')]();});}};}function handleEntityNotFound(_0x18d5b3,_0x2ffea2){return function(_0x31667c){if(!_0x31667c){_0x18d5b3[_0x90fd('0x17')](0x194);}return _0x31667c;};}function handleError(_0x4c962f,_0x35c38d){_0x35c38d=_0x35c38d||0x1f4;return function(_0xe333f0){logger[_0x90fd('0x26')](_0xe333f0[_0x90fd('0x27')]);if(_0xe333f0[_0x90fd('0x28')]){delete _0xe333f0[_0x90fd('0x28')];}_0x4c962f['status'](_0x35c38d)['send'](_0xe333f0);};}exports[_0x90fd('0x29')]=function(_0x170cfb,_0x2924e9){var _0x404971={},_0x397aaf={},_0x59b3e8={'count':0x0,'rows':[]};var _0x4f69e7=_[_0x90fd('0x2a')](db[_0x90fd('0x2b')][_0x90fd('0x2c')],function(_0x3a0102){return{'name':_0x3a0102['fieldName'],'type':_0x3a0102['type'][_0x90fd('0x2d')]};});_0x397aaf[_0x90fd('0x2e')]=_[_0x90fd('0x2a')](_0x4f69e7,_0x90fd('0x28'));_0x397aaf['query']=_[_0x90fd('0x2f')](_0x170cfb[_0x90fd('0x30')]);_0x397aaf[_0x90fd('0x31')]=_[_0x90fd('0x32')](_0x397aaf[_0x90fd('0x2e')],_0x397aaf[_0x90fd('0x30')]);_0x404971[_0x90fd('0x33')]=_[_0x90fd('0x32')](_0x397aaf[_0x90fd('0x2e')],qs[_0x90fd('0x34')](_0x170cfb[_0x90fd('0x30')][_0x90fd('0x34')]));_0x404971[_0x90fd('0x33')]=_0x404971[_0x90fd('0x33')][_0x90fd('0x35')]?_0x404971[_0x90fd('0x33')]:_0x397aaf['model'];if(!_0x170cfb[_0x90fd('0x30')][_0x90fd('0x36')](_0x90fd('0x37'))){_0x404971[_0x90fd('0x1c')]=qs[_0x90fd('0x1c')](_0x170cfb[_0x90fd('0x30')][_0x90fd('0x1c')]);_0x404971[_0x90fd('0x1e')]=qs[_0x90fd('0x1e')](_0x170cfb[_0x90fd('0x30')][_0x90fd('0x1e')]);}_0x404971[_0x90fd('0x38')]=qs[_0x90fd('0x39')](_0x170cfb['query'][_0x90fd('0x39')]);_0x404971[_0x90fd('0x3a')]=qs[_0x90fd('0x31')](_[_0x90fd('0x3b')](_0x170cfb['query'],_0x397aaf[_0x90fd('0x31')]),_0x4f69e7);if(_0x170cfb[_0x90fd('0x30')][_0x90fd('0x3c')]){_0x404971['where']=_['merge'](_0x404971[_0x90fd('0x3a')],{'$or':_[_0x90fd('0x2a')](_0x4f69e7,function(_0x377319){if(_0x377319[_0x90fd('0x3d')]!==_0x90fd('0x3e')){var _0x254200={};_0x254200[_0x377319[_0x90fd('0x28')]]={'$like':'%'+_0x170cfb[_0x90fd('0x30')][_0x90fd('0x3c')]+'%'};return _0x254200;}})});}_0x404971=_[_0x90fd('0x3f')]({},_0x404971,_0x170cfb[_0x90fd('0x40')]);var _0x43c84c={'where':_0x404971[_0x90fd('0x3a')]};return db[_0x90fd('0x2b')][_0x90fd('0x1d')](_0x43c84c)[_0x90fd('0x25')](function(_0x2717ca){_0x59b3e8[_0x90fd('0x1d')]=_0x2717ca;if(_0x170cfb['query'][_0x90fd('0x41')]){_0x404971[_0x90fd('0x42')]=[{'all':!![]}];}return db[_0x90fd('0x2b')]['findAll'](_0x404971);})['then'](function(_0x47b8c8){_0x59b3e8[_0x90fd('0x43')]=_0x47b8c8;return _0x59b3e8;})[_0x90fd('0x25')](respondWithFilteredResult(_0x2924e9,_0x404971))[_0x90fd('0x44')](handleError(_0x2924e9,null));};exports[_0x90fd('0x45')]=function(_0x1361d9,_0x311c7e){var _0x363365={'raw':!![],'where':{'id':_0x1361d9[_0x90fd('0x46')]['id']}},_0x733d4d={};_0x733d4d[_0x90fd('0x2e')]=_[_0x90fd('0x2f')](db[_0x90fd('0x2b')][_0x90fd('0x2c')]);_0x733d4d[_0x90fd('0x30')]=_[_0x90fd('0x2f')](_0x1361d9['query']);_0x733d4d['filters']=_[_0x90fd('0x32')](_0x733d4d[_0x90fd('0x2e')],_0x733d4d[_0x90fd('0x30')]);_0x363365['attributes']=_['intersection'](_0x733d4d[_0x90fd('0x2e')],qs[_0x90fd('0x34')](_0x1361d9['query']['fields']));_0x363365[_0x90fd('0x33')]=_0x363365[_0x90fd('0x33')]['length']?_0x363365['attributes']:_0x733d4d[_0x90fd('0x2e')];if(_0x1361d9[_0x90fd('0x30')][_0x90fd('0x41')]){_0x363365['include']=[{'all':!![]}];}_0x363365=_[_0x90fd('0x3f')]({},_0x363365,_0x1361d9[_0x90fd('0x40')]);return db['WhatsappQueueReport']['find'](_0x363365)['then'](handleEntityNotFound(_0x311c7e,null))[_0x90fd('0x25')](respondWithResult(_0x311c7e,null))[_0x90fd('0x44')](handleError(_0x311c7e,null));};exports['create']=function(_0x2d42b3,_0x2b73f7){return db[_0x90fd('0x2b')][_0x90fd('0x47')](_0x2d42b3[_0x90fd('0x48')],{})['then'](respondWithResult(_0x2b73f7,0xc9))['catch'](handleError(_0x2b73f7,null));};exports[_0x90fd('0x24')]=function(_0x326e4d,_0x125874){if(_0x326e4d[_0x90fd('0x48')]['id']){delete _0x326e4d[_0x90fd('0x48')]['id'];}return db[_0x90fd('0x2b')][_0x90fd('0x49')]({'where':{'id':_0x326e4d[_0x90fd('0x46')]['id']}})[_0x90fd('0x25')](handleEntityNotFound(_0x125874,null))[_0x90fd('0x25')](saveUpdates(_0x326e4d['body'],null))[_0x90fd('0x25')](respondWithResult(_0x125874,null))[_0x90fd('0x44')](handleError(_0x125874,null));};exports[_0x90fd('0x4a')]=function(_0x38021b,_0x4b47bc){return db['WhatsappQueueReport'][_0x90fd('0x49')]({'where':{'id':_0x38021b['params']['id']}})['then'](handleEntityNotFound(_0x4b47bc,null))[_0x90fd('0x25')](removeEntity(_0x4b47bc,null))[_0x90fd('0x44')](handleError(_0x4b47bc,null));};exports[_0x90fd('0x4b')]=function(_0xb8a2af,_0x13c428){return db[_0x90fd('0x2b')][_0x90fd('0x4b')]()['then'](respondWithResult(_0x13c428,null))['catch'](handleError(_0x13c428,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 780083e..3acea2e 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 _0x532f=['define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','api','moment','path','./whatsappQueueReport.attributes','exports'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x532f,0x1e8));var _0xf532=function(_0x14e59e,_0x4a5ba7){_0x14e59e=_0x14e59e-0x0;var _0x4e015a=_0x532f[_0x14e59e];return _0x4e015a;};'use strict';var _=require(_0xf532('0x0'));var util=require(_0xf532('0x1'));var logger=require('../../config/logger')(_0xf532('0x2'));var moment=require(_0xf532('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf532('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf532('0x5'));module[_0xf532('0x6')]=function(_0x3878e7,_0x2d5668){return _0x3878e7[_0xf532('0x7')](_0xf532('0x8'),attributes,{'tableName':_0xf532('0x9'),'paranoid':![],'indexes':[{'name':_0xf532('0xa'),'fields':[_0xf532('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfd05=['bluebird','request-promise','rimraf','exports','define','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x48051b,_0x339115){var _0x2a4f6e=function(_0x5b7756){while(--_0x5b7756){_0x48051b['push'](_0x48051b['shift']());}};_0x2a4f6e(++_0x339115);}(_0xfd05,0x8b));var _0x5fd0=function(_0x3e41b5,_0x504ee5){_0x3e41b5=_0x3e41b5-0x0;var _0xe10c43=_0xfd05[_0x3e41b5];return _0xe10c43;};'use strict';var _=require(_0x5fd0('0x0'));var util=require(_0x5fd0('0x1'));var logger=require(_0x5fd0('0x2'))('api');var moment=require(_0x5fd0('0x3'));var BPromise=require(_0x5fd0('0x4'));var rp=require(_0x5fd0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5fd0('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappQueueReport.attributes');module[_0x5fd0('0x7')]=function(_0x5a9afd,_0x31ffdf){return _0x5a9afd[_0x5fd0('0x8')]('WhatsappQueueReport',attributes,{'tableName':_0x5fd0('0x9'),'paranoid':![],'indexes':[{'name':_0x5fd0('0xa'),'fields':[_0x5fd0('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 d05899f..c7ba289 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 _0x4552=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','WhatsappQueueReport,\x20%s,\x20%s','message','catch','WhatsappQueueReport','create','body','options','raw','CreateWhatsappQueueReport','debug','stringify','UpdateWhatsappQueueReport','update','where','attributes','limit','lodash','util','moment','randomstring'];(function(_0x3d1f8e,_0x279486){var _0x3ebcb3=function(_0x544b2e){while(--_0x544b2e){_0x3d1f8e['push'](_0x3d1f8e['shift']());}};_0x3ebcb3(++_0x279486);}(_0x4552,0x1eb));var _0x2455=function(_0x1ac4c8,_0x10941b){_0x1ac4c8=_0x1ac4c8-0x0;var _0x669dd7=_0x4552[_0x1ac4c8];return _0x669dd7;};'use strict';var _=require(_0x2455('0x0'));var util=require(_0x2455('0x1'));var moment=require(_0x2455('0x2'));var BPromise=require('bluebird');var rs=require(_0x2455('0x3'));var fs=require('fs');var Redis=require(_0x2455('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2455('0x5'));var logger=require(_0x2455('0x6'))(_0x2455('0x7'));var config=require('../../config/environment');var jayson=require(_0x2455('0x8'));var client=jayson[_0x2455('0x9')][_0x2455('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x233df6,_0x51955b,_0x516157){return new BPromise(function(_0x581e0d,_0x172186){return client[_0x2455('0xb')](_0x233df6,_0x516157)[_0x2455('0xc')](function(_0x31621f){logger[_0x2455('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x51955b,_0x2455('0xe'));logger['debug'](_0x2455('0xf'),_0x51955b,_0x2455('0xe'),JSON['stringify'](_0x31621f));if(_0x31621f[_0x2455('0x10')]){if(_0x31621f[_0x2455('0x10')]['code']===0x1f4){logger[_0x2455('0x10')](_0x2455('0x11'),_0x51955b,_0x31621f[_0x2455('0x10')][_0x2455('0x12')]);return _0x172186(_0x31621f[_0x2455('0x10')][_0x2455('0x12')]);}logger[_0x2455('0x10')](_0x2455('0x11'),_0x51955b,_0x31621f[_0x2455('0x10')]['message']);return _0x581e0d(_0x31621f[_0x2455('0x10')][_0x2455('0x12')]);}else{logger[_0x2455('0xd')](_0x2455('0x11'),_0x51955b,_0x2455('0xe'));_0x581e0d(_0x31621f['result'][_0x2455('0x12')]);}})[_0x2455('0x13')](function(_0x55e838){logger[_0x2455('0x10')](_0x2455('0x11'),_0x51955b,_0x55e838);_0x172186(_0x55e838);});});}exports['CreateWhatsappQueueReport']=function(_0x5ce741){var _0x1e5e64=this;return new Promise(function(_0x4c9622,_0x45aaef){return db[_0x2455('0x14')][_0x2455('0x15')](_0x5ce741[_0x2455('0x16')],{'raw':_0x5ce741['options']?_0x5ce741[_0x2455('0x17')][_0x2455('0x18')]===undefined?!![]:![]:!![]})[_0x2455('0xc')](function(_0x580bdd){logger[_0x2455('0xd')](_0x2455('0x19'),_0x5ce741);logger[_0x2455('0x1a')](_0x2455('0x19'),_0x5ce741,JSON[_0x2455('0x1b')](_0x580bdd));_0x4c9622(_0x580bdd);})[_0x2455('0x13')](function(_0x4a2a19){logger['error'](_0x2455('0x19'),_0x4a2a19[_0x2455('0x12')],_0x5ce741);_0x45aaef(_0x1e5e64[_0x2455('0x10')](0x1f4,_0x4a2a19['message']));});});};exports[_0x2455('0x1c')]=function(_0x4ebced){var _0x5cdddc=this;return new Promise(function(_0x4d4a17,_0xa1ffc9){return db[_0x2455('0x14')][_0x2455('0x1d')](_0x4ebced['body'],{'raw':_0x4ebced[_0x2455('0x17')]?_0x4ebced[_0x2455('0x17')][_0x2455('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ebced[_0x2455('0x17')]?_0x4ebced[_0x2455('0x17')][_0x2455('0x1e')]||null:null,'attributes':_0x4ebced[_0x2455('0x17')]?_0x4ebced[_0x2455('0x17')][_0x2455('0x1f')]||null:null,'limit':_0x4ebced[_0x2455('0x17')]?_0x4ebced[_0x2455('0x17')][_0x2455('0x20')]||null:null})['then'](function(_0x32267b){logger[_0x2455('0xd')](_0x2455('0x1c'),_0x4ebced);logger[_0x2455('0x1a')](_0x2455('0x1c'),_0x4ebced,JSON[_0x2455('0x1b')](_0x32267b));_0x4d4a17(_0x32267b);})[_0x2455('0x13')](function(_0x1944a9){logger[_0x2455('0x10')](_0x2455('0x1c'),_0x1944a9['message'],_0x4ebced);_0xa1ffc9(_0x5cdddc[_0x2455('0x10')](0x1f4,_0x1944a9[_0x2455('0x12')]));});});}; \ No newline at end of file +var _0xf842=['info','UpdateWhatsappQueueReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateWhatsappQueueReport','body','options','then','catch','WhatsappQueueReport','update','raw','where','attributes','limit'];(function(_0x4a29a2,_0x5a9cb5){var _0x13db52=function(_0x4bc0c5){while(--_0x4bc0c5){_0x4a29a2['push'](_0x4a29a2['shift']());}};_0x13db52(++_0x5a9cb5);}(_0xf842,0xc8));var _0x2f84=function(_0x4b4f24,_0x5654a8){_0x4b4f24=_0x4b4f24-0x0;var _0x1c13d4=_0xf842[_0x4b4f24];return _0x1c13d4;};'use strict';var _=require(_0x2f84('0x0'));var util=require(_0x2f84('0x1'));var moment=require(_0x2f84('0x2'));var BPromise=require(_0x2f84('0x3'));var rs=require(_0x2f84('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f84('0x5'))['db'];var utils=require(_0x2f84('0x6'));var logger=require('../../config/logger')(_0x2f84('0x7'));var config=require(_0x2f84('0x8'));var jayson=require(_0x2f84('0x9'));var client=jayson['client'][_0x2f84('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a7eb5,_0x2aa7b0,_0x407f79){return new BPromise(function(_0x19732b,_0x2639a7){return client['request'](_0x1a7eb5,_0x407f79)['then'](function(_0x148532){logger['info'](_0x2f84('0xb'),_0x2aa7b0,_0x2f84('0xc'));logger[_0x2f84('0xd')](_0x2f84('0xe'),_0x2aa7b0,_0x2f84('0xc'),JSON[_0x2f84('0xf')](_0x148532));if(_0x148532[_0x2f84('0x10')]){if(_0x148532[_0x2f84('0x10')][_0x2f84('0x11')]===0x1f4){logger[_0x2f84('0x10')](_0x2f84('0xb'),_0x2aa7b0,_0x148532[_0x2f84('0x10')][_0x2f84('0x12')]);return _0x2639a7(_0x148532['error'][_0x2f84('0x12')]);}logger['error'](_0x2f84('0xb'),_0x2aa7b0,_0x148532[_0x2f84('0x10')][_0x2f84('0x12')]);return _0x19732b(_0x148532[_0x2f84('0x10')][_0x2f84('0x12')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x2aa7b0,_0x2f84('0xc'));_0x19732b(_0x148532[_0x2f84('0x13')][_0x2f84('0x12')]);}})['catch'](function(_0x30a1e0){logger[_0x2f84('0x10')](_0x2f84('0xb'),_0x2aa7b0,_0x30a1e0);_0x2639a7(_0x30a1e0);});});}exports[_0x2f84('0x14')]=function(_0x3b8481){var _0x3c6d64=this;return new Promise(function(_0x24b59a,_0x1d9615){return db['WhatsappQueueReport']['create'](_0x3b8481[_0x2f84('0x15')],{'raw':_0x3b8481[_0x2f84('0x16')]?_0x3b8481['options']['raw']===undefined?!![]:![]:!![]})[_0x2f84('0x17')](function(_0x1e6a4c){logger['info'](_0x2f84('0x14'),_0x3b8481);logger[_0x2f84('0xd')](_0x2f84('0x14'),_0x3b8481,JSON[_0x2f84('0xf')](_0x1e6a4c));_0x24b59a(_0x1e6a4c);})[_0x2f84('0x18')](function(_0x553ce9){logger[_0x2f84('0x10')]('CreateWhatsappQueueReport',_0x553ce9['message'],_0x3b8481);_0x1d9615(_0x3c6d64[_0x2f84('0x10')](0x1f4,_0x553ce9['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x4d986d){var _0x453140=this;return new Promise(function(_0x5e0872,_0x53f53c){return db[_0x2f84('0x19')][_0x2f84('0x1a')](_0x4d986d[_0x2f84('0x15')],{'raw':_0x4d986d[_0x2f84('0x16')]?_0x4d986d[_0x2f84('0x16')][_0x2f84('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d986d[_0x2f84('0x16')]?_0x4d986d['options'][_0x2f84('0x1c')]||null:null,'attributes':_0x4d986d['options']?_0x4d986d[_0x2f84('0x16')][_0x2f84('0x1d')]||null:null,'limit':_0x4d986d[_0x2f84('0x16')]?_0x4d986d[_0x2f84('0x16')][_0x2f84('0x1e')]||null:null})[_0x2f84('0x17')](function(_0x1fbff2){logger[_0x2f84('0x1f')](_0x2f84('0x20'),_0x4d986d);logger[_0x2f84('0xd')]('UpdateWhatsappQueueReport',_0x4d986d,JSON['stringify'](_0x1fbff2));_0x5e0872(_0x1fbff2);})[_0x2f84('0x18')](function(_0x54172b){logger[_0x2f84('0x10')](_0x2f84('0x20'),_0x54172b[_0x2f84('0x12')],_0x4d986d);_0x53f53c(_0x453140[_0x2f84('0x10')](0x1f4,_0x54172b[_0x2f84('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index be26aca..2908d7b 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 _0x0c08=['post','create','put','delete','destroy','multer','util','path','Router','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0c08,0x71));var _0x80c0=function(_0x446208,_0xb483fb){_0x446208=_0x446208-0x0;var _0xe49563=_0x0c08[_0x446208];return _0xe49563;};'use strict';var multer=require(_0x80c0('0x0'));var util=require(_0x80c0('0x1'));var path=require(_0x80c0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x80c0('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x80c0('0x4'));var config=require('../../config/environment');var controller=require(_0x80c0('0x5'));router[_0x80c0('0x6')]('/',auth[_0x80c0('0x7')](),controller[_0x80c0('0x8')]);router[_0x80c0('0x6')](_0x80c0('0x9'),auth[_0x80c0('0x7')](),controller[_0x80c0('0xa')]);router[_0x80c0('0x6')](_0x80c0('0xb'),auth['isAuthenticated'](),controller[_0x80c0('0xc')]);router[_0x80c0('0xd')]('/',auth[_0x80c0('0x7')](),controller[_0x80c0('0xe')]);router[_0x80c0('0xf')](_0x80c0('0xb'),auth[_0x80c0('0x7')](),controller['update']);router[_0x80c0('0x10')](_0x80c0('0xb'),auth[_0x80c0('0x7')](),controller[_0x80c0('0x11')]);module['exports']=router; \ No newline at end of file +var _0xa039=['show','create','put','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','index','get','/:id'];(function(_0xd4636c,_0x34dbf6){var _0x5ee17d=function(_0x223c38){while(--_0x223c38){_0xd4636c['push'](_0xd4636c['shift']());}};_0x5ee17d(++_0x34dbf6);}(_0xa039,0xee));var _0x9a03=function(_0x496b17,_0x4cf9f8){_0x496b17=_0x496b17-0x0;var _0x5659a7=_0xa039[_0x496b17];return _0x5659a7;};'use strict';var multer=require(_0x9a03('0x0'));var util=require(_0x9a03('0x1'));var path=require(_0x9a03('0x2'));var timeout=require('connect-timeout');var express=require(_0x9a03('0x3'));var router=express[_0x9a03('0x4')]();var fs_extra=require(_0x9a03('0x5'));var auth=require(_0x9a03('0x6'));var interaction=require(_0x9a03('0x7'));var config=require(_0x9a03('0x8'));var controller=require(_0x9a03('0x9'));router['get']('/',auth[_0x9a03('0xa')](),controller[_0x9a03('0xb')]);router[_0x9a03('0xc')]('/describe',auth[_0x9a03('0xa')](),controller['describe']);router[_0x9a03('0xc')](_0x9a03('0xd'),auth['isAuthenticated'](),controller[_0x9a03('0xe')]);router['post']('/',auth[_0x9a03('0xa')](),controller[_0x9a03('0xf')]);router[_0x9a03('0x10')](_0x9a03('0xd'),auth[_0x9a03('0xa')](),controller['update']);router['delete'](_0x9a03('0xd'),auth[_0x9a03('0xa')](),controller[_0x9a03('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 101c4a9..01533f7 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 _0xa49b=['exports','STRING','ENUM','account','queue','DATE'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa49b,0x126));var _0xba49=function(_0x118b69,_0x2d1561){_0x118b69=_0x118b69-0x0;var _0x276aa3=_0xa49b[_0x118b69];return _0x276aa3;};'use strict';var Sequelize=require('sequelize');module[_0xba49('0x0')]={'uniqueid':{'type':Sequelize[_0xba49('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xba49('0x2')](_0xba49('0x3'),'agent',_0xba49('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xba49('0x5')]}}; \ No newline at end of file +var _0x81b7=['ENUM','account','queue','exports','STRING'];(function(_0x18f64a,_0x1c8248){var _0x44687f=function(_0x1234ad){while(--_0x1234ad){_0x18f64a['push'](_0x18f64a['shift']());}};_0x44687f(++_0x1c8248);}(_0x81b7,0x1f2));var _0x781b=function(_0x5101ad,_0x9383c1){_0x5101ad=_0x5101ad-0x0;var _0x590b28=_0x81b7[_0x5101ad];return _0x590b28;};'use strict';var Sequelize=require('sequelize');module[_0x781b('0x0')]={'uniqueid':{'type':Sequelize[_0x781b('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x781b('0x2')](_0x781b('0x3'),'agent',_0x781b('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index a99c99c..1bd297d 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 _0xc627=['type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','then','includeAll','findAll','catch','show','keys','include','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','end','error','name','map','WhatsappTransferReport','rawAttributes'];(function(_0x224f01,_0x3ef306){var _0x5cd8ce=function(_0x23fd77){while(--_0x23fd77){_0x224f01['push'](_0x224f01['shift']());}};_0x5cd8ce(++_0x3ef306);}(_0xc627,0x1bd));var _0x7c62=function(_0x1e01ae,_0x4e7bc9){_0x1e01ae=_0x1e01ae-0x0;var _0x4ebee2=_0xc627[_0x1e01ae];return _0x4ebee2;};'use strict';var emlformat=require(_0x7c62('0x0'));var rimraf=require(_0x7c62('0x1'));var zipdir=require(_0x7c62('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7c62('0x3'));var BPromise=require(_0x7c62('0x4'));var Mustache=require(_0x7c62('0x5'));var util=require('util');var path=require(_0x7c62('0x6'));var sox=require(_0x7c62('0x7'));var csv=require(_0x7c62('0x8'));var ejs=require(_0x7c62('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7c62('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7c62('0x8'));var querystring=require(_0x7c62('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7c62('0xc'));var as=require(_0x7c62('0xd'));var hardwareService=require(_0x7c62('0xe'));var logger=require(_0x7c62('0xf'))('api');var utils=require(_0x7c62('0x10'));var config=require(_0x7c62('0x11'));var licenseUtil=require(_0x7c62('0x12'));var db=require(_0x7c62('0x13'))['db'];function respondWithStatusCode(_0x4b82c3,_0x28ac5d){_0x28ac5d=_0x28ac5d||0xcc;return function(_0x47268f){if(_0x47268f){return _0x4b82c3[_0x7c62('0x14')](_0x28ac5d);}return _0x4b82c3[_0x7c62('0x15')](_0x28ac5d)['end']();};}function respondWithResult(_0xa3dc24,_0x524602){_0x524602=_0x524602||0xc8;return function(_0x1d8a34){if(_0x1d8a34){return _0xa3dc24[_0x7c62('0x15')](_0x524602)[_0x7c62('0x16')](_0x1d8a34);}};}function respondWithFilteredResult(_0x4e6fc5,_0x287dde){return function(_0x3895c9){if(_0x3895c9){var _0xbcf4e0=typeof _0x287dde[_0x7c62('0x17')]==='undefined'&&typeof _0x287dde[_0x7c62('0x18')]===_0x7c62('0x19');var _0x29d6c5=_0x3895c9[_0x7c62('0x1a')];var _0x150d33=_0xbcf4e0?0x0:_0x287dde[_0x7c62('0x17')];var _0xf41c90=_0xbcf4e0?_0x3895c9['count']:_0x287dde[_0x7c62('0x17')]+_0x287dde['limit'];var _0x116999;if(_0xf41c90>=_0x29d6c5){_0xf41c90=_0x29d6c5;_0x116999=0xc8;}else{_0x116999=0xce;}_0x4e6fc5['status'](_0x116999);return _0x4e6fc5[_0x7c62('0x1b')](_0x7c62('0x1c'),_0x150d33+'-'+_0xf41c90+'/'+_0x29d6c5)['json'](_0x3895c9);}return null;};}function patchUpdates(_0x3b12b9){return function(_0x313c57){try{jsonpatch['apply'](_0x313c57,_0x3b12b9,!![]);}catch(_0x585b8f){return BPromise[_0x7c62('0x1d')](_0x585b8f);}return _0x313c57[_0x7c62('0x1e')]();};}function saveUpdates(_0x4d7653,_0x535638){return function(_0x2bb7c6){if(_0x2bb7c6){return _0x2bb7c6[_0x7c62('0x1f')](_0x4d7653)['then'](function(_0x21d5ad){return _0x21d5ad;});}return null;};}function removeEntity(_0x3b0f79,_0x348ed6){return function(_0x33aaee){if(_0x33aaee){return _0x33aaee['destroy']()['then'](function(){_0x3b0f79['status'](0xcc)[_0x7c62('0x20')]();});}};}function handleEntityNotFound(_0x204337,_0x39d576){return function(_0x48acc6){if(!_0x48acc6){_0x204337[_0x7c62('0x14')](0x194);}return _0x48acc6;};}function handleError(_0x62dadf,_0x308651){_0x308651=_0x308651||0x1f4;return function(_0x2a05f9){logger[_0x7c62('0x21')](_0x2a05f9['stack']);if(_0x2a05f9[_0x7c62('0x22')]){delete _0x2a05f9[_0x7c62('0x22')];}_0x62dadf[_0x7c62('0x15')](_0x308651)['send'](_0x2a05f9);};}exports['index']=function(_0x43a532,_0x43fff9){var _0x5c5e62={},_0x1b068d={},_0x50a928={'count':0x0,'rows':[]};var _0x354de6=_[_0x7c62('0x23')](db[_0x7c62('0x24')][_0x7c62('0x25')],function(_0x13a8ca){return{'name':_0x13a8ca['fieldName'],'type':_0x13a8ca[_0x7c62('0x26')][_0x7c62('0x27')]};});_0x1b068d[_0x7c62('0x28')]=_[_0x7c62('0x23')](_0x354de6,_0x7c62('0x22'));_0x1b068d['query']=_['keys'](_0x43a532[_0x7c62('0x29')]);_0x1b068d[_0x7c62('0x2a')]=_[_0x7c62('0x2b')](_0x1b068d[_0x7c62('0x28')],_0x1b068d[_0x7c62('0x29')]);_0x5c5e62[_0x7c62('0x2c')]=_[_0x7c62('0x2b')](_0x1b068d[_0x7c62('0x28')],qs['fields'](_0x43a532[_0x7c62('0x29')][_0x7c62('0x2d')]));_0x5c5e62[_0x7c62('0x2c')]=_0x5c5e62[_0x7c62('0x2c')][_0x7c62('0x2e')]?_0x5c5e62[_0x7c62('0x2c')]:_0x1b068d[_0x7c62('0x28')];if(!_0x43a532['query'][_0x7c62('0x2f')](_0x7c62('0x30'))){_0x5c5e62['limit']=qs[_0x7c62('0x18')](_0x43a532[_0x7c62('0x29')]['limit']);_0x5c5e62[_0x7c62('0x17')]=qs[_0x7c62('0x17')](_0x43a532[_0x7c62('0x29')]['offset']);}_0x5c5e62[_0x7c62('0x31')]=qs[_0x7c62('0x32')](_0x43a532[_0x7c62('0x29')][_0x7c62('0x32')]);_0x5c5e62[_0x7c62('0x33')]=qs[_0x7c62('0x2a')](_['pick'](_0x43a532[_0x7c62('0x29')],_0x1b068d[_0x7c62('0x2a')]),_0x354de6);if(_0x43a532[_0x7c62('0x29')][_0x7c62('0x34')]){_0x5c5e62[_0x7c62('0x33')]=_[_0x7c62('0x35')](_0x5c5e62['where'],{'$or':_['map'](_0x354de6,function(_0x2483a7){if(_0x2483a7[_0x7c62('0x26')]!==_0x7c62('0x36')){var _0x348c08={};_0x348c08[_0x2483a7['name']]={'$like':'%'+_0x43a532['query']['filter']+'%'};return _0x348c08;}})});}_0x5c5e62=_[_0x7c62('0x35')]({},_0x5c5e62,_0x43a532[_0x7c62('0x37')]);var _0x294c63={'where':_0x5c5e62['where']};return db[_0x7c62('0x24')][_0x7c62('0x1a')](_0x294c63)[_0x7c62('0x38')](function(_0x5a5c51){_0x50a928[_0x7c62('0x1a')]=_0x5a5c51;if(_0x43a532[_0x7c62('0x29')][_0x7c62('0x39')]){_0x5c5e62['include']=[{'all':!![]}];}return db[_0x7c62('0x24')][_0x7c62('0x3a')](_0x5c5e62);})[_0x7c62('0x38')](function(_0x42a9f3){_0x50a928['rows']=_0x42a9f3;return _0x50a928;})[_0x7c62('0x38')](respondWithFilteredResult(_0x43fff9,_0x5c5e62))[_0x7c62('0x3b')](handleError(_0x43fff9,null));};exports[_0x7c62('0x3c')]=function(_0xc76305,_0x37bc2a){var _0x4622ec={'raw':!![],'where':{'id':_0xc76305['params']['id']}},_0x4c4af4={};_0x4c4af4[_0x7c62('0x28')]=_[_0x7c62('0x3d')](db[_0x7c62('0x24')]['rawAttributes']);_0x4c4af4[_0x7c62('0x29')]=_[_0x7c62('0x3d')](_0xc76305[_0x7c62('0x29')]);_0x4c4af4[_0x7c62('0x2a')]=_[_0x7c62('0x2b')](_0x4c4af4['model'],_0x4c4af4['query']);_0x4622ec[_0x7c62('0x2c')]=_['intersection'](_0x4c4af4[_0x7c62('0x28')],qs[_0x7c62('0x2d')](_0xc76305[_0x7c62('0x29')][_0x7c62('0x2d')]));_0x4622ec[_0x7c62('0x2c')]=_0x4622ec[_0x7c62('0x2c')][_0x7c62('0x2e')]?_0x4622ec[_0x7c62('0x2c')]:_0x4c4af4[_0x7c62('0x28')];if(_0xc76305[_0x7c62('0x29')][_0x7c62('0x39')]){_0x4622ec[_0x7c62('0x3e')]=[{'all':!![]}];}_0x4622ec=_[_0x7c62('0x35')]({},_0x4622ec,_0xc76305[_0x7c62('0x37')]);return db[_0x7c62('0x24')][_0x7c62('0x3f')](_0x4622ec)[_0x7c62('0x38')](handleEntityNotFound(_0x37bc2a,null))['then'](respondWithResult(_0x37bc2a,null))[_0x7c62('0x3b')](handleError(_0x37bc2a,null));};exports['create']=function(_0x46d752,_0x4be1c8){return db['WhatsappTransferReport'][_0x7c62('0x40')](_0x46d752[_0x7c62('0x41')],{})[_0x7c62('0x38')](respondWithResult(_0x4be1c8,0xc9))[_0x7c62('0x3b')](handleError(_0x4be1c8,null));};exports[_0x7c62('0x1f')]=function(_0x33052a,_0x2b0c8c){if(_0x33052a['body']['id']){delete _0x33052a['body']['id'];}return db[_0x7c62('0x24')][_0x7c62('0x3f')]({'where':{'id':_0x33052a[_0x7c62('0x42')]['id']}})[_0x7c62('0x38')](handleEntityNotFound(_0x2b0c8c,null))[_0x7c62('0x38')](saveUpdates(_0x33052a[_0x7c62('0x41')],null))[_0x7c62('0x38')](respondWithResult(_0x2b0c8c,null))[_0x7c62('0x3b')](handleError(_0x2b0c8c,null));};exports[_0x7c62('0x43')]=function(_0x4c5821,_0x4566c5){return db[_0x7c62('0x24')][_0x7c62('0x3f')]({'where':{'id':_0x4c5821[_0x7c62('0x42')]['id']}})['then'](handleEntityNotFound(_0x4566c5,null))[_0x7c62('0x38')](removeEntity(_0x4566c5,null))[_0x7c62('0x3b')](handleError(_0x4566c5,null));};exports[_0x7c62('0x44')]=function(_0x509a8c,_0x47819f){return db[_0x7c62('0x24')]['describe']()[_0x7c62('0x38')](respondWithResult(_0x47819f,null))[_0x7c62('0x3b')](handleError(_0x47819f,null));}; \ No newline at end of file +var _0x6a57=['query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','options','find','create','update','body','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','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key'];(function(_0x3048fa,_0x21f9ee){var _0x59fc63=function(_0x4ae1a2){while(--_0x4ae1a2){_0x3048fa['push'](_0x3048fa['shift']());}};_0x59fc63(++_0x21f9ee);}(_0x6a57,0x14a));var _0x76a5=function(_0xf48cce,_0x3531e4){_0xf48cce=_0xf48cce-0x0;var _0x2a5c38=_0x6a57[_0xf48cce];return _0x2a5c38;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x76a5('0x0'));var zipdir=require(_0x76a5('0x1'));var jsonpatch=require(_0x76a5('0x2'));var rp=require(_0x76a5('0x3'));var moment=require(_0x76a5('0x4'));var BPromise=require(_0x76a5('0x5'));var Mustache=require(_0x76a5('0x6'));var util=require('util');var path=require(_0x76a5('0x7'));var sox=require(_0x76a5('0x8'));var csv=require(_0x76a5('0x9'));var ejs=require(_0x76a5('0xa'));var fs=require('fs');var fs_extra=require(_0x76a5('0xb'));var _=require(_0x76a5('0xc'));var squel=require(_0x76a5('0xd'));var crypto=require(_0x76a5('0xe'));var jsforce=require(_0x76a5('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x76a5('0x9'));var querystring=require(_0x76a5('0x10'));var Papa=require(_0x76a5('0x11'));var Redis=require(_0x76a5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x76a5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x76a5('0x14'))(_0x76a5('0x15'));var utils=require(_0x76a5('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x76a5('0x17'));var db=require(_0x76a5('0x18'))['db'];function respondWithStatusCode(_0x2ae44c,_0x588b3d){_0x588b3d=_0x588b3d||0xcc;return function(_0x381922){if(_0x381922){return _0x2ae44c[_0x76a5('0x19')](_0x588b3d);}return _0x2ae44c[_0x76a5('0x1a')](_0x588b3d)[_0x76a5('0x1b')]();};}function respondWithResult(_0x292300,_0x1fa091){_0x1fa091=_0x1fa091||0xc8;return function(_0x596a38){if(_0x596a38){return _0x292300[_0x76a5('0x1a')](_0x1fa091)[_0x76a5('0x1c')](_0x596a38);}};}function respondWithFilteredResult(_0x183349,_0x158c2e){return function(_0x4abf0c){if(_0x4abf0c){var _0x3b205b=typeof _0x158c2e[_0x76a5('0x1d')]==='undefined'&&typeof _0x158c2e[_0x76a5('0x1e')]===_0x76a5('0x1f');var _0x5a56a4=_0x4abf0c[_0x76a5('0x20')];var _0xd1ee6=_0x3b205b?0x0:_0x158c2e[_0x76a5('0x1d')];var _0xe9be82=_0x3b205b?_0x4abf0c['count']:_0x158c2e['offset']+_0x158c2e['limit'];var _0x4f0b1a;if(_0xe9be82>=_0x5a56a4){_0xe9be82=_0x5a56a4;_0x4f0b1a=0xc8;}else{_0x4f0b1a=0xce;}_0x183349['status'](_0x4f0b1a);return _0x183349['set'](_0x76a5('0x21'),_0xd1ee6+'-'+_0xe9be82+'/'+_0x5a56a4)['json'](_0x4abf0c);}return null;};}function patchUpdates(_0x1d1167){return function(_0x275ddc){try{jsonpatch[_0x76a5('0x22')](_0x275ddc,_0x1d1167,!![]);}catch(_0x4a1eda){return BPromise[_0x76a5('0x23')](_0x4a1eda);}return _0x275ddc[_0x76a5('0x24')]();};}function saveUpdates(_0x33f9c8,_0x2e77a6){return function(_0x292130){if(_0x292130){return _0x292130['update'](_0x33f9c8)['then'](function(_0x2b4ebe){return _0x2b4ebe;});}return null;};}function removeEntity(_0x23aa01,_0x153623){return function(_0x42a350){if(_0x42a350){return _0x42a350[_0x76a5('0x25')]()[_0x76a5('0x26')](function(){_0x23aa01[_0x76a5('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37e5fd,_0x218cd2){return function(_0x18fdcb){if(!_0x18fdcb){_0x37e5fd[_0x76a5('0x19')](0x194);}return _0x18fdcb;};}function handleError(_0x312e20,_0x3a6a39){_0x3a6a39=_0x3a6a39||0x1f4;return function(_0x1e8ba0){logger[_0x76a5('0x27')](_0x1e8ba0[_0x76a5('0x28')]);if(_0x1e8ba0[_0x76a5('0x29')]){delete _0x1e8ba0['name'];}_0x312e20[_0x76a5('0x1a')](_0x3a6a39)[_0x76a5('0x2a')](_0x1e8ba0);};}exports[_0x76a5('0x2b')]=function(_0x55188f,_0x3b392f){var _0x1ab43b={},_0x2467fc={},_0x2fe134={'count':0x0,'rows':[]};var _0x2702d7=_[_0x76a5('0x2c')](db[_0x76a5('0x2d')][_0x76a5('0x2e')],function(_0x311b37){return{'name':_0x311b37[_0x76a5('0x2f')],'type':_0x311b37[_0x76a5('0x30')][_0x76a5('0x31')]};});_0x2467fc['model']=_[_0x76a5('0x2c')](_0x2702d7,'name');_0x2467fc[_0x76a5('0x32')]=_[_0x76a5('0x33')](_0x55188f['query']);_0x2467fc[_0x76a5('0x34')]=_['intersection'](_0x2467fc[_0x76a5('0x35')],_0x2467fc[_0x76a5('0x32')]);_0x1ab43b['attributes']=_[_0x76a5('0x36')](_0x2467fc[_0x76a5('0x35')],qs[_0x76a5('0x37')](_0x55188f['query'][_0x76a5('0x37')]));_0x1ab43b[_0x76a5('0x38')]=_0x1ab43b[_0x76a5('0x38')]['length']?_0x1ab43b['attributes']:_0x2467fc[_0x76a5('0x35')];if(!_0x55188f[_0x76a5('0x32')][_0x76a5('0x39')]('nolimit')){_0x1ab43b[_0x76a5('0x1e')]=qs['limit'](_0x55188f[_0x76a5('0x32')][_0x76a5('0x1e')]);_0x1ab43b[_0x76a5('0x1d')]=qs['offset'](_0x55188f['query'][_0x76a5('0x1d')]);}_0x1ab43b[_0x76a5('0x3a')]=qs['sort'](_0x55188f[_0x76a5('0x32')]['sort']);_0x1ab43b[_0x76a5('0x3b')]=qs['filters'](_[_0x76a5('0x3c')](_0x55188f[_0x76a5('0x32')],_0x2467fc[_0x76a5('0x34')]),_0x2702d7);if(_0x55188f[_0x76a5('0x32')][_0x76a5('0x3d')]){_0x1ab43b[_0x76a5('0x3b')]=_[_0x76a5('0x3e')](_0x1ab43b[_0x76a5('0x3b')],{'$or':_['map'](_0x2702d7,function(_0xf8d96d){if(_0xf8d96d['type']!==_0x76a5('0x3f')){var _0x193330={};_0x193330[_0xf8d96d[_0x76a5('0x29')]]={'$like':'%'+_0x55188f[_0x76a5('0x32')][_0x76a5('0x3d')]+'%'};return _0x193330;}})});}_0x1ab43b=_[_0x76a5('0x3e')]({},_0x1ab43b,_0x55188f['options']);var _0x475a82={'where':_0x1ab43b[_0x76a5('0x3b')]};return db['WhatsappTransferReport'][_0x76a5('0x20')](_0x475a82)[_0x76a5('0x26')](function(_0x5c5a25){_0x2fe134[_0x76a5('0x20')]=_0x5c5a25;if(_0x55188f[_0x76a5('0x32')][_0x76a5('0x40')]){_0x1ab43b[_0x76a5('0x41')]=[{'all':!![]}];}return db[_0x76a5('0x2d')][_0x76a5('0x42')](_0x1ab43b);})['then'](function(_0x226f83){_0x2fe134[_0x76a5('0x43')]=_0x226f83;return _0x2fe134;})[_0x76a5('0x26')](respondWithFilteredResult(_0x3b392f,_0x1ab43b))[_0x76a5('0x44')](handleError(_0x3b392f,null));};exports['show']=function(_0x35e98e,_0x500c3b){var _0x18a2c3={'raw':!![],'where':{'id':_0x35e98e['params']['id']}},_0x5df01c={};_0x5df01c[_0x76a5('0x35')]=_[_0x76a5('0x33')](db[_0x76a5('0x2d')][_0x76a5('0x2e')]);_0x5df01c[_0x76a5('0x32')]=_['keys'](_0x35e98e[_0x76a5('0x32')]);_0x5df01c[_0x76a5('0x34')]=_['intersection'](_0x5df01c[_0x76a5('0x35')],_0x5df01c['query']);_0x18a2c3[_0x76a5('0x38')]=_[_0x76a5('0x36')](_0x5df01c[_0x76a5('0x35')],qs[_0x76a5('0x37')](_0x35e98e[_0x76a5('0x32')][_0x76a5('0x37')]));_0x18a2c3[_0x76a5('0x38')]=_0x18a2c3[_0x76a5('0x38')]['length']?_0x18a2c3['attributes']:_0x5df01c[_0x76a5('0x35')];if(_0x35e98e[_0x76a5('0x32')]['includeAll']){_0x18a2c3[_0x76a5('0x41')]=[{'all':!![]}];}_0x18a2c3=_[_0x76a5('0x3e')]({},_0x18a2c3,_0x35e98e[_0x76a5('0x45')]);return db[_0x76a5('0x2d')][_0x76a5('0x46')](_0x18a2c3)[_0x76a5('0x26')](handleEntityNotFound(_0x500c3b,null))['then'](respondWithResult(_0x500c3b,null))[_0x76a5('0x44')](handleError(_0x500c3b,null));};exports[_0x76a5('0x47')]=function(_0x4a648c,_0x2e0e28){return db[_0x76a5('0x2d')][_0x76a5('0x47')](_0x4a648c['body'],{})[_0x76a5('0x26')](respondWithResult(_0x2e0e28,0xc9))['catch'](handleError(_0x2e0e28,null));};exports[_0x76a5('0x48')]=function(_0x272ab0,_0x4f4823){if(_0x272ab0[_0x76a5('0x49')]['id']){delete _0x272ab0[_0x76a5('0x49')]['id'];}return db['WhatsappTransferReport'][_0x76a5('0x46')]({'where':{'id':_0x272ab0[_0x76a5('0x4a')]['id']}})[_0x76a5('0x26')](handleEntityNotFound(_0x4f4823,null))[_0x76a5('0x26')](saveUpdates(_0x272ab0[_0x76a5('0x49')],null))[_0x76a5('0x26')](respondWithResult(_0x4f4823,null))[_0x76a5('0x44')](handleError(_0x4f4823,null));};exports[_0x76a5('0x25')]=function(_0x435b6a,_0x23c952){return db[_0x76a5('0x2d')][_0x76a5('0x46')]({'where':{'id':_0x435b6a['params']['id']}})[_0x76a5('0x26')](handleEntityNotFound(_0x23c952,null))[_0x76a5('0x26')](removeEntity(_0x23c952,null))[_0x76a5('0x44')](handleError(_0x23c952,null));};exports[_0x76a5('0x4b')]=function(_0x1f2205,_0x1e3532){return db[_0x76a5('0x2d')]['describe']()[_0x76a5('0x26')](respondWithResult(_0x1e3532,null))[_0x76a5('0x44')](handleError(_0x1e3532,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index a0a3b88..570f177 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 _0x3664=['lodash','util','../../config/logger','moment','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid'];(function(_0x79bc73,_0x1ba45b){var _0x260252=function(_0x4770f8){while(--_0x4770f8){_0x79bc73['push'](_0x79bc73['shift']());}};_0x260252(++_0x1ba45b);}(_0x3664,0x8f));var _0x4366=function(_0x2079c3,_0x3ddf3f){_0x2079c3=_0x2079c3-0x0;var _0x1b280b=_0x3664[_0x2079c3];return _0x1b280b;};'use strict';var _=require(_0x4366('0x0'));var util=require(_0x4366('0x1'));var logger=require(_0x4366('0x2'))('api');var moment=require(_0x4366('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4366('0x4'));var config=require(_0x4366('0x5'));var attributes=require(_0x4366('0x6'));module[_0x4366('0x7')]=function(_0x524d44,_0x4b63a7){return _0x524d44['define'](_0x4366('0x8'),attributes,{'tableName':_0x4366('0x9'),'paranoid':![],'indexes':[{'name':_0x4366('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9e62=['WhatsappTransferReport','report_whatsapp_transfer','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappTransferReport.attributes','exports','define'];(function(_0x5e330a,_0x3df1c3){var _0x4d0639=function(_0x153131){while(--_0x153131){_0x5e330a['push'](_0x5e330a['shift']());}};_0x4d0639(++_0x3df1c3);}(_0x9e62,0x1a2));var _0x29e6=function(_0x16fbbc,_0x54a1ee){_0x16fbbc=_0x16fbbc-0x0;var _0x300a0d=_0x9e62[_0x16fbbc];return _0x300a0d;};'use strict';var _=require(_0x29e6('0x0'));var util=require('util');var logger=require(_0x29e6('0x1'))(_0x29e6('0x2'));var moment=require(_0x29e6('0x3'));var BPromise=require(_0x29e6('0x4'));var rp=require(_0x29e6('0x5'));var fs=require('fs');var path=require(_0x29e6('0x6'));var rimraf=require('rimraf');var config=require(_0x29e6('0x7'));var attributes=require(_0x29e6('0x8'));module[_0x29e6('0x9')]=function(_0x370a6a,_0x242635){return _0x370a6a[_0x29e6('0xa')](_0x29e6('0xb'),attributes,{'tableName':_0x29e6('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 3467857..86c5f7c 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 _0x118f=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x118f,0x102));var _0xf118=function(_0x3b0449,_0x14bba6){_0x3b0449=_0x3b0449-0x0;var _0x3e7b06=_0x118f[_0x3b0449];return _0x3e7b06;};'use strict';var _=require(_0xf118('0x0'));var util=require(_0xf118('0x1'));var moment=require(_0xf118('0x2'));var BPromise=require(_0xf118('0x3'));var rs=require(_0xf118('0x4'));var fs=require('fs');var Redis=require(_0xf118('0x5'));var db=require(_0xf118('0x6'))['db'];var utils=require(_0xf118('0x7'));var logger=require(_0xf118('0x8'))('rpc');var config=require(_0xf118('0x9'));var jayson=require(_0xf118('0xa'));var client=jayson[_0xf118('0xb')][_0xf118('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e3473,_0x35da40,_0x57a26a){return new BPromise(function(_0x3f8439,_0x3b9b0c){return client['request'](_0x3e3473,_0x57a26a)[_0xf118('0xd')](function(_0x2635cb){logger[_0xf118('0xe')](_0xf118('0xf'),_0x35da40,_0xf118('0x10'));logger[_0xf118('0x11')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x35da40,_0xf118('0x10'),JSON[_0xf118('0x12')](_0x2635cb));if(_0x2635cb[_0xf118('0x13')]){if(_0x2635cb['error']['code']===0x1f4){logger[_0xf118('0x13')](_0xf118('0xf'),_0x35da40,_0x2635cb[_0xf118('0x13')]['message']);return _0x3b9b0c(_0x2635cb[_0xf118('0x13')][_0xf118('0x14')]);}logger[_0xf118('0x13')](_0xf118('0xf'),_0x35da40,_0x2635cb[_0xf118('0x13')][_0xf118('0x14')]);return _0x3f8439(_0x2635cb['error']['message']);}else{logger[_0xf118('0xe')]('WhatsappTransferReport,\x20%s,\x20%s',_0x35da40,_0xf118('0x10'));_0x3f8439(_0x2635cb['result']['message']);}})[_0xf118('0x15')](function(_0x4d552c){logger[_0xf118('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0x35da40,_0x4d552c);_0x3b9b0c(_0x4d552c);});});} \ No newline at end of file +var _0xcf2e=['client','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4e98e0,_0x11b16a){var _0x1c4fcd=function(_0x2b1467){while(--_0x2b1467){_0x4e98e0['push'](_0x4e98e0['shift']());}};_0x1c4fcd(++_0x11b16a);}(_0xcf2e,0x14d));var _0xecf2=function(_0x4f839f,_0x292796){_0x4f839f=_0x4f839f-0x0;var _0x598e94=_0xcf2e[_0x4f839f];return _0x598e94;};'use strict';var _=require(_0xecf2('0x0'));var util=require(_0xecf2('0x1'));var moment=require(_0xecf2('0x2'));var BPromise=require(_0xecf2('0x3'));var rs=require(_0xecf2('0x4'));var fs=require('fs');var Redis=require(_0xecf2('0x5'));var db=require(_0xecf2('0x6'))['db'];var utils=require(_0xecf2('0x7'));var logger=require(_0xecf2('0x8'))(_0xecf2('0x9'));var config=require(_0xecf2('0xa'));var jayson=require(_0xecf2('0xb'));var client=jayson[_0xecf2('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1aa1b4,_0x1d7111,_0x399282){return new BPromise(function(_0x2dded4,_0x54a3d3){return client['request'](_0x1aa1b4,_0x399282)[_0xecf2('0xd')](function(_0x1ab9d1){logger['info'](_0xecf2('0xe'),_0x1d7111,_0xecf2('0xf'));logger[_0xecf2('0x10')](_0xecf2('0x11'),_0x1d7111,_0xecf2('0xf'),JSON['stringify'](_0x1ab9d1));if(_0x1ab9d1[_0xecf2('0x12')]){if(_0x1ab9d1['error'][_0xecf2('0x13')]===0x1f4){logger[_0xecf2('0x12')](_0xecf2('0xe'),_0x1d7111,_0x1ab9d1[_0xecf2('0x12')][_0xecf2('0x14')]);return _0x54a3d3(_0x1ab9d1[_0xecf2('0x12')]['message']);}logger['error'](_0xecf2('0xe'),_0x1d7111,_0x1ab9d1[_0xecf2('0x12')][_0xecf2('0x14')]);return _0x2dded4(_0x1ab9d1[_0xecf2('0x12')][_0xecf2('0x14')]);}else{logger[_0xecf2('0x15')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1d7111,_0xecf2('0xf'));_0x2dded4(_0x1ab9d1[_0xecf2('0x16')][_0xecf2('0x14')]);}})['catch'](function(_0x1049ad){logger[_0xecf2('0x12')](_0xecf2('0xe'),_0x1d7111,_0x1049ad);_0x54a3d3(_0x1049ad);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 39e5430..daea1c6 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6075=['app','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sync','then','seedDB','default','listen','info','start','filter','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','online','join','Offline\x20apps:','status','None','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger'];(function(_0xa88b33,_0x1c561c){var _0x1daa3c=function(_0x340270){while(--_0x340270){_0xa88b33['push'](_0xa88b33['shift']());}};_0x1daa3c(++_0x1c561c);}(_0x6075,0x191));var _0x5607=function(_0xa76581,_0x322fd6){_0xa76581=_0xa76581-0x0;var _0x2b4914=_0x6075[_0xa76581];return _0x2b4914;};'use strict';var _=require('lodash');var db=require(_0x5607('0x0'))['db'];var seedDb=require(_0x5607('0x1'));var checkLicense=require(_0x5607('0x2'));var rpc=require(_0x5607('0x3'));var config=require(_0x5607('0x4'));var logger=require(_0x5607('0x5'))(_0x5607('0x6'));var pm2=require(_0x5607('0x7'));var pm2Config=require(_0x5607('0x8'));var schedule=require('./config/schedule');var chat=require(_0x5607('0x9'));var whatsapp=require(_0x5607('0xa'));var transcribe=require(_0x5607('0xb'));var provider=require('./config/schedule/cloud-provider');function main(){return db['sequelize'][_0x5607('0xc')]()[_0x5607('0xd')](function(){if(config[_0x5607('0xe')]){return seedDb[_0x5607('0xf')]();}})[_0x5607('0xd')](function(){return checkLicense['default']();})[_0x5607('0xd')](function(){return rpc[_0x5607('0x10')]();})[_0x5607('0xd')](function(_0x4ea43b){logger[_0x5607('0x11')](_0x4ea43b);return chat['start']();})['then'](function(){return whatsapp[_0x5607('0x12')]();})[_0x5607('0xd')](function(){return schedule[_0x5607('0x12')]();})['then'](function(){return transcribe[_0x5607('0x12')]();})[_0x5607('0xd')](function(){return provider[_0x5607('0x12')]();})[_0x5607('0xd')](function(_0xe6368d){logger[_0x5607('0x11')](_0xe6368d);return pm2[_0x5607('0x12')](pm2Config);})[_0x5607('0xd')](function(_0x2daf4c){var _0x4e1167=_0x2daf4c[_0x5607('0x13')](function(_0x275c5d){return typeof _0x275c5d[_0x5607('0x14')]==='number'&&_0x275c5d['exitCode']>=0x0;});if(_0x4e1167[_0x5607('0x15')]>0x0){throw new Error(_0x4e1167['length']+_0x5607('0x16')+_[_0x5607('0x17')](_0x4e1167,function(_0x1fa238){return'\x22'+_0x1fa238[_0x5607('0x18')][_0x5607('0x19')]+'\x22';}));}logger[_0x5607('0x11')]('Online\x20apps:',_[_0x5607('0x17')](_['filter'](_0x2daf4c,{'status':_0x5607('0x1a')}),_0x5607('0x19'))[_0x5607('0x1b')]());logger['info'](_0x5607('0x1c'),_[_0x5607('0x17')](_[_0x5607('0x13')](_0x2daf4c,function(_0x4e66f0){return _0x4e66f0[_0x5607('0x1d')]!==_0x5607('0x1a');}),_0x5607('0x19'))['join']()||_0x5607('0x1e'));console['log']('App\x20Ready!');})[_0x5607('0x1f')](function(_0x564ba2){console[_0x5607('0x20')](_0x5607('0x21'),_0x564ba2);logger[_0x5607('0x22')](_0x5607('0x23'),_0x564ba2);process[_0x5607('0x24')](0x1);});}main(); \ No newline at end of file +var _0x1670=['online','join','Offline\x20apps:','status','None','App\x20Ready!','catch','log','error','exit','lodash','./mysqldb','./config/license','./config/environment','./config/logger','app','./config/pm2','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','info','start','number','exitCode','length','name','Online\x20apps:','map','filter'];(function(_0x3d4297,_0x930c63){var _0x12b361=function(_0x258fb8){while(--_0x258fb8){_0x3d4297['push'](_0x3d4297['shift']());}};_0x12b361(++_0x930c63);}(_0x1670,0x9a));var _0x0167=function(_0x36679c,_0x53c39c){_0x36679c=_0x36679c-0x0;var _0x13eef9=_0x1670[_0x36679c];return _0x13eef9;};'use strict';var _=require(_0x0167('0x0'));var db=require(_0x0167('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x0167('0x2'));var rpc=require('./rpc');var config=require(_0x0167('0x3'));var logger=require(_0x0167('0x4'))(_0x0167('0x5'));var pm2=require(_0x0167('0x6'));var pm2Config=require('./config/pm2/config');var schedule=require('./config/schedule');var chat=require(_0x0167('0x7'));var whatsapp=require(_0x0167('0x8'));var transcribe=require(_0x0167('0x9'));var provider=require(_0x0167('0xa'));function main(){return db[_0x0167('0xb')][_0x0167('0xc')]()[_0x0167('0xd')](function(){if(config[_0x0167('0xe')]){return seedDb['default']();}})['then'](function(){return checkLicense[_0x0167('0xf')]();})[_0x0167('0xd')](function(){return rpc[_0x0167('0x10')]();})[_0x0167('0xd')](function(_0x338288){logger[_0x0167('0x11')](_0x338288);return chat[_0x0167('0x12')]();})[_0x0167('0xd')](function(){return whatsapp[_0x0167('0x12')]();})[_0x0167('0xd')](function(){return schedule[_0x0167('0x12')]();})[_0x0167('0xd')](function(){return transcribe[_0x0167('0x12')]();})[_0x0167('0xd')](function(){return provider['start']();})[_0x0167('0xd')](function(_0x4e2c53){logger[_0x0167('0x11')](_0x4e2c53);return pm2['start'](pm2Config);})[_0x0167('0xd')](function(_0x39e644){var _0x3fc778=_0x39e644['filter'](function(_0x50c1a3){return typeof _0x50c1a3['exitCode']===_0x0167('0x13')&&_0x50c1a3[_0x0167('0x14')]>=0x0;});if(_0x3fc778['length']>0x0){throw new Error(_0x3fc778[_0x0167('0x15')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_['map'](_0x3fc778,function(_0x38f934){return'\x22'+_0x38f934['pm2_env'][_0x0167('0x16')]+'\x22';}));}logger['info'](_0x0167('0x17'),_[_0x0167('0x18')](_[_0x0167('0x19')](_0x39e644,{'status':_0x0167('0x1a')}),_0x0167('0x16'))[_0x0167('0x1b')]());logger[_0x0167('0x11')](_0x0167('0x1c'),_[_0x0167('0x18')](_[_0x0167('0x19')](_0x39e644,function(_0x221d7c){return _0x221d7c[_0x0167('0x1d')]!=='online';}),_0x0167('0x16'))[_0x0167('0x1b')]()||_0x0167('0x1e'));console['log'](_0x0167('0x1f'));})[_0x0167('0x20')](function(_0x43d6bc){console[_0x0167('0x21')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x43d6bc);logger[_0x0167('0x22')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x43d6bc);process[_0x0167('0x23')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 8452d86..9f43a2d 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 _0x3423=['session','role','fullname','name','internal','email','md5secret','smsPause','openchannelPause','showWebBar','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswer','messengerSoundNotification','isAuthenticated','use','user','ChatInteraction','findOne','closed','disposition','json','Forbidden.','catch','headers','authorization','startsWith','Basic','User','then','authenticate','pass','status','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','find','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','/dashboards/general','send','retrieveApiKey','apiKeyNonce','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','length','splice','unshift','encryptString','join','promisify','secret','payload','options','verify','randomBytes','floor','now','toString','HS512','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets'];(function(_0x1ff5d9,_0x2980be){var _0x5f3fc8=function(_0x7179ef){while(--_0x7179ef){_0x1ff5d9['push'](_0x1ff5d9['shift']());}};_0x5f3fc8(++_0x2980be);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var hardwareConf=require(_0x3342('0x0'));var licenseUtil=require(_0x3342('0x1'));var encryptor=require(_0x3342('0x2'));var _=require(_0x3342('0x3'));var jwt=require(_0x3342('0x4'));var expressJwt=require(_0x3342('0x5'));var compose=require(_0x3342('0x6'));var basicAuth=require(_0x3342('0x7'));var crypto=require(_0x3342('0x8'));var BPromise=require(_0x3342('0x9'));var util=require(_0x3342('0xa'));var moment=require(_0x3342('0xb'));var validateJwt=expressJwt({'secret':config[_0x3342('0xc')][_0x3342('0xd')]});var userAttributes=['id',_0x3342('0xe'),_0x3342('0xf'),_0x3342('0x10'),_0x3342('0x11'),_0x3342('0x12'),'userpic','permissions',_0x3342('0x13'),'voicePause','chatPause','mailPause','faxPause',_0x3342('0x14'),_0x3342('0x15'),'pauseType',_0x3342('0x16'),'lastLoginAt',_0x3342('0x17'),_0x3342('0x18'),'allowmessenger',_0x3342('0x19'),_0x3342('0x1a'),_0x3342('0x1b'),_0x3342('0x1c'),_0x3342('0x1d'),_0x3342('0x1e'),_0x3342('0x1f'),'phoneBarEnableSettings',_0x3342('0x20'),_0x3342('0x21'),'phoneBarRemoteControl',_0x3342('0x22'),_0x3342('0x23'),'interface','userProfileId',_0x3342('0x24'),_0x3342('0x25'),_0x3342('0x26'),_0x3342('0x27'),_0x3342('0x28'),_0x3342('0x29'),_0x3342('0x2a'),_0x3342('0x2b'),_0x3342('0x2c'),'chatAutoanswerDelay',_0x3342('0x2d'),_0x3342('0x2e'),_0x3342('0x2f'),'smsAutoanswerDelay',_0x3342('0x30'),_0x3342('0x31'),'faxAutoanswer',_0x3342('0x32'),_0x3342('0x33'),'whatsappAutoanswerDelay',_0x3342('0x34')];exports['isChatInteractionAuthorized']=function(){return this[_0x3342('0x35')](!![])[_0x3342('0x36')](function(_0xa23053,_0x2dbad1,_0xd2b87d){if(_0xa23053[_0x3342('0x37')]){_0xd2b87d();}else{return db[_0x3342('0x38')][_0x3342('0x39')]({'where':{'id':_0xa23053['params']['id']},'attributes':['id',_0x3342('0x3a'),'disposition'],'raw':!![]})['then'](function(_0x986ab0){if(_0x986ab0&&_0x986ab0['closed']){return _0x2dbad1['status'](_0x986ab0[_0x3342('0x3b')]==='unmanaged'?0x195:0x193)[_0x3342('0x3c')]({'message':_0x986ab0['disposition']==='unmanaged'?'Unmanaged.':_0x3342('0x3d')});}else{_0xd2b87d();}})[_0x3342('0x3e')](function(_0x1dd607){_0xd2b87d(_0x1dd607);});}});};exports['isAuthenticated']=function isAuthenticated(_0xc275a1){return compose()[_0x3342('0x36')](function(_0x1cc542,_0x272a52,_0x4fbfb7){var _0x27e25b;if(_0x1cc542[_0x3342('0x3f')][_0x3342('0x40')]){if(_[_0x3342('0x41')](_0x1cc542[_0x3342('0x3f')][_0x3342('0x40')],_0x3342('0x42'))){var _0x47b2a0=basicAuth(_0x1cc542);db[_0x3342('0x43')]['find']({'where':{'name':_0x47b2a0[_0x3342('0x10')]}})[_0x3342('0x44')](function(_0x508f87){if(!_0x508f87||!_0x508f87[_0x3342('0x45')](_0x47b2a0[_0x3342('0x46')])){return _0x272a52[_0x3342('0x47')](0x191)[_0x3342('0x3c')]({'message':'Wrong\x20credentials.'});}_0x1cc542[_0x3342('0x37')]={'id':_0x508f87['id']};_0x4fbfb7();})[_0x3342('0x3e')](function(_0x311cfe){_0x4fbfb7(_0x311cfe);});}else if(_[_0x3342('0x41')](_0x1cc542[_0x3342('0x3f')][_0x3342('0x40')],_0x3342('0x48'))){validateJwt(_0x1cc542,_0x272a52,_0x4fbfb7);}else{if(_0xc275a1){_0x4fbfb7();}else{return _0x272a52[_0x3342('0x47')](0x193)[_0x3342('0x3c')]({'message':_0x3342('0x49')});}}}else if(_0x1cc542[_0x3342('0x4a')][_0x3342('0x4b')]){try{var _0x5aea96={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x3342('0x4c')]()};verifyJwt(_0x1cc542['query'][_0x3342('0x4b')],_0x5aea96)[_0x3342('0x44')](function(_0x1a74d3){return db[_0x3342('0x43')][_0x3342('0x4d')]({'where':{'id':_0x1a74d3[_0x3342('0x4e')]}})[_0x3342('0x44')](function(_0x5d460c){_0x27e25b=_0x5d460c;return db[_0x3342('0x4f')][_0x3342('0x39')]({'where':{'id':0x1},'attributes':[_0x3342('0x50'),_0x3342('0x51')],'raw':!![]});})[_0x3342('0x44')](function(_0x5bd5eb){if(!_0x27e25b||!_[_0x3342('0x52')](_0x27e25b['apiKeyNonce'],_0x1a74d3[_0x3342('0x53')])){return _0x272a52[_0x3342('0x47')](0x191)[_0x3342('0x3c')]({'message':_0x3342('0x54')});}if(_0x27e25b['disabled']){return _0x272a52[_0x3342('0x47')](0x191)['json']({'message':_0x3342('0x55')});}if(_0x27e25b[_0x3342('0x56')]){if(_0x5bd5eb[_0x3342('0x51')]>0x0){if(moment(_0x27e25b[_0x3342('0x57')])[_0x3342('0x58')](_0x5bd5eb[_0x3342('0x51')],_0x3342('0x59'))>moment()){return _0x272a52['status'](0x191)[_0x3342('0x3c')]({'message':_0x3342('0x55')});}}else{return _0x272a52['status'](0x191)[_0x3342('0x3c')]({'message':_0x3342('0x55')});}}_0x1cc542['user']={'id':_0x27e25b['id']};_0x4fbfb7();});})[_0x3342('0x3e')](function(){return _0x272a52[_0x3342('0x47')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x5acb74){_0x4fbfb7(_0x5acb74);}}else if(_0xc275a1){_0x4fbfb7();}else{return _0x272a52[_0x3342('0x47')](0x193)[_0x3342('0x3c')]({'message':'Unknown\x20authorization\x20format'});}})[_0x3342('0x36')](function(_0x2a1f7e,_0x2944ab,_0x17fd01){if(_0x2a1f7e[_0x3342('0x37')]){db[_0x3342('0x43')][_0x3342('0x4d')]({'where':{'id':_0x2a1f7e[_0x3342('0x37')]['id']},'attributes':userAttributes})['then'](function(_0x5a787b){if(!_0x5a787b){return _0x2944ab[_0x3342('0x47')](0x194)[_0x3342('0x3c')]({'message':_0x3342('0x5a')});}_0x2a1f7e[_0x3342('0x37')]=_0x5a787b;_0x17fd01();})[_0x3342('0x3e')](function(_0x414fcb){_0x17fd01(_0x414fcb);});}else if(_0xc275a1){_0x17fd01();}else{return _0x2944ab['status'](0x194)[_0x3342('0x3c')]({'message':_0x3342('0x5b')});}});};exports[_0x3342('0x5c')]=function canUpdate(){return compose()[_0x3342('0x36')](function(_0x64e352,_0x365d6f,_0x5e2c66){return licenseUtil[_0x3342('0x5d')]()['then'](function(_0x6090bd){if(_0x6090bd[_0x3342('0x5e')]){_0x5e2c66();}else{return _0x365d6f[_0x3342('0x47')](0x193)[_0x3342('0x3c')]({'message':'Forbidden'});}})[_0x3342('0x3e')](function(_0x16e970){_0x5e2c66(_0x16e970);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0x3342('0x36')](function(_0x302159,_0x169549,_0x16cebb){return licenseUtil['getLicense']()[_0x3342('0x44')](function(_0x2453a9){if(_0x2453a9['webrtc']){_0x16cebb();}else{return _0x169549[_0x3342('0x47')](0x193)['json']({'message':'Forbidden'});}})[_0x3342('0x3e')](function(_0x706154){_0x16cebb(_0x706154);});});};exports[_0x3342('0x5f')]=function(_0x296cbb,_0x23925e,_0x171387){_0x296cbb[_0x3342('0x5f')]=!![];return _0x171387();};exports['signToken']=function signToken(_0x4e6be0){return signJwt(_0x4e6be0);};exports[_0x3342('0x60')]=function(_0x5a9e40,_0x26251c){if(!_0x5a9e40['user']){return _0x26251c['status'](0x194)['json']({'message':_0x3342('0x61')});}var _0x23f623={'payload':{'id':_0x5a9e40[_0x3342('0x37')]['id'],'role':_0x5a9e40[_0x3342('0x37')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x23f623)[_0x3342('0x44')](function(_0x3a6597){_0x26251c['cookie'](_0x3342('0x62'),_0x3a6597);_0x26251c[_0x3342('0x63')](_0x3342('0x64'));})['catch'](function(_0x189b68){return _0x26251c[_0x3342('0x47')](0x1f4)[_0x3342('0x65')](_0x189b68);});};exports[_0x3342('0x66')]=function(_0x250e6a){if(_['isNil'](_0x250e6a[_0x3342('0x67')])||_[_0x3342('0x68')](_0x250e6a[_0x3342('0x69')])){return null;}else{return createJwt(_0x250e6a);}};exports[_0x3342('0x6a')]=function(_0x16d966){_0x16d966[_0x3342('0x67')]=generateNonce();_0x16d966[_0x3342('0x69')]=generateIssuedAt();return createJwt(_0x16d966);};exports[_0x3342('0x6b')]=function(_0x16a4be,_0x542181){var _0x218181=_0x16a4be['query'][_0x3342('0x4b')];if(_0x218181){var _0x524fb6={'nonce':_0x542181['apiKeyNonce'],'iat':_0x542181['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x3342('0x4c')]()};return verifyJwt(_0x218181,_0x524fb6)[_0x3342('0x44')](function(){return generateApiKey(_0x542181);});}else{throw{'message':_0x3342('0x6c')};}};exports[_0x3342('0x6d')]=function(_0x3d9be7){var _0x163d76=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x163d76[_0x3342('0x6e')](_0x3d9be7))throw new db[(_0x3342('0x6f'))][(_0x3342('0x70'))](_0x3342('0x71'));return;};exports[_0x3342('0x72')]=function(_0x561812,_0x47d138,_0x11719c){var _0x53e54b=encryptor[_0x3342('0x73')](_0x47d138)['split'](',');for(var _0x4c777e=0x0;_0x4c777e<_0x11719c;_0x4c777e++){if(!_0x53e54b[_0x4c777e])break;if(_0x561812[_0x3342('0x74')]()===_0x53e54b[_0x4c777e][_0x3342('0x74')]()){var _0x16e692=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x11719c);if(_0x11719c===0x1){_0x16e692=_0x3342('0x75');}throw new db[(_0x3342('0x6f'))]['ValidationError'](_0x16e692);}}return;};exports[_0x3342('0x76')]=function(_0x219a17,_0x372af5){var _0x4d3660=_0x372af5?encryptor[_0x3342('0x73')](_0x372af5)[_0x3342('0x77')](','):[];if(_0x4d3660[_0x3342('0x78')]===0x5){_0x4d3660[_0x3342('0x79')](-0x1,0x1);}_0x4d3660[_0x3342('0x7a')](_0x219a17);return encryptor[_0x3342('0x7b')](_0x4d3660[_0x3342('0x7c')](','));};function signJwt(_0x57942a){var _0x4bc9a9=BPromise[_0x3342('0x7d')](jwt['sign'],{'context':jwt});var _0x25fa01=_0x57942a[_0x3342('0x7e')]||config[_0x3342('0xc')][_0x3342('0xd')];return new BPromise(function(_0xe9b979,_0x5d8a9d){_0x4bc9a9(_0x57942a[_0x3342('0x7f')],_0x25fa01,_0x57942a[_0x3342('0x80')])['then'](function(_0x14e56b){_0xe9b979(_0x14e56b);})[_0x3342('0x3e')](function(_0x10842c){_0x5d8a9d(_0x10842c);});});}function verifyJwt(_0x2858a6,_0x1ba552,_0x3a82c8){var _0x19fcc5=BPromise[_0x3342('0x7d')](jwt[_0x3342('0x81')],{'context':jwt});var _0x36eec8=_0x3a82c8||config[_0x3342('0xc')][_0x3342('0xd')];return new BPromise(function(_0x3b01a3,_0x58cbdd){_0x19fcc5(_0x2858a6,_0x36eec8,_0x1ba552)['then'](function(_0x146ffc){_0x3b01a3(_0x146ffc);})[_0x3342('0x3e')](function(_0x14193b){_0x58cbdd(_0x14193b);});});}function generateNonce(){return crypto[_0x3342('0x82')](0x10)['toString']('hex');}function generateIssuedAt(){return Math[_0x3342('0x83')](Date[_0x3342('0x84')]()/0x3e8)[_0x3342('0x85')]();}function createJwt(_0x2aed01){var _0xbc9035={'payload':{'iat':_0x2aed01[_0x3342('0x69')],'nonce':_0x2aed01[_0x3342('0x67')]},'options':{'algorithm':_0x3342('0x86'),'subject':_0x2aed01['id'][_0x3342('0x85')](),'issuer':hardwareConf[_0x3342('0x4c')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0xbc9035)[_0x3342('0x44')](function(_0x5e2ff3){return{'iat':_0x2aed01[_0x3342('0x69')],'nonce':_0x2aed01[_0x3342('0x67')],'token':_0x5e2ff3};});} \ No newline at end of file +var _0x6426=['blockDuration','blockedAt','add','minutes','use','User','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','isWebrtcLicence','getLicense','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','decryptString','length','splice','encryptString','join','promisify','sign','secret','session','payload','options','verify','randomBytes','toString','hex','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','secrets','role','name','internal','email','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','findOne','params','closed','disposition','then','query','forceDownload','unmanaged','json','Unmanaged.','Forbidden.','authorization','startsWith','headers','find','authenticate','pass','Wrong\x20credentials.','catch','status','Unknown\x20authorization\x20format','apikey','getUuid','Setting','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked'];(function(_0x9ad710,_0x449a0e){var _0x5c1bd6=function(_0x12e083){while(--_0x12e083){_0x9ad710['push'](_0x9ad710['shift']());}};_0x5c1bd6(++_0x449a0e);}(_0x6426,0x1ea));var _0x6642=function(_0x5d0e3c,_0x52f191){_0x5d0e3c=_0x5d0e3c-0x0;var _0x11ffc4=_0x6426[_0x5d0e3c];return _0x11ffc4;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x6642('0x0'));var hardwareConf=require(_0x6642('0x1'));var licenseUtil=require(_0x6642('0x2'));var encryptor=require(_0x6642('0x3'));var _=require(_0x6642('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x6642('0x5'));var compose=require(_0x6642('0x6'));var basicAuth=require(_0x6642('0x7'));var crypto=require('crypto');var BPromise=require(_0x6642('0x8'));var util=require(_0x6642('0x9'));var moment=require(_0x6642('0xa'));var validateJwt=expressJwt({'secret':config[_0x6642('0xb')]['session']});var userAttributes=['id',_0x6642('0xc'),'fullname',_0x6642('0xd'),_0x6642('0xe'),_0x6642('0xf'),_0x6642('0x10'),_0x6642('0x11'),'md5secret',_0x6642('0x12'),_0x6642('0x13'),_0x6642('0x14'),_0x6642('0x15'),_0x6642('0x16'),_0x6642('0x17'),'pauseType','showWebBar','lastLoginAt',_0x6642('0x18'),_0x6642('0x19'),'allowmessenger',_0x6642('0x1a'),_0x6642('0x1b'),_0x6642('0x1c'),_0x6642('0x1d'),_0x6642('0x1e'),_0x6642('0x1f'),_0x6642('0x20'),_0x6642('0x21'),_0x6642('0x22'),_0x6642('0x23'),'phoneBarRemoteControl',_0x6642('0x24'),_0x6642('0x25'),'interface','userProfileId',_0x6642('0x26'),_0x6642('0x27'),_0x6642('0x28'),_0x6642('0x29'),'downloadOmnichannelInteractions',_0x6642('0x2a'),'ignorePauseForPreviewCalls',_0x6642('0x2b'),_0x6642('0x2c'),_0x6642('0x2d'),_0x6642('0x2e'),_0x6642('0x2f'),_0x6642('0x30'),_0x6642('0x31'),'openchannelAutoanswer',_0x6642('0x32'),_0x6642('0x33'),_0x6642('0x34'),_0x6642('0x35'),_0x6642('0x36'),_0x6642('0x37')];exports[_0x6642('0x38')]=function(){return this[_0x6642('0x39')](!![])['use'](function(_0x50de3e,_0x4c8286,_0x577bb9){if(_0x50de3e[_0x6642('0x3a')]){_0x577bb9();}else{return db[_0x6642('0x3b')][_0x6642('0x3c')]({'where':{'id':_0x50de3e[_0x6642('0x3d')]['id']},'attributes':['id',_0x6642('0x3e'),_0x6642('0x3f')],'raw':!![]})[_0x6642('0x40')](function(_0x48b2bd){if(_0x48b2bd&&_0x48b2bd[_0x6642('0x3e')]&&!_0x50de3e[_0x6642('0x41')][_0x6642('0x42')]){return _0x4c8286['status'](_0x48b2bd[_0x6642('0x3f')]===_0x6642('0x43')?0x195:0x193)[_0x6642('0x44')]({'message':_0x48b2bd[_0x6642('0x3f')]===_0x6642('0x43')?_0x6642('0x45'):_0x6642('0x46')});}else{_0x577bb9();}})['catch'](function(_0x6a7b5c){_0x577bb9(_0x6a7b5c);});}});};exports[_0x6642('0x39')]=function isAuthenticated(_0x5ab4a2){return compose()['use'](function(_0x8d2bff,_0x3324f0,_0x3e9a07){var _0x1af695;if(_0x8d2bff['headers'][_0x6642('0x47')]){if(_[_0x6642('0x48')](_0x8d2bff[_0x6642('0x49')][_0x6642('0x47')],'Basic')){var _0x4c75b3=basicAuth(_0x8d2bff);db['User'][_0x6642('0x4a')]({'where':{'name':_0x4c75b3['name']}})[_0x6642('0x40')](function(_0x34d751){if(!_0x34d751||!_0x34d751[_0x6642('0x4b')](_0x4c75b3[_0x6642('0x4c')])){return _0x3324f0['status'](0x191)[_0x6642('0x44')]({'message':_0x6642('0x4d')});}_0x8d2bff['user']={'id':_0x34d751['id']};_0x3e9a07();})[_0x6642('0x4e')](function(_0xc5e3e2){_0x3e9a07(_0xc5e3e2);});}else if(_[_0x6642('0x48')](_0x8d2bff[_0x6642('0x49')][_0x6642('0x47')],'Bearer')){validateJwt(_0x8d2bff,_0x3324f0,_0x3e9a07);}else{if(_0x5ab4a2){_0x3e9a07();}else{return _0x3324f0[_0x6642('0x4f')](0x193)[_0x6642('0x44')]({'message':_0x6642('0x50')});}}}else if(_0x8d2bff[_0x6642('0x41')][_0x6642('0x51')]){try{var _0x300c30={'audience':hardwareConf[_0x6642('0x52')](),'issuer':hardwareConf[_0x6642('0x52')]()};verifyJwt(_0x8d2bff['query'][_0x6642('0x51')],_0x300c30)['then'](function(_0x3be94a){return db['User']['find']({'where':{'id':_0x3be94a['sub']}})[_0x6642('0x40')](function(_0x5e3640){_0x1af695=_0x5e3640;return db[_0x6642('0x53')][_0x6642('0x3c')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]});})[_0x6642('0x40')](function(_0x5bb3e9){if(!_0x1af695||!_['isEqual'](_0x1af695[_0x6642('0x54')],_0x3be94a[_0x6642('0x55')])){return _0x3324f0[_0x6642('0x4f')](0x191)[_0x6642('0x44')]({'message':_0x6642('0x56')});}if(_0x1af695[_0x6642('0x57')]){return _0x3324f0['status'](0x191)['json']({'message':_0x6642('0x58')});}if(_0x1af695[_0x6642('0x59')]){if(_0x5bb3e9[_0x6642('0x5a')]>0x0){if(moment(_0x1af695[_0x6642('0x5b')])[_0x6642('0x5c')](_0x5bb3e9[_0x6642('0x5a')],_0x6642('0x5d'))>moment()){return _0x3324f0[_0x6642('0x4f')](0x191)[_0x6642('0x44')]({'message':_0x6642('0x58')});}}else{return _0x3324f0[_0x6642('0x4f')](0x191)['json']({'message':_0x6642('0x58')});}}_0x8d2bff['user']={'id':_0x1af695['id']};_0x3e9a07();});})[_0x6642('0x4e')](function(){return _0x3324f0[_0x6642('0x4f')](0x191)[_0x6642('0x44')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x266667){_0x3e9a07(_0x266667);}}else if(_0x5ab4a2){_0x3e9a07();}else{return _0x3324f0[_0x6642('0x4f')](0x193)[_0x6642('0x44')]({'message':_0x6642('0x50')});}})[_0x6642('0x5e')](function(_0x24ae6a,_0x11be57,_0x29492e){if(_0x24ae6a[_0x6642('0x3a')]){db[_0x6642('0x5f')][_0x6642('0x4a')]({'where':{'id':_0x24ae6a[_0x6642('0x3a')]['id']},'attributes':userAttributes})[_0x6642('0x40')](function(_0x101f26){if(!_0x101f26){return _0x11be57['status'](0x194)[_0x6642('0x44')]({'message':_0x6642('0x60')});}_0x24ae6a[_0x6642('0x3a')]=_0x101f26;_0x29492e();})[_0x6642('0x4e')](function(_0x36f68a){_0x29492e(_0x36f68a);});}else if(_0x5ab4a2){_0x29492e();}else{return _0x11be57[_0x6642('0x4f')](0x194)[_0x6642('0x44')]({'message':_0x6642('0x61')});}});};exports[_0x6642('0x62')]=function canUpdate(){return compose()[_0x6642('0x5e')](function(_0x1f6ea7,_0x5ca1d6,_0x3618ba){return licenseUtil['getLicense']()['then'](function(_0x240d91){if(_0x240d91[_0x6642('0x63')]){_0x3618ba();}else{return _0x5ca1d6[_0x6642('0x4f')](0x193)[_0x6642('0x44')]({'message':_0x6642('0x64')});}})[_0x6642('0x4e')](function(_0x3edc6c){_0x3618ba(_0x3edc6c);});});};exports[_0x6642('0x65')]=function isWebrtcLicence(){return compose()[_0x6642('0x5e')](function(_0x33294e,_0x4cdad,_0x3cc665){return licenseUtil[_0x6642('0x66')]()['then'](function(_0x2911aa){if(_0x2911aa[_0x6642('0x67')]){_0x3cc665();}else{return _0x4cdad[_0x6642('0x4f')](0x193)[_0x6642('0x44')]({'message':_0x6642('0x64')});}})[_0x6642('0x4e')](function(_0x27dd0a){_0x3cc665(_0x27dd0a);});});};exports[_0x6642('0x68')]=function(_0x1e9833,_0xa88dcb,_0x14a242){_0x1e9833['isMiddleware']=!![];return _0x14a242();};exports[_0x6642('0x69')]=function signToken(_0x5754fb){return signJwt(_0x5754fb);};exports[_0x6642('0x6a')]=function(_0x21bc90,_0x1d498c){if(!_0x21bc90['user']){return _0x1d498c[_0x6642('0x4f')](0x194)[_0x6642('0x44')]({'message':_0x6642('0x6b')});}var _0x57bfcd={'payload':{'id':_0x21bc90[_0x6642('0x3a')]['id'],'role':_0x21bc90[_0x6642('0x3a')][_0x6642('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x57bfcd)['then'](function(_0x529eed){_0x1d498c[_0x6642('0x6c')](_0x6642('0x6d'),_0x529eed);_0x1d498c[_0x6642('0x6e')](_0x6642('0x6f'));})[_0x6642('0x4e')](function(_0x1a58d8){return _0x1d498c[_0x6642('0x4f')](0x1f4)[_0x6642('0x70')](_0x1a58d8);});};exports[_0x6642('0x71')]=function(_0x1bf5fb){if(_[_0x6642('0x72')](_0x1bf5fb[_0x6642('0x54')])||_[_0x6642('0x72')](_0x1bf5fb['apiKeyIat'])){return null;}else{return createJwt(_0x1bf5fb);}};exports[_0x6642('0x73')]=function(_0x54cb89){_0x54cb89['apiKeyNonce']=generateNonce();_0x54cb89[_0x6642('0x74')]=generateIssuedAt();return createJwt(_0x54cb89);};exports[_0x6642('0x75')]=function(_0x59d2f5,_0x4587fd){var _0x5f3f6e=_0x59d2f5[_0x6642('0x41')][_0x6642('0x51')];if(_0x5f3f6e){var _0x47314e={'nonce':_0x4587fd[_0x6642('0x54')],'iat':_0x4587fd[_0x6642('0x74')],'audience':hardwareConf[_0x6642('0x52')](),'issuer':hardwareConf[_0x6642('0x52')]()};return verifyJwt(_0x5f3f6e,_0x47314e)['then'](function(){return generateApiKey(_0x4587fd);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports['validatePasswordPattern']=function(_0x10ac59){var _0xecd12b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xecd12b[_0x6642('0x76')](_0x10ac59))throw new db[(_0x6642('0x77'))][(_0x6642('0x78'))](_0x6642('0x79'));return;};exports[_0x6642('0x7a')]=function(_0x77b2f2,_0x16eb87,_0xc0965){var _0x274f7d=encryptor['decryptString'](_0x16eb87)[_0x6642('0x7b')](',');for(var _0x4628cd=0x0;_0x4628cd<_0xc0965;_0x4628cd++){if(!_0x274f7d[_0x4628cd])break;if(_0x77b2f2[_0x6642('0x7c')]()===_0x274f7d[_0x4628cd][_0x6642('0x7c')]()){var _0x4792c6=util[_0x6642('0x7d')](_0x6642('0x7e'),_0xc0965);if(_0xc0965===0x1){_0x4792c6=_0x6642('0x7f');}throw new db[(_0x6642('0x77'))][(_0x6642('0x78'))](_0x4792c6);}}return;};exports[_0x6642('0x80')]=function(_0x1320d3,_0x3750b6){var _0x1fe011=_0x3750b6?encryptor[_0x6642('0x81')](_0x3750b6)[_0x6642('0x7b')](','):[];if(_0x1fe011[_0x6642('0x82')]===0x5){_0x1fe011[_0x6642('0x83')](-0x1,0x1);}_0x1fe011['unshift'](_0x1320d3);return encryptor[_0x6642('0x84')](_0x1fe011[_0x6642('0x85')](','));};function signJwt(_0x39eea5){var _0x1239cf=BPromise[_0x6642('0x86')](jwt[_0x6642('0x87')],{'context':jwt});var _0x539d74=_0x39eea5[_0x6642('0x88')]||config['secrets'][_0x6642('0x89')];return new BPromise(function(_0xcd8853,_0x55bcce){_0x1239cf(_0x39eea5[_0x6642('0x8a')],_0x539d74,_0x39eea5[_0x6642('0x8b')])[_0x6642('0x40')](function(_0x1ae508){_0xcd8853(_0x1ae508);})[_0x6642('0x4e')](function(_0x2dfc43){_0x55bcce(_0x2dfc43);});});}function verifyJwt(_0x261fe7,_0x559cb9,_0x145043){var _0x44c739=BPromise['promisify'](jwt[_0x6642('0x8c')],{'context':jwt});var _0x80a730=_0x145043||config[_0x6642('0xb')][_0x6642('0x89')];return new BPromise(function(_0x5d9c7f,_0x5dea41){_0x44c739(_0x261fe7,_0x80a730,_0x559cb9)[_0x6642('0x40')](function(_0x769896){_0x5d9c7f(_0x769896);})['catch'](function(_0x5a1376){_0x5dea41(_0x5a1376);});});}function generateNonce(){return crypto[_0x6642('0x8d')](0x10)[_0x6642('0x8e')](_0x6642('0x8f'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x6642('0x8e')]();}function createJwt(_0x17c8da){var _0x147b9c={'payload':{'iat':_0x17c8da[_0x6642('0x74')],'nonce':_0x17c8da['apiKeyNonce']},'options':{'algorithm':_0x6642('0x90'),'subject':_0x17c8da['id']['toString'](),'issuer':hardwareConf[_0x6642('0x52')](),'audience':hardwareConf[_0x6642('0x52')]()}};return signJwt(_0x147b9c)[_0x6642('0x40')](function(_0x4dcc32){return{'iat':_0x17c8da[_0x6642('0x74')],'nonce':_0x17c8da['apiKeyNonce'],'token':_0x4dcc32};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index a32e923..37a6aca 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 _0xf7dd=['startsWith','cf_','map','slice','all','length','fieldType','type','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','fields','filter','clause','tags','checkListsRestrictions','tag','countFilteredContacts','count','User','buildContactsQuery','getFilteredContacts','rows','catch','describe','CmContact','keys'];(function(_0x3ea28c,_0x614cc8){var _0x35acd7=function(_0x15218c){while(--_0x15218c){_0x3ea28c['push'](_0x3ea28c['shift']());}};_0x35acd7(++_0x614cc8);}(_0xf7dd,0x77));var _0xdf7d=function(_0x1d5cfa,_0x57efb0){_0x1d5cfa=_0x1d5cfa-0x0;var _0x19a273=_0xf7dd[_0x1d5cfa];return _0x19a273;};'use strict';var _=require(_0xdf7d('0x0'));var sqlUtils=require(_0xdf7d('0x1'));var db=require(_0xdf7d('0x2'))['db'];exports[_0xdf7d('0x3')]=function(_0x44aa52,_0xb8f726,_0x573f71,_0x2eb4fc){var _0x3f70f5={'count':0x0,'rows':[]};var _0xaad5f9=sqlUtils[_0xdf7d('0x4')](_0xb8f726,_0x44aa52);if(_0xaad5f9){return Promise[_0xdf7d('0x5')](_0x3f70f5);}var _0x2a3f55=sqlUtils[_0xdf7d('0x6')]();var _0x32b852={};var _0x468aa9=![];var _0x1869be=![];return Promise[_0xdf7d('0x5')]()[_0xdf7d('0x7')](function(){if(_0x44aa52[_0xdf7d('0x8')]){return sqlUtils[_0xdf7d('0x9')](_0x44aa52[_0xdf7d('0x8')],_0x2eb4fc);}else{return sqlUtils[_0xdf7d('0xa')](_0x44aa52,_0x2eb4fc);}})['then'](function(_0x916f37){_0x2a3f55[_0xdf7d('0xb')](_0x916f37[_0xdf7d('0xc')]);_0x2a3f55[_0xdf7d('0xb')](_0x916f37[_0xdf7d('0xd')]);_0x2a3f55[_0xdf7d('0xb')](_0x916f37[_0xdf7d('0xe')]);_0x2a3f55[_0xdf7d('0xb')](_0x916f37['user'][_0xdf7d('0xf')]);_0x32b852=_0x916f37[_0xdf7d('0x10')];_0x1869be=_0x916f37['user']['skip'];return sqlUtils[_0xdf7d('0x11')](_0xb8f726,_0x44aa52,_0x1869be);})[_0xdf7d('0x7')](function(_0x4adca0){_0x2a3f55[_0xdf7d('0xb')](_0x4adca0);var _0x3d2e29=_0x44aa52['search']?_0x32b852['ids']:_0x44aa52[_0xdf7d('0x12')];_0x468aa9=_0x3d2e29?!![]:![];return sqlUtils[_0xdf7d('0x13')](_0x2a3f55,_0x3d2e29);})[_0xdf7d('0x7')](function(_0x239559){_0x3f70f5[_0xdf7d('0x14')]=_0x239559;if(_0x3f70f5[_0xdf7d('0x14')]===0x0){return;}if(_0x44aa52[_0xdf7d('0x15')]){_0x1869be=!![];}return sqlUtils[_0xdf7d('0x16')](_0x2a3f55,_0x44aa52[_0xdf7d('0xd')],_0x573f71,_0x468aa9,_0x32b852[_0xdf7d('0xf')],_0x1869be);})['then'](function(_0x9bad84){if(!_0x9bad84){return[];}return sqlUtils[_0xdf7d('0x17')](_0x9bad84,_0x44aa52,_0x573f71);})[_0xdf7d('0x7')](function(_0x2fdcbb){_0x3f70f5[_0xdf7d('0x18')]=_0x2fdcbb;return _0x3f70f5;})[_0xdf7d('0x19')](function(_0x4dd654){throw _0x4dd654;});};exports[_0xdf7d('0x1a')]=function(){var _0x1d33aa={};var _0x40bb7=[];return db[_0xdf7d('0x1b')][_0xdf7d('0x1a')]()[_0xdf7d('0x7')](function(_0x27be9f){_0x1d33aa=_0x27be9f;var _0x3f5d8f=Object[_0xdf7d('0x1c')](_0x1d33aa)[_0xdf7d('0xe')](function(_0x3b4150){return _[_0xdf7d('0x1d')](_0x3b4150,_0xdf7d('0x1e'))?_0x3b4150:undefined;});var _0x489e07=_0x3f5d8f[_0xdf7d('0x1f')](function(_0x2bfed4){return db['CmCustomField']['findOne']({'where':{'id':_0x2bfed4[_0xdf7d('0x20')](0x3)},'raw':!![]});});return Promise[_0xdf7d('0x21')](_0x489e07);})[_0xdf7d('0x7')](function(_0x1318fa){for(var _0x4d9993=0x0;_0x4d9993<_0x1318fa[_0xdf7d('0x22')];_0x4d9993++){if(_0x1318fa[_0x4d9993]){var _0x4b584a=_0xdf7d('0x1e')+_0x1318fa[_0x4d9993]['id'];_0x1d33aa[_0x4b584a][_0xdf7d('0x23')]=_0x1318fa[_0x4d9993][_0xdf7d('0x24')];}}_0x40bb7=_[_0xdf7d('0x1f')](Object[_0xdf7d('0x1c')](_0x1d33aa),function(_0x3a8820){return{'name':_0x3a8820,'type':_0x1d33aa[_0x3a8820]['type']};});return _0x40bb7;})[_0xdf7d('0x19')](function(_0x3f81c0){throw _0x3f81c0;});}; \ No newline at end of file +var _0x5eef=['clause','tags','skip','ids','tag','countFilteredContacts','count','User','buildContactsQuery','getFilteredContacts','rows','describe','CmContact','startsWith','cf_','map','CmCustomField','all','length','type','keys','catch','./sql-utils','../../mysqldb','findAll','resolve','then','parseAdvancedSearchFilter','search','where','default','fields','filter','user'];(function(_0x211727,_0xea1053){var _0x4fb6a3=function(_0x3f26d4){while(--_0x3f26d4){_0x211727['push'](_0x211727['shift']());}};_0x4fb6a3(++_0xea1053);}(_0x5eef,0x16a));var _0xf5ee=function(_0xcf8c66,_0x2d2da1){_0xcf8c66=_0xcf8c66-0x0;var _0x4abb00=_0x5eef[_0xcf8c66];return _0x4abb00;};'use strict';var _=require('lodash');var sqlUtils=require(_0xf5ee('0x0'));var db=require(_0xf5ee('0x1'))['db'];exports[_0xf5ee('0x2')]=function(_0x30a39e,_0x1b5166,_0x475f83,_0x424909){var _0x2b4aee={'count':0x0,'rows':[]};var _0x5b7168=sqlUtils['skipContactsQuery'](_0x1b5166,_0x30a39e);if(_0x5b7168){return Promise[_0xf5ee('0x3')](_0x2b4aee);}var _0x4302ee=sqlUtils['getContactsSubquery']();var _0x41f10c={};var _0x3eb6f5=![];var _0x1df8aa=![];return Promise[_0xf5ee('0x3')]()[_0xf5ee('0x4')](function(){if(_0x30a39e['search']){return sqlUtils[_0xf5ee('0x5')](_0x30a39e[_0xf5ee('0x6')],_0x424909);}else{return sqlUtils['parseQueryParameters'](_0x30a39e,_0x424909);}})[_0xf5ee('0x4')](function(_0xec0f1a){_0x4302ee[_0xf5ee('0x7')](_0xec0f1a[_0xf5ee('0x8')]);_0x4302ee[_0xf5ee('0x7')](_0xec0f1a[_0xf5ee('0x9')]);_0x4302ee[_0xf5ee('0x7')](_0xec0f1a[_0xf5ee('0xa')]);_0x4302ee[_0xf5ee('0x7')](_0xec0f1a[_0xf5ee('0xb')][_0xf5ee('0xc')]);_0x41f10c=_0xec0f1a[_0xf5ee('0xd')];_0x1df8aa=_0xec0f1a['user'][_0xf5ee('0xe')];return sqlUtils['checkListsRestrictions'](_0x1b5166,_0x30a39e,_0x1df8aa);})[_0xf5ee('0x4')](function(_0x17d570){_0x4302ee[_0xf5ee('0x7')](_0x17d570);var _0x458080=_0x30a39e['search']?_0x41f10c[_0xf5ee('0xf')]:_0x30a39e[_0xf5ee('0x10')];_0x3eb6f5=_0x458080?!![]:![];return sqlUtils[_0xf5ee('0x11')](_0x4302ee,_0x458080);})['then'](function(_0x465ba3){_0x2b4aee[_0xf5ee('0x12')]=_0x465ba3;if(_0x2b4aee[_0xf5ee('0x12')]===0x0){return;}if(_0x30a39e[_0xf5ee('0x13')]){_0x1df8aa=!![];}return sqlUtils[_0xf5ee('0x14')](_0x4302ee,_0x30a39e[_0xf5ee('0x9')],_0x475f83,_0x3eb6f5,_0x41f10c[_0xf5ee('0xc')],_0x1df8aa);})[_0xf5ee('0x4')](function(_0x1ae794){if(!_0x1ae794){return[];}return sqlUtils[_0xf5ee('0x15')](_0x1ae794,_0x30a39e,_0x475f83);})[_0xf5ee('0x4')](function(_0x318eb0){_0x2b4aee[_0xf5ee('0x16')]=_0x318eb0;return _0x2b4aee;})['catch'](function(_0x58444a){throw _0x58444a;});};exports[_0xf5ee('0x17')]=function(){var _0x1a9b48={};var _0xaab133=[];return db[_0xf5ee('0x18')]['describe']()[_0xf5ee('0x4')](function(_0x1b2846){_0x1a9b48=_0x1b2846;var _0x4b267d=Object['keys'](_0x1a9b48)[_0xf5ee('0xa')](function(_0x289bc4){return _[_0xf5ee('0x19')](_0x289bc4,_0xf5ee('0x1a'))?_0x289bc4:undefined;});var _0x557d46=_0x4b267d[_0xf5ee('0x1b')](function(_0x1eb9d){return db[_0xf5ee('0x1c')]['findOne']({'where':{'id':_0x1eb9d['slice'](0x3)},'raw':!![]});});return Promise[_0xf5ee('0x1d')](_0x557d46);})[_0xf5ee('0x4')](function(_0xaae6de){for(var _0x5fb2c=0x0;_0x5fb2c<_0xaae6de[_0xf5ee('0x1e')];_0x5fb2c++){if(_0xaae6de[_0x5fb2c]){var _0x54bf7c=_0xf5ee('0x1a')+_0xaae6de[_0x5fb2c]['id'];_0x1a9b48[_0x54bf7c]['fieldType']=_0xaae6de[_0x5fb2c][_0xf5ee('0x1f')];}}_0xaab133=_['map'](Object[_0xf5ee('0x20')](_0x1a9b48),function(_0x19138d){return{'name':_0x19138d,'type':_0x1a9b48[_0x19138d]['type']};});return _0xaab133;})[_0xf5ee('0x21')](function(_0x2b8d29){throw _0x2b8d29;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 4cc7939..0ee6a4a 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 _0xb5ac=['keyBy','Sequelize','SELECT','CmContact','query','Tags','COUNT(*)','c.id','isEmpty','QueryTypes','sequelize','exports','squel','../parsers/advancedSearch','../../mysqldb','role','search','autocomplete','true','select','from','cm_contacts','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','cm_contact_has_tags','ct.CmContactId\x20=\x20','.id','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','fax','ListId','createdAt','deletedAt','includes','push','forEach','TagIds','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','conditions','length','find','name','fieldType','castTo','DATE','buildExpression','default','text','value','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','keys','some','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','agent','getLists','c.ListId\x20IS\x20NULL','map','attributes','group','limit','offset','subqry.id','having','order','subqry.','DESC','color'];(function(_0x236862,_0x571782){var _0x146859=function(_0x20934e){while(--_0x20934e){_0x236862['push'](_0x236862['shift']());}};_0x146859(++_0x571782);}(_0xb5ac,0x76));var _0xcb5a=function(_0x3c5570,_0x113167){_0x3c5570=_0x3c5570-0x0;var _0x2edae8=_0xb5ac[_0x3c5570];return _0x2edae8;};'use strict';var _=require('lodash');var squel=require(_0xcb5a('0x0'));var as=require(_0xcb5a('0x1'));var qs=require('../parsers/qs');var utils=require('../interaction/utils');var db=require(_0xcb5a('0x2'))['db'];function skipContactsQuery(_0x3ff3b1,_0x201c20){var _0xbff35b=![];if(_0x3ff3b1[_0xcb5a('0x3')]==='agent'&&!_0x201c20[_0xcb5a('0x4')]&&!_0x201c20['ListId']&&_0x201c20[_0xcb5a('0x5')]!==_0xcb5a('0x6')){_0xbff35b=!![];}return _0xbff35b;}function getContactsSubquery(){return squel[_0xcb5a('0x7')]()[_0xcb5a('0x8')](_0xcb5a('0x9'),'c')['where'](_0xcb5a('0xa'));}function applyJoinClauses(_0xe4faba,_0x3cee7e){var _0xea119d=_0x3cee7e?'c':_0xcb5a('0xb');_0xe4faba[_0xcb5a('0xc')](_0xcb5a('0xd'),'uc',_0xcb5a('0xe')+_0xea119d+'.id')[_0xcb5a('0xc')](_0xcb5a('0xf'),'ct',_0xcb5a('0x10')+_0xea119d+_0xcb5a('0x11'))[_0xcb5a('0xc')](_0xcb5a('0x12'),'t',_0xcb5a('0x13'));return _0xe4faba;}function addFieldsToQuery(_0x2fba82,_0x277da6,_0x350fb7,_0x115a85,_0x3de582){var _0x56fbb1=_0x3de582?'c':'subqry';if(!_0x277da6){_0x277da6=['id',_0xcb5a('0x14'),_0xcb5a('0x15'),_0xcb5a('0x16'),_0xcb5a('0x17'),_0xcb5a('0x18'),'email',_0xcb5a('0x19'),'CompanyId',_0xcb5a('0x1a'),'updatedAt',_0xcb5a('0x1b'),'TagIds'];}else if(!_0x277da6[_0xcb5a('0x1c')]('id')){_0x277da6[_0xcb5a('0x1d')]('id');}var _0x479fc9=_0x350fb7&&_0x3de582||!_0x350fb7&&!_0x3de582;if(_0x115a85){_0x479fc9=_0x115a85&&_0x3de582||!_0x115a85&&!_0x3de582;}_0x277da6[_0xcb5a('0x1e')](function(_0x2a0af2){if(_0x2a0af2===_0xcb5a('0x1f')){if(_0x479fc9){_0x2fba82['field'](_0xcb5a('0x20'),_0x2a0af2);}else if(_0x350fb7||_0x115a85){_0x2fba82[_0xcb5a('0x21')](_0x56fbb1+'.'+_0x2a0af2);}}else{_0x2fba82['field'](_0x56fbb1+'.'+_0x2a0af2);}});return _0x2fba82;}function getSqlClauses(){var _0xa0df69={'default':squel['expr'](),'fields':squel[_0xcb5a('0x22')](),'filter':squel[_0xcb5a('0x22')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0xcb5a('0x22')](),'skip':![]}};return _0xa0df69;}function parseTagParameter(_0x229023){var _0x438e90=squel['expr']();if(_0x229023){var _0x11d0b5=utils[_0xcb5a('0x23')](_0x229023);_0x11d0b5[_0xcb5a('0x1e')](function(_0xa6547b){_0x438e90['or'](_0xcb5a('0x24'),'%,'+_0xa6547b+',%');});}return _0x438e90;}function parseSearchFilter(_0x3e94f4){var _0x3c1f46=squel[_0xcb5a('0x22')]();if(_0x3e94f4){var _0x1d3ff8=_0x3e94f4[_0xcb5a('0x25')]('\x5c','\x5c\x5c')[_0xcb5a('0x25')](/'/g,'\x27\x27');if(_0x1d3ff8[_0xcb5a('0x26')]('\x20')['length']>0x1){_0x3c1f46['or'](_0xcb5a('0x27'),qs[_0xcb5a('0x28')](_0x1d3ff8,!![]),null);}else{if(qs[_0xcb5a('0x29')](_0x1d3ff8)){_0x3c1f46['or'](_0xcb5a('0x2a'),_0x1d3ff8+'%');_0x3c1f46['or'](_0xcb5a('0x2b'),_0x1d3ff8+'%');_0x3c1f46['or']('c.mobile\x20LIKE\x20?',_0x1d3ff8+'%');_0x3c1f46['or'](_0xcb5a('0x2c'),_0x1d3ff8+'%');}else if(qs['isEmail'](_0x1d3ff8)){_0x3c1f46['or'](_0xcb5a('0x2d'),_0x1d3ff8+'%');}else{_0x3c1f46['or'](_0xcb5a('0x2e'),'%'+_0x1d3ff8+'%');_0x3c1f46['or'](_0xcb5a('0x2f'),'%'+_0x1d3ff8+'%');_0x3c1f46['or'](_0xcb5a('0x2d'),'%'+_0x1d3ff8+'%');}}}return _0x3c1f46;}function parseAdvancedSearchFilter(_0x430d1c,_0x3d464){var _0x1fe07d=getSqlClauses();var _0x35d187=as[_0xcb5a('0x30')](_0x430d1c);var _0x4d5acd=_0x35d187['sqlOperator'];for(var _0x1aa6f4=0x0;_0x1aa6f4<_0x35d187[_0xcb5a('0x31')][_0xcb5a('0x32')];_0x1aa6f4++){var _0x2eee3c=_0x35d187['conditions'][_0x1aa6f4];var _0x25ebda='c';var _0x3425af=_[_0xcb5a('0x33')](_0x3d464,[_0xcb5a('0x34'),_0x2eee3c[_0xcb5a('0x21')]]);if(_0x3425af){if(_0x2eee3c[_0xcb5a('0x21')]==='dateOfBirth'||_0x3425af[_0xcb5a('0x35')]==='datetime'){_0x2eee3c[_0xcb5a('0x36')]=_0xcb5a('0x37');}var _0x358e9d=as[_0xcb5a('0x38')](_0x25ebda,_0x3425af['type'],_0x2eee3c);_0x1fe07d[_0xcb5a('0x39')][_0x4d5acd](_0x358e9d[_0xcb5a('0x3a')],_0x358e9d[_0xcb5a('0x3b')]['start'],_0x358e9d[_0xcb5a('0x3b')]['end']);}else{if(_0x2eee3c['field']==='Tag'){var _0x4c75b3=_0x2eee3c[_0xcb5a('0x3b')]['split'](',')['map'](function(_0x3dd12b){return Number(_0x3dd12b);});var _0x41d9f3=parseTagParameter(_0x4c75b3);_0x1fe07d[_0xcb5a('0x3c')][_0xcb5a('0x3d')][_0xcb5a('0x3e')](_0x41d9f3);_0x1fe07d[_0xcb5a('0x3c')][_0xcb5a('0x3f')]=_0x4c75b3;}else if(_0x2eee3c[_0xcb5a('0x21')]===_0xcb5a('0x40')){_0x1fe07d[_0xcb5a('0x41')][_0xcb5a('0x3d')][_0xcb5a('0x3e')](_0xcb5a('0x42'),_0x2eee3c['value']);_0x1fe07d['user'][_0xcb5a('0x43')]=!![];}}}return _0x1fe07d;}function parseModelFields(_0x4e051f,_0x41b820){var _0x4e9f7e=squel['expr']();var _0x230126=_(_0x4e051f)[_0xcb5a('0x44')]()['map'](function(_0x1d69f0){return _[_0xcb5a('0x45')](_0x41b820,[_0xcb5a('0x34'),_0x1d69f0])?_0x1d69f0:undefined;})['compact']()['value']();if(_0x4e051f['Contact']){_0x230126[_0xcb5a('0x1d')](_0xcb5a('0x46'));}if(_0x4e051f[_0xcb5a('0x40')]){_0x230126[_0xcb5a('0x1d')](_0xcb5a('0x40'));}if(_0x230126[_0xcb5a('0x32')]>0x0){_0x230126[_0xcb5a('0x1e')](function(_0x3b1a7a){if(_0x3b1a7a===_0xcb5a('0x19')){_0x4e9f7e[_0xcb5a('0x3e')](_0xcb5a('0x47'),[][_0xcb5a('0x48')](_0x4e051f[_0x3b1a7a]));}else if(_0x3b1a7a==='Contact'){var _0x4c65e3='%'+_0x4e051f[_0x3b1a7a]+'%';_0x4e9f7e['and'](_0xcb5a('0x49'),_0x4c65e3);}else if(_0x3b1a7a===_0xcb5a('0x40')){_0x4e9f7e[_0xcb5a('0x3e')](_0xcb5a('0x42'),_0x4e051f[_0x3b1a7a]);}else{_0x4e9f7e[_0xcb5a('0x3e')]('c.'+_0x3b1a7a+_0xcb5a('0x4a'),_0x4e051f[_0x3b1a7a]);}});}return _0x4e9f7e;}function parseQueryParameters(_0x410531,_0x576663){var _0xfaf763=getSqlClauses();return Promise[_0xcb5a('0x4b')]()[_0xcb5a('0x4c')](function(){return parseModelFields(_0x410531,_0x576663);})[_0xcb5a('0x4c')](function(_0x2fe897){_0xfaf763[_0xcb5a('0x4d')][_0xcb5a('0x3e')](_0x2fe897);return parseTagParameter(_0x410531[_0xcb5a('0x4e')]);})[_0xcb5a('0x4c')](function(_0x262b6a){_0xfaf763[_0xcb5a('0x3c')][_0xcb5a('0x3d')][_0xcb5a('0x3e')](_0x262b6a);return parseSearchFilter(_0x410531[_0xcb5a('0x4f')]);})[_0xcb5a('0x4c')](function(_0x3303cc){_0xfaf763['filter']=_0x3303cc;return _0xfaf763;});}function checkListsRestrictions(_0x49ded2,_0x3fb78a,_0x45ee85){var _0x2d9b65=squel[_0xcb5a('0x22')]();return Promise[_0xcb5a('0x4b')]()[_0xcb5a('0x4c')](function(){if(_0x3fb78a[_0xcb5a('0x4')]&&_0x49ded2[_0xcb5a('0x3')]===_0xcb5a('0x50')&&!_0x45ee85){return _0x49ded2[_0xcb5a('0x51')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x3f79e0){if(_0x3f79e0){if(_0x3f79e0[_0xcb5a('0x32')]===0x0){_0x2d9b65[_0xcb5a('0x3e')](_0xcb5a('0x52'));}else{_0x2d9b65[_0xcb5a('0x3e')]('c.ListId\x20IN\x20?',_[_0xcb5a('0x53')](_0x3f79e0,'id'));}}})[_0xcb5a('0x4c')](function(){return _0x2d9b65;});}function buildContactsQuery(_0x5888f0,_0x45a4e2,_0x472e4a,_0x319627,_0x2ff00b,_0x4703db){if(_0x45a4e2){_0x45a4e2=_0x472e4a[_0xcb5a('0x54')];}_0x5888f0=addFieldsToQuery(_0x5888f0,_0x45a4e2,_0x319627,_0x4703db,!![]);var _0x1dfe06=squel[_0xcb5a('0x7')]();_0x1dfe06=addFieldsToQuery(_0x1dfe06,_0x45a4e2,_0x319627,_0x4703db,![]);if(_0x319627||_0x4703db){_0x5888f0=applyJoinClauses(_0x5888f0,!![]);_0x5888f0[_0xcb5a('0x55')]('c.id');if(_0x472e4a[_0xcb5a('0x56')]){_0x1dfe06[_0xcb5a('0x56')](_0x472e4a[_0xcb5a('0x56')]);}if(_0x472e4a[_0xcb5a('0x57')]){_0x1dfe06['offset'](_0x472e4a['offset']);}}else{_0x1dfe06=applyJoinClauses(_0x1dfe06,![]);_0x1dfe06['group'](_0xcb5a('0x58'));if(_0x472e4a[_0xcb5a('0x56')]){_0x5888f0[_0xcb5a('0x56')](_0x472e4a[_0xcb5a('0x56')]);}if(_0x472e4a['offset']){_0x5888f0[_0xcb5a('0x57')](_0x472e4a[_0xcb5a('0x57')]);}}_0x1dfe06[_0xcb5a('0x59')](_0x2ff00b);if(_0x472e4a[_0xcb5a('0x5a')]){_0x472e4a[_0xcb5a('0x5a')][_0xcb5a('0x1e')](function(_0x3493d7){_0x5888f0[_0xcb5a('0x5a')]('c.'+_0x3493d7[0x0],_0x3493d7[0x1]==='DESC'?![]:!![]);_0x1dfe06[_0xcb5a('0x5a')](_0xcb5a('0x5b')+_0x3493d7[0x0],_0x3493d7[0x1]===_0xcb5a('0x5c')?![]:!![]);});}_0x1dfe06[_0xcb5a('0x8')](_0x5888f0,_0xcb5a('0xb'));return _0x1dfe06;}function getFilteredContacts(_0x56742b){var _0x516305=[];return db['Tag']['findAll']({'attributes':['id','name',_0xcb5a('0x5d')],'raw':!![]})[_0xcb5a('0x4c')](function(_0x17a143){_0x516305=_[_0xcb5a('0x5e')](_0x17a143,'id');var _0x2e139c={'type':db[_0xcb5a('0x5f')]['QueryTypes'][_0xcb5a('0x60')],'model':db[_0xcb5a('0x61')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0xcb5a('0x62')](_0x56742b['toString'](),_0x2e139c);})[_0xcb5a('0x4c')](function(_0x42e154){_0x42e154[_0xcb5a('0x1e')](function(_0x861ea){if(_0x861ea['TagIds']){_0x861ea[_0xcb5a('0x63')]=[];_0x861ea[_0xcb5a('0x1f')][_0xcb5a('0x26')](',')[_0xcb5a('0x1e')](function(_0x18b837){_0x861ea['Tags'][_0xcb5a('0x1d')](_0x516305[_0x18b837]);});}delete _0x861ea[_0xcb5a('0x1f')];});return _0x42e154;});}function countFilteredContacts(_0x3d7435,_0x118402){var _0x543555=_0x3d7435['clone']();_0x543555['field'](_0xcb5a('0x64'));_0x543555=applyJoinClauses(_0x543555,!![]);_0x3d7435['group'](_0xcb5a('0x65'));var _0x39f23c=utils[_0xcb5a('0x23')](_0x118402);if(!_[_0xcb5a('0x66')](_0x39f23c)){_0x543555['where']('t.id\x20IN\x20?',_0x39f23c);}var _0x20078c={'type':db[_0xcb5a('0x5f')][_0xcb5a('0x67')][_0xcb5a('0x60')],'raw':!![]};return db[_0xcb5a('0x68')]['query'](_0x543555['toString'](),_0x20078c)['then'](function(_0x2e1cc6){return _0x2e1cc6[0x0][_0xcb5a('0x64')];});}module[_0xcb5a('0x69')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xe751=['where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','cm_contact_has_tags','ct.CmContactId\x20=\x20','.id','tools_tags','t.id\x20=\x20ct.TagId','lastName','phone','mobile','fax','email','createdAt','updatedAt','push','TagIds','field','expr','getSelectedTags','forEach','replace','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','name','fieldType','datetime','castTo','DATE','buildExpression','type','text','value','Tag','split','map','tags','and','ids','User','user','keys','some','compact','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','uc.UserId\x20=\x20?','\x20=\x20?','then','fields','tag','clause','filter','resolve','agent','getLists','c.ListId\x20IS\x20NULL','select','group','c.id','limit','offset','subqry.id','order','DESC','findAll','keyBy','Sequelize','QueryTypes','CmContact','sequelize','query','toString','Tags','clone','COUNT(*)','t.id\x20IN\x20?','exports','search','ListId','autocomplete','true','from','cm_contacts'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe751,0x1ee));var _0x1e75=function(_0xfd67d6,_0x26d785){_0xfd67d6=_0xfd67d6-0x0;var _0x469b16=_0xe751[_0xfd67d6];return _0x469b16;};'use strict';var _=require('lodash');var squel=require('squel');var as=require('../parsers/advancedSearch');var qs=require('../parsers/qs');var utils=require('../interaction/utils');var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x14187a,_0x4da82e){var _0x56aed0=![];if(_0x14187a['role']==='agent'&&!_0x4da82e[_0x1e75('0x0')]&&!_0x4da82e[_0x1e75('0x1')]&&_0x4da82e[_0x1e75('0x2')]!==_0x1e75('0x3')){_0x56aed0=!![];}return _0x56aed0;}function getContactsSubquery(){return squel['select']()[_0x1e75('0x4')](_0x1e75('0x5'),'c')[_0x1e75('0x6')](_0x1e75('0x7'));}function applyJoinClauses(_0x40cd2b,_0x38b229){var _0x25b766=_0x38b229?'c':_0x1e75('0x8');_0x40cd2b[_0x1e75('0x9')](_0x1e75('0xa'),'uc',_0x1e75('0xb')+_0x25b766+'.id')['left_join'](_0x1e75('0xc'),'ct',_0x1e75('0xd')+_0x25b766+_0x1e75('0xe'))['left_join'](_0x1e75('0xf'),'t',_0x1e75('0x10'));return _0x40cd2b;}function addFieldsToQuery(_0x41aea3,_0xf08f4c,_0x58b5fb,_0x51ace8,_0x443b77){var _0x51cb36=_0x443b77?'c':_0x1e75('0x8');if(!_0xf08f4c){_0xf08f4c=['id','firstName',_0x1e75('0x11'),_0x1e75('0x12'),_0x1e75('0x13'),_0x1e75('0x14'),_0x1e75('0x15'),'ListId','CompanyId',_0x1e75('0x16'),_0x1e75('0x17'),'deletedAt','TagIds'];}else if(!_0xf08f4c['includes']('id')){_0xf08f4c[_0x1e75('0x18')]('id');}var _0x3b418d=_0x58b5fb&&_0x443b77||!_0x58b5fb&&!_0x443b77;if(_0x51ace8){_0x3b418d=_0x51ace8&&_0x443b77||!_0x51ace8&&!_0x443b77;}_0xf08f4c['forEach'](function(_0x2ef91f){if(_0x2ef91f===_0x1e75('0x19')){if(_0x3b418d){_0x41aea3[_0x1e75('0x1a')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x2ef91f);}else if(_0x58b5fb||_0x51ace8){_0x41aea3[_0x1e75('0x1a')](_0x51cb36+'.'+_0x2ef91f);}}else{_0x41aea3[_0x1e75('0x1a')](_0x51cb36+'.'+_0x2ef91f);}});return _0x41aea3;}function getSqlClauses(){var _0x25d536={'default':squel[_0x1e75('0x1b')](),'fields':squel[_0x1e75('0x1b')](),'filter':squel[_0x1e75('0x1b')](),'tags':{'clause':squel[_0x1e75('0x1b')](),'ids':null},'user':{'clause':squel[_0x1e75('0x1b')](),'skip':![]}};return _0x25d536;}function parseTagParameter(_0x1e9790){var _0x647244=squel['expr']();if(_0x1e9790){var _0x58dce3=utils[_0x1e75('0x1c')](_0x1e9790);_0x58dce3[_0x1e75('0x1d')](function(_0x36465c){_0x647244['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x36465c+',%');});}return _0x647244;}function parseSearchFilter(_0x5072f3){var _0x3fc4d9=squel[_0x1e75('0x1b')]();if(_0x5072f3){var _0x42c220=_0x5072f3['replace']('\x5c','\x5c\x5c')[_0x1e75('0x1e')](/'/g,'\x27\x27');if(_0x42c220['split']('\x20')[_0x1e75('0x1f')]>0x1){_0x3fc4d9['or'](_0x1e75('0x20'),qs[_0x1e75('0x21')](_0x42c220,!![]),null);}else{if(qs[_0x1e75('0x22')](_0x42c220)){_0x3fc4d9['or']('c.id\x20LIKE\x20?',_0x42c220+'%');_0x3fc4d9['or'](_0x1e75('0x23'),_0x42c220+'%');_0x3fc4d9['or'](_0x1e75('0x24'),_0x42c220+'%');_0x3fc4d9['or'](_0x1e75('0x25'),_0x42c220+'%');}else if(qs[_0x1e75('0x26')](_0x42c220)){_0x3fc4d9['or'](_0x1e75('0x27'),_0x42c220+'%');}else{_0x3fc4d9['or']('c.firstName\x20LIKE\x20?','%'+_0x42c220+'%');_0x3fc4d9['or'](_0x1e75('0x28'),'%'+_0x42c220+'%');_0x3fc4d9['or'](_0x1e75('0x27'),'%'+_0x42c220+'%');}}}return _0x3fc4d9;}function parseAdvancedSearchFilter(_0x10f690,_0x1941ae){var _0x36d903=getSqlClauses();var _0x5a7f30=as[_0x1e75('0x29')](_0x10f690);var _0x2758dc=_0x5a7f30[_0x1e75('0x2a')];for(var _0x474056=0x0;_0x474056<_0x5a7f30[_0x1e75('0x2b')][_0x1e75('0x1f')];_0x474056++){var _0x44ed98=_0x5a7f30[_0x1e75('0x2b')][_0x474056];var _0x3294ea='c';var _0x99e91a=_['find'](_0x1941ae,[_0x1e75('0x2c'),_0x44ed98['field']]);if(_0x99e91a){if(_0x44ed98[_0x1e75('0x1a')]==='dateOfBirth'||_0x99e91a[_0x1e75('0x2d')]===_0x1e75('0x2e')){_0x44ed98[_0x1e75('0x2f')]=_0x1e75('0x30');}var _0x555208=as[_0x1e75('0x31')](_0x3294ea,_0x99e91a[_0x1e75('0x32')],_0x44ed98);_0x36d903['default'][_0x2758dc](_0x555208[_0x1e75('0x33')],_0x555208[_0x1e75('0x34')]['start'],_0x555208[_0x1e75('0x34')]['end']);}else{if(_0x44ed98[_0x1e75('0x1a')]===_0x1e75('0x35')){var _0x21456b=_0x44ed98[_0x1e75('0x34')][_0x1e75('0x36')](',')[_0x1e75('0x37')](function(_0x492e3a){return Number(_0x492e3a);});var _0x15a49c=parseTagParameter(_0x21456b);_0x36d903[_0x1e75('0x38')]['clause'][_0x1e75('0x39')](_0x15a49c);_0x36d903[_0x1e75('0x38')][_0x1e75('0x3a')]=_0x21456b;}else if(_0x44ed98[_0x1e75('0x1a')]===_0x1e75('0x3b')){_0x36d903[_0x1e75('0x3c')]['clause']['and']('uc.UserId\x20=\x20?',_0x44ed98[_0x1e75('0x34')]);_0x36d903['user']['skip']=!![];}}}return _0x36d903;}function parseModelFields(_0x29d70a,_0x46632e){var _0x43c6a3=squel[_0x1e75('0x1b')]();var _0x2dc060=_(_0x29d70a)[_0x1e75('0x3d')]()[_0x1e75('0x37')](function(_0x29b701){return _[_0x1e75('0x3e')](_0x46632e,['name',_0x29b701])?_0x29b701:undefined;})[_0x1e75('0x3f')]()[_0x1e75('0x34')]();if(_0x29d70a[_0x1e75('0x40')]){_0x2dc060[_0x1e75('0x18')](_0x1e75('0x40'));}if(_0x29d70a[_0x1e75('0x3b')]){_0x2dc060[_0x1e75('0x18')]('User');}if(_0x2dc060[_0x1e75('0x1f')]>0x0){_0x2dc060[_0x1e75('0x1d')](function(_0x1f2225){if(_0x1f2225===_0x1e75('0x1')){_0x43c6a3[_0x1e75('0x39')](_0x1e75('0x41'),[][_0x1e75('0x42')](_0x29d70a[_0x1f2225]));}else if(_0x1f2225===_0x1e75('0x40')){var _0x469340='%'+_0x29d70a[_0x1f2225]+'%';_0x43c6a3['and'](_0x1e75('0x43'),_0x469340);}else if(_0x1f2225===_0x1e75('0x3b')){_0x43c6a3[_0x1e75('0x39')](_0x1e75('0x44'),_0x29d70a[_0x1f2225]);}else{_0x43c6a3[_0x1e75('0x39')]('c.'+_0x1f2225+_0x1e75('0x45'),_0x29d70a[_0x1f2225]);}});}return _0x43c6a3;}function parseQueryParameters(_0xbc054b,_0x5034e6){var _0x232e97=getSqlClauses();return Promise['resolve']()[_0x1e75('0x46')](function(){return parseModelFields(_0xbc054b,_0x5034e6);})[_0x1e75('0x46')](function(_0x359213){_0x232e97[_0x1e75('0x47')]['and'](_0x359213);return parseTagParameter(_0xbc054b[_0x1e75('0x48')]);})[_0x1e75('0x46')](function(_0x4af3dc){_0x232e97[_0x1e75('0x38')][_0x1e75('0x49')][_0x1e75('0x39')](_0x4af3dc);return parseSearchFilter(_0xbc054b[_0x1e75('0x4a')]);})['then'](function(_0x497e7b){_0x232e97[_0x1e75('0x4a')]=_0x497e7b;return _0x232e97;});}function checkListsRestrictions(_0x13f26e,_0x14fd95,_0x2678f0){var _0x3d534e=squel[_0x1e75('0x1b')]();return Promise[_0x1e75('0x4b')]()[_0x1e75('0x46')](function(){if(_0x14fd95['search']&&_0x13f26e['role']===_0x1e75('0x4c')&&!_0x2678f0){return _0x13f26e[_0x1e75('0x4d')]({'attributes':['id'],'raw':!![]});}})[_0x1e75('0x46')](function(_0x57bd26){if(_0x57bd26){if(_0x57bd26['length']===0x0){_0x3d534e['and'](_0x1e75('0x4e'));}else{_0x3d534e[_0x1e75('0x39')]('c.ListId\x20IN\x20?',_['map'](_0x57bd26,'id'));}}})[_0x1e75('0x46')](function(){return _0x3d534e;});}function buildContactsQuery(_0x1a116b,_0x181b34,_0x4d2104,_0x15a42c,_0x5b16ff,_0xf4374a){if(_0x181b34){_0x181b34=_0x4d2104['attributes'];}_0x1a116b=addFieldsToQuery(_0x1a116b,_0x181b34,_0x15a42c,_0xf4374a,!![]);var _0x230566=squel[_0x1e75('0x4f')]();_0x230566=addFieldsToQuery(_0x230566,_0x181b34,_0x15a42c,_0xf4374a,![]);if(_0x15a42c||_0xf4374a){_0x1a116b=applyJoinClauses(_0x1a116b,!![]);_0x1a116b[_0x1e75('0x50')](_0x1e75('0x51'));if(_0x4d2104['limit']){_0x230566[_0x1e75('0x52')](_0x4d2104[_0x1e75('0x52')]);}if(_0x4d2104['offset']){_0x230566[_0x1e75('0x53')](_0x4d2104[_0x1e75('0x53')]);}}else{_0x230566=applyJoinClauses(_0x230566,![]);_0x230566[_0x1e75('0x50')](_0x1e75('0x54'));if(_0x4d2104[_0x1e75('0x52')]){_0x1a116b[_0x1e75('0x52')](_0x4d2104[_0x1e75('0x52')]);}if(_0x4d2104[_0x1e75('0x53')]){_0x1a116b[_0x1e75('0x53')](_0x4d2104['offset']);}}_0x230566['having'](_0x5b16ff);if(_0x4d2104[_0x1e75('0x55')]){_0x4d2104[_0x1e75('0x55')][_0x1e75('0x1d')](function(_0x56d225){_0x1a116b['order']('c.'+_0x56d225[0x0],_0x56d225[0x1]===_0x1e75('0x56')?![]:!![]);_0x230566[_0x1e75('0x55')]('subqry.'+_0x56d225[0x0],_0x56d225[0x1]===_0x1e75('0x56')?![]:!![]);});}_0x230566[_0x1e75('0x4')](_0x1a116b,_0x1e75('0x8'));return _0x230566;}function getFilteredContacts(_0x434be3){var _0x5d77ff=[];return db['Tag'][_0x1e75('0x57')]({'attributes':['id','name','color'],'raw':!![]})[_0x1e75('0x46')](function(_0x17328a){_0x5d77ff=_[_0x1e75('0x58')](_0x17328a,'id');var _0x2b83fc={'type':db[_0x1e75('0x59')][_0x1e75('0x5a')]['SELECT'],'model':db[_0x1e75('0x5b')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x1e75('0x5c')][_0x1e75('0x5d')](_0x434be3[_0x1e75('0x5e')](),_0x2b83fc);})[_0x1e75('0x46')](function(_0x3bb6f3){_0x3bb6f3[_0x1e75('0x1d')](function(_0x3ecae0){if(_0x3ecae0[_0x1e75('0x19')]){_0x3ecae0['Tags']=[];_0x3ecae0[_0x1e75('0x19')][_0x1e75('0x36')](',')[_0x1e75('0x1d')](function(_0x3c3e6d){_0x3ecae0[_0x1e75('0x5f')][_0x1e75('0x18')](_0x5d77ff[_0x3c3e6d]);});}delete _0x3ecae0[_0x1e75('0x19')];});return _0x3bb6f3;});}function countFilteredContacts(_0x4d4be6,_0x2517cd){var _0x576049=_0x4d4be6[_0x1e75('0x60')]();_0x576049['field'](_0x1e75('0x61'));_0x576049=applyJoinClauses(_0x576049,!![]);_0x4d4be6[_0x1e75('0x50')](_0x1e75('0x51'));var _0x21f3cc=utils[_0x1e75('0x1c')](_0x2517cd);if(!_['isEmpty'](_0x21f3cc)){_0x576049[_0x1e75('0x6')](_0x1e75('0x62'),_0x21f3cc);}var _0x4460e8={'type':db['Sequelize'][_0x1e75('0x5a')]['SELECT'],'raw':!![]};return db[_0x1e75('0x5c')][_0x1e75('0x5d')](_0x576049[_0x1e75('0x5e')](),_0x4460e8)[_0x1e75('0x46')](function(_0x3f67c5){return _0x3f67c5[0x0][_0x1e75('0x61')];});}module[_0x1e75('0x63')]={'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 12fc32b..156ca15 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 _0x2fb0=['aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','hasOwnProperty','encryptFile','createReadStream','createCipher','data','update','write','end','final','binary','close','unlink','createWriteStream','encryptString','secret','utf8','base64','decryptString','createDecipher','bluebird','lodash','../../config/environment','../../config/logger','session','aes-256-ctr'];(function(_0x189c9e,_0x1c3b55){var _0x3f38ca=function(_0x4c05ec){while(--_0x4c05ec){_0x189c9e['push'](_0x189c9e['shift']());}};_0x3f38ca(++_0x1c3b55);}(_0x2fb0,0x192));var _0x02fb=function(_0x12aa2d,_0x352204){_0x12aa2d=_0x12aa2d-0x0;var _0x45a2e3=_0x2fb0[_0x12aa2d];return _0x45a2e3;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x02fb('0x0'));var _=require(_0x02fb('0x1'));var config=require(_0x02fb('0x2'));var logger=require(_0x02fb('0x3'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x02fb('0x4')],'algorithm':_0x02fb('0x5')};const fileOptions={'algorithm':_0x02fb('0x6')};if(config[_0x02fb('0x7')]&&config[_0x02fb('0x7')][_0x02fb('0x8')]){var isSupported=isAlgorithmSupported(config[_0x02fb('0x7')][_0x02fb('0x8')]);if(isSupported){fileOptions[_0x02fb('0x8')]=config[_0x02fb('0x7')][_0x02fb('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x02fb('0x9')](',\x20');logger[_0x02fb('0xa')](config[_0x02fb('0x7')][_0x02fb('0x8')],_0x02fb('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x37d367){return AES_SUPPORTED_RX[_0x02fb('0xc')](_0x37d367);}function getSupportedCiphers(){return crypto[_0x02fb('0xd')]()[_0x02fb('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x5533e3){return getSupportedCiphers()['indexOf'](_0x5533e3)>-0x1;}function combineOptions(_0x34c388){var _0x254eb1={};for(var _0x4cfad9 in fileOptions){if(fileOptions[_0x02fb('0xf')](_0x4cfad9)){_0x254eb1[_0x4cfad9]=fileOptions[_0x4cfad9];}}if(_0x34c388){for(var _0x2bb421 in _0x34c388){if(_0x34c388['hasOwnProperty'](_0x2bb421)){_0x254eb1[_0x2bb421]=_0x34c388[_0x2bb421];}}}return _0x254eb1;}exports[_0x02fb('0x10')]=function(_0x38116e,_0x5e6b6e,_0x26c37c,_0x373e56){return new BPromise(function(_0x3b3cdc,_0x5c3dc1){_0x373e56=combineOptions(_0x373e56);var _0x392e72=new Buffer(_0x26c37c);var _0x3a86d6=fs[_0x02fb('0x11')](_0x38116e);var _0x2929e1=fs['createWriteStream'](_0x5e6b6e);var _0x115b28=crypto[_0x02fb('0x12')](_0x373e56['algorithm'],_0x392e72);_0x3a86d6['on'](_0x02fb('0x13'),function(_0x22f090){var _0x258de8=new Buffer(_0x115b28[_0x02fb('0x14')](_0x22f090),'binary');_0x2929e1[_0x02fb('0x15')](_0x258de8);});_0x3a86d6['on'](_0x02fb('0x16'),function(){try{var _0xb0e8ba=new Buffer(_0x115b28[_0x02fb('0x17')](_0x02fb('0x18')),_0x02fb('0x18'));_0x2929e1['write'](_0xb0e8ba);_0x2929e1[_0x02fb('0x16')]();_0x2929e1['on'](_0x02fb('0x19'),function(){return _0x3b3cdc(_0x5e6b6e);});}catch(_0x3e7b3a){fs[_0x02fb('0x1a')](_0x5e6b6e);return _0x5c3dc1(_0x3e7b3a);}});});};exports['decryptFile']=function(_0x5b07f2,_0x2f074f,_0x362c21,_0x5b2e27){return new BPromise(function(_0x52b1ca,_0x433d5a){_0x5b2e27=combineOptions(_0x5b2e27);var _0x484d7c=new Buffer(_0x362c21);var _0x38ea25=fs[_0x02fb('0x11')](_0x5b07f2);var _0x1e0fc7=fs[_0x02fb('0x1b')](_0x2f074f);var _0x4dee77=crypto['createDecipher'](_0x5b2e27[_0x02fb('0x8')],_0x484d7c);_0x38ea25['on'](_0x02fb('0x13'),function(_0x1caad6){var _0x5142c3=new Buffer(_0x4dee77['update'](_0x1caad6),_0x02fb('0x18'));_0x1e0fc7[_0x02fb('0x15')](_0x5142c3);});_0x38ea25['on'](_0x02fb('0x16'),function(){try{var _0x1caf81=new Buffer(_0x4dee77['final']('binary'),_0x02fb('0x18'));_0x1e0fc7[_0x02fb('0x15')](_0x1caf81);_0x1e0fc7[_0x02fb('0x16')]();_0x1e0fc7['on']('close',function(){return _0x52b1ca(_0x2f074f);});}catch(_0x421071){fs[_0x02fb('0x1a')](_0x2f074f);return _0x433d5a(_0x421071);}});});};exports[_0x02fb('0x1c')]=function(_0x3c0c07,_0x1095a9,_0x46e711){var _0x83e8d7=_0x46e711||stringOptions['algorithm'];var _0x29f06d=_0x1095a9||stringOptions[_0x02fb('0x1d')];var _0x3eee42=crypto[_0x02fb('0x12')](_0x83e8d7,_0x29f06d);var _0x2c8ccf=_0x3eee42['update'](_0x3c0c07,_0x02fb('0x1e'),_0x02fb('0x1f'));_0x2c8ccf+=_0x3eee42[_0x02fb('0x17')](_0x02fb('0x1f'));return _0x2c8ccf;};exports[_0x02fb('0x20')]=function(_0x4c959d,_0x10ef1e,_0x4e6120){var _0x3c6f14=_0x4e6120||stringOptions[_0x02fb('0x8')];var _0x37694e=_0x10ef1e||stringOptions[_0x02fb('0x1d')];var _0x5687a0=crypto[_0x02fb('0x21')](_0x3c6f14,_0x37694e);var _0x3b2fe2=_0x5687a0[_0x02fb('0x14')](_0x4c959d,_0x02fb('0x1f'),'utf8');_0x3b2fe2+=_0x5687a0['final']('utf8');return _0x3b2fe2;}; \ No newline at end of file +var _0xd7c8=['is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','indexOf','hasOwnProperty','encryptFile','createWriteStream','createCipher','data','write','end','final','binary','close','unlink','decryptFile','createReadStream','createDecipher','encryptString','secret','utf8','decryptString','crypto','lodash','../../config/environment','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error'];(function(_0x11b4fb,_0x10c784){var _0x56cbb5=function(_0x56d812){while(--_0x56d812){_0x11b4fb['push'](_0x11b4fb['shift']());}};_0x56cbb5(++_0x10c784);}(_0xd7c8,0x1d0));var _0x8d7c=function(_0x280692,_0x54cf20){_0x280692=_0x280692-0x0;var _0x16dc38=_0xd7c8[_0x280692];return _0x16dc38;};'use strict';var crypto=require(_0x8d7c('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x8d7c('0x1'));var config=require(_0x8d7c('0x2'));var logger=require('../../config/logger')(_0x8d7c('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x8d7c('0x4')][_0x8d7c('0x5')],'algorithm':_0x8d7c('0x6')};const fileOptions={'algorithm':_0x8d7c('0x7')};if(config[_0x8d7c('0x8')]&&config[_0x8d7c('0x8')][_0x8d7c('0x9')]){var isSupported=isAlgorithmSupported(config[_0x8d7c('0x8')][_0x8d7c('0x9')]);if(isSupported){fileOptions['algorithm']=config[_0x8d7c('0x8')][_0x8d7c('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x8d7c('0xa')](',\x20');logger[_0x8d7c('0xb')](config['encrypt'][_0x8d7c('0x9')],_0x8d7c('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x5594ac){return AES_SUPPORTED_RX[_0x8d7c('0xd')](_0x5594ac);}function getSupportedCiphers(){return crypto[_0x8d7c('0xe')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x1db19d){return getSupportedCiphers()[_0x8d7c('0xf')](_0x1db19d)>-0x1;}function combineOptions(_0x570e8a){var _0x5beb27={};for(var _0x5f39e4 in fileOptions){if(fileOptions['hasOwnProperty'](_0x5f39e4)){_0x5beb27[_0x5f39e4]=fileOptions[_0x5f39e4];}}if(_0x570e8a){for(var _0x4bdfac in _0x570e8a){if(_0x570e8a[_0x8d7c('0x10')](_0x4bdfac)){_0x5beb27[_0x4bdfac]=_0x570e8a[_0x4bdfac];}}}return _0x5beb27;}exports[_0x8d7c('0x11')]=function(_0x458321,_0x49616f,_0x26bad9,_0x4c99c7){return new BPromise(function(_0x1c5c2e,_0x2e27d4){_0x4c99c7=combineOptions(_0x4c99c7);var _0x36618d=new Buffer(_0x26bad9);var _0x3cded5=fs['createReadStream'](_0x458321);var _0xb30d5c=fs[_0x8d7c('0x12')](_0x49616f);var _0x40fbc2=crypto[_0x8d7c('0x13')](_0x4c99c7[_0x8d7c('0x9')],_0x36618d);_0x3cded5['on'](_0x8d7c('0x14'),function(_0x456454){var _0x510e97=new Buffer(_0x40fbc2['update'](_0x456454),'binary');_0xb30d5c[_0x8d7c('0x15')](_0x510e97);});_0x3cded5['on'](_0x8d7c('0x16'),function(){try{var _0x5300f6=new Buffer(_0x40fbc2[_0x8d7c('0x17')](_0x8d7c('0x18')),_0x8d7c('0x18'));_0xb30d5c[_0x8d7c('0x15')](_0x5300f6);_0xb30d5c[_0x8d7c('0x16')]();_0xb30d5c['on'](_0x8d7c('0x19'),function(){return _0x1c5c2e(_0x49616f);});}catch(_0x4714ed){fs[_0x8d7c('0x1a')](_0x49616f);return _0x2e27d4(_0x4714ed);}});});};exports[_0x8d7c('0x1b')]=function(_0x229daa,_0x4ae3e3,_0x49c501,_0x4b0c04){return new BPromise(function(_0x258140,_0x1ab968){_0x4b0c04=combineOptions(_0x4b0c04);var _0x358c79=new Buffer(_0x49c501);var _0x2dc4a8=fs[_0x8d7c('0x1c')](_0x229daa);var _0x21a491=fs[_0x8d7c('0x12')](_0x4ae3e3);var _0x2b7470=crypto[_0x8d7c('0x1d')](_0x4b0c04['algorithm'],_0x358c79);_0x2dc4a8['on']('data',function(_0x3b593d){var _0x572522=new Buffer(_0x2b7470['update'](_0x3b593d),_0x8d7c('0x18'));_0x21a491[_0x8d7c('0x15')](_0x572522);});_0x2dc4a8['on'](_0x8d7c('0x16'),function(){try{var _0x45360c=new Buffer(_0x2b7470[_0x8d7c('0x17')](_0x8d7c('0x18')),_0x8d7c('0x18'));_0x21a491[_0x8d7c('0x15')](_0x45360c);_0x21a491[_0x8d7c('0x16')]();_0x21a491['on']('close',function(){return _0x258140(_0x4ae3e3);});}catch(_0x1f0c81){fs['unlink'](_0x4ae3e3);return _0x1ab968(_0x1f0c81);}});});};exports[_0x8d7c('0x1e')]=function(_0x4eca21,_0x1a572c,_0x4605fd){var _0x19b8af=_0x4605fd||stringOptions[_0x8d7c('0x9')];var _0x275193=_0x1a572c||stringOptions[_0x8d7c('0x1f')];var _0x189604=crypto['createCipher'](_0x19b8af,_0x275193);var _0x500f99=_0x189604['update'](_0x4eca21,_0x8d7c('0x20'),'base64');_0x500f99+=_0x189604[_0x8d7c('0x17')]('base64');return _0x500f99;};exports[_0x8d7c('0x21')]=function(_0x2e1510,_0x5eb32d,_0xb752c5){var _0x144d43=_0xb752c5||stringOptions['algorithm'];var _0x5d2484=_0x5eb32d||stringOptions['secret'];var _0x1efe64=crypto[_0x8d7c('0x1d')](_0x144d43,_0x5d2484);var _0xb4834e=_0x1efe64['update'](_0x2e1510,'base64',_0x8d7c('0x20'));_0xb4834e+=_0x1efe64['final'](_0x8d7c('0x20'));return _0xb4834e;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index b1624bf..5423c0c 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 _0x578e=['query','dirname','existsSync','mkdirSync','join','each','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','exit','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x578e,0x1ca));var _0xe578=function(_0x329ea0,_0x107160){_0x329ea0=_0x329ea0-0x0;var _0x58fdf8=_0x578e[_0x329ea0];return _0x58fdf8;};'use strict';var util=require(_0xe578('0x0'));var path=require(_0xe578('0x1'));var _=require(_0xe578('0x2'));var csv=require(_0xe578('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xe578('0x4'));var rimraf=require(_0xe578('0x5'));var db=require(_0xe578('0x6'))['db'];var dbH=require(_0xe578('0x6'))[_0xe578('0x7')];var logger=require(_0xe578('0x8'))(_0xe578('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xe578('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xe578('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x213044,_0xa49900){var _0x2ce963={'status':_0x213044};var _0x4b9ca9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xa49900){_0x2ce963['savename']=_0xa49900;}return db[_0xe578('0xb')]['update'](_0x2ce963,_0x4b9ca9);}function main(){var _0x4f7861=0x1388;var _0x5b543a;logger[_0xe578('0xc')](util[_0xe578('0xd')](_0xe578('0xe'),EXTRACTED_REPORT_ID,_0xe578('0xf')));return db[_0xe578('0x10')][_0xe578('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe578('0x12'),_0xe578('0x13')]})[_0xe578('0x14')](function(_0x15e08f){if(_0x15e08f){_0x5b543a=_0x15e08f;_0x4f7861=_0x5b543a['splitSizeCsv']||0x1388;}})[_0xe578('0x14')](function(){return dbH['sequelize']['query'](util[_0xe578('0xd')](_0xe578('0x15'),QUERY),{'type':dbH[_0xe578('0x16')][_0xe578('0x17')][_0xe578('0x18')]});})[_0xe578('0x14')](function(_0x394749){if(!_0x394749[0x0][_0xe578('0x19')]){return analyticExtractedReport(_0xe578('0x1a'));}var _0x18b1c0=[];var _0x75f68d=0x0;if(_0x5b543a[_0xe578('0x12')]){if(_0x394749&&_0x394749[_0xe578('0x1b')]){var _0x399077=_[_0xe578('0x1c')](_0x394749[0x0]['num']/_0x4f7861);var _0x22e273=Number['isInteger'](_0x394749[0x0][_0xe578('0x19')]/_0x4f7861)?_0x394749[0x0][_0xe578('0x19')]%_0x4f7861:0x0;_0x399077[_0xe578('0x1d')](function(_0x385206){if(_0x385206>0x0){_0x75f68d+=_0x4f7861;}_0x18b1c0[_0xe578('0x1e')](dbH['sequelize']['query'](util[_0xe578('0xd')](_0xe578('0x1f'),QUERY,_0x4f7861,_0x75f68d),{'type':dbH[_0xe578('0x16')][_0xe578('0x17')]['SELECT']}));});if(_0x22e273>0x0){_0x75f68d+=_0x4f7861;_0x18b1c0[_0xe578('0x1e')](dbH['sequelize']['query'](util[_0xe578('0xd')](_0xe578('0x1f'),QUERY,_0x22e273,_0x75f68d),{'type':dbH[_0xe578('0x16')][_0xe578('0x17')][_0xe578('0x18')]}));}}}else{_0x18b1c0[_0xe578('0x1e')](dbH[_0xe578('0x16')][_0xe578('0x20')](QUERY,{'type':dbH[_0xe578('0x16')]['QueryTypes']['SELECT']}));}var _0xddf064=path[_0xe578('0x21')](PATH);var _0x40de89=path['basename'](PATH,'.csv');var _0x1a546b=_0x5b543a[_0xe578('0x12')]&&_0x18b1c0[_0xe578('0x1b')]>0x1;var _0x45029f=[];if(!fs[_0xe578('0x22')](path['join'](_0xddf064,_0x40de89))&&_0x1a546b){fs[_0xe578('0x23')](path[_0xe578('0x24')](_0xddf064,_0x40de89));}return BPromise[_0xe578('0x25')](_0x18b1c0,function(_0x419b95){_0x45029f[_0xe578('0x1e')](_0x419b95);})[_0xe578('0x14')](function(){for(var _0x5024a8=0x0;_0x5024a8<_0x45029f['length'];_0x5024a8+=0x1){var _0x4691c4;var _0x2da922=_0x45029f[_0x5024a8];if(_0x1a546b){_0x4691c4=path[_0xe578('0x24')](_0xddf064,_0x40de89,util[_0xe578('0xd')]('%s%d.%s',_0x40de89,_0x5024a8,_0xe578('0x26')));}else{_0x4691c4=path[_0xe578('0x24')](_0xddf064,util[_0xe578('0xd')](_0xe578('0x27'),_0x40de89,_0xe578('0x26')));}fs[_0xe578('0x28')](_0x4691c4,csv(_0x2da922));}})[_0xe578('0x14')](function(){if(_0x1a546b){return new Promise(function(_0x159dcb){zipdir(path[_0xe578('0x24')](_0xddf064,_0x40de89),{'saveTo':path[_0xe578('0x24')](_0xddf064,util['format'](_0xe578('0x27'),_0x40de89,_0xe578('0x29')))},function(_0x378104,_0x9694bc){rimraf(path[_0xe578('0x24')](_0xddf064,_0x40de89),function(){});_0x159dcb(_0xe578('0x2a'));});});}})['then'](function(){logger[_0xe578('0xc')](util['format'](_0xe578('0x2b'),EXTRACTED_REPORT_ID,_0xe578('0xf')));return analyticExtractedReport(_0xe578('0x2c'),_0x1a546b?util[_0xe578('0xd')](_0xe578('0x27'),_0x40de89,_0x1a546b?'zip':_0xe578('0x26')):null);});})[_0xe578('0x2d')](function(_0x302a17){logger[_0xe578('0xc')](util['format'](_0xe578('0x2e'),EXTRACTED_REPORT_ID,_0xe578('0xf')),util['inspect'](_0x302a17,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xe578('0x2f')](function(){process[_0xe578('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xf9af=['bluebird','zip-dir','../../mysqldb','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeCsv','then','sequelize','SELECT','num','Empty','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','query','dirname','basename','.csv','mkdirSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','lodash','to-csv'];(function(_0x317213,_0x131ad7){var _0x50ff4d=function(_0x4c6b68){while(--_0x4c6b68){_0x317213['push'](_0x317213['shift']());}};_0x50ff4d(++_0x131ad7);}(_0xf9af,0x8b));var _0xff9a=function(_0x176286,_0x25669d){_0x176286=_0x176286-0x0;var _0x5cb5c1=_0xf9af[_0x176286];return _0x5cb5c1;};'use strict';var util=require('util');var path=require('path');var _=require(_0xff9a('0x0'));var csv=require(_0xff9a('0x1'));var fs=require('fs');var BPromise=require(_0xff9a('0x2'));var zipdir=require(_0xff9a('0x3'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0xff9a('0x4'))['dbH'];var logger=require(_0xff9a('0x5'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xff9a('0x6')][0x2]);var QUERY=process[_0xff9a('0x6')][0x3];var PATH=process[_0xff9a('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x50fd68,_0x518658){var _0x48cf06={'status':_0x50fd68};var _0x216b61={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x518658){_0x48cf06[_0xff9a('0x7')]=_0x518658;}return db[_0xff9a('0x8')][_0xff9a('0x9')](_0x48cf06,_0x216b61);}function main(){var _0x46f123=0x1388;var _0x284555;logger[_0xff9a('0xa')](util[_0xff9a('0xb')](_0xff9a('0xc'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xff9a('0xd')][_0xff9a('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xff9a('0xf'),_0xff9a('0x10')]})[_0xff9a('0x11')](function(_0x576722){if(_0x576722){_0x284555=_0x576722;_0x46f123=_0x284555[_0xff9a('0x10')]||0x1388;}})[_0xff9a('0x11')](function(){return dbH[_0xff9a('0x12')]['query'](util[_0xff9a('0xb')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xff9a('0x12')]['QueryTypes'][_0xff9a('0x13')]});})[_0xff9a('0x11')](function(_0x30b545){if(!_0x30b545[0x0][_0xff9a('0x14')]){return analyticExtractedReport(_0xff9a('0x15'));}var _0x43cd1a=[];var _0x5f4ee1=0x0;if(_0x284555[_0xff9a('0xf')]){if(_0x30b545&&_0x30b545[_0xff9a('0x16')]){var _0x2979eb=_[_0xff9a('0x17')](_0x30b545[0x0][_0xff9a('0x14')]/_0x46f123);var _0xdeda76=Number[_0xff9a('0x18')](_0x30b545[0x0][_0xff9a('0x14')]/_0x46f123)?_0x30b545[0x0]['num']%_0x46f123:0x0;_0x2979eb['forEach'](function(_0x2eab3e){if(_0x2eab3e>0x0){_0x5f4ee1+=_0x46f123;}_0x43cd1a[_0xff9a('0x19')](dbH[_0xff9a('0x12')]['query'](util['format'](_0xff9a('0x1a'),QUERY,_0x46f123,_0x5f4ee1),{'type':dbH['sequelize'][_0xff9a('0x1b')][_0xff9a('0x13')]}));});if(_0xdeda76>0x0){_0x5f4ee1+=_0x46f123;_0x43cd1a[_0xff9a('0x19')](dbH[_0xff9a('0x12')]['query'](util['format'](_0xff9a('0x1a'),QUERY,_0xdeda76,_0x5f4ee1),{'type':dbH[_0xff9a('0x12')][_0xff9a('0x1b')][_0xff9a('0x13')]}));}}}else{_0x43cd1a[_0xff9a('0x19')](dbH[_0xff9a('0x12')][_0xff9a('0x1c')](QUERY,{'type':dbH['sequelize'][_0xff9a('0x1b')]['SELECT']}));}var _0x49ebc8=path[_0xff9a('0x1d')](PATH);var _0x38ba60=path[_0xff9a('0x1e')](PATH,_0xff9a('0x1f'));var _0x1058fe=_0x284555['split']&&_0x43cd1a[_0xff9a('0x16')]>0x1;var _0x5011ff=[];if(!fs['existsSync'](path['join'](_0x49ebc8,_0x38ba60))&&_0x1058fe){fs[_0xff9a('0x20')](path[_0xff9a('0x21')](_0x49ebc8,_0x38ba60));}return BPromise[_0xff9a('0x22')](_0x43cd1a,function(_0x3e62ac){_0x5011ff[_0xff9a('0x19')](_0x3e62ac);})[_0xff9a('0x11')](function(){for(var _0x3e5a68=0x0;_0x3e5a68<_0x5011ff[_0xff9a('0x16')];_0x3e5a68+=0x1){var _0x16cf01;var _0x5f2b3a=_0x5011ff[_0x3e5a68];if(_0x1058fe){_0x16cf01=path[_0xff9a('0x21')](_0x49ebc8,_0x38ba60,util['format'](_0xff9a('0x23'),_0x38ba60,_0x3e5a68,_0xff9a('0x24')));}else{_0x16cf01=path[_0xff9a('0x21')](_0x49ebc8,util['format'](_0xff9a('0x25'),_0x38ba60,_0xff9a('0x24')));}fs[_0xff9a('0x26')](_0x16cf01,csv(_0x5f2b3a));}})['then'](function(){if(_0x1058fe){return new Promise(function(_0x2c97eb){zipdir(path[_0xff9a('0x21')](_0x49ebc8,_0x38ba60),{'saveTo':path[_0xff9a('0x21')](_0x49ebc8,util[_0xff9a('0xb')](_0xff9a('0x25'),_0x38ba60,'zip'))},function(_0x2bf1aa,_0x127702){rimraf(path[_0xff9a('0x21')](_0x49ebc8,_0x38ba60),function(){});_0x2c97eb('zip\x20finished');});});}})[_0xff9a('0x11')](function(){logger[_0xff9a('0xa')](util['format'](_0xff9a('0x27'),EXTRACTED_REPORT_ID,_0xff9a('0x28')));return analyticExtractedReport('Completed',_0x1058fe?util['format'](_0xff9a('0x25'),_0x38ba60,_0x1058fe?_0xff9a('0x29'):_0xff9a('0x24')):null);});})['catch'](function(_0x3e954a){logger[_0xff9a('0xa')](util[_0xff9a('0xb')](_0xff9a('0x2a'),EXTRACTED_REPORT_ID,'CSV'),util[_0xff9a('0x2b')](_0x3e954a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xff9a('0x2c'));})[_0xff9a('0x2d')](function(){process[_0xff9a('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 0cc9c12..a96927c 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 _0x933b=['toString','value','fill','length','auto','body','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','push','header','pageBreak','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','split','then','splitSizePdf','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','.pdf','existsSync','join','mkdirSync','each','flatten','%s%d.%s','pdf','all','zip','zip\x20finished','info','%s.%s','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfKitDocument','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','pick'];(function(_0x434ec8,_0x384565){var _0xac1560=function(_0x1dc1f8){while(--_0x1dc1f8){_0x434ec8['push'](_0x434ec8['shift']());}};_0xac1560(++_0x384565);}(_0x933b,0x1b3));var _0xb933=function(_0x5abae0,_0x4e8b36){_0x5abae0=_0x5abae0-0x0;var _0x4700df=_0x933b[_0x5abae0];return _0x4700df;};'use strict';var _=require(_0xb933('0x0'));var fs=require('fs');var util=require(_0xb933('0x1'));var path=require(_0xb933('0x2'));var moment=require(_0xb933('0x3'));var htmlToPdfmake=require(_0xb933('0x4'));var PdfPrinter=require(_0xb933('0x5'));var zipdir=require(_0xb933('0x6'));var rimraf=require(_0xb933('0x7'));var JSDOM=require('jsdom')['JSDOM'];var window=new JSDOM('')['window'];var BPromise=require(_0xb933('0x8'));var db=require('../../mysqldb')['db'];var dbH=require(_0xb933('0x9'))[_0xb933('0xa')];var logger=require(_0xb933('0xb'))(_0xb933('0xc'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xb933('0xd')][0x3];var PATH=process[_0xb933('0xd')][0x4];var NAME=process[_0xb933('0xd')][0x5];var FORMAT=_0xb933('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x14edcc,_0x28f9f0){var _0x1fc254={'status':_0x14edcc};var _0x1bd296={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x28f9f0){_0x1fc254[_0xb933('0xf')]=_0x28f9f0;}return db[_0xb933('0x10')]['update'](_0x1fc254,_0x1bd296);}function getHeaders(_0x1e630e){return _[_0xb933('0x11')](_0x1e630e,function(_0x273b04){return{'text':_0x273b04,'style':_0xb933('0x12')};});}function getRows(_0x398780,_0x14216c){return _[_0xb933('0x11')](_0x14216c,function(_0x5cba63){return _(_0x5cba63)[_0xb933('0x13')](_0x398780)['map'](function(_0x42eb4f){return _0x42eb4f?_[_0xb933('0x14')](_0x42eb4f):'';})[_0xb933('0x15')]();});}function createTable(_0x21d280,_0x3bfa6f){var _0x4b1d17={'widths':_[_0xb933('0x16')](Array(_0x21d280[_0xb933('0x17')]),0x91),'heights':function(_0x2033b1){return _0x2033b1===0x0?_0xb933('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0xdc6fd9=getHeaders(_0x21d280);_0x4b1d17[_0xb933('0x19')]['push'](_0xdc6fd9);var _0x3c01ec=getRows(_0x21d280,_0x3bfa6f);_0x4b1d17[_0xb933('0x19')]=_0x4b1d17[_0xb933('0x19')][_0xb933('0x1a')](_0x3c01ec);return _0x4b1d17;}function createTables(_0x54993f){var _0x1b5127=[];var _0x3cd161=_[_0xb933('0x1b')](Object[_0xb933('0x1c')](_0x54993f[0x0]),0x5);_0x3cd161[_0xb933('0x1d')](function(_0x40e45e){_0x1b5127['push'](createTable(_0x40e45e,_0x54993f));});return _0x1b5127;}function getPDFDocDefinition(_0xfb45b5){var _0x56c0b9=util[_0xb933('0x1e')](_0xb933('0x1f'),NAME,EXTRACTED_REPORT[_0xb933('0x20')],moment(EXTRACTED_REPORT[_0xb933('0x21')])[_0xb933('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0xb933('0x22')])[_0xb933('0x1e')](FORMAT));var _0x23a5c0=[];for(var _0x217206=0x0;_0x217206<_0xfb45b5[_0xb933('0x17')];_0x217206++){var _0x32490d=[];if(_0x217206===0x0){_0x32490d[_0xb933('0x23')]({'text':_0x56c0b9,'style':_0xb933('0x24')});}var _0x3b3ea0={'table':_0xfb45b5[_0x217206]};if(_0x217206>0x0){_0x3b3ea0[_0xb933('0x25')]='before';_0x3b3ea0[_0xb933('0x26')]=[0x0,0x46,0x0,0x0];}_0x32490d[_0xb933('0x23')](_0x3b3ea0);_0x23a5c0[_0xb933('0x23')](_0x32490d);}return{'pageSize':'A4','pageOrientation':_0xb933('0x27'),'content':_0x23a5c0,'footer':function(_0x47a25c,_0x5cb320){return{'text':_0x47a25c[_0xb933('0x14')]()+_0xb933('0x28')+_0x5cb320,'style':_0xb933('0x29')};},'defaultStyle':{'font':_0xb933('0x2a')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xb933('0x2b')},'footer':{'alignment':_0xb933('0x2c'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x478723){var _0x4e92c6=0x1388;var _0x220d9a;if(!_0x478723[0x0][_0xb933('0x2d')]){return analyticExtractedReport(_0xb933('0x2e'));}return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb933('0x2f'),'splitSizePdf']})[_0xb933('0x30')](function(_0x5f0c65){if(_0x5f0c65){_0x220d9a=_0x5f0c65;_0x4e92c6=_0x220d9a[_0xb933('0x31')]||0x3e8;}})[_0xb933('0x30')](function(){var _0x55b438=[];var _0x5cee08=0x0;if(_0x220d9a['split']){if(_0x478723&&_0x478723['length']){var _0x5a89f2=_[_0xb933('0x32')](_0x478723[0x0][_0xb933('0x2d')]/_0x4e92c6);var _0x10a1d4=Number[_0xb933('0x33')](_0x478723[0x0][_0xb933('0x2d')]/_0x4e92c6)?_0x478723[0x0][_0xb933('0x2d')]%_0x4e92c6:0x0;_0x5a89f2[_0xb933('0x1d')](function(_0x2392c5){if(_0x2392c5>0x0){_0x5cee08+=_0x4e92c6;}_0x55b438['push'](dbH[_0xb933('0x34')][_0xb933('0x35')](util[_0xb933('0x1e')](_0xb933('0x36'),QUERY,_0x4e92c6,_0x5cee08),{'type':dbH['sequelize'][_0xb933('0x37')][_0xb933('0x38')]}));});if(_0x10a1d4>0x0){_0x5cee08+=_0x4e92c6;_0x55b438[_0xb933('0x23')](dbH['sequelize'][_0xb933('0x35')](util[_0xb933('0x1e')](_0xb933('0x36'),QUERY,_0x10a1d4,_0x5cee08),{'type':dbH[_0xb933('0x34')]['QueryTypes'][_0xb933('0x38')]}));}}}else{_0x55b438[_0xb933('0x23')](dbH[_0xb933('0x34')]['query'](QUERY,{'type':dbH[_0xb933('0x34')]['QueryTypes'][_0xb933('0x38')]}));}var _0x24d109=path['dirname'](PATH);var _0xd9a09e=path['basename'](PATH,_0xb933('0x39'));var _0x34e462=_0x220d9a[_0xb933('0x2f')]&&_0x55b438['length']>0x1;var _0xe1446=[];if(!fs[_0xb933('0x3a')](path[_0xb933('0x3b')](_0x24d109,_0xd9a09e))&&_0x34e462){fs[_0xb933('0x3c')](path[_0xb933('0x3b')](_0x24d109,_0xd9a09e));}return BPromise[_0xb933('0x3d')](_0x55b438,function(_0x4155ff){_0xe1446[_0xb933('0x23')](_0x4155ff);})[_0xb933('0x30')](function(){var _0x5e4e22=[];for(var _0x30aa1b=0x0;_0x30aa1b<_0xe1446[_0xb933('0x17')];_0x30aa1b+=0x1){var _0x1a695e=_0xe1446[_0x30aa1b];var _0x5c05ae=createTables(_[_0xb933('0x3e')](_0x1a695e));var _0x72ed78;var _0x48256a=getPDFDocDefinition(_0x5c05ae);var _0x723945=getPDFPrinter();var _0x57d3d3=_0x723945['createPdfKitDocument'](_0x48256a);if(_0x34e462){_0x72ed78=path[_0xb933('0x3b')](_0x24d109,_0xd9a09e,util[_0xb933('0x1e')](_0xb933('0x3f'),_0xd9a09e,_0x30aa1b,_0xb933('0x40')));}else{_0x72ed78=path['join'](_0x24d109,util['format']('%s.%s',_0xd9a09e,_0xb933('0x40')));}_0x5e4e22[_0xb933('0x23')](writePDFDocument(_0x57d3d3,_0x72ed78));}return Promise[_0xb933('0x41')](_0x5e4e22);})[_0xb933('0x30')](function(){if(_0x34e462){return new Promise(function(_0x1cc692){zipdir(path['join'](_0x24d109,_0xd9a09e),{'saveTo':path['join'](_0x24d109,util[_0xb933('0x1e')]('%s.%s',_0xd9a09e,_0xb933('0x42')))},function(){rimraf(path[_0xb933('0x3b')](_0x24d109,_0xd9a09e),function(){});_0x1cc692(_0xb933('0x43'));});});}})[_0xb933('0x30')](function(){if(!_0x34e462)return;rimraf(path[_0xb933('0x3b')](_0x24d109,_0xd9a09e),function(){});})['then'](function(){logger[_0xb933('0x44')](util[_0xb933('0x1e')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport('Completed',_0x34e462?util[_0xb933('0x1e')](_0xb933('0x45'),_0xd9a09e,_0x34e462?_0xb933('0x42'):_0xb933('0x40')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xb933('0x44')](util[_0xb933('0x1e')](_0xb933('0x46'),EXTRACTED_REPORT_ID,_0xb933('0x47')));return db[_0xb933('0x10')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0xb933('0x30')](function(_0x133371){EXTRACTED_REPORT=_0x133371;return dbH[_0xb933('0x34')][_0xb933('0x35')](util[_0xb933('0x1e')](_0xb933('0x48'),QUERY),{'type':dbH['sequelize'][_0xb933('0x37')][_0xb933('0x38')]});})[_0xb933('0x30')](extractReport)['catch'](function(_0x29c974){logger['info'](util[_0xb933('0x1e')](_0xb933('0x49'),EXTRACTED_REPORT_ID,_0xb933('0x47')),util['inspect'](_0x29c974,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xb933('0x4a')](function(){process[_0xb933('0x4b')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x265c5a=new PdfPrinter({'Arial':{'normal':__dirname+_0xb933('0x4c'),'bold':__dirname+_0xb933('0x4d'),'italics':__dirname+_0xb933('0x4e'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x265c5a;}function getPDFDocDefinitionFromHTML(_0x131ca3,_0x3d0455){var _0x85a596=util[_0xb933('0x1e')](_0xb933('0x4f'),_0x3d0455['channel'],_0x3d0455[_0xb933('0x50')]);var _0x5b3f55=moment()[_0xb933('0x1e')](_0xb933('0x51'))[_0xb933('0x14')]();var _0x2fc8d2=htmlToPdfmake(_0x131ca3,{'window':window,'tableAutoSize':!![]});return{'content':[_0x2fc8d2],'defaultStyle':{'font':_0xb933('0x2a')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xb933('0x52'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xb933('0x52'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xb933('0x52')}},'header':function(){return[{'text':_0xb933('0x53'),'style':_0xb933('0x24')}];},'footer':function(_0x1fa477,_0x2e8a61){return[{'text':util['format'](_0xb933('0x54'),_0x85a596,_0x1fa477,_0x2e8a61,_0x5b3f55),'style':_0xb933('0x29')}];}};}function writePDFDocument(_0x3e3f8f,_0x5bbf38){return new Promise(function(_0x3420f8,_0x5eaa1c){var _0xb56b2c=_0x3e3f8f[_0xb933('0x55')](fs[_0xb933('0x56')](_0x5bbf38));_0xb56b2c['on'](_0xb933('0x57'),function(){_0x3420f8(_0xb933('0x57'));});_0xb56b2c['on'](_0xb933('0x58'),function(_0x3f8b36){_0x5eaa1c(_0x3f8b36);});_0x3e3f8f[_0xb933('0x59')]();});}exports['createPdfFromHTML']=function(_0x11eec1,_0x84c413){var _0x505793=getPDFPrinter();var _0x124dd1=getPDFDocDefinitionFromHTML(_0x11eec1,_0x84c413);var _0x408c27=_0x505793[_0xb933('0x5a')](_0x124dd1);return writePDFDocument(_0x408c27,_0x84c413[_0xb933('0x2')])['catch'](function(_0x29d9c4){throw _0x29d9c4;});}; \ No newline at end of file +var _0xe380=['Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-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','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','path','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','tableHeader','map','pick','value','fill','length','auto','body','push','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','endDate','header','pageBreak','before','margin','landscape','toString','\x20/\x20','footer','Arial','num','Empty','Setting','find','splitSizePdf','then','split','isInteger','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','query','QueryTypes','.pdf','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed'];(function(_0x5bc430,_0x54aced){var _0x5deeef=function(_0x26f2c4){while(--_0x26f2c4){_0x5bc430['push'](_0x5bc430['shift']());}};_0x5deeef(++_0x54aced);}(_0xe380,0x11a));var _0x0e38=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xe380[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0x0e38('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x0e38('0x1'));var moment=require('moment');var htmlToPdfmake=require(_0x0e38('0x2'));var PdfPrinter=require(_0x0e38('0x3'));var zipdir=require(_0x0e38('0x4'));var rimraf=require(_0x0e38('0x5'));var JSDOM=require(_0x0e38('0x6'))[_0x0e38('0x7')];var window=new JSDOM('')[_0x0e38('0x8')];var BPromise=require('bluebird');var db=require(_0x0e38('0x9'))['db'];var dbH=require(_0x0e38('0x9'))['dbH'];var logger=require(_0x0e38('0xa'))(_0x0e38('0xb'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x0e38('0xc')][0x3];var PATH=process[_0x0e38('0xc')][0x4];var NAME=process[_0x0e38('0xc')][0x5];var FORMAT=_0x0e38('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x27efe3,_0x776852){var _0x38d0dc={'status':_0x27efe3};var _0x339400={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x776852){_0x38d0dc['savename']=_0x776852;}return db[_0x0e38('0xe')][_0x0e38('0xf')](_0x38d0dc,_0x339400);}function getHeaders(_0x29c47d){return _['map'](_0x29c47d,function(_0x22ae84){return{'text':_0x22ae84,'style':_0x0e38('0x10')};});}function getRows(_0x4cab92,_0x1fe355){return _[_0x0e38('0x11')](_0x1fe355,function(_0x3e0d93){return _(_0x3e0d93)[_0x0e38('0x12')](_0x4cab92)[_0x0e38('0x11')](function(_0x27f40d){return _0x27f40d?_['toString'](_0x27f40d):'';})[_0x0e38('0x13')]();});}function createTable(_0x5da80f,_0x3be709){var _0x3fd2cd={'widths':_[_0x0e38('0x14')](Array(_0x5da80f[_0x0e38('0x15')]),0x91),'heights':function(_0xceec91){return _0xceec91===0x0?_0x0e38('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x3989fc=getHeaders(_0x5da80f);_0x3fd2cd[_0x0e38('0x17')][_0x0e38('0x18')](_0x3989fc);var _0xbe6f03=getRows(_0x5da80f,_0x3be709);_0x3fd2cd[_0x0e38('0x17')]=_0x3fd2cd[_0x0e38('0x17')]['concat'](_0xbe6f03);return _0x3fd2cd;}function createTables(_0xb39fc6){var _0x4f3e75=[];var _0x517a0d=_[_0x0e38('0x19')](Object[_0x0e38('0x1a')](_0xb39fc6[0x0]),0x5);_0x517a0d[_0x0e38('0x1b')](function(_0x18c3f4){_0x4f3e75[_0x0e38('0x18')](createTable(_0x18c3f4,_0xb39fc6));});return _0x4f3e75;}function getPDFDocDefinition(_0x5f700){var _0x42afd3=util[_0x0e38('0x1c')](_0x0e38('0x1d'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT['startDate'])['format'](FORMAT),moment(EXTRACTED_REPORT[_0x0e38('0x1e')])['format'](FORMAT));var _0x279e69=[];for(var _0x389349=0x0;_0x389349<_0x5f700[_0x0e38('0x15')];_0x389349++){var _0x19b58e=[];if(_0x389349===0x0){_0x19b58e[_0x0e38('0x18')]({'text':_0x42afd3,'style':_0x0e38('0x1f')});}var _0x315cac={'table':_0x5f700[_0x389349]};if(_0x389349>0x0){_0x315cac[_0x0e38('0x20')]=_0x0e38('0x21');_0x315cac[_0x0e38('0x22')]=[0x0,0x46,0x0,0x0];}_0x19b58e[_0x0e38('0x18')](_0x315cac);_0x279e69['push'](_0x19b58e);}return{'pageSize':'A4','pageOrientation':_0x0e38('0x23'),'content':_0x279e69,'footer':function(_0x5de5fa,_0x43cfc6){return{'text':_0x5de5fa[_0x0e38('0x24')]()+_0x0e38('0x25')+_0x43cfc6,'style':_0x0e38('0x26')};},'defaultStyle':{'font':_0x0e38('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5e10c8){var _0x4c586e=0x1388;var _0x550fd6;if(!_0x5e10c8[0x0][_0x0e38('0x28')]){return analyticExtractedReport(_0x0e38('0x29'));}return db[_0x0e38('0x2a')][_0x0e38('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x0e38('0x2c')]})['then'](function(_0x5d1b83){if(_0x5d1b83){_0x550fd6=_0x5d1b83;_0x4c586e=_0x550fd6[_0x0e38('0x2c')]||0x3e8;}})[_0x0e38('0x2d')](function(){var _0x3945f9=[];var _0x125784=0x0;if(_0x550fd6[_0x0e38('0x2e')]){if(_0x5e10c8&&_0x5e10c8[_0x0e38('0x15')]){var _0x4e503a=_['range'](_0x5e10c8[0x0]['num']/_0x4c586e);var _0x5f1e99=Number[_0x0e38('0x2f')](_0x5e10c8[0x0][_0x0e38('0x28')]/_0x4c586e)?_0x5e10c8[0x0][_0x0e38('0x28')]%_0x4c586e:0x0;_0x4e503a[_0x0e38('0x1b')](function(_0x490c2){if(_0x490c2>0x0){_0x125784+=_0x4c586e;}_0x3945f9[_0x0e38('0x18')](dbH[_0x0e38('0x30')]['query'](util[_0x0e38('0x1c')](_0x0e38('0x31'),QUERY,_0x4c586e,_0x125784),{'type':dbH[_0x0e38('0x30')]['QueryTypes'][_0x0e38('0x32')]}));});if(_0x5f1e99>0x0){_0x125784+=_0x4c586e;_0x3945f9[_0x0e38('0x18')](dbH[_0x0e38('0x30')][_0x0e38('0x33')](util[_0x0e38('0x1c')](_0x0e38('0x31'),QUERY,_0x5f1e99,_0x125784),{'type':dbH[_0x0e38('0x30')][_0x0e38('0x34')][_0x0e38('0x32')]}));}}}else{_0x3945f9[_0x0e38('0x18')](dbH[_0x0e38('0x30')]['query'](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x0e38('0x32')]}));}var _0x1d5680=path['dirname'](PATH);var _0x59bc68=path['basename'](PATH,_0x0e38('0x35'));var _0x11ed58=_0x550fd6[_0x0e38('0x2e')]&&_0x3945f9[_0x0e38('0x15')]>0x1;var _0x5da1ee=[];if(!fs['existsSync'](path['join'](_0x1d5680,_0x59bc68))&&_0x11ed58){fs['mkdirSync'](path[_0x0e38('0x36')](_0x1d5680,_0x59bc68));}return BPromise[_0x0e38('0x37')](_0x3945f9,function(_0x338fe0){_0x5da1ee['push'](_0x338fe0);})[_0x0e38('0x2d')](function(){var _0x3382d8=[];for(var _0x3490ad=0x0;_0x3490ad<_0x5da1ee['length'];_0x3490ad+=0x1){var _0x470dbc=_0x5da1ee[_0x3490ad];var _0x541e38=createTables(_[_0x0e38('0x38')](_0x470dbc));var _0x4a863f;var _0x1b3902=getPDFDocDefinition(_0x541e38);var _0x5ccee7=getPDFPrinter();var _0x5c4981=_0x5ccee7[_0x0e38('0x39')](_0x1b3902);if(_0x11ed58){_0x4a863f=path['join'](_0x1d5680,_0x59bc68,util[_0x0e38('0x1c')](_0x0e38('0x3a'),_0x59bc68,_0x3490ad,_0x0e38('0x3b')));}else{_0x4a863f=path[_0x0e38('0x36')](_0x1d5680,util[_0x0e38('0x1c')](_0x0e38('0x3c'),_0x59bc68,'pdf'));}_0x3382d8['push'](writePDFDocument(_0x5c4981,_0x4a863f));}return Promise[_0x0e38('0x3d')](_0x3382d8);})['then'](function(){if(_0x11ed58){return new Promise(function(_0x425f60){zipdir(path[_0x0e38('0x36')](_0x1d5680,_0x59bc68),{'saveTo':path[_0x0e38('0x36')](_0x1d5680,util[_0x0e38('0x1c')](_0x0e38('0x3c'),_0x59bc68,_0x0e38('0x3e')))},function(){rimraf(path['join'](_0x1d5680,_0x59bc68),function(){});_0x425f60('zip\x20finished');});});}})['then'](function(){if(!_0x11ed58)return;rimraf(path['join'](_0x1d5680,_0x59bc68),function(){});})[_0x0e38('0x2d')](function(){logger[_0x0e38('0x3f')](util[_0x0e38('0x1c')](_0x0e38('0x40'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x0e38('0x41'),_0x11ed58?util[_0x0e38('0x1c')](_0x0e38('0x3c'),_0x59bc68,_0x11ed58?_0x0e38('0x3e'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x0e38('0x3f')](util['format'](_0x0e38('0x42'),EXTRACTED_REPORT_ID,_0x0e38('0x43')));return db['AnalyticExtractedReport'][_0x0e38('0x44')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x0e38('0x2d')](function(_0x40b345){EXTRACTED_REPORT=_0x40b345;return dbH['sequelize']['query'](util[_0x0e38('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0e38('0x30')][_0x0e38('0x34')][_0x0e38('0x32')]});})[_0x0e38('0x2d')](extractReport)[_0x0e38('0x45')](function(_0x33e4a5){logger[_0x0e38('0x3f')](util[_0x0e38('0x1c')](_0x0e38('0x46'),EXTRACTED_REPORT_ID,'PDF'),util[_0x0e38('0x47')](_0x33e4a5,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x591d99=new PdfPrinter({'Arial':{'normal':__dirname+_0x0e38('0x48'),'bold':__dirname+_0x0e38('0x49'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x0e38('0x4a')}});return _0x591d99;}function getPDFDocDefinitionFromHTML(_0x41f346,_0x3741e3){var _0x39e424=util[_0x0e38('0x1c')]('%s\x20#%d',_0x3741e3[_0x0e38('0x4b')],_0x3741e3[_0x0e38('0x4c')]);var _0x4924b5=moment()[_0x0e38('0x1c')](_0x0e38('0x4d'))[_0x0e38('0x24')]();var _0x5c13a2=htmlToPdfmake(_0x41f346,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5c13a2],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x0e38('0x4e'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x0e38('0x4e')}},'header':function(){return[{'text':_0x0e38('0x4f'),'style':_0x0e38('0x1f')}];},'footer':function(_0xde3ed0,_0x1101bb){return[{'text':util[_0x0e38('0x1c')](_0x0e38('0x50'),_0x39e424,_0xde3ed0,_0x1101bb,_0x4924b5),'style':_0x0e38('0x26')}];}};}function writePDFDocument(_0x4ba547,_0x54b5c6){return new Promise(function(_0x48185d,_0x51b42a){var _0x579e8e=_0x4ba547[_0x0e38('0x51')](fs[_0x0e38('0x52')](_0x54b5c6));_0x579e8e['on']('finish',function(){_0x48185d(_0x0e38('0x53'));});_0x579e8e['on'](_0x0e38('0x54'),function(_0x5af6fb){_0x51b42a(_0x5af6fb);});_0x4ba547[_0x0e38('0x55')]();});}exports[_0x0e38('0x56')]=function(_0xe2c311,_0x4b49e0){var _0x46509b=getPDFPrinter();var _0x4ea86d=getPDFDocDefinitionFromHTML(_0xe2c311,_0x4b49e0);var _0xbda13c=_0x46509b['createPdfKitDocument'](_0x4ea86d);return writePDFDocument(_0xbda13c,_0x4b49e0[_0x0e38('0x1')])[_0x0e38('0x45')](function(_0x78bdee){throw _0x78bdee;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index f14679c..082fea2 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 _0x0590=['push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.xlsx','length','existsSync','mkdirSync','join','%s%d.%s','xlsx','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','Failed','finally','exit','lodash','json2xls','bluebird','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','info','format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','forEach'];(function(_0x4e3d4b,_0x1f528d){var _0x17f2b1=function(_0x4ad3f3){while(--_0x4ad3f3){_0x4e3d4b['push'](_0x4e3d4b['shift']());}};_0x17f2b1(++_0x1f528d);}(_0x0590,0x166));var _0x0059=function(_0x56c723,_0x512a2e){_0x56c723=_0x56c723-0x0;var _0x3bdbb7=_0x0590[_0x56c723];return _0x3bdbb7;};'use strict';var util=require('util');var path=require('path');var _=require(_0x0059('0x0'));var fs=require('fs');var json2xls=require(_0x0059('0x1'));var BPromise=require(_0x0059('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0x0059('0x3'));var db=require('../../mysqldb')['db'];var dbH=require(_0x0059('0x4'))[_0x0059('0x5')];var logger=require('../../config/logger')(_0x0059('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0059('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x0059('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x57b16e,_0xca9f50){var _0x23c5f5={'status':_0x57b16e};var _0x4c001f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xca9f50){_0x23c5f5[_0x0059('0x8')]=_0xca9f50;}return db[_0x0059('0x9')][_0x0059('0xa')](_0x23c5f5,_0x4c001f);}function main(){var _0x47e941=0x1388;var _0x1461c1;logger[_0x0059('0xb')](util[_0x0059('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x0059('0xd')));return db[_0x0059('0xe')][_0x0059('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0059('0x10'),_0x0059('0x11')]})[_0x0059('0x12')](function(_0x192ee1){if(_0x192ee1){_0x1461c1=_0x192ee1;_0x47e941=_0x1461c1['splitSizeXlsx']||0x1388;}})[_0x0059('0x12')](function(){return dbH[_0x0059('0x13')][_0x0059('0x14')](util[_0x0059('0xc')](_0x0059('0x15'),QUERY),{'type':dbH[_0x0059('0x13')]['QueryTypes'][_0x0059('0x16')]});})[_0x0059('0x12')](function(_0x4a1a22){if(!_0x4a1a22[0x0][_0x0059('0x17')]){return analyticExtractedReport(_0x0059('0x18'));}var _0x245d2d=[];var _0x33aadb=0x0;if(_0x1461c1[_0x0059('0x10')]){if(_0x4a1a22&&_0x4a1a22['length']){var _0x451a7c=_['range'](_0x4a1a22[0x0][_0x0059('0x17')]/_0x47e941);var _0x4eafa7=Number['isInteger'](_0x4a1a22[0x0]['num']/_0x47e941)?_0x4a1a22[0x0][_0x0059('0x17')]%_0x47e941:0x0;_0x451a7c[_0x0059('0x19')](function(_0x2dac1d){if(_0x2dac1d>0x0){_0x33aadb+=_0x47e941;}_0x245d2d[_0x0059('0x1a')](dbH[_0x0059('0x13')]['query'](util[_0x0059('0xc')](_0x0059('0x1b'),QUERY,_0x47e941,_0x33aadb),{'type':dbH[_0x0059('0x13')][_0x0059('0x1c')][_0x0059('0x16')]}));});if(_0x4eafa7>0x0){_0x33aadb+=_0x47e941;_0x245d2d[_0x0059('0x1a')](dbH['sequelize']['query'](util[_0x0059('0xc')](_0x0059('0x1b'),QUERY,_0x4eafa7,_0x33aadb),{'type':dbH[_0x0059('0x13')][_0x0059('0x1c')]['SELECT']}));}}}else{_0x245d2d[_0x0059('0x1a')](dbH[_0x0059('0x13')][_0x0059('0x14')](QUERY,{'type':dbH[_0x0059('0x13')][_0x0059('0x1c')][_0x0059('0x16')]}));}var _0x4d40ac=path[_0x0059('0x1d')](PATH);var _0x24f685=path[_0x0059('0x1e')](PATH,_0x0059('0x1f'));var _0x140a13=_0x1461c1[_0x0059('0x10')]&&_0x245d2d[_0x0059('0x20')]>0x1;var _0x317937=[];if(!fs[_0x0059('0x21')](path['join'](_0x4d40ac,_0x24f685))&&_0x140a13){fs[_0x0059('0x22')](path[_0x0059('0x23')](_0x4d40ac,_0x24f685));}return BPromise['each'](_0x245d2d,function(_0x3f2fd6){_0x317937[_0x0059('0x1a')](_0x3f2fd6);})[_0x0059('0x12')](function(){for(var _0x4b6e2e=0x0;_0x4b6e2e<_0x317937[_0x0059('0x20')];_0x4b6e2e+=0x1){var _0xd7529;var _0x17b584=_0x317937[_0x4b6e2e];if(_0x140a13){_0xd7529=path[_0x0059('0x23')](_0x4d40ac,_0x24f685,util[_0x0059('0xc')](_0x0059('0x24'),_0x24f685,_0x4b6e2e,_0x0059('0x25')));}else{_0xd7529=path[_0x0059('0x23')](_0x4d40ac,util[_0x0059('0xc')](_0x0059('0x26'),_0x24f685,_0x0059('0x25')));}fs['writeFileSync'](_0xd7529,json2xls(_0x17b584),'binary');}})[_0x0059('0x12')](function(){if(_0x140a13){return new Promise(function(_0x5a5cfa){zipdir(path['join'](_0x4d40ac,_0x24f685),{'saveTo':path['join'](_0x4d40ac,util['format']('%s.%s',_0x24f685,_0x0059('0x27')))},function(_0x2e68b4,_0x40827a){rimraf(path['join'](_0x4d40ac,_0x24f685),function(){});_0x5a5cfa(_0x0059('0x28'));});});}})[_0x0059('0x12')](function(){logger[_0x0059('0xb')](util[_0x0059('0xc')](_0x0059('0x29'),EXTRACTED_REPORT_ID,_0x0059('0xd')));return analyticExtractedReport(_0x0059('0x2a'),_0x140a13?util[_0x0059('0xc')](_0x0059('0x26'),_0x24f685,_0x140a13?'zip':_0x0059('0x25')):null);});})[_0x0059('0x2b')](function(_0x2ac305){logger[_0x0059('0xb')](util[_0x0059('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x0059('0xd')),util[_0x0059('0x2c')](_0x2ac305,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x0059('0x2d'));})[_0x0059('0x2e')](function(){process[_0x0059('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xf1c3=['xlsx','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','analytics','argv','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','range','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','format','dirname','basename','length','existsSync','join','mkdirSync','%s%d.%s'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0xf1c3,0x1d8));var _0x3f1c=function(_0x1bd323,_0x1c16ab){_0x1bd323=_0x1bd323-0x0;var _0x13097b=_0xf1c3[_0x1bd323];return _0x13097b;};'use strict';var util=require(_0x3f1c('0x0'));var path=require('path');var _=require(_0x3f1c('0x1'));var fs=require('fs');var json2xls=require(_0x3f1c('0x2'));var BPromise=require(_0x3f1c('0x3'));var zipdir=require(_0x3f1c('0x4'));var rimraf=require(_0x3f1c('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0x3f1c('0x6'))['dbH'];var logger=require('../../config/logger')(_0x3f1c('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x3f1c('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x3f1c('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5d0d4b,_0x2509aa){var _0x3f6bdf={'status':_0x5d0d4b};var _0x2bb2ea={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2509aa){_0x3f6bdf['savename']=_0x2509aa;}return db[_0x3f1c('0x9')][_0x3f1c('0xa')](_0x3f6bdf,_0x2bb2ea);}function main(){var _0x5e37ab=0x1388;var _0xccea72;logger[_0x3f1c('0xb')](util['format'](_0x3f1c('0xc'),EXTRACTED_REPORT_ID,_0x3f1c('0xd')));return db[_0x3f1c('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3f1c('0xf'),_0x3f1c('0x10')]})['then'](function(_0x5f38d8){if(_0x5f38d8){_0xccea72=_0x5f38d8;_0x5e37ab=_0xccea72[_0x3f1c('0x10')]||0x1388;}})[_0x3f1c('0x11')](function(){return dbH[_0x3f1c('0x12')][_0x3f1c('0x13')](util['format'](_0x3f1c('0x14'),QUERY),{'type':dbH[_0x3f1c('0x12')][_0x3f1c('0x15')][_0x3f1c('0x16')]});})[_0x3f1c('0x11')](function(_0x43f526){if(!_0x43f526[0x0]['num']){return analyticExtractedReport(_0x3f1c('0x17'));}var _0x1cc175=[];var _0x59c4a1=0x0;if(_0xccea72['split']){if(_0x43f526&&_0x43f526['length']){var _0x3c1406=_[_0x3f1c('0x18')](_0x43f526[0x0][_0x3f1c('0x19')]/_0x5e37ab);var _0x19021f=Number[_0x3f1c('0x1a')](_0x43f526[0x0]['num']/_0x5e37ab)?_0x43f526[0x0]['num']%_0x5e37ab:0x0;_0x3c1406[_0x3f1c('0x1b')](function(_0x4681cf){if(_0x4681cf>0x0){_0x59c4a1+=_0x5e37ab;}_0x1cc175[_0x3f1c('0x1c')](dbH[_0x3f1c('0x12')][_0x3f1c('0x13')](util['format'](_0x3f1c('0x1d'),QUERY,_0x5e37ab,_0x59c4a1),{'type':dbH[_0x3f1c('0x12')][_0x3f1c('0x15')][_0x3f1c('0x16')]}));});if(_0x19021f>0x0){_0x59c4a1+=_0x5e37ab;_0x1cc175['push'](dbH[_0x3f1c('0x12')][_0x3f1c('0x13')](util[_0x3f1c('0x1e')](_0x3f1c('0x1d'),QUERY,_0x19021f,_0x59c4a1),{'type':dbH[_0x3f1c('0x12')][_0x3f1c('0x15')][_0x3f1c('0x16')]}));}}}else{_0x1cc175[_0x3f1c('0x1c')](dbH[_0x3f1c('0x12')][_0x3f1c('0x13')](QUERY,{'type':dbH[_0x3f1c('0x12')][_0x3f1c('0x15')][_0x3f1c('0x16')]}));}var _0x4290fa=path[_0x3f1c('0x1f')](PATH);var _0x2d9ab5=path[_0x3f1c('0x20')](PATH,'.xlsx');var _0x1c7efb=_0xccea72[_0x3f1c('0xf')]&&_0x1cc175[_0x3f1c('0x21')]>0x1;var _0x36ef44=[];if(!fs[_0x3f1c('0x22')](path[_0x3f1c('0x23')](_0x4290fa,_0x2d9ab5))&&_0x1c7efb){fs[_0x3f1c('0x24')](path['join'](_0x4290fa,_0x2d9ab5));}return BPromise['each'](_0x1cc175,function(_0x4da363){_0x36ef44[_0x3f1c('0x1c')](_0x4da363);})[_0x3f1c('0x11')](function(){for(var _0x2d5f8e=0x0;_0x2d5f8e<_0x36ef44[_0x3f1c('0x21')];_0x2d5f8e+=0x1){var _0x4e05ad;var _0x2fc1ff=_0x36ef44[_0x2d5f8e];if(_0x1c7efb){_0x4e05ad=path['join'](_0x4290fa,_0x2d9ab5,util['format'](_0x3f1c('0x25'),_0x2d9ab5,_0x2d5f8e,_0x3f1c('0x26')));}else{_0x4e05ad=path[_0x3f1c('0x23')](_0x4290fa,util[_0x3f1c('0x1e')](_0x3f1c('0x27'),_0x2d9ab5,'xlsx'));}fs[_0x3f1c('0x28')](_0x4e05ad,json2xls(_0x2fc1ff),'binary');}})[_0x3f1c('0x11')](function(){if(_0x1c7efb){return new Promise(function(_0x52b5b5){zipdir(path[_0x3f1c('0x23')](_0x4290fa,_0x2d9ab5),{'saveTo':path[_0x3f1c('0x23')](_0x4290fa,util['format'](_0x3f1c('0x27'),_0x2d9ab5,_0x3f1c('0x29')))},function(_0x4a5e59,_0xe87004){rimraf(path[_0x3f1c('0x23')](_0x4290fa,_0x2d9ab5),function(){});_0x52b5b5(_0x3f1c('0x2a'));});});}})[_0x3f1c('0x11')](function(){logger['info'](util['format'](_0x3f1c('0x2b'),EXTRACTED_REPORT_ID,_0x3f1c('0xd')));return analyticExtractedReport(_0x3f1c('0x2c'),_0x1c7efb?util[_0x3f1c('0x1e')]('%s.%s',_0x2d9ab5,_0x1c7efb?'zip':_0x3f1c('0x26')):null);});})[_0x3f1c('0x2d')](function(_0x188075){logger[_0x3f1c('0xb')](util[_0x3f1c('0x1e')](_0x3f1c('0x2e'),EXTRACTED_REPORT_ID,_0x3f1c('0xd')),util[_0x3f1c('0x2f')](_0x188075,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3f1c('0x30'));})[_0x3f1c('0x31')](function(){process[_0x3f1c('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 4365c2d..fe7f7aa 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 _0x29d9=['rewrite','lodash','util','Interval','findAll','then','intervals','models','VoiceExtension','map','exten','filter','groupBy','queue','hasOwnProperty','priority','find','push','type','context','VoiceExtensionId','inbound','extensions','CDR(routeid)=','outbound','extension','Set','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','createdAt','interval','*,*,*,*','IntervalId','tag','callerID','ExecIf','$[${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','app','toLowerCase','appType','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','bulkCreate','sortBy','catch','error'];(function(_0x516f7c,_0x31d38d){var _0x30bd54=function(_0x4a0e68){while(--_0x4a0e68){_0x516f7c['push'](_0x516f7c['shift']());}};_0x30bd54(++_0x31d38d);}(_0x29d9,0x1e4));var _0x929d=function(_0x503bc0,_0xca86dd){_0x503bc0=_0x503bc0-0x0;var _0x327d98=_0x29d9[_0x503bc0];return _0x327d98;};'use strict';var _=require(_0x929d('0x0'));var util=require(_0x929d('0x1'));function rewrite(_0x494611,_0x422340){var _0x21c107=this;return _0x494611['models'][_0x929d('0x2')][_0x929d('0x3')]({'raw':!![]})[_0x929d('0x4')](function(_0x5cece1){_0x21c107[_0x929d('0x5')]=_0x5cece1;return _0x494611[_0x929d('0x6')][_0x929d('0x7')]['findAll']({'where':{'IntervalId':_0x422340['IntervalId']},'raw':!![]});})[_0x929d('0x4')](function(_0x154bb9){return _0x494611[_0x929d('0x6')]['VoiceExtension']['findAll']({'where':{'exten':{'$in':_['uniq'](_[_0x929d('0x8')](_0x154bb9,_0x929d('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x929d('0x4')](function(_0x82a8c7){var _0x3db3f8=_[_0x929d('0xa')](_0x82a8c7,{'priority':'1'});var _0x443d6d=_[_0x929d('0xa')](_0x82a8c7,{'isApp':0x1});var _0x5d5dd3=_[_0x929d('0xb')](_0x443d6d,_0x929d('0x9'));var _0x30fa21=[_0x929d('0xc'),'playback'];var _0x268854=[];var _0x69e74e=[];for(var _0xb95b34 in _0x5d5dd3){if(_0x5d5dd3[_0x929d('0xd')](_0xb95b34)){_0x21c107[_0x929d('0xe')]=0x2;_0x21c107['extensions']=[];_0x21c107['extension']=_[_0x929d('0xf')](_0x3db3f8,{'exten':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x9')]});_0x21c107['extensions'][_0x929d('0x10')]({'type':_0x5d5dd3[_0xb95b34][0x0]['type'],'app':'Set','appdata':util['format']('CDR(type)=%s',_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x11')]),'context':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x12')],'exten':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x9')],'priority':_0x21c107['priority']++,'VoiceExtensionId':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x13')]});if(_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x11')]===_0x929d('0x14')){_0x21c107[_0x929d('0x15')][_0x929d('0x10')]({'type':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x11')],'app':'Set','appdata':_0x929d('0x16')+_0x5d5dd3[_0xb95b34][0x0]['VoiceExtensionId'],'context':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x12')],'exten':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x9')],'priority':_0x21c107[_0x929d('0xe')]++,'VoiceExtensionId':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x13')]});}else if(_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x11')]===_0x929d('0x17')){if(_0x21c107[_0x929d('0x18')]){_0x21c107[_0x929d('0x15')][_0x929d('0x10')]({'type':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x11')],'app':_0x929d('0x19'),'appdata':_0x929d('0x1a')+(_0x21c107[_0x929d('0x18')][_0x929d('0x1b')]?_0x929d('0x1c')+_0x21c107[_0x929d('0x18')][_0x929d('0x1b')]+'}':_0x929d('0x1d')),'context':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x12')],'exten':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x9')],'priority':_0x21c107[_0x929d('0xe')]++,'VoiceExtensionId':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x13')]});}_0x21c107[_0x929d('0x15')][_0x929d('0x10')]({'type':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x11')],'app':'Set','appdata':'CDR(routeid)='+_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x13')],'context':_0x5d5dd3[_0xb95b34][0x0]['context'],'exten':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x9')],'priority':_0x21c107[_0x929d('0xe')]++,'VoiceExtensionId':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x13')]});var _0x572eb5=_0x21c107[_0x929d('0xe')]++;_0x21c107[_0x929d('0x15')][_0x929d('0x10')]({'type':_0x5d5dd3[_0xb95b34][0x0]['type'],'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x572eb5+0x2)+_0x929d('0x1e')+(_0x572eb5+0x1)+')','context':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x12')],'exten':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x9')],'priority':_0x572eb5,'VoiceExtensionId':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x13')]});if(_0x21c107['extension']){_0x21c107[_0x929d('0x15')][_0x929d('0x10')]({'type':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x11')],'app':_0x929d('0x19'),'appdata':_0x21c107[_0x929d('0x18')][_0x929d('0x1b')]?_0x929d('0x1f')+_0x21c107['extension']['cutdigits']+'}':_0x929d('0x20'),'context':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x12')],'exten':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x9')],'priority':_0x21c107['priority']++,'VoiceExtensionId':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x13')]});}_0x21c107['extensions'][_0x929d('0x10')]({'type':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x11')],'app':'Set','appdata':_0x929d('0x21')+_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x13')],'context':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x12')],'exten':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x9')],'priority':_0x21c107[_0x929d('0xe')]++,'VoiceExtensionId':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x13')]});if(_0x21c107[_0x929d('0x18')]&&_0x21c107[_0x929d('0x18')][_0x929d('0xd')](_0x929d('0x22'))&&_0x21c107[_0x929d('0x18')][_0x929d('0x22')]!==_0x929d('0x23')){_0x21c107['extensions'][_0x929d('0x10')]({'type':_0x5d5dd3[_0xb95b34][0x0]['type'],'app':_0x929d('0x19'),'appdata':_0x929d('0x24'),'context':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x12')],'exten':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x9')],'priority':_0x21c107['priority']++,'VoiceExtensionId':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x13')]});_0x21c107[_0x929d('0x15')][_0x929d('0x10')]({'type':_0x5d5dd3[_0xb95b34][0x0]['type'],'app':_0x929d('0x19'),'appdata':_0x929d('0x25')+_0x21c107[_0x929d('0x18')][_0x929d('0x22')]||'wav','context':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x12')],'exten':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x9')],'priority':_0x21c107[_0x929d('0xe')]++,'VoiceExtensionId':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x13')]});}}_0x21c107[_0x929d('0x15')][_0x929d('0x10')]({'type':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x11')],'app':_0x929d('0x19'),'appdata':_0x929d('0x26'),'context':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x12')],'exten':_0x5d5dd3[_0xb95b34][0x0]['exten'],'priority':_0x21c107['priority']++,'VoiceExtensionId':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x13')]});_0x21c107[_0x929d('0x15')][_0x929d('0x10')]({'type':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x11')],'app':_0x929d('0x19'),'appdata':_0x929d('0x27'),'context':_0x5d5dd3[_0xb95b34][0x0]['context'],'exten':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x9')],'priority':_0x21c107[_0x929d('0xe')]++,'VoiceExtensionId':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x13')]});_0x21c107[_0x929d('0x15')]['push']({'type':_0x5d5dd3[_0xb95b34][0x0]['type'],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x12')],'exten':_0x5d5dd3[_0xb95b34][0x0]['exten'],'priority':_0x21c107[_0x929d('0xe')]++,'VoiceExtensionId':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x13')]});for(var _0x3c8c96=0x0,_0x28f2bb=0x0;_0x3c8c96<_0x5d5dd3[_0xb95b34][_0x929d('0x28')];_0x3c8c96+=0x1,_0x28f2bb=0x0){var _0x2f4958=_0x5d5dd3[_0xb95b34][_0x3c8c96];if(_0x2f4958[_0x929d('0x11')]){_0x2f4958[_0x929d('0x11')]=_0x2f4958['type']['toLowerCase']();}var _0x2eb832=[];var _0xefb26c=[];delete _0x2f4958['id'];delete _0x2f4958[_0x929d('0x29')];delete _0x2f4958['updatedAt'];var _0x302f99=_0x2f4958[_0x929d('0x2a')]!==_0x929d('0x2b')?[_0x2f4958['interval']]:_0x2f4958[_0x929d('0x2c')]?_[_0x929d('0x8')](_[_0x929d('0xa')](_0x21c107[_0x929d('0x5')],{'IntervalId':_0x2f4958[_0x929d('0x2c')]}),_0x929d('0x2a')):[];if(_0x2f4958['hasOwnProperty'](_0x929d('0x2d'))){if(_0x2f4958['tag']&&_0x2f4958[_0x929d('0x2d')]!=='--'){_0x2eb832[_0x929d('0x10')]({'type':_0x2f4958['type'],'app':'Set','appdata':'CDR(tag)='+_0x2f4958[_0x929d('0x2d')],'context':_0x2f4958[_0x929d('0x12')],'exten':_0x2f4958[_0x929d('0x9')],'priority':_0x302f99[_0x929d('0x28')]+_0x21c107[_0x929d('0xe')]+_0x28f2bb++,'VoiceExtensionId':_0x2f4958[_0x929d('0x13')]});}}if(_0x2f4958[_0x929d('0x11')]===_0x929d('0x17')&&_0x2f4958[_0x929d('0xd')](_0x929d('0x2e'))){if(_0x2f4958[_0x929d('0x2e')]){_0x2eb832[_0x929d('0x10')]({'type':_0x2f4958[_0x929d('0x11')],'app':_0x929d('0x2f'),'appdata':_0x929d('0x30')+_0x2f4958[_0x929d('0x2e')]+')','context':_0x2f4958[_0x929d('0x12')],'exten':_0x2f4958['exten'],'priority':_0x302f99[_0x929d('0x28')]+_0x21c107[_0x929d('0xe')]+_0x28f2bb++,'VoiceExtensionId':_0x2f4958[_0x929d('0x13')]});}else{_0x2eb832[_0x929d('0x10')]({'type':_0x2f4958[_0x929d('0x11')],'app':'ExecIf','appdata':_0x929d('0x31'),'context':_0x2f4958['context'],'exten':_0x2f4958[_0x929d('0x9')],'priority':_0x302f99[_0x929d('0x28')]+_0x21c107['priority']+_0x28f2bb++,'VoiceExtensionId':_0x2f4958[_0x929d('0x13')]});}}if(_0x2f4958[_0x929d('0xd')]('answer')){if(_0x30fa21[_0x929d('0x32')](_0x2f4958[_0x929d('0x33')][_0x929d('0x34')]())>=0x0&&_0x2f4958[_0x929d('0x35')]!=='custom'){if(_0x2f4958[_0x929d('0x36')]){_0x2eb832[_0x929d('0x10')]({'type':_0x2f4958['type'],'app':'ExecIf','appdata':_0x929d('0x37'),'context':_0x2f4958[_0x929d('0x12')],'exten':_0x2f4958[_0x929d('0x9')],'priority':_0x302f99[_0x929d('0x28')]+_0x21c107[_0x929d('0xe')]+_0x28f2bb++,'VoiceExtensionId':_0x2f4958['VoiceExtensionId']});_0x2eb832[_0x929d('0x10')]({'type':_0x2f4958[_0x929d('0x11')],'app':'Set','appdata':_0x929d('0x38'),'context':_0x2f4958[_0x929d('0x12')],'exten':_0x2f4958['exten'],'priority':_0x302f99['length']+_0x21c107[_0x929d('0xe')]+_0x28f2bb++,'VoiceExtensionId':_0x2f4958[_0x929d('0x13')]});}else{_0x2eb832['push']({'type':_0x2f4958[_0x929d('0x11')],'app':_0x929d('0x2f'),'appdata':_0x929d('0x39'),'context':_0x2f4958[_0x929d('0x12')],'exten':_0x2f4958[_0x929d('0x9')],'priority':_0x302f99['length']+_0x21c107['priority']+_0x28f2bb++,'VoiceExtensionId':_0x2f4958[_0x929d('0x13')]});_0x2eb832[_0x929d('0x10')]({'type':_0x2f4958[_0x929d('0x11')],'app':_0x929d('0x19'),'appdata':_0x929d('0x3a'),'context':_0x2f4958[_0x929d('0x12')],'exten':_0x2f4958['exten'],'priority':_0x302f99['length']+_0x21c107[_0x929d('0xe')]+_0x28f2bb++,'VoiceExtensionId':_0x2f4958[_0x929d('0x13')]});}}}for(var _0x16222b=0x0;_0x16222b<_0x302f99['length'];_0x16222b+=0x1){var _0x2f350b=_0x21c107['priority']+_0x302f99[_0x929d('0x28')];var _0x5a0d41=_0x16222b===_0x302f99[_0x929d('0x28')]-0x1?_0x21c107['priority']+_0x2eb832[_0x929d('0x28')]+_0xefb26c[_0x929d('0x28')]+0x2:_0x21c107[_0x929d('0xe')]+_0x16222b+0x1;_0x2eb832[_0x929d('0x3b')](_0x16222b,0x0,{'type':_0x2f4958['type'],'app':'GotoIfTime','appdata':_0x302f99[_0x16222b]+'?'+_0x2f4958[_0x929d('0x12')]+',${EXTEN},'+_0x2f350b+':'+_0x2f4958['context']+_0x929d('0x3c')+_0x5a0d41,'exten':_0x2f4958['exten'],'context':_0x2f4958[_0x929d('0x12')],'priority':_0x21c107[_0x929d('0xe')]+_0x16222b,'VoiceExtensionId':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x13')]});}_0x2f4958['priority']=_0x2eb832[_0x929d('0x28')]?_[_0x929d('0x3d')](_0x2eb832)[_0x929d('0xe')]+0x1:_0x21c107[_0x929d('0xe')];_0x21c107[_0x929d('0xe')]=(_0xefb26c['length']?_[_0x929d('0x3d')](_0xefb26c)[_0x929d('0xe')]:_0x2f4958['priority'])+0x1;_0x21c107[_0x929d('0x15')]=_[_0x929d('0x3e')](_0x21c107[_0x929d('0x15')],_0x2eb832,[_0x2f4958],_0xefb26c);}_0x21c107[_0x929d('0x15')][_0x929d('0x10')]({'type':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x11')],'app':_0x929d('0x3f'),'exten':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x9')],'context':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x12')],'priority':_0x21c107[_0x929d('0xe')],'VoiceExtensionId':_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x13')]});_0x268854[_0x929d('0x10')](_0x5d5dd3[_0xb95b34][0x0][_0x929d('0x13')]);_0x69e74e=_[_0x929d('0x3e')](_0x69e74e,_0x21c107[_0x929d('0x15')]);}}return _0x494611['transaction'](function(_0x1883ee){return _0x494611[_0x929d('0x6')][_0x929d('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x268854}},'transaction':_0x1883ee})[_0x929d('0x4')](function(_0x59c4ee){return _0x494611[_0x929d('0x6')][_0x929d('0x7')][_0x929d('0x40')](_[_0x929d('0x41')](_0x69e74e,_0x929d('0xe')),{'transaction':_0x1883ee});});});})[_0x929d('0x42')](function(_0x465f6a){console[_0x929d('0x43')](_0x465f6a);});}exports[_0x929d('0x44')]=rewrite; \ No newline at end of file +var _0x3e25=['XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','sortBy','catch','error','rewrite','lodash','util','models','findAll','intervals','VoiceExtension','IntervalId','then','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','extensions','find','push','type','Set','priority','VoiceExtensionId','inbound','CDR(routeid)=','context','outbound','extension','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','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','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress'];(function(_0x1e68e9,_0x4393fa){var _0x3948bd=function(_0x1dd6be){while(--_0x1dd6be){_0x1e68e9['push'](_0x1e68e9['shift']());}};_0x3948bd(++_0x4393fa);}(_0x3e25,0x120));var _0x53e2=function(_0xdc460b,_0x56eac8){_0xdc460b=_0xdc460b-0x0;var _0x43f65b=_0x3e25[_0xdc460b];return _0x43f65b;};'use strict';var _=require(_0x53e2('0x0'));var util=require(_0x53e2('0x1'));function rewrite(_0x122dbf,_0x4d9d8a){var _0x4276d9=this;return _0x122dbf[_0x53e2('0x2')]['Interval'][_0x53e2('0x3')]({'raw':!![]})['then'](function(_0xe8fca0){_0x4276d9[_0x53e2('0x4')]=_0xe8fca0;return _0x122dbf[_0x53e2('0x2')][_0x53e2('0x5')]['findAll']({'where':{'IntervalId':_0x4d9d8a[_0x53e2('0x6')]},'raw':!![]});})[_0x53e2('0x7')](function(_0x3b4e9a){return _0x122dbf[_0x53e2('0x2')][_0x53e2('0x5')]['findAll']({'where':{'exten':{'$in':_['uniq'](_['map'](_0x3b4e9a,_0x53e2('0x8')))}},'order':[{'raw':_0x53e2('0x9')}],'raw':!![]});})[_0x53e2('0x7')](function(_0x2d3ec6){var _0x1ef536=_[_0x53e2('0xa')](_0x2d3ec6,{'priority':'1'});var _0x263212=_[_0x53e2('0xa')](_0x2d3ec6,{'isApp':0x1});var _0x37816d=_[_0x53e2('0xb')](_0x263212,_0x53e2('0x8'));var _0xcaa752=[_0x53e2('0xc'),_0x53e2('0xd')];var _0x3786f2=[];var _0x26bf4d=[];for(var _0x3000e1 in _0x37816d){if(_0x37816d['hasOwnProperty'](_0x3000e1)){_0x4276d9['priority']=0x2;_0x4276d9[_0x53e2('0xe')]=[];_0x4276d9['extension']=_[_0x53e2('0xf')](_0x1ef536,{'exten':_0x37816d[_0x3000e1][0x0][_0x53e2('0x8')]});_0x4276d9['extensions'][_0x53e2('0x10')]({'type':_0x37816d[_0x3000e1][0x0][_0x53e2('0x11')],'app':_0x53e2('0x12'),'appdata':util['format']('CDR(type)=%s',_0x37816d[_0x3000e1][0x0][_0x53e2('0x11')]),'context':_0x37816d[_0x3000e1][0x0]['context'],'exten':_0x37816d[_0x3000e1][0x0][_0x53e2('0x8')],'priority':_0x4276d9[_0x53e2('0x13')]++,'VoiceExtensionId':_0x37816d[_0x3000e1][0x0][_0x53e2('0x14')]});if(_0x37816d[_0x3000e1][0x0][_0x53e2('0x11')]===_0x53e2('0x15')){_0x4276d9[_0x53e2('0xe')][_0x53e2('0x10')]({'type':_0x37816d[_0x3000e1][0x0][_0x53e2('0x11')],'app':_0x53e2('0x12'),'appdata':_0x53e2('0x16')+_0x37816d[_0x3000e1][0x0][_0x53e2('0x14')],'context':_0x37816d[_0x3000e1][0x0][_0x53e2('0x17')],'exten':_0x37816d[_0x3000e1][0x0]['exten'],'priority':_0x4276d9[_0x53e2('0x13')]++,'VoiceExtensionId':_0x37816d[_0x3000e1][0x0][_0x53e2('0x14')]});}else if(_0x37816d[_0x3000e1][0x0][_0x53e2('0x11')]===_0x53e2('0x18')){if(_0x4276d9[_0x53e2('0x19')]){_0x4276d9[_0x53e2('0xe')][_0x53e2('0x10')]({'type':_0x37816d[_0x3000e1][0x0][_0x53e2('0x11')],'app':_0x53e2('0x12'),'appdata':'CDR(destination)='+(_0x4276d9[_0x53e2('0x19')][_0x53e2('0x1a')]?_0x53e2('0x1b')+_0x4276d9[_0x53e2('0x19')][_0x53e2('0x1a')]+'}':'${EXTEN}'),'context':_0x37816d[_0x3000e1][0x0][_0x53e2('0x17')],'exten':_0x37816d[_0x3000e1][0x0][_0x53e2('0x8')],'priority':_0x4276d9['priority']++,'VoiceExtensionId':_0x37816d[_0x3000e1][0x0][_0x53e2('0x14')]});}_0x4276d9[_0x53e2('0xe')]['push']({'type':_0x37816d[_0x3000e1][0x0][_0x53e2('0x11')],'app':_0x53e2('0x12'),'appdata':'CDR(routeid)='+_0x37816d[_0x3000e1][0x0][_0x53e2('0x14')],'context':_0x37816d[_0x3000e1][0x0][_0x53e2('0x17')],'exten':_0x37816d[_0x3000e1][0x0][_0x53e2('0x8')],'priority':_0x4276d9[_0x53e2('0x13')]++,'VoiceExtensionId':_0x37816d[_0x3000e1][0x0][_0x53e2('0x14')]});var _0x59c2c6=_0x4276d9[_0x53e2('0x13')]++;_0x4276d9[_0x53e2('0xe')]['push']({'type':_0x37816d[_0x3000e1][0x0][_0x53e2('0x11')],'app':_0x53e2('0x1c'),'appdata':_0x53e2('0x1d')+(_0x59c2c6+0x2)+'):Goto('+(_0x59c2c6+0x1)+')','context':_0x37816d[_0x3000e1][0x0][_0x53e2('0x17')],'exten':_0x37816d[_0x3000e1][0x0]['exten'],'priority':_0x59c2c6,'VoiceExtensionId':_0x37816d[_0x3000e1][0x0][_0x53e2('0x14')]});if(_0x4276d9[_0x53e2('0x19')]){_0x4276d9['extensions']['push']({'type':_0x37816d[_0x3000e1][0x0][_0x53e2('0x11')],'app':_0x53e2('0x12'),'appdata':_0x4276d9[_0x53e2('0x19')][_0x53e2('0x1a')]?_0x53e2('0x1e')+_0x4276d9[_0x53e2('0x19')][_0x53e2('0x1a')]+'}':_0x53e2('0x1f'),'context':_0x37816d[_0x3000e1][0x0][_0x53e2('0x17')],'exten':_0x37816d[_0x3000e1][0x0][_0x53e2('0x8')],'priority':_0x4276d9['priority']++,'VoiceExtensionId':_0x37816d[_0x3000e1][0x0][_0x53e2('0x14')]});}_0x4276d9['extensions']['push']({'type':_0x37816d[_0x3000e1][0x0][_0x53e2('0x11')],'app':_0x53e2('0x12'),'appdata':_0x53e2('0x20')+_0x37816d[_0x3000e1][0x0]['VoiceExtensionId'],'context':_0x37816d[_0x3000e1][0x0]['context'],'exten':_0x37816d[_0x3000e1][0x0][_0x53e2('0x8')],'priority':_0x4276d9[_0x53e2('0x13')]++,'VoiceExtensionId':_0x37816d[_0x3000e1][0x0][_0x53e2('0x14')]});if(_0x4276d9[_0x53e2('0x19')]&&_0x4276d9[_0x53e2('0x19')][_0x53e2('0x21')]('recordingFormat')&&_0x4276d9[_0x53e2('0x19')][_0x53e2('0x22')]!==_0x53e2('0x23')){_0x4276d9[_0x53e2('0xe')][_0x53e2('0x10')]({'type':_0x37816d[_0x3000e1][0x0][_0x53e2('0x11')],'app':_0x53e2('0x12'),'appdata':_0x53e2('0x24'),'context':_0x37816d[_0x3000e1][0x0][_0x53e2('0x17')],'exten':_0x37816d[_0x3000e1][0x0]['exten'],'priority':_0x4276d9[_0x53e2('0x13')]++,'VoiceExtensionId':_0x37816d[_0x3000e1][0x0][_0x53e2('0x14')]});_0x4276d9[_0x53e2('0xe')][_0x53e2('0x10')]({'type':_0x37816d[_0x3000e1][0x0][_0x53e2('0x11')],'app':_0x53e2('0x12'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x4276d9[_0x53e2('0x19')]['recordingFormat']||'wav','context':_0x37816d[_0x3000e1][0x0]['context'],'exten':_0x37816d[_0x3000e1][0x0][_0x53e2('0x8')],'priority':_0x4276d9[_0x53e2('0x13')]++,'VoiceExtensionId':_0x37816d[_0x3000e1][0x0][_0x53e2('0x14')]});}}_0x4276d9[_0x53e2('0xe')][_0x53e2('0x10')]({'type':_0x37816d[_0x3000e1][0x0][_0x53e2('0x11')],'app':_0x53e2('0x12'),'appdata':_0x53e2('0x25'),'context':_0x37816d[_0x3000e1][0x0][_0x53e2('0x17')],'exten':_0x37816d[_0x3000e1][0x0]['exten'],'priority':_0x4276d9[_0x53e2('0x13')]++,'VoiceExtensionId':_0x37816d[_0x3000e1][0x0][_0x53e2('0x14')]});_0x4276d9[_0x53e2('0xe')][_0x53e2('0x10')]({'type':_0x37816d[_0x3000e1][0x0][_0x53e2('0x11')],'app':'Set','appdata':_0x53e2('0x26'),'context':_0x37816d[_0x3000e1][0x0][_0x53e2('0x17')],'exten':_0x37816d[_0x3000e1][0x0]['exten'],'priority':_0x4276d9[_0x53e2('0x13')]++,'VoiceExtensionId':_0x37816d[_0x3000e1][0x0]['VoiceExtensionId']});_0x4276d9[_0x53e2('0xe')]['push']({'type':_0x37816d[_0x3000e1][0x0]['type'],'app':_0x53e2('0x12'),'appdata':'MONITOR_OPTIONS=ab','context':_0x37816d[_0x3000e1][0x0]['context'],'exten':_0x37816d[_0x3000e1][0x0][_0x53e2('0x8')],'priority':_0x4276d9[_0x53e2('0x13')]++,'VoiceExtensionId':_0x37816d[_0x3000e1][0x0]['VoiceExtensionId']});for(var _0x5ded12=0x0,_0x19108b=0x0;_0x5ded12<_0x37816d[_0x3000e1]['length'];_0x5ded12+=0x1,_0x19108b=0x0){var _0x551cb0=_0x37816d[_0x3000e1][_0x5ded12];if(_0x551cb0[_0x53e2('0x11')]){_0x551cb0['type']=_0x551cb0[_0x53e2('0x11')][_0x53e2('0x27')]();}var _0x1bf809=[];var _0x57660a=[];delete _0x551cb0['id'];delete _0x551cb0[_0x53e2('0x28')];delete _0x551cb0[_0x53e2('0x29')];var _0x57062c=_0x551cb0['interval']!==_0x53e2('0x2a')?[_0x551cb0['interval']]:_0x551cb0[_0x53e2('0x6')]?_['map'](_['filter'](_0x4276d9[_0x53e2('0x4')],{'IntervalId':_0x551cb0[_0x53e2('0x6')]}),_0x53e2('0x2b')):[];if(_0x551cb0['hasOwnProperty']('tag')){if(_0x551cb0[_0x53e2('0x2c')]&&_0x551cb0['tag']!=='--'){_0x1bf809[_0x53e2('0x10')]({'type':_0x551cb0[_0x53e2('0x11')],'app':_0x53e2('0x12'),'appdata':'CDR(tag)='+_0x551cb0['tag'],'context':_0x551cb0[_0x53e2('0x17')],'exten':_0x551cb0[_0x53e2('0x8')],'priority':_0x57062c[_0x53e2('0x2d')]+_0x4276d9[_0x53e2('0x13')]+_0x19108b++,'VoiceExtensionId':_0x551cb0[_0x53e2('0x14')]});}}if(_0x551cb0[_0x53e2('0x11')]===_0x53e2('0x18')&&_0x551cb0['hasOwnProperty'](_0x53e2('0x2e'))){if(_0x551cb0[_0x53e2('0x2e')]){_0x1bf809[_0x53e2('0x10')]({'type':_0x551cb0[_0x53e2('0x11')],'app':_0x53e2('0x1c'),'appdata':_0x53e2('0x2f')+_0x551cb0[_0x53e2('0x2e')]+')','context':_0x551cb0['context'],'exten':_0x551cb0[_0x53e2('0x8')],'priority':_0x57062c[_0x53e2('0x2d')]+_0x4276d9['priority']+_0x19108b++,'VoiceExtensionId':_0x551cb0[_0x53e2('0x14')]});}else{_0x1bf809['push']({'type':_0x551cb0[_0x53e2('0x11')],'app':_0x53e2('0x1c'),'appdata':_0x53e2('0x30'),'context':_0x551cb0['context'],'exten':_0x551cb0[_0x53e2('0x8')],'priority':_0x57062c['length']+_0x4276d9[_0x53e2('0x13')]+_0x19108b++,'VoiceExtensionId':_0x551cb0[_0x53e2('0x14')]});}}if(_0x551cb0[_0x53e2('0x21')]('answer')){if(_0xcaa752[_0x53e2('0x31')](_0x551cb0[_0x53e2('0x32')]['toLowerCase']())>=0x0&&_0x551cb0[_0x53e2('0x33')]!==_0x53e2('0x34')){if(_0x551cb0[_0x53e2('0x35')]){_0x1bf809[_0x53e2('0x10')]({'type':_0x551cb0[_0x53e2('0x11')],'app':_0x53e2('0x1c'),'appdata':_0x53e2('0x36'),'context':_0x551cb0['context'],'exten':_0x551cb0[_0x53e2('0x8')],'priority':_0x57062c[_0x53e2('0x2d')]+_0x4276d9[_0x53e2('0x13')]+_0x19108b++,'VoiceExtensionId':_0x551cb0[_0x53e2('0x14')]});_0x1bf809[_0x53e2('0x10')]({'type':_0x551cb0['type'],'app':_0x53e2('0x12'),'appdata':_0x53e2('0x37'),'context':_0x551cb0[_0x53e2('0x17')],'exten':_0x551cb0[_0x53e2('0x8')],'priority':_0x57062c['length']+_0x4276d9[_0x53e2('0x13')]+_0x19108b++,'VoiceExtensionId':_0x551cb0['VoiceExtensionId']});}else{_0x1bf809[_0x53e2('0x10')]({'type':_0x551cb0[_0x53e2('0x11')],'app':_0x53e2('0x1c'),'appdata':_0x53e2('0x38'),'context':_0x551cb0[_0x53e2('0x17')],'exten':_0x551cb0[_0x53e2('0x8')],'priority':_0x57062c['length']+_0x4276d9['priority']+_0x19108b++,'VoiceExtensionId':_0x551cb0[_0x53e2('0x14')]});_0x1bf809['push']({'type':_0x551cb0[_0x53e2('0x11')],'app':'Set','appdata':_0x53e2('0x39'),'context':_0x551cb0[_0x53e2('0x17')],'exten':_0x551cb0[_0x53e2('0x8')],'priority':_0x57062c[_0x53e2('0x2d')]+_0x4276d9['priority']+_0x19108b++,'VoiceExtensionId':_0x551cb0[_0x53e2('0x14')]});}}}for(var _0x514804=0x0;_0x514804<_0x57062c[_0x53e2('0x2d')];_0x514804+=0x1){var _0x435e89=_0x4276d9[_0x53e2('0x13')]+_0x57062c['length'];var _0x13af89=_0x514804===_0x57062c[_0x53e2('0x2d')]-0x1?_0x4276d9[_0x53e2('0x13')]+_0x1bf809[_0x53e2('0x2d')]+_0x57660a['length']+0x2:_0x4276d9['priority']+_0x514804+0x1;_0x1bf809[_0x53e2('0x3a')](_0x514804,0x0,{'type':_0x551cb0['type'],'app':_0x53e2('0x3b'),'appdata':_0x57062c[_0x514804]+'?'+_0x551cb0['context']+_0x53e2('0x3c')+_0x435e89+':'+_0x551cb0[_0x53e2('0x17')]+_0x53e2('0x3c')+_0x13af89,'exten':_0x551cb0[_0x53e2('0x8')],'context':_0x551cb0['context'],'priority':_0x4276d9[_0x53e2('0x13')]+_0x514804,'VoiceExtensionId':_0x37816d[_0x3000e1][0x0]['VoiceExtensionId']});}_0x551cb0[_0x53e2('0x13')]=_0x1bf809['length']?_['last'](_0x1bf809)[_0x53e2('0x13')]+0x1:_0x4276d9[_0x53e2('0x13')];_0x4276d9[_0x53e2('0x13')]=(_0x57660a[_0x53e2('0x2d')]?_[_0x53e2('0x3d')](_0x57660a)[_0x53e2('0x13')]:_0x551cb0['priority'])+0x1;_0x4276d9[_0x53e2('0xe')]=_[_0x53e2('0x3e')](_0x4276d9[_0x53e2('0xe')],_0x1bf809,[_0x551cb0],_0x57660a);}_0x4276d9[_0x53e2('0xe')][_0x53e2('0x10')]({'type':_0x37816d[_0x3000e1][0x0][_0x53e2('0x11')],'app':_0x53e2('0x3f'),'exten':_0x37816d[_0x3000e1][0x0]['exten'],'context':_0x37816d[_0x3000e1][0x0][_0x53e2('0x17')],'priority':_0x4276d9[_0x53e2('0x13')],'VoiceExtensionId':_0x37816d[_0x3000e1][0x0][_0x53e2('0x14')]});_0x3786f2[_0x53e2('0x10')](_0x37816d[_0x3000e1][0x0][_0x53e2('0x14')]);_0x26bf4d=_[_0x53e2('0x3e')](_0x26bf4d,_0x4276d9[_0x53e2('0xe')]);}}return _0x122dbf['transaction'](function(_0x370089){return _0x122dbf[_0x53e2('0x2')]['VoiceExtension'][_0x53e2('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x3786f2}},'transaction':_0x370089})[_0x53e2('0x7')](function(_0x273fe3){return _0x122dbf[_0x53e2('0x2')][_0x53e2('0x5')]['bulkCreate'](_[_0x53e2('0x41')](_0x26bf4d,_0x53e2('0x13')),{'transaction':_0x370089});});});})[_0x53e2('0x42')](function(_0x2b001a){console[_0x53e2('0x43')](_0x2b001a);});}exports[_0x53e2('0x44')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index b4b0c77..33ca523 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 _0x45aa=['map','message','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','create','keys','then','catch','stringify','checkHopper','inspect','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','createdAt','select','field','NOW()','toString','updatedAt','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','insert','from','id\x20IN\x20?','str','\x20=\x20?','cm_contacts','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','push','VoiceQueueId','sequelize','query','all','BlackLists','Campaign','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','duplicate','pause','CSV\x20parse\x20error','bluebird','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','../../../api/cmContact/cmContact.socket','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','errors','length'];(function(_0x4a342e,_0x839a34){var _0x2b0981=function(_0x5d1cd1){while(--_0x5d1cd1){_0x4a342e['push'](_0x4a342e['shift']());}};_0x2b0981(++_0x839a34);}(_0x45aa,0x191));var _0xa45a=function(_0x13a8b9,_0xd4f9a5){_0x13a8b9=_0x13a8b9-0x0;var _0x3e27a1=_0x45aa[_0x13a8b9];return _0x3e27a1;};'use strict';var BPromise=require(_0xa45a('0x0'));var util=require('util');var _=require(_0xa45a('0x1'));var fs=require('fs');var squel=require(_0xa45a('0x2'));var Papa=require(_0xa45a('0x3'));var Redis=require(_0xa45a('0x4'));var db=require(_0xa45a('0x5'))['db'];var config=require(_0xa45a('0x6'));var logger=require(_0xa45a('0x7'))(_0xa45a('0x8'));config[_0xa45a('0x9')]=_[_0xa45a('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa45a('0xb'))['register'](socket);try{if(!process[_0xa45a('0xc')][0x2]||process['argv'][0x2]===_0xa45a('0xd')||process[_0xa45a('0xc')][0x2]==='null'){throw new Error(_0xa45a('0xe'));}var FILEPATH=process[_0xa45a('0xc')][0x2];if(!process[_0xa45a('0xc')][0x3]||process[_0xa45a('0xc')][0x3]===_0xa45a('0xd')||process[_0xa45a('0xc')][0x3]==='null'||!process['argv'][0x4]||process[_0xa45a('0xc')][0x4]===_0xa45a('0xd')||process[_0xa45a('0xc')][0x4]===_0xa45a('0xf')){throw new Error(_0xa45a('0x10'));}var FIELDS=_['zipObject'](process[_0xa45a('0xc')][0x3][_0xa45a('0x11')](','),process[_0xa45a('0xc')][0x4]['split'](','));if(!process['argv'][0x5]||process[_0xa45a('0xc')][0x5]==='undefined'||process[_0xa45a('0xc')][0x5]==='null'){throw new Error(_0xa45a('0x12'));}var LISTID=process[_0xa45a('0xc')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0xa45a('0xc')][0x6]!==_0xa45a('0xd')&&process[_0xa45a('0xc')][0x6]!==_0xa45a('0xf')?process['argv'][0x6]:null;var DUPLICATES=process[_0xa45a('0xc')][0x7]&&process[_0xa45a('0xc')][0x7]!==_0xa45a('0xd')&&process['argv'][0x7]!==_0xa45a('0xf')?process['argv'][0x7]:null;if(!process[_0xa45a('0xc')][0x8]||process[_0xa45a('0xc')][0x8]===_0xa45a('0xd')||process[_0xa45a('0xc')][0x8]===_0xa45a('0xf')){throw new Error(_0xa45a('0x13'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x11089b){logger[_0xa45a('0x14')](_0x11089b);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(_0x1982d9,_0x161798,_0x20ceca,_0x1680a3){var _0x1507fa={'message':_0x161798};_0x1507fa[_0x1982d9]=!![];if(_0x20ceca){_0x1507fa[_0xa45a('0x15')]=_0x20ceca;}if(_0x1680a3){_0x1507fa[_0xa45a('0x16')]=_0x1680a3;}return _0x1507fa;}function isEmail(_0x12d7d3){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))*$/[_0xa45a('0x17')](_0x12d7d3);}function checkRow(_0x1f7b9d,_0x4d2b89,_0x136583){return new BPromise(function(_0x34ab6f,_0x533887){if(_[_0xa45a('0x18')](_0x1f7b9d)){return _0x533887(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x136583));}if(_0x1f7b9d[_0xa45a('0x19')]&&_0x1f7b9d[_0xa45a('0x19')][_0xa45a('0x1a')]){var _0x29a549=_[_0xa45a('0x1b')](_0x1f7b9d[_0xa45a('0x19')],_0xa45a('0x1c'))['join'](';');return _0x533887(handleCheckRowError(_0xa45a('0x14'),_0x29a549,null,_0x136583));}var _0x18b58c={};for(var _0x524e62 in FIELDS){if(FIELDS['hasOwnProperty'](_0x524e62)&&FIELDS[_0x524e62]){_0x18b58c[_0x524e62]=_0x1f7b9d['data'][0x0][FIELDS[_0x524e62]]||_0x1f7b9d[_0xa45a('0x1d')][0x0]['\ufeff'+FIELDS[_0x524e62]];}}if(!_0x18b58c[_0xa45a('0x1e')]){return _0x533887(handleCheckRowError(_0xa45a('0x14'),_0xa45a('0x1f'),null,_0x136583));}if(!_0x18b58c['phone']){return _0x533887(handleCheckRowError(_0xa45a('0x14'),_0xa45a('0x20'),null,_0x136583));}if(_0x18b58c[_0xa45a('0x21')]){var _0x324158=moment(_0x18b58c[_0xa45a('0x21')],_0xa45a('0x22'));if(!_0x324158[_0xa45a('0x23')]()){return _0x533887(handleCheckRowError(_0xa45a('0x14'),_0xa45a('0x24'),null,_0x136583));}}if(_0x18b58c['email']){if(!isEmail(_0x18b58c[_0xa45a('0x25')])){return _0x533887(handleCheckRowError(_0xa45a('0x14'),_0xa45a('0x26'),null,_0x136583));}}_0x18b58c[_0xa45a('0x27')]=LISTID;_0x18b58c[_0xa45a('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x4d2b89){var _0x40e37c={};for(var _0x4ac742=0x0,_0x2db408=DUPLICATES[_0xa45a('0x1a')];_0x4ac742<_0x2db408;_0x4ac742+=0x1){_0x40e37c[DUPLICATES[_0x4ac742]]=_0x18b58c[DUPLICATES[_0x4ac742]];}var _0x15f0c6=_['find'](_0x4d2b89,_0x40e37c);if(_0x15f0c6){return _0x533887(handleCheckRowError('duplicate','Duplicate\x20Contact',_0x15f0c6,_0x136583));}}return db['CmContact'][_0xa45a('0x29')](_0x18b58c,{'raw':!![],'hooks':![],'fields':_[_0xa45a('0x2a')](_0x18b58c)})[_0xa45a('0x2b')](function(_0x3d8815){if(DUPLICATES&&DUPLICATES['length']&&_0x4d2b89){_0x4d2b89['push'](_['pick'](_0x18b58c,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3d8815['id'];return _0x34ab6f();})[_0xa45a('0x2c')](function(_0x1234fc){return _0x533887(handleCheckRowError(_0xa45a('0x14'),'Error\x20while\x20creating\x20contact:\x20'+(_0x1234fc[_0xa45a('0x1c')]||JSON[_0xa45a('0x2d')](_0x1234fc)),null,_0x136583));});});}function checkHopper(){function _0x58488f(){return function(_0x9eac64){logger['error']('cmContact',_0xa45a('0x2e'),util[_0xa45a('0x2f')](_0x9eac64,{'showHidden':![],'depth':null}));};}var _0x1c72ca=function(_0x27127f,_0x3c1da2){var _0x55cd89=squel['insert']()[_0xa45a('0x30')](_0xa45a('0x31'))[_0xa45a('0x32')]([_0xa45a('0x33'),_0xa45a('0x34'),_0xa45a('0x35'),_0xa45a('0x27'),_0x3c1da2,_0xa45a('0x36'),'updatedAt'],squel[_0xa45a('0x37')]()[_0xa45a('0x38')](_0xa45a('0x33'),_0xa45a('0x33'))[_0xa45a('0x38')](_0xa45a('0x39'),_0xa45a('0x34'))[_0xa45a('0x38')]('id',_0xa45a('0x35'))[_0xa45a('0x38')](LISTID[_0xa45a('0x3a')](),_0xa45a('0x27'))[_0xa45a('0x38')](_0x27127f['id'][_0xa45a('0x3a')](),_0x3c1da2)[_0xa45a('0x38')](_0xa45a('0x39'),_0xa45a('0x36'))['field'](_0xa45a('0x39'),_0xa45a('0x3b'))['from']('cm_contacts')[_0xa45a('0x3c')](_0xa45a('0x3d'))[_0xa45a('0x3c')](_0xa45a('0x3e'),LISTID['toString']())['where'](_0xa45a('0x3f'))[_0xa45a('0x3c')](_0xa45a('0x40'),squel[_0xa45a('0x37')]()[_0xa45a('0x38')](_0xa45a('0x33'))['from'](_0xa45a('0x31'))['where'](_0x3c1da2+'\x20=\x20?',_0x27127f['id']['toString']())))['toString']();return _0x55cd89;};var _0x2f5de5=function(_0x5977f4,_0x31d095){var _0x3dbac6=squel[_0xa45a('0x41')]()[_0xa45a('0x30')]('cm_hopper')[_0xa45a('0x32')]([_0xa45a('0x33'),_0xa45a('0x34'),_0xa45a('0x35'),_0xa45a('0x27'),_0x31d095,_0xa45a('0x36'),_0xa45a('0x3b')],squel[_0xa45a('0x37')]()['field'](_0xa45a('0x33'),_0xa45a('0x33'))[_0xa45a('0x38')](_0xa45a('0x39'),_0xa45a('0x34'))[_0xa45a('0x38')]('id','ContactId')['field'](LISTID['toString'](),_0xa45a('0x27'))[_0xa45a('0x38')](_0x5977f4['id'][_0xa45a('0x3a')](),_0x31d095)[_0xa45a('0x38')](_0xa45a('0x39'),_0xa45a('0x36'))[_0xa45a('0x38')](_0xa45a('0x39'),_0xa45a('0x3b'))[_0xa45a('0x42')]('cm_contacts')[_0xa45a('0x3c')]('deletedAt\x20IS\x20NULL')['where'](_0xa45a('0x3e'),LISTID[_0xa45a('0x3a')]())[_0xa45a('0x3c')](_0xa45a('0x43'),squel[_0xa45a('0x44')](hopperContacts))[_0xa45a('0x3c')](_0xa45a('0x3f'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xa45a('0x37')]()[_0xa45a('0x38')]('calleridnum')[_0xa45a('0x42')]('cm_hopper_final')[_0xa45a('0x3c')](_0x31d095+_0xa45a('0x45'),_0x5977f4['id'][_0xa45a('0x3a')]()))[_0xa45a('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0xa45a('0x37')]()[_0xa45a('0x38')](_0xa45a('0x33'))[_0xa45a('0x42')]('cm_hopper')[_0xa45a('0x3c')](_0x31d095+_0xa45a('0x45'),_0x5977f4['id'][_0xa45a('0x3a')]())))[_0xa45a('0x3a')]();return _0x3dbac6;};function _0x355403(_0x24ab30,_0x39c00e){var _0x92bc78=squel[_0xa45a('0x41')]()[_0xa45a('0x30')]('cm_hopper')[_0xa45a('0x32')]([_0xa45a('0x33'),_0xa45a('0x34'),'ContactId',_0xa45a('0x27'),_0x39c00e,_0xa45a('0x36'),_0xa45a('0x3b')],squel[_0xa45a('0x37')]()['field'](_0xa45a('0x33'),_0xa45a('0x33'))['field'](_0xa45a('0x39'),'scheduledAt')[_0xa45a('0x38')]('id',_0xa45a('0x35'))[_0xa45a('0x38')](LISTID[_0xa45a('0x3a')](),'ListId')[_0xa45a('0x38')](_0x24ab30['id']['toString'](),_0x39c00e)['field'](_0xa45a('0x39'),_0xa45a('0x36'))[_0xa45a('0x38')]('NOW()','updatedAt')[_0xa45a('0x42')](_0xa45a('0x46'))[_0xa45a('0x3c')](_0xa45a('0x3d'))['where']('ListId\x20=\x20?',LISTID[_0xa45a('0x3a')]())[_0xa45a('0x3c')](_0xa45a('0x43'),squel['str'](hopperContacts))[_0xa45a('0x3c')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x92bc78;}function _0x907d22(_0xef4c95,_0x64a73f){var _0x5aca8d=squel[_0xa45a('0x41')]()[_0xa45a('0x30')](_0xa45a('0x47'))[_0xa45a('0x32')](['phone','ContactId',_0xa45a('0x27'),_0x64a73f,_0xa45a('0x36'),_0xa45a('0x3b')],squel['select']()['field']('phone',_0xa45a('0x33'))['field']('id',_0xa45a('0x35'))[_0xa45a('0x38')](LISTID[_0xa45a('0x3a')](),_0xa45a('0x27'))[_0xa45a('0x38')](_0xef4c95['id']['toString'](),_0x64a73f)[_0xa45a('0x38')](_0xa45a('0x39'),_0xa45a('0x36'))[_0xa45a('0x38')](_0xa45a('0x39'),_0xa45a('0x3b'))['from'](_0xa45a('0x46'))[_0xa45a('0x3c')](_0xa45a('0x3d'))[_0xa45a('0x3c')](_0xa45a('0x3e'),LISTID['toString']())[_0xa45a('0x3c')](_0xa45a('0x43'),squel[_0xa45a('0x44')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0xa45a('0x3a')]();return _0x5aca8d;}return db[_0xa45a('0x48')][_0xa45a('0x49')]({'where':{'type':_0xa45a('0x4a')},'attributes':['id',_0xa45a('0x4b')],'include':[{'model':db[_0xa45a('0x4c')],'as':_0xa45a('0x4d'),'where':{'id':LISTID}}]})['then'](function(_0x1d714b){var _0x4916cd=[];if(_0x1d714b){var _0x55513;for(var _0x4eed15=0x0,_0x373183;_0x4eed15<_0x1d714b[_0xa45a('0x1a')];_0x4eed15+=0x1){_0x373183=_0x1d714b[_0x4eed15][_0xa45a('0x4e')]({'plain':!![]});switch(_0x373183[_0xa45a('0x4b')]){case _0xa45a('0x4f'):_0x4916cd[_0xa45a('0x50')](db['sequelize']['query'](_0x2f5de5(_0x373183,_0xa45a('0x51')))['then'](function(){})['catch'](_0x58488f()));break;case'onlyIfOpen':_0x4916cd['push'](db[_0xa45a('0x52')][_0xa45a('0x53')](_0x1c72ca(_0x373183,_0xa45a('0x51')))['then'](function(){})[_0xa45a('0x2c')](_0x58488f()));break;default:_0x4916cd[_0xa45a('0x50')](db['sequelize'][_0xa45a('0x53')](_0x355403(_0x373183,_0xa45a('0x51')))[_0xa45a('0x2b')](function(){})[_0xa45a('0x2c')](_0x58488f()));}}}return _0x4916cd;})[_0xa45a('0x54')]()['then'](function(){return db[_0xa45a('0x48')][_0xa45a('0x49')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xa45a('0x4c')],'as':_0xa45a('0x55'),'where':{'id':LISTID}}]})['then'](function(_0x42f2ff){var _0xf59283=[];if(_0x42f2ff){var _0x51485e;for(var _0x5539d6=0x0,_0x26f186;_0x5539d6<_0x42f2ff[_0xa45a('0x1a')];_0x5539d6+=0x1){_0x26f186=_0x42f2ff[_0x5539d6][_0xa45a('0x4e')]({'plain':!![]});_0xf59283['push'](db[_0xa45a('0x52')]['query'](_0x907d22(_0x26f186,_0xa45a('0x51')))[_0xa45a('0x2b')](function(){})[_0xa45a('0x2c')](_0x58488f()));}}return _0xf59283;})[_0xa45a('0x54')]();})[_0xa45a('0x2b')](function(){return db[_0xa45a('0x56')]['findAll']({'attributes':['id',_0xa45a('0x4b')],'include':[{'model':db[_0xa45a('0x4c')],'as':_0xa45a('0x4d'),'where':{'id':LISTID}}]})[_0xa45a('0x2b')](function(_0x2dca68){var _0x4da804=[];if(_0x2dca68){for(var _0x18e526=0x0,_0x16d743;_0x18e526<_0x2dca68[_0xa45a('0x1a')];_0x18e526+=0x1){_0x16d743=_0x2dca68[_0x18e526][_0xa45a('0x4e')]({'plain':!![]});switch(_0x16d743[_0xa45a('0x4b')]){case _0xa45a('0x4f'):_0x4da804['push'](db[_0xa45a('0x52')][_0xa45a('0x53')](_0x2f5de5(_0x16d743,_0xa45a('0x57')))['then'](function(){})[_0xa45a('0x2c')](_0x58488f()));break;case _0xa45a('0x58'):_0x4da804[_0xa45a('0x50')](db['sequelize']['query'](_0x1c72ca(_0x16d743,_0xa45a('0x57')))[_0xa45a('0x2b')](function(){})[_0xa45a('0x2c')](_0x58488f()));break;default:_0x4da804[_0xa45a('0x50')](db[_0xa45a('0x52')]['query'](_0x355403(_0x16d743,_0xa45a('0x57')))[_0xa45a('0x2b')](function(){})['catch'](_0x58488f()));}}}return _0x4da804;})[_0xa45a('0x54')]();})[_0xa45a('0x2b')](function(){return db[_0xa45a('0x56')][_0xa45a('0x49')]({'attributes':['id'],'include':[{'model':db[_0xa45a('0x4c')],'as':_0xa45a('0x55'),'where':{'id':LISTID}}]})[_0xa45a('0x2b')](function(_0x16a627){var _0x13c2d6=[];if(_0x16a627){for(var _0x365d39=0x0,_0x27b820;_0x365d39<_0x16a627[_0xa45a('0x1a')];_0x365d39+=0x1){_0x27b820=_0x16a627[_0x365d39]['get']({'plain':!![]});_0x13c2d6[_0xa45a('0x50')](db[_0xa45a('0x52')][_0xa45a('0x53')](_0x907d22(_0x27b820,_0xa45a('0x57')))[_0xa45a('0x2b')](function(){})[_0xa45a('0x2c')](_0x58488f()));}}return _0x13c2d6;})['all']();})[_0xa45a('0x2c')](function(_0x538a02){logger[_0xa45a('0x14')](_0xa45a('0x59'),_0xa45a('0x5a'),_0x538a02[_0xa45a('0x1c')]);});}var processPromises=function(_0x2a6b7a){return BPromise[_0xa45a('0x54')](promises)['then'](function(_0x295805){})['catch'](function(_0x358c14){logger['error'](_0xa45a('0x5b'),JSON[_0xa45a('0x2d')](_0x358c14));})[_0xa45a('0x5c')](function(){socket[_0xa45a('0x5d')](_0xa45a('0x5e')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2a6b7a){return _0x2a6b7a[_0xa45a('0x5f')]();}});};var endCsv=function(){return BPromise[_0xa45a('0x60')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xa45a('0x2b')](function(){socket[_0xa45a('0x5d')](_0xa45a('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xa45a('0x61')](FILEPATH);}catch(_0x30df7b){logger['error'](_0xa45a('0x62'),JSON[_0xa45a('0x2d')](_0x30df7b));}finally{process[_0xa45a('0x63')](0x0);}});};process['on']('SIGINT',function(){logger[_0xa45a('0x64')](_0xa45a('0x65'));endCsv();});function main(){return BPromise[_0xa45a('0x60')]()[_0xa45a('0x2b')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xa45a('0x11')](',');return db[_0xa45a('0x66')][_0xa45a('0x49')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xa45a('0x2b')](function(_0x55d435){var _0x1442b=fs[_0xa45a('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x1442b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1c1b83,_0x197ebb){total+=0x1;var _0x59b066=total;promises[_0xa45a('0x50')](checkRow(_0x1c1b83,_0x55d435,_0x59b066)[_0xa45a('0x2b')](function(){success+=0x1;})[_0xa45a('0x2c')](function(_0x3f457e){if(_0x3f457e[_0xa45a('0x14')]){errors+=0x1;delete _0x3f457e[_0xa45a('0x14')];}else if(_0x3f457e[_0xa45a('0x68')]){duplicates+=0x1;delete _0x3f457e[_0xa45a('0x68')];}rows['push'](_0x3f457e);}));if(total%0xc8===0x0){_0x197ebb[_0xa45a('0x69')]();return processPromises(_0x197ebb);}},'complete':function(){return processPromises()['then'](function(){logger[_0xa45a('0x64')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x464915,_0x59242c){logger['info'](_0xa45a('0x6a'),JSON[_0xa45a('0x2d')](_0x464915));endCsv();}});})['catch'](function(_0x266b4b){logger[_0xa45a('0x14')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0xa45a('0x2d')](_0x266b4b));});}main(); \ No newline at end of file +var _0xb6cb=['socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','CompanyId','find','duplicate','CmContact','keys','then','push','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','insert','cm_hopper','fromQuery','phone','scheduledAt','ListId','createdAt','updatedAt','field','NOW()','ContactId','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','select','\x20=\x20?','into','id\x20IN\x20?','phone\x20NOT\x20IN\x20(?)','calleridnum','str','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','query','catch','onlyIfOpen','all','VoiceQueue','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','emit','resume','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost'];(function(_0x59a004,_0x3f21e9){var _0x5927b8=function(_0x1107b2){while(--_0x1107b2){_0x59a004['push'](_0x59a004['shift']());}};_0x5927b8(++_0x3f21e9);}(_0xb6cb,0x19e));var _0xbb6c=function(_0x5178fb,_0x121e19){_0x5178fb=_0x5178fb-0x0;var _0x348183=_0xb6cb[_0x5178fb];return _0x348183;};'use strict';var BPromise=require('bluebird');var util=require(_0xbb6c('0x0'));var _=require(_0xbb6c('0x1'));var fs=require('fs');var squel=require(_0xbb6c('0x2'));var Papa=require(_0xbb6c('0x3'));var Redis=require(_0xbb6c('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0xbb6c('0x5'));var logger=require(_0xbb6c('0x6'))('api');config[_0xbb6c('0x7')]=_[_0xbb6c('0x8')](config['redis'],{'host':_0xbb6c('0x9'),'port':0x18eb});var socket=require(_0xbb6c('0xa'))(new Redis(config[_0xbb6c('0x7')]));require(_0xbb6c('0xb'))[_0xbb6c('0xc')](socket);try{if(!process[_0xbb6c('0xd')][0x2]||process[_0xbb6c('0xd')][0x2]===_0xbb6c('0xe')||process[_0xbb6c('0xd')][0x2]===_0xbb6c('0xf')){throw new Error(_0xbb6c('0x10'));}var FILEPATH=process[_0xbb6c('0xd')][0x2];if(!process[_0xbb6c('0xd')][0x3]||process[_0xbb6c('0xd')][0x3]==='undefined'||process[_0xbb6c('0xd')][0x3]==='null'||!process[_0xbb6c('0xd')][0x4]||process[_0xbb6c('0xd')][0x4]==='undefined'||process['argv'][0x4]===_0xbb6c('0xf')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_['zipObject'](process[_0xbb6c('0xd')][0x3][_0xbb6c('0x11')](','),process['argv'][0x4]['split'](','));if(!process[_0xbb6c('0xd')][0x5]||process['argv'][0x5]===_0xbb6c('0xe')||process['argv'][0x5]===_0xbb6c('0xf')){throw new Error(_0xbb6c('0x12'));}var LISTID=process[_0xbb6c('0xd')][0x5];var COMPANYID=process[_0xbb6c('0xd')][0x6]&&process[_0xbb6c('0xd')][0x6]!==_0xbb6c('0xe')&&process[_0xbb6c('0xd')][0x6]!==_0xbb6c('0xf')?process[_0xbb6c('0xd')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process['argv'][0x7]!==_0xbb6c('0xe')&&process[_0xbb6c('0xd')][0x7]!=='null'?process[_0xbb6c('0xd')][0x7]:null;if(!process['argv'][0x8]||process[_0xbb6c('0xd')][0x8]===_0xbb6c('0xe')||process['argv'][0x8]===_0xbb6c('0xf')){throw new Error(_0xbb6c('0x13'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x1bb554){logger[_0xbb6c('0x14')](_0x1bb554);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(_0x515572,_0x1ec318,_0x4892d8,_0x5ecd6e){var _0x1a1167={'message':_0x1ec318};_0x1a1167[_0x515572]=!![];if(_0x4892d8){_0x1a1167['contact']=_0x4892d8;}if(_0x5ecd6e){_0x1a1167[_0xbb6c('0x15')]=_0x5ecd6e;}return _0x1a1167;}function isEmail(_0x15de5c){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'](_0x15de5c);}function checkRow(_0x3928e3,_0x1d03c3,_0x5ca164){return new BPromise(function(_0x5086b1,_0x2a4de8){if(_[_0xbb6c('0x16')](_0x3928e3)){return _0x2a4de8(handleCheckRowError(_0xbb6c('0x14'),_0xbb6c('0x17'),null,_0x5ca164));}if(_0x3928e3[_0xbb6c('0x18')]&&_0x3928e3[_0xbb6c('0x18')][_0xbb6c('0x19')]){var _0x8eee63=_[_0xbb6c('0x1a')](_0x3928e3[_0xbb6c('0x18')],_0xbb6c('0x1b'))[_0xbb6c('0x1c')](';');return _0x2a4de8(handleCheckRowError(_0xbb6c('0x14'),_0x8eee63,null,_0x5ca164));}var _0x3512c1={};for(var _0x247c54 in FIELDS){if(FIELDS[_0xbb6c('0x1d')](_0x247c54)&&FIELDS[_0x247c54]){_0x3512c1[_0x247c54]=_0x3928e3[_0xbb6c('0x1e')][0x0][FIELDS[_0x247c54]]||_0x3928e3[_0xbb6c('0x1e')][0x0]['\ufeff'+FIELDS[_0x247c54]];}}if(!_0x3512c1[_0xbb6c('0x1f')]){return _0x2a4de8(handleCheckRowError(_0xbb6c('0x14'),_0xbb6c('0x20'),null,_0x5ca164));}if(!_0x3512c1['phone']){return _0x2a4de8(handleCheckRowError(_0xbb6c('0x14'),'phone\x20not\x20specified!',null,_0x5ca164));}if(_0x3512c1[_0xbb6c('0x21')]){var _0x50108c=moment(_0x3512c1[_0xbb6c('0x21')],_0xbb6c('0x22'));if(!_0x50108c[_0xbb6c('0x23')]()){return _0x2a4de8(handleCheckRowError(_0xbb6c('0x14'),_0xbb6c('0x24'),null,_0x5ca164));}}if(_0x3512c1[_0xbb6c('0x25')]){if(!isEmail(_0x3512c1['email'])){return _0x2a4de8(handleCheckRowError(_0xbb6c('0x14'),'email\x20format\x20is\x20not\x20valid!',null,_0x5ca164));}}_0x3512c1['ListId']=LISTID;_0x3512c1[_0xbb6c('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x1d03c3){var _0x19bdba={};for(var _0x156453=0x0,_0x44d3b0=DUPLICATES['length'];_0x156453<_0x44d3b0;_0x156453+=0x1){_0x19bdba[DUPLICATES[_0x156453]]=_0x3512c1[DUPLICATES[_0x156453]];}var _0x318603=_[_0xbb6c('0x27')](_0x1d03c3,_0x19bdba);if(_0x318603){return _0x2a4de8(handleCheckRowError(_0xbb6c('0x28'),'Duplicate\x20Contact',_0x318603,_0x5ca164));}}return db[_0xbb6c('0x29')]['create'](_0x3512c1,{'raw':!![],'hooks':![],'fields':_[_0xbb6c('0x2a')](_0x3512c1)})[_0xbb6c('0x2b')](function(_0x5617fc){if(DUPLICATES&&DUPLICATES[_0xbb6c('0x19')]&&_0x1d03c3){_0x1d03c3[_0xbb6c('0x2c')](_['pick'](_0x3512c1,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x5617fc['id'];return _0x5086b1();})['catch'](function(_0x5c1805){return _0x2a4de8(handleCheckRowError(_0xbb6c('0x14'),_0xbb6c('0x2d')+(_0x5c1805[_0xbb6c('0x1b')]||JSON[_0xbb6c('0x2e')](_0x5c1805)),null,_0x5ca164));});});}function checkHopper(){function _0xc6ba8b(){return function(_0x4b00a0){logger[_0xbb6c('0x14')]('cmContact',_0xbb6c('0x2f'),util['inspect'](_0x4b00a0,{'showHidden':![],'depth':null}));};}var _0x3c6476=function(_0x376ca4,_0x235b7d){var _0x3d84f2=squel[_0xbb6c('0x30')]()['into'](_0xbb6c('0x31'))[_0xbb6c('0x32')]([_0xbb6c('0x33'),_0xbb6c('0x34'),'ContactId',_0xbb6c('0x35'),_0x235b7d,_0xbb6c('0x36'),_0xbb6c('0x37')],squel['select']()[_0xbb6c('0x38')]('phone',_0xbb6c('0x33'))[_0xbb6c('0x38')](_0xbb6c('0x39'),_0xbb6c('0x34'))[_0xbb6c('0x38')]('id',_0xbb6c('0x3a'))[_0xbb6c('0x38')](LISTID[_0xbb6c('0x3b')](),_0xbb6c('0x35'))[_0xbb6c('0x38')](_0x376ca4['id']['toString'](),_0x235b7d)[_0xbb6c('0x38')](_0xbb6c('0x39'),'createdAt')[_0xbb6c('0x38')]('NOW()',_0xbb6c('0x37'))[_0xbb6c('0x3c')](_0xbb6c('0x3d'))[_0xbb6c('0x3e')](_0xbb6c('0x3f'))[_0xbb6c('0x3e')](_0xbb6c('0x40'),LISTID['toString']())['where'](_0xbb6c('0x41'))[_0xbb6c('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0xbb6c('0x42')]()['field'](_0xbb6c('0x33'))[_0xbb6c('0x3c')]('cm_hopper')[_0xbb6c('0x3e')](_0x235b7d+_0xbb6c('0x43'),_0x376ca4['id']['toString']())))[_0xbb6c('0x3b')]();return _0x3d84f2;};var _0x18c130=function(_0x594931,_0x25490f){var _0x4b4f40=squel[_0xbb6c('0x30')]()[_0xbb6c('0x44')](_0xbb6c('0x31'))[_0xbb6c('0x32')]([_0xbb6c('0x33'),_0xbb6c('0x34'),_0xbb6c('0x3a'),_0xbb6c('0x35'),_0x25490f,_0xbb6c('0x36'),_0xbb6c('0x37')],squel[_0xbb6c('0x42')]()[_0xbb6c('0x38')](_0xbb6c('0x33'),_0xbb6c('0x33'))['field']('NOW()','scheduledAt')[_0xbb6c('0x38')]('id',_0xbb6c('0x3a'))[_0xbb6c('0x38')](LISTID[_0xbb6c('0x3b')](),_0xbb6c('0x35'))[_0xbb6c('0x38')](_0x594931['id'][_0xbb6c('0x3b')](),_0x25490f)['field']('NOW()',_0xbb6c('0x36'))[_0xbb6c('0x38')](_0xbb6c('0x39'),_0xbb6c('0x37'))['from'](_0xbb6c('0x3d'))[_0xbb6c('0x3e')]('deletedAt\x20IS\x20NULL')[_0xbb6c('0x3e')](_0xbb6c('0x40'),LISTID[_0xbb6c('0x3b')]())[_0xbb6c('0x3e')](_0xbb6c('0x45'),squel['str'](hopperContacts))[_0xbb6c('0x3e')](_0xbb6c('0x41'))['where'](_0xbb6c('0x46'),squel['select']()[_0xbb6c('0x38')](_0xbb6c('0x47'))[_0xbb6c('0x3c')]('cm_hopper_final')[_0xbb6c('0x3e')](_0x25490f+'\x20=\x20?',_0x594931['id']['toString']()))[_0xbb6c('0x3e')](_0xbb6c('0x46'),squel[_0xbb6c('0x42')]()[_0xbb6c('0x38')](_0xbb6c('0x33'))[_0xbb6c('0x3c')](_0xbb6c('0x31'))['where'](_0x25490f+_0xbb6c('0x43'),_0x594931['id'][_0xbb6c('0x3b')]())))[_0xbb6c('0x3b')]();return _0x4b4f40;};function _0xb02d5f(_0x34597e,_0x48db17){var _0x433709=squel[_0xbb6c('0x30')]()[_0xbb6c('0x44')](_0xbb6c('0x31'))['fromQuery']([_0xbb6c('0x33'),_0xbb6c('0x34'),_0xbb6c('0x3a'),_0xbb6c('0x35'),_0x48db17,_0xbb6c('0x36'),'updatedAt'],squel[_0xbb6c('0x42')]()[_0xbb6c('0x38')](_0xbb6c('0x33'),'phone')[_0xbb6c('0x38')](_0xbb6c('0x39'),_0xbb6c('0x34'))['field']('id',_0xbb6c('0x3a'))[_0xbb6c('0x38')](LISTID[_0xbb6c('0x3b')](),_0xbb6c('0x35'))[_0xbb6c('0x38')](_0x34597e['id'][_0xbb6c('0x3b')](),_0x48db17)['field'](_0xbb6c('0x39'),_0xbb6c('0x36'))[_0xbb6c('0x38')](_0xbb6c('0x39'),_0xbb6c('0x37'))[_0xbb6c('0x3c')](_0xbb6c('0x3d'))[_0xbb6c('0x3e')](_0xbb6c('0x3f'))[_0xbb6c('0x3e')](_0xbb6c('0x40'),LISTID[_0xbb6c('0x3b')]())[_0xbb6c('0x3e')](_0xbb6c('0x45'),squel[_0xbb6c('0x48')](hopperContacts))[_0xbb6c('0x3e')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x433709;}function _0x867108(_0x2f2519,_0x5dade0){var _0x137457=squel[_0xbb6c('0x30')]()[_0xbb6c('0x44')]('cm_hopper_black')[_0xbb6c('0x32')]([_0xbb6c('0x33'),_0xbb6c('0x3a'),_0xbb6c('0x35'),_0x5dade0,'createdAt','updatedAt'],squel[_0xbb6c('0x42')]()[_0xbb6c('0x38')](_0xbb6c('0x33'),_0xbb6c('0x33'))['field']('id','ContactId')['field'](LISTID[_0xbb6c('0x3b')](),_0xbb6c('0x35'))[_0xbb6c('0x38')](_0x2f2519['id'][_0xbb6c('0x3b')](),_0x5dade0)['field'](_0xbb6c('0x39'),_0xbb6c('0x36'))['field']('NOW()','updatedAt')[_0xbb6c('0x3c')](_0xbb6c('0x3d'))[_0xbb6c('0x3e')](_0xbb6c('0x3f'))[_0xbb6c('0x3e')](_0xbb6c('0x40'),LISTID[_0xbb6c('0x3b')]())[_0xbb6c('0x3e')](_0xbb6c('0x45'),squel['str'](hopperContacts))[_0xbb6c('0x3e')](_0xbb6c('0x41')))[_0xbb6c('0x3b')]();return _0x137457;}return db['VoiceQueue'][_0xbb6c('0x49')]({'where':{'type':_0xbb6c('0x4a')},'attributes':['id',_0xbb6c('0x4b')],'include':[{'model':db[_0xbb6c('0x4c')],'as':_0xbb6c('0x4d'),'where':{'id':LISTID}}]})['then'](function(_0x54039b){var _0x371250=[];if(_0x54039b){var _0x1de611;for(var _0xf0996e=0x0,_0x5e5904;_0xf0996e<_0x54039b[_0xbb6c('0x19')];_0xf0996e+=0x1){_0x5e5904=_0x54039b[_0xf0996e][_0xbb6c('0x4e')]({'plain':!![]});switch(_0x5e5904['dialCheckDuplicateType']){case _0xbb6c('0x4f'):_0x371250[_0xbb6c('0x2c')](db[_0xbb6c('0x50')][_0xbb6c('0x51')](_0x18c130(_0x5e5904,'VoiceQueueId'))['then'](function(){})[_0xbb6c('0x52')](_0xc6ba8b()));break;case _0xbb6c('0x53'):_0x371250[_0xbb6c('0x2c')](db['sequelize'][_0xbb6c('0x51')](_0x3c6476(_0x5e5904,'VoiceQueueId'))[_0xbb6c('0x2b')](function(){})[_0xbb6c('0x52')](_0xc6ba8b()));break;default:_0x371250['push'](db[_0xbb6c('0x50')]['query'](_0xb02d5f(_0x5e5904,'VoiceQueueId'))['then'](function(){})[_0xbb6c('0x52')](_0xc6ba8b()));}}}return _0x371250;})[_0xbb6c('0x54')]()['then'](function(){return db[_0xbb6c('0x55')][_0xbb6c('0x49')]({'where':{'type':_0xbb6c('0x4a')},'attributes':['id'],'include':[{'model':db[_0xbb6c('0x4c')],'as':_0xbb6c('0x56'),'where':{'id':LISTID}}]})[_0xbb6c('0x2b')](function(_0x592a6d){var _0x432320=[];if(_0x592a6d){var _0x1f51d7;for(var _0x5aeddd=0x0,_0x45d597;_0x5aeddd<_0x592a6d['length'];_0x5aeddd+=0x1){_0x45d597=_0x592a6d[_0x5aeddd][_0xbb6c('0x4e')]({'plain':!![]});_0x432320['push'](db[_0xbb6c('0x50')]['query'](_0x867108(_0x45d597,'VoiceQueueId'))[_0xbb6c('0x2b')](function(){})[_0xbb6c('0x52')](_0xc6ba8b()));}}return _0x432320;})[_0xbb6c('0x54')]();})[_0xbb6c('0x2b')](function(){return db[_0xbb6c('0x57')][_0xbb6c('0x49')]({'attributes':['id',_0xbb6c('0x4b')],'include':[{'model':db[_0xbb6c('0x4c')],'as':_0xbb6c('0x4d'),'where':{'id':LISTID}}]})[_0xbb6c('0x2b')](function(_0x4c054a){var _0x3978d3=[];if(_0x4c054a){for(var _0x4899e=0x0,_0x50c084;_0x4899e<_0x4c054a[_0xbb6c('0x19')];_0x4899e+=0x1){_0x50c084=_0x4c054a[_0x4899e][_0xbb6c('0x4e')]({'plain':!![]});switch(_0x50c084[_0xbb6c('0x4b')]){case _0xbb6c('0x4f'):_0x3978d3['push'](db[_0xbb6c('0x50')][_0xbb6c('0x51')](_0x18c130(_0x50c084,_0xbb6c('0x58')))[_0xbb6c('0x2b')](function(){})[_0xbb6c('0x52')](_0xc6ba8b()));break;case _0xbb6c('0x53'):_0x3978d3[_0xbb6c('0x2c')](db[_0xbb6c('0x50')][_0xbb6c('0x51')](_0x3c6476(_0x50c084,_0xbb6c('0x58')))['then'](function(){})[_0xbb6c('0x52')](_0xc6ba8b()));break;default:_0x3978d3[_0xbb6c('0x2c')](db[_0xbb6c('0x50')]['query'](_0xb02d5f(_0x50c084,_0xbb6c('0x58')))[_0xbb6c('0x2b')](function(){})['catch'](_0xc6ba8b()));}}}return _0x3978d3;})['all']();})[_0xbb6c('0x2b')](function(){return db[_0xbb6c('0x57')][_0xbb6c('0x49')]({'attributes':['id'],'include':[{'model':db[_0xbb6c('0x4c')],'as':_0xbb6c('0x56'),'where':{'id':LISTID}}]})['then'](function(_0x52b070){var _0x25068c=[];if(_0x52b070){for(var _0x3e8276=0x0,_0x26e2f6;_0x3e8276<_0x52b070[_0xbb6c('0x19')];_0x3e8276+=0x1){_0x26e2f6=_0x52b070[_0x3e8276][_0xbb6c('0x4e')]({'plain':!![]});_0x25068c[_0xbb6c('0x2c')](db[_0xbb6c('0x50')][_0xbb6c('0x51')](_0x867108(_0x26e2f6,_0xbb6c('0x58')))[_0xbb6c('0x2b')](function(){})[_0xbb6c('0x52')](_0xc6ba8b()));}}return _0x25068c;})[_0xbb6c('0x54')]();})[_0xbb6c('0x52')](function(_0x2d96b2){logger[_0xbb6c('0x14')](_0xbb6c('0x59'),'generalCheckHopper',_0x2d96b2[_0xbb6c('0x1b')]);});}var processPromises=function(_0x1cb881){return BPromise[_0xbb6c('0x54')](promises)[_0xbb6c('0x2b')](function(_0x479409){})[_0xbb6c('0x52')](function(_0x3ebdf){logger['error'](_0xbb6c('0x5a'),JSON[_0xbb6c('0x2e')](_0x3ebdf));})['finally'](function(){socket[_0xbb6c('0x5b')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1cb881){return _0x1cb881[_0xbb6c('0x5c')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xbb6c('0x5b')](_0xbb6c('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xbb6c('0x5e')](FILEPATH);}catch(_0x4e09ef){logger[_0xbb6c('0x14')](_0xbb6c('0x5f'),JSON[_0xbb6c('0x2e')](_0x4e09ef));}finally{process[_0xbb6c('0x60')](0x0);}});};process['on'](_0xbb6c('0x61'),function(){logger[_0xbb6c('0x62')](_0xbb6c('0x63'));endCsv();});function main(){return BPromise[_0xbb6c('0x64')]()[_0xbb6c('0x2b')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xbb6c('0x11')](',');return db[_0xbb6c('0x29')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xbb6c('0x2b')](function(_0x18a803){var _0x13248f=fs[_0xbb6c('0x65')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xbb6c('0x66')](_0x13248f,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1b0607,_0x1aa3ca){total+=0x1;var _0x2ac716=total;promises[_0xbb6c('0x2c')](checkRow(_0x1b0607,_0x18a803,_0x2ac716)[_0xbb6c('0x2b')](function(){success+=0x1;})['catch'](function(_0x47f234){if(_0x47f234['error']){errors+=0x1;delete _0x47f234[_0xbb6c('0x14')];}else if(_0x47f234[_0xbb6c('0x28')]){duplicates+=0x1;delete _0x47f234['duplicate'];}rows[_0xbb6c('0x2c')](_0x47f234);}));if(total%0xc8===0x0){_0x1aa3ca[_0xbb6c('0x67')]();return processPromises(_0x1aa3ca);}},'complete':function(){return processPromises()[_0xbb6c('0x2b')](function(){logger[_0xbb6c('0x62')](_0xbb6c('0x68'));endCsv();});},'error':function(_0x4df8a7,_0x470ed5){logger[_0xbb6c('0x62')]('CSV\x20parse\x20error',JSON[_0xbb6c('0x2e')](_0x4df8a7));endCsv();}});})[_0xbb6c('0x52')](function(_0x4cab8f){logger[_0xbb6c('0x14')](_0xbb6c('0x69'),JSON['stringify'](_0x4cab8f));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 366a126..75c04a7 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 _0xdd1f=['catch','error','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','isNil','utcOffset','set','offset','stringify','send','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','header','name','_description','writeFileSync','parse','data','rows','find','hasOwnProperty','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','trim','itemTypeId','appendFileSync','emit','abort','duplicates','CREATE\x20TABLE\x20','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','contact:import:','unlink','exit','complete','argv','arguments\x20\x20\x20','existsSync','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','No\x20agent\x20available','uncaughtException','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','defaults','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','then','push','all','AdditionalPhones','split','length','filter','findOne','update','updated','create','PHONE','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','priority','UserId','fields','cm_contacts.ListId\x20=\x20','join','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.phone','cm_contacts.id','cm_hopper_black','cm_contacts','.CmListId','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','scheduledat','recallme','\x22onlyIfOpen\x22','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','group','info','Received\x20SIGINT','message','errors','code','sequelize','query','spread'];(function(_0x18b191,_0x4e0684){var _0x43e146=function(_0x4b464e){while(--_0x4b464e){_0x18b191['push'](_0x18b191['shift']());}};_0x43e146(++_0x4e0684);}(_0xdd1f,0x101));var _0xfdd1=function(_0x2f9606,_0x415e64){_0x2f9606=_0x2f9606-0x0;var _0x8a7337=_0xdd1f[_0x2f9606];return _0x8a7337;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xfdd1('0x0'));var Papa=require(_0xfdd1('0x1'));var util=require(_0xfdd1('0x2'));var BPromise=require(_0xfdd1('0x3'));var moment=require(_0xfdd1('0x4'));var squel=require(_0xfdd1('0x5'));var Redis=require(_0xfdd1('0x6'));var db=require(_0xfdd1('0x7'))['db'];var config=require(_0xfdd1('0x8'));var shared=require('../../../config/environment/shared');var logger=require(_0xfdd1('0x9'))('import');config['redis']=_[_0xfdd1('0xa')](config[_0xfdd1('0xb')],{'host':_0xfdd1('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfdd1('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xfdd1('0xd')](_0xfdd1('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xfdd1('0xd')](_0xfdd1('0xe'));function isEmail(_0x27ef53){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))*$/[_0xfdd1('0xf')](_0x27ef53);}function selectNotIn(_0x184e8d,_0x3a0874,_0x47ad53,_0x37e49e,_0x55eaac){return squel[_0xfdd1('0x10')]()[_0xfdd1('0x11')](_0xfdd1('0x12'))[_0xfdd1('0x13')](_0x37e49e)['join'](_0x3a0874,null,_0x3a0874+_0xfdd1('0x14')+_0x37e49e+'.'+_0x47ad53)[_0xfdd1('0x15')](_0x37e49e+'.'+_0x47ad53+_0xfdd1('0x16')+_0x184e8d+'.'+_0x47ad53)[_0xfdd1('0x15')](_0x3a0874+_0xfdd1('0x17')+_0x55eaac['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x335e1d,_0x5efe1d){promisesAdditionalPhones=[];return db[_0xfdd1('0x18')][_0xfdd1('0x19')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xfdd1('0x1a')](function(_0x4bd801){if(_0x4bd801!==null){var _0x27a23c=[];for(var _0x2b2b05=0x0;_0x2b2b05<_0x4bd801['length'];_0x2b2b05++){var _0x9d0e5c=_0x4bd801[_0x2b2b05];_0x27a23c[_0xfdd1('0x1b')](insertAdditionalPhones(_0x9d0e5c));}}Promise[_0xfdd1('0x1c')](_0x27a23c)[_0xfdd1('0x1a')](function(){_0x335e1d({'val':0x1});});});});}function insertAdditionalPhones(_0x23d050){return new Promise(function(_0x164506,_0x5c6b93){var _0x1bba46=_0x23d050[_0xfdd1('0x1d')];var _0x104ebf=_0x1bba46[_0xfdd1('0x1e')](';');var _0x320bb8=[];orderBy=0x0;for(var _0x1ddf7b=0x0;_0x1ddf7b<_0x104ebf['length'];_0x1ddf7b++){_0x320bb8['push'](splitAdditionalPhone(_0x23d050['id'],_0x104ebf[_0x1ddf7b]));}Promise[_0xfdd1('0x1c')](_0x320bb8)[_0xfdd1('0x1a')](function(){_0x164506({'val':_0x104ebf['length']});});});}function splitAdditionalPhone(_0x52c32c,_0x57b87a){return new Promise(function(_0xa67410,_0x40e63b){var _0x5b3862=_0x57b87a[_0xfdd1('0x1e')](':');var _0x1509de=_0x5b3862[0x0];var _0xb42540=_0x5b3862[0x1];if(!_['isNil'](_0xb42540)){var _0x3bf683=_0xb42540[_0xfdd1('0x1e')]('|');var _0x322451=[];for(var _0x3aa2c8=0x0;_0x3aa2c8<_0x3bf683[_0xfdd1('0x1f')];_0x3aa2c8++){if(_0x3bf683[_0x3aa2c8]!==''){var _0x210cd4=_[_0xfdd1('0x20')](promisesAdditionalPhones,{'contactId':_0x52c32c,'phone':_0x3bf683[_0x3aa2c8]});if(_0x210cd4[_0xfdd1('0x1f')]==0x0){orderBy++;promisesAdditionalPhones[_0xfdd1('0x1b')]({'contactId':_0x52c32c,'contactTypeId':_0x1509de,'phone':_0x3bf683[_0x3aa2c8],'orderBy':orderBy});}}}_0xa67410({'ok':0x1});}else _0xa67410({'res':0x0});});}function createAdditionalPhone(_0x439689,_0x3178ba,_0x46b79d,_0x4e74c2){var _0x1fcd0a='';var _0x7bae28='';var _0xe75af9=_0x46b79d['split']('§');_0x1fcd0a=_0xe75af9[0x0];if(_0xe75af9[_0xfdd1('0x1f')]==0x2)_0x7bae28=_0xe75af9[0x1];return new Promise(function(_0x4f8e3e,_0xec702d){return db['CmContactHasItem'][_0xfdd1('0x21')]({'where':{'CmContactId':_0x439689,'item':_0x1fcd0a}})[_0xfdd1('0x1a')](function(_0x48cd59){if(_0x48cd59){return db['CmContactHasItem'][_0xfdd1('0x22')]({'ItemTypeId':_0x3178ba,'description':_0x7bae28,'OrderBy':_0x4e74c2},{'where':{'CmContactId':_0x439689,'item':_0x1fcd0a}})[_0xfdd1('0x1a')](function(_0x2bb17e){_0x4f8e3e({'res':_0xfdd1('0x23')});});}else{return db['CmContactHasItem'][_0xfdd1('0x24')]({'CmContactId':_0x439689,'item':_0x1fcd0a,'description':_0x7bae28,'ItemTypeId':_0x3178ba,'OrderBy':_0x4e74c2,'ItemClass':_0xfdd1('0x25')})[_0xfdd1('0x1a')](function(_0xd72082){_0x4f8e3e({'res':'inserted'});});}});});}function insertCmHopper(_0x48a79d,_0x23070,_0xb88e5b,_0x175cab,_0x9ea321){var _0x3e4081=['cm_contacts.phone',_0xfdd1('0x26'),'cm_contacts.id',_0xfdd1('0x27'),_0x23070+'.'+_0x175cab,_0xfdd1('0x28'),_0xfdd1('0x29'),_0xfdd1('0x2a'),_0xfdd1('0x2b'),'\x22'+_0x9ea321+'\x22'];return squel[_0xfdd1('0x2c')]()[_0xfdd1('0x2d')](_0xfdd1('0x2e'))[_0xfdd1('0x2f')](['phone','scheduledat',_0xfdd1('0x30'),_0xfdd1('0x31'),_0x175cab,_0xfdd1('0x32'),_0xfdd1('0x33'),_0xfdd1('0x34'),_0xfdd1('0x35'),'recallme'],squel['select']()[_0xfdd1('0x36')](_0x3e4081)[_0xfdd1('0x13')](_0x23070)['join']('cm_contacts',null,_0xfdd1('0x37')+_0x23070+'.CmListId')[_0xfdd1('0x38')](_0xb88e5b,null,_0xb88e5b+_0xfdd1('0x14')+_0x23070+'.'+_0x175cab)[_0xfdd1('0x15')](_0x23070+_0xfdd1('0x39'),_0x48a79d)['where'](_0xfdd1('0x3a'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x23070,_0xb88e5b,_0x175cab,_0xfdd1('0x2e'),[_0xfdd1('0x3b'),'\x22onlyIfOpen\x22']))[_0xfdd1('0x15')](_0xfdd1('0x3c'),selectNotIn(_0x23070,_0xb88e5b,_0x175cab,_0xfdd1('0x2e'),['\x22always\x22'])))[_0xfdd1('0x3d')]();}function insertCmHopperBlack(_0x51ee7b,_0x2500ec,_0x5e600b,_0x563675){var _0x1a061d=[_0xfdd1('0x3e'),_0xfdd1('0x3f'),_0xfdd1('0x27'),_0x2500ec+'.'+_0x563675,_0xfdd1('0x28'),_0xfdd1('0x29')];return squel[_0xfdd1('0x2c')]()[_0xfdd1('0x2d')](_0xfdd1('0x40'))[_0xfdd1('0x2f')]([_0xfdd1('0x12'),_0xfdd1('0x30'),_0xfdd1('0x31'),_0x563675,_0xfdd1('0x32'),'updatedAt'],squel[_0xfdd1('0x10')]()[_0xfdd1('0x36')](_0x1a061d)[_0xfdd1('0x13')](_0x2500ec)['join'](_0xfdd1('0x41'),null,'cm_contacts.ListId\x20=\x20'+_0x2500ec+_0xfdd1('0x42'))['join'](_0x5e600b,null,_0x5e600b+_0xfdd1('0x14')+_0x2500ec+'.'+_0x563675)[_0xfdd1('0x15')](_0x2500ec+_0xfdd1('0x39'),_0x51ee7b)[_0xfdd1('0x15')](_0xfdd1('0x3a'),NOW)[_0xfdd1('0x15')](_0xfdd1('0x3c'),squel['select']()[_0xfdd1('0x11')](_0xfdd1('0x12'))[_0xfdd1('0x13')]('cm_hopper_black')[_0xfdd1('0x15')](_0xfdd1('0x43'),_0x51ee7b)['where'](_0x563675+_0xfdd1('0x16')+_0x2500ec+'.'+_0x563675)))[_0xfdd1('0x3d')]();}function insertTzCmHopper(_0x145bda,_0x548abb,_0x550c5d,_0x5479c5,_0x37b695,_0x2208c7){var _0x3c781a=['cm_contacts.phone',_0xfdd1('0x44')+_0x2208c7+'.offset-cm_contacts.utcOffset\x20minute)',_0xfdd1('0x3f'),_0xfdd1('0x27'),_0x548abb+'.'+_0x5479c5,_0xfdd1('0x28'),_0xfdd1('0x29'),_0xfdd1('0x2a'),_0xfdd1('0x2b'),'\x22'+_0x37b695+'\x22'];var _0x2df17d=squel[_0xfdd1('0x2c')]()[_0xfdd1('0x2d')](_0xfdd1('0x2e'))[_0xfdd1('0x2f')]([_0xfdd1('0x12'),_0xfdd1('0x45'),_0xfdd1('0x30'),'ListId',_0x5479c5,_0xfdd1('0x32'),_0xfdd1('0x33'),_0xfdd1('0x34'),_0xfdd1('0x35'),_0xfdd1('0x46')],squel[_0xfdd1('0x10')]()[_0xfdd1('0x36')](_0x3c781a)[_0xfdd1('0x13')](_0x548abb)['join'](_0xfdd1('0x41'),null,_0xfdd1('0x37')+_0x548abb+_0xfdd1('0x42'))[_0xfdd1('0x38')](_0x550c5d,null,_0x550c5d+_0xfdd1('0x14')+_0x548abb+'.'+_0x5479c5)['join'](_0x2208c7,null,_0x2208c7+_0xfdd1('0x14')+_0x548abb+'.'+_0x5479c5)[_0xfdd1('0x15')](_0x548abb+_0xfdd1('0x39'),_0x145bda)[_0xfdd1('0x15')](_0xfdd1('0x3a'),NOW)['where'](_0xfdd1('0x3c'),selectNotIn(_0x548abb,_0x550c5d,_0x5479c5,_0xfdd1('0x2e'),[_0xfdd1('0x3b'),_0xfdd1('0x47')]))[_0xfdd1('0x15')](_0xfdd1('0x3c'),selectNotIn(_0x548abb,_0x550c5d,_0x5479c5,'cm_hopper',['\x22always\x22'])))['toString']();return _0x2df17d;}function insertTzCmHopperBlack(_0x5ec0fb,_0x49c60d,_0x3ba77c,_0x43e8e1){var _0x4b237c=[_0xfdd1('0x3e'),_0xfdd1('0x3f'),_0xfdd1('0x27'),_0x49c60d+'.'+_0x43e8e1,_0xfdd1('0x28'),_0xfdd1('0x29')];return squel[_0xfdd1('0x2c')]()[_0xfdd1('0x2d')](_0xfdd1('0x40'))[_0xfdd1('0x2f')]([_0xfdd1('0x12'),_0xfdd1('0x30'),_0xfdd1('0x31'),_0x43e8e1,_0xfdd1('0x32'),_0xfdd1('0x33')],squel['select']()[_0xfdd1('0x36')](_0x4b237c)['from'](_0x49c60d)[_0xfdd1('0x38')](_0xfdd1('0x41'),null,_0xfdd1('0x37')+_0x49c60d+'.CmListId')['join'](_0x3ba77c,null,_0x3ba77c+'.id\x20=\x20'+_0x49c60d+'.'+_0x43e8e1)[_0xfdd1('0x15')](_0x49c60d+_0xfdd1('0x39'),_0x5ec0fb)[_0xfdd1('0x15')](_0xfdd1('0x3a'),NOW)[_0xfdd1('0x15')](_0xfdd1('0x3c'),squel[_0xfdd1('0x10')]()[_0xfdd1('0x11')]('phone')[_0xfdd1('0x13')]('cm_hopper_black')[_0xfdd1('0x15')](_0xfdd1('0x43'),_0x5ec0fb)[_0xfdd1('0x15')](_0x43e8e1+_0xfdd1('0x16')+_0x49c60d+'.'+_0x43e8e1)))['toString']();}function insertCmHopperAdditionalPhones(_0x162d94){var _0x54e1dc=[_0xfdd1('0x48'),'cm_contact_has_items.item',_0xfdd1('0x49'),'cm_contact_has_items.createdAt',_0xfdd1('0x4a')];return squel['insert']()[_0xfdd1('0x2d')]('cm_hopper_additional_phones')['fromQuery']([_0xfdd1('0x4b'),_0xfdd1('0x12'),_0xfdd1('0x4c'),_0xfdd1('0x32'),_0xfdd1('0x33')],squel[_0xfdd1('0x10')]()['fields'](_0x54e1dc)['from'](_0xfdd1('0x2e'))[_0xfdd1('0x38')](_0xfdd1('0x41'),null,_0xfdd1('0x4d'))[_0xfdd1('0x38')]('cm_contact_has_items',null,_0xfdd1('0x4e'))[_0xfdd1('0x15')](_0xfdd1('0x4f'),_0x162d94)[_0xfdd1('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xfdd1('0x3d')]();}function insertCmContact(_0x31ba11,_0x5ef34a,_0xd4df74,_0x265493){var _0x327e85=_['concat'](_[_0xfdd1('0x50')](_0x265493),['ListId',_0xfdd1('0x51'),_0xfdd1('0x32'),_0xfdd1('0x33'),_0xfdd1('0x52')]);return squel[_0xfdd1('0x2c')]()['into'](_0xfdd1('0x41'))[_0xfdd1('0x2f')](_0x327e85,squel[_0xfdd1('0x10')]()[_0xfdd1('0x36')](_0x327e85)[_0xfdd1('0x13')](_0x5ef34a)[_0xfdd1('0x15')]('('+_0xd4df74['join'](',')+_0xfdd1('0x53'),squel[_0xfdd1('0x10')]()[_0xfdd1('0x36')](_0xd4df74)[_0xfdd1('0x13')](_0xfdd1('0x41'))[_0xfdd1('0x15')](_0xfdd1('0x43'),_0x31ba11)[_0xfdd1('0x15')]('deletedAt\x20IS\x20NULL'))[_0xfdd1('0x15')]('id\x20IN\x20?',squel[_0xfdd1('0x10')]()[_0xfdd1('0x11')]('MIN(id)','min_id')['from'](_0x5ef34a)[_0xfdd1('0x54')](_0xd4df74[_0xfdd1('0x38')](','))))['toString']();}function handleStop(){logger[_0xfdd1('0x55')](_0xfdd1('0x56'));stopped=!![];}function handleUncaughtException(_0x202f89){logger['error'](_0x202f89[_0xfdd1('0x57')]);process['exit'](0x1);}function handleError(_0x45ab81,_0x27330e){stats[_0xfdd1('0x58')][_0xfdd1('0x1b')]({'name':_0x27330e[_0xfdd1('0x59')],'message':_0x27330e[_0xfdd1('0x57')],'row':_0x45ab81});}function handleQuery(_0x2ae5de){logger[_0xfdd1('0x55')](_0x2ae5de);return db[_0xfdd1('0x5a')][_0xfdd1('0x5b')](_0x2ae5de)[_0xfdd1('0x5c')](function(_0x49349f){results['push'](_0x49349f);})[_0xfdd1('0x5d')](function(_0x5df70f){logger[_0xfdd1('0x5e')](_0x5df70f[_0xfdd1('0x57')]);});}function updateTzCampaigns(_0x54805e){return new Promise(function(_0x164ec9,_0x9f6bb6){var _0x49dba6=squel[_0xfdd1('0x10')]()[_0xfdd1('0x36')](['campaigns.id','campaigns.dialTimezone'])[_0xfdd1('0x13')](_0xfdd1('0x5f'))[_0xfdd1('0x38')](_0xfdd1('0x60'),null,_0xfdd1('0x61'))[_0xfdd1('0x15')](_0xfdd1('0x62')+_0x54805e);db[_0xfdd1('0x5a')]['query'](_0x49dba6[_0xfdd1('0x3d')]())['spread'](function(_0x504784){var _0x4d44ae=[];for(var _0x315a01=0x0;_0x315a01<_0x504784['length'];_0x315a01++){_0x4d44ae[_0xfdd1('0x1b')](getTimezoneData(_0x504784[_0x315a01],tmp_campaigns));}BPromise[_0xfdd1('0x1c')](_0x4d44ae)[_0xfdd1('0x1a')](function(){_0x164ec9({'val':0x1});});})['catch'](function(_0x56516a){logger[_0xfdd1('0x5e')](_0x56516a[_0xfdd1('0x57')]);_0x164ec9({'val':0x0});});});}function updateTzVoiceQueues(_0x5310bd){return new Promise(function(_0x142b59,_0x589381){var _0xe6b901=squel[_0xfdd1('0x10')]()[_0xfdd1('0x36')](['voice_queues.id','voice_queues.dialTimezone'])['from'](_0xfdd1('0x63'))['join'](_0xfdd1('0x64'),null,_0xfdd1('0x65'))[_0xfdd1('0x15')](_0xfdd1('0x66')+_0x5310bd);db['sequelize'][_0xfdd1('0x5b')](_0xe6b901['toString']())[_0xfdd1('0x5c')](function(_0x1f220e){var _0x2a18f5=[];for(var _0x1eee92=0x0;_0x1eee92<_0x1f220e[_0xfdd1('0x1f')];_0x1eee92++){_0x2a18f5['push'](getTimezoneData(_0x1f220e[_0x1eee92],tmp_voice_queues));}BPromise[_0xfdd1('0x1c')](_0x2a18f5)['then'](function(){_0x142b59({'val':0x1});});})[_0xfdd1('0x5d')](function(_0x364608){logger[_0xfdd1('0x5e')](_0x364608[_0xfdd1('0x57')]);_0x142b59({'val':0x0});});});}function getTimezoneData(_0x527844,_0x31a281){return new Promise(function(_0x54c448,_0x41e8f2){var _0x2a71a4=shared[_0xfdd1('0x67')];var _0x582836=_0x2a71a4[_0x527844[_0xfdd1('0x68')]];if(_[_0xfdd1('0x69')](_0x582836)){_0x54c448({'ret':0x1});}else{var _0x3dfd42=_0x582836[_0xfdd1('0x6a')];var _0x3339b4=squel[_0xfdd1('0x2c')]()[_0xfdd1('0x2d')](_0x31a281)[_0xfdd1('0x6b')]('id',_0x527844['id'])['set'](_0xfdd1('0x6c'),_0x3dfd42)['set']('dialTimezone',_0x527844['dialTimezone'])['toString']();return db[_0xfdd1('0x5a')]['query'](_0x3339b4)[_0xfdd1('0x5c')](function(_0x25769e){_0x54c448({'ret':0x1});})['catch'](function(_0x5bb6ab){logger[_0xfdd1('0x5e')](_0x5bb6ab[_0xfdd1('0x57')]);_0x41e8f2({'ret':0x1});});}});}function handleTZQuery(_0x5f2f14){logger[_0xfdd1('0x55')](_0x5f2f14);return db[_0xfdd1('0x5a')][_0xfdd1('0x5b')](_0x5f2f14)[_0xfdd1('0x5c')](function(_0x525f38){})[_0xfdd1('0x5d')](function(_0x5d76d7){logger[_0xfdd1('0x5e')](_0x5d76d7[_0xfdd1('0x57')]);});}function main(_0x5ace4f,_0x3bcfb0,_0x21bc81,_0x463495){logger[_0xfdd1('0x55')]('main',_0x5ace4f,JSON[_0xfdd1('0x6d')](_0x3bcfb0));process[_0xfdd1('0x6e')](_0xfdd1('0x6f'));var _0x7c2d3c=_0x3bcfb0[_0xfdd1('0x70')];var _0x3babe7=_[_0xfdd1('0x71')](_0x7c2d3c);var _0x2ffe13=_0x3bcfb0[_0xfdd1('0x72')];var _0x4a5d97=path[_0xfdd1('0x38')](config[_0xfdd1('0x73')],_0xfdd1('0x74'),_0x2ffe13+_0xfdd1('0x75'));hasTZ=_[_0xfdd1('0x50')](_0x7c2d3c)['includes'](_0xfdd1('0x68'));var _0x5d3c24=_['keys'](_0x7c2d3c)['join']();logger[_0xfdd1('0x55')](_0xfdd1('0x76'),_0x5d3c24);db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0xfdd1('0x77')]})[_0xfdd1('0x1a')](function(_0x472c66){for(var _0x421961=0x0;_0x421961<_0x472c66[_0xfdd1('0x1f')];_0x421961++){if(_0x472c66[_0x421961][_0xfdd1('0x77')]in _0x7c2d3c){contactItemTypes[_0xfdd1('0x1b')](_0x472c66[_0x421961]);delete _0x3babe7[_0x472c66[_0x421961][_0xfdd1('0x77')]];hasAdditionalPhones=!![];}for(var _0x963a63 in _0x7c2d3c){if(_0x472c66[_0x421961]['name']+_0xfdd1('0x78')===_0x963a63){phoneDescriptions[_0xfdd1('0x1b')]({'itemTypeId':_0x472c66[_0x421961]['id'],'description':_0x963a63});delete _0x3babe7[_0x963a63];}}}if(hasAdditionalPhones)_0x3babe7['AdditionalPhones']='';var _0x7eb5d0=_['keys'](_0x3babe7)[_0xfdd1('0x38')]();logger[_0xfdd1('0x55')](_0xfdd1('0x76'),_0x7eb5d0);fs[_0xfdd1('0x79')](_0x4a5d97,_0x7eb5d0+'\x0a');Papa[_0xfdd1('0x7a')](fs['createReadStream'](_0x5ace4f),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5877a7,_0x3a4f27){try{for(var _0x546ba0=0x0,_0x1a4b2d=[];_0x546ba0<_0x5877a7[_0xfdd1('0x7b')][_0xfdd1('0x1f')];_0x546ba0++){stats[_0xfdd1('0x7c')]+=0x1;if(_0x5877a7[_0xfdd1('0x58')][_0x546ba0]){handleError(_0x5877a7['data'][_0x546ba0],_0x5877a7[_0xfdd1('0x58')][_0x546ba0]);}else{var _0x7a5dac=[];var _0x308294=[];var _0x41203c={};for(var _0x4f1159 in _0x7c2d3c){let _0x4641d7=contactItemTypes[_0xfdd1('0x7d')](_0x4622d8=>_0x4622d8[_0xfdd1('0x77')]===_0x4f1159);let _0x4d3e7f=contactItemTypes[_0xfdd1('0x7d')](_0xc91125=>_0xc91125[_0xfdd1('0x77')]+'_description'===_0x4f1159);if(_[_0xfdd1('0x69')](_0x4641d7)&&_[_0xfdd1('0x69')](_0x4d3e7f)){if(_0x7c2d3c[_0xfdd1('0x7e')](_0x4f1159)){if(_0x5877a7[_0xfdd1('0x7b')][_0x546ba0][_0x7c2d3c[_0x4f1159]]){var _0x139e15=_['trim'](_0x5877a7[_0xfdd1('0x7b')][_0x546ba0][_0x7c2d3c[_0x4f1159]][_0xfdd1('0x7f')](/"/g,'\x27'));switch(_0x4f1159){case'scheduledat':var _0x20e2ab=moment(_0x139e15,_0xfdd1('0xe'),!![]);if(_0x20e2ab[_0xfdd1('0x80')]()){_0x1a4b2d[_0xfdd1('0x1b')]('\x22'+_0x139e15+'\x22');}else{_0x7a5dac[_0xfdd1('0x1b')](_0xfdd1('0x81'));}break;case _0xfdd1('0x34'):var _0x4c0bcb=parseInt(_0x139e15);_0x139e15=_[_0xfdd1('0x82')](_0x4c0bcb)||_0x4c0bcb<0x0||_0x4c0bcb>0x4?_0x463495?0x3:0x2:_0x4c0bcb;_0x1a4b2d['push']('\x22'+_0x139e15+'\x22');break;case'UserId':var _0x5c2f56=parseInt(_0x139e15);if(_[_0xfdd1('0x83')](_0x5c2f56)&&_[_0xfdd1('0x84')](_0x21bc81,_0x5c2f56)){_0x1a4b2d['push']('\x22'+_0x5c2f56+'\x22');}else{_0x7a5dac[_0xfdd1('0x1b')](_0xfdd1('0x85'));}break;case _0xfdd1('0x86'):if(isEmail(_0x139e15)){_0x1a4b2d[_0xfdd1('0x1b')]('\x22'+_0x139e15+'\x22');}else{_0x7a5dac[_0xfdd1('0x1b')](_0xfdd1('0x87'));}break;case _0xfdd1('0x88'):var _0x5eacb0=moment(_0x139e15,_0xfdd1('0x89'),!![]);if(_0x5eacb0['isValid']()){_0x1a4b2d[_0xfdd1('0x1b')]('\x22'+_0x139e15+'\x22');}else{_0x7a5dac[_0xfdd1('0x1b')](_0xfdd1('0x8a'));}break;case _0xfdd1('0x68'):var _0x417d90=shared['timezones'];var _0x5abbd5=_0x417d90[_0x139e15];if(!_[_0xfdd1('0x69')](_0x5abbd5)){var _0x508464=_0x5abbd5['utcOffset'];_0x1a4b2d[_0xfdd1('0x1b')]('\x22'+_0x139e15+'\x22');_0x1a4b2d[_0xfdd1('0x1b')]('\x22'+_0x508464+'\x22');}break;default:_0x1a4b2d[_0xfdd1('0x1b')]('\x22'+_0x139e15+'\x22');}}else{switch(_0x4f1159){case _0xfdd1('0x8b'):case _0xfdd1('0x12'):_0x7a5dac[_0xfdd1('0x1b')](_0x4f1159+_0xfdd1('0x8c'));break;default:_0x1a4b2d[_0xfdd1('0x1b')]('\x22\x22');}}}}else{var _0xea51b4='';if(!_['isNil'](_0x4641d7)){if(!_0x41203c[_0xfdd1('0x7e')](_0x4641d7['id'])){if(!_[_0xfdd1('0x69')](_0x5877a7[_0xfdd1('0x7b')][_0x546ba0][_0x7c2d3c[_0x4f1159]])){var _0x139e15=_[_0xfdd1('0x8d')](_0x5877a7[_0xfdd1('0x7b')][_0x546ba0][_0x7c2d3c[_0x4f1159]]['replace'](/"/g,'\x27'));var _0x33c2a7=phoneDescriptions[_0xfdd1('0x7d')](_0xcd7d2c=>_0xcd7d2c[_0xfdd1('0x8e')]===_0x4641d7['id']);if(!_[_0xfdd1('0x69')](_0x33c2a7)){var _0x432170=_[_0xfdd1('0x8d')](_0x5877a7[_0xfdd1('0x7b')][_0x546ba0][_0x7c2d3c[_0x33c2a7['description']]][_0xfdd1('0x7f')](/"/g,'\x27'));if(!_['isNil'](_0x432170))_0x139e15=_0x139e15+'§'+_0x432170;}if(_0xea51b4=='')_0xea51b4=_0x139e15;else _0xea51b4+='|'+_0x139e15;}_0x308294['push'](_0x4641d7['id']+':'+_0xea51b4);_0x41203c[_0x4641d7['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1a4b2d[_0xfdd1('0x1b')]('\x22'+_0x308294[_0xfdd1('0x38')](';')+'\x22');}if(_0x7a5dac[_0xfdd1('0x1f')]){handleError(_0x5877a7[_0xfdd1('0x7b')][_0x546ba0],{'code':'SystemRow','message':_0x7a5dac['join']()});}else{fs[_0xfdd1('0x8f')](_0x4a5d97,_0x1a4b2d[_0xfdd1('0x38')]()+'\x0a');}_0x1a4b2d=[];}if(!(stats[_0xfdd1('0x7c')]%0xc8)){socket[_0xfdd1('0x90')]('contact:import:'+_0x2ffe13,stats);stats[_0xfdd1('0x58')]=[];}}if(stopped){logger[_0xfdd1('0x55')]('Abort\x20parser');_0x3a4f27[_0xfdd1('0x91')]();}}catch(_0x2cee2d){handleError(_0x5877a7[_0xfdd1('0x7b')][_0x546ba0],{'code':'SystemError','message':_0x2cee2d[_0xfdd1('0x57')]});logger[_0xfdd1('0x5e')]('step',_0x2cee2d[_0xfdd1('0x57')]);}},'complete':function(){try{var _0x279a3f=[];var _0x58c7dd=[];var _0x1bd670=_0xfdd1('0x41');if(_0x3bcfb0[_0xfdd1('0x92')]&&_0x3bcfb0[_0xfdd1('0x92')]['length']){_0x1bd670='cm_contacts_'+_0x2ffe13;_0x279a3f[_0xfdd1('0x1b')](_0xfdd1('0x93')+_0x1bd670+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0xfdd1('0x94')+_0x2ffe13;tmp_voice_queues=_0xfdd1('0x95')+_0x2ffe13;_0x58c7dd['push'](_0xfdd1('0x93')+tmp_campaigns+_0xfdd1('0x96'));_0x58c7dd[_0xfdd1('0x1b')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0xfdd1('0x96'));BPromise[_0xfdd1('0x97')](_0x58c7dd,handleTZQuery)[_0xfdd1('0x1a')](function(_0x1292f8){updateTzCampaigns(_0x3bcfb0[_0xfdd1('0x31')])[_0xfdd1('0x1a')](function(_0x1e247d){updateTzVoiceQueues(_0x3bcfb0[_0xfdd1('0x31')])[_0xfdd1('0x1a')](function(_0x50df15){if(hasTZ)_0x7eb5d0=_0x7eb5d0[_0xfdd1('0x7f')](_0xfdd1('0x68'),_0xfdd1('0x98'));var _0x944379=util[_0xfdd1('0xd')]('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',_0x4a5d97,_0x1bd670,_0x7eb5d0,_0x3bcfb0[_0xfdd1('0x31')],_0x3bcfb0[_0xfdd1('0x51')]||null,NOW,NOW);if(_[_0xfdd1('0x69')](_0x7c2d3c['scheduledat'])){_0x944379+=_0xfdd1('0x99');}_0x279a3f[_0xfdd1('0x1b')](_0x944379);if(_0x3bcfb0[_0xfdd1('0x92')]&&_0x3bcfb0['duplicates']['length']){_0x279a3f['push'](insertCmContact(_0x3bcfb0[_0xfdd1('0x31')],_0x1bd670,_0x3bcfb0[_0xfdd1('0x92')],_0x7c2d3c));_0x279a3f[_0xfdd1('0x1b')](_0xfdd1('0x9a')+_0x1bd670+';');}BPromise[_0xfdd1('0x97')](_0x279a3f,handleQuery)['then'](function(_0x58cdae){BPromise[_0xfdd1('0x1c')]([handleAdditionalPhones()])[_0xfdd1('0x1a')](function(){_0x279a3f=[];for(var _0x19658c=0x0;_0x19658c\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','lodash','papaparse','util','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','format','test','select','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','CmContact','findAll','AdditionalPhones','then','length','push','all','split','isNil','CmContactHasItem','findOne','update','updated','create','PHONE','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','phone','scheduledat','ListId','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','insert','cm_hopper_black','field','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','ContactId','createdAt','updatedAt','priority','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','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)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors'];(function(_0x228b22,_0x1b92e8){var _0x247cc3=function(_0x3a5088){while(--_0x3a5088){_0x228b22['push'](_0x228b22['shift']());}};_0x247cc3(++_0x1b92e8);}(_0xad9e,0x1ce));var _0xead9=function(_0x57fc15,_0x41eea5){_0x57fc15=_0x57fc15-0x0;var _0x2514f1=_0xad9e[_0x57fc15];return _0x2514f1;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xead9('0x0'));var Papa=require(_0xead9('0x1'));var util=require(_0xead9('0x2'));var BPromise=require(_0xead9('0x3'));var moment=require('moment');var squel=require(_0xead9('0x4'));var Redis=require(_0xead9('0x5'));var db=require(_0xead9('0x6'))['db'];var config=require(_0xead9('0x7'));var shared=require(_0xead9('0x8'));var logger=require(_0xead9('0x9'))(_0xead9('0xa'));config[_0xead9('0xb')]=_[_0xead9('0xc')](config[_0xead9('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xead9('0xd'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0xead9('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xead9('0xf')](_0xead9('0xe'));function isEmail(_0x5c14cb){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))*$/[_0xead9('0x10')](_0x5c14cb);}function selectNotIn(_0x501666,_0x518496,_0x5972d2,_0x3b3bbd,_0x59134a){return squel[_0xead9('0x11')]()['field']('phone')[_0xead9('0x12')](_0x3b3bbd)['join'](_0x518496,null,_0x518496+_0xead9('0x13')+_0x3b3bbd+'.'+_0x5972d2)[_0xead9('0x14')](_0x3b3bbd+'.'+_0x5972d2+_0xead9('0x15')+_0x501666+'.'+_0x5972d2)['where'](_0x518496+_0xead9('0x16')+_0x59134a[_0xead9('0x17')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x17facd,_0xcd8aad){promisesAdditionalPhones=[];return db[_0xead9('0x18')][_0xead9('0x19')]({'raw':!![],'attributes':['id',_0xead9('0x1a')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xead9('0x1b')](function(_0x35bcd3){if(_0x35bcd3!==null){var _0x4aaf39=[];for(var _0x2506b2=0x0;_0x2506b2<_0x35bcd3[_0xead9('0x1c')];_0x2506b2++){var _0x2feded=_0x35bcd3[_0x2506b2];_0x4aaf39[_0xead9('0x1d')](insertAdditionalPhones(_0x2feded));}}Promise[_0xead9('0x1e')](_0x4aaf39)[_0xead9('0x1b')](function(){_0x17facd({'val':0x1});});});});}function insertAdditionalPhones(_0x314d07){return new Promise(function(_0x2daeff,_0x24952f){var _0x5568da=_0x314d07[_0xead9('0x1a')];var _0x10c407=_0x5568da[_0xead9('0x1f')](';');var _0x4fb483=[];orderBy=0x0;for(var _0x16ce7b=0x0;_0x16ce7b<_0x10c407['length'];_0x16ce7b++){_0x4fb483[_0xead9('0x1d')](splitAdditionalPhone(_0x314d07['id'],_0x10c407[_0x16ce7b]));}Promise[_0xead9('0x1e')](_0x4fb483)[_0xead9('0x1b')](function(){_0x2daeff({'val':_0x10c407[_0xead9('0x1c')]});});});}function splitAdditionalPhone(_0x3cf2e3,_0x23e25f){return new Promise(function(_0x4a3042,_0x507748){var _0x424528=_0x23e25f['split'](':');var _0x301cd3=_0x424528[0x0];var _0x1d3b8d=_0x424528[0x1];if(!_[_0xead9('0x20')](_0x1d3b8d)){var _0x535462=_0x1d3b8d[_0xead9('0x1f')]('|');var _0x363828=[];for(var _0x2ae871=0x0;_0x2ae871<_0x535462[_0xead9('0x1c')];_0x2ae871++){if(_0x535462[_0x2ae871]!==''){var _0x2adb62=_['filter'](promisesAdditionalPhones,{'contactId':_0x3cf2e3,'phone':_0x535462[_0x2ae871]});if(_0x2adb62[_0xead9('0x1c')]==0x0){orderBy++;promisesAdditionalPhones[_0xead9('0x1d')]({'contactId':_0x3cf2e3,'contactTypeId':_0x301cd3,'phone':_0x535462[_0x2ae871],'orderBy':orderBy});}}}_0x4a3042({'ok':0x1});}else _0x4a3042({'res':0x0});});}function createAdditionalPhone(_0x2e2661,_0x57abe7,_0x2d3c61,_0x5b5937){var _0x558d51='';var _0x5f0fc0='';var _0x2670c7=_0x2d3c61[_0xead9('0x1f')]('§');_0x558d51=_0x2670c7[0x0];if(_0x2670c7[_0xead9('0x1c')]==0x2)_0x5f0fc0=_0x2670c7[0x1];return new Promise(function(_0x5cefb8,_0x2bf6d0){return db[_0xead9('0x21')][_0xead9('0x22')]({'where':{'CmContactId':_0x2e2661,'item':_0x558d51}})[_0xead9('0x1b')](function(_0x285edc){if(_0x285edc){return db[_0xead9('0x21')][_0xead9('0x23')]({'ItemTypeId':_0x57abe7,'description':_0x5f0fc0,'OrderBy':_0x5b5937},{'where':{'CmContactId':_0x2e2661,'item':_0x558d51}})['then'](function(_0x49777d){_0x5cefb8({'res':_0xead9('0x24')});});}else{return db['CmContactHasItem'][_0xead9('0x25')]({'CmContactId':_0x2e2661,'item':_0x558d51,'description':_0x5f0fc0,'ItemTypeId':_0x57abe7,'OrderBy':_0x5b5937,'ItemClass':_0xead9('0x26')})[_0xead9('0x1b')](function(_0x1a969c){_0x5cefb8({'res':'inserted'});});}});});}function insertCmHopper(_0x42c78a,_0x378bbe,_0x2ad1db,_0x79442d,_0x59c1bb){var _0x3d3940=[_0xead9('0x27'),_0xead9('0x28'),_0xead9('0x29'),_0xead9('0x2a'),_0x378bbe+'.'+_0x79442d,_0xead9('0x2b'),_0xead9('0x2c'),_0xead9('0x2d'),_0xead9('0x2e'),'\x22'+_0x59c1bb+'\x22'];return squel['insert']()[_0xead9('0x2f')](_0xead9('0x30'))[_0xead9('0x31')]([_0xead9('0x32'),_0xead9('0x33'),'ContactId',_0xead9('0x34'),_0x79442d,'createdAt','updatedAt','priority',_0xead9('0x35'),_0xead9('0x36')],squel[_0xead9('0x11')]()[_0xead9('0x37')](_0x3d3940)[_0xead9('0x12')](_0x378bbe)[_0xead9('0x17')](_0xead9('0x38'),null,_0xead9('0x39')+_0x378bbe+_0xead9('0x3a'))['join'](_0x2ad1db,null,_0x2ad1db+_0xead9('0x13')+_0x378bbe+'.'+_0x79442d)[_0xead9('0x14')](_0x378bbe+_0xead9('0x3b'),_0x42c78a)[_0xead9('0x14')](_0xead9('0x3c'),NOW)['where'](_0xead9('0x3d'),selectNotIn(_0x378bbe,_0x2ad1db,_0x79442d,_0xead9('0x30'),[_0xead9('0x3e'),_0xead9('0x3f')]))[_0xead9('0x14')](_0xead9('0x3d'),selectNotIn(_0x378bbe,_0x2ad1db,_0x79442d,'cm_hopper',[_0xead9('0x3e')])))[_0xead9('0x40')]();}function insertCmHopperBlack(_0x33abe4,_0x41eace,_0x45c4ef,_0x29c04f){var _0x2d7c34=[_0xead9('0x27'),'cm_contacts.id',_0xead9('0x2a'),_0x41eace+'.'+_0x29c04f,_0xead9('0x2b'),_0xead9('0x2c')];return squel[_0xead9('0x41')]()[_0xead9('0x2f')](_0xead9('0x42'))[_0xead9('0x31')]([_0xead9('0x32'),'ContactId',_0xead9('0x34'),_0x29c04f,'createdAt','updatedAt'],squel[_0xead9('0x11')]()['fields'](_0x2d7c34)[_0xead9('0x12')](_0x41eace)[_0xead9('0x17')]('cm_contacts',null,_0xead9('0x39')+_0x41eace+_0xead9('0x3a'))[_0xead9('0x17')](_0x45c4ef,null,_0x45c4ef+_0xead9('0x13')+_0x41eace+'.'+_0x29c04f)[_0xead9('0x14')](_0x41eace+_0xead9('0x3b'),_0x33abe4)[_0xead9('0x14')](_0xead9('0x3c'),NOW)[_0xead9('0x14')](_0xead9('0x3d'),squel[_0xead9('0x11')]()[_0xead9('0x43')](_0xead9('0x32'))[_0xead9('0x12')](_0xead9('0x42'))[_0xead9('0x14')](_0xead9('0x44'),_0x33abe4)[_0xead9('0x14')](_0x29c04f+'\x20=\x20'+_0x41eace+'.'+_0x29c04f)))['toString']();}function insertTzCmHopper(_0x45c650,_0x27a772,_0xcff115,_0x555a55,_0x34c58f,_0x571200){var _0x262e1d=[_0xead9('0x27'),_0xead9('0x45')+_0x571200+_0xead9('0x46'),_0xead9('0x29'),_0xead9('0x2a'),_0x27a772+'.'+_0x555a55,_0xead9('0x2b'),_0xead9('0x2c'),_0xead9('0x2d'),_0xead9('0x2e'),'\x22'+_0x34c58f+'\x22'];var _0x1c529b=squel[_0xead9('0x41')]()[_0xead9('0x2f')](_0xead9('0x30'))['fromQuery']([_0xead9('0x32'),_0xead9('0x33'),_0xead9('0x47'),'ListId',_0x555a55,_0xead9('0x48'),_0xead9('0x49'),_0xead9('0x4a'),_0xead9('0x35'),_0xead9('0x36')],squel[_0xead9('0x11')]()['fields'](_0x262e1d)['from'](_0x27a772)['join'](_0xead9('0x38'),null,_0xead9('0x39')+_0x27a772+_0xead9('0x3a'))[_0xead9('0x17')](_0xcff115,null,_0xcff115+'.id\x20=\x20'+_0x27a772+'.'+_0x555a55)[_0xead9('0x17')](_0x571200,null,_0x571200+_0xead9('0x13')+_0x27a772+'.'+_0x555a55)['where'](_0x27a772+'.CmListId\x20=\x20?',_0x45c650)[_0xead9('0x14')](_0xead9('0x3c'),NOW)[_0xead9('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x27a772,_0xcff115,_0x555a55,_0xead9('0x30'),['\x22always\x22',_0xead9('0x3f')]))[_0xead9('0x14')](_0xead9('0x3d'),selectNotIn(_0x27a772,_0xcff115,_0x555a55,'cm_hopper',[_0xead9('0x3e')])))[_0xead9('0x40')]();return _0x1c529b;}function insertTzCmHopperBlack(_0x46ca35,_0x463aa8,_0x2cc4f1,_0x1ba341){var _0xc37389=[_0xead9('0x27'),_0xead9('0x29'),_0xead9('0x2a'),_0x463aa8+'.'+_0x1ba341,'cm_contacts.createdAt',_0xead9('0x2c')];return squel[_0xead9('0x41')]()[_0xead9('0x2f')]('cm_hopper_black')[_0xead9('0x31')]([_0xead9('0x32'),_0xead9('0x47'),_0xead9('0x34'),_0x1ba341,_0xead9('0x48'),_0xead9('0x49')],squel[_0xead9('0x11')]()['fields'](_0xc37389)[_0xead9('0x12')](_0x463aa8)[_0xead9('0x17')](_0xead9('0x38'),null,_0xead9('0x39')+_0x463aa8+_0xead9('0x3a'))['join'](_0x2cc4f1,null,_0x2cc4f1+_0xead9('0x13')+_0x463aa8+'.'+_0x1ba341)[_0xead9('0x14')](_0x463aa8+'.CmListId\x20=\x20?',_0x46ca35)[_0xead9('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0xead9('0x3d'),squel['select']()['field'](_0xead9('0x32'))[_0xead9('0x12')](_0xead9('0x42'))[_0xead9('0x14')](_0xead9('0x44'),_0x46ca35)[_0xead9('0x14')](_0x1ba341+_0xead9('0x15')+_0x463aa8+'.'+_0x1ba341)))[_0xead9('0x40')]();}function insertCmHopperAdditionalPhones(_0x2032c2){var _0x196e5f=[_0xead9('0x4b'),_0xead9('0x4c'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt',_0xead9('0x4d')];return squel['insert']()[_0xead9('0x2f')](_0xead9('0x4e'))[_0xead9('0x31')]([_0xead9('0x4f'),'phone',_0xead9('0x50'),_0xead9('0x48'),_0xead9('0x49')],squel[_0xead9('0x11')]()[_0xead9('0x37')](_0x196e5f)[_0xead9('0x12')](_0xead9('0x30'))['join'](_0xead9('0x38'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xead9('0x17')](_0xead9('0x51'),null,_0xead9('0x52'))['where'](_0xead9('0x53'),_0x2032c2)[_0xead9('0x14')](_0xead9('0x3c'),NOW))[_0xead9('0x40')]();}function insertCmContact(_0x269cd8,_0x349ba4,_0x4d0dbd,_0x51fa3b){var _0xece4e=_[_0xead9('0x54')](_['keys'](_0x51fa3b),['ListId',_0xead9('0x55'),'createdAt',_0xead9('0x49'),_0xead9('0x56')]);return squel[_0xead9('0x41')]()['into'](_0xead9('0x38'))[_0xead9('0x31')](_0xece4e,squel[_0xead9('0x11')]()[_0xead9('0x37')](_0xece4e)['from'](_0x349ba4)[_0xead9('0x14')]('('+_0x4d0dbd['join'](',')+_0xead9('0x57'),squel[_0xead9('0x11')]()[_0xead9('0x37')](_0x4d0dbd)[_0xead9('0x12')]('cm_contacts')[_0xead9('0x14')](_0xead9('0x44'),_0x269cd8)[_0xead9('0x14')](_0xead9('0x58')))[_0xead9('0x14')](_0xead9('0x59'),squel[_0xead9('0x11')]()[_0xead9('0x43')](_0xead9('0x5a'),_0xead9('0x5b'))[_0xead9('0x12')](_0x349ba4)[_0xead9('0x5c')](_0x4d0dbd[_0xead9('0x17')](','))))[_0xead9('0x40')]();}function handleStop(){logger[_0xead9('0x5d')](_0xead9('0x5e'));stopped=!![];}function handleUncaughtException(_0x4b2467){logger[_0xead9('0x5f')](_0x4b2467[_0xead9('0x60')]);process[_0xead9('0x61')](0x1);}function handleError(_0x5c5a1c,_0x423d63){stats[_0xead9('0x62')][_0xead9('0x1d')]({'name':_0x423d63['code'],'message':_0x423d63['message'],'row':_0x5c5a1c});}function handleQuery(_0x5672ae){logger[_0xead9('0x5d')](_0x5672ae);return db[_0xead9('0x63')][_0xead9('0x64')](_0x5672ae)[_0xead9('0x65')](function(_0x5ab7a5){results[_0xead9('0x1d')](_0x5ab7a5);})[_0xead9('0x66')](function(_0x3bb2f2){logger[_0xead9('0x5f')](_0x3bb2f2['message']);});}function updateTzCampaigns(_0x34a1f6){return new Promise(function(_0x14b43c,_0x4da41e){var _0x1baeae=squel[_0xead9('0x11')]()['fields']([_0xead9('0x67'),_0xead9('0x68')])[_0xead9('0x12')](_0xead9('0x69'))[_0xead9('0x17')](_0xead9('0x6a'),null,_0xead9('0x6b'))['where']('campaigns_has_cm_lists.CmListId='+_0x34a1f6);db[_0xead9('0x63')][_0xead9('0x64')](_0x1baeae['toString']())[_0xead9('0x65')](function(_0x1b0253){var _0x3ed80d=[];for(var _0x4ae12f=0x0;_0x4ae12f<_0x1b0253['length'];_0x4ae12f++){_0x3ed80d['push'](getTimezoneData(_0x1b0253[_0x4ae12f],tmp_campaigns));}BPromise[_0xead9('0x1e')](_0x3ed80d)[_0xead9('0x1b')](function(){_0x14b43c({'val':0x1});});})[_0xead9('0x66')](function(_0x3de89f){logger[_0xead9('0x5f')](_0x3de89f[_0xead9('0x60')]);_0x14b43c({'val':0x0});});});}function updateTzVoiceQueues(_0x46f5bc){return new Promise(function(_0xd58de7,_0x385495){var _0x409b26=squel['select']()[_0xead9('0x37')]([_0xead9('0x6c'),_0xead9('0x6d')])[_0xead9('0x12')](_0xead9('0x6e'))['join'](_0xead9('0x6f'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0xead9('0x14')](_0xead9('0x70')+_0x46f5bc);db['sequelize'][_0xead9('0x64')](_0x409b26[_0xead9('0x40')]())['spread'](function(_0x18ec8b){var _0x533243=[];for(var _0x43202f=0x0;_0x43202f<_0x18ec8b[_0xead9('0x1c')];_0x43202f++){_0x533243[_0xead9('0x1d')](getTimezoneData(_0x18ec8b[_0x43202f],tmp_voice_queues));}BPromise[_0xead9('0x1e')](_0x533243)[_0xead9('0x1b')](function(){_0xd58de7({'val':0x1});});})[_0xead9('0x66')](function(_0x49b283){logger[_0xead9('0x5f')](_0x49b283[_0xead9('0x60')]);_0xd58de7({'val':0x0});});});}function getTimezoneData(_0xdbe4bf,_0x38271a){return new Promise(function(_0x5461df,_0x38b76f){var _0x5181e9=shared[_0xead9('0x71')];var _0x33a3b9=_0x5181e9[_0xdbe4bf[_0xead9('0x72')]];if(_[_0xead9('0x20')](_0x33a3b9)){_0x5461df({'ret':0x1});}else{var _0xdcceb1=_0x33a3b9[_0xead9('0x73')];var _0x4073f1=squel['insert']()[_0xead9('0x2f')](_0x38271a)['set']('id',_0xdbe4bf['id'])[_0xead9('0x74')](_0xead9('0x75'),_0xdcceb1)[_0xead9('0x74')](_0xead9('0x72'),_0xdbe4bf[_0xead9('0x72')])[_0xead9('0x40')]();return db[_0xead9('0x63')]['query'](_0x4073f1)['spread'](function(_0x345878){_0x5461df({'ret':0x1});})['catch'](function(_0x594eec){logger['error'](_0x594eec[_0xead9('0x60')]);_0x38b76f({'ret':0x1});});}});}function handleTZQuery(_0x51a896){logger[_0xead9('0x5d')](_0x51a896);return db[_0xead9('0x63')][_0xead9('0x64')](_0x51a896)[_0xead9('0x65')](function(_0x180f10){})[_0xead9('0x66')](function(_0x42a280){logger[_0xead9('0x5f')](_0x42a280[_0xead9('0x60')]);});}function main(_0x4a4b94,_0x5001df,_0x53eda8,_0x28a245){logger[_0xead9('0x5d')]('main',_0x4a4b94,JSON['stringify'](_0x5001df));process[_0xead9('0x76')](_0xead9('0x77'));var _0x4af27b=_0x5001df['binding'];var _0x36ff6c=_[_0xead9('0x78')](_0x4af27b);var _0x3dd97f=_0x5001df[_0xead9('0x79')];var _0x42e1c0=path[_0xead9('0x17')](config['root'],_0xead9('0x7a'),_0x3dd97f+_0xead9('0x7b'));hasTZ=_[_0xead9('0x7c')](_0x4af27b)[_0xead9('0x7d')]('dialTimezone');var _0x459555=_[_0xead9('0x7c')](_0x4af27b)[_0xead9('0x17')]();logger[_0xead9('0x5d')](_0xead9('0x7e'),_0x459555);db['ContactItemType'][_0xead9('0x19')]({'raw':!![],'attributes':['id','name']})[_0xead9('0x1b')](function(_0x3e811c){for(var _0x3eec09=0x0;_0x3eec09<_0x3e811c['length'];_0x3eec09++){if(_0x3e811c[_0x3eec09][_0xead9('0x7f')]in _0x4af27b){contactItemTypes[_0xead9('0x1d')](_0x3e811c[_0x3eec09]);delete _0x36ff6c[_0x3e811c[_0x3eec09][_0xead9('0x7f')]];hasAdditionalPhones=!![];}for(var _0x5f39b0 in _0x4af27b){if(_0x3e811c[_0x3eec09][_0xead9('0x7f')]+'_description'===_0x5f39b0){phoneDescriptions[_0xead9('0x1d')]({'itemTypeId':_0x3e811c[_0x3eec09]['id'],'description':_0x5f39b0});delete _0x36ff6c[_0x5f39b0];}}}if(hasAdditionalPhones)_0x36ff6c[_0xead9('0x1a')]='';var _0x1c26d2=_[_0xead9('0x7c')](_0x36ff6c)[_0xead9('0x17')]();logger[_0xead9('0x5d')](_0xead9('0x7e'),_0x1c26d2);fs[_0xead9('0x80')](_0x42e1c0,_0x1c26d2+'\x0a');Papa[_0xead9('0x81')](fs[_0xead9('0x82')](_0x4a4b94),{'header':!![],'skipEmptyLines':!![],'step':function(_0x23d922,_0x3f0166){try{for(var _0x3cb8f9=0x0,_0x113d62=[];_0x3cb8f9<_0x23d922[_0xead9('0x83')]['length'];_0x3cb8f9++){stats[_0xead9('0x84')]+=0x1;if(_0x23d922['errors'][_0x3cb8f9]){handleError(_0x23d922[_0xead9('0x83')][_0x3cb8f9],_0x23d922[_0xead9('0x62')][_0x3cb8f9]);}else{var _0x4c2ff1=[];var _0x45adf8=[];var _0x1374f7={};for(var _0x19016d in _0x4af27b){let _0x12bb34=contactItemTypes[_0xead9('0x85')](_0x1efa3f=>_0x1efa3f['name']===_0x19016d);let _0x1a3e86=contactItemTypes[_0xead9('0x85')](_0x4fc28c=>_0x4fc28c[_0xead9('0x7f')]+'_description'===_0x19016d);if(_[_0xead9('0x20')](_0x12bb34)&&_[_0xead9('0x20')](_0x1a3e86)){if(_0x4af27b['hasOwnProperty'](_0x19016d)){if(_0x23d922['data'][_0x3cb8f9][_0x4af27b[_0x19016d]]){var _0x250763=_[_0xead9('0x86')](_0x23d922['data'][_0x3cb8f9][_0x4af27b[_0x19016d]][_0xead9('0x87')](/"/g,'\x27'));switch(_0x19016d){case'scheduledat':var _0x149ed6=moment(_0x250763,_0xead9('0xe'),!![]);if(_0x149ed6[_0xead9('0x88')]()){_0x113d62['push']('\x22'+_0x250763+'\x22');}else{_0x4c2ff1['push'](_0xead9('0x89'));}break;case _0xead9('0x4a'):var _0x2bdff8=parseInt(_0x250763);_0x250763=_['isNaN'](_0x2bdff8)||_0x2bdff8<0x0||_0x2bdff8>0x4?_0x28a245?0x3:0x2:_0x2bdff8;_0x113d62[_0xead9('0x1d')]('\x22'+_0x250763+'\x22');break;case _0xead9('0x35'):var _0x2958dd=parseInt(_0x250763);if(_[_0xead9('0x8a')](_0x2958dd)&&_[_0xead9('0x7d')](_0x53eda8,_0x2958dd)){_0x113d62[_0xead9('0x1d')]('\x22'+_0x2958dd+'\x22');}else{_0x4c2ff1['push']('agent\x20not\x20exists');}break;case _0xead9('0x8b'):if(isEmail(_0x250763)){_0x113d62['push']('\x22'+_0x250763+'\x22');}else{_0x4c2ff1[_0xead9('0x1d')](_0xead9('0x8c'));}break;case _0xead9('0x8d'):var _0xde593d=moment(_0x250763,'YYYY-MM-DD',!![]);if(_0xde593d[_0xead9('0x88')]()){_0x113d62[_0xead9('0x1d')]('\x22'+_0x250763+'\x22');}else{_0x4c2ff1[_0xead9('0x1d')](_0xead9('0x8e'));}break;case _0xead9('0x72'):var _0x55996c=shared[_0xead9('0x71')];var _0x1c55d1=_0x55996c[_0x250763];if(!_[_0xead9('0x20')](_0x1c55d1)){var _0x133fb6=_0x1c55d1[_0xead9('0x73')];_0x113d62[_0xead9('0x1d')]('\x22'+_0x250763+'\x22');_0x113d62['push']('\x22'+_0x133fb6+'\x22');}break;default:_0x113d62[_0xead9('0x1d')]('\x22'+_0x250763+'\x22');}}else{switch(_0x19016d){case'firstName':case _0xead9('0x32'):_0x4c2ff1[_0xead9('0x1d')](_0x19016d+_0xead9('0x8f'));break;default:_0x113d62[_0xead9('0x1d')]('\x22\x22');}}}}else{var _0x4bc199='';if(!_['isNil'](_0x12bb34)){if(!_0x1374f7[_0xead9('0x90')](_0x12bb34['id'])){if(!_['isNil'](_0x23d922[_0xead9('0x83')][_0x3cb8f9][_0x4af27b[_0x19016d]])){var _0x250763=_[_0xead9('0x86')](_0x23d922[_0xead9('0x83')][_0x3cb8f9][_0x4af27b[_0x19016d]][_0xead9('0x87')](/"/g,'\x27'));var _0x4d5980=phoneDescriptions[_0xead9('0x85')](_0x3b734c=>_0x3b734c[_0xead9('0x91')]===_0x12bb34['id']);if(!_['isNil'](_0x4d5980)){var _0x4336a7=_[_0xead9('0x86')](_0x23d922[_0xead9('0x83')][_0x3cb8f9][_0x4af27b[_0x4d5980[_0xead9('0x92')]]][_0xead9('0x87')](/"/g,'\x27'));if(!_[_0xead9('0x20')](_0x4336a7))_0x250763=_0x250763+'§'+_0x4336a7;}if(_0x4bc199=='')_0x4bc199=_0x250763;else _0x4bc199+='|'+_0x250763;}_0x45adf8['push'](_0x12bb34['id']+':'+_0x4bc199);_0x1374f7[_0x12bb34['id']]=0x1;}}}}if(hasAdditionalPhones){_0x113d62[_0xead9('0x1d')]('\x22'+_0x45adf8[_0xead9('0x17')](';')+'\x22');}if(_0x4c2ff1[_0xead9('0x1c')]){handleError(_0x23d922[_0xead9('0x83')][_0x3cb8f9],{'code':'SystemRow','message':_0x4c2ff1[_0xead9('0x17')]()});}else{fs[_0xead9('0x93')](_0x42e1c0,_0x113d62[_0xead9('0x17')]()+'\x0a');}_0x113d62=[];}if(!(stats['rows']%0xc8)){socket[_0xead9('0x94')](_0xead9('0x95')+_0x3dd97f,stats);stats[_0xead9('0x62')]=[];}}if(stopped){logger[_0xead9('0x5d')](_0xead9('0x96'));_0x3f0166[_0xead9('0x97')]();}}catch(_0x4b7c90){handleError(_0x23d922[_0xead9('0x83')][_0x3cb8f9],{'code':_0xead9('0x98'),'message':_0x4b7c90['message']});logger[_0xead9('0x5f')](_0xead9('0x99'),_0x4b7c90['message']);}},'complete':function(){try{var _0x3cc46c=[];var _0x3b2408=[];var _0x178ad4='cm_contacts';if(_0x5001df[_0xead9('0x9a')]&&_0x5001df[_0xead9('0x9a')][_0xead9('0x1c')]){_0x178ad4=_0xead9('0x9b')+_0x3dd97f;_0x3cc46c['push']('CREATE\x20TABLE\x20'+_0x178ad4+_0xead9('0x9c'));}tmp_campaigns='campaigns_'+_0x3dd97f;tmp_voice_queues=_0xead9('0x9d')+_0x3dd97f;_0x3b2408[_0xead9('0x1d')](_0xead9('0x9e')+tmp_campaigns+_0xead9('0x9f'));_0x3b2408[_0xead9('0x1d')]('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0xead9('0xa0')](_0x3b2408,handleTZQuery)[_0xead9('0x1b')](function(_0x39b195){updateTzCampaigns(_0x5001df[_0xead9('0x34')])[_0xead9('0x1b')](function(_0x398359){updateTzVoiceQueues(_0x5001df['ListId'])[_0xead9('0x1b')](function(_0x546bb4){if(hasTZ)_0x1c26d2=_0x1c26d2[_0xead9('0x87')](_0xead9('0x72'),_0xead9('0xa1'));var _0x2cd95f=util[_0xead9('0xf')]('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',_0x42e1c0,_0x178ad4,_0x1c26d2,_0x5001df['ListId'],_0x5001df[_0xead9('0x55')]||null,NOW,NOW);if(_[_0xead9('0x20')](_0x4af27b[_0xead9('0x33')])){_0x2cd95f+=',\x20scheduledAt\x20=\x20NOW()';}_0x3cc46c['push'](_0x2cd95f);if(_0x5001df['duplicates']&&_0x5001df[_0xead9('0x9a')][_0xead9('0x1c')]){_0x3cc46c[_0xead9('0x1d')](insertCmContact(_0x5001df[_0xead9('0x34')],_0x178ad4,_0x5001df[_0xead9('0x9a')],_0x4af27b));_0x3cc46c[_0xead9('0x1d')](_0xead9('0xa2')+_0x178ad4+';');}BPromise[_0xead9('0xa0')](_0x3cc46c,handleQuery)[_0xead9('0x1b')](function(_0x3cd24f){BPromise[_0xead9('0x1e')]([handleAdditionalPhones()])[_0xead9('0x1b')](function(){_0x3cc46c=[];for(var _0x2ee983=0x0;_0x2ee983\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','bluebird','moment','squel','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','phone','from','join','.id\x20=\x20','where','\x20=\x20','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','catch','error','message','split','filter','CmContactHasItem','findOne','updated','PHONE','inserted','CmContact'];(function(_0x378275,_0x19a8b0){var _0x41955e=function(_0xc6dba4){while(--_0xc6dba4){_0x378275['push'](_0x378275['shift']());}};_0x41955e(++_0x19a8b0);}(_0xa062,0x101));var _0x2a06=function(_0xae2add,_0x1c1106){_0xae2add=_0xae2add-0x0;var _0x1a512a=_0xa062[_0xae2add];return _0x1a512a;};'use strict';var fs=require('fs');var path=require(_0x2a06('0x0'));var _=require(_0x2a06('0x1'));var Papa=require(_0x2a06('0x2'));var util=require('util');var BPromise=require(_0x2a06('0x3'));var moment=require(_0x2a06('0x4'));var squel=require(_0x2a06('0x5'));var Redis=require(_0x2a06('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0x2a06('0x7'));var logger=require('../../../config/logger')('import');config[_0x2a06('0x8')]=_[_0x2a06('0x9')](config[_0x2a06('0x8')],{'host':_0x2a06('0xa'),'port':0x18eb});var socket=require(_0x2a06('0xb'))(new Redis(config[_0x2a06('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0x2a06('0xc'));var tempTableName=_0x2a06('0xd')+moment()['format'](_0x2a06('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0xd2a1a0){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))*$/[_0x2a06('0xf')](_0xd2a1a0);}function selectNotIn(_0x533012,_0x528c65,_0x4b0b28,_0x4d9237,_0x291dd4){return squel[_0x2a06('0x10')]()['field'](_0x2a06('0x11'))[_0x2a06('0x12')](_0x4d9237)[_0x2a06('0x13')](_0x528c65,null,_0x528c65+_0x2a06('0x14')+_0x4d9237+'.'+_0x4b0b28)[_0x2a06('0x15')](_0x4d9237+'.'+_0x4b0b28+_0x2a06('0x16')+_0x533012+'.'+_0x4b0b28)[_0x2a06('0x15')](_0x528c65+'.dialCheckDuplicateType\x20IN\x20('+_0x291dd4['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x43fa64,_0x3a7fcd){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0x2a06('0x17')](_0x2a06('0x18')+tempTableName)[_0x2a06('0x19')](function(_0x1ba819){if(_0x1ba819!==null){var _0x65805f=[];for(var _0x3864aa=0x0;_0x3864aa<_0x1ba819[_0x2a06('0x1a')];_0x3864aa++){var _0xe429f2=_0x1ba819[_0x3864aa];if(!_[_0x2a06('0x1b')](_0xe429f2[_0x2a06('0x11')])){if(!_['isNil'](_0xe429f2[_0x2a06('0x1c')]))_0x65805f[_0x2a06('0x1d')](insertAdditionalPhones(_0xe429f2));promisesContact[_0x2a06('0x1d')]({'contact':_0xe429f2});}}}Promise[_0x2a06('0x1e')](_0x65805f)[_0x2a06('0x1f')](function(){_0x43fa64({'val':0x1});});})[_0x2a06('0x20')](function(_0x2b962a){logger[_0x2a06('0x21')](_0x2b962a[_0x2a06('0x22')]);});});}function insertAdditionalPhones(_0x248300){return new Promise(function(_0x249d42,_0x38c6fd){var _0x498415=_0x248300[_0x2a06('0x1c')];if(_[_0x2a06('0x1b')](_0x498415))_0x38c6fd({'val':0x0});else{var _0x24af58=_0x498415[_0x2a06('0x23')](';');var _0x1c7e4e=[];orderBy=0x0;for(var _0x382b4a=0x0;_0x382b4a<_0x24af58['length'];_0x382b4a++){_0x1c7e4e['push'](splitAdditionalPhone(_0x248300['id'],_0x24af58[_0x382b4a]));}Promise[_0x2a06('0x1e')](_0x1c7e4e)['then'](function(){_0x249d42({'val':_0x24af58['length']});});}});}function splitAdditionalPhone(_0x3eef6f,_0x3b97ee){return new Promise(function(_0x21e09c,_0x1d61dc){var _0x1b3673=_0x3b97ee[_0x2a06('0x23')](':');var _0x5c9f1d=_0x1b3673[0x0];var _0x58733f=_0x1b3673[0x1];if(_0x58733f!==''){var _0x371b56=_0x58733f[_0x2a06('0x23')]('|');var _0x2dc7e4=[];for(var _0x72f402=0x0;_0x72f402<_0x371b56[_0x2a06('0x1a')];_0x72f402++){if(_0x371b56[_0x72f402]!==''){var _0x5edc18=_[_0x2a06('0x24')](promisesAdditionalPhones,{'contactId':_0x3eef6f,'phone':_0x371b56[_0x72f402]});if(_0x5edc18[_0x2a06('0x1a')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x3eef6f,'contactTypeId':_0x5c9f1d,'phone':_0x371b56[_0x72f402],'orderBy':orderBy});}}}_0x21e09c({'ok':0x1});}else _0x21e09c({'res':0x0});});}function createAdditionalPhone(_0xfd1407,_0xc7b773,_0x404631,_0x45bafa){var _0x445be8='';var _0x49cf8d='';var _0xf6ae16=_0x404631['split']('§');_0x445be8=_0xf6ae16[0x0];if(_0xf6ae16[_0x2a06('0x1a')]==0x2)_0x49cf8d=_0xf6ae16[0x1];return new Promise(function(_0x2c3b01,_0x40dbc2){return db[_0x2a06('0x25')][_0x2a06('0x26')]({'where':{'CmContactId':_0xfd1407,'item':_0x445be8}})['then'](function(_0x214067){if(_0x214067){return db[_0x2a06('0x25')]['update']({'ItemTypeId':_0xc7b773,'description':_0x49cf8d,'OrderBy':_0x45bafa},{'where':{'CmContactId':_0xfd1407,'item':_0x445be8}})['then'](function(_0x5b48e7){_0x2c3b01({'res':_0x2a06('0x27')});});}else{return db['CmContactHasItem']['create']({'CmContactId':_0xfd1407,'item':_0x445be8,'ItemTypeId':_0xc7b773,'description':_0x49cf8d,'OrderBy':_0x45bafa,'ItemClass':_0x2a06('0x28')})[_0x2a06('0x1f')](function(_0x17fede){_0x2c3b01({'res':_0x2a06('0x29')});});}});});}function updateContact(_0x35b66e){return new Promise(function(_0x45739b,_0x19bb03){var _0x371e25=_0x35b66e['id'];delete _0x35b66e['id'];return db[_0x2a06('0x2a')]['update'](_0x35b66e,{'where':{'id':_0x371e25}})[_0x2a06('0x1f')](function(_0x272c40){updatedRows+=0x1;return db[_0x2a06('0x2b')]['update']({'phone':_0x35b66e['phone']},{'where':{'ContactId':_0x371e25}})[_0x2a06('0x1f')](function(_0x1b0fe8){_0x45739b({'ret':'OK'});});});});}function insertCmHopper(_0x475c73,_0x516e2c,_0x5df66a,_0x386b42,_0x207d98){var _0x3bafb7=[_0x2a06('0x2c'),'cm_contacts.scheduledat',_0x2a06('0x2d'),'cm_contacts.ListId',_0x516e2c+'.'+_0x386b42,_0x2a06('0x2e'),_0x2a06('0x2f'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x207d98+'\x22'];return squel[_0x2a06('0x30')]()[_0x2a06('0x31')](_0x2a06('0x32'))[_0x2a06('0x33')](['phone','scheduledat','ContactId',_0x2a06('0x34'),_0x386b42,_0x2a06('0x35'),_0x2a06('0x36'),_0x2a06('0x37'),_0x2a06('0x38'),_0x2a06('0x39')],squel[_0x2a06('0x10')]()['fields'](_0x3bafb7)['from'](_0x516e2c)[_0x2a06('0x13')](_0x2a06('0x3a'),null,_0x2a06('0x3b')+_0x516e2c+_0x2a06('0x3c'))[_0x2a06('0x13')](_0x5df66a,null,_0x5df66a+_0x2a06('0x14')+_0x516e2c+'.'+_0x386b42)[_0x2a06('0x15')](_0x516e2c+_0x2a06('0x3d'),_0x475c73)[_0x2a06('0x15')](_0x2a06('0x3e'),NOW)[_0x2a06('0x15')](_0x2a06('0x3f'),selectNotIn(_0x516e2c,_0x5df66a,_0x386b42,_0x2a06('0x32'),[_0x2a06('0x40'),_0x2a06('0x41')]))[_0x2a06('0x15')](_0x2a06('0x3f'),selectNotIn(_0x516e2c,_0x5df66a,_0x386b42,_0x2a06('0x32'),['\x22always\x22'])))[_0x2a06('0x42')]();}function insertCmHopperBlack(_0x866956,_0x337742,_0x1e4f98,_0x1f5c2e){var _0x180d35=[_0x2a06('0x2c'),_0x2a06('0x2d'),_0x2a06('0x43'),_0x337742+'.'+_0x1f5c2e,_0x2a06('0x2e'),_0x2a06('0x2f')];return squel[_0x2a06('0x30')]()[_0x2a06('0x31')](_0x2a06('0x44'))[_0x2a06('0x33')]([_0x2a06('0x11'),_0x2a06('0x45'),_0x2a06('0x34'),_0x1f5c2e,_0x2a06('0x35'),_0x2a06('0x36')],squel[_0x2a06('0x10')]()['fields'](_0x180d35)[_0x2a06('0x12')](_0x337742)['join']('cm_contacts',null,_0x2a06('0x3b')+_0x337742+'.CmListId')[_0x2a06('0x13')](_0x1e4f98,null,_0x1e4f98+'.id\x20=\x20'+_0x337742+'.'+_0x1f5c2e)['where'](_0x337742+_0x2a06('0x3d'),_0x866956)[_0x2a06('0x15')](_0x2a06('0x3e'),NOW)[_0x2a06('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x2a06('0x10')]()[_0x2a06('0x46')](_0x2a06('0x11'))[_0x2a06('0x12')]('cm_hopper_black')[_0x2a06('0x15')](_0x2a06('0x47'),_0x866956)[_0x2a06('0x15')](_0x1f5c2e+_0x2a06('0x48'),_0x337742+'.'+_0x1f5c2e)))['toString']();}function insertCmHopperAdditionalPhones(_0x22dd68){var _0x2900e1=['cm_hopper.id',_0x2a06('0x49'),_0x2a06('0x4a'),'cm_contact_has_items.createdAt',_0x2a06('0x4b')];return squel[_0x2a06('0x30')]()[_0x2a06('0x31')](_0x2a06('0x4c'))[_0x2a06('0x33')](['CmHopperId','phone',_0x2a06('0x4d'),'createdAt',_0x2a06('0x36')],squel['select']()['fields'](_0x2900e1)[_0x2a06('0x12')]('cm_hopper')[_0x2a06('0x13')](_0x2a06('0x3a'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x2a06('0x13')](_0x2a06('0x4e'),null,_0x2a06('0x4f'))[_0x2a06('0x15')](_0x2a06('0x50'),_0x22dd68)[_0x2a06('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x2a06('0x42')]();}function insertCmContact(_0x4e7e73,_0x1c654b,_0x115c83,_0x16be9f){var _0x2f821f=_[_0x2a06('0x51')](_[_0x2a06('0x52')](_0x16be9f),['ListId',_0x2a06('0x53'),_0x2a06('0x35'),_0x2a06('0x36')]);return squel[_0x2a06('0x30')]()[_0x2a06('0x31')](_0x2a06('0x3a'))[_0x2a06('0x33')](_0x2f821f,squel[_0x2a06('0x10')]()[_0x2a06('0x54')](_0x2f821f)['from'](_0x1c654b)['where']('('+_0x115c83['join'](',')+_0x2a06('0x55'),squel[_0x2a06('0x10')]()['fields'](_0x115c83)['from'](_0x2a06('0x3a'))[_0x2a06('0x15')]('ListId\x20=\x20?',_0x4e7e73))[_0x2a06('0x15')](_0x2a06('0x56'),squel[_0x2a06('0x10')]()[_0x2a06('0x46')](_0x2a06('0x57'),'min_id')['from'](_0x1c654b)['group'](_0x115c83[_0x2a06('0x13')](','))))[_0x2a06('0x42')]();}function handleStop(){logger[_0x2a06('0x58')](_0x2a06('0x59'));stopped=!![];}function handleUncaughtException(_0x23f15b){logger[_0x2a06('0x21')](_0x23f15b[_0x2a06('0x22')]);process[_0x2a06('0x5a')](0x1);}function handleError(_0x3e2ab7,_0x2ac21d){stats[_0x2a06('0x5b')][_0x2a06('0x1d')]({'name':_0x2ac21d[_0x2a06('0x5c')],'message':_0x2ac21d[_0x2a06('0x22')],'row':_0x3e2ab7});}function handleQuery(_0x21de54){logger['info'](_0x21de54);return db['sequelize'][_0x2a06('0x17')](_0x21de54)['spread'](function(_0xb80b56){results[_0x2a06('0x1d')](_0xb80b56);})[_0x2a06('0x20')](function(_0x3c8059){logger[_0x2a06('0x21')](_0x3c8059[_0x2a06('0x22')]);});}function main(_0x524629,_0xd7f89a,_0x5156f4,_0x2f187d){logger['info'](_0x2a06('0x5d'),_0x524629,JSON['stringify'](_0xd7f89a));process['send']('start');var _0x56f24c=_0xd7f89a[_0x2a06('0x5e')];var _0x625991=_['clone'](_0x56f24c);var _0x3c13db=_0xd7f89a[_0x2a06('0x5f')];var _0x3e6a2d=path['join'](config[_0x2a06('0x60')],_0x2a06('0x61'),_0x3c13db+_0x2a06('0x62'));logger[_0x2a06('0x58')](_0x2a06('0x63'),_0xd7f89a);db[_0x2a06('0x64')][_0x2a06('0x65')]({'raw':!![],'attributes':['id','name']})[_0x2a06('0x1f')](function(_0x42090b){for(var _0x5cafb1=0x0;_0x5cafb1<_0x42090b[_0x2a06('0x1a')];_0x5cafb1++){if(_0x42090b[_0x5cafb1]['name']in _0x56f24c){contactItemTypes['push'](_0x42090b[_0x5cafb1]);delete _0x625991[_0x42090b[_0x5cafb1]['name']];hasAdditionalPhones=!![];}for(var _0x219588 in _0x56f24c){if(_0x42090b[_0x5cafb1]['name']+_0x2a06('0x66')===_0x219588){phoneDescriptions[_0x2a06('0x1d')]({'itemTypeId':_0x42090b[_0x5cafb1]['id'],'description':_0x219588});delete _0x625991[_0x219588];}}}if(hasAdditionalPhones)_0x625991['AdditionalPhones']='';var _0x55d22e=_[_0x2a06('0x52')](_0x625991)[_0x2a06('0x13')]();logger[_0x2a06('0x58')](_0x2a06('0x67'),_0x55d22e);fs[_0x2a06('0x68')](_0x3e6a2d,_0x55d22e+'\x0a');Papa[_0x2a06('0x69')](fs[_0x2a06('0x6a')](_0x524629),{'header':!![],'skipEmptyLines':!![],'step':function(_0x9135c3,_0x5966a4){try{for(var _0x40d316=0x0,_0x1899c4=[];_0x40d316<_0x9135c3['data']['length'];_0x40d316++){stats['rows']+=0x1;if(_0x9135c3[_0x2a06('0x5b')][_0x40d316]){handleError(_0x9135c3['data'][_0x40d316],_0x9135c3[_0x2a06('0x5b')][_0x40d316]);}else{var _0x481f42=[];var _0x531bb7=[];var _0x22a42a={};for(var _0x4b09d8 in _0x56f24c){let _0xeb42cb=contactItemTypes[_0x2a06('0x6b')](_0x22cef9=>_0x22cef9[_0x2a06('0x6c')]===_0x4b09d8);let _0xf2eb53=contactItemTypes['find'](_0x4612cb=>_0x4612cb[_0x2a06('0x6c')]+'_description'===_0x4b09d8);if(_['isNil'](_0xeb42cb)&&_[_0x2a06('0x1b')](_0xf2eb53)){if(_0x56f24c[_0x2a06('0x6d')](_0x4b09d8)){if(_0x9135c3[_0x2a06('0x6e')][_0x40d316][_0x56f24c[_0x4b09d8]]){var _0x4d7747=_[_0x2a06('0x6f')](_0x9135c3['data'][_0x40d316][_0x56f24c[_0x4b09d8]][_0x2a06('0x70')](/"/g,'\x27'));switch(_0x4b09d8){case _0x2a06('0x71'):var _0x1dcc75=moment(_0x4d7747,_0x2a06('0xc'),!![]);if(_0x1dcc75[_0x2a06('0x72')]()){_0x1899c4[_0x2a06('0x1d')]('\x22'+_0x4d7747+'\x22');}else{_0x481f42[_0x2a06('0x1d')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x28ac88=parseInt(_0x4d7747);_0x4d7747=_['isNaN'](_0x28ac88)||_0x28ac88<0x0||_0x28ac88>0x4?_0x2f187d?0x3:0x2:_0x28ac88;_0x1899c4[_0x2a06('0x1d')]('\x22'+_0x4d7747+'\x22');break;case _0x2a06('0x38'):var _0x31816a=parseInt(_0x4d7747);if(_[_0x2a06('0x73')](_0x31816a)&&_['includes'](_0x5156f4,_0x31816a)){_0x1899c4['push']('\x22'+_0x31816a+'\x22');}else{_0x481f42[_0x2a06('0x1d')]('agent\x20not\x20exists');}break;case _0x2a06('0x74'):if(isEmail(_0x4d7747)){_0x1899c4[_0x2a06('0x1d')]('\x22'+_0x4d7747+'\x22');}else{_0x481f42[_0x2a06('0x1d')](_0x2a06('0x75'));}break;case _0x2a06('0x76'):var _0x11a989=moment(_0x4d7747,_0x2a06('0x77'),!![]);if(_0x11a989[_0x2a06('0x72')]()){_0x1899c4[_0x2a06('0x1d')]('\x22'+_0x4d7747+'\x22');}else{_0x481f42[_0x2a06('0x1d')](_0x2a06('0x78'));}break;default:_0x1899c4[_0x2a06('0x1d')]('\x22'+_0x4d7747+'\x22');}}else{switch(_0x4b09d8){case _0x2a06('0x79'):case _0x2a06('0x11'):_0x481f42[_0x2a06('0x1d')](_0x4b09d8+_0x2a06('0x7a'));break;default:_0x1899c4[_0x2a06('0x1d')]('\x22\x22');}}}}else{var _0x379c2a='';if(!_[_0x2a06('0x1b')](_0xeb42cb)){if(!_0x22a42a[_0x2a06('0x6d')](_0xeb42cb['id'])){for(var _0x3fdbeb=0x0;_0x3fdbeb<_0x56f24c[_0x4b09d8][_0x2a06('0x1a')];_0x3fdbeb++){var _0x4d7747=_[_0x2a06('0x6f')](_0x9135c3[_0x2a06('0x6e')][_0x40d316][_0x56f24c[_0x4b09d8][_0x3fdbeb]][_0x2a06('0x70')](/"/g,'\x27'));var _0x2b2281=phoneDescriptions[_0x2a06('0x6b')](_0x1a4b0e=>_0x1a4b0e['itemTypeId']===_0xeb42cb['id']);if(!_[_0x2a06('0x1b')](_0x2b2281)){var _0x1944f8=_[_0x2a06('0x6f')](_0x9135c3['data'][_0x40d316][_0x56f24c[_0x2b2281['description']][0x0]][_0x2a06('0x70')](/"/g,'\x27'));if(!_['isNil'](_0x1944f8))_0x4d7747=_0x4d7747+'§'+_0x1944f8;}if(_0x379c2a=='')_0x379c2a=_0x4d7747;else _0x379c2a+='|'+_0x4d7747;}_0x531bb7[_0x2a06('0x1d')](_0xeb42cb['id']+':'+_0x379c2a);_0x22a42a[_0xeb42cb['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1899c4[_0x2a06('0x1d')]('\x22'+_0x531bb7[_0x2a06('0x13')](';')+'\x22');}if(_0x481f42[_0x2a06('0x1a')]){handleError(_0x9135c3[_0x2a06('0x6e')][_0x40d316],{'code':_0x2a06('0x7b'),'message':_0x481f42[_0x2a06('0x13')]()});}else{fs['appendFileSync'](_0x3e6a2d,_0x1899c4['join']()+'\x0a');}_0x1899c4=[];}if(!(stats[_0x2a06('0x7c')]%0xc8)){socket[_0x2a06('0x7d')](_0x2a06('0x7e')+_0x3c13db,stats);stats[_0x2a06('0x5b')]=[];}}if(stopped){logger['info'](_0x2a06('0x7f'));_0x5966a4['abort']();}}catch(_0x48e558){handleError(_0x9135c3[_0x2a06('0x6e')][_0x40d316],{'code':_0x2a06('0x80'),'message':_0x48e558[_0x2a06('0x22')]});logger['error']('step',_0x48e558[_0x2a06('0x22')]);}},'complete':function(){try{var _0x5a095d=[];var _0x1b1ef2=tempTableName;_0x5a095d['push'](_0x2a06('0x81')+_0x1b1ef2+_0x2a06('0x82'));logger[_0x2a06('0x58')]('CIS\x20len',contactItemTypes[_0x2a06('0x1a')]);var _0x2af922=util[_0x2a06('0x83')](_0x2a06('0x84'),_0x3e6a2d,_0x1b1ef2,_0x55d22e,_0xd7f89a[_0x2a06('0x34')],_0xd7f89a[_0x2a06('0x53')]||null,NOW,NOW);if(_[_0x2a06('0x1b')](_0x56f24c['scheduledat'])){_0x2af922+=_0x2a06('0x85');}_0x5a095d[_0x2a06('0x1d')](_0x2af922);BPromise[_0x2a06('0x86')](_0x5a095d,handleQuery)['then'](function(_0x30b0e7){BPromise[_0x2a06('0x1e')]([handleAdditionalPhones()])['then'](function(){_0x5a095d=[];for(var _0xf0d1d9=0x0;_0xf0d1d9\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','defaults','redis','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','format','YYYYMMDDHHmmss','select','phone','from','join','.id\x20=\x20','where','sequelize','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','catch','split','CmContactHasItem','create','inserted','CmContact','update','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','insert','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','fields','cm_contacts'];(function(_0x5622d4,_0x396780){var _0x353176=function(_0x3d1ede){while(--_0x3d1ede){_0x5622d4['push'](_0x5622d4['shift']());}};_0x353176(++_0x396780);}(_0x0f97,0x196));var _0x70f9=function(_0x461f4c,_0x4c293d){_0x461f4c=_0x461f4c-0x0;var _0x299260=_0x0f97[_0x461f4c];return _0x299260;};'use strict';var fs=require('fs');var path=require(_0x70f9('0x0'));var _=require(_0x70f9('0x1'));var Papa=require(_0x70f9('0x2'));var util=require(_0x70f9('0x3'));var BPromise=require(_0x70f9('0x4'));var moment=require(_0x70f9('0x5'));var squel=require(_0x70f9('0x6'));var Redis=require(_0x70f9('0x7'));var db=require(_0x70f9('0x8'))['db'];var config=require(_0x70f9('0x9'));var logger=require(_0x70f9('0xa'))('import');config['redis']=_[_0x70f9('0xb')](config[_0x70f9('0xc')],{'host':_0x70f9('0xd'),'port':0x18eb});var socket=require(_0x70f9('0xe'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0x70f9('0xf'));var tempTableName=_0x70f9('0x10')+moment()[_0x70f9('0x11')](_0x70f9('0x12'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x481fc2){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'](_0x481fc2);}function selectNotIn(_0x5de133,_0x50f052,_0x3f46e0,_0x3c3f23,_0x5951be){return squel[_0x70f9('0x13')]()['field'](_0x70f9('0x14'))[_0x70f9('0x15')](_0x3c3f23)[_0x70f9('0x16')](_0x50f052,null,_0x50f052+_0x70f9('0x17')+_0x3c3f23+'.'+_0x3f46e0)[_0x70f9('0x18')](_0x3c3f23+'.'+_0x3f46e0+'\x20=\x20'+_0x5de133+'.'+_0x3f46e0)[_0x70f9('0x18')](_0x50f052+'.dialCheckDuplicateType\x20IN\x20('+_0x5951be['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4879b4,_0x4f1ba0){promisesAdditionalPhones=[];promisesContact=[];return db[_0x70f9('0x19')]['query'](_0x70f9('0x1a')+tempTableName)[_0x70f9('0x1b')](function(_0x138a8e){if(_0x138a8e!==null){var _0x3ce5ed=[];for(var _0x25b88f=0x0;_0x25b88f<_0x138a8e[_0x70f9('0x1c')];_0x25b88f++){var _0xfa4388=_0x138a8e[_0x25b88f];if(!_[_0x70f9('0x1d')](_0xfa4388[_0x70f9('0x14')])){if(!_['isNil'](_0xfa4388[_0x70f9('0x1e')]))_0x3ce5ed[_0x70f9('0x1f')](insertAdditionalPhones(_0xfa4388));promisesContact['push']({'contact':_0xfa4388});}}}Promise[_0x70f9('0x20')](_0x3ce5ed)[_0x70f9('0x21')](function(){_0x4879b4({'val':0x1});});})[_0x70f9('0x22')](function(_0x22f7f7){logger['error'](_0x22f7f7['message']);});});}function insertAdditionalPhones(_0x14de5c){return new Promise(function(_0x24a7f1,_0x34e740){var _0x12b71a=_0x14de5c['AdditionalPhones'];if(_[_0x70f9('0x1d')](_0x12b71a))_0x34e740({'val':0x0});else{var _0x5156d5=_0x12b71a[_0x70f9('0x23')](';');var _0x309afd=[];orderBy=0x0;for(var _0x3ce965=0x0;_0x3ce965<_0x5156d5[_0x70f9('0x1c')];_0x3ce965++){_0x309afd[_0x70f9('0x1f')](splitAdditionalPhone(_0x14de5c['id'],_0x5156d5[_0x3ce965]));}Promise['all'](_0x309afd)[_0x70f9('0x21')](function(){_0x24a7f1({'val':_0x5156d5[_0x70f9('0x1c')]});});}});}function splitAdditionalPhone(_0x388f13,_0x5d5372){return new Promise(function(_0x47057b,_0x474474){var _0xcc9c19=_0x5d5372[_0x70f9('0x23')](':');var _0x2a9c4b=_0xcc9c19[0x0];var _0x49337a=_0xcc9c19[0x1];if(_0x49337a!==''){var _0x3a8209=_0x49337a[_0x70f9('0x23')]('|');var _0x1139e7=[];for(var _0x386ded=0x0;_0x386ded<_0x3a8209[_0x70f9('0x1c')];_0x386ded++){if(_0x3a8209[_0x386ded]!==''){var _0xfe324e=_['filter'](promisesAdditionalPhones,{'contactId':_0x388f13,'phone':_0x3a8209[_0x386ded]});if(_0xfe324e[_0x70f9('0x1c')]==0x0){orderBy++;promisesAdditionalPhones[_0x70f9('0x1f')]({'contactId':_0x388f13,'contactTypeId':_0x2a9c4b,'phone':_0x3a8209[_0x386ded],'orderBy':orderBy});}}}_0x47057b({'ok':0x1});}else _0x47057b({'res':0x0});});}function createAdditionalPhone(_0x1a0da5,_0x2ddf21,_0x35d452,_0x701ff2){var _0x3e29b9='';var _0x28a8c6='';var _0x562b72=_0x35d452['split']('§');_0x3e29b9=_0x562b72[0x0];if(_0x562b72[_0x70f9('0x1c')]==0x2)_0x28a8c6=_0x562b72[0x1];return new Promise(function(_0x428646,_0x2f805a){return db['CmContactHasItem']['findOne']({'where':{'CmContactId':_0x1a0da5,'item':_0x3e29b9}})[_0x70f9('0x21')](function(_0xe9d41f){if(_0xe9d41f){return db['CmContactHasItem']['update']({'ItemTypeId':_0x2ddf21,'description':_0x28a8c6,'OrderBy':_0x701ff2},{'where':{'CmContactId':_0x1a0da5,'item':_0x3e29b9}})[_0x70f9('0x21')](function(_0x17cf3f){_0x428646({'res':'updated'});});}else{return db[_0x70f9('0x24')][_0x70f9('0x25')]({'CmContactId':_0x1a0da5,'item':_0x3e29b9,'ItemTypeId':_0x2ddf21,'description':_0x28a8c6,'OrderBy':_0x701ff2,'ItemClass':'PHONE'})[_0x70f9('0x21')](function(_0xb9c6a2){_0x428646({'res':_0x70f9('0x26')});});}});});}function updateContact(_0x54b093){return new Promise(function(_0xa93f4a,_0x19c476){var _0x4b9b8d=_0x54b093['id'];delete _0x54b093['id'];return db[_0x70f9('0x27')][_0x70f9('0x28')](_0x54b093,{'where':{'id':_0x4b9b8d}})['then'](function(_0x139f2d){updatedRows+=0x1;return db[_0x70f9('0x29')][_0x70f9('0x28')]({'phone':_0x54b093[_0x70f9('0x14')]},{'where':{'ContactId':_0x4b9b8d}})[_0x70f9('0x21')](function(_0x36e93d){_0xa93f4a({'ret':'OK'});});});});}function insertCmHopper(_0x32bfb3,_0x4b1c17,_0x3a7e9e,_0x1b98cf,_0x242101){var _0x13a5ea=[_0x70f9('0x2a'),_0x70f9('0x2b'),'cm_contacts.id',_0x70f9('0x2c'),_0x4b1c17+'.'+_0x1b98cf,_0x70f9('0x2d'),'cm_contacts.updatedAt',_0x70f9('0x2e'),'cm_contacts.UserId','\x22'+_0x242101+'\x22'];return squel[_0x70f9('0x2f')]()['into'](_0x70f9('0x30'))[_0x70f9('0x31')]([_0x70f9('0x14'),_0x70f9('0x32'),_0x70f9('0x33'),_0x70f9('0x34'),_0x1b98cf,_0x70f9('0x35'),_0x70f9('0x36'),_0x70f9('0x37'),_0x70f9('0x38'),'recallme'],squel[_0x70f9('0x13')]()[_0x70f9('0x39')](_0x13a5ea)[_0x70f9('0x15')](_0x4b1c17)[_0x70f9('0x16')](_0x70f9('0x3a'),null,_0x70f9('0x3b')+_0x4b1c17+'.CmListId')[_0x70f9('0x16')](_0x3a7e9e,null,_0x3a7e9e+_0x70f9('0x17')+_0x4b1c17+'.'+_0x1b98cf)[_0x70f9('0x18')](_0x4b1c17+_0x70f9('0x3c'),_0x32bfb3)[_0x70f9('0x18')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x70f9('0x18')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4b1c17,_0x3a7e9e,_0x1b98cf,_0x70f9('0x30'),['\x22always\x22',_0x70f9('0x3d')]))['where'](_0x70f9('0x3e'),selectNotIn(_0x4b1c17,_0x3a7e9e,_0x1b98cf,'cm_hopper',['\x22always\x22'])))[_0x70f9('0x3f')]();}function insertCmHopperBlack(_0x4c5991,_0x40dd09,_0x5c35f5,_0x70e4a7){var _0x392d10=[_0x70f9('0x2a'),'cm_contacts.id','cm_contacts.ListId',_0x40dd09+'.'+_0x70e4a7,_0x70f9('0x2d'),_0x70f9('0x40')];return squel['insert']()[_0x70f9('0x41')](_0x70f9('0x42'))[_0x70f9('0x31')]([_0x70f9('0x14'),_0x70f9('0x33'),_0x70f9('0x34'),_0x70e4a7,_0x70f9('0x35'),'updatedAt'],squel[_0x70f9('0x13')]()[_0x70f9('0x39')](_0x392d10)[_0x70f9('0x15')](_0x40dd09)[_0x70f9('0x16')]('cm_contacts',null,_0x70f9('0x3b')+_0x40dd09+_0x70f9('0x43'))[_0x70f9('0x16')](_0x5c35f5,null,_0x5c35f5+_0x70f9('0x17')+_0x40dd09+'.'+_0x70e4a7)[_0x70f9('0x18')](_0x40dd09+_0x70f9('0x3c'),_0x4c5991)['where'](_0x70f9('0x44'),NOW)[_0x70f9('0x18')](_0x70f9('0x3e'),squel[_0x70f9('0x13')]()['field'](_0x70f9('0x14'))['from'](_0x70f9('0x42'))['where'](_0x70f9('0x45'),_0x4c5991)[_0x70f9('0x18')](_0x70e4a7+_0x70f9('0x46'),_0x40dd09+'.'+_0x70e4a7)))[_0x70f9('0x3f')]();}function insertCmHopperAdditionalPhones(_0x41cc84){var _0x5a727e=[_0x70f9('0x47'),'cm_contact_has_items.item',_0x70f9('0x48'),_0x70f9('0x49'),_0x70f9('0x4a')];return squel[_0x70f9('0x2f')]()[_0x70f9('0x41')]('cm_hopper_additional_phones')[_0x70f9('0x31')](['CmHopperId','phone',_0x70f9('0x4b'),_0x70f9('0x35'),'updatedAt'],squel[_0x70f9('0x13')]()[_0x70f9('0x39')](_0x5a727e)[_0x70f9('0x15')](_0x70f9('0x30'))[_0x70f9('0x16')](_0x70f9('0x3a'),null,_0x70f9('0x4c'))[_0x70f9('0x16')](_0x70f9('0x4d'),null,_0x70f9('0x4e'))['where'](_0x70f9('0x4f'),_0x41cc84)[_0x70f9('0x18')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x70f9('0x3f')]();}function insertCmContact(_0x28b50e,_0x3ec5f4,_0x1c6522,_0x5305b7){var _0x2e69e=_['concat'](_[_0x70f9('0x50')](_0x5305b7),[_0x70f9('0x34'),_0x70f9('0x51'),_0x70f9('0x35'),'updatedAt']);return squel['insert']()[_0x70f9('0x41')]('cm_contacts')[_0x70f9('0x31')](_0x2e69e,squel[_0x70f9('0x13')]()[_0x70f9('0x39')](_0x2e69e)['from'](_0x3ec5f4)[_0x70f9('0x18')]('('+_0x1c6522[_0x70f9('0x16')](',')+_0x70f9('0x52'),squel[_0x70f9('0x13')]()[_0x70f9('0x39')](_0x1c6522)[_0x70f9('0x15')](_0x70f9('0x3a'))[_0x70f9('0x18')](_0x70f9('0x45'),_0x28b50e))[_0x70f9('0x18')](_0x70f9('0x53'),squel[_0x70f9('0x13')]()['field'](_0x70f9('0x54'),_0x70f9('0x55'))['from'](_0x3ec5f4)[_0x70f9('0x56')](_0x1c6522[_0x70f9('0x16')](','))))[_0x70f9('0x3f')]();}function handleStop(){logger[_0x70f9('0x57')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x389c86){logger['error'](_0x389c86['message']);process['exit'](0x1);}function handleError(_0x1681b2,_0x4ac43f){stats[_0x70f9('0x58')][_0x70f9('0x1f')]({'name':_0x4ac43f[_0x70f9('0x59')],'message':_0x4ac43f['message'],'row':_0x1681b2});}function handleQuery(_0x23b82a){logger[_0x70f9('0x57')](_0x23b82a);return db[_0x70f9('0x19')][_0x70f9('0x5a')](_0x23b82a)[_0x70f9('0x1b')](function(_0x389b83){results[_0x70f9('0x1f')](_0x389b83);})['catch'](function(_0x2e6a2d){logger[_0x70f9('0x5b')](_0x2e6a2d[_0x70f9('0x5c')]);});}function main(_0x45a8e6,_0xd094c7,_0x5ddfd0,_0x16c752){logger[_0x70f9('0x57')](_0x70f9('0x5d'),_0x45a8e6,JSON['stringify'](_0xd094c7));process[_0x70f9('0x5e')](_0x70f9('0x5f'));var _0xbac3d6=_0xd094c7[_0x70f9('0x60')];var _0x32ddd4=_['clone'](_0xbac3d6);var _0x461acd=_0xd094c7[_0x70f9('0x61')];var _0x23171e=path[_0x70f9('0x16')](config[_0x70f9('0x62')],'server/files/tmp',_0x461acd+_0x70f9('0x63'));logger['info'](_0x70f9('0x64'),_0xd094c7);db[_0x70f9('0x65')][_0x70f9('0x66')]({'raw':!![],'attributes':['id',_0x70f9('0x67')]})[_0x70f9('0x21')](function(_0x1845e5){for(var _0x21729c=0x0;_0x21729c<_0x1845e5[_0x70f9('0x1c')];_0x21729c++){if(_0x1845e5[_0x21729c]['name']in _0xbac3d6){contactItemTypes['push'](_0x1845e5[_0x21729c]);delete _0x32ddd4[_0x1845e5[_0x21729c][_0x70f9('0x67')]];hasAdditionalPhones=!![];}for(var _0x581456 in _0xbac3d6){if(_0x1845e5[_0x21729c][_0x70f9('0x67')]+_0x70f9('0x68')===_0x581456){phoneDescriptions[_0x70f9('0x1f')]({'itemTypeId':_0x1845e5[_0x21729c]['id'],'description':_0x581456});delete _0x32ddd4[_0x581456];}}}if(hasAdditionalPhones)_0x32ddd4[_0x70f9('0x1e')]='';var _0x50fdd8=_[_0x70f9('0x50')](_0x32ddd4)['join']();logger[_0x70f9('0x57')](_0x70f9('0x69'),_0x50fdd8);fs['writeFileSync'](_0x23171e,_0x50fdd8+'\x0a');Papa['parse'](fs[_0x70f9('0x6a')](_0x45a8e6),{'header':!![],'skipEmptyLines':!![],'step':function(_0x286428,_0x5d764c){try{for(var _0x3f9e0f=0x0,_0x4041d3=[];_0x3f9e0f<_0x286428[_0x70f9('0x6b')][_0x70f9('0x1c')];_0x3f9e0f++){stats[_0x70f9('0x6c')]+=0x1;if(_0x286428[_0x70f9('0x58')][_0x3f9e0f]){handleError(_0x286428[_0x70f9('0x6b')][_0x3f9e0f],_0x286428['errors'][_0x3f9e0f]);}else{var _0x172530=[];var _0x3c88ce=[];var _0x1ef246={};for(var _0x58f54a in _0xbac3d6){let _0x33e959=contactItemTypes[_0x70f9('0x6d')](_0x30a64d=>_0x30a64d[_0x70f9('0x67')]===_0x58f54a);let _0x15cc1b=contactItemTypes[_0x70f9('0x6d')](_0x2fd708=>_0x2fd708[_0x70f9('0x67')]+_0x70f9('0x68')===_0x58f54a);if(_[_0x70f9('0x1d')](_0x33e959)&&_['isNil'](_0x15cc1b)){if(_0xbac3d6[_0x70f9('0x6e')](_0x58f54a)){if(_0x286428['data'][_0x3f9e0f][_0xbac3d6[_0x58f54a]]){var _0x37158b=_['trim'](_0x286428['data'][_0x3f9e0f][_0xbac3d6[_0x58f54a]][_0x70f9('0x6f')](/"/g,'\x27'));switch(_0x58f54a){case _0x70f9('0x32'):var _0x5f03a5=moment(_0x37158b,_0x70f9('0xf'),!![]);if(_0x5f03a5['isValid']()){_0x4041d3[_0x70f9('0x1f')]('\x22'+_0x37158b+'\x22');}else{_0x172530['push'](_0x70f9('0x70'));}break;case _0x70f9('0x37'):var _0x949af=parseInt(_0x37158b);_0x37158b=_[_0x70f9('0x71')](_0x949af)||_0x949af<0x0||_0x949af>0x4?_0x16c752?0x3:0x2:_0x949af;_0x4041d3['push']('\x22'+_0x37158b+'\x22');break;case'UserId':var _0x2a9421=parseInt(_0x37158b);if(_[_0x70f9('0x72')](_0x2a9421)&&_[_0x70f9('0x73')](_0x5ddfd0,_0x2a9421)){_0x4041d3[_0x70f9('0x1f')]('\x22'+_0x2a9421+'\x22');}else{_0x172530['push'](_0x70f9('0x74'));}break;case _0x70f9('0x75'):if(isEmail(_0x37158b)){_0x4041d3['push']('\x22'+_0x37158b+'\x22');}else{_0x172530[_0x70f9('0x1f')]('email\x20wrong\x20format');}break;case _0x70f9('0x76'):var _0x583217=moment(_0x37158b,_0x70f9('0x77'),!![]);if(_0x583217[_0x70f9('0x78')]()){_0x4041d3[_0x70f9('0x1f')]('\x22'+_0x37158b+'\x22');}else{_0x172530[_0x70f9('0x1f')](_0x70f9('0x79'));}break;default:_0x4041d3[_0x70f9('0x1f')]('\x22'+_0x37158b+'\x22');}}else{switch(_0x58f54a){case'firstName':case'phone':_0x172530['push'](_0x58f54a+_0x70f9('0x7a'));break;default:_0x4041d3[_0x70f9('0x1f')]('\x22\x22');}}}}else{var _0x30c1aa='';if(!_[_0x70f9('0x1d')](_0x33e959)){if(!_0x1ef246[_0x70f9('0x6e')](_0x33e959['id'])){for(var _0x37ed8d=0x0;_0x37ed8d<_0xbac3d6[_0x58f54a]['length'];_0x37ed8d++){var _0x37158b=_['trim'](_0x286428[_0x70f9('0x6b')][_0x3f9e0f][_0xbac3d6[_0x58f54a][_0x37ed8d]][_0x70f9('0x6f')](/"/g,'\x27'));var _0x44fc2e=phoneDescriptions['find'](_0x1c2228=>_0x1c2228[_0x70f9('0x7b')]===_0x33e959['id']);if(!_[_0x70f9('0x1d')](_0x44fc2e)){var _0x448fd9=_[_0x70f9('0x7c')](_0x286428[_0x70f9('0x6b')][_0x3f9e0f][_0xbac3d6[_0x44fc2e[_0x70f9('0x7d')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0x70f9('0x1d')](_0x448fd9))_0x37158b=_0x37158b+'§'+_0x448fd9;}if(_0x30c1aa=='')_0x30c1aa=_0x37158b;else _0x30c1aa+='|'+_0x37158b;}_0x3c88ce[_0x70f9('0x1f')](_0x33e959['id']+':'+_0x30c1aa);_0x1ef246[_0x33e959['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4041d3[_0x70f9('0x1f')]('\x22'+_0x3c88ce['join'](';')+'\x22');}if(_0x172530[_0x70f9('0x1c')]){handleError(_0x286428[_0x70f9('0x6b')][_0x3f9e0f],{'code':_0x70f9('0x7e'),'message':_0x172530[_0x70f9('0x16')]()});}else{fs[_0x70f9('0x7f')](_0x23171e,_0x4041d3[_0x70f9('0x16')]()+'\x0a');}_0x4041d3=[];}if(!(stats['rows']%0xc8)){socket['emit'](_0x70f9('0x80')+_0x461acd,stats);stats['errors']=[];}}if(stopped){logger[_0x70f9('0x57')](_0x70f9('0x81'));_0x5d764c[_0x70f9('0x82')]();}}catch(_0x5796a8){handleError(_0x286428['data'][_0x3f9e0f],{'code':_0x70f9('0x83'),'message':_0x5796a8[_0x70f9('0x5c')]});logger[_0x70f9('0x5b')](_0x70f9('0x84'),_0x5796a8[_0x70f9('0x5c')]);}},'complete':function(){try{var _0x579800=[];var _0x4c9120=tempTableName;_0x579800[_0x70f9('0x1f')]('CREATE\x20TABLE\x20'+_0x4c9120+_0x70f9('0x85'));logger['info'](_0x70f9('0x86'),contactItemTypes[_0x70f9('0x1c')]);var _0x5165e7=util[_0x70f9('0x11')](_0x70f9('0x87'),_0x23171e,_0x4c9120,_0x50fdd8,_0xd094c7[_0x70f9('0x34')],_0xd094c7['CompanyId']||null,NOW,NOW);if(_['isNil'](_0xbac3d6[_0x70f9('0x32')])){_0x5165e7+=_0x70f9('0x88');}_0x579800[_0x70f9('0x1f')](_0x5165e7);BPromise[_0x70f9('0x89')](_0x579800,handleQuery)['then'](function(_0x3e866a){BPromise[_0x70f9('0x20')]([handleAdditionalPhones()])[_0x70f9('0x21')](function(){_0x579800=[];for(var _0x5214d8=0x0;_0x5214d8\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.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.to','i.ContactId','i.MailAccountId','i.UserId','openchannel','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Owner.fullname','Owner.internal','limit','offset','groupBy','findOne','enableEmailPreview','clone','COUNT(*)','getSelectedTags','isEmpty','exports','lodash','squel','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','field','color','from','tools_tags','getInteractionFK','user_has_','select','u.id','u.fullname','ui.','left_join','users','u.id\x20=\x20ui.UserId','where','map','getInteractionsTables','interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','\x20=\x20i.id','interactionsTags','it.','expr','forEach','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','sms','whatsapp','includes','i.fax\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','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','conditions','length','name','buildExpression','type','default','text','value','end','read','and','Contact','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','start','tags','clause','ids','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','user','plainBody','keys','some','compact','concat','createdAt','parse','$gte','\x20IS\x20NULL','\x20=\x20?','resolve','fields','then','tag','filter','get','capitalize','chat','Websites','\x20IS\x20NOT\x20NULL'];(function(_0x1a84b1,_0x3ca6d8){var _0x161938=function(_0x44e888){while(--_0x44e888){_0x1a84b1['push'](_0x1a84b1['shift']());}};_0x161938(++_0x3ca6d8);}(_0xf0a9,0x188));var _0x9f0a=function(_0x34bc7f,_0x2345c3){_0x34bc7f=_0x34bc7f-0x0;var _0x7f8b24=_0xf0a9[_0x34bc7f];return _0x7f8b24;};'use strict';var _=require(_0x9f0a('0x0'));var squel=require(_0x9f0a('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0x9f0a('0x2'));var updateInteraction=require(_0x9f0a('0x3'))[_0x9f0a('0x4')];var utils=require(_0x9f0a('0x5'));var db=require(_0x9f0a('0x6'))['db'];function skipInteractionsQuery(_0x5be429,_0x1d4ff3,_0xa70c6){var _0x5e5c7c=![];var _0x1eb6c2=utils[_0x9f0a('0x7')](_0x5be429);if(_0x1d4ff3[_0x9f0a('0x8')]===_0x9f0a('0x9')&&!_0xa70c6[_0x9f0a('0xa')]&&!_0xa70c6[_0x1eb6c2]){_0x5e5c7c=!![];}return _0x5e5c7c;}function getTagsQuery(){return squel['select']()[_0x9f0a('0xb')]('id')[_0x9f0a('0xb')]('name')[_0x9f0a('0xb')](_0x9f0a('0xc'))[_0x9f0a('0xd')](_0x9f0a('0xe'));}function getUsersQuery(_0xb3173f,_0x1b3629){var _0x48015c=utils[_0x9f0a('0xf')](_0xb3173f);var _0x3037ed=_0x9f0a('0x10')+_0xb3173f+'_interactions';var _0x38d265=squel[_0x9f0a('0x11')]()[_0x9f0a('0xb')](_0x9f0a('0x12'))[_0x9f0a('0xb')](_0x9f0a('0x13'))[_0x9f0a('0xb')](_0x9f0a('0x14')+_0x48015c)['from'](_0x3037ed,'ui')[_0x9f0a('0x15')](_0x9f0a('0x16'),'u',_0x9f0a('0x17'));if(_0x1b3629['length']>0x0){_0x38d265[_0x9f0a('0x18')]('ui.'+_0x48015c+'\x20IN\x20?',_[_0x9f0a('0x19')](_0x1b3629,'id'));}return _0x38d265;}function getInteractionsQuery(_0x3e4537){var _0x37e2e8=utils[_0x9f0a('0x1a')](_0x3e4537);var _0xb0b1e3=utils[_0x9f0a('0x7')](_0x3e4537);var _0x39c9c4=utils['getInteractionFK'](_0x3e4537);return squel[_0x9f0a('0x11')]()[_0x9f0a('0xd')](_0x37e2e8[_0x9f0a('0x1b')],'i')['left_join']('cm_contacts','c',_0x9f0a('0x1c'))[_0x9f0a('0x15')]('users','o',_0x9f0a('0x1d'))['left_join'](_0x37e2e8[_0x9f0a('0x1e')],'a',_0x9f0a('0x1f')+_0xb0b1e3)[_0x9f0a('0x15')](_0x37e2e8[_0x9f0a('0x20')],'me','me.'+_0x39c9c4+_0x9f0a('0x21'))[_0x9f0a('0x15')](_0x37e2e8[_0x9f0a('0x22')],'it',_0x9f0a('0x23')+_0x39c9c4+_0x9f0a('0x21'))[_0x9f0a('0x15')](_0x9f0a('0xe'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x474590={'body':squel['expr'](),'contact':squel[_0x9f0a('0x24')](),'default':squel[_0x9f0a('0x24')](),'fields':squel[_0x9f0a('0x24')](),'filter':squel[_0x9f0a('0x24')](),'read':squel['expr'](),'tags':{'clause':squel[_0x9f0a('0x24')](),'ids':null},'user':squel[_0x9f0a('0x24')]()};return _0x474590;}function parseTagParameter(_0x1585b0){var _0x1808f3=squel[_0x9f0a('0x24')]();if(_0x1585b0){var _0x2666a0=utils['getSelectedTags'](_0x1585b0);_0x2666a0[_0x9f0a('0x25')](function(_0x5c6ad1){_0x1808f3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5c6ad1+',%');});}return _0x1808f3;}function parseReadParameter(_0x254d6e){var _0x21b223='';if(_0x254d6e){_0x21b223=_0x9f0a('0x26');if(_0x254d6e==='1'){_0x21b223=_0x21b223[_0x9f0a('0x27')](_0x9f0a('0x28'),'=');}else{_0x21b223=_0x21b223[_0x9f0a('0x27')]('{OPERATOR}','>');}}return _0x21b223;}function parseSearchFilter(_0x5032bf,_0x46994b){var _0x1db460=squel[_0x9f0a('0x24')]();if(_0x46994b){var _0x6c0603=_0x46994b['replace']('\x5c','\x5c\x5c')[_0x9f0a('0x27')](/'/g,'\x27\x27');if(qs[_0x9f0a('0x29')](_0x6c0603)){_0x1db460['or']('i.id\x20LIKE\x20?',_0x6c0603+'%');if([_0x9f0a('0x2a'),_0x9f0a('0x2b')][_0x9f0a('0x2c')](_0x5032bf)){_0x1db460['or']('i.phone\x20LIKE\x20?',_0x6c0603+'%');}else if(_0x5032bf==='fax'){_0x1db460['or'](_0x9f0a('0x2d'),_0x6c0603+'%');}else if(_0x5032bf==='openchannel'){_0x1db460['or']('i.from\x20LIKE\x20?',_0x6c0603+'%');}}else if(_0x5032bf===_0x9f0a('0x2e')&&qs[_0x9f0a('0x2f')](_0x6c0603)){_0x1db460['or'](_0x9f0a('0x30'),_0x6c0603+'%');}else{if(_0x5032bf===_0x9f0a('0x2e')){_0x1db460['or'](_0x9f0a('0x31'),qs[_0x9f0a('0x32')](_0x6c0603,!![]))['or'](_0x9f0a('0x33'),qs['getFullTextValue'](_0x6c0603));}else if(_0x5032bf!==_0x9f0a('0x34')){_0x1db460['or'](_0x9f0a('0x35'),qs['getFullTextValue'](_0x6c0603));}_0x1db460['or'](_0x9f0a('0x36'),qs[_0x9f0a('0x32')](_0x6c0603,!![]),null);}}return _0x1db460;}function parseAdvancedSearchFilter(_0x32bf60,_0x144c0b){var _0x1214fe=getSqlClauses();var _0x2d86f7=as[_0x9f0a('0x37')](_0x32bf60);var _0x1d8f3a=_0x2d86f7['sqlOperator'];for(var _0xccf423=0x0;_0xccf423<_0x2d86f7[_0x9f0a('0x38')][_0x9f0a('0x39')];_0xccf423++){var _0x202013=_0x2d86f7[_0x9f0a('0x38')][_0xccf423];var _0x326fef='i';var _0x58d4a6=_['find'](_0x144c0b,[_0x9f0a('0x3a'),_0x202013[_0x9f0a('0xb')]]);if(_0x58d4a6){var _0x539d9d=as[_0x9f0a('0x3b')](_0x326fef,_0x58d4a6[_0x9f0a('0x3c')],_0x202013);_0x1214fe[_0x9f0a('0x3d')][_0x1d8f3a](_0x539d9d[_0x9f0a('0x3e')],_0x539d9d[_0x9f0a('0x3f')]['start'],_0x539d9d['value'][_0x9f0a('0x40')]);}else{switch(_0x202013[_0x9f0a('0xb')]){case'unreadMessages':var _0x379387=parseReadParameter(_0x202013['value']);_0x1214fe[_0x9f0a('0x41')][_0x9f0a('0x42')](_0x379387);break;case _0x9f0a('0x43'):if(_0x202013[_0x9f0a('0x44')]===_0x9f0a('0x45')){if(_0x202013[_0x9f0a('0x3f')][_0x9f0a('0x46')]('\x20')[_0x9f0a('0x39')]>0x1){_0x1214fe[_0x9f0a('0x47')][_0x1d8f3a](_0x9f0a('0x36'),qs[_0x9f0a('0x32')](_0x202013['value'],!![]),null);}else{var _0x3cf874='%'+_0x202013[_0x9f0a('0x3f')]+'%';_0x1214fe[_0x9f0a('0x47')][_0x1d8f3a](_0x9f0a('0x48'),_0x3cf874,_0x3cf874,_0x3cf874);}}else{_0x58d4a6=_[_0x9f0a('0x49')](_0x144c0b,[_0x9f0a('0x3a'),'ContactId']);_0x202013[_0x9f0a('0xb')]=_0x9f0a('0x4a');_0x539d9d=as[_0x9f0a('0x3b')](_0x326fef,_0x58d4a6['type'],_0x202013);_0x1214fe[_0x9f0a('0x47')][_0x1d8f3a](_0x539d9d[_0x9f0a('0x3e')],_0x539d9d[_0x9f0a('0x3f')][_0x9f0a('0x4b')],_0x539d9d[_0x9f0a('0x3f')]['end']);}break;case'Tag':var _0xf10449=_0x202013[_0x9f0a('0x3f')][_0x9f0a('0x46')](',')['map'](function(_0x15fb69){return Number(_0x15fb69);});var _0x5a832c=parseTagParameter(_0xf10449);_0x1214fe[_0x9f0a('0x4c')][_0x9f0a('0x4d')][_0x9f0a('0x42')](_0x5a832c);_0x1214fe['tags'][_0x9f0a('0x4e')]=_0xf10449;break;case _0x9f0a('0x4f'):if(_0x202013[_0x9f0a('0x44')]===_0x9f0a('0x45')){_0x1214fe['user'][_0x1d8f3a](_0x9f0a('0x50'),'%'+_0x202013[_0x9f0a('0x3f')]+'%',null);}else{_0x58d4a6=_['find'](_0x144c0b,[_0x9f0a('0x3a'),_0x9f0a('0x51')]);_0x202013['field']=_0x9f0a('0x51');_0x539d9d=as[_0x9f0a('0x3b')](_0x326fef,_0x58d4a6[_0x9f0a('0x3c')],_0x202013);_0x1214fe[_0x9f0a('0x52')][_0x1d8f3a](_0x539d9d[_0x9f0a('0x3e')],_0x539d9d['value']['start'],_0x539d9d[_0x9f0a('0x3f')][_0x9f0a('0x40')]);}break;case'body':case _0x9f0a('0x53'):_0x539d9d=as['buildExpression']('me',null,_0x202013);_0x1214fe['body'][_0x1d8f3a](_0x539d9d[_0x9f0a('0x3e')],_0x539d9d[_0x9f0a('0x3f')][_0x9f0a('0x4b')],_0x539d9d[_0x9f0a('0x3f')]['end']);break;}}}return _0x1214fe;}function parseModelFields(_0x1fad90,_0x50bf8b,_0xccc2cc){var _0x1ad201=utils[_0x9f0a('0x7')](_0x1fad90);var _0x24e0a4=squel['expr']();var _0x56b7db=_(_0x50bf8b)[_0x9f0a('0x54')]()['map'](function(_0x51994e){return _[_0x9f0a('0x55')](_0xccc2cc,[_0x9f0a('0x3a'),_0x51994e])?_0x51994e:undefined;})[_0x9f0a('0x56')]()[_0x9f0a('0x3f')]();if(_0x56b7db[_0x9f0a('0x39')]>0x0){_0x56b7db[_0x9f0a('0x25')](function(_0x2d33ab){if(_0x2d33ab===_0x1ad201){_0x24e0a4['and']('i.'+_0x1ad201+'\x20IN\x20?',[][_0x9f0a('0x57')](_0x50bf8b[_0x2d33ab]));}else if(_0x2d33ab===_0x9f0a('0x58')){var _0x486d04=JSON[_0x9f0a('0x59')](_0x50bf8b[_0x2d33ab])[_0x9f0a('0x5a')];var _0x4be744=JSON[_0x9f0a('0x59')](_0x50bf8b[_0x2d33ab])['$lte'];_0x24e0a4[_0x9f0a('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x486d04,_0x4be744);}else{if(_0x50bf8b[_0x2d33ab]==='null'){_0x24e0a4['and']('i.'+_0x2d33ab+_0x9f0a('0x5b'));}else{_0x24e0a4['and']('i.'+_0x2d33ab+_0x9f0a('0x5c'),_0x50bf8b[_0x2d33ab]);}}});}return _0x24e0a4;}function parseQueryParameters(_0x519365,_0x43fd1e,_0x1d6bd4){var _0x2f6249=getSqlClauses();return Promise[_0x9f0a('0x5d')]()['then'](function(){return parseModelFields(_0x519365,_0x43fd1e,_0x1d6bd4);})['then'](function(_0x4fb768){_0x2f6249[_0x9f0a('0x5e')][_0x9f0a('0x42')](_0x4fb768);return parseReadParameter(_0x43fd1e[_0x9f0a('0x41')]);})[_0x9f0a('0x5f')](function(_0x464bf4){_0x2f6249[_0x9f0a('0x41')][_0x9f0a('0x42')](_0x464bf4);return parseTagParameter(_0x43fd1e[_0x9f0a('0x60')]);})[_0x9f0a('0x5f')](function(_0x5e6c23){_0x2f6249[_0x9f0a('0x4c')]['clause']['and'](_0x5e6c23);return parseSearchFilter(_0x519365,_0x43fd1e[_0x9f0a('0x61')]);})[_0x9f0a('0x5f')](function(_0x5676c0){_0x2f6249[_0x9f0a('0x61')]=_0x5676c0;return _0x2f6249;});}function checkAccountsRestrictions(_0x34ba61,_0x1ee3ca,_0x43da4f){var _0x104733=utils[_0x9f0a('0x7')](_0x34ba61);var _0x2f556b=_0x9f0a('0x62')+_[_0x9f0a('0x63')](_0x34ba61)+(_0x34ba61===_0x9f0a('0x64')?_0x9f0a('0x65'):'Accounts');var _0x298d2f=squel[_0x9f0a('0x24')]();return Promise[_0x9f0a('0x5d')]()[_0x9f0a('0x5f')](function(){if(_0x43da4f['search']&&_0x1ee3ca[_0x9f0a('0x8')]==='agent'){return _0x1ee3ca[_0x2f556b]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x12e759){if(_0x12e759){if(_0x12e759[_0x9f0a('0x39')]===0x0){_0x298d2f[_0x9f0a('0x42')]('i.'+_0x104733+'\x20IS\x20NULL');}else{_0x298d2f[_0x9f0a('0x42')]('i.'+_0x104733+'\x20IN\x20?',_[_0x9f0a('0x19')](_0x12e759,'id'));}}else if(!_0x43da4f[_0x104733]){_0x298d2f['and']('i.'+_0x104733+_0x9f0a('0x66'));}})[_0x9f0a('0x5f')](function(){return _0x298d2f;});}function getClosedOrderClause(_0x5bcdbb,_0x29bda7){var _0x35ba72='';var _0x1da5ca=[_0x9f0a('0x67'),_0x9f0a('0x68'),_0x9f0a('0x69')];if(_0x5bcdbb===_0x9f0a('0x2e')){_0x1da5ca[_0x9f0a('0x6a')]('i.substatus');}if(_0x29bda7[_0x9f0a('0x6b')]==='0'&&_0x5bcdbb===_0x9f0a('0x2e')){_0x35ba72=_0x9f0a('0x6c');}else{if(_0x29bda7[_0x9f0a('0x6b')]==='1'){_0x1da5ca[_0x9f0a('0x6d')]();}_0x35ba72='CONCAT_WS(\x27\x27,\x20'+_0x1da5ca[_0x9f0a('0x6e')](',\x20')+')';}return _0x35ba72;}function getFilteredInteractions(_0x430893,_0x334d2b,_0x38ea9a,_0x229dc2){var _0x45d07f=utils['getInteractionFK'](_0x430893);var _0x410ec2=_[_0x9f0a('0x63')](_0x430893)+_0x9f0a('0x6f');var _0x3da5a3=[];var _0x200294=getTagsQuery();var _0x416ad3={'type':db[_0x9f0a('0x70')][_0x9f0a('0x71')][_0x9f0a('0x72')],'raw':!![]};var _0x1c695b=[];var _0x87158e=[];return db[_0x9f0a('0x73')][_0x9f0a('0x74')](_0x200294[_0x9f0a('0x75')](),_0x416ad3)[_0x9f0a('0x5f')](function(_0x1715be){_0x3da5a3=_[_0x9f0a('0x76')](_0x1715be,'id');_0x416ad3=_[_0x9f0a('0x77')](_0x416ad3,{'model':db[_0x410ec2],'mapToModel':!![],'nest':!![]});if(_0x38ea9a[_0x9f0a('0x5e')]){_0x229dc2[_0x9f0a('0x78')]['forEach'](function(_0x3bb29d){_0x334d2b['field']('i.'+_0x3bb29d);});}else{_0x334d2b['field'](_0x9f0a('0x79'),_0x9f0a('0x7a'));_0x334d2b[_0x9f0a('0xb')](_0x9f0a('0x7b'),_0x9f0a('0x7c'));_0x334d2b['field']('a.mandatoryDisposition','Account.mandatoryDisposition');if(_0x430893==='mail'){_0x334d2b['field'](_0x9f0a('0x7d'),_0x9f0a('0x7e'));_0x334d2b[_0x9f0a('0xb')](_0x9f0a('0x7f'),_0x9f0a('0x80'));_0x334d2b['field']('i.id');_0x334d2b[_0x9f0a('0xb')]('i.createdAt');_0x334d2b[_0x9f0a('0xb')](_0x9f0a('0x81'));_0x334d2b[_0x9f0a('0xb')](_0x9f0a('0x82'));_0x334d2b['field'](_0x9f0a('0x83'));_0x334d2b[_0x9f0a('0xb')]('i.attach');_0x334d2b[_0x9f0a('0xb')](_0x9f0a('0x84'));_0x334d2b['field'](_0x9f0a('0x85'));_0x334d2b[_0x9f0a('0xb')](_0x9f0a('0x86'));_0x334d2b[_0x9f0a('0xb')](_0x9f0a('0x69'));_0x334d2b['field'](_0x9f0a('0x68'));_0x334d2b[_0x9f0a('0xb')](_0x9f0a('0x67'));_0x334d2b[_0x9f0a('0xb')](_0x9f0a('0x6c'));_0x334d2b['field'](_0x9f0a('0x87'));_0x334d2b['field'](_0x9f0a('0x88'));_0x334d2b[_0x9f0a('0xb')](_0x9f0a('0x89'));_0x334d2b[_0x9f0a('0xb')](_0x9f0a('0x8a'));}else if(_0x430893===_0x9f0a('0x8b')){_0x334d2b['field'](_0x9f0a('0x8c'),_0x9f0a('0x80'));}else{_0x334d2b[_0x9f0a('0xb')]('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',_0x9f0a('0x80'));}if(_0x430893!=='mail'){_0x334d2b[_0x9f0a('0xb')](_0x9f0a('0x8d'));}_0x334d2b[_0x9f0a('0xb')](_0x9f0a('0x8e'),_0x9f0a('0x8f'));_0x334d2b[_0x9f0a('0xb')](_0x9f0a('0x90'),_0x9f0a('0x91'));_0x334d2b[_0x9f0a('0xb')](_0x9f0a('0x92'),_0x9f0a('0x93'));_0x334d2b[_0x9f0a('0xb')](_0x9f0a('0x94'),_0x9f0a('0x95'));_0x334d2b['field'](_0x9f0a('0x96'),_0x9f0a('0x97'));_0x334d2b[_0x9f0a('0xb')](_0x9f0a('0x98'),'Contact.fax');_0x334d2b[_0x9f0a('0xb')]('o.fullname',_0x9f0a('0x99'));_0x334d2b['field']('o.internal',_0x9f0a('0x9a'));_0x334d2b['field']('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x229dc2[_0x9f0a('0x9b')]){_0x334d2b['limit'](_0x229dc2[_0x9f0a('0x9b')]);}if(_0x229dc2[_0x9f0a('0x9c')]){_0x334d2b[_0x9f0a('0x9c')](_0x229dc2[_0x9f0a('0x9c')]);}return db[_0x9f0a('0x73')]['query'](_0x334d2b[_0x9f0a('0x75')](),_0x416ad3);})['then'](function(_0x574e83){_0x1c695b=_0x574e83;var _0x5336fa=getUsersQuery(_0x430893,_0x1c695b);return db['sequelize'][_0x9f0a('0x74')](_0x5336fa[_0x9f0a('0x75')](),_0x416ad3);})['then'](function(_0x3894d5){_0x87158e=_[_0x9f0a('0x9d')](_0x3894d5,_0x45d07f);if(_0x430893===_0x9f0a('0x2e')){return db['Setting'][_0x9f0a('0x9e')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0x9f0a('0x5f')](function(_0x3b9468){var _0x33ecc5=_0x3b9468?_0x3b9468[_0x9f0a('0x9f')]:undefined;var _0x4e939f=_0x1c695b[_0x9f0a('0x19')](function(_0x1cb41c){return updateInteraction(_0x1cb41c,_0x3da5a3,_0x87158e,_0x33ecc5);});return Promise['all'](_0x4e939f);});}function countFilteredInteractions(_0x29ae3f,_0x57d20c){var _0x5a004d=_0x29ae3f[_0x9f0a('0xa0')]();_0x5a004d[_0x9f0a('0xb')](_0x9f0a('0xa1'));_0x5a004d[_0x9f0a('0xb')](_0x9f0a('0x79'),'unreadMessages');var _0x447900=utils[_0x9f0a('0xa2')](_0x57d20c);if(!_[_0x9f0a('0xa3')](_0x447900)){_0x5a004d[_0x9f0a('0x18')]('t.id\x20IN\x20?',_0x447900);}var _0x420f61={'type':db[_0x9f0a('0x70')][_0x9f0a('0x71')][_0x9f0a('0x72')],'raw':!![]};return db['sequelize'][_0x9f0a('0x74')](_0x5a004d[_0x9f0a('0x75')](),_0x420f61);}module[_0x9f0a('0xa4')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x6db8=['c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','toString','groupBy','findOne','enableEmailPreview','clone','COUNT(*)','t.id\x20IN\x20?','exports','squel','../parsers/qs','./update-interaction','updateInteraction','role','agent','select','field','name','color','from','tools_tags','_interactions','u.id','users','length','where','ui.','\x20IN\x20?','getInteractionsTables','getInteractionFK','left_join','o.id\x20=\x20i.UserId','accounts','me.','\x20=\x20i.id','interactionsTags','it.','expr','getSelectedTags','forEach','{OPERATOR}','replace','i.id\x20LIKE\x20?','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','getFullTextValue','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)','sqlOperator','find','buildExpression','type','default','text','value','start','end','read','and','Contact','operator','$substring','split','contact','ContactId','map','clause','tags','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','plainBody','getAccountFK','keys','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','then','fields','tag','filter','get','capitalize','chat','Websites','Accounts','resolve','search','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.disposition','unshift','i.substatus','closed','CONCAT_WS(\x27\x27,\x20','join','Sequelize','QueryTypes','sequelize','query','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','contactName','i.id','i.updatedAt','i.closed','i.lastMsgAt','i.lastMsgDirection','i.subject','i.secondDisposition','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','c.firstName','Contact.firstName','c.lastName','Contact.lastName'];(function(_0x26b1ea,_0x4fe767){var _0x523092=function(_0x303eb7){while(--_0x303eb7){_0x26b1ea['push'](_0x26b1ea['shift']());}};_0x523092(++_0x4fe767);}(_0x6db8,0x144));var _0x86db=function(_0x786e9,_0x1a029){_0x786e9=_0x786e9-0x0;var _0x1f891b=_0x6db8[_0x786e9];return _0x1f891b;};'use strict';var _=require('lodash');var squel=require(_0x86db('0x0'));var as=require('../parsers/advancedSearch');var qs=require(_0x86db('0x1'));var updateInteraction=require(_0x86db('0x2'))[_0x86db('0x3')];var utils=require('./utils');var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x29d0aa,_0x41d1af,_0x4c5929){var _0x4c44ac=![];var _0xbfe85f=utils['getAccountFK'](_0x29d0aa);if(_0x41d1af[_0x86db('0x4')]===_0x86db('0x5')&&!_0x4c5929['search']&&!_0x4c5929[_0xbfe85f]){_0x4c44ac=!![];}return _0x4c44ac;}function getTagsQuery(){return squel[_0x86db('0x6')]()['field']('id')[_0x86db('0x7')](_0x86db('0x8'))[_0x86db('0x7')](_0x86db('0x9'))[_0x86db('0xa')](_0x86db('0xb'));}function getUsersQuery(_0x51db45,_0x3d63bd){var _0x4f7017=utils['getInteractionFK'](_0x51db45);var _0x5b3bd1='user_has_'+_0x51db45+_0x86db('0xc');var _0x2afb20=squel[_0x86db('0x6')]()[_0x86db('0x7')](_0x86db('0xd'))['field']('u.fullname')[_0x86db('0x7')]('ui.'+_0x4f7017)['from'](_0x5b3bd1,'ui')['left_join'](_0x86db('0xe'),'u','u.id\x20=\x20ui.UserId');if(_0x3d63bd[_0x86db('0xf')]>0x0){_0x2afb20[_0x86db('0x10')](_0x86db('0x11')+_0x4f7017+_0x86db('0x12'),_['map'](_0x3d63bd,'id'));}return _0x2afb20;}function getInteractionsQuery(_0x397238){var _0xe15c7b=utils[_0x86db('0x13')](_0x397238);var _0x57e1c5=utils['getAccountFK'](_0x397238);var _0x265bfb=utils[_0x86db('0x14')](_0x397238);return squel['select']()[_0x86db('0xa')](_0xe15c7b['interactions'],'i')[_0x86db('0x15')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x86db('0x15')](_0x86db('0xe'),'o',_0x86db('0x16'))[_0x86db('0x15')](_0xe15c7b[_0x86db('0x17')],'a','a.id\x20=\x20i.'+_0x57e1c5)[_0x86db('0x15')](_0xe15c7b['messages'],'me',_0x86db('0x18')+_0x265bfb+_0x86db('0x19'))[_0x86db('0x15')](_0xe15c7b[_0x86db('0x1a')],'it',_0x86db('0x1b')+_0x265bfb+'\x20=\x20i.id')[_0x86db('0x15')](_0x86db('0xb'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x34d599={'body':squel['expr'](),'contact':squel[_0x86db('0x1c')](),'default':squel['expr'](),'fields':squel[_0x86db('0x1c')](),'filter':squel[_0x86db('0x1c')](),'read':squel[_0x86db('0x1c')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0x86db('0x1c')]()};return _0x34d599;}function parseTagParameter(_0x1bd74c){var _0xaef0ce=squel[_0x86db('0x1c')]();if(_0x1bd74c){var _0x5a1548=utils[_0x86db('0x1d')](_0x1bd74c);_0x5a1548[_0x86db('0x1e')](function(_0xca6839){_0xaef0ce['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xca6839+',%');});}return _0xaef0ce;}function parseReadParameter(_0x4ac20f){var _0xdbcb3f='';if(_0x4ac20f){_0xdbcb3f='unreadMessages\x20{OPERATOR}\x200';if(_0x4ac20f==='1'){_0xdbcb3f=_0xdbcb3f['replace'](_0x86db('0x1f'),'=');}else{_0xdbcb3f=_0xdbcb3f['replace'](_0x86db('0x1f'),'>');}}return _0xdbcb3f;}function parseSearchFilter(_0x53788c,_0x22f258){var _0x3c19be=squel[_0x86db('0x1c')]();if(_0x22f258){var _0x103bca=_0x22f258[_0x86db('0x20')]('\x5c','\x5c\x5c')[_0x86db('0x20')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x103bca)){_0x3c19be['or'](_0x86db('0x21'),_0x103bca+'%');if(['sms',_0x86db('0x22')][_0x86db('0x23')](_0x53788c)){_0x3c19be['or'](_0x86db('0x24'),_0x103bca+'%');}else if(_0x53788c===_0x86db('0x25')){_0x3c19be['or'](_0x86db('0x26'),_0x103bca+'%');}else if(_0x53788c===_0x86db('0x27')){_0x3c19be['or'](_0x86db('0x28'),_0x103bca+'%');}}else if(_0x53788c===_0x86db('0x29')&&qs['isEmail'](_0x103bca)){_0x3c19be['or']('c.email\x20LIKE\x20?',_0x103bca+'%');}else{if(_0x53788c===_0x86db('0x29')){_0x3c19be['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x86db('0x2a')](_0x103bca,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x86db('0x2a')](_0x103bca));}else if(_0x53788c!==_0x86db('0x25')){_0x3c19be['or'](_0x86db('0x2b'),qs[_0x86db('0x2a')](_0x103bca));}_0x3c19be['or'](_0x86db('0x2c'),qs[_0x86db('0x2a')](_0x103bca,!![]),null);}}return _0x3c19be;}function parseAdvancedSearchFilter(_0x112cb3,_0x42d243){var _0x3e2c87=getSqlClauses();var _0x72d689=as['parseSearch'](_0x112cb3);var _0x5126b7=_0x72d689[_0x86db('0x2d')];for(var _0x3f888f=0x0;_0x3f888f<_0x72d689['conditions']['length'];_0x3f888f++){var _0x4d2930=_0x72d689['conditions'][_0x3f888f];var _0x1d4354='i';var _0x5d8579=_[_0x86db('0x2e')](_0x42d243,[_0x86db('0x8'),_0x4d2930[_0x86db('0x7')]]);if(_0x5d8579){var _0x219a77=as[_0x86db('0x2f')](_0x1d4354,_0x5d8579[_0x86db('0x30')],_0x4d2930);_0x3e2c87[_0x86db('0x31')][_0x5126b7](_0x219a77[_0x86db('0x32')],_0x219a77[_0x86db('0x33')][_0x86db('0x34')],_0x219a77[_0x86db('0x33')][_0x86db('0x35')]);}else{switch(_0x4d2930[_0x86db('0x7')]){case'unreadMessages':var _0x918dff=parseReadParameter(_0x4d2930[_0x86db('0x33')]);_0x3e2c87[_0x86db('0x36')][_0x86db('0x37')](_0x918dff);break;case _0x86db('0x38'):if(_0x4d2930[_0x86db('0x39')]===_0x86db('0x3a')){if(_0x4d2930['value'][_0x86db('0x3b')]('\x20')[_0x86db('0xf')]>0x1){_0x3e2c87[_0x86db('0x3c')][_0x5126b7](_0x86db('0x2c'),qs['getFullTextValue'](_0x4d2930['value'],!![]),null);}else{var _0x5b471d='%'+_0x4d2930[_0x86db('0x33')]+'%';_0x3e2c87[_0x86db('0x3c')][_0x5126b7]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5b471d,_0x5b471d,_0x5b471d);}}else{_0x5d8579=_[_0x86db('0x2e')](_0x42d243,['name',_0x86db('0x3d')]);_0x4d2930[_0x86db('0x7')]=_0x86db('0x3d');_0x219a77=as[_0x86db('0x2f')](_0x1d4354,_0x5d8579[_0x86db('0x30')],_0x4d2930);_0x3e2c87[_0x86db('0x3c')][_0x5126b7](_0x219a77[_0x86db('0x32')],_0x219a77['value'][_0x86db('0x34')],_0x219a77[_0x86db('0x33')][_0x86db('0x35')]);}break;case'Tag':var _0x1057a1=_0x4d2930[_0x86db('0x33')][_0x86db('0x3b')](',')[_0x86db('0x3e')](function(_0x10915b){return Number(_0x10915b);});var _0x555f26=parseTagParameter(_0x1057a1);_0x3e2c87['tags'][_0x86db('0x3f')][_0x86db('0x37')](_0x555f26);_0x3e2c87[_0x86db('0x40')][_0x86db('0x41')]=_0x1057a1;break;case _0x86db('0x42'):if(_0x4d2930[_0x86db('0x39')]===_0x86db('0x3a')){_0x3e2c87[_0x86db('0x43')][_0x5126b7](_0x86db('0x44'),'%'+_0x4d2930[_0x86db('0x33')]+'%',null);}else{_0x5d8579=_[_0x86db('0x2e')](_0x42d243,[_0x86db('0x8'),_0x86db('0x45')]);_0x4d2930[_0x86db('0x7')]=_0x86db('0x45');_0x219a77=as['buildExpression'](_0x1d4354,_0x5d8579[_0x86db('0x30')],_0x4d2930);_0x3e2c87['user'][_0x5126b7](_0x219a77[_0x86db('0x32')],_0x219a77[_0x86db('0x33')]['start'],_0x219a77[_0x86db('0x33')]['end']);}break;case _0x86db('0x46'):case _0x86db('0x47'):_0x219a77=as['buildExpression']('me',null,_0x4d2930);_0x3e2c87[_0x86db('0x46')][_0x5126b7](_0x219a77['text'],_0x219a77[_0x86db('0x33')][_0x86db('0x34')],_0x219a77[_0x86db('0x33')][_0x86db('0x35')]);break;}}}return _0x3e2c87;}function parseModelFields(_0x3b5904,_0x4baf21,_0x51f5d2){var _0x16d60b=utils[_0x86db('0x48')](_0x3b5904);var _0xb99feb=squel[_0x86db('0x1c')]();var _0x5193e2=_(_0x4baf21)[_0x86db('0x49')]()['map'](function(_0x13ff66){return _['some'](_0x51f5d2,['name',_0x13ff66])?_0x13ff66:undefined;})['compact']()['value']();if(_0x5193e2[_0x86db('0xf')]>0x0){_0x5193e2[_0x86db('0x1e')](function(_0xf73736){if(_0xf73736===_0x16d60b){_0xb99feb[_0x86db('0x37')]('i.'+_0x16d60b+_0x86db('0x12'),[]['concat'](_0x4baf21[_0xf73736]));}else if(_0xf73736===_0x86db('0x4a')){var _0xab765d=JSON[_0x86db('0x4b')](_0x4baf21[_0xf73736])['$gte'];var _0x65e299=JSON[_0x86db('0x4b')](_0x4baf21[_0xf73736])[_0x86db('0x4c')];_0xb99feb['and'](_0x86db('0x4d'),_0xab765d,_0x65e299);}else{if(_0x4baf21[_0xf73736]==='null'){_0xb99feb['and']('i.'+_0xf73736+_0x86db('0x4e'));}else{_0xb99feb[_0x86db('0x37')]('i.'+_0xf73736+_0x86db('0x4f'),_0x4baf21[_0xf73736]);}}});}return _0xb99feb;}function parseQueryParameters(_0x5898bd,_0x55d3ba,_0x20b4c3){var _0x4b204b=getSqlClauses();return Promise['resolve']()[_0x86db('0x50')](function(){return parseModelFields(_0x5898bd,_0x55d3ba,_0x20b4c3);})['then'](function(_0x2f8b82){_0x4b204b[_0x86db('0x51')][_0x86db('0x37')](_0x2f8b82);return parseReadParameter(_0x55d3ba[_0x86db('0x36')]);})['then'](function(_0x378363){_0x4b204b[_0x86db('0x36')][_0x86db('0x37')](_0x378363);return parseTagParameter(_0x55d3ba[_0x86db('0x52')]);})[_0x86db('0x50')](function(_0x1d8909){_0x4b204b[_0x86db('0x40')]['clause'][_0x86db('0x37')](_0x1d8909);return parseSearchFilter(_0x5898bd,_0x55d3ba[_0x86db('0x53')]);})[_0x86db('0x50')](function(_0x24e1ec){_0x4b204b[_0x86db('0x53')]=_0x24e1ec;return _0x4b204b;});}function checkAccountsRestrictions(_0x25d352,_0x48a74a,_0x17a4ee){var _0x32edca=utils[_0x86db('0x48')](_0x25d352);var _0x3d8c53=_0x86db('0x54')+_[_0x86db('0x55')](_0x25d352)+(_0x25d352===_0x86db('0x56')?_0x86db('0x57'):_0x86db('0x58'));var _0x2bcf27=squel[_0x86db('0x1c')]();return Promise[_0x86db('0x59')]()[_0x86db('0x50')](function(){if(_0x17a4ee[_0x86db('0x5a')]&&_0x48a74a[_0x86db('0x4')]===_0x86db('0x5')){return _0x48a74a[_0x3d8c53]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x4e8bc6){if(_0x4e8bc6){if(_0x4e8bc6[_0x86db('0xf')]===0x0){_0x2bcf27[_0x86db('0x37')]('i.'+_0x32edca+_0x86db('0x4e'));}else{_0x2bcf27[_0x86db('0x37')]('i.'+_0x32edca+_0x86db('0x12'),_[_0x86db('0x3e')](_0x4e8bc6,'id'));}}else if(!_0x17a4ee[_0x32edca]){_0x2bcf27[_0x86db('0x37')]('i.'+_0x32edca+_0x86db('0x5b'));}})[_0x86db('0x50')](function(){return _0x2bcf27;});}function getClosedOrderClause(_0x3d6de8,_0x5d56f2){var _0x50230b='';var _0x4fb128=[_0x86db('0x5c'),'i.secondDisposition',_0x86db('0x5d')];if(_0x3d6de8==='mail'){_0x4fb128[_0x86db('0x5e')](_0x86db('0x5f'));}if(_0x5d56f2[_0x86db('0x60')]==='0'&&_0x3d6de8===_0x86db('0x29')){_0x50230b=_0x86db('0x5f');}else{if(_0x5d56f2['closed']==='1'){_0x4fb128['shift']();}_0x50230b=_0x86db('0x61')+_0x4fb128[_0x86db('0x62')](',\x20')+')';}return _0x50230b;}function getFilteredInteractions(_0x400ac0,_0x3a97fb,_0x21f273,_0x3953ba){var _0x1ce21b=utils[_0x86db('0x14')](_0x400ac0);var _0x4fde9e=_[_0x86db('0x55')](_0x400ac0)+'Interaction';var _0x6d7a5a=[];var _0x43f1c2=getTagsQuery();var _0x3bf5d9={'type':db[_0x86db('0x63')][_0x86db('0x64')]['SELECT'],'raw':!![]};var _0x3181ae=[];var _0x352cb5=[];return db[_0x86db('0x65')][_0x86db('0x66')](_0x43f1c2['toString'](),_0x3bf5d9)['then'](function(_0xeb239){_0x6d7a5a=_[_0x86db('0x67')](_0xeb239,'id');_0x3bf5d9=_['merge'](_0x3bf5d9,{'model':db[_0x4fde9e],'mapToModel':!![],'nest':!![]});if(_0x21f273[_0x86db('0x51')]){_0x3953ba['attributes']['forEach'](function(_0x3725e3){_0x3a97fb[_0x86db('0x7')]('i.'+_0x3725e3);});}else{_0x3a97fb[_0x86db('0x7')](_0x86db('0x68'),_0x86db('0x69'));_0x3a97fb[_0x86db('0x7')](_0x86db('0x6a'),'Account.key');_0x3a97fb[_0x86db('0x7')](_0x86db('0x6b'),_0x86db('0x6c'));if(_0x400ac0===_0x86db('0x29')){_0x3a97fb[_0x86db('0x7')](_0x86db('0x6d'),_0x86db('0x6e'));_0x3a97fb[_0x86db('0x7')]('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',_0x86db('0x6f'));_0x3a97fb[_0x86db('0x7')](_0x86db('0x70'));_0x3a97fb[_0x86db('0x7')]('i.createdAt');_0x3a97fb[_0x86db('0x7')](_0x86db('0x71'));_0x3a97fb['field'](_0x86db('0x72'));_0x3a97fb[_0x86db('0x7')]('i.closedAt');_0x3a97fb[_0x86db('0x7')]('i.attach');_0x3a97fb[_0x86db('0x7')](_0x86db('0x73'));_0x3a97fb['field'](_0x86db('0x74'));_0x3a97fb[_0x86db('0x7')](_0x86db('0x75'));_0x3a97fb[_0x86db('0x7')](_0x86db('0x5d'));_0x3a97fb[_0x86db('0x7')](_0x86db('0x76'));_0x3a97fb[_0x86db('0x7')](_0x86db('0x5c'));_0x3a97fb[_0x86db('0x7')](_0x86db('0x5f'));_0x3a97fb['field'](_0x86db('0x77'));_0x3a97fb['field'](_0x86db('0x78'));_0x3a97fb[_0x86db('0x7')](_0x86db('0x79'));_0x3a97fb[_0x86db('0x7')](_0x86db('0x7a'));}else if(_0x400ac0===_0x86db('0x27')){_0x3a97fb['field'](_0x86db('0x7b'),_0x86db('0x6f'));}else{_0x3a97fb[_0x86db('0x7')](_0x86db('0x7c'),_0x86db('0x6f'));}if(_0x400ac0!==_0x86db('0x29')){_0x3a97fb[_0x86db('0x7')]('i.*');}_0x3a97fb['field'](_0x86db('0x7d'),_0x86db('0x7e'));_0x3a97fb[_0x86db('0x7')](_0x86db('0x7f'),_0x86db('0x80'));_0x3a97fb['field'](_0x86db('0x81'),_0x86db('0x82'));_0x3a97fb[_0x86db('0x7')]('c.phone',_0x86db('0x83'));_0x3a97fb['field'](_0x86db('0x84'),_0x86db('0x85'));_0x3a97fb[_0x86db('0x7')](_0x86db('0x86'),_0x86db('0x87'));_0x3a97fb[_0x86db('0x7')]('o.fullname',_0x86db('0x88'));_0x3a97fb[_0x86db('0x7')](_0x86db('0x89'),_0x86db('0x8a'));_0x3a97fb[_0x86db('0x7')](_0x86db('0x8b'),_0x86db('0x8c'));}if(_0x3953ba['limit']){_0x3a97fb[_0x86db('0x8d')](_0x3953ba[_0x86db('0x8d')]);}if(_0x3953ba[_0x86db('0x8e')]){_0x3a97fb[_0x86db('0x8e')](_0x3953ba[_0x86db('0x8e')]);}return db[_0x86db('0x65')][_0x86db('0x66')](_0x3a97fb[_0x86db('0x8f')](),_0x3bf5d9);})[_0x86db('0x50')](function(_0x1ea4c2){_0x3181ae=_0x1ea4c2;var _0x578263=getUsersQuery(_0x400ac0,_0x3181ae);return db[_0x86db('0x65')][_0x86db('0x66')](_0x578263['toString'](),_0x3bf5d9);})[_0x86db('0x50')](function(_0x14aa8c){_0x352cb5=_[_0x86db('0x90')](_0x14aa8c,_0x1ce21b);if(_0x400ac0===_0x86db('0x29')){return db['Setting'][_0x86db('0x91')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0x86db('0x50')](function(_0x50c809){var _0x5020eb=_0x50c809?_0x50c809[_0x86db('0x92')]:undefined;var _0x29ffbd=_0x3181ae[_0x86db('0x3e')](function(_0x436063){return updateInteraction(_0x436063,_0x6d7a5a,_0x352cb5,_0x5020eb);});return Promise['all'](_0x29ffbd);});}function countFilteredInteractions(_0x584208,_0x195e31){var _0x2593f5=_0x584208[_0x86db('0x93')]();_0x2593f5['field'](_0x86db('0x94'));_0x2593f5[_0x86db('0x7')](_0x86db('0x68'),_0x86db('0x69'));var _0x4ad99c=utils[_0x86db('0x1d')](_0x195e31);if(!_['isEmpty'](_0x4ad99c)){_0x2593f5['where'](_0x86db('0x95'),_0x4ad99c);}var _0x1b5c65={'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};return db['sequelize']['query'](_0x2593f5[_0x86db('0x8f')](),_0x1b5c65);}module[_0x86db('0x96')]={'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 257676c..3fa0027 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 _0xa178=['MailMessage','findOne','plainBody','-id','then','lastMsgText','trimStart','updateInteraction','Users','TagIds','Tags','catch','lodash','../../mysqldb','map','split','forEach','waiting','talking','answered','total','closed','disposition','UserId','unmanaged'];(function(_0x5d8c47,_0x2626ba){var _0x28d478=function(_0x4a80d7){while(--_0x4a80d7){_0x5d8c47['push'](_0x5d8c47['shift']());}};_0x28d478(++_0x2626ba);}(_0xa178,0x1e7));var _0x8a17=function(_0xe809b,_0xe026db){_0xe809b=_0xe809b-0x0;var _0x20aaf2=_0xa178[_0xe809b];return _0x20aaf2;};'use strict';var _=require(_0x8a17('0x0'));var db=require(_0x8a17('0x1'))['db'];function getInteractionUsers(_0x36f829,_0x20d490){return new Promise(function(_0x3161eb,_0x5a0569){try{var _0x55febf=[];if(_0x20d490[_0x36f829]){_0x55febf=_0x20d490[_0x36f829][_0x8a17('0x2')](function(_0x425090){return{'id':_0x425090['id'],'fullname':_0x425090['fullname']};});}return _0x3161eb(_0x55febf);}catch(_0x9a1fac){_0x5a0569(_0x9a1fac);}});}function getInteractionTags(_0x855bb3,_0x1893b8){var _0x3ccb7b=[];if(_0x855bb3){_0x855bb3[_0x8a17('0x3')](',')[_0x8a17('0x4')](function(_0x232dfa){_0x3ccb7b['push'](_0x1893b8[_0x232dfa]);});}return _0x3ccb7b;}function updateWaitingCounter(_0x445526){if(_0x445526[_0x8a17('0x5')]){_0x445526[_0x8a17('0x5')]-=0x1;}}function updateInteractionCounters(_0x437f24){_0x437f24[_0x8a17('0x5')]=0x0;_0x437f24[_0x8a17('0x6')]=0x0;_0x437f24[_0x8a17('0x7')]=0x0;_0x437f24['unmanaged']=0x0;_0x437f24['abandoned']=0x0;_0x437f24[_0x8a17('0x8')]=0x0;if(_0x437f24[_0x8a17('0x9')]){if(_0x437f24[_0x8a17('0xa')]==='abandoned'){_0x437f24['abandoned']+=0x1;updateWaitingCounter(_0x437f24);}if(_0x437f24[_0x8a17('0xb')]){_0x437f24[_0x8a17('0x7')]+=0x1;if(_0x437f24['talking']){_0x437f24['talking']-=0x1;}}else{if(_0x437f24['disposition']){_0x437f24[_0x8a17('0xc')]+=0x1;updateWaitingCounter(_0x437f24);}}}else{if(!_0x437f24[_0x8a17('0xb')]){_0x437f24[_0x8a17('0x5')]+=0x1;}if(_0x437f24[_0x8a17('0xb')]){_0x437f24[_0x8a17('0x6')]+=0x1;updateWaitingCounter(_0x437f24);}}_0x437f24[_0x8a17('0x8')]+=0x1;return _0x437f24;}function getLastMessageText(_0x44401e){return db[_0x8a17('0xd')][_0x8a17('0xe')]({'where':{'$and':[{'MailInteractionId':_0x44401e['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x8a17('0xf')],'order':_0x8a17('0x10'),'raw':!![]})[_0x8a17('0x11')](function(_0x3a3d98){if(_0x3a3d98&&_0x3a3d98[_0x8a17('0xf')]){_0x44401e[_0x8a17('0x12')]=_[_0x8a17('0x13')](_0x3a3d98['plainBody']);}return _0x44401e;})['catch'](function(_0x2c46b7){throw _0x2c46b7;});}exports[_0x8a17('0x14')]=function(_0x20a455,_0x2bb1cd,_0x30ce99,_0xf424d){return new Promise(function(_0x2b31cf,_0x1c6aae){return getInteractionUsers(_0x20a455['id'],_0x30ce99)[_0x8a17('0x11')](function(_0x3edbca){_0x20a455[_0x8a17('0x15')]=_0x3edbca;return getInteractionTags(_0x20a455[_0x8a17('0x16')],_0x2bb1cd);})[_0x8a17('0x11')](function(_0x52c969){_0x20a455[_0x8a17('0x17')]=_0x52c969;delete _0x20a455[_0x8a17('0x16')];return updateInteractionCounters(_0x20a455);})[_0x8a17('0x11')](function(_0x567f6f){if(_0xf424d){return getLastMessageText(_0x567f6f);}else{return _0x567f6f;}})['then'](function(_0x332062){_0x2b31cf(_0x332062);})[_0x8a17('0x18')](function(_0x417c5d){_0x1c6aae(_0x417c5d);});});}; \ No newline at end of file +var _0xa640=['unmanaged','abandoned','total','closed','disposition','UserId','MailMessage','findOne','out','plainBody','then','lastMsgText','trimStart','catch','updateInteraction','TagIds','Tags','lodash','../../mysqldb','map','fullname','split','waiting','talking'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xa640,0x1a9));var _0x0a64=function(_0x3e9950,_0x1f0946){_0x3e9950=_0x3e9950-0x0;var _0x2e1438=_0xa640[_0x3e9950];return _0x2e1438;};'use strict';var _=require(_0x0a64('0x0'));var db=require(_0x0a64('0x1'))['db'];function getInteractionUsers(_0x25b8ab,_0x44e2ad){return new Promise(function(_0x26f9fd,_0x42b502){try{var _0x289114=[];if(_0x44e2ad[_0x25b8ab]){_0x289114=_0x44e2ad[_0x25b8ab][_0x0a64('0x2')](function(_0x314015){return{'id':_0x314015['id'],'fullname':_0x314015[_0x0a64('0x3')]};});}return _0x26f9fd(_0x289114);}catch(_0x3ef13a){_0x42b502(_0x3ef13a);}});}function getInteractionTags(_0xbc8981,_0x2ef712){var _0x28a332=[];if(_0xbc8981){_0xbc8981[_0x0a64('0x4')](',')['forEach'](function(_0x1547c9){_0x28a332['push'](_0x2ef712[_0x1547c9]);});}return _0x28a332;}function updateWaitingCounter(_0x57de06){if(_0x57de06[_0x0a64('0x5')]){_0x57de06['waiting']-=0x1;}}function updateInteractionCounters(_0x19ea43){_0x19ea43[_0x0a64('0x5')]=0x0;_0x19ea43[_0x0a64('0x6')]=0x0;_0x19ea43['answered']=0x0;_0x19ea43[_0x0a64('0x7')]=0x0;_0x19ea43[_0x0a64('0x8')]=0x0;_0x19ea43[_0x0a64('0x9')]=0x0;if(_0x19ea43[_0x0a64('0xa')]){if(_0x19ea43[_0x0a64('0xb')]===_0x0a64('0x8')){_0x19ea43[_0x0a64('0x8')]+=0x1;updateWaitingCounter(_0x19ea43);}if(_0x19ea43[_0x0a64('0xc')]){_0x19ea43['answered']+=0x1;if(_0x19ea43[_0x0a64('0x6')]){_0x19ea43['talking']-=0x1;}}else{if(_0x19ea43[_0x0a64('0xb')]){_0x19ea43[_0x0a64('0x7')]+=0x1;updateWaitingCounter(_0x19ea43);}}}else{if(!_0x19ea43[_0x0a64('0xc')]){_0x19ea43[_0x0a64('0x5')]+=0x1;}if(_0x19ea43[_0x0a64('0xc')]){_0x19ea43['talking']+=0x1;updateWaitingCounter(_0x19ea43);}}_0x19ea43[_0x0a64('0x9')]+=0x1;return _0x19ea43;}function getLastMessageText(_0x265135){return db[_0x0a64('0xd')][_0x0a64('0xe')]({'where':{'$and':[{'MailInteractionId':_0x265135['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0a64('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x0a64('0x10')],'order':'-id','raw':!![]})[_0x0a64('0x11')](function(_0x54561e){if(_0x54561e&&_0x54561e[_0x0a64('0x10')]){_0x265135[_0x0a64('0x12')]=_[_0x0a64('0x13')](_0x54561e[_0x0a64('0x10')]);}return _0x265135;})[_0x0a64('0x14')](function(_0x5d46a3){throw _0x5d46a3;});}exports[_0x0a64('0x15')]=function(_0x213ba4,_0x18df70,_0x263ac3,_0x36b1f1){return new Promise(function(_0x5577e2,_0xa6ef7f){return getInteractionUsers(_0x213ba4['id'],_0x263ac3)['then'](function(_0x1fb280){_0x213ba4['Users']=_0x1fb280;return getInteractionTags(_0x213ba4[_0x0a64('0x16')],_0x18df70);})['then'](function(_0x1936c9){_0x213ba4[_0x0a64('0x17')]=_0x1936c9;delete _0x213ba4[_0x0a64('0x16')];return updateInteractionCounters(_0x213ba4);})[_0x0a64('0x11')](function(_0x142713){if(_0x36b1f1){return getLastMessageText(_0x142713);}else{return _0x142713;}})[_0x0a64('0x11')](function(_0x363538){_0x5577e2(_0x363538);})[_0x0a64('0x14')](function(_0x537f37){_0xa6ef7f(_0x537f37);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 4211516..a6c3cc5 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 _0xc30b=['Interaction','findOne','then','update','catch','error','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','sms-interactions','chat-interactions','chat','Website','Account','capitalize','InteractionId','upperFirst','unknown','accounts','_interactions','_interaction_has_tags','_messages','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0xc30b,0x86));var _0xbc30=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xc30b[_0x29d94e];return _0x106237;};'use strict';var _=require(_0xbc30('0x0'));var db=require(_0xbc30('0x1'))['db'];var loggers={'openchannel':require(_0xbc30('0x2'))(_0xbc30('0x3')),'mail':require('../../config/logger')(_0xbc30('0x4')),'fax':require('../../config/logger')('fax-interactions'),'sms':require(_0xbc30('0x2'))(_0xbc30('0x5')),'chat':require('../../config/logger')(_0xbc30('0x6')),'whatsapp':require(_0xbc30('0x2'))('whatsapp-interactions')};function getAccountFK(_0x416226){return _['capitalize'](_0x416226)+(_0x416226===_0xbc30('0x7')?_0xbc30('0x8'):_0xbc30('0x9'))+'Id';}function getInteractionFK(_0xfacb36){return _[_0xbc30('0xa')](_0xfacb36)+_0xbc30('0xb');}function getInteractionId(_0x15e4d4,_0x4d2b16,_0x3ef1fb){if(_0x15e4d4&&_0x15e4d4[_[_0xbc30('0xc')](_0x3ef1fb)+'InteractionId']){return _0x15e4d4[_[_0xbc30('0xc')](_0x3ef1fb)+_0xbc30('0xb')];}else if(_0x15e4d4&&_0x15e4d4['id']){return _0x15e4d4['id'];}else if(_0x4d2b16&&_0x4d2b16['id']){return _0x4d2b16['id'];}else{return _0xbc30('0xd');}}function getInteractionsTables(_0x513144){return{'accounts':_0x513144+'_'+(_0x513144===_0xbc30('0x7')?'websites':_0xbc30('0xe')),'interactions':_0x513144+_0xbc30('0xf'),'interactionsTags':_0x513144+_0xbc30('0x10'),'messages':_0x513144+_0xbc30('0x11'),'userInteractions':'user_has_'+_0x513144+_0xbc30('0xf')};}function getSelectedTags(_0xcdcd05){var _0x12a191=[];if(_0xcdcd05){_0x12a191=Array[_0xbc30('0x12')](_0xcdcd05)?_0xcdcd05:[_0xcdcd05];}return _0x12a191;}function log(_0x46206c,_0x4873f1,_0x21d134,_0x51acb8,_0x3d3a9c,_0x3d38ce){loggers[_0x3d3a9c[_0xbc30('0x13')]()][_0x46206c](_0xbc30('0x14'),_0x3d38ce[_0xbc30('0x15')](),_0x4873f1?_0x4873f1['id']:null,_0x4873f1?_0x4873f1[_0xbc30('0x16')]:null,_0x4873f1?_0x4873f1[_0xbc30('0x17')]:null,getInteractionId(_0x21d134,_0x51acb8,_0x3d3a9c),_0x21d134?JSON[_0xbc30('0x18')](_0x21d134):_0xbc30('0x19'));}function updateUser(_0x3bb1d0,_0x1fd8f3,_0x5b5588,_0x520106,_0x521bb){db[_[_0xbc30('0xc')](_0x520106)+_0xbc30('0x1a')][_0xbc30('0x1b')]({'where':{'id':getInteractionId(_0x1fd8f3,_0x5b5588,_0x520106)}})[_0xbc30('0x1c')](function(_0x231b69){if(_0x231b69){return _0x231b69[_0xbc30('0x1d')]({'UserId':_0x3bb1d0?_0x3bb1d0['id']:null});}})[_0xbc30('0x1c')](function(_0x31f2b5){if(_0x31f2b5){log('info',_0x3bb1d0,_0x1fd8f3,_0x5b5588,_0x520106,_0x521bb);}})[_0xbc30('0x1e')](function(){log(_0xbc30('0x1f'),_0x3bb1d0,_0x1fd8f3,_0x5b5588,_0x520106,_0x521bb);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xf5af=['user_has_','toLowerCase','toUpperCase','stringify','Interaction','then','update','info','catch','error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','Website','Account','InteractionId','upperFirst','chat','websites','accounts','_interactions','_interaction_has_tags','_messages'];(function(_0x417e0a,_0x446db8){var _0x223dab=function(_0x56978c){while(--_0x56978c){_0x417e0a['push'](_0x417e0a['shift']());}};_0x223dab(++_0x446db8);}(_0xf5af,0x103));var _0xff5a=function(_0x1348c0,_0x7a9608){_0x1348c0=_0x1348c0-0x0;var _0x8a6441=_0xf5af[_0x1348c0];return _0x8a6441;};'use strict';var _=require(_0xff5a('0x0'));var db=require(_0xff5a('0x1'))['db'];var loggers={'openchannel':require(_0xff5a('0x2'))(_0xff5a('0x3')),'mail':require(_0xff5a('0x2'))(_0xff5a('0x4')),'fax':require(_0xff5a('0x2'))(_0xff5a('0x5')),'sms':require(_0xff5a('0x2'))(_0xff5a('0x6')),'chat':require(_0xff5a('0x2'))(_0xff5a('0x7')),'whatsapp':require(_0xff5a('0x2'))(_0xff5a('0x8'))};function getAccountFK(_0x2a878d){return _[_0xff5a('0x9')](_0x2a878d)+(_0x2a878d==='chat'?_0xff5a('0xa'):_0xff5a('0xb'))+'Id';}function getInteractionFK(_0x37d11f){return _[_0xff5a('0x9')](_0x37d11f)+_0xff5a('0xc');}function getInteractionId(_0x2edd79,_0xb65db,_0x58f1c4){if(_0x2edd79&&_0x2edd79[_[_0xff5a('0xd')](_0x58f1c4)+_0xff5a('0xc')]){return _0x2edd79[_[_0xff5a('0xd')](_0x58f1c4)+_0xff5a('0xc')];}else if(_0x2edd79&&_0x2edd79['id']){return _0x2edd79['id'];}else if(_0xb65db&&_0xb65db['id']){return _0xb65db['id'];}else{return'unknown';}}function getInteractionsTables(_0x29ebe0){return{'accounts':_0x29ebe0+'_'+(_0x29ebe0===_0xff5a('0xe')?_0xff5a('0xf'):_0xff5a('0x10')),'interactions':_0x29ebe0+_0xff5a('0x11'),'interactionsTags':_0x29ebe0+_0xff5a('0x12'),'messages':_0x29ebe0+_0xff5a('0x13'),'userInteractions':_0xff5a('0x14')+_0x29ebe0+'_interactions'};}function getSelectedTags(_0x119183){var _0x23dddb=[];if(_0x119183){_0x23dddb=Array['isArray'](_0x119183)?_0x119183:[_0x119183];}return _0x23dddb;}function log(_0x10bc74,_0x5e07e9,_0x21dfd9,_0x198f45,_0x210253,_0xb492d1){loggers[_0x210253[_0xff5a('0x15')]()][_0x10bc74]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xb492d1[_0xff5a('0x16')](),_0x5e07e9?_0x5e07e9['id']:null,_0x5e07e9?_0x5e07e9['name']:null,_0x5e07e9?_0x5e07e9['role']:null,getInteractionId(_0x21dfd9,_0x198f45,_0x210253),_0x21dfd9?JSON[_0xff5a('0x17')](_0x21dfd9):'null');}function updateUser(_0x54975b,_0x2d6cfc,_0x8612b1,_0x31d39b,_0x3e6ebb){db[_[_0xff5a('0xd')](_0x31d39b)+_0xff5a('0x18')]['findOne']({'where':{'id':getInteractionId(_0x2d6cfc,_0x8612b1,_0x31d39b)}})[_0xff5a('0x19')](function(_0x4b03e3){if(_0x4b03e3){return _0x4b03e3[_0xff5a('0x1a')]({'UserId':_0x54975b?_0x54975b['id']:null});}})[_0xff5a('0x19')](function(_0x31fe81){if(_0x31fe81){log(_0xff5a('0x1b'),_0x54975b,_0x2d6cfc,_0x8612b1,_0x31d39b,_0x3e6ebb);}})[_0xff5a('0x1c')](function(){log(_0xff5a('0x1d'),_0x54975b,_0x2d6cfc,_0x8612b1,_0x31d39b,_0x3e6ebb);});}module[_0xff5a('0x1e')]={'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 cde7cf1..8d40126 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 _0xb952=['split','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','License','findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../config/environment','data1','license'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0xb952,0xf4));var _0x2b95=function(_0x47fcc5,_0x639448){_0x47fcc5=_0x47fcc5-0x0;var _0x171bdf=_0xb952[_0x47fcc5];return _0x171bdf;};'use strict';var crypto=require(_0x2b95('0x0'));var util=require(_0x2b95('0x1'));var compose=require(_0x2b95('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x2b95('0x3'));function getValueFromLicense(_0x3924f1,_0x2df142){if(_0x3924f1&&_0x2df142){if(_0x2df142[_0x2b95('0x4')]&&_0x2df142[_0x2b95('0x5')]){var _0x2248b5=_0x2df142[_0x2b95('0x4')];var _0x4f69c6=_0x2df142['license'];var _0x3ce211=_0x2248b5[_0x2b95('0x6')]('-')[0x4];var _0x116c1d=_0x2248b5[_0x2b95('0x6')]('-')[0x0];var _0x5b9c43=crypto['createDecipher']('aes-256-ctr',util['format'](_0x2b95('0x7'),_0x3ce211,_0x2248b5,_0x116c1d));var _0x6ec316=_0x5b9c43[_0x2b95('0x8')](_0x4f69c6,_0x2b95('0x9'),_0x2b95('0xa'));_0x6ec316+=_0x5b9c43[_0x2b95('0xb')](_0x2b95('0xa'));var _0x2fec3d=JSON[_0x2b95('0xc')](_0x6ec316);return _0x2fec3d[_0x2b95('0xd')](_0x3924f1)?_0x2fec3d[_0x3924f1]:null;}}return null;}function isLimit(_0x2b9859,_0x2d279b,_0x3cab36,_0x4e0e44){var _0x13e659=_0x2d279b;return compose()['use'](function(_0xf08094,_0x542adb,_0x1be893){return db[_0x2b95('0xe')][_0x2b95('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x2b95('0x10')](function(_0x245c98){var _0x573e4b=getValueFromLicense(_0x2b9859,_0x245c98);return _0x573e4b?_0x573e4b:_0x13e659;})[_0x2b95('0x10')](function(_0x2c2ebf){_0x13e659=_0x2c2ebf;return _0x3cab36['count'](_0x4e0e44);})[_0x2b95('0x10')](function(_0x178345){if(_0x178345>=_0x13e659){return _0x542adb[_0x2b95('0x11')](0x193)[_0x2b95('0x12')]({'message':util['format'](_0x2b95('0x13'),_0x2b9859)});}_0x1be893();})['catch'](function(_0x86ef01){_0x1be893(_0x86ef01);});});}function isUserLimit(){return isLimit(_0x2b95('0x14'),0x1,db[_0x2b95('0x15')],{'where':{'$or':[{'role':_0x2b95('0x16')},{'role':_0x2b95('0x17')}]}});}exports[_0x2b95('0x18')]=isUserLimit; \ No newline at end of file +var _0x55c3=['User','admin','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','update','base64','utf8','final','parse','hasOwnProperty','use','License','then','count','status','json','catch','users'];(function(_0x29e0e7,_0x16e5e0){var _0x246ec7=function(_0x1cd0b2){while(--_0x1cd0b2){_0x29e0e7['push'](_0x29e0e7['shift']());}};_0x246ec7(++_0x16e5e0);}(_0x55c3,0x6f));var _0x355c=function(_0x4b464d,_0x1cf0bd){_0x4b464d=_0x4b464d-0x0;var _0x239837=_0x55c3[_0x4b464d];return _0x239837;};'use strict';var crypto=require(_0x355c('0x0'));var util=require(_0x355c('0x1'));var compose=require(_0x355c('0x2'));var db=require(_0x355c('0x3'))['db'];var config=require(_0x355c('0x4'));function getValueFromLicense(_0x1adcb1,_0x3e0d39){if(_0x1adcb1&&_0x3e0d39){if(_0x3e0d39['data1']&&_0x3e0d39['license']){var _0x2aa01b=_0x3e0d39[_0x355c('0x5')];var _0xe7c101=_0x3e0d39[_0x355c('0x6')];var _0x54ddec=_0x2aa01b[_0x355c('0x7')]('-')[0x4];var _0x5e6d2f=_0x2aa01b[_0x355c('0x7')]('-')[0x0];var _0x2af24b=crypto[_0x355c('0x8')](_0x355c('0x9'),util['format']('%s:%s:%s',_0x54ddec,_0x2aa01b,_0x5e6d2f));var _0x4e0365=_0x2af24b[_0x355c('0xa')](_0xe7c101,_0x355c('0xb'),_0x355c('0xc'));_0x4e0365+=_0x2af24b[_0x355c('0xd')](_0x355c('0xc'));var _0x3ab250=JSON[_0x355c('0xe')](_0x4e0365);return _0x3ab250[_0x355c('0xf')](_0x1adcb1)?_0x3ab250[_0x1adcb1]:null;}}return null;}function isLimit(_0x2b7587,_0x1fefcc,_0x112df7,_0x536972){var _0xd49bcc=_0x1fefcc;return compose()[_0x355c('0x10')](function(_0x5297c7,_0x19f666,_0x5e8243){return db[_0x355c('0x11')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x355c('0x12')](function(_0x1f5879){var _0xd7abf4=getValueFromLicense(_0x2b7587,_0x1f5879);return _0xd7abf4?_0xd7abf4:_0xd49bcc;})['then'](function(_0x3a8cab){_0xd49bcc=_0x3a8cab;return _0x112df7[_0x355c('0x13')](_0x536972);})['then'](function(_0x191cff){if(_0x191cff>=_0xd49bcc){return _0x19f666[_0x355c('0x14')](0x193)[_0x355c('0x15')]({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x2b7587)});}_0x5e8243();})[_0x355c('0x16')](function(_0x244231){_0x5e8243(_0x244231);});});}function isUserLimit(){return isLimit(_0x355c('0x17'),0x1,db[_0x355c('0x18')],{'where':{'$or':[{'role':_0x355c('0x19')},{'role':'user'}]}});}exports[_0x355c('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index c1a8d76..981824f 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 _0x5ed0=['>\x20?','<=\x20?','>=\x20?','start','pop','utcOffset','add','hours','minutes','seconds','lodash','moment','parseSearch','startsWith','[$or]','[$and]','split','length','slice','forEach','shift','match','indexOf','push','buildExpression','operator','$eq','$between','value','includes','$lte','days','format','YYYY-MM-DD','castTo','text','CAST(','\x20AS\x20','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$gt'];(function(_0x1b926c,_0x4d9682){var _0x357c10=function(_0x4e3044){while(--_0x4e3044){_0x1b926c['push'](_0x1b926c['shift']());}};_0x357c10(++_0x4d9682);}(_0x5ed0,0xe2));var _0x05ed=function(_0x2e19cc,_0xf83ff1){_0x2e19cc=_0x2e19cc-0x0;var _0x3be05a=_0x5ed0[_0x2e19cc];return _0x3be05a;};'use strict';var _=require(_0x05ed('0x0'));var moment=require(_0x05ed('0x1'));exports[_0x05ed('0x2')]=function(_0xd88d78){var _0x54d01b={'conditions':[]};_0x54d01b['sqlOperator']=_[_0x05ed('0x3')](_0xd88d78,_0x05ed('0x4'))?'or':'and';var _0x208a08=_0xd88d78['replace'](_0x05ed('0x5'),'')['replace']('[$or]','')[_0x05ed('0x6')]('||');for(var _0x12c6c4=0x0;_0x12c6c4<_0x208a08[_0x05ed('0x7')];_0x12c6c4++){var _0x254624=_0x208a08[_0x12c6c4][_0x05ed('0x6')](':=');var _0x13c03e=_0x254624[0x0];var _0x889b3=_0x254624[_0x05ed('0x8')](0x1);_0x889b3[_0x05ed('0x9')](function(_0x4299df){var _0x40d02a=_0x4299df[_0x05ed('0x6')]('[')[_0x05ed('0xa')]();var _0x37ac08=_0x4299df[_0x05ed('0xb')](/\[(.*?)\]/g);_0x37ac08['forEach'](function(_0x4bf4d8){var _0xb239c9=_0x4bf4d8[_0x05ed('0x6')]('[')['filter'](function(_0x5e25a1){return _0x5e25a1[_0x05ed('0xc')](']')>-0x1;})['map'](function(_0x579716){return _0x579716['split'](']')[0x0];})[0x0];_0x54d01b['conditions'][_0x05ed('0xd')]({'field':_0x13c03e,'operator':_0x40d02a,'value':_0xb239c9});});});}return _0x54d01b;};exports[_0x05ed('0xe')]=function(_0x527b8f,_0x219f83,_0x1c13e1){var _0x127468={};if(_0x219f83==='DATE'){if(_0x1c13e1[_0x05ed('0xf')]===_0x05ed('0x10')){_0x1c13e1[_0x05ed('0xf')]=_0x05ed('0x11');_0x1c13e1[_0x05ed('0x12')]+=','+_0x1c13e1[_0x05ed('0x12')];}else if(_[_0x05ed('0x13')](['$gt',_0x05ed('0x14')],_0x1c13e1[_0x05ed('0xf')])){_0x1c13e1[_0x05ed('0x12')]=moment(_0x1c13e1[_0x05ed('0x12')])['add'](0x1,_0x05ed('0x15'))[_0x05ed('0x16')](_0x05ed('0x17'));}}if(_0x1c13e1[_0x05ed('0x18')]){_0x219f83=_0x1c13e1[_0x05ed('0x18')];_0x127468[_0x05ed('0x19')]=_0x05ed('0x1a')+_0x527b8f+'.'+_0x1c13e1['field']+_0x05ed('0x1b')+_0x1c13e1['castTo']+')\x20'+parseOperator(_0x1c13e1['operator']);}else{_0x127468[_0x05ed('0x19')]=_0x527b8f+'.'+_0x1c13e1[_0x05ed('0x1c')]+'\x20'+parseOperator(_0x1c13e1[_0x05ed('0xf')]);}if(_[_0x05ed('0x13')]([_0x05ed('0x1d'),_0x05ed('0x1e')],_0x1c13e1[_0x05ed('0xf')]))_0x127468[_0x05ed('0x19')]='('+_0x127468['text']+_0x05ed('0x1f')+_0x527b8f+'.'+_0x1c13e1[_0x05ed('0x1c')]+_0x05ed('0x20');_0x127468[_0x05ed('0x12')]=parseValue(_0x219f83,_0x1c13e1[_0x05ed('0xf')],_0x1c13e1[_0x05ed('0x12')]);return _0x127468;};function parseOperator(_0x123dab){var _0x50743e;switch(_0x123dab){case _0x05ed('0x21'):_0x50743e='IN\x20?';break;case _0x05ed('0x1e'):_0x50743e=_0x05ed('0x22');break;case'$eq':_0x50743e=_0x05ed('0x23');break;case _0x05ed('0x1d'):_0x50743e=_0x05ed('0x24');break;case _0x05ed('0x25'):case _0x05ed('0x26'):case _0x05ed('0x27'):_0x50743e=_0x05ed('0x28');break;case _0x05ed('0x29'):_0x50743e=_0x05ed('0x2a');break;case _0x05ed('0x2b'):_0x50743e=_0x05ed('0x2c');break;case'$lte':_0x50743e=_0x05ed('0x2d');break;case'$gte':_0x50743e=_0x05ed('0x2e');break;case _0x05ed('0x11'):_0x50743e='BETWEEN\x20?\x20AND\x20?';break;}return _0x50743e;}function parseValue(_0x310512,_0x33e45c,_0x37d628){var _0x59fac7={'start':undefined,'end':undefined};switch(_0x33e45c){case _0x05ed('0x21'):case'$notIn':_0x59fac7[_0x05ed('0x2f')]=_0x37d628[_0x05ed('0x6')](',');break;case _0x05ed('0x25'):_0x59fac7[_0x05ed('0x2f')]='%'+_0x37d628+'%';break;case _0x05ed('0x26'):_0x59fac7[_0x05ed('0x2f')]=_0x37d628+'%';break;case _0x05ed('0x27'):_0x59fac7['start']='%'+_0x37d628;break;case _0x05ed('0x11'):var _0x542e80=_0x37d628['split'](',');var _0x37d628=_0x542e80['shift']();var _0x30585b=_0x542e80[_0x05ed('0x30')]();if(_0x310512==='DATE'){_0x37d628=moment(_0x37d628)[_0x05ed('0x31')](0x0,!![])[_0x05ed('0x16')]();_0x30585b=moment(_0x30585b)['utcOffset'](0x0,!![])[_0x05ed('0x32')](0x17,_0x05ed('0x33'))[_0x05ed('0x32')](0x3b,_0x05ed('0x34'))['add'](0x3b,_0x05ed('0x35'))[_0x05ed('0x16')]();}_0x59fac7={'start':_0x37d628,'end':_0x30585b};break;default:_0x59fac7[_0x05ed('0x2f')]=_0x37d628;break;}return _0x59fac7;} \ No newline at end of file +var _0xe438=['\x20IS\x20NULL)','$in','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','start','$startsWith','shift','pop','utcOffset','hours','seconds','lodash','moment','parseSearch','startsWith','[$or]','and','replace','split','forEach','match','filter','indexOf','map','push','buildExpression','DATE','operator','$eq','$between','value','includes','$lte','add','format','castTo','text','CAST(','\x20AS\x20','field','\x20OR\x20'];(function(_0x13ac78,_0x216e96){var _0x5e3ddc=function(_0x5e0d13){while(--_0x5e0d13){_0x13ac78['push'](_0x13ac78['shift']());}};_0x5e3ddc(++_0x216e96);}(_0xe438,0x1c8));var _0x8e43=function(_0x7966fd,_0x2aa18d){_0x7966fd=_0x7966fd-0x0;var _0x1301d4=_0xe438[_0x7966fd];return _0x1301d4;};'use strict';var _=require(_0x8e43('0x0'));var moment=require(_0x8e43('0x1'));exports[_0x8e43('0x2')]=function(_0x7ae095){var _0x211791={'conditions':[]};_0x211791['sqlOperator']=_[_0x8e43('0x3')](_0x7ae095,_0x8e43('0x4'))?'or':_0x8e43('0x5');var _0x2a3f14=_0x7ae095[_0x8e43('0x6')]('[$and]','')['replace'](_0x8e43('0x4'),'')[_0x8e43('0x7')]('||');for(var _0x3b1aca=0x0;_0x3b1aca<_0x2a3f14['length'];_0x3b1aca++){var _0x587134=_0x2a3f14[_0x3b1aca][_0x8e43('0x7')](':=');var _0x38b1b7=_0x587134[0x0];var _0x4a34f4=_0x587134['slice'](0x1);_0x4a34f4[_0x8e43('0x8')](function(_0x16c078){var _0x74d673=_0x16c078[_0x8e43('0x7')]('[')['shift']();var _0x352d4d=_0x16c078[_0x8e43('0x9')](/\[(.*?)\]/g);_0x352d4d[_0x8e43('0x8')](function(_0x5336c1){var _0x569586=_0x5336c1[_0x8e43('0x7')]('[')[_0x8e43('0xa')](function(_0x2bf50f){return _0x2bf50f[_0x8e43('0xb')](']')>-0x1;})[_0x8e43('0xc')](function(_0x23c0b6){return _0x23c0b6[_0x8e43('0x7')](']')[0x0];})[0x0];_0x211791['conditions'][_0x8e43('0xd')]({'field':_0x38b1b7,'operator':_0x74d673,'value':_0x569586});});});}return _0x211791;};exports[_0x8e43('0xe')]=function(_0x5dfade,_0x5a060b,_0x255eac){var _0xc3efae={};if(_0x5a060b===_0x8e43('0xf')){if(_0x255eac[_0x8e43('0x10')]===_0x8e43('0x11')){_0x255eac['operator']=_0x8e43('0x12');_0x255eac[_0x8e43('0x13')]+=','+_0x255eac[_0x8e43('0x13')];}else if(_[_0x8e43('0x14')](['$gt',_0x8e43('0x15')],_0x255eac[_0x8e43('0x10')])){_0x255eac['value']=moment(_0x255eac[_0x8e43('0x13')])[_0x8e43('0x16')](0x1,'days')[_0x8e43('0x17')]('YYYY-MM-DD');}}if(_0x255eac[_0x8e43('0x18')]){_0x5a060b=_0x255eac['castTo'];_0xc3efae[_0x8e43('0x19')]=_0x8e43('0x1a')+_0x5dfade+'.'+_0x255eac['field']+_0x8e43('0x1b')+_0x255eac[_0x8e43('0x18')]+')\x20'+parseOperator(_0x255eac['operator']);}else{_0xc3efae[_0x8e43('0x19')]=_0x5dfade+'.'+_0x255eac[_0x8e43('0x1c')]+'\x20'+parseOperator(_0x255eac[_0x8e43('0x10')]);}if(_['includes'](['$ne','$notIn'],_0x255eac['operator']))_0xc3efae['text']='('+_0xc3efae[_0x8e43('0x19')]+_0x8e43('0x1d')+_0x5dfade+'.'+_0x255eac['field']+_0x8e43('0x1e');_0xc3efae['value']=parseValue(_0x5a060b,_0x255eac[_0x8e43('0x10')],_0x255eac[_0x8e43('0x13')]);return _0xc3efae;};function parseOperator(_0x183f27){var _0x23be77;switch(_0x183f27){case _0x8e43('0x1f'):_0x23be77=_0x8e43('0x20');break;case _0x8e43('0x21'):_0x23be77=_0x8e43('0x22');break;case'$eq':_0x23be77=_0x8e43('0x23');break;case _0x8e43('0x24'):_0x23be77=_0x8e43('0x25');break;case _0x8e43('0x26'):case'$startsWith':case _0x8e43('0x27'):_0x23be77=_0x8e43('0x28');break;case _0x8e43('0x29'):_0x23be77=_0x8e43('0x2a');break;case'$gt':_0x23be77=_0x8e43('0x2b');break;case _0x8e43('0x15'):_0x23be77=_0x8e43('0x2c');break;case _0x8e43('0x2d'):_0x23be77=_0x8e43('0x2e');break;case _0x8e43('0x12'):_0x23be77='BETWEEN\x20?\x20AND\x20?';break;}return _0x23be77;}function parseValue(_0x4ca96f,_0x40c679,_0x9dc243){var _0x3af33f={'start':undefined,'end':undefined};switch(_0x40c679){case _0x8e43('0x1f'):case'$notIn':_0x3af33f[_0x8e43('0x2f')]=_0x9dc243[_0x8e43('0x7')](',');break;case _0x8e43('0x26'):_0x3af33f[_0x8e43('0x2f')]='%'+_0x9dc243+'%';break;case _0x8e43('0x30'):_0x3af33f[_0x8e43('0x2f')]=_0x9dc243+'%';break;case'$endsWith':_0x3af33f[_0x8e43('0x2f')]='%'+_0x9dc243;break;case'$between':var _0x2ecd4d=_0x9dc243['split'](',');var _0x9dc243=_0x2ecd4d[_0x8e43('0x31')]();var _0x1e96ea=_0x2ecd4d[_0x8e43('0x32')]();if(_0x4ca96f==='DATE'){_0x9dc243=moment(_0x9dc243)[_0x8e43('0x33')](0x0,!![])[_0x8e43('0x17')]();_0x1e96ea=moment(_0x1e96ea)['utcOffset'](0x0,!![])['add'](0x17,_0x8e43('0x34'))[_0x8e43('0x16')](0x3b,'minutes')[_0x8e43('0x16')](0x3b,_0x8e43('0x35'))[_0x8e43('0x17')]();}_0x3af33f={'start':_0x9dc243,'end':_0x1e96ea};break;default:_0x3af33f[_0x8e43('0x2f')]=_0x9dc243;break;}return _0x3af33f;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 6a83e98..927bfb0 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 _0xcacd=['isEmpty','forOwn','find','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','uniqueid','isArray','limit','offset','sort','map','priority','cast','col','unsigned','DESC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','{EXPR}','forEach','replace','join','getOptions','query','$id','name','intersection','attributes','fields','nolimit','order','filter','object','columns','value','where','merge','type','VIRTUAL','lower','include','push','lodash','parse','includes','keys','model','alias','split','filters'];(function(_0xc163d3,_0x14778a){var _0x3832d3=function(_0xf6f81c){while(--_0xf6f81c){_0xc163d3['push'](_0xc163d3['shift']());}};_0x3832d3(++_0x14778a);}(_0xcacd,0x1bf));var _0xdcac=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xcacd[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xdcac('0x0'));var sequelize=require('sequelize');var moment=require('moment');var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x164f6a){var _0x23084d=['ne'];try{var _0x477049=JSON[_0xdcac('0x1')](_0x164f6a);var _0x3b2cc2=Object['keys'](_0x477049)[0x0];return _0x23084d[_0xdcac('0x2')](_0x3b2cc2);}catch(_0x110ad4){return![];}}function getOperatorValue(_0x208907){var _0x58af9f=JSON[_0xdcac('0x1')](_0x208907);var _0x2491e7=Object[_0xdcac('0x3')](_0x58af9f)[0x0];var _0x598f7e=_0x58af9f[_0x2491e7];return{['$'+_0x2491e7]:_0x598f7e};}function parseIncludeModel(_0x2f59c2){var _0x5574ae=JSON['parse'](_0x2f59c2);return{'model':db[_0x5574ae[_0xdcac('0x4')]],'as':_0x5574ae[_0xdcac('0x5')],'attributes':_0x5574ae['fields'],'raw':_0x5574ae['raw']};}exports['fields']=function(_0x5ac199){var _0x34e756=null;if(_0x5ac199){_0x34e756=_0x5ac199[_0xdcac('0x6')](',');}return _0x34e756;};exports[_0xdcac('0x7')]=function(_0x2f5710,_0x1e85cc){var _0xa22432={};if(!_[_0xdcac('0x8')](_0x2f5710)){_[_0xdcac('0x9')](_0x2f5710,function(_0x59fe4c,_0x21c8e0){try{if(_0x1e85cc){var _0x28d55f=_[_0xdcac('0xa')](_0x1e85cc,{'name':_0x21c8e0})||{};if(hasSequelizeOperator(_0x59fe4c)){_0xa22432[_0x21c8e0]=getOperatorValue(_0x59fe4c);}else if(_0x28d55f['type']===_0xdcac('0xb')&&_[_0xdcac('0xc')](_0x59fe4c)){var _0x452c9d=JSON[_0xdcac('0x1')](_0x59fe4c);var _0x17f077={'$gte':moment(moment(_0x452c9d[_0xdcac('0xd')])[_0xdcac('0xe')](_0xdcac('0xf')))[_0xdcac('0x10')]()[_0xdcac('0xe')](),'$lte':moment(moment(_0x452c9d[_0xdcac('0x11')])['format'](_0xdcac('0xf')))[_0xdcac('0x10')]()[_0xdcac('0x12')](0x1,'s')[_0xdcac('0xe')]()};_0xa22432[_0x21c8e0]=_0x17f077;}else if(_0x28d55f['name']===_0xdcac('0x13')){_0xa22432[_0x21c8e0]=_0x59fe4c;}else{_0xa22432[_0x21c8e0]=_[_0xdcac('0x14')](_0x59fe4c)?_0x59fe4c:JSON[_0xdcac('0x1')](_0x59fe4c);}}else{_0xa22432[_0x21c8e0]=_['isArray'](_0x59fe4c)?_0x59fe4c:JSON[_0xdcac('0x1')](_0x59fe4c);}}catch(_0x2e16a2){_0xa22432[_0x21c8e0]=_0x59fe4c[_0xdcac('0x6')](',');}});}return _0xa22432;};exports[_0xdcac('0x15')]=function(_0x1280b6){_0x1280b6=parseInt(_0x1280b6,0xa);if(!_0x1280b6||_0x1280b6<0x0){_0x1280b6=LIMIT_VALUE;}return _0x1280b6;};exports[_0xdcac('0x16')]=function(_0x1d05db){_0x1d05db=parseInt(_0x1d05db,0xa);if(!_0x1d05db||_0x1d05db<0x0){_0x1d05db=0x0;}return _0x1d05db;};exports[_0xdcac('0x17')]=function(_0x281551){var _0x63900c,_0x27fc80=null;if(_0x281551){_0x63900c=_0x281551[_0xdcac('0x6')](',');_0x27fc80=_[_0xdcac('0x18')](_0x63900c,function(_0x3c327f){if(_0x3c327f['indexOf']('-')===0x0){return[_0x3c327f===_0xdcac('0x19')?sequelize[_0xdcac('0x1a')](sequelize[_0xdcac('0x1b')](_0xdcac('0x19')),_0xdcac('0x1c')):_0x3c327f['substr'](0x1),_0xdcac('0x1d')];}else{return[_0x3c327f===_0xdcac('0x19')?sequelize[_0xdcac('0x1a')](sequelize['col'](_0xdcac('0x19')),'unsigned'):_0x3c327f,'ASC'];}});}return _0x27fc80;};exports[_0xdcac('0x1e')]=function(_0x2b320f,_0x195ca6){if(_[_0xdcac('0x8')](_0x2b320f)){return _0x2b320f;}if(_[_0xdcac('0x14')](_0x2b320f)){for(var _0xc89afd=0x0;_0xc89afd<_0x2b320f[_0xdcac('0x1f')];_0xc89afd+=0x1){_0x2b320f[_0xc89afd]=this[_0xdcac('0x1e')](_0x2b320f[_0xc89afd],_0x195ca6);}return _0x2b320f;}if(!_[_0xdcac('0x20')](_0x2b320f)){return _0x2b320f;}if(_[_0xdcac('0x21')](_0x195ca6)){_0x195ca6=[_0x195ca6];}if(!_[_0xdcac('0x14')](_0x195ca6)){return _0x2b320f;}for(var _0x54c757=0x0;_0x54c757<_0x195ca6[_0xdcac('0x1f')];_0x54c757+=0x1){_[_0xdcac('0x22')](_0x2b320f,_0x195ca6[_0x54c757]);}for(var _0xa47341 in _0x2b320f){if(_0x2b320f[_0xdcac('0x23')](_0xa47341)){_0x2b320f[_0xa47341]=this[_0xdcac('0x1e')](_0x2b320f[_0xa47341],_0x195ca6);}}return _0x2b320f;};exports[_0xdcac('0x24')]=function(_0x26ccca){return _0x26ccca[_0xdcac('0x25')](RegExp(_0xdcac('0x26')))?!![]:![];};exports[_0xdcac('0x27')]=function(_0x3d5d54){return _0x3d5d54[_0xdcac('0x25')](/^\S+@\S+$/)?!![]:![];};exports[_0xdcac('0x28')]=function(_0x146a70,_0x2ed086){var _0x1b3892=[];var _0x4e7062=/[ `!@#$%^&*()_\-?~]/;var _0x1327f0=_0x2ed086?'\x22{EXPR}\x22':_0xdcac('0x29');_0x146a70[_0xdcac('0x6')](/[ ,]+/)[_0xdcac('0x2a')](function(_0x595af8){_0x595af8=_0x595af8[_0xdcac('0x2b')](/([^:]")"+/g,'$1');_0x595af8='+'+_0x595af8+'*';var _0x5278bc=_0x595af8[_0xdcac('0x25')](_0x4e7062);if(_0x5278bc){_0x595af8='\x22'+_0x595af8+'\x22';}_0x1b3892['push'](_0x595af8);});_0x1327f0=_0x1327f0[_0xdcac('0x2b')]('{EXPR}',_0x1b3892[_0xdcac('0x2c')]('\x20'));return _0x1327f0;};exports[_0xdcac('0x2d')]=function(_0x49aa8e,_0x552715,_0x2fdafd){var _0xb2d041={},_0x10dd2c={};if(_0x552715[_0xdcac('0x2e')][_0xdcac('0x2f')]){_0x552715['query']['id']=_0x552715[_0xdcac('0x2e')][_0xdcac('0x2f')];delete _0x552715['query']['$id'];}_0xb2d041[_0xdcac('0x4')]=_[_0xdcac('0x18')](_0x49aa8e,_0xdcac('0x30'));_0xb2d041[_0xdcac('0x2e')]=_[_0xdcac('0x3')](_0x552715[_0xdcac('0x2e')]);_0xb2d041[_0xdcac('0x7')]=_[_0xdcac('0x31')](_0xb2d041[_0xdcac('0x4')],_0xb2d041[_0xdcac('0x2e')]);_0x10dd2c[_0xdcac('0x32')]=_[_0xdcac('0x31')](_0xb2d041[_0xdcac('0x4')],this[_0xdcac('0x33')](_0x552715[_0xdcac('0x2e')][_0xdcac('0x33')]));_0x10dd2c['attributes']=_0x10dd2c[_0xdcac('0x32')][_0xdcac('0x1f')]?_0x10dd2c['attributes']:_0xb2d041['model'];if(!_0x552715[_0xdcac('0x2e')][_0xdcac('0x23')](_0xdcac('0x34'))){_0x10dd2c[_0xdcac('0x15')]=this[_0xdcac('0x15')](_0x552715[_0xdcac('0x2e')][_0xdcac('0x15')]);_0x10dd2c[_0xdcac('0x16')]=this[_0xdcac('0x16')](_0x552715[_0xdcac('0x2e')][_0xdcac('0x16')]);}_0x10dd2c[_0xdcac('0x35')]=this[_0xdcac('0x17')](_0x552715[_0xdcac('0x2e')][_0xdcac('0x17')]);_0x10dd2c['where']=this['filters'](_['pick'](_0x552715[_0xdcac('0x2e')],_0xb2d041[_0xdcac('0x7')]),_0x49aa8e);if(_0x552715[_0xdcac('0x2e')]['filter']){var _0x3b4ec4=_0x49aa8e;var _0x1d01f2=_0x552715[_0xdcac('0x2e')][_0xdcac('0x36')];if(typeof _0x1d01f2===_0xdcac('0x37')){_0x3b4ec4=_[_0xdcac('0x36')](_0x49aa8e,function(_0x2a15ff){return _[_0xdcac('0x2')](_0x1d01f2[_0xdcac('0x38')],_0x2a15ff[_0xdcac('0x30')]);});_0x1d01f2=_0x1d01f2[_0xdcac('0x39')];}_0x10dd2c[_0xdcac('0x3a')]=_[_0xdcac('0x3b')](_0x10dd2c['where'],{'$or':_[_0xdcac('0x18')](_0x3b4ec4,function(_0x5c5a26){if(_0x5c5a26[_0xdcac('0x3c')]!==_0xdcac('0x3d')){if(_0x2fdafd){return sequelize[_0xdcac('0x3a')](sequelize['fn'](_0xdcac('0x3e'),sequelize[_0xdcac('0x1b')](_0x5c5a26['name'])),{'$like':sequelize['fn'](_0xdcac('0x3e'),'%'+_0x552715[_0xdcac('0x2e')][_0xdcac('0x36')]+'%')});}else{var _0x354447={};_0x354447[_0x5c5a26[_0xdcac('0x30')]]={'$like':'%'+_0x552715[_0xdcac('0x2e')][_0xdcac('0x36')]+'%'};return _0x354447;}}})});}_0x10dd2c=_[_0xdcac('0x3b')]({},_0x10dd2c,_0x552715['options']);return _0x10dd2c;};exports[_0xdcac('0x3f')]=function(_0x3dffd2){var _0x19b8f8=[];if(_0x3dffd2['includeAll']){_0x19b8f8['push']({'all':!![]});}else if(_0x3dffd2['include']){if(Array[_0xdcac('0x14')](_0x3dffd2[_0xdcac('0x3f')])){_0x19b8f8=Object[_0xdcac('0x3')](_0x3dffd2[_0xdcac('0x3f')])[_0xdcac('0x18')](function(_0xee9550){return parseIncludeModel(_0x3dffd2[_0xdcac('0x3f')][_0xee9550]);});}else{var _0x119d6a=parseIncludeModel(_0x3dffd2['include']);_0x19b8f8[_0xdcac('0x40')](_0x119d6a);}}return _0x19b8f8;}; \ No newline at end of file +var _0x3a5e=['alias','raw','fields','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','YYYY-MM-DD','utc','$lte','format','subtract','name','uniqueid','split','limit','map','indexOf','priority','cast','col','unsigned','substr','ASC','omit','length','isObject','isString','isArray','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','{EXPR}','forEach','replace','push','getOptions','query','$id','intersection','attributes','nolimit','offset','sort','where','filter','columns','value','merge','VIRTUAL','lower','include','includeAll','lodash','sequelize','moment','../../mysqldb','parse','keys','includes','model'];(function(_0x436ca1,_0x565ee2){var _0x316601=function(_0x315cf2){while(--_0x315cf2){_0x436ca1['push'](_0x436ca1['shift']());}};_0x316601(++_0x565ee2);}(_0x3a5e,0x14c));var _0xe3a5=function(_0x2d6516,_0x5bcaab){_0x2d6516=_0x2d6516-0x0;var _0x36f0a9=_0x3a5e[_0x2d6516];return _0x36f0a9;};'use strict';var _=require(_0xe3a5('0x0'));var sequelize=require(_0xe3a5('0x1'));var moment=require(_0xe3a5('0x2'));var db=require(_0xe3a5('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x378b86){var _0x36ef75=['ne'];try{var _0x509cb0=JSON[_0xe3a5('0x4')](_0x378b86);var _0x189d9c=Object[_0xe3a5('0x5')](_0x509cb0)[0x0];return _0x36ef75[_0xe3a5('0x6')](_0x189d9c);}catch(_0x348e88){return![];}}function getOperatorValue(_0x499f61){var _0x5e1507=JSON[_0xe3a5('0x4')](_0x499f61);var _0x4ff682=Object[_0xe3a5('0x5')](_0x5e1507)[0x0];var _0x32fab4=_0x5e1507[_0x4ff682];return{['$'+_0x4ff682]:_0x32fab4};}function parseIncludeModel(_0x2d133b){var _0x437915=JSON[_0xe3a5('0x4')](_0x2d133b);return{'model':db[_0x437915[_0xe3a5('0x7')]],'as':_0x437915[_0xe3a5('0x8')],'attributes':_0x437915['fields'],'raw':_0x437915[_0xe3a5('0x9')]};}exports[_0xe3a5('0xa')]=function(_0x2782c2){var _0x1741d8=null;if(_0x2782c2){_0x1741d8=_0x2782c2['split'](',');}return _0x1741d8;};exports[_0xe3a5('0xb')]=function(_0x1bf6dc,_0x276d7a){var _0xed6d6a={};if(!_[_0xe3a5('0xc')](_0x1bf6dc)){_[_0xe3a5('0xd')](_0x1bf6dc,function(_0x5181c5,_0x3a9a3a){try{if(_0x276d7a){var _0x45d98a=_[_0xe3a5('0xe')](_0x276d7a,{'name':_0x3a9a3a})||{};if(hasSequelizeOperator(_0x5181c5)){_0xed6d6a[_0x3a9a3a]=getOperatorValue(_0x5181c5);}else if(_0x45d98a[_0xe3a5('0xf')]===_0xe3a5('0x10')&&_[_0xe3a5('0x11')](_0x5181c5)){var _0x20c650=JSON[_0xe3a5('0x4')](_0x5181c5);var _0x28645a={'$gte':moment(moment(_0x20c650['$gte'])['format'](_0xe3a5('0x12')))[_0xe3a5('0x13')]()['format'](),'$lte':moment(moment(_0x20c650[_0xe3a5('0x14')])[_0xe3a5('0x15')](_0xe3a5('0x12')))[_0xe3a5('0x13')]()[_0xe3a5('0x16')](0x1,'s')[_0xe3a5('0x15')]()};_0xed6d6a[_0x3a9a3a]=_0x28645a;}else if(_0x45d98a[_0xe3a5('0x17')]===_0xe3a5('0x18')){_0xed6d6a[_0x3a9a3a]=_0x5181c5;}else{_0xed6d6a[_0x3a9a3a]=_['isArray'](_0x5181c5)?_0x5181c5:JSON['parse'](_0x5181c5);}}else{_0xed6d6a[_0x3a9a3a]=_['isArray'](_0x5181c5)?_0x5181c5:JSON[_0xe3a5('0x4')](_0x5181c5);}}catch(_0x2eedc8){_0xed6d6a[_0x3a9a3a]=_0x5181c5[_0xe3a5('0x19')](',');}});}return _0xed6d6a;};exports[_0xe3a5('0x1a')]=function(_0x2a07e6){_0x2a07e6=parseInt(_0x2a07e6,0xa);if(!_0x2a07e6||_0x2a07e6<0x0){_0x2a07e6=LIMIT_VALUE;}return _0x2a07e6;};exports['offset']=function(_0x5c1be4){_0x5c1be4=parseInt(_0x5c1be4,0xa);if(!_0x5c1be4||_0x5c1be4<0x0){_0x5c1be4=0x0;}return _0x5c1be4;};exports['sort']=function(_0x453e95){var _0xd5f03b,_0x2920e7=null;if(_0x453e95){_0xd5f03b=_0x453e95[_0xe3a5('0x19')](',');_0x2920e7=_[_0xe3a5('0x1b')](_0xd5f03b,function(_0x3f2092){if(_0x3f2092[_0xe3a5('0x1c')]('-')===0x0){return[_0x3f2092===_0xe3a5('0x1d')?sequelize[_0xe3a5('0x1e')](sequelize[_0xe3a5('0x1f')](_0xe3a5('0x1d')),_0xe3a5('0x20')):_0x3f2092[_0xe3a5('0x21')](0x1),'DESC'];}else{return[_0x3f2092===_0xe3a5('0x1d')?sequelize[_0xe3a5('0x1e')](sequelize[_0xe3a5('0x1f')](_0xe3a5('0x1d')),'unsigned'):_0x3f2092,_0xe3a5('0x22')];}});}return _0x2920e7;};exports[_0xe3a5('0x23')]=function(_0x279e81,_0x4d709d){if(_[_0xe3a5('0xc')](_0x279e81)){return _0x279e81;}if(_['isArray'](_0x279e81)){for(var _0x952936=0x0;_0x952936<_0x279e81[_0xe3a5('0x24')];_0x952936+=0x1){_0x279e81[_0x952936]=this['omit'](_0x279e81[_0x952936],_0x4d709d);}return _0x279e81;}if(!_[_0xe3a5('0x25')](_0x279e81)){return _0x279e81;}if(_[_0xe3a5('0x26')](_0x4d709d)){_0x4d709d=[_0x4d709d];}if(!_[_0xe3a5('0x27')](_0x4d709d)){return _0x279e81;}for(var _0x1c1f79=0x0;_0x1c1f79<_0x4d709d[_0xe3a5('0x24')];_0x1c1f79+=0x1){_[_0xe3a5('0x28')](_0x279e81,_0x4d709d[_0x1c1f79]);}for(var _0x284660 in _0x279e81){if(_0x279e81[_0xe3a5('0x29')](_0x284660)){_0x279e81[_0x284660]=this[_0xe3a5('0x23')](_0x279e81[_0x284660],_0x4d709d);}}return _0x279e81;};exports[_0xe3a5('0x2a')]=function(_0x116bd5){return _0x116bd5[_0xe3a5('0x2b')](RegExp(_0xe3a5('0x2c')))?!![]:![];};exports[_0xe3a5('0x2d')]=function(_0x2361af){return _0x2361af[_0xe3a5('0x2b')](/^\S+@\S+$/)?!![]:![];};exports[_0xe3a5('0x2e')]=function(_0x467da3,_0x4b3b3c){var _0x4f04be=[];var _0x55a664=/[ `!@#$%^&*()_\-?~]/;var _0x7f73c6=_0x4b3b3c?'\x22{EXPR}\x22':_0xe3a5('0x2f');_0x467da3[_0xe3a5('0x19')](/[ ,]+/)[_0xe3a5('0x30')](function(_0x1b66a5){_0x1b66a5=_0x1b66a5[_0xe3a5('0x31')](/([^:]")"+/g,'$1');_0x1b66a5='+'+_0x1b66a5+'*';var _0xf7d11e=_0x1b66a5[_0xe3a5('0x2b')](_0x55a664);if(_0xf7d11e){_0x1b66a5='\x22'+_0x1b66a5+'\x22';}_0x4f04be[_0xe3a5('0x32')](_0x1b66a5);});_0x7f73c6=_0x7f73c6[_0xe3a5('0x31')](_0xe3a5('0x2f'),_0x4f04be['join']('\x20'));return _0x7f73c6;};exports[_0xe3a5('0x33')]=function(_0x35ca60,_0x395e03,_0x14a437){var _0x1725ca={},_0x54ed63={};if(_0x395e03[_0xe3a5('0x34')][_0xe3a5('0x35')]){_0x395e03['query']['id']=_0x395e03[_0xe3a5('0x34')][_0xe3a5('0x35')];delete _0x395e03[_0xe3a5('0x34')][_0xe3a5('0x35')];}_0x1725ca['model']=_[_0xe3a5('0x1b')](_0x35ca60,_0xe3a5('0x17'));_0x1725ca[_0xe3a5('0x34')]=_[_0xe3a5('0x5')](_0x395e03[_0xe3a5('0x34')]);_0x1725ca[_0xe3a5('0xb')]=_[_0xe3a5('0x36')](_0x1725ca[_0xe3a5('0x7')],_0x1725ca['query']);_0x54ed63['attributes']=_[_0xe3a5('0x36')](_0x1725ca[_0xe3a5('0x7')],this[_0xe3a5('0xa')](_0x395e03[_0xe3a5('0x34')][_0xe3a5('0xa')]));_0x54ed63['attributes']=_0x54ed63[_0xe3a5('0x37')][_0xe3a5('0x24')]?_0x54ed63[_0xe3a5('0x37')]:_0x1725ca[_0xe3a5('0x7')];if(!_0x395e03[_0xe3a5('0x34')][_0xe3a5('0x29')](_0xe3a5('0x38'))){_0x54ed63[_0xe3a5('0x1a')]=this[_0xe3a5('0x1a')](_0x395e03[_0xe3a5('0x34')][_0xe3a5('0x1a')]);_0x54ed63[_0xe3a5('0x39')]=this[_0xe3a5('0x39')](_0x395e03[_0xe3a5('0x34')]['offset']);}_0x54ed63['order']=this[_0xe3a5('0x3a')](_0x395e03[_0xe3a5('0x34')][_0xe3a5('0x3a')]);_0x54ed63[_0xe3a5('0x3b')]=this[_0xe3a5('0xb')](_['pick'](_0x395e03[_0xe3a5('0x34')],_0x1725ca[_0xe3a5('0xb')]),_0x35ca60);if(_0x395e03[_0xe3a5('0x34')][_0xe3a5('0x3c')]){var _0x45d746=_0x35ca60;var _0x37c0e2=_0x395e03[_0xe3a5('0x34')][_0xe3a5('0x3c')];if(typeof _0x37c0e2==='object'){_0x45d746=_[_0xe3a5('0x3c')](_0x35ca60,function(_0x483b07){return _['includes'](_0x37c0e2[_0xe3a5('0x3d')],_0x483b07[_0xe3a5('0x17')]);});_0x37c0e2=_0x37c0e2[_0xe3a5('0x3e')];}_0x54ed63['where']=_[_0xe3a5('0x3f')](_0x54ed63[_0xe3a5('0x3b')],{'$or':_[_0xe3a5('0x1b')](_0x45d746,function(_0x57c848){if(_0x57c848[_0xe3a5('0xf')]!==_0xe3a5('0x40')){if(_0x14a437){return sequelize[_0xe3a5('0x3b')](sequelize['fn'](_0xe3a5('0x41'),sequelize['col'](_0x57c848[_0xe3a5('0x17')])),{'$like':sequelize['fn'](_0xe3a5('0x41'),'%'+_0x395e03[_0xe3a5('0x34')][_0xe3a5('0x3c')]+'%')});}else{var _0x2c4d48={};_0x2c4d48[_0x57c848['name']]={'$like':'%'+_0x395e03['query'][_0xe3a5('0x3c')]+'%'};return _0x2c4d48;}}})});}_0x54ed63=_[_0xe3a5('0x3f')]({},_0x54ed63,_0x395e03['options']);return _0x54ed63;};exports[_0xe3a5('0x42')]=function(_0x5c8ab0){var _0x5e49d8=[];if(_0x5c8ab0[_0xe3a5('0x43')]){_0x5e49d8[_0xe3a5('0x32')]({'all':!![]});}else if(_0x5c8ab0[_0xe3a5('0x42')]){if(Array[_0xe3a5('0x27')](_0x5c8ab0[_0xe3a5('0x42')])){_0x5e49d8=Object[_0xe3a5('0x5')](_0x5c8ab0[_0xe3a5('0x42')])[_0xe3a5('0x1b')](function(_0x425fa6){return parseIncludeModel(_0x5c8ab0['include'][_0x425fa6]);});}else{var _0x54d5b8=parseIncludeModel(_0x5c8ab0[_0xe3a5('0x42')]);_0x5e49d8[_0xe3a5('0x32')](_0x54d5b8);}}return _0x5e49d8;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 953b361..58ed267 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 _0x46ed=['map','findOne','getAgents','all','flatten','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','findAll','name','pauseType','find','globalStatus','split','order','startsWith','DESC','ASC','fullname,internal','fullname','validateSortParameter','toLowerCase','sortAgentsByStatus','userpic','online','lastPauseAt','internal','address','chatCapacity','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','omit','pick','role','lastLoginAt','faxStatus','mailCurrentCapacity','smsCurrentCapacity','onhold','queue','routealias','lodash','jayson/promise','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','unknown','unavailable','ringing','isNil','voiceStatus','chatStatus','openchannelStatus','smsStatus','whatsappStatus','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','pause','*pause','idle','busy','isArray','startCase','Queue'];(function(_0x2a490f,_0x3cb94b){var _0x4683ff=function(_0x8fe63a){while(--_0x8fe63a){_0x2a490f['push'](_0x2a490f['shift']());}};_0x4683ff(++_0x3cb94b);}(_0x46ed,0x168));var _0xd46e=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x46ed[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xd46e('0x0'));var jayson=require(_0xd46e('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xd46e('0x2')][_0xd46e('0x3')]({'port':0x232a});var routingClient=jayson[_0xd46e('0x2')]['http']({'port':0x232c});function isAgentPaused(_0x2e6b84,_0x4518b8){var _0x54ef98=[_0x2e6b84[_0xd46e('0x4')],_0x2e6b84[_0xd46e('0x5')],_0x2e6b84[_0xd46e('0x6')],_0x2e6b84[_0xd46e('0x7')],_0x2e6b84[_0xd46e('0x8')],_0x2e6b84[_0xd46e('0x9')],_0x2e6b84[_0xd46e('0xa')]];if(!_0x4518b8)return _[_0xd46e('0xb')](_0x54ef98);var _0x31259b=_[_0xd46e('0xc')](_0x54ef98);return _0x31259b[_0xd46e('0xd')]>0x0&&_0x31259b['length']<_0x54ef98[_0xd46e('0xd')]?!![]:![];}function isIdle(_0x81235b){return _0x81235b==='idle'||_0x81235b===_0xd46e('0xe')||_0x81235b===_0xd46e('0xf')||_0x81235b===_0xd46e('0x10')||_[_0xd46e('0x11')](_0x81235b);}function isAgentIdle(_0x1ad723){if(_0x1ad723[_0xd46e('0x12')]!=='idle'&&_0x1ad723[_0xd46e('0x9')]){_0x1ad723['voiceStatus']='pause';return![];}return _[_0xd46e('0xb')]([_0x1ad723[_0xd46e('0x13')],_0x1ad723['faxStatus'],_0x1ad723['mailStatus'],_0x1ad723[_0xd46e('0x14')],_0x1ad723[_0xd46e('0x15')],_0x1ad723[_0xd46e('0x12')],_0x1ad723[_0xd46e('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0xd46e('0x17'),{})[_0xd46e('0x18')](function(_0x417402){if(_0x417402[_0xd46e('0x19')]){throw new Error(_0xd46e('0x1a'));}var _0x47fa8f=_0x417402[_0xd46e('0x1b')];return routingClient[_0xd46e('0x1c')](_0xd46e('0x17'),{})['then'](function(_0x5ddd04){if(_0x5ddd04[_0xd46e('0x19')]){throw new Error(_0xd46e('0x1d'));}var _0x488690=_0x5ddd04['result'];return _[_0xd46e('0x1e')]({},_0x47fa8f,_0x488690);});})[_0xd46e('0x1f')](function(_0x362885){throw _0x362885;});}exports[_0xd46e('0x20')]=getRealtimeAgents;function getAgentStatus(_0x409010){var _0x312d6f=_0xd46e('0xe');if(isAgentPaused(_0x409010))_0x312d6f=_0xd46e('0x21');else if(isAgentPaused(_0x409010,!![]))_0x312d6f=_0xd46e('0x22');else if(isAgentIdle(_0x409010))_0x312d6f=_0xd46e('0x23');else _0x312d6f=_0xd46e('0x24');return _0x312d6f;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x259072,_0x1c83fa){var _0x79aa51=_[_0xd46e('0x25')](_0x259072)?_0x259072:[_0x259072];var _0x128246=_[_0xd46e('0x26')](_0x1c83fa)+_0xd46e('0x27');var _0x8a1be=_[_0xd46e('0x28')](_0x79aa51,function(_0x4cf899){return db[_0x128246][_0xd46e('0x29')]({'where':{'id':_0x4cf899}})['then'](function(_0x4b8f6a){if(!_0x4b8f6a)return[];return _0x4b8f6a[_0xd46e('0x2a')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xd46e('0x2b')](_0x8a1be)[_0xd46e('0x18')](function(_0x42afc7){var _0x247b9f=_(_0x42afc7)[_0xd46e('0x2c')]()[_0xd46e('0x28')]('id')['uniq']()[_0xd46e('0x2d')]();return _0x247b9f;});}exports[_0xd46e('0x2e')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0xddbce9,_0x17db79,_0x96f15c){try{if(_0x17db79[_0xd46e('0xd')]>0x0){_0xddbce9=_0xddbce9['filter'](function(_0x465d54){return _0x17db79[_0xd46e('0x2f')](_0x465d54['id']);});}var _0x2d1afe=_0xddbce9[_0xd46e('0xc')](function(_0x106edc){var _0x423ea3=_0xd46e('0x24');if(isAgentIdle(_0x106edc)){_0x423ea3=_0xd46e('0x23');}return _0x423ea3===_0x96f15c;});return _[_0xd46e('0x28')](_0x2d1afe,'id');}catch(_0x45ea47){throw _0x45ea47;}}exports[_0xd46e('0x30')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x504324,_0x2f4a1b,_0x5ed8dc){return Promise[_0xd46e('0x31')]()[_0xd46e('0x18')](function(){if(_0x2f4a1b[_0xd46e('0xd')]>0x0){_0x504324=_0x504324[_0xd46e('0xc')](function(_0x5ef248){return _0x2f4a1b[_0xd46e('0x2f')](_0x5ef248['id']);});}return _0x504324;})[_0xd46e('0x18')](function(){return db['User'][_0xd46e('0x32')]({'attributes':['id',_0xd46e('0x33'),'fullname',_0xd46e('0x4'),_0xd46e('0x5'),_0xd46e('0x6'),'openchannelPause','smsPause',_0xd46e('0x9'),_0xd46e('0xa'),_0xd46e('0x34')],'where':{'id':{'$in':_[_0xd46e('0x28')](_0x504324,'id')}},'raw':!![]});})[_0xd46e('0x18')](function(_0x423de9){return _0x423de9[_0xd46e('0x28')](function(_0xf8b746){var _0x527a2f=_[_0xd46e('0x35')](_0x504324,['id',_0xf8b746['id']]);var _0x1a1181=filterAgentAttributes(_0x527a2f);_[_0xd46e('0x1e')](_0xf8b746,_0x1a1181);_0xf8b746[_0xd46e('0x36')]=getAgentStatus(_0xf8b746);return _0xf8b746;});})[_0xd46e('0x18')](function(_0x1e0897){var _0x42ddde=sortAgentsByStatus(_0x1e0897,_0x5ed8dc);return _['map'](_0x42ddde,'id');})[_0xd46e('0x1f')](function(_0x357212){throw _0x357212;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x14447e){var _0x96b0f9={'fields':[],'order':null};var _0x12ccf8=_0x14447e[_0xd46e('0x37')](',');_0x96b0f9['fields']=_[_0xd46e('0xc')](_0x12ccf8,function(_0x3ecf34){if(!_0x3ecf34[_0xd46e('0x2f')](_0xd46e('0x36'))){return!![];}_0x96b0f9[_0xd46e('0x38')]=_[_0xd46e('0x39')](_0x3ecf34,'-')?_0xd46e('0x3a'):_0xd46e('0x3b');return![];});return _0x96b0f9;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x232e6f){if(!_0x232e6f){_0x232e6f=_0xd46e('0x3c');}if(_0x232e6f[_0xd46e('0x2f')](_0xd46e('0x3d'))&&!_0x232e6f[_0xd46e('0x2f')]('internal')){var _0x964c66=_0x232e6f['substring'](0x0,_0x232e6f['indexOf']('fullname'));_0x232e6f+=','+_0x964c66+'internal';}return _0x232e6f;}exports[_0xd46e('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x54949f,_0x3b76e0){var _0x40720e=_0x54949f['sort'](function(_0x462477,_0x4114e6){if(_0x462477[_0xd46e('0x36')]===_0x4114e6[_0xd46e('0x36')]){if(_0x462477[_0xd46e('0x36')]===_0xd46e('0x21')){if(_0x3b76e0===_0xd46e('0x3a')){return(_0x462477[_0xd46e('0x34')]||'')<(_0x4114e6[_0xd46e('0x34')]||'')||_0x462477[_0xd46e('0x3d')][_0xd46e('0x3f')]()>_0x4114e6['fullname']['toLowerCase']()?0x1:-0x1;}else{return(_0x462477['pauseType']||'')<(_0x4114e6[_0xd46e('0x34')]||'')||_0x462477['fullname'][_0xd46e('0x3f')]()>_0x4114e6[_0xd46e('0x3d')][_0xd46e('0x3f')]()?-0x1:0x1;}}else{if(_0x3b76e0===_0xd46e('0x3a')){return _0x462477[_0xd46e('0x3d')][_0xd46e('0x3f')]()<_0x4114e6[_0xd46e('0x3d')][_0xd46e('0x3f')]()?0x1:-0x1;}else{return _0x462477['fullname'][_0xd46e('0x3f')]()<_0x4114e6['fullname'][_0xd46e('0x3f')]()?-0x1:0x1;}}}else{if(_0x3b76e0===_0xd46e('0x3a')){return _0x462477[_0xd46e('0x36')]<_0x4114e6[_0xd46e('0x36')]?0x1:-0x1;}else{return _0x462477[_0xd46e('0x36')]<_0x4114e6['globalStatus']?-0x1:0x1;}}});return _0x40720e;}exports[_0xd46e('0x40')]=sortAgentsByStatus;function filterAgentAttributes(_0xfcd7f9){var _0x2acb83=[_0xd46e('0x41'),_0xd46e('0x42'),'lastLoginAt',_0xd46e('0x43'),_0xd46e('0x34'),_0xd46e('0x43'),_0xd46e('0x44'),_0xd46e('0x45'),'chatPause',_0xd46e('0x7'),_0xd46e('0x6'),_0xd46e('0x8'),_0xd46e('0xa'),_0xd46e('0x5'),_0xd46e('0x9'),_0xd46e('0x46'),_0xd46e('0x47'),'mailCapacity',_0xd46e('0x48'),_0xd46e('0x49'),_0xd46e('0x4a'),_0xd46e('0x4b'),_0xd46e('0x4c'),'mailCurrentCapacity','smsCurrentCapacity',_0xd46e('0x4d'),_0xd46e('0x4e'),_0xd46e('0x13'),'openchannelStatus','mailStatus',_0xd46e('0x15'),_0xd46e('0x16'),'faxStatus',_0xd46e('0x12'),_0xd46e('0x4f'),_0xd46e('0x50'),_0xd46e('0x51'),_0xd46e('0x52'),_0xd46e('0x53'),_0xd46e('0x54'),_0xd46e('0x55'),'queue',_0xd46e('0x56'),_0xd46e('0x57'),_0xd46e('0x58'),_0xd46e('0x59'),'routealias'];var _0x56dd9a=[_0xd46e('0x4'),'openchannelPause',_0xd46e('0x6'),_0xd46e('0x8'),_0xd46e('0xa'),_0xd46e('0x5'),_0xd46e('0x9'),_0xd46e('0x42')];var _0x492329=_(_0xfcd7f9)[_0xd46e('0x5a')](_0x56dd9a)[_0xd46e('0x5b')](_0x2acb83)[_0xd46e('0x2d')]();return _0x492329;}exports['filterAgentAttributes']=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xd46e('0x33'),_0xd46e('0x3d'),_0xd46e('0x5c'),_0xd46e('0x44'),_0xd46e('0x42'),_0xd46e('0x36'),_0xd46e('0x41'),_0xd46e('0x5d'),_0xd46e('0x34'),_0xd46e('0x43'),_0xd46e('0x5'),_0xd46e('0x4'),_0xd46e('0x6'),_0xd46e('0x7'),'smsPause',_0xd46e('0x9'),_0xd46e('0xa'),_0xd46e('0x13'),_0xd46e('0x5e'),'mailStatus',_0xd46e('0x14'),_0xd46e('0x15'),_0xd46e('0x12'),_0xd46e('0x16'),'chatStatusTime',_0xd46e('0x54'),_0xd46e('0x51'),'openchannelStatusTime','smsStatusTime',_0xd46e('0x55'),_0xd46e('0x53'),_0xd46e('0x46'),'faxCapacity','mailCapacity',_0xd46e('0x47'),_0xd46e('0x48'),_0xd46e('0x49'),_0xd46e('0x4b'),_0xd46e('0x4e'),_0xd46e('0x5f'),_0xd46e('0x4c'),_0xd46e('0x60'),_0xd46e('0x4d'),_0xd46e('0x58'),_0xd46e('0x59'),_0xd46e('0x56'),_0xd46e('0x61'),_0xd46e('0x62'),_0xd46e('0x63'),_0xd46e('0x57')];}exports['getRealtimeAgentsQueryFields']=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(_0x26394d,_0x547eea){var _0x5c7861=function(_0x252805){while(--_0x252805){_0x26394d['push'](_0x26394d['shift']());}};_0x5c7861(++_0x547eea);}(_0x53ec,0x192));var _0xc53e=function(_0x3732e1,_0x304dc1){_0x3732e1=_0x3732e1-0x0;var _0x51e120=_0x53ec[_0x3732e1];return _0x51e120;};'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 d272922..570ca31 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 _0xbca2=['onHold','ringing','ringInUse','unavailable','unknown','pTalking','originated','message','statusMessage','Trunk','startPredictive','startProgressive','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','inbound','concat','outbound','map','get','talking','busy','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','paused','waiting','invalid','loggedInDb','notInUse'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xbca2,0x132));var _0x2bca=function(_0x1ed116,_0x23bc80){_0x1ed116=_0x1ed116-0x0;var _0x574066=_0xbca2[_0x1ed116];return _0x574066;};'use strict';var _=require(_0x2bca('0x0'));var jayson=require(_0x2bca('0x1'));var util=require(_0x2bca('0x2'));var amiClient=jayson[_0x2bca('0x3')][_0x2bca('0x4')]({'port':0x232a});var routingClient=jayson[_0x2bca('0x3')][_0x2bca('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x2bca('0x5'),_0x2bca('0x6'),_0x2bca('0x7'),_0x2bca('0x8')];var VOICE_QUEUE_ATTRIBUTES=['busy','inUse',_0x2bca('0x9'),_0x2bca('0xa'),_0x2bca('0xb'),_0x2bca('0xc'),_0x2bca('0xd'),_0x2bca('0xe'),'talking',_0x2bca('0xf'),_0x2bca('0x10')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x2bca('0x11'),_0x2bca('0x12'),_0x2bca('0x13'),_0x2bca('0x14'),'dialActive','dialMethod',_0x2bca('0x15'),_0x2bca('0x16'),_0x2bca('0x17'),'erlangCalls',_0x2bca('0x18'),'erlangAbandonmentRate',_0x2bca('0x19'),_0x2bca('0x1a'),_0x2bca('0x1b'),_0x2bca('0x1c'),'predictiveIntervalAvailable',_0x2bca('0x1d'),_0x2bca('0x1e'),_0x2bca('0x1f'),_0x2bca('0x20'),_0x2bca('0x21'),_0x2bca('0x22')];function getRealtimeQueues(_0x13dd6f,_0x31a869){var _0x10c545=_0x31a869===_0x2bca('0x23')?amiClient:routingClient;return _0x10c545['request'](_[_0x2bca('0x24')](_0x31a869)+_0x2bca('0x25'),_0x13dd6f)[_0x2bca('0x26')](function(_0x26807a){if(_0x26807a[_0x2bca('0x27')])throw new Error(util[_0x2bca('0x28')](_0x2bca('0x29'),_0x31a869));return _0x26807a[_0x2bca('0x2a')];})[_0x2bca('0x2b')](function(_0x2cd38f){throw _0x2cd38f;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x12d599,_0x297fd6,_0x1de4c5,_0x26ea9b){var _0x128880=DEFAULT_QUEUE_ATTRIBUTES;if(_0x1de4c5===_0x2bca('0x23')){if(_0x26ea9b===_0x2bca('0x2c')){_0x128880=_0x128880[_0x2bca('0x2d')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x26ea9b===_0x2bca('0x2e')){_0x128880=_0x128880[_0x2bca('0x2d')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x12d599[_0x2bca('0x2f')](function(_0x18de05){var _0x5adc01=_0x18de05[_0x2bca('0x30')]({'plain':!![]});_0x5adc01[_0x2bca('0x7')]=0x0;_0x5adc01[_0x2bca('0xa')]=0x0;_0x5adc01['loggedIn']=0x0;_0x5adc01[_0x2bca('0x5')]=0x0;_0x5adc01[_0x2bca('0x8')]=0x0;if(_0x1de4c5==='voice'){_0x5adc01[_0x2bca('0x31')]=0x0;_0x5adc01[_0x2bca('0x32')]=0x0;if(_0x26ea9b===_0x2bca('0x2e')){_0x5adc01[_0x2bca('0x11')]=0x0;_0x5adc01[_0x2bca('0x12')]=0x0;}}var _0x5f3f75=_['find'](_0x297fd6,['id',_0x5adc01['id']]);if(_0x5f3f75){_['merge'](_0x5adc01,_[_0x2bca('0x33')](_0x5f3f75,_0x128880));}return _0x5adc01;});}exports[_0x2bca('0x34')]=initializeQueues; \ No newline at end of file +var _0x5ae3=['format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','outbound','get','paused','find','merge','initializeQueues','lodash','jayson/promise','util','http','available','loggedIn','waiting','busy','invalid','loggedInDb','notInUse','ringInUse','talking','unavailable','unknown','pTalking','originated','message','statusMessage','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','startCase','Queues','then'];(function(_0x13ed69,_0x229161){var _0x50c72e=function(_0x4f1491){while(--_0x4f1491){_0x13ed69['push'](_0x13ed69['shift']());}};_0x50c72e(++_0x229161);}(_0x5ae3,0x10c));var _0x35ae=function(_0x4a0adb,_0x257a2e){_0x4a0adb=_0x4a0adb-0x0;var _0x2c76f5=_0x5ae3[_0x4a0adb];return _0x2c76f5;};'use strict';var _=require(_0x35ae('0x0'));var jayson=require(_0x35ae('0x1'));var util=require(_0x35ae('0x2'));var amiClient=jayson['client'][_0x35ae('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0x35ae('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x35ae('0x4'),_0x35ae('0x5'),'paused',_0x35ae('0x6')];var VOICE_QUEUE_ATTRIBUTES=[_0x35ae('0x7'),'inUse',_0x35ae('0x8'),_0x35ae('0x9'),_0x35ae('0xa'),'onHold','ringing',_0x35ae('0xb'),_0x35ae('0xc'),_0x35ae('0xd'),_0x35ae('0xe')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x35ae('0xf'),_0x35ae('0x10'),_0x35ae('0x11'),_0x35ae('0x12'),'dialActive',_0x35ae('0x13'),_0x35ae('0x14'),_0x35ae('0x15'),_0x35ae('0x16'),_0x35ae('0x17'),'erlangCallToSecond',_0x35ae('0x18'),_0x35ae('0x19'),_0x35ae('0x1a'),_0x35ae('0x1b'),'dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable',_0x35ae('0x1c'),_0x35ae('0x1d'),_0x35ae('0x1e'),_0x35ae('0x1f'),_0x35ae('0x20'),_0x35ae('0x21')];function getRealtimeQueues(_0x1649d0,_0x1b7d0b){var _0x55bd05=_0x1b7d0b===_0x35ae('0x22')?amiClient:routingClient;return _0x55bd05['request'](_[_0x35ae('0x23')](_0x1b7d0b)+_0x35ae('0x24'),_0x1649d0)[_0x35ae('0x25')](function(_0x55ec95){if(_0x55ec95['error'])throw new Error(util[_0x35ae('0x26')](_0x35ae('0x27'),_0x1b7d0b));return _0x55ec95[_0x35ae('0x28')];})[_0x35ae('0x29')](function(_0x1b19c1){throw _0x1b19c1;});}exports[_0x35ae('0x2a')]=getRealtimeQueues;function initializeQueues(_0x2c7ae2,_0x3f84dd,_0x5894c6,_0x17d9fa){var _0x4bac2d=DEFAULT_QUEUE_ATTRIBUTES;if(_0x5894c6===_0x35ae('0x22')){if(_0x17d9fa===_0x35ae('0x2b')){_0x4bac2d=_0x4bac2d[_0x35ae('0x2c')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x17d9fa===_0x35ae('0x2d')){_0x4bac2d=_0x4bac2d[_0x35ae('0x2c')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x2c7ae2['map'](function(_0x214810){var _0x53df46=_0x214810[_0x35ae('0x2e')]({'plain':!![]});_0x53df46[_0x35ae('0x2f')]=0x0;_0x53df46[_0x35ae('0x9')]=0x0;_0x53df46[_0x35ae('0x5')]=0x0;_0x53df46[_0x35ae('0x4')]=0x0;_0x53df46[_0x35ae('0x6')]=0x0;if(_0x5894c6===_0x35ae('0x22')){_0x53df46[_0x35ae('0xc')]=0x0;_0x53df46[_0x35ae('0x7')]=0x0;if(_0x17d9fa===_0x35ae('0x2d')){_0x53df46[_0x35ae('0xf')]=0x0;_0x53df46[_0x35ae('0x10')]=0x0;}}var _0x64f5e4=_[_0x35ae('0x30')](_0x3f84dd,['id',_0x53df46['id']]);if(_0x64f5e4){_[_0x35ae('0x31')](_0x53df46,_['pick'](_0x64f5e4,_0x4bac2d));}return _0x53df46;});}exports[_0x35ae('0x32')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 9f2e604..db0dc9c 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(_0x3ff685,_0x304b9e){var _0x2046c9=function(_0x7a10e9){while(--_0x7a10e9){_0x3ff685['push'](_0x3ff685['shift']());}};_0x2046c9(++_0x304b9e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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(_0x3a634e,_0x273db2){var _0x2ecddb=function(_0x3a9d2d){while(--_0x3a9d2d){_0x3a634e['push'](_0x3a634e['shift']());}};_0x2ecddb(++_0x273db2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 cb62662..cb4ad6b 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 _0xb830=['test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','ipAddress','createHash','substring','lodash','crypto','bimedia-machine-uuid','child_process','../environment','networkInterfaces','orderBy','keys','filter','family','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','model','join','md5','digest','hex','getUuid','platform','licenseToken'];(function(_0x1d8119,_0xc98f17){var _0x3e30f6=function(_0x2c7f3e){while(--_0x2c7f3e){_0x1d8119['push'](_0x1d8119['shift']());}};_0x3e30f6(++_0xc98f17);}(_0xb830,0xf6));var _0x0b83=function(_0x24f8a2,_0x1144b5){_0x24f8a2=_0x24f8a2-0x0;var _0x4d7884=_0xb830[_0x24f8a2];return _0x4d7884;};'use strict';var _=require(_0x0b83('0x0'));var os=require('os');var crypto=require(_0x0b83('0x1'));var machine=require(_0x0b83('0x2'));var exec=require(_0x0b83('0x3'))['execSync'];var config=require(_0x0b83('0x4'));function getInterfaces(){var _0x52937d=[];var _0x374b29=os[_0x0b83('0x5')]();var _0x693703=_[_0x0b83('0x6')](_[_0x0b83('0x7')](_0x374b29));for(var _0x2af640=0x0;_0x2af640<_0x693703['length'];_0x2af640++){var _0x338238=_0x374b29[_0x693703[_0x2af640]][_0x0b83('0x8')](function(_0x3efd8d){return _0x3efd8d[_0x0b83('0x9')]==='IPv4'&&_0x3efd8d[_0x0b83('0xa')]===![];});_0x52937d=_0x52937d[_0x0b83('0xb')](_0x338238);}return _0x52937d;}function getFirstInterface(){var _0x142430=_[_0x0b83('0xc')](getInterfaces());return{'macAddress':_0x142430&&_0x142430[_0x0b83('0xd')]?_0x142430[_0x0b83('0xd')]:_0x0b83('0xe'),'ipAddress':_0x142430&&_0x142430['address']?_0x142430[_0x0b83('0xf')]:_0x0b83('0x10')};}exports[_0x0b83('0x11')]=getFirstInterface;function getCPUhash(){var _0x128d77=_[_0x0b83('0x6')](os['cpus']()['map'](function(_0x5eeb42){return _0x5eeb42[_0x0b83('0x12')];}))[_0x0b83('0x13')](':');return crypto['createHash'](_0x0b83('0x14'))['update'](_0x128d77)[_0x0b83('0x15')](_0x0b83('0x16'));}exports[_0x0b83('0x17')]=function(){var _0x941563=os[_0x0b83('0x18')]();var _0x15d9c0=/[0-9a-f-]{36}/;if(config[_0x0b83('0x19')]&&_0x15d9c0[_0x0b83('0x1a')](config[_0x0b83('0x19')])){return config['licenseToken'];}else if(_0x941563===_0x0b83('0x1b')){return exec(_0x0b83('0x1c'),{'encoding':_0x0b83('0x1d')})[_0x0b83('0x1e')]('\x0d\x0a','');}else{var _0x46a70c=getFirstInterface();var _0x4c6439=getCPUhash();var _0x1e348d=_0x4c6439+'|'+os['hostname']()+'|'+_0x46a70c['macAddress']+'|'+_0x46a70c[_0x0b83('0x1f')];var _0x80aa61=crypto[_0x0b83('0x20')]('md5')['update'](_0x1e348d)[_0x0b83('0x15')]('hex');return _0x80aa61[_0x0b83('0x21')](0x0,0x8)+'-'+_0x80aa61['substring'](0x8,0xc)+'-'+_0x80aa61[_0x0b83('0x21')](0xc,0x10)+'-'+_0x80aa61[_0x0b83('0x21')](0x10,0x14)+'-'+_0x80aa61[_0x0b83('0x21')](0x14);}}; \ No newline at end of file +var _0xc7ca=['md5','update','digest','hex','test','licenseToken','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','substring','lodash','bimedia-machine-uuid','child_process','execSync','../environment','orderBy','length','family','IPv4','internal','concat','head','mac','address','127.0.0.1','getFirstInterface','map','model','join','createHash'];(function(_0x65cd03,_0x2913ee){var _0x21c579=function(_0xee6ad4){while(--_0xee6ad4){_0x65cd03['push'](_0x65cd03['shift']());}};_0x21c579(++_0x2913ee);}(_0xc7ca,0x8c));var _0xac7c=function(_0x5ec332,_0x4c7a9a){_0x5ec332=_0x5ec332-0x0;var _0x83612f=_0xc7ca[_0x5ec332];return _0x83612f;};'use strict';var _=require(_0xac7c('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0xac7c('0x1'));var exec=require(_0xac7c('0x2'))[_0xac7c('0x3')];var config=require(_0xac7c('0x4'));function getInterfaces(){var _0x143f89=[];var _0x4818a1=os['networkInterfaces']();var _0x207c35=_[_0xac7c('0x5')](_['keys'](_0x4818a1));for(var _0x44ad07=0x0;_0x44ad07<_0x207c35[_0xac7c('0x6')];_0x44ad07++){var _0x36d247=_0x4818a1[_0x207c35[_0x44ad07]]['filter'](function(_0x57b887){return _0x57b887[_0xac7c('0x7')]===_0xac7c('0x8')&&_0x57b887[_0xac7c('0x9')]===![];});_0x143f89=_0x143f89[_0xac7c('0xa')](_0x36d247);}return _0x143f89;}function getFirstInterface(){var _0xfa7135=_[_0xac7c('0xb')](getInterfaces());return{'macAddress':_0xfa7135&&_0xfa7135['mac']?_0xfa7135[_0xac7c('0xc')]:'00:00:00:00:00:00','ipAddress':_0xfa7135&&_0xfa7135[_0xac7c('0xd')]?_0xfa7135[_0xac7c('0xd')]:_0xac7c('0xe')};}exports[_0xac7c('0xf')]=getFirstInterface;function getCPUhash(){var _0x1e8ae1=_[_0xac7c('0x5')](os['cpus']()[_0xac7c('0x10')](function(_0x52779e){return _0x52779e[_0xac7c('0x11')];}))[_0xac7c('0x12')](':');return crypto[_0xac7c('0x13')](_0xac7c('0x14'))[_0xac7c('0x15')](_0x1e8ae1)[_0xac7c('0x16')](_0xac7c('0x17'));}exports['getUuid']=function(){var _0x1b5265=os['platform']();var _0x445d5b=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x445d5b[_0xac7c('0x18')](config[_0xac7c('0x19')])){return config['licenseToken'];}else if(_0x1b5265==='win32'){return exec(_0xac7c('0x1a'),{'encoding':_0xac7c('0x1b')})[_0xac7c('0x1c')]('\x0d\x0a','');}else{var _0x2d3758=getFirstInterface();var _0x4309a8=getCPUhash();var _0x49ce83=_0x4309a8+'|'+os[_0xac7c('0x1d')]()+'|'+_0x2d3758['macAddress']+'|'+_0x2d3758[_0xac7c('0x1e')];var _0x37fa0b=crypto['createHash'](_0xac7c('0x14'))[_0xac7c('0x15')](_0x49ce83)[_0xac7c('0x16')](_0xac7c('0x17'));return _0x37fa0b['substring'](0x0,0x8)+'-'+_0x37fa0b[_0xac7c('0x1f')](0x8,0xc)+'-'+_0x37fa0b[_0xac7c('0x1f')](0xc,0x10)+'-'+_0x37fa0b[_0xac7c('0x1f')](0x10,0x14)+'-'+_0x37fa0b[_0xac7c('0x1f')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 36cd29a..ec463ff 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 _0xb1de=['data2','then','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','catch','data1'];(function(_0x4fb739,_0x2c42d6){var _0x14fa0b=function(_0x4877d4){while(--_0x4877d4){_0x4fb739['push'](_0x4fb739['shift']());}};_0x14fa0b(++_0x2c42d6);}(_0xb1de,0x75));var _0xeb1d=function(_0x34c78d,_0x3ca186){_0x34c78d=_0x34c78d-0x0;var _0x311e59=_0xb1de[_0x34c78d];return _0x311e59;};'use strict';var util=require(_0xeb1d('0x0'));var moment=require(_0xeb1d('0x1'));var rp=require(_0xeb1d('0x2'));var BPromise=require(_0xeb1d('0x3'));var pkginfo=require(_0xeb1d('0x4'))(module,_0xeb1d('0x5'));var db=require(_0xeb1d('0x6'))['db'];var encryptor=require(_0xeb1d('0x7'));var hardware=require(_0xeb1d('0x8'));var logger=require(_0xeb1d('0x9'))(_0xeb1d('0xa'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x33ff8a){return new BPromise(function(_0x5c7e79,_0x1c314a){var _0x3e7460=util[_0xeb1d('0xb')](_0xeb1d('0xc'),HOST,_0x33ff8a,module['exports'][_0xeb1d('0x5')]);if(oldToken){_0x3e7460=util[_0xeb1d('0xb')](_0xeb1d('0xd'),HOST,_0x33ff8a,module[_0xeb1d('0xe')][_0xeb1d('0x5')],oldToken);}var _0xc3c21d={'uri':_0x3e7460,'method':_0xeb1d('0xf'),'timeout':0xea60,'json':!![]};return rp(_0xc3c21d)['then'](function(_0x497ea4){_0x5c7e79(_0x497ea4);})[_0xeb1d('0x10')](function(_0x3b1277){_0x1c314a(_0x3b1277);});});}function manageLicense(_0x4d086b,_0x225cb2){var _0x14d9a8=_0x225cb2['get']({'plain':!![]});if(!isOldTokenSent&&_0x14d9a8[_0xeb1d('0x11')]!==_0x4d086b&&!_0x14d9a8[_0xeb1d('0x12')]){oldToken=_0x14d9a8[_0xeb1d('0x11')];}httpRequest(_0x4d086b)[_0xeb1d('0x13')](function(_0x265593){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x265593[_0xeb1d('0x14')]){isOldTokenSent=![];if(!_0x14d9a8[_0xeb1d('0xa')]&&_0x14d9a8['license']!=_0x265593[_0xeb1d('0xa')]||_0x14d9a8[_0xeb1d('0xa')]&&_0x14d9a8[_0xeb1d('0x12')]){logger[_0xeb1d('0x15')](_0xeb1d('0x16'));}if(_0x14d9a8[_0xeb1d('0xa')]&&!_0x14d9a8[_0xeb1d('0x12')]&&_0x14d9a8[_0xeb1d('0xa')]!=_0x265593[_0xeb1d('0xa')]){logger[_0xeb1d('0x15')](_0xeb1d('0x17'));}if(_0x14d9a8[_0xeb1d('0xa')]&&!_0x14d9a8[_0xeb1d('0x12')]&&_0x14d9a8[_0xeb1d('0xa')]==_0x265593[_0xeb1d('0xa')]){return _0x225cb2;}return _0x225cb2[_0xeb1d('0x18')]({'data1':_0x4d086b,'data2':null,'license':_0x265593[_0xeb1d('0xa')]});}else{if(_0x265593['license']||_0x14d9a8['license']){if(!_0x14d9a8[_0xeb1d('0x12')]){if(_0x14d9a8[_0xeb1d('0x11')]==_0x4d086b){GRAY_PERIOD_REASON=_0xeb1d('0x19');logger[_0xeb1d('0x15')](_0xeb1d('0x1a'));}else{GRAY_PERIOD_REASON=_0xeb1d('0x1b');logger['info'](_0xeb1d('0x1c'),_0x14d9a8[_0xeb1d('0x11')],_0x4d086b);}logger[_0xeb1d('0x15')](_0xeb1d('0x1d'),GRAY_PERIOD_REASON[_0xeb1d('0x1e')](),moment()[_0xeb1d('0xb')](_0xeb1d('0x1f')));return _0x225cb2[_0xeb1d('0x18')]({'data2':encryptor[_0xeb1d('0x20')](moment()['format'](_0xeb1d('0x1f')))});}else{if(moment()[_0xeb1d('0x21')](encryptor[_0xeb1d('0x22')](_0x14d9a8[_0xeb1d('0x12')]),'days')>DAYS){logger[_0xeb1d('0x15')](_0xeb1d('0x23'),moment()[_0xeb1d('0xb')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x225cb2[_0xeb1d('0x18')]({'data1':_0x4d086b,'data2':null,'license':null});}}}else{if(_0x14d9a8[_0xeb1d('0x11')]!=_0x4d086b){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x14d9a8['data1'],_0x4d086b);return _0x225cb2['update']({'data1':_0x4d086b,'data2':null,'license':null});}}}return _0x225cb2;})['then'](function(_0x3e5b50){_0x225cb2=_0x3e5b50;})[_0xeb1d('0x10')](function(_0x4242dd){logger['error'](_0x4242dd[_0xeb1d('0x24')]);})[_0xeb1d('0x25')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x225cb2);},TIME);});}function defaultLicense(){var _0x28bb09=hardware[_0xeb1d('0x26')]();if(_0x28bb09){return db[_0xeb1d('0x27')][_0xeb1d('0x28')]({'where':{'id':0x1},'defaults':{'data1':_0x28bb09}})[_0xeb1d('0x29')](function(_0x3e00c3,_0x2a7a80){logger['info'](_0xeb1d('0x2a'),_0x28bb09);manageLicense(_0x28bb09,_0x3e00c3);})[_0xeb1d('0x10')](function(_0x1f97e1){logger[_0xeb1d('0x2b')](_0x1f97e1['message']);});}}exports[_0xeb1d('0x2c')]=defaultLicense; \ No newline at end of file +var _0xf406=['./hardware','license','format','exports','GET','then','catch','data2','data1','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','util','moment','request-promise','bluebird','version','../../components/encryptor'];(function(_0x5439d1,_0x2a825c){var _0x5b4900=function(_0x3d8d4e){while(--_0x3d8d4e){_0x5439d1['push'](_0x5439d1['shift']());}};_0x5b4900(++_0x2a825c);}(_0xf406,0xfd));var _0x6f40=function(_0x54945e,_0x42f71a){_0x54945e=_0x54945e-0x0;var _0x36eabd=_0xf406[_0x54945e];return _0x36eabd;};'use strict';var util=require(_0x6f40('0x0'));var moment=require(_0x6f40('0x1'));var rp=require(_0x6f40('0x2'));var BPromise=require(_0x6f40('0x3'));var pkginfo=require('pkginfo')(module,_0x6f40('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x6f40('0x5'));var hardware=require(_0x6f40('0x6'));var logger=require('../logger')(_0x6f40('0x7'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x38831a){return new BPromise(function(_0x4cf5e6,_0xec4a51){var _0x45f606=util[_0x6f40('0x8')]('%s/api/servers/%s/check?version=%s',HOST,_0x38831a,module['exports'][_0x6f40('0x4')]);if(oldToken){_0x45f606=util[_0x6f40('0x8')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x38831a,module[_0x6f40('0x9')][_0x6f40('0x4')],oldToken);}var _0x28a943={'uri':_0x45f606,'method':_0x6f40('0xa'),'timeout':0xea60,'json':!![]};return rp(_0x28a943)[_0x6f40('0xb')](function(_0x46d707){_0x4cf5e6(_0x46d707);})[_0x6f40('0xc')](function(_0x208409){_0xec4a51(_0x208409);});});}function manageLicense(_0x4e1217,_0xf7001c){var _0x8b08d8=_0xf7001c['get']({'plain':!![]});if(!isOldTokenSent&&_0x8b08d8['data1']!==_0x4e1217&&!_0x8b08d8[_0x6f40('0xd')]){oldToken=_0x8b08d8[_0x6f40('0xe')];}httpRequest(_0x4e1217)[_0x6f40('0xb')](function(_0x4f73dd){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4f73dd[_0x6f40('0xf')]){isOldTokenSent=![];if(!_0x8b08d8['license']&&_0x8b08d8[_0x6f40('0x7')]!=_0x4f73dd[_0x6f40('0x7')]||_0x8b08d8[_0x6f40('0x7')]&&_0x8b08d8[_0x6f40('0xd')]){logger[_0x6f40('0x10')](_0x6f40('0x11'));}if(_0x8b08d8[_0x6f40('0x7')]&&!_0x8b08d8['data2']&&_0x8b08d8['license']!=_0x4f73dd[_0x6f40('0x7')]){logger[_0x6f40('0x10')](_0x6f40('0x12'));}if(_0x8b08d8['license']&&!_0x8b08d8[_0x6f40('0xd')]&&_0x8b08d8[_0x6f40('0x7')]==_0x4f73dd[_0x6f40('0x7')]){return _0xf7001c;}return _0xf7001c[_0x6f40('0x13')]({'data1':_0x4e1217,'data2':null,'license':_0x4f73dd['license']});}else{if(_0x4f73dd[_0x6f40('0x7')]||_0x8b08d8[_0x6f40('0x7')]){if(!_0x8b08d8[_0x6f40('0xd')]){if(_0x8b08d8[_0x6f40('0xe')]==_0x4e1217){GRAY_PERIOD_REASON=_0x6f40('0x14');logger[_0x6f40('0x10')](_0x6f40('0x15'));}else{GRAY_PERIOD_REASON=_0x6f40('0x16');logger['info'](_0x6f40('0x17'),_0x8b08d8[_0x6f40('0xe')],_0x4e1217);}logger['info']('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x6f40('0x18')](),moment()[_0x6f40('0x8')](_0x6f40('0x19')));return _0xf7001c[_0x6f40('0x13')]({'data2':encryptor[_0x6f40('0x1a')](moment()[_0x6f40('0x8')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x6f40('0x1b')](encryptor['decryptString'](_0x8b08d8[_0x6f40('0xd')]),_0x6f40('0x1c'))>DAYS){logger[_0x6f40('0x10')]('DEMO\x20START\x20AT\x20%s',moment()['format']('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0xf7001c[_0x6f40('0x13')]({'data1':_0x4e1217,'data2':null,'license':null});}}}else{if(_0x8b08d8[_0x6f40('0xe')]!=_0x4e1217){logger[_0x6f40('0x10')](_0x6f40('0x17'),_0x8b08d8[_0x6f40('0xe')],_0x4e1217);return _0xf7001c[_0x6f40('0x13')]({'data1':_0x4e1217,'data2':null,'license':null});}}}return _0xf7001c;})[_0x6f40('0xb')](function(_0x24280d){_0xf7001c=_0x24280d;})['catch'](function(_0x32b155){logger['error'](_0x32b155[_0x6f40('0x1d')]);})[_0x6f40('0x1e')](function(){setTimeout(function(){manageLicense(hardware[_0x6f40('0x1f')](),_0xf7001c);},TIME);});}function defaultLicense(){var _0x525769=hardware[_0x6f40('0x1f')]();if(_0x525769){return db[_0x6f40('0x20')][_0x6f40('0x21')]({'where':{'id':0x1},'defaults':{'data1':_0x525769}})[_0x6f40('0x22')](function(_0x3d33e5,_0x1ea866){logger[_0x6f40('0x10')](_0x6f40('0x23'),_0x525769);manageLicense(_0x525769,_0x3d33e5);})['catch'](function(_0x1764b8){logger[_0x6f40('0x24')](_0x1764b8[_0x6f40('0x1d')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 5969fa3..ad18f96 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 _0xe2d7=['License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline','changed','disabled','message','User','role','sequelize','COUNT','col','count','admin','telephone','users','telephones','forEach','user','pick','countBy','License\x20limit\x20reached\x20for\x20users'];(function(_0x1fcb67,_0x70fb6c){var _0x17a001=function(_0x43ae93){while(--_0x43ae93){_0x1fcb67['push'](_0x1fcb67['shift']());}};_0x17a001(++_0x70fb6c);}(_0xe2d7,0x1c4));var _0x7e2d=function(_0x5dd7ab,_0x504414){_0x5dd7ab=_0x5dd7ab-0x0;var _0x18bd60=_0xe2d7[_0x5dd7ab];return _0x18bd60;};'use strict';var util=require(_0x7e2d('0x0'));var _=require(_0x7e2d('0x1'));var moment=require(_0x7e2d('0x2'));var BPromise=require(_0x7e2d('0x3'));var hardware=require(_0x7e2d('0x4'));var encryptor=require(_0x7e2d('0x5'));var db=require(_0x7e2d('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x7e2d('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x7e2d('0x8'),'machineUuid':hardware[_0x7e2d('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x7e2d('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x7e2d('0xa'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4b4244){return new BPromise(function(_0x185b24,_0x1aa27c){return db[_0x7e2d('0xb')][_0x7e2d('0xc')](_[_0x7e2d('0xd')](_0x4b4244,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0xb6c6b2){return checkLicense(_0xb6c6b2,null);})[_0x7e2d('0xe')](function(_0x556a5f){_0x185b24(_0x556a5f);return;})[_0x7e2d('0xf')](function(_0x350f5b){_0x1aa27c(_0x350f5b);});});}function checkLicense(_0x3e566a,_0x13dc0c){if(!_0x3e566a){demoLicense[_0x7e2d('0x10')]=_0x3e566a[_0x7e2d('0x11')];return demoLicense;}try{var _0x3596e5=_0x13dc0c||_0x3e566a[_0x7e2d('0x12')];if(_[_0x7e2d('0x13')](_0x3596e5)){throw new Error(_0x7e2d('0x14'));}var _0x1e1d0f=_0x3e566a[_0x7e2d('0x11')];var _0x2b5b2a=_0x3e566a['data2'];var _0x3ac78f=_0x1e1d0f[_0x7e2d('0x15')]('-')[0x4];var _0x24e879=_0x1e1d0f[_0x7e2d('0x15')]('-')[0x0];var _0x46700d=encryptor[_0x7e2d('0x16')](_0x3596e5,util[_0x7e2d('0x17')](_0x7e2d('0x18'),_0x3ac78f,_0x1e1d0f,_0x24e879));var _0x5460ba=JSON[_0x7e2d('0x19')](_0x46700d);_0x5460ba[_0x7e2d('0x1a')]=![];_0x5460ba['uuid']=_0x1e1d0f;_0x5460ba[_0x7e2d('0x1b')]=hardware[_0x7e2d('0x9')]();if(_0x2b5b2a){var _0x1f7a6f=encryptor[_0x7e2d('0x16')](_0x2b5b2a);_0x5460ba[_0x7e2d('0x1c')]=_0x1f7a6f;_0x5460ba[_0x7e2d('0x1d')]=moment(_0x1f7a6f)['add'](0x7,'days')[_0x7e2d('0x17')]();_0x5460ba['grayReason']=_0x5460ba['uuid']!=_0x5460ba['machineUuid']?_0x7e2d('0x1e'):_0x7e2d('0x1f');}return _0x5460ba;}catch(_0x4a98a2){breakingLicense['uuid']=_0x3e566a[_0x7e2d('0x11')];breakingLicense[_0x7e2d('0x20')]=_0x4a98a2['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x11d40e,_0x2092ba){getLicense()[_0x7e2d('0xe')](function(_0x249d86){return db[_0x7e2d('0x21')]['findAll']({'attributes':[_0x7e2d('0x22'),[db[_0x7e2d('0x23')]['fn'](_0x7e2d('0x24'),db[_0x7e2d('0x23')][_0x7e2d('0x25')]('role')),_0x7e2d('0x26')]],'group':_0x7e2d('0x22'),'where':{'role':{'$or':[_0x7e2d('0x27'),'user',_0x7e2d('0x28')]}},'raw':!![]})[_0x7e2d('0xe')](function(_0x31710b){var _0x1c0ef9={'user':_0x249d86[_0x7e2d('0x29')]||0x0,'telephone':_0x249d86[_0x7e2d('0x2a')]||0x0};_0x31710b[_0x7e2d('0x2b')](function(_0x3d79cf){var _0x273bae=_0x3d79cf[_0x7e2d('0x22')]===_0x7e2d('0x27')?_0x7e2d('0x2c'):_0x3d79cf['role'];_0x1c0ef9[_0x273bae]-=_0x3d79cf[_0x7e2d('0x26')];if(_0x1c0ef9[_0x273bae]<0x0)_0x1c0ef9[_0x273bae]=0x0;});_0x11d40e(_0x1c0ef9);return;});})[_0x7e2d('0xf')](function(_0x58917f){_0x2092ba(_0x58917f);});});}function checkUserLimits(_0x34eaca){return new BPromise(function(_0x16d93e,_0x4d50ad){getLimits()[_0x7e2d('0xe')](function(_0x47b513){var _0x124813=_[_0x7e2d('0x2d')](_[_0x7e2d('0x2e')](_0x34eaca,_0x7e2d('0x22')),[_0x7e2d('0x27'),_0x7e2d('0x2c'),_0x7e2d('0x28')]);var _0x2212e9=(_0x124813[_0x7e2d('0x27')]||0x0)+(_0x124813[_0x7e2d('0x2c')]||0x0);var _0xa8b044=_0x124813['telephone']||0x0;if(_0x2212e9>_0x47b513[_0x7e2d('0x2c')])return _0x4d50ad(_0x7e2d('0x2f'));if(_0xa8b044>_0x47b513[_0x7e2d('0x28')])return _0x4d50ad(_0x7e2d('0x30'));return _0x16d93e();})[_0x7e2d('0xf')](function(_0x2d2a35){_0x4d50ad(_0x2d2a35);});});}module[_0x7e2d('0x31')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x1424=['License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','defaults','then','uuid','data1','license','License\x20key\x20value\x20not\x20found','data2','split','format','parse','demo','gray','add','days','grayReason','changed','message','User','findAll','sequelize','COUNT','col','count','role','admin','user','telephone','forEach','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1424,0x13c));var _0x4142=function(_0x20b1e2,_0x26c5cf){_0x20b1e2=_0x20b1e2-0x0;var _0x2ad462=_0x1424[_0x20b1e2];return _0x2ad462;};'use strict';var util=require(_0x4142('0x0'));var _=require(_0x4142('0x1'));var moment=require(_0x4142('0x2'));var BPromise=require(_0x4142('0x3'));var hardware=require(_0x4142('0x4'));var encryptor=require(_0x4142('0x5'));var db=require(_0x4142('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4142('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x4142('0x8'),'machineUuid':hardware[_0x4142('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4142('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x4142('0xa'),'machineUuid':hardware[_0x4142('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1ac974){return new BPromise(function(_0x2e0a1e,_0x4ad2fb){return db[_0x4142('0xb')]['find'](_[_0x4142('0xc')](_0x1ac974,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x1417cb){return checkLicense(_0x1417cb,null);})[_0x4142('0xd')](function(_0x1466f2){_0x2e0a1e(_0x1466f2);return;})['catch'](function(_0x4c7ec5){_0x4ad2fb(_0x4c7ec5);});});}function checkLicense(_0x21bcaa,_0x4b5a84){if(!_0x21bcaa){demoLicense[_0x4142('0xe')]=_0x21bcaa[_0x4142('0xf')];return demoLicense;}try{var _0x23d426=_0x4b5a84||_0x21bcaa[_0x4142('0x10')];if(_['isEmpty'](_0x23d426)){throw new Error(_0x4142('0x11'));}var _0x30d261=_0x21bcaa[_0x4142('0xf')];var _0x5e4e1f=_0x21bcaa[_0x4142('0x12')];var _0x2cb4ea=_0x30d261[_0x4142('0x13')]('-')[0x4];var _0x51c521=_0x30d261[_0x4142('0x13')]('-')[0x0];var _0x1d5720=encryptor['decryptString'](_0x23d426,util[_0x4142('0x14')]('%s:%s:%s',_0x2cb4ea,_0x30d261,_0x51c521));var _0x3291e2=JSON[_0x4142('0x15')](_0x1d5720);_0x3291e2[_0x4142('0x16')]=![];_0x3291e2[_0x4142('0xe')]=_0x30d261;_0x3291e2['machineUuid']=hardware[_0x4142('0x9')]();if(_0x5e4e1f){var _0x325cb2=encryptor['decryptString'](_0x5e4e1f);_0x3291e2[_0x4142('0x17')]=_0x325cb2;_0x3291e2['deadline']=moment(_0x325cb2)[_0x4142('0x18')](0x7,_0x4142('0x19'))[_0x4142('0x14')]();_0x3291e2[_0x4142('0x1a')]=_0x3291e2[_0x4142('0xe')]!=_0x3291e2['machineUuid']?_0x4142('0x1b'):'disabled';}return _0x3291e2;}catch(_0x1e62c2){breakingLicense['uuid']=_0x21bcaa[_0x4142('0xf')];breakingLicense[_0x4142('0x1c')]=_0x1e62c2[_0x4142('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3fd0c3,_0x37d8d8){getLicense()[_0x4142('0xd')](function(_0x164142){return db[_0x4142('0x1d')][_0x4142('0x1e')]({'attributes':['role',[db[_0x4142('0x1f')]['fn'](_0x4142('0x20'),db[_0x4142('0x1f')][_0x4142('0x21')]('role')),_0x4142('0x22')]],'group':_0x4142('0x23'),'where':{'role':{'$or':[_0x4142('0x24'),_0x4142('0x25'),_0x4142('0x26')]}},'raw':!![]})[_0x4142('0xd')](function(_0x4445c4){var _0x36f06c={'user':_0x164142['users']||0x0,'telephone':_0x164142['telephones']||0x0};_0x4445c4[_0x4142('0x27')](function(_0xc0398c){var _0x5f0fc1=_0xc0398c[_0x4142('0x23')]===_0x4142('0x24')?_0x4142('0x25'):_0xc0398c[_0x4142('0x23')];_0x36f06c[_0x5f0fc1]-=_0xc0398c[_0x4142('0x22')];if(_0x36f06c[_0x5f0fc1]<0x0)_0x36f06c[_0x5f0fc1]=0x0;});_0x3fd0c3(_0x36f06c);return;});})[_0x4142('0x28')](function(_0xf1dad9){_0x37d8d8(_0xf1dad9);});});}function checkUserLimits(_0x3407a9){return new BPromise(function(_0x8147ea,_0x11df57){getLimits()[_0x4142('0xd')](function(_0x121ad2){var _0x1f87c4=_[_0x4142('0x29')](_[_0x4142('0x2a')](_0x3407a9,_0x4142('0x23')),[_0x4142('0x24'),_0x4142('0x25'),'telephone']);var _0x532de4=(_0x1f87c4[_0x4142('0x24')]||0x0)+(_0x1f87c4[_0x4142('0x25')]||0x0);var _0x3e06d1=_0x1f87c4[_0x4142('0x26')]||0x0;if(_0x532de4>_0x121ad2['user'])return _0x11df57(_0x4142('0x2b'));if(_0x3e06d1>_0x121ad2[_0x4142('0x26')])return _0x11df57(_0x4142('0x2c'));return _0x8147ea();})['catch'](function(_0x36c445){_0x11df57(_0x36c445);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 723d77b..47bc091 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 _0x1893=['myappanuglar-secret','app-id','secret'];(function(_0x56f92d,_0x1d500b){var _0x290941=function(_0x44fb43){while(--_0x44fb43){_0x56f92d['push'](_0x56f92d['shift']());}};_0x290941(++_0x1d500b);}(_0x1893,0xa2));var _0x3189=function(_0x213518,_0x51e022){_0x213518=_0x213518-0x0;var _0x1baf75=_0x1893[_0x213518];return _0x1baf75;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x3189('0x0'),'GOOGLE_ID':_0x3189('0x1'),'GOOGLE_SECRET':_0x3189('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x4e2e=['app-id','secret','http://localhost:9000','myappanuglar-secret'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x11a817,_0x57d55b){_0x11a817=_0x11a817-0x0;var _0x1a04da=_0x4e2e[_0x11a817];return _0x1a04da;};'use strict';module['exports']={'DOMAIN':_0xe4e2('0x0'),'SESSION_SECRET':_0xe4e2('0x1'),'GOOGLE_ID':_0xe4e2('0x2'),'GOOGLE_SECRET':_0xe4e2('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index a5c05cc..088efdc 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x13c2=['../utils/loggers','exports'];(function(_0x3a1602,_0xfbce10){var _0xeeb50f=function(_0x515304){while(--_0x515304){_0x3a1602['push'](_0x3a1602['shift']());}};_0xeeb50f(++_0xfbce10);}(_0x13c2,0xc2));var _0x213c=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x13c2[_0x220dbb];return _0x2b77de;};'use strict';var fileLogger=require(_0x213c('0x0'))['fileLogger'];module[_0x213c('0x1')]=fileLogger; \ No newline at end of file +var _0xf9c4=['fileLogger','exports','../utils/loggers'];(function(_0x9d679d,_0x4dd38a){var _0x3ce1dc=function(_0x2cbc68){while(--_0x2cbc68){_0x9d679d['push'](_0x9d679d['shift']());}};_0x3ce1dc(++_0x4dd38a);}(_0xf9c4,0x158));var _0x4f9c=function(_0x2a217b,_0xb039df){_0x2a217b=_0x2a217b-0x0;var _0x29a6ac=_0xf9c4[_0x2a217b];return _0x29a6ac;};'use strict';var fileLogger=require(_0x4f9c('0x0'))[_0x4f9c('0x1')];module[_0x4f9c('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index a2e6491..78559e2 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 _0x1e03=['../../services/email/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','resolve','join','root','legacy-libs','express','../../services/express/index.js','ami','agi','../../services/agi/index.js','email'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1e03,0xaa));var _0x31e0=function(_0x4cd8d5,_0xb981d5){_0x4cd8d5=_0x4cd8d5-0x0;var _0x19995f=_0x1e03[_0x4cd8d5];return _0x19995f;};'use strict';var path=require('path');var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0x31e0('0x0')](path[_0x31e0('0x1')](cfg[_0x31e0('0x2')],_0x31e0('0x3')))};var pm2config={'apps':[{'name':_0x31e0('0x4'),'script':path[_0x31e0('0x1')](__dirname,_0x31e0('0x5')),'env':env},{'name':_0x31e0('0x6'),'script':path['join'](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0x31e0('0x7'),'script':path[_0x31e0('0x1')](__dirname,_0x31e0('0x8')),'env':env},{'name':_0x31e0('0x9'),'script':path[_0x31e0('0x1')](__dirname,_0x31e0('0xa')),'env':env},{'name':'routing','script':path[_0x31e0('0x1')](__dirname,_0x31e0('0xb')),'env':env},{'name':_0x31e0('0xc'),'script':path[_0x31e0('0x1')](__dirname,_0x31e0('0xd')),'env':env}]};module[_0x31e0('0xe')]=pm2config; \ No newline at end of file +var _0x4116=['../../services/email/index.js','routing','xdr','../../config/environment','resolve','join','root','legacy-libs','ami','../../services/agi/index.js','email'];(function(_0x5c2b52,_0x4fa1bd){var _0x2819b0=function(_0x59ffca){while(--_0x59ffca){_0x5c2b52['push'](_0x5c2b52['shift']());}};_0x2819b0(++_0x4fa1bd);}(_0x4116,0x71));var _0x6411=function(_0xa69733,_0x2aa122){_0xa69733=_0xa69733-0x0;var _0xca5645=_0x4116[_0xa69733];return _0xca5645;};'use strict';var path=require('path');var cfg=require(_0x6411('0x0'));var env={'NODE_PATH':path[_0x6411('0x1')](path[_0x6411('0x2')](cfg[_0x6411('0x3')],_0x6411('0x4')))};var pm2config={'apps':[{'name':'express','script':path[_0x6411('0x2')](__dirname,'../../services/express/index.js'),'env':env},{'name':_0x6411('0x5'),'script':path[_0x6411('0x2')](__dirname,'../../services/ami/index.js'),'env':env},{'name':'agi','script':path[_0x6411('0x2')](__dirname,_0x6411('0x6')),'env':env},{'name':_0x6411('0x7'),'script':path[_0x6411('0x2')](__dirname,_0x6411('0x8')),'env':env},{'name':_0x6411('0x9'),'script':path[_0x6411('0x2')](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0x6411('0xa'),'script':path[_0x6411('0x2')](__dirname,'../../services/xdr/index.js'),'env':env}]};module['exports']=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index a338b24..e25bd65 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 _0x59b1=['disconnect','restart','list','describe','then','delete','dump','bluebird','connect','start','stop'];(function(_0x455239,_0x52b37d){var _0x233bff=function(_0x54400c){while(--_0x54400c){_0x455239['push'](_0x455239['shift']());}};_0x233bff(++_0x52b37d);}(_0x59b1,0x11a));var _0x159b=function(_0x3566c4,_0x34537f){_0x3566c4=_0x3566c4-0x0;var _0x8a2656=_0x59b1[_0x3566c4];return _0x8a2656;};'use strict';var pm2=require('pm2');var BPromise=require(_0x159b('0x0'));var config=require('./config');function connect(){return new BPromise(function(_0x1cc7c9,_0x495e50){return pm2[_0x159b('0x1')](function(_0xbf2ff4){if(_0xbf2ff4){return _0x495e50(_0xbf2ff4);}return _0x1cc7c9('connected');});});};exports[_0x159b('0x2')]=function(_0x287119){return connect()['then'](function(){return new BPromise(function(_0x46bcf9,_0x3ea073){return pm2['start'](_0x287119,function(_0x166926,_0x6b161f){if(_0x166926){return _0x3ea073(_0x166926);}pm2['disconnect']();return _0x46bcf9(_0x6b161f);});});});};exports[_0x159b('0x3')]=function(_0x250a31){return connect()['then'](function(){return new BPromise(function(_0x1ff51f,_0x3aa5d4){return pm2['stop'](_0x250a31,function(_0x17071f,_0x244645){if(_0x17071f){return _0x3aa5d4(_0x17071f);}pm2[_0x159b('0x4')]();return _0x1ff51f(_0x244645);});});});};exports[_0x159b('0x5')]=function(_0x32446e){return connect()['then'](function(){return new BPromise(function(_0x4773df,_0x30db77){return pm2[_0x159b('0x5')](_0x32446e,function(_0x468a5a,_0x4d3d6b){if(_0x468a5a){return _0x30db77(_0x468a5a);}pm2['disconnect']();return _0x4773df(_0x4d3d6b);});});});};exports[_0x159b('0x6')]=function(){return connect()['then'](function(){return new BPromise(function(_0x3fa6c9,_0x3f9ecd){return pm2[_0x159b('0x6')](function(_0x1e8834,_0x1d911b){if(_0x1e8834){return _0x3f9ecd(_0x1e8834);}pm2[_0x159b('0x4')]();return _0x3fa6c9(_0x1d911b);});});});};exports[_0x159b('0x7')]=function(_0x34adeb){return connect()[_0x159b('0x8')](function(){return new BPromise(function(_0x5d8c6b,_0x536e47){return pm2[_0x159b('0x7')](_0x34adeb,function(_0x3247e6,_0x182ddf){if(_0x3247e6){return _0x536e47(_0x3247e6);}pm2['disconnect']();return _0x5d8c6b(_0x182ddf);});});});};exports['delete']=function(_0x2bb11d){return connect()[_0x159b('0x8')](function(){return new BPromise(function(_0x3cccfd,_0x1e6d4a){return pm2[_0x159b('0x9')](_0x2bb11d,function(_0x3c9e0b,_0xf1f3b5){if(_0x3c9e0b){return _0x1e6d4a(_0x3c9e0b);}pm2[_0x159b('0x4')]();return _0x3cccfd(_0xf1f3b5);});});});};exports[_0x159b('0xa')]=function(){return connect()['then'](function(){return new BPromise(function(_0x380432,_0x2f9207){return pm2[_0x159b('0xa')](function(_0x32fb91){if(_0x32fb91){return _0x2f9207(_0x32fb91);}return _0x380432('saved');});});});}; \ No newline at end of file +var _0x46f5=['list','describe','delete','dump','pm2','bluebird','./config','connect','start','then','disconnect','stop','restart'];(function(_0x326c7e,_0x23af0a){var _0x2f7565=function(_0xef7b81){while(--_0xef7b81){_0x326c7e['push'](_0x326c7e['shift']());}};_0x2f7565(++_0x23af0a);}(_0x46f5,0xfb));var _0x546f=function(_0xd21550,_0x31c67d){_0xd21550=_0xd21550-0x0;var _0x5bca0b=_0x46f5[_0xd21550];return _0x5bca0b;};'use strict';var pm2=require(_0x546f('0x0'));var BPromise=require(_0x546f('0x1'));var config=require(_0x546f('0x2'));function connect(){return new BPromise(function(_0x4898d6,_0x54c4d4){return pm2[_0x546f('0x3')](function(_0x5a6e57){if(_0x5a6e57){return _0x54c4d4(_0x5a6e57);}return _0x4898d6('connected');});});};exports[_0x546f('0x4')]=function(_0x9ba99f){return connect()[_0x546f('0x5')](function(){return new BPromise(function(_0x1f4021,_0x1ee402){return pm2[_0x546f('0x4')](_0x9ba99f,function(_0x56d512,_0x4c20bb){if(_0x56d512){return _0x1ee402(_0x56d512);}pm2[_0x546f('0x6')]();return _0x1f4021(_0x4c20bb);});});});};exports[_0x546f('0x7')]=function(_0x9f2e50){return connect()['then'](function(){return new BPromise(function(_0x2100f4,_0x5cefb4){return pm2[_0x546f('0x7')](_0x9f2e50,function(_0x5a3e90,_0x452d06){if(_0x5a3e90){return _0x5cefb4(_0x5a3e90);}pm2[_0x546f('0x6')]();return _0x2100f4(_0x452d06);});});});};exports[_0x546f('0x8')]=function(_0x41f15b){return connect()['then'](function(){return new BPromise(function(_0xf43031,_0x30d865){return pm2[_0x546f('0x8')](_0x41f15b,function(_0xd8471a,_0x41b95a){if(_0xd8471a){return _0x30d865(_0xd8471a);}pm2[_0x546f('0x6')]();return _0xf43031(_0x41b95a);});});});};exports[_0x546f('0x9')]=function(){return connect()[_0x546f('0x5')](function(){return new BPromise(function(_0x20fb4e,_0x3c0b00){return pm2[_0x546f('0x9')](function(_0x1ba4ed,_0x24c633){if(_0x1ba4ed){return _0x3c0b00(_0x1ba4ed);}pm2[_0x546f('0x6')]();return _0x20fb4e(_0x24c633);});});});};exports[_0x546f('0xa')]=function(_0x2fb78d){return connect()[_0x546f('0x5')](function(){return new BPromise(function(_0x1de438,_0x25cef4){return pm2[_0x546f('0xa')](_0x2fb78d,function(_0x1d5bc3,_0x963abb){if(_0x1d5bc3){return _0x25cef4(_0x1d5bc3);}pm2['disconnect']();return _0x1de438(_0x963abb);});});});};exports[_0x546f('0xb')]=function(_0x1c382d){return connect()[_0x546f('0x5')](function(){return new BPromise(function(_0x49d162,_0x2bfe9d){return pm2[_0x546f('0xb')](_0x1c382d,function(_0x248b8a,_0x134ca3){if(_0x248b8a){return _0x2bfe9d(_0x248b8a);}pm2[_0x546f('0x6')]();return _0x49d162(_0x134ca3);});});});};exports[_0x546f('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x2e2f50,_0x29b08b){return pm2['dump'](function(_0x5429b6){if(_0x5429b6){return _0x29b08b(_0x5429b6);}return _0x2e2f50('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 1ad4a45..a904a38 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 _0x8e3d=['ChatInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','join','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','util','../../config/environment','../../mysqldb','../logger','schedule','redis','socket.io-emitter','Setting','find','chatTimeout','then','findAll','lastMsgAt','subtract','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8e3d,0x1ea));var _0xd8e3=function(_0x55cab6,_0xcfb493){_0x55cab6=_0x55cab6-0x0;var _0x556ec1=_0x8e3d[_0x55cab6];return _0x556ec1;};'use strict';var _=require(_0xd8e3('0x0'));var moment=require(_0xd8e3('0x1'));var Redis=require('ioredis');var util=require(_0xd8e3('0x2'));var config=require(_0xd8e3('0x3'));var db=require(_0xd8e3('0x4'))['db'];var logger=require(_0xd8e3('0x5'))(_0xd8e3('0x6'));config[_0xd8e3('0x7')]=_['defaults'](config[_0xd8e3('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xd8e3('0x8'))(new Redis(config[_0xd8e3('0x7')]));function closeInteractions(){var _0xf5a7dd=0x0;var _0x309baa=[];return db[_0xd8e3('0x9')][_0xd8e3('0xa')]({'raw':!![],'attributes':['id',_0xd8e3('0xb')],'where':{'id':0x1}})[_0xd8e3('0xc')](function(_0x4a4c3a){_0xf5a7dd=_0x4a4c3a[_0xd8e3('0xb')];if(_0xf5a7dd){return db['ChatInteraction'][_0xd8e3('0xd')]({'raw':!![],'attributes':['id',_0xd8e3('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xd8e3('0xf')](_0x4a4c3a['chatTimeout'],_0xd8e3('0x10'))}}});}else{return[];}})[_0xd8e3('0xc')](function(_0x131646){if(_0x131646&&_0x131646[_0xd8e3('0x11')]){_0x309baa=_['map'](_0x131646||[],'id');logger[_0xd8e3('0x12')](_0xd8e3('0x13'),_0x309baa['join']());return db[_0xd8e3('0x14')][_0xd8e3('0x15')]({'closeReason':_0xd8e3('0x16'),'disposition':_0xd8e3('0x17'),'closed':!![],'closedAt':moment()[_0xd8e3('0x18')](_0xd8e3('0x19'))},{'where':{'id':_0x309baa}});}})[_0xd8e3('0xc')](function(){if(_0x309baa&&_0x309baa[_0xd8e3('0x11')]){logger[_0xd8e3('0x12')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x309baa[_0xd8e3('0x1a')]());for(var _0x5c0184=0x0;_0x5c0184<_0x309baa[_0xd8e3('0x11')];_0x5c0184++){io[_0xd8e3('0x1b')](_0xd8e3('0x1c'),{'id':_0x309baa[_0x5c0184],'closed':!![]});}}})[_0xd8e3('0x1d')](function(_0x285a46){logger[_0xd8e3('0x1e')](_0xd8e3('0x1f'),_0x285a46?util[_0xd8e3('0x20')](_0x285a46,{'showHidden':![],'depth':null}):'');});}exports[_0xd8e3('0x21')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xf47c=['minutes','length','map','info','join','ChatInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','util','../../config/environment','../../mysqldb','schedule','defaults','redis','socket.io-emitter','Setting','find','chatTimeout','then','lastMsgAt','subtract'];(function(_0x50eab9,_0x1a6d00){var _0x102a2f=function(_0x5af23c){while(--_0x5af23c){_0x50eab9['push'](_0x50eab9['shift']());}};_0x102a2f(++_0x1a6d00);}(_0xf47c,0x79));var _0xcf47=function(_0x1c8bdc,_0x5a0b14){_0x1c8bdc=_0x1c8bdc-0x0;var _0x4aa48c=_0xf47c[_0x1c8bdc];return _0x4aa48c;};'use strict';var _=require(_0xcf47('0x0'));var moment=require('moment');var Redis=require(_0xcf47('0x1'));var util=require(_0xcf47('0x2'));var config=require(_0xcf47('0x3'));var db=require(_0xcf47('0x4'))['db'];var logger=require('../logger')(_0xcf47('0x5'));config['redis']=_[_0xcf47('0x6')](config[_0xcf47('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xcf47('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x586abb=0x0;var _0x11b781=[];return db[_0xcf47('0x9')][_0xcf47('0xa')]({'raw':!![],'attributes':['id',_0xcf47('0xb')],'where':{'id':0x1}})[_0xcf47('0xc')](function(_0x1565f9){_0x586abb=_0x1565f9[_0xcf47('0xb')];if(_0x586abb){return db['ChatInteraction']['findAll']({'raw':!![],'attributes':['id',_0xcf47('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xcf47('0xe')](_0x1565f9[_0xcf47('0xb')],_0xcf47('0xf'))}}});}else{return[];}})[_0xcf47('0xc')](function(_0x27287c){if(_0x27287c&&_0x27287c[_0xcf47('0x10')]){_0x11b781=_[_0xcf47('0x11')](_0x27287c||[],'id');logger[_0xcf47('0x12')]('[CHAT]\x20Interactions\x20to\x20close:',_0x11b781[_0xcf47('0x13')]());return db[_0xcf47('0x14')][_0xcf47('0x15')]({'closeReason':_0xcf47('0x16'),'disposition':_0xcf47('0x17'),'closed':!![],'closedAt':moment()[_0xcf47('0x18')](_0xcf47('0x19'))},{'where':{'id':_0x11b781}});}})[_0xcf47('0xc')](function(){if(_0x11b781&&_0x11b781['length']){logger['info'](_0xcf47('0x1a'),_0x11b781[_0xcf47('0x13')]());for(var _0x2a0b98=0x0;_0x2a0b98<_0x11b781[_0xcf47('0x10')];_0x2a0b98++){io[_0xcf47('0x1b')](_0xcf47('0x1c'),{'id':_0x11b781[_0x2a0b98],'closed':!![]});}}})[_0xcf47('0x1d')](function(_0x43f565){logger[_0xcf47('0x1e')](_0xcf47('0x1f'),_0x43f565?util[_0xcf47('0x20')](_0x43f565,{'showHidden':![],'depth':null}):'');});}exports[_0xcf47('0x21')]=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 6a16359..2cda35e 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 _0x429a=['startAllRefreshIntervals','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x5d4adf,_0xac4932){var _0x34ef1a=function(_0xa5b6d2){while(--_0xa5b6d2){_0x5d4adf['push'](_0x5d4adf['shift']());}};_0x34ef1a(++_0xac4932);}(_0x429a,0x183));var _0xa429=function(_0xf168d3,_0x43dcfc){_0xf168d3=_0xf168d3-0x0;var _0x17fb54=_0x429a[_0xf168d3];return _0x17fb54;};'use strict';function start(){var _0x106157=require(_0xa429('0x0'));return _0x106157[_0xa429('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0x2be5=['exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0xb83c69,_0xe332f3){var _0x2f9cbf=function(_0x54b909){while(--_0x54b909){_0xb83c69['push'](_0xb83c69['shift']());}};_0x2f9cbf(++_0xe332f3);}(_0x2be5,0xeb));var _0x52be=function(_0x23d2d5,_0x26d2f2){_0x23d2d5=_0x23d2d5-0x0;var _0x4f137b=_0x2be5[_0x23d2d5];return _0x4f137b;};'use strict';function start(){var _0x755d25=require(_0x52be('0x0'));return _0x755d25['startAllRefreshIntervals']();}module[_0x52be('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 2f117ac..5d271da 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 _0x9251=['runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','findAll','CloudProvider','jobs','toString','keyBy','difference','length','stop','deleteJob','delete\x20cron','toRun','index','resolve','cron','isBetween','add','start','exists','update','update\x20cron','stop\x20cron','run','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','name','Smtp','bcc','subtractNumber','subtractUnit','join','../../files/reports','%s.%s','basename','savename','zip','existsSync','status','Sent','attachments','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','then','error','error\x20mail','email\x20sent','isNil','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s'];(function(_0x2fd0ec,_0x34a4e0){var _0x1a0601=function(_0x1ee677){while(--_0x1ee677){_0x2fd0ec['push'](_0x2fd0ec['shift']());}};_0x1a0601(++_0x34a4e0);}(_0x9251,0x1ef));var _0x1925=function(_0x14e9f0,_0x287f90){_0x14e9f0=_0x14e9f0-0x0;var _0xa63f7e=_0x9251[_0x14e9f0];return _0xa63f7e;};'use strict';var fs=require('fs');var util=require(_0x1925('0x0'));var path=require(_0x1925('0x1'));var _=require(_0x1925('0x2'));var moment=require(_0x1925('0x3'));var CronJobManager=require(_0x1925('0x4'));var jayson=require(_0x1925('0x5'));var BPromise=require(_0x1925('0x6'));var logger=require(_0x1925('0x7'))(_0x1925('0x8'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x1925('0x9'));var analyticDefaultReportController=require(_0x1925('0xa'));var client=jayson['client'][_0x1925('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4aaaa4,_0x1f60e8){return function(){logger[_0x1925('0xc')](_0x1925('0xd'),_0x4aaaa4[_0x1925('0xe')]);var _0x1323b5=!![];var _0x21fe15=_0x4aaaa4[_0x1925('0xf')][_0x1925('0x10')]();var _0x3d2b5b={'account':_0x21fe15,'message':{'from':util[_0x1925('0x11')]('\x22%s\x22\x20<%s>',_0x4aaaa4[_0x1925('0xf')][_0x1925('0x12')],_0x4aaaa4[_0x1925('0xf')][_0x1925('0xe')]||_0x4aaaa4[_0x1925('0xf')][_0x1925('0x13')]['user']),'to':_0x4aaaa4[_0x1925('0xe')],'cc':_0x4aaaa4['cc'],'bcc':_0x4aaaa4[_0x1925('0x14')],'subject':util[_0x1925('0x11')]('Report\x20%s\x20last\x20%s\x20%s',_0x1f60e8[_0x1925('0x12')],_0x4aaaa4[_0x1925('0x15')],_0x4aaaa4[_0x1925('0x16')])}};var _0x28f1fe=path[_0x1925('0x17')](__dirname,_0x1925('0x18'));var _0x2ca3c2=_0x1f60e8['savename'];var _0x559de6=util['format'](_0x1925('0x19'),path[_0x1925('0x1a')](_0x1f60e8['savename'],path['extname'](_0x1f60e8[_0x1925('0x1b')])),_0x1925('0x1c'));var _0x176235=path[_0x1925('0x17')](_0x28f1fe,_0x2ca3c2);var _0x2ae3a2=path[_0x1925('0x17')](_0x28f1fe,_0x559de6);if(fs[_0x1925('0x1d')](_0x176235)){_0x1f60e8[_0x1925('0x1e')]=_0x1925('0x1f');_0x3d2b5b['message'][_0x1925('0x20')]=[{'filename':_0x2ca3c2,'path':_0x176235}];_0x3d2b5b[_0x1925('0x21')][_0x1925('0x22')]=util[_0x1925('0x11')](_0x1925('0x23'),JSON[_0x1925('0x24')](_0x1f60e8,null,0x2));}else if(fs['existsSync'](_0x2ae3a2)){_0x1f60e8[_0x1925('0x1e')]=_0x1925('0x1f');_0x3d2b5b['message'][_0x1925('0x20')]=[{'filename':_0x559de6,'path':_0x2ae3a2}];}else{_0x3d2b5b[_0x1925('0x21')]['text']=_0x1925('0x25');if(!_0x4aaaa4[_0x1925('0x26')]){_0x1323b5=![];logger[_0x1925('0xc')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x1323b5){return client[_0x1925('0x27')](_0x1925('0x28'),_0x3d2b5b)[_0x1925('0x29')](function(_0x345e74){if(_0x345e74[_0x1925('0x2a')]){return logger[_0x1925('0x2a')](_0x1925('0x2b'),JSON[_0x1925('0x24')](_0x345e74));}return logger['info'](_0x1925('0x2c'));})['catch'](function(_0x5ccb25){return logger['error'](_0x1925('0x2b'),JSON['stringify'](_0x5ccb25));});}};}function handleError(){return function(_0x8f3e4c){return logger[_0x1925('0x2a')](JSON['stringify'](_0x8f3e4c));};}function handleResult(_0x1b62ae){return function(_0x1509ce){logger[_0x1925('0xc')]('data',JSON[_0x1925('0x24')](_0x1509ce));if(_0x1b62ae[_0x1925('0xf')]&&_0x1b62ae[_0x1925('0xf')][_0x1925('0x13')]&&!_[_0x1925('0x2d')](_0x1b62ae[_0x1925('0xe')])){setTimeout(handleSendEmail(_0x1b62ae,_0x1509ce),0x3c*0x3e8);}};}function handleJob(_0x52d9be){return function(){try{if(_[_0x1925('0x2d')](_0x52d9be['subtractNumber'])){return logger[_0x1925('0xc')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x1925('0x2d')](_0x52d9be[_0x1925('0x16')])){return logger[_0x1925('0xc')]('subtractUnit\x20null\x20or\x20undefined');}var _0x5e877f={'startDate':moment()[_0x1925('0x2e')](_0x52d9be['subtractNumber'],_0x52d9be['subtractUnit'])['format'](_0x1925('0x2f')),'endDate':moment()[_0x1925('0x11')](_0x1925('0x2f')),'type':'scheduled','output':_0x52d9be[_0x1925('0x30')],'name':_0x52d9be[_0x1925('0x12')]};if(!_[_0x1925('0x2d')](_0x52d9be[_0x1925('0x31')])){logger[_0x1925('0xc')](_0x1925('0x32'),_0x52d9be['DefaultReportId']);return analyticDefaultReportController[_0x1925('0x33')]({'id':_0x52d9be[_0x1925('0x31')]},_0x5e877f)[_0x1925('0x29')](handleResult(_0x52d9be))[_0x1925('0x34')](handleError());}if(!_[_0x1925('0x2d')](_0x52d9be[_0x1925('0x35')])){logger['info'](_0x1925('0x36'),_0x52d9be['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x52d9be[_0x1925('0x35')]},_0x5e877f)[_0x1925('0x29')](handleResult(_0x52d9be))[_0x1925('0x34')](handleError());}}catch(_0x418ce6){logger['error'](JSON[_0x1925('0x24')](_0x418ce6));}return logger['info'](_0x1925('0x37'));};}function getJobs(_0x503c88){var _0x3a2854={};if(_0x503c88){_0x3a2854['id']=_0x503c88;}return db['Schedule'][_0x1925('0x38')]({'where':_0x3a2854,'include':[{'model':db[_0x1925('0xf')],'attributes':['id',_0x1925('0x12'),_0x1925('0xe')],'include':[{'model':db['MailServerOut'],'as':_0x1925('0x13'),'include':[{'model':db[_0x1925('0x39')],'as':_0x1925('0x39')}]}]}]})[_0x1925('0x29')](function(_0x19bcd5){var _0x3cf863=_['keys'](manager[_0x1925('0x3a')]);var _0x38854b=_['map'](_0x19bcd5,function(_0x22851b){return _0x22851b['id'][_0x1925('0x3b')]();});var _0x80d8a7=_[_0x1925('0x3c')](_0x19bcd5,function(_0x4f16a7){return _0x4f16a7['id'][_0x1925('0x3b')]();});var _0x53c36a=_0x503c88?_0x38854b:_['difference'](_0x38854b,_0x3cf863);var _0x578f5b=_['intersection'](_0x38854b,_0x3cf863);var _0x5c891e=_[_0x1925('0x3d')](_0x3cf863,_0x38854b);var _0x38d9ec;var _0xcc7a88;for(_0x38d9ec=0x0;_0x38d9ec<_0x5c891e[_0x1925('0x3e')]&&!_0x503c88;_0x38d9ec+=0x1){_0xcc7a88=_0x5c891e[_0x38d9ec][_0x1925('0x3b')]();if(manager['exists'](_0xcc7a88)){manager[_0x1925('0x3f')](_0xcc7a88);manager[_0x1925('0x40')](_0xcc7a88);logger[_0x1925('0xc')](_0x1925('0x41'),_0xcc7a88);}}logger[_0x1925('0xc')](_0x1925('0x42'),JSON['stringify'](_0x53c36a));for(_0x38d9ec=0x0;_0x38d9ec<_0x53c36a['length'];_0x38d9ec+=0x1){_0xcc7a88=_0x53c36a[_0x38d9ec]['toString']();logger[_0x1925('0xc')](_0x1925('0x43'),_0xcc7a88);if(_0x503c88){logger['info']('my\x20id',_0x503c88);logger[_0x1925('0xc')](JSON[_0x1925('0x24')](_0x80d8a7[_0xcc7a88]));BPromise[_0x1925('0x44')]()[_0x1925('0x29')](handleJob(_0x80d8a7[_0xcc7a88]));logger[_0x1925('0xc')]('run\x20job',_0x80d8a7[_0xcc7a88][_0x1925('0x12')],_0x80d8a7[_0xcc7a88][_0x1925('0x45')]);}else if(_0x80d8a7[_0xcc7a88]['cron']&&_0x80d8a7[_0xcc7a88]['active']&&moment()[_0x1925('0x46')](_0x80d8a7[_0xcc7a88]['startAt'],_0x80d8a7[_0xcc7a88]['endAt'])){manager[_0x1925('0x47')](_0xcc7a88,_0x80d8a7[_0xcc7a88][_0x1925('0x45')],handleJob(_0x80d8a7[_0xcc7a88]));manager[_0x1925('0x48')](_0xcc7a88);logger[_0x1925('0xc')]('add\x20cron',_0x80d8a7[_0xcc7a88][_0x1925('0x12')],_0x80d8a7[_0xcc7a88][_0x1925('0x45')]);}else if(manager[_0x1925('0x49')](_0xcc7a88)){manager['stop'](_0xcc7a88);manager[_0x1925('0x40')](_0xcc7a88);logger[_0x1925('0xc')]('stop\x20cron',_0x80d8a7[_0xcc7a88]['name'],_0x80d8a7[_0xcc7a88][_0x1925('0x45')]);}}for(_0x38d9ec=0x0,_0xcc7a88;_0x38d9ec<_0x578f5b['length']&&!_0x503c88;_0x38d9ec+=0x1){_0xcc7a88=_0x578f5b[_0x38d9ec][_0x1925('0x3b')]();if(manager[_0x1925('0x49')](_0xcc7a88)){if(_0x80d8a7[_0xcc7a88]['cron']&&_0x80d8a7[_0xcc7a88]['active']&&moment()['isBetween'](_0x80d8a7[_0xcc7a88]['startAt'],_0x80d8a7[_0xcc7a88]['endAt'])){manager[_0x1925('0x4a')](_0xcc7a88,_0x80d8a7[_0xcc7a88][_0x1925('0x45')],handleJob(_0x80d8a7[_0xcc7a88]));logger[_0x1925('0xc')](_0x1925('0x4b'),_0x80d8a7[_0xcc7a88][_0x1925('0x12')],_0x80d8a7[_0xcc7a88][_0x1925('0x45')]);}else{manager[_0x1925('0x3f')](_0xcc7a88);manager['deleteJob'](_0xcc7a88);logger[_0x1925('0xc')](_0x1925('0x4c'),_0x80d8a7[_0xcc7a88]['name'],_0x80d8a7[_0xcc7a88][_0x1925('0x45')]);}}}})[_0x1925('0x34')](function(_0x56f6d3){logger[_0x1925('0x2a')](JSON[_0x1925('0x24')](_0x56f6d3));});}exports[_0x1925('0x4d')]=function(_0x5a549b){return getJobs(_0x5a549b);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x4a39=['../../api/analyticCustomReport/analyticCustomReport.controller','client','http','email','MailAccount','format','\x22%s\x22\x20<%s>','Smtp','bcc','name','subtractNumber','subtractUnit','%s.%s','basename','savename','extname','zip','join','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','existsSync','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','SendMail','then','error','error\x20mail','catch','data','isNil','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','cron','active','isBetween','endAt','start','stop\x20cron','startAt','update','update\x20cron','run','util','lodash','moment','jayson/promise','../logger','schedule','../../mysqldb'];(function(_0x14898e,_0x53a29f){var _0x17ad43=function(_0x2d6a47){while(--_0x2d6a47){_0x14898e['push'](_0x14898e['shift']());}};_0x17ad43(++_0x53a29f);}(_0x4a39,0x9b));var _0x94a3=function(_0x2db30b,_0x740f15){_0x2db30b=_0x2db30b-0x0;var _0x2db253=_0x4a39[_0x2db30b];return _0x2db253;};'use strict';var fs=require('fs');var util=require(_0x94a3('0x0'));var path=require('path');var _=require(_0x94a3('0x1'));var moment=require(_0x94a3('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x94a3('0x3'));var BPromise=require('bluebird');var logger=require(_0x94a3('0x4'))(_0x94a3('0x5'));var db=require(_0x94a3('0x6'))['db'];var analyticCustomReportController=require(_0x94a3('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x94a3('0x8')][_0x94a3('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x48e86a,_0x1bfea9){return function(){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0x48e86a[_0x94a3('0xa')]);var _0x52e15d=!![];var _0x14985b=_0x48e86a[_0x94a3('0xb')]['getSmtpOptions']();var _0x23192a={'account':_0x14985b,'message':{'from':util[_0x94a3('0xc')](_0x94a3('0xd'),_0x48e86a[_0x94a3('0xb')]['name'],_0x48e86a[_0x94a3('0xb')]['email']||_0x48e86a[_0x94a3('0xb')][_0x94a3('0xe')]['user']),'to':_0x48e86a[_0x94a3('0xa')],'cc':_0x48e86a['cc'],'bcc':_0x48e86a[_0x94a3('0xf')],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x1bfea9[_0x94a3('0x10')],_0x48e86a[_0x94a3('0x11')],_0x48e86a[_0x94a3('0x12')])}};var _0x2cc6f7=path['join'](__dirname,'../../files/reports');var _0x3bda03=_0x1bfea9['savename'];var _0x4642d4=util['format'](_0x94a3('0x13'),path[_0x94a3('0x14')](_0x1bfea9[_0x94a3('0x15')],path[_0x94a3('0x16')](_0x1bfea9[_0x94a3('0x15')])),_0x94a3('0x17'));var _0x10c9ab=path[_0x94a3('0x18')](_0x2cc6f7,_0x3bda03);var _0x4357be=path[_0x94a3('0x18')](_0x2cc6f7,_0x4642d4);if(fs['existsSync'](_0x10c9ab)){_0x1bfea9[_0x94a3('0x19')]=_0x94a3('0x1a');_0x23192a[_0x94a3('0x1b')][_0x94a3('0x1c')]=[{'filename':_0x3bda03,'path':_0x10c9ab}];_0x23192a[_0x94a3('0x1b')][_0x94a3('0x1d')]=util[_0x94a3('0xc')](_0x94a3('0x1e'),JSON[_0x94a3('0x1f')](_0x1bfea9,null,0x2));}else if(fs[_0x94a3('0x20')](_0x4357be)){_0x1bfea9[_0x94a3('0x19')]=_0x94a3('0x1a');_0x23192a[_0x94a3('0x1b')][_0x94a3('0x1c')]=[{'filename':_0x4642d4,'path':_0x4357be}];}else{_0x23192a[_0x94a3('0x1b')][_0x94a3('0x1d')]=_0x94a3('0x21');if(!_0x48e86a[_0x94a3('0x22')]){_0x52e15d=![];logger[_0x94a3('0x23')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x52e15d){return client['request'](_0x94a3('0x24'),_0x23192a)[_0x94a3('0x25')](function(_0x5be8f1){if(_0x5be8f1['error']){return logger[_0x94a3('0x26')](_0x94a3('0x27'),JSON[_0x94a3('0x1f')](_0x5be8f1));}return logger[_0x94a3('0x23')]('email\x20sent');})[_0x94a3('0x28')](function(_0x58cbf6){return logger[_0x94a3('0x26')]('error\x20mail',JSON[_0x94a3('0x1f')](_0x58cbf6));});}};}function handleError(){return function(_0xd72016){return logger[_0x94a3('0x26')](JSON[_0x94a3('0x1f')](_0xd72016));};}function handleResult(_0x16702a){return function(_0x452fc6){logger[_0x94a3('0x23')](_0x94a3('0x29'),JSON[_0x94a3('0x1f')](_0x452fc6));if(_0x16702a[_0x94a3('0xb')]&&_0x16702a[_0x94a3('0xb')][_0x94a3('0xe')]&&!_[_0x94a3('0x2a')](_0x16702a[_0x94a3('0xa')])){setTimeout(handleSendEmail(_0x16702a,_0x452fc6),0x3c*0x3e8);}};}function handleJob(_0xa4f9c3){return function(){try{if(_[_0x94a3('0x2a')](_0xa4f9c3[_0x94a3('0x11')])){return logger[_0x94a3('0x23')]('subtractNumber\x20null\x20or\x20undefined');}if(_['isNil'](_0xa4f9c3[_0x94a3('0x12')])){return logger[_0x94a3('0x23')](_0x94a3('0x2b'));}var _0x3849b7={'startDate':moment()['subtract'](_0xa4f9c3[_0x94a3('0x11')],_0xa4f9c3[_0x94a3('0x12')])[_0x94a3('0xc')](_0x94a3('0x2c')),'endDate':moment()[_0x94a3('0xc')](_0x94a3('0x2c')),'type':_0x94a3('0x2d'),'output':_0xa4f9c3[_0x94a3('0x2e')],'name':_0xa4f9c3[_0x94a3('0x10')]};if(!_[_0x94a3('0x2a')](_0xa4f9c3['DefaultReportId'])){logger[_0x94a3('0x23')](_0x94a3('0x2f'),_0xa4f9c3[_0x94a3('0x30')]);return analyticDefaultReportController[_0x94a3('0x31')]({'id':_0xa4f9c3[_0x94a3('0x30')]},_0x3849b7)[_0x94a3('0x25')](handleResult(_0xa4f9c3))[_0x94a3('0x28')](handleError());}if(!_[_0x94a3('0x2a')](_0xa4f9c3[_0x94a3('0x32')])){logger['info'](_0x94a3('0x33'),_0xa4f9c3[_0x94a3('0x32')]);return analyticCustomReportController[_0x94a3('0x31')]({'id':_0xa4f9c3['CustomReportId']},_0x3849b7)[_0x94a3('0x25')](handleResult(_0xa4f9c3))[_0x94a3('0x28')](handleError());}}catch(_0xbb328f){logger[_0x94a3('0x26')](JSON['stringify'](_0xbb328f));}return logger['info']('no\x20report\x20id');};}function getJobs(_0x3b38ab){var _0x3fddb5={};if(_0x3b38ab){_0x3fddb5['id']=_0x3b38ab;}return db[_0x94a3('0x34')][_0x94a3('0x35')]({'where':_0x3fddb5,'include':[{'model':db[_0x94a3('0xb')],'attributes':['id','name',_0x94a3('0xa')],'include':[{'model':db[_0x94a3('0x36')],'as':_0x94a3('0xe'),'include':[{'model':db['CloudProvider'],'as':_0x94a3('0x37')}]}]}]})[_0x94a3('0x25')](function(_0x2e5ab4){var _0x3c7807=_[_0x94a3('0x38')](manager[_0x94a3('0x39')]);var _0x17e0c7=_[_0x94a3('0x3a')](_0x2e5ab4,function(_0x21913f){return _0x21913f['id'][_0x94a3('0x3b')]();});var _0x1e1cfe=_[_0x94a3('0x3c')](_0x2e5ab4,function(_0x17ebc8){return _0x17ebc8['id'][_0x94a3('0x3b')]();});var _0x21afb2=_0x3b38ab?_0x17e0c7:_[_0x94a3('0x3d')](_0x17e0c7,_0x3c7807);var _0x3912f2=_[_0x94a3('0x3e')](_0x17e0c7,_0x3c7807);var _0x35282a=_[_0x94a3('0x3d')](_0x3c7807,_0x17e0c7);var _0x57da80;var _0x4fb6d3;for(_0x57da80=0x0;_0x57da80<_0x35282a[_0x94a3('0x3f')]&&!_0x3b38ab;_0x57da80+=0x1){_0x4fb6d3=_0x35282a[_0x57da80][_0x94a3('0x3b')]();if(manager[_0x94a3('0x40')](_0x4fb6d3)){manager[_0x94a3('0x41')](_0x4fb6d3);manager[_0x94a3('0x42')](_0x4fb6d3);logger[_0x94a3('0x23')](_0x94a3('0x43'),_0x4fb6d3);}}logger['info'](_0x94a3('0x44'),JSON[_0x94a3('0x1f')](_0x21afb2));for(_0x57da80=0x0;_0x57da80<_0x21afb2[_0x94a3('0x3f')];_0x57da80+=0x1){_0x4fb6d3=_0x21afb2[_0x57da80][_0x94a3('0x3b')]();logger[_0x94a3('0x23')](_0x94a3('0x45'),_0x4fb6d3);if(_0x3b38ab){logger[_0x94a3('0x23')](_0x94a3('0x46'),_0x3b38ab);logger['info'](JSON[_0x94a3('0x1f')](_0x1e1cfe[_0x4fb6d3]));BPromise['resolve']()[_0x94a3('0x25')](handleJob(_0x1e1cfe[_0x4fb6d3]));logger['info']('run\x20job',_0x1e1cfe[_0x4fb6d3][_0x94a3('0x10')],_0x1e1cfe[_0x4fb6d3][_0x94a3('0x47')]);}else if(_0x1e1cfe[_0x4fb6d3][_0x94a3('0x47')]&&_0x1e1cfe[_0x4fb6d3][_0x94a3('0x48')]&&moment()[_0x94a3('0x49')](_0x1e1cfe[_0x4fb6d3]['startAt'],_0x1e1cfe[_0x4fb6d3][_0x94a3('0x4a')])){manager['add'](_0x4fb6d3,_0x1e1cfe[_0x4fb6d3]['cron'],handleJob(_0x1e1cfe[_0x4fb6d3]));manager[_0x94a3('0x4b')](_0x4fb6d3);logger['info']('add\x20cron',_0x1e1cfe[_0x4fb6d3]['name'],_0x1e1cfe[_0x4fb6d3][_0x94a3('0x47')]);}else if(manager['exists'](_0x4fb6d3)){manager[_0x94a3('0x41')](_0x4fb6d3);manager['deleteJob'](_0x4fb6d3);logger[_0x94a3('0x23')](_0x94a3('0x4c'),_0x1e1cfe[_0x4fb6d3][_0x94a3('0x10')],_0x1e1cfe[_0x4fb6d3]['cron']);}}for(_0x57da80=0x0,_0x4fb6d3;_0x57da80<_0x3912f2[_0x94a3('0x3f')]&&!_0x3b38ab;_0x57da80+=0x1){_0x4fb6d3=_0x3912f2[_0x57da80]['toString']();if(manager[_0x94a3('0x40')](_0x4fb6d3)){if(_0x1e1cfe[_0x4fb6d3]['cron']&&_0x1e1cfe[_0x4fb6d3][_0x94a3('0x48')]&&moment()[_0x94a3('0x49')](_0x1e1cfe[_0x4fb6d3][_0x94a3('0x4d')],_0x1e1cfe[_0x4fb6d3]['endAt'])){manager[_0x94a3('0x4e')](_0x4fb6d3,_0x1e1cfe[_0x4fb6d3][_0x94a3('0x47')],handleJob(_0x1e1cfe[_0x4fb6d3]));logger[_0x94a3('0x23')](_0x94a3('0x4f'),_0x1e1cfe[_0x4fb6d3]['name'],_0x1e1cfe[_0x4fb6d3]['cron']);}else{manager[_0x94a3('0x41')](_0x4fb6d3);manager[_0x94a3('0x42')](_0x4fb6d3);logger['info']('stop\x20cron',_0x1e1cfe[_0x4fb6d3][_0x94a3('0x10')],_0x1e1cfe[_0x4fb6d3]['cron']);}}}})[_0x94a3('0x28')](function(_0x5656c8){logger[_0x94a3('0x26')](JSON[_0x94a3('0x1f')](_0x5656c8));});}exports[_0x94a3('0x50')]=function(_0x326ce3){return getJobs(_0x326ce3);};exports[_0x94a3('0x4b')]=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 c162b93..00b4a6e 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 _0x2a84=['all','catch','start','lodash','aws-sdk','util','bluebird','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','data2','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','Negative','SentimentScore','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','resolve','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Mixed','COMPLETED','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','Transcribe\x20not\x20configured','transcribeAccountId','Cloud\x20Provider\x20not\x20configured','forEach','push'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x2a84,0x170));var _0x42a8=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2a84[_0x19e35c];return _0x3e1fe8;};var _=require(_0x42a8('0x0'));var AWS=require(_0x42a8('0x1'));var rp=require('request-promise');var util=require(_0x42a8('0x2'));var BPromise=require(_0x42a8('0x3'));var db=require(_0x42a8('0x4'))['db'];var logger=require('../../config/logger')(_0x42a8('0x5'));function getTranscriptionJob(_0x49dca9,_0xea116f,_0x1dc04a,_0x1b6a6a){return new Promise(function(_0x59505e,_0x593b3a){var _0x4b17b7=new AWS[(_0x42a8('0x6'))]({'accessKeyId':_0xea116f,'secretAccessKey':_0x49dca9,'region':_0x1dc04a});_0x4b17b7[_0x42a8('0x7')]({'TranscriptionJobName':_0x1b6a6a},function(_0x4ff8e0,_0x2aa872){if(_0x4ff8e0){return _0x593b3a(_0x4ff8e0);}else{return _0x59505e(_0x2aa872);}});});}function sentiment(_0x454118,_0x5b93ac,_0x40062e,_0x29fc29,_0x53048e){return new Promise(function(_0x127d12,_0x3467d4){var _0x7a340c=new AWS['Comprehend']({'accessKeyId':_0x5b93ac,'secretAccessKey':_0x454118,'region':_0x40062e});_0x7a340c['detectSentiment']({'Text':_0x29fc29,'LanguageCode':_0x53048e[_0x42a8('0x8')](0x0,0x2)},function(_0x54e4a5,_0x2cffd7){if(_0x54e4a5){return _0x3467d4(_0x54e4a5);}else{return _0x127d12(_0x2cffd7);}});});}function checkTranscribeJob(_0x52c0c3,_0x5441d7,_0x25dcb8){var _0x3133c4;return new BPromise(function(_0x449617,_0xb041a0){logger[_0x42a8('0x9')](util[_0x42a8('0xa')](_0x42a8('0xb'),_0x52c0c3['id'],_0x52c0c3[_0x42a8('0xc')]));return getTranscriptionJob(_0x25dcb8['data1'],_0x25dcb8['data2'],_0x5441d7[_0x42a8('0xd')],_0x52c0c3[_0x42a8('0xc')])[_0x42a8('0xe')](function(_0x542543){logger[_0x42a8('0x9')](util[_0x42a8('0xa')](_0x42a8('0xf'),_0x52c0c3['id'],_0x52c0c3[_0x42a8('0xc')],_0x542543[_0x42a8('0x10')][_0x42a8('0x11')]));if(!_0x52c0c3[_0x42a8('0x12')]){switch(_0x542543[_0x42a8('0x10')][_0x42a8('0x11')]){case'COMPLETED':var _0x509b0a={'transcribeStatus':_0x542543['TranscriptionJob'][_0x42a8('0x11')],'fileUri':_0x542543[_0x42a8('0x10')][_0x42a8('0x13')][_0x42a8('0x14')]};logger[_0x42a8('0x9')](util[_0x42a8('0xa')](_0x42a8('0x15'),_0x52c0c3['id']));return rp({'uri':_0x542543['TranscriptionJob'][_0x42a8('0x13')]['TranscriptFileUri'],'json':!![]})['then'](function(_0x58f83a){logger[_0x42a8('0x9')](util[_0x42a8('0xa')](_0x42a8('0x16'),_0x52c0c3['id']));if(_0x58f83a&&_0x58f83a['results']&&_0x58f83a[_0x42a8('0x17')]['transcripts']&&_0x58f83a['results'][_0x42a8('0x18')][_0x42a8('0x19')]){_0x509b0a[_0x42a8('0x12')]='';for(var _0xe6c44c=0x0;_0xe6c44c<_0x58f83a['results'][_0x42a8('0x18')]['length'];_0xe6c44c++){_0x509b0a[_0x42a8('0x12')]+=_0x58f83a[_0x42a8('0x17')][_0x42a8('0x18')][_0xe6c44c][_0x42a8('0x1a')]+'';}}return _0x52c0c3[_0x42a8('0x1b')](_0x509b0a);})[_0x42a8('0xe')](function(){logger['info'](util[_0x42a8('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x52c0c3['id']));if(!_0x52c0c3[_0x42a8('0x1c')]){throw new db['Sequelize'][(_0x42a8('0x1d'))](_0x42a8('0x1e'));}if(!_0x5441d7[_0x42a8('0x1f')]||!_0x5441d7[_0x42a8('0x20')]||!_0x5441d7[_0x42a8('0x21')]||!_0x5441d7[_0x42a8('0x22')]||!_0x5441d7[_0x42a8('0x23')]){throw new db[(_0x42a8('0x24'))][(_0x42a8('0x1d'))](_0x42a8('0x25'));}if(!_0x509b0a[_0x42a8('0x12')]){throw new Error(_0x42a8('0x26'));}if(_0x5441d7['sentimentAccountId']===_0x25dcb8['id']){return _0x25dcb8;}else{return db[_0x42a8('0x27')][_0x42a8('0x28')]({'where':{'id':_settings[_0x42a8('0x20')]}});}})[_0x42a8('0xe')](function(_0x85793d){if(!_0x85793d){throw new db[(_0x42a8('0x24'))][(_0x42a8('0x1d'))](_0x42a8('0x29'));}if(!_0x85793d[_0x42a8('0x2a')]||!_0x85793d[_0x42a8('0x2b')]){throw new db['Sequelize'][(_0x42a8('0x1d'))]('Cloud\x20Provider\x20not\x20configured');}_0x3133c4=_0x85793d;logger[_0x42a8('0x9')](util[_0x42a8('0xa')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x52c0c3['id']));return sentiment(_0x3133c4[_0x42a8('0x2a')],_0x3133c4[_0x42a8('0x2b')],_0x5441d7[_0x42a8('0x21')],_0x509b0a[_0x42a8('0x12')],_0x5441d7[_0x42a8('0x22')]);})['then'](function(_0x2a155e){logger[_0x42a8('0x9')](util['format'](_0x42a8('0x2c'),_0x52c0c3['id']));return _0x52c0c3[_0x42a8('0x1b')]({'sentiment':_0x2a155e[_0x42a8('0x2d')],'sPositive':_0x2a155e['SentimentScore'][_0x42a8('0x2e')],'sNegative':_0x2a155e['SentimentScore'][_0x42a8('0x2f')],'sMixed':_0x2a155e['SentimentScore']['Mixed'],'sNeutral':_0x2a155e[_0x42a8('0x30')][_0x42a8('0x31')]});})[_0x42a8('0xe')](function(){logger[_0x42a8('0x9')](util[_0x42a8('0xa')](_0x42a8('0x32'),_0x52c0c3['id']));_0x449617();});case _0x42a8('0x33'):return _0x52c0c3[_0x42a8('0x1b')]({'transcribeStatus':'FAILED','failureReason':_0x542543['TranscriptionJob'][_0x42a8('0x34')]})[_0x42a8('0xe')](function(){logger[_0x42a8('0x9')](util['format'](_0x42a8('0x32'),_0x52c0c3['id']));_0x449617();});default:logger[_0x42a8('0x9')](util[_0x42a8('0xa')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x52c0c3['id']));break;}}else{return BPromise[_0x42a8('0x35')]()[_0x42a8('0xe')](function(){if(!_0x52c0c3[_0x42a8('0x1c')]){throw new db[(_0x42a8('0x24'))][(_0x42a8('0x1d'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x5441d7[_0x42a8('0x1f')]||!_0x5441d7[_0x42a8('0x20')]||!_0x5441d7[_0x42a8('0x21')]||!_0x5441d7[_0x42a8('0x22')]||!_0x5441d7[_0x42a8('0x23')]){throw new db['Sequelize'][(_0x42a8('0x1d'))](_0x42a8('0x25'));}if(!_0x52c0c3[_0x42a8('0x12')]){throw new Error(_0x42a8('0x26'));}if(_0x5441d7[_0x42a8('0x20')]===_0x25dcb8['id']){return _0x25dcb8;}else{return db['CloudProvider'][_0x42a8('0x28')]({'where':{'id':_settings[_0x42a8('0x20')]}});}})[_0x42a8('0xe')](function(_0x2b8206){if(!_0x2b8206){throw new db[(_0x42a8('0x24'))][(_0x42a8('0x1d'))](_0x42a8('0x29'));}if(!_0x2b8206[_0x42a8('0x2a')]||!_0x2b8206['data2']){throw new db[(_0x42a8('0x24'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x3133c4=_0x2b8206;logger['info'](util['format'](_0x42a8('0x36'),_0x52c0c3['id']));return sentiment(_0x3133c4[_0x42a8('0x2a')],_0x3133c4['data2'],_0x5441d7[_0x42a8('0x21')],_0x52c0c3[_0x42a8('0x12')],_0x5441d7[_0x42a8('0x22')]);})[_0x42a8('0xe')](function(_0x51302c){logger[_0x42a8('0x9')](util[_0x42a8('0xa')](_0x42a8('0x2c'),_0x52c0c3['id']));return _0x52c0c3[_0x42a8('0x1b')]({'sentiment':_0x51302c[_0x42a8('0x2d')],'sPositive':_0x51302c['SentimentScore'][_0x42a8('0x2e')],'sNegative':_0x51302c[_0x42a8('0x30')][_0x42a8('0x2f')],'sMixed':_0x51302c[_0x42a8('0x30')][_0x42a8('0x37')],'sNeutral':_0x51302c[_0x42a8('0x30')]['Neutral'],'transcribeStatus':_0x42a8('0x38')});})['then'](function(){logger[_0x42a8('0x9')](util[_0x42a8('0xa')](_0x42a8('0x32'),_0x52c0c3['id']));_0x449617();});}})['catch'](function(_0x556a0f){if(_0x556a0f){if(!_0x556a0f[_0x42a8('0x39')]||_0x556a0f['name']!==_0x42a8('0x3a')){logger[_0x42a8('0x3b')](util[_0x42a8('0xa')](_0x42a8('0x3c'),_0x52c0c3['id']),util[_0x42a8('0x3d')](_0x556a0f,{'showHidden':![],'depth':null}));}}_0x449617();});});}function checkTranscribe(){var _0x285e64;var _0xc576f8;var _0x17aec8;return db[_0x42a8('0x3e')][_0x42a8('0x3f')]({'where':{'transcribeStatus':_0x42a8('0x40')}})[_0x42a8('0xe')](function(_0x5863ac){if(!_0x5863ac||!_0x5863ac['length']){throw new db[(_0x42a8('0x24'))]['ValidationError']('No\x20transcribe\x20job\x20to\x20check');}_0x285e64=_0x5863ac;return db['Setting'][_0x42a8('0x28')]({'where':{'id':0x1}});})[_0x42a8('0xe')](function(_0x5aae6b){if(!_0x5aae6b){throw new db[(_0x42a8('0x24'))][(_0x42a8('0x1d'))]('Settings\x20not\x20available');}_0xc576f8=_0x5aae6b;if(!_0xc576f8['transcribe']||!_0xc576f8['transcribeAccountId']||!_0xc576f8[_0x42a8('0xd')]||!_0xc576f8[_0x42a8('0x22')]||!_0xc576f8[_0x42a8('0x23')]){throw new db[(_0x42a8('0x24'))][(_0x42a8('0x1d'))](_0x42a8('0x41'));}return db[_0x42a8('0x27')][_0x42a8('0x28')]({'where':{'id':_0xc576f8[_0x42a8('0x42')]}});})[_0x42a8('0xe')](function(_0x142b12){if(!_0x142b12){throw new db['Sequelize']['ValidationError'](_0x42a8('0x29'));}if(!_0x142b12[_0x42a8('0x2a')]||!_0x142b12['data2']){throw new db[(_0x42a8('0x24'))][(_0x42a8('0x1d'))](_0x42a8('0x43'));}_0x17aec8=_0x142b12;var _0x2eeb0c=[];_0x285e64[_0x42a8('0x44')](function(_0x36db51){_0x2eeb0c[_0x42a8('0x45')](checkTranscribeJob(_0x36db51,_0xc576f8,_0x17aec8));});return BPromise[_0x42a8('0x46')](_0x2eeb0c);})[_0x42a8('0x47')](function(_0x2d3443){if(_0x2d3443){if(!_0x2d3443['name']||_0x2d3443[_0x42a8('0x39')]!=='SequelizeValidationError'){logger[_0x42a8('0x3b')](util[_0x42a8('0x3d')](_0x2d3443,{'showHidden':![],'depth':null}));}}});}exports[_0x42a8('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xe9f9=['Mixed','catch','name','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','all','SequelizeValidationError','lodash','request-promise','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','fileText','TranscriptionJob','TranscriptionJobStatus','COMPLETED','TranscriptFileUri','format','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Positive','SentimentScore','Neutral','FAILED','update','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','bucket','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Negative'];(function(_0x2a6acc,_0x506096){var _0x174af3=function(_0x2c06b7){while(--_0x2c06b7){_0x2a6acc['push'](_0x2a6acc['shift']());}};_0x174af3(++_0x506096);}(_0xe9f9,0x174));var _0x9e9f=function(_0x182394,_0xb04235){_0x182394=_0x182394-0x0;var _0x21159f=_0xe9f9[_0x182394];return _0x21159f;};var _=require(_0x9e9f('0x0'));var AWS=require('aws-sdk');var rp=require(_0x9e9f('0x1'));var util=require(_0x9e9f('0x2'));var BPromise=require(_0x9e9f('0x3'));var db=require(_0x9e9f('0x4'))['db'];var logger=require(_0x9e9f('0x5'))('transcribe');function getTranscriptionJob(_0x2020b3,_0x47f4c7,_0x372526,_0xde96fc){return new Promise(function(_0x549ea5,_0x32da7a){var _0x54f87c=new AWS[(_0x9e9f('0x6'))]({'accessKeyId':_0x47f4c7,'secretAccessKey':_0x2020b3,'region':_0x372526});_0x54f87c[_0x9e9f('0x7')]({'TranscriptionJobName':_0xde96fc},function(_0x10d43b,_0x5256b3){if(_0x10d43b){return _0x32da7a(_0x10d43b);}else{return _0x549ea5(_0x5256b3);}});});}function sentiment(_0x1170bb,_0x3a4291,_0x2e1e8e,_0x29aebc,_0xa837dd){return new Promise(function(_0x140b9b,_0x54a20a){var _0x18faca=new AWS[(_0x9e9f('0x8'))]({'accessKeyId':_0x3a4291,'secretAccessKey':_0x1170bb,'region':_0x2e1e8e});_0x18faca[_0x9e9f('0x9')]({'Text':_0x29aebc,'LanguageCode':_0xa837dd['substring'](0x0,0x2)},function(_0x3db1c7,_0x1997f5){if(_0x3db1c7){return _0x54a20a(_0x3db1c7);}else{return _0x140b9b(_0x1997f5);}});});}function checkTranscribeJob(_0x38aaf8,_0x43603d,_0x1320b2){var _0x35a622;return new BPromise(function(_0x52c423,_0x35e630){logger[_0x9e9f('0xa')](util['format']('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x38aaf8['id'],_0x38aaf8[_0x9e9f('0xb')]));return getTranscriptionJob(_0x1320b2[_0x9e9f('0xc')],_0x1320b2[_0x9e9f('0xd')],_0x43603d[_0x9e9f('0xe')],_0x38aaf8[_0x9e9f('0xb')])[_0x9e9f('0xf')](function(_0x4c5d54){logger[_0x9e9f('0xa')](util['format'](_0x9e9f('0x10'),_0x38aaf8['id'],_0x38aaf8['transcribeName'],_0x4c5d54['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x38aaf8[_0x9e9f('0x11')]){switch(_0x4c5d54[_0x9e9f('0x12')][_0x9e9f('0x13')]){case _0x9e9f('0x14'):var _0x4d3a5f={'transcribeStatus':_0x4c5d54[_0x9e9f('0x12')][_0x9e9f('0x13')],'fileUri':_0x4c5d54[_0x9e9f('0x12')]['Transcript'][_0x9e9f('0x15')]};logger[_0x9e9f('0xa')](util[_0x9e9f('0x16')](_0x9e9f('0x17'),_0x38aaf8['id']));return rp({'uri':_0x4c5d54['TranscriptionJob']['Transcript'][_0x9e9f('0x15')],'json':!![]})[_0x9e9f('0xf')](function(_0x54f288){logger[_0x9e9f('0xa')](util[_0x9e9f('0x16')](_0x9e9f('0x18'),_0x38aaf8['id']));if(_0x54f288&&_0x54f288[_0x9e9f('0x19')]&&_0x54f288['results'][_0x9e9f('0x1a')]&&_0x54f288[_0x9e9f('0x19')]['transcripts']['length']){_0x4d3a5f[_0x9e9f('0x11')]='';for(var _0x2ea441=0x0;_0x2ea441<_0x54f288['results'][_0x9e9f('0x1a')][_0x9e9f('0x1b')];_0x2ea441++){_0x4d3a5f['fileText']+=_0x54f288[_0x9e9f('0x19')][_0x9e9f('0x1a')][_0x2ea441]['transcript']+'';}}return _0x38aaf8['update'](_0x4d3a5f);})[_0x9e9f('0xf')](function(){logger[_0x9e9f('0xa')](util[_0x9e9f('0x16')](_0x9e9f('0x1c'),_0x38aaf8['id']));if(!_0x38aaf8['tempSentiment']){throw new db[(_0x9e9f('0x1d'))][(_0x9e9f('0x1e'))](_0x9e9f('0x1f'));}if(!_0x43603d['sentiment']||!_0x43603d[_0x9e9f('0x20')]||!_0x43603d[_0x9e9f('0x21')]||!_0x43603d[_0x9e9f('0x22')]||!_0x43603d['bucket']){throw new db[(_0x9e9f('0x1d'))][(_0x9e9f('0x1e'))](_0x9e9f('0x23'));}if(!_0x4d3a5f[_0x9e9f('0x11')]){throw new Error(_0x9e9f('0x24'));}if(_0x43603d[_0x9e9f('0x20')]===_0x1320b2['id']){return _0x1320b2;}else{return db[_0x9e9f('0x25')][_0x9e9f('0x26')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x9e9f('0xf')](function(_0x1a46d3){if(!_0x1a46d3){throw new db[(_0x9e9f('0x1d'))][(_0x9e9f('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x1a46d3[_0x9e9f('0xc')]||!_0x1a46d3[_0x9e9f('0xd')]){throw new db[(_0x9e9f('0x1d'))][(_0x9e9f('0x1e'))](_0x9e9f('0x27'));}_0x35a622=_0x1a46d3;logger[_0x9e9f('0xa')](util[_0x9e9f('0x16')](_0x9e9f('0x28'),_0x38aaf8['id']));return sentiment(_0x35a622[_0x9e9f('0xc')],_0x35a622[_0x9e9f('0xd')],_0x43603d[_0x9e9f('0x21')],_0x4d3a5f[_0x9e9f('0x11')],_0x43603d[_0x9e9f('0x22')]);})[_0x9e9f('0xf')](function(_0x41b153){logger[_0x9e9f('0xa')](util[_0x9e9f('0x16')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x38aaf8['id']));return _0x38aaf8['update']({'sentiment':_0x41b153['Sentiment'],'sPositive':_0x41b153['SentimentScore'][_0x9e9f('0x29')],'sNegative':_0x41b153[_0x9e9f('0x2a')]['Negative'],'sMixed':_0x41b153[_0x9e9f('0x2a')]['Mixed'],'sNeutral':_0x41b153[_0x9e9f('0x2a')][_0x9e9f('0x2b')]});})[_0x9e9f('0xf')](function(){logger[_0x9e9f('0xa')](util[_0x9e9f('0x16')](_0x9e9f('0x1c'),_0x38aaf8['id']));_0x52c423();});case _0x9e9f('0x2c'):return _0x38aaf8[_0x9e9f('0x2d')]({'transcribeStatus':_0x9e9f('0x2c'),'failureReason':_0x4c5d54[_0x9e9f('0x12')][_0x9e9f('0x2e')]})[_0x9e9f('0xf')](function(){logger[_0x9e9f('0xa')](util[_0x9e9f('0x16')](_0x9e9f('0x1c'),_0x38aaf8['id']));_0x52c423();});default:logger[_0x9e9f('0xa')](util[_0x9e9f('0x16')](_0x9e9f('0x2f'),_0x38aaf8['id']));break;}}else{return BPromise[_0x9e9f('0x30')]()[_0x9e9f('0xf')](function(){if(!_0x38aaf8['tempSentiment']){throw new db[(_0x9e9f('0x1d'))][(_0x9e9f('0x1e'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x43603d[_0x9e9f('0x31')]||!_0x43603d[_0x9e9f('0x20')]||!_0x43603d[_0x9e9f('0x21')]||!_0x43603d[_0x9e9f('0x22')]||!_0x43603d[_0x9e9f('0x32')]){throw new db['Sequelize']['ValidationError'](_0x9e9f('0x23'));}if(!_0x38aaf8['fileText']){throw new Error(_0x9e9f('0x24'));}if(_0x43603d[_0x9e9f('0x20')]===_0x1320b2['id']){return _0x1320b2;}else{return db[_0x9e9f('0x25')]['findOne']({'where':{'id':_settings[_0x9e9f('0x20')]}});}})['then'](function(_0x3f4fb9){if(!_0x3f4fb9){throw new db[(_0x9e9f('0x1d'))][(_0x9e9f('0x1e'))](_0x9e9f('0x33'));}if(!_0x3f4fb9[_0x9e9f('0xc')]||!_0x3f4fb9[_0x9e9f('0xd')]){throw new db[(_0x9e9f('0x1d'))][(_0x9e9f('0x1e'))](_0x9e9f('0x27'));}_0x35a622=_0x3f4fb9;logger['info'](util[_0x9e9f('0x16')](_0x9e9f('0x28'),_0x38aaf8['id']));return sentiment(_0x35a622[_0x9e9f('0xc')],_0x35a622[_0x9e9f('0xd')],_0x43603d['sentimentRegion'],_0x38aaf8['fileText'],_0x43603d[_0x9e9f('0x22')]);})['then'](function(_0x4ef460){logger[_0x9e9f('0xa')](util['format'](_0x9e9f('0x34'),_0x38aaf8['id']));return _0x38aaf8[_0x9e9f('0x2d')]({'sentiment':_0x4ef460['Sentiment'],'sPositive':_0x4ef460[_0x9e9f('0x2a')]['Positive'],'sNegative':_0x4ef460[_0x9e9f('0x2a')][_0x9e9f('0x35')],'sMixed':_0x4ef460[_0x9e9f('0x2a')][_0x9e9f('0x36')],'sNeutral':_0x4ef460[_0x9e9f('0x2a')]['Neutral'],'transcribeStatus':_0x9e9f('0x14')});})[_0x9e9f('0xf')](function(){logger[_0x9e9f('0xa')](util[_0x9e9f('0x16')](_0x9e9f('0x1c'),_0x38aaf8['id']));_0x52c423();});}})[_0x9e9f('0x37')](function(_0x3889ff){if(_0x3889ff){if(!_0x3889ff[_0x9e9f('0x38')]||_0x3889ff[_0x9e9f('0x38')]!=='SequelizeValidationError'){logger['error'](util[_0x9e9f('0x16')](_0x9e9f('0x39'),_0x38aaf8['id']),util['inspect'](_0x3889ff,{'showHidden':![],'depth':null}));}}_0x52c423();});});}function checkTranscribe(){var _0x2c9ada;var _0x44e631;var _0x22bec9;return db[_0x9e9f('0x3a')][_0x9e9f('0x3b')]({'where':{'transcribeStatus':_0x9e9f('0x3c')}})[_0x9e9f('0xf')](function(_0x304dff){if(!_0x304dff||!_0x304dff[_0x9e9f('0x1b')]){throw new db['Sequelize']['ValidationError'](_0x9e9f('0x3d'));}_0x2c9ada=_0x304dff;return db[_0x9e9f('0x3e')][_0x9e9f('0x26')]({'where':{'id':0x1}});})[_0x9e9f('0xf')](function(_0x37dbd6){if(!_0x37dbd6){throw new db['Sequelize'][(_0x9e9f('0x1e'))](_0x9e9f('0x3f'));}_0x44e631=_0x37dbd6;if(!_0x44e631[_0x9e9f('0x40')]||!_0x44e631['transcribeAccountId']||!_0x44e631[_0x9e9f('0xe')]||!_0x44e631['language']||!_0x44e631[_0x9e9f('0x32')]){throw new db[(_0x9e9f('0x1d'))]['ValidationError'](_0x9e9f('0x41'));}return db['CloudProvider']['findOne']({'where':{'id':_0x44e631[_0x9e9f('0x42')]}});})['then'](function(_0x1b41ef){if(!_0x1b41ef){throw new db[(_0x9e9f('0x1d'))][(_0x9e9f('0x1e'))](_0x9e9f('0x33'));}if(!_0x1b41ef['data1']||!_0x1b41ef[_0x9e9f('0xd')]){throw new db[(_0x9e9f('0x1d'))][(_0x9e9f('0x1e'))]('Cloud\x20Provider\x20not\x20configured');}_0x22bec9=_0x1b41ef;var _0x57cba8=[];_0x2c9ada[_0x9e9f('0x43')](function(_0x43592e){_0x57cba8[_0x9e9f('0x44')](checkTranscribeJob(_0x43592e,_0x44e631,_0x22bec9));});return BPromise[_0x9e9f('0x45')](_0x57cba8);})[_0x9e9f('0x37')](function(_0x7fae40){if(_0x7fae40){if(!_0x7fae40[_0x9e9f('0x38')]||_0x7fae40[_0x9e9f('0x38')]!==_0x9e9f('0x46')){logger['error'](util['inspect'](_0x7fae40,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index b36dfe3..cf538c3 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 _0xcb1a=['localhost','socket.io-emitter','WhatsappInteraction','findAll','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','timeout','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../logger','redis','defaults'];(function(_0x5724e6,_0xa6ee67){var _0x4ccb15=function(_0x48a8c2){while(--_0x48a8c2){_0x5724e6['push'](_0x5724e6['shift']());}};_0x4ccb15(++_0xa6ee67);}(_0xcb1a,0xb6));var _0xacb1=function(_0x53568f,_0x4bfd1d){_0x53568f=_0x53568f-0x0;var _0x253f12=_0xcb1a[_0x53568f];return _0x253f12;};'use strict';var _=require(_0xacb1('0x0'));var moment=require(_0xacb1('0x1'));var Redis=require(_0xacb1('0x2'));var util=require(_0xacb1('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0xacb1('0x4'))('schedule');config[_0xacb1('0x5')]=_[_0xacb1('0x6')](config['redis'],{'host':_0xacb1('0x7'),'port':0x18eb});var io=require(_0xacb1('0x8'))(new Redis(config[_0xacb1('0x5')]));function closeInteractions(){var _0x317779=[];return db[_0xacb1('0x9')][_0xacb1('0xa')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xacb1('0xb')](0x18,_0xacb1('0xc'))}}})[_0xacb1('0xd')](function(_0x1492f3){if(_0x1492f3&&_0x1492f3[_0xacb1('0xe')]){_0x317779=_[_0xacb1('0xf')](_0x1492f3||[],'id');logger[_0xacb1('0x10')](_0xacb1('0x11'),_0x317779[_0xacb1('0x12')]());return db[_0xacb1('0x9')][_0xacb1('0x13')]({'closeReason':'system','disposition':_0xacb1('0x14'),'closed':!![],'closedAt':moment()[_0xacb1('0x15')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x317779}});}})['then'](function(){if(_0x317779&&_0x317779[_0xacb1('0xe')]){logger[_0xacb1('0x10')](_0xacb1('0x16'),_0x317779[_0xacb1('0x12')]());for(var _0x3842b5=0x0;_0x3842b5<_0x317779[_0xacb1('0xe')];_0x3842b5++){io['emit'](_0xacb1('0x17'),{'id':_0x317779[_0x3842b5],'closed':!![]});}}})['catch'](function(_0x312155){logger[_0xacb1('0x18')](_0xacb1('0x19'),_0x312155?util[_0xacb1('0x1a')](_0x312155,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x7ba5=['subtract','hours','then','map','info','join','update','YYYY-MM-DD\x20HH:mm:ss','length','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt'];(function(_0xaedeb3,_0x401116){var _0x37e946=function(_0x354fe0){while(--_0x354fe0){_0xaedeb3['push'](_0xaedeb3['shift']());}};_0x37e946(++_0x401116);}(_0x7ba5,0xff));var _0x57ba=function(_0x3ada90,_0x5cf120){_0x3ada90=_0x3ada90-0x0;var _0x44481f=_0x7ba5[_0x3ada90];return _0x44481f;};'use strict';var _=require(_0x57ba('0x0'));var moment=require(_0x57ba('0x1'));var Redis=require(_0x57ba('0x2'));var util=require(_0x57ba('0x3'));var config=require(_0x57ba('0x4'));var db=require(_0x57ba('0x5'))['db'];var logger=require(_0x57ba('0x6'))(_0x57ba('0x7'));config[_0x57ba('0x8')]=_[_0x57ba('0x9')](config[_0x57ba('0x8')],{'host':_0x57ba('0xa'),'port':0x18eb});var io=require(_0x57ba('0xb'))(new Redis(config[_0x57ba('0x8')]));function closeInteractions(){var _0x4f678a=[];return db[_0x57ba('0xc')][_0x57ba('0xd')]({'raw':!![],'attributes':['id',_0x57ba('0xe')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x57ba('0xf')](0x18,_0x57ba('0x10'))}}})[_0x57ba('0x11')](function(_0x552c44){if(_0x552c44&&_0x552c44['length']){_0x4f678a=_[_0x57ba('0x12')](_0x552c44||[],'id');logger[_0x57ba('0x13')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x4f678a[_0x57ba('0x14')]());return db[_0x57ba('0xc')][_0x57ba('0x15')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x57ba('0x16'))},{'where':{'id':_0x4f678a}});}})[_0x57ba('0x11')](function(){if(_0x4f678a&&_0x4f678a[_0x57ba('0x17')]){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x4f678a['join']());for(var _0x4a1f15=0x0;_0x4a1f15<_0x4f678a[_0x57ba('0x17')];_0x4a1f15++){io['emit'](_0x57ba('0x18'),{'id':_0x4f678a[_0x4a1f15],'closed':!![]});}}})[_0x57ba('0x19')](function(_0xa65a06){logger[_0x57ba('0x1a')](_0x57ba('0x1b'),_0xa65a06?util[_0x57ba('0x1c')](_0xa65a06,{'showHidden':![],'depth':null}):'');});}exports[_0x57ba('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 5a90871..be50b72 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb55c=['util','push','Innocenzo','Biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','contacts1','log','finished\x20populating','hopper1','contacts2','CmHopper','hopper2','catch'];(function(_0x2732c0,_0x5adcf1){var _0x3bef7e=function(_0x16a38d){while(--_0x16a38d){_0x2732c0['push'](_0x2732c0['shift']());}};_0x3bef7e(++_0x5adcf1);}(_0xb55c,0x156));var _0xcb55=function(_0xaebd08,_0x1bd66b){_0xaebd08=_0xaebd08-0x0;var _0x1642fa=_0xb55c[_0xaebd08];return _0x1642fa;};'use strict';var util=require(_0xcb55('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xcb55('0x1')]({'id':i,'firstName':_0xcb55('0x2')+i,'lastName':_0xcb55('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xcb55('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xcb55('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xcb55('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xcb55('0x1')]({'id':i,'firstName':_0xcb55('0x2')+i,'lastName':_0xcb55('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xcb55('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xcb55('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xcb55('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xcb55('0x5')]()});}db[_0xcb55('0x6')][_0xcb55('0x7')]({'where':{}})[_0xcb55('0x8')](function(){return db[_0xcb55('0x6')][_0xcb55('0x9')](contacts);})['then'](function(){console['log']('finished\x20populating',_0xcb55('0xa'));return db['CmHopper'][_0xcb55('0x7')]({'where':{}});})[_0xcb55('0x8')](function(){return db['CmHopper'][_0xcb55('0x9')](hopper);})['then'](function(){console[_0xcb55('0xb')](_0xcb55('0xc'),_0xcb55('0xd'));return db[_0xcb55('0x6')][_0xcb55('0x9')](contacts2);})[_0xcb55('0x8')](function(){console[_0xcb55('0xb')](_0xcb55('0xc'),_0xcb55('0xe'));return db[_0xcb55('0xf')][_0xcb55('0x9')](hopper2);})['then'](function(){console[_0xcb55('0xb')]('finished\x20populating',_0xcb55('0x10'));})[_0xcb55('0x11')](function(_0x1c769e){console[_0xcb55('0xb')](_0x1c769e);}); \ No newline at end of file +var _0xb19b=['log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','util','../mysqldb','push','Innocenzo','innocenzo.biondo','@xcally.com','now','Biondo','CmContact','destroy','then','bulkCreate'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xb19b,0x1a9));var _0xbb19=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb19b[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xbb19('0x0'));var db=require(_0xbb19('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xbb19('0x2')]({'id':i,'firstName':_0xbb19('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xbb19('0x4')+i+_0xbb19('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xbb19('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xbb19('0x6')](),'updatedAt':Date[_0xbb19('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xbb19('0x7')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xbb19('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xbb19('0x6')](),'updatedAt':Date[_0xbb19('0x6')]()});}db[_0xbb19('0x8')][_0xbb19('0x9')]({'where':{}})[_0xbb19('0xa')](function(){return db[_0xbb19('0x8')][_0xbb19('0xb')](contacts);})[_0xbb19('0xa')](function(){console[_0xbb19('0xc')](_0xbb19('0xd'),_0xbb19('0xe'));return db[_0xbb19('0xf')][_0xbb19('0x9')]({'where':{}});})[_0xbb19('0xa')](function(){return db[_0xbb19('0xf')][_0xbb19('0xb')](hopper);})[_0xbb19('0xa')](function(){console[_0xbb19('0xc')](_0xbb19('0xd'),_0xbb19('0x10'));return db['CmContact'][_0xbb19('0xb')](contacts2);})[_0xbb19('0xa')](function(){console[_0xbb19('0xc')](_0xbb19('0xd'),_0xbb19('0x11'));return db[_0xbb19('0xf')][_0xbb19('0xb')](hopper2);})[_0xbb19('0xa')](function(){console['log'](_0xbb19('0xd'),_0xbb19('0x12'));})['catch'](function(_0x3a07a9){console['log'](_0x3a07a9);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 15320ee..10b8f28 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7687=['password','friend','udp','yes','/etc/pki/tls/certs/motion.crt','actpass','bulkCreate','then','log','add\x20user','catch','util','agent','format','%s%s','%s%s@xcally.com'];(function(_0x1dded0,_0x5de392){var _0xf00e9e=function(_0x221aee){while(--_0x221aee){_0x1dded0['push'](_0x1dded0['shift']());}};_0xf00e9e(++_0x5de392);}(_0x7687,0x17b));var _0x7768=function(_0x23b85e,_0x39b209){_0x23b85e=_0x23b85e-0x0;var _0x329756=_0x7687[_0x23b85e];return _0x329756;};'use strict';var util=require(_0x7768('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format']('%s%s',_0x7768('0x1'),i),'fullname':util[_0x7768('0x2')](_0x7768('0x3'),_0x7768('0x1'),i),'email':util[_0x7768('0x2')](_0x7768('0x4'),_0x7768('0x1'),i),'role':_0x7768('0x1'),'password':_0x7768('0x5'),'internal':0xfa0+i,'type':_0x7768('0x6'),'transport':[_0x7768('0x7'),'ws','wss'],'disallow':['all'],'allow':['ulaw'],'defaultuser':util[_0x7768('0x2')](_0x7768('0x3'),_0x7768('0x1'),i),'encryption':_0x7768('0x8'),'avpf':'yes','force_avp':_0x7768('0x8'),'icesupport':_0x7768('0x8'),'dtlsenable':_0x7768('0x8'),'dtlsverify':'no','dtlscertfile':_0x7768('0x9'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x7768('0xa'),'callerid':util['format']('\x22%s\x22\x20<%s>',util['format'](_0x7768('0x3'),_0x7768('0x1'),i),0xfa0+i)});}db['User'][_0x7768('0xb')](users)[_0x7768('0xc')](function(){console[_0x7768('0xd')](_0x7768('0xe'));})[_0x7768('0xf')](function(_0x5db302){console['log'](_0x5db302);}); \ No newline at end of file +var _0x8ac5=['all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','bulkCreate','then','catch','log','util','../mysqldb','push','format','%s%s','%s%s@xcally.com','agent','password','friend','wss'];(function(_0x41460b,_0x624464){var _0xa0d9ed=function(_0x39f1dd){while(--_0x39f1dd){_0x41460b['push'](_0x41460b['shift']());}};_0xa0d9ed(++_0x624464);}(_0x8ac5,0x1ea));var _0x58ac=function(_0x18a580,_0x2d6228){_0x18a580=_0x18a580-0x0;var _0xcdd691=_0x8ac5[_0x18a580];return _0xcdd691;};'use strict';var util=require(_0x58ac('0x0'));var db=require(_0x58ac('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x58ac('0x2')]({'name':util[_0x58ac('0x3')]('%s%s','agent',i),'fullname':util[_0x58ac('0x3')](_0x58ac('0x4'),'agent',i),'email':util[_0x58ac('0x3')](_0x58ac('0x5'),_0x58ac('0x6'),i),'role':_0x58ac('0x6'),'password':_0x58ac('0x7'),'internal':0xfa0+i,'type':_0x58ac('0x8'),'transport':['udp','ws',_0x58ac('0x9')],'disallow':[_0x58ac('0xa')],'allow':['ulaw'],'defaultuser':util['format'](_0x58ac('0x4'),_0x58ac('0x6'),i),'encryption':_0x58ac('0xb'),'avpf':_0x58ac('0xb'),'force_avp':_0x58ac('0xb'),'icesupport':'yes','dtlsenable':_0x58ac('0xb'),'dtlsverify':'no','dtlscertfile':_0x58ac('0xc'),'dtlsprivatekey':_0x58ac('0xd'),'dtlssetup':'actpass','callerid':util[_0x58ac('0x3')](_0x58ac('0xe'),util[_0x58ac('0x3')](_0x58ac('0x4'),_0x58ac('0x6'),i),0xfa0+i)});}db[_0x58ac('0xf')][_0x58ac('0x10')](users)[_0x58ac('0x11')](function(){console['log']('add\x20user');})[_0x58ac('0x12')](function(_0x376c3a){console[_0x58ac('0x13')](_0x376c3a);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 3e52cd7..8518c3c 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6fc2=['./environment','name','role','agent','telephone','type','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','User','Campaign','where','ivr','Agents','format','user:%s','handshake','find','userProfileId','query','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','hasOwnProperty','include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:inbound','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','chat','sms','mail','openchannel','trunk:%s','leave','removeChatInteractions','emit','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','log','connection','address','request','remotePort','connectedAt','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird'];(function(_0x5f5646,_0x2ef59b){var _0x343f8a=function(_0x261123){while(--_0x261123){_0x5f5646['push'](_0x5f5646['shift']());}};_0x343f8a(++_0x2ef59b);}(_0x6fc2,0x117));var _0x26fc=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x6fc2[_0x42bdad];return _0x122626;};'use strict';var _=require(_0x26fc('0x0'));var util=require(_0x26fc('0x1'));var BPromise=require(_0x26fc('0x2'));var db=require('../mysqldb')['db'];var config=require(_0x26fc('0x3'));var queryQueues={'attributes':['id',_0x26fc('0x4')],'include':[{'as':'Agents','model':db['User'],'attributes':['id','name',_0x26fc('0x5')],'raw':!![],'where':{'role':_0x26fc('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x26fc('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x26fc('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x26fc('0x4')],'where':{'role':_0x26fc('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x26fc('0x8')],'where':{'type':'ivr'}};function getAssociatedResources(_0x5a452d,_0x1d9522,_0x2ea728){return db[_0x26fc('0x9')]['findOne']({'where':{'name':_0x5a452d,'userProfileId':_0x1d9522},'raw':!![]})[_0x26fc('0xa')](function(_0xe22d78){if(_0xe22d78){if(_0xe22d78[_0x26fc('0xb')]){switch(_0x5a452d){case _0x26fc('0xc'):case _0x26fc('0xd'):case _0x26fc('0xe'):case _0x26fc('0xf'):case _0x26fc('0x10'):case _0x26fc('0x11'):case _0x26fc('0x12'):return db[_0x2ea728][_0x26fc('0x13')](queryQueues);case _0x26fc('0x14'):return db[_0x2ea728][_0x26fc('0x13')](queryTelephones);case _0x26fc('0x15'):return db[_0x2ea728][_0x26fc('0x13')](queryTrunks);case _0x26fc('0x16'):return db[_0x2ea728]['findAll'](queryCampaigns);}}else{return db[_0x26fc('0x17')][_0x26fc('0x13')]({'attributes':[_0x26fc('0x18')],'where':{'sectionId':_0xe22d78['id']},'raw':!![]})[_0x26fc('0xa')](function(_0x41d50a){if(_0x41d50a){var _0x29afb9={'where':{'id':_[_0x26fc('0x19')](_0x41d50a,_0x26fc('0x18'))},'raw':!![]};switch(_0x2ea728){case _0x26fc('0x1a'):_0x29afb9['where'][_0x26fc('0x5')]='telephone';break;case _0x26fc('0x1b'):_0x29afb9[_0x26fc('0x1c')][_0x26fc('0x8')]=_0x26fc('0x1d');break;}return db[_0x2ea728]['findAll'](_0x29afb9);}else{return[];}});}}else{return[];}})[_0x26fc('0xa')](function(_0x2d7e32){return _0x2d7e32;});}function joinOrLeaveQueues(_0x1c00ae,_0x9a9c2,_0xa0ca4f,_0x5f454f){_0x1c00ae[_0x9a9c2](util['format']('%s:queue:%s',_0xa0ca4f,_0x5f454f['name']));if(_0x5f454f['Agents']){for(var _0x4fa549=0x0;_0x4fa549<_0x5f454f[_0x26fc('0x1e')]['length'];_0x4fa549+=0x1){_0x1c00ae[_0x9a9c2](util[_0x26fc('0x1f')](_0x26fc('0x20'),_0x5f454f['Agents'][_0x4fa549][_0x26fc('0x4')]));}}}function joinOrLeave(_0x288c8d,_0x12a7ca,_0x1641f2){var _0x2738ee;if(_0x288c8d[_0x26fc('0x21')]['query']['id']){db[_0x26fc('0x1a')][_0x26fc('0x22')]({'attributes':['id',_0x26fc('0x4'),_0x26fc('0x5'),_0x26fc('0x23')],'where':{'id':_0x288c8d[_0x26fc('0x21')][_0x26fc('0x24')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x26fc('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x26fc('0x26')],'as':_0x26fc('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x26fc('0x28')],'as':_0x26fc('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x26fc('0x2a')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x26fc('0x2b')],'as':_0x26fc('0x2c'),'attributes':['id'],'raw':!![]},{'model':db[_0x26fc('0x2d')],'as':_0x26fc('0x2e'),'attributes':['id'],'raw':!![]}]})[_0x26fc('0xa')](function(_0x14ecff){if(_0x14ecff){_0x2738ee=_0x14ecff;_0x288c8d[_0x12a7ca](util[_0x26fc('0x1f')](_0x26fc('0x20'),_0x14ecff['name']));var _0x5457f5=[];switch(_0x14ecff['role']){case _0x26fc('0x2f'):_0x288c8d[_0x12a7ca]('voice:inbound');_0x288c8d[_0x12a7ca]('voice:outbound');if(queryQueues[_0x26fc('0x30')](_0x26fc('0x31'))){delete queryQueues[_0x26fc('0x31')];}_0x5457f5[_0x26fc('0x32')](db[_0x26fc('0x33')][_0x26fc('0x13')](queryQueues));_0x5457f5[_0x26fc('0x32')](db[_0x26fc('0x34')][_0x26fc('0x13')](queryQueues));_0x5457f5[_0x26fc('0x32')](db['FaxQueue'][_0x26fc('0x13')](queryQueues));_0x5457f5[_0x26fc('0x32')](db[_0x26fc('0x35')][_0x26fc('0x13')](queryQueues));_0x5457f5[_0x26fc('0x32')](db[_0x26fc('0x36')][_0x26fc('0x13')](queryQueues));_0x5457f5['push'](db[_0x26fc('0x37')]['findAll'](queryQueues));_0x5457f5[_0x26fc('0x32')](db[_0x26fc('0x38')][_0x26fc('0x13')](queryQueues));_0x5457f5[_0x26fc('0x32')](db[_0x26fc('0x1a')]['findAll'](queryTelephones));_0x5457f5[_0x26fc('0x32')](db[_0x26fc('0x39')]['findAll'](queryTrunks));_0x5457f5[_0x26fc('0x32')](db['Campaign'][_0x26fc('0x13')](queryCampaigns));_0x5457f5[_0x26fc('0x32')](db[_0x26fc('0x1a')][_0x26fc('0x13')](queryAgents));break;case _0x26fc('0x3a'):_0x288c8d[_0x12a7ca](_0x26fc('0x3b'));_0x288c8d[_0x12a7ca]('voice:outbound');_0x5457f5['push'](getAssociatedResources(_0x26fc('0xc'),_0x14ecff[_0x26fc('0x23')],_0x26fc('0x33')));_0x5457f5[_0x26fc('0x32')](getAssociatedResources('ChatQueues',_0x14ecff[_0x26fc('0x23')],_0x26fc('0x34')));_0x5457f5['push'](getAssociatedResources(_0x26fc('0xe'),_0x14ecff[_0x26fc('0x23')],'FaxQueue'));_0x5457f5[_0x26fc('0x32')](getAssociatedResources(_0x26fc('0xf'),_0x14ecff[_0x26fc('0x23')],'SmsQueue'));_0x5457f5[_0x26fc('0x32')](getAssociatedResources(_0x26fc('0x10'),_0x14ecff['userProfileId'],_0x26fc('0x36')));_0x5457f5['push'](getAssociatedResources(_0x26fc('0x11'),_0x14ecff[_0x26fc('0x23')],_0x26fc('0x37')));_0x5457f5[_0x26fc('0x32')](getAssociatedResources(_0x26fc('0x12'),_0x14ecff[_0x26fc('0x23')],_0x26fc('0x38')));_0x5457f5[_0x26fc('0x32')](getAssociatedResources(_0x26fc('0x14'),_0x14ecff[_0x26fc('0x23')],_0x26fc('0x1a')));_0x5457f5[_0x26fc('0x32')](getAssociatedResources('Trunks',_0x14ecff[_0x26fc('0x23')],_0x26fc('0x39')));_0x5457f5[_0x26fc('0x32')](getAssociatedResources(_0x26fc('0x16'),_0x14ecff[_0x26fc('0x23')],_0x26fc('0x1b')));_0x5457f5[_0x26fc('0x32')](db['User']['findAll'](queryAgents));break;case _0x26fc('0x6'):_0x288c8d[_0x12a7ca](_0x26fc('0x3b'));_0x288c8d[_0x12a7ca]('voice:outbound');_0x5457f5[_0x26fc('0x32')](_0x14ecff[_0x26fc('0x3c')]({'attributes':['id',_0x26fc('0x4')]}));_0x5457f5['push'](_0x14ecff[_0x26fc('0x3d')]({'attributes':['id',_0x26fc('0x4')]}));_0x5457f5[_0x26fc('0x32')](_0x14ecff[_0x26fc('0x3e')]({'attributes':['id',_0x26fc('0x4')]}));_0x5457f5[_0x26fc('0x32')](_0x14ecff[_0x26fc('0x3f')]({'attributes':['id',_0x26fc('0x4')]}));_0x5457f5[_0x26fc('0x32')](_0x14ecff[_0x26fc('0x40')]({'attributes':['id',_0x26fc('0x4')]}));_0x5457f5['push'](_0x14ecff[_0x26fc('0x41')]({'attributes':['id',_0x26fc('0x4')]}));_0x5457f5['push'](_0x14ecff[_0x26fc('0x42')]({'attributes':['id',_0x26fc('0x4')]}));break;}return BPromise[_0x26fc('0x43')](_0x5457f5);}})['then'](function(_0x27f00e){if(_0x27f00e&&_0x27f00e[_0x26fc('0x44')]){for(var _0x202412=0x0;_0x202412<_0x27f00e[_0x26fc('0x44')];_0x202412+=0x1){for(var _0x182bb6=0x0;_0x182bb6<_0x27f00e[_0x202412]['length'];_0x182bb6+=0x1){switch(_0x202412){case 0x0:joinOrLeaveQueues(_0x288c8d,_0x12a7ca,_0x26fc('0x45'),_0x27f00e[_0x202412][_0x182bb6]);break;case 0x1:joinOrLeaveQueues(_0x288c8d,_0x12a7ca,_0x26fc('0x46'),_0x27f00e[_0x202412][_0x182bb6]);break;case 0x2:joinOrLeaveQueues(_0x288c8d,_0x12a7ca,'fax',_0x27f00e[_0x202412][_0x182bb6]);break;case 0x3:joinOrLeaveQueues(_0x288c8d,_0x12a7ca,_0x26fc('0x47'),_0x27f00e[_0x202412][_0x182bb6]);break;case 0x4:joinOrLeaveQueues(_0x288c8d,_0x12a7ca,_0x26fc('0x48'),_0x27f00e[_0x202412][_0x182bb6]);break;case 0x5:joinOrLeaveQueues(_0x288c8d,_0x12a7ca,_0x26fc('0x49'),_0x27f00e[_0x202412][_0x182bb6]);break;case 0x6:joinOrLeaveQueues(_0x288c8d,_0x12a7ca,'whatsapp',_0x27f00e[_0x202412][_0x182bb6]);break;case 0x7:if(_0x2738ee[_0x26fc('0x5')]!==_0x26fc('0x6'))_0x288c8d[_0x12a7ca](util[_0x26fc('0x1f')]('telephone:%s',_0x27f00e[_0x202412][_0x182bb6]['name']));break;case 0x8:if(_0x2738ee[_0x26fc('0x5')]!==_0x26fc('0x6'))_0x288c8d[_0x12a7ca](util[_0x26fc('0x1f')](_0x26fc('0x4a'),_0x27f00e[_0x202412][_0x182bb6][_0x26fc('0x4')]));break;case 0x9:if(_0x2738ee['role']!=='agent')_0x288c8d[_0x12a7ca](util[_0x26fc('0x1f')]('campaign:%s:%s',_0x27f00e[_0x202412][_0x182bb6]['type'],_0x27f00e[_0x202412][_0x182bb6][_0x26fc('0x4')]));break;case 0xa:_0x288c8d[_0x12a7ca](util[_0x26fc('0x1f')](_0x26fc('0x20'),_0x27f00e[_0x202412][_0x182bb6][_0x26fc('0x4')]));break;}}}}})[_0x26fc('0xa')](function(){if(_0x12a7ca===_0x26fc('0x4b')){var _0x6c753=_[_0x26fc('0x19')](_0x2738ee[_0x26fc('0x25')],'id');return _0x2738ee[_0x26fc('0x4c')](_0x6c753)['then'](function(){for(var _0x7e6b58=0x0;_0x7e6b58<_0x6c753[_0x26fc('0x44')];_0x7e6b58+=0x1){_0x1641f2[_0x26fc('0x4d')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x6c753[_0x7e6b58]),'UserId':Number(_0x2738ee['id'])});}});}})[_0x26fc('0xa')](function(){if(_0x12a7ca==='leave'){var _0x5ddde5=_[_0x26fc('0x19')](_0x2738ee['MailInteractions'],'id');return _0x2738ee['removeMailInteractions'](_0x5ddde5)[_0x26fc('0xa')](function(){for(var _0x4fc2e6=0x0;_0x4fc2e6<_0x5ddde5[_0x26fc('0x44')];_0x4fc2e6+=0x1){_0x1641f2[_0x26fc('0x4d')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x5ddde5[_0x4fc2e6]),'UserId':Number(_0x2738ee['id'])});}});}})[_0x26fc('0xa')](function(){if(_0x12a7ca===_0x26fc('0x4b')){var _0x2d4b54=_[_0x26fc('0x19')](_0x2738ee[_0x26fc('0x29')],'id');return _0x2738ee[_0x26fc('0x4e')](_0x2d4b54)['then'](function(){for(var _0x33427c=0x0;_0x33427c<_0x2d4b54['length'];_0x33427c+=0x1){_0x1641f2[_0x26fc('0x4d')](_0x26fc('0x4f'),{'FaxInteractionId':Number(_0x2d4b54[_0x33427c]),'UserId':Number(_0x2738ee['id'])});}});}})[_0x26fc('0xa')](function(){if(_0x12a7ca===_0x26fc('0x4b')){var _0x3db60c=_[_0x26fc('0x19')](_0x2738ee[_0x26fc('0x50')],'id');return _0x2738ee['removeSmsInteractions'](_0x3db60c)[_0x26fc('0xa')](function(){for(var _0x32eff8=0x0;_0x32eff8<_0x3db60c[_0x26fc('0x44')];_0x32eff8+=0x1){_0x1641f2[_0x26fc('0x4d')](_0x26fc('0x51'),{'SmsInteractionId':Number(_0x3db60c[_0x32eff8]),'UserId':Number(_0x2738ee['id'])});}});}})[_0x26fc('0xa')](function(){if(_0x12a7ca==='leave'){var _0x2a4a74=_[_0x26fc('0x19')](_0x2738ee[_0x26fc('0x2c')],'id');return _0x2738ee['removeOpenchannelInteractions'](_0x2a4a74)[_0x26fc('0xa')](function(){for(var _0x213d56=0x0;_0x213d56<_0x2a4a74['length'];_0x213d56+=0x1){_0x1641f2[_0x26fc('0x4d')](_0x26fc('0x52'),{'OpenchannelInteractionId':Number(_0x2a4a74[_0x213d56]),'UserId':Number(_0x2738ee['id'])});}});}})[_0x26fc('0xa')](function(){if(_0x12a7ca===_0x26fc('0x4b')){var _0x1773f0=_[_0x26fc('0x19')](_0x2738ee[_0x26fc('0x2e')],'id');return _0x2738ee['removeWhatsappInteractions'](_0x1773f0)[_0x26fc('0xa')](function(){for(var _0x506b4e=0x0;_0x506b4e<_0x1773f0[_0x26fc('0x44')];_0x506b4e+=0x1){_0x1641f2['emit'](_0x26fc('0x53'),{'WhatsappInteractionId':Number(_0x1773f0[_0x506b4e]),'UserId':Number(_0x2738ee['id'])});}});}})['catch'](function(_0x14e4b7){_0x288c8d[_0x26fc('0x54')](_0x14e4b7);});}}function onDisconnect(_0x49f685,_0x34e013){joinOrLeave(_0x49f685,_0x26fc('0x4b'),_0x34e013);}function onConnect(_0xd06ed7){joinOrLeave(_0xd06ed7,'join');}exports['default']=function(_0x4b2c1d){_0x4b2c1d['on'](_0x26fc('0x55'),function(_0x5f5672){_0x5f5672['setMaxListeners'](0x0);_0x5f5672[_0x26fc('0x56')]=_0x5f5672[_0x26fc('0x57')]['connection']['remoteAddress']+':'+_0x5f5672[_0x26fc('0x57')][_0x26fc('0x55')][_0x26fc('0x58')];_0x5f5672[_0x26fc('0x59')]=new Date();_0x5f5672['log']=function(_0x313cea){console['log'](_0x26fc('0x5a')+_0x5f5672['nsp']['name']+'['+_0x5f5672[_0x26fc('0x56')]+']',_0x313cea);};_0x5f5672['on'](_0x26fc('0x5b'),function(){onDisconnect(_0x5f5672,_0x4b2c1d);_0x5f5672[_0x26fc('0x54')](_0x26fc('0x5c'));});onConnect(_0x5f5672);_0x5f5672['log'](_0x26fc('0x5d'));});}; \ No newline at end of file +var _0x0d91=['removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','connectedAt','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','name','Agents','User','role','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','telephone','Campaign','where','%s:queue:%s','length','format','user:%s','handshake','query','find','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','admin','voice:inbound','include','push','ChatQueue','OpenchannelQueue','WhatsappQueue','Trunk','voice:outbound','userProfileId','FaxQueue','SmsQueues','MailQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','chat','fax','sms','mail','openchannel','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions'];(function(_0x1c3e2f,_0x14f882){var _0x36e8a7=function(_0x533d4f){while(--_0x533d4f){_0x1c3e2f['push'](_0x1c3e2f['shift']());}};_0x36e8a7(++_0x14f882);}(_0x0d91,0x76));var _0x10d9=function(_0x431f0f,_0x263b3c){_0x431f0f=_0x431f0f-0x0;var _0x334a40=_0x0d91[_0x431f0f];return _0x334a40;};'use strict';var _=require(_0x10d9('0x0'));var util=require(_0x10d9('0x1'));var BPromise=require(_0x10d9('0x2'));var db=require(_0x10d9('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x10d9('0x4')],'include':[{'as':_0x10d9('0x5'),'model':db[_0x10d9('0x6')],'attributes':['id','name',_0x10d9('0x7')],'raw':!![],'where':{'role':_0x10d9('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x10d9('0x4')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x10d9('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x10d9('0x4')],'where':{'role':_0x10d9('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x10d9('0x4'),_0x10d9('0x9')],'where':{'type':_0x10d9('0xa')}};function getAssociatedResources(_0x3e5013,_0x2872a3,_0x24b5e7){return db[_0x10d9('0xb')][_0x10d9('0xc')]({'where':{'name':_0x3e5013,'userProfileId':_0x2872a3},'raw':!![]})[_0x10d9('0xd')](function(_0x3fe0de){if(_0x3fe0de){if(_0x3fe0de[_0x10d9('0xe')]){switch(_0x3e5013){case _0x10d9('0xf'):case _0x10d9('0x10'):case _0x10d9('0x11'):case'SmsQueues':case _0x10d9('0x12'):case _0x10d9('0x13'):case _0x10d9('0x14'):return db[_0x24b5e7][_0x10d9('0x15')](queryQueues);case _0x10d9('0x16'):return db[_0x24b5e7]['findAll'](queryTelephones);case _0x10d9('0x17'):return db[_0x24b5e7]['findAll'](queryTrunks);case _0x10d9('0x18'):return db[_0x24b5e7][_0x10d9('0x15')](queryCampaigns);}}else{return db[_0x10d9('0x19')][_0x10d9('0x15')]({'attributes':[_0x10d9('0x1a')],'where':{'sectionId':_0x3fe0de['id']},'raw':!![]})[_0x10d9('0xd')](function(_0x211df6){if(_0x211df6){var _0x2a6587={'where':{'id':_[_0x10d9('0x1b')](_0x211df6,_0x10d9('0x1a'))},'raw':!![]};switch(_0x24b5e7){case'User':_0x2a6587['where'][_0x10d9('0x7')]=_0x10d9('0x1c');break;case _0x10d9('0x1d'):_0x2a6587[_0x10d9('0x1e')]['type']=_0x10d9('0xa');break;}return db[_0x24b5e7][_0x10d9('0x15')](_0x2a6587);}else{return[];}});}}else{return[];}})[_0x10d9('0xd')](function(_0x8441a5){return _0x8441a5;});}function joinOrLeaveQueues(_0x5c7014,_0x664294,_0xff164e,_0x554d42){_0x5c7014[_0x664294](util['format'](_0x10d9('0x1f'),_0xff164e,_0x554d42['name']));if(_0x554d42[_0x10d9('0x5')]){for(var _0x1e84ba=0x0;_0x1e84ba<_0x554d42['Agents'][_0x10d9('0x20')];_0x1e84ba+=0x1){_0x5c7014[_0x664294](util[_0x10d9('0x21')](_0x10d9('0x22'),_0x554d42[_0x10d9('0x5')][_0x1e84ba][_0x10d9('0x4')]));}}}function joinOrLeave(_0x94fe39,_0x26ff84,_0x3a2e97){var _0x13a3e0;if(_0x94fe39[_0x10d9('0x23')][_0x10d9('0x24')]['id']){db[_0x10d9('0x6')][_0x10d9('0x25')]({'attributes':['id',_0x10d9('0x4'),_0x10d9('0x7'),'userProfileId'],'where':{'id':_0x94fe39[_0x10d9('0x23')][_0x10d9('0x24')]['id']},'include':[{'model':db[_0x10d9('0x26')],'as':_0x10d9('0x27'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x10d9('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x10d9('0x29')],'as':_0x10d9('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x10d9('0x2b')],'as':_0x10d9('0x2c'),'attributes':['id'],'raw':!![]},{'model':db[_0x10d9('0x2d')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x10d9('0x2e')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x10d9('0xd')](function(_0x3ec714){if(_0x3ec714){_0x13a3e0=_0x3ec714;_0x94fe39[_0x26ff84](util[_0x10d9('0x21')](_0x10d9('0x22'),_0x3ec714[_0x10d9('0x4')]));var _0x4fac0b=[];switch(_0x3ec714['role']){case _0x10d9('0x2f'):_0x94fe39[_0x26ff84](_0x10d9('0x30'));_0x94fe39[_0x26ff84]('voice:outbound');if(queryQueues['hasOwnProperty'](_0x10d9('0x31'))){delete queryQueues[_0x10d9('0x31')];}_0x4fac0b[_0x10d9('0x32')](db['VoiceQueue'][_0x10d9('0x15')](queryQueues));_0x4fac0b['push'](db[_0x10d9('0x33')][_0x10d9('0x15')](queryQueues));_0x4fac0b['push'](db['FaxQueue'][_0x10d9('0x15')](queryQueues));_0x4fac0b[_0x10d9('0x32')](db['SmsQueue'][_0x10d9('0x15')](queryQueues));_0x4fac0b[_0x10d9('0x32')](db['MailQueue'][_0x10d9('0x15')](queryQueues));_0x4fac0b[_0x10d9('0x32')](db[_0x10d9('0x34')]['findAll'](queryQueues));_0x4fac0b[_0x10d9('0x32')](db[_0x10d9('0x35')][_0x10d9('0x15')](queryQueues));_0x4fac0b['push'](db[_0x10d9('0x6')][_0x10d9('0x15')](queryTelephones));_0x4fac0b['push'](db[_0x10d9('0x36')][_0x10d9('0x15')](queryTrunks));_0x4fac0b[_0x10d9('0x32')](db[_0x10d9('0x1d')][_0x10d9('0x15')](queryCampaigns));_0x4fac0b[_0x10d9('0x32')](db['User']['findAll'](queryAgents));break;case'user':_0x94fe39[_0x26ff84](_0x10d9('0x30'));_0x94fe39[_0x26ff84](_0x10d9('0x37'));_0x4fac0b[_0x10d9('0x32')](getAssociatedResources(_0x10d9('0xf'),_0x3ec714[_0x10d9('0x38')],'VoiceQueue'));_0x4fac0b[_0x10d9('0x32')](getAssociatedResources(_0x10d9('0x10'),_0x3ec714[_0x10d9('0x38')],_0x10d9('0x33')));_0x4fac0b['push'](getAssociatedResources(_0x10d9('0x11'),_0x3ec714[_0x10d9('0x38')],_0x10d9('0x39')));_0x4fac0b[_0x10d9('0x32')](getAssociatedResources(_0x10d9('0x3a'),_0x3ec714[_0x10d9('0x38')],'SmsQueue'));_0x4fac0b[_0x10d9('0x32')](getAssociatedResources(_0x10d9('0x12'),_0x3ec714[_0x10d9('0x38')],_0x10d9('0x3b')));_0x4fac0b[_0x10d9('0x32')](getAssociatedResources(_0x10d9('0x13'),_0x3ec714[_0x10d9('0x38')],_0x10d9('0x34')));_0x4fac0b[_0x10d9('0x32')](getAssociatedResources('WhatsappQueues',_0x3ec714[_0x10d9('0x38')],_0x10d9('0x35')));_0x4fac0b[_0x10d9('0x32')](getAssociatedResources('Telephones',_0x3ec714[_0x10d9('0x38')],_0x10d9('0x6')));_0x4fac0b['push'](getAssociatedResources(_0x10d9('0x17'),_0x3ec714[_0x10d9('0x38')],_0x10d9('0x36')));_0x4fac0b[_0x10d9('0x32')](getAssociatedResources(_0x10d9('0x18'),_0x3ec714[_0x10d9('0x38')],_0x10d9('0x1d')));_0x4fac0b[_0x10d9('0x32')](db[_0x10d9('0x6')][_0x10d9('0x15')](queryAgents));break;case'agent':_0x94fe39[_0x26ff84](_0x10d9('0x30'));_0x94fe39[_0x26ff84](_0x10d9('0x37'));_0x4fac0b[_0x10d9('0x32')](_0x3ec714[_0x10d9('0x3c')]({'attributes':['id',_0x10d9('0x4')]}));_0x4fac0b[_0x10d9('0x32')](_0x3ec714[_0x10d9('0x3d')]({'attributes':['id',_0x10d9('0x4')]}));_0x4fac0b[_0x10d9('0x32')](_0x3ec714[_0x10d9('0x3e')]({'attributes':['id',_0x10d9('0x4')]}));_0x4fac0b[_0x10d9('0x32')](_0x3ec714[_0x10d9('0x3f')]({'attributes':['id','name']}));_0x4fac0b['push'](_0x3ec714[_0x10d9('0x40')]({'attributes':['id',_0x10d9('0x4')]}));_0x4fac0b[_0x10d9('0x32')](_0x3ec714[_0x10d9('0x41')]({'attributes':['id',_0x10d9('0x4')]}));_0x4fac0b[_0x10d9('0x32')](_0x3ec714['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0x10d9('0x42')](_0x4fac0b);}})[_0x10d9('0xd')](function(_0x55acc1){if(_0x55acc1&&_0x55acc1[_0x10d9('0x20')]){for(var _0x204303=0x0;_0x204303<_0x55acc1[_0x10d9('0x20')];_0x204303+=0x1){for(var _0x159cb4=0x0;_0x159cb4<_0x55acc1[_0x204303][_0x10d9('0x20')];_0x159cb4+=0x1){switch(_0x204303){case 0x0:joinOrLeaveQueues(_0x94fe39,_0x26ff84,'voice',_0x55acc1[_0x204303][_0x159cb4]);break;case 0x1:joinOrLeaveQueues(_0x94fe39,_0x26ff84,_0x10d9('0x43'),_0x55acc1[_0x204303][_0x159cb4]);break;case 0x2:joinOrLeaveQueues(_0x94fe39,_0x26ff84,_0x10d9('0x44'),_0x55acc1[_0x204303][_0x159cb4]);break;case 0x3:joinOrLeaveQueues(_0x94fe39,_0x26ff84,_0x10d9('0x45'),_0x55acc1[_0x204303][_0x159cb4]);break;case 0x4:joinOrLeaveQueues(_0x94fe39,_0x26ff84,_0x10d9('0x46'),_0x55acc1[_0x204303][_0x159cb4]);break;case 0x5:joinOrLeaveQueues(_0x94fe39,_0x26ff84,_0x10d9('0x47'),_0x55acc1[_0x204303][_0x159cb4]);break;case 0x6:joinOrLeaveQueues(_0x94fe39,_0x26ff84,'whatsapp',_0x55acc1[_0x204303][_0x159cb4]);break;case 0x7:if(_0x13a3e0[_0x10d9('0x7')]!==_0x10d9('0x8'))_0x94fe39[_0x26ff84](util[_0x10d9('0x21')]('telephone:%s',_0x55acc1[_0x204303][_0x159cb4]['name']));break;case 0x8:if(_0x13a3e0[_0x10d9('0x7')]!==_0x10d9('0x8'))_0x94fe39[_0x26ff84](util[_0x10d9('0x21')](_0x10d9('0x48'),_0x55acc1[_0x204303][_0x159cb4][_0x10d9('0x4')]));break;case 0x9:if(_0x13a3e0[_0x10d9('0x7')]!==_0x10d9('0x8'))_0x94fe39[_0x26ff84](util[_0x10d9('0x21')](_0x10d9('0x49'),_0x55acc1[_0x204303][_0x159cb4]['type'],_0x55acc1[_0x204303][_0x159cb4][_0x10d9('0x4')]));break;case 0xa:_0x94fe39[_0x26ff84](util[_0x10d9('0x21')](_0x10d9('0x22'),_0x55acc1[_0x204303][_0x159cb4][_0x10d9('0x4')]));break;}}}}})[_0x10d9('0xd')](function(){if(_0x26ff84===_0x10d9('0x4a')){var _0x449548=_[_0x10d9('0x1b')](_0x13a3e0[_0x10d9('0x27')],'id');return _0x13a3e0[_0x10d9('0x4b')](_0x449548)[_0x10d9('0xd')](function(){for(var _0xd16df8=0x0;_0xd16df8<_0x449548['length'];_0xd16df8+=0x1){_0x3a2e97[_0x10d9('0x4c')](_0x10d9('0x4d'),{'ChatInteractionId':Number(_0x449548[_0xd16df8]),'UserId':Number(_0x13a3e0['id'])});}});}})[_0x10d9('0xd')](function(){if(_0x26ff84==='leave'){var _0x315267=_[_0x10d9('0x1b')](_0x13a3e0[_0x10d9('0x28')],'id');return _0x13a3e0[_0x10d9('0x4e')](_0x315267)['then'](function(){for(var _0x1b8c08=0x0;_0x1b8c08<_0x315267[_0x10d9('0x20')];_0x1b8c08+=0x1){_0x3a2e97[_0x10d9('0x4c')](_0x10d9('0x4f'),{'MailInteractionId':Number(_0x315267[_0x1b8c08]),'UserId':Number(_0x13a3e0['id'])});}});}})[_0x10d9('0xd')](function(){if(_0x26ff84===_0x10d9('0x4a')){var _0x4d8141=_['map'](_0x13a3e0['FaxInteractions'],'id');return _0x13a3e0['removeFaxInteractions'](_0x4d8141)[_0x10d9('0xd')](function(){for(var _0x141223=0x0;_0x141223<_0x4d8141['length'];_0x141223+=0x1){_0x3a2e97[_0x10d9('0x4c')](_0x10d9('0x50'),{'FaxInteractionId':Number(_0x4d8141[_0x141223]),'UserId':Number(_0x13a3e0['id'])});}});}})[_0x10d9('0xd')](function(){if(_0x26ff84===_0x10d9('0x4a')){var _0xd600b9=_[_0x10d9('0x1b')](_0x13a3e0[_0x10d9('0x2c')],'id');return _0x13a3e0[_0x10d9('0x51')](_0xd600b9)[_0x10d9('0xd')](function(){for(var _0x34f2f2=0x0;_0x34f2f2<_0xd600b9['length'];_0x34f2f2+=0x1){_0x3a2e97[_0x10d9('0x4c')](_0x10d9('0x52'),{'SmsInteractionId':Number(_0xd600b9[_0x34f2f2]),'UserId':Number(_0x13a3e0['id'])});}});}})[_0x10d9('0xd')](function(){if(_0x26ff84==='leave'){var _0x3ea8d=_[_0x10d9('0x1b')](_0x13a3e0[_0x10d9('0x53')],'id');return _0x13a3e0['removeOpenchannelInteractions'](_0x3ea8d)[_0x10d9('0xd')](function(){for(var _0x6247f0=0x0;_0x6247f0<_0x3ea8d['length'];_0x6247f0+=0x1){_0x3a2e97[_0x10d9('0x4c')](_0x10d9('0x54'),{'OpenchannelInteractionId':Number(_0x3ea8d[_0x6247f0]),'UserId':Number(_0x13a3e0['id'])});}});}})[_0x10d9('0xd')](function(){if(_0x26ff84===_0x10d9('0x4a')){var _0x49da8b=_['map'](_0x13a3e0[_0x10d9('0x55')],'id');return _0x13a3e0[_0x10d9('0x56')](_0x49da8b)[_0x10d9('0xd')](function(){for(var _0x3aa9b5=0x0;_0x3aa9b5<_0x49da8b[_0x10d9('0x20')];_0x3aa9b5+=0x1){_0x3a2e97[_0x10d9('0x4c')](_0x10d9('0x57'),{'WhatsappInteractionId':Number(_0x49da8b[_0x3aa9b5]),'UserId':Number(_0x13a3e0['id'])});}});}})[_0x10d9('0x58')](function(_0x404cbb){_0x94fe39[_0x10d9('0x59')](_0x404cbb);});}}function onDisconnect(_0xc1ea65,_0x53b5c9){joinOrLeave(_0xc1ea65,'leave',_0x53b5c9);}function onConnect(_0x3d29e9){joinOrLeave(_0x3d29e9,_0x10d9('0x5a'));}exports[_0x10d9('0x5b')]=function(_0x1c0517){_0x1c0517['on'](_0x10d9('0x5c'),function(_0x11c969){_0x11c969[_0x10d9('0x5d')](0x0);_0x11c969[_0x10d9('0x5e')]=_0x11c969[_0x10d9('0x5f')]['connection'][_0x10d9('0x60')]+':'+_0x11c969[_0x10d9('0x5f')][_0x10d9('0x5c')]['remotePort'];_0x11c969[_0x10d9('0x61')]=new Date();_0x11c969[_0x10d9('0x59')]=function(_0xd09ee5){console['log']('SocketIO\x20'+_0x11c969[_0x10d9('0x62')]['name']+'['+_0x11c969[_0x10d9('0x5e')]+']',_0xd09ee5);};_0x11c969['on'](_0x10d9('0x63'),function(){onDisconnect(_0x11c969,_0x1c0517);_0x11c969[_0x10d9('0x59')](_0x10d9('0x64'));});onConnect(_0x11c969);_0x11c969['log'](_0x10d9('0x65'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 27d1f6d..f92f692 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 _0x092d=['substatus','User','find','fullname','email','internal','default','hasOwnProperty','model','hook','callback','toLowerCase','condition','jayson/promise','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','newmessage','Sms','SmsInteraction','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','Trigger,\x20%s','EventManager','error','catch','channel','motionChannel','event','direction','resolve','then','ContactId','undefined','sequelize','query','QueryTypes','SELECT','contact','UserId','interface','SIP/%s','name','agent','outgoingmessage','AfterCreateMessage','get','opened','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','format','closed','changed'];(function(_0x5d8898,_0x303ff9){var _0x5512a2=function(_0x3f34e6){while(--_0x3f34e6){_0x5d8898['push'](_0x5d8898['shift']());}};_0x5512a2(++_0x303ff9);}(_0x092d,0xdf));var _0xd092=function(_0x6cf622,_0x146e67){_0x6cf622=_0x6cf622-0x0;var _0x1887fe=_0x092d[_0x6cf622];return _0x1887fe;};'use strict';var util=require('util');var db=require('../../mysqldb')['db'];var jayson=require(_0xd092('0x0'));var logger=require('../logger')(_0xd092('0x1'));var client=jayson[_0xd092('0x2')][_0xd092('0x3')]({'port':0x232a});var triggers=[{'channel':_0xd092('0x4'),'model':_0xd092('0x5'),'event':_0xd092('0x6'),'condition':_0xd092('0x7'),'callback':afterCreate},{'channel':_0xd092('0x4'),'model':_0xd092('0x5'),'event':_0xd092('0x8'),'condition':_0xd092('0x9'),'callback':afterUpdate},{'channel':_0xd092('0x4'),'model':'ChatMessage','event':'afterCreate','condition':_0xd092('0xa'),'callback':afterCreateMessage},{'channel':_0xd092('0x4'),'model':'ChatOfflineMessage','event':'afterCreate','condition':_0xd092('0xa'),'callback':afterCreateOfflineMessage},{'channel':_0xd092('0xb'),'model':_0xd092('0xc'),'event':_0xd092('0x6'),'condition':_0xd092('0x7'),'callback':afterCreate},{'channel':'Sms','model':_0xd092('0xc'),'event':_0xd092('0x8'),'condition':_0xd092('0x9'),'callback':afterUpdate},{'channel':_0xd092('0xb'),'model':'SmsMessage','event':'afterCreate','condition':_0xd092('0xa'),'callback':afterCreateMessage},{'channel':_0xd092('0xd'),'model':_0xd092('0xe'),'event':_0xd092('0x6'),'condition':_0xd092('0x7'),'callback':afterCreate},{'channel':_0xd092('0xd'),'model':_0xd092('0xe'),'event':_0xd092('0x8'),'condition':_0xd092('0x9'),'callback':afterUpdate},{'channel':_0xd092('0xd'),'model':_0xd092('0xf'),'event':_0xd092('0x6'),'condition':_0xd092('0xa'),'callback':afterCreateMessage},{'channel':_0xd092('0x10'),'model':_0xd092('0x11'),'event':_0xd092('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':'Fax','model':_0xd092('0x11'),'event':_0xd092('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xd092('0x10'),'model':_0xd092('0x12'),'event':_0xd092('0x6'),'condition':_0xd092('0xa'),'callback':afterCreateMessage},{'channel':_0xd092('0x13'),'model':_0xd092('0x14'),'event':_0xd092('0x6'),'condition':_0xd092('0x7'),'callback':afterCreate},{'channel':_0xd092('0x13'),'model':'MailInteraction','event':_0xd092('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xd092('0x13'),'model':_0xd092('0x15'),'event':_0xd092('0x6'),'condition':_0xd092('0xa'),'callback':afterCreateMessage},{'channel':_0xd092('0x16'),'model':_0xd092('0x17'),'event':_0xd092('0x6'),'condition':_0xd092('0x7'),'callback':afterCreate},{'channel':'Openchannel','model':'OpenchannelInteraction','event':_0xd092('0x8'),'condition':_0xd092('0x9'),'callback':afterUpdate},{'channel':_0xd092('0x16'),'model':_0xd092('0x18'),'event':_0xd092('0x6'),'condition':_0xd092('0xa'),'callback':afterCreateMessage}];function request(_0xdcccc7){return client[_0xd092('0x19')]('EventManager',_0xdcccc7)['then'](function(_0x2db998){logger['info'](_0xd092('0x1a'),_0xd092('0x1b'),_0x2db998);if(_0x2db998['error']){if(_0x2db998[_0xd092('0x1c')]['code']===0x1f4){logger[_0xd092('0x1c')](_0xd092('0x1a'),'EventManager',_0x2db998[_0xd092('0x1c')]);}}})[_0xd092('0x1d')](function(_0x571e3e){logger[_0xd092('0x1c')]('Trigger,\x20%s',_0xd092('0x1b'),_0x571e3e);});}function afterCreateMessage(_0x3bc960){return function(_0x4ea197){_0x4ea197=_0x4ea197['get']({'plain':!![]});_0x4ea197[_0xd092('0x1e')]=_0x3bc960;_0x4ea197[_0xd092('0x1f')]=_0x3bc960;_0x4ea197[_0xd092('0x20')]=_0x4ea197[_0xd092('0x21')];Promise[_0xd092('0x22')]()[_0xd092('0x23')](function(){if(typeof _0x4ea197[_0xd092('0x24')]===_0xd092('0x25'))return null;var _0x14074a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4ea197[_0xd092('0x24')];return db[_0xd092('0x26')][_0xd092('0x27')](_0x14074a,{'type':db['Sequelize'][_0xd092('0x28')][_0xd092('0x29')],'raw':!![]});})[_0xd092('0x23')](function(_0x120ca5){if(_0x120ca5){_0x4ea197[_0xd092('0x2a')]=_0x120ca5[0x0];}if(typeof _0x4ea197[_0xd092('0x2b')]===_0xd092('0x25'))return;return getAgent(_0x4ea197[_0xd092('0x2b')]);})[_0xd092('0x23')](function(_0x85784e){if(_0x85784e){_0x4ea197[_0xd092('0x2c')]=util['format'](_0xd092('0x2d'),_0x85784e[_0xd092('0x2e')]);_0x4ea197[_0xd092('0x2f')]=_0x85784e;_0x4ea197[_0xd092('0x1e')]=_0x3bc960;return request({'event':'incomingmessage','message':_0x4ea197});}else{return request({'event':_0xd092('0x30'),'message':_0x4ea197});}})[_0xd092('0x1d')](function(_0x17f65c){logger[_0xd092('0x1c')]('Trigger,\x20%s',_0xd092('0x31'),_0x17f65c);});};}function afterCreateOfflineMessage(_0x5b8d4a){return function(_0x27828c){_0x27828c=_0x27828c[_0xd092('0x32')]({'plain':!![]});_0x27828c[_0xd092('0x1e')]=_0x5b8d4a;_0x27828c[_0xd092('0x1f')]=_0x5b8d4a;_0x27828c[_0xd092('0x20')]='offlineMessage';return request({'event':_0x27828c[_0xd092('0x20')],'message':_0x27828c});};}function afterCreate(_0x34a254,_0x890d7c){return function(_0x15a5e9){_0x15a5e9=_0x15a5e9['get']({'plain':!![]});_0x15a5e9[_0xd092('0x1e')]=_0x34a254;_0x15a5e9[_0xd092('0x1f')]=_0x34a254;_0x15a5e9[_0xd092('0x20')]=_0xd092('0x33');Promise['resolve']()['then'](function(){var _0x291336=_0xd092('0x34')+_0x15a5e9[_0xd092('0x24')];return db[_0xd092('0x26')][_0xd092('0x27')](_0x291336,{'type':db[_0xd092('0x35')][_0xd092('0x28')][_0xd092('0x29')],'raw':!![]});})['then'](function(_0x9f405e){if(_0x9f405e){_0x15a5e9['contact']=_0x9f405e[0x0];}if(typeof _0x15a5e9[_0xd092('0x2b')]===_0xd092('0x25'))return;return getAgent(_0x15a5e9[_0xd092('0x2b')]);})[_0xd092('0x23')](function(_0xd4589b){if(_0xd4589b){_0x15a5e9['interface']=util[_0xd092('0x36')](_0xd092('0x2d'),_0xd4589b[_0xd092('0x2e')]);_0x15a5e9[_0xd092('0x2f')]=_0xd4589b;}return request({'event':_0x890d7c,'message':_0x15a5e9});})[_0xd092('0x1d')](function(_0x4be673){logger[_0xd092('0x1c')]('Trigger,\x20%s','AfterCreate',_0x4be673);});};}function afterUpdate(_0x2aba22){return function(_0x2a6eb3){var _0x487d2a=_0x2a6eb3['changed'](_0xd092('0x37'))&&_0x2a6eb3[_0xd092('0x37')];var _0x2bd48d=_0x2a6eb3[_0xd092('0x38')](_0xd092('0x39'));if(_0x487d2a||_0x2bd48d){var _0x48bcab=_0x487d2a?'closedinteraction':_0xd092('0x39');var _0x5c1aee=_0x2a6eb3[_0xd092('0x32')]({'plain':!![]});_0x5c1aee[_0xd092('0x1e')]=_0x2aba22;_0x5c1aee[_0xd092('0x1f')]=_0x2aba22;_0x5c1aee[_0xd092('0x20')]=_0x487d2a?_0xd092('0x37'):'substatus';var _0x5bc411=_0xd092('0x34')+_0x5c1aee['ContactId'];return db['sequelize']['query'](_0x5bc411,{'type':db[_0xd092('0x35')][_0xd092('0x28')][_0xd092('0x29')],'raw':!![]})[_0xd092('0x23')](function(_0x58ef3f){if(_0x58ef3f){_0x5c1aee[_0xd092('0x2a')]=_0x58ef3f[0x0];}if(typeof _0x5c1aee[_0xd092('0x2b')]===_0xd092('0x25'))return;return getAgent(_0x5c1aee[_0xd092('0x2b')]);})['then'](function(_0x494930){if(_0x494930){_0x5c1aee['interface']=util[_0xd092('0x36')](_0xd092('0x2d'),_0x494930['name']);_0x5c1aee[_0xd092('0x2f')]=_0x494930;}return request({'event':_0x48bcab,'message':_0x5c1aee});})['catch'](function(_0x5f3196){logger['error'](_0xd092('0x1a'),'AfterUpdate',_0x5f3196);});}};}function getAgent(_0x166211){return db[_0xd092('0x3a')][_0xd092('0x3b')]({'where':{'id':_0x166211},'attributes':['id',_0xd092('0x2e'),_0xd092('0x3c'),_0xd092('0x3d'),_0xd092('0x3e')],'raw':!![]})[_0xd092('0x23')](function(_0x4af9fc){return _0x4af9fc;});}exports[_0xd092('0x3f')]=function(){for(var _0x422145=0x0;_0x422145=_0x2e16f6[_0x5979('0x16')]){throw Error(_0x5979('0x17'));}_0x2f3564(_0x48573e);})[_0x5979('0x18')](function(_0x4235bd){_0x5c17c2(_0x4235bd);});});}; \ No newline at end of file +var _0x745d=['Maximum\x20login\x20has\x20been\x20reached','catch','lodash','../mysqldb','./license/util','voice','mail','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','blockedAt','role','User','count','agent','getLicense','then','agents'];(function(_0x3b34db,_0x524c0b){var _0x3d3e22=function(_0x39e03a){while(--_0x39e03a){_0x3b34db['push'](_0x3b34db['shift']());}};_0x3d3e22(++_0x524c0b);}(_0x745d,0x152));var _0xd745=function(_0x50ee48,_0x4a389a){_0x50ee48=_0x50ee48-0x0;var _0x529062=_0x745d[_0x50ee48];return _0x529062;};'use strict';var _=require(_0xd745('0x0'));var BPromise=require('bluebird');var db=require(_0xd745('0x1'))['db'];var util=require(_0xd745('0x2'));var channels=[_0xd745('0x3'),_0xd745('0x4'),'chat',_0xd745('0x5'),_0xd745('0x6'),_0xd745('0x7'),_0xd745('0x8')];exports[_0xd745('0x9')]=function(){return channels;};exports[_0xd745('0xa')]=function(_0x1cb32d){_0x1cb32d=_0x1cb32d[_0xd745('0xb')]();return _[_0xd745('0xc')](channels,_0x1cb32d);};exports[_0xd745('0xd')]=function(_0x3989f0,_0x5e41bc,_0x17ae47,_0x1efd94){var _0x517272={'loginAttempts':_0x5e41bc,'blocked':_0x17ae47};if(!_['isUndefined'](_0x1efd94)){_0x517272[_0xd745('0xe')]=_0x1efd94;}return _0x3989f0['updateAttributes'](_0x517272);};exports['getLicense']=function(_0x2fff05){return new BPromise(function(_0x14413f,_0x3955ab){var _0x2b171e=0x0;if(_0x2fff05[_0xd745('0xf')]!=='agent'){_0x14413f(_0x2fff05);}db[_0xd745('0x10')][_0xd745('0x11')]({'where':{'role':_0xd745('0x12'),'online':!![],'id':{'$ne':_0x2fff05['id']}}})['then'](function(_0x473417){_0x2b171e=_0x473417;return util[_0xd745('0x13')]();})[_0xd745('0x14')](function(_0x54c607){if(_0x54c607&&_0x54c607[_0xd745('0x15')]&&_0x2b171e>=_0x54c607[_0xd745('0x15')]){throw Error(_0xd745('0x16'));}_0x14413f(_0x2fff05);})[_0xd745('0x17')](function(_0xca5482){_0x3955ab(_0xca5482);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 8913d77..a156efe 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['statusMessage','status','send','exports','util','../config/logger','api','message','name','Error','inherits','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error','stack'];(function(_0x5967e6,_0x103c1b){var _0x26706a=function(_0x2944ca){while(--_0x2944ca){_0x5967e6['push'](_0x5967e6['shift']());}};_0x26706a(++_0x103c1b);}(_0x814b,0x1a2));var _0xb814=function(_0x4d230c,_0x3862fd){_0x4d230c=_0x4d230c-0x0;var _0x16b044=_0x814b[_0x4d230c];return _0x16b044;};'use strict';var util=require(_0xb814('0x0'));var logger=require(_0xb814('0x1'))(_0xb814('0x2'));var APIError=function(_0x2f4ece,_0xfbb64b){this[_0xb814('0x3')]=_0x2f4ece||'Internal\x20Server\x20Error';this[_0xb814('0x4')]=_0xfbb64b||_0xb814('0x5');util[_0xb814('0x6')](APIError,Error);};var APIBadRequestError=function(_0x4237bc){this[_0xb814('0x3')]=_0x4237bc||_0xb814('0x7');this['name']=_0xb814('0x7');util[_0xb814('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x5c8539){this[_0xb814('0x3')]=_0x5c8539||_0xb814('0x8');this[_0xb814('0x4')]=_0xb814('0x9');util[_0xb814('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x21d4a5){this[_0xb814('0x3')]=_0x21d4a5||_0xb814('0xa');this[_0xb814('0x4')]=_0xb814('0xb');util[_0xb814('0x6')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x4b5f14){switch(_0x4b5f14){case _0xb814('0x7'):return 0x190;case'Forbidden',_0xb814('0xb'):return 0x193;case _0xb814('0x9'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x35b10d){if(_0x35b10d===_0xb814('0xb'))return _0x35b10d;return null;}function handleError(_0x2ce718){return function(_0x3bde14){logger[_0xb814('0xc')](_0x3bde14[_0xb814('0xd')]);var _0xa0a2e5=getStatusCode(_0x3bde14[_0xb814('0x4')]);var _0x3f4881=getCustomStatusMessage(_0x3bde14[_0xb814('0x4')]);if(_0x3bde14[_0xb814('0x4')])delete _0x3bde14[_0xb814('0x4')];if(_0x3f4881)_0x2ce718[_0xb814('0xe')]=_0x3f4881;return _0x2ce718[_0xb814('0xf')](_0xa0a2e5)[_0xb814('0x10')](_0x3bde14);};}module[_0xb814('0x11')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0x814b=['statusMessage','status','send','exports','util','../config/logger','api','message','name','Error','inherits','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error','stack'];(function(_0x48556e,_0x27c2e0){var _0x480216=function(_0x2e1c50){while(--_0x2e1c50){_0x48556e['push'](_0x48556e['shift']());}};_0x480216(++_0x27c2e0);}(_0x814b,0x1a2));var _0xb814=function(_0x15f8ad,_0x5275c3){_0x15f8ad=_0x15f8ad-0x0;var _0xc0238a=_0x814b[_0x15f8ad];return _0xc0238a;};'use strict';var util=require(_0xb814('0x0'));var logger=require(_0xb814('0x1'))(_0xb814('0x2'));var APIError=function(_0x2f4ece,_0xfbb64b){this[_0xb814('0x3')]=_0x2f4ece||'Internal\x20Server\x20Error';this[_0xb814('0x4')]=_0xfbb64b||_0xb814('0x5');util[_0xb814('0x6')](APIError,Error);};var APIBadRequestError=function(_0x4237bc){this[_0xb814('0x3')]=_0x4237bc||_0xb814('0x7');this['name']=_0xb814('0x7');util[_0xb814('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x5c8539){this[_0xb814('0x3')]=_0x5c8539||_0xb814('0x8');this[_0xb814('0x4')]=_0xb814('0x9');util[_0xb814('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x21d4a5){this[_0xb814('0x3')]=_0x21d4a5||_0xb814('0xa');this[_0xb814('0x4')]=_0xb814('0xb');util[_0xb814('0x6')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x4b5f14){switch(_0x4b5f14){case _0xb814('0x7'):return 0x190;case'Forbidden',_0xb814('0xb'):return 0x193;case _0xb814('0x9'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x35b10d){if(_0x35b10d===_0xb814('0xb'))return _0x35b10d;return null;}function handleError(_0x2ce718){return function(_0x3bde14){logger[_0xb814('0xc')](_0x3bde14[_0xb814('0xd')]);var _0xa0a2e5=getStatusCode(_0x3bde14[_0xb814('0x4')]);var _0x3f4881=getCustomStatusMessage(_0x3bde14[_0xb814('0x4')]);if(_0x3bde14[_0xb814('0x4')])delete _0x3bde14[_0xb814('0x4')];if(_0x3f4881)_0x2ce718[_0xb814('0xe')]=_0x3f4881;return _0x2ce718[_0xb814('0xf')](_0xa0a2e5)[_0xb814('0x10')](_0x3bde14);};}module[_0xb814('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 f1ff38e..428b051 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f6f=['status','exports','404'];(function(_0x32414e,_0x27c008){var _0x2970a9=function(_0x3b64db){while(--_0x3b64db){_0x32414e['push'](_0x32414e['shift']());}};_0x2970a9(++_0x27c008);}(_0x4f6f,0x17e));var _0xf4f6=function(_0xd67723,_0x1e576f){_0xd67723=_0xd67723-0x0;var _0x53b62b=_0x4f6f[_0xd67723];return _0x53b62b;};'use strict';module[_0xf4f6('0x0')][0x194]=function pageNotFound(_0x3f76a1,_0x1ddee1){var _0x147c2d=_0xf4f6('0x1');var _0x242163=0x194;var _0x4d4fb5={'status':_0x242163};_0x1ddee1[_0xf4f6('0x2')](_0x4d4fb5[_0xf4f6('0x2')]);_0x1ddee1['render'](_0x147c2d,{},function(_0x3681a2,_0x20a802){if(_0x3681a2){return _0x1ddee1['status'](_0x4d4fb5['status'])['json'](_0x4d4fb5);}_0x1ddee1['send'](_0x20a802);});}; \ No newline at end of file +var _0x13e9=['render','json','send','exports','404','status'];(function(_0x12d147,_0x59f567){var _0x161885=function(_0x42cbec){while(--_0x42cbec){_0x12d147['push'](_0x12d147['shift']());}};_0x161885(++_0x59f567);}(_0x13e9,0xf3));var _0x913e=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x13e9[_0x13b02f];return _0x12e9a6;};'use strict';module[_0x913e('0x0')][0x194]=function pageNotFound(_0x5baf2f,_0x3fa9ff){var _0x2bf73c=_0x913e('0x1');var _0x657f2f=0x194;var _0x54a5dd={'status':_0x657f2f};_0x3fa9ff['status'](_0x54a5dd[_0x913e('0x2')]);_0x3fa9ff[_0x913e('0x3')](_0x2bf73c,{},function(_0x3297b5,_0x30ef99){if(_0x3297b5){return _0x3fa9ff[_0x913e('0x2')](_0x54a5dd[_0x913e('0x2')])[_0x913e('0x4')](_0x54a5dd);}_0x3fa9ff[_0x913e('0x5')](_0x30ef99);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 8c11b66..99058a1 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(_0xf34b0a,_0x11e116){var _0x5021e1=function(_0x4eff67){while(--_0x4eff67){_0xf34b0a['push'](_0xf34b0a['shift']());}};_0x5021e1(++_0x11e116);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_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 35cb391..b1f301c 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa0d6=['/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/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/intServicenowField','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','./api/migration','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/cmList','/api/voice/prefixes','./api/userProfile','./api/userProfileSection','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','static','join','root','/apidoc','/demo','/snippet','snippet','3.8.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','./errors','./utils/client-side-logger','setupLoggers','./api/client-side-logs','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/queues','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition'];(function(_0x4abcf4,_0x4d80bc){var _0x24c066=function(_0x52ef99){while(--_0x52ef99){_0x4abcf4['push'](_0x4abcf4['shift']());}};_0x24c066(++_0x4d80bc);}(_0xa0d6,0xa4));var _0x6a0d=function(_0x17f6a0,_0x191bc6){_0x17f6a0=_0x17f6a0-0x0;var _0x1860f6=_0xa0d6[_0x17f6a0];return _0x1860f6;};'use strict';var path=require(_0x6a0d('0x0'));var express=require('express');var errors=require(_0x6a0d('0x1'));var config=require('./config/environment');var setupLoggers=require(_0x6a0d('0x2'))[_0x6a0d('0x3')];var clientSideLogs=require(_0x6a0d('0x4'));exports['default']=function(_0x72581e){return setupLoggers(_0x72581e)['then'](function(){_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x6'),require(_0x6a0d('0x7')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x8'),require(_0x6a0d('0x9')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xa'),require(_0x6a0d('0xb')));_0x72581e['use'](_0x6a0d('0xc'),require(_0x6a0d('0xd')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xe'),require(_0x6a0d('0xf')));_0x72581e[_0x6a0d('0x5')]('/api/voice/queues',require('./api/voiceQueue'));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x10'),require(_0x6a0d('0x11')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x12'),require(_0x6a0d('0x13')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x14'),require(_0x6a0d('0x15')));_0x72581e[_0x6a0d('0x5')]('/api/voice/mails/messages',require(_0x6a0d('0x16')));_0x72581e['use'](_0x6a0d('0x17'),require(_0x6a0d('0x18')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x19'),require(_0x6a0d('0x1a')));_0x72581e[_0x6a0d('0x5')]('/api/voice/agents/reports',require(_0x6a0d('0x1b')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x1c'),require(_0x6a0d('0x1d')));_0x72581e['use']('/api/members/reports',require('./api/memberReport'));_0x72581e['use']('/api/trunks',require(_0x6a0d('0x1e')));_0x72581e[_0x6a0d('0x5')]('/api/voice/transfers/reports',require(_0x6a0d('0x1f')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x20'),require(_0x6a0d('0x21')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x22'),require(_0x6a0d('0x23')));_0x72581e[_0x6a0d('0x5')]('/api/mail/queues',require(_0x6a0d('0x24')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x25'),require('./api/mailSubstatus'));_0x72581e[_0x6a0d('0x5')]('/api/mail/interactions',require(_0x6a0d('0x26')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x27'),require(_0x6a0d('0x28')));_0x72581e[_0x6a0d('0x5')]('/api/mail/applications',require(_0x6a0d('0x29')));_0x72581e['use']('/api/mail/reports/queue',require(_0x6a0d('0x2a')));_0x72581e['use'](_0x6a0d('0x2b'),require('./api/dashboard'));_0x72581e['use'](_0x6a0d('0x2c'),require(_0x6a0d('0x2d')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x2e'),require(_0x6a0d('0x2f')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x30'),require('./api/faxApplication'));_0x72581e[_0x6a0d('0x5')]('/api/fax/interactions',require(_0x6a0d('0x31')));_0x72581e['use'](_0x6a0d('0x32'),require(_0x6a0d('0x33')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x34'),require(_0x6a0d('0x35')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x36'),require('./api/faxQueueReport'));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x37'),require(_0x6a0d('0x38')));_0x72581e[_0x6a0d('0x5')]('/api/sms/applications',require(_0x6a0d('0x39')));_0x72581e[_0x6a0d('0x5')]('/api/sms/interactions',require('./api/smsInteraction'));_0x72581e['use'](_0x6a0d('0x3a'),require(_0x6a0d('0x3b')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x3c'),require(_0x6a0d('0x3d')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x3e'),require(_0x6a0d('0x3f')));_0x72581e[_0x6a0d('0x5')]('/api/openchannel/applications',require(_0x6a0d('0x40')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x41'),require(_0x6a0d('0x42')));_0x72581e[_0x6a0d('0x5')]('/api/openchannel/messages',require('./api/openchannelMessage'));_0x72581e['use'](_0x6a0d('0x43'),require('./api/openchannelQueue'));_0x72581e['use']('/api/chat/websites',require(_0x6a0d('0x44')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x45'),require(_0x6a0d('0x46')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x47'),require('./api/chatApplication'));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x48'),require(_0x6a0d('0x49')));_0x72581e['use'](_0x6a0d('0x4a'),require('./api/chatMessage'));_0x72581e[_0x6a0d('0x5')]('/api/chat/offline_messages',require(_0x6a0d('0x4b')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x4c'),require(_0x6a0d('0x4d')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x4e'),require(_0x6a0d('0x4f')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x50'),require('./api/chatProactiveAction'));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x51'),require('./api/cmCompany'));_0x72581e['use'](_0x6a0d('0x52'),require('./api/cmContact'));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x53'),require(_0x6a0d('0x54')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x55'),require(_0x6a0d('0x56')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x57'),require('./api/cmHopperFinal'));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x58'),require('./api/cmHopperHistory'));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x59'),require(_0x6a0d('0x5a')));_0x72581e[_0x6a0d('0x5')]('/api/actions',require(_0x6a0d('0x5b')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x5c'),require(_0x6a0d('0x5d')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x5e'),require(_0x6a0d('0x5f')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x60'),require(_0x6a0d('0x61')));_0x72581e['use'](_0x6a0d('0x62'),require(_0x6a0d('0x63')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x64'),require(_0x6a0d('0x65')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x66'),require(_0x6a0d('0x67')));_0x72581e[_0x6a0d('0x5')]('/api/cdr',require(_0x6a0d('0x68')));_0x72581e['use']('/api/voiceQueuesLog',require('./api/voiceQueuesLog'));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x69'),require(_0x6a0d('0x6a')));_0x72581e['use'](_0x6a0d('0x6b'),require(_0x6a0d('0x6c')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x6d'),require('./api/tag'));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x6e'),require('./api/contactItemType'));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x6f'),require(_0x6a0d('0x70')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x71'),require('./api/cmHopperAdditionalPhone'));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x72'),require(_0x6a0d('0x73')));_0x72581e['use'](_0x6a0d('0x74'),require(_0x6a0d('0x75')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x76'),require('./api/variable'));_0x72581e['use']('/api/integrations',require(_0x6a0d('0x77')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x78'),require('./api/integrationReport'));_0x72581e['use'](_0x6a0d('0x79'),require('./api/analyticCustomReport'));_0x72581e[_0x6a0d('0x5')]('/api/analytics/default_reports',require(_0x6a0d('0x7a')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x7b'),require(_0x6a0d('0x7c')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x7d'),require(_0x6a0d('0x7e')));_0x72581e[_0x6a0d('0x5')]('/api/analytics/field_reports',require('./api/analyticFieldReport'));_0x72581e[_0x6a0d('0x5')]('/api/analytics/tree_reports',require(_0x6a0d('0x7f')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x80'),require('./api/intSalesforceAccount'));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x81'),require('./api/intSalesforceConfiguration'));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x82'),require(_0x6a0d('0x83')));_0x72581e[_0x6a0d('0x5')]('/api/integrations/sugarcrm/accounts',require(_0x6a0d('0x84')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x85'),require(_0x6a0d('0x86')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x87'),require(_0x6a0d('0x88')));_0x72581e[_0x6a0d('0x5')]('/api/integrations/desk/accounts',require(_0x6a0d('0x89')));_0x72581e[_0x6a0d('0x5')]('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x8a'),require('./api/intDeskField'));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x8b'),require(_0x6a0d('0x8c')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x8d'),require(_0x6a0d('0x8e')));_0x72581e['use']('/api/integrations/zoho/fields',require(_0x6a0d('0x8f')));_0x72581e['use'](_0x6a0d('0x90'),require(_0x6a0d('0x91')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x92'),require('./api/intZendeskConfiguration'));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x93'),require(_0x6a0d('0x94')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x95'),require('./api/intFreshdeskAccount'));_0x72581e[_0x6a0d('0x5')]('/api/integrations/freshdesk/configurations',require(_0x6a0d('0x96')));_0x72581e['use'](_0x6a0d('0x97'),require('./api/intFreshdeskField'));_0x72581e['use'](_0x6a0d('0x98'),require(_0x6a0d('0x99')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x9a'),require('./api/intVtigerConfiguration'));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x9b'),require(_0x6a0d('0x9c')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0x9d'),require(_0x6a0d('0x9e')));_0x72581e[_0x6a0d('0x5')]('/api/integrations/servicenow/configurations',require(_0x6a0d('0x9f')));_0x72581e['use']('/api/integrations/servicenow/fields',require(_0x6a0d('0xa0')));_0x72581e[_0x6a0d('0x5')]('/api/integrations/dynamics365/accounts',require(_0x6a0d('0xa1')));_0x72581e['use']('/api/integrations/dynamics365/configurations',require(_0x6a0d('0xa2')));_0x72581e['use'](_0x6a0d('0xa3'),require(_0x6a0d('0xa4')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xa5'),require(_0x6a0d('0xa6')));_0x72581e['use'](_0x6a0d('0xa7'),require(_0x6a0d('0xa8')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xa9'),require(_0x6a0d('0xaa')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xab'),require(_0x6a0d('0xac')));_0x72581e[_0x6a0d('0x5')]('/api/chat/reports/queue',require(_0x6a0d('0xad')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xae'),require('./api/chatInternalMessage'));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xaf'),require('./api/jscriptyAnswerReport'));_0x72581e['use'](_0x6a0d('0xb0'),require('./api/jscriptyQuestionReport'));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xb1'),require('./api/jscriptySessionReport'));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xb2'),require(_0x6a0d('0xb3')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xb4'),require('./api/squareReport'));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xb5'),require(_0x6a0d('0xb6')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xb7'),require(_0x6a0d('0xb8')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xb9'),require('./api/setting'));_0x72581e['use'](_0x6a0d('0xba'),require(_0x6a0d('0xbb')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xbc'),require('./api/squareProject'));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xbd'),require(_0x6a0d('0xbe')));_0x72581e['use'](_0x6a0d('0xbf'),require('./api/squareMessage'));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xc0'),require(_0x6a0d('0xc1')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xc2'),require(_0x6a0d('0xc3')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xc4'),require(_0x6a0d('0xc5')));_0x72581e['use']('/api/migrations',require(_0x6a0d('0xc6')));_0x72581e[_0x6a0d('0x5')]('/api/attachments',require(_0x6a0d('0xc7')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xc8'),require(_0x6a0d('0xc9')));_0x72581e['use']('/api/mail/reports/transfer',require(_0x6a0d('0xca')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xcb'),require(_0x6a0d('0xcc')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xcd'),require(_0x6a0d('0xce')));_0x72581e['use'](_0x6a0d('0xcf'),require(_0x6a0d('0xd0')));_0x72581e['use'](_0x6a0d('0xd1'),require('./api/smsTransferReport'));_0x72581e[_0x6a0d('0x5')]('/api/cm/lists',require(_0x6a0d('0xd2')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xd3'),require('./api/voicePrefix'));_0x72581e['use']('/api/userProfiles',require(_0x6a0d('0xd4')));_0x72581e[_0x6a0d('0x5')]('/api/userProfile/sections',require(_0x6a0d('0xd5')));_0x72581e[_0x6a0d('0x5')]('/api/userProfile/resources',require('./api/userProfileResource'));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xd6'),require(_0x6a0d('0xd7')));_0x72581e['use'](_0x6a0d('0xd8'),require(_0x6a0d('0xd9')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xda'),require('./api/whatsappApplication'));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xdb'),require(_0x6a0d('0xdc')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xdd'),require(_0x6a0d('0xde')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xdf'),require(_0x6a0d('0xe0')));_0x72581e[_0x6a0d('0x5')]('/api/whatsapp/reports/transfer',require(_0x6a0d('0xe1')));_0x72581e[_0x6a0d('0x5')]('/api/whatsapp/queues',require(_0x6a0d('0xe2')));_0x72581e['use'](_0x6a0d('0xe3'),require(_0x6a0d('0xe4')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xe5'),require(_0x6a0d('0xe6')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xe7'),require(_0x6a0d('0xe8')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xe9'),require('./api/authLocal'));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xea'),require(_0x6a0d('0xeb')));_0x72581e['use'](_0x6a0d('0xec'),require(_0x6a0d('0xed')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xee'),require(_0x6a0d('0xef')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xf0'),require(_0x6a0d('0xf1')));_0x72581e[_0x6a0d('0x5')]('/api/version',require('./api/version'));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xf2'),require(_0x6a0d('0xf3')));_0x72581e['use'](_0x6a0d('0xf4'),require(_0x6a0d('0xf5')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xf6'),require('./api/webbar'));_0x72581e['use']('/api/logs',clientSideLogs);_0x72581e['use']('/apidoc',express[_0x6a0d('0xf7')](path[_0x6a0d('0xf8')](config[_0x6a0d('0xf9')],_0x6a0d('0xfa'))));_0x72581e['use']('/www',express[_0x6a0d('0xf7')](path['join'](config[_0x6a0d('0xf9')],'/www')));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xfb'),express[_0x6a0d('0xf7')](path['join'](config[_0x6a0d('0xf9')],'/demo')));_0x72581e['use'](_0x6a0d('0xfc'),express[_0x6a0d('0xf7')](path[_0x6a0d('0xf8')](config[_0x6a0d('0xf9')],_0x6a0d('0xfd'),_0x6a0d('0xfe'))));_0x72581e[_0x6a0d('0x5')](_0x6a0d('0xff'),express[_0x6a0d('0xf7')](path[_0x6a0d('0xf8')](config[_0x6a0d('0xf9')],_0x6a0d('0x100'))));_0x72581e[_0x6a0d('0x101')](_0x6a0d('0x102'))[_0x6a0d('0x103')](errors[0x194]);_0x72581e[_0x6a0d('0x101')]('/*')[_0x6a0d('0x103')](function(_0x1b9e76,_0x22abeb){_0x22abeb[_0x6a0d('0x104')](path[_0x6a0d('0x105')](_0x72581e[_0x6a0d('0x103')](_0x6a0d('0x106'))+_0x6a0d('0x107')));});return _0x72581e;});}; \ No newline at end of file +var _0xea73=['/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappApplication','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.8.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','appPath','express','./errors','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','/api/users','use','./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/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailAccount','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','/api/pauses','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./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/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticFieldReport','/api/analytics/tree_reports','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./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/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField'];(function(_0x86c1f9,_0x21f8b0){var _0x62e436=function(_0x163c26){while(--_0x163c26){_0x86c1f9['push'](_0x86c1f9['shift']());}};_0x62e436(++_0x21f8b0);}(_0xea73,0x175));var _0x3ea7=function(_0x2f877d,_0x10726f){_0x2f877d=_0x2f877d-0x0;var _0x277b31=_0xea73[_0x2f877d];return _0x277b31;};'use strict';var path=require('path');var express=require(_0x3ea7('0x0'));var errors=require(_0x3ea7('0x1'));var config=require('./config/environment');var setupLoggers=require(_0x3ea7('0x2'))[_0x3ea7('0x3')];var clientSideLogs=require(_0x3ea7('0x4'));exports[_0x3ea7('0x5')]=function(_0x59821a){return setupLoggers(_0x59821a)['then'](function(){_0x59821a['use'](_0x3ea7('0x6'),require('./api/user'));_0x59821a[_0x3ea7('0x7')]('/api/voice/chanspy',require(_0x3ea7('0x8')));_0x59821a['use'](_0x3ea7('0x9'),require(_0x3ea7('0xa')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xb'),require(_0x3ea7('0xc')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xd'),require(_0x3ea7('0xe')));_0x59821a['use'](_0x3ea7('0xf'),require(_0x3ea7('0x10')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x11'),require('./api/voiceRecording'));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x12'),require(_0x3ea7('0x13')));_0x59821a[_0x3ea7('0x7')]('/api/voice/mails',require(_0x3ea7('0x14')));_0x59821a['use'](_0x3ea7('0x15'),require(_0x3ea7('0x16')));_0x59821a[_0x3ea7('0x7')]('/api/voice/calls/reports',require(_0x3ea7('0x17')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x18'),require('./api/voiceDialReport'));_0x59821a[_0x3ea7('0x7')]('/api/voice/agents/reports',require(_0x3ea7('0x19')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x1a'),require(_0x3ea7('0x1b')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x1c'),require(_0x3ea7('0x1d')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x1e'),require(_0x3ea7('0x1f')));_0x59821a[_0x3ea7('0x7')]('/api/voice/transfers/reports',require(_0x3ea7('0x20')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x21'),require('./api/mailServerOut'));_0x59821a[_0x3ea7('0x7')]('/api/mail/accounts',require(_0x3ea7('0x22')));_0x59821a['use']('/api/mail/queues',require(_0x3ea7('0x23')));_0x59821a[_0x3ea7('0x7')]('/api/mail/substatuses',require(_0x3ea7('0x24')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x25'),require('./api/mailInteraction'));_0x59821a[_0x3ea7('0x7')]('/api/mail/messages',require(_0x3ea7('0x26')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x27'),require('./api/mailApplication'));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x28'),require(_0x3ea7('0x29')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x2a'),require('./api/dashboard'));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x2b'),require(_0x3ea7('0x2c')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x2d'),require(_0x3ea7('0x2e')));_0x59821a['use']('/api/fax/applications',require(_0x3ea7('0x2f')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x30'),require(_0x3ea7('0x31')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x32'),require(_0x3ea7('0x33')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x34'),require('./api/faxQueue'));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x35'),require(_0x3ea7('0x36')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x37'),require(_0x3ea7('0x38')));_0x59821a['use']('/api/sms/applications',require(_0x3ea7('0x39')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x3a'),require(_0x3ea7('0x3b')));_0x59821a['use']('/api/sms/messages',require('./api/smsMessage'));_0x59821a['use'](_0x3ea7('0x3c'),require(_0x3ea7('0x3d')));_0x59821a['use']('/api/openchannel/accounts',require(_0x3ea7('0x3e')));_0x59821a[_0x3ea7('0x7')]('/api/openchannel/applications',require(_0x3ea7('0x3f')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x40'),require('./api/openchannelInteraction'));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x41'),require(_0x3ea7('0x42')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x43'),require(_0x3ea7('0x44')));_0x59821a['use'](_0x3ea7('0x45'),require(_0x3ea7('0x46')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x47'),require(_0x3ea7('0x48')));_0x59821a[_0x3ea7('0x7')]('/api/chat/applications',require(_0x3ea7('0x49')));_0x59821a['use'](_0x3ea7('0x4a'),require(_0x3ea7('0x4b')));_0x59821a['use'](_0x3ea7('0x4c'),require(_0x3ea7('0x4d')));_0x59821a[_0x3ea7('0x7')]('/api/chat/offline_messages',require(_0x3ea7('0x4e')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x4f'),require(_0x3ea7('0x50')));_0x59821a['use'](_0x3ea7('0x51'),require(_0x3ea7('0x52')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x53'),require(_0x3ea7('0x54')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x55'),require('./api/cmCompany'));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x56'),require(_0x3ea7('0x57')));_0x59821a[_0x3ea7('0x7')]('/api/cm/hopper',require(_0x3ea7('0x58')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x59'),require('./api/cmHopperBlack'));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x5a'),require(_0x3ea7('0x5b')));_0x59821a[_0x3ea7('0x7')]('/api/cm/hopper_history',require(_0x3ea7('0x5c')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x5d'),require(_0x3ea7('0x5e')));_0x59821a[_0x3ea7('0x7')]('/api/actions',require(_0x3ea7('0x5f')));_0x59821a['use'](_0x3ea7('0x60'),require(_0x3ea7('0x61')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x62'),require(_0x3ea7('0x63')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x64'),require(_0x3ea7('0x65')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x66'),require('./api/condition'));_0x59821a[_0x3ea7('0x7')]('/api/intervals',require('./api/interval'));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x67'),require('./api/pause'));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x68'),require('./api/cdr'));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x69'),require(_0x3ea7('0x6a')));_0x59821a[_0x3ea7('0x7')]('/api/schedules',require(_0x3ea7('0x6b')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x6c'),require(_0x3ea7('0x6d')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x6e'),require(_0x3ea7('0x6f')));_0x59821a['use'](_0x3ea7('0x70'),require(_0x3ea7('0x71')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x72'),require(_0x3ea7('0x73')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x74'),require(_0x3ea7('0x75')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x76'),require(_0x3ea7('0x77')));_0x59821a['use'](_0x3ea7('0x78'),require('./api/trigger'));_0x59821a[_0x3ea7('0x7')]('/api/variables',require('./api/variable'));_0x59821a[_0x3ea7('0x7')]('/api/integrations',require('./api/integration'));_0x59821a['use']('/api/integrations/reports',require(_0x3ea7('0x79')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x7a'),require(_0x3ea7('0x7b')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x7c'),require(_0x3ea7('0x7d')));_0x59821a[_0x3ea7('0x7')]('/api/analytics/extracted_reports',require(_0x3ea7('0x7e')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x7f'),require('./api/analyticMetric'));_0x59821a[_0x3ea7('0x7')]('/api/analytics/field_reports',require(_0x3ea7('0x80')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x81'),require('./api/analyticTreeReport'));_0x59821a['use']('/api/integrations/salesforce/accounts',require(_0x3ea7('0x82')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x83'),require(_0x3ea7('0x84')));_0x59821a[_0x3ea7('0x7')]('/api/integrations/salesforce/fields',require(_0x3ea7('0x85')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x86'),require(_0x3ea7('0x87')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x88'),require(_0x3ea7('0x89')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x8a'),require(_0x3ea7('0x8b')));_0x59821a['use'](_0x3ea7('0x8c'),require(_0x3ea7('0x8d')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x8e'),require(_0x3ea7('0x8f')));_0x59821a['use']('/api/integrations/desk/fields',require('./api/intDeskField'));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x90'),require(_0x3ea7('0x91')));_0x59821a[_0x3ea7('0x7')]('/api/integrations/zoho/configurations',require('./api/intZohoConfiguration'));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x92'),require(_0x3ea7('0x93')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x94'),require(_0x3ea7('0x95')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x96'),require(_0x3ea7('0x97')));_0x59821a['use'](_0x3ea7('0x98'),require(_0x3ea7('0x99')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x9a'),require(_0x3ea7('0x9b')));_0x59821a['use'](_0x3ea7('0x9c'),require('./api/intFreshdeskConfiguration'));_0x59821a[_0x3ea7('0x7')]('/api/integrations/freshdesk/fields',require('./api/intFreshdeskField'));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x9d'),require(_0x3ea7('0x9e')));_0x59821a['use'](_0x3ea7('0x9f'),require('./api/intVtigerConfiguration'));_0x59821a['use'](_0x3ea7('0xa0'),require(_0x3ea7('0xa1')));_0x59821a['use']('/api/integrations/servicenow/accounts',require(_0x3ea7('0xa2')));_0x59821a['use'](_0x3ea7('0xa3'),require(_0x3ea7('0xa4')));_0x59821a['use'](_0x3ea7('0xa5'),require(_0x3ea7('0xa6')));_0x59821a[_0x3ea7('0x7')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x59821a['use'](_0x3ea7('0xa7'),require(_0x3ea7('0xa8')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xa9'),require(_0x3ea7('0xaa')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xab'),require('./api/intFreshsalesAccount'));_0x59821a['use']('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x59821a[_0x3ea7('0x7')]('/api/integrations/freshsales/fields',require(_0x3ea7('0xac')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xad'),require(_0x3ea7('0xae')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xaf'),require('./api/chatQueueReport'));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xb0'),require(_0x3ea7('0xb1')));_0x59821a['use'](_0x3ea7('0xb2'),require(_0x3ea7('0xb3')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xb4'),require('./api/jscriptyQuestionReport'));_0x59821a['use']('/api/jscripty/sessions/reports',require(_0x3ea7('0xb5')));_0x59821a[_0x3ea7('0x7')]('/api/sms/reports/queue',require(_0x3ea7('0xb6')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xb7'),require('./api/squareReport'));_0x59821a['use'](_0x3ea7('0xb8'),require(_0x3ea7('0xb9')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xba'),require(_0x3ea7('0xbb')));_0x59821a['use'](_0x3ea7('0xbc'),require(_0x3ea7('0xbd')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xbe'),require('./api/squareOdbc'));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xbf'),require(_0x3ea7('0xc0')));_0x59821a['use'](_0x3ea7('0xc1'),require(_0x3ea7('0xc2')));_0x59821a[_0x3ea7('0x7')]('/api/square/messages',require(_0x3ea7('0xc3')));_0x59821a[_0x3ea7('0x7')]('/api/teams',require(_0x3ea7('0xc4')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xc5'),require(_0x3ea7('0xc6')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xc7'),require(_0x3ea7('0xc8')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xc9'),require(_0x3ea7('0xca')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xcb'),require(_0x3ea7('0xcc')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xcd'),require(_0x3ea7('0xce')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xcf'),require(_0x3ea7('0xd0')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xd1'),require(_0x3ea7('0xd2')));_0x59821a['use'](_0x3ea7('0xd3'),require('./api/faxTransferReport'));_0x59821a[_0x3ea7('0x7')]('/api/openchannel/reports/transfer',require(_0x3ea7('0xd4')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xd5'),require(_0x3ea7('0xd6')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xd7'),require(_0x3ea7('0xd8')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xd9'),require(_0x3ea7('0xda')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xdb'),require(_0x3ea7('0xdc')));_0x59821a[_0x3ea7('0x7')]('/api/userProfile/sections',require(_0x3ea7('0xdd')));_0x59821a['use'](_0x3ea7('0xde'),require(_0x3ea7('0xdf')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xe0'),require(_0x3ea7('0xe1')));_0x59821a[_0x3ea7('0x7')]('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0x59821a['use']('/api/whatsapp/applications',require(_0x3ea7('0xe2')));_0x59821a['use']('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x59821a['use'](_0x3ea7('0xe3'),require(_0x3ea7('0xe4')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xe5'),require(_0x3ea7('0xe6')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xe7'),require(_0x3ea7('0xe8')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xe9'),require(_0x3ea7('0xea')));_0x59821a[_0x3ea7('0x7')]('/api/cloudProviders',require(_0x3ea7('0xeb')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xec'),require(_0x3ea7('0xed')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xee'),require(_0x3ea7('0xef')));_0x59821a['use'](_0x3ea7('0xf0'),require(_0x3ea7('0xf1')));_0x59821a['use'](_0x3ea7('0xf2'),require('./api/authGoogle'));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xf3'),require(_0x3ea7('0xf4')));_0x59821a['use']('/api/jira',require(_0x3ea7('0xf5')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xf6'),require(_0x3ea7('0xf7')));_0x59821a['use'](_0x3ea7('0xf8'),require(_0x3ea7('0xf9')));_0x59821a[_0x3ea7('0x7')]('/api/system',require('./api/system'));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xfa'),require(_0x3ea7('0xfb')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0xfc'),require(_0x3ea7('0xfd')));_0x59821a['use'](_0x3ea7('0xfe'),clientSideLogs);_0x59821a['use'](_0x3ea7('0xff'),express[_0x3ea7('0x100')](path[_0x3ea7('0x101')](config[_0x3ea7('0x102')],'/apidoc')));_0x59821a['use'](_0x3ea7('0x103'),express['static'](path['join'](config[_0x3ea7('0x102')],'/www')));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x104'),express[_0x3ea7('0x100')](path['join'](config[_0x3ea7('0x102')],_0x3ea7('0x104'))));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x105'),express['static'](path[_0x3ea7('0x101')](config['root'],_0x3ea7('0x106'),_0x3ea7('0x107'))));_0x59821a[_0x3ea7('0x7')](_0x3ea7('0x108'),express[_0x3ea7('0x100')](path['join'](config[_0x3ea7('0x102')],_0x3ea7('0x109'))));_0x59821a[_0x3ea7('0x10a')](_0x3ea7('0x10b'))[_0x3ea7('0x10c')](errors[0x194]);_0x59821a[_0x3ea7('0x10a')]('/*')['get'](function(_0xbfc34a,_0x5aa636){_0x5aa636['sendFile'](path['resolve'](_0x59821a[_0x3ea7('0x10c')](_0x3ea7('0x10d'))+'/index.html'));});return _0x59821a;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 7db199d..fe7aa32 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x31e5=['../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','port','rpc','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailQueue/mailQueue.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc'];(function(_0x3a75c3,_0x3bccba){var _0xac0f1c=function(_0x5c7b81){while(--_0x5c7b81){_0x3a75c3['push'](_0x3a75c3['shift']());}};_0xac0f1c(++_0x3bccba);}(_0x31e5,0x164));var _0x531e=function(_0x3d9d6b,_0x2922ef){_0x3d9d6b=_0x3d9d6b-0x0;var _0x4c1965=_0x31e5[_0x3d9d6b];return _0x4c1965;};'use strict';var jayson=require(_0x531e('0x0'));var _=require(_0x531e('0x1'));var config=require(_0x531e('0x2'));exports[_0x531e('0x3')]=function(){return new Promise(function(_0x27ed40,_0x204d46){var _0x1fc241={};_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x5')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x6')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require('../api/voiceQueue/voiceQueue.rpc'));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x7')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x8')));_0x1fc241=_['merge'](_0x1fc241,require(_0x531e('0x9')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0xa')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0xb')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0xc')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0xd')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0xe')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0xf')));_0x1fc241=_['merge'](_0x1fc241,require('../api/mailServerIn/mailServerIn.rpc'));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require('../api/mailAccount/mailAccount.rpc'));_0x1fc241=_['merge'](_0x1fc241,require(_0x531e('0x10')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require('../api/mailInteraction/mailInteraction.rpc'));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require('../api/mailMessage/mailMessage.rpc'));_0x1fc241=_['merge'](_0x1fc241,require(_0x531e('0x11')));_0x1fc241=_['merge'](_0x1fc241,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x12')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x13')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x14')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x15')));_0x1fc241=_['merge'](_0x1fc241,require(_0x531e('0x16')));_0x1fc241=_['merge'](_0x1fc241,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x17')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x18')));_0x1fc241=_['merge'](_0x1fc241,require(_0x531e('0x19')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x1a')));_0x1fc241=_['merge'](_0x1fc241,require(_0x531e('0x1b')));_0x1fc241=_['merge'](_0x1fc241,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x1fc241=_['merge'](_0x1fc241,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x1c')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x1d')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x1e')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x1f')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x20')));_0x1fc241=_['merge'](_0x1fc241,require(_0x531e('0x21')));_0x1fc241=_['merge'](_0x1fc241,require(_0x531e('0x22')));_0x1fc241=_['merge'](_0x1fc241,require(_0x531e('0x23')));_0x1fc241=_['merge'](_0x1fc241,require(_0x531e('0x24')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x25')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x26')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x27')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x28')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x29')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require('../api/template/template.rpc'));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x2a')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require('../api/variable/variable.rpc'));_0x1fc241=_['merge'](_0x1fc241,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x2b')));_0x1fc241=_['merge'](_0x1fc241,require(_0x531e('0x2c')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x2d')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x2e')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x2f')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x1fc241=_['merge'](_0x1fc241,require(_0x531e('0x30')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x31')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x32')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x33')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x34')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require('../api/setting/setting.rpc'));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require('../api/squareOdbc/squareOdbc.rpc'));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x35')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require('../api/squareRecording/squareRecording.rpc'));_0x1fc241=_['merge'](_0x1fc241,require(_0x531e('0x36')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require('../api/campaign/campaign.rpc'));_0x1fc241=_['merge'](_0x1fc241,require(_0x531e('0x37')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require('../api/plugin/plugin.rpc'));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x38')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x39')));_0x1fc241=_[_0x531e('0x4')](_0x1fc241,require(_0x531e('0x3a')));_0x1fc241=_['merge'](_0x1fc241,require(_0x531e('0x3b')));var _0x119da3=jayson[_0x531e('0x3c')](_0x1fc241)['http']();var _0x7568d3=config['rpc'][_0x531e('0x3d')]||config[_0x531e('0x3d')]+0x1;var _0x343ca1=config[_0x531e('0x3e')]['ip']||_0x531e('0x3f');_0x119da3['on'](_0x531e('0x40'),function(_0x24ebca){return _0x204d46(_0x24ebca);});_0x119da3[_0x531e('0x3')](_0x7568d3,_0x343ca1,function(){console[_0x531e('0x41')](_0x531e('0x42'),_0x343ca1,_0x7568d3);require('../config/triggers')[_0x531e('0x43')]();return _0x27ed40(_0x531e('0x44')+_0x343ca1+':'+_0x7568d3);});});}; \ No newline at end of file +var _0x5956=['../api/interval/interval.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','port','rpc','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.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/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc'];(function(_0x229437,_0x2491e8){var _0x3d923c=function(_0xb7f9d0){while(--_0xb7f9d0){_0x229437['push'](_0x229437['shift']());}};_0x3d923c(++_0x2491e8);}(_0x5956,0x65));var _0x6595=function(_0x30702f,_0x428433){_0x30702f=_0x30702f-0x0;var _0x514f48=_0x5956[_0x30702f];return _0x514f48;};'use strict';var jayson=require(_0x6595('0x0'));var _=require(_0x6595('0x1'));var config=require(_0x6595('0x2'));exports[_0x6595('0x3')]=function(){return new Promise(function(_0x6ec0d7,_0x4f1e31){var _0x5c1a88={};_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x5')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x6')));_0x5c1a88=_['merge'](_0x5c1a88,require('../api/voiceQueue/voiceQueue.rpc'));_0x5c1a88=_['merge'](_0x5c1a88,require(_0x6595('0x7')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x8')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x9')));_0x5c1a88=_['merge'](_0x5c1a88,require(_0x6595('0xa')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0xb')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0xc')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0xd')));_0x5c1a88=_['merge'](_0x5c1a88,require(_0x6595('0xe')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0xf')));_0x5c1a88=_['merge'](_0x5c1a88,require(_0x6595('0x10')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require('../api/mailQueue/mailQueue.rpc'));_0x5c1a88=_['merge'](_0x5c1a88,require(_0x6595('0x11')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x12')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x13')));_0x5c1a88=_['merge'](_0x5c1a88,require(_0x6595('0x14')));_0x5c1a88=_['merge'](_0x5c1a88,require(_0x6595('0x15')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x16')));_0x5c1a88=_['merge'](_0x5c1a88,require('../api/faxInteraction/faxInteraction.rpc'));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require('../api/faxMessage/faxMessage.rpc'));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x17')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x18')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x19')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x1a')));_0x5c1a88=_['merge'](_0x5c1a88,require('../api/smsQueue/smsQueue.rpc'));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x1b')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x1c')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x1d')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x1e')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x1f')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x20')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x21')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x22')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x23')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x24')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x25')));_0x5c1a88=_['merge'](_0x5c1a88,require(_0x6595('0x26')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x27')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x28')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x29')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require('../api/pause/pause.rpc'));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require('../api/sound/sound.rpc'));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require('../api/template/template.rpc'));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require('../api/trigger/trigger.rpc'));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x2a')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x2b')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x2c')));_0x5c1a88=_['merge'](_0x5c1a88,require(_0x6595('0x2d')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x2e')));_0x5c1a88=_['merge'](_0x5c1a88,require(_0x6595('0x2f')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x30')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x31')));_0x5c1a88=_['merge'](_0x5c1a88,require(_0x6595('0x32')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x33')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x34')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x35')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x36')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x37')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require('../api/squareProject/squareProject.rpc'));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x38')));_0x5c1a88=_['merge'](_0x5c1a88,require('../api/squareMessage/squareMessage.rpc'));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require('../api/campaign/campaign.rpc'));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x39')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x3a')));_0x5c1a88=_['merge'](_0x5c1a88,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x3b')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x5c1a88=_['merge'](_0x5c1a88,require(_0x6595('0x3c')));_0x5c1a88=_[_0x6595('0x4')](_0x5c1a88,require(_0x6595('0x3d')));var _0x3956ae=jayson['server'](_0x5c1a88)[_0x6595('0x3e')]();var _0x1c8160=config['rpc'][_0x6595('0x3f')]||config[_0x6595('0x3f')]+0x1;var _0x5cecba=config[_0x6595('0x40')]['ip']||_0x6595('0x41');_0x3956ae['on'](_0x6595('0x42'),function(_0x38823e){return _0x4f1e31(_0x38823e);});_0x3956ae[_0x6595('0x3')](_0x1c8160,_0x5cecba,function(){console['log'](_0x6595('0x43'),_0x5cecba,_0x1c8160);require(_0x6595('0x44'))[_0x6595('0x45')]();return _0x6ec0d7(_0x6595('0x46')+_0x5cecba+':'+_0x1c8160);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 6858f00..83f9597 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 _0xaf62=['hangup','substring','520-Invalid','520\x20End\x20of\x20proper','no\x20code','replace','indexOf','startsWith','split','length','match','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','function','write','prototype','sendRequest','answer','ANSWER','getData','beep','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','events','EventEmitter','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase'];(function(_0x55c6be,_0x113560){var _0x3fd017=function(_0x3ff1b9){while(--_0x3ff1b9){_0x55c6be['push'](_0x55c6be['shift']());}};_0x3fd017(++_0x113560);}(_0xaf62,0x174));var _0x2af6=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xaf62[_0x618414];return _0x21c19a;};'use strict';var util=require('util');var _=require(_0x2af6('0x0'));var EventEmitter=require(_0x2af6('0x1'))[_0x2af6('0x2')];var AGIReply=require('./reply');var AGIError=require(_0x2af6('0x3'));function AGIChannel(_0x1330b0){var _0xb10524=this,_0x13a7c7=new AGIReply(),_0x359bb3=![],_0x5d6a21={};EventEmitter[_0x2af6('0x4')](_0xb10524);_0x1330b0[_0x2af6('0x5')](_0x2af6('0x6'));_0x1330b0[_0x2af6('0x7')](0x8*0x3c*0x3c*0x3e8);_0x13a7c7['setEncoding'](_0x2af6('0x6'));_0x13a7c7['on'](_0x2af6('0x8'),function(_0x35b1c0){for(var _0x2be510 in _0x35b1c0){_0xb10524[_0x2be510]=_0x35b1c0[_0x2be510];}_0xb10524[_0x2af6('0x9')](_0x2af6('0xa'));});_0x13a7c7['on'](_0x2af6('0xb'),function(_0x42bbfb){if(_0x42bbfb[_0x2af6('0xc')]()==_0x2af6('0xd')){_0xb10524['emit'](_0x2af6('0xd'));return;}if(_0x42bbfb[_0x2af6('0xe')](0x0,0xb)==_0x2af6('0xf')){_0x359bb3=!![];}if(_0x359bb3){_0x5d6a21['rx']+=_0x42bbfb+'\x0a';if(_0x42bbfb['search'](_0x2af6('0x10'))!=-0x1){_0x359bb3=![];}}else{_0x5d6a21['rx']=_0x42bbfb;}if(_0x359bb3){return;}if(typeof _0x5d6a21['cb']=='function'){var _0x438ee1=_0x5d6a21['rx'][_0x2af6('0xe')](0x0,0x3),_0x3e4f4c=null,_0x5c509a=null;_0x438ee1=parseInt(_0x438ee1);if(isNaN(_0x438ee1)){_0x5d6a21['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x2af6('0x11')});return;}if(_0x438ee1!=0xc8){_0x5d6a21['cb'](null,{'code':_0x438ee1,'result':-0x1,'extra':'KO'});return;}_0x3e4f4c=_0x5d6a21['rx']['substring'](0x4)[_0x2af6('0x12')]('result=','');if(_0x3e4f4c['indexOf']('\x20')!=-0x1){_0x3e4f4c=_0x3e4f4c['substr'](0x0,_0x3e4f4c[_0x2af6('0x13')]('\x20'));}if(_[_0x2af6('0x14')](_0x3e4f4c,'-1')){_0x3e4f4c=parseInt(_0x3e4f4c);}_0x5c509a=_0x5d6a21['rx'][_0x2af6('0x15')]('\x20');if(_0x5c509a[_0x2af6('0x16')]==0x3){_0x5c509a=_0x5c509a[0x2][_0x2af6('0xe')](0x1,_0x5c509a[0x2]['length']-0x1);}else if(_0x5c509a[_0x2af6('0x16')]>0x3){var _0x3b7cfd=/\((.+)\)/;var _0x7f7a06=_0x5d6a21['rx'][_0x2af6('0x17')](_0x3b7cfd);if(_0x7f7a06){_0x5c509a=_0x7f7a06[0x1];}else{_0x5c509a=null;}}else{_0x5c509a=null;}_0x5d6a21['cb'](null,{'code':_0x438ee1,'result':_0x3e4f4c,'extra':_0x5c509a});}});_0x1330b0['on'](_0x2af6('0x18'),function(_0x222d34){_0xb10524[_0x2af6('0x9')](_0x2af6('0x18'),new AGIError('E_AGI_SOCKET_ERROR',_0x222d34[_0x2af6('0x19')]));});_0x1330b0['on'](_0x2af6('0x1a'),function(){_0xb10524[_0x2af6('0x9')](_0x2af6('0x1a'),new AGIError(_0x2af6('0x1b')));});_0x1330b0['on'](_0x2af6('0x1c'),function(){_0xb10524[_0x2af6('0x9')](_0x2af6('0x1c'),new AGIError(_0x2af6('0x1d')));_0x1330b0[_0x2af6('0x1e')]();});_0x1330b0[_0x2af6('0x1f')](_0x13a7c7);this['command']=function(_0x692e62,_0xebe735){var _0x692e62=_0x692e62||'',_0xebe735=typeof _0xebe735==_0x2af6('0x20')?_0xebe735:new Function();_0x5d6a21={'tx':_0x692e62,'rx':'','cb':_0xebe735};_0x1330b0[_0x2af6('0x21')](_0x692e62+'\x0a');},this[_0x2af6('0x1a')]=function(){_0x1330b0[_0x2af6('0x1e')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x2af6('0x22')][_0x2af6('0x23')]=function(_0x564eff){return this['command']['sync'](this,_0x564eff);};AGIChannel['prototype'][_0x2af6('0x24')]=function(){return this['sendRequest'](_0x2af6('0x25'));};AGIChannel[_0x2af6('0x22')][_0x2af6('0x26')]=function(_0x58a7fe,_0x1c7956,_0x265b83){_0x58a7fe=_0x58a7fe===undefined?_0x2af6('0x27'):_0x58a7fe;_0x1c7956=_0x1c7956===undefined?'5':_0x1c7956;_0x265b83=_0x265b83===undefined?'1':_0x265b83;return this[_0x2af6('0x23')](util[_0x2af6('0x28')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x58a7fe,_0x1c7956*0x3e8,_0x265b83));};AGIChannel['prototype'][_0x2af6('0x29')]=function(_0x4059d9){_0x4059d9=_0x4059d9||_0x2af6('0x2a');return this['sendRequest'](util[_0x2af6('0x28')](_0x2af6('0x2b'),_0x4059d9));};AGIChannel[_0x2af6('0x22')][_0x2af6('0x2c')]=function(_0x32a88c,_0x4110f1){if(_[_0x2af6('0x2d')](_0x4110f1)){return this['sendRequest'](util[_0x2af6('0x28')](_0x2af6('0x2e'),_0x32a88c,_0x4110f1[_0x2af6('0x2f')](',')));}return this[_0x2af6('0x23')](util[_0x2af6('0x28')](_0x2af6('0x2e'),_0x32a88c,_0x4110f1));};AGIChannel[_0x2af6('0x22')][_0x2af6('0x30')]=function(_0x59c027){return this['sendRequest'](util[_0x2af6('0x28')](_0x2af6('0x31'),_0x59c027));};AGIChannel[_0x2af6('0x22')][_0x2af6('0x32')]=function(_0x2596db){return this[_0x2af6('0x23')](util['format'](_0x2af6('0x33'),_0x2596db));};AGIChannel[_0x2af6('0x22')][_0x2af6('0x34')]=function(_0x5e6eb8){return this['sendRequest'](util[_0x2af6('0x28')](_0x2af6('0x35'),_0x5e6eb8));};AGIChannel['prototype'][_0x2af6('0xd')]=function(){return this['sendRequest']('HANGUP');};AGIChannel[_0x2af6('0x22')]['setVariable']=function(_0x96f826,_0x307fae){var _0x54e317=_[_0x2af6('0x36')](_0x307fae)||_[_0x2af6('0x37')](_0x307fae)?_0x307fae['toString']():_0x307fae;return this['sendRequest'](util[_0x2af6('0x28')](_0x2af6('0x38'),_0x96f826,_0x54e317?_0x54e317[_0x2af6('0x39')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x2af6('0x22')][_0x2af6('0x3a')]=function(_0x2008c8,_0x473be1){return this[_0x2af6('0x23')](util[_0x2af6('0x28')]('SAY\x20NUMBER\x20%s\x20%s',_0x2008c8,_0x473be1));};AGIChannel[_0x2af6('0x22')][_0x2af6('0x3b')]=function(_0x4f5434,_0x383a53){return this[_0x2af6('0x23')](util[_0x2af6('0x28')](_0x2af6('0x3c'),_0x4f5434,_0x383a53));};AGIChannel['prototype'][_0x2af6('0x3d')]=function(_0x5d52c3,_0x54fedc){return this[_0x2af6('0x23')](util[_0x2af6('0x28')](_0x2af6('0x3e'),_0x5d52c3,_0x54fedc));};AGIChannel[_0x2af6('0x22')][_0x2af6('0x3f')]=function(_0xe6f744,_0x75728c,_0x4d2e6c){_0x75728c=_0x75728c||this['extension'];_0x4d2e6c=_0x4d2e6c||0x1;this['setContext'](_0xe6f744);this['setExtension'](_0x75728c);this[_0x2af6('0x34')](_0x4d2e6c);return this[_0x2af6('0x29')](util['format']('GOTO\x20%s\x20%s\x20%s',_0xe6f744,_0x75728c,_0x4d2e6c));};AGIChannel['prototype'][_0x2af6('0x40')]=function(_0x236a3e){return this[_0x2af6('0x23')](util[_0x2af6('0x28')](_0x2af6('0x41'),_0x236a3e));};AGIChannel[_0x2af6('0x22')][_0x2af6('0x42')]=function(_0x3cbefe,_0x278cc5,_0xed171,_0x5ca7da,_0x34ade6,_0x149771){_0x278cc5=_0x278cc5||_0x2af6('0x43');_0xed171=_0xed171||'';_0x5ca7da=_0x5ca7da===undefined?-0x1:_0x5ca7da==='-1'?-0x1:_0x5ca7da*0x3e8;_0x34ade6=_0x34ade6===undefined?'':'s='+_0x34ade6;_0x149771=_0x149771?_0x2af6('0x44'):'';return this[_0x2af6('0x23')](util[_0x2af6('0x28')](_0x2af6('0x45'),_0x3cbefe,_0x278cc5,_0xed171,_0x5ca7da,_0x149771,_0x34ade6));};AGIChannel[_0x2af6('0x22')]['streamFile']=function(_0x1a90dc,_0x6be3dc){_0x6be3dc=_0x6be3dc||'';return this[_0x2af6('0x23')](util[_0x2af6('0x28')](_0x2af6('0x46'),_0x1a90dc,_0x6be3dc));};AGIChannel[_0x2af6('0x22')][_0x2af6('0x47')]=function(_0x2e010d){return this[_0x2af6('0x2c')](_0x2af6('0x48'),_0x2e010d);};AGIChannel[_0x2af6('0x22')]['wait']=function(_0x1bf5f6){return this[_0x2af6('0x2c')](_0x2af6('0x49'),_0x1bf5f6);};AGIChannel[_0x2af6('0x22')][_0x2af6('0x18')]=function(_0x452232,_0x218f1e){this[_0x2af6('0x29')](util[_0x2af6('0x28')](_0x2af6('0x4a'),_0x452232['id'],_0x452232[_0x2af6('0x4b')],_0x218f1e));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x2af6('0x4c')]=AGIChannel; \ No newline at end of file +var _0xd906=['join','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','events','EventEmitter','./reply','./error','call','utf8','setTimeout','setEncoding','headers','ready','line','toLowerCase','hangup','emit','520-Invalid','520\x20End\x20of\x20proper','substring','no\x20code','replace','result=','substr','indexOf','startsWith','split','length','match','error','code','close','timeout','E_AGI_SOCKET_TIMEOUT','function','write','destroy','inherits','prototype','sendRequest','command','sync','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','exec','isArray','EXEC\x20%s\x20%s'];(function(_0x2eb500,_0x23ed2b){var _0x5e4beb=function(_0x264c08){while(--_0x264c08){_0x2eb500['push'](_0x2eb500['shift']());}};_0x5e4beb(++_0x23ed2b);}(_0xd906,0x6b));var _0x6d90=function(_0x4a20d4,_0x28a033){_0x4a20d4=_0x4a20d4-0x0;var _0x40eaaf=_0xd906[_0x4a20d4];return _0x40eaaf;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x6d90('0x0'))[_0x6d90('0x1')];var AGIReply=require(_0x6d90('0x2'));var AGIError=require(_0x6d90('0x3'));function AGIChannel(_0x2653e){var _0x4d5bbd=this,_0x2ae140=new AGIReply(),_0x431c1e=![],_0x132c67={};EventEmitter[_0x6d90('0x4')](_0x4d5bbd);_0x2653e['setEncoding'](_0x6d90('0x5'));_0x2653e[_0x6d90('0x6')](0x8*0x3c*0x3c*0x3e8);_0x2ae140[_0x6d90('0x7')](_0x6d90('0x5'));_0x2ae140['on'](_0x6d90('0x8'),function(_0x5d0ed4){for(var _0x5f272f in _0x5d0ed4){_0x4d5bbd[_0x5f272f]=_0x5d0ed4[_0x5f272f];}_0x4d5bbd['emit'](_0x6d90('0x9'));});_0x2ae140['on'](_0x6d90('0xa'),function(_0x46586e){if(_0x46586e[_0x6d90('0xb')]()==_0x6d90('0xc')){_0x4d5bbd[_0x6d90('0xd')](_0x6d90('0xc'));return;}if(_0x46586e['substring'](0x0,0xb)==_0x6d90('0xe')){_0x431c1e=!![];}if(_0x431c1e){_0x132c67['rx']+=_0x46586e+'\x0a';if(_0x46586e['search'](_0x6d90('0xf'))!=-0x1){_0x431c1e=![];}}else{_0x132c67['rx']=_0x46586e;}if(_0x431c1e){return;}if(typeof _0x132c67['cb']=='function'){var _0x2e791b=_0x132c67['rx'][_0x6d90('0x10')](0x0,0x3),_0x3c5dc9=null,_0x1e4b32=null;_0x2e791b=parseInt(_0x2e791b);if(isNaN(_0x2e791b)){_0x132c67['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x6d90('0x11')});return;}if(_0x2e791b!=0xc8){_0x132c67['cb'](null,{'code':_0x2e791b,'result':-0x1,'extra':'KO'});return;}_0x3c5dc9=_0x132c67['rx'][_0x6d90('0x10')](0x4)[_0x6d90('0x12')](_0x6d90('0x13'),'');if(_0x3c5dc9['indexOf']('\x20')!=-0x1){_0x3c5dc9=_0x3c5dc9[_0x6d90('0x14')](0x0,_0x3c5dc9[_0x6d90('0x15')]('\x20'));}if(_[_0x6d90('0x16')](_0x3c5dc9,'-1')){_0x3c5dc9=parseInt(_0x3c5dc9);}_0x1e4b32=_0x132c67['rx'][_0x6d90('0x17')]('\x20');if(_0x1e4b32[_0x6d90('0x18')]==0x3){_0x1e4b32=_0x1e4b32[0x2]['substring'](0x1,_0x1e4b32[0x2][_0x6d90('0x18')]-0x1);}else if(_0x1e4b32['length']>0x3){var _0x379439=/\((.+)\)/;var _0x5dfc40=_0x132c67['rx'][_0x6d90('0x19')](_0x379439);if(_0x5dfc40){_0x1e4b32=_0x5dfc40[0x1];}else{_0x1e4b32=null;}}else{_0x1e4b32=null;}_0x132c67['cb'](null,{'code':_0x2e791b,'result':_0x3c5dc9,'extra':_0x1e4b32});}});_0x2653e['on'](_0x6d90('0x1a'),function(_0x352736){_0x4d5bbd[_0x6d90('0xd')]('error',new AGIError('E_AGI_SOCKET_ERROR',_0x352736[_0x6d90('0x1b')]));});_0x2653e['on']('close',function(){_0x4d5bbd[_0x6d90('0xd')](_0x6d90('0x1c'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x2653e['on']('timeout',function(){_0x4d5bbd[_0x6d90('0xd')](_0x6d90('0x1d'),new AGIError(_0x6d90('0x1e')));_0x2653e['destroy']();});_0x2653e['pipe'](_0x2ae140);this['command']=function(_0x4cac22,_0x2d07f9){var _0x4cac22=_0x4cac22||'',_0x2d07f9=typeof _0x2d07f9==_0x6d90('0x1f')?_0x2d07f9:new Function();_0x132c67={'tx':_0x4cac22,'rx':'','cb':_0x2d07f9};_0x2653e[_0x6d90('0x20')](_0x4cac22+'\x0a');},this[_0x6d90('0x1c')]=function(){_0x2653e[_0x6d90('0x21')]();};}util[_0x6d90('0x22')](AGIChannel,EventEmitter);AGIChannel[_0x6d90('0x23')][_0x6d90('0x24')]=function(_0x243a32){return this[_0x6d90('0x25')][_0x6d90('0x26')](this,_0x243a32);};AGIChannel['prototype'][_0x6d90('0x27')]=function(){return this[_0x6d90('0x24')](_0x6d90('0x28'));};AGIChannel['prototype'][_0x6d90('0x29')]=function(_0x1fefae,_0x20cbc6,_0x46d76b){_0x1fefae=_0x1fefae===undefined?_0x6d90('0x2a'):_0x1fefae;_0x20cbc6=_0x20cbc6===undefined?'5':_0x20cbc6;_0x46d76b=_0x46d76b===undefined?'1':_0x46d76b;return this[_0x6d90('0x24')](util[_0x6d90('0x2b')](_0x6d90('0x2c'),_0x1fefae,_0x20cbc6*0x3e8,_0x46d76b));};AGIChannel[_0x6d90('0x23')][_0x6d90('0x2d')]=function(_0x5eea54){_0x5eea54=_0x5eea54||'NO\x20MESSAGE';return this['sendRequest'](util[_0x6d90('0x2b')]('VERBOSE\x20\x22%s\x22',_0x5eea54));};AGIChannel[_0x6d90('0x23')][_0x6d90('0x2e')]=function(_0x148cf5,_0x3802fb){if(_[_0x6d90('0x2f')](_0x3802fb)){return this[_0x6d90('0x24')](util[_0x6d90('0x2b')](_0x6d90('0x30'),_0x148cf5,_0x3802fb[_0x6d90('0x31')](',')));}return this[_0x6d90('0x24')](util[_0x6d90('0x2b')](_0x6d90('0x30'),_0x148cf5,_0x3802fb));};AGIChannel[_0x6d90('0x23')]['setContext']=function(_0x385758){return this[_0x6d90('0x24')](util['format'](_0x6d90('0x32'),_0x385758));};AGIChannel[_0x6d90('0x23')]['setExtension']=function(_0x3e5000){return this[_0x6d90('0x24')](util[_0x6d90('0x2b')](_0x6d90('0x33'),_0x3e5000));};AGIChannel[_0x6d90('0x23')][_0x6d90('0x34')]=function(_0x216590){return this[_0x6d90('0x24')](util[_0x6d90('0x2b')](_0x6d90('0x35'),_0x216590));};AGIChannel[_0x6d90('0x23')][_0x6d90('0xc')]=function(){return this[_0x6d90('0x24')](_0x6d90('0x36'));};AGIChannel[_0x6d90('0x23')][_0x6d90('0x37')]=function(_0x20987c,_0x118b03){var _0x47eed0=_[_0x6d90('0x38')](_0x118b03)||_['isNumber'](_0x118b03)?_0x118b03[_0x6d90('0x39')]():_0x118b03;return this[_0x6d90('0x24')](util['format'](_0x6d90('0x3a'),_0x20987c,_0x47eed0?_0x47eed0[_0x6d90('0x39')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x6d90('0x23')][_0x6d90('0x3b')]=function(_0x2bfaf1,_0xae7292){return this[_0x6d90('0x24')](util['format'](_0x6d90('0x3c'),_0x2bfaf1,_0xae7292));};AGIChannel[_0x6d90('0x23')][_0x6d90('0x3d')]=function(_0x58f0b9,_0xa1eb2d){return this['sendRequest'](util[_0x6d90('0x2b')]('SAY\x20DIGITS\x20%s\x20%s',_0x58f0b9,_0xa1eb2d));};AGIChannel['prototype'][_0x6d90('0x3e')]=function(_0x2ac762,_0x389e97){return this[_0x6d90('0x24')](util[_0x6d90('0x2b')](_0x6d90('0x3f'),_0x2ac762,_0x389e97));};AGIChannel[_0x6d90('0x23')][_0x6d90('0x40')]=function(_0x12c5a8,_0x1bc06a,_0x50e00e){_0x1bc06a=_0x1bc06a||this['extension'];_0x50e00e=_0x50e00e||0x1;this['setContext'](_0x12c5a8);this['setExtension'](_0x1bc06a);this['setPriority'](_0x50e00e);return this['noop'](util[_0x6d90('0x2b')]('GOTO\x20%s\x20%s\x20%s',_0x12c5a8,_0x1bc06a,_0x50e00e));};AGIChannel[_0x6d90('0x23')][_0x6d90('0x41')]=function(_0x3485dd){return this[_0x6d90('0x24')](util['format'](_0x6d90('0x42'),_0x3485dd));};AGIChannel['prototype'][_0x6d90('0x43')]=function(_0x401c3c,_0x41d8f5,_0x45e413,_0x1cc539,_0x5d39d0,_0xb9d4d5){_0x41d8f5=_0x41d8f5||_0x6d90('0x44');_0x45e413=_0x45e413||'';_0x1cc539=_0x1cc539===undefined?-0x1:_0x1cc539==='-1'?-0x1:_0x1cc539*0x3e8;_0x5d39d0=_0x5d39d0===undefined?'':'s='+_0x5d39d0;_0xb9d4d5=_0xb9d4d5?_0x6d90('0x45'):'';return this[_0x6d90('0x24')](util[_0x6d90('0x2b')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x401c3c,_0x41d8f5,_0x45e413,_0x1cc539,_0xb9d4d5,_0x5d39d0));};AGIChannel[_0x6d90('0x23')][_0x6d90('0x46')]=function(_0x56b788,_0x262d80){_0x262d80=_0x262d80||'';return this[_0x6d90('0x24')](util['format']('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x56b788,_0x262d80));};AGIChannel[_0x6d90('0x23')][_0x6d90('0x47')]=function(_0x123560){return this[_0x6d90('0x2e')](_0x6d90('0x48'),_0x123560);};AGIChannel[_0x6d90('0x23')][_0x6d90('0x49')]=function(_0x180226){return this[_0x6d90('0x2e')](_0x6d90('0x4a'),_0x180226);};AGIChannel[_0x6d90('0x23')]['error']=function(_0x2d9af5,_0x4e241a){this['noop'](util['format'](_0x6d90('0x4b'),_0x2d9af5['id'],_0x2d9af5[_0x6d90('0x4c')],_0x4e241a));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x6d90('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 747585f..7ca1467 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 _0x2b4c=['format','apply','message','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push'];(function(_0x19d4dc,_0x46e8e0){var _0x1cf72f=function(_0x42402c){while(--_0x42402c){_0x19d4dc['push'](_0x19d4dc['shift']());}};_0x1cf72f(++_0x46e8e0);}(_0x2b4c,0xab));var _0xc2b4=function(_0x3be5db,_0x2b1238){_0x3be5db=_0x3be5db-0x0;var _0x5790d3=_0x2b4c[_0x3be5db];return _0x5790d3;};'use strict';var util=require(_0xc2b4('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0xc2b4('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0xc2b4('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0xc2b4('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0xc2b4('0x4'),'E_AGI_SOCKET_ERROR':_0xc2b4('0x5'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0xc2b4('0x6'),'E_AGI_COMMAND_EMPTY':_0xc2b4('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0xc2b4('0x8')};function AGIError(_0x37ff80){var _0x37ff80=_0x37ff80||null,_0x2806fa=_0x2806fa||[],_0x25f154=0x1,_0x2685be='';if(!error[_0x37ff80]){_0x37ff80=_0xc2b4('0x9');}_0x2806fa[_0xc2b4('0xa')](error[_0x37ff80]);while(arguments[_0x25f154]){_0x2806fa[_0xc2b4('0xa')](arguments[_0x25f154]);_0x25f154++;}_0x2685be=util[_0xc2b4('0xb')][_0xc2b4('0xc')](util,_0x2806fa);this[_0xc2b4('0xd')]=_0x2685be;this['name']=_0x37ff80;}module['exports']=AGIError; \ No newline at end of file +var _0x8bfe=['Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Missing\x20\x27ivr.agi_network_script\x27.','push','apply','message','name','exports','util'];(function(_0x5a40ed,_0x269b3a){var _0x2b7a52=function(_0x4f7ce2){while(--_0x4f7ce2){_0x5a40ed['push'](_0x5a40ed['shift']());}};_0x2b7a52(++_0x269b3a);}(_0x8bfe,0x12a));var _0xe8bf=function(_0x25f3e3,_0x207891){_0x25f3e3=_0x25f3e3-0x0;var _0xa89b6d=_0x8bfe[_0x25f3e3];return _0xa89b6d;};'use strict';var util=require(_0xe8bf('0x0'));var error={'E_AGI_UNDEFINED':_0xe8bf('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xe8bf('0x2'),'E_AGI_SERVER_CLOSE':_0xe8bf('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xe8bf('0x4'),'E_AGI_SOCKET_ERROR':_0xe8bf('0x5'),'E_AGI_SOCKET_CLOSE':_0xe8bf('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xe8bf('0x7'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x33bede){var _0x33bede=_0x33bede||null,_0x2dd4aa=_0x2dd4aa||[],_0x1deded=0x1,_0x17ec36='';if(!error[_0x33bede]){_0x33bede='E_AGI_UNDEFINED';}_0x2dd4aa[_0xe8bf('0x8')](error[_0x33bede]);while(arguments[_0x1deded]){_0x2dd4aa[_0xe8bf('0x8')](arguments[_0x1deded]);_0x1deded++;}_0x17ec36=util['format'][_0xe8bf('0x9')](util,_0x2dd4aa);this[_0xe8bf('0xa')]=_0x17ec36;this[_0xe8bf('0xb')]=_0x33bede;}module[_0xe8bf('0xc')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 7043aea..08773ed 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 _0x37df=['emit','E_AGI_SERVER_ERROR','message','parse','projectUpdate','error','exports','lodash','events','EventEmitter','ioredis','../../config/environment','redis','defaults','localhost','subscribe','agi'];(function(_0x59e4cb,_0x5c953d){var _0x4aadf1=function(_0x425909){while(--_0x425909){_0x59e4cb['push'](_0x59e4cb['shift']());}};_0x4aadf1(++_0x5c953d);}(_0x37df,0x8f));var _0xf37d=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x37df[_0x186376];return _0x2dbdd9;};'use strict';var _=require(_0xf37d('0x0'));var EventEmitter=require(_0xf37d('0x1'))[_0xf37d('0x2')];var Redis=require(_0xf37d('0x3'));var AGIError=require('./error');var config=require(_0xf37d('0x4'));config[_0xf37d('0x5')]=_[_0xf37d('0x6')](config[_0xf37d('0x5')],{'host':_0xf37d('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0xf37d('0x8')](_0xf37d('0x9'),function(_0x359319){if(_0x359319)return eventEmitter[_0xf37d('0xa')]('error',new AGIError(_0xf37d('0xb'),_0x359319));});sub['on'](_0xf37d('0xc'),function(_0x2ad751,_0x49c849){if(_0x2ad751!=='agi')return;try{var _0x3dc661=JSON[_0xf37d('0xd')](_0x49c849);eventEmitter[_0xf37d('0xa')](_0xf37d('0xe'),_0x3dc661);}catch(_0x45bd67){eventEmitter['emit'](_0xf37d('0xf'),new AGIError('E_AGI_SERVER_ERROR',_0x45bd67));}});module[_0xf37d('0x10')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x75fa=['./error','../../config/environment','redis','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','parse','projectUpdate','exports','lodash','events','EventEmitter','ioredis'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x75fa,0xce));var _0xa75f=function(_0x50b731,_0x1e16a7){_0x50b731=_0x50b731-0x0;var _0x34a53d=_0x75fa[_0x50b731];return _0x34a53d;};'use strict';var _=require(_0xa75f('0x0'));var EventEmitter=require(_0xa75f('0x1'))[_0xa75f('0x2')];var Redis=require(_0xa75f('0x3'));var AGIError=require(_0xa75f('0x4'));var config=require(_0xa75f('0x5'));config[_0xa75f('0x6')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0xa75f('0x7')](_0xa75f('0x8'),function(_0x56c34d){if(_0x56c34d)return eventEmitter[_0xa75f('0x9')](_0xa75f('0xa'),new AGIError(_0xa75f('0xb'),_0x56c34d));});sub['on']('message',function(_0xc61324,_0x1b573a){if(_0xc61324!==_0xa75f('0x8'))return;try{var _0x3a2c27=JSON[_0xa75f('0xc')](_0x1b573a);eventEmitter[_0xa75f('0x9')](_0xa75f('0xd'),_0x3a2c27);}catch(_0x339c51){eventEmitter['emit'](_0xa75f('0xa'),new AGIError(_0xa75f('0xb'),_0x339c51));}});module[_0xa75f('0xe')]={'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 1e55bcf..c57cbe8 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 _0xbbe7=['menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addEdge','push','size','relations','getVertex','traverseBFS','info','stop\x20traverse','length','condition','split','agicommand','vswitch','target','default','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','lodash','../../../config/logger','agi'];(function(_0x3eb2a8,_0x279891){var _0x4b1601=function(_0x415581){while(--_0x415581){_0x3eb2a8['push'](_0x3eb2a8['shift']());}};_0x4b1601(++_0x279891);}(_0xbbe7,0x10b));var _0x7bbe=function(_0x4a9a4c,_0x3dd24e){_0x4a9a4c=_0x4a9a4c-0x0;var _0x3cbf13=_0xbbe7[_0x4a9a4c];return _0x3cbf13;};'use strict';var _=require(_0x7bbe('0x0'));var logger=require(_0x7bbe('0x1'))(_0x7bbe('0x2'));var verticesWithRetry=[_0x7bbe('0x3'),_0x7bbe('0x4'),_0x7bbe('0x5')];var Graph=function(){this[_0x7bbe('0x6')]={};this[_0x7bbe('0x7')]={};this[_0x7bbe('0x8')]=0x0;};Graph[_0x7bbe('0x9')]['addVertex']=function(_0x307a32){this[_0x7bbe('0x6')][_0x307a32['id']]=_0x307a32;this[_0x7bbe('0x7')][_0x307a32['id']]=[];};Graph['prototype'][_0x7bbe('0xa')]=function(_0xb862b3,_0x694c56,_0x18fa7a){this[_0x7bbe('0x7')][_0xb862b3][_0x7bbe('0xb')]({'target':_0x694c56,'condition':_0x18fa7a});this[_0x7bbe('0x8')]+=0x1;};Graph[_0x7bbe('0x9')][_0x7bbe('0xc')]=function(){return _[_0x7bbe('0xc')](this[_0x7bbe('0x6')]);};Graph[_0x7bbe('0x9')][_0x7bbe('0xd')]=function(){return this[_0x7bbe('0x8')];};Graph[_0x7bbe('0x9')][_0x7bbe('0xe')]=function(_0x496bbe){return this[_0x7bbe('0x6')][_0x496bbe];};Graph[_0x7bbe('0x9')][_0x7bbe('0xf')]=function(_0x39230b,_0x194a05){if(!this[_0x7bbe('0x6')][_0x39230b]){return logger[_0x7bbe('0x10')]('no\x20vertex\x20found');}var _0x10d823=_0x194a05(this['vertices'][_0x39230b]);if(!_0x10d823){return logger['info'](_0x7bbe('0x11'));}if(this[_0x7bbe('0x7')][_0x39230b][_0x7bbe('0x12')]===0x0){return logger[_0x7bbe('0x10')]('no\x20edge/s\x20available');}for(var _0x5e847e=0x0,_0x2522d5=[],_0x57c96c=![];_0x5e847e\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','hangup','find','handleNotFound','production','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','catch','finally','listening','connection','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','defaults','127.0.0.1'];(function(_0x2f6269,_0x30aa0f){var _0x120627=function(_0x40b947){while(--_0x40b947){_0x2f6269['push'](_0x2f6269['shift']());}};_0x120627(++_0x30aa0f);}(_0x8e26,0x149));var _0x68e2=function(_0x39c2b4,_0x28d263){_0x39c2b4=_0x39c2b4-0x0;var _0x53305f=_0x8e26[_0x39c2b4];return _0x53305f;};'use strict';var _=require(_0x68e2('0x0'));var syncho=require(_0x68e2('0x1'));var util=require(_0x68e2('0x2'));var config=require(_0x68e2('0x3'));var logger=require(_0x68e2('0x4'))(_0x68e2('0x5'));var utilLicense=require(_0x68e2('0x6'));var rpc=require(_0x68e2('0x7'));var Project=require(_0x68e2('0x8'));var AGIEmitter=require(_0x68e2('0x9'))[_0x68e2('0xa')];var projects=[];config[_0x68e2('0x5')]=_[_0x68e2('0xb')](config['agi'],{'ip':_0x68e2('0xc'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x36ac2e){process[_0x68e2('0xd')](function(){syncho(function(){try{setChannelVariables(_0x36ac2e);agiHandler(_0x36ac2e);}catch(_0x4161db){logger['error'](_0x4161db['stack']);}});});}function projectUpdateHandler(_0x49ba79){try{var _0x3ba3ff=_[_0x68e2('0xe')](projects,['id',_0x49ba79['id']]);if(_0x3ba3ff>-0x1){if(_0x49ba79[_0x68e2('0xf')]===!![]){projects[_0x68e2('0x10')](_0x3ba3ff,0x1);}else{projects[_0x3ba3ff]=_0x49ba79;}}else{projects[_0x68e2('0x11')](_0x49ba79);}}catch(_0x20e66b){logger[_0x68e2('0x12')](_0x20e66b[_0x68e2('0x13')]);}}function listeningHandler(){console[_0x68e2('0x14')](_0x68e2('0x15'),config[_0x68e2('0x5')][_0x68e2('0x16')]);logger[_0x68e2('0x17')](util[_0x68e2('0x18')](_0x68e2('0x19'),config[_0x68e2('0x5')]['ip'],config['agi']['port']));}function errorHandler(_0x5bddb8){if(_0x5bddb8&&_0x5bddb8[_0x68e2('0x1a')]&&_0x5bddb8[_0x68e2('0x1b')]){logger['error'](util[_0x68e2('0x18')]('[%s]\x20%s',_0x5bddb8['name'],_0x5bddb8[_0x68e2('0x1b')]));}else{logger['error'](util[_0x68e2('0x18')](_0x68e2('0x1c'),_0x5bddb8[_0x68e2('0x13')]));}}function closeHandler(){logger[_0x68e2('0x17')](util[_0x68e2('0x18')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x68e2('0x1d')],this[_0x68e2('0x1e')],this['callerid'],this[_0x68e2('0x1f')],this[_0x68e2('0x20')]));try{createSquareReport(this);}catch(_0x908135){logger[_0x68e2('0x12')](_0x908135[_0x68e2('0x13')]);}}function timeoutHandler(){logger['info'](util[_0x68e2('0x18')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x68e2('0x1d')],this['calleridname'],this[_0x68e2('0x21')],this[_0x68e2('0x1f')],this[_0x68e2('0x20')]));}function hangupHandler(){logger['info'](util[_0x68e2('0x18')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x68e2('0x1e')],this[_0x68e2('0x21')],this['dnid'],this[_0x68e2('0x20')]));this['evtHangup']=!![];}function createSquareReport(_0x56dcd7,_0x2e49cf){rpc['createSquareReport'](_0x56dcd7)[_0x68e2('0x22')](function(_0x494e08){if(_0x2e49cf){_0x2e49cf(null,_0x494e08);}})['catch'](function(_0x40970f){if(_0x2e49cf){_0x2e49cf(null,_0x40970f);}});}function setChannelVariables(_0x411d36){for(var _0x275ce5 in _0x411d36){if(_0x411d36[_0x68e2('0x23')](_0x275ce5)){if(_0x275ce5[_0x68e2('0x24')]('agi_')===0x0){_0x411d36[_0x275ce5[_0x68e2('0x25')](0x4)]=_0x411d36[_0x275ce5];delete _0x411d36[_0x275ce5];}}}}function agiHandler(_0x4247c4){logger[_0x68e2('0x26')](_0x68e2('0x27'),JSON['stringify'](_0x4247c4,null,0x2));logger[_0x68e2('0x17')](util[_0x68e2('0x18')](_0x68e2('0x28'),_0x4247c4['arg_1'],_0x4247c4[_0x68e2('0x1e')],_0x4247c4[_0x68e2('0x21')],_0x4247c4[_0x68e2('0x1f')],_0x4247c4[_0x68e2('0x20')]));_0x4247c4['on'](_0x68e2('0x12'),errorHandler);_0x4247c4['on'](_0x68e2('0x29'),closeHandler);_0x4247c4['on'](_0x68e2('0x2a'),timeoutHandler);_0x4247c4[_0x68e2('0x2b')]=![];_0x4247c4['on'](_0x68e2('0x2c'),hangupHandler);var _0x3aa84a=_[_0x68e2('0x2d')](projects,[_0x68e2('0x1a'),_0x4247c4[_0x68e2('0x1d')]]);if(!_0x3aa84a)return Project[_0x68e2('0x2e')](_0x4247c4);if(!_0x3aa84a[_0x68e2('0x2f')])return Project['handleUnpublished'](_0x4247c4);return Project['initialize'](_0x3aa84a,_0x4247c4);}function main(){var _0x589b90;return utilLicense[_0x68e2('0x30')]()['then'](function(_0x56684c){if(!_0x56684c)return;if(_0x56684c['voice']){if(_0x56684c[_0x68e2('0x31')]&&_0x56684c['callysquare']>0x0){logger[_0x68e2('0x17')](util[_0x68e2('0x18')]('[LICENSE]\x20CHANNELS:\x20%s',_0x56684c['callysquare']));_0x589b90=_0x56684c['callysquare'];}else{logger[_0x68e2('0x17')](_0x68e2('0x32'));}}else{logger[_0x68e2('0x17')](_0x68e2('0x33'));_0x589b90=-0x1;}})[_0x68e2('0x22')](function(){return Project[_0x68e2('0x34')]();})[_0x68e2('0x22')](function(_0x1d6501){projects=_0x1d6501;return;})[_0x68e2('0x35')](function(_0x54134f){logger[_0x68e2('0x12')]('[LICENSE]',_0x54134f[_0x68e2('0x13')]);})[_0x68e2('0x36')](function(){var _0x188267=require('./server')(config[_0x68e2('0x5')]['port'],config['agi']['ip'],_0x589b90);_0x188267['on'](_0x68e2('0x12'),errorHandler);_0x188267['on'](_0x68e2('0x37'),listeningHandler);_0x188267['on'](_0x68e2('0x38'),connectionHandler);_0x188267['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0xb8c0=['util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','defaults','projectUpdate','error','stack','splice','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','createSquareReport','catch','hasOwnProperty','indexOf','agi_','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','find','handleNotFound','production','handleUnpublished','initialize','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','./server','listening','connection'];(function(_0x3510c2,_0x396bf6){var _0x191fb0=function(_0x1e3f44){while(--_0x1e3f44){_0x3510c2['push'](_0x3510c2['shift']());}};_0x191fb0(++_0x396bf6);}(_0xb8c0,0x162));var _0x0b8c=function(_0x23a816,_0x98b254){_0x23a816=_0x23a816-0x0;var _0x26a1a3=_0xb8c0[_0x23a816];return _0x26a1a3;};'use strict';var _=require('lodash');var syncho=require('syncho');var util=require(_0x0b8c('0x0'));var config=require(_0x0b8c('0x1'));var logger=require(_0x0b8c('0x2'))(_0x0b8c('0x3'));var utilLicense=require(_0x0b8c('0x4'));var rpc=require(_0x0b8c('0x5'));var Project=require(_0x0b8c('0x6'));var AGIEmitter=require(_0x0b8c('0x7'))[_0x0b8c('0x8')];var projects=[];config[_0x0b8c('0x3')]=_[_0x0b8c('0x9')](config[_0x0b8c('0x3')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x0b8c('0xa'),projectUpdateHandler);function connectionHandler(_0x1c80f2){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x1c80f2);agiHandler(_0x1c80f2);}catch(_0x303606){logger[_0x0b8c('0xb')](_0x303606[_0x0b8c('0xc')]);}});});}function projectUpdateHandler(_0x1349f9){try{var _0x24df04=_['findIndex'](projects,['id',_0x1349f9['id']]);if(_0x24df04>-0x1){if(_0x1349f9['deleted']===!![]){projects[_0x0b8c('0xd')](_0x24df04,0x1);}else{projects[_0x24df04]=_0x1349f9;}}else{projects[_0x0b8c('0xe')](_0x1349f9);}}catch(_0x24913d){logger[_0x0b8c('0xb')](_0x24913d['stack']);}}function listeningHandler(){console[_0x0b8c('0xf')](_0x0b8c('0x10'),config['agi']['port']);logger[_0x0b8c('0x11')](util[_0x0b8c('0x12')](_0x0b8c('0x13'),config[_0x0b8c('0x3')]['ip'],config['agi']['port']));}function errorHandler(_0x45d225){if(_0x45d225&&_0x45d225[_0x0b8c('0x14')]&&_0x45d225[_0x0b8c('0x15')]){logger['error'](util[_0x0b8c('0x12')](_0x0b8c('0x16'),_0x45d225[_0x0b8c('0x14')],_0x45d225[_0x0b8c('0x15')]));}else{logger[_0x0b8c('0xb')](util[_0x0b8c('0x12')]('[ERROR]\x20%s',_0x45d225[_0x0b8c('0xc')]));}}function closeHandler(){logger[_0x0b8c('0x11')](util['format'](_0x0b8c('0x17'),this[_0x0b8c('0x18')],this[_0x0b8c('0x19')],this[_0x0b8c('0x1a')],this[_0x0b8c('0x1b')],this[_0x0b8c('0x1c')]));try{createSquareReport(this);}catch(_0x139f7a){logger[_0x0b8c('0xb')](_0x139f7a[_0x0b8c('0xc')]);}}function timeoutHandler(){logger[_0x0b8c('0x11')](util[_0x0b8c('0x12')](_0x0b8c('0x1d'),this[_0x0b8c('0x18')],this[_0x0b8c('0x19')],this[_0x0b8c('0x1a')],this[_0x0b8c('0x1b')],this[_0x0b8c('0x1c')]));}function hangupHandler(){logger[_0x0b8c('0x11')](util[_0x0b8c('0x12')](_0x0b8c('0x1e'),this[_0x0b8c('0x18')],this['calleridname'],this['callerid'],this[_0x0b8c('0x1b')],this[_0x0b8c('0x1c')]));this['evtHangup']=!![];}function createSquareReport(_0x3e7e61,_0x47e6f5){rpc[_0x0b8c('0x1f')](_0x3e7e61)['then'](function(_0x3befbe){if(_0x47e6f5){_0x47e6f5(null,_0x3befbe);}})[_0x0b8c('0x20')](function(_0x392e4f){if(_0x47e6f5){_0x47e6f5(null,_0x392e4f);}});}function setChannelVariables(_0x15fe94){for(var _0x4c0f37 in _0x15fe94){if(_0x15fe94[_0x0b8c('0x21')](_0x4c0f37)){if(_0x4c0f37[_0x0b8c('0x22')](_0x0b8c('0x23'))===0x0){_0x15fe94[_0x4c0f37['substring'](0x4)]=_0x15fe94[_0x4c0f37];delete _0x15fe94[_0x4c0f37];}}}}function agiHandler(_0x479ee5){logger[_0x0b8c('0x24')](_0x0b8c('0x25'),JSON[_0x0b8c('0x26')](_0x479ee5,null,0x2));logger[_0x0b8c('0x11')](util['format'](_0x0b8c('0x27'),_0x479ee5[_0x0b8c('0x18')],_0x479ee5[_0x0b8c('0x19')],_0x479ee5[_0x0b8c('0x1a')],_0x479ee5[_0x0b8c('0x1b')],_0x479ee5[_0x0b8c('0x1c')]));_0x479ee5['on'](_0x0b8c('0xb'),errorHandler);_0x479ee5['on'](_0x0b8c('0x28'),closeHandler);_0x479ee5['on']('timeout',timeoutHandler);_0x479ee5['evtHangup']=![];_0x479ee5['on'](_0x0b8c('0x29'),hangupHandler);var _0x4f5326=_[_0x0b8c('0x2a')](projects,[_0x0b8c('0x14'),_0x479ee5[_0x0b8c('0x18')]]);if(!_0x4f5326)return Project[_0x0b8c('0x2b')](_0x479ee5);if(!_0x4f5326[_0x0b8c('0x2c')])return Project[_0x0b8c('0x2d')](_0x479ee5);return Project[_0x0b8c('0x2e')](_0x4f5326,_0x479ee5);}function main(){var _0x4a207b;return utilLicense['getLicense']()[_0x0b8c('0x2f')](function(_0x3c6403){if(!_0x3c6403)return;if(_0x3c6403[_0x0b8c('0x30')]){if(_0x3c6403[_0x0b8c('0x31')]&&_0x3c6403[_0x0b8c('0x31')]>0x0){logger[_0x0b8c('0x11')](util[_0x0b8c('0x12')](_0x0b8c('0x32'),_0x3c6403[_0x0b8c('0x31')]));_0x4a207b=_0x3c6403[_0x0b8c('0x31')];}else{logger[_0x0b8c('0x11')](_0x0b8c('0x33'));}}else{logger[_0x0b8c('0x11')](_0x0b8c('0x34'));_0x4a207b=-0x1;}})[_0x0b8c('0x2f')](function(){return Project[_0x0b8c('0x35')]();})[_0x0b8c('0x2f')](function(_0x12b68d){projects=_0x12b68d;return;})[_0x0b8c('0x20')](function(_0x3b2ff8){logger[_0x0b8c('0xb')](_0x0b8c('0x36'),_0x3b2ff8[_0x0b8c('0xc')]);})[_0x0b8c('0x37')](function(){var _0x169292=require(_0x0b8c('0x38'))(config[_0x0b8c('0x3')]['port'],config[_0x0b8c('0x3')]['ip'],_0x4a207b);_0x169292['on'](_0x0b8c('0xb'),errorHandler);_0x169292['on'](_0x0b8c('0x39'),listeningHandler);_0x169292['on'](_0x0b8c('0x3a'),connectionHandler);_0x169292['on'](_0x0b8c('0x28'),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 d859696..68f46be 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 _0x73a6=['error','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x73a6,0x16c));var _0x673a=function(_0x33b507,_0xe48ac3){_0x33b507=_0x33b507-0x0;var _0x4d4309=_0x73a6[_0x33b507];return _0x4d4309;};'use strict';var BPromise=require(_0x673a('0x0'));var jayson=require(_0x673a('0x1'));var client=jayson[_0x673a('0x2')][_0x673a('0x3')]({'port':0x232b});function request(_0x4ca334,_0x1e7918){return new BPromise(function(_0x52555c,_0x469933){return client[_0x673a('0x4')](_0x4ca334,_0x1e7918)[_0x673a('0x5')](function(_0x23d3e6){if(_0x23d3e6['error']){return _0x469933(_0x23d3e6[_0x673a('0x6')]['message']);}else{return _0x52555c(_0x23d3e6['result']);}})[_0x673a('0x7')](function(_0x2cf15e){return _0x469933(_0x2cf15e);});});}exports[_0x673a('0x8')]=function(_0x4290c3,_0x23c19c){return request(_0x673a('0x9'),{'account':_0x4290c3,'message':_0x23c19c});}; \ No newline at end of file +var _0x6482=['http','request','then','error','message','result','catch','SendMail','bluebird','jayson/promise'];(function(_0x3be0c4,_0x5b7eff){var _0x11af9f=function(_0x3f5113){while(--_0x3f5113){_0x3be0c4['push'](_0x3be0c4['shift']());}};_0x11af9f(++_0x5b7eff);}(_0x6482,0x1ca));var _0x2648=function(_0x3d8f50,_0x213180){_0x3d8f50=_0x3d8f50-0x0;var _0x2d18c2=_0x6482[_0x3d8f50];return _0x2d18c2;};'use strict';var BPromise=require(_0x2648('0x0'));var jayson=require(_0x2648('0x1'));var client=jayson['client'][_0x2648('0x2')]({'port':0x232b});function request(_0x1a7613,_0x2f67e2){return new BPromise(function(_0xdaefd8,_0x2ed876){return client[_0x2648('0x3')](_0x1a7613,_0x2f67e2)[_0x2648('0x4')](function(_0x21fb0a){if(_0x21fb0a[_0x2648('0x5')]){return _0x2ed876(_0x21fb0a[_0x2648('0x5')][_0x2648('0x6')]);}else{return _0xdaefd8(_0x21fb0a[_0x2648('0x7')]);}})[_0x2648('0x8')](function(_0x57e7ca){return _0x2ed876(_0x57e7ca);});});}exports['sendMailMessage']=function(_0x2c21c9,_0x57f3c4){return request(_0x2648('0x9'),{'account':_0x2c21c9,'message':_0x57f3c4});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 30e53c3..5856bbe 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 _0xd213=['addEdge','source','target','toJson','mxGraphModel','inspect','production','debug','root','stringify','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','callerid','dnid','uniqueid','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','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','calleridname','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','close','Project\x20%s\x20not\x20found','exports','lodash','moment','xml2json','../../config/logger','agi','./rpc','./graph','./vertices','catch','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','omit','mxCell','isArray','length'];(function(_0xb62013,_0x115b81){var _0x6956fd=function(_0x265125){while(--_0x265125){_0xb62013['push'](_0xb62013['shift']());}};_0x6956fd(++_0x115b81);}(_0xd213,0xa7));var _0x3d21=function(_0x23fab5,_0x36e4ff){_0x23fab5=_0x23fab5-0x0;var _0x49c7b8=_0xd213[_0x23fab5];return _0x49c7b8;};'use strict';var _=require(_0x3d21('0x0'));var moment=require(_0x3d21('0x1'));var parser=require(_0x3d21('0x2'));var util=require('util');var logger=require(_0x3d21('0x3'))(_0x3d21('0x4'));var rpc=require(_0x3d21('0x5'));var mailRpc=require('./mailRpc');var Graph=require(_0x3d21('0x6'));var Vertices=require(_0x3d21('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0x3d21('0x8')](function(_0x207e40){logger['error'](_0x3d21('0x9'),_0x207e40[_0x3d21('0xa')]);return[];});}function addVertex(_0x192a52,_0x376d80,_0x36448e){_0x376d80[_0x3d21('0xb')]=_0x36448e;if(_0x376d80[_0x3d21('0xc')](_0x3d21('0xd'))){_0x376d80[_0x3d21('0xe')]=parseInt(_0x376d80[_0x3d21('0xd')],0xa);}_0x192a52['addVertex'](_[_0x3d21('0xf')](_0x376d80,_0x3d21('0x10')));}function initGraph(_0x151b98,_0x1a0448){var _0x22c347=new Graph();for(var _0x1f7386 in _0x151b98){if(_0x151b98[_0x3d21('0xc')](_0x1f7386)){if(_[_0x3d21('0x11')](_0x151b98[_0x1f7386])){for(var _0x519d4f=0x0;_0x519d4f<_0x151b98[_0x1f7386][_0x3d21('0x12')];_0x519d4f+=0x1){addVertex(_0x22c347,_0x151b98[_0x1f7386][_0x519d4f],_0x1f7386);}}else{addVertex(_0x22c347,_0x151b98[_0x1f7386],_0x1f7386);}}}for(var _0x2157fb=0x0;_0x2157fb<_0x1a0448[_0x3d21('0x12')];_0x2157fb+=0x1){if(_0x1a0448[_0x2157fb]['source']&&_0x1a0448[_0x2157fb]['target']){_0x22c347[_0x3d21('0x13')](_0x1a0448[_0x2157fb][_0x3d21('0x14')],_0x1a0448[_0x2157fb][_0x3d21('0x15')],_0x1a0448[_0x2157fb]['value']);}}return _0x22c347;}function getRoot(_0x40ff85){return parser[_0x3d21('0x16')](_0x40ff85,{'object':!![]})[_0x3d21('0x17')]['root'];}function inspect(_0x387ef9){return util[_0x3d21('0x18')](_0x387ef9,{'showHidden':![],'depth':null});}function initialize(_0xf10abd,_0x287a87){var _0xd82447=getRoot(_0xf10abd[_0x3d21('0x19')]);if(!_0xd82447||!_0xd82447['start'])return;var _0x458867,_0x15b75c,_0x55096e;logger[_0x3d21('0x1a')](_0x3d21('0x1b'),JSON[_0x3d21('0x1c')](_0xd82447,null,0x2));_0x287a87[_0x3d21('0x1d')]=moment()[_0x3d21('0x1e')](_0x3d21('0x1f'));_0x458867=initGraph(_[_0x3d21('0xf')](_0xd82447,_0x3d21('0x10')),_0xd82447['mxCell']);_0x15b75c=new Vertices(_0x287a87,rpc,mailRpc);logger[_0x3d21('0x20')](util[_0x3d21('0x1e')](_0x3d21('0x21'),_0x287a87[_0x3d21('0x22')],_0x287a87['calleridname'],_0x287a87[_0x3d21('0x23')],_0x287a87[_0x3d21('0x24')],_0x287a87[_0x3d21('0x25')]));_0x458867[_0x3d21('0x26')](_0xd82447['start']['id'],function(_0x4597ef){try{_0x4597ef=_0x15b75c[_0x3d21('0x27')](_0x4597ef);logger[_0x3d21('0x1a')](_0x3d21('0x28'),JSON[_0x3d21('0x1c')](_0x4597ef,null,0x2));if(_0x4597ef['agicommand']===_0x3d21('0x29')){logger[_0x3d21('0x20')](_0x3d21('0x2a'));_0x287a87[_0x3d21('0x2b')]=_0x4597ef[_0x3d21('0x2b')]||_0x287a87[_0x3d21('0x2b')];_0x287a87[_0x3d21('0x2c')]=_0x4597ef[_0x3d21('0x2c')];_0x287a87[_0x3d21('0x2d')]=_0x4597ef[_0x3d21('0x2d')]?_0x4597ef['priority']-0x1:0x1;return null;}else if(_0x4597ef&&_0x15b75c[_0x4597ef[_0x3d21('0xb')]]){_0x55096e=_0x15b75c[_0x4597ef[_0x3d21('0xb')]](_0x4597ef);logger[_0x3d21('0x20')](_0x3d21('0x2e'),JSON[_0x3d21('0x1c')](_0x55096e,null,0x2));if(_0x55096e&&_0x55096e[_0x3d21('0x2f')]===AGI_CODE_SUCCESS&&_0x55096e[_0x3d21('0x30')]!==AGI_RESULT_ERROR&&!_0x287a87[_0x3d21('0x31')]){logger[_0x3d21('0x1a')](_0x3d21('0x2e'),inspect(_0x55096e));return _[_0x3d21('0x32')](_0x55096e[_0x3d21('0x30')])?null:_0x55096e[_0x3d21('0x30')][_0x3d21('0x33')]();}else{logger[_0x3d21('0x34')](_0x3d21('0x2e'),inspect(_0x55096e));return null;}}else{logger[_0x3d21('0x34')](_0x3d21('0x35'));return null;}}catch(_0xc4bcfe){logger[_0x3d21('0x34')](_0xc4bcfe[_0x3d21('0xa')]);return null;}});if(_0xd82447[_0x3d21('0x36')]){logger['info'](util[_0x3d21('0x1e')](_0x3d21('0x37'),_0x287a87[_0x3d21('0x22')],_0x287a87[_0x3d21('0x38')],_0x287a87[_0x3d21('0x23')],_0x287a87[_0x3d21('0x24')],_0x287a87[_0x3d21('0x25')]));_0x458867[_0x3d21('0x26')](_0xd82447[_0x3d21('0x36')]['id'],function(_0x30d3cc){try{_0x30d3cc=_0x15b75c[_0x3d21('0x27')](_0x30d3cc);logger['debug'](_0x3d21('0x28'),JSON[_0x3d21('0x1c')](_0x30d3cc,null,0x2));if(_0x30d3cc&&_0x15b75c[_0x30d3cc[_0x3d21('0xb')]]){_0x55096e=_0x15b75c[_0x30d3cc['agicommand']](_0x30d3cc);if(_0x55096e){logger['debug']('response',inspect(_0x55096e));return _[_0x3d21('0x32')](_0x55096e['result'])?null:_0x55096e[_0x3d21('0x30')]['toString']();}else{logger[_0x3d21('0x34')](_0x3d21('0x2e'),inspect(_0x55096e));return null;}}else{logger[_0x3d21('0x34')]('agicommand\x20not\x20found');return null;}}catch(_0x2df95f){logger['error'](_0x2df95f['stack']);return null;}});}logger['info'](util['format'](_0x3d21('0x39'),_0x287a87[_0x3d21('0x22')],_0x287a87[_0x3d21('0x38')],_0x287a87[_0x3d21('0x23')],_0x287a87[_0x3d21('0x24')],_0x287a87[_0x3d21('0x25')]));logger[_0x3d21('0x20')](util[_0x3d21('0x1e')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x287a87[_0x3d21('0x2b')],_0x287a87[_0x3d21('0x2c')],parseInt(_0x287a87[_0x3d21('0x2d')],0xa)+0x1));_0x287a87[_0x3d21('0x3a')](_0x287a87[_0x3d21('0x2b')],_0x287a87[_0x3d21('0x2c')],parseInt(_0x287a87[_0x3d21('0x2d')],0xa)+0x1);_0x287a87[_0x3d21('0x3b')]();}function handleNotFound(_0x1ab3bf){logger[_0x3d21('0x34')](util[_0x3d21('0x1e')](_0x3d21('0x3c'),_0x1ab3bf['arg_1']));_0x1ab3bf[_0x3d21('0x3a')](_0x1ab3bf['context'],_0x1ab3bf[_0x3d21('0x2c')],parseInt(_0x1ab3bf[_0x3d21('0x2d')],0xa)+0x1);_0x1ab3bf[_0x3d21('0x3b')]();}function handleUnpublished(_0x4b21f9){logger['error'](util[_0x3d21('0x1e')]('Project\x20%s\x20not\x20published',_0x4b21f9[_0x3d21('0x22')]));_0x4b21f9[_0x3d21('0x3a')](_0x4b21f9[_0x3d21('0x2b')],_0x4b21f9[_0x3d21('0x2c')],parseInt(_0x4b21f9[_0x3d21('0x2d')],0xa)+0x1);_0x4b21f9['close']();}module[_0x3d21('0x3d')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x90e9=['close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','xml2json','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','stack','agicommand','maxRetry','retry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','root','inspect','production','start','debug','stringify','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','dnid','uniqueid','traverseBFS','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','evtHangup','isUndefined','result','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','clear','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','continueAt'];(function(_0x48bdd1,_0x13440d){var _0x5889b3=function(_0x457933){while(--_0x457933){_0x48bdd1['push'](_0x48bdd1['shift']());}};_0x5889b3(++_0x13440d);}(_0x90e9,0xc7));var _0x990e=function(_0x44f11b,_0x38d732){_0x44f11b=_0x44f11b-0x0;var _0x1c8879=_0x90e9[_0x44f11b];return _0x1c8879;};'use strict';var _=require(_0x990e('0x0'));var moment=require('moment');var parser=require(_0x990e('0x1'));var util=require('util');var logger=require(_0x990e('0x2'))(_0x990e('0x3'));var rpc=require(_0x990e('0x4'));var mailRpc=require(_0x990e('0x5'));var Graph=require(_0x990e('0x6'));var Vertices=require(_0x990e('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x990e('0x8')]()[_0x990e('0x9')](function(_0x1b3202){logger[_0x990e('0xa')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x1b3202[_0x990e('0xb')]);return[];});}function addVertex(_0x3bcdd6,_0x1e4be2,_0x3b8bb1){_0x1e4be2[_0x990e('0xc')]=_0x3b8bb1;if(_0x1e4be2['hasOwnProperty']('retry')){_0x1e4be2[_0x990e('0xd')]=parseInt(_0x1e4be2[_0x990e('0xe')],0xa);}_0x3bcdd6[_0x990e('0xf')](_[_0x990e('0x10')](_0x1e4be2,_0x990e('0x11')));}function initGraph(_0x6e815d,_0x2dcf80){var _0xbfdc92=new Graph();for(var _0x23ab5d in _0x6e815d){if(_0x6e815d['hasOwnProperty'](_0x23ab5d)){if(_[_0x990e('0x12')](_0x6e815d[_0x23ab5d])){for(var _0x1f0ac8=0x0;_0x1f0ac8<_0x6e815d[_0x23ab5d][_0x990e('0x13')];_0x1f0ac8+=0x1){addVertex(_0xbfdc92,_0x6e815d[_0x23ab5d][_0x1f0ac8],_0x23ab5d);}}else{addVertex(_0xbfdc92,_0x6e815d[_0x23ab5d],_0x23ab5d);}}}for(var _0x4542e1=0x0;_0x4542e1<_0x2dcf80[_0x990e('0x13')];_0x4542e1+=0x1){if(_0x2dcf80[_0x4542e1][_0x990e('0x14')]&&_0x2dcf80[_0x4542e1][_0x990e('0x15')]){_0xbfdc92[_0x990e('0x16')](_0x2dcf80[_0x4542e1]['source'],_0x2dcf80[_0x4542e1][_0x990e('0x15')],_0x2dcf80[_0x4542e1][_0x990e('0x17')]);}}return _0xbfdc92;}function getRoot(_0xf7c48c){return parser[_0x990e('0x18')](_0xf7c48c,{'object':!![]})[_0x990e('0x19')][_0x990e('0x1a')];}function inspect(_0x2d3f6f){return util[_0x990e('0x1b')](_0x2d3f6f,{'showHidden':![],'depth':null});}function initialize(_0x32917f,_0x17bd07){var _0x3d6d14=getRoot(_0x32917f[_0x990e('0x1c')]);if(!_0x3d6d14||!_0x3d6d14[_0x990e('0x1d')])return;var _0x42353f,_0x4642e7,_0x5bb68a;logger[_0x990e('0x1e')](_0x990e('0x1a'),JSON[_0x990e('0x1f')](_0x3d6d14,null,0x2));_0x17bd07[_0x990e('0x20')]=moment()[_0x990e('0x21')](_0x990e('0x22'));_0x42353f=initGraph(_['omit'](_0x3d6d14,'mxCell'),_0x3d6d14[_0x990e('0x11')]);_0x4642e7=new Vertices(_0x17bd07,rpc,mailRpc);logger[_0x990e('0x23')](util[_0x990e('0x21')](_0x990e('0x24'),_0x17bd07[_0x990e('0x25')],_0x17bd07['calleridname'],_0x17bd07['callerid'],_0x17bd07[_0x990e('0x26')],_0x17bd07[_0x990e('0x27')]));_0x42353f[_0x990e('0x28')](_0x3d6d14[_0x990e('0x1d')]['id'],function(_0xa2b066){try{_0xa2b066=_0x4642e7['clear'](_0xa2b066);logger[_0x990e('0x1e')](_0x990e('0x29'),JSON[_0x990e('0x1f')](_0xa2b066,null,0x2));if(_0xa2b066[_0x990e('0xc')]===_0x990e('0x2a')){logger[_0x990e('0x23')](_0x990e('0x2b'));_0x17bd07[_0x990e('0x2c')]=_0xa2b066[_0x990e('0x2c')]||_0x17bd07[_0x990e('0x2c')];_0x17bd07[_0x990e('0x2d')]=_0xa2b066[_0x990e('0x2d')];_0x17bd07['priority']=_0xa2b066[_0x990e('0x2e')]?_0xa2b066[_0x990e('0x2e')]-0x1:0x1;return null;}else if(_0xa2b066&&_0x4642e7[_0xa2b066['agicommand']]){_0x5bb68a=_0x4642e7[_0xa2b066[_0x990e('0xc')]](_0xa2b066);logger[_0x990e('0x23')](_0x990e('0x2f'),JSON[_0x990e('0x1f')](_0x5bb68a,null,0x2));if(_0x5bb68a&&_0x5bb68a[_0x990e('0x30')]===AGI_CODE_SUCCESS&&_0x5bb68a['result']!==AGI_RESULT_ERROR&&!_0x17bd07[_0x990e('0x31')]){logger[_0x990e('0x1e')](_0x990e('0x2f'),inspect(_0x5bb68a));return _[_0x990e('0x32')](_0x5bb68a[_0x990e('0x33')])?null:_0x5bb68a['result'][_0x990e('0x34')]();}else{logger['error'](_0x990e('0x2f'),inspect(_0x5bb68a));return null;}}else{logger[_0x990e('0xa')](_0x990e('0x35'));return null;}}catch(_0x359002){logger['error'](_0x359002['stack']);return null;}});if(_0x3d6d14[_0x990e('0x36')]){logger[_0x990e('0x23')](util[_0x990e('0x21')](_0x990e('0x37'),_0x17bd07[_0x990e('0x25')],_0x17bd07[_0x990e('0x38')],_0x17bd07['callerid'],_0x17bd07[_0x990e('0x26')],_0x17bd07[_0x990e('0x27')]));_0x42353f['traverseBFS'](_0x3d6d14['finally']['id'],function(_0xac4521){try{_0xac4521=_0x4642e7[_0x990e('0x39')](_0xac4521);logger[_0x990e('0x1e')](_0x990e('0x29'),JSON[_0x990e('0x1f')](_0xac4521,null,0x2));if(_0xac4521&&_0x4642e7[_0xac4521[_0x990e('0xc')]]){_0x5bb68a=_0x4642e7[_0xac4521[_0x990e('0xc')]](_0xac4521);if(_0x5bb68a){logger['debug'](_0x990e('0x2f'),inspect(_0x5bb68a));return _[_0x990e('0x32')](_0x5bb68a[_0x990e('0x33')])?null:_0x5bb68a[_0x990e('0x33')][_0x990e('0x34')]();}else{logger['error'](_0x990e('0x2f'),inspect(_0x5bb68a));return null;}}else{logger['error'](_0x990e('0x35'));return null;}}catch(_0xe4e135){logger[_0x990e('0xa')](_0xe4e135[_0x990e('0xb')]);return null;}});}logger[_0x990e('0x23')](util['format'](_0x990e('0x3a'),_0x17bd07[_0x990e('0x25')],_0x17bd07[_0x990e('0x38')],_0x17bd07[_0x990e('0x3b')],_0x17bd07['dnid'],_0x17bd07['uniqueid']));logger[_0x990e('0x23')](util[_0x990e('0x21')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x17bd07[_0x990e('0x2c')],_0x17bd07[_0x990e('0x2d')],parseInt(_0x17bd07[_0x990e('0x2e')],0xa)+0x1));_0x17bd07[_0x990e('0x3c')](_0x17bd07[_0x990e('0x2c')],_0x17bd07[_0x990e('0x2d')],parseInt(_0x17bd07[_0x990e('0x2e')],0xa)+0x1);_0x17bd07[_0x990e('0x3d')]();}function handleNotFound(_0xe98a25){logger[_0x990e('0xa')](util['format'](_0x990e('0x3e'),_0xe98a25[_0x990e('0x25')]));_0xe98a25[_0x990e('0x3c')](_0xe98a25[_0x990e('0x2c')],_0xe98a25[_0x990e('0x2d')],parseInt(_0xe98a25[_0x990e('0x2e')],0xa)+0x1);_0xe98a25[_0x990e('0x3d')]();}function handleUnpublished(_0x2391a6){logger[_0x990e('0xa')](util[_0x990e('0x21')](_0x990e('0x3f'),_0x2391a6[_0x990e('0x25')]));_0x2391a6[_0x990e('0x3c')](_0x2391a6[_0x990e('0x2c')],_0x2391a6[_0x990e('0x2d')],parseInt(_0x2391a6[_0x990e('0x2e')],0xa)+0x1);_0x2391a6[_0x990e('0x3d')]();}module[_0x990e('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 ccbb377..05ee206 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 _0xb5b1=['indexOf','substring','length','split','trim','emit','line','exports','util','call','inherits','prototype','\x0d\x0a\x0d\x0a','_localBuffer','_inBody'];(function(_0x34c98,_0x1b526f){var _0x520052=function(_0x4ea363){while(--_0x4ea363){_0x34c98['push'](_0x34c98['shift']());}};_0x520052(++_0x1b526f);}(_0xb5b1,0xcb));var _0x1b5b=function(_0x3849d4,_0x394083){_0x3849d4=_0x3849d4-0x0;var _0x5238ed=_0xb5b1[_0x3849d4];return _0x5238ed;};'use strict';var util=require(_0x1b5b('0x0'));var Transform=require('stream')['Transform'];function AGIReply(_0x4b6be3){Transform[_0x1b5b('0x1')](this,_0x4b6be3);this['_localBuffer']='';this['_inBody']=![];}util[_0x1b5b('0x2')](AGIReply,Transform);AGIReply[_0x1b5b('0x3')]['_transform']=function(_0x4ce921,_0x8113bf,_0x7c7b3){var _0x2bc562='\x0a',_0x128b94=['\x0a\x0a',_0x1b5b('0x4')],_0x4f0c42=-0x1,_0x3ccad2=-0x1,_0x31a4e2='',_0x3da5ee=0x0,_0x409f88='',_0x6ead91='';this[_0x1b5b('0x5')]+=_0x4ce921['toString']();_0x409f88=this[_0x1b5b('0x5')];if(!this[_0x1b5b('0x6')]){_0x3da5ee=0x0;while(_0x128b94[_0x3da5ee]){while((_0x3ccad2=_0x409f88[_0x1b5b('0x7')](_0x128b94[_0x3da5ee]))!=-0x1){_0x31a4e2=_0x128b94[_0x3da5ee];_0x6ead91=_0x409f88[_0x1b5b('0x8')](0x0,_0x3ccad2);_0x409f88=_0x409f88['substring'](_0x3ccad2+_0x31a4e2[_0x1b5b('0x9')]);var _0x44d160=_0x6ead91[_0x1b5b('0xa')](_0x2bc562),_0x29c84f=0x0,_0x13c4d9={},_0x130678='',_0x323b6d='',_0x592053=-0x1;while(_0x44d160[_0x29c84f]){_0x592053=_0x44d160[_0x29c84f]['indexOf'](':');if(_0x592053!=-0x1){_0x130678=_0x44d160[_0x29c84f]['slice'](0x0,_0x592053)[_0x1b5b('0xb')]();_0x323b6d=_0x44d160[_0x29c84f]['slice'](_0x592053+0x1)['trim']();if(_0x130678['length']>0x0){_0x13c4d9[_0x130678]=_0x323b6d;}}else{}_0x29c84f++;}this[_0x1b5b('0xc')]('headers',_0x13c4d9);this['_inBody']=!![];}_0x3da5ee++;}this[_0x1b5b('0x5')]=_0x409f88;}else{while((_0x4f0c42=_0x409f88['indexOf'](_0x2bc562))!=-0x1){_0x6ead91=_0x409f88[_0x1b5b('0x8')](0x0,_0x4f0c42);this[_0x1b5b('0xc')](_0x1b5b('0xd'),_0x6ead91);_0x409f88=_0x409f88['substring'](_0x4f0c42+_0x2bc562[_0x1b5b('0x9')]);}this[_0x1b5b('0x5')]=_0x409f88;}_0x7c7b3();};module[_0x1b5b('0xe')]=AGIReply; \ No newline at end of file +var _0xf81a=['emit','exports','util','stream','Transform','call','_localBuffer','_inBody','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','split','slice','trim','length','headers'];(function(_0x4345e2,_0x1df6dc){var _0x2a8718=function(_0x2324d4){while(--_0x2324d4){_0x4345e2['push'](_0x4345e2['shift']());}};_0x2a8718(++_0x1df6dc);}(_0xf81a,0x16b));var _0xaf81=function(_0x2125d3,_0x5d7fad){_0x2125d3=_0x2125d3-0x0;var _0x17a247=_0xf81a[_0x2125d3];return _0x17a247;};'use strict';var util=require(_0xaf81('0x0'));var Transform=require(_0xaf81('0x1'))[_0xaf81('0x2')];function AGIReply(_0x515bb5){Transform[_0xaf81('0x3')](this,_0x515bb5);this[_0xaf81('0x4')]='';this[_0xaf81('0x5')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0xaf81('0x6')][_0xaf81('0x7')]=function(_0x5c8d58,_0x102c05,_0x3c4f98){var _0x1c89dd='\x0a',_0x5cfd36=['\x0a\x0a',_0xaf81('0x8')],_0x268973=-0x1,_0x365b31=-0x1,_0x4c3052='',_0x3f0ac8=0x0,_0x34cc6a='',_0x413337='';this['_localBuffer']+=_0x5c8d58[_0xaf81('0x9')]();_0x34cc6a=this[_0xaf81('0x4')];if(!this[_0xaf81('0x5')]){_0x3f0ac8=0x0;while(_0x5cfd36[_0x3f0ac8]){while((_0x365b31=_0x34cc6a[_0xaf81('0xa')](_0x5cfd36[_0x3f0ac8]))!=-0x1){_0x4c3052=_0x5cfd36[_0x3f0ac8];_0x413337=_0x34cc6a[_0xaf81('0xb')](0x0,_0x365b31);_0x34cc6a=_0x34cc6a[_0xaf81('0xb')](_0x365b31+_0x4c3052['length']);var _0x57ba9c=_0x413337[_0xaf81('0xc')](_0x1c89dd),_0x2acecd=0x0,_0x56497d={},_0x2ecd06='',_0x327517='',_0x2b62dd=-0x1;while(_0x57ba9c[_0x2acecd]){_0x2b62dd=_0x57ba9c[_0x2acecd]['indexOf'](':');if(_0x2b62dd!=-0x1){_0x2ecd06=_0x57ba9c[_0x2acecd][_0xaf81('0xd')](0x0,_0x2b62dd)[_0xaf81('0xe')]();_0x327517=_0x57ba9c[_0x2acecd][_0xaf81('0xd')](_0x2b62dd+0x1)[_0xaf81('0xe')]();if(_0x2ecd06[_0xaf81('0xf')]>0x0){_0x56497d[_0x2ecd06]=_0x327517;}}else{}_0x2acecd++;}this['emit'](_0xaf81('0x10'),_0x56497d);this[_0xaf81('0x5')]=!![];}_0x3f0ac8++;}this['_localBuffer']=_0x34cc6a;}else{while((_0x268973=_0x34cc6a[_0xaf81('0xa')](_0x1c89dd))!=-0x1){_0x413337=_0x34cc6a[_0xaf81('0xb')](0x0,_0x268973);this[_0xaf81('0x11')]('line',_0x413337);_0x34cc6a=_0x34cc6a[_0xaf81('0xb')](_0x268973+_0x1c89dd[_0xaf81('0xf')]);}this[_0xaf81('0x4')]=_0x34cc6a;}_0x3c4f98();};module[_0xaf81('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 1cb1f88..f6cca05 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 _0x3379=['error','result','getSquareProjects','GetSquareProjects','name','production','ShowSquareProject','getMailAccountById','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getSquareOdbcById','ShowSquareOdbc','getUserById','getContactByPhone','phone','getTrunkById','ShowTrunk','ShowSound','Interval','getSmsAccountById','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareMessage','CreateSquareMessage','createCmContact','ListId','CreateCmContact','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','then'];(function(_0x38d367,_0x54d472){var _0x3c4f63=function(_0xbe432f){while(--_0xbe432f){_0x38d367['push'](_0x38d367['shift']());}};_0x3c4f63(++_0x54d472);}(_0x3379,0x115));var _0x9337=function(_0x481111,_0x28d3c5){_0x481111=_0x481111-0x0;var _0x5ee527=_0x3379[_0x481111];return _0x5ee527;};'use strict';var _=require(_0x9337('0x0'));var moment=require(_0x9337('0x1'));var jayson=require(_0x9337('0x2'));var client=jayson[_0x9337('0x3')]['http']({'port':0x2329});function request(_0x369104,_0x39545){return new Promise(function(_0x144317,_0x30dcfe){return client['request'](_0x369104,_0x39545)[_0x9337('0x4')](function(_0x192812){if(_0x192812[_0x9337('0x5')]){return _0x30dcfe(_0x192812[_0x9337('0x5')]['message']);}else{return _0x144317(_0x192812[_0x9337('0x6')]);}})['catch'](function(_0x268943){return _0x30dcfe(_0x268943);});});}exports[_0x9337('0x7')]=function(){return request(_0x9337('0x8'),{'options':{'raw':![],'attributes':['id',_0x9337('0x9'),_0x9337('0xa')]}});};exports['getSquareProject']=function(_0xd9b084){return request(_0x9337('0xb'),{'options':{'raw':![],'where':{'name':_0xd9b084},'attributes':[_0x9337('0xa')]}});};exports[_0x9337('0xc')]=function(_0x26995d){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x26995d},'include':[{'model':_0x9337('0xd'),'as':_0x9337('0xe'),'include':[{'model':_0x9337('0xf'),'as':_0x9337('0xf')}]}],'attributes':['id',_0x9337('0x9'),_0x9337('0x10')],'smtp':!![]}});};exports[_0x9337('0x11')]=function(_0x4f2fc4){return request('ShowSquareProject',{'options':{'where':{'id':_0x4f2fc4},'attributes':[_0x9337('0x9')]}});};exports[_0x9337('0x12')]=function(_0x12f1f1){return request(_0x9337('0x13'),{'options':{'where':{'id':_0x12f1f1},'attributes':['name']}});};exports['getVariableById']=function(_0x13515e){return request('ShowVariable',{'options':{'where':{'id':_0x13515e},'attributes':['name']}});};exports[_0x9337('0x14')]=function(_0x13a207){return request(_0x9337('0x15'),{'options':{'where':{'id':_0x13a207},'attributes':['dsn']}});};exports[_0x9337('0x16')]=function(_0x25633f){return request('ShowUser',{'options':{'where':{'id':_0x25633f},'attributes':['name']}});};exports[_0x9337('0x17')]=function(_0x462196){return request('GetContactByPhone',{'options':{'where':{'phone':_0x462196[_0x9337('0x18')]},'attributes':['id']}});};exports[_0x9337('0x19')]=function(_0x4e9802){return request(_0x9337('0x1a'),{'options':{'where':{'id':_0x4e9802},'attributes':[_0x9337('0x9')]}});};exports['getSoundById']=function(_0x1b8753){return request(_0x9337('0x1b'),{'options':{'where':{'id':_0x1b8753},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x28a237){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x28a237},'include':[{'model':_0x9337('0x1c'),'as':'Intervals'}]}});};exports[_0x9337('0x1d')]=function(_0x5768d5){return request('ShowSmsAccount',{'options':{'where':{'id':_0x5768d5},'attributes':['id',_0x9337('0x9')]}});};exports['createSmsMessage']=function(_0xe4b053){return request('CreateSmsMessage',{'body':_0xe4b053});};exports[_0x9337('0x1e')]=function(_0x332238){return request(_0x9337('0x1f'),{'body':_0x332238});};exports[_0x9337('0x20')]=function(_0x125af7){return request(_0x9337('0x21'),{'body':_['merge'](_0x125af7,{'project_name':_0x125af7['arg_1'],'prev_project_name':_0x125af7[_0x9337('0x22')]||'','is_subproject':_0x125af7[_0x9337('0x22')]?!![]:![],'leaveAt':moment()[_0x9337('0x23')](_0x9337('0x24'))})});};exports['createSquareRecording']=function(_0x453f19){return request('CreateSquareRecording',{'body':_0x453f19});};exports[_0x9337('0x25')]=function(_0x3d4b08){return request(_0x9337('0x26'),{'body':_0x3d4b08});};exports[_0x9337('0x27')]=function(_0x4da717){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x4da717[_0x9337('0x18')],'ListId':_0x4da717[_0x9337('0x28')]}}})[_0x9337('0x4')](function(_0x263ff1){if(_0x263ff1){return _0x263ff1;}return request(_0x9337('0x29'),{'body':_0x4da717});});};exports['getPauseById']=function(_0x333b99){return request('ShowPause',{'options':{'where':{'id':_0x333b99},'attributes':[_0x9337('0x9')]}});};exports['agentLogin']=function(_0x4d5c20,_0x554c47){return request('LoginUser',{'body':{'interface':_0x554c47},'options':{'where':_0x4d5c20}});};exports[_0x9337('0x2a')]=function(_0x3f1006,_0xd4afec,_0x8ca74c){return request(_0x9337('0x2b'),{'body':{'type':_0xd4afec,'uniqueid':_0x8ca74c},'options':{'where':_0x3f1006}});};exports['agentUnpause']=function(_0x47f137){return request(_0x9337('0x2c'),{'body':{},'options':{'where':_0x47f137}});};exports[_0x9337('0x2d')]=function(_0x2e709e){return request(_0x9337('0x2e'),{'body':{},'options':{'where':_0x2e709e}});}; \ No newline at end of file +var _0x946e=['GetSquareProjects','name','ShowSquareProject','ShowMailAccount','CloudProvider','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','phone','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','lodash','jayson/promise','http','request','then','error','message','result'];(function(_0x1e06f1,_0x59d7e1){var _0x34f77e=function(_0x4f9f26){while(--_0x4f9f26){_0x1e06f1['push'](_0x1e06f1['shift']());}};_0x34f77e(++_0x59d7e1);}(_0x946e,0x1d0));var _0xe946=function(_0x267b74,_0x5cbb83){_0x267b74=_0x267b74-0x0;var _0x5222ae=_0x946e[_0x267b74];return _0x5222ae;};'use strict';var _=require(_0xe946('0x0'));var moment=require('moment');var jayson=require(_0xe946('0x1'));var client=jayson['client'][_0xe946('0x2')]({'port':0x2329});function request(_0x5d4ee0,_0x5c9b66){return new Promise(function(_0x31cade,_0xb981db){return client[_0xe946('0x3')](_0x5d4ee0,_0x5c9b66)[_0xe946('0x4')](function(_0x11d758){if(_0x11d758['error']){return _0xb981db(_0x11d758[_0xe946('0x5')][_0xe946('0x6')]);}else{return _0x31cade(_0x11d758[_0xe946('0x7')]);}})['catch'](function(_0x39bd38){return _0xb981db(_0x39bd38);});});}exports['getSquareProjects']=function(){return request(_0xe946('0x8'),{'options':{'raw':![],'attributes':['id',_0xe946('0x9'),'production']}});};exports['getSquareProject']=function(_0x49e9fc){return request(_0xe946('0xa'),{'options':{'raw':![],'where':{'name':_0x49e9fc},'attributes':['production']}});};exports['getMailAccountById']=function(_0x35a35a){return request(_0xe946('0xb'),{'options':{'raw':![],'where':{'id':_0x35a35a},'include':[{'model':'MailServerOut','as':'Smtp','include':[{'model':_0xe946('0xc'),'as':_0xe946('0xc')}]}],'attributes':['id','name',_0xe946('0xd')],'smtp':!![]}});};exports[_0xe946('0xe')]=function(_0x36ad64){return request(_0xe946('0xa'),{'options':{'where':{'id':_0x36ad64},'attributes':[_0xe946('0x9')]}});};exports[_0xe946('0xf')]=function(_0x3eba3c){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x3eba3c},'attributes':['name']}});};exports[_0xe946('0x10')]=function(_0x2e66b8){return request(_0xe946('0x11'),{'options':{'where':{'id':_0x2e66b8},'attributes':['name']}});};exports[_0xe946('0x12')]=function(_0x437f13){return request(_0xe946('0x13'),{'options':{'where':{'id':_0x437f13},'attributes':['dsn']}});};exports[_0xe946('0x14')]=function(_0x1fbe13){return request(_0xe946('0x15'),{'options':{'where':{'id':_0x1fbe13},'attributes':['name']}});};exports[_0xe946('0x16')]=function(_0x3cde06){return request('GetContactByPhone',{'options':{'where':{'phone':_0x3cde06[_0xe946('0x17')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x1489f4){return request(_0xe946('0x18'),{'options':{'where':{'id':_0x1489f4},'attributes':['name']}});};exports[_0xe946('0x19')]=function(_0x3c9027){return request(_0xe946('0x1a'),{'options':{'where':{'id':_0x3c9027},'attributes':[_0xe946('0x1b')]}});};exports[_0xe946('0x1c')]=function(_0x29fa47){return request(_0xe946('0x1d'),{'options':{'raw':![],'where':{'id':_0x29fa47},'include':[{'model':_0xe946('0x1e'),'as':_0xe946('0x1f')}]}});};exports[_0xe946('0x20')]=function(_0x5c0f83){return request(_0xe946('0x21'),{'options':{'where':{'id':_0x5c0f83},'attributes':['id',_0xe946('0x9')]}});};exports[_0xe946('0x22')]=function(_0x25dbfb){return request(_0xe946('0x23'),{'body':_0x25dbfb});};exports[_0xe946('0x24')]=function(_0x556045){return request(_0xe946('0x25'),{'body':_0x556045});};exports[_0xe946('0x26')]=function(_0x1d0b1f){return request(_0xe946('0x27'),{'body':_[_0xe946('0x28')](_0x1d0b1f,{'project_name':_0x1d0b1f[_0xe946('0x29')],'prev_project_name':_0x1d0b1f[_0xe946('0x2a')]||'','is_subproject':_0x1d0b1f[_0xe946('0x2a')]?!![]:![],'leaveAt':moment()[_0xe946('0x2b')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xe946('0x2c')]=function(_0x4454d3){return request(_0xe946('0x2d'),{'body':_0x4454d3});};exports[_0xe946('0x2e')]=function(_0x33efee){return request(_0xe946('0x2f'),{'body':_0x33efee});};exports['createCmContact']=function(_0x20366d){return request(_0xe946('0x30'),{'options':{'raw':![],'where':{'phone':_0x20366d[_0xe946('0x17')],'ListId':_0x20366d[_0xe946('0x31')]}}})[_0xe946('0x4')](function(_0x1e41d2){if(_0x1e41d2){return _0x1e41d2;}return request(_0xe946('0x32'),{'body':_0x20366d});});};exports[_0xe946('0x33')]=function(_0x54ac40){return request(_0xe946('0x34'),{'options':{'where':{'id':_0x54ac40},'attributes':[_0xe946('0x9')]}});};exports['agentLogin']=function(_0x17f44c,_0x207a97){return request(_0xe946('0x35'),{'body':{'interface':_0x207a97},'options':{'where':_0x17f44c}});};exports[_0xe946('0x36')]=function(_0x5bf662,_0x39258e,_0xbd026d){return request(_0xe946('0x37'),{'body':{'type':_0x39258e,'uniqueid':_0xbd026d},'options':{'where':_0x5bf662}});};exports[_0xe946('0x38')]=function(_0x1711a1){return request('UnpauseUser',{'body':{},'options':{'where':_0x1711a1}});};exports[_0xe946('0x39')]=function(_0x1dcab6){return request(_0xe946('0x3a'),{'body':{},'options':{'where':_0x1dcab6}});}; \ 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 98df29c..bd3c351 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 _0x0eb2=['./polly','exports'];(function(_0x3ab928,_0x2b990b){var _0xf47692=function(_0x311b8e){while(--_0x311b8e){_0x3ab928['push'](_0x3ab928['shift']());}};_0xf47692(++_0x2b990b);}(_0x0eb2,0x11c));var _0x20eb=function(_0x3c4c6e,_0x59ff43){_0x3c4c6e=_0x3c4c6e-0x0;var _0x1d0ab7=_0x0eb2[_0x3c4c6e];return _0x1d0ab7;};var polly=require(_0x20eb('0x0'));var lex=require('./lex');module[_0x20eb('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x1a61=['./polly','exports'];(function(_0xcbdad1,_0x5c7032){var _0x359da2=function(_0x333e31){while(--_0x333e31){_0xcbdad1['push'](_0xcbdad1['shift']());}};_0x359da2(++_0x5c7032);}(_0x1a61,0x1e6));var _0x11a6=function(_0xe5032a,_0x29eaf4){_0xe5032a=_0xe5032a-0x0;var _0x347e2f=_0x1a61[_0xe5032a];return _0x347e2f;};var polly=require(_0x11a6('0x0'));var lex=require('./lex');module[_0x11a6('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 22515b4..cce330f 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x2936e7,_0x2afa91,_0x27405a,_0x305d85,_0x864539,_0x52b5fb){return lex(_0x2936e7,_0x2afa91,_0x27405a,_0x305d85,_0x864539,_0x52b5fb);}; \ No newline at end of file +var _0xe706=['exports','./lib/api'];(function(_0x37ffe4,_0x1a8997){var _0x31f3c9=function(_0x258de7){while(--_0x258de7){_0x37ffe4['push'](_0x37ffe4['shift']());}};_0x31f3c9(++_0x1a8997);}(_0xe706,0xa3));var _0x6e70=function(_0x1cce40,_0x2773c1){_0x1cce40=_0x1cce40-0x0;var _0x444893=_0xe706[_0x1cce40];return _0x444893;};'use strict';var lex=require(_0x6e70('0x0'));module[_0x6e70('0x1')]=function(_0x311951,_0x5e8446,_0x2cae77,_0x315629,_0x2ca810,_0x7dfbc3){return lex(_0x311951,_0x5e8446,_0x2cae77,_0x315629,_0x2ca810,_0x7dfbc3);}; \ 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 2a27d44..f02caa1 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(_0x2bf57e,_0x27df65){var _0x5a2e76=function(_0x586211){while(--_0x586211){_0x2bf57e['push'](_0x2bf57e['shift']());}};_0x5a2e76(++_0x27df65);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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(_0x389d01,_0x4e1a0c){var _0x1e93bd=function(_0xf08ab3){while(--_0xf08ab3){_0x389d01['push'](_0x389d01['shift']());}};_0x1e93bd(++_0x4e1a0c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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 2aaad99..756ef5b 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 _0xb3c9=['exports','./lib/api'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0xb3c9,0x103));var _0x9b3c=function(_0x363c0f,_0x145279){_0x363c0f=_0x363c0f-0x0;var _0x1d8f41=_0xb3c9[_0x363c0f];return _0x1d8f41;};'use strict';var polly=require(_0x9b3c('0x0'));module[_0x9b3c('0x1')]=function(_0x10ac39,_0x3eeede,_0x4972e8,_0x1b853c,_0x4c015b,_0x36a89b,_0x5afe69){return polly(_0x10ac39,_0x3eeede,_0x4972e8,_0x1b853c,_0x4c015b,_0x36a89b,_0x5afe69);}; \ No newline at end of file +var _0x48f5=['./lib/api','exports'];(function(_0x571833,_0x5383e8){var _0x38bc03=function(_0x494048){while(--_0x494048){_0x571833['push'](_0x571833['shift']());}};_0x38bc03(++_0x5383e8);}(_0x48f5,0x162));var _0x548f=function(_0xca5044,_0x3fb82d){_0xca5044=_0xca5044-0x0;var _0x5bc83a=_0x48f5[_0xca5044];return _0x5bc83a;};'use strict';var polly=require(_0x548f('0x0'));module[_0x548f('0x1')]=function(_0x1ac7f5,_0x495bde,_0x5ca40f,_0x36275c,_0x3925b2,_0x3b91fc,_0x3cf891){return polly(_0x1ac7f5,_0x495bde,_0x5ca40f,_0x36275c,_0x3925b2,_0x3b91fc,_0x3cf891);}; \ 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 96b32b9..2dfe311 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 _0x0fc9=['synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','path','bluebird','randomstring','aws-sdk'];(function(_0x4492af,_0x47e25d){var _0x216729=function(_0x4964c8){while(--_0x4964c8){_0x4492af['push'](_0x4492af['shift']());}};_0x216729(++_0x47e25d);}(_0x0fc9,0xa1));var _0x90fc=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x0fc9[_0x6c993a];return _0x27f547;};'use strict';var fs=require('fs');var path=require(_0x90fc('0x0'));var BPromise=require(_0x90fc('0x1'));var rs=require(_0x90fc('0x2'));var AWS=require(_0x90fc('0x3'));function pollyResult(_0x4965da,_0x46e1c8,_0x1d28e2){return new BPromise(function(_0x3831d1,_0x2f92ff){_0x4965da[_0x90fc('0x4')](_0x46e1c8,function(_0x506acc,_0x522590){if(_0x506acc){_0x2f92ff(_0x506acc);}else if(_0x522590){if(_0x522590['AudioStream']instanceof Buffer){fs[_0x90fc('0x5')](_0x1d28e2,_0x522590[_0x90fc('0x6')],function(_0x1dddf0){if(_0x1dddf0){_0x2f92ff(_0x1dddf0);}else{_0x3831d1();}});}else{_0x2f92ff(new Error(_0x90fc('0x7')));}}else{_0x2f92ff(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x90fc('0x8')]=function(_0x5ab053,_0xd8c765,_0x36d1b5,_0x115397,_0x2b7684,_0x237e46,_0x454f38){var _0x350833=new AWS[(_0x90fc('0x9'))]({'accessKeyId':_0x5ab053,'secretAccessKey':_0xd8c765,'region':_0x36d1b5});var _0x3eb206={'Text':_0x2b7684,'TextType':_0x237e46||_0x90fc('0xa'),'OutputFormat':'mp3','VoiceId':_0x115397};return pollyResult(_0x350833,_0x3eb206,_0x454f38);}; \ No newline at end of file +var _0xd83c=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','randomstring','synthesizeSpeech'];(function(_0x1f32cb,_0x10774e){var _0xff2722=function(_0x370c71){while(--_0x370c71){_0x1f32cb['push'](_0x1f32cb['shift']());}};_0xff2722(++_0x10774e);}(_0xd83c,0x10a));var _0xcd83=function(_0x20ebb5,_0x237d88){_0x20ebb5=_0x20ebb5-0x0;var _0x487182=_0xd83c[_0x20ebb5];return _0x487182;};'use strict';var fs=require('fs');var path=require(_0xcd83('0x0'));var BPromise=require(_0xcd83('0x1'));var rs=require(_0xcd83('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x555a7b,_0x504b5c,_0x43d07b){return new BPromise(function(_0x4d6df1,_0x1e81d9){_0x555a7b[_0xcd83('0x3')](_0x504b5c,function(_0x1c7298,_0x4a553f){if(_0x1c7298){_0x1e81d9(_0x1c7298);}else if(_0x4a553f){if(_0x4a553f['AudioStream']instanceof Buffer){fs['writeFile'](_0x43d07b,_0x4a553f['AudioStream'],function(_0x26fba1){if(_0x26fba1){_0x1e81d9(_0x26fba1);}else{_0x4d6df1();}});}else{_0x1e81d9(new Error(_0xcd83('0x4')));}}else{_0x1e81d9(new Error(_0xcd83('0x5')));}});});}module[_0xcd83('0x6')]=function(_0x1ab757,_0x4c1990,_0x2bde8d,_0x564e05,_0x5a6817,_0x418a9b,_0x150eeb){var _0x567a1c=new AWS[(_0xcd83('0x7'))]({'accessKeyId':_0x1ab757,'secretAccessKey':_0x4c1990,'region':_0x2bde8d});var _0xff7754={'Text':_0x5a6817,'TextType':_0x418a9b||_0xcd83('0x8'),'OutputFormat':_0xcd83('0x9'),'VoiceId':_0x564e05};return pollyResult(_0x567a1c,_0xff7754,_0x150eeb);}; \ 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 1135d0b..38428f7 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 _0x7bbb=['exports','./lib/api'];(function(_0x59659d,_0xb17019){var _0x2adbb5=function(_0x22ea94){while(--_0x22ea94){_0x59659d['push'](_0x59659d['shift']());}};_0x2adbb5(++_0xb17019);}(_0x7bbb,0x11b));var _0xb7bb=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x7bbb[_0xb0f7c3];return _0x28ea68;};'use strict';var asr=require(_0xb7bb('0x0'));module[_0xb7bb('0x1')]=function(_0x2ccf8d,_0x59921b,_0x482ffc,_0x583035){return asr(_0x2ccf8d,_0x59921b,_0x482ffc);}; \ No newline at end of file +var _0x778d=['./lib/api'];(function(_0x2e0763,_0x37e6e4){var _0x189643=function(_0x20802b){while(--_0x20802b){_0x2e0763['push'](_0x2e0763['shift']());}};_0x189643(++_0x37e6e4);}(_0x778d,0x1d6));var _0xd778=function(_0x7f1f83,_0x19649b){_0x7f1f83=_0x7f1f83-0x0;var _0x11ba01=_0x778d[_0x7f1f83];return _0x11ba01;};'use strict';var asr=require(_0xd778('0x0'));module['exports']=function(_0x2b7c9b,_0x228ada,_0x40a5f4,_0x2b0419){return asr(_0x2b7c9b,_0x228ada,_0x40a5f4);}; \ 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 299775f..da8de9e 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 _0xac55=['8000','url','bluebird','https://speech.googleapis.com','exports','string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','POST','LINEAR16'];(function(_0x1e7c2b,_0x4ca639){var _0x98b768=function(_0x293317){while(--_0x293317){_0x1e7c2b['push'](_0x1e7c2b['shift']());}};_0x98b768(++_0x4ca639);}(_0xac55,0x1c8));var _0x5ac5=function(_0x230031,_0x3f2174){_0x230031=_0x230031-0x0;var _0x435b0b=_0xac55[_0x230031];return _0x435b0b;};'use strict';var url=require(_0x5ac5('0x0'));var BPromise=require(_0x5ac5('0x1'));var fs=require('fs');var host=_0x5ac5('0x2');module[_0x5ac5('0x3')]=function(_0x5ac30d,_0x17b1d9,_0x13fcc6){return new BPromise(function(_0x192f9d,_0x1cdfec){var _0x3706ee;if(typeof _0x5ac30d!==_0x5ac5('0x4')||_0x5ac30d[_0x5ac5('0x5')]===0x0){return _0x1cdfec('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x17b1d9!=='string'||_0x17b1d9[_0x5ac5('0x5')]===0x0){return _0x1cdfec(_0x5ac5('0x6'));}if(typeof _0x13fcc6!==_0x5ac5('0x7')&&(typeof _0x13fcc6!==_0x5ac5('0x4')||_0x13fcc6[_0x5ac5('0x5')]===0x0)){return _0x1cdfec(_0x5ac5('0x8'));}try{_0x3706ee=fs[_0x5ac5('0x9')](_0x5ac30d)['toString']('base64');}catch(_0x2414f9){return _0x1cdfec(_0x2414f9);}return _0x192f9d({'method':_0x5ac5('0xa'),'uri':host+'/v1/speech:recognize?key='+_0x17b1d9,'body':{'config':{'encoding':_0x5ac5('0xb'),'sampleRateHertz':_0x5ac5('0xc'),'languageCode':_0x13fcc6},'audio':{'content':_0x3706ee}},'json':!![]});});}; \ No newline at end of file +var _0x702d=['exports','length','string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com'];(function(_0x295656,_0x306bb0){var _0x1c9127=function(_0x1a2f70){while(--_0x1a2f70){_0x295656['push'](_0x295656['shift']());}};_0x1c9127(++_0x306bb0);}(_0x702d,0x147));var _0xd702=function(_0x2427ff,_0x53048d){_0x2427ff=_0x2427ff-0x0;var _0x2c54cd=_0x702d[_0x2427ff];return _0x2c54cd;};'use strict';var url=require(_0xd702('0x0'));var BPromise=require(_0xd702('0x1'));var fs=require('fs');var host=_0xd702('0x2');module[_0xd702('0x3')]=function(_0x37ed5c,_0x5c2b9e,_0x20c11a){return new BPromise(function(_0xebbd7c,_0x27b260){var _0x1c5a32;if(typeof _0x37ed5c!=='string'||_0x37ed5c[_0xd702('0x4')]===0x0){return _0x27b260('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x5c2b9e!==_0xd702('0x5')||_0x5c2b9e[_0xd702('0x4')]===0x0){return _0x27b260(_0xd702('0x6'));}if(typeof _0x20c11a!=='undefined'&&(typeof _0x20c11a!==_0xd702('0x5')||_0x20c11a['length']===0x0)){return _0x27b260(_0xd702('0x7'));}try{_0x1c5a32=fs[_0xd702('0x8')](_0x37ed5c)[_0xd702('0x9')](_0xd702('0xa'));}catch(_0x2fe0ba){return _0x27b260(_0x2fe0ba);}return _0xebbd7c({'method':_0xd702('0xb'),'uri':host+_0xd702('0xc')+_0x5c2b9e,'body':{'config':{'encoding':_0xd702('0xd'),'sampleRateHertz':_0xd702('0xe'),'languageCode':_0x20c11a},'audio':{'content':_0x1c5a32}},'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 b2c552c..1fb719f 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 _0xc298=['./asr','exports'];(function(_0x4aa3f8,_0x13d6aa){var _0x588c3f=function(_0x1a1964){while(--_0x1a1964){_0x4aa3f8['push'](_0x4aa3f8['shift']());}};_0x588c3f(++_0x13d6aa);}(_0xc298,0x132));var _0x8c29=function(_0x2bb834,_0xbd4fe2){_0x2bb834=_0x2bb834-0x0;var _0x20a9d1=_0xc298[_0x2bb834];return _0x20a9d1;};var asr=require(_0x8c29('0x0'));module[_0x8c29('0x1')]={'asr':asr}; \ No newline at end of file +var _0x6808=['exports'];(function(_0x3cf481,_0x356a75){var _0x36a038=function(_0x38783e){while(--_0x38783e){_0x3cf481['push'](_0x3cf481['shift']());}};_0x36a038(++_0x356a75);}(_0x6808,0xc7));var _0x8680=function(_0x3daf36,_0x404250){_0x3daf36=_0x3daf36-0x0;var _0x5efb5a=_0x6808[_0x3daf36];return _0x5efb5a;};var asr=require('./asr');module[_0x8680('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 38aa39d..a272746 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 _0x6ea7=['join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','source','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','sestekNDA','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','util','./aws','./tilde','../../../config/logger','agi','https:','host','WHAT_EVER','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','finish\x20download\x20file','unlink','download\x20error','pipe','protocol','request\x20to\x20','data','end','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','writeFile','.wav','info','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','confidence'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x6ea7,0x14c));var _0x76ea=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x6ea7[_0x36ed48];return _0x51c63a;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require('dialogflow');var fs=require('fs');var http=require('http');var https=require('https');var md5=require(_0x76ea('0x0'));var path=require(_0x76ea('0x1'));var querystring=require(_0x76ea('0x2'));var rp=require(_0x76ea('0x3'));var rs=require(_0x76ea('0x4'));var sox=require(_0x76ea('0x5'));var tts=require(_0x76ea('0x6'));var urlParse=require(_0x76ea('0x7'))['parse'];var util=require(_0x76ea('0x8'));var aws=require(_0x76ea('0x9'));var google=require('./google');var sestek=require('./sestek');var tilde=require(_0x76ea('0xa'));var logger=require(_0x76ea('0xb'))(_0x76ea('0xc'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x248e40,_0x182bda){return new BPromise(function(_0x1fe428,_0x365d04){var _0x133843=urlParse(_0x248e40);var _0x444c92=_0x133843['protocol']===_0x76ea('0xd')?https:http;var _0xee5345={'host':_0x133843[_0x76ea('0xe')],'path':_0x133843['path'],'headers':{'user-agent':_0x76ea('0xf')}};_0x444c92[_0x76ea('0x10')](_0xee5345,function(_0x552996){if(_0x552996[_0x76ea('0x11')]!==0xc8){logger[_0x76ea('0x12')]('request\x20to\x20'+_0x248e40+_0x76ea('0x13')+_0x552996[_0x76ea('0x11')]+'\x20('+_0x552996[_0x76ea('0x14')]+')');_0x365d04(new Error('request\x20to\x20'+_0x248e40+_0x76ea('0x13')+_0x552996[_0x76ea('0x11')]+'\x20('+_0x552996[_0x76ea('0x14')]+')'));return;}var _0x43781f=fs['createWriteStream'](_0x182bda);_0x43781f['on'](_0x76ea('0x15'),function(){logger['info'](_0x76ea('0x16'));_0x43781f['close'](_0x1fe428);});_0x43781f['on']('error',function(_0x490b1a){fs[_0x76ea('0x17')](_0x182bda);logger[_0x76ea('0x12')](_0x76ea('0x18'),_0x490b1a);_0x365d04(_0x490b1a);});_0x552996[_0x76ea('0x19')](_0x43781f);})['on'](_0x76ea('0x12'),function(_0x566eae){logger[_0x76ea('0x12')](_0x566eae);_0x365d04(_0x566eae);})['end']();});}function uploadFile(_0xa20f44){return new BPromise(function(_0x23b495,_0xf102ad){var _0x3d1649=urlParse(_0xa20f44);var _0xc2f3a3=_0x3d1649[_0x76ea('0x1a')]===_0x76ea('0xd')?https:http;var _0x4afad6={'host':_0x3d1649['host'],'path':_0x3d1649[_0x76ea('0x1')],'headers':{'user-agent':_0x76ea('0xf')}};_0xc2f3a3[_0x76ea('0x10')](_0x4afad6,function(_0x364f54){if(_0x364f54[_0x76ea('0x11')]!==0xc8){_0xf102ad(new Error(_0x76ea('0x1b')+_0xa20f44+'\x20failed,\x20status\x20code\x20=\x20'+_0x364f54[_0x76ea('0x11')]+'\x20('+_0x364f54[_0x76ea('0x14')]+')'));return;}var _0x483f90='';_0x364f54['on'](_0x76ea('0x1c'),function(_0x3fa73b){_0x483f90+=_0x3fa73b;});_0x364f54['on'](_0x76ea('0x1d'),function(){_0x23b495(_0x483f90);});})['on']('error',function(_0x13b410){_0xf102ad(_0x13b410);})[_0x76ea('0x1d')]();});}function convertFile(_0x4befe7,_0x899e09){return new BPromise(function(_0x41914d,_0x242e1a){var _0x81acec=sox[_0x76ea('0x1e')](_0x4befe7,_0x899e09,{'sampleRate':0x1f40,'format':_0x76ea('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x81acec['on'](_0x76ea('0x12'),function(_0xe8eedd){logger[_0x76ea('0x12')](_0x76ea('0x20'),_0xe8eedd);_0x242e1a(_0xe8eedd);});_0x81acec['on']('end',function(){logger['info'](_0x76ea('0x21'));_0x41914d();});_0x81acec[_0x76ea('0x22')]();});}function base64Decode(_0x2e62e5,_0x5c3348){var _0x1ab2d7=path[_0x76ea('0x23')](__dirname,_0x76ea('0x24'),rs[_0x76ea('0x25')](0x4)+'.wav');fs[_0x76ea('0x26')](_0x1ab2d7,_0x2e62e5,_0x76ea('0x27'));return convertFile(_0x1ab2d7,_0x5c3348)[_0x76ea('0x28')](function(){try{fs[_0x76ea('0x17')](_0x1ab2d7);fs[_0x76ea('0x29')](_0x5c3348,_0x76ea('0x2a'));}catch(_0x3f5af6){logger['error'](_0x3f5af6);}return _0x5c3348[_0x76ea('0x2b')]('.')[0x0];});}function base64Encode(_0x32a585){var _0x520884=fs[_0x76ea('0x2c')](_0x32a585);return new Buffer(_0x520884)[_0x76ea('0x2d')](_0x76ea('0x27'));}exports[_0x76ea('0x2e')]=function(_0x36e87e,_0x4569c9,_0x4cd35f,_0x2974d7,_0x2f3c49,_0x2857f8){var _0x3331d1,_0xfbac16;var _0xdbfee5=_0x76ea('0x2f');var _0x2418fe=_0x76ea('0x30')+_0x36e87e;var _0x3ab183={};if(_0x4569c9===_0x76ea('0x31')){_0x3ab183[_0x76ea('0x32')]={'ssml':_0x4cd35f};}else{_0x3ab183[_0x76ea('0x32')]={'text':_0x4cd35f};};_0x3ab183[_0x76ea('0x33')]={'languageCode':_0x2974d7,'ssmlGender':_0x2f3c49};_0x3ab183[_0x76ea('0x34')]={'audioEncoding':_0x76ea('0x35'),'sampleRateHertz':0x1f40};var _0x1f10b3={'url':_0xdbfee5+_0x76ea('0x36')+_0x2418fe,'method':_0x76ea('0x37'),'json':!![],'body':_0x3ab183};return rp(_0x1f10b3)[_0x76ea('0x28')](function(_0x4cbbcb){return new BPromise(function(_0x4fbb18,_0x565480){_0x3331d1=path['resolve'](__dirname,_0x76ea('0x24'),rs[_0x76ea('0x25')](0x4)+_0x76ea('0x38'));var _0x227385=Buffer[_0x76ea('0x39')](_0x4cbbcb[_0x76ea('0x3a')],'base64');return fs[_0x76ea('0x3b')](_0x3331d1,_0x227385,function(_0x30f5a4){_0x565480(_0x30f5a4);},function(_0x4c9c27){fs[_0x76ea('0x29')](_0x3331d1,_0x76ea('0x2a'));_0x4fbb18(_0x4c9c27);});});})[_0x76ea('0x28')](function(_0x301232){_0xfbac16=path[_0x76ea('0x23')](__dirname,'tmp',rs['generate'](0x4)+_0x76ea('0x3c'));return convertFile(_0x3331d1,_0xfbac16);})[_0x76ea('0x28')](function(){try{fs[_0x76ea('0x17')](_0x3331d1);fs['chmodSync'](_0xfbac16,_0x76ea('0x2a'));}catch(_0x194b50){logger[_0x76ea('0x12')](_0x194b50);}logger[_0x76ea('0x3d')](_0x76ea('0x3e'),_0xfbac16['split']('.')[0x0]);return _0xfbac16[_0x76ea('0x2b')]('.')[0x0];});};exports[_0x76ea('0x3f')]=function(_0x2a3887,_0x166e23){var _0x363ca9=_0x76ea('0x40');var _0x24abd4,_0x18f41d;var _0xfbcf27;var _0x147cb9={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x363ca9,'headers':{'Content-Type':_0x76ea('0x41')},'body':_0x76ea('0x42')+encodeURIComponent(JSON[_0x76ea('0x43')]([[['jQ1olc',JSON['stringify']([_0x2a3887,_0x166e23||'en',![],_0x76ea('0x44')]),null,_0x76ea('0x45')]]]))};return rp(_0x147cb9)['then'](function(_0x1c0234){try{_0xfbcf27=eval(_0x1c0234[_0x76ea('0x46')](0x5))[0x0][0x2];}catch(_0x879d7a){throw new Error(_0x76ea('0x47')+_0x1c0234[_0x76ea('0x1c')]);}if(!_0xfbcf27){if(_0x2a3887[_0x76ea('0x48')]>0xc8){throw new Error(_0x76ea('0x49'));}else{throw new Error(_0x76ea('0x4a')+_0x166e23+_0x76ea('0x4b'));}}try{_0xfbcf27=eval(_0xfbcf27)[0x0];}catch(_0x3f615f){throw new Error(_0x76ea('0x47')+res['data']);}const _0x267b0d=_0xfbcf27;_0x24abd4=path[_0x76ea('0x23')](__dirname,'tmp',rs[_0x76ea('0x25')](0x4)+'.mp3');fs[_0x76ea('0x26')](_0x24abd4,_0xfbcf27,{'encoding':_0x76ea('0x27')});_0x18f41d=path['resolve'](__dirname,_0x76ea('0x24'),rs[_0x76ea('0x25')](0x4)+_0x76ea('0x3c'));return convertFile(_0x24abd4,_0x18f41d);})[_0x76ea('0x28')](function(){try{fs[_0x76ea('0x17')](_0x24abd4);fs[_0x76ea('0x29')](_0x18f41d,_0x76ea('0x2a'));}catch(_0x5dc65d){logger[_0x76ea('0x12')](_0x5dc65d);}logger[_0x76ea('0x3d')](_0x76ea('0x4c'),_0x18f41d['split']('.')[0x0]);return _0x18f41d[_0x76ea('0x2b')]('.')[0x0];});};exports[_0x76ea('0x4d')]=function(_0x1c2a1a,_0x262fbf,_0x493aee){return google[_0x76ea('0x4e')](_0x1c2a1a,_0x262fbf,_0x493aee)[_0x76ea('0x28')](function(_0x1cfe80){logger['info'](_0x1cfe80[_0x76ea('0x4f')]);return rp(_0x1cfe80);})[_0x76ea('0x28')](function(_0x57f35f){var _0x1386fa='';var _0x20813f=0x0;try{fs['unlink'](_0x1c2a1a);}catch(_0x3e23fa){logger[_0x76ea('0x12')](_0x3e23fa);}if(_0x57f35f&&_0x57f35f[_0x76ea('0x50')]){_0x1386fa=_0x57f35f['results'][_0x76ea('0x51')](function(_0x24f997){return _0x24f997&&_0x24f997[_0x76ea('0x52')][0x0]&&_0x24f997[_0x76ea('0x52')][0x0]['transcript']?_0x24f997[_0x76ea('0x52')][0x0][_0x76ea('0x53')]:'';})['join']('\x0a');_0x20813f=_0x57f35f[_0x76ea('0x50')][_0x76ea('0x51')](function(_0x184625){return _0x184625&&_0x184625[_0x76ea('0x52')][0x0]&&_0x184625['alternatives'][0x0][_0x76ea('0x54')]?_0x184625['alternatives'][0x0]['confidence']:0x0;})[_0x76ea('0x55')]('\x0a');}logger[_0x76ea('0x3d')](_0x76ea('0x56'),_0x1386fa);logger[_0x76ea('0x3d')](_0x76ea('0x57'),_0x20813f);return{'transcript':_0x1386fa,'confidence':_0x20813f};})[_0x76ea('0x58')](function(_0x2a84cc){logger[_0x76ea('0x12')](_0x76ea('0x59'),_0x2a84cc[_0x76ea('0x11')],_0x2a84cc[_0x76ea('0x5a')],_0x2a84cc[_0x76ea('0x5b')]);});};exports[_0x76ea('0x5c')]=function(_0x293b10,_0x46440f,_0x306b05,_0x4de3e1){var _0x3f1a88=apiai(_0x46440f,{'language':_0x4de3e1||'en'});return _0x3f1a88[_0x76ea('0x5d')](_0x306b05,{'sessionId':md5(_0x293b10)})[_0x76ea('0x28')](function(_0x4552d2){logger[_0x76ea('0x3d')](JSON[_0x76ea('0x43')](_0x4552d2));return{'source':_0x4552d2['result'][_0x76ea('0x5e')],'resolvedQuery':_0x4552d2[_0x76ea('0x5f')][_0x76ea('0x60')],'action':_0x4552d2[_0x76ea('0x5f')][_0x76ea('0x61')],'actionIncomplete':_0x4552d2[_0x76ea('0x5f')][_0x76ea('0x62')],'speech':_0x4552d2[_0x76ea('0x5f')][_0x76ea('0x63')][_0x76ea('0x64')],'score':_0x4552d2[_0x76ea('0x5f')][_0x76ea('0x65')],'statusCode':_0x4552d2['status'][_0x76ea('0x66')],'endConversation':_0x4552d2['result'][_0x76ea('0x67')][_0x76ea('0x68')]||![],'isFallbackIntent':_0x4552d2[_0x76ea('0x5f')][_0x76ea('0x67')][_0x76ea('0x69')]};});};exports[_0x76ea('0x6a')]=function(_0x23706b,_0x575116,_0x1c6357,_0x1b538c,_0x15c258,_0x48965c){var _0x1b94ea=_0x1b538c[_0x76ea('0x6b')](/\\n/g,'\x0a');var _0x7623e1={'credentials':{'private_key':_0x1b94ea,'client_email':_0x1c6357}};var _0x2a0e0b=new dialogflow['SessionsClient'](_0x7623e1);var _0x1d36b9=_0x2a0e0b[_0x76ea('0x6c')](_0x575116,md5(_0x23706b));var _0x4f3f6a={'session':_0x1d36b9,'queryInput':{'text':{'text':_0x15c258,'languageCode':_0x48965c}}};return _0x2a0e0b[_0x76ea('0x6d')](_0x4f3f6a)[_0x76ea('0x28')](function(_0x34f4bb){if(_0x34f4bb&&_0x34f4bb[_0x76ea('0x48')]){logger[_0x76ea('0x3d')](_0x76ea('0x6e'),JSON[_0x76ea('0x43')](_0x34f4bb));var _0x57429c=_0x34f4bb[0x0];if(_0x57429c){var _0x4f9536={'action':_0x57429c[_0x76ea('0x6f')][_0x76ea('0x61')],'allRequiredParamsPresent':_0x57429c[_0x76ea('0x6f')][_0x76ea('0x70')],'endConversation':_0x57429c[_0x76ea('0x6f')]['diagnosticInfo']&&_0x57429c[_0x76ea('0x6f')][_0x76ea('0x71')]['fields']?_0x57429c[_0x76ea('0x6f')][_0x76ea('0x71')][_0x76ea('0x72')]['end_conversation'][_0x76ea('0x73')]:![],'fulfillmentText':_0x57429c[_0x76ea('0x6f')][_0x76ea('0x74')],'intentName':_0x57429c['queryResult'][_0x76ea('0x75')][_0x76ea('0x5a')],'intentDisplayName':_0x57429c['queryResult'][_0x76ea('0x75')][_0x76ea('0x76')],'isFallbackIntent':_0x57429c[_0x76ea('0x6f')][_0x76ea('0x75')]['isFallback'],'languageCode':_0x57429c['queryResult'][_0x76ea('0x77')],'queryText':_0x57429c['queryResult'][_0x76ea('0x78')],'responseId':_0x57429c[_0x76ea('0x79')],'score':_0x57429c[_0x76ea('0x6f')][_0x76ea('0x7a')],'speech':_0x57429c[_0x76ea('0x6f')][_0x76ea('0x74')],'providerResponse':JSON['stringify'](_0x34f4bb)};return _0x4f9536;}}});};exports[_0x76ea('0x7b')]=function(_0x11a729,_0x1b776b,_0x3ff57a,_0x264199){return tilde[_0x76ea('0x4e')](_0x11a729,_0x1b776b,_0x3ff57a,_0x264199)[_0x76ea('0x28')](function(_0x4217f7){try{fs[_0x76ea('0x17')](_0x11a729);}catch(_0x55be03){logger['error'](_0x55be03);}logger[_0x76ea('0x3d')](_0x76ea('0x7c'),_0x4217f7[_0x76ea('0x53')]);logger[_0x76ea('0x3d')](_0x76ea('0x7d'),_0x4217f7['confidence']);return _0x4217f7;});};exports[_0x76ea('0x7e')]=function(_0x404854,_0x150c94,_0x58ec54,_0x263e1f,_0x1563cb,_0x3c1e7e){var _0x504695=path['resolve'](__dirname,'tmp',rs[_0x76ea('0x25')](0x4)+'.mp3');var _0x4c0369;return aws[_0x76ea('0x7f')](_0x404854,_0x150c94,_0x58ec54,_0x263e1f,_0x1563cb,_0x3c1e7e,_0x504695)[_0x76ea('0x28')](function(){_0x4c0369=path[_0x76ea('0x23')](__dirname,_0x76ea('0x24'),rs['generate'](0x4)+_0x76ea('0x3c'));return convertFile(_0x504695,_0x4c0369);})['then'](function(){try{fs[_0x76ea('0x17')](_0x504695);fs[_0x76ea('0x29')](_0x4c0369,_0x76ea('0x2a'));}catch(_0x385dec){logger[_0x76ea('0x12')](_0x385dec);}return _0x4c0369[_0x76ea('0x2b')]('.')[0x0];});};exports[_0x76ea('0x80')]=function(_0x541d86,_0x3958cf,_0x385d2d,_0x5e10a3,_0x4f5538,_0x2de016){return aws['lex'](_0x541d86,_0x3958cf,_0x385d2d,_0x5e10a3,_0x4f5538,_0x2de016)[_0x76ea('0x28')](function(_0x467ff8){logger['info'](JSON[_0x76ea('0x43')](_0x467ff8));return _0x467ff8;});};exports['ispeechTTS']=function(_0x493910,_0x5b38e8,_0x32df14,_0xa9be68){var _0x4820e7=util[_0x76ea('0x81')](_0x76ea('0x82'),ISPEECH_API,_0x493910,encodeURIComponent(_0x5b38e8),_0x32df14,_0xa9be68);var _0x2422d8=path[_0x76ea('0x23')](__dirname,_0x76ea('0x24'),rs[_0x76ea('0x25')](0x4)+'.mp3');var _0x309891;return downloadFile(_0x4820e7,_0x2422d8)['then'](function(){_0x309891=path[_0x76ea('0x23')](__dirname,_0x76ea('0x24'),rs['generate'](0x4)+_0x76ea('0x3c'));return convertFile(_0x2422d8,_0x309891);})[_0x76ea('0x28')](function(){try{fs[_0x76ea('0x17')](_0x2422d8);fs[_0x76ea('0x29')](_0x309891,_0x76ea('0x2a'));}catch(_0x5a0bc0){logger[_0x76ea('0x12')](_0x5a0bc0);}return _0x309891[_0x76ea('0x2b')]('.')[0x0];});};exports['ispeechASR']=function(_0x196ede,_0x304aa5,_0x1434d2,_0x4eb580){var _0x28ca20=util[_0x76ea('0x81')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x304aa5,_0x1434d2,base64Encode(_0x196ede),_0x4eb580?util[_0x76ea('0x81')]('model=%s',encodeURIComponent(_0x4eb580)):'freeform=3');return uploadFile(_0x28ca20)[_0x76ea('0x28')](function(_0x543141){return querystring['parse'](_0x543141);});};exports[_0x76ea('0x83')]=function(_0x3672a8,_0x25111c){return sestek['nda'](_0x3672a8,_0x25111c)['then'](function(_0x1f63f7){logger[_0x76ea('0x3d')](JSON[_0x76ea('0x43')](_0x1f63f7));var _0x470427={'speech':_0x1f63f7['text'],'action':_0x1f63f7[_0x76ea('0x84')]?_0x1f63f7[_0x76ea('0x84')][_0x76ea('0x85')]:undefined,'actiondata':_0x1f63f7[_0x76ea('0x84')]?_0x1f63f7[_0x76ea('0x84')][_0x76ea('0x86')]:undefined};if(_0x1f63f7[_0x76ea('0x84')]&&_0x1f63f7[_0x76ea('0x84')][_0x76ea('0x87')]){return base64Decode(_0x1f63f7[_0x76ea('0x84')]['AudioFromTts'][_0x76ea('0x88')],path[_0x76ea('0x23')](__dirname,_0x76ea('0x24'),rs['generate'](0x4)+_0x76ea('0x3c')))[_0x76ea('0x28')](function(_0xfdfe31){_0x470427[_0x76ea('0x89')]=_0xfdfe31;return _0x470427;});}return _0x470427;});};exports[_0x76ea('0x8a')]=function(){return __dirname;}; \ No newline at end of file +var _0x9004=['uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','source','result','resolvedQuery','action','fulfillment','speech','status','code','metadata','googleDialogflowV2','replace','sessionPath','detectIntent','queryResult','allRequiredParamsPresent','diagnosticInfo','boolValue','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','fulfillmentText','tildeASR','awsPolly','polly','awsLex','lex','format','ispeechASR','model=%s','freeform=3','nda','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','https','md5','path','randomstring','sox','google-tts-api','url','./aws','./google','./tilde','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','request\x20to\x20','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish\x20download\x20file','close','error','unlink','pipe','end','transcode','wav','error\x20convert','info','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','base64','then','777','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','chmodSync','googleCloudTTS\x20path','split','googleTTS','utf8','f.req=','stringify','null','generic','slice','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','writeFileSync','googleASR','asr'];(function(_0x421725,_0x318a04){var _0x51b322=function(_0xe58018){while(--_0xe58018){_0x421725['push'](_0x421725['shift']());}};_0x51b322(++_0x318a04);}(_0x9004,0x1bc));var _0x4900=function(_0x29e9ed,_0x7bf530){_0x29e9ed=_0x29e9ed-0x0;var _0x4d0b99=_0x9004[_0x29e9ed];return _0x4d0b99;};'use strict';var apiai=require(_0x4900('0x0'));var BPromise=require(_0x4900('0x1'));var dialogflow=require(_0x4900('0x2'));var fs=require('fs');var http=require('http');var https=require(_0x4900('0x3'));var md5=require(_0x4900('0x4'));var path=require(_0x4900('0x5'));var querystring=require('querystring');var rp=require('request-promise');var rs=require(_0x4900('0x6'));var sox=require(_0x4900('0x7'));var tts=require(_0x4900('0x8'));var urlParse=require(_0x4900('0x9'))['parse'];var util=require('util');var aws=require(_0x4900('0xa'));var google=require(_0x4900('0xb'));var sestek=require('./sestek');var tilde=require(_0x4900('0xc'));var logger=require('../../../config/logger')(_0x4900('0xd'));var ISPEECH_API=_0x4900('0xe');function downloadFile(_0x385653,_0x5c9999){return new BPromise(function(_0x59551d,_0x18da18){var _0xfef3c2=urlParse(_0x385653);var _0x349b78=_0xfef3c2[_0x4900('0xf')]===_0x4900('0x10')?https:http;var _0x5314a2={'host':_0xfef3c2[_0x4900('0x11')],'path':_0xfef3c2[_0x4900('0x5')],'headers':{'user-agent':_0x4900('0x12')}};_0x349b78[_0x4900('0x13')](_0x5314a2,function(_0x1a965b){if(_0x1a965b[_0x4900('0x14')]!==0xc8){logger['error'](_0x4900('0x15')+_0x385653+'\x20failed,\x20status\x20code\x20=\x20'+_0x1a965b[_0x4900('0x14')]+'\x20('+_0x1a965b[_0x4900('0x16')]+')');_0x18da18(new Error(_0x4900('0x15')+_0x385653+_0x4900('0x17')+_0x1a965b[_0x4900('0x14')]+'\x20('+_0x1a965b[_0x4900('0x16')]+')'));return;}var _0x15fdae=fs[_0x4900('0x18')](_0x5c9999);_0x15fdae['on']('finish',function(){logger['info'](_0x4900('0x19'));_0x15fdae[_0x4900('0x1a')](_0x59551d);});_0x15fdae['on'](_0x4900('0x1b'),function(_0xd15851){fs[_0x4900('0x1c')](_0x5c9999);logger[_0x4900('0x1b')]('download\x20error',_0xd15851);_0x18da18(_0xd15851);});_0x1a965b[_0x4900('0x1d')](_0x15fdae);})['on'](_0x4900('0x1b'),function(_0x3fcd76){logger[_0x4900('0x1b')](_0x3fcd76);_0x18da18(_0x3fcd76);})[_0x4900('0x1e')]();});}function uploadFile(_0x50fee9){return new BPromise(function(_0x144d89,_0x6ced9c){var _0x2f43cc=urlParse(_0x50fee9);var _0x2efdb1=_0x2f43cc[_0x4900('0xf')]===_0x4900('0x10')?https:http;var _0x4b915c={'host':_0x2f43cc[_0x4900('0x11')],'path':_0x2f43cc[_0x4900('0x5')],'headers':{'user-agent':_0x4900('0x12')}};_0x2efdb1[_0x4900('0x13')](_0x4b915c,function(_0x2a1b30){if(_0x2a1b30[_0x4900('0x14')]!==0xc8){_0x6ced9c(new Error(_0x4900('0x15')+_0x50fee9+'\x20failed,\x20status\x20code\x20=\x20'+_0x2a1b30[_0x4900('0x14')]+'\x20('+_0x2a1b30['statusMessage']+')'));return;}var _0x12d407='';_0x2a1b30['on']('data',function(_0x13471e){_0x12d407+=_0x13471e;});_0x2a1b30['on']('end',function(){_0x144d89(_0x12d407);});})['on'](_0x4900('0x1b'),function(_0x175777){_0x6ced9c(_0x175777);})[_0x4900('0x1e')]();});}function convertFile(_0x22e169,_0x48b488){return new BPromise(function(_0x5438ce,_0x10960f){var _0x1d0862=sox[_0x4900('0x1f')](_0x22e169,_0x48b488,{'sampleRate':0x1f40,'format':_0x4900('0x20'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1d0862['on'](_0x4900('0x1b'),function(_0x998c27){logger[_0x4900('0x1b')](_0x4900('0x21'),_0x998c27);_0x10960f(_0x998c27);});_0x1d0862['on'](_0x4900('0x1e'),function(){logger[_0x4900('0x22')](_0x4900('0x23'));_0x5438ce();});_0x1d0862[_0x4900('0x24')]();});}function base64Decode(_0xf843e7,_0x12d999){var _0x59c27d=path[_0x4900('0x25')](__dirname,_0x4900('0x26'),rs[_0x4900('0x27')](0x4)+_0x4900('0x28'));fs['writeFileSync'](_0x59c27d,_0xf843e7,_0x4900('0x29'));return convertFile(_0x59c27d,_0x12d999)[_0x4900('0x2a')](function(){try{fs[_0x4900('0x1c')](_0x59c27d);fs['chmodSync'](_0x12d999,_0x4900('0x2b'));}catch(_0x134f62){logger[_0x4900('0x1b')](_0x134f62);}return _0x12d999['split']('.')[0x0];});}function base64Encode(_0x4705f7){var _0x36bb83=fs[_0x4900('0x2c')](_0x4705f7);return new Buffer(_0x36bb83)[_0x4900('0x2d')](_0x4900('0x29'));}exports[_0x4900('0x2e')]=function(_0x2f2819,_0x3b0cba,_0x1917a5,_0x57cd0a,_0x4a03d5,_0x1e69c5){var _0x27f26d,_0x116896;var _0x2c3830=_0x4900('0x2f');var _0x459659=_0x4900('0x30')+_0x2f2819;var _0x310cf7={};if(_0x3b0cba===_0x4900('0x31')){_0x310cf7[_0x4900('0x32')]={'ssml':_0x1917a5};}else{_0x310cf7[_0x4900('0x32')]={'text':_0x1917a5};};_0x310cf7[_0x4900('0x33')]={'languageCode':_0x57cd0a,'ssmlGender':_0x4a03d5};_0x310cf7[_0x4900('0x34')]={'audioEncoding':_0x4900('0x35'),'sampleRateHertz':0x1f40};var _0x3dfa26={'url':_0x2c3830+_0x4900('0x36')+_0x459659,'method':_0x4900('0x37'),'json':!![],'body':_0x310cf7};return rp(_0x3dfa26)[_0x4900('0x2a')](function(_0x126936){return new BPromise(function(_0x76c854,_0x40a438){_0x27f26d=path[_0x4900('0x25')](__dirname,_0x4900('0x26'),rs[_0x4900('0x27')](0x4)+_0x4900('0x38'));var _0xef10f1=Buffer['from'](_0x126936['audioContent'],_0x4900('0x29'));return fs['writeFile'](_0x27f26d,_0xef10f1,function(_0x4e52e8){_0x40a438(_0x4e52e8);},function(_0x4b5a71){fs[_0x4900('0x39')](_0x27f26d,_0x4900('0x2b'));_0x76c854(_0x4b5a71);});});})[_0x4900('0x2a')](function(_0x301b49){_0x116896=path[_0x4900('0x25')](__dirname,_0x4900('0x26'),rs['generate'](0x4)+_0x4900('0x28'));return convertFile(_0x27f26d,_0x116896);})[_0x4900('0x2a')](function(){try{fs[_0x4900('0x1c')](_0x27f26d);fs[_0x4900('0x39')](_0x116896,_0x4900('0x2b'));}catch(_0x5e1ea4){logger['error'](_0x5e1ea4);}logger[_0x4900('0x22')](_0x4900('0x3a'),_0x116896[_0x4900('0x3b')]('.')[0x0]);return _0x116896[_0x4900('0x3b')]('.')[0x0];});};exports[_0x4900('0x3c')]=function(_0x30a4a0,_0x2f948a){var _0x4f061a='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x22e763,_0x5a25b4;var _0x3702d1;var _0x4d4faf={'encoding':_0x4900('0x3d'),'method':'POST','timeout':0x2710,'url':_0x4f061a,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x4900('0x3e')+encodeURIComponent(JSON[_0x4900('0x3f')]([[['jQ1olc',JSON[_0x4900('0x3f')]([_0x30a4a0,_0x2f948a||'en',![],_0x4900('0x40')]),null,_0x4900('0x41')]]]))};return rp(_0x4d4faf)[_0x4900('0x2a')](function(_0x310dc4){try{_0x3702d1=eval(_0x310dc4[_0x4900('0x42')](0x5))[0x0][0x2];}catch(_0x514d6c){throw new Error('parse\x20response\x20failed:\x0a'+_0x310dc4[_0x4900('0x43')]);}if(!_0x3702d1){if(_0x30a4a0[_0x4900('0x44')]>0xc8){throw new Error(_0x4900('0x45'));}else{throw new Error(_0x4900('0x46')+_0x2f948a+_0x4900('0x47'));}}try{_0x3702d1=eval(_0x3702d1)[0x0];}catch(_0x53c2d9){throw new Error(_0x4900('0x48')+res[_0x4900('0x43')]);}const _0x15024f=_0x3702d1;_0x22e763=path[_0x4900('0x25')](__dirname,_0x4900('0x26'),rs['generate'](0x4)+'.mp3');fs[_0x4900('0x49')](_0x22e763,_0x3702d1,{'encoding':_0x4900('0x29')});_0x5a25b4=path[_0x4900('0x25')](__dirname,'tmp',rs[_0x4900('0x27')](0x4)+_0x4900('0x28'));return convertFile(_0x22e763,_0x5a25b4);})[_0x4900('0x2a')](function(){try{fs[_0x4900('0x1c')](_0x22e763);fs[_0x4900('0x39')](_0x5a25b4,'777');}catch(_0x1b7d02){logger['error'](_0x1b7d02);}logger[_0x4900('0x22')]('goggleTTS\x20path',_0x5a25b4[_0x4900('0x3b')]('.')[0x0]);return _0x5a25b4[_0x4900('0x3b')]('.')[0x0];});};exports[_0x4900('0x4a')]=function(_0x433e48,_0x5e203c,_0x1a98be){return google[_0x4900('0x4b')](_0x433e48,_0x5e203c,_0x1a98be)[_0x4900('0x2a')](function(_0x25f199){logger[_0x4900('0x22')](_0x25f199[_0x4900('0x4c')]);return rp(_0x25f199);})['then'](function(_0x31414d){var _0x4f50af='';var _0x4436a1=0x0;try{fs['unlink'](_0x433e48);}catch(_0x152e3a){logger[_0x4900('0x1b')](_0x152e3a);}if(_0x31414d&&_0x31414d[_0x4900('0x4d')]){_0x4f50af=_0x31414d[_0x4900('0x4d')][_0x4900('0x4e')](function(_0xa1544){return _0xa1544&&_0xa1544[_0x4900('0x4f')][0x0]&&_0xa1544[_0x4900('0x4f')][0x0][_0x4900('0x50')]?_0xa1544[_0x4900('0x4f')][0x0][_0x4900('0x50')]:'';})[_0x4900('0x51')]('\x0a');_0x4436a1=_0x31414d[_0x4900('0x4d')][_0x4900('0x4e')](function(_0x5cf2d4){return _0x5cf2d4&&_0x5cf2d4['alternatives'][0x0]&&_0x5cf2d4[_0x4900('0x4f')][0x0]['confidence']?_0x5cf2d4[_0x4900('0x4f')][0x0][_0x4900('0x52')]:0x0;})[_0x4900('0x51')]('\x0a');}logger[_0x4900('0x22')](_0x4900('0x53'),_0x4f50af);logger[_0x4900('0x22')]('googleASR\x20confidence',_0x4436a1);return{'transcript':_0x4f50af,'confidence':_0x4436a1};})['catch'](function(_0x29e5bc){logger['error'](_0x4900('0x54'),_0x29e5bc[_0x4900('0x14')],_0x29e5bc[_0x4900('0x55')],_0x29e5bc[_0x4900('0x56')]);});};exports[_0x4900('0x57')]=function(_0x222c12,_0x2722a8,_0x393bda,_0x44ebd0){var _0x2ce50c=apiai(_0x2722a8,{'language':_0x44ebd0||'en'});return _0x2ce50c[_0x4900('0x58')](_0x393bda,{'sessionId':md5(_0x222c12)})[_0x4900('0x2a')](function(_0x431b7b){logger['info'](JSON[_0x4900('0x3f')](_0x431b7b));return{'source':_0x431b7b['result'][_0x4900('0x59')],'resolvedQuery':_0x431b7b[_0x4900('0x5a')][_0x4900('0x5b')],'action':_0x431b7b[_0x4900('0x5a')][_0x4900('0x5c')],'actionIncomplete':_0x431b7b[_0x4900('0x5a')]['actionIncomplete'],'speech':_0x431b7b[_0x4900('0x5a')][_0x4900('0x5d')][_0x4900('0x5e')],'score':_0x431b7b[_0x4900('0x5a')]['score'],'statusCode':_0x431b7b[_0x4900('0x5f')][_0x4900('0x60')],'endConversation':_0x431b7b[_0x4900('0x5a')][_0x4900('0x61')]['endConversation']||![],'isFallbackIntent':_0x431b7b[_0x4900('0x5a')][_0x4900('0x61')]['isFallbackIntent']};});};exports[_0x4900('0x62')]=function(_0x3496c7,_0x348e93,_0x245f92,_0x1713a1,_0x3ed74c,_0x1e0638){var _0x508a21=_0x1713a1[_0x4900('0x63')](/\\n/g,'\x0a');var _0x5b4354={'credentials':{'private_key':_0x508a21,'client_email':_0x245f92}};var _0x56b2a7=new dialogflow['SessionsClient'](_0x5b4354);var _0x12a3f7=_0x56b2a7[_0x4900('0x64')](_0x348e93,md5(_0x3496c7));var _0x3eadb8={'session':_0x12a3f7,'queryInput':{'text':{'text':_0x3ed74c,'languageCode':_0x1e0638}}};return _0x56b2a7[_0x4900('0x65')](_0x3eadb8)[_0x4900('0x2a')](function(_0x294c0b){if(_0x294c0b&&_0x294c0b[_0x4900('0x44')]){logger[_0x4900('0x22')]('Dialogflow\x20V2\x20response:',JSON[_0x4900('0x3f')](_0x294c0b));var _0x352772=_0x294c0b[0x0];if(_0x352772){var _0x4c9e96={'action':_0x352772[_0x4900('0x66')][_0x4900('0x5c')],'allRequiredParamsPresent':_0x352772[_0x4900('0x66')][_0x4900('0x67')],'endConversation':_0x352772['queryResult'][_0x4900('0x68')]&&_0x352772[_0x4900('0x66')][_0x4900('0x68')]['fields']?_0x352772[_0x4900('0x66')]['diagnosticInfo']['fields']['end_conversation'][_0x4900('0x69')]:![],'fulfillmentText':_0x352772[_0x4900('0x66')]['fulfillmentText'],'intentName':_0x352772[_0x4900('0x66')][_0x4900('0x6a')]['name'],'intentDisplayName':_0x352772['queryResult']['intent'][_0x4900('0x6b')],'isFallbackIntent':_0x352772[_0x4900('0x66')][_0x4900('0x6a')][_0x4900('0x6c')],'languageCode':_0x352772[_0x4900('0x66')][_0x4900('0x6d')],'queryText':_0x352772[_0x4900('0x66')][_0x4900('0x6e')],'responseId':_0x352772[_0x4900('0x6f')],'score':_0x352772['queryResult'][_0x4900('0x70')],'speech':_0x352772['queryResult'][_0x4900('0x71')],'providerResponse':JSON['stringify'](_0x294c0b)};return _0x4c9e96;}}});};exports[_0x4900('0x72')]=function(_0x4873eb,_0x495217,_0x1675de,_0x526306){return tilde[_0x4900('0x4b')](_0x4873eb,_0x495217,_0x1675de,_0x526306)['then'](function(_0x2cc444){try{fs[_0x4900('0x1c')](_0x4873eb);}catch(_0x33cb31){logger['error'](_0x33cb31);}logger[_0x4900('0x22')]('Tilde\x20ASR\x20transcription',_0x2cc444['transcript']);logger[_0x4900('0x22')]('Tilde\x20ASR\x20confidence',_0x2cc444[_0x4900('0x52')]);return _0x2cc444;});};exports[_0x4900('0x73')]=function(_0x5a57ac,_0x24e5ad,_0x855021,_0x3ffce7,_0x43dc37,_0x183fb2){var _0x12601d=path['resolve'](__dirname,_0x4900('0x26'),rs['generate'](0x4)+_0x4900('0x38'));var _0x5a664e;return aws[_0x4900('0x74')](_0x5a57ac,_0x24e5ad,_0x855021,_0x3ffce7,_0x43dc37,_0x183fb2,_0x12601d)[_0x4900('0x2a')](function(){_0x5a664e=path[_0x4900('0x25')](__dirname,_0x4900('0x26'),rs['generate'](0x4)+_0x4900('0x28'));return convertFile(_0x12601d,_0x5a664e);})[_0x4900('0x2a')](function(){try{fs['unlink'](_0x12601d);fs['chmodSync'](_0x5a664e,'777');}catch(_0x4ccfd8){logger[_0x4900('0x1b')](_0x4ccfd8);}return _0x5a664e[_0x4900('0x3b')]('.')[0x0];});};exports[_0x4900('0x75')]=function(_0x144bc9,_0x4d97fa,_0x1b4d89,_0x121737,_0x4934ed,_0x423182){return aws[_0x4900('0x76')](_0x144bc9,_0x4d97fa,_0x1b4d89,_0x121737,_0x4934ed,_0x423182)['then'](function(_0x1ad849){logger['info'](JSON[_0x4900('0x3f')](_0x1ad849));return _0x1ad849;});};exports['ispeechTTS']=function(_0x3356b5,_0x47a12f,_0x4b7b1e,_0x15259d){var _0x44bc7a=util[_0x4900('0x77')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x3356b5,encodeURIComponent(_0x47a12f),_0x4b7b1e,_0x15259d);var _0x59fa2f=path[_0x4900('0x25')](__dirname,_0x4900('0x26'),rs[_0x4900('0x27')](0x4)+_0x4900('0x38'));var _0x1fe167;return downloadFile(_0x44bc7a,_0x59fa2f)['then'](function(){_0x1fe167=path[_0x4900('0x25')](__dirname,_0x4900('0x26'),rs[_0x4900('0x27')](0x4)+_0x4900('0x28'));return convertFile(_0x59fa2f,_0x1fe167);})[_0x4900('0x2a')](function(){try{fs['unlink'](_0x59fa2f);fs[_0x4900('0x39')](_0x1fe167,_0x4900('0x2b'));}catch(_0x426877){logger[_0x4900('0x1b')](_0x426877);}return _0x1fe167['split']('.')[0x0];});};exports[_0x4900('0x78')]=function(_0x17ae71,_0x1c771a,_0x5cd1a3,_0x5e3c60){var _0x23362b=util[_0x4900('0x77')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x1c771a,_0x5cd1a3,base64Encode(_0x17ae71),_0x5e3c60?util['format'](_0x4900('0x79'),encodeURIComponent(_0x5e3c60)):_0x4900('0x7a'));return uploadFile(_0x23362b)[_0x4900('0x2a')](function(_0xdb0ae3){return querystring['parse'](_0xdb0ae3);});};exports['sestekNDA']=function(_0xa41c4c,_0x4a08a0){return sestek[_0x4900('0x7b')](_0xa41c4c,_0x4a08a0)[_0x4900('0x2a')](function(_0x224824){logger[_0x4900('0x22')](JSON[_0x4900('0x3f')](_0x224824));var _0x5eeed4={'speech':_0x224824['text'],'action':_0x224824[_0x4900('0x7c')]?_0x224824[_0x4900('0x7c')][_0x4900('0x7d')]:undefined,'actiondata':_0x224824[_0x4900('0x7c')]?_0x224824[_0x4900('0x7c')]['CustomActionData']:undefined};if(_0x224824[_0x4900('0x7c')]&&_0x224824['channelData']['AudioFromTts']){return base64Decode(_0x224824['channelData'][_0x4900('0x7e')][_0x4900('0x7f')],path[_0x4900('0x25')](__dirname,_0x4900('0x26'),rs['generate'](0x4)+_0x4900('0x28')))[_0x4900('0x2a')](function(_0xc777d1){_0x5eeed4[_0x4900('0x80')]=_0xc777d1;return _0x5eeed4;});}return _0x5eeed4;});};exports[_0x4900('0x81')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 7cfecd0..8a277ba 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 _0x8bd7=['exports','./nda'];(function(_0x421fd4,_0x1eea70){var _0x15298f=function(_0x38b40c){while(--_0x38b40c){_0x421fd4['push'](_0x421fd4['shift']());}};_0x15298f(++_0x1eea70);}(_0x8bd7,0x1a1));var _0x78bd=function(_0x21c7b5,_0x3d23d2){_0x21c7b5=_0x21c7b5-0x0;var _0x4f9a76=_0x8bd7[_0x21c7b5];return _0x4f9a76;};var nda=require(_0x78bd('0x0'));module[_0x78bd('0x1')]={'nda':nda}; \ No newline at end of file +var _0x1075=['./nda','exports'];(function(_0x1e38e9,_0xc2378b){var _0x19f0ea=function(_0x5b3e7e){while(--_0x5b3e7e){_0x1e38e9['push'](_0x1e38e9['shift']());}};_0x19f0ea(++_0xc2378b);}(_0x1075,0xdc));var _0x5107=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x1075[_0x42cae2];return _0x5f256f;};var nda=require(_0x5107('0x0'));module[_0x5107('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 24e3abe..901d5df 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 _0x84e1=['dnid','extension','text','Bearer\x20','access_token','project','body','channelData','AudioOutputSettings','audio/wav','custom_action','CustomAction','CustomActionData','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','callerid','calleridname'];(function(_0x5f5400,_0x8f28d3){var _0x5412bc=function(_0x2eccbc){while(--_0x2eccbc){_0x5f5400['push'](_0x5f5400['shift']());}};_0x5412bc(++_0x8f28d3);}(_0x84e1,0x1dc));var _0x184e=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x84e1[_0x68c979];return _0x4f0001;};'use strict';var rp=require(_0x184e('0x0'));var url=require(_0x184e('0x1'));var logger=require(_0x184e('0x2'))(_0x184e('0x3'));module[_0x184e('0x4')]=function(_0x4df769,_0x5c6973){var _0x6947f1={'method':_0x184e('0x5'),'uri':url[_0x184e('0x6')](_0x5c6973[_0x184e('0x7')],_0x184e('0x8')),'form':{'grant_type':_0x184e('0x9'),'username':_0x5c6973[_0x184e('0xa')],'password':_0x5c6973['password']},'json':!![]};return rp(_0x6947f1)[_0x184e('0xb')](function(_0xa32654){var _0x1e79b2={'method':'POST','uri':url[_0x184e('0x6')](_0x5c6973[_0x184e('0xc')],_0x184e('0xd')),'body':{'type':_0x5c6973[_0x184e('0xe')]||'message','channelId':_0x184e('0xf'),'conversation':{'id':_0x4df769[_0x184e('0x10')]},'from':{'id':_0x4df769[_0x184e('0x11')],'name':_0x4df769[_0x184e('0x12')]},'recipient':{'id':_0x4df769[_0x184e('0x13')],'name':_0x4df769[_0x184e('0x14')]},'text':_0x5c6973[_0x184e('0x15')],'channelData':{}},'headers':{'Authorization':_0x184e('0x16')+_0xa32654[_0x184e('0x17')]},'json':!![]};if(_0x5c6973[_0x184e('0x18')]){_0x1e79b2[_0x184e('0x19')][_0x184e('0x1a')]['ProjectName']=_0x5c6973[_0x184e('0x18')];}if(_0x5c6973['ndagenerate_audio']=='1'){_0x1e79b2[_0x184e('0x19')][_0x184e('0x1a')][_0x184e('0x1b')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x184e('0x1c')};}if(_0x5c6973[_0x184e('0x1d')]){_0x1e79b2[_0x184e('0x19')][_0x184e('0x1a')][_0x184e('0x1e')]=_0x5c6973[_0x184e('0x1d')];if(_0x5c6973['custom_action_data']){_0x1e79b2[_0x184e('0x19')]['channelData'][_0x184e('0x1f')]=_0x5c6973['custom_action_data'];}}logger['info'](JSON[_0x184e('0x20')](_0x1e79b2));return rp(_0x1e79b2);});}; \ No newline at end of file +var _0x9234=['ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','ProjectName','ndagenerate_audio','channelData','AudioOutputSettings','audio/wav','custom_action','body','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','../../../../../config/logger','agi','exports','POST','ndauth_url','/token','password','username','then'];(function(_0x345408,_0x1fff69){var _0xa5ca54=function(_0x334ddb){while(--_0x334ddb){_0x345408['push'](_0x345408['shift']());}};_0xa5ca54(++_0x1fff69);}(_0x9234,0x1bd));var _0x4923=function(_0x12a2a6,_0x374ff1){_0x12a2a6=_0x12a2a6-0x0;var _0x1754ae=_0x9234[_0x12a2a6];return _0x1754ae;};'use strict';var rp=require(_0x4923('0x0'));var url=require('url');var logger=require(_0x4923('0x1'))(_0x4923('0x2'));module[_0x4923('0x3')]=function(_0x34915b,_0x481178){var _0x1ca221={'method':_0x4923('0x4'),'uri':url['resolve'](_0x481178[_0x4923('0x5')],_0x4923('0x6')),'form':{'grant_type':_0x4923('0x7'),'username':_0x481178[_0x4923('0x8')],'password':_0x481178[_0x4923('0x7')]},'json':!![]};return rp(_0x1ca221)[_0x4923('0x9')](function(_0x2de396){var _0x548676={'method':_0x4923('0x4'),'uri':url['resolve'](_0x481178[_0x4923('0xa')],_0x4923('0xb')),'body':{'type':_0x481178[_0x4923('0xc')]||'message','channelId':_0x4923('0xd'),'conversation':{'id':_0x34915b[_0x4923('0xe')]},'from':{'id':_0x34915b[_0x4923('0xf')],'name':_0x34915b[_0x4923('0x10')]},'recipient':{'id':_0x34915b[_0x4923('0x11')],'name':_0x34915b[_0x4923('0x12')]},'text':_0x481178[_0x4923('0x13')],'channelData':{}},'headers':{'Authorization':_0x4923('0x14')+_0x2de396[_0x4923('0x15')]},'json':!![]};if(_0x481178[_0x4923('0x16')]){_0x548676['body']['channelData'][_0x4923('0x17')]=_0x481178[_0x4923('0x16')];}if(_0x481178[_0x4923('0x18')]=='1'){_0x548676['body'][_0x4923('0x19')][_0x4923('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x4923('0x1b')};}if(_0x481178[_0x4923('0x1c')]){_0x548676[_0x4923('0x1d')][_0x4923('0x19')][_0x4923('0x1e')]=_0x481178[_0x4923('0x1c')];if(_0x481178[_0x4923('0x1f')]){_0x548676[_0x4923('0x1d')]['channelData'][_0x4923('0x20')]=_0x481178[_0x4923('0x1f')];}}logger[_0x4923('0x21')](JSON[_0x4923('0x22')](_0x548676));return rp(_0x548676);});}; \ 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 568eb0e..a4d8dad 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 _0xae2c=['exports'];(function(_0x396350,_0xcc4aca){var _0x44f227=function(_0x5a3432){while(--_0x5a3432){_0x396350['push'](_0x396350['shift']());}};_0x44f227(++_0xcc4aca);}(_0xae2c,0x7f));var _0xcae2=function(_0x4e5632,_0x301633){_0x4e5632=_0x4e5632-0x0;var _0x30d8e5=_0xae2c[_0x4e5632];return _0x30d8e5;};'use strict';var asr=require('./lib/api');module[_0xcae2('0x0')]=function(_0x2f06ed,_0x36ed7c,_0x133c8f,_0x505b27){return asr(_0x2f06ed,_0x36ed7c,_0x133c8f,_0x505b27);}; \ No newline at end of file +var _0xc277=['./lib/api'];(function(_0x3a2b37,_0x3463ee){var _0x17cb9d=function(_0xd698df){while(--_0xd698df){_0x3a2b37['push'](_0x3a2b37['shift']());}};_0x17cb9d(++_0x3463ee);}(_0xc277,0xd7));var _0x7c27=function(_0x1fce71,_0x5050e1){_0x1fce71=_0x1fce71-0x0;var _0x3aa021=_0xc277[_0x1fce71];return _0x3aa021;};'use strict';var asr=require(_0x7c27('0x0'));module['exports']=function(_0x5f2770,_0x52f07b,_0x47631c,_0x1f546d){return asr(_0x5f2770,_0x52f07b,_0x47631c,_0x1f546d);}; \ 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 508dce8..3acd268 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 _0xfbe6=['isObject','open','message','close','lodash','moment','crypto','../../../../../../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','createHash','sha1','update','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','data','EOS','error','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','terminate','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil'];(function(_0x2dcae4,_0x32fe59){var _0x175130=function(_0x19ea18){while(--_0x19ea18){_0x2dcae4['push'](_0x2dcae4['shift']());}};_0x175130(++_0x32fe59);}(_0xfbe6,0xe8));var _0x6fbe=function(_0x239436,_0xfc1828){_0x239436=_0x239436-0x0;var _0x43c888=_0xfbe6[_0x239436];return _0x43c888;};'use strict';var BPromise=require('bluebird');var _=require(_0x6fbe('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x6fbe('0x1'));var crypto=require(_0x6fbe('0x2'));var logger=require(_0x6fbe('0x3'))(_0x6fbe('0x4'));module[_0x6fbe('0x5')]=function(_0x6a1eb2,_0x439890,_0x464bb9,_0x25e6da){return new BPromise(function(_0xbdf7d1,_0x44db5e){logger[_0x6fbe('0x6')]('Tilde\x20URI',_0x25e6da||_0x6fbe('0x7'));var _0x252256=new WebSocket(_0x25e6da||_0x6fbe('0x7'),{'perMessageDeflate':![]});var _0x3d5316='';var _0x1d3331='0';var _0x43def6='1';var _0x2fdc17=_0x6fbe('0x8');function _0x4eb448(_0x5d40c5){var _0x35e472=crypto[_0x6fbe('0x9')](_0x6fbe('0xa'));_0x35e472[_0x6fbe('0xb')](_0x5d40c5);return _0x35e472['digest']('hex');}function _0x1e846f(){try{logger['info'](_0x6fbe('0xc'));var _0x7a8bc6=moment()['unix']();var _0x2be17e=_0x4eb448(_0x7a8bc6+_0x439890+_0x464bb9);_0x252256[_0x6fbe('0xd')](JSON[_0x6fbe('0xe')]({'appID':_0x439890,'timestamp':_0x7a8bc6,'appKey':_0x2be17e}));var _0x5c0a35=fs[_0x6fbe('0xf')](_0x6a1eb2);_0x5c0a35['on'](_0x6fbe('0x10'),function(_0x307edc){_0x252256[_0x6fbe('0xd')](_0x307edc);});_0x5c0a35['on']('close',function(){_0x252256[_0x6fbe('0xd')](_0x6fbe('0x11'));});}catch(_0x9380be){logger[_0x6fbe('0x12')]('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0x9380be));_0x252256['terminate']();}}function _0x1f65f2(_0x3cf0d5){try{if(_0x3cf0d5){var _0x3fb0d5=JSON[_0x6fbe('0x13')](_0x3cf0d5);switch(_0x3fb0d5[_0x6fbe('0x14')]){case 0x0:if(_0x3fb0d5[_0x6fbe('0x15')]){if(_0x3fb0d5[_0x6fbe('0x15')]['final']){logger[_0x6fbe('0x6')](_0x6fbe('0x16'),JSON[_0x6fbe('0xe')](_0x3fb0d5[_0x6fbe('0x15')]['hypotheses']));_0x3d5316=_0x3fb0d5[_0x6fbe('0x15')][_0x6fbe('0x17')][0x0][_0x6fbe('0x18')];_0x1d3331=_0x3fb0d5[_0x6fbe('0x15')]['hypotheses'][0x0]['likelihood'];_0x43def6='0';_0x2fdc17=_0x6fbe('0x19');_0x252256[_0x6fbe('0x1a')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x43def6='1';_0x2fdc17=_0x6fbe('0x8');break;case 0x2:logger[_0x6fbe('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x43def6='2';_0x2fdc17='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x6fbe('0x6')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x43def6='9';_0x2fdc17=_0x6fbe('0x1b');break;case 0xa:logger['info'](_0x6fbe('0x1c'));_0x43def6='10';_0x2fdc17=_0x6fbe('0x1c');break;case 0xb:logger[_0x6fbe('0x6')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x43def6='11';_0x2fdc17=_0x6fbe('0x1d');}}}catch(_0x285617){logger[_0x6fbe('0x12')](_0x6fbe('0x1e'),JSON['stringify'](_0x285617));_0x252256[_0x6fbe('0x1a')]();}}function _0x2fed52(){logger[_0x6fbe('0x6')](_0x6fbe('0x1f'));_0xbdf7d1({'transcript':_0x3d5316,'confidence':_0x1d3331,'status':_0x43def6,'status_message':_0x2fdc17});}function _0xa2e10f(_0xa9f7f5){logger[_0x6fbe('0x12')](_0x6fbe('0x20'));if(!_[_0x6fbe('0x21')](_0xa9f7f5)){logger[_0x6fbe('0x12')](_[_0x6fbe('0x22')](_0xa9f7f5)?JSON['stringify'](_0xa9f7f5):_0xa9f7f5);}}_0x252256['on'](_0x6fbe('0x23'),_0x1e846f);_0x252256['on'](_0x6fbe('0x24'),_0x1f65f2);_0x252256['on'](_0x6fbe('0x25'),_0x2fed52);_0x252256['on'](_0x6fbe('0x12'),_0xa2e10f);});}; \ No newline at end of file +var _0xf8c8=['open','close','bluebird','lodash','moment','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','stringify','data','send','EOS','error','Tilde\x20ASR\x20send\x20error','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','isNil','isObject'];(function(_0x29b778,_0x45671b){var _0xdc6f80=function(_0x522345){while(--_0x522345){_0x29b778['push'](_0x29b778['shift']());}};_0xdc6f80(++_0x45671b);}(_0xf8c8,0x188));var _0x8f8c=function(_0x1bb2b9,_0x306c29){_0x1bb2b9=_0x1bb2b9-0x0;var _0x1a935d=_0xf8c8[_0x1bb2b9];return _0x1a935d;};'use strict';var BPromise=require(_0x8f8c('0x0'));var _=require(_0x8f8c('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x8f8c('0x2'));var crypto=require(_0x8f8c('0x3'));var logger=require(_0x8f8c('0x4'))('agi');module[_0x8f8c('0x5')]=function(_0x24ec57,_0x3d304f,_0x1e5e3c,_0x4fb32a){return new BPromise(function(_0x35c3f1,_0x2dca62){logger[_0x8f8c('0x6')](_0x8f8c('0x7'),_0x4fb32a||_0x8f8c('0x8'));var _0x2fc653=new WebSocket(_0x4fb32a||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x536d49='';var _0x5cbdb6='0';var _0x15142e='1';var _0x6f99e9=_0x8f8c('0x9');function _0x5f5218(_0x981e23){var _0x3866a6=crypto[_0x8f8c('0xa')](_0x8f8c('0xb'));_0x3866a6[_0x8f8c('0xc')](_0x981e23);return _0x3866a6[_0x8f8c('0xd')](_0x8f8c('0xe'));}function _0x116bbd(){try{logger['info'](_0x8f8c('0xf'));var _0xced27f=moment()[_0x8f8c('0x10')]();var _0x51e045=_0x5f5218(_0xced27f+_0x3d304f+_0x1e5e3c);_0x2fc653['send'](JSON[_0x8f8c('0x11')]({'appID':_0x3d304f,'timestamp':_0xced27f,'appKey':_0x51e045}));var _0x238237=fs['createReadStream'](_0x24ec57);_0x238237['on'](_0x8f8c('0x12'),function(_0x48c17c){_0x2fc653[_0x8f8c('0x13')](_0x48c17c);});_0x238237['on']('close',function(){_0x2fc653[_0x8f8c('0x13')](_0x8f8c('0x14'));});}catch(_0x2fcfba){logger[_0x8f8c('0x15')](_0x8f8c('0x16'),JSON[_0x8f8c('0x11')](_0x2fcfba));_0x2fc653['terminate']();}}function _0x4f182c(_0x342d56){try{if(_0x342d56){var _0x8aca45=JSON['parse'](_0x342d56);switch(_0x8aca45['status']){case 0x0:if(_0x8aca45['result']){if(_0x8aca45[_0x8f8c('0x17')][_0x8f8c('0x18')]){logger[_0x8f8c('0x6')](_0x8f8c('0x19'),JSON[_0x8f8c('0x11')](_0x8aca45[_0x8f8c('0x17')][_0x8f8c('0x1a')]));_0x536d49=_0x8aca45[_0x8f8c('0x17')][_0x8f8c('0x1a')][0x0][_0x8f8c('0x1b')];_0x5cbdb6=_0x8aca45[_0x8f8c('0x17')]['hypotheses'][0x0]['likelihood'];_0x15142e='0';_0x6f99e9=_0x8f8c('0x1c');_0x2fc653[_0x8f8c('0x1d')]();}}break;case 0x1:logger[_0x8f8c('0x6')](_0x8f8c('0x9'));_0x15142e='1';_0x6f99e9='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x8f8c('0x6')](_0x8f8c('0x1e'));_0x15142e='2';_0x6f99e9='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x8f8c('0x6')](_0x8f8c('0x1f'));_0x15142e='9';_0x6f99e9='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x8f8c('0x6')](_0x8f8c('0x20'));_0x15142e='10';_0x6f99e9=_0x8f8c('0x20');break;case 0xb:logger[_0x8f8c('0x6')](_0x8f8c('0x21'));_0x15142e='11';_0x6f99e9=_0x8f8c('0x21');}}}catch(_0x4cb666){logger['error'](_0x8f8c('0x22'),JSON[_0x8f8c('0x11')](_0x4cb666));_0x2fc653[_0x8f8c('0x1d')]();}}function _0x3dc44e(){logger[_0x8f8c('0x6')]('Close\x20Tilde\x20ASR\x20socket');_0x35c3f1({'transcript':_0x536d49,'confidence':_0x5cbdb6,'status':_0x15142e,'status_message':_0x6f99e9});}function _0xe563b0(_0x5050fb){logger[_0x8f8c('0x15')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x8f8c('0x23')](_0x5050fb)){logger[_0x8f8c('0x15')](_[_0x8f8c('0x24')](_0x5050fb)?JSON[_0x8f8c('0x11')](_0x5050fb):_0x5050fb);}}_0x2fc653['on'](_0x8f8c('0x25'),_0x116bbd);_0x2fc653['on']('message',_0x4f182c);_0x2fc653['on'](_0x8f8c('0x26'),_0x3dc44e);_0x2fc653['on'](_0x8f8c('0x15'),_0xe563b0);});}; \ 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 50e5ed7..3501a88 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 _0x6abe=['./asr'];(function(_0x195d75,_0x299ce0){var _0x49640a=function(_0x574a7d){while(--_0x574a7d){_0x195d75['push'](_0x195d75['shift']());}};_0x49640a(++_0x299ce0);}(_0x6abe,0x13a));var _0xe6ab=function(_0x3c078d,_0x549039){_0x3c078d=_0x3c078d-0x0;var _0x49f2c7=_0x6abe[_0x3c078d];return _0x49f2c7;};var asr=require(_0xe6ab('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0xd99f=['exports','./asr'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xd99f,0xdd));var _0xfd99=function(_0x32cc,_0x5a2971){_0x32cc=_0x32cc-0x0;var _0x10609f=_0xd99f[_0x32cc];return _0x10609f;};var asr=require(_0xfd99('0x0'));module[_0xfd99('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 68fcf62..3ce5c13 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x9cfe28,_0x1a335c){var _0x54a1d0=function(_0x46bc02){while(--_0x46bc02){_0x9cfe28['push'](_0x9cfe28['shift']());}};_0x54a1d0(++_0x1a335c);}(_0xe706,0xa3));var _0x6e70=function(_0x237d29,_0x439645){_0x237d29=_0x237d29-0x0;var _0x1e73ad=_0xe706[_0x237d29];return _0x1e73ad;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file +var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x9c44[_0x24061a];return _0x82054e;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index b25e8e1..510ec22 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 _0x9c5a=['getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUserById','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','callerid','createSquareRecording','calleridname','context','extension','priority','arg_1','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','getPause','getPauseById','agentPause','agentUnpause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','MP3','googleTTS','restAPI','url','method','number','timeout','includes','POST','PUT','toUpperCase','body','parse','computedVariables','sync','uri','render','stringify','headers','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_secret_access_key','Amy','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','length','saveRestApiResult','isPlainObject','%s.%s','isArray','setVariable','replaceObjectAllVariables','split','replaceAll','getVariable','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','retry','mrcpsynth','noop','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','exec','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','command','args','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','no\x20list\x20selected','delay','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20query\x20configured','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','getUser','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','streamFile','SestekNDA\x20Result\x20%s','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','maxdigit','toString','test','mindigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','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','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','.wav','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','email','user','bcc','subject','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','voicemail','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','odbc','randomstring','moment','mustache','../../config/logger','agi','./scripts','rawHeaders','rawBody','getsecretdigits','channel','mailRpc','prototype','rpc'];(function(_0x19f670,_0x36d23f){var _0x3ffd49=function(_0x5d9e05){while(--_0x5d9e05){_0x19f670['push'](_0x19f670['shift']());}};_0x3ffd49(++_0x36d23f);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x1d8c82,_0x5dc60b){_0x1d8c82=_0x1d8c82-0x0;var _0xc37fc3=_0x9c5a[_0x1d8c82];return _0xc37fc3;};'use strict';var fs=require('fs');var util=require(_0xa9c5('0x0'));var _=require(_0xa9c5('0x1'));var sh=require('shelljs');var odbc=require(_0xa9c5('0x2'))();var rs=require(_0xa9c5('0x3'));var moment=require(_0xa9c5('0x4'));var Mustache=require(_0xa9c5('0x5'));var rp=require('request-promise');var logger=require(_0xa9c5('0x6'))(_0xa9c5('0x7'));var config=require('../../config/environment');var scripts=require(_0xa9c5('0x8'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0xa9c5('0x9'),_0xa9c5('0xa')];var verticesWithRetry=['menu','getdigits',_0xa9c5('0xb')];var AGIVertices=function(_0x16f331,_0x52afb2,_0x2e2b3e){this[_0xa9c5('0xc')]=_0x16f331;this['rpc']=_0x52afb2;this[_0xa9c5('0xd')]=_0x2e2b3e;};AGIVertices[_0xa9c5('0xe')]['getVariable']=function(_0x4c55e9,_0x38e106){this[_0xa9c5('0xf')][_0xa9c5('0x10')](_0x4c55e9)[_0xa9c5('0x11')](function(_0x34c948){_0x38e106(null,_0x34c948?_0x34c948[_0xa9c5('0x12')]:![]);})[_0xa9c5('0x13')](function(_0x42d5cf){_0x38e106(_0x42d5cf);});};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x14')]=function(_0x5915ad,_0x390ca2){this[_0xa9c5('0xf')][_0xa9c5('0x15')](_0x5915ad)[_0xa9c5('0x11')](function(_0x418ca5){_0x390ca2(null,_0x418ca5?_0x418ca5[_0xa9c5('0x12')]:![]);})[_0xa9c5('0x13')](function(_0x40b001){_0x390ca2(_0x40b001);});};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x16')]=function(_0x4bb57e,_0x2b0d73){this[_0xa9c5('0xf')][_0xa9c5('0x17')](_0x4bb57e)['then'](function(_0x2cda1b){_0x2b0d73(null,_0x2cda1b?_0x2cda1b[_0xa9c5('0x12')]:![]);})[_0xa9c5('0x13')](function(_0x3b8cf7){_0x2b0d73(_0x3b8cf7);});};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x18')]=function(_0x3b8d4d,_0x1e5ce6){this[_0xa9c5('0xf')][_0xa9c5('0x19')](_0x3b8d4d)[_0xa9c5('0x11')](function(_0x2d95f8){_0x1e5ce6(null,_0x2d95f8?_0x2d95f8['dsn']:![]);})[_0xa9c5('0x13')](function(_0x21ab50){_0x1e5ce6(_0x21ab50);});};AGIVertices['prototype']['getUser']=function(_0xce9af6,_0x366f5c){this[_0xa9c5('0xf')][_0xa9c5('0x1a')](_0xce9af6)[_0xa9c5('0x11')](function(_0xd4b8a1){_0x366f5c(null,_0xd4b8a1?_0xd4b8a1['name']:![]);})['catch'](function(_0x3d4e1b){_0x366f5c(_0x3d4e1b);});};AGIVertices[_0xa9c5('0xe')]['getTrunk']=function(_0x6819b3,_0x424b4c){this[_0xa9c5('0xf')][_0xa9c5('0x1b')](_0x6819b3)[_0xa9c5('0x11')](function(_0x40f08b){_0x424b4c(null,_0x40f08b?_0x40f08b[_0xa9c5('0x12')]:![]);})['catch'](function(_0x4e8a7f){_0x424b4c(_0x4e8a7f);});};AGIVertices[_0xa9c5('0xe')]['getSound']=function(_0x1762ac,_0x830bad){var _0x4caefa=this;this[_0xa9c5('0xf')][_0xa9c5('0x1c')](_0x1762ac)['then'](function(_0x413edf){_0x830bad(null,_0x413edf?_0x4caefa[_0xa9c5('0x1d')](_0x413edf[_0xa9c5('0x1e')]):![]);})[_0xa9c5('0x13')](function(_0x325c65){_0x830bad(_0x325c65);});};AGIVertices['prototype'][_0xa9c5('0x1f')]=function(_0x4cee90,_0x3c3da7){this[_0xa9c5('0xf')][_0xa9c5('0x20')](_0x4cee90)['then'](function(_0xc6d0c1){_0x3c3da7(null,_0xc6d0c1?_0xc6d0c1:![]);})[_0xa9c5('0x13')](function(_0x5bc9bb){_0x3c3da7(_0x5bc9bb);});};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x21')]=function(_0x431e07,_0x378684,_0x22ee21){this[_0xa9c5('0xd')][_0xa9c5('0x21')](_0x431e07,_0x378684)['then'](function(){_0x22ee21(null);})[_0xa9c5('0x13')](function(_0x3bdf64){_0x22ee21(_0x3bdf64);});};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x22')]=function(_0x1c617c,_0x2de191){this[_0xa9c5('0xf')][_0xa9c5('0x23')](_0x1c617c)['then'](function(_0x4e3f3e){if(_0x4e3f3e){if(_0x4e3f3e[_0xa9c5('0x24')]){_0x2de191(null,[_0x4e3f3e[_0xa9c5('0x25')]]);}else{_0x2de191(null,_[_0xa9c5('0x26')](_0x4e3f3e[_0xa9c5('0x27')],_0xa9c5('0x25')));}}else{_0x2de191(null,![]);}})[_0xa9c5('0x13')](function(_0x4dfdb5){_0x2de191(_0x4dfdb5);});};AGIVertices['prototype']['getSoundPath']=function(_0x314010){return util[_0xa9c5('0x28')]('%s/sounds/converted/%s',FILES_PATH,_0x314010);};AGIVertices[_0xa9c5('0xe')]['getQueryOdbc']=function(_0x1f5740,_0x1fc8bf,_0x2567be){odbc[_0xa9c5('0x29')](_0x1f5740,function(_0x593be8){if(_0x593be8){logger[_0xa9c5('0x2a')](_0xa9c5('0x2b'),_0x593be8);_0x2567be(_0x593be8);}else{logger[_0xa9c5('0x2c')](_0xa9c5('0x2d'));odbc[_0xa9c5('0x2e')](_0x1fc8bf,function(_0x17ef8e,_0x422f9b){if(_0x17ef8e){logger[_0xa9c5('0x2c')]('Error\x20executing\x20query\x20%s',_0x1fc8bf);_0x2567be(_0x17ef8e);}else{logger[_0xa9c5('0x2c')](_0xa9c5('0x2f'),_0x1fc8bf);odbc[_0xa9c5('0x30')](function(_0x2b95fa){if(_0x2b95fa){logger[_0xa9c5('0x2a')](_0xa9c5('0x31'),_0x2b95fa);}_0x2567be(null,_0x422f9b);});}});}});};AGIVertices['prototype'][_0xa9c5('0x32')]=function(_0x5b7a0a,_0x2fa3e3){this['rpc'][_0xa9c5('0x33')](_0x5b7a0a)[_0xa9c5('0x11')](function(_0x37fb1b){_0x2fa3e3(null,_0x37fb1b?_0x37fb1b:![]);})['catch'](function(_0x12e19c){_0x2fa3e3(_0x12e19c);});};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x34')]=function(_0x26dd0c,_0x5914d2){this[_0xa9c5('0xf')][_0xa9c5('0x34')](_0x26dd0c)[_0xa9c5('0x11')](function(_0x45668e){_0x5914d2(null,_0x45668e);})[_0xa9c5('0x13')](function(_0x5dc092){_0x5914d2(_0x5dc092);});};AGIVertices[_0xa9c5('0xe')]['createSquareDetailsReport']=function(_0x1de605,_0x397614,_0x2998ad){this[_0xa9c5('0xf')][_0xa9c5('0x35')]({'uniqueid':this[_0xa9c5('0xc')][_0xa9c5('0x36')],'node':_0x1de605[_0xa9c5('0x37')],'application':_0x1de605[_0xa9c5('0x38')],'data':_0x397614||null,'project_name':this[_0xa9c5('0xc')]['arg_1'],'callerid':this[_0xa9c5('0xc')][_0xa9c5('0x39')]})[_0xa9c5('0x11')](function(_0x31611d){if(_0x2998ad){_0x2998ad(null,_0x31611d);}})[_0xa9c5('0x13')](function(_0x3794d2){if(_0x2998ad){_0x2998ad(_0x3794d2);}});};AGIVertices['prototype'][_0xa9c5('0x3a')]=function(_0x2ba81e,_0x557c21,_0x52cfbf,_0x56b8b4){this['rpc']['createSquareRecording']({'uniqueid':this[_0xa9c5('0xc')][_0xa9c5('0x36')],'callerid':this[_0xa9c5('0xc')][_0xa9c5('0x39')],'calleridname':this[_0xa9c5('0xc')][_0xa9c5('0x3b')],'context':this[_0xa9c5('0xc')][_0xa9c5('0x3c')],'extension':this[_0xa9c5('0xc')][_0xa9c5('0x3d')],'priority':this[_0xa9c5('0xc')][_0xa9c5('0x3e')],'accountcode':this[_0xa9c5('0xc')]['accountcode'],'dnid':this[_0xa9c5('0xc')]['dnid'],'projectName':this[_0xa9c5('0xc')][_0xa9c5('0x3f')],'saveName':_0x557c21,'filename':_0x2ba81e['file']||_0x557c21,'savePath':_0x52cfbf})['then'](function(_0xf00970){_0x56b8b4(null,_0xf00970);})[_0xa9c5('0x13')](function(_0xeb0720){_0x56b8b4(_0xeb0720);});};AGIVertices['prototype']['createSquareMessage']=function(_0x2333c4,_0xd03cec,_0x481f9c,_0x8ea192,_0x2c095f){this[_0xa9c5('0xf')][_0xa9c5('0x40')]({'uniqueid':this[_0xa9c5('0xc')][_0xa9c5('0x36')],'body':_0x2333c4,'direction':_0xd03cec,'providerName':_0x481f9c,'providerResponse':_0x8ea192})['then'](function(_0x4cd8e4){if(_0x2c095f){_0x2c095f(null,_0x4cd8e4);}})['catch'](function(_0x4317d8){if(_0x2c095f){_0x2c095f(_0x4317d8);}});};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x41')]=function(_0xef4d2,_0x380266){this[_0xa9c5('0xf')]['createCmContact']({'firstName':_[_0xa9c5('0x42')](_0xef4d2[_0xa9c5('0x12')])||_[_0xa9c5('0x43')](_0xef4d2[_0xa9c5('0x12')])?_0xa9c5('0x44')+Math[_0xa9c5('0x45')]():_0xef4d2['name'],'lastName':_['isEmpty'](_0xef4d2[_0xa9c5('0x46')])||_['isNil'](_0xef4d2[_0xa9c5('0x46')])?null:_0xef4d2['lastName'],'phone':_0xef4d2[_0xa9c5('0x47')],'ListId':_0xef4d2[_0xa9c5('0x48')],'scheduledat':_0xef4d2[_0xa9c5('0x49')],'callbackUniqueid':this['channel'][_0xa9c5('0x36')],'tags':_0xa9c5('0x4a'),'description':_0xa9c5('0x4b')+_0xef4d2[_0xa9c5('0x49')]['toString'](),'priority':_0xef4d2['callback_priority']})[_0xa9c5('0x11')](function(_0x2b66ee){_0x380266(null,_0x2b66ee);})[_0xa9c5('0x13')](function(_0x5b4323){_0x380266(_0x5b4323);});};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x4c')]=function(_0x3d3c04,_0x2e4734){this[_0xa9c5('0xf')][_0xa9c5('0x4d')](_0x3d3c04)[_0xa9c5('0x11')](function(_0x298b3d){_0x2e4734(null,_0x298b3d?_0x298b3d['name']:![]);})[_0xa9c5('0x13')](function(_0x5a9d4f){_0x2e4734(_0x5a9d4f);});};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x4e')]=function(_0x26bda1,_0x4dfe3a,_0x4d475a){var _0x1dd3b2={'role':'agent'};_0x1dd3b2[_0x26bda1]=this[_0xa9c5('0xc')][_0xa9c5('0x39')];this[_0xa9c5('0xf')][_0xa9c5('0x4e')](_0x1dd3b2,_0x4dfe3a,this['channel'][_0xa9c5('0x36')])[_0xa9c5('0x11')](function(_0x1f6fbc){_0x4d475a(null,_[_0xa9c5('0x43')](_0x1f6fbc)?![]:!![]);})['catch'](function(_0x5538ad){logger[_0xa9c5('0x2a')](_0x5538ad);_0x4d475a(null,![]);});};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x4f')]=function(_0x1b676e,_0x279a26){var _0x44ac8a={'role':'agent'};_0x44ac8a[_0x1b676e]=this[_0xa9c5('0xc')][_0xa9c5('0x39')];this[_0xa9c5('0xf')][_0xa9c5('0x4f')](_0x44ac8a)[_0xa9c5('0x11')](function(_0x372ab9){_0x279a26(null,_[_0xa9c5('0x43')](_0x372ab9)?![]:!![]);})[_0xa9c5('0x13')](function(_0x456973){logger[_0xa9c5('0x2a')](_0x456973);_0x279a26(null,![]);});};AGIVertices['prototype']['agentLogout']=function(_0x25c34f,_0x40ade1){var _0x3322cc={'role':_0xa9c5('0x50')};_0x3322cc[_0x25c34f]=this['channel'][_0xa9c5('0x39')];this['rpc'][_0xa9c5('0x51')](_0x3322cc)[_0xa9c5('0x11')](function(_0x325424){_0x40ade1(null,_[_0xa9c5('0x43')](_0x325424)?![]:!![]);})[_0xa9c5('0x13')](function(_0x11bb72){logger[_0xa9c5('0x2a')](_0x11bb72);_0x40ade1(null,![]);});};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x52')]=function(_0x9a7d4b,_0x446b8a){var _0x26c221={'role':'agent'};_0x26c221[_0x9a7d4b]=this[_0xa9c5('0xc')][_0xa9c5('0x39')];var _0x15eb25=_0x9a7d4b!=_0xa9c5('0x53')?util[_0xa9c5('0x28')](_0xa9c5('0x54'),_0xa9c5('0x55'),this['channel']['callerid']):undefined;this[_0xa9c5('0xf')]['agentLogin'](_0x26c221,_0x15eb25)[_0xa9c5('0x11')](function(_0x2510e4){_0x446b8a(null,_['isNil'](_0x2510e4)?![]:!![]);})[_0xa9c5('0x13')](function(_0x3db169){logger['error'](_0x3db169);_0x446b8a(null,![]);});};AGIVertices['prototype'][_0xa9c5('0x56')]=function(_0x26c805,_0x22af29){sh['exec'](_['trim'](_0x26c805),function(_0xd1ea,_0x3317c3){var _0x4b36a3=_0x3317c3[_0xa9c5('0x57')](/(\r\n|\n|\r)/gm,'');_0x22af29(null,_0x4b36a3);});};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x58')]=function(_0x3c0c7a,_0x135791){scripts[_0xa9c5('0x58')](_0x3c0c7a['apiKey'],_0x3c0c7a[_0xa9c5('0x59')]||_0xa9c5('0x5a'),_0x3c0c7a[_0xa9c5('0x5a')],_0x3c0c7a[_0xa9c5('0x5b')]||'en-US',_0x3c0c7a[_0xa9c5('0x5c')]||_0xa9c5('0x5d'),_0x3c0c7a['audioEncoding']||_0xa9c5('0x5e'))[_0xa9c5('0x11')](function(_0x12181b){_0x135791(null,_0x12181b);})['catch'](function(_0x11691e){_0x135791(_0x11691e);});};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x5f')]=function(_0x2e00f5,_0x2d449a){scripts[_0xa9c5('0x5f')](_0x2e00f5[_0xa9c5('0x5a')],_0x2e00f5['google_tts_language']||'en',0x1)[_0xa9c5('0x11')](function(_0x40468b){_0x2d449a(null,_0x40468b);})[_0xa9c5('0x13')](function(_0x3de672){_0x2d449a(_0x3de672);});};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x60')]=function(_0x39fae1,_0x390d0b){var _0x3f6114={'uri':_0x39fae1[_0xa9c5('0x61')],'method':_0x39fae1[_0xa9c5('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x39fae1['timeout'])===_0xa9c5('0x63')&&parseInt(_0x39fae1[_0xa9c5('0x64')])>=0x1?parseInt(_0x39fae1['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xa9c5('0x65')]([_0xa9c5('0x66'),_0xa9c5('0x67')],_0x3f6114['method'][_0xa9c5('0x68')]())){try{_0x3f6114[_0xa9c5('0x69')]=_0x39fae1[_0xa9c5('0xa')]?JSON[_0xa9c5('0x6a')](_0x39fae1['rawBody']):{};}catch(_0x2bcccf){logger[_0xa9c5('0x2a')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x2bcccf);}}try{_0x3f6114['headers']=_0x39fae1['rawHeaders']?JSON['parse'](_0x39fae1['rawHeaders']):{};}catch(_0x4efbde){logger['error']('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x4efbde);}if(_0x39fae1[_0xa9c5('0x6b')]){try{var _0x21797e=require(_0x39fae1[_0xa9c5('0x6b')])[_0xa9c5('0x6c')](this,_0x3f6114);_0x3f6114[_0xa9c5('0x6d')]=Mustache['render'](_0x39fae1['url'],_0x21797e,{},['$$','$$']);if(_0x3f6114['headers']){_0x3f6114['headers']=JSON[_0xa9c5('0x6a')](Mustache[_0xa9c5('0x6e')](JSON[_0xa9c5('0x6f')](_0x3f6114[_0xa9c5('0x70')]),_0x21797e,{},['$$','$$']));}if(_0x3f6114['body']){_0x3f6114['body']=JSON[_0xa9c5('0x6a')](Mustache[_0xa9c5('0x6e')](JSON[_0xa9c5('0x6f')](_0x3f6114[_0xa9c5('0x69')]),_0x21797e,{},['$$','$$']));}}catch(_0x1d89ec){logger['error'](_0xa9c5('0x71'),_0x1d89ec);}}rp(_0x3f6114)[_0xa9c5('0x11')](function(_0xd063cf){var _0x58de52={'statusCode':_0xd063cf[_0xa9c5('0x72')]||0xc8,'statusMessage':_0xd063cf[_0xa9c5('0x73')]||'OK','headers':_0xd063cf[_0xa9c5('0x70')]||{},'body':_0xd063cf[_0xa9c5('0x69')]||{}};_0x390d0b(null,_0x58de52);})['catch'](function(_0x34fcea){var _0x22c63b={'statusCode':_0x34fcea['statusCode']||0x1f4,'statusMessage':_0x34fcea['message']||_0xa9c5('0x74'),'headers':_0x34fcea['options']['headers']||{},'body':_0x34fcea[_0xa9c5('0x75')][_0xa9c5('0x69')]||{}};_0x390d0b(null,_0x22c63b);});};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x76')]=function(_0x22661f,_0x5bc433){scripts[_0xa9c5('0x76')](this['channel'][_0xa9c5('0x36')],_0x22661f[_0xa9c5('0x77')],_0x22661f[_0xa9c5('0x5a')],_0x22661f[_0xa9c5('0x78')]||'en')['then'](function(_0x4b056e){_0x5bc433(null,_0x4b056e);})[_0xa9c5('0x13')](function(_0x532712){_0x5bc433(_0x532712);});};AGIVertices['prototype'][_0xa9c5('0x79')]=function(_0x370bbb,_0x4cdf88){scripts['googleDialogflowV2'](this[_0xa9c5('0xc')][_0xa9c5('0x36')],_0x370bbb[_0xa9c5('0x7a')],_0x370bbb[_0xa9c5('0x7b')],_0x370bbb['private_key'],_0x370bbb['text'],_0x370bbb[_0xa9c5('0x7c')]||'en')[_0xa9c5('0x11')](function(_0x3229ea){_0x4cdf88(null,_0x3229ea);})[_0xa9c5('0x13')](function(_0x2f80d9){_0x4cdf88(_0x2f80d9);});};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x7d')]=function(_0x538973,_0x23ee99){scripts[_0xa9c5('0x7d')](this['channel'],_0x538973)[_0xa9c5('0x11')](function(_0x2488aa){_0x23ee99(null,_0x2488aa);})['catch'](function(_0x185820){_0x23ee99(_0x185820);});};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x7e')]=function(_0x2c93e3,_0x21e3ba){scripts[_0xa9c5('0x7e')](_0x2c93e3[_0xa9c5('0x77')],_0x2c93e3[_0xa9c5('0x5a')],_0x2c93e3[_0xa9c5('0x7f')]||_0xa9c5('0x80'),_0x2c93e3[_0xa9c5('0x81')])[_0xa9c5('0x11')](function(_0x29873a){_0x21e3ba(null,_0x29873a);})[_0xa9c5('0x13')](function(_0x359f3f){_0x21e3ba(_0x359f3f);});};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x82')]=function(_0x5f00ad,_0x425b92,_0x2b56dc){scripts[_0xa9c5('0x82')](_0x425b92,_0x5f00ad['key'],_0x5f00ad[_0xa9c5('0x83')]||_0xa9c5('0x80'),this['isConfigured'](_0x5f00ad[_0xa9c5('0x84')])?_0x5f00ad[_0xa9c5('0x84')]:undefined)[_0xa9c5('0x11')](function(_0x355184){_0x2b56dc(null,_0x355184);})[_0xa9c5('0x13')](function(_0x427666){_0x2b56dc(_0x427666);});};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x85')]=function(_0xe30a70,_0xb09d88){scripts[_0xa9c5('0x85')](_0xe30a70[_0xa9c5('0x86')],_0xe30a70[_0xa9c5('0x87')],_0xe30a70['aws_polly_region'],_0xe30a70['aws_polly_voice']||_0xa9c5('0x88'),_0xe30a70[_0xa9c5('0x5a')],_0xe30a70['aws_text_type']||_0xa9c5('0x5a'))[_0xa9c5('0x11')](function(_0x409e96){_0xb09d88(null,_0x409e96);})[_0xa9c5('0x13')](function(_0x5d734d){_0xb09d88(_0x5d734d);});};AGIVertices['prototype'][_0xa9c5('0x89')]=function(_0x22c480,_0x457158){scripts['awsLex'](this[_0xa9c5('0xc')][_0xa9c5('0x36')],_0x22c480[_0xa9c5('0x86')],_0x22c480['aws_secret_access_key'],_0x22c480[_0xa9c5('0x8a')],_0x22c480[_0xa9c5('0x5a')],_0x22c480[_0xa9c5('0x8b')])[_0xa9c5('0x11')](function(_0xd2b735){_0x457158(null,_0xd2b735);})[_0xa9c5('0x13')](function(_0xac9d4a){_0x457158(_0xac9d4a);});};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x8c')]=function(_0x13ac1f,_0x133a2c,_0x39ae69){scripts[_0xa9c5('0x8c')](_0x133a2c,_0x13ac1f[_0xa9c5('0x77')],_0x13ac1f[_0xa9c5('0x8d')]||'en-US')['then'](function(_0x4acddb){_0x39ae69(null,_0x4acddb);})[_0xa9c5('0x13')](function(_0x3bfc19){_0x39ae69(_0x3bfc19);});};AGIVertices['prototype'][_0xa9c5('0x8e')]=function(_0x24c7bd,_0x5646ab,_0x428223){scripts[_0xa9c5('0x8e')](_0x5646ab,_0x24c7bd[_0xa9c5('0x8f')],_0x24c7bd[_0xa9c5('0x90')],_0x24c7bd[_0xa9c5('0x6d')])['then'](function(_0x70d779){_0x428223(null,_0x70d779);})[_0xa9c5('0x13')](function(_0x2e41da){_0x428223(_0x2e41da);});};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x91')]=function(_0x23dbee){var _0x3050a6=_[_0xa9c5('0x65')](verticesWithRetry,_0x23dbee[_0xa9c5('0x38')])?_0x23dbee:_[_0xa9c5('0x92')](_0x23dbee);for(var _0x30b597 in _0x3050a6){if(_0x3050a6[_0xa9c5('0x93')](_0x30b597)){if(_0x3050a6[_0x30b597]&&_[_0xa9c5('0x94')](_0x3050a6[_0x30b597])){if(_['includes'](recursiveMapAttributes,_0x30b597)){_0x3050a6[_0x30b597]=this['replaceObjectAllVariables'](_0x3050a6[_0x30b597]);}else{_0x3050a6[_0x30b597]=this[_0xa9c5('0x95')](_0x3050a6[_0x30b597]);}}}}return _0x3050a6;};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x96')]=function(_0x471c7b){for(var _0x5b9835 in _0x471c7b){if(_0x471c7b[_0xa9c5('0x93')](_0x5b9835)){if(_['isPlainObject'](_0x471c7b[_0x5b9835])){this['recursiveNodeIndex'](_0x471c7b[_0x5b9835]);}else if(_['isArray'](_0x471c7b[_0x5b9835])){for(var _0x171d12=0x0;_0x171d12<_0x471c7b[_0x5b9835][_0xa9c5('0x97')];_0x171d12++){this['recursiveNodeIndex'](_0x471c7b[_0x5b9835][_0x171d12]);}}else if(_[_0xa9c5('0x94')](_0x471c7b[_0x5b9835])){_0x471c7b[_0x5b9835]=this[_0xa9c5('0x95')](_0x471c7b[_0x5b9835]);}}}};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x98')]=function(_0x156f7a,_0x3a98d){for(var _0x193fe0 in _0x156f7a){if(_0x156f7a['hasOwnProperty'](_0x193fe0)){if(_[_0xa9c5('0x99')](_0x156f7a[_0x193fe0])){if(!_['isEmpty'](_0x156f7a[_0x193fe0])){this[_0xa9c5('0x98')](_0x156f7a[_0x193fe0],util[_0xa9c5('0x28')](_0xa9c5('0x9a'),_0x3a98d,_0x193fe0));}}else if(_[_0xa9c5('0x9b')](_0x156f7a[_0x193fe0])){for(var _0x461091=0x0;_0x461091<_0x156f7a[_0x193fe0][_0xa9c5('0x97')];_0x461091++){this[_0xa9c5('0x98')](_0x156f7a[_0x193fe0][_0x461091],util[_0xa9c5('0x28')]('%s.%s',_0x3a98d,_0x193fe0+'['+_0x461091+']'));}}else{if(!_[_0xa9c5('0x43')](_0x156f7a[_0x193fe0])){this['channel'][_0xa9c5('0x9c')](util['format'](_0xa9c5('0x9a'),_0x3a98d,_0x193fe0),_0x156f7a[_0x193fe0]);}}}}};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x9d')]=function(_0x58b949){try{var _0x2a5df5=JSON[_0xa9c5('0x6a')](_0x58b949);this[_0xa9c5('0x96')](_0x2a5df5);return JSON[_0xa9c5('0x6f')](_0x2a5df5);}catch(_0x5c3404){return this['replaceAllVariables'](_0x58b949);}};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x95')]=function(_0x33a649){var _0x41f09e=_0x33a649['split']('{');for(var _0x5361de=0x1;_0x5361de<_0x41f09e[_0xa9c5('0x97')];_0x5361de+=0x1){var _0x3fa107=_0x41f09e[_0x5361de][_0xa9c5('0x9e')]('}');if(_0x3fa107[_0xa9c5('0x97')]>0x1){_0x33a649=_0x33a649[_0xa9c5('0x9f')]('{'+_0x3fa107[0x0]+'}',this[_0xa9c5('0xc')][_0xa9c5('0xa0')](_0x3fa107[0x0])[_0xa9c5('0xa1')]||_0x3fa107[0x0]);}}if(_0x41f09e[_0xa9c5('0x97')]===0x1){return _0x33a649['toString']();}return this[_0xa9c5('0x95')](_0x33a649);};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0xa2')]=function(_0x351c4d,_0x83042){var _0x71cb30=this[_0xa9c5('0xc')][_0xa9c5('0xa0')](_0x351c4d);if(_0x71cb30[_0xa9c5('0xa3')]===-0x1){return _0x71cb30;}logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')](_0xa9c5('0xa4'),_0x83042,_0x71cb30[_0xa9c5('0xa1')]));return this[_0xa9c5('0xc')][_0xa9c5('0x9c')](_0x83042,_0x71cb30['extra']);};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0xa5')]=function(_0x1e5ccd){return _0x1e5ccd&&_0x1e5ccd!=='0'&&_0x1e5ccd!=='-1'&&_0x1e5ccd!=='';};AGIVertices['prototype'][_0xa9c5('0xa6')]=function(_0x47ed85){this[_0xa9c5('0x35')][_0xa9c5('0x6c')](this,_0x47ed85,'-');_0x47ed85[_0xa9c5('0xa7')]=_0x47ed85[_0xa9c5('0xa6')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0xa8')]=function(_0x32f874){logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x32f874[_0xa9c5('0x37')]));if(!this[_0xa9c5('0xa5')](_0x32f874[_0xa9c5('0x5a')])){return this[_0xa9c5('0xc')][_0xa9c5('0xa9')]('no\x20text\x20configured');}var _0x2b5403='\x22'+_0x32f874[_0xa9c5('0x5a')]+'\x22';if(this[_0xa9c5('0xa5')](_0x32f874[_0xa9c5('0x75')])){_0x2b5403+=','+_0x32f874[_0xa9c5('0x75')];}var _0x49c4a3=this[_0xa9c5('0xc')]['exec'](_0xa9c5('0xaa'),_0x2b5403);if(_0x49c4a3[_0xa9c5('0xa3')]===-0x1){return _0x49c4a3;}return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util[_0xa9c5('0x28')](_0xa9c5('0xab'),_0x2b5403));};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0xac')]=function(_0x1fdc93){logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')](_0xa9c5('0xad'),_0x1fdc93[_0xa9c5('0x37')]));if(!this[_0xa9c5('0xa5')](_0x1fdc93[_0xa9c5('0xae')])){return this[_0xa9c5('0xc')][_0xa9c5('0xa9')]('no\x20grammar\x20configured');}var _0x1d0358=_0x1fdc93[_0xa9c5('0xae')];if(this[_0xa9c5('0xa5')](_0x1fdc93[_0xa9c5('0x75')])){_0x1d0358+=','+_0x1fdc93[_0xa9c5('0x75')];}var _0xdc16e9=this[_0xa9c5('0xc')][_0xa9c5('0xaf')]('MRCPRecog',_0x1d0358);if(_0xdc16e9[_0xa9c5('0xa3')]===-0x1){return _0xdc16e9;}var _0x2f06f3=this['getAndSetVariable'](_0xa9c5('0xb0'),_0xa9c5('0xb1'));if(_0x2f06f3['result']===-0x1){return _0x2f06f3;}var _0x4d2fd7=this[_0xa9c5('0xa2')](_0xa9c5('0xb2'),'MRCP_RECOG_TRANSCRIPT');if(_0x4d2fd7[_0xa9c5('0xa3')]===-0x1){return _0x4d2fd7;}var _0x46cf2e=this[_0xa9c5('0xa2')](_0xa9c5('0xb3'),_0xa9c5('0xb4'));if(_0x46cf2e[_0xa9c5('0xa3')]===-0x1){return _0x46cf2e;}return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util[_0xa9c5('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x1d0358));};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x7')]=function(_0x316728){logger[_0xa9c5('0x2c')](util['format']('Enter\x20in\x20AGI\x20(%s)\x20block',_0x316728[_0xa9c5('0x37')]));return this[_0xa9c5('0xc')][_0xa9c5('0x7')]([_0x316728[_0xa9c5('0xb5')],_0x316728[_0xa9c5('0xb6')]]);};AGIVertices[_0xa9c5('0xe')]['answer']=function(_0xca4f80){logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0xca4f80[_0xa9c5('0x37')]));if(this[_0xa9c5('0xa5')](_0xca4f80['timeout'])){logger[_0xa9c5('0x2c')](util['format'](_0xa9c5('0xb7'),_0xca4f80['timeout']));var _0x52d348=this[_0xa9c5('0xc')][_0xa9c5('0xb8')](_0xca4f80['timeout']);if(_0x52d348['result']===-0x1){return _0x52d348;}}return this[_0xa9c5('0xc')][_0xa9c5('0xb9')]();};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x4a')]=function(_0x5814cd){logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x5814cd['label']));if(!this[_0xa9c5('0xa5')](_0x5814cd['list_id'])){return this[_0xa9c5('0xc')]['error'](_0x5814cd,_0xa9c5('0xba'));}_0x5814cd['scheduledAt']=moment();if(this[_0xa9c5('0xa5')](_0x5814cd[_0xa9c5('0xbb')])){_0x5814cd[_0xa9c5('0x49')]=moment()['add'](_0x5814cd[_0xa9c5('0xbb')],_0xa9c5('0xbc'));}if(!this[_0xa9c5('0xa5')](_0x5814cd[_0xa9c5('0xbd')])){_0x5814cd[_0xa9c5('0xbd')]=0x2;}this[_0xa9c5('0x41')][_0xa9c5('0x6c')](this,_0x5814cd);return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util[_0xa9c5('0x28')](_0xa9c5('0xbe'),_0x5814cd[_0xa9c5('0x47')],_0x5814cd[_0xa9c5('0x48')],_0x5814cd[_0xa9c5('0x49')]));};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0xbf')]=function(_0x1e2b13){logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')](_0xa9c5('0xc0'),_0x1e2b13[_0xa9c5('0x37')]));var _0x1dcebb=this[_0xa9c5('0xc')][_0xa9c5('0xaf')](_0x1e2b13[_0xa9c5('0xc1')],_0x1e2b13['options']);if(_0x1dcebb[_0xa9c5('0xa3')]===-0x1){return _0x1dcebb;}return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util[_0xa9c5('0x28')]('Executed\x20command\x20%s\x20%s',_0x1e2b13[_0xa9c5('0xc1')],_0x1e2b13['options']));};AGIVertices[_0xa9c5('0xe')]['lumenvoxtts']=function(_0x3725ff){logger['info'](util[_0xa9c5('0x28')](_0xa9c5('0xc2'),_0x3725ff[_0xa9c5('0x37')]));if(!this[_0xa9c5('0xa5')](_0x3725ff['text'])){return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](_0xa9c5('0xc3'));}var _0x3e645b='\x22'+_0x3725ff[_0xa9c5('0x5a')]+'\x22';if(this['isConfigured'](_0x3725ff[_0xa9c5('0x75')])){_0x3e645b+=','+_0x3725ff[_0xa9c5('0x75')];}var _0x15d384=this['channel'][_0xa9c5('0xaf')](_0xa9c5('0xaa'),_0x3e645b);if(_0x15d384[_0xa9c5('0xa3')]===-0x1){return _0x15d384;}return this[_0xa9c5('0xc')]['noop'](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x3e645b));};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0xc4')]=function(_0x4b3edf){logger[_0xa9c5('0x2c')](util['format'](_0xa9c5('0xc5'),_0x4b3edf['label']));if(!this[_0xa9c5('0xa5')](_0x4b3edf[_0xa9c5('0x5a')])){return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](_0xa9c5('0xc3'));}var _0xd06ffc='\x22'+_0x4b3edf[_0xa9c5('0x5a')]+'\x22';if(this[_0xa9c5('0xa5')](_0x4b3edf[_0xa9c5('0x75')])){_0xd06ffc+=','+_0x4b3edf[_0xa9c5('0x75')];}var _0x8bfd88=this['channel'][_0xa9c5('0xaf')](_0xa9c5('0xaa'),_0xd06ffc);if(_0x8bfd88[_0xa9c5('0xa3')]===-0x1){return _0x8bfd88;}return this['channel'][_0xa9c5('0xa9')](util[_0xa9c5('0x28')](_0xa9c5('0xab'),_0xd06ffc));};AGIVertices['prototype'][_0xa9c5('0xc6')]=function(_0x3a4750){logger['info'](util[_0xa9c5('0x28')](_0xa9c5('0xc7'),_0x3a4750['label']));if(!this[_0xa9c5('0xa5')](_0x3a4750[_0xa9c5('0xae')])){return this[_0xa9c5('0xc')][_0xa9c5('0xa9')]('no\x20grammar\x20configured');}var _0x2cb432=_0x3a4750[_0xa9c5('0xae')];if(this[_0xa9c5('0xa5')](_0x3a4750[_0xa9c5('0x75')])){_0x2cb432+=','+_0x3a4750['options'];}var _0x43f004=this[_0xa9c5('0xc')][_0xa9c5('0xaf')](_0xa9c5('0xc8'),_0x2cb432);if(_0x43f004['result']===-0x1){return _0x43f004;}var _0x4ee92c=this[_0xa9c5('0xa2')]('RECOG_CONFIDENCE()',_0xa9c5('0xc9'));if(_0x4ee92c[_0xa9c5('0xa3')]===-0x1){return _0x4ee92c;}var _0x3dd33c=this['getAndSetVariable'](_0xa9c5('0xb2'),_0xa9c5('0xca'));if(_0x3dd33c[_0xa9c5('0xa3')]===-0x1){return _0x3dd33c;}var _0x293aed=this[_0xa9c5('0xa2')](_0xa9c5('0xb3'),_0xa9c5('0xcb'));if(_0x293aed[_0xa9c5('0xa3')]===-0x1){return _0x293aed;}return this['channel'][_0xa9c5('0xa9')](util[_0xa9c5('0x28')](_0xa9c5('0xcc'),_0x2cb432));};AGIVertices[_0xa9c5('0xe')]['sestekasr']=function(_0x1cda6f){logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x1cda6f['label']));if(!this[_0xa9c5('0xa5')](_0x1cda6f[_0xa9c5('0xae')])){return this[_0xa9c5('0xc')]['noop']('no\x20grammar\x20configured');}var _0x46006f=_0x1cda6f[_0xa9c5('0xae')];if(this['isConfigured'](_0x1cda6f[_0xa9c5('0x75')])){_0x46006f+=','+_0x1cda6f['options'];}var _0x3b2282=this[_0xa9c5('0xc')][_0xa9c5('0xaf')](_0xa9c5('0xc8'),_0x46006f);if(_0x3b2282[_0xa9c5('0xa3')]===-0x1){return _0x3b2282;}var _0xb37c8=this[_0xa9c5('0xa2')](_0xa9c5('0xb0'),_0xa9c5('0xcd'));if(_0xb37c8[_0xa9c5('0xa3')]===-0x1){return _0xb37c8;}var _0x354783=this['getAndSetVariable'](_0xa9c5('0xb2'),_0xa9c5('0xce'));if(_0x354783[_0xa9c5('0xa3')]===-0x1){return _0x354783;}var _0x1478c8=this[_0xa9c5('0xa2')](_0xa9c5('0xb3'),_0xa9c5('0xcf'));if(_0x1478c8['result']===-0x1){return _0x1478c8;}return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util[_0xa9c5('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x46006f));};AGIVertices['prototype'][_0xa9c5('0xd0')]=function(_0x174423){logger['info'](util[_0xa9c5('0x28')](_0xa9c5('0xd1'),_0x174423['label']));if(!this[_0xa9c5('0xa5')](_0x174423[_0xa9c5('0xd2')])){return this[_0xa9c5('0xc')][_0xa9c5('0x2a')](_0x174423,_0xa9c5('0xd3'));}var _0x1bf72e=this[_0xa9c5('0x18')][_0xa9c5('0x6c')](this,_0x174423[_0xa9c5('0xd2')]);if(!_0x1bf72e){return this[_0xa9c5('0xc')][_0xa9c5('0x2a')](_0x174423,'no\x20odbc\x20database\x20found');}if(!this[_0xa9c5('0xa5')](_0x174423['query'])){return this[_0xa9c5('0xc')][_0xa9c5('0x2a')](_0x174423,_0xa9c5('0xd4'));}var _0x2b7039=_0x174423['query'][_0xa9c5('0x57')](/(\r\n|\n|\r)/gm,'\x20');this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util[_0xa9c5('0x28')]('query:\x20%s',_0x2b7039));var _0x41caad=this[_0xa9c5('0xd5')][_0xa9c5('0x6c')](this,_0x1bf72e,_0x2b7039);this[_0xa9c5('0x35')]['sync'](this,_0x174423,_0x2b7039);if(!this[_0xa9c5('0xa5')](_0x174423[_0xa9c5('0xd6')])){return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](_0xa9c5('0xd7'));}var _0x1b6e7d=this[_0xa9c5('0xa0')][_0xa9c5('0x6c')](this,_0x174423[_0xa9c5('0xd6')]);if(!_0x1b6e7d){return this[_0xa9c5('0xc')][_0xa9c5('0x2a')](_0x174423,_0xa9c5('0xd8'));}var _0x3971d5=this;_0x41caad[_0xa9c5('0xd9')](function(_0x15eb7d,_0x51640b){Object[_0xa9c5('0xda')](_0x15eb7d)['forEach'](function(_0x4d2280){_0x3971d5[_0xa9c5('0xc')][_0xa9c5('0x9c')](util[_0xa9c5('0x28')](_0xa9c5('0xdb'),_0x1b6e7d,_0x51640b,_0x4d2280),_0x15eb7d[_0x4d2280]);});});this[_0xa9c5('0xc')]['setVariable'](util[_0xa9c5('0x28')]('%s_ROWS_COUNT',_0x1b6e7d),_0x41caad['length']);return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util[_0xa9c5('0x28')](_0xa9c5('0xdc'),_0x1b6e7d));};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0xdd')]=function(_0xf7d0b8){logger[_0xa9c5('0xde')](util[_0xa9c5('0x28')](_0xa9c5('0xdf'),_0xf7d0b8[_0xa9c5('0x37')]));if(!this[_0xa9c5('0xa5')](_0xf7d0b8['sip_id'])){return this[_0xa9c5('0xc')][_0xa9c5('0x2a')](_0xf7d0b8,_0xa9c5('0xe0'));}var _0x2bf1b3=this[_0xa9c5('0xe1')][_0xa9c5('0x6c')](this,_0xf7d0b8[_0xa9c5('0xe2')]);if(!_0x2bf1b3){return this[_0xa9c5('0xc')][_0xa9c5('0x2a')](_0xf7d0b8,_0xa9c5('0xe3'));}var _0x503dcf=this[_0xa9c5('0xc')]['exec'](_0xa9c5('0xe4'),[util[_0xa9c5('0x28')](_0xa9c5('0xe5'),_0x2bf1b3),_0xf7d0b8[_0xa9c5('0x64')],_0xf7d0b8[_0xa9c5('0xe6')],_0xf7d0b8[_0xa9c5('0x61')]]);if(_0x503dcf['result']===-0x1){return _0x503dcf;}return this[_0xa9c5('0xc')]['noop'](util[_0xa9c5('0x28')]('Executed\x20command\x20%s',_0xa9c5('0xe4')));};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0xe7')]=function(_0x1a5655){logger['info'](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x1a5655[_0xa9c5('0x37')]));if(!this['isConfigured'](_0x1a5655[_0xa9c5('0x77')])){return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](_0xa9c5('0xe8'));}if(!this['isConfigured'](_0x1a5655['text'])){return this['channel'][_0xa9c5('0xa9')]('no\x20text\x20configured');}this[_0xa9c5('0xc')][_0xa9c5('0xe9')]=!![];this[_0xa9c5('0x35')](_0x1a5655);this[_0xa9c5('0x40')](_0x1a5655[_0xa9c5('0x5a')],'in','','');this[_0xa9c5('0xc')]['noop'](util[_0xa9c5('0x28')](_0xa9c5('0xea'),_0x1a5655[_0xa9c5('0x5a')]));var _0x240bf4=this['googleDialogflow'][_0xa9c5('0x6c')](this,_0x1a5655);if(_0x240bf4){for(var _0x5e5233 in _0x240bf4){if(_0x240bf4['hasOwnProperty'](_0x5e5233)){this[_0xa9c5('0xc')][_0xa9c5('0x9c')](util['format'](_0xa9c5('0xeb'),_0x5e5233[_0xa9c5('0x68')]()),_0x240bf4[_0x5e5233]);}}this['createSquareMessage'](_0x240bf4[_0xa9c5('0xec')],_0xa9c5('0xed'),_0xa9c5('0xe7'),'');return this['channel'][_0xa9c5('0xa9')](util[_0xa9c5('0x28')]('Dialogflow\x20Result\x20%s',_0x240bf4[_0xa9c5('0xec')]));}return this[_0xa9c5('0xc')][_0xa9c5('0x2a')](_0x1a5655,_0xa9c5('0xee'));};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0xef')]=function(_0x2a079f){logger[_0xa9c5('0x2c')](util['format']('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x2a079f['label']));if(!this[_0xa9c5('0xa5')](_0x2a079f['dialogflowV2_project_id'])){return this[_0xa9c5('0xc')]['noop'](_0xa9c5('0xf0'));}if(!this[_0xa9c5('0xa5')](_0x2a079f[_0xa9c5('0x7b')])){return this['channel']['noop'](_0xa9c5('0xf1'));}if(!this[_0xa9c5('0xa5')](_0x2a079f[_0xa9c5('0xf2')])){return this[_0xa9c5('0xc')][_0xa9c5('0xa9')]('no\x20private_key\x20configured');}if(!this[_0xa9c5('0xa5')](_0x2a079f['dialogflowV2_language'])){return this[_0xa9c5('0xc')][_0xa9c5('0xa9')]('no\x20anguage\x20configured');}if(!this['isConfigured'](_0x2a079f[_0xa9c5('0x5a')])){return this[_0xa9c5('0xc')]['noop'](_0xa9c5('0xc3'));}this[_0xa9c5('0xc')][_0xa9c5('0xe9')]=!![];this[_0xa9c5('0x35')](_0x2a079f);this[_0xa9c5('0x40')](_0x2a079f[_0xa9c5('0x5a')],'in','','');this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util['format'](_0xa9c5('0xf3'),_0x2a079f[_0xa9c5('0x5a')]));var _0x321564=this[_0xa9c5('0x79')][_0xa9c5('0x6c')](this,_0x2a079f);if(_0x321564){for(var _0x511781 in _0x321564){if(_0x321564[_0xa9c5('0x93')](_0x511781)){if(_0x511781!==_0xa9c5('0xf4')){this['channel'][_0xa9c5('0x9c')](util[_0xa9c5('0x28')](_0xa9c5('0xeb'),_0x511781['toUpperCase']()),_0x321564[_0x511781]);}}}this[_0xa9c5('0x40')](_0x321564['speech'],_0xa9c5('0xed'),_0xa9c5('0xef'),_0x321564[_0xa9c5('0xf4')]);return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util[_0xa9c5('0x28')](_0xa9c5('0xf5'),_0x321564['speech']));}return this['channel'][_0xa9c5('0x2a')](_0x2a079f,_0xa9c5('0xf6'));};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0xf7')]=function(_0x4eceb6){logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')](_0xa9c5('0xf8'),_0x4eceb6[_0xa9c5('0x37')]));if(!this[_0xa9c5('0xa5')](_0x4eceb6['ndauth_url'])){return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](_0xa9c5('0xf9'));}if(!this[_0xa9c5('0xa5')](_0x4eceb6[_0xa9c5('0xfa')])){return this[_0xa9c5('0xc')]['noop']('no\x20username\x20configured');}if(!this[_0xa9c5('0xa5')](_0x4eceb6[_0xa9c5('0xfb')])){return this[_0xa9c5('0xc')]['noop']('no\x20password\x20configured');}if(!this[_0xa9c5('0xa5')](_0x4eceb6[_0xa9c5('0xfc')])){return this[_0xa9c5('0xc')][_0xa9c5('0xa9')]('no\x20text\x20configured');}this[_0xa9c5('0xc')]['bot']=!![];this[_0xa9c5('0x35')](_0x4eceb6);this[_0xa9c5('0x40')](_0x4eceb6['text'],'in','','');this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util[_0xa9c5('0x28')](_0xa9c5('0xfd'),_0x4eceb6[_0xa9c5('0x5a')]));var _0x5b87a8=this[_0xa9c5('0x7d')]['sync'](this,_0x4eceb6);if(_0x5b87a8){for(var _0x5e0492 in _0x5b87a8){if(_0x5b87a8['hasOwnProperty'](_0x5e0492)){this[_0xa9c5('0xc')]['setVariable'](util[_0xa9c5('0x28')](_0xa9c5('0xfe'),_0x5e0492[_0xa9c5('0x68')]()),_0x5b87a8[_0x5e0492]);}}this[_0xa9c5('0x40')](_0x5b87a8[_0xa9c5('0xec')],_0xa9c5('0xed'),'sesteknda','');if(_0x5b87a8[_0xa9c5('0xff')]){this['channel']['noop'](util[_0xa9c5('0x28')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x5b87a8[_0xa9c5('0xff')]));var _0x3c1566=this[_0xa9c5('0xc')][_0xa9c5('0x100')](_0x5b87a8[_0xa9c5('0xff')]);try{fs['unlink'](_0x5b87a8[_0xa9c5('0xff')]+'.wav');}catch(_0x83d73d){logger['error'](_0x83d73d);}return _0x3c1566;}else{return this[_0xa9c5('0xc')]['noop'](util[_0xa9c5('0x28')](_0xa9c5('0x101'),_0x5b87a8['speech']));}}return this[_0xa9c5('0xc')]['error'](_0x4eceb6,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xa9c5('0xe')]['end']=function(_0x44519f){logger[_0xa9c5('0x2c')](util['format'](_0xa9c5('0x102'),_0x44519f[_0xa9c5('0x37')]));return this[_0xa9c5('0xc')]['noop'](_0xa9c5('0x103'));};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x104')]=function(_0x4e918b){logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')](_0xa9c5('0x105'),_0x4e918b[_0xa9c5('0x37')]));var _0xf2c042='';if(_0x4e918b[_0xa9c5('0x106')]){if(!this[_0xa9c5('0xa5')](_0x4e918b[_0xa9c5('0x106')])){return this[_0xa9c5('0xc')][_0xa9c5('0x2a')](_0x4e918b,_0xa9c5('0x107'));}else{var _0x4574aa=parseInt(_0x4e918b[_0xa9c5('0x106')],0xa);if(isNaN(_0x4574aa)){_0xf2c042=_0x4e918b['trunk_id'];}else{_0xf2c042=this[_0xa9c5('0x108')][_0xa9c5('0x6c')](this,_0x4e918b[_0xa9c5('0x106')]);if(!_0xf2c042){return this[_0xa9c5('0xc')][_0xa9c5('0x2a')](_0x4e918b,_0xa9c5('0x109'));}}}}else if(_0x4e918b[_0xa9c5('0x10a')]){_0xf2c042=_0x4e918b[_0xa9c5('0x10a')];}else{return this[_0xa9c5('0xc')]['error'](_0x4e918b,_0xa9c5('0x107'));}var _0x29899c=this[_0xa9c5('0xc')][_0xa9c5('0xaf')](_0xa9c5('0xe4'),[util[_0xa9c5('0x28')](_0xa9c5('0x10b'),_0xf2c042,_0x4e918b[_0xa9c5('0x47')]),_0x4e918b[_0xa9c5('0x64')],_0x4e918b[_0xa9c5('0xe6')],_0x4e918b['url']]);if(_0x29899c['result']===-0x1){return _0x29899c;}return this[_0xa9c5('0xc')]['noop'](util[_0xa9c5('0x28')](_0xa9c5('0x10c'),_0xa9c5('0xe4')));};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x10d')]=function(_0x116aec){logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')](_0xa9c5('0x10e'),_0x116aec[_0xa9c5('0x37')]));return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](_0xa9c5('0x10d'));};AGIVertices[_0xa9c5('0xe')]['getdigits']=function(_0x44c80f){logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x44c80f['label']));if(_0x44c80f[_0xa9c5('0xa7')]===0x0){return this['maxRetry'](_0x44c80f);}_0x44c80f[_0xa9c5('0xa7')]-=0x1;if(!this[_0xa9c5('0xa5')](_0x44c80f[_0xa9c5('0x10f')])){return this[_0xa9c5('0xc')][_0xa9c5('0x2a')](_0x44c80f,_0xa9c5('0x110'));}var _0x2bad98=this[_0xa9c5('0x111')][_0xa9c5('0x6c')](this,_0x44c80f['file_id']);if(!_0x2bad98){return this[_0xa9c5('0xc')]['error'](_0x44c80f,'no\x20file\x20audio\x20found');}if(!this[_0xa9c5('0xa5')](_0x44c80f[_0xa9c5('0xd6')])){return this[_0xa9c5('0xc')][_0xa9c5('0x2a')](_0xa9c5('0xd7'));}var _0x3b0fe0=this[_0xa9c5('0xc')]['getData'](_0x2bad98,_0x44c80f['response'],_0x44c80f[_0xa9c5('0x112')]);var _0x9ab0c4=_0x3b0fe0[_0xa9c5('0xa3')]?_0x3b0fe0[_0xa9c5('0xa3')][_0xa9c5('0x113')]():'';logger[_0xa9c5('0x2c')](_0xa9c5('0x114'),JSON['stringify'](_0x3b0fe0));if(_0x3b0fe0[_0xa9c5('0xa3')]===-0x1){this[_0xa9c5('0x35')]['sync'](this,_0x44c80f,_0x9ab0c4);return _0x3b0fe0;}else if(_0x3b0fe0['extra']===_0xa9c5('0x64')){_0x3b0fe0[_0xa9c5('0xa3')]=_0x9ab0c4[_0xa9c5('0x97')]>=parseInt(_0x44c80f['mindigit'])?'x':'i';}else{_0x3b0fe0['result']=_0x9ab0c4[_0xa9c5('0x97')]>=parseInt(_0x44c80f[_0xa9c5('0x115')])&&_0x9ab0c4[_0xa9c5('0x97')]<=parseInt(_0x44c80f[_0xa9c5('0x112')])?'x':'i';}var _0x4e625e=this['getVariable'][_0xa9c5('0x6c')](this,_0x44c80f['variable_id']);if(!_0x4e625e){return this['channel'][_0xa9c5('0x2a')](_0x44c80f,_0xa9c5('0xd8'));}this[_0xa9c5('0xc')]['setVariable'](_0x4e625e,_0x9ab0c4);if(this[_0xa9c5('0xa5')](_0x44c80f[_0xa9c5('0x116')])){var _0x24da3d=parseInt(_0x44c80f[_0xa9c5('0x116')],0xa);var _0x2443ea=rs[_0xa9c5('0x117')]({'charset':'*','length':_0x24da3d});var _0x351cf2=_0x9ab0c4[_0xa9c5('0x97')];if(_0x351cf2>0x0){if(_0x351cf2>_0x24da3d){this['createSquareDetailsReport'][_0xa9c5('0x6c')](this,_0x44c80f,_0x44c80f['hiddendigitspos']===_0xa9c5('0x118')?_0x2443ea+_0x9ab0c4[_0xa9c5('0x119')](_0x24da3d):_0x9ab0c4[_0xa9c5('0x119')](0x0,_0x351cf2-_0x24da3d)+_0x2443ea);}else{this[_0xa9c5('0x35')]['sync'](this,_0x44c80f,rs['generate']({'charset':'*','length':_0x351cf2}));}}else{this[_0xa9c5('0x35')]['sync'](this,_0x44c80f,'');}}else{this[_0xa9c5('0x35')][_0xa9c5('0x6c')](this,_0x44c80f,_0x9ab0c4);}return _0x3b0fe0;};AGIVertices[_0xa9c5('0xe')]['getsecretdigits']=function(_0x2a3478){logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')](_0xa9c5('0x11a'),_0x2a3478['label']));return this['getdigits'](_0x2a3478);};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x11b')]=function(_0x4eb084){logger['info'](util['format'](_0xa9c5('0x11c'),_0x4eb084[_0xa9c5('0x37')]));this[_0xa9c5('0x35')][_0xa9c5('0x6c')](this,_0x4eb084,_0x4eb084[_0xa9c5('0x11d')]);return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util['format']('GOAL\x20%s',_0x4eb084[_0xa9c5('0x11d')]));};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x11e')]=function(_0x195828){logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')](_0xa9c5('0x11f'),_0x195828[_0xa9c5('0x37')]));if(!this[_0xa9c5('0xa5')](_0x195828[_0xa9c5('0x86')])||!this[_0xa9c5('0xa5')](_0x195828[_0xa9c5('0x87')])){return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](_0xa9c5('0x120'));}if(!this[_0xa9c5('0xa5')](_0x195828['text'])){return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](_0xa9c5('0xc3'));}this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util[_0xa9c5('0x28')](_0xa9c5('0x121'),_0x195828['text']));var _0x8d75ef=this[_0xa9c5('0x85')]['sync'](this,_0x195828);if(_0x8d75ef){this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util['format'](_0xa9c5('0x122'),_0x8d75ef));var _0x5d2b81=this[_0xa9c5('0xc')][_0xa9c5('0x100')](_0x8d75ef);try{fs[_0xa9c5('0x123')](_0x8d75ef+'.wav');}catch(_0x4c5367){logger[_0xa9c5('0x2a')](_0x4c5367);}return _0x5d2b81;}return this[_0xa9c5('0xc')][_0xa9c5('0x2a')](_0x195828,_0xa9c5('0x124'));};AGIVertices[_0xa9c5('0xe')]['awslex']=function(_0x215c8a){logger[_0xa9c5('0x2c')](util['format'](_0xa9c5('0x125'),_0x215c8a['label']));if(!this[_0xa9c5('0xa5')](_0x215c8a[_0xa9c5('0x86')])||!this[_0xa9c5('0xa5')](_0x215c8a[_0xa9c5('0x87')])){return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](_0xa9c5('0x120'));}if(!this[_0xa9c5('0xa5')](_0x215c8a[_0xa9c5('0x8b')])){return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](_0xa9c5('0x126'));}if(!this[_0xa9c5('0xa5')](_0x215c8a[_0xa9c5('0x5a')])){return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](_0xa9c5('0xc3'));}this[_0xa9c5('0xc')]['bot']=!![];this[_0xa9c5('0x35')](_0x215c8a);this['createSquareMessage'](_0x215c8a[_0xa9c5('0x5a')],'in','','');this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util[_0xa9c5('0x28')](_0xa9c5('0x127'),_0x215c8a['text']));var _0x1f7c0d=this[_0xa9c5('0x89')]['sync'](this,_0x215c8a);if(_0x1f7c0d){for(var _0x4d07df in _0x1f7c0d){if(_0x1f7c0d[_0xa9c5('0x93')](_0x4d07df)&&_[_0xa9c5('0x94')](_0x1f7c0d[_0x4d07df])){this['channel'][_0xa9c5('0x9c')](util[_0xa9c5('0x28')](_0xa9c5('0x128'),_0x4d07df[_0xa9c5('0x68')]()),_0x1f7c0d[_0x4d07df]);}}if(_['isNil'](_0x1f7c0d['message'])){return this[_0xa9c5('0xc')]['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x1f7c0d[_0xa9c5('0x129')],'out','amazonlex','');return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util[_0xa9c5('0x28')](_0xa9c5('0x12a'),_0x1f7c0d[_0xa9c5('0x129')]));}}return this[_0xa9c5('0xc')][_0xa9c5('0x2a')](_0x215c8a,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices['prototype'][_0xa9c5('0x12b')]=function(_0x4cc922){logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')](_0xa9c5('0x12c'),_0x4cc922[_0xa9c5('0x37')],_0x4cc922[_0xa9c5('0x64')]));if(!this[_0xa9c5('0xa5')](_0x4cc922[_0xa9c5('0x77')])){return this[_0xa9c5('0xc')]['noop'](_0xa9c5('0xe8'));}var _0xbfd60e=_0xa9c5('0x12d');var _0x59a5c5=util[_0xa9c5('0x28')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x4cc192=util['format'](_0xa9c5('0x9a'),_0x59a5c5,_0xbfd60e);var _0x53130b=!![];if(_0x4cc922[_0xa9c5('0x12e')]===_0xa9c5('0x12f')){_0x53130b=![];}var _0x2fbb1f=this[_0xa9c5('0xc')][_0xa9c5('0x130')](_0x59a5c5,_0xbfd60e,_0x4cc922[_0xa9c5('0x131')],_0x4cc922[_0xa9c5('0x64')],undefined,_0x53130b);if(_0x2fbb1f[_0xa9c5('0xa3')]!==-0x1){this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util[_0xa9c5('0x28')](_0xa9c5('0x132'),_0x4cc192));var _0x53f461=this['googleASR']['sync'](this,_0x4cc922,_0x4cc192);if(_0x53f461){for(var _0xdd9306 in _0x53f461){if(_0x53f461[_0xa9c5('0x93')](_0xdd9306)){this['channel'][_0xa9c5('0x9c')](util[_0xa9c5('0x28')]('GOOGLE_ASR_%s',_0xdd9306[_0xa9c5('0x68')]()),_0x53f461[_0xdd9306]);}}return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util[_0xa9c5('0x28')](_0xa9c5('0x133'),JSON[_0xa9c5('0x6f')](_0x53f461)));}}return _0x2fbb1f;};AGIVertices['prototype'][_0xa9c5('0x134')]=function(_0x4deceb){logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')](_0xa9c5('0x135'),_0x4deceb['label']));if(!this[_0xa9c5('0xa5')](_0x4deceb[_0xa9c5('0x8f')])){return this[_0xa9c5('0xc')]['noop'](_0xa9c5('0x136'));}if(!this[_0xa9c5('0xa5')](_0x4deceb[_0xa9c5('0x90')])){return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](_0xa9c5('0x137'));}var _0x4d91db=_0xa9c5('0x12d');var _0x4b0e78=util[_0xa9c5('0x28')](_0xa9c5('0x138'),FILES_PATH,rs['generate'](0x4));var _0x58277e=util[_0xa9c5('0x28')](_0xa9c5('0x9a'),_0x4b0e78,_0x4d91db);var _0x88c0f8=!![];if(_0x4deceb[_0xa9c5('0x12e')]==='NOBEEP'){_0x88c0f8=![];}var _0x24f5d0=this[_0xa9c5('0xc')][_0xa9c5('0x130')](_0x4b0e78,_0x4d91db,_0x4deceb[_0xa9c5('0x131')],_0x4deceb[_0xa9c5('0x64')],undefined,_0x88c0f8);if(_0x24f5d0['result']!==-0x1){this[_0xa9c5('0xc')]['noop'](util[_0xa9c5('0x28')](_0xa9c5('0x139'),_0x58277e));var _0xb5e1=this[_0xa9c5('0x8e')][_0xa9c5('0x6c')](this,_0x4deceb,_0x58277e);if(_0xb5e1){for(var _0xd530db in _0xb5e1){if(_0xb5e1['hasOwnProperty'](_0xd530db)){this['channel'][_0xa9c5('0x9c')](util['format'](_0xa9c5('0x13a'),_0xd530db[_0xa9c5('0x68')]()),_0xb5e1[_0xd530db]);}}return this[_0xa9c5('0xc')]['noop'](util['format'](_0xa9c5('0x13b'),JSON[_0xa9c5('0x6f')](_0xb5e1)));}}return _0x24f5d0;};AGIVertices['prototype'][_0xa9c5('0x13c')]=function(_0x32c487){logger['info'](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x32c487[_0xa9c5('0x37')]));return this[_0xa9c5('0xc')]['continueAt'](_0x32c487[_0xa9c5('0x3c')],_0x32c487[_0xa9c5('0x3d')],_0x32c487[_0xa9c5('0x3e')]);};AGIVertices[_0xa9c5('0xe')]['gotoif']=function(_0x5ec5bb){logger[_0xa9c5('0x2c')](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x5ec5bb[_0xa9c5('0x37')]));if(!this[_0xa9c5('0xa5')](_0x5ec5bb[_0xa9c5('0x13d')])){return this[_0xa9c5('0xc')]['error'](_0x5ec5bb,_0xa9c5('0x13e'));}try{var _0x5ccef2=eval(_0x5ec5bb[_0xa9c5('0x13d')])?_0xa9c5('0x13f'):_0xa9c5('0x140');this['channel']['noop'](util[_0xa9c5('0x28')](_0xa9c5('0x141'),_0x5ec5bb[_0xa9c5('0x13d')],_0x5ccef2));return{'code':0xc8,'result':_0x5ccef2};}catch(_0xc2b21c){return{'code':0xc8,'result':_0xa9c5('0x140')};}};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x142')]=function(_0xb08988){logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')](_0xa9c5('0x143'),_0xb08988[_0xa9c5('0x37')]));if(!this['isConfigured'](_0xb08988[_0xa9c5('0x144')])){return this['channel']['error'](_0xb08988,_0xa9c5('0x145'));}var _0x5ae8ab=this['getIntervals'][_0xa9c5('0x6c')](this,_0xb08988[_0xa9c5('0x144')]);if(!_0x5ae8ab){return this[_0xa9c5('0xc')][_0xa9c5('0x2a')](_0xb08988,_0xa9c5('0x146'));}for(var _0x38e797=0x0;_0x38e797<_0x5ae8ab[_0xa9c5('0x97')];_0x38e797+=0x1){var _0x2365e1=this[_0xa9c5('0xc')][_0xa9c5('0xa0')](util[_0xa9c5('0x28')](_0xa9c5('0x147'),_0x5ae8ab[_0x38e797]));if(_0x2365e1[_0xa9c5('0xa3')]===-0x1){return _0x2365e1;}logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')](_0xa9c5('0x148'),_0x5ae8ab[_0x38e797],_0x2365e1[_0xa9c5('0xa1')]));if(_0x2365e1[_0xa9c5('0xa1')]==='true'){logger['info'](util[_0xa9c5('0x28')]('IFTIME\x20%s\x20%s',_0x5ae8ab[_0x38e797],_0xa9c5('0x13f')));this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util['format'](_0xa9c5('0x148'),_0x5ae8ab[_0x38e797],_0xa9c5('0x13f')));return{'code':0xc8,'result':_0xa9c5('0x13f')};}else{logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')](_0xa9c5('0x148'),_0x5ae8ab[_0x38e797],'false'));this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util[_0xa9c5('0x28')](_0xa9c5('0x148'),_0x5ae8ab[_0x38e797],_0xa9c5('0x140')));}}return{'code':0xc8,'result':_0xa9c5('0x140')};};AGIVertices['prototype'][_0xa9c5('0x149')]=function(_0x13688e){logger[_0xa9c5('0x2c')](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x13688e[_0xa9c5('0x37')]));return this['channel'][_0xa9c5('0x149')]();};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x14a')]=function(_0x152dc0){logger['info'](util[_0xa9c5('0x28')](_0xa9c5('0x14b'),_0x152dc0[_0xa9c5('0x37')]));if(!this['isConfigured'](_0x152dc0[_0xa9c5('0x77')])){return this['channel'][_0xa9c5('0xa9')](_0xa9c5('0xe8'));}var _0x51ff04=_0xa9c5('0x12d');var _0x5d9fb8=util[_0xa9c5('0x28')](_0xa9c5('0x138'),FILES_PATH,rs[_0xa9c5('0x117')](0x4));var _0x2544ae=util[_0xa9c5('0x28')](_0xa9c5('0x9a'),_0x5d9fb8,_0x51ff04);var _0x42f090=!![];if(_0x152dc0[_0xa9c5('0x12e')]===_0xa9c5('0x12f')){_0x42f090=![];}var _0x581f6a=this[_0xa9c5('0xc')][_0xa9c5('0x130')](_0x5d9fb8,_0x51ff04,_0x152dc0[_0xa9c5('0x131')],_0x152dc0[_0xa9c5('0x64')],undefined,_0x42f090);if(_0x581f6a[_0xa9c5('0xa3')]!==-0x1){this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util[_0xa9c5('0x28')]('ispeech\x20%s\x20file\x20created',_0x2544ae));var _0x1e0ce7=this[_0xa9c5('0x82')]['sync'](this,_0x152dc0,_0x2544ae);if(_0x1e0ce7){for(var _0x15be84 in _0x1e0ce7){if(_0x1e0ce7[_0xa9c5('0x93')](_0x15be84)){this[_0xa9c5('0xc')]['setVariable'](util[_0xa9c5('0x28')]('ISPEECH_ASR_%s',_0x15be84[_0xa9c5('0x68')]()),_0x1e0ce7[_0x15be84]);}}return this['channel'][_0xa9c5('0xa9')](util[_0xa9c5('0x28')]('IspeechASR\x20Result\x20%s',JSON[_0xa9c5('0x6f')](_0x1e0ce7)));}}return _0x581f6a;};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x14c')]=function(_0x3dcb4a){logger['info'](util[_0xa9c5('0x28')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x3dcb4a[_0xa9c5('0x37')]));if(!this[_0xa9c5('0xa5')](_0x3dcb4a['key'])){return this['channel'][_0xa9c5('0xa9')]('no\x20key\x20configured');}if(!this[_0xa9c5('0xa5')](_0x3dcb4a['text'])){return this['channel']['noop'](_0xa9c5('0xc3'));}this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util[_0xa9c5('0x28')](_0xa9c5('0x14d'),_0x3dcb4a['text']));var _0xd401c6=this['ispeechTTS'][_0xa9c5('0x6c')](this,_0x3dcb4a);if(_0xd401c6){this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util[_0xa9c5('0x28')](_0xa9c5('0x14e'),_0xd401c6));var _0x3c3edf=this[_0xa9c5('0xc')]['streamFile'](_0xd401c6,_0x3dcb4a['intKey']);try{fs[_0xa9c5('0x123')](_0xd401c6+_0xa9c5('0x14f'));}catch(_0xc2ef07){logger[_0xa9c5('0x2a')](_0xc2ef07);}return _0x3c3edf;}return this[_0xa9c5('0xc')][_0xa9c5('0x2a')](_0x3dcb4a,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x150')]=function(_0x43a097){logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')](_0xa9c5('0x151'),_0x43a097[_0xa9c5('0x37')]));if(!this[_0xa9c5('0xa5')](_0x43a097[_0xa9c5('0x152')])){return this[_0xa9c5('0xc')][_0xa9c5('0x2a')](_0x43a097,_0xa9c5('0x153'));}logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xa9c5('0xc')][_0xa9c5('0x39')],_0x43a097['findBy']));var _0x3f305b=this[_0xa9c5('0x52')][_0xa9c5('0x6c')](this,_0x43a097['findBy']);if(_0x3f305b){logger['info'](util['format'](_0xa9c5('0x154'),this[_0xa9c5('0xc')]['callerid'],_0x43a097[_0xa9c5('0x152')]));this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util[_0xa9c5('0x28')](_0xa9c5('0x154'),this[_0xa9c5('0xc')][_0xa9c5('0x39')],_0x43a097[_0xa9c5('0x152')]));return{'code':0xc8,'result':_0xa9c5('0x155')};}else{logger['info'](util[_0xa9c5('0x28')](_0xa9c5('0x156'),this[_0xa9c5('0xc')][_0xa9c5('0x39')],_0x43a097[_0xa9c5('0x152')]));this['channel'][_0xa9c5('0xa9')](util[_0xa9c5('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa9c5('0xc')][_0xa9c5('0x39')],_0x43a097[_0xa9c5('0x152')]));return{'code':0xc8,'result':_0xa9c5('0x157')};}};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x158')]=function(_0x1fadbe){logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')](_0xa9c5('0x159'),_0x1fadbe[_0xa9c5('0x37')]));if(!this[_0xa9c5('0xa5')](_0x1fadbe['findBy'])){return this[_0xa9c5('0xc')]['error'](_0x1fadbe,_0xa9c5('0x153'));}logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')](_0xa9c5('0x15a'),this['channel']['callerid'],_0x1fadbe[_0xa9c5('0x152')]));var _0x457ddd=this[_0xa9c5('0x51')]['sync'](this,_0x1fadbe[_0xa9c5('0x152')]);if(_0x457ddd){logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')](_0xa9c5('0x154'),this[_0xa9c5('0xc')]['callerid'],_0x1fadbe['findBy']));this[_0xa9c5('0xc')]['noop'](util[_0xa9c5('0x28')](_0xa9c5('0x154'),this['channel'][_0xa9c5('0x39')],_0x1fadbe[_0xa9c5('0x152')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0xa9c5('0x28')](_0xa9c5('0x156'),this[_0xa9c5('0xc')]['callerid'],_0x1fadbe[_0xa9c5('0x152')]));this['channel'][_0xa9c5('0xa9')](util[_0xa9c5('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa9c5('0xc')][_0xa9c5('0x39')],_0x1fadbe[_0xa9c5('0x152')]));return{'code':0xc8,'result':_0xa9c5('0x157')};}};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x15b')]=function(_0x14f232){logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')](_0xa9c5('0x15c'),_0x14f232[_0xa9c5('0x37')]));if(!this[_0xa9c5('0xa5')](_0x14f232[_0xa9c5('0x15d')])){return this[_0xa9c5('0xc')][_0xa9c5('0x2a')](_0x14f232,_0xa9c5('0x15e'));}this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util[_0xa9c5('0x28')](_0xa9c5('0x15f'),_0x14f232[_0xa9c5('0x15d')]));var _0x229b67=eval(_0x14f232[_0xa9c5('0x15d')]);if(!this['isConfigured'](_0x14f232[_0xa9c5('0xd6')])){return this[_0xa9c5('0xc')]['noop'](_0xa9c5('0xd7'));}var _0xfec8f3=this[_0xa9c5('0xa0')][_0xa9c5('0x6c')](this,_0x14f232[_0xa9c5('0xd6')]);if(!_0xfec8f3){return this[_0xa9c5('0xc')][_0xa9c5('0x2a')](_0x14f232,_0xa9c5('0xd8'));}if(_[_0xa9c5('0x9b')](_0x229b67)){var _0x5bfa7c=this;_0x229b67['forEach'](function(_0x2e20fe,_0x3f1612){_0x5bfa7c[_0xa9c5('0xc')][_0xa9c5('0x9c')](util[_0xa9c5('0x28')](_0xa9c5('0x160'),_0xfec8f3,_0x3f1612),_0x2e20fe);});return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util['format'](_0xa9c5('0x161'),_0xfec8f3));}else{return this[_0xa9c5('0xc')]['setVariable'](_0xfec8f3,_0x229b67);}};AGIVertices['prototype'][_0xa9c5('0x162')]=function(_0x31be30){logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')](_0xa9c5('0x163'),_0x31be30[_0xa9c5('0x37')]));if(_0x31be30[_0xa9c5('0xa7')]===0x0){return this[_0xa9c5('0xa6')](_0x31be30);}_0x31be30[_0xa9c5('0xa7')]-=0x1;if(!this[_0xa9c5('0xa5')](_0x31be30[_0xa9c5('0x10f')])){return this[_0xa9c5('0xc')][_0xa9c5('0x2a')](_0x31be30,_0xa9c5('0x110'));}var _0x13e520=this['getSound']['sync'](this,_0x31be30['file_id']);if(!_0x13e520){return this[_0xa9c5('0xc')][_0xa9c5('0x2a')](_0x31be30,_0xa9c5('0x164'));}var _0x139f2c=this[_0xa9c5('0xc')]['getData'](_0x13e520,_0x31be30[_0xa9c5('0x165')],_0x31be30[_0xa9c5('0x166')]);var _0x1ba14d=_0x139f2c['result'];if(_0x139f2c[_0xa9c5('0xa3')]===-0x1){this[_0xa9c5('0x35')][_0xa9c5('0x6c')](this,_0x31be30,'-1');return _0x139f2c;}else if(_0x139f2c[_0xa9c5('0xa1')]===_0xa9c5('0x64')){_0x139f2c[_0xa9c5('0xa3')]=_0x139f2c[_0xa9c5('0xa3')][_0xa9c5('0x97')]>0x0?_0x139f2c[_0xa9c5('0xa3')]:'t';}else if(_[_0xa9c5('0x42')](_0x139f2c[_0xa9c5('0xa3')])){_0x139f2c[_0xa9c5('0xa3')]='#';_0x1ba14d='#';}if(!this[_0xa9c5('0xa5')](_0x31be30['variable_id'])){this[_0xa9c5('0xc')][_0xa9c5('0xa9')](_0xa9c5('0xd7'));}else{var _0x4d6b70=this[_0xa9c5('0xa0')]['sync'](this,_0x31be30[_0xa9c5('0xd6')]);if(!_0x4d6b70){return this['channel'][_0xa9c5('0x2a')](_0x31be30,_0xa9c5('0xd8'));}this[_0xa9c5('0xc')][_0xa9c5('0x9c')](_0x4d6b70,_0x1ba14d);}this[_0xa9c5('0x35')]['sync'](this,_0x31be30,_0x1ba14d);return _0x139f2c;};AGIVertices[_0xa9c5('0xe')]['noop']=function(_0x5691dc){logger['info'](util['format'](_0xa9c5('0x167'),_0x5691dc[_0xa9c5('0x37')]));return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](_0x5691dc[_0xa9c5('0x168')]||_0x5691dc[_0xa9c5('0x37')]);};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x169')]=function(_0x56f183){logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')](_0xa9c5('0x16a'),_0x56f183[_0xa9c5('0x37')]));if(!this[_0xa9c5('0xa5')](_0x56f183[_0xa9c5('0x152')])){return this[_0xa9c5('0xc')][_0xa9c5('0x2a')](_0x56f183,'no\x20find\x20by\x20configured');}logger[_0xa9c5('0x2c')](util['format'](_0xa9c5('0x15a'),this['channel'][_0xa9c5('0x39')],_0x56f183['findBy']));var _0x59a91b=this['getPause'][_0xa9c5('0x6c')](this,_0x56f183[_0xa9c5('0x16b')]);var _0x54d2d8=this[_0xa9c5('0x4e')]['sync'](this,_0x56f183['findBy'],_0x59a91b);if(_0x54d2d8){logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa9c5('0xc')][_0xa9c5('0x39')],_0x56f183[_0xa9c5('0x152')]));this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util[_0xa9c5('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa9c5('0xc')][_0xa9c5('0x39')],_0x56f183[_0xa9c5('0x152')]));return{'code':0xc8,'result':_0xa9c5('0x155')};}else{logger[_0xa9c5('0x2c')](util['format'](_0xa9c5('0x156'),this[_0xa9c5('0xc')]['callerid'],_0x56f183[_0xa9c5('0x152')]));this[_0xa9c5('0xc')]['noop'](util[_0xa9c5('0x28')](_0xa9c5('0x154'),this[_0xa9c5('0xc')][_0xa9c5('0x39')],_0x56f183[_0xa9c5('0x152')]));return{'code':0xc8,'result':_0xa9c5('0x157')};}};AGIVertices['prototype'][_0xa9c5('0x16c')]=function(_0x4009d6){logger[_0xa9c5('0x2c')](util['format'](_0xa9c5('0x16d'),_0x4009d6['label']));if(!this[_0xa9c5('0xa5')](_0x4009d6['file_id'])){return this[_0xa9c5('0xc')]['error'](_0x4009d6,_0xa9c5('0x110'));}var _0x51742=this[_0xa9c5('0x111')]['sync'](this,_0x4009d6[_0xa9c5('0x10f')]);if(!_0x51742){return this['channel'][_0xa9c5('0x2a')](_0x4009d6,'no\x20file\x20audio\x20found');}var _0x37d4ca=this['channel'][_0xa9c5('0xaf')]('PLAYBACK',[_0x51742,_0x4009d6[_0xa9c5('0xe6')]]);if(_0x37d4ca[_0xa9c5('0xa3')]===-0x1){return _0x37d4ca;}return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util['format'](_0xa9c5('0x16e'),_0xa9c5('0x16f'),_0x51742));};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x170')]=function(_0x356c58){logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')](_0xa9c5('0x171'),_0x356c58[_0xa9c5('0x37')]));if(!this['isConfigured'](_0x356c58[_0xa9c5('0x172')])){return this['channel'][_0xa9c5('0x2a')](_0x356c58,_0xa9c5('0x173'));}var _0x52d970='';var _0x27df11=parseInt(_0x356c58[_0xa9c5('0x172')],0xa);if(isNaN(_0x27df11)){_0x52d970=_0x356c58[_0xa9c5('0x172')];}else{_0x52d970=this[_0xa9c5('0x14')][_0xa9c5('0x6c')](this,_0x356c58[_0xa9c5('0x172')]);if(!_0x52d970){return this['channel'][_0xa9c5('0x2a')](_0x356c58,_0xa9c5('0x174'));}}var _0x44eebf='';if(this[_0xa9c5('0xa5')](_0x356c58[_0xa9c5('0x10f')])){var _0x5632f2=this[_0xa9c5('0x111')]['sync'](this,_0x356c58[_0xa9c5('0x10f')]);if(_0x5632f2){_0x44eebf=_0x5632f2;}}this[_0xa9c5('0x35')][_0xa9c5('0x6c')](this,_0x356c58,_0x52d970);if(_0x356c58[_0xa9c5('0xe6')][_0xa9c5('0x175')]('x')<0x0){_0x356c58[_0xa9c5('0xe6')]+='x';}if(_0x356c58['opts'][_0xa9c5('0x175')]('X')<0x0){_0x356c58[_0xa9c5('0xe6')]+='X';}this['channel']['setVariable'](_0xa9c5('0x176'),_0x52d970?_0x52d970[_0xa9c5('0x177')]():'');var _0x207523=this['channel']['exec'](_0xa9c5('0x178'),[_0x52d970,_0x356c58['opts'],_0x356c58[_0xa9c5('0x61')],_0x44eebf,_0x356c58['timeout'],_0x356c58[_0xa9c5('0x7')],_0x356c58[_0xa9c5('0x179')],_0x356c58[_0xa9c5('0x17a')],'',_0x356c58[_0xa9c5('0x17b')]]);if(_0x207523[_0xa9c5('0xa3')]===-0x1){return _0x207523;}return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util[_0xa9c5('0x28')](_0xa9c5('0x16e'),_0xa9c5('0x178'),_0x52d970));};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x17c')]=function(_0x55932f){logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')](_0xa9c5('0x17d'),_0x55932f[_0xa9c5('0x37')]));var _0x178313=_0x55932f[_0xa9c5('0x17e')]||_0xa9c5('0x12d');var _0x2dce09=util['format'](_0xa9c5('0x17f'),this[_0xa9c5('0xc')][_0xa9c5('0x36')],rs[_0xa9c5('0x117')](0x5));var _0x51de53=util[_0xa9c5('0x28')]('%s/recordings/%s.%s',FILES_PATH,_0x2dce09,_0x178313);var _0x2aa9df=util[_0xa9c5('0x28')](_0xa9c5('0x138'),FILES_PATH,_0x2dce09);this[_0xa9c5('0x3a')]['sync'](this,_0x55932f,_0x2dce09,_0x51de53);this[_0xa9c5('0xc')]['setVariable'](_0xa9c5('0x180'),_0x2dce09);logger['info'](_0xa9c5('0x181'),_0x2aa9df,_0x178313,_0x55932f[_0xa9c5('0x182')],_0x55932f[_0xa9c5('0x64')]);return this['channel'][_0xa9c5('0x130')](_0x2aa9df,_0x178313,_0x55932f[_0xa9c5('0x182')],_0x55932f[_0xa9c5('0x64')],undefined,!![]);};AGIVertices[_0xa9c5('0xe')]['restapi']=function(_0x1f1194){logger[_0xa9c5('0x2c')](util['format'](_0xa9c5('0x183'),_0x1f1194[_0xa9c5('0x37')]));if(!this[_0xa9c5('0xa5')](_0x1f1194[_0xa9c5('0x61')])){return this[_0xa9c5('0xc')]['noop'](_0xa9c5('0x184'));}var _0x14eded=this['restAPI'][_0xa9c5('0x6c')](this,_0x1f1194);logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')](_0xa9c5('0x185'),util[_0xa9c5('0x186')](_0x14eded,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x1f1194['variable_id'])){return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](_0xa9c5('0x187'));}var _0x32ffa1=this['getVariable']['sync'](this,_0x1f1194[_0xa9c5('0xd6')]);if(!_0x32ffa1){return this[_0xa9c5('0xc')][_0xa9c5('0x2a')](_0x1f1194,_0xa9c5('0xd8'));}this[_0xa9c5('0xc')]['setVariable'](util['format'](_0xa9c5('0x188'),_0x32ffa1),_0x14eded[_0xa9c5('0x72')]?_0x14eded['statusCode']:_0xa9c5('0x189'));this[_0xa9c5('0xc')][_0xa9c5('0x9c')](util[_0xa9c5('0x28')](_0xa9c5('0x18a'),_0x32ffa1),_0x14eded[_0xa9c5('0x73')]?_0x14eded[_0xa9c5('0x73')]:'OK');if(_0x14eded[_0xa9c5('0x69')]){try{this[_0xa9c5('0x98')](_0x14eded[_0xa9c5('0x69')],_0x32ffa1);}catch(_0x5f39de){logger[_0xa9c5('0x2a')](util[_0xa9c5('0x28')](_0xa9c5('0x18b'),_0x32ffa1));}}return this['channel'][_0xa9c5('0xa9')](util[_0xa9c5('0x28')]('variable\x20%s\x20set',_0x32ffa1));};AGIVertices[_0xa9c5('0xe')]['saydigits']=function(_0x45df21){logger['info'](util[_0xa9c5('0x28')](_0xa9c5('0x18c'),_0x45df21['label']));return this[_0xa9c5('0xc')][_0xa9c5('0x18d')](_0x45df21[_0xa9c5('0x18e')][_0xa9c5('0x57')](/\s+/g,''),_0x45df21[_0xa9c5('0x182')]);};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x18f')]=function(_0x871c29){logger['info'](util['format'](_0xa9c5('0x190'),_0x871c29[_0xa9c5('0x37')]));return this[_0xa9c5('0xc')]['sayNumber'](_0x871c29['number'][_0xa9c5('0x57')](/\s+/g,''),_0x871c29[_0xa9c5('0x182')]);};AGIVertices['prototype'][_0xa9c5('0x191')]=function(_0x908b65){logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')](_0xa9c5('0x192'),_0x908b65[_0xa9c5('0x37')]));return this[_0xa9c5('0xc')][_0xa9c5('0x193')](_0x908b65[_0xa9c5('0x5a')],_0x908b65[_0xa9c5('0x182')]);};AGIVertices['prototype'][_0xa9c5('0x194')]=function(_0x3b5640){logger['info'](util[_0xa9c5('0x28')](_0xa9c5('0x195'),_0x3b5640[_0xa9c5('0x37')]));if(!this[_0xa9c5('0xa5')](_0x3b5640[_0xa9c5('0x196')])){return this[_0xa9c5('0xc')]['noop']('no\x20mail\x20account\x20configured');}var _0x1e4d3=this[_0xa9c5('0x1f')][_0xa9c5('0x6c')](this,_0x3b5640[_0xa9c5('0x196')]);if(!_0x1e4d3||!_0x1e4d3[_0xa9c5('0x197')]){return this['channel']['error'](_0x3b5640,_0xa9c5('0x198'));}var _0x2eb427={'from':util[_0xa9c5('0x28')]('\x22%s\x22\x20<%s>',_0x1e4d3[_0xa9c5('0x12')],_0x1e4d3[_0xa9c5('0x199')]||_0x1e4d3[_0xa9c5('0x197')][_0xa9c5('0x19a')]),'to':_0x3b5640['to']||'','cc':_0x3b5640['cc']||'','bcc':_0x3b5640[_0xa9c5('0x19b')]||'','subject':_0x3b5640[_0xa9c5('0x19c')],'html':_0x3b5640[_0xa9c5('0x5a')],'text':_0x3b5640[_0xa9c5('0x5a')]};if(this[_0xa9c5('0xa5')](_0x3b5640['template_id'])){}logger['debug'](_0xa9c5('0x19d'),JSON['stringify'](_0x2eb427));this[_0xa9c5('0x35')]['sync'](this,_0x3b5640,_0x3b5640[_0xa9c5('0x196')]);this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util[_0xa9c5('0x28')](_0xa9c5('0x19e'),_0x1e4d3[_0xa9c5('0x12')]));this[_0xa9c5('0x21')][_0xa9c5('0x6c')](this,_0x1e4d3[_0xa9c5('0x19f')],_0x2eb427);return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](_0xa9c5('0x1a0'));};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x1a1')]=function(_0x4a922c){logger[_0xa9c5('0x2c')](util['format'](_0xa9c5('0x1a2'),_0x4a922c[_0xa9c5('0x37')]));return this[_0xa9c5('0xc')]['noop'](_0xa9c5('0x1a3'));};AGIVertices[_0xa9c5('0xe')]['sendSMS']=function(_0x30501d){logger['info'](util[_0xa9c5('0x28')](_0xa9c5('0x1a4'),_0x30501d[_0xa9c5('0x37')]));if(!this[_0xa9c5('0xa5')](_0x30501d[_0xa9c5('0x1a5')])){return this['channel'][_0xa9c5('0xa9')](_0xa9c5('0x1a6'));}var _0x35c1be=this[_0xa9c5('0x32')][_0xa9c5('0x6c')](this,_0x30501d[_0xa9c5('0x1a5')]);if(!_0x35c1be){return this[_0xa9c5('0xc')][_0xa9c5('0x2a')](_0x30501d,_0xa9c5('0x1a7'));}var _0x532eb4={'body':_0x30501d['sms_text'],'phone':_0x30501d['to']||'','SmsAccountId':_0x35c1be['id']};logger[_0xa9c5('0xde')](_0xa9c5('0x1a8'),JSON[_0xa9c5('0x6f')](_0x532eb4));this[_0xa9c5('0x35')][_0xa9c5('0x6c')](this,_0x30501d,_0x30501d[_0xa9c5('0x1a5')]);this[_0xa9c5('0xc')]['noop'](util['format'](_0xa9c5('0x1a9'),_0x35c1be[_0xa9c5('0x12')]));this['createSmsMessage'][_0xa9c5('0x6c')](this,_0x532eb4);return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](_0xa9c5('0x1aa'));};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x1ab')]=function(_0x468cb4){logger['info'](util[_0xa9c5('0x28')](_0xa9c5('0x1ac'),_0x468cb4[_0xa9c5('0x37')]));if(!this[_0xa9c5('0xa5')](_0x468cb4[_0xa9c5('0xd6')])){return this['channel'][_0xa9c5('0x2a')](_0x468cb4,_0xa9c5('0x1ad'));}var _0x30fb9f=this['getVariable'][_0xa9c5('0x6c')](this,_0x468cb4[_0xa9c5('0xd6')]);if(!_0x30fb9f){return this[_0xa9c5('0xc')][_0xa9c5('0x2a')](_0x468cb4,_0xa9c5('0xd8'));}return this[_0xa9c5('0xc')][_0xa9c5('0x9c')](_0x30fb9f,_0x468cb4[_0xa9c5('0x1ae')]);};AGIVertices[_0xa9c5('0xe')]['start']=function(_0x39ecc4){logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')](_0xa9c5('0x1af'),_0x39ecc4[_0xa9c5('0x37')]));this[_0xa9c5('0xc')][_0xa9c5('0xa9')](_0xa9c5('0x1b0'));var _0x23b569=this[_0xa9c5('0xc')]['getVariable'](_0xa9c5('0x1b1'));if(!_[_0xa9c5('0x42')](_0x23b569['extra'])){this[_0xa9c5('0xc')]['uniqueid']=_0x23b569[_0xa9c5('0xa1')];}if(_0x39ecc4[_0xa9c5('0xb9')]==='yes'){this['channel'][_0xa9c5('0xa9')](_0xa9c5('0x1b2'));return this[_0xa9c5('0xc')]['answer']();}return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](_0xa9c5('0x1b3'));};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x1b4')]=function(_0x53e506){logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')](_0xa9c5('0x1b5'),_0x53e506['label']));if(!this[_0xa9c5('0xa5')](_0x53e506['project_id'])){return this['channel'][_0xa9c5('0x2a')](_0x53e506,_0xa9c5('0x1b6'));}var _0x3930d1=this['getSquareProject'][_0xa9c5('0x6c')](this,_0x53e506[_0xa9c5('0x1b7')]);if(!this['isConfigured'](_0x3930d1)){return this[_0xa9c5('0xc')]['error'](_0x53e506,util[_0xa9c5('0x28')](_0xa9c5('0x1b8'),_0x53e506[_0xa9c5('0x1b7')]));}if(_0x3930d1===this[_0xa9c5('0xc')][_0xa9c5('0x3f')]){return this[_0xa9c5('0xc')]['error'](_0x53e506,_0xa9c5('0x1b9'));}this[_0xa9c5('0x35')][_0xa9c5('0x6c')](this,_0x53e506,_0x3930d1);var _0x497a84=this[_0xa9c5('0xc')][_0xa9c5('0xaf')](_0xa9c5('0x1ba'),util[_0xa9c5('0x28')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0xa9c5('0x7')][_0xa9c5('0x1bb')]||_0xa9c5('0x1bc'),_0x3930d1,this[_0xa9c5('0xc')][_0xa9c5('0x3f')]));if(_0x497a84[_0xa9c5('0xa3')]===-0x1){return _0x497a84;}return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util[_0xa9c5('0x28')]('Executed\x20command\x20%s\x20%s',_0xa9c5('0x1ba'),_0x3930d1));};AGIVertices['prototype'][_0xa9c5('0x1bd')]=function(_0x5b5e20){logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')](_0xa9c5('0x1be'),_0x5b5e20[_0xa9c5('0x37')]));var _0xb8cde1=this[_0xa9c5('0x56')][_0xa9c5('0x6c')](this,_0x5b5e20['command']);this[_0xa9c5('0x35')][_0xa9c5('0x6c')](this,_0x5b5e20,_0x5b5e20['command']);if(this[_0xa9c5('0xa5')](_0x5b5e20[_0xa9c5('0xd6')])){var _0x5582c7=this[_0xa9c5('0xa0')][_0xa9c5('0x6c')](this,_0x5b5e20[_0xa9c5('0xd6')]);if(_0x5582c7){this[_0xa9c5('0xc')][_0xa9c5('0x9c')](_0x5582c7,_0xb8cde1);return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util['format']('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x5b5e20[_0xa9c5('0xb5')],_0x5582c7));}}return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util[_0xa9c5('0x28')](_0xa9c5('0x1bf'),_0x5b5e20[_0xa9c5('0xb5')]));};AGIVertices['prototype'][_0xa9c5('0x1c0')]=function(_0x4908e4){logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')](_0xa9c5('0x1c1'),_0x4908e4[_0xa9c5('0x37')]));_0x4908e4['text']=_0x4908e4['text'][_0xa9c5('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x4908e4[_0xa9c5('0x1c2')])){return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](_0xa9c5('0x1c3'));}if(!this['isConfigured'](_0x4908e4[_0xa9c5('0x5a')])){return this[_0xa9c5('0xc')][_0xa9c5('0xa9')](_0xa9c5('0xc3'));}this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util['format'](_0xa9c5('0x1c4'),_0x4908e4[_0xa9c5('0x5a')]));var _0x450611=this[_0xa9c5('0x58')][_0xa9c5('0x6c')](this,_0x4908e4);if(_0x450611){this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util[_0xa9c5('0x28')](_0xa9c5('0x1c5'),_0x450611));var _0x43b746=this[_0xa9c5('0xc')][_0xa9c5('0x100')](_0x450611);try{fs[_0xa9c5('0x123')](_0x450611+_0xa9c5('0x14f'));}catch(_0x247420){logger[_0xa9c5('0x2a')](_0x247420);}return _0x43b746;}return this[_0xa9c5('0xc')]['error'](_0x4908e4,_0xa9c5('0x1c6'));};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x1c7')]=function(_0x17f53c){logger['info'](util['format'](_0xa9c5('0x1c8'),_0x17f53c[_0xa9c5('0x37')]));_0x17f53c[_0xa9c5('0x5a')]=_0x17f53c['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa9c5('0xa5')](_0x17f53c['text'])){return this[_0xa9c5('0xc')][_0xa9c5('0xa9')]('no\x20text\x20configured');}this['channel'][_0xa9c5('0xa9')](util[_0xa9c5('0x28')](_0xa9c5('0x1c9'),_0x17f53c[_0xa9c5('0x5a')]));var _0x16dd78=this['googleTTS']['sync'](this,_0x17f53c);if(_0x16dd78){this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util[_0xa9c5('0x28')](_0xa9c5('0x1ca'),_0x16dd78));var _0x5a490c=this['channel'][_0xa9c5('0x100')](_0x16dd78);try{fs['unlink'](_0x16dd78+_0xa9c5('0x14f'));}catch(_0x5cfb7e){logger[_0xa9c5('0x2a')](_0x5cfb7e);}return _0x5a490c;}return this[_0xa9c5('0xc')][_0xa9c5('0x2a')](_0x17f53c,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x1cb')]=function(_0x4d3dfc){logger['info'](util[_0xa9c5('0x28')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x4d3dfc['label']));if(!this[_0xa9c5('0xa5')](_0x4d3dfc['findBy'])){return this[_0xa9c5('0xc')]['error'](_0x4d3dfc,_0xa9c5('0x153'));}logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xa9c5('0xc')][_0xa9c5('0x39')],_0x4d3dfc[_0xa9c5('0x152')]));var _0x574fa8=this['agentUnpause'][_0xa9c5('0x6c')](this,_0x4d3dfc[_0xa9c5('0x152')]);if(_0x574fa8){logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')](_0xa9c5('0x154'),this[_0xa9c5('0xc')][_0xa9c5('0x39')],_0x4d3dfc[_0xa9c5('0x152')]));this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util[_0xa9c5('0x28')](_0xa9c5('0x154'),this[_0xa9c5('0xc')][_0xa9c5('0x39')],_0x4d3dfc[_0xa9c5('0x152')]));return{'code':0xc8,'result':_0xa9c5('0x155')};}else{logger['info'](util[_0xa9c5('0x28')](_0xa9c5('0x156'),this[_0xa9c5('0xc')]['callerid'],_0x4d3dfc[_0xa9c5('0x152')]));this[_0xa9c5('0xc')][_0xa9c5('0xa9')](util[_0xa9c5('0x28')](_0xa9c5('0x156'),this[_0xa9c5('0xc')][_0xa9c5('0x39')],_0x4d3dfc[_0xa9c5('0x152')]));return{'code':0xc8,'result':_0xa9c5('0x157')};}};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x1cc')]=function(_0x29f363){logger['info'](util['format']('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x29f363[_0xa9c5('0x37')]));var _0x349d92=this['channel'][_0xa9c5('0xaf')](_0xa9c5('0x1cd'),[_0x29f363['mailbox'],_0x29f363['options']]);if(_0x349d92[_0xa9c5('0xa3')]===-0x1){return _0x349d92;}return this[_0xa9c5('0xc')]['noop'](util['format']('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x29f363[_0xa9c5('0x1ce')]));};AGIVertices[_0xa9c5('0xe')][_0xa9c5('0x1cf')]=function(_0x26f495){logger[_0xa9c5('0x2c')](util[_0xa9c5('0x28')](_0xa9c5('0x1d0'),_0x26f495[_0xa9c5('0x37')]));if(!this[_0xa9c5('0xa5')](_0x26f495[_0xa9c5('0xd6')])){return this[_0xa9c5('0xc')][_0xa9c5('0x2a')](_0x26f495,_0xa9c5('0x1ad'));}var _0xc3f1a6=this[_0xa9c5('0xa0')][_0xa9c5('0x6c')](this,_0x26f495[_0xa9c5('0xd6')]);if(!_0xc3f1a6){return this[_0xa9c5('0xc')][_0xa9c5('0x2a')](_0x26f495,_0xa9c5('0xd8'));}var _0x1d4606=this[_0xa9c5('0xc')][_0xa9c5('0xa0')](_0xc3f1a6);return{'code':0xc8,'result':_0x1d4606[_0xa9c5('0xa1')]?_0x1d4606[_0xa9c5('0xa1')]:'-'};};String[_0xa9c5('0xe')][_0xa9c5('0x9f')]=function(_0x4382f3,_0x3243a9){return this[_0xa9c5('0x9e')](_0x4382f3)[_0xa9c5('0x1d1')](_0x3243a9);};module[_0xa9c5('0x1d2')]=AGIVertices; \ No newline at end of file +var _0x56e6=['ispeech\x20TTS\x20is\x20unreachable','login','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','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','math','no\x20operation\x20configured','math\x20%s','operation','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','getVoiceQueue','no\x20queue\x20found','indexOf','toLowerCase','gosub','position','record','recordingFormat','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','no\x20mail\x20account\x20configured','getMailAccount','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendMailMessage','smtpOptions','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','shellCommand','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','failure','voicemail','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','util','lodash','shelljs','odbc','randomstring','moment','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','name','catch','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','then','dsn','getUser','getUserById','getTrunk','getSound','getSoundById','getSoundPath','save_name','getMailAccountById','getIntervalById','IntervalId','map','Intervals','interval','getQueryOdbc','open','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','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','extension','priority','file','createSquareMessage','createCmContact','isEmpty','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','isNil','agentUnpause','agent','agentLogout','internal','agentLogin','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','speed','ispeechASR','ispeech_asr_language','en-US','isConfigured','model','awsPolly','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','google_asr_language','tildeASR','appid','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','format','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','MRCPSynth','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','no\x20list\x20selected','delay','add','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','out','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','SestekNDA\x20Result\x20%s','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','variable_id','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','beep','NOBEEP','recordFile','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','%s/recordings/%s','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','context','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','getIntervals','no\x20intervals\x20found','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeechTTS','.wav'];(function(_0x29507c,_0x20c803){var _0x225585=function(_0x4f4dfe){while(--_0x4f4dfe){_0x29507c['push'](_0x29507c['shift']());}};_0x225585(++_0x20c803);}(_0x56e6,0x6b));var _0x656e=function(_0x5593d5,_0x2eb560){_0x5593d5=_0x5593d5-0x0;var _0x34b7bc=_0x56e6[_0x5593d5];return _0x34b7bc;};'use strict';var fs=require('fs');var util=require(_0x656e('0x0'));var _=require(_0x656e('0x1'));var sh=require(_0x656e('0x2'));var odbc=require(_0x656e('0x3'))();var rs=require(_0x656e('0x4'));var moment=require(_0x656e('0x5'));var Mustache=require('mustache');var rp=require(_0x656e('0x6'));var logger=require(_0x656e('0x7'))(_0x656e('0x8'));var config=require(_0x656e('0x9'));var scripts=require(_0x656e('0xa'));var FILES_PATH=_0x656e('0xb');var recursiveMapAttributes=[_0x656e('0xc'),'rawBody'];var verticesWithRetry=[_0x656e('0xd'),_0x656e('0xe'),_0x656e('0xf')];var AGIVertices=function(_0x2fc011,_0x381a05,_0x16260d){this[_0x656e('0x10')]=_0x2fc011;this[_0x656e('0x11')]=_0x381a05;this[_0x656e('0x12')]=_0x16260d;};AGIVertices[_0x656e('0x13')][_0x656e('0x14')]=function(_0x6cde13,_0xcfedd2){this[_0x656e('0x11')]['getVariableById'](_0x6cde13)['then'](function(_0xf30829){_0xcfedd2(null,_0xf30829?_0xf30829[_0x656e('0x15')]:![]);})[_0x656e('0x16')](function(_0x460aad){_0xcfedd2(_0x460aad);});};AGIVertices['prototype']['getVoiceQueue']=function(_0x1f8431,_0x3b1bb6){this['rpc'][_0x656e('0x17')](_0x1f8431)['then'](function(_0x2ce681){_0x3b1bb6(null,_0x2ce681?_0x2ce681[_0x656e('0x15')]:![]);})[_0x656e('0x16')](function(_0x1f839f){_0x3b1bb6(_0x1f839f);});};AGIVertices['prototype'][_0x656e('0x18')]=function(_0x38e2e3,_0x3e4d1e){this[_0x656e('0x11')][_0x656e('0x19')](_0x38e2e3)['then'](function(_0x5e762d){_0x3e4d1e(null,_0x5e762d?_0x5e762d['name']:![]);})[_0x656e('0x16')](function(_0x1b0fdd){_0x3e4d1e(_0x1b0fdd);});};AGIVertices['prototype'][_0x656e('0x1a')]=function(_0x555d67,_0x495f60){this['rpc'][_0x656e('0x1b')](_0x555d67)[_0x656e('0x1c')](function(_0xdc59dd){_0x495f60(null,_0xdc59dd?_0xdc59dd[_0x656e('0x1d')]:![]);})['catch'](function(_0x173600){_0x495f60(_0x173600);});};AGIVertices[_0x656e('0x13')][_0x656e('0x1e')]=function(_0x59c19f,_0x159e42){this[_0x656e('0x11')][_0x656e('0x1f')](_0x59c19f)[_0x656e('0x1c')](function(_0x20eb26){_0x159e42(null,_0x20eb26?_0x20eb26[_0x656e('0x15')]:![]);})[_0x656e('0x16')](function(_0x57ac6c){_0x159e42(_0x57ac6c);});};AGIVertices[_0x656e('0x13')][_0x656e('0x20')]=function(_0x5c5d4c,_0x494f3a){this[_0x656e('0x11')]['getTrunkById'](_0x5c5d4c)[_0x656e('0x1c')](function(_0x5b492e){_0x494f3a(null,_0x5b492e?_0x5b492e['name']:![]);})[_0x656e('0x16')](function(_0x4e2a80){_0x494f3a(_0x4e2a80);});};AGIVertices[_0x656e('0x13')][_0x656e('0x21')]=function(_0x26d486,_0x514272){var _0x4cb7ca=this;this[_0x656e('0x11')][_0x656e('0x22')](_0x26d486)[_0x656e('0x1c')](function(_0x469acf){_0x514272(null,_0x469acf?_0x4cb7ca[_0x656e('0x23')](_0x469acf[_0x656e('0x24')]):![]);})[_0x656e('0x16')](function(_0x58181e){_0x514272(_0x58181e);});};AGIVertices[_0x656e('0x13')]['getMailAccount']=function(_0x44d79c,_0x33d446){this['rpc'][_0x656e('0x25')](_0x44d79c)['then'](function(_0x4a7fbb){_0x33d446(null,_0x4a7fbb?_0x4a7fbb:![]);})[_0x656e('0x16')](function(_0x7a14cc){_0x33d446(_0x7a14cc);});};AGIVertices[_0x656e('0x13')]['sendMailMessage']=function(_0x16d991,_0x4d70f2,_0x3b545b){this[_0x656e('0x12')]['sendMailMessage'](_0x16d991,_0x4d70f2)[_0x656e('0x1c')](function(){_0x3b545b(null);})['catch'](function(_0x599386){_0x3b545b(_0x599386);});};AGIVertices[_0x656e('0x13')]['getIntervals']=function(_0x423eb1,_0x4694d3){this[_0x656e('0x11')][_0x656e('0x26')](_0x423eb1)['then'](function(_0x533d2c){if(_0x533d2c){if(_0x533d2c[_0x656e('0x27')]){_0x4694d3(null,[_0x533d2c['interval']]);}else{_0x4694d3(null,_[_0x656e('0x28')](_0x533d2c[_0x656e('0x29')],_0x656e('0x2a')));}}else{_0x4694d3(null,![]);}})[_0x656e('0x16')](function(_0x2709a7){_0x4694d3(_0x2709a7);});};AGIVertices[_0x656e('0x13')]['getSoundPath']=function(_0x5d792d){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0x5d792d);};AGIVertices['prototype'][_0x656e('0x2b')]=function(_0x4796b7,_0x502e27,_0x10dfd6){odbc[_0x656e('0x2c')](_0x4796b7,function(_0x412ce2){if(_0x412ce2){logger[_0x656e('0x2d')](_0x656e('0x2e'),_0x412ce2);_0x10dfd6(_0x412ce2);}else{logger[_0x656e('0x2f')](_0x656e('0x30'));odbc[_0x656e('0x31')](_0x502e27,function(_0x37aa7a,_0x24c18c){if(_0x37aa7a){logger[_0x656e('0x2f')](_0x656e('0x32'),_0x502e27);_0x10dfd6(_0x37aa7a);}else{logger[_0x656e('0x2f')]('Query\x20executed\x20correctly\x20%s',_0x502e27);odbc[_0x656e('0x33')](function(_0x4adae5){if(_0x4adae5){logger['error'](_0x656e('0x34'),_0x4adae5);}_0x10dfd6(null,_0x24c18c);});}});}});};AGIVertices[_0x656e('0x13')][_0x656e('0x35')]=function(_0x5cd5e9,_0x554ef2){this['rpc'][_0x656e('0x36')](_0x5cd5e9)[_0x656e('0x1c')](function(_0x3e6266){_0x554ef2(null,_0x3e6266?_0x3e6266:![]);})[_0x656e('0x16')](function(_0x1e9c67){_0x554ef2(_0x1e9c67);});};AGIVertices[_0x656e('0x13')][_0x656e('0x37')]=function(_0x38d3f2,_0x662c0){this[_0x656e('0x11')][_0x656e('0x37')](_0x38d3f2)[_0x656e('0x1c')](function(_0x100995){_0x662c0(null,_0x100995);})['catch'](function(_0x2d847a){_0x662c0(_0x2d847a);});};AGIVertices['prototype'][_0x656e('0x38')]=function(_0x3f3d5e,_0x4045c4,_0x2add1c){this[_0x656e('0x11')][_0x656e('0x38')]({'uniqueid':this[_0x656e('0x10')][_0x656e('0x39')],'node':_0x3f3d5e[_0x656e('0x3a')],'application':_0x3f3d5e[_0x656e('0x3b')],'data':_0x4045c4||null,'project_name':this['channel'][_0x656e('0x3c')],'callerid':this[_0x656e('0x10')][_0x656e('0x3d')]})['then'](function(_0x4d3107){if(_0x2add1c){_0x2add1c(null,_0x4d3107);}})[_0x656e('0x16')](function(_0x20f6fb){if(_0x2add1c){_0x2add1c(_0x20f6fb);}});};AGIVertices[_0x656e('0x13')][_0x656e('0x3e')]=function(_0x5f0eef,_0x1b47a4,_0x3f9ecc,_0x46bf04){this[_0x656e('0x11')][_0x656e('0x3e')]({'uniqueid':this['channel'][_0x656e('0x39')],'callerid':this[_0x656e('0x10')][_0x656e('0x3d')],'calleridname':this[_0x656e('0x10')][_0x656e('0x3f')],'context':this[_0x656e('0x10')]['context'],'extension':this[_0x656e('0x10')][_0x656e('0x40')],'priority':this[_0x656e('0x10')][_0x656e('0x41')],'accountcode':this['channel']['accountcode'],'dnid':this[_0x656e('0x10')]['dnid'],'projectName':this['channel']['arg_1'],'saveName':_0x1b47a4,'filename':_0x5f0eef[_0x656e('0x42')]||_0x1b47a4,'savePath':_0x3f9ecc})[_0x656e('0x1c')](function(_0x59cb0f){_0x46bf04(null,_0x59cb0f);})['catch'](function(_0x57d0e3){_0x46bf04(_0x57d0e3);});};AGIVertices['prototype'][_0x656e('0x43')]=function(_0x13e2b0,_0x4a3880,_0x105922,_0x23c5de,_0x40bf72){this[_0x656e('0x11')][_0x656e('0x43')]({'uniqueid':this[_0x656e('0x10')][_0x656e('0x39')],'body':_0x13e2b0,'direction':_0x4a3880,'providerName':_0x105922,'providerResponse':_0x23c5de})[_0x656e('0x1c')](function(_0x403a2f){if(_0x40bf72){_0x40bf72(null,_0x403a2f);}})[_0x656e('0x16')](function(_0x45ca1f){if(_0x40bf72){_0x40bf72(_0x45ca1f);}});};AGIVertices['prototype']['createCmContact']=function(_0x4f365c,_0x47e622){this[_0x656e('0x11')][_0x656e('0x44')]({'firstName':_[_0x656e('0x45')](_0x4f365c['name'])||_['isNil'](_0x4f365c[_0x656e('0x15')])?'callback_'+Math[_0x656e('0x46')]():_0x4f365c[_0x656e('0x15')],'lastName':_[_0x656e('0x45')](_0x4f365c['lastName'])||_['isNil'](_0x4f365c[_0x656e('0x47')])?null:_0x4f365c[_0x656e('0x47')],'phone':_0x4f365c[_0x656e('0x48')],'ListId':_0x4f365c[_0x656e('0x49')],'scheduledat':_0x4f365c[_0x656e('0x4a')],'callbackUniqueid':this[_0x656e('0x10')][_0x656e('0x39')],'tags':_0x656e('0x4b'),'description':_0x656e('0x4c')+_0x4f365c['scheduledAt'][_0x656e('0x4d')](),'priority':_0x4f365c[_0x656e('0x4e')]})['then'](function(_0xf90483){_0x47e622(null,_0xf90483);})['catch'](function(_0x4c23f8){_0x47e622(_0x4c23f8);});};AGIVertices[_0x656e('0x13')][_0x656e('0x4f')]=function(_0x125e11,_0x484817){this[_0x656e('0x11')][_0x656e('0x50')](_0x125e11)['then'](function(_0x5ef5f7){_0x484817(null,_0x5ef5f7?_0x5ef5f7['name']:![]);})[_0x656e('0x16')](function(_0x1a061c){_0x484817(_0x1a061c);});};AGIVertices['prototype'][_0x656e('0x51')]=function(_0x21af97,_0x2e2468,_0xe63d2a){var _0x34a2df={'role':'agent'};_0x34a2df[_0x21af97]=this[_0x656e('0x10')][_0x656e('0x3d')];this['rpc']['agentPause'](_0x34a2df,_0x2e2468,this[_0x656e('0x10')]['uniqueid'])[_0x656e('0x1c')](function(_0x431ee3){_0xe63d2a(null,_[_0x656e('0x52')](_0x431ee3)?![]:!![]);})['catch'](function(_0x307328){logger[_0x656e('0x2d')](_0x307328);_0xe63d2a(null,![]);});};AGIVertices[_0x656e('0x13')][_0x656e('0x53')]=function(_0x12ccf0,_0x50a941){var _0x3c4061={'role':_0x656e('0x54')};_0x3c4061[_0x12ccf0]=this['channel'][_0x656e('0x3d')];this[_0x656e('0x11')][_0x656e('0x53')](_0x3c4061)[_0x656e('0x1c')](function(_0x3585ec){_0x50a941(null,_[_0x656e('0x52')](_0x3585ec)?![]:!![]);})[_0x656e('0x16')](function(_0xdc609e){logger['error'](_0xdc609e);_0x50a941(null,![]);});};AGIVertices[_0x656e('0x13')][_0x656e('0x55')]=function(_0x541ae0,_0x4b8ca2){var _0xfe3fdf={'role':_0x656e('0x54')};_0xfe3fdf[_0x541ae0]=this[_0x656e('0x10')][_0x656e('0x3d')];this[_0x656e('0x11')]['agentLogout'](_0xfe3fdf)[_0x656e('0x1c')](function(_0x486222){_0x4b8ca2(null,_[_0x656e('0x52')](_0x486222)?![]:!![]);})[_0x656e('0x16')](function(_0x380b76){logger['error'](_0x380b76);_0x4b8ca2(null,![]);});};AGIVertices[_0x656e('0x13')]['agentLogin']=function(_0x45ae79,_0x8160bc){var _0x25f3c9={'role':_0x656e('0x54')};_0x25f3c9[_0x45ae79]=this['channel'][_0x656e('0x3d')];var _0x2f5169=_0x45ae79!=_0x656e('0x56')?util['format']('%s/%s@from-sip/n','LOCAL',this['channel']['callerid']):undefined;this[_0x656e('0x11')][_0x656e('0x57')](_0x25f3c9,_0x2f5169)[_0x656e('0x1c')](function(_0x5800e4){_0x8160bc(null,_[_0x656e('0x52')](_0x5800e4)?![]:!![]);})['catch'](function(_0x505c58){logger[_0x656e('0x2d')](_0x505c58);_0x8160bc(null,![]);});};AGIVertices[_0x656e('0x13')]['shellCommand']=function(_0x5ebc2e,_0x42a29c){sh[_0x656e('0x58')](_[_0x656e('0x59')](_0x5ebc2e),function(_0x249aaa,_0xb95968){var _0x18c519=_0xb95968[_0x656e('0x5a')](/(\r\n|\n|\r)/gm,'');_0x42a29c(null,_0x18c519);});};AGIVertices[_0x656e('0x13')][_0x656e('0x5b')]=function(_0x321bad,_0x17abef){scripts[_0x656e('0x5b')](_0x321bad[_0x656e('0x5c')],_0x321bad[_0x656e('0x5d')]||_0x656e('0x5e'),_0x321bad[_0x656e('0x5e')],_0x321bad[_0x656e('0x5f')]||'en-US',_0x321bad[_0x656e('0x60')]||_0x656e('0x61'),_0x321bad[_0x656e('0x62')]||'MP3')[_0x656e('0x1c')](function(_0x482d14){_0x17abef(null,_0x482d14);})[_0x656e('0x16')](function(_0x34c7cf){_0x17abef(_0x34c7cf);});};AGIVertices['prototype'][_0x656e('0x63')]=function(_0x4f9691,_0x503884){scripts[_0x656e('0x63')](_0x4f9691['text'],_0x4f9691[_0x656e('0x64')]||'en',0x1)[_0x656e('0x1c')](function(_0x333cbd){_0x503884(null,_0x333cbd);})[_0x656e('0x16')](function(_0x46f86c){_0x503884(_0x46f86c);});};AGIVertices[_0x656e('0x13')][_0x656e('0x65')]=function(_0x42f8cf,_0x510aa0){var _0x1e8069={'uri':_0x42f8cf[_0x656e('0x66')],'method':_0x42f8cf[_0x656e('0x67')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x42f8cf[_0x656e('0x68')])===_0x656e('0x69')&&parseInt(_0x42f8cf[_0x656e('0x68')])>=0x1?parseInt(_0x42f8cf[_0x656e('0x68')])*0x3e8:0x5*0x3e8};if(_[_0x656e('0x6a')]([_0x656e('0x6b'),_0x656e('0x6c')],_0x1e8069[_0x656e('0x67')][_0x656e('0x6d')]())){try{_0x1e8069[_0x656e('0x6e')]=_0x42f8cf[_0x656e('0x6f')]?JSON[_0x656e('0x70')](_0x42f8cf[_0x656e('0x6f')]):{};}catch(_0x4b0228){logger[_0x656e('0x2d')](_0x656e('0x71'),_0x4b0228);}}try{_0x1e8069[_0x656e('0x72')]=_0x42f8cf[_0x656e('0xc')]?JSON['parse'](_0x42f8cf[_0x656e('0xc')]):{};}catch(_0x24e2a7){logger[_0x656e('0x2d')](_0x656e('0x73'),_0x24e2a7);}if(_0x42f8cf['computedVariables']){try{var _0x313f25=require(_0x42f8cf[_0x656e('0x74')])[_0x656e('0x75')](this,_0x1e8069);_0x1e8069[_0x656e('0x76')]=Mustache[_0x656e('0x77')](_0x42f8cf[_0x656e('0x66')],_0x313f25,{},['$$','$$']);if(_0x1e8069[_0x656e('0x72')]){_0x1e8069[_0x656e('0x72')]=JSON[_0x656e('0x70')](Mustache[_0x656e('0x77')](JSON[_0x656e('0x78')](_0x1e8069[_0x656e('0x72')]),_0x313f25,{},['$$','$$']));}if(_0x1e8069[_0x656e('0x6e')]){_0x1e8069['body']=JSON['parse'](Mustache[_0x656e('0x77')](JSON[_0x656e('0x78')](_0x1e8069[_0x656e('0x6e')]),_0x313f25,{},['$$','$$']));}}catch(_0x4ee759){logger[_0x656e('0x2d')](_0x656e('0x79'),_0x4ee759);}}rp(_0x1e8069)['then'](function(_0x557c61){var _0x90811b={'statusCode':_0x557c61[_0x656e('0x7a')]||0xc8,'statusMessage':_0x557c61[_0x656e('0x7b')]||'OK','headers':_0x557c61[_0x656e('0x72')]||{},'body':_0x557c61[_0x656e('0x6e')]||{}};_0x510aa0(null,_0x90811b);})[_0x656e('0x16')](function(_0x2acdb7){var _0x4327fa={'statusCode':_0x2acdb7[_0x656e('0x7a')]||0x1f4,'statusMessage':_0x2acdb7[_0x656e('0x7c')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x2acdb7[_0x656e('0x7d')][_0x656e('0x72')]||{},'body':_0x2acdb7[_0x656e('0x7d')][_0x656e('0x6e')]||{}};_0x510aa0(null,_0x4327fa);});};AGIVertices['prototype'][_0x656e('0x7e')]=function(_0x5298ce,_0x43079d){scripts[_0x656e('0x7e')](this[_0x656e('0x10')]['uniqueid'],_0x5298ce[_0x656e('0x7f')],_0x5298ce['text'],_0x5298ce[_0x656e('0x80')]||'en')[_0x656e('0x1c')](function(_0x52de1b){_0x43079d(null,_0x52de1b);})[_0x656e('0x16')](function(_0x1b60bb){_0x43079d(_0x1b60bb);});};AGIVertices[_0x656e('0x13')][_0x656e('0x81')]=function(_0x3c82e1,_0x1d5fe2){scripts[_0x656e('0x81')](this[_0x656e('0x10')][_0x656e('0x39')],_0x3c82e1[_0x656e('0x82')],_0x3c82e1[_0x656e('0x83')],_0x3c82e1[_0x656e('0x84')],_0x3c82e1[_0x656e('0x5e')],_0x3c82e1[_0x656e('0x85')]||'en')[_0x656e('0x1c')](function(_0x313533){_0x1d5fe2(null,_0x313533);})[_0x656e('0x16')](function(_0x449c72){_0x1d5fe2(_0x449c72);});};AGIVertices[_0x656e('0x13')][_0x656e('0x86')]=function(_0x4fb864,_0x4692b1){scripts[_0x656e('0x86')](this['channel'],_0x4fb864)[_0x656e('0x1c')](function(_0x28de98){_0x4692b1(null,_0x28de98);})['catch'](function(_0x27bfaa){_0x4692b1(_0x27bfaa);});};AGIVertices[_0x656e('0x13')]['ispeechTTS']=function(_0x1294e0,_0x5ce6b2){scripts['ispeechTTS'](_0x1294e0[_0x656e('0x7f')],_0x1294e0['text'],_0x1294e0['ispeech_tts_language']||'en-US',_0x1294e0[_0x656e('0x87')])[_0x656e('0x1c')](function(_0x380221){_0x5ce6b2(null,_0x380221);})[_0x656e('0x16')](function(_0x162dbf){_0x5ce6b2(_0x162dbf);});};AGIVertices['prototype'][_0x656e('0x88')]=function(_0x5ace10,_0x3ff901,_0x264c6d){scripts['ispeechASR'](_0x3ff901,_0x5ace10[_0x656e('0x7f')],_0x5ace10[_0x656e('0x89')]||_0x656e('0x8a'),this[_0x656e('0x8b')](_0x5ace10[_0x656e('0x8c')])?_0x5ace10[_0x656e('0x8c')]:undefined)['then'](function(_0x47153c){_0x264c6d(null,_0x47153c);})[_0x656e('0x16')](function(_0x99798b){_0x264c6d(_0x99798b);});};AGIVertices[_0x656e('0x13')][_0x656e('0x8d')]=function(_0x2dd63c,_0x2f01f8){scripts[_0x656e('0x8d')](_0x2dd63c[_0x656e('0x8e')],_0x2dd63c[_0x656e('0x8f')],_0x2dd63c[_0x656e('0x90')],_0x2dd63c[_0x656e('0x91')]||_0x656e('0x92'),_0x2dd63c['text'],_0x2dd63c[_0x656e('0x93')]||_0x656e('0x5e'))[_0x656e('0x1c')](function(_0x5c776c){_0x2f01f8(null,_0x5c776c);})[_0x656e('0x16')](function(_0x242133){_0x2f01f8(_0x242133);});};AGIVertices[_0x656e('0x13')][_0x656e('0x94')]=function(_0x299b89,_0x220389){scripts['awsLex'](this[_0x656e('0x10')][_0x656e('0x39')],_0x299b89[_0x656e('0x8e')],_0x299b89['aws_secret_access_key'],_0x299b89[_0x656e('0x95')],_0x299b89['text'],_0x299b89[_0x656e('0x96')])[_0x656e('0x1c')](function(_0x4e4468){_0x220389(null,_0x4e4468);})[_0x656e('0x16')](function(_0x27d1fd){_0x220389(_0x27d1fd);});};AGIVertices[_0x656e('0x13')][_0x656e('0x97')]=function(_0x111578,_0x810f0f,_0x2dd089){scripts[_0x656e('0x97')](_0x810f0f,_0x111578[_0x656e('0x7f')],_0x111578[_0x656e('0x98')]||'en-US')['then'](function(_0x2515c8){_0x2dd089(null,_0x2515c8);})[_0x656e('0x16')](function(_0x27473a){_0x2dd089(_0x27473a);});};AGIVertices[_0x656e('0x13')][_0x656e('0x99')]=function(_0x195a02,_0x1dcc23,_0x29c45f){scripts[_0x656e('0x99')](_0x1dcc23,_0x195a02[_0x656e('0x9a')],_0x195a02['appsecret'],_0x195a02[_0x656e('0x76')])[_0x656e('0x1c')](function(_0x1305d6){_0x29c45f(null,_0x1305d6);})['catch'](function(_0x48b3cd){_0x29c45f(_0x48b3cd);});};AGIVertices[_0x656e('0x13')][_0x656e('0x9b')]=function(_0x27f0d8){var _0x174e87=_[_0x656e('0x6a')](verticesWithRetry,_0x27f0d8['agicommand'])?_0x27f0d8:_[_0x656e('0x9c')](_0x27f0d8);for(var _0x293e24 in _0x174e87){if(_0x174e87[_0x656e('0x9d')](_0x293e24)){if(_0x174e87[_0x293e24]&&_[_0x656e('0x9e')](_0x174e87[_0x293e24])){if(_[_0x656e('0x6a')](recursiveMapAttributes,_0x293e24)){_0x174e87[_0x293e24]=this[_0x656e('0x9f')](_0x174e87[_0x293e24]);}else{_0x174e87[_0x293e24]=this[_0x656e('0xa0')](_0x174e87[_0x293e24]);}}}}return _0x174e87;};AGIVertices['prototype'][_0x656e('0xa1')]=function(_0x3174b9){for(var _0x34eef1 in _0x3174b9){if(_0x3174b9[_0x656e('0x9d')](_0x34eef1)){if(_[_0x656e('0xa2')](_0x3174b9[_0x34eef1])){this[_0x656e('0xa1')](_0x3174b9[_0x34eef1]);}else if(_[_0x656e('0xa3')](_0x3174b9[_0x34eef1])){for(var _0x42696=0x0;_0x42696<_0x3174b9[_0x34eef1][_0x656e('0xa4')];_0x42696++){this['recursiveNodeIndex'](_0x3174b9[_0x34eef1][_0x42696]);}}else if(_[_0x656e('0x9e')](_0x3174b9[_0x34eef1])){_0x3174b9[_0x34eef1]=this[_0x656e('0xa0')](_0x3174b9[_0x34eef1]);}}}};AGIVertices['prototype'][_0x656e('0xa5')]=function(_0x3106d2,_0x569d7e){for(var _0x3921ba in _0x3106d2){if(_0x3106d2[_0x656e('0x9d')](_0x3921ba)){if(_[_0x656e('0xa2')](_0x3106d2[_0x3921ba])){if(!_[_0x656e('0x45')](_0x3106d2[_0x3921ba])){this[_0x656e('0xa5')](_0x3106d2[_0x3921ba],util[_0x656e('0xa6')](_0x656e('0xa7'),_0x569d7e,_0x3921ba));}}else if(_['isArray'](_0x3106d2[_0x3921ba])){for(var _0x650ca2=0x0;_0x650ca2<_0x3106d2[_0x3921ba][_0x656e('0xa4')];_0x650ca2++){this[_0x656e('0xa5')](_0x3106d2[_0x3921ba][_0x650ca2],util[_0x656e('0xa6')]('%s.%s',_0x569d7e,_0x3921ba+'['+_0x650ca2+']'));}}else{if(!_[_0x656e('0x52')](_0x3106d2[_0x3921ba])){this[_0x656e('0x10')][_0x656e('0xa8')](util[_0x656e('0xa6')](_0x656e('0xa7'),_0x569d7e,_0x3921ba),_0x3106d2[_0x3921ba]);}}}}};AGIVertices[_0x656e('0x13')]['replaceObjectAllVariables']=function(_0x31da12){try{var _0x149f73=JSON[_0x656e('0x70')](_0x31da12);this['recursiveNodeIndex'](_0x149f73);return JSON['stringify'](_0x149f73);}catch(_0x2f6a58){return this[_0x656e('0xa0')](_0x31da12);}};AGIVertices[_0x656e('0x13')][_0x656e('0xa0')]=function(_0x431bed){var _0x52bd2f=_0x431bed[_0x656e('0xa9')]('{');for(var _0x567eb3=0x1;_0x567eb3<_0x52bd2f[_0x656e('0xa4')];_0x567eb3+=0x1){var _0x3d5de4=_0x52bd2f[_0x567eb3]['split']('}');if(_0x3d5de4[_0x656e('0xa4')]>0x1){_0x431bed=_0x431bed[_0x656e('0xaa')]('{'+_0x3d5de4[0x0]+'}',this[_0x656e('0x10')][_0x656e('0x14')](_0x3d5de4[0x0])[_0x656e('0xab')]||_0x3d5de4[0x0]);}}if(_0x52bd2f['length']===0x1){return _0x431bed[_0x656e('0x4d')]();}return this[_0x656e('0xa0')](_0x431bed);};AGIVertices[_0x656e('0x13')][_0x656e('0xac')]=function(_0x25dfda,_0x25c344){var _0x38cee2=this[_0x656e('0x10')][_0x656e('0x14')](_0x25dfda);if(_0x38cee2[_0x656e('0xad')]===-0x1){return _0x38cee2;}logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0xae'),_0x25c344,_0x38cee2[_0x656e('0xab')]));return this[_0x656e('0x10')][_0x656e('0xa8')](_0x25c344,_0x38cee2[_0x656e('0xab')]);};AGIVertices['prototype'][_0x656e('0x8b')]=function(_0x50e168){return _0x50e168&&_0x50e168!=='0'&&_0x50e168!=='-1'&&_0x50e168!=='';};AGIVertices[_0x656e('0x13')][_0x656e('0xaf')]=function(_0x4f949d){this[_0x656e('0x38')][_0x656e('0x75')](this,_0x4f949d,'-');_0x4f949d[_0x656e('0xb0')]=_0x4f949d[_0x656e('0xaf')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x656e('0x13')][_0x656e('0xb1')]=function(_0x5900fe){logger['info'](util[_0x656e('0xa6')](_0x656e('0xb2'),_0x5900fe[_0x656e('0x3a')]));if(!this[_0x656e('0x8b')](_0x5900fe[_0x656e('0x5e')])){return this['channel'][_0x656e('0xb3')]('no\x20text\x20configured');}var _0x58e476='\x22'+_0x5900fe[_0x656e('0x5e')]+'\x22';if(this[_0x656e('0x8b')](_0x5900fe[_0x656e('0x7d')])){_0x58e476+=','+_0x5900fe['options'];}var _0x2e4a8e=this[_0x656e('0x10')][_0x656e('0x58')](_0x656e('0xb4'),_0x58e476);if(_0x2e4a8e['result']===-0x1){return _0x2e4a8e;}return this['channel'][_0x656e('0xb3')](util[_0x656e('0xa6')]('Executed\x20command\x20MRCPSynth\x20%s',_0x58e476));};AGIVertices['prototype']['mrcprecog']=function(_0x5a9f5e){logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0xb5'),_0x5a9f5e['label']));if(!this[_0x656e('0x8b')](_0x5a9f5e['grammar'])){return this[_0x656e('0x10')][_0x656e('0xb3')](_0x656e('0xb6'));}var _0x3babd0=_0x5a9f5e[_0x656e('0xb7')];if(this['isConfigured'](_0x5a9f5e['options'])){_0x3babd0+=','+_0x5a9f5e[_0x656e('0x7d')];}var _0x44a525=this['channel']['exec'](_0x656e('0xb8'),_0x3babd0);if(_0x44a525[_0x656e('0xad')]===-0x1){return _0x44a525;}var _0x18c97b=this[_0x656e('0xac')](_0x656e('0xb9'),_0x656e('0xba'));if(_0x18c97b[_0x656e('0xad')]===-0x1){return _0x18c97b;}var _0x37c0da=this[_0x656e('0xac')](_0x656e('0xbb'),_0x656e('0xbc'));if(_0x37c0da['result']===-0x1){return _0x37c0da;}var _0x2fcf90=this[_0x656e('0xac')](_0x656e('0xbd'),_0x656e('0xbe'));if(_0x2fcf90['result']===-0x1){return _0x2fcf90;}return this[_0x656e('0x10')][_0x656e('0xb3')](util[_0x656e('0xa6')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3babd0));};AGIVertices[_0x656e('0x13')]['agi']=function(_0x508447){logger[_0x656e('0x2f')](util['format'](_0x656e('0xbf'),_0x508447['label']));return this['channel'][_0x656e('0x8')]([_0x508447[_0x656e('0xc0')],_0x508447[_0x656e('0xc1')]]);};AGIVertices['prototype'][_0x656e('0xc2')]=function(_0x3c5138){logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0xc3'),_0x3c5138['label']));if(this[_0x656e('0x8b')](_0x3c5138[_0x656e('0x68')])){logger['info'](util[_0x656e('0xa6')](_0x656e('0xc4'),_0x3c5138[_0x656e('0x68')]));var _0x1e8870=this[_0x656e('0x10')][_0x656e('0xc5')](_0x3c5138[_0x656e('0x68')]);if(_0x1e8870[_0x656e('0xad')]===-0x1){return _0x1e8870;}}return this[_0x656e('0x10')][_0x656e('0xc2')]();};AGIVertices[_0x656e('0x13')][_0x656e('0x4b')]=function(_0x193490){logger[_0x656e('0x2f')](util[_0x656e('0xa6')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x193490[_0x656e('0x3a')]));if(!this[_0x656e('0x8b')](_0x193490[_0x656e('0x49')])){return this['channel'][_0x656e('0x2d')](_0x193490,_0x656e('0xc6'));}_0x193490[_0x656e('0x4a')]=moment();if(this['isConfigured'](_0x193490[_0x656e('0xc7')])){_0x193490[_0x656e('0x4a')]=moment()[_0x656e('0xc8')](_0x193490['delay'],'minutes');}if(!this[_0x656e('0x8b')](_0x193490[_0x656e('0x4e')])){_0x193490[_0x656e('0x4e')]=0x2;}this['createCmContact'][_0x656e('0x75')](this,_0x193490);return this[_0x656e('0x10')][_0x656e('0xb3')](util['format'](_0x656e('0xc9'),_0x193490['phone'],_0x193490['list_id'],_0x193490['scheduledAt']));};AGIVertices[_0x656e('0x13')][_0x656e('0xca')]=function(_0x5de720){logger['info'](util[_0x656e('0xa6')](_0x656e('0xcb'),_0x5de720[_0x656e('0x3a')]));var _0x2ea400=this[_0x656e('0x10')]['exec'](_0x5de720[_0x656e('0xcc')],_0x5de720['options']);if(_0x2ea400['result']===-0x1){return _0x2ea400;}return this[_0x656e('0x10')]['noop'](util[_0x656e('0xa6')]('Executed\x20command\x20%s\x20%s',_0x5de720[_0x656e('0xcc')],_0x5de720[_0x656e('0x7d')]));};AGIVertices[_0x656e('0x13')][_0x656e('0xcd')]=function(_0x24d8ef){logger[_0x656e('0x2f')](util[_0x656e('0xa6')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x24d8ef[_0x656e('0x3a')]));if(!this[_0x656e('0x8b')](_0x24d8ef[_0x656e('0x5e')])){return this[_0x656e('0x10')][_0x656e('0xb3')](_0x656e('0xce'));}var _0xadf1c2='\x22'+_0x24d8ef[_0x656e('0x5e')]+'\x22';if(this['isConfigured'](_0x24d8ef['options'])){_0xadf1c2+=','+_0x24d8ef['options'];}var _0xcf130e=this['channel'][_0x656e('0x58')](_0x656e('0xb4'),_0xadf1c2);if(_0xcf130e[_0x656e('0xad')]===-0x1){return _0xcf130e;}return this[_0x656e('0x10')][_0x656e('0xb3')](util['format'](_0x656e('0xcf'),_0xadf1c2));};AGIVertices[_0x656e('0x13')][_0x656e('0xd0')]=function(_0x2a7db8){logger['info'](util[_0x656e('0xa6')](_0x656e('0xd1'),_0x2a7db8[_0x656e('0x3a')]));if(!this[_0x656e('0x8b')](_0x2a7db8[_0x656e('0x5e')])){return this[_0x656e('0x10')]['noop']('no\x20text\x20configured');}var _0x35fb47='\x22'+_0x2a7db8[_0x656e('0x5e')]+'\x22';if(this[_0x656e('0x8b')](_0x2a7db8[_0x656e('0x7d')])){_0x35fb47+=','+_0x2a7db8[_0x656e('0x7d')];}var _0x1b4b57=this[_0x656e('0x10')]['exec'](_0x656e('0xb4'),_0x35fb47);if(_0x1b4b57[_0x656e('0xad')]===-0x1){return _0x1b4b57;}return this[_0x656e('0x10')][_0x656e('0xb3')](util[_0x656e('0xa6')](_0x656e('0xcf'),_0x35fb47));};AGIVertices[_0x656e('0x13')][_0x656e('0xd2')]=function(_0x42f30c){logger['info'](util[_0x656e('0xa6')](_0x656e('0xd3'),_0x42f30c[_0x656e('0x3a')]));if(!this[_0x656e('0x8b')](_0x42f30c[_0x656e('0xb7')])){return this['channel'][_0x656e('0xb3')](_0x656e('0xb6'));}var _0x50efd3=_0x42f30c['grammar'];if(this[_0x656e('0x8b')](_0x42f30c[_0x656e('0x7d')])){_0x50efd3+=','+_0x42f30c[_0x656e('0x7d')];}var _0x5ca5c7=this['channel'][_0x656e('0x58')](_0x656e('0xb8'),_0x50efd3);if(_0x5ca5c7['result']===-0x1){return _0x5ca5c7;}var _0x1121d0=this[_0x656e('0xac')](_0x656e('0xb9'),_0x656e('0xd4'));if(_0x1121d0[_0x656e('0xad')]===-0x1){return _0x1121d0;}var _0x14d13c=this[_0x656e('0xac')](_0x656e('0xbb'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x14d13c[_0x656e('0xad')]===-0x1){return _0x14d13c;}var _0x4a936e=this[_0x656e('0xac')]('RECOG_INSTANCE()',_0x656e('0xd5'));if(_0x4a936e[_0x656e('0xad')]===-0x1){return _0x4a936e;}return this['channel'][_0x656e('0xb3')](util['format'](_0x656e('0xd6'),_0x50efd3));};AGIVertices[_0x656e('0x13')][_0x656e('0xd7')]=function(_0x31efc5){logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0xd8'),_0x31efc5['label']));if(!this[_0x656e('0x8b')](_0x31efc5[_0x656e('0xb7')])){return this['channel'][_0x656e('0xb3')]('no\x20grammar\x20configured');}var _0x1993ba=_0x31efc5['grammar'];if(this[_0x656e('0x8b')](_0x31efc5['options'])){_0x1993ba+=','+_0x31efc5[_0x656e('0x7d')];}var _0x4fb541=this[_0x656e('0x10')]['exec'](_0x656e('0xb8'),_0x1993ba);if(_0x4fb541[_0x656e('0xad')]===-0x1){return _0x4fb541;}var _0x530bd0=this['getAndSetVariable'](_0x656e('0xb9'),'SESTEK_ASR_CONFIDENCE');if(_0x530bd0[_0x656e('0xad')]===-0x1){return _0x530bd0;}var _0x7857be=this[_0x656e('0xac')](_0x656e('0xbb'),_0x656e('0xd9'));if(_0x7857be[_0x656e('0xad')]===-0x1){return _0x7857be;}var _0x268461=this[_0x656e('0xac')]('RECOG_INSTANCE()',_0x656e('0xda'));if(_0x268461[_0x656e('0xad')]===-0x1){return _0x268461;}return this[_0x656e('0x10')][_0x656e('0xb3')](util['format'](_0x656e('0xd6'),_0x1993ba));};AGIVertices[_0x656e('0x13')]['database']=function(_0x307125){logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0xdb'),_0x307125[_0x656e('0x3a')]));if(!this[_0x656e('0x8b')](_0x307125[_0x656e('0xdc')])){return this['channel'][_0x656e('0x2d')](_0x307125,_0x656e('0xdd'));}var _0x5581e4=this[_0x656e('0x1a')][_0x656e('0x75')](this,_0x307125[_0x656e('0xdc')]);if(!_0x5581e4){return this[_0x656e('0x10')]['error'](_0x307125,_0x656e('0xde'));}if(!this[_0x656e('0x8b')](_0x307125[_0x656e('0x31')])){return this[_0x656e('0x10')][_0x656e('0x2d')](_0x307125,_0x656e('0xdf'));}var _0x40d74d=_0x307125['query'][_0x656e('0x5a')](/(\r\n|\n|\r)/gm,'\x20');this[_0x656e('0x10')][_0x656e('0xb3')](util[_0x656e('0xa6')](_0x656e('0xe0'),_0x40d74d));var _0x235d59=this[_0x656e('0x2b')][_0x656e('0x75')](this,_0x5581e4,_0x40d74d);this[_0x656e('0x38')][_0x656e('0x75')](this,_0x307125,_0x40d74d);if(!this['isConfigured'](_0x307125['variable_id'])){return this[_0x656e('0x10')][_0x656e('0xb3')](_0x656e('0xe1'));}var _0x31c03d=this[_0x656e('0x14')][_0x656e('0x75')](this,_0x307125['variable_id']);if(!_0x31c03d){return this[_0x656e('0x10')][_0x656e('0x2d')](_0x307125,_0x656e('0xe2'));}var _0x3805d1=this;_0x235d59[_0x656e('0xe3')](function(_0x48645f,_0x42d150){Object[_0x656e('0xe4')](_0x48645f)['forEach'](function(_0x5e3f11){_0x3805d1[_0x656e('0x10')][_0x656e('0xa8')](util[_0x656e('0xa6')](_0x656e('0xe5'),_0x31c03d,_0x42d150,_0x5e3f11),_0x48645f[_0x5e3f11]);});});this[_0x656e('0x10')][_0x656e('0xa8')](util[_0x656e('0xa6')](_0x656e('0xe6'),_0x31c03d),_0x235d59['length']);return this['channel'][_0x656e('0xb3')](util[_0x656e('0xa6')](_0x656e('0xe7'),_0x31c03d));};AGIVertices[_0x656e('0x13')][_0x656e('0xe8')]=function(_0x3b95c3){logger[_0x656e('0xe9')](util[_0x656e('0xa6')](_0x656e('0xea'),_0x3b95c3['label']));if(!this[_0x656e('0x8b')](_0x3b95c3['sip_id'])){return this['channel'][_0x656e('0x2d')](_0x3b95c3,_0x656e('0xeb'));}var _0x5ac7bb=this[_0x656e('0x1e')][_0x656e('0x75')](this,_0x3b95c3['sip_id']);if(!_0x5ac7bb){return this[_0x656e('0x10')][_0x656e('0x2d')](_0x3b95c3,'no\x20user\x20found');}var _0x117f85=this[_0x656e('0x10')][_0x656e('0x58')](_0x656e('0xec'),[util[_0x656e('0xa6')](_0x656e('0xed'),_0x5ac7bb),_0x3b95c3['timeout'],_0x3b95c3[_0x656e('0xee')],_0x3b95c3[_0x656e('0x66')]]);if(_0x117f85[_0x656e('0xad')]===-0x1){return _0x117f85;}return this[_0x656e('0x10')][_0x656e('0xb3')](util[_0x656e('0xa6')](_0x656e('0xef'),_0x656e('0xec')));};AGIVertices[_0x656e('0x13')][_0x656e('0xf0')]=function(_0x245f1b){logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0xf1'),_0x245f1b[_0x656e('0x3a')]));if(!this[_0x656e('0x8b')](_0x245f1b[_0x656e('0x7f')])){return this[_0x656e('0x10')][_0x656e('0xb3')](_0x656e('0xf2'));}if(!this[_0x656e('0x8b')](_0x245f1b[_0x656e('0x5e')])){return this[_0x656e('0x10')][_0x656e('0xb3')](_0x656e('0xce'));}this[_0x656e('0x10')][_0x656e('0xf3')]=!![];this[_0x656e('0x38')](_0x245f1b);this[_0x656e('0x43')](_0x245f1b[_0x656e('0x5e')],'in','','');this[_0x656e('0x10')][_0x656e('0xb3')](util['format']('Trying\x20Dialogflow:\x20%s',_0x245f1b[_0x656e('0x5e')]));var _0x586ea7=this[_0x656e('0x7e')][_0x656e('0x75')](this,_0x245f1b);if(_0x586ea7){for(var _0x21b12f in _0x586ea7){if(_0x586ea7[_0x656e('0x9d')](_0x21b12f)){this[_0x656e('0x10')][_0x656e('0xa8')](util[_0x656e('0xa6')]('DIALOGFLOW_%s',_0x21b12f[_0x656e('0x6d')]()),_0x586ea7[_0x21b12f]);}}this[_0x656e('0x43')](_0x586ea7['speech'],_0x656e('0xf4'),_0x656e('0xf0'),'');return this[_0x656e('0x10')][_0x656e('0xb3')](util[_0x656e('0xa6')](_0x656e('0xf5'),_0x586ea7[_0x656e('0xf6')]));}return this[_0x656e('0x10')][_0x656e('0x2d')](_0x245f1b,_0x656e('0xf7'));};AGIVertices[_0x656e('0x13')][_0x656e('0xf8')]=function(_0x213b5b){logger[_0x656e('0x2f')](util[_0x656e('0xa6')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x213b5b[_0x656e('0x3a')]));if(!this[_0x656e('0x8b')](_0x213b5b[_0x656e('0x82')])){return this[_0x656e('0x10')][_0x656e('0xb3')](_0x656e('0xf9'));}if(!this[_0x656e('0x8b')](_0x213b5b[_0x656e('0x83')])){return this[_0x656e('0x10')][_0x656e('0xb3')](_0x656e('0xfa'));}if(!this[_0x656e('0x8b')](_0x213b5b[_0x656e('0x84')])){return this[_0x656e('0x10')][_0x656e('0xb3')](_0x656e('0xfb'));}if(!this[_0x656e('0x8b')](_0x213b5b[_0x656e('0x85')])){return this[_0x656e('0x10')][_0x656e('0xb3')](_0x656e('0xfc'));}if(!this[_0x656e('0x8b')](_0x213b5b[_0x656e('0x5e')])){return this[_0x656e('0x10')]['noop'](_0x656e('0xce'));}this[_0x656e('0x10')][_0x656e('0xf3')]=!![];this[_0x656e('0x38')](_0x213b5b);this[_0x656e('0x43')](_0x213b5b[_0x656e('0x5e')],'in','','');this[_0x656e('0x10')][_0x656e('0xb3')](util[_0x656e('0xa6')](_0x656e('0xfd'),_0x213b5b['text']));var _0x4da64b=this[_0x656e('0x81')]['sync'](this,_0x213b5b);if(_0x4da64b){for(var _0x2c4b6c in _0x4da64b){if(_0x4da64b[_0x656e('0x9d')](_0x2c4b6c)){if(_0x2c4b6c!==_0x656e('0xfe')){this[_0x656e('0x10')][_0x656e('0xa8')](util[_0x656e('0xa6')]('DIALOGFLOW_%s',_0x2c4b6c[_0x656e('0x6d')]()),_0x4da64b[_0x2c4b6c]);}}}this[_0x656e('0x43')](_0x4da64b[_0x656e('0xf6')],'out',_0x656e('0xf8'),_0x4da64b[_0x656e('0xfe')]);return this[_0x656e('0x10')][_0x656e('0xb3')](util['format']('DialogflowV2\x20Result\x20%s',_0x4da64b[_0x656e('0xf6')]));}return this[_0x656e('0x10')][_0x656e('0x2d')](_0x213b5b,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x656e('0x13')][_0x656e('0xff')]=function(_0x38cc4a){logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0x100'),_0x38cc4a[_0x656e('0x3a')]));if(!this[_0x656e('0x8b')](_0x38cc4a[_0x656e('0x101')])){return this[_0x656e('0x10')][_0x656e('0xb3')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x656e('0x8b')](_0x38cc4a[_0x656e('0x102')])){return this[_0x656e('0x10')][_0x656e('0xb3')](_0x656e('0x103'));}if(!this[_0x656e('0x8b')](_0x38cc4a[_0x656e('0x104')])){return this[_0x656e('0x10')]['noop']('no\x20password\x20configured');}if(!this[_0x656e('0x8b')](_0x38cc4a[_0x656e('0x105')])){return this[_0x656e('0x10')][_0x656e('0xb3')](_0x656e('0xce'));}this[_0x656e('0x10')][_0x656e('0xf3')]=!![];this[_0x656e('0x38')](_0x38cc4a);this[_0x656e('0x43')](_0x38cc4a[_0x656e('0x5e')],'in','','');this[_0x656e('0x10')][_0x656e('0xb3')](util[_0x656e('0xa6')](_0x656e('0x106'),_0x38cc4a['text']));var _0x8f6ac8=this[_0x656e('0x86')][_0x656e('0x75')](this,_0x38cc4a);if(_0x8f6ac8){for(var _0x554116 in _0x8f6ac8){if(_0x8f6ac8['hasOwnProperty'](_0x554116)){this[_0x656e('0x10')][_0x656e('0xa8')](util[_0x656e('0xa6')]('SESTEK_NDA_%s',_0x554116['toUpperCase']()),_0x8f6ac8[_0x554116]);}}this['createSquareMessage'](_0x8f6ac8['speech'],_0x656e('0xf4'),'sesteknda','');if(_0x8f6ac8[_0x656e('0x107')]){this[_0x656e('0x10')]['noop'](util[_0x656e('0xa6')](_0x656e('0x108'),_0x8f6ac8[_0x656e('0x107')]));var _0x134f28=this[_0x656e('0x10')][_0x656e('0x109')](_0x8f6ac8[_0x656e('0x107')]);try{fs[_0x656e('0x10a')](_0x8f6ac8[_0x656e('0x107')]+'.wav');}catch(_0x2164c4){logger['error'](_0x2164c4);}return _0x134f28;}else{return this[_0x656e('0x10')][_0x656e('0xb3')](util[_0x656e('0xa6')](_0x656e('0x10b'),_0x8f6ac8[_0x656e('0xf6')]));}}return this[_0x656e('0x10')][_0x656e('0x2d')](_0x38cc4a,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype']['end']=function(_0x8e395e){logger[_0x656e('0x2f')](util['format'](_0x656e('0x10c'),_0x8e395e[_0x656e('0x3a')]));return this[_0x656e('0x10')]['noop'](_0x656e('0x10d'));};AGIVertices[_0x656e('0x13')][_0x656e('0x10e')]=function(_0x458cf9){logger[_0x656e('0x2f')](util[_0x656e('0xa6')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x458cf9[_0x656e('0x3a')]));var _0x2f244d='';if(_0x458cf9[_0x656e('0x10f')]){if(!this[_0x656e('0x8b')](_0x458cf9[_0x656e('0x10f')])){return this['channel'][_0x656e('0x2d')](_0x458cf9,_0x656e('0x110'));}else{var _0x459c09=parseInt(_0x458cf9[_0x656e('0x10f')],0xa);if(isNaN(_0x459c09)){_0x2f244d=_0x458cf9[_0x656e('0x10f')];}else{_0x2f244d=this[_0x656e('0x20')]['sync'](this,_0x458cf9[_0x656e('0x10f')]);if(!_0x2f244d){return this[_0x656e('0x10')][_0x656e('0x2d')](_0x458cf9,_0x656e('0x111'));}}}}else if(_0x458cf9[_0x656e('0x112')]){_0x2f244d=_0x458cf9[_0x656e('0x112')];}else{return this[_0x656e('0x10')][_0x656e('0x2d')](_0x458cf9,_0x656e('0x110'));}var _0x821abe=this['channel'][_0x656e('0x58')](_0x656e('0xec'),[util[_0x656e('0xa6')](_0x656e('0x113'),_0x2f244d,_0x458cf9[_0x656e('0x48')]),_0x458cf9[_0x656e('0x68')],_0x458cf9[_0x656e('0xee')],_0x458cf9[_0x656e('0x66')]]);if(_0x821abe[_0x656e('0xad')]===-0x1){return _0x821abe;}return this['channel'][_0x656e('0xb3')](util['format'](_0x656e('0xef'),'DIAL'));};AGIVertices[_0x656e('0x13')][_0x656e('0x114')]=function(_0x2d359f){logger[_0x656e('0x2f')](util['format'](_0x656e('0x115'),_0x2d359f[_0x656e('0x3a')]));return this[_0x656e('0x10')][_0x656e('0xb3')](_0x656e('0x114'));};AGIVertices['prototype'][_0x656e('0xe')]=function(_0x397f34){logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0x116'),_0x397f34[_0x656e('0x3a')]));if(_0x397f34[_0x656e('0xb0')]===0x0){return this['maxRetry'](_0x397f34);}_0x397f34['retry']-=0x1;if(!this[_0x656e('0x8b')](_0x397f34[_0x656e('0x117')])){return this[_0x656e('0x10')]['error'](_0x397f34,_0x656e('0x118'));}var _0x4cad09=this[_0x656e('0x21')]['sync'](this,_0x397f34[_0x656e('0x117')]);if(!_0x4cad09){return this['channel'][_0x656e('0x2d')](_0x397f34,_0x656e('0x119'));}if(!this['isConfigured'](_0x397f34[_0x656e('0x11a')])){return this[_0x656e('0x10')]['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x303b10=this[_0x656e('0x10')][_0x656e('0x11b')](_0x4cad09,_0x397f34[_0x656e('0x11c')],_0x397f34[_0x656e('0x11d')]);var _0x2f5662=_0x303b10['result']?_0x303b10[_0x656e('0xad')]['toString']():'';logger['info'](_0x656e('0x11e'),JSON['stringify'](_0x303b10));if(_0x303b10['result']===-0x1){this['createSquareDetailsReport'][_0x656e('0x75')](this,_0x397f34,_0x2f5662);return _0x303b10;}else if(_0x303b10[_0x656e('0xab')]===_0x656e('0x68')){_0x303b10[_0x656e('0xad')]=_0x2f5662[_0x656e('0xa4')]>=parseInt(_0x397f34[_0x656e('0x11f')])?'x':'i';}else{_0x303b10[_0x656e('0xad')]=_0x2f5662['length']>=parseInt(_0x397f34[_0x656e('0x11f')])&&_0x2f5662[_0x656e('0xa4')]<=parseInt(_0x397f34['maxdigit'])?'x':'i';}var _0x321568=this[_0x656e('0x14')][_0x656e('0x75')](this,_0x397f34[_0x656e('0x11a')]);if(!_0x321568){return this[_0x656e('0x10')]['error'](_0x397f34,_0x656e('0xe2'));}this[_0x656e('0x10')]['setVariable'](_0x321568,_0x2f5662);if(this[_0x656e('0x8b')](_0x397f34[_0x656e('0x120')])){var _0x366bad=parseInt(_0x397f34[_0x656e('0x120')],0xa);var _0x1cf283=rs[_0x656e('0x121')]({'charset':'*','length':_0x366bad});var _0x53d253=_0x2f5662['length'];if(_0x53d253>0x0){if(_0x53d253>_0x366bad){this[_0x656e('0x38')][_0x656e('0x75')](this,_0x397f34,_0x397f34[_0x656e('0x122')]==='first'?_0x1cf283+_0x2f5662['substr'](_0x366bad):_0x2f5662[_0x656e('0x123')](0x0,_0x53d253-_0x366bad)+_0x1cf283);}else{this[_0x656e('0x38')][_0x656e('0x75')](this,_0x397f34,rs[_0x656e('0x121')]({'charset':'*','length':_0x53d253}));}}else{this[_0x656e('0x38')]['sync'](this,_0x397f34,'');}}else{this['createSquareDetailsReport']['sync'](this,_0x397f34,_0x2f5662);}return _0x303b10;};AGIVertices[_0x656e('0x13')]['getsecretdigits']=function(_0x2cf858){logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0x124'),_0x2cf858[_0x656e('0x3a')]));return this[_0x656e('0xe')](_0x2cf858);};AGIVertices[_0x656e('0x13')][_0x656e('0x125')]=function(_0x575ec1){logger['info'](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x575ec1[_0x656e('0x3a')]));this[_0x656e('0x38')]['sync'](this,_0x575ec1,_0x575ec1[_0x656e('0x126')]);return this[_0x656e('0x10')][_0x656e('0xb3')](util[_0x656e('0xa6')](_0x656e('0x127'),_0x575ec1[_0x656e('0x126')]));};AGIVertices[_0x656e('0x13')][_0x656e('0x128')]=function(_0x4bd29f){logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0x129'),_0x4bd29f[_0x656e('0x3a')]));if(!this[_0x656e('0x8b')](_0x4bd29f['aws_access_key_id'])||!this[_0x656e('0x8b')](_0x4bd29f[_0x656e('0x8f')])){return this[_0x656e('0x10')][_0x656e('0xb3')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x656e('0x8b')](_0x4bd29f['text'])){return this[_0x656e('0x10')][_0x656e('0xb3')](_0x656e('0xce'));}this[_0x656e('0x10')][_0x656e('0xb3')](util[_0x656e('0xa6')](_0x656e('0x12a'),_0x4bd29f[_0x656e('0x5e')]));var _0x430fba=this[_0x656e('0x8d')][_0x656e('0x75')](this,_0x4bd29f);if(_0x430fba){this[_0x656e('0x10')]['noop'](util['format'](_0x656e('0x12b'),_0x430fba));var _0x4d0621=this[_0x656e('0x10')]['streamFile'](_0x430fba);try{fs[_0x656e('0x10a')](_0x430fba+'.wav');}catch(_0x3520eb){logger[_0x656e('0x2d')](_0x3520eb);}return _0x4d0621;}return this['channel'][_0x656e('0x2d')](_0x4bd29f,_0x656e('0x12c'));};AGIVertices[_0x656e('0x13')]['awslex']=function(_0x4db5c3){logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0x12d'),_0x4db5c3[_0x656e('0x3a')]));if(!this[_0x656e('0x8b')](_0x4db5c3[_0x656e('0x8e')])||!this[_0x656e('0x8b')](_0x4db5c3[_0x656e('0x8f')])){return this[_0x656e('0x10')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0x656e('0x8b')](_0x4db5c3[_0x656e('0x96')])){return this[_0x656e('0x10')][_0x656e('0xb3')](_0x656e('0x12e'));}if(!this[_0x656e('0x8b')](_0x4db5c3[_0x656e('0x5e')])){return this[_0x656e('0x10')][_0x656e('0xb3')](_0x656e('0xce'));}this[_0x656e('0x10')][_0x656e('0xf3')]=!![];this['createSquareDetailsReport'](_0x4db5c3);this[_0x656e('0x43')](_0x4db5c3['text'],'in','','');this[_0x656e('0x10')][_0x656e('0xb3')](util['format'](_0x656e('0x12f'),_0x4db5c3[_0x656e('0x5e')]));var _0x589c61=this[_0x656e('0x94')][_0x656e('0x75')](this,_0x4db5c3);if(_0x589c61){for(var _0x2a32ab in _0x589c61){if(_0x589c61[_0x656e('0x9d')](_0x2a32ab)&&_['isString'](_0x589c61[_0x2a32ab])){this[_0x656e('0x10')]['setVariable'](util[_0x656e('0xa6')](_0x656e('0x130'),_0x2a32ab['toUpperCase']()),_0x589c61[_0x2a32ab]);}}if(_['isNil'](_0x589c61[_0x656e('0x7c')])){return this[_0x656e('0x10')][_0x656e('0xb3')](_0x656e('0x131'));}else{this['createSquareMessage'](_0x589c61[_0x656e('0x7c')],_0x656e('0xf4'),_0x656e('0x132'),'');return this[_0x656e('0x10')]['noop'](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x589c61[_0x656e('0x7c')]));}}return this[_0x656e('0x10')]['error'](_0x4db5c3,_0x656e('0x133'));};AGIVertices['prototype'][_0x656e('0x134')]=function(_0x5b47d8){logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0x135'),_0x5b47d8[_0x656e('0x3a')],_0x5b47d8['timeout']));if(!this[_0x656e('0x8b')](_0x5b47d8[_0x656e('0x7f')])){return this[_0x656e('0x10')][_0x656e('0xb3')](_0x656e('0xf2'));}var _0x242198='wav';var _0x20bc4b=util[_0x656e('0xa6')]('%s/recordings/%s',FILES_PATH,rs[_0x656e('0x121')](0x4));var _0x5c83f7=util[_0x656e('0xa6')](_0x656e('0xa7'),_0x20bc4b,_0x242198);var _0x1e510e=!![];if(_0x5b47d8[_0x656e('0x136')]===_0x656e('0x137')){_0x1e510e=![];}var _0x31ab36=this[_0x656e('0x10')][_0x656e('0x138')](_0x20bc4b,_0x242198,_0x5b47d8['intKey'],_0x5b47d8['timeout'],undefined,_0x1e510e);if(_0x31ab36['result']!==-0x1){this[_0x656e('0x10')][_0x656e('0xb3')](util[_0x656e('0xa6')](_0x656e('0x139'),_0x5c83f7));var _0x2baf84=this[_0x656e('0x97')]['sync'](this,_0x5b47d8,_0x5c83f7);if(_0x2baf84){for(var _0x2bc4f2 in _0x2baf84){if(_0x2baf84[_0x656e('0x9d')](_0x2bc4f2)){this[_0x656e('0x10')][_0x656e('0xa8')](util[_0x656e('0xa6')](_0x656e('0x13a'),_0x2bc4f2['toUpperCase']()),_0x2baf84[_0x2bc4f2]);}}return this[_0x656e('0x10')]['noop'](util[_0x656e('0xa6')](_0x656e('0x13b'),JSON[_0x656e('0x78')](_0x2baf84)));}}return _0x31ab36;};AGIVertices[_0x656e('0x13')][_0x656e('0x13c')]=function(_0x3ba4e0){logger['info'](util['format'](_0x656e('0x13d'),_0x3ba4e0[_0x656e('0x3a')]));if(!this[_0x656e('0x8b')](_0x3ba4e0[_0x656e('0x9a')])){return this['channel'][_0x656e('0xb3')](_0x656e('0x13e'));}if(!this['isConfigured'](_0x3ba4e0['appsecret'])){return this[_0x656e('0x10')][_0x656e('0xb3')](_0x656e('0x13f'));}var _0x105fa9=_0x656e('0x140');var _0x4dd712=util[_0x656e('0xa6')](_0x656e('0x141'),FILES_PATH,rs[_0x656e('0x121')](0x4));var _0x326f7d=util['format'](_0x656e('0xa7'),_0x4dd712,_0x105fa9);var _0xdf7c0=!![];if(_0x3ba4e0[_0x656e('0x136')]===_0x656e('0x137')){_0xdf7c0=![];}var _0x1070fd=this[_0x656e('0x10')][_0x656e('0x138')](_0x4dd712,_0x105fa9,_0x3ba4e0[_0x656e('0x142')],_0x3ba4e0[_0x656e('0x68')],undefined,_0xdf7c0);if(_0x1070fd[_0x656e('0xad')]!==-0x1){this['channel'][_0x656e('0xb3')](util[_0x656e('0xa6')](_0x656e('0x143'),_0x326f7d));var _0x17cde5=this[_0x656e('0x99')][_0x656e('0x75')](this,_0x3ba4e0,_0x326f7d);if(_0x17cde5){for(var _0x37bc19 in _0x17cde5){if(_0x17cde5[_0x656e('0x9d')](_0x37bc19)){this[_0x656e('0x10')][_0x656e('0xa8')](util['format'](_0x656e('0x144'),_0x37bc19['toUpperCase']()),_0x17cde5[_0x37bc19]);}}return this[_0x656e('0x10')][_0x656e('0xb3')](util[_0x656e('0xa6')](_0x656e('0x145'),JSON['stringify'](_0x17cde5)));}}return _0x1070fd;};AGIVertices['prototype'][_0x656e('0x146')]=function(_0x130eb5){logger[_0x656e('0x2f')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x130eb5[_0x656e('0x3a')]));return this[_0x656e('0x10')][_0x656e('0x147')](_0x130eb5[_0x656e('0x148')],_0x130eb5[_0x656e('0x40')],_0x130eb5[_0x656e('0x41')]);};AGIVertices[_0x656e('0x13')][_0x656e('0x149')]=function(_0x36aafc){logger[_0x656e('0x2f')](util['format'](_0x656e('0x14a'),_0x36aafc['label']));if(!this[_0x656e('0x8b')](_0x36aafc[_0x656e('0x14b')])){return this[_0x656e('0x10')][_0x656e('0x2d')](_0x36aafc,_0x656e('0x14c'));}try{var _0x5b2404=eval(_0x36aafc[_0x656e('0x14b')])?_0x656e('0x14d'):_0x656e('0x14e');this[_0x656e('0x10')]['noop'](util[_0x656e('0xa6')](_0x656e('0x14f'),_0x36aafc['condition'],_0x5b2404));return{'code':0xc8,'result':_0x5b2404};}catch(_0x23ed16){return{'code':0xc8,'result':_0x656e('0x14e')};}};AGIVertices[_0x656e('0x13')][_0x656e('0x150')]=function(_0x4e1777){logger['info'](util['format'](_0x656e('0x151'),_0x4e1777[_0x656e('0x3a')]));if(!this['isConfigured'](_0x4e1777[_0x656e('0x152')])){return this[_0x656e('0x10')][_0x656e('0x2d')](_0x4e1777,'no\x20interval\x20configured');}var _0x4ddf91=this[_0x656e('0x153')][_0x656e('0x75')](this,_0x4e1777[_0x656e('0x152')]);if(!_0x4ddf91){return this[_0x656e('0x10')][_0x656e('0x2d')](_0x4e1777,_0x656e('0x154'));}for(var _0x43f1b9=0x0;_0x43f1b9<_0x4ddf91[_0x656e('0xa4')];_0x43f1b9+=0x1){var _0x5a142e=this[_0x656e('0x10')][_0x656e('0x14')](util['format']('IFTIME(%s?true:false)',_0x4ddf91[_0x43f1b9]));if(_0x5a142e[_0x656e('0xad')]===-0x1){return _0x5a142e;}logger[_0x656e('0x2f')](util['format'](_0x656e('0x155'),_0x4ddf91[_0x43f1b9],_0x5a142e[_0x656e('0xab')]));if(_0x5a142e[_0x656e('0xab')]===_0x656e('0x14d')){logger['info'](util[_0x656e('0xa6')](_0x656e('0x155'),_0x4ddf91[_0x43f1b9],'true'));this['channel'][_0x656e('0xb3')](util[_0x656e('0xa6')](_0x656e('0x155'),_0x4ddf91[_0x43f1b9],_0x656e('0x14d')));return{'code':0xc8,'result':_0x656e('0x14d')};}else{logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0x155'),_0x4ddf91[_0x43f1b9],_0x656e('0x14e')));this[_0x656e('0x10')][_0x656e('0xb3')](util[_0x656e('0xa6')]('IFTIME\x20%s\x20%s',_0x4ddf91[_0x43f1b9],_0x656e('0x14e')));}}return{'code':0xc8,'result':_0x656e('0x14e')};};AGIVertices['prototype']['hangup']=function(_0x331660){logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0x156'),_0x331660['label']));return this[_0x656e('0x10')][_0x656e('0x157')]();};AGIVertices[_0x656e('0x13')][_0x656e('0x158')]=function(_0x1d837a){logger[_0x656e('0x2f')](util[_0x656e('0xa6')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x1d837a[_0x656e('0x3a')]));if(!this[_0x656e('0x8b')](_0x1d837a['key'])){return this[_0x656e('0x10')]['noop']('no\x20key\x20configured');}var _0x4f1e07=_0x656e('0x140');var _0x48c6a7=util['format'](_0x656e('0x141'),FILES_PATH,rs[_0x656e('0x121')](0x4));var _0x2daa71=util[_0x656e('0xa6')](_0x656e('0xa7'),_0x48c6a7,_0x4f1e07);var _0x151a6f=!![];if(_0x1d837a[_0x656e('0x136')]===_0x656e('0x137')){_0x151a6f=![];}var _0x498171=this[_0x656e('0x10')][_0x656e('0x138')](_0x48c6a7,_0x4f1e07,_0x1d837a[_0x656e('0x142')],_0x1d837a[_0x656e('0x68')],undefined,_0x151a6f);if(_0x498171['result']!==-0x1){this['channel']['noop'](util[_0x656e('0xa6')](_0x656e('0x159'),_0x2daa71));var _0x410b64=this[_0x656e('0x88')][_0x656e('0x75')](this,_0x1d837a,_0x2daa71);if(_0x410b64){for(var _0x2b8bfe in _0x410b64){if(_0x410b64[_0x656e('0x9d')](_0x2b8bfe)){this[_0x656e('0x10')]['setVariable'](util[_0x656e('0xa6')](_0x656e('0x15a'),_0x2b8bfe['toUpperCase']()),_0x410b64[_0x2b8bfe]);}}return this['channel'][_0x656e('0xb3')](util[_0x656e('0xa6')](_0x656e('0x15b'),JSON[_0x656e('0x78')](_0x410b64)));}}return _0x498171;};AGIVertices['prototype']['ispeechtts']=function(_0x16ff66){logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0x15c'),_0x16ff66[_0x656e('0x3a')]));if(!this[_0x656e('0x8b')](_0x16ff66[_0x656e('0x7f')])){return this['channel']['noop'](_0x656e('0xf2'));}if(!this[_0x656e('0x8b')](_0x16ff66[_0x656e('0x5e')])){return this[_0x656e('0x10')]['noop'](_0x656e('0xce'));}this[_0x656e('0x10')][_0x656e('0xb3')](util[_0x656e('0xa6')]('Trying\x20ispeech\x20TTS\x20%s',_0x16ff66[_0x656e('0x5e')]));var _0x102169=this[_0x656e('0x15d')][_0x656e('0x75')](this,_0x16ff66);if(_0x102169){this[_0x656e('0x10')][_0x656e('0xb3')](util['format'](_0x656e('0x159'),_0x102169));var _0x1c8ab0=this[_0x656e('0x10')][_0x656e('0x109')](_0x102169,_0x16ff66['intKey']);try{fs['unlink'](_0x102169+_0x656e('0x15e'));}catch(_0x189796){logger[_0x656e('0x2d')](_0x189796);}return _0x1c8ab0;}return this[_0x656e('0x10')][_0x656e('0x2d')](_0x16ff66,_0x656e('0x15f'));};AGIVertices[_0x656e('0x13')][_0x656e('0x160')]=function(_0x2e8e01){logger[_0x656e('0x2f')](util['format'](_0x656e('0x161'),_0x2e8e01[_0x656e('0x3a')]));if(!this['isConfigured'](_0x2e8e01[_0x656e('0x162')])){return this[_0x656e('0x10')][_0x656e('0x2d')](_0x2e8e01,'no\x20find\x20by\x20configured');}logger['info'](util['format'](_0x656e('0x163'),this[_0x656e('0x10')][_0x656e('0x3d')],_0x2e8e01[_0x656e('0x162')]));var _0x3e5577=this[_0x656e('0x57')][_0x656e('0x75')](this,_0x2e8e01[_0x656e('0x162')]);if(_0x3e5577){logger[_0x656e('0x2f')](util['format'](_0x656e('0x164'),this[_0x656e('0x10')][_0x656e('0x3d')],_0x2e8e01[_0x656e('0x162')]));this[_0x656e('0x10')][_0x656e('0xb3')](util[_0x656e('0xa6')](_0x656e('0x164'),this['channel'][_0x656e('0x3d')],_0x2e8e01[_0x656e('0x162')]));return{'code':0xc8,'result':_0x656e('0x165')};}else{logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0x166'),this[_0x656e('0x10')][_0x656e('0x3d')],_0x2e8e01[_0x656e('0x162')]));this[_0x656e('0x10')][_0x656e('0xb3')](util[_0x656e('0xa6')](_0x656e('0x166'),this[_0x656e('0x10')][_0x656e('0x3d')],_0x2e8e01['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x656e('0x13')][_0x656e('0x167')]=function(_0x6b76b9){logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0x168'),_0x6b76b9[_0x656e('0x3a')]));if(!this[_0x656e('0x8b')](_0x6b76b9[_0x656e('0x162')])){return this[_0x656e('0x10')][_0x656e('0x2d')](_0x6b76b9,_0x656e('0x169'));}logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0x163'),this[_0x656e('0x10')][_0x656e('0x3d')],_0x6b76b9['findBy']));var _0x126a37=this[_0x656e('0x55')][_0x656e('0x75')](this,_0x6b76b9[_0x656e('0x162')]);if(_0x126a37){logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0x164'),this[_0x656e('0x10')][_0x656e('0x3d')],_0x6b76b9[_0x656e('0x162')]));this[_0x656e('0x10')][_0x656e('0xb3')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x656e('0x10')]['callerid'],_0x6b76b9[_0x656e('0x162')]));return{'code':0xc8,'result':_0x656e('0x165')};}else{logger[_0x656e('0x2f')](util[_0x656e('0xa6')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x656e('0x3d')],_0x6b76b9['findBy']));this[_0x656e('0x10')][_0x656e('0xb3')](util['format'](_0x656e('0x166'),this['channel']['callerid'],_0x6b76b9[_0x656e('0x162')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x656e('0x13')][_0x656e('0x16a')]=function(_0x39c8c3){logger['info'](util[_0x656e('0xa6')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x39c8c3[_0x656e('0x3a')]));if(!this[_0x656e('0x8b')](_0x39c8c3['operation'])){return this[_0x656e('0x10')][_0x656e('0x2d')](_0x39c8c3,_0x656e('0x16b'));}this[_0x656e('0x10')][_0x656e('0xb3')](util[_0x656e('0xa6')](_0x656e('0x16c'),_0x39c8c3[_0x656e('0x16d')]));var _0x5162c1=eval(_0x39c8c3[_0x656e('0x16d')]);if(!this[_0x656e('0x8b')](_0x39c8c3[_0x656e('0x11a')])){return this[_0x656e('0x10')][_0x656e('0xb3')](_0x656e('0xe1'));}var _0x1c62f8=this['getVariable'][_0x656e('0x75')](this,_0x39c8c3[_0x656e('0x11a')]);if(!_0x1c62f8){return this[_0x656e('0x10')][_0x656e('0x2d')](_0x39c8c3,_0x656e('0xe2'));}if(_[_0x656e('0xa3')](_0x5162c1)){var _0x4628c2=this;_0x5162c1[_0x656e('0xe3')](function(_0x1cd063,_0x318d6d){_0x4628c2[_0x656e('0x10')]['setVariable'](util['format']('%s[%s]',_0x1c62f8,_0x318d6d),_0x1cd063);});return this['channel'][_0x656e('0xb3')](util[_0x656e('0xa6')](_0x656e('0x16e'),_0x1c62f8));}else{return this[_0x656e('0x10')][_0x656e('0xa8')](_0x1c62f8,_0x5162c1);}};AGIVertices['prototype'][_0x656e('0xd')]=function(_0x789783){logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0x16f'),_0x789783[_0x656e('0x3a')]));if(_0x789783[_0x656e('0xb0')]===0x0){return this[_0x656e('0xaf')](_0x789783);}_0x789783[_0x656e('0xb0')]-=0x1;if(!this[_0x656e('0x8b')](_0x789783[_0x656e('0x117')])){return this[_0x656e('0x10')][_0x656e('0x2d')](_0x789783,_0x656e('0x118'));}var _0x50a972=this[_0x656e('0x21')][_0x656e('0x75')](this,_0x789783[_0x656e('0x117')]);if(!_0x50a972){return this[_0x656e('0x10')]['error'](_0x789783,_0x656e('0x119'));}var _0x8932b7=this[_0x656e('0x10')][_0x656e('0x11b')](_0x50a972,_0x789783['response'],_0x789783[_0x656e('0x170')]);var _0x54249d=_0x8932b7[_0x656e('0xad')];if(_0x8932b7['result']===-0x1){this[_0x656e('0x38')]['sync'](this,_0x789783,'-1');return _0x8932b7;}else if(_0x8932b7[_0x656e('0xab')]==='timeout'){_0x8932b7[_0x656e('0xad')]=_0x8932b7['result']['length']>0x0?_0x8932b7['result']:'t';}else if(_[_0x656e('0x45')](_0x8932b7[_0x656e('0xad')])){_0x8932b7[_0x656e('0xad')]='#';_0x54249d='#';}if(!this[_0x656e('0x8b')](_0x789783['variable_id'])){this[_0x656e('0x10')][_0x656e('0xb3')](_0x656e('0xe1'));}else{var _0x5ca2a0=this['getVariable'][_0x656e('0x75')](this,_0x789783[_0x656e('0x11a')]);if(!_0x5ca2a0){return this[_0x656e('0x10')][_0x656e('0x2d')](_0x789783,_0x656e('0xe2'));}this[_0x656e('0x10')][_0x656e('0xa8')](_0x5ca2a0,_0x54249d);}this[_0x656e('0x38')][_0x656e('0x75')](this,_0x789783,_0x54249d);return _0x8932b7;};AGIVertices[_0x656e('0x13')]['noop']=function(_0xa8c9d2){logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0x171'),_0xa8c9d2[_0x656e('0x3a')]));return this[_0x656e('0x10')][_0x656e('0xb3')](_0xa8c9d2[_0x656e('0x172')]||_0xa8c9d2[_0x656e('0x3a')]);};AGIVertices[_0x656e('0x13')][_0x656e('0x173')]=function(_0x3f32e6){logger[_0x656e('0x2f')](util['format'](_0x656e('0x174'),_0x3f32e6['label']));if(!this[_0x656e('0x8b')](_0x3f32e6[_0x656e('0x162')])){return this[_0x656e('0x10')][_0x656e('0x2d')](_0x3f32e6,_0x656e('0x169'));}logger[_0x656e('0x2f')](util['format'](_0x656e('0x163'),this[_0x656e('0x10')][_0x656e('0x3d')],_0x3f32e6[_0x656e('0x162')]));var _0x1071e9=this[_0x656e('0x4f')][_0x656e('0x75')](this,_0x3f32e6['pause_id']);var _0x190795=this[_0x656e('0x51')][_0x656e('0x75')](this,_0x3f32e6[_0x656e('0x162')],_0x1071e9);if(_0x190795){logger[_0x656e('0x2f')](util[_0x656e('0xa6')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x656e('0x10')]['callerid'],_0x3f32e6[_0x656e('0x162')]));this[_0x656e('0x10')][_0x656e('0xb3')](util[_0x656e('0xa6')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x656e('0x10')][_0x656e('0x3d')],_0x3f32e6[_0x656e('0x162')]));return{'code':0xc8,'result':_0x656e('0x165')};}else{logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0x166'),this[_0x656e('0x10')][_0x656e('0x3d')],_0x3f32e6[_0x656e('0x162')]));this['channel'][_0x656e('0xb3')](util['format'](_0x656e('0x164'),this[_0x656e('0x10')][_0x656e('0x3d')],_0x3f32e6[_0x656e('0x162')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x656e('0x13')][_0x656e('0x175')]=function(_0x29bd55){logger['info'](util['format'](_0x656e('0x176'),_0x29bd55[_0x656e('0x3a')]));if(!this[_0x656e('0x8b')](_0x29bd55[_0x656e('0x117')])){return this[_0x656e('0x10')][_0x656e('0x2d')](_0x29bd55,_0x656e('0x118'));}var _0x244a96=this[_0x656e('0x21')][_0x656e('0x75')](this,_0x29bd55[_0x656e('0x117')]);if(!_0x244a96){return this[_0x656e('0x10')][_0x656e('0x2d')](_0x29bd55,_0x656e('0x119'));}var _0x3e20ef=this[_0x656e('0x10')][_0x656e('0x58')]('PLAYBACK',[_0x244a96,_0x29bd55[_0x656e('0xee')]]);if(_0x3e20ef[_0x656e('0xad')]===-0x1){return _0x3e20ef;}return this[_0x656e('0x10')][_0x656e('0xb3')](util['format']('Executed\x20command\x20%s\x20%s',_0x656e('0x177'),_0x244a96));};AGIVertices[_0x656e('0x13')][_0x656e('0x178')]=function(_0x8c40ba){logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0x179'),_0x8c40ba[_0x656e('0x3a')]));if(!this['isConfigured'](_0x8c40ba[_0x656e('0x17a')])){return this['channel']['error'](_0x8c40ba,'no\x20queue\x20selected');}var _0x1f0b0d='';var _0x1a0b42=parseInt(_0x8c40ba['queue_id'],0xa);if(isNaN(_0x1a0b42)){_0x1f0b0d=_0x8c40ba[_0x656e('0x17a')];}else{_0x1f0b0d=this[_0x656e('0x17b')][_0x656e('0x75')](this,_0x8c40ba[_0x656e('0x17a')]);if(!_0x1f0b0d){return this[_0x656e('0x10')][_0x656e('0x2d')](_0x8c40ba,_0x656e('0x17c'));}}var _0x289614='';if(this['isConfigured'](_0x8c40ba[_0x656e('0x117')])){var _0x1e688e=this['getSound'][_0x656e('0x75')](this,_0x8c40ba[_0x656e('0x117')]);if(_0x1e688e){_0x289614=_0x1e688e;}}this[_0x656e('0x38')][_0x656e('0x75')](this,_0x8c40ba,_0x1f0b0d);if(_0x8c40ba['opts'][_0x656e('0x17d')]('x')<0x0){_0x8c40ba[_0x656e('0xee')]+='x';}if(_0x8c40ba[_0x656e('0xee')]['indexOf']('X')<0x0){_0x8c40ba[_0x656e('0xee')]+='X';}this[_0x656e('0x10')][_0x656e('0xa8')]('XMCS-QUEUE',_0x1f0b0d?_0x1f0b0d[_0x656e('0x17e')]():'');var _0x2ed306=this['channel'][_0x656e('0x58')]('QUEUE',[_0x1f0b0d,_0x8c40ba[_0x656e('0xee')],_0x8c40ba[_0x656e('0x66')],_0x289614,_0x8c40ba[_0x656e('0x68')],_0x8c40ba[_0x656e('0x8')],_0x8c40ba['macro'],_0x8c40ba[_0x656e('0x17f')],'',_0x8c40ba[_0x656e('0x180')]]);if(_0x2ed306['result']===-0x1){return _0x2ed306;}return this[_0x656e('0x10')]['noop'](util[_0x656e('0xa6')]('Executed\x20command\x20%s\x20%s','QUEUE',_0x1f0b0d));};AGIVertices[_0x656e('0x13')][_0x656e('0x181')]=function(_0x565946){logger[_0x656e('0x2f')](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x565946['label']));var _0x2ec9dc=_0x565946[_0x656e('0x182')]||'wav';var _0x3c386a=util[_0x656e('0xa6')]('%s_%s',this[_0x656e('0x10')][_0x656e('0x39')],rs[_0x656e('0x121')](0x5));var _0x3459fd=util['format']('%s/recordings/%s.%s',FILES_PATH,_0x3c386a,_0x2ec9dc);var _0x109258=util['format'](_0x656e('0x141'),FILES_PATH,_0x3c386a);this['createSquareRecording'][_0x656e('0x75')](this,_0x565946,_0x3c386a,_0x3459fd);this[_0x656e('0x10')][_0x656e('0xa8')](_0x656e('0x183'),_0x3c386a);logger['info'](_0x656e('0x184'),_0x109258,_0x2ec9dc,_0x565946[_0x656e('0x185')],_0x565946[_0x656e('0x68')]);return this[_0x656e('0x10')][_0x656e('0x138')](_0x109258,_0x2ec9dc,_0x565946['escape_digits'],_0x565946[_0x656e('0x68')],undefined,!![]);};AGIVertices[_0x656e('0x13')][_0x656e('0x186')]=function(_0x1eef33){logger[_0x656e('0x2f')](util[_0x656e('0xa6')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x1eef33[_0x656e('0x3a')]));if(!this[_0x656e('0x8b')](_0x1eef33[_0x656e('0x66')])){return this[_0x656e('0x10')][_0x656e('0xb3')](_0x656e('0x187'));}var _0x16cbd1=this[_0x656e('0x65')][_0x656e('0x75')](this,_0x1eef33);logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0x188'),util[_0x656e('0x189')](_0x16cbd1,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x1eef33[_0x656e('0x11a')])){return this[_0x656e('0x10')][_0x656e('0xb3')](_0x656e('0x18a'));}var _0x5304a2=this['getVariable'][_0x656e('0x75')](this,_0x1eef33[_0x656e('0x11a')]);if(!_0x5304a2){return this[_0x656e('0x10')][_0x656e('0x2d')](_0x1eef33,_0x656e('0xe2'));}this['channel'][_0x656e('0xa8')](util[_0x656e('0xa6')]('%s_STATUS_CODE',_0x5304a2),_0x16cbd1[_0x656e('0x7a')]?_0x16cbd1['statusCode']:_0x656e('0x18b'));this[_0x656e('0x10')][_0x656e('0xa8')](util['format'](_0x656e('0x18c'),_0x5304a2),_0x16cbd1[_0x656e('0x7b')]?_0x16cbd1[_0x656e('0x7b')]:'OK');if(_0x16cbd1[_0x656e('0x6e')]){try{this['saveRestApiResult'](_0x16cbd1['body'],_0x5304a2);}catch(_0x366472){logger[_0x656e('0x2d')](util['format']('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x5304a2));}}return this[_0x656e('0x10')]['noop'](util[_0x656e('0xa6')]('variable\x20%s\x20set',_0x5304a2));};AGIVertices[_0x656e('0x13')][_0x656e('0x18d')]=function(_0x2d6687){logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0x18e'),_0x2d6687[_0x656e('0x3a')]));return this[_0x656e('0x10')][_0x656e('0x18f')](_0x2d6687['digits'][_0x656e('0x5a')](/\s+/g,''),_0x2d6687[_0x656e('0x185')]);};AGIVertices['prototype'][_0x656e('0x190')]=function(_0x8bac61){logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0x191'),_0x8bac61['label']));return this[_0x656e('0x10')][_0x656e('0x192')](_0x8bac61[_0x656e('0x69')]['replace'](/\s+/g,''),_0x8bac61['escape_digits']);};AGIVertices[_0x656e('0x13')]['sayphonetic']=function(_0x3e7bdb){logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0x193'),_0x3e7bdb['label']));return this[_0x656e('0x10')]['sayPhonetic'](_0x3e7bdb[_0x656e('0x5e')],_0x3e7bdb[_0x656e('0x185')]);};AGIVertices[_0x656e('0x13')]['sendMail']=function(_0x5edb93){logger[_0x656e('0x2f')](util[_0x656e('0xa6')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x5edb93[_0x656e('0x3a')]));if(!this[_0x656e('0x8b')](_0x5edb93['account_id'])){return this[_0x656e('0x10')][_0x656e('0xb3')](_0x656e('0x194'));}var _0x274992=this[_0x656e('0x195')][_0x656e('0x75')](this,_0x5edb93[_0x656e('0x196')]);if(!_0x274992||!_0x274992[_0x656e('0x197')]){return this[_0x656e('0x10')][_0x656e('0x2d')](_0x5edb93,_0x656e('0x198'));}var _0x41c3a1={'from':util[_0x656e('0xa6')](_0x656e('0x199'),_0x274992[_0x656e('0x15')],_0x274992[_0x656e('0x19a')]||_0x274992[_0x656e('0x197')][_0x656e('0x19b')]),'to':_0x5edb93['to']||'','cc':_0x5edb93['cc']||'','bcc':_0x5edb93['bcc']||'','subject':_0x5edb93[_0x656e('0x19c')],'html':_0x5edb93[_0x656e('0x5e')],'text':_0x5edb93[_0x656e('0x5e')]};if(this['isConfigured'](_0x5edb93[_0x656e('0x19d')])){}logger[_0x656e('0xe9')](_0x656e('0x19e'),JSON[_0x656e('0x78')](_0x41c3a1));this[_0x656e('0x38')][_0x656e('0x75')](this,_0x5edb93,_0x5edb93[_0x656e('0x196')]);this['channel'][_0x656e('0xb3')](util[_0x656e('0xa6')](_0x656e('0x19f'),_0x274992[_0x656e('0x15')]));this[_0x656e('0x1a0')][_0x656e('0x75')](this,_0x274992[_0x656e('0x1a1')],_0x41c3a1);return this[_0x656e('0x10')][_0x656e('0xb3')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x656e('0x13')][_0x656e('0x1a2')]=function(_0x4fe2ee){logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0x1a3'),_0x4fe2ee[_0x656e('0x3a')]));return this[_0x656e('0x10')][_0x656e('0xb3')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x656e('0x13')]['sendSMS']=function(_0x31a1f9){logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0x1a4'),_0x31a1f9[_0x656e('0x3a')]));if(!this[_0x656e('0x8b')](_0x31a1f9[_0x656e('0x1a5')])){return this[_0x656e('0x10')][_0x656e('0xb3')]('no\x20sms\x20account\x20configured');}var _0x1f2e73=this[_0x656e('0x35')]['sync'](this,_0x31a1f9[_0x656e('0x1a5')]);if(!_0x1f2e73){return this[_0x656e('0x10')][_0x656e('0x2d')](_0x31a1f9,_0x656e('0x1a6'));}var _0x2c9ff6={'body':_0x31a1f9[_0x656e('0x1a7')],'phone':_0x31a1f9['to']||'','SmsAccountId':_0x1f2e73['id']};logger[_0x656e('0xe9')](_0x656e('0x1a8'),JSON['stringify'](_0x2c9ff6));this[_0x656e('0x38')][_0x656e('0x75')](this,_0x31a1f9,_0x31a1f9[_0x656e('0x1a5')]);this[_0x656e('0x10')][_0x656e('0xb3')](util['format'](_0x656e('0x1a9'),_0x1f2e73[_0x656e('0x15')]));this[_0x656e('0x37')][_0x656e('0x75')](this,_0x2c9ff6);return this[_0x656e('0x10')][_0x656e('0xb3')](_0x656e('0x1aa'));};AGIVertices[_0x656e('0x13')][_0x656e('0x1ab')]=function(_0x40577b){logger['info'](util[_0x656e('0xa6')](_0x656e('0x1ac'),_0x40577b[_0x656e('0x3a')]));if(!this['isConfigured'](_0x40577b['variable_id'])){return this[_0x656e('0x10')][_0x656e('0x2d')](_0x40577b,_0x656e('0x1ad'));}var _0x3f0b8f=this[_0x656e('0x14')][_0x656e('0x75')](this,_0x40577b[_0x656e('0x11a')]);if(!_0x3f0b8f){return this[_0x656e('0x10')]['error'](_0x40577b,_0x656e('0xe2'));}return this['channel']['setVariable'](_0x3f0b8f,_0x40577b[_0x656e('0x1ae')]);};AGIVertices['prototype'][_0x656e('0x1af')]=function(_0x49c578){logger[_0x656e('0x2f')](util[_0x656e('0xa6')]('Enter\x20in\x20START\x20(%s)\x20block',_0x49c578[_0x656e('0x3a')]));this[_0x656e('0x10')][_0x656e('0xb3')](_0x656e('0x1b0'));var _0x6c5b98=this[_0x656e('0x10')][_0x656e('0x14')]('XMCS-UNIQUEID');if(!_[_0x656e('0x45')](_0x6c5b98[_0x656e('0xab')])){this['channel'][_0x656e('0x39')]=_0x6c5b98['extra'];}if(_0x49c578[_0x656e('0xc2')]===_0x656e('0x1b1')){this[_0x656e('0x10')][_0x656e('0xb3')](_0x656e('0x1b2'));return this[_0x656e('0x10')][_0x656e('0xc2')]();}return this[_0x656e('0x10')][_0x656e('0xb3')](_0x656e('0x1b3'));};AGIVertices['prototype'][_0x656e('0x1b4')]=function(_0xb7eff7){logger[_0x656e('0x2f')](util[_0x656e('0xa6')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0xb7eff7[_0x656e('0x3a')]));if(!this['isConfigured'](_0xb7eff7[_0x656e('0x1b5')])){return this[_0x656e('0x10')][_0x656e('0x2d')](_0xb7eff7,_0x656e('0x1b6'));}var _0x57507a=this[_0x656e('0x18')][_0x656e('0x75')](this,_0xb7eff7[_0x656e('0x1b5')]);if(!this[_0x656e('0x8b')](_0x57507a)){return this[_0x656e('0x10')][_0x656e('0x2d')](_0xb7eff7,util[_0x656e('0xa6')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0xb7eff7[_0x656e('0x1b5')]));}if(_0x57507a===this[_0x656e('0x10')][_0x656e('0x3c')]){return this[_0x656e('0x10')][_0x656e('0x2d')](_0xb7eff7,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x656e('0x38')][_0x656e('0x75')](this,_0xb7eff7,_0x57507a);var _0x5a408e=this['channel']['exec'](_0x656e('0x1b7'),util[_0x656e('0xa6')](_0x656e('0x1b8'),config['agi']['host']||_0x656e('0x1b9'),_0x57507a,this[_0x656e('0x10')][_0x656e('0x3c')]));if(_0x5a408e['result']===-0x1){return _0x5a408e;}return this[_0x656e('0x10')][_0x656e('0xb3')](util[_0x656e('0xa6')]('Executed\x20command\x20%s\x20%s',_0x656e('0x1b7'),_0x57507a));};AGIVertices[_0x656e('0x13')][_0x656e('0x1ba')]=function(_0x5209fd){logger['info'](util[_0x656e('0xa6')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x5209fd[_0x656e('0x3a')]));var _0x5676ed=this[_0x656e('0x1bb')][_0x656e('0x75')](this,_0x5209fd[_0x656e('0xc0')]);this[_0x656e('0x38')][_0x656e('0x75')](this,_0x5209fd,_0x5209fd[_0x656e('0xc0')]);if(this[_0x656e('0x8b')](_0x5209fd[_0x656e('0x11a')])){var _0x136258=this[_0x656e('0x14')][_0x656e('0x75')](this,_0x5209fd[_0x656e('0x11a')]);if(_0x136258){this[_0x656e('0x10')][_0x656e('0xa8')](_0x136258,_0x5676ed);return this[_0x656e('0x10')][_0x656e('0xb3')](util[_0x656e('0xa6')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x5209fd['command'],_0x136258));}}return this[_0x656e('0x10')]['noop'](util[_0x656e('0xa6')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x5209fd['command']));};AGIVertices['prototype'][_0x656e('0x1bc')]=function(_0x13aaf8){logger['info'](util[_0x656e('0xa6')](_0x656e('0x1bd'),_0x13aaf8[_0x656e('0x3a')]));_0x13aaf8[_0x656e('0x5e')]=_0x13aaf8[_0x656e('0x5e')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x656e('0x8b')](_0x13aaf8[_0x656e('0x5c')])){return this[_0x656e('0x10')][_0x656e('0xb3')]('no\x20apiKey\x20configured');}if(!this[_0x656e('0x8b')](_0x13aaf8[_0x656e('0x5e')])){return this['channel'][_0x656e('0xb3')](_0x656e('0xce'));}this[_0x656e('0x10')]['noop'](util['format']('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x13aaf8[_0x656e('0x5e')]));var _0x36a782=this[_0x656e('0x5b')][_0x656e('0x75')](this,_0x13aaf8);if(_0x36a782){this[_0x656e('0x10')][_0x656e('0xb3')](util[_0x656e('0xa6')](_0x656e('0x1be'),_0x36a782));var _0x23f51e=this[_0x656e('0x10')]['streamFile'](_0x36a782);try{fs[_0x656e('0x10a')](_0x36a782+_0x656e('0x15e'));}catch(_0xfb1883){logger[_0x656e('0x2d')](_0xfb1883);}return _0x23f51e;}return this['channel']['error'](_0x13aaf8,_0x656e('0x1bf'));};AGIVertices['prototype']['tts']=function(_0x5cad7f){logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0x1c0'),_0x5cad7f['label']));_0x5cad7f[_0x656e('0x5e')]=_0x5cad7f[_0x656e('0x5e')][_0x656e('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x656e('0x8b')](_0x5cad7f[_0x656e('0x5e')])){return this['channel']['noop'](_0x656e('0xce'));}this[_0x656e('0x10')][_0x656e('0xb3')](util[_0x656e('0xa6')](_0x656e('0x1c1'),_0x5cad7f[_0x656e('0x5e')]));var _0x28d8ab=this[_0x656e('0x63')][_0x656e('0x75')](this,_0x5cad7f);if(_0x28d8ab){this[_0x656e('0x10')][_0x656e('0xb3')](util[_0x656e('0xa6')](_0x656e('0x1c2'),_0x28d8ab));var _0xcf5a25=this[_0x656e('0x10')][_0x656e('0x109')](_0x28d8ab);try{fs[_0x656e('0x10a')](_0x28d8ab+_0x656e('0x15e'));}catch(_0x1b1273){logger[_0x656e('0x2d')](_0x1b1273);}return _0xcf5a25;}return this[_0x656e('0x10')][_0x656e('0x2d')](_0x5cad7f,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x656e('0x13')][_0x656e('0x1c3')]=function(_0x49e057){logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0x1c4'),_0x49e057[_0x656e('0x3a')]));if(!this['isConfigured'](_0x49e057[_0x656e('0x162')])){return this['channel'][_0x656e('0x2d')](_0x49e057,_0x656e('0x169'));}logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0x163'),this[_0x656e('0x10')][_0x656e('0x3d')],_0x49e057['findBy']));var _0x56ece6=this['agentUnpause'][_0x656e('0x75')](this,_0x49e057['findBy']);if(_0x56ece6){logger[_0x656e('0x2f')](util[_0x656e('0xa6')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x656e('0x10')][_0x656e('0x3d')],_0x49e057[_0x656e('0x162')]));this[_0x656e('0x10')]['noop'](util['format'](_0x656e('0x164'),this[_0x656e('0x10')]['callerid'],_0x49e057[_0x656e('0x162')]));return{'code':0xc8,'result':_0x656e('0x165')};}else{logger[_0x656e('0x2f')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x656e('0x10')]['callerid'],_0x49e057[_0x656e('0x162')]));this[_0x656e('0x10')][_0x656e('0xb3')](util[_0x656e('0xa6')](_0x656e('0x166'),this['channel']['callerid'],_0x49e057[_0x656e('0x162')]));return{'code':0xc8,'result':_0x656e('0x1c5')};}};AGIVertices[_0x656e('0x13')][_0x656e('0x1c6')]=function(_0x482e2b){logger[_0x656e('0x2f')](util[_0x656e('0xa6')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x482e2b[_0x656e('0x3a')]));var _0x491536=this[_0x656e('0x10')]['exec'](_0x656e('0x1c7'),[_0x482e2b['mailbox'],_0x482e2b[_0x656e('0x7d')]]);if(_0x491536['result']===-0x1){return _0x491536;}return this['channel'][_0x656e('0xb3')](util[_0x656e('0xa6')]('Executed\x20command\x20%s\x20%s',_0x656e('0x1c7'),_0x482e2b[_0x656e('0x1c8')]));};AGIVertices[_0x656e('0x13')]['vswitch']=function(_0x1b3cd4){logger[_0x656e('0x2f')](util[_0x656e('0xa6')](_0x656e('0x1c9'),_0x1b3cd4[_0x656e('0x3a')]));if(!this[_0x656e('0x8b')](_0x1b3cd4['variable_id'])){return this[_0x656e('0x10')][_0x656e('0x2d')](_0x1b3cd4,_0x656e('0x1ad'));}var _0x320fcc=this['getVariable'][_0x656e('0x75')](this,_0x1b3cd4[_0x656e('0x11a')]);if(!_0x320fcc){return this[_0x656e('0x10')]['error'](_0x1b3cd4,_0x656e('0xe2'));}var _0x3a84a3=this[_0x656e('0x10')][_0x656e('0x14')](_0x320fcc);return{'code':0xc8,'result':_0x3a84a3[_0x656e('0xab')]?_0x3a84a3['extra']:'-'};};String[_0x656e('0x13')][_0x656e('0xaa')]=function(_0x222170,_0x2f1224){return this['split'](_0x222170)['join'](_0x2f1224);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index c33a51e..bc5c5fb 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 _0xd579=['transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','diff','prototype','lastPauseAt','timer','uniqueid','then','catch','[%s][UPDATE][ERRORS:%s]','finally','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','resolve','getAgent','info','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','error','[ACW][START]\x20%s','message','stopAcw','[%s][TIMER][STOP][AGENT:%s]','pauseType','saveUnpause','update','[%s][UPDATE][ACWTIME:%s]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]'];(function(_0x17e108,_0x3eeaec){var _0x74dec9=function(_0x523555){while(--_0x523555){_0x17e108['push'](_0x17e108['shift']());}};_0x74dec9(++_0x3eeaec);}(_0xd579,0x160));var _0x9d57=function(_0x4582f1,_0x49e8b1){_0x4582f1=_0x4582f1-0x0;var _0xad881a=_0xd579[_0x4582f1];return _0xad881a;};'use strict';var _=require('lodash');var moment=require(_0x9d57('0x0'));var ami=require(_0x9d57('0x1'));var logger=require(_0x9d57('0x2'))(_0x9d57('0x3'));var RpcUser=require(_0x9d57('0x4'));var RpcVoiceAgentReport=require(_0x9d57('0x5'));function Acw(_0x26f47f){this['voiceQueues']=_0x26f47f[_0x9d57('0x6')];this[_0x9d57('0x7')]=_0x26f47f['agents'];this[_0x9d57('0x8')]=_0x26f47f[_0x9d57('0x8')];this[_0x9d57('0x9')]={};ami['on']('agentconnect',this[_0x9d57('0xa')][_0x9d57('0xb')](this));ami['on'](_0x9d57('0xc'),this[_0x9d57('0xd')]['bind'](this));ami['on'](_0x9d57('0xe'),this[_0x9d57('0xf')][_0x9d57('0xb')](this));ami['on'](_0x9d57('0x10'),this[_0x9d57('0x11')][_0x9d57('0xb')](this));ami['on'](_0x9d57('0x12'),this[_0x9d57('0x13')]['bind'](this));ami['on'](_0x9d57('0x14'),this[_0x9d57('0x15')]['bind'](this));ami['on'](_0x9d57('0x16'),this['syncAgentConnectPreview']['bind'](this));}function getDiff(_0x409497){var _0x19897e=moment()['milliseconds'](0x0);var _0x1922c6=moment(_0x409497)['milliseconds'](0x0);return _0x19897e[_0x9d57('0x17')](_0x1922c6,'seconds');}Acw[_0x9d57('0x18')]['updateAcw']=function(_0x490478,_0x5a8430){var _0x7d0d50=this;var _0x1c01d0=getDiff(_0x7d0d50[_0x9d57('0x8')][_0x490478][_0x9d57('0x19')]);clearTimeout(_0x7d0d50[_0x9d57('0x8')][_0x490478]['timer']);_0x7d0d50[_0x9d57('0x8')][_0x490478][_0x9d57('0x1a')]=![];return RpcVoiceAgentReport['update']({'acwtime':_0x1c01d0},_0x7d0d50[_0x9d57('0x8')][_0x490478][_0x9d57('0x1b')],_0x490478)[_0x9d57('0x1c')](function(_0x435526){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x5a8430,_0x1c01d0,_0x435526);})[_0x9d57('0x1d')](function(_0x281799){logger['error'](_0x9d57('0x1e'),_0x5a8430,_0x281799);})[_0x9d57('0x1f')](function(){delete _0x7d0d50[_0x9d57('0x8')][_0x490478];});};Acw['prototype'][_0x9d57('0x20')]=function(_0x5b7e0e){try{var _0x1d3f56=this;var _0x683ae1=this[_0x9d57('0x9')][_0x5b7e0e][_0x9d57('0x21')];var _0x27be50=this[_0x9d57('0x9')][_0x5b7e0e][_0x9d57('0x22')];var _0x1e50f7=this[_0x9d57('0x6')][_0x27be50];var _0x36f421=![];var _0x1a2769=_0x9d57('0x23');if(_0x1e50f7[_0x9d57('0x24')]&&_0x1e50f7[_0x9d57('0x25')][_0x9d57('0x26')]){_0x36f421=!![];_0x1a2769=_0x1e50f7[_0x9d57('0x25')][_0x9d57('0x26')];}if(!_0x1d3f56[_0x9d57('0x7')][_0x683ae1]){return Promise[_0x9d57('0x27')]();}return RpcUser[_0x9d57('0x28')](_0x1d3f56[_0x9d57('0x7')][_0x683ae1]['id'])[_0x9d57('0x1c')](function(_0x363060){if(!_0x363060||_0x363060['voicePause']){logger[_0x9d57('0x29')](_0x9d57('0x2a'),_0x5b7e0e,_0x683ae1,_0x27be50);return;}logger[_0x9d57('0x29')](_0x9d57('0x2b'),_0x5b7e0e,_0x683ae1,_0x27be50);var _0x5b9ae4=_0x1d3f56[_0x9d57('0x9')][_0x5b7e0e][_0x9d57('0x2c')]&&_0x1d3f56['channels'][_0x5b7e0e]['destlinkedid']?_0x1d3f56[_0x9d57('0x9')][_0x5b7e0e][_0x9d57('0x2d')]:_0x5b7e0e;return RpcUser[_0x9d57('0x2e')](_0x1d3f56[_0x9d57('0x7')][_0x683ae1],_0x1a2769,_0x5b9ae4)['then'](function(_0x279a58){_0x1d3f56['voiceQueues'][_0x27be50]['available']-=0x1;_0x1d3f56[_0x9d57('0x6')][_0x27be50][_0x9d57('0x2f')]+=0x1;return _0x279a58;});})['then'](function(_0x4f5ea4){if(_0x36f421||!_0x4f5ea4){return;}_0x1d3f56[_0x9d57('0x8')][_0x683ae1]={};logger[_0x9d57('0x29')](_0x9d57('0x30'),_0x5b7e0e,_0x1d3f56[_0x9d57('0x6')][_0x27be50][_0x9d57('0x31')],_0x683ae1,_0x27be50);_0x1d3f56[_0x9d57('0x8')][_0x683ae1][_0x9d57('0x1a')]=setTimeout(_0x1d3f56['stopAcw'][_0x9d57('0xb')](_0x1d3f56,_0x683ae1),_0x1d3f56[_0x9d57('0x6')][_0x27be50][_0x9d57('0x31')]*0x3e8);_0x1d3f56[_0x9d57('0x8')][_0x683ae1]['lastPauseAt']=moment()[_0x9d57('0x32')](_0x9d57('0x33'));_0x1d3f56[_0x9d57('0x8')][_0x683ae1][_0x9d57('0x1b')]=_0x5b7e0e;_0x1d3f56[_0x9d57('0x8')][_0x683ae1]['queue']=_0x27be50;_0x1d3f56['timers'][_0x683ae1][_0x9d57('0x34')]=_0x1d3f56[_0x9d57('0x34')][_0x9d57('0xb')](_0x1d3f56,_0x683ae1,_0x5b7e0e);})[_0x9d57('0x1d')](function(){logger[_0x9d57('0x35')](_0x9d57('0x30'),_0x5b7e0e,_0x1d3f56[_0x9d57('0x6')][_0x27be50][_0x9d57('0x31')],_0x683ae1,_0x27be50);})[_0x9d57('0x1f')](function(){delete _0x1d3f56['channels'][_0x5b7e0e];});}catch(_0x16e44f){logger[_0x9d57('0x35')](_0x9d57('0x36'),_0x16e44f[_0x9d57('0x37')]);}};Acw['prototype'][_0x9d57('0x38')]=function(_0x595044){try{var _0x1fb056=this;if(_0x1fb056[_0x9d57('0x8')][_0x595044]){_0x1fb056[_0x9d57('0x8')][_0x595044][_0x9d57('0x1a')]=![];var _0x200c92=_0x1fb056[_0x9d57('0x8')][_0x595044][_0x9d57('0x1b')];var _0x469272=_0x1fb056[_0x9d57('0x8')][_0x595044][_0x9d57('0x22')];var _0x3f86a1=_0x1fb056[_0x9d57('0x6')][_0x469272][_0x9d57('0x31')];logger[_0x9d57('0x29')](_0x9d57('0x39'),_0x200c92,_0x595044);RpcUser['getAgent'](this[_0x9d57('0x7')][_0x595044]['id'])[_0x9d57('0x1c')](function(_0x479d72){if(_0x479d72[_0x9d57('0x3a')]===_0x9d57('0x23')){return RpcUser[_0x9d57('0x3b')](_0x1fb056[_0x9d57('0x7')][_0x595044]);}});RpcVoiceAgentReport[_0x9d57('0x3c')]({'acwtime':_0x3f86a1,'agentacw':!![]},_0x200c92,_0x595044)[_0x9d57('0x1c')](function(_0x5c0404){logger[_0x9d57('0x29')](_0x9d57('0x3d'),_0x200c92,_0x3f86a1,_0x5c0404);})[_0x9d57('0x1d')](function(_0x334e93){logger[_0x9d57('0x35')](_0x9d57('0x1e'),_0x200c92,_0x334e93);});}else{logger[_0x9d57('0x35')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x595044);if(_0x1fb056[_0x9d57('0x8')]){logger['info']('[ACW][TIMERS]',JSON[_0x9d57('0x3e')](_0x1fb056[_0x9d57('0x8')]));}}}catch(_0x26cf8e){logger[_0x9d57('0x35')](_0x9d57('0x3f'),_0x26cf8e[_0x9d57('0x37')]);}};Acw[_0x9d57('0x18')][_0x9d57('0xa')]=function(_0x595605){try{if(this[_0x9d57('0x6')][_0x595605['queue']]&&(this[_0x9d57('0x6')][_0x595605[_0x9d57('0x22')]][_0x9d57('0x3')]||this[_0x9d57('0x6')][_0x595605['queue']]['mandatoryDisposition'])){if(this[_0x9d57('0x7')][_0x595605[_0x9d57('0x21')]]){this[_0x9d57('0x9')][_0x595605['uniqueid']]={'queue':_0x595605[_0x9d57('0x22')],'interface':_0x595605[_0x9d57('0x21')],'destlinkedid':_0x595605[_0x9d57('0x2d')]};}}}catch(_0x1ef3b0){logger[_0x9d57('0x35')]('[ACW][syncAgentConnect]\x20%s',_0x1ef3b0[_0x9d57('0x37')]);}};Acw[_0x9d57('0x18')]['syncAgentConnectPreview']=function(_0x240f3a){try{if(this[_0x9d57('0x6')][_0x240f3a[_0x9d57('0x22')]]&&(this[_0x9d57('0x6')][_0x240f3a[_0x9d57('0x22')]][_0x9d57('0x3')]||this['voiceQueues'][_0x240f3a['queue']]['mandatoryDisposition'])){if(this[_0x9d57('0x7')][_0x240f3a['interface']]){this[_0x9d57('0x9')][_0x240f3a['uniqueid']]={'queue':_0x240f3a[_0x9d57('0x22')],'interface':_0x240f3a[_0x9d57('0x21')]};}}}catch(_0xc956de){logger['error'](_0x9d57('0x40'),_0xc956de[_0x9d57('0x37')]);}};Acw[_0x9d57('0x18')][_0x9d57('0xd')]=function(_0x5ea26d){try{if(this[_0x9d57('0x9')][_0x5ea26d[_0x9d57('0x1b')]]&&_[_0x9d57('0x41')](this[_0x9d57('0x9')][_0x5ea26d[_0x9d57('0x1b')]][_0x9d57('0x2c')])){logger[_0x9d57('0x29')]('[%s][HANGUP:UNIQUEID]',_0x5ea26d[_0x9d57('0x1b')]);this[_0x9d57('0x20')](_0x5ea26d[_0x9d57('0x1b')]);}else if(this[_0x9d57('0x9')][_0x5ea26d['linkedid']]&&_[_0x9d57('0x41')](this[_0x9d57('0x9')][_0x5ea26d[_0x9d57('0x42')]][_0x9d57('0x2c')])){logger[_0x9d57('0x29')](_0x9d57('0x43'),_0x5ea26d['linkedid']);this['startAcw'](_0x5ea26d[_0x9d57('0x42')]);}}catch(_0x54a1f1){logger['error']('[ACW][syncHangupRequest]\x20%s',_0x54a1f1[_0x9d57('0x37')]);}};Acw[_0x9d57('0x18')][_0x9d57('0xf')]=function(_0x129805){try{if(this['channels'][_0x129805['uniqueid']]&&this['channels'][_0x129805[_0x9d57('0x1b')]][_0x9d57('0x2c')]){logger[_0x9d57('0x29')](_0x9d57('0x44'),_0x129805[_0x9d57('0x1b')]);this['startAcw'](_0x129805[_0x9d57('0x1b')]);}else if(this[_0x9d57('0x9')][_0x129805[_0x9d57('0x42')]]&&this[_0x9d57('0x9')][_0x129805['linkedid']]['attended']){logger[_0x9d57('0x29')](_0x9d57('0x45'),_0x129805[_0x9d57('0x42')]);this[_0x9d57('0x20')](_0x129805[_0x9d57('0x42')]);}}catch(_0xb89d92){logger[_0x9d57('0x35')](_0x9d57('0x46'),_0xb89d92[_0x9d57('0x37')]);}};Acw[_0x9d57('0x18')][_0x9d57('0x13')]=function(_0x30cc2c){try{if(!_['isNil'](this['channels'][_0x30cc2c[_0x9d57('0x47')]])){this[_0x9d57('0x20')](_0x30cc2c[_0x9d57('0x47')]);if(this[_0x9d57('0x9')][_0x30cc2c[_0x9d57('0x48')]]){this[_0x9d57('0x9')][_0x30cc2c[_0x9d57('0x48')]][_0x9d57('0x2c')]=!![];this['channels'][_0x30cc2c[_0x9d57('0x49')]]=this[_0x9d57('0x9')][_0x30cc2c['secondtransfereruniqueid']];delete this[_0x9d57('0x9')][_0x30cc2c['secondtransfereruniqueid']];}}else if(!_[_0x9d57('0x4a')](this[_0x9d57('0x9')][_0x30cc2c[_0x9d57('0x49')]])){this[_0x9d57('0x20')](_0x30cc2c[_0x9d57('0x49')]);if(this[_0x9d57('0x9')][_0x30cc2c[_0x9d57('0x4b')]]){this[_0x9d57('0x9')][_0x30cc2c[_0x9d57('0x4b')]][_0x9d57('0x2c')]=!![];this[_0x9d57('0x9')][_0x30cc2c[_0x9d57('0x47')]]=this[_0x9d57('0x9')][_0x30cc2c['origtransfereruniqueid']];delete this['channels'][_0x30cc2c[_0x9d57('0x4b')]];}}}catch(_0x616ea2){logger[_0x9d57('0x35')]('[ACW][syncAttendedTransfer]\x20%s',_0x616ea2[_0x9d57('0x37')]);}};Acw['prototype']['syncBlindTransfer']=function(_0x5f529b){try{if(this[_0x9d57('0x9')][_0x5f529b[_0x9d57('0x4c')]]){logger[_0x9d57('0x29')](_0x9d57('0x4d'),JSON[_0x9d57('0x3e')](_0x5f529b[_0x9d57('0x4c')]));this[_0x9d57('0x20')](_0x5f529b[_0x9d57('0x4c')]);}else if(this[_0x9d57('0x9')][_0x5f529b[_0x9d57('0x4e')]]){logger[_0x9d57('0x29')](_0x9d57('0x4f'),JSON['stringify'](_0x5f529b[_0x9d57('0x4e')]));this['startAcw'](_0x5f529b['transfererlinkedid']);}}catch(_0xb10f31){logger[_0x9d57('0x35')](_0x9d57('0x50'),_0xb10f31[_0x9d57('0x37')]);}};Acw[_0x9d57('0x18')][_0x9d57('0x11')]=function(_0x1a60d7){try{if(this[_0x9d57('0x6')][_0x1a60d7[_0x9d57('0x22')]]&&this[_0x9d57('0x6')][_0x1a60d7['queue']][_0x9d57('0x51')]===_0x9d57('0x52')){if(this['agents'][_0x1a60d7[_0x9d57('0x21')]]){logger[_0x9d57('0x29')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x1a60d7[_0x9d57('0x1b')],_0x1a60d7[_0x9d57('0x21')],_0x1a60d7[_0x9d57('0x22')]);return RpcUser['savePause'](this['agents'][_0x1a60d7[_0x9d57('0x21')]],_0x9d57('0x53'),_0x1a60d7[_0x9d57('0x1b')]);}}}catch(_0x43fa88){logger[_0x9d57('0x35')](_0x9d57('0x54'),_0x43fa88[_0x9d57('0x37')]);}};module[_0x9d57('0x55')]=Acw; \ No newline at end of file +var _0xf822=['[ACW][START]\x20%s','message','prototype','queue','[%s][TIMER][STOP][AGENT:%s]','getAgent','pauseType','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','startAcw','linkedid','attended','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','updateAcw','lastPauseAt','timer','update','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','interface','channels','ACW','mandatoryDisposition','mandatoryDispositionPause','name','resolve','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','available','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw'];(function(_0x209c0f,_0x1129eb){var _0x447745=function(_0x3e0895){while(--_0x3e0895){_0x209c0f['push'](_0x209c0f['shift']());}};_0x447745(++_0x1129eb);}(_0xf822,0x81));var _0x2f82=function(_0x57e054,_0xf25910){_0x57e054=_0x57e054-0x0;var _0x3f53ca=_0xf822[_0x57e054];return _0x3f53ca;};'use strict';var _=require(_0x2f82('0x0'));var moment=require(_0x2f82('0x1'));var ami=require(_0x2f82('0x2'));var logger=require(_0x2f82('0x3'))(_0x2f82('0x4'));var RpcUser=require(_0x2f82('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x44c4d4){this[_0x2f82('0x6')]=_0x44c4d4[_0x2f82('0x6')];this[_0x2f82('0x7')]=_0x44c4d4[_0x2f82('0x7')];this[_0x2f82('0x8')]=_0x44c4d4[_0x2f82('0x8')];this['channels']={};ami['on'](_0x2f82('0x9'),this[_0x2f82('0xa')][_0x2f82('0xb')](this));ami['on'](_0x2f82('0xc'),this[_0x2f82('0xd')][_0x2f82('0xb')](this));ami['on'](_0x2f82('0xe'),this[_0x2f82('0xf')][_0x2f82('0xb')](this));ami['on'](_0x2f82('0x10'),this[_0x2f82('0x11')][_0x2f82('0xb')](this));ami['on'](_0x2f82('0x12'),this[_0x2f82('0x13')]['bind'](this));ami['on'](_0x2f82('0x14'),this[_0x2f82('0x15')]['bind'](this));ami['on']('custom:agentConnectPreview',this[_0x2f82('0x16')]['bind'](this));}function getDiff(_0x2219d1){var _0x4c197c=moment()[_0x2f82('0x17')](0x0);var _0x3218bc=moment(_0x2219d1)['milliseconds'](0x0);return _0x4c197c[_0x2f82('0x18')](_0x3218bc,_0x2f82('0x19'));}Acw['prototype'][_0x2f82('0x1a')]=function(_0x377213,_0x4a8453){var _0x3ff0c9=this;var _0x136d96=getDiff(_0x3ff0c9[_0x2f82('0x8')][_0x377213][_0x2f82('0x1b')]);clearTimeout(_0x3ff0c9['timers'][_0x377213]['timer']);_0x3ff0c9[_0x2f82('0x8')][_0x377213][_0x2f82('0x1c')]=![];return RpcVoiceAgentReport[_0x2f82('0x1d')]({'acwtime':_0x136d96},_0x3ff0c9[_0x2f82('0x8')][_0x377213][_0x2f82('0x1e')],_0x377213)[_0x2f82('0x1f')](function(_0x20f3de){logger[_0x2f82('0x20')](_0x2f82('0x21'),_0x4a8453,_0x136d96,_0x20f3de);})[_0x2f82('0x22')](function(_0x2bf5e0){logger[_0x2f82('0x23')](_0x2f82('0x24'),_0x4a8453,_0x2bf5e0);})[_0x2f82('0x25')](function(){delete _0x3ff0c9['timers'][_0x377213];});};Acw['prototype']['startAcw']=function(_0x4545c9){try{var _0x1de455=this;var _0x54b888=this['channels'][_0x4545c9][_0x2f82('0x26')];var _0x466b99=this[_0x2f82('0x27')][_0x4545c9]['queue'];var _0xc2a525=this[_0x2f82('0x6')][_0x466b99];var _0x161277=![];var _0x55e424=_0x2f82('0x28');if(_0xc2a525[_0x2f82('0x29')]&&_0xc2a525[_0x2f82('0x2a')][_0x2f82('0x2b')]){_0x161277=!![];_0x55e424=_0xc2a525['mandatoryDispositionPause'][_0x2f82('0x2b')];}if(!_0x1de455[_0x2f82('0x7')][_0x54b888]){return Promise[_0x2f82('0x2c')]();}return RpcUser['getAgent'](_0x1de455[_0x2f82('0x7')][_0x54b888]['id'])[_0x2f82('0x1f')](function(_0xcb5443){if(!_0xcb5443||_0xcb5443[_0x2f82('0x2d')]){logger['info'](_0x2f82('0x2e'),_0x4545c9,_0x54b888,_0x466b99);return;}logger[_0x2f82('0x20')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x4545c9,_0x54b888,_0x466b99);var _0x236f75=_0x1de455['channels'][_0x4545c9]['attended']&&_0x1de455[_0x2f82('0x27')][_0x4545c9][_0x2f82('0x2f')]?_0x1de455[_0x2f82('0x27')][_0x4545c9][_0x2f82('0x2f')]:_0x4545c9;return RpcUser[_0x2f82('0x30')](_0x1de455['agents'][_0x54b888],_0x55e424,_0x236f75)['then'](function(_0x15bb29){_0x1de455['voiceQueues'][_0x466b99][_0x2f82('0x31')]-=0x1;_0x1de455['voiceQueues'][_0x466b99]['paused']+=0x1;return _0x15bb29;});})['then'](function(_0x300adf){if(_0x161277||!_0x300adf){return;}_0x1de455[_0x2f82('0x8')][_0x54b888]={};logger['info'](_0x2f82('0x32'),_0x4545c9,_0x1de455['voiceQueues'][_0x466b99][_0x2f82('0x33')],_0x54b888,_0x466b99);_0x1de455[_0x2f82('0x8')][_0x54b888][_0x2f82('0x1c')]=setTimeout(_0x1de455[_0x2f82('0x34')][_0x2f82('0xb')](_0x1de455,_0x54b888),_0x1de455[_0x2f82('0x6')][_0x466b99][_0x2f82('0x33')]*0x3e8);_0x1de455[_0x2f82('0x8')][_0x54b888][_0x2f82('0x1b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1de455['timers'][_0x54b888][_0x2f82('0x1e')]=_0x4545c9;_0x1de455[_0x2f82('0x8')][_0x54b888]['queue']=_0x466b99;_0x1de455[_0x2f82('0x8')][_0x54b888][_0x2f82('0x1a')]=_0x1de455[_0x2f82('0x1a')][_0x2f82('0xb')](_0x1de455,_0x54b888,_0x4545c9);})[_0x2f82('0x22')](function(){logger[_0x2f82('0x23')](_0x2f82('0x32'),_0x4545c9,_0x1de455[_0x2f82('0x6')][_0x466b99][_0x2f82('0x33')],_0x54b888,_0x466b99);})[_0x2f82('0x25')](function(){delete _0x1de455[_0x2f82('0x27')][_0x4545c9];});}catch(_0x13435d){logger[_0x2f82('0x23')](_0x2f82('0x35'),_0x13435d[_0x2f82('0x36')]);}};Acw[_0x2f82('0x37')][_0x2f82('0x34')]=function(_0x342e64){try{var _0x4da2b7=this;if(_0x4da2b7[_0x2f82('0x8')][_0x342e64]){_0x4da2b7[_0x2f82('0x8')][_0x342e64][_0x2f82('0x1c')]=![];var _0x5e5b56=_0x4da2b7[_0x2f82('0x8')][_0x342e64]['uniqueid'];var _0x1572e8=_0x4da2b7['timers'][_0x342e64][_0x2f82('0x38')];var _0x5333d8=_0x4da2b7[_0x2f82('0x6')][_0x1572e8][_0x2f82('0x33')];logger['info'](_0x2f82('0x39'),_0x5e5b56,_0x342e64);RpcUser[_0x2f82('0x3a')](this[_0x2f82('0x7')][_0x342e64]['id'])[_0x2f82('0x1f')](function(_0x9bc581){if(_0x9bc581[_0x2f82('0x3b')]===_0x2f82('0x28')){return RpcUser[_0x2f82('0x3c')](_0x4da2b7['agents'][_0x342e64]);}});RpcVoiceAgentReport[_0x2f82('0x1d')]({'acwtime':_0x5333d8,'agentacw':!![]},_0x5e5b56,_0x342e64)[_0x2f82('0x1f')](function(_0x570e46){logger[_0x2f82('0x20')](_0x2f82('0x21'),_0x5e5b56,_0x5333d8,_0x570e46);})[_0x2f82('0x22')](function(_0x28e899){logger['error'](_0x2f82('0x24'),_0x5e5b56,_0x28e899);});}else{logger[_0x2f82('0x23')](_0x2f82('0x3d'),_0x342e64);if(_0x4da2b7[_0x2f82('0x8')]){logger[_0x2f82('0x20')](_0x2f82('0x3e'),JSON[_0x2f82('0x3f')](_0x4da2b7['timers']));}}}catch(_0x9c4776){logger[_0x2f82('0x23')](_0x2f82('0x40'),_0x9c4776['message']);}};Acw[_0x2f82('0x37')][_0x2f82('0xa')]=function(_0x50206c){try{if(this[_0x2f82('0x6')][_0x50206c[_0x2f82('0x38')]]&&(this[_0x2f82('0x6')][_0x50206c['queue']][_0x2f82('0x4')]||this[_0x2f82('0x6')][_0x50206c[_0x2f82('0x38')]][_0x2f82('0x29')])){if(this[_0x2f82('0x7')][_0x50206c[_0x2f82('0x26')]]){this[_0x2f82('0x27')][_0x50206c[_0x2f82('0x1e')]]={'queue':_0x50206c[_0x2f82('0x38')],'interface':_0x50206c[_0x2f82('0x26')],'destlinkedid':_0x50206c[_0x2f82('0x2f')]};}}}catch(_0x565c20){logger['error']('[ACW][syncAgentConnect]\x20%s',_0x565c20['message']);}};Acw[_0x2f82('0x37')][_0x2f82('0x16')]=function(_0x375d4b){try{if(this[_0x2f82('0x6')][_0x375d4b[_0x2f82('0x38')]]&&(this[_0x2f82('0x6')][_0x375d4b[_0x2f82('0x38')]][_0x2f82('0x4')]||this[_0x2f82('0x6')][_0x375d4b[_0x2f82('0x38')]][_0x2f82('0x29')])){if(this['agents'][_0x375d4b[_0x2f82('0x26')]]){this[_0x2f82('0x27')][_0x375d4b['uniqueid']]={'queue':_0x375d4b[_0x2f82('0x38')],'interface':_0x375d4b['interface']};}}}catch(_0x3350e0){logger[_0x2f82('0x23')](_0x2f82('0x41'),_0x3350e0[_0x2f82('0x36')]);}};Acw[_0x2f82('0x37')][_0x2f82('0xd')]=function(_0x97ab89){try{if(this['channels'][_0x97ab89['uniqueid']]&&_[_0x2f82('0x42')](this['channels'][_0x97ab89[_0x2f82('0x1e')]]['attended'])){logger[_0x2f82('0x20')]('[%s][HANGUP:UNIQUEID]',_0x97ab89[_0x2f82('0x1e')]);this[_0x2f82('0x43')](_0x97ab89[_0x2f82('0x1e')]);}else if(this[_0x2f82('0x27')][_0x97ab89[_0x2f82('0x44')]]&&_[_0x2f82('0x42')](this[_0x2f82('0x27')][_0x97ab89[_0x2f82('0x44')]][_0x2f82('0x45')])){logger['info'](_0x2f82('0x46'),_0x97ab89[_0x2f82('0x44')]);this[_0x2f82('0x43')](_0x97ab89[_0x2f82('0x44')]);}}catch(_0x590f68){logger[_0x2f82('0x23')](_0x2f82('0x47'),_0x590f68[_0x2f82('0x36')]);}};Acw[_0x2f82('0x37')][_0x2f82('0xf')]=function(_0x354a96){try{if(this[_0x2f82('0x27')][_0x354a96[_0x2f82('0x1e')]]&&this[_0x2f82('0x27')][_0x354a96[_0x2f82('0x1e')]][_0x2f82('0x45')]){logger[_0x2f82('0x20')](_0x2f82('0x48'),_0x354a96[_0x2f82('0x1e')]);this[_0x2f82('0x43')](_0x354a96[_0x2f82('0x1e')]);}else if(this['channels'][_0x354a96['linkedid']]&&this[_0x2f82('0x27')][_0x354a96['linkedid']]['attended']){logger[_0x2f82('0x20')](_0x2f82('0x49'),_0x354a96[_0x2f82('0x44')]);this[_0x2f82('0x43')](_0x354a96[_0x2f82('0x44')]);}}catch(_0x25ca57){logger[_0x2f82('0x23')]('[ACW][syncHangup]\x20%s',_0x25ca57['message']);}};Acw['prototype'][_0x2f82('0x13')]=function(_0xfe4b0c){try{if(!_['isNil'](this[_0x2f82('0x27')][_0xfe4b0c['transfereeuniqueid']])){this[_0x2f82('0x43')](_0xfe4b0c[_0x2f82('0x4a')]);if(this[_0x2f82('0x27')][_0xfe4b0c[_0x2f82('0x4b')]]){this[_0x2f82('0x27')][_0xfe4b0c[_0x2f82('0x4b')]][_0x2f82('0x45')]=!![];this[_0x2f82('0x27')][_0xfe4b0c[_0x2f82('0x4c')]]=this[_0x2f82('0x27')][_0xfe4b0c[_0x2f82('0x4b')]];delete this['channels'][_0xfe4b0c[_0x2f82('0x4b')]];}}else if(!_[_0x2f82('0x4d')](this['channels'][_0xfe4b0c[_0x2f82('0x4c')]])){this[_0x2f82('0x43')](_0xfe4b0c['transfertargetuniqueid']);if(this[_0x2f82('0x27')][_0xfe4b0c[_0x2f82('0x4e')]]){this['channels'][_0xfe4b0c[_0x2f82('0x4e')]][_0x2f82('0x45')]=!![];this[_0x2f82('0x27')][_0xfe4b0c[_0x2f82('0x4a')]]=this[_0x2f82('0x27')][_0xfe4b0c[_0x2f82('0x4e')]];delete this[_0x2f82('0x27')][_0xfe4b0c['origtransfereruniqueid']];}}}catch(_0xdb70c8){logger['error'](_0x2f82('0x4f'),_0xdb70c8[_0x2f82('0x36')]);}};Acw[_0x2f82('0x37')][_0x2f82('0x15')]=function(_0x19fbb3){try{if(this[_0x2f82('0x27')][_0x19fbb3['transfereruniqueid']]){logger[_0x2f82('0x20')](_0x2f82('0x50'),JSON[_0x2f82('0x3f')](_0x19fbb3['transfereruniqueid']));this[_0x2f82('0x43')](_0x19fbb3[_0x2f82('0x51')]);}else if(this[_0x2f82('0x27')][_0x19fbb3[_0x2f82('0x52')]]){logger['info'](_0x2f82('0x53'),JSON[_0x2f82('0x3f')](_0x19fbb3[_0x2f82('0x52')]));this['startAcw'](_0x19fbb3[_0x2f82('0x52')]);}}catch(_0x15dbec){logger[_0x2f82('0x23')](_0x2f82('0x54'),_0x15dbec[_0x2f82('0x36')]);}};Acw[_0x2f82('0x37')][_0x2f82('0x11')]=function(_0x21935f){try{if(this['voiceQueues'][_0x21935f[_0x2f82('0x38')]]&&this[_0x2f82('0x6')][_0x21935f[_0x2f82('0x38')]][_0x2f82('0x55')]===_0x2f82('0x56')){if(this[_0x2f82('0x7')][_0x21935f[_0x2f82('0x26')]]){logger['info'](_0x2f82('0x57'),_0x21935f[_0x2f82('0x1e')],_0x21935f[_0x2f82('0x26')],_0x21935f[_0x2f82('0x38')]);return RpcUser[_0x2f82('0x30')](this[_0x2f82('0x7')][_0x21935f['interface']],_0x2f82('0x58'),_0x21935f['uniqueid']);}}}catch(_0x1bbd0e){logger['error'](_0x2f82('0x59'),_0x1bbd0e[_0x2f82('0x36')]);}};module[_0x2f82('0x5a')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 92cea0e..3776b33 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 _0x35da=['format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','actionSipShowRegistry','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','resolve','then','catch','exports','asterisk-manager','bluebird','util','../../config/environment','asterisk','port','password','keepConnected','promisify','action','error'];(function(_0x52ebba,_0x57b37c){var _0x198068=function(_0x285d96){while(--_0x285d96){_0x52ebba['push'](_0x52ebba['shift']());}};_0x198068(++_0x57b37c);}(_0x35da,0x181));var _0xa35d=function(_0x38ed26,_0x251529){_0x38ed26=_0x38ed26-0x0;var _0x5cc237=_0x35da[_0x38ed26];return _0x5cc237;};'use strict';var Manager=require(_0xa35d('0x0'));var BPromise=require(_0xa35d('0x1'));var util=require(_0xa35d('0x2'));var logger=require('../../config/logger')('ami');var config=require(_0xa35d('0x3'));var ami=new Manager(config[_0xa35d('0x4')][_0xa35d('0x5')],config[_0xa35d('0x4')]['ip'],config['asterisk']['username'],config[_0xa35d('0x4')][_0xa35d('0x6')],!![]);ami[_0xa35d('0x7')]();ami['Action']=BPromise[_0xa35d('0x8')](ami[_0xa35d('0x9')]);function error(_0x2a9092){logger[_0xa35d('0xa')](util[_0xa35d('0xb')](_0xa35d('0xc'),config[_0xa35d('0x4')][_0xa35d('0xd')],config['asterisk']['ip'],config['asterisk']['port'],util[_0xa35d('0xe')](_0x2a9092,![],null)));}function close(){logger[_0xa35d('0xa')](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xa35d('0x4')][_0xa35d('0xd')],config['asterisk']['ip'],config[_0xa35d('0x4')]['port']));}ami[_0xa35d('0xf')]=function(){return function(){return ami[_0xa35d('0x10')]({'action':_0xa35d('0x11')});};};ami[_0xa35d('0x12')]=function(){return function(){return ami['Action']({'action':_0xa35d('0x13')});};};ami[_0xa35d('0x14')]=function(){return function(){return ami[_0xa35d('0x10')]({'action':_0xa35d('0x15')});};};ami[_0xa35d('0x16')]=function(){return function(){return ami[_0xa35d('0x10')]({'action':_0xa35d('0x17')});};};ami[_0xa35d('0x18')]=function(){return function(){return ami[_0xa35d('0x10')]({'action':_0xa35d('0x19')});};};function connect(){logger['info'](util[_0xa35d('0xb')](_0xa35d('0x1a'),config[_0xa35d('0x4')]['username'],config[_0xa35d('0x4')]['ip'],config['asterisk']['port']));ami[_0xa35d('0x1b')]('error',error);ami[_0xa35d('0x1b')](_0xa35d('0x1c'),close);}ami['on']('connect',connect);ami['on'](_0xa35d('0x1d'),function(_0x566922){logger['info'](util[_0xa35d('0xb')](_0xa35d('0x1e'),config[_0xa35d('0x4')][_0xa35d('0xd')],config[_0xa35d('0x4')]['ip'],config['asterisk'][_0xa35d('0x5')],util[_0xa35d('0xe')](_0x566922,![],null)));});ami['on'](_0xa35d('0x1f'),function(){logger['info'](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xa35d('0x4')][_0xa35d('0xd')],config[_0xa35d('0x4')]['ip'],config[_0xa35d('0x4')][_0xa35d('0x5')]));return Promise[_0xa35d('0x20')]()[_0xa35d('0x21')](ami[_0xa35d('0xf')]())['then'](ami[_0xa35d('0x12')]())[_0xa35d('0x21')](ami[_0xa35d('0x14')]())[_0xa35d('0x21')](ami[_0xa35d('0x16')]())[_0xa35d('0x21')](ami[_0xa35d('0x18')]())[_0xa35d('0x22')](function(_0x5d07da){logger['error']('[ami.js][fullybooted]',util[_0xa35d('0xe')](_0x5d07da,{'showHidden':![],'depth':null}));});});ami[_0xa35d('0x1b')](_0xa35d('0xa'),error);ami[_0xa35d('0x1b')](_0xa35d('0x1c'),close);module[_0xa35d('0x23')]=ami; \ No newline at end of file +var _0xd7a4=['Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','error','shutdown','inspect','info','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','[ami.js][fullybooted]','close','exports','asterisk-manager','bluebird','util','../../config/logger','ami','../../config/environment','port','asterisk','keepConnected','Action','promisify','action'];(function(_0x5742c4,_0x5d94fc){var _0x3eecc9=function(_0x1a8a56){while(--_0x1a8a56){_0x5742c4['push'](_0x5742c4['shift']());}};_0x3eecc9(++_0x5d94fc);}(_0xd7a4,0x1e2));var _0x4d7a=function(_0x5ae21e,_0x5dc8fd){_0x5ae21e=_0x5ae21e-0x0;var _0x6cacfe=_0xd7a4[_0x5ae21e];return _0x6cacfe;};'use strict';var Manager=require(_0x4d7a('0x0'));var BPromise=require(_0x4d7a('0x1'));var util=require(_0x4d7a('0x2'));var logger=require(_0x4d7a('0x3'))(_0x4d7a('0x4'));var config=require(_0x4d7a('0x5'));var ami=new Manager(config['asterisk'][_0x4d7a('0x6')],config['asterisk']['ip'],config[_0x4d7a('0x7')]['username'],config[_0x4d7a('0x7')]['password'],!![]);ami[_0x4d7a('0x8')]();ami[_0x4d7a('0x9')]=BPromise[_0x4d7a('0xa')](ami[_0x4d7a('0xb')]);function error(_0x47912e){logger['error'](util['format'](_0x4d7a('0xc'),config[_0x4d7a('0x7')][_0x4d7a('0xd')],config['asterisk']['ip'],config[_0x4d7a('0x7')][_0x4d7a('0x6')],util['inspect'](_0x47912e,![],null)));}function close(){logger['error'](util[_0x4d7a('0xe')](_0x4d7a('0xf'),config[_0x4d7a('0x7')][_0x4d7a('0xd')],config[_0x4d7a('0x7')]['ip'],config[_0x4d7a('0x7')][_0x4d7a('0x6')]));}ami[_0x4d7a('0x10')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0x4d7a('0x11')]=function(){return function(){return ami['Action']({'action':_0x4d7a('0x12')});};};ami[_0x4d7a('0x13')]=function(){return function(){return ami[_0x4d7a('0x9')]({'action':_0x4d7a('0x14')});};};ami[_0x4d7a('0x15')]=function(){return function(){return ami['Action']({'action':_0x4d7a('0x16')});};};ami[_0x4d7a('0x17')]=function(){return function(){return ami['Action']({'action':_0x4d7a('0x18')});};};function connect(){logger['info'](util['format'](_0x4d7a('0x19'),config[_0x4d7a('0x7')][_0x4d7a('0xd')],config[_0x4d7a('0x7')]['ip'],config[_0x4d7a('0x7')][_0x4d7a('0x6')]));ami[_0x4d7a('0x1a')](_0x4d7a('0x1b'),error);ami[_0x4d7a('0x1a')]('close',close);}ami['on']('connect',connect);ami['on'](_0x4d7a('0x1c'),function(_0x454132){logger['info'](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x4d7a('0x7')][_0x4d7a('0xd')],config[_0x4d7a('0x7')]['ip'],config[_0x4d7a('0x7')][_0x4d7a('0x6')],util[_0x4d7a('0x1d')](_0x454132,![],null)));});ami['on']('fullybooted',function(){logger[_0x4d7a('0x1e')](util['format'](_0x4d7a('0x1f'),config[_0x4d7a('0x7')][_0x4d7a('0xd')],config[_0x4d7a('0x7')]['ip'],config[_0x4d7a('0x7')]['port']));return Promise[_0x4d7a('0x20')]()['then'](ami['actionSipShowRegistry']())[_0x4d7a('0x21')](ami[_0x4d7a('0x11')]())[_0x4d7a('0x21')](ami[_0x4d7a('0x13')]())[_0x4d7a('0x21')](ami[_0x4d7a('0x15')]())[_0x4d7a('0x21')](ami[_0x4d7a('0x17')]())[_0x4d7a('0x22')](function(_0x219bcf){logger['error'](_0x4d7a('0x23'),util[_0x4d7a('0x1d')](_0x219bcf,{'showHidden':![],'depth':null}));});});ami[_0x4d7a('0x1a')](_0x4d7a('0x1b'),error);ami['once'](_0x4d7a('0x24'),close);module[_0x4d7a('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 3c5fcb8..7130a60 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 _0xf4eb=['rpc','error','message','result','exports','jayson/promise','http','request','then','debug','memberReport'];(function(_0x18f3bf,_0x2f81f0){var _0x88488a=function(_0x501968){while(--_0x501968){_0x18f3bf['push'](_0x18f3bf['shift']());}};_0x88488a(++_0x2f81f0);}(_0xf4eb,0xec));var _0xbf4e=function(_0x473862,_0x2125be){_0x473862=_0x473862-0x0;var _0x50d976=_0xf4eb[_0x473862];return _0x50d976;};'use strict';var jayson=require(_0xbf4e('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('ami');var client=jayson['client'][_0xbf4e('0x1')]({'port':0x2329});client['Request']=function(_0x4e7fa7,_0x2e3070){return new BPromise(function(_0x1c7606,_0x32d1d7){return client[_0xbf4e('0x2')](_0x4e7fa7,_0x2e3070)[_0xbf4e('0x3')](function(_0x2fcfed){logger[_0xbf4e('0x4')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x2e3070,_0x2fcfed);if(_0x2fcfed['error']){logger['error'](_0xbf4e('0x6'),_0xbf4e('0x5'),_0x4e7fa7,_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')],_0x2e3070);return _0x32d1d7(_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')]);}else{return _0x1c7606(_0x2fcfed[_0xbf4e('0x9')]);}})['catch'](function(_0x4d9a07){logger[_0xbf4e('0x7')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x4d9a07,_0x2e3070);return _0x32d1d7(_0x4d9a07);});});};module[_0xbf4e('0xa')]=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(_0xe3e0af,_0x4564ed){var _0x4828e9=function(_0x55c7a7){while(--_0x55c7a7){_0xe3e0af['push'](_0xe3e0af['shift']());}};_0x4828e9(++_0x4564ed);}(_0xe706,0xa3));var _0x6e70=function(_0x3cf7df,_0x43b053){_0x3cf7df=_0x3cf7df-0x0;var _0x52ca51=_0xe706[_0x3cf7df];return _0x52ca51;};'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 0546f0d..350f4c2 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 _0xc13c=['response','Success','callProgressDetecting','variable','amdstatus','exten','xcally-motion-dialer','outboundAnswerAgiCallsDay','HangupInAMD','membername','custom:amd','buildObj','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','value','MACHINE','Machine','countmachineretry','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','HANGUP','[syncHangupInAMDIvr]','AMD','countnosuchnumberretry','reason19\x20machine....','dialMachineMaxRetry','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','moveContactManagedDialer','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','cause-txt','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','inUse','talking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','assign','filter','dialPreviewRecallmeReminder','online','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','enqueue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','handlePreviewRecallNotifications','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','XMD-AMDINITIALSILENCE','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','setXMDContactVariables','Contact','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','TrunkBackup','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originate][error]','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','busy','dialBusyMaxRetry','outboundCongestionCallsDay','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','dialAbandonedRetryFrequency','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','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]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','predictiveIntervalErlangCallsDroppedCalls','dropRate','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','avgHandleTime','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','predictiveIntervalAvailable','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','loggedIn','predictiveIntervalDroppedCallsTimeout','predictiveIntervalPauses','outboundQueuePauses','[CatchErlangB]','erlangCallToSecond','one\x20call\x20every:','milliseconds','[handlePredictive]','checkContactBlack','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','limitCalls','getContactDialerIvr','checkContactEmpty','NO_AVAILABLE_CONTACTS','RUNNING','loggerHandler','[actionOriginateIvr]\x20','available','dialLimitQueue','not_inuse','countReScheduled','[actionOriginate]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','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','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','[abandonmentRate]','p\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','Ts\x20=\x20','interval\x20=\x20','lodash','uuid','moment','ioredis','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/interval','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','XCALLY_IP_AGI','127.0.0.1','prototype','tail','sequence','preview','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','queuesSummary','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','syncAgentComplete','syncQueueSummary','custom:queuesummarycomplete','syncQueueSummaryComplete','syncHangup','newexten','syncNewExten','queuemember','syncQueueMember','loopCampaigns','loopClearZombieChannels','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','inspect','format','voice:queue:%s','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','predictiveIntervalTotalCalls','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','erlangBusyFactor','merge','getSeconds','startProgressive','name','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','temp','contactsRescheduled','message','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','CAMPAIGN_STATUS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','stringify','pick','Interval','\x20INTERVAL_IS_NULL','Intervals','NULL_INTERVAL','INACTIVE','\x20NOT\x20Active','isIVRCampaign','sendMessageOneNotActive','is\x20not\x20active','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','reachable','status','unmonitored','checkIsTrunkReachable','Trunk','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTimeIvr','checkIfTimeIntervals','Failure','ifTime','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','interval','then','content','catch','iftime\x20%s,%s','indexOf','true','all','some','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','isIVRCampaignActive','resolve','dialGlobalInterval','dialTimezone','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','method\x20not\x20recognized','silly','intervalIftime','OVERTIME_GLOBAL_INTERVAL','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','voiceQueues','uniqueid','ivr','updateOriginated','YYYY-MM-DD\x20HH:mm:ss','queue','outboundAnswerCallsDay','agiafterat','dialQueueProject2','createHistory','[syncAgentComplete][createHistory]','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','countdropretry','callAdditionalPhoneAfterMin','voiceQueue','dialDropMaxRetry','queueCallerAbandonCreateState','additional','add','dialDropRetryFrequency','minutes','ContactId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','Abandoned','CALLEREXIT','countglobal','dialAbandonedMaxRetry','rescheduleContact','countabandonedretry','ListId','actions','channel','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','stateinterface','queueBooked','idHopper','run','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','finally','[booked][RR][finaly]','VoiceQueueId','[unlock3][syncQueueStatusComplete]','getQueue'];(function(_0x231037,_0x1de3a7){var _0x3b6654=function(_0x592f94){while(--_0x592f94){_0x231037['push'](_0x231037['shift']());}};_0x3b6654(++_0x1de3a7);}(_0xc13c,0x113));var _0xcc13=function(_0x28912c,_0x217d87){_0x28912c=_0x28912c-0x0;var _0xc1d854=_0xc13c[_0x28912c];return _0xc1d854;};'use strict';var util=require('util');var _=require(_0xcc13('0x0'));var uuid=require(_0xcc13('0x1'));var moment=require(_0xcc13('0x2'));var rr=require('rr');var Redis=require(_0xcc13('0x3'));var utils=require('./utils');var hopperUtils=require(_0xcc13('0x4'));var ut=require(_0xcc13('0x5'));var config=require(_0xcc13('0x6'));var logger=require(_0xcc13('0x7'))('dialer');var loggerBooked=require(_0xcc13('0x7'))(_0xcc13('0x8'));var loggerPredictive=require(_0xcc13('0x7'))(_0xcc13('0x9'));var loggerPredictiveCalls=require(_0xcc13('0x7'))(_0xcc13('0xa'));var loggerSyncQueueSummary=require(_0xcc13('0x7'))('syncQueueSummary');var ami=require(_0xcc13('0xb'));config[_0xcc13('0xc')]=_[_0xcc13('0xd')](config[_0xcc13('0xc')],{'host':_0xcc13('0xe'),'port':0x18eb});var io=require(_0xcc13('0xf'))(new Redis(config['redis']));var cmHopper=require(_0xcc13('0x10'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require('../rpc/setting');var Interval=require(_0xcc13('0x11'));var Action=require('./models/action');var History=require('./models/history');var Final=require(_0xcc13('0x12'));var AgentComplete=require(_0xcc13('0x13'));var QueueCallerAbandon=require(_0xcc13('0x14'));var Hangup=require(_0xcc13('0x15'));var ipAgi=process['env'][_0xcc13('0x16')]||_0xcc13('0x17');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xcc13('0x18')]['enqueue']=function(_0x1e97a7){this[_0xcc13('0x19')]=this['tail']?this[_0xcc13('0x19')]['finally'](_0x1e97a7):_0x1e97a7();};function Dialer(_0x339fd2,_0x553ee0){this[_0xcc13('0x1a')]=new Sequence();this[_0xcc13('0x1b')]=_0x553ee0;this['voiceQueues']=_0x339fd2['voiceQueues'];this[_0xcc13('0x1c')]=_0x339fd2[_0xcc13('0x1c')];this[_0xcc13('0x1d')]=_0x339fd2[_0xcc13('0x1d')];this['trunks']=_0x339fd2[_0xcc13('0x1e')];this['maxNumberOriginate']=config[_0xcc13('0x1f')]||0x2;this[_0xcc13('0x20')]={};this['actions']={};this[_0xcc13('0x21')]={};this[_0xcc13('0x22')]={};this[_0xcc13('0x23')]={};this[_0xcc13('0x24')]={};this['startProgressive']={};this['ivrOriginated']={};this['queueBooked']={};this['queueBookedRR']={};this[_0xcc13('0x25')]={};ami['on']('agentconnect',this[_0xcc13('0x26')][_0xcc13('0x27')](this));ami['on'](_0xcc13('0x28'),this[_0xcc13('0x29')][_0xcc13('0x27')](this));ami['on']('originateresponse',this[_0xcc13('0x2a')][_0xcc13('0x27')](this));ami['on'](_0xcc13('0x2b'),this[_0xcc13('0x2c')][_0xcc13('0x27')](this));ami['on']('custom:queuesummary',this[_0xcc13('0x2d')][_0xcc13('0x27')](this));ami['on'](_0xcc13('0x2e'),this[_0xcc13('0x2f')][_0xcc13('0x27')](this));ami['on']('hangup',this[_0xcc13('0x30')][_0xcc13('0x27')](this));ami['on'](_0xcc13('0x31'),this[_0xcc13('0x32')][_0xcc13('0x27')](this));ami['on']('varset',this['syncVarSet'][_0xcc13('0x27')](this));ami['on'](_0xcc13('0x33'),this[_0xcc13('0x34')]['bind'](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete'][_0xcc13('0x27')](this));this[_0xcc13('0x35')]();this[_0xcc13('0x36')]();RpcSetting['getSettings']()['then'](function(_0x3e55ac){previewRecallmeReminderInterval=_0x3e55ac[_0xcc13('0x37')];});}function isNotNull(_0x94e9b6){return _0x94e9b6!==null&&!_[_0xcc13('0x38')](_0x94e9b6);}function msgResponse(_0x437873,_0x2292fa,_0x168366){return{'action':_0x437873,'response':_0x2292fa,'message':_0x168366,'stack':_0x168366};}function emit(_0x2a007a,_0xaf7a9f,_0x446129){io['to'](_0x2a007a)[_0xcc13('0x39')](_0xaf7a9f,_0x446129);}function emitOutboundVoiceQueueSummary(_0x3ea70e){if(_0x3ea70e[_0xcc13('0x3a')]===_0xcc13('0x3b')){logger[_0xcc13('0x3c')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0xcc13('0x3d')](_0x3ea70e,{'showHidden':![],'depth':null}));emit(util[_0xcc13('0x3e')](_0xcc13('0x3f'),_0x3ea70e['name']),_0xcc13('0x40'),_0x3ea70e);}}function checkGetDataPredictive(_0x28553f){if(isNotNull(_0x28553f)&&!_[_0xcc13('0x41')](_0x28553f)){loggerPredictive[_0xcc13('0x42')](_0xcc13('0x43'));loggerPredictive[_0xcc13('0x42')](_0xcc13('0x44'),_0x28553f['predictiveIntervalTotalCalls']);loggerPredictive[_0xcc13('0x42')](_0xcc13('0x45'),_0x28553f[_0xcc13('0x46')]);loggerPredictive[_0xcc13('0x42')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x28553f['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0xcc13('0x42')](_0xcc13('0x47'),_0x28553f['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xcc13('0x42')](_0xcc13('0x48'),_0x28553f[_0xcc13('0x49')]);loggerPredictive['info'](_0xcc13('0x4a'),_0x28553f[_0xcc13('0x4b')]);loggerPredictive[_0xcc13('0x42')](_0xcc13('0x4c'));if(_0x28553f[_0xcc13('0x4d')]>0x0){if(!_[_0xcc13('0x38')](_0x28553f['predictiveIntervalAvgTalktime'])&&_0x28553f[_0xcc13('0x4b')]>0x0){return!![];}loggerPredictive[_0xcc13('0x42')](_0xcc13('0x4e'));if(!_['isUndefined'](_0x28553f[_0xcc13('0x49')])&&_0x28553f[_0xcc13('0x49')]>0x0){return!![];}loggerPredictive[_0xcc13('0x42')](_0xcc13('0x4f'));}else{loggerPredictive[_0xcc13('0x42')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info'](_0xcc13('0x50'));}return![];}function mergeDataErlangB(_0x53fa9e){return function(_0x3ac8ec){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive[_0xcc13('0x42')](_0xcc13('0x51'),_0x3ac8ec[_0xcc13('0x52')]);loggerPredictive[_0xcc13('0x42')](_0xcc13('0x53'),_0x3ac8ec['erlangCallToSecond']);loggerPredictive[_0xcc13('0x42')](_0xcc13('0x54'),_0x3ac8ec[_0xcc13('0x55')]);loggerPredictive[_0xcc13('0x42')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3ac8ec[_0xcc13('0x56')]);loggerPredictive[_0xcc13('0x42')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3ac8ec['erlangAbandonmentRate']);loggerPredictive['info']('---------------------------');_[_0xcc13('0x57')](_0x53fa9e,_0x3ac8ec);};}function ifInterval(_0x469621,_0x481eb4){if(_[_0xcc13('0x38')](_0x481eb4)){return![];}return utils[_0xcc13('0x58')](undefined,_0x481eb4)<_0x469621*0x3c;}function clearPredictiveAttributes(_0x5d50f3){if(_0x5d50f3[_0xcc13('0x59')]){_0x5d50f3[_0xcc13('0x59')]=undefined;loggerPredictive['debug'](_0x5d50f3[_0xcc13('0x5a')],_0xcc13('0x5b'));}if(_0x5d50f3['startPredictive']){_0x5d50f3[_0xcc13('0x24')]=undefined;loggerPredictive[_0xcc13('0x3c')](_0x5d50f3[_0xcc13('0x5a')],_0xcc13('0x5c'));}if(_0x5d50f3[_0xcc13('0x5d')]){clearInterval(_0x5d50f3['handlePredictive']);_0x5d50f3[_0xcc13('0x5d')]=undefined;loggerPredictive[_0xcc13('0x3c')](_0x5d50f3['name'],_0xcc13('0x5e'));}}function loggerCatchPredictive(_0x51651d,_0x11686a){return function(_0x6e116d){loggerPredictive[_0xcc13('0x5f')](_0x11686a[_0xcc13('0x5a')],_0x51651d);loggerPredictive[_0xcc13('0x5f')](_0x6e116d[_0xcc13('0x60')]);clearPredictiveAttributes(_0x11686a);};}function loggerCatch(_0x38adf3){return function(_0x1f23ab){logger[_0xcc13('0x5f')](_0x38adf3,util[_0xcc13('0x3d')](_0x1f23ab,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x4d9412,_0xbdfcb9,_0x162796){return function(_0x577e38){utils[_0xcc13('0x61')](_0xbdfcb9,_0x162796,0x0);_0xbdfcb9[_0xcc13('0x62')]=0x0;logger[_0xcc13('0x5f')](_0x4d9412,util['inspect'](_0x577e38,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3dcb00){return function(_0x223f27){if(isNotNull(_0x223f27)&&isNotNull(_0x223f27[0x0])){if(_0x223f27[0x0][_0xcc13('0x63')]>0x0){_0x3dcb00[_0xcc13('0x64')]=utils['CAMPAIGN_STATUS'][_0xcc13('0x65')];logger[_0xcc13('0x42')](_0xcc13('0x66')+_0x3dcb00[_0xcc13('0x5a')],_0x223f27[0x0][_0xcc13('0x63')],_0xcc13('0x67'));}else{_0x3dcb00[_0xcc13('0x64')]=utils[_0xcc13('0x68')]['NO_AVAILABLE_CONTACTS'];logger[_0xcc13('0x42')](_0xcc13('0x69')+_0x3dcb00[_0xcc13('0x5a')]);}}};}function createObjHistory(_0x3a093a,_0x363762,_0x4db140,_0x59fe31,_0x95471c){_0x3a093a[_0xcc13('0x64')]=_0x4db140;var _0x43f44e=new Action(_0x3a093a,_0x363762);var _0x18c186=new History(_0x43f44e);_0x18c186[_0xcc13('0x6a')]=_0x59fe31;_0x18c186[_0xcc13('0x6b')]=_0x95471c;_0x18c186[_0xcc13('0x6c')]=_0x43f44e[_0xcc13('0x6d')];return _0x18c186;}function unlockQueueStatus(_0x43ee21,_0x1374c6){setTimeout(function(){if(_['isUndefined'](_0x43ee21[_0xcc13('0x6e')])){loggerBooked[_0xcc13('0x5f')](_0xcc13('0x6f'),_0x1374c6);}_0x43ee21[_0xcc13('0x6e')]=!![];loggerBooked[_0xcc13('0x42')]('[booked][unlockQueueStatus]',_0x1374c6,JSON[_0xcc13('0x70')](_[_0xcc13('0x71')](_0x43ee21,['name',_0xcc13('0x6e')])));},0x1f3);}function checkInterval(_0x153319){return function(){if(!isNotNull(_0x153319[_0xcc13('0x72')])){_0x153319[_0xcc13('0x64')]=utils[_0xcc13('0x68')]['NULL_INTERVAL'];throw _0x153319[_0xcc13('0x5a')]+_0xcc13('0x73');}if(!isNotNull(_0x153319[_0xcc13('0x72')][_0xcc13('0x74')])){_0x153319['message']=utils[_0xcc13('0x68')][_0xcc13('0x75')];throw _0x153319[_0xcc13('0x5a')]+_0xcc13('0x73');}if(!isNotNull(_[_0xcc13('0x41')](_0x153319[_0xcc13('0x72')][_0xcc13('0x74')]))){_0x153319[_0xcc13('0x64')]=utils[_0xcc13('0x68')][_0xcc13('0x75')];throw _0x153319[_0xcc13('0x5a')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x1a7b7b){return function(){if(!utils['isIVRCampaignActive'](_0x1a7b7b)){_0x1a7b7b[_0xcc13('0x64')]=utils[_0xcc13('0x68')][_0xcc13('0x76')];throw _0x1a7b7b[_0xcc13('0x5a')]+_0xcc13('0x77');}};}function emitCampaignSummary(_0x315f6c){if(utils[_0xcc13('0x78')](_0x315f6c)){emit(util['format']('campaign:ivr:%s',_0x315f6c['name']),'campaign:save',_0x315f6c);}}function loggerCatchQueueSummary(_0x2680ab,_0x3b1578){return function(_0x1edf9c){clearPredictiveAttributes(_0x3b1578);emitCampaignSummary(_0x3b1578);loggerSyncQueueSummary[_0xcc13('0x3c')](_0x2680ab,util['inspect'](_0x1edf9c,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x38c920){if(_0x38c920['sendMessageOneNotActive']){if(_0x38c920['originated']===0x0){_0x38c920[_0xcc13('0x79')]=![];_0x38c920[_0xcc13('0x64')]=utils[_0xcc13('0x68')][_0xcc13('0x76')];loggerSyncQueueSummary[_0xcc13('0x3c')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x38c920[_0xcc13('0x5a')],_0xcc13('0x7a'));}else{_0x38c920[_0xcc13('0x64')]=utils['CAMPAIGN_STATUS'][_0xcc13('0x7b')];loggerSyncQueueSummary[_0xcc13('0x3c')](_0xcc13('0x7c'),_0x38c920['name'],_0xcc13('0x7d'));}emitCampaignSummary(_0x38c920);}}function myreject(_0xbb0f24){return function(_0x313622){return _0xbb0f24(msgResponse(_0xcc13('0x7e'),_0xcc13('0x7f'),JSON[_0xcc13('0x70')](_0x313622)));};}Dialer[_0xcc13('0x18')][_0xcc13('0x80')]=function(_0x42e538){return!_[_0xcc13('0x38')](_0x42e538)&&_0x42e538&&!_['isUndefined'](_0x42e538[_0xcc13('0x5a')])&&!_[_0xcc13('0x38')](_0x42e538[_0xcc13('0x81')])&&_0x42e538['active']&&(this['trunks'][util[_0xcc13('0x3e')](_0xcc13('0x82'),_0x42e538[_0xcc13('0x5a')])]['status']===_0xcc13('0x83')||this[_0xcc13('0x1e')][util[_0xcc13('0x3e')](_0xcc13('0x82'),_0x42e538[_0xcc13('0x5a')])][_0xcc13('0x84')]===_0xcc13('0x85'));};Dialer[_0xcc13('0x18')][_0xcc13('0x86')]=function(_0xa79f0e){var _0xa6b1b=this;return function(){if(!_0xa6b1b['isTrunkReachable'](_0xa79f0e[_0xcc13('0x87')])){if(!_0xa6b1b[_0xcc13('0x80')](_0xa79f0e['TrunkBackup'])){_0xa79f0e[_0xcc13('0x64')]=utils[_0xcc13('0x68')][_0xcc13('0x88')];throw _0xa79f0e[_0xcc13('0x5a')]+_0xcc13('0x89');}}};};Dialer[_0xcc13('0x18')]['checkIfTime']=function(_0x24605a,_0x171dfa,_0x2c7ce9,_0x4f3b1f){var _0x35af2c=this;return function(){var _0x4a4d08=!![];return _0x35af2c[_0xcc13('0x8a')](_0x24605a,_0x171dfa,_0x2c7ce9,_0x4f3b1f,_0x4a4d08);};};Dialer[_0xcc13('0x18')][_0xcc13('0x8b')]=function(_0x230304,_0x5ece9d,_0x4c454f,_0x46da4f){var _0x1c907a=this;return function(){var _0x115d9f=![];return _0x1c907a[_0xcc13('0x8a')](_0x230304[_0xcc13('0x74')],_0x5ece9d,_0x4c454f,_0x46da4f,_0x115d9f);};};Dialer[_0xcc13('0x18')]['ifTimeIvr']=function(_0x3831ff,_0x51f4f7,_0x1a8a36,_0x2225ad,_0x5812a3){var _0x539538=[];return new Promise(function(_0x29f9e6,_0x513b6f){if(!isNotNull(_0x3831ff)){_0x2225ad['message']=utils[_0xcc13('0x68')][_0xcc13('0x75')];return _0x513b6f(msgResponse('ifTime',_0xcc13('0x8c'),_0x1a8a36+'\x20Intervals\x20is\x20null\x20'));}if(_[_0xcc13('0x41')](_0x3831ff)){_0x2225ad[_0xcc13('0x64')]=utils[_0xcc13('0x68')]['EMPTY_INTERVAL'];return _0x513b6f(msgResponse(_0xcc13('0x8d'),_0xcc13('0x8c'),_0x1a8a36+_0xcc13('0x8e')));}if(_0x51f4f7&&_['isUndefined'](config[_0xcc13('0x8f')][_0x51f4f7])){_0x2225ad[_0xcc13('0x64')]=utils['CAMPAIGN_STATUS'][_0xcc13('0x90')];return _0x513b6f(msgResponse(_0xcc13('0x8d'),'Failure',_0x1a8a36+_0xcc13('0x91')+_0x51f4f7));}if(_[_0xcc13('0x92')](_0x3831ff)){for(var _0x3c82a1=0x0;_0x3c82a1<_0x3831ff[_0xcc13('0x93')];_0x3c82a1+=0x1){_0x539538[_0xcc13('0x94')](ami[_0xcc13('0x95')]({'action':'command','command':util[_0xcc13('0x3e')]('iftime\x20%s,%s',_0x3831ff[_0x3c82a1][_0xcc13('0x96')],!_[_0xcc13('0x38')](config[_0xcc13('0x8f')][_0x51f4f7])?_0x51f4f7:'')})[_0xcc13('0x97')](function(_0x31c570){return _0x31c570[_0xcc13('0x98')]['indexOf']('true')>=0x0;})[_0xcc13('0x99')](myreject(_0x513b6f)));}}else{_0x539538['push'](ami[_0xcc13('0x95')]({'action':'command','command':util['format'](_0xcc13('0x9a'),_0x3831ff,!_[_0xcc13('0x38')](config['timezones'][_0x51f4f7])?_0x51f4f7:'')})['then'](function(_0x1f75d1){return _0x1f75d1['content'][_0xcc13('0x9b')](_0xcc13('0x9c'))>=0x0;})[_0xcc13('0x99')](myreject(_0x513b6f)));}Promise[_0xcc13('0x9d')](_0x539538)[_0xcc13('0x97')](function(_0x21dda1){var _0x5cb87e=_[_0xcc13('0x9e')](_0x21dda1);if(_0x5cb87e){return _0x29f9e6(_0x5cb87e);}else{_0x2225ad[_0xcc13('0x64')]=_0x5812a3?utils[_0xcc13('0x68')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0xcc13('0x68')]['OVERTIME_INTERVAL'];return _0x513b6f(msgResponse(_0xcc13('0x9f'),_0xcc13('0x8c'),_0xcc13('0xa0')+_0x5812a3+'\x20'+_0x1a8a36+_0xcc13('0xa1')+util['inspect'](_0x3831ff,{'showHidden':![],'depth':null})+_0xcc13('0xa2')+_0x51f4f7));}})[_0xcc13('0x99')](function(_0x1f84da){return _0x513b6f(msgResponse(_0xcc13('0x8d'),_0xcc13('0x8c'),JSON[_0xcc13('0x70')](_0x1f84da)));});});};Dialer[_0xcc13('0x18')]['loopCampaigns']=function(){var _0x256640=this;return cmHopper[_0xcc13('0xa3')]({'active':![]},{'where':{'active':!![]}})[_0xcc13('0x97')](function(){setInterval(function(){_0x256640[_0xcc13('0xa4')]();},0x3e8);});};Dialer['prototype'][_0xcc13('0xa4')]=function(){var _0x56da48=this;var _0xe0ae53;for(var _0x13642a in this[_0xcc13('0x1c')]){if(typeof this[_0xcc13('0x1c')][_0x13642a]!==_0xcc13('0xa5')){_0xe0ae53=this[_0xcc13('0x1c')][_0x13642a];if(utils[_0xcc13('0x78')](_0xe0ae53)&&utils[_0xcc13('0xa6')](_0xe0ae53)){_0xe0ae53['sendMessageOneNotActive']=!![];Promise[_0xcc13('0xa7')]()[_0xcc13('0x97')](checkIsIVRCampaignActive(_0xe0ae53))['then'](checkInterval(_0xe0ae53))[_0xcc13('0x97')](_0x56da48[_0xcc13('0x86')](_0xe0ae53))[_0xcc13('0x97')](_0x56da48['checkIfTime'](_0xe0ae53[_0xcc13('0xa8')],_0xe0ae53[_0xcc13('0xa9')],_0xe0ae53[_0xcc13('0x5a')],_0xe0ae53))[_0xcc13('0x97')](_0x56da48[_0xcc13('0x8b')](_0xe0ae53[_0xcc13('0x72')],_0xe0ae53['dialTimezone'],_0xe0ae53[_0xcc13('0x5a')],_0xe0ae53))[_0xcc13('0x97')](_0x56da48['launchHandleIvr'](_0xe0ae53))[_0xcc13('0x99')](loggerCatchQueueSummary(_0xcc13('0xaa'),_0xe0ae53));}else{notSendMessagesCampaign(_0xe0ae53);}}}};Dialer[_0xcc13('0x18')][_0xcc13('0xab')]=function(_0x365a8c){if(_0x365a8c[_0xcc13('0xac')]!==_0xcc13('0x9')){clearPredictiveAttributes(_0x365a8c);}switch(_0x365a8c['dialMethod']){case _0xcc13('0xad'):this[_0xcc13('0xae')](_0x365a8c,0x1);break;case _0xcc13('0xaf'):this['handlePower'](_0x365a8c,_0x365a8c['dialPowerLevel']);break;case _0xcc13('0x9'):this[_0xcc13('0x9')](_0x365a8c);break;case _0xcc13('0x8'):this[_0xcc13('0xae')](_0x365a8c,0x1);break;default:logger[_0xcc13('0x5f')]('Queue',_0x365a8c[_0xcc13('0x5a')],_0xcc13('0xb0'));}};Dialer[_0xcc13('0x18')][_0xcc13('0x8d')]=function(_0x2c2de6,_0x205481){var _0x10aa45=_0x2c2de6[_0xcc13('0xa9')];var _0x2b99b0=_0x205481?_0x2c2de6[_0xcc13('0xa8')]:_0x2c2de6[_0xcc13('0x72')][_0xcc13('0x74')];logger[_0xcc13('0xb1')]('Dialer::ifTime()',_0x2b99b0,_0x10aa45,_0x2c2de6['name'],util[_0xcc13('0x3e')]('Voice\x20Queue\x20%s\x20$s',_0x2c2de6[_0xcc13('0x5a')],_0x2c2de6['id']));var _0x1cf5b2=null;return Interval[_0xcc13('0xb2')](_0x2b99b0,_0x10aa45)[_0xcc13('0x97')](function(_0x7756a5){if(_0x7756a5===!![]){return _0x7756a5;}else{_0x2c2de6['message']=_0x205481?utils[_0xcc13('0x68')][_0xcc13('0xb3')]:utils[_0xcc13('0x68')]['OVERTIME_INTERVAL'];_0x1cf5b2=msgResponse(_0xcc13('0x9f'),'Failure',_0xcc13('0xa0')+_0x205481+'\x20'+_0x2c2de6[_0xcc13('0x5a')]+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x2b99b0,{'showHidden':![],'depth':null})+_0xcc13('0xa2')+_0x10aa45);}if(_0x1cf5b2!==null){logger['silly'](_0xcc13('0xb4'),_0x1cf5b2);_0x1cf5b2['isGlobal']=_0x205481;throw _0x1cf5b2;}})[_0xcc13('0x99')](function(_0x7f262f){logger[_0xcc13('0x5f')](_0xcc13('0xb5'),_0x7f262f);throw msgResponse(_0xcc13('0x7e'),_0xcc13('0x7f'),util[_0xcc13('0x3d')](_0x7f262f,{'showHidden':![],'depth':null}));});};Dialer[_0xcc13('0x18')]['syncAgentConnect']=function(_0x21ea11){if(this[_0xcc13('0xb6')][_0x21ea11['queue']]){if(this[_0xcc13('0x22')][_0x21ea11[_0xcc13('0xb7')]]&&this['uniqueId'][_0x21ea11[_0xcc13('0xb7')]][_0xcc13('0x3a')]!==_0xcc13('0xb8')){this[_0xcc13('0xb9')](this[_0xcc13('0xb6')][_0x21ea11['queue']]);this[_0xcc13('0x22')][_0x21ea11[_0xcc13('0xb7')]]['answertime']=moment()[_0xcc13('0x3e')](_0xcc13('0xba'));}}};Dialer['prototype'][_0xcc13('0x2c')]=function(_0x58a586){var _0x42988b=this[_0xcc13('0x22')][_0x58a586['uniqueid']];if(this[_0xcc13('0xb6')][_0x58a586[_0xcc13('0xbb')]]){if(_0x42988b&&_0x42988b['type']!=='ivr'){delete this[_0xcc13('0x22')][_0x58a586[_0xcc13('0xb7')]];this['voiceQueues'][_0x58a586[_0xcc13('0xbb')]][_0xcc13('0xbc')]+=0x1;var _0x2dfe0e=new AgentComplete(_0x42988b,_0x58a586);if(_0x58a586['reason']==='agent'){_0x2dfe0e[_0xcc13('0xbd')]=this[_0xcc13('0xb6')][_0x58a586[_0xcc13('0xbb')]][_0xcc13('0xbe')]&&this[_0xcc13('0xb6')][_0x58a586[_0xcc13('0xbb')]]['dialAgiAfterHangupAgent']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0xcc13('0xbf')](_0x2dfe0e)[_0xcc13('0x99')](loggerCatch(_0xcc13('0xc0')));hopperUtils['moveContactManagedDialer'](_0x2dfe0e)[_0xcc13('0x99')](loggerCatch(_0xcc13('0xc1')));}}};Dialer[_0xcc13('0x18')][_0xcc13('0x29')]=function(_0x23e3c4){var _0xa76f26=this[_0xcc13('0x22')][_0x23e3c4[_0xcc13('0xb7')]];var _0x4af5d4=this;var _0x6b7cad=![];var _0x2baebb;var _0x571197;if(this['voiceQueues'][_0x23e3c4[_0xcc13('0xbb')]]){if(_0xa76f26&&_0xa76f26[_0xcc13('0x3a')]!==_0xcc13('0xb8')){delete this[_0xcc13('0x22')][_0x23e3c4[_0xcc13('0xb7')]];this[_0xcc13('0xb9')](this[_0xcc13('0xb6')][_0x23e3c4[_0xcc13('0xbb')]]);_0xa76f26['droptime']=moment()[_0xcc13('0x3e')](_0xcc13('0xba'));var _0x34cf07=new QueueCallerAbandon(_0xa76f26,_0x23e3c4);if(utils['getSeconds'](_0xa76f26[_0xcc13('0xc2')],_0xa76f26[_0xcc13('0xc3')])>=_0xa76f26[_0xcc13('0xc4')]){this[_0xcc13('0xb6')][_0x23e3c4[_0xcc13('0xbb')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xcc13('0xb6')][_0x23e3c4['queue']]['outboundDropCallsDayTimeout']+=0x1;this[_0xcc13('0xb6')][_0x23e3c4[_0xcc13('0xbb')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x34cf07[_0xcc13('0x6a')]=0xa;_0x34cf07[_0xcc13('0x6b')]=_0xcc13('0xc5');_0x34cf07[_0xcc13('0xc6')]=_0xcc13('0xc7');_0x34cf07[_0xcc13('0xbd')]=this['voiceQueues'][_0x23e3c4['queue']][_0xcc13('0xbe')]?moment()[_0xcc13('0x3e')](_0xcc13('0xba')):undefined;_0x34cf07[_0xcc13('0xc8')]+=0x1;_0x34cf07['countglobal']+=0x1;_0x2baebb=this['voiceQueues'][_0x23e3c4[_0xcc13('0xbb')]]['dialDropRetryFrequency'];_0x571197=this[_0xcc13('0xb6')][_0x23e3c4['queue']][_0xcc13('0xc9')];hopperUtils['verifyAdditionalPhones'](_0x34cf07,_0x34cf07['state'],_0xa76f26[_0xcc13('0xca')])['then'](function(_0x21fe24){_0x6b7cad=_0x21fe24['additional']==0x1;if(_0x34cf07['countdropretry']>=_0x4af5d4[_0xcc13('0xb6')][_0x23e3c4[_0xcc13('0xbb')]][_0xcc13('0xcb')]){_0x4af5d4[_0xcc13('0xcc')](_0x34cf07,_0x21fe24[_0xcc13('0xcd')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x34cf07['countdropretry'],'scheduledat':moment()[_0xcc13('0xce')](_0x4af5d4[_0xcc13('0xb6')][_0x23e3c4['queue']][_0xcc13('0xcf')],_0xcc13('0xd0'))[_0xcc13('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xa76f26[_0xcc13('0xd1')],'ListId':_0xa76f26['ListId'],'VoiceQueueId':_0xa76f26['VoiceQueueId']||undefined,'CampaignId':_0xa76f26[_0xcc13('0xd2')]||undefined})['catch'](loggerCatch(_0xcc13('0xd3')));var _0x3b53e7=new History(_0x34cf07);_0x3b53e7[_0xcc13('0x6a')]=0xa;_0x3b53e7[_0xcc13('0x6b')]='Drop';_0x3b53e7[_0xcc13('0x6d')]=moment()['format'](_0xcc13('0xba'));_0x3b53e7[_0xcc13('0x6c')]=_0x3b53e7['starttime'];_0x3b53e7[_0xcc13('0xd4')]=_0x34cf07[_0xcc13('0xd4')];_0x3b53e7['calleridnum']=_0x34cf07[_0xcc13('0xd5')];hopperUtils[_0xcc13('0xbf')](_0x3b53e7)[_0xcc13('0x99')](loggerCatch(_0xcc13('0xd6')));}})['then'](function(){if(_0x6b7cad)hopperUtils[_0xcc13('0xd7')](_0x34cf07,_0x2baebb,_0x571197)['then'](function(){return 0x1;});});}else{this[_0xcc13('0xb6')][_0x23e3c4[_0xcc13('0xbb')]][_0xcc13('0xd8')]+=0x1;this[_0xcc13('0xb6')][_0x23e3c4['queue']]['outboundDropCallsDayCallersExit']+=0x1;_0x34cf07[_0xcc13('0x6a')]=0xb;_0x34cf07[_0xcc13('0x6b')]=_0xcc13('0xd9');_0x34cf07[_0xcc13('0xc6')]=_0xcc13('0xda');_0x34cf07['countabandonedretry']+=0x1;_0x34cf07[_0xcc13('0xdb')]+=0x1;_0x2baebb=this[_0xcc13('0xb6')][_0x23e3c4[_0xcc13('0xbb')]]['dialAbandonedRetryFrequency'];_0x571197=this[_0xcc13('0xb6')][_0x23e3c4['queue']][_0xcc13('0xc9')];hopperUtils['verifyAdditionalPhones'](_0x34cf07,_0x34cf07[_0xcc13('0x6a')],_0xa76f26[_0xcc13('0xca')])[_0xcc13('0x97')](function(_0xd38957){if(_0x34cf07['countabandonedretry']>=_0x4af5d4[_0xcc13('0xb6')][_0x23e3c4[_0xcc13('0xbb')]][_0xcc13('0xdc')]){_0x4af5d4['queueCallerAbandonCreateState'](_0x34cf07,_0xd38957['additional']);}else{hopperUtils[_0xcc13('0xdd')]({'active':![],'countabandonedretry':_0x34cf07[_0xcc13('0xde')],'scheduledat':moment()[_0xcc13('0xce')](_0x4af5d4[_0xcc13('0xb6')][_0x23e3c4[_0xcc13('0xbb')]]['dialAbandonedRetryFrequency'],_0xcc13('0xd0'))['format'](_0xcc13('0xba')),'ContactId':_0xa76f26[_0xcc13('0xd1')],'ListId':_0xa76f26[_0xcc13('0xdf')],'VoiceQueueId':_0xa76f26['VoiceQueueId']||undefined,'CampaignId':_0xa76f26[_0xcc13('0xd2')]||undefined})[_0xcc13('0x99')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x5e9431=new History(_0x34cf07);_0x5e9431[_0xcc13('0x6a')]=0xb;_0x5e9431[_0xcc13('0x6b')]=_0xcc13('0xd9');_0x5e9431[_0xcc13('0x6d')]=moment()[_0xcc13('0x3e')](_0xcc13('0xba'));_0x5e9431['endtime']=_0x5e9431['starttime'];_0x5e9431['calleridname']=_0x34cf07['calleridname'];_0x5e9431[_0xcc13('0xd5')]=_0x34cf07[_0xcc13('0xd5')];hopperUtils[_0xcc13('0xbf')](_0x5e9431)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0xcc13('0x97')](function(){if(_0x6b7cad)hopperUtils[_0xcc13('0xd7')](_0x34cf07,_0x2baebb,_0x571197)[_0xcc13('0x97')](function(){return 0x1;});});}}}};Dialer[_0xcc13('0x18')][_0xcc13('0x32')]=function(_0x4ab41a){if(this[_0xcc13('0xe0')][_0x4ab41a[_0xcc13('0xb7')]]){this[_0xcc13('0xe0')][_0x4ab41a[_0xcc13('0xb7')]][_0xcc13('0xe1')]=_0x4ab41a[_0xcc13('0xe1')];}if(this[_0xcc13('0x22')][_0x4ab41a[_0xcc13('0xb7')]]){this[_0xcc13('0x22')][_0x4ab41a[_0xcc13('0xb7')]][_0xcc13('0xe1')]=_0x4ab41a[_0xcc13('0xe1')];}};Dialer['prototype'][_0xcc13('0x34')]=function(_0x3dadaa){if(!this[_0xcc13('0xe0')][_0x3dadaa[_0xcc13('0xe2')]]){return;}var _0x3318f8=this['voiceQueues'][this[_0xcc13('0xe0')][_0x3dadaa[_0xcc13('0xe2')]][_0xcc13('0xbb')]][_0xcc13('0xe3')]||_0xcc13('0xe4');if(_0x3318f8===_0xcc13('0xe5')){if(this['actions'][_0x3dadaa[_0xcc13('0xe2')]]&&_[_0xcc13('0xe6')](this[_0xcc13('0xe0')][_0x3dadaa[_0xcc13('0xe2')]][_0xcc13('0xe7')])&&_0x3dadaa[_0xcc13('0x84')]==='1'&&_0x3dadaa[_0xcc13('0xe8')]==='0'){if(this[_0xcc13('0x1d')][_0x3dadaa[_0xcc13('0xe9')]]){if(!this[_0xcc13('0x1d')][_0x3dadaa['stateinterface']][_0xcc13('0xe7')]){this[_0xcc13('0x1d')][_0x3dadaa[_0xcc13('0xe9')]][_0xcc13('0xe7')]=!![];this['actions'][_0x3dadaa['actionid']][_0xcc13('0xe7')]=!![];this['actions'][_0x3dadaa[_0xcc13('0xe2')]][_0xcc13('0xe9')]=_0x3dadaa[_0xcc13('0xe9')];}}}}else if(_0x3318f8===_0xcc13('0xe4')){if(this[_0xcc13('0xe0')][_0x3dadaa[_0xcc13('0xe2')]]){if(this['agents'][_0x3dadaa[_0xcc13('0xe9')]]){this[_0xcc13('0xe0')][_0x3dadaa[_0xcc13('0xe2')]][_0xcc13('0xe9')]=_0x3dadaa[_0xcc13('0xe9')];if(_[_0xcc13('0xe6')](this[_0xcc13('0xea')][this[_0xcc13('0xe0')][_0x3dadaa[_0xcc13('0xe2')]]['queue']])){this[_0xcc13('0xea')][this['actions'][_0x3dadaa[_0xcc13('0xe2')]][_0xcc13('0xbb')]]=[];}this[_0xcc13('0xea')][this[_0xcc13('0xe0')][_0x3dadaa[_0xcc13('0xe2')]]['queue']][_0xcc13('0x94')](_['merge'](_[_0xcc13('0x71')](this[_0xcc13('0xe0')][_0x3dadaa[_0xcc13('0xe2')]],[_0xcc13('0xeb'),_0xcc13('0xe9')]),{'status':_0x3dadaa['status'],'paused':_0x3dadaa[_0xcc13('0xe8')]}));}}}};Dialer[_0xcc13('0x18')]['syncQueueStatusComplete']=function(_0x1517c4){if(!this['actions'][_0x1517c4[_0xcc13('0xe2')]]){return;}var _0x28d4d8=this;var _0x37eb04=this[_0xcc13('0xb6')][this[_0xcc13('0xe0')][_0x1517c4[_0xcc13('0xe2')]][_0xcc13('0xbb')]];var _0x3a8d0f=_0x37eb04[_0xcc13('0xe3')]||_0xcc13('0xe4');if(_0x3a8d0f===_0xcc13('0xe5')){if(this['actions'][_0x1517c4[_0xcc13('0xe2')]]&&this[_0xcc13('0xe0')][_0x1517c4['actionid']][_0xcc13('0xe9')]){this[_0xcc13('0x1b')][_0xcc13('0xec')](this[_0xcc13('0xe0')][_0x1517c4[_0xcc13('0xe2')]][_0xcc13('0xeb')],this['actions'][_0x1517c4['actionid']][_0xcc13('0xe9')])[_0xcc13('0x99')](function(_0x491280){logger[_0xcc13('0x5f')]('[Catch][Preview][syncQueueStatusComplete]',util[_0xcc13('0x3d')](_0x491280,{'showHidden':![],'depth':null}));})['finally'](function(){_0x28d4d8[_0xcc13('0xb9')](_0x28d4d8[_0xcc13('0xb6')][_0x28d4d8[_0xcc13('0xe0')][_0x1517c4[_0xcc13('0xe2')]][_0xcc13('0xbb')]]);_0x28d4d8['agents'][_0x28d4d8[_0xcc13('0xe0')][_0x1517c4[_0xcc13('0xe2')]][_0xcc13('0xe9')]][_0xcc13('0xe7')]=![];delete _0x28d4d8['actions'][_0x1517c4[_0xcc13('0xe2')]];unlockQueueStatus(_0x37eb04);});}else{this[_0xcc13('0xb9')](this[_0xcc13('0xb6')][this[_0xcc13('0xe0')][_0x1517c4[_0xcc13('0xe2')]]['queue']]);hopperUtils[_0xcc13('0xdd')]({'active':![],'ContactId':this[_0xcc13('0xe0')][_0x1517c4['actionid']]['ContactId'],'ListId':this[_0xcc13('0xe0')][_0x1517c4[_0xcc13('0xe2')]][_0xcc13('0xdf')],'VoiceQueueId':this[_0xcc13('0xe0')][_0x1517c4['actionid']]['VoiceQueueId']||undefined,'CampaignId':this[_0xcc13('0xe0')][_0x1517c4[_0xcc13('0xe2')]]['CampaignId']||undefined})[_0xcc13('0x99')](loggerCatch(_0xcc13('0xed')));delete this[_0xcc13('0xe0')][_0x1517c4[_0xcc13('0xe2')]];unlockQueueStatus(_0x37eb04);}}else if(_0x3a8d0f==='rrmemory'){var _0xa4c666;if(this[_0xcc13('0xe0')][_0x1517c4[_0xcc13('0xe2')]]&&!_['isEmpty'](this[_0xcc13('0xea')][this['actions'][_0x1517c4[_0xcc13('0xe2')]]['queue']])){if(this[_0xcc13('0xee')][_0x28d4d8[_0xcc13('0xe0')][_0x1517c4[_0xcc13('0xe2')]][_0xcc13('0xbb')]]){this['queueBookedRR'][_0x28d4d8[_0xcc13('0xe0')][_0x1517c4[_0xcc13('0xe2')]][_0xcc13('0xbb')]]=this[_0xcc13('0xee')][this['actions'][_0x1517c4['actionid']][_0xcc13('0xbb')]]?this[_0xcc13('0xee')][this['actions'][_0x1517c4[_0xcc13('0xe2')]][_0xcc13('0xbb')]]:this[_0xcc13('0xea')][this['actions'][_0x1517c4[_0xcc13('0xe2')]][_0xcc13('0xbb')]]?this[_0xcc13('0xea')][this['actions'][_0x1517c4['actionid']]['queue']][_0xcc13('0xef')]||0x0:0x0;}this[_0xcc13('0xea')][this[_0xcc13('0xe0')][_0x1517c4[_0xcc13('0xe2')]][_0xcc13('0xbb')]][_0xcc13('0xef')]=this[_0xcc13('0xee')][this[_0xcc13('0xe0')][_0x1517c4['actionid']]['queue']];for(var _0x66a3b6=0x0;_0x66a3b6=_0x280747[_0xcc13('0x114')]){_0x491385[_0xcc13('0x115')](_0x37ef23,_0x55911f,_0x4bd9b1,'reason19\x20machine....');}else{if(_0x37ef23[_0xcc13('0x10d')]>=_0x280747['dialMachineMaxRetry']){_0x491385[_0xcc13('0x116')](_0x37ef23,_0x55911f,_0x4bd9b1,_0xcc13('0x117'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x37ef23[_0xcc13('0x10d')],'scheduledat':moment()[_0xcc13('0xce')](_0x280747[_0xcc13('0x118')],_0xcc13('0xd0'))[_0xcc13('0x3e')](_0xcc13('0xba')),'ContactId':_0x37ef23['ContactId'],'ListId':_0x37ef23[_0xcc13('0xdf')],'VoiceQueueId':_0x37ef23['VoiceQueueId']||undefined,'CampaignId':_0x37ef23[_0xcc13('0xd2')]||undefined})[_0xcc13('0x99')](loggerCatch('[rescheduleContact][Machine]'));_0x55911f({'reschedule':0x1});}}});}if(_0xb1239a['type']==='ivr'&&this[_0xcc13('0x1c')][_0xb1239a[_0xcc13('0xbb')]][_0xcc13('0x109')]&&_0x12b45b[_0xcc13('0x10a')]===_0xcc13('0x119')){delete this[_0xcc13('0x22')][_0x12b45b[_0xcc13('0xb7')]];this[_0xcc13('0xb9')](this[_0xcc13('0x1c')][_0xb1239a[_0xcc13('0xbb')]]);_0x5c48f6=new Hangup(_0xb1239a,_0x12b45b);_0x5c48f6['state']=0x12;_0x5c48f6['statedesc']=_0xcc13('0x102');_0x5c48f6[_0xcc13('0x103')]='AMD';ami[_0xcc13('0x39')]('custom:amd',ut[_0xcc13('0x105')](_0x5c48f6,'amd'));this['saveInDb'](_0x5c48f6,'[syncHangupInAMDIvr][createHistory]',_0xcc13('0x11a'));}if(_0xb1239a[_0xcc13('0x3a')]==='ivr'&&this[_0xcc13('0x1c')][_0xb1239a[_0xcc13('0xbb')]][_0xcc13('0x109')]&&_0x12b45b['value']===_0xcc13('0x10b')){return new Promise(function(_0x167470,_0x19a875){delete _0x491385['uniqueId'][_0x12b45b[_0xcc13('0xb7')]];_0x491385[_0xcc13('0xb9')](_0x491385[_0xcc13('0x1c')][_0xb1239a[_0xcc13('0xbb')]]);_0x491385['campaigns'][_0xb1239a[_0xcc13('0xbb')]][_0xcc13('0xbc')]+=0x1;_0x491385[_0xcc13('0x1c')][_0xb1239a['queue']][_0xcc13('0x101')]+=0x1;var _0x1b2f21=_0x491385['campaigns'][_0xb1239a[_0xcc13('0xbb')]];var _0x1b7ce8=new Hangup(_0xb1239a,_0x12b45b);_0x1b7ce8[_0xcc13('0x6a')]=0x13;_0x1b7ce8[_0xcc13('0x6b')]=_0xcc13('0x10c');_0x1b7ce8[_0xcc13('0x103')]=_0xcc13('0x11b');_0x1b7ce8[_0xcc13('0x10d')]+=0x1;_0x1b7ce8[_0xcc13('0xdb')]+=0x1;_0x1b7ce8[_0xcc13('0x10e')]=!![];ami[_0xcc13('0x39')](_0xcc13('0x104'),ut[_0xcc13('0x105')](_0x1b7ce8,_0xcc13('0x10e')));hopperUtils['createHistory'](_0x1b7ce8)[_0xcc13('0x99')](loggerCatch(_0xcc13('0x10f')));if(_0x1b7ce8[_0xcc13('0x110')]+_0x1b7ce8[_0xcc13('0x111')]+_0x1b7ce8[_0xcc13('0x112')]+_0x1b7ce8[_0xcc13('0x11c')]+_0x1b7ce8['countdropretry']+_0x1b7ce8[_0xcc13('0xde')]+_0x1b7ce8[_0xcc13('0x10d')]+_0x1b7ce8[_0xcc13('0x113')]>=_0x1b2f21[_0xcc13('0x114')]){_0x491385[_0xcc13('0x115')](_0x1b7ce8,_0x167470,_0x19a875,_0xcc13('0x11d'));}else{if(_0x1b7ce8[_0xcc13('0x10d')]>=_0x1b2f21[_0xcc13('0x11e')]){_0x491385[_0xcc13('0x116')](_0x1b7ce8,_0x167470,_0x19a875,_0xcc13('0x117'));}else{hopperUtils[_0xcc13('0xdd')]({'active':![],'countmachineretry':_0x1b7ce8[_0xcc13('0x10d')],'scheduledat':moment()[_0xcc13('0xce')](_0x1b2f21['dialMachineRetryFrequency'],_0xcc13('0xd0'))[_0xcc13('0x3e')](_0xcc13('0xba')),'ContactId':_0x1b7ce8[_0xcc13('0xd1')],'ListId':_0x1b7ce8['ListId'],'VoiceQueueId':_0x1b7ce8[_0xcc13('0xf7')]||undefined,'CampaignId':_0x1b7ce8[_0xcc13('0xd2')]||undefined})[_0xcc13('0x99')](loggerCatch(_0xcc13('0x11f')));_0x167470({'reschedule':0x1});}}});}}};Dialer['prototype'][_0xcc13('0x30')]=function(_0x3f2822){var _0x4718d6=this[_0xcc13('0x22')][_0x3f2822[_0xcc13('0xb7')]];var _0x40895c;if(_0x4718d6&&_0x4718d6[_0xcc13('0x3a')]===_0xcc13('0xb8')){delete this['uniqueId'][_0x3f2822[_0xcc13('0xb7')]];this[_0xcc13('0xb9')](this['campaigns'][_0x4718d6['queue']]);this['campaigns'][_0x4718d6[_0xcc13('0xbb')]][_0xcc13('0x120')]+=0x1;_0x40895c=new Hangup(_0x4718d6,_0x3f2822);hopperUtils[_0xcc13('0xbf')](_0x40895c)[_0xcc13('0x99')](loggerCatch(_0xcc13('0x121')));hopperUtils[_0xcc13('0x122')](_0x40895c)['catch'](loggerCatch(_0xcc13('0x123')));}if(_0x4718d6&&_0x4718d6[_0xcc13('0x3a')]!=='ivr'&&isNotNull(this[_0xcc13('0xb6')][_0x4718d6[_0xcc13('0xbb')]]['dialQueueProject'])){delete this['uniqueId'][_0x3f2822['uniqueid']];this['updateOriginated'](this['voiceQueues'][_0x4718d6[_0xcc13('0xbb')]]);this[_0xcc13('0xb6')][_0x4718d6[_0xcc13('0xbb')]][_0xcc13('0xbc')]+=0x1;this[_0xcc13('0xb6')][_0x4718d6[_0xcc13('0xbb')]][_0xcc13('0x101')]+=0x1;_0x40895c=new Hangup(_0x4718d6,_0x3f2822);_0x40895c[_0xcc13('0x6a')]=0x10;_0x40895c[_0xcc13('0x6b')]=_0xcc13('0x124');_0x40895c[_0xcc13('0x103')]=_0xcc13('0x125');hopperUtils['createHistory'](_0x40895c)['catch'](loggerCatch(_0xcc13('0x121')));hopperUtils['moveContactManagedDialer'](_0x40895c)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x4718d6&&_0x4718d6[_0xcc13('0x3a')]!==_0xcc13('0xb8')&&!isNotNull(this[_0xcc13('0xb6')][_0x4718d6['queue']][_0xcc13('0x126')])){delete this[_0xcc13('0x22')][_0x3f2822[_0xcc13('0xb7')]];this[_0xcc13('0xb9')](this[_0xcc13('0xb6')][_0x4718d6['queue']]);this[_0xcc13('0xb6')][_0x4718d6[_0xcc13('0xbb')]]['outboundUnknownCallsDay']+=0x1;_0x40895c=new Hangup(_0x4718d6,_0x3f2822);_0x40895c[_0xcc13('0x6a')]=0xc;_0x40895c[_0xcc13('0x6b')]=_0x3f2822[_0xcc13('0x127')];_0x40895c[_0xcc13('0x103')]=_0xcc13('0x128');hopperUtils[_0xcc13('0xbf')](_0x40895c)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0xcc13('0x122')](_0x40895c)[_0xcc13('0x99')](loggerCatch('[syncHangupIvr]'));}};Dialer['prototype'][_0xcc13('0x2d')]=function(_0x49b526){var _0x5b17aa=this;if(!_0x5b17aa[_0xcc13('0x25')][_0x49b526['name']]){_0x5b17aa[_0xcc13('0x25')][_0x49b526['name']]={'running':![]};}else if(_0x5b17aa[_0xcc13('0x25')][_0x49b526['name']][_0xcc13('0x129')]===!![]){return;}else if(_0x5b17aa['queuesSummary'][_0x49b526[_0xcc13('0x5a')]]['running']===![]){_0x5b17aa[_0xcc13('0x25')][_0x49b526[_0xcc13('0x5a')]][_0xcc13('0x129')]=!![];}var _0x4bb998=_0x5b17aa[_0xcc13('0xb6')][_0x49b526['name']];var _0x2af165=_0x4bb998['message']!==utils['CAMPAIGN_STATUS'][_0xcc13('0x76')];var _0xa6afbe=utils[_0xcc13('0x12a')](_0x4bb998);_0x4bb998[_0xcc13('0x12b')]=utils[_0xcc13('0x12c')](_0x4bb998,_0x5b17aa['trunks']);Promise[_0xcc13('0xa7')]()[_0xcc13('0x97')](function(){if(_0x4bb998[_0xcc13('0x12b')]===utils[_0xcc13('0x68')][_0xcc13('0x76')]){if(_0x2af165){clearPredictiveAttributes(_0x4bb998);_0x49b526[_0xcc13('0x24')]=undefined;_0x49b526['startProgressive']=undefined;}if(_0x4bb998[_0xcc13('0x12b')]===utils[_0xcc13('0x68')][_0xcc13('0x76')]){_0x49b526['available']=0x0;_0x49b526[_0xcc13('0xe8')]=0x0;_0x49b526[_0xcc13('0x12d')]=0x0;_0x49b526[_0xcc13('0x12e')]=0x0;_0x49b526['pTalking']=0x0;}}else if(_0x4bb998[_0xcc13('0x12b')]===utils[_0xcc13('0x68')][_0xcc13('0x12f')]&&!_0xa6afbe){return _0x5b17aa[_0xcc13('0x8d')](_0x4bb998,!![])[_0xcc13('0x97')](function(){return _0x5b17aa[_0xcc13('0x8d')](_0x4bb998,![]);})[_0xcc13('0x97')](function(){return _0x5b17aa[_0xcc13('0xab')](_0x4bb998);})[_0xcc13('0x99')](function(_0x53ea31){loggerSyncQueueSummary['debug'](_0xcc13('0x130'),util[_0xcc13('0x3d')](_0x53ea31,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x4bb998);});}else{clearPredictiveAttributes(_0x4bb998);}})[_0xcc13('0x97')](function(){var _0x512d27=_0x49b526[_0xcc13('0x131')](_0x4bb998);if(_0x512d27||_0x4bb998[_0xcc13('0x132')]){_0x4bb998[_0xcc13('0x132')]=![];_0x49b526['updateReportFromOutboundQueue'](_0x4bb998);Object[_0xcc13('0x133')](_0x4bb998,_0x49b526);emitOutboundVoiceQueueSummary(_0x49b526);}_0x5b17aa[_0xcc13('0x25')][_0x4bb998[_0xcc13('0x5a')]][_0xcc13('0x129')]=![];})['catch'](function(_0x2c680e){logger[_0xcc13('0x5f')](_0xcc13('0x130'),util[_0xcc13('0x3d')](_0x2c680e,{'showHidden':![],'depth':null}));_0x5b17aa[_0xcc13('0x25')][_0x4bb998[_0xcc13('0x5a')]]['running']=![];});};Dialer[_0xcc13('0x18')]['syncQueueSummaryComplete']=_['throttle'](function(){var _0x24aaf8=_[_0xcc13('0x134')](this['voiceQueues'],function(_0x4a106e){return _0x4a106e[_0xcc13('0x135')];});var _0x3295fb=_[_0xcc13('0x134')](this[_0xcc13('0x1d')],function(_0x55e964){return _0x55e964[_0xcc13('0x136')]&&_0x55e964['status']==='reachable';});if(_0x24aaf8[_0xcc13('0x93')]>0x0&&_0x3295fb['length']>0x0){return Promise['resolve']()['then'](cmHopper['handlePreviewRecallNotifications'](_[_0xcc13('0x137')](_0x24aaf8,'id'),previewRecallmeReminderInterval,_[_0xcc13('0x137')](_0x3295fb,'id')))[_0xcc13('0x97')](function(_0x536cac){for(var _0x40519b=0x0;_0x40519b<_0x536cac[_0xcc13('0x93')];_0x40519b++){var _0x4108c2=_0x536cac[_0x40519b][_0xcc13('0x138')]['name'];if(_0x4108c2)io['to'](util[_0xcc13('0x3e')](_0xcc13('0x139'),_0x4108c2))[_0xcc13('0x39')](_0xcc13('0x13a'),{'hopper':_0x536cac[_0x40519b]});}})[_0xcc13('0x99')](function(_0x2c51f0){logger[_0xcc13('0x5f')](_0xcc13('0x13b'),_0x2c51f0);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xcc13('0x18')][_0xcc13('0x36')]=function(){var _0x20cf6b=this;setInterval(function(){_0x20cf6b[_0xcc13('0x13c')](_0x20cf6b[_0xcc13('0x22')],_0xcc13('0x13d'));_0x20cf6b[_0xcc13('0x13c')](_0x20cf6b[_0xcc13('0xe0')],_0xcc13('0x13e'));},0x32c8);};Dialer[_0xcc13('0x18')]['clearZombieChannels']=function(_0x3d3706,_0x435e71){var _0x24378e=this;for(var _0x2fcf49 in _0x3d3706){if(typeof _0x3d3706[_0x2fcf49]!==_0xcc13('0xa5')){this[_0xcc13('0x1a')][_0xcc13('0x13f')](function(){if(!_['isNil'](_0x3d3706[_0x2fcf49])){return ami[_0xcc13('0x95')]({'action':_0xcc13('0x84'),'channel':_0x3d3706[_0x2fcf49][_0xcc13('0xe1')]})[_0xcc13('0x99')](function(_0x5bce3e){if(_0x5bce3e[_0xcc13('0x64')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x3d3706[_0x2fcf49]&&_0x3d3706[_0x2fcf49]['type']!=='ivr'){_0x24378e['updateOriginated'](_0x24378e[_0xcc13('0xb6')][_0x3d3706[_0x2fcf49]['queue']]);logger[_0xcc13('0x5f')](_0xcc13('0x140'),_0x435e71,_0x2fcf49,_0x3d3706[_0x2fcf49][_0xcc13('0xbb')]);delete _0x3d3706[_0x2fcf49];}if(_0x3d3706[_0x2fcf49]&&_0x3d3706[_0x2fcf49][_0xcc13('0x3a')]===_0xcc13('0xb8')){_0x24378e[_0xcc13('0xb9')](_0x24378e[_0xcc13('0x1c')][_0x3d3706[_0x2fcf49][_0xcc13('0xbb')]]);logger[_0xcc13('0x5f')](_0xcc13('0x141'),_0x435e71,_0x2fcf49,_0x3d3706[_0x2fcf49]['queue']);delete _0x3d3706[_0x2fcf49];}},0x2328);}});}});}}};Dialer[_0xcc13('0x18')][_0xcc13('0x142')]=function(_0x10f201){return Promise[_0xcc13('0xa7')]()[_0xcc13('0x97')](voiceQueueRt[_0xcc13('0x142')](_0x10f201))[_0xcc13('0x99')](loggerCatch(_0xcc13('0x143')));};Dialer[_0xcc13('0x18')][_0xcc13('0xb9')]=function(_0x13c8e1){if(!_[_0xcc13('0x38')](_0x13c8e1)&&_0x13c8e1!==null){if(typeof _0x13c8e1[_0xcc13('0x144')]!==_0xcc13('0xa5')){if(_0x13c8e1[_0xcc13('0x144')]>0x0){_0x13c8e1[_0xcc13('0x144')]-=0x1;}else{logger[_0xcc13('0x5f')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xcc13('0x5f')](_0xcc13('0x145'));}};Dialer[_0xcc13('0x18')]['loggerHandler']=function(_0x12cfb8,_0x431aff){var _0x1fc7c4=this;return function(_0x5bef2f){_0x1fc7c4[_0xcc13('0xb9')](_0x431aff);logger[_0xcc13('0x5f')](_0x12cfb8,util['inspect'](_0x5bef2f,{'showHidden':![],'depth':null}));};};Dialer[_0xcc13('0x18')][_0xcc13('0x146')]=function(_0x3fba6a,_0x50a2bc,_0x1f4fa2){var _0x14b8dc={'state':0x19,'statedesc':_0xcc13('0x147')};this[_0xcc13('0xb9')](_0x50a2bc);this[_0xcc13('0x106')](_[_0xcc13('0x57')](_0x14b8dc,_[_0xcc13('0x71')](_0x1f4fa2,[_0xcc13('0xd1'),_0xcc13('0xdf'),_0xcc13('0x148'),_0xcc13('0xf7'),_0xcc13('0xd2')])),_0xcc13('0x149'),'[emptyContact]');logger[_0xcc13('0x5f')](_0x3fba6a);};Dialer[_0xcc13('0x18')][_0xcc13('0x106')]=function(_0x15b2e6,_0x25655c,_0x1c4568){hopperUtils['createHistory'](_0x15b2e6)[_0xcc13('0x99')](loggerCatch(_0x25655c));hopperUtils[_0xcc13('0x122')](_0x15b2e6)[_0xcc13('0x99')](loggerCatch(_0x1c4568));};Dialer[_0xcc13('0x18')]['queueCallerAbandonCreateState']=function(_0x31ab65,_0xe0e0c1){hopperUtils[_0xcc13('0xbf')](_0x31ab65)[_0xcc13('0x99')](loggerCatch(_0xcc13('0xc0')));if(_0xe0e0c1==0x0){hopperUtils['moveContactManagedDialer'](_0x31ab65)[_0xcc13('0x99')](loggerCatch(_0xcc13('0x14a')));}};Dialer[_0xcc13('0x18')][_0xcc13('0x13b')]=function(_0xf80c2f){return Promise[_0xcc13('0xa7')]()['then'](cmHopper[_0xcc13('0x14b')](_0xf80c2f['id'],previewRecallmeReminderInterval))[_0xcc13('0x97')](function(_0x1f86d9){for(var _0x13fafd=0x0;_0x13fafd<_0x1f86d9[_0xcc13('0x93')];_0x13fafd++){var _0x2b8451=_0x1f86d9[_0x13fafd][_0xcc13('0x138')]['name'];if(_0x2b8451)io['to'](util[_0xcc13('0x3e')](_0xcc13('0x139'),_0x2b8451))[_0xcc13('0x39')](_0xcc13('0x13a'),{'hopper':_0x1f86d9[_0x13fafd]});}})[_0xcc13('0x99')](function(){});};Dialer[_0xcc13('0x18')]['launchHandleIvr']=function(_0x1069ff){var _0x19299e=this;return function(){_0x19299e[_0xcc13('0x14c')](_0x1069ff);};};Dialer[_0xcc13('0x18')][_0xcc13('0x14d')]=function(_0x3e2d74,_0x262b4a){var _0x39e0a=this;var _0x45874d=uuid['v4']();this[_0xcc13('0xe0')][_0x45874d]=new Action(_0x3e2d74,_0x262b4a,_0x45874d);return new Promise(function(_0x1e28fe,_0x177f14){if(_[_0xcc13('0x38')](_0x3e2d74)&&typeof _0x3e2d74!==_0xcc13('0x14e')){return _0x177f14(msgResponse(_0xcc13('0x14f'),_0xcc13('0x8c'),_0xcc13('0x150')));}if(_[_0xcc13('0x38')](_0x262b4a[_0xcc13('0x151')])||_0x262b4a[_0xcc13('0x151')]===null){return _0x177f14(msgResponse(_0xcc13('0x14f'),_0xcc13('0x8c'),_0xcc13('0x152')));}var _0xcb29bf={'XMD-CALLERID':_0x39e0a[_0xcc13('0xe0')][_0x45874d][_0xcc13('0x153')](),'XMD-AGI':_0x3e2d74['dialQueueProject']?util[_0xcc13('0x3e')](_0xcc13('0x154'),ipAgi,_0x3e2d74['dialQueueProject']):_0xcc13('0x155'),'XMD-AGIAFTER':_0x3e2d74[_0xcc13('0xbe')]?util['format'](_0xcc13('0x154'),ipAgi,_0x3e2d74[_0xcc13('0xbe')]):_0xcc13('0x155'),'XMD-QUEUE':utils[_0xcc13('0x156')](_0x3e2d74)?util[_0xcc13('0x3e')](_0xcc13('0x157'),_0x3e2d74[_0xcc13('0x5a')],_0x3e2d74[_0xcc13('0x158')]||'',_0x3e2d74['dialAgiAfterHangupAgent']?'c':'',_0x3e2d74[_0xcc13('0xc4')]||0x3):_0xcc13('0x155'),'XMD-CONTACTID':_0x262b4a[_0xcc13('0xd1')],'XMD-CDRTYPE':_0xcc13('0x159'),'CALLERID(all)':_0x39e0a['actions'][_0x45874d][_0xcc13('0x153')](),'XMD-AMD':_0x3e2d74[_0xcc13('0x109')]?_0xcc13('0x12f'):_0xcc13('0x155'),'XMD-DESTINATION':_0xcc13('0x100')};if(_0x3e2d74[_0xcc13('0x109')]){_0xcb29bf[_0xcc13('0x15a')]=_0x3e2d74['dialAMDInitialSilence']||0x9c4;_0xcb29bf['XMD-AMDGREETING']=_0x3e2d74[_0xcc13('0x15b')]||0x5dc;_0xcb29bf[_0xcc13('0x15c')]=_0x3e2d74[_0xcc13('0x15d')]||0x320;_0xcb29bf['XMD-AMDTOTALANALYSISTIME']=_0x3e2d74[_0xcc13('0x15e')]||0x1388;_0xcb29bf[_0xcc13('0x15f')]=_0x3e2d74[_0xcc13('0x160')]||0x64;_0xcb29bf[_0xcc13('0x161')]=_0x3e2d74[_0xcc13('0x162')]||0x32;_0xcb29bf[_0xcc13('0x163')]=_0x3e2d74[_0xcc13('0x164')]||0x3;_0xcb29bf[_0xcc13('0x165')]=_0x3e2d74[_0xcc13('0x166')]||0x100;_0xcb29bf[_0xcc13('0x167')]=_0x3e2d74['dialAMDMaximumWordLength']||0x1388;}if(utils[_0xcc13('0x156')](_0x3e2d74)){_0xcb29bf['XMD-VOICEQUEUEID']=_0x262b4a['VoiceQueueId'];}else{_0xcb29bf['XMD-CAMPAIGNID']=_0x262b4a[_0xcc13('0xd2')];}var _0x1bebba=utils[_0xcc13('0x168')](_0x262b4a[_0xcc13('0x169')]);Object['assign'](_0xcb29bf,_0x1bebba);var _0x47009f=_0x39e0a['isTrunkReachable'](_0x3e2d74[_0xcc13('0x87')])?utils[_0xcc13('0x16a')](_0x3e2d74[_0xcc13('0x87')][_0xcc13('0x16b')],_0x3e2d74[_0xcc13('0x16c')],_0x3e2d74['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0xcc13('0x16d')](_0x3e2d74[_0xcc13('0x16e')],_0x3e2d74[_0xcc13('0x16f')]):_0x3e2d74[_0xcc13('0x16e')]):utils[_0xcc13('0x16a')](_[_0xcc13('0xe6')](_0x3e2d74['TrunkBackup'])?_0x3e2d74[_0xcc13('0x87')]['callerid']:_0x3e2d74['TrunkBackup'][_0xcc13('0x16b')],_0x3e2d74['dialOriginateCallerIdName'],_0x3e2d74['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0xcc13('0x16d')](_0x3e2d74['dialOriginateCallerIdNumber'],_0x3e2d74[_0xcc13('0x16f')]):_0x3e2d74['dialOriginateCallerIdNumber']);if(_0x47009f){_0xcb29bf['XMD-ORIGINATECALLERIDNAME']=_0x39e0a[_0xcc13('0xe0')][_0x45874d][_0xcc13('0x170')]=utils[_0xcc13('0x171')](_0x47009f);_0xcb29bf[_0xcc13('0x172')]=_0x262b4a[_0xcc13('0x151')];}_0x3e2d74[_0xcc13('0x173')]=_0xcb29bf;return ami[_0xcc13('0x95')]({'actionid':_0x45874d,'action':_0xcc13('0x14f'),'channel':_0x39e0a[_0xcc13('0x80')](_0x3e2d74[_0xcc13('0x87')])?util[_0xcc13('0x3e')](_0xcc13('0x174'),_0x3e2d74[_0xcc13('0x87')][_0xcc13('0x5a')],isNotNull(_0x3e2d74[_0xcc13('0x175')])?_0x3e2d74[_0xcc13('0x175')][_0xcc13('0x176')]()||'':'',_0x3e2d74[_0xcc13('0x177')]>0x0?_0x262b4a[_0xcc13('0x151')][_0xcc13('0x178')](_0x3e2d74[_0xcc13('0x177')]):_0x262b4a[_0xcc13('0x151')]):util[_0xcc13('0x3e')](_0xcc13('0x174'),_['isNil'](_0x3e2d74[_0xcc13('0x179')])?_0x3e2d74[_0xcc13('0x87')][_0xcc13('0x5a')]:_0x3e2d74[_0xcc13('0x179')][_0xcc13('0x5a')],isNotNull(_0x3e2d74[_0xcc13('0x175')])?_0x3e2d74[_0xcc13('0x175')][_0xcc13('0x176')]()||'':'',_0x3e2d74[_0xcc13('0x177')]>0x0?_0x262b4a[_0xcc13('0x151')][_0xcc13('0x178')](_0x3e2d74[_0xcc13('0x177')]):_0x262b4a['phone']),'callerid':_0x47009f,'Exten':_0xcc13('0x100'),'Context':_0xcc13('0x17a'),'Priority':'1','variable':_0xcb29bf,'timeout':(_0x3e2d74[_0xcc13('0x17b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x45874d})[_0xcc13('0x97')](function(_0x126725){return _0x1e28fe(_0x126725);})[_0xcc13('0x99')](function(_0x2df345){_0x3e2d74[_0xcc13('0x17c')]+=0x1;var _0x4a79f7=new History(_0x39e0a[_0xcc13('0xe0')][_0x45874d]);logger[_0xcc13('0x5f')](util[_0xcc13('0x3e')]('[originateError]:\x20%s',JSON[_0xcc13('0x70')](_0x2df345)));_0x4a79f7[_0xcc13('0x6a')]=0xe;_0x4a79f7['statedesc']='OriginateError';_0x4a79f7['starttime']=moment()[_0xcc13('0x3e')](_0xcc13('0xba'));_0x4a79f7[_0xcc13('0x6c')]=_0x4a79f7[_0xcc13('0x6d')];hopperUtils[_0xcc13('0xbf')](_0x4a79f7)['catch'](loggerCatch(_0xcc13('0x17d')));_0x39e0a[_0xcc13('0x122')](_0x4a79f7)[_0xcc13('0x99')](loggerCatch(_0xcc13('0x17d')))[_0xcc13('0xf5')](function(){delete _0x39e0a[_0xcc13('0xe0')][_0x45874d];return _0x177f14(msgResponse(_0xcc13('0x14f'),_0xcc13('0x7f'),'originate\x20action\x20Error'));});});});};Dialer['prototype'][_0xcc13('0x17e')]=function(_0x169162,_0x463195,_0x519178){var _0x5afecc=new History(_0x463195);if(_0x5afecc[_0xcc13('0x110')]+_0x5afecc[_0xcc13('0x111')]+_0x5afecc[_0xcc13('0x112')]+_0x5afecc[_0xcc13('0x11c')]+_0x5afecc[_0xcc13('0xc8')]+_0x5afecc[_0xcc13('0xde')]+_0x5afecc[_0xcc13('0x10d')]+_0x5afecc['countagentrejectretry']>=_0x519178[_0xcc13('0x114')]-0x1){return!![];}switch(_0x169162){case 0x3:if(_0x5afecc[_0xcc13('0x112')]>=_0x519178[_0xcc13('0x17f')]-0x1){return!![];}hopperUtils[_0xcc13('0xdd')]({'active':![],'countnoanswerretry':_0x5afecc[_0xcc13('0x112')]+=0x1,'scheduledat':moment()[_0xcc13('0xce')](_0x519178[_0xcc13('0x180')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5afecc[_0xcc13('0xd1')],'ListId':_0x5afecc[_0xcc13('0xdf')],'VoiceQueueId':_0x5afecc[_0xcc13('0xf7')]||undefined,'CampaignId':_0x5afecc[_0xcc13('0xd2')]||undefined})[_0xcc13('0x99')](loggerCatch(_0xcc13('0x181')));break;case 0x5:if(_0x5afecc['countbusyretry']>=_0x519178['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0xcc13('0xdd')]({'active':![],'countbusyretry':_0x5afecc['countbusyretry']+=0x1,'scheduledat':moment()['add'](_0x519178[_0xcc13('0x182')],_0xcc13('0xd0'))[_0xcc13('0x3e')](_0xcc13('0xba')),'ContactId':_0x5afecc[_0xcc13('0xd1')],'ListId':_0x5afecc[_0xcc13('0xdf')],'VoiceQueueId':_0x5afecc['VoiceQueueId']||undefined,'CampaignId':_0x5afecc[_0xcc13('0xd2')]||undefined})[_0xcc13('0x99')](loggerCatch(_0xcc13('0x183')));break;case 0x8:if(_0x5afecc[_0xcc13('0x111')]>=_0x519178[_0xcc13('0x184')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x5afecc[_0xcc13('0x111')]+=0x1,'scheduledat':moment()[_0xcc13('0xce')](_0x519178['dialCongestionRetryFrequency'],_0xcc13('0xd0'))[_0xcc13('0x3e')](_0xcc13('0xba')),'ContactId':_0x5afecc['ContactId'],'ListId':_0x5afecc['ListId'],'VoiceQueueId':_0x5afecc[_0xcc13('0xf7')]||undefined,'CampaignId':_0x5afecc[_0xcc13('0xd2')]||undefined})[_0xcc13('0x99')](loggerCatch(_0xcc13('0x185')));break;case 0x0:if(_0x5afecc[_0xcc13('0x11c')]>=_0x519178[_0xcc13('0x186')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x5afecc[_0xcc13('0x11c')]+=0x1,'scheduledat':moment()[_0xcc13('0xce')](_0x519178[_0xcc13('0x187')],_0xcc13('0xd0'))[_0xcc13('0x3e')](_0xcc13('0xba')),'ContactId':_0x5afecc['ContactId'],'ListId':_0x5afecc[_0xcc13('0xdf')],'VoiceQueueId':_0x5afecc[_0xcc13('0xf7')]||undefined,'CampaignId':_0x5afecc[_0xcc13('0xd2')]||undefined})[_0xcc13('0x99')](loggerCatch(_0xcc13('0x188')));}break;case 0xa:if(_0x5afecc[_0xcc13('0xc8')]>=_0x519178[_0xcc13('0xcb')]-0x1){return!![];}hopperUtils[_0xcc13('0xdd')]({'active':![],'countdropretry':_0x5afecc[_0xcc13('0xc8')]+=0x1,'scheduledat':moment()[_0xcc13('0xce')](_0x519178[_0xcc13('0xcf')],'minutes')[_0xcc13('0x3e')](_0xcc13('0xba')),'ContactId':_0x5afecc[_0xcc13('0xd1')],'ListId':_0x5afecc[_0xcc13('0xdf')],'VoiceQueueId':_0x5afecc[_0xcc13('0xf7')]||undefined,'CampaignId':_0x5afecc['CampaignId']||undefined})[_0xcc13('0x99')](loggerCatch(_0xcc13('0xd3')));break;case 0xb:if(_0x5afecc[_0xcc13('0xde')]>=_0x519178[_0xcc13('0xdc')]-0x1){return!![];}hopperUtils[_0xcc13('0xdd')]({'active':![],'countabandonedretry':_0x5afecc[_0xcc13('0xde')]+=0x1,'scheduledat':moment()['add'](_0x519178['dialAbandonedRetryFrequency'],_0xcc13('0xd0'))[_0xcc13('0x3e')](_0xcc13('0xba')),'ContactId':_0x5afecc[_0xcc13('0xd1')],'ListId':_0x5afecc['ListId'],'VoiceQueueId':_0x5afecc[_0xcc13('0xf7')]||undefined,'CampaignId':_0x5afecc[_0xcc13('0xd2')]||undefined})[_0xcc13('0x99')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x5afecc['countmachineretry']>=_0x519178['dialMachineMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x5afecc[_0xcc13('0x10d')]+=0x1,'scheduledat':moment()[_0xcc13('0xce')](_0x519178['dialMachineRetryFrequency'],_0xcc13('0xd0'))[_0xcc13('0x3e')](_0xcc13('0xba')),'ContactId':_0x5afecc[_0xcc13('0xd1')],'ListId':_0x5afecc[_0xcc13('0xdf')],'VoiceQueueId':_0x5afecc[_0xcc13('0xf7')]||undefined,'CampaignId':_0x5afecc[_0xcc13('0xd2')]||undefined})[_0xcc13('0x99')](loggerCatch(_0xcc13('0x11f')));break;case 0x14:if(_0x5afecc[_0xcc13('0x113')]>=_0x519178[_0xcc13('0x189')]-0x1){return!![];}hopperUtils[_0xcc13('0xdd')]({'active':![],'countagentrejectretry':_0x5afecc[_0xcc13('0x113')]+=0x1,'scheduledat':moment()[_0xcc13('0xce')](_0x519178['dialAgentRejectRetryFrequency'],_0xcc13('0xd0'))[_0xcc13('0x3e')](_0xcc13('0xba')),'ContactId':_0x5afecc[_0xcc13('0xd1')],'ListId':_0x5afecc[_0xcc13('0xdf')],'VoiceQueueId':_0x5afecc[_0xcc13('0xf7')]||undefined,'CampaignId':_0x5afecc[_0xcc13('0xd2')]||undefined})[_0xcc13('0x99')](loggerCatch(_0xcc13('0x18a')));break;default:return!![];}};Dialer[_0xcc13('0x18')][_0xcc13('0xfc')]=function(_0x4012a3,_0x39bc1e,_0x3cdf10){var _0x1de30e=this;var _0x371406=new History(_0x4012a3);var _0x346bb9=![];var _0x5b2a57;var _0xc1907f;return new Promise(function(_0x51cfb7,_0x101233){if(_['isUndefined'](_0x39bc1e)&&typeof _0x39bc1e!==_0xcc13('0x14e')){return _0x101233(msgResponse(_0xcc13('0x18b'),_0xcc13('0x8c'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x3cdf10)&&typeof _0x3cdf10!==_0xcc13('0x14e')){return _0x101233(msgResponse(_0xcc13('0x18b'),_0xcc13('0x8c'),_0xcc13('0x18c')));}hopperUtils['verifyAdditionalPhones'](_0x371406,_0x3cdf10[_0xcc13('0x18d')],_0x39bc1e)[_0xcc13('0x97')](function(_0x5f132c){if(_0x5f132c[_0xcc13('0xcd')]==0x1)_0x346bb9=!![];switch(_0x3cdf10[_0xcc13('0x18d')]){case'0':_0x39bc1e[_0xcc13('0x18e')]+=0x1;_0x371406[_0xcc13('0x6a')]=0x0;_0x371406[_0xcc13('0x6b')]=_0xcc13('0x18f');_0x371406[_0xcc13('0x11c')]+=0x1;_0x371406[_0xcc13('0xdb')]+=0x1;ami[_0xcc13('0x39')](_0xcc13('0x190'),ut['buildObj'](_0x4012a3,_0xcc13('0x191')));_0x5b2a57=_0x39bc1e['dialNoSuchNumberRetryFrequency'];_0xc1907f=_0x39bc1e[_0xcc13('0xc9')];hopperUtils[_0xcc13('0xbf')](_0x371406)[_0xcc13('0x99')](loggerCatch(_0xcc13('0x10f')));if(_0x1de30e[_0xcc13('0x17e')](0x0,_0x4012a3,_0x39bc1e)&&!_0x346bb9){if(_0x371406['countnosuchnumberretry']>=_0x39bc1e[_0xcc13('0x186')]){_0x1de30e[_0xcc13('0x116')](_0x371406,_0x51cfb7,_0x101233,_0xcc13('0x192'));}else{_0x1de30e[_0xcc13('0x115')](_0x371406,_0x51cfb7,_0x101233,_0xcc13('0x192'));}}break;case'3':_0x39bc1e[_0xcc13('0x193')]+=0x1;_0x371406[_0xcc13('0x6a')]=0x3;_0x371406[_0xcc13('0x6b')]=_0xcc13('0x194');_0x371406[_0xcc13('0x112')]+=0x1;_0x371406[_0xcc13('0xdb')]+=0x1;var _0x400674=ut['buildNoAnswerEventPayload'](_0x4012a3,_0x39bc1e);ami[_0xcc13('0x39')]('custom:agentnoanswer',_0x400674);_0x5b2a57=_0x39bc1e['dialNoAnswerRetryFrequency'];_0xc1907f=_0x39bc1e[_0xcc13('0xc9')];hopperUtils['createHistory'](_0x371406)[_0xcc13('0x99')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x1de30e[_0xcc13('0x17e')](0x3,_0x4012a3,_0x39bc1e)&&!_0x346bb9){if(_0x371406['countnoanswerretry']>=_0x39bc1e[_0xcc13('0x17f')]){_0x1de30e[_0xcc13('0x116')](_0x371406,_0x51cfb7,_0x101233,_0xcc13('0x195'));}else{_0x1de30e[_0xcc13('0x115')](_0x371406,_0x51cfb7,_0x101233,_0xcc13('0x195'));}}break;case'5':_0x39bc1e[_0xcc13('0x196')]+=0x1;_0x371406[_0xcc13('0x6a')]=0x5;_0x371406[_0xcc13('0x6b')]='Busy';_0x371406[_0xcc13('0x110')]+=0x1;_0x371406[_0xcc13('0xdb')]+=0x1;ami[_0xcc13('0x39')]('custom:agentbusy',ut['buildObj'](_0x4012a3,_0xcc13('0x197')));_0x5b2a57=_0x39bc1e[_0xcc13('0x182')];_0xc1907f=_0x39bc1e['callAdditionalPhoneAfterMin'];hopperUtils[_0xcc13('0xbf')](_0x371406)[_0xcc13('0x99')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x1de30e[_0xcc13('0x17e')](0x5,_0x4012a3,_0x39bc1e)&&!_0x346bb9){if(_0x371406[_0xcc13('0x110')]>=_0x39bc1e[_0xcc13('0x198')]){_0x1de30e[_0xcc13('0x116')](_0x371406,_0x51cfb7,_0x101233,'reason\x205\x20busy');}else{_0x1de30e['stateGlobal'](_0x371406,_0x51cfb7,_0x101233,'reason\x205\x20busy');}}break;case'8':_0x39bc1e[_0xcc13('0x199')]+=0x1;_0x371406['state']=0x8;_0x371406['statedesc']=_0xcc13('0x19a');_0x371406[_0xcc13('0x111')]+=0x1;_0x371406[_0xcc13('0xdb')]+=0x1;_0x5b2a57=_0x39bc1e['dialCongestionRetryFrequency'];_0xc1907f=_0x39bc1e[_0xcc13('0xc9')];ami[_0xcc13('0x39')]('custom:agentcongestion',ut[_0xcc13('0x105')](_0x4012a3,_0xcc13('0x19b')));hopperUtils['createHistory'](_0x371406)[_0xcc13('0x99')](loggerCatch(_0xcc13('0x19c')));if(_0x1de30e[_0xcc13('0x17e')](0x8,_0x4012a3,_0x39bc1e)&&!_0x346bb9){if(_0x371406[_0xcc13('0x111')]>=_0x39bc1e['dialCongestionMaxRetry']){_0x1de30e[_0xcc13('0x116')](_0x371406,_0x51cfb7,_0x101233,_0xcc13('0x19d'));}else{_0x1de30e[_0xcc13('0x115')](_0x371406,_0x51cfb7,_0x101233,_0xcc13('0x19d'));}}break;case'11':_0x39bc1e[_0xcc13('0x19e')]+=0x1;_0x371406[_0xcc13('0x6a')]=0xb;_0x371406[_0xcc13('0x6b')]=_0xcc13('0xd9');_0x371406[_0xcc13('0xde')]+=0x1;_0x371406[_0xcc13('0xdb')]+=0x1;_0x5b2a57=_0x39bc1e[_0xcc13('0x19f')];_0xc1907f=_0x39bc1e[_0xcc13('0xc9')];hopperUtils['createHistory'](_0x371406)['catch'](loggerCatch(_0xcc13('0x1a0')));if(_0x1de30e[_0xcc13('0x17e')](0xb,_0x4012a3,_0x39bc1e)&&!_0x346bb9){if(_0x371406[_0xcc13('0xde')]>=_0x39bc1e[_0xcc13('0xdc')]){_0x1de30e[_0xcc13('0x116')](_0x371406,_0x51cfb7,_0x101233,'reason\x2011\x20abandoned');}else{_0x1de30e[_0xcc13('0x115')](_0x371406,_0x51cfb7,_0x101233,_0xcc13('0x1a1'));}}break;case'20':_0x39bc1e[_0xcc13('0x1a2')]+=0x1;_0x371406['state']=0x14;_0x371406[_0xcc13('0x6b')]=_0xcc13('0x1a3');_0x371406[_0xcc13('0x113')]+=0x1;_0x371406[_0xcc13('0xdb')]+=0x1;_0x5b2a57=_0x39bc1e['dialAgentRejectRetryFrequency'];_0xc1907f=_0x39bc1e['callAdditionalPhoneAfterMin'];ami[_0xcc13('0x39')](_0xcc13('0x1a4'),ut['buildObj'](_0x4012a3,_0xcc13('0x1a5')));hopperUtils['createHistory'](_0x371406)[_0xcc13('0x99')](loggerCatch(_0xcc13('0x1a6')));if(_0x1de30e[_0xcc13('0x17e')](0x14,_0x4012a3,_0x39bc1e)&&!_0x346bb9){if(_0x371406[_0xcc13('0x113')]>=_0x39bc1e['dialAgentRejectMaxRetry']){_0x1de30e['createStateFinal'](_0x371406,_0x51cfb7,_0x101233,_0xcc13('0x1a7'));}else{_0x1de30e['stateGlobal'](_0x371406,_0x51cfb7,_0x101233,_0xcc13('0x1a7'));}}break;default:_0x39bc1e['outboundUnknownCallsDay']+=0x1;_0x371406[_0xcc13('0x6a')]=0xc;_0x371406[_0xcc13('0x6b')]=_0x3cdf10[_0xcc13('0x18d')];_0x5b2a57=_0x39bc1e['dialAgentRejectRetryFrequency'];_0xc1907f=_0x39bc1e[_0xcc13('0xc9')];hopperUtils[_0xcc13('0xbf')](_0x371406)['catch'](loggerCatch(_0xcc13('0x1a8')));if(_0x1de30e[_0xcc13('0x17e')](_0x3cdf10[_0xcc13('0x18d')],_0x4012a3,_0x39bc1e)&&!_0x346bb9){if(_0x371406[_0xcc13('0x110')]+_0x371406[_0xcc13('0x111')]+_0x371406['countnoanswerretry']+_0x371406['countnosuchnumberretry']+_0x371406[_0xcc13('0xc8')]+_0x371406[_0xcc13('0xde')]+_0x371406[_0xcc13('0x10d')]+_0x371406[_0xcc13('0x113')]>=_0x39bc1e[_0xcc13('0x114')]){_0x1de30e[_0xcc13('0x115')](_0x371406,_0x51cfb7,_0x101233,_0x3cdf10[_0xcc13('0x18d')]);}else{_0x1de30e[_0xcc13('0x116')](_0x371406,_0x51cfb7,_0x101233,_0x3cdf10[_0xcc13('0x18d')]);}}}})[_0xcc13('0x97')](function(){if(_0x346bb9){hopperUtils[_0xcc13('0xd7')](_0x371406,_0x5b2a57,_0xc1907f)[_0xcc13('0x97')](function(){return _0x51cfb7(0x1);});}});});};Dialer['prototype']['stateGlobal']=function(_0x2c83f0,_0x182fc8,_0x50509f,_0x27c27b){var _0x5d5209=new Final(_0x2c83f0);_0x5d5209['state']=0xf;_0x5d5209['statedesc']='Global';this[_0xcc13('0x116')](_0x5d5209,_0x182fc8,_0x50509f,_0x27c27b);};Dialer[_0xcc13('0x18')][_0xcc13('0x116')]=function(_0x3e155b,_0x441a11,_0x4b092f,_0x31cafe){hopperUtils['moveContactManagedDialer'](_0x3e155b)[_0xcc13('0x97')](function(){return _0x441a11(msgResponse(_0xcc13('0x18b'),_0xcc13('0xfb'),_0x31cafe));})[_0xcc13('0x99')](function(){return _0x4b092f(msgResponse(_0xcc13('0x1a9'),_0xcc13('0x8c'),_0xcc13('0x1aa')));});};Dialer[_0xcc13('0x18')]['predictive']=function(_0x15dde1){var _0x43a7f8=_0x15dde1[_0xcc13('0x1ab')]/0x64;var _0x16df7b=_0x15dde1[_0xcc13('0x1ac')]/(_0x15dde1[_0xcc13('0x1ac')]+_0x15dde1[_0xcc13('0xbc')]);var _0xd33391=Math[_0xcc13('0x1ad')](_0x15dde1['predictiveIntervalAvailable']*(_0x15dde1[_0xcc13('0x1ae')]/0x64));var _0x489233=Math[_0xcc13('0x1ad')](_0x15dde1['predictiveIntervalAvailable']*(_0x15dde1[_0xcc13('0x1af')]/0x64));var _0x5a3a9c=_0x15dde1['available']+_0x15dde1[_0xcc13('0x12e')];var _0x2b85ca=Math[_0xcc13('0x1b0')](_0x15dde1[_0xcc13('0x52')]*_0x15dde1[_0xcc13('0x55')]*_0x15dde1[_0xcc13('0x1b1')]*_0x15dde1[_0xcc13('0x1b2')]);if(_[_0xcc13('0x38')](_0x15dde1[_0xcc13('0x59')])){if(!_[_0xcc13('0x38')](_0x15dde1['startPredictive'])){_0x15dde1[_0xcc13('0x24')]=undefined;loggerPredictive[_0xcc13('0x5f')](_0xcc13('0x1b3'),_0xcc13('0x1b4'));}if(!_[_0xcc13('0x38')](_0x15dde1[_0xcc13('0x5d')])){loggerPredictive[_0xcc13('0x5f')](_0xcc13('0x1b3'),_0xcc13('0x1b5'));clearInterval(_0x15dde1[_0xcc13('0x5d')]);_0x15dde1[_0xcc13('0x5d')]=undefined;}_0x15dde1['startProgressive']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x15dde1[_0xcc13('0x5a')],_0xcc13('0x1b6'),_0x15dde1[_0xcc13('0x59')]);this['handlePower'](_0x15dde1,0x1);}else if(ifInterval(_0x15dde1[_0xcc13('0x1b7')],_0x15dde1['startProgressive'])){this[_0xcc13('0xae')](_0x15dde1,0x1);loggerPredictiveCalls['info'](_0xcc13('0x1b8'),_0x15dde1['startProgressive'],_0x15dde1[_0xcc13('0x5a')]);_0x15dde1['erlangCalls']=0x0;_0x15dde1['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x43a7f8<_0x16df7b&&_0x15dde1[_0xcc13('0x1b9')]==='dropRate'){clearPredictiveAttributes(_0x15dde1);loggerPredictive[_0xcc13('0x42')](_0xcc13('0x1ba'),_0xcc13('0x1bb'),_0x16df7b,_0xcc13('0x59'),_0x15dde1[_0xcc13('0x5a')]);}else if(_0x2b85ca<_0x15dde1[_0xcc13('0x1bc')]&&_0x15dde1['dialPredictiveOptimization']===_0xcc13('0x1bd')){clearPredictiveAttributes(_0x15dde1);loggerPredictive[_0xcc13('0x42')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xcc13('0x1be'),_0x2b85ca,_0xcc13('0x1bf'),_0x15dde1['predictiveIntervalErlangCallsDroppedCalls'],_0xcc13('0x59'),_0x15dde1[_0xcc13('0x5a')]);}else if(!ifInterval(_0x15dde1[_0xcc13('0x1b7')],_0x15dde1['startProgressive'])&&_[_0xcc13('0x38')](_0x15dde1['startPredictive'])&&!_['isUndefined'](_0x15dde1[_0xcc13('0x59')])){_0x15dde1[_0xcc13('0x24')]=moment()[_0xcc13('0x3e')](_0xcc13('0xba'));loggerPredictive[_0xcc13('0x42')](_0x15dde1[_0xcc13('0x5a')],'started\x20in\x20predictive\x20at',_0x15dde1[_0xcc13('0x24')]);hopperUtils[_0xcc13('0x1c0')](_0x15dde1[_0xcc13('0x1b7')])[_0xcc13('0x97')](this[_0xcc13('0x1c1')](_0x15dde1))[_0xcc13('0x97')](mergeDataErlangB(_0x15dde1))[_0xcc13('0x97')](this[_0xcc13('0x1c2')](_0x15dde1))[_0xcc13('0x99')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x15dde1));}else if(!ifInterval(_0x15dde1['dialPredictiveInterval'],_0x15dde1[_0xcc13('0x24')])){_0x15dde1[_0xcc13('0x1bc')]=0x0;_0x15dde1[_0xcc13('0x24')]=moment()[_0xcc13('0x3e')](_0xcc13('0xba'));loggerPredictive['info'](_0x15dde1['name'],_0xcc13('0x1c3'),_0x15dde1[_0xcc13('0x24')]);clearInterval(_0x15dde1['handlePredictive']);_0x15dde1[_0xcc13('0x5d')]=undefined;hopperUtils['avgHandleTime'](_0x15dde1[_0xcc13('0x1b7')])['then'](this[_0xcc13('0x1c1')](_0x15dde1))[_0xcc13('0x97')](mergeDataErlangB(_0x15dde1))[_0xcc13('0x97')](this[_0xcc13('0x1c2')](_0x15dde1))[_0xcc13('0x99')](loggerCatchPredictive(_0xcc13('0x1c4'),_0x15dde1));}else if(_0x15dde1[_0xcc13('0x1c5')]&&_0x5a3a9c<_0x15dde1['predictiveIntervalAvailable']-_0x489233){clearPredictiveAttributes(_0x15dde1);loggerPredictive['info'](_0x15dde1['name'],_0xcc13('0x1c6'),_0x5a3a9c,_0xcc13('0x1c7'),_0x15dde1['predictiveIntervalAvailable'],'-',_0x489233,'=',_0x15dde1[_0xcc13('0x1c5')]-_0x489233,')');}else if(_0x15dde1['predictiveIntervalAvailable']&&_0x5a3a9c>_0x15dde1['predictiveIntervalAvailable']+_0xd33391){clearPredictiveAttributes(_0x15dde1);loggerPredictive[_0xcc13('0x42')](_0x15dde1[_0xcc13('0x5a')],_0xcc13('0x1c6'),_0x5a3a9c,_0xcc13('0x1c8'),_0x15dde1['predictiveIntervalAvailable'],'+',_0xd33391,'=',_0x15dde1[_0xcc13('0x1c5')]+_0xd33391,')');}};Dialer[_0xcc13('0x18')][_0xcc13('0x1c1')]=function(_0x4283e1){var _0x4b0d02=this;return function(_0x2f7a48){return new Promise(function(_0x5937b7,_0x53feac){_[_0xcc13('0x57')](_0x4283e1,_0x2f7a48[0x0]);if(checkGetDataPredictive(_0x2f7a48[0x0])){var _0x41921c=_0x4283e1[_0xcc13('0x1c5')]=_0x4283e1[_0xcc13('0x12e')]+_0x4283e1['available'];var _0x23c248=_0x4283e1[_0xcc13('0x1b7')]*0x3c;var _0x392923=_0x2f7a48[0x0][_0xcc13('0x4b')]+_0x2f7a48[0x0]['predictiveIntervalAvgHoldtime'];var _0x4bf83d=(_0x2f7a48[0x0]['predictiveIntervalAnsweredCalls']+_0x2f7a48[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2f7a48[0x0][_0xcc13('0xd8')])/_0x2f7a48[0x0][_0xcc13('0x4d')];_0x4283e1['predictiveIntervalHitRate']=_0x4bf83d>0x0?_0x4bf83d:0x1;switch(_0x4283e1['dialPredictiveOptimization']){case _0xcc13('0x1bd'):var _0x40df4f=_0x4283e1[_0xcc13('0x1ab')]/0x64;return _0x4b0d02[_0xcc13('0x1c9')](_0x41921c,_0x23c248,_0x392923,_0x4bf83d,_0x40df4f)[_0xcc13('0x97')](function(_0x19be63){return _0x5937b7(_0x19be63);});case _0xcc13('0x1ca'):var _0x23c738=_0x4283e1['dialPredictiveOptimizationPercentage']/0x64;return _0x4b0d02[_0xcc13('0x1cb')](_0x41921c,_0x23c248,_0x392923,_0x4bf83d,_0x23c738)[_0xcc13('0x97')](function(_0x1af5a1){return _0x5937b7(_0x1af5a1);});default:return _0x53feac(msgResponse(_0xcc13('0x1cc'),_0xcc13('0x8c'),'Unknown\x20Predictive'));}}else{return _0x53feac(msgResponse(_0xcc13('0x1cc'),'Failure',_0xcc13('0x1cd')));}});};};Dialer['prototype']['getDataPredictiveOld']=function(_0x205256){var _0x26c288=this;return function(_0x1aa718){return new Promise(function(_0x8f7180,_0x4f80b9){_[_0xcc13('0x57')](_0x205256,_0x1aa718[0x0]);if(checkGetDataPredictive(_0x1aa718[0x0])){loggerPredictive['info'](JSON[_0xcc13('0x70')](_0x1aa718[0x0]));if(_0x205256['dialPredictiveOptimization']===_0xcc13('0x1bd')){return _0x26c288[_0xcc13('0x142')](_0x205256['id'])['then'](function(_0x2e70db){var _0x4315be=_0x205256[_0xcc13('0x1ce')]-_0x2e70db[0x0]['outboundQueuePauses'];var _0x3f3566=_0x205256['dialPredictiveInterval']*0x3c;var _0xde60f=_0x1aa718[0x0]['predictiveIntervalAvgTalktime']+_0x1aa718[0x0][_0xcc13('0x49')];var _0x5465c7=(_0x1aa718[0x0][_0xcc13('0x46')]+_0x1aa718[0x0][_0xcc13('0x1cf')]+_0x1aa718[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x1aa718[0x0][_0xcc13('0x4d')];var _0x3d2d6f=_0x205256[_0xcc13('0x1ab')]/0x64;_0x205256[_0xcc13('0x1d0')]=_0x2e70db[0x0][_0xcc13('0x1d1')]||0x0;_0x205256[_0xcc13('0x1b1')]=_0x5465c7>0x0?_0x5465c7:0x1;return _0x26c288[_0xcc13('0x1c9')](_0x4315be,_0x3f3566,_0xde60f,_0x5465c7,_0x3d2d6f);})[_0xcc13('0x97')](function(_0x260cad){return _0x8f7180(_0x260cad);})[_0xcc13('0x99')](function(_0x4b0b39){return _0x4f80b9(msgResponse('[CatchErlangB]','Failure',JSON[_0xcc13('0x70')](_0x4b0b39)));});}if(_0x205256[_0xcc13('0x1b9')]===_0xcc13('0x1ca')){return _0x26c288[_0xcc13('0x142')](_0x205256['id'])[_0xcc13('0x97')](function(_0x42d907){var _0x8303e2=_0x205256[_0xcc13('0x1ce')]-_0x42d907[0x0]['outboundQueuePauses'];var _0x107291=_0x205256[_0xcc13('0x1b7')]*0x3c;var _0x421da1=_0x1aa718[0x0][_0xcc13('0x4b')]+_0x1aa718[0x0][_0xcc13('0x49')];var _0x15aef8=(_0x1aa718[0x0]['predictiveIntervalAnsweredCalls']+_0x1aa718[0x0][_0xcc13('0x1cf')]+_0x1aa718[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x1aa718[0x0][_0xcc13('0x4d')];var _0x291d5d=_0x205256[_0xcc13('0x1ab')]/0x64;_0x205256[_0xcc13('0x1d0')]=_0x42d907[0x0][_0xcc13('0x1d1')]||0x0;_0x205256['predictiveIntervalHitRate']=_0x15aef8>0x0?_0x15aef8:0x1;return _0x26c288[_0xcc13('0x1cb')](_0x8303e2,_0x107291,_0x421da1,_0x15aef8,_0x291d5d);})[_0xcc13('0x97')](function(_0x29e647){return _0x8f7180(_0x29e647);})[_0xcc13('0x99')](function(_0x3ca166){return _0x4f80b9(msgResponse(_0xcc13('0x1d2'),'Failure',JSON[_0xcc13('0x70')](_0x3ca166)));});}}else{return _0x4f80b9(msgResponse(_0xcc13('0x1cc'),_0xcc13('0x8c'),_0xcc13('0x1cd')));}});};};Dialer['prototype'][_0xcc13('0x1c2')]=function(_0x31fe3c){var _0x57eefe=this;return function(){var _0x211072=0x0;var _0x339645=Math[_0xcc13('0x1b0')](_0x31fe3c[_0xcc13('0x1d3')]*0x3e8);if(_0x339645>0x0){_0x339645=_0x339645<0x64?0x64:_0x339645;loggerPredictive[_0xcc13('0x42')](_0x31fe3c[_0xcc13('0x5a')],_0xcc13('0x1d4'),_0x339645,_0xcc13('0x1d5'));_0x31fe3c[_0xcc13('0x5d')]=setInterval(function(){_0x57eefe[_0xcc13('0x5d')](_0x31fe3c);loggerPredictiveCalls['info'](_0xcc13('0x1d6'),_0x211072+=0x1);},_0x339645);}else{loggerPredictive[_0xcc13('0x42')](_0x31fe3c['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xcc13('0x18')][_0xcc13('0x1d7')]=function(_0x59dbc9,_0x1fe7d1){var _0xd33cf7=this;return function(_0x4b3b4d){if(_[_0xcc13('0x41')](_0x4b3b4d)){if(_[_0xcc13('0xe6')](_0x1fe7d1['UserId'])||!_0x1fe7d1['recallme']){if(_0x59dbc9[_0xcc13('0xac')]===_0xcc13('0x8')){_0x59dbc9[_0xcc13('0x6e')]=_[_0xcc13('0x38')](_0x59dbc9[_0xcc13('0x6e')])?!![]:_0x59dbc9[_0xcc13('0x6e')];var _0x2df0d4=uuid['v4']();_0xd33cf7[_0xcc13('0xe0')][_0x2df0d4]=new Action(_0x59dbc9,_0x1fe7d1,_0x2df0d4);loggerBooked[_0xcc13('0x42')]('[booked][checkContactBlack]',_0x2df0d4,_0xcc13('0x1d8'),JSON[_0xcc13('0x70')](_0x59dbc9[_0xcc13('0x6e')]),_0xcc13('0x1d9'),_0x59dbc9[_0xcc13('0x5a')]);if(_0x59dbc9['queueStatusComplete']){_0x59dbc9[_0xcc13('0x6e')]=![];_0xd33cf7[_0xcc13('0xea')][_0xd33cf7[_0xcc13('0xe0')][_0x2df0d4][_0xcc13('0xbb')]]=[];ami[_0xcc13('0x95')]({'actionid':_0x2df0d4,'action':_0xcc13('0x1da'),'queue':_0x59dbc9[_0xcc13('0x5a')]})[_0xcc13('0x99')](function(){_0xd33cf7[_0xcc13('0xb9')](_0x59dbc9);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0xd33cf7[_0xcc13('0xe0')][_0x2df0d4][_0xcc13('0xd1')],'ListId':_0xd33cf7['actions'][_0x2df0d4][_0xcc13('0xdf')],'VoiceQueueId':_0xd33cf7[_0xcc13('0xe0')][_0x2df0d4]['VoiceQueueId']||undefined,'CampaignId':_0xd33cf7[_0xcc13('0xe0')][_0x2df0d4]['CampaignId']||undefined})['catch'](loggerCatch(_0xcc13('0x1db')));delete _0xd33cf7['actions'][_0x2df0d4];});}else{loggerBooked[_0xcc13('0x42')](_0xcc13('0x1dc'),JSON['stringify'](_0x59dbc9[_0xcc13('0x6e')]),_0xcc13('0x1d9'),_0x59dbc9[_0xcc13('0x5a')]);_0xd33cf7['updateOriginated'](_0x59dbc9);hopperUtils[_0xcc13('0xdd')]({'active':![],'ContactId':_0xd33cf7[_0xcc13('0xe0')][_0x2df0d4]['ContactId'],'ListId':_0xd33cf7[_0xcc13('0xe0')][_0x2df0d4][_0xcc13('0xdf')],'VoiceQueueId':_0xd33cf7[_0xcc13('0xe0')][_0x2df0d4][_0xcc13('0xf7')]||undefined,'CampaignId':_0xd33cf7[_0xcc13('0xe0')][_0x2df0d4][_0xcc13('0xd2')]||undefined})[_0xcc13('0x99')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0xd33cf7[_0xcc13('0xe0')][_0x2df0d4];}}else{return _0xd33cf7[_0xcc13('0x14d')](_0x59dbc9,_0x1fe7d1);}}else{if(utils[_0xcc13('0x58')](undefined,_0x1fe7d1[_0xcc13('0x1dd')])<_0x59dbc9[_0xcc13('0x1de')]*0x3c){if(_0x1fe7d1[_0xcc13('0x138')]&&!_0x1fe7d1[_0xcc13('0x138')][_0xcc13('0x1df')]){_0xd33cf7[_0xcc13('0x1b')][_0xcc13('0xec')](_0x1fe7d1['id'])[_0xcc13('0xf5')](function(){_0xd33cf7['updateOriginated'](_0x59dbc9);});}else{hopperUtils['unlockContact']({'active':![]},_0x1fe7d1['id'],0x1)[_0xcc13('0xf5')](function(){_0xd33cf7[_0xcc13('0xb9')](_0x59dbc9);});}}else{_0x59dbc9[_0xcc13('0x1e0')]+=0x1;_0xd33cf7[_0xcc13('0xb9')](_0x59dbc9);if(_0x59dbc9['dialRecallInQueue']){hopperUtils[_0xcc13('0xdd')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1fe7d1[_0xcc13('0xd1')],'ListId':_0x1fe7d1[_0xcc13('0xdf')],'VoiceQueueId':_0x1fe7d1[_0xcc13('0xf7')]||undefined,'CampaignId':_0x1fe7d1[_0xcc13('0xd2')]||undefined})['catch'](loggerCatch(_0xcc13('0x1e1')));hopperUtils[_0xcc13('0xbf')](createObjHistory(_0x59dbc9,_0x1fe7d1,utils[_0xcc13('0x68')][_0xcc13('0x1e2')],0x17,_0xcc13('0x1e3')))[_0xcc13('0x99')](loggerCatch(_0xcc13('0x1e4')));}else{_0xd33cf7['saveInDb'](createObjHistory(_0x59dbc9,_0x1fe7d1,utils[_0xcc13('0x68')][_0xcc13('0x1e5')],0x16,'RecallFailedTimeout'),_0xcc13('0x1e6'),'[Originate][HistoryRecallClose]');}}}}else{_0x59dbc9[_0xcc13('0x1e7')]+=0x1;_0xd33cf7[_0xcc13('0x106')](createObjHistory(_0x59dbc9,_0x1fe7d1,utils['CAMPAIGN_STATUS'][_0xcc13('0x1e8')],0xd,_0xcc13('0x1e9')),'[Originate][historyBlacklist]',_0xcc13('0x1ea'));throw _0xcc13('0x1eb');}};};Dialer['prototype'][_0xcc13('0x14c')]=function(_0x333211){var _0x40277e=this;var _0x344238=_0x333211[_0xcc13('0x1ec')]-_0x333211[_0xcc13('0x144')];emitCampaignSummary(_0x333211);if(_0x344238>0x0&&_0x333211[_0xcc13('0x62')]==0x0){if(_0x344238>this[_0xcc13('0x1f')]){_0x344238=this['maxNumberOriginate'];}_0x333211[_0xcc13('0x62')]=0x1;hopperUtils[_0xcc13('0x1ed')](_0x333211,_0x344238)['then'](function(_0x381236){_0x333211['temp']=0x0;if(_0x381236){if(!utils[_0xcc13('0x1ee')](_0x381236)){_0x333211[_0xcc13('0x64')]=utils[_0xcc13('0x68')][_0xcc13('0x1ef')];logger[_0xcc13('0x42')]('[getContactCampaign2][Empty]'+_0x333211[_0xcc13('0x5a')]);}else{_0x333211['originated']+=_0x381236[_0xcc13('0x93')];_0x333211['message']=utils[_0xcc13('0x68')][_0xcc13('0x1f0')];for(var _0x57a64a=0x0;_0x57a64a<_0x381236[_0xcc13('0x93')];_0x57a64a+=0x1){_0x333211['ivrTotalCallsDays']+=0x1;if(_[_0xcc13('0xe6')](_0x381236[_0x57a64a])||_['isNil'](_0x381236[_0x57a64a][_0xcc13('0x169')])||_[_0xcc13('0xe6')](_0x381236[_0x57a64a][_0xcc13('0x151')])){_0x40277e['emptyContact']('[actionOriginate]\x20',_0x333211,_0x381236[_0x57a64a]);}else{hopperUtils['checkIsBlackListIvr'](_['pick'](_0x381236[_0x57a64a],['CampaignId',_0xcc13('0x151')]))[_0xcc13('0x97')](_0x40277e[_0xcc13('0x1d7')](_0x333211,_0x381236[_0x57a64a]))[_0xcc13('0x99')](_0x40277e[_0xcc13('0x1f1')](_0xcc13('0x1f2'),_0x333211));}}}}})[_0xcc13('0x99')](loggerGetContactDialer('[getContactCampaign2]',_0x333211,_0x344238));}};Dialer[_0xcc13('0x18')][_0xcc13('0xae')]=function(_0x3f5f54,_0xc92386){var _0x5d27e9=this;var _0x500366=[];if(_0xc92386<0x1||_0x3f5f54['dialMethod']==='booked'){_0xc92386=0x1;}var _0x3f5c1b=Math[_0xcc13('0x1b0')](_0x3f5f54[_0xcc13('0x1f3')]*_0xc92386)-_0x3f5f54[_0xcc13('0x144')];if(_0x3f5f54[_0xcc13('0x1f4')]>0x0){var _0x5a0372=_0x3f5f54[_0xcc13('0x1f4')]-_0x3f5f54[_0xcc13('0x144')]-_0x3f5f54['talking']-_0x3f5f54['pTalking'];if(_0x3f5c1b>_0x5a0372){_0x3f5c1b=_0x5a0372;}}if(_0x3f5c1b>0x0&&_0x3f5f54[_0xcc13('0x62')]==0x0){if(_0x3f5f54[_0xcc13('0xac')]===_0xcc13('0x8')){_0x3f5c1b=0x1;}if(_0x3f5c1b>this[_0xcc13('0x1f')]){_0x3f5c1b=this[_0xcc13('0x1f')];}for(var _0x243c83 in this['agents']){if(typeof this['agents'][_0x243c83]!==_0xcc13('0xa5')){if(this['agents'][_0x243c83][_0xcc13('0x6a')]===_0xcc13('0x1f5')&&this['agents'][_0x243c83][_0xcc13('0x84')]===_0xcc13('0x83')){_0x500366[_0xcc13('0x94')](this[_0xcc13('0x1d')][_0x243c83]['id']);}}}_0x3f5f54[_0xcc13('0x62')]=0x1;hopperUtils['getContactDialer'](_0x3f5f54,_0x500366,_0x3f5c1b)['then'](function(_0x3cb08c){_0x3f5f54['temp']=0x0;if(_0x3cb08c){if(!utils[_0xcc13('0x1ee')](_0x3cb08c)){hopperUtils[_0xcc13('0x1f6')](_0x3f5f54)['then'](sendMessageReschedule(_0x3f5f54))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x3f5f54[_0xcc13('0x144')]+=_0x3cb08c[_0xcc13('0x93')];_0x3f5f54['message']=_0x3f5f54[_0xcc13('0xac')]==='booked'?utils[_0xcc13('0x68')]['ACTIVE']:utils[_0xcc13('0x68')][_0xcc13('0x1f0')];for(var _0x553f5b=0x0;_0x553f5b<_0x3cb08c[_0xcc13('0x93')];_0x553f5b+=0x1){if(_[_0xcc13('0xe6')](_0x3cb08c[_0x553f5b])||_[_0xcc13('0xe6')](_0x3cb08c[_0x553f5b][_0xcc13('0x169')])||_[_0xcc13('0xe6')](_0x3cb08c[_0x553f5b][_0xcc13('0x151')])){_0x5d27e9[_0xcc13('0x146')](_0xcc13('0x1f7'),_0x3f5f54,_0x3cb08c[_0x553f5b]);}else{hopperUtils[_0xcc13('0x1f8')](_['pick'](_0x3cb08c[_0x553f5b],['VoiceQueueId','phone']))[_0xcc13('0x97')](_0x5d27e9[_0xcc13('0x1d7')](_0x3f5f54,_0x3cb08c[_0x553f5b]))[_0xcc13('0x99')](_0x5d27e9[_0xcc13('0x1f1')](_0xcc13('0x1f7'),_0x3f5f54));}}}}})[_0xcc13('0x99')](loggerGetContactDialer(_0xcc13('0x1f9'),_0x3f5f54,_0x3f5c1b));}};Dialer[_0xcc13('0x18')][_0xcc13('0x5d')]=function(_0x1bb72c){if(_0x1bb72c[_0xcc13('0x1f4')]>0x0){var _0x36b6ff=_0x1bb72c[_0xcc13('0x1f4')]-_0x1bb72c[_0xcc13('0x144')]-_0x1bb72c[_0xcc13('0x12e')];if(_0x36b6ff>0x0&&_0x1bb72c[_0xcc13('0x62')]==0x0){this[_0xcc13('0x1fa')](_0x1bb72c);}else{loggerPredictiveCalls[_0xcc13('0x42')](_0xcc13('0x1fb'));}}else{this['tryOriginatePredictive'](_0x1bb72c);}};Dialer['prototype'][_0xcc13('0x1fa')]=function(_0x40dbf8){var _0x2dbd1b=this;var _0x420705=[];_0x40dbf8['originated']+=0x1;for(var _0x523ee9 in this['agents']){if(typeof this['agents'][_0x523ee9]!==_0xcc13('0xa5')){if(this[_0xcc13('0x1d')][_0x523ee9][_0xcc13('0x6a')]===_0xcc13('0x1f5')&&this[_0xcc13('0x1d')][_0x523ee9][_0xcc13('0x84')]===_0xcc13('0x83')){_0x420705[_0xcc13('0x94')](this[_0xcc13('0x1d')][_0x523ee9]['id']);}}}_0x40dbf8[_0xcc13('0x62')]=0x1;return this['getContactDialer'](_0x40dbf8['id'],_0x420705,0x1,_0x40dbf8[_0xcc13('0x1fc')],_0x40dbf8)['then'](function(_0x47074c){_0x40dbf8[_0xcc13('0x62')]=0x1;if(_0x47074c){if(!utils[_0xcc13('0x1ee')](_0x47074c)){utils['checkContactLowerLimitOriginate'](_0x40dbf8,0x1,0x0);return hopperUtils[_0xcc13('0x1f6')](_0x40dbf8)[_0xcc13('0x97')](sendMessageReschedule(_0x40dbf8))[_0xcc13('0x99')](loggerCatch(_0xcc13('0x1fd')));}else{_0x40dbf8[_0xcc13('0x64')]=utils['CAMPAIGN_STATUS'][_0xcc13('0x1f0')];if(_[_0xcc13('0xe6')](_0x47074c[0x0])||_['isNil'](_0x47074c[0x0][_0xcc13('0x169')])||_['isNil'](_0x47074c[0x0][_0xcc13('0x151')])){_0x2dbd1b[_0xcc13('0x146')](_0xcc13('0x1f7'),_0x40dbf8,_0x47074c[0x0]);}else{return hopperUtils[_0xcc13('0x1f8')](_['pick'](_0x47074c[0x0],[_0xcc13('0xf7'),_0xcc13('0x151')]))[_0xcc13('0x97')](_0x2dbd1b[_0xcc13('0x1d7')](_0x40dbf8,_0x47074c[0x0]))['catch'](_0x2dbd1b['loggerHandler'](_0xcc13('0x1fe'),_0x40dbf8));}}}})['catch'](loggerGetContactDialer('[getContactDialerPredictive]',_0x40dbf8,0x1));};Dialer[_0xcc13('0x18')][_0xcc13('0x1c9')]=function(_0x3c1edf,_0x579abb,_0x3ae721,_0x5d6eaf,_0x76d831,_0x2dd5ba){loggerPredictive['info'](_0xcc13('0x1ff'));loggerPredictive[_0xcc13('0x42')](_0xcc13('0x200'),_0x3c1edf);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x579abb);loggerPredictive[_0xcc13('0x42')](_0xcc13('0x201'),_0x3ae721);loggerPredictive[_0xcc13('0x42')]('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',_0x5d6eaf);loggerPredictive['info']('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x76d831);loggerPredictive[_0xcc13('0x42')]('---------------------------');return new Promise(function(_0x343036,_0x32138d){if(_0x3c1edf<=0x0||isNaN(_0x3c1edf)){return _0x32138d(msgResponse(_0xcc13('0x202'),'Error','m\x20=\x20'+_0x3c1edf));}if(_0x3ae721<=0x0||isNaN(_0x3ae721)){return _0x32138d(msgResponse(_0xcc13('0x202'),_0xcc13('0x7f'),'Ts\x20=\x20'+_0x3ae721));}if(_0x5d6eaf<=0x0||isNaN(_0x5d6eaf)){return _0x32138d(msgResponse(_0xcc13('0x202'),_0xcc13('0x7f'),_0xcc13('0x203')+_0x5d6eaf));}if(_0x579abb<=0x0||isNaN(_0x579abb)){return _0x32138d(msgResponse(_0xcc13('0x202'),'Error','interval\x20=\x20'+_0x579abb));}if(_0x76d831<=0x0||isNaN(_0x76d831)){return _0x32138d(msgResponse('[abandonmentRate]',_0xcc13('0x7f'),_0xcc13('0x204')+_0x76d831));}_0x2dd5ba=_0x2dd5ba||0x0;var _0x2d7026=0x1/_0x3ae721;var _0x35c304=0x0;var _0x60387e=0x0;var _0x190b71=0x0;var _0xdf5638=0x0;for(var _0x6a9ba8=0x0;_0x190b71<_0x76d831;_0x6a9ba8+=0x1){_0x60387e=_0x6a9ba8/_0x579abb;_0x35c304=(_0x5d6eaf*_0x60387e+_0x2dd5ba)/_0x2d7026;_0x190b71=utils[_0xcc13('0x205')](_0x35c304,_0x3c1edf);_0xdf5638=_0x35c304/_0x3c1edf*(0x1-utils[_0xcc13('0x205')](_0x35c304,_0x3c1edf));}return _0x343036({'erlangCalls':_0x6a9ba8,'erlangCallToSecond':_0x579abb/_0x6a9ba8,'erlangAbandonmentRate':_0x190b71,'erlangBusyFactor':_0xdf5638});});};Dialer[_0xcc13('0x18')]['busyFactor']=function(_0x3b3675,_0x14d317,_0x3e4bcd,_0x175efe,_0x23077b,_0x286816){loggerPredictive['info'](_0xcc13('0x206'));loggerPredictive[_0xcc13('0x42')]('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',_0x3b3675);loggerPredictive[_0xcc13('0x42')](_0xcc13('0x207'),_0x14d317);loggerPredictive[_0xcc13('0x42')](_0xcc13('0x201'),_0x3e4bcd);loggerPredictive[_0xcc13('0x42')]('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',_0x175efe);loggerPredictive['info'](_0xcc13('0x208'),_0x23077b);loggerPredictive[_0xcc13('0x42')](_0xcc13('0x4c'));return new Promise(function(_0x5d40b1,_0x179667){if(_0x3b3675<=0x0||isNaN(_0x3b3675)){return _0x179667(msgResponse(_0xcc13('0x209'),_0xcc13('0x7f'),_0xcc13('0x20a')+_0x3b3675));}if(_0x3e4bcd<=0x0||isNaN(_0x3e4bcd)){return _0x179667(msgResponse(_0xcc13('0x209'),_0xcc13('0x7f'),_0xcc13('0x20b')+_0x3e4bcd));}if(_0x175efe<=0x0||isNaN(_0x175efe)){return _0x179667(msgResponse(_0xcc13('0x209'),_0xcc13('0x7f'),_0xcc13('0x203')+_0x175efe));}if(_0x14d317<=0x0||isNaN(_0x14d317)){return _0x179667(msgResponse(_0xcc13('0x209'),_0xcc13('0x7f'),_0xcc13('0x20c')+_0x14d317));}if(_0x23077b<=0x0||isNaN(_0x23077b)){return _0x179667(msgResponse('[busyFactor]',_0xcc13('0x7f'),'Umin\x20=\x20'+_0x23077b));}_0x286816=_0x286816||0x0;var _0x1fd203=0x1/_0x3e4bcd;var _0x5d89c0=0x0;var _0x3edce9=0x0;var _0x397cc4=0x0;var _0x3c7dc0=0x0;for(var _0x4af7fa=0x0;_0x3c7dc0<_0x23077b;_0x4af7fa+=0x1){_0x3edce9=_0x4af7fa/_0x14d317;_0x5d89c0=(_0x175efe*_0x3edce9+_0x286816)/_0x1fd203;_0x397cc4=utils[_0xcc13('0x205')](_0x5d89c0,_0x3b3675);_0x3c7dc0=_0x5d89c0/_0x3b3675*(0x1-utils[_0xcc13('0x205')](_0x5d89c0,_0x3b3675));}return _0x5d40b1({'erlangCalls':_0x4af7fa,'erlangCallToSecond':_0x14d317/_0x4af7fa,'erlangAbandonmentRate':_0x397cc4,'erlangBusyFactor':_0x3c7dc0});});};module['exports']=Dialer; \ No newline at end of file +var _0x7564=['[syncAgentComplete][createHistory][?]','Global','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','erlangCalls','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','milliseconds','[handlePredictive]','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','getContactDialerIvr','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','checkIsBlackListIvr','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','countReScheduled','[countReScheduled]\x20','Contact','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','getContactDialer','dialOrderByScheduledAt','checkContactEmpty','checkContactLowerLimitOriginate','checkIsBlackList','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','util','lodash','./utils','./utils/hopper','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','redis','socket.io-emitter','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','startProgressive','queueBooked','agentconnect','syncAgentConnect','queuecallerabandon','bind','originateresponse','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','syncHangup','newexten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','then','previewRecallmeReminderInterval','isUndefined','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','isEmpty','info','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\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','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','temp','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','\x20Timezone\x20unknow\x20','isArray','length','Action','command','iftime\x20%s,%s','interval','timezones','content','true','push','some','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','catch','resetActiveCalls','syncCampaigns','resolve','checkIfTime','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','silly','Voice\x20Queue\x20%s\x20$s','OVERTIME_INTERVAL','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','queue','type','ivr','updateOriginated','uniqueid','answertime','YYYY-MM-DD\x20HH:mm:ss','syncAgentComplete','outboundAnswerCallsDay','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncQueueCallerAbandon','droptime','getSeconds','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','agiafterat','countdropretry','countglobal','dialDropRetryFrequency','verifyAdditionalPhones','state','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','ContactId','ListId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','countabandonedretry','dialAbandonedMaxRetry','minutes','VoiceQueueId','[rescheduleContact][Abandoned]','syncNewExten','channel','actionid','rrmemory','roundrobin','isNil','stateinterface','locked','idHopper','preview','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','paused','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','response','Success','callProgressDetecting','variable','amdstatus','exten','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','membername','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','MACHINE','Machine','AMD','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','HangupInAMD','emit','[syncHangupInAMDIvr]','moveContactManagedDialer','[syncHangupIvr]','AGI','[syncHangupIvr][createHistory]','dialQueueProject','outboundUnknownCallsDay','cause-txt','Unknow','queuesSummary','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','talking','pTalking','ACTIVE','compareToOutboundQueue','queueSummaryCountersUpdated','assign','throttle','filter','dialPreviewRecallmeReminder','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','undefined','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','[emptyContact][createHistory]','[emptyContact]','handleIvr','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','originate','NONE','\x22agi://%s/square,%s\x22','isOutboundQueue','dialQueueOptions','getCaller','XMD-AMDINITIALSILENCE','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','xcally-motion-dialer','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','checkRetriveMax','countbusyretry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberRetryFrequency','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject'];(function(_0x342024,_0x47212d){var _0x384838=function(_0x3ab3e1){while(--_0x3ab3e1){_0x342024['push'](_0x342024['shift']());}};_0x384838(++_0x47212d);}(_0x7564,0x69));var _0x4756=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x7564[_0x3ab51d];return _0x29a04e;};'use strict';var util=require(_0x4756('0x0'));var _=require(_0x4756('0x1'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var Redis=require('ioredis');var utils=require(_0x4756('0x2'));var hopperUtils=require(_0x4756('0x3'));var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require(_0x4756('0x4'))(_0x4756('0x5'));var loggerBooked=require('../../../config/logger')(_0x4756('0x6'));var loggerPredictive=require('../../../config/logger')(_0x4756('0x7'));var loggerPredictiveCalls=require('../../../config/logger')(_0x4756('0x8'));var loggerSyncQueueSummary=require(_0x4756('0x4'))(_0x4756('0x9'));var ami=require(_0x4756('0xa'));config['redis']=_[_0x4756('0xb')](config[_0x4756('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x4756('0xd'))(new Redis(config[_0x4756('0xc')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require('../rpc/setting');var Interval=require(_0x4756('0xe'));var Action=require(_0x4756('0xf'));var History=require(_0x4756('0x10'));var Final=require(_0x4756('0x11'));var AgentComplete=require(_0x4756('0x12'));var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0x4756('0x13'));var ipAgi=process[_0x4756('0x14')][_0x4756('0x15')]||_0x4756('0x16');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x4756('0x17')][_0x4756('0x18')]=function(_0x218cc9){this[_0x4756('0x19')]=this[_0x4756('0x19')]?this['tail'][_0x4756('0x1a')](_0x218cc9):_0x218cc9();};function Dialer(_0x291c29,_0x51a024){this[_0x4756('0x1b')]=new Sequence();this['preview']=_0x51a024;this[_0x4756('0x1c')]=_0x291c29['voiceQueues'];this[_0x4756('0x1d')]=_0x291c29[_0x4756('0x1d')];this[_0x4756('0x1e')]=_0x291c29[_0x4756('0x1e')];this[_0x4756('0x1f')]=_0x291c29[_0x4756('0x1f')];this['maxNumberOriginate']=config[_0x4756('0x20')]||0x2;this[_0x4756('0x21')]={};this[_0x4756('0x22')]={};this['contactsId']={};this[_0x4756('0x23')]={};this[_0x4756('0x24')]={};this[_0x4756('0x25')]={};this[_0x4756('0x26')]={};this['ivrOriginated']={};this[_0x4756('0x27')]={};this['queueBookedRR']={};this['queuesSummary']={};ami['on'](_0x4756('0x28'),this[_0x4756('0x29')]['bind'](this));ami['on'](_0x4756('0x2a'),this['syncQueueCallerAbandon'][_0x4756('0x2b')](this));ami['on'](_0x4756('0x2c'),this['syncOriginateResponse'][_0x4756('0x2b')](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0x4756('0x2b')](this));ami['on'](_0x4756('0x2d'),this[_0x4756('0x9')]['bind'](this));ami['on'](_0x4756('0x2e'),this[_0x4756('0x2f')][_0x4756('0x2b')](this));ami['on']('hangup',this[_0x4756('0x30')][_0x4756('0x2b')](this));ami['on'](_0x4756('0x31'),this['syncNewExten'][_0x4756('0x2b')](this));ami['on'](_0x4756('0x32'),this[_0x4756('0x33')][_0x4756('0x2b')](this));ami['on'](_0x4756('0x34'),this[_0x4756('0x35')]['bind'](this));ami['on'](_0x4756('0x36'),this[_0x4756('0x37')][_0x4756('0x2b')](this));this[_0x4756('0x38')]();this[_0x4756('0x39')]();RpcSetting['getSettings']()[_0x4756('0x3a')](function(_0x45761b){previewRecallmeReminderInterval=_0x45761b[_0x4756('0x3b')];});}function isNotNull(_0xf365f6){return _0xf365f6!==null&&!_[_0x4756('0x3c')](_0xf365f6);}function msgResponse(_0x3fef99,_0xb17fc1,_0x10b288){return{'action':_0x3fef99,'response':_0xb17fc1,'message':_0x10b288,'stack':_0x10b288};}function emit(_0x2d49cd,_0x1b9f3e,_0x1f428c){io['to'](_0x2d49cd)['emit'](_0x1b9f3e,_0x1f428c);}function emitOutboundVoiceQueueSummary(_0x4d5e08){if(_0x4d5e08['type']===_0x4756('0x3d')){logger[_0x4756('0x3e')](_0x4756('0x3f'),util[_0x4756('0x40')](_0x4d5e08,{'showHidden':![],'depth':null}));emit(util[_0x4756('0x41')](_0x4756('0x42'),_0x4d5e08[_0x4756('0x43')]),'voice_queue:save',_0x4d5e08);}}function checkGetDataPredictive(_0x37bb2b){if(isNotNull(_0x37bb2b)&&!_[_0x4756('0x44')](_0x37bb2b)){loggerPredictive[_0x4756('0x45')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x4756('0x45')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x37bb2b[_0x4756('0x46')]);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x37bb2b[_0x4756('0x47')]);loggerPredictive[_0x4756('0x45')](_0x4756('0x48'),_0x37bb2b['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x4756('0x45')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x37bb2b[_0x4756('0x49')]);loggerPredictive[_0x4756('0x45')](_0x4756('0x4a'),_0x37bb2b[_0x4756('0x4b')]);loggerPredictive['info'](_0x4756('0x4c'),_0x37bb2b[_0x4756('0x4d')]);loggerPredictive[_0x4756('0x45')](_0x4756('0x4e'));if(_0x37bb2b[_0x4756('0x46')]>0x0){if(!_[_0x4756('0x3c')](_0x37bb2b[_0x4756('0x4d')])&&_0x37bb2b[_0x4756('0x4d')]>0x0){return!![];}loggerPredictive[_0x4756('0x45')](_0x4756('0x4f'));if(!_[_0x4756('0x3c')](_0x37bb2b['predictiveIntervalAvgHoldtime'])&&_0x37bb2b[_0x4756('0x4b')]>0x0){return!![];}loggerPredictive[_0x4756('0x45')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x4756('0x45')](_0x4756('0x50'));}}else{loggerPredictive[_0x4756('0x45')](_0x4756('0x51'));}return![];}function mergeDataErlangB(_0x385f69){return function(_0x411106){loggerPredictive[_0x4756('0x45')](_0x4756('0x52'));loggerPredictive['info'](_0x4756('0x53'),_0x411106['erlangCalls']);loggerPredictive[_0x4756('0x45')](_0x4756('0x54'),_0x411106[_0x4756('0x55')]);loggerPredictive[_0x4756('0x45')](_0x4756('0x56'),_0x411106[_0x4756('0x57')]);loggerPredictive[_0x4756('0x45')](_0x4756('0x58'),_0x411106[_0x4756('0x59')]);loggerPredictive['info'](_0x4756('0x56'),_0x411106['erlangAbandonmentRate']);loggerPredictive[_0x4756('0x45')](_0x4756('0x4e'));_[_0x4756('0x5a')](_0x385f69,_0x411106);};}function ifInterval(_0x362e15,_0x52c3b2){if(_[_0x4756('0x3c')](_0x52c3b2)){return![];}return utils['getSeconds'](undefined,_0x52c3b2)<_0x362e15*0x3c;}function clearPredictiveAttributes(_0x449971){if(_0x449971[_0x4756('0x26')]){_0x449971[_0x4756('0x26')]=undefined;loggerPredictive[_0x4756('0x3e')](_0x449971['name'],_0x4756('0x5b'));}if(_0x449971['startPredictive']){_0x449971[_0x4756('0x25')]=undefined;loggerPredictive[_0x4756('0x3e')](_0x449971['name'],_0x4756('0x5c'));}if(_0x449971[_0x4756('0x5d')]){clearInterval(_0x449971[_0x4756('0x5d')]);_0x449971[_0x4756('0x5d')]=undefined;loggerPredictive[_0x4756('0x3e')](_0x449971[_0x4756('0x43')],_0x4756('0x5e'));}}function loggerCatchPredictive(_0x4a20f2,_0x30ae21){return function(_0x53762f){loggerPredictive[_0x4756('0x5f')](_0x30ae21['name'],_0x4a20f2);loggerPredictive[_0x4756('0x5f')](_0x53762f['stack']);clearPredictiveAttributes(_0x30ae21);};}function loggerCatch(_0x2f8cfd){return function(_0x30f7d3){logger[_0x4756('0x5f')](_0x2f8cfd,util[_0x4756('0x40')](_0x30f7d3,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x1ccdef,_0x277209,_0x5f304c){return function(_0x263150){utils['checkContactLowerLimitOriginate'](_0x277209,_0x5f304c,0x0);_0x277209[_0x4756('0x60')]=0x0;logger[_0x4756('0x5f')](_0x1ccdef,util['inspect'](_0x263150,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0xa2872d){return function(_0x20edf5){if(isNotNull(_0x20edf5)&&isNotNull(_0x20edf5[0x0])){if(_0x20edf5[0x0][_0x4756('0x61')]>0x0){_0xa2872d[_0x4756('0x62')]=utils[_0x4756('0x63')][_0x4756('0x64')];logger[_0x4756('0x45')](_0x4756('0x65')+_0xa2872d[_0x4756('0x43')],_0x20edf5[0x0][_0x4756('0x61')],_0x4756('0x66'));}else{_0xa2872d[_0x4756('0x62')]=utils[_0x4756('0x63')][_0x4756('0x67')];logger[_0x4756('0x45')](_0x4756('0x68')+_0xa2872d[_0x4756('0x43')]);}}};}function createObjHistory(_0x3d4095,_0xc2865a,_0x320264,_0x345f8d,_0x100516){_0x3d4095[_0x4756('0x62')]=_0x320264;var _0xbe986=new Action(_0x3d4095,_0xc2865a);var _0x570e76=new History(_0xbe986);_0x570e76['state']=_0x345f8d;_0x570e76[_0x4756('0x69')]=_0x100516;_0x570e76[_0x4756('0x6a')]=_0xbe986[_0x4756('0x6b')];return _0x570e76;}function unlockQueueStatus(_0x1bc70f,_0x1949a3){setTimeout(function(){if(_['isUndefined'](_0x1bc70f[_0x4756('0x6c')])){loggerBooked[_0x4756('0x5f')](_0x4756('0x6d'),_0x1949a3);}_0x1bc70f[_0x4756('0x6c')]=!![];loggerBooked[_0x4756('0x45')](_0x4756('0x6e'),_0x1949a3,JSON[_0x4756('0x6f')](_[_0x4756('0x70')](_0x1bc70f,['name',_0x4756('0x6c')])));},0x1f3);}function checkInterval(_0x3b5415){return function(){if(!isNotNull(_0x3b5415[_0x4756('0x71')])){_0x3b5415[_0x4756('0x62')]=utils[_0x4756('0x63')][_0x4756('0x72')];throw _0x3b5415[_0x4756('0x43')]+_0x4756('0x73');}if(!isNotNull(_0x3b5415['Interval'][_0x4756('0x74')])){_0x3b5415[_0x4756('0x62')]=utils['CAMPAIGN_STATUS'][_0x4756('0x72')];throw _0x3b5415['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x4756('0x44')](_0x3b5415[_0x4756('0x71')][_0x4756('0x74')]))){_0x3b5415[_0x4756('0x62')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x3b5415[_0x4756('0x43')]+_0x4756('0x73');}};}function checkIsIVRCampaignActive(_0x2cbeac){return function(){if(!utils[_0x4756('0x75')](_0x2cbeac)){_0x2cbeac[_0x4756('0x62')]=utils['CAMPAIGN_STATUS'][_0x4756('0x76')];throw _0x2cbeac[_0x4756('0x43')]+_0x4756('0x77');}};}function emitCampaignSummary(_0x44e832){if(utils[_0x4756('0x78')](_0x44e832)){emit(util[_0x4756('0x41')](_0x4756('0x79'),_0x44e832[_0x4756('0x43')]),_0x4756('0x7a'),_0x44e832);}}function loggerCatchQueueSummary(_0x1f9bb1,_0x24e6f2){return function(_0x488599){clearPredictiveAttributes(_0x24e6f2);emitCampaignSummary(_0x24e6f2);loggerSyncQueueSummary[_0x4756('0x3e')](_0x1f9bb1,util['inspect'](_0x488599,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x4b085c){if(_0x4b085c[_0x4756('0x7b')]){if(_0x4b085c[_0x4756('0x7c')]===0x0){_0x4b085c[_0x4756('0x7b')]=![];_0x4b085c['message']=utils['CAMPAIGN_STATUS'][_0x4756('0x76')];loggerSyncQueueSummary[_0x4756('0x3e')](_0x4756('0x7d'),_0x4b085c[_0x4756('0x43')],_0x4756('0x7e'));}else{_0x4b085c[_0x4756('0x62')]=utils['CAMPAIGN_STATUS'][_0x4756('0x7f')];loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x4b085c[_0x4756('0x43')],'is\x20disactive');}emitCampaignSummary(_0x4b085c);}}function myreject(_0x466f9b){return function(_0xa4aba8){return _0x466f9b(msgResponse(_0x4756('0x80'),_0x4756('0x81'),JSON[_0x4756('0x6f')](_0xa4aba8)));};}Dialer[_0x4756('0x17')][_0x4756('0x82')]=function(_0x4c5db5){return!_[_0x4756('0x3c')](_0x4c5db5)&&_0x4c5db5&&!_[_0x4756('0x3c')](_0x4c5db5[_0x4756('0x43')])&&!_[_0x4756('0x3c')](_0x4c5db5[_0x4756('0x83')])&&_0x4c5db5[_0x4756('0x83')]&&(this['trunks'][util[_0x4756('0x41')](_0x4756('0x84'),_0x4c5db5[_0x4756('0x43')])][_0x4756('0x85')]===_0x4756('0x86')||this['trunks'][util[_0x4756('0x41')](_0x4756('0x84'),_0x4c5db5['name'])][_0x4756('0x85')]===_0x4756('0x87'));};Dialer[_0x4756('0x17')][_0x4756('0x88')]=function(_0x443470){var _0x466a3b=this;return function(){if(!_0x466a3b[_0x4756('0x82')](_0x443470[_0x4756('0x89')])){if(!_0x466a3b['isTrunkReachable'](_0x443470[_0x4756('0x8a')])){_0x443470['message']=utils[_0x4756('0x63')][_0x4756('0x8b')];throw _0x443470[_0x4756('0x43')]+_0x4756('0x8c');}}};};Dialer[_0x4756('0x17')]['checkIfTime']=function(_0x566553,_0x572fc2,_0x6152c9,_0x1f48a9){var _0x373873=this;return function(){var _0x3ecd32=!![];return _0x373873[_0x4756('0x8d')](_0x566553,_0x572fc2,_0x6152c9,_0x1f48a9,_0x3ecd32);};};Dialer[_0x4756('0x17')][_0x4756('0x8e')]=function(_0xe8a5a9,_0x4ede22,_0xfa2277,_0x4b26c2){var _0x2332d7=this;return function(){var _0x4ba320=![];return _0x2332d7[_0x4756('0x8d')](_0xe8a5a9[_0x4756('0x74')],_0x4ede22,_0xfa2277,_0x4b26c2,_0x4ba320);};};Dialer['prototype'][_0x4756('0x8d')]=function(_0x3d1b56,_0x3f9dd4,_0x593493,_0x5e95ac,_0x4941c8){var _0x2b5ebb=[];return new Promise(function(_0x182a80,_0x2d2b3d){if(!isNotNull(_0x3d1b56)){_0x5e95ac[_0x4756('0x62')]=utils[_0x4756('0x63')][_0x4756('0x72')];return _0x2d2b3d(msgResponse(_0x4756('0x8f'),_0x4756('0x90'),_0x593493+'\x20Intervals\x20is\x20null\x20'));}if(_['isEmpty'](_0x3d1b56)){_0x5e95ac[_0x4756('0x62')]=utils[_0x4756('0x63')][_0x4756('0x91')];return _0x2d2b3d(msgResponse(_0x4756('0x8f'),_0x4756('0x90'),_0x593493+_0x4756('0x92')));}if(_0x3f9dd4&&_[_0x4756('0x3c')](config['timezones'][_0x3f9dd4])){_0x5e95ac[_0x4756('0x62')]=utils[_0x4756('0x63')]['UNKNOWN_TIMEZONE'];return _0x2d2b3d(msgResponse(_0x4756('0x8f'),_0x4756('0x90'),_0x593493+_0x4756('0x93')+_0x3f9dd4));}if(_[_0x4756('0x94')](_0x3d1b56)){for(var _0xedaee=0x0;_0xedaee<_0x3d1b56[_0x4756('0x95')];_0xedaee+=0x1){_0x2b5ebb['push'](ami[_0x4756('0x96')]({'action':_0x4756('0x97'),'command':util[_0x4756('0x41')](_0x4756('0x98'),_0x3d1b56[_0xedaee][_0x4756('0x99')],!_[_0x4756('0x3c')](config[_0x4756('0x9a')][_0x3f9dd4])?_0x3f9dd4:'')})[_0x4756('0x3a')](function(_0x173769){return _0x173769[_0x4756('0x9b')]['indexOf'](_0x4756('0x9c'))>=0x0;})['catch'](myreject(_0x2d2b3d)));}}else{_0x2b5ebb[_0x4756('0x9d')](ami[_0x4756('0x96')]({'action':_0x4756('0x97'),'command':util[_0x4756('0x41')](_0x4756('0x98'),_0x3d1b56,!_[_0x4756('0x3c')](config[_0x4756('0x9a')][_0x3f9dd4])?_0x3f9dd4:'')})[_0x4756('0x3a')](function(_0x5e5673){return _0x5e5673[_0x4756('0x9b')]['indexOf'](_0x4756('0x9c'))>=0x0;})['catch'](myreject(_0x2d2b3d)));}Promise['all'](_0x2b5ebb)[_0x4756('0x3a')](function(_0x3b7c9c){var _0x2c9821=_[_0x4756('0x9e')](_0x3b7c9c);if(_0x2c9821){return _0x182a80(_0x2c9821);}else{_0x5e95ac[_0x4756('0x62')]=_0x4941c8?utils['CAMPAIGN_STATUS'][_0x4756('0x9f')]:utils[_0x4756('0x63')]['OVERTIME_INTERVAL'];return _0x2d2b3d(msgResponse(_0x4756('0xa0'),_0x4756('0x90'),_0x4756('0xa1')+_0x4941c8+'\x20'+_0x593493+_0x4756('0xa2')+util[_0x4756('0x40')](_0x3d1b56,{'showHidden':![],'depth':null})+_0x4756('0xa3')+_0x3f9dd4));}})[_0x4756('0xa4')](function(_0x3f13c9){return _0x2d2b3d(msgResponse('ifTime',_0x4756('0x90'),JSON[_0x4756('0x6f')](_0x3f13c9)));});});};Dialer['prototype'][_0x4756('0x38')]=function(){var _0x839904=this;return cmHopper[_0x4756('0xa5')]({'active':![]},{'where':{'active':!![]}})[_0x4756('0x3a')](function(){setInterval(function(){_0x839904['syncCampaigns']();},0x3e8);});};Dialer[_0x4756('0x17')][_0x4756('0xa6')]=function(){var _0x4e1f4c=this;var _0x2249ab;for(var _0x168b2a in this[_0x4756('0x1d')]){if(typeof this['campaigns'][_0x168b2a]!=='undefined'){_0x2249ab=this['campaigns'][_0x168b2a];if(utils[_0x4756('0x78')](_0x2249ab)&&utils[_0x4756('0x75')](_0x2249ab)){_0x2249ab['sendMessageOneNotActive']=!![];Promise[_0x4756('0xa7')]()[_0x4756('0x3a')](checkIsIVRCampaignActive(_0x2249ab))['then'](checkInterval(_0x2249ab))['then'](_0x4e1f4c[_0x4756('0x88')](_0x2249ab))['then'](_0x4e1f4c[_0x4756('0xa8')](_0x2249ab[_0x4756('0xa9')],_0x2249ab[_0x4756('0xaa')],_0x2249ab[_0x4756('0x43')],_0x2249ab))['then'](_0x4e1f4c[_0x4756('0x8e')](_0x2249ab[_0x4756('0x71')],_0x2249ab[_0x4756('0xaa')],_0x2249ab[_0x4756('0x43')],_0x2249ab))[_0x4756('0x3a')](_0x4e1f4c[_0x4756('0xab')](_0x2249ab))[_0x4756('0xa4')](loggerCatchQueueSummary(_0x4756('0xac'),_0x2249ab));}else{notSendMessagesCampaign(_0x2249ab);}}}};Dialer[_0x4756('0x17')][_0x4756('0xad')]=function(_0x54f9ca){if(_0x54f9ca[_0x4756('0xae')]!==_0x4756('0x7')){clearPredictiveAttributes(_0x54f9ca);}switch(_0x54f9ca[_0x4756('0xae')]){case _0x4756('0xaf'):this[_0x4756('0xb0')](_0x54f9ca,0x1);break;case _0x4756('0xb1'):this[_0x4756('0xb0')](_0x54f9ca,_0x54f9ca[_0x4756('0xb2')]);break;case _0x4756('0x7'):this[_0x4756('0x7')](_0x54f9ca);break;case _0x4756('0x6'):this[_0x4756('0xb0')](_0x54f9ca,0x1);break;default:logger['error'](_0x4756('0xb3'),_0x54f9ca['name'],'method\x20not\x20recognized');}};Dialer[_0x4756('0x17')][_0x4756('0x8f')]=function(_0x379444,_0x54a6cf){var _0x33eb62=_0x379444[_0x4756('0xaa')];var _0x1712ec=_0x54a6cf?_0x379444[_0x4756('0xa9')]:_0x379444[_0x4756('0x71')][_0x4756('0x74')];logger[_0x4756('0xb4')]('Dialer::ifTime()',_0x1712ec,_0x33eb62,_0x379444[_0x4756('0x43')],util[_0x4756('0x41')](_0x4756('0xb5'),_0x379444[_0x4756('0x43')],_0x379444['id']));var _0x41dbba=null;return Interval['intervalIftime'](_0x1712ec,_0x33eb62)[_0x4756('0x3a')](function(_0x25093f){if(_0x25093f===!![]){return _0x25093f;}else{_0x379444[_0x4756('0x62')]=_0x54a6cf?utils[_0x4756('0x63')][_0x4756('0x9f')]:utils[_0x4756('0x63')][_0x4756('0xb6')];_0x41dbba=msgResponse(_0x4756('0xa0'),'Failure','Global:\x20'+_0x54a6cf+'\x20'+_0x379444['name']+_0x4756('0xa2')+util['inspect'](_0x1712ec,{'showHidden':![],'depth':null})+_0x4756('0xa3')+_0x33eb62);}if(_0x41dbba!==null){logger['silly'](_0x4756('0xb7'),_0x41dbba);_0x41dbba['isGlobal']=_0x54a6cf;throw _0x41dbba;}})[_0x4756('0xa4')](function(_0x574f9c){logger[_0x4756('0x5f')](_0x4756('0xb8'),_0x574f9c);throw msgResponse('[ifTime][Action]',_0x4756('0x81'),util['inspect'](_0x574f9c,{'showHidden':![],'depth':null}));});};Dialer[_0x4756('0x17')][_0x4756('0x29')]=function(_0x253cdc){if(this[_0x4756('0x1c')][_0x253cdc[_0x4756('0xb9')]]){if(this['uniqueId'][_0x253cdc['uniqueid']]&&this['uniqueId'][_0x253cdc['uniqueid']][_0x4756('0xba')]!==_0x4756('0xbb')){this[_0x4756('0xbc')](this['voiceQueues'][_0x253cdc['queue']]);this[_0x4756('0x23')][_0x253cdc[_0x4756('0xbd')]][_0x4756('0xbe')]=moment()[_0x4756('0x41')](_0x4756('0xbf'));}}};Dialer['prototype'][_0x4756('0xc0')]=function(_0x36c21c){var _0x34b067=this[_0x4756('0x23')][_0x36c21c['uniqueid']];if(this[_0x4756('0x1c')][_0x36c21c[_0x4756('0xb9')]]){if(_0x34b067&&_0x34b067[_0x4756('0xba')]!==_0x4756('0xbb')){delete this[_0x4756('0x23')][_0x36c21c[_0x4756('0xbd')]];this[_0x4756('0x1c')][_0x36c21c[_0x4756('0xb9')]][_0x4756('0xc1')]+=0x1;var _0x117138=new AgentComplete(_0x34b067,_0x36c21c);if(_0x36c21c['reason']==='agent'){_0x117138['agiafterat']=this[_0x4756('0x1c')][_0x36c21c[_0x4756('0xb9')]][_0x4756('0xc2')]&&this[_0x4756('0x1c')][_0x36c21c[_0x4756('0xb9')]][_0x4756('0xc3')]?moment()['format'](_0x4756('0xbf')):undefined;}hopperUtils[_0x4756('0xc4')](_0x117138)[_0x4756('0xa4')](loggerCatch(_0x4756('0xc5')));hopperUtils['moveContactManagedDialer'](_0x117138)[_0x4756('0xa4')](loggerCatch(_0x4756('0xc6')));}}};Dialer[_0x4756('0x17')][_0x4756('0xc7')]=function(_0x39c971){var _0x2e3084=this[_0x4756('0x23')][_0x39c971[_0x4756('0xbd')]];var _0x4c8296=this;var _0x1e3bbb=![];var _0xe3d6af;var _0x333cc0;if(this[_0x4756('0x1c')][_0x39c971[_0x4756('0xb9')]]){if(_0x2e3084&&_0x2e3084[_0x4756('0xba')]!==_0x4756('0xbb')){delete this['uniqueId'][_0x39c971[_0x4756('0xbd')]];this[_0x4756('0xbc')](this[_0x4756('0x1c')][_0x39c971[_0x4756('0xb9')]]);_0x2e3084[_0x4756('0xc8')]=moment()[_0x4756('0x41')]('YYYY-MM-DD\x20HH:mm:ss');var _0x292846=new QueueCallerAbandon(_0x2e3084,_0x39c971);if(utils[_0x4756('0xc9')](_0x2e3084['droptime'],_0x2e3084[_0x4756('0xca')])>=_0x2e3084[_0x4756('0xcb')]){this[_0x4756('0x1c')][_0x39c971[_0x4756('0xb9')]][_0x4756('0xcc')]+=0x1;this[_0x4756('0x1c')][_0x39c971[_0x4756('0xb9')]][_0x4756('0xcd')]+=0x1;this[_0x4756('0x1c')][_0x39c971[_0x4756('0xb9')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x292846['state']=0xa;_0x292846[_0x4756('0x69')]=_0x4756('0xce');_0x292846[_0x4756('0xcf')]=_0x4756('0xd0');_0x292846[_0x4756('0xd1')]=this[_0x4756('0x1c')][_0x39c971['queue']][_0x4756('0xc2')]?moment()[_0x4756('0x41')](_0x4756('0xbf')):undefined;_0x292846[_0x4756('0xd2')]+=0x1;_0x292846[_0x4756('0xd3')]+=0x1;_0xe3d6af=this[_0x4756('0x1c')][_0x39c971[_0x4756('0xb9')]][_0x4756('0xd4')];_0x333cc0=this[_0x4756('0x1c')][_0x39c971[_0x4756('0xb9')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x4756('0xd5')](_0x292846,_0x292846[_0x4756('0xd6')],_0x2e3084['voiceQueue'])[_0x4756('0x3a')](function(_0x35ea0c){_0x1e3bbb=_0x35ea0c[_0x4756('0xd7')]==0x1;if(_0x292846[_0x4756('0xd2')]>=_0x4c8296[_0x4756('0x1c')][_0x39c971[_0x4756('0xb9')]][_0x4756('0xd8')]){_0x4c8296[_0x4756('0xd9')](_0x292846,_0x35ea0c[_0x4756('0xd7')]);}else{hopperUtils[_0x4756('0xda')]({'active':![],'countdropretry':_0x292846[_0x4756('0xd2')],'scheduledat':moment()[_0x4756('0xdb')](_0x4c8296['voiceQueues'][_0x39c971[_0x4756('0xb9')]][_0x4756('0xd4')],'minutes')[_0x4756('0x41')](_0x4756('0xbf')),'ContactId':_0x2e3084[_0x4756('0xdc')],'ListId':_0x2e3084[_0x4756('0xdd')],'VoiceQueueId':_0x2e3084['VoiceQueueId']||undefined,'CampaignId':_0x2e3084[_0x4756('0xde')]||undefined})[_0x4756('0xa4')](loggerCatch(_0x4756('0xdf')));var _0x350406=new History(_0x292846);_0x350406[_0x4756('0xd6')]=0xa;_0x350406[_0x4756('0x69')]='Drop';_0x350406['starttime']=moment()['format'](_0x4756('0xbf'));_0x350406[_0x4756('0x6a')]=_0x350406[_0x4756('0x6b')];_0x350406[_0x4756('0xe0')]=_0x292846['calleridname'];_0x350406[_0x4756('0xe1')]=_0x292846[_0x4756('0xe1')];hopperUtils[_0x4756('0xc4')](_0x350406)[_0x4756('0xa4')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})['then'](function(){if(_0x1e3bbb)hopperUtils[_0x4756('0xe2')](_0x292846,_0xe3d6af,_0x333cc0)['then'](function(){return 0x1;});});}else{this['voiceQueues'][_0x39c971[_0x4756('0xb9')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x4756('0x1c')][_0x39c971[_0x4756('0xb9')]][_0x4756('0xe3')]+=0x1;_0x292846[_0x4756('0xd6')]=0xb;_0x292846[_0x4756('0x69')]=_0x4756('0xe4');_0x292846['dropreason']=_0x4756('0xe5');_0x292846['countabandonedretry']+=0x1;_0x292846[_0x4756('0xd3')]+=0x1;_0xe3d6af=this[_0x4756('0x1c')][_0x39c971[_0x4756('0xb9')]][_0x4756('0xe6')];_0x333cc0=this[_0x4756('0x1c')][_0x39c971['queue']][_0x4756('0xe7')];hopperUtils[_0x4756('0xd5')](_0x292846,_0x292846[_0x4756('0xd6')],_0x2e3084[_0x4756('0xe8')])['then'](function(_0x407d84){if(_0x292846[_0x4756('0xe9')]>=_0x4c8296[_0x4756('0x1c')][_0x39c971['queue']][_0x4756('0xea')]){_0x4c8296['queueCallerAbandonCreateState'](_0x292846,_0x407d84['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x292846[_0x4756('0xe9')],'scheduledat':moment()[_0x4756('0xdb')](_0x4c8296[_0x4756('0x1c')][_0x39c971[_0x4756('0xb9')]][_0x4756('0xe6')],_0x4756('0xeb'))[_0x4756('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2e3084[_0x4756('0xdc')],'ListId':_0x2e3084[_0x4756('0xdd')],'VoiceQueueId':_0x2e3084[_0x4756('0xec')]||undefined,'CampaignId':_0x2e3084['CampaignId']||undefined})[_0x4756('0xa4')](loggerCatch(_0x4756('0xed')));var _0x1a948d=new History(_0x292846);_0x1a948d['state']=0xb;_0x1a948d[_0x4756('0x69')]='Abandoned';_0x1a948d['starttime']=moment()[_0x4756('0x41')](_0x4756('0xbf'));_0x1a948d[_0x4756('0x6a')]=_0x1a948d[_0x4756('0x6b')];_0x1a948d[_0x4756('0xe0')]=_0x292846[_0x4756('0xe0')];_0x1a948d[_0x4756('0xe1')]=_0x292846['calleridnum'];hopperUtils[_0x4756('0xc4')](_0x1a948d)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0x4756('0x3a')](function(){if(_0x1e3bbb)hopperUtils[_0x4756('0xe2')](_0x292846,_0xe3d6af,_0x333cc0)[_0x4756('0x3a')](function(){return 0x1;});});}}}};Dialer['prototype'][_0x4756('0xee')]=function(_0x1ea410){if(this[_0x4756('0x22')][_0x1ea410[_0x4756('0xbd')]]){this[_0x4756('0x22')][_0x1ea410[_0x4756('0xbd')]][_0x4756('0xef')]=_0x1ea410[_0x4756('0xef')];}if(this[_0x4756('0x23')][_0x1ea410[_0x4756('0xbd')]]){this[_0x4756('0x23')][_0x1ea410['uniqueid']][_0x4756('0xef')]=_0x1ea410[_0x4756('0xef')];}};Dialer[_0x4756('0x17')][_0x4756('0x35')]=function(_0x5ed610){if(!this[_0x4756('0x22')][_0x5ed610[_0x4756('0xf0')]]){return;}var _0x673b6=this[_0x4756('0x1c')][this['actions'][_0x5ed610[_0x4756('0xf0')]][_0x4756('0xb9')]]['strategy']||_0x4756('0xf1');if(_0x673b6===_0x4756('0xf2')){if(this[_0x4756('0x22')][_0x5ed610[_0x4756('0xf0')]]&&_[_0x4756('0xf3')](this['actions'][_0x5ed610[_0x4756('0xf0')]]['locked'])&&_0x5ed610[_0x4756('0x85')]==='1'&&_0x5ed610['paused']==='0'){if(this['agents'][_0x5ed610['stateinterface']]){if(!this[_0x4756('0x1e')][_0x5ed610[_0x4756('0xf4')]][_0x4756('0xf5')]){this['agents'][_0x5ed610[_0x4756('0xf4')]][_0x4756('0xf5')]=!![];this[_0x4756('0x22')][_0x5ed610[_0x4756('0xf0')]][_0x4756('0xf5')]=!![];this[_0x4756('0x22')][_0x5ed610[_0x4756('0xf0')]]['stateinterface']=_0x5ed610[_0x4756('0xf4')];}}}}else if(_0x673b6===_0x4756('0xf1')){if(this[_0x4756('0x22')][_0x5ed610['actionid']]){if(this[_0x4756('0x1e')][_0x5ed610[_0x4756('0xf4')]]){this[_0x4756('0x22')][_0x5ed610[_0x4756('0xf0')]]['stateinterface']=_0x5ed610['stateinterface'];if(_[_0x4756('0xf3')](this[_0x4756('0x27')][this[_0x4756('0x22')][_0x5ed610[_0x4756('0xf0')]][_0x4756('0xb9')]])){this[_0x4756('0x27')][this['actions'][_0x5ed610[_0x4756('0xf0')]][_0x4756('0xb9')]]=[];}this[_0x4756('0x27')][this[_0x4756('0x22')][_0x5ed610[_0x4756('0xf0')]][_0x4756('0xb9')]][_0x4756('0x9d')](_['merge'](_['pick'](this[_0x4756('0x22')][_0x5ed610[_0x4756('0xf0')]],[_0x4756('0xf6'),_0x4756('0xf4')]),{'status':_0x5ed610[_0x4756('0x85')],'paused':_0x5ed610['paused']}));}}}};Dialer[_0x4756('0x17')][_0x4756('0x37')]=function(_0x1c5058){if(!this[_0x4756('0x22')][_0x1c5058[_0x4756('0xf0')]]){return;}var _0x59d549=this;var _0x2c3f53=this[_0x4756('0x1c')][this[_0x4756('0x22')][_0x1c5058[_0x4756('0xf0')]][_0x4756('0xb9')]];var _0x2e48fa=_0x2c3f53['strategy']||'rrmemory';if(_0x2e48fa==='roundrobin'){if(this[_0x4756('0x22')][_0x1c5058[_0x4756('0xf0')]]&&this['actions'][_0x1c5058[_0x4756('0xf0')]][_0x4756('0xf4')]){this[_0x4756('0xf7')]['run'](this[_0x4756('0x22')][_0x1c5058['actionid']][_0x4756('0xf6')],this[_0x4756('0x22')][_0x1c5058['actionid']][_0x4756('0xf4')])[_0x4756('0xa4')](function(_0x1de759){logger[_0x4756('0x5f')](_0x4756('0xf8'),util[_0x4756('0x40')](_0x1de759,{'showHidden':![],'depth':null}));})[_0x4756('0x1a')](function(){_0x59d549[_0x4756('0xbc')](_0x59d549[_0x4756('0x1c')][_0x59d549[_0x4756('0x22')][_0x1c5058[_0x4756('0xf0')]][_0x4756('0xb9')]]);_0x59d549[_0x4756('0x1e')][_0x59d549['actions'][_0x1c5058[_0x4756('0xf0')]][_0x4756('0xf4')]]['locked']=![];delete _0x59d549[_0x4756('0x22')][_0x1c5058['actionid']];unlockQueueStatus(_0x2c3f53);});}else{this['updateOriginated'](this[_0x4756('0x1c')][this[_0x4756('0x22')][_0x1c5058[_0x4756('0xf0')]][_0x4756('0xb9')]]);hopperUtils[_0x4756('0xda')]({'active':![],'ContactId':this['actions'][_0x1c5058['actionid']][_0x4756('0xdc')],'ListId':this['actions'][_0x1c5058[_0x4756('0xf0')]][_0x4756('0xdd')],'VoiceQueueId':this[_0x4756('0x22')][_0x1c5058[_0x4756('0xf0')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x4756('0x22')][_0x1c5058[_0x4756('0xf0')]][_0x4756('0xde')]||undefined})[_0x4756('0xa4')](loggerCatch(_0x4756('0xf9')));delete this[_0x4756('0x22')][_0x1c5058[_0x4756('0xf0')]];unlockQueueStatus(_0x2c3f53);}}else if(_0x2e48fa===_0x4756('0xf1')){var _0x45b94c;if(this['actions'][_0x1c5058[_0x4756('0xf0')]]&&!_['isEmpty'](this[_0x4756('0x27')][this[_0x4756('0x22')][_0x1c5058['actionid']][_0x4756('0xb9')]])){if(this[_0x4756('0xfa')][_0x59d549['actions'][_0x1c5058[_0x4756('0xf0')]]['queue']]){this[_0x4756('0xfa')][_0x59d549[_0x4756('0x22')][_0x1c5058[_0x4756('0xf0')]][_0x4756('0xb9')]]=this[_0x4756('0xfa')][this[_0x4756('0x22')][_0x1c5058['actionid']]['queue']]?this['queueBookedRR'][this[_0x4756('0x22')][_0x1c5058[_0x4756('0xf0')]][_0x4756('0xb9')]]:this[_0x4756('0x27')][this[_0x4756('0x22')][_0x1c5058[_0x4756('0xf0')]][_0x4756('0xb9')]]?this[_0x4756('0x27')][this[_0x4756('0x22')][_0x1c5058[_0x4756('0xf0')]][_0x4756('0xb9')]][_0x4756('0xfb')]||0x0:0x0;}this[_0x4756('0x27')][this[_0x4756('0x22')][_0x1c5058[_0x4756('0xf0')]][_0x4756('0xb9')]][_0x4756('0xfb')]=this[_0x4756('0xfa')][this['actions'][_0x1c5058[_0x4756('0xf0')]]['queue']];for(var _0x61575b=0x0;_0x61575b=_0x3f3613[_0x4756('0x122')]){_0x397ae2[_0x4756('0x123')](_0x41c40d,_0x44b737,_0x2cf7d3,_0x4756('0x124'));}else{if(_0x41c40d[_0x4756('0x120')]>=_0x3f3613[_0x4756('0x125')]){_0x397ae2[_0x4756('0x126')](_0x41c40d,_0x44b737,_0x2cf7d3,_0x4756('0x127'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x41c40d[_0x4756('0x120')],'scheduledat':moment()['add'](_0x3f3613[_0x4756('0x128')],_0x4756('0xeb'))[_0x4756('0x41')](_0x4756('0xbf')),'ContactId':_0x41c40d['ContactId'],'ListId':_0x41c40d['ListId'],'VoiceQueueId':_0x41c40d[_0x4756('0xec')]||undefined,'CampaignId':_0x41c40d[_0x4756('0xde')]||undefined})[_0x4756('0xa4')](loggerCatch(_0x4756('0x129')));_0x44b737({'reschedule':0x1});}}});}if(_0xc75f5b[_0x4756('0xba')]===_0x4756('0xbb')&&this[_0x4756('0x1d')][_0xc75f5b['queue']][_0x4756('0x10f')]&&_0x4d57d1['value']==='HANGUP'){delete this['uniqueId'][_0x4d57d1['uniqueid']];this[_0x4756('0xbc')](this['campaigns'][_0xc75f5b['queue']]);_0xd86a32=new Hangup(_0xc75f5b,_0x4d57d1);_0xd86a32[_0x4756('0xd6')]=0x12;_0xd86a32[_0x4756('0x69')]=_0x4756('0x12a');_0xd86a32[_0x4756('0x113')]=_0x4756('0x11b');ami[_0x4756('0x12b')](_0x4756('0x114'),ut['buildObj'](_0xd86a32,_0x4756('0x116')));this['saveInDb'](_0xd86a32,'[syncHangupInAMDIvr][createHistory]',_0x4756('0x12c'));}if(_0xc75f5b[_0x4756('0xba')]===_0x4756('0xbb')&&this['campaigns'][_0xc75f5b[_0x4756('0xb9')]][_0x4756('0x10f')]&&_0x4d57d1['value']===_0x4756('0x119')){return new Promise(function(_0x5a2592,_0x265bdf){delete _0x397ae2[_0x4756('0x23')][_0x4d57d1['uniqueid']];_0x397ae2[_0x4756('0xbc')](_0x397ae2[_0x4756('0x1d')][_0xc75f5b[_0x4756('0xb9')]]);_0x397ae2[_0x4756('0x1d')][_0xc75f5b['queue']]['outboundAnswerCallsDay']+=0x1;_0x397ae2[_0x4756('0x1d')][_0xc75f5b['queue']][_0x4756('0x112')]+=0x1;var _0x33dafe=_0x397ae2[_0x4756('0x1d')][_0xc75f5b['queue']];var _0x440ee5=new Hangup(_0xc75f5b,_0x4d57d1);_0x440ee5[_0x4756('0xd6')]=0x13;_0x440ee5['statedesc']=_0x4756('0x11a');_0x440ee5[_0x4756('0x113')]='AMD';_0x440ee5['countmachineretry']+=0x1;_0x440ee5[_0x4756('0xd3')]+=0x1;_0x440ee5[_0x4756('0x116')]=!![];ami['emit'](_0x4756('0x114'),ut[_0x4756('0x115')](_0x440ee5,_0x4756('0x116')));hopperUtils[_0x4756('0xc4')](_0x440ee5)['catch'](loggerCatch(_0x4756('0x11c')));if(_0x440ee5['countbusyretry']+_0x440ee5[_0x4756('0x11d')]+_0x440ee5[_0x4756('0x11e')]+_0x440ee5['countnosuchnumberretry']+_0x440ee5['countdropretry']+_0x440ee5[_0x4756('0xe9')]+_0x440ee5[_0x4756('0x120')]+_0x440ee5['countagentrejectretry']>=_0x33dafe['dialGlobalMaxRetry']){_0x397ae2[_0x4756('0x123')](_0x440ee5,_0x5a2592,_0x265bdf,'reason19\x20machine....');}else{if(_0x440ee5[_0x4756('0x120')]>=_0x33dafe['dialMachineMaxRetry']){_0x397ae2[_0x4756('0x126')](_0x440ee5,_0x5a2592,_0x265bdf,'reason\x2019\x20machine....');}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x440ee5['countmachineretry'],'scheduledat':moment()['add'](_0x33dafe[_0x4756('0x128')],'minutes')[_0x4756('0x41')](_0x4756('0xbf')),'ContactId':_0x440ee5['ContactId'],'ListId':_0x440ee5[_0x4756('0xdd')],'VoiceQueueId':_0x440ee5[_0x4756('0xec')]||undefined,'CampaignId':_0x440ee5['CampaignId']||undefined})[_0x4756('0xa4')](loggerCatch(_0x4756('0x129')));_0x5a2592({'reschedule':0x1});}}});}}};Dialer[_0x4756('0x17')][_0x4756('0x30')]=function(_0x4f0d08){var _0x17a30c=this[_0x4756('0x23')][_0x4f0d08[_0x4756('0xbd')]];var _0x121feb;if(_0x17a30c&&_0x17a30c['type']===_0x4756('0xbb')){delete this[_0x4756('0x23')][_0x4f0d08['uniqueid']];this['updateOriginated'](this['campaigns'][_0x17a30c[_0x4756('0xb9')]]);this['campaigns'][_0x17a30c[_0x4756('0xb9')]]['ivrAnswerCallsDay']+=0x1;_0x121feb=new Hangup(_0x17a30c,_0x4f0d08);hopperUtils[_0x4756('0xc4')](_0x121feb)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x4756('0x12d')](_0x121feb)[_0x4756('0xa4')](loggerCatch(_0x4756('0x12e')));}if(_0x17a30c&&_0x17a30c[_0x4756('0xba')]!=='ivr'&&isNotNull(this[_0x4756('0x1c')][_0x17a30c[_0x4756('0xb9')]]['dialQueueProject'])){delete this[_0x4756('0x23')][_0x4f0d08[_0x4756('0xbd')]];this[_0x4756('0xbc')](this['voiceQueues'][_0x17a30c[_0x4756('0xb9')]]);this[_0x4756('0x1c')][_0x17a30c[_0x4756('0xb9')]][_0x4756('0xc1')]+=0x1;this[_0x4756('0x1c')][_0x17a30c['queue']][_0x4756('0x112')]+=0x1;_0x121feb=new Hangup(_0x17a30c,_0x4f0d08);_0x121feb[_0x4756('0xd6')]=0x10;_0x121feb[_0x4756('0x69')]='AnswerAGI';_0x121feb[_0x4756('0x113')]=_0x4756('0x12f');hopperUtils[_0x4756('0xc4')](_0x121feb)['catch'](loggerCatch(_0x4756('0x130')));hopperUtils['moveContactManagedDialer'](_0x121feb)[_0x4756('0xa4')](loggerCatch(_0x4756('0x12e')));}if(_0x17a30c&&_0x17a30c[_0x4756('0xba')]!==_0x4756('0xbb')&&!isNotNull(this['voiceQueues'][_0x17a30c['queue']][_0x4756('0x131')])){delete this[_0x4756('0x23')][_0x4f0d08[_0x4756('0xbd')]];this[_0x4756('0xbc')](this[_0x4756('0x1c')][_0x17a30c[_0x4756('0xb9')]]);this['voiceQueues'][_0x17a30c[_0x4756('0xb9')]][_0x4756('0x132')]+=0x1;_0x121feb=new Hangup(_0x17a30c,_0x4f0d08);_0x121feb['state']=0xc;_0x121feb[_0x4756('0x69')]=_0x4f0d08[_0x4756('0x133')];_0x121feb[_0x4756('0x113')]=_0x4756('0x134');hopperUtils[_0x4756('0xc4')](_0x121feb)[_0x4756('0xa4')](loggerCatch(_0x4756('0x130')));hopperUtils['moveContactManagedDialer'](_0x121feb)[_0x4756('0xa4')](loggerCatch(_0x4756('0x12e')));}};Dialer[_0x4756('0x17')][_0x4756('0x9')]=function(_0x177fd6){var _0x5202f0=this;if(!_0x5202f0[_0x4756('0x135')][_0x177fd6[_0x4756('0x43')]]){_0x5202f0[_0x4756('0x135')][_0x177fd6['name']]={'running':![]};}else if(_0x5202f0[_0x4756('0x135')][_0x177fd6[_0x4756('0x43')]][_0x4756('0x136')]===!![]){return;}else if(_0x5202f0[_0x4756('0x135')][_0x177fd6[_0x4756('0x43')]][_0x4756('0x136')]===![]){_0x5202f0[_0x4756('0x135')][_0x177fd6[_0x4756('0x43')]][_0x4756('0x136')]=!![];}var _0x1a00a9=_0x5202f0['voiceQueues'][_0x177fd6[_0x4756('0x43')]];var _0x322540=_0x1a00a9[_0x4756('0x62')]!==utils[_0x4756('0x63')][_0x4756('0x76')];var _0x4fd697=utils[_0x4756('0x137')](_0x1a00a9);_0x1a00a9[_0x4756('0x138')]=utils[_0x4756('0x139')](_0x1a00a9,_0x5202f0[_0x4756('0x1f')]);Promise['resolve']()['then'](function(){if(_0x1a00a9[_0x4756('0x138')]===utils[_0x4756('0x63')][_0x4756('0x76')]){if(_0x322540){clearPredictiveAttributes(_0x1a00a9);_0x177fd6['startPredictive']=undefined;_0x177fd6[_0x4756('0x26')]=undefined;}if(_0x1a00a9[_0x4756('0x138')]===utils[_0x4756('0x63')][_0x4756('0x76')]){_0x177fd6[_0x4756('0x13a')]=0x0;_0x177fd6['paused']=0x0;_0x177fd6[_0x4756('0x13b')]=0x0;_0x177fd6[_0x4756('0x13c')]=0x0;_0x177fd6[_0x4756('0x13d')]=0x0;}}else if(_0x1a00a9[_0x4756('0x138')]===utils[_0x4756('0x63')][_0x4756('0x13e')]&&!_0x4fd697){return _0x5202f0[_0x4756('0x8f')](_0x1a00a9,!![])[_0x4756('0x3a')](function(){return _0x5202f0[_0x4756('0x8f')](_0x1a00a9,![]);})[_0x4756('0x3a')](function(){return _0x5202f0[_0x4756('0xad')](_0x1a00a9);})[_0x4756('0xa4')](function(_0x103836){loggerSyncQueueSummary['debug']('[syncQueueSummary]',util[_0x4756('0x40')](_0x103836,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x1a00a9);});}else{clearPredictiveAttributes(_0x1a00a9);}})[_0x4756('0x3a')](function(){var _0x1c1c9c=_0x177fd6[_0x4756('0x13f')](_0x1a00a9);if(_0x1c1c9c||_0x1a00a9[_0x4756('0x140')]){_0x1a00a9[_0x4756('0x140')]=![];_0x177fd6['updateReportFromOutboundQueue'](_0x1a00a9);Object[_0x4756('0x141')](_0x1a00a9,_0x177fd6);emitOutboundVoiceQueueSummary(_0x177fd6);}_0x5202f0['queuesSummary'][_0x1a00a9[_0x4756('0x43')]]['running']=![];})[_0x4756('0xa4')](function(_0x34f5f0){logger[_0x4756('0x5f')]('[syncQueueSummary]',util[_0x4756('0x40')](_0x34f5f0,{'showHidden':![],'depth':null}));_0x5202f0[_0x4756('0x135')][_0x1a00a9['name']]['running']=![];});};Dialer[_0x4756('0x17')][_0x4756('0x2f')]=_[_0x4756('0x142')](function(){var _0x11ac4a=_[_0x4756('0x143')](this[_0x4756('0x1c')],function(_0x22c8f8){return _0x22c8f8[_0x4756('0x144')];});var _0x5da24d=_[_0x4756('0x143')](this[_0x4756('0x1e')],function(_0x20fa88){return _0x20fa88['online']&&_0x20fa88['status']===_0x4756('0x86');});if(_0x11ac4a[_0x4756('0x95')]>0x0&&_0x5da24d[_0x4756('0x95')]>0x0){return Promise['resolve']()[_0x4756('0x3a')](cmHopper[_0x4756('0x145')](_[_0x4756('0x146')](_0x11ac4a,'id'),previewRecallmeReminderInterval,_['map'](_0x5da24d,'id')))[_0x4756('0x3a')](function(_0xb87974){for(var _0x1d96c3=0x0;_0x1d96c3<_0xb87974[_0x4756('0x95')];_0x1d96c3++){var _0x4ef18a=_0xb87974[_0x1d96c3][_0x4756('0x147')][_0x4756('0x43')];if(_0x4ef18a)io['to'](util[_0x4756('0x41')](_0x4756('0x148'),_0x4ef18a))[_0x4756('0x12b')](_0x4756('0x149'),{'hopper':_0xb87974[_0x1d96c3]});}})[_0x4756('0xa4')](function(_0x1159a1){logger[_0x4756('0x5f')](_0x4756('0x14a'),_0x1159a1);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x4756('0x17')][_0x4756('0x39')]=function(){var _0x279bb1=this;setInterval(function(){_0x279bb1[_0x4756('0x14b')](_0x279bb1[_0x4756('0x23')],_0x4756('0x14c'));_0x279bb1[_0x4756('0x14b')](_0x279bb1[_0x4756('0x22')],_0x4756('0x14d'));},0x32c8);};Dialer[_0x4756('0x17')][_0x4756('0x14b')]=function(_0x35ec0a,_0x1306bb){var _0x128bdc=this;for(var _0x5be06a in _0x35ec0a){if(typeof _0x35ec0a[_0x5be06a]!==_0x4756('0x14e')){this[_0x4756('0x1b')][_0x4756('0x18')](function(){if(!_[_0x4756('0xf3')](_0x35ec0a[_0x5be06a])){return ami['Action']({'action':_0x4756('0x85'),'channel':_0x35ec0a[_0x5be06a][_0x4756('0xef')]})['catch'](function(_0x56c2fd){if(_0x56c2fd[_0x4756('0x62')]===_0x4756('0x14f')){setTimeout(function(){if(_0x35ec0a[_0x5be06a]&&_0x35ec0a[_0x5be06a][_0x4756('0xba')]!==_0x4756('0xbb')){_0x128bdc[_0x4756('0xbc')](_0x128bdc['voiceQueues'][_0x35ec0a[_0x5be06a][_0x4756('0xb9')]]);logger[_0x4756('0x5f')](_0x4756('0x150'),_0x1306bb,_0x5be06a,_0x35ec0a[_0x5be06a][_0x4756('0xb9')]);delete _0x35ec0a[_0x5be06a];}if(_0x35ec0a[_0x5be06a]&&_0x35ec0a[_0x5be06a][_0x4756('0xba')]===_0x4756('0xbb')){_0x128bdc['updateOriginated'](_0x128bdc[_0x4756('0x1d')][_0x35ec0a[_0x5be06a]['queue']]);logger[_0x4756('0x5f')](_0x4756('0x151'),_0x1306bb,_0x5be06a,_0x35ec0a[_0x5be06a][_0x4756('0xb9')]);delete _0x35ec0a[_0x5be06a];}},0x2328);}});}});}}};Dialer[_0x4756('0x17')][_0x4756('0x152')]=function(_0x5a5cf7){return Promise[_0x4756('0xa7')]()[_0x4756('0x3a')](voiceQueueRt['getVoiceQueueRtPauses'](_0x5a5cf7))[_0x4756('0xa4')](loggerCatch(_0x4756('0x153')));};Dialer[_0x4756('0x17')][_0x4756('0xbc')]=function(_0x11818f){if(!_[_0x4756('0x3c')](_0x11818f)&&_0x11818f!==null){if(typeof _0x11818f[_0x4756('0x7c')]!==_0x4756('0x14e')){if(_0x11818f['originated']>0x0){_0x11818f['originated']-=0x1;}else{logger[_0x4756('0x5f')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x4756('0x5f')](_0x4756('0x154'));}};Dialer[_0x4756('0x17')]['loggerHandler']=function(_0x1c403b,_0x43ef39){var _0x2205fb=this;return function(_0x2c5491){_0x2205fb[_0x4756('0xbc')](_0x43ef39);logger[_0x4756('0x5f')](_0x1c403b,util[_0x4756('0x40')](_0x2c5491,{'showHidden':![],'depth':null}));};};Dialer[_0x4756('0x17')][_0x4756('0x155')]=function(_0x1c1a60,_0x14d808,_0xd92267){var _0x597465={'state':0x19,'statedesc':_0x4756('0x156')};this[_0x4756('0xbc')](_0x14d808);this[_0x4756('0x117')](_['merge'](_0x597465,_[_0x4756('0x70')](_0xd92267,[_0x4756('0xdc'),_0x4756('0xdd'),'UserId',_0x4756('0xec'),_0x4756('0xde')])),_0x4756('0x157'),_0x4756('0x158'));logger[_0x4756('0x5f')](_0x1c1a60);};Dialer['prototype']['saveInDb']=function(_0x37eef4,_0x3e3cb8,_0x1122ff){hopperUtils[_0x4756('0xc4')](_0x37eef4)[_0x4756('0xa4')](loggerCatch(_0x3e3cb8));hopperUtils[_0x4756('0x12d')](_0x37eef4)[_0x4756('0xa4')](loggerCatch(_0x1122ff));};Dialer[_0x4756('0x17')][_0x4756('0xd9')]=function(_0x281f15,_0x2bd7cc){hopperUtils[_0x4756('0xc4')](_0x281f15)['catch'](loggerCatch(_0x4756('0xc5')));if(_0x2bd7cc==0x0){hopperUtils[_0x4756('0x12d')](_0x281f15)[_0x4756('0xa4')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer['prototype'][_0x4756('0x14a')]=function(_0x1e67ce){return Promise[_0x4756('0xa7')]()[_0x4756('0x3a')](cmHopper[_0x4756('0x145')](_0x1e67ce['id'],previewRecallmeReminderInterval))[_0x4756('0x3a')](function(_0x1bf26e){for(var _0x207cff=0x0;_0x207cff<_0x1bf26e[_0x4756('0x95')];_0x207cff++){var _0x279f83=_0x1bf26e[_0x207cff][_0x4756('0x147')][_0x4756('0x43')];if(_0x279f83)io['to'](util[_0x4756('0x41')]('user:%s',_0x279f83))[_0x4756('0x12b')](_0x4756('0x149'),{'hopper':_0x1bf26e[_0x207cff]});}})[_0x4756('0xa4')](function(){});};Dialer[_0x4756('0x17')][_0x4756('0xab')]=function(_0x4d3440){var _0x2224c4=this;return function(){_0x2224c4[_0x4756('0x159')](_0x4d3440);};};Dialer[_0x4756('0x17')][_0x4756('0x15a')]=function(_0x496485,_0xa1774c){var _0x529c97=this;var _0x1d1d8d=uuid['v4']();this['actions'][_0x1d1d8d]=new Action(_0x496485,_0xa1774c,_0x1d1d8d);return new Promise(function(_0x251bb6,_0x3941c9){if(_[_0x4756('0x3c')](_0x496485)&&typeof _0x496485!==_0x4756('0x15b')){return _0x3941c9(msgResponse('originate',_0x4756('0x90'),_0x4756('0x15c')));}if(_[_0x4756('0x3c')](_0xa1774c[_0x4756('0x15d')])||_0xa1774c[_0x4756('0x15d')]===null){return _0x3941c9(msgResponse(_0x4756('0x15e'),_0x4756('0x90'),'contact\x20is\x20undefine'));}var _0x2aba8a={'XMD-CALLERID':_0x529c97[_0x4756('0x22')][_0x1d1d8d]['getCaller'](),'XMD-AGI':_0x496485[_0x4756('0x131')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x496485[_0x4756('0x131')]):_0x4756('0x15f'),'XMD-AGIAFTER':_0x496485[_0x4756('0xc2')]?util[_0x4756('0x41')](_0x4756('0x160'),ipAgi,_0x496485[_0x4756('0xc2')]):_0x4756('0x15f'),'XMD-QUEUE':utils[_0x4756('0x161')](_0x496485)?util[_0x4756('0x41')]('\x22%s,%s%s,,,%s\x22',_0x496485['name'],_0x496485[_0x4756('0x162')]||'',_0x496485[_0x4756('0xc3')]?'c':'',_0x496485[_0x4756('0xcb')]||0x3):_0x4756('0x15f'),'XMD-CONTACTID':_0xa1774c[_0x4756('0xdc')],'XMD-CDRTYPE':_0x4756('0x5'),'CALLERID(all)':_0x529c97[_0x4756('0x22')][_0x1d1d8d][_0x4756('0x163')](),'XMD-AMD':_0x496485[_0x4756('0x10f')]?'ACTIVE':'NONE','XMD-DESTINATION':'xcally-motion-dialer'};if(_0x496485[_0x4756('0x10f')]){_0x2aba8a[_0x4756('0x164')]=_0x496485['dialAMDInitialSilence']||0x9c4;_0x2aba8a['XMD-AMDGREETING']=_0x496485[_0x4756('0x165')]||0x5dc;_0x2aba8a[_0x4756('0x166')]=_0x496485[_0x4756('0x167')]||0x320;_0x2aba8a[_0x4756('0x168')]=_0x496485['dialAMDTotalAnalysisTime']||0x1388;_0x2aba8a[_0x4756('0x169')]=_0x496485[_0x4756('0x16a')]||0x64;_0x2aba8a['XMD-AMDBETWEENWORDSSILENCE']=_0x496485[_0x4756('0x16b')]||0x32;_0x2aba8a[_0x4756('0x16c')]=_0x496485[_0x4756('0x16d')]||0x3;_0x2aba8a[_0x4756('0x16e')]=_0x496485[_0x4756('0x16f')]||0x100;_0x2aba8a[_0x4756('0x170')]=_0x496485[_0x4756('0x171')]||0x1388;}if(utils['isOutboundQueue'](_0x496485)){_0x2aba8a[_0x4756('0x172')]=_0xa1774c['VoiceQueueId'];}else{_0x2aba8a[_0x4756('0x173')]=_0xa1774c[_0x4756('0xde')];}var _0x40615f=utils[_0x4756('0x174')](_0xa1774c['Contact']);Object[_0x4756('0x141')](_0x2aba8a,_0x40615f);var _0x4ddb1e=_0x529c97[_0x4756('0x82')](_0x496485[_0x4756('0x89')])?utils[_0x4756('0x175')](_0x496485[_0x4756('0x89')][_0x4756('0x176')],_0x496485[_0x4756('0x177')],_0x496485[_0x4756('0x178')]>0x0?utils[_0x4756('0x179')](_0x496485['dialOriginateCallerIdNumber'],_0x496485[_0x4756('0x178')]):_0x496485[_0x4756('0x17a')]):utils[_0x4756('0x175')](_[_0x4756('0xf3')](_0x496485[_0x4756('0x8a')])?_0x496485[_0x4756('0x89')][_0x4756('0x176')]:_0x496485[_0x4756('0x8a')][_0x4756('0x176')],_0x496485['dialOriginateCallerIdName'],_0x496485[_0x4756('0x178')]>0x0?utils[_0x4756('0x179')](_0x496485['dialOriginateCallerIdNumber'],_0x496485[_0x4756('0x178')]):_0x496485[_0x4756('0x17a')]);if(_0x4ddb1e){_0x2aba8a[_0x4756('0x17b')]=_0x529c97[_0x4756('0x22')][_0x1d1d8d][_0x4756('0x17c')]=utils['extractCalleridName'](_0x4ddb1e);_0x2aba8a[_0x4756('0x17d')]=_0xa1774c[_0x4756('0x15d')];}_0x496485['variables']=_0x2aba8a;return ami[_0x4756('0x96')]({'actionid':_0x1d1d8d,'action':_0x4756('0x15e'),'channel':_0x529c97[_0x4756('0x82')](_0x496485[_0x4756('0x89')])?util[_0x4756('0x41')]('SIP/%s/%s%s',_0x496485['Trunk'][_0x4756('0x43')],isNotNull(_0x496485[_0x4756('0x17e')])?_0x496485[_0x4756('0x17e')][_0x4756('0x17f')]()||'':'',_0x496485[_0x4756('0x180')]>0x0?_0xa1774c[_0x4756('0x15d')][_0x4756('0x181')](_0x496485['dialCutDigit']):_0xa1774c[_0x4756('0x15d')]):util[_0x4756('0x41')](_0x4756('0x182'),_[_0x4756('0xf3')](_0x496485[_0x4756('0x8a')])?_0x496485[_0x4756('0x89')]['name']:_0x496485[_0x4756('0x8a')][_0x4756('0x43')],isNotNull(_0x496485[_0x4756('0x17e')])?_0x496485[_0x4756('0x17e')][_0x4756('0x17f')]()||'':'',_0x496485[_0x4756('0x180')]>0x0?_0xa1774c[_0x4756('0x15d')][_0x4756('0x181')](_0x496485[_0x4756('0x180')]):_0xa1774c[_0x4756('0x15d')]),'callerid':_0x4ddb1e,'Exten':_0x4756('0x183'),'Context':_0x4756('0x184'),'Priority':'1','variable':_0x2aba8a,'timeout':(_0x496485[_0x4756('0x185')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1d1d8d})[_0x4756('0x3a')](function(_0x3c485e){return _0x251bb6(_0x3c485e);})['catch'](function(_0x473824){_0x496485[_0x4756('0x186')]+=0x1;var _0x21583c=new History(_0x529c97['actions'][_0x1d1d8d]);logger[_0x4756('0x5f')](util['format'](_0x4756('0x187'),JSON[_0x4756('0x6f')](_0x473824)));_0x21583c[_0x4756('0xd6')]=0xe;_0x21583c['statedesc']='OriginateError';_0x21583c[_0x4756('0x6b')]=moment()['format'](_0x4756('0xbf'));_0x21583c[_0x4756('0x6a')]=_0x21583c[_0x4756('0x6b')];hopperUtils[_0x4756('0xc4')](_0x21583c)[_0x4756('0xa4')](loggerCatch('[originate][error]'));_0x529c97['moveContactManagedDialer'](_0x21583c)[_0x4756('0xa4')](loggerCatch(_0x4756('0x188')))[_0x4756('0x1a')](function(){delete _0x529c97[_0x4756('0x22')][_0x1d1d8d];return _0x3941c9(msgResponse(_0x4756('0x15e'),'Error','originate\x20action\x20Error'));});});});};Dialer[_0x4756('0x17')][_0x4756('0x189')]=function(_0xfcf9b3,_0x1916fc,_0x11b9ae){var _0x1f1742=new History(_0x1916fc);if(_0x1f1742[_0x4756('0x18a')]+_0x1f1742[_0x4756('0x11d')]+_0x1f1742[_0x4756('0x11e')]+_0x1f1742[_0x4756('0x11f')]+_0x1f1742[_0x4756('0xd2')]+_0x1f1742[_0x4756('0xe9')]+_0x1f1742[_0x4756('0x120')]+_0x1f1742['countagentrejectretry']>=_0x11b9ae[_0x4756('0x122')]-0x1){return!![];}switch(_0xfcf9b3){case 0x3:if(_0x1f1742[_0x4756('0x11e')]>=_0x11b9ae['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0x4756('0xda')]({'active':![],'countnoanswerretry':_0x1f1742['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x4756('0xdb')](_0x11b9ae[_0x4756('0x18b')],_0x4756('0xeb'))[_0x4756('0x41')](_0x4756('0xbf')),'ContactId':_0x1f1742[_0x4756('0xdc')],'ListId':_0x1f1742['ListId'],'VoiceQueueId':_0x1f1742[_0x4756('0xec')]||undefined,'CampaignId':_0x1f1742[_0x4756('0xde')]||undefined})[_0x4756('0xa4')](loggerCatch(_0x4756('0x18c')));break;case 0x5:if(_0x1f1742[_0x4756('0x18a')]>=_0x11b9ae[_0x4756('0x18d')]-0x1){return!![];}hopperUtils[_0x4756('0xda')]({'active':![],'countbusyretry':_0x1f1742[_0x4756('0x18a')]+=0x1,'scheduledat':moment()[_0x4756('0xdb')](_0x11b9ae[_0x4756('0x18e')],_0x4756('0xeb'))[_0x4756('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1f1742[_0x4756('0xdc')],'ListId':_0x1f1742[_0x4756('0xdd')],'VoiceQueueId':_0x1f1742[_0x4756('0xec')]||undefined,'CampaignId':_0x1f1742[_0x4756('0xde')]||undefined})['catch'](loggerCatch(_0x4756('0x18f')));break;case 0x8:if(_0x1f1742[_0x4756('0x11d')]>=_0x11b9ae['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0x4756('0xda')]({'active':![],'countcongestionretry':_0x1f1742[_0x4756('0x11d')]+=0x1,'scheduledat':moment()[_0x4756('0xdb')](_0x11b9ae[_0x4756('0x190')],_0x4756('0xeb'))[_0x4756('0x41')](_0x4756('0xbf')),'ContactId':_0x1f1742[_0x4756('0xdc')],'ListId':_0x1f1742[_0x4756('0xdd')],'VoiceQueueId':_0x1f1742[_0x4756('0xec')]||undefined,'CampaignId':_0x1f1742[_0x4756('0xde')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x1f1742[_0x4756('0x11f')]>=_0x11b9ae[_0x4756('0x191')]-0x1){return!![];}else{hopperUtils[_0x4756('0xda')]({'active':![],'countnosuchnumberretry':_0x1f1742[_0x4756('0x11f')]+=0x1,'scheduledat':moment()['add'](_0x11b9ae['dialNoSuchNumberRetryFrequency'],'minutes')[_0x4756('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1f1742[_0x4756('0xdc')],'ListId':_0x1f1742[_0x4756('0xdd')],'VoiceQueueId':_0x1f1742[_0x4756('0xec')]||undefined,'CampaignId':_0x1f1742[_0x4756('0xde')]||undefined})[_0x4756('0xa4')](loggerCatch(_0x4756('0x192')));}break;case 0xa:if(_0x1f1742['countdropretry']>=_0x11b9ae[_0x4756('0xd8')]-0x1){return!![];}hopperUtils[_0x4756('0xda')]({'active':![],'countdropretry':_0x1f1742[_0x4756('0xd2')]+=0x1,'scheduledat':moment()[_0x4756('0xdb')](_0x11b9ae['dialDropRetryFrequency'],_0x4756('0xeb'))[_0x4756('0x41')](_0x4756('0xbf')),'ContactId':_0x1f1742['ContactId'],'ListId':_0x1f1742[_0x4756('0xdd')],'VoiceQueueId':_0x1f1742[_0x4756('0xec')]||undefined,'CampaignId':_0x1f1742[_0x4756('0xde')]||undefined})['catch'](loggerCatch(_0x4756('0xdf')));break;case 0xb:if(_0x1f1742[_0x4756('0xe9')]>=_0x11b9ae['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x1f1742[_0x4756('0xe9')]+=0x1,'scheduledat':moment()[_0x4756('0xdb')](_0x11b9ae[_0x4756('0xe6')],_0x4756('0xeb'))[_0x4756('0x41')](_0x4756('0xbf')),'ContactId':_0x1f1742['ContactId'],'ListId':_0x1f1742[_0x4756('0xdd')],'VoiceQueueId':_0x1f1742[_0x4756('0xec')]||undefined,'CampaignId':_0x1f1742[_0x4756('0xde')]||undefined})[_0x4756('0xa4')](loggerCatch(_0x4756('0xed')));break;case 0x13:if(_0x1f1742[_0x4756('0x120')]>=_0x11b9ae[_0x4756('0x125')]-0x1){return!![];}hopperUtils[_0x4756('0xda')]({'active':![],'countmachineretry':_0x1f1742['countmachineretry']+=0x1,'scheduledat':moment()[_0x4756('0xdb')](_0x11b9ae[_0x4756('0x128')],_0x4756('0xeb'))[_0x4756('0x41')](_0x4756('0xbf')),'ContactId':_0x1f1742[_0x4756('0xdc')],'ListId':_0x1f1742[_0x4756('0xdd')],'VoiceQueueId':_0x1f1742['VoiceQueueId']||undefined,'CampaignId':_0x1f1742[_0x4756('0xde')]||undefined})['catch'](loggerCatch(_0x4756('0x129')));break;case 0x14:if(_0x1f1742['countagentrejectretry']>=_0x11b9ae[_0x4756('0x193')]-0x1){return!![];}hopperUtils[_0x4756('0xda')]({'active':![],'countagentrejectretry':_0x1f1742[_0x4756('0x121')]+=0x1,'scheduledat':moment()['add'](_0x11b9ae[_0x4756('0x194')],_0x4756('0xeb'))[_0x4756('0x41')](_0x4756('0xbf')),'ContactId':_0x1f1742[_0x4756('0xdc')],'ListId':_0x1f1742[_0x4756('0xdd')],'VoiceQueueId':_0x1f1742[_0x4756('0xec')]||undefined,'CampaignId':_0x1f1742[_0x4756('0xde')]||undefined})[_0x4756('0xa4')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer['prototype'][_0x4756('0x10b')]=function(_0xa06b0d,_0x5189e6,_0x39acc1){var _0x5d0c1b=this;var _0x37ec75=new History(_0xa06b0d);var _0x288b51=![];var _0x3adf50;var _0x2b7701;return new Promise(function(_0x526966,_0x573907){if(_[_0x4756('0x3c')](_0x5189e6)&&typeof _0x5189e6!==_0x4756('0x15b')){return _0x573907(msgResponse(_0x4756('0x195'),_0x4756('0x90'),'entity\x20is\x20undefine'));}if(_[_0x4756('0x3c')](_0x39acc1)&&typeof _0x39acc1!==_0x4756('0x15b')){return _0x573907(msgResponse(_0x4756('0x195'),_0x4756('0x90'),_0x4756('0x196')));}hopperUtils[_0x4756('0xd5')](_0x37ec75,_0x39acc1[_0x4756('0x197')],_0x5189e6)['then'](function(_0x7f2937){if(_0x7f2937[_0x4756('0xd7')]==0x1)_0x288b51=!![];switch(_0x39acc1['reason']){case'0':_0x5189e6[_0x4756('0x198')]+=0x1;_0x37ec75[_0x4756('0xd6')]=0x0;_0x37ec75[_0x4756('0x69')]='NoSuchNumber';_0x37ec75['countnosuchnumberretry']+=0x1;_0x37ec75[_0x4756('0xd3')]+=0x1;ami[_0x4756('0x12b')](_0x4756('0x199'),ut[_0x4756('0x115')](_0xa06b0d,_0x4756('0x19a')));_0x3adf50=_0x5189e6[_0x4756('0x19b')];_0x2b7701=_0x5189e6[_0x4756('0xe7')];hopperUtils[_0x4756('0xc4')](_0x37ec75)['catch'](loggerCatch(_0x4756('0x11c')));if(_0x5d0c1b[_0x4756('0x189')](0x0,_0xa06b0d,_0x5189e6)&&!_0x288b51){if(_0x37ec75[_0x4756('0x11f')]>=_0x5189e6[_0x4756('0x191')]){_0x5d0c1b[_0x4756('0x126')](_0x37ec75,_0x526966,_0x573907,_0x4756('0x19c'));}else{_0x5d0c1b[_0x4756('0x123')](_0x37ec75,_0x526966,_0x573907,_0x4756('0x19c'));}}break;case'3':_0x5189e6[_0x4756('0x19d')]+=0x1;_0x37ec75[_0x4756('0xd6')]=0x3;_0x37ec75[_0x4756('0x69')]=_0x4756('0x19e');_0x37ec75[_0x4756('0x11e')]+=0x1;_0x37ec75[_0x4756('0xd3')]+=0x1;var _0x16fcfd=ut[_0x4756('0x19f')](_0xa06b0d,_0x5189e6);ami[_0x4756('0x12b')](_0x4756('0x1a0'),_0x16fcfd);_0x3adf50=_0x5189e6[_0x4756('0x18b')];_0x2b7701=_0x5189e6[_0x4756('0xe7')];hopperUtils['createHistory'](_0x37ec75)[_0x4756('0xa4')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x5d0c1b[_0x4756('0x189')](0x3,_0xa06b0d,_0x5189e6)&&!_0x288b51){if(_0x37ec75[_0x4756('0x11e')]>=_0x5189e6[_0x4756('0x1a1')]){_0x5d0c1b[_0x4756('0x126')](_0x37ec75,_0x526966,_0x573907,_0x4756('0x1a2'));}else{_0x5d0c1b['stateGlobal'](_0x37ec75,_0x526966,_0x573907,_0x4756('0x1a2'));}}break;case'5':_0x5189e6[_0x4756('0x1a3')]+=0x1;_0x37ec75[_0x4756('0xd6')]=0x5;_0x37ec75[_0x4756('0x69')]=_0x4756('0x1a4');_0x37ec75[_0x4756('0x18a')]+=0x1;_0x37ec75['countglobal']+=0x1;ami[_0x4756('0x12b')](_0x4756('0x1a5'),ut[_0x4756('0x115')](_0xa06b0d,'busy'));_0x3adf50=_0x5189e6[_0x4756('0x18e')];_0x2b7701=_0x5189e6[_0x4756('0xe7')];hopperUtils['createHistory'](_0x37ec75)[_0x4756('0xa4')](loggerCatch(_0x4756('0x1a6')));if(_0x5d0c1b[_0x4756('0x189')](0x5,_0xa06b0d,_0x5189e6)&&!_0x288b51){if(_0x37ec75[_0x4756('0x18a')]>=_0x5189e6[_0x4756('0x18d')]){_0x5d0c1b[_0x4756('0x126')](_0x37ec75,_0x526966,_0x573907,_0x4756('0x1a7'));}else{_0x5d0c1b[_0x4756('0x123')](_0x37ec75,_0x526966,_0x573907,'reason\x205\x20busy');}}break;case'8':_0x5189e6[_0x4756('0x1a8')]+=0x1;_0x37ec75[_0x4756('0xd6')]=0x8;_0x37ec75[_0x4756('0x69')]=_0x4756('0x1a9');_0x37ec75[_0x4756('0x11d')]+=0x1;_0x37ec75['countglobal']+=0x1;_0x3adf50=_0x5189e6[_0x4756('0x190')];_0x2b7701=_0x5189e6[_0x4756('0xe7')];ami[_0x4756('0x12b')](_0x4756('0x1aa'),ut[_0x4756('0x115')](_0xa06b0d,_0x4756('0x1ab')));hopperUtils[_0x4756('0xc4')](_0x37ec75)[_0x4756('0xa4')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x5d0c1b['checkRetriveMax'](0x8,_0xa06b0d,_0x5189e6)&&!_0x288b51){if(_0x37ec75[_0x4756('0x11d')]>=_0x5189e6['dialCongestionMaxRetry']){_0x5d0c1b[_0x4756('0x126')](_0x37ec75,_0x526966,_0x573907,_0x4756('0x1ac'));}else{_0x5d0c1b['stateGlobal'](_0x37ec75,_0x526966,_0x573907,_0x4756('0x1ac'));}}break;case'11':_0x5189e6[_0x4756('0x1ad')]+=0x1;_0x37ec75[_0x4756('0xd6')]=0xb;_0x37ec75['statedesc']='Abandoned';_0x37ec75['countabandonedretry']+=0x1;_0x37ec75[_0x4756('0xd3')]+=0x1;_0x3adf50=_0x5189e6[_0x4756('0xe6')];_0x2b7701=_0x5189e6['callAdditionalPhoneAfterMin'];hopperUtils[_0x4756('0xc4')](_0x37ec75)[_0x4756('0xa4')](loggerCatch(_0x4756('0x1ae')));if(_0x5d0c1b[_0x4756('0x189')](0xb,_0xa06b0d,_0x5189e6)&&!_0x288b51){if(_0x37ec75[_0x4756('0xe9')]>=_0x5189e6[_0x4756('0xea')]){_0x5d0c1b[_0x4756('0x126')](_0x37ec75,_0x526966,_0x573907,_0x4756('0x1af'));}else{_0x5d0c1b[_0x4756('0x123')](_0x37ec75,_0x526966,_0x573907,'reason\x2011\x20abandoned');}}break;case'20':_0x5189e6[_0x4756('0x1b0')]+=0x1;_0x37ec75[_0x4756('0xd6')]=0x14;_0x37ec75[_0x4756('0x69')]=_0x4756('0x1b1');_0x37ec75[_0x4756('0x121')]+=0x1;_0x37ec75[_0x4756('0xd3')]+=0x1;_0x3adf50=_0x5189e6[_0x4756('0x194')];_0x2b7701=_0x5189e6[_0x4756('0xe7')];ami[_0x4756('0x12b')](_0x4756('0x1b2'),ut['buildObj'](_0xa06b0d,_0x4756('0x1b3')));hopperUtils['createHistory'](_0x37ec75)[_0x4756('0xa4')](loggerCatch(_0x4756('0x1b4')));if(_0x5d0c1b[_0x4756('0x189')](0x14,_0xa06b0d,_0x5189e6)&&!_0x288b51){if(_0x37ec75[_0x4756('0x121')]>=_0x5189e6[_0x4756('0x193')]){_0x5d0c1b[_0x4756('0x126')](_0x37ec75,_0x526966,_0x573907,_0x4756('0x1b5'));}else{_0x5d0c1b[_0x4756('0x123')](_0x37ec75,_0x526966,_0x573907,_0x4756('0x1b5'));}}break;default:_0x5189e6[_0x4756('0x132')]+=0x1;_0x37ec75[_0x4756('0xd6')]=0xc;_0x37ec75[_0x4756('0x69')]=_0x39acc1[_0x4756('0x197')];_0x3adf50=_0x5189e6[_0x4756('0x194')];_0x2b7701=_0x5189e6[_0x4756('0xe7')];hopperUtils['createHistory'](_0x37ec75)[_0x4756('0xa4')](loggerCatch(_0x4756('0x1b6')));if(_0x5d0c1b[_0x4756('0x189')](_0x39acc1[_0x4756('0x197')],_0xa06b0d,_0x5189e6)&&!_0x288b51){if(_0x37ec75[_0x4756('0x18a')]+_0x37ec75['countcongestionretry']+_0x37ec75[_0x4756('0x11e')]+_0x37ec75['countnosuchnumberretry']+_0x37ec75[_0x4756('0xd2')]+_0x37ec75[_0x4756('0xe9')]+_0x37ec75['countmachineretry']+_0x37ec75[_0x4756('0x121')]>=_0x5189e6[_0x4756('0x122')]){_0x5d0c1b[_0x4756('0x123')](_0x37ec75,_0x526966,_0x573907,_0x39acc1['reason']);}else{_0x5d0c1b[_0x4756('0x126')](_0x37ec75,_0x526966,_0x573907,_0x39acc1[_0x4756('0x197')]);}}}})[_0x4756('0x3a')](function(){if(_0x288b51){hopperUtils[_0x4756('0xe2')](_0x37ec75,_0x3adf50,_0x2b7701)['then'](function(){return _0x526966(0x1);});}});});};Dialer[_0x4756('0x17')][_0x4756('0x123')]=function(_0x5c4597,_0x8e0d99,_0x572524,_0x2b51d1){var _0x329dd1=new Final(_0x5c4597);_0x329dd1[_0x4756('0xd6')]=0xf;_0x329dd1[_0x4756('0x69')]=_0x4756('0x1b7');this[_0x4756('0x126')](_0x329dd1,_0x8e0d99,_0x572524,_0x2b51d1);};Dialer[_0x4756('0x17')][_0x4756('0x126')]=function(_0x4b5652,_0x971f7a,_0x58c0ec,_0x3c0940){hopperUtils[_0x4756('0x12d')](_0x4b5652)[_0x4756('0x3a')](function(){return _0x971f7a(msgResponse(_0x4756('0x195'),_0x4756('0x10a'),_0x3c0940));})['catch'](function(){return _0x58c0ec(msgResponse('[moveContactManagedDialer][0]',_0x4756('0x90'),'contact\x20not\x20moved'));});};Dialer[_0x4756('0x17')][_0x4756('0x7')]=function(_0xce44a4){var _0x59b9a2=_0xce44a4['dialPredictiveOptimizationPercentage']/0x64;var _0x158869=_0xce44a4['outboundDropCallsDayTimeout']/(_0xce44a4[_0x4756('0xcd')]+_0xce44a4[_0x4756('0xc1')]);var _0x4d9bf2=Math[_0x4756('0x1b8')](_0xce44a4[_0x4756('0x1b9')]*(_0xce44a4[_0x4756('0x1ba')]/0x64));var _0x54ca18=Math[_0x4756('0x1b8')](_0xce44a4[_0x4756('0x1b9')]*(_0xce44a4[_0x4756('0x1bb')]/0x64));var _0x4dbbf4=_0xce44a4[_0x4756('0x13a')]+_0xce44a4['talking'];var _0x372b4b=Math[_0x4756('0x1bc')](_0xce44a4[_0x4756('0x1bd')]*_0xce44a4[_0x4756('0x57')]*_0xce44a4[_0x4756('0x1be')]*_0xce44a4['predictiveIntervalMultiplicativeFactor']);if(_[_0x4756('0x3c')](_0xce44a4['startProgressive'])){if(!_[_0x4756('0x3c')](_0xce44a4[_0x4756('0x25')])){_0xce44a4[_0x4756('0x25')]=undefined;loggerPredictive[_0x4756('0x5f')](_0x4756('0x1bf'),_0x4756('0x1c0'));}if(!_['isUndefined'](_0xce44a4[_0x4756('0x5d')])){loggerPredictive['error'](_0x4756('0x1bf'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0xce44a4[_0x4756('0x5d')]);_0xce44a4[_0x4756('0x5d')]=undefined;}_0xce44a4[_0x4756('0x26')]=moment()['format'](_0x4756('0xbf'));loggerPredictive[_0x4756('0x45')](_0xce44a4['name'],_0x4756('0x1c1'),_0xce44a4[_0x4756('0x26')]);this[_0x4756('0xb0')](_0xce44a4,0x1);}else if(ifInterval(_0xce44a4[_0x4756('0x1c2')],_0xce44a4['startProgressive'])){this[_0x4756('0xb0')](_0xce44a4,0x1);loggerPredictiveCalls['info'](_0x4756('0x1c3'),_0xce44a4[_0x4756('0x26')],_0xce44a4['name']);_0xce44a4[_0x4756('0x1bd')]=0x0;_0xce44a4[_0x4756('0x1c4')]=0x0;}else if(_0x59b9a2<_0x158869&&_0xce44a4[_0x4756('0x1c5')]===_0x4756('0x1c6')){clearPredictiveAttributes(_0xce44a4);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x158869,'startProgressive',_0xce44a4[_0x4756('0x43')]);}else if(_0x372b4b<_0xce44a4['predictiveIntervalErlangCallsDroppedCalls']&&_0xce44a4[_0x4756('0x1c5')]===_0x4756('0x1c6')){clearPredictiveAttributes(_0xce44a4);loggerPredictive[_0x4756('0x45')](_0x4756('0x1c7'),_0x4756('0x1c8'),_0x372b4b,_0x4756('0x1c9'),_0xce44a4[_0x4756('0x1c4')],'startProgressive',_0xce44a4['name']);}else if(!ifInterval(_0xce44a4[_0x4756('0x1c2')],_0xce44a4[_0x4756('0x26')])&&_[_0x4756('0x3c')](_0xce44a4[_0x4756('0x25')])&&!_[_0x4756('0x3c')](_0xce44a4[_0x4756('0x26')])){_0xce44a4[_0x4756('0x25')]=moment()[_0x4756('0x41')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x4756('0x45')](_0xce44a4['name'],_0x4756('0x1ca'),_0xce44a4['startPredictive']);hopperUtils['avgHandleTime'](_0xce44a4[_0x4756('0x1c2')])['then'](this[_0x4756('0x1cb')](_0xce44a4))['then'](mergeDataErlangB(_0xce44a4))[_0x4756('0x3a')](this[_0x4756('0x1cc')](_0xce44a4))[_0x4756('0xa4')](loggerCatchPredictive(_0x4756('0x1cd'),_0xce44a4));}else if(!ifInterval(_0xce44a4[_0x4756('0x1c2')],_0xce44a4[_0x4756('0x25')])){_0xce44a4['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0xce44a4['startPredictive']=moment()['format'](_0x4756('0xbf'));loggerPredictive[_0x4756('0x45')](_0xce44a4[_0x4756('0x43')],_0x4756('0x1ce'),_0xce44a4['startPredictive']);clearInterval(_0xce44a4['handlePredictive']);_0xce44a4[_0x4756('0x5d')]=undefined;hopperUtils['avgHandleTime'](_0xce44a4[_0x4756('0x1c2')])[_0x4756('0x3a')](this[_0x4756('0x1cb')](_0xce44a4))[_0x4756('0x3a')](mergeDataErlangB(_0xce44a4))[_0x4756('0x3a')](this[_0x4756('0x1cc')](_0xce44a4))['catch'](loggerCatchPredictive(_0x4756('0x1cf'),_0xce44a4));}else if(_0xce44a4[_0x4756('0x1b9')]&&_0x4dbbf4<_0xce44a4[_0x4756('0x1b9')]-_0x54ca18){clearPredictiveAttributes(_0xce44a4);loggerPredictive[_0x4756('0x45')](_0xce44a4[_0x4756('0x43')],_0x4756('0x1d0'),_0x4dbbf4,')\x20are\x20less\x20than\x20threshold\x20(',_0xce44a4[_0x4756('0x1b9')],'-',_0x54ca18,'=',_0xce44a4[_0x4756('0x1b9')]-_0x54ca18,')');}else if(_0xce44a4[_0x4756('0x1b9')]&&_0x4dbbf4>_0xce44a4[_0x4756('0x1b9')]+_0x4d9bf2){clearPredictiveAttributes(_0xce44a4);loggerPredictive[_0x4756('0x45')](_0xce44a4['name'],_0x4756('0x1d0'),_0x4dbbf4,_0x4756('0x1d1'),_0xce44a4['predictiveIntervalAvailable'],'+',_0x4d9bf2,'=',_0xce44a4['predictiveIntervalAvailable']+_0x4d9bf2,')');}};Dialer['prototype']['getDataPredictive']=function(_0x2f5fa3){var _0x564407=this;return function(_0x47e750){return new Promise(function(_0x4fa35b,_0xb0ebac){_[_0x4756('0x5a')](_0x2f5fa3,_0x47e750[0x0]);if(checkGetDataPredictive(_0x47e750[0x0])){var _0x1f3f77=_0x2f5fa3[_0x4756('0x1b9')]=_0x2f5fa3[_0x4756('0x13c')]+_0x2f5fa3[_0x4756('0x13a')];var _0x2f3e61=_0x2f5fa3[_0x4756('0x1c2')]*0x3c;var _0xcca820=_0x47e750[0x0]['predictiveIntervalAvgTalktime']+_0x47e750[0x0]['predictiveIntervalAvgHoldtime'];var _0x2b8f63=(_0x47e750[0x0][_0x4756('0x47')]+_0x47e750[0x0][_0x4756('0xcc')]+_0x47e750[0x0][_0x4756('0x49')])/_0x47e750[0x0][_0x4756('0x46')];_0x2f5fa3[_0x4756('0x1be')]=_0x2b8f63>0x0?_0x2b8f63:0x1;switch(_0x2f5fa3[_0x4756('0x1c5')]){case _0x4756('0x1c6'):var _0x2317ca=_0x2f5fa3[_0x4756('0x1d2')]/0x64;return _0x564407[_0x4756('0x1d3')](_0x1f3f77,_0x2f3e61,_0xcca820,_0x2b8f63,_0x2317ca)[_0x4756('0x3a')](function(_0x2e5318){return _0x4fa35b(_0x2e5318);});case _0x4756('0x1d4'):var _0x1ebcee=_0x2f5fa3['dialPredictiveOptimizationPercentage']/0x64;return _0x564407[_0x4756('0x1d5')](_0x1f3f77,_0x2f3e61,_0xcca820,_0x2b8f63,_0x1ebcee)[_0x4756('0x3a')](function(_0x539b15){return _0x4fa35b(_0x539b15);});default:return _0xb0ebac(msgResponse(_0x4756('0x1d6'),_0x4756('0x90'),_0x4756('0x1d7')));}}else{return _0xb0ebac(msgResponse('[getDataPredictive]',_0x4756('0x90'),_0x4756('0x1d8')));}});};};Dialer[_0x4756('0x17')][_0x4756('0x1d9')]=function(_0x3b9c3f){var _0x17b68e=this;return function(_0x1dd30d){return new Promise(function(_0x3a6e94,_0x3326f1){_[_0x4756('0x5a')](_0x3b9c3f,_0x1dd30d[0x0]);if(checkGetDataPredictive(_0x1dd30d[0x0])){loggerPredictive[_0x4756('0x45')](JSON[_0x4756('0x6f')](_0x1dd30d[0x0]));if(_0x3b9c3f[_0x4756('0x1c5')]==='dropRate'){return _0x17b68e[_0x4756('0x152')](_0x3b9c3f['id'])['then'](function(_0xea0729){var _0x3f2aa5=_0x3b9c3f[_0x4756('0x1da')]-_0xea0729[0x0][_0x4756('0x1db')];var _0x150295=_0x3b9c3f['dialPredictiveInterval']*0x3c;var _0xceb6eb=_0x1dd30d[0x0][_0x4756('0x4d')]+_0x1dd30d[0x0][_0x4756('0x4b')];var _0xf666a6=(_0x1dd30d[0x0][_0x4756('0x47')]+_0x1dd30d[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1dd30d[0x0][_0x4756('0x49')])/_0x1dd30d[0x0][_0x4756('0x46')];var _0x2995cb=_0x3b9c3f[_0x4756('0x1d2')]/0x64;_0x3b9c3f[_0x4756('0x1dc')]=_0xea0729[0x0][_0x4756('0x1db')]||0x0;_0x3b9c3f[_0x4756('0x1be')]=_0xf666a6>0x0?_0xf666a6:0x1;return _0x17b68e['abandonmentRate'](_0x3f2aa5,_0x150295,_0xceb6eb,_0xf666a6,_0x2995cb);})[_0x4756('0x3a')](function(_0x42198d){return _0x3a6e94(_0x42198d);})[_0x4756('0xa4')](function(_0x255089){return _0x3326f1(msgResponse(_0x4756('0x1dd'),_0x4756('0x90'),JSON[_0x4756('0x6f')](_0x255089)));});}if(_0x3b9c3f['dialPredictiveOptimization']===_0x4756('0x1d4')){return _0x17b68e['getVoiceQueueRtPauses'](_0x3b9c3f['id'])['then'](function(_0x13c61a){var _0x13a74e=_0x3b9c3f[_0x4756('0x1da')]-_0x13c61a[0x0][_0x4756('0x1db')];var _0x5ee647=_0x3b9c3f[_0x4756('0x1c2')]*0x3c;var _0x5dac10=_0x1dd30d[0x0][_0x4756('0x4d')]+_0x1dd30d[0x0][_0x4756('0x4b')];var _0xb71062=(_0x1dd30d[0x0]['predictiveIntervalAnsweredCalls']+_0x1dd30d[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1dd30d[0x0][_0x4756('0x49')])/_0x1dd30d[0x0][_0x4756('0x46')];var _0x1b5199=_0x3b9c3f[_0x4756('0x1d2')]/0x64;_0x3b9c3f[_0x4756('0x1dc')]=_0x13c61a[0x0][_0x4756('0x1db')]||0x0;_0x3b9c3f[_0x4756('0x1be')]=_0xb71062>0x0?_0xb71062:0x1;return _0x17b68e[_0x4756('0x1d5')](_0x13a74e,_0x5ee647,_0x5dac10,_0xb71062,_0x1b5199);})[_0x4756('0x3a')](function(_0x16ace6){return _0x3a6e94(_0x16ace6);})['catch'](function(_0x24b3e5){return _0x3326f1(msgResponse(_0x4756('0x1dd'),_0x4756('0x90'),JSON['stringify'](_0x24b3e5)));});}}else{return _0x3326f1(msgResponse('[getDataPredictive]',_0x4756('0x90'),_0x4756('0x1d8')));}});};};Dialer['prototype'][_0x4756('0x1cc')]=function(_0x46c141){var _0x1a166b=this;return function(){var _0x58bc0f=0x0;var _0x521d22=Math[_0x4756('0x1bc')](_0x46c141[_0x4756('0x55')]*0x3e8);if(_0x521d22>0x0){_0x521d22=_0x521d22<0x64?0x64:_0x521d22;loggerPredictive[_0x4756('0x45')](_0x46c141[_0x4756('0x43')],'one\x20call\x20every:',_0x521d22,_0x4756('0x1de'));_0x46c141[_0x4756('0x5d')]=setInterval(function(){_0x1a166b['handlePredictive'](_0x46c141);loggerPredictiveCalls['info'](_0x4756('0x1df'),_0x58bc0f+=0x1);},_0x521d22);}else{loggerPredictive[_0x4756('0x45')](_0x46c141['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x4756('0x17')][_0x4756('0x1e0')]=function(_0x589067,_0x32b2fb){var _0x3fbefa=this;return function(_0x3276dc){if(_[_0x4756('0x44')](_0x3276dc)){if(_[_0x4756('0xf3')](_0x32b2fb[_0x4756('0x1e1')])||!_0x32b2fb[_0x4756('0x1e2')]){if(_0x589067[_0x4756('0xae')]===_0x4756('0x6')){_0x589067['queueStatusComplete']=_[_0x4756('0x3c')](_0x589067['queueStatusComplete'])?!![]:_0x589067['queueStatusComplete'];var _0x29648c=uuid['v4']();_0x3fbefa[_0x4756('0x22')][_0x29648c]=new Action(_0x589067,_0x32b2fb,_0x29648c);loggerBooked[_0x4756('0x45')](_0x4756('0x1e3'),_0x29648c,'queueStatusComplete:\x20',JSON['stringify'](_0x589067[_0x4756('0x6c')]),_0x4756('0x1e4'),_0x589067['name']);if(_0x589067[_0x4756('0x6c')]){_0x589067['queueStatusComplete']=![];_0x3fbefa[_0x4756('0x27')][_0x3fbefa[_0x4756('0x22')][_0x29648c]['queue']]=[];ami[_0x4756('0x96')]({'actionid':_0x29648c,'action':'queuestatus','queue':_0x589067[_0x4756('0x43')]})[_0x4756('0xa4')](function(){_0x3fbefa[_0x4756('0xbc')](_0x589067);hopperUtils[_0x4756('0xda')]({'active':![],'ContactId':_0x3fbefa[_0x4756('0x22')][_0x29648c]['ContactId'],'ListId':_0x3fbefa[_0x4756('0x22')][_0x29648c]['ListId'],'VoiceQueueId':_0x3fbefa[_0x4756('0x22')][_0x29648c]['VoiceQueueId']||undefined,'CampaignId':_0x3fbefa[_0x4756('0x22')][_0x29648c][_0x4756('0xde')]||undefined})[_0x4756('0xa4')](loggerCatch(_0x4756('0x1e5')));delete _0x3fbefa['actions'][_0x29648c];});}else{loggerBooked['info'](_0x4756('0x1e6'),JSON[_0x4756('0x6f')](_0x589067[_0x4756('0x6c')]),'Queue:\x20',_0x589067[_0x4756('0x43')]);_0x3fbefa[_0x4756('0xbc')](_0x589067);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x3fbefa[_0x4756('0x22')][_0x29648c][_0x4756('0xdc')],'ListId':_0x3fbefa[_0x4756('0x22')][_0x29648c][_0x4756('0xdd')],'VoiceQueueId':_0x3fbefa['actions'][_0x29648c][_0x4756('0xec')]||undefined,'CampaignId':_0x3fbefa[_0x4756('0x22')][_0x29648c][_0x4756('0xde')]||undefined})['catch'](loggerCatch(_0x4756('0x1e5')));delete _0x3fbefa[_0x4756('0x22')][_0x29648c];}}else{return _0x3fbefa['actionOriginate'](_0x589067,_0x32b2fb);}}else{if(utils[_0x4756('0xc9')](undefined,_0x32b2fb[_0x4756('0x1e7')])<_0x589067[_0x4756('0x1e8')]*0x3c){if(_0x32b2fb[_0x4756('0x147')]&&!_0x32b2fb['Agent'][_0x4756('0x1e9')]){_0x3fbefa[_0x4756('0xf7')][_0x4756('0x101')](_0x32b2fb['id'])['finally'](function(){_0x3fbefa[_0x4756('0xbc')](_0x589067);});}else{hopperUtils[_0x4756('0x1ea')]({'active':![]},_0x32b2fb['id'],0x1)[_0x4756('0x1a')](function(){_0x3fbefa[_0x4756('0xbc')](_0x589067);});}}else{_0x589067[_0x4756('0x1eb')]+=0x1;_0x3fbefa[_0x4756('0xbc')](_0x589067);if(_0x589067['dialRecallInQueue']){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x32b2fb['ContactId'],'ListId':_0x32b2fb[_0x4756('0xdd')],'VoiceQueueId':_0x32b2fb[_0x4756('0xec')]||undefined,'CampaignId':_0x32b2fb[_0x4756('0xde')]||undefined})[_0x4756('0xa4')](loggerCatch(_0x4756('0x1ec')));hopperUtils[_0x4756('0xc4')](createObjHistory(_0x589067,_0x32b2fb,utils['CAMPAIGN_STATUS'][_0x4756('0x1ed')],0x17,'RecallInQueue'))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x3fbefa[_0x4756('0x117')](createObjHistory(_0x589067,_0x32b2fb,utils['CAMPAIGN_STATUS'][_0x4756('0x1ee')],0x16,_0x4756('0x1ef')),_0x4756('0x1f0'),_0x4756('0x1f1'));}}}}else{_0x589067['outboundBlacklistCallsDay']+=0x1;_0x3fbefa[_0x4756('0x117')](createObjHistory(_0x589067,_0x32b2fb,utils[_0x4756('0x63')][_0x4756('0x1f2')],0xd,_0x4756('0x1f3')),_0x4756('0x1f4'),_0x4756('0x1f5'));throw _0x4756('0x1f6');}};};Dialer[_0x4756('0x17')][_0x4756('0x159')]=function(_0x522a7f){var _0x261cff=this;var _0x27c85f=_0x522a7f['limitCalls']-_0x522a7f[_0x4756('0x7c')];emitCampaignSummary(_0x522a7f);if(_0x27c85f>0x0&&_0x522a7f[_0x4756('0x60')]==0x0){if(_0x27c85f>this['maxNumberOriginate']){_0x27c85f=this['maxNumberOriginate'];}_0x522a7f[_0x4756('0x60')]=0x1;hopperUtils[_0x4756('0x1f7')](_0x522a7f,_0x27c85f)[_0x4756('0x3a')](function(_0x37a8f7){_0x522a7f[_0x4756('0x60')]=0x0;if(_0x37a8f7){if(!utils['checkContactEmpty'](_0x37a8f7)){_0x522a7f[_0x4756('0x62')]=utils[_0x4756('0x63')][_0x4756('0x67')];logger['info'](_0x4756('0x1f8')+_0x522a7f[_0x4756('0x43')]);}else{_0x522a7f['originated']+=_0x37a8f7[_0x4756('0x95')];_0x522a7f[_0x4756('0x62')]=utils[_0x4756('0x63')][_0x4756('0x1f9')];for(var _0x14be01=0x0;_0x14be01<_0x37a8f7[_0x4756('0x95')];_0x14be01+=0x1){_0x522a7f['ivrTotalCallsDays']+=0x1;if(_[_0x4756('0xf3')](_0x37a8f7[_0x14be01])||_[_0x4756('0xf3')](_0x37a8f7[_0x14be01]['Contact'])||_[_0x4756('0xf3')](_0x37a8f7[_0x14be01][_0x4756('0x15d')])){_0x261cff['emptyContact'](_0x4756('0x1fa'),_0x522a7f,_0x37a8f7[_0x14be01]);}else{hopperUtils[_0x4756('0x1fb')](_['pick'](_0x37a8f7[_0x14be01],[_0x4756('0xde'),_0x4756('0x15d')]))[_0x4756('0x3a')](_0x261cff['checkContactBlack'](_0x522a7f,_0x37a8f7[_0x14be01]))[_0x4756('0xa4')](_0x261cff[_0x4756('0x1fc')](_0x4756('0x1fd'),_0x522a7f));}}}}})['catch'](loggerGetContactDialer(_0x4756('0x1fe'),_0x522a7f,_0x27c85f));}};Dialer[_0x4756('0x17')]['handlePower']=function(_0x12175d,_0x4a87ec){var _0x4d5805=this;var _0x3a6800=[];if(_0x4a87ec<0x1||_0x12175d[_0x4756('0xae')]===_0x4756('0x6')){_0x4a87ec=0x1;}var _0x53795f=Math['floor'](_0x12175d[_0x4756('0x13a')]*_0x4a87ec)-_0x12175d[_0x4756('0x7c')];if(_0x12175d[_0x4756('0x1ff')]>0x0){var _0x12e0d4=_0x12175d[_0x4756('0x1ff')]-_0x12175d[_0x4756('0x7c')]-_0x12175d['talking']-_0x12175d['pTalking'];if(_0x53795f>_0x12e0d4){_0x53795f=_0x12e0d4;}}if(_0x53795f>0x0&&_0x12175d[_0x4756('0x60')]==0x0){if(_0x12175d['dialMethod']==='booked'){_0x53795f=0x1;}if(_0x53795f>this[_0x4756('0x20')]){_0x53795f=this[_0x4756('0x20')];}for(var _0x16db6c in this['agents']){if(typeof this[_0x4756('0x1e')][_0x16db6c]!==_0x4756('0x14e')){if(this['agents'][_0x16db6c][_0x4756('0xd6')]===_0x4756('0x200')&&this[_0x4756('0x1e')][_0x16db6c][_0x4756('0x85')]===_0x4756('0x86')){_0x3a6800[_0x4756('0x9d')](this[_0x4756('0x1e')][_0x16db6c]['id']);}}}_0x12175d[_0x4756('0x60')]=0x1;hopperUtils['getContactDialer'](_0x12175d,_0x3a6800,_0x53795f)['then'](function(_0x9fc65e){_0x12175d['temp']=0x0;if(_0x9fc65e){if(!utils['checkContactEmpty'](_0x9fc65e)){hopperUtils[_0x4756('0x201')](_0x12175d)[_0x4756('0x3a')](sendMessageReschedule(_0x12175d))[_0x4756('0xa4')](loggerCatch(_0x4756('0x202')));}else{_0x12175d[_0x4756('0x7c')]+=_0x9fc65e[_0x4756('0x95')];_0x12175d['message']=_0x12175d[_0x4756('0xae')]===_0x4756('0x6')?utils[_0x4756('0x63')][_0x4756('0x13e')]:utils[_0x4756('0x63')]['RUNNING'];for(var _0x3a599f=0x0;_0x3a599f<_0x9fc65e['length'];_0x3a599f+=0x1){if(_[_0x4756('0xf3')](_0x9fc65e[_0x3a599f])||_[_0x4756('0xf3')](_0x9fc65e[_0x3a599f][_0x4756('0x203')])||_[_0x4756('0xf3')](_0x9fc65e[_0x3a599f][_0x4756('0x15d')])){_0x4d5805[_0x4756('0x155')](_0x4756('0x1fa'),_0x12175d,_0x9fc65e[_0x3a599f]);}else{hopperUtils['checkIsBlackList'](_['pick'](_0x9fc65e[_0x3a599f],[_0x4756('0xec'),_0x4756('0x15d')]))[_0x4756('0x3a')](_0x4d5805[_0x4756('0x1e0')](_0x12175d,_0x9fc65e[_0x3a599f]))[_0x4756('0xa4')](_0x4d5805['loggerHandler']('[actionOriginate]\x20',_0x12175d));}}}}})[_0x4756('0xa4')](loggerGetContactDialer(_0x4756('0x204'),_0x12175d,_0x53795f));}};Dialer[_0x4756('0x17')][_0x4756('0x5d')]=function(_0x4416ec){if(_0x4416ec[_0x4756('0x1ff')]>0x0){var _0x3369b0=_0x4416ec[_0x4756('0x1ff')]-_0x4416ec['originated']-_0x4416ec[_0x4756('0x13c')];if(_0x3369b0>0x0&&_0x4416ec['temp']==0x0){this[_0x4756('0x205')](_0x4416ec);}else{loggerPredictiveCalls[_0x4756('0x45')](_0x4756('0x206'));}}else{this[_0x4756('0x205')](_0x4416ec);}};Dialer[_0x4756('0x17')][_0x4756('0x205')]=function(_0x59a852){var _0x268d48=this;var _0x176919=[];_0x59a852[_0x4756('0x7c')]+=0x1;for(var _0x13f7f in this[_0x4756('0x1e')]){if(typeof this[_0x4756('0x1e')][_0x13f7f]!==_0x4756('0x14e')){if(this[_0x4756('0x1e')][_0x13f7f]['state']===_0x4756('0x200')&&this['agents'][_0x13f7f][_0x4756('0x85')]==='reachable'){_0x176919[_0x4756('0x9d')](this['agents'][_0x13f7f]['id']);}}}_0x59a852[_0x4756('0x60')]=0x1;return this[_0x4756('0x207')](_0x59a852['id'],_0x176919,0x1,_0x59a852[_0x4756('0x208')],_0x59a852)['then'](function(_0x52bf6e){_0x59a852[_0x4756('0x60')]=0x1;if(_0x52bf6e){if(!utils[_0x4756('0x209')](_0x52bf6e)){utils[_0x4756('0x20a')](_0x59a852,0x1,0x0);return hopperUtils[_0x4756('0x201')](_0x59a852)['then'](sendMessageReschedule(_0x59a852))[_0x4756('0xa4')](loggerCatch(_0x4756('0x202')));}else{_0x59a852['message']=utils[_0x4756('0x63')][_0x4756('0x1f9')];if(_[_0x4756('0xf3')](_0x52bf6e[0x0])||_['isNil'](_0x52bf6e[0x0]['Contact'])||_[_0x4756('0xf3')](_0x52bf6e[0x0][_0x4756('0x15d')])){_0x268d48[_0x4756('0x155')](_0x4756('0x1fa'),_0x59a852,_0x52bf6e[0x0]);}else{return hopperUtils[_0x4756('0x20b')](_[_0x4756('0x70')](_0x52bf6e[0x0],[_0x4756('0xec'),_0x4756('0x15d')]))[_0x4756('0x3a')](_0x268d48[_0x4756('0x1e0')](_0x59a852,_0x52bf6e[0x0]))[_0x4756('0xa4')](_0x268d48[_0x4756('0x1fc')](_0x4756('0x20c'),_0x59a852));}}}})[_0x4756('0xa4')](loggerGetContactDialer(_0x4756('0x20d'),_0x59a852,0x1));};Dialer['prototype'][_0x4756('0x1d3')]=function(_0x6d7ed7,_0x2916ec,_0x3bcca0,_0x51d56d,_0x36a64c,_0x3436de){loggerPredictive['info'](_0x4756('0x20e'));loggerPredictive[_0x4756('0x45')](_0x4756('0x20f'),_0x6d7ed7);loggerPredictive[_0x4756('0x45')](_0x4756('0x210'),_0x2916ec);loggerPredictive['info']('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3bcca0);loggerPredictive[_0x4756('0x45')](_0x4756('0x211'),_0x51d56d);loggerPredictive[_0x4756('0x45')](_0x4756('0x212'),_0x36a64c);loggerPredictive[_0x4756('0x45')](_0x4756('0x4e'));return new Promise(function(_0x8548d8,_0xd02b0b){if(_0x6d7ed7<=0x0||isNaN(_0x6d7ed7)){return _0xd02b0b(msgResponse(_0x4756('0x213'),_0x4756('0x81'),_0x4756('0x214')+_0x6d7ed7));}if(_0x3bcca0<=0x0||isNaN(_0x3bcca0)){return _0xd02b0b(msgResponse(_0x4756('0x213'),_0x4756('0x81'),'Ts\x20=\x20'+_0x3bcca0));}if(_0x51d56d<=0x0||isNaN(_0x51d56d)){return _0xd02b0b(msgResponse(_0x4756('0x213'),_0x4756('0x81'),_0x4756('0x215')+_0x51d56d));}if(_0x2916ec<=0x0||isNaN(_0x2916ec)){return _0xd02b0b(msgResponse(_0x4756('0x213'),_0x4756('0x81'),_0x4756('0x216')+_0x2916ec));}if(_0x36a64c<=0x0||isNaN(_0x36a64c)){return _0xd02b0b(msgResponse(_0x4756('0x213'),_0x4756('0x81'),_0x4756('0x217')+_0x36a64c));}_0x3436de=_0x3436de||0x0;var _0x1b58dc=0x1/_0x3bcca0;var _0x2bf27c=0x0;var _0x111728=0x0;var _0x5594fe=0x0;var _0x58a5a0=0x0;for(var _0x23cb5c=0x0;_0x5594fe<_0x36a64c;_0x23cb5c+=0x1){_0x111728=_0x23cb5c/_0x2916ec;_0x2bf27c=(_0x51d56d*_0x111728+_0x3436de)/_0x1b58dc;_0x5594fe=utils[_0x4756('0x218')](_0x2bf27c,_0x6d7ed7);_0x58a5a0=_0x2bf27c/_0x6d7ed7*(0x1-utils['erlangb'](_0x2bf27c,_0x6d7ed7));}return _0x8548d8({'erlangCalls':_0x23cb5c,'erlangCallToSecond':_0x2916ec/_0x23cb5c,'erlangAbandonmentRate':_0x5594fe,'erlangBusyFactor':_0x58a5a0});});};Dialer['prototype'][_0x4756('0x1d5')]=function(_0x44b67f,_0x235fa6,_0x3402c8,_0x1725fc,_0x2ec6bf,_0x15bfd5){loggerPredictive[_0x4756('0x45')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x4756('0x45')](_0x4756('0x20f'),_0x44b67f);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x235fa6);loggerPredictive[_0x4756('0x45')](_0x4756('0x219'),_0x3402c8);loggerPredictive[_0x4756('0x45')](_0x4756('0x211'),_0x1725fc);loggerPredictive[_0x4756('0x45')](_0x4756('0x21a'),_0x2ec6bf);loggerPredictive[_0x4756('0x45')](_0x4756('0x4e'));return new Promise(function(_0x6a399b,_0x77f383){if(_0x44b67f<=0x0||isNaN(_0x44b67f)){return _0x77f383(msgResponse('[busyFactor]','Error','m\x20=\x20'+_0x44b67f));}if(_0x3402c8<=0x0||isNaN(_0x3402c8)){return _0x77f383(msgResponse(_0x4756('0x21b'),_0x4756('0x81'),_0x4756('0x21c')+_0x3402c8));}if(_0x1725fc<=0x0||isNaN(_0x1725fc)){return _0x77f383(msgResponse(_0x4756('0x21b'),_0x4756('0x81'),_0x4756('0x215')+_0x1725fc));}if(_0x235fa6<=0x0||isNaN(_0x235fa6)){return _0x77f383(msgResponse(_0x4756('0x21b'),_0x4756('0x81'),_0x4756('0x216')+_0x235fa6));}if(_0x2ec6bf<=0x0||isNaN(_0x2ec6bf)){return _0x77f383(msgResponse('[busyFactor]',_0x4756('0x81'),_0x4756('0x21d')+_0x2ec6bf));}_0x15bfd5=_0x15bfd5||0x0;var _0xd52dbf=0x1/_0x3402c8;var _0x16014d=0x0;var _0x57cc4d=0x0;var _0x5e8b71=0x0;var _0x199b0d=0x0;for(var _0x23f402=0x0;_0x199b0d<_0x2ec6bf;_0x23f402+=0x1){_0x57cc4d=_0x23f402/_0x235fa6;_0x16014d=(_0x1725fc*_0x57cc4d+_0x15bfd5)/_0xd52dbf;_0x5e8b71=utils[_0x4756('0x218')](_0x16014d,_0x44b67f);_0x199b0d=_0x16014d/_0x44b67f*(0x1-utils[_0x4756('0x218')](_0x16014d,_0x44b67f));}return _0x6a399b({'erlangCalls':_0x23f402,'erlangCallToSecond':_0x235fa6/_0x23f402,'erlangAbandonmentRate':_0x5e8b71,'erlangBusyFactor':_0x199b0d});});};module[_0x4756('0x21e')]=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 a973443..b390de1 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 _0x54d3=['callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','dialCutDigit','substring','exports','util','moment','isNil','string','voiceQueue','name','Contact','firstName','lastName','number','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xfb0ac9,_0x299fc2){var _0x367369=function(_0x14d5ee){while(--_0x14d5ee){_0xfb0ac9['push'](_0xfb0ac9['shift']());}};_0x367369(++_0x299fc2);}(_0x54d3,0x184));var _0x354d=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x54d3[_0x2a6809];return _0x11c371;};'use strict';var util=require(_0x354d('0x0'));var _=require('lodash');var moment=require(_0x354d('0x1'));function checkNameSurname(_0x3d76d6,_0x11672f,_0x29dd9b){var _0x5199aa='';if(!_[_0x354d('0x2')](_0x11672f)&&_0x354d('0x3')===typeof _0x11672f){_0x5199aa+=_0x11672f;}if(!_[_0x354d('0x2')](_0x29dd9b)&&_0x354d('0x3')===typeof _0x29dd9b){_0x5199aa+='\x20'+_0x29dd9b;}if(_0x5199aa!==''){return _0x5199aa;}return _0x3d76d6;}function Action(_0x2dd9f9,_0x25996e,_0x220f8b){this[_0x354d('0x4')]=_0x2dd9f9;this['uniqueid']=_0x220f8b||undefined;this[_0x354d('0x5')]=checkNameSurname(_0x25996e[_0x354d('0x6')]['phone'],_0x25996e['Contact'][_0x354d('0x7')],_0x25996e[_0x354d('0x6')][_0x354d('0x8')]);this[_0x354d('0x9')]=_0x25996e[_0x354d('0xa')];this[_0x354d('0xb')]=_0x2dd9f9[_0x354d('0x5')];this[_0x354d('0xc')]=_0x25996e[_0x354d('0xc')]||![];this[_0x354d('0xd')]=_0x2dd9f9[_0x354d('0xd')];this['dialQueueTimeout']=_0x2dd9f9[_0x354d('0xe')]||0x3;this[_0x354d('0xf')]=_0x25996e['scheduledat'];this[_0x354d('0x10')]=_0x25996e[_0x354d('0x10')];this[_0x354d('0x11')]=_0x25996e[_0x354d('0x11')];this[_0x354d('0x12')]=_0x25996e['countnoanswerretry'];this[_0x354d('0x13')]=_0x25996e[_0x354d('0x13')];this[_0x354d('0x14')]=_0x25996e[_0x354d('0x14')];this['countabandonedretry']=_0x25996e[_0x354d('0x15')];this[_0x354d('0x16')]=_0x25996e[_0x354d('0x16')];this[_0x354d('0x17')]=_0x25996e['countagentrejectretry'];this[_0x354d('0x18')]=_0x25996e[_0x354d('0x18')];this['ListId']=_0x25996e['ListId'];this['UserId']=_0x25996e[_0x354d('0x19')];this[_0x354d('0x1a')]=_0x25996e[_0x354d('0x1a')];this['CampaignId']=_0x25996e[_0x354d('0x1b')];this['idHopper']=_0x25996e['id'];this[_0x354d('0x1c')]=_0x25996e['Contact']['firstName']||'';this[_0x354d('0x1d')]=moment()[_0x354d('0x1e')](_0x354d('0x1f'));this[_0x354d('0x20')]=_0x25996e[_0x354d('0x20')];this['callbackuniqueid']=_0x25996e[_0x354d('0x21')];this[_0x354d('0x22')]=_0x25996e[_0x354d('0x22')];this['recallme']=_0x25996e[_0x354d('0x23')];this[_0x354d('0x24')]='';this[_0x354d('0x25')]='';}Action[_0x354d('0x26')]['getCaller']=function(){return util[_0x354d('0x1e')]('\x22%s\x22\x20<%s>',this[_0x354d('0x5')],this[_0x354d('0x4')][_0x354d('0x27')]>0x0?this[_0x354d('0x9')][_0x354d('0x28')](this[_0x354d('0x4')][_0x354d('0x27')]):this['number']);};Action[_0x354d('0x26')]['getQueue']=function(){return this['queue'];};module[_0x354d('0x29')]=Action; \ No newline at end of file +var _0x85cb=['string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','active','dialQueueTimeout','scheduledat','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','substring','dialCutDigit','prototype','getQueue','queue','exports','util','lodash','moment','isNil'];(function(_0x5036f6,_0x19474c){var _0x33032b=function(_0x222e47){while(--_0x222e47){_0x5036f6['push'](_0x5036f6['shift']());}};_0x33032b(++_0x19474c);}(_0x85cb,0x137));var _0xb85c=function(_0x5b8d9c,_0x22ba30){_0x5b8d9c=_0x5b8d9c-0x0;var _0x3f33e8=_0x85cb[_0x5b8d9c];return _0x3f33e8;};'use strict';var util=require(_0xb85c('0x0'));var _=require(_0xb85c('0x1'));var moment=require(_0xb85c('0x2'));function checkNameSurname(_0x1578b5,_0x3e5b63,_0x1204f2){var _0x3c9dae='';if(!_[_0xb85c('0x3')](_0x3e5b63)&&_0xb85c('0x4')===typeof _0x3e5b63){_0x3c9dae+=_0x3e5b63;}if(!_[_0xb85c('0x3')](_0x1204f2)&&_0xb85c('0x4')===typeof _0x1204f2){_0x3c9dae+='\x20'+_0x1204f2;}if(_0x3c9dae!==''){return _0x3c9dae;}return _0x1578b5;}function Action(_0x13991b,_0x5d15a2,_0x200c8e){this[_0xb85c('0x5')]=_0x13991b;this[_0xb85c('0x6')]=_0x200c8e||undefined;this[_0xb85c('0x7')]=checkNameSurname(_0x5d15a2[_0xb85c('0x8')][_0xb85c('0x9')],_0x5d15a2[_0xb85c('0x8')][_0xb85c('0xa')],_0x5d15a2[_0xb85c('0x8')][_0xb85c('0xb')]);this[_0xb85c('0xc')]=_0x5d15a2[_0xb85c('0x9')];this['queue']=_0x13991b['name'];this[_0xb85c('0xd')]=_0x5d15a2['active']||![];this['type']=_0x13991b['type'];this[_0xb85c('0xe')]=_0x13991b[_0xb85c('0xe')]||0x3;this[_0xb85c('0xf')]=_0x5d15a2[_0xb85c('0xf')];this['countbusyretry']=_0x5d15a2['countbusyretry'];this[_0xb85c('0x10')]=_0x5d15a2[_0xb85c('0x10')];this[_0xb85c('0x11')]=_0x5d15a2[_0xb85c('0x11')];this[_0xb85c('0x12')]=_0x5d15a2['countnosuchnumberretry'];this[_0xb85c('0x13')]=_0x5d15a2[_0xb85c('0x13')];this['countabandonedretry']=_0x5d15a2[_0xb85c('0x14')];this[_0xb85c('0x15')]=_0x5d15a2[_0xb85c('0x15')];this['countagentrejectretry']=_0x5d15a2[_0xb85c('0x16')];this[_0xb85c('0x17')]=_0x5d15a2['ContactId'];this[_0xb85c('0x18')]=_0x5d15a2['ListId'];this[_0xb85c('0x19')]=_0x5d15a2[_0xb85c('0x19')];this['VoiceQueueId']=_0x5d15a2['VoiceQueueId'];this[_0xb85c('0x1a')]=_0x5d15a2[_0xb85c('0x1a')];this[_0xb85c('0x1b')]=_0x5d15a2['id'];this[_0xb85c('0x1c')]=_0x5d15a2[_0xb85c('0x8')]['firstName']||'';this[_0xb85c('0x1d')]=moment()[_0xb85c('0x1e')](_0xb85c('0x1f'));this[_0xb85c('0x20')]=_0x5d15a2[_0xb85c('0x20')];this[_0xb85c('0x21')]=_0x5d15a2[_0xb85c('0x21')];this[_0xb85c('0x22')]=_0x5d15a2['callbackat'];this[_0xb85c('0x23')]=_0x5d15a2['recallme'];this[_0xb85c('0x24')]='';this['originatecalleridname']='';}Action['prototype'][_0xb85c('0x25')]=function(){return util[_0xb85c('0x1e')](_0xb85c('0x26'),this[_0xb85c('0x7')],this[_0xb85c('0x5')]['dialCutDigit']>0x0?this[_0xb85c('0xc')][_0xb85c('0x27')](this[_0xb85c('0x5')][_0xb85c('0x28')]):this[_0xb85c('0xc')]);};Action[_0xb85c('0x29')][_0xb85c('0x2a')]=function(){return this[_0xb85c('0x2b')];};module[_0xb85c('0x2c')]=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 f441037..9c1bc87 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 _0x3d5f=['getSeconds','responsetime','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','../utils','statedesc','Answer','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0x3d5f,0x152));var _0xf3d5=function(_0x5f0ebb,_0x43d438){_0x5f0ebb=_0x5f0ebb-0x0;var _0x1f3c43=_0x3d5f[_0x5f0ebb];return _0x1f3c43;};'use strict';var moment=require('moment');var utils=require(_0xf3d5('0x0'));function AgentComplete(_0xdbbb42,_0xf797b9){this['state']=0x4;this[_0xf3d5('0x1')]=_0xf3d5('0x2');this[_0xf3d5('0x3')]=_0xdbbb42[_0xf3d5('0x3')];this[_0xf3d5('0x4')]=_0xdbbb42[_0xf3d5('0x4')];this['campaigntype']=_0xdbbb42[_0xf3d5('0x4')]==='outbound'?'queue':_0xdbbb42[_0xf3d5('0x4')];this['countbusyretry']=_0xdbbb42[_0xf3d5('0x5')];this[_0xf3d5('0x6')]=_0xdbbb42[_0xf3d5('0x6')];this[_0xf3d5('0x7')]=_0xdbbb42[_0xf3d5('0x7')];this['countglobal']=_0xdbbb42['countbusyretry']+_0xdbbb42['countcongestionretry']+_0xdbbb42[_0xf3d5('0x7')]+_0xdbbb42[_0xf3d5('0x8')]+_0xdbbb42[_0xf3d5('0x9')]+_0xdbbb42['countabandonedretry']+_0xdbbb42[_0xf3d5('0xa')]+_0xdbbb42[_0xf3d5('0xb')];this['countnosuchnumberretry']=_0xdbbb42[_0xf3d5('0x8')];this[_0xf3d5('0x9')]=_0xdbbb42[_0xf3d5('0x9')];this[_0xf3d5('0xc')]=_0xdbbb42[_0xf3d5('0xc')];this[_0xf3d5('0xa')]=_0xdbbb42[_0xf3d5('0xa')];this[_0xf3d5('0xb')]=_0xdbbb42[_0xf3d5('0xb')];this[_0xf3d5('0xd')]=_0xf797b9[_0xf3d5('0xd')];this[_0xf3d5('0xe')]=_0xdbbb42[_0xf3d5('0xf')];this[_0xf3d5('0x10')]=_0xdbbb42[_0xf3d5('0x11')];this[_0xf3d5('0x12')]=_0xdbbb42['starttime'];this['responsetime']=_0xdbbb42['responsetime'];this[_0xf3d5('0x13')]=_0xdbbb42['answertime'];this[_0xf3d5('0x14')]=moment()['format'](_0xf3d5('0x15'));this['ringtime']=utils[_0xf3d5('0x16')](_0xdbbb42[_0xf3d5('0x17')],_0xdbbb42['starttime']);this[_0xf3d5('0x18')]=utils['getSeconds'](_0xdbbb42[_0xf3d5('0x13')],_0xdbbb42[_0xf3d5('0x17')]);this[_0xf3d5('0x19')]=utils[_0xf3d5('0x16')](this[_0xf3d5('0x14')],_0xdbbb42[_0xf3d5('0x13')]);this[_0xf3d5('0x1a')]=_0xf797b9[_0xf3d5('0x1a')];this[_0xf3d5('0x1b')]=_0xf797b9[_0xf3d5('0x1b')];this[_0xf3d5('0x1c')]=_0xf797b9[_0xf3d5('0x1c')];this['callback']=_0xdbbb42[_0xf3d5('0x1d')];this[_0xf3d5('0x1e')]=_0xdbbb42[_0xf3d5('0x1e')];this[_0xf3d5('0x1f')]=_0xdbbb42[_0xf3d5('0x1f')];this['recallme']=_0xdbbb42[_0xf3d5('0x20')];this['ContactId']=_0xdbbb42[_0xf3d5('0x21')];this[_0xf3d5('0x22')]=_0xdbbb42[_0xf3d5('0x22')];this['UserId']=_0xdbbb42['UserId'];this[_0xf3d5('0x23')]=_0xdbbb42[_0xf3d5('0x23')];this[_0xf3d5('0x24')]=_0xdbbb42[_0xf3d5('0x24')];this['originatecalleridnum']=_0xdbbb42[_0xf3d5('0x25')]||'';this[_0xf3d5('0x26')]=_0xdbbb42[_0xf3d5('0x26')]||'';this[_0xf3d5('0x27')]=_0xdbbb42['agiafterat'];}module['exports']=AgentComplete; \ No newline at end of file +var _0xfb5b=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','starttime','responsetime','answertime','endtime','format','ringtime','getSeconds','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','statedesc','Answer','scheduledat','type'];(function(_0x39cf70,_0x3ec55b){var _0x580424=function(_0x580a4e){while(--_0x580a4e){_0x39cf70['push'](_0x39cf70['shift']());}};_0x580424(++_0x3ec55b);}(_0xfb5b,0xf1));var _0xbfb5=function(_0x890cdc,_0x5b98b7){_0x890cdc=_0x890cdc-0x0;var _0x3e6864=_0xfb5b[_0x890cdc];return _0x3e6864;};'use strict';var moment=require('moment');var utils=require(_0xbfb5('0x0'));function AgentComplete(_0x13400e,_0x5b6dfb){this['state']=0x4;this[_0xbfb5('0x1')]=_0xbfb5('0x2');this[_0xbfb5('0x3')]=_0x13400e[_0xbfb5('0x3')];this[_0xbfb5('0x4')]=_0x13400e[_0xbfb5('0x4')];this['campaigntype']=_0x13400e['type']===_0xbfb5('0x5')?_0xbfb5('0x6'):_0x13400e[_0xbfb5('0x4')];this[_0xbfb5('0x7')]=_0x13400e[_0xbfb5('0x7')];this[_0xbfb5('0x8')]=_0x13400e[_0xbfb5('0x8')];this[_0xbfb5('0x9')]=_0x13400e['countnoanswerretry'];this['countglobal']=_0x13400e[_0xbfb5('0x7')]+_0x13400e['countcongestionretry']+_0x13400e[_0xbfb5('0x9')]+_0x13400e[_0xbfb5('0xa')]+_0x13400e[_0xbfb5('0xb')]+_0x13400e[_0xbfb5('0xc')]+_0x13400e[_0xbfb5('0xd')]+_0x13400e['countagentrejectretry'];this[_0xbfb5('0xa')]=_0x13400e[_0xbfb5('0xa')];this[_0xbfb5('0xb')]=_0x13400e[_0xbfb5('0xb')];this[_0xbfb5('0xc')]=_0x13400e['countabandonedretry'];this[_0xbfb5('0xd')]=_0x13400e[_0xbfb5('0xd')];this[_0xbfb5('0xe')]=_0x13400e[_0xbfb5('0xe')];this[_0xbfb5('0xf')]=_0x5b6dfb[_0xbfb5('0xf')];this['calleridname']=_0x13400e[_0xbfb5('0x10')];this[_0xbfb5('0x11')]=_0x13400e['number'];this['starttime']=_0x13400e[_0xbfb5('0x12')];this[_0xbfb5('0x13')]=_0x13400e['responsetime'];this[_0xbfb5('0x14')]=_0x13400e['answertime'];this[_0xbfb5('0x15')]=moment()[_0xbfb5('0x16')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xbfb5('0x17')]=utils['getSeconds'](_0x13400e[_0xbfb5('0x13')],_0x13400e[_0xbfb5('0x12')]);this['holdtime']=utils[_0xbfb5('0x18')](_0x13400e[_0xbfb5('0x14')],_0x13400e[_0xbfb5('0x13')]);this[_0xbfb5('0x19')]=utils[_0xbfb5('0x18')](this[_0xbfb5('0x15')],_0x13400e[_0xbfb5('0x14')]);this[_0xbfb5('0x6')]=_0x5b6dfb[_0xbfb5('0x6')];this[_0xbfb5('0x1a')]=_0x5b6dfb['membername'];this[_0xbfb5('0x1b')]=_0x5b6dfb[_0xbfb5('0x1b')];this[_0xbfb5('0x1c')]=_0x13400e[_0xbfb5('0x1c')];this[_0xbfb5('0x1d')]=_0x13400e[_0xbfb5('0x1d')];this[_0xbfb5('0x1e')]=_0x13400e['callbackat'];this[_0xbfb5('0x1f')]=_0x13400e[_0xbfb5('0x1f')];this[_0xbfb5('0x20')]=_0x13400e[_0xbfb5('0x20')];this[_0xbfb5('0x21')]=_0x13400e[_0xbfb5('0x21')];this[_0xbfb5('0x22')]=_0x13400e[_0xbfb5('0x22')];this[_0xbfb5('0x23')]=_0x13400e[_0xbfb5('0x23')];this['CampaignId']=_0x13400e[_0xbfb5('0x24')];this[_0xbfb5('0x25')]=_0x13400e[_0xbfb5('0x25')]||'';this[_0xbfb5('0x26')]=_0x13400e[_0xbfb5('0x26')]||'';this[_0xbfb5('0x27')]=_0x13400e[_0xbfb5('0x27')];}module[_0xbfb5('0x28')]=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 9c03dda..c791017 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 _0xbd3a=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','type','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x26fdfa,_0x3ec54b){var _0x5f1773=function(_0x1e5573){while(--_0x1e5573){_0x26fdfa['push'](_0x26fdfa['shift']());}};_0x5f1773(++_0x3ec54b);}(_0xbd3a,0xa8));var _0xabd3=function(_0x4f1d8d,_0x5a4b5c){_0x4f1d8d=_0x4f1d8d-0x0;var _0x49fa3e=_0xbd3a[_0x4f1d8d];return _0x49fa3e;};'use strict';function Final(_0x2f7df7){this['uniqueid']=_0x2f7df7['uniqueid'];this['scheduledat']=_0x2f7df7['scheduledat'];this[_0xabd3('0x0')]=_0x2f7df7[_0xabd3('0x0')];this['campaigntype']=_0x2f7df7[_0xabd3('0x0')]===_0xabd3('0x1')?_0xabd3('0x2'):_0x2f7df7[_0xabd3('0x0')];this['countbusyretry']=_0x2f7df7['countbusyretry'];this[_0xabd3('0x3')]=_0x2f7df7[_0xabd3('0x3')];this[_0xabd3('0x4')]=_0x2f7df7[_0xabd3('0x4')];this[_0xabd3('0x5')]=_0x2f7df7[_0xabd3('0x6')]+_0x2f7df7[_0xabd3('0x3')]+_0x2f7df7['countnoanswerretry']+_0x2f7df7[_0xabd3('0x7')]+_0x2f7df7[_0xabd3('0x8')]+_0x2f7df7[_0xabd3('0x9')]+_0x2f7df7[_0xabd3('0xa')]+_0x2f7df7[_0xabd3('0xb')];this[_0xabd3('0x7')]=_0x2f7df7[_0xabd3('0x7')];this['countdropretry']=_0x2f7df7['countdropretry'];this[_0xabd3('0x9')]=_0x2f7df7[_0xabd3('0x9')];this['countmachineretry']=_0x2f7df7['countmachineretry'];this[_0xabd3('0xb')]=_0x2f7df7['countagentrejectretry'];this['queue']=_0x2f7df7[_0xabd3('0x2')];this[_0xabd3('0xc')]=_0x2f7df7[_0xabd3('0xc')];this[_0xabd3('0xd')]=_0x2f7df7[_0xabd3('0xd')];this[_0xabd3('0xe')]=_0x2f7df7[_0xabd3('0xe')];this[_0xabd3('0xf')]=_0x2f7df7[_0xabd3('0xf')];this['endtime']=_0x2f7df7[_0xabd3('0xf')];this[_0xabd3('0x10')]=_0x2f7df7['ringtime']||0x0;this['holdtime']=_0x2f7df7[_0xabd3('0x11')]||0x0;this[_0xabd3('0x12')]=_0x2f7df7[_0xabd3('0x12')]||0x0;this['callback']=_0x2f7df7['callback'];this[_0xabd3('0x13')]=_0x2f7df7[_0xabd3('0x13')];this[_0xabd3('0x14')]=_0x2f7df7[_0xabd3('0x14')];this[_0xabd3('0x15')]=_0x2f7df7[_0xabd3('0x15')];this[_0xabd3('0x16')]=_0x2f7df7[_0xabd3('0x16')];this[_0xabd3('0x17')]=_0x2f7df7[_0xabd3('0x17')];this['UserId']=_0x2f7df7[_0xabd3('0x18')];this['VoiceQueueId']=_0x2f7df7[_0xabd3('0x19')];this[_0xabd3('0x1a')]=_0x2f7df7[_0xabd3('0x1a')];this[_0xabd3('0x1b')]=_0x2f7df7['originatecalleridnum']||'';this[_0xabd3('0x1c')]=_0x2f7df7[_0xabd3('0x1c')]||'';this[_0xabd3('0x1d')]=_0x2f7df7['state'];this[_0xabd3('0x1e')]=_0x2f7df7[_0xabd3('0x1e')];}module[_0xabd3('0x1f')]=Final; \ No newline at end of file +var _0xcdef=['countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','outbound'];(function(_0x52684f,_0xff73fc){var _0x4a55f0=function(_0x8ce37c){while(--_0x8ce37c){_0x52684f['push'](_0x52684f['shift']());}};_0x4a55f0(++_0xff73fc);}(_0xcdef,0xa1));var _0xfcde=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xcdef[_0x59ee6f];return _0x4c0979;};'use strict';function Final(_0x5d8104){this['uniqueid']=_0x5d8104[_0xfcde('0x0')];this['scheduledat']=_0x5d8104[_0xfcde('0x1')];this[_0xfcde('0x2')]=_0x5d8104['type'];this['campaigntype']=_0x5d8104[_0xfcde('0x2')]===_0xfcde('0x3')?'queue':_0x5d8104[_0xfcde('0x2')];this['countbusyretry']=_0x5d8104['countbusyretry'];this[_0xfcde('0x4')]=_0x5d8104[_0xfcde('0x4')];this[_0xfcde('0x5')]=_0x5d8104[_0xfcde('0x5')];this[_0xfcde('0x6')]=_0x5d8104[_0xfcde('0x7')]+_0x5d8104[_0xfcde('0x4')]+_0x5d8104[_0xfcde('0x5')]+_0x5d8104[_0xfcde('0x8')]+_0x5d8104[_0xfcde('0x9')]+_0x5d8104[_0xfcde('0xa')]+_0x5d8104[_0xfcde('0xb')]+_0x5d8104['countagentrejectretry'];this[_0xfcde('0x8')]=_0x5d8104[_0xfcde('0x8')];this[_0xfcde('0x9')]=_0x5d8104[_0xfcde('0x9')];this[_0xfcde('0xa')]=_0x5d8104[_0xfcde('0xa')];this[_0xfcde('0xb')]=_0x5d8104[_0xfcde('0xb')];this['countagentrejectretry']=_0x5d8104[_0xfcde('0xc')];this[_0xfcde('0xd')]=_0x5d8104[_0xfcde('0xd')];this[_0xfcde('0xe')]=_0x5d8104[_0xfcde('0xe')];this[_0xfcde('0xf')]=_0x5d8104['calleridnum'];this[_0xfcde('0x10')]=_0x5d8104['starttime'];this[_0xfcde('0x11')]=_0x5d8104[_0xfcde('0x11')];this[_0xfcde('0x12')]=_0x5d8104[_0xfcde('0x11')];this['ringtime']=_0x5d8104[_0xfcde('0x13')]||0x0;this['holdtime']=_0x5d8104[_0xfcde('0x14')]||0x0;this['talktime']=_0x5d8104['talktime']||0x0;this['callback']=_0x5d8104['callback'];this[_0xfcde('0x15')]=_0x5d8104['callbackuniqueid'];this[_0xfcde('0x16')]=_0x5d8104[_0xfcde('0x16')];this['recallme']=_0x5d8104[_0xfcde('0x17')];this[_0xfcde('0x18')]=_0x5d8104[_0xfcde('0x18')];this[_0xfcde('0x19')]=_0x5d8104[_0xfcde('0x19')];this[_0xfcde('0x1a')]=_0x5d8104[_0xfcde('0x1a')];this[_0xfcde('0x1b')]=_0x5d8104['VoiceQueueId'];this[_0xfcde('0x1c')]=_0x5d8104[_0xfcde('0x1c')];this[_0xfcde('0x1d')]=_0x5d8104[_0xfcde('0x1d')]||'';this[_0xfcde('0x1e')]=_0x5d8104[_0xfcde('0x1e')]||'';this[_0xfcde('0x1f')]=_0x5d8104['state'];this[_0xfcde('0x20')]=_0x5d8104['statedesc'];}module['exports']=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 88f4f04..d9a58df 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 _0xecca=['scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','getSeconds','cause-txt','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','moment','state','statedesc','Answer'];(function(_0x52cfc5,_0x56ffcd){var _0x56a322=function(_0x269adc){while(--_0x269adc){_0x52cfc5['push'](_0x52cfc5['shift']());}};_0x56a322(++_0x56ffcd);}(_0xecca,0x196));var _0xaecc=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xecca[_0x580576];return _0x3f55a0;};'use strict';var moment=require(_0xaecc('0x0'));var utils=require('../utils');function Hangup(_0x176c29,_0x40fb28){this[_0xaecc('0x1')]=0x4;this[_0xaecc('0x2')]=_0xaecc('0x3');this['scheduledat']=_0x176c29[_0xaecc('0x4')];this[_0xaecc('0x5')]=_0x176c29[_0xaecc('0x5')];this[_0xaecc('0x6')]=_0x176c29[_0xaecc('0x5')]===_0xaecc('0x7')?_0xaecc('0x8'):_0x176c29['type'];this[_0xaecc('0x9')]=_0x176c29[_0xaecc('0x9')]||![];this[_0xaecc('0xa')]=_0x176c29[_0xaecc('0xa')];this[_0xaecc('0xb')]=_0x176c29['countcongestionretry'];this['countnoanswerretry']=_0x176c29[_0xaecc('0xc')];this[_0xaecc('0xd')]=_0x176c29['countbusyretry']+_0x176c29['countcongestionretry']+_0x176c29['countnoanswerretry']+_0x176c29[_0xaecc('0xe')]+_0x176c29[_0xaecc('0xf')]+_0x176c29['countabandonedretry']+_0x176c29['countmachineretry']+_0x176c29[_0xaecc('0x10')];this['countnosuchnumberretry']=_0x176c29[_0xaecc('0xe')];this[_0xaecc('0xf')]=_0x176c29[_0xaecc('0xf')];this[_0xaecc('0x11')]=_0x176c29[_0xaecc('0x11')];this[_0xaecc('0x12')]=_0x176c29[_0xaecc('0x12')];this[_0xaecc('0x10')]=_0x176c29['countagentrejectretry'];this[_0xaecc('0x13')]=_0x40fb28[_0xaecc('0x13')];this['calleridname']=_0x176c29[_0xaecc('0x14')];this[_0xaecc('0x15')]=_0x176c29[_0xaecc('0x16')];this[_0xaecc('0x17')]=_0x176c29[_0xaecc('0x17')];this[_0xaecc('0x18')]=_0x176c29[_0xaecc('0x18')];this[_0xaecc('0x19')]=moment()[_0xaecc('0x1a')](_0xaecc('0x1b'));this[_0xaecc('0x1c')]=utils['getSeconds'](_0x176c29[_0xaecc('0x18')],_0x176c29['starttime']);this[_0xaecc('0x1d')]=0x0;this[_0xaecc('0x1e')]=utils[_0xaecc('0x1f')](this[_0xaecc('0x19')],_0x176c29[_0xaecc('0x18')]);this['queue']=_0x176c29[_0xaecc('0x8')];this['membername']='IVR';this['reason']=_0x40fb28[_0xaecc('0x20')];this['callback']=_0x176c29[_0xaecc('0x21')];this['callbackuniqueid']=_0x176c29[_0xaecc('0x22')];this[_0xaecc('0x23')]=_0x176c29[_0xaecc('0x23')];this[_0xaecc('0x24')]=_0x176c29[_0xaecc('0x24')];this['ContactId']=_0x176c29['ContactId'];this[_0xaecc('0x25')]=_0x176c29['ListId'];this['UserId']=_0x176c29[_0xaecc('0x26')];this[_0xaecc('0x27')]=_0x176c29[_0xaecc('0x27')];this['CampaignId']=_0x176c29[_0xaecc('0x28')];}module['exports']=Hangup; \ No newline at end of file +var _0xb5fd=['countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','queue','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry'];(function(_0x513ec5,_0x359443){var _0x3a913a=function(_0x9f3339){while(--_0x9f3339){_0x513ec5['push'](_0x513ec5['shift']());}};_0x3a913a(++_0x359443);}(_0xb5fd,0x71));var _0xdb5f=function(_0x1e3c5e,_0x12df05){_0x1e3c5e=_0x1e3c5e-0x0;var _0x3c83ac=_0xb5fd[_0x1e3c5e];return _0x3c83ac;};'use strict';var moment=require('moment');var utils=require(_0xdb5f('0x0'));function Hangup(_0x38292a,_0x294900){this[_0xdb5f('0x1')]=0x4;this[_0xdb5f('0x2')]=_0xdb5f('0x3');this[_0xdb5f('0x4')]=_0x38292a[_0xdb5f('0x4')];this[_0xdb5f('0x5')]=_0x38292a[_0xdb5f('0x5')];this[_0xdb5f('0x6')]=_0x38292a[_0xdb5f('0x5')]==='outbound'?'queue':_0x38292a[_0xdb5f('0x5')];this[_0xdb5f('0x7')]=_0x38292a[_0xdb5f('0x7')]||![];this[_0xdb5f('0x8')]=_0x38292a['countbusyretry'];this['countcongestionretry']=_0x38292a[_0xdb5f('0x9')];this[_0xdb5f('0xa')]=_0x38292a[_0xdb5f('0xa')];this['countglobal']=_0x38292a['countbusyretry']+_0x38292a[_0xdb5f('0x9')]+_0x38292a[_0xdb5f('0xa')]+_0x38292a[_0xdb5f('0xb')]+_0x38292a[_0xdb5f('0xc')]+_0x38292a[_0xdb5f('0xd')]+_0x38292a[_0xdb5f('0xe')]+_0x38292a[_0xdb5f('0xf')];this[_0xdb5f('0xb')]=_0x38292a[_0xdb5f('0xb')];this[_0xdb5f('0xc')]=_0x38292a[_0xdb5f('0xc')];this[_0xdb5f('0xd')]=_0x38292a['countabandonedretry'];this['countmachineretry']=_0x38292a[_0xdb5f('0xe')];this['countagentrejectretry']=_0x38292a[_0xdb5f('0xf')];this[_0xdb5f('0x10')]=_0x294900[_0xdb5f('0x10')];this[_0xdb5f('0x11')]=_0x38292a[_0xdb5f('0x12')];this['calleridnum']=_0x38292a[_0xdb5f('0x13')];this[_0xdb5f('0x14')]=_0x38292a['starttime'];this[_0xdb5f('0x15')]=_0x38292a[_0xdb5f('0x15')];this[_0xdb5f('0x16')]=moment()[_0xdb5f('0x17')](_0xdb5f('0x18'));this['ringtime']=utils[_0xdb5f('0x19')](_0x38292a['responsetime'],_0x38292a[_0xdb5f('0x14')]);this[_0xdb5f('0x1a')]=0x0;this['talktime']=utils[_0xdb5f('0x19')](this[_0xdb5f('0x16')],_0x38292a[_0xdb5f('0x15')]);this['queue']=_0x38292a[_0xdb5f('0x1b')];this[_0xdb5f('0x1c')]=_0xdb5f('0x1d');this[_0xdb5f('0x1e')]=_0x294900[_0xdb5f('0x1f')];this['callback']=_0x38292a[_0xdb5f('0x20')];this[_0xdb5f('0x21')]=_0x38292a['callbackuniqueid'];this[_0xdb5f('0x22')]=_0x38292a[_0xdb5f('0x22')];this[_0xdb5f('0x23')]=_0x38292a[_0xdb5f('0x23')];this[_0xdb5f('0x24')]=_0x38292a['ContactId'];this[_0xdb5f('0x25')]=_0x38292a[_0xdb5f('0x25')];this[_0xdb5f('0x26')]=_0x38292a[_0xdb5f('0x26')];this[_0xdb5f('0x27')]=_0x38292a[_0xdb5f('0x27')];this[_0xdb5f('0x28')]=_0x38292a[_0xdb5f('0x28')];}module[_0xdb5f('0x29')]=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 fc72c01..28328e2 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 _0xe859=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','starttime','responsetime','endtime','getSeconds','callback','callbackuniqueid','callbackat'];(function(_0x74b6f,_0x1c1ddd){var _0x513e89=function(_0x41f843){while(--_0x41f843){_0x74b6f['push'](_0x74b6f['shift']());}};_0x513e89(++_0x1c1ddd);}(_0xe859,0x113));var _0x9e85=function(_0x36db37,_0x43677b){_0x36db37=_0x36db37-0x0;var _0x330ad1=_0xe859[_0x36db37];return _0x330ad1;};'use strict';var utils=require(_0x9e85('0x0'));function History(_0x2fd4d5){this[_0x9e85('0x1')]=_0x2fd4d5[_0x9e85('0x1')];this[_0x9e85('0x2')]=_0x2fd4d5['scheduledat']||undefined;this['type']=_0x2fd4d5[_0x9e85('0x3')];this[_0x9e85('0x4')]=_0x2fd4d5[_0x9e85('0x3')]==='outbound'?_0x9e85('0x5'):_0x2fd4d5[_0x9e85('0x3')];this[_0x9e85('0x6')]=_0x2fd4d5[_0x9e85('0x6')];this[_0x9e85('0x7')]=_0x2fd4d5[_0x9e85('0x7')];this[_0x9e85('0x8')]=_0x2fd4d5['countnoanswerretry'];this[_0x9e85('0x9')]=_0x2fd4d5['countbusyretry']+_0x2fd4d5[_0x9e85('0x7')]+_0x2fd4d5[_0x9e85('0x8')]+_0x2fd4d5[_0x9e85('0xa')]+_0x2fd4d5['countdropretry']+_0x2fd4d5[_0x9e85('0xb')]+_0x2fd4d5['countmachineretry']+_0x2fd4d5[_0x9e85('0xc')];this[_0x9e85('0xa')]=_0x2fd4d5['countnosuchnumberretry'];this[_0x9e85('0xd')]=_0x2fd4d5[_0x9e85('0xd')];this[_0x9e85('0xb')]=_0x2fd4d5[_0x9e85('0xb')];this['countmachineretry']=_0x2fd4d5[_0x9e85('0xe')];this['countagentrejectretry']=_0x2fd4d5[_0x9e85('0xc')];this[_0x9e85('0x5')]=_0x2fd4d5[_0x9e85('0x5')];this['calleridname']=_0x2fd4d5['name'];this['calleridnum']=_0x2fd4d5['number'];this['starttime']=_0x2fd4d5[_0x9e85('0xf')];this['responsetime']=_0x2fd4d5[_0x9e85('0x10')];this[_0x9e85('0x11')]=_0x2fd4d5['responsetime'];this['ringtime']=utils[_0x9e85('0x12')](_0x2fd4d5['responsetime'],_0x2fd4d5[_0x9e85('0xf')]);this['holdtime']=0x0;this['talktime']=0x0;this[_0x9e85('0x13')]=_0x2fd4d5[_0x9e85('0x13')];this['callbackuniqueid']=_0x2fd4d5[_0x9e85('0x14')];this[_0x9e85('0x15')]=_0x2fd4d5[_0x9e85('0x15')];this['recallme']=_0x2fd4d5[_0x9e85('0x16')];this[_0x9e85('0x17')]=_0x2fd4d5['ContactId'];this['ListId']=_0x2fd4d5[_0x9e85('0x18')];this[_0x9e85('0x19')]=_0x2fd4d5[_0x9e85('0x19')];this[_0x9e85('0x1a')]=_0x2fd4d5[_0x9e85('0x1a')];this['CampaignId']=_0x2fd4d5[_0x9e85('0x1b')];this['originatecalleridnum']=_0x2fd4d5[_0x9e85('0x1c')]||'';this[_0x9e85('0x1d')]=_0x2fd4d5['originatecalleridname']||'';this[_0x9e85('0x1e')]=_0x2fd4d5['state'];this['statedesc']=_0x2fd4d5[_0x9e85('0x1f')];}module[_0x9e85('0x20')]=History; \ No newline at end of file +var _0x110c=['countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','calleridname','number','starttime','responsetime','endtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x110c,0x162));var _0xc110=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x110c[_0x321bb2];return _0x9c12ed;};'use strict';var utils=require(_0xc110('0x0'));function History(_0x415b77){this['uniqueid']=_0x415b77['uniqueid'];this[_0xc110('0x1')]=_0x415b77[_0xc110('0x1')]||undefined;this[_0xc110('0x2')]=_0x415b77[_0xc110('0x2')];this[_0xc110('0x3')]=_0x415b77['type']===_0xc110('0x4')?_0xc110('0x5'):_0x415b77['type'];this[_0xc110('0x6')]=_0x415b77[_0xc110('0x6')];this['countcongestionretry']=_0x415b77[_0xc110('0x7')];this[_0xc110('0x8')]=_0x415b77[_0xc110('0x8')];this[_0xc110('0x9')]=_0x415b77[_0xc110('0x6')]+_0x415b77[_0xc110('0x7')]+_0x415b77['countnoanswerretry']+_0x415b77['countnosuchnumberretry']+_0x415b77[_0xc110('0xa')]+_0x415b77[_0xc110('0xb')]+_0x415b77[_0xc110('0xc')]+_0x415b77['countagentrejectretry'];this[_0xc110('0xd')]=_0x415b77[_0xc110('0xd')];this['countdropretry']=_0x415b77[_0xc110('0xa')];this[_0xc110('0xb')]=_0x415b77[_0xc110('0xb')];this[_0xc110('0xc')]=_0x415b77[_0xc110('0xc')];this[_0xc110('0xe')]=_0x415b77['countagentrejectretry'];this[_0xc110('0x5')]=_0x415b77[_0xc110('0x5')];this[_0xc110('0xf')]=_0x415b77['name'];this['calleridnum']=_0x415b77[_0xc110('0x10')];this[_0xc110('0x11')]=_0x415b77['starttime'];this[_0xc110('0x12')]=_0x415b77[_0xc110('0x12')];this[_0xc110('0x13')]=_0x415b77[_0xc110('0x12')];this['ringtime']=utils['getSeconds'](_0x415b77[_0xc110('0x12')],_0x415b77[_0xc110('0x11')]);this['holdtime']=0x0;this[_0xc110('0x14')]=0x0;this[_0xc110('0x15')]=_0x415b77[_0xc110('0x15')];this[_0xc110('0x16')]=_0x415b77['callbackuniqueid'];this[_0xc110('0x17')]=_0x415b77['callbackat'];this[_0xc110('0x18')]=_0x415b77[_0xc110('0x18')];this['ContactId']=_0x415b77[_0xc110('0x19')];this['ListId']=_0x415b77['ListId'];this[_0xc110('0x1a')]=_0x415b77[_0xc110('0x1a')];this[_0xc110('0x1b')]=_0x415b77['VoiceQueueId'];this[_0xc110('0x1c')]=_0x415b77[_0xc110('0x1c')];this[_0xc110('0x1d')]=_0x415b77[_0xc110('0x1d')]||'';this[_0xc110('0x1e')]=_0x415b77[_0xc110('0x1e')]||'';this[_0xc110('0x1f')]=_0x415b77[_0xc110('0x1f')];this[_0xc110('0x20')]=_0x415b77[_0xc110('0x20')];}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 0d035ed..e83cdac 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 _0x0990=['state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat'];(function(_0x5485aa,_0x13b24f){var _0x12a624=function(_0x205c90){while(--_0x205c90){_0x5485aa['push'](_0x5485aa['shift']());}};_0x12a624(++_0x13b24f);}(_0x0990,0x1c5));var _0x0099=function(_0x3902c1,_0x1c9eb2){_0x3902c1=_0x3902c1-0x0;var _0x1266cc=_0x0990[_0x3902c1];return _0x1266cc;};'use strict';var utils=require(_0x0099('0x0'));function QueueCallerAbandon(_0x217663,_0x1f4d9a){this[_0x0099('0x1')]=_0x217663[_0x0099('0x1')];this[_0x0099('0x2')]=_0x217663[_0x0099('0x2')];this[_0x0099('0x3')]=_0x217663['type']===_0x0099('0x4')?_0x0099('0x5'):_0x217663[_0x0099('0x2')];this['countbusyretry']=_0x217663[_0x0099('0x6')];this[_0x0099('0x7')]=_0x217663[_0x0099('0x7')];this[_0x0099('0x8')]=_0x217663[_0x0099('0x8')];this[_0x0099('0x9')]=_0x217663[_0x0099('0x6')]+_0x217663[_0x0099('0x7')]+_0x217663[_0x0099('0x8')]+_0x217663['countnosuchnumberretry']+_0x217663[_0x0099('0xa')]+_0x217663[_0x0099('0xb')]+_0x217663[_0x0099('0xc')]+_0x217663['countagentrejectretry'];this[_0x0099('0xd')]=_0x217663[_0x0099('0xd')];this[_0x0099('0xa')]=_0x217663[_0x0099('0xa')];this[_0x0099('0xb')]=_0x217663[_0x0099('0xb')];this['countmachineretry']=_0x217663[_0x0099('0xc')];this[_0x0099('0xe')]=_0x217663[_0x0099('0xe')];this[_0x0099('0xf')]=_0x1f4d9a[_0x0099('0xf')];this[_0x0099('0x10')]=_0x217663[_0x0099('0x11')];this[_0x0099('0x12')]=_0x217663['number'];this[_0x0099('0x13')]=_0x217663[_0x0099('0x13')];this['responsetime']=_0x217663[_0x0099('0x14')];this[_0x0099('0x15')]=_0x217663['droptime'];this[_0x0099('0x16')]=_0x217663[_0x0099('0x16')];this[_0x0099('0x17')]=this[_0x0099('0x15')];this[_0x0099('0x18')]=utils[_0x0099('0x19')](_0x217663[_0x0099('0x14')],_0x217663['starttime']);this[_0x0099('0x1a')]=utils[_0x0099('0x19')](this[_0x0099('0x15')],_0x217663[_0x0099('0x14')]);this['talktime']=0x0;this['queue']=_0x1f4d9a[_0x0099('0x5')];this[_0x0099('0x1b')]=_0x1f4d9a[_0x0099('0x1c')];this[_0x0099('0x1d')]=_0x1f4d9a[_0x0099('0x1d')];this['callback']=_0x217663[_0x0099('0x1e')];this[_0x0099('0x1f')]=_0x217663[_0x0099('0x1f')];this[_0x0099('0x20')]=_0x217663[_0x0099('0x20')];this['recallme']=_0x217663[_0x0099('0x21')];this['ContactId']=_0x217663[_0x0099('0x22')];this[_0x0099('0x23')]=_0x217663[_0x0099('0x23')];this[_0x0099('0x24')]=_0x217663[_0x0099('0x24')];this[_0x0099('0x25')]=_0x217663[_0x0099('0x25')];this[_0x0099('0x26')]=_0x217663['CampaignId'];this[_0x0099('0x27')]=_0x217663['originatecalleridnum']||'';this[_0x0099('0x28')]=_0x217663[_0x0099('0x28')]||'';this[_0x0099('0x29')]=_0x217663[_0x0099('0x29')];this[_0x0099('0x2a')]=_0x217663[_0x0099('0x2a')];this[_0x0099('0x2b')]=_0x217663['statedesc'];}module[_0x0099('0x2c')]=QueueCallerAbandon; \ No newline at end of file +var _0x0076=['starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime','connectedlinename','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number'];(function(_0x16aad7,_0x425479){var _0x179116=function(_0x511a2c){while(--_0x511a2c){_0x16aad7['push'](_0x16aad7['shift']());}};_0x179116(++_0x425479);}(_0x0076,0x13e));var _0x6007=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x0076[_0x39e283];return _0x7de89f;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x24c4c1,_0x34205d){this['scheduledat']=_0x24c4c1[_0x6007('0x0')];this[_0x6007('0x1')]=_0x24c4c1[_0x6007('0x1')];this[_0x6007('0x2')]=_0x24c4c1[_0x6007('0x1')]===_0x6007('0x3')?_0x6007('0x4'):_0x24c4c1['type'];this[_0x6007('0x5')]=_0x24c4c1[_0x6007('0x5')];this[_0x6007('0x6')]=_0x24c4c1[_0x6007('0x6')];this['countnoanswerretry']=_0x24c4c1['countnoanswerretry'];this[_0x6007('0x7')]=_0x24c4c1[_0x6007('0x5')]+_0x24c4c1[_0x6007('0x6')]+_0x24c4c1[_0x6007('0x8')]+_0x24c4c1[_0x6007('0x9')]+_0x24c4c1[_0x6007('0xa')]+_0x24c4c1[_0x6007('0xb')]+_0x24c4c1[_0x6007('0xc')]+_0x24c4c1[_0x6007('0xd')];this['countnosuchnumberretry']=_0x24c4c1[_0x6007('0x9')];this[_0x6007('0xa')]=_0x24c4c1[_0x6007('0xa')];this[_0x6007('0xb')]=_0x24c4c1[_0x6007('0xb')];this[_0x6007('0xc')]=_0x24c4c1[_0x6007('0xc')];this[_0x6007('0xd')]=_0x24c4c1[_0x6007('0xd')];this[_0x6007('0xe')]=_0x34205d[_0x6007('0xe')];this[_0x6007('0xf')]=_0x24c4c1[_0x6007('0x10')];this['calleridnum']=_0x24c4c1[_0x6007('0x11')];this[_0x6007('0x12')]=_0x24c4c1[_0x6007('0x12')];this[_0x6007('0x13')]=_0x24c4c1[_0x6007('0x13')];this[_0x6007('0x14')]=_0x24c4c1[_0x6007('0x14')];this[_0x6007('0x15')]=_0x24c4c1[_0x6007('0x15')];this[_0x6007('0x16')]=this['droptime'];this[_0x6007('0x17')]=utils[_0x6007('0x18')](_0x24c4c1[_0x6007('0x13')],_0x24c4c1[_0x6007('0x12')]);this[_0x6007('0x19')]=utils[_0x6007('0x18')](this[_0x6007('0x14')],_0x24c4c1['responsetime']);this[_0x6007('0x1a')]=0x0;this['queue']=_0x34205d['queue'];this['membername']=_0x34205d[_0x6007('0x1b')];this[_0x6007('0x1c')]=_0x34205d[_0x6007('0x1c')];this['callback']=_0x24c4c1['callback'];this[_0x6007('0x1d')]=_0x24c4c1['callbackuniqueid'];this[_0x6007('0x1e')]=_0x24c4c1[_0x6007('0x1e')];this[_0x6007('0x1f')]=_0x24c4c1[_0x6007('0x1f')];this[_0x6007('0x20')]=_0x24c4c1[_0x6007('0x20')];this[_0x6007('0x21')]=_0x24c4c1[_0x6007('0x21')];this[_0x6007('0x22')]=_0x24c4c1[_0x6007('0x22')];this[_0x6007('0x23')]=_0x24c4c1[_0x6007('0x23')];this['CampaignId']=_0x24c4c1[_0x6007('0x24')];this[_0x6007('0x25')]=_0x24c4c1[_0x6007('0x25')]||'';this[_0x6007('0x26')]=_0x24c4c1[_0x6007('0x26')]||'';this[_0x6007('0x27')]=_0x24c4c1[_0x6007('0x27')];this['state']=_0x24c4c1[_0x6007('0x28')];this[_0x6007('0x29')]=_0x24c4c1[_0x6007('0x29')];}module['exports']=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 f4fd021..8b5a123 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 _0x4819=['[unlockContact]','[moveContactManagedDialer]','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','[swapAdditionalPhone]','avgHandleTime','createHistory','[createHistory]','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','temp','error','[getContactDialer]','dialOrderByScheduledAt','[getContactDialerIvr]','getContactDialerIvr','countReScheduled','catch','rescheduleContact','[rescheduleContact]','unlockContact'];(function(_0xf0bc07,_0x510ebf){var _0x1c50c2=function(_0x2e2bdf){while(--_0x2e2bdf){_0xf0bc07['push'](_0xf0bc07['shift']());}};_0x1c50c2(++_0x510ebf);}(_0x4819,0xcd));var _0x9481=function(_0xe3a46,_0x4f9273){_0xe3a46=_0xe3a46-0x0;var _0x5bb333=_0x4819[_0xe3a46];return _0x5bb333;};'use strict';var util=require('util');var logger=require(_0x9481('0x0'))(_0x9481('0x1'));var cmHopper=require(_0x9481('0x2'));var cmHopperAdditionalPhone=require(_0x9481('0x3'));var cmHopperBlack=require(_0x9481('0x4'));var cmHopperHistory=require(_0x9481('0x5'));function inspectError(_0x40a703){return util[_0x9481('0x6')](_0x40a703,{'showHidden':![],'depth':null});}function getContactDialer(_0xc39edf,_0x16c617,_0x5ac51c){return cmHopper[_0x9481('0x7')](_0xc39edf['id'],_0x16c617,_0x5ac51c,_0xc39edf['dialOrderByScheduledAt'])['catch'](function(_0x14e05a){_0xc39edf[_0x9481('0x8')]=0x0;logger[_0x9481('0x9')](_0x9481('0xa'),inspectError(_0x14e05a));});}exports[_0x9481('0x7')]=getContactDialer;function getContactDialerIvr(_0x4c7d9c,_0x1818cf){return cmHopper['getContactDialerIvr'](_0x4c7d9c['id'],_0x1818cf,_0x4c7d9c[_0x9481('0xb')])['catch'](function(_0x411d24){_0x4c7d9c[_0x9481('0x8')]=0x0;logger[_0x9481('0x9')](_0x9481('0xc'),inspectError(_0x411d24));});}exports[_0x9481('0xd')]=getContactDialerIvr;function countReScheduled(_0x29515a){return cmHopper[_0x9481('0xe')](_0x29515a)[_0x9481('0xf')](function(_0xed8e9){logger['error']('[countReScheduled]',inspectError(_0xed8e9));});}exports[_0x9481('0xe')]=countReScheduled;function rescheduleContact(_0x150276){return cmHopper[_0x9481('0x10')](_0x150276)[_0x9481('0xf')](function(_0x3d23c2){logger[_0x9481('0x9')](_0x9481('0x11'),inspectError(_0x3d23c2));});}exports['rescheduleContact']=rescheduleContact;function unlockContact(_0x4220f1,_0x7a7ee,_0x5b1fe6){return cmHopper[_0x9481('0x12')](_0x4220f1,_0x7a7ee,_0x5b1fe6)['catch'](function(_0x34108d){logger[_0x9481('0x9')](_0x9481('0x13'),inspectError(_0x34108d));});}exports[_0x9481('0x12')]=unlockContact;function moveContactManagedDialer(_0x546fce){return cmHopper['moveContactManagedDialer'](_0x546fce)[_0x9481('0xf')](function(_0x50a559){logger['error'](_0x9481('0x14'),inspectError(_0x50a559));});}exports[_0x9481('0x15')]=moveContactManagedDialer;function checkIsBlackList(_0x18c6f5){return cmHopperBlack[_0x9481('0x16')](_0x18c6f5)[_0x9481('0xf')](function(_0x3dc33f){logger['error'](_0x9481('0x17'),inspectError(_0x3dc33f));});}exports[_0x9481('0x16')]=checkIsBlackList;function checkIsBlackListIvr(_0x45f9df){return cmHopperBlack[_0x9481('0x18')](_0x45f9df)[_0x9481('0xf')](function(_0x56da97){logger[_0x9481('0x9')](_0x9481('0x19'),inspectError(_0x56da97));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x2bcf37,_0xd1cd1a,_0x352b3a){return cmHopperAdditionalPhone[_0x9481('0x1a')](_0x2bcf37,_0xd1cd1a,_0x352b3a)[_0x9481('0xf')](function(_0x49ecfa){logger[_0x9481('0x9')](_0x9481('0x1b'),inspectError(_0x49ecfa));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x5eb4f5,_0x12b0c3,_0x299e28){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x5eb4f5,_0x12b0c3,_0x299e28)[_0x9481('0xf')](function(_0x20ff9a){logger[_0x9481('0x9')](_0x9481('0x1c'),inspectError(_0x20ff9a));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x14f03e){return cmHopperHistory[_0x9481('0x1d')](_0x14f03e)[_0x9481('0xf')](function(_0x587706){logger[_0x9481('0x9')]('[avgHandleTime]',inspectError(_0x587706));});}exports[_0x9481('0x1d')]=avgHandleTime;function createHistory(_0xe153ab){return cmHopperHistory[_0x9481('0x1e')](_0xe153ab)[_0x9481('0xf')](function(_0x2e5e63){logger['error'](_0x9481('0x1f'),inspectError(_0x2e5e63));});}exports[_0x9481('0x1e')]=createHistory; \ No newline at end of file +var _0x7b84=['swapAdditionalPhones','[avgHandleTime]','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','temp','error','[getContactDialer]','getContactDialerIvr','catch','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','[unlockContact]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','[verifyAdditionalPhone]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7b84,0x17c));var _0x47b8=function(_0x145c9c,_0x193104){_0x145c9c=_0x145c9c-0x0;var _0x71f76=_0x7b84[_0x145c9c];return _0x71f76;};'use strict';var util=require(_0x47b8('0x0'));var logger=require(_0x47b8('0x1'))(_0x47b8('0x2'));var cmHopper=require(_0x47b8('0x3'));var cmHopperAdditionalPhone=require(_0x47b8('0x4'));var cmHopperBlack=require(_0x47b8('0x5'));var cmHopperHistory=require(_0x47b8('0x6'));function inspectError(_0x5c7cda){return util[_0x47b8('0x7')](_0x5c7cda,{'showHidden':![],'depth':null});}function getContactDialer(_0x1fa41a,_0x2279ea,_0x7013d7){return cmHopper[_0x47b8('0x8')](_0x1fa41a['id'],_0x2279ea,_0x7013d7,_0x1fa41a[_0x47b8('0x9')])['catch'](function(_0x3867ca){_0x1fa41a[_0x47b8('0xa')]=0x0;logger[_0x47b8('0xb')](_0x47b8('0xc'),inspectError(_0x3867ca));});}exports[_0x47b8('0x8')]=getContactDialer;function getContactDialerIvr(_0x1af17f,_0x24d240){return cmHopper[_0x47b8('0xd')](_0x1af17f['id'],_0x24d240,_0x1af17f[_0x47b8('0x9')])[_0x47b8('0xe')](function(_0x289f98){_0x1af17f[_0x47b8('0xa')]=0x0;logger[_0x47b8('0xb')](_0x47b8('0xf'),inspectError(_0x289f98));});}exports[_0x47b8('0xd')]=getContactDialerIvr;function countReScheduled(_0x2a1af3){return cmHopper[_0x47b8('0x10')](_0x2a1af3)[_0x47b8('0xe')](function(_0x25a224){logger[_0x47b8('0xb')](_0x47b8('0x11'),inspectError(_0x25a224));});}exports[_0x47b8('0x10')]=countReScheduled;function rescheduleContact(_0x2d1aaf){return cmHopper[_0x47b8('0x12')](_0x2d1aaf)[_0x47b8('0xe')](function(_0x223121){logger[_0x47b8('0xb')]('[rescheduleContact]',inspectError(_0x223121));});}exports[_0x47b8('0x12')]=rescheduleContact;function unlockContact(_0x340da0,_0x3e760a,_0x1217a4){return cmHopper[_0x47b8('0x13')](_0x340da0,_0x3e760a,_0x1217a4)[_0x47b8('0xe')](function(_0x4765ad){logger['error'](_0x47b8('0x14'),inspectError(_0x4765ad));});}exports['unlockContact']=unlockContact;function moveContactManagedDialer(_0x525fd6){return cmHopper['moveContactManagedDialer'](_0x525fd6)[_0x47b8('0xe')](function(_0x36faf1){logger[_0x47b8('0xb')]('[moveContactManagedDialer]',inspectError(_0x36faf1));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x4f6716){return cmHopperBlack[_0x47b8('0x15')](_0x4f6716)['catch'](function(_0x2a4fa7){logger[_0x47b8('0xb')](_0x47b8('0x16'),inspectError(_0x2a4fa7));});}exports[_0x47b8('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x4eba33){return cmHopperBlack[_0x47b8('0x17')](_0x4eba33)[_0x47b8('0xe')](function(_0x2840c3){logger[_0x47b8('0xb')](_0x47b8('0x18'),inspectError(_0x2840c3));});}exports[_0x47b8('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x54f6bc,_0x31555d,_0x2a22e3){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x54f6bc,_0x31555d,_0x2a22e3)[_0x47b8('0xe')](function(_0x247429){logger[_0x47b8('0xb')](_0x47b8('0x19'),inspectError(_0x247429));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x35b327,_0x332c23,_0x319d17){return cmHopperAdditionalPhone[_0x47b8('0x1a')](_0x35b327,_0x332c23,_0x319d17)[_0x47b8('0xe')](function(_0xbf5ce9){logger[_0x47b8('0xb')]('[swapAdditionalPhone]',inspectError(_0xbf5ce9));});}exports[_0x47b8('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x1f719a){return cmHopperHistory['avgHandleTime'](_0x1f719a)[_0x47b8('0xe')](function(_0x6d517a){logger[_0x47b8('0xb')](_0x47b8('0x1b'),inspectError(_0x6d517a));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x162d96){return cmHopperHistory['createHistory'](_0x162d96)[_0x47b8('0xe')](function(_0x2255ab){logger[_0x47b8('0xb')](_0x47b8('0x1c'),inspectError(_0x2255ab));});}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 ee82b2c..b32dec4 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 _0x03d6=['unmonitored','includes','status','TrunkBackup','ACTIVE','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','getQueueCampaignStatusMessage','match','extractCalleridName','string','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','\x5cw{0,','pow','random','toString','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','tags','updatedAt','undefined','description','XMD-','toUpperCase','substring','setXMDContactVariables','lodash','moment','util','../../../../config/logger','dialer','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','type','ivr','isIVRCampaign','outbound','isOutboundQueue','isQueueCampaignActive','active','milliseconds','diff','seconds','getSeconds','dialActive','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','dialTimezone','isNil','dialGlobalInterval','Interval','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','SIP/','reachable'];(function(_0x431b0e,_0x9450f1){var _0x3a87cf=function(_0x4bf45e){while(--_0x4bf45e){_0x431b0e['push'](_0x431b0e['shift']());}};_0x3a87cf(++_0x9450f1);}(_0x03d6,0x184));var _0x603d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x03d6[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x603d('0x0'));var moment=require(_0x603d('0x1'));var util=require(_0x603d('0x2'));var logger=require(_0x603d('0x3'))(_0x603d('0x4'));var timezones=require('../../../../config/environment/shared')['timezones'];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0x603d('0x5'),'DEACTIVATED':_0x603d('0x6'),'DISACTIVED':_0x603d('0x7'),'EMPTY_INTERVAL':_0x603d('0x8'),'INACTIVE':_0x603d('0x9'),'NO_AGENTS_LOGGED':_0x603d('0xa'),'NO_AVAILABLE_CONTACTS':_0x603d('0xb'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x603d('0xc'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0x603d('0xd'),'RUNNING':_0x603d('0xe'),'UNKNOWN_TIMEZONE':_0x603d('0xf'),'UNREACHABLE_TRUNK':_0x603d('0x10')};exports[_0x603d('0x11')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0xe3be24){return _0xe3be24[_0x603d('0x12')]==='preview';}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x4add0d){return _0x4add0d[_0x603d('0x13')]===_0x603d('0x14');}exports[_0x603d('0x15')]=isIVRCampaign;function isOutboundQueue(_0x570dd6){return _0x570dd6[_0x603d('0x13')]===_0x603d('0x16');}exports[_0x603d('0x17')]=isOutboundQueue;function isQueueCampaignActive(_0x2793b6){return _0x2793b6['dialActive'];}exports[_0x603d('0x18')]=isQueueCampaignActive;function isIVRCampaignActive(_0x3b0ca7){return _0x3b0ca7[_0x603d('0x19')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x3e863f,_0x520af2){var _0x4305b0=moment(_0x3e863f)[_0x603d('0x1a')](0x0);var _0x19e824=moment(_0x520af2)[_0x603d('0x1a')](0x0);return _0x4305b0[_0x603d('0x1b')](_0x19e824,_0x603d('0x1c'));}exports[_0x603d('0x1d')]=getSeconds;function hasQueueCampaignDataChanged(_0x189e3a,_0x4d7d43){var _0x208d8d=![];var _0x23406d=_0x189e3a[_0x603d('0x12')]!==_0x4d7d43['dialMethod']||_0x189e3a[_0x603d('0x1e')]!==_0x4d7d43[_0x603d('0x1e')]||_0x189e3a[_0x603d('0x1f')]!==_0x4d7d43[_0x603d('0x1f')];var _0x2adc20=_0x189e3a['available']!==_0x4d7d43[_0x603d('0x20')]||_0x189e3a['loggedIn']!==_0x4d7d43[_0x603d('0x21')]||_0x189e3a['loggedInDb']!==_0x4d7d43[_0x603d('0x22')]||_0x189e3a[_0x603d('0x23')]!==_0x4d7d43[_0x603d('0x23')]||_0x189e3a[_0x603d('0x24')]!==_0x4d7d43[_0x603d('0x24')]||_0x189e3a[_0x603d('0x25')]!==_0x4d7d43[_0x603d('0x25')]||_0x189e3a['waiting']!==_0x4d7d43[_0x603d('0x26')]||_0x189e3a[_0x603d('0x27')]!==_0x4d7d43[_0x603d('0x27')]||_0x189e3a[_0x603d('0x28')]!==_0x4d7d43[_0x603d('0x28')];if(_0x189e3a[_0x603d('0x29')]&&_0x4d7d43[_0x603d('0x29')]){_0x208d8d=_0x189e3a['Trunk'][_0x603d('0x2a')]!==_0x4d7d43[_0x603d('0x29')]['name']||_0x189e3a[_0x603d('0x29')][_0x603d('0x19')]!==_0x4d7d43[_0x603d('0x29')][_0x603d('0x19')];}return _0x23406d||_0x2adc20||_0x208d8d;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x115763){var _0x2e1f66=null;var _0x9aa48b=_0x115763[_0x603d('0x2b')];if(_[_0x603d('0x2c')](_0x115763[_0x603d('0x2d')])||_[_0x603d('0x2c')](_0x115763[_0x603d('0x2e')])||_[_0x603d('0x2c')](_0x115763[_0x603d('0x2e')]['Intervals'])){_0x2e1f66=CAMPAIGN_STATUS[_0x603d('0x2f')];}else if(_[_0x603d('0x30')](_0x115763[_0x603d('0x2d')])||_[_0x603d('0x30')](_0x115763[_0x603d('0x2e')]['Intervals'])){_0x2e1f66=CAMPAIGN_STATUS[_0x603d('0x31')];}else if(_0x9aa48b&&!timezones[_0x9aa48b]){_0x2e1f66=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x2e1f66;}function checkAnyValidTrunk(_0x3d6178,_0x5703cb){var _0x8e2a18=null;var _0x1e815f=_0x603d('0x32');var _0x36dc2b=[_0x603d('0x33'),_0x603d('0x34')];var _0xba24fe=!![];if(_0x3d6178['Trunk']&&_0x3d6178[_0x603d('0x29')][_0x603d('0x19')]){_0x1e815f+=_0x3d6178[_0x603d('0x29')]['name'];_0x8e2a18=_0x5703cb[_0x1e815f];_0xba24fe=_0x36dc2b[_0x603d('0x35')](_0x8e2a18[_0x603d('0x36')]);}else if(_0x3d6178[_0x603d('0x37')]&&_0x3d6178['TrunkBackup'][_0x603d('0x19')]){_0x1e815f+=_0x3d6178[_0x603d('0x37')][_0x603d('0x2a')];_0x8e2a18=_0x5703cb[_0x1e815f];_0xba24fe=_0x36dc2b[_0x603d('0x35')](_0x8e2a18['status']);}return _0xba24fe;}function getQueueCampaignStatusMessage(_0x37a516,_0x257e72){var _0x54c66b=CAMPAIGN_STATUS[_0x603d('0x38')];var _0x11a44f=isPreviewCampaign(_0x37a516);if(!isQueueCampaignActive(_0x37a516)){if(_0x11a44f){_0x54c66b=CAMPAIGN_STATUS[_0x603d('0x39')];}else{if(_0x37a516['originated']===0x0&&_0x37a516[_0x603d('0x24')]===0x0&&_0x37a516[_0x603d('0x26')]===0x0&&(_0x37a516[_0x603d('0x25')]||0x0)===0x0){_0x54c66b=CAMPAIGN_STATUS[_0x603d('0x39')];}else{_0x54c66b=CAMPAIGN_STATUS[_0x603d('0x3a')];}}}else if(_0x37a516[_0x603d('0x21')]===0x0){_0x54c66b=CAMPAIGN_STATUS[_0x603d('0x3b')];}else if(!checkAnyValidTrunk(_0x37a516,_0x257e72)){_0x54c66b=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x37a516)){var _0x5515e4=checkAnyValidQueueCampaignInterval(_0x37a516);if(_0x5515e4){_0x54c66b=_0x5515e4;}}return _0x54c66b;}exports[_0x603d('0x3c')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x25ecab){var _0x54c1a9=CAMPAIGN_STATUS[_0x603d('0x3a')];if(_0x25ecab[_0x603d('0x28')]===0x0&&_0x25ecab['talking']===0x0&&_0x25ecab['waiting']===0x0&&(_0x25ecab[_0x603d('0x25')]||0x0)===0x0){_0x54c1a9=CAMPAIGN_STATUS['INACTIVE'];}return _0x54c1a9;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x51e6e2){var _0x5d1bf3=_0x51e6e2[_0x603d('0x3d')](/"(.*?)"/);return _0x5d1bf3?_0x5d1bf3[0x1]:_0x51e6e2;}exports[_0x603d('0x3e')]=extractCalleridName;function getCallerId(_0x33c76f,_0x40c1c3,_0x21efde){if(!_['isUndefined'](_0x21efde)&&typeof _0x21efde===_0x603d('0x3f')&&!_['isEmpty'](_0x21efde)){if(!_[_0x603d('0x40')](_0x40c1c3)&&typeof _0x40c1c3===_0x603d('0x3f')&&!_[_0x603d('0x30')](_0x40c1c3)){return util[_0x603d('0x41')](_0x603d('0x42'),_0x40c1c3,_0x21efde);}return util['format'](_0x603d('0x42'),_0x21efde,_0x21efde);}if(!_[_0x603d('0x40')](_0x33c76f)&&typeof _0x33c76f==='string'&&!_[_0x603d('0x30')](_0x33c76f)){return _0x33c76f;}return _0x603d('0x43');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x4dbc,_0x149823){var _0x3cd07e;var _0x1de497;var _0x21c9ef;if(_0x149823<=0x0){_0x149823=0x1;}_0x3cd07e=new RegExp(_0x603d('0x44')+_0x149823+'}$');_0x1de497=Math[_0x603d('0x45')](0xa,_0x149823-0x1);_0x21c9ef=Math[_0x603d('0x45')](0xa,_0x149823)-0x1;return util[_0x603d('0x41')]('%s',_['replace'](_0x4dbc,_0x3cd07e,_[_0x603d('0x46')](_0x1de497,_0x21c9ef)[_0x603d('0x47')]()));}exports[_0x603d('0x48')]=getCallerIdRandom;function decrementOriginate(_0x4a667b){if(_0x4a667b['originated']&&_0x4a667b['originated']>0x0){_0x4a667b[_0x603d('0x28')]-=0x1;}else{logger['error'](_0x603d('0x49'));}}exports[_0x603d('0x4a')]=decrementOriginate;function checkContactEmpty(_0x3e9665){return _0x3e9665&&_0x3e9665[_0x603d('0x4b')]>0x0;}exports[_0x603d('0x4c')]=checkContactEmpty;function erlangb(_0x5d0fe0,_0x290d27){if(_0x290d27===0x0){return 0x0;}var _0x55f9db=0x1;for(var _0x2d82a1=0x1;_0x2d82a1<=_0x290d27;_0x2d82a1+=0x1){_0x55f9db=0x1+_0x55f9db*_0x2d82a1/_0x5d0fe0;}return 0x1/_0x55f9db;}exports[_0x603d('0x4d')]=erlangb;function checkContactLowerLimitOriginate(_0x4b1f89,_0x5d4469,_0x255296){if(_0x5d4469>_0x255296){for(var _0x406d6d=0x0;_0x406d6d<_0x5d4469-_0x255296;_0x406d6d+=0x1){decrementOriginate(_0x4b1f89);}}}exports[_0x603d('0x4e')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x3f7ea1){var _0x3e2def={};var _0x1d8271=['id',_0x603d('0x4f'),_0x603d('0x50'),_0x603d('0x51')];const _0x152e6c=0xfa;if(_0x3f7ea1){for(var _0x1df4c3 in _0x3f7ea1){if(typeof _0x3f7ea1[_0x1df4c3]!==_0x603d('0x52')){if(!_[_0x603d('0x2c')](_0x3f7ea1[_0x1df4c3])&&!_0x1d8271[_0x603d('0x35')](_0x1df4c3)){if(_0x1df4c3===_0x603d('0x53')&&_0x3f7ea1[_0x1df4c3]['length']>_0x152e6c){_0x3e2def[_0x603d('0x54')+_0x1df4c3[_0x603d('0x55')]()]=_0x3f7ea1[_0x1df4c3][_0x603d('0x47')]()[_0x603d('0x56')](0x0,_0x152e6c);}else{_0x3e2def[_0x603d('0x54')+_0x1df4c3[_0x603d('0x55')]()]=_0x3f7ea1[_0x1df4c3];}}}}}return _0x3e2def;}exports[_0x603d('0x57')]=setXMDContactVariables; \ No newline at end of file +var _0x484c=['UNKNOWN_TIMEZONE','SIP/','unmonitored','TrunkBackup','status','ACTIVE','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','erlangb','checkContactLowerLimitOriginate','createdAt','updatedAt','includes','description','XMD-','toUpperCase','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RUNNING','CAMPAIGN_STATUS','preview','isPreviewCampaign','isIVRCampaign','type','outbound','isOutboundQueue','dialActive','active','milliseconds','dialMethod','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','dialTimezone','dialGlobalInterval','isNil','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL'];(function(_0x3f2095,_0xa07211){var _0x41eb9b=function(_0x4087ce){while(--_0x4087ce){_0x3f2095['push'](_0x3f2095['shift']());}};_0x41eb9b(++_0xa07211);}(_0x484c,0x77));var _0xc484=function(_0x327d35,_0x4b1e4c){_0x327d35=_0x327d35-0x0;var _0xc95dfb=_0x484c[_0x327d35];return _0xc95dfb;};'use strict';var _=require(_0xc484('0x0'));var moment=require(_0xc484('0x1'));var util=require(_0xc484('0x2'));var logger=require(_0xc484('0x3'))(_0xc484('0x4'));var timezones=require(_0xc484('0x5'))[_0xc484('0x6')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0xc484('0x7'),'CONTACTS_RESCHEDULED':_0xc484('0x8'),'DEACTIVATED':_0xc484('0x9'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0xc484('0xa'),'NO_AGENTS_LOGGED':_0xc484('0xb'),'NO_AVAILABLE_CONTACTS':_0xc484('0xc'),'NULL_INTERVAL':_0xc484('0xd'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0xc484('0xe'),'QUEUE_RECALL':_0xc484('0xf'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0xc484('0x10'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0xc484('0x11')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x5589be){return _0x5589be['dialMethod']===_0xc484('0x12');}exports[_0xc484('0x13')]=isPreviewCampaign;function isIVRCampaign(_0x57891){return _0x57891['type']==='ivr';}exports[_0xc484('0x14')]=isIVRCampaign;function isOutboundQueue(_0x4ed505){return _0x4ed505[_0xc484('0x15')]===_0xc484('0x16');}exports[_0xc484('0x17')]=isOutboundQueue;function isQueueCampaignActive(_0x520a3d){return _0x520a3d[_0xc484('0x18')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x3d7044){return _0x3d7044[_0xc484('0x19')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x52e9ee,_0x80a5f0){var _0x4ce49a=moment(_0x52e9ee)[_0xc484('0x1a')](0x0);var _0x59d49b=moment(_0x80a5f0)[_0xc484('0x1a')](0x0);return _0x4ce49a['diff'](_0x59d49b,'seconds');}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x387fc9,_0x556964){var _0x240113=![];var _0x267094=_0x387fc9[_0xc484('0x1b')]!==_0x556964[_0xc484('0x1b')]||_0x387fc9[_0xc484('0x18')]!==_0x556964[_0xc484('0x18')]||_0x387fc9['message']!==_0x556964['message'];var _0x4663b6=_0x387fc9[_0xc484('0x1c')]!==_0x556964[_0xc484('0x1c')]||_0x387fc9[_0xc484('0x1d')]!==_0x556964[_0xc484('0x1d')]||_0x387fc9[_0xc484('0x1e')]!==_0x556964[_0xc484('0x1e')]||_0x387fc9[_0xc484('0x1f')]!==_0x556964[_0xc484('0x1f')]||_0x387fc9[_0xc484('0x20')]!==_0x556964[_0xc484('0x20')]||_0x387fc9[_0xc484('0x21')]!==_0x556964[_0xc484('0x21')]||_0x387fc9[_0xc484('0x22')]!==_0x556964['waiting']||_0x387fc9['inUse']!==_0x556964[_0xc484('0x23')]||_0x387fc9['originated']!==_0x556964[_0xc484('0x24')];if(_0x387fc9[_0xc484('0x25')]&&_0x556964['Trunk']){_0x240113=_0x387fc9[_0xc484('0x25')][_0xc484('0x26')]!==_0x556964[_0xc484('0x25')][_0xc484('0x26')]||_0x387fc9[_0xc484('0x25')][_0xc484('0x19')]!==_0x556964[_0xc484('0x25')]['active'];}return _0x267094||_0x4663b6||_0x240113;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x9223e2){var _0x5dbb23=null;var _0x18b355=_0x9223e2[_0xc484('0x27')];if(_['isNil'](_0x9223e2[_0xc484('0x28')])||_[_0xc484('0x29')](_0x9223e2[_0xc484('0x2a')])||_['isNil'](_0x9223e2[_0xc484('0x2a')][_0xc484('0x2b')])){_0x5dbb23=CAMPAIGN_STATUS[_0xc484('0x2c')];}else if(_[_0xc484('0x2d')](_0x9223e2['dialGlobalInterval'])||_[_0xc484('0x2d')](_0x9223e2['Interval'][_0xc484('0x2b')])){_0x5dbb23=CAMPAIGN_STATUS[_0xc484('0x2e')];}else if(_0x18b355&&!timezones[_0x18b355]){_0x5dbb23=CAMPAIGN_STATUS[_0xc484('0x2f')];}return _0x5dbb23;}function checkAnyValidTrunk(_0x4950e7,_0x4dca4d){var _0x31acd7=null;var _0x3d4622=_0xc484('0x30');var _0x31c9cc=['reachable',_0xc484('0x31')];var _0x4b2101=!![];if(_0x4950e7['Trunk']&&_0x4950e7['Trunk'][_0xc484('0x19')]){_0x3d4622+=_0x4950e7[_0xc484('0x25')][_0xc484('0x26')];_0x31acd7=_0x4dca4d[_0x3d4622];_0x4b2101=_0x31c9cc['includes'](_0x31acd7['status']);}else if(_0x4950e7[_0xc484('0x32')]&&_0x4950e7[_0xc484('0x32')][_0xc484('0x19')]){_0x3d4622+=_0x4950e7[_0xc484('0x32')]['name'];_0x31acd7=_0x4dca4d[_0x3d4622];_0x4b2101=_0x31c9cc['includes'](_0x31acd7[_0xc484('0x33')]);}return _0x4b2101;}function getQueueCampaignStatusMessage(_0x48abb8,_0x8b4514){var _0x32797e=CAMPAIGN_STATUS[_0xc484('0x34')];var _0x52db41=isPreviewCampaign(_0x48abb8);if(!isQueueCampaignActive(_0x48abb8)){if(_0x52db41){_0x32797e=CAMPAIGN_STATUS[_0xc484('0x35')];}else{if(_0x48abb8[_0xc484('0x24')]===0x0&&_0x48abb8[_0xc484('0x20')]===0x0&&_0x48abb8[_0xc484('0x22')]===0x0&&(_0x48abb8[_0xc484('0x21')]||0x0)===0x0){_0x32797e=CAMPAIGN_STATUS[_0xc484('0x35')];}else{_0x32797e=CAMPAIGN_STATUS[_0xc484('0x36')];}}}else if(_0x48abb8[_0xc484('0x1d')]===0x0){_0x32797e=CAMPAIGN_STATUS[_0xc484('0x37')];}else if(!checkAnyValidTrunk(_0x48abb8,_0x8b4514)){_0x32797e=CAMPAIGN_STATUS[_0xc484('0x38')];}else if(!isPreviewCampaign(_0x48abb8)){var _0x5efc93=checkAnyValidQueueCampaignInterval(_0x48abb8);if(_0x5efc93){_0x32797e=_0x5efc93;}}return _0x32797e;}exports[_0xc484('0x39')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x462ee5){var _0x1591e8=CAMPAIGN_STATUS[_0xc484('0x36')];if(_0x462ee5[_0xc484('0x24')]===0x0&&_0x462ee5['talking']===0x0&&_0x462ee5[_0xc484('0x22')]===0x0&&(_0x462ee5[_0xc484('0x21')]||0x0)===0x0){_0x1591e8=CAMPAIGN_STATUS['INACTIVE'];}return _0x1591e8;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x8dc9df){var _0x2648b2=_0x8dc9df[_0xc484('0x3a')](/"(.*?)"/);return _0x2648b2?_0x2648b2[0x1]:_0x8dc9df;}exports[_0xc484('0x3b')]=extractCalleridName;function getCallerId(_0x334404,_0x2daa04,_0x15f3e9){if(!_[_0xc484('0x3c')](_0x15f3e9)&&typeof _0x15f3e9===_0xc484('0x3d')&&!_[_0xc484('0x2d')](_0x15f3e9)){if(!_['isUndefined'](_0x2daa04)&&typeof _0x2daa04===_0xc484('0x3d')&&!_['isEmpty'](_0x2daa04)){return util[_0xc484('0x3e')](_0xc484('0x3f'),_0x2daa04,_0x15f3e9);}return util[_0xc484('0x3e')](_0xc484('0x3f'),_0x15f3e9,_0x15f3e9);}if(!_[_0xc484('0x3c')](_0x334404)&&typeof _0x334404===_0xc484('0x3d')&&!_[_0xc484('0x2d')](_0x334404)){return _0x334404;}return _0xc484('0x40');}exports[_0xc484('0x41')]=getCallerId;function getCallerIdRandom(_0xbb601,_0x38b375){var _0x552b1a;var _0x52caf0;var _0x42a105;if(_0x38b375<=0x0){_0x38b375=0x1;}_0x552b1a=new RegExp(_0xc484('0x42')+_0x38b375+'}$');_0x52caf0=Math['pow'](0xa,_0x38b375-0x1);_0x42a105=Math[_0xc484('0x43')](0xa,_0x38b375)-0x1;return util[_0xc484('0x3e')]('%s',_[_0xc484('0x44')](_0xbb601,_0x552b1a,_['random'](_0x52caf0,_0x42a105)[_0xc484('0x45')]()));}exports[_0xc484('0x46')]=getCallerIdRandom;function decrementOriginate(_0x2368f7){if(_0x2368f7['originated']&&_0x2368f7['originated']>0x0){_0x2368f7['originated']-=0x1;}else{logger[_0xc484('0x47')](_0xc484('0x48'));}}exports[_0xc484('0x49')]=decrementOriginate;function checkContactEmpty(_0x2feae9){return _0x2feae9&&_0x2feae9[_0xc484('0x4a')]>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x41f53e,_0x136116){if(_0x136116===0x0){return 0x0;}var _0x463cf5=0x1;for(var _0x50e190=0x1;_0x50e190<=_0x136116;_0x50e190+=0x1){_0x463cf5=0x1+_0x463cf5*_0x50e190/_0x41f53e;}return 0x1/_0x463cf5;}exports[_0xc484('0x4b')]=erlangb;function checkContactLowerLimitOriginate(_0x1aa478,_0xbf0c3d,_0x1d1367){if(_0xbf0c3d>_0x1d1367){for(var _0x2c6f86=0x0;_0x2c6f86<_0xbf0c3d-_0x1d1367;_0x2c6f86+=0x1){decrementOriginate(_0x1aa478);}}}exports[_0xc484('0x4c')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x27d1ff){var _0x4c2d6b={};var _0x19039a=['id',_0xc484('0x4d'),'tags',_0xc484('0x4e')];const _0x193d32=0xfa;if(_0x27d1ff){for(var _0x1dc6cd in _0x27d1ff){if(typeof _0x27d1ff[_0x1dc6cd]!=='undefined'){if(!_[_0xc484('0x29')](_0x27d1ff[_0x1dc6cd])&&!_0x19039a[_0xc484('0x4f')](_0x1dc6cd)){if(_0x1dc6cd===_0xc484('0x50')&&_0x27d1ff[_0x1dc6cd][_0xc484('0x4a')]>_0x193d32){_0x4c2d6b[_0xc484('0x51')+_0x1dc6cd[_0xc484('0x52')]()]=_0x27d1ff[_0x1dc6cd][_0xc484('0x45')]()['substring'](0x0,_0x193d32);}else{_0x4c2d6b[_0xc484('0x51')+_0x1dc6cd[_0xc484('0x52')]()]=_0x27d1ff[_0x1dc6cd];}}}}}return _0x4c2d6b;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index be32078..eb9667a 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(_0x242eec,_0x142a6a){var _0x39294d=function(_0x4c5fe9){while(--_0x4c5fe9){_0x242eec['push'](_0x242eec['shift']());}};_0x39294d(++_0x142a6a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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(_0x4e5206,_0x51b55c){var _0x2b0eb4=function(_0x2841e8){while(--_0x2841e8){_0x4e5206['push'](_0x4e5206['shift']());}};_0x2b0eb4(++_0x51b55c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 7714ab5..801ca06 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 _0x0066=['uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','hasOwnProperty','value','channelstate','channelstatedesc','operation','status','localstationid','filename','remotestationid','pagestransferred','resolution','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','catch','\x20notify\x20','stringify','error','merge','pick','response','reason','update','AttachmentId','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','send','[Fax][execOriginate][success]','checkTrunk','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','%s/%s.tif','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','./util/gs','../../../config/logger','fax','../ami','./channel','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','syncVarSet','bind','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','prototype','syncNewchannel','context','from-voip-provider','exten'];(function(_0x5e6118,_0x56dfd3){var _0xaf950f=function(_0x1b1c26){while(--_0x1b1c26){_0x5e6118['push'](_0x5e6118['shift']());}};_0xaf950f(++_0x56dfd3);}(_0x0066,0x195));var _0x6006=function(_0x320aef,_0x4485be){_0x320aef=_0x320aef-0x0;var _0x18c643=_0x0066[_0x320aef];return _0x18c643;};'use strict';var util=require(_0x6006('0x0'));var _=require(_0x6006('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require('moment');var path=require('path');var tiff2pdf=require('tiff2pdf');var gs=require(_0x6006('0x2'));var logger=require(_0x6006('0x3'))(_0x6006('0x4'));var ami=require(_0x6006('0x5'));var rpcDb=require('./rpcDb');var Channel=require(_0x6006('0x6'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0x6006('0x7'));var attachment=require(_0x6006('0x8'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x592940){this[_0x6006('0x9')]={};this[_0x6006('0xa')]=_0x592940[_0x6006('0xa')];this[_0x6006('0xb')]=_0x592940[_0x6006('0xb')];this[_0x6006('0xc')]={};ami['on'](_0x6006('0xd'),this['syncNewchannel']['bind'](this));ami['on']('varset',this[_0x6006('0xe')][_0x6006('0xf')](this));ami['on']('newstate',this[_0x6006('0x10')][_0x6006('0xf')](this));ami['on'](_0x6006('0x11'),this[_0x6006('0x12')][_0x6006('0xf')](this));ami['on'](_0x6006('0x13'),this[_0x6006('0x14')]['bind'](this));ami['on'](_0x6006('0x15'),this[_0x6006('0x16')][_0x6006('0xf')](this));ami['on'](_0x6006('0x17'),this[_0x6006('0x18')][_0x6006('0xf')](this));ami['on'](_0x6006('0x19'),this['syncOriginateResponse'][_0x6006('0xf')](this));}Fax[_0x6006('0x1a')][_0x6006('0x1b')]=function(_0x533a02){if(_0x533a02[_0x6006('0x1c')]===_0x6006('0x1d')){for(var _0x473fe3 in this[_0x6006('0xa')]){if(this[_0x6006('0xa')]['hasOwnProperty'](_0x473fe3)){if(_0x533a02[_0x6006('0x1e')]===this[_0x6006('0xa')][_0x473fe3]['localstationid']){this[_0x6006('0x9')][_0x533a02['uniqueid']]={};this[_0x6006('0x9')][_0x533a02[_0x6006('0x1f')]][_0x6006('0x20')]=_0x533a02['channel'];this[_0x6006('0x9')][_0x533a02['uniqueid']]['id']=this['faxAccounts'][_0x473fe3]['id'];this[_0x6006('0x9')][_0x533a02[_0x6006('0x1f')]]['name']=this[_0x6006('0xa')][_0x473fe3][_0x6006('0x21')];logger[_0x6006('0x22')](_0x533a02[_0x6006('0x1f')],_0x6006('0x23'));}}}}if(this['actions'][_0x533a02[_0x6006('0x1f')]]){this[_0x6006('0x9')][_0x533a02[_0x6006('0x1f')]]={};this[_0x6006('0x9')][_0x533a02['uniqueid']][_0x6006('0x20')]=_0x533a02[_0x6006('0x20')];logger[_0x6006('0x22')](_0x533a02[_0x6006('0x1f')],_0x6006('0x23'));}};Fax[_0x6006('0x1a')]['syncVarSet']=function(_0x34d264){if(this['channels'][_0x34d264['uniqueid']]){for(var _0x2a9d80 in _0x34d264[_0x6006('0x24')]){if(_0x34d264['variable'][_0x6006('0x25')](_0x2a9d80)){this[_0x6006('0x9')][_0x34d264[_0x6006('0x1f')]][_0x2a9d80]=_0x34d264[_0x6006('0x26')];}}}};Fax[_0x6006('0x1a')][_0x6006('0x10')]=function(_0x28434d){if(this['channels'][_0x28434d['uniqueid']]){this[_0x6006('0x9')][_0x28434d[_0x6006('0x1f')]]['channelstate']=_0x28434d[_0x6006('0x27')];this[_0x6006('0x9')][_0x28434d[_0x6006('0x1f')]][_0x6006('0x28')]=_0x28434d[_0x6006('0x28')];}};Fax['prototype']['syncNewExten']=function(_0x2191ab){if(this[_0x6006('0x9')][_0x2191ab[_0x6006('0x1f')]]){for(var _0x37eb3a in _0x2191ab[_0x6006('0x24')]){if(_0x2191ab[_0x6006('0x24')][_0x6006('0x25')](_0x37eb3a)){this[_0x6006('0x9')][_0x2191ab[_0x6006('0x1f')]][_0x37eb3a]=_0x2191ab[_0x6006('0x26')];}}}};Fax['prototype'][_0x6006('0x14')]=function(_0x2d44d5){if(this['channels'][_0x2d44d5[_0x6006('0x1f')]]){this[_0x6006('0x9')][_0x2d44d5[_0x6006('0x1f')]][_0x6006('0x29')]=_0x2d44d5[_0x6006('0x29')];this[_0x6006('0x9')][_0x2d44d5['uniqueid']]['status']=_0x2d44d5[_0x6006('0x2a')];this['channels'][_0x2d44d5[_0x6006('0x1f')]][_0x6006('0x2b')]=_0x2d44d5['localstationid'];this[_0x6006('0x9')][_0x2d44d5[_0x6006('0x1f')]][_0x6006('0x2c')]=_0x2d44d5[_0x6006('0x2c')];logger[_0x6006('0x22')](_0x2d44d5[_0x6006('0x1f')],'\x20syncFaxStatus\x20');}};Fax[_0x6006('0x1a')][_0x6006('0x16')]=function(_0x54e59e){var _0x2c2725=this;if(this[_0x6006('0x9')][_0x54e59e[_0x6006('0x1f')]]){var _0x522be7=this[_0x6006('0x9')][_0x54e59e[_0x6006('0x1f')]]['id'];this[_0x6006('0x9')][_0x54e59e[_0x6006('0x1f')]][_0x6006('0x2d')]=_0x54e59e['remotestationid'];this['channels'][_0x54e59e[_0x6006('0x1f')]][_0x6006('0x2e')]=_0x54e59e[_0x6006('0x2e')];this['channels'][_0x54e59e[_0x6006('0x1f')]][_0x6006('0x2b')]=_0x54e59e[_0x6006('0x2b')];this[_0x6006('0x9')][_0x54e59e[_0x6006('0x1f')]]['resolution']=_0x54e59e[_0x6006('0x2f')];this[_0x6006('0x9')][_0x54e59e['uniqueid']]['transferrate']=_0x54e59e['transferrate'];this[_0x6006('0x9')][_0x54e59e[_0x6006('0x1f')]][_0x6006('0x2c')]=_0x54e59e[_0x6006('0x2c')];this[_0x6006('0x9')][_0x54e59e['uniqueid']]['calleridnum']=_0x54e59e[_0x6006('0x30')];if(this['channels'][_0x54e59e['uniqueid']][_0x6006('0x2e')]>0x0){tiff2pdf(_0x54e59e[_0x6006('0x2c')],_0x6006('0x31'),function(_0x12f366){logger['info'](_0x54e59e['uniqueid'],_0x6006('0x32'),_0x12f366[_0x6006('0x33')]);attachment[_0x6006('0x34')]({'name':path[_0x6006('0x35')](_0x54e59e[_0x6006('0x2c')])[_0x6006('0x21')],'basename':path['parse'](_0x54e59e[_0x6006('0x2c')])[_0x6006('0x21')]+_0x6006('0x36'),'type':_0x6006('0x37')})[_0x6006('0x38')](function(_0x4e2eb9){faxAccount['notify'](_0x522be7,{'from':_0x54e59e[_0x6006('0x30')],'mapKey':_0x6006('0x4'),'body':path[_0x6006('0x35')](_0x54e59e[_0x6006('0x2c')])[_0x6006('0x21')]+'.pdf','AttachmentId':_0x4e2eb9['id']})[_0x6006('0x39')](function(_0x9e03ee){logger['error'](_0x54e59e[_0x6006('0x1f')],_0x6006('0x3a'),JSON[_0x6006('0x3b')](_0x9e03ee));});})[_0x6006('0x39')](function(_0x1017d1){logger[_0x6006('0x3c')](_0x54e59e[_0x6006('0x1f')],'\x20receiveFax\x20',JSON[_0x6006('0x3b')](_0x1017d1));});});}logger[_0x6006('0x22')](_0x54e59e[_0x6006('0x1f')],'\x20receiveFax\x20');}};Fax['prototype']['syncOriginateResponse']=function(_0x35582f){if(this[_0x6006('0xc')][_0x35582f['uniqueid']]){_[_0x6006('0x3d')](this[_0x6006('0x9')][_0x35582f['uniqueid']],_[_0x6006('0x3e')](_0x35582f,[_0x6006('0x3f'),_0x6006('0x40')]));}};function updateStatus(_0x1da951){if(_0x1da951['AttachmentId']){faxMessage[_0x6006('0x41')](_0x1da951[_0x6006('0x42')],{'failMessage':'SENDING\x20FAILED\x20'})['then'](function(_0x325975){ut[_0x6006('0x43')](_0x6006('0x44'),_0x325975);})[_0x6006('0x39')](function(_0x32aa7e){ut[_0x6006('0x43')](_0x6006('0x45'),_0x32aa7e);});}else{ut[_0x6006('0x43')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x6006('0x1a')]['updateStatus']=function(_0x20f19e,_0x26bae9,_0x128734){var _0x20d8ac=this;var _0x5d6d99={};if(_0x26bae9){_0x5d6d99={'read':_0x26bae9};}else{_0x5d6d99={'failMessage':_0x128734};}if(this['actions'][_0x20f19e][_0x6006('0x42')]){faxMessage['update'](this[_0x6006('0xc')][_0x20f19e]['AttachmentId'],_0x5d6d99)[_0x6006('0x38')](function(_0x581dd0){ut[_0x6006('0x43')](_0x6006('0x46'),_0x581dd0);})['catch'](function(_0x11ef82){ut[_0x6006('0x43')](_0x6006('0x47'),_0x11ef82);})[_0x6006('0x48')](function(){delete _0x20d8ac[_0x6006('0x9')][_0x20f19e];delete _0x20d8ac[_0x6006('0xc')][_0x20f19e];});}else{ut[_0x6006('0x43')](_0x6006('0x49'));delete this['channels'][_0x20f19e];delete this[_0x6006('0xc')][_0x20f19e];}};Fax[_0x6006('0x1a')][_0x6006('0x18')]=function(_0x4be124){var _0x1ba42c=this;if(this[_0x6006('0x9')][_0x4be124[_0x6006('0x1f')]]){if(this[_0x6006('0xc')][_0x4be124['uniqueid']]){this[_0x6006('0x9')][_0x4be124['uniqueid']]['id']=this[_0x6006('0xc')][_0x4be124[_0x6006('0x1f')]]['id'];this[_0x6006('0x9')][_0x4be124['uniqueid']][_0x6006('0x21')]=this[_0x6006('0xc')][_0x4be124[_0x6006('0x1f')]][_0x6006('0x21')];}logger[_0x6006('0x22')](_0x4be124[_0x6006('0x1f')],this['actions'][_0x4be124[_0x6006('0x1f')]]?_0x6006('0x4a'):_0x6006('0x4b'),JSON['stringify'](this[_0x6006('0x9')][_0x4be124['uniqueid']]));if(this[_0x6006('0xc')][_0x4be124[_0x6006('0x1f')]]){if(this['channels'][_0x4be124[_0x6006('0x1f')]][_0x6006('0x4c')]>0x0&&this[_0x6006('0x9')][_0x4be124['uniqueid']][_0x6006('0x13')]===_0x6006('0x4d')){this[_0x6006('0x4e')](_0x4be124[_0x6006('0x1f')],!![]);}else{this[_0x6006('0x4e')](_0x4be124[_0x6006('0x1f')],![],this[_0x6006('0x9')][_0x4be124[_0x6006('0x1f')]][_0x6006('0x4f')]?_0x6006('0x50')+this[_0x6006('0x9')][_0x4be124[_0x6006('0x1f')]][_0x6006('0x4f')]:'SENDING\x20FAILED');}}}};Fax[_0x6006('0x1a')][_0x6006('0x51')]=function(_0x124206){var _0x2dd97e=this;return new BPromise(function(_0x5f3ff7,_0x53ad8d){_0x2dd97e['execOriginate'](_0x124206,_0x2dd97e[_0x6006('0xa')][_0x124206['FaxAccountId']])[_0x6006('0x38')](function(_0x4d0f5f){ut[_0x6006('0x43')](_0x6006('0x52'),_0x4d0f5f);_0x5f3ff7(ut[_0x6006('0x33')]('Fax\x20received'));})['catch'](function(_0x1d1d10){ut[_0x6006('0x43')]('[Fax][execOriginate][failure]',_0x1d1d10);updateStatus(_0x124206);_0x53ad8d(ut[_0x6006('0x33')]('Fax\x20failed'));});});};Fax[_0x6006('0x1a')]['checkAfterSend']=function(_0x286927){var _0x46a0b0=this;return new BPromise(function(_0x386cbc,_0x112973){var _0x3121fb=_0x46a0b0[_0x6006('0x53')](_0x46a0b0[_0x6006('0xa')][_0x286927['FaxAccountId']]['Trunk'],_0x286927);if(_0x3121fb[_0x6006('0x54')]){_0x386cbc(ut['message'](_0x6006('0x55')));}else{_0x112973(ut[_0x6006('0x33')](_0x3121fb['message']));}});};function originate(_0x260bb5,_0x5540fa,_0x521e4e){return new BPromise(function(_0x1d2a79,_0x341f44){if(_0x521e4e){var _0x37d001=util[_0x6006('0x56')](_0x6006('0x57'),path[_0x6006('0x35')](_0x260bb5[_0x6006('0x58')])[_0x6006('0x21')],_0x260bb5[_0x6006('0x58')]);gs['execute'](_0x37d001)['then'](function(){_0x260bb5[_0x6006('0x58')]=util['format'](_0x6006('0x59'),path[_0x6006('0x35')](_0x260bb5[_0x6006('0x58')])['dir'],path[_0x6006('0x35')](_0x260bb5[_0x6006('0x58')])['name']);_0x5540fa['XMF-PATH']=_0x260bb5['path'];ut['logger'](_0x6006('0x5a'),'');ami[_0x6006('0x5b')](ut[_0x6006('0x5c')](_0x260bb5,_0x5540fa))[_0x6006('0x38')](function(_0xb3363c){_0x1d2a79(_0xb3363c);})['catch'](function(_0x584993){_0x341f44(_0x584993);});})['catch'](function(_0x491662){_0x341f44(_0x491662);});}else{ami['Action'](ut[_0x6006('0x5c')](_0x260bb5,_0x5540fa))[_0x6006('0x38')](function(_0x3daed8){_0x1d2a79(_0x3daed8);})[_0x6006('0x39')](function(_0x2ff360){_0x341f44(_0x2ff360);});}});}Fax[_0x6006('0x1a')][_0x6006('0x5d')]=function(_0x437d95,_0x21c742){var _0x2f43de=this;return new BPromise(function(_0xd54b4a,_0x306f2f){var _0x7bee30=uuid['v4']();var _0x42ce1e=ut[_0x6006('0x5e')](_0x437d95,_0x21c742);_0x2f43de['actions'][_0x7bee30]=new Action(_0x7bee30,_0x21c742,_0x437d95);var _0x40812e=_0x2f43de[_0x6006('0xc')][_0x7bee30];if(path[_0x6006('0x35')](_0x437d95[_0x6006('0x58')])[_0x6006('0x5f')]==='.pdf'){originate(_0x40812e,_0x42ce1e,!![])[_0x6006('0x38')](function(_0x11d7b7){_0xd54b4a(_0x11d7b7);})['catch'](function(_0x12d5f6){_0x306f2f(_0x12d5f6);});}else{originate(_0x40812e,_0x42ce1e,![])['then'](function(_0x52e8bc){_0xd54b4a(_0x52e8bc);})[_0x6006('0x39')](function(_0x13ac1a){_0x306f2f(_0x13ac1a);});}});};Fax[_0x6006('0x1a')][_0x6006('0x60')]=function(_0x308509){return!_[_0x6006('0x61')](_0x308509)&&!_['isNil'](_0x308509[_0x6006('0x21')])&&!_['isNil'](_0x308509['active'])&&_0x308509[_0x6006('0x62')]&&!_[_0x6006('0x61')](this[_0x6006('0xb')][util[_0x6006('0x56')](_0x6006('0x63'),_0x308509[_0x6006('0x21')])])&&!_[_0x6006('0x61')](this[_0x6006('0xb')][util[_0x6006('0x56')]('SIP/%s',_0x308509[_0x6006('0x21')])]['status'])&&(this['trunks'][util['format'](_0x6006('0x63'),_0x308509['name'])][_0x6006('0x2a')]===_0x6006('0x64')||this[_0x6006('0xb')][util['format'](_0x6006('0x63'),_0x308509[_0x6006('0x21')])][_0x6006('0x2a')]==='unmonitored');};Fax[_0x6006('0x1a')][_0x6006('0x53')]=function(_0x2e323c,_0x9a8888){if(!this['isTrunkReachable'](_0x2e323c)){ut[_0x6006('0x43')](_0x6006('0x65'),_['isNil'](_0x2e323c)?'':_0x2e323c['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x6006('0x66')};}if(_[_0x6006('0x61')](_0x9a8888['fax'])){ut['logger'](_0x6006('0x67'),JSON[_0x6006('0x3b')](_0x9a8888));return{'isValid':![],'message':_0x6006('0x68')};}if(_[_0x6006('0x61')](_0x9a8888['path'])){ut[_0x6006('0x43')](_0x6006('0x69'),JSON[_0x6006('0x3b')](_0x9a8888));return{'isValid':![],'message':_0x6006('0x6a')};}return{'isValid':!![],'message':_0x6006('0x6b')};};module[_0x6006('0x6c')]=Fax; \ No newline at end of file +var _0x71d2=['response','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','execute','%s/%s.tif','dir','XMF-PATH','Action','variablesAction','execOriginate','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','bind','newstate','syncNewState','newexten','syncNewExten','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','syncOriginateResponse','context','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','prototype','channelstate','channelstatedesc','value','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','pick'];(function(_0x137a1c,_0x5608eb){var _0x5297df=function(_0x442ab9){while(--_0x442ab9){_0x137a1c['push'](_0x137a1c['shift']());}};_0x5297df(++_0x5608eb);}(_0x71d2,0x19b));var _0x271d=function(_0x2cf711,_0x553dfa){_0x2cf711=_0x2cf711-0x0;var _0x3ca2eb=_0x71d2[_0x2cf711];return _0x3ca2eb;};'use strict';var util=require(_0x271d('0x0'));var _=require(_0x271d('0x1'));var BPromise=require(_0x271d('0x2'));var uuid=require(_0x271d('0x3'));var moment=require(_0x271d('0x4'));var path=require(_0x271d('0x5'));var tiff2pdf=require(_0x271d('0x6'));var gs=require(_0x271d('0x7'));var logger=require(_0x271d('0x8'))(_0x271d('0x9'));var ami=require(_0x271d('0xa'));var rpcDb=require('./rpcDb');var Channel=require(_0x271d('0xb'));var ut=require(_0x271d('0xc'));var Action=require(_0x271d('0xd'));var faxAccount=require(_0x271d('0xe'));var attachment=require(_0x271d('0xf'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x5051f0){this[_0x271d('0x10')]={};this[_0x271d('0x11')]=_0x5051f0[_0x271d('0x11')];this[_0x271d('0x12')]=_0x5051f0[_0x271d('0x12')];this[_0x271d('0x13')]={};ami['on'](_0x271d('0x14'),this[_0x271d('0x15')]['bind'](this));ami['on'](_0x271d('0x16'),this[_0x271d('0x17')][_0x271d('0x18')](this));ami['on'](_0x271d('0x19'),this[_0x271d('0x1a')][_0x271d('0x18')](this));ami['on'](_0x271d('0x1b'),this[_0x271d('0x1c')][_0x271d('0x18')](this));ami['on']('faxstatus',this[_0x271d('0x1d')]['bind'](this));ami['on'](_0x271d('0x1e'),this[_0x271d('0x1f')][_0x271d('0x18')](this));ami['on']('hangup',this[_0x271d('0x20')][_0x271d('0x18')](this));ami['on']('originateresponse',this[_0x271d('0x21')][_0x271d('0x18')](this));}Fax['prototype']['syncNewchannel']=function(_0x2d61aa){if(_0x2d61aa[_0x271d('0x22')]==='from-voip-provider'){for(var _0x3d9414 in this[_0x271d('0x11')]){if(this[_0x271d('0x11')][_0x271d('0x23')](_0x3d9414)){if(_0x2d61aa[_0x271d('0x24')]===this[_0x271d('0x11')][_0x3d9414][_0x271d('0x25')]){this[_0x271d('0x10')][_0x2d61aa[_0x271d('0x26')]]={};this['channels'][_0x2d61aa[_0x271d('0x26')]]['channel']=_0x2d61aa[_0x271d('0x27')];this[_0x271d('0x10')][_0x2d61aa[_0x271d('0x26')]]['id']=this[_0x271d('0x11')][_0x3d9414]['id'];this[_0x271d('0x10')][_0x2d61aa[_0x271d('0x26')]][_0x271d('0x28')]=this['faxAccounts'][_0x3d9414][_0x271d('0x28')];logger['info'](_0x2d61aa[_0x271d('0x26')],_0x271d('0x29'));}}}}if(this[_0x271d('0x13')][_0x2d61aa['uniqueid']]){this[_0x271d('0x10')][_0x2d61aa[_0x271d('0x26')]]={};this[_0x271d('0x10')][_0x2d61aa[_0x271d('0x26')]][_0x271d('0x27')]=_0x2d61aa[_0x271d('0x27')];logger[_0x271d('0x2a')](_0x2d61aa['uniqueid'],_0x271d('0x29'));}};Fax['prototype'][_0x271d('0x17')]=function(_0x2b5f49){if(this[_0x271d('0x10')][_0x2b5f49[_0x271d('0x26')]]){for(var _0x306d4f in _0x2b5f49[_0x271d('0x2b')]){if(_0x2b5f49[_0x271d('0x2b')][_0x271d('0x23')](_0x306d4f)){this[_0x271d('0x10')][_0x2b5f49[_0x271d('0x26')]][_0x306d4f]=_0x2b5f49['value'];}}}};Fax[_0x271d('0x2c')]['syncNewState']=function(_0x4f7073){if(this[_0x271d('0x10')][_0x4f7073['uniqueid']]){this['channels'][_0x4f7073[_0x271d('0x26')]][_0x271d('0x2d')]=_0x4f7073[_0x271d('0x2d')];this['channels'][_0x4f7073[_0x271d('0x26')]][_0x271d('0x2e')]=_0x4f7073[_0x271d('0x2e')];}};Fax[_0x271d('0x2c')][_0x271d('0x1c')]=function(_0x3238de){if(this['channels'][_0x3238de['uniqueid']]){for(var _0x4c08d4 in _0x3238de[_0x271d('0x2b')]){if(_0x3238de['variable'][_0x271d('0x23')](_0x4c08d4)){this[_0x271d('0x10')][_0x3238de[_0x271d('0x26')]][_0x4c08d4]=_0x3238de[_0x271d('0x2f')];}}}};Fax['prototype'][_0x271d('0x1d')]=function(_0x445089){if(this[_0x271d('0x10')][_0x445089['uniqueid']]){this[_0x271d('0x10')][_0x445089[_0x271d('0x26')]]['operation']=_0x445089[_0x271d('0x30')];this[_0x271d('0x10')][_0x445089[_0x271d('0x26')]]['status']=_0x445089[_0x271d('0x31')];this[_0x271d('0x10')][_0x445089[_0x271d('0x26')]]['localstationid']=_0x445089[_0x271d('0x25')];this['channels'][_0x445089['uniqueid']][_0x271d('0x32')]=_0x445089[_0x271d('0x32')];logger['info'](_0x445089[_0x271d('0x26')],_0x271d('0x33'));}};Fax[_0x271d('0x2c')]['syncReceiveFax']=function(_0x5240e7){var _0x559b24=this;if(this[_0x271d('0x10')][_0x5240e7[_0x271d('0x26')]]){var _0x2bbaa8=this[_0x271d('0x10')][_0x5240e7[_0x271d('0x26')]]['id'];this[_0x271d('0x10')][_0x5240e7[_0x271d('0x26')]][_0x271d('0x34')]=_0x5240e7[_0x271d('0x34')];this['channels'][_0x5240e7[_0x271d('0x26')]]['pagestransferred']=_0x5240e7['pagestransferred'];this[_0x271d('0x10')][_0x5240e7[_0x271d('0x26')]][_0x271d('0x25')]=_0x5240e7[_0x271d('0x25')];this[_0x271d('0x10')][_0x5240e7['uniqueid']]['resolution']=_0x5240e7[_0x271d('0x35')];this[_0x271d('0x10')][_0x5240e7[_0x271d('0x26')]][_0x271d('0x36')]=_0x5240e7[_0x271d('0x36')];this[_0x271d('0x10')][_0x5240e7[_0x271d('0x26')]]['filename']=_0x5240e7[_0x271d('0x32')];this[_0x271d('0x10')][_0x5240e7[_0x271d('0x26')]][_0x271d('0x37')]=_0x5240e7[_0x271d('0x37')];if(this[_0x271d('0x10')][_0x5240e7[_0x271d('0x26')]]['pagestransferred']>0x0){tiff2pdf(_0x5240e7[_0x271d('0x32')],_0x271d('0x38'),function(_0x6a1ad5){logger[_0x271d('0x2a')](_0x5240e7[_0x271d('0x26')],_0x271d('0x39'),_0x6a1ad5['message']);attachment['create']({'name':path[_0x271d('0x3a')](_0x5240e7[_0x271d('0x32')])[_0x271d('0x28')],'basename':path[_0x271d('0x3a')](_0x5240e7['filename'])['name']+_0x271d('0x3b'),'type':_0x271d('0x3c')})[_0x271d('0x3d')](function(_0x3feabd){faxAccount[_0x271d('0x3e')](_0x2bbaa8,{'from':_0x5240e7[_0x271d('0x37')],'mapKey':_0x271d('0x9'),'body':path['parse'](_0x5240e7['filename'])[_0x271d('0x28')]+_0x271d('0x3b'),'AttachmentId':_0x3feabd['id']})[_0x271d('0x3f')](function(_0x3a9f82){logger[_0x271d('0x40')](_0x5240e7['uniqueid'],_0x271d('0x41'),JSON[_0x271d('0x42')](_0x3a9f82));});})[_0x271d('0x3f')](function(_0x4167fe){logger['error'](_0x5240e7[_0x271d('0x26')],_0x271d('0x43'),JSON['stringify'](_0x4167fe));});});}logger['info'](_0x5240e7[_0x271d('0x26')],_0x271d('0x43'));}};Fax[_0x271d('0x2c')][_0x271d('0x21')]=function(_0xc24f3c){if(this[_0x271d('0x13')][_0xc24f3c[_0x271d('0x26')]]){_['merge'](this[_0x271d('0x10')][_0xc24f3c[_0x271d('0x26')]],_[_0x271d('0x44')](_0xc24f3c,[_0x271d('0x45'),'reason']));}};function updateStatus(_0x8bbe23){if(_0x8bbe23[_0x271d('0x46')]){faxMessage[_0x271d('0x47')](_0x8bbe23[_0x271d('0x46')],{'failMessage':_0x271d('0x48')})[_0x271d('0x3d')](function(_0x16675e){ut['logger']('[Fax][Message][Error][Updated]',_0x16675e);})[_0x271d('0x3f')](function(_0x10c53a){ut[_0x271d('0x49')]('[Fax][Message][Error][NoUpdate1]',_0x10c53a);});}else{ut[_0x271d('0x49')](_0x271d('0x4a'));}}Fax['prototype'][_0x271d('0x4b')]=function(_0xbe5bb9,_0x1bf190,_0x10492b){var _0x27ef8a=this;var _0x46a4da={};if(_0x1bf190){_0x46a4da={'read':_0x1bf190};}else{_0x46a4da={'failMessage':_0x10492b};}if(this[_0x271d('0x13')][_0xbe5bb9][_0x271d('0x46')]){faxMessage['update'](this[_0x271d('0x13')][_0xbe5bb9][_0x271d('0x46')],_0x46a4da)['then'](function(_0x37d814){ut[_0x271d('0x49')](_0x271d('0x4c'),_0x37d814);})[_0x271d('0x3f')](function(_0x6b36d9){ut['logger'](_0x271d('0x4d'),_0x6b36d9);})[_0x271d('0x4e')](function(){delete _0x27ef8a[_0x271d('0x10')][_0xbe5bb9];delete _0x27ef8a[_0x271d('0x13')][_0xbe5bb9];});}else{ut['logger'](_0x271d('0x4f'));delete this[_0x271d('0x10')][_0xbe5bb9];delete this[_0x271d('0x13')][_0xbe5bb9];}};Fax[_0x271d('0x2c')][_0x271d('0x20')]=function(_0x14d1e3){var _0x5b831d=this;if(this[_0x271d('0x10')][_0x14d1e3[_0x271d('0x26')]]){if(this['actions'][_0x14d1e3[_0x271d('0x26')]]){this[_0x271d('0x10')][_0x14d1e3['uniqueid']]['id']=this[_0x271d('0x13')][_0x14d1e3['uniqueid']]['id'];this['channels'][_0x14d1e3[_0x271d('0x26')]][_0x271d('0x28')]=this[_0x271d('0x13')][_0x14d1e3[_0x271d('0x26')]][_0x271d('0x28')];}logger[_0x271d('0x2a')](_0x14d1e3['uniqueid'],this[_0x271d('0x13')][_0x14d1e3[_0x271d('0x26')]]?_0x271d('0x50'):_0x271d('0x51'),JSON['stringify'](this[_0x271d('0x10')][_0x14d1e3[_0x271d('0x26')]]));if(this[_0x271d('0x13')][_0x14d1e3['uniqueid']]){if(this['channels'][_0x14d1e3[_0x271d('0x26')]]['faxpages']>0x0&&this[_0x271d('0x10')][_0x14d1e3[_0x271d('0x26')]]['faxstatus']===_0x271d('0x52')){this['updateStatus'](_0x14d1e3[_0x271d('0x26')],!![]);}else{this[_0x271d('0x4b')](_0x14d1e3[_0x271d('0x26')],![],this['channels'][_0x14d1e3[_0x271d('0x26')]][_0x271d('0x53')]?'SENDING\x20FAILED:\x20'+this[_0x271d('0x10')][_0x14d1e3[_0x271d('0x26')]][_0x271d('0x53')]:_0x271d('0x54'));}}}};Fax[_0x271d('0x2c')]['send']=function(_0x122f9a){var _0x38a8e2=this;return new BPromise(function(_0x41ded6,_0x5daee){_0x38a8e2['execOriginate'](_0x122f9a,_0x38a8e2[_0x271d('0x11')][_0x122f9a[_0x271d('0x55')]])[_0x271d('0x3d')](function(_0x26dc03){ut['logger'](_0x271d('0x56'),_0x26dc03);_0x41ded6(ut[_0x271d('0x57')](_0x271d('0x58')));})['catch'](function(_0x2ccdc1){ut[_0x271d('0x49')](_0x271d('0x59'),_0x2ccdc1);updateStatus(_0x122f9a);_0x5daee(ut[_0x271d('0x57')](_0x271d('0x5a')));});});};Fax[_0x271d('0x2c')][_0x271d('0x5b')]=function(_0xbdb60f){var _0x55cbfa=this;return new BPromise(function(_0xd89419,_0x3ec059){var _0x2dfc40=_0x55cbfa[_0x271d('0x5c')](_0x55cbfa['faxAccounts'][_0xbdb60f[_0x271d('0x55')]][_0x271d('0x5d')],_0xbdb60f);if(_0x2dfc40[_0x271d('0x5e')]){_0xd89419(ut[_0x271d('0x57')](_0x271d('0x5f')));}else{_0x3ec059(ut[_0x271d('0x57')](_0x2dfc40[_0x271d('0x57')]));}});};function originate(_0x2b5993,_0x1ffeb3,_0x512522){return new BPromise(function(_0x47bfb6,_0x350340){if(_0x512522){var _0x45332b=util[_0x271d('0x60')]('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[_0x271d('0x3a')](_0x2b5993[_0x271d('0x5')])[_0x271d('0x28')],_0x2b5993[_0x271d('0x5')]);gs[_0x271d('0x61')](_0x45332b)[_0x271d('0x3d')](function(){_0x2b5993[_0x271d('0x5')]=util[_0x271d('0x60')](_0x271d('0x62'),path[_0x271d('0x3a')](_0x2b5993[_0x271d('0x5')])[_0x271d('0x63')],path[_0x271d('0x3a')](_0x2b5993[_0x271d('0x5')])[_0x271d('0x28')]);_0x1ffeb3[_0x271d('0x64')]=_0x2b5993[_0x271d('0x5')];ut['logger']('Convert\x20pdf\x20to\x20tif','');ami[_0x271d('0x65')](ut[_0x271d('0x66')](_0x2b5993,_0x1ffeb3))['then'](function(_0x41cf4b){_0x47bfb6(_0x41cf4b);})['catch'](function(_0x511b9c){_0x350340(_0x511b9c);});})[_0x271d('0x3f')](function(_0x39a00e){_0x350340(_0x39a00e);});}else{ami['Action'](ut['variablesAction'](_0x2b5993,_0x1ffeb3))[_0x271d('0x3d')](function(_0x2b99e1){_0x47bfb6(_0x2b99e1);})[_0x271d('0x3f')](function(_0x2f4058){_0x350340(_0x2f4058);});}});}Fax[_0x271d('0x2c')][_0x271d('0x67')]=function(_0x211155,_0x212814){var _0x4ec02d=this;return new BPromise(function(_0x6ce9c9,_0x42ff58){var _0x11a7ba=uuid['v4']();var _0x54e82f=ut[_0x271d('0x68')](_0x211155,_0x212814);_0x4ec02d[_0x271d('0x13')][_0x11a7ba]=new Action(_0x11a7ba,_0x212814,_0x211155);var _0x5e05d8=_0x4ec02d['actions'][_0x11a7ba];if(path['parse'](_0x211155['path'])[_0x271d('0x69')]===_0x271d('0x3b')){originate(_0x5e05d8,_0x54e82f,!![])[_0x271d('0x3d')](function(_0x449cc0){_0x6ce9c9(_0x449cc0);})['catch'](function(_0xc8c65f){_0x42ff58(_0xc8c65f);});}else{originate(_0x5e05d8,_0x54e82f,![])['then'](function(_0x37e6af){_0x6ce9c9(_0x37e6af);})[_0x271d('0x3f')](function(_0xff31fe){_0x42ff58(_0xff31fe);});}});};Fax['prototype'][_0x271d('0x6a')]=function(_0x327ac0){return!_[_0x271d('0x6b')](_0x327ac0)&&!_[_0x271d('0x6b')](_0x327ac0[_0x271d('0x28')])&&!_[_0x271d('0x6b')](_0x327ac0['active'])&&_0x327ac0[_0x271d('0x6c')]&&!_[_0x271d('0x6b')](this['trunks'][util[_0x271d('0x60')](_0x271d('0x6d'),_0x327ac0[_0x271d('0x28')])])&&!_[_0x271d('0x6b')](this[_0x271d('0x12')][util[_0x271d('0x60')](_0x271d('0x6d'),_0x327ac0[_0x271d('0x28')])]['status'])&&(this['trunks'][util[_0x271d('0x60')](_0x271d('0x6d'),_0x327ac0['name'])]['status']===_0x271d('0x6e')||this['trunks'][util[_0x271d('0x60')](_0x271d('0x6d'),_0x327ac0[_0x271d('0x28')])]['status']===_0x271d('0x6f'));};Fax[_0x271d('0x2c')]['checkTrunk']=function(_0x5a98ed,_0x25596b){if(!this[_0x271d('0x6a')](_0x5a98ed)){ut[_0x271d('0x49')](_0x271d('0x70'),_['isNil'](_0x5a98ed)?'':_0x5a98ed[_0x271d('0x28')]+_0x271d('0x71'));return{'isValid':![],'message':_0x271d('0x72')};}if(_['isNil'](_0x25596b[_0x271d('0x9')])){ut['logger'](_0x271d('0x73'),JSON['stringify'](_0x25596b));return{'isValid':![],'message':_0x271d('0x74')};}if(_[_0x271d('0x6b')](_0x25596b['path'])){ut[_0x271d('0x49')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x271d('0x42')](_0x25596b));return{'isValid':![],'message':_0x271d('0x75')};}return{'isValid':!![],'message':_0x271d('0x76')};};module[_0x271d('0x77')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 114bf71..bc76207 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 _0xa41e=['lodash','../rpc/faxAccount','error','inspect','notify','resolve','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview'];(function(_0x13606d,_0x30f265){var _0x1b85b0=function(_0x285c1b){while(--_0x285c1b){_0x13606d['push'](_0x13606d['shift']());}};_0x1b85b0(++_0x30f265);}(_0xa41e,0x1a0));var _0xea41=function(_0x64b657,_0x35f1a3){_0x64b657=_0x64b657-0x0;var _0x250a67=_0xa41e[_0x64b657];return _0x250a67;};'use strict';var util=require(_0xea41('0x0'));var BPromise=require(_0xea41('0x1'));var logger=require(_0xea41('0x2'))(_0xea41('0x3'));var _=require(_0xea41('0x4'));var faxAccount=require(_0xea41('0x5'));function loggerCatch(_0x5abfc0){return function(_0x5d514f){logger[_0xea41('0x6')](_0x5abfc0,util[_0xea41('0x7')](_0x5d514f,{'showHidden':![],'depth':null}));};}exports[_0xea41('0x8')]=function(_0xd37ec4,_0x2cde7a){return BPromise[_0xea41('0x9')]()['then'](faxAccount[_0xea41('0x8')](_0xd37ec4,_0x2cde7a))[_0xea41('0xa')](loggerCatch(_0xea41('0xb')));}; \ No newline at end of file +var _0xd7ac=['[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','notify','resolve','then','catch'];(function(_0x3df4ec,_0x188cf8){var _0x38eeb2=function(_0x9f1840){while(--_0x9f1840){_0x3df4ec['push'](_0x3df4ec['shift']());}};_0x38eeb2(++_0x188cf8);}(_0xd7ac,0x1f0));var _0xcd7a=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xd7ac[_0xbd08b4];return _0x314f1e;};'use strict';var util=require(_0xcd7a('0x0'));var BPromise=require(_0xcd7a('0x1'));var logger=require(_0xcd7a('0x2'))(_0xcd7a('0x3'));var _=require(_0xcd7a('0x4'));var faxAccount=require(_0xcd7a('0x5'));function loggerCatch(_0xbb023d){return function(_0x4025e7){logger['error'](_0xbb023d,util['inspect'](_0x4025e7,{'showHidden':![],'depth':null}));};}exports[_0xcd7a('0x6')]=function(_0x4b9722,_0x3c945b){return BPromise[_0xcd7a('0x7')]()[_0xcd7a('0x8')](faxAccount[_0xcd7a('0x6')](_0x4b9722,_0x3c945b))[_0xcd7a('0x9')](loggerCatch(_0xcd7a('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index d906caa..99ef0fe 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 _0xb314=['../../../../config/logger','fax','bluebird','exec','Exec\x20gs','info','inspect','util'];(function(_0x5813eb,_0x157c17){var _0x314c58=function(_0x45dcec){while(--_0x45dcec){_0x5813eb['push'](_0x5813eb['shift']());}};_0x314c58(++_0x157c17);}(_0xb314,0x117));var _0x4b31=function(_0x8186d9,_0x2e2daa){_0x8186d9=_0x8186d9-0x0;var _0x45bb32=_0xb314[_0x8186d9];return _0x45bb32;};'use strict';var util=require(_0x4b31('0x0'));var logger=require(_0x4b31('0x1'))(_0x4b31('0x2'));var BPromise=require(_0x4b31('0x3'));var exec=require('child_process')[_0x4b31('0x4')];exports['execute']=function(_0x2e93f9){return new BPromise(function(_0x309582,_0x473da1){exec(_0x2e93f9,function(_0xc86537,_0x4010c6,_0x19031d){logger['info'](_0x4b31('0x5'),_0x4010c6);if(_0xc86537){logger[_0x4b31('0x6')](_0x4b31('0x5'),'\x20Error\x20:',util[_0x4b31('0x7')](_0xc86537,{'showHidden':![],'depth':null}),_0x4010c6,_0x19031d);_0x473da1(_0xc86537);}_0x309582(_0x4010c6);});});}; \ No newline at end of file +var _0xdf4a=['Exec\x20gs','\x20Error\x20:','../../../../config/logger','bluebird','exec'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xdf4a,0x1dd));var _0xadf4=function(_0x3e4783,_0x4d6d2b){_0x3e4783=_0x3e4783-0x0;var _0x5bfe93=_0xdf4a[_0x3e4783];return _0x5bfe93;};'use strict';var util=require('util');var logger=require(_0xadf4('0x0'))('fax');var BPromise=require(_0xadf4('0x1'));var exec=require('child_process')[_0xadf4('0x2')];exports['execute']=function(_0x58d9f7){return new BPromise(function(_0x31bc15,_0xd10ead){exec(_0x58d9f7,function(_0x552d42,_0x92d57e,_0x468a00){logger['info'](_0xadf4('0x3'),_0x92d57e);if(_0x552d42){logger['info'](_0xadf4('0x3'),_0xadf4('0x4'),util['inspect'](_0x552d42,{'showHidden':![],'depth':null}),_0x92d57e,_0x468a00);_0xd10ead(_0x552d42);}_0x31bc15(_0x92d57e);});});}; \ 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 6b2cfc9..0f4dda9 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 _0xf440=['faxdetect','t38timeout','path','variablesAction','uniqueid','originate','channel','from-sip','format','\x22%s\x22\x20<%s>','headerinfo','localstationid','util','lodash','../../../../config/logger','fax','message','inspect','minrate','\x22%s\x22','modem'];(function(_0x41aad8,_0x21040d){var _0x13c860=function(_0x1e13be){while(--_0x1e13be){_0x41aad8['push'](_0x41aad8['shift']());}};_0x13c860(++_0x21040d);}(_0xf440,0xf3));var _0x0f44=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xf440[_0xfae23b];return _0x200640;};'use strict';var util=require(_0x0f44('0x0'));var _=require(_0x0f44('0x1'));var moment=require('moment');var logger=require(_0x0f44('0x2'))(_0x0f44('0x3'));exports[_0x0f44('0x4')]=function(_0x4d90c2){return{'message':_0x4d90c2};};exports['logger']=function(_0x363e0c,_0x7931c1){logger['info'](_0x363e0c,util[_0x0f44('0x5')](_0x7931c1,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x31d95b,_0x52e467){var _0x2ad173={'XMF-ECM':_0x52e467['ecm'],'XMF-HEADERINFO':_0x52e467['headerinfo'],'XMF-MINRATE':_0x52e467[_0x0f44('0x6')],'XMF-MAXRATE':_0x52e467['maxrate'],'XMF-MODEM':util['format'](_0x0f44('0x7'),_0x52e467[_0x0f44('0x8')]),'XMF-GATEWAY':_0x52e467['gateway'],'XMF-FAXDETECT':_0x52e467[_0x0f44('0x9')],'XMF-T38TIMEOUT':_0x52e467[_0x0f44('0xa')],'XMF-LOCALSTATIONID':_0x52e467['localstationid'],'XMF-PATH':_0x31d95b[_0x0f44('0xb')]};return _0x2ad173;};exports[_0x0f44('0xc')]=function(_0x253fe2,_0x39f622){return{'actionid':_0x253fe2[_0x0f44('0xd')],'action':_0x0f44('0xe'),'channel':_0x253fe2[_0x0f44('0xf')],'Exten':'xcally-motion-fax','Context':_0x0f44('0x10'),'Priority':'1','callerid':util[_0x0f44('0x11')](_0x0f44('0x12'),_0x253fe2[_0x0f44('0x13')]?_0x253fe2[_0x0f44('0x13')]:'',_0x253fe2[_0x0f44('0x14')]),'variable':_0x39f622,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x253fe2[_0x0f44('0xd')]};}; \ No newline at end of file +var _0xfe77=['gateway','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','format','\x22%s\x22','modem'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xfe77,0x181));var _0x7fe7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfe77[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x7fe7('0x0'));var _=require(_0x7fe7('0x1'));var moment=require(_0x7fe7('0x2'));var logger=require(_0x7fe7('0x3'))(_0x7fe7('0x4'));exports[_0x7fe7('0x5')]=function(_0x545c4d){return{'message':_0x545c4d};};exports[_0x7fe7('0x6')]=function(_0x224d96,_0x4919e7){logger[_0x7fe7('0x7')](_0x224d96,util[_0x7fe7('0x8')](_0x4919e7,{'showHidden':![],'depth':null}));};exports[_0x7fe7('0x9')]=function(_0x10b821,_0x59b9c9){var _0x2526ba={'XMF-ECM':_0x59b9c9[_0x7fe7('0xa')],'XMF-HEADERINFO':_0x59b9c9[_0x7fe7('0xb')],'XMF-MINRATE':_0x59b9c9['minrate'],'XMF-MAXRATE':_0x59b9c9['maxrate'],'XMF-MODEM':util[_0x7fe7('0xc')](_0x7fe7('0xd'),_0x59b9c9[_0x7fe7('0xe')]),'XMF-GATEWAY':_0x59b9c9[_0x7fe7('0xf')],'XMF-FAXDETECT':_0x59b9c9['faxdetect'],'XMF-T38TIMEOUT':_0x59b9c9[_0x7fe7('0x10')],'XMF-LOCALSTATIONID':_0x59b9c9[_0x7fe7('0x11')],'XMF-PATH':_0x10b821[_0x7fe7('0x12')]};return _0x2526ba;};exports[_0x7fe7('0x13')]=function(_0x36efce,_0x1c0ee3){return{'actionid':_0x36efce[_0x7fe7('0x14')],'action':_0x7fe7('0x15'),'channel':_0x36efce[_0x7fe7('0x16')],'Exten':'xcally-motion-fax','Context':_0x7fe7('0x17'),'Priority':'1','callerid':util[_0x7fe7('0xc')](_0x7fe7('0x18'),_0x36efce[_0x7fe7('0xb')]?_0x36efce['headerinfo']:'',_0x36efce['localstationid']),'variable':_0x1c0ee3,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x36efce['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 381f53c..5d3cc9f 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 _0xa052=['initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','[index.js][initParams]','inspect','listen','sync','error','[index.js][main]','moment','./report','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','ami','hour','resolve','getAgents','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions'];(function(_0x55fa5c,_0x30bd41){var _0xea802f=function(_0x4bc014){while(--_0x4bc014){_0x55fa5c['push'](_0x55fa5c['shift']());}};_0xea802f(++_0x30bd41);}(_0xa052,0x124));var _0x2a05=function(_0xfadba1,_0x4de494){_0xfadba1=_0xfadba1-0x0;var _0x57638a=_0xa052[_0xfadba1];return _0x57638a;};'use strict';var util=require('util');var moment=require(_0x2a05('0x0'));var server=require('./server');var Realtime=require('./realtime');var Report=require(_0x2a05('0x1'));var Acw=require('./acw');var Trigger=require(_0x2a05('0x2'));var Dialer=require(_0x2a05('0x3'));var Preview=require(_0x2a05('0x4'));var Fax=require(_0x2a05('0x5'));var user=require(_0x2a05('0x6'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x2a05('0x7'));var voiceCallReport=require(_0x2a05('0x8'));var trunk=require(_0x2a05('0x9'));var trigger=require('./rpc/trigger');var template=require(_0x2a05('0xa'));var cmHopperHistory=require(_0x2a05('0xb'));var campaign=require(_0x2a05('0xc'));var voiceExtension=require(_0x2a05('0xd'));var faxAccount=require(_0x2a05('0xe'));var zendesk=require(_0x2a05('0xf'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x2a05('0x10'));var zoho=require(_0x2a05('0x11'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x2a05('0x12'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0x2a05('0x13'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x2a05('0x14'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x2a05('0x14'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x2a05('0x15')]()['then'](user[_0x2a05('0x16')]())[_0x2a05('0x17')](realtime[_0x2a05('0x18')]())[_0x2a05('0x17')](user[_0x2a05('0x19')]())[_0x2a05('0x17')](realtime[_0x2a05('0x1a')]())[_0x2a05('0x17')](trunk[_0x2a05('0x1b')]())[_0x2a05('0x17')](realtime[_0x2a05('0x1c')]())[_0x2a05('0x17')](voiceQueue['getVoiceQueues']())[_0x2a05('0x17')](realtime[_0x2a05('0x1d')]())['then'](trigger[_0x2a05('0x1e')]())[_0x2a05('0x17')](realtime['initTriggers']())[_0x2a05('0x17')](template['getTemplates']())[_0x2a05('0x17')](realtime[_0x2a05('0x1f')]())['then'](zendesk[_0x2a05('0x20')]())['then'](realtime[_0x2a05('0x21')]())[_0x2a05('0x17')](salesforce[_0x2a05('0x22')]())[_0x2a05('0x17')](realtime[_0x2a05('0x23')]())[_0x2a05('0x17')](sugarcrm[_0x2a05('0x24')]())['then'](realtime[_0x2a05('0x25')]())[_0x2a05('0x17')](freshdesk[_0x2a05('0x26')]())['then'](realtime[_0x2a05('0x27')]())['then'](desk[_0x2a05('0x28')]())[_0x2a05('0x17')](realtime[_0x2a05('0x29')]())[_0x2a05('0x17')](zoho[_0x2a05('0x2a')]())[_0x2a05('0x17')](realtime[_0x2a05('0x2b')]())[_0x2a05('0x17')](vtiger[_0x2a05('0x2c')]())['then'](realtime[_0x2a05('0x2d')]())[_0x2a05('0x17')](freshsales[_0x2a05('0x2e')]())[_0x2a05('0x17')](realtime['initFreshsalesAccounts']())[_0x2a05('0x17')](servicenow[_0x2a05('0x2f')]())[_0x2a05('0x17')](realtime[_0x2a05('0x30')]())['then'](dynamics365['getDynamics365Accounts']())[_0x2a05('0x17')](realtime[_0x2a05('0x31')]())['then'](campaign[_0x2a05('0x32')]())[_0x2a05('0x17')](realtime[_0x2a05('0x33')]())['then'](voiceExtension[_0x2a05('0x34')]())[_0x2a05('0x17')](realtime[_0x2a05('0x35')]())['then'](faxAccount['getFaxAccounts']())['then'](realtime[_0x2a05('0x36')]())[_0x2a05('0x17')](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0x2a05('0x17')](voiceQueueReport[_0x2a05('0x37')]())['then'](realtime[_0x2a05('0x38')]())['then'](cmHopperHistory[_0x2a05('0x39')]())[_0x2a05('0x17')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory[_0x2a05('0x3a')]())['then'](realtime[_0x2a05('0x3b')]())[_0x2a05('0x17')](voiceCallReport[_0x2a05('0x3c')]())[_0x2a05('0x17')](realtime[_0x2a05('0x3d')]())[_0x2a05('0x3e')](function(_0x23455){logger['error'](_0x2a05('0x3f'),util[_0x2a05('0x40')](_0x23455,{'showHidden':![],'depth':null}));});}function main(){return server[_0x2a05('0x41')](realtime,preview,fax)[_0x2a05('0x17')](function(){return initRealtime();})[_0x2a05('0x17')](function(){return initParams();})[_0x2a05('0x17')](function(){report[_0x2a05('0x42')]();setInterval(initRealtime,0x1388);})[_0x2a05('0x3e')](function(_0x1bfdd8){logger[_0x2a05('0x43')](_0x2a05('0x44'),util[_0x2a05('0x40')](_0x1bfdd8,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x8419=['./dialer','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/dynamics365','ami','get','hour','then','getAgents','initAgents','getTelephones','getTrunks','initTrunks','getTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','moment','./server','./report','./acw','./trigger'];(function(_0x3a1ac5,_0x6fc077){var _0x51f53c=function(_0x1999de){while(--_0x1999de){_0x3a1ac5['push'](_0x3a1ac5['shift']());}};_0x51f53c(++_0x6fc077);}(_0x8419,0x149));var _0x9841=function(_0x297939,_0x4809b6){_0x297939=_0x297939-0x0;var _0x1ec7bf=_0x8419[_0x297939];return _0x1ec7bf;};'use strict';var util=require(_0x9841('0x0'));var moment=require(_0x9841('0x1'));var server=require(_0x9841('0x2'));var Realtime=require('./realtime');var Report=require(_0x9841('0x3'));var Acw=require(_0x9841('0x4'));var Trigger=require(_0x9841('0x5'));var Dialer=require(_0x9841('0x6'));var Preview=require('./preview');var Fax=require(_0x9841('0x7'));var user=require('./rpc/user');var voiceQueue=require(_0x9841('0x8'));var voiceQueueReport=require(_0x9841('0x9'));var voiceCallReport=require(_0x9841('0xa'));var trunk=require(_0x9841('0xb'));var trigger=require(_0x9841('0xc'));var template=require(_0x9841('0xd'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x9841('0xe'));var voiceExtension=require(_0x9841('0xf'));var faxAccount=require(_0x9841('0x10'));var zendesk=require(_0x9841('0x11'));var salesforce=require(_0x9841('0x12'));var sugarcrm=require(_0x9841('0x13'));var freshdesk=require(_0x9841('0x14'));var desk=require(_0x9841('0x15'));var zoho=require(_0x9841('0x16'));var vtiger=require(_0x9841('0x17'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x9841('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0x9841('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x9841('0x1a')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x9841('0x1a')](_0x9841('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0x9841('0x1c')](user[_0x9841('0x1d')]())[_0x9841('0x1c')](realtime[_0x9841('0x1e')]())[_0x9841('0x1c')](user[_0x9841('0x1f')]())[_0x9841('0x1c')](realtime['initTelephones']())['then'](trunk[_0x9841('0x20')]())[_0x9841('0x1c')](realtime[_0x9841('0x21')]())[_0x9841('0x1c')](voiceQueue['getVoiceQueues']())[_0x9841('0x1c')](realtime['initVoiceQueues']())[_0x9841('0x1c')](trigger[_0x9841('0x22')]())[_0x9841('0x1c')](realtime['initTriggers']())['then'](template['getTemplates']())['then'](realtime[_0x9841('0x23')]())[_0x9841('0x1c')](zendesk[_0x9841('0x24')]())[_0x9841('0x1c')](realtime[_0x9841('0x25')]())[_0x9841('0x1c')](salesforce['getSalesforceAccounts']())[_0x9841('0x1c')](realtime['initSalesforceAccounts']())[_0x9841('0x1c')](sugarcrm['getSugarcrmAccounts']())[_0x9841('0x1c')](realtime[_0x9841('0x26')]())[_0x9841('0x1c')](freshdesk[_0x9841('0x27')]())[_0x9841('0x1c')](realtime['initFreshdeskAccounts']())[_0x9841('0x1c')](desk[_0x9841('0x28')]())[_0x9841('0x1c')](realtime[_0x9841('0x29')]())[_0x9841('0x1c')](zoho[_0x9841('0x2a')]())['then'](realtime[_0x9841('0x2b')]())['then'](vtiger['getVtigerAccounts']())[_0x9841('0x1c')](realtime[_0x9841('0x2c')]())[_0x9841('0x1c')](freshsales['getFreshsalesAccounts']())[_0x9841('0x1c')](realtime['initFreshsalesAccounts']())[_0x9841('0x1c')](servicenow[_0x9841('0x2d')]())['then'](realtime[_0x9841('0x2e')]())[_0x9841('0x1c')](dynamics365[_0x9841('0x2f')]())[_0x9841('0x1c')](realtime[_0x9841('0x30')]())[_0x9841('0x1c')](campaign['getCampaigns']())[_0x9841('0x1c')](realtime[_0x9841('0x31')]())[_0x9841('0x1c')](voiceExtension['getVoiceExtensions']())[_0x9841('0x1c')](realtime[_0x9841('0x32')]())['then'](faxAccount[_0x9841('0x33')]())[_0x9841('0x1c')](realtime[_0x9841('0x34')]())['then'](function(){return realtime;});}function initParams(){return Promise[_0x9841('0x35')]()[_0x9841('0x1c')](voiceQueueReport[_0x9841('0x36')]())[_0x9841('0x1c')](realtime[_0x9841('0x37')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x9841('0x1c')](realtime[_0x9841('0x38')]())[_0x9841('0x1c')](cmHopperHistory[_0x9841('0x39')]())[_0x9841('0x1c')](realtime[_0x9841('0x3a')]())[_0x9841('0x1c')](voiceCallReport[_0x9841('0x3b')]())[_0x9841('0x1c')](realtime['initVoiceCallReports']())[_0x9841('0x3c')](function(_0x336b78){logger[_0x9841('0x3d')](_0x9841('0x3e'),util[_0x9841('0x3f')](_0x336b78,{'showHidden':![],'depth':null}));});}function main(){return server[_0x9841('0x40')](realtime,preview,fax)[_0x9841('0x1c')](function(){return initRealtime();})[_0x9841('0x1c')](function(){return initParams();})[_0x9841('0x1c')](function(){report[_0x9841('0x41')]();setInterval(initRealtime,0x1388);})[_0x9841('0x3c')](function(_0x42511f){logger[_0x9841('0x3d')](_0x9841('0x42'),util[_0x9841('0x3f')](_0x42511f,{'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 471ae69..12ad29c 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 _0x66c5=['user:%s','emit','user:ami:update','omit','user:presence','exports','util','moment','md5','ioredis','redis','defaults','localhost','name','email','accountcode','fullname','state','unknown','stateTime','status','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','toNumber','format','address','stringify'];(function(_0x9ac6f2,_0x43d9e9){var _0x5bc954=function(_0x467bc1){while(--_0x467bc1){_0x9ac6f2['push'](_0x9ac6f2['shift']());}};_0x5bc954(++_0x43d9e9);}(_0x66c5,0x1b3));var _0x566c=function(_0x57d100,_0x3559c7){_0x57d100=_0x57d100-0x0;var _0x170781=_0x66c5[_0x57d100];return _0x170781;};'use strict';var _=require('lodash');var util=require(_0x566c('0x0'));var moment=require(_0x566c('0x1'));var md5=require(_0x566c('0x2'));var Redis=require(_0x566c('0x3'));var config=require('../../../config/environment');config[_0x566c('0x4')]=_[_0x566c('0x5')](config['redis'],{'host':_0x566c('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x566c('0x4')]));function Agent(_0x511c4f){this['id']=_0x511c4f['id']||0x0;this['name']=_0x511c4f[_0x566c('0x7')]||'';this[_0x566c('0x8')]=_0x511c4f['email']||'';this[_0x566c('0x9')]=_0x511c4f['accountcode']||'';this[_0x566c('0xa')]=_0x511c4f[_0x566c('0xa')]||'';this[_0x566c('0xb')]=_0x566c('0xc');this[_0x566c('0xd')]=0x0;this[_0x566c('0xe')]='unknown';this['address']='';this[_0x566c('0xf')]='';this['mobile']='';this['interface']='';this[_0x566c('0x10')]=_0x511c4f[_0x566c('0x10')]||![];this[_0x566c('0x11')]=_0x566c('0xc');this[_0x566c('0x12')]=0x0;this[_0x566c('0x13')]='';this[_0x566c('0x14')]='';this['onhold']=![];this[_0x566c('0x15')]=![];this[_0x566c('0x2')]='';}Agent['prototype'][_0x566c('0x16')]=function(_0x2d213d){var _0x2756f5;if(_0x2d213d&&_0x2d213d[_0x566c('0xb')]){_0x2756f5=_0x2d213d[_0x566c('0xb')][_0x566c('0x17')]();switch(_0x2756f5){case _0x566c('0x18'):_0x2756f5=_0x566c('0x19');break;case _0x566c('0x1a'):_0x2756f5=_0x566c('0x1b');break;}}if(_0x2756f5&&this[_0x566c('0x11')]!==_0x2756f5||_0x2d213d[_0x566c('0x1c')]){this['voiceStatusTime']=_[_0x566c('0x1d')](moment()[_0x566c('0x1e')]('x'));}if(_0x2756f5){this[_0x566c('0x11')]=_0x2756f5;}var _0x422c3a={'id':this['id'],'name':this[_0x566c('0x7')],'email':this[_0x566c('0x8')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0x566c('0xb')],'stateTime':this[_0x566c('0xd')],'status':this['status'],'address':this[_0x566c('0x1f')],'online':this['online'],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x566c('0x12')],'voiceStatusCallerIdNumber':this[_0x566c('0x13')],'voiceStatusQueue':this[_0x566c('0x14')],'interface':this['interface'],'onhold':this['onhold']};var _0x266bc0=md5(JSON[_0x566c('0x20')](_0x422c3a));if(this['md5']!==_0x266bc0){this[_0x566c('0x2')]=_0x266bc0;io['to'](util[_0x566c('0x1e')](_0x566c('0x21'),_0x422c3a[_0x566c('0x7')]))[_0x566c('0x22')](_0x566c('0x23'),_[_0x566c('0x24')](_0x422c3a,['online']));io['emit'](_0x566c('0x25'),_0x422c3a);}};module[_0x566c('0x26')]=Agent; \ No newline at end of file +var _0xf072=['talking','statePause','voiceStatusTime','toNumber','format','stringify','user:%s','emit','omit','online','user:presence','exports','lodash','util','moment','ioredis','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','interface','voiceStatus','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','md5','prototype','updateStatusRealtime','toLowerCase','idle','inuse'];(function(_0x5cd2e2,_0x1fa130){var _0x572fed=function(_0x329639){while(--_0x329639){_0x5cd2e2['push'](_0x5cd2e2['shift']());}};_0x572fed(++_0x1fa130);}(_0xf072,0x1cf));var _0x2f07=function(_0x5d665b,_0x424d54){_0x5d665b=_0x5d665b-0x0;var _0xe74d04=_0xf072[_0x5d665b];return _0xe74d04;};'use strict';var _=require(_0x2f07('0x0'));var util=require(_0x2f07('0x1'));var moment=require(_0x2f07('0x2'));var md5=require('md5');var Redis=require(_0x2f07('0x3'));var config=require('../../../config/environment');config[_0x2f07('0x4')]=_[_0x2f07('0x5')](config[_0x2f07('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x2f07('0x6'))(new Redis(config[_0x2f07('0x4')]));function Agent(_0x3643bb){this['id']=_0x3643bb['id']||0x0;this[_0x2f07('0x7')]=_0x3643bb[_0x2f07('0x7')]||'';this[_0x2f07('0x8')]=_0x3643bb[_0x2f07('0x8')]||'';this[_0x2f07('0x9')]=_0x3643bb[_0x2f07('0x9')]||'';this[_0x2f07('0xa')]=_0x3643bb[_0x2f07('0xa')]||'';this[_0x2f07('0xb')]=_0x2f07('0xc');this[_0x2f07('0xd')]=0x0;this[_0x2f07('0xe')]='unknown';this[_0x2f07('0xf')]='';this[_0x2f07('0x10')]='';this[_0x2f07('0x11')]='';this[_0x2f07('0x12')]='';this['online']=_0x3643bb['online']||![];this[_0x2f07('0x13')]=_0x2f07('0xc');this['voiceStatusTime']=0x0;this[_0x2f07('0x14')]='';this[_0x2f07('0x15')]='';this[_0x2f07('0x16')]=![];this['local']=![];this[_0x2f07('0x17')]='';}Agent[_0x2f07('0x18')][_0x2f07('0x19')]=function(_0xe2ffb7){var _0x254dbb;if(_0xe2ffb7&&_0xe2ffb7[_0x2f07('0xb')]){_0x254dbb=_0xe2ffb7['state'][_0x2f07('0x1a')]();switch(_0x254dbb){case'not_inuse':_0x254dbb=_0x2f07('0x1b');break;case _0x2f07('0x1c'):_0x254dbb=_0x2f07('0x1d');break;}}if(_0x254dbb&&this[_0x2f07('0x13')]!==_0x254dbb||_0xe2ffb7[_0x2f07('0x1e')]){this[_0x2f07('0x1f')]=_[_0x2f07('0x20')](moment()[_0x2f07('0x21')]('x'));}if(_0x254dbb){this['voiceStatus']=_0x254dbb;}var _0x15c3dd={'id':this['id'],'name':this['name'],'email':this[_0x2f07('0x8')],'accountcode':this[_0x2f07('0x9')],'fullname':this[_0x2f07('0xa')],'state':this[_0x2f07('0xb')],'stateTime':this[_0x2f07('0xd')],'status':this['status'],'address':this[_0x2f07('0xf')],'online':this['online'],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x2f07('0x14')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x2f07('0x12')],'onhold':this['onhold']};var _0x354ee2=md5(JSON[_0x2f07('0x22')](_0x15c3dd));if(this[_0x2f07('0x17')]!==_0x354ee2){this[_0x2f07('0x17')]=_0x354ee2;io['to'](util['format'](_0x2f07('0x23'),_0x15c3dd[_0x2f07('0x7')]))[_0x2f07('0x24')]('user:ami:update',_[_0x2f07('0x25')](_0x15c3dd,[_0x2f07('0x26')]));io['emit'](_0x2f07('0x27'),_0x15c3dd);}};module[_0x2f07('0x28')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 9c72b3c..77a7372 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 _0x7793=['dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry'];(function(_0x31e43c,_0x1ae0c0){var _0x554637=function(_0x138c3f){while(--_0x138c3f){_0x31e43c['push'](_0x31e43c['shift']());}};_0x554637(++_0x1ae0c0);}(_0x7793,0x159));var _0x3779=function(_0x5e2bea,_0x58895a){_0x5e2bea=_0x5e2bea-0x0;var _0x3041a2=_0x7793[_0x5e2bea];return _0x3041a2;};'use strict';function Campaign(_0x50fe75){this['id']=_0x50fe75['id']||0x0;this[_0x3779('0x0')]=_0x50fe75['name']||'';this['type']=_0x50fe75['type']||_0x3779('0x1');this[_0x3779('0x2')]=0x0;this['temp']=0x0;this[_0x3779('0x3')]=0x0;this[_0x3779('0x4')]=0x0;this['message']='';this[_0x3779('0x5')]=!![];this[_0x3779('0x6')]=_0x50fe75['active'];this[_0x3779('0x7')]=_0x50fe75['limitCalls'];this['dialTimezone']=_0x50fe75['dialTimezone']||null;this[_0x3779('0x8')]=_0x50fe75[_0x3779('0x8')]?_0x50fe75[_0x3779('0x8')]:null;this[_0x3779('0x9')]=_0x50fe75['dialOriginateCallerIdName'];this[_0x3779('0xa')]=_0x50fe75[_0x3779('0xa')];this[_0x3779('0xb')]=_0x50fe75[_0x3779('0xb')]||0x1e;this[_0x3779('0xc')]=_0x50fe75[_0x3779('0xc')];this[_0x3779('0xd')]=_0x50fe75[_0x3779('0xd')];this['dialBusyMaxRetry']=_0x50fe75['dialBusyMaxRetry'];this[_0x3779('0xe')]=_0x50fe75[_0x3779('0xe')];this['dialNoAnswerMaxRetry']=_0x50fe75[_0x3779('0xf')];this[_0x3779('0x10')]=_0x50fe75[_0x3779('0x10')];this['dialGlobalMaxRetry']=_0x50fe75[_0x3779('0x11')];this[_0x3779('0x12')]=_0x50fe75[_0x3779('0x12')]||0x3;this[_0x3779('0x13')]=_0x50fe75[_0x3779('0x13')]||0x96;this[_0x3779('0x14')]=_0x50fe75[_0x3779('0x14')]||0x3;this[_0x3779('0x15')]=_0x50fe75['dialDropRetryFrequency']||0x96;this[_0x3779('0x16')]=_0x50fe75['dialAbandonedMaxRetry']||0x3;this[_0x3779('0x17')]=_0x50fe75[_0x3779('0x17')]||0x96;this['dialMachineMaxRetry']=_0x50fe75[_0x3779('0x18')]||0x3;this[_0x3779('0x19')]=_0x50fe75['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x50fe75['dialAgentRejectMaxRetry']||0x3;this[_0x3779('0x1a')]=_0x50fe75[_0x3779('0x1a')]||0x96;this[_0x3779('0x1b')]=_0x50fe75[_0x3779('0x1b')]||_0x3779('0x1c');this[_0x3779('0x1d')]=_0x50fe75[_0x3779('0x1d')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x50fe75['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x50fe75[_0x3779('0x1e')]||undefined;this['TrunkBackup']=_0x50fe75[_0x3779('0x1f')]?_0x50fe75['TrunkBackup']:undefined;this[_0x3779('0x20')]=_0x50fe75[_0x3779('0x20')]?_0x50fe75[_0x3779('0x20')]:undefined;this[_0x3779('0x21')]=_0x50fe75[_0x3779('0x21')]?_0x50fe75[_0x3779('0x21')]:undefined;this[_0x3779('0x22')]=_0x50fe75[_0x3779('0x22')]?_0x50fe75[_0x3779('0x22')]:undefined;this[_0x3779('0x23')]=_0x50fe75[_0x3779('0x22')]?_0x50fe75[_0x3779('0x22')]['name']:undefined;this[_0x3779('0x24')]=_0x50fe75[_0x3779('0x24')]||![];this['dialAMDInitialSilence']=_0x50fe75[_0x3779('0x25')];this[_0x3779('0x26')]=_0x50fe75[_0x3779('0x26')];this['dialAMDAfterGreetingSilence']=_0x50fe75[_0x3779('0x27')];this[_0x3779('0x28')]=_0x50fe75['dialAMDTotalAnalysisTime'];this[_0x3779('0x29')]=_0x50fe75['dialAMDMinWordLength'];this[_0x3779('0x2a')]=_0x50fe75[_0x3779('0x2a')];this['dialAMDMaximumNumberOfWords']=_0x50fe75['dialAMDMaximumNumberOfWords'];this[_0x3779('0x2b')]=_0x50fe75[_0x3779('0x2b')];this['dialAMDMaximumWordLength']=_0x50fe75[_0x3779('0x2c')];}module[_0x3779('0x2d')]=Campaign; \ No newline at end of file +var _0x146d=['SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','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'];(function(_0x10c291,_0x36b963){var _0xad8b79=function(_0x39bb00){while(--_0x39bb00){_0x10c291['push'](_0x10c291['shift']());}};_0xad8b79(++_0x36b963);}(_0x146d,0x9e));var _0xd146=function(_0x28d7ce,_0x1421e4){_0x28d7ce=_0x28d7ce-0x0;var _0x581d58=_0x146d[_0x28d7ce];return _0x581d58;};'use strict';function Campaign(_0x25f765){this['id']=_0x25f765['id']||0x0;this[_0xd146('0x0')]=_0x25f765[_0xd146('0x0')]||'';this['type']=_0x25f765['type']||_0xd146('0x1');this[_0xd146('0x2')]=0x0;this[_0xd146('0x3')]=0x0;this[_0xd146('0x4')]=0x0;this[_0xd146('0x5')]=0x0;this['message']='';this[_0xd146('0x6')]=!![];this['active']=_0x25f765[_0xd146('0x7')];this[_0xd146('0x8')]=_0x25f765[_0xd146('0x8')];this['dialTimezone']=_0x25f765['dialTimezone']||null;this[_0xd146('0x9')]=_0x25f765[_0xd146('0x9')]?_0x25f765[_0xd146('0x9')]:null;this['dialOriginateCallerIdName']=_0x25f765[_0xd146('0xa')];this[_0xd146('0xb')]=_0x25f765['dialOriginateCallerIdNumber'];this[_0xd146('0xc')]=_0x25f765[_0xd146('0xc')]||0x1e;this[_0xd146('0xd')]=_0x25f765[_0xd146('0xd')];this[_0xd146('0xe')]=_0x25f765[_0xd146('0xe')];this[_0xd146('0xf')]=_0x25f765[_0xd146('0xf')];this[_0xd146('0x10')]=_0x25f765[_0xd146('0x10')];this['dialNoAnswerMaxRetry']=_0x25f765[_0xd146('0x11')];this['dialNoAnswerRetryFrequency']=_0x25f765[_0xd146('0x12')];this['dialGlobalMaxRetry']=_0x25f765[_0xd146('0x13')];this[_0xd146('0x14')]=_0x25f765[_0xd146('0x14')]||0x3;this[_0xd146('0x15')]=_0x25f765[_0xd146('0x15')]||0x96;this[_0xd146('0x16')]=_0x25f765[_0xd146('0x16')]||0x3;this[_0xd146('0x17')]=_0x25f765[_0xd146('0x17')]||0x96;this[_0xd146('0x18')]=_0x25f765['dialAbandonedMaxRetry']||0x3;this[_0xd146('0x19')]=_0x25f765[_0xd146('0x19')]||0x96;this['dialMachineMaxRetry']=_0x25f765[_0xd146('0x1a')]||0x3;this[_0xd146('0x1b')]=_0x25f765[_0xd146('0x1b')]||0x96;this[_0xd146('0x1c')]=_0x25f765[_0xd146('0x1c')]||0x3;this[_0xd146('0x1d')]=_0x25f765[_0xd146('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x25f765[_0xd146('0x1e')]||_0xd146('0x1f');this[_0xd146('0x20')]=_0x25f765[_0xd146('0x20')]||undefined;this[_0xd146('0x21')]=_0x25f765['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xd146('0x22')]=_0x25f765[_0xd146('0x22')]||undefined;this['TrunkBackup']=_0x25f765[_0xd146('0x23')]?_0x25f765[_0xd146('0x23')]:undefined;this[_0xd146('0x24')]=_0x25f765['Trunk']?_0x25f765['Trunk']:undefined;this[_0xd146('0x25')]=_0x25f765[_0xd146('0x25')]?_0x25f765[_0xd146('0x25')]:undefined;this[_0xd146('0x26')]=_0x25f765[_0xd146('0x26')]?_0x25f765[_0xd146('0x26')]:undefined;this['dialQueueProject']=_0x25f765['SquareProject']?_0x25f765[_0xd146('0x26')][_0xd146('0x0')]:undefined;this[_0xd146('0x27')]=_0x25f765['dialAMDActive']||![];this[_0xd146('0x28')]=_0x25f765[_0xd146('0x28')];this[_0xd146('0x29')]=_0x25f765[_0xd146('0x29')];this[_0xd146('0x2a')]=_0x25f765['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x25f765['dialAMDTotalAnalysisTime'];this[_0xd146('0x2b')]=_0x25f765[_0xd146('0x2b')];this[_0xd146('0x2c')]=_0x25f765[_0xd146('0x2c')];this['dialAMDMaximumNumberOfWords']=_0x25f765[_0xd146('0x2d')];this[_0xd146('0x2e')]=_0x25f765[_0xd146('0x2e')];this[_0xd146('0x2f')]=_0x25f765[_0xd146('0x2f')];}module[_0xd146('0x30')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index bfa2166..d843d51 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 _0x236c=['monitorFilename','monitors','transfercalleridnum','transferType','mohtime','starttime','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','context','uniqueid','linkedid','exten','answered','answertime','unmanaged','abandoned','billableseconds','type','tag','disposition','monitor'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0x236c,0x155));var _0xc236=function(_0x3e53f1,_0x1c2930){_0x3e53f1=_0x3e53f1-0x0;var _0x3414fd=_0x236c[_0x3e53f1];return _0x3414fd;};'use strict';function Channel(){this[_0xc236('0x0')]=null;this['channel']='';this[_0xc236('0x1')]='';this[_0xc236('0x2')]=0x0;this[_0xc236('0x3')]='';this[_0xc236('0x4')]=undefined;this[_0xc236('0x5')]=undefined;this['accountcode']=0x0;this[_0xc236('0x6')]='';this[_0xc236('0x7')]=0x0;this[_0xc236('0x8')]=0x0;this[_0xc236('0x9')]=0x0;this[_0xc236('0xa')]=![];this[_0xc236('0xb')]=null;this['endtime']=null;this[_0xc236('0xc')]=![];this[_0xc236('0xd')]=![];this['lastapplication']='';this['lastdata']='';this['duration']=0x0;this[_0xc236('0xe')]=0x0;this['holdtime']=0x0;this[_0xc236('0xf')]=null;this[_0xc236('0x10')]=null;this[_0xc236('0x11')]=null;this[_0xc236('0x12')]=![];this[_0xc236('0x13')]=null;this['queue']=null;this[_0xc236('0x14')]=[];this[_0xc236('0x15')]=undefined;this['transferconnectedlinenum']=undefined;this[_0xc236('0x16')]=undefined;this[_0xc236('0x17')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x4816=['holdtime','tag','disposition','monitors','transfercalleridnum','mohtime','exports','channel','calleridnum','calleridname','connectedlinename','uniqueid','linkedid','answertime','endtime','abandoned','lastapplication','duration','billableseconds'];(function(_0x255209,_0x5987f7){var _0x44684a=function(_0x566f1b){while(--_0x566f1b){_0x255209['push'](_0x255209['shift']());}};_0x44684a(++_0x5987f7);}(_0x4816,0xfe));var _0x6481=function(_0x461c2c,_0x13f720){_0x461c2c=_0x461c2c-0x0;var _0x34ce82=_0x4816[_0x461c2c];return _0x34ce82;};'use strict';function Channel(){this['starttime']=null;this[_0x6481('0x0')]='';this['destinationchannel']='';this[_0x6481('0x1')]=0x0;this[_0x6481('0x2')]='';this['connectedlinenum']=undefined;this[_0x6481('0x3')]=undefined;this['accountcode']=0x0;this['context']='';this[_0x6481('0x4')]=0x0;this[_0x6481('0x5')]=0x0;this['exten']=0x0;this['answered']=![];this[_0x6481('0x6')]=null;this[_0x6481('0x7')]=null;this['unmanaged']=![];this[_0x6481('0x8')]=![];this[_0x6481('0x9')]='';this['lastdata']='';this[_0x6481('0xa')]=0x0;this[_0x6481('0xb')]=0x0;this[_0x6481('0xc')]=0x0;this['type']=null;this[_0x6481('0xd')]=null;this[_0x6481('0xe')]=null;this['monitor']=![];this['monitorFilename']=null;this['queue']=null;this[_0x6481('0xf')]=[];this[_0x6481('0x10')]=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this[_0x6481('0x11')]=0x0;}module[_0x6481('0x12')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 90c72ee..2a4a715 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 _0x169e=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','serverUrl','Configurations','exports','name','username'];(function(_0x2f56de,_0x54858c){var _0x1b5072=function(_0x4a1e07){while(--_0x4a1e07){_0x2f56de['push'](_0x2f56de['shift']());}};_0x1b5072(++_0x54858c);}(_0x169e,0xa6));var _0xe169=function(_0xe466a1,_0x5766a2){_0xe466a1=_0xe466a1-0x0;var _0x2a3d2d=_0x169e[_0xe466a1];return _0x2a3d2d;};'use strict';function DeskAccount(_0x23dcf7){this['id']=_0x23dcf7['id']||0x0;this[_0xe169('0x0')]=_0x23dcf7[_0xe169('0x0')]||'';this['username']=_0x23dcf7[_0xe169('0x1')]||'';this[_0xe169('0x2')]=_0x23dcf7['remoteUri']||'';this['authType']=_0x23dcf7[_0xe169('0x3')]||'';this[_0xe169('0x4')]=_0x23dcf7[_0xe169('0x4')]||'';this[_0xe169('0x5')]=_0x23dcf7['consumerKey']||'';this[_0xe169('0x6')]=_0x23dcf7['consumerSecret']||'';this['token']=_0x23dcf7[_0xe169('0x7')]||'';this[_0xe169('0x8')]=_0x23dcf7[_0xe169('0x8')]||'';this['type']=_0x23dcf7['type']||'';this[_0xe169('0x9')]=_0x23dcf7[_0xe169('0x9')]||'';this[_0xe169('0xa')]=_0x23dcf7[_0xe169('0xa')]||{};}module[_0xe169('0xb')]=DeskAccount; \ No newline at end of file +var _0x04ca=['authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x04ca,0x1eb));var _0xa04c=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x04ca[_0x19950b];return _0x3c6b41;};'use strict';function DeskAccount(_0x5207fb){this['id']=_0x5207fb['id']||0x0;this['name']=_0x5207fb[_0xa04c('0x0')]||'';this[_0xa04c('0x1')]=_0x5207fb[_0xa04c('0x1')]||'';this['remoteUri']=_0x5207fb[_0xa04c('0x2')]||'';this[_0xa04c('0x3')]=_0x5207fb[_0xa04c('0x3')]||'';this[_0xa04c('0x4')]=_0x5207fb['password']||'';this[_0xa04c('0x5')]=_0x5207fb[_0xa04c('0x5')]||'';this['consumerSecret']=_0x5207fb[_0xa04c('0x6')]||'';this[_0xa04c('0x7')]=_0x5207fb[_0xa04c('0x7')]||'';this[_0xa04c('0x8')]=_0x5207fb[_0xa04c('0x8')]||'';this['type']=_0x5207fb[_0xa04c('0x9')]||'';this['serverUrl']=_0x5207fb[_0xa04c('0xa')]||'';this[_0xa04c('0xb')]=_0x5207fb[_0xa04c('0xb')]||{};}module[_0xa04c('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 806b5cc..3251c81 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 _0x5d1f=['modernAuthentication','Configurations','CloudProvider','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0xdca4a6,_0x4965f6){var _0x5c5b95=function(_0x2c8fe7){while(--_0x2c8fe7){_0xdca4a6['push'](_0xdca4a6['shift']());}};_0x5c5b95(++_0x4965f6);}(_0x5d1f,0x1a5));var _0xf5d1=function(_0x2e9005,_0xbde42b){_0x2e9005=_0x2e9005-0x0;var _0x2a1678=_0x5d1f[_0x2e9005];return _0x2a1678;};'use strict';function Dynamics365Account(_0x4b6d29){this['id']=_0x4b6d29['id']||0x0;this['name']=_0x4b6d29[_0xf5d1('0x0')]||'';this[_0xf5d1('0x1')]=_0x4b6d29[_0xf5d1('0x1')]||'';this[_0xf5d1('0x2')]=_0x4b6d29[_0xf5d1('0x2')]||'';this[_0xf5d1('0x3')]=_0x4b6d29[_0xf5d1('0x3')]||'';this[_0xf5d1('0x4')]=_0x4b6d29[_0xf5d1('0x4')]||'';this[_0xf5d1('0x5')]=_0x4b6d29[_0xf5d1('0x5')]||'';this[_0xf5d1('0x6')]=_0x4b6d29['clientSecret']||{};this['serverUrl']=_0x4b6d29[_0xf5d1('0x7')]||'';this[_0xf5d1('0x8')]=_0x4b6d29[_0xf5d1('0x8')]||![];this[_0xf5d1('0x9')]=_0x4b6d29['Configurations']||{};this['CloudProvider']=_0x4b6d29[_0xf5d1('0xa')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0xf3c1=['CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations'];(function(_0x4dd549,_0x5e7648){var _0xd66329=function(_0x24e4ed){while(--_0x24e4ed){_0x4dd549['push'](_0x4dd549['shift']());}};_0xd66329(++_0x5e7648);}(_0xf3c1,0x176));var _0x1f3c=function(_0x505eae,_0x127237){_0x505eae=_0x505eae-0x0;var _0x2f097a=_0xf3c1[_0x505eae];return _0x2f097a;};'use strict';function Dynamics365Account(_0x3a11e6){this['id']=_0x3a11e6['id']||0x0;this[_0x1f3c('0x0')]=_0x3a11e6[_0x1f3c('0x0')]||'';this[_0x1f3c('0x1')]=_0x3a11e6['username']||'';this['password']=_0x3a11e6[_0x1f3c('0x2')]||'';this[_0x1f3c('0x3')]=_0x3a11e6[_0x1f3c('0x3')]||'';this['tenantId']=_0x3a11e6[_0x1f3c('0x4')]||'';this['clientId']=_0x3a11e6[_0x1f3c('0x5')]||'';this[_0x1f3c('0x6')]=_0x3a11e6[_0x1f3c('0x6')]||{};this[_0x1f3c('0x7')]=_0x3a11e6[_0x1f3c('0x7')]||'';this[_0x1f3c('0x8')]=_0x3a11e6[_0x1f3c('0x8')]||![];this[_0x1f3c('0x9')]=_0x3a11e6[_0x1f3c('0x9')]||{};this[_0x1f3c('0xa')]=_0x3a11e6['CloudProvider']||{};}module[_0x1f3c('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index f4e3236..deb8e8d 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 _0x702c=['maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','ecm','headerinfo','localstationid','minrate'];(function(_0x92d4eb,_0x40b48c){var _0x28f8a8=function(_0x1988ba){while(--_0x1988ba){_0x92d4eb['push'](_0x92d4eb['shift']());}};_0x28f8a8(++_0x40b48c);}(_0x702c,0x7b));var _0xc702=function(_0x5412ee,_0x3acdf5){_0x5412ee=_0x5412ee-0x0;var _0x3f224d=_0x702c[_0x5412ee];return _0x3f224d;};'use strict';function FaxAccount(_0x53e4de){this['id']=_0x53e4de['id']||0x0;this[_0xc702('0x0')]=_0x53e4de[_0xc702('0x0')]||'';this['description']=_0x53e4de['description'];this[_0xc702('0x1')]=_0x53e4de[_0xc702('0x1')];this[_0xc702('0x2')]=_0x53e4de[_0xc702('0x2')];this[_0xc702('0x3')]=_0x53e4de[_0xc702('0x3')];this[_0xc702('0x4')]=_0x53e4de['minrate']||0x960;this['maxrate']=_0x53e4de[_0xc702('0x5')]||0x3840;this[_0xc702('0x6')]=_0x53e4de[_0xc702('0x6')]||'v17,v27,v29';this['gateway']=_0x53e4de[_0xc702('0x7')]||'no';this['faxdetect']=_0x53e4de[_0xc702('0x8')]||'no';this[_0xc702('0x9')]=_0x53e4de[_0xc702('0x9')]||0x1388;this[_0xc702('0xa')]=_0x53e4de['tech']||_0xc702('0xb');this[_0xc702('0xc')]=_0x53e4de[_0xc702('0xc')]?_0x53e4de['Trunk']:undefined;this[_0xc702('0xd')]=_0x53e4de[_0xc702('0xd')];this[_0xc702('0xe')]=_0x53e4de[_0xc702('0xe')];}module[_0xc702('0xf')]=FaxAccount; \ No newline at end of file +var _0xe877=['key','exports','name','description','ecm','headerinfo','localstationid','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId'];(function(_0x561771,_0x554760){var _0x54d16e=function(_0x381c1f){while(--_0x381c1f){_0x561771['push'](_0x561771['shift']());}};_0x54d16e(++_0x554760);}(_0xe877,0xdf));var _0x7e87=function(_0x4df4c2,_0x55baef){_0x4df4c2=_0x4df4c2-0x0;var _0x1ef51b=_0xe877[_0x4df4c2];return _0x1ef51b;};'use strict';function FaxAccount(_0x46b62d){this['id']=_0x46b62d['id']||0x0;this[_0x7e87('0x0')]=_0x46b62d[_0x7e87('0x0')]||'';this[_0x7e87('0x1')]=_0x46b62d['description'];this[_0x7e87('0x2')]=_0x46b62d[_0x7e87('0x2')];this[_0x7e87('0x3')]=_0x46b62d['headerinfo'];this[_0x7e87('0x4')]=_0x46b62d[_0x7e87('0x4')];this['minrate']=_0x46b62d['minrate']||0x960;this[_0x7e87('0x5')]=_0x46b62d[_0x7e87('0x5')]||0x3840;this[_0x7e87('0x6')]=_0x46b62d[_0x7e87('0x6')]||_0x7e87('0x7');this[_0x7e87('0x8')]=_0x46b62d[_0x7e87('0x8')]||'no';this[_0x7e87('0x9')]=_0x46b62d[_0x7e87('0x9')]||'no';this[_0x7e87('0xa')]=_0x46b62d[_0x7e87('0xa')]||0x1388;this[_0x7e87('0xb')]=_0x46b62d[_0x7e87('0xb')]||_0x7e87('0xc');this[_0x7e87('0xd')]=_0x46b62d[_0x7e87('0xd')]?_0x46b62d['Trunk']:undefined;this['ListId']=_0x46b62d[_0x7e87('0xe')];this[_0x7e87('0xf')]=_0x46b62d[_0x7e87('0xf')];}module[_0x7e87('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index cd4cd36..8c308f8 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 _0x47ae=['apiKey','token','remoteUri','serverUrl','Configurations','name','username'];(function(_0x1e9e15,_0x30d00f){var _0x421de9=function(_0x1c44e3){while(--_0x1c44e3){_0x1e9e15['push'](_0x1e9e15['shift']());}};_0x421de9(++_0x30d00f);}(_0x47ae,0x1e8));var _0xe47a=function(_0x45313f,_0x46caf4){_0x45313f=_0x45313f-0x0;var _0x402910=_0x47ae[_0x45313f];return _0x402910;};'use strict';function FreshdeskAccount(_0x53d67f){this['id']=_0x53d67f['id']||0x0;this[_0xe47a('0x0')]=_0x53d67f[_0xe47a('0x0')]||'';this[_0xe47a('0x1')]=_0x53d67f[_0xe47a('0x1')]||'';this[_0xe47a('0x2')]=_0x53d67f[_0xe47a('0x3')]||'';this[_0xe47a('0x4')]=_0x53d67f['remoteUri']||'';this[_0xe47a('0x5')]=_0x53d67f[_0xe47a('0x5')]||'';this[_0xe47a('0x6')]=_0x53d67f[_0xe47a('0x6')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0xcc4c=['exports','name','username','remoteUri','serverUrl','Configurations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc4c,0x1db));var _0xccc4=function(_0x151745,_0x37a869){_0x151745=_0x151745-0x0;var _0x36a39b=_0xcc4c[_0x151745];return _0x36a39b;};'use strict';function FreshdeskAccount(_0x5c3d74){this['id']=_0x5c3d74['id']||0x0;this[_0xccc4('0x0')]=_0x5c3d74['name']||'';this[_0xccc4('0x1')]=_0x5c3d74[_0xccc4('0x1')]||'';this['apiKey']=_0x5c3d74['token']||'';this[_0xccc4('0x2')]=_0x5c3d74[_0xccc4('0x2')]||'';this[_0xccc4('0x3')]=_0x5c3d74[_0xccc4('0x3')]||'';this['Configurations']=_0x5c3d74[_0xccc4('0x4')]||{};}module[_0xccc4('0x5')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index c9738b2..8408807 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 _0xae1c=['serverUrl','Configurations','exports','username','apiKey','token','remoteUri'];(function(_0x14294f,_0xb24527){var _0x1d4d6f=function(_0x540e98){while(--_0x540e98){_0x14294f['push'](_0x14294f['shift']());}};_0x1d4d6f(++_0xb24527);}(_0xae1c,0xff));var _0xcae1=function(_0x5f580f,_0x1f1f08){_0x5f580f=_0x5f580f-0x0;var _0x299371=_0xae1c[_0x5f580f];return _0x299371;};'use strict';function FreshsalesAccount(_0x16ae91){this['id']=_0x16ae91['id']||0x0;this['name']=_0x16ae91['name']||'';this['username']=_0x16ae91[_0xcae1('0x0')]||'';this[_0xcae1('0x1')]=_0x16ae91[_0xcae1('0x2')]||'';this[_0xcae1('0x3')]=_0x16ae91[_0xcae1('0x3')]||'';this[_0xcae1('0x4')]=_0x16ae91[_0xcae1('0x4')]||'';this[_0xcae1('0x5')]=_0x16ae91[_0xcae1('0x5')]||{};}module[_0xcae1('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x7579=['username','apiKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0xc0021a,_0x121ca4){var _0x5b84c9=function(_0x5a96ff){while(--_0x5a96ff){_0xc0021a['push'](_0xc0021a['shift']());}};_0x5b84c9(++_0x121ca4);}(_0x7579,0x1e2));var _0x9757=function(_0x252bbd,_0x344ece){_0x252bbd=_0x252bbd-0x0;var _0x502cf1=_0x7579[_0x252bbd];return _0x502cf1;};'use strict';function FreshsalesAccount(_0x362458){this['id']=_0x362458['id']||0x0;this[_0x9757('0x0')]=_0x362458[_0x9757('0x0')]||'';this[_0x9757('0x1')]=_0x362458[_0x9757('0x1')]||'';this[_0x9757('0x2')]=_0x362458['token']||'';this[_0x9757('0x3')]=_0x362458[_0x9757('0x3')]||'';this[_0x9757('0x4')]=_0x362458[_0x9757('0x4')]||'';this['Configurations']=_0x362458[_0x9757('0x5')]||{};}module[_0x9757('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 1b6f41f..d3e4c64 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 _0x3ec1=['originalposition','connectedlinenum','context','exten','assigned','lastAssignedTo','motionChannel','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit'];(function(_0x30126c,_0x43a5a3){var _0x184d7f=function(_0x34f445){while(--_0x34f445){_0x30126c['push'](_0x30126c['shift']());}};_0x184d7f(++_0x43a5a3);}(_0x3ec1,0xf8));var _0x13ec=function(_0x5d164e,_0x1014de){_0x5d164e=_0x5d164e-0x0;var _0x3f12c6=_0x3ec1[_0x5d164e];return _0x3f12c6;};'use strict';function QueueReport(){this[_0x13ec('0x0')]=_0x13ec('0x1');this[_0x13ec('0x2')]='';this[_0x13ec('0x3')]='';this[_0x13ec('0x4')]='';this[_0x13ec('0x5')]='';this[_0x13ec('0x6')]=null;this[_0x13ec('0x7')]=null;this['position']=0x1;this[_0x13ec('0x8')]=0x1;this['queuecallerabandon']=![];this[_0x13ec('0x9')]=null;this['queuecallercomplete']=![];this[_0x13ec('0xa')]=null;this[_0x13ec('0xb')]=![];this['queuecallerexitAt']=null;this[_0x13ec('0xc')]=0x1;this['channel']='';this[_0x13ec('0xd')]='';this['connectedlinename']='';this['accountcode']='';this[_0x13ec('0xe')]='';this[_0x13ec('0xf')]='';this['priority']='';this['holdtime']=0x0;this[_0x13ec('0x10')]=![];this[_0x13ec('0x11')]='';this[_0x13ec('0x12')]='voice';this['routealias']=null;this['mohtime']=0x0;this['variables']={};}module[_0x13ec('0x13')]=QueueReport; \ No newline at end of file +var _0x9d56=['queuecallerabandonAt','queuecallercomplete','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','assigned','lastAssignedTo','motionChannel','voice','routealias','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x9d56,0x152));var _0x69d5=function(_0x38716a,_0x4336d9){_0x38716a=_0x38716a-0x0;var _0x133e75=_0x9d56[_0x38716a];return _0x133e75;};'use strict';function QueueReport(){this[_0x69d5('0x0')]=_0x69d5('0x1');this[_0x69d5('0x2')]='';this[_0x69d5('0x3')]='';this[_0x69d5('0x4')]='';this[_0x69d5('0x5')]='';this[_0x69d5('0x6')]=null;this[_0x69d5('0x7')]=null;this[_0x69d5('0x8')]=0x1;this['count']=0x1;this[_0x69d5('0x9')]=![];this[_0x69d5('0xa')]=null;this[_0x69d5('0xb')]=![];this['queuecallercompleteAt']=null;this['queuecallerexit']=![];this[_0x69d5('0xc')]=null;this[_0x69d5('0xd')]=0x1;this[_0x69d5('0xe')]='';this[_0x69d5('0xf')]='';this[_0x69d5('0x10')]='';this[_0x69d5('0x11')]='';this[_0x69d5('0x12')]='';this[_0x69d5('0x13')]='';this[_0x69d5('0x14')]='';this['holdtime']=0x0;this[_0x69d5('0x15')]=![];this[_0x69d5('0x16')]='';this[_0x69d5('0x17')]=_0x69d5('0x18');this[_0x69d5('0x19')]=null;this[_0x69d5('0x1a')]=0x0;this[_0x69d5('0x1b')]={};}module[_0x69d5('0x1c')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 86cd117..3a10e4d 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 _0x0227=['integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x0227,0xa0));var _0x7022=function(_0x264289,_0x280f42){_0x264289=_0x264289-0x0;var _0x1d40b9=_0x0227[_0x264289];return _0x1d40b9;};'use strict';function SalesforceAccount(_0x393b9c){this['id']=_0x393b9c['id']||0x0;this[_0x7022('0x0')]=_0x393b9c[_0x7022('0x0')]||'';this[_0x7022('0x1')]=_0x393b9c['username']||'';this[_0x7022('0x2')]=_0x393b9c[_0x7022('0x2')]||'';this[_0x7022('0x3')]=_0x393b9c[_0x7022('0x3')]||'';this['clientId']=_0x393b9c[_0x7022('0x4')]||'';this['clientSecret']=_0x393b9c[_0x7022('0x5')]||'';this[_0x7022('0x6')]=_0x393b9c['securityToken']||'';this['type']=_0x393b9c[_0x7022('0x7')]||_0x7022('0x8');this[_0x7022('0x9')]=_0x393b9c[_0x7022('0x9')]||'';this['Configurations']=_0x393b9c[_0x7022('0xa')]||{};}module[_0x7022('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x2ec4=['integrationTab','serverUrl','Configurations','name','remoteUri','password','clientId','clientSecret','securityToken','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2ec4,0x111));var _0x42ec=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x2ec4[_0x8de54f];return _0x14cba4;};'use strict';function SalesforceAccount(_0x1a20dd){this['id']=_0x1a20dd['id']||0x0;this[_0x42ec('0x0')]=_0x1a20dd[_0x42ec('0x0')]||'';this['username']=_0x1a20dd['username']||'';this[_0x42ec('0x1')]=_0x1a20dd[_0x42ec('0x1')]||'';this[_0x42ec('0x2')]=_0x1a20dd[_0x42ec('0x2')]||'';this[_0x42ec('0x3')]=_0x1a20dd[_0x42ec('0x3')]||'';this[_0x42ec('0x4')]=_0x1a20dd['clientSecret']||'';this[_0x42ec('0x5')]=_0x1a20dd[_0x42ec('0x5')]||'';this['type']=_0x1a20dd[_0x42ec('0x6')]||_0x42ec('0x7');this[_0x42ec('0x8')]=_0x1a20dd[_0x42ec('0x8')]||'';this[_0x42ec('0x9')]=_0x1a20dd[_0x42ec('0x9')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 7f07a0a..7b04ad1 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 _0xe181=['Configurations','username','password','remoteUri','serverUrl'];(function(_0x1c20d2,_0x1dbc59){var _0x334bdf=function(_0x50fae7){while(--_0x50fae7){_0x1c20d2['push'](_0x1c20d2['shift']());}};_0x334bdf(++_0x1dbc59);}(_0xe181,0x9c));var _0x1e18=function(_0x19d350,_0x3c843f){_0x19d350=_0x19d350-0x0;var _0x3bfc8d=_0xe181[_0x19d350];return _0x3bfc8d;};'use strict';function ServicenowAccount(_0x4a968d){this['id']=_0x4a968d['id']||0x0;this['name']=_0x4a968d['name']||'';this[_0x1e18('0x0')]=_0x4a968d['username']||'';this[_0x1e18('0x1')]=_0x4a968d[_0x1e18('0x1')]||'';this[_0x1e18('0x2')]=_0x4a968d['remoteUri']||'';this[_0x1e18('0x3')]=_0x4a968d[_0x1e18('0x3')]||'';this[_0x1e18('0x4')]=_0x4a968d[_0x1e18('0x4')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x7ee7=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0x1a629d,_0x4f1db4){var _0x402082=function(_0xd57095){while(--_0xd57095){_0x1a629d['push'](_0x1a629d['shift']());}};_0x402082(++_0x4f1db4);}(_0x7ee7,0x91));var _0x77ee=function(_0x384ca3,_0x8ac31b){_0x384ca3=_0x384ca3-0x0;var _0x514a35=_0x7ee7[_0x384ca3];return _0x514a35;};'use strict';function ServicenowAccount(_0x385da3){this['id']=_0x385da3['id']||0x0;this[_0x77ee('0x0')]=_0x385da3[_0x77ee('0x0')]||'';this['username']=_0x385da3[_0x77ee('0x1')]||'';this[_0x77ee('0x2')]=_0x385da3[_0x77ee('0x2')]||'';this[_0x77ee('0x3')]=_0x385da3[_0x77ee('0x3')]||'';this[_0x77ee('0x4')]=_0x385da3['serverUrl']||'';this[_0x77ee('0x5')]=_0x385da3[_0x77ee('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 911cbc8..ef9abf9 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 _0xdfbc=['name','username','password','remoteUri','serverUrl'];(function(_0x2f3570,_0x14fcab){var _0xa87edc=function(_0x403059){while(--_0x403059){_0x2f3570['push'](_0x2f3570['shift']());}};_0xa87edc(++_0x14fcab);}(_0xdfbc,0x69));var _0xcdfb=function(_0x516a8e,_0x4ca982){_0x516a8e=_0x516a8e-0x0;var _0x5361c5=_0xdfbc[_0x516a8e];return _0x5361c5;};'use strict';function SugarcrmAccount(_0x3cdc1b){this['id']=_0x3cdc1b['id']||0x0;this[_0xcdfb('0x0')]=_0x3cdc1b['name']||'';this['username']=_0x3cdc1b[_0xcdfb('0x1')]||'';this[_0xcdfb('0x2')]=_0x3cdc1b[_0xcdfb('0x2')]||'';this[_0xcdfb('0x3')]=_0x3cdc1b[_0xcdfb('0x3')]||'';this[_0xcdfb('0x4')]=_0x3cdc1b[_0xcdfb('0x4')]||'';this['Configurations']=_0x3cdc1b['Configurations']||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x8319=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0x4289ed,_0x2c7b8f){var _0x2f5317=function(_0x2f6a2f){while(--_0x2f6a2f){_0x4289ed['push'](_0x4289ed['shift']());}};_0x2f5317(++_0x2c7b8f);}(_0x8319,0x103));var _0x9831=function(_0x2f573d,_0xc9a924){_0x2f573d=_0x2f573d-0x0;var _0x5e0496=_0x8319[_0x2f573d];return _0x5e0496;};'use strict';function SugarcrmAccount(_0x2afcbc){this['id']=_0x2afcbc['id']||0x0;this[_0x9831('0x0')]=_0x2afcbc[_0x9831('0x0')]||'';this[_0x9831('0x1')]=_0x2afcbc[_0x9831('0x1')]||'';this[_0x9831('0x2')]=_0x2afcbc[_0x9831('0x2')]||'';this['remoteUri']=_0x2afcbc[_0x9831('0x3')]||'';this[_0x9831('0x4')]=_0x2afcbc[_0x9831('0x4')]||'';this[_0x9831('0x5')]=_0x2afcbc['Configurations']||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index aabde20..4abb9f9 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 _0x55f4=['unknown','address','exports','name','accountcode','state'];(function(_0x2170a6,_0x535ba9){var _0x3ff8e0=function(_0x1d54f2){while(--_0x1d54f2){_0x2170a6['push'](_0x2170a6['shift']());}};_0x3ff8e0(++_0x535ba9);}(_0x55f4,0x129));var _0x455f=function(_0x12c8bd,_0x2110d0){_0x12c8bd=_0x12c8bd-0x0;var _0x2d5faf=_0x55f4[_0x12c8bd];return _0x2d5faf;};'use strict';function Telephone(_0x242dc3){this['id']=_0x242dc3['id']||0x0;this[_0x455f('0x0')]=_0x242dc3[_0x455f('0x0')]||'';this[_0x455f('0x1')]=_0x242dc3['accountcode']||'';this[_0x455f('0x2')]=_0x455f('0x3');this['stateTime']=0x0;this['status']='unknown';this[_0x455f('0x4')]='';}module[_0x455f('0x5')]=Telephone; \ No newline at end of file +var _0xa5dd=['state','unknown','stateTime','address','exports','accountcode'];(function(_0x3f6426,_0x12cbf9){var _0x25d790=function(_0x3c6756){while(--_0x3c6756){_0x3f6426['push'](_0x3f6426['shift']());}};_0x25d790(++_0x12cbf9);}(_0xa5dd,0x101));var _0xda5d=function(_0xcbb184,_0x3e7308){_0xcbb184=_0xcbb184-0x0;var _0x257bda=_0xa5dd[_0xcbb184];return _0x257bda;};'use strict';function Telephone(_0x5cf5a0){this['id']=_0x5cf5a0['id']||0x0;this['name']=_0x5cf5a0['name']||'';this[_0xda5d('0x0')]=_0x5cf5a0[_0xda5d('0x0')]||'';this[_0xda5d('0x1')]=_0xda5d('0x2');this[_0xda5d('0x3')]=0x0;this['status']=_0xda5d('0x2');this[_0xda5d('0x4')]='';}module[_0xda5d('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 154bd68..d38100b 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(_0x41b0a9,_0x256413){var _0x1274da=function(_0x507a15){while(--_0x507a15){_0x41b0a9['push'](_0x41b0a9['shift']());}};_0x1274da(++_0x256413);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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(_0x479568,_0x5dd080){var _0x2bdbf1=function(_0x2eae1c){while(--_0x2eae1c){_0x479568['push'](_0x479568['shift']());}};_0x2bdbf1(++_0x5dd080);}(_0xb10b,0x12a));var _0xbb10=function(_0x687ce7,_0x39db4f){_0x687ce7=_0x687ce7-0x0;var _0x8bb835=_0xb10b[_0x687ce7];return _0x8bb835;};'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 d3f9880..dce8f40 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 _0x2032=['exports','name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x353a27,_0x5baee6){var _0x538430=function(_0x49e48d){while(--_0x49e48d){_0x353a27['push'](_0x353a27['shift']());}};_0x538430(++_0x5baee6);}(_0x2032,0xd9));var _0x2203=function(_0x21ab28,_0x6fb7d){_0x21ab28=_0x21ab28-0x0;var _0x497f74=_0x2032[_0x21ab28];return _0x497f74;};'use strict';function Trigger(_0x4d6c97){this['id']=_0x4d6c97['id']||0x0;this[_0x2203('0x0')]=_0x4d6c97[_0x2203('0x0')]||'';this[_0x2203('0x1')]=_0x4d6c97['channel']||_0x2203('0x2');this[_0x2203('0x3')]=_0x4d6c97['status']||![];this[_0x2203('0x4')]=_0x4d6c97[_0x2203('0x4')]||[];this[_0x2203('0x5')]=_0x4d6c97[_0x2203('0x5')]||[];this[_0x2203('0x6')]=_0x4d6c97[_0x2203('0x6')]||[];}module[_0x2203('0x7')]=Trigger; \ No newline at end of file +var _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x4beadf,_0x5ad131){var _0xf24c49=function(_0x5d54aa){while(--_0x5d54aa){_0x4beadf['push'](_0x4beadf['shift']());}};_0xf24c49(++_0x5ad131);}(_0x8603,0x190));var _0x3860=function(_0x3a2bb8,_0x24f840){_0x3a2bb8=_0x3a2bb8-0x0;var _0x228d25=_0x8603[_0x3a2bb8];return _0x228d25;};'use strict';function Trigger(_0xba4b79){this['id']=_0xba4b79['id']||0x0;this[_0x3860('0x0')]=_0xba4b79[_0x3860('0x0')]||'';this[_0x3860('0x1')]=_0xba4b79['channel']||'voice';this[_0x3860('0x2')]=_0xba4b79[_0x3860('0x2')]||![];this[_0x3860('0x3')]=_0xba4b79['AllConditions']||[];this[_0x3860('0x4')]=_0xba4b79['AnyConditions']||[];this[_0x3860('0x5')]=_0xba4b79[_0x3860('0x5')]||[];}module[_0x3860('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 67a3937..ea74e8d 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 _0x23fd=['unknown','stateTime','status','registry','indexOf','split','port','domain','domainport','refresh','address','defaultuser','exports','active','name'];(function(_0x3cb3ca,_0x44d697){var _0x214366=function(_0x6b38e1){while(--_0x6b38e1){_0x3cb3ca['push'](_0x3cb3ca['shift']());}};_0x214366(++_0x44d697);}(_0x23fd,0x1b1));var _0xd23f=function(_0x4216b9,_0x20d8f3){_0x4216b9=_0x4216b9-0x0;var _0x74083a=_0x23fd[_0x4216b9];return _0x74083a;};'use strict';function Trunk(_0x1ba4da){this['id']=_0x1ba4da['id']||0x0;this[_0xd23f('0x0')]=_0x1ba4da[_0xd23f('0x0')]||![];this[_0xd23f('0x1')]=_0x1ba4da[_0xd23f('0x1')]||'';this['state']=_0xd23f('0x2');this[_0xd23f('0x3')]=0x0;this[_0xd23f('0x4')]=_0xd23f('0x2');this[_0xd23f('0x5')]=_0x1ba4da['registry']&&_0x1ba4da['registry'][_0xd23f('0x6')](':')?_0x1ba4da[_0xd23f('0x5')][_0xd23f('0x7')](':')[0x0]:'';this['host']='';this[_0xd23f('0x8')]='';this[_0xd23f('0x9')]='';this[_0xd23f('0xa')]='';this[_0xd23f('0xb')]='';this['stateRegistry']='unknown';this['registrationtime']='';this[_0xd23f('0xc')]='';this[_0xd23f('0xd')]=_0x1ba4da['defaultuser']||'';}module[_0xd23f('0xe')]=Trunk; \ No newline at end of file +var _0x3ae0=['domain','refresh','stateRegistry','address','defaultuser','exports','active','name','stateTime','status','unknown','registry','indexOf','split','host','port'];(function(_0x8d823c,_0x4dfa8e){var _0x1399a6=function(_0x85d55e){while(--_0x85d55e){_0x8d823c['push'](_0x8d823c['shift']());}};_0x1399a6(++_0x4dfa8e);}(_0x3ae0,0xb6));var _0x03ae=function(_0x345209,_0x45773e){_0x345209=_0x345209-0x0;var _0x152e00=_0x3ae0[_0x345209];return _0x152e00;};'use strict';function Trunk(_0x3c318d){this['id']=_0x3c318d['id']||0x0;this[_0x03ae('0x0')]=_0x3c318d['active']||![];this['name']=_0x3c318d[_0x03ae('0x1')]||'';this['state']='unknown';this[_0x03ae('0x2')]=0x0;this[_0x03ae('0x3')]=_0x03ae('0x4');this[_0x03ae('0x5')]=_0x3c318d['registry']&&_0x3c318d[_0x03ae('0x5')][_0x03ae('0x6')](':')?_0x3c318d[_0x03ae('0x5')][_0x03ae('0x7')](':')[0x0]:'';this[_0x03ae('0x8')]='';this[_0x03ae('0x9')]='';this[_0x03ae('0xa')]='';this['domainport']='';this[_0x03ae('0xb')]='';this[_0x03ae('0xc')]=_0x03ae('0x4');this['registrationtime']='';this[_0x03ae('0xd')]='';this[_0x03ae('0xe')]=_0x3c318d[_0x03ae('0xe')]||'';}module[_0x03ae('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index ad6e46f..5dfb60d 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 _0x64b3=['exten','recordingFormat','mandatoryDisposition','exports'];(function(_0xc2343c,_0x2c3d6b){var _0x549070=function(_0xa8be64){while(--_0xa8be64){_0xc2343c['push'](_0xc2343c['shift']());}};_0x549070(++_0x2c3d6b);}(_0x64b3,0x134));var _0x364b=function(_0x4ad8cb,_0x2ad69a){_0x4ad8cb=_0x4ad8cb-0x0;var _0x5c735c=_0x64b3[_0x4ad8cb];return _0x5c735c;};'use strict';function voiceExtension(_0x3a5e7b){this['id']=_0x3a5e7b['id']||0x0;this[_0x364b('0x0')]=_0x3a5e7b['exten']||'';this[_0x364b('0x1')]=_0x3a5e7b[_0x364b('0x1')]||'none';this['mandatoryDisposition']=_0x3a5e7b[_0x364b('0x2')]||![];}module[_0x364b('0x3')]=voiceExtension; \ No newline at end of file +var _0x4637=['exports','exten','recordingFormat','mandatoryDisposition'];(function(_0x52d7fc,_0x5d5e5a){var _0x1a5f17=function(_0xd2821){while(--_0xd2821){_0x52d7fc['push'](_0x52d7fc['shift']());}};_0x1a5f17(++_0x5d5e5a);}(_0x4637,0x7d));var _0x7463=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x4637[_0x4baae2];return _0x1a2285;};'use strict';function voiceExtension(_0x454d74){this['id']=_0x454d74['id']||0x0;this[_0x7463('0x0')]=_0x454d74['exten']||'';this['recordingFormat']=_0x454d74[_0x7463('0x1')]||'none';this[_0x7463('0x2')]=_0x454d74['mandatoryDisposition']||![];}module[_0x7463('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 482ab4a..f16e497 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 _0xb182=['handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav49','gsm','fewestcalls','random','ringall','roundrobin','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','loggedIn','notInUse','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startPredictive'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xb182,0x121));var _0x2b18=function(_0x502953,_0x28de83){_0x502953=_0x502953-0x0;var _0x2fa32d=_0xb182[_0x502953];return _0x2fa32d;};'use strict';var monitorFormat={'wav':'wav','wav49':_0x2b18('0x0'),'gsm':_0x2b18('0x1')};var strategy={'fewestcalls':_0x2b18('0x2'),'leastrecent':'leastrecent','linear':'linear','random':_0x2b18('0x3'),'ringall':_0x2b18('0x4'),'rr':_0x2b18('0x5'),'rrmemory':'rrmemory','rrordered':_0x2b18('0x6'),'wrandom':_0x2b18('0x7')};function VoiceQueue(_0x22eae8){this['id']=_0x22eae8['id']||0x0;this[_0x2b18('0x8')]=_0x22eae8[_0x2b18('0x8')]||'';this[_0x2b18('0x9')]=_0x22eae8[_0x2b18('0x9')]||'';this['type']=_0x22eae8[_0x2b18('0xa')]||_0x2b18('0xb');this[_0x2b18('0xc')]=0x0;this[_0x2b18('0xd')]=0x0;this[_0x2b18('0xe')]=0x0;this[_0x2b18('0xf')]=0x0;this[_0x2b18('0x10')]=0x0;this[_0x2b18('0x11')]=0x0;this[_0x2b18('0x12')]=0x0;this[_0x2b18('0x13')]=0x0;this[_0x2b18('0x14')]=0x0;this[_0x2b18('0x15')]=0x0;this[_0x2b18('0x16')]=0x0;this['invalid']=0x0;this[_0x2b18('0x17')]=0x0;this[_0x2b18('0x18')]=0x0;this['onHold']=0x0;this['paused']=0x0;this[_0x2b18('0x19')]=0x0;this[_0x2b18('0x1a')]=0x0;this[_0x2b18('0x1b')]=0x0;this[_0x2b18('0x1c')]=0x0;this[_0x2b18('0x1d')]=0x0;this[_0x2b18('0x1e')]=_0x22eae8[_0x2b18('0x1e')]||![];this[_0x2b18('0x1f')]=_0x22eae8['acwTimeout']||0xa;this[_0x2b18('0x20')]=_0x22eae8[_0x2b18('0x20')]||'no';this[_0x2b18('0x21')]=!![];this['message']='';this[_0x2b18('0x22')]='';this['originated']=0x0;this['temp']=0x0;this['dialTimezone']=_0x22eae8[_0x2b18('0x23')]||null;this[_0x2b18('0x24')]=_0x22eae8[_0x2b18('0x24')]?_0x22eae8[_0x2b18('0x24')]:null;this[_0x2b18('0x25')]=_0x22eae8[_0x2b18('0x25')];this[_0x2b18('0x26')]=_0x22eae8['dialMethod']||_0x2b18('0x27');this[_0x2b18('0x28')]=_0x22eae8['dialLimitChannel']||0x0;this['dialLimitQueue']=_0x22eae8[_0x2b18('0x29')]||0x0;this[_0x2b18('0x2a')]=_0x22eae8['dialPowerLevel']||0x1;this[_0x2b18('0x2b')]=_0x22eae8[_0x2b18('0x2b')]||_0x2b18('0x2c');this[_0x2b18('0x2d')]=_0x22eae8['dialPredictiveOptimizationPercentage']||0.03;this[_0x2b18('0x2e')]=_0x22eae8['dialPredictiveInterval']||0x258;this[_0x2b18('0x2f')]=_0x22eae8[_0x2b18('0x2f')]||_0x2b18('0x30');this['dialOriginateCallerIdNumber']=_0x22eae8['dialOriginateCallerIdNumber']||'anonymous';this[_0x2b18('0x31')]=_0x22eae8[_0x2b18('0x31')]||0x1e;this[_0x2b18('0x32')]=_0x22eae8[_0x2b18('0x32')]||_0x2b18('0x33');this[_0x2b18('0x34')]=_0x22eae8[_0x2b18('0x34')]||0x3;this[_0x2b18('0x35')]=_0x22eae8[_0x2b18('0x35')]||undefined;this[_0x2b18('0x36')]=_0x22eae8[_0x2b18('0x36')]||0x3;this[_0x2b18('0x37')]=_0x22eae8[_0x2b18('0x37')]||0x96;this[_0x2b18('0x38')]=_0x22eae8[_0x2b18('0x38')]||0x3;this[_0x2b18('0x39')]=_0x22eae8[_0x2b18('0x39')]||0x96;this[_0x2b18('0x3a')]=_0x22eae8[_0x2b18('0x3a')]||0x3;this[_0x2b18('0x3b')]=_0x22eae8[_0x2b18('0x3b')]||0x96;this[_0x2b18('0x3c')]=_0x22eae8[_0x2b18('0x3c')]||0x3;this[_0x2b18('0x3d')]=_0x22eae8[_0x2b18('0x3d')]||0x96;this[_0x2b18('0x3e')]=_0x22eae8[_0x2b18('0x3e')]||0x3;this[_0x2b18('0x3f')]=_0x22eae8[_0x2b18('0x3f')]||0x96;this[_0x2b18('0x40')]=_0x22eae8[_0x2b18('0x40')]||0x3;this[_0x2b18('0x41')]=_0x22eae8['dialAbandonedRetryFrequency']||0x96;this[_0x2b18('0x42')]=_0x22eae8[_0x2b18('0x42')]||0x3;this[_0x2b18('0x43')]=_0x22eae8[_0x2b18('0x43')]||0x96;this['dialAgentRejectMaxRetry']=_0x22eae8['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x22eae8[_0x2b18('0x44')]||0x96;this[_0x2b18('0x45')]=_0x22eae8[_0x2b18('0x45')]||0x3;this[_0x2b18('0x46')]=_0x22eae8[_0x2b18('0x46')]||0x4;this[_0x2b18('0x47')]=_0x22eae8[_0x2b18('0x47')]?_0x22eae8[_0x2b18('0x47')]:undefined;this[_0x2b18('0x48')]=_0x22eae8[_0x2b18('0x48')]?_0x22eae8[_0x2b18('0x48')]:undefined;this[_0x2b18('0x49')]=_0x22eae8[_0x2b18('0x49')]||undefined;this[_0x2b18('0x4a')]=_0x22eae8['Interval']?_0x22eae8['Interval']:undefined;this['dialOrderByScheduledAt']=_0x22eae8[_0x2b18('0x4b')]||_0x2b18('0x4c');this[_0x2b18('0x4d')]=_0x22eae8[_0x2b18('0x4d')]||undefined;this['dialCutDigit']=_0x22eae8['dialCutDigit']||undefined;this[_0x2b18('0x4e')]=strategy[_0x22eae8[_0x2b18('0x4e')]];this[_0x2b18('0x4f')]=!![];this[_0x2b18('0x50')]=_0x22eae8[_0x2b18('0x50')]||![];this[_0x2b18('0x51')]=_0x22eae8[_0x2b18('0x51')];this[_0x2b18('0x52')]=_0x22eae8[_0x2b18('0x52')];this[_0x2b18('0x53')]=_0x22eae8[_0x2b18('0x53')];this[_0x2b18('0x54')]=_0x22eae8[_0x2b18('0x54')];this[_0x2b18('0x55')]=_0x22eae8[_0x2b18('0x55')];this[_0x2b18('0x56')]=_0x22eae8['dialAMDBetweenWordsSilence'];this[_0x2b18('0x57')]=_0x22eae8[_0x2b18('0x57')];this[_0x2b18('0x58')]=_0x22eae8[_0x2b18('0x58')];this[_0x2b18('0x59')]=_0x22eae8[_0x2b18('0x59')];this[_0x2b18('0x5a')]=0x0;this[_0x2b18('0x5b')]=0x0;this[_0x2b18('0x5c')]=_0x22eae8[_0x2b18('0x5c')];this[_0x2b18('0x5d')]=0x0;this[_0x2b18('0x5e')]=0x0;this[_0x2b18('0x5f')]=0x0;this[_0x2b18('0x60')]=0x0;this[_0x2b18('0x61')]=0x0;this[_0x2b18('0x62')]=0x0;this[_0x2b18('0x63')]=0x0;this[_0x2b18('0x64')]=0x0;this[_0x2b18('0x65')]=0x0;this[_0x2b18('0x66')]=0x0;this[_0x2b18('0x67')]=0x0;this[_0x2b18('0x68')]=0x0;this[_0x2b18('0x69')]=0x0;this['outboundAbandonedDay']=0x0;this['startProgressive']=undefined;this[_0x2b18('0x6a')]=undefined;this[_0x2b18('0x6b')]=undefined;this[_0x2b18('0x6c')]=1.05;this[_0x2b18('0x6d')]=0x0;this[_0x2b18('0x6e')]=0x0;this[_0x2b18('0x6f')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x2b18('0x70')]=0x0;this[_0x2b18('0x71')]=0x0;this[_0x2b18('0x72')]=0x0;this[_0x2b18('0x73')]=_0x22eae8[_0x2b18('0x74')]||0x14;this['predictiveIntervalMinThreshold']=_0x22eae8['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x2b18('0x75')]=0x0;this[_0x2b18('0x76')]=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this[_0x2b18('0x77')]=0x0;this[_0x2b18('0x78')]=0x0;this[_0x2b18('0x79')]=0x0;this[_0x2b18('0x7a')]=_0x22eae8[_0x2b18('0x7a')]||0x1e;this[_0x2b18('0x7b')]=_0x22eae8[_0x2b18('0x7b')]||![];this[_0x2b18('0x7c')]=!!_0x22eae8['dialPreviewAutoRecallMe']||![];this[_0x2b18('0x7d')]=!!_0x22eae8[_0x2b18('0x7d')]||![];this['dialQueueProject2']=_0x22eae8[_0x2b18('0x7e')]||undefined;this['dialAgiAfterHangupClient']=_0x22eae8['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0x22eae8[_0x2b18('0x7f')]||![];this['monitor_format']=monitorFormat[_0x22eae8['monitor_format']]?monitorFormat[_0x22eae8[_0x2b18('0x9')]]:undefined;this[_0x2b18('0x80')]=_0x22eae8[_0x2b18('0x80')]||![];this[_0x2b18('0x81')]=_0x22eae8[_0x2b18('0x81')]?_0x22eae8[_0x2b18('0x81')]:undefined;this[_0x2b18('0x82')]=![];}module[_0x2b18('0x83')]=VoiceQueue; \ No newline at end of file +var _0xe64b=['predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','wav','wav49','gsm','leastrecent','linear','ringall','roundrobin','rrmemory','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','loggedIn','onHold','paused','ringing','talking','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold'];(function(_0x4cce65,_0x40021e){var _0x4d1b45=function(_0x54d290){while(--_0x54d290){_0x4cce65['push'](_0x4cce65['shift']());}};_0x4d1b45(++_0x40021e);}(_0xe64b,0x1a3));var _0xbe64=function(_0x382593,_0x18ea9f){_0x382593=_0x382593-0x0;var _0x3eda0b=_0xe64b[_0x382593];return _0x3eda0b;};'use strict';var monitorFormat={'wav':_0xbe64('0x0'),'wav49':_0xbe64('0x1'),'gsm':_0xbe64('0x2')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0xbe64('0x3'),'linear':_0xbe64('0x4'),'random':'random','ringall':_0xbe64('0x5'),'rr':_0xbe64('0x6'),'rrmemory':_0xbe64('0x7'),'rrordered':'rrordered','wrandom':_0xbe64('0x8')};function VoiceQueue(_0x4286e3){this['id']=_0x4286e3['id']||0x0;this[_0xbe64('0x9')]=_0x4286e3['name']||'';this['monitor_format']=_0x4286e3[_0xbe64('0xa')]||'';this[_0xbe64('0xb')]=_0x4286e3[_0xbe64('0xb')]||_0xbe64('0xc');this[_0xbe64('0xd')]=0x0;this[_0xbe64('0xe')]=0x0;this[_0xbe64('0xf')]=0x0;this[_0xbe64('0x10')]=0x0;this[_0xbe64('0x11')]=0x0;this[_0xbe64('0x12')]=0x0;this[_0xbe64('0x13')]=0x0;this[_0xbe64('0x14')]=0x0;this[_0xbe64('0x15')]=0x0;this[_0xbe64('0x16')]=0x0;this[_0xbe64('0x17')]=0x0;this['invalid']=0x0;this[_0xbe64('0x18')]=0x0;this['notInUse']=0x0;this[_0xbe64('0x19')]=0x0;this[_0xbe64('0x1a')]=0x0;this[_0xbe64('0x1b')]=0x0;this['ringInUse']=0x0;this[_0xbe64('0x1c')]=0x0;this['unavailable']=0x0;this[_0xbe64('0x1d')]=0x0;this[_0xbe64('0x1e')]=_0x4286e3[_0xbe64('0x1e')]||![];this[_0xbe64('0x1f')]=_0x4286e3['acwTimeout']||0xa;this[_0xbe64('0x20')]=_0x4286e3[_0xbe64('0x20')]||'no';this[_0xbe64('0x21')]=!![];this[_0xbe64('0x22')]='';this[_0xbe64('0x23')]='';this['originated']=0x0;this[_0xbe64('0x24')]=0x0;this[_0xbe64('0x25')]=_0x4286e3['dialTimezone']||null;this[_0xbe64('0x26')]=_0x4286e3['dialGlobalInterval']?_0x4286e3[_0xbe64('0x26')]:null;this['dialActive']=_0x4286e3[_0xbe64('0x27')];this[_0xbe64('0x28')]=_0x4286e3[_0xbe64('0x28')]||_0xbe64('0x29');this[_0xbe64('0x2a')]=_0x4286e3['dialLimitChannel']||0x0;this[_0xbe64('0x2b')]=_0x4286e3[_0xbe64('0x2b')]||0x0;this[_0xbe64('0x2c')]=_0x4286e3[_0xbe64('0x2c')]||0x1;this[_0xbe64('0x2d')]=_0x4286e3[_0xbe64('0x2d')]||_0xbe64('0x2e');this[_0xbe64('0x2f')]=_0x4286e3[_0xbe64('0x2f')]||0.03;this['dialPredictiveInterval']=_0x4286e3[_0xbe64('0x30')]||0x258;this[_0xbe64('0x31')]=_0x4286e3[_0xbe64('0x31')]||_0xbe64('0x32');this[_0xbe64('0x33')]=_0x4286e3[_0xbe64('0x33')]||_0xbe64('0x32');this[_0xbe64('0x34')]=_0x4286e3[_0xbe64('0x34')]||0x1e;this[_0xbe64('0x35')]=_0x4286e3[_0xbe64('0x35')]||'tTxX';this['dialQueueTimeout']=_0x4286e3[_0xbe64('0x36')]||0x3;this[_0xbe64('0x37')]=_0x4286e3[_0xbe64('0x37')]||undefined;this[_0xbe64('0x38')]=_0x4286e3[_0xbe64('0x38')]||0x3;this[_0xbe64('0x39')]=_0x4286e3[_0xbe64('0x39')]||0x96;this[_0xbe64('0x3a')]=_0x4286e3[_0xbe64('0x3a')]||0x3;this[_0xbe64('0x3b')]=_0x4286e3['dialBusyRetryFrequency']||0x96;this[_0xbe64('0x3c')]=_0x4286e3['dialNoAnswerMaxRetry']||0x3;this[_0xbe64('0x3d')]=_0x4286e3['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x4286e3['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x4286e3[_0xbe64('0x3e')]||0x96;this[_0xbe64('0x3f')]=_0x4286e3['dialDropMaxRetry']||0x3;this[_0xbe64('0x40')]=_0x4286e3[_0xbe64('0x40')]||0x96;this[_0xbe64('0x41')]=_0x4286e3[_0xbe64('0x41')]||0x3;this[_0xbe64('0x42')]=_0x4286e3[_0xbe64('0x42')]||0x96;this['dialMachineMaxRetry']=_0x4286e3[_0xbe64('0x43')]||0x3;this['dialMachineRetryFrequency']=_0x4286e3['dialMachineRetryFrequency']||0x96;this[_0xbe64('0x44')]=_0x4286e3[_0xbe64('0x44')]||0x3;this[_0xbe64('0x45')]=_0x4286e3[_0xbe64('0x45')]||0x96;this[_0xbe64('0x46')]=_0x4286e3[_0xbe64('0x46')]||0x3;this[_0xbe64('0x47')]=_0x4286e3[_0xbe64('0x47')]||0x4;this[_0xbe64('0x48')]=_0x4286e3[_0xbe64('0x48')]?_0x4286e3['Trunk']:undefined;this['TrunkBackup']=_0x4286e3[_0xbe64('0x49')]?_0x4286e3['TrunkBackup']:undefined;this[_0xbe64('0x4a')]=_0x4286e3['dialPrefix']||undefined;this['Interval']=_0x4286e3[_0xbe64('0x4b')]?_0x4286e3[_0xbe64('0x4b')]:undefined;this[_0xbe64('0x4c')]=_0x4286e3[_0xbe64('0x4c')]||_0xbe64('0x4d');this[_0xbe64('0x4e')]=_0x4286e3[_0xbe64('0x4e')]||undefined;this[_0xbe64('0x4f')]=_0x4286e3[_0xbe64('0x4f')]||undefined;this['strategy']=strategy[_0x4286e3[_0xbe64('0x50')]];this['queueStatusComplete']=!![];this[_0xbe64('0x51')]=_0x4286e3[_0xbe64('0x51')]||![];this[_0xbe64('0x52')]=_0x4286e3[_0xbe64('0x52')];this[_0xbe64('0x53')]=_0x4286e3[_0xbe64('0x53')];this['dialAMDAfterGreetingSilence']=_0x4286e3['dialAMDAfterGreetingSilence'];this[_0xbe64('0x54')]=_0x4286e3[_0xbe64('0x54')];this[_0xbe64('0x55')]=_0x4286e3[_0xbe64('0x55')];this[_0xbe64('0x56')]=_0x4286e3[_0xbe64('0x56')];this['dialAMDMaximumNumberOfWords']=_0x4286e3[_0xbe64('0x57')];this[_0xbe64('0x58')]=_0x4286e3['dialAMDSilenceThreshold'];this[_0xbe64('0x59')]=_0x4286e3[_0xbe64('0x59')];this[_0xbe64('0x5a')]=0x0;this[_0xbe64('0x5b')]=0x0;this[_0xbe64('0x5c')]=_0x4286e3[_0xbe64('0x5c')];this[_0xbe64('0x5d')]=0x0;this[_0xbe64('0x5e')]=0x0;this[_0xbe64('0x5f')]=0x0;this[_0xbe64('0x60')]=0x0;this[_0xbe64('0x61')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0xbe64('0x62')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xbe64('0x63')]=0x0;this[_0xbe64('0x64')]=0x0;this[_0xbe64('0x65')]=0x0;this[_0xbe64('0x66')]=0x0;this['outboundReCallsDay']=0x0;this[_0xbe64('0x67')]=0x0;this[_0xbe64('0x68')]=undefined;this[_0xbe64('0x69')]=undefined;this[_0xbe64('0x6a')]=undefined;this[_0xbe64('0x6b')]=1.05;this[_0xbe64('0x6c')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xbe64('0x6d')]=0x0;this[_0xbe64('0x6e')]=0x0;this[_0xbe64('0x6f')]=0x0;this[_0xbe64('0x70')]=0x0;this[_0xbe64('0x71')]=0x0;this[_0xbe64('0x72')]=0x0;this['predictiveIntervalMaxThreshold']=_0x4286e3[_0xbe64('0x73')]||0x14;this[_0xbe64('0x74')]=_0x4286e3[_0xbe64('0x73')]||0xa;this[_0xbe64('0x75')]=0x0;this[_0xbe64('0x76')]=0x0;this[_0xbe64('0x77')]=0x1;this[_0xbe64('0x78')]=0x0;this[_0xbe64('0x79')]=0x0;this[_0xbe64('0x7a')]=0x0;this[_0xbe64('0x7b')]=0x0;this[_0xbe64('0x7c')]=_0x4286e3[_0xbe64('0x7c')]||0x1e;this['dialRecallInQueue']=_0x4286e3[_0xbe64('0x7d')]||![];this[_0xbe64('0x7e')]=!!_0x4286e3[_0xbe64('0x7e')]||![];this[_0xbe64('0x7f')]=!!_0x4286e3[_0xbe64('0x7f')]||![];this['dialQueueProject2']=_0x4286e3[_0xbe64('0x80')]||undefined;this[_0xbe64('0x81')]=_0x4286e3[_0xbe64('0x81')]||![];this['dialAgiAfterHangupAgent']=_0x4286e3[_0xbe64('0x82')]||![];this[_0xbe64('0xa')]=monitorFormat[_0x4286e3[_0xbe64('0xa')]]?monitorFormat[_0x4286e3[_0xbe64('0xa')]]:undefined;this[_0xbe64('0x83')]=_0x4286e3[_0xbe64('0x83')]||![];this['mandatoryDispositionPause']=_0x4286e3[_0xbe64('0x84')]?_0x4286e3[_0xbe64('0x84')]:undefined;this[_0xbe64('0x85')]=![];}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 9ba4892..f4428eb 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 _0x4986=['prototype','loggedin','callers','length','SIP/','online','incall','includes','status','booked','keys','queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue','exports','available','loggedIn','loggedInDb','talking','waiting','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','paused','pTalking','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringing','ringInUse','sumBillable','sumDuration','sumHoldTime','type','unavailable','unknown','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid'];(function(_0x2b6600,_0x24c497){var _0x912ee2=function(_0x5d6484){while(--_0x5d6484){_0x2b6600['push'](_0x2b6600['shift']());}};_0x912ee2(++_0x24c497);}(_0x4986,0x6e));var _0x6498=function(_0x4b29a3,_0x5a0f00){_0x4b29a3=_0x4b29a3-0x0;var _0x4cca63=_0x4986[_0x4b29a3];return _0x4cca63;};'use strict';var INBOUND_COUNTERS=[_0x6498('0x0'),_0x6498('0x1'),_0x6498('0x2'),'paused','ringing',_0x6498('0x3'),_0x6498('0x4')];var OUTBOUND_COUNTERS=['available',_0x6498('0x5'),_0x6498('0x6'),_0x6498('0x1'),_0x6498('0x2'),_0x6498('0x7'),_0x6498('0x8'),_0x6498('0x9'),'outboundBlacklistCallsDay','outboundBusyCallsDay',_0x6498('0xa'),_0x6498('0xb'),_0x6498('0xc'),_0x6498('0xd'),_0x6498('0xe'),'outboundUnknownCallsDay',_0x6498('0xf'),_0x6498('0x10'),_0x6498('0x3'),'sumBillable','sumDuration',_0x6498('0x11'),'waiting'];function VoiceQueueSummary(_0x1b6f28){this['id']=_0x1b6f28['id'];this[_0x6498('0x12')]=_0x1b6f28[_0x6498('0x12')];this[_0x6498('0x13')]=_0x1b6f28[_0x6498('0x13')];this[_0x6498('0x14')]=_0x1b6f28[_0x6498('0x14')]||0x0;this['answered']=_0x1b6f28['answered']||0x0;this[_0x6498('0x0')]=_0x1b6f28[_0x6498('0x0')]||0x0;this[_0x6498('0x15')]=_0x1b6f28[_0x6498('0x15')]||0x0;this[_0x6498('0x6')]=_0x1b6f28['inUse']||0x0;this[_0x6498('0x16')]=_0x1b6f28[_0x6498('0x16')]||0x0;this[_0x6498('0x1')]=_0x1b6f28[_0x6498('0x1')]||0x0;this[_0x6498('0x2')]=_0x1b6f28[_0x6498('0x2')]||0x0;this[_0x6498('0x17')]=_0x1b6f28['onHold']||0x0;this[_0x6498('0x18')]=_0x1b6f28[_0x6498('0x18')]||0x0;this[_0x6498('0xf')]=_0x1b6f28[_0x6498('0xf')]||0x0;this[_0x6498('0x19')]=_0x1b6f28['ringing']||0x0;this['ringInUse']=_0x1b6f28[_0x6498('0x1a')];this[_0x6498('0x1b')]=_0x1b6f28[_0x6498('0x1b')];this[_0x6498('0x1c')]=_0x1b6f28[_0x6498('0x1c')];this[_0x6498('0x1d')]=_0x1b6f28[_0x6498('0x1d')]||0x0;this[_0x6498('0x3')]=_0x1b6f28[_0x6498('0x3')]||0x0;this[_0x6498('0x11')]=_0x1b6f28[_0x6498('0x11')]||0x0;this[_0x6498('0x1e')]=_0x1b6f28[_0x6498('0x1e')];this[_0x6498('0x1f')]=_0x1b6f28['unavailable']||0x0;this['unknown']=_0x1b6f28[_0x6498('0x20')]||0x0;this['unmanaged']=_0x1b6f28[_0x6498('0x21')]||0x0;this[_0x6498('0x4')]=_0x1b6f28[_0x6498('0x4')]||0x0;if(_0x1b6f28[_0x6498('0x1e')]==='outbound'){this['pTalking']=_0x1b6f28[_0x6498('0x10')]||0x0;this['dialActive']=_0x1b6f28[_0x6498('0x22')];this[_0x6498('0x23')]=_0x1b6f28[_0x6498('0x23')];this[_0x6498('0x24')]=_0x1b6f28[_0x6498('0x24')];this[_0x6498('0x25')]=_0x1b6f28[_0x6498('0x25')];this[_0x6498('0x26')]=_0x1b6f28[_0x6498('0x26')];this[_0x6498('0x27')]=_0x1b6f28[_0x6498('0x27')];this[_0x6498('0x28')]=_0x1b6f28[_0x6498('0x28')];this['outboundAnswerAgiCallsDay']=_0x1b6f28[_0x6498('0x29')];this[_0x6498('0x9')]=_0x1b6f28['outboundAnswerCallsDay'];this['outboundBlacklistCallsDay']=_0x1b6f28['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0x1b6f28[_0x6498('0x2a')];this[_0x6498('0xa')]=_0x1b6f28[_0x6498('0xa')];this[_0x6498('0x2b')]=_0x1b6f28['outboundDropCallsDayACS'];this[_0x6498('0x2c')]=_0x1b6f28['outboundDropCallsDayCallersExit'];this['outboundDropCallsDayTimeout']=_0x1b6f28['outboundDropCallsDayTimeout'];this['outboundNoAnswerCallsDay']=_0x1b6f28[_0x6498('0xb')];this[_0x6498('0xc')]=_0x1b6f28['outboundNoSuchCallsDay'];this[_0x6498('0x2d')]=_0x1b6f28['outboundOriginateFailureCallsDay'];this[_0x6498('0xd')]=_0x1b6f28[_0x6498('0xd')];this['outboundRejectCallsDay']=_0x1b6f28['outboundRejectCallsDay'];this[_0x6498('0x2e')]=_0x1b6f28['outboundUnknownCallsDay'];this[_0x6498('0x2f')]=_0x1b6f28[_0x6498('0x2f')];this['predictiveIntervalAvgHoldtime']=_0x1b6f28[_0x6498('0x30')];this['predictiveIntervalAvgTalktime']=_0x1b6f28[_0x6498('0x31')];this[_0x6498('0x32')]=_0x1b6f28[_0x6498('0x32')];this[_0x6498('0x33')]=_0x1b6f28[_0x6498('0x33')];this[_0x6498('0x34')]=_0x1b6f28[_0x6498('0x34')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x1b6f28[_0x6498('0x35')];this['predictiveIntervalHitRate']=_0x1b6f28[_0x6498('0x36')];this['predictiveIntervalMultiplicativeFactor']=_0x1b6f28[_0x6498('0x37')];this['predictiveIntervalPauses']=_0x1b6f28[_0x6498('0x38')];this[_0x6498('0x39')]=_0x1b6f28[_0x6498('0x39')];this[_0x6498('0x3a')]=_0x1b6f28[_0x6498('0x3a')];this[_0x6498('0x7')]=_0x1b6f28[_0x6498('0x7')];this['erlangCalls']=_0x1b6f28[_0x6498('0x3b')];this[_0x6498('0x3c')]=_0x1b6f28[_0x6498('0x3c')];this[_0x6498('0x3d')]=_0x1b6f28[_0x6498('0x3d')];this[_0x6498('0x3e')]=_0x1b6f28[_0x6498('0x3e')];this[_0x6498('0x3f')]=_0x1b6f28['startPredictive'];this[_0x6498('0x40')]=_0x1b6f28[_0x6498('0x40')];this[_0x6498('0x41')]=_0x1b6f28['message'];this[_0x6498('0x42')]=_0x1b6f28[_0x6498('0x42')];}if(_0x1b6f28[_0x6498('0x43')]){this[_0x6498('0x43')]={'id':_0x1b6f28[_0x6498('0x43')]['id'],'name':_0x1b6f28[_0x6498('0x43')][_0x6498('0x12')],'active':_0x1b6f28[_0x6498('0x43')][_0x6498('0x44')],'callerid':_0x1b6f28[_0x6498('0x43')][_0x6498('0x45')]};}}VoiceQueueSummary[_0x6498('0x46')]['createReport']=function(_0x4d05d2,_0x5b4348,_0x2b98dd,_0x1ceb5d){this[_0x6498('0x2')]=0x0;this[_0x6498('0x3')]=0x0;this[_0x6498('0xf')]=0x0;this[_0x6498('0x20')]=0x0;this[_0x6498('0x18')]=0x0;this['inUse']=0x0;this[_0x6498('0x15')]=0x0;this[_0x6498('0x16')]=0x0;this[_0x6498('0x1f')]=0x0;this[_0x6498('0x19')]=0x0;this[_0x6498('0x1a')]=0x0;this[_0x6498('0x17')]=0x0;if(_0x2b98dd){if(_0x2b98dd['available']){this[_0x6498('0x0')]=Number(_0x2b98dd[_0x6498('0x0')]);}if(_0x2b98dd['loggedin']){this['loggedIn']=Number(_0x2b98dd[_0x6498('0x47')]);}if(_0x2b98dd[_0x6498('0x48')]){this[_0x6498('0x4')]=Number(_0x2b98dd['callers']);}}for(var _0x4fb005=0x0;_0x4fb005<_0x4d05d2[_0x6498('0x49')];_0x4fb005++){var _0x4ade23=_0x5b4348[_0x6498('0x4a')+_0x4d05d2[_0x4fb005][_0x6498('0x12')]];if(_0x4ade23&&_0x4ade23[_0x6498('0x4b')]){this[_0x6498('0x2')]+=0x1;}if(_0x4d05d2[_0x4fb005][_0x6498('0x4c')]==='1'){this[_0x6498('0x3')]+=0x1;}if(_0x4d05d2[_0x4fb005]['paused']==='1'&&!['2','7','8'][_0x6498('0x4d')](_0x4d05d2[_0x4fb005][_0x6498('0x4e')])){this[_0x6498('0xf')]+=0x1;}switch(_0x4d05d2[_0x4fb005][_0x6498('0x4e')]){case'0':this['unknown']+=0x1;break;case'1':this[_0x6498('0x18')]+=0x1;break;case'2':this[_0x6498('0x6')]+=0x1;break;case'3':this[_0x6498('0x15')]+=0x1;break;case'4':this[_0x6498('0x16')]+=0x1;break;case'5':this[_0x6498('0x1f')]+=0x1;break;case'6':this[_0x6498('0x19')]+=0x1;break;case'7':this[_0x6498('0x1a')]+=0x1;break;case'8':this[_0x6498('0x17')]+=0x1;break;}}if(this['dialMethod']===_0x6498('0x4f')){var _0x1bbb6f=Object[_0x6498('0x50')](_0x1ceb5d);for(var _0x30d30b=0x0;_0x30d30b<_0x1bbb6f[_0x6498('0x49')];_0x30d30b++){var _0x1f44b8=_0x1bbb6f[_0x30d30b];var _0x4bfcb5=_0x1ceb5d[_0x1f44b8];if(_0x4bfcb5[_0x6498('0x51')]===this[_0x6498('0x12')]&&_0x4bfcb5[_0x6498('0x1e')]===_0x6498('0x52')&&_0x4bfcb5[_0x6498('0x53')]===_0x6498('0x54')){this[_0x6498('0x3')]+=0x1;}}if(this[_0x6498('0x3')]>this[_0x6498('0x6')]){this[_0x6498('0x3')]=this[_0x6498('0x6')];}this[_0x6498('0x10')]=0x0;}return this;};VoiceQueueSummary[_0x6498('0x46')][_0x6498('0x55')]=function(_0x47e90c){var _0x147937=![];if(_0x47e90c){_0x147937=INBOUND_COUNTERS[_0x6498('0x56')](function(_0x3d531c){return this[_0x3d531c]!==_0x47e90c[_0x3d531c];},this);}return _0x147937;};VoiceQueueSummary[_0x6498('0x46')][_0x6498('0x57')]=function(_0x24083a){var _0x5ab08c=![];var _0x552a9e=![];var _0x26580e=![];if(_0x24083a){_0x5ab08c=this['dialMethod']!==_0x24083a[_0x6498('0x23')]||this[_0x6498('0x22')]!==_0x24083a[_0x6498('0x22')]||this[_0x6498('0x41')]!==_0x24083a[_0x6498('0x41')]||this['statusMessage']!==_0x24083a[_0x6498('0x42')];_0x552a9e=OUTBOUND_COUNTERS[_0x6498('0x56')](function(_0x3ed025){return this[_0x3ed025]!==_0x24083a[_0x3ed025];},this);if(this[_0x6498('0x43')]&&_0x24083a['Trunk']){_0x26580e=this['Trunk'][_0x6498('0x12')]!==_0x24083a['Trunk'][_0x6498('0x12')]||this[_0x6498('0x43')][_0x6498('0x44')]!==_0x24083a[_0x6498('0x43')][_0x6498('0x44')];}}return _0x5ab08c||_0x552a9e||_0x26580e;};VoiceQueueSummary[_0x6498('0x46')][_0x6498('0x58')]=function(_0x11e978){this['answered']=_0x11e978[_0x6498('0x5')];this[_0x6498('0x41')]=_0x11e978[_0x6498('0x41')];this[_0x6498('0x42')]=_0x11e978['statusMessage'];this[_0x6498('0x7')]=_0x11e978['originated'];this[_0x6498('0x8')]=_0x11e978['outboundAbandonedCallsDay'];this[_0x6498('0x9')]=_0x11e978[_0x6498('0x9')];this['outboundBlacklistCallsDay']=_0x11e978['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0x11e978[_0x6498('0x2a')];this[_0x6498('0xa')]=_0x11e978['outboundCongestionCallsDay'];this[_0x6498('0xb')]=_0x11e978[_0x6498('0xb')];this['outboundNoSuchCallsDay']=_0x11e978['outboundNoSuchCallsDay'];this[_0x6498('0xd')]=_0x11e978[_0x6498('0xd')];this[_0x6498('0xe')]=_0x11e978[_0x6498('0xe')];this[_0x6498('0x2e')]=_0x11e978[_0x6498('0x2e')];this[_0x6498('0x1b')]=_0x11e978[_0x6498('0x1b')];this[_0x6498('0x1c')]=_0x11e978['sumDuration'];this['total']=_0x11e978[_0x6498('0x11')];if(this[_0x6498('0x23')]==='preview'){this[_0x6498('0x10')]=_0x11e978[_0x6498('0x10')];}};module[_0x6498('0x59')]=VoiceQueueSummary; \ No newline at end of file +var _0xf29c=['predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','prototype','callers','length','SIP/','online','incall','includes','status','keys','dialer','exten','compareToInboundQueue','some','compareToOutboundQueue','preview','exports','loggedIn','loggedInDb','paused','ringing','talking','waiting','available','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf29c,0xc7));var _0xcf29=function(_0x474d68,_0x23f0d7){_0x474d68=_0x474d68-0x0;var _0x2c9008=_0xf29c[_0x474d68];return _0x2c9008;};'use strict';var INBOUND_COUNTERS=['available',_0xcf29('0x0'),_0xcf29('0x1'),_0xcf29('0x2'),_0xcf29('0x3'),_0xcf29('0x4'),_0xcf29('0x5')];var OUTBOUND_COUNTERS=[_0xcf29('0x6'),_0xcf29('0x7'),_0xcf29('0x8'),_0xcf29('0x0'),_0xcf29('0x1'),_0xcf29('0x9'),_0xcf29('0xa'),_0xcf29('0xb'),_0xcf29('0xc'),_0xcf29('0xd'),'outboundCongestionCallsDay','outboundNoAnswerCallsDay',_0xcf29('0xe'),_0xcf29('0xf'),_0xcf29('0x10'),_0xcf29('0x11'),_0xcf29('0x2'),_0xcf29('0x12'),_0xcf29('0x4'),_0xcf29('0x13'),_0xcf29('0x14'),_0xcf29('0x15'),_0xcf29('0x5')];function VoiceQueueSummary(_0x11d304){this['id']=_0x11d304['id'];this['name']=_0x11d304[_0xcf29('0x16')];this[_0xcf29('0x17')]=_0x11d304['strategy'];this[_0xcf29('0x18')]=_0x11d304['abandoned']||0x0;this[_0xcf29('0x7')]=_0x11d304[_0xcf29('0x7')]||0x0;this[_0xcf29('0x6')]=_0x11d304[_0xcf29('0x6')]||0x0;this[_0xcf29('0x19')]=_0x11d304[_0xcf29('0x19')]||0x0;this[_0xcf29('0x8')]=_0x11d304[_0xcf29('0x8')]||0x0;this[_0xcf29('0x1a')]=_0x11d304['invalid']||0x0;this[_0xcf29('0x0')]=_0x11d304['loggedIn']||0x0;this[_0xcf29('0x1')]=_0x11d304['loggedInDb']||0x0;this[_0xcf29('0x1b')]=_0x11d304['onHold']||0x0;this[_0xcf29('0x1c')]=_0x11d304['notInUse']||0x0;this[_0xcf29('0x2')]=_0x11d304[_0xcf29('0x2')]||0x0;this['ringing']=_0x11d304[_0xcf29('0x3')]||0x0;this[_0xcf29('0x1d')]=_0x11d304['ringInUse'];this[_0xcf29('0x13')]=_0x11d304[_0xcf29('0x13')];this['sumDuration']=_0x11d304['sumDuration'];this['sumHoldTime']=_0x11d304[_0xcf29('0x1e')]||0x0;this[_0xcf29('0x4')]=_0x11d304[_0xcf29('0x4')]||0x0;this[_0xcf29('0x15')]=_0x11d304[_0xcf29('0x15')]||0x0;this[_0xcf29('0x1f')]=_0x11d304[_0xcf29('0x1f')];this[_0xcf29('0x20')]=_0x11d304[_0xcf29('0x20')]||0x0;this[_0xcf29('0x21')]=_0x11d304[_0xcf29('0x21')]||0x0;this[_0xcf29('0x22')]=_0x11d304['unmanaged']||0x0;this[_0xcf29('0x5')]=_0x11d304[_0xcf29('0x5')]||0x0;if(_0x11d304[_0xcf29('0x1f')]===_0xcf29('0x23')){this[_0xcf29('0x12')]=_0x11d304[_0xcf29('0x12')]||0x0;this['dialActive']=_0x11d304[_0xcf29('0x24')];this[_0xcf29('0x25')]=_0x11d304[_0xcf29('0x25')];this[_0xcf29('0x26')]=_0x11d304['dialOriginateCallerIdName'];this[_0xcf29('0x27')]=_0x11d304[_0xcf29('0x27')];this[_0xcf29('0x28')]=_0x11d304['dialOriginateTimeout'];this[_0xcf29('0x29')]=_0x11d304[_0xcf29('0x29')];this[_0xcf29('0x2a')]=_0x11d304[_0xcf29('0x2a')];this[_0xcf29('0x2b')]=_0x11d304[_0xcf29('0x2b')];this[_0xcf29('0xb')]=_0x11d304['outboundAnswerCallsDay'];this[_0xcf29('0xc')]=_0x11d304[_0xcf29('0xc')];this[_0xcf29('0xd')]=_0x11d304[_0xcf29('0xd')];this[_0xcf29('0x2c')]=_0x11d304[_0xcf29('0x2c')];this[_0xcf29('0x2d')]=_0x11d304[_0xcf29('0x2d')];this['outboundDropCallsDayCallersExit']=_0x11d304[_0xcf29('0x2e')];this[_0xcf29('0x2f')]=_0x11d304[_0xcf29('0x2f')];this[_0xcf29('0x30')]=_0x11d304[_0xcf29('0x30')];this[_0xcf29('0xe')]=_0x11d304[_0xcf29('0xe')];this['outboundOriginateFailureCallsDay']=_0x11d304['outboundOriginateFailureCallsDay'];this[_0xcf29('0xf')]=_0x11d304[_0xcf29('0xf')];this[_0xcf29('0x10')]=_0x11d304[_0xcf29('0x10')];this[_0xcf29('0x11')]=_0x11d304[_0xcf29('0x11')];this[_0xcf29('0x31')]=_0x11d304['predictiveIntervalAnsweredCalls'];this[_0xcf29('0x32')]=_0x11d304[_0xcf29('0x32')];this[_0xcf29('0x33')]=_0x11d304[_0xcf29('0x33')];this['predictiveIntervalDroppedCallsCallersExit']=_0x11d304['predictiveIntervalDroppedCallsCallersExit'];this[_0xcf29('0x34')]=_0x11d304['predictiveIntervalDroppedCallsTimeout'];this[_0xcf29('0x35')]=_0x11d304[_0xcf29('0x35')];this[_0xcf29('0x36')]=_0x11d304[_0xcf29('0x36')];this['predictiveIntervalHitRate']=_0x11d304['predictiveIntervalHitRate'];this[_0xcf29('0x37')]=_0x11d304[_0xcf29('0x37')];this[_0xcf29('0x38')]=_0x11d304[_0xcf29('0x38')];this['predictiveIntervalAvailable']=_0x11d304['predictiveIntervalAvailable'];this[_0xcf29('0x39')]=_0x11d304['predictiveIntervalTotalCalls'];this[_0xcf29('0x9')]=_0x11d304['originated'];this['erlangCalls']=_0x11d304[_0xcf29('0x3a')];this[_0xcf29('0x3b')]=_0x11d304['erlangCallToSecond'];this[_0xcf29('0x3c')]=_0x11d304['erlangAbandonmentRate'];this['erlangBusyFactor']=_0x11d304[_0xcf29('0x3d')];this[_0xcf29('0x3e')]=_0x11d304['startPredictive'];this[_0xcf29('0x3f')]=_0x11d304['startProgressive'];this[_0xcf29('0x40')]=_0x11d304['message'];this[_0xcf29('0x41')]=_0x11d304['statusMessage'];}if(_0x11d304['Trunk']){this[_0xcf29('0x42')]={'id':_0x11d304['Trunk']['id'],'name':_0x11d304[_0xcf29('0x42')][_0xcf29('0x16')],'active':_0x11d304[_0xcf29('0x42')][_0xcf29('0x43')],'callerid':_0x11d304[_0xcf29('0x42')]['callerid']};}}VoiceQueueSummary[_0xcf29('0x44')]['createReport']=function(_0x230613,_0x32b35c,_0x4df41b,_0x48690a){this[_0xcf29('0x1')]=0x0;this[_0xcf29('0x4')]=0x0;this[_0xcf29('0x2')]=0x0;this[_0xcf29('0x21')]=0x0;this[_0xcf29('0x1c')]=0x0;this[_0xcf29('0x8')]=0x0;this['busy']=0x0;this[_0xcf29('0x1a')]=0x0;this[_0xcf29('0x20')]=0x0;this[_0xcf29('0x3')]=0x0;this['ringInUse']=0x0;this[_0xcf29('0x1b')]=0x0;if(_0x4df41b){if(_0x4df41b[_0xcf29('0x6')]){this[_0xcf29('0x6')]=Number(_0x4df41b[_0xcf29('0x6')]);}if(_0x4df41b['loggedin']){this[_0xcf29('0x0')]=Number(_0x4df41b['loggedin']);}if(_0x4df41b[_0xcf29('0x45')]){this['waiting']=Number(_0x4df41b[_0xcf29('0x45')]);}}for(var _0x287fda=0x0;_0x287fda<_0x230613[_0xcf29('0x46')];_0x287fda++){var _0x3a330a=_0x32b35c[_0xcf29('0x47')+_0x230613[_0x287fda][_0xcf29('0x16')]];if(_0x3a330a&&_0x3a330a[_0xcf29('0x48')]){this[_0xcf29('0x1')]+=0x1;}if(_0x230613[_0x287fda][_0xcf29('0x49')]==='1'){this[_0xcf29('0x4')]+=0x1;}if(_0x230613[_0x287fda][_0xcf29('0x2')]==='1'&&!['2','7','8'][_0xcf29('0x4a')](_0x230613[_0x287fda][_0xcf29('0x4b')])){this['paused']+=0x1;}switch(_0x230613[_0x287fda][_0xcf29('0x4b')]){case'0':this[_0xcf29('0x21')]+=0x1;break;case'1':this[_0xcf29('0x1c')]+=0x1;break;case'2':this[_0xcf29('0x8')]+=0x1;break;case'3':this[_0xcf29('0x19')]+=0x1;break;case'4':this[_0xcf29('0x1a')]+=0x1;break;case'5':this[_0xcf29('0x20')]+=0x1;break;case'6':this[_0xcf29('0x3')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0xcf29('0x1b')]+=0x1;break;}}if(this[_0xcf29('0x25')]==='booked'){var _0x306ab5=Object[_0xcf29('0x4c')](_0x48690a);for(var _0x3b1f15=0x0;_0x3b1f15<_0x306ab5[_0xcf29('0x46')];_0x3b1f15++){var _0x4dd061=_0x306ab5[_0x3b1f15];var _0x42ef21=_0x48690a[_0x4dd061];if(_0x42ef21['queue']===this[_0xcf29('0x16')]&&_0x42ef21['type']===_0xcf29('0x4d')&&_0x42ef21[_0xcf29('0x4e')]==='xcally-motion-preview'){this[_0xcf29('0x4')]+=0x1;}}if(this[_0xcf29('0x4')]>this[_0xcf29('0x8')]){this[_0xcf29('0x4')]=this['inUse'];}this[_0xcf29('0x12')]=0x0;}return this;};VoiceQueueSummary[_0xcf29('0x44')][_0xcf29('0x4f')]=function(_0x411959){var _0x34df0f=![];if(_0x411959){_0x34df0f=INBOUND_COUNTERS[_0xcf29('0x50')](function(_0x3e7fb9){return this[_0x3e7fb9]!==_0x411959[_0x3e7fb9];},this);}return _0x34df0f;};VoiceQueueSummary[_0xcf29('0x44')][_0xcf29('0x51')]=function(_0xe97668){var _0x2be93e=![];var _0x12e107=![];var _0x5713a4=![];if(_0xe97668){_0x2be93e=this[_0xcf29('0x25')]!==_0xe97668[_0xcf29('0x25')]||this[_0xcf29('0x24')]!==_0xe97668[_0xcf29('0x24')]||this[_0xcf29('0x40')]!==_0xe97668['message']||this[_0xcf29('0x41')]!==_0xe97668['statusMessage'];_0x12e107=OUTBOUND_COUNTERS['some'](function(_0x40661e){return this[_0x40661e]!==_0xe97668[_0x40661e];},this);if(this[_0xcf29('0x42')]&&_0xe97668[_0xcf29('0x42')]){_0x5713a4=this[_0xcf29('0x42')][_0xcf29('0x16')]!==_0xe97668[_0xcf29('0x42')][_0xcf29('0x16')]||this[_0xcf29('0x42')][_0xcf29('0x43')]!==_0xe97668[_0xcf29('0x42')]['active'];}}return _0x2be93e||_0x12e107||_0x5713a4;};VoiceQueueSummary[_0xcf29('0x44')]['updateReportFromOutboundQueue']=function(_0x5f5a0a){this[_0xcf29('0x7')]=_0x5f5a0a['answered'];this[_0xcf29('0x40')]=_0x5f5a0a[_0xcf29('0x40')];this[_0xcf29('0x41')]=_0x5f5a0a[_0xcf29('0x41')];this[_0xcf29('0x9')]=_0x5f5a0a[_0xcf29('0x9')];this[_0xcf29('0xa')]=_0x5f5a0a[_0xcf29('0xa')];this['outboundAnswerCallsDay']=_0x5f5a0a[_0xcf29('0xb')];this[_0xcf29('0xc')]=_0x5f5a0a[_0xcf29('0xc')];this[_0xcf29('0xd')]=_0x5f5a0a[_0xcf29('0xd')];this[_0xcf29('0x2c')]=_0x5f5a0a[_0xcf29('0x2c')];this[_0xcf29('0x30')]=_0x5f5a0a[_0xcf29('0x30')];this[_0xcf29('0xe')]=_0x5f5a0a[_0xcf29('0xe')];this[_0xcf29('0xf')]=_0x5f5a0a[_0xcf29('0xf')];this['outboundRejectCallsDay']=_0x5f5a0a[_0xcf29('0x10')];this[_0xcf29('0x11')]=_0x5f5a0a[_0xcf29('0x11')];this[_0xcf29('0x13')]=_0x5f5a0a[_0xcf29('0x13')];this[_0xcf29('0x14')]=_0x5f5a0a[_0xcf29('0x14')];this[_0xcf29('0x15')]=_0x5f5a0a[_0xcf29('0x15')];if(this[_0xcf29('0x25')]===_0xcf29('0x52')){this[_0xcf29('0x12')]=_0x5f5a0a[_0xcf29('0x12')];}};module[_0xcf29('0x53')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index a2173cc..974c32f 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 _0xd997=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x162c83,_0x125a02){var _0x3a8d4f=function(_0x159887){while(--_0x159887){_0x162c83['push'](_0x162c83['shift']());}};_0x3a8d4f(++_0x125a02);}(_0xd997,0x18d));var _0x7d99=function(_0x22ac18,_0x1515d4){_0x22ac18=_0x22ac18-0x0;var _0x4da78f=_0xd997[_0x22ac18];return _0x4da78f;};'use strict';function VtigerAccount(_0x3e3f45){this['id']=_0x3e3f45['id']||0x0;this[_0x7d99('0x0')]=_0x3e3f45[_0x7d99('0x0')]||'';this['username']=_0x3e3f45[_0x7d99('0x1')]||'';this[_0x7d99('0x2')]=_0x3e3f45[_0x7d99('0x2')]||'';this[_0x7d99('0x3')]=_0x3e3f45[_0x7d99('0x3')]||'';this[_0x7d99('0x4')]=_0x3e3f45[_0x7d99('0x4')]||'';this[_0x7d99('0x5')]=_0x3e3f45[_0x7d99('0x5')]||{};}module[_0x7d99('0x6')]=VtigerAccount; \ No newline at end of file +var _0x19a3=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0xc16be7,_0x55b283){var _0x553b83=function(_0x598d79){while(--_0x598d79){_0xc16be7['push'](_0xc16be7['shift']());}};_0x553b83(++_0x55b283);}(_0x19a3,0x87));var _0x319a=function(_0x47519a,_0x37dc32){_0x47519a=_0x47519a-0x0;var _0x330208=_0x19a3[_0x47519a];return _0x330208;};'use strict';function VtigerAccount(_0x3142e0){this['id']=_0x3142e0['id']||0x0;this[_0x319a('0x0')]=_0x3142e0[_0x319a('0x0')]||'';this[_0x319a('0x1')]=_0x3142e0[_0x319a('0x1')]||'';this[_0x319a('0x2')]=_0x3142e0[_0x319a('0x2')]||'';this[_0x319a('0x3')]=_0x3142e0[_0x319a('0x3')]||'';this[_0x319a('0x4')]=_0x3142e0[_0x319a('0x4')]||'';this[_0x319a('0x5')]=_0x3142e0[_0x319a('0x5')]||{};}module[_0x319a('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 3e6f0a4..4147474 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 _0x1751=['password','token','remoteUri','type','serverUrl','Configurations','exports','name','username'];(function(_0x39b9b3,_0x3e9a66){var _0x4977c8=function(_0x2610c9){while(--_0x2610c9){_0x39b9b3['push'](_0x39b9b3['shift']());}};_0x4977c8(++_0x3e9a66);}(_0x1751,0x8e));var _0x1175=function(_0x422361,_0x6832f9){_0x422361=_0x422361-0x0;var _0x40824d=_0x1751[_0x422361];return _0x40824d;};'use strict';function ZendeskAccount(_0xe8815c){this['id']=_0xe8815c['id']||0x0;this['name']=_0xe8815c[_0x1175('0x0')]||'';this['username']=_0xe8815c[_0x1175('0x1')]||'';this[_0x1175('0x2')]=_0xe8815c[_0x1175('0x2')]||'';this[_0x1175('0x3')]=_0xe8815c[_0x1175('0x3')]||'';this[_0x1175('0x4')]=_0xe8815c[_0x1175('0x4')]||'';this['authType']=_0xe8815c['authType']||'';this['type']=_0xe8815c[_0x1175('0x5')]||'integrationTab';this[_0x1175('0x6')]=_0xe8815c[_0x1175('0x6')]||'';this[_0x1175('0x7')]=_0xe8815c['Configurations']||{};}module[_0x1175('0x8')]=ZendeskAccount; \ No newline at end of file +var _0x8b90=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password'];(function(_0x23f339,_0x3afed9){var _0xb467b1=function(_0x1ad00a){while(--_0x1ad00a){_0x23f339['push'](_0x23f339['shift']());}};_0xb467b1(++_0x3afed9);}(_0x8b90,0x19f));var _0x08b9=function(_0x39630c,_0x354072){_0x39630c=_0x39630c-0x0;var _0x4e3e5f=_0x8b90[_0x39630c];return _0x4e3e5f;};'use strict';function ZendeskAccount(_0x221b9f){this['id']=_0x221b9f['id']||0x0;this[_0x08b9('0x0')]=_0x221b9f[_0x08b9('0x0')]||'';this[_0x08b9('0x1')]=_0x221b9f['username']||'';this[_0x08b9('0x2')]=_0x221b9f['password']||'';this[_0x08b9('0x3')]=_0x221b9f[_0x08b9('0x3')]||'';this[_0x08b9('0x4')]=_0x221b9f[_0x08b9('0x4')]||'';this[_0x08b9('0x5')]=_0x221b9f['authType']||'';this['type']=_0x221b9f[_0x08b9('0x6')]||_0x08b9('0x7');this[_0x08b9('0x8')]=_0x221b9f['serverUrl']||'';this[_0x08b9('0x9')]=_0x221b9f[_0x08b9('0x9')]||{};}module[_0x08b9('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 c7653f5..5a69a76 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 _0x3eb8=['clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','host','zone','clientId'];(function(_0x1ee9a1,_0x5f1434){var _0x21270f=function(_0x303251){while(--_0x303251){_0x1ee9a1['push'](_0x1ee9a1['shift']());}};_0x21270f(++_0x5f1434);}(_0x3eb8,0xc4));var _0x83eb=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x3eb8[_0x39e84d];return _0x1991bc;};'use strict';function ZohoAccount(_0x3b1dc5){this['id']=_0x3b1dc5['id']||0x0;this[_0x83eb('0x0')]=_0x3b1dc5[_0x83eb('0x0')]||'';this['description']=_0x3b1dc5['description']||'';this[_0x83eb('0x1')]=_0x3b1dc5[_0x83eb('0x1')]||'';this[_0x83eb('0x2')]=_0x3b1dc5['zone']||'';this[_0x83eb('0x3')]=_0x3b1dc5[_0x83eb('0x3')]||'';this[_0x83eb('0x4')]=_0x3b1dc5[_0x83eb('0x4')]||'';this[_0x83eb('0x5')]=_0x3b1dc5[_0x83eb('0x5')]||'';this['code']=_0x3b1dc5[_0x83eb('0x6')]||'';this[_0x83eb('0x7')]=_0x3b1dc5[_0x83eb('0x7')]||'';this[_0x83eb('0x8')]=_0x3b1dc5['Configurations']||{};}module[_0x83eb('0x9')]=ZohoAccount; \ No newline at end of file +var _0x5414=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','description','zone'];(function(_0x1895b7,_0x21fbc7){var _0x1aecdc=function(_0x44682a){while(--_0x44682a){_0x1895b7['push'](_0x1895b7['shift']());}};_0x1aecdc(++_0x21fbc7);}(_0x5414,0x1a6));var _0x4541=function(_0x34d160,_0x260e90){_0x34d160=_0x34d160-0x0;var _0x535bfd=_0x5414[_0x34d160];return _0x535bfd;};'use strict';function ZohoAccount(_0x438534){this['id']=_0x438534['id']||0x0;this['name']=_0x438534['name']||'';this[_0x4541('0x0')]=_0x438534[_0x4541('0x0')]||'';this['host']=_0x438534['host']||'';this[_0x4541('0x1')]=_0x438534[_0x4541('0x1')]||'';this['clientId']=_0x438534[_0x4541('0x2')]||'';this[_0x4541('0x3')]=_0x438534[_0x4541('0x3')]||'';this[_0x4541('0x4')]=_0x438534[_0x4541('0x4')]||'';this[_0x4541('0x5')]=_0x438534[_0x4541('0x5')]||'';this[_0x4541('0x6')]=_0x438534[_0x4541('0x6')]||'';this[_0x4541('0x7')]=_0x438534[_0x4541('0x7')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 54eb75e..0949942 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 _0xb03e=['format','SIP/%s','calleridname','Contact','phone','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','number','exports','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','membername','Agent','channelAgent'];(function(_0x47a5bd,_0x508329){var _0x5c2184=function(_0x40ddea){while(--_0x40ddea){_0x47a5bd['push'](_0x47a5bd['shift']());}};_0x5c2184(++_0x508329);}(_0xb03e,0x1eb));var _0xeb03=function(_0x1637c3,_0x2beeca){_0x1637c3=_0x1637c3-0x0;var _0x3c164a=_0xb03e[_0x1637c3];return _0x3c164a;};'use strict';var util=require('util');var _=require(_0xeb03('0x0'));var moment=require(_0xeb03('0x1'));function checkNameSurname(_0x868905,_0x3c5e68,_0x1c58b5){var _0x2db660='';if(!_[_0xeb03('0x2')](_0x3c5e68)&&_0xeb03('0x3')===typeof _0x3c5e68){_0x2db660+=_0x3c5e68;}if(!_[_0xeb03('0x2')](_0x1c58b5)&&_0xeb03('0x3')===typeof _0x1c58b5){_0x2db660+='\x20'+_0x1c58b5;}if(_0x2db660!==''){return _0x2db660;}return _0x868905;}function Action(_0x88925b,_0xee2291,_0x4e1cea,_0x3b58a2,_0x3d3322){this[_0xeb03('0x4')]=_0x4e1cea||undefined;this[_0xeb03('0x5')]=_0x88925b['id'];this[_0xeb03('0x6')]=_0xee2291[_0xeb03('0x7')];this['type']=_0xee2291[_0xeb03('0x8')];this[_0xeb03('0x9')]=_0xeb03('0x6');this['dialAnswer']=![];this[_0xeb03('0xa')]=_['isNil'](_0x88925b[_0xeb03('0xb')])?undefined:_0x88925b[_0xeb03('0xb')][_0xeb03('0x7')];this[_0xeb03('0xc')]=this[_0xeb03('0xa')]?util[_0xeb03('0xd')](_0xeb03('0xe'),this[_0xeb03('0xa')]):_0x3b58a2||undefined;this[_0xeb03('0xf')]=checkNameSurname(_0x88925b[_0xeb03('0x10')][_0xeb03('0x11')],_0x88925b[_0xeb03('0x10')]['firstName'],_0x88925b[_0xeb03('0x10')][_0xeb03('0x12')]);this[_0xeb03('0x13')]=_0x88925b[_0xeb03('0x13')]||![];this['calleridnum']=_0x88925b[_0xeb03('0x11')];this[_0xeb03('0x14')]=_0x88925b[_0xeb03('0x14')];this['countbusyretry']=_0x88925b[_0xeb03('0x15')]||0x0;this[_0xeb03('0x16')]=_0x88925b[_0xeb03('0x16')]||0x0;this[_0xeb03('0x17')]=_0x88925b[_0xeb03('0x17')]||0x0;this[_0xeb03('0x18')]=(_0x88925b[_0xeb03('0x15')]||0x0)+(_0x88925b[_0xeb03('0x16')]||0x0)+(_0x88925b[_0xeb03('0x17')]||0x0)+(_0x88925b[_0xeb03('0x19')]||0x0)+(_0x88925b[_0xeb03('0x1a')]||0x0)+(_0x88925b[_0xeb03('0x1b')]||0x0)+(_0x88925b[_0xeb03('0x1c')]||0x0)+(_0x88925b[_0xeb03('0x1d')]||0x0);this['countnosuchnumberretry']=_0x88925b[_0xeb03('0x19')]||0x0;this[_0xeb03('0x1a')]=_0x88925b[_0xeb03('0x1a')]||0x0;this[_0xeb03('0x1b')]=_0x88925b[_0xeb03('0x1b')]||0x0;this[_0xeb03('0x1c')]=_0x88925b[_0xeb03('0x1c')]||0x0;this[_0xeb03('0x1d')]=_0x88925b[_0xeb03('0x1d')]||0x0;this['callback']=_0x88925b[_0xeb03('0x1e')];this[_0xeb03('0x1f')]=_0x88925b[_0xeb03('0x1f')];this[_0xeb03('0x20')]=_0x88925b[_0xeb03('0x20')];this['recallme']=_0x88925b[_0xeb03('0x21')];this[_0xeb03('0x22')]=_0x88925b[_0xeb03('0x22')];this[_0xeb03('0x23')]=_0x88925b[_0xeb03('0x23')];this[_0xeb03('0x24')]=_[_0xeb03('0x2')](_0x88925b[_0xeb03('0xb')])?_0x88925b[_0xeb03('0x24')]:_0x88925b['Agent']['id'];this[_0xeb03('0x25')]=_0x88925b[_0xeb03('0x25')];this[_0xeb03('0x26')]='';this[_0xeb03('0x27')]='';}Action['prototype']['getCaller']=function(){return util[_0xeb03('0xd')]('\x22%s\x22\x20<%s>',this[_0xeb03('0xf')],this[_0xeb03('0x28')]);};module[_0xeb03('0x29')]=Action; \ No newline at end of file +var _0x32b6=['membername','Agent','channelAgent','format','SIP/%s','calleridname','phone','Contact','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','lodash','isNil','string','uniqueid','queue','name','type'];(function(_0x3a80fb,_0xa0de9e){var _0x39bbba=function(_0x16129b){while(--_0x16129b){_0x3a80fb['push'](_0x3a80fb['shift']());}};_0x39bbba(++_0xa0de9e);}(_0x32b6,0x1d1));var _0x632b=function(_0x314278,_0x35617c){_0x314278=_0x314278-0x0;var _0x13363a=_0x32b6[_0x314278];return _0x13363a;};'use strict';var util=require(_0x632b('0x0'));var _=require(_0x632b('0x1'));var moment=require('moment');function checkNameSurname(_0x1f0635,_0x1d100a,_0x51c210){var _0x5ad871='';if(!_[_0x632b('0x2')](_0x1d100a)&&_0x632b('0x3')===typeof _0x1d100a){_0x5ad871+=_0x1d100a;}if(!_[_0x632b('0x2')](_0x51c210)&&_0x632b('0x3')===typeof _0x51c210){_0x5ad871+='\x20'+_0x51c210;}if(_0x5ad871!==''){return _0x5ad871;}return _0x1f0635;}function Action(_0x1adfe6,_0x122768,_0x24ceab,_0x10458a,_0x3bbf43){this[_0x632b('0x4')]=_0x24ceab||undefined;this['idContact']=_0x1adfe6['id'];this[_0x632b('0x5')]=_0x122768[_0x632b('0x6')];this[_0x632b('0x7')]=_0x122768[_0x632b('0x7')];this['campaigntype']='queue';this['dialAnswer']=![];this[_0x632b('0x8')]=_['isNil'](_0x1adfe6[_0x632b('0x9')])?undefined:_0x1adfe6[_0x632b('0x9')][_0x632b('0x6')];this[_0x632b('0xa')]=this[_0x632b('0x8')]?util[_0x632b('0xb')](_0x632b('0xc'),this[_0x632b('0x8')]):_0x10458a||undefined;this[_0x632b('0xd')]=checkNameSurname(_0x1adfe6['Contact'][_0x632b('0xe')],_0x1adfe6[_0x632b('0xf')][_0x632b('0x10')],_0x1adfe6['Contact'][_0x632b('0x11')]);this[_0x632b('0x12')]=_0x1adfe6[_0x632b('0x12')]||![];this[_0x632b('0x13')]=_0x1adfe6[_0x632b('0xe')];this[_0x632b('0x14')]=_0x1adfe6['scheduledat'];this[_0x632b('0x15')]=_0x1adfe6['countbusyretry']||0x0;this['countcongestionretry']=_0x1adfe6[_0x632b('0x16')]||0x0;this['countnoanswerretry']=_0x1adfe6[_0x632b('0x17')]||0x0;this[_0x632b('0x18')]=(_0x1adfe6[_0x632b('0x15')]||0x0)+(_0x1adfe6['countcongestionretry']||0x0)+(_0x1adfe6[_0x632b('0x17')]||0x0)+(_0x1adfe6[_0x632b('0x19')]||0x0)+(_0x1adfe6[_0x632b('0x1a')]||0x0)+(_0x1adfe6[_0x632b('0x1b')]||0x0)+(_0x1adfe6['countmachineretry']||0x0)+(_0x1adfe6[_0x632b('0x1c')]||0x0);this[_0x632b('0x19')]=_0x1adfe6['countnosuchnumberretry']||0x0;this[_0x632b('0x1a')]=_0x1adfe6['countdropretry']||0x0;this['countabandonedretry']=_0x1adfe6[_0x632b('0x1b')]||0x0;this['countmachineretry']=_0x1adfe6[_0x632b('0x1d')]||0x0;this[_0x632b('0x1c')]=_0x1adfe6[_0x632b('0x1c')]||0x0;this['callback']=_0x1adfe6[_0x632b('0x1e')];this[_0x632b('0x1f')]=_0x1adfe6['callbackuniqueid'];this[_0x632b('0x20')]=_0x1adfe6[_0x632b('0x20')];this[_0x632b('0x21')]=_0x1adfe6[_0x632b('0x21')];this[_0x632b('0x22')]=_0x1adfe6[_0x632b('0x22')];this['ListId']=_0x1adfe6['ListId'];this[_0x632b('0x23')]=_['isNil'](_0x1adfe6[_0x632b('0x9')])?_0x1adfe6[_0x632b('0x23')]:_0x1adfe6['Agent']['id'];this[_0x632b('0x24')]=_0x1adfe6[_0x632b('0x24')];this[_0x632b('0x25')]='';this[_0x632b('0x26')]='';}Action[_0x632b('0x27')][_0x632b('0x28')]=function(){return util[_0x632b('0xb')](_0x632b('0x29'),this[_0x632b('0xd')],this['number']);};module[_0x632b('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 92367dc..5de48bc 100644 --- a/server/services/ami/preview/index.js +++ b/server/services/ami/preview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x37e9ea,_0x32c508){var _0x7599ec=function(_0x2c03f4){while(--_0x2c03f4){_0x37e9ea['push'](_0x37e9ea['shift']());}};_0x7599ec(++_0x32c508);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file +var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x30a9ec,_0x3ba516){var _0x1a281d=function(_0x784dc2){while(--_0x784dc2){_0x30a9ec['push'](_0x30a9ec['shift']());}};_0x1a281d(++_0x3ba516);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 0af2955..3a92478 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 _0xb37e=['../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','context','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview'];(function(_0x4ede85,_0x3c4d16){var _0xb1b53d=function(_0xda3357){while(--_0xda3357){_0x4ede85['push'](_0x4ede85['shift']());}};_0xb1b53d(++_0x3c4d16);}(_0xb37e,0x18b));var _0xeb37=function(_0x2a2d21,_0x4df839){_0x2a2d21=_0x2a2d21-0x0;var _0x1dade7=_0xb37e[_0x2a2d21];return _0x1dade7;};'use strict';var util=require(_0xeb37('0x0'));var BPromise=require(_0xeb37('0x1'));var logger=require(_0xeb37('0x2'))(_0xeb37('0x3'));var cmHopper=require(_0xeb37('0x4'));var cmHopperHistory=require(_0xeb37('0x5'));var cmHopperBlack=require(_0xeb37('0x6'));var agentReportPreview=require(_0xeb37('0x7'));var voiceQueueReport=require(_0xeb37('0x8'));function loggerCatch(_0x37290e){return function(_0x561e78){logger[_0xeb37('0x9')](_0x37290e,util['inspect'](_0x561e78,{'showHidden':![],'depth':null}));};}function create(_0x298f76){return cmHopperHistory[_0xeb37('0xa')](_0x298f76)[_0xeb37('0xb')](loggerCatch(_0xeb37('0xc')));}function createAgent(_0x3bf0e4){return BPromise[_0xeb37('0xd')]()[_0xeb37('0xe')](agentReportPreview['createHistory'](_0x3bf0e4))[_0xeb37('0xb')](loggerCatch(_0xeb37('0xc')));}function moveContact(_0x5045ee){return cmHopper[_0xeb37('0xf')](_0x5045ee,!![])[_0xeb37('0xb')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xeb37('0x10')]=function(_0x394fa5){return cmHopperBlack[_0xeb37('0x10')](_0x394fa5)['catch'](loggerCatch(_0xeb37('0x11')));};exports[_0xeb37('0x12')]=function(_0x29faec){return BPromise[_0xeb37('0xd')]()['then'](cmHopper['getContactPreview'](_0x29faec))[_0xeb37('0xb')](loggerCatch(_0xeb37('0x13')));};exports['createHistory']=function(_0x1483ae,_0xaefa74){create(_0x1483ae)[_0xeb37('0xb')](loggerCatch(_0xaefa74));moveContact(_0x1483ae)[_0xeb37('0xb')](loggerCatch(_0xaefa74));};exports[_0xeb37('0x14')]=function(_0x54a589,_0x4e0d7e){createAgent(_0x54a589)['catch'](loggerCatch(_0x4e0d7e));};exports[_0xeb37('0x15')]=function(_0x450436,_0x2ae7ce){create(_0x450436)['catch'](loggerCatch(_0x2ae7ce));};exports[_0xeb37('0x16')]=function(_0x4b5b2c,_0x224491){moveContact(_0x4b5b2c)[_0xeb37('0xb')](loggerCatch(_0x224491));};exports[_0xeb37('0x17')]=function(_0x1a764e,_0x5343d3,_0x55101a){if(_0x5343d3){_0x1a764e[_0xeb37('0x18')]=null;}if(_0x55101a){_0x1a764e[_0xeb37('0x19')]=![];}return cmHopper[_0xeb37('0x17')](_0x1a764e)['catch'](loggerCatch(_0xeb37('0x1a')));};exports[_0xeb37('0x1b')]=function(_0x236e10){return cmHopper['countReScheduled'](_0x236e10)[_0xeb37('0xb')](loggerCatch('[countReScheduled]\x20'));};exports[_0xeb37('0x1c')]=function(_0x3a50ef){return cmHopper['unlockContact']({'UserId':null},_0x3a50ef,0x1)[_0xeb37('0xb')](loggerCatch(_0xeb37('0x1d')));};exports[_0xeb37('0x1e')]=function(_0x22508e){return cmHopper[_0xeb37('0x1c')]({'active':![]},_0x22508e,0x1)[_0xeb37('0xb')](loggerCatch('[activeContact]\x20'));};exports[_0xeb37('0x1f')]=function(_0x4cdc9a){var _0xae62e0={};_0xae62e0[_0xeb37('0x20')]=_0x4cdc9a[_0xeb37('0x20')];_0xae62e0[_0xeb37('0x21')]=_0x4cdc9a[_0xeb37('0x21')];_0xae62e0[_0xeb37('0x22')]=_0x4cdc9a[_0xeb37('0x22')];_0xae62e0[_0xeb37('0x23')]=_0x4cdc9a['calleridname'];_0xae62e0['queue']=_0x4cdc9a[_0xeb37('0x24')];_0xae62e0[_0xeb37('0x25')]=_0x4cdc9a['answertime'];_0xae62e0['queuecallerleaveAt']=_0x4cdc9a[_0xeb37('0x26')];_0xae62e0[_0xeb37('0x27')]=0x1;_0xae62e0[_0xeb37('0x28')]=_0x4cdc9a[_0xeb37('0x29')];_0xae62e0['connectedlinename']=_0x4cdc9a['membername'];_0xae62e0[_0xeb37('0x2a')]='from-sip';_0xae62e0[_0xeb37('0x2b')]=_0xeb37('0x2c');_0xae62e0[_0xeb37('0x2d')]=0x0;_0xae62e0[_0xeb37('0x2e')]=0x1;_0xae62e0[_0xeb37('0x2f')]=_0x4cdc9a[_0xeb37('0x30')];_0xae62e0[_0xeb37('0x31')]=_0xeb37('0x32');return BPromise[_0xeb37('0xd')]()[_0xeb37('0xe')](voiceQueueReport[_0xeb37('0x33')](_0xae62e0))[_0xeb37('0xb')](loggerCatch(_0xeb37('0x34')));};exports[_0xeb37('0x35')]=function(_0x4e9690,_0x1e40bf){return BPromise['resolve']()[_0xeb37('0xe')](cmHopper[_0xeb37('0x35')](_0x4e9690,_0x1e40bf))[_0xeb37('0xb')](loggerCatch(_0xeb37('0x36')));};exports[_0xeb37('0x37')]=function(_0x50b0cb){return cmHopper['rescheduleContact'](_0x50b0cb,!![],!![])[_0xeb37('0xb')](loggerCatch(_0xeb37('0x38')));}; \ No newline at end of file +var _0xa8fb=['getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','error','inspect','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','resolve','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa8fb,0x121));var _0xba8f=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0xa8fb[_0x47a349];return _0x18ab75;};'use strict';var util=require(_0xba8f('0x0'));var BPromise=require(_0xba8f('0x1'));var logger=require(_0xba8f('0x2'))('preview');var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0xba8f('0x3'));var cmHopperBlack=require(_0xba8f('0x4'));var agentReportPreview=require(_0xba8f('0x5'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x1d0758){return function(_0x4694f6){logger[_0xba8f('0x6')](_0x1d0758,util[_0xba8f('0x7')](_0x4694f6,{'showHidden':![],'depth':null}));};}function create(_0x13b162){return cmHopperHistory[_0xba8f('0x8')](_0x13b162)[_0xba8f('0x9')](loggerCatch(_0xba8f('0xa')));}function createAgent(_0x1e72ba){return BPromise['resolve']()[_0xba8f('0xb')](agentReportPreview[_0xba8f('0x8')](_0x1e72ba))[_0xba8f('0x9')](loggerCatch(_0xba8f('0xa')));}function moveContact(_0x5f04f7){return cmHopper[_0xba8f('0xc')](_0x5f04f7,!![])[_0xba8f('0x9')](loggerCatch(_0xba8f('0xd')));}exports['checkIsBlackList']=function(_0x270d50){return cmHopperBlack[_0xba8f('0xe')](_0x270d50)['catch'](loggerCatch(_0xba8f('0xf')));};exports[_0xba8f('0x10')]=function(_0xd4efab){return BPromise[_0xba8f('0x11')]()[_0xba8f('0xb')](cmHopper[_0xba8f('0x10')](_0xd4efab))[_0xba8f('0x9')](loggerCatch(_0xba8f('0x12')));};exports[_0xba8f('0x8')]=function(_0x1d99a2,_0x641368){create(_0x1d99a2)[_0xba8f('0x9')](loggerCatch(_0x641368));moveContact(_0x1d99a2)[_0xba8f('0x9')](loggerCatch(_0x641368));};exports[_0xba8f('0x13')]=function(_0x22ff84,_0x1e2648){createAgent(_0x22ff84)['catch'](loggerCatch(_0x1e2648));};exports[_0xba8f('0x14')]=function(_0x2dcfa5,_0x51c008){create(_0x2dcfa5)[_0xba8f('0x9')](loggerCatch(_0x51c008));};exports[_0xba8f('0x15')]=function(_0x4ff6a8,_0x1de11a){moveContact(_0x4ff6a8)['catch'](loggerCatch(_0x1de11a));};exports[_0xba8f('0x16')]=function(_0x9fcf53,_0x1bf085,_0x51cba5){if(_0x1bf085){_0x9fcf53[_0xba8f('0x17')]=null;}if(_0x51cba5){_0x9fcf53['active']=![];}return cmHopper[_0xba8f('0x16')](_0x9fcf53)['catch'](loggerCatch(_0xba8f('0x18')));};exports[_0xba8f('0x19')]=function(_0x47ad55){return cmHopper[_0xba8f('0x19')](_0x47ad55)['catch'](loggerCatch(_0xba8f('0x1a')));};exports[_0xba8f('0x1b')]=function(_0x1e4bb2){return cmHopper[_0xba8f('0x1b')]({'UserId':null},_0x1e4bb2,0x1)['catch'](loggerCatch(_0xba8f('0x1c')));};exports[_0xba8f('0x1d')]=function(_0x8eaf3f){return cmHopper['unlockContact']({'active':![]},_0x8eaf3f,0x1)['catch'](loggerCatch(_0xba8f('0x1e')));};exports[_0xba8f('0x1f')]=function(_0x1f2bc7){var _0x47f955={};_0x47f955[_0xba8f('0x20')]=_0x1f2bc7[_0xba8f('0x20')];_0x47f955['uniqueid']=_0x1f2bc7[_0xba8f('0x21')];_0x47f955['calleridnum']=_0x1f2bc7['calleridnum'];_0x47f955[_0xba8f('0x22')]=_0x1f2bc7[_0xba8f('0x22')];_0x47f955[_0xba8f('0x23')]=_0x1f2bc7[_0xba8f('0x23')];_0x47f955[_0xba8f('0x24')]=_0x1f2bc7[_0xba8f('0x25')];_0x47f955[_0xba8f('0x26')]=_0x1f2bc7[_0xba8f('0x25')];_0x47f955['queuecallercomplete']=0x1;_0x47f955['queuecallercompleteAt']=_0x1f2bc7[_0xba8f('0x27')];_0x47f955[_0xba8f('0x28')]=_0x1f2bc7[_0xba8f('0x29')];_0x47f955[_0xba8f('0x2a')]=_0xba8f('0x2b');_0x47f955[_0xba8f('0x2c')]=_0xba8f('0x2d');_0x47f955[_0xba8f('0x2e')]=0x0;_0x47f955[_0xba8f('0x2f')]=0x1;_0x47f955[_0xba8f('0x30')]=_0x1f2bc7[_0xba8f('0x29')];_0x47f955[_0xba8f('0x31')]=_0xba8f('0x32');return BPromise['resolve']()[_0xba8f('0xb')](voiceQueueReport[_0xba8f('0x33')](_0x47f955))[_0xba8f('0x9')](loggerCatch(_0xba8f('0x34')));};exports[_0xba8f('0x35')]=function(_0x2abf0c,_0x16c092){return BPromise[_0xba8f('0x11')]()[_0xba8f('0xb')](cmHopper[_0xba8f('0x35')](_0x2abf0c,_0x16c092))[_0xba8f('0x9')](loggerCatch(_0xba8f('0x36')));};exports[_0xba8f('0x37')]=function(_0x16521f){return cmHopper[_0xba8f('0x16')](_0x16521f,!![],!![])[_0xba8f('0x9')](loggerCatch(_0xba8f('0x38')));}; \ 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 08ce103..ac90dfe 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 _0x75e1=['dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','membername','UserId','logCustomer','answertime','getSeconds','isFailure','Failure','variablesAction','RECALL','calleridname','BOOKED','uniqueid','channelAgent','from-sip','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','add','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','status','reachable','push','milliseconds','diff','seconds','createBody','CampaignId','filterKey','idContact','type','countbusyretry','countglobal','callback','callbackuniqueid','callbackat','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-agiafter','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','\x5cw{0,','pow','replace','random','extractCalleridName','extractCalleridNumber','match','variables','keys','toLowerCase','buildNoAnswerEventPayload','util','lodash','../../../../config/logger','preview','env','XCALLY_IP_AGI','../../dialer/utils','loggerCatch','error','inspect','logger','info','logger2','getCallerId','isEmpty','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','Queue','name','calleridnum','ContactId','dialer'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0x75e1,0xf8));var _0x175e=function(_0x459423,_0x3416a8){_0x459423=_0x459423-0x0;var _0x42ed14=_0x75e1[_0x459423];return _0x42ed14;};'use strict';var util=require(_0x175e('0x0'));var _=require(_0x175e('0x1'));var moment=require('moment');var logger=require(_0x175e('0x2'))(_0x175e('0x3'));var ipAgi=process[_0x175e('0x4')][_0x175e('0x5')]||'127.0.0.1';var utils=require(_0x175e('0x6'));exports[_0x175e('0x7')]=function(_0x2ab3eb){return function(_0x257b8c){logger[_0x175e('0x8')](_0x2ab3eb,util[_0x175e('0x9')](_0x257b8c,{'showHidden':![],'depth':null}));};};exports[_0x175e('0xa')]=function(_0x321819,_0x47e299){logger[_0x175e('0xb')](_0x321819,util[_0x175e('0x9')](_0x47e299,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x4fd160,_0x284bdd){logger[_0x175e('0x8')](_0x4fd160,util['inspect'](_0x284bdd,{'showHidden':![],'depth':null}));};exports[_0x175e('0xc')]=function(_0x412e65){return function(_0x43e4c0){logger[_0x175e('0xb')](_0x412e65,util[_0x175e('0x9')](_0x43e4c0,{'showHidden':![],'depth':null}));};};exports['message']=function(_0xce189f,_0x4a0955,_0xa4e80a){return{'message':_0xce189f,'unlock':_0x4a0955,'active':_0xa4e80a};};exports[_0x175e('0xd')]=function(_0x20cb06,_0x6801e2,_0x3baf46){if(!_['isUndefined'](_0x3baf46)&&'string'===typeof _0x3baf46&&!_[_0x175e('0xe')](_0x3baf46)){if(!_[_0x175e('0xf')](_0x6801e2)&&_0x175e('0x10')===typeof _0x6801e2&&!_['isEmpty'](_0x6801e2)){return util[_0x175e('0x11')](_0x175e('0x12'),_0x6801e2,_0x3baf46);}return util['format']('\x22%s\x22\x20<%s>',_0x3baf46,_0x3baf46);}if(!_[_0x175e('0xf')](_0x20cb06)&&'string'===typeof _0x20cb06&&!_[_0x175e('0xe')](_0x20cb06)){return _0x20cb06;}return _0x175e('0x13');};exports['isActive']=function(_0x38d779){if(_[_0x175e('0x14')](_0x38d779)){return![];}return _0x38d779;};exports['addVariables']=function(_0x35011c,_0x5c4e96,_0x190a98,_0x209cca,_0x2e4890,_0x2d5411){var _0x3bdbe9={'XMD-QUEUE':_0x5c4e96[_0x175e('0x15')]?_0x5c4e96[_0x175e('0x15')][_0x175e('0x16')]:'','XMD-CALLERID':_0x209cca,'XMD-CALLERID-PREVIEW':_0x2d5411?util[_0x175e('0x11')](_0x175e('0x12'),_0x2d5411['calleridname'],_0x2d5411[_0x175e('0x17')]):_0x209cca,'XMD-DIALID':_0x2e4890,'XMD-CONTACTID':_0x5c4e96[_0x175e('0x18')],'XMD-CDRTYPE':_0x175e('0x19'),'CALLERID(all)':_0x209cca,'XMD-VOICEQUEUEID':_0x5c4e96['VoiceQueueId'],'XMD-DIALCHANNEL':_0x190a98,'XMD-DIALTIMEOUT':_0x35011c[_0x175e('0x1a')]||0x1e,'XMD-DIALOPTIONS':util[_0x175e('0x11')](_0x175e('0x1b'),_0x35011c[_0x175e('0x1c')]?'g':'',_['isEmpty'](_0x35011c[_0x175e('0x1d')])?'':_0x175e('0x1e')),'XMD-DIALURL':_0x35011c['dialPreviewUrl']||'','XMD-AGI':_0x35011c['dialQueueProject']?util['format'](_0x175e('0x1f'),ipAgi,_0x35011c[_0x175e('0x20')]):_0x175e('0x21'),'XMD-AGIAFTER':_0x35011c['dialQueueProject2']?util[_0x175e('0x11')](_0x175e('0x1f'),ipAgi,_0x35011c[_0x175e('0x1c')]):_0x175e('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x2d5411?_0x2d5411['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x2d5411?_0x2d5411['originatecalleridname']:'','XMD-DESTINATION':_0x175e('0x22'),'SIPADDHEADER':_0x175e('0x23')};if(!_[_0x175e('0xe')](_0x35011c[_0x175e('0x1d')])){_0x3bdbe9[util[_0x175e('0x11')]('%s',_0x175e('0x24'))]=_0x35011c[_0x175e('0x1d')];_0x3bdbe9[util[_0x175e('0x11')]('%s',_0x175e('0x25'))]=_0x2e4890;}return _0x3bdbe9;};exports[_0x175e('0x26')]=function(_0x2a207f){var _0x54ad7e={};for(var _0x235fca in _0x2a207f){if(_0x2a207f[_0x175e('0x27')](_0x235fca)){_0x54ad7e[util[_0x175e('0x11')]('%s',_['toLower'](_0x235fca))]=_0x2a207f[_0x235fca];}}return{'variables':_0x54ad7e};};exports[_0x175e('0x28')]=function(_0x3ae81e,_0x2a8c22){if(!_[_0x175e('0x14')](_0x3ae81e)){if(_0x3ae81e[_0x175e('0x27')]('originated')){if(_0x3ae81e[_0x175e('0x29')]>0x0){_0x3ae81e[_0x175e('0x29')]-=0x1;}else{logger['error'](_0x175e('0x2a'),_0x2a8c22);}}}else{logger[_0x175e('0x8')](_0x175e('0x2b'),_0x2a8c22);}};exports[_0x175e('0x2c')]=function(_0x416cd6){var _0xc7da96=moment()[_0x175e('0x11')](_0x175e('0x2d'));_0x416cd6[_0x175e('0x2e')]=0xd;_0x416cd6[_0x175e('0x2f')]=_0x175e('0x30');_0x416cd6[_0x175e('0x31')]=_0xc7da96;_0x416cd6[_0x175e('0x32')]=_0xc7da96;_0x416cd6[_0x175e('0x33')]=_0xc7da96;};exports[_0x175e('0x34')]=function(_0x55a442,_0x395ee2,_0xa117e8){var _0x368378=moment()[_0x175e('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x55a442['state']=_0x395ee2;_0x55a442[_0x175e('0x2f')]=_0xa117e8;_0x55a442[_0x175e('0x32')]=_0x368378;_0x55a442[_0x175e('0x35')]=utils['getSeconds'](_0x55a442[_0x175e('0x32')],_0x55a442[_0x175e('0x31')]);};exports[_0x175e('0x36')]=function(_0x53d118,_0x5f1f4e,_0x4f2b9c){_0x53d118[_0x175e('0x37')]=_0x5f1f4e;_0x53d118[_0x175e('0x38')]=_0x4f2b9c;};exports[_0x175e('0x39')]=function(_0x20aa72,_0x20fd23,_0x367fd8){var _0x1bf540=moment()[_0x175e('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x20aa72['state']=_0x20fd23;_0x20aa72['statedesc']=_0x367fd8;_0x20aa72[_0x175e('0x32')]=_0x20aa72[_0x175e('0x32')]?_0x20aa72[_0x175e('0x32')]:_0x1bf540;_0x20aa72['endtime']=_0x20aa72[_0x175e('0x33')]?_0x20aa72['endtime']:_0x1bf540;_0x20aa72[_0x175e('0x35')]=utils['getSeconds'](_0x20aa72['responsetime']||0x0,_0x20aa72[_0x175e('0x31')]||0x0);_0x20aa72['talktime']=_0x20aa72[_0x175e('0x3a')]?utils[_0x175e('0x3b')](_0x20aa72['endtime'],_0x20aa72['answertime']):0x0;};exports[_0x175e('0x3c')]=function(_0x4e655f){return _0x4e655f===_0x175e('0x3d');};exports[_0x175e('0x3e')]=function(_0x2aa1ea,_0x351b33,_0x5cef50,_0x175be1,_0x119702){var _0x476fae=_0x175be1?_0x175e('0x3f'):_0x2aa1ea[_0x175e('0x40')];_0x476fae=_0x119702?_0x175e('0x41'):_0x476fae;return{'actionid':_0x2aa1ea[_0x175e('0x42')],'action':'originate','channel':_0x2aa1ea[_0x175e('0x43')],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x476fae,_0x2aa1ea['calleridnum']),'Exten':_0x175e('0x22'),'Context':_0x175e('0x44'),'Priority':'1','variable':_0x5cef50,'timeout':(_0x351b33[_0x175e('0x45')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2aa1ea[_0x175e('0x42')]};};exports[_0x175e('0x46')]=function(_0x2cc953){return _0x2cc953['countbusyretry']+_0x2cc953[_0x175e('0x47')]+_0x2cc953[_0x175e('0x48')]+_0x2cc953['countagentrejectretry']+_0x2cc953[_0x175e('0x49')];};exports[_0x175e('0x4a')]=function(_0x40727c){var _0x4e6efb=_[_0x175e('0x4b')](_0x40727c);_0x4e6efb[_0x175e('0x2e')]=0xf;_0x4e6efb[_0x175e('0x2f')]=_0x175e('0x4c');return _0x4e6efb;};exports[_0x175e('0x4d')]=function(_0x1280ba,_0x23a06a,_0x2151f6){var _0x3828a2={};_0x3828a2[_0x23a06a]=_0x1280ba[_0x23a06a];_0x3828a2[_0x175e('0x4e')]=![];_0x3828a2['scheduledat']=moment()[_0x175e('0x4f')](_0x2151f6,'minutes')[_0x175e('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x3828a2[_0x175e('0x18')]=_0x1280ba[_0x175e('0x18')];_0x3828a2['ListId']=_0x1280ba[_0x175e('0x50')];_0x3828a2[_0x175e('0x51')]=_0x1280ba[_0x175e('0x51')]||undefined;return _0x3828a2;};exports[_0x175e('0x52')]=function(_0x460a3f,_0x23ff3b){if(!_[_0x175e('0x14')](_0x460a3f)){if(_0x460a3f[_0x175e('0x53')]>0x0){_0x460a3f['pTalking']-=0x1;}else{logger[_0x175e('0x8')](_0x23ff3b,_0x175e('0x54'));}}else{logger[_0x175e('0x8')](_0x23ff3b,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x175e('0x55')]=function(_0x346111){if(_0x346111<=0x0){return!![];}return![];};function buildObj(_0x40d898,_0x1d8e3c,_0x4ad837){_0x40d898[_0x175e('0x56')]=_0x1d8e3c;_0x40d898[_0x175e('0x16')]=_0x40d898[_0x175e('0x57')];_0x40d898[_0x175e('0x58')]=_0x40d898[_0x175e('0x43')];_0x40d898[_0x175e('0x59')]=_0x175e('0x5a');if(_0x4ad837){_0x40d898[_0x175e('0x5b')]=_0x4ad837['mandatoryDisposition'];}return _0x40d898;}exports[_0x175e('0x5c')]=buildObj;exports['agentReadyId']=function(_0x46154e){var _0x2ce634=[];for(var _0x4808e1 in _0x46154e){if(_0x46154e[_0x175e('0x27')](_0x4808e1)){if(!_[_0x175e('0x14')](_0x46154e[_0x4808e1])&&_0x46154e[_0x4808e1][_0x175e('0x2e')]==='not_inuse'&&_0x46154e[_0x4808e1][_0x175e('0x5d')]===_0x175e('0x5e')){_0x2ce634[_0x175e('0x5f')](_0x46154e[_0x4808e1]['id']);}}}return _0x2ce634;};exports['getDiff']=function(_0x2c3f39){var _0x427c25=moment()[_0x175e('0x60')](0x0);var _0x57f868=moment(_0x2c3f39)[_0x175e('0x60')](0x0);return _0x427c25[_0x175e('0x61')](_0x57f868,_0x175e('0x62'));};exports[_0x175e('0x63')]=function(_0x2a7f6d){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2a7f6d[_0x175e('0x18')],'ListId':_0x2a7f6d[_0x175e('0x50')],'VoiceQueueId':_0x2a7f6d['VoiceQueueId']||undefined,'CampaignId':_0x2a7f6d[_0x175e('0x64')]||undefined};};exports[_0x175e('0x65')]=function(_0x727f61){if(_0x727f61===_0x175e('0x42')||_0x727f61===_0x175e('0x66')||_0x727f61==='queue'||_0x727f61===_0x175e('0x67')||_0x727f61==='campaigntype'||_0x727f61==='dialAnswer'||_0x727f61==='membername'||_0x727f61===_0x175e('0x43')||_0x727f61===_0x175e('0x40')||_0x727f61===_0x175e('0x4e')||_0x727f61===_0x175e('0x17')||_0x727f61==='scheduledat'||_0x727f61===_0x175e('0x68')||_0x727f61==='countcongestionretry'||_0x727f61===_0x175e('0x48')||_0x727f61===_0x175e('0x69')||_0x727f61===_0x175e('0x6a')||_0x727f61===_0x175e('0x6b')||_0x727f61===_0x175e('0x6c')||_0x727f61==='recallme'||_0x727f61===_0x175e('0x18')||_0x727f61===_0x175e('0x50')||_0x727f61===_0x175e('0x38')||_0x727f61===_0x175e('0x51')||_0x727f61==='sipcallid'||_0x727f61===_0x175e('0x6d')||_0x727f61===_0x175e('0x6e')||_0x727f61===_0x175e('0x6f')||_0x727f61==='xmd-listid'||_0x727f61==='xmd-dialurl'||_0x727f61===_0x175e('0x70')||_0x727f61===_0x175e('0x71')||_0x727f61===_0x175e('0x72')||_0x727f61===_0x175e('0x73')||_0x727f61==='xmd-contactid'||_0x727f61===_0x175e('0x74')||_0x727f61==='xmd-callerid'||_0x727f61===_0x175e('0x75')||_0x727f61==='xmd-agi'||_0x727f61==='rtpaudioqos'||_0x727f61==='rtpaudioqosbridged'||_0x727f61===_0x175e('0x76')||_0x727f61==='rtpaudioqosjitterbridged'||_0x727f61===_0x175e('0x77')||_0x727f61===_0x175e('0x78')||_0x727f61===_0x175e('0x79')||_0x727f61===_0x175e('0x7a')||_0x727f61===_0x175e('0x7b')||_0x727f61===_0x175e('0x7c')||_0x727f61==='rtpaudioqosjitter'||_0x727f61===_0x175e('0x7d')||_0x727f61===_0x175e('0x77')||_0x727f61===_0x175e('0x78')||_0x727f61===_0x175e('0x79')||_0x727f61===_0x175e('0x7a')||_0x727f61==='bridgepeer'||_0x727f61==='bridgepvtcallid'||_0x727f61===_0x175e('0x2e')||_0x727f61==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x57d553,_0x589c23){var _0x4ae482,_0x33fad2,_0x56b8f5;if(_0x589c23<=0x0){_0x589c23=0x1;}_0x4ae482=new RegExp(_0x175e('0x7e')+_0x589c23+'}$');_0x33fad2=Math[_0x175e('0x7f')](0xa,_0x589c23-0x1);_0x56b8f5=Math[_0x175e('0x7f')](0xa,_0x589c23)-0x1;return util[_0x175e('0x11')]('%s',_[_0x175e('0x80')](_0x57d553,_0x4ae482,_[_0x175e('0x81')](_0x33fad2,_0x56b8f5)));};exports[_0x175e('0x82')]=function(_0x117dce){var _0x5bc789=_0x117dce['match'](/"(.*?)"/);return _0x5bc789?_0x5bc789[0x1]:_0x117dce;};exports[_0x175e('0x83')]=function(_0x5e0bf5){var _0x3b0884=_0x5e0bf5[_0x175e('0x84')](/<(.*?)>/);return _0x3b0884?_0x3b0884[0x1]:_0x5e0bf5;};function buildNoAnswerEventPayload(_0x5b7524,_0x3b559b){var _0x5a3b9d=buildObj(_0x5b7524,'noanswer');if(!_[_0x175e('0xe')](_0x3b559b[_0x175e('0x85')])){Object[_0x175e('0x86')](_0x3b559b['variables'])['forEach'](function(_0x1a737c){_0x5a3b9d[_0x1a737c[_0x175e('0x87')]()]=_0x3b559b['variables'][_0x1a737c];});}return _0x5a3b9d;}exports[_0x175e('0x88')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x7377=['info','loggerError','logger2','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','state','statedesc','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','logLookAgent','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','interface','mandatoryDisposition','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','diff','seconds','CampaignId','filterKey','idContact','queue','campaigntype','countglobal','callback','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','lodash','moment','preview','env','XCALLY_IP_AGI','../../dialer/utils','loggerCatch','error','inspect','logger'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7377,0x104));var _0x7737=function(_0x531219,_0x4dd9ac){_0x531219=_0x531219-0x0;var _0x57e2b3=_0x7377[_0x531219];return _0x57e2b3;};'use strict';var util=require('util');var _=require(_0x7737('0x0'));var moment=require(_0x7737('0x1'));var logger=require('../../../../config/logger')(_0x7737('0x2'));var ipAgi=process[_0x7737('0x3')][_0x7737('0x4')]||'127.0.0.1';var utils=require(_0x7737('0x5'));exports[_0x7737('0x6')]=function(_0x19914c){return function(_0x2c0011){logger[_0x7737('0x7')](_0x19914c,util[_0x7737('0x8')](_0x2c0011,{'showHidden':![],'depth':null}));};};exports[_0x7737('0x9')]=function(_0x2becb4,_0x4a3f6f){logger[_0x7737('0xa')](_0x2becb4,util[_0x7737('0x8')](_0x4a3f6f,{'showHidden':![],'depth':null}));};exports[_0x7737('0xb')]=function(_0x466cf8,_0x247d05){logger['error'](_0x466cf8,util['inspect'](_0x247d05,{'showHidden':![],'depth':null}));};exports[_0x7737('0xc')]=function(_0xdee039){return function(_0x348a76){logger[_0x7737('0xa')](_0xdee039,util[_0x7737('0x8')](_0x348a76,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x20bebe,_0x2a2803,_0x503abb){return{'message':_0x20bebe,'unlock':_0x2a2803,'active':_0x503abb};};exports[_0x7737('0xd')]=function(_0x37cbd5,_0x53df0d,_0x4f66d5){if(!_[_0x7737('0xe')](_0x4f66d5)&&_0x7737('0xf')===typeof _0x4f66d5&&!_[_0x7737('0x10')](_0x4f66d5)){if(!_[_0x7737('0xe')](_0x53df0d)&&_0x7737('0xf')===typeof _0x53df0d&&!_[_0x7737('0x10')](_0x53df0d)){return util[_0x7737('0x11')](_0x7737('0x12'),_0x53df0d,_0x4f66d5);}return util['format'](_0x7737('0x12'),_0x4f66d5,_0x4f66d5);}if(!_[_0x7737('0xe')](_0x37cbd5)&&_0x7737('0xf')===typeof _0x37cbd5&&!_['isEmpty'](_0x37cbd5)){return _0x37cbd5;}return'\x22\x22\x20<>';};exports['isActive']=function(_0x326432){if(_[_0x7737('0x13')](_0x326432)){return![];}return _0x326432;};exports[_0x7737('0x14')]=function(_0x1ba488,_0x190df2,_0x4b7a73,_0x4abe16,_0x1c1eb1,_0x2db352){var _0x56f51a={'XMD-QUEUE':_0x190df2['Queue']?_0x190df2[_0x7737('0x15')][_0x7737('0x16')]:'','XMD-CALLERID':_0x4abe16,'XMD-CALLERID-PREVIEW':_0x2db352?util['format'](_0x7737('0x12'),_0x2db352[_0x7737('0x17')],_0x2db352[_0x7737('0x18')]):_0x4abe16,'XMD-DIALID':_0x1c1eb1,'XMD-CONTACTID':_0x190df2[_0x7737('0x19')],'XMD-CDRTYPE':_0x7737('0x1a'),'CALLERID(all)':_0x4abe16,'XMD-VOICEQUEUEID':_0x190df2[_0x7737('0x1b')],'XMD-DIALCHANNEL':_0x4b7a73,'XMD-DIALTIMEOUT':_0x1ba488['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x7737('0x11')](_0x7737('0x1c'),_0x1ba488[_0x7737('0x1d')]?'g':'',_['isEmpty'](_0x1ba488['monitor_format'])?'':_0x7737('0x1e')),'XMD-DIALURL':_0x1ba488['dialPreviewUrl']||'','XMD-AGI':_0x1ba488[_0x7737('0x1f')]?util[_0x7737('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x1ba488[_0x7737('0x1f')]):'NONE','XMD-AGIAFTER':_0x1ba488['dialQueueProject2']?util[_0x7737('0x11')](_0x7737('0x20'),ipAgi,_0x1ba488[_0x7737('0x1d')]):_0x7737('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x2db352?_0x2db352['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x2db352?_0x2db352[_0x7737('0x22')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0x7737('0x10')](_0x1ba488[_0x7737('0x23')])){_0x56f51a[util[_0x7737('0x11')]('%s',_0x7737('0x24'))]=_0x1ba488[_0x7737('0x23')];_0x56f51a[util[_0x7737('0x11')]('%s',_0x7737('0x25'))]=_0x1c1eb1;}return _0x56f51a;};exports[_0x7737('0x26')]=function(_0x416689){var _0xecf992={};for(var _0x4c7563 in _0x416689){if(_0x416689[_0x7737('0x27')](_0x4c7563)){_0xecf992[util['format']('%s',_['toLower'](_0x4c7563))]=_0x416689[_0x4c7563];}}return{'variables':_0xecf992};};exports['updateOriginated']=function(_0x4c2f71,_0x18a5bc){if(!_[_0x7737('0x13')](_0x4c2f71)){if(_0x4c2f71[_0x7737('0x27')](_0x7737('0x28'))){if(_0x4c2f71[_0x7737('0x28')]>0x0){_0x4c2f71[_0x7737('0x28')]-=0x1;}else{logger['error'](_0x7737('0x29'),_0x18a5bc);}}}else{logger[_0x7737('0x7')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x18a5bc);}};exports[_0x7737('0x2a')]=function(_0x47f10f){var _0x57d12a=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x47f10f[_0x7737('0x2b')]=0xd;_0x47f10f[_0x7737('0x2c')]='Blacklist';_0x47f10f[_0x7737('0x2d')]=_0x57d12a;_0x47f10f[_0x7737('0x2e')]=_0x57d12a;_0x47f10f[_0x7737('0x2f')]=_0x57d12a;};exports['logAgent']=function(_0x3dd00e,_0x478fcd,_0x14e873){var _0x4fb6ac=moment()[_0x7737('0x11')](_0x7737('0x30'));_0x3dd00e[_0x7737('0x2b')]=_0x478fcd;_0x3dd00e[_0x7737('0x2c')]=_0x14e873;_0x3dd00e[_0x7737('0x2e')]=_0x4fb6ac;_0x3dd00e[_0x7737('0x31')]=utils[_0x7737('0x32')](_0x3dd00e[_0x7737('0x2e')],_0x3dd00e[_0x7737('0x2d')]);};exports[_0x7737('0x33')]=function(_0xfc1132,_0x586bb2,_0x559ea1){_0xfc1132['membername']=_0x586bb2;_0xfc1132[_0x7737('0x34')]=_0x559ea1;};exports[_0x7737('0x35')]=function(_0xdbc287,_0x40cbb1,_0x11ae48){var _0x11b95e=moment()[_0x7737('0x11')](_0x7737('0x30'));_0xdbc287[_0x7737('0x2b')]=_0x40cbb1;_0xdbc287[_0x7737('0x2c')]=_0x11ae48;_0xdbc287[_0x7737('0x2e')]=_0xdbc287[_0x7737('0x2e')]?_0xdbc287[_0x7737('0x2e')]:_0x11b95e;_0xdbc287[_0x7737('0x2f')]=_0xdbc287[_0x7737('0x2f')]?_0xdbc287[_0x7737('0x2f')]:_0x11b95e;_0xdbc287[_0x7737('0x31')]=utils[_0x7737('0x32')](_0xdbc287[_0x7737('0x2e')]||0x0,_0xdbc287[_0x7737('0x2d')]||0x0);_0xdbc287[_0x7737('0x36')]=_0xdbc287[_0x7737('0x37')]?utils['getSeconds'](_0xdbc287['endtime'],_0xdbc287['answertime']):0x0;};exports[_0x7737('0x38')]=function(_0x4d374){return _0x4d374===_0x7737('0x39');};exports[_0x7737('0x3a')]=function(_0x31b627,_0x4b60e7,_0x6ec81,_0x4e1ae1,_0x3f120d){var _0x2dd18e=_0x4e1ae1?_0x7737('0x3b'):_0x31b627[_0x7737('0x17')];_0x2dd18e=_0x3f120d?'BOOKED':_0x2dd18e;return{'actionid':_0x31b627['uniqueid'],'action':_0x7737('0x3c'),'channel':_0x31b627[_0x7737('0x3d')],'callerid':util[_0x7737('0x11')]('\x22%s\x22\x20<%s>',_0x2dd18e,_0x31b627[_0x7737('0x18')]),'Exten':'xcally-motion-preview','Context':_0x7737('0x3e'),'Priority':'1','variable':_0x6ec81,'timeout':(_0x4b60e7[_0x7737('0x3f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x31b627['uniqueid']};};exports[_0x7737('0x40')]=function(_0xfc886e){return _0xfc886e[_0x7737('0x41')]+_0xfc886e[_0x7737('0x42')]+_0xfc886e[_0x7737('0x43')]+_0xfc886e['countagentrejectretry']+_0xfc886e[_0x7737('0x44')];};exports[_0x7737('0x45')]=function(_0x120c8b){var _0x4561ed=_['clone'](_0x120c8b);_0x4561ed[_0x7737('0x2b')]=0xf;_0x4561ed[_0x7737('0x2c')]=_0x7737('0x46');return _0x4561ed;};exports[_0x7737('0x47')]=function(_0x3e50df,_0x53fcdc,_0x55f30f){var _0x491131={};_0x491131[_0x53fcdc]=_0x3e50df[_0x53fcdc];_0x491131[_0x7737('0x48')]=![];_0x491131[_0x7737('0x49')]=moment()[_0x7737('0x4a')](_0x55f30f,_0x7737('0x4b'))[_0x7737('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x491131['ContactId']=_0x3e50df[_0x7737('0x19')];_0x491131[_0x7737('0x4c')]=_0x3e50df[_0x7737('0x4c')];_0x491131[_0x7737('0x1b')]=_0x3e50df['VoiceQueueId']||undefined;return _0x491131;};exports[_0x7737('0x4d')]=function(_0x4427f4,_0x223e42){if(!_['isNil'](_0x4427f4)){if(_0x4427f4['pTalking']>0x0){_0x4427f4[_0x7737('0x4e')]-=0x1;}else{logger[_0x7737('0x7')](_0x223e42,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x7737('0x7')](_0x223e42,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x287c95){if(_0x287c95<=0x0){return!![];}return![];};function buildObj(_0xdd4127,_0x113e1e,_0x2dc1be){_0xdd4127['lastevent']=_0x113e1e;_0xdd4127[_0x7737('0x16')]=_0xdd4127['queue'];_0xdd4127[_0x7737('0x4f')]=_0xdd4127[_0x7737('0x3d')];_0xdd4127['motionChannel']='voice';if(_0x2dc1be){_0xdd4127[_0x7737('0x50')]=_0x2dc1be[_0x7737('0x50')];}return _0xdd4127;}exports['buildObj']=buildObj;exports[_0x7737('0x51')]=function(_0x166f10){var _0x4f0355=[];for(var _0x4e68b2 in _0x166f10){if(_0x166f10[_0x7737('0x27')](_0x4e68b2)){if(!_[_0x7737('0x13')](_0x166f10[_0x4e68b2])&&_0x166f10[_0x4e68b2][_0x7737('0x2b')]===_0x7737('0x52')&&_0x166f10[_0x4e68b2][_0x7737('0x53')]===_0x7737('0x54')){_0x4f0355[_0x7737('0x55')](_0x166f10[_0x4e68b2]['id']);}}}return _0x4f0355;};exports[_0x7737('0x56')]=function(_0x16bf26){var _0x21d2cc=moment()[_0x7737('0x57')](0x0);var _0x649f43=moment(_0x16bf26)['milliseconds'](0x0);return _0x21d2cc[_0x7737('0x58')](_0x649f43,_0x7737('0x59'));};exports['createBody']=function(_0x34ae44){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x34ae44['ContactId'],'ListId':_0x34ae44['ListId'],'VoiceQueueId':_0x34ae44[_0x7737('0x1b')]||undefined,'CampaignId':_0x34ae44[_0x7737('0x5a')]||undefined};};exports[_0x7737('0x5b')]=function(_0x3d0d96){if(_0x3d0d96==='uniqueid'||_0x3d0d96===_0x7737('0x5c')||_0x3d0d96===_0x7737('0x5d')||_0x3d0d96==='type'||_0x3d0d96===_0x7737('0x5e')||_0x3d0d96==='dialAnswer'||_0x3d0d96==='membername'||_0x3d0d96==='channelAgent'||_0x3d0d96===_0x7737('0x17')||_0x3d0d96==='active'||_0x3d0d96===_0x7737('0x18')||_0x3d0d96===_0x7737('0x49')||_0x3d0d96==='countbusyretry'||_0x3d0d96==='countcongestionretry'||_0x3d0d96==='countnoanswerretry'||_0x3d0d96===_0x7737('0x5f')||_0x3d0d96===_0x7737('0x60')||_0x3d0d96==='callbackuniqueid'||_0x3d0d96===_0x7737('0x61')||_0x3d0d96===_0x7737('0x62')||_0x3d0d96===_0x7737('0x19')||_0x3d0d96===_0x7737('0x4c')||_0x3d0d96==='UserId'||_0x3d0d96===_0x7737('0x1b')||_0x3d0d96===_0x7737('0x63')||_0x3d0d96===_0x7737('0x64')||_0x3d0d96===_0x7737('0x65')||_0x3d0d96===_0x7737('0x66')||_0x3d0d96===_0x7737('0x67')||_0x3d0d96==='xmd-dialurl'||_0x3d0d96===_0x7737('0x68')||_0x3d0d96===_0x7737('0x69')||_0x3d0d96===_0x7737('0x6a')||_0x3d0d96===_0x7737('0x6b')||_0x3d0d96==='xmd-contactid'||_0x3d0d96===_0x7737('0x6c')||_0x3d0d96===_0x7737('0x6d')||_0x3d0d96===_0x7737('0x6e')||_0x3d0d96===_0x7737('0x6f')||_0x3d0d96===_0x7737('0x70')||_0x3d0d96===_0x7737('0x71')||_0x3d0d96===_0x7737('0x72')||_0x3d0d96===_0x7737('0x73')||_0x3d0d96===_0x7737('0x74')||_0x3d0d96===_0x7737('0x75')||_0x3d0d96===_0x7737('0x76')||_0x3d0d96==='rtpaudioqosrttbridged'||_0x3d0d96==='rtpaudioqos'||_0x3d0d96===_0x7737('0x71')||_0x3d0d96==='rtpaudioqosjitter'||_0x3d0d96===_0x7737('0x73')||_0x3d0d96===_0x7737('0x74')||_0x3d0d96===_0x7737('0x75')||_0x3d0d96===_0x7737('0x76')||_0x3d0d96===_0x7737('0x77')||_0x3d0d96===_0x7737('0x78')||_0x3d0d96===_0x7737('0x79')||_0x3d0d96==='state'||_0x3d0d96===_0x7737('0x2c')){return![];}return!![];};exports[_0x7737('0x7a')]=function(_0x6018e6,_0x31c855){var _0x4ab039,_0x395d96,_0x248148;if(_0x31c855<=0x0){_0x31c855=0x1;}_0x4ab039=new RegExp('\x5cw{0,'+_0x31c855+'}$');_0x395d96=Math['pow'](0xa,_0x31c855-0x1);_0x248148=Math[_0x7737('0x7b')](0xa,_0x31c855)-0x1;return util[_0x7737('0x11')]('%s',_[_0x7737('0x7c')](_0x6018e6,_0x4ab039,_[_0x7737('0x7d')](_0x395d96,_0x248148)));};exports[_0x7737('0x7e')]=function(_0x2a2a4d){var _0x2176a3=_0x2a2a4d[_0x7737('0x7f')](/"(.*?)"/);return _0x2176a3?_0x2176a3[0x1]:_0x2a2a4d;};exports[_0x7737('0x80')]=function(_0x21ed84){var _0x4a786b=_0x21ed84[_0x7737('0x7f')](/<(.*?)>/);return _0x4a786b?_0x4a786b[0x1]:_0x21ed84;};function buildNoAnswerEventPayload(_0x18ae09,_0xd8bfed){var _0x4e5320=buildObj(_0x18ae09,_0x7737('0x81'));if(!_[_0x7737('0x10')](_0xd8bfed[_0x7737('0x82')])){Object[_0x7737('0x83')](_0xd8bfed[_0x7737('0x82')])[_0x7737('0x84')](function(_0x593273){_0x4e5320[_0x593273[_0x7737('0x85')]()]=_0xd8bfed[_0x7737('0x82')][_0x593273];});}return _0x4e5320;}exports[_0x7737('0x86')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 524b12c..8abff58 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 _0xe439=['queueremove','queuepause','voicequeuechannel','voicequeuechannelhangup','queueadd','string','number','boolean'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0xe439,0x1c4));var _0x9e43=function(_0x181f93,_0x1ef72c){_0x181f93=_0x181f93-0x0;var _0x3eff2d=_0xe439[_0x181f93];return _0x3eff2d;};'use strict';exports[_0x9e43('0x0')]={'queue':{'type':_0x9e43('0x1'),'required':!![]},'interface':{'type':_0x9e43('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x9e43('0x2'),'required':![]},'paused':{'type':_0x9e43('0x3'),'required':![]}};exports[_0x9e43('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x9e43('0x1'),'required':!![]}};exports[_0x9e43('0x5')]={'interface':{'type':_0x9e43('0x1'),'required':!![]},'paused':{'type':_0x9e43('0x3')},'reason':{'type':_0x9e43('0x1'),'required':![]}};exports['reload']={'module':{'type':_0x9e43('0x1'),'required':![]}};exports[_0x9e43('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x9e43('0x1'),'required':!![]},'filename':{'type':_0x9e43('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x9e43('0x1')}};exports[_0x9e43('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x9e43('0x1'),'required':!![]},'exten':{'type':_0x9e43('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x5984=['string','number','boolean','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd'];(function(_0x4b9e62,_0xb9e90a){var _0x38f41f=function(_0x4b6549){while(--_0x4b6549){_0x4b9e62['push'](_0x4b9e62['shift']());}};_0x38f41f(++_0xb9e90a);}(_0x5984,0x98));var _0x4598=function(_0xcc5b09,_0x17464d){_0xcc5b09=_0xcc5b09-0x0;var _0x1f165e=_0x5984[_0xcc5b09];return _0x1f165e;};'use strict';exports[_0x4598('0x0')]={'queue':{'type':_0x4598('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x4598('0x1'),'required':!![]},'penalty':{'type':_0x4598('0x2'),'required':![]},'paused':{'type':_0x4598('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x4598('0x1'),'required':!![]},'interface':{'type':_0x4598('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x4598('0x1'),'required':!![]},'paused':{'type':_0x4598('0x3')},'reason':{'type':_0x4598('0x1'),'required':![]}};exports[_0x4598('0x4')]={'module':{'type':_0x4598('0x1'),'required':![]}};exports[_0x4598('0x5')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x4598('0x6')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':'string'},'format':{'type':_0x4598('0x1')},'mixmonitorid':{'type':_0x4598('0x1')}};exports[_0x4598('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x4598('0x8')]={'uniqueid':{'type':_0x4598('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x4598('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 8f26e78..2a75e76 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(_0x511492,_0x31e1f3){var _0x563d78=function(_0x534848){while(--_0x534848){_0x511492['push'](_0x511492['shift']());}};_0x563d78(++_0x31e1f3);}(_0xadb5,0xad));var _0x5adb=function(_0x546ca2,_0x919751){_0x546ca2=_0x546ca2-0x0;var _0x15258a=_0xadb5[_0x546ca2];return _0x15258a;};'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 _0x5f66=['diff','seconds','disposition','ANSWERED','outbound','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','telephones','trunks','voiceQueues','triggers','templates','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','isNil','format','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','name','isUndefined','initTelephones','SIP/%s','initTriggers','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','sumDuration','queuecallercompleteAt','queuecallerexitAt'];(function(_0x28045b,_0x5cb6c1){var _0x4b4be8=function(_0x54b769){while(--_0x54b769){_0x28045b['push'](_0x28045b['shift']());}};_0x4b4be8(++_0x5cb6c1);}(_0x5f66,0x1a0));var _0x65f6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5f66[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var util=require('util');var Agent=require(_0x65f6('0x1'));var Telephone=require(_0x65f6('0x2'));var Trunk=require(_0x65f6('0x3'));var VoiceQueue=require(_0x65f6('0x4'));var Trigger=require(_0x65f6('0x5'));var Template=require('../model/template');var Campaign=require(_0x65f6('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x65f6('0x7'));var SalesforceAccount=require(_0x65f6('0x8'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x65f6('0x9'));var DeskAccount=require(_0x65f6('0xa'));var VtigerAccount=require(_0x65f6('0xb'));var ServicenowAccount=require(_0x65f6('0xc'));var Dynamics365Account=require(_0x65f6('0xd'));var FreshsalesAccount=require(_0x65f6('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this['agents']={};this[_0x65f6('0xf')]={};this[_0x65f6('0x10')]={};this[_0x65f6('0x11')]={};this[_0x65f6('0x12')]={};this['campaigns']={};this[_0x65f6('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x65f6('0x14')]={};this['queueChannels']={};this[_0x65f6('0x15')]={};this['timers']={};this[_0x65f6('0x16')]={};this[_0x65f6('0x17')]={};this[_0x65f6('0x18')]={};this[_0x65f6('0x19')]={};this[_0x65f6('0x1a')]={};this[_0x65f6('0x1b')]={};this[_0x65f6('0x1c')]={};this[_0x65f6('0x1d')]={};this[_0x65f6('0x1e')]={};this[_0x65f6('0x1f')]={};this['freshsalesAccounts']={};this[_0x65f6('0x20')]={};}function freeIsNotKey(_0x49a913,_0x5dd324,_0x1693e6){var _0x5c69f8=_[_0x65f6('0x21')](_0x49a913,function(_0x1c955c){return _0x1c955c[_0x1693e6];});for(var _0x1b1cbb in _0x5dd324){if(_0x5dd324[_0x65f6('0x22')](_0x1b1cbb)){if(!_0x5c69f8[_0x1b1cbb]){delete _0x5dd324[_0x1b1cbb];}}}}function freeIsNotKeySip(_0xc8660c,_0x18380e){var _0x495dd6=_['mapKeys'](_0xc8660c,function(_0x2d538c){return util['format']('SIP/%s',_0x2d538c['name']);});for(var _0x365159 in _0x18380e){if(_0x18380e[_0x65f6('0x22')](_0x365159)){if(!_0x495dd6[_0x365159]){delete _0x18380e[_0x365159];}}}}function freeIsNotKeyAgent(_0x5114a4,_0x39e19f){var _0x270893=_[_0x65f6('0x21')](_0x5114a4,function(_0x3876ed){var _0x219ab2=_[_0x65f6('0x23')](_0x3876ed['interface'])?util[_0x65f6('0x24')]('SIP/%s',_0x3876ed['name']):_0x3876ed[_0x65f6('0x25')];return _0x219ab2;});for(var _0xd173f4 in _0x39e19f){if(_0x39e19f['hasOwnProperty'](_0xd173f4)){if(!_0x270893[_0xd173f4]){delete _0x39e19f[_0xd173f4];}}}}function clearVoiceCallReports(_0x1eeaaa){_0x1eeaaa[_0x65f6('0x26')]=0x0;_0x1eeaaa[_0x65f6('0x27')]=0x0;_0x1eeaaa[_0x65f6('0x28')]=0x0;_0x1eeaaa['sumDuration']=0x0;_0x1eeaaa[_0x65f6('0x29')]=0x0;}function clearCampaigns(_0x59ea32){if(!_[_0x65f6('0x2a')](_0x59ea32)){for(var _0x5963e0 in _0x59ea32){if(_0x59ea32['hasOwnProperty'](_0x5963e0)){_0x59ea32[_0x5963e0]['ivrTotalCallsDays']=0x0;_0x59ea32[_0x5963e0][_0x65f6('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x16cde8){if(!_['isEmpty'](_0x16cde8)){for(var _0x296cd9 in _0x16cde8){if(_0x16cde8[_0x65f6('0x22')](_0x296cd9)){_0x16cde8[_0x296cd9]['total']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x27')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2c')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2d')]=0x0;_0x16cde8[_0x296cd9]['sumHoldTime']=0x0;_0x16cde8[_0x296cd9]['sumDuration']=0x0;_0x16cde8[_0x296cd9]['sumBillable']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2e')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2f')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x30')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x31')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x32')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x33')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x34')]=0x0;_0x16cde8[_0x296cd9]['outboundDropCallsDayCallersExit']=0x0;_0x16cde8[_0x296cd9]['outboundBlacklistCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x35')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x36')]=0x0;_0x16cde8[_0x296cd9]['outboundReCallsDay']=0x0;_0x16cde8[_0x296cd9]['outboundAnswerAgiCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x37')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x38')]=!![];}}}}Realtime[_0x65f6('0x39')][_0x65f6('0x3a')]=function(_0x1217fd,_0x2d32be){for(var _0x5792a0 in _0x2d32be){if(_0x1217fd[_0x65f6('0x22')](_0x5792a0)){_0x1217fd[_0x5792a0]=_0x2d32be[_0x5792a0];}}};Realtime[_0x65f6('0x39')][_0x65f6('0x3b')]=function(){var _0x4bc037=this;return function(_0x217f35){if(_0x217f35){freeIsNotKeyAgent(_0x217f35,_0x4bc037[_0x65f6('0x3c')]);for(var _0xbaed3c=0x0,_0x45510a={};_0xbaed3c<_0x217f35[_0x65f6('0x3d')];_0xbaed3c+=0x1){_0x45510a=_0x217f35[_0xbaed3c];var _0x2f054c=_['isNil'](_0x45510a[_0x65f6('0x25')])?util[_0x65f6('0x24')]('SIP/%s',_0x45510a[_0x65f6('0x3e')]):_0x45510a['interface'];if(_[_0x65f6('0x3f')](_0x4bc037['agents'][_0x2f054c])){_0x4bc037[_0x65f6('0x3c')][_0x2f054c]=new Agent(_0x45510a);}else{_0x4bc037[_0x65f6('0x3a')](_0x4bc037['agents'][_0x2f054c],_0x45510a);}}}return _0x4bc037[_0x65f6('0x3c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x40')]=function(){var _0x515648=this;return function(_0x582c7e){if(_0x582c7e){freeIsNotKeySip(_0x582c7e,_0x515648[_0x65f6('0xf')]);for(var _0x4c0df4=0x0,_0x26de30={};_0x4c0df4<_0x582c7e['length'];_0x4c0df4+=0x1){_0x26de30=_0x582c7e[_0x4c0df4];if(_[_0x65f6('0x3f')](_0x515648[_0x65f6('0xf')][util['format'](_0x65f6('0x41'),_0x26de30['name'])])){_0x515648['telephones'][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])]=new Telephone(_0x26de30);}else{_0x515648[_0x65f6('0x3a')](_0x515648[_0x65f6('0xf')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])],_0x26de30);}}}return _0x515648['telephones'];};};Realtime[_0x65f6('0x39')]['initTrunks']=function(){var _0x12a589=this;return function(_0xa4394a){if(_0xa4394a){freeIsNotKeySip(_0xa4394a,_0x12a589[_0x65f6('0x10')]);for(var _0x2ea7f7=0x0,_0x5ef5c2={};_0x2ea7f7<_0xa4394a[_0x65f6('0x3d')];_0x2ea7f7+=0x1){_0x5ef5c2=_0xa4394a[_0x2ea7f7];if(_[_0x65f6('0x3f')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])])){_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2['name'])]=new Trunk(_0x5ef5c2);}else{_0x12a589[_0x65f6('0x3a')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])],_0x5ef5c2);}}}return _0x12a589[_0x65f6('0x10')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x42')]=function(){var _0x461393=this;return function(_0x2abbed){if(_0x2abbed){freeIsNotKey(_0x2abbed,_0x461393[_0x65f6('0x12')],'id');for(var _0x2c008a=0x0,_0x6c4d94={};_0x2c008a<_0x2abbed[_0x65f6('0x3d')];_0x2c008a+=0x1){_0x6c4d94=_0x2abbed[_0x2c008a];if(_[_0x65f6('0x3f')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']])){_0x461393['triggers'][_0x6c4d94['id']]=new Trigger(_0x6c4d94);}else{_0x461393[_0x65f6('0x3a')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']],_0x6c4d94);}}}return _0x461393[_0x65f6('0x12')];};};Realtime[_0x65f6('0x39')]['initTemplates']=function(){var _0x1bf5bf=this;return function(_0x2d0dac){if(_0x2d0dac){freeIsNotKey(_0x2d0dac,_0x1bf5bf[_0x65f6('0x13')],'id');for(var _0x5e69b4=0x0,_0x2dbab3={};_0x5e69b4<_0x2d0dac[_0x65f6('0x3d')];_0x5e69b4+=0x1){_0x2dbab3=_0x2d0dac[_0x5e69b4];if(_[_0x65f6('0x3f')](_0x1bf5bf[_0x65f6('0x13')][_0x2dbab3['id']])){_0x1bf5bf['templates'][_0x2dbab3['id']]=new Template(_0x2dbab3);}else{_0x1bf5bf[_0x65f6('0x3a')](_0x1bf5bf['templates'][_0x2dbab3['id']],_0x2dbab3);}}}return _0x1bf5bf[_0x65f6('0x13')];};};Realtime[_0x65f6('0x39')]['initZendeskAccounts']=function(){var _0xf754ee=this;return function(_0x5085db){if(_0x5085db){freeIsNotKey(_0x5085db,_0xf754ee[_0x65f6('0x17')],'id');for(var _0x4d9b76=0x0,_0x2d1706={};_0x4d9b76<_0x5085db[_0x65f6('0x3d')];_0x4d9b76+=0x1){_0x2d1706=_0x5085db[_0x4d9b76];if(_[_0x65f6('0x3f')](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']])){_0xf754ee['zendeskAccounts'][_0x2d1706['id']]=new ZendeskAccount(_0x2d1706);}else{_0xf754ee['mergeFromDatabase'](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']],_0x2d1706);}}}return _0xf754ee[_0x65f6('0x17')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x43')]=function(){var _0x3b907c=this;return function(_0x2d6ab9){if(_0x2d6ab9){freeIsNotKey(_0x2d6ab9,_0x3b907c[_0x65f6('0x18')],'id');for(var _0x41690c=0x0,_0x414f49={};_0x41690c<_0x2d6ab9['length'];_0x41690c+=0x1){_0x414f49=_0x2d6ab9[_0x41690c];if(_[_0x65f6('0x3f')](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']])){_0x3b907c[_0x65f6('0x18')][_0x414f49['id']]=new SalesforceAccount(_0x414f49);}else{_0x3b907c['mergeFromDatabase'](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']],_0x414f49);}}}return _0x3b907c[_0x65f6('0x18')];};};Realtime['prototype'][_0x65f6('0x44')]=function(){var _0x253d52=this;return function(_0x57eb04){if(_0x57eb04){freeIsNotKey(_0x57eb04,_0x253d52[_0x65f6('0x1a')],'id');for(var _0x4f96c4=0x0,_0x247be3={};_0x4f96c4<_0x57eb04[_0x65f6('0x3d')];_0x4f96c4+=0x1){_0x247be3=_0x57eb04[_0x4f96c4];if(_[_0x65f6('0x3f')](_0x253d52['freshdeskAccounts'][_0x247be3['id']])){_0x253d52[_0x65f6('0x1a')][_0x247be3['id']]=new FreshdeskAccount(_0x247be3);}else{_0x253d52[_0x65f6('0x3a')](_0x253d52['freshdeskAccounts'][_0x247be3['id']],_0x247be3);}}}return _0x253d52[_0x65f6('0x1a')];};};Realtime[_0x65f6('0x39')]['initZohoAccounts']=function(){var _0x34d6a9=this;return function(_0x344c0e){if(_0x344c0e){freeIsNotKey(_0x344c0e,_0x34d6a9[_0x65f6('0x1b')],'id');for(var _0x25d504=0x0,_0x234fa7={};_0x25d504<_0x344c0e[_0x65f6('0x3d')];_0x25d504+=0x1){_0x234fa7=_0x344c0e[_0x25d504];if(_[_0x65f6('0x3f')](_0x34d6a9[_0x65f6('0x1b')][_0x234fa7['id']])){_0x34d6a9['zohoAccounts'][_0x234fa7['id']]=new ZohoAccount(_0x234fa7);}else{_0x34d6a9['mergeFromDatabase'](_0x34d6a9['zohoAccounts'][_0x234fa7['id']],_0x234fa7);}}}return _0x34d6a9[_0x65f6('0x1b')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x45')]=function(){var _0x20c322=this;return function(_0x545445){if(_0x545445){freeIsNotKey(_0x545445,_0x20c322[_0x65f6('0x1c')],'id');for(var _0x2032b9=0x0,_0x9ff849={};_0x2032b9<_0x545445['length'];_0x2032b9+=0x1){_0x9ff849=_0x545445[_0x2032b9];if(_[_0x65f6('0x3f')](_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']])){_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']]=new DeskAccount(_0x9ff849);}else{_0x20c322['mergeFromDatabase'](_0x20c322['deskAccounts'][_0x9ff849['id']],_0x9ff849);}}}return _0x20c322[_0x65f6('0x1c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x46')]=function(){var _0x39364f=this;return function(_0x2a76b3){if(_0x2a76b3){freeIsNotKey(_0x2a76b3,_0x39364f[_0x65f6('0x19')],'id');for(var _0x35d77f=0x0,_0x138334={};_0x35d77f<_0x2a76b3[_0x65f6('0x3d')];_0x35d77f+=0x1){_0x138334=_0x2a76b3[_0x35d77f];if(_[_0x65f6('0x3f')](_0x39364f[_0x65f6('0x19')][_0x138334['id']])){_0x39364f[_0x65f6('0x19')][_0x138334['id']]=new SugarcrmAccount(_0x138334);}else{_0x39364f[_0x65f6('0x3a')](_0x39364f[_0x65f6('0x19')][_0x138334['id']],_0x138334);}}}return _0x39364f['sugarcrmAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x47')]=function(){var _0x42a805=this;return function(_0x4b4efe){if(_0x4b4efe){freeIsNotKey(_0x4b4efe,_0x42a805[_0x65f6('0x1d')],'id');for(var _0x16dec0=0x0,_0x4638c9={};_0x16dec0<_0x4b4efe[_0x65f6('0x3d')];_0x16dec0+=0x1){_0x4638c9=_0x4b4efe[_0x16dec0];if(_['isUndefined'](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']])){_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']]=new VtigerAccount(_0x4638c9);}else{_0x42a805[_0x65f6('0x3a')](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']],_0x4638c9);}}}return _0x42a805['vtigerAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x48')]=function(){var _0x5c55e4=this;return function(_0x28682b){if(_0x28682b){freeIsNotKey(_0x28682b,_0x5c55e4[_0x65f6('0x1e')],'id');for(var _0x36c316=0x0,_0x51549d={};_0x36c316<_0x28682b[_0x65f6('0x3d')];_0x36c316+=0x1){_0x51549d=_0x28682b[_0x36c316];if(_[_0x65f6('0x3f')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']])){_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']]=new ServicenowAccount(_0x51549d);}else{_0x5c55e4[_0x65f6('0x3a')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']],_0x51549d);}}}return _0x5c55e4['servicenowAccounts'];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x336a7d=this;return function(_0x367d95){if(_0x367d95){freeIsNotKey(_0x367d95,_0x336a7d[_0x65f6('0x1f')],'id');for(var _0x471bec=0x0,_0xab6f0={};_0x471bec<_0x367d95[_0x65f6('0x3d')];_0x471bec+=0x1){_0xab6f0=_0x367d95[_0x471bec];if(_['isUndefined'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']])){_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']]=new Dynamics365Account(_0xab6f0);}else{_0x336a7d['mergeFromDatabase'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']],_0xab6f0);}}}return _0x336a7d[_0x65f6('0x1f')];};};Realtime[_0x65f6('0x39')]['initFreshsalesAccounts']=function(){var _0x23c441=this;return function(_0x448c9a){if(_0x448c9a){freeIsNotKey(_0x448c9a,_0x23c441['freshsalesAccounts'],'id');for(var _0x271d76=0x0,_0x3edc6b={};_0x271d76<_0x448c9a[_0x65f6('0x3d')];_0x271d76+=0x1){_0x3edc6b=_0x448c9a[_0x271d76];if(_[_0x65f6('0x3f')](_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']])){_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']]=new FreshsalesAccount(_0x3edc6b);}else{_0x23c441[_0x65f6('0x3a')](_0x23c441['freshsalesAccounts'][_0x3edc6b['id']],_0x3edc6b);}}}return _0x23c441['freshsalesAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4a')]=function(){var _0x4a9524=this;return function(_0x417ba5){for(var _0x5f3df9=0x0;_0x5f3df9<_0x417ba5[_0x65f6('0x3d')];_0x5f3df9+=0x1){_['merge'](_0x4a9524[_0x65f6('0x11')][_0x417ba5[_0x5f3df9][_0x65f6('0x3e')]],_0x417ba5[_0x5f3df9]);}return _0x4a9524[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4b')]=function(){var _0x264e6c=this;return function(_0x1aaf75){clearVoiceQueues(_0x264e6c[_0x65f6('0x11')]);if(_0x1aaf75){_0x1aaf75=_[_0x65f6('0x4c')](_0x1aaf75,'uniqueid');for(var _0x480190 in _0x1aaf75){if(_0x1aaf75[_0x65f6('0x22')](_0x480190)){for(var _0x13ee4b=0x0;_0x13ee4b<_0x1aaf75[_0x480190][_0x65f6('0x3d')];_0x13ee4b+=0x1){var _0x51497f=_0x1aaf75[_0x480190][_0x13ee4b]['queue'];if(_0x264e6c[_0x65f6('0x11')][_0x51497f]){if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4d')]){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x2c')]+=0x1;}if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4e')]){_0x264e6c[_0x65f6('0x11')][_0x51497f]['abandoned']+=0x1;}_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4f')])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;if(_0x13ee4b===_0x1aaf75[_0x480190][_0x65f6('0x3d')]-0x1){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x52')]||_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerabandonAt']||_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x53')])[_0x65f6('0x54')](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x26')]+=0x1;if(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercomplete']){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x27')]+=0x1;_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x29')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercompleteAt'])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerleaveAt']),_0x65f6('0x55'))||0x0;}}else{_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]||0x0;}}}}}}return _0x264e6c[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')]['initVoiceCallReports']=function(){var _0x40d0f7=this;return function(_0x15809e){clearVoiceCallReports(_0x40d0f7['outbound']);if(_0x15809e){for(var _0x758e80=0x0;_0x758e80<_0x15809e[_0x65f6('0x3d')];_0x758e80+=0x1){_0x40d0f7['outbound'][_0x65f6('0x26')]+=0x1;_0x40d0f7['outbound'][_0x65f6('0x51')]+=_0x15809e[_0x758e80]['duration'];if(_0x15809e[_0x758e80][_0x65f6('0x56')]===_0x65f6('0x57')){_0x40d0f7['outbound'][_0x65f6('0x27')]+=0x1;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x28')]+=_0x15809e[_0x758e80][_0x65f6('0x59')]-_0x15809e[_0x758e80][_0x65f6('0x5a')]||0x0;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x29')]+=_0x15809e[_0x758e80][_0x65f6('0x5a')];}}}return _0x40d0f7[_0x65f6('0x58')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x5b')]=function(){var _0x574d84=this;return function(_0x10a661){if(_0x10a661){freeIsNotKey(_0x10a661,_0x574d84[_0x65f6('0x5c')],_0x65f6('0x3e'));for(var _0x219e42=0x0,_0x5694f9={};_0x219e42<_0x10a661[_0x65f6('0x3d')];_0x219e42+=0x1){_0x5694f9=_0x10a661[_0x219e42];if(_[_0x65f6('0x3f')](_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]])){_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]]=new Campaign(_0x5694f9);}else{_0x574d84['mergeFromDatabase'](_0x574d84[_0x65f6('0x5c')][_0x5694f9[_0x65f6('0x3e')]],_0x5694f9);_0x574d84['campaigns'][_0x5694f9['name']][_0x65f6('0x5d')]=_0x5694f9[_0x65f6('0x5e')]?_0x5694f9['SquareProject'][_0x65f6('0x3e')]:undefined;}}}return _0x574d84[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')]['initVoiceExtensions']=function(){var _0x1348ec=this;return function(_0x246510){if(_0x246510){freeIsNotKey(_0x246510,_0x1348ec['voiceExtensions'],'id');for(var _0x36b8de=0x0,_0x504b39={};_0x36b8de<_0x246510[_0x65f6('0x3d')];_0x36b8de+=0x1){_0x504b39=_0x246510[_0x36b8de];if(_['isUndefined'](_0x1348ec['voiceExtensions'][_0x504b39['id']])){_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']]=new VoiceExtension(_0x504b39);}else{_0x1348ec[_0x65f6('0x3a')](_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']],_0x504b39);}}}return _0x1348ec[_0x65f6('0x5f')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x60')]=function(){var _0x1ac46f=this;return function(_0x1f4e2c){clearCampaigns(_0x1ac46f['campaigns']);for(var _0x494904=0x0;_0x494904<_0x1f4e2c[_0x65f6('0x3d')];_0x494904+=0x1){_['merge'](_0x1ac46f[_0x65f6('0x5c')][_0x1f4e2c[_0x494904][_0x65f6('0x3e')]],_0x1f4e2c[_0x494904]);}return _0x1ac46f[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x61')]=function(){var _0x56bd9d=this;return function(_0x398cac){if(_0x398cac){freeIsNotKey(_0x398cac,_0x56bd9d[_0x65f6('0x20')],'id');for(var _0x14c908=0x0,_0x576ecd={};_0x14c908<_0x398cac[_0x65f6('0x3d')];_0x14c908+=0x1){_0x576ecd=_0x398cac[_0x14c908];if(_[_0x65f6('0x3f')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']])){_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']]=new FaxAccount(_0x576ecd);}else{_0x56bd9d[_0x65f6('0x3a')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']],_0x576ecd);}}}return _0x56bd9d['faxAccounts'];};};Realtime['prototype'][_0x65f6('0x62')]=function(){var _0x10d744=this;return function(_0x10c916){if(_0x10c916){freeIsNotKey(_0x10c916,_0x10d744[_0x65f6('0x11')],'name');for(var _0x4bda86=0x0,_0x336076={};_0x4bda86<_0x10c916[_0x65f6('0x3d')];_0x4bda86+=0x1){_0x336076=_0x10c916[_0x4bda86];if(_[_0x65f6('0x3f')](_0x10d744[_0x65f6('0x11')][_0x336076[_0x65f6('0x3e')]])){_0x10d744[_0x65f6('0x11')][_0x336076['name']]=new VoiceQueue(_0x336076);}else{_0x10d744['mergeFromDatabase'](_0x10d744['voiceQueues'][_0x336076[_0x65f6('0x3e')]],_0x336076);}}}return _0x10d744[_0x65f6('0x11')];};};module[_0x65f6('0x63')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 41a8287..d80d573 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 _0x1bf3=['mergeDBDataToRealtime'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1bf3,0x1a7));var _0x31bf=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x1bf3[_0x57b54c];return _0x59cc19;};'use strict';function mergeDBDataToRealtime(_0x2cc1ec,_0x1d2a9a){var _0x2fff48=Object['assign']({},_0x2cc1ec);for(var _0x1d050b in _0x1d2a9a){if(_0x2fff48['hasOwnProperty'](_0x1d050b)){_0x2fff48[_0x1d050b]=_0x1d2a9a[_0x1d050b];}}return _0x2fff48;}exports[_0x31bf('0x0')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x63c1=['hasOwnProperty','mergeDBDataToRealtime','assign'];(function(_0x4e9994,_0x1710cd){var _0x129000=function(_0x123a9d){while(--_0x123a9d){_0x4e9994['push'](_0x4e9994['shift']());}};_0x129000(++_0x1710cd);}(_0x63c1,0x161));var _0x163c=function(_0xf69f77,_0x1116d7){_0xf69f77=_0xf69f77-0x0;var _0x4f7d0e=_0x63c1[_0xf69f77];return _0x4f7d0e;};'use strict';function mergeDBDataToRealtime(_0x2515b7,_0x4bd287){var _0x499ee3=Object[_0x163c('0x0')]({},_0x2515b7);for(var _0x208e09 in _0x4bd287){if(_0x499ee3[_0x163c('0x1')](_0x208e09)){_0x499ee3[_0x208e09]=_0x4bd287[_0x208e09];}}return _0x499ee3;}exports[_0x163c('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 f1fee7f..19c9877 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 _0x08b5=['connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','UserId','membername','create','monitor','monitors','monitorFilename','filename','createdAt','exten','connectedlinename','xcally-motion-dialer','forEach','startsWith','Local','substring','indexOf','lastIndexOf','transfererlinkedid','attendedTransfer','exports','moment','util','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','sync','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','prototype','findAgent','find','name','isNil','accountcode','interface','format','SIP/%s','length','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','match','getAgentByInternal','keys','getCallType','split','outbound','internal','destination','type','dialer','queue','lastdata','context','from-voip-provider','callerid','from-sip','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','ANSWERED'];(function(_0x55a286,_0x5ada6f){var _0x40009f=function(_0x477f8b){while(--_0x477f8b){_0x55a286['push'](_0x55a286['shift']());}};_0x40009f(++_0x5ada6f);}(_0x08b5,0x17f));var _0x508b=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x08b5[_0x4709c0];return _0x13348b;};'use strict';var _=require('lodash');var moment=require(_0x508b('0x0'));var util=require(_0x508b('0x1'));var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0x508b('0x2'));var RpcVoiceCallReport=require(_0x508b('0x3'));var RpcVoiceDialReport=require(_0x508b('0x4'));var RpcMemberReport=require(_0x508b('0x5'));var RpcVoiceQueueReport=require(_0x508b('0x6'));var RpcVoiceRecording=require(_0x508b('0x7'));var RpcVoiceTransferReport=require(_0x508b('0x8'));var VoiceQueueReport=require(_0x508b('0x9'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x508b('0xa'));var VoiceDialReport=require(_0x508b('0xb'));var UserReport=require(_0x508b('0xc'));function Report(_0x410d6f){this[_0x508b('0xd')]=_0x410d6f;this[_0x508b('0xe')]=_0x410d6f['agents'];this['telephones']=_0x410d6f[_0x508b('0xf')];}Report['prototype'][_0x508b('0x10')]=function(_0x75866c){var _0x19a5c6=new VoiceQueueReport(this['realtime']);var _0x48c9b5=new VoiceAgentReport(this['realtime']);var _0x74d25f=new VoiceDialReport(this[_0x508b('0xd')]);var _0x30922d=new VoiceCallReport(this[_0x508b('0xd')]);var _0x28303e=new UserReport(this['realtime']);if(config['xdr']&&config[_0x508b('0x11')][_0x508b('0x12')]){ami['on']('custom:voiceQueueReport',this[_0x508b('0x13')][_0x508b('0x14')](this));ami['on'](_0x508b('0x15'),this['voiceCallReport'][_0x508b('0x14')](this));ami['on']('custom:voiceAgentReport',this[_0x508b('0x16')]['bind'](this));ami['on']('custom:voiceDialReport',this[_0x508b('0x17')][_0x508b('0x14')](this));ami['on'](_0x508b('0x18'),this[_0x508b('0x19')][_0x508b('0x14')](this));ami['on']('attendedtransfer',this['attendedTransfer'][_0x508b('0x14')](this));}};Report[_0x508b('0x1a')][_0x508b('0x1b')]=function(_0x1eff77){var _0xcd224d;_0xcd224d=_[_0x508b('0x1c')](this['agents'],function(_0x3c20bb){return _0x3c20bb['accountcode']==_0x1eff77||_0x3c20bb[_0x508b('0x1d')]==_0x1eff77;});if(_[_0x508b('0x1e')](_0xcd224d)){var _0x491810=_['find'](this[_0x508b('0xf')],function(_0x5231d8){return _0x5231d8[_0x508b('0x1f')]==_0x1eff77||_0x5231d8[_0x508b('0x1d')]==_0x1eff77;});if(_0x491810){_0xcd224d=_[_0x508b('0x1c')](this[_0x508b('0xe')],function(_0x3db9f2){return _0x3db9f2[_0x508b('0x20')]==util[_0x508b('0x21')](_0x508b('0x22'),_0x491810['name']);});}}return _0xcd224d;};Report['prototype'][_0x508b('0x13')]=function(_0x3b4e15){for(var _0x44e11f=0x0;_0x44e11f<_0x3b4e15[_0x508b('0x23')];_0x44e11f+=0x1){var _0x103f63=this[_0x508b('0x1b')](_0x3b4e15[_0x44e11f]['connectedlinenum']);if(_0x103f63){_0x3b4e15[_0x44e11f][_0x508b('0x1f')]=_0x103f63[_0x508b('0x1f')];_0x3b4e15[_0x44e11f][_0x508b('0x24')]=!![];_0x3b4e15[_0x44e11f][_0x508b('0x25')]=_0x103f63[_0x508b('0x1d')];_0x3b4e15[_0x44e11f][_0x508b('0x20')]=_[_0x508b('0x1e')](_0x103f63[_0x508b('0x20')])?util[_0x508b('0x21')](_0x508b('0x22'),_0x103f63['name']):_0x103f63[_0x508b('0x20')];if(_0x3b4e15[_0x44e11f][_0x508b('0x26')]){_0x3b4e15[_0x44e11f][_0x508b('0x27')]=moment()[_0x508b('0x21')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3b4e15[_0x44e11f]['queuecallerexit']){_0x3b4e15[_0x44e11f]['queuecallerexitAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x508b('0x13')](_0x3b4e15[_0x44e11f]);}RpcVoiceQueueReport['create'](_0x3b4e15[_0x44e11f]);}};function extractCalleridNumber(_0x559515){var _0x5000e3=_0x559515[_0x508b('0x28')](/<(.*?)>/);return _0x5000e3?_0x5000e3[0x1]:_0x559515;}Report[_0x508b('0x1a')][_0x508b('0x29')]=function(_0x56c6c9){for(var _0x25d0ee=0x0;_0x25d0ee','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','UserId','monitor','monitors','monitorFilename','createdAt','exten','connectedlinename','membername','originatecalleridnum','xcally-motion-dialer','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','attendedTransfer','exports','lodash','moment','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','find','accountcode','name','isNil','interface','format','SIP/%s','findAgent','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','create','match','getAgentByInternal','keys','length','getCallType','channel','split','calleridnum','outbound','internal','destination','type','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip'];(function(_0x681ddd,_0x5f3051){var _0x563b9f=function(_0x45cf54){while(--_0x45cf54){_0x681ddd['push'](_0x681ddd['shift']());}};_0x563b9f(++_0x5f3051);}(_0x6829,0x7e));var _0x9682=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x6829[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0x9682('0x0'));var moment=require(_0x9682('0x1'));var util=require('util');var config=require(_0x9682('0x2'));var ami=require(_0x9682('0x3'));var RpcVoiceAgentReport=require(_0x9682('0x4'));var RpcVoiceCallReport=require(_0x9682('0x5'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x9682('0x6'));var RpcVoiceQueueReport=require(_0x9682('0x7'));var RpcVoiceRecording=require(_0x9682('0x8'));var RpcVoiceTransferReport=require(_0x9682('0x9'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x9682('0xa'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x9682('0xb'));var UserReport=require(_0x9682('0xc'));function Report(_0x5b67dd){this[_0x9682('0xd')]=_0x5b67dd;this['agents']=_0x5b67dd[_0x9682('0xe')];this['telephones']=_0x5b67dd[_0x9682('0xf')];}Report[_0x9682('0x10')][_0x9682('0x11')]=function(_0x2b3725){var _0x5a3bf9=new VoiceQueueReport(this[_0x9682('0xd')]);var _0x4e5033=new VoiceAgentReport(this[_0x9682('0xd')]);var _0x14f3ce=new VoiceDialReport(this['realtime']);var _0x375bd9=new VoiceCallReport(this[_0x9682('0xd')]);var _0x2046cf=new UserReport(this[_0x9682('0xd')]);if(config[_0x9682('0x12')]&&config[_0x9682('0x12')][_0x9682('0x13')]){ami['on'](_0x9682('0x14'),this['voiceQueueReport'][_0x9682('0x15')](this));ami['on'](_0x9682('0x16'),this[_0x9682('0x17')][_0x9682('0x15')](this));ami['on'](_0x9682('0x18'),this[_0x9682('0x19')][_0x9682('0x15')](this));ami['on'](_0x9682('0x1a'),this[_0x9682('0x1b')][_0x9682('0x15')](this));ami['on'](_0x9682('0x1c'),this[_0x9682('0x1d')][_0x9682('0x15')](this));ami['on']('attendedtransfer',this['attendedTransfer'][_0x9682('0x15')](this));}};Report[_0x9682('0x10')]['findAgent']=function(_0x5d7110){var _0x4be350;_0x4be350=_[_0x9682('0x1e')](this[_0x9682('0xe')],function(_0x5bf809){return _0x5bf809[_0x9682('0x1f')]==_0x5d7110||_0x5bf809[_0x9682('0x20')]==_0x5d7110;});if(_[_0x9682('0x21')](_0x4be350)){var _0x211d84=_[_0x9682('0x1e')](this[_0x9682('0xf')],function(_0x4bcb3f){return _0x4bcb3f['accountcode']==_0x5d7110||_0x4bcb3f['name']==_0x5d7110;});if(_0x211d84){_0x4be350=_[_0x9682('0x1e')](this['agents'],function(_0x2e232c){return _0x2e232c[_0x9682('0x22')]==util[_0x9682('0x23')](_0x9682('0x24'),_0x211d84[_0x9682('0x20')]);});}}return _0x4be350;};Report[_0x9682('0x10')]['voiceQueueReport']=function(_0xde2d83){for(var _0x5d4be6=0x0;_0x5d4be6<_0xde2d83['length'];_0x5d4be6+=0x1){var _0x3f3951=this[_0x9682('0x25')](_0xde2d83[_0x5d4be6][_0x9682('0x26')]);if(_0x3f3951){_0xde2d83[_0x5d4be6][_0x9682('0x1f')]=_0x3f3951[_0x9682('0x1f')];_0xde2d83[_0x5d4be6][_0x9682('0x27')]=!![];_0xde2d83[_0x5d4be6][_0x9682('0x28')]=_0x3f3951[_0x9682('0x20')];_0xde2d83[_0x5d4be6][_0x9682('0x22')]=_[_0x9682('0x21')](_0x3f3951['interface'])?util[_0x9682('0x23')](_0x9682('0x24'),_0x3f3951[_0x9682('0x20')]):_0x3f3951[_0x9682('0x22')];if(_0xde2d83[_0x5d4be6][_0x9682('0x29')]){_0xde2d83[_0x5d4be6][_0x9682('0x2a')]=moment()[_0x9682('0x23')](_0x9682('0x2b'));}if(_0xde2d83[_0x5d4be6]['queuecallerexit']){_0xde2d83[_0x5d4be6]['queuecallerexitAt']=moment()['format'](_0x9682('0x2b'));}RpcMemberReport['voiceQueueReport'](_0xde2d83[_0x5d4be6]);}RpcVoiceQueueReport[_0x9682('0x2c')](_0xde2d83[_0x5d4be6]);}};function extractCalleridNumber(_0x336a99){var _0x260324=_0x336a99[_0x9682('0x2d')](/<(.*?)>/);return _0x260324?_0x260324[0x1]:_0x336a99;}Report[_0x9682('0x10')][_0x9682('0x2e')]=function(_0x19a679){for(var _0x3c5bf9=0x0;_0x3c5bf90x0?!![]:![];if(!_0x12aa83){return this[_0xebd4('0x1c')](this['summary'][_0xebd4('0x74')]);}};VoiceQueueReport[_0xebd4('0xc')][_0xebd4('0x75')]=function(_0x15e0bf){var _0x43c0d0=this[_0xebd4('0x16')]['id'];if(this[_0xebd4('0x16')][_0xebd4('0x66')][_0x43c0d0]&&this['summary']['queuestatus'][_0x43c0d0][_0x15e0bf[_0xebd4('0x65')]]){this['summary'][_0xebd4('0x66')][_0x43c0d0][_0x15e0bf[_0xebd4('0x65')]][_0xebd4('0x6c')][_0xebd4('0x76')](_0x15e0bf);}};VoiceQueueReport[_0xebd4('0xc')]['syncQueueSummary']=function(_0x250ac3){var _0x18cad7=this;try{if(this[_0xebd4('0x5f')](_0x250ac3)&&this[_0xebd4('0x5f')](_0x250ac3[_0xebd4('0x58')])){logger['debug'](_0xebd4('0x77'),util['inspect'](_0x250ac3,{'showHidden':![],'depth':null}));var _0x392a48=this[_0xebd4('0x14')][_0x250ac3[_0xebd4('0x58')]];if(_0x392a48){logger[_0xebd4('0x5c')](_0xebd4('0x78'),_0x392a48[_0xebd4('0x69')]);this[_0xebd4('0x16')][_0xebd4('0x61')][_0x392a48[_0xebd4('0x69')]]={'summaryEvent':_0x250ac3};this[_0xebd4('0x16')][_0xebd4('0x73')]+=0x1;return ami[_0xebd4('0x42')]({'action':_0xebd4('0x66'),'queue':_0x392a48['name']})[_0xebd4('0x64')](function(_0x3f2836){if(!_0x18cad7[_0xebd4('0x16')][_0xebd4('0x66')][_0x250ac3['actionid']]){_0x18cad7[_0xebd4('0x16')]['queuestatus'][_0x250ac3[_0xebd4('0x65')]]={};}_0x18cad7[_0xebd4('0x16')][_0xebd4('0x66')][_0x250ac3[_0xebd4('0x65')]][_0x3f2836[_0xebd4('0x65')]]={'queue':_0x392a48[_0xebd4('0x69')],'agents':[]};})[_0xebd4('0x62')](function(_0x3a1d70){throw _0x3a1d70;});}}}catch(_0x3ab5da){logger[_0xebd4('0x44')](_0xebd4('0x67'),util[_0xebd4('0x46')](_0x3ab5da,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xebd4('0xc')][_0xebd4('0x1c')]=function(_0x512461){if(this[_0xebd4('0x16')][_0xebd4('0x73')]>0x0){this['summary'][_0xebd4('0x74')]=_0x512461;return;}logger['debug'](_0xebd4('0x79'),util['inspect'](_0x512461,{'showHidden':![],'depth':null}));this[_0xebd4('0x16')]=initializeSummary();ami['emit']('custom:queuesummarycomplete',{});};VoiceQueueReport['prototype'][_0xebd4('0x21')]=function(_0x4b1122){try{if(this['isNotNull'](_0x4b1122)){logger[_0xebd4('0x5c')](_0xebd4('0x7a'),_0x4b1122[_0xebd4('0x50')],util[_0xebd4('0x46')](_0x4b1122,{'showHidden':![],'depth':null}));if(_[_0xebd4('0x60')](this[_0xebd4('0x11')][_0x4b1122[_0xebd4('0x50')]])){this[_0xebd4('0x11')][_0x4b1122['uniqueid']]=[];}if(_[_0xebd4('0x60')](this['channels'][_0x4b1122[_0xebd4('0x50')]])){this[_0xebd4('0x13')][_0x4b1122[_0xebd4('0x50')]]={};}var _0x5f4849=new QueueReport();_0x5f4849[_0xebd4('0x58')]=_0x4b1122[_0xebd4('0x58')];_0x5f4849[_0xebd4('0x5b')]=this[_0xebd4('0x14')][_0x5f4849[_0xebd4('0x58')]]&&this[_0xebd4('0x14')][_0x5f4849[_0xebd4('0x58')]][_0xebd4('0x5b')]?this[_0xebd4('0x14')][_0x5f4849[_0xebd4('0x58')]][_0xebd4('0x5b')]||_0xebd4('0x70'):_0xebd4('0x70');_0x5f4849[_0xebd4('0x7b')]=moment()[_0xebd4('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x5f4849[_0xebd4('0x7c')]=_0x4b1122[_0xebd4('0x7c')];_0x5f4849[_0xebd4('0x7d')]=_0x4b1122[_0xebd4('0x7d')];_0x5f4849[_0xebd4('0x50')]=_0x4b1122[_0xebd4('0x50')];_0x5f4849['routealias']=this[_0xebd4('0x13')][_0x4b1122[_0xebd4('0x50')]]['routealias'];logger[_0xebd4('0x7e')](_0xebd4('0x7f'),_0x5f4849['queue'],_0x5f4849[_0xebd4('0x5b')]);Object[_0xebd4('0x6f')](_0x5f4849,_['pick'](_0x4b1122,_['keys'](_0x5f4849)));this[_0xebd4('0x11')][_0x4b1122[_0xebd4('0x50')]][_0xebd4('0x76')](_0x5f4849);this[_0xebd4('0x13')][_0x4b1122[_0xebd4('0x50')]]=_0x5f4849;this[_0xebd4('0x4d')](_0x5f4849,'queuecallerjoin');}}catch(_0x22628f){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x4b1122['uniqueid'],util['inspect'](_0x22628f,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xebd4('0x23')]=function(_0x5a9e3d){try{if(this[_0xebd4('0x5f')](_0x5a9e3d)){logger[_0xebd4('0x5c')](_0xebd4('0x80'),_0x5a9e3d[_0xebd4('0x50')],util['inspect'](_0x5a9e3d,{'showHidden':![],'depth':null}));if(this[_0xebd4('0x11')][_0x5a9e3d[_0xebd4('0x50')]]){var _0x50ee8e=_[_0xebd4('0x81')](this[_0xebd4('0x11')][_0x5a9e3d[_0xebd4('0x50')]]);_0x50ee8e['queuecallercomplete']=![];_0x50ee8e[_0xebd4('0x82')]=null;_0x50ee8e[_0xebd4('0x83')]=_0x5a9e3d[_0xebd4('0x83')];_0x50ee8e[_0xebd4('0x84')]=_0x5a9e3d['originalposition'];_0x50ee8e['queuecallerabandon']=!![];_0x50ee8e[_0xebd4('0x85')]=moment()[_0xebd4('0x51')](_0xebd4('0x86'));_0x50ee8e[_0xebd4('0x56')]=_0xebd4('0x87');_0x50ee8e[_0xebd4('0x88')]=null;logger['info']('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x50ee8e[_0xebd4('0x58')],_0x50ee8e[_0xebd4('0x5b')]);this[_0xebd4('0x13')][_0x5a9e3d[_0xebd4('0x50')]]=_0x50ee8e;this[_0xebd4('0x4a')](_0x50ee8e,_0xebd4('0x22'));}}}catch(_0x176063){logger['error'](_0xebd4('0x80'),_0x5a9e3d['uniqueid'],util[_0xebd4('0x46')](_0x176063,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xebd4('0xc')]['syncQueueCallerLeave']=function(_0x462292){try{if(this[_0xebd4('0x5f')](_0x462292)){logger[_0xebd4('0x5c')](_0xebd4('0x89'),_0x462292[_0xebd4('0x50')],util[_0xebd4('0x46')](_0x462292,{'showHidden':![],'depth':null}));if(this[_0xebd4('0x11')][_0x462292[_0xebd4('0x50')]]){var _0x3252e5=_[_0xebd4('0x81')](this[_0xebd4('0x11')][_0x462292[_0xebd4('0x50')]]);_0x3252e5[_0xebd4('0x8a')]=moment()['format'](_0xebd4('0x86'));_0x3252e5[_0xebd4('0x8b')]=_0x462292[_0xebd4('0x8b')];_0x3252e5[_0xebd4('0x8c')]=_0x462292[_0xebd4('0x8c')];logger['info'](_0xebd4('0x8d'),_0x3252e5['queue'],_0x3252e5[_0xebd4('0x5b')],_0x462292[_0xebd4('0x8b')],_0x462292['connectedlinename']);this[_0xebd4('0x13')][_0x462292[_0xebd4('0x50')]]=_0x3252e5;this['emitVoiceQueueChannelSave'](_0x3252e5,_0xebd4('0x24'));}}}catch(_0xc97cb1){logger[_0xebd4('0x44')](_0xebd4('0x89'),_0x462292[_0xebd4('0x50')],util[_0xebd4('0x46')](_0xc97cb1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xebd4('0xc')][_0xebd4('0x8e')]=function(_0x2c1e70){try{if(this[_0xebd4('0x5f')](_0x2c1e70)){logger[_0xebd4('0x5c')](_0xebd4('0x8f'),_0x2c1e70[_0xebd4('0x50')],util[_0xebd4('0x46')](_0x2c1e70,{'showHidden':![],'depth':null}));if(this[_0xebd4('0x11')][_0x2c1e70['uniqueid']]){var _0x19a05f=_[_0xebd4('0x81')](this[_0xebd4('0x11')][_0x2c1e70['uniqueid']]);_0x19a05f[_0xebd4('0x3e')]=!![];_0x19a05f['queuecallerexitreason']=_0xebd4('0x90');logger[_0xebd4('0x7e')](_0xebd4('0x91'),_0x19a05f[_0xebd4('0x58')],_0x19a05f[_0xebd4('0x5b')]);}}}catch(_0x375571){logger[_0xebd4('0x44')](_0xebd4('0x8f'),_0x2c1e70[_0xebd4('0x50')],util[_0xebd4('0x46')](_0x375571,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xebd4('0xc')][_0xebd4('0x27')]=function(_0x21af31){try{if(this[_0xebd4('0x5f')](_0x21af31)){logger[_0xebd4('0x5c')](_0xebd4('0x92'),_0x21af31[_0xebd4('0x50')],util['inspect'](_0x21af31,{'showHidden':![],'depth':null}));if(this[_0xebd4('0x11')][_0x21af31[_0xebd4('0x50')]]){var _0x52017f=_[_0xebd4('0x81')](this[_0xebd4('0x11')][_0x21af31[_0xebd4('0x50')]]);_0x52017f[_0xebd4('0x22')]=![];_0x52017f[_0xebd4('0x85')]=null;_0x52017f[_0xebd4('0x93')]=!![];_0x52017f[_0xebd4('0x88')]=_0x21af31[_0xebd4('0x94')];_0x52017f[_0xebd4('0x83')]=_0x21af31['holdtime'];_0x52017f[_0xebd4('0x3e')]=!![];_0x52017f[_0xebd4('0x3d')]=![];_0x52017f[_0xebd4('0x95')]=null;if(!_0x52017f[_0xebd4('0x96')]){if(_0x21af31[_0xebd4('0x97')]==_0xebd4('0x96')){_0x52017f[_0xebd4('0x56')]='COMPLETED';logger[_0xebd4('0x7e')](_0xebd4('0x98'),_0x52017f[_0xebd4('0x58')],_0x52017f[_0xebd4('0x5b')]);}else{if(_[_0xebd4('0x99')](_0x21af31[_0xebd4('0x9a')][_0xebd4('0x9b')](),_0xebd4('0x9c'))){if(this[_0xebd4('0x11')][_0x21af31[_0xebd4('0x9d')]]){var _0x555374=_[_0xebd4('0x81')](this[_0xebd4('0x11')][_0x21af31[_0xebd4('0x9d')]]);_0x555374['queuecallercomplete']=![];_0x555374[_0xebd4('0x3d')]=!![];_0x555374[_0xebd4('0x95')]=moment(_0x52017f[_0xebd4('0x7b')])[_0xebd4('0x9e')](_0x21af31[_0xebd4('0x83')],_0xebd4('0x9f'))[_0xebd4('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x555374[_0xebd4('0x56')]='FORWARDTRANSFER';_0x555374[_0xebd4('0x96')]=!![];_0x555374[_0xebd4('0xa0')]='FORWARD';_0x555374[_0xebd4('0xa1')]=_0x21af31[_0xebd4('0xa2')];_0x555374['transferuniqueid']=_0x21af31['uniqueid'];logger[_0xebd4('0x7e')](_0xebd4('0xa3'),_0x555374[_0xebd4('0x58')],_0x555374[_0xebd4('0x5b')]);var _0x536b00=this['queueReports'][_0x21af31[_0xebd4('0x9d')]];this['queueReports'][_0x21af31[_0xebd4('0x9d')]]=this[_0xebd4('0x11')][_0x21af31[_0xebd4('0x50')]];this[_0xebd4('0x11')][_0x21af31['uniqueid']]=_0x536b00;}}else{_0x52017f['queuecallerexitreason']=_0xebd4('0xa4')+_0x21af31[_0xebd4('0x97')][_0xebd4('0xa5')]();logger[_0xebd4('0x7e')](_0xebd4('0xa6'),_0x52017f[_0xebd4('0x58')],_0x52017f['type'],_0x52017f['queuecallerexitreason']);}}}this[_0xebd4('0x13')][_0x21af31['uniqueid']]=_0x52017f;}}}catch(_0x267697){logger[_0xebd4('0x44')](_0xebd4('0x92'),_0x21af31[_0xebd4('0x50')],util['inspect'](_0x267697,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xebd4('0xc')][_0xebd4('0x2a')]=function(_0x41ed5e){try{if(this['isNotNull'](_0x41ed5e)){logger[_0xebd4('0x5c')](_0xebd4('0xa7'),_0x41ed5e[_0xebd4('0x50')],util[_0xebd4('0x46')](_0x41ed5e,{'showHidden':![],'depth':null}));this[_0xebd4('0xa8')](_0x41ed5e[_0xebd4('0x50')],_[_0xebd4('0xa9')](_0x41ed5e[_0xebd4('0xaa')])[0x0],_0x41ed5e[_0xebd4('0xab')]);if(this[_0xebd4('0x11')][_0x41ed5e['uniqueid']]){var _0x5acac8=_[_0xebd4('0x81')](this['queueReports'][_0x41ed5e[_0xebd4('0x50')]]);if(_0x5acac8){if(this['isNotNull'](_0x41ed5e['variable'])&&this['isNotNull'](_0x41ed5e[_0xebd4('0xaa')][_0xebd4('0x66')])){switch(_0x41ed5e['value']){case _0xebd4('0xac'):_0x5acac8['queuecallerexit']=![];_0x5acac8['queuecallerexitAt']=null;break;case _0xebd4('0xad'):_0x5acac8[_0xebd4('0xae')]=_0xebd4('0xaf');_0x5acac8[_0xebd4('0x3d')]=!![];_0x5acac8[_0xebd4('0x95')]=moment()[_0xebd4('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x5acac8[_0xebd4('0x8a')]=moment()[_0xebd4('0x51')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0xebd4('0x5c')](_0xebd4('0xb0'),_0x41ed5e[_0xebd4('0x50')],util['inspect'](_0x5acac8,{'showHidden':![],'depth':null}));ami[_0xebd4('0x4c')](_0xebd4('0xb1'),_0x5acac8);break;default:_0x5acac8['queuecallerexit']=!![];_0x5acac8[_0xebd4('0x95')]=moment()[_0xebd4('0x51')](_0xebd4('0x86'));_0x5acac8[_0xebd4('0x8a')]=moment()[_0xebd4('0x51')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5acac8[_0xebd4('0x22')]=![];_0x5acac8['queuecallerabandonAt']=null;_0x5acac8['queuecallerexitreason']=_0x41ed5e[_0xebd4('0xab')];this[_0xebd4('0x13')][_0x41ed5e[_0xebd4('0x50')]]=_0x5acac8;this[_0xebd4('0x4a')](_0x5acac8,_0xebd4('0x29'));}else if(this[_0xebd4('0x5f')](_0x41ed5e[_0xebd4('0xaa')])&&this[_0xebd4('0x5f')](_0x41ed5e['variable'][_0xebd4('0xb2')])){if(!_0x5acac8[_0xebd4('0x22')]){_0x5acac8['queuecallerexit']=!![];_0x5acac8['queuecallerexitAt']=moment()[_0xebd4('0x51')](_0xebd4('0x86'));_0x5acac8['queuecallerexitreason']=_0xebd4('0xb3');_0x5acac8[_0xebd4('0x8a')]=moment()[_0xebd4('0x51')](_0xebd4('0x86'));this[_0xebd4('0x13')][_0x41ed5e[_0xebd4('0x50')]]=_0x5acac8;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x41ed5e['uniqueid'],_0x5acac8[_0xebd4('0x58')],_0x5acac8[_0xebd4('0x5b')],_[_0xebd4('0xa9')](_0x41ed5e[_0xebd4('0xaa')])[0x0],_0x41ed5e[_0xebd4('0xab')]);_0x5acac8['variables']=this[_0xebd4('0x17')][_0x41ed5e[_0xebd4('0x50')]];}}}}catch(_0x2c1257){logger[_0xebd4('0x44')](_0xebd4('0xa7'),_0x41ed5e[_0xebd4('0x50')],util[_0xebd4('0x46')](_0x2c1257,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xebd4('0xc')][_0xebd4('0xa8')]=function(_0x576927,_0x53d8a8,_0x1fa7a5){var _0x2893a0=[_0xebd4('0xb4'),_0xebd4('0xb5'),_0xebd4('0xb6'),_0xebd4('0xb7'),'rtpaudioqosloss',_0xebd4('0xb8'),_0xebd4('0xb9'),_0xebd4('0xba'),_0xebd4('0xbb'),_0xebd4('0xbc'),_0xebd4('0xbd'),_0xebd4('0xbe'),'membercalls',_0xebd4('0xbf'),_0xebd4('0xc0'),'memberlastcall',_0xebd4('0x94'),_0xebd4('0xc1'),_0xebd4('0xc2')];if(!_[_0xebd4('0x41')](_0x53d8a8)&&!_[_0xebd4('0xc3')](_0x2893a0,_0x53d8a8)){if(_[_0xebd4('0x60')](this[_0xebd4('0x17')][_0x576927])){this[_0xebd4('0x17')][_0x576927]={};}this[_0xebd4('0x17')][_0x576927][_0x53d8a8]=_0x1fa7a5;}};VoiceQueueReport[_0xebd4('0xc')]['handleHangup']=function(_0x5592d5,_0x5c9db6,_0xb433c5){try{var _0x278510={};if(this['queueReports'][_0x5592d5]){for(var _0x30d733=0x0;_0x30d7330x0?!![]:![];if(!_0x582768){return this[_0x909b('0x19')](this[_0x909b('0x16')]['completeEvent']);}};VoiceQueueReport[_0x909b('0xb')][_0x909b('0x6e')]=function(_0x3a7e75){var _0x1a7d9e=this[_0x909b('0x16')]['id'];if(this['summary'][_0x909b('0x65')][_0x1a7d9e]&&this[_0x909b('0x16')][_0x909b('0x65')][_0x1a7d9e][_0x3a7e75['actionid']]){this['summary'][_0x909b('0x65')][_0x1a7d9e][_0x3a7e75[_0x909b('0x64')]]['agents'][_0x909b('0x6f')](_0x3a7e75);}};VoiceQueueReport['prototype']['syncQueueSummary']=function(_0x523739){var _0x31a1d8=this;try{if(this[_0x909b('0x5c')](_0x523739)&&this[_0x909b('0x5c')](_0x523739[_0x909b('0x4f')])){logger[_0x909b('0x4a')](_0x909b('0x70'),util['inspect'](_0x523739,{'showHidden':![],'depth':null}));var _0x43d5ac=this['voiceQueues'][_0x523739[_0x909b('0x4f')]];if(_0x43d5ac){logger['debug']('[voiceQueueReport][queuesummary]\x20name:%s',_0x43d5ac[_0x909b('0x5a')]);this[_0x909b('0x16')][_0x909b('0x5f')][_0x43d5ac[_0x909b('0x5a')]]={'summaryEvent':_0x523739};this[_0x909b('0x16')][_0x909b('0x6d')]+=0x1;return ami[_0x909b('0x3b')]({'action':_0x909b('0x65'),'queue':_0x43d5ac['name']})['then'](function(_0x4ce849){if(!_0x31a1d8[_0x909b('0x16')][_0x909b('0x65')][_0x523739['actionid']]){_0x31a1d8[_0x909b('0x16')][_0x909b('0x65')][_0x523739['actionid']]={};}_0x31a1d8[_0x909b('0x16')][_0x909b('0x65')][_0x523739[_0x909b('0x64')]][_0x4ce849[_0x909b('0x64')]]={'queue':_0x43d5ac[_0x909b('0x5a')],'agents':[]};})['catch'](function(_0x5e4df0){throw _0x5e4df0;});}}}catch(_0x3dc408){logger['error'](_0x909b('0x66'),util[_0x909b('0x42')](_0x3dc408,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x909b('0x19')]=function(_0x1c78e3){if(this[_0x909b('0x16')]['statusRequests']>0x0){this[_0x909b('0x16')]['completeEvent']=_0x1c78e3;return;}logger[_0x909b('0x4a')](_0x909b('0x71'),util[_0x909b('0x42')](_0x1c78e3,{'showHidden':![],'depth':null}));this[_0x909b('0x16')]=initializeSummary();ami[_0x909b('0x49')](_0x909b('0x72'),{});};VoiceQueueReport[_0x909b('0xb')][_0x909b('0x1f')]=function(_0x44abaf){try{if(this[_0x909b('0x5c')](_0x44abaf)){logger[_0x909b('0x4a')](_0x909b('0x73'),_0x44abaf[_0x909b('0x53')],util[_0x909b('0x42')](_0x44abaf,{'showHidden':![],'depth':null}));if(_[_0x909b('0x5d')](this[_0x909b('0xf')][_0x44abaf[_0x909b('0x53')]])){this[_0x909b('0xf')][_0x44abaf[_0x909b('0x53')]]=[];}if(_[_0x909b('0x5d')](this['channels'][_0x44abaf['uniqueid']])){this[_0x909b('0x12')][_0x44abaf['uniqueid']]={};}var _0x2462b7=new QueueReport();_0x2462b7[_0x909b('0x4f')]=_0x44abaf[_0x909b('0x4f')];_0x2462b7['type']=this['voiceQueues'][_0x2462b7[_0x909b('0x4f')]]&&this[_0x909b('0x14')][_0x2462b7[_0x909b('0x4f')]][_0x909b('0x58')]?this[_0x909b('0x14')][_0x2462b7[_0x909b('0x4f')]][_0x909b('0x58')]||'inbound':_0x909b('0x59');_0x2462b7[_0x909b('0x74')]=moment()[_0x909b('0x4d')](_0x909b('0x75'));_0x2462b7['position']=_0x44abaf[_0x909b('0x76')];_0x2462b7['count']=_0x44abaf[_0x909b('0x77')];_0x2462b7[_0x909b('0x53')]=_0x44abaf[_0x909b('0x53')];_0x2462b7[_0x909b('0x78')]=this['channels'][_0x44abaf[_0x909b('0x53')]][_0x909b('0x78')];logger[_0x909b('0x79')](_0x909b('0x7a'),_0x2462b7[_0x909b('0x4f')],_0x2462b7['type']);Object[_0x909b('0x7b')](_0x2462b7,_[_0x909b('0x7c')](_0x44abaf,_[_0x909b('0x7d')](_0x2462b7)));this[_0x909b('0xf')][_0x44abaf[_0x909b('0x53')]][_0x909b('0x6f')](_0x2462b7);this[_0x909b('0x12')][_0x44abaf[_0x909b('0x53')]]=_0x2462b7;this['emitVoiceQueueChannelSave'](_0x2462b7,_0x909b('0x1e'));}}catch(_0x1658ea){logger[_0x909b('0x40')]('[%s][voiceQueueReport][queuecallerjoin]',_0x44abaf[_0x909b('0x53')],util[_0x909b('0x42')](_0x1658ea,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x909b('0xb')]['syncQueueCallerAbandon']=function(_0x44a118){try{if(this[_0x909b('0x5c')](_0x44a118)){logger[_0x909b('0x4a')](_0x909b('0x7e'),_0x44a118[_0x909b('0x53')],util[_0x909b('0x42')](_0x44a118,{'showHidden':![],'depth':null}));if(this[_0x909b('0xf')][_0x44a118['uniqueid']]){var _0x36e366=_[_0x909b('0x7f')](this[_0x909b('0xf')][_0x44a118[_0x909b('0x53')]]);_0x36e366[_0x909b('0x80')]=![];_0x36e366[_0x909b('0x81')]=null;_0x36e366[_0x909b('0x82')]=_0x44a118[_0x909b('0x82')];_0x36e366[_0x909b('0x83')]=_0x44a118['originalposition'];_0x36e366['queuecallerabandon']=!![];_0x36e366[_0x909b('0x84')]=moment()[_0x909b('0x4d')](_0x909b('0x75'));_0x36e366[_0x909b('0x54')]='ABANDONED';_0x36e366[_0x909b('0x85')]=null;logger['info']('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x36e366['queue'],_0x36e366[_0x909b('0x58')]);this[_0x909b('0x12')][_0x44a118['uniqueid']]=_0x36e366;this[_0x909b('0x47')](_0x36e366,_0x909b('0x39'));}}}catch(_0x5f0d6e){logger['error'](_0x909b('0x7e'),_0x44a118['uniqueid'],util[_0x909b('0x42')](_0x5f0d6e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x909b('0xb')][_0x909b('0x22')]=function(_0x197705){try{if(this[_0x909b('0x5c')](_0x197705)){logger[_0x909b('0x4a')](_0x909b('0x86'),_0x197705['uniqueid'],util['inspect'](_0x197705,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x197705[_0x909b('0x53')]]){var _0x4b0ece=_['last'](this[_0x909b('0xf')][_0x197705[_0x909b('0x53')]]);_0x4b0ece['queuecallerleaveAt']=moment()[_0x909b('0x4d')](_0x909b('0x75'));_0x4b0ece['connectedlinenum']=_0x197705[_0x909b('0x87')];_0x4b0ece[_0x909b('0x88')]=_0x197705[_0x909b('0x88')];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x4b0ece[_0x909b('0x4f')],_0x4b0ece[_0x909b('0x58')],_0x197705[_0x909b('0x87')],_0x197705[_0x909b('0x88')]);this['channels'][_0x197705['uniqueid']]=_0x4b0ece;this[_0x909b('0x89')](_0x4b0ece,'queuecallerleave');}}}catch(_0x1a9ef5){logger[_0x909b('0x40')]('[%s][voiceQueueReport][queuecallerleave]',_0x197705[_0x909b('0x53')],util[_0x909b('0x42')](_0x1a9ef5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x909b('0xb')]['syncAgentConnect']=function(_0x2a3b88){try{if(this[_0x909b('0x5c')](_0x2a3b88)){logger['debug'](_0x909b('0x8a'),_0x2a3b88['uniqueid'],util[_0x909b('0x42')](_0x2a3b88,{'showHidden':![],'depth':null}));if(this[_0x909b('0xf')][_0x2a3b88[_0x909b('0x53')]]){var _0x576900=_[_0x909b('0x7f')](this['queueReports'][_0x2a3b88[_0x909b('0x53')]]);_0x576900[_0x909b('0x80')]=!![];_0x576900[_0x909b('0x54')]=_0x909b('0x8b');logger[_0x909b('0x79')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x576900[_0x909b('0x4f')],_0x576900[_0x909b('0x58')]);}}}catch(_0x5692ee){logger['error'](_0x909b('0x8a'),_0x2a3b88[_0x909b('0x53')],util[_0x909b('0x42')](_0x5692ee,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x909b('0xb')]['syncAgentComplete']=function(_0x12c33f){try{if(this[_0x909b('0x5c')](_0x12c33f)){logger[_0x909b('0x4a')](_0x909b('0x8c'),_0x12c33f[_0x909b('0x53')],util[_0x909b('0x42')](_0x12c33f,{'showHidden':![],'depth':null}));if(this[_0x909b('0xf')][_0x12c33f[_0x909b('0x53')]]){var _0x1ca139=_['last'](this['queueReports'][_0x12c33f[_0x909b('0x53')]]);_0x1ca139['queuecallerabandon']=![];_0x1ca139['queuecallerabandonAt']=null;_0x1ca139[_0x909b('0x8d')]=!![];_0x1ca139['lastAssignedTo']=_0x12c33f[_0x909b('0x8e')];_0x1ca139['holdtime']=_0x12c33f['holdtime'];_0x1ca139['queuecallercomplete']=!![];_0x1ca139[_0x909b('0x38')]=![];_0x1ca139[_0x909b('0x8f')]=null;if(!_0x1ca139[_0x909b('0x90')]){if(_0x12c33f[_0x909b('0x91')]==_0x909b('0x90')){_0x1ca139['queuecallerexitreason']='COMPLETED';logger[_0x909b('0x79')](_0x909b('0x92'),_0x1ca139[_0x909b('0x4f')],_0x1ca139[_0x909b('0x58')]);}else{if(_[_0x909b('0x93')](_0x12c33f['channel'][_0x909b('0x94')](),_0x909b('0x95'))){if(this[_0x909b('0xf')][_0x12c33f[_0x909b('0x96')]]){var _0x337341=_['last'](this[_0x909b('0xf')][_0x12c33f['linkedid']]);_0x337341[_0x909b('0x80')]=![];_0x337341[_0x909b('0x38')]=!![];_0x337341[_0x909b('0x8f')]=moment(_0x1ca139['queuecallerjoinAt'])[_0x909b('0x97')](_0x12c33f[_0x909b('0x82')],_0x909b('0x98'))[_0x909b('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x337341[_0x909b('0x54')]=_0x909b('0x99');_0x337341[_0x909b('0x90')]=!![];_0x337341['transfertype']=_0x909b('0x9a');_0x337341[_0x909b('0x9b')]=_0x12c33f[_0x909b('0x9c')];_0x337341[_0x909b('0x9d')]=_0x12c33f[_0x909b('0x53')];logger[_0x909b('0x79')](_0x909b('0x9e'),_0x337341[_0x909b('0x4f')],_0x337341[_0x909b('0x58')]);var _0x5b9ac9=this['queueReports'][_0x12c33f[_0x909b('0x96')]];this[_0x909b('0xf')][_0x12c33f[_0x909b('0x96')]]=this['queueReports'][_0x12c33f[_0x909b('0x53')]];this['queueReports'][_0x12c33f[_0x909b('0x53')]]=_0x5b9ac9;}}else{_0x1ca139['queuecallerexitreason']=_0x909b('0x9f')+_0x12c33f[_0x909b('0x91')][_0x909b('0xa0')]();logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x1ca139[_0x909b('0x4f')],_0x1ca139[_0x909b('0x58')],_0x1ca139[_0x909b('0x54')]);}}}this['channels'][_0x12c33f[_0x909b('0x53')]]=_0x1ca139;}}}catch(_0x4cba63){logger[_0x909b('0x40')](_0x909b('0x8c'),_0x12c33f[_0x909b('0x53')],util[_0x909b('0x42')](_0x4cba63,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x909b('0xb')]['syncVarSet']=function(_0x31c399){try{if(this[_0x909b('0x5c')](_0x31c399)){logger[_0x909b('0x4a')]('[%s][voiceQueueReport][varset]',_0x31c399[_0x909b('0x53')],util[_0x909b('0x42')](_0x31c399,{'showHidden':![],'depth':null}));this['addVariable'](_0x31c399[_0x909b('0x53')],_[_0x909b('0x7d')](_0x31c399['variable'])[0x0],_0x31c399['value']);if(this[_0x909b('0xf')][_0x31c399[_0x909b('0x53')]]){var _0x5278f2=_[_0x909b('0x7f')](this[_0x909b('0xf')][_0x31c399['uniqueid']]);if(_0x5278f2){if(this[_0x909b('0x5c')](_0x31c399[_0x909b('0xa1')])&&this['isNotNull'](_0x31c399[_0x909b('0xa1')][_0x909b('0x65')])){switch(_0x31c399[_0x909b('0xa2')]){case _0x909b('0xa3'):_0x5278f2[_0x909b('0x38')]=![];_0x5278f2['queuecallerexitAt']=null;break;case'TIMEOUT':_0x5278f2[_0x909b('0xa4')]=_0x909b('0xa5');_0x5278f2['queuecallerexit']=!![];_0x5278f2[_0x909b('0x8f')]=moment()[_0x909b('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x5278f2[_0x909b('0xa6')]=moment()['format'](_0x909b('0x75'));logger[_0x909b('0x4a')](_0x909b('0xa7'),_0x31c399[_0x909b('0x53')],util['inspect'](_0x5278f2,{'showHidden':![],'depth':null}));ami[_0x909b('0x49')](_0x909b('0xa8'),_0x5278f2);break;default:_0x5278f2[_0x909b('0x38')]=!![];_0x5278f2[_0x909b('0x8f')]=moment()[_0x909b('0x4d')](_0x909b('0x75'));_0x5278f2[_0x909b('0xa6')]=moment()['format'](_0x909b('0x75'));}_0x5278f2[_0x909b('0x39')]=![];_0x5278f2[_0x909b('0x84')]=null;_0x5278f2[_0x909b('0x54')]=_0x31c399['value'];this[_0x909b('0x12')][_0x31c399[_0x909b('0x53')]]=_0x5278f2;this[_0x909b('0x47')](_0x5278f2,_0x909b('0x27'));}else if(this['isNotNull'](_0x31c399[_0x909b('0xa1')])&&this[_0x909b('0x5c')](_0x31c399[_0x909b('0xa1')][_0x909b('0xa9')])){if(!_0x5278f2[_0x909b('0x39')]){_0x5278f2[_0x909b('0x38')]=!![];_0x5278f2[_0x909b('0x8f')]=moment()[_0x909b('0x4d')](_0x909b('0x75'));_0x5278f2[_0x909b('0x54')]=_0x909b('0xaa');_0x5278f2[_0x909b('0xa6')]=moment()[_0x909b('0x4d')](_0x909b('0x75'));this[_0x909b('0x12')][_0x31c399['uniqueid']]=_0x5278f2;}}logger[_0x909b('0x79')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x31c399['uniqueid'],_0x5278f2[_0x909b('0x4f')],_0x5278f2[_0x909b('0x58')],_[_0x909b('0x7d')](_0x31c399['variable'])[0x0],_0x31c399[_0x909b('0xa2')]);_0x5278f2['variables']=this[_0x909b('0x44')][_0x31c399[_0x909b('0x53')]];}}}}catch(_0x11db1f){logger[_0x909b('0x40')](_0x909b('0xab'),_0x31c399[_0x909b('0x53')],util['inspect'](_0x11db1f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x909b('0xb')]['addVariable']=function(_0x395e7e,_0x37711e,_0x2fbdf1){var _0x4c3113=[_0x909b('0xac'),_0x909b('0xad'),_0x909b('0xae'),'rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged',_0x909b('0xaf'),_0x909b('0xb0'),_0x909b('0xb1'),'sipuri',_0x909b('0xb2'),'bridgepvtcallid','membercalls',_0x909b('0xb3'),_0x909b('0xb4'),_0x909b('0xb5'),'membername','memberpenalty','memberrealtime'];if(!_['isNil'](_0x37711e)&&!_[_0x909b('0xb6')](_0x4c3113,_0x37711e)){if(_[_0x909b('0x5d')](this[_0x909b('0x44')][_0x395e7e])){this[_0x909b('0x44')][_0x395e7e]={};}this[_0x909b('0x44')][_0x395e7e][_0x37711e]=_0x2fbdf1;}};VoiceQueueReport[_0x909b('0xb')][_0x909b('0xb7')]=function(_0x204fc3,_0x2e5c04,_0x46dd92){try{var _0x4e4b36={};if(this[_0x909b('0xf')][_0x204fc3]){for(var _0xf86bf1=0x0;_0xf86bf1=0x0?moment(_0x1723bc[_0x45eb('0x19')])['diff'](_0x1723bc['starttime'],_0x45eb('0xd')):null,'data1':'outbound','data2':_0x1723bc['accountcode'],'data3':_0x1723bc[_0x45eb('0xf')],'data4':_0x1723bc['dialstring']||null,'role':_0x45eb('0x11'),'internal':_0x1723bc[_0x45eb('0x13')]?_[_0x45eb('0x12')](_0x1723bc[_0x45eb('0x13')]):undefined,'uniqueid':_0x1723bc['uniqueid']},'log':_0x45eb('0x15')});}; \ No newline at end of file +var _0xfb87=['membername','starttime','endtime','dialstring','lodash','util','../client','queuecallerexitAt','CreateMemberReport','lastAssignedTo','isNil','interface','TALKING','diff','queuecallerleaveAt','seconds','inbound','calleridnum','exten','agent','accountcode','toNumber','uniqueid','voiceDialReport','Request','voice'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xfb87,0xee));var _0x7fb8=function(_0x305551,_0x868339){_0x305551=_0x305551-0x0;var _0x115ce2=_0xfb87[_0x305551];return _0x115ce2;};'use strict';var moment=require('moment');var _=require(_0x7fb8('0x0'));var util=require(_0x7fb8('0x1'));var client=require(_0x7fb8('0x2'));exports['voiceQueueReport']=function(_0x4a503f){var _0x183770=_0x4a503f['queuecallercompleteAt']||_0x4a503f[_0x7fb8('0x3')];return client['Request'](_0x7fb8('0x4'),{'body':{'channel':'voice','membername':_0x4a503f[_0x7fb8('0x5')],'interface':_[_0x7fb8('0x6')](_0x4a503f[_0x7fb8('0x7')])?util['format']('SIP/%s',_0x4a503f['lastAssignedTo']):_0x4a503f['interface'],'type':_0x7fb8('0x8'),'enterAt':_0x4a503f['queuecallerleaveAt'],'exitAt':_0x183770,'duration':moment(_0x183770)[_0x7fb8('0x9')](_0x4a503f[_0x7fb8('0xa')],_0x7fb8('0xb')),'data1':_0x7fb8('0xc'),'data2':_0x4a503f[_0x7fb8('0xd')],'data3':_0x4a503f[_0x7fb8('0xe')],'data4':null,'data5':_0x4a503f['queue'],'role':_0x7fb8('0xf'),'internal':_0x4a503f[_0x7fb8('0x10')]?_[_0x7fb8('0x11')](_0x4a503f['accountcode']):undefined,'uniqueid':_0x4a503f[_0x7fb8('0x12')]},'log':_0x7fb8('0x4')});};exports[_0x7fb8('0x13')]=function(_0x3c4196){return client[_0x7fb8('0x14')]('CreateMemberReport',{'body':{'channel':_0x7fb8('0x15'),'membername':_0x3c4196[_0x7fb8('0x16')],'interface':_0x3c4196[_0x7fb8('0x7')],'type':_0x7fb8('0x8'),'enterAt':_0x3c4196[_0x7fb8('0x17')],'exitAt':_0x3c4196['endtime'],'duration':moment(_0x3c4196[_0x7fb8('0x18')])['diff'](_0x3c4196[_0x7fb8('0x17')],_0x7fb8('0xb'))>=0x0?moment(_0x3c4196[_0x7fb8('0x18')])[_0x7fb8('0x9')](_0x3c4196[_0x7fb8('0x17')],_0x7fb8('0xb')):null,'data1':'outbound','data2':_0x3c4196[_0x7fb8('0x10')],'data3':_0x3c4196['exten'],'data4':_0x3c4196[_0x7fb8('0x19')]||null,'role':_0x7fb8('0xf'),'internal':_0x3c4196[_0x7fb8('0x10')]?_[_0x7fb8('0x11')](_0x3c4196['accountcode']):undefined,'uniqueid':_0x3c4196[_0x7fb8('0x12')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index ccde689..1ab4137 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 _0xd1eb=['getSettings','Request','stopRecordingOnTransfer','../client'];(function(_0x350cd0,_0x5b49f9){var _0x3f24a5=function(_0x3ab74e){while(--_0x3ab74e){_0x350cd0['push'](_0x350cd0['shift']());}};_0x3f24a5(++_0x5b49f9);}(_0xd1eb,0xc3));var _0xbd1e=function(_0x4a13e6,_0x2f2bfc){_0x4a13e6=_0x4a13e6-0x0;var _0x49febe=_0xd1eb[_0x4a13e6];return _0x49febe;};'use strict';var client=require(_0xbd1e('0x0'));exports[_0xbd1e('0x1')]=function(){return client[_0xbd1e('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xbd1e('0x3'),'previewRecallmeReminderInterval']},'log':'GetSettings'});}; \ No newline at end of file +var _0x566f=['Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','getSettings'];(function(_0x2fa457,_0x7021df){var _0x4f250a=function(_0xef901e){while(--_0xef901e){_0x2fa457['push'](_0x2fa457['shift']());}};_0x4f250a(++_0x7021df);}(_0x566f,0x124));var _0xf566=function(_0x535700,_0x12710b){_0x535700=_0x535700-0x0;var _0x12fd36=_0x566f[_0x535700];return _0x12fd36;};'use strict';var client=require(_0xf566('0x0'));exports[_0xf566('0x1')]=function(){return client[_0xf566('0x2')](_0xf566('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xf566('0x4'),_0xf566('0x5')]},'log':_0xf566('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index b459e63..89cb180 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 _0xa92a=['Request','GetTemplate','html','../client'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xa92a,0x1c7));var _0xaa92=function(_0x1044e5,_0x498e01){_0x1044e5=_0x1044e5-0x0;var _0x5ad0dd=_0xa92a[_0x1044e5];return _0x5ad0dd;};'use strict';var client=require(_0xaa92('0x0'));exports['getTemplates']=function(_0x5eb0f2){return function(_0x28aff2){return client[_0xaa92('0x1')](_0xaa92('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0xaa92('0x3')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x72a0=['getTemplates','Request','GetTemplate','name','../client'];(function(_0x169af2,_0x4079b7){var _0x407c7d=function(_0x35b63c){while(--_0x35b63c){_0x169af2['push'](_0x169af2['shift']());}};_0x407c7d(++_0x4079b7);}(_0x72a0,0x194));var _0x072a=function(_0x8a38c3,_0x308029){_0x8a38c3=_0x8a38c3-0x0;var _0x4af1dc=_0x72a0[_0x8a38c3];return _0x4af1dc;};'use strict';var client=require(_0x072a('0x0'));exports[_0x072a('0x1')]=function(_0x253c93){return function(_0x20f383){return client[_0x072a('0x2')](_0x072a('0x3'),{'options':{'raw':!![],'attributes':['id',_0x072a('0x4'),'html']},'log':_0x072a('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 13e50fd..4de22d5 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 _0x8ab7=['data7','GetTrigger','getTriggers','channel','Condition','field','operator','AnyConditions','value','Actions','action','data1','data3','data4','data5','data6'];(function(_0x2f260e,_0x239e29){var _0x5e9222=function(_0x3bcb71){while(--_0x3bcb71){_0x2f260e['push'](_0x2f260e['shift']());}};_0x5e9222(++_0x239e29);}(_0x8ab7,0x142));var _0x78ab=function(_0x347a76,_0x13d2fe){_0x347a76=_0x347a76-0x0;var _0x138e49=_0x8ab7[_0x347a76];return _0x138e49;};'use strict';var client=require('../client');exports[_0x78ab('0x0')]=function(_0x6ca270){return function(_0x3aceb7){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id','name',_0x78ab('0x1'),'status'],'include':[{'model':_0x78ab('0x2'),'as':'AllConditions','attributes':['id',_0x78ab('0x3'),_0x78ab('0x4'),'value']},{'model':_0x78ab('0x2'),'as':_0x78ab('0x5'),'attributes':['id',_0x78ab('0x3'),'operator',_0x78ab('0x6')]},{'model':'Action','as':_0x78ab('0x7'),'attributes':['id',_0x78ab('0x8'),_0x78ab('0x9'),'data2',_0x78ab('0xa'),_0x78ab('0xb'),_0x78ab('0xc'),_0x78ab('0xd'),_0x78ab('0xe')]}]},'log':_0x78ab('0xf')});};}; \ No newline at end of file +var _0x0540=['operator','value','Condition','AnyConditions','Action','Actions','action','data1','data2','data4','data6','../client','getTriggers','Request','GetTrigger','name','channel','status','field'];(function(_0x1adaa6,_0x3a522f){var _0x1673da=function(_0x96c6b7){while(--_0x96c6b7){_0x1adaa6['push'](_0x1adaa6['shift']());}};_0x1673da(++_0x3a522f);}(_0x0540,0xb6));var _0x0054=function(_0x2828d9,_0x472996){_0x2828d9=_0x2828d9-0x0;var _0x22d492=_0x0540[_0x2828d9];return _0x22d492;};'use strict';var client=require(_0x0054('0x0'));exports[_0x0054('0x1')]=function(_0x4f8ac9){return function(_0x73e9d9){return client[_0x0054('0x2')](_0x0054('0x3'),{'options':{'raw':![],'attributes':['id',_0x0054('0x4'),_0x0054('0x5'),_0x0054('0x6')],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0x0054('0x7'),_0x0054('0x8'),_0x0054('0x9')]},{'model':_0x0054('0xa'),'as':_0x0054('0xb'),'attributes':['id',_0x0054('0x7'),_0x0054('0x8'),'value']},{'model':_0x0054('0xc'),'as':_0x0054('0xd'),'attributes':['id',_0x0054('0xe'),_0x0054('0xf'),_0x0054('0x10'),'data3',_0x0054('0x11'),'data5',_0x0054('0x12'),'data7']}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index daf6bcd..440f7c7 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 _0xd847=['name','registry','defaultuser','GetTrunk','../client','getTrunks'];(function(_0x160c68,_0x59b748){var _0x1b29ab=function(_0x51f5b2){while(--_0x51f5b2){_0x160c68['push'](_0x160c68['shift']());}};_0x1b29ab(++_0x59b748);}(_0xd847,0x18a));var _0x7d84=function(_0x44f097,_0x1385a9){_0x44f097=_0x44f097-0x0;var _0x5f10a7=_0xd847[_0x44f097];return _0x5f10a7;};'use strict';var client=require(_0x7d84('0x0'));exports[_0x7d84('0x1')]=function(_0x3e5e53){return function(_0x1d94dd){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x7d84('0x2'),_0x7d84('0x3'),_0x7d84('0x4')]},'log':_0x7d84('0x5')});};}; \ No newline at end of file +var _0x3d25=['registry','defaultuser','GetTrunk','../client','getTrunks','Request','name'];(function(_0x585d81,_0xf6d74f){var _0x1aca0d=function(_0x3782d3){while(--_0x3782d3){_0x585d81['push'](_0x585d81['shift']());}};_0x1aca0d(++_0xf6d74f);}(_0x3d25,0xff));var _0x53d2=function(_0x68c4e3,_0x5b18b0){_0x68c4e3=_0x68c4e3-0x0;var _0xaca048=_0x3d25[_0x68c4e3];return _0xaca048;};'use strict';var client=require(_0x53d2('0x0'));exports[_0x53d2('0x1')]=function(_0x4fb683){return function(_0x342739){return client[_0x53d2('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x53d2('0x3'),_0x53d2('0x4'),_0x53d2('0x5')]},'log':_0x53d2('0x6')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 6d76a01..c71e818 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x4a88c9,_0x1d0aed){var _0x1663ea=function(_0x13bda0){while(--_0x13bda0){_0x4a88c9['push'](_0x4a88c9['shift']());}};_0x1663ea(++_0x1d0aed);}(_0x70e0,0x17b));var _0x070e=function(_0x58228a,_0x162385){_0x58228a=_0x58228a-0x0;var _0x3d1960=_0x70e0[_0x58228a];return _0x3d1960;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file +var _0x34e8=['../client','getAgents','Request','GetUser','name','email','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','agent','lastPauseAt'];(function(_0x45a4d0,_0x477e98){var _0x1dba02=function(_0x153607){while(--_0x153607){_0x45a4d0['push'](_0x45a4d0['shift']());}};_0x1dba02(++_0x477e98);}(_0x34e8,0x12c));var _0x834e=function(_0x4da92c,_0x3071b5){_0x4da92c=_0x4da92c-0x0;var _0x37670a=_0x34e8[_0x4da92c];return _0x37670a;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6'),_0x834e('0x7'),_0x834e('0x8'),_0x834e('0x9'),_0x834e('0xa'),'lastPauseAt',_0x834e('0xb'),'phone',_0x834e('0xc'),_0x834e('0xd')]},'log':_0x834e('0x1')});};};exports[_0x834e('0xe')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':!![],'where':{'role':_0x834e('0xf')},'attributes':['id',_0x834e('0x4'),_0x834e('0x6'),_0x834e('0x10')]},'log':_0x834e('0xe')});};};exports[_0x834e('0x11')]=function(_0x14038b,_0x2e1a37,_0x293514){return client[_0x834e('0x2')](_0x834e('0x12'),{'body':{'type':_0x2e1a37,'uniqueid':_0x293514},'options':{'where':{'id':_0x14038b['id']}},'log':'savePause'});};exports[_0x834e('0x13')]=function(_0x6cd9b9){return client['Request'](_0x834e('0x14'),{'body':{},'options':{'where':{'id':_0x6cd9b9['id']}},'log':_0x834e('0x11')});};exports[_0x834e('0x15')]=function(_0x21cc0a){return client['Request'](_0x834e('0x16'),{'options':{'raw':![],'where':{'role':_0x834e('0x17'),'id':_0x21cc0a},'attributes':['id','name',_0x834e('0x5'),'accountcode',_0x834e('0x7'),_0x834e('0x8'),'lastLoginAt',_0x834e('0xa'),_0x834e('0x18'),_0x834e('0xb'),'interface']},'log':_0x834e('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 4f7ef64..818d0ad 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 _0x7c1d=['Request','UpdateVoiceAgentReport','../client','create','CreateVoiceAgentReport','update'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x7c1d,0x16a));var _0xd7c1=function(_0x55806b,_0x3cb555){_0x55806b=_0x55806b-0x0;var _0x4cc875=_0x7c1d[_0x55806b];return _0x4cc875;};'use strict';var client=require(_0xd7c1('0x0'));exports[_0xd7c1('0x1')]=function(_0x2b60bf){return client['Request']('CreateVoiceAgentReport',{'body':_0x2b60bf,'log':_0xd7c1('0x2')});};exports[_0xd7c1('0x3')]=function(_0x3040d6,_0x3e4251,_0x157cba){return client[_0xd7c1('0x4')](_0xd7c1('0x5'),{'body':_0x3040d6,'options':{'where':{'uniqueid':_0x3e4251,'interface':_0x157cba,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x5452=['create','CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport'];(function(_0x43d5a8,_0x30e6f1){var _0x10546e=function(_0xb2b53c){while(--_0xb2b53c){_0x43d5a8['push'](_0x43d5a8['shift']());}};_0x10546e(++_0x30e6f1);}(_0x5452,0xe1));var _0x2545=function(_0x6142db,_0x5c0094){_0x6142db=_0x6142db-0x0;var _0x5d9c5b=_0x5452[_0x6142db];return _0x5d9c5b;};'use strict';var client=require('../client');exports[_0x2545('0x0')]=function(_0x40ced9){return client['Request'](_0x2545('0x1'),{'body':_0x40ced9,'log':_0x2545('0x1')});};exports[_0x2545('0x2')]=function(_0x35d7a4,_0x559d56,_0xee5c2){return client[_0x2545('0x3')]('UpdateVoiceAgentReport',{'body':_0x35d7a4,'options':{'where':{'uniqueid':_0x559d56,'interface':_0xee5c2,'agentcomplete':!![]}},'log':_0x2545('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 59aac73..f69f01f 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 _0xf2a6=['type','duration','billableseconds','moment','util','lodash','../client','CreateVoiceCallReport','calleridnum','context','getVoiceCallReports','Request','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf'];(function(_0x17ebb6,_0x465af7){var _0x32ec22=function(_0x160ff0){while(--_0x160ff0){_0x17ebb6['push'](_0x17ebb6['shift']());}};_0x32ec22(++_0x465af7);}(_0xf2a6,0x1de));var _0x6f2a=function(_0x19874e,_0x424eaa){_0x19874e=_0x19874e-0x0;var _0x432c57=_0xf2a6[_0x19874e];return _0x432c57;};'use strict';var moment=require(_0x6f2a('0x0'));var util=require(_0x6f2a('0x1'));var _=require(_0x6f2a('0x2'));var client=require(_0x6f2a('0x3'));exports['create']=function(_0x5dfc5d){return client['Request'](_0x6f2a('0x4'),{'body':_['merge'](_0x5dfc5d,{'source':_0x5dfc5d[_0x6f2a('0x5')],'destinationcontext':_0x5dfc5d[_0x6f2a('0x6')],'callerid':_0x5dfc5d['callerid'],'amaflags':'DOCUMENTATION'}),'log':_0x6f2a('0x4')});};exports[_0x6f2a('0x7')]=function(){return function(){return client[_0x6f2a('0x8')](_0x6f2a('0x9'),{'options':{'where':{'type':[_0x6f2a('0xa')],'createdAt':{'$between':[moment()[_0x6f2a('0xb')](_0x6f2a('0xc'))[_0x6f2a('0xd')](_0x6f2a('0xe')),moment()[_0x6f2a('0xf')](_0x6f2a('0xc'))['format'](_0x6f2a('0xe'))]}},'attributes':[_0x6f2a('0x10'),'disposition',_0x6f2a('0x11'),_0x6f2a('0x12')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x6c25=['../client','create','Request','CreateVoiceCallReport','merge','context','callerid','DOCUMENTATION','GetVoiceCallReport','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','util','lodash'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x6c25,0x1b3));var _0x56c2=function(_0x514532,_0x1985d6){_0x514532=_0x514532-0x0;var _0x4ae990=_0x6c25[_0x514532];return _0x4ae990;};'use strict';var moment=require('moment');var util=require(_0x56c2('0x0'));var _=require(_0x56c2('0x1'));var client=require(_0x56c2('0x2'));exports[_0x56c2('0x3')]=function(_0x2b3cb5){return client[_0x56c2('0x4')](_0x56c2('0x5'),{'body':_[_0x56c2('0x6')](_0x2b3cb5,{'source':_0x2b3cb5['calleridnum'],'destinationcontext':_0x2b3cb5[_0x56c2('0x7')],'callerid':_0x2b3cb5[_0x56c2('0x8')],'amaflags':_0x56c2('0x9')}),'log':_0x56c2('0x5')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x56c2('0x4')](_0x56c2('0xa'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()['startOf'](_0x56c2('0xb'))[_0x56c2('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0x56c2('0xb'))[_0x56c2('0xc')](_0x56c2('0xd'))]}},'attributes':[_0x56c2('0xe'),_0x56c2('0xf'),_0x56c2('0x10'),_0x56c2('0x11')]},'log':_0x56c2('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 35b1631..75c8207 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 _0x82db=['CreateVoiceDialReport','create','Request'];(function(_0xb65e77,_0x238c3d){var _0x38134b=function(_0x39da21){while(--_0x39da21){_0xb65e77['push'](_0xb65e77['shift']());}};_0x38134b(++_0x238c3d);}(_0x82db,0x1cf));var _0xb82d=function(_0x238681,_0x3b0528){_0x238681=_0x238681-0x0;var _0x10adc3=_0x82db[_0x238681];return _0x10adc3;};'use strict';var client=require('../client');exports[_0xb82d('0x0')]=function(_0x4e817b){return client[_0xb82d('0x1')]('CreateVoiceDialReport',{'body':_0x4e817b,'log':_0xb82d('0x2')});}; \ No newline at end of file +var _0x9229=['../client','create'];(function(_0x24b36f,_0x1ca3db){var _0x34eb73=function(_0x1d6064){while(--_0x1d6064){_0x24b36f['push'](_0x24b36f['shift']());}};_0x34eb73(++_0x1ca3db);}(_0x9229,0x124));var _0x9922=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x9229[_0x5e3b04];return _0x1fc44d;};'use strict';var client=require(_0x9922('0x0'));exports[_0x9922('0x1')]=function(_0x320b09){return client['Request']('CreateVoiceDialReport',{'body':_0x320b09,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 6dc8258..9a84552 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 _0x58a7=['recordingFormat','../client','getVoiceExtensions','Request','GetVoiceExtension','exten'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x58a7,0xf7));var _0x758a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x58a7[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x758a('0x0'));exports[_0x758a('0x1')]=function(){return function(){return client[_0x758a('0x2')](_0x758a('0x3'),{'options':{'raw':!![],'attributes':['id',_0x758a('0x4'),_0x758a('0x5')],'where':{'VoiceExtensionId':null}},'log':_0x758a('0x1')});};}; \ No newline at end of file +var _0xa902=['exten','../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x7791d5,_0xdab65f){var _0x5ce288=function(_0x2b818d){while(--_0x2b818d){_0x7791d5['push'](_0x7791d5['shift']());}};_0x5ce288(++_0xdab65f);}(_0xa902,0x8d));var _0x2a90=function(_0x48ecfd,_0x4e2565){_0x48ecfd=_0x48ecfd-0x0;var _0x45cff7=_0xa902[_0x48ecfd];return _0x45cff7;};'use strict';var client=require(_0x2a90('0x0'));exports[_0x2a90('0x1')]=function(){return function(){return client[_0x2a90('0x2')](_0x2a90('0x3'),{'options':{'raw':!![],'attributes':['id',_0x2a90('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x2a90('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index cf9515d..1ba5ef6 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 _0xb8e8=['mandatoryDispositionPause','active','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','Pause'];(function(_0x59a6ac,_0x5be681){var _0x76c846=function(_0x5bd431){while(--_0x5bd431){_0x59a6ac['push'](_0x59a6ac['shift']());}};_0x76c846(++_0x5be681);}(_0xb8e8,0x172));var _0x8b8e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb8e8[_0x501510];return _0x1e6ee5;};'use strict';var client=require(_0x8b8e('0x0'));exports[_0x8b8e('0x1')]=function(){return function(){return client[_0x8b8e('0x2')](_0x8b8e('0x3'),{'options':{'raw':![],'attributes':['id',_0x8b8e('0x4'),_0x8b8e('0x5'),_0x8b8e('0x6'),_0x8b8e('0x7'),_0x8b8e('0x8'),_0x8b8e('0x9'),_0x8b8e('0xa'),'dialMethod','dialLimitChannel',_0x8b8e('0xb'),_0x8b8e('0xc'),'dialPredictiveOptimization',_0x8b8e('0xd'),_0x8b8e('0xe'),'dialOriginateCallerIdName',_0x8b8e('0xf'),_0x8b8e('0x10'),_0x8b8e('0x11'),'dialQueueTimeout','dialQueueProject',_0x8b8e('0x12'),'dialCongestionRetryFrequency',_0x8b8e('0x13'),_0x8b8e('0x14'),'dialNoAnswerMaxRetry',_0x8b8e('0x15'),_0x8b8e('0x16'),_0x8b8e('0x17'),'dialGlobalInterval',_0x8b8e('0x18'),_0x8b8e('0x19'),_0x8b8e('0x1a'),_0x8b8e('0x1b'),'dialAMDGreeting',_0x8b8e('0x1c'),_0x8b8e('0x1d'),_0x8b8e('0x1e'),_0x8b8e('0x1f'),_0x8b8e('0x20'),_0x8b8e('0x21'),_0x8b8e('0x22'),_0x8b8e('0x23'),_0x8b8e('0x24'),'dialRecallInQueue',_0x8b8e('0x25'),_0x8b8e('0x26'),_0x8b8e('0x27'),'dialQueueProject2','monitor_format',_0x8b8e('0x28'),_0x8b8e('0x29'),_0x8b8e('0x2a'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency',_0x8b8e('0x2b'),_0x8b8e('0x2c'),'dialAbandonedMaxRetry',_0x8b8e('0x2d'),_0x8b8e('0x2e'),_0x8b8e('0x2f'),_0x8b8e('0x30'),_0x8b8e('0x31'),'mandatoryDisposition',_0x8b8e('0x32'),_0x8b8e('0x33'),_0x8b8e('0x34'),_0x8b8e('0x35')],'include':[{'model':'Trunk','as':_0x8b8e('0x36'),'attributes':['id',_0x8b8e('0x4'),_0x8b8e('0x37'),'active']},{'model':_0x8b8e('0x38'),'as':_0x8b8e('0x39'),'attributes':['id','name']},{'model':_0x8b8e('0x36'),'as':'TrunkBackup','attributes':['id',_0x8b8e('0x4'),_0x8b8e('0x37'),_0x8b8e('0x3a')]},{'model':_0x8b8e('0x3b'),'as':_0x8b8e('0x3b'),'attributes':['id',_0x8b8e('0x4')],'include':[{'model':_0x8b8e('0x3b'),'as':'Intervals','attributes':['id',_0x8b8e('0x4'),_0x8b8e('0x3c')]}]}]},'log':_0x8b8e('0x1')});};}; \ No newline at end of file +var _0x6089=['dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions'];(function(_0x17b178,_0x591046){var _0x1bae80=function(_0x12552a){while(--_0x12552a){_0x17b178['push'](_0x17b178['shift']());}};_0x1bae80(++_0x591046);}(_0x6089,0x1e7));var _0x9608=function(_0x1afa9e,_0x4c476a){_0x1afa9e=_0x1afa9e-0x0;var _0x110b30=_0x6089[_0x1afa9e];return _0x110b30;};'use strict';var client=require(_0x9608('0x0'));exports[_0x9608('0x1')]=function(){return function(){return client[_0x9608('0x2')](_0x9608('0x3'),{'options':{'raw':![],'attributes':['id',_0x9608('0x4'),_0x9608('0x5'),'acwTimeout',_0x9608('0x6'),'monitor_format','type',_0x9608('0x7'),_0x9608('0x8'),_0x9608('0x9'),'dialLimitQueue',_0x9608('0xa'),_0x9608('0xb'),_0x9608('0xc'),_0x9608('0xd'),_0x9608('0xe'),_0x9608('0xf'),'dialOriginateTimeout',_0x9608('0x10'),_0x9608('0x11'),'dialQueueProject',_0x9608('0x12'),_0x9608('0x13'),_0x9608('0x14'),_0x9608('0x15'),_0x9608('0x16'),_0x9608('0x17'),_0x9608('0x18'),_0x9608('0x19'),_0x9608('0x1a'),'dialPrefix',_0x9608('0x1b'),_0x9608('0x1c'),_0x9608('0x1d'),_0x9608('0x1e'),_0x9608('0x1f'),_0x9608('0x20'),_0x9608('0x21'),'dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0x9608('0x22'),_0x9608('0x23'),_0x9608('0x24'),'dialRecallInQueue',_0x9608('0x25'),_0x9608('0x26'),_0x9608('0x27'),_0x9608('0x28'),_0x9608('0x29'),'strategy','dialRandomLastDigitCallerIdNumber',_0x9608('0x2a'),_0x9608('0x2b'),_0x9608('0x2c'),_0x9608('0x2d'),_0x9608('0x2e'),'dialAbandonedMaxRetry','dialAbandonedRetryFrequency',_0x9608('0x2f'),_0x9608('0x30'),_0x9608('0x31'),_0x9608('0x32'),_0x9608('0x33'),'dialPredictiveIntervalMaxThreshold',_0x9608('0x34'),_0x9608('0x35'),_0x9608('0x36')],'include':[{'model':_0x9608('0x37'),'as':_0x9608('0x37'),'attributes':['id','name',_0x9608('0x38'),_0x9608('0x39')]},{'model':_0x9608('0x3a'),'as':_0x9608('0x3b'),'attributes':['id',_0x9608('0x4')]},{'model':_0x9608('0x37'),'as':_0x9608('0x3c'),'attributes':['id','name',_0x9608('0x38'),'active']},{'model':_0x9608('0x3d'),'as':_0x9608('0x3d'),'attributes':['id',_0x9608('0x4')],'include':[{'model':_0x9608('0x3d'),'as':_0x9608('0x3e'),'attributes':['id',_0x9608('0x4'),'interval']}]}]},'log':_0x9608('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index cb97d40..31038e5 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(_0x1eb31c,_0x3afd06){var _0x5df7a0=function(_0xc07fb3){while(--_0xc07fb3){_0x1eb31c['push'](_0x1eb31c['shift']());}};_0x5df7a0(++_0x3afd06);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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(_0x5513c8,_0x51e85c){var _0x35f6cb=function(_0x2b063d){while(--_0x2b063d){_0x5513c8['push'](_0x5513c8['shift']());}};_0x35f6cb(++_0x51e85c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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 d503521..ce0d974 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 _0x5fbb=['Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses','../client'];(function(_0x29d5e3,_0x3e8755){var _0x525e8a=function(_0x54f505){while(--_0x54f505){_0x29d5e3['push'](_0x29d5e3['shift']());}};_0x525e8a(++_0x3e8755);}(_0x5fbb,0x12b));var _0xb5fb=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x5fbb[_0x2c91e9];return _0x13f0ff;};'use strict';var client=require(_0xb5fb('0x0'));exports['getVoiceQueueRtPauses']=function(_0x499d8b){return function(){return client[_0xb5fb('0x1')](_0xb5fb('0x2'),{'options':{'where':{'VoiceQueueId':_0x499d8b,'paused':!![]},'raw':!![]},'log':_0xb5fb('0x3')});};}; \ No newline at end of file +var _0x39a6=['getVoiceQueueRtPauses','Request'];(function(_0x3e69ae,_0x366e8d){var _0x3d7f42=function(_0x5df093){while(--_0x5df093){_0x3e69ae['push'](_0x3e69ae['shift']());}};_0x3d7f42(++_0x366e8d);}(_0x39a6,0x178));var _0x639a=function(_0x34d5be,_0x51a595){_0x34d5be=_0x34d5be-0x0;var _0x2f29c7=_0x39a6[_0x34d5be];return _0x2f29c7;};'use strict';var client=require('../client');exports[_0x639a('0x0')]=function(_0x58c562){return function(){return client[_0x639a('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x58c562,'paused':!![]},'raw':!![]},'log':_0x639a('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 1a765e0..1cea296 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x34c95b,_0x382d3e){var _0xb0cef=function(_0x3df8ae){while(--_0x3df8ae){_0x34c95b['push'](_0x34c95b['shift']());}};_0xb0cef(++_0x382d3e);}(_0x7a54,0x106));var _0x47a5=function(_0x5701ec,_0x35a9da){_0x5701ec=_0x5701ec-0x0;var _0x2fe223=_0x7a54[_0x5701ec];return _0x2fe223;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x2e6aaf,_0x595176){var _0x39b072=function(_0xb687bb){while(--_0xb687bb){_0x2e6aaf['push'](_0x2e6aaf['shift']());}};_0x39b072(++_0x595176);}(_0x7a54,0x106));var _0x47a5=function(_0x4e3633,_0x11ac84){_0x4e3633=_0x4e3633-0x0;var _0x2fceae=_0x7a54[_0x4e3633];return _0x2fceae;};'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 2328522..fc67208 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 _0x185b=['secondtransfererconnectedlinename','origtransfereraccountcode','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','Request','CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','origtransferercalleridnum','origtransferercalleridname'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0x185b,0xab));var _0xb185=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x185b[_0x2070da];return _0x4f9fe1;};'use strict';var client=require(_0xb185('0x0'));exports[_0xb185('0x1')]={};exports['blindTransfer']=function(_0x2ac066){return client[_0xb185('0x2')](_0xb185('0x3'),{'body':{'result':_0x2ac066[_0xb185('0x4')],'transfererchannel':_0x2ac066['transfererchannel'],'transferercalleridnum':_0x2ac066[_0xb185('0x5')],'transferercalleridname':_0x2ac066[_0xb185('0x6')],'transfererconnectedlinenum':_0x2ac066[_0xb185('0x7')],'transfererconnectedlinename':_0x2ac066[_0xb185('0x8')],'transfereraccountcode':_0x2ac066[_0xb185('0x9')],'transferercontext':_0x2ac066[_0xb185('0xa')],'transfererexten':_0x2ac066['transfererexten'],'transfererlinkedid':_0x2ac066[_0xb185('0xb')],'transfereechannel':_0x2ac066[_0xb185('0xc')],'transfereecalleridnum':_0x2ac066['transfereecalleridnum'],'transfereecalleridname':_0x2ac066['transfereecalleridname'],'transfereeconnectedlinenum':_0x2ac066['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x2ac066[_0xb185('0xd')],'transfereeaccountcode':_0x2ac066['transfereeaccountcode'],'transfereecontext':_0x2ac066[_0xb185('0xe')],'transfereeexten':_0x2ac066[_0xb185('0xf')],'transfereelinkedid':_0x2ac066[_0xb185('0x10')],'isexternal':_0x2ac066[_0xb185('0x11')],'context':_0x2ac066[_0xb185('0x12')],'extension':_0x2ac066[_0xb185('0x13')],'type':_0xb185('0x14')},'log':_0xb185('0x3')});};exports[_0xb185('0x15')]=function(_0x37117c){return client['Request'](_0xb185('0x3'),{'body':{'result':_0x37117c[_0xb185('0x4')],'transfererchannel':_0x37117c['origtransfererchannel'],'transferercalleridnum':_0x37117c[_0xb185('0x16')],'transferercalleridname':_0x37117c[_0xb185('0x17')],'transfererconnectedlinenum':_0x37117c['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x37117c[_0xb185('0x18')],'transfereraccountcode':_0x37117c[_0xb185('0x19')],'transferercontext':_0x37117c['secondtransferercontext'],'transfererexten':_0x37117c['secondtransfererexten'],'transfererlinkedid':_0x37117c[_0xb185('0x1a')],'transfereechannel':_0x37117c[_0xb185('0x1b')],'transfereecalleridnum':_0x37117c[_0xb185('0x1c')],'transfereecalleridname':_0x37117c[_0xb185('0x1d')],'transfereeconnectedlinenum':_0x37117c[_0xb185('0x1e')],'transfereeconnectedlinename':_0x37117c[_0xb185('0x1f')],'transfereeaccountcode':_0x37117c[_0xb185('0x20')],'transfereecontext':_0x37117c[_0xb185('0x21')],'transfereeexten':_0x37117c[_0xb185('0x22')],'transfereelinkedid':_0x37117c[_0xb185('0x23')],'isexternal':_0x37117c[_0xb185('0x11')],'context':_0x37117c[_0xb185('0x24')],'extension':_0x37117c[_0xb185('0x25')],'type':_0xb185('0x26')},'log':_0xb185('0x3')});}; \ No newline at end of file +var _0x641b=['attendedTransfer','Request','result','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransferercontext','attended','../client','transfers','blindTransfer','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','CreateVoiceTransferReport'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x641b,0x89));var _0xb641=function(_0x57cacf,_0x5ead5d){_0x57cacf=_0x57cacf-0x0;var _0x37c3a8=_0x641b[_0x57cacf];return _0x37c3a8;};'use strict';var client=require(_0xb641('0x0'));exports[_0xb641('0x1')]={};exports[_0xb641('0x2')]=function(_0x5bb2d8){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x5bb2d8['result'],'transfererchannel':_0x5bb2d8[_0xb641('0x3')],'transferercalleridnum':_0x5bb2d8[_0xb641('0x4')],'transferercalleridname':_0x5bb2d8[_0xb641('0x5')],'transfererconnectedlinenum':_0x5bb2d8['transfererconnectedlinenum'],'transfererconnectedlinename':_0x5bb2d8[_0xb641('0x6')],'transfereraccountcode':_0x5bb2d8[_0xb641('0x7')],'transferercontext':_0x5bb2d8[_0xb641('0x8')],'transfererexten':_0x5bb2d8[_0xb641('0x9')],'transfererlinkedid':_0x5bb2d8[_0xb641('0xa')],'transfereechannel':_0x5bb2d8[_0xb641('0xb')],'transfereecalleridnum':_0x5bb2d8[_0xb641('0xc')],'transfereecalleridname':_0x5bb2d8['transfereecalleridname'],'transfereeconnectedlinenum':_0x5bb2d8[_0xb641('0xd')],'transfereeconnectedlinename':_0x5bb2d8['transfereeconnectedlinename'],'transfereeaccountcode':_0x5bb2d8[_0xb641('0xe')],'transfereecontext':_0x5bb2d8[_0xb641('0xf')],'transfereeexten':_0x5bb2d8[_0xb641('0x10')],'transfereelinkedid':_0x5bb2d8[_0xb641('0x11')],'isexternal':_0x5bb2d8[_0xb641('0x12')],'context':_0x5bb2d8[_0xb641('0x13')],'extension':_0x5bb2d8[_0xb641('0x14')],'type':_0xb641('0x15')},'log':_0xb641('0x16')});};exports[_0xb641('0x17')]=function(_0x511663){return client[_0xb641('0x18')](_0xb641('0x16'),{'body':{'result':_0x511663[_0xb641('0x19')],'transfererchannel':_0x511663['origtransfererchannel'],'transferercalleridnum':_0x511663[_0xb641('0x1a')],'transferercalleridname':_0x511663[_0xb641('0x1b')],'transfererconnectedlinenum':_0x511663[_0xb641('0x1c')],'transfererconnectedlinename':_0x511663['secondtransfererconnectedlinename'],'transfereraccountcode':_0x511663[_0xb641('0x1d')],'transferercontext':_0x511663['secondtransferercontext'],'transfererexten':_0x511663[_0xb641('0x1e')],'transfererlinkedid':_0x511663[_0xb641('0x1f')],'transfereechannel':_0x511663[_0xb641('0x20')],'transfereecalleridnum':_0x511663['transfertargetcalleridnum'],'transfereecalleridname':_0x511663[_0xb641('0x21')],'transfereeconnectedlinenum':_0x511663['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x511663[_0xb641('0x22')],'transfereeaccountcode':_0x511663[_0xb641('0x23')],'transfereecontext':_0x511663[_0xb641('0x24')],'transfereeexten':_0x511663['transfertargetexten'],'transfereelinkedid':_0x511663[_0xb641('0x25')],'isexternal':_0x511663[_0xb641('0x12')],'context':_0x511663[_0xb641('0x26')],'extension':_0x511663['origtransfererexten'],'type':_0xb641('0x27')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 9acc250..50e72ef 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(_0x261a8d,_0x2a1384){var _0x1d8c99=function(_0x537dc7){while(--_0x537dc7){_0x261a8d['push'](_0x261a8d['shift']());}};_0x1d8c99(++_0x2a1384);}(_0x7a54,0x106));var _0x47a5=function(_0x1253f8,_0x44417f){_0x1253f8=_0x1253f8-0x0;var _0x357383=_0x7a54[_0x1253f8];return _0x357383;};'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 _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(_0x14c9f9,_0x896584){var _0x5441a0=function(_0x5a7260){while(--_0x5a7260){_0x14c9f9['push'](_0x14c9f9['shift']());}};_0x5441a0(++_0x896584);}(_0x7a54,0x106));var _0x47a5=function(_0x4bb9b3,_0x212f34){_0x4bb9b3=_0x4bb9b3-0x0;var _0x264e47=_0x7a54[_0x4bb9b3];return _0x264e47;};'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 diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 8437377..7b6df3e 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 _0x1472=['ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','stringify','emit','data1','data2','isNil','data5','xmd-contactid','data3','phone','$or','routeId','destcalleridnum','calleridnum','firstName','lastName','fax','ListId','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','[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','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','format','trigger:%s','toLowerCase','merge','length','lodash','bluebird'];(function(_0x1526a9,_0x48fb64){var _0x9f4049=function(_0x13271a){while(--_0x13271a){_0x1526a9['push'](_0x1526a9['shift']());}};_0x9f4049(++_0x48fb64);}(_0x1472,0x166));var _0x2147=function(_0x3f2228,_0x3b27d5){_0x3f2228=_0x3f2228-0x0;var _0x285ae4=_0x1472[_0x3f2228];return _0x285ae4;};'use strict';var _=require(_0x2147('0x0'));var BPromise=require(_0x2147('0x1'));var Redis=require(_0x2147('0x2'));var util=require(_0x2147('0x3'));var config=require(_0x2147('0x4'));var logger=require(_0x2147('0x5'))(_0x2147('0x6'));var cmContactRpc=require(_0x2147('0x7'));config['redis']=_['defaults'](config[_0x2147('0x8')],{'host':_0x2147('0x9'),'port':0x18eb});var io=require(_0x2147('0xa'))(new Redis(config['redis']));function emit(_0x4b8324,_0x160f19,_0x4b8310,_0x4286f8,_0x1d759e){logger[_0x2147('0xb')]('[CM][%s][%s]',_0x4b8324,_0x160f19['id'],_0x4b8310,_0x4286f8,JSON[_0x2147('0xc')](_0x1d759e));io['to'](_0x4b8310)[_0x2147('0xd')](_0x4286f8,_0x1d759e);}exports['exec']=function(_0x39d26a,_0x9b5369,_0x1f8bbc,_0x2809f2){var _0x357f5a,_0x4e4e5e;var _0x23e3ef={};var _0x4d9fcc;var _0x352b6f=Number(_0x1f8bbc[_0x2147('0xe')]);var _0x11a373=_0x1f8bbc[_0x2147('0xf')]?Boolean(Number(_0x1f8bbc[_0x2147('0xf')])):![];var _0x2b1c3a;var _0x365c1c=![];if(!_[_0x2147('0x10')](_0x1f8bbc['data5'])){if(_0x1f8bbc[_0x2147('0x11')]=='1')_0x365c1c=!![];}if(!_0x365c1c){if(_0x2809f2[_0x2147('0x12')]){_0x23e3ef['id']=_0x2809f2['xmd-contactid'];}}if(!_0x23e3ef['id']){_0x23e3ef['ListId']=_0x352b6f;_0x2b1c3a=_0x1f8bbc[_0x2147('0x13')]&&_0x1f8bbc[_0x2147('0x13')]!=='0'?_0x1f8bbc[_0x2147('0x13')]['split'](','):[_0x2147('0x14')];_0x23e3ef[_0x2147('0x15')]=_['map'](_0x2b1c3a,function(_0x35c26b){var _0x3ad5e6={};_0x3ad5e6[_0x35c26b]=_0x2809f2[_0x2147('0x16')]?_0x2809f2[_0x2147('0x17')]:_0x2809f2['calleridnum'];return _0x3ad5e6;});_0x4d9fcc=_0x2809f2[_0x2147('0x16')]?_0x2809f2[_0x2147('0x17')]:_0x2809f2[_0x2147('0x18')];}var _0x125943=['id',_0x2147('0x19'),_0x2147('0x1a'),_0x2147('0x14'),'mobile',_0x2147('0x1b'),_0x2147('0x1c'),_0x2147('0x1d'),_0x2147('0x1e'),_0x2147('0x1f')];var _0x3b2053=_[_0x2147('0x20')](_0x125943,_0x2b1c3a);BPromise[_0x2147('0x21')]()[_0x2147('0x22')](cmContactRpc[_0x2147('0x23')]({'attributes':_0x3b2053,'where':_0x23e3ef,'phone':_0x4d9fcc}))[_0x2147('0x22')](function(_0x36d29a){_0x4e4e5e=_0x36d29a;if(!_[_0x2147('0x24')](_0x4e4e5e)){if(_0x4e4e5e['length']===0x1){_0x357f5a=_0x4e4e5e[0x0];logger[_0x2147('0xb')](_0x2147('0x25'),_0x2809f2[_0x2147('0x26')],_0x9b5369['id'],_0x357f5a['id']);}else{logger[_0x2147('0xb')](_0x2147('0x27'),_0x2809f2[_0x2147('0x26')],_0x9b5369['id'],_[_0x2147('0x28')](_0x4e4e5e,'id')[_0x2147('0x29')](','));}return;}else{logger[_0x2147('0xb')](_0x2147('0x2a'),_0x2809f2[_0x2147('0x26')],_0x9b5369['id']);var _0x1a6128={'ListId':_0x352b6f};var _0x564552=_0x1f8bbc[_0x2147('0x2b')]&&_0x1f8bbc['data4']!=='0'?_0x1f8bbc[_0x2147('0x2b')]:_0x2147('0x14');if(_0x11a373){logger[_0x2147('0xb')](_0x2147('0x2c'),_0x2809f2['uniqueid'],_0x9b5369['id']);_0x1a6128[_0x564552]=_[_0x2147('0x10')](_0x2809f2[_0x2147('0x16')])?_0x2809f2[_0x2147('0x18')]:_0x2809f2[_0x2147('0x17')];if(_[_0x2147('0x10')](_0x2809f2[_0x2147('0x16')])){_0x1a6128[_0x2147('0x19')]=_0x2809f2[_0x2147('0x2d')]&&_0x2809f2[_0x2147('0x2d')]!==_0x2147('0x2e')?_0x2809f2[_0x2147('0x2d')]:_0x2147('0x2f');}else{_0x1a6128[_0x2147('0x19')]=_0x2809f2[_0x2147('0x30')]&&_0x2809f2[_0x2147('0x30')]!==''?_0x2809f2[_0x2147('0x30')]:'Unknown';}return BPromise['resolve']()[_0x2147('0x22')](cmContactRpc[_0x2147('0x31')](_0x1a6128))[_0x2147('0x22')](function(_0x5b9ecd){_0x357f5a=_0x5b9ecd;_0x4e4e5e[_0x2147('0x32')](_0x5b9ecd);if(_0x357f5a){logger[_0x2147('0xb')](_0x2147('0x33'),_0x2809f2[_0x2147('0x26')],_0x9b5369['id'],_0x357f5a['id']);}return;});}else{logger[_0x2147('0xb')](_0x2147('0x34'),_0x2809f2[_0x2147('0x26')],_0x9b5369['id']);_0x1a6128[_0x564552]=_[_0x2147('0x10')](_0x2809f2[_0x2147('0x16')])?_0x2809f2['calleridnum']:_0x2809f2[_0x2147('0x17')];if(_[_0x2147('0x10')](_0x2809f2[_0x2147('0x16')])){_0x1a6128['firstName']=_0x2809f2[_0x2147('0x2d')]&&_0x2809f2[_0x2147('0x2d')]!==_0x2147('0x2e')?_0x2809f2[_0x2147('0x2d')]:_0x2147('0x2f');}else{_0x1a6128[_0x2147('0x19')]=_0x2809f2[_0x2147('0x30')]&&_0x2809f2['destcalleridname']!==_0x2147('0x2e')?_0x2809f2['destcalleridname']:_0x2147('0x2f');}_0x357f5a=_0x1a6128;_0x4e4e5e[_0x2147('0x32')](_0x1a6128);return;}}})[_0x2147('0x22')](function(){if(_0x39d26a){emit(_0x2809f2[_0x2147('0x26')],_0x9b5369,util['format'](_0x2147('0x35'),_0x39d26a[_0x2147('0x36')]),util[_0x2147('0x37')](_0x2147('0x38'),_0x1f8bbc['action'][_0x2147('0x39')]()),{'evt':_[_0x2147('0x3a')](_0x2809f2,{'autoCreate':_0x11a373}),'contact':_0x357f5a===undefined?{}:_0x357f5a,'contacts':_0x4e4e5e[_0x2147('0x3b')]===0x0?undefined:_0x4e4e5e});}});}; \ No newline at end of file +var _0xc35f=['calleridname','','destcalleridname','Unknown','resolve','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','format','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','info','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','data3','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','phone','mobile','fax','ListId','createdAt','updatedAt','union','getContacts','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled'];(function(_0x320668,_0x6f40cc){var _0x48a8b4=function(_0x27b90e){while(--_0x27b90e){_0x320668['push'](_0x320668['shift']());}};_0x48a8b4(++_0x6f40cc);}(_0xc35f,0x16f));var _0xfc35=function(_0xa4340a,_0x500e62){_0xa4340a=_0xa4340a-0x0;var _0x5704ae=_0xc35f[_0xa4340a];return _0x5704ae;};'use strict';var _=require(_0xfc35('0x0'));var BPromise=require(_0xfc35('0x1'));var Redis=require(_0xfc35('0x2'));var util=require(_0xfc35('0x3'));var config=require(_0xfc35('0x4'));var logger=require(_0xfc35('0x5'))(_0xfc35('0x6'));var cmContactRpc=require(_0xfc35('0x7'));config[_0xfc35('0x8')]=_[_0xfc35('0x9')](config[_0xfc35('0x8')],{'host':_0xfc35('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfc35('0x8')]));function emit(_0x16077a,_0x2a16ea,_0xfd2169,_0x53ee60,_0x56a014){logger[_0xfc35('0xb')]('[CM][%s][%s]',_0x16077a,_0x2a16ea['id'],_0xfd2169,_0x53ee60,JSON[_0xfc35('0xc')](_0x56a014));io['to'](_0xfd2169)[_0xfc35('0xd')](_0x53ee60,_0x56a014);}exports[_0xfc35('0xe')]=function(_0x138fe0,_0x5bd7df,_0x5d2967,_0x464f9b){var _0x436afc,_0x5f57f3;var _0x7f2a17={};var _0x3cd92f;var _0x53e553=Number(_0x5d2967[_0xfc35('0xf')]);var _0xa1c840=_0x5d2967[_0xfc35('0x10')]?Boolean(Number(_0x5d2967[_0xfc35('0x10')])):![];var _0x5324bc;var _0x38757f=![];if(!_[_0xfc35('0x11')](_0x5d2967[_0xfc35('0x12')])){if(_0x5d2967[_0xfc35('0x12')]=='1')_0x38757f=!![];}if(!_0x38757f){if(_0x464f9b[_0xfc35('0x13')]){_0x7f2a17['id']=_0x464f9b[_0xfc35('0x13')];}}if(!_0x7f2a17['id']){_0x7f2a17['ListId']=_0x53e553;_0x5324bc=_0x5d2967[_0xfc35('0x14')]&&_0x5d2967[_0xfc35('0x14')]!=='0'?_0x5d2967['data3']['split'](','):['phone'];_0x7f2a17[_0xfc35('0x15')]=_[_0xfc35('0x16')](_0x5324bc,function(_0x13a1ca){var _0x371fff={};_0x371fff[_0x13a1ca]=_0x464f9b[_0xfc35('0x17')]?_0x464f9b[_0xfc35('0x18')]:_0x464f9b[_0xfc35('0x19')];return _0x371fff;});_0x3cd92f=_0x464f9b['routeId']?_0x464f9b[_0xfc35('0x18')]:_0x464f9b[_0xfc35('0x19')];}var _0x4fd805=['id',_0xfc35('0x1a'),_0xfc35('0x1b'),_0xfc35('0x1c'),_0xfc35('0x1d'),_0xfc35('0x1e'),_0xfc35('0x1f'),_0xfc35('0x20'),'scheduledAt',_0xfc35('0x21')];var _0x570a08=_[_0xfc35('0x22')](_0x4fd805,_0x5324bc);BPromise['resolve']()['then'](cmContactRpc[_0xfc35('0x23')]({'attributes':_0x570a08,'where':_0x7f2a17,'phone':_0x3cd92f}))[_0xfc35('0x24')](function(_0x4507ac){_0x5f57f3=_0x4507ac;if(!_[_0xfc35('0x25')](_0x5f57f3)){if(_0x5f57f3[_0xfc35('0x26')]===0x1){_0x436afc=_0x5f57f3[0x0];logger['info'](_0xfc35('0x27'),_0x464f9b[_0xfc35('0x28')],_0x5bd7df['id'],_0x436afc['id']);}else{logger[_0xfc35('0xb')](_0xfc35('0x29'),_0x464f9b[_0xfc35('0x28')],_0x5bd7df['id'],_['map'](_0x5f57f3,'id')[_0xfc35('0x2a')](','));}return;}else{logger['info'](_0xfc35('0x2b'),_0x464f9b[_0xfc35('0x28')],_0x5bd7df['id']);var _0x7dbebb={'ListId':_0x53e553};var _0x455f47=_0x5d2967[_0xfc35('0x2c')]&&_0x5d2967[_0xfc35('0x2c')]!=='0'?_0x5d2967[_0xfc35('0x2c')]:_0xfc35('0x1c');if(_0xa1c840){logger['info'](_0xfc35('0x2d'),_0x464f9b[_0xfc35('0x28')],_0x5bd7df['id']);_0x7dbebb[_0x455f47]=_[_0xfc35('0x11')](_0x464f9b[_0xfc35('0x17')])?_0x464f9b[_0xfc35('0x19')]:_0x464f9b[_0xfc35('0x18')];if(_['isNil'](_0x464f9b[_0xfc35('0x17')])){_0x7dbebb[_0xfc35('0x1a')]=_0x464f9b[_0xfc35('0x2e')]&&_0x464f9b[_0xfc35('0x2e')]!==_0xfc35('0x2f')?_0x464f9b[_0xfc35('0x2e')]:'Unknown';}else{_0x7dbebb[_0xfc35('0x1a')]=_0x464f9b[_0xfc35('0x30')]&&_0x464f9b[_0xfc35('0x30')]!==''?_0x464f9b[_0xfc35('0x30')]:_0xfc35('0x31');}return BPromise[_0xfc35('0x32')]()[_0xfc35('0x24')](cmContactRpc['createContact'](_0x7dbebb))[_0xfc35('0x24')](function(_0xc2cc90){_0x436afc=_0xc2cc90;_0x5f57f3[_0xfc35('0x33')](_0xc2cc90);if(_0x436afc){logger[_0xfc35('0xb')](_0xfc35('0x34'),_0x464f9b[_0xfc35('0x28')],_0x5bd7df['id'],_0x436afc['id']);}return;});}else{logger[_0xfc35('0xb')](_0xfc35('0x35'),_0x464f9b[_0xfc35('0x28')],_0x5bd7df['id']);_0x7dbebb[_0x455f47]=_[_0xfc35('0x11')](_0x464f9b[_0xfc35('0x17')])?_0x464f9b[_0xfc35('0x19')]:_0x464f9b[_0xfc35('0x18')];if(_['isNil'](_0x464f9b['routeId'])){_0x7dbebb[_0xfc35('0x1a')]=_0x464f9b['calleridname']&&_0x464f9b[_0xfc35('0x2e')]!==''?_0x464f9b[_0xfc35('0x2e')]:_0xfc35('0x31');}else{_0x7dbebb[_0xfc35('0x1a')]=_0x464f9b[_0xfc35('0x30')]&&_0x464f9b[_0xfc35('0x30')]!==''?_0x464f9b[_0xfc35('0x30')]:_0xfc35('0x31');}_0x436afc=_0x7dbebb;_0x5f57f3[_0xfc35('0x33')](_0x7dbebb);return;}}})['then'](function(){if(_0x138fe0){emit(_0x464f9b[_0xfc35('0x28')],_0x5bd7df,util['format'](_0xfc35('0x36'),_0x138fe0[_0xfc35('0x37')]),util[_0xfc35('0x38')]('trigger:%s',_0x5d2967['action'][_0xfc35('0x39')]()),{'evt':_[_0xfc35('0x3a')](_0x464f9b,{'autoCreate':_0xa1c840}),'contact':_0x436afc===undefined?{}:_0x436afc,'contacts':_0x5f57f3[_0xfc35('0x26')]===0x0?undefined:_0x5f57f3});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index c8fa56e..9b372c5 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 _0xfc9f=['replace','motionChannel','AllConditions','every','checkConditions','channel','AnyConditions','length','some','checkTrigger:\x20trigger','evt','inspect','field','ChatWebsiteId','value','upperFirst','AccountId','operator','interaction','message','event','queue','agent','membername','lastevent','mailSubstatus','null','undefined','substatus','offlineMessage','created','equals','exports','util','url','mustache','ioredis','./urlforward','./integration','trigger','../ami','redis','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:newinteraction','custom:substatus','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','stringify','clone','voice','debug','interface','hasOwnProperty','status','checkTrigger','merge','variables','Actions','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','data2','html','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','windowWidth','windowHeight','data6','600','winApplication','render','winArguments','user:%s','name','format','trigger:%s:%s','trigger:%s','action','integration','exec','voiceExtensions','routeId','query','search'];(function(_0x148e49,_0x1b5a5b){var _0x19223a=function(_0x352153){while(--_0x352153){_0x148e49['push'](_0x148e49['shift']());}};_0x19223a(++_0x1b5a5b);}(_0xfc9f,0x11d));var _0xffc9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfc9f[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xffc9('0x0'));var _=require('lodash');var url=require(_0xffc9('0x1'));var Mustache=require(_0xffc9('0x2'));var Redis=require(_0xffc9('0x3'));var urlforward=require(_0xffc9('0x4'));var integration=require(_0xffc9('0x5'));var cmContact=require('./cmContact');var script=require('./script');var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xffc9('0x6'));var ami=require(_0xffc9('0x7'));config[_0xffc9('0x8')]=_['defaults'](config[_0xffc9('0x8')],{'host':_0xffc9('0x9'),'port':0x18eb});var io=require(_0xffc9('0xa'))(new Redis(config['redis']));var operators={'equals':function(_0x19cbaa,_0x5e59a2){return _0x19cbaa==_0x5e59a2;},'not_equals':function(_0x39642b,_0x5c14d5){return _0x39642b!=_0x5c14d5;}};var barAndWebActions=[_0xffc9('0xb'),_0xffc9('0x1'),_0xffc9('0xc')];function Trigger(_0x431a46){this[_0xffc9('0xd')]=_0x431a46[_0xffc9('0xd')];this[_0xffc9('0xe')]=_0x431a46[_0xffc9('0xe')];this[_0xffc9('0xf')]=_0x431a46[_0xffc9('0xf')];this[_0xffc9('0x10')]=_0x431a46[_0xffc9('0x10')];this['voiceExtensions']=_0x431a46['voiceExtensions'];this[_0xffc9('0x11')]=_0x431a46[_0xffc9('0x11')];this[_0xffc9('0x12')]=_0x431a46[_0xffc9('0x12')];this[_0xffc9('0x13')]=_0x431a46[_0xffc9('0x13')];this[_0xffc9('0x14')]=_0x431a46[_0xffc9('0x14')];this[_0xffc9('0x15')]=_0x431a46[_0xffc9('0x15')];this[_0xffc9('0x16')]=_0x431a46['deskAccounts'];this[_0xffc9('0x17')]=_0x431a46[_0xffc9('0x17')];this[_0xffc9('0x18')]=_0x431a46[_0xffc9('0x18')];this[_0xffc9('0x19')]=_0x431a46[_0xffc9('0x19')];this[_0xffc9('0x1a')]=_0x431a46[_0xffc9('0x1a')];this[_0xffc9('0x1b')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0xffc9('0x13')],'freshdesk':this[_0xffc9('0x12')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0xffc9('0x15')],'desk':this[_0xffc9('0x16')],'vtiger':this[_0xffc9('0x17')],'dynamics365':this[_0xffc9('0x19')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0xffc9('0x18')]};ami['on'](_0xffc9('0x1c'),this[_0xffc9('0x1d')][_0xffc9('0x1e')](this));ami['on'](_0xffc9('0x1f'),this[_0xffc9('0x1d')][_0xffc9('0x1e')](this));ami['on'](_0xffc9('0x20'),this[_0xffc9('0x1d')][_0xffc9('0x1e')](this));ami['on'](_0xffc9('0x21'),this['syncCustomEvent'][_0xffc9('0x1e')](this));ami['on']('custom:agentnosuchnumber',this[_0xffc9('0x1d')]['bind'](this));ami['on']('custom:agentnoanswer',this['syncCustomEvent'][_0xffc9('0x1e')](this));ami['on'](_0xffc9('0x22'),this[_0xffc9('0x1d')][_0xffc9('0x1e')](this));ami['on'](_0xffc9('0x23'),this[_0xffc9('0x1d')][_0xffc9('0x1e')](this));ami['on'](_0xffc9('0x24'),this['syncCustomEvent'][_0xffc9('0x1e')](this));ami['on']('custom:amd',this[_0xffc9('0x1d')][_0xffc9('0x1e')](this));ami['on'](_0xffc9('0x25'),this[_0xffc9('0x1d')][_0xffc9('0x1e')](this));ami['on']('custom:timeout',this[_0xffc9('0x1d')]['bind'](this));ami['on'](_0xffc9('0x26'),this['syncAgentDial'][_0xffc9('0x1e')](this));ami['on'](_0xffc9('0x27'),this[_0xffc9('0x28')][_0xffc9('0x1e')](this));ami['on']('custom:dialend',this[_0xffc9('0x28')]['bind'](this));ami['on'](_0xffc9('0x29'),this[_0xffc9('0x1d')]['bind'](this));ami['on']('custom:closedinteraction',this['syncCustomEvent']['bind'](this));ami['on'](_0xffc9('0x2a'),this[_0xffc9('0x1d')][_0xffc9('0x1e')](this));ami['on']('custom:incomingmessage',this[_0xffc9('0x1d')][_0xffc9('0x1e')](this));ami['on'](_0xffc9('0x2b'),this[_0xffc9('0x1d')][_0xffc9('0x1e')](this));ami['on'](_0xffc9('0x2c'),this[_0xffc9('0x1d')][_0xffc9('0x1e')](this));ami['on'](_0xffc9('0x2d'),this[_0xffc9('0x1d')]['bind'](this));ami['on']('custom:offlineMessage',this[_0xffc9('0x1d')][_0xffc9('0x1e')](this));}Trigger[_0xffc9('0x2e')][_0xffc9('0x2f')]=function(_0x459ae5,_0x569f82,_0xaadfde){logger['info'](_0x459ae5,_0x569f82,JSON[_0xffc9('0x30')](_0xaadfde));io['to'](_0x459ae5)[_0xffc9('0x2f')](_0x569f82,_0xaadfde);};Trigger[_0xffc9('0x2e')][_0xffc9('0x1d')]=function(_0x2e3c06){var _0x326297=_[_0xffc9('0x31')](_0x2e3c06);if(typeof _0x326297['motionChannel']==='undefined'){_0x326297['motionChannel']=_0xffc9('0x32');}logger[_0xffc9('0x33')](_0xffc9('0x1d'),util['inspect'](_0x326297,{'showHidden':!![],'depth':null}));this['checkTriggers'](_0x326297);};Trigger['prototype'][_0xffc9('0x28')]=function(_0x764fb6){if(this['agents'][_0x764fb6[_0xffc9('0x34')]]){this[_0xffc9('0x1d')](_0x764fb6);}};Trigger[_0xffc9('0x2e')]['checkTriggers']=function(_0x179819){var _0x1678a6;for(var _0x1f2d89 in this[_0xffc9('0xd')]){if(this[_0xffc9('0xd')][_0xffc9('0x35')](_0x1f2d89)){if(this[_0xffc9('0xd')][_0x1f2d89][_0xffc9('0x36')]){_0x1678a6=this[_0xffc9('0x37')](this[_0xffc9('0xd')][_0x1f2d89],_0x179819);if(_0x1678a6){_[_0xffc9('0x38')](_0x179819,_0x179819[_0xffc9('0x39')]);for(var _0x272e9d=0x0,_0x3a5a59,_0x1a3b0f,_0x4e3c47;_0x272e9d0x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ No newline at end of file +var _0x814b=['calleridname','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','desk','redis','defaults','localhost','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','then','total_entries','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','[HTTP]','%s:%s','authType','token','username','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','length','string','nameField','toLowerCase','content','picklist','idField','customField','custom_fields','type','variableName','customVariable','Variable','name','priority','merge','getString','Subjects','xCALLY','CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','catch','error','stringify','recordingFormat','none','[OUTBOUND]','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','unmanaged','lastevent'];(function(_0xda281b,_0x1d6b32){var _0x2a83fc=function(_0x502e7a){while(--_0x502e7a){_0xda281b['push'](_0xda281b['shift']());}};_0x2a83fc(++_0x1d6b32);}(_0x814b,0x1a2));var _0xb814=function(_0x2f023d,_0x29dfe5){_0x2f023d=_0x2f023d-0x0;var _0x4ef240=_0x814b[_0x2f023d];return _0x4ef240;};'use strict';var _=require(_0xb814('0x0'));var rp=require(_0xb814('0x1'));var md5=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var Redis=require(_0xb814('0x4'));var intUtil=require(_0xb814('0x5'));var config=require('../../../../config/environment');var logger=require(_0xb814('0x6'))(_0xb814('0x7'));config[_0xb814('0x8')]=_[_0xb814('0x9')](config[_0xb814('0x8')],{'host':_0xb814('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb814('0x8')]));function emit(_0x2e6272,_0x5c8539,_0x271af9){io['to'](_0x2e6272)[_0xb814('0xb')](_0x5c8539,_0x271af9);}var headers={'Content-Type':_0xb814('0xc'),'Accept':_0xb814('0xc')};function getUser(_0x1fea33,_0x21d4a5){if(intUtil[_0xb814('0xd')](_0x21d4a5)===!![]){logger[_0xb814('0xe')](_0xb814('0xf'),_0x21d4a5);return request({'uri':util[_0xb814('0x10')](_0xb814('0x11'),_0x1fea33['remoteUri'])})[_0xb814('0x12')](function(_0x56278f){if(_0x56278f[_0xb814('0x13')]){return _[_0xb814('0x14')](_0x56278f[_0xb814('0x15')][_0xb814('0x16')],{'email':_0x21d4a5});}})[_0xb814('0x12')](function(_0x3bde14){if(_0x3bde14){logger[_0xb814('0xe')](_0xb814('0x17'));return _0x3bde14;}else{logger[_0xb814('0xe')](_0xb814('0x18'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}});}else{logger[_0xb814('0xe')](_0xb814('0x1b'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}}function request(_0x125ce2){logger[_0xb814('0x1c')](_0xb814('0x1d'),JSON['stringify'](_0x125ce2));return rp(_[_0xb814('0x9')](_0x125ce2,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x270598){var _0xfac75b;if(_0x270598['authType']==='basic'){_0xfac75b=util['format'](_0xb814('0x1e'),_0x270598['username'],_0x270598['password']);}else if(_0x270598[_0xb814('0x1f')]===_0xb814('0x20')){_0xfac75b=util[_0xb814('0x10')]('%s/token:%s',_0x270598[_0xb814('0x21')],_0x270598['token']);}return util[_0xb814('0x10')](_0xb814('0x22'),new Buffer(_0xfac75b)[_0xb814('0x23')](_0xb814('0x24')));}function getEndUser(_0x27352e,_0x2bd039,_0x1f5d40){logger['info'](_0xb814('0x25'),_0x1f5d40);return request({'uri':util['format'](_0xb814('0x26'),_0x27352e[_0xb814('0x1a')]),'qs':{'phone':_0x1f5d40}})[_0xb814('0x12')](function(_0x208927){if(_0x208927[_0xb814('0x13')]){logger[_0xb814('0xe')](_0xb814('0x27'));return _0x208927['_embedded'][_0xb814('0x16')][0x0];}else{logger[_0xb814('0xe')](_0xb814('0x28'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x29'),_0x27352e[_0xb814('0x1a')]),'method':_0xb814('0x2a'),'body':{'first_name':_0x2bd039,'title':_0x2bd039,'phone_numbers':[{'type':_0xb814('0x2b'),'value':_0x1f5d40}]}});}});}function getTags(_0x5a6291,_0x271aa8){var _0x328a08=[];if(_0x5a6291&&_0x5a6291['length']>0x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ 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 9a5364f..9383202 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 _0xb1de=['uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','unmanaged','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','../../../../config/logger','dynamics365','../../../../config/environment','defaults','localhost','socket.io-emitter','redis','modernAuthentication','CloudProvider','data7','tenantId','data2','resolve','data5','POST','remoteUri','username','password','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','toLowerCase','outbound','destcalleridnum','contacts','/systemusers(','Bearer\x20','body','odata-entityid','substring','lastIndexOf','enduserId','calleridnum','telephone1','contacts?$select=','\x20eq\x20\x27','%2b','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','includes','string','picklist','type','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','Subjects','getString','Descriptions','/contacts(','userId','Fields','callDirection','queue','phonecalls','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x40e35a,_0x1d610a){var _0x5f0637=function(_0x45e78e){while(--_0x45e78e){_0x40e35a['push'](_0x40e35a['shift']());}};_0x5f0637(++_0x1d610a);}(_0xb1de,0x166));var _0xeb1d=function(_0x2f90fa,_0x37724d){_0x2f90fa=_0x2f90fa-0x0;var _0x384458=_0xb1de[_0x2f90fa];return _0x384458;};'use strict';var _=require(_0xeb1d('0x0'));var rp=require(_0xeb1d('0x1'));var util=require(_0xeb1d('0x2'));var intUtil=require(_0xeb1d('0x3'));var md5=require(_0xeb1d('0x4'));var Redis=require('ioredis');var logger=require(_0xeb1d('0x5'))(_0xeb1d('0x6'));var config=require(_0xeb1d('0x7'));config['redis']=_[_0xeb1d('0x8')](config['redis'],{'host':_0xeb1d('0x9'),'port':0x18eb});var io=require(_0xeb1d('0xa'))(new Redis(config[_0xeb1d('0xb')]));function getAuthToken(_0x4d0f6a,_0x17e641,_0x4a7e5c){if(_0x4d0f6a[_0xeb1d('0xc')]){_0x4d0f6a['remoteUri']=_0x4d0f6a[_0xeb1d('0xd')][_0xeb1d('0xe')];_0x4d0f6a[_0xeb1d('0xf')]=_0x4d0f6a[_0xeb1d('0xd')][_0xeb1d('0x10')];return Promise[_0xeb1d('0x11')](_0x4d0f6a[_0xeb1d('0xd')][_0xeb1d('0x12')]);}var _0x29d76f={'method':_0xeb1d('0x13'),'uri':_0x17e641,'form':{'client_id':_0x4d0f6a['clientId'],'resource':_0x4d0f6a[_0xeb1d('0x14')],'username':_0x4d0f6a[_0xeb1d('0x15')],'password':_0x4d0f6a[_0xeb1d('0x16')],'grant_type':_0xeb1d('0x16'),'client_secret':_0x4d0f6a['clientSecret']},'json':!![]};return rp(_0x29d76f)['then'](function(_0x315ef5){return _0x315ef5[_0xeb1d('0x17')];})[_0xeb1d('0x18')](function(_0x1f9fb9){logger[_0xeb1d('0x19')]('['+[_0x4a7e5c[_0xeb1d('0x1a')]()]+_0xeb1d('0x1b'));return _0x1f9fb9[_0xeb1d('0x1c')];});}function getUser(_0x4b7e18,_0x2f8380,_0x839119,_0x1e6e74,_0x3a206c,_0x250db7){return new Promise(function(_0x27efbf,_0x1d68bd){return getAuthToken(_0x2f8380,_0x1e6e74,_0x250db7)[_0xeb1d('0x1d')](function(_0x138ece){var _0x5afbc5={'method':_0xeb1d('0x1e'),'uri':_0x3a206c+_0xeb1d('0x1f'),'headers':{'Authorization':'Bearer\x20'+_0x138ece,'OData-Version':_0xeb1d('0x20')},'json':!![]};return rp(_0x5afbc5);})[_0xeb1d('0x1d')](function(_0x39eddf){var _0x472305=_0x39eddf[_0xeb1d('0x21')];var _0x3e5cee=![];var _0x54c886=null;if(!_['isNil'](_0x839119)){if(intUtil['validateEmail'](_0x839119[_0xeb1d('0x22')])){_0x4b7e18[_0xeb1d('0x23')]=_0x839119['email'];for(_0x54c886=0x0;_0x54c886<_0x472305[_0xeb1d('0x24')];_0x54c886++){if(_0x472305[_0x54c886][_0xeb1d('0x25')]===_0x839119[_0xeb1d('0x22')]&&!_0x472305[_0x54c886][_0xeb1d('0x26')]){_0x3e5cee=!![];logger[_0xeb1d('0x27')]('['+[_0x250db7[_0xeb1d('0x1a')]()]+_0xeb1d('0x28')+_0x472305[_0x54c886][_0xeb1d('0x29')]+'!');_0x4b7e18['userId']=_0x472305[_0x54c886][_0xeb1d('0x29')];}}}}if(!_0x3e5cee){logger[_0xeb1d('0x27')]('['+[_0x250db7[_0xeb1d('0x1a')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x4b7e18[_0xeb1d('0x23')]=_0x2f8380[_0xeb1d('0x15')];for(_0x54c886=0x0;_0x54c886<_0x472305[_0xeb1d('0x24')];_0x54c886++){if(_0x472305[_0x54c886]['internalemailaddress']===_0x2f8380['username']){_0x4b7e18['userId']=_0x472305[_0x54c886][_0xeb1d('0x29')];}}}_0x27efbf(_0x4b7e18);})[_0xeb1d('0x18')](function(_0x507f88){_0x1d68bd(_0x507f88[_0xeb1d('0x1c')]);});});}function createEndUser(_0x2f07d3,_0x2b087b,_0xe234e9,_0x2140ab,_0x180150,_0x3a4331,_0x279473){return new Promise(function(_0x3cb7f3,_0x43baed){return getAuthToken(_0x2b087b,_0xe234e9,_0x3a4331)[_0xeb1d('0x1d')](function(_0x3593ea){var _0x50f07f=_0x3a4331[_0xeb1d('0x2a')]()===_0xeb1d('0x2b')?_0x180150[_0xeb1d('0x2c')]:_0x180150['calleridnum'];var _0x2e70ed={'method':'POST','uri':_0x2140ab+_0xeb1d('0x2d'),'body':{'fullname':_0x50f07f,'firstname':_0x50f07f,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xeb1d('0x2e')+_0x2f07d3['userId']+')'},'headers':{'Authorization':_0xeb1d('0x2f')+_0x3593ea,'OData-Version':_0xeb1d('0x20')},'json':!![],'resolveWithFullResponse':!![]};_0x2e70ed[_0xeb1d('0x30')][_0x279473]=_0x50f07f;return rp(_0x2e70ed);})['then'](function(_0x20a89f){var _0x117e56=_0x20a89f['headers'][_0xeb1d('0x31')];var _0x361d56=_0x117e56[_0xeb1d('0x32')](_0x117e56[_0xeb1d('0x33')]('(')+0x1,_0x117e56[_0xeb1d('0x33')](')'));_0x2f07d3[_0xeb1d('0x34')]=_0x361d56;_0x3cb7f3(_0x2f07d3);})['catch'](function(_0x53c6b0){_0x43baed(_0x53c6b0[_0xeb1d('0x1c')]);});});}function getEndUser(_0x26d8fe,_0x1abeab,_0x898e60,_0x47d99c,_0x1a2aeb,_0x2e225d,_0x5448a6,_0x16512d){var _0x88824b=_0x2e225d[_0xeb1d('0x2a')]()===_0xeb1d('0x2b')?_0x1a2aeb[_0xeb1d('0x2c')]:_0x1a2aeb[_0xeb1d('0x35')];return getAuthToken(_0x1abeab,_0x898e60,_0x2e225d)[_0xeb1d('0x1d')](function(_0x556cc7){_0x16512d=_0x16512d?_0x16512d:_0xeb1d('0x36');var _0x50a01f={'method':'GET','uri':_0x47d99c+_0xeb1d('0x37')+_0x16512d+'&$filter='+_0x16512d+_0xeb1d('0x38')+_0x88824b['replace']('+',_0xeb1d('0x39'))+'\x27','headers':{'Authorization':_0xeb1d('0x2f')+_0x556cc7,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x50a01f);})[_0xeb1d('0x1d')](function(_0x5c9169){var _0x51a5eb=![];if(!_0x5c9169)return _0x51a5eb;var _0x801bcf=_0x5c9169[_0xeb1d('0x21')];for(var _0x32a510=0x0;_0x32a510<_0x801bcf[_0xeb1d('0x24')];_0x32a510++){if(_0x801bcf[_0x32a510][_0x16512d]===_0x88824b){_0x51a5eb=!![];_0x26d8fe[_0xeb1d('0x34')]=_0x801bcf[_0x32a510][_0xeb1d('0x3a')];}}return _0x51a5eb;})[_0xeb1d('0x1d')](function(_0x343bfe){if(_0x343bfe)return _0x26d8fe;if(_0x5448a6==='nothing'){logger[_0xeb1d('0x27')]('['+[_0x2e225d['toUpperCase']()]+_0xeb1d('0x3b'));return _0x26d8fe;}return createEndUser(_0x26d8fe,_0x1abeab,_0x898e60,_0x47d99c,_0x1a2aeb,_0x2e225d,_0x16512d)['then'](function(_0x4c6916){logger[_0xeb1d('0x27')]('['+[_0x2e225d['toUpperCase']()]+']\x20Enduser\x20created!',_0x4c6916['enduserId']);return _0x4c6916;});});}function getCustomFields(_0x2f52f6,_0x2fe2c9,_0x363c1e){var _0xad7c42={};if(_0x2f52f6[_0xeb1d('0x24')]>0x0){_['forEach'](_0x2f52f6,function(_0x5262a8){if(_[_0xeb1d('0x3c')]([_0xeb1d('0x3d'),_0xeb1d('0x3e')],_0x5262a8[_0xeb1d('0x3f')])&&_0x5262a8[_0xeb1d('0x40')]&&!_0x5262a8[_0xeb1d('0x41')]){var _0x2d81f1=_0x5262a8[_0xeb1d('0x42')]['toLowerCase']();var _0x549152=_0x2d81f1[_0xeb1d('0x32')](0x0,_0x2d81f1[_0xeb1d('0x43')]('_'));var _0x47ee2d=_0x2d81f1[_0xeb1d('0x32')](_0x2d81f1['indexOf']('_')+0x1);if(_0x549152===_0x363c1e){_0xad7c42[_0x47ee2d]=_0x5262a8[_0xeb1d('0x44')];}}});}return _0xad7c42;}function getTicket(_0x310315,_0x23b424,_0x43274f,_0x3a3822,_0x2f1be9,_0x44b231,_0x46f689){return new Promise(function(_0x577482,_0x6a402a){var _0x45ee2b;return getAuthToken(_0x23b424,_0x43274f,_0x46f689)['then'](function(_0x1b1dca){if(_0x44b231[_0xeb1d('0x45')]===_0xeb1d('0x46')){_0x45ee2b={'method':_0xeb1d('0x13'),'uri':_0x3a3822+_0xeb1d('0x47'),'body':Object[_0xeb1d('0x48')]({},{'title':intUtil['getString'](_0x44b231[_0xeb1d('0x49')],_0x2f1be9,'\x20'),'description':intUtil[_0xeb1d('0x4a')](_0x44b231[_0xeb1d('0x4b')],_0x2f1be9,'\x0a'),'customerid_contact@odata.bind':_0x310315[_0xeb1d('0x34')]?_0xeb1d('0x4c')+_0x310315[_0xeb1d('0x34')]+')':undefined,'ownerid@odata.bind':_0xeb1d('0x2e')+_0x310315[_0xeb1d('0x4d')]+')','caseorigincode':'1'},getCustomFields(_0x44b231[_0xeb1d('0x4e')],_0x2f1be9,_0x44b231[_0xeb1d('0x45')])),'headers':{'Authorization':_0xeb1d('0x2f')+_0x1b1dca,'OData-Version':_0xeb1d('0x20')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x44b231[_0xeb1d('0x45')]==='phonecall'){var _0x566f7e=_0x310315[_0xeb1d('0x34')]?[{'partyid_systemuser@odata.bind':_0xeb1d('0x2e')+_0x310315[_0xeb1d('0x4d')]+')','participationtypemask':_0x310315[_0xeb1d('0x4f')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x310315['enduserId']+')','participationtypemask':_0x310315[_0xeb1d('0x4f')]===_0xeb1d('0x50')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xeb1d('0x2e')+_0x310315[_0xeb1d('0x4d')]+')','participationtypemask':_0x310315[_0xeb1d('0x4f')]===_0xeb1d('0x50')?0x2:0x1}];_0x45ee2b={'method':'POST','uri':_0x3a3822+_0xeb1d('0x51'),'body':Object[_0xeb1d('0x48')]({},{'subject':intUtil[_0xeb1d('0x4a')](_0x44b231['Subjects'],_0x2f1be9,'\x20'),'phonenumber':String(_0x2f1be9[_0xeb1d('0x35')]),'description':intUtil['getString'](_0x44b231[_0xeb1d('0x4b')],_0x2f1be9,'\x0a'),'regardingobjectid_contact@odata.bind':_0x310315[_0xeb1d('0x34')]?_0xeb1d('0x4c')+_0x310315['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x310315[_0xeb1d('0x4d')]+')','directioncode':_0x310315[_0xeb1d('0x4f')]===_0xeb1d('0x50')?![]:!![],'phonecall_activity_parties':_0x566f7e},getCustomFields(_0x44b231['Fields'],_0x2f1be9,_0x44b231['ticketType'])),'headers':{'Authorization':_0xeb1d('0x2f')+_0x1b1dca,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x45ee2b);})[_0xeb1d('0x1d')](function(_0xa938c0){var _0x4a7299=_0xa938c0[_0xeb1d('0x52')][_0xeb1d('0x31')];var _0x48da76=_0x4a7299[_0xeb1d('0x32')](_0x4a7299[_0xeb1d('0x33')]('(')+0x1,_0x4a7299[_0xeb1d('0x33')](')'));_0x310315[_0xeb1d('0x53')]=_0x48da76;_0x577482(_0x310315);})['catch'](function(_0x273bbe){_0x6a402a(_0x273bbe[_0xeb1d('0x1c')]);});});}function emit(_0x53da28,_0x28db96,_0x337dce,_0xd421cb){var _0xd67163={'uri':util[_0xeb1d('0x54')](_0xeb1d('0x55'),_0x53da28,_0x337dce,_0xd421cb)};io['to'](util[_0xeb1d('0x54')](_0xeb1d('0x56'),_0x28db96))[_0xeb1d('0x57')](_0xeb1d('0x58'),_0xd67163);}exports['cs']=function(_0x2892fd,_0x83d899,_0x2b7808,_0x4dbbbc,_0x47c67b,_0x26dff9,_0x387eb0,_0x575b20){var _0x4c8067={};_0x26dff9[_0xeb1d('0x14')]=_0x26dff9[_0xeb1d('0xc')]?intUtil[_0xeb1d('0x59')](_0x26dff9[_0xeb1d('0xd')][_0xeb1d('0xe')]):intUtil[_0xeb1d('0x59')](_0x26dff9[_0xeb1d('0x14')]);_0x26dff9[_0xeb1d('0x5a')]=intUtil[_0xeb1d('0x59')](_0x26dff9['serverUrl']);_0x4c8067[_0xeb1d('0x4f')]=_0x575b20===_0xeb1d('0x50')||_0x575b20==='unmanaged'?_0xeb1d('0x50'):_0xeb1d('0x2b');var _0x51c5d0=_0x26dff9[_0xeb1d('0xc')]?util[_0xeb1d('0x54')](_0xeb1d('0x5b'),_0x26dff9[_0xeb1d('0xd')][_0xeb1d('0xe')]):util[_0xeb1d('0x54')]('%s/api/data/v9.0/',_0x26dff9[_0xeb1d('0x14')]);var _0x5d5173=util[_0xeb1d('0x54')](_0xeb1d('0x5c'),_0x26dff9[_0xeb1d('0xf')]);var _0x2156a3=util[_0xeb1d('0x54')](_0xeb1d('0x5d'),_0x26dff9['serverUrl'],_0x83d899[_0xeb1d('0x5e')],md5(_0x83d899[_0xeb1d('0x5e')]));if(_0x47c67b&&_0x47c67b[_0xeb1d('0x5f')]){logger[_0xeb1d('0x27')](_0xeb1d('0x60'),'Recording\x20is\x20enabled!');_0x83d899[_0xeb1d('0x61')]=_0x2156a3;}else if(_0x387eb0&&_0x387eb0['recordingFormat']&&_0x387eb0[_0xeb1d('0x62')]!=='none'){logger[_0xeb1d('0x27')](_0xeb1d('0x63'),_0xeb1d('0x64'));_0x83d899[_0xeb1d('0x61')]=_0x2156a3;}else{_0x83d899['recordingURL']='';}return getUser(_0x4c8067,_0x26dff9,_0x4dbbbc,_0x5d5173,_0x51c5d0,_0x575b20)[_0xeb1d('0x1d')](function(_0x3cd24a){logger[_0xeb1d('0x27')]('['+_0x575b20[_0xeb1d('0x1a')]()+_0xeb1d('0x65'),_0x3cd24a[_0xeb1d('0x4d')]);logger['info']('['+_0x575b20[_0xeb1d('0x1a')]()+_0xeb1d('0x66'),_0x3cd24a['userEmail']);return getEndUser(_0x3cd24a,_0x26dff9,_0x5d5173,_0x51c5d0,_0x83d899,_0x575b20,_0x2b7808[_0xeb1d('0x67')],_0x2b7808[_0xeb1d('0x68')]);})[_0xeb1d('0x1d')](function(_0xaee921){logger[_0xeb1d('0x27')]('['+_0x575b20[_0xeb1d('0x1a')]()+_0xeb1d('0x69'),_0xaee921[_0xeb1d('0x34')]);logger[_0xeb1d('0x27')]('['+_0x575b20[_0xeb1d('0x1a')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x83d899['calleridnum']);return getTicket(_0xaee921,_0x26dff9,_0x5d5173,_0x51c5d0,_0x83d899,_0x2b7808,_0x575b20);})['then'](function(_0x3b62c1){logger[_0xeb1d('0x27')](util[_0xeb1d('0x54')]('['+_0x575b20[_0xeb1d('0x1a')]()+_0xeb1d('0x6a'),_0x2b7808[_0xeb1d('0x45')],_0x3b62c1[_0xeb1d('0x53')]));logger['info'](util[_0xeb1d('0x54')]('['+_0x575b20[_0xeb1d('0x1a')]()+']\x20Call\x20direction:\x20%s',_0x575b20));if(_0x575b20!==_0xeb1d('0x6b')&&_0x2b7808[_0xeb1d('0x6c')]){logger[_0xeb1d('0x27')]('['+_0x575b20[_0xeb1d('0x1a')]()+']',_0xeb1d('0x6d'));emit(_0x26dff9[_0xeb1d('0x14')],_0x4dbbbc[_0xeb1d('0x6e')],_0x2b7808['ticketType'],_0x3b62c1[_0xeb1d('0x53')]);}})[_0xeb1d('0x18')](function(_0x5c8f4f){logger[_0xeb1d('0x19')]('['+_0x575b20[_0xeb1d('0x1a')]()+_0xeb1d('0x6f'),_0x5c8f4f[_0xeb1d('0x1c')]);console[_0xeb1d('0x19')](_0xeb1d('0x70'),_0x5c8f4f);});}; \ No newline at end of file +var _0xf10f=['getString','Subjects','Descriptions','/contacts(','ticketType','phonecall','callDirection','queue','phonecalls','Fields','odata-entityid','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','modernAuthentication','remoteUri','CloudProvider','data7','data2','data5','POST','clientId','username','password','clientSecret','then','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','userEmail','email','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','catch','outbound','destcalleridnum','calleridnum','/systemusers(','body','headers','substring','lastIndexOf','toLowerCase','telephone1','&$filter=','\x20eq\x20\x27','%2b','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','enduserId','forEach','includes','string','picklist','type','nameField','customField','idField','indexOf','content','assign'];(function(_0x20dad8,_0x1f1554){var _0x3aea88=function(_0x11ea53){while(--_0x11ea53){_0x20dad8['push'](_0x20dad8['shift']());}};_0x3aea88(++_0x1f1554);}(_0xf10f,0xfd));var _0xff10=function(_0x28bf82,_0x170819){_0x28bf82=_0x28bf82-0x0;var _0x4839a4=_0xf10f[_0x28bf82];return _0x4839a4;};'use strict';var _=require(_0xff10('0x0'));var rp=require(_0xff10('0x1'));var util=require(_0xff10('0x2'));var intUtil=require('./util');var md5=require(_0xff10('0x3'));var Redis=require(_0xff10('0x4'));var logger=require(_0xff10('0x5'))(_0xff10('0x6'));var config=require(_0xff10('0x7'));config['redis']=_['defaults'](config[_0xff10('0x8')],{'host':_0xff10('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAuthToken(_0x55326a,_0x41326e,_0x5393a1){if(_0x55326a[_0xff10('0xa')]){_0x55326a[_0xff10('0xb')]=_0x55326a[_0xff10('0xc')][_0xff10('0xd')];_0x55326a['tenantId']=_0x55326a[_0xff10('0xc')][_0xff10('0xe')];return Promise['resolve'](_0x55326a[_0xff10('0xc')][_0xff10('0xf')]);}var _0x246764={'method':_0xff10('0x10'),'uri':_0x41326e,'form':{'client_id':_0x55326a[_0xff10('0x11')],'resource':_0x55326a[_0xff10('0xb')],'username':_0x55326a[_0xff10('0x12')],'password':_0x55326a[_0xff10('0x13')],'grant_type':_0xff10('0x13'),'client_secret':_0x55326a[_0xff10('0x14')]},'json':!![]};return rp(_0x246764)[_0xff10('0x15')](function(_0x1b74ae){return _0x1b74ae['access_token'];})['catch'](function(_0x114b87){logger[_0xff10('0x16')]('['+[_0x5393a1[_0xff10('0x17')]()]+_0xff10('0x18'));return _0x114b87[_0xff10('0x19')];});}function getUser(_0x1b6467,_0x2c53bf,_0x47838b,_0x1b355b,_0x21d18e,_0x1301f2){return new Promise(function(_0x25b5d4,_0x4a081e){return getAuthToken(_0x2c53bf,_0x1b355b,_0x1301f2)['then'](function(_0xff8557){var _0x5d3a65={'method':_0xff10('0x1a'),'uri':_0x21d18e+_0xff10('0x1b'),'headers':{'Authorization':_0xff10('0x1c')+_0xff8557,'OData-Version':_0xff10('0x1d')},'json':!![]};return rp(_0x5d3a65);})[_0xff10('0x15')](function(_0x38a909){var _0x284ce0=_0x38a909[_0xff10('0x1e')];var _0xd9852b=![];var _0x4d8a93=null;if(!_[_0xff10('0x1f')](_0x47838b)){if(intUtil[_0xff10('0x20')](_0x47838b['email'])){_0x1b6467[_0xff10('0x21')]=_0x47838b[_0xff10('0x22')];for(_0x4d8a93=0x0;_0x4d8a93<_0x284ce0['length'];_0x4d8a93++){if(_0x284ce0[_0x4d8a93][_0xff10('0x23')]===_0x47838b[_0xff10('0x22')]&&!_0x284ce0[_0x4d8a93][_0xff10('0x24')]){_0xd9852b=!![];logger[_0xff10('0x25')]('['+[_0x1301f2[_0xff10('0x17')]()]+_0xff10('0x26')+_0x284ce0[_0x4d8a93][_0xff10('0x27')]+'!');_0x1b6467[_0xff10('0x28')]=_0x284ce0[_0x4d8a93]['systemuserid'];}}}}if(!_0xd9852b){logger[_0xff10('0x25')]('['+[_0x1301f2['toUpperCase']()]+_0xff10('0x29'));_0x1b6467[_0xff10('0x21')]=_0x2c53bf[_0xff10('0x12')];for(_0x4d8a93=0x0;_0x4d8a93<_0x284ce0[_0xff10('0x2a')];_0x4d8a93++){if(_0x284ce0[_0x4d8a93][_0xff10('0x23')]===_0x2c53bf['username']){_0x1b6467[_0xff10('0x28')]=_0x284ce0[_0x4d8a93][_0xff10('0x27')];}}}_0x25b5d4(_0x1b6467);})[_0xff10('0x2b')](function(_0x45af47){_0x4a081e(_0x45af47[_0xff10('0x19')]);});});}function createEndUser(_0x213722,_0x5f596b,_0x429db3,_0x95ecb2,_0x29c556,_0x49ea6a,_0x24a5aa){return new Promise(function(_0x3060a1,_0x14cf55){return getAuthToken(_0x5f596b,_0x429db3,_0x49ea6a)[_0xff10('0x15')](function(_0x52ea25){var _0x2ed51=_0x49ea6a['toLowerCase']()===_0xff10('0x2c')?_0x29c556[_0xff10('0x2d')]:_0x29c556[_0xff10('0x2e')];var _0x2e429f={'method':_0xff10('0x10'),'uri':_0x95ecb2+'contacts','body':{'fullname':_0x2ed51,'firstname':_0x2ed51,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xff10('0x2f')+_0x213722['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x52ea25,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x2e429f[_0xff10('0x30')][_0x24a5aa]=_0x2ed51;return rp(_0x2e429f);})[_0xff10('0x15')](function(_0x45d74f){var _0x55819f=_0x45d74f[_0xff10('0x31')]['odata-entityid'];var _0x47ee65=_0x55819f[_0xff10('0x32')](_0x55819f[_0xff10('0x33')]('(')+0x1,_0x55819f[_0xff10('0x33')](')'));_0x213722['enduserId']=_0x47ee65;_0x3060a1(_0x213722);})[_0xff10('0x2b')](function(_0x37baf0){_0x14cf55(_0x37baf0[_0xff10('0x19')]);});});}function getEndUser(_0x509cb4,_0x48d78a,_0x3646d9,_0x199ff4,_0x5a50ee,_0x2cf5b4,_0x2f1bbb,_0x48ba93){var _0x376a64=_0x2cf5b4[_0xff10('0x34')]()===_0xff10('0x2c')?_0x5a50ee[_0xff10('0x2d')]:_0x5a50ee[_0xff10('0x2e')];return getAuthToken(_0x48d78a,_0x3646d9,_0x2cf5b4)[_0xff10('0x15')](function(_0x392eb3){_0x48ba93=_0x48ba93?_0x48ba93:_0xff10('0x35');var _0x288f67={'method':'GET','uri':_0x199ff4+'contacts?$select='+_0x48ba93+_0xff10('0x36')+_0x48ba93+_0xff10('0x37')+_0x376a64['replace']('+',_0xff10('0x38'))+'\x27','headers':{'Authorization':_0xff10('0x1c')+_0x392eb3,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x288f67);})[_0xff10('0x15')](function(_0x19b80f){var _0x14d36d=![];if(!_0x19b80f)return _0x14d36d;var _0x3085cb=_0x19b80f[_0xff10('0x1e')];for(var _0x3e5023=0x0;_0x3e5023<_0x3085cb['length'];_0x3e5023++){if(_0x3085cb[_0x3e5023][_0x48ba93]===_0x376a64){_0x14d36d=!![];_0x509cb4['enduserId']=_0x3085cb[_0x3e5023]['contactid'];}}return _0x14d36d;})[_0xff10('0x15')](function(_0x2b70ce){if(_0x2b70ce)return _0x509cb4;if(_0x2f1bbb===_0xff10('0x39')){logger['info']('['+[_0x2cf5b4['toUpperCase']()]+_0xff10('0x3a'));return _0x509cb4;}return createEndUser(_0x509cb4,_0x48d78a,_0x3646d9,_0x199ff4,_0x5a50ee,_0x2cf5b4,_0x48ba93)[_0xff10('0x15')](function(_0x2d6639){logger['info']('['+[_0x2cf5b4[_0xff10('0x17')]()]+']\x20Enduser\x20created!',_0x2d6639[_0xff10('0x3b')]);return _0x2d6639;});});}function getCustomFields(_0x8a84d5,_0x5c02d0,_0x40a51f){var _0x50c7e8={};if(_0x8a84d5['length']>0x0){_[_0xff10('0x3c')](_0x8a84d5,function(_0xb5e6fb){if(_[_0xff10('0x3d')]([_0xff10('0x3e'),_0xff10('0x3f')],_0xb5e6fb[_0xff10('0x40')])&&_0xb5e6fb[_0xff10('0x41')]&&!_0xb5e6fb[_0xff10('0x42')]){var _0x1e8a5a=_0xb5e6fb[_0xff10('0x43')][_0xff10('0x34')]();var _0x770fe=_0x1e8a5a['substring'](0x0,_0x1e8a5a[_0xff10('0x44')]('_'));var _0x49ba7a=_0x1e8a5a[_0xff10('0x32')](_0x1e8a5a['indexOf']('_')+0x1);if(_0x770fe===_0x40a51f){_0x50c7e8[_0x49ba7a]=_0xb5e6fb[_0xff10('0x45')];}}});}return _0x50c7e8;}function getTicket(_0x394a97,_0x4fee1e,_0x5393f5,_0x251995,_0x26460b,_0x5c4dc5,_0x295060){return new Promise(function(_0x5c446a,_0x2313c4){var _0x96de08;return getAuthToken(_0x4fee1e,_0x5393f5,_0x295060)[_0xff10('0x15')](function(_0x5b6683){if(_0x5c4dc5['ticketType']==='incident'){_0x96de08={'method':_0xff10('0x10'),'uri':_0x251995+'incidents','body':Object[_0xff10('0x46')]({},{'title':intUtil[_0xff10('0x47')](_0x5c4dc5[_0xff10('0x48')],_0x26460b,'\x20'),'description':intUtil['getString'](_0x5c4dc5[_0xff10('0x49')],_0x26460b,'\x0a'),'customerid_contact@odata.bind':_0x394a97['enduserId']?_0xff10('0x4a')+_0x394a97[_0xff10('0x3b')]+')':undefined,'ownerid@odata.bind':_0xff10('0x2f')+_0x394a97[_0xff10('0x28')]+')','caseorigincode':'1'},getCustomFields(_0x5c4dc5['Fields'],_0x26460b,_0x5c4dc5['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x5b6683,'OData-Version':_0xff10('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5c4dc5[_0xff10('0x4b')]===_0xff10('0x4c')){var _0x580832=_0x394a97[_0xff10('0x3b')]?[{'partyid_systemuser@odata.bind':_0xff10('0x2f')+_0x394a97[_0xff10('0x28')]+')','participationtypemask':_0x394a97[_0xff10('0x4d')]===_0xff10('0x4e')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x394a97[_0xff10('0x3b')]+')','participationtypemask':_0x394a97[_0xff10('0x4d')]===_0xff10('0x4e')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xff10('0x2f')+_0x394a97['userId']+')','participationtypemask':_0x394a97['callDirection']==='queue'?0x2:0x1}];_0x96de08={'method':_0xff10('0x10'),'uri':_0x251995+_0xff10('0x4f'),'body':Object[_0xff10('0x46')]({},{'subject':intUtil[_0xff10('0x47')](_0x5c4dc5[_0xff10('0x48')],_0x26460b,'\x20'),'phonenumber':String(_0x26460b[_0xff10('0x2e')]),'description':intUtil['getString'](_0x5c4dc5[_0xff10('0x49')],_0x26460b,'\x0a'),'regardingobjectid_contact@odata.bind':_0x394a97[_0xff10('0x3b')]?_0xff10('0x4a')+_0x394a97[_0xff10('0x3b')]+')':undefined,'ownerid@odata.bind':_0xff10('0x2f')+_0x394a97[_0xff10('0x28')]+')','directioncode':_0x394a97[_0xff10('0x4d')]===_0xff10('0x4e')?![]:!![],'phonecall_activity_parties':_0x580832},getCustomFields(_0x5c4dc5[_0xff10('0x50')],_0x26460b,_0x5c4dc5[_0xff10('0x4b')])),'headers':{'Authorization':'Bearer\x20'+_0x5b6683,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x96de08);})['then'](function(_0x3ce8cb){var _0x413167=_0x3ce8cb[_0xff10('0x31')][_0xff10('0x51')];var _0x2d1881=_0x413167[_0xff10('0x32')](_0x413167[_0xff10('0x33')]('(')+0x1,_0x413167[_0xff10('0x33')](')'));_0x394a97['ticketId']=_0x2d1881;_0x5c446a(_0x394a97);})[_0xff10('0x2b')](function(_0x514c55){_0x2313c4(_0x514c55[_0xff10('0x19')]);});});}function emit(_0x1927ae,_0x259a5d,_0x5c315e,_0x1d9f43){var _0x31be27={'uri':util[_0xff10('0x52')](_0xff10('0x53'),_0x1927ae,_0x5c315e,_0x1d9f43)};io['to'](util[_0xff10('0x52')]('user:%s',_0x259a5d))['emit']('trigger:browser:url',_0x31be27);}exports['cs']=function(_0x302336,_0x28d2c0,_0x3edfde,_0x1d39b6,_0x409c2a,_0x1c3cb4,_0x524215,_0x19f1c1){var _0x10adff={};_0x1c3cb4[_0xff10('0xb')]=_0x1c3cb4[_0xff10('0xa')]?intUtil[_0xff10('0x54')](_0x1c3cb4[_0xff10('0xc')][_0xff10('0xd')]):intUtil['stripTrailingSlash'](_0x1c3cb4[_0xff10('0xb')]);_0x1c3cb4[_0xff10('0x55')]=intUtil[_0xff10('0x54')](_0x1c3cb4[_0xff10('0x55')]);_0x10adff[_0xff10('0x4d')]=_0x19f1c1===_0xff10('0x4e')||_0x19f1c1===_0xff10('0x56')?_0xff10('0x4e'):_0xff10('0x2c');var _0x2abeaa=_0x1c3cb4[_0xff10('0xa')]?util[_0xff10('0x52')](_0xff10('0x57'),_0x1c3cb4[_0xff10('0xc')]['data7']):util[_0xff10('0x52')](_0xff10('0x57'),_0x1c3cb4[_0xff10('0xb')]);var _0x9742fc=util[_0xff10('0x52')](_0xff10('0x58'),_0x1c3cb4[_0xff10('0x59')]);var _0x591910=util[_0xff10('0x52')](_0xff10('0x5a'),_0x1c3cb4[_0xff10('0x55')],_0x28d2c0[_0xff10('0x5b')],md5(_0x28d2c0[_0xff10('0x5b')]));if(_0x409c2a&&_0x409c2a[_0xff10('0x5c')]){logger[_0xff10('0x25')]('[QUEUE]','Recording\x20is\x20enabled!');_0x28d2c0[_0xff10('0x5d')]=_0x591910;}else if(_0x524215&&_0x524215[_0xff10('0x5e')]&&_0x524215[_0xff10('0x5e')]!=='none'){logger[_0xff10('0x25')]('[OUTBOUND]',_0xff10('0x5f'));_0x28d2c0[_0xff10('0x5d')]=_0x591910;}else{_0x28d2c0[_0xff10('0x5d')]='';}return getUser(_0x10adff,_0x1c3cb4,_0x1d39b6,_0x9742fc,_0x2abeaa,_0x19f1c1)[_0xff10('0x15')](function(_0x424d97){logger[_0xff10('0x25')]('['+_0x19f1c1[_0xff10('0x17')]()+_0xff10('0x60'),_0x424d97[_0xff10('0x28')]);logger[_0xff10('0x25')]('['+_0x19f1c1[_0xff10('0x17')]()+_0xff10('0x61'),_0x424d97['userEmail']);return getEndUser(_0x424d97,_0x1c3cb4,_0x9742fc,_0x2abeaa,_0x28d2c0,_0x19f1c1,_0x3edfde[_0xff10('0x62')],_0x3edfde[_0xff10('0x63')]);})['then'](function(_0x2cd314){logger['info']('['+_0x19f1c1[_0xff10('0x17')]()+_0xff10('0x64'),_0x2cd314['enduserId']);logger[_0xff10('0x25')]('['+_0x19f1c1[_0xff10('0x17')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x28d2c0[_0xff10('0x2e')]);return getTicket(_0x2cd314,_0x1c3cb4,_0x9742fc,_0x2abeaa,_0x28d2c0,_0x3edfde,_0x19f1c1);})['then'](function(_0x4638f1){logger['info'](util[_0xff10('0x52')]('['+_0x19f1c1[_0xff10('0x17')]()+_0xff10('0x65'),_0x3edfde[_0xff10('0x4b')],_0x4638f1[_0xff10('0x66')]));logger[_0xff10('0x25')](util[_0xff10('0x52')]('['+_0x19f1c1[_0xff10('0x17')]()+_0xff10('0x67'),_0x19f1c1));if(_0x19f1c1!=='unmanaged'&&_0x3edfde['openNewTab']){logger['info']('['+_0x19f1c1[_0xff10('0x17')]()+']',_0xff10('0x68'));emit(_0x1c3cb4[_0xff10('0xb')],_0x1d39b6[_0xff10('0x69')],_0x3edfde[_0xff10('0x4b')],_0x4638f1[_0xff10('0x66')]);}})[_0xff10('0x2b')](function(_0x26a475){logger[_0xff10('0x16')]('['+_0x19f1c1['toUpperCase']()+_0xff10('0x6a'),_0x26a475['message']);console[_0xff10('0x16')](_0xff10('0x6b'),_0x26a475);});}; \ 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 0e04182..9525fb4 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 _0x5973=['%s/api/v2/contacts','length','Enduser\x20created.','Basic\x20%s','apiKey','base64','debug','[HTTP]','stringify','map','forEach','includes','picklist','nameField','customField','toLowerCase','toString','string','type','idField','push','content','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','calleridnum','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','recordingFormat','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','[OUTBOUND]','unmanaged','lastevent','toUpperCase','lodash','request-promise','ioredis','./util','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','Subjects','getString','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone'];(function(_0x287872,_0x9ae0c7){var _0x5cd069=function(_0x29fd7f){while(--_0x29fd7f){_0x287872['push'](_0x287872['shift']());}};_0x5cd069(++_0x9ae0c7);}(_0x5973,0xf3));var _0x3597=function(_0x4d84cb,_0x4c81e3){_0x4d84cb=_0x4d84cb-0x0;var _0x40c301=_0x5973[_0x4d84cb];return _0x40c301;};'use strict';var _=require(_0x3597('0x0'));var rp=require(_0x3597('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0x3597('0x2'));var intUtil=require(_0x3597('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x3597('0x4'));config[_0x3597('0x5')]=_[_0x3597('0x6')](config[_0x3597('0x5')],{'host':_0x3597('0x7'),'port':0x18eb});var io=require(_0x3597('0x8'))(new Redis(config[_0x3597('0x5')]));var headers={'Content-Type':_0x3597('0x9'),'Accept':_0x3597('0x9')};function emit(_0x33cdaf,_0x5a9b1a,_0x4f9c73){io['to'](_0x33cdaf)[_0x3597('0xa')](_0x5a9b1a,_0x4f9c73);}function getTicket(_0x5edd2c,_0x56fd42,_0x27cd72,_0x43cde3,_0x144d8c){logger[_0x3597('0xb')](_0x3597('0xc'));var _0x378a2a=_[_0x3597('0xd')]({'responder_id':_0x56fd42['id'],'requester_id':_0x27cd72['id'],'name':util[_0x3597('0xe')](_0x3597('0xf'),_0x144d8c[_0x3597('0x10')]),'phone':_0x144d8c['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x43cde3[_0x3597('0x11')],_0x144d8c,'\x20'),'description':intUtil[_0x3597('0x12')](_0x43cde3['Descriptions'],_0x144d8c,_0x3597('0x13')),'tags':getTags(_0x43cde3[_0x3597('0x14')],_0x3597('0x15'))},getCustomFields(_0x43cde3[_0x3597('0x16')],_0x144d8c));_0x378a2a[_0x3597('0x17')]=_[_0x3597('0x18')](_[_0x3597('0x19')](_0x378a2a[_0x3597('0x17')],'id'),_0x3597('0x1a'));return request({'uri':util[_0x3597('0xe')](_0x3597('0x1b'),_0x5edd2c[_0x3597('0x1c')]),'method':_0x3597('0x1d'),'body':_0x378a2a})[_0x3597('0x1e')](function(_0x27931a){logger[_0x3597('0xb')](_0x3597('0x1f'));return _0x27931a;});}function getUser(_0x512683,_0x3d79fb){if(intUtil[_0x3597('0x20')](_0x3d79fb)){return request({'uri':util[_0x3597('0xe')](_0x3597('0x21'),_0x512683[_0x3597('0x1c')]),'qs':{'email':_0x3d79fb}})[_0x3597('0x1e')](function(_0x5e43af){if(_0x5e43af['length']){logger[_0x3597('0xb')](_0x3597('0x22'));return _[_0x3597('0x23')](_0x5e43af,function(_0x2e95a1){return _0x2e95a1[_0x3597('0x24')][_0x3597('0x25')]===_0x3d79fb;});}else{logger[_0x3597('0xb')](_0x3597('0x26'));return request({'uri':util['format'](_0x3597('0x27'),_0x512683[_0x3597('0x1c')])})[_0x3597('0x1e')](function(_0x3a2cf4){logger[_0x3597('0xb')](_0x3597('0x28'));return _0x3a2cf4;});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x3597('0x27'),_0x512683[_0x3597('0x1c')])})[_0x3597('0x1e')](function(_0x1cf02a){logger[_0x3597('0xb')]('Admin\x20account\x20selected.');return _0x1cf02a;});}}function getEndUser(_0x16bdba,_0x4158cf,_0x7e8d9d){logger[_0x3597('0xb')](_0x3597('0x29'),_0x7e8d9d);return request({'uri':util[_0x3597('0xe')](_0x3597('0x2a'),_0x16bdba['remoteUri']),'qs':{'phone':_0x7e8d9d}})['then'](function(_0x1ec301){if(_0x1ec301[_0x3597('0x2b')]){logger[_0x3597('0xb')]('Enduser\x20found!');return _['find'](_0x1ec301,{'phone':_0x7e8d9d});}else{logger[_0x3597('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x3597('0xe')](_0x3597('0x2a'),_0x16bdba[_0x3597('0x1c')]),'method':_0x3597('0x1d'),'body':{'name':_0x4158cf,'phone':_0x7e8d9d}})[_0x3597('0x1e')](function(_0x4fb854){logger['info'](_0x3597('0x2c'));return _0x4fb854;});}});}function getAuth(_0x422c56){return util['format'](_0x3597('0x2d'),new Buffer(_0x422c56[_0x3597('0x2e')]+':X')['toString'](_0x3597('0x2f')));}function request(_0x30d3ab){logger[_0x3597('0x30')](_0x3597('0x31'),JSON[_0x3597('0x32')](_0x30d3ab));return rp(_[_0x3597('0x6')](_0x30d3ab,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x324f5f,_0x28304c){var _0x4b173f=[];if(_0x324f5f&&_0x324f5f[_0x3597('0x2b')]>0x0){_0x4b173f=_[_0x3597('0x33')](_0x324f5f,_0x28304c);}return _0x4b173f;}function getCustomFields(_0x118a2a,_0x3acdb2){var _0xc9ca9d=[];var _0x428b37={'custom_fields':[]};if(_0x118a2a[_0x3597('0x2b')]>0x0){_[_0x3597('0x34')](_0x118a2a,function(_0x329c27){if(_[_0x3597('0x35')](['string',_0x3597('0x36')],_0x329c27['type'])&&_0x329c27[_0x3597('0x37')]&&!_0x329c27[_0x3597('0x38')]){_0x428b37[_0x329c27['nameField'][_0x3597('0x39')]()]=_0x329c27['content'][_0x3597('0x3a')]();}else if(_[_0x3597('0x35')]([_0x3597('0x3b'),'picklist'],_0x329c27[_0x3597('0x3c')])&&_0x329c27[_0x3597('0x3d')]&&_0x329c27['customField']){_0x428b37[_0x3597('0x17')][_0x3597('0x3e')]({'id':_0x329c27['idField'],'value':_0x329c27[_0x3597('0x3f')][_0x3597('0x3a')]()});}else if(_0x329c27[_0x3597('0x3c')]===_0x3597('0x40')&&_0x329c27[_0x3597('0x41')]&&_0x329c27[_0x3597('0x3d')]&&_0x329c27['customField']){_0x3acdb2[_0x329c27[_0x3597('0x41')]]&&_0x428b37[_0x3597('0x17')][_0x3597('0x3e')]({'id':_0x329c27[_0x3597('0x3d')],'value':_0x3acdb2[_0x329c27['variableName']][_0x3597('0x3a')]()});}else if(_0x329c27['type']===_0x3597('0x42')&&_0x329c27['Variable']&&_0x329c27[_0x3597('0x43')][_0x3597('0x15')]&&_0x329c27[_0x3597('0x3d')]&&_0x329c27[_0x3597('0x38')]){_0x3acdb2[_0x329c27[_0x3597('0x43')][_0x3597('0x15')]['toLowerCase']()]&&_0x428b37[_0x3597('0x17')][_0x3597('0x3e')]({'id':_0x329c27[_0x3597('0x3d')],'value':_0x3acdb2[_0x329c27['Variable'][_0x3597('0x15')][_0x3597('0x39')]()][_0x3597('0x3a')]()});}});}return _0x428b37;}exports[_0x3597('0x44')]=function(_0x38c28b,_0x49a6af,_0x8e6c66,_0x153d1d,_0xaddeb1,_0x1304fe){var _0x1ca773,_0x4ef3cc;_0x1304fe['remoteUri']=intUtil[_0x3597('0x45')](_0x1304fe[_0x3597('0x1c')]);_0x1304fe[_0x3597('0x46')]=intUtil[_0x3597('0x45')](_0x1304fe[_0x3597('0x46')]);if(_0xaddeb1&&_0xaddeb1[_0x3597('0x47')]){logger[_0x3597('0xb')](_0x3597('0x48'),_0x3597('0x49'));_0x49a6af[_0x3597('0x4a')]=util['format'](_0x3597('0x4b'),_0x1304fe[_0x3597('0x46')],_0x49a6af[_0x3597('0x4c')],md5(_0x49a6af['uniqueid']));}else{_0x49a6af[_0x3597('0x4a')]='';}headers[_0x3597('0x4d')]=getAuth(_0x1304fe);return getUser(_0x1304fe,_0x153d1d['email'])[_0x3597('0x1e')](function(_0x24e99d){_0x1ca773=_0x24e99d;logger['info']('The\x20User\x20ID\x20is:',_0x1ca773['id']);return getEndUser(_0x1304fe,_0x49a6af[_0x3597('0x10')],_0x49a6af[_0x3597('0x4e')]);})[_0x3597('0x1e')](function(_0x1906af){_0x4ef3cc=_0x1906af;logger['info']('The\x20Enduser\x20ID\x20is:',_0x4ef3cc['id']);return getTicket(_0x1304fe,_0x1ca773,_0x4ef3cc,_0x8e6c66,_0x49a6af);})[_0x3597('0x1e')](function(_0x444e12){if(_0x444e12&&_0x444e12['id']){logger[_0x3597('0xb')](_0x3597('0x1f'));logger[_0x3597('0xb')](_0x3597('0x4f'),_0x444e12['id']);logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x3597('0x50'),_0x153d1d[_0x3597('0x15')]),_0x3597('0x51'),{'uri':util[_0x3597('0xe')](_0x3597('0x52'),_0x1304fe['remoteUri'],_0x444e12['id'])});}})['catch'](function(_0x1618cf){logger[_0x3597('0x53')]('[QUEUE]',JSON[_0x3597('0x32')](_0x1618cf));});};exports['outbound']=function(_0x597689,_0x4e6214,_0x4d502b,_0x5180cc,_0x696c28,_0xe2c5b5,_0x345488){var _0x3dbb40,_0x488400;_0xe2c5b5[_0x3597('0x1c')]=intUtil[_0x3597('0x45')](_0xe2c5b5['remoteUri']);_0xe2c5b5[_0x3597('0x46')]=intUtil[_0x3597('0x45')](_0xe2c5b5[_0x3597('0x46')]);if(_0x345488&&_0x345488[_0x3597('0x54')]&&_0x345488[_0x3597('0x54')]!=='none'){logger[_0x3597('0xb')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4e6214[_0x3597('0x4a')]=util[_0x3597('0xe')](_0x3597('0x4b'),_0xe2c5b5['serverUrl'],_0x4e6214[_0x3597('0x4c')],md5(_0x4e6214[_0x3597('0x4c')]));}headers['Authorization']=getAuth(_0xe2c5b5);return getUser(_0xe2c5b5,_0x5180cc['email'])['then'](function(_0x5a0d4a){_0x3dbb40=_0x5a0d4a;logger[_0x3597('0xb')](_0x3597('0x55'),_0x3dbb40['id']);return getEndUser(_0xe2c5b5,_0x4e6214[_0x3597('0x56')],_0x4e6214[_0x3597('0x57')]);})[_0x3597('0x1e')](function(_0x364f55){_0x488400=_0x364f55;logger[_0x3597('0xb')](_0x3597('0x58'),_0x488400['id']);return getTicket(_0xe2c5b5,_0x3dbb40,_0x488400,_0x4d502b,_0x4e6214);})[_0x3597('0x1e')](function(_0x4950e1){if(_0x4950e1&&_0x4950e1['id']){logger['info'](_0x3597('0x1f'));logger[_0x3597('0xb')](_0x3597('0x4f'),_0x4950e1['id']);logger['info']('[OUTBOUND]',_0x3597('0x59'));emit(util['format'](_0x3597('0x50'),_0x5180cc[_0x3597('0x15')]),_0x3597('0x51'),{'uri':util[_0x3597('0xe')](_0x3597('0x52'),_0xe2c5b5[_0x3597('0x1c')],_0x4950e1['id'])});}})[_0x3597('0x5a')](function(_0x5d8a6c){logger['error'](_0x3597('0x5b'),JSON[_0x3597('0x32')](_0x5d8a6c));});};exports[_0x3597('0x5c')]=function(_0x256262,_0x18686e,_0x5589f4,_0x26768a,_0x1973ac,_0x510e7b){var _0x21539e,_0xc8be59;_0x510e7b[_0x3597('0x1c')]=intUtil[_0x3597('0x45')](_0x510e7b['remoteUri']);_0x510e7b['serverUrl']=intUtil[_0x3597('0x45')](_0x510e7b[_0x3597('0x46')]);if(_0x1973ac&&_0x1973ac[_0x3597('0x47')]){logger[_0x3597('0xb')]('['+_0x18686e['lastevent']['toUpperCase']()+']',_0x3597('0x49'));_0x18686e[_0x3597('0x4a')]=util[_0x3597('0xe')](_0x3597('0x4b'),_0x510e7b[_0x3597('0x46')],_0x18686e[_0x3597('0x4c')],md5(_0x18686e[_0x3597('0x4c')]));}else{_0x18686e[_0x3597('0x4a')]='';}headers[_0x3597('0x4d')]=getAuth(_0x510e7b);return getUser(_0x510e7b,'')[_0x3597('0x1e')](function(_0x2dcb6c){_0x21539e=_0x2dcb6c;logger[_0x3597('0xb')](_0x3597('0x55'),_0x21539e['id']);return getEndUser(_0x510e7b,_0x18686e['calleridname'],_0x18686e[_0x3597('0x4e')]);})[_0x3597('0x1e')](function(_0x25f58f){_0xc8be59=_0x25f58f;logger[_0x3597('0xb')](_0x3597('0x58'),_0xc8be59['id']);return getTicket(_0x510e7b,_0x21539e,_0xc8be59,_0x5589f4,_0x18686e);})[_0x3597('0x1e')](function(_0x13553f){if(_0x13553f){logger[_0x3597('0xb')](_0x3597('0x1f'));logger[_0x3597('0xb')](_0x3597('0x4f'),_0x13553f['id']);}})[_0x3597('0x5a')](function(_0x4cfc84){logger[_0x3597('0x53')]('['+_0x18686e[_0x3597('0x5d')][_0x3597('0x5e')]()+']',JSON[_0x3597('0x32')](_0x4cfc84));});}; \ No newline at end of file +var _0x1dd2=['Variable','idField','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','stringify','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','error','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','localhost','socket.io-emitter','redis','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Tags','name','Fields','mapValues','keyBy','custom_fields','value','format','remoteUri','POST','then','Ticket\x20created!','validateEmail','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','defaults','GET','map','forEach','includes','string','nameField','customField','content','picklist','type','push','variableName'];(function(_0x44474f,_0x431580){var _0x427d97=function(_0x53f7d4){while(--_0x53f7d4){_0x44474f['push'](_0x44474f['shift']());}};_0x427d97(++_0x431580);}(_0x1dd2,0x7f));var _0x21dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dd2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x21dd('0x0'));var rp=require(_0x21dd('0x1'));var md5=require(_0x21dd('0x2'));var util=require(_0x21dd('0x3'));var Redis=require(_0x21dd('0x4'));var intUtil=require(_0x21dd('0x5'));var config=require(_0x21dd('0x6'));var logger=require(_0x21dd('0x7'))(_0x21dd('0x8'));config['redis']=_['defaults'](config['redis'],{'host':_0x21dd('0x9'),'port':0x18eb});var io=require(_0x21dd('0xa'))(new Redis(config[_0x21dd('0xb')]));var headers={'Content-Type':_0x21dd('0xc'),'Accept':_0x21dd('0xc')};function emit(_0x44db57,_0x2ba5b3,_0x5f14c2){io['to'](_0x44db57)[_0x21dd('0xd')](_0x2ba5b3,_0x5f14c2);}function getTicket(_0x32117a,_0x548e73,_0x5191b9,_0x3d9ce2,_0x1daa5d){logger[_0x21dd('0xe')](_0x21dd('0xf'));var _0x238b7e=_[_0x21dd('0x10')]({'responder_id':_0x548e73['id'],'requester_id':_0x5191b9['id'],'name':util['format'](_0x21dd('0x11'),_0x1daa5d[_0x21dd('0x12')]),'phone':_0x1daa5d[_0x21dd('0x13')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x3d9ce2['Subjects'],_0x1daa5d,'\x20'),'description':intUtil[_0x21dd('0x14')](_0x3d9ce2['Descriptions'],_0x1daa5d,'
'),'tags':getTags(_0x3d9ce2[_0x21dd('0x15')],_0x21dd('0x16'))},getCustomFields(_0x3d9ce2[_0x21dd('0x17')],_0x1daa5d));_0x238b7e['custom_fields']=_[_0x21dd('0x18')](_[_0x21dd('0x19')](_0x238b7e[_0x21dd('0x1a')],'id'),_0x21dd('0x1b'));return request({'uri':util[_0x21dd('0x1c')]('%s/api/v2/tickets',_0x32117a[_0x21dd('0x1d')]),'method':_0x21dd('0x1e'),'body':_0x238b7e})[_0x21dd('0x1f')](function(_0x661184){logger['info'](_0x21dd('0x20'));return _0x661184;});}function getUser(_0x59ea40,_0x33ff41){if(intUtil[_0x21dd('0x21')](_0x33ff41)){return request({'uri':util[_0x21dd('0x1c')]('%s/api/v2/agents',_0x59ea40[_0x21dd('0x1d')]),'qs':{'email':_0x33ff41}})[_0x21dd('0x1f')](function(_0x51d255){if(_0x51d255[_0x21dd('0x22')]){logger[_0x21dd('0xe')](_0x21dd('0x23'));return _[_0x21dd('0x24')](_0x51d255,function(_0x34d4b0){return _0x34d4b0[_0x21dd('0x25')][_0x21dd('0x26')]===_0x33ff41;});}else{logger['info'](_0x21dd('0x27'));return request({'uri':util[_0x21dd('0x1c')](_0x21dd('0x28'),_0x59ea40['remoteUri'])})[_0x21dd('0x1f')](function(_0x1c6f97){logger[_0x21dd('0xe')](_0x21dd('0x29'));return _0x1c6f97;});}});}else{logger[_0x21dd('0xe')](_0x21dd('0x2a'));return request({'uri':util[_0x21dd('0x1c')](_0x21dd('0x28'),_0x59ea40[_0x21dd('0x1d')])})[_0x21dd('0x1f')](function(_0x1521e7){logger[_0x21dd('0xe')](_0x21dd('0x29'));return _0x1521e7;});}}function getEndUser(_0x56b4a0,_0x431889,_0x399fbb){logger['info']('Searching\x20enduser\x20with\x20phone',_0x399fbb);return request({'uri':util[_0x21dd('0x1c')](_0x21dd('0x2b'),_0x56b4a0[_0x21dd('0x1d')]),'qs':{'phone':_0x399fbb}})[_0x21dd('0x1f')](function(_0x48282b){if(_0x48282b[_0x21dd('0x22')]){logger[_0x21dd('0xe')](_0x21dd('0x2c'));return _['find'](_0x48282b,{'phone':_0x399fbb});}else{logger[_0x21dd('0xe')](_0x21dd('0x2d'));return request({'uri':util[_0x21dd('0x1c')](_0x21dd('0x2b'),_0x56b4a0[_0x21dd('0x1d')]),'method':_0x21dd('0x1e'),'body':{'name':_0x431889,'phone':_0x399fbb}})[_0x21dd('0x1f')](function(_0x5d67bd){logger[_0x21dd('0xe')]('Enduser\x20created.');return _0x5d67bd;});}});}function getAuth(_0x5ed05b){return util[_0x21dd('0x1c')](_0x21dd('0x2e'),new Buffer(_0x5ed05b[_0x21dd('0x2f')]+':X')[_0x21dd('0x30')](_0x21dd('0x31')));}function request(_0x459e23){logger[_0x21dd('0x32')](_0x21dd('0x33'),JSON['stringify'](_0x459e23));return rp(_[_0x21dd('0x34')](_0x459e23,{'method':_0x21dd('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x354b85,_0x456c1a){var _0xb09da8=[];if(_0x354b85&&_0x354b85['length']>0x0){_0xb09da8=_[_0x21dd('0x36')](_0x354b85,_0x456c1a);}return _0xb09da8;}function getCustomFields(_0x531748,_0x554fbf){var _0x48c5fb=[];var _0x30c779={'custom_fields':[]};if(_0x531748[_0x21dd('0x22')]>0x0){_[_0x21dd('0x37')](_0x531748,function(_0x4d3343){if(_[_0x21dd('0x38')]([_0x21dd('0x39'),'picklist'],_0x4d3343['type'])&&_0x4d3343[_0x21dd('0x3a')]&&!_0x4d3343[_0x21dd('0x3b')]){_0x30c779[_0x4d3343[_0x21dd('0x3a')]['toLowerCase']()]=_0x4d3343[_0x21dd('0x3c')][_0x21dd('0x30')]();}else if(_[_0x21dd('0x38')]([_0x21dd('0x39'),_0x21dd('0x3d')],_0x4d3343[_0x21dd('0x3e')])&&_0x4d3343['idField']&&_0x4d3343['customField']){_0x30c779[_0x21dd('0x1a')][_0x21dd('0x3f')]({'id':_0x4d3343['idField'],'value':_0x4d3343['content'][_0x21dd('0x30')]()});}else if(_0x4d3343[_0x21dd('0x3e')]==='variable'&&_0x4d3343[_0x21dd('0x40')]&&_0x4d3343['idField']&&_0x4d3343[_0x21dd('0x3b')]){_0x554fbf[_0x4d3343[_0x21dd('0x40')]]&&_0x30c779[_0x21dd('0x1a')][_0x21dd('0x3f')]({'id':_0x4d3343['idField'],'value':_0x554fbf[_0x4d3343[_0x21dd('0x40')]][_0x21dd('0x30')]()});}else if(_0x4d3343[_0x21dd('0x3e')]==='customVariable'&&_0x4d3343[_0x21dd('0x41')]&&_0x4d3343[_0x21dd('0x41')][_0x21dd('0x16')]&&_0x4d3343['idField']&&_0x4d3343['customField']){_0x554fbf[_0x4d3343[_0x21dd('0x41')]['name']['toLowerCase']()]&&_0x30c779[_0x21dd('0x1a')][_0x21dd('0x3f')]({'id':_0x4d3343[_0x21dd('0x42')],'value':_0x554fbf[_0x4d3343[_0x21dd('0x41')][_0x21dd('0x16')][_0x21dd('0x43')]()][_0x21dd('0x30')]()});}});}return _0x30c779;}exports[_0x21dd('0x44')]=function(_0x4c35d6,_0x251a38,_0x267366,_0x21a8e1,_0x2a17c4,_0x184598){var _0x87da85,_0x4d613c;_0x184598[_0x21dd('0x1d')]=intUtil[_0x21dd('0x45')](_0x184598[_0x21dd('0x1d')]);_0x184598['serverUrl']=intUtil[_0x21dd('0x45')](_0x184598[_0x21dd('0x46')]);if(_0x2a17c4&&_0x2a17c4[_0x21dd('0x47')]){logger['info'](_0x21dd('0x48'),_0x21dd('0x49'));_0x251a38[_0x21dd('0x4a')]=util[_0x21dd('0x1c')](_0x21dd('0x4b'),_0x184598[_0x21dd('0x46')],_0x251a38[_0x21dd('0x4c')],md5(_0x251a38['uniqueid']));}else{_0x251a38[_0x21dd('0x4a')]='';}headers[_0x21dd('0x4d')]=getAuth(_0x184598);return getUser(_0x184598,_0x21a8e1[_0x21dd('0x26')])['then'](function(_0x420afb){_0x87da85=_0x420afb;logger[_0x21dd('0xe')](_0x21dd('0x4e'),_0x87da85['id']);return getEndUser(_0x184598,_0x251a38[_0x21dd('0x12')],_0x251a38['calleridnum']);})[_0x21dd('0x1f')](function(_0x442e78){_0x4d613c=_0x442e78;logger[_0x21dd('0xe')](_0x21dd('0x4f'),_0x4d613c['id']);return getTicket(_0x184598,_0x87da85,_0x4d613c,_0x267366,_0x251a38);})[_0x21dd('0x1f')](function(_0x802e87){if(_0x802e87&&_0x802e87['id']){logger[_0x21dd('0xe')](_0x21dd('0x20'));logger[_0x21dd('0xe')](_0x21dd('0x50'),_0x802e87['id']);logger['info'](_0x21dd('0x48'),_0x21dd('0x51'));emit(util['format'](_0x21dd('0x52'),_0x21a8e1[_0x21dd('0x16')]),_0x21dd('0x53'),{'uri':util[_0x21dd('0x1c')](_0x21dd('0x54'),_0x184598['remoteUri'],_0x802e87['id'])});}})[_0x21dd('0x55')](function(_0x33b445){logger['error'](_0x21dd('0x48'),JSON[_0x21dd('0x56')](_0x33b445));});};exports[_0x21dd('0x57')]=function(_0x5dd726,_0x35a463,_0x25789f,_0x213577,_0x3f03fd,_0x2578f6,_0x22bb01){var _0x2e2f66,_0x224104;_0x2578f6[_0x21dd('0x1d')]=intUtil[_0x21dd('0x45')](_0x2578f6[_0x21dd('0x1d')]);_0x2578f6['serverUrl']=intUtil[_0x21dd('0x45')](_0x2578f6[_0x21dd('0x46')]);if(_0x22bb01&&_0x22bb01[_0x21dd('0x58')]&&_0x22bb01[_0x21dd('0x58')]!==_0x21dd('0x59')){logger['info'](_0x21dd('0x5a'),_0x21dd('0x49'));_0x35a463[_0x21dd('0x4a')]=util[_0x21dd('0x1c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2578f6[_0x21dd('0x46')],_0x35a463[_0x21dd('0x4c')],md5(_0x35a463[_0x21dd('0x4c')]));}headers[_0x21dd('0x4d')]=getAuth(_0x2578f6);return getUser(_0x2578f6,_0x213577[_0x21dd('0x26')])[_0x21dd('0x1f')](function(_0x21714e){_0x2e2f66=_0x21714e;logger['info']('The\x20User\x20ID\x20is:',_0x2e2f66['id']);return getEndUser(_0x2578f6,_0x35a463[_0x21dd('0x5b')],_0x35a463['destcalleridnum']);})[_0x21dd('0x1f')](function(_0x4e7633){_0x224104=_0x4e7633;logger[_0x21dd('0xe')](_0x21dd('0x4f'),_0x224104['id']);return getTicket(_0x2578f6,_0x2e2f66,_0x224104,_0x25789f,_0x35a463);})[_0x21dd('0x1f')](function(_0x28a5ae){if(_0x28a5ae&&_0x28a5ae['id']){logger['info']('Ticket\x20created!');logger[_0x21dd('0xe')](_0x21dd('0x50'),_0x28a5ae['id']);logger[_0x21dd('0xe')](_0x21dd('0x5a'),_0x21dd('0x51'));emit(util['format'](_0x21dd('0x52'),_0x213577['name']),_0x21dd('0x53'),{'uri':util[_0x21dd('0x1c')](_0x21dd('0x54'),_0x2578f6[_0x21dd('0x1d')],_0x28a5ae['id'])});}})['catch'](function(_0x16dc3b){logger[_0x21dd('0x5c')](_0x21dd('0x5a'),JSON['stringify'](_0x16dc3b));});};exports[_0x21dd('0x5d')]=function(_0x2239e8,_0x523fd3,_0x1b322f,_0x26e862,_0x3475e2,_0x49ac7b){var _0x2decdc,_0x425fc5;_0x49ac7b[_0x21dd('0x1d')]=intUtil[_0x21dd('0x45')](_0x49ac7b['remoteUri']);_0x49ac7b[_0x21dd('0x46')]=intUtil[_0x21dd('0x45')](_0x49ac7b[_0x21dd('0x46')]);if(_0x3475e2&&_0x3475e2[_0x21dd('0x47')]){logger[_0x21dd('0xe')]('['+_0x523fd3[_0x21dd('0x5e')][_0x21dd('0x5f')]()+']',_0x21dd('0x49'));_0x523fd3[_0x21dd('0x4a')]=util[_0x21dd('0x1c')](_0x21dd('0x4b'),_0x49ac7b[_0x21dd('0x46')],_0x523fd3[_0x21dd('0x4c')],md5(_0x523fd3[_0x21dd('0x4c')]));}else{_0x523fd3[_0x21dd('0x4a')]='';}headers['Authorization']=getAuth(_0x49ac7b);return getUser(_0x49ac7b,'')[_0x21dd('0x1f')](function(_0x52bf44){_0x2decdc=_0x52bf44;logger[_0x21dd('0xe')](_0x21dd('0x4e'),_0x2decdc['id']);return getEndUser(_0x49ac7b,_0x523fd3['calleridname'],_0x523fd3['calleridnum']);})[_0x21dd('0x1f')](function(_0x1b54fa){_0x425fc5=_0x1b54fa;logger[_0x21dd('0xe')](_0x21dd('0x4f'),_0x425fc5['id']);return getTicket(_0x49ac7b,_0x2decdc,_0x425fc5,_0x1b322f,_0x523fd3);})[_0x21dd('0x1f')](function(_0x20c1ac){if(_0x20c1ac){logger[_0x21dd('0xe')](_0x21dd('0x20'));logger[_0x21dd('0xe')](_0x21dd('0x50'),_0x20c1ac['id']);}})[_0x21dd('0x55')](function(_0x249d0){logger['error']('['+_0x523fd3['lastevent'][_0x21dd('0x5f')]()+']',JSON[_0x21dd('0x56')](_0x249d0));});}; \ 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 cbfbeaa..72d8f8d 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 _0x9395=['username','toLowerCase','outbound','destcalleridnum','calleridnum','unmanaged','queue','uniqueid','monitor_format','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information','then','length','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','headers','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','User\x20found:','userId','Admin\x20selected','userEmail','/api/lookup?q=','&f=','&entities=contact','find','contacts','catch','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','endUserId','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','POST','getString','Descriptions','task','Task\x20created:','ticketId','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl'];(function(_0x4123f2,_0x227240){var _0x51c7de=function(_0x1e202f){while(--_0x1e202f){_0x4123f2['push'](_0x4123f2['shift']());}};_0x51c7de(++_0x227240);}(_0x9395,0xb4));var _0x5939=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9395[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x5939('0x0'));var util=require(_0x5939('0x1'));var moment=require(_0x5939('0x2'));var Promise=require(_0x5939('0x3'));var Redis=require(_0x5939('0x4'));var intUtil=require(_0x5939('0x5'));var config=require(_0x5939('0x6'));var logger=require(_0x5939('0x7'))(_0x5939('0x8'));config[_0x5939('0x9')]=_[_0x5939('0xa')](config['redis'],{'host':_0x5939('0xb'),'port':0x18eb});var io=require(_0x5939('0xc'))(new Redis(config['redis']));function getAdminId(_0xf56c44,_0x329039,_0x5859ed,_0x151806){return new Promise(function(_0x285028,_0x4c49a3){var _0x3aab78=![];var _0x3f8bb4={'method':_0x5939('0xd'),'uri':_0x151806+_0x5939('0xe'),'json':!![]};_0x3f8bb4['headers']=_0x5859ed;logger[_0x5939('0xf')](_0x5939('0x10'));return rp(_0x3f8bb4)[_0x5939('0x11')](function(_0xf55d6e){if(_0xf55d6e){var _0x46206a=_0xf55d6e['users'];var _0x3795d4=null;for(_0x3795d4=0x0;_0x3795d4<_0x46206a[_0x5939('0x12')];_0x3795d4++){if(_0x46206a[_0x3795d4]['email']===_0xf56c44[_0x5939('0x13')]){_0xf56c44['adminId']=_0x46206a[_0x3795d4]['id'];_0x3aab78=!![];}}if(_0x3aab78){logger[_0x5939('0xf')]('Admin\x20found:',_0xf56c44[_0x5939('0x14')]);_0x285028(_0xf56c44);}else{_0x4c49a3({'statusCode':0x194,'message':_0x5939('0x15')});}}else{_0x4c49a3({'statusCode':0x194,'message':_0x5939('0x15')});}})['catch'](function(_0x14f592){logger[_0x5939('0x16')]('['+[_0x329039[_0x5939('0x17')]()]+']',_0x14f592[_0x5939('0x18')]);_0x4c49a3(_0x14f592);});});}function getUser(_0x19f2c9,_0x5a8e24,_0x2cd436){return function(_0x494902){return new Promise(function(_0x134fa6,_0x792e0f){var _0x1f20dc={'method':'GET','uri':_0x2cd436+_0x5939('0xe'),'json':!![]};_0x1f20dc[_0x5939('0x19')]=_0x5a8e24;logger[_0x5939('0xf')](_0x5939('0x1a'));return rp(_0x1f20dc)[_0x5939('0x11')](function(_0x2ea6d4){if(_0x2ea6d4){var _0x495c70=_0x2ea6d4['users'];var _0x5e32a3=![];var _0x318ba3=null;if(_0x494902[_0x5939('0x1b')]!==null){logger[_0x5939('0xf')](_0x5939('0x1c'),_0x494902[_0x5939('0x1b')]);_0x494902['userEmail']=_0x494902[_0x5939('0x1b')];for(_0x318ba3=0x0;_0x318ba3<_0x495c70[_0x5939('0x12')];_0x318ba3++){if(_0x495c70[_0x318ba3]['email']===_0x494902[_0x5939('0x1b')]){_0x5e32a3=!![];_0x494902['userId']=_0x495c70[_0x318ba3]['id'];logger['info'](_0x5939('0x1d'),_0x494902[_0x5939('0x1e')]);}}}if(!_0x5e32a3){logger['info'](_0x5939('0x1f'));_0x494902[_0x5939('0x20')]=_0x494902['adminEmail'];_0x494902[_0x5939('0x1e')]=_0x494902[_0x5939('0x14')];_0x5e32a3=!![];}if(_0x5e32a3){_0x134fa6(_0x494902);}else{_0x792e0f({'statusCode':0x194,'message':_0x5939('0x15')});}}else{_0x792e0f({'statusCode':0x194,'message':_0x5939('0x15')});}})['catch'](function(_0x53f2b2){logger[_0x5939('0x16')]('['+[_0x19f2c9['toUpperCase']()]+']',_0x53f2b2[_0x5939('0x18')]);_0x792e0f(_0x53f2b2);});});};}function searchContact(_0x59870a,_0x2ea30c,_0x591ebb,_0x1b03b8){return new Promise(function(_0x79471f,_0x485477){var _0x56b600={'method':'GET','headers':_0x2ea30c,'uri':_0x59870a+_0x5939('0x21')+_0x1b03b8+_0x5939('0x22')+_0x591ebb+_0x5939('0x23'),'json':!![]};rp(_0x56b600)[_0x5939('0x11')](function(_0x4c9d4a){var _0x2508cf=_[_0x5939('0x24')](_0x4c9d4a[_0x5939('0x25')][_0x5939('0x25')],[_0x591ebb,_0x1b03b8]);_0x79471f(_0x2508cf);})[_0x5939('0x26')](function(_0x51b0d2){_0x485477(_0x51b0d2);});});}function getEndUser(_0x32f951,_0x5d58f4,_0x10d540){return function(_0x5bed15){return new Promise(function(_0x3200fc,_0x510996){logger[_0x5939('0xf')](util[_0x5939('0x27')](_0x5939('0x28'),_0x5bed15[_0x5939('0x29')]));searchContact(_0x10d540,_0x5d58f4,_0x5939('0x2a'),_0x5bed15[_0x5939('0x29')])[_0x5939('0x11')](function(_0x518005){if(_0x518005){_0x5bed15['endUserId']=_0x518005['id'];logger['info'](_0x5939('0x2b'),_0x5bed15['endUserId']);return _0x3200fc(_0x5bed15);}searchContact(_0x10d540,_0x5d58f4,_0x5939('0x2c'),_0x5bed15[_0x5939('0x29')])['then'](function(_0x38ff84){if(_0x38ff84){_0x5bed15['endUserId']=_0x38ff84['id'];logger[_0x5939('0xf')](_0x5939('0x2d'),_0x5bed15[_0x5939('0x2e')]);return _0x3200fc(_0x5bed15);}createEndUser(_0x5bed15,_0x32f951,_0x5d58f4,_0x10d540)[_0x5939('0x11')](function(_0x2eab6b){logger[_0x5939('0xf')](_0x5939('0x2f'),_0x2eab6b[_0x5939('0x2e')]);return _0x3200fc(_0x2eab6b);});});})[_0x5939('0x26')](function(_0x5019d6){_0x510996(_0x5019d6);});});};}function createEndUser(_0x49aa6f,_0x1726ed,_0x285376,_0x50687){return new Promise(function(_0x29a787,_0x2818fe){var _0x576458=moment();var _0x350867={'method':'POST','uri':_0x50687+_0x5939('0x30'),'body':{'contact':{'last_name':_0x49aa6f['contactNumber'],'work_number':_0x49aa6f[_0x5939('0x29')],'mobile_number':_0x49aa6f[_0x5939('0x29')],'owner_id':_0x49aa6f[_0x5939('0x1e')],'created_at':_0x576458[_0x5939('0x27')](_0x5939('0x31'))}},'json':!![]};_0x350867[_0x5939('0x19')]=_0x285376;logger[_0x5939('0xf')](_0x5939('0x32'));return rp(_0x350867)['then'](function(_0x3a36e0){_0x49aa6f['endUserId']=_0x3a36e0[_0x5939('0x33')]['id'];_0x29a787(_0x49aa6f);})[_0x5939('0x26')](function(_0x4085d4){logger[_0x5939('0x16')]('['+[_0x1726ed[_0x5939('0x17')]()]+']',_0x4085d4[_0x5939('0x18')]);_0x2818fe(_0x4085d4[_0x5939('0x18')]);});});}function getTicket(_0x1bb835,_0x356570,_0x23ae57,_0x5d7b79,_0x14c205){return function(_0x36670d){logger[_0x5939('0xf')]('Creating\x20new\x20task');return new Promise(function(_0x319a8b,_0xa53de7){var _0x59015e=moment();var _0x36b3b8={'method':_0x5939('0x34'),'uri':_0x23ae57+'/api/tasks','body':{'title':intUtil[_0x5939('0x35')](_0x5d7b79['Subjects'],_0x14c205,'\x20'),'description':intUtil[_0x5939('0x35')](_0x5d7b79[_0x5939('0x36')],_0x14c205,'\x0a'),'owner_id':_0x36670d[_0x5939('0x1e')],'creater_id':_0x36670d['adminId'],'targetable_id':_0x36670d['endUserId'],'targetable_type':'Contact','created_at':_0x59015e['format'](_0x5939('0x31')),'due_date':_0x59015e['add'](0x1e,'m')[_0x5939('0x27')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x36b3b8[_0x5939('0x19')]=_0x356570;return rp(_0x36b3b8)['then'](function(_0x118b39){_0x36670d['ticketId']=_0x118b39[_0x5939('0x37')]['id'];logger['info'](_0x5939('0x38'),_0x36670d[_0x5939('0x39')]);_0x319a8b(_0x36670d);})[_0x5939('0x26')](function(_0x5ae158){logger[_0x5939('0x16')]('['+[_0x1bb835[_0x5939('0x17')]()]+']',_0x5ae158[_0x5939('0x18')]);_0xa53de7(_0x5ae158[_0x5939('0x18')]);});});};}function emit(_0x47f903,_0x4b497c,_0x192b36){var _0x28b98c={'uri':_0x47f903+'/contacts/'+_0x192b36};io['to'](util[_0x5939('0x27')]('user:%s',_0x4b497c))['emit'](_0x5939('0x3a'),_0x28b98c);}exports['cs']=function(_0x325bf,_0xcf149b,_0x16dc97,_0x20c0cd,_0x2f3a27,_0x1975f2,_0x4bd95a,_0x5c8365){var _0x25a6ea={};var _0x46d71d={'Authorization':_0x5939('0x3b')+_0x1975f2['apiKey']};_0x1975f2[_0x5939('0x3c')]=intUtil[_0x5939('0x3d')](_0x1975f2[_0x5939('0x3c')]);_0x1975f2[_0x5939('0x3e')]=intUtil[_0x5939('0x3d')](_0x1975f2[_0x5939('0x3e')]);var _0x5ce6ad=_0x1975f2[_0x5939('0x3c')];_0x25a6ea['adminEmail']=_0x1975f2[_0x5939('0x3f')];_0x25a6ea['contactNumber']=_0x5c8365[_0x5939('0x40')]()===_0x5939('0x41')?_0xcf149b[_0x5939('0x42')]:_0xcf149b[_0x5939('0x43')];_0x25a6ea['callDirection']=_0x5c8365==='queue'||_0x5c8365===_0x5939('0x44')?_0x5939('0x45'):_0x5939('0x41');if(_0x20c0cd){_0x25a6ea[_0x5939('0x1b')]=_0x20c0cd['email'];}var _0x38a96e=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1975f2[_0x5939('0x3e')],_0xcf149b['uniqueid'],md5(_0xcf149b[_0x5939('0x46')]));if(_0x2f3a27&&_0x2f3a27[_0x5939('0x47')]){logger[_0x5939('0xf')]('[QUEUE]','Recording\x20is\x20enabled!');_0xcf149b['recordingURL']=_0x38a96e;}else if(_0x4bd95a&&_0x4bd95a[_0x5939('0x48')]&&_0x4bd95a[_0x5939('0x48')]!==_0x5939('0x49')){logger[_0x5939('0xf')](_0x5939('0x4a'),_0x5939('0x4b'));_0xcf149b['recordingURL']=_0x38a96e;}else{_0xcf149b[_0x5939('0x4c')]='';}return getAdminId(_0x25a6ea,_0x5c8365,_0x46d71d,_0x5ce6ad)['then'](getUser(_0x5c8365,_0x46d71d,_0x5ce6ad))[_0x5939('0x11')](getEndUser(_0x5c8365,_0x46d71d,_0x5ce6ad))[_0x5939('0x11')](getTicket(_0x5c8365,_0x46d71d,_0x5ce6ad,_0x16dc97,_0xcf149b))[_0x5939('0x11')](function(_0x52beca){logger[_0x5939('0xf')](util[_0x5939('0x27')]('The\x20ticket\x20ID\x20is:\x20%s',_0x52beca[_0x5939('0x39')]));if(_0x5c8365!=='unmanaged'){logger[_0x5939('0xf')]('['+[_0x5c8365[_0x5939('0x17')]()]+']',_0x5939('0x4d'));emit(_0x5ce6ad,_0x20c0cd[_0x5939('0x4e')],_0x52beca['endUserId']);}})['catch'](function(_0x2aed43){logger[_0x5939('0x16')]('['+[_0x5c8365[_0x5939('0x17')]()]+_0x5939('0x4f'),util[_0x5939('0x50')](_0x2aed43,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x134e=['users','length','email','adminEmail','adminId','Admin\x20found:','catch','toUpperCase','message','Getting\x20user\x20list','agentEmail','userId','User\x20found:','userEmail','Requested\x20Resource\x20not\x20Found','error','/api/lookup?q=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','contact','Creating\x20new\x20task','getString','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','GET','headers','info','Getting\x20admin\x20information','then'];(function(_0x4705d8,_0x4d06de){var _0x2d2f1e=function(_0xe64e62){while(--_0xe64e62){_0x4705d8['push'](_0x4705d8['shift']());}};_0x2d2f1e(++_0x4d06de);}(_0x134e,0x95));var _0xe134=function(_0x547074,_0x11f601){_0x547074=_0x547074-0x0;var _0x1efee=_0x134e[_0x547074];return _0x1efee;};'use strict';var _=require(_0xe134('0x0'));var rp=require(_0xe134('0x1'));var md5=require(_0xe134('0x2'));var util=require('util');var moment=require(_0xe134('0x3'));var Promise=require(_0xe134('0x4'));var Redis=require(_0xe134('0x5'));var intUtil=require(_0xe134('0x6'));var config=require(_0xe134('0x7'));var logger=require(_0xe134('0x8'))('freshsales');config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe134('0x9')]));function getAdminId(_0x21d8ad,_0x45293b,_0x4a617a,_0x1bb048){return new Promise(function(_0x5c2293,_0xaf89ef){var _0x2b8806=![];var _0x547435={'method':_0xe134('0xa'),'uri':_0x1bb048+'/api/selector/owners','json':!![]};_0x547435[_0xe134('0xb')]=_0x4a617a;logger[_0xe134('0xc')](_0xe134('0xd'));return rp(_0x547435)[_0xe134('0xe')](function(_0x49c865){if(_0x49c865){var _0xcd72e5=_0x49c865[_0xe134('0xf')];var _0x415a25=null;for(_0x415a25=0x0;_0x415a25<_0xcd72e5[_0xe134('0x10')];_0x415a25++){if(_0xcd72e5[_0x415a25][_0xe134('0x11')]===_0x21d8ad[_0xe134('0x12')]){_0x21d8ad[_0xe134('0x13')]=_0xcd72e5[_0x415a25]['id'];_0x2b8806=!![];}}if(_0x2b8806){logger['info'](_0xe134('0x14'),_0x21d8ad['adminId']);_0x5c2293(_0x21d8ad);}else{_0xaf89ef({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0xaf89ef({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xe134('0x15')](function(_0x10b873){logger['error']('['+[_0x45293b[_0xe134('0x16')]()]+']',_0x10b873[_0xe134('0x17')]);_0xaf89ef(_0x10b873);});});}function getUser(_0x452fb3,_0x55f781,_0x47fb59){return function(_0x57e0d5){return new Promise(function(_0x3a13c1,_0x341b74){var _0x99d3c5={'method':_0xe134('0xa'),'uri':_0x47fb59+'/api/selector/owners','json':!![]};_0x99d3c5['headers']=_0x55f781;logger[_0xe134('0xc')](_0xe134('0x18'));return rp(_0x99d3c5)[_0xe134('0xe')](function(_0x5de1ac){if(_0x5de1ac){var _0x223a9c=_0x5de1ac['users'];var _0x4fd9ce=![];var _0x18570a=null;if(_0x57e0d5[_0xe134('0x19')]!==null){logger[_0xe134('0xc')]('Getting\x20user\x20with\x20email',_0x57e0d5['agentEmail']);_0x57e0d5['userEmail']=_0x57e0d5[_0xe134('0x19')];for(_0x18570a=0x0;_0x18570a<_0x223a9c['length'];_0x18570a++){if(_0x223a9c[_0x18570a][_0xe134('0x11')]===_0x57e0d5[_0xe134('0x19')]){_0x4fd9ce=!![];_0x57e0d5[_0xe134('0x1a')]=_0x223a9c[_0x18570a]['id'];logger[_0xe134('0xc')](_0xe134('0x1b'),_0x57e0d5[_0xe134('0x1a')]);}}}if(!_0x4fd9ce){logger[_0xe134('0xc')]('Admin\x20selected');_0x57e0d5[_0xe134('0x1c')]=_0x57e0d5[_0xe134('0x12')];_0x57e0d5[_0xe134('0x1a')]=_0x57e0d5[_0xe134('0x13')];_0x4fd9ce=!![];}if(_0x4fd9ce){_0x3a13c1(_0x57e0d5);}else{_0x341b74({'statusCode':0x194,'message':_0xe134('0x1d')});}}else{_0x341b74({'statusCode':0x194,'message':_0xe134('0x1d')});}})[_0xe134('0x15')](function(_0x1548e3){logger[_0xe134('0x1e')]('['+[_0x452fb3['toUpperCase']()]+']',_0x1548e3[_0xe134('0x17')]);_0x341b74(_0x1548e3);});});};}function searchContact(_0x23fc0f,_0x537267,_0x105ece,_0x5e9a08){return new Promise(function(_0x19858d,_0x6143d2){var _0x3f4c39={'method':_0xe134('0xa'),'headers':_0x537267,'uri':_0x23fc0f+_0xe134('0x1f')+_0x5e9a08+'&f='+_0x105ece+_0xe134('0x20'),'json':!![]};rp(_0x3f4c39)[_0xe134('0xe')](function(_0x242189){var _0x19a57f=_['find'](_0x242189[_0xe134('0x21')][_0xe134('0x21')],[_0x105ece,_0x5e9a08]);_0x19858d(_0x19a57f);})[_0xe134('0x15')](function(_0x1018bd){_0x6143d2(_0x1018bd);});});}function getEndUser(_0x424bb7,_0x2af1f3,_0x5bccda){return function(_0x4e9151){return new Promise(function(_0x431015,_0x33ca03){logger[_0xe134('0xc')](util[_0xe134('0x22')](_0xe134('0x23'),_0x4e9151[_0xe134('0x24')]));searchContact(_0x5bccda,_0x2af1f3,_0xe134('0x25'),_0x4e9151[_0xe134('0x24')])[_0xe134('0xe')](function(_0x146664){if(_0x146664){_0x4e9151[_0xe134('0x26')]=_0x146664['id'];logger[_0xe134('0xc')](_0xe134('0x27'),_0x4e9151[_0xe134('0x26')]);return _0x431015(_0x4e9151);}searchContact(_0x5bccda,_0x2af1f3,_0xe134('0x28'),_0x4e9151[_0xe134('0x24')])['then'](function(_0x5db204){if(_0x5db204){_0x4e9151['endUserId']=_0x5db204['id'];logger['info'](_0xe134('0x29'),_0x4e9151[_0xe134('0x26')]);return _0x431015(_0x4e9151);}createEndUser(_0x4e9151,_0x424bb7,_0x2af1f3,_0x5bccda)[_0xe134('0xe')](function(_0x4b118c){logger[_0xe134('0xc')](_0xe134('0x2a'),_0x4b118c['endUserId']);return _0x431015(_0x4b118c);});});})['catch'](function(_0x2756ff){_0x33ca03(_0x2756ff);});});};}function createEndUser(_0x5e2dc9,_0x1abcc0,_0x3023f6,_0x4e9ccd){return new Promise(function(_0x221da5,_0x28bf28){var _0x1a5332=moment();var _0x36e733={'method':_0xe134('0x2b'),'uri':_0x4e9ccd+_0xe134('0x2c'),'body':{'contact':{'last_name':_0x5e2dc9['contactNumber'],'work_number':_0x5e2dc9[_0xe134('0x24')],'mobile_number':_0x5e2dc9[_0xe134('0x24')],'owner_id':_0x5e2dc9[_0xe134('0x1a')],'created_at':_0x1a5332[_0xe134('0x22')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x36e733[_0xe134('0xb')]=_0x3023f6;logger[_0xe134('0xc')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x36e733)[_0xe134('0xe')](function(_0x5f18e4){_0x5e2dc9[_0xe134('0x26')]=_0x5f18e4[_0xe134('0x2d')]['id'];_0x221da5(_0x5e2dc9);})[_0xe134('0x15')](function(_0x5f257a){logger['error']('['+[_0x1abcc0[_0xe134('0x16')]()]+']',_0x5f257a[_0xe134('0x17')]);_0x28bf28(_0x5f257a['message']);});});}function getTicket(_0xf1b823,_0x1c41af,_0x4bc771,_0x5af5e7,_0x1c7e45){return function(_0xa04011){logger['info'](_0xe134('0x2e'));return new Promise(function(_0x5b1dca,_0x51efb4){var _0x377cdd=moment();var _0x1be6e1={'method':_0xe134('0x2b'),'uri':_0x4bc771+'/api/tasks','body':{'title':intUtil[_0xe134('0x2f')](_0x5af5e7[_0xe134('0x30')],_0x1c7e45,'\x20'),'description':intUtil[_0xe134('0x2f')](_0x5af5e7[_0xe134('0x31')],_0x1c7e45,'\x0a'),'owner_id':_0xa04011['userId'],'creater_id':_0xa04011[_0xe134('0x13')],'targetable_id':_0xa04011[_0xe134('0x26')],'targetable_type':_0xe134('0x32'),'created_at':_0x377cdd[_0xe134('0x22')](_0xe134('0x33')),'due_date':_0x377cdd[_0xe134('0x34')](0x1e,'m')['format'](_0xe134('0x33'))},'json':!![]};_0x1be6e1['headers']=_0x1c41af;return rp(_0x1be6e1)[_0xe134('0xe')](function(_0x2cd7e1){_0xa04011[_0xe134('0x35')]=_0x2cd7e1[_0xe134('0x36')]['id'];logger[_0xe134('0xc')](_0xe134('0x37'),_0xa04011[_0xe134('0x35')]);_0x5b1dca(_0xa04011);})[_0xe134('0x15')](function(_0xa70510){logger[_0xe134('0x1e')]('['+[_0xf1b823[_0xe134('0x16')]()]+']',_0xa70510[_0xe134('0x17')]);_0x51efb4(_0xa70510['message']);});});};}function emit(_0x269455,_0x2651aa,_0x518ca1){var _0xce921a={'uri':_0x269455+_0xe134('0x38')+_0x518ca1};io['to'](util[_0xe134('0x22')](_0xe134('0x39'),_0x2651aa))[_0xe134('0x3a')](_0xe134('0x3b'),_0xce921a);}exports['cs']=function(_0x198189,_0x258241,_0x27bc2b,_0x17580a,_0x4fa56d,_0x28c46d,_0x3c3193,_0x5d5fb7){var _0x4025f3={};var _0x1ef093={'Authorization':'Token\x20token='+_0x28c46d[_0xe134('0x3c')]};_0x28c46d[_0xe134('0x3d')]=intUtil[_0xe134('0x3e')](_0x28c46d['remoteUri']);_0x28c46d['serverUrl']=intUtil['stripTrailingSlash'](_0x28c46d[_0xe134('0x3f')]);var _0xeeb057=_0x28c46d[_0xe134('0x3d')];_0x4025f3[_0xe134('0x12')]=_0x28c46d[_0xe134('0x40')];_0x4025f3['contactNumber']=_0x5d5fb7['toLowerCase']()===_0xe134('0x41')?_0x258241[_0xe134('0x42')]:_0x258241['calleridnum'];_0x4025f3[_0xe134('0x43')]=_0x5d5fb7===_0xe134('0x44')||_0x5d5fb7==='unmanaged'?'queue':_0xe134('0x41');if(_0x17580a){_0x4025f3[_0xe134('0x19')]=_0x17580a[_0xe134('0x11')];}var _0x1231a7=util[_0xe134('0x22')](_0xe134('0x45'),_0x28c46d['serverUrl'],_0x258241[_0xe134('0x46')],md5(_0x258241[_0xe134('0x46')]));if(_0x4fa56d&&_0x4fa56d[_0xe134('0x47')]){logger[_0xe134('0xc')](_0xe134('0x48'),_0xe134('0x49'));_0x258241['recordingURL']=_0x1231a7;}else if(_0x3c3193&&_0x3c3193[_0xe134('0x4a')]&&_0x3c3193[_0xe134('0x4a')]!=='none'){logger[_0xe134('0xc')](_0xe134('0x4b'),_0xe134('0x49'));_0x258241[_0xe134('0x4c')]=_0x1231a7;}else{_0x258241[_0xe134('0x4c')]='';}return getAdminId(_0x4025f3,_0x5d5fb7,_0x1ef093,_0xeeb057)[_0xe134('0xe')](getUser(_0x5d5fb7,_0x1ef093,_0xeeb057))[_0xe134('0xe')](getEndUser(_0x5d5fb7,_0x1ef093,_0xeeb057))[_0xe134('0xe')](getTicket(_0x5d5fb7,_0x1ef093,_0xeeb057,_0x27bc2b,_0x258241))[_0xe134('0xe')](function(_0x260692){logger['info'](util[_0xe134('0x22')](_0xe134('0x4d'),_0x260692[_0xe134('0x35')]));if(_0x5d5fb7!==_0xe134('0x4e')){logger[_0xe134('0xc')]('['+[_0x5d5fb7[_0xe134('0x16')]()]+']',_0xe134('0x4f'));emit(_0xeeb057,_0x17580a[_0xe134('0x50')],_0x260692[_0xe134('0x26')]);}})['catch'](function(_0x569891){logger[_0xe134('0x1e')]('['+[_0x5d5fb7[_0xe134('0x16')]()]+_0xe134('0x51'),util['inspect'](_0x569891,{'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 52f3234..43d7efa 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 _0x7fbc=['zendesk','salesforce','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','find','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','log','unknown\x20integration','error','[EXEC]','format','data3','lodash','util','./sugarcrm','./zoho','./desk','./vtiger','./dynamics365','./freshsales'];(function(_0x9cb19f,_0x35f63a){var _0x3ad398=function(_0x5d9ea0){while(--_0x5d9ea0){_0x9cb19f['push'](_0x9cb19f['shift']());}};_0x3ad398(++_0x35f63a);}(_0x7fbc,0xdf));var _0xc7fb=function(_0x1dcc18,_0x5ef3b9){_0x1dcc18=_0x1dcc18-0x0;var _0x17b7ab=_0x7fbc[_0x1dcc18];return _0x17b7ab;};'use strict';var _=require(_0xc7fb('0x0'));var util=require(_0xc7fb('0x1'));var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0xc7fb('0x2'));var freshdesk=require('./freshdesk');var zoho=require(_0xc7fb('0x3'));var desk=require(_0xc7fb('0x4'));var vtiger=require(_0xc7fb('0x5'));var servicenow=require('./servicenow');var dynamics365=require(_0xc7fb('0x6'));var freshsales=require(_0xc7fb('0x7'));var integrations=[_0xc7fb('0x8'),_0xc7fb('0x9'),'sugarcrm',_0xc7fb('0xa'),_0xc7fb('0xb'),_0xc7fb('0xc'),_0xc7fb('0xd'),_0xc7fb('0xe'),_0xc7fb('0xf'),_0xc7fb('0x10')];exports[_0xc7fb('0x11')]=function(_0xf42fc5,_0x779582,_0x3309ab,_0x2eb105,_0xe4bdb1,_0x2d565c){if(_0x3309ab){if(_[_0xc7fb('0x12')](integrations,_0xf42fc5[_0xc7fb('0x13')]['toLowerCase']())){try{var _0x350dd8=null;var _0x13476d='';var _0x367639=_0x3309ab[_0xf42fc5[_0xc7fb('0x13')][_0xc7fb('0x14')]()];if(_0x367639){var _0x27765e=_0x367639[_0xf42fc5['data2']];if(_0x27765e){var _0xaf119f=_[_0xc7fb('0x15')](_0x27765e['Configurations'],{'id':parseInt(_0xf42fc5['data3'],0xa)});if(_0xaf119f){if(_0x2eb105){if(_0xe4bdb1&&_0x779582[_0xc7fb('0x16')]){_0x13476d=_0xc7fb('0x16');}else if(_0x779582[_0xc7fb('0x17')]){_0x13476d=_0xc7fb('0x18');}else{console['log'](_0xc7fb('0x19'),_0x779582);}}else{_0x13476d=_0xc7fb('0x1a');}switch(_0xf42fc5[_0xc7fb('0x13')][_0xc7fb('0x14')]()){case _0xc7fb('0x8'):zendesk[_0x13476d](_0xf42fc5,_0x779582,_0xaf119f,_0x2eb105,_0xe4bdb1,_0x27765e,_0x2d565c);break;case _0xc7fb('0x9'):salesforce[_0x13476d](_0xf42fc5,_0x779582,_0xaf119f,_0x2eb105,_0xe4bdb1,_0x27765e,_0x2d565c);break;case'sugarcrm':sugarcrm[_0x13476d](_0xf42fc5,_0x779582,_0xaf119f,_0x2eb105,_0xe4bdb1,_0x27765e,_0x2d565c);break;case _0xc7fb('0xa'):freshdesk[_0x13476d](_0xf42fc5,_0x779582,_0xaf119f,_0x2eb105,_0xe4bdb1,_0x27765e,_0x2d565c);break;case _0xc7fb('0xb'):zoho[_0x13476d](_0xf42fc5,_0x779582,_0xaf119f,_0x2eb105,_0xe4bdb1,_0x27765e,_0x2d565c);break;case _0xc7fb('0xc'):desk[_0x13476d](_0xf42fc5,_0x779582,_0xaf119f,_0x2eb105,_0xe4bdb1,_0x27765e,_0x2d565c);break;case _0xc7fb('0xd'):vtiger[_0x13476d](_0xf42fc5,_0x779582,_0xaf119f,_0x2eb105,_0xe4bdb1,_0x27765e,_0x2d565c);break;case'freshsales':freshsales['cs'](_0xf42fc5,_0x779582,_0xaf119f,_0x2eb105,_0xe4bdb1,_0x27765e,_0x2d565c,_0x13476d);break;case _0xc7fb('0x10'):servicenow['cs'](_0xf42fc5,_0x779582,_0xaf119f,_0x2eb105,_0xe4bdb1,_0x27765e,_0x2d565c,_0x13476d);break;case _0xc7fb('0xe'):dynamics365['cs'](_0xf42fc5,_0x779582,_0xaf119f,_0x2eb105,_0xe4bdb1,_0x27765e,_0x2d565c,_0x13476d);break;default:console[_0xc7fb('0x1b')](_0xc7fb('0x1c'));}}else{_0x350dd8=require('../../../../config/logger')(_0xf42fc5['data1']['toLowerCase']());_0x350dd8[_0xc7fb('0x1d')](_0xc7fb('0x1e'),util[_0xc7fb('0x1f')]('%s\x20configuration\x20#%s\x20not\x20found',_0xf42fc5[_0xc7fb('0x13')][_0xc7fb('0x14')](),_0xf42fc5[_0xc7fb('0x20')]));}}else{_0x350dd8=require('../../../../config/logger')(_0xf42fc5[_0xc7fb('0x13')][_0xc7fb('0x14')]());_0x350dd8['error']('[EXEC]',util[_0xc7fb('0x1f')]('%s\x20account\x20#%s\x20not\x20found',_0xf42fc5[_0xc7fb('0x13')][_0xc7fb('0x14')](),_0xf42fc5['data2']));}}else{}}catch(_0x31fba9){console[_0xc7fb('0x1d')](_0x31fba9);}}}}; \ No newline at end of file +var _0x3411=['./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','vtiger','dynamics365','freshsales','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','zoho','desk','servicenow','log','unknown\x20integration','format','../../../../config/logger','error','util','./zendesk','./sugarcrm','./freshdesk','./zoho','./desk'];(function(_0x18ab10,_0x526c8a){var _0x44ba1d=function(_0x3ba882){while(--_0x3ba882){_0x18ab10['push'](_0x18ab10['shift']());}};_0x44ba1d(++_0x526c8a);}(_0x3411,0x1e8));var _0x1341=function(_0xa8636d,_0x10b9d9){_0xa8636d=_0xa8636d-0x0;var _0x2f87cf=_0x3411[_0xa8636d];return _0x2f87cf;};'use strict';var _=require('lodash');var util=require(_0x1341('0x0'));var zendesk=require(_0x1341('0x1'));var salesforce=require('./salesforce');var sugarcrm=require(_0x1341('0x2'));var freshdesk=require(_0x1341('0x3'));var zoho=require(_0x1341('0x4'));var desk=require(_0x1341('0x5'));var vtiger=require(_0x1341('0x6'));var servicenow=require(_0x1341('0x7'));var dynamics365=require(_0x1341('0x8'));var freshsales=require(_0x1341('0x9'));var integrations=[_0x1341('0xa'),_0x1341('0xb'),_0x1341('0xc'),_0x1341('0xd'),'zoho','desk',_0x1341('0xe'),_0x1341('0xf'),_0x1341('0x10'),'servicenow'];exports[_0x1341('0x11')]=function(_0x3f9586,_0x41430c,_0x5b168b,_0x2edc76,_0x4be3b7,_0x51ba41){if(_0x5b168b){if(_[_0x1341('0x12')](integrations,_0x3f9586[_0x1341('0x13')][_0x1341('0x14')]())){try{var _0x1a6f17=null;var _0xf97be9='';var _0x6a9e7f=_0x5b168b[_0x3f9586[_0x1341('0x13')][_0x1341('0x14')]()];if(_0x6a9e7f){var _0x3e4a20=_0x6a9e7f[_0x3f9586[_0x1341('0x15')]];if(_0x3e4a20){var _0x3492c9=_[_0x1341('0x16')](_0x3e4a20[_0x1341('0x17')],{'id':parseInt(_0x3f9586[_0x1341('0x18')],0xa)});if(_0x3492c9){if(_0x2edc76){if(_0x4be3b7&&_0x41430c['queue']){_0xf97be9=_0x1341('0x19');}else if(_0x41430c[_0x1341('0x1a')]){_0xf97be9=_0x1341('0x1b');}else{console['log'](_0x1341('0x1c'),_0x41430c);}}else{_0xf97be9=_0x1341('0x1d');}switch(_0x3f9586[_0x1341('0x13')]['toLowerCase']()){case _0x1341('0xa'):zendesk[_0xf97be9](_0x3f9586,_0x41430c,_0x3492c9,_0x2edc76,_0x4be3b7,_0x3e4a20,_0x51ba41);break;case _0x1341('0xb'):salesforce[_0xf97be9](_0x3f9586,_0x41430c,_0x3492c9,_0x2edc76,_0x4be3b7,_0x3e4a20,_0x51ba41);break;case _0x1341('0xc'):sugarcrm[_0xf97be9](_0x3f9586,_0x41430c,_0x3492c9,_0x2edc76,_0x4be3b7,_0x3e4a20,_0x51ba41);break;case _0x1341('0xd'):freshdesk[_0xf97be9](_0x3f9586,_0x41430c,_0x3492c9,_0x2edc76,_0x4be3b7,_0x3e4a20,_0x51ba41);break;case _0x1341('0x1e'):zoho[_0xf97be9](_0x3f9586,_0x41430c,_0x3492c9,_0x2edc76,_0x4be3b7,_0x3e4a20,_0x51ba41);break;case _0x1341('0x1f'):desk[_0xf97be9](_0x3f9586,_0x41430c,_0x3492c9,_0x2edc76,_0x4be3b7,_0x3e4a20,_0x51ba41);break;case _0x1341('0xe'):vtiger[_0xf97be9](_0x3f9586,_0x41430c,_0x3492c9,_0x2edc76,_0x4be3b7,_0x3e4a20,_0x51ba41);break;case _0x1341('0x10'):freshsales['cs'](_0x3f9586,_0x41430c,_0x3492c9,_0x2edc76,_0x4be3b7,_0x3e4a20,_0x51ba41,_0xf97be9);break;case _0x1341('0x20'):servicenow['cs'](_0x3f9586,_0x41430c,_0x3492c9,_0x2edc76,_0x4be3b7,_0x3e4a20,_0x51ba41,_0xf97be9);break;case _0x1341('0xf'):dynamics365['cs'](_0x3f9586,_0x41430c,_0x3492c9,_0x2edc76,_0x4be3b7,_0x3e4a20,_0x51ba41,_0xf97be9);break;default:console[_0x1341('0x21')](_0x1341('0x22'));}}else{_0x1a6f17=require('../../../../config/logger')(_0x3f9586[_0x1341('0x13')]['toLowerCase']());_0x1a6f17['error']('[EXEC]',util[_0x1341('0x23')]('%s\x20configuration\x20#%s\x20not\x20found',_0x3f9586['data1'][_0x1341('0x14')](),_0x3f9586['data3']));}}else{_0x1a6f17=require(_0x1341('0x24'))(_0x3f9586[_0x1341('0x13')][_0x1341('0x14')]());_0x1a6f17[_0x1341('0x25')]('[EXEC]',util[_0x1341('0x23')]('%s\x20account\x20#%s\x20not\x20found',_0x3f9586[_0x1341('0x13')][_0x1341('0x14')](),_0x3f9586[_0x1341('0x15')]));}}else{}}catch(_0x2f5f8c){console[_0x1341('0x25')](_0x2f5f8c);}}}}; \ 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 784219b..904cb5f 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 _0xebf2=['clientId','clientSecret','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','Fields','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','error','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase','lastevent',']\x20Ticket\x20%s\x20created.','request-promise','md5','jsforce','util','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','endUserType','contact','lead','WhoId','WhatId','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','User','find','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','display_name','identity','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','contact_lead','additionalSearchContact','merge','$or','execute','length','cloneDeep','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','Contact','account','first','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','','Caller\x20-\x20%s','No\x20Company','format','upperFirst','create','forEach','includes','string','picklist','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xebf2,0x1a7));var _0x2ebf=function(_0x1e72f5,_0x322bfa){_0x1e72f5=_0x1e72f5-0x0;var _0x4b59e2=_0xebf2[_0x1e72f5];return _0x4b59e2;};'use strict';var _=require('lodash');var rp=require(_0x2ebf('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x2ebf('0x1'));var jsforce=require(_0x2ebf('0x2'));var util=require(_0x2ebf('0x3'));var Redis=require('ioredis');var intUtil=require(_0x2ebf('0x4'));var config=require(_0x2ebf('0x5'));var logger=require(_0x2ebf('0x6'))(_0x2ebf('0x7'));config[_0x2ebf('0x8')]=_[_0x2ebf('0x9')](config[_0x2ebf('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x2ebf('0xa'))(new Redis(config[_0x2ebf('0x8')]));function emit(_0x416a5f,_0x1bfcf2,_0x49ef78){io['to'](_0x416a5f)[_0x2ebf('0xb')](_0x1bfcf2,_0x49ef78);}function getTicket(_0x37aa71,_0x2fb1f7,_0x24be45,_0x24a1ba,_0x5b9061,_0x3d5450,_0x5e09b5,_0x30a6be){var _0x5b6e7d=Object[_0x2ebf('0xc')]({},{'OwnerId':_0x2fb1f7['id'],'Subject':intUtil[_0x2ebf('0xd')](_0x24a1ba[_0x2ebf('0xe')],_0x5b9061,'\x20'),'Description':intUtil[_0x2ebf('0xd')](_0x24a1ba[_0x2ebf('0xf')],_0x5b9061,'\x0a')},getCustomFields(_0x3d5450,_0x5b9061));if(_0x24be45){if(_0x24a1ba[_0x2ebf('0x10')]===_0x2ebf('0x11')){_0x5b6e7d[_0x2ebf('0x12')]=moment[_0x2ebf('0x13')]();_0x5b6e7d[_0x2ebf('0x14')]=![];_0x5b6e7d['IsRecurrence']=![];if(_0x24be45[_0x2ebf('0x15')]===_0x2ebf('0x16')||_0x24be45['endUserType']===_0x2ebf('0x17')){_0x5b6e7d[_0x2ebf('0x18')]=_0x24be45['id'];}else if(_0x24be45[_0x2ebf('0x15')]==='account'){_0x5b6e7d[_0x2ebf('0x19')]=_0x24be45['id'];}}else if(_0x24a1ba[_0x2ebf('0x10')]===_0x2ebf('0x1a')){if(_0x24be45[_0x2ebf('0x15')]===_0x2ebf('0x16')){_0x5b6e7d[_0x2ebf('0x1b')]=_0x24be45['id'];}else if(_0x24be45[_0x2ebf('0x15')]==='account'){_0x5b6e7d[_0x2ebf('0x1c')]=_0x24be45['id'];}else if(_0x24be45[_0x2ebf('0x15')]===_0x2ebf('0x17')&&_0x24a1ba[_0x2ebf('0x1d')]){_0x5b6e7d[_0x24a1ba[_0x2ebf('0x1d')]]=_0x24be45['id'];}else{logger[_0x2ebf('0x1e')](_0x2ebf('0x1f'));}}}return _0x5e09b5[_0x2ebf('0x20')](_0x24a1ba[_0x2ebf('0x10')])['create'](_0x5b6e7d);}function getUser(_0x29d03f,_0x77200e,_0x160ddd){if(!_[_0x2ebf('0x21')](_0x77200e)&&intUtil[_0x2ebf('0x22')](_0x77200e)){var _0x3e8ad4={'Email':_0x77200e};var _0xdeb91f={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x160ddd[_0x2ebf('0x20')](_0x2ebf('0x23'))[_0x2ebf('0x24')](_0x3e8ad4,_0xdeb91f)['execute']()['then'](function(_0x56fed6){if(_0x56fed6['length']){var _0x506027=_[_0x2ebf('0x24')](_0x56fed6,function(_0x20615a){return _0x20615a[_0x2ebf('0x25')]===_0x77200e;});if(_0x506027){logger[_0x2ebf('0x1e')](_0x2ebf('0x26'),_0x77200e);return BPromise[_0x2ebf('0x27')]({'id':_0x506027['Id'],'name':_0x506027[_0x2ebf('0x28')]});}}else{logger[_0x2ebf('0x1e')](_0x2ebf('0x29'),_0x77200e);return _0x160ddd['identity']()[_0x2ebf('0x2a')](function(_0x24cd83){return BPromise[_0x2ebf('0x27')]({'id':_0x24cd83['user_id'],'name':_0x24cd83[_0x2ebf('0x2b')]});});}});}else{logger[_0x2ebf('0x1e')](_0x2ebf('0x29'),_0x77200e);return _0x160ddd[_0x2ebf('0x2c')]()[_0x2ebf('0x2a')](function(_0xf5a279){return BPromise['resolve']({'id':_0xf5a279[_0x2ebf('0x2d')],'name':_0xf5a279['display_name']});});}}function getEndUser(_0x4049df,_0x1b9997,_0x403c5d,_0x5324a6,_0x581b45){var _0x172ec1={'$or':{'Phone':_0x5324a6}};var _0xed8a41={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x2ebf('0x27')]()[_0x2ebf('0x2a')](function(){logger[_0x2ebf('0x1e')](_0x2ebf('0x2e'),_0x5324a6,_0x1b9997['moduleSearch']);switch(_0x1b9997['moduleSearch']){case _0x2ebf('0x2f'):var _0x2ce998=_['cloneDeep'](_0x172ec1);if(_0x1b9997[_0x2ebf('0x30')]){var _0x21a5d4={};_0x21a5d4[_0x1b9997['additionalSearchContact']]=_0x5324a6;_[_0x2ebf('0x31')](_0x2ce998[_0x2ebf('0x32')],_0x21a5d4);}return _0x581b45[_0x2ebf('0x20')]('Contact')['find'](_0x2ce998,_0xed8a41)[_0x2ebf('0x33')]()[_0x2ebf('0x2a')](function(_0x439f3a){if(_0x439f3a&&_0x439f3a[_0x2ebf('0x34')]){return _0x439f3a;}else{var _0x1e5e53=_[_0x2ebf('0x35')](_0x172ec1);if(_0x1b9997[_0x2ebf('0x36')]){var _0x1f896a={};_0x1f896a[_0x1b9997['additionalSearchLead']]=_0x5324a6;_[_0x2ebf('0x31')](_0x1e5e53[_0x2ebf('0x32')],_0x1f896a);}return _0x581b45[_0x2ebf('0x20')](_0x2ebf('0x37'))[_0x2ebf('0x24')](_0x1e5e53,_0xed8a41);}});case _0x2ebf('0x38'):var _0x1c458a=_[_0x2ebf('0x35')](_0x172ec1);if(_0x1b9997[_0x2ebf('0x39')]){var _0x21a5d4={};_0x21a5d4[_0x1b9997[_0x2ebf('0x39')]]=_0x5324a6;_['merge'](_0x1c458a['$or'],_0x21a5d4);}return _0x581b45[_0x2ebf('0x20')](_0x2ebf('0x3a'))[_0x2ebf('0x24')](_0x1c458a,_0xed8a41)[_0x2ebf('0x33')]()[_0x2ebf('0x2a')](function(_0x4afd04){if(_0x4afd04&&_0x4afd04[_0x2ebf('0x34')]){return _0x4afd04;}else{var _0x4c4575=_[_0x2ebf('0x35')](_0x172ec1);if(_0x1b9997[_0x2ebf('0x30')]){var _0x2d5c63={};_0x2d5c63[_0x1b9997['additionalSearchContact']]=_0x5324a6;_[_0x2ebf('0x31')](_0x4c4575[_0x2ebf('0x32')],_0x2d5c63);}return _0x581b45[_0x2ebf('0x20')](_0x2ebf('0x3b'))['find'](_0x4c4575,_0xed8a41)['then'](function(_0x424f6a){if(_0x424f6a&&_0x424f6a['length']){return _0x424f6a;}else{var _0x528fae=_[_0x2ebf('0x35')](_0x172ec1);if(_0x1b9997[_0x2ebf('0x36')]){var _0x13a35b={};_0x13a35b[_0x1b9997[_0x2ebf('0x36')]]=_0x5324a6;_['merge'](_0x528fae['$or'],_0x13a35b);}return _0x581b45[_0x2ebf('0x20')]('Lead')[_0x2ebf('0x24')](_0x528fae,_0xed8a41);}});}});case _0x2ebf('0x16'):var _0x2ce998=_['cloneDeep'](_0x172ec1);if(_0x1b9997[_0x2ebf('0x30')]){var _0x21a5d4={};_0x21a5d4[_0x1b9997[_0x2ebf('0x30')]]=_0x5324a6;_[_0x2ebf('0x31')](_0x2ce998['$or'],_0x21a5d4);}return _0x581b45[_0x2ebf('0x20')](_0x2ebf('0x3b'))[_0x2ebf('0x24')](_0x2ce998,_0xed8a41)[_0x2ebf('0x33')]();case _0x2ebf('0x17'):var _0x5c331b=_['cloneDeep'](_0x172ec1);if(_0x1b9997[_0x2ebf('0x36')]){var _0x21a5d4={};_0x21a5d4[_0x1b9997[_0x2ebf('0x36')]]=_0x5324a6;_[_0x2ebf('0x31')](_0x5c331b[_0x2ebf('0x32')],_0x21a5d4);}return _0x581b45[_0x2ebf('0x20')](_0x2ebf('0x37'))[_0x2ebf('0x24')](_0x5c331b,_0xed8a41);case _0x2ebf('0x3c'):var _0x1c458a=_[_0x2ebf('0x35')](_0x172ec1);if(_0x1b9997[_0x2ebf('0x39')]){var _0x21a5d4={};_0x21a5d4[_0x1b9997['additionalSearchAccount']]=_0x5324a6;_[_0x2ebf('0x31')](_0x1c458a['$or'],_0x21a5d4);}return _0x581b45[_0x2ebf('0x20')](_0x2ebf('0x3a'))[_0x2ebf('0x24')](_0x1c458a,_0xed8a41);default:return null;}})[_0x2ebf('0x2a')](function(_0x3d282d){if(_0x3d282d&&_0x3d282d[_0x2ebf('0x34')]){var _0x24e19c=_[_0x2ebf('0x3d')](_0x3d282d);if(_0x24e19c){return BPromise[_0x2ebf('0x27')]({'id':_0x24e19c['Id'],'name':_0x24e19c[_0x2ebf('0x28')],'phone':_0x24e19c[_0x2ebf('0x3e')],'endUserType':_0x24e19c[_0x2ebf('0x3f')][_0x2ebf('0x40')]['toLowerCase']()});}}})[_0x2ebf('0x2a')](function(_0x45b010){if(_0x45b010){logger['info'](_0x2ebf('0x41'),_0x45b010['endUserType'],_0x5324a6);return BPromise['resolve'](_0x45b010);}else{logger[_0x2ebf('0x1e')](_0x2ebf('0x42'),_0x5324a6);var _0x30bd06={'Phone':_0x5324a6};if(_0x1b9997['moduleCreate']){if(_0x1b9997[_0x2ebf('0x43')]==='contact'){logger[_0x2ebf('0x1e')](_0x2ebf('0x44'),_0x5324a6,_0x1b9997[_0x2ebf('0x43')]);_0x30bd06[_0x2ebf('0x45')]=_0x403c5d!==_0x2ebf('0x46')?_0x403c5d:util['format']('Caller\x20-\x20%s',_0x5324a6);}else if(_0x1b9997[_0x2ebf('0x43')]==='lead'){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x5324a6,_0x1b9997[_0x2ebf('0x43')]);_0x30bd06['LastName']=_0x403c5d!==_0x2ebf('0x46')?_0x403c5d:util['format'](_0x2ebf('0x47'),_0x5324a6);_0x30bd06['Company']=_0x2ebf('0x48');}else if(_0x1b9997[_0x2ebf('0x43')]===_0x2ebf('0x3c')){logger[_0x2ebf('0x1e')](_0x2ebf('0x44'),_0x5324a6,_0x1b9997['moduleCreate']);_0x30bd06['Name']=_0x403c5d!==''?_0x403c5d:util[_0x2ebf('0x49')](_0x2ebf('0x47'),_0x5324a6);}else{return null;}}return _0x581b45[_0x2ebf('0x20')](_[_0x2ebf('0x4a')](_0x1b9997[_0x2ebf('0x43')]))[_0x2ebf('0x4b')](_0x30bd06)[_0x2ebf('0x2a')](function(_0x5252bc){return BPromise[_0x2ebf('0x27')]({'id':_0x5252bc['id'],'endUserType':_0x1b9997[_0x2ebf('0x43')]});});}});}function getCustomFields(_0x1a64e1,_0x1fbaa5){var _0xe909ab={};if(_0x1a64e1[_0x2ebf('0x34')]>0x0){_[_0x2ebf('0x4c')](_0x1a64e1,function(_0x440f05){if(_[_0x2ebf('0x4d')]([_0x2ebf('0x4e'),_0x2ebf('0x4f')],_0x440f05['type'])&&_0x440f05[_0x2ebf('0x50')]){_0xe909ab[_0x440f05[_0x2ebf('0x50')]]=_0x440f05['content'][_0x2ebf('0x51')]();}else if(_0x440f05[_0x2ebf('0x40')]===_0x2ebf('0x52')&&_0x440f05[_0x2ebf('0x53')]&&_0x440f05['idField']){_0x1fbaa5[_0x440f05[_0x2ebf('0x53')]]&&(_0xe909ab[_0x440f05[_0x2ebf('0x50')]]=_0x1fbaa5[_0x440f05[_0x2ebf('0x53')]][_0x2ebf('0x51')]());}else if(_0x440f05[_0x2ebf('0x40')]===_0x2ebf('0x54')&&_0x440f05['Variable']&&_0x440f05[_0x2ebf('0x55')][_0x2ebf('0x56')]&&_0x440f05[_0x2ebf('0x50')]){_0x1fbaa5[_0x440f05[_0x2ebf('0x55')][_0x2ebf('0x56')][_0x2ebf('0x57')]()]&&(_0xe909ab[_0x440f05[_0x2ebf('0x50')]]=_0x1fbaa5[_0x440f05[_0x2ebf('0x55')][_0x2ebf('0x56')][_0x2ebf('0x57')]()][_0x2ebf('0x51')]());}});}return _0xe909ab;}function getConnection(_0x52ae46){var _0x246256=_0x52ae46[_0x2ebf('0x58')][_0x2ebf('0x59')](_0x52ae46[_0x2ebf('0x5a')]);var _0x180162=new jsforce[(_0x2ebf('0x5b'))]({'oauth2':{'loginUrl':_0x52ae46[_0x2ebf('0x5c')]||'https://login.salesforce.com','clientId':_0x52ae46[_0x2ebf('0x5d')],'clientSecret':_0x52ae46[_0x2ebf('0x5e')]}});return _0x180162['login'](_0x52ae46['username'],_0x246256)['then'](function(){logger[_0x2ebf('0x1e')](_0x2ebf('0x5f'));return _0x180162;});}exports[_0x2ebf('0x60')]=function(_0x515cbb,_0x30b05a,_0x401078,_0x93efca,_0x3329df,_0x569fda){var _0x23c2ab,_0x4ab492,_0x3ec6e3,_0x390eeb;_0x569fda[_0x2ebf('0x61')]=intUtil[_0x2ebf('0x62')](_0x569fda['serverUrl']);_0x569fda[_0x2ebf('0x5c')]=intUtil[_0x2ebf('0x62')](_0x569fda['remoteUri']);if(_0x3329df&&_0x3329df[_0x2ebf('0x63')]){logger['info'](_0x2ebf('0x64'),_0x2ebf('0x65'));_0x30b05a[_0x2ebf('0x66')]=util[_0x2ebf('0x49')](_0x2ebf('0x67'),_0x569fda[_0x2ebf('0x61')],_0x30b05a[_0x2ebf('0x68')],md5(_0x30b05a[_0x2ebf('0x68')]));}else{_0x30b05a['recordingURL']='';}return getConnection(_0x569fda)[_0x2ebf('0x2a')](function(_0x3937fa){_0x390eeb=_0x3937fa;return getUser(_0x569fda,_0x93efca[_0x2ebf('0x69')],_0x390eeb);})[_0x2ebf('0x2a')](function(_0x2f86a3){_0x23c2ab=_0x2f86a3;return getEndUser(_0x569fda,_0x401078,_0x30b05a[_0x2ebf('0x6a')],_0x30b05a['calleridnum'],_0x390eeb);})[_0x2ebf('0x2a')](function(_0x295d58){_0x4ab492=_0x295d58;return getTicket(_0x569fda,_0x23c2ab,_0x4ab492,_0x401078,_0x30b05a,_0x401078['Fields'],_0x390eeb,_0x2ebf('0x60'));})[_0x2ebf('0x2a')](function(_0x527a8f){_0x3ec6e3=_0x527a8f;logger[_0x2ebf('0x1e')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x3ec6e3['id']);logger[_0x2ebf('0x1e')](_0x2ebf('0x6b'),_0x3ec6e3['id'],_0x93efca[_0x2ebf('0x56')],_0x569fda[_0x2ebf('0x40')]);switch(_0x569fda[_0x2ebf('0x40')]){case _0x2ebf('0x6c'):emit(util[_0x2ebf('0x49')](_0x2ebf('0x6d'),_0x93efca[_0x2ebf('0x56')]),_0x2ebf('0x6e'),{'recordId':_0x3ec6e3['id']});break;case'newTab':emit(util[_0x2ebf('0x49')](_0x2ebf('0x6d'),_0x93efca[_0x2ebf('0x56')]),_0x2ebf('0x6f'),{'uri':util[_0x2ebf('0x49')](_0x2ebf('0x70'),_0x390eeb[_0x2ebf('0x71')],_0x3ec6e3['id'])});break;default:logger['error'](_0x2ebf('0x72'));}})[_0x2ebf('0x73')](function(_0x1e708c){logger['error'](_0x2ebf('0x64'),_0x1e708c);});};exports[_0x2ebf('0x74')]=function(_0x384b93,_0x4aca55,_0x7f177d,_0x4b1feb,_0x4769f3,_0x4c8f41,_0x3d0e7b){var _0x5df1b2,_0x12cb78,_0x581740,_0x460adb;_0x4c8f41[_0x2ebf('0x61')]=intUtil[_0x2ebf('0x62')](_0x4c8f41['serverUrl']);_0x4c8f41[_0x2ebf('0x5c')]=intUtil[_0x2ebf('0x62')](_0x4c8f41[_0x2ebf('0x5c')]);if(_0x3d0e7b&&_0x3d0e7b[_0x2ebf('0x75')]&&_0x3d0e7b[_0x2ebf('0x75')]!==_0x2ebf('0x76')){logger[_0x2ebf('0x1e')]('[OUTBOUND]',_0x2ebf('0x65'));_0x4aca55[_0x2ebf('0x66')]=util[_0x2ebf('0x49')](_0x2ebf('0x67'),_0x4c8f41[_0x2ebf('0x61')],_0x4aca55[_0x2ebf('0x68')],md5(_0x4aca55[_0x2ebf('0x68')]));}return getConnection(_0x4c8f41)['then'](function(_0x125eb1){_0x460adb=_0x125eb1;return getUser(_0x4c8f41,_0x4b1feb[_0x2ebf('0x69')],_0x460adb);})[_0x2ebf('0x2a')](function(_0x1805ba){_0x5df1b2=_0x1805ba;return getEndUser(_0x4c8f41,_0x7f177d,_0x4aca55['destcalleridname'],_0x4aca55['destcalleridnum'],_0x460adb);})[_0x2ebf('0x2a')](function(_0x9e24b0){_0x12cb78=_0x9e24b0;return getTicket(_0x4c8f41,_0x5df1b2,_0x12cb78,_0x7f177d,_0x4aca55,_0x7f177d[_0x2ebf('0x77')],_0x460adb,'outbound');})['then'](function(_0x1cf8fc){_0x581740=_0x1cf8fc;logger['info']('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x581740['id']);logger[_0x2ebf('0x1e')](_0x2ebf('0x78'),_0x581740['id'],_0x4b1feb[_0x2ebf('0x56')],_0x4c8f41[_0x2ebf('0x40')]);switch(_0x4c8f41['type']){case _0x2ebf('0x6c'):emit(util['format'](_0x2ebf('0x6d'),_0x4b1feb[_0x2ebf('0x56')]),'trigger:salesforce:display',{'recordId':_0x581740['id']});break;case _0x2ebf('0x79'):emit(util['format'](_0x2ebf('0x6d'),_0x4b1feb['name']),_0x2ebf('0x6f'),{'uri':util[_0x2ebf('0x49')](_0x2ebf('0x70'),_0x460adb[_0x2ebf('0x71')],_0x581740['id'])});break;default:logger[_0x2ebf('0x7a')](_0x2ebf('0x7b'),_0x2ebf('0x7c'));}})[_0x2ebf('0x73')](function(_0x43ede2){logger[_0x2ebf('0x7a')]('[OUTBOUND]',_0x43ede2);});};exports[_0x2ebf('0x7d')]=function(_0xd6df05,_0x50465a,_0x3b5443,_0x40e335,_0x25cad7,_0x3b38de){var _0x2dc315,_0xb1106,_0x3cc20c,_0x447eee;_0x3b38de['serverUrl']=intUtil['stripTrailingSlash'](_0x3b38de['serverUrl']);_0x3b38de['remoteUri']=intUtil[_0x2ebf('0x62')](_0x3b38de[_0x2ebf('0x5c')]);if(_0x25cad7&&_0x25cad7['monitor_format']){logger[_0x2ebf('0x1e')]('['+_0x50465a['lastevent'][_0x2ebf('0x7e')]()+']',_0x2ebf('0x65'));_0x50465a[_0x2ebf('0x66')]=util[_0x2ebf('0x49')](_0x2ebf('0x67'),_0x3b38de['serverUrl'],_0x50465a[_0x2ebf('0x68')],md5(_0x50465a['uniqueid']));}else{_0x50465a['recordingURL']='';}return getConnection(_0x3b38de)['then'](function(_0x4bf4c9){_0x447eee=_0x4bf4c9;if(!_['isNil'](_0x40e335)){return getUser(_0x3b38de,_0x40e335[_0x2ebf('0x56')],_0x447eee);}else{return getUser(_0x3b38de,null,_0x447eee);}})['then'](function(_0x18ec1){_0x2dc315=_0x18ec1;return getEndUser(_0x3b38de,_0x3b5443,_0x50465a[_0x2ebf('0x6a')],_0x50465a['calleridnum'],_0x447eee);})[_0x2ebf('0x2a')](function(_0x2c6144){_0xb1106=_0x2c6144;return getTicket(_0x3b38de,_0x2dc315,_0xb1106,_0x3b5443,_0x50465a,_0x3b5443['Fields'],_0x447eee);})[_0x2ebf('0x2a')](function(_0x4fe39b){_0x3cc20c=_0x4fe39b;logger[_0x2ebf('0x1e')]('['+_0x50465a[_0x2ebf('0x7f')][_0x2ebf('0x7e')]()+_0x2ebf('0x80'),_0x3cc20c['id']);logger['info']('['+_0x50465a[_0x2ebf('0x7f')]['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x3b38de['type']);})[_0x2ebf('0x73')](function(_0x4e6595){logger[_0x2ebf('0x7a')]('['+_0x50465a[_0x2ebf('0x7f')][_0x2ebf('0x7e')]()+']',_0x4e6595);});}; \ No newline at end of file +var _0x5f64=['recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','lastevent','toUpperCase','isNil','calleridnum',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','emit','assign','getString','Subjects','ticketType','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhatId','Case','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','validateEmail','User','then','length','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','Contact','find','execute','additionalSearchLead','merge','sobject','Lead','$or','Account','account','additionalSearchAccount','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','idField','content','toString','variable','variableName','customVariable','Variable','name','Connection','remoteUri','clientId','clientSecret','login','username','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','[QUEUE]\x20Ticket\x20%s\x20created','trigger:salesforce:display','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.'];(function(_0x1b0be4,_0x525f3e){var _0x448a22=function(_0x48f2de){while(--_0x48f2de){_0x1b0be4['push'](_0x1b0be4['shift']());}};_0x448a22(++_0x525f3e);}(_0x5f64,0x178));var _0x45f6=function(_0x55daf2,_0x1b48de){_0x55daf2=_0x55daf2-0x0;var _0x1c8500=_0x5f64[_0x55daf2];return _0x1c8500;};'use strict';var _=require(_0x45f6('0x0'));var rp=require(_0x45f6('0x1'));var moment=require(_0x45f6('0x2'));var BPromise=require(_0x45f6('0x3'));var md5=require(_0x45f6('0x4'));var jsforce=require(_0x45f6('0x5'));var util=require(_0x45f6('0x6'));var Redis=require(_0x45f6('0x7'));var intUtil=require('./util');var config=require(_0x45f6('0x8'));var logger=require(_0x45f6('0x9'))(_0x45f6('0xa'));config[_0x45f6('0xb')]=_[_0x45f6('0xc')](config[_0x45f6('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x45f6('0xd'))(new Redis(config[_0x45f6('0xb')]));function emit(_0x333081,_0x374d55,_0x20fb5f){io['to'](_0x333081)[_0x45f6('0xe')](_0x374d55,_0x20fb5f);}function getTicket(_0xc309f7,_0x5adbb7,_0x267cde,_0xb17779,_0x9b2d38,_0x18d365,_0x9cf10d,_0x1eb7cd){var _0x3e9e19=Object[_0x45f6('0xf')]({},{'OwnerId':_0x5adbb7['id'],'Subject':intUtil[_0x45f6('0x10')](_0xb17779[_0x45f6('0x11')],_0x9b2d38,'\x20'),'Description':intUtil['getString'](_0xb17779['Descriptions'],_0x9b2d38,'\x0a')},getCustomFields(_0x18d365,_0x9b2d38));if(_0x267cde){if(_0xb17779[_0x45f6('0x12')]==='Task'){_0x3e9e19[_0x45f6('0x13')]=moment[_0x45f6('0x14')]();_0x3e9e19[_0x45f6('0x15')]=![];_0x3e9e19[_0x45f6('0x16')]=![];if(_0x267cde[_0x45f6('0x17')]===_0x45f6('0x18')||_0x267cde[_0x45f6('0x17')]===_0x45f6('0x19')){_0x3e9e19['WhoId']=_0x267cde['id'];}else if(_0x267cde['endUserType']==='account'){_0x3e9e19[_0x45f6('0x1a')]=_0x267cde['id'];}}else if(_0xb17779['ticketType']===_0x45f6('0x1b')){if(_0x267cde[_0x45f6('0x17')]===_0x45f6('0x18')){_0x3e9e19['ContactId']=_0x267cde['id'];}else if(_0x267cde[_0x45f6('0x17')]==='account'){_0x3e9e19['AccountId']=_0x267cde['id'];}else if(_0x267cde['endUserType']===_0x45f6('0x19')&&_0xb17779[_0x45f6('0x1c')]){_0x3e9e19[_0xb17779[_0x45f6('0x1c')]]=_0x267cde['id'];}else{logger[_0x45f6('0x1d')](_0x45f6('0x1e'));}}}return _0x9cf10d['sobject'](_0xb17779[_0x45f6('0x12')])[_0x45f6('0x1f')](_0x3e9e19);}function getUser(_0xa5221a,_0x67ba80,_0x5760ae){if(!_['isNil'](_0x67ba80)&&intUtil[_0x45f6('0x20')](_0x67ba80)){var _0x2a53ea={'Email':_0x67ba80};var _0x207170={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5760ae['sobject'](_0x45f6('0x21'))['find'](_0x2a53ea,_0x207170)['execute']()[_0x45f6('0x22')](function(_0x378753){if(_0x378753[_0x45f6('0x23')]){var _0x39d7c1=_['find'](_0x378753,function(_0x52c6a1){return _0x52c6a1['Email']===_0x67ba80;});if(_0x39d7c1){logger[_0x45f6('0x1d')]('Agent\x20%s\x20found.',_0x67ba80);return BPromise['resolve']({'id':_0x39d7c1['Id'],'name':_0x39d7c1[_0x45f6('0x24')]});}}else{logger[_0x45f6('0x1d')](_0x45f6('0x25'),_0x67ba80);return _0x5760ae[_0x45f6('0x26')]()[_0x45f6('0x22')](function(_0x5ec55b){return BPromise[_0x45f6('0x27')]({'id':_0x5ec55b[_0x45f6('0x28')],'name':_0x5ec55b[_0x45f6('0x29')]});});}});}else{logger[_0x45f6('0x1d')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x67ba80);return _0x5760ae[_0x45f6('0x26')]()[_0x45f6('0x22')](function(_0x560482){return BPromise[_0x45f6('0x27')]({'id':_0x560482[_0x45f6('0x28')],'name':_0x560482[_0x45f6('0x29')]});});}}function getEndUser(_0x595df0,_0x51f7f1,_0x5d99c2,_0x24b33a,_0x153a85){var _0x2f5e36={'$or':{'Phone':_0x24b33a}};var _0x49ac91={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x45f6('0x27')]()['then'](function(){logger[_0x45f6('0x1d')](_0x45f6('0x2a'),_0x24b33a,_0x51f7f1['moduleSearch']);switch(_0x51f7f1[_0x45f6('0x2b')]){case'contact_lead':var _0x4a757d=_[_0x45f6('0x2c')](_0x2f5e36);if(_0x51f7f1[_0x45f6('0x2d')]){var _0x14176f={};_0x14176f[_0x51f7f1[_0x45f6('0x2d')]]=_0x24b33a;_['merge'](_0x4a757d['$or'],_0x14176f);}return _0x153a85['sobject'](_0x45f6('0x2e'))[_0x45f6('0x2f')](_0x4a757d,_0x49ac91)[_0x45f6('0x30')]()[_0x45f6('0x22')](function(_0x124158){if(_0x124158&&_0x124158[_0x45f6('0x23')]){return _0x124158;}else{var _0x3fa5cf=_[_0x45f6('0x2c')](_0x2f5e36);if(_0x51f7f1['additionalSearchLead']){var _0x109603={};_0x109603[_0x51f7f1[_0x45f6('0x31')]]=_0x24b33a;_[_0x45f6('0x32')](_0x3fa5cf['$or'],_0x109603);}return _0x153a85[_0x45f6('0x33')](_0x45f6('0x34'))[_0x45f6('0x2f')](_0x3fa5cf,_0x49ac91);}});case'account_contact_lead':var _0x32486b=_['cloneDeep'](_0x2f5e36);if(_0x51f7f1['additionalSearchAccount']){var _0x14176f={};_0x14176f[_0x51f7f1['additionalSearchAccount']]=_0x24b33a;_[_0x45f6('0x32')](_0x32486b[_0x45f6('0x35')],_0x14176f);}return _0x153a85[_0x45f6('0x33')](_0x45f6('0x36'))['find'](_0x32486b,_0x49ac91)[_0x45f6('0x30')]()['then'](function(_0x577990){if(_0x577990&&_0x577990[_0x45f6('0x23')]){return _0x577990;}else{var _0x4b9f70=_['cloneDeep'](_0x2f5e36);if(_0x51f7f1[_0x45f6('0x2d')]){var _0x46e34b={};_0x46e34b[_0x51f7f1[_0x45f6('0x2d')]]=_0x24b33a;_[_0x45f6('0x32')](_0x4b9f70[_0x45f6('0x35')],_0x46e34b);}return _0x153a85['sobject'](_0x45f6('0x2e'))[_0x45f6('0x2f')](_0x4b9f70,_0x49ac91)[_0x45f6('0x22')](function(_0x2ddf50){if(_0x2ddf50&&_0x2ddf50[_0x45f6('0x23')]){return _0x2ddf50;}else{var _0x5ed8a7=_[_0x45f6('0x2c')](_0x2f5e36);if(_0x51f7f1[_0x45f6('0x31')]){var _0x3a80a3={};_0x3a80a3[_0x51f7f1[_0x45f6('0x31')]]=_0x24b33a;_[_0x45f6('0x32')](_0x5ed8a7[_0x45f6('0x35')],_0x3a80a3);}return _0x153a85[_0x45f6('0x33')](_0x45f6('0x34'))['find'](_0x5ed8a7,_0x49ac91);}});}});case'contact':var _0x4a757d=_[_0x45f6('0x2c')](_0x2f5e36);if(_0x51f7f1[_0x45f6('0x2d')]){var _0x14176f={};_0x14176f[_0x51f7f1[_0x45f6('0x2d')]]=_0x24b33a;_[_0x45f6('0x32')](_0x4a757d[_0x45f6('0x35')],_0x14176f);}return _0x153a85[_0x45f6('0x33')](_0x45f6('0x2e'))[_0x45f6('0x2f')](_0x4a757d,_0x49ac91)['execute']();case _0x45f6('0x19'):var _0x232bb0=_[_0x45f6('0x2c')](_0x2f5e36);if(_0x51f7f1[_0x45f6('0x31')]){var _0x14176f={};_0x14176f[_0x51f7f1[_0x45f6('0x31')]]=_0x24b33a;_[_0x45f6('0x32')](_0x232bb0['$or'],_0x14176f);}return _0x153a85[_0x45f6('0x33')](_0x45f6('0x34'))['find'](_0x232bb0,_0x49ac91);case _0x45f6('0x37'):var _0x32486b=_[_0x45f6('0x2c')](_0x2f5e36);if(_0x51f7f1[_0x45f6('0x38')]){var _0x14176f={};_0x14176f[_0x51f7f1[_0x45f6('0x38')]]=_0x24b33a;_[_0x45f6('0x32')](_0x32486b[_0x45f6('0x35')],_0x14176f);}return _0x153a85[_0x45f6('0x33')](_0x45f6('0x36'))[_0x45f6('0x2f')](_0x32486b,_0x49ac91);default:return null;}})[_0x45f6('0x22')](function(_0x10a928){if(_0x10a928&&_0x10a928['length']){var _0xa3d518=_[_0x45f6('0x39')](_0x10a928);if(_0xa3d518){return BPromise[_0x45f6('0x27')]({'id':_0xa3d518['Id'],'name':_0xa3d518[_0x45f6('0x24')],'phone':_0xa3d518[_0x45f6('0x3a')],'endUserType':_0xa3d518[_0x45f6('0x3b')][_0x45f6('0x3c')][_0x45f6('0x3d')]()});}}})[_0x45f6('0x22')](function(_0x371695){if(_0x371695){logger[_0x45f6('0x1d')](_0x45f6('0x3e'),_0x371695[_0x45f6('0x17')],_0x24b33a);return BPromise[_0x45f6('0x27')](_0x371695);}else{logger[_0x45f6('0x1d')](_0x45f6('0x3f'),_0x24b33a);var _0x51308b={'Phone':_0x24b33a};if(_0x51f7f1[_0x45f6('0x40')]){if(_0x51f7f1[_0x45f6('0x40')]==='contact'){logger[_0x45f6('0x1d')](_0x45f6('0x41'),_0x24b33a,_0x51f7f1[_0x45f6('0x40')]);_0x51308b['LastName']=_0x5d99c2!==_0x45f6('0x42')?_0x5d99c2:util[_0x45f6('0x43')](_0x45f6('0x44'),_0x24b33a);}else if(_0x51f7f1[_0x45f6('0x40')]===_0x45f6('0x19')){logger['info'](_0x45f6('0x41'),_0x24b33a,_0x51f7f1['moduleCreate']);_0x51308b['LastName']=_0x5d99c2!==''?_0x5d99c2:util[_0x45f6('0x43')](_0x45f6('0x44'),_0x24b33a);_0x51308b[_0x45f6('0x45')]=_0x45f6('0x46');}else if(_0x51f7f1[_0x45f6('0x40')]===_0x45f6('0x37')){logger[_0x45f6('0x1d')](_0x45f6('0x41'),_0x24b33a,_0x51f7f1[_0x45f6('0x40')]);_0x51308b[_0x45f6('0x24')]=_0x5d99c2!==_0x45f6('0x42')?_0x5d99c2:util['format'](_0x45f6('0x44'),_0x24b33a);}else{return null;}}return _0x153a85[_0x45f6('0x33')](_[_0x45f6('0x47')](_0x51f7f1[_0x45f6('0x40')]))[_0x45f6('0x1f')](_0x51308b)[_0x45f6('0x22')](function(_0x2cc8be){return BPromise[_0x45f6('0x27')]({'id':_0x2cc8be['id'],'endUserType':_0x51f7f1[_0x45f6('0x40')]});});}});}function getCustomFields(_0x278493,_0x49730d){var _0x45903f={};if(_0x278493['length']>0x0){_['forEach'](_0x278493,function(_0x32d2a6){if(_['includes'](['string','picklist'],_0x32d2a6[_0x45f6('0x3c')])&&_0x32d2a6[_0x45f6('0x48')]){_0x45903f[_0x32d2a6[_0x45f6('0x48')]]=_0x32d2a6[_0x45f6('0x49')][_0x45f6('0x4a')]();}else if(_0x32d2a6[_0x45f6('0x3c')]===_0x45f6('0x4b')&&_0x32d2a6[_0x45f6('0x4c')]&&_0x32d2a6[_0x45f6('0x48')]){_0x49730d[_0x32d2a6[_0x45f6('0x4c')]]&&(_0x45903f[_0x32d2a6[_0x45f6('0x48')]]=_0x49730d[_0x32d2a6[_0x45f6('0x4c')]][_0x45f6('0x4a')]());}else if(_0x32d2a6[_0x45f6('0x3c')]===_0x45f6('0x4d')&&_0x32d2a6[_0x45f6('0x4e')]&&_0x32d2a6[_0x45f6('0x4e')]['name']&&_0x32d2a6[_0x45f6('0x48')]){_0x49730d[_0x32d2a6[_0x45f6('0x4e')]['name']['toLowerCase']()]&&(_0x45903f[_0x32d2a6[_0x45f6('0x48')]]=_0x49730d[_0x32d2a6[_0x45f6('0x4e')][_0x45f6('0x4f')][_0x45f6('0x3d')]()][_0x45f6('0x4a')]());}});}return _0x45903f;}function getConnection(_0x1e1550){var _0x3c5c80=_0x1e1550['password']['concat'](_0x1e1550['securityToken']);var _0x4ef453=new jsforce[(_0x45f6('0x50'))]({'oauth2':{'loginUrl':_0x1e1550[_0x45f6('0x51')]||'https://login.salesforce.com','clientId':_0x1e1550[_0x45f6('0x52')],'clientSecret':_0x1e1550[_0x45f6('0x53')]}});return _0x4ef453[_0x45f6('0x54')](_0x1e1550[_0x45f6('0x55')],_0x3c5c80)['then'](function(){logger['info']('Connection\x20established.');return _0x4ef453;});}exports[_0x45f6('0x56')]=function(_0x32597d,_0x4fc40c,_0x4e5fac,_0x1646ca,_0x3a6ead,_0x4254ff){var _0x44270b,_0xf9d8ff,_0x40c355,_0x4e61db;_0x4254ff['serverUrl']=intUtil[_0x45f6('0x57')](_0x4254ff[_0x45f6('0x58')]);_0x4254ff['remoteUri']=intUtil[_0x45f6('0x57')](_0x4254ff[_0x45f6('0x51')]);if(_0x3a6ead&&_0x3a6ead['monitor_format']){logger[_0x45f6('0x1d')](_0x45f6('0x59'),_0x45f6('0x5a'));_0x4fc40c[_0x45f6('0x5b')]=util[_0x45f6('0x43')](_0x45f6('0x5c'),_0x4254ff[_0x45f6('0x58')],_0x4fc40c[_0x45f6('0x5d')],md5(_0x4fc40c['uniqueid']));}else{_0x4fc40c[_0x45f6('0x5b')]='';}return getConnection(_0x4254ff)[_0x45f6('0x22')](function(_0x193654){_0x4e61db=_0x193654;return getUser(_0x4254ff,_0x1646ca[_0x45f6('0x5e')],_0x4e61db);})[_0x45f6('0x22')](function(_0x372d09){_0x44270b=_0x372d09;return getEndUser(_0x4254ff,_0x4e5fac,_0x4fc40c[_0x45f6('0x5f')],_0x4fc40c['calleridnum'],_0x4e61db);})['then'](function(_0x2fc1c7){_0xf9d8ff=_0x2fc1c7;return getTicket(_0x4254ff,_0x44270b,_0xf9d8ff,_0x4e5fac,_0x4fc40c,_0x4e5fac['Fields'],_0x4e61db,_0x45f6('0x56'));})['then'](function(_0x5aa53d){_0x40c355=_0x5aa53d;logger[_0x45f6('0x1d')](_0x45f6('0x60'),_0x40c355['id']);logger['info']('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x40c355['id'],_0x1646ca[_0x45f6('0x4f')],_0x4254ff[_0x45f6('0x3c')]);switch(_0x4254ff[_0x45f6('0x3c')]){case'integrationTab':emit(util[_0x45f6('0x43')]('user:%s',_0x1646ca[_0x45f6('0x4f')]),_0x45f6('0x61'),{'recordId':_0x40c355['id']});break;case'newTab':emit(util[_0x45f6('0x43')](_0x45f6('0x62'),_0x1646ca['name']),_0x45f6('0x63'),{'uri':util['format'](_0x45f6('0x64'),_0x4e61db[_0x45f6('0x65')],_0x40c355['id'])});break;default:logger[_0x45f6('0x66')](_0x45f6('0x67'));}})['catch'](function(_0x2bd7c1){logger[_0x45f6('0x66')](_0x45f6('0x59'),_0x2bd7c1);});};exports['outbound']=function(_0x3a4e42,_0xfd6b32,_0x50dc83,_0x3ffd02,_0x53c20b,_0x5aeb28,_0x183114){var _0x3aeb8c,_0x39bc87,_0x3dc31d,_0x56cc1d;_0x5aeb28[_0x45f6('0x58')]=intUtil[_0x45f6('0x57')](_0x5aeb28[_0x45f6('0x58')]);_0x5aeb28[_0x45f6('0x51')]=intUtil[_0x45f6('0x57')](_0x5aeb28[_0x45f6('0x51')]);if(_0x183114&&_0x183114[_0x45f6('0x68')]&&_0x183114['recordingFormat']!==_0x45f6('0x69')){logger[_0x45f6('0x1d')](_0x45f6('0x6a'),_0x45f6('0x5a'));_0xfd6b32[_0x45f6('0x5b')]=util[_0x45f6('0x43')](_0x45f6('0x5c'),_0x5aeb28['serverUrl'],_0xfd6b32[_0x45f6('0x5d')],md5(_0xfd6b32['uniqueid']));}return getConnection(_0x5aeb28)[_0x45f6('0x22')](function(_0x3a1298){_0x56cc1d=_0x3a1298;return getUser(_0x5aeb28,_0x3ffd02['email'],_0x56cc1d);})[_0x45f6('0x22')](function(_0x54c376){_0x3aeb8c=_0x54c376;return getEndUser(_0x5aeb28,_0x50dc83,_0xfd6b32[_0x45f6('0x6b')],_0xfd6b32[_0x45f6('0x6c')],_0x56cc1d);})[_0x45f6('0x22')](function(_0x27dcee){_0x39bc87=_0x27dcee;return getTicket(_0x5aeb28,_0x3aeb8c,_0x39bc87,_0x50dc83,_0xfd6b32,_0x50dc83['Fields'],_0x56cc1d,_0x45f6('0x6d'));})['then'](function(_0x29bc8e){_0x3dc31d=_0x29bc8e;logger[_0x45f6('0x1d')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x3dc31d['id']);logger[_0x45f6('0x1d')](_0x45f6('0x6e'),_0x3dc31d['id'],_0x3ffd02[_0x45f6('0x4f')],_0x5aeb28['type']);switch(_0x5aeb28[_0x45f6('0x3c')]){case _0x45f6('0x6f'):emit(util[_0x45f6('0x43')](_0x45f6('0x62'),_0x3ffd02['name']),'trigger:salesforce:display',{'recordId':_0x3dc31d['id']});break;case'newTab':emit(util['format'](_0x45f6('0x62'),_0x3ffd02['name']),_0x45f6('0x63'),{'uri':util['format'](_0x45f6('0x64'),_0x56cc1d[_0x45f6('0x65')],_0x3dc31d['id'])});break;default:logger[_0x45f6('0x66')](_0x45f6('0x6a'),_0x45f6('0x70'));}})[_0x45f6('0x71')](function(_0x898c06){logger[_0x45f6('0x66')](_0x45f6('0x6a'),_0x898c06);});};exports[_0x45f6('0x72')]=function(_0x39440a,_0x330559,_0x2ec456,_0x4355fc,_0x430e3b,_0x10b4d4){var _0x50081f,_0x3ab722,_0x350466,_0x534a76;_0x10b4d4[_0x45f6('0x58')]=intUtil[_0x45f6('0x57')](_0x10b4d4[_0x45f6('0x58')]);_0x10b4d4[_0x45f6('0x51')]=intUtil['stripTrailingSlash'](_0x10b4d4[_0x45f6('0x51')]);if(_0x430e3b&&_0x430e3b['monitor_format']){logger[_0x45f6('0x1d')]('['+_0x330559[_0x45f6('0x73')][_0x45f6('0x74')]()+']',_0x45f6('0x5a'));_0x330559[_0x45f6('0x5b')]=util[_0x45f6('0x43')](_0x45f6('0x5c'),_0x10b4d4[_0x45f6('0x58')],_0x330559[_0x45f6('0x5d')],md5(_0x330559['uniqueid']));}else{_0x330559['recordingURL']='';}return getConnection(_0x10b4d4)[_0x45f6('0x22')](function(_0x383d1b){_0x534a76=_0x383d1b;if(!_[_0x45f6('0x75')](_0x4355fc)){return getUser(_0x10b4d4,_0x4355fc[_0x45f6('0x4f')],_0x534a76);}else{return getUser(_0x10b4d4,null,_0x534a76);}})[_0x45f6('0x22')](function(_0x2debaf){_0x50081f=_0x2debaf;return getEndUser(_0x10b4d4,_0x2ec456,_0x330559[_0x45f6('0x5f')],_0x330559[_0x45f6('0x76')],_0x534a76);})[_0x45f6('0x22')](function(_0x48ae18){_0x3ab722=_0x48ae18;return getTicket(_0x10b4d4,_0x50081f,_0x3ab722,_0x2ec456,_0x330559,_0x2ec456['Fields'],_0x534a76);})[_0x45f6('0x22')](function(_0x2f73cf){_0x350466=_0x2f73cf;logger[_0x45f6('0x1d')]('['+_0x330559[_0x45f6('0x73')][_0x45f6('0x74')]()+']\x20Ticket\x20%s\x20created.',_0x350466['id']);logger[_0x45f6('0x1d')]('['+_0x330559['lastevent'][_0x45f6('0x74')]()+_0x45f6('0x77'),_0x10b4d4[_0x45f6('0x3c')]);})[_0x45f6('0x71')](function(_0x58805f){logger[_0x45f6('0x66')]('['+_0x330559['lastevent'][_0x45f6('0x74')]()+']',_0x58805f);});}; \ 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 ee88a3c..02f3ccd 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 _0xfa21=['email','destcalleridnum','callDirection','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','lodash','request-promise','md5','ioredis','./util','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','],\x20getAdminUser\x20crm','error','toUpperCase','message','info','],\x20getUser\x20input\x20crm','userEmail','],\x20getUser\x20rp\x20obj','active','true','userId','sys_id','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','POST','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','catch','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','push','all',']\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','format','user:%s','emit','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl'];(function(_0x4e49dd,_0xda8495){var _0x4c6300=function(_0x401b4c){while(--_0x401b4c){_0x4e49dd['push'](_0x4e49dd['shift']());}};_0x4c6300(++_0xda8495);}(_0xfa21,0xe6));var _0x1fa2=function(_0x587f4b,_0x223d12){_0x587f4b=_0x587f4b-0x0;var _0x135f1d=_0xfa21[_0x587f4b];return _0x135f1d;};'use strict';var _=require(_0x1fa2('0x0'));var Promise=require('bluebird');var rp=require(_0x1fa2('0x1'));var util=require('util');var md5=require(_0x1fa2('0x2'));var Redis=require(_0x1fa2('0x3'));var intUtil=require(_0x1fa2('0x4'));var config=require('../../../../config/environment');var logger=require(_0x1fa2('0x5'))(_0x1fa2('0x6'));config[_0x1fa2('0x7')]=_[_0x1fa2('0x8')](config[_0x1fa2('0x7')],{'host':_0x1fa2('0x9'),'port':0x18eb});var io=require(_0x1fa2('0xa'))(new Redis(config[_0x1fa2('0x7')]));function getAdminUser(_0x55cd3a,_0x20f4d1,_0x120da8,_0x576760,_0x3b0194,_0x5cde41){return new Promise(function(_0x2c8f5c,_0xb5ebbf){var _0x3f5f04={'method':_0x1fa2('0xb'),'uri':_0x576760+_0x1fa2('0xc')+'&'+_0x3b0194+'&'+_0x5cde41,'auth':_0x20f4d1,'json':!![]};return rp(_0x3f5f04)[_0x1fa2('0xd')](function(_0x469cbd){if(_0x469cbd[_0x1fa2('0xe')][_0x1fa2('0xf')]>0x0){_0x120da8[_0x1fa2('0x10')]=_0x469cbd[_0x1fa2('0xe')][0x0]['sys_id'];}logger['info']('['+[_0x55cd3a['toUpperCase']()]+_0x1fa2('0x11'),_0x120da8);_0x2c8f5c(_0x120da8);})['catch'](function(_0x5502b5){logger[_0x1fa2('0x12')]('['+[_0x55cd3a[_0x1fa2('0x13')]()]+']',_0x5502b5[_0x1fa2('0x14')]);_0xb5ebbf(_0x5502b5[_0x1fa2('0x14')]);});});}function getUser(_0x30fe7c,_0x386729,_0x29fdcc,_0x3968a2,_0x412ce0){return function(_0x47c0a2){logger[_0x1fa2('0x15')]('['+[_0x30fe7c[_0x1fa2('0x13')]()]+_0x1fa2('0x16'),_0x47c0a2);return new Promise(function(_0x5eb334,_0x472fcd){if(intUtil['validateEmail'](_0x47c0a2['userEmail'])){var _0x5959ce={'method':_0x1fa2('0xb'),'uri':_0x29fdcc+'sys_user?sysparm_query=email%3D'+_0x47c0a2[_0x1fa2('0x17')]+'&'+_0x3968a2+'&'+_0x412ce0,'auth':_0x386729,'json':!![]};logger['info']('['+[_0x30fe7c[_0x1fa2('0x13')]()]+_0x1fa2('0x18'),_0x5959ce);return rp(_0x5959ce)[_0x1fa2('0xd')](function(_0x3030ad){logger['info']('['+[_0x30fe7c[_0x1fa2('0x13')]()]+'],\x20getUser\x20entity',_0x3030ad);if(_0x3030ad[_0x1fa2('0xe')]['length']>0x0&&String(_0x3030ad[_0x1fa2('0xe')][0x0][_0x1fa2('0x19')])===_0x1fa2('0x1a')){_0x47c0a2[_0x1fa2('0x1b')]=_0x3030ad[_0x1fa2('0xe')][0x0][_0x1fa2('0x1c')];}else{_0x47c0a2[_0x1fa2('0x1b')]=_0x47c0a2[_0x1fa2('0x10')];_0x47c0a2[_0x1fa2('0x17')]=_0x47c0a2[_0x1fa2('0x1d')];}logger['info']('['+[_0x30fe7c[_0x1fa2('0x13')]()]+_0x1fa2('0x1e'),_0x47c0a2);_0x5eb334(_0x47c0a2);})['catch'](function(_0x778621){logger[_0x1fa2('0x12')]('['+[_0x30fe7c[_0x1fa2('0x13')]()]+']',_0x778621[_0x1fa2('0x14')]);_0x472fcd(_0x778621[_0x1fa2('0x14')]);});}else{logger['info']('['+[_0x30fe7c['toUpperCase']()]+_0x1fa2('0x1f'));_0x47c0a2[_0x1fa2('0x1b')]=_0x47c0a2[_0x1fa2('0x10')];_0x47c0a2[_0x1fa2('0x17')]=_0x47c0a2[_0x1fa2('0x1d')];_0x5eb334(_0x47c0a2);}});};}function createEndUser(_0x519b2d,_0x2eae5f,_0x29edd9,_0x59cb09,_0x14ec97){logger[_0x1fa2('0x15')]('['+[_0x519b2d['toUpperCase']()]+'],\x20createEndUser\x20input\x20crm',_0x29edd9);return new Promise(function(_0x232eb2,_0x655a1){var _0x5f11fa={'method':_0x1fa2('0x20'),'uri':_0x59cb09+'sys_user?'+_0x14ec97,'body':{'user_name':_0x29edd9[_0x1fa2('0x21')],'roles':_0x1fa2('0x22'),'first_name':_0x29edd9[_0x1fa2('0x21')],'active':'true','date_format':_0x1fa2('0x23'),'phone':_0x29edd9[_0x1fa2('0x21')]},'auth':_0x2eae5f,'json':!![]};return rp(_0x5f11fa)['then'](function(_0x2fee29){logger[_0x1fa2('0x15')]('['+[_0x519b2d[_0x1fa2('0x13')]()]+_0x1fa2('0x24'),_0x2fee29[_0x1fa2('0xe')]);_0x29edd9[_0x1fa2('0x25')]=_0x2fee29[_0x1fa2('0xe')][_0x1fa2('0x1c')];_0x232eb2(_0x29edd9);})[_0x1fa2('0x26')](function(_0x1a122c){logger[_0x1fa2('0x12')]('['+[_0x519b2d[_0x1fa2('0x13')]()]+']',_0x1a122c[_0x1fa2('0x14')]);_0x655a1(_0x1a122c['message']);});});}function getEndUser(_0x5e724e,_0xe42555,_0x7f68da,_0x388295,_0x48f8d1){return function(_0x1e79f7){logger[_0x1fa2('0x15')]('['+[_0x5e724e[_0x1fa2('0x13')]()]+_0x1fa2('0x27'),_0x1e79f7);return new Promise(function(_0x3567cb,_0x3902e9){var _0x454aca={'method':'GET','uri':_0x7f68da+'sys_user?sysparm_query=phone%3D'+_0x1e79f7['endUserNumber']+'&'+_0x388295+'&'+_0x48f8d1,'auth':_0xe42555,'json':!![]};return rp(_0x454aca)[_0x1fa2('0xd')](function(_0x141a55){if(_0x141a55['result'][_0x1fa2('0xf')]>0x0){_0x1e79f7[_0x1fa2('0x25')]=_0x141a55['result'][0x0][_0x1fa2('0x1c')];logger[_0x1fa2('0x15')]('['+[_0x5e724e['toUpperCase']()]+_0x1fa2('0x28'),_0x1e79f7);_0x3567cb(_0x1e79f7);}else{return createEndUser(_0x5e724e,_0xe42555,_0x1e79f7,_0x7f68da,_0x388295)[_0x1fa2('0xd')](function(_0x177fd4){logger['info']('['+[_0x5e724e['toUpperCase']()]+'],\x20createEndUser\x20crm',_0x177fd4);_0x3567cb(_0x177fd4);});}})[_0x1fa2('0x26')](function(_0x1283a5){logger[_0x1fa2('0x12')]('['+[_0x5e724e['toUpperCase']()]+']',_0x1283a5[_0x1fa2('0x14')]);_0x3902e9(_0x1283a5[_0x1fa2('0x14')]);});});};}function getCustomFields(_0x1f8d9f,_0x7544df){var _0x517e7e={};if(_0x1f8d9f[_0x1fa2('0xf')]>0x0){_[_0x1fa2('0x29')](_0x1f8d9f,function(_0x5a9632){if(_[_0x1fa2('0x2a')](['string',_0x1fa2('0x2b')],_0x5a9632[_0x1fa2('0x2c')])&&_0x5a9632[_0x1fa2('0x2d')]&&!_0x5a9632[_0x1fa2('0x2e')]){_0x517e7e[_0x5a9632[_0x1fa2('0x2d')][_0x1fa2('0x2f')]()]=_0x5a9632[_0x1fa2('0x30')][_0x1fa2('0x31')]();}else if(_[_0x1fa2('0x2a')](['string',_0x1fa2('0x2b')],_0x5a9632[_0x1fa2('0x2c')])&&_0x5a9632[_0x1fa2('0x32')]&&_0x5a9632['customField']){_0x517e7e[_0x5a9632[_0x1fa2('0x32')]['toLowerCase']()]=_0x5a9632[_0x1fa2('0x30')][_0x1fa2('0x31')]();}else if(_0x5a9632[_0x1fa2('0x2c')]==='variable'&&_0x5a9632[_0x1fa2('0x33')]&&_0x5a9632[_0x1fa2('0x32')]&&_0x5a9632[_0x1fa2('0x2e')]){_0x517e7e[_0x5a9632['idField'][_0x1fa2('0x2f')]()]=_0x7544df[_0x5a9632[_0x1fa2('0x33')]][_0x1fa2('0x31')]();}else if(_0x5a9632[_0x1fa2('0x2c')]===_0x1fa2('0x34')&&_0x5a9632[_0x1fa2('0x35')]&&_0x5a9632['Variable'][_0x1fa2('0x36')]&&_0x5a9632['idField']&&_0x5a9632['customField']){_0x517e7e[_0x5a9632[_0x1fa2('0x32')]['toLowerCase']()]=_0x7544df[_0x5a9632[_0x1fa2('0x35')][_0x1fa2('0x36')][_0x1fa2('0x2f')]()][_0x1fa2('0x31')]();}});}return _0x517e7e;}function getTicket(_0x12ccde,_0xcc944b,_0x3cede1,_0x203b38,_0x23b50d,_0x30a253){return function(_0x50ce96){logger[_0x1fa2('0x15')]('['+[_0x12ccde[_0x1fa2('0x13')]()]+_0x1fa2('0x37'),_0x50ce96);return new Promise(function(_0x47a2c8,_0xd65ba6){var _0x64cc4f=_0x12ccde[_0x1fa2('0x2f')]()==='outbound'?_0x50ce96[_0x1fa2('0x1b')]:_0x50ce96[_0x1fa2('0x25')];var _0x10fe17={'method':_0x1fa2('0x20'),'uri':_0x3cede1+_0x1fa2('0x38')+'?'+_0x30a253,'body':Object[_0x1fa2('0x39')]({},{'active':'true','caller_id':_0x64cc4f,'assigned_to':_0x50ce96[_0x1fa2('0x1b')],'short_description':intUtil[_0x1fa2('0x3a')](_0x203b38['Subjects'],_0x23b50d,'\x20'),'description':intUtil[_0x1fa2('0x3a')](_0x203b38[_0x1fa2('0x3b')],_0x23b50d,'\x0a')},getCustomFields(_0x203b38[_0x1fa2('0x3c')],_0x23b50d)),'auth':_0xcc944b,'json':!![]};return rp(_0x10fe17)[_0x1fa2('0xd')](function(_0x5eaa79){logger[_0x1fa2('0x15')]('['+[_0x12ccde[_0x1fa2('0x13')]()]+_0x1fa2('0x3d'),_0x5eaa79['result']);_0x50ce96[_0x1fa2('0x3e')]=_0x5eaa79[_0x1fa2('0xe')][_0x1fa2('0x1c')];_0x50ce96[_0x1fa2('0x3f')]=_0x5eaa79[_0x1fa2('0xe')][_0x1fa2('0x40')];logger[_0x1fa2('0x15')]('['+[_0x12ccde['toUpperCase']()]+_0x1fa2('0x41'),_0x50ce96);_0x47a2c8(_0x50ce96);})[_0x1fa2('0x26')](function(_0x4a22c1){logger['error']('['+[_0x12ccde['toUpperCase']()]+']',_0x4a22c1[_0x1fa2('0x14')]);_0xd65ba6(_0x4a22c1[_0x1fa2('0x14')]);});});};}function createRemoteTag(_0x189db5,_0x5c946c,_0x1eecc3,_0x304951){return new Promise(function(_0x1cf66a,_0x3a2f72){var _0x1d0d51={'method':'POST','uri':_0x1eecc3+_0x1fa2('0x42')+'?'+_0x304951,'body':{'short_description':_0x189db5,'global':!![],'active':!![],'name':_0x189db5},'auth':_0x5c946c,'json':!![]};return rp(_0x1d0d51)[_0x1fa2('0xd')](function(_0x45f278){var _0xa21d44=_0x45f278[_0x1fa2('0xe')][_0x1fa2('0x1c')];_0x1cf66a(_0xa21d44);});});}function getRemoteTag(_0x142dd6,_0x4e0b12,_0xe1466c,_0x26b87e,_0x4e63ea){return new Promise(function(_0x58feee,_0x194a6e){var _0x11b6f0={'method':_0x1fa2('0xb'),'uri':_0xe1466c+'label'+_0x1fa2('0x43')+_0x142dd6+'&'+_0x26b87e,'auth':_0x4e0b12,'json':!![]};return rp(_0x11b6f0)[_0x1fa2('0xd')](function(_0x373788){if(_0x373788[_0x1fa2('0xe')][_0x1fa2('0xf')]>0x0){var _0x56a1c7=_0x373788['result'][0x0][_0x1fa2('0x1c')];_0x58feee(_0x56a1c7);}else{return createRemoteTag(_0x142dd6,_0x4e0b12,_0xe1466c,_0x26b87e)[_0x1fa2('0xd')](function(_0x10987a){_0x58feee(_0x10987a);});}});});}function assignTagToIncident(_0x5f58e9,_0x5ab98a,_0x12e0b6,_0x163abb,_0x2323b2){return new Promise(function(_0x3da647,_0x4cbe6f){var _0x19fe76={'method':_0x1fa2('0x20'),'uri':_0x12e0b6+_0x1fa2('0x44')+'?'+_0x2323b2,'body':{'label':_0x5f58e9,'table':'incident','id_type':'Incident','table_key':_0x163abb[_0x1fa2('0x3e')],'title':'Incident\x20-\x20'+_0x163abb['ticketNumber'],'id_display':_0x163abb[_0x1fa2('0x3f')]},'auth':_0x5ab98a,'json':!![]};return rp(_0x19fe76)[_0x1fa2('0xd')](function(_0x23423f){_0x3da647();})[_0x1fa2('0x26')](function(){_0x3da647();});});}function manageTags(_0xee7c8f,_0x1674f7,_0x4f76cb,_0x2ff266,_0x39e2c4,_0x32cb27,_0x125102){return new Promise(function(_0x16a46b,_0x23d1cf){var _0x50cb73=[];_0x1674f7[_0x1fa2('0x29')](function(_0x5cfb3b){_0x50cb73[_0x1fa2('0x45')](getRemoteTag(_0x5cfb3b,_0x4f76cb,_0x2ff266,_0x32cb27,_0x125102));});return Promise[_0x1fa2('0x46')](_0x50cb73)['then'](function(_0x7f199){if(_0x7f199[_0x1fa2('0xf')]){logger[_0x1fa2('0x15')]('['+[_0xee7c8f[_0x1fa2('0x13')]()]+_0x1fa2('0x47'),_0x7f199);var _0x184b83=[];_0x7f199[_0x1fa2('0x29')](function(_0x452d60){_0x184b83[_0x1fa2('0x45')](assignTagToIncident(_0x452d60,_0x4f76cb,_0x2ff266,_0x39e2c4,_0x32cb27));});return Promise[_0x1fa2('0x46')](_0x184b83)['then'](function(){_0x16a46b();})['catch'](function(){_0x16a46b();});}else{_0x16a46b();}});});}function getTags(_0x48aeee,_0x34e336,_0x3c4b66,_0x4c3669,_0x3a6a78,_0x117821){return function(_0x562686){return new Promise(function(_0x5a3657,_0x177b7f){var _0x5262c2=[];var _0x3fce60=_0x4c3669['Tags'];if(_0x3fce60&&_0x3fce60[_0x1fa2('0xf')]>0x0){_0x5262c2=_[_0x1fa2('0x48')](_0x3fce60,_0x1fa2('0x36'));}if(_0x5262c2[_0x1fa2('0xf')]>0x0){return manageTags(_0x48aeee,_0x5262c2,_0x34e336,_0x3c4b66,_0x562686,_0x3a6a78,_0x117821)['then'](function(){_0x5a3657(_0x562686);});}else{_0x5a3657(_0x562686);}});};}function emit(_0x17db50,_0x2010da,_0x3bba29){var _0x10e536=_0x1fa2('0x49')+_0x1fa2('0x4a')+_0x1fa2('0x4b')+_0x1fa2('0x4c');var _0x5aca57={'uri':_0x17db50+_0x1fa2('0x4d')+_0x3bba29+_0x10e536};io['to'](util[_0x1fa2('0x4e')](_0x1fa2('0x4f'),_0x2010da))[_0x1fa2('0x50')](_0x1fa2('0x51'),_0x5aca57);}exports['cs']=function(_0x35bb82,_0x183a69,_0x23c2dc,_0x2132e6,_0x429e35,_0x1cbe36,_0x152ef5,_0x3fdcf2){var _0x3e12fc={};var _0x2bd896={'user':_0x1cbe36[_0x1fa2('0x52')],'pass':_0x1cbe36[_0x1fa2('0x53')]};var _0x4f5529='sysparm_limit=1';var _0x536200=_0x1fa2('0x54');_0x1cbe36[_0x1fa2('0x55')]=intUtil['stripTrailingSlash'](_0x1cbe36['remoteUri']);_0x1cbe36['serverUrl']=intUtil[_0x1fa2('0x56')](_0x1cbe36[_0x1fa2('0x57')]);var _0x2e791d=util[_0x1fa2('0x4e')]('%s/api/now/table/',_0x1cbe36[_0x1fa2('0x55')]);_0x3e12fc[_0x1fa2('0x17')]=!_['isNil'](_0x2132e6)?_0x2132e6[_0x1fa2('0x58')]:null;_0x3e12fc[_0x1fa2('0x1d')]=_0x1cbe36[_0x1fa2('0x58')];_0x3e12fc[_0x1fa2('0x21')]=_0x3fdcf2[_0x1fa2('0x2f')]()==='outbound'?_0x183a69[_0x1fa2('0x59')]:_0x183a69['calleridnum'];_0x3e12fc[_0x1fa2('0x5a')]=_0x3fdcf2===_0x1fa2('0x5b')||_0x3fdcf2==='unmanaged'?_0x1fa2('0x5b'):_0x1fa2('0x5c');var _0x33dcba=util['format'](_0x1fa2('0x5d'),_0x1cbe36[_0x1fa2('0x57')],_0x183a69['uniqueid'],md5(_0x183a69[_0x1fa2('0x5e')]));if(_0x429e35&&_0x429e35[_0x1fa2('0x5f')]){logger[_0x1fa2('0x15')](_0x1fa2('0x60'),_0x1fa2('0x61'));_0x183a69[_0x1fa2('0x62')]=_0x33dcba;}else if(_0x152ef5&&_0x152ef5[_0x1fa2('0x63')]&&_0x152ef5['recordingFormat']!==_0x1fa2('0x64')){logger[_0x1fa2('0x15')](_0x1fa2('0x65'),'Recording\x20is\x20enabled!');_0x183a69[_0x1fa2('0x62')]=_0x33dcba;}else{_0x183a69[_0x1fa2('0x62')]='';}return getAdminUser(_0x3fdcf2,_0x2bd896,_0x3e12fc,_0x2e791d,_0x536200,_0x4f5529)[_0x1fa2('0xd')](getUser(_0x3fdcf2,_0x2bd896,_0x2e791d,_0x536200,_0x4f5529))[_0x1fa2('0xd')](getEndUser(_0x3fdcf2,_0x2bd896,_0x2e791d,_0x536200,_0x4f5529))[_0x1fa2('0xd')](getTicket(_0x3fdcf2,_0x2bd896,_0x2e791d,_0x23c2dc,_0x183a69,_0x536200))[_0x1fa2('0xd')](function(_0x16b3c8){logger[_0x1fa2('0x15')](util['format'](_0x1fa2('0x66'),_0x16b3c8[_0x1fa2('0x3e')]));logger[_0x1fa2('0x15')](util[_0x1fa2('0x4e')](_0x1fa2('0x67'),_0x3fdcf2));if(_0x3fdcf2!==_0x1fa2('0x68')){logger[_0x1fa2('0x15')]('['+[_0x3fdcf2[_0x1fa2('0x13')]()]+']',_0x1fa2('0x69'));emit(_0x1cbe36[_0x1fa2('0x55')],_0x2132e6[_0x1fa2('0x36')],_0x16b3c8[_0x1fa2('0x3e')]);}})['catch'](function(_0x3a2d51){logger[_0x1fa2('0x12')]('['+[_0x3fdcf2[_0x1fa2('0x13')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0x3a2d51,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc35a=['%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','format','user:%s','password','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','request-promise','util','md5','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','POST','sys_user?','endUserNumber','user','System','endUserId','GET','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Subjects','Fields','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags'];(function(_0x25a82e,_0x472d55){var _0x135910=function(_0x52214e){while(--_0x52214e){_0x25a82e['push'](_0x25a82e['shift']());}};_0x135910(++_0x472d55);}(_0xc35a,0x1b9));var _0xac35=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xc35a[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var Promise=require('bluebird');var rp=require(_0xac35('0x0'));var util=require(_0xac35('0x1'));var md5=require(_0xac35('0x2'));var Redis=require('ioredis');var intUtil=require(_0xac35('0x3'));var config=require(_0xac35('0x4'));var logger=require(_0xac35('0x5'))('servicenow');config[_0xac35('0x6')]=_[_0xac35('0x7')](config[_0xac35('0x6')],{'host':_0xac35('0x8'),'port':0x18eb});var io=require(_0xac35('0x9'))(new Redis(config[_0xac35('0x6')]));function getAdminUser(_0x22aba0,_0x3fcd7c,_0x379373,_0x132a04,_0x25b8d2,_0x152091){return new Promise(function(_0x4200b2,_0x412e9d){var _0x6fe5a8={'method':'GET','uri':_0x132a04+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x25b8d2+'&'+_0x152091,'auth':_0x3fcd7c,'json':!![]};return rp(_0x6fe5a8)['then'](function(_0x5ec5d2){if(_0x5ec5d2[_0xac35('0xa')][_0xac35('0xb')]>0x0){_0x379373[_0xac35('0xc')]=_0x5ec5d2[_0xac35('0xa')][0x0][_0xac35('0xd')];}logger[_0xac35('0xe')]('['+[_0x22aba0[_0xac35('0xf')]()]+_0xac35('0x10'),_0x379373);_0x4200b2(_0x379373);})[_0xac35('0x11')](function(_0x349f3b){logger[_0xac35('0x12')]('['+[_0x22aba0[_0xac35('0xf')]()]+']',_0x349f3b[_0xac35('0x13')]);_0x412e9d(_0x349f3b['message']);});});}function getUser(_0x4480fc,_0x47ce4a,_0x39ab18,_0x39046d,_0x589a60){return function(_0xb9ac93){logger[_0xac35('0xe')]('['+[_0x4480fc[_0xac35('0xf')]()]+_0xac35('0x14'),_0xb9ac93);return new Promise(function(_0x2e5731,_0x27f615){if(intUtil['validateEmail'](_0xb9ac93[_0xac35('0x15')])){var _0xecb521={'method':'GET','uri':_0x39ab18+_0xac35('0x16')+_0xb9ac93[_0xac35('0x15')]+'&'+_0x39046d+'&'+_0x589a60,'auth':_0x47ce4a,'json':!![]};logger[_0xac35('0xe')]('['+[_0x4480fc['toUpperCase']()]+_0xac35('0x17'),_0xecb521);return rp(_0xecb521)[_0xac35('0x18')](function(_0x22717f){logger['info']('['+[_0x4480fc[_0xac35('0xf')]()]+'],\x20getUser\x20entity',_0x22717f);if(_0x22717f[_0xac35('0xa')][_0xac35('0xb')]>0x0&&String(_0x22717f['result'][0x0]['active'])===_0xac35('0x19')){_0xb9ac93[_0xac35('0x1a')]=_0x22717f['result'][0x0][_0xac35('0xd')];}else{_0xb9ac93[_0xac35('0x1a')]=_0xb9ac93['adminId'];_0xb9ac93['userEmail']=_0xb9ac93[_0xac35('0x1b')];}logger[_0xac35('0xe')]('['+[_0x4480fc['toUpperCase']()]+_0xac35('0x1c'),_0xb9ac93);_0x2e5731(_0xb9ac93);})[_0xac35('0x11')](function(_0x4446ab){logger[_0xac35('0x12')]('['+[_0x4480fc[_0xac35('0xf')]()]+']',_0x4446ab[_0xac35('0x13')]);_0x27f615(_0x4446ab[_0xac35('0x13')]);});}else{logger[_0xac35('0xe')]('['+[_0x4480fc[_0xac35('0xf')]()]+_0xac35('0x1d'));_0xb9ac93[_0xac35('0x1a')]=_0xb9ac93[_0xac35('0xc')];_0xb9ac93['userEmail']=_0xb9ac93[_0xac35('0x1b')];_0x2e5731(_0xb9ac93);}});};}function createEndUser(_0x1079b5,_0x3d2a4d,_0x2d1728,_0x5301ca,_0x2e8143){logger['info']('['+[_0x1079b5[_0xac35('0xf')]()]+'],\x20createEndUser\x20input\x20crm',_0x2d1728);return new Promise(function(_0x534bf1,_0xc4325b){var _0x560883={'method':_0xac35('0x1e'),'uri':_0x5301ca+_0xac35('0x1f')+_0x2e8143,'body':{'user_name':_0x2d1728[_0xac35('0x20')],'roles':_0xac35('0x21'),'first_name':_0x2d1728['endUserNumber'],'active':'true','date_format':_0xac35('0x22'),'phone':_0x2d1728[_0xac35('0x20')]},'auth':_0x3d2a4d,'json':!![]};return rp(_0x560883)['then'](function(_0x7b8e87){logger[_0xac35('0xe')]('['+[_0x1079b5[_0xac35('0xf')]()]+'],\x20EndUser\x20schema',_0x7b8e87['result']);_0x2d1728[_0xac35('0x23')]=_0x7b8e87['result'][_0xac35('0xd')];_0x534bf1(_0x2d1728);})[_0xac35('0x11')](function(_0x2d54db){logger['error']('['+[_0x1079b5['toUpperCase']()]+']',_0x2d54db['message']);_0xc4325b(_0x2d54db[_0xac35('0x13')]);});});}function getEndUser(_0x16b540,_0xaab973,_0x40954c,_0x26394e,_0x362ad4){return function(_0x336f99){logger[_0xac35('0xe')]('['+[_0x16b540[_0xac35('0xf')]()]+'],\x20getEndUser\x20input\x20crm',_0x336f99);return new Promise(function(_0x40d99f,_0x127c94){var _0x4a2977={'method':_0xac35('0x24'),'uri':_0x40954c+_0xac35('0x25')+_0x336f99[_0xac35('0x20')]+'&'+_0x26394e+'&'+_0x362ad4,'auth':_0xaab973,'json':!![]};return rp(_0x4a2977)[_0xac35('0x18')](function(_0x251779){if(_0x251779[_0xac35('0xa')][_0xac35('0xb')]>0x0){_0x336f99[_0xac35('0x23')]=_0x251779['result'][0x0]['sys_id'];logger[_0xac35('0xe')]('['+[_0x16b540[_0xac35('0xf')]()]+_0xac35('0x26'),_0x336f99);_0x40d99f(_0x336f99);}else{return createEndUser(_0x16b540,_0xaab973,_0x336f99,_0x40954c,_0x26394e)[_0xac35('0x18')](function(_0xd11654){logger[_0xac35('0xe')]('['+[_0x16b540['toUpperCase']()]+_0xac35('0x27'),_0xd11654);_0x40d99f(_0xd11654);});}})[_0xac35('0x11')](function(_0x2043ff){logger[_0xac35('0x12')]('['+[_0x16b540[_0xac35('0xf')]()]+']',_0x2043ff[_0xac35('0x13')]);_0x127c94(_0x2043ff['message']);});});};}function getCustomFields(_0xec09c2,_0x28d561){var _0x219e78={};if(_0xec09c2[_0xac35('0xb')]>0x0){_['forEach'](_0xec09c2,function(_0x48d2a8){if(_[_0xac35('0x28')]([_0xac35('0x29'),_0xac35('0x2a')],_0x48d2a8[_0xac35('0x2b')])&&_0x48d2a8[_0xac35('0x2c')]&&!_0x48d2a8[_0xac35('0x2d')]){_0x219e78[_0x48d2a8[_0xac35('0x2c')][_0xac35('0x2e')]()]=_0x48d2a8[_0xac35('0x2f')][_0xac35('0x30')]();}else if(_['includes']([_0xac35('0x29'),_0xac35('0x2a')],_0x48d2a8[_0xac35('0x2b')])&&_0x48d2a8[_0xac35('0x31')]&&_0x48d2a8['customField']){_0x219e78[_0x48d2a8[_0xac35('0x31')][_0xac35('0x2e')]()]=_0x48d2a8[_0xac35('0x2f')]['toString']();}else if(_0x48d2a8['type']===_0xac35('0x32')&&_0x48d2a8['variableName']&&_0x48d2a8[_0xac35('0x31')]&&_0x48d2a8['customField']){_0x219e78[_0x48d2a8[_0xac35('0x31')][_0xac35('0x2e')]()]=_0x28d561[_0x48d2a8[_0xac35('0x33')]][_0xac35('0x30')]();}else if(_0x48d2a8[_0xac35('0x2b')]===_0xac35('0x34')&&_0x48d2a8[_0xac35('0x35')]&&_0x48d2a8[_0xac35('0x35')][_0xac35('0x36')]&&_0x48d2a8['idField']&&_0x48d2a8[_0xac35('0x2d')]){_0x219e78[_0x48d2a8[_0xac35('0x31')][_0xac35('0x2e')]()]=_0x28d561[_0x48d2a8[_0xac35('0x35')][_0xac35('0x36')][_0xac35('0x2e')]()][_0xac35('0x30')]();}});}return _0x219e78;}function getTicket(_0x2ad1dd,_0x4cf630,_0x265e22,_0x17fe52,_0x2efd37,_0x457652){return function(_0x574fc6){logger[_0xac35('0xe')]('['+[_0x2ad1dd[_0xac35('0xf')]()]+_0xac35('0x37'),_0x574fc6);return new Promise(function(_0x41d889,_0xdbe213){var _0x1bc292=_0x2ad1dd[_0xac35('0x2e')]()===_0xac35('0x38')?_0x574fc6[_0xac35('0x1a')]:_0x574fc6[_0xac35('0x23')];var _0x160232={'method':_0xac35('0x1e'),'uri':_0x265e22+_0xac35('0x39')+'?'+_0x457652,'body':Object['assign']({},{'active':'true','caller_id':_0x1bc292,'assigned_to':_0x574fc6[_0xac35('0x1a')],'short_description':intUtil[_0xac35('0x3a')](_0x17fe52[_0xac35('0x3b')],_0x2efd37,'\x20'),'description':intUtil[_0xac35('0x3a')](_0x17fe52['Descriptions'],_0x2efd37,'\x0a')},getCustomFields(_0x17fe52[_0xac35('0x3c')],_0x2efd37)),'auth':_0x4cf630,'json':!![]};return rp(_0x160232)[_0xac35('0x18')](function(_0x325eae){logger['info']('['+[_0x2ad1dd[_0xac35('0xf')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x325eae[_0xac35('0xa')]);_0x574fc6[_0xac35('0x3d')]=_0x325eae[_0xac35('0xa')]['sys_id'];_0x574fc6[_0xac35('0x3e')]=_0x325eae[_0xac35('0xa')][_0xac35('0x3f')];logger[_0xac35('0xe')]('['+[_0x2ad1dd['toUpperCase']()]+_0xac35('0x40'),_0x574fc6);_0x41d889(_0x574fc6);})[_0xac35('0x11')](function(_0x22ff31){logger[_0xac35('0x12')]('['+[_0x2ad1dd[_0xac35('0xf')]()]+']',_0x22ff31[_0xac35('0x13')]);_0xdbe213(_0x22ff31['message']);});});};}function createRemoteTag(_0x4b0da6,_0x174566,_0x2be136,_0x4d5876){return new Promise(function(_0x596bde,_0xf89ce6){var _0x1254ca={'method':_0xac35('0x1e'),'uri':_0x2be136+_0xac35('0x41')+'?'+_0x4d5876,'body':{'short_description':_0x4b0da6,'global':!![],'active':!![],'name':_0x4b0da6},'auth':_0x174566,'json':!![]};return rp(_0x1254ca)['then'](function(_0x12f7b3){var _0x411e81=_0x12f7b3['result'][_0xac35('0xd')];_0x596bde(_0x411e81);});});}function getRemoteTag(_0x1a6596,_0x356252,_0xae4e84,_0x53c12b,_0x292251){return new Promise(function(_0x4c3f9c,_0x2aeb57){var _0x1c21fe={'method':_0xac35('0x24'),'uri':_0xae4e84+'label'+_0xac35('0x42')+_0x1a6596+'&'+_0x53c12b,'auth':_0x356252,'json':!![]};return rp(_0x1c21fe)[_0xac35('0x18')](function(_0x519c73){if(_0x519c73[_0xac35('0xa')]['length']>0x0){var _0x42f654=_0x519c73['result'][0x0][_0xac35('0xd')];_0x4c3f9c(_0x42f654);}else{return createRemoteTag(_0x1a6596,_0x356252,_0xae4e84,_0x53c12b)[_0xac35('0x18')](function(_0x8d7999){_0x4c3f9c(_0x8d7999);});}});});}function assignTagToIncident(_0x43c7c0,_0x167fb8,_0x1b4577,_0x5199b7,_0x58474c){return new Promise(function(_0x47a3a7,_0x1df87e){var _0x58cae1={'method':_0xac35('0x1e'),'uri':_0x1b4577+_0xac35('0x43')+'?'+_0x58474c,'body':{'label':_0x43c7c0,'table':_0xac35('0x39'),'id_type':_0xac35('0x44'),'table_key':_0x5199b7[_0xac35('0x3d')],'title':'Incident\x20-\x20'+_0x5199b7[_0xac35('0x3e')],'id_display':_0x5199b7['ticketNumber']},'auth':_0x167fb8,'json':!![]};return rp(_0x58cae1)[_0xac35('0x18')](function(_0x299e46){_0x47a3a7();})[_0xac35('0x11')](function(){_0x47a3a7();});});}function manageTags(_0x55b622,_0x1c1308,_0x2392bc,_0x5ef811,_0x157924,_0x46fd81,_0x109c05){return new Promise(function(_0x3ea74,_0x2004c9){var _0x2e8a7b=[];_0x1c1308[_0xac35('0x45')](function(_0x4580b1){_0x2e8a7b[_0xac35('0x46')](getRemoteTag(_0x4580b1,_0x2392bc,_0x5ef811,_0x46fd81,_0x109c05));});return Promise[_0xac35('0x47')](_0x2e8a7b)[_0xac35('0x18')](function(_0x623725){if(_0x623725[_0xac35('0xb')]){logger[_0xac35('0xe')]('['+[_0x55b622[_0xac35('0xf')]()]+_0xac35('0x48'),_0x623725);var _0x3887ce=[];_0x623725[_0xac35('0x45')](function(_0x1a5b00){_0x3887ce[_0xac35('0x46')](assignTagToIncident(_0x1a5b00,_0x2392bc,_0x5ef811,_0x157924,_0x46fd81));});return Promise[_0xac35('0x47')](_0x3887ce)[_0xac35('0x18')](function(){_0x3ea74();})[_0xac35('0x11')](function(){_0x3ea74();});}else{_0x3ea74();}});});}function getTags(_0x207329,_0x1428c8,_0x517a81,_0x2428c7,_0x5a818d,_0x14d829){return function(_0x14f5da){return new Promise(function(_0x30b77b,_0x528902){var _0x383f97=[];var _0x323b7f=_0x2428c7[_0xac35('0x49')];if(_0x323b7f&&_0x323b7f[_0xac35('0xb')]>0x0){_0x383f97=_['map'](_0x323b7f,_0xac35('0x36'));}if(_0x383f97[_0xac35('0xb')]>0x0){return manageTags(_0x207329,_0x383f97,_0x1428c8,_0x517a81,_0x14f5da,_0x5a818d,_0x14d829)[_0xac35('0x18')](function(){_0x30b77b(_0x14f5da);});}else{_0x30b77b(_0x14f5da);}});};}function emit(_0x19de06,_0x28132a,_0x380537){var _0x20de71=_0xac35('0x4a')+_0xac35('0x4b')+_0xac35('0x4c')+'%255EORDERBYDESCnumber';var _0xfd1adc={'uri':_0x19de06+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x380537+_0x20de71};io['to'](util[_0xac35('0x4d')](_0xac35('0x4e'),_0x28132a))['emit']('trigger:browser:url',_0xfd1adc);}exports['cs']=function(_0x59fd75,_0x307976,_0x17e302,_0x3e2055,_0x59aeed,_0x14a6d5,_0xc0038,_0x2115a1){var _0x24e95a={};var _0x5716ad={'user':_0x14a6d5['username'],'pass':_0x14a6d5[_0xac35('0x4f')]};var _0x5902f2='sysparm_limit=1';var _0x5a05be='sysparm_display_value=true';_0x14a6d5[_0xac35('0x50')]=intUtil[_0xac35('0x51')](_0x14a6d5['remoteUri']);_0x14a6d5[_0xac35('0x52')]=intUtil[_0xac35('0x51')](_0x14a6d5[_0xac35('0x52')]);var _0x3763a5=util['format'](_0xac35('0x53'),_0x14a6d5['remoteUri']);_0x24e95a[_0xac35('0x15')]=!_[_0xac35('0x54')](_0x3e2055)?_0x3e2055[_0xac35('0x55')]:null;_0x24e95a[_0xac35('0x1b')]=_0x14a6d5[_0xac35('0x55')];_0x24e95a[_0xac35('0x20')]=_0x2115a1[_0xac35('0x2e')]()===_0xac35('0x38')?_0x307976[_0xac35('0x56')]:_0x307976[_0xac35('0x57')];_0x24e95a['callDirection']=_0x2115a1==='queue'||_0x2115a1===_0xac35('0x58')?_0xac35('0x59'):'outbound';var _0x3887ef=util['format'](_0xac35('0x5a'),_0x14a6d5[_0xac35('0x52')],_0x307976[_0xac35('0x5b')],md5(_0x307976[_0xac35('0x5b')]));if(_0x59aeed&&_0x59aeed[_0xac35('0x5c')]){logger[_0xac35('0xe')](_0xac35('0x5d'),_0xac35('0x5e'));_0x307976[_0xac35('0x5f')]=_0x3887ef;}else if(_0xc0038&&_0xc0038[_0xac35('0x60')]&&_0xc0038['recordingFormat']!==_0xac35('0x61')){logger[_0xac35('0xe')](_0xac35('0x62'),_0xac35('0x5e'));_0x307976[_0xac35('0x5f')]=_0x3887ef;}else{_0x307976['recordingURL']='';}return getAdminUser(_0x2115a1,_0x5716ad,_0x24e95a,_0x3763a5,_0x5a05be,_0x5902f2)[_0xac35('0x18')](getUser(_0x2115a1,_0x5716ad,_0x3763a5,_0x5a05be,_0x5902f2))[_0xac35('0x18')](getEndUser(_0x2115a1,_0x5716ad,_0x3763a5,_0x5a05be,_0x5902f2))[_0xac35('0x18')](getTicket(_0x2115a1,_0x5716ad,_0x3763a5,_0x17e302,_0x307976,_0x5a05be))[_0xac35('0x18')](function(_0x4b5bb4){logger[_0xac35('0xe')](util[_0xac35('0x4d')](_0xac35('0x63'),_0x4b5bb4[_0xac35('0x3d')]));logger[_0xac35('0xe')](util[_0xac35('0x4d')](_0xac35('0x64'),_0x2115a1));if(_0x2115a1!==_0xac35('0x58')){logger[_0xac35('0xe')]('['+[_0x2115a1[_0xac35('0xf')]()]+']',_0xac35('0x65'));emit(_0x14a6d5[_0xac35('0x50')],_0x3e2055[_0xac35('0x36')],_0x4b5bb4[_0xac35('0x3d')]);}})[_0xac35('0x11')](function(_0x32fdea){logger[_0xac35('0x12')]('['+[_0x2115a1['toUpperCase']()]+_0xac35('0x66'),util['inspect'](_0x32fdea,{'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 a114b41..f7fe1a2 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 _0x24ac=['socket.io-emitter','POST','emit','info','name','getString','Subjects','assigned_user_id','created_by','Descriptions','toISOString','slice','replace','duration_minutes','parent_id','parent_type','Contacts','direction','variableName','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','get_server_info','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','length','find','entry_list','name_value_list','user_name','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','get_entry_list','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','forEach','type','string','nameField','customField','toLowerCase','content','idField','custom_fields','push','variable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','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','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','uri','%s/service/v4_1/rest.php','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','Ticket\x20created!','users','charAt','catch','unmanaged','monitor_format','lastevent','toUpperCase','isNil','calleridname','bluebird','md5','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost'];(function(_0x760e06,_0x279300){var _0x5a73fd=function(_0x473ef0){while(--_0x473ef0){_0x760e06['push'](_0x760e06['shift']());}};_0x5a73fd(++_0x279300);}(_0x24ac,0x1d9));var _0xc24a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x24ac[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0xc24a('0x0'));var md5=require(_0xc24a('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xc24a('0x2'));var logger=require(_0xc24a('0x3'))(_0xc24a('0x4'));config[_0xc24a('0x5')]=_['defaults'](config[_0xc24a('0x5')],{'host':_0xc24a('0x6'),'port':0x18eb});var io=require(_0xc24a('0x7'))(new Redis(config[_0xc24a('0x5')]));var def={'method':_0xc24a('0x8'),'json':!![]};function emit(_0x221fc6,_0x346771,_0x330f8f){io['to'](_0x221fc6)[_0xc24a('0x9')](_0x346771,_0x330f8f);}function getTicket(_0x581f1c,_0x59fbd3,_0x57c3d1,_0x467832,_0x4b566e,_0x7d7d6c,_0x115de8,_0x4dc010){logger[_0xc24a('0xa')]('Creating\x20new\x20ticket...');var _0x169a32=new Date();var _0x89a114=[{'name':_0xc24a('0xb'),'value':intUtil[_0xc24a('0xc')](_0x467832[_0xc24a('0xd')],_0x4b566e,'\x20')},{'name':_0xc24a('0xe'),'value':_0x59fbd3['id']},{'name':_0xc24a('0xf'),'value':_0x59fbd3['id']},{'name':'description','value':intUtil[_0xc24a('0xc')](_0x467832[_0xc24a('0x10')],_0x4b566e,'\x0a')},{'name':'date_start','value':_0x169a32[_0xc24a('0x11')]()[_0xc24a('0x12')](0x0,0x13)[_0xc24a('0x13')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xc24a('0x14'),'value':'15'},{'name':_0xc24a('0x15'),'value':_0x57c3d1['id']},{'name':_0xc24a('0x16'),'value':_0xc24a('0x17')},{'name':'parent_name','value':_0x57c3d1[_0xc24a('0xb')]},{'name':_0xc24a('0x18'),'value':_0x4dc010}];if(_0x7d7d6c['length']){_['forEach'](_0x7d7d6c,function(_0x1b6bbd){if(_0x4b566e[_0x1b6bbd['variableName']]){_0x89a114['push']({'name':_0x1b6bbd['idField'],'value':_0x4b566e[_0x1b6bbd[_0xc24a('0x19')]]});}});}return request({'form':{'method':'set_entry','input_type':_0xc24a('0x1a'),'response_type':_0xc24a('0x1a'),'rest_data':JSON[_0xc24a('0x1b')]({'session':_0x115de8['id'],'module_name':_0xc24a('0x1c'),'name_value_list':_0x89a114})}});}function getAuth(_0x396780){return util[_0xc24a('0x1d')](_0xc24a('0x1e'),new Buffer(_0x396780[_0xc24a('0x1f')]+':X')[_0xc24a('0x20')]('base64'));}function getServerInfo(_0x374770){return request({'form':{'method':_0xc24a('0x21'),'input_type':_0xc24a('0x1a'),'response_type':_0xc24a('0x1a'),'rest_data':JSON[_0xc24a('0x1b')]({'session':_0x374770['id']})}});}function getUser(_0x3d9089,_0x2d1223,_0x2f4a68){if(!_['isNil'](_0x2d1223)){logger['info'](_0xc24a('0x22'),_0x2d1223);return request({'form':{'method':'get_entry_list','input_type':_0xc24a('0x1a'),'response_type':_0xc24a('0x1a'),'rest_data':JSON[_0xc24a('0x1b')]({'session':_0x2f4a68['id'],'module_name':_0xc24a('0x23'),'query':util[_0xc24a('0x1d')](_0xc24a('0x24'),_0x2d1223),'order_by':'','offset':'0','select_fields':['id',_0xc24a('0xb'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc24a('0x25')](function(_0x4f42f6){if(_0x4f42f6['entry_list'][_0xc24a('0x26')]){var _0x5719f6=_[_0xc24a('0x27')](_0x4f42f6[_0xc24a('0x28')],function(_0x350134){return _0x350134[_0xc24a('0x29')][_0xc24a('0x2a')][_0xc24a('0x2b')]===_0x2d1223;});if(_0x5719f6){logger[_0xc24a('0xa')](_0xc24a('0x2c'));return BPromise[_0xc24a('0x2d')]({'id':_0x5719f6[_0xc24a('0x29')]['id']['value'],'name':_0x5719f6[_0xc24a('0x29')]['name'][_0xc24a('0x2b')]});}}logger[_0xc24a('0xa')](_0xc24a('0x2e'));return BPromise[_0xc24a('0x2d')]({'id':_0x2f4a68[_0xc24a('0x29')][_0xc24a('0x2f')][_0xc24a('0x2b')],'name':_0x2f4a68[_0xc24a('0x29')][_0xc24a('0x2a')][_0xc24a('0x2b')]});});}else{logger[_0xc24a('0xa')](_0xc24a('0x30'));return BPromise[_0xc24a('0x2d')]({'id':_0x2f4a68[_0xc24a('0x29')][_0xc24a('0x2f')]['value'],'name':_0x2f4a68[_0xc24a('0x29')]['user_name'][_0xc24a('0x2b')]});}}function getEndUser(_0x3e3504,_0x2068d5,_0x21d816,_0x52e0ac){logger[_0xc24a('0xa')]('Searching\x20enduser\x20with\x20phone',_0x21d816);return request({'form':{'method':_0xc24a('0x31'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x52e0ac['id'],'module_name':'Contacts','query':util['format']('contacts.phone_home\x20=\x20\x22%s\x22',_0x21d816),'order_by':'','offset':'0','select_fields':['id',_0xc24a('0xb'),_0xc24a('0x32')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc24a('0x25')](function(_0x203b9a){if(_0x203b9a[_0xc24a('0x28')][_0xc24a('0x26')]){var _0x36c79b=_[_0xc24a('0x27')](_0x203b9a[_0xc24a('0x28')],function(_0x200331){return _0x200331[_0xc24a('0x29')][_0xc24a('0x32')][_0xc24a('0x2b')]===_0x21d816;});if(_0x36c79b){logger[_0xc24a('0xa')]('Enduser\x20found!');return BPromise[_0xc24a('0x2d')]({'id':_0x36c79b[_0xc24a('0x29')]['id'][_0xc24a('0x2b')],'name':_0x36c79b[_0xc24a('0x29')][_0xc24a('0xb')][_0xc24a('0x2b')],'phone':_0x36c79b['name_value_list'][_0xc24a('0x32')][_0xc24a('0x2b')]});}}else{logger[_0xc24a('0xa')](_0xc24a('0x33'));return request({'form':{'method':_0xc24a('0x34'),'input_type':_0xc24a('0x1a'),'response_type':_0xc24a('0x1a'),'rest_data':JSON[_0xc24a('0x1b')]({'session':_0x52e0ac['id'],'module_name':_0xc24a('0x17'),'name_value_list':[{'name':_0xc24a('0x35'),'value':_0x2068d5!==_0xc24a('0x36')?_0x2068d5:util[_0xc24a('0x1d')](_0xc24a('0x37'),_0x21d816)},{'name':_0xc24a('0x32'),'value':_0x21d816}]})}})[_0xc24a('0x25')](function(_0x17282c){logger[_0xc24a('0xa')](_0xc24a('0x38'));return BPromise['resolve']({'id':_0x17282c['id'],'name':_0x17282c[_0xc24a('0x28')][_0xc24a('0x35')][_0xc24a('0x2b')],'phone':_0x17282c[_0xc24a('0x28')]['phone_home'][_0xc24a('0x2b')]});});}});}function request(_0x485322){logger[_0xc24a('0x39')](_0xc24a('0x3a'),JSON[_0xc24a('0x1b')](_0x485322));return rp(_[_0xc24a('0x3b')](def,_0x485322));}function getTags(_0x3a14ff,_0x182b39){var _0x507b8f=[];if(_0x3a14ff&&_0x3a14ff[_0xc24a('0x26')]>0x0){_0x507b8f=_[_0xc24a('0x3c')](_0x3a14ff,_0x182b39);}return _0x507b8f;}function getCustomFields(_0x239084,_0xaebbc9){var _0x6c5f8a=[];var _0x599daf={'custom_fields':[]};if(_0x239084[_0xc24a('0x26')]>0x0){_[_0xc24a('0x3d')](_0x239084,function(_0x12344f){if(_0x12344f[_0xc24a('0x3e')]===_0xc24a('0x3f')&&_0x12344f[_0xc24a('0x40')]&&!_0x12344f[_0xc24a('0x41')]){_0x599daf[_0x12344f[_0xc24a('0x40')][_0xc24a('0x42')]()]=_0x12344f[_0xc24a('0x43')][_0xc24a('0x20')]();}else if(_0x12344f['type']===_0xc24a('0x3f')&&_0x12344f[_0xc24a('0x44')]&&_0x12344f['customField']){_0x599daf[_0xc24a('0x45')][_0xc24a('0x46')]({'id':_0x12344f['idField'],'value':_0x12344f['content'][_0xc24a('0x20')]()});}else if(_0x12344f[_0xc24a('0x3e')]===_0xc24a('0x47')&&_0x12344f['variableName']&&_0x12344f['idField']&&_0x12344f['customField']){_0xaebbc9[_0x12344f[_0xc24a('0x19')]]&&_0x599daf[_0xc24a('0x45')]['push']({'id':_0x12344f[_0xc24a('0x44')],'value':_0xaebbc9[_0x12344f[_0xc24a('0x19')]][_0xc24a('0x20')]()});}else if(_0x12344f[_0xc24a('0x3e')]==='customVariable'&&_0x12344f['Variable']&&_0x12344f[_0xc24a('0x48')][_0xc24a('0xb')]&&_0x12344f[_0xc24a('0x44')]&&_0x12344f['customField']){_0xaebbc9[_0x12344f[_0xc24a('0x48')][_0xc24a('0xb')][_0xc24a('0x42')]()]&&_0x599daf['custom_fields']['push']({'id':_0x12344f[_0xc24a('0x44')],'value':_0xaebbc9[_0x12344f[_0xc24a('0x48')][_0xc24a('0xb')][_0xc24a('0x42')]()][_0xc24a('0x20')]()});}});}return _0x599daf;}function getConnection(_0x556629){return request({'method':_0xc24a('0x8'),'form':{'method':_0xc24a('0x49'),'input_type':_0xc24a('0x1a'),'response_type':_0xc24a('0x1a'),'rest_data':JSON[_0xc24a('0x1b')]({'user_auth':{'user_name':_0x556629[_0xc24a('0x4a')],'password':_0x556629[_0xc24a('0x4b')],'encryption':_0xc24a('0x4c')},'application':_0xc24a('0x4d')})}})['then'](function(_0x3b6842){var _0x520cc7=_0x3b6842;if(_0x520cc7['id']){def[_0xc24a('0x4e')]=_0x520cc7['id'];return BPromise[_0xc24a('0x2d')](_0x520cc7);}else{throw new Error(util[_0xc24a('0x1d')](_0xc24a('0x4f'),_0x556629['id']));}});}function setRelationship(_0xae519b,_0x51d7bd,_0xca9675,_0x27a58a){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':_0xc24a('0x1a'),'rest_data':JSON[_0xc24a('0x1b')]({'session':_0xae519b['id'],'module_name':_0xc24a('0x1c'),'module_id':_0xca9675['id'],'link_field_name':_0x27a58a,'related_ids':[_0x51d7bd['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xc24a('0x50')]=function(_0x95be29,_0x4ede13,_0x55acdc,_0x4c4f0b,_0x447713,_0x5936cc){var _0x1e1ef9,_0x2c5488,_0x545c0f,_0x511fba;_0x5936cc[_0xc24a('0x51')]=intUtil[_0xc24a('0x52')](_0x5936cc[_0xc24a('0x51')]);_0x5936cc[_0xc24a('0x53')]=intUtil['stripTrailingSlash'](_0x5936cc[_0xc24a('0x53')]);def['uri']=util[_0xc24a('0x1d')]('%s/service/v4_1/rest.php',_0x5936cc[_0xc24a('0x51')]);if(_0x447713&&_0x447713['monitor_format']){logger[_0xc24a('0xa')](_0xc24a('0x54'),_0xc24a('0x55'));_0x4ede13[_0xc24a('0x56')]=util['format'](_0xc24a('0x57'),_0x5936cc['serverUrl'],_0x4ede13['uniqueid'],md5(_0x4ede13[_0xc24a('0x58')]));}else{_0x4ede13['recordingURL']='';}return getConnection(_0x5936cc)[_0xc24a('0x25')](function(_0x25d86d){_0x511fba=_0x25d86d;return getUser(_0x5936cc,_0x4c4f0b[_0xc24a('0xb')],_0x511fba);})[_0xc24a('0x25')](function(_0x2bb740){_0x1e1ef9=_0x2bb740;logger['info'](_0xc24a('0x59'),_0x1e1ef9['id']);return getEndUser(_0x5936cc,_0x4ede13['calleridname'],_0x4ede13[_0xc24a('0x5a')],_0x511fba);})['then'](function(_0x1d415d){_0x2c5488=_0x1d415d;logger[_0xc24a('0xa')](_0xc24a('0x5b'),_0x2c5488['id']);return getTicket(_0x5936cc,_0x1e1ef9,_0x2c5488,_0x55acdc,_0x4ede13,_0x55acdc[_0xc24a('0x5c')],_0x511fba,_0xc24a('0x5d'));})[_0xc24a('0x25')](function(_0x4ee7e5){_0x545c0f=_0x4ee7e5;logger[_0xc24a('0xa')]('Ticket\x20created!');logger[_0xc24a('0xa')]('The\x20Ticket\x20ID\x20is:',_0x545c0f['id']);return setRelationship(_0x511fba,_0x1e1ef9,_0x545c0f,'users');})[_0xc24a('0x25')](function(){return setRelationship(_0x511fba,_0x2c5488,_0x545c0f,_0xc24a('0x5e'));})[_0xc24a('0x25')](function(){return getServerInfo(_0x511fba);})[_0xc24a('0x25')](function(_0x4c86a1){var _0x4c3284=parseInt(_0x4c86a1[_0xc24a('0x5f')]['charAt'](0x0));var _0x488cc0=util['format'](_0xc24a('0x60'),_0x5936cc[_0xc24a('0x51')],_0x545c0f['id']);if(_0x4c3284>0x6){_0x488cc0=util['format'](_0xc24a('0x61'),_0x5936cc['remoteUri'],_0x545c0f['id']);}logger['info']('[QUEUE]',_0xc24a('0x62'));emit(util[_0xc24a('0x1d')](_0xc24a('0x63'),_0x4c4f0b['name']),_0xc24a('0x64'),{'uri':_0x488cc0});})['catch'](function(_0x55a899){logger[_0xc24a('0x65')](_0xc24a('0x54'),JSON['stringify'](_0x55a899));});};exports[_0xc24a('0x66')]=function(_0x293ee3,_0x230acc,_0x47d93a,_0x35f068,_0x516a59,_0x548350,_0x40db8e){var _0x41deb3,_0xd54a82,_0x3a9488,_0x1fad7f;_0x548350[_0xc24a('0x51')]=intUtil['stripTrailingSlash'](_0x548350[_0xc24a('0x51')]);_0x548350['serverUrl']=intUtil[_0xc24a('0x52')](_0x548350[_0xc24a('0x53')]);def[_0xc24a('0x67')]=util[_0xc24a('0x1d')](_0xc24a('0x68'),_0x548350[_0xc24a('0x51')]);if(_0x40db8e&&_0x40db8e[_0xc24a('0x69')]&&_0x40db8e[_0xc24a('0x69')]!=='none'){logger['info'](_0xc24a('0x6a'),'Recording\x20is\x20enabled!');_0x230acc['recordingURL']=util[_0xc24a('0x1d')](_0xc24a('0x57'),_0x548350[_0xc24a('0x53')],_0x230acc[_0xc24a('0x58')],md5(_0x230acc[_0xc24a('0x58')]));}return getConnection(_0x548350)[_0xc24a('0x25')](function(_0x4f51c8){_0x1fad7f=_0x4f51c8;return getUser(_0x548350,_0x35f068['name'],_0x1fad7f);})[_0xc24a('0x25')](function(_0x1bc1ed){_0x41deb3=_0x1bc1ed;logger[_0xc24a('0xa')](_0xc24a('0x59'),_0x41deb3['id']);return getEndUser(_0x548350,_0x230acc[_0xc24a('0x6b')],_0x230acc[_0xc24a('0x6c')],_0x1fad7f);})[_0xc24a('0x25')](function(_0x3e63f5){_0xd54a82=_0x3e63f5;logger[_0xc24a('0xa')](_0xc24a('0x5b'),_0xd54a82['id']);return getTicket(_0x548350,_0x41deb3,_0xd54a82,_0x47d93a,_0x230acc,_0x47d93a[_0xc24a('0x5c')],_0x1fad7f,_0xc24a('0x6d'));})[_0xc24a('0x25')](function(_0x29fc0c){_0x3a9488=_0x29fc0c;logger['info'](_0xc24a('0x6e'));logger[_0xc24a('0xa')]('The\x20Ticket\x20ID\x20is:',_0x3a9488['id']);return setRelationship(_0x1fad7f,_0x41deb3,_0x3a9488,_0xc24a('0x6f'));})[_0xc24a('0x25')](function(){return setRelationship(_0x1fad7f,_0xd54a82,_0x3a9488,_0xc24a('0x5e'));})[_0xc24a('0x25')](function(){return getServerInfo(_0x1fad7f);})['then'](function(_0x29c739){var _0x556fac=parseInt(_0x29c739['version'][_0xc24a('0x70')](0x0));var _0x2d7fe2=util[_0xc24a('0x1d')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x548350['remoteUri'],_0x3a9488['id']);if(_0x556fac>0x6){_0x2d7fe2=util[_0xc24a('0x1d')](_0xc24a('0x61'),_0x548350['remoteUri'],_0x3a9488['id']);}logger[_0xc24a('0xa')](_0xc24a('0x6a'),_0xc24a('0x62'));emit(util[_0xc24a('0x1d')](_0xc24a('0x63'),_0x35f068[_0xc24a('0xb')]),_0xc24a('0x64'),{'uri':_0x2d7fe2});})[_0xc24a('0x71')](function(_0xb0b9af){logger[_0xc24a('0x65')](_0xc24a('0x6a'),JSON['stringify'](_0xb0b9af));});};exports[_0xc24a('0x72')]=function(_0x31126e,_0x329bc8,_0x1e0852,_0x4cb3ad,_0xfe673c,_0x5affa6){var _0x1717bc,_0x42e34d,_0x107d5e,_0x1a1361;_0x5affa6['remoteUri']=intUtil[_0xc24a('0x52')](_0x5affa6[_0xc24a('0x51')]);_0x5affa6['serverUrl']=intUtil[_0xc24a('0x52')](_0x5affa6['serverUrl']);def['uri']=util[_0xc24a('0x1d')]('%s/service/v4_1/rest.php',_0x5affa6[_0xc24a('0x51')]);if(_0xfe673c&&_0xfe673c[_0xc24a('0x73')]){logger[_0xc24a('0xa')]('['+_0x329bc8[_0xc24a('0x74')][_0xc24a('0x75')]()+']',_0xc24a('0x55'));_0x329bc8[_0xc24a('0x56')]=util[_0xc24a('0x1d')](_0xc24a('0x57'),_0x5affa6[_0xc24a('0x53')],_0x329bc8['uniqueid'],md5(_0x329bc8[_0xc24a('0x58')]));}else{_0x329bc8[_0xc24a('0x56')]='';}return getConnection(_0x5affa6)[_0xc24a('0x25')](function(_0x1656db){_0x1a1361=_0x1656db;if(!_[_0xc24a('0x76')](_0x4cb3ad)){return getUser(_0x5affa6,_0x4cb3ad[_0xc24a('0xb')],_0x1a1361);}else{return getUser(_0x5affa6,null,_0x1a1361);}})[_0xc24a('0x25')](function(_0x248da0){_0x1717bc=_0x248da0;logger[_0xc24a('0xa')](_0xc24a('0x59'),_0x1717bc['id']);return getEndUser(_0x5affa6,_0x329bc8[_0xc24a('0x77')],_0x329bc8['calleridnum'],_0x1a1361);})[_0xc24a('0x25')](function(_0x4aef75){_0x42e34d=_0x4aef75;logger[_0xc24a('0xa')](_0xc24a('0x5b'),_0x42e34d['id']);return getTicket(_0x5affa6,_0x1717bc,_0x42e34d,_0x1e0852,_0x329bc8,_0x1e0852['Fields'],_0x1a1361,'Inbound');})[_0xc24a('0x25')](function(_0x3ea719){_0x107d5e=_0x3ea719;logger[_0xc24a('0xa')](_0xc24a('0x6e'));logger[_0xc24a('0xa')]('The\x20Ticket\x20ID\x20is:',_0x107d5e['id']);return setRelationship(_0x1a1361,_0x1717bc,_0x107d5e,_0xc24a('0x6f'));})['then'](function(){return setRelationship(_0x1a1361,_0x42e34d,_0x107d5e,'contacts');})[_0xc24a('0x25')](function(){return getServerInfo(_0x1a1361);})[_0xc24a('0x71')](function(_0x36846){logger['error']('['+_0x329bc8[_0xc24a('0x74')]['toUpperCase']()+']',JSON[_0xc24a('0x1b')](_0x36846));});}; \ No newline at end of file +var _0x239d=['Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','first_name','','Caller\x20-\x20%s','debug','[HTTP]','map','type','customField','toLowerCase','content','variable','custom_fields','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','[QUEUE]','recordingURL','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','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','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','Outbound','charAt','unmanaged','%s/service/v4_1/rest.php','monitor_format','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Inbound','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','sugarcrm','defaults','redis','socket.io-emitter','POST','emit','info','name','Subjects','created_by','description','getString','Descriptions','date_start','toISOString','slice','replace','duration_hours','parent_id','direction','variableName','push','idField','set_entry','stringify','Calls','Basic\x20%s','apiKey','toString','base64','get_server_info','JSON','isNil','format','user_name','then','entry_list','find','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id'];(function(_0x48dc28,_0x349a24){var _0x10d4c4=function(_0x1c5a9d){while(--_0x1c5a9d){_0x48dc28['push'](_0x48dc28['shift']());}};_0x10d4c4(++_0x349a24);}(_0x239d,0xb9));var _0xd239=function(_0x5da182,_0x3b5ca9){_0x5da182=_0x5da182-0x0;var _0x30787e=_0x239d[_0x5da182];return _0x30787e;};'use strict';var _=require(_0xd239('0x0'));var rp=require(_0xd239('0x1'));var BPromise=require(_0xd239('0x2'));var md5=require(_0xd239('0x3'));var util=require(_0xd239('0x4'));var Redis=require(_0xd239('0x5'));var intUtil=require(_0xd239('0x6'));var config=require(_0xd239('0x7'));var logger=require('../../../../config/logger')(_0xd239('0x8'));config['redis']=_[_0xd239('0x9')](config[_0xd239('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xd239('0xb'))(new Redis(config['redis']));var def={'method':_0xd239('0xc'),'json':!![]};function emit(_0x8f425c,_0x310336,_0x1fb4ef){io['to'](_0x8f425c)[_0xd239('0xd')](_0x310336,_0x1fb4ef);}function getTicket(_0x3be26c,_0x370b93,_0x517f51,_0x5c6713,_0x1e777b,_0x1ecb75,_0x5ada94,_0x4dc6ec){logger[_0xd239('0xe')]('Creating\x20new\x20ticket...');var _0x4cc373=new Date();var _0x55b3ac=[{'name':_0xd239('0xf'),'value':intUtil['getString'](_0x5c6713[_0xd239('0x10')],_0x1e777b,'\x20')},{'name':'assigned_user_id','value':_0x370b93['id']},{'name':_0xd239('0x11'),'value':_0x370b93['id']},{'name':_0xd239('0x12'),'value':intUtil[_0xd239('0x13')](_0x5c6713[_0xd239('0x14')],_0x1e777b,'\x0a')},{'name':_0xd239('0x15'),'value':_0x4cc373[_0xd239('0x16')]()[_0xd239('0x17')](0x0,0x13)[_0xd239('0x18')]('T','\x20')},{'name':_0xd239('0x19'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xd239('0x1a'),'value':_0x517f51['id']},{'name':'parent_type','value':'Contacts'},{'name':'parent_name','value':_0x517f51[_0xd239('0xf')]},{'name':_0xd239('0x1b'),'value':_0x4dc6ec}];if(_0x1ecb75['length']){_['forEach'](_0x1ecb75,function(_0x138486){if(_0x1e777b[_0x138486[_0xd239('0x1c')]]){_0x55b3ac[_0xd239('0x1d')]({'name':_0x138486[_0xd239('0x1e')],'value':_0x1e777b[_0x138486[_0xd239('0x1c')]]});}});}return request({'form':{'method':_0xd239('0x1f'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xd239('0x20')]({'session':_0x5ada94['id'],'module_name':_0xd239('0x21'),'name_value_list':_0x55b3ac})}});}function getAuth(_0x2e57f6){return util['format'](_0xd239('0x22'),new Buffer(_0x2e57f6[_0xd239('0x23')]+':X')[_0xd239('0x24')](_0xd239('0x25')));}function getServerInfo(_0x42dde7){return request({'form':{'method':_0xd239('0x26'),'input_type':_0xd239('0x27'),'response_type':_0xd239('0x27'),'rest_data':JSON[_0xd239('0x20')]({'session':_0x42dde7['id']})}});}function getUser(_0x404f56,_0x20930,_0x46f4f8){if(!_[_0xd239('0x28')](_0x20930)){logger[_0xd239('0xe')]('Getting\x20agent\x20with\x20name',_0x20930);return request({'form':{'method':'get_entry_list','input_type':_0xd239('0x27'),'response_type':_0xd239('0x27'),'rest_data':JSON[_0xd239('0x20')]({'session':_0x46f4f8['id'],'module_name':'Employees','query':util[_0xd239('0x29')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x20930),'order_by':'','offset':'0','select_fields':['id',_0xd239('0xf'),_0xd239('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd239('0x2b')](function(_0x58b26e){if(_0x58b26e[_0xd239('0x2c')]['length']){var _0x37d12a=_[_0xd239('0x2d')](_0x58b26e[_0xd239('0x2c')],function(_0xe8384e){return _0xe8384e[_0xd239('0x2e')][_0xd239('0x2a')][_0xd239('0x2f')]===_0x20930;});if(_0x37d12a){logger['info']('Agent\x20found!');return BPromise[_0xd239('0x30')]({'id':_0x37d12a[_0xd239('0x2e')]['id'][_0xd239('0x2f')],'name':_0x37d12a[_0xd239('0x2e')][_0xd239('0xf')][_0xd239('0x2f')]});}}logger['info'](_0xd239('0x31'));return BPromise[_0xd239('0x30')]({'id':_0x46f4f8['name_value_list'][_0xd239('0x32')][_0xd239('0x2f')],'name':_0x46f4f8['name_value_list'][_0xd239('0x2a')][_0xd239('0x2f')]});});}else{logger[_0xd239('0xe')](_0xd239('0x33'));return BPromise[_0xd239('0x30')]({'id':_0x46f4f8[_0xd239('0x2e')][_0xd239('0x32')][_0xd239('0x2f')],'name':_0x46f4f8[_0xd239('0x2e')]['user_name'][_0xd239('0x2f')]});}}function getEndUser(_0x2ab06b,_0x227749,_0x481d87,_0x3f8fc6){logger[_0xd239('0xe')](_0xd239('0x34'),_0x481d87);return request({'form':{'method':_0xd239('0x35'),'input_type':_0xd239('0x27'),'response_type':_0xd239('0x27'),'rest_data':JSON[_0xd239('0x20')]({'session':_0x3f8fc6['id'],'module_name':'Contacts','query':util[_0xd239('0x29')](_0xd239('0x36'),_0x481d87),'order_by':'','offset':'0','select_fields':['id',_0xd239('0xf'),_0xd239('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd239('0x2b')](function(_0x339427){if(_0x339427[_0xd239('0x2c')][_0xd239('0x38')]){var _0x2746f1=_['find'](_0x339427['entry_list'],function(_0x4ccb65){return _0x4ccb65[_0xd239('0x2e')][_0xd239('0x37')]['value']===_0x481d87;});if(_0x2746f1){logger[_0xd239('0xe')](_0xd239('0x39'));return BPromise[_0xd239('0x30')]({'id':_0x2746f1[_0xd239('0x2e')]['id']['value'],'name':_0x2746f1[_0xd239('0x2e')][_0xd239('0xf')][_0xd239('0x2f')],'phone':_0x2746f1[_0xd239('0x2e')][_0xd239('0x37')][_0xd239('0x2f')]});}}else{logger['info'](_0xd239('0x3a'));return request({'form':{'method':'set_entry','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xd239('0x20')]({'session':_0x3f8fc6['id'],'module_name':_0xd239('0x3b'),'name_value_list':[{'name':_0xd239('0x3c'),'value':_0x227749!==_0xd239('0x3d')?_0x227749:util[_0xd239('0x29')](_0xd239('0x3e'),_0x481d87)},{'name':_0xd239('0x37'),'value':_0x481d87}]})}})[_0xd239('0x2b')](function(_0x47a62a){logger['info']('Enduser\x20created.');return BPromise[_0xd239('0x30')]({'id':_0x47a62a['id'],'name':_0x47a62a['entry_list'][_0xd239('0x3c')][_0xd239('0x2f')],'phone':_0x47a62a[_0xd239('0x2c')][_0xd239('0x37')][_0xd239('0x2f')]});});}});}function request(_0xe9df88){logger[_0xd239('0x3f')](_0xd239('0x40'),JSON['stringify'](_0xe9df88));return rp(_['merge'](def,_0xe9df88));}function getTags(_0xbf2488,_0x38c862){var _0x5d986c=[];if(_0xbf2488&&_0xbf2488[_0xd239('0x38')]>0x0){_0x5d986c=_[_0xd239('0x41')](_0xbf2488,_0x38c862);}return _0x5d986c;}function getCustomFields(_0xfa905b,_0x4bdc32){var _0x4da3b0=[];var _0x9a7b80={'custom_fields':[]};if(_0xfa905b[_0xd239('0x38')]>0x0){_['forEach'](_0xfa905b,function(_0x53fde8){if(_0x53fde8[_0xd239('0x42')]==='string'&&_0x53fde8['nameField']&&!_0x53fde8[_0xd239('0x43')]){_0x9a7b80[_0x53fde8['nameField'][_0xd239('0x44')]()]=_0x53fde8[_0xd239('0x45')][_0xd239('0x24')]();}else if(_0x53fde8[_0xd239('0x42')]==='string'&&_0x53fde8['idField']&&_0x53fde8[_0xd239('0x43')]){_0x9a7b80['custom_fields'][_0xd239('0x1d')]({'id':_0x53fde8[_0xd239('0x1e')],'value':_0x53fde8[_0xd239('0x45')][_0xd239('0x24')]()});}else if(_0x53fde8[_0xd239('0x42')]===_0xd239('0x46')&&_0x53fde8['variableName']&&_0x53fde8['idField']&&_0x53fde8[_0xd239('0x43')]){_0x4bdc32[_0x53fde8[_0xd239('0x1c')]]&&_0x9a7b80[_0xd239('0x47')][_0xd239('0x1d')]({'id':_0x53fde8['idField'],'value':_0x4bdc32[_0x53fde8[_0xd239('0x1c')]][_0xd239('0x24')]()});}else if(_0x53fde8[_0xd239('0x42')]===_0xd239('0x48')&&_0x53fde8['Variable']&&_0x53fde8[_0xd239('0x49')]['name']&&_0x53fde8[_0xd239('0x1e')]&&_0x53fde8[_0xd239('0x43')]){_0x4bdc32[_0x53fde8[_0xd239('0x49')][_0xd239('0xf')][_0xd239('0x44')]()]&&_0x9a7b80[_0xd239('0x47')][_0xd239('0x1d')]({'id':_0x53fde8[_0xd239('0x1e')],'value':_0x4bdc32[_0x53fde8[_0xd239('0x49')]['name'][_0xd239('0x44')]()][_0xd239('0x24')]()});}});}return _0x9a7b80;}function getConnection(_0x43dd31){return request({'method':_0xd239('0xc'),'form':{'method':_0xd239('0x4a'),'input_type':_0xd239('0x27'),'response_type':_0xd239('0x27'),'rest_data':JSON[_0xd239('0x20')]({'user_auth':{'user_name':_0x43dd31[_0xd239('0x4b')],'password':_0x43dd31[_0xd239('0x4c')],'encryption':_0xd239('0x4d')},'application':_0xd239('0x4e')})}})[_0xd239('0x2b')](function(_0x254ef4){var _0x3c66f2=_0x254ef4;if(_0x3c66f2['id']){def[_0xd239('0x4f')]=_0x3c66f2['id'];return BPromise[_0xd239('0x30')](_0x3c66f2);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x43dd31['id']));}});}function setRelationship(_0x91c67d,_0x5c0caf,_0x5ad73b,_0x402346){return request({'form':{'method':_0xd239('0x50'),'input_type':'JSON','response_type':_0xd239('0x27'),'rest_data':JSON['stringify']({'session':_0x91c67d['id'],'module_name':'Calls','module_id':_0x5ad73b['id'],'link_field_name':_0x402346,'related_ids':[_0x5c0caf['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xd239('0x51')]=function(_0x555ac6,_0x27437f,_0x51219e,_0x132e3c,_0x400379,_0x33400d){var _0x452148,_0x957077,_0x1357c1,_0x365808;_0x33400d[_0xd239('0x52')]=intUtil[_0xd239('0x53')](_0x33400d[_0xd239('0x52')]);_0x33400d['serverUrl']=intUtil[_0xd239('0x53')](_0x33400d[_0xd239('0x54')]);def[_0xd239('0x55')]=util['format']('%s/service/v4_1/rest.php',_0x33400d[_0xd239('0x52')]);if(_0x400379&&_0x400379['monitor_format']){logger['info'](_0xd239('0x56'),'Recording\x20is\x20enabled!');_0x27437f[_0xd239('0x57')]=util[_0xd239('0x29')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x33400d[_0xd239('0x54')],_0x27437f[_0xd239('0x58')],md5(_0x27437f[_0xd239('0x58')]));}else{_0x27437f[_0xd239('0x57')]='';}return getConnection(_0x33400d)[_0xd239('0x2b')](function(_0x815d1a){_0x365808=_0x815d1a;return getUser(_0x33400d,_0x132e3c[_0xd239('0xf')],_0x365808);})[_0xd239('0x2b')](function(_0x34223b){_0x452148=_0x34223b;logger['info']('The\x20User\x20ID\x20is:',_0x452148['id']);return getEndUser(_0x33400d,_0x27437f[_0xd239('0x59')],_0x27437f[_0xd239('0x5a')],_0x365808);})[_0xd239('0x2b')](function(_0x19ca1a){_0x957077=_0x19ca1a;logger[_0xd239('0xe')](_0xd239('0x5b'),_0x957077['id']);return getTicket(_0x33400d,_0x452148,_0x957077,_0x51219e,_0x27437f,_0x51219e[_0xd239('0x5c')],_0x365808,'Inbound');})['then'](function(_0x3f0d93){_0x1357c1=_0x3f0d93;logger[_0xd239('0xe')](_0xd239('0x5d'));logger[_0xd239('0xe')](_0xd239('0x5e'),_0x1357c1['id']);return setRelationship(_0x365808,_0x452148,_0x1357c1,_0xd239('0x5f'));})[_0xd239('0x2b')](function(){return setRelationship(_0x365808,_0x957077,_0x1357c1,_0xd239('0x60'));})[_0xd239('0x2b')](function(){return getServerInfo(_0x365808);})[_0xd239('0x2b')](function(_0x25c9bb){var _0x43e816=parseInt(_0x25c9bb[_0xd239('0x61')]['charAt'](0x0));var _0x55a1c7=util['format'](_0xd239('0x62'),_0x33400d[_0xd239('0x52')],_0x1357c1['id']);if(_0x43e816>0x6){_0x55a1c7=util['format'](_0xd239('0x63'),_0x33400d[_0xd239('0x52')],_0x1357c1['id']);}logger[_0xd239('0xe')](_0xd239('0x56'),_0xd239('0x64'));emit(util['format'](_0xd239('0x65'),_0x132e3c[_0xd239('0xf')]),_0xd239('0x66'),{'uri':_0x55a1c7});})[_0xd239('0x67')](function(_0x5a2298){logger[_0xd239('0x68')]('[QUEUE]',JSON[_0xd239('0x20')](_0x5a2298));});};exports['outbound']=function(_0x21430c,_0x1120e2,_0x2495c8,_0x9844a2,_0x1b3de4,_0x588fe3,_0xe19b17){var _0x53a3ec,_0x165202,_0x1cca99,_0xed473;_0x588fe3[_0xd239('0x52')]=intUtil['stripTrailingSlash'](_0x588fe3[_0xd239('0x52')]);_0x588fe3[_0xd239('0x54')]=intUtil[_0xd239('0x53')](_0x588fe3[_0xd239('0x54')]);def[_0xd239('0x55')]=util[_0xd239('0x29')]('%s/service/v4_1/rest.php',_0x588fe3[_0xd239('0x52')]);if(_0xe19b17&&_0xe19b17[_0xd239('0x69')]&&_0xe19b17[_0xd239('0x69')]!=='none'){logger[_0xd239('0xe')](_0xd239('0x6a'),_0xd239('0x6b'));_0x1120e2[_0xd239('0x57')]=util[_0xd239('0x29')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x588fe3[_0xd239('0x54')],_0x1120e2[_0xd239('0x58')],md5(_0x1120e2[_0xd239('0x58')]));}return getConnection(_0x588fe3)[_0xd239('0x2b')](function(_0x350730){_0xed473=_0x350730;return getUser(_0x588fe3,_0x9844a2[_0xd239('0xf')],_0xed473);})[_0xd239('0x2b')](function(_0x4e1b43){_0x53a3ec=_0x4e1b43;logger[_0xd239('0xe')](_0xd239('0x6c'),_0x53a3ec['id']);return getEndUser(_0x588fe3,_0x1120e2[_0xd239('0x6d')],_0x1120e2['destcalleridnum'],_0xed473);})[_0xd239('0x2b')](function(_0x559310){_0x165202=_0x559310;logger[_0xd239('0xe')](_0xd239('0x5b'),_0x165202['id']);return getTicket(_0x588fe3,_0x53a3ec,_0x165202,_0x2495c8,_0x1120e2,_0x2495c8[_0xd239('0x5c')],_0xed473,_0xd239('0x6e'));})[_0xd239('0x2b')](function(_0x56c29a){_0x1cca99=_0x56c29a;logger[_0xd239('0xe')]('Ticket\x20created!');logger[_0xd239('0xe')]('The\x20Ticket\x20ID\x20is:',_0x1cca99['id']);return setRelationship(_0xed473,_0x53a3ec,_0x1cca99,_0xd239('0x5f'));})['then'](function(){return setRelationship(_0xed473,_0x165202,_0x1cca99,_0xd239('0x60'));})[_0xd239('0x2b')](function(){return getServerInfo(_0xed473);})[_0xd239('0x2b')](function(_0x13f5bb){var _0x417973=parseInt(_0x13f5bb[_0xd239('0x61')][_0xd239('0x6f')](0x0));var _0x15f786=util[_0xd239('0x29')](_0xd239('0x62'),_0x588fe3[_0xd239('0x52')],_0x1cca99['id']);if(_0x417973>0x6){_0x15f786=util['format'](_0xd239('0x63'),_0x588fe3[_0xd239('0x52')],_0x1cca99['id']);}logger[_0xd239('0xe')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd239('0x29')](_0xd239('0x65'),_0x9844a2[_0xd239('0xf')]),_0xd239('0x66'),{'uri':_0x15f786});})['catch'](function(_0x58df1d){logger[_0xd239('0x68')](_0xd239('0x6a'),JSON[_0xd239('0x20')](_0x58df1d));});};exports[_0xd239('0x70')]=function(_0x479781,_0x166138,_0x4e44cf,_0x5c60cc,_0x1bcee2,_0x1e3f8e){var _0x367748,_0x23766e,_0x46e9bd,_0x8b0a3c;_0x1e3f8e[_0xd239('0x52')]=intUtil[_0xd239('0x53')](_0x1e3f8e[_0xd239('0x52')]);_0x1e3f8e[_0xd239('0x54')]=intUtil['stripTrailingSlash'](_0x1e3f8e['serverUrl']);def[_0xd239('0x55')]=util[_0xd239('0x29')](_0xd239('0x71'),_0x1e3f8e[_0xd239('0x52')]);if(_0x1bcee2&&_0x1bcee2[_0xd239('0x72')]){logger[_0xd239('0xe')]('['+_0x166138['lastevent'][_0xd239('0x73')]()+']',_0xd239('0x6b'));_0x166138[_0xd239('0x57')]=util[_0xd239('0x29')](_0xd239('0x74'),_0x1e3f8e['serverUrl'],_0x166138[_0xd239('0x58')],md5(_0x166138[_0xd239('0x58')]));}else{_0x166138[_0xd239('0x57')]='';}return getConnection(_0x1e3f8e)[_0xd239('0x2b')](function(_0x53adc2){_0x8b0a3c=_0x53adc2;if(!_[_0xd239('0x28')](_0x5c60cc)){return getUser(_0x1e3f8e,_0x5c60cc['name'],_0x8b0a3c);}else{return getUser(_0x1e3f8e,null,_0x8b0a3c);}})[_0xd239('0x2b')](function(_0xf4d17a){_0x367748=_0xf4d17a;logger[_0xd239('0xe')](_0xd239('0x6c'),_0x367748['id']);return getEndUser(_0x1e3f8e,_0x166138[_0xd239('0x59')],_0x166138[_0xd239('0x5a')],_0x8b0a3c);})['then'](function(_0xf70443){_0x23766e=_0xf70443;logger[_0xd239('0xe')](_0xd239('0x5b'),_0x23766e['id']);return getTicket(_0x1e3f8e,_0x367748,_0x23766e,_0x4e44cf,_0x166138,_0x4e44cf[_0xd239('0x5c')],_0x8b0a3c,_0xd239('0x75'));})['then'](function(_0x34d9e5){_0x46e9bd=_0x34d9e5;logger['info']('Ticket\x20created!');logger[_0xd239('0xe')](_0xd239('0x5e'),_0x46e9bd['id']);return setRelationship(_0x8b0a3c,_0x367748,_0x46e9bd,'users');})[_0xd239('0x2b')](function(){return setRelationship(_0x8b0a3c,_0x23766e,_0x46e9bd,_0xd239('0x60'));})[_0xd239('0x2b')](function(){return getServerInfo(_0x8b0a3c);})[_0xd239('0x67')](function(_0x13672c){logger[_0xd239('0x68')]('['+_0x166138['lastevent'][_0xd239('0x73')]()+']',JSON[_0xd239('0x20')](_0x13672c));});}; \ 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 0090870..1fdbdbc 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 _0xb316=['variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','join','validateEmail','isNil','test','lodash','util','getString','length','sortBy','type','string','push','content','variable'];(function(_0x2c2857,_0x36e298){var _0x38d065=function(_0xba059f){while(--_0xba059f){_0x2c2857['push'](_0x2c2857['shift']());}};_0x38d065(++_0x36e298);}(_0xb316,0x1e4));var _0x6b31=function(_0x1a3ceb,_0x3acf0d){_0x1a3ceb=_0x1a3ceb-0x0;var _0x58e57e=_0xb316[_0x1a3ceb];return _0x58e57e;};'use strict';var _=require(_0x6b31('0x0'));var util=require(_0x6b31('0x1'));exports[_0x6b31('0x2')]=function(_0x24f6ad,_0x2407de,_0x39ab91){var _0x275f04=[];if(_0x24f6ad[_0x6b31('0x3')]>0x0){var _0xc167d9=_[_0x6b31('0x4')](_0x24f6ad,['id']);for(var _0x1adc36=0x0;_0x1adc36<_0xc167d9[_0x6b31('0x3')];_0x1adc36++){var _0x26a203=_0xc167d9[_0x1adc36];if(_0x26a203[_0x6b31('0x5')]===_0x6b31('0x6')){_0x275f04[_0x6b31('0x7')](_0x26a203[_0x6b31('0x8')]);}else if(_0x26a203[_0x6b31('0x5')]===_0x6b31('0x9')&&_0x26a203[_0x6b31('0xa')]){_0x2407de[_0x26a203[_0x6b31('0xa')]]&&_0x275f04[_0x6b31('0x7')](_0x2407de[_0x26a203[_0x6b31('0xa')]][_0x6b31('0xb')]());}else if(_0x26a203[_0x6b31('0x5')]===_0x6b31('0xc')&&_0x26a203[_0x6b31('0xd')]&&_0x26a203[_0x6b31('0xd')][_0x6b31('0xe')]){_0x2407de[_0x26a203[_0x6b31('0xd')]['name'][_0x6b31('0xf')]()]&&_0x275f04[_0x6b31('0x7')](_0x2407de[_0x26a203['Variable'][_0x6b31('0xe')][_0x6b31('0xf')]()][_0x6b31('0xb')]());}else if(_0x26a203['type']===_0x6b31('0x10')){if(_0x26a203[_0x6b31('0x11')]===_0x6b31('0x6')&&_0x26a203[_0x6b31('0x12')]){_0x275f04[_0x6b31('0x7')](util[_0x6b31('0x13')](_0x6b31('0x14'),_0x26a203[_0x6b31('0x12')],_0x26a203[_0x6b31('0x15')]));}else if(_0x26a203[_0x6b31('0x11')]==='variable'&&_0x26a203[_0x6b31('0xa')]&&_0x26a203[_0x6b31('0x12')]){_0x2407de[_0x26a203[_0x6b31('0xa')]]&&_0x275f04['push'](util[_0x6b31('0x13')](_0x6b31('0x14'),_0x26a203['key'],_0x2407de[_0x26a203[_0x6b31('0xa')]]));}else if(_0x26a203[_0x6b31('0x11')]==='customVariable'&&_0x26a203[_0x6b31('0xd')]&&_0x26a203[_0x6b31('0xd')][_0x6b31('0xe')]&&_0x26a203[_0x6b31('0x12')]){_0x2407de[_0x26a203[_0x6b31('0xd')][_0x6b31('0xe')]['toLowerCase']()]&&_0x275f04[_0x6b31('0x7')](util['format'](_0x6b31('0x14'),_0x26a203[_0x6b31('0x12')],_0x2407de[_0x26a203[_0x6b31('0xd')]['name'][_0x6b31('0xf')]()]));}}}}return _0x275f04[_0x6b31('0x16')](_0x39ab91);};exports['stripTrailingSlash']=function(_0x205748){var _0x4ae42b=_0x205748['slice'](-0x1);if(_0x4ae42b==='/'){_0x205748=_0x205748['substring'](0x0,_0x205748['lastIndexOf'](_0x4ae42b));}return _0x205748;};exports[_0x6b31('0x17')]=function(_0x23b322){if(!_[_0x6b31('0x18')](_0x23b322)&&_0x23b322!==''){var _0x283567=/^(([^<>()\[\]\\.,;:\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 _0x283567[_0x6b31('0x19')](String(_0x23b322)[_0x6b31('0xf')]());}else{return![];}}; \ No newline at end of file +var _0x7a7f=['format','%s:\x20%s','keyContent','variable','join','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','sortBy','length','content','type','variableName','toString','Variable','name','toLowerCase','push','keyType','string','key'];(function(_0x1dba13,_0x3a2d7d){var _0x17eabf=function(_0x42de16){while(--_0x42de16){_0x1dba13['push'](_0x1dba13['shift']());}};_0x17eabf(++_0x3a2d7d);}(_0x7a7f,0x92));var _0xf7a7=function(_0x24e794,_0x22dc4e){_0x24e794=_0x24e794-0x0;var _0x2fc8dc=_0x7a7f[_0x24e794];return _0x2fc8dc;};'use strict';var _=require(_0xf7a7('0x0'));var util=require(_0xf7a7('0x1'));exports[_0xf7a7('0x2')]=function(_0x50319d,_0x1ede8a,_0x297c74){var _0x12bb7a=[];if(_0x50319d['length']>0x0){var _0x17428a=_[_0xf7a7('0x3')](_0x50319d,['id']);for(var _0x46423=0x0;_0x46423<_0x17428a[_0xf7a7('0x4')];_0x46423++){var _0x451265=_0x17428a[_0x46423];if(_0x451265['type']==='string'){_0x12bb7a['push'](_0x451265[_0xf7a7('0x5')]);}else if(_0x451265[_0xf7a7('0x6')]==='variable'&&_0x451265[_0xf7a7('0x7')]){_0x1ede8a[_0x451265['variableName']]&&_0x12bb7a['push'](_0x1ede8a[_0x451265['variableName']][_0xf7a7('0x8')]());}else if(_0x451265[_0xf7a7('0x6')]==='customVariable'&&_0x451265[_0xf7a7('0x9')]&&_0x451265[_0xf7a7('0x9')][_0xf7a7('0xa')]){_0x1ede8a[_0x451265[_0xf7a7('0x9')]['name'][_0xf7a7('0xb')]()]&&_0x12bb7a[_0xf7a7('0xc')](_0x1ede8a[_0x451265[_0xf7a7('0x9')][_0xf7a7('0xa')][_0xf7a7('0xb')]()][_0xf7a7('0x8')]());}else if(_0x451265[_0xf7a7('0x6')]==='keyValue'){if(_0x451265[_0xf7a7('0xd')]===_0xf7a7('0xe')&&_0x451265[_0xf7a7('0xf')]){_0x12bb7a[_0xf7a7('0xc')](util[_0xf7a7('0x10')](_0xf7a7('0x11'),_0x451265[_0xf7a7('0xf')],_0x451265[_0xf7a7('0x12')]));}else if(_0x451265[_0xf7a7('0xd')]===_0xf7a7('0x13')&&_0x451265['variableName']&&_0x451265[_0xf7a7('0xf')]){_0x1ede8a[_0x451265['variableName']]&&_0x12bb7a[_0xf7a7('0xc')](util[_0xf7a7('0x10')]('%s:\x20%s',_0x451265[_0xf7a7('0xf')],_0x1ede8a[_0x451265['variableName']]));}else if(_0x451265[_0xf7a7('0xd')]==='customVariable'&&_0x451265[_0xf7a7('0x9')]&&_0x451265[_0xf7a7('0x9')]['name']&&_0x451265[_0xf7a7('0xf')]){_0x1ede8a[_0x451265[_0xf7a7('0x9')][_0xf7a7('0xa')][_0xf7a7('0xb')]()]&&_0x12bb7a[_0xf7a7('0xc')](util[_0xf7a7('0x10')]('%s:\x20%s',_0x451265['key'],_0x1ede8a[_0x451265[_0xf7a7('0x9')][_0xf7a7('0xa')][_0xf7a7('0xb')]()]));}}}}return _0x12bb7a[_0xf7a7('0x14')](_0x297c74);};exports['stripTrailingSlash']=function(_0x31c4f1){var _0x4c567b=_0x31c4f1[_0xf7a7('0x15')](-0x1);if(_0x4c567b==='/'){_0x31c4f1=_0x31c4f1[_0xf7a7('0x16')](0x0,_0x31c4f1[_0xf7a7('0x17')](_0x4c567b));}return _0x31c4f1;};exports[_0xf7a7('0x18')]=function(_0x296744){if(!_[_0xf7a7('0x19')](_0x296744)&&_0x296744!==''){var _0x28c464=/^(([^<>()\[\]\\.,;:\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 _0x28c464[_0xf7a7('0x1a')](String(_0x296744)[_0xf7a7('0xb')]());}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 59a0b11..ee7b4c7 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x5f04d0,_0x2d5fb6){var _0x59d756=function(_0x24cacb){while(--_0x24cacb){_0x5f04d0['push'](_0x5f04d0['shift']());}};_0x59d756(++_0x2d5fb6);}(_0x9c44,0x178));var _0x49c4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ 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 f3e7ffd..c8e2740 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 _0x5427=['../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','POST','merge','Tags','name','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','results','agent','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','toString','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','content','idField','custom_fields','push','variable','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','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','[QUEUE]','user:%s','trigger:browser:url','replace','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','./util'];(function(_0x14fd3e,_0x1949ae){var _0x3958d5=function(_0x280aaf){while(--_0x280aaf){_0x14fd3e['push'](_0x14fd3e['shift']());}};_0x3958d5(++_0x1949ae);}(_0x5427,0x6b));var _0x7542=function(_0x5c3b24,_0x1c030d){_0x5c3b24=_0x5c3b24-0x0;var _0x40e59c=_0x5427[_0x5c3b24];return _0x40e59c;};'use strict';var _=require(_0x7542('0x0'));var rp=require(_0x7542('0x1'));var md5=require(_0x7542('0x2'));var util=require(_0x7542('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7542('0x4'));var config=require(_0x7542('0x5'));var logger=require(_0x7542('0x6'))(_0x7542('0x7'));config[_0x7542('0x8')]=_[_0x7542('0x9')](config[_0x7542('0x8')],{'host':_0x7542('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x4a45da,_0x8c3ce4,_0x362bdf){io['to'](_0x4a45da)[_0x7542('0xb')](_0x8c3ce4,_0x362bdf);}var headers={'Content-Type':_0x7542('0xc'),'Accept':_0x7542('0xc')};function getTicket(_0x3a5847,_0x179110,_0x40efa2,_0x58c84c,_0x3cfa6f){logger[_0x7542('0xd')](_0x7542('0xe'));return request({'uri':util[_0x7542('0xf')]('%s/tickets.json',_0x3a5847[_0x7542('0x10')]),'method':_0x7542('0x11'),'body':{'ticket':_[_0x7542('0x12')]({'requester_id':_0x40efa2['id'],'submitter_id':_0x179110?_0x179110['id']:undefined,'assignee_id':_0x179110?_0x179110['id']:undefined,'tags':getTags(_0x58c84c[_0x7542('0x13')],_0x7542('0x14')),'subject':intUtil[_0x7542('0x15')](_0x58c84c['Subjects'],_0x3cfa6f,'\x20'),'description':intUtil[_0x7542('0x15')](_0x58c84c[_0x7542('0x16')],_0x3cfa6f,'\x0a'),'comment':{'public':![],'body':intUtil[_0x7542('0x15')](_0x58c84c[_0x7542('0x16')],_0x3cfa6f,'\x0a')}},getCustomFields(_0x58c84c[_0x7542('0x17')],_0x3cfa6f))}})[_0x7542('0x18')](function(_0x4024be){logger['info'](_0x7542('0x19'));return _0x4024be[_0x7542('0x1a')];});}function getUser(_0x2af535,_0x4297d9){if(intUtil[_0x7542('0x1b')](_0x4297d9)){logger[_0x7542('0xd')](_0x7542('0x1c'),_0x4297d9);return request({'uri':util[_0x7542('0xf')]('%s/search.json',_0x2af535[_0x7542('0x10')]),'qs':{'query':util[_0x7542('0xf')](_0x7542('0x1d'),_0x4297d9)}})[_0x7542('0x18')](function(_0x359f19){if(_0x359f19['count']){logger['info'](_0x7542('0x1e'));return _[_0x7542('0x1f')](_0x359f19[_0x7542('0x20')],{'email':_0x4297d9,'role':_0x7542('0x21')});}else{logger[_0x7542('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x7542('0xf')]('%s/users/me.json',_0x2af535[_0x7542('0x10')])})[_0x7542('0x18')](function(_0x27b105){logger[_0x7542('0xd')](_0x7542('0x22'));return _0x27b105[_0x7542('0x23')];});}});}else{logger[_0x7542('0xd')](_0x7542('0x24'));return request({'uri':util['format']('%s/users/me.json',_0x2af535[_0x7542('0x10')])})['then'](function(_0x2b8c84){logger[_0x7542('0xd')](_0x7542('0x22'));return _0x2b8c84[_0x7542('0x23')];});}}function getEndUser(_0x2a7848,_0xa96703,_0x5a4ca0){logger[_0x7542('0xd')](_0x7542('0x25'),_0x5a4ca0);return request({'uri':util[_0x7542('0xf')](_0x7542('0x26'),_0x2a7848['remoteUri']),'qs':{'query':util['format'](_0x7542('0x27'),_0x5a4ca0)}})['then'](function(_0xe9a0a8){var _0xce822e;if(_0xe9a0a8['results'][_0x7542('0x28')]){_0xe9a0a8['results']=_[_0x7542('0x29')](_0xe9a0a8[_0x7542('0x20')],{'suspended':![],'role':_0x7542('0x2a')});if(_0xe9a0a8[_0x7542('0x20')][_0x7542('0x28')]){_0xce822e=_['first'](_0xe9a0a8[_0x7542('0x20')]);}}if(_0xce822e){logger[_0x7542('0xd')]('Enduser\x20found!');return _0xce822e;}else{logger['info'](_0x7542('0x2b'));return request({'uri':util[_0x7542('0xf')]('%s/users.json',_0x2a7848[_0x7542('0x10')]),'method':'POST','body':{'user':{'role':_0x7542('0x2a'),'name':util[_0x7542('0xf')](_0x7542('0x2c'),_0xa96703||_0x5a4ca0),'phone':_0x5a4ca0}}})['then'](function(_0x2347e5){logger['info'](_0x7542('0x2d'));return _0x2347e5[_0x7542('0x23')];});}});}function getAuth(_0x594ab8){var _0x136df6;if(_0x594ab8[_0x7542('0x2e')]===_0x7542('0x2f')){_0x136df6=util[_0x7542('0xf')](_0x7542('0x30'),_0x594ab8[_0x7542('0x31')],_0x594ab8[_0x7542('0x2f')]);}else if(_0x594ab8[_0x7542('0x2e')]===_0x7542('0x32')){_0x136df6=util[_0x7542('0xf')](_0x7542('0x33'),_0x594ab8[_0x7542('0x31')],_0x594ab8[_0x7542('0x32')]);}return util[_0x7542('0xf')]('Basic\x20%s',new Buffer(_0x136df6)[_0x7542('0x34')]('base64'));}function request(_0x203f8a){logger[_0x7542('0x35')](_0x7542('0x36'),JSON[_0x7542('0x37')](_0x203f8a));return rp(_[_0x7542('0x9')](_0x203f8a,{'method':_0x7542('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x4fdc2d,_0x36eaea){var _0xfaa085=[];if(_0x4fdc2d&&_0x4fdc2d['length']>0x0){_0xfaa085=_[_0x7542('0x39')](_0x4fdc2d,_0x36eaea);}return _0xfaa085;}function getCustomFields(_0x49152b,_0x3b3ce0){var _0x12bbda=[];var _0x510a24={'custom_fields':[]};if(_0x49152b['length']>0x0){_[_0x7542('0x3a')](_0x49152b,function(_0x4e1d2b){if(_[_0x7542('0x3b')]([_0x7542('0x3c'),_0x7542('0x3d')],_0x4e1d2b[_0x7542('0x3e')])&&_0x4e1d2b[_0x7542('0x3f')]&&!_0x4e1d2b[_0x7542('0x40')]){_0x510a24[_0x4e1d2b[_0x7542('0x3f')]['toLowerCase']()]=_0x4e1d2b[_0x7542('0x41')][_0x7542('0x34')]();}else if(_['includes']([_0x7542('0x3c'),_0x7542('0x3d')],_0x4e1d2b[_0x7542('0x3e')])&&_0x4e1d2b[_0x7542('0x42')]&&_0x4e1d2b[_0x7542('0x40')]){_0x510a24[_0x7542('0x43')][_0x7542('0x44')]({'id':_0x4e1d2b['idField'],'value':_0x4e1d2b['content'][_0x7542('0x34')]()});}else if(_0x4e1d2b['type']===_0x7542('0x45')&&_0x4e1d2b[_0x7542('0x46')]&&_0x4e1d2b[_0x7542('0x42')]&&_0x4e1d2b[_0x7542('0x40')]){_0x3b3ce0[_0x4e1d2b[_0x7542('0x46')]]&&_0x510a24[_0x7542('0x43')][_0x7542('0x44')]({'id':_0x4e1d2b[_0x7542('0x42')],'value':_0x3b3ce0[_0x4e1d2b[_0x7542('0x46')]][_0x7542('0x34')]()});}else if(_0x4e1d2b['type']===_0x7542('0x47')&&_0x4e1d2b[_0x7542('0x48')]&&_0x4e1d2b[_0x7542('0x48')][_0x7542('0x14')]&&_0x4e1d2b[_0x7542('0x42')]&&_0x4e1d2b[_0x7542('0x40')]){_0x3b3ce0[_0x4e1d2b[_0x7542('0x48')][_0x7542('0x14')][_0x7542('0x49')]()]&&_0x510a24[_0x7542('0x43')][_0x7542('0x44')]({'id':_0x4e1d2b[_0x7542('0x42')],'value':_0x3b3ce0[_0x4e1d2b[_0x7542('0x48')][_0x7542('0x14')][_0x7542('0x49')]()][_0x7542('0x34')]()});}});}return _0x510a24;}exports[_0x7542('0x4a')]=function(_0x210c6e,_0x16769e,_0x2fc404,_0x44ad0e,_0x5e7e2e,_0x829afb){var _0x4f4de1,_0x312730;_0x829afb[_0x7542('0x10')]=intUtil[_0x7542('0x4b')](_0x829afb['remoteUri']);_0x829afb[_0x7542('0x4c')]=intUtil['stripTrailingSlash'](_0x829afb[_0x7542('0x4c')]);if(_0x5e7e2e&&_0x5e7e2e[_0x7542('0x4d')]){logger[_0x7542('0xd')]('[QUEUE]',_0x7542('0x4e'));_0x16769e[_0x7542('0x4f')]=util[_0x7542('0xf')](_0x7542('0x50'),_0x829afb['serverUrl'],_0x16769e[_0x7542('0x51')],md5(_0x16769e[_0x7542('0x51')]));}else{_0x16769e[_0x7542('0x4f')]='';}headers[_0x7542('0x52')]=getAuth(_0x829afb);return getUser(_0x829afb,_0x44ad0e[_0x7542('0x53')])[_0x7542('0x18')](function(_0x52fede){_0x4f4de1=_0x52fede;logger[_0x7542('0xd')](_0x7542('0x54'),_0x4f4de1['id']);return getEndUser(_0x829afb,_0x16769e[_0x7542('0x55')],_0x16769e[_0x7542('0x56')]);})[_0x7542('0x18')](function(_0x52edbf){_0x312730=_0x52edbf;logger[_0x7542('0xd')](_0x7542('0x57'),_0x312730['id']);return getTicket(_0x829afb,_0x4f4de1,_0x312730,_0x2fc404,_0x16769e);})[_0x7542('0x18')](function(_0x558a18){if(_0x558a18){logger[_0x7542('0xd')](_0x7542('0x58'),_0x558a18['id']);switch(_0x829afb[_0x7542('0x3e')]){case _0x7542('0x59'):logger['info']('[QUEUE]',_0x7542('0x5a'));return request({'uri':util[_0x7542('0xf')](_0x7542('0x5b'),_0x829afb['remoteUri'],_0x4f4de1['id'],_0x558a18['id']),'method':_0x7542('0x11')});case _0x7542('0x5c'):logger[_0x7542('0xd')](_0x7542('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7542('0xf')](_0x7542('0x5e'),_0x44ad0e[_0x7542('0x14')]),_0x7542('0x5f'),{'uri':util[_0x7542('0xf')]('%s/agent/tickets/%s',_0x829afb['remoteUri'][_0x7542('0x60')](_0x7542('0x61'),''),_0x558a18['id'])});break;default:logger[_0x7542('0x62')](_0x7542('0x5d'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x7542('0x63')](function(_0x1fa6a3){logger[_0x7542('0x62')](_0x7542('0x64'),util[_0x7542('0x65')](_0x1fa6a3,{'showHidden':!![],'depth':null}));});};exports[_0x7542('0x66')]=function(_0x190593,_0x582505,_0x2e66c8,_0x1f483b,_0x207134,_0xcc4b4d,_0x1f18fa){var _0x6946dc,_0x39cb5b;_0xcc4b4d[_0x7542('0x10')]=intUtil['stripTrailingSlash'](_0xcc4b4d['remoteUri']);_0xcc4b4d[_0x7542('0x4c')]=intUtil['stripTrailingSlash'](_0xcc4b4d[_0x7542('0x4c')]);if(_0x1f18fa&&_0x1f18fa[_0x7542('0x67')]&&_0x1f18fa[_0x7542('0x67')]!==_0x7542('0x68')){logger[_0x7542('0xd')](_0x7542('0x69'),'Recording\x20is\x20enabled!');_0x582505[_0x7542('0x4f')]=util[_0x7542('0xf')](_0x7542('0x50'),_0xcc4b4d[_0x7542('0x4c')],_0x582505[_0x7542('0x51')],md5(_0x582505[_0x7542('0x51')]));}headers[_0x7542('0x52')]=getAuth(_0xcc4b4d);return getUser(_0xcc4b4d,_0x1f483b['email'])[_0x7542('0x18')](function(_0x4d92ab){_0x6946dc=_0x4d92ab;logger[_0x7542('0xd')]('The\x20User\x20ID\x20is:',_0x6946dc['id']);return getEndUser(_0xcc4b4d,_0x582505[_0x7542('0x6a')],_0x582505['destcalleridnum']);})[_0x7542('0x18')](function(_0x340650){_0x39cb5b=_0x340650;logger[_0x7542('0xd')](_0x7542('0x57'),_0x39cb5b['id']);return getTicket(_0xcc4b4d,_0x6946dc,_0x39cb5b,_0x2e66c8,_0x582505);})[_0x7542('0x18')](function(_0x5db339){if(_0x5db339){logger[_0x7542('0xd')]('The\x20Ticket\x20ID\x20is:',_0x5db339['id']);switch(_0xcc4b4d[_0x7542('0x3e')]){case _0x7542('0x59'):logger[_0x7542('0xd')](_0x7542('0x69'),_0x7542('0x5a'));return request({'uri':util[_0x7542('0xf')](_0x7542('0x5b'),_0xcc4b4d[_0x7542('0x10')],_0x6946dc['id'],_0x5db339['id']),'method':_0x7542('0x11')});case'newTab':logger[_0x7542('0xd')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7542('0xf')](_0x7542('0x5e'),_0x1f483b[_0x7542('0x14')]),_0x7542('0x5f'),{'uri':util[_0x7542('0xf')](_0x7542('0x6b'),_0xcc4b4d[_0x7542('0x10')][_0x7542('0x60')](_0x7542('0x61'),''),_0x5db339['id'])});break;default:logger[_0x7542('0x62')](_0x7542('0x69'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x7542('0x63')](function(_0x2962b3){logger[_0x7542('0x62')](_0x7542('0x6c'),util[_0x7542('0x65')](_0x2962b3,{'showHidden':!![],'depth':null}));});};exports[_0x7542('0x6d')]=function(_0x54e547,_0x19a04c,_0x34c61c,_0x4122f7,_0x6021fb,_0x3d5c48){var _0x538b81,_0x1846fc;_0x3d5c48['remoteUri']=intUtil[_0x7542('0x4b')](_0x3d5c48[_0x7542('0x10')]);_0x3d5c48[_0x7542('0x4c')]=intUtil[_0x7542('0x4b')](_0x3d5c48[_0x7542('0x4c')]);if(_0x6021fb&&_0x6021fb[_0x7542('0x4d')]){logger[_0x7542('0xd')]('['+_0x19a04c[_0x7542('0x6e')][_0x7542('0x6f')]()+']',_0x7542('0x4e'));_0x19a04c['recordingURL']=util[_0x7542('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3d5c48[_0x7542('0x4c')],_0x19a04c[_0x7542('0x51')],md5(_0x19a04c[_0x7542('0x51')]));}else{_0x19a04c[_0x7542('0x4f')]='';}headers[_0x7542('0x52')]=getAuth(_0x3d5c48);return getUser(_0x3d5c48)[_0x7542('0x18')](function(_0x286ad7){_0x538b81=_0x286ad7;logger[_0x7542('0xd')]('The\x20User\x20ID\x20is:',_0x538b81['id']);return getEndUser(_0x3d5c48,_0x19a04c[_0x7542('0x55')],_0x19a04c[_0x7542('0x56')]);})[_0x7542('0x18')](function(_0x20c3e2){_0x1846fc=_0x20c3e2;logger[_0x7542('0xd')](_0x7542('0x57'),_0x1846fc['id']);return getTicket(_0x3d5c48,_0x538b81,_0x1846fc,_0x34c61c,_0x19a04c);})[_0x7542('0x18')](function(_0x26ae3a){if(_0x26ae3a){logger[_0x7542('0xd')](_0x7542('0x58'),_0x26ae3a['id']);}})[_0x7542('0x63')](function(_0x4f927f){logger[_0x7542('0x62')]('['+_0x19a04c[_0x7542('0x6e')][_0x7542('0x6f')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x7542('0x65')](_0x4f927f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc138=['Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','password','%s:%s','username','%s/token:%s','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','defaults','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','variableName','custom_fields','customVariable','Variable','push','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','POST','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','inspect','outbound','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridnum','The\x20Ticket\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','emit','application/json','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','merge','Tags','name','getString','Descriptions','Fields','then','ticket','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','count','info','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first'];(function(_0x418ad2,_0x2eb809){var _0x53e614=function(_0x32fc8e){while(--_0x32fc8e){_0x418ad2['push'](_0x418ad2['shift']());}};_0x53e614(++_0x2eb809);}(_0xc138,0xc1));var _0x8c13=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc138[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x8c13('0x0'));var rp=require(_0x8c13('0x1'));var md5=require('md5');var util=require(_0x8c13('0x2'));var Redis=require(_0x8c13('0x3'));var intUtil=require(_0x8c13('0x4'));var config=require(_0x8c13('0x5'));var logger=require(_0x8c13('0x6'))(_0x8c13('0x7'));config[_0x8c13('0x8')]=_['defaults'](config['redis'],{'host':_0x8c13('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8c13('0x8')]));function emit(_0x3dd4bc,_0x18dd8d,_0x21b271){io['to'](_0x3dd4bc)[_0x8c13('0xa')](_0x18dd8d,_0x21b271);}var headers={'Content-Type':'application/json','Accept':_0x8c13('0xb')};function getTicket(_0x298457,_0x548908,_0x388c71,_0x5c565f,_0x526903){logger['info'](_0x8c13('0xc'));return request({'uri':util['format'](_0x8c13('0xd'),_0x298457[_0x8c13('0xe')]),'method':'POST','body':{'ticket':_[_0x8c13('0xf')]({'requester_id':_0x388c71['id'],'submitter_id':_0x548908?_0x548908['id']:undefined,'assignee_id':_0x548908?_0x548908['id']:undefined,'tags':getTags(_0x5c565f[_0x8c13('0x10')],_0x8c13('0x11')),'subject':intUtil[_0x8c13('0x12')](_0x5c565f['Subjects'],_0x526903,'\x20'),'description':intUtil['getString'](_0x5c565f[_0x8c13('0x13')],_0x526903,'\x0a'),'comment':{'public':![],'body':intUtil[_0x8c13('0x12')](_0x5c565f[_0x8c13('0x13')],_0x526903,'\x0a')}},getCustomFields(_0x5c565f[_0x8c13('0x14')],_0x526903))}})[_0x8c13('0x15')](function(_0x1b0b58){logger['info']('Ticket\x20created!');return _0x1b0b58[_0x8c13('0x16')];});}function getUser(_0x3f368a,_0x446cb6){if(intUtil['validateEmail'](_0x446cb6)){logger['info'](_0x8c13('0x17'),_0x446cb6);return request({'uri':util[_0x8c13('0x18')](_0x8c13('0x19'),_0x3f368a['remoteUri']),'qs':{'query':util[_0x8c13('0x18')](_0x8c13('0x1a'),_0x446cb6)}})['then'](function(_0x4a10b3){if(_0x4a10b3[_0x8c13('0x1b')]){logger[_0x8c13('0x1c')](_0x8c13('0x1d'));return _[_0x8c13('0x1e')](_0x4a10b3[_0x8c13('0x1f')],{'email':_0x446cb6,'role':_0x8c13('0x20')});}else{logger[_0x8c13('0x1c')](_0x8c13('0x21'));return request({'uri':util[_0x8c13('0x18')](_0x8c13('0x22'),_0x3f368a[_0x8c13('0xe')])})[_0x8c13('0x15')](function(_0x4ec1de){logger[_0x8c13('0x1c')]('Admin\x20account\x20selected.');return _0x4ec1de[_0x8c13('0x23')];});}});}else{logger['info'](_0x8c13('0x21'));return request({'uri':util[_0x8c13('0x18')](_0x8c13('0x22'),_0x3f368a[_0x8c13('0xe')])})[_0x8c13('0x15')](function(_0x2fdd4a){logger[_0x8c13('0x1c')](_0x8c13('0x24'));return _0x2fdd4a[_0x8c13('0x23')];});}}function getEndUser(_0x31c4f1,_0x1133c5,_0x48b7f1){logger[_0x8c13('0x1c')](_0x8c13('0x25'),_0x48b7f1);return request({'uri':util[_0x8c13('0x18')](_0x8c13('0x19'),_0x31c4f1[_0x8c13('0xe')]),'qs':{'query':util[_0x8c13('0x18')](_0x8c13('0x26'),_0x48b7f1)}})['then'](function(_0x323480){var _0x5925c0;if(_0x323480[_0x8c13('0x1f')][_0x8c13('0x27')]){_0x323480[_0x8c13('0x1f')]=_[_0x8c13('0x28')](_0x323480[_0x8c13('0x1f')],{'suspended':![],'role':_0x8c13('0x29')});if(_0x323480[_0x8c13('0x1f')][_0x8c13('0x27')]){_0x5925c0=_[_0x8c13('0x2a')](_0x323480['results']);}}if(_0x5925c0){logger[_0x8c13('0x1c')](_0x8c13('0x2b'));return _0x5925c0;}else{logger[_0x8c13('0x1c')](_0x8c13('0x2c'));return request({'uri':util['format'](_0x8c13('0x2d'),_0x31c4f1['remoteUri']),'method':'POST','body':{'user':{'role':_0x8c13('0x29'),'name':util[_0x8c13('0x18')](_0x8c13('0x2e'),_0x1133c5||_0x48b7f1),'phone':_0x48b7f1}}})[_0x8c13('0x15')](function(_0x3a499f){logger[_0x8c13('0x1c')]('Enduser\x20created.');return _0x3a499f[_0x8c13('0x23')];});}});}function getAuth(_0x4e1591){var _0x34b8f6;if(_0x4e1591[_0x8c13('0x2f')]===_0x8c13('0x30')){_0x34b8f6=util['format'](_0x8c13('0x31'),_0x4e1591[_0x8c13('0x32')],_0x4e1591['password']);}else if(_0x4e1591['authType']==='token'){_0x34b8f6=util[_0x8c13('0x18')](_0x8c13('0x33'),_0x4e1591['username'],_0x4e1591[_0x8c13('0x34')]);}return util[_0x8c13('0x18')](_0x8c13('0x35'),new Buffer(_0x34b8f6)[_0x8c13('0x36')](_0x8c13('0x37')));}function request(_0x4b9004){logger[_0x8c13('0x38')](_0x8c13('0x39'),JSON[_0x8c13('0x3a')](_0x4b9004));return rp(_[_0x8c13('0x3b')](_0x4b9004,{'method':_0x8c13('0x3c'),'headers':headers,'json':!![]}));}function getTags(_0x5d6e6e,_0x5d2863){var _0x1c576c=[];if(_0x5d6e6e&&_0x5d6e6e[_0x8c13('0x27')]>0x0){_0x1c576c=_[_0x8c13('0x3d')](_0x5d6e6e,_0x5d2863);}return _0x1c576c;}function getCustomFields(_0x31a736,_0x46dca6){var _0x3f91d7=[];var _0x3671d5={'custom_fields':[]};if(_0x31a736['length']>0x0){_[_0x8c13('0x3e')](_0x31a736,function(_0x305d7a){if(_[_0x8c13('0x3f')]([_0x8c13('0x40'),_0x8c13('0x41')],_0x305d7a[_0x8c13('0x42')])&&_0x305d7a[_0x8c13('0x43')]&&!_0x305d7a[_0x8c13('0x44')]){_0x3671d5[_0x305d7a[_0x8c13('0x43')][_0x8c13('0x45')]()]=_0x305d7a[_0x8c13('0x46')][_0x8c13('0x36')]();}else if(_[_0x8c13('0x3f')]([_0x8c13('0x40'),_0x8c13('0x41')],_0x305d7a[_0x8c13('0x42')])&&_0x305d7a[_0x8c13('0x47')]&&_0x305d7a[_0x8c13('0x44')]){_0x3671d5['custom_fields']['push']({'id':_0x305d7a[_0x8c13('0x47')],'value':_0x305d7a[_0x8c13('0x46')][_0x8c13('0x36')]()});}else if(_0x305d7a['type']==='variable'&&_0x305d7a['variableName']&&_0x305d7a['idField']&&_0x305d7a[_0x8c13('0x44')]){_0x46dca6[_0x305d7a[_0x8c13('0x48')]]&&_0x3671d5[_0x8c13('0x49')]['push']({'id':_0x305d7a[_0x8c13('0x47')],'value':_0x46dca6[_0x305d7a[_0x8c13('0x48')]][_0x8c13('0x36')]()});}else if(_0x305d7a[_0x8c13('0x42')]===_0x8c13('0x4a')&&_0x305d7a[_0x8c13('0x4b')]&&_0x305d7a[_0x8c13('0x4b')][_0x8c13('0x11')]&&_0x305d7a[_0x8c13('0x47')]&&_0x305d7a['customField']){_0x46dca6[_0x305d7a[_0x8c13('0x4b')][_0x8c13('0x11')][_0x8c13('0x45')]()]&&_0x3671d5[_0x8c13('0x49')][_0x8c13('0x4c')]({'id':_0x305d7a[_0x8c13('0x47')],'value':_0x46dca6[_0x305d7a[_0x8c13('0x4b')][_0x8c13('0x11')]['toLowerCase']()]['toString']()});}});}return _0x3671d5;}exports[_0x8c13('0x4d')]=function(_0x249ec8,_0x46c2c7,_0x4f2f42,_0x258c87,_0x55e0bc,_0x2cf402){var _0x9b9939,_0x43686e;_0x2cf402[_0x8c13('0xe')]=intUtil[_0x8c13('0x4e')](_0x2cf402[_0x8c13('0xe')]);_0x2cf402[_0x8c13('0x4f')]=intUtil[_0x8c13('0x4e')](_0x2cf402[_0x8c13('0x4f')]);if(_0x55e0bc&&_0x55e0bc[_0x8c13('0x50')]){logger['info']('[QUEUE]',_0x8c13('0x51'));_0x46c2c7[_0x8c13('0x52')]=util['format'](_0x8c13('0x53'),_0x2cf402[_0x8c13('0x4f')],_0x46c2c7[_0x8c13('0x54')],md5(_0x46c2c7[_0x8c13('0x54')]));}else{_0x46c2c7[_0x8c13('0x52')]='';}headers['Authorization']=getAuth(_0x2cf402);return getUser(_0x2cf402,_0x258c87[_0x8c13('0x55')])[_0x8c13('0x15')](function(_0x2123dc){_0x9b9939=_0x2123dc;logger[_0x8c13('0x1c')](_0x8c13('0x56'),_0x9b9939['id']);return getEndUser(_0x2cf402,_0x46c2c7[_0x8c13('0x57')],_0x46c2c7[_0x8c13('0x58')]);})[_0x8c13('0x15')](function(_0x14fe85){_0x43686e=_0x14fe85;logger[_0x8c13('0x1c')](_0x8c13('0x59'),_0x43686e['id']);return getTicket(_0x2cf402,_0x9b9939,_0x43686e,_0x4f2f42,_0x46c2c7);})[_0x8c13('0x15')](function(_0x34356b){if(_0x34356b){logger[_0x8c13('0x1c')]('The\x20Ticket\x20ID\x20is:',_0x34356b['id']);switch(_0x2cf402[_0x8c13('0x42')]){case _0x8c13('0x5a'):logger[_0x8c13('0x1c')](_0x8c13('0x5b'),_0x8c13('0x5c'));return request({'uri':util[_0x8c13('0x18')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x2cf402[_0x8c13('0xe')],_0x9b9939['id'],_0x34356b['id']),'method':_0x8c13('0x5d')});case _0x8c13('0x5e'):logger[_0x8c13('0x1c')]('[QUEUE]',_0x8c13('0x5f'));emit(util[_0x8c13('0x18')](_0x8c13('0x60'),_0x258c87[_0x8c13('0x11')]),_0x8c13('0x61'),{'uri':util[_0x8c13('0x18')](_0x8c13('0x62'),_0x2cf402['remoteUri'][_0x8c13('0x63')](_0x8c13('0x64'),''),_0x34356b['id'])});break;default:logger['error']('[QUEUE]',_0x8c13('0x65'));}}})[_0x8c13('0x66')](function(_0xa8d33b){logger[_0x8c13('0x67')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x8c13('0x68')](_0xa8d33b,{'showHidden':!![],'depth':null}));});};exports[_0x8c13('0x69')]=function(_0x1d1362,_0x408771,_0x3ffd30,_0x50f4c4,_0x2d5d23,_0x48c345,_0x301e8a){var _0x305a30,_0x1f94ac;_0x48c345['remoteUri']=intUtil[_0x8c13('0x4e')](_0x48c345[_0x8c13('0xe')]);_0x48c345[_0x8c13('0x4f')]=intUtil[_0x8c13('0x4e')](_0x48c345[_0x8c13('0x4f')]);if(_0x301e8a&&_0x301e8a[_0x8c13('0x6a')]&&_0x301e8a[_0x8c13('0x6a')]!==_0x8c13('0x6b')){logger[_0x8c13('0x1c')](_0x8c13('0x6c'),_0x8c13('0x51'));_0x408771['recordingURL']=util['format'](_0x8c13('0x53'),_0x48c345['serverUrl'],_0x408771[_0x8c13('0x54')],md5(_0x408771[_0x8c13('0x54')]));}headers[_0x8c13('0x6d')]=getAuth(_0x48c345);return getUser(_0x48c345,_0x50f4c4[_0x8c13('0x55')])['then'](function(_0x383206){_0x305a30=_0x383206;logger[_0x8c13('0x1c')](_0x8c13('0x56'),_0x305a30['id']);return getEndUser(_0x48c345,_0x408771['destcalleridname'],_0x408771[_0x8c13('0x6e')]);})[_0x8c13('0x15')](function(_0x128469){_0x1f94ac=_0x128469;logger[_0x8c13('0x1c')]('The\x20Enduser\x20ID\x20is:',_0x1f94ac['id']);return getTicket(_0x48c345,_0x305a30,_0x1f94ac,_0x3ffd30,_0x408771);})[_0x8c13('0x15')](function(_0x47a04f){if(_0x47a04f){logger[_0x8c13('0x1c')](_0x8c13('0x6f'),_0x47a04f['id']);switch(_0x48c345[_0x8c13('0x42')]){case _0x8c13('0x5a'):logger[_0x8c13('0x1c')]('[OUTBOUND]',_0x8c13('0x5c'));return request({'uri':util[_0x8c13('0x18')](_0x8c13('0x70'),_0x48c345[_0x8c13('0xe')],_0x305a30['id'],_0x47a04f['id']),'method':_0x8c13('0x5d')});case _0x8c13('0x5e'):logger[_0x8c13('0x1c')](_0x8c13('0x6c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x8c13('0x18')]('user:%s',_0x50f4c4[_0x8c13('0x11')]),_0x8c13('0x61'),{'uri':util[_0x8c13('0x18')]('%s/agent/tickets/%s',_0x48c345['remoteUri'][_0x8c13('0x63')]('/api/v2',''),_0x47a04f['id'])});break;default:logger[_0x8c13('0x67')]('[OUTBOUND]',_0x8c13('0x65'));}}})[_0x8c13('0x66')](function(_0x4a4b8a){logger[_0x8c13('0x67')](_0x8c13('0x71'),util[_0x8c13('0x68')](_0x4a4b8a,{'showHidden':!![],'depth':null}));});};exports[_0x8c13('0x72')]=function(_0xe96c6d,_0x3df350,_0x5b8396,_0x1457cc,_0x4b3d26,_0x42a543){var _0xb8fabd,_0x2152a1;_0x42a543[_0x8c13('0xe')]=intUtil['stripTrailingSlash'](_0x42a543[_0x8c13('0xe')]);_0x42a543['serverUrl']=intUtil[_0x8c13('0x4e')](_0x42a543[_0x8c13('0x4f')]);if(_0x4b3d26&&_0x4b3d26[_0x8c13('0x50')]){logger[_0x8c13('0x1c')]('['+_0x3df350[_0x8c13('0x73')][_0x8c13('0x74')]()+']',_0x8c13('0x51'));_0x3df350[_0x8c13('0x52')]=util[_0x8c13('0x18')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x42a543[_0x8c13('0x4f')],_0x3df350['uniqueid'],md5(_0x3df350[_0x8c13('0x54')]));}else{_0x3df350[_0x8c13('0x52')]='';}headers[_0x8c13('0x6d')]=getAuth(_0x42a543);return getUser(_0x42a543)[_0x8c13('0x15')](function(_0x30f486){_0xb8fabd=_0x30f486;logger['info']('The\x20User\x20ID\x20is:',_0xb8fabd['id']);return getEndUser(_0x42a543,_0x3df350['calleridname'],_0x3df350[_0x8c13('0x58')]);})['then'](function(_0x4af84e){_0x2152a1=_0x4af84e;logger[_0x8c13('0x1c')]('The\x20Enduser\x20ID\x20is:',_0x2152a1['id']);return getTicket(_0x42a543,_0xb8fabd,_0x2152a1,_0x5b8396,_0x3df350);})[_0x8c13('0x15')](function(_0x540fa4){if(_0x540fa4){logger[_0x8c13('0x1c')]('The\x20Ticket\x20ID\x20is:',_0x540fa4['id']);}})['catch'](function(_0x2c0a47){logger[_0x8c13('0x67')]('['+_0x3df350[_0x8c13('0x73')][_0x8c13('0x74')]()+']'+_0x8c13('0x75'),util['inspect'](_0x2c0a47,{'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 ae60811..a4b385b 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 _0x2a60=['Call_Type','Inbound','merge','Fields','/crm/v2/Calls','code','Call\x20created!','details','err','stack','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','com','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','destcalleridname','destcalleridnum','user:%s','trigger:browser:url','toUpperCase','calleridnum','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','zoho','redis','defaults','localhost','socket.io-emitter','emit','[HTTP]','length','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Using\x20the\x20admin\x20account!','profile','Administrator','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','stringify','error','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','SUCCESS','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','Contacts','Leads','Creating\x20new\x20call...','Owner','administrator','Description','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','mm:ss','answertime','utc','endtime','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','called','Call_Result','Called','connect','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','agentcalledAt'];(function(_0x2f345a,_0x6b793a){var _0x3de554=function(_0x5962b7){while(--_0x5962b7){_0x2f345a['push'](_0x2f345a['shift']());}};_0x3de554(++_0x6b793a);}(_0x2a60,0xc9));var _0x02a6=function(_0x4770b1,_0x40319f){_0x4770b1=_0x4770b1-0x0;var _0x5817cf=_0x2a60[_0x4770b1];return _0x5817cf;};'use strict';var _=require(_0x02a6('0x0'));var rp=require(_0x02a6('0x1'));var md5=require(_0x02a6('0x2'));var util=require(_0x02a6('0x3'));var intUtil=require(_0x02a6('0x4'));var moment=require(_0x02a6('0x5'));var Redis=require(_0x02a6('0x6'));var BPromise=require(_0x02a6('0x7'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x02a6('0x8'));config[_0x02a6('0x9')]=_[_0x02a6('0xa')](config[_0x02a6('0x9')],{'host':_0x02a6('0xb'),'port':0x18eb});var io=require(_0x02a6('0xc'))(new Redis(config[_0x02a6('0x9')]));function emit(_0x13205d,_0x291323,_0x1f0151){io['to'](_0x13205d)[_0x02a6('0xd')](_0x291323,_0x1f0151);}function request(_0x4ba291){logger['debug'](_0x02a6('0xe'),JSON['stringify'](_0x4ba291));return rp(_0x4ba291);}function getCustomFields(_0x5a048e,_0x3a5657){var _0xc87c40={};if(_0x5a048e[_0x02a6('0xf')]>0x0){_[_0x02a6('0x10')](_0x5a048e,function(_0x26b81b){if(_[_0x02a6('0x11')]([_0x02a6('0x12'),_0x02a6('0x13')],_0x26b81b[_0x02a6('0x14')])&&_0x26b81b[_0x02a6('0x15')]){_0xc87c40[_0x26b81b['idField']]=_0x26b81b[_0x02a6('0x16')][_0x02a6('0x17')]();}else if(_0x26b81b[_0x02a6('0x14')]===_0x02a6('0x18')&&_0x26b81b['variableName']&&_0x26b81b[_0x02a6('0x15')]&&_0x3a5657[_0x26b81b[_0x02a6('0x19')]]){_0xc87c40[_0x26b81b[_0x02a6('0x15')]]=_0x3a5657[_0x26b81b['variableName']][_0x02a6('0x17')]();}else if(_0x26b81b[_0x02a6('0x14')]==='customVariable'&&_0x26b81b['Variable']&&_0x26b81b[_0x02a6('0x1a')]['name']&&_0x26b81b[_0x02a6('0x15')]&&_0x3a5657[_0x26b81b[_0x02a6('0x1a')][_0x02a6('0x1b')][_0x02a6('0x1c')]()]){_0xc87c40[_0x26b81b[_0x02a6('0x15')]]=_0x3a5657[_0x26b81b['Variable'][_0x02a6('0x1b')][_0x02a6('0x1c')]()]['toString']();}});}return _0xc87c40;}function getName(_0x242e68){if(_0x242e68['indexOf']('\x20')>0x0){var _0x24f29f=_0x242e68[_0x02a6('0x1d')](/ (.+)/);if(_0x24f29f[0x1]){return _0x24f29f;}}return[_0x242e68,_0x242e68];}var accountsTokens={};function getAccessToken(_0x455ac2){return new Promise(function(_0x3d6811,_0xdd1342){if(!_['isNil'](accountsTokens[_0x455ac2['id']])&&!_[_0x02a6('0x1e')](accountsTokens[_0x455ac2['id']][_0x02a6('0x1f')])){if(moment()[_0x02a6('0x20')](accountsTokens[_0x455ac2['id']][_0x02a6('0x21')])){_0x3d6811(accountsTokens[_0x455ac2['id']][_0x02a6('0x1f')]);}}var _0x3d3bcc;switch(_0x455ac2[_0x02a6('0x22')]){case'US':_0x3d3bcc=_0x02a6('0x23');break;case'AU':_0x3d3bcc=_0x02a6('0x24');break;case'EU':_0x3d3bcc='https://accounts.zoho.eu';break;case'IN':_0x3d3bcc=_0x02a6('0x25');break;case'CN':_0x3d3bcc=_0x02a6('0x26');break;default:_0x3d3bcc=_0x02a6('0x27');break;}var _0x59459f={'method':_0x02a6('0x28'),'uri':_0x3d3bcc+_0x02a6('0x29'),'qs':{'refresh_token':_0x455ac2[_0x02a6('0x2a')],'client_id':_0x455ac2[_0x02a6('0x2b')],'client_secret':_0x455ac2[_0x02a6('0x2c')],'grant_type':_0x02a6('0x2d')},'json':!![]};return rp(_0x59459f)[_0x02a6('0x2e')](function(_0x14d519){accountsTokens[_0x455ac2['id']]={'access_token':_0x14d519[_0x02a6('0x1f')],'expires_in':moment()[_0x02a6('0x2f')](_0x14d519['expires_in'],_0x02a6('0x30'))};_0x3d6811(_0x14d519['access_token']);})[_0x02a6('0x31')](function(_0xa606e2){logger['error'](_0x02a6('0x32'),_0xa606e2['stack']);_0xdd1342(_0xa606e2);});});}function getUser(_0x325159,_0x13fc15,_0x37b719,_0x264c76){logger[_0x02a6('0x33')](_0x02a6('0x34'));return request({'method':_0x02a6('0x35'),'uri':util[_0x02a6('0x36')](_0x02a6('0x37'),_0x13fc15),'qs':{'type':_0x02a6('0x38')},'headers':{'Authorization':_0x02a6('0x39')+_0x325159},'json':!![]})[_0x02a6('0x2e')](function(_0x5f5004){if(_0x5f5004[_0x02a6('0x3a')]){var _0x1b12c6=-0x1;if(_[_0x02a6('0x3b')](_0x5f5004[_0x02a6('0x3a')])){if(!_[_0x02a6('0x1e')](_0x264c76)){_0x1b12c6=_[_0x02a6('0x3c')](_0x5f5004[_0x02a6('0x3a')],function(_0x4bc978){return _0x4bc978[_0x02a6('0x3d')]===_0x264c76;});}if(_0x1b12c6>=0x0){logger[_0x02a6('0x33')]('Agent\x20found!');}else{logger[_0x02a6('0x33')](_0x02a6('0x3e'));_0x1b12c6=_[_0x02a6('0x3c')](_0x5f5004[_0x02a6('0x3a')],function(_0x47bda9){return _0x47bda9[_0x02a6('0x3f')][_0x02a6('0x1b')]===_0x02a6('0x40');});}return _0x5f5004[_0x02a6('0x3a')][_0x1b12c6];}else{if(_0x5f5004[_0x02a6('0x41')][_0x02a6('0x3f')][_0x02a6('0x1b')]===_0x02a6('0x40')){logger[_0x02a6('0x33')](_0x02a6('0x3e'));user=_0x5f5004[_0x02a6('0x41')];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON['stringify'](_0x5f5004));throw new Error(_0x02a6('0x42')+JSON[_0x02a6('0x43')](_0x5f5004));}}}else{logger[_0x02a6('0x44')]('The\x20failing\x20result\x20is',JSON[_0x02a6('0x43')](_0x5f5004));throw new Error(_0x02a6('0x42')+JSON[_0x02a6('0x43')](_0x5f5004));}})[_0x02a6('0x31')](function(_0x2a7b3b){console[_0x02a6('0x44')](_0x2a7b3b);});}function getZohoUser(_0x4d0a72,_0x1d9dee){return new BPromise(function(_0x23b330,_0x71d2e0){request(_0x4d0a72)[_0x02a6('0x2e')](function(_0x35fddb){var _0x39e9d7=null;if(_0x35fddb){_0x39e9d7=_0x35fddb[_0x02a6('0x45')][0x0];_0x39e9d7[_0x02a6('0x46')]=_0x1d9dee;}_0x23b330(_0x39e9d7);})[_0x02a6('0x31')](function(_0x10a613){_0x71d2e0(_0x10a613);});});}function createEndUser(_0x5cf3e8,_0x869172,_0x1d7b1f,_0x1285ff,_0x1cd3ff,_0x5027a4){var _0x1d7b1f=getName(_0x1d7b1f);return request({'method':_0x02a6('0x28'),'uri':_0x02a6('0x47')+_0x869172+_0x02a6('0x48')+_[_0x02a6('0x49')](_0x5027a4[_0x02a6('0x4a')])+'s','body':{'data':[{'Last_Name':_0x1d7b1f[0x1],'First_Name':_0x1d7b1f[0x0],'Phone':_0x1285ff,'Owner':{'name':!_['isNil'](_0x1cd3ff[_0x02a6('0x4b')][_0x02a6('0x1b')])?_0x1cd3ff[_0x02a6('0x4b')][_0x02a6('0x1b')]:!_[_0x02a6('0x1e')](_0x1cd3ff[_0x02a6('0x4c')])?_0x1cd3ff[_0x02a6('0x4c')]+'\x20'+_0x1cd3ff[_0x02a6('0x4d')]:_0x1cd3ff[_0x02a6('0x4d')],'id':_0x1cd3ff['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5cf3e8},'json':!![]})[_0x02a6('0x2e')](function(_0x5e9671){if(_0x5e9671&&_0x5e9671[_0x02a6('0x45')][0x0]['code']===_0x02a6('0x4e')){var _0x50f619=_0x5e9671[_0x02a6('0x45')][0x0]['details'];_0x50f619[_0x02a6('0x46')]=_[_0x02a6('0x49')](_0x5027a4[_0x02a6('0x4a')])+'s';return _0x50f619;}logger[_0x02a6('0x44')]('The\x20failing\x20result\x20is',JSON[_0x02a6('0x43')](data));throw new Error(_0x02a6('0x4f')+JSON[_0x02a6('0x43')](data));})[_0x02a6('0x31')](function(_0x331581){console[_0x02a6('0x50')](_0x02a6('0x51'),_0x331581);});}function getEndUser(_0x90e0e9,_0x44f56d,_0x1735cf,_0x1bfad5,_0x3259fe,_0x94f5fb,_0x27dfd4){var _0x207175={'method':_0x02a6('0x35'),'uri':'','headers':{'Authorization':_0x02a6('0x39')+_0x90e0e9},'json':!![]};switch(_0x27dfd4['moduleSearch']){case _0x02a6('0x52'):_0x207175[_0x02a6('0x53')]='https://www.zohoapis.'+_0x44f56d+_0x02a6('0x54')+_0x3259fe+'))';return getZohoUser(_0x207175,'Contacts')[_0x02a6('0x2e')](function(_0x3c60ec){if(_0x3c60ec)return _0x3c60ec;_0x207175[_0x02a6('0x53')]=_0x02a6('0x47')+_0x44f56d+_0x02a6('0x55')+_0x3259fe+'))';return getZohoUser(_0x207175,'Leads')[_0x02a6('0x2e')](function(_0x3642fd){if(_0x3642fd)return _0x3642fd;if(_0x27dfd4['moduleCreate']!=_0x02a6('0x56')){return createEndUser(_0x90e0e9,_0x44f56d,_0x1bfad5,_0x3259fe,_0x94f5fb,_0x27dfd4);}else{return{};}});});break;case _0x02a6('0x57'):_0x207175[_0x02a6('0x53')]='https://www.zohoapis.'+_0x44f56d+_0x02a6('0x54')+_0x3259fe+'))';return getZohoUser(_0x207175,_0x02a6('0x58'))['then'](function(_0x20ea87){if(_0x20ea87)return _0x20ea87;if(_0x27dfd4['moduleCreate']!=_0x02a6('0x56')){return createEndUser(_0x90e0e9,_0x44f56d,_0x1bfad5,_0x3259fe,_0x94f5fb,_0x27dfd4);}else{return{};}});break;case'lead':_0x207175[_0x02a6('0x53')]=_0x02a6('0x47')+_0x44f56d+_0x02a6('0x55')+_0x3259fe+'))';return getZohoUser(_0x207175,_0x02a6('0x59'))['then'](function(_0x12f383){if(_0x12f383)return _0x12f383;if(_0x27dfd4['moduleCreate']!=_0x02a6('0x56')){return createEndUser(_0x90e0e9,_0x44f56d,_0x1bfad5,_0x3259fe,_0x94f5fb,_0x27dfd4);}else{return{};}});break;}}function getCall(_0x2f4482,_0x3475b5,_0x32d477,_0x1eff89,_0x5c2368,_0x3cbe83,_0x2a39fe,_0x328401){logger[_0x02a6('0x33')](_0x02a6('0x5a'));var _0x4ef01e={};_0x4ef01e[_0x02a6('0x5b')]={'name':!_[_0x02a6('0x1e')](_0x1eff89[_0x02a6('0x4b')][_0x02a6('0x1b')])&&!_['isNil'](_0x1eff89[_0x02a6('0x3f')][_0x02a6('0x1b')])&&_0x1eff89[_0x02a6('0x3f')][_0x02a6('0x1b')]===_0x02a6('0x5c')?_0x1eff89[_0x02a6('0x4b')]['name']:!_['isNil'](_0x1eff89[_0x02a6('0x4c')])?_0x1eff89[_0x02a6('0x4c')]+'\x20'+_0x1eff89[_0x02a6('0x4d')]:_0x1eff89[_0x02a6('0x4d')],'id':_0x1eff89['id']};_0x4ef01e['Subject']=intUtil['getString'](_0x3cbe83['Subjects'],_0x2a39fe,'\x20');_0x4ef01e[_0x02a6('0x5d')]=intUtil[_0x02a6('0x5e')](_0x3cbe83[_0x02a6('0x5f')],_0x2a39fe,'\x0a');if(_0x5c2368[_0x02a6('0x46')]===_0x02a6('0x58')){_0x4ef01e[_0x02a6('0x60')]={'name':!_['isNil'](_0x5c2368['Full_Name'])?_0x5c2368[_0x02a6('0x61')]:!_[_0x02a6('0x1e')](_0x5c2368[_0x02a6('0x62')])?_0x5c2368['First_Name']+'\x20'+_0x5c2368[_0x02a6('0x63')]:_0x5c2368[_0x02a6('0x63')],'id':_0x5c2368['id']};}if(_0x5c2368[_0x02a6('0x46')]==='Leads'){_0x4ef01e[_0x02a6('0x64')]={'name':!_[_0x02a6('0x1e')](_0x5c2368[_0x02a6('0x61')])?_0x5c2368[_0x02a6('0x61')]:!_[_0x02a6('0x1e')](_0x5c2368[_0x02a6('0x62')])?_0x5c2368[_0x02a6('0x62')]+'\x20'+_0x5c2368[_0x02a6('0x63')]:_0x5c2368[_0x02a6('0x63')],'id':_0x5c2368['id']};_0x4ef01e[_0x02a6('0x65')]=_['startCase'](_0x5c2368[_0x02a6('0x46')]);}if(_0x2a39fe[_0x02a6('0x66')]){_0x4ef01e[_0x02a6('0x67')]=moment['utc'](parseInt(_0x2a39fe[_0x02a6('0x66')])*0x3e8)['format'](_0x02a6('0x68'));}else if(_0x2a39fe[_0x02a6('0x69')]&&_0x2a39fe['endtime']){_0x4ef01e[_0x02a6('0x67')]=moment[_0x02a6('0x6a')](moment(_0x2a39fe[_0x02a6('0x6b')],_0x02a6('0x6c'))['diff'](moment(_0x2a39fe[_0x02a6('0x6d')],_0x02a6('0x6c'))))[_0x02a6('0x36')](_0x02a6('0x68'));}switch(_0x2a39fe[_0x02a6('0x6e')]){case _0x02a6('0x6f'):_0x4ef01e[_0x02a6('0x70')]=_0x02a6('0x71');break;case'complete':case _0x02a6('0x72'):_0x4ef01e['Call_Result']='Answered';break;case _0x02a6('0x73'):_0x4ef01e['Call_Result']=_0x02a6('0x74');break;case _0x02a6('0x75'):_0x4ef01e[_0x02a6('0x70')]=_0x02a6('0x76');break;case _0x02a6('0x77'):_0x4ef01e[_0x02a6('0x70')]=_0x02a6('0x78');default:}_0x4ef01e[_0x02a6('0x79')]=(_0x328401==='outbound'?moment(_0x2a39fe['starttime'])['format'](_0x02a6('0x6c')):moment(_0x2a39fe[_0x02a6('0x7a')])[_0x02a6('0x36')](_0x02a6('0x6c')))||moment()[_0x02a6('0x36')](_0x02a6('0x6c'));_0x4ef01e[_0x02a6('0x7b')]=_0x328401||_0x02a6('0x7c');_0x4ef01e=_[_0x02a6('0x7d')](_0x4ef01e,getCustomFields(_0x3cbe83[_0x02a6('0x7e')],_0x2a39fe));return request({'method':_0x02a6('0x28'),'uri':'https://www.zohoapis.'+_0x3475b5+_0x02a6('0x7f'),'headers':{'Authorization':_0x02a6('0x39')+_0x2f4482},'body':{'data':[_0x4ef01e]},'json':!![]})[_0x02a6('0x2e')](function(_0x13f532){if(_0x13f532&&_0x13f532['data'][0x0][_0x02a6('0x80')]==='SUCCESS'){logger[_0x02a6('0x33')](_0x02a6('0x81'));return{'id':_0x13f532[_0x02a6('0x45')][0x0][_0x02a6('0x82')]['id']};}})[_0x02a6('0x31')](function(_0x3114d2){logger[_0x02a6('0x33')](_0x02a6('0x83'),_0x3114d2[_0x02a6('0x84')]);console['log']('err',_0x3114d2);});}exports[_0x02a6('0x85')]=function(_0x319621,_0x3a1252,_0x24360a,_0x4bafe3,_0x3850b3,_0xf70dd7){var _0x32b330,_0x4e068,_0x4a3a9b;_0xf70dd7[_0x02a6('0x86')]=intUtil[_0x02a6('0x87')](_0xf70dd7[_0x02a6('0x86')]);_0xf70dd7[_0x02a6('0x88')]=intUtil[_0x02a6('0x87')](_0xf70dd7[_0x02a6('0x88')]);if(_0x3850b3&&_0x3850b3[_0x02a6('0x89')]){logger['info'](_0x02a6('0x8a'),_0x02a6('0x8b'));_0x3a1252[_0x02a6('0x8c')]=_0xf70dd7[_0x02a6('0x88')]+_0x02a6('0x8d')+_0x3a1252['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x3a1252['uniqueid']);}else{_0x3a1252[_0x02a6('0x8c')]='';}var _0x5d556d=_0xf70dd7['host']==='zoho.eu'?'eu':_0x02a6('0x8e');return getAccessToken(_0xf70dd7)[_0x02a6('0x2e')](function(_0x2a8f36){_0x4a3a9b=_0x2a8f36;return getUser(_0x4a3a9b,_0x5d556d,_0xf70dd7,_0x4bafe3[_0x02a6('0x3d')]);})['then'](function(_0x5ce355){_0x32b330=_0x5ce355;logger[_0x02a6('0x33')](_0x02a6('0x8f'),_0x32b330['id']);return getEndUser(_0x4a3a9b,_0x5d556d,_0xf70dd7,_0x3a1252[_0x02a6('0x90')],_0x3a1252['calleridnum'],_0x32b330,_0x24360a);})[_0x02a6('0x2e')](function(_0x4b98a1){_0x4e068=_0x4b98a1;return getCall(_0x4a3a9b,_0x5d556d,_0xf70dd7,_0x32b330,_0x4e068,_0x24360a,_0x3a1252,_0x02a6('0x7c'));})[_0x02a6('0x2e')](function(_0x441681){if(_0x441681){logger[_0x02a6('0x33')](_0x02a6('0x91'),_0x441681['id']);logger[_0x02a6('0x33')](_0x02a6('0x8a'),_0x02a6('0x92'));emit(util[_0x02a6('0x36')]('user:%s',_0x4bafe3[_0x02a6('0x1b')]),'trigger:browser:url',{'uri':_0x02a6('0x93')+_0xf70dd7[_0x02a6('0x86')]+_0x02a6('0x94')+_0x441681['id']});}})[_0x02a6('0x31')](function(_0x2b79e4){logger[_0x02a6('0x44')]('[QUEUE]',JSON[_0x02a6('0x43')](_0x2b79e4));});};exports[_0x02a6('0x95')]=function(_0x45c1cb,_0x2c82bf,_0x13ef11,_0x1f31b5,_0x2f085d,_0x4a206a,_0x56450c){var _0x5372eb,_0x4ad010,_0x3793b2;_0x4a206a[_0x02a6('0x86')]=intUtil['stripTrailingSlash'](_0x4a206a[_0x02a6('0x86')]);_0x4a206a[_0x02a6('0x88')]=intUtil['stripTrailingSlash'](_0x4a206a[_0x02a6('0x88')]);if(_0x56450c&&_0x56450c[_0x02a6('0x96')]&&_0x56450c[_0x02a6('0x96')]!==_0x02a6('0x97')){logger[_0x02a6('0x33')](_0x02a6('0x98'),_0x02a6('0x8b'));_0x2c82bf['recordingURL']=_0x4a206a[_0x02a6('0x88')]+'/api/voice/recordings/'+_0x2c82bf[_0x02a6('0x99')]+_0x02a6('0x9a')+md5(_0x2c82bf[_0x02a6('0x99')]);}var _0x37bb88=_0x4a206a['host']===_0x02a6('0x9b')?'eu':_0x02a6('0x8e');return getAccessToken(_0x4a206a)[_0x02a6('0x2e')](function(_0x3b3c4e){_0x3793b2=_0x3b3c4e;return getUser(_0x3793b2,_0x37bb88,_0x4a206a,_0x1f31b5[_0x02a6('0x3d')]);})[_0x02a6('0x2e')](function(_0x1b242b){_0x5372eb=_0x1b242b;logger[_0x02a6('0x33')](_0x02a6('0x8f'),_0x5372eb['id']);return getEndUser(_0x3793b2,_0x37bb88,_0x4a206a,_0x2c82bf[_0x02a6('0x9c')],_0x2c82bf[_0x02a6('0x9d')],_0x5372eb,_0x13ef11);})['then'](function(_0x359a29){_0x4ad010=_0x359a29;return getCall(_0x3793b2,_0x37bb88,_0x4a206a,_0x5372eb,_0x4ad010,_0x13ef11,_0x2c82bf,'Outbound');})[_0x02a6('0x2e')](function(_0x34c7a6){if(_0x34c7a6){logger[_0x02a6('0x33')](_0x02a6('0x91'),_0x34c7a6['id']);logger[_0x02a6('0x33')](_0x02a6('0x98'),_0x02a6('0x92'));emit(util[_0x02a6('0x36')](_0x02a6('0x9e'),_0x1f31b5[_0x02a6('0x1b')]),_0x02a6('0x9f'),{'uri':_0x02a6('0x93')+_0x4a206a[_0x02a6('0x86')]+_0x02a6('0x94')+_0x34c7a6['id']});}})[_0x02a6('0x31')](function(_0x4340da){logger[_0x02a6('0x44')](_0x02a6('0x98'),JSON[_0x02a6('0x43')](_0x4340da));});};exports['unmanaged']=function(_0xa11852,_0x3ac17f,_0xab586,_0x18a726,_0xdbaef7,_0x422ad5){var _0x43ae77,_0x576f67,_0x280a8d;_0x422ad5[_0x02a6('0x86')]=intUtil[_0x02a6('0x87')](_0x422ad5[_0x02a6('0x86')]);_0x422ad5[_0x02a6('0x88')]=intUtil[_0x02a6('0x87')](_0x422ad5['serverUrl']);if(_0xdbaef7&&_0xdbaef7[_0x02a6('0x89')]){logger[_0x02a6('0x33')]('['+_0x3ac17f[_0x02a6('0x6e')][_0x02a6('0xa0')]()+']','Recording\x20is\x20enabled!');_0x3ac17f[_0x02a6('0x8c')]=_0x422ad5['serverUrl']+_0x02a6('0x8d')+_0x3ac17f[_0x02a6('0x99')]+_0x02a6('0x9a')+md5(_0x3ac17f['uniqueid']);}else{_0x3ac17f['recordingURL']='';}var _0x276683=_0x422ad5[_0x02a6('0x86')]===_0x02a6('0x9b')?'eu':'com';return getAccessToken(_0x422ad5)[_0x02a6('0x2e')](function(_0x4b8345){_0x280a8d=_0x4b8345;return getUser(_0x280a8d,_0x276683,_0x422ad5);})[_0x02a6('0x2e')](function(_0x1f84b1){_0x43ae77=_0x1f84b1;logger[_0x02a6('0x33')](_0x02a6('0x8f'),_0x43ae77['id']);return getEndUser(_0x280a8d,_0x276683,_0x422ad5,_0x3ac17f[_0x02a6('0x90')],_0x3ac17f[_0x02a6('0xa1')],_0x43ae77,_0xab586);})[_0x02a6('0x2e')](function(_0x19b45a){_0x576f67=_0x19b45a;return getCall(_0x280a8d,_0x276683,_0x422ad5,_0x43ae77,_0x576f67,_0xab586,_0x3ac17f,_0x02a6('0x7c'));})['then'](function(_0x43eb69){if(_0x43eb69){logger[_0x02a6('0x33')](_0x02a6('0x91'),_0x43eb69['id']);}})[_0x02a6('0x31')](function(_0x420504){logger['error']('['+_0x3ac17f[_0x02a6('0x6e')]['toUpperCase']()+']',JSON[_0x02a6('0x43')](_0x420504));});}; \ No newline at end of file +var _0x8f7c=['https://crm.','unmanaged','toUpperCase','lodash','request-promise','./util','ioredis','bluebird','../../../../config/environment','redis','localhost','socket.io-emitter','debug','[HTTP]','stringify','length','forEach','includes','string','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','refresh_token','then','add','seconds','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','info','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','data','code','SUCCESS','details','enduserType','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','nothing','contact','lead','Owner','administrator','getString','Who_Id','Full_Name','First_Name','Last_Name','Leads','What_Id','talktime','utc','format','mm:ss','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','recordingFormat','[OUTBOUND]','zoho.eu','destcalleridname','Outbound','user:%s'];(function(_0x52dae4,_0x6233fc){var _0x2cb946=function(_0x1611cf){while(--_0x1611cf){_0x52dae4['push'](_0x52dae4['shift']());}};_0x2cb946(++_0x6233fc);}(_0x8f7c,0x133));var _0xc8f7=function(_0x4a9546,_0x5598ce){_0x4a9546=_0x4a9546-0x0;var _0x31d75d=_0x8f7c[_0x4a9546];return _0x31d75d;};'use strict';var _=require(_0xc8f7('0x0'));var rp=require(_0xc8f7('0x1'));var md5=require('md5');var util=require('util');var intUtil=require(_0xc8f7('0x2'));var moment=require('moment');var Redis=require(_0xc8f7('0x3'));var BPromise=require(_0xc8f7('0x4'));var config=require(_0xc8f7('0x5'));var logger=require('../../../../config/logger')('zoho');config[_0xc8f7('0x6')]=_['defaults'](config[_0xc8f7('0x6')],{'host':_0xc8f7('0x7'),'port':0x18eb});var io=require(_0xc8f7('0x8'))(new Redis(config[_0xc8f7('0x6')]));function emit(_0x193e5b,_0x1e1bcf,_0x3ad42f){io['to'](_0x193e5b)['emit'](_0x1e1bcf,_0x3ad42f);}function request(_0x1494f9){logger[_0xc8f7('0x9')](_0xc8f7('0xa'),JSON[_0xc8f7('0xb')](_0x1494f9));return rp(_0x1494f9);}function getCustomFields(_0x480800,_0x5ae6eb){var _0x268e45={};if(_0x480800[_0xc8f7('0xc')]>0x0){_[_0xc8f7('0xd')](_0x480800,function(_0x3f700f){if(_[_0xc8f7('0xe')]([_0xc8f7('0xf'),'picklist'],_0x3f700f['type'])&&_0x3f700f['idField']){_0x268e45[_0x3f700f[_0xc8f7('0x10')]]=_0x3f700f[_0xc8f7('0x11')][_0xc8f7('0x12')]();}else if(_0x3f700f[_0xc8f7('0x13')]===_0xc8f7('0x14')&&_0x3f700f[_0xc8f7('0x15')]&&_0x3f700f[_0xc8f7('0x10')]&&_0x5ae6eb[_0x3f700f[_0xc8f7('0x15')]]){_0x268e45[_0x3f700f[_0xc8f7('0x10')]]=_0x5ae6eb[_0x3f700f[_0xc8f7('0x15')]][_0xc8f7('0x12')]();}else if(_0x3f700f[_0xc8f7('0x13')]===_0xc8f7('0x16')&&_0x3f700f['Variable']&&_0x3f700f[_0xc8f7('0x17')]['name']&&_0x3f700f[_0xc8f7('0x10')]&&_0x5ae6eb[_0x3f700f[_0xc8f7('0x17')][_0xc8f7('0x18')]['toLowerCase']()]){_0x268e45[_0x3f700f[_0xc8f7('0x10')]]=_0x5ae6eb[_0x3f700f[_0xc8f7('0x17')][_0xc8f7('0x18')][_0xc8f7('0x19')]()][_0xc8f7('0x12')]();}});}return _0x268e45;}function getName(_0x3a85a9){if(_0x3a85a9[_0xc8f7('0x1a')]('\x20')>0x0){var _0x450b12=_0x3a85a9[_0xc8f7('0x1b')](/ (.+)/);if(_0x450b12[0x1]){return _0x450b12;}}return[_0x3a85a9,_0x3a85a9];}var accountsTokens={};function getAccessToken(_0x56ae72){return new Promise(function(_0x102e7,_0x4c57cc){if(!_[_0xc8f7('0x1c')](accountsTokens[_0x56ae72['id']])&&!_['isNil'](accountsTokens[_0x56ae72['id']][_0xc8f7('0x1d')])){if(moment()[_0xc8f7('0x1e')](accountsTokens[_0x56ae72['id']][_0xc8f7('0x1f')])){_0x102e7(accountsTokens[_0x56ae72['id']][_0xc8f7('0x1d')]);}}var _0x2ce695;switch(_0x56ae72[_0xc8f7('0x20')]){case'US':_0x2ce695=_0xc8f7('0x21');break;case'AU':_0x2ce695=_0xc8f7('0x22');break;case'EU':_0x2ce695=_0xc8f7('0x23');break;case'IN':_0x2ce695=_0xc8f7('0x24');break;case'CN':_0x2ce695=_0xc8f7('0x25');break;default:_0x2ce695=_0xc8f7('0x23');break;}var _0x5883ee={'method':_0xc8f7('0x26'),'uri':_0x2ce695+_0xc8f7('0x27'),'qs':{'refresh_token':_0x56ae72[_0xc8f7('0x28')],'client_id':_0x56ae72['clientId'],'client_secret':_0x56ae72['clientSecret'],'grant_type':_0xc8f7('0x29')},'json':!![]};return rp(_0x5883ee)[_0xc8f7('0x2a')](function(_0xd08a63){accountsTokens[_0x56ae72['id']]={'access_token':_0xd08a63[_0xc8f7('0x1d')],'expires_in':moment()[_0xc8f7('0x2b')](_0xd08a63[_0xc8f7('0x1f')],_0xc8f7('0x2c'))};_0x102e7(_0xd08a63[_0xc8f7('0x1d')]);})['catch'](function(_0x2a06bd){logger[_0xc8f7('0x2d')](_0xc8f7('0x2e'),_0x2a06bd[_0xc8f7('0x2f')]);_0x4c57cc(_0x2a06bd);});});}function getUser(_0x255de4,_0x885856,_0x3e7912,_0x525019){logger['info'](_0xc8f7('0x30'));return request({'method':_0xc8f7('0x31'),'uri':util['format'](_0xc8f7('0x32'),_0x885856),'qs':{'type':_0xc8f7('0x33')},'headers':{'Authorization':_0xc8f7('0x34')+_0x255de4},'json':!![]})[_0xc8f7('0x2a')](function(_0x4203db){if(_0x4203db[_0xc8f7('0x35')]){var _0x318a91=-0x1;if(_[_0xc8f7('0x36')](_0x4203db[_0xc8f7('0x35')])){if(!_['isNil'](_0x525019)){_0x318a91=_[_0xc8f7('0x37')](_0x4203db[_0xc8f7('0x35')],function(_0x15ca0f){return _0x15ca0f[_0xc8f7('0x38')]===_0x525019;});}if(_0x318a91>=0x0){logger[_0xc8f7('0x39')]('Agent\x20found!');}else{logger[_0xc8f7('0x39')](_0xc8f7('0x3a'));_0x318a91=_[_0xc8f7('0x37')](_0x4203db[_0xc8f7('0x35')],function(_0x1e3ce7){return _0x1e3ce7[_0xc8f7('0x3b')][_0xc8f7('0x18')]===_0xc8f7('0x3c');});}return _0x4203db[_0xc8f7('0x35')][_0x318a91];}else{if(_0x4203db[_0xc8f7('0x3d')][_0xc8f7('0x3b')][_0xc8f7('0x18')]===_0xc8f7('0x3c')){logger[_0xc8f7('0x39')](_0xc8f7('0x3a'));user=_0x4203db[_0xc8f7('0x3d')];return user;}else{logger[_0xc8f7('0x2d')](_0xc8f7('0x3e'),JSON[_0xc8f7('0xb')](_0x4203db));throw new Error(_0xc8f7('0x3f')+JSON[_0xc8f7('0xb')](_0x4203db));}}}else{logger[_0xc8f7('0x2d')](_0xc8f7('0x3e'),JSON['stringify'](_0x4203db));throw new Error(_0xc8f7('0x3f')+JSON[_0xc8f7('0xb')](_0x4203db));}})[_0xc8f7('0x40')](function(_0xdb3b83){console[_0xc8f7('0x2d')](_0xdb3b83);});}function getZohoUser(_0x8f904f,_0x28efde){return new BPromise(function(_0x5187e4,_0x3db1d5){request(_0x8f904f)[_0xc8f7('0x2a')](function(_0x587fa7){var _0x1cf3c2=null;if(_0x587fa7){_0x1cf3c2=_0x587fa7['data'][0x0];_0x1cf3c2['enduserType']=_0x28efde;}_0x5187e4(_0x1cf3c2);})[_0xc8f7('0x40')](function(_0x140c40){_0x3db1d5(_0x140c40);});});}function createEndUser(_0x4e0131,_0x41ddd9,_0x1b5cd0,_0x16a311,_0x1b36da,_0x27b8dc){var _0x1b5cd0=getName(_0x1b5cd0);return request({'method':_0xc8f7('0x26'),'uri':_0xc8f7('0x41')+_0x41ddd9+_0xc8f7('0x42')+_[_0xc8f7('0x43')](_0x27b8dc[_0xc8f7('0x44')])+'s','body':{'data':[{'Last_Name':_0x1b5cd0[0x1],'First_Name':_0x1b5cd0[0x0],'Phone':_0x16a311,'Owner':{'name':!_[_0xc8f7('0x1c')](_0x1b36da[_0xc8f7('0x45')][_0xc8f7('0x18')])?_0x1b36da[_0xc8f7('0x45')]['name']:!_[_0xc8f7('0x1c')](_0x1b36da['first_name'])?_0x1b36da[_0xc8f7('0x46')]+'\x20'+_0x1b36da[_0xc8f7('0x47')]:_0x1b36da[_0xc8f7('0x47')],'id':_0x1b36da['id']}}]},'headers':{'Authorization':_0xc8f7('0x34')+_0x4e0131},'json':!![]})[_0xc8f7('0x2a')](function(_0x2f52df){if(_0x2f52df&&_0x2f52df[_0xc8f7('0x48')][0x0][_0xc8f7('0x49')]===_0xc8f7('0x4a')){var _0x32d830=_0x2f52df[_0xc8f7('0x48')][0x0][_0xc8f7('0x4b')];_0x32d830[_0xc8f7('0x4c')]=_[_0xc8f7('0x43')](_0x27b8dc[_0xc8f7('0x44')])+'s';return _0x32d830;}logger[_0xc8f7('0x2d')](_0xc8f7('0x3e'),JSON[_0xc8f7('0xb')](data));throw new Error(_0xc8f7('0x4d')+JSON['stringify'](data));})[_0xc8f7('0x40')](function(_0x3c7c15){console[_0xc8f7('0x4e')](_0xc8f7('0x4f'),_0x3c7c15);});}function getEndUser(_0x225879,_0x45d63a,_0x4167bb,_0x405e32,_0x703300,_0x3b8899,_0x37711f){var _0x22f7c7={'method':_0xc8f7('0x31'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x225879},'json':!![]};switch(_0x37711f[_0xc8f7('0x50')]){case _0xc8f7('0x51'):_0x22f7c7[_0xc8f7('0x52')]='https://www.zohoapis.'+_0x45d63a+_0xc8f7('0x53')+_0x703300+'))';return getZohoUser(_0x22f7c7,_0xc8f7('0x54'))['then'](function(_0x513017){if(_0x513017)return _0x513017;_0x22f7c7['uri']='https://www.zohoapis.'+_0x45d63a+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x703300+'))';return getZohoUser(_0x22f7c7,'Leads')[_0xc8f7('0x2a')](function(_0x5848fd){if(_0x5848fd)return _0x5848fd;if(_0x37711f[_0xc8f7('0x44')]!=_0xc8f7('0x55')){return createEndUser(_0x225879,_0x45d63a,_0x405e32,_0x703300,_0x3b8899,_0x37711f);}else{return{};}});});break;case _0xc8f7('0x56'):_0x22f7c7[_0xc8f7('0x52')]='https://www.zohoapis.'+_0x45d63a+_0xc8f7('0x53')+_0x703300+'))';return getZohoUser(_0x22f7c7,'Contacts')['then'](function(_0x58ae26){if(_0x58ae26)return _0x58ae26;if(_0x37711f[_0xc8f7('0x44')]!=_0xc8f7('0x55')){return createEndUser(_0x225879,_0x45d63a,_0x405e32,_0x703300,_0x3b8899,_0x37711f);}else{return{};}});break;case _0xc8f7('0x57'):_0x22f7c7['uri']=_0xc8f7('0x41')+_0x45d63a+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x703300+'))';return getZohoUser(_0x22f7c7,'Leads')[_0xc8f7('0x2a')](function(_0x24aa3f){if(_0x24aa3f)return _0x24aa3f;if(_0x37711f[_0xc8f7('0x44')]!=_0xc8f7('0x55')){return createEndUser(_0x225879,_0x45d63a,_0x405e32,_0x703300,_0x3b8899,_0x37711f);}else{return{};}});break;}}function getCall(_0x1b3007,_0x15e780,_0x3d25bf,_0xf0bd09,_0x203948,_0x3c0e73,_0x321c76,_0x4e3143){logger['info']('Creating\x20new\x20call...');var _0x262ec2={};_0x262ec2[_0xc8f7('0x58')]={'name':!_[_0xc8f7('0x1c')](_0xf0bd09[_0xc8f7('0x45')][_0xc8f7('0x18')])&&!_[_0xc8f7('0x1c')](_0xf0bd09['profile']['name'])&&_0xf0bd09[_0xc8f7('0x3b')][_0xc8f7('0x18')]===_0xc8f7('0x59')?_0xf0bd09[_0xc8f7('0x45')]['name']:!_[_0xc8f7('0x1c')](_0xf0bd09['first_name'])?_0xf0bd09[_0xc8f7('0x46')]+'\x20'+_0xf0bd09[_0xc8f7('0x47')]:_0xf0bd09[_0xc8f7('0x47')],'id':_0xf0bd09['id']};_0x262ec2['Subject']=intUtil[_0xc8f7('0x5a')](_0x3c0e73['Subjects'],_0x321c76,'\x20');_0x262ec2['Description']=intUtil[_0xc8f7('0x5a')](_0x3c0e73['Descriptions'],_0x321c76,'\x0a');if(_0x203948['enduserType']===_0xc8f7('0x54')){_0x262ec2[_0xc8f7('0x5b')]={'name':!_[_0xc8f7('0x1c')](_0x203948[_0xc8f7('0x5c')])?_0x203948[_0xc8f7('0x5c')]:!_[_0xc8f7('0x1c')](_0x203948['First_Name'])?_0x203948[_0xc8f7('0x5d')]+'\x20'+_0x203948[_0xc8f7('0x5e')]:_0x203948[_0xc8f7('0x5e')],'id':_0x203948['id']};}if(_0x203948[_0xc8f7('0x4c')]===_0xc8f7('0x5f')){_0x262ec2[_0xc8f7('0x60')]={'name':!_[_0xc8f7('0x1c')](_0x203948[_0xc8f7('0x5c')])?_0x203948[_0xc8f7('0x5c')]:!_[_0xc8f7('0x1c')](_0x203948[_0xc8f7('0x5d')])?_0x203948[_0xc8f7('0x5d')]+'\x20'+_0x203948[_0xc8f7('0x5e')]:_0x203948[_0xc8f7('0x5e')],'id':_0x203948['id']};_0x262ec2['$se_module']=_[_0xc8f7('0x43')](_0x203948[_0xc8f7('0x4c')]);}if(_0x321c76[_0xc8f7('0x61')]){_0x262ec2['Call_Duration']=moment[_0xc8f7('0x62')](parseInt(_0x321c76[_0xc8f7('0x61')])*0x3e8)[_0xc8f7('0x63')](_0xc8f7('0x64'));}else if(_0x321c76[_0xc8f7('0x65')]&&_0x321c76[_0xc8f7('0x66')]){_0x262ec2[_0xc8f7('0x67')]=moment[_0xc8f7('0x62')](moment(_0x321c76[_0xc8f7('0x66')],_0xc8f7('0x68'))[_0xc8f7('0x69')](moment(_0x321c76[_0xc8f7('0x6a')],_0xc8f7('0x68'))))[_0xc8f7('0x63')](_0xc8f7('0x64'));}switch(_0x321c76[_0xc8f7('0x6b')]){case _0xc8f7('0x6c'):_0x262ec2[_0xc8f7('0x6d')]='Called';break;case'complete':case'connect':_0x262ec2[_0xc8f7('0x6d')]=_0xc8f7('0x6e');break;case _0xc8f7('0x6f'):_0x262ec2['Call_Result']=_0xc8f7('0x70');break;case _0xc8f7('0x71'):_0x262ec2[_0xc8f7('0x6d')]=_0xc8f7('0x72');break;case _0xc8f7('0x73'):_0x262ec2[_0xc8f7('0x6d')]=_0xc8f7('0x74');default:}_0x262ec2[_0xc8f7('0x75')]=(_0x4e3143===_0xc8f7('0x76')?moment(_0x321c76[_0xc8f7('0x6a')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x321c76[_0xc8f7('0x77')])[_0xc8f7('0x63')](_0xc8f7('0x68')))||moment()[_0xc8f7('0x63')](_0xc8f7('0x68'));_0x262ec2[_0xc8f7('0x78')]=_0x4e3143||_0xc8f7('0x79');_0x262ec2=_[_0xc8f7('0x7a')](_0x262ec2,getCustomFields(_0x3c0e73['Fields'],_0x321c76));return request({'method':_0xc8f7('0x26'),'uri':_0xc8f7('0x41')+_0x15e780+_0xc8f7('0x7b'),'headers':{'Authorization':_0xc8f7('0x34')+_0x1b3007},'body':{'data':[_0x262ec2]},'json':!![]})[_0xc8f7('0x2a')](function(_0x47fdcd){if(_0x47fdcd&&_0x47fdcd['data'][0x0][_0xc8f7('0x49')]===_0xc8f7('0x4a')){logger[_0xc8f7('0x39')](_0xc8f7('0x7c'));return{'id':_0x47fdcd[_0xc8f7('0x48')][0x0][_0xc8f7('0x4b')]['id']};}})['catch'](function(_0x28586b){logger[_0xc8f7('0x39')](_0xc8f7('0x7d'),_0x28586b[_0xc8f7('0x2f')]);console[_0xc8f7('0x4e')](_0xc8f7('0x7d'),_0x28586b);});}exports[_0xc8f7('0x7e')]=function(_0x1d52dd,_0x39cdc8,_0x2741f3,_0x44d035,_0x56c486,_0x15ed61){var _0x33a1a9,_0x3fcda4,_0x17bd5d;_0x15ed61[_0xc8f7('0x7f')]=intUtil[_0xc8f7('0x80')](_0x15ed61[_0xc8f7('0x7f')]);_0x15ed61[_0xc8f7('0x81')]=intUtil['stripTrailingSlash'](_0x15ed61[_0xc8f7('0x81')]);if(_0x56c486&&_0x56c486[_0xc8f7('0x82')]){logger[_0xc8f7('0x39')](_0xc8f7('0x83'),_0xc8f7('0x84'));_0x39cdc8[_0xc8f7('0x85')]=_0x15ed61['serverUrl']+_0xc8f7('0x86')+_0x39cdc8['uniqueid']+_0xc8f7('0x87')+md5(_0x39cdc8[_0xc8f7('0x88')]);}else{_0x39cdc8['recordingURL']='';}var _0xcedd95=_0x15ed61['host']==='zoho.eu'?'eu':_0xc8f7('0x89');return getAccessToken(_0x15ed61)[_0xc8f7('0x2a')](function(_0x149a54){_0x17bd5d=_0x149a54;return getUser(_0x17bd5d,_0xcedd95,_0x15ed61,_0x44d035[_0xc8f7('0x38')]);})['then'](function(_0x52b951){_0x33a1a9=_0x52b951;logger[_0xc8f7('0x39')](_0xc8f7('0x8a'),_0x33a1a9['id']);return getEndUser(_0x17bd5d,_0xcedd95,_0x15ed61,_0x39cdc8[_0xc8f7('0x8b')],_0x39cdc8[_0xc8f7('0x8c')],_0x33a1a9,_0x2741f3);})['then'](function(_0x12f9b4){_0x3fcda4=_0x12f9b4;return getCall(_0x17bd5d,_0xcedd95,_0x15ed61,_0x33a1a9,_0x3fcda4,_0x2741f3,_0x39cdc8,'Inbound');})[_0xc8f7('0x2a')](function(_0x4d71a7){if(_0x4d71a7){logger[_0xc8f7('0x39')]('The\x20Call\x20ID\x20is:',_0x4d71a7['id']);logger['info'](_0xc8f7('0x83'),_0xc8f7('0x8d'));emit(util[_0xc8f7('0x63')]('user:%s',_0x44d035[_0xc8f7('0x18')]),_0xc8f7('0x8e'),{'uri':'https://crm.'+_0x15ed61[_0xc8f7('0x7f')]+'/crm/EntityInfo.do?module=Calls&id='+_0x4d71a7['id']});}})[_0xc8f7('0x40')](function(_0x346939){logger[_0xc8f7('0x2d')](_0xc8f7('0x83'),JSON[_0xc8f7('0xb')](_0x346939));});};exports[_0xc8f7('0x76')]=function(_0x355769,_0x3752a2,_0x4c788c,_0x57b06f,_0x3e8978,_0xda6aa4,_0x5d0a5d){var _0x2f3dd2,_0x10b4d7,_0x221bf1;_0xda6aa4[_0xc8f7('0x7f')]=intUtil[_0xc8f7('0x80')](_0xda6aa4['host']);_0xda6aa4['serverUrl']=intUtil[_0xc8f7('0x80')](_0xda6aa4[_0xc8f7('0x81')]);if(_0x5d0a5d&&_0x5d0a5d[_0xc8f7('0x8f')]&&_0x5d0a5d[_0xc8f7('0x8f')]!=='none'){logger[_0xc8f7('0x39')](_0xc8f7('0x90'),_0xc8f7('0x84'));_0x3752a2[_0xc8f7('0x85')]=_0xda6aa4[_0xc8f7('0x81')]+_0xc8f7('0x86')+_0x3752a2[_0xc8f7('0x88')]+_0xc8f7('0x87')+md5(_0x3752a2[_0xc8f7('0x88')]);}var _0x157545=_0xda6aa4['host']===_0xc8f7('0x91')?'eu':_0xc8f7('0x89');return getAccessToken(_0xda6aa4)['then'](function(_0x7bd649){_0x221bf1=_0x7bd649;return getUser(_0x221bf1,_0x157545,_0xda6aa4,_0x57b06f[_0xc8f7('0x38')]);})['then'](function(_0x858409){_0x2f3dd2=_0x858409;logger[_0xc8f7('0x39')](_0xc8f7('0x8a'),_0x2f3dd2['id']);return getEndUser(_0x221bf1,_0x157545,_0xda6aa4,_0x3752a2[_0xc8f7('0x92')],_0x3752a2['destcalleridnum'],_0x2f3dd2,_0x4c788c);})[_0xc8f7('0x2a')](function(_0xe8e1e1){_0x10b4d7=_0xe8e1e1;return getCall(_0x221bf1,_0x157545,_0xda6aa4,_0x2f3dd2,_0x10b4d7,_0x4c788c,_0x3752a2,_0xc8f7('0x93'));})[_0xc8f7('0x2a')](function(_0x1fd318){if(_0x1fd318){logger['info']('The\x20Call\x20ID\x20is:',_0x1fd318['id']);logger['info'](_0xc8f7('0x90'),_0xc8f7('0x8d'));emit(util[_0xc8f7('0x63')](_0xc8f7('0x94'),_0x57b06f[_0xc8f7('0x18')]),_0xc8f7('0x8e'),{'uri':_0xc8f7('0x95')+_0xda6aa4[_0xc8f7('0x7f')]+'/crm/EntityInfo.do?module=Calls&id='+_0x1fd318['id']});}})[_0xc8f7('0x40')](function(_0x2d7668){logger[_0xc8f7('0x2d')](_0xc8f7('0x90'),JSON['stringify'](_0x2d7668));});};exports[_0xc8f7('0x96')]=function(_0x57a641,_0x521d22,_0x2a7561,_0x136814,_0x66a017,_0x49f5b4){var _0x39099e,_0x1b8d71,_0x3109eb;_0x49f5b4['host']=intUtil[_0xc8f7('0x80')](_0x49f5b4[_0xc8f7('0x7f')]);_0x49f5b4[_0xc8f7('0x81')]=intUtil[_0xc8f7('0x80')](_0x49f5b4[_0xc8f7('0x81')]);if(_0x66a017&&_0x66a017[_0xc8f7('0x82')]){logger[_0xc8f7('0x39')]('['+_0x521d22[_0xc8f7('0x6b')][_0xc8f7('0x97')]()+']',_0xc8f7('0x84'));_0x521d22[_0xc8f7('0x85')]=_0x49f5b4['serverUrl']+_0xc8f7('0x86')+_0x521d22[_0xc8f7('0x88')]+_0xc8f7('0x87')+md5(_0x521d22['uniqueid']);}else{_0x521d22[_0xc8f7('0x85')]='';}var _0x3dfd79=_0x49f5b4['host']==='zoho.eu'?'eu':_0xc8f7('0x89');return getAccessToken(_0x49f5b4)[_0xc8f7('0x2a')](function(_0x3ebd99){_0x3109eb=_0x3ebd99;return getUser(_0x3109eb,_0x3dfd79,_0x49f5b4);})['then'](function(_0x119f47){_0x39099e=_0x119f47;logger[_0xc8f7('0x39')](_0xc8f7('0x8a'),_0x39099e['id']);return getEndUser(_0x3109eb,_0x3dfd79,_0x49f5b4,_0x521d22[_0xc8f7('0x8b')],_0x521d22[_0xc8f7('0x8c')],_0x39099e,_0x2a7561);})[_0xc8f7('0x2a')](function(_0xd68420){_0x1b8d71=_0xd68420;return getCall(_0x3109eb,_0x3dfd79,_0x49f5b4,_0x39099e,_0x1b8d71,_0x2a7561,_0x521d22,_0xc8f7('0x79'));})[_0xc8f7('0x2a')](function(_0x2fc9b3){if(_0x2fc9b3){logger[_0xc8f7('0x39')]('The\x20Call\x20ID\x20is:',_0x2fc9b3['id']);}})[_0xc8f7('0x40')](function(_0x2a9b0e){logger['error']('['+_0x521d22['lastevent'][_0xc8f7('0x97')]()+']',JSON[_0xc8f7('0xb')](_0x2a9b0e));});}; \ 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 e729cab..cd85e08 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 _0xa400=['shelljs','mustache','exec','data2','data3','render','error','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s'];(function(_0x43d0d1,_0x558634){var _0xfe7111=function(_0x1c1679){while(--_0x1c1679){_0x43d0d1['push'](_0x43d0d1['shift']());}};_0xfe7111(++_0x558634);}(_0xa400,0xcf));var _0x0a40=function(_0xc60220,_0x1eba66){_0xc60220=_0xc60220-0x0;var _0x1be75c=_0xa400[_0xc60220];return _0x1be75c;};'use strict';var util=require('util');var sh=require(_0x0a40('0x0'));var Mustache=require(_0x0a40('0x1'));var logger=require('../../../../config/logger')('trigger');exports[_0x0a40('0x2')]=function(_0x35ba3f,_0x1a529f){var _0x169bd1=_0x35ba3f[_0x0a40('0x3')]?_0x35ba3f[_0x0a40('0x3')]:'Script';var _0x4a3699=_0x35ba3f[_0x0a40('0x4')]?Mustache[_0x0a40('0x5')](_0x35ba3f[_0x0a40('0x4')],_0x1a529f):_0x1a529f;sh[_0x0a40('0x2')](_0x4a3699,function(_0x1aa9f0,_0x46d642,_0xce56b3){if(_0x1aa9f0!==0x0){logger[_0x0a40('0x6')](util[_0x0a40('0x7')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x169bd1,_0x4a3699,_0x1aa9f0,_0xce56b3));}else{logger['info'](util[_0x0a40('0x7')](_0x0a40('0x8'),_0x169bd1,_0x4a3699,_0x46d642));}});}; \ No newline at end of file +var _0x9e91=['error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','trigger','exec','data2','Script','data3','render'];(function(_0x330740,_0x58c0c0){var _0x1cb5f2=function(_0xa5c99a){while(--_0xa5c99a){_0x330740['push'](_0x330740['shift']());}};_0x1cb5f2(++_0x58c0c0);}(_0x9e91,0x1a6));var _0x19e9=function(_0x29427b,_0xd431d4){_0x29427b=_0x29427b-0x0;var _0x1a071c=_0x9e91[_0x29427b];return _0x1a071c;};'use strict';var util=require(_0x19e9('0x0'));var sh=require('shelljs');var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x19e9('0x1'));exports[_0x19e9('0x2')]=function(_0x21fef5,_0x1c8434){var _0xb4d7e6=_0x21fef5[_0x19e9('0x3')]?_0x21fef5[_0x19e9('0x3')]:_0x19e9('0x4');var _0x5a8435=_0x21fef5[_0x19e9('0x5')]?Mustache[_0x19e9('0x6')](_0x21fef5[_0x19e9('0x5')],_0x1c8434):_0x1c8434;sh['exec'](_0x5a8435,function(_0x3a6840,_0x2c9d57,_0x470ce8){if(_0x3a6840!==0x0){logger[_0x19e9('0x7')](util['format'](_0x19e9('0x8'),_0xb4d7e6,_0x5a8435,_0x3a6840,_0x470ce8));}else{logger['info'](util[_0x19e9('0x9')](_0x19e9('0xa'),_0xb4d7e6,_0x5a8435,_0x2c9d57));}});}; \ 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 fed961d..61f7d95 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 _0xb6ee=['toUpperCase','render','data2','number','data5','headers','data6','parse','error','data1','data7','body','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','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','format','name','message','util','lodash','mustache','../../../../config/logger','trigger','exec'];(function(_0x1271ec,_0xb178d1){var _0x1f6ed2=function(_0x2c32f3){while(--_0x2c32f3){_0x1271ec['push'](_0x1271ec['shift']());}};_0x1f6ed2(++_0xb178d1);}(_0xb6ee,0x7a));var _0xeb6e=function(_0x37b31d,_0x3151b5){_0x37b31d=_0x37b31d-0x0;var _0x237fa7=_0xb6ee[_0x37b31d];return _0x237fa7;};'use strict';var rp=require('request-promise');var util=require(_0xeb6e('0x0'));var _=require(_0xeb6e('0x1'));var Mustache=require(_0xeb6e('0x2'));var logger=require(_0xeb6e('0x3'))(_0xeb6e('0x4'));exports[_0xeb6e('0x5')]=function(_0x15d1e8,_0x286525){var _0x5c1532,_0x477de0;var _0x45518a={'method':_0x15d1e8['data1'][_0xeb6e('0x6')](),'uri':Mustache[_0xeb6e('0x7')](_0x15d1e8[_0xeb6e('0x8')],_0x286525),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x15d1e8['data5'])===_0xeb6e('0x9')&&parseInt(_0x15d1e8[_0xeb6e('0xa')])>=0x1&&parseInt(_0x15d1e8[_0xeb6e('0xa')])<=0xa?parseInt(_0x15d1e8['data5'])*0x3e8:0x5*0x3e8};try{_0x45518a[_0xeb6e('0xb')]=_0x15d1e8[_0xeb6e('0xc')]?JSON[_0xeb6e('0xd')](Mustache[_0xeb6e('0x7')](_0x15d1e8['data6'],_0x286525)):{};}catch(_0x2282bf){logger[_0xeb6e('0xe')](_0x2282bf['stack']);}switch(_0x15d1e8[_0xeb6e('0xf')][_0xeb6e('0x6')]()){case'GET':case'DELETE':_0x5c1532=null;_0x45518a['qs']=_0x286525;break;case'POST':case'PUT':if(_0x15d1e8[_0xeb6e('0x10')]){try{_0x5c1532=JSON[_0xeb6e('0xd')](Mustache[_0xeb6e('0x7')](_0x15d1e8['data7'],_0x286525));_0x45518a[_0xeb6e('0x11')]=_0x5c1532;}catch(_0x2005c7){logger[_0xeb6e('0xe')](_0x2005c7[_0xeb6e('0x12')]);logger['error'](_0xeb6e('0x13'));}}else{_0x5c1532=_0x286525;_0x45518a[_0xeb6e('0x11')]=_0x5c1532;}break;}logger[_0xeb6e('0x14')](util['format'](_0xeb6e('0x15'),_0x15d1e8[_0xeb6e('0xf')],_0x15d1e8['data2'],JSON[_0xeb6e('0x16')](_0x45518a)));rp(_0x45518a)[_0xeb6e('0x17')](function(_0x1cbe6f){_0x5c1532=!_[_0xeb6e('0x18')](_0x5c1532)?_0xeb6e('0x19')+_0x5c1532:'';_0x477de0=typeof _0x1cbe6f[_0xeb6e('0x11')]==='object'?JSON[_0xeb6e('0x16')](_0x1cbe6f['body']):_0x1cbe6f[_0xeb6e('0x11')];logger[_0xeb6e('0x14')](util['format'](_0xeb6e('0x1a'),_0x15d1e8[_0xeb6e('0xf')],_0x15d1e8[_0xeb6e('0x8')],_0x1cbe6f[_0xeb6e('0x1b')],_0x477de0));})[_0xeb6e('0x1c')](function(_0x420821){logger['error'](util[_0xeb6e('0x1d')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x15d1e8['data1'],_0x15d1e8[_0xeb6e('0x8')],_0x420821['statusCode'],_0x420821[_0xeb6e('0x1e')],_0x420821[_0xeb6e('0x1f')]));});}; \ No newline at end of file +var _0x6ad0=['body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','info','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','lodash','mustache','../../../../config/logger','exec','data1','toUpperCase','data2','data5','headers','data6','parse','error','stack','GET','DELETE','POST','PUT','data7'];(function(_0x2f0811,_0x589ce){var _0x18ff83=function(_0x4c269a){while(--_0x4c269a){_0x2f0811['push'](_0x2f0811['shift']());}};_0x18ff83(++_0x589ce);}(_0x6ad0,0x8e));var _0x06ad=function(_0x1fe64b,_0x4c4563){_0x1fe64b=_0x1fe64b-0x0;var _0x440f7b=_0x6ad0[_0x1fe64b];return _0x440f7b;};'use strict';var rp=require('request-promise');var util=require('util');var _=require(_0x06ad('0x0'));var Mustache=require(_0x06ad('0x1'));var logger=require(_0x06ad('0x2'))('trigger');exports[_0x06ad('0x3')]=function(_0x10b8be,_0xb927ba){var _0x311f7c,_0x217c42;var _0x102956={'method':_0x10b8be[_0x06ad('0x4')][_0x06ad('0x5')](),'uri':Mustache['render'](_0x10b8be[_0x06ad('0x6')],_0xb927ba),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x10b8be[_0x06ad('0x7')])==='number'&&parseInt(_0x10b8be[_0x06ad('0x7')])>=0x1&&parseInt(_0x10b8be[_0x06ad('0x7')])<=0xa?parseInt(_0x10b8be[_0x06ad('0x7')])*0x3e8:0x5*0x3e8};try{_0x102956[_0x06ad('0x8')]=_0x10b8be[_0x06ad('0x9')]?JSON[_0x06ad('0xa')](Mustache['render'](_0x10b8be['data6'],_0xb927ba)):{};}catch(_0x2a5f08){logger[_0x06ad('0xb')](_0x2a5f08[_0x06ad('0xc')]);}switch(_0x10b8be[_0x06ad('0x4')][_0x06ad('0x5')]()){case _0x06ad('0xd'):case _0x06ad('0xe'):_0x311f7c=null;_0x102956['qs']=_0xb927ba;break;case _0x06ad('0xf'):case _0x06ad('0x10'):if(_0x10b8be['data7']){try{_0x311f7c=JSON[_0x06ad('0xa')](Mustache['render'](_0x10b8be[_0x06ad('0x11')],_0xb927ba));_0x102956[_0x06ad('0x12')]=_0x311f7c;}catch(_0x3e80a2){logger[_0x06ad('0xb')](_0x3e80a2[_0x06ad('0xc')]);logger[_0x06ad('0xb')](_0x06ad('0x13'));}}else{_0x311f7c=_0xb927ba;_0x102956[_0x06ad('0x12')]=_0x311f7c;}break;}logger['info'](util['format'](_0x06ad('0x14'),_0x10b8be['data1'],_0x10b8be['data2'],JSON[_0x06ad('0x15')](_0x102956)));rp(_0x102956)[_0x06ad('0x16')](function(_0x260720){_0x311f7c=!_[_0x06ad('0x17')](_0x311f7c)?_0x06ad('0x18')+_0x311f7c:'';_0x217c42=typeof _0x260720['body']===_0x06ad('0x19')?JSON[_0x06ad('0x15')](_0x260720['body']):_0x260720[_0x06ad('0x12')];logger[_0x06ad('0x1a')](util[_0x06ad('0x1b')](_0x06ad('0x1c'),_0x10b8be[_0x06ad('0x4')],_0x10b8be['data2'],_0x260720[_0x06ad('0x1d')],_0x217c42));})['catch'](function(_0x3b14c0){logger[_0x06ad('0xb')](util[_0x06ad('0x1b')](_0x06ad('0x1e'),_0x10b8be['data1'],_0x10b8be[_0x06ad('0x6')],_0x3b14c0['statusCode'],_0x3b14c0[_0x06ad('0x1f')],_0x3b14c0['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index bb64b16..7f2997f 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 _0x780c=['message','result','exports','bluebird','routing','http','Request','request','rpc','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x780c,0xfd));var _0xc780=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x780c[_0x5a9c0c];return _0x53c77d;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xc780('0x0'));var logger=require('../../config/logger')(_0xc780('0x1'));var client=jayson['client'][_0xc780('0x2')]({'port':0x2329});client[_0xc780('0x3')]=function(_0x15b4ea,_0x435419){return new BPromise(function(_0x5d09ff,_0x53c792){return client[_0xc780('0x4')](_0x15b4ea,_0x435419)['then'](function(_0x438b61){logger['debug'](_0xc780('0x5'),_0xc780('0x1'),_0x15b4ea,_0x435419,_0x438b61);if(_0x438b61[_0xc780('0x6')]){logger['error'](_0xc780('0x5'),'routing',_0x15b4ea,_0x438b61[_0xc780('0x6')][_0xc780('0x7')],_0x435419);return _0x53c792(_0x438b61[_0xc780('0x6')][_0xc780('0x7')]);}else{return _0x5d09ff(_0x438b61[_0xc780('0x8')]);}})['catch'](function(_0x33db47){logger[_0xc780('0x6')]('rpc',_0xc780('0x1'),_0x15b4ea,_0x33db47,_0x435419);return _0x53c792(_0x33db47);});});};module[_0xc780('0x9')]=client; \ No newline at end of file +var _0x9f7d=['rpc','error','message','result','catch','bluebird','../../config/logger','routing','client','http','Request','request','then','debug'];(function(_0x533e30,_0x1b0858){var _0x57dcca=function(_0xa7322b){while(--_0xa7322b){_0x533e30['push'](_0x533e30['shift']());}};_0x57dcca(++_0x1b0858);}(_0x9f7d,0x1e1));var _0xd9f7=function(_0x4ae736,_0x3a16ab){_0x4ae736=_0x4ae736-0x0;var _0x1a7d3f=_0x9f7d[_0x4ae736];return _0x1a7d3f;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xd9f7('0x0'));var logger=require(_0xd9f7('0x1'))(_0xd9f7('0x2'));var client=jayson[_0xd9f7('0x3')][_0xd9f7('0x4')]({'port':0x2329});client[_0xd9f7('0x5')]=function(_0x5d3481,_0x18cc79){return new BPromise(function(_0x378d1f,_0x57e32c){return client[_0xd9f7('0x6')](_0x5d3481,_0x18cc79)[_0xd9f7('0x7')](function(_0x27771e){logger[_0xd9f7('0x8')](_0xd9f7('0x9'),_0xd9f7('0x2'),_0x5d3481,_0x18cc79,_0x27771e);if(_0x27771e['error']){logger[_0xd9f7('0xa')](_0xd9f7('0x9'),'routing',_0x5d3481,_0x27771e['error'][_0xd9f7('0xb')],_0x18cc79);return _0x57e32c(_0x27771e[_0xd9f7('0xa')]['message']);}else{return _0x378d1f(_0x27771e[_0xd9f7('0xc')]);}})[_0xd9f7('0xd')](function(_0x4124c4){logger[_0xd9f7('0xa')](_0xd9f7('0x9'),'routing',_0x5d3481,_0x4124c4,_0x18cc79);return _0x57e32c(_0x4124c4);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 51b9bca..c533990 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 _0xbbd3=['./lib/email','email','resolve','then','getMailAccounts','initMailAccounts','refresh','listen','loginMailFrequency','catch','error','Email\x20service\x20initialization','./realtime'];(function(_0x5a8b43,_0x41a0aa){var _0x383129=function(_0x40ae38){while(--_0x40ae38){_0x5a8b43['push'](_0x5a8b43['shift']());}};_0x383129(++_0x41a0aa);}(_0xbbd3,0x19f));var _0x3bbd=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0xbbd3[_0x9c2427];return _0x51984f;};'use strict';var server=require('./server');var Realtime=require(_0x3bbd('0x0'));var EmailChannel=require(_0x3bbd('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var logger=require('../../config/logger')(_0x3bbd('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x3bbd('0x3')]()[_0x3bbd('0x4')](mailAccount[_0x3bbd('0x5')]())[_0x3bbd('0x4')](realtime[_0x3bbd('0x6')]())[_0x3bbd('0x4')](function(){email[_0x3bbd('0x7')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x3bbd('0x8')](realtime,email)[_0x3bbd('0x4')](function(){return initRealtime();})[_0x3bbd('0x4')](function(){return setting['getSettings']();})[_0x3bbd('0x4')](function(_0x4e8ef4){return setInterval(initRealtime,_0x4e8ef4[_0x3bbd('0x9')]*0x3e8);})[_0x3bbd('0xa')](function(_0x4223e1){logger[_0x3bbd('0xb')](_0x3bbd('0xc'),_0x4223e1);});}main(); \ No newline at end of file +var _0x472b=['mailAccounts','getSettings','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','refresh'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x472b,0x184));var _0xb472=function(_0x1ccc02,_0x4aec78){_0x1ccc02=_0x1ccc02-0x0;var _0x437986=_0x472b[_0x1ccc02];return _0x437986;};'use strict';var server=require(_0xb472('0x0'));var Realtime=require(_0xb472('0x1'));var EmailChannel=require(_0xb472('0x2'));var mailAccount=require(_0xb472('0x3'));var setting=require(_0xb472('0x4'));var logger=require(_0xb472('0x5'))(_0xb472('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xb472('0x7')]()[_0xb472('0x8')](mailAccount[_0xb472('0x9')]())[_0xb472('0x8')](realtime[_0xb472('0xa')]())['then'](function(){email[_0xb472('0xb')](realtime[_0xb472('0xc')]);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(){return initRealtime();})[_0xb472('0x8')](function(){return setting[_0xb472('0xd')]();})[_0xb472('0x8')](function(_0x4ccf4c){return setInterval(initRealtime,_0x4ccf4c['loginMailFrequency']*0x3e8);})['catch'](function(_0x5c855a){logger[_0xb472('0xe')](_0xb472('0xf'),_0x5c855a);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 833fb71..e52ddc8 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 _0xca28=['mailAccounts','imapAccounts','smtp','emit','name','key','active','status','Imap','messageStatus','total','isNil','stringify','md5','mailAccount:update','prototype','hasOwnProperty','service','provider','custom','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError','sendMail','send','Smtp','verify','verified','exports','bluebird','ioredis','../../../config/logger','email','redis','socket.io-emitter','./imap','../rpc/mailAccount','info','start\x20email\x20channel'];(function(_0x5d3abb,_0x41852f){var _0x298e72=function(_0x47a746){while(--_0x47a746){_0x5d3abb['push'](_0x5d3abb['shift']());}};_0x298e72(++_0x41852f);}(_0xca28,0x66));var _0x8ca2=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xca28[_0x334841];return _0x5beb4b;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0x8ca2('0x0'));var md5=require('md5');var Redis=require(_0x8ca2('0x1'));var config=require('../../../config/environment');var logger=require(_0x8ca2('0x2'))(_0x8ca2('0x3'));config['redis']=_['defaults'](config[_0x8ca2('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x8ca2('0x5'))(new Redis(config[_0x8ca2('0x4')]));var EmailImap=require(_0x8ca2('0x6'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x8ca2('0x7'));var md5Accounts={};function EmailChannel(_0x1949c9){logger[_0x8ca2('0x8')](_0x8ca2('0x9'));this['mailAccounts']=_0x1949c9[_0x8ca2('0xa')];this[_0x8ca2('0xb')]={};this[_0x8ca2('0xc')]=new EmailSmtp();}EmailChannel['prototype'][_0x8ca2('0xd')]=function(_0x328da9){var _0x4b81c8=this['mailAccounts'][_0x328da9];var _0x29f4d3={'id':_0x4b81c8['id'],'name':_0x4b81c8[_0x8ca2('0xe')],'key':_0x4b81c8[_0x8ca2('0xf')],'active':_0x4b81c8[_0x8ca2('0x10')],'Imap':{'status':_0x4b81c8['Imap'][_0x8ca2('0x11')],'messageStatus':_0x4b81c8[_0x8ca2('0x12')][_0x8ca2('0x13')],'total':_0x4b81c8[_0x8ca2('0x12')][_0x8ca2('0x14')]}};if(_[_0x8ca2('0x15')](md5Accounts[_0x328da9])){md5Accounts[_0x328da9]={};}var _0x38619a=md5(JSON[_0x8ca2('0x16')](_0x29f4d3));if(md5Accounts[_0x328da9][_0x8ca2('0x17')]!==_0x38619a){md5Accounts[_0x328da9][_0x8ca2('0x17')]=_0x38619a;io['emit'](_0x8ca2('0x18'),_0x29f4d3);}};EmailChannel[_0x8ca2('0x19')]['refresh']=function(_0x450f56){for(var _0x3a58c4 in _0x450f56){if(_0x450f56[_0x8ca2('0x1a')](_0x3a58c4)){if(_0x450f56[_0x3a58c4][_0x8ca2('0x12')]&&_0x450f56[_0x3a58c4]['active']){var _0x48867a=_0x450f56[_0x3a58c4][_0x8ca2('0x12')];if(!_0x48867a[_0x8ca2('0x1b')]&&_0x450f56[_0x3a58c4][_0x8ca2('0x1c')]!==_0x8ca2('0x1d'))_0x48867a[_0x8ca2('0x1b')]=_0x450f56[_0x3a58c4][_0x8ca2('0x1c')];if(!this['imapAccounts'][_0x8ca2('0x1a')](_0x48867a['id'])){this[_0x8ca2('0xb')][_0x48867a['id']]=new EmailImap(_0x48867a,_0x450f56[_0x3a58c4]['email']);this['imapAccounts'][_0x48867a['id']]['on'](_0x8ca2('0x1e'),this[_0x8ca2('0x1f')][_0x8ca2('0x20')](this,_0x3a58c4));this[_0x8ca2('0xb')][_0x48867a['id']]['on'](_0x8ca2('0x3'),this[_0x8ca2('0x21')][_0x8ca2('0x20')](this,_0x3a58c4));this[_0x8ca2('0xb')][_0x48867a['id']]['on'](_0x8ca2('0x22'),this[_0x8ca2('0x23')][_0x8ca2('0x20')](this,_0x3a58c4));this[_0x8ca2('0xb')][_0x48867a['id']]['on'](_0x8ca2('0x24'),this['handleImapError'][_0x8ca2('0x20')](this,_0x3a58c4));}}else{if(_[_0x8ca2('0x15')](this['mailAccounts'][_0x3a58c4][_0x8ca2('0x12')])){this['mailAccounts'][_0x3a58c4][_0x8ca2('0x12')]={};}this[_0x8ca2('0xa')][_0x3a58c4][_0x8ca2('0x12')][_0x8ca2('0x11')]=_0x8ca2('0x25');this[_0x8ca2('0xa')][_0x3a58c4][_0x8ca2('0x12')][_0x8ca2('0x13')]='';this[_0x8ca2('0xd')](_0x3a58c4);}}}};EmailChannel[_0x8ca2('0x19')][_0x8ca2('0x1f')]=function(_0xd10934,_0x43e35f){if(this[_0x8ca2('0xa')][_0xd10934]){this[_0x8ca2('0xa')][_0xd10934][_0x8ca2('0x12')][_0x8ca2('0x11')]=_0x8ca2('0x26');this[_0x8ca2('0xa')][_0xd10934][_0x8ca2('0x12')]['messageStatus']=_0x43e35f[_0x8ca2('0xe')];if(_0x43e35f[_0x8ca2('0x27')]){this[_0x8ca2('0xa')][_0xd10934]['Imap']['total']=_0x43e35f[_0x8ca2('0x27')]['total'];}return this[_0x8ca2('0xd')](_0xd10934);}};EmailChannel[_0x8ca2('0x19')]['handleImapEmail']=function(_0x35b167,_0x143705){logger[_0x8ca2('0x8')](_0x8ca2('0x28'),_0x143705[_0x8ca2('0x29')],_0x143705[_0x8ca2('0x2a')],_0x143705['from'],_0x35b167);if(this[_0x8ca2('0xa')][_0x35b167]){return mailAccount[_0x8ca2('0x2b')](_0x35b167,_0x143705)[_0x8ca2('0x2c')](function(_0x39bd75){if(_0x39bd75){logger[_0x8ca2('0x8')](_0x8ca2('0x2d'));}})[_0x8ca2('0x2e')](function(_0x5c84ab){logger[_0x8ca2('0x24')](_0x8ca2('0x2f'),JSON[_0x8ca2('0x16')](_0x5c84ab));});}};EmailChannel['prototype'][_0x8ca2('0x23')]=function(_0x3a099b){if(this[_0x8ca2('0xa')][_0x3a099b]&&this['mailAccounts'][_0x3a099b]['Imap']){if(this['imapAccounts'][this[_0x8ca2('0xa')][_0x3a099b][_0x8ca2('0x12')]['id']]){delete this['imapAccounts'][this[_0x8ca2('0xa')][_0x3a099b][_0x8ca2('0x12')]['id']];}this[_0x8ca2('0xa')][_0x3a099b][_0x8ca2('0x12')][_0x8ca2('0x30')]=moment();this['emit'](_0x3a099b);}};EmailChannel[_0x8ca2('0x19')][_0x8ca2('0x31')]=function(_0x386099,_0x4eefa8){if(this[_0x8ca2('0xa')][_0x386099]){this[_0x8ca2('0xa')][_0x386099][_0x8ca2('0x12')]['status']=_0x8ca2('0x24');this[_0x8ca2('0xa')][_0x386099][_0x8ca2('0x12')][_0x8ca2('0x13')]=_0x4eefa8;return this[_0x8ca2('0xd')](_0x386099);}};EmailChannel[_0x8ca2('0x19')][_0x8ca2('0x32')]=function(_0x217c43,_0x11b203){return this[_0x8ca2('0xc')][_0x8ca2('0x33')](_0x217c43,_0x11b203);};EmailChannel['prototype']['verifySmtp']=function(_0x3668e6){var _0x48c670=this;if(this[_0x8ca2('0xa')][_0x3668e6['id']]){if(_['isNil'](this[_0x8ca2('0xa')][_0x3668e6['id']]['Smtp'])){this[_0x8ca2('0xa')][_0x3668e6['id']]['Smtp']={};}this[_0x8ca2('0xa')][_0x3668e6['id']][_0x8ca2('0x34')]['lastSync']=moment();return new BPromise(function(_0x245855,_0x3b2835){return _0x48c670['smtp'][_0x8ca2('0x35')](_0x3668e6)[_0x8ca2('0x2c')](function(_0x4dbca4){_0x48c670[_0x8ca2('0xa')][_0x3668e6['id']][_0x8ca2('0x34')][_0x8ca2('0x11')]=_0x8ca2('0x36');_0x48c670['mailAccounts'][_0x3668e6['id']][_0x8ca2('0x34')]['messageStatus']='';_0x48c670['emit'](_0x3668e6['id']);_0x245855(_0x4dbca4);})[_0x8ca2('0x2e')](function(_0x53c14a){_0x48c670[_0x8ca2('0xa')][_0x3668e6['id']][_0x8ca2('0x34')][_0x8ca2('0x11')]=_0x8ca2('0x24');_0x48c670[_0x8ca2('0xa')][_0x3668e6['id']][_0x8ca2('0x34')][_0x8ca2('0x13')]=_0x53c14a;_0x48c670[_0x8ca2('0xd')](_0x3668e6['id']);_0x3b2835(_0x53c14a);});});}return this[_0x8ca2('0xc')][_0x8ca2('0x35')](_0x3668e6);};module[_0x8ca2('0x37')]=EmailChannel; \ No newline at end of file +var _0x38a2=['New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','handleImapEnd','lastSync','verifySmtp','Smtp','verify','then','verified','lodash','moment','bluebird','ioredis','../../../config/environment','email','redis','defaults','localhost','socket.io-emitter','./imap','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','messageStatus','Imap','total','isNil','md5','mailAccount:update','refresh','hasOwnProperty','active','provider','service','box','handleImapBox','bind','handleImapEmail','end','error','handleImapError','status','disabled','connected','messages'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x38a2,0x158));var _0x238a=function(_0x1a454b,_0x18ac32){_0x1a454b=_0x1a454b-0x0;var _0x3a3d89=_0x38a2[_0x1a454b];return _0x3a3d89;};'use strict';var _=require(_0x238a('0x0'));var moment=require(_0x238a('0x1'));var BPromise=require(_0x238a('0x2'));var md5=require('md5');var Redis=require(_0x238a('0x3'));var config=require(_0x238a('0x4'));var logger=require('../../../config/logger')(_0x238a('0x5'));config[_0x238a('0x6')]=_[_0x238a('0x7')](config[_0x238a('0x6')],{'host':_0x238a('0x8'),'port':0x18eb});var io=require(_0x238a('0x9'))(new Redis(config[_0x238a('0x6')]));var EmailImap=require(_0x238a('0xa'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x238a('0xb'));var md5Accounts={};function EmailChannel(_0x3189fb){logger[_0x238a('0xc')](_0x238a('0xd'));this[_0x238a('0xe')]=_0x3189fb[_0x238a('0xe')];this[_0x238a('0xf')]={};this[_0x238a('0x10')]=new EmailSmtp();}EmailChannel[_0x238a('0x11')][_0x238a('0x12')]=function(_0x33a76d){var _0x287785=this[_0x238a('0xe')][_0x33a76d];var _0x5c57b1={'id':_0x287785['id'],'name':_0x287785['name'],'key':_0x287785['key'],'active':_0x287785['active'],'Imap':{'status':_0x287785['Imap']['status'],'messageStatus':_0x287785['Imap'][_0x238a('0x13')],'total':_0x287785[_0x238a('0x14')][_0x238a('0x15')]}};if(_[_0x238a('0x16')](md5Accounts[_0x33a76d])){md5Accounts[_0x33a76d]={};}var _0x1e70c2=md5(JSON['stringify'](_0x5c57b1));if(md5Accounts[_0x33a76d][_0x238a('0x17')]!==_0x1e70c2){md5Accounts[_0x33a76d]['md5']=_0x1e70c2;io[_0x238a('0x12')](_0x238a('0x18'),_0x5c57b1);}};EmailChannel[_0x238a('0x11')][_0x238a('0x19')]=function(_0x301526){for(var _0x251336 in _0x301526){if(_0x301526[_0x238a('0x1a')](_0x251336)){if(_0x301526[_0x251336][_0x238a('0x14')]&&_0x301526[_0x251336][_0x238a('0x1b')]){var _0x459be1=_0x301526[_0x251336]['Imap'];if(!_0x459be1['service']&&_0x301526[_0x251336][_0x238a('0x1c')]!=='custom')_0x459be1[_0x238a('0x1d')]=_0x301526[_0x251336][_0x238a('0x1c')];if(!this[_0x238a('0xf')]['hasOwnProperty'](_0x459be1['id'])){this[_0x238a('0xf')][_0x459be1['id']]=new EmailImap(_0x459be1,_0x301526[_0x251336][_0x238a('0x5')]);this[_0x238a('0xf')][_0x459be1['id']]['on'](_0x238a('0x1e'),this[_0x238a('0x1f')][_0x238a('0x20')](this,_0x251336));this[_0x238a('0xf')][_0x459be1['id']]['on'](_0x238a('0x5'),this[_0x238a('0x21')]['bind'](this,_0x251336));this[_0x238a('0xf')][_0x459be1['id']]['on'](_0x238a('0x22'),this['handleImapEnd'][_0x238a('0x20')](this,_0x251336));this[_0x238a('0xf')][_0x459be1['id']]['on'](_0x238a('0x23'),this[_0x238a('0x24')]['bind'](this,_0x251336));}}else{if(_['isNil'](this[_0x238a('0xe')][_0x251336]['Imap'])){this[_0x238a('0xe')][_0x251336][_0x238a('0x14')]={};}this['mailAccounts'][_0x251336]['Imap'][_0x238a('0x25')]=_0x238a('0x26');this['mailAccounts'][_0x251336][_0x238a('0x14')][_0x238a('0x13')]='';this[_0x238a('0x12')](_0x251336);}}}};EmailChannel[_0x238a('0x11')]['handleImapBox']=function(_0x59b0cc,_0x598b86){if(this[_0x238a('0xe')][_0x59b0cc]){this['mailAccounts'][_0x59b0cc][_0x238a('0x14')][_0x238a('0x25')]=_0x238a('0x27');this[_0x238a('0xe')][_0x59b0cc]['Imap']['messageStatus']=_0x598b86['name'];if(_0x598b86[_0x238a('0x28')]){this[_0x238a('0xe')][_0x59b0cc][_0x238a('0x14')][_0x238a('0x15')]=_0x598b86[_0x238a('0x28')]['total'];}return this[_0x238a('0x12')](_0x59b0cc);}};EmailChannel[_0x238a('0x11')][_0x238a('0x21')]=function(_0x291a8b,_0x2e232c){logger[_0x238a('0xc')](_0x238a('0x29'),_0x2e232c['firstName'],_0x2e232c[_0x238a('0x2a')],_0x2e232c[_0x238a('0x2b')],_0x291a8b);if(this['mailAccounts'][_0x291a8b]){return mailAccount['notify'](_0x291a8b,_0x2e232c)['then'](function(_0x20e35e){if(_0x20e35e){logger[_0x238a('0xc')](_0x238a('0x2c'));}})[_0x238a('0x2d')](function(_0x5389de){logger['error'](_0x238a('0x2e'),JSON[_0x238a('0x2f')](_0x5389de));});}};EmailChannel['prototype'][_0x238a('0x30')]=function(_0x2a4958){if(this['mailAccounts'][_0x2a4958]&&this[_0x238a('0xe')][_0x2a4958]['Imap']){if(this[_0x238a('0xf')][this['mailAccounts'][_0x2a4958][_0x238a('0x14')]['id']]){delete this[_0x238a('0xf')][this[_0x238a('0xe')][_0x2a4958][_0x238a('0x14')]['id']];}this[_0x238a('0xe')][_0x2a4958][_0x238a('0x14')][_0x238a('0x31')]=moment();this[_0x238a('0x12')](_0x2a4958);}};EmailChannel[_0x238a('0x11')][_0x238a('0x24')]=function(_0x213bdb,_0x24aa77){if(this[_0x238a('0xe')][_0x213bdb]){this['mailAccounts'][_0x213bdb][_0x238a('0x14')]['status']=_0x238a('0x23');this['mailAccounts'][_0x213bdb][_0x238a('0x14')]['messageStatus']=_0x24aa77;return this['emit'](_0x213bdb);}};EmailChannel[_0x238a('0x11')]['sendMail']=function(_0x342000,_0x32bb89){return this['smtp']['send'](_0x342000,_0x32bb89);};EmailChannel[_0x238a('0x11')][_0x238a('0x32')]=function(_0x28a390){var _0x1b950c=this;if(this[_0x238a('0xe')][_0x28a390['id']]){if(_[_0x238a('0x16')](this[_0x238a('0xe')][_0x28a390['id']][_0x238a('0x33')])){this[_0x238a('0xe')][_0x28a390['id']]['Smtp']={};}this[_0x238a('0xe')][_0x28a390['id']][_0x238a('0x33')][_0x238a('0x31')]=moment();return new BPromise(function(_0x4b182a,_0x4e7528){return _0x1b950c[_0x238a('0x10')][_0x238a('0x34')](_0x28a390)[_0x238a('0x35')](function(_0x180849){_0x1b950c[_0x238a('0xe')][_0x28a390['id']][_0x238a('0x33')][_0x238a('0x25')]=_0x238a('0x36');_0x1b950c[_0x238a('0xe')][_0x28a390['id']]['Smtp'][_0x238a('0x13')]='';_0x1b950c[_0x238a('0x12')](_0x28a390['id']);_0x4b182a(_0x180849);})[_0x238a('0x2d')](function(_0x27a5bb){_0x1b950c[_0x238a('0xe')][_0x28a390['id']]['Smtp'][_0x238a('0x25')]='error';_0x1b950c[_0x238a('0xe')][_0x28a390['id']][_0x238a('0x33')][_0x238a('0x13')]=_0x27a5bb;_0x1b950c[_0x238a('0x12')](_0x28a390['id']);_0x4e7528(_0x27a5bb);});});}return this[_0x238a('0x10')][_0x238a('0x34')](_0x28a390);};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 4658fb7..9012f93 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 _0x6d29=['handleError','connect','inherits','prototype','user','generateXOAuth2Token','CloudProvider','password','authentication','anonymous@xcally.com','host','port','tls','required','handleReady','openBox','mailbox','handleOpenBox','emit','box','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchEnd','closeBox','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchError','handleEnd','textCode','hasOwnProperty','upperFirst','exports','lodash','util','mailparser','simpleParser','iconv','Iconv','EventEmitter','./utils','../../../config/logger','email','account','getAccount','once','ready','bind','imap','error'];(function(_0x234346,_0x4f31ba){var _0x1550ae=function(_0x553026){while(--_0x553026){_0x234346['push'](_0x234346['shift']());}};_0x1550ae(++_0x4f31ba);}(_0x6d29,0x157));var _0x96d2=function(_0x31a9d1,_0x283ae9){_0x31a9d1=_0x31a9d1-0x0;var _0x127d8e=_0x6d29[_0x31a9d1];return _0x127d8e;};'use strict';var _=require(_0x96d2('0x0'));var util=require(_0x96d2('0x1'));var Imap=require('imap');var simpleParser=require(_0x96d2('0x2'))[_0x96d2('0x3')];var Iconv=require(_0x96d2('0x4'))[_0x96d2('0x5')];var EventEmitter=require('events')[_0x96d2('0x6')];var utils=require(_0x96d2('0x7'));var logger=require(_0x96d2('0x8'))(_0x96d2('0x9'));function EmailImap(_0x4c50de,_0x1fe97a){this['mailbox']=_0x4c50de['mailbox'];this[_0x96d2('0xa')]=this[_0x96d2('0xb')](_0x4c50de,_0x1fe97a);this['imap']=new Imap(this[_0x96d2('0xa')]);this['imap'][_0x96d2('0xc')](_0x96d2('0xd'),this['handleReady'][_0x96d2('0xe')](this));this[_0x96d2('0xf')][_0x96d2('0xc')]('end',this['handleEnd'][_0x96d2('0xe')](this));this[_0x96d2('0xf')]['on'](_0x96d2('0x10'),this[_0x96d2('0x11')]['bind'](this));this['imap'][_0x96d2('0x12')]();}util[_0x96d2('0x13')](EmailImap,EventEmitter);EmailImap[_0x96d2('0x14')][_0x96d2('0xb')]=function(_0x2b6646,_0x212032){var _0x19dca2={'connTimeout':_0x2b6646['connTimeout']?_0x2b6646['connTimeout']*0x3e8:0x2710,'authTimeout':_0x2b6646['authTimeout']?_0x2b6646['authTimeout']*0x3e8:0x1388};if(_0x2b6646['service']){_0x19dca2[_0x96d2('0x15')]=_0x2b6646[_0x96d2('0x15')];if(_0x2b6646['modernAuthentication']){_0x19dca2['xoauth2']=utils[_0x96d2('0x16')](_0x2b6646[_0x96d2('0x17')]['data5'],_0x2b6646[_0x96d2('0x15')]);}else{_0x19dca2[_0x96d2('0x18')]=_0x2b6646['password'];}}else{if(_0x2b6646[_0x96d2('0x19')]){_0x19dca2[_0x96d2('0x15')]=_0x2b6646[_0x96d2('0x15')];_0x19dca2[_0x96d2('0x18')]=_0x2b6646[_0x96d2('0x18')];}}_0x19dca2[_0x96d2('0x9')]=_0x212032||_0x2b6646[_0x96d2('0x15')]||_0x96d2('0x1a');_0x19dca2[_0x96d2('0x1b')]=_0x2b6646[_0x96d2('0x1b')];_0x19dca2[_0x96d2('0x1c')]=_0x2b6646[_0x96d2('0x1c')]||0x3e1;if(_0x2b6646[_0x96d2('0x1d')]){_0x19dca2['tls']=!![];}else{_0x19dca2[_0x96d2('0x1d')]=![];_0x19dca2['autotls']=_0x96d2('0x1e');}return _0x19dca2;};EmailImap[_0x96d2('0x14')][_0x96d2('0x1f')]=function(){this[_0x96d2('0xf')][_0x96d2('0x20')](this[_0x96d2('0x21')],![],this[_0x96d2('0x22')][_0x96d2('0xe')](this));};EmailImap['prototype'][_0x96d2('0x22')]=function(_0x1677ef,_0x94c9f7){if(_0x1677ef){this[_0x96d2('0x11')](_0x1677ef,!![]);}else{this[_0x96d2('0x23')](_0x96d2('0x24'),_0x94c9f7);this[_0x96d2('0x25')]();}};EmailImap[_0x96d2('0x14')][_0x96d2('0x26')]=function(_0x2af47a){if(_0x2af47a){this['handleError'](_0x2af47a,!![]);}else{this[_0x96d2('0xf')][_0x96d2('0x27')]();}};EmailImap[_0x96d2('0x14')]['readUnseen']=function(){this['imap'][_0x96d2('0x28')]([_0x96d2('0x29')],this[_0x96d2('0x2a')]['bind'](this));};EmailImap['prototype'][_0x96d2('0x2a')]=function(_0x452d3f,_0x10495e){if(_0x452d3f){this[_0x96d2('0x11')](_0x452d3f,!![]);}else{if(_0x10495e[_0x96d2('0x2b')]){try{var _0x39f80a=this[_0x96d2('0xf')][_0x96d2('0x2c')](_0x10495e,{'bodies':'','markSeen':!![]});_0x39f80a['on'](_0x96d2('0x2d'),this[_0x96d2('0x2e')][_0x96d2('0xe')](this));_0x39f80a[_0x96d2('0xc')](_0x96d2('0x10'),this['handleFetchError'][_0x96d2('0xe')](this));_0x39f80a[_0x96d2('0xc')]('end',this[_0x96d2('0x2f')][_0x96d2('0xe')](this));}catch(_0x315ef6){logger[_0x96d2('0x10')](_0x315ef6);}}else{this[_0x96d2('0xf')][_0x96d2('0x30')](!![],this[_0x96d2('0x26')][_0x96d2('0xe')](this));}}};EmailImap[_0x96d2('0x14')]['handleFetchMessage']=function(_0x5f46ba){_0x5f46ba['on']('body',this['handleMessageBody']['bind'](this));_0x5f46ba[_0x96d2('0xc')](_0x96d2('0x31'),this[_0x96d2('0x32')][_0x96d2('0xe')](this));_0x5f46ba[_0x96d2('0xc')](_0x96d2('0x27'),this[_0x96d2('0x33')][_0x96d2('0xe')](this));};EmailImap[_0x96d2('0x14')]['handleMessageBody']=function(_0x4be0dd){simpleParser(_0x4be0dd,{'Iconv':Iconv},this['handleSimpleParser'][_0x96d2('0xe')](this));};EmailImap[_0x96d2('0x14')][_0x96d2('0x32')]=function(){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap[_0x96d2('0x14')][_0x96d2('0x34')]=function(_0x2a2941,_0x7f0222){if(_0x2a2941){logger[_0x96d2('0x10')](_0x2a2941);}else{var _0x260d57=this;utils[_0x96d2('0x35')](this[_0x96d2('0xa')],_0x7f0222,function(_0xadfc2d){_0x260d57[_0x96d2('0x23')](_0x96d2('0x9'),_0xadfc2d);});}};EmailImap['prototype'][_0x96d2('0x2f')]=function(){this['imap'][_0x96d2('0x30')](!![],this[_0x96d2('0x26')][_0x96d2('0xe')](this));};EmailImap[_0x96d2('0x14')][_0x96d2('0x36')]=function(_0x1e9a13){this['handleError'](_0x1e9a13);this['imap'][_0x96d2('0x30')](!![],this[_0x96d2('0x26')]['bind'](this));};EmailImap[_0x96d2('0x14')][_0x96d2('0x37')]=function(){this[_0x96d2('0x23')](_0x96d2('0x27'));};EmailImap[_0x96d2('0x14')]['handleError']=function(_0x3cb9a3,_0x12e1ca){logger[_0x96d2('0x10')](_0x96d2('0x11'),this[_0x96d2('0xa')][_0x96d2('0x9')],JSON['stringify'](_0x3cb9a3));var _0x177abf='';if(_0x3cb9a3){if(_0x3cb9a3['textCode']){_0x177abf=_0x3cb9a3[_0x96d2('0x38')];}else{for(var _0x206d6b in _0x3cb9a3){if(_0x3cb9a3[_0x96d2('0x39')](_0x206d6b)){_0x177abf+=_[_0x96d2('0x3a')](_0x206d6b)+':\x20'+_0x3cb9a3[_0x206d6b]+'\x0a';}}}}if(_0x12e1ca){this[_0x96d2('0xf')]['end']();}else{this[_0x96d2('0x23')](_0x96d2('0x10'),_0x177abf);this[_0x96d2('0x23')]('end');}};module[_0x96d2('0x3b')]=EmailImap; \ No newline at end of file +var _0x240b=['inherits','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','prototype','openBox','handleOpenBox','emit','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','end','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','stringify','textCode','hasOwnProperty','upperFirst','lodash','util','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','../../../config/logger','email','mailbox','account','getAccount','once','ready','handleReady','bind','handleEnd','error','handleError','connect'];(function(_0x591db7,_0x150445){var _0x4ad760=function(_0x5dd24e){while(--_0x5dd24e){_0x591db7['push'](_0x591db7['shift']());}};_0x4ad760(++_0x150445);}(_0x240b,0xee));var _0xb240=function(_0x455422,_0x4d52f3){_0x455422=_0x455422-0x0;var _0x35c813=_0x240b[_0x455422];return _0x35c813;};'use strict';var _=require(_0xb240('0x0'));var util=require(_0xb240('0x1'));var Imap=require(_0xb240('0x2'));var simpleParser=require(_0xb240('0x3'))[_0xb240('0x4')];var Iconv=require(_0xb240('0x5'))[_0xb240('0x6')];var EventEmitter=require(_0xb240('0x7'))[_0xb240('0x8')];var utils=require('./utils');var logger=require(_0xb240('0x9'))(_0xb240('0xa'));function EmailImap(_0x1d6109,_0x2ac3c4){this[_0xb240('0xb')]=_0x1d6109[_0xb240('0xb')];this[_0xb240('0xc')]=this[_0xb240('0xd')](_0x1d6109,_0x2ac3c4);this[_0xb240('0x2')]=new Imap(this['account']);this[_0xb240('0x2')][_0xb240('0xe')](_0xb240('0xf'),this[_0xb240('0x10')][_0xb240('0x11')](this));this['imap'][_0xb240('0xe')]('end',this[_0xb240('0x12')][_0xb240('0x11')](this));this['imap']['on'](_0xb240('0x13'),this[_0xb240('0x14')][_0xb240('0x11')](this));this[_0xb240('0x2')][_0xb240('0x15')]();}util[_0xb240('0x16')](EmailImap,EventEmitter);EmailImap['prototype'][_0xb240('0xd')]=function(_0x1d2090,_0x5efcc8){var _0xde89f7={'connTimeout':_0x1d2090[_0xb240('0x17')]?_0x1d2090[_0xb240('0x17')]*0x3e8:0x2710,'authTimeout':_0x1d2090['authTimeout']?_0x1d2090[_0xb240('0x18')]*0x3e8:0x1388};if(_0x1d2090[_0xb240('0x19')]){_0xde89f7['user']=_0x1d2090[_0xb240('0x1a')];if(_0x1d2090[_0xb240('0x1b')]){_0xde89f7[_0xb240('0x1c')]=utils[_0xb240('0x1d')](_0x1d2090[_0xb240('0x1e')][_0xb240('0x1f')],_0x1d2090['user']);}else{_0xde89f7[_0xb240('0x20')]=_0x1d2090[_0xb240('0x20')];}}else{if(_0x1d2090[_0xb240('0x21')]){_0xde89f7[_0xb240('0x1a')]=_0x1d2090[_0xb240('0x1a')];_0xde89f7[_0xb240('0x20')]=_0x1d2090[_0xb240('0x20')];}}_0xde89f7['email']=_0x5efcc8||_0x1d2090['user']||_0xb240('0x22');_0xde89f7[_0xb240('0x23')]=_0x1d2090[_0xb240('0x23')];_0xde89f7[_0xb240('0x24')]=_0x1d2090[_0xb240('0x24')]||0x3e1;if(_0x1d2090[_0xb240('0x25')]){_0xde89f7['tls']=!![];}else{_0xde89f7[_0xb240('0x25')]=![];_0xde89f7[_0xb240('0x26')]='required';}return _0xde89f7;};EmailImap[_0xb240('0x27')][_0xb240('0x10')]=function(){this[_0xb240('0x2')][_0xb240('0x28')](this['mailbox'],![],this[_0xb240('0x29')][_0xb240('0x11')](this));};EmailImap[_0xb240('0x27')][_0xb240('0x29')]=function(_0x554739,_0x34697c){if(_0x554739){this[_0xb240('0x14')](_0x554739,!![]);}else{this[_0xb240('0x2a')]('box',_0x34697c);this[_0xb240('0x2b')]();}};EmailImap['prototype'][_0xb240('0x2c')]=function(_0x18f7dd){if(_0x18f7dd){this[_0xb240('0x14')](_0x18f7dd,!![]);}else{this['imap']['end']();}};EmailImap[_0xb240('0x27')][_0xb240('0x2b')]=function(){this[_0xb240('0x2')][_0xb240('0x2d')]([_0xb240('0x2e')],this[_0xb240('0x2f')][_0xb240('0x11')](this));};EmailImap[_0xb240('0x27')][_0xb240('0x2f')]=function(_0x15f964,_0x4c87c4){if(_0x15f964){this['handleError'](_0x15f964,!![]);}else{if(_0x4c87c4[_0xb240('0x30')]){try{var _0x2110db=this[_0xb240('0x2')][_0xb240('0x31')](_0x4c87c4,{'bodies':'','markSeen':!![]});_0x2110db['on'](_0xb240('0x32'),this[_0xb240('0x33')][_0xb240('0x11')](this));_0x2110db['once'](_0xb240('0x13'),this[_0xb240('0x34')]['bind'](this));_0x2110db[_0xb240('0xe')](_0xb240('0x35'),this[_0xb240('0x36')][_0xb240('0x11')](this));}catch(_0x49190e){logger['error'](_0x49190e);}}else{this[_0xb240('0x2')][_0xb240('0x37')](!![],this[_0xb240('0x2c')][_0xb240('0x11')](this));}}};EmailImap[_0xb240('0x27')][_0xb240('0x33')]=function(_0x5b2e1c){_0x5b2e1c['on'](_0xb240('0x38'),this[_0xb240('0x39')][_0xb240('0x11')](this));_0x5b2e1c[_0xb240('0xe')](_0xb240('0x3a'),this[_0xb240('0x3b')][_0xb240('0x11')](this));_0x5b2e1c[_0xb240('0xe')](_0xb240('0x35'),this['handleMessageEnd'][_0xb240('0x11')](this));};EmailImap[_0xb240('0x27')][_0xb240('0x39')]=function(_0x4250bb){simpleParser(_0x4250bb,{'Iconv':Iconv},this[_0xb240('0x3c')][_0xb240('0x11')](this));};EmailImap[_0xb240('0x27')]['handleMessageAttributes']=function(){};EmailImap[_0xb240('0x27')]['handleMessageEnd']=function(){};EmailImap[_0xb240('0x27')]['handleSimpleParser']=function(_0x933f40,_0x366e07){if(_0x933f40){logger[_0xb240('0x13')](_0x933f40);}else{var _0x8e4479=this;utils['parser'](this[_0xb240('0xc')],_0x366e07,function(_0x5940ee){_0x8e4479['emit']('email',_0x5940ee);});}};EmailImap[_0xb240('0x27')]['handleFetchEnd']=function(){this[_0xb240('0x2')]['closeBox'](!![],this[_0xb240('0x2c')][_0xb240('0x11')](this));};EmailImap[_0xb240('0x27')][_0xb240('0x34')]=function(_0x58661e){this[_0xb240('0x14')](_0x58661e);this['imap'][_0xb240('0x37')](!![],this['handleCloseBox'][_0xb240('0x11')](this));};EmailImap[_0xb240('0x27')][_0xb240('0x12')]=function(){this[_0xb240('0x2a')]('end');};EmailImap[_0xb240('0x27')][_0xb240('0x14')]=function(_0x258d33,_0x4d8766){logger[_0xb240('0x13')]('handleError',this[_0xb240('0xc')][_0xb240('0xa')],JSON[_0xb240('0x3d')](_0x258d33));var _0x2e60e1='';if(_0x258d33){if(_0x258d33['textCode']){_0x2e60e1=_0x258d33[_0xb240('0x3e')];}else{for(var _0x99f093 in _0x258d33){if(_0x258d33[_0xb240('0x3f')](_0x99f093)){_0x2e60e1+=_[_0xb240('0x40')](_0x99f093)+':\x20'+_0x258d33[_0x99f093]+'\x0a';}}}}if(_0x4d8766){this[_0xb240('0x2')]['end']();}else{this[_0xb240('0x2a')](_0xb240('0x13'),_0x2e60e1);this['emit'](_0xb240('0x35'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 558784a..6e76fcb 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 _0x8b57=['prototype','send','createTransport','compile','sendMail','toString','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64'];(function(_0x1f1ccc,_0x322e45){var _0x404b73=function(_0xfbb781){while(--_0xfbb781){_0x1f1ccc['push'](_0x1f1ccc['shift']());}};_0x404b73(++_0x322e45);}(_0x8b57,0xe4));var _0x78b5=function(_0x17d497,_0x1a6570){_0x17d497=_0x17d497-0x0;var _0x113f0c=_0x8b57[_0x17d497];return _0x113f0c;};'use strict';var nodemailer=require(_0x78b5('0x0'));var inlineBase64=require(_0x78b5('0x1'));function EmailSmtp(){}EmailSmtp[_0x78b5('0x2')][_0x78b5('0x3')]=function(_0x1b348f,_0x56e384){return new Promise(function(_0x542aad,_0xa7ceb9){var _0x3a1c9a=nodemailer[_0x78b5('0x4')](_0x1b348f);_0x3a1c9a['use'](_0x78b5('0x5'),inlineBase64());_0x3a1c9a[_0x78b5('0x6')](_0x56e384,function(_0x5e6da6,_0x26cddb){if(_0x5e6da6){_0xa7ceb9(_0x5e6da6[_0x78b5('0x7')]());}else{_0x542aad(_0x26cddb);}});});};EmailSmtp['prototype']['verify']=function(_0x5b394d){return new Promise(function(_0x56aeab,_0x44da87){var _0x24557f=nodemailer[_0x78b5('0x4')](_0x5b394d);_0x24557f['verify'](function(_0x5b0946,_0x5e2ba8){if(_0x5b0946){_0x44da87(_0x5b0946[_0x78b5('0x7')]());}else{if(_0x5e2ba8){_0x56aeab(_0x5e2ba8);}else{_0x44da87(_0x78b5('0x8'));}}});});};module[_0x78b5('0x9')]=EmailSmtp; \ No newline at end of file +var _0xe586=['createTransport','use','compile','verify','toString','exports','nodemailer','prototype','send'];(function(_0x3d257b,_0x92967c){var _0x22744e=function(_0x337a1c){while(--_0x337a1c){_0x3d257b['push'](_0x3d257b['shift']());}};_0x22744e(++_0x92967c);}(_0xe586,0x7b));var _0x6e58=function(_0x346416,_0x5e112a){_0x346416=_0x346416-0x0;var _0x1d2792=_0xe586[_0x346416];return _0x1d2792;};'use strict';var nodemailer=require(_0x6e58('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x6e58('0x1')][_0x6e58('0x2')]=function(_0xd672ec,_0x225661){return new Promise(function(_0x5b33d2,_0x550e3f){var _0x179d3f=nodemailer[_0x6e58('0x3')](_0xd672ec);_0x179d3f[_0x6e58('0x4')](_0x6e58('0x5'),inlineBase64());_0x179d3f['sendMail'](_0x225661,function(_0x26e064,_0x2ffd3f){if(_0x26e064){_0x550e3f(_0x26e064['toString']());}else{_0x5b33d2(_0x2ffd3f);}});});};EmailSmtp[_0x6e58('0x1')][_0x6e58('0x6')]=function(_0x1d2782){return new Promise(function(_0x20c5a6,_0x58d9b5){var _0x3ea1f7=nodemailer[_0x6e58('0x3')](_0x1d2782);_0x3ea1f7['verify'](function(_0x1d1a91,_0x5c2975){if(_0x1d1a91){_0x58d9b5(_0x1d1a91[_0x6e58('0x7')]());}else{if(_0x5c2975){_0x20c5a6(_0x5c2975);}else{_0x58d9b5('Not\x20verifired');}}});});};module[_0x6e58('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 af62903..8d659f7 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 _0x85b5=['email','value','address','generate','name','substring','split','length','slice','join','Anonymous','head','isEmpty','anonymous','@xcally.com','html','test','includes','attachments','push','replace','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','utf-8','toString','base64','moment','path','util','../../../config/logger'];(function(_0x53f56d,_0x5225db){var _0x4e7726=function(_0x1578b0){while(--_0x1578b0){_0x53f56d['push'](_0x53f56d['shift']());}};_0x4e7726(++_0x5225db);}(_0x85b5,0x110));var _0x585b=function(_0x5afec3,_0x255c8c){_0x5afec3=_0x5afec3-0x0;var _0x3b4f7b=_0x85b5[_0x5afec3];return _0x3b4f7b;};'use strict';var _=require('lodash');var moment=require(_0x585b('0x0'));var random=require('randomstring');var fs=require('fs');var path=require(_0x585b('0x1'));var util=require(_0x585b('0x2'));var tnef=require('node-tnef');var logger=require(_0x585b('0x3'))(_0x585b('0x4'));var config=require('../../../config/environment');function getAddress(_0x4df663){var _0x21c2da=_['head'](_0x4df663[_0x585b('0x5')]);return _0x21c2da&&_0x21c2da[_0x585b('0x6')]?_0x21c2da['address']:'anonymous'+random[_0x585b('0x7')](0x6)+'@xcally.com';}function getFirstName(_0x2c84d9){var _0x2b5325=_['head'](_0x2c84d9[_0x585b('0x5')]);if(_0x2b5325&&_0x2b5325['name']){if(_0x2b5325[_0x585b('0x8')]==_0x2b5325['address']){return _0x2b5325['name'][_0x585b('0x9')](0x0,_0x2b5325[_0x585b('0x8')]['indexOf']('@'));}var _0x1a7f33=_0x2b5325[_0x585b('0x8')][_0x585b('0xa')](/\s+/);return _0x1a7f33[_0x585b('0xb')]>0x1?_0x1a7f33[_0x585b('0xc')](0x0,-0x1)[_0x585b('0xd')]('\x20'):_0x2b5325['name'];}return _0x585b('0xe');}function getLastName(_0x202741){var _0x19fead=_[_0x585b('0xf')](_0x202741[_0x585b('0x5')]);if(_0x19fead&&_0x19fead[_0x585b('0x8')]){var _0x15e837=_0x19fead[_0x585b('0x8')][_0x585b('0xa')](/\s+/);return _0x15e837[_0x585b('0xb')]>0x1?_0x15e837['pop']():'';}return'';}function getMails(_0x3856bf,_0x51d106){var _0x234e85='';for(var _0x2b8dbc=0x0;_0x2b8dbc<_0x51d106[_0x585b('0x5')][_0x585b('0xb')];_0x2b8dbc+=0x1){if(_0x51d106[_0x585b('0x5')][_0x2b8dbc]['address']!==_0x3856bf){if(!_[_0x585b('0x10')](_0x234e85)){_0x234e85+=',';}_0x234e85+=_0x51d106[_0x585b('0x5')][_0x2b8dbc][_0x585b('0x8')]||_0x51d106[_0x585b('0x5')][_0x2b8dbc]['address']||'';_0x234e85+='\x20<';_0x234e85+=_0x51d106[_0x585b('0x5')][_0x2b8dbc][_0x585b('0x6')]?_0x51d106[_0x585b('0x5')][_0x2b8dbc][_0x585b('0x6')]:_0x585b('0x11')+random[_0x585b('0x7')](0x6)+_0x585b('0x12');_0x234e85+='>';}}return _0x234e85;}function parseEmail(_0x371674,_0x3f4374,_0x43c7ee){if(_0x3f4374[_0x585b('0x13')]){var _0x119376=/)<[^<]*)*<\/script>/gi;while(_0x119376[_0x585b('0x14')](_0x3f4374[_0x585b('0x13')])){_0x3f4374['html']=_0x3f4374[_0x585b('0x13')]['replace'](_0x119376,'');}if(_0x3f4374[_0x585b('0x13')][_0x585b('0x15')]('{_0x5e8671[_0x585b('0x17')](_0x3aebda['filename']);});var _0x3bb04e=/]+>/g;var _0x9c00c0=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x40a669=_0x3f4374[_0x585b('0x13')][_0x585b('0x18')](_0x9c00c0,'_SRC');var _0x173268=_0x40a669['replace'](_0x3bb04e,_0x585b('0x19'));for(let _0x301fb0=0x0;_0x301fb0<_0x5e8671[_0x585b('0xb')];_0x301fb0++){var _0x19bb00=_0x173268[_0x585b('0x18')](_0x585b('0x19'),_0x585b('0x1a')+_0x5e8671[_0x301fb0]+_0x585b('0x1b'));_0x173268=_0x19bb00;}_0x3f4374['html']=_0x173268;}_0x43c7ee[_0x585b('0x1c')]=_0x3f4374['html'];}else{_0x43c7ee[_0x585b('0x1c')]=_0x3f4374[_0x585b('0x1d')];}if(_0x43c7ee[_0x585b('0x1c')]){_0x43c7ee['body']=_0x43c7ee['body']['replace'](/0x0){var _0x5c288b=[_0x585b('0x2d'),'X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply'];for(var _0x16bbd1=0x0;_0x16bbd1<_0x3f4374[_0x585b('0x2c')]['length'];_0x16bbd1++){var _0x3e008c=_['indexOf'](_0x5c288b,_0x3f4374[_0x585b('0x2c')][_0x16bbd1][_0x585b('0x2e')]);if(_0x3e008c>=0x0){_0x43c7ee[_0x585b('0x2f')]=!![];}}}return _0x43c7ee;}exports[_0x585b('0x30')]=function(_0x567583,_0x544bd3,_0x320831){var _0x4dab2f={'from':getAddress(_0x544bd3['from']),'firstName':getFirstName(_0x544bd3['from']),'lastName':getLastName(_0x544bd3[_0x585b('0x31')]),'mapKey':_0x585b('0x4'),'message':{'from':getMails(_0x567583[_0x585b('0x4')],_0x544bd3[_0x585b('0x31')]),'to':_0x567583[_0x585b('0x4')],'cc':'','subject':_0x544bd3[_0x585b('0x32')]||'','messageId':_0x544bd3[_0x585b('0x33')],'inReplyTo':_0x544bd3[_0x585b('0x34')],'sentAt':moment(_0x544bd3[_0x585b('0x35')])[_0x585b('0x36')](_0x585b('0x37')),'attach':![],'attachments':[]}};if(!_0x544bd3['html']&&!_0x544bd3[_0x585b('0x1d')]){var _0x12c58e=_[_0x585b('0x38')](_0x544bd3[_0x585b('0x16')],{'contentType':_0x585b('0x39')});if(_0x12c58e[_0x585b('0xb')]){logger[_0x585b('0x3a')](util['format'](_0x585b('0x3b'),_0x544bd3[_0x585b('0x33')]));tnef[_0x585b('0x3c')](_[_0x585b('0x3d')](_0x12c58e)[_0x585b('0x2b')],function(_0x8e1959,_0x608d41){if(_0x608d41){_0x544bd3[_0x585b('0x13')]=_0x608d41['BodyHTML']||_0x585b('0x3e');if(_0x608d41[_0x585b('0x3f')]){for(var _0x22f792=0x0;_0x22f792<_0x608d41['Attachments'][_0x585b('0xb')];_0x22f792++){var _0x484cb2=_0x608d41[_0x585b('0x3f')][_0x22f792];_0x4dab2f[_0x585b('0x1f')][_0x585b('0x16')][_0x585b('0x17')]({'filename':_0x484cb2[_0x585b('0x40')],'content':Buffer[_0x585b('0x31')](_0x484cb2[_0x585b('0x41')])});}}}_0x320831(parseEmail(_0x567583,_0x544bd3,_0x4dab2f));});}else{_0x544bd3[_0x585b('0x13')]='

Empty\x20message

';_0x320831(parseEmail(_0x567583,_0x544bd3,_0x4dab2f));}}else{_0x320831(parseEmail(_0x567583,_0x544bd3,_0x4dab2f));}};exports['generateXOAuth2Token']=function(_0xbba6c0,_0x4c1bf2){var _0x2ef6ff=['user='+(_0x4c1bf2||''),'auth=Bearer\x20'+_0xbba6c0,'',''];return Buffer[_0x585b('0x31')](_0x2ef6ff[_0x585b('0xd')](''),_0x585b('0x42'))[_0x585b('0x43')](_0x585b('0x44'));}; \ No newline at end of file +var _0xe064=['content','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','join','toString','base64','lodash','moment','randomstring','node-tnef','../../../config/logger','email','../../../config/environment','value','address','anonymous','generate','@xcally.com','head','name','substring','indexOf','split','length','slice','Anonymous','isEmpty','html','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x256498[_0x4e06('0x12')](0x0,-0x1)['join']('\x20'):_0x2ed12c[_0x4e06('0xd')];}return _0x4e06('0x13');}function getLastName(_0x50fcef){var _0x3b682c=_[_0x4e06('0xc')](_0x50fcef['value']);if(_0x3b682c&&_0x3b682c[_0x4e06('0xd')]){var _0x5e3235=_0x3b682c[_0x4e06('0xd')][_0x4e06('0x10')](/\s+/);return _0x5e3235[_0x4e06('0x11')]>0x1?_0x5e3235['pop']():'';}return'';}function getMails(_0x20fa41,_0x30d158){var _0x5c06cd='';for(var _0x455196=0x0;_0x455196<_0x30d158[_0x4e06('0x7')]['length'];_0x455196+=0x1){if(_0x30d158['value'][_0x455196][_0x4e06('0x8')]!==_0x20fa41){if(!_[_0x4e06('0x14')](_0x5c06cd)){_0x5c06cd+=',';}_0x5c06cd+=_0x30d158[_0x4e06('0x7')][_0x455196][_0x4e06('0xd')]||_0x30d158['value'][_0x455196]['address']||'';_0x5c06cd+='\x20<';_0x5c06cd+=_0x30d158[_0x4e06('0x7')][_0x455196][_0x4e06('0x8')]?_0x30d158[_0x4e06('0x7')][_0x455196][_0x4e06('0x8')]:_0x4e06('0x9')+random[_0x4e06('0xa')](0x6)+'@xcally.com';_0x5c06cd+='>';}}return _0x5c06cd;}function parseEmail(_0x1e2448,_0x3ac315,_0x3fb03c){if(_0x3ac315['html']){var _0x2a3cc8=/)<[^<]*)*<\/script>/gi;while(_0x2a3cc8['test'](_0x3ac315[_0x4e06('0x15')])){_0x3ac315[_0x4e06('0x15')]=_0x3ac315[_0x4e06('0x15')][_0x4e06('0x16')](_0x2a3cc8,'');}if(_0x3ac315[_0x4e06('0x15')][_0x4e06('0x17')](_0x4e06('0x18'))){var _0x1ee6c6=[];_0x3ac315[_0x4e06('0x19')][_0x4e06('0x1a')](_0x2005e4=>{_0x1ee6c6[_0x4e06('0x1b')](_0x2005e4[_0x4e06('0x1c')]);});var _0x149dcf=/]+>/g;var _0x48228a=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x14fa6f=_0x3ac315[_0x4e06('0x15')][_0x4e06('0x16')](_0x48228a,_0x4e06('0x1d'));var _0x2e8338=_0x14fa6f[_0x4e06('0x16')](_0x149dcf,_0x4e06('0x1e'));for(let _0x1b1779=0x0;_0x1b1779<_0x1ee6c6[_0x4e06('0x11')];_0x1b1779++){var _0xd30f04=_0x2e8338[_0x4e06('0x16')]('_IMG',_0x4e06('0x1f')+_0x1ee6c6[_0x1b1779]+_0x4e06('0x20'));_0x2e8338=_0xd30f04;}_0x3ac315['html']=_0x2e8338;}_0x3fb03c[_0x4e06('0x21')]=_0x3ac315[_0x4e06('0x15')];}else{_0x3fb03c['body']=_0x3ac315[_0x4e06('0x22')];}if(_0x3fb03c['body']){_0x3fb03c[_0x4e06('0x21')]=_0x3fb03c[_0x4e06('0x21')]['replace'](/0x0){var _0x532dd8=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All',_0x4e06('0x31')];for(var _0x14d52c=0x0;_0x14d52c<_0x3ac315[_0x4e06('0x30')][_0x4e06('0x11')];_0x14d52c++){var _0x5d2730=_['indexOf'](_0x532dd8,_0x3ac315[_0x4e06('0x30')][_0x14d52c][_0x4e06('0x32')]);if(_0x5d2730>=0x0){_0x3fb03c[_0x4e06('0x33')]=!![];}}}return _0x3fb03c;}exports[_0x4e06('0x34')]=function(_0x36cd13,_0x1a22b3,_0x5c3467){var _0x2bec01={'from':getAddress(_0x1a22b3[_0x4e06('0x35')]),'firstName':getFirstName(_0x1a22b3[_0x4e06('0x35')]),'lastName':getLastName(_0x1a22b3['from']),'mapKey':_0x4e06('0x5'),'message':{'from':getMails(_0x36cd13[_0x4e06('0x5')],_0x1a22b3[_0x4e06('0x35')]),'to':_0x36cd13[_0x4e06('0x5')],'cc':'','subject':_0x1a22b3[_0x4e06('0x36')]||'','messageId':_0x1a22b3[_0x4e06('0x37')],'inReplyTo':_0x1a22b3[_0x4e06('0x38')],'sentAt':moment(_0x1a22b3[_0x4e06('0x39')])[_0x4e06('0x3a')](_0x4e06('0x3b')),'attach':![],'attachments':[]}};if(!_0x1a22b3[_0x4e06('0x15')]&&!_0x1a22b3['textAsHtml']){var _0x368c1e=_[_0x4e06('0x3c')](_0x1a22b3[_0x4e06('0x19')],{'contentType':_0x4e06('0x3d')});if(_0x368c1e[_0x4e06('0x11')]){logger[_0x4e06('0x3e')](util[_0x4e06('0x3a')](_0x4e06('0x3f'),_0x1a22b3[_0x4e06('0x37')]));tnef[_0x4e06('0x40')](_[_0x4e06('0x41')](_0x368c1e)[_0x4e06('0x42')],function(_0x519c5f,_0x4ae5df){if(_0x4ae5df){_0x1a22b3[_0x4e06('0x15')]=_0x4ae5df['BodyHTML']||_0x4e06('0x43');if(_0x4ae5df[_0x4e06('0x44')]){for(var _0x4765cc=0x0;_0x4765cc<_0x4ae5df[_0x4e06('0x44')][_0x4e06('0x11')];_0x4765cc++){var _0x1880f4=_0x4ae5df[_0x4e06('0x44')][_0x4765cc];_0x2bec01[_0x4e06('0x24')][_0x4e06('0x19')][_0x4e06('0x1b')]({'filename':_0x1880f4[_0x4e06('0x45')],'content':Buffer[_0x4e06('0x35')](_0x1880f4[_0x4e06('0x46')])});}}}_0x5c3467(parseEmail(_0x36cd13,_0x1a22b3,_0x2bec01));});}else{_0x1a22b3[_0x4e06('0x15')]=_0x4e06('0x43');_0x5c3467(parseEmail(_0x36cd13,_0x1a22b3,_0x2bec01));}}else{_0x5c3467(parseEmail(_0x36cd13,_0x1a22b3,_0x2bec01));}};exports[_0x4e06('0x47')]=function(_0x2df25c,_0x2e8f25){var _0x12b22e=[_0x4e06('0x48')+(_0x2e8f25||''),_0x4e06('0x49')+_0x2df25c,'',''];return Buffer[_0x4e06('0x35')](_0x12b22e[_0x4e06('0x4a')](''),'utf-8')[_0x4e06('0x4b')](_0x4e06('0x4c'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 38c23fd..2303af9 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 _0xdcac=['active','Imap','Smtp','exports','lodash','name','Service','key','SERV'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xdcac,0x9d));var _0xcdca=function(_0x582b2d,_0x5e5f2e){_0x582b2d=_0x582b2d-0x0;var _0xe02b84=_0xdcac[_0x582b2d];return _0xe02b84;};'use strict';var _=require(_0xcdca('0x0'));function MailAccount(_0x5dac0a){this['id']=_0x5dac0a['id']||0x0;this[_0xcdca('0x1')]=_0x5dac0a['name']||_0xcdca('0x2');this[_0xcdca('0x3')]=_0x5dac0a[_0xcdca('0x3')]||_0xcdca('0x4');this[_0xcdca('0x5')]=_0x5dac0a[_0xcdca('0x5')]||![];this[_0xcdca('0x6')]=_0x5dac0a[_0xcdca('0x6')]||[];this[_0xcdca('0x7')]=_0x5dac0a[_0xcdca('0x7')]||[];}module[_0xcdca('0x8')]=MailAccount; \ No newline at end of file +var _0xd8be=['name','key','SERV','active','Imap','Smtp','exports'];(function(_0xf7dd0f,_0x396c3b){var _0x3fc64b=function(_0x41adc1){while(--_0x41adc1){_0xf7dd0f['push'](_0xf7dd0f['shift']());}};_0x3fc64b(++_0x396c3b);}(_0xd8be,0xa8));var _0xed8b=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0xd8be[_0x432fca];return _0x3adba4;};'use strict';var _=require('lodash');function MailAccount(_0xda810c){this['id']=_0xda810c['id']||0x0;this[_0xed8b('0x0')]=_0xda810c[_0xed8b('0x0')]||'Service';this[_0xed8b('0x1')]=_0xda810c[_0xed8b('0x1')]||_0xed8b('0x2');this[_0xed8b('0x3')]=_0xda810c['active']||![];this[_0xed8b('0x4')]=_0xda810c['Imap']||[];this['Smtp']=_0xda810c[_0xed8b('0x5')]||[];}module[_0xed8b('0x6')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 8dca543..7bc53ac 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 _0x22a3=['exports','lodash','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','mailAccounts','merge'];(function(_0x1bb812,_0x23eacc){var _0x372adb=function(_0x5ad456){while(--_0x5ad456){_0x1bb812['push'](_0x1bb812['shift']());}};_0x372adb(++_0x23eacc);}(_0x22a3,0x64));var _0x322a=function(_0x85cb49,_0x50a08a){_0x85cb49=_0x85cb49-0x0;var _0x52f463=_0x22a3[_0x85cb49];return _0x52f463;};'use strict';var _=require(_0x322a('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x327cac,_0x3451ea,_0x508d11){var _0x3c2ebe=_[_0x322a('0x1')](_0x327cac,function(_0x3d8f00,_0x2486cd){return _0x3d8f00[_0x508d11];});for(var _0x1115fe in _0x3451ea){if(_0x3451ea[_0x322a('0x2')](_0x1115fe)){if(!_0x3c2ebe[_0x1115fe]){delete _0x3451ea[_0x1115fe];}}}}Realtime[_0x322a('0x3')][_0x322a('0x4')]=function(_0x2baf30,_0x22d3ae){for(var _0x11e3da in _0x22d3ae){if(_0x2baf30[_0x322a('0x2')](_0x11e3da)){_0x2baf30[_0x11e3da]=_0x22d3ae[_0x11e3da];}}};Realtime['prototype'][_0x322a('0x5')]=function(){var _0x3c60dc=this;return function(_0x198c54){if(_0x198c54){freeIsNotKey(_0x198c54,_0x3c60dc['mailAccounts'],'id');for(var _0x1a1440=0x0,_0x5f1d61={},_0x289534={};_0x1a1440<_0x198c54[_0x322a('0x6')];_0x1a1440+=0x1){_0x5f1d61=_0x198c54[_0x1a1440];if(_[_0x322a('0x7')](_0x3c60dc[_0x322a('0x8')][_0x5f1d61['id']])){_0x3c60dc[_0x322a('0x8')][_0x5f1d61['id']]=new MailAccount(_0x5f1d61);}else{_[_0x322a('0x9')](_0x3c60dc[_0x322a('0x8')][_0x5f1d61['id']],_0x5f1d61);}}}return _0x3c60dc[_0x322a('0x8')];};};module[_0x322a('0xa')]=Realtime; \ No newline at end of file +var _0xacfa=['hasOwnProperty','initMailAccounts','mailAccounts','length','exports','lodash','../model/mailAccount','mapKeys','prototype'];(function(_0x3c79ae,_0x2a953b){var _0x2c922a=function(_0x231179){while(--_0x231179){_0x3c79ae['push'](_0x3c79ae['shift']());}};_0x2c922a(++_0x2a953b);}(_0xacfa,0x1a3));var _0xaacf=function(_0x1b658,_0x344b6a){_0x1b658=_0x1b658-0x0;var _0x1d17e5=_0xacfa[_0x1b658];return _0x1d17e5;};'use strict';var _=require(_0xaacf('0x0'));var MailAccount=require(_0xaacf('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x5df1fb,_0x1fbb5c,_0x43b684){var _0x404675=_[_0xaacf('0x2')](_0x5df1fb,function(_0x5b1896,_0x51212d){return _0x5b1896[_0x43b684];});for(var _0x27eeb4 in _0x1fbb5c){if(_0x1fbb5c['hasOwnProperty'](_0x27eeb4)){if(!_0x404675[_0x27eeb4]){delete _0x1fbb5c[_0x27eeb4];}}}}Realtime[_0xaacf('0x3')]['mergeFromDatabase']=function(_0x491416,_0x45f564){for(var _0x4b8b83 in _0x45f564){if(_0x491416[_0xaacf('0x4')](_0x4b8b83)){_0x491416[_0x4b8b83]=_0x45f564[_0x4b8b83];}}};Realtime['prototype'][_0xaacf('0x5')]=function(){var _0x2f6f95=this;return function(_0x53a709){if(_0x53a709){freeIsNotKey(_0x53a709,_0x2f6f95[_0xaacf('0x6')],'id');for(var _0x49fc56=0x0,_0x70a673={},_0x3cd972={};_0x49fc56<_0x53a709[_0xaacf('0x7')];_0x49fc56+=0x1){_0x70a673=_0x53a709[_0x49fc56];if(_['isUndefined'](_0x2f6f95[_0xaacf('0x6')][_0x70a673['id']])){_0x2f6f95[_0xaacf('0x6')][_0x70a673['id']]=new MailAccount(_0x70a673);}else{_['merge'](_0x2f6f95[_0xaacf('0x6')][_0x70a673['id']],_0x70a673);}}}return _0x2f6f95[_0xaacf('0x6')];};};module[_0xaacf('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 4eb4447..c7165a9 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 _0x7a3e=['active','key','ListId','MailServerIn','Imap','CloudProvider','service','data5','MailServerOut','Smtp','type','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','name','provider'];(function(_0x59079a,_0x53c526){var _0x6857=function(_0x575e94){while(--_0x575e94){_0x59079a['push'](_0x59079a['shift']());}};_0x6857(++_0x53c526);}(_0x7a3e,0x18a));var _0xe7a3=function(_0x49dd1e,_0x1eba54){_0x49dd1e=_0x49dd1e-0x0;var _0x346e40=_0x7a3e[_0x49dd1e];return _0x346e40;};'use strict';var client=require(_0xe7a3('0x0'));exports[_0xe7a3('0x1')]=function(){return function(){return client[_0xe7a3('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0xe7a3('0x3'),_0xe7a3('0x4'),'service','email',_0xe7a3('0x5'),_0xe7a3('0x6'),_0xe7a3('0x7'),'TemplateId'],'raw':![],'include':[{'model':_0xe7a3('0x8'),'as':_0xe7a3('0x9'),'include':[{'model':_0xe7a3('0xa'),'attributes':['id',_0xe7a3('0x3'),_0xe7a3('0xb'),'type',_0xe7a3('0xc')],'as':_0xe7a3('0xa')}]},{'model':_0xe7a3('0xd'),'as':_0xe7a3('0xe'),'include':[{'model':'CloudProvider','attributes':['id',_0xe7a3('0x3'),_0xe7a3('0xb'),_0xe7a3('0xf'),_0xe7a3('0xc')],'as':_0xe7a3('0xa')}]}]},'log':_0xe7a3('0x10')});};};exports[_0xe7a3('0x11')]=function(_0x2906ce,_0x1193c4){return client[_0xe7a3('0x2')](_0xe7a3('0x12'),{'account':{'id':_0x2906ce},'body':_0x1193c4,'log':_0xe7a3('0x12')});}; \ No newline at end of file +var _0x36fe=['provider','service','email','active','key','ListId','MailServerIn','CloudProvider','type','data5','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name'];(function(_0x55ff2c,_0x5d00f4){var _0x3c9083=function(_0xa3a9d2){while(--_0xa3a9d2){_0x55ff2c['push'](_0x55ff2c['shift']());}};_0x3c9083(++_0x5d00f4);}(_0x36fe,0x127));var _0xe36f=function(_0x10d34b,_0x4fef76){_0x10d34b=_0x10d34b-0x0;var _0x92b0bf=_0x36fe[_0x10d34b];return _0x92b0bf;};'use strict';var client=require(_0xe36f('0x0'));exports[_0xe36f('0x1')]=function(){return function(){return client[_0xe36f('0x2')](_0xe36f('0x3'),{'options':{'attributes':['id',_0xe36f('0x4'),_0xe36f('0x5'),_0xe36f('0x6'),_0xe36f('0x7'),_0xe36f('0x8'),_0xe36f('0x9'),_0xe36f('0xa'),'TemplateId'],'raw':![],'include':[{'model':_0xe36f('0xb'),'as':'Imap','include':[{'model':_0xe36f('0xc'),'attributes':['id',_0xe36f('0x4'),'service',_0xe36f('0xd'),_0xe36f('0xe')],'as':'CloudProvider'}]},{'model':_0xe36f('0xf'),'as':_0xe36f('0x10'),'include':[{'model':_0xe36f('0xc'),'attributes':['id',_0xe36f('0x4'),_0xe36f('0x6'),'type',_0xe36f('0xe')],'as':'CloudProvider'}]}]},'log':_0xe36f('0x11')});};};exports[_0xe36f('0x12')]=function(_0x1effb1,_0x4c42cc){return client[_0xe36f('0x2')](_0xe36f('0x13'),{'account':{'id':_0x1effb1},'body':_0x4c42cc,'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 937e32f..e5728b0 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 _0x2d2c=['../client','getSettings','Request','ShowSetting','GetSettings'];(function(_0x12de21,_0x1b5f05){var _0x3f02a9=function(_0x34ffee){while(--_0x34ffee){_0x12de21['push'](_0x12de21['shift']());}};_0x3f02a9(++_0x1b5f05);}(_0x2d2c,0xbe));var _0xc2d2=function(_0x1dbaf7,_0x3d05b3){_0x1dbaf7=_0x1dbaf7-0x0;var _0x593f05=_0x2d2c[_0x1dbaf7];return _0x593f05;};'use strict';var client=require(_0xc2d2('0x0'));exports[_0xc2d2('0x1')]=function(){return client[_0xc2d2('0x2')](_0xc2d2('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0xc2d2('0x4')});}; \ No newline at end of file +var _0xfa07=['getSettings','ShowSetting','GetSettings'];(function(_0x4a9e27,_0x5238f9){var _0x107e56=function(_0x41699e){while(--_0x41699e){_0x4a9e27['push'](_0x4a9e27['shift']());}};_0x107e56(++_0x5238f9);}(_0xfa07,0x147));var _0x7fa0=function(_0x214133,_0x53a2b7){_0x214133=_0x214133-0x0;var _0x6f3a6a=_0xfa07[_0x214133];return _0x6f3a6a;};'use strict';var client=require('../client');exports[_0x7fa0('0x0')]=function(){return client['Request'](_0x7fa0('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x7fa0('0x2')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 0a6086c..e39e54d 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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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 5546644..d602c26 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 _0xa721=['timeout','port','socket.io','websocket','polling','redis','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer'];(function(_0x4acfa7,_0x21db2d){var _0x5a6cdd=function(_0x3c0012){while(--_0x3c0012){_0x4acfa7['push'](_0x4acfa7['shift']());}};_0x5a6cdd(++_0x21db2d);}(_0xa721,0x101));var _0x1a72=function(_0x5084b5,_0x3048d1){_0x5084b5=_0x5084b5-0x0;var _0x2e7c67=_0xa721[_0x5084b5];return _0x2e7c67;};'use strict';var _=require(_0x1a72('0x0'));var http=require(_0x1a72('0x1'));var express=require(_0x1a72('0x2'));var sticky=require(_0x1a72('0x3'));var Redis=require(_0x1a72('0x4'));var config=require(_0x1a72('0x5'));var app=express();var server=http[_0x1a72('0x6')](app);server[_0x1a72('0x7')]=0xdbba0;if(sticky['listen'](server,config[_0x1a72('0x8')])){var socketio=require(_0x1a72('0x9'))(server,{'transports':[_0x1a72('0xa'),_0x1a72('0xb')]});config['redis']=_['defaults'](config[_0x1a72('0xc')],{'host':'localhost','port':0x18eb});socketio[_0x1a72('0xd')](require(_0x1a72('0xe'))({'pubClient':new Redis(config[_0x1a72('0xc')]),'subClient':new Redis(config[_0x1a72('0xc')])}));require(_0x1a72('0xf'))[_0x1a72('0x10')]();require(_0x1a72('0x11'))[_0x1a72('0x10')](socketio);require(_0x1a72('0x12'))[_0x1a72('0x10')](app);require(_0x1a72('0x13'))['default'](app);}else{server['once'](_0x1a72('0x14'),function(){console[_0x1a72('0x15')](_0x1a72('0x16'),config[_0x1a72('0x8')]);});}exports=module[_0x1a72('0x17')]=app; \ No newline at end of file +var _0x46a4=['polling','redis','defaults','adapter','socket.io-redis','../../config/triggers','default','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io'];(function(_0x372ff0,_0x418655){var _0x47bfc7=function(_0x3c8f1c){while(--_0x3c8f1c){_0x372ff0['push'](_0x372ff0['shift']());}};_0x47bfc7(++_0x418655);}(_0x46a4,0x1d9));var _0x446a=function(_0x18a80d,_0x135f2c){_0x18a80d=_0x18a80d-0x0;var _0x3e8703=_0x46a4[_0x18a80d];return _0x3e8703;};'use strict';var _=require(_0x446a('0x0'));var http=require(_0x446a('0x1'));var express=require(_0x446a('0x2'));var sticky=require(_0x446a('0x3'));var Redis=require(_0x446a('0x4'));var config=require(_0x446a('0x5'));var app=express();var server=http[_0x446a('0x6')](app);server[_0x446a('0x7')]=0xdbba0;if(sticky[_0x446a('0x8')](server,config[_0x446a('0x9')])){var socketio=require(_0x446a('0xa'))(server,{'transports':['websocket',_0x446a('0xb')]});config[_0x446a('0xc')]=_[_0x446a('0xd')](config['redis'],{'host':'localhost','port':0x18eb});socketio[_0x446a('0xe')](require(_0x446a('0xf'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x446a('0xc')])}));require(_0x446a('0x10'))[_0x446a('0x11')]();require('../../config/socketio')[_0x446a('0x11')](socketio);require('../../config/express')['default'](app);require('../../routes')[_0x446a('0x11')](app);}else{server[_0x446a('0x12')]('listening',function(){console[_0x446a('0x13')](_0x446a('0x14'),config[_0x446a('0x9')]);});}exports=module[_0x446a('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 8bc87e0..431a056 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 _0x4ef5=['routing','http','Request','request','then','debug','rpc','error','message','result','catch','exports','../../config/logger'];(function(_0x3861f7,_0x995b22){var _0x50879f=function(_0x3003f1){while(--_0x3003f1){_0x3861f7['push'](_0x3861f7['shift']());}};_0x50879f(++_0x995b22);}(_0x4ef5,0x8e));var _0x54ef=function(_0x3d5a9a,_0x4e700c){_0x3d5a9a=_0x3d5a9a-0x0;var _0x42d65c=_0x4ef5[_0x3d5a9a];return _0x42d65c;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x54ef('0x0'))(_0x54ef('0x1'));var client=jayson['client'][_0x54ef('0x2')]({'port':0x2329});client[_0x54ef('0x3')]=function(_0x3828ee,_0x536c15){return new BPromise(function(_0x1648e6,_0x4e5fc1){return client[_0x54ef('0x4')](_0x3828ee,_0x536c15)[_0x54ef('0x5')](function(_0x2a085e){logger[_0x54ef('0x6')](_0x54ef('0x7'),_0x54ef('0x1'),_0x3828ee,_0x536c15,_0x2a085e);if(_0x2a085e['error']){logger[_0x54ef('0x8')](_0x54ef('0x7'),_0x54ef('0x1'),_0x3828ee,_0x2a085e[_0x54ef('0x8')]['message'],_0x536c15);return _0x4e5fc1(_0x2a085e[_0x54ef('0x8')][_0x54ef('0x9')]);}else{return _0x1648e6(_0x2a085e[_0x54ef('0xa')]);}})[_0x54ef('0xb')](function(_0x5628af){logger[_0x54ef('0x8')](_0x54ef('0x7'),'routing',_0x3828ee,_0x5628af,_0x536c15);return _0x4e5fc1(_0x5628af);});});};module[_0x54ef('0xc')]=client; \ No newline at end of file +var _0x7421=['../../config/logger','routing','Request','request','then','debug','rpc','error','message','result','exports','jayson/promise','bluebird'];(function(_0xb07073,_0x18ab16){var _0x1c463d=function(_0x34d469){while(--_0x34d469){_0xb07073['push'](_0xb07073['shift']());}};_0x1c463d(++_0x18ab16);}(_0x7421,0x184));var _0x1742=function(_0x474602,_0x5084b5){_0x474602=_0x474602-0x0;var _0x15ecab=_0x7421[_0x474602];return _0x15ecab;};'use strict';var jayson=require(_0x1742('0x0'));var BPromise=require(_0x1742('0x1'));var logger=require(_0x1742('0x2'))(_0x1742('0x3'));var client=jayson['client']['http']({'port':0x2329});client[_0x1742('0x4')]=function(_0x1b1613,_0x3cbd3b){return new BPromise(function(_0x22e4df,_0xa6520d){return client[_0x1742('0x5')](_0x1b1613,_0x3cbd3b)[_0x1742('0x6')](function(_0x9b481f){logger[_0x1742('0x7')](_0x1742('0x8'),_0x1742('0x3'),_0x1b1613,_0x3cbd3b,_0x9b481f);if(_0x9b481f[_0x1742('0x9')]){logger['error'](_0x1742('0x8'),_0x1742('0x3'),_0x1b1613,_0x9b481f[_0x1742('0x9')][_0x1742('0xa')],_0x3cbd3b);return _0xa6520d(_0x9b481f['error'][_0x1742('0xa')]);}else{return _0x22e4df(_0x9b481f[_0x1742('0xb')]);}})['catch'](function(_0x34c1f){logger[_0x1742('0x9')](_0x1742('0x8'),_0x1742('0x3'),_0x1b1613,_0x34c1f,_0x3cbd3b);return _0xa6520d(_0x34c1f);});});};module[_0x1742('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index b8290c8..9e1e850 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 _0xfada=['initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','log','bluebird','./realtime','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents'];(function(_0x27ad02,_0x5dcbff){var _0x4cbc84=function(_0x6f5da3){while(--_0x6f5da3){_0x27ad02['push'](_0x27ad02['shift']());}};_0x4cbc84(++_0x5dcbff);}(_0xfada,0xd7));var _0xafad=function(_0x210213,_0x2a1aa6){_0x210213=_0x210213-0x0;var _0x12b438=_0xfada[_0x210213];return _0x12b438;};'use strict';var BPromise=require(_0xafad('0x0'));var server=require('./server');var Realtime=require(_0xafad('0x1'));var user=require(_0xafad('0x2'));var interval=require(_0xafad('0x3'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xafad('0x4'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xafad('0x5'));var whatsappQueue=require(_0xafad('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xafad('0x7')]()[_0xafad('0x8')](user[_0xafad('0x9')]())[_0xafad('0x8')](realtime[_0xafad('0xa')]())[_0xafad('0x8')](interval[_0xafad('0xb')]())[_0xafad('0x8')](realtime[_0xafad('0xc')]())[_0xafad('0x8')](openchannelQueue[_0xafad('0xd')]())[_0xafad('0x8')](realtime[_0xafad('0xe')]())[_0xafad('0x8')](chatQueue['getChatQueues']())[_0xafad('0x8')](realtime[_0xafad('0xf')]())[_0xafad('0x8')](smsQueue[_0xafad('0x10')]())[_0xafad('0x8')](realtime[_0xafad('0x11')]())[_0xafad('0x8')](mailQueue[_0xafad('0x12')]())['then'](realtime[_0xafad('0x13')]())[_0xafad('0x8')](faxQueue['getFaxQueues']())[_0xafad('0x8')](realtime[_0xafad('0x14')]())[_0xafad('0x8')](whatsappQueue[_0xafad('0x15')]())[_0xafad('0x8')](realtime[_0xafad('0x16')]())['then'](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xafad('0x8')](function(_0x31d91a){return initRealtime();})[_0xafad('0x8')](function(_0x97e25b){return setInterval(initRealtime,0x1388);})[_0xafad('0x17')](function(_0x150b9b){console[_0xafad('0x18')](_0x150b9b);});}main(); \ No newline at end of file +var _0xa8c7=['./rpc/whatsappQueue','resolve','initAgents','then','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getMailQueues','initMailQueues','getFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue'];(function(_0x2fa21,_0x48ac92){var _0x4e05c9=function(_0x496542){while(--_0x496542){_0x2fa21['push'](_0x2fa21['shift']());}};_0x4e05c9(++_0x48ac92);}(_0xa8c7,0x179));var _0x7a8c=function(_0x527ee2,_0xd9fc49){_0x527ee2=_0x527ee2-0x0;var _0x26f8e0=_0xa8c7[_0x527ee2];return _0x26f8e0;};'use strict';var BPromise=require(_0x7a8c('0x0'));var server=require(_0x7a8c('0x1'));var Realtime=require(_0x7a8c('0x2'));var user=require(_0x7a8c('0x3'));var interval=require(_0x7a8c('0x4'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x7a8c('0x5'));var smsQueue=require(_0x7a8c('0x6'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x7a8c('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x7a8c('0x8')]()['then'](user['getAgents']())['then'](realtime[_0x7a8c('0x9')]())[_0x7a8c('0xa')](interval['getIntervals']())[_0x7a8c('0xa')](realtime[_0x7a8c('0xb')]())[_0x7a8c('0xa')](openchannelQueue[_0x7a8c('0xc')]())['then'](realtime[_0x7a8c('0xd')]())[_0x7a8c('0xa')](chatQueue[_0x7a8c('0xe')]())[_0x7a8c('0xa')](realtime[_0x7a8c('0xf')]())['then'](smsQueue['getSmsQueues']())[_0x7a8c('0xa')](realtime['initSmsQueues']())[_0x7a8c('0xa')](mailQueue[_0x7a8c('0x10')]())[_0x7a8c('0xa')](realtime[_0x7a8c('0x11')]())[_0x7a8c('0xa')](faxQueue[_0x7a8c('0x12')]())['then'](realtime['initFaxQueues']())['then'](whatsappQueue[_0x7a8c('0x13')]())[_0x7a8c('0xa')](realtime[_0x7a8c('0x14')]())['then'](function(){return realtime;});}function main(){return server[_0x7a8c('0x15')](realtime)[_0x7a8c('0xa')](function(_0x36d035){return initRealtime();})['then'](function(_0x20f5a7){return setInterval(initRealtime,0x1388);})[_0x7a8c('0x16')](function(_0x392b08){console[_0x7a8c('0x17')](_0x392b08);});}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 ba7f250..0099126 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 _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1261,0x144));var _0x1126=function(_0x41d432,_0x20e878){_0x41d432=_0x41d432-0x0;var _0x1650f9=_0x1261[_0x41d432];return _0x1650f9;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file +var _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0x456919,_0x4c175d){var _0x41a512=function(_0x44c4dd){while(--_0x44c4dd){_0x456919['push'](_0x456919['shift']());}};_0x41a512(++_0x4c175d);}(_0x814b,0x1a2));var _0xb814=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0x814b[_0x5d7227];return _0x15ac55;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index d72d7ca..c9d45c9 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 _0xe79e=['then','error','message','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise'];(function(_0x4c40aa,_0x1f3e0c){var _0x4f7708=function(_0x35ae17){while(--_0x35ae17){_0x4c40aa['push'](_0x4c40aa['shift']());}};_0x4f7708(++_0x1f3e0c);}(_0xe79e,0xa9));var _0xee79=function(_0x497ba1,_0xba4f7f){_0x497ba1=_0x497ba1-0x0;var _0x16474a=_0xe79e[_0x497ba1];return _0x16474a;};'use strict';var BPromise=require(_0xee79('0x0'));var jayson=require(_0xee79('0x1'));var client=jayson['client']['http']({'port':0x232b});function request(_0x478e69,_0x3dffb5){return new BPromise(function(_0x290aca,_0x4f4313){return client['request'](_0x478e69,_0x3dffb5)[_0xee79('0x2')](function(_0x55e22a){if(_0x55e22a[_0xee79('0x3')]){return _0x4f4313(_0x55e22a[_0xee79('0x3')][_0xee79('0x4')]);}else{return _0x290aca(_0x55e22a[_0xee79('0x5')]);}})[_0xee79('0x6')](function(_0x3f23a4){return _0x4f4313(_0x3f23a4);});});}exports[_0xee79('0x7')]=function(_0x141bf1,_0x17c45d){return request(_0xee79('0x8'),{'account':_0x141bf1,'message':_0x17c45d});}; \ No newline at end of file +var _0x91f6=['error','message','catch','sendMailMessage','SendMail','http','request','then'];(function(_0x1fafff,_0x1bfeb7){var _0x1acc1d=function(_0xfc6797){while(--_0xfc6797){_0x1fafff['push'](_0x1fafff['shift']());}};_0x1acc1d(++_0x1bfeb7);}(_0x91f6,0xe5));var _0x691f=function(_0x52d020,_0x2e375e){_0x52d020=_0x52d020-0x0;var _0x47be64=_0x91f6[_0x52d020];return _0x47be64;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson['client'][_0x691f('0x0')]({'port':0x232b});function request(_0x4bc392,_0x3bffb6){return new BPromise(function(_0xf2694c,_0x4628bf){return client[_0x691f('0x1')](_0x4bc392,_0x3bffb6)[_0x691f('0x2')](function(_0x5da0e6){if(_0x5da0e6[_0x691f('0x3')]){return _0x4628bf(_0x5da0e6[_0x691f('0x3')][_0x691f('0x4')]);}else{return _0xf2694c(_0x5da0e6['result']);}})[_0x691f('0x5')](function(_0x295a05){return _0x4628bf(_0x295a05);});});}exports[_0x691f('0x6')]=function(_0x2353ca,_0x3ed394){return request(_0x691f('0x7'),{'account':_0x2353ca,'message':_0x3ed394});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 7176a5d..0762dfa 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 _0x160f=['faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','chatWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working','idle','mail','chat','fax','sms','whatsapp','length','toNumber','format','Status','chatPause','whatsappStatus','busy','stringify','emit','user:routing:update','exports','lodash','md5','moment','ioredis','redis','defaults','localhost','socket.io-emitter','name','voicePause','mailPause','faxPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','unknown','faxStatusTime','faxCapacity'];(function(_0x996bc8,_0x291e01){var _0x20b0ea=function(_0x5ba992){while(--_0x5ba992){_0x996bc8['push'](_0x996bc8['shift']());}};_0x20b0ea(++_0x291e01);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf160('0x0'));var md5=require(_0xf160('0x1'));var moment=require(_0xf160('0x2'));var Redis=require(_0xf160('0x3'));var config=require('../../../config/environment');config[_0xf160('0x4')]=_[_0xf160('0x5')](config[_0xf160('0x4')],{'host':_0xf160('0x6'),'port':0x18eb});var io=require(_0xf160('0x7'))(new Redis(config[_0xf160('0x4')]));function Agent(_0x4a6f3d){this['id']=_0x4a6f3d['id']||0x0;this[_0xf160('0x8')]=_0x4a6f3d[_0xf160('0x8')]||'';this['online']=_0x4a6f3d['online']||!![];this[_0xf160('0x9')]=_0x4a6f3d['voicePause']||![];this['chatPause']=_0x4a6f3d['chatPause']||![];this[_0xf160('0xa')]=_0x4a6f3d[_0xf160('0xa')]||![];this[_0xf160('0xb')]=_0x4a6f3d[_0xf160('0xb')]||![];this['smsPause']=_0x4a6f3d['smsPause']||![];this[_0xf160('0xc')]=_0x4a6f3d[_0xf160('0xc')]||![];this[_0xf160('0xd')]='unknown';this[_0xf160('0xe')]=0x0;this[_0xf160('0xf')]=_0x4a6f3d[_0xf160('0xf')]||0x0;this[_0xf160('0x10')]=0x0;this[_0xf160('0x11')]='unknown';this[_0xf160('0x12')]=0x0;this['mailCapacity']=_0x4a6f3d[_0xf160('0x13')]||0x0;this[_0xf160('0x14')]=0x0;this[_0xf160('0x15')]=_0xf160('0x16');this[_0xf160('0x17')]=0x0;this[_0xf160('0x18')]=_0x4a6f3d[_0xf160('0x18')]||0x0;this[_0xf160('0x19')]=0x0;this[_0xf160('0x1a')]='unknown';this[_0xf160('0x1b')]=0x0;this[_0xf160('0x1c')]=_0x4a6f3d[_0xf160('0x1c')]||0x0;this[_0xf160('0x1d')]=0x0;this['whatsappStatus']=_0xf160('0x16');this['whatsappStatusTime']=0x0;this[_0xf160('0x1e')]=_0x4a6f3d[_0xf160('0x1e')]||0x0;this[_0xf160('0x1f')]=0x0;this[_0xf160('0x20')]=_0xf160('0x16');this[_0xf160('0x21')]=0x0;this[_0xf160('0x22')]=_0x4a6f3d[_0xf160('0x22')]||0x0;this[_0xf160('0x23')]=0x0;this['busy']=![];this[_0xf160('0x24')]=undefined;this[_0xf160('0x1')]='';this[_0xf160('0x25')]={};this['faxWaitingInteractions']={};this[_0xf160('0x26')]={};this[_0xf160('0x27')]={};this[_0xf160('0x28')]={};this[_0xf160('0x29')]={};this[_0xf160('0x2a')]();}Agent[_0xf160('0x2b')][_0xf160('0x2c')]=function(_0x5a72d1){if(this[_0x5a72d1+_0xf160('0x2d')]>0x0){if(this[_0x5a72d1+_0xf160('0x2e')]>0x0&&this[_0x5a72d1+_0xf160('0x2d')]>=this[_0x5a72d1+_0xf160('0x2e')]){return'maxcapacity';}else{return _0xf160('0x2f');}}else{return _0xf160('0x30');}};Agent['prototype']['updateRealtime']=function(){var _0x168a09=[_0xf160('0x31'),_0xf160('0x32'),'openchannel',_0xf160('0x33'),_0xf160('0x34'),_0xf160('0x35')];for(var _0x2e2b00=0x0;_0x2e2b00<_0x168a09[_0xf160('0x36')];_0x2e2b00+=0x1){var _0x193e1e=this['getChannelStatus'](_0x168a09[_0x2e2b00]);if(this[_0x168a09[_0x2e2b00]+'Status']!==_0x193e1e){this[_0x168a09[_0x2e2b00]+'StatusTime']=_[_0xf160('0x37')](moment()[_0xf160('0x38')]('x'));}this[_0x168a09[_0x2e2b00]+_0xf160('0x39')]=_0x193e1e;}var _0x26e06b={'id':this['id'],'name':this[_0xf160('0x8')],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this[_0xf160('0x3a')],'mailPause':this['mailPause'],'smsPause':this['smsPause'],'faxPause':this[_0xf160('0xb')],'openchannelPause':this[_0xf160('0xc')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xf160('0xe')],'chatCapacity':this[_0xf160('0xf')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this['mailStatus'],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0xf160('0x14')],'faxStatus':this[_0xf160('0x15')],'faxStatusTime':this[_0xf160('0x17')],'faxCapacity':this[_0xf160('0x18')],'faxCurrentCapacity':this[_0xf160('0x19')],'smsStatus':this[_0xf160('0x1a')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xf160('0x3b')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0xf160('0x1f')],'openchannelStatus':this[_0xf160('0x20')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0xf160('0x22')],'openchannelCurrentCapacity':this[_0xf160('0x23')],'busy':this[_0xf160('0x3c')],'busyQueue':this[_0xf160('0x24')],'chatWaitingInteractions':this[_0xf160('0x25')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0xf160('0x26')],'openchannelWaitingInteractions':this[_0xf160('0x27')],'smsWaitingInteractions':this[_0xf160('0x28')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x2dfe7b=md5(JSON[_0xf160('0x3d')](_0x26e06b));if(this[_0xf160('0x1')]!==_0x2dfe7b){this[_0xf160('0x1')]=_0x2dfe7b;io[_0xf160('0x3e')](_0xf160('0x3f'),_['omit'](_0x26e06b,['online']));}};module[_0xf160('0x40')]=Agent; \ No newline at end of file +var _0x81c6=['length','StatusTime','toNumber','format','Status','chatStatusTime','whatsappStatus','whatsappCurrentCapacity','openchannelWaitingInteractions','stringify','emit','user:routing:update','exports','md5','redis','defaults','socket.io-emitter','name','online','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatCapacity','chatCurrentCapacity','unknown','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','chat','fax'];(function(_0x197a13,_0x1f84f0){var _0x331e97=function(_0x4b6d47){while(--_0x4b6d47){_0x197a13['push'](_0x197a13['shift']());}};_0x331e97(++_0x1f84f0);}(_0x81c6,0x1d5));var _0x681c=function(_0x2f7e42,_0x4aa0cf){_0x2f7e42=_0x2f7e42-0x0;var _0x1ac0d3=_0x81c6[_0x2f7e42];return _0x1ac0d3;};'use strict';var _=require('lodash');var md5=require(_0x681c('0x0'));var moment=require('moment');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x681c('0x1')]=_[_0x681c('0x2')](config[_0x681c('0x1')],{'host':'localhost','port':0x18eb});var io=require(_0x681c('0x3'))(new Redis(config[_0x681c('0x1')]));function Agent(_0x1f2032){this['id']=_0x1f2032['id']||0x0;this[_0x681c('0x4')]=_0x1f2032['name']||'';this[_0x681c('0x5')]=_0x1f2032[_0x681c('0x5')]||!![];this['voicePause']=_0x1f2032['voicePause']||![];this[_0x681c('0x6')]=_0x1f2032[_0x681c('0x6')]||![];this[_0x681c('0x7')]=_0x1f2032['mailPause']||![];this['faxPause']=_0x1f2032[_0x681c('0x8')]||![];this['smsPause']=_0x1f2032[_0x681c('0x9')]||![];this[_0x681c('0xa')]=_0x1f2032[_0x681c('0xa')]||![];this[_0x681c('0xb')]='unknown';this['chatStatusTime']=0x0;this[_0x681c('0xc')]=_0x1f2032[_0x681c('0xc')]||0x0;this[_0x681c('0xd')]=0x0;this['mailStatus']=_0x681c('0xe');this['mailStatusTime']=0x0;this[_0x681c('0xf')]=_0x1f2032['mailCapacity']||0x0;this[_0x681c('0x10')]=0x0;this[_0x681c('0x11')]=_0x681c('0xe');this[_0x681c('0x12')]=0x0;this[_0x681c('0x13')]=_0x1f2032[_0x681c('0x13')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x681c('0x14')]=_0x681c('0xe');this[_0x681c('0x15')]=0x0;this[_0x681c('0x16')]=_0x1f2032[_0x681c('0x16')]||0x0;this[_0x681c('0x17')]=0x0;this['whatsappStatus']=_0x681c('0xe');this[_0x681c('0x18')]=0x0;this[_0x681c('0x19')]=_0x1f2032[_0x681c('0x19')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x681c('0x1a')]=_0x681c('0xe');this['openchannelStatusTime']=0x0;this[_0x681c('0x1b')]=_0x1f2032['openchannelCapacity']||0x0;this[_0x681c('0x1c')]=0x0;this[_0x681c('0x1d')]=![];this[_0x681c('0x1e')]=undefined;this[_0x681c('0x0')]='';this[_0x681c('0x1f')]={};this['faxWaitingInteractions']={};this['mailWaitingInteractions']={};this['openchannelWaitingInteractions']={};this[_0x681c('0x20')]={};this[_0x681c('0x21')]={};this[_0x681c('0x22')]();}Agent[_0x681c('0x23')][_0x681c('0x24')]=function(_0x29f3fa){if(this[_0x29f3fa+_0x681c('0x25')]>0x0){if(this[_0x29f3fa+_0x681c('0x26')]>0x0&&this[_0x29f3fa+_0x681c('0x25')]>=this[_0x29f3fa+_0x681c('0x26')]){return _0x681c('0x27');}else{return _0x681c('0x28');}}else{return _0x681c('0x29');}};Agent[_0x681c('0x23')][_0x681c('0x22')]=function(){var _0x228f59=['mail',_0x681c('0x2a'),'openchannel',_0x681c('0x2b'),'sms','whatsapp'];for(var _0x30c977=0x0;_0x30c977<_0x228f59[_0x681c('0x2c')];_0x30c977+=0x1){var _0x17e8f3=this[_0x681c('0x24')](_0x228f59[_0x30c977]);if(this[_0x228f59[_0x30c977]+'Status']!==_0x17e8f3){this[_0x228f59[_0x30c977]+_0x681c('0x2d')]=_[_0x681c('0x2e')](moment()[_0x681c('0x2f')]('x'));}this[_0x228f59[_0x30c977]+_0x681c('0x30')]=_0x17e8f3;}var _0x147cda={'id':this['id'],'name':this[_0x681c('0x4')],'online':this[_0x681c('0x5')],'voicePause':this['voicePause'],'chatPause':this[_0x681c('0x6')],'mailPause':this[_0x681c('0x7')],'smsPause':this[_0x681c('0x9')],'faxPause':this['faxPause'],'openchannelPause':this[_0x681c('0xa')],'chatStatus':this[_0x681c('0xb')],'chatStatusTime':this[_0x681c('0x31')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x681c('0xd')],'mailStatus':this['mailStatus'],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x681c('0xf')],'mailCurrentCapacity':this[_0x681c('0x10')],'faxStatus':this[_0x681c('0x11')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x681c('0x13')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x681c('0x14')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x681c('0x32')],'whatsappStatusTime':this[_0x681c('0x18')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x681c('0x33')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x681c('0x1b')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x681c('0x1d')],'busyQueue':this[_0x681c('0x1e')],'chatWaitingInteractions':this[_0x681c('0x1f')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this[_0x681c('0x34')],'smsWaitingInteractions':this[_0x681c('0x20')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0xdb4f56=md5(JSON[_0x681c('0x35')](_0x147cda));if(this[_0x681c('0x0')]!==_0xdb4f56){this['md5']=_0xdb4f56;io[_0x681c('0x36')](_0x681c('0x37'),_['omit'](_0x147cda,[_0x681c('0x5')]));}};module[_0x681c('0x38')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 797482c..a78567b 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 _0x8b39=['timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','mapAgentsId','_rr','map','prototype','loggedIn','paused','length','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name'];(function(_0x29e35f,_0x4859ef){var _0x266b74=function(_0xc09e1){while(--_0xc09e1){_0x29e35f['push'](_0x29e35f['shift']());}};_0x266b74(++_0x4859ef);}(_0x8b39,0x14c));var _0x98b3=function(_0x2f7538,_0x1292b4){_0x2f7538=_0x2f7538-0x0;var _0x266ffd=_0x8b39[_0x2f7538];return _0x266ffd;};'use strict';var _=require(_0x98b3('0x0'));var md5=require(_0x98b3('0x1'));var util=require(_0x98b3('0x2'));var Redis=require(_0x98b3('0x3'));var config=require(_0x98b3('0x4'));config[_0x98b3('0x5')]=_[_0x98b3('0x6')](config['redis'],{'host':_0x98b3('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x98b3('0x5')]));function ChatQueue(_0x21af31){this['id']=_0x21af31['id']||0x0;this[_0x98b3('0x8')]=_0x21af31[_0x98b3('0x8')]||'';this[_0x98b3('0x9')]=_0x21af31[_0x98b3('0x9')]||0xa;this[_0x98b3('0xa')]=_0x21af31['strategy']||_0x98b3('0xb');this[_0x98b3('0xc')]=_0x21af31['Agents'];this['mapAgentsId']={};this[_0x98b3('0xd')]=0x0;this[_0x98b3('0x1')]='';this[_0x98b3('0xe')]();this[_0x98b3('0xf')]();}ChatQueue['prototype']['updateRouting']=function(){var _0x5df6be=this[_0x98b3('0x10')][_0x98b3('0x11')];this[_0x98b3('0x10')]=_[_0x98b3('0x12')](this[_0x98b3('0xc')],'id');this[_0x98b3('0x10')][_0x98b3('0x11')]=_0x5df6be;};ChatQueue[_0x98b3('0x13')]['updateRealtime']=function(){this[_0x98b3('0x14')]=0x0;this[_0x98b3('0x15')]=0x0;for(var _0x30951b=0x0;_0x30951b=0x0?this[_0x98b3('0x18')]:0x0;var _0x3b0da2={'id':this['id'],'available':this[_0x98b3('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x98b3('0x8')],'paused':this[_0x98b3('0x15')],'waiting':this[_0x98b3('0xd')]};var _0x2beaf4=md5(JSON[_0x98b3('0x19')](_0x3b0da2));if(this[_0x98b3('0x1')]!==_0x2beaf4){this['md5']=_0x2beaf4;io['to'](util[_0x98b3('0x1a')](_0x98b3('0x1b'),_0x3b0da2[_0x98b3('0x8')]))[_0x98b3('0x1c')](_0x98b3('0x1d'),_0x3b0da2);}};module[_0x98b3('0x1e')]=ChatQueue; \ No newline at end of file +var _0x17e8=['chatPause','available','waiting','stringify','format','chat:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','beepall','Agents','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','online'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x17e8,0x19e));var _0x817e=function(_0x52f0c8,_0x20130e){_0x52f0c8=_0x52f0c8-0x0;var _0x4164ea=_0x17e8[_0x52f0c8];return _0x4164ea;};'use strict';var _=require(_0x817e('0x0'));var md5=require(_0x817e('0x1'));var util=require(_0x817e('0x2'));var Redis=require(_0x817e('0x3'));var config=require(_0x817e('0x4'));config[_0x817e('0x5')]=_[_0x817e('0x6')](config['redis'],{'host':_0x817e('0x7'),'port':0x18eb});var io=require(_0x817e('0x8'))(new Redis(config['redis']));function ChatQueue(_0x55308d){this['id']=_0x55308d['id']||0x0;this[_0x817e('0x9')]=_0x55308d[_0x817e('0x9')]||'';this[_0x817e('0xa')]=_0x55308d['timeout']||0xa;this['strategy']=_0x55308d['strategy']||_0x817e('0xb');this[_0x817e('0xc')]=_0x55308d[_0x817e('0xc')];this['mapAgentsId']={};this['waiting']=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0x817e('0xd')]['updateRouting']=function(){var _0xf01af6=this[_0x817e('0xe')][_0x817e('0xf')];this[_0x817e('0xe')]=_[_0x817e('0x10')](this[_0x817e('0xc')],'id');this[_0x817e('0xe')][_0x817e('0xf')]=_0xf01af6;};ChatQueue[_0x817e('0xd')]['updateRealtime']=function(){this[_0x817e('0x11')]=0x0;this[_0x817e('0x12')]=0x0;for(var _0x5792ce=0x0;_0x5792ce=0x0?this['available']:0x0;var _0x64b4fd={'id':this['id'],'available':this[_0x817e('0x16')],'loggedIn':this[_0x817e('0x11')],'name':this[_0x817e('0x9')],'paused':this[_0x817e('0x12')],'waiting':this[_0x817e('0x17')]};var _0xc7258=md5(JSON[_0x817e('0x18')](_0x64b4fd));if(this[_0x817e('0x1')]!==_0xc7258){this[_0x817e('0x1')]=_0xc7258;io['to'](util[_0x817e('0x19')](_0x817e('0x1a'),_0x64b4fd[_0x817e('0x9')]))[_0x817e('0x1b')]('chat_queue:save',_0x64b4fd);}};module[_0x817e('0x1c')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 926e37f..4cf6a84 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 _0x06f8=['online','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length'];(function(_0x40a04e,_0x324a25){var _0x2e355a=function(_0x3f32d8){while(--_0x3f32d8){_0x40a04e['push'](_0x40a04e['shift']());}};_0x2e355a(++_0x324a25);}(_0x06f8,0xf9));var _0x806f=function(_0x149882,_0x39b6be){_0x149882=_0x149882-0x0;var _0x43c6ee=_0x06f8[_0x149882];return _0x43c6ee;};'use strict';var _=require(_0x806f('0x0'));var md5=require(_0x806f('0x1'));var util=require(_0x806f('0x2'));var Redis=require('ioredis');var config=require(_0x806f('0x3'));config[_0x806f('0x4')]=_[_0x806f('0x5')](config[_0x806f('0x4')],{'host':_0x806f('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x806f('0x4')]));function FaxQueue(_0x1dc5ed){this['id']=_0x1dc5ed['id']||0x0;this[_0x806f('0x7')]=_0x1dc5ed[_0x806f('0x7')]||'';this[_0x806f('0x8')]=_0x1dc5ed[_0x806f('0x8')]||0xa;this[_0x806f('0x9')]=_0x1dc5ed[_0x806f('0x9')]||_0x806f('0xa');this[_0x806f('0xb')]=_0x1dc5ed[_0x806f('0xb')];this[_0x806f('0xc')]={};this[_0x806f('0xd')]=0x0;this[_0x806f('0x1')]='';this[_0x806f('0xe')]();this[_0x806f('0xf')]();}FaxQueue[_0x806f('0x10')][_0x806f('0xe')]=function(){var _0xad9f9f=this[_0x806f('0xc')][_0x806f('0x11')];this[_0x806f('0xc')]=_['map'](this[_0x806f('0xb')],'id');this[_0x806f('0xc')][_0x806f('0x11')]=_0xad9f9f;};FaxQueue[_0x806f('0x10')][_0x806f('0xf')]=function(){this[_0x806f('0x12')]=0x0;this[_0x806f('0x13')]=0x0;for(var _0x2473ac=0x0;_0x2473ac=0x0?this['available']:0x0;var _0xd7689e={'id':this['id'],'available':this['available'],'loggedIn':this[_0x806f('0x12')],'name':this[_0x806f('0x7')],'paused':this[_0x806f('0x13')],'waiting':this[_0x806f('0xd')]};var _0x5cabaf=md5(JSON[_0x806f('0x18')](_0xd7689e));if(this['md5']!==_0x5cabaf){this[_0x806f('0x1')]=_0x5cabaf;io['to'](util[_0x806f('0x19')](_0x806f('0x1a'),_0xd7689e[_0x806f('0x7')]))[_0x806f('0x1b')](_0x806f('0x1c'),_0xd7689e);}};module[_0x806f('0x1d')]=FaxQueue; \ No newline at end of file +var _0x76a2=['_rr','updateRealtime','paused','length','available','loggedIn','stringify','format','fax_queue:save','exports','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','map'];(function(_0x1b906c,_0xc8288a){var _0x29d676=function(_0x53b775){while(--_0x53b775){_0x1b906c['push'](_0x1b906c['shift']());}};_0x29d676(++_0xc8288a);}(_0x76a2,0xea));var _0x276a=function(_0x380af2,_0x36cf66){_0x380af2=_0x380af2-0x0;var _0x1789dc=_0x76a2[_0x380af2];return _0x1789dc;};'use strict';var _=require(_0x276a('0x0'));var md5=require(_0x276a('0x1'));var util=require(_0x276a('0x2'));var Redis=require(_0x276a('0x3'));var config=require('../../../config/environment');config[_0x276a('0x4')]=_[_0x276a('0x5')](config[_0x276a('0x4')],{'host':_0x276a('0x6'),'port':0x18eb});var io=require(_0x276a('0x7'))(new Redis(config[_0x276a('0x4')]));function FaxQueue(_0x3f3bef){this['id']=_0x3f3bef['id']||0x0;this[_0x276a('0x8')]=_0x3f3bef['name']||'';this[_0x276a('0x9')]=_0x3f3bef[_0x276a('0x9')]||0xa;this[_0x276a('0xa')]=_0x3f3bef['strategy']||_0x276a('0xb');this[_0x276a('0xc')]=_0x3f3bef[_0x276a('0xc')];this[_0x276a('0xd')]={};this[_0x276a('0xe')]=0x0;this[_0x276a('0x1')]='';this[_0x276a('0xf')]();this['updateRealtime']();}FaxQueue[_0x276a('0x10')]['updateRouting']=function(){var _0x1e8cd3=this['mapAgentsId']['_rr'];this[_0x276a('0xd')]=_[_0x276a('0x11')](this['Agents'],'id');this[_0x276a('0xd')][_0x276a('0x12')]=_0x1e8cd3;};FaxQueue['prototype'][_0x276a('0x13')]=function(){this['loggedIn']=0x0;this[_0x276a('0x14')]=0x0;for(var _0x397083=0x0;_0x397083=0x0?this[_0x276a('0x16')]:0x0;var _0x59359f={'id':this['id'],'available':this['available'],'loggedIn':this[_0x276a('0x17')],'name':this[_0x276a('0x8')],'paused':this[_0x276a('0x14')],'waiting':this['waiting']};var _0x463791=md5(JSON[_0x276a('0x18')](_0x59359f));if(this[_0x276a('0x1')]!==_0x463791){this[_0x276a('0x1')]=_0x463791;io['to'](util[_0x276a('0x19')]('fax:queue:%s',_0x59359f[_0x276a('0x8')]))['emit'](_0x276a('0x1a'),_0x59359f);}};module[_0x276a('0x1b')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 487f2a6..7ea8630 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 _0xb2c1=['Intervals','exports','name'];(function(_0x2e35a6,_0x5ef737){var _0x450c20=function(_0x4c68cf){while(--_0x4c68cf){_0x2e35a6['push'](_0x2e35a6['shift']());}};_0x450c20(++_0x5ef737);}(_0xb2c1,0x13d));var _0x1b2c=function(_0x31a37b,_0x826249){_0x31a37b=_0x31a37b-0x0;var _0x49ae16=_0xb2c1[_0x31a37b];return _0x49ae16;};'use strict';function Interval(_0x1b03ba){this['id']=_0x1b03ba['id']||0x0;this[_0x1b2c('0x0')]=_0x1b03ba[_0x1b2c('0x0')]||'';this[_0x1b2c('0x1')]=_0x1b03ba['Intervals']||{};}module[_0x1b2c('0x2')]=Interval; \ No newline at end of file +var _0xa962=['Intervals','exports','name'];(function(_0x4e11e7,_0x42d0b6){var _0x1d7d39=function(_0x416030){while(--_0x416030){_0x4e11e7['push'](_0x4e11e7['shift']());}};_0x1d7d39(++_0x42d0b6);}(_0xa962,0x134));var _0x2a96=function(_0x4cdd4d,_0x3cce1e){_0x4cdd4d=_0x4cdd4d-0x0;var _0x1bbd06=_0xa962[_0x4cdd4d];return _0x1bbd06;};'use strict';function Interval(_0x11ce6d){this['id']=_0x11ce6d['id']||0x0;this[_0x2a96('0x0')]=_0x11ce6d[_0x2a96('0x0')]||'';this[_0x2a96('0x1')]=_0x11ce6d[_0x2a96('0x1')]||{};}module[_0x2a96('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 e1f2fd5..03f3387 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 _0x822e=['length','online','available','paused','waiting','stringify','format','mail:queue:%s','exports','lodash','md5','util','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','prototype','loggedIn'];(function(_0x382e89,_0x4768c0){var _0x3a1318=function(_0x79e1ce){while(--_0x79e1ce){_0x382e89['push'](_0x382e89['shift']());}};_0x3a1318(++_0x4768c0);}(_0x822e,0xbf));var _0xe822=function(_0x56139f,_0x306c82){_0x56139f=_0x56139f-0x0;var _0x205bc6=_0x822e[_0x56139f];return _0x205bc6;};'use strict';var _=require(_0xe822('0x0'));var md5=require(_0xe822('0x1'));var util=require(_0xe822('0x2'));var Redis=require(_0xe822('0x3'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0xe822('0x4')],{'host':_0xe822('0x5'),'port':0x18eb});var io=require(_0xe822('0x6'))(new Redis(config['redis']));function MailQueue(_0x5df0d3){this['id']=_0x5df0d3['id']||0x0;this[_0xe822('0x7')]=_0x5df0d3['name']||'';this[_0xe822('0x8')]=_0x5df0d3[_0xe822('0x8')]||0xa;this[_0xe822('0x9')]=_0x5df0d3[_0xe822('0x9')]||'beepall';this[_0xe822('0xa')]=_0x5df0d3['Agents'];this[_0xe822('0xb')]={};this['waiting']=0x0;this['md5']='';this[_0xe822('0xc')]();this[_0xe822('0xd')]();}MailQueue['prototype']['updateRouting']=function(){var _0x2df98b=this[_0xe822('0xb')][_0xe822('0xe')];this[_0xe822('0xb')]=_['map'](this[_0xe822('0xa')],'id');this['mapAgentsId'][_0xe822('0xe')]=_0x2df98b;};MailQueue[_0xe822('0xf')][_0xe822('0xd')]=function(){this[_0xe822('0x10')]=0x0;this['paused']=0x0;for(var _0x2360d6=0x0;_0x2360d6=0x0?this[_0xe822('0x13')]:0x0;var _0xc2cf59={'id':this['id'],'available':this[_0xe822('0x13')],'loggedIn':this['loggedIn'],'name':this[_0xe822('0x7')],'paused':this[_0xe822('0x14')],'waiting':this[_0xe822('0x15')]};var _0x5436c4=md5(JSON[_0xe822('0x16')](_0xc2cf59));if(this[_0xe822('0x1')]!==_0x5436c4){this['md5']=_0x5436c4;io['to'](util[_0xe822('0x17')](_0xe822('0x18'),_0xc2cf59[_0xe822('0x7')]))['emit']('mail_queue:save',_0xc2cf59);}};module[_0xe822('0x19')]=MailQueue; \ No newline at end of file +var _0x81fa=['length','online','mailPause','available','format','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused'];(function(_0x59b900,_0x36f9e9){var _0xc6d4bc=function(_0x262918){while(--_0x262918){_0x59b900['push'](_0x59b900['shift']());}};_0xc6d4bc(++_0x36f9e9);}(_0x81fa,0x7c));var _0xa81f=function(_0x5a92ad,_0x2219a6){_0x5a92ad=_0x5a92ad-0x0;var _0x2466f8=_0x81fa[_0x5a92ad];return _0x2466f8;};'use strict';var _=require(_0xa81f('0x0'));var md5=require(_0xa81f('0x1'));var util=require(_0xa81f('0x2'));var Redis=require(_0xa81f('0x3'));var config=require(_0xa81f('0x4'));config[_0xa81f('0x5')]=_['defaults'](config[_0xa81f('0x5')],{'host':_0xa81f('0x6'),'port':0x18eb});var io=require(_0xa81f('0x7'))(new Redis(config[_0xa81f('0x5')]));function MailQueue(_0x4b78c0){this['id']=_0x4b78c0['id']||0x0;this[_0xa81f('0x8')]=_0x4b78c0[_0xa81f('0x8')]||'';this[_0xa81f('0x9')]=_0x4b78c0[_0xa81f('0x9')]||0xa;this[_0xa81f('0xa')]=_0x4b78c0['strategy']||'beepall';this[_0xa81f('0xb')]=_0x4b78c0[_0xa81f('0xb')];this[_0xa81f('0xc')]={};this[_0xa81f('0xd')]=0x0;this['md5']='';this[_0xa81f('0xe')]();this[_0xa81f('0xf')]();}MailQueue[_0xa81f('0x10')]['updateRouting']=function(){var _0x5a2416=this[_0xa81f('0xc')]['_rr'];this[_0xa81f('0xc')]=_[_0xa81f('0x11')](this[_0xa81f('0xb')],'id');this['mapAgentsId'][_0xa81f('0x12')]=_0x5a2416;};MailQueue[_0xa81f('0x10')][_0xa81f('0xf')]=function(){this[_0xa81f('0x13')]=0x0;this[_0xa81f('0x14')]=0x0;for(var _0x44a7ba=0x0;_0x44a7ba=0x0?this[_0xa81f('0x18')]:0x0;var _0x2064aa={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xa81f('0x8')],'paused':this[_0xa81f('0x14')],'waiting':this['waiting']};var _0x1298ab=md5(JSON['stringify'](_0x2064aa));if(this['md5']!==_0x1298ab){this[_0xa81f('0x1')]=_0x1298ab;io['to'](util[_0xa81f('0x19')]('mail:queue:%s',_0x2064aa[_0xa81f('0x8')]))[_0xa81f('0x1a')](_0xa81f('0x1b'),_0x2064aa);}};module[_0xa81f('0x1c')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 35a99a9..5bb305f 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 _0xadb5=['../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','prototype','updateRealtime','paused','loggedIn','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','md5','ioredis'];(function(_0x556634,_0x520958){var _0x4429fd=function(_0x1e7eb9){while(--_0x1e7eb9){_0x556634['push'](_0x556634['shift']());}};_0x4429fd(++_0x520958);}(_0xadb5,0xad));var _0x5adb=function(_0xb0e50b,_0x4e4be6){_0xb0e50b=_0xb0e50b-0x0;var _0x5c6047=_0xadb5[_0xb0e50b];return _0x5c6047;};'use strict';var _=require('lodash');var md5=require(_0x5adb('0x0'));var util=require('util');var Redis=require(_0x5adb('0x1'));var config=require(_0x5adb('0x2'));config[_0x5adb('0x3')]=_['defaults'](config[_0x5adb('0x3')],{'host':_0x5adb('0x4'),'port':0x18eb});var io=require(_0x5adb('0x5'))(new Redis(config['redis']));function OpenchannelQueue(_0x35a5d3){this['id']=_0x35a5d3['id']||0x0;this[_0x5adb('0x6')]=_0x35a5d3[_0x5adb('0x6')]||'';this[_0x5adb('0x7')]=_0x35a5d3[_0x5adb('0x7')]||0xa;this[_0x5adb('0x8')]=_0x35a5d3[_0x5adb('0x8')]||_0x5adb('0x9');this[_0x5adb('0xa')]=_0x35a5d3[_0x5adb('0xa')];this[_0x5adb('0xb')]={};this[_0x5adb('0xc')]=0x0;this[_0x5adb('0x0')]='';this[_0x5adb('0xd')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0x5adb('0xd')]=function(){var _0x1ea238=this[_0x5adb('0xb')]['_rr'];this[_0x5adb('0xb')]=_['map'](this[_0x5adb('0xa')],'id');this['mapAgentsId'][_0x5adb('0xe')]=_0x1ea238;};OpenchannelQueue[_0x5adb('0xf')][_0x5adb('0x10')]=function(){this['loggedIn']=0x0;this[_0x5adb('0x11')]=0x0;for(var _0x34af2c=0x0;_0x34af2c=0x0?this['available']:0x0;var _0x3fff62={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5adb('0x12')],'name':this['name'],'paused':this[_0x5adb('0x11')],'waiting':this['waiting']};var _0x5e218c=md5(JSON[_0x5adb('0x15')](_0x3fff62));if(this[_0x5adb('0x0')]!==_0x5e218c){this[_0x5adb('0x0')]=_0x5e218c;io['to'](util[_0x5adb('0x16')](_0x5adb('0x17'),_0x3fff62['name']))[_0x5adb('0x18')]('openchannel_queue:save',_0x3fff62);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0xaa8ea9,_0x238ec5){var _0x23ea22=function(_0x4683f2){while(--_0x4683f2){_0xaa8ea9['push'](_0xaa8ea9['shift']());}};_0x23ea22(++_0x238ec5);}(_0x814b,0x1a2));var _0xb814=function(_0x58fc2f,_0x111399){_0x58fc2f=_0x58fc2f-0x0;var _0x3a1312=_0x814b[_0x58fc2f];return _0x3a1312;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index d20b46b..b755a5d 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 _0x87f8=['updateRouting','updateRealtime','prototype','map','paused','length','loggedIn','smsPause','available','waiting','stringify','sms:queue:%s','sms_queue:save','exports','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','md5'];(function(_0x5028a9,_0x2cf5d4){var _0x3c6c52=function(_0x3bf0bc){while(--_0x3bf0bc){_0x5028a9['push'](_0x5028a9['shift']());}};_0x3c6c52(++_0x2cf5d4);}(_0x87f8,0x152));var _0x887f=function(_0x299475,_0x40302e){_0x299475=_0x299475-0x0;var _0x28355a=_0x87f8[_0x299475];return _0x28355a;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0x887f('0x0'));var config=require(_0x887f('0x1'));config['redis']=_[_0x887f('0x2')](config['redis'],{'host':_0x887f('0x3'),'port':0x18eb});var io=require(_0x887f('0x4'))(new Redis(config[_0x887f('0x5')]));function SmsQueue(_0x2d4cec){this['id']=_0x2d4cec['id']||0x0;this['name']=_0x2d4cec[_0x887f('0x6')]||'';this[_0x887f('0x7')]=_0x2d4cec[_0x887f('0x7')]||0xa;this[_0x887f('0x8')]=_0x2d4cec[_0x887f('0x8')]||_0x887f('0x9');this[_0x887f('0xa')]=_0x2d4cec['Agents'];this[_0x887f('0xb')]={};this['waiting']=0x0;this[_0x887f('0xc')]='';this[_0x887f('0xd')]();this[_0x887f('0xe')]();}SmsQueue[_0x887f('0xf')]['updateRouting']=function(){var _0x12383f=this[_0x887f('0xb')]['_rr'];this['mapAgentsId']=_[_0x887f('0x10')](this[_0x887f('0xa')],'id');this[_0x887f('0xb')]['_rr']=_0x12383f;};SmsQueue[_0x887f('0xf')][_0x887f('0xe')]=function(){this['loggedIn']=0x0;this[_0x887f('0x11')]=0x0;for(var _0x58152e=0x0;_0x58152e=0x0?this[_0x887f('0x15')]:0x0;var _0x3d3b0c={'id':this['id'],'available':this[_0x887f('0x15')],'loggedIn':this[_0x887f('0x13')],'name':this[_0x887f('0x6')],'paused':this[_0x887f('0x11')],'waiting':this[_0x887f('0x16')]};var _0x3964d6=md5(JSON[_0x887f('0x17')](_0x3d3b0c));if(this[_0x887f('0xc')]!==_0x3964d6){this[_0x887f('0xc')]=_0x3964d6;io['to'](util['format'](_0x887f('0x18'),_0x3d3b0c[_0x887f('0x6')]))['emit'](_0x887f('0x19'),_0x3d3b0c);}};module[_0x887f('0x1a')]=SmsQueue; \ No newline at end of file +var _0xa5ca=['localhost','socket.io-emitter','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','length','loggedIn','smsPause','paused','available','stringify','format','emit','sms_queue:save','exports','lodash','md5','util','redis','defaults'];(function(_0x4a6f0a,_0x963c19){var _0x3a9e77=function(_0x398eb6){while(--_0x398eb6){_0x4a6f0a['push'](_0x4a6f0a['shift']());}};_0x3a9e77(++_0x963c19);}(_0xa5ca,0xb1));var _0xaa5c=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0xa5ca[_0x32b542];return _0x554d54;};'use strict';var _=require(_0xaa5c('0x0'));var md5=require(_0xaa5c('0x1'));var util=require(_0xaa5c('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xaa5c('0x3')]=_[_0xaa5c('0x4')](config[_0xaa5c('0x3')],{'host':_0xaa5c('0x5'),'port':0x18eb});var io=require(_0xaa5c('0x6'))(new Redis(config[_0xaa5c('0x3')]));function SmsQueue(_0x56500a){this['id']=_0x56500a['id']||0x0;this['name']=_0x56500a['name']||'';this[_0xaa5c('0x7')]=_0x56500a[_0xaa5c('0x7')]||0xa;this[_0xaa5c('0x8')]=_0x56500a['strategy']||'beepall';this[_0xaa5c('0x9')]=_0x56500a[_0xaa5c('0x9')];this[_0xaa5c('0xa')]={};this['waiting']=0x0;this[_0xaa5c('0x1')]='';this[_0xaa5c('0xb')]();this[_0xaa5c('0xc')]();}SmsQueue[_0xaa5c('0xd')][_0xaa5c('0xb')]=function(){var _0xb03963=this[_0xaa5c('0xa')][_0xaa5c('0xe')];this[_0xaa5c('0xa')]=_[_0xaa5c('0xf')](this[_0xaa5c('0x9')],'id');this[_0xaa5c('0xa')][_0xaa5c('0xe')]=_0xb03963;};SmsQueue['prototype'][_0xaa5c('0xc')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x4c8461=0x0;_0x4c8461=0x0?this['available']:0x0;var _0x43990d={'id':this['id'],'available':this[_0xaa5c('0x14')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x3e7eab=md5(JSON[_0xaa5c('0x15')](_0x43990d));if(this['md5']!==_0x3e7eab){this[_0xaa5c('0x1')]=_0x3e7eab;io['to'](util[_0xaa5c('0x16')]('sms:queue:%s',_0x43990d['name']))[_0xaa5c('0x17')](_0xaa5c('0x18'),_0x43990d);}};module[_0xaa5c('0x19')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 90fd0c0..ca04087 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 _0xff8c=['beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','paused','length','available','loggedIn','name','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','md5','redis','localhost','socket.io-emitter','timeout','strategy'];(function(_0xd4e399,_0x4a8481){var _0x1186c9=function(_0x48aa19){while(--_0x48aa19){_0xd4e399['push'](_0xd4e399['shift']());}};_0x1186c9(++_0x4a8481);}(_0xff8c,0x1cd));var _0xcff8=function(_0x3bd139,_0x52a505){_0x3bd139=_0x3bd139-0x0;var _0xa9342a=_0xff8c[_0x3bd139];return _0xa9342a;};'use strict';var _=require(_0xcff8('0x0'));var md5=require(_0xcff8('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0xcff8('0x2')],{'host':_0xcff8('0x3'),'port':0x18eb});var io=require(_0xcff8('0x4'))(new Redis(config['redis']));function WhatsappQueue(_0x49d880){this['id']=_0x49d880['id']||0x0;this['name']=_0x49d880['name']||'';this[_0xcff8('0x5')]=_0x49d880[_0xcff8('0x5')]||0xa;this['strategy']=_0x49d880[_0xcff8('0x6')]||_0xcff8('0x7');this[_0xcff8('0x8')]=_0x49d880[_0xcff8('0x8')];this[_0xcff8('0x9')]={};this[_0xcff8('0xa')]=0x0;this['md5']='';this['updateRouting']();this[_0xcff8('0xb')]();}WhatsappQueue[_0xcff8('0xc')][_0xcff8('0xd')]=function(){var _0x377624=this[_0xcff8('0x9')][_0xcff8('0xe')];this[_0xcff8('0x9')]=_[_0xcff8('0xf')](this[_0xcff8('0x8')],'id');this[_0xcff8('0x9')][_0xcff8('0xe')]=_0x377624;};WhatsappQueue[_0xcff8('0xc')][_0xcff8('0xb')]=function(){this['loggedIn']=0x0;this[_0xcff8('0x10')]=0x0;for(var _0x9c060c=0x0;_0x9c060c=0x0?this[_0xcff8('0x12')]:0x0;var _0x16f85a={'id':this['id'],'available':this[_0xcff8('0x12')],'loggedIn':this[_0xcff8('0x13')],'name':this[_0xcff8('0x14')],'paused':this['paused'],'waiting':this[_0xcff8('0xa')]};var _0x5d0168=md5(JSON[_0xcff8('0x15')](_0x16f85a));if(this['md5']!==_0x5d0168){this[_0xcff8('0x1')]=_0x5d0168;io['to'](util[_0xcff8('0x16')](_0xcff8('0x17'),_0x16f85a[_0xcff8('0x14')]))[_0xcff8('0x18')](_0xcff8('0x19'),_0x16f85a);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0xd226=['socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','length','online','loggedIn','whatsappPause','paused','available','format','whatsapp_queue:save','md5','util','ioredis','redis','defaults','localhost'];(function(_0x105fe6,_0x4e93c6){var _0x5c78a3=function(_0x23ee4f){while(--_0x23ee4f){_0x105fe6['push'](_0x105fe6['shift']());}};_0x5c78a3(++_0x4e93c6);}(_0xd226,0x126));var _0x6d22=function(_0x5333ba,_0x22e1bb){_0x5333ba=_0x5333ba-0x0;var _0x20f9dc=_0xd226[_0x5333ba];return _0x20f9dc;};'use strict';var _=require('lodash');var md5=require(_0x6d22('0x0'));var util=require(_0x6d22('0x1'));var Redis=require(_0x6d22('0x2'));var config=require('../../../config/environment');config[_0x6d22('0x3')]=_[_0x6d22('0x4')](config[_0x6d22('0x3')],{'host':_0x6d22('0x5'),'port':0x18eb});var io=require(_0x6d22('0x6'))(new Redis(config[_0x6d22('0x3')]));function WhatsappQueue(_0x340b55){this['id']=_0x340b55['id']||0x0;this[_0x6d22('0x7')]=_0x340b55[_0x6d22('0x7')]||'';this[_0x6d22('0x8')]=_0x340b55['timeout']||0xa;this[_0x6d22('0x9')]=_0x340b55[_0x6d22('0x9')]||_0x6d22('0xa');this[_0x6d22('0xb')]=_0x340b55[_0x6d22('0xb')];this['mapAgentsId']={};this[_0x6d22('0xc')]=0x0;this[_0x6d22('0x0')]='';this[_0x6d22('0xd')]();this[_0x6d22('0xe')]();}WhatsappQueue[_0x6d22('0xf')]['updateRouting']=function(){var _0x44a064=this[_0x6d22('0x10')]['_rr'];this[_0x6d22('0x10')]=_['map'](this[_0x6d22('0xb')],'id');this[_0x6d22('0x10')]['_rr']=_0x44a064;};WhatsappQueue[_0x6d22('0xf')][_0x6d22('0xe')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x50cfdf=0x0;_0x50cfdf=0x0?this['available']:0x0;var _0x327a9e={'id':this['id'],'available':this[_0x6d22('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x6d22('0x7')],'paused':this[_0x6d22('0x15')],'waiting':this['waiting']};var _0x39d5ce=md5(JSON['stringify'](_0x327a9e));if(this['md5']!==_0x39d5ce){this[_0x6d22('0x0')]=_0x39d5ce;io['to'](util[_0x6d22('0x17')]('whatsapp:queue:%s',_0x327a9e[_0x6d22('0x7')]))['emit'](_0x6d22('0x18'),_0x327a9e);}};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 25b0784..fc1de82 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x25ec4c,_0x23a06d){var _0xff5b36=function(_0x376547){while(--_0x376547){_0x25ec4c['push'](_0x25ec4c['shift']());}};_0xff5b36(++_0x23a06d);}(_0xb10b,0x12a));var _0xbb10=function(_0x3b3947,_0x1c5e57){_0x3b3947=_0x3b3947-0x0;var _0x4113d7=_0xb10b[_0x3b3947];return _0x4113d7;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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 d256883..df53359 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 _0xcef8=['updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','Request','UpdateChatInteraction'];(function(_0x533a4d,_0xdd2035){var _0x13225f=function(_0x1152a6){while(--_0x1152a6){_0x533a4d['push'](_0x533a4d['shift']());}};_0x13225f(++_0xdd2035);}(_0xcef8,0x162));var _0x8cef=function(_0x29ceb7,_0x464552){_0x29ceb7=_0x29ceb7-0x0;var _0x26e370=_0xcef8[_0x29ceb7];return _0x26e370;};'use strict';var client=require(_0x8cef('0x0'));exports['update']=function(_0xed6f11,_0x4220c4){return client[_0x8cef('0x1')](_0x8cef('0x2'),{'body':_0x4220c4,'options':{'where':{'id':_0xed6f11}},'log':_0x8cef('0x3')});};exports[_0x8cef('0x4')]=function(_0x4e2a88,_0x280679){return client[_0x8cef('0x1')](_0x8cef('0x5'),{'body':_0x280679,'options':{'where':{'id':_0x4e2a88}},'log':_0x8cef('0x6')});}; \ No newline at end of file +var _0x17bf=['addTags','AddTagsToChatInteraction','addTagsToChatInteraction','update','updateChatInteraction'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x17bf,0x157));var _0xf17b=function(_0x23aa08,_0x280606){_0x23aa08=_0x23aa08-0x0;var _0x1423ba=_0x17bf[_0x23aa08];return _0x1423ba;};'use strict';var client=require('../client');exports[_0xf17b('0x0')]=function(_0xe2205e,_0x3fc3e7){return client['Request']('UpdateChatInteraction',{'body':_0x3fc3e7,'options':{'where':{'id':_0xe2205e}},'log':_0xf17b('0x1')});};exports[_0xf17b('0x2')]=function(_0x470538,_0x35deed){return client['Request'](_0xf17b('0x3'),{'body':_0x35deed,'options':{'where':{'id':_0x470538}},'log':_0xf17b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 15bb000..cf11752 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 _0x876d=['Request','CreateChatMessage','createChatMessage','create'];(function(_0xdb5d69,_0x54897a){var _0x5defd4=function(_0x1a429d){while(--_0x1a429d){_0xdb5d69['push'](_0xdb5d69['shift']());}};_0x5defd4(++_0x54897a);}(_0x876d,0x12b));var _0xd876=function(_0x38c625,_0x53cbb9){_0x38c625=_0x38c625-0x0;var _0x3eb8a4=_0x876d[_0x38c625];return _0x3eb8a4;};'use strict';var client=require('../client');exports[_0xd876('0x0')]=function(_0x5219b2){return client[_0xd876('0x1')](_0xd876('0x2'),{'body':_0x5219b2,'log':_0xd876('0x3')});}; \ No newline at end of file +var _0xb47d=['../client','create','createChatMessage'];(function(_0x16fcb4,_0x4a1009){var _0x54be5e=function(_0x489755){while(--_0x489755){_0x16fcb4['push'](_0x16fcb4['shift']());}};_0x54be5e(++_0x4a1009);}(_0xb47d,0x189));var _0xdb47=function(_0x7bbe45,_0x269fcd){_0x7bbe45=_0x7bbe45-0x0;var _0x57c3dd=_0xb47d[_0x7bbe45];return _0x57c3dd;};'use strict';var client=require(_0xdb47('0x0'));exports[_0xdb47('0x1')]=function(_0x28ce3d){return client['Request']('CreateChatMessage',{'body':_0x28ce3d,'log':_0xdb47('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 0006511..75fd8f3 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 _0x1134=['getChatQueues','GetChatQueue','name','strategy','User','chatPause','../client'];(function(_0x5460c6,_0x1bab97){var _0x2c4673=function(_0x6f65b6){while(--_0x6f65b6){_0x5460c6['push'](_0x5460c6['shift']());}};_0x2c4673(++_0x1bab97);}(_0x1134,0x19c));var _0x4113=function(_0x4a671a,_0x1172e7){_0x4a671a=_0x4a671a-0x0;var _0x20ec01=_0x1134[_0x4a671a];return _0x20ec01;};'use strict';var client=require(_0x4113('0x0'));exports[_0x4113('0x1')]=function(){return function(){return client['Request'](_0x4113('0x2'),{'options':{'raw':![],'attributes':['id',_0x4113('0x3'),'timeout',_0x4113('0x4')],'include':[{'model':_0x4113('0x5'),'as':'Agents','attributes':['id',_0x4113('0x3'),'online',_0x4113('0x6')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0xe314=['GetChatQueue','name','timeout','strategy','User','Agents','online','getChatQueues','Request'];(function(_0x162e64,_0x58c8bd){var _0x40319b=function(_0x309339){while(--_0x309339){_0x162e64['push'](_0x162e64['shift']());}};_0x40319b(++_0x58c8bd);}(_0xe314,0x7c));var _0x4e31=function(_0x15e45d,_0x5b6683){_0x15e45d=_0x15e45d-0x0;var _0x22fc0e=_0xe314[_0x15e45d];return _0x22fc0e;};'use strict';var client=require('../client');exports[_0x4e31('0x0')]=function(){return function(){return client[_0x4e31('0x1')](_0x4e31('0x2'),{'options':{'raw':![],'attributes':['id',_0x4e31('0x3'),_0x4e31('0x4'),_0x4e31('0x5')],'include':[{'model':_0x4e31('0x6'),'as':_0x4e31('0x7'),'attributes':['id',_0x4e31('0x3'),_0x4e31('0x8'),'chatPause']}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 9d027fe..5fae796 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 _0xf3cd=['DESC','UpdateChatQueueReport','../client','create','Request','CreateChatQueueReport'];(function(_0x554637,_0x474aab){var _0x258da8=function(_0x5c52b6){while(--_0x5c52b6){_0x554637['push'](_0x554637['shift']());}};_0x258da8(++_0x474aab);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x2678d6,_0x4e2001){_0x2678d6=_0x2678d6-0x0;var _0x475503=_0xf3cd[_0x2678d6];return _0x475503;};'use strict';var client=require(_0xdf3c('0x0'));exports[_0xdf3c('0x1')]=function(_0x31e5a5){return client[_0xdf3c('0x2')](_0xdf3c('0x3'),{'body':_0x31e5a5,'log':_0xdf3c('0x3')});};exports['update']=function(_0x401518,_0x71b446){return client[_0xdf3c('0x2')]('UpdateChatQueueReport',{'body':_0x71b446,'options':{'where':{'uniqueid':_0x401518},'order':[['id',_0xdf3c('0x4')]],'limit':0x1},'log':_0xdf3c('0x5')});}; \ No newline at end of file +var _0x72b1=['../client','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC'];(function(_0x11f993,_0xfbd7ba){var _0x461321=function(_0x35e0ff){while(--_0x35e0ff){_0x11f993['push'](_0x11f993['shift']());}};_0x461321(++_0xfbd7ba);}(_0x72b1,0x16e));var _0x172b=function(_0x40ec84,_0x25f950){_0x40ec84=_0x40ec84-0x0;var _0x3c230c=_0x72b1[_0x40ec84];return _0x3c230c;};'use strict';var client=require(_0x172b('0x0'));exports['create']=function(_0x368075){return client[_0x172b('0x1')](_0x172b('0x2'),{'body':_0x368075,'log':_0x172b('0x2')});};exports[_0x172b('0x3')]=function(_0x3fa10d,_0x2c1d6e){return client['Request'](_0x172b('0x4'),{'body':_0x2c1d6e,'options':{'where':{'uniqueid':_0x3fa10d},'order':[['id',_0x172b('0x5')]],'limit':0x1},'log':_0x172b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 448aa68..16b7c50 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(_0x198457,_0x5bb489){var _0x23b71a=function(_0x5f8ab1){while(--_0x5f8ab1){_0x198457['push'](_0x198457['shift']());}};_0x23b71a(++_0x5bb489);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x4d4b38,_0x3bdb2c){var _0x20e91e=function(_0x404117){while(--_0x404117){_0x4d4b38['push'](_0x4d4b38['shift']());}};_0x20e91e(++_0x3bdb2c);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 7a874a5..da069ef 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 _0x8c55=['Request','CreateFaxMessage','createFaxMessage'];(function(_0x55c8d7,_0x2a4369){var _0x523dce=function(_0x1879e2){while(--_0x1879e2){_0x55c8d7['push'](_0x55c8d7['shift']());}};_0x523dce(++_0x2a4369);}(_0x8c55,0x69));var _0x58c5=function(_0x16b121,_0x222254){_0x16b121=_0x16b121-0x0;var _0x56ce9e=_0x8c55[_0x16b121];return _0x56ce9e;};'use strict';var client=require('../client');exports['create']=function(_0x551a8c){return client[_0x58c5('0x0')](_0x58c5('0x1'),{'body':_0x551a8c,'log':_0x58c5('0x2')});}; \ No newline at end of file +var _0xa693=['Request','create'];(function(_0x1f7cf0,_0x299555){var _0x16e7f8=function(_0x25da09){while(--_0x25da09){_0x1f7cf0['push'](_0x1f7cf0['shift']());}};_0x16e7f8(++_0x299555);}(_0xa693,0x69));var _0x3a69=function(_0x50e40b,_0x338d17){_0x50e40b=_0x50e40b-0x0;var _0x2608b7=_0xa693[_0x50e40b];return _0x2608b7;};'use strict';var client=require('../client');exports[_0x3a69('0x0')]=function(_0x83990c){return client[_0x3a69('0x1')]('CreateFaxMessage',{'body':_0x83990c,'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 011a1f3..55532aa 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 _0xb899=['faxPause','../client','GetFaxQueue','name','timeout','strategy','User','online'];(function(_0x2112ae,_0xeb3641){var _0x15dcae=function(_0x21742d){while(--_0x21742d){_0x2112ae['push'](_0x2112ae['shift']());}};_0x15dcae(++_0xeb3641);}(_0xb899,0x91));var _0x9b89=function(_0xd9a32a,_0x52810e){_0xd9a32a=_0xd9a32a-0x0;var _0x1ffeda=_0xb899[_0xd9a32a];return _0x1ffeda;};'use strict';var client=require(_0x9b89('0x0'));exports['getFaxQueues']=function(){return function(){return client['Request'](_0x9b89('0x1'),{'options':{'raw':![],'attributes':['id',_0x9b89('0x2'),_0x9b89('0x3'),_0x9b89('0x4')],'include':[{'model':_0x9b89('0x5'),'as':'Agents','attributes':['id',_0x9b89('0x2'),_0x9b89('0x6'),_0x9b89('0x7')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0xc37d=['Request','GetFaxQueue','name','User','faxPause','getFaxQueues'];(function(_0x325501,_0x5242f6){var _0x2c1626=function(_0x4270b2){while(--_0x4270b2){_0x325501['push'](_0x325501['shift']());}};_0x2c1626(++_0x5242f6);}(_0xc37d,0x1cd));var _0xdc37=function(_0x32c4ac,_0x377da3){_0x32c4ac=_0x32c4ac-0x0;var _0x2e49bc=_0xc37d[_0x32c4ac];return _0x2e49bc;};'use strict';var client=require('../client');exports[_0xdc37('0x0')]=function(){return function(){return client[_0xdc37('0x1')](_0xdc37('0x2'),{'options':{'raw':![],'attributes':['id',_0xdc37('0x3'),'timeout','strategy'],'include':[{'model':_0xdc37('0x4'),'as':'Agents','attributes':['id',_0xdc37('0x3'),'online',_0xdc37('0x5')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 535ef72..372367f 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 _0x47f7=['update','Request','UpdateFaxQueueReport','DESC','../client','create','CreateFaxQueueReport'];(function(_0x5108f9,_0x249e0d){var _0x33f35e=function(_0x36ae09){while(--_0x36ae09){_0x5108f9['push'](_0x5108f9['shift']());}};_0x33f35e(++_0x249e0d);}(_0x47f7,0x1c4));var _0x747f=function(_0x2e1862,_0x1503a8){_0x2e1862=_0x2e1862-0x0;var _0x4655d4=_0x47f7[_0x2e1862];return _0x4655d4;};'use strict';var client=require(_0x747f('0x0'));exports[_0x747f('0x1')]=function(_0x479b6d){return client['Request'](_0x747f('0x2'),{'body':_0x479b6d,'log':_0x747f('0x2')});};exports[_0x747f('0x3')]=function(_0x55697a,_0x41d82d){return client[_0x747f('0x4')](_0x747f('0x5'),{'body':_0x41d82d,'options':{'where':{'uniqueid':_0x55697a},'order':[['id',_0x747f('0x6')]],'limit':0x1},'log':_0x747f('0x5')});}; \ No newline at end of file +var _0x8cd5=['DESC','UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8cd5,0x121));var _0x58cd=function(_0x129b99,_0x254188){_0x129b99=_0x129b99-0x0;var _0x51d0f7=_0x8cd5[_0x129b99];return _0x51d0f7;};'use strict';var client=require(_0x58cd('0x0'));exports[_0x58cd('0x1')]=function(_0x4a0702){return client[_0x58cd('0x2')](_0x58cd('0x3'),{'body':_0x4a0702,'log':_0x58cd('0x3')});};exports[_0x58cd('0x4')]=function(_0x44b40b,_0x5a91a8){return client[_0x58cd('0x2')]('UpdateFaxQueueReport',{'body':_0x5a91a8,'options':{'where':{'uniqueid':_0x44b40b},'order':[['id',_0x58cd('0x5')]],'limit':0x1},'log':_0x58cd('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index b785645..5381445 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 _0x1b2e=['name','Interval','Intervals','../client','getIntervals','Request'];(function(_0x324e86,_0x81b1cb){var _0x592846=function(_0x33439c){while(--_0x33439c){_0x324e86['push'](_0x324e86['shift']());}};_0x592846(++_0x81b1cb);}(_0x1b2e,0xf9));var _0xe1b2=function(_0x278b26,_0x4f1387){_0x278b26=_0x278b26-0x0;var _0xf59782=_0x1b2e[_0x278b26];return _0xf59782;};'use strict';var client=require(_0xe1b2('0x0'));exports[_0xe1b2('0x1')]=function(){return function(){return client[_0xe1b2('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xe1b2('0x3')],'include':[{'model':_0xe1b2('0x4'),'as':_0xe1b2('0x5'),'attributes':['id',_0xe1b2('0x3'),'interval']}]},'log':_0xe1b2('0x1')});};}; \ No newline at end of file +var _0xa06d=['Request','GetInterval','Interval','interval','../client','getIntervals'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xa06d,0x94));var _0xda06=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa06d[_0x5ddb1c];return _0x354adc;};'use strict';var client=require(_0xda06('0x0'));exports[_0xda06('0x1')]=function(){return function(){return client[_0xda06('0x2')](_0xda06('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xda06('0x4'),'as':'Intervals','attributes':['id','name',_0xda06('0x5')]}]},'log':_0xda06('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index ac77efc..c3b87e9 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 _0x57ca=['UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','update','Request'];(function(_0x2e0032,_0x483067){var _0x1a83a6=function(_0x32fe77){while(--_0x32fe77){_0x2e0032['push'](_0x2e0032['shift']());}};_0x1a83a6(++_0x483067);}(_0x57ca,0x108));var _0xa57c=function(_0x327040,_0x6f7206){_0x327040=_0x327040-0x0;var _0x201070=_0x57ca[_0x327040];return _0x201070;};'use strict';var client=require('../client');exports[_0xa57c('0x0')]=function(_0x4ad696,_0x4b1712){return client[_0xa57c('0x1')](_0xa57c('0x2'),{'body':_0x4b1712,'options':{'where':{'id':_0x4ad696}},'log':_0xa57c('0x3')});};exports[_0xa57c('0x4')]=function(_0x1da469,_0x48be2d){return client[_0xa57c('0x1')](_0xa57c('0x5'),{'body':_0x48be2d,'options':{'where':{'id':_0x1da469}},'log':_0xa57c('0x6')});}; \ No newline at end of file +var _0x0b0e=['Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x320b9e,_0x1f892f){var _0x5e4416=function(_0x160fcc){while(--_0x160fcc){_0x320b9e['push'](_0x320b9e['shift']());}};_0x5e4416(++_0x1f892f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x685346,_0x3ef2e5){_0x685346=_0x685346-0x0;var _0x52e15b=_0x0b0e[_0x685346];return _0x52e15b;};'use strict';var client=require(_0xe0b0('0x0'));exports['update']=function(_0xc416e3,_0x536e9b){return client[_0xe0b0('0x1')](_0xe0b0('0x2'),{'body':_0x536e9b,'options':{'where':{'id':_0xc416e3}},'log':_0xe0b0('0x3')});};exports[_0xe0b0('0x4')]=function(_0x28040c,_0x38a058){return client[_0xe0b0('0x1')](_0xe0b0('0x5'),{'body':_0x38a058,'options':{'where':{'id':_0x28040c}},'log':_0xe0b0('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 770ab12..73e0934 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 _0xef17=['create','Request','CreateMailMessage','createMailMessage','../client'];(function(_0x458f22,_0x45d568){var _0x2ffddc=function(_0x37fc21){while(--_0x37fc21){_0x458f22['push'](_0x458f22['shift']());}};_0x2ffddc(++_0x45d568);}(_0xef17,0x185));var _0x7ef1=function(_0x3aef77,_0x3aaa61){_0x3aef77=_0x3aef77-0x0;var _0x154179=_0xef17[_0x3aef77];return _0x154179;};'use strict';var client=require(_0x7ef1('0x0'));exports[_0x7ef1('0x1')]=function(_0xfbb5fe){return client[_0x7ef1('0x2')](_0x7ef1('0x3'),{'body':_0xfbb5fe,'log':_0x7ef1('0x4')});}; \ No newline at end of file +var _0xd4da=['create','Request','CreateMailMessage','createMailMessage'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd4da,0xdc));var _0xad4d=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xd4da[_0x4a9fb1];return _0x348672;};'use strict';var client=require('../client');exports[_0xad4d('0x0')]=function(_0xa03992){return client[_0xad4d('0x1')](_0xad4d('0x2'),{'body':_0xa03992,'log':_0xad4d('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 8aaac7f..723f0ee 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 _0xe60e=['name','timeout','User','online','mailPause','getMailQueues','../client','Request','GetMailQueue'];(function(_0x55f4a4,_0x20e524){var _0x2c453a=function(_0x1eb1e9){while(--_0x1eb1e9){_0x55f4a4['push'](_0x55f4a4['shift']());}};_0x2c453a(++_0x20e524);}(_0xe60e,0x8d));var _0xee60=function(_0x4d96d8,_0x31e935){_0x4d96d8=_0x4d96d8-0x0;var _0x43ed07=_0xe60e[_0x4d96d8];return _0x43ed07;};'use strict';var client=require(_0xee60('0x0'));exports['getMailQueues']=function(){return function(){return client[_0xee60('0x1')](_0xee60('0x2'),{'options':{'raw':![],'attributes':['id',_0xee60('0x3'),_0xee60('0x4'),'strategy'],'include':[{'model':_0xee60('0x5'),'as':'Agents','attributes':['id',_0xee60('0x3'),_0xee60('0x6'),_0xee60('0x7')]}]},'log':_0xee60('0x8')});};}; \ No newline at end of file +var _0x5a44=['name','strategy','Agents','online','mailPause','getMailQueues'];(function(_0x5df59f,_0xf11a72){var _0x190e3b=function(_0x2b983e){while(--_0x2b983e){_0x5df59f['push'](_0x5df59f['shift']());}};_0x190e3b(++_0xf11a72);}(_0x5a44,0xdd));var _0x45a4=function(_0x529c3a,_0x9db14a){_0x529c3a=_0x529c3a-0x0;var _0x34f4f8=_0x5a44[_0x529c3a];return _0x34f4f8;};'use strict';var client=require('../client');exports[_0x45a4('0x0')]=function(){return function(){return client['Request']('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x45a4('0x1'),'timeout',_0x45a4('0x2')],'include':[{'model':'User','as':_0x45a4('0x3'),'attributes':['id','name',_0x45a4('0x4'),_0x45a4('0x5')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index e4bb5ea..eff49c8 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 _0xa941=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','create'];(function(_0x2b20f2,_0x134796){var _0x46f2a9=function(_0x5c299c){while(--_0x5c299c){_0x2b20f2['push'](_0x2b20f2['shift']());}};_0x46f2a9(++_0x134796);}(_0xa941,0xa1));var _0x1a94=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa941[_0x122ef9];return _0x42fba0;};'use strict';var client=require('../client');exports[_0x1a94('0x0')]=function(_0x167f21){return client[_0x1a94('0x1')]('CreateMailQueueReport',{'body':_0x167f21,'log':_0x1a94('0x2')});};exports[_0x1a94('0x3')]=function(_0x747814,_0x3ce103){return client['Request'](_0x1a94('0x4'),{'body':_0x3ce103,'options':{'where':{'uniqueid':_0x747814},'order':[['id',_0x1a94('0x5')]],'limit':0x1},'log':_0x1a94('0x4')});}; \ No newline at end of file +var _0x54ab=['update','UpdateMailQueueReport','../client','Request','CreateMailQueueReport'];(function(_0x3494b6,_0x148cb5){var _0x280d79=function(_0x4e5db7){while(--_0x4e5db7){_0x3494b6['push'](_0x3494b6['shift']());}};_0x280d79(++_0x148cb5);}(_0x54ab,0x6b));var _0xb54a=function(_0x299e47,_0x2fb4a9){_0x299e47=_0x299e47-0x0;var _0x350101=_0x54ab[_0x299e47];return _0x350101;};'use strict';var client=require(_0xb54a('0x0'));exports['create']=function(_0x37e2d6){return client[_0xb54a('0x1')](_0xb54a('0x2'),{'body':_0x37e2d6,'log':_0xb54a('0x2')});};exports[_0xb54a('0x3')]=function(_0x11543a,_0x5dfbd6){return client[_0xb54a('0x1')](_0xb54a('0x4'),{'body':_0x5dfbd6,'options':{'where':{'uniqueid':_0x11543a},'order':[['id','DESC']],'limit':0x1},'log':_0xb54a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 3ea5d8f..72f5171 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 _0xcc83=['addTagsToChatInteraction','../client','update','addTags','Request'];(function(_0x3572ca,_0x128844){var _0x410d60=function(_0x115fa9){while(--_0x115fa9){_0x3572ca['push'](_0x3572ca['shift']());}};_0x410d60(++_0x128844);}(_0xcc83,0xce));var _0x3cc8=function(_0x906e88,_0x2b5046){_0x906e88=_0x906e88-0x0;var _0x551acb=_0xcc83[_0x906e88];return _0x551acb;};'use strict';var client=require(_0x3cc8('0x0'));exports[_0x3cc8('0x1')]=function(_0x47d8fd,_0x100a37){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x100a37,'options':{'where':{'id':_0x47d8fd}},'log':'updateOpenchannelInteraction'});};exports[_0x3cc8('0x2')]=function(_0x25b133,_0x2eeb08){return client[_0x3cc8('0x3')]('AddTagsToOpenchannelInteraction',{'body':_0x2eeb08,'options':{'where':{'id':_0x25b133}},'log':_0x3cc8('0x4')});}; \ No newline at end of file +var _0x5041=['addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x5bbe5e,_0x126136){var _0x1bbe9e=function(_0x5585d0){while(--_0x5585d0){_0x5bbe5e['push'](_0x5bbe5e['shift']());}};_0x1bbe9e(++_0x126136);}(_0x5041,0xb3));var _0x1504=function(_0x204075,_0xea2000){_0x204075=_0x204075-0x0;var _0x45ec97=_0x5041[_0x204075];return _0x45ec97;};'use strict';var client=require(_0x1504('0x0'));exports[_0x1504('0x1')]=function(_0x1ba8de,_0x403584){return client[_0x1504('0x2')](_0x1504('0x3'),{'body':_0x403584,'options':{'where':{'id':_0x1ba8de}},'log':_0x1504('0x4')});};exports[_0x1504('0x5')]=function(_0x521ae8,_0x467443){return client[_0x1504('0x2')](_0x1504('0x6'),{'body':_0x467443,'options':{'where':{'id':_0x521ae8}},'log':_0x1504('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index b3c24d1..1ed3b50 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 _0xbc9a=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create'];(function(_0x528fe7,_0x2948ec){var _0x282b9d=function(_0x1a3cbc){while(--_0x1a3cbc){_0x528fe7['push'](_0x528fe7['shift']());}};_0x282b9d(++_0x2948ec);}(_0xbc9a,0xa2));var _0xabc9=function(_0x37d317,_0x46dcc1){_0x37d317=_0x37d317-0x0;var _0x2c757f=_0xbc9a[_0x37d317];return _0x2c757f;};'use strict';var client=require(_0xabc9('0x0'));exports[_0xabc9('0x1')]=function(_0x464ab6){return client['Request'](_0xabc9('0x2'),{'body':_0x464ab6,'log':_0xabc9('0x3')});}; \ No newline at end of file +var _0x4c60=['CreateOpenchannelMessage','../client','create'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x4c60,0x8b));var _0x04c6=function(_0x292ae6,_0x20fb69){_0x292ae6=_0x292ae6-0x0;var _0x19c67e=_0x4c60[_0x292ae6];return _0x19c67e;};'use strict';var client=require(_0x04c6('0x0'));exports[_0x04c6('0x1')]=function(_0x3fafac){return client['Request'](_0x04c6('0x2'),{'body':_0x3fafac,'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 e801bb2..8b1e5ef 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 _0x8c77=['Agents','../client','GetOpenchannelQueue','name','timeout','User'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8c77,0xcd));var _0x78c7=function(_0x38a60b,_0x744abf){_0x38a60b=_0x38a60b-0x0;var _0x2ff5ca=_0x8c77[_0x38a60b];return _0x2ff5ca;};'use strict';var client=require(_0x78c7('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client['Request'](_0x78c7('0x1'),{'options':{'raw':![],'attributes':['id',_0x78c7('0x2'),_0x78c7('0x3'),'strategy'],'include':[{'model':_0x78c7('0x4'),'as':_0x78c7('0x5'),'attributes':['id','name','online','openchannelPause']}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0xd749=['Agents','name','online','getOpenchannelQueues','../client','Request','GetOpenchannelQueue','timeout','strategy','User'];(function(_0x456fc1,_0x5e289d){var _0x35587a=function(_0x753883){while(--_0x753883){_0x456fc1['push'](_0x456fc1['shift']());}};_0x35587a(++_0x5e289d);}(_0xd749,0x180));var _0x9d74=function(_0x187f74,_0x41daca){_0x187f74=_0x187f74-0x0;var _0x42c511=_0xd749[_0x187f74];return _0x42c511;};'use strict';var client=require(_0x9d74('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x9d74('0x1')](_0x9d74('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x9d74('0x3'),_0x9d74('0x4')],'include':[{'model':_0x9d74('0x5'),'as':_0x9d74('0x6'),'attributes':['id',_0x9d74('0x7'),_0x9d74('0x8'),'openchannelPause']}]},'log':_0x9d74('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 10cf656..2566d78 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 _0x4c48=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','Request'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x4c48,0x1e4));var _0x84c4=function(_0x421cf8,_0x23152c){_0x421cf8=_0x421cf8-0x0;var _0x145c48=_0x4c48[_0x421cf8];return _0x145c48;};'use strict';var client=require('../client');exports['create']=function(_0x6a2824){return client[_0x84c4('0x0')](_0x84c4('0x1'),{'body':_0x6a2824,'log':_0x84c4('0x1')});};exports[_0x84c4('0x2')]=function(_0x5524db,_0x5302e8){return client[_0x84c4('0x0')](_0x84c4('0x3'),{'body':_0x5302e8,'options':{'where':{'uniqueid':_0x5524db},'order':[['id',_0x84c4('0x4')]],'limit':0x1},'log':_0x84c4('0x3')});}; \ No newline at end of file +var _0xa4ad=['UpdateOpenchannelQueueReport','DESC','../client','Request','CreateOpenchannelQueueReport','update'];(function(_0x327710,_0x16f921){var _0x357f9c=function(_0xc0ce3d){while(--_0xc0ce3d){_0x327710['push'](_0x327710['shift']());}};_0x357f9c(++_0x16f921);}(_0xa4ad,0x80));var _0xda4a=function(_0x1e4a8e,_0x18022b){_0x1e4a8e=_0x1e4a8e-0x0;var _0x5408f9=_0xa4ad[_0x1e4a8e];return _0x5408f9;};'use strict';var client=require(_0xda4a('0x0'));exports['create']=function(_0x35df20){return client[_0xda4a('0x1')](_0xda4a('0x2'),{'body':_0x35df20,'log':_0xda4a('0x2')});};exports[_0xda4a('0x3')]=function(_0x99d008,_0x4c32b3){return client['Request'](_0xda4a('0x4'),{'body':_0x4c32b3,'options':{'where':{'uniqueid':_0x99d008},'order':[['id',_0xda4a('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 0bb2b6b..1ee74fb 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 _0xab3f=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','Request','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xab3f,0x72));var _0xfab3=function(_0x35468b,_0x4f6083){_0x35468b=_0x35468b-0x0;var _0x45ab9a=_0xab3f[_0x35468b];return _0x45ab9a;};'use strict';var client=require(_0xfab3('0x0'));exports['update']=function(_0x2a6f4b,_0x2b1bc5){return client[_0xfab3('0x1')](_0xfab3('0x2'),{'body':_0x2b1bc5,'options':{'where':{'id':_0x2a6f4b}},'log':_0xfab3('0x3')});};exports[_0xfab3('0x4')]=function(_0x394308,_0x4387f8){return client[_0xfab3('0x1')](_0xfab3('0x5'),{'body':_0x4387f8,'options':{'where':{'id':_0x394308}},'log':_0xfab3('0x6')});}; \ No newline at end of file +var _0xdad2=['AddTagsToSmsInteraction','addTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x41a222,_0x32f0ae){var _0x4805a5=function(_0x56dae3){while(--_0x56dae3){_0x41a222['push'](_0x41a222['shift']());}};_0x4805a5(++_0x32f0ae);}(_0xdad2,0x14c));var _0x2dad=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xdad2[_0x42cae2];return _0x5f256f;};'use strict';var client=require('../client');exports[_0x2dad('0x0')]=function(_0x1e2007,_0x5a35a1){return client[_0x2dad('0x1')](_0x2dad('0x2'),{'body':_0x5a35a1,'options':{'where':{'id':_0x1e2007}},'log':_0x2dad('0x3')});};exports['addTags']=function(_0x3212a5,_0x1437b9){return client['Request'](_0x2dad('0x4'),{'body':_0x1437b9,'options':{'where':{'id':_0x3212a5}},'log':_0x2dad('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 585b59f..36712ba 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 _0xafbe=['createSmsMessage','create','Request'];(function(_0x2824f6,_0x380bae){var _0x559287=function(_0x7cc2d7){while(--_0x7cc2d7){_0x2824f6['push'](_0x2824f6['shift']());}};_0x559287(++_0x380bae);}(_0xafbe,0x17e));var _0xeafb=function(_0x302d1a,_0x387081){_0x302d1a=_0x302d1a-0x0;var _0xd82ca=_0xafbe[_0x302d1a];return _0xd82ca;};'use strict';var client=require('../client');exports[_0xeafb('0x0')]=function(_0x589fe8){return client[_0xeafb('0x1')]('CreateSmsMessage',{'body':_0x589fe8,'log':_0xeafb('0x2')});}; \ No newline at end of file +var _0x22ea=['CreateSmsMessage','createSmsMessage','Request'];(function(_0x2d87ab,_0x277d52){var _0xb7f540=function(_0x1c6314){while(--_0x1c6314){_0x2d87ab['push'](_0x2d87ab['shift']());}};_0xb7f540(++_0x277d52);}(_0x22ea,0x14c));var _0xa22e=function(_0x3d08e4,_0x32e331){_0x3d08e4=_0x3d08e4-0x0;var _0x382644=_0x22ea[_0x3d08e4];return _0x382644;};'use strict';var client=require('../client');exports['create']=function(_0x314346){return client[_0xa22e('0x0')](_0xa22e('0x1'),{'body':_0x314346,'log':_0xa22e('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index cce4df8..24e1dbc 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x1d81d5,_0x49dfdc){var _0x14fb98=function(_0x1204c9){while(--_0x1204c9){_0x1d81d5['push'](_0x1d81d5['shift']());}};_0x14fb98(++_0x49dfdc);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x36436d,_0x20292c){_0x36436d=_0x36436d-0x0;var _0x34615d=_0xcb91[_0x36436d];return _0x34615d;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x3b104b,_0x59f421){var _0x377827=function(_0x44617d){while(--_0x44617d){_0x3b104b['push'](_0x3b104b['shift']());}};_0x377827(++_0x59f421);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1b745b,_0x3e2d40){_0x1b745b=_0x1b745b-0x0;var _0x120a9d=_0xcb91[_0x1b745b];return _0x120a9d;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 9ccf48a..d959f9c 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 _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x3f9480,_0x4ead6b){var _0x2a616d=function(_0x567cfb){while(--_0x567cfb){_0x3f9480['push'](_0x3f9480['shift']());}};_0x2a616d(++_0x4ead6b);}(_0x70e0,0x17b));var _0x070e=function(_0x21042d,_0x155df2){_0x21042d=_0x21042d-0x0;var _0x168f79=_0x70e0[_0x21042d];return _0x168f79;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file +var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x313b29,_0x297352){var _0x36c4ff=function(_0x5046c9){while(--_0x5046c9){_0x313b29['push'](_0x313b29['shift']());}};_0x36c4ff(++_0x297352);}(_0x55ca,0x126));var _0xa55c=function(_0x4f1651,_0xc4ac4f){_0x4f1651=_0x4f1651-0x0;var _0x44868e=_0x55ca[_0x4f1651];return _0x44868e;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 46dbe95..ef48e5c 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(_0x33d25a,_0x5c4416){var _0x3ad46a=function(_0x503c4c){while(--_0x503c4c){_0x33d25a['push'](_0x33d25a['shift']());}};_0x3ad46a(++_0x5c4416);}(_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 +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x38646c,_0xc6ec4b){var _0x356872=function(_0x86ab45){while(--_0x86ab45){_0x38646c['push'](_0x38646c['shift']());}};_0x356872(++_0xc6ec4b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 6317966..54db7bc 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 _0x81c6=['update','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x913581,_0x59fd75){var _0x5b695a=function(_0x5b4919){while(--_0x5b4919){_0x913581['push'](_0x913581['shift']());}};_0x5b695a(++_0x59fd75);}(_0x81c6,0x1d5));var _0x681c=function(_0x5ad00b,_0x22c334){_0x5ad00b=_0x5ad00b-0x0;var _0x2aab79=_0x81c6[_0x5ad00b];return _0x2aab79;};'use strict';var client=require('../client');exports[_0x681c('0x0')]=function(_0x5e54d4,_0x59c03c){return client['Request'](_0x681c('0x1'),{'body':_0x59c03c,'options':{'where':{'id':_0x5e54d4}},'log':_0x681c('0x2')});};exports[_0x681c('0x3')]=function(_0x5566e5,_0x44c18e){return client[_0x681c('0x4')](_0x681c('0x5'),{'body':_0x44c18e,'options':{'where':{'id':_0x5566e5}},'log':_0x681c('0x6')});}; \ No newline at end of file +var _0x5b47=['addTags','Request','AddTagsToWhatsappInteraction','../client','update'];(function(_0x335391,_0x1984f8){var _0x4fadee=function(_0x5930cd){while(--_0x5930cd){_0x335391['push'](_0x335391['shift']());}};_0x4fadee(++_0x1984f8);}(_0x5b47,0x120));var _0x75b4=function(_0x1e00cd,_0xef8cab){_0x1e00cd=_0x1e00cd-0x0;var _0x1e9b71=_0x5b47[_0x1e00cd];return _0x1e9b71;};'use strict';var client=require(_0x75b4('0x0'));exports[_0x75b4('0x1')]=function(_0x5ee71e,_0x5c0b0c){return client['Request']('UpdateWhatsappInteraction',{'body':_0x5c0b0c,'options':{'where':{'id':_0x5ee71e}},'log':'updateWhatsappInteraction'});};exports[_0x75b4('0x2')]=function(_0x42359f,_0x37497c){return client[_0x75b4('0x3')](_0x75b4('0x4'),{'body':_0x37497c,'options':{'where':{'id':_0x42359f}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 16761da..6056579 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 _0x5f8f=['createWhatsappMessage','create'];(function(_0x374954,_0x18dc36){var _0x42073e=function(_0x1cb45f){while(--_0x1cb45f){_0x374954['push'](_0x374954['shift']());}};_0x42073e(++_0x18dc36);}(_0x5f8f,0x1cd));var _0xf5f8=function(_0x3bd9f7,_0x184d25){_0x3bd9f7=_0x3bd9f7-0x0;var _0x46a7ba=_0x5f8f[_0x3bd9f7];return _0x46a7ba;};'use strict';var client=require('../client');exports[_0xf5f8('0x0')]=function(_0xcf1197){return client['Request']('CreateWhatsappMessage',{'body':_0xcf1197,'log':_0xf5f8('0x1')});}; \ No newline at end of file +var _0xc3f9=['create','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x2d1971,_0x20b764){var _0x4d7759=function(_0x56a550){while(--_0x56a550){_0x2d1971['push'](_0x2d1971['shift']());}};_0x4d7759(++_0x20b764);}(_0xc3f9,0x13e));var _0x9c3f=function(_0x512aa4,_0x319dd2){_0x512aa4=_0x512aa4-0x0;var _0x2d0204=_0xc3f9[_0x512aa4];return _0x2d0204;};'use strict';var client=require('../client');exports[_0x9c3f('0x0')]=function(_0x3398a8){return client['Request'](_0x9c3f('0x1'),{'body':_0x3398a8,'log':_0x9c3f('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 127d7ea..70384d5 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 _0x4635=['getWhatsappQueues','Request','GetWhatsappQueue','timeout','strategy','User','Agents','online'];(function(_0x4c6d19,_0x149f70){var _0x40b6c7=function(_0x258143){while(--_0x258143){_0x4c6d19['push'](_0x4c6d19['shift']());}};_0x40b6c7(++_0x149f70);}(_0x4635,0xd0));var _0x5463=function(_0x254be3,_0x3baf49){_0x254be3=_0x254be3-0x0;var _0x2f3361=_0x4635[_0x254be3];return _0x2f3361;};'use strict';var client=require('../client');exports[_0x5463('0x0')]=function(){return function(){return client[_0x5463('0x1')](_0x5463('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x5463('0x3'),_0x5463('0x4')],'include':[{'model':_0x5463('0x5'),'as':_0x5463('0x6'),'attributes':['id','name',_0x5463('0x7'),'whatsappPause']}]},'log':_0x5463('0x0')});};}; \ No newline at end of file +var _0x1e1f=['strategy','User','online','getWhatsappQueues','../client','Request','name','timeout'];(function(_0x25e01f,_0x159194){var _0x51b4f9=function(_0xfbceb0){while(--_0xfbceb0){_0x25e01f['push'](_0x25e01f['shift']());}};_0x51b4f9(++_0x159194);}(_0x1e1f,0x8c));var _0xf1e1=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1e1f[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0xf1e1('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0xf1e1('0x1')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xf1e1('0x2'),_0xf1e1('0x3'),_0xf1e1('0x4')],'include':[{'model':_0xf1e1('0x5'),'as':'Agents','attributes':['id','name',_0xf1e1('0x6'),'whatsappPause']}]},'log':_0xf1e1('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 84c02c0..a991087 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 _0xab11=['UpdateWhatsappQueueReport','create','CreateWhatsappQueueReport','Request'];(function(_0x178619,_0x8acdca){var _0x5d16a0=function(_0x3092e3){while(--_0x3092e3){_0x178619['push'](_0x178619['shift']());}};_0x5d16a0(++_0x8acdca);}(_0xab11,0x10d));var _0x1ab1=function(_0x49be97,_0x3dbc43){_0x49be97=_0x49be97-0x0;var _0x3b16be=_0xab11[_0x49be97];return _0x3b16be;};'use strict';var client=require('../client');exports[_0x1ab1('0x0')]=function(_0x1265e0){return client['Request'](_0x1ab1('0x1'),{'body':_0x1265e0,'log':_0x1ab1('0x1')});};exports['update']=function(_0x2c9c38,_0x4630ea){return client[_0x1ab1('0x2')](_0x1ab1('0x3'),{'body':_0x4630ea,'options':{'where':{'uniqueid':_0x2c9c38},'order':[['id','DESC']],'limit':0x1},'log':_0x1ab1('0x3')});}; \ No newline at end of file +var _0x4c21=['UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport','update'];(function(_0x6f0911,_0x5721c6){var _0x48cf3b=function(_0x3ab401){while(--_0x3ab401){_0x6f0911['push'](_0x6f0911['shift']());}};_0x48cf3b(++_0x5721c6);}(_0x4c21,0x17c));var _0x14c2=function(_0x53b93b,_0x1bfab1){_0x53b93b=_0x53b93b-0x0;var _0x485761=_0x4c21[_0x53b93b];return _0x485761;};'use strict';var client=require(_0x14c2('0x0'));exports[_0x14c2('0x1')]=function(_0x2e2ade){return client[_0x14c2('0x2')](_0x14c2('0x3'),{'body':_0x2e2ade,'log':_0x14c2('0x3')});};exports[_0x14c2('0x4')]=function(_0x4cb982,_0x1c8348){return client[_0x14c2('0x2')](_0x14c2('0x5'),{'body':_0x1c8348,'options':{'where':{'uniqueid':_0x4cb982},'order':[['id',_0x14c2('0x6')]],'limit':0x1},'log':_0x14c2('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 4fc6030..5c4c468 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 _0x0476=['timeout\x20is\x20a\x20number','info','format','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x54559f,_0x36cfe5){var _0x13dbe7=function(_0x21b576){while(--_0x21b576){_0x54559f['push'](_0x54559f['shift']());}};_0x13dbe7(++_0x36cfe5);}(_0x0476,0x184));var _0x6047=function(_0x17b0d4,_0x377add){_0x17b0d4=_0x17b0d4-0x0;var _0x2d02c7=_0x0476[_0x17b0d4];return _0x2d02c7;};'use strict';var schema=require(_0x6047('0x0'));var _=require(_0x6047('0x1'));var util=require(_0x6047('0x2'));var seqqueue=require(_0x6047('0x3'));var logger=require('../../../../config/logger')(_0x6047('0x4'));var strategy=require(_0x6047('0x5'));var queue=schema({'name':{'type':_0x6047('0x6'),'required':!![],'message':_0x6047('0x7')},'timeout':{'type':'number','message':_0x6047('0x8')}});function writeLog(_0x44287d,_0x526015,_0x322975){return logger[_0x6047('0x9')](util[_0x6047('0xa')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x44287d,_0x526015[_0x6047('0xb')],_0x322975));}function handleFindAgent(_0x464501){return function(_0x3f4067){return _0x3f4067[_0x6047('0xb')][_0x6047('0xc')]()===_0x464501[_0x6047('0xc')]();};}exports[_0x6047('0xd')]=function(_0x49feed,_0x5abf9b,_0x110520,_0x2df906){return function(_0x24fed4){try{var _0x348918={'name':_0x5abf9b[0x0],'timeout':_0x5abf9b[0x1]};var _0x4409d3=queue[_0x6047('0x0')](_0x348918,{'typecast':!![]});if(_0x4409d3[_0x6047('0xe')]){logger[_0x6047('0xf')](_0x6047('0x10'),_0x49feed,_[_0x6047('0x11')](_0x4409d3,'message')['join'](',\x20'));_0x24fed4[_0x6047('0x12')]();}else{var _0x297b81=_[_0x6047('0x13')](_0x110520[_0x6047('0x14')],handleFindAgent(_0x348918[_0x6047('0xb')]));if(_0x297b81){var _0x22678b=(_0x348918[_0x6047('0x15')]||0xa)*0x3e8;var _0xb35add,_0x4b3a70;var _0x57c2c0=seqqueue[_0x6047('0x16')](_0x22678b);_0x57c2c0['id']=_0x49feed;_0x57c2c0[_0x6047('0x17')]=_0x22678b;_0x57c2c0[_0x6047('0x18')]=_0x2df906['channel'];writeLog(_0x49feed,_0x297b81,util[_0x6047('0xa')](_0x6047('0x19'),_0x22678b));_0x110520[_0x6047('0x1a')][_0x49feed]['on'](_0x6047('0x1b'),function(){logger[_0x6047('0x9')](_0x6047('0x1c'),_0x49feed);clearTimeout(_0x4b3a70);_0x4b3a70=undefined;_0x57c2c0[_0x6047('0x1d')]();if(_0x110520[_0x6047('0x1a')][_0x49feed]){delete _0x110520[_0x6047('0x1a')][_0x49feed];}_0x24fed4[_0x6047('0x12')]();});_0x110520[_0x6047('0x1a')][_0x49feed]['on'](_0x6047('0x1e'),function(){if(_0x110520[_0x6047('0x1a')][_0x49feed]){delete _0x110520[_0x6047('0x1a')][_0x49feed];}});_0x4b3a70=setTimeout(function(){logger[_0x6047('0x9')](_0x6047('0x1f'),_0x49feed);clearTimeout(_0x4b3a70);_0x57c2c0['close']();_0x24fed4[_0x6047('0x20')]();},_0x22678b);strategy['agent'](_0x57c2c0,_0x297b81,_0x110520,_0x2df906);}else{logger[_0x6047('0xf')](_0x6047('0x21'),_0x49feed,_0x348918[_0x6047('0xb')]);_0x24fed4[_0x6047('0x12')]();}}}catch(_0x38a7e9){console['log'](_0x38a7e9);logger[_0x6047('0xf')](_0x6047('0x22'),_0x49feed,_0x38a7e9[_0x6047('0x23')]);_0x24fed4[_0x6047('0x12')]();}};}; \ No newline at end of file +var _0xb6c2=['consequence','length','error','map','message','join','stop','find','timeout','createQueue','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','name','toLowerCase'];(function(_0x4e697a,_0x56a14b){var _0x88850c=function(_0x4e368a){while(--_0x4e368a){_0x4e697a['push'](_0x4e697a['shift']());}};_0x88850c(++_0x56a14b);}(_0xb6c2,0x182));var _0x2b6c=function(_0x4ff79e,_0x5ed3d5){_0x4ff79e=_0x4ff79e-0x0;var _0x38061f=_0xb6c2[_0x4ff79e];return _0x38061f;};'use strict';var schema=require(_0x2b6c('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')(_0x2b6c('0x1'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x2b6c('0x2'),'required':!![],'message':_0x2b6c('0x3')},'timeout':{'type':_0x2b6c('0x4'),'message':_0x2b6c('0x5')}});function writeLog(_0x869d5c,_0x1182c1,_0x9c7d6d){return logger[_0x2b6c('0x6')](util[_0x2b6c('0x7')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x869d5c,_0x1182c1[_0x2b6c('0x8')],_0x9c7d6d));}function handleFindAgent(_0x3e7cb4){return function(_0x7b7f07){return _0x7b7f07[_0x2b6c('0x8')][_0x2b6c('0x9')]()===_0x3e7cb4[_0x2b6c('0x9')]();};}exports[_0x2b6c('0xa')]=function(_0x3a12a0,_0x2aedb8,_0x3929ee,_0x1e64e9){return function(_0x522b3e){try{var _0x3b4295={'name':_0x2aedb8[0x0],'timeout':_0x2aedb8[0x1]};var _0x9936db=queue[_0x2b6c('0x0')](_0x3b4295,{'typecast':!![]});if(_0x9936db[_0x2b6c('0xb')]){logger[_0x2b6c('0xc')]('[%s][AGENT]\x20%s',_0x3a12a0,_[_0x2b6c('0xd')](_0x9936db,_0x2b6c('0xe'))[_0x2b6c('0xf')](',\x20'));_0x522b3e[_0x2b6c('0x10')]();}else{var _0x5bb187=_[_0x2b6c('0x11')](_0x3929ee['agents'],handleFindAgent(_0x3b4295[_0x2b6c('0x8')]));if(_0x5bb187){var _0x3c6249=(_0x3b4295[_0x2b6c('0x12')]||0xa)*0x3e8;var _0x1ae8a7,_0x3fcc01;var _0x4ad53f=seqqueue[_0x2b6c('0x13')](_0x3c6249);_0x4ad53f['id']=_0x3a12a0;_0x4ad53f['atimeout']=_0x3c6249;_0x4ad53f[_0x2b6c('0x14')]=_0x1e64e9[_0x2b6c('0x14')];writeLog(_0x3a12a0,_0x5bb187,util[_0x2b6c('0x7')](_0x2b6c('0x15'),_0x3c6249));_0x3929ee[_0x2b6c('0x16')][_0x3a12a0]['on'](_0x2b6c('0x17'),function(){logger['info'](_0x2b6c('0x18'),_0x3a12a0);clearTimeout(_0x3fcc01);_0x3fcc01=undefined;_0x4ad53f[_0x2b6c('0x19')]();if(_0x3929ee[_0x2b6c('0x16')][_0x3a12a0]){delete _0x3929ee[_0x2b6c('0x16')][_0x3a12a0];}_0x522b3e[_0x2b6c('0x10')]();});_0x3929ee[_0x2b6c('0x16')][_0x3a12a0]['on'](_0x2b6c('0x1a'),function(){if(_0x3929ee['rules'][_0x3a12a0]){delete _0x3929ee['rules'][_0x3a12a0];}});_0x3fcc01=setTimeout(function(){logger[_0x2b6c('0x6')](_0x2b6c('0x1b'),_0x3a12a0);clearTimeout(_0x3fcc01);_0x4ad53f[_0x2b6c('0x19')]();_0x522b3e[_0x2b6c('0x1c')]();},_0x3c6249);strategy[_0x2b6c('0x1d')](_0x4ad53f,_0x5bb187,_0x3929ee,_0x1e64e9);}else{logger[_0x2b6c('0xc')](_0x2b6c('0x1e'),_0x3a12a0,_0x3b4295['name']);_0x522b3e[_0x2b6c('0x10')]();}}}catch(_0x56882f){console['log'](_0x56882f);logger[_0x2b6c('0xc')](_0x2b6c('0x1f'),_0x3a12a0,_0x56882f[_0x2b6c('0x20')]);_0x522b3e[_0x2b6c('0x10')]();}};}; \ 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 11ba7c3..fb2cca3 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 _0x826b=['InteractionId','created','isEmpty','body','getMustacheRender','create','then','catch','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','postText','error','amazonlex','providerName','providerResponse','dialogState','stringify','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','AccountId','account'];(function(_0x415275,_0x180e37){var _0x3a65b7=function(_0x459d26){while(--_0x459d26){_0x415275['push'](_0x415275['shift']());}};_0x3a65b7(++_0x180e37);}(_0x826b,0x18d));var _0xb826=function(_0xc4e346,_0x4fdcf4){_0xc4e346=_0xc4e346-0x0;var _0x2c60ac=_0x826b[_0xc4e346];return _0x2c60ac;};'use strict';var _=require(_0xb826('0x0'));var moment=require(_0xb826('0x1'));var AWS=require('aws-sdk');var utils=require(_0xb826('0x2'));var logger=require(_0xb826('0x3'))('routing');var rpc={'chatMessage':require(_0xb826('0x4')),'openchannelMessage':require(_0xb826('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xb826('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xb826('0x7'))};exports[_0xb826('0x8')]=function(_0x263994,_0x16a7c1){return function(_0x58b80d){try{if(!_[_0xb826('0x9')](this[_0xb826('0xa')][_0xb826('0xb')])){logger[_0xb826('0xc')](_0xb826('0xd'),_0x263994,_0xb826('0xe'));return _0x58b80d[_0xb826('0xf')]();}var _0x59cf5a={'ContactId':this[_0xb826('0x10')]['id'],'sentAt':moment()['format'](_0xb826('0x11')),'direction':_0xb826('0x12')};if(this['channel']==='sms'||this[_0xb826('0x13')]===_0xb826('0x14')){_0x59cf5a[_0xb826('0x15')]=this['interaction'][_0xb826('0x15')];}var _0x384dc8=this[_0xb826('0x13')];if(_0x384dc8===_0xb826('0x16')){_0x59cf5a[_0xb826('0x17')]=this['account']['id'];}else{_0x59cf5a[_['upperFirst'](_0x384dc8)+_0xb826('0x18')]=this[_0xb826('0x19')]['id'];}_0x59cf5a[_['upperFirst'](_0x384dc8)+_0xb826('0x1a')]=this[_0xb826('0xa')]['id'];if(this['interaction'][_0xb826('0x1b')]){var _0x1284a5=_0x16a7c1[0x4];if(!_[_0xb826('0x1c')](_0x1284a5)){_0x59cf5a[_0xb826('0x1d')]=utils[_0xb826('0x1e')](_0x1284a5,this);return rpc[_0x384dc8+'Message'][_0xb826('0x1f')](_0x59cf5a)[_0xb826('0x20')](function(_0xddd233){logger[_0xb826('0xc')]('[%s][AMAZONLEX]\x20%s',_0x263994,_0x59cf5a[_0xb826('0x1d')]);})[_0xb826('0x21')](function(_0x3a04ba){logger['error']('[%s][AMAZONLEX]\x20%s',_0x263994,JSON['stringify'](_0x3a04ba));})[_0xb826('0x22')](function(){logger[_0xb826('0xc')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x263994);_0x58b80d[_0xb826('0x23')]();});}else{logger['info'](_0xb826('0x24'),_0x263994);_0x58b80d[_0xb826('0x23')]();}}else{var _0xd05528=this;var _0x313ccd=new AWS[(_0xb826('0x25'))]({'accessKeyId':_0x16a7c1[0x0],'secretAccessKey':_0x16a7c1[0x1],'region':_0x16a7c1[0x2]});var _0xf043fe={'botAlias':_0xb826('0x26'),'botName':_0x16a7c1[0x3],'inputText':this[_0xb826('0x27')]['body'],'userId':this['channel']+':'+this[_0xb826('0xa')]['id']['toString']()};_0x313ccd[_0xb826('0x28')](_0xf043fe,function(_0x633627,_0xa5c4e8){if(_0x633627){logger[_0xb826('0x29')](_0xb826('0xd'),_0x263994,_0x633627['message']);_0x58b80d[_0xb826('0xf')]();}else if(_0xa5c4e8&&_0xa5c4e8['message']){_0xd05528[_0xb826('0x1d')][_0xb826('0x2a')]=_0xa5c4e8;_0x59cf5a[_0xb826('0x1d')]=_0xa5c4e8[_0xb826('0x27')];_0x59cf5a[_0xb826('0x2b')]=_0xb826('0x2a');_0x59cf5a[_0xb826('0x2c')]=JSON['stringify'](_0xa5c4e8);return rpc[_0x384dc8+'Message'][_0xb826('0x1f')](_0x59cf5a)[_0xb826('0x20')](function(_0x5d3c10){logger[_0xb826('0xc')](_0xb826('0xd'),_0x263994,_0x59cf5a[_0xb826('0x1d')]);if(_0xa5c4e8[_0xb826('0x2d')]=='Failed'){_0x58b80d[_0xb826('0xf')]();}else{_0x58b80d[_0xb826('0x23')]();}})[_0xb826('0x21')](function(_0x15d755){logger[_0xb826('0x29')](_0xb826('0xd'),_0x263994,JSON[_0xb826('0x2e')](_0x15d755));_0x58b80d[_0xb826('0xf')]();});}else{_0x58b80d['next']();}});}}catch(_0x4e31fa){logger[_0xb826('0x29')](_0xb826('0xd'),_0x263994,JSON['stringify'](_0x4e31fa));_0x58b80d[_0xb826('0x23')]();}};}; \ No newline at end of file +var _0xdae7=['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','$LATEST','toString','postText','message','providerName','amazonlex','then','dialogState','aws-sdk','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','getMustacheRender','Message','create','[%s][AMAZONLEX]\x20%s','body','catch'];(function(_0x28e627,_0x3dd237){var _0xc6bfda=function(_0x127dbc){while(--_0x127dbc){_0x28e627['push'](_0x28e627['shift']());}};_0xc6bfda(++_0x3dd237);}(_0xdae7,0x142));var _0x7dae=function(_0x435b2f,_0x4c44da){_0x435b2f=_0x435b2f-0x0;var _0x181648=_0xdae7[_0x435b2f];return _0x181648;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require(_0x7dae('0x0'));var utils=require('./utils');var logger=require(_0x7dae('0x1'))('routing');var rpc={'chatMessage':require(_0x7dae('0x2')),'openchannelMessage':require(_0x7dae('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x7dae('0x4')),'faxMessage':require(_0x7dae('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x5154fd,_0x9b1be7){return function(_0x140bb2){try{if(!_['isNil'](this[_0x7dae('0x6')][_0x7dae('0x7')])){logger[_0x7dae('0x8')]('[%s][AMAZONLEX]\x20%s',_0x5154fd,_0x7dae('0x9'));return _0x140bb2[_0x7dae('0xa')]();}var _0x4fc515={'ContactId':this['contact']['id'],'sentAt':moment()[_0x7dae('0xb')](_0x7dae('0xc')),'direction':'out'};if(this[_0x7dae('0xd')]===_0x7dae('0xe')||this[_0x7dae('0xd')]===_0x7dae('0xf')){_0x4fc515[_0x7dae('0x10')]=this[_0x7dae('0x6')]['phone'];}var _0x50128f=this[_0x7dae('0xd')];if(_0x50128f===_0x7dae('0x11')){_0x4fc515[_0x7dae('0x12')]=this[_0x7dae('0x13')]['id'];}else{_0x4fc515[_[_0x7dae('0x14')](_0x50128f)+'AccountId']=this[_0x7dae('0x13')]['id'];}_0x4fc515[_[_0x7dae('0x14')](_0x50128f)+_0x7dae('0x15')]=this[_0x7dae('0x6')]['id'];if(this[_0x7dae('0x6')][_0x7dae('0x16')]){var _0x3613c7=_0x9b1be7[0x4];if(!_[_0x7dae('0x17')](_0x3613c7)){_0x4fc515['body']=utils[_0x7dae('0x18')](_0x3613c7,this);return rpc[_0x50128f+_0x7dae('0x19')][_0x7dae('0x1a')](_0x4fc515)['then'](function(_0x1b732a){logger['info'](_0x7dae('0x1b'),_0x5154fd,_0x4fc515[_0x7dae('0x1c')]);})[_0x7dae('0x1d')](function(_0x299fcd){logger[_0x7dae('0x1e')]('[%s][AMAZONLEX]\x20%s',_0x5154fd,JSON[_0x7dae('0x1f')](_0x299fcd));})[_0x7dae('0x20')](function(){logger['info'](_0x7dae('0x21'),_0x5154fd);_0x140bb2['stop']();});}else{logger['info'](_0x7dae('0x22'),_0x5154fd);_0x140bb2[_0x7dae('0x23')]();}}else{var _0x540f9d=this;var _0x1d81dd=new AWS['LexRuntime']({'accessKeyId':_0x9b1be7[0x0],'secretAccessKey':_0x9b1be7[0x1],'region':_0x9b1be7[0x2]});var _0x40e0fc={'botAlias':_0x7dae('0x24'),'botName':_0x9b1be7[0x3],'inputText':this['message'][_0x7dae('0x1c')],'userId':this[_0x7dae('0xd')]+':'+this['interaction']['id'][_0x7dae('0x25')]()};_0x1d81dd[_0x7dae('0x26')](_0x40e0fc,function(_0x205c6b,_0x27c71a){if(_0x205c6b){logger['error'](_0x7dae('0x1b'),_0x5154fd,_0x205c6b[_0x7dae('0x27')]);_0x140bb2[_0x7dae('0xa')]();}else if(_0x27c71a&&_0x27c71a[_0x7dae('0x27')]){_0x540f9d[_0x7dae('0x1c')]['amazonlex']=_0x27c71a;_0x4fc515[_0x7dae('0x1c')]=_0x27c71a['message'];_0x4fc515[_0x7dae('0x28')]=_0x7dae('0x29');_0x4fc515['providerResponse']=JSON['stringify'](_0x27c71a);return rpc[_0x50128f+_0x7dae('0x19')]['create'](_0x4fc515)[_0x7dae('0x2a')](function(_0x5ba1d5){logger[_0x7dae('0x8')](_0x7dae('0x1b'),_0x5154fd,_0x4fc515[_0x7dae('0x1c')]);if(_0x27c71a[_0x7dae('0x2b')]=='Failed'){_0x140bb2[_0x7dae('0xa')]();}else{_0x140bb2[_0x7dae('0x23')]();}})[_0x7dae('0x1d')](function(_0x13d1ef){logger[_0x7dae('0x1e')](_0x7dae('0x1b'),_0x5154fd,JSON[_0x7dae('0x1f')](_0x13d1ef));_0x140bb2[_0x7dae('0xa')]();});}else{_0x140bb2[_0x7dae('0xa')]();}});}}catch(_0x4d17c2){logger['error'](_0x7dae('0x1b'),_0x5154fd,JSON[_0x7dae('0x1f')](_0x4d17c2));_0x140bb2[_0x7dae('0x23')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 145160e..263964d 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 _0x26d6=['create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','resolve','Interaction','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','update','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','created','Autoreply\x20already\x20sent','interaction','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','Message','messageId','html','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT'];(function(_0x1828a6,_0xc3cbcd){var _0x97447b=function(_0x341598){while(--_0x341598){_0x1828a6['push'](_0x1828a6['shift']());}};_0x97447b(++_0xc3cbcd);}(_0x26d6,0x11d));var _0x626d=function(_0x4d183d,_0x123de0){_0x4d183d=_0x4d183d-0x0;var _0x431236=_0x26d6[_0x4d183d];return _0x431236;};'use strict';var _=require(_0x626d('0x0'));var moment=require(_0x626d('0x1'));var utils=require(_0x626d('0x2'));var logger=require(_0x626d('0x3'))(_0x626d('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x626d('0x5')),'mailMessage':require(_0x626d('0x6')),'smsMessage':require(_0x626d('0x7')),'faxMessage':require(_0x626d('0x8')),'whatsappMessage':require(_0x626d('0x9')),'chatInteraction':require(_0x626d('0xa')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0x626d('0xb')),'whatsappInteraction':require(_0x626d('0xc'))};var mailRpc=require(_0x626d('0xd'));exports[_0x626d('0xe')]=function(_0x1dfe53,_0x1478d9,_0x55ea26,_0xef12c2){return function(_0x11a547){try{var _0x3392ba=this[_0x626d('0xf')];if(_0x3392ba===_0x626d('0x10')&&_0xef12c2[_0x626d('0x11')]['isAutoreply']){logger[_0x626d('0x12')](_0x626d('0x13'),_0x1dfe53,_0x626d('0x14'));return _0x11a547[_0x626d('0x15')]();}if(_0x1478d9[0x0]==='1'&&(_[_0x626d('0x16')](this['interaction'][_0x626d('0x17')])||!this['interaction']['created'])){logger['info'](_0x626d('0x13'),_0x1dfe53,_0x626d('0x18'));return _0x11a547[_0x626d('0x15')]();}if(_0x1478d9[0x0]==='2'&&this[_0x626d('0x19')][_0x626d('0x1a')]){logger[_0x626d('0x12')](_0x626d('0x1b'),_0x1dfe53,'One\x20Time\x20already\x20sent');return _0x11a547[_0x626d('0x15')]();}var _0x4311c5={'ContactId':this['contact']['id'],'sentAt':moment()[_0x626d('0x1c')](_0x626d('0x1d')),'direction':_0x626d('0x1e')};if(this[_0x626d('0xf')]===_0x626d('0x10')){_0x4311c5[_0x626d('0x11')]=utils[_0x626d('0x1f')](_0x1478d9[0x2],this);}else{_0x4311c5['body']=utils['getMustacheRender'](_0x1478d9[0x1],this);}if(this[_0x626d('0x20')]){_0x4311c5['to']=this[_0x626d('0x20')]['from']||'';if(this[_0x626d('0xf')]===_0x626d('0x10')&&_0x1478d9[0x1]==='1'){_0x4311c5['cc']=this[_0x626d('0x20')]['cc']||'';}_0x4311c5[_0x626d('0x21')]=this[_0x626d('0x20')]['to']||'';_0x4311c5[_0x626d('0x22')]=this['message'][_0x626d('0x22')]||'';_0x4311c5['read']=!![];if(this['message'][_0x626d('0x23')]){_0x4311c5[_0x626d('0x23')]='';_0x4311c5[_0x626d('0x23')]+=_[_0x626d('0x24')](this[_0x626d('0x20')][_0x626d('0x23')],_0x626d('0x25'))?'':_0x626d('0x26');_0x4311c5[_0x626d('0x23')]+=this[_0x626d('0x20')]['subject'];}}if(this['channel']===_0x626d('0x27')){_0x4311c5[_0x626d('0x28')]=this[_0x626d('0x29')]['id'];}else{_0x4311c5[_['upperFirst'](this[_0x626d('0xf')])+_0x626d('0x2a')]=this[_0x626d('0x29')]['id'];}_0x4311c5[_[_0x626d('0x2b')](this[_0x626d('0xf')])+_0x626d('0x2c')]=this[_0x626d('0x19')]['id'];var _0x473026=this[_0x626d('0x19')];if(rpc[this[_0x626d('0xf')]+_0x626d('0x2d')]){if(this[_0x626d('0xf')]===_0x626d('0x10')){_0x4311c5['inReplyTo']=this[_0x626d('0x20')][_0x626d('0x2e')];_0x4311c5[_0x626d('0x2f')]=_0x626d('0x30')+_[_0x626d('0x31')](_0x4311c5[_0x626d('0x11')],_0x626d('0x32'),'','','headers','auto-replied','auto_reply','sendMailMessage','smtpOptions','[%s][AUTOREPLY]\x20SMTP\x20SENT','then','stringify','error','finally','Interaction','update','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','resolve','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction','created','next','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','YYYY-MM-DD\x20HH:mm:ss','out','body','message','from','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId'];(function(_0x43b34a,_0x39f685){var _0x4d4b3b=function(_0x488b72){while(--_0x488b72){_0x43b34a['push'](_0x43b34a['shift']());}};_0x4d4b3b(++_0x39f685);}(_0x3077,0x131));var _0x7307=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x3077[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0x7307('0x0'));var moment=require(_0x7307('0x1'));var utils=require(_0x7307('0x2'));var logger=require(_0x7307('0x3'))(_0x7307('0x4'));var rpc={'chatMessage':require(_0x7307('0x5')),'openchannelMessage':require(_0x7307('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x7307('0x7')),'chatInteraction':require(_0x7307('0x8')),'openchannelInteraction':require(_0x7307('0x9')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x7307('0xa')),'faxInteraction':require(_0x7307('0xb')),'whatsappInteraction':require(_0x7307('0xc'))};var mailRpc=require(_0x7307('0xd'));exports[_0x7307('0xe')]=function(_0x1054c7,_0x3df8cf,_0x16052d,_0x5a101c){return function(_0x58b5af){try{var _0x2fecbd=this[_0x7307('0xf')];if(_0x2fecbd===_0x7307('0x10')&&_0x5a101c['body'][_0x7307('0x11')]){logger[_0x7307('0x12')](_0x7307('0x13'),_0x1054c7,_0x7307('0x14'));return _0x58b5af['next']();}if(_0x3df8cf[0x0]==='1'&&(_[_0x7307('0x15')](this[_0x7307('0x16')][_0x7307('0x17')])||!this[_0x7307('0x16')][_0x7307('0x17')])){logger['info'](_0x7307('0x13'),_0x1054c7,'Autoreply\x20already\x20sent');return _0x58b5af[_0x7307('0x18')]();}if(_0x3df8cf[0x0]==='2'&&this['interaction'][_0x7307('0x19')]){logger['info'](_0x7307('0x1a'),_0x1054c7,_0x7307('0x1b'));return _0x58b5af[_0x7307('0x18')]();}var _0x2ef016={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x7307('0x1c')),'direction':_0x7307('0x1d')};if(this['channel']==='mail'){_0x2ef016[_0x7307('0x1e')]=utils['getMustacheRender'](_0x3df8cf[0x2],this);}else{_0x2ef016['body']=utils['getMustacheRender'](_0x3df8cf[0x1],this);}if(this[_0x7307('0x1f')]){_0x2ef016['to']=this[_0x7307('0x1f')][_0x7307('0x20')]||'';if(this[_0x7307('0xf')]===_0x7307('0x10')&&_0x3df8cf[0x1]==='1'){_0x2ef016['cc']=this[_0x7307('0x1f')]['cc']||'';}_0x2ef016[_0x7307('0x20')]=this[_0x7307('0x1f')]['to']||'';_0x2ef016[_0x7307('0x21')]=this[_0x7307('0x1f')]['phone']||'';_0x2ef016[_0x7307('0x22')]=!![];if(this[_0x7307('0x1f')][_0x7307('0x23')]){_0x2ef016[_0x7307('0x23')]='';_0x2ef016['subject']+=_[_0x7307('0x24')](this['message']['subject'],'Re:')?'':_0x7307('0x25');_0x2ef016[_0x7307('0x23')]+=this[_0x7307('0x1f')]['subject'];}}if(this[_0x7307('0xf')]===_0x7307('0x26')){_0x2ef016[_0x7307('0x27')]=this['account']['id'];}else{_0x2ef016[_[_0x7307('0x28')](this['channel'])+_0x7307('0x29')]=this[_0x7307('0x2a')]['id'];}_0x2ef016[_[_0x7307('0x28')](this[_0x7307('0xf')])+_0x7307('0x2b')]=this['interaction']['id'];var _0x120e8f=this[_0x7307('0x16')];if(rpc[this[_0x7307('0xf')]+_0x7307('0x2c')]){if(this[_0x7307('0xf')]==='mail'){_0x2ef016[_0x7307('0x2d')]=this[_0x7307('0x1f')][_0x7307('0x2e')];_0x2ef016[_0x7307('0x2f')]=_0x7307('0x30')+_['replace'](_0x2ef016[_0x7307('0x1e')],_0x7307('0x31'),_0x7307('0x32'))+_0x7307('0x33');_0x2ef016[_0x7307('0x34')]={'Auto-Submitted':_0x7307('0x35'),'X-Auto-Response-Suppress':'All','Precedence':_0x7307('0x36')};return mailRpc[_0x7307('0x37')](this[_0x7307('0x2a')][_0x7307('0x38')],_0x2ef016)['then'](function(_0x58e9e9){logger[_0x7307('0x12')](_0x7307('0x39'),_0x1054c7);_0x2ef016['messageId']=_0x58e9e9[_0x7307('0x1f')]['messageId'];return rpc[_0x2fecbd+_0x7307('0x2c')]['create'](_0x2ef016);})[_0x7307('0x3a')](function(_0x4a6619){logger['info'](_0x7307('0x13'),_0x1054c7,JSON[_0x7307('0x3b')](_0x4a6619));})['catch'](function(_0x4b2de2){logger[_0x7307('0x3c')]('[RPC][%s][AUTOREPLY]\x20%s',_0x1054c7,JSON[_0x7307('0x3b')](_0x4b2de2));})[_0x7307('0x3d')](function(){Promise['resolve']()[_0x7307('0x3a')](function(){if(_0x3df8cf[0x0]!=='2'||_0x120e8f[_0x7307('0x19')])return;return rpc[_0x2fecbd+_0x7307('0x3e')][_0x7307('0x3f')](_0x120e8f['id'],{'autoreplyExecuted':!![]})[_0x7307('0x3a')](function(_0x251ea8){logger[_0x7307('0x12')](_0x7307('0x1a'),_0x1054c7,JSON[_0x7307('0x3b')](_0x251ea8));})[_0x7307('0x40')](function(_0x220649){logger[_0x7307('0x3c')](_0x7307('0x41'),_0x1054c7,JSON[_0x7307('0x3b')](_0x220649));});})[_0x7307('0x3a')](function(){_0x58b5af['next']();});});}else{return rpc[this['channel']+'Message'][_0x7307('0x42')](_0x2ef016)[_0x7307('0x3a')](function(){logger[_0x7307('0x12')](_0x7307('0x13'),_0x1054c7,_0x2ef016[_0x7307('0x1e')]);})['catch'](function(_0x58de5a){logger[_0x7307('0x3c')]('[%s][AUTOREPLY]\x20%s',_0x1054c7,JSON['stringify'](_0x58de5a));})['finally'](function(){Promise[_0x7307('0x43')]()[_0x7307('0x3a')](function(){if(_0x3df8cf[0x0]!=='2'||_0x120e8f[_0x7307('0x19')])return;return rpc[_0x2fecbd+_0x7307('0x3e')]['update'](_0x120e8f['id'],{'autoreplyExecuted':!![]})[_0x7307('0x3a')](function(_0x69ed2a){logger[_0x7307('0x12')](_0x7307('0x1a'),_0x1054c7,JSON[_0x7307('0x3b')](_0x69ed2a));})[_0x7307('0x40')](function(_0x283e3c){logger[_0x7307('0x3c')](_0x7307('0x41'),_0x1054c7,JSON[_0x7307('0x3b')](_0x283e3c));});})[_0x7307('0x3a')](function(){_0x58b5af[_0x7307('0x18')]();});});}}}catch(_0x456f6f){logger[_0x7307('0x3c')](_0x7307('0x13'),_0x1054c7,JSON[_0x7307('0x3b')](_0x456f6f));_0x58b5af[_0x7307('0x44')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index ebb6428..60c60b5 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb162=['format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','stringify','finally','stop','error','moment','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','info','[%s][CLOSE]\x20reason\x20%s'];(function(_0x4bb581,_0x6f7037){var _0x316bf5=function(_0x1f6ed0){while(--_0x1f6ed0){_0x4bb581['push'](_0x4bb581['shift']());}};_0x316bf5(++_0x6f7037);}(_0xb162,0xf4));var _0x2b16=function(_0x14d54f,_0x4559f7){_0x14d54f=_0x14d54f-0x0;var _0x54676e=_0xb162[_0x14d54f];return _0x54676e;};'use strict';var moment=require(_0x2b16('0x0'));var logger=require('../../../../config/logger')(_0x2b16('0x1'));var rpc={'chatInteraction':require(_0x2b16('0x2')),'openchannelInteraction':require(_0x2b16('0x3')),'smsInteraction':require(_0x2b16('0x4')),'mailInteraction':require(_0x2b16('0x5')),'faxInteraction':require(_0x2b16('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports['consequence']=function(_0xfd2fca,_0x36c83d,_0x3a2a3a,_0x4230ce){return function(_0x39817e){try{logger[_0x2b16('0x7')](_0x2b16('0x8'),_0xfd2fca,_0x36c83d[0x0]);var _0xbd208c={'closed':0x1,'closedAt':moment()[_0x2b16('0x9')](_0x2b16('0xa')),'closeReason':'system','disposition':_0x36c83d[0x0]};if(rpc[_0x4230ce[_0x2b16('0xb')]+_0x2b16('0xc')]){rpc[_0x4230ce[_0x2b16('0xb')]+'Interaction'][_0x2b16('0xd')](_0x4230ce[_0x2b16('0xe')]['id'],_0xbd208c)[_0x2b16('0xf')](function(_0x37cfd2){logger[_0x2b16('0x7')](_0x2b16('0x10'),_0xfd2fca,_0x4230ce['interaction']['id']);})[_0x2b16('0x11')](function(_0x1246ca){logger['error'](_0x2b16('0x12'),_0xfd2fca,JSON[_0x2b16('0x13')](_0x1246ca));})[_0x2b16('0x14')](function(){_0x39817e[_0x2b16('0x15')]();});}}catch(_0x29a6d4){logger[_0x2b16('0x16')]('[%s][CLOSE]\x20%s',_0xfd2fca,JSON['stringify'](_0x29a6d4));_0x39817e['stop']();}};}; \ No newline at end of file +var _0xe270=['YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','stop','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','[%s][CLOSE]\x20reason\x20%s','format'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0xe270,0x160));var _0x0e27=function(_0x2d6c4c,_0x5b4089){_0x2d6c4c=_0x2d6c4c-0x0;var _0x54f456=_0xe270[_0x2d6c4c];return _0x54f456;};'use strict';var moment=require(_0x0e27('0x0'));var logger=require(_0x0e27('0x1'))('routing');var rpc={'chatInteraction':require(_0x0e27('0x2')),'openchannelInteraction':require(_0x0e27('0x3')),'smsInteraction':require(_0x0e27('0x4')),'mailInteraction':require(_0x0e27('0x5')),'faxInteraction':require(_0x0e27('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports['consequence']=function(_0x4c7025,_0x3b49c9,_0x207425,_0x251071){return function(_0x2bd6de){try{logger['info'](_0x0e27('0x7'),_0x4c7025,_0x3b49c9[0x0]);var _0x456599={'closed':0x1,'closedAt':moment()[_0x0e27('0x8')](_0x0e27('0x9')),'closeReason':_0x0e27('0xa'),'disposition':_0x3b49c9[0x0]};if(rpc[_0x251071[_0x0e27('0xb')]+'Interaction']){rpc[_0x251071[_0x0e27('0xb')]+_0x0e27('0xc')][_0x0e27('0xd')](_0x251071[_0x0e27('0xe')]['id'],_0x456599)['then'](function(_0x422e79){logger['info'](_0x0e27('0xf'),_0x4c7025,_0x251071[_0x0e27('0xe')]['id']);})['catch'](function(_0x370717){logger[_0x0e27('0x10')](_0x0e27('0x11'),_0x4c7025,JSON['stringify'](_0x370717));})['finally'](function(){_0x2bd6de['stop']();});}}catch(_0xdfbe9){logger[_0x0e27('0x10')](_0x0e27('0x11'),_0x4c7025,JSON['stringify'](_0xdfbe9));_0x2bd6de[_0x0e27('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 834dc16..a65b45c 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b29=['body','Message','create','then','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','dialogflow','result','fulfillment','speech','providerName','providerResponse','endConversation','moment','apiai-promise','md5','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId'];(function(_0x3d754d,_0x71aad){var _0x59f912=function(_0x4a2630){while(--_0x4a2630){_0x3d754d['push'](_0x3d754d['shift']());}};_0x59f912(++_0x71aad);}(_0x2b29,0x163));var _0x92b2=function(_0x4ea100,_0x41ed51){_0x4ea100=_0x4ea100-0x0;var _0x57c802=_0x2b29[_0x4ea100];return _0x57c802;};'use strict';var _=require('lodash');var moment=require(_0x92b2('0x0'));var apiai=require(_0x92b2('0x1'));var md5=require(_0x92b2('0x2'));var utils=require(_0x92b2('0x3'));var logger=require('../../../../config/logger')(_0x92b2('0x4'));var rpc={'chatMessage':require(_0x92b2('0x5')),'openchannelMessage':require(_0x92b2('0x6')),'mailMessage':require(_0x92b2('0x7')),'smsMessage':require(_0x92b2('0x8')),'faxMessage':require(_0x92b2('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x92b2('0xa')]=function(_0x536e21,_0x29f183){return function(_0x43a292){try{if(!_['isNil'](this[_0x92b2('0xb')][_0x92b2('0xc')])){logger[_0x92b2('0xd')](_0x92b2('0xe'),_0x536e21,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x43a292[_0x92b2('0xf')]();}var _0x21bbf5={'ContactId':this[_0x92b2('0x10')]['id'],'sentAt':moment()[_0x92b2('0x11')](_0x92b2('0x12')),'direction':_0x92b2('0x13')};if(this[_0x92b2('0x14')]==='sms'||this[_0x92b2('0x14')]===_0x92b2('0x15')){_0x21bbf5[_0x92b2('0x16')]=this['interaction'][_0x92b2('0x16')];}var _0x3e5309=this[_0x92b2('0x14')];if(_0x3e5309===_0x92b2('0x17')){_0x21bbf5[_0x92b2('0x18')]=this[_0x92b2('0x19')]['id'];}else{_0x21bbf5[_['upperFirst'](_0x3e5309)+_0x92b2('0x1a')]=this['account']['id'];}_0x21bbf5[_[_0x92b2('0x1b')](_0x3e5309)+_0x92b2('0x1c')]=this[_0x92b2('0xb')]['id'];if(this['interaction']['created']){var _0xbb9cef=_0x29f183[0x2];if(!_['isEmpty'](_0xbb9cef)){_0x21bbf5[_0x92b2('0x1d')]=utils['getMustacheRender'](_0xbb9cef,this);return rpc[_0x3e5309+_0x92b2('0x1e')][_0x92b2('0x1f')](_0x21bbf5)[_0x92b2('0x20')](function(_0xceaa2f){logger[_0x92b2('0xd')](_0x92b2('0xe'),_0x536e21,_0x21bbf5[_0x92b2('0x1d')]);})[_0x92b2('0x21')](function(_0x21bc07){logger[_0x92b2('0x22')](_0x92b2('0xe'),_0x536e21,JSON[_0x92b2('0x23')](_0x21bc07));})[_0x92b2('0x24')](function(){logger[_0x92b2('0xd')](_0x92b2('0x25'),_0x536e21);_0x43a292['stop']();});}else{logger[_0x92b2('0xd')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x536e21);_0x43a292[_0x92b2('0x26')]();}}else{var _0xe6f05f=this;var _0x2b372c=apiai(_0x29f183[0x0],{'language':_0x29f183[0x1]||'en'});return _0x2b372c[_0x92b2('0x27')](this[_0x92b2('0x28')]['body'],{'sessionId':md5(this['interaction']['id'])})[_0x92b2('0x20')](function(_0x31567c){_0xe6f05f[_0x92b2('0x1d')][_0x92b2('0x29')]=_0x31567c;_0x21bbf5[_0x92b2('0x1d')]=_0x31567c[_0x92b2('0x2a')][_0x92b2('0x2b')][_0x92b2('0x2c')];_0x21bbf5[_0x92b2('0x2d')]='dialogflow';_0x21bbf5[_0x92b2('0x2e')]=JSON['stringify'](_0x31567c);return rpc[_0x3e5309+_0x92b2('0x1e')]['create'](_0x21bbf5)['then'](function(_0x105270){logger[_0x92b2('0xd')](_0x92b2('0xe'),_0x536e21,_0x21bbf5['body']);if(_0x31567c[_0x92b2('0x2a')]['metadata'][_0x92b2('0x2f')]){_0x43a292[_0x92b2('0xf')]();}else{_0x43a292[_0x92b2('0x26')]();}})[_0x92b2('0x21')](function(_0x368998){logger[_0x92b2('0x22')](_0x92b2('0xe'),_0x536e21,JSON['stringify'](_0x368998));_0x43a292['next']();});})['catch'](function(_0xd240ec){logger[_0x92b2('0x22')](_0x92b2('0xe'),_0x536e21,_0xd240ec['message']);_0x43a292['next']();});}}catch(_0x4039ec){logger[_0x92b2('0x22')](_0x92b2('0xe'),_0x536e21,JSON[_0x92b2('0x23')](_0x4039ec));_0x43a292[_0x92b2('0x26')]();}};}; \ No newline at end of file +var _0x6c45=['UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','chat','ChatWebsiteId','account','upperFirst','created','body','getMustacheRender','create','then','catch','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','fulfillment','speech','dialogflow','providerResponse','endConversation','next','lodash','moment','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction'];(function(_0x541368,_0xb7b0e4){var _0x19bb07=function(_0xa00773){while(--_0xa00773){_0x541368['push'](_0x541368['shift']());}};_0x19bb07(++_0xb7b0e4);}(_0x6c45,0xb1));var _0x56c4=function(_0x17a66d,_0x46df52){_0x17a66d=_0x17a66d-0x0;var _0x10a710=_0x6c45[_0x17a66d];return _0x10a710;};'use strict';var _=require(_0x56c4('0x0'));var moment=require(_0x56c4('0x1'));var apiai=require('apiai-promise');var md5=require(_0x56c4('0x2'));var utils=require(_0x56c4('0x3'));var logger=require(_0x56c4('0x4'))(_0x56c4('0x5'));var rpc={'chatMessage':require(_0x56c4('0x6')),'openchannelMessage':require(_0x56c4('0x7')),'mailMessage':require(_0x56c4('0x8')),'smsMessage':require(_0x56c4('0x9')),'faxMessage':require(_0x56c4('0xa')),'whatsappMessage':require(_0x56c4('0xb'))};exports[_0x56c4('0xc')]=function(_0x330e6,_0x1d0b9b){return function(_0x373748){try{if(!_[_0x56c4('0xd')](this[_0x56c4('0xe')][_0x56c4('0xf')])){logger[_0x56c4('0x10')](_0x56c4('0x11'),_0x330e6,_0x56c4('0x12'));return _0x373748['next']();}var _0x2533d7={'ContactId':this[_0x56c4('0x13')]['id'],'sentAt':moment()[_0x56c4('0x14')](_0x56c4('0x15')),'direction':'out'};if(this[_0x56c4('0x16')]===_0x56c4('0x17')||this[_0x56c4('0x16')]===_0x56c4('0x18')){_0x2533d7['phone']=this[_0x56c4('0xe')]['phone'];}var _0x512d7e=this[_0x56c4('0x16')];if(_0x512d7e===_0x56c4('0x19')){_0x2533d7[_0x56c4('0x1a')]=this[_0x56c4('0x1b')]['id'];}else{_0x2533d7[_[_0x56c4('0x1c')](_0x512d7e)+'AccountId']=this[_0x56c4('0x1b')]['id'];}_0x2533d7[_[_0x56c4('0x1c')](_0x512d7e)+'InteractionId']=this[_0x56c4('0xe')]['id'];if(this[_0x56c4('0xe')][_0x56c4('0x1d')]){var _0x2f0bb2=_0x1d0b9b[0x2];if(!_['isEmpty'](_0x2f0bb2)){_0x2533d7[_0x56c4('0x1e')]=utils[_0x56c4('0x1f')](_0x2f0bb2,this);return rpc[_0x512d7e+'Message'][_0x56c4('0x20')](_0x2533d7)[_0x56c4('0x21')](function(_0x110f71){logger[_0x56c4('0x10')]('[%s][DIALOGFLOW]\x20%s',_0x330e6,_0x2533d7[_0x56c4('0x1e')]);})[_0x56c4('0x22')](function(_0x279a1e){logger[_0x56c4('0x23')](_0x56c4('0x11'),_0x330e6,JSON[_0x56c4('0x24')](_0x279a1e));})['finally'](function(){logger['info'](_0x56c4('0x25'),_0x330e6);_0x373748[_0x56c4('0x26')]();});}else{logger['info'](_0x56c4('0x27'),_0x330e6);_0x373748[_0x56c4('0x26')]();}}else{var _0x10eae6=this;var _0x23b11e=apiai(_0x1d0b9b[0x0],{'language':_0x1d0b9b[0x1]||'en'});return _0x23b11e[_0x56c4('0x28')](this[_0x56c4('0x29')][_0x56c4('0x1e')],{'sessionId':md5(this['interaction']['id'])})[_0x56c4('0x21')](function(_0x3e1007){_0x10eae6[_0x56c4('0x1e')]['dialogflow']=_0x3e1007;_0x2533d7[_0x56c4('0x1e')]=_0x3e1007['result'][_0x56c4('0x2a')][_0x56c4('0x2b')];_0x2533d7['providerName']=_0x56c4('0x2c');_0x2533d7[_0x56c4('0x2d')]=JSON['stringify'](_0x3e1007);return rpc[_0x512d7e+'Message']['create'](_0x2533d7)[_0x56c4('0x21')](function(_0x2ac814){logger[_0x56c4('0x10')]('[%s][DIALOGFLOW]\x20%s',_0x330e6,_0x2533d7[_0x56c4('0x1e')]);if(_0x3e1007['result']['metadata'][_0x56c4('0x2e')]){_0x373748[_0x56c4('0x2f')]();}else{_0x373748[_0x56c4('0x26')]();}})[_0x56c4('0x22')](function(_0x3f9cc0){logger[_0x56c4('0x23')](_0x56c4('0x11'),_0x330e6,JSON[_0x56c4('0x24')](_0x3f9cc0));_0x373748['next']();});})[_0x56c4('0x22')](function(_0x388dee){logger[_0x56c4('0x23')]('[%s][DIALOGFLOW]\x20%s',_0x330e6,_0x388dee[_0x56c4('0x29')]);_0x373748[_0x56c4('0x2f')]();});}}catch(_0x3894ba){logger['error'](_0x56c4('0x11'),_0x330e6,JSON[_0x56c4('0x24')](_0x3894ba));_0x373748['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 55858b3..02c26a8 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1e6f=['allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','length','fulfillmentText','push','all','next','dialogflow','moment','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','create','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','UserId','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','interaction','phone','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','getMustacheRender','Message','then','body','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT'];(function(_0x4dfa14,_0x3e6fa1){var _0x367eca=function(_0x5cce45){while(--_0x5cce45){_0x4dfa14['push'](_0x4dfa14['shift']());}};_0x367eca(++_0x3e6fa1);}(_0x1e6f,0x132));var _0xf1e6=function(_0x13d15c,_0x307619){_0x13d15c=_0x13d15c-0x0;var _0x2d9b04=_0x1e6f[_0x13d15c];return _0x2d9b04;};'use strict';var _=require('lodash');var dialogflow=require(_0xf1e6('0x0'));var md5=require('md5');var moment=require(_0xf1e6('0x1'));var Promise=require('bluebird');var logger=require(_0xf1e6('0x2'))(_0xf1e6('0x3'));var utils=require(_0xf1e6('0x4'));var rpc={'chatMessage':require(_0xf1e6('0x5')),'openchannelMessage':require(_0xf1e6('0x6')),'mailMessage':require(_0xf1e6('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xf1e6('0x8')),'whatsappMessage':require(_0xf1e6('0x9'))};function createMessage(_0x31ed57,_0x522640,_0x596234,_0x16f4d4){return new Promise(function(_0x225378,_0x131deb){var _0x46e6a6=_['clone'](_0x596234);_0x46e6a6['body']=_0x16f4d4;return rpc[_0x522640+'Message'][_0xf1e6('0xa')](_0x46e6a6)['then'](function(){logger[_0xf1e6('0xb')](_0xf1e6('0xc'),_0x31ed57,_0x46e6a6['body']);_0x225378();})[_0xf1e6('0xd')](function(_0x154631){logger[_0xf1e6('0xe')](_0xf1e6('0xc'),_0x31ed57,JSON[_0xf1e6('0xf')](_0x154631));_0x131deb(_0x154631);});});}exports[_0xf1e6('0x10')]=function(_0x657138,_0x2cacb0){return function(_0x12cba9){try{if(!_['isNil'](this['interaction'][_0xf1e6('0x11')])){logger['info'](_0xf1e6('0xc'),_0x657138,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x12cba9['next']();}var _0x69607b={'ContactId':this[_0xf1e6('0x12')]['id'],'sentAt':moment()['format'](_0xf1e6('0x13')),'direction':_0xf1e6('0x14')};if(this[_0xf1e6('0x15')]===_0xf1e6('0x16')||this[_0xf1e6('0x15')]===_0xf1e6('0x17')){_0x69607b['phone']=this[_0xf1e6('0x18')][_0xf1e6('0x19')];}var _0xf850f=this[_0xf1e6('0x15')];if(_0xf850f==='chat'){_0x69607b[_0xf1e6('0x1a')]=this[_0xf1e6('0x1b')]['id'];}else{_0x69607b[_[_0xf1e6('0x1c')](_0xf850f)+'AccountId']=this[_0xf1e6('0x1b')]['id'];}_0x69607b[_[_0xf1e6('0x1c')](_0xf850f)+_0xf1e6('0x1d')]=this[_0xf1e6('0x18')]['id'];if(this['interaction'][_0xf1e6('0x1e')]){var _0x4ca1c8=_0x2cacb0[0x4];if(!_[_0xf1e6('0x1f')](_0x4ca1c8)){_0x69607b['body']=utils[_0xf1e6('0x20')](_0x4ca1c8,this);return rpc[_0xf850f+_0xf1e6('0x21')][_0xf1e6('0xa')](_0x69607b)[_0xf1e6('0x22')](function(_0xcb8910){logger[_0xf1e6('0xb')](_0xf1e6('0xc'),_0x657138,_0x69607b[_0xf1e6('0x23')]);})[_0xf1e6('0xd')](function(_0x1139df){logger[_0xf1e6('0xe')](_0xf1e6('0xc'),_0x657138,JSON[_0xf1e6('0xf')](_0x1139df));})[_0xf1e6('0x24')](function(){logger[_0xf1e6('0xb')](_0xf1e6('0x25'),_0x657138);_0x12cba9[_0xf1e6('0x26')]();});}else{logger[_0xf1e6('0xb')](_0xf1e6('0x27'),_0x657138);_0x12cba9[_0xf1e6('0x26')]();}}else{var _0x396e59=this;var _0x24a8c2=_0x2cacb0[0x2]['replace'](/\\n/g,'\x0a');var _0x2d0208={'credentials':{'private_key':_0x24a8c2,'client_email':_0x2cacb0[0x1]}};var _0x5d15ff=new dialogflow['SessionsClient'](_0x2d0208);var _0x4e64e1=_0x5d15ff['sessionPath'](_0x2cacb0[0x0],md5(_0x396e59['interaction']['id']));var _0x500718={'session':_0x4e64e1,'queryInput':{'text':{'text':_0x396e59[_0xf1e6('0x28')][_0xf1e6('0x23')],'languageCode':_0x2cacb0[0x3]||'en'}}};return _0x5d15ff[_0xf1e6('0x29')](_0x500718)[_0xf1e6('0x22')](function(_0x7fe6a){if(_0x7fe6a&&_0x7fe6a['length']){_0x396e59['body'][_0xf1e6('0x2a')]=_0x7fe6a;var _0x52f6b5=_0x7fe6a[0x0];var _0x1a08e0=_0x52f6b5[_0xf1e6('0x2b')][_0xf1e6('0x2c')]&&_0x52f6b5[_0xf1e6('0x2b')][_0xf1e6('0x2c')][_0xf1e6('0x2d')]?_0x52f6b5[_0xf1e6('0x2b')][_0xf1e6('0x2c')][_0xf1e6('0x2d')]['end_conversation'][_0xf1e6('0x2e')]:![];_0x396e59[_0xf1e6('0x23')][_0xf1e6('0x2f')]=_0x52f6b5[_0xf1e6('0x2b')]['action'];_0x396e59[_0xf1e6('0x23')][_0xf1e6('0x30')]=_0x52f6b5[_0xf1e6('0x2b')][_0xf1e6('0x31')];_0x396e59['body'][_0xf1e6('0x32')]=_0x52f6b5['queryResult']['diagnosticInfo']&&_0x52f6b5[_0xf1e6('0x2b')][_0xf1e6('0x2c')][_0xf1e6('0x2d')]?_0x52f6b5[_0xf1e6('0x2b')]['diagnosticInfo'][_0xf1e6('0x2d')][_0xf1e6('0x33')][_0xf1e6('0x2e')]:![];_0x396e59['body'][_0xf1e6('0x34')]=_0x52f6b5[_0xf1e6('0x2b')][_0xf1e6('0x35')][_0xf1e6('0x36')];_0x396e59[_0xf1e6('0x23')][_0xf1e6('0x37')]=_0x52f6b5['queryResult']['intent'][_0xf1e6('0x38')];_0x396e59['body'][_0xf1e6('0x39')]=_0x52f6b5[_0xf1e6('0x2b')][_0xf1e6('0x35')][_0xf1e6('0x3a')];_0x396e59[_0xf1e6('0x23')][_0xf1e6('0x3b')]=_0x52f6b5[_0xf1e6('0x2b')][_0xf1e6('0x3c')];_0x396e59[_0xf1e6('0x23')][_0xf1e6('0x3d')]=_0x52f6b5['queryResult']['queryText'];_0x396e59[_0xf1e6('0x23')][_0xf1e6('0x3e')]=_0x52f6b5[_0xf1e6('0x2b')][_0xf1e6('0x3f')];_0x69607b[_0xf1e6('0x40')]=_0xf1e6('0x2a');_0x69607b[_0xf1e6('0x41')]=JSON[_0xf1e6('0xf')](_0x7fe6a);var _0x73ae26=[];for(var _0x373e8f=0x0;_0x373e8f<_0x7fe6a[_0xf1e6('0x42')];_0x373e8f++){var _0x51774b=_0x7fe6a[_0x373e8f];if(_0x51774b&&_0x51774b['queryResult']&&_0x51774b['queryResult'][_0xf1e6('0x43')]){_0x73ae26[_0xf1e6('0x44')](createMessage(_0x657138,_0xf850f,_0x69607b,_0x51774b[_0xf1e6('0x2b')][_0xf1e6('0x43')]));}}return Promise[_0xf1e6('0x45')](_0x73ae26)[_0xf1e6('0x22')](function(){if(_0x1a08e0){_0x12cba9[_0xf1e6('0x46')]();}else{_0x12cba9[_0xf1e6('0x26')]();}})['catch'](function(_0xb883d6){logger['error'](_0xf1e6('0xc'),_0x657138,JSON[_0xf1e6('0xf')](_0xb883d6));_0x12cba9[_0xf1e6('0x46')]();});}})['catch'](function(_0x2de13d){logger[_0xf1e6('0xe')](_0xf1e6('0xc'),_0x657138,_0x2de13d[_0xf1e6('0x28')],_0x2de13d['stack']);_0x12cba9[_0xf1e6('0x46')]();});}}catch(_0x23cd0d){logger['error'](_0xf1e6('0xc'),_0x657138,JSON[_0xf1e6('0xf')](_0x23cd0d));_0x12cba9[_0xf1e6('0x26')]();}};}; \ No newline at end of file +var _0xaa17=['md5','moment','bluebird','../../../../config/logger','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','error','[%s][DIALOGFLOWV2]\x20%s','stringify','consequence','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','ChatWebsiteId','account','AccountId','isEmpty','catch','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','message','detectIntent','length','diagnosticInfo','queryResult','fields','end_conversation','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','boolValue','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerName','providerResponse','all','stack','dialogflow'];(function(_0x470e67,_0x4a596d){var _0x28bbde=function(_0x1bbf56){while(--_0x1bbf56){_0x470e67['push'](_0x470e67['shift']());}};_0x28bbde(++_0x4a596d);}(_0xaa17,0x1d4));var _0x7aa1=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xaa17[_0x297fd3];return _0x2af381;};'use strict';var _=require('lodash');var dialogflow=require(_0x7aa1('0x0'));var md5=require(_0x7aa1('0x1'));var moment=require(_0x7aa1('0x2'));var Promise=require(_0x7aa1('0x3'));var logger=require(_0x7aa1('0x4'))('routing');var utils=require(_0x7aa1('0x5'));var rpc={'chatMessage':require(_0x7aa1('0x6')),'openchannelMessage':require(_0x7aa1('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x7aa1('0x8')),'faxMessage':require(_0x7aa1('0x9')),'whatsappMessage':require(_0x7aa1('0xa'))};function createMessage(_0x192865,_0x584f28,_0x2e4562,_0x55f8cd){return new Promise(function(_0x4efca7,_0x549143){var _0xa11ba6=_[_0x7aa1('0xb')](_0x2e4562);_0xa11ba6[_0x7aa1('0xc')]=_0x55f8cd;return rpc[_0x584f28+_0x7aa1('0xd')][_0x7aa1('0xe')](_0xa11ba6)[_0x7aa1('0xf')](function(){logger[_0x7aa1('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x192865,_0xa11ba6[_0x7aa1('0xc')]);_0x4efca7();})['catch'](function(_0x3def2b){logger[_0x7aa1('0x11')](_0x7aa1('0x12'),_0x192865,JSON[_0x7aa1('0x13')](_0x3def2b));_0x549143(_0x3def2b);});});}exports[_0x7aa1('0x14')]=function(_0x3460f4,_0x48d478){return function(_0x380f3f){try{if(!_[_0x7aa1('0x15')](this[_0x7aa1('0x16')]['UserId'])){logger[_0x7aa1('0x10')](_0x7aa1('0x12'),_0x3460f4,_0x7aa1('0x17'));return _0x380f3f[_0x7aa1('0x18')]();}var _0x4f4f6b={'ContactId':this[_0x7aa1('0x19')]['id'],'sentAt':moment()[_0x7aa1('0x1a')](_0x7aa1('0x1b')),'direction':_0x7aa1('0x1c')};if(this['channel']===_0x7aa1('0x1d')||this[_0x7aa1('0x1e')]===_0x7aa1('0x1f')){_0x4f4f6b['phone']=this['interaction'][_0x7aa1('0x20')];}var _0x4101cc=this['channel'];if(_0x4101cc==='chat'){_0x4f4f6b[_0x7aa1('0x21')]=this[_0x7aa1('0x22')]['id'];}else{_0x4f4f6b[_['upperFirst'](_0x4101cc)+_0x7aa1('0x23')]=this[_0x7aa1('0x22')]['id'];}_0x4f4f6b[_['upperFirst'](_0x4101cc)+'InteractionId']=this[_0x7aa1('0x16')]['id'];if(this[_0x7aa1('0x16')]['created']){var _0x102487=_0x48d478[0x4];if(!_[_0x7aa1('0x24')](_0x102487)){_0x4f4f6b[_0x7aa1('0xc')]=utils['getMustacheRender'](_0x102487,this);return rpc[_0x4101cc+_0x7aa1('0xd')][_0x7aa1('0xe')](_0x4f4f6b)[_0x7aa1('0xf')](function(_0xd9ced0){logger['info'](_0x7aa1('0x12'),_0x3460f4,_0x4f4f6b[_0x7aa1('0xc')]);})[_0x7aa1('0x25')](function(_0x534cb1){logger['error'](_0x7aa1('0x12'),_0x3460f4,JSON[_0x7aa1('0x13')](_0x534cb1));})[_0x7aa1('0x26')](function(){logger['info'](_0x7aa1('0x27'),_0x3460f4);_0x380f3f[_0x7aa1('0x28')]();});}else{logger['info'](_0x7aa1('0x29'),_0x3460f4);_0x380f3f['stop']();}}else{var _0xa0f432=this;var _0x46c962=_0x48d478[0x2][_0x7aa1('0x2a')](/\\n/g,'\x0a');var _0x25bcf1={'credentials':{'private_key':_0x46c962,'client_email':_0x48d478[0x1]}};var _0x52b5db=new dialogflow[(_0x7aa1('0x2b'))](_0x25bcf1);var _0x15614a=_0x52b5db['sessionPath'](_0x48d478[0x0],md5(_0xa0f432[_0x7aa1('0x16')]['id']));var _0x259671={'session':_0x15614a,'queryInput':{'text':{'text':_0xa0f432[_0x7aa1('0x2c')][_0x7aa1('0xc')],'languageCode':_0x48d478[0x3]||'en'}}};return _0x52b5db[_0x7aa1('0x2d')](_0x259671)[_0x7aa1('0xf')](function(_0x78c56a){if(_0x78c56a&&_0x78c56a[_0x7aa1('0x2e')]){_0xa0f432[_0x7aa1('0xc')]['dialogflowV2']=_0x78c56a;var _0x2b593d=_0x78c56a[0x0];var _0x17e95e=_0x2b593d['queryResult'][_0x7aa1('0x2f')]&&_0x2b593d[_0x7aa1('0x30')]['diagnosticInfo']['fields']?_0x2b593d[_0x7aa1('0x30')][_0x7aa1('0x2f')][_0x7aa1('0x31')][_0x7aa1('0x32')]['boolValue']:![];_0xa0f432[_0x7aa1('0xc')][_0x7aa1('0x33')]=_0x2b593d[_0x7aa1('0x30')]['action'];_0xa0f432[_0x7aa1('0xc')][_0x7aa1('0x34')]=_0x2b593d[_0x7aa1('0x30')][_0x7aa1('0x35')];_0xa0f432['body']['DIALOGFLOWV2_ENDCONVERSATION']=_0x2b593d['queryResult'][_0x7aa1('0x2f')]&&_0x2b593d[_0x7aa1('0x30')][_0x7aa1('0x2f')][_0x7aa1('0x31')]?_0x2b593d[_0x7aa1('0x30')]['diagnosticInfo'][_0x7aa1('0x31')][_0x7aa1('0x32')][_0x7aa1('0x36')]:![];_0xa0f432[_0x7aa1('0xc')][_0x7aa1('0x37')]=_0x2b593d['queryResult'][_0x7aa1('0x38')][_0x7aa1('0x39')];_0xa0f432[_0x7aa1('0xc')][_0x7aa1('0x3a')]=_0x2b593d[_0x7aa1('0x30')][_0x7aa1('0x38')]['displayName'];_0xa0f432[_0x7aa1('0xc')][_0x7aa1('0x3b')]=_0x2b593d[_0x7aa1('0x30')][_0x7aa1('0x38')]['isFallback'];_0xa0f432[_0x7aa1('0xc')]['DIALOGFLOWV2_LANGUAGECODE']=_0x2b593d['queryResult']['languageCode'];_0xa0f432[_0x7aa1('0xc')][_0x7aa1('0x3c')]=_0x2b593d[_0x7aa1('0x30')][_0x7aa1('0x3d')];_0xa0f432[_0x7aa1('0xc')]['DIALOGFLOWV2_SCORE']=_0x2b593d[_0x7aa1('0x30')][_0x7aa1('0x3e')];_0x4f4f6b[_0x7aa1('0x3f')]='dialogflowV2';_0x4f4f6b[_0x7aa1('0x40')]=JSON['stringify'](_0x78c56a);var _0x2a3d69=[];for(var _0x3f1f5d=0x0;_0x3f1f5d<_0x78c56a[_0x7aa1('0x2e')];_0x3f1f5d++){var _0x41748d=_0x78c56a[_0x3f1f5d];if(_0x41748d&&_0x41748d['queryResult']&&_0x41748d[_0x7aa1('0x30')]['fulfillmentText']){_0x2a3d69['push'](createMessage(_0x3460f4,_0x4101cc,_0x4f4f6b,_0x41748d['queryResult']['fulfillmentText']));}}return Promise[_0x7aa1('0x41')](_0x2a3d69)[_0x7aa1('0xf')](function(){if(_0x17e95e){_0x380f3f[_0x7aa1('0x18')]();}else{_0x380f3f[_0x7aa1('0x28')]();}})[_0x7aa1('0x25')](function(_0x396d82){logger[_0x7aa1('0x11')](_0x7aa1('0x12'),_0x3460f4,JSON[_0x7aa1('0x13')](_0x396d82));_0x380f3f[_0x7aa1('0x18')]();});}})[_0x7aa1('0x25')](function(_0x2e4466){logger[_0x7aa1('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x3460f4,_0x2e4466['message'],_0x2e4466[_0x7aa1('0x42')]);_0x380f3f[_0x7aa1('0x18')]();});}}catch(_0x79f4f){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x3460f4,JSON['stringify'](_0x79f4f));_0x380f3f[_0x7aa1('0x28')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index f0788d5..22979e5 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x239a=['priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','error','[%s][GOTOIF]\x20%s','map','message','join','condition'];(function(_0x192467,_0x20a200){var _0x4f8fbc=function(_0x320269){while(--_0x320269){_0x192467['push'](_0x192467['shift']());}};_0x4f8fbc(++_0x20a200);}(_0x239a,0x119));var _0xa239=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x239a[_0x321bb2];return _0x9c12ed;};'use strict';var schema=require(_0xa239('0x0'));var _=require(_0xa239('0x1'));var htmlToText=require(_0xa239('0x2'));var utils=require(_0xa239('0x3'));var logger=require(_0xa239('0x4'))(_0xa239('0x5'));var gotoif=schema({'condition':{'type':_0xa239('0x6'),'required':!![],'message':_0xa239('0x7')},'priorityTrue':{'type':_0xa239('0x8'),'message':_0xa239('0x9')},'priorityFalse':{'type':_0xa239('0x8'),'message':_0xa239('0xa')}});exports[_0xa239('0xb')]=function(_0x14258c,_0x44af0c){return function(_0x216979){try{var _0x4d970a={'condition':htmlToText['fromString'](utils[_0xa239('0xc')](_0x44af0c[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x44af0c[0x1],'priorityFalse':_0x44af0c[0x2]};var _0xfd1bc0=gotoif['validate'](_0x4d970a,{'typecast':!![]});if(_0xfd1bc0['length']){logger[_0xa239('0xd')](_0xa239('0xe'),_0x14258c,_[_0xa239('0xf')](_0xfd1bc0,_0xa239('0x10'))[_0xa239('0x11')](',\x20'));_0x216979['stop']();}else{try{var _0x5d30e5=eval('('+_0x4d970a[_0xa239('0x12')]+')');var _0x2c7797=_0x5d30e5?_0x4d970a[_0xa239('0x13')]:_0x4d970a[_0xa239('0x14')];logger[_0xa239('0x15')](_0xa239('0x16'),_0x14258c,_0x4d970a[_0xa239('0x12')],_0x5d30e5,_0x2c7797||'next');if(_0x2c7797){var _0x51f605=_[_0xa239('0x17')](_0x216979[_0xa239('0x18')](),{'p':_0x2c7797});if(_0x51f605>=0x0){logger['info'](_0xa239('0x19'),_0x14258c,_0x2c7797||_0xa239('0x1a'),_0x51f605);_0x216979[_0xa239('0x1a')](_0x51f605);}else{logger[_0xa239('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x14258c,_0x2c7797||_0xa239('0x1a'));_0x216979[_0xa239('0x1b')]();}}else{_0x216979['next']();}}catch(_0x1fe138){logger[_0xa239('0xd')](_0xa239('0x1c'),_0x14258c,_0x1fe138[_0xa239('0x10')]);_0x216979[_0xa239('0x1b')]();}}}catch(_0x8cecac){logger['error'](_0xa239('0xe'),_0x14258c,JSON[_0xa239('0x1d')](_0x8cecac));_0x216979[_0xa239('0x1b')]();}};}; \ No newline at end of file +var _0x58fd=['./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','message','stop','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','html-to-text'];(function(_0x1277e8,_0x1cd934){var _0x10cfff=function(_0x227e02){while(--_0x227e02){_0x1277e8['push'](_0x1277e8['shift']());}};_0x10cfff(++_0x1cd934);}(_0x58fd,0x94));var _0xd58f=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x58fd[_0x2d8fc2];return _0x3a9e53;};'use strict';var schema=require(_0xd58f('0x0'));var _=require('lodash');var htmlToText=require(_0xd58f('0x1'));var utils=require(_0xd58f('0x2'));var logger=require(_0xd58f('0x3'))(_0xd58f('0x4'));var gotoif=schema({'condition':{'type':_0xd58f('0x5'),'required':!![],'message':_0xd58f('0x6')},'priorityTrue':{'type':_0xd58f('0x7'),'message':_0xd58f('0x8')},'priorityFalse':{'type':_0xd58f('0x7'),'message':_0xd58f('0x9')}});exports[_0xd58f('0xa')]=function(_0x13ddc3,_0x57bcf2){return function(_0x2fc970){try{var _0x4d885e={'condition':htmlToText[_0xd58f('0xb')](utils[_0xd58f('0xc')](_0x57bcf2[0x0],this),{'wordwrap':![]})[_0xd58f('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x57bcf2[0x1],'priorityFalse':_0x57bcf2[0x2]};var _0x1be449=gotoif[_0xd58f('0x0')](_0x4d885e,{'typecast':!![]});if(_0x1be449[_0xd58f('0xe')]){logger[_0xd58f('0xf')]('[%s][GOTOIF]\x20%s',_0x13ddc3,_['map'](_0x1be449,_0xd58f('0x10'))['join'](',\x20'));_0x2fc970[_0xd58f('0x11')]();}else{try{var _0x1e815b=eval('('+_0x4d885e['condition']+')');var _0x593865=_0x1e815b?_0x4d885e[_0xd58f('0x12')]:_0x4d885e[_0xd58f('0x13')];logger[_0xd58f('0x14')](_0xd58f('0x15'),_0x13ddc3,_0x4d885e[_0xd58f('0x16')],_0x1e815b,_0x593865||_0xd58f('0x17'));if(_0x593865){var _0x4eb889=_[_0xd58f('0x18')](_0x2fc970[_0xd58f('0x19')](),{'p':_0x593865});if(_0x4eb889>=0x0){logger['info'](_0xd58f('0x1a'),_0x13ddc3,_0x593865||_0xd58f('0x17'),_0x4eb889);_0x2fc970[_0xd58f('0x17')](_0x4eb889);}else{logger[_0xd58f('0x14')](_0xd58f('0x1b'),_0x13ddc3,_0x593865||_0xd58f('0x17'));_0x2fc970[_0xd58f('0x11')]();}}else{_0x2fc970['next']();}}catch(_0x263dce){logger[_0xd58f('0xf')](_0xd58f('0x1c'),_0x13ddc3,_0x263dce[_0xd58f('0x10')]);_0x2fc970['stop']();}}}catch(_0x43e092){logger['error']('[%s][GOTOIF]\x20%s',_0x13ddc3,JSON[_0xd58f('0x1d')](_0x43e092));_0x2fc970[_0xd58f('0x11')]();}};}; \ 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 2426ea1..cfee698 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 _0x3e72=['validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop'];(function(_0x4b09ae,_0x3a2e8e){var _0xcf2f6c=function(_0x21c7d1){while(--_0x21c7d1){_0x4b09ae['push'](_0x4b09ae['shift']());}};_0xcf2f6c(++_0x3a2e8e);}(_0x3e72,0x118));var _0x23e7=function(_0x5ce8b9,_0x5cded8){_0x5ce8b9=_0x5ce8b9-0x0;var _0xe34be0=_0x3e72[_0x5ce8b9];return _0xe34be0;};'use strict';var schema=require(_0x23e7('0x0'));var _=require('lodash');var logger=require(_0x23e7('0x1'))(_0x23e7('0x2'));var gotop=schema({'priority':{'type':_0x23e7('0x3'),'required':!![],'message':_0x23e7('0x4')}});exports[_0x23e7('0x5')]=function(_0x44c06e,_0x5ed590){return function(_0x1fa1ce){try{var _0x74a964={'priority':_0x5ed590[0x0]};var _0x3ed5cd=gotop[_0x23e7('0x0')](_0x74a964,{'typecast':!![]});if(_0x3ed5cd[_0x23e7('0x6')]){logger[_0x23e7('0x7')](_0x23e7('0x8'),_0x44c06e,_[_0x23e7('0x9')](_0x3ed5cd,_0x23e7('0xa'))[_0x23e7('0xb')](',\x20'));_0x1fa1ce['stop']();}else{logger[_0x23e7('0xc')]('[%s][GOTOP]\x20priority\x20%s',_0x44c06e,_0x74a964[_0x23e7('0xd')]);if(_0x74a964[_0x23e7('0xd')]){var _0x1ed0d1=_[_0x23e7('0xe')](_0x1fa1ce[_0x23e7('0xf')](),{'p':_0x74a964[_0x23e7('0xd')]});if(_0x1ed0d1>=0x0){logger[_0x23e7('0xc')](_0x23e7('0x10'),_0x44c06e,_0x74a964[_0x23e7('0xd')]||_0x23e7('0x11'),_0x1ed0d1);_0x1fa1ce[_0x23e7('0x11')](_0x1ed0d1);}else{logger[_0x23e7('0xc')](_0x23e7('0x12'),_0x44c06e,_0x74a964[_0x23e7('0xd')]||_0x23e7('0x11'));_0x1fa1ce[_0x23e7('0x13')]();}}else{_0x1fa1ce[_0x23e7('0x11')]();}}}catch(_0x5c2cc4){logger['error']('[%s][GOTOP]\x20%s',_0x44c06e,JSON['stringify'](_0x5c2cc4));_0x1fa1ce[_0x23e7('0x13')]();}};}; \ No newline at end of file +var _0x5320=['consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'];(function(_0x1e16cf,_0x9cb872){var _0x2bd065=function(_0x5a37be){while(--_0x5a37be){_0x1e16cf['push'](_0x1e16cf['shift']());}};_0x2bd065(++_0x9cb872);}(_0x5320,0x13f));var _0x0532=function(_0x50cc02,_0x2ecdc2){_0x50cc02=_0x50cc02-0x0;var _0x34dc25=_0x5320[_0x50cc02];return _0x34dc25;};'use strict';var schema=require(_0x0532('0x0'));var _=require('lodash');var logger=require(_0x0532('0x1'))(_0x0532('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x0532('0x3')}});exports[_0x0532('0x4')]=function(_0x3da03,_0xb06344){return function(_0x425876){try{var _0x5b84af={'priority':_0xb06344[0x0]};var _0xd5a633=gotop[_0x0532('0x0')](_0x5b84af,{'typecast':!![]});if(_0xd5a633[_0x0532('0x5')]){logger[_0x0532('0x6')](_0x0532('0x7'),_0x3da03,_[_0x0532('0x8')](_0xd5a633,_0x0532('0x9'))[_0x0532('0xa')](',\x20'));_0x425876[_0x0532('0xb')]();}else{logger[_0x0532('0xc')](_0x0532('0xd'),_0x3da03,_0x5b84af[_0x0532('0xe')]);if(_0x5b84af[_0x0532('0xe')]){var _0x14d03e=_[_0x0532('0xf')](_0x425876[_0x0532('0x10')](),{'p':_0x5b84af[_0x0532('0xe')]});if(_0x14d03e>=0x0){logger[_0x0532('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x3da03,_0x5b84af[_0x0532('0xe')]||_0x0532('0x11'),_0x14d03e);_0x425876[_0x0532('0x11')](_0x14d03e);}else{logger['info'](_0x0532('0x12'),_0x3da03,_0x5b84af[_0x0532('0xe')]||_0x0532('0x11'));_0x425876[_0x0532('0xb')]();}}else{_0x425876[_0x0532('0x11')]();}}}catch(_0x6d3ffa){logger[_0x0532('0x6')](_0x0532('0x7'),_0x3da03,JSON['stringify'](_0x6d3ffa));_0x425876[_0x0532('0xb')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index b52c3d4..c0920f6 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 _0x1c8a=['info','body','next','catch','error','[%s][MESSAGE]\x20%s','stop','stringify','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','channel','chat','account','upperFirst','InteractionId','Message','create','then'];(function(_0x412faa,_0x6d5ea8){var _0x204402=function(_0x1ddbe0){while(--_0x1ddbe0){_0x412faa['push'](_0x412faa['shift']());}};_0x204402(++_0x6d5ea8);}(_0x1c8a,0x140));var _0xa1c8=function(_0x468c37,_0x310b3a){_0x468c37=_0x468c37-0x0;var _0x373091=_0x1c8a[_0x468c37];return _0x373091;};'use strict';var _=require(_0xa1c8('0x0'));var utils=require(_0xa1c8('0x1'));var logger=require(_0xa1c8('0x2'))(_0xa1c8('0x3'));var rpc={'chatMessage':require(_0xa1c8('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xa1c8('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xa1c8('0x6')),'whatsappMessage':require(_0xa1c8('0x7'))};exports[_0xa1c8('0x8')]=function(_0x559330,_0x331282){return function(_0x14b85c){try{var _0x14d2f0={'body':utils['getMustacheRender'](_0x331282[0x0],this),'ContactId':this[_0xa1c8('0x9')]['id']};if(this[_0xa1c8('0xa')]===_0xa1c8('0xb')){_0x14d2f0['ChatWebsiteId']=this[_0xa1c8('0xc')]['id'];}else{_0x14d2f0[_[_0xa1c8('0xd')](this[_0xa1c8('0xa')])+'AccountId']=this['account']['id'];}_0x14d2f0[_[_0xa1c8('0xd')](this['channel'])+_0xa1c8('0xe')]=this['interaction']['id'];if(rpc[this['channel']+'Message']){return rpc[this[_0xa1c8('0xa')]+_0xa1c8('0xf')][_0xa1c8('0x10')](_0x14d2f0)[_0xa1c8('0x11')](function(_0x644e9c){logger[_0xa1c8('0x12')]('[%s][MESSAGE]\x20%s',_0x559330,_0x14d2f0[_0xa1c8('0x13')]);_0x14b85c[_0xa1c8('0x14')]();})[_0xa1c8('0x15')](function(_0x3797fe){logger[_0xa1c8('0x16')](_0xa1c8('0x17'),_0x559330,JSON['stringify'](_0x3797fe));_0x14b85c[_0xa1c8('0x18')]();});}}catch(_0x51b1c3){logger[_0xa1c8('0x16')](_0xa1c8('0x17'),_0x559330,JSON[_0xa1c8('0x19')](_0x51b1c3));_0x14b85c['stop']();}};}; \ No newline at end of file +var _0x0630=['next','catch','error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','contact','chat','channel','AccountId','account','upperFirst','interaction','Message','create','info','body'];(function(_0x15b5ce,_0x136582){var _0x11dec5=function(_0x20a26f){while(--_0x20a26f){_0x15b5ce['push'](_0x15b5ce['shift']());}};_0x11dec5(++_0x136582);}(_0x0630,0xde));var _0x0063=function(_0x4454e3,_0x1cc3e6){_0x4454e3=_0x4454e3-0x0;var _0x32010a=_0x0630[_0x4454e3];return _0x32010a;};'use strict';var _=require(_0x0063('0x0'));var utils=require(_0x0063('0x1'));var logger=require(_0x0063('0x2'))(_0x0063('0x3'));var rpc={'chatMessage':require(_0x0063('0x4')),'openchannelMessage':require(_0x0063('0x5')),'mailMessage':require(_0x0063('0x6')),'smsMessage':require(_0x0063('0x7')),'faxMessage':require(_0x0063('0x8')),'whatsappMessage':require(_0x0063('0x9'))};exports['consequence']=function(_0x46e442,_0x57a966){return function(_0x14ff3d){try{var _0x51e3e2={'body':utils['getMustacheRender'](_0x57a966[0x0],this),'ContactId':this[_0x0063('0xa')]['id']};if(this['channel']===_0x0063('0xb')){_0x51e3e2['ChatWebsiteId']=this['account']['id'];}else{_0x51e3e2[_['upperFirst'](this[_0x0063('0xc')])+_0x0063('0xd')]=this[_0x0063('0xe')]['id'];}_0x51e3e2[_[_0x0063('0xf')](this[_0x0063('0xc')])+'InteractionId']=this[_0x0063('0x10')]['id'];if(rpc[this[_0x0063('0xc')]+_0x0063('0x11')]){return rpc[this[_0x0063('0xc')]+_0x0063('0x11')][_0x0063('0x12')](_0x51e3e2)['then'](function(_0xdc2d32){logger[_0x0063('0x13')]('[%s][MESSAGE]\x20%s',_0x46e442,_0x51e3e2[_0x0063('0x14')]);_0x14ff3d[_0x0063('0x15')]();})[_0x0063('0x16')](function(_0x5aefbd){logger[_0x0063('0x17')](_0x0063('0x18'),_0x46e442,JSON[_0x0063('0x19')](_0x5aefbd));_0x14ff3d[_0x0063('0x1a')]();});}}catch(_0x222370){logger['error']('[%s][MESSAGE]\x20%s',_0x46e442,JSON[_0x0063('0x19')](_0x222370));_0x14ff3d[_0x0063('0x1a')]();}};}; \ 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 88af881..167bdd0 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 _0x0d29=['next','error','[%s][NOOP]\x20%s','stringify','stop','./utils','../../../../config/logger','routing','consequence','info','getMustacheRender'];(function(_0x2608cc,_0x550602){var _0x671ece=function(_0x35a8ee){while(--_0x35a8ee){_0x2608cc['push'](_0x2608cc['shift']());}};_0x671ece(++_0x550602);}(_0x0d29,0x1bd));var _0x90d2=function(_0x568b4a,_0x4f0a51){_0x568b4a=_0x568b4a-0x0;var _0xd4b3cd=_0x0d29[_0x568b4a];return _0xd4b3cd;};'use strict';var utils=require(_0x90d2('0x0'));var logger=require(_0x90d2('0x1'))(_0x90d2('0x2'));exports[_0x90d2('0x3')]=function(_0x37e22f,_0x3e6463){return function(_0x446622){try{logger[_0x90d2('0x4')]('[%s][NOOP]\x20%s',_0x37e22f,utils[_0x90d2('0x5')](_0x3e6463[0x0],this));_0x446622[_0x90d2('0x6')]();}catch(_0x3247a5){logger[_0x90d2('0x7')](_0x90d2('0x8'),_0x37e22f,JSON[_0x90d2('0x9')](_0x3247a5));_0x446622[_0x90d2('0xa')]();}};}; \ No newline at end of file +var _0x9412=['info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger'];(function(_0x52040e,_0x201cc2){var _0xe26c7b=function(_0x5f56d1){while(--_0x5f56d1){_0x52040e['push'](_0x52040e['shift']());}};_0xe26c7b(++_0x201cc2);}(_0x9412,0x8e));var _0x2941=function(_0x24306d,_0x17542d){_0x24306d=_0x24306d-0x0;var _0x8e197d=_0x9412[_0x24306d];return _0x8e197d;};'use strict';var utils=require(_0x2941('0x0'));var logger=require(_0x2941('0x1'))('routing');exports['consequence']=function(_0x31c37d,_0x444772){return function(_0x1b6278){try{logger[_0x2941('0x2')](_0x2941('0x3'),_0x31c37d,utils[_0x2941('0x4')](_0x444772[0x0],this));_0x1b6278[_0x2941('0x5')]();}catch(_0x494e04){logger[_0x2941('0x6')](_0x2941('0x3'),_0x31c37d,JSON[_0x2941('0x7')](_0x494e04));_0x1b6278[_0x2941('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index a6cc3ab..2a5f3b2 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 _0xb609=['../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','interaction','MessageId','message','chat','WebsiteId','name','create','catch','error','YYYY-MM-DD\x20HH:mm:ss','info','[%s][STOP:QUEUE][NAME:%s]','Interaction','then','QueueReport','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','find','createQueue','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','seq-queue','moment','../../../../config/logger','routing','./strategy','redis','localhost','socket.io-emitter','account','queue','from','joinAt','emit','queue_id','push','%sQueuesWaitingInteractions','pick','format','save','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport'];(function(_0x357fe8,_0x5379d6){var _0x228861=function(_0x5e59cf){while(--_0x5e59cf){_0x357fe8['push'](_0x357fe8['shift']());}};_0x228861(++_0x5379d6);}(_0xb609,0x12f));var _0x9b60=function(_0x64f407,_0x1c4136){_0x64f407=_0x64f407-0x0;var _0x15b1dd=_0xb609[_0x64f407];return _0x15b1dd;};'use strict';var schema=require(_0x9b60('0x0'));var _=require(_0x9b60('0x1'));var util=require('util');var seqqueue=require(_0x9b60('0x2'));var moment=require(_0x9b60('0x3'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x9b60('0x4'))(_0x9b60('0x5'));var strategy=require(_0x9b60('0x6'));config[_0x9b60('0x7')]=_['defaults'](config[_0x9b60('0x7')],{'host':_0x9b60('0x8'),'port':0x18eb});var io=require(_0x9b60('0x9'))(new Redis(config[_0x9b60('0x7')]));var attributes=['id','queue_id',_0x9b60('0xa'),_0x9b60('0xb'),_0x9b60('0xc'),_0x9b60('0xd')];function emit(_0x4de68a,_0xf4dbaf,_0x2af510){io['to'](_0x4de68a)[_0x9b60('0xe')](_0xf4dbaf,_0x2af510);}function emitChannelQueueInteraction(_0x2482be,_0x4245d5,_0x1b87b2,_0x475477,_0x43607f,_0x5609dd,_0x629a7a,_0x5b39d2){var _0x17a97c=_['clone'](_0x1b87b2);_0x17a97c[_0x9b60('0xf')]=_0x5b39d2;_0x17a97c['queue']=_0x4245d5;_0x17a97c[_0x9b60('0xa')]=_0x475477;_0x17a97c['id']=_0x43607f;if(_0x5609dd){attributes[_0x9b60('0x10')](_['capitalize'](_0x2482be)+'InteractionId');_0x629a7a[util['format'](_0x9b60('0x11'),_0x2482be)][_0x43607f]=_[_0x9b60('0x12')](_0x17a97c,attributes);}else{delete _0x629a7a[util[_0x9b60('0x13')]('%sQueuesWaitingInteractions',_0x2482be)][_0x43607f];}emit(util['format']('%s:queue:%s',_0x2482be,_0x4245d5),util[_0x9b60('0x13')]('%s_queue_waiting_interaction:%s',_0x2482be,_0x5609dd?_0x9b60('0x14'):_0x9b60('0x15')),_[_0x9b60('0x12')](_0x17a97c,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x9b60('0x16')),'chatQueueReport':require(_0x9b60('0x17')),'smsQueueReport':require(_0x9b60('0x18')),'faxQueueReport':require(_0x9b60('0x19')),'whatsappQueueReport':require(_0x9b60('0x1a')),'chatInteraction':require(_0x9b60('0x1b')),'faxInteraction':require(_0x9b60('0x1c')),'mailInteraction':require('../../rpc/mailInteraction'),'openchannelInteraction':require(_0x9b60('0x1d')),'smsInteraction':require(_0x9b60('0x1e')),'whatsappInteraction':require(_0x9b60('0x1f'))};var queue=schema({'name':{'type':_0x9b60('0x20'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x9b60('0x21'),'message':_0x9b60('0x22')}});function startRouting(_0x2c83e4,_0x5118e5,_0x24ef92,_0x27d74f){if(_0x2c83e4&&_0x5118e5&&_0x24ef92){_0x5118e5[_0x9b60('0x23')]+=0x1;var _0x29511d={'uniqueid':_0x2c83e4,'from':_0x24ef92['body']?_0x24ef92[_0x9b60('0x24')][_0x9b60('0xc')]:'','joinAt':moment()[_0x9b60('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x24ef92[_0x9b60('0x25')]?_0x24ef92['contact']['id']:null,'ListId':_0x24ef92[_0x9b60('0x26')]?_0x24ef92[_0x9b60('0x26')]['id']:null};_0x29511d[_[_0x9b60('0x27')](_0x24ef92[_0x9b60('0x28')])+'QueueId']=_0x5118e5['id']||null;_0x29511d[_['upperFirst'](_0x24ef92[_0x9b60('0x28')])+'InteractionId']=_0x24ef92[_0x9b60('0x29')]?_0x24ef92[_0x9b60('0x29')]['id']:null;_0x29511d[_[_0x9b60('0x27')](_0x24ef92[_0x9b60('0x28')])+_0x9b60('0x2a')]=_0x24ef92[_0x9b60('0x2b')]?_0x24ef92[_0x9b60('0x2b')]['id']:null;_0x29511d[_['upperFirst'](_0x24ef92[_0x9b60('0x28')])+(_0x24ef92[_0x9b60('0x28')]!==_0x9b60('0x2c')?'AccountId':_0x9b60('0x2d'))]=_0x24ef92[_0x9b60('0xa')]?_0x24ef92[_0x9b60('0xa')]['id']:null;logger['info'](util[_0x9b60('0x13')]('[%s][START:QUEUE][NAME:%s]',_0x2c83e4,_0x5118e5['name']));emitChannelQueueInteraction(_0x24ef92[_0x9b60('0x28')],_0x5118e5['name'],_0x29511d,_0x24ef92[_0x9b60('0xa')][_0x9b60('0x2e')],_0x24ef92[_0x9b60('0x2b')]['id'],!![],_0x27d74f,_0x5118e5['id']);if(rpc[_0x24ef92['channel']+'QueueReport']){return rpc[_0x24ef92['channel']+'QueueReport'][_0x9b60('0x2f')](_0x29511d)[_0x9b60('0x30')](function(_0x3e3dc7){logger[_0x9b60('0x31')]('create\x20queue\x20report',_0x3e3dc7);});}}}function stopRouting(_0x38d052,_0x5ae8e3,_0x30b3fd,_0x10adac){if(_0x38d052&&_0x5ae8e3){_0x5ae8e3[_0x9b60('0x23')]-=0x1;var _0x3126fd={'leaveAt':moment()['format'](_0x9b60('0x32')),'acceptAt':moment()[_0x9b60('0x13')](_0x9b60('0x32')),'reason':'accepted'};logger[_0x9b60('0x33')](util[_0x9b60('0x13')](_0x9b60('0x34'),_0x38d052,_0x5ae8e3[_0x9b60('0x2e')]));emitChannelQueueInteraction(_0x30b3fd[_0x9b60('0x28')],_0x5ae8e3[_0x9b60('0x2e')],_0x30b3fd['body'],_0x30b3fd[_0x9b60('0xa')][_0x9b60('0x2e')],_0x30b3fd[_0x9b60('0x2b')]['id'],![],_0x10adac,_0x5ae8e3['id']);return rpc[_0x30b3fd['channel']+_0x9b60('0x35')]['update'](_0x30b3fd[_0x9b60('0x29')]['id'],{'queueId':_0x5ae8e3['id']})[_0x9b60('0x36')](function(){if(rpc[_0x30b3fd['channel']+'QueueReport']){return rpc[_0x30b3fd['channel']+_0x9b60('0x37')][_0x9b60('0x38')](_0x38d052,_0x3126fd)[_0x9b60('0x30')](function(_0x47421c){logger[_0x9b60('0x31')](_0x9b60('0x39'),_0x47421c);});}});}}function endRouting(_0x1f19da,_0x5015fc,_0xfcc8d2,_0x571be8){if(_0x1f19da&&_0x5015fc){_0x5015fc[_0x9b60('0x23')]-=0x1;var _0x33c302={'leaveAt':moment()['format'](_0x9b60('0x32')),'exitAt':moment()['format'](_0x9b60('0x32')),'reason':_0x9b60('0x3a')};logger[_0x9b60('0x33')](util[_0x9b60('0x13')](_0x9b60('0x3b'),_0x1f19da,_0x5015fc[_0x9b60('0x2e')]));emitChannelQueueInteraction(_0xfcc8d2['channel'],_0x5015fc[_0x9b60('0x2e')],_0xfcc8d2[_0x9b60('0x24')],_0xfcc8d2[_0x9b60('0xa')][_0x9b60('0x2e')],_0xfcc8d2['message']['id'],![],_0x571be8);if(rpc[_0xfcc8d2[_0x9b60('0x28')]+'QueueReport']){return rpc[_0xfcc8d2[_0x9b60('0x28')]+'QueueReport'][_0x9b60('0x38')](_0x1f19da,_0x33c302)[_0x9b60('0x30')](function(_0x1bc439){logger[_0x9b60('0x31')]('update\x20queue\x20report',_0x1bc439);});}}}function handleFindQueue(_0xd079c7){return function(_0x523480){return _0x523480[_0x9b60('0x2e')][_0x9b60('0x3c')]()===_0xd079c7[_0x9b60('0x3c')]();};}exports[_0x9b60('0x3d')]=function(_0x20e010,_0x3ad62a,_0x4e2d26,_0x5d0715){return function(_0x58a37e){try{var _0x56b42d={'name':_0x3ad62a[0x0],'timeout':_0x3ad62a[0x1]};var _0xc7c402=queue[_0x9b60('0x0')](_0x56b42d,{'typecast':!![]});if(_0xc7c402[_0x9b60('0x3e')]){logger[_0x9b60('0x31')](_0x9b60('0x3f'),_0x20e010,_[_0x9b60('0x40')](_0xc7c402,_0x9b60('0x2b'))[_0x9b60('0x41')](',\x20'));_0x58a37e['stop']();}else{var _0x3e2c3c=_[_0x9b60('0x42')](_0x4e2d26[_0x5d0715[_0x9b60('0x28')]+'Queues'],handleFindQueue(_0x56b42d[_0x9b60('0x2e')]));if(_0x3e2c3c){startRouting(_0x20e010,_0x3e2c3c,_0x5d0715,_0x4e2d26);var _0x5da25d=(_0x3e2c3c[_0x9b60('0x3a')]||0xa)*0x3e8;var _0x429d14=(_0x56b42d[_0x9b60('0x3a')]||0x14)*0x3e8;var _0x2e2e81;if(_0x5da25d>_0x429d14){_0x429d14=_0x5da25d;}var _0x1f6bdd=seqqueue[_0x9b60('0x43')](_0x5da25d);_0x1f6bdd['id']=_0x20e010;_0x1f6bdd[_0x9b60('0x44')]=_0x5da25d;_0x1f6bdd[_0x9b60('0x45')]=_0x429d14;_0x1f6bdd[_0x9b60('0x28')]=_0x5d0715[_0x9b60('0x28')];_0x4e2d26['rules'][_0x20e010]['on'](_0x9b60('0x46'),function(){logger[_0x9b60('0x33')](_0x9b60('0x47'),_0x20e010);stopRouting(_0x20e010,_0x3e2c3c,_0x5d0715,_0x4e2d26);clearTimeout(_0x2e2e81);_0x2e2e81=undefined;_0x1f6bdd[_0x9b60('0x48')](!![]);if(_0x4e2d26['rules'][_0x20e010]){delete _0x4e2d26[_0x9b60('0x49')][_0x20e010];}_0x58a37e[_0x9b60('0x4a')]();});_0x4e2d26[_0x9b60('0x49')][_0x20e010]['on'](_0x9b60('0x4b'),function(){if(_0x4e2d26[_0x9b60('0x49')][_0x20e010]){delete _0x4e2d26[_0x9b60('0x49')][_0x20e010];}});_0x2e2e81=setTimeout(function(){logger[_0x9b60('0x33')](_0x9b60('0x4c'),_0x20e010);endRouting(_0x20e010,_0x3e2c3c,_0x5d0715,_0x4e2d26);clearTimeout(_0x2e2e81);_0x1f6bdd[_0x9b60('0x48')](!![]);_0x58a37e[_0x9b60('0x4d')]();},_0x429d14);switch(_0x3e2c3c['strategy']){case _0x9b60('0x4e'):strategy[_0x9b60('0x4e')](_0x1f6bdd,_0x3e2c3c,_0x4e2d26,_0x5d0715);break;default:strategy[_0x9b60('0x4f')](_0x1f6bdd,_0x3e2c3c,_0x4e2d26,_0x5d0715);}}else{logger[_0x9b60('0x31')](_0x9b60('0x50'),_0x20e010,_0x56b42d[_0x9b60('0x2e')]);_0x58a37e['stop']();}}}catch(_0x52b929){logger['error'](_0x9b60('0x3f'),_0x20e010,_0x52b929[_0x9b60('0x51')]);_0x58a37e['stop']();}};}; \ No newline at end of file +var _0x3970=['InteractionId','format','pick','%sQueuesWaitingInteractions','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','interaction','MessageId','upperFirst','chat','AccountId','WebsiteId','account','info','[%s][START:QUEUE][NAME:%s]','name','message','QueueReport','create','catch','[%s][STOP:QUEUE][NAME:%s]','body','Interaction','update','update\x20queue\x20report','timeout','toLowerCase','length','[%s][QUEUE]\x20%s','map','find','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','error','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','validate','lodash','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','defaults','redis','localhost','socket.io-emitter','queue_id','from','joinAt','emit','queue','push'];(function(_0x11fb3f,_0x500f21){var _0x4d45bf=function(_0x40ca7a){while(--_0x40ca7a){_0x11fb3f['push'](_0x11fb3f['shift']());}};_0x4d45bf(++_0x500f21);}(_0x3970,0x1d4));var _0x0397=function(_0x2dc96f,_0x459058){_0x2dc96f=_0x2dc96f-0x0;var _0xd012da=_0x3970[_0x2dc96f];return _0xd012da;};'use strict';var schema=require(_0x0397('0x0'));var _=require(_0x0397('0x1'));var util=require('util');var seqqueue=require(_0x0397('0x2'));var moment=require('moment');var Redis=require(_0x0397('0x3'));var config=require(_0x0397('0x4'));var logger=require(_0x0397('0x5'))(_0x0397('0x6'));var strategy=require(_0x0397('0x7'));config['redis']=_[_0x0397('0x8')](config[_0x0397('0x9')],{'host':_0x0397('0xa'),'port':0x18eb});var io=require(_0x0397('0xb'))(new Redis(config[_0x0397('0x9')]));var attributes=['id',_0x0397('0xc'),'account','queue',_0x0397('0xd'),_0x0397('0xe')];function emit(_0x2bba66,_0x4b87cf,_0x22566b){io['to'](_0x2bba66)[_0x0397('0xf')](_0x4b87cf,_0x22566b);}function emitChannelQueueInteraction(_0x418f47,_0x546324,_0x38fb53,_0x187321,_0xd10906,_0x53abb0,_0x1f5abc,_0x39bd87){var _0x395106=_['clone'](_0x38fb53);_0x395106['queue_id']=_0x39bd87;_0x395106[_0x0397('0x10')]=_0x546324;_0x395106['account']=_0x187321;_0x395106['id']=_0xd10906;if(_0x53abb0){attributes[_0x0397('0x11')](_['capitalize'](_0x418f47)+_0x0397('0x12'));_0x1f5abc[util[_0x0397('0x13')]('%sQueuesWaitingInteractions',_0x418f47)][_0xd10906]=_[_0x0397('0x14')](_0x395106,attributes);}else{delete _0x1f5abc[util[_0x0397('0x13')](_0x0397('0x15'),_0x418f47)][_0xd10906];}emit(util[_0x0397('0x13')]('%s:queue:%s',_0x418f47,_0x546324),util['format'](_0x0397('0x16'),_0x418f47,_0x53abb0?_0x0397('0x17'):_0x0397('0x18')),_['pick'](_0x395106,attributes));}var rpc={'openchannelQueueReport':require(_0x0397('0x19')),'mailQueueReport':require(_0x0397('0x1a')),'chatQueueReport':require(_0x0397('0x1b')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0x0397('0x1c')),'mailInteraction':require(_0x0397('0x1d')),'openchannelInteraction':require(_0x0397('0x1e')),'smsInteraction':require(_0x0397('0x1f')),'whatsappInteraction':require(_0x0397('0x20'))};var queue=schema({'name':{'type':_0x0397('0x21'),'required':!![],'message':_0x0397('0x22')},'timeout':{'type':_0x0397('0x23'),'message':_0x0397('0x24')}});function startRouting(_0xb4a13e,_0x53ef24,_0x3af351,_0x2eaf4d){if(_0xb4a13e&&_0x53ef24&&_0x3af351){_0x53ef24[_0x0397('0x25')]+=0x1;var _0x3d43f0={'uniqueid':_0xb4a13e,'from':_0x3af351['body']?_0x3af351['body'][_0x0397('0xd')]:'','joinAt':moment()[_0x0397('0x13')](_0x0397('0x26')),'ContactId':_0x3af351['contact']?_0x3af351[_0x0397('0x27')]['id']:null,'ListId':_0x3af351[_0x0397('0x28')]?_0x3af351[_0x0397('0x28')]['id']:null};_0x3d43f0[_['upperFirst'](_0x3af351[_0x0397('0x29')])+_0x0397('0x2a')]=_0x53ef24['id']||null;_0x3d43f0[_['upperFirst'](_0x3af351[_0x0397('0x29')])+_0x0397('0x12')]=_0x3af351[_0x0397('0x2b')]?_0x3af351[_0x0397('0x2b')]['id']:null;_0x3d43f0[_['upperFirst'](_0x3af351[_0x0397('0x29')])+_0x0397('0x2c')]=_0x3af351['message']?_0x3af351['message']['id']:null;_0x3d43f0[_[_0x0397('0x2d')](_0x3af351[_0x0397('0x29')])+(_0x3af351['channel']!==_0x0397('0x2e')?_0x0397('0x2f'):_0x0397('0x30'))]=_0x3af351[_0x0397('0x31')]?_0x3af351[_0x0397('0x31')]['id']:null;logger[_0x0397('0x32')](util[_0x0397('0x13')](_0x0397('0x33'),_0xb4a13e,_0x53ef24[_0x0397('0x34')]));emitChannelQueueInteraction(_0x3af351[_0x0397('0x29')],_0x53ef24[_0x0397('0x34')],_0x3d43f0,_0x3af351['account'][_0x0397('0x34')],_0x3af351[_0x0397('0x35')]['id'],!![],_0x2eaf4d,_0x53ef24['id']);if(rpc[_0x3af351[_0x0397('0x29')]+_0x0397('0x36')]){return rpc[_0x3af351[_0x0397('0x29')]+_0x0397('0x36')][_0x0397('0x37')](_0x3d43f0)[_0x0397('0x38')](function(_0x4a1573){logger['error']('create\x20queue\x20report',_0x4a1573);});}}}function stopRouting(_0x2b33f5,_0x46c2b7,_0x360ceb,_0x57b54c){if(_0x2b33f5&&_0x46c2b7){_0x46c2b7[_0x0397('0x25')]-=0x1;var _0x64dc34={'leaveAt':moment()[_0x0397('0x13')](_0x0397('0x26')),'acceptAt':moment()['format'](_0x0397('0x26')),'reason':'accepted'};logger[_0x0397('0x32')](util[_0x0397('0x13')](_0x0397('0x39'),_0x2b33f5,_0x46c2b7[_0x0397('0x34')]));emitChannelQueueInteraction(_0x360ceb['channel'],_0x46c2b7[_0x0397('0x34')],_0x360ceb[_0x0397('0x3a')],_0x360ceb['account'][_0x0397('0x34')],_0x360ceb[_0x0397('0x35')]['id'],![],_0x57b54c,_0x46c2b7['id']);return rpc[_0x360ceb[_0x0397('0x29')]+_0x0397('0x3b')][_0x0397('0x3c')](_0x360ceb['interaction']['id'],{'queueId':_0x46c2b7['id']})['then'](function(){if(rpc[_0x360ceb[_0x0397('0x29')]+_0x0397('0x36')]){return rpc[_0x360ceb[_0x0397('0x29')]+'QueueReport'][_0x0397('0x3c')](_0x2b33f5,_0x64dc34)[_0x0397('0x38')](function(_0xa02c97){logger['error'](_0x0397('0x3d'),_0xa02c97);});}});}}function endRouting(_0x2200b5,_0x38285e,_0x329313,_0x1c784c){if(_0x2200b5&&_0x38285e){_0x38285e[_0x0397('0x25')]-=0x1;var _0x30fb1e={'leaveAt':moment()[_0x0397('0x13')](_0x0397('0x26')),'exitAt':moment()['format'](_0x0397('0x26')),'reason':_0x0397('0x3e')};logger['info'](util[_0x0397('0x13')]('[%s][END:QUEUE][NAME:%s]',_0x2200b5,_0x38285e[_0x0397('0x34')]));emitChannelQueueInteraction(_0x329313[_0x0397('0x29')],_0x38285e[_0x0397('0x34')],_0x329313[_0x0397('0x3a')],_0x329313[_0x0397('0x31')]['name'],_0x329313[_0x0397('0x35')]['id'],![],_0x1c784c);if(rpc[_0x329313[_0x0397('0x29')]+'QueueReport']){return rpc[_0x329313[_0x0397('0x29')]+_0x0397('0x36')][_0x0397('0x3c')](_0x2200b5,_0x30fb1e)[_0x0397('0x38')](function(_0x1292ba){logger['error'](_0x0397('0x3d'),_0x1292ba);});}}}function handleFindQueue(_0x4c51fc){return function(_0x235c21){return _0x235c21['name']['toLowerCase']()===_0x4c51fc[_0x0397('0x3f')]();};}exports['consequence']=function(_0x4eb320,_0x446b47,_0x2f353d,_0x4d7435){return function(_0x12f2d9){try{var _0x527169={'name':_0x446b47[0x0],'timeout':_0x446b47[0x1]};var _0x55c822=queue[_0x0397('0x0')](_0x527169,{'typecast':!![]});if(_0x55c822[_0x0397('0x40')]){logger['error'](_0x0397('0x41'),_0x4eb320,_[_0x0397('0x42')](_0x55c822,_0x0397('0x35'))['join'](',\x20'));_0x12f2d9['stop']();}else{var _0x8669d3=_[_0x0397('0x43')](_0x2f353d[_0x4d7435[_0x0397('0x29')]+'Queues'],handleFindQueue(_0x527169[_0x0397('0x34')]));if(_0x8669d3){startRouting(_0x4eb320,_0x8669d3,_0x4d7435,_0x2f353d);var _0x5aa5ea=(_0x8669d3['timeout']||0xa)*0x3e8;var _0x2949f5=(_0x527169['timeout']||0x14)*0x3e8;var _0x767941;if(_0x5aa5ea>_0x2949f5){_0x2949f5=_0x5aa5ea;}var _0x437615=seqqueue['createQueue'](_0x5aa5ea);_0x437615['id']=_0x4eb320;_0x437615['atimeout']=_0x5aa5ea;_0x437615[_0x0397('0x44')]=_0x2949f5;_0x437615['channel']=_0x4d7435['channel'];_0x2f353d[_0x0397('0x45')][_0x4eb320]['on'](_0x0397('0x46'),function(){logger[_0x0397('0x32')](_0x0397('0x47'),_0x4eb320);stopRouting(_0x4eb320,_0x8669d3,_0x4d7435,_0x2f353d);clearTimeout(_0x767941);_0x767941=undefined;_0x437615['close'](!![]);if(_0x2f353d['rules'][_0x4eb320]){delete _0x2f353d[_0x0397('0x45')][_0x4eb320];}_0x12f2d9[_0x0397('0x48')]();});_0x2f353d[_0x0397('0x45')][_0x4eb320]['on'](_0x0397('0x49'),function(){if(_0x2f353d[_0x0397('0x45')][_0x4eb320]){delete _0x2f353d[_0x0397('0x45')][_0x4eb320];}});_0x767941=setTimeout(function(){logger[_0x0397('0x32')](_0x0397('0x4a'),_0x4eb320);endRouting(_0x4eb320,_0x8669d3,_0x4d7435,_0x2f353d);clearTimeout(_0x767941);_0x437615['close'](!![]);_0x12f2d9[_0x0397('0x4b')]();},_0x2949f5);switch(_0x8669d3[_0x0397('0x4c')]){case'rrmemory':strategy[_0x0397('0x4d')](_0x437615,_0x8669d3,_0x2f353d,_0x4d7435);break;default:strategy[_0x0397('0x4e')](_0x437615,_0x8669d3,_0x2f353d,_0x4d7435);}}else{logger[_0x0397('0x4f')](_0x0397('0x50'),_0x4eb320,_0x527169[_0x0397('0x34')]);_0x12f2d9[_0x0397('0x48')]();}}}catch(_0x1263de){logger[_0x0397('0x4f')](_0x0397('0x41'),_0x4eb320,_0x1263de['stack']);_0x12f2d9[_0x0397('0x48')]();}};}; \ 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 eb3cf46..1c82975 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 _0x54ef=['[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','agent','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','saveWaitingNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','routing','notificationId','squeue','push','bind','handleTimeout','drained','prototype','handleRun','handleDrained','debug'];(function(_0x131687,_0x3d710a){var _0x1e6346=function(_0x58a9d6){while(--_0x58a9d6){_0x131687['push'](_0x131687['shift']());}};_0x1e6346(++_0x3d710a);}(_0x54ef,0x112));var _0xf54e=function(_0x597c60,_0x48dad4){_0x597c60=_0x597c60-0x0;var _0x418147=_0x54ef[_0x597c60];return _0x418147;};'use strict';var _=require(_0xf54e('0x0'));var uuid=require(_0xf54e('0x1'));var util=require(_0xf54e('0x2'));var logger=require('../../../../../config/logger')(_0xf54e('0x3'));var Agent=function(_0x18b7d6,_0x18b1cf,_0x42b9b2,_0x8b6bb6){this[_0xf54e('0x4')]=uuid['v4']();this[_0xf54e('0x5')]=_0x18b7d6;this['agent']=_0x18b1cf;this['realtime']=_0x42b9b2;this[_0xf54e('0x3')]=_0x8b6bb6;this[_0xf54e('0x5')][_0xf54e('0x6')](this['handleRun'][_0xf54e('0x7')](this),this['handleTimeout'][_0xf54e('0x7')](this));this[_0xf54e('0x5')]['on']('timeout',this[_0xf54e('0x8')][_0xf54e('0x7')](this));this[_0xf54e('0x5')]['on'](_0xf54e('0x9'),this['handleDrained'][_0xf54e('0x7')](this));};Agent[_0xf54e('0xa')][_0xf54e('0x6')]=function(){this[_0xf54e('0x5')]['push'](this[_0xf54e('0xb')]['bind'](this),this['handleTimeout'][_0xf54e('0x7')](this));};Agent[_0xf54e('0xa')][_0xf54e('0xc')]=function(){this[_0xf54e('0x8')](!![]);};Agent['prototype'][_0xf54e('0xb')]=function(){logger[_0xf54e('0xd')](_0xf54e('0xe'),this[_0xf54e('0x5')]['id'],this['agent']['id']);if(_[_0xf54e('0xf')](this[_0xf54e('0x10')][_0xf54e('0x11')][this['agent']['id']])){logger['debug'](_0xf54e('0x12'),this[_0xf54e('0x5')]['id'],this[_0xf54e('0x13')]['id']);setTimeout(this[_0xf54e('0x6')][_0xf54e('0x7')](this),0x3e8);}else{if(this[_0xf54e('0x3')][_0xf54e('0x14')]||util[_0xf54e('0x15')](this[_0xf54e('0x5')]['id'],this[_0xf54e('0x10')][_0xf54e('0x11')][this['agent']['id']],this['squeue'][_0xf54e('0x16')],![])){this['realtime'][_0xf54e('0x11')][this[_0xf54e('0x13')]['id']][_0xf54e('0x17')]=!![];this[_0xf54e('0x10')][_0xf54e('0x11')][this[_0xf54e('0x13')]['id']][_0xf54e('0x18')]=undefined;util[_0xf54e('0x19')](this[_0xf54e('0x10')],this[_0xf54e('0x3')],this[_0xf54e('0x13')],this['squeue'][_0xf54e('0x16')]);util['showNotification'](this[_0xf54e('0x4')],this[_0xf54e('0x5')]['id'],this[_0xf54e('0x10')][_0xf54e('0x11')][this[_0xf54e('0x13')]['id']],null,this[_0xf54e('0x3')]);util[_0xf54e('0x1a')](this[_0xf54e('0x5')]['id'],this[_0xf54e('0x10')][_0xf54e('0x11')][this[_0xf54e('0x13')]['id']],_0xf54e('0x1b')+(this[_0xf54e('0x3')]['forcedOwnership']?_0xf54e('0x1c'):''));}else{logger['debug'](_0xf54e('0x1d'),this['squeue']['id'],this[_0xf54e('0x13')]['id']);setTimeout(this[_0xf54e('0x6')][_0xf54e('0x7')](this),0x3e8);}}};Agent[_0xf54e('0xa')][_0xf54e('0x8')]=function(_0x3993e4){if(_[_0xf54e('0xf')](this['realtime']['agents'][this[_0xf54e('0x13')]['id']])){return logger[_0xf54e('0xd')](_0xf54e('0x12'),this[_0xf54e('0x5')]['id'],this[_0xf54e('0x13')]['id']);}else{logger[_0xf54e('0xd')](_0xf54e('0x1e'),this[_0xf54e('0x5')]['id'],this[_0xf54e('0x13')]['id']);util[_0xf54e('0x1f')](this['notificationId'],this['squeue']['id'],this[_0xf54e('0x10')][_0xf54e('0x11')][this['agent']['id']],null,this[_0xf54e('0x3')]);this[_0xf54e('0x10')][_0xf54e('0x11')][this[_0xf54e('0x13')]['id']]['busy']=![];this['realtime']['agents'][this[_0xf54e('0x13')]['id']][_0xf54e('0x18')]=undefined;util[_0xf54e('0x20')](this[_0xf54e('0x10')],this[_0xf54e('0x3')],this[_0xf54e('0x13')],this['squeue']['channel']);util['writeLog'](this[_0xf54e('0x5')]['id'],this[_0xf54e('0x10')]['agents'][this['agent']['id']],_0x3993e4?_0xf54e('0x21'):_0xf54e('0x22'));}if(!_0x3993e4){setTimeout(this[_0xf54e('0x6')]['bind'](this),0x3e8);}};function agent(_0x14ecc8,_0x44a437,_0x50aeca,_0x38d7a0){return new Agent(_0x14ecc8,_0x44a437,_0x50aeca,_0x38d7a0);}module[_0xf54e('0x23')]=agent; \ No newline at end of file +var _0x0c02=['squeue','agent','realtime','handleTimeout','bind','timeout','push','handleRun','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','saveWaitingNotification','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','TIMEOUT','exports','uuid','./util','routing','notificationId'];(function(_0x206f4b,_0x346117){var _0x20599c=function(_0x2f15b3){while(--_0x2f15b3){_0x206f4b['push'](_0x206f4b['shift']());}};_0x20599c(++_0x346117);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var uuid=require(_0x20c0('0x0'));var util=require(_0x20c0('0x1'));var logger=require('../../../../../config/logger')(_0x20c0('0x2'));var Agent=function(_0x5c8750,_0x454922,_0x6d03d0,_0x38022e){this[_0x20c0('0x3')]=uuid['v4']();this[_0x20c0('0x4')]=_0x5c8750;this[_0x20c0('0x5')]=_0x454922;this[_0x20c0('0x6')]=_0x6d03d0;this[_0x20c0('0x2')]=_0x38022e;this['squeue']['push'](this['handleRun']['bind'](this),this[_0x20c0('0x7')][_0x20c0('0x8')](this));this[_0x20c0('0x4')]['on'](_0x20c0('0x9'),this[_0x20c0('0x7')][_0x20c0('0x8')](this));this['squeue']['on']('drained',this['handleDrained']['bind'](this));};Agent['prototype'][_0x20c0('0xa')]=function(){this[_0x20c0('0x4')][_0x20c0('0xa')](this[_0x20c0('0xb')]['bind'](this),this[_0x20c0('0x7')]['bind'](this));};Agent['prototype'][_0x20c0('0xc')]=function(){this[_0x20c0('0x7')](!![]);};Agent[_0x20c0('0xd')][_0x20c0('0xb')]=function(){logger[_0x20c0('0xe')](_0x20c0('0xf'),this[_0x20c0('0x4')]['id'],this[_0x20c0('0x5')]['id']);if(_[_0x20c0('0x10')](this['realtime'][_0x20c0('0x11')][this[_0x20c0('0x5')]['id']])){logger[_0x20c0('0xe')](_0x20c0('0x12'),this[_0x20c0('0x4')]['id'],this[_0x20c0('0x5')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this['routing'][_0x20c0('0x13')]||util[_0x20c0('0x14')](this[_0x20c0('0x4')]['id'],this[_0x20c0('0x6')]['agents'][this[_0x20c0('0x5')]['id']],this[_0x20c0('0x4')][_0x20c0('0x15')],![])){this['realtime']['agents'][this[_0x20c0('0x5')]['id']][_0x20c0('0x16')]=!![];this[_0x20c0('0x6')][_0x20c0('0x11')][this[_0x20c0('0x5')]['id']]['busyQueue']=undefined;util[_0x20c0('0x17')](this[_0x20c0('0x6')],this[_0x20c0('0x2')],this[_0x20c0('0x5')],this['squeue'][_0x20c0('0x15')]);util[_0x20c0('0x18')](this[_0x20c0('0x3')],this[_0x20c0('0x4')]['id'],this[_0x20c0('0x6')][_0x20c0('0x11')][this[_0x20c0('0x5')]['id']],null,this['routing']);util[_0x20c0('0x19')](this[_0x20c0('0x4')]['id'],this[_0x20c0('0x6')][_0x20c0('0x11')][this[_0x20c0('0x5')]['id']],_0x20c0('0x1a')+(this['routing']['forcedOwnership']?_0x20c0('0x1b'):''));}else{logger[_0x20c0('0xe')](_0x20c0('0x1c'),this['squeue']['id'],this[_0x20c0('0x5')]['id']);setTimeout(this[_0x20c0('0xa')][_0x20c0('0x8')](this),0x3e8);}}};Agent[_0x20c0('0xd')]['handleTimeout']=function(_0x49b738){if(_[_0x20c0('0x10')](this[_0x20c0('0x6')][_0x20c0('0x11')][this[_0x20c0('0x5')]['id']])){return logger[_0x20c0('0xe')](_0x20c0('0x12'),this[_0x20c0('0x4')]['id'],this[_0x20c0('0x5')]['id']);}else{logger[_0x20c0('0xe')](_0x20c0('0x1d'),this[_0x20c0('0x4')]['id'],this[_0x20c0('0x5')]['id']);util[_0x20c0('0x1e')](this[_0x20c0('0x3')],this['squeue']['id'],this[_0x20c0('0x6')][_0x20c0('0x11')][this[_0x20c0('0x5')]['id']],null,this[_0x20c0('0x2')]);this['realtime'][_0x20c0('0x11')][this[_0x20c0('0x5')]['id']][_0x20c0('0x16')]=![];this[_0x20c0('0x6')][_0x20c0('0x11')][this['agent']['id']][_0x20c0('0x1f')]=undefined;util['removeWaitingNotification'](this['realtime'],this[_0x20c0('0x2')],this[_0x20c0('0x5')],this[_0x20c0('0x4')][_0x20c0('0x15')]);util[_0x20c0('0x19')](this[_0x20c0('0x4')]['id'],this[_0x20c0('0x6')]['agents'][this['agent']['id']],_0x49b738?'STOP':_0x20c0('0x20'));}if(!_0x49b738){setTimeout(this[_0x20c0('0xa')]['bind'](this),0x3e8);}};function agent(_0x346a04,_0x20d6f3,_0x550d2c,_0x5a7641){return new Agent(_0x346a04,_0x20d6f3,_0x550d2c,_0x5a7641);}module[_0x20c0('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 f1b3c85..407d622 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 _0x3e1d=['agents','channel','writeLog','RINGING','name','saveWaitingNotification','showNotification','debug','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','busy','busyQueue','removeWaitingNotification','exports','lodash','uuid','./util','notificationId','squeue','queue','routing','push','bind','handleTimeout','timeout','handleDrained','handleRun','prototype','isNil','Agents','length','realtime','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable'];(function(_0x25b130,_0x35f449){var _0x492c97=function(_0x2186be){while(--_0x2186be){_0x25b130['push'](_0x25b130['shift']());}};_0x492c97(++_0x35f449);}(_0x3e1d,0x1a8));var _0xd3e1=function(_0x2d2a33,_0x2d1d1f){_0x2d2a33=_0x2d2a33-0x0;var _0x32d8ba=_0x3e1d[_0x2d2a33];return _0x32d8ba;};'use strict';var _=require(_0xd3e1('0x0'));var uuid=require(_0xd3e1('0x1'));var util=require(_0xd3e1('0x2'));var logger=require('../../../../../config/logger')('routing');var Beepall=function(_0x3e21ac,_0xf57191,_0x84c48e,_0x3e2cd7){this[_0xd3e1('0x3')]=uuid['v4']();this[_0xd3e1('0x4')]=_0x3e21ac;this[_0xd3e1('0x5')]=_0xf57191;this['realtime']=_0x84c48e;this[_0xd3e1('0x6')]=_0x3e2cd7;this['squeue'][_0xd3e1('0x7')](this['handleRun'][_0xd3e1('0x8')](this),this[_0xd3e1('0x9')]['bind'](this));this[_0xd3e1('0x4')]['on'](_0xd3e1('0xa'),this['handleTimeout'][_0xd3e1('0x8')](this));this[_0xd3e1('0x4')]['on']('drained',this[_0xd3e1('0xb')][_0xd3e1('0x8')](this));};Beepall['prototype']['push']=function(){this[_0xd3e1('0x4')]['push'](this[_0xd3e1('0xc')]['bind'](this),this[_0xd3e1('0x9')][_0xd3e1('0x8')](this));};Beepall[_0xd3e1('0xd')][_0xd3e1('0xb')]=function(){this[_0xd3e1('0x9')](!![]);};Beepall[_0xd3e1('0xd')][_0xd3e1('0xc')]=function(){var _0x368c83=!![];if(!_[_0xd3e1('0xe')](this[_0xd3e1('0x5')])&&!_[_0xd3e1('0xe')](this[_0xd3e1('0x5')]['Agents'])&&this[_0xd3e1('0x5')][_0xd3e1('0xf')]['length']>0x0){for(var _0x173505=0x0,_0x558ae5;_0x1735050x0){for(var _0x6b766e=0x0,_0x418f42;_0x6b766e0x0&&_0x10d3f2[_0x310d98+_0xa1a4('0x22')]>=_0x10d3f2[_0x310d98+'Capacity']){writeLog(_0x1abea1,_0x10d3f2,_0x310d98[_0xa1a4('0x23')]()+_0xa1a4('0x24'));return![];}}return!![];};exports[_0xa1a4('0x25')]=function(_0x1d2c23,_0x43f21f,_0x94b5be,_0x4af672,_0x5cf8c7){return sendNotification(!![],_0x1d2c23,_0x43f21f,_0x94b5be,_0x4af672,_0x5cf8c7);};exports[_0xa1a4('0x26')]=function(_0x5d1b75,_0x347ad0,_0x1cf5e0,_0x5268bc,_0x539a25){return sendNotification(![],_0x5d1b75,_0x347ad0,_0x1cf5e0,_0x5268bc,_0x539a25);};exports['checkWaitingNotifications']=function(_0x313db1,_0x4ccf6b,_0x437508){var _0x2be5d9=_0x4ccf6b[_0xa1a4('0x27')][_0xa1a4('0x28')];if(!_0x2be5d9&&_0x437508){_0x2be5d9=_0x437508['id'];}var _0x20c49e=_[_0xa1a4('0x29')](_0x313db1[_0x4ccf6b['channel']+'QueuesWaitingInteractions'],function(_0x4142aa){var _0x495cc8=_[_0xa1a4('0x2a')](_0x4ccf6b['channel'])+_0xa1a4('0x2b');return _0x4142aa[_0x495cc8]===_0x4ccf6b[_0xa1a4('0x27')]['id'];});if(!_0x20c49e&&_0x2be5d9&&_0x313db1[_0xa1a4('0x2c')][_0x2be5d9]){_0x20c49e=_['some'](_0x313db1[_0xa1a4('0x2c')][_0x2be5d9][_0x4ccf6b[_0xa1a4('0x2d')]+_0xa1a4('0x2e')],function(_0x5afa13){return _0x5afa13['id']===_0x4ccf6b['interaction']['id'];});}return _0x20c49e;};exports[_0xa1a4('0x2f')]=function(_0x1ceb0b,_0x59fe8a,_0x5ec77d,_0xe1b00a){if(_0x5ec77d&&_0x5ec77d['id']&&_0x1ceb0b[_0xa1a4('0x2c')]&&_0x1ceb0b['agents'][_0x5ec77d['id']]){_0x1ceb0b[_0xa1a4('0x2c')][_0x5ec77d['id']][_0xe1b00a+_0xa1a4('0x2e')][_0x59fe8a['message']['id']]={'id':_0x59fe8a[_0xa1a4('0x27')]['id']};}};exports['removeWaitingNotification']=function(_0xa1eaa2,_0x2061fb,_0x4446e1,_0x2973b2){if(_0x4446e1&&_0x4446e1['id']&&_0xa1eaa2[_0xa1a4('0x2c')]&&_0xa1eaa2[_0xa1a4('0x2c')][_0x4446e1['id']]){delete _0xa1eaa2[_0xa1a4('0x2c')][_0x4446e1['id']][_0x2973b2+_0xa1a4('0x2e')][_0x2061fb[_0xa1a4('0x13')]['id']];}};exports[_0xa1a4('0x30')]=writeLog; \ No newline at end of file +var _0xc38e=['split','name','account','notificationSound','notificationShake','body','queue','msg','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','message','emit','notification:%s','save','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','interaction','channel','QueuesWaitingInteractions','some','agents','WaitingInteractions','removeWaitingNotification','lodash','util','../utils','../../../../../config/environment','../../../../../config/logger','routing','redis','localhost','socket.io-emitter'];(function(_0x2732ec,_0x463c18){var _0x4222d2=function(_0x48c5e7){while(--_0x48c5e7){_0x2732ec['push'](_0x2732ec['shift']());}};_0x4222d2(++_0x463c18);}(_0xc38e,0x19e));var _0xec38=function(_0x25d189,_0x3cbc93){_0x25d189=_0x25d189-0x0;var _0x22cbf6=_0xc38e[_0x25d189];return _0x22cbf6;};'use strict';var _=require(_0xec38('0x0'));var util=require(_0xec38('0x1'));var utils=require(_0xec38('0x2'));var Redis=require('ioredis');var config=require(_0xec38('0x3'));var logger=require(_0xec38('0x4'))(_0xec38('0x5'));config[_0xec38('0x6')]=_['defaults'](config[_0xec38('0x6')],{'host':_0xec38('0x7'),'port':0x18eb});var io=require(_0xec38('0x8'))(new Redis(config[_0xec38('0x6')]));function sendNotification(_0x7213b6,_0x37c29d,_0x5e2264,_0x3dbf95,_0x1a46cc,_0x29b457){var _0x26230b=_0x29b457||{};var _0x999426=_0x5e2264[_0xec38('0x9')]('.');var _0x45af20={'uniqueid':_0x37c29d,'channel':_0x999426[0x0],'id':_0x999426[0x1],'title':_0x999426[0x0]+'\x20interaction','interactionId':_0x999426[0x2],'queue':_0x1a46cc?_0x1a46cc[_0xec38('0xa')]:null,'sound':_0x26230b[_0xec38('0xb')][_0xec38('0xc')],'shake':_0x26230b[_0xec38('0xb')][_0xec38('0xd')]};try{if(!_0x26230b[_0xec38('0xe')]){_0x26230b['body']={};}if(_0x1a46cc){_0x26230b['body']['queue']=_0x1a46cc;}else if(_0x26230b[_0xec38('0xe')][_0xec38('0xf')]){delete _0x26230b[_0xec38('0xe')][_0xec38('0xf')];}_0x45af20[_0xec38('0x10')]=utils['getMustacheRender'](_0x26230b[_0xec38('0xb')][_0xec38('0x11')],_0x26230b);}catch(_0x434513){_0x45af20[_0xec38('0x10')]=_0xec38('0x12');logger[_0xec38('0x13')](util[_0xec38('0x14')](_0xec38('0x15'),_0x37c29d,_0x434513[_0xec38('0x16')]));}io['to'](util[_0xec38('0x14')]('user:%s',_0x3dbf95[_0xec38('0xa')]))[_0xec38('0x17')](util[_0xec38('0x14')](_0xec38('0x18'),_0x7213b6?_0xec38('0x19'):'remove'),_0x45af20);}function writeLog(_0x10b349,_0x1459c5,_0x37c696){return logger['debug'](util[_0xec38('0x14')](_0xec38('0x1a'),_0x10b349,_0x1459c5[_0xec38('0xa')],_0x37c696));}exports[_0xec38('0x1b')]=function(_0x59c7d1,_0x4c6d76,_0x5a257c,_0x3c277f){if(_0x4c6d76[_0xec38('0x1c')]){writeLog(_0x59c7d1,_0x4c6d76,_0xec38('0x1d'));return![];}if(!_0x4c6d76[_0xec38('0x1e')]){writeLog(_0x59c7d1,_0x4c6d76,_0xec38('0x1f'));return![];}if(_0x4c6d76[_0x5a257c+_0xec38('0x20')]){writeLog(_0x59c7d1,_0x4c6d76,'PAUSE');return![];}if(_0x3c277f&&_0x4c6d76[_0xec38('0x21')](_0x5a257c+_0xec38('0x22'))&&_0x4c6d76[_0xec38('0x21')](_0x5a257c+_0xec38('0x23'))){if(_0x4c6d76[_0x5a257c+_0xec38('0x22')]>0x0&&_0x4c6d76[_0x5a257c+_0xec38('0x23')]>=_0x4c6d76[_0x5a257c+_0xec38('0x22')]){writeLog(_0x59c7d1,_0x4c6d76,_0x5a257c[_0xec38('0x24')]()+_0xec38('0x25'));return![];}}return!![];};exports[_0xec38('0x26')]=function(_0x32be18,_0x4d4ec7,_0x8a2a60,_0x42de48,_0x542d88){return sendNotification(!![],_0x32be18,_0x4d4ec7,_0x8a2a60,_0x42de48,_0x542d88);};exports[_0xec38('0x27')]=function(_0x312671,_0x419479,_0x380907,_0x54cef7,_0x38c4fb){return sendNotification(![],_0x312671,_0x419479,_0x380907,_0x54cef7,_0x38c4fb);};exports['checkWaitingNotifications']=function(_0x5079f9,_0x383fcc,_0x22c3ee){var _0x25f178=_0x383fcc[_0xec38('0x28')]['UserId'];if(!_0x25f178&&_0x22c3ee){_0x25f178=_0x22c3ee['id'];}var _0x1b9c1b=_['some'](_0x5079f9[_0x383fcc[_0xec38('0x29')]+_0xec38('0x2a')],function(_0x1e50b3){var _0x437cce=_['capitalize'](_0x383fcc[_0xec38('0x29')])+'InteractionId';return _0x1e50b3[_0x437cce]===_0x383fcc[_0xec38('0x28')]['id'];});if(!_0x1b9c1b&&_0x25f178&&_0x5079f9['agents'][_0x25f178]){_0x1b9c1b=_[_0xec38('0x2b')](_0x5079f9[_0xec38('0x2c')][_0x25f178][_0x383fcc[_0xec38('0x29')]+'WaitingInteractions'],function(_0x567a41){return _0x567a41['id']===_0x383fcc[_0xec38('0x28')]['id'];});}return _0x1b9c1b;};exports['saveWaitingNotification']=function(_0x1679c0,_0x180483,_0x5a2d1d,_0x2304a1){if(_0x5a2d1d&&_0x5a2d1d['id']&&_0x1679c0[_0xec38('0x2c')]&&_0x1679c0['agents'][_0x5a2d1d['id']]){_0x1679c0[_0xec38('0x2c')][_0x5a2d1d['id']][_0x2304a1+_0xec38('0x2d')][_0x180483[_0xec38('0x16')]['id']]={'id':_0x180483[_0xec38('0x28')]['id']};}};exports[_0xec38('0x2e')]=function(_0x391f42,_0x1955a2,_0x396248,_0x213f7d){if(_0x396248&&_0x396248['id']&&_0x391f42['agents']&&_0x391f42[_0xec38('0x2c')][_0x396248['id']]){delete _0x391f42[_0xec38('0x2c')][_0x396248['id']][_0x213f7d+_0xec38('0x2d')][_0x1955a2[_0xec38('0x16')]['id']];}};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 787b190..7df5ecb 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 _0x29d4=['trim','replace','isNil','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','error','isObject','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','lodash','./utils','../../../../config/logger','routing','string','consequence','length','[%s][SYSTEM]\x20%s','message','join','info','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s'];(function(_0x57dcf4,_0x394b84){var _0x5e5122=function(_0x2787d4){while(--_0x2787d4){_0x57dcf4['push'](_0x57dcf4['shift']());}};_0x5e5122(++_0x394b84);}(_0x29d4,0x1a1));var _0x429d=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x29d4[_0x18a79d];return _0x4f8848;};'use strict';var schema=require(_0x429d('0x0'));var sh=require('shelljs');var _=require(_0x429d('0x1'));var utils=require(_0x429d('0x2'));var logger=require(_0x429d('0x3'))(_0x429d('0x4'));var system=schema({'command':{'type':_0x429d('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x429d('0x6')]=function(_0x3f43f5,_0x36a3d8){return function(_0x5e2a9c){try{var _0x1c55aa={'command':_0x36a3d8[0x0]};var _0xa71445=system[_0x429d('0x0')](_0x1c55aa,{'typecast':!![]});if(_0xa71445[_0x429d('0x7')]){logger['error'](_0x429d('0x8'),_0x3f43f5,_['map'](_0xa71445,_0x429d('0x9'))[_0x429d('0xa')](',\x20'));logger[_0x429d('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x3f43f5);_0x5e2a9c[_0x429d('0xc')]();}else{var _0x8c7cb6=this;var _0x5993cc=utils[_0x429d('0xd')](_0x36a3d8[0x0],this);logger[_0x429d('0xb')](_0x429d('0xe'),_0x3f43f5,_0x5993cc);sh['exec'](_[_0x429d('0xf')](_0x5993cc),function(_0x1f7a35,_0x1d933b){logger[_0x429d('0xb')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x3f43f5,_0x1f7a35);if(_0x1f7a35==0x0){var _0x1c542c=_0x1d933b[_0x429d('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0x429d('0x11')](_0x36a3d8[0x1])||_['isEmpty'](_0x36a3d8[0x1])){logger[_0x429d('0xb')](_0x429d('0x12'),_0x3f43f5);_0x8c7cb6['body'][_0x36a3d8[0x1]]=_0x1c542c;}else{logger[_0x429d('0xb')](_0x429d('0x13'),_0x3f43f5,_0x36a3d8[0x1],_0x1c542c);_0x8c7cb6[_0x429d('0x14')][_0x36a3d8[0x1]]=_0x1c542c;}}_0x5e2a9c[_0x429d('0xc')]();});}}catch(_0x8c8a15){logger[_0x429d('0x15')]('[%s][SYSTEM]\x20%s',_0x3f43f5,_[_0x429d('0x16')](_0x8c8a15)?JSON['stringify'](_0x8c8a15):_0x8c8a15);logger[_0x429d('0xb')](_0x429d('0x17'),_0x3f43f5);_0x5e2a9c[_0x429d('0xc')]();}};}; \ No newline at end of file +var _0x550e=['isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','next','validate','shelljs','lodash','./utils','routing','string','length','error','[%s][SYSTEM]\x20%s','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x550e,0x9d));var _0xe550=function(_0x58c55b,_0x200c8f){_0x58c55b=_0x58c55b-0x0;var _0x234426=_0x550e[_0x58c55b];return _0x234426;};'use strict';var schema=require(_0xe550('0x0'));var sh=require(_0xe550('0x1'));var _=require(_0xe550('0x2'));var utils=require(_0xe550('0x3'));var logger=require('../../../../config/logger')(_0xe550('0x4'));var system=schema({'command':{'type':_0xe550('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x31517a,_0x3cd216){return function(_0x20a5cf){try{var _0x2674cb={'command':_0x3cd216[0x0]};var _0x5f0d53=system['validate'](_0x2674cb,{'typecast':!![]});if(_0x5f0d53[_0xe550('0x6')]){logger[_0xe550('0x7')](_0xe550('0x8'),_0x31517a,_[_0xe550('0x9')](_0x5f0d53,_0xe550('0xa'))['join'](',\x20'));logger[_0xe550('0xb')](_0xe550('0xc'),_0x31517a);_0x20a5cf['next']();}else{var _0x5387d3=this;var _0x51e79f=utils[_0xe550('0xd')](_0x3cd216[0x0],this);logger[_0xe550('0xb')](_0xe550('0xe'),_0x31517a,_0x51e79f);sh[_0xe550('0xf')](_[_0xe550('0x10')](_0x51e79f),function(_0x5e9240,_0x58ce91){logger[_0xe550('0xb')](_0xe550('0x11'),_0x31517a,_0x5e9240);if(_0x5e9240==0x0){var _0x43b706=_0x58ce91['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xe550('0x12')](_0x3cd216[0x1])||_[_0xe550('0x13')](_0x3cd216[0x1])){logger[_0xe550('0xb')](_0xe550('0x14'),_0x31517a);_0x5387d3[_0xe550('0x15')][_0x3cd216[0x1]]=_0x43b706;}else{logger[_0xe550('0xb')](_0xe550('0x16'),_0x31517a,_0x3cd216[0x1],_0x43b706);_0x5387d3[_0xe550('0x15')][_0x3cd216[0x1]]=_0x43b706;}}_0x20a5cf['next']();});}}catch(_0x5eeec6){logger['error'](_0xe550('0x8'),_0x31517a,_['isObject'](_0x5eeec6)?JSON[_0xe550('0x17')](_0x5eeec6):_0x5eeec6);logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x31517a);_0x20a5cf[_0xe550('0x18')]();}};}; \ 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 7c4e8d6..60a509c 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 _0x6be5=['../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][TAG]\x20%s','map','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','channel','catch','stringify','finally','isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction'];(function(_0x47beed,_0x33c360){var _0x572e2a=function(_0x22d7b5){while(--_0x22d7b5){_0x47beed['push'](_0x47beed['shift']());}};_0x572e2a(++_0x33c360);}(_0x6be5,0x109));var _0x56be=function(_0x1ddcc4,_0x1d6d92){_0x1ddcc4=_0x1ddcc4-0x0;var _0xaae43a=_0x6be5[_0x1ddcc4];return _0xaae43a;};'use strict';var schema=require('validate');var _=require(_0x56be('0x0'));var rpc={'chatInteraction':require(_0x56be('0x1')),'openchannelInteraction':require(_0x56be('0x2')),'smsInteraction':require(_0x56be('0x3')),'mailInteraction':require(_0x56be('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x56be('0x5'))('routing');var tag=schema({'tag':{'type':_0x56be('0x6'),'required':!![],'message':_0x56be('0x7')}});exports[_0x56be('0x8')]=function(_0x361361,_0x55b4d0,_0x3ab0bd,_0x1c2271){return function(_0x3403b4){try{var _0x1a9c5a={'tag':_0x55b4d0[0x0]};var _0x11e922=tag[_0x56be('0x9')](_0x1a9c5a,{'typecast':!![]});if(_0x11e922[_0x56be('0xa')]){logger[_0x56be('0xb')](_0x56be('0xc'),_0x361361,_[_0x56be('0xd')](_0x11e922,'message')['join'](',\x20'));logger[_0x56be('0xe')](_0x56be('0xf'),_0x361361);_0x3403b4[_0x56be('0x10')]();}else{var _0x58fd83={'ids':[_0x55b4d0[0x0]]};if(rpc[_0x1c2271['channel']+_0x56be('0x11')]){rpc[_0x1c2271['channel']+_0x56be('0x11')][_0x56be('0x12')](_0x1c2271[_0x56be('0x13')]['id'],_0x58fd83)[_0x56be('0x14')](function(_0x4a6c3a){logger[_0x56be('0xe')](_0x56be('0x15'),_0x361361,_0x55b4d0[0x1],_0x1c2271[_0x56be('0x16')],_0x1c2271[_0x56be('0x13')]['id']);})[_0x56be('0x17')](function(_0x3f50d8){logger['error']('[%s][TAG]\x20%s',_0x361361,JSON[_0x56be('0x18')](_0x3f50d8));logger['info'](_0x56be('0xf'),_0x361361);})[_0x56be('0x19')](function(){_0x3403b4[_0x56be('0x10')]();});}}}catch(_0x5d2114){logger[_0x56be('0xb')]('[%s][TAG]\x20%s',_0x361361,_[_0x56be('0x1a')](_0x5d2114)?JSON[_0x56be('0x18')](_0x5d2114):_0x5d2114);logger[_0x56be('0xe')](_0x56be('0xf'),_0x361361);_0x3403b4[_0x56be('0x10')]();}};}; \ No newline at end of file +var _0xe6fa=['validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','then','catch','stringify','finally','isObject'];(function(_0x47c492,_0x311a27){var _0x32105d=function(_0x5b0289){while(--_0x5b0289){_0x47c492['push'](_0x47c492['shift']());}};_0x32105d(++_0x311a27);}(_0xe6fa,0x15f));var _0xae6f=function(_0xd7f631,_0x595530){_0xd7f631=_0xd7f631-0x0;var _0x267e3b=_0xe6fa[_0xd7f631];return _0x267e3b;};'use strict';var schema=require(_0xae6f('0x0'));var _=require(_0xae6f('0x1'));var rpc={'chatInteraction':require(_0xae6f('0x2')),'openchannelInteraction':require(_0xae6f('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xae6f('0x4')),'whatsappInteraction':require(_0xae6f('0x5'))};var logger=require(_0xae6f('0x6'))(_0xae6f('0x7'));var tag=schema({'tag':{'type':_0xae6f('0x8'),'required':!![],'message':_0xae6f('0x9')}});exports[_0xae6f('0xa')]=function(_0x54546f,_0x293198,_0x48f38e,_0x42289b){return function(_0x7b57da){try{var _0x41f652={'tag':_0x293198[0x0]};var _0x31a7b3=tag[_0xae6f('0x0')](_0x41f652,{'typecast':!![]});if(_0x31a7b3[_0xae6f('0xb')]){logger[_0xae6f('0xc')](_0xae6f('0xd'),_0x54546f,_[_0xae6f('0xe')](_0x31a7b3,'message')[_0xae6f('0xf')](',\x20'));logger[_0xae6f('0x10')](_0xae6f('0x11'),_0x54546f);_0x7b57da[_0xae6f('0x12')]();}else{var _0x2dc365={'ids':[_0x293198[0x0]]};if(rpc[_0x42289b[_0xae6f('0x13')]+_0xae6f('0x14')]){rpc[_0x42289b[_0xae6f('0x13')]+'Interaction'][_0xae6f('0x15')](_0x42289b['interaction']['id'],_0x2dc365)[_0xae6f('0x16')](function(_0x328c59){logger[_0xae6f('0x10')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x54546f,_0x293198[0x1],_0x42289b['channel'],_0x42289b['interaction']['id']);})[_0xae6f('0x17')](function(_0x3b3264){logger[_0xae6f('0xc')](_0xae6f('0xd'),_0x54546f,JSON[_0xae6f('0x18')](_0x3b3264));logger[_0xae6f('0x10')](_0xae6f('0x11'),_0x54546f);})[_0xae6f('0x19')](function(){_0x7b57da[_0xae6f('0x12')]();});}}}catch(_0x54a214){logger[_0xae6f('0xc')](_0xae6f('0xd'),_0x54546f,_[_0xae6f('0x1a')](_0x54a214)?JSON[_0xae6f('0x18')](_0x54a214):_0x54a214);logger[_0xae6f('0x10')](_0xae6f('0x11'),_0x54546f);_0x7b57da[_0xae6f('0x12')]();}};}; \ 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 275b187..a80a1c5 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 _0x0c7c=['routing','lodash','consequence','replace','\x20-\x20','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','login','stringify','utf8','POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','[%s][TVOX]\x20%s','isObject','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger'];(function(_0x5316fa,_0x30ca54){var _0x11d369=function(_0x516ee2){while(--_0x516ee2){_0x5316fa['push'](_0x5316fa['shift']());}};_0x11d369(++_0x30ca54);}(_0x0c7c,0x65));var _0xc0c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c7c[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require('request-promise');var logger=require(_0xc0c7('0x0'))(_0xc0c7('0x1'));var _=require(_0xc0c7('0x2'));var arr=[];exports[_0xc0c7('0x3')]=function(_0x37cade,_0x1fc043){return function(_0x24020c){var _0x499bc7=_0x1fc043[0xa];var _0x2235ee=_0x1fc043[0xb];var _0x37f818=_0x1fc043[0xc];var _0x1f2842=_0x1fc043[0xd];var _0x2bca5e=_0x1fc043[0xe];var _0x1574bd=_0x1fc043[0xf][_0xc0c7('0x4')](/\n/g,_0xc0c7('0x5'));var _0x52ba73=_0x1fc043[0x10][_0xc0c7('0x4')](/\n/g,'\x20');if(!arr['includes'](_0x2235ee)){arr[_0xc0c7('0x6')](_0x2235ee);var _0x3cab3b=_0x1fc043[0x3];var _0x5154aa=_0x1fc043[0x4];var _0x1f1510=_0x1fc043[0x1];var _0x4b624c=_0x1fc043[0x0];var _0x52abbe={};_0x52abbe[_0xc0c7('0x7')]=_0x1fc043[0x8]+_0xc0c7('0x8')+_0x37f818+'|'+_0x499bc7+'|'+_0x1f2842+'|'+_0x2235ee+'|'+_0x2bca5e;_0x52abbe[_0xc0c7('0x9')]=_0x1fc043[0x7]+_0xc0c7('0x8')+_0x37f818+'|'+_0x499bc7+'|'+_0x1f2842+'|'+_0x2235ee+'|'+_0x2bca5e+'|'+_0x1574bd+'|'+_0x52ba73;_0x52abbe[_0xc0c7('0xa')]=_0x1fc043[0x9];var _0x4967e4={};_0x4967e4[_0xc0c7('0xb')]='2.0';_0x4967e4['method']=_0xc0c7('0xc');var _0x3a2b28=[];_0x3a2b28[_0xc0c7('0x6')](_0x1fc043[0x2]);_0x3a2b28[_0xc0c7('0x6')](_0x1fc043[0x5]);_0x3a2b28[_0xc0c7('0x6')](_0x1fc043[0x6]);_0x4967e4['params']=_0x3a2b28;_0x4967e4['id']=0x1;var _0x5efcd7=JSON[_0xc0c7('0xd')](_0x4967e4);var _0x484124={'encoding':_0xc0c7('0xe'),'method':_0xc0c7('0xf'),'timeout':0x2710,'url':_0x3cab3b,'headers':{'Content-Type':_0xc0c7('0x10')},'body':_0x5efcd7};return rp(_0x484124)[_0xc0c7('0x11')](function(_0x2233c5){const _0x2bc79e=JSON[_0xc0c7('0x12')](_0x2233c5);if(!_0x2bc79e[_0xc0c7('0x13')][_0xc0c7('0x14')]){throw new Error(_0xc0c7('0x15'));}var _0x59db29=_0x2235ee;var _0x28fd4f=_0xc0c7('0x16')+_0x1f1510+_0xc0c7('0x17')+_0x4b624c+_0xc0c7('0x18')+_0x59db29+_0xc0c7('0x19')+JSON[_0xc0c7('0xd')](_0x52abbe);var _0x55e9bd=_0x5154aa+'?'+_0x28fd4f;return rp(_0x55e9bd);})[_0xc0c7('0x11')](function(_0x2c79db){logger['info'](_0xc0c7('0x1a'),_0x37cade,_0x2c79db);_0x24020c[_0xc0c7('0x1b')]();})[_0xc0c7('0x1c')](function(_0x1fc8e0){logger['error'](_0xc0c7('0x1d'),_0x37cade,_[_0xc0c7('0x1e')](_0x1fc8e0)?JSON['stringify'](_0x1fc8e0):_0x1fc8e0);_0x24020c[_0xc0c7('0x1b')]();});}else{logger[_0xc0c7('0x1f')](_0xc0c7('0x20'),_0x37cade);_0x24020c[_0xc0c7('0x21')]();}};}; \ No newline at end of file +var _0x3869=['&sessionId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','[%s][TVOX]\x20%s','isObject','stringify','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','includes','?params=','title','2.0','method','login','push','params','utf8','POST','application/json-rpc','then','parse','result','logged','channelId=','&serviceId='];(function(_0x1e35bf,_0x5ef390){var _0x4cd488=function(_0x548484){while(--_0x548484){_0x1e35bf['push'](_0x1e35bf['shift']());}};_0x4cd488(++_0x5ef390);}(_0x3869,0x93));var _0x9386=function(_0x4e1aa9,_0x551a0e){_0x4e1aa9=_0x4e1aa9-0x0;var _0x1c3f82=_0x3869[_0x4e1aa9];return _0x1c3f82;};'use strict';var rp=require(_0x9386('0x0'));var logger=require(_0x9386('0x1'))(_0x9386('0x2'));var _=require(_0x9386('0x3'));var arr=[];exports[_0x9386('0x4')]=function(_0x185160,_0x3cba23){return function(_0x35c5f4){var _0x28342f=_0x3cba23[0xa];var _0x56d651=_0x3cba23[0xb];var _0x4a2fcd=_0x3cba23[0xc];var _0x49b774=_0x3cba23[0xd];var _0x428221=_0x3cba23[0xe];var _0x24c013=_0x3cba23[0xf][_0x9386('0x5')](/\n/g,'\x20-\x20');var _0x36393d=_0x3cba23[0x10][_0x9386('0x5')](/\n/g,'\x20');if(!arr[_0x9386('0x6')](_0x56d651)){arr['push'](_0x56d651);var _0x414727=_0x3cba23[0x3];var _0x305999=_0x3cba23[0x4];var _0x1ee85f=_0x3cba23[0x1];var _0x1a34e7=_0x3cba23[0x0];var _0x3d5a1c={};_0x3d5a1c['urlOnAnswer']=_0x3cba23[0x8]+_0x9386('0x7')+_0x4a2fcd+'|'+_0x28342f+'|'+_0x49b774+'|'+_0x56d651+'|'+_0x428221;_0x3d5a1c['urlOnRing']=_0x3cba23[0x7]+_0x9386('0x7')+_0x4a2fcd+'|'+_0x28342f+'|'+_0x49b774+'|'+_0x56d651+'|'+_0x428221+'|'+_0x24c013+'|'+_0x36393d;_0x3d5a1c[_0x9386('0x8')]=_0x3cba23[0x9];var _0x2ee195={};_0x2ee195['jsonrpc']=_0x9386('0x9');_0x2ee195[_0x9386('0xa')]=_0x9386('0xb');var _0x1d066a=[];_0x1d066a['push'](_0x3cba23[0x2]);_0x1d066a[_0x9386('0xc')](_0x3cba23[0x5]);_0x1d066a[_0x9386('0xc')](_0x3cba23[0x6]);_0x2ee195[_0x9386('0xd')]=_0x1d066a;_0x2ee195['id']=0x1;var _0x1dc33c=JSON['stringify'](_0x2ee195);var _0x2ddb1d={'encoding':_0x9386('0xe'),'method':_0x9386('0xf'),'timeout':0x2710,'url':_0x414727,'headers':{'Content-Type':_0x9386('0x10')},'body':_0x1dc33c};return rp(_0x2ddb1d)[_0x9386('0x11')](function(_0x48025a){const _0x8779c6=JSON[_0x9386('0x12')](_0x48025a);if(!_0x8779c6[_0x9386('0x13')][_0x9386('0x14')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x235028=_0x56d651;var _0x46ab4e=_0x9386('0x15')+_0x1ee85f+_0x9386('0x16')+_0x1a34e7+_0x9386('0x17')+_0x235028+_0x9386('0x18')+JSON['stringify'](_0x3d5a1c);var _0x3d2a66=_0x305999+'?'+_0x46ab4e;return rp(_0x3d2a66);})[_0x9386('0x11')](function(_0x40341b){logger['info'](_0x9386('0x19'),_0x185160,_0x40341b);_0x35c5f4[_0x9386('0x1a')]();})[_0x9386('0x1b')](function(_0x5b2c38){logger['error'](_0x9386('0x1c'),_0x185160,_[_0x9386('0x1d')](_0x5b2c38)?JSON[_0x9386('0x1e')](_0x5b2c38):_0x5b2c38);_0x35c5f4['stop']();});}else{logger[_0x9386('0x1f')](_0x9386('0x20'),_0x185160);_0x35c5f4[_0x9386('0x21')]();}};}; \ 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 5a5a156..3745ff0 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['merge','body','account','list','exports','render'];(function(_0x3f25f2,_0x45b7b4){var _0x4afdea=function(_0x19ead1){while(--_0x19ead1){_0x3f25f2['push'](_0x3f25f2['shift']());}};_0x4afdea(++_0x45b7b4);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x1afe33,_0x3e34ed){var _0x5c6730=function(_0x380eda){while(--_0x380eda){_0x1afe33['push'](_0x1afe33['shift']());}};_0x5c6730(++_0x3e34ed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 5065b5a..4cf604c 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 _0x49c1=['stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','agents','agent','busyQueue','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','find','chatQueues','available','loggedIn','name','paused','mailQueues','openchannelQueues','waiting','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','./applications/strategy/util','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','transfer','applications','isArray','length','existsSync','join','app','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','dialogflowv2','tag','tvox','account','notificationTemplate','ChatWebsiteId','ContactId','body','format','./interval','condition','consequence','priority','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','info','Applications\x20executed'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x49c1,0xef));var _0x149c=function(_0x4c667f,_0x335204){_0x4c667f=_0x4c667f-0x0;var _0xe099b0=_0x49c1[_0x4c667f];return _0xe099b0;};'use strict';var _=require(_0x149c('0x0'));var util=require('util');var path=require(_0x149c('0x1'));var fs=require('fs');var jayson=require(_0x149c('0x2'));var BPromise=require(_0x149c('0x3'));var utils=require('./applications/utils');var sUtils=require(_0x149c('0x4'));var logger=require(_0x149c('0x5'))('routing');var rpc={'openchannelQueueReport':require(_0x149c('0x6')),'mailQueueReport':require(_0x149c('0x7')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x149c('0x8')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x149c('0x9'))};var RuleEngine=require(_0x149c('0xa'));function getId(_0x51f682,_0x4396bb,_0xfe0da6){return util['format'](_0x149c('0xb'),_0x51f682,_0x4396bb||0x0,_0xfe0da6||0x0);}function getIntervals(_0x350050,_0x486451){var _0x3dc08d=[];if(!_[_0x149c('0xc')](_0x486451[_0x149c('0xd')])&&!_[_0x149c('0xc')](_0x350050[_0x486451['IntervalId']])&&!_[_0x149c('0xc')](_0x350050[_0x486451[_0x149c('0xd')]][_0x149c('0xe')])){_0x3dc08d=_[_0x149c('0xf')](_0x350050[_0x486451[_0x149c('0xd')]][_0x149c('0xe')],_0x149c('0x10'));}else if(!_[_0x149c('0xc')](_0x486451['interval'])){_0x3dc08d=[_0x486451[_0x149c('0x10')]];}return _0x3dc08d;}exports[_0x149c('0x11')]=function(_0x4aee29){_0x4aee29[_0x149c('0x12')]={};return new BPromise(function(_0x4e6cbc,_0x112d99){var _0x1d2a83={'Start':function(_0x177800){var _0x471e93=this;return new Promise(function(_0x3d851a,_0x30f8c1){if(_0x177800){try{var _0x3659eb=[];var _0x3e966f=getId(_0x177800[_0x149c('0x13')],_0x177800['message']?_0x177800[_0x149c('0x14')]['id']:0x0,_0x177800[_0x149c('0x15')]?_0x177800[_0x149c('0x15')]['id']:0x0);var _0x1bcd3d=sUtils[_0x149c('0x16')](_0x4aee29,_0x177800);if(_0x177800[_0x149c('0x17')]||!_0x1bcd3d&&_0x177800[_0x149c('0x18')]&&_[_0x149c('0x19')](_0x177800['applications'])&&_0x177800[_0x149c('0x18')]['length']){for(var _0x5d57c7=0x0;_0x5d57c7<_0x177800['applications'][_0x149c('0x1a')];_0x5d57c7+=0x1){var _0x14194d=_0x177800[_0x149c('0x18')][_0x5d57c7];if(fs[_0x149c('0x1b')](path[_0x149c('0x1c')](__dirname,_0x149c('0x18'),_0x14194d[_0x149c('0x1d')]+'.js'))){var _0x398203=[];switch(_0x14194d[_0x149c('0x1d')][_0x149c('0x1e')]()){case _0x149c('0x1f'):var _0x2cdd54=_0x14194d[_0x149c('0x20')][_0x149c('0x21')](',');if(_0x177800[_0x149c('0x13')]==='mail'){_0x398203[_0x149c('0x22')](_0x2cdd54[0x0]);_0x398203[_0x149c('0x22')](_0x2cdd54[0x1]);_0x398203['push'](_0x2cdd54[_0x149c('0x23')](0x2,_0x2cdd54[_0x149c('0x1a')])[_0x149c('0x1c')](','));}else{_0x398203[_0x149c('0x22')](_0x2cdd54[0x0]);_0x398203['push'](_0x2cdd54[_0x149c('0x23')](0x1,_0x2cdd54[_0x149c('0x1a')])[_0x149c('0x1c')](','));}break;case _0x149c('0x24'):var _0x149705=_0x14194d[_0x149c('0x20')][_0x149c('0x21')](',');_0x398203['push'](_0x149705[0x0]);_0x398203['push'](_0x149705[0x1]);_0x398203[_0x149c('0x22')](_0x149705[_0x149c('0x23')](0x2,_0x149705[_0x149c('0x1a')])['join'](','));break;case _0x149c('0x25'):var _0xcac130=_0x14194d[_0x149c('0x20')][_0x149c('0x21')](',');_0x398203['push'](_0xcac130[0x0]);_0x398203[_0x149c('0x22')](_0xcac130[0x1]);_0x398203[_0x149c('0x22')](_0xcac130[0x2]);_0x398203[_0x149c('0x22')](_0xcac130[0x3]);_0x398203[_0x149c('0x22')](_0xcac130[_0x149c('0x23')](0x4,_0xcac130['length'])[_0x149c('0x1c')](','));break;case'amazonlex':var _0x3b222a=_0x14194d[_0x149c('0x20')][_0x149c('0x21')](',');_0x398203[_0x149c('0x22')](_0x3b222a[0x0]);_0x398203[_0x149c('0x22')](_0x3b222a[0x1]);_0x398203[_0x149c('0x22')](_0x3b222a[0x2]);_0x398203[_0x149c('0x22')](_0x3b222a[0x3]);_0x398203['push'](_0x3b222a[_0x149c('0x23')](0x4,_0x3b222a['length'])[_0x149c('0x1c')](','));break;case'message':_0x398203[_0x149c('0x22')](_0x14194d['appdata']);break;case _0x149c('0x26'):_0x398203[_0x149c('0x22')](_0x14194d['TagId']);_0x398203['push'](_0x14194d[_0x149c('0x20')]);break;case _0x149c('0x27'):var _0x59d3ec=utils['getMustacheRender'](_0x177800[_0x149c('0x28')][_0x149c('0x29')],_0x177800);var _0x125261=_0x14194d[_0x149c('0x20')][_0x149c('0x21')](',');_0x398203[_0x149c('0x22')](_0x125261[0x0]);_0x398203['push'](_0x125261[0x1]);_0x398203[_0x149c('0x22')](_0x125261[0x2]);_0x398203[_0x149c('0x22')](_0x125261[0x3]);_0x398203[_0x149c('0x22')](_0x125261[0x4]);_0x398203[_0x149c('0x22')](_0x125261[0x5]);_0x398203['push'](_0x125261[0x6]);_0x398203[_0x149c('0x22')](_0x125261[0x7]);_0x398203[_0x149c('0x22')](_0x125261[0x8]);_0x398203[_0x149c('0x22')](_0x125261[0x9]);_0x398203[_0x149c('0x22')](_0x125261[0xa]);_0x398203['push'](_0x177800['interaction']['id']);_0x398203[_0x149c('0x22')](_0x177800[_0x149c('0x14')]['id']);_0x398203['push'](_0x14194d[_0x149c('0x2a')]);_0x398203['push'](_0x177800[_0x149c('0x15')][_0x149c('0x2b')]);_0x398203[_0x149c('0x22')](_0x177800[_0x149c('0x2c')][_0x149c('0x2c')]);_0x398203['push'](_0x59d3ec);break;default:_0x398203=_[_0x149c('0xc')](_0x14194d[_0x149c('0x20')])?[]:_0x14194d['appdata']['split'](',');}var _0x25b7e6={'id':util[_0x149c('0x2d')]('%s:%s:%s',_0x3e966f,_0x14194d['id'],_0x14194d[_0x149c('0x1d')]),'condition':require(_0x149c('0x2e'))[_0x149c('0x2f')](_0x3e966f,getIntervals(_0x4aee29['intervals'],_0x14194d),_0x4aee29),'consequence':require('./applications/'+_0x14194d[_0x149c('0x1d')])[_0x149c('0x30')](_0x3e966f,_0x398203,_0x4aee29,_0x177800),'p':_0x14194d[_0x149c('0x31')]||0x0};logger['info'](_0x149c('0x32'),_0x25b7e6['id'],'on\x20interval',getIntervals(_0x4aee29['intervals'],_0x14194d)[_0x149c('0x1c')](_0x149c('0x33')));_0x3659eb[_0x149c('0x22')](_0x25b7e6);}else{logger[_0x149c('0x34')](_0x149c('0x35'),path[_0x149c('0x1c')](__dirname,'applications',_0x14194d[_0x149c('0x1d')]+_0x149c('0x36')));}}_0x4aee29[_0x149c('0x12')][_0x3e966f]=new RuleEngine(_0x3659eb);_0x4aee29[_0x149c('0x12')][_0x3e966f][_0x149c('0x37')](_0x177800,function(_0x1835db){logger[_0x149c('0x38')](_0x149c('0x39'),JSON[_0x149c('0x3a')](_0x1835db[_0x149c('0x3b')]));if(_0x4aee29['rules'][_0x3e966f]){_0x4aee29[_0x149c('0x12')][_0x3e966f][_0x149c('0x3c')](_0x149c('0x3d'));}});return _0x3d851a({'code':0xc8,'message':_0x177800});}else{if(_0x1bcd3d){logger[_0x149c('0x38')](util[_0x149c('0x2d')]('Skipped\x20routing\x20for\x20%s',_0x3e966f));}else{logger['info'](_0x149c('0x3e'));}return _0x3d851a({'code':0xc8,'message':_0x177800});}}catch(_0x568b5b){logger[_0x149c('0x34')](_0x568b5b[_0x149c('0x3f')]);return _0x30f8c1(_0x471e93['error'](0x1f4,_0x568b5b));}}return _0x30f8c1('routing\x20is\x20empty');});},'AcceptMessage':function(_0x470f64){var _0x24fbe9=this;return new Promise(function(_0x54ab08,_0x145d2a){if(_0x470f64['agent']&&_0x470f64['agent']['id']){if(_0x4aee29[_0x149c('0x40')][_0x470f64[_0x149c('0x41')]['id']]){_0x4aee29['agents'][_0x470f64['agent']['id']]['busy']=![];_0x4aee29[_0x149c('0x40')][_0x470f64[_0x149c('0x41')]['id']][_0x149c('0x42')]=undefined;}}if(_0x470f64[_0x149c('0x14')]&&_0x470f64['message']['id']){try{var _0x583092=getId(_0x470f64[_0x149c('0x13')],_0x470f64[_0x149c('0x14')]?_0x470f64['message']['id']:0x0,_0x470f64[_0x149c('0x15')]?_0x470f64[_0x149c('0x15')]['id']:0x0);if(_0x4aee29['rules'][_0x583092]){_0x4aee29['rules'][_0x583092]['emit']('end');if(rpc[_0x470f64[_0x149c('0x13')]+_0x149c('0x43')]){rpc[_0x470f64[_0x149c('0x13')]+'QueueReport'][_0x149c('0x44')](_0x583092,{'UserId':_0x470f64['message'][_0x149c('0x45')]})['catch'](function(){logger[_0x149c('0x34')](_0x149c('0x46'));});}}return _0x54ab08({'code':0xc8,'message':_0x470f64});}catch(_0x45c59d){logger[_0x149c('0x34')](_0x45c59d[_0x149c('0x3f')]);return _0x145d2a(_0x24fbe9[_0x149c('0x34')](0x1f4,_0x45c59d));}}logger['error'](_0x149c('0x47'));return _0x145d2a(_0x24fbe9[_0x149c('0x34')](0x1f4,_0x149c('0x47')));});},'RejectMessage':function(_0x4ad160){var _0xb5e39f=this;return new Promise(function(_0x4341cb,_0x98687c){if(_0x4ad160[_0x149c('0x41')]&&_0x4ad160[_0x149c('0x41')]['id']){try{if(_0x4aee29[_0x149c('0x40')][_0x4ad160[_0x149c('0x41')]['id']]){_0x4aee29[_0x149c('0x40')][_0x4ad160[_0x149c('0x41')]['id']]['busy']=![];_0x4aee29[_0x149c('0x40')][_0x4ad160[_0x149c('0x41')]['id']][_0x149c('0x42')]=undefined;}return _0x4341cb({'code':0xc8,'message':_0x4ad160});}catch(_0x5c1967){logger['error'](_0x5c1967[_0x149c('0x3f')]);return _0x98687c(_0xb5e39f[_0x149c('0x34')](0x1f4,_0x5c1967));}}logger['error'](_0x149c('0x47'));return _0x98687c(_0xb5e39f[_0x149c('0x34')](0x1f4,_0x149c('0x47')));});},'AbandonInteraction':function(_0x902d3){var _0x533188=this;return new Promise(function(_0x54301e,_0x313094){if(_0x902d3['channel']&&_0x902d3['interaction']&&_0x902d3[_0x149c('0x15')]['id']){try{var _0x5182e2=getId(_0x902d3[_0x149c('0x13')],_0x902d3[_0x149c('0x14')]?_0x902d3['message']['id']:0x0,_0x902d3['interaction']?_0x902d3[_0x149c('0x15')]['id']:0x0);if(_0x4aee29['rules'][_0x5182e2]){_0x4aee29[_0x149c('0x12')][_0x5182e2]['emit'](_0x149c('0x48'));}return _0x54301e({'code':0xc8,'message':_0x902d3});}catch(_0x3e494b){logger['error'](_0x3e494b[_0x149c('0x3f')]);return _0x313094(_0x533188[_0x149c('0x34')](0x1f4,_0x3e494b));}}logger[_0x149c('0x34')]('message\x20is\x20empty');return _0x313094(_0x533188[_0x149c('0x34')](0x1f4,_0x149c('0x47')));});},'AgentCapacity':function(_0x4ee8bf){var _0x147f44=this;return new Promise(function(_0x36b9f9,_0x31e488){if(_0x4aee29[_0x149c('0x40')][_0x149c('0x49')](_0x4ee8bf['id'])){for(var _0x24d972 in _0x4ee8bf[_0x149c('0x4a')]){if(_0x4ee8bf['capacity'][_0x149c('0x49')](_0x24d972)){if(_0x4aee29['agents'][_0x4ee8bf['id']]['hasOwnProperty'](_0x24d972+'CurrentCapacity')){_0x4aee29['agents'][_0x4ee8bf['id']][_0x24d972+_0x149c('0x4b')]=parseInt(_0x4ee8bf[_0x149c('0x4a')][_0x24d972],0xa);}}}_0x4aee29['agents'][_0x4ee8bf['id']][_0x149c('0x4c')]();return _0x36b9f9({'code':0xc8,'message':_0x4aee29[_0x149c('0x40')][_0x4ee8bf['id']]});}else{return _0x31e488(_0x147f44['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x301c18){return new Promise(function(_0x210541){var _0x401771=_[_0x149c('0x4d')](_0x4aee29[_0x149c('0x40')]);if(_0x301c18&&_0x301c18['id']){var _0x5df9e5=_[_0x149c('0x4e')](_0x401771,function(_0x204a49){return _0x204a49['id']===_0x301c18['id'];});_0x210541(_0x5df9e5);}else{_0x210541({'count':_0x401771['length'],'rows':_0x401771});}});},'ChatQueues':function(){return new Promise(function(_0x4cc469){var _0x36759c=[];for(var _0x19efbf in _0x4aee29[_0x149c('0x4f')]){if(_0x4aee29[_0x149c('0x4f')][_0x149c('0x49')](_0x19efbf)){var _0x4d2b4b=_0x4aee29[_0x149c('0x4f')][_0x19efbf];var _0x4e2021={'id':_0x4d2b4b['id'],'available':_0x4d2b4b[_0x149c('0x50')],'loggedIn':_0x4d2b4b[_0x149c('0x51')],'name':_0x4d2b4b[_0x149c('0x52')],'paused':_0x4d2b4b[_0x149c('0x53')],'waiting':_0x4d2b4b['waiting']};_0x36759c[_0x149c('0x22')](_0x4e2021);}}_0x4cc469({'count':_0x36759c[_0x149c('0x1a')],'rows':_0x36759c});});},'MailQueues':function(){return new Promise(function(_0x5c7a5e){var _0x3adc36=[];for(var _0x1d9502 in _0x4aee29[_0x149c('0x54')]){if(_0x4aee29[_0x149c('0x54')]['hasOwnProperty'](_0x1d9502)){var _0x20704d=_0x4aee29['mailQueues'][_0x1d9502];var _0xae1c70={'id':_0x20704d['id'],'available':_0x20704d[_0x149c('0x50')],'loggedIn':_0x20704d[_0x149c('0x51')],'name':_0x20704d[_0x149c('0x52')],'paused':_0x20704d[_0x149c('0x53')],'waiting':_0x20704d['waiting']};_0x3adc36['push'](_0xae1c70);}}_0x5c7a5e({'count':_0x3adc36[_0x149c('0x1a')],'rows':_0x3adc36});});},'OpenchannelQueues':function(){return new Promise(function(_0x45c752){var _0x249467=[];for(var _0x4844b6 in _0x4aee29['openchannelQueues']){if(_0x4aee29[_0x149c('0x55')][_0x149c('0x49')](_0x4844b6)){var _0x4f341a=_0x4aee29[_0x149c('0x55')][_0x4844b6];var _0x5847dc={'id':_0x4f341a['id'],'available':_0x4f341a[_0x149c('0x50')],'loggedIn':_0x4f341a[_0x149c('0x51')],'name':_0x4f341a[_0x149c('0x52')],'paused':_0x4f341a['paused'],'waiting':_0x4f341a[_0x149c('0x56')]};_0x249467[_0x149c('0x22')](_0x5847dc);}}_0x45c752({'count':_0x249467[_0x149c('0x1a')],'rows':_0x249467});});},'SmsQueues':function(){return new Promise(function(_0x1e1975){var _0x76beb9=[];for(var _0xf1988d in _0x4aee29['smsQueues']){if(_0x4aee29[_0x149c('0x57')]['hasOwnProperty'](_0xf1988d)){var _0x4647ea=_0x4aee29[_0x149c('0x57')][_0xf1988d];var _0x2bd18c={'id':_0x4647ea['id'],'available':_0x4647ea['available'],'loggedIn':_0x4647ea[_0x149c('0x51')],'name':_0x4647ea[_0x149c('0x52')],'paused':_0x4647ea[_0x149c('0x53')],'waiting':_0x4647ea[_0x149c('0x56')]};_0x76beb9['push'](_0x2bd18c);}}_0x1e1975({'count':_0x76beb9['length'],'rows':_0x76beb9});});},'FaxQueues':function(){return new Promise(function(_0x19e450){var _0x44f63b=[];for(var _0x4dc05d in _0x4aee29[_0x149c('0x58')]){if(_0x4aee29[_0x149c('0x58')][_0x149c('0x49')](_0x4dc05d)){var _0x484c99=_0x4aee29[_0x149c('0x58')][_0x4dc05d];var _0x408f13={'id':_0x484c99['id'],'available':_0x484c99[_0x149c('0x50')],'loggedIn':_0x484c99[_0x149c('0x51')],'name':_0x484c99[_0x149c('0x52')],'paused':_0x484c99['paused'],'waiting':_0x484c99['waiting']};_0x44f63b[_0x149c('0x22')](_0x408f13);}}_0x19e450({'count':_0x44f63b['length'],'rows':_0x44f63b});});},'WhatsappQueues':function(){return new Promise(function(_0x254d16){var _0x243caa=[];for(var _0x5aaa17 in _0x4aee29[_0x149c('0x59')]){if(_0x4aee29['whatsappQueues'][_0x149c('0x49')](_0x5aaa17)){var _0x1e75b6=_0x4aee29[_0x149c('0x59')][_0x5aaa17];var _0x7148e2={'id':_0x1e75b6['id'],'available':_0x1e75b6[_0x149c('0x50')],'loggedIn':_0x1e75b6[_0x149c('0x51')],'name':_0x1e75b6[_0x149c('0x52')],'paused':_0x1e75b6[_0x149c('0x53')],'waiting':_0x1e75b6[_0x149c('0x56')]};_0x243caa[_0x149c('0x22')](_0x7148e2);}}_0x254d16({'count':_0x243caa['length'],'rows':_0x243caa});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x54c339){var _0x125f88=_[_0x149c('0x4d')](_0x4aee29[_0x149c('0x5a')]);_0x54c339({'count':_0x125f88['length'],'rows':_0x125f88});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x28e93e){var _0x285ce5=_[_0x149c('0x4d')](_0x4aee29['mailQueuesWaitingInteractions']);_0x28e93e({'count':_0x285ce5[_0x149c('0x1a')],'rows':_0x285ce5});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x38b5a5){var _0x6a8ce3=_[_0x149c('0x4d')](_0x4aee29[_0x149c('0x5b')]);_0x38b5a5({'count':_0x6a8ce3[_0x149c('0x1a')],'rows':_0x6a8ce3});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x25255a){var _0xea1d03=_[_0x149c('0x4d')](_0x4aee29[_0x149c('0x5c')]);_0x25255a({'count':_0xea1d03[_0x149c('0x1a')],'rows':_0xea1d03});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x3b6985){var _0x5e3edf=_[_0x149c('0x4d')](_0x4aee29['faxQueuesWaitingInteractions']);_0x3b6985({'count':_0x5e3edf[_0x149c('0x1a')],'rows':_0x5e3edf});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x2db03b){var _0x420458=_['values'](_0x4aee29[_0x149c('0x5d')]);_0x2db03b({'count':_0x420458[_0x149c('0x1a')],'rows':_0x420458});});}};var _0x2a1707=jayson['server'](_0x1d2a83)[_0x149c('0x5e')]();_0x2a1707['on'](_0x149c('0x34'),function(_0x346736){logger[_0x149c('0x34')](JSON[_0x149c('0x3a')](_0x346736));return _0x112d99(_0x346736);});_0x2a1707[_0x149c('0x11')](0x232c,_0x149c('0x5f'),function(){console[_0x149c('0x60')](_0x149c('0x61'),0x232c);return _0x4e6cbc(_0x149c('0x62')+0x232c);});});}; \ No newline at end of file +var _0x352b=['join','.js','app','autoreply','appdata','channel','mail','push','slice','split','dialogflowv2','amazonlex','tag','TagId','tvox','account','notificationTemplate','body','%s:%s:%s','./interval','condition','intervals','priority','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','rules','execute','info','Applications\x20executed','stringify','emit','complete','Skipped\x20routing\x20for\x20%s','stack','agent','agents','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','loggedIn','name','mailQueues','available','openchannelQueues','paused','waiting','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','./applications/utils','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/whatsappQueueReport','format','IntervalId','isNil','Intervals','map','interval','listen','message','interaction','transfer','applications','isArray','length','existsSync'];(function(_0x3b7125,_0x9119ec){var _0x5d4632=function(_0x46e229){while(--_0x46e229){_0x3b7125['push'](_0x3b7125['shift']());}};_0x5d4632(++_0x9119ec);}(_0x352b,0x1c8));var _0xb352=function(_0x5ca751,_0x4fc1d1){_0x5ca751=_0x5ca751-0x0;var _0x4891a4=_0x352b[_0x5ca751];return _0x4891a4;};'use strict';var _=require(_0xb352('0x0'));var util=require(_0xb352('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0xb352('0x2'));var BPromise=require(_0xb352('0x3'));var utils=require(_0xb352('0x4'));var sUtils=require('./applications/strategy/util');var logger=require('../../../config/logger')(_0xb352('0x5'));var rpc={'openchannelQueueReport':require(_0xb352('0x6')),'mailQueueReport':require(_0xb352('0x7')),'chatQueueReport':require(_0xb352('0x8')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xb352('0x9'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x2d70d9,_0x4e09cd,_0x5992c4){return util[_0xb352('0xa')]('%s.%s.%s',_0x2d70d9,_0x4e09cd||0x0,_0x5992c4||0x0);}function getIntervals(_0x49d21f,_0x5e9cfd){var _0x493368=[];if(!_['isNil'](_0x5e9cfd[_0xb352('0xb')])&&!_[_0xb352('0xc')](_0x49d21f[_0x5e9cfd[_0xb352('0xb')]])&&!_[_0xb352('0xc')](_0x49d21f[_0x5e9cfd[_0xb352('0xb')]][_0xb352('0xd')])){_0x493368=_[_0xb352('0xe')](_0x49d21f[_0x5e9cfd[_0xb352('0xb')]][_0xb352('0xd')],'interval');}else if(!_[_0xb352('0xc')](_0x5e9cfd[_0xb352('0xf')])){_0x493368=[_0x5e9cfd['interval']];}return _0x493368;}exports[_0xb352('0x10')]=function(_0x5aceb5){_0x5aceb5['rules']={};return new BPromise(function(_0x26fac9,_0x1636f4){var _0x1a0573={'Start':function(_0x533d2e){var _0x250675=this;return new Promise(function(_0x450c41,_0xbc4cb9){if(_0x533d2e){try{var _0x5cc8f5=[];var _0x2d75bb=getId(_0x533d2e['channel'],_0x533d2e[_0xb352('0x11')]?_0x533d2e['message']['id']:0x0,_0x533d2e[_0xb352('0x12')]?_0x533d2e[_0xb352('0x12')]['id']:0x0);var _0x4bfb61=sUtils['checkWaitingNotifications'](_0x5aceb5,_0x533d2e);if(_0x533d2e[_0xb352('0x13')]||!_0x4bfb61&&_0x533d2e[_0xb352('0x14')]&&_[_0xb352('0x15')](_0x533d2e[_0xb352('0x14')])&&_0x533d2e[_0xb352('0x14')][_0xb352('0x16')]){for(var _0x3c9cf0=0x0;_0x3c9cf0<_0x533d2e[_0xb352('0x14')]['length'];_0x3c9cf0+=0x1){var _0x3608fc=_0x533d2e[_0xb352('0x14')][_0x3c9cf0];if(fs[_0xb352('0x17')](path[_0xb352('0x18')](__dirname,_0xb352('0x14'),_0x3608fc['app']+_0xb352('0x19')))){var _0x5e0ab8=[];switch(_0x3608fc[_0xb352('0x1a')]['toLowerCase']()){case _0xb352('0x1b'):var _0x4cb924=_0x3608fc[_0xb352('0x1c')]['split'](',');if(_0x533d2e[_0xb352('0x1d')]===_0xb352('0x1e')){_0x5e0ab8[_0xb352('0x1f')](_0x4cb924[0x0]);_0x5e0ab8[_0xb352('0x1f')](_0x4cb924[0x1]);_0x5e0ab8[_0xb352('0x1f')](_0x4cb924[_0xb352('0x20')](0x2,_0x4cb924[_0xb352('0x16')])[_0xb352('0x18')](','));}else{_0x5e0ab8[_0xb352('0x1f')](_0x4cb924[0x0]);_0x5e0ab8[_0xb352('0x1f')](_0x4cb924[_0xb352('0x20')](0x1,_0x4cb924[_0xb352('0x16')])[_0xb352('0x18')](','));}break;case'dialogflow':var _0x3e94c6=_0x3608fc['appdata'][_0xb352('0x21')](',');_0x5e0ab8['push'](_0x3e94c6[0x0]);_0x5e0ab8[_0xb352('0x1f')](_0x3e94c6[0x1]);_0x5e0ab8[_0xb352('0x1f')](_0x3e94c6[_0xb352('0x20')](0x2,_0x3e94c6[_0xb352('0x16')])['join'](','));break;case _0xb352('0x22'):var _0x45d22a=_0x3608fc[_0xb352('0x1c')][_0xb352('0x21')](',');_0x5e0ab8['push'](_0x45d22a[0x0]);_0x5e0ab8['push'](_0x45d22a[0x1]);_0x5e0ab8[_0xb352('0x1f')](_0x45d22a[0x2]);_0x5e0ab8[_0xb352('0x1f')](_0x45d22a[0x3]);_0x5e0ab8[_0xb352('0x1f')](_0x45d22a['slice'](0x4,_0x45d22a['length'])['join'](','));break;case _0xb352('0x23'):var _0x52bfa5=_0x3608fc[_0xb352('0x1c')][_0xb352('0x21')](',');_0x5e0ab8[_0xb352('0x1f')](_0x52bfa5[0x0]);_0x5e0ab8[_0xb352('0x1f')](_0x52bfa5[0x1]);_0x5e0ab8[_0xb352('0x1f')](_0x52bfa5[0x2]);_0x5e0ab8[_0xb352('0x1f')](_0x52bfa5[0x3]);_0x5e0ab8[_0xb352('0x1f')](_0x52bfa5[_0xb352('0x20')](0x4,_0x52bfa5[_0xb352('0x16')])['join'](','));break;case _0xb352('0x11'):_0x5e0ab8[_0xb352('0x1f')](_0x3608fc[_0xb352('0x1c')]);break;case _0xb352('0x24'):_0x5e0ab8[_0xb352('0x1f')](_0x3608fc[_0xb352('0x25')]);_0x5e0ab8[_0xb352('0x1f')](_0x3608fc['appdata']);break;case _0xb352('0x26'):var _0x27774c=utils['getMustacheRender'](_0x533d2e[_0xb352('0x27')][_0xb352('0x28')],_0x533d2e);var _0x313482=_0x3608fc[_0xb352('0x1c')]['split'](',');_0x5e0ab8[_0xb352('0x1f')](_0x313482[0x0]);_0x5e0ab8[_0xb352('0x1f')](_0x313482[0x1]);_0x5e0ab8['push'](_0x313482[0x2]);_0x5e0ab8[_0xb352('0x1f')](_0x313482[0x3]);_0x5e0ab8['push'](_0x313482[0x4]);_0x5e0ab8[_0xb352('0x1f')](_0x313482[0x5]);_0x5e0ab8[_0xb352('0x1f')](_0x313482[0x6]);_0x5e0ab8[_0xb352('0x1f')](_0x313482[0x7]);_0x5e0ab8[_0xb352('0x1f')](_0x313482[0x8]);_0x5e0ab8[_0xb352('0x1f')](_0x313482[0x9]);_0x5e0ab8[_0xb352('0x1f')](_0x313482[0xa]);_0x5e0ab8[_0xb352('0x1f')](_0x533d2e['interaction']['id']);_0x5e0ab8[_0xb352('0x1f')](_0x533d2e['message']['id']);_0x5e0ab8[_0xb352('0x1f')](_0x3608fc['ChatWebsiteId']);_0x5e0ab8['push'](_0x533d2e['interaction']['ContactId']);_0x5e0ab8[_0xb352('0x1f')](_0x533d2e[_0xb352('0x29')][_0xb352('0x29')]);_0x5e0ab8[_0xb352('0x1f')](_0x27774c);break;default:_0x5e0ab8=_['isNil'](_0x3608fc['appdata'])?[]:_0x3608fc[_0xb352('0x1c')][_0xb352('0x21')](',');}var _0x82dca7={'id':util[_0xb352('0xa')](_0xb352('0x2a'),_0x2d75bb,_0x3608fc['id'],_0x3608fc[_0xb352('0x1a')]),'condition':require(_0xb352('0x2b'))[_0xb352('0x2c')](_0x2d75bb,getIntervals(_0x5aceb5[_0xb352('0x2d')],_0x3608fc),_0x5aceb5),'consequence':require('./applications/'+_0x3608fc[_0xb352('0x1a')])['consequence'](_0x2d75bb,_0x5e0ab8,_0x5aceb5,_0x533d2e),'p':_0x3608fc[_0xb352('0x2e')]||0x0};logger['info'](_0xb352('0x2f'),_0x82dca7['id'],_0xb352('0x30'),getIntervals(_0x5aceb5[_0xb352('0x2d')],_0x3608fc)['join'](_0xb352('0x31')));_0x5cc8f5[_0xb352('0x1f')](_0x82dca7);}else{logger[_0xb352('0x32')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,_0xb352('0x14'),_0x3608fc[_0xb352('0x1a')]+_0xb352('0x19')));}}_0x5aceb5[_0xb352('0x33')][_0x2d75bb]=new RuleEngine(_0x5cc8f5);_0x5aceb5[_0xb352('0x33')][_0x2d75bb][_0xb352('0x34')](_0x533d2e,function(_0x3c7bfd){logger[_0xb352('0x35')](_0xb352('0x36'),JSON[_0xb352('0x37')](_0x3c7bfd['matchPath']));if(_0x5aceb5['rules'][_0x2d75bb]){_0x5aceb5['rules'][_0x2d75bb][_0xb352('0x38')](_0xb352('0x39'));}});return _0x450c41({'code':0xc8,'message':_0x533d2e});}else{if(_0x4bfb61){logger[_0xb352('0x35')](util['format'](_0xb352('0x3a'),_0x2d75bb));}else{logger['info']('No\x20applications\x20to\x20execute');}return _0x450c41({'code':0xc8,'message':_0x533d2e});}}catch(_0x445a2b){logger['error'](_0x445a2b[_0xb352('0x3b')]);return _0xbc4cb9(_0x250675[_0xb352('0x32')](0x1f4,_0x445a2b));}}return _0xbc4cb9('routing\x20is\x20empty');});},'AcceptMessage':function(_0x310639){var _0x25d99d=this;return new Promise(function(_0x4b7574,_0x509db5){if(_0x310639[_0xb352('0x3c')]&&_0x310639['agent']['id']){if(_0x5aceb5['agents'][_0x310639['agent']['id']]){_0x5aceb5[_0xb352('0x3d')][_0x310639[_0xb352('0x3c')]['id']]['busy']=![];_0x5aceb5[_0xb352('0x3d')][_0x310639['agent']['id']][_0xb352('0x3e')]=undefined;}}if(_0x310639[_0xb352('0x11')]&&_0x310639['message']['id']){try{var _0x5603f3=getId(_0x310639['channel'],_0x310639[_0xb352('0x11')]?_0x310639[_0xb352('0x11')]['id']:0x0,_0x310639[_0xb352('0x12')]?_0x310639[_0xb352('0x12')]['id']:0x0);if(_0x5aceb5[_0xb352('0x33')][_0x5603f3]){_0x5aceb5['rules'][_0x5603f3][_0xb352('0x38')](_0xb352('0x3f'));if(rpc[_0x310639[_0xb352('0x1d')]+'QueueReport']){rpc[_0x310639[_0xb352('0x1d')]+_0xb352('0x40')][_0xb352('0x41')](_0x5603f3,{'UserId':_0x310639['message'][_0xb352('0x42')]})[_0xb352('0x43')](function(){logger['error'](_0xb352('0x44'));});}}return _0x4b7574({'code':0xc8,'message':_0x310639});}catch(_0x110dc8){logger['error'](_0x110dc8[_0xb352('0x3b')]);return _0x509db5(_0x25d99d[_0xb352('0x32')](0x1f4,_0x110dc8));}}logger[_0xb352('0x32')](_0xb352('0x45'));return _0x509db5(_0x25d99d[_0xb352('0x32')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x3d1150){var _0x2756e7=this;return new Promise(function(_0x26d811,_0xa45471){if(_0x3d1150[_0xb352('0x3c')]&&_0x3d1150[_0xb352('0x3c')]['id']){try{if(_0x5aceb5[_0xb352('0x3d')][_0x3d1150[_0xb352('0x3c')]['id']]){_0x5aceb5[_0xb352('0x3d')][_0x3d1150[_0xb352('0x3c')]['id']][_0xb352('0x46')]=![];_0x5aceb5[_0xb352('0x3d')][_0x3d1150[_0xb352('0x3c')]['id']][_0xb352('0x3e')]=undefined;}return _0x26d811({'code':0xc8,'message':_0x3d1150});}catch(_0x304831){logger[_0xb352('0x32')](_0x304831[_0xb352('0x3b')]);return _0xa45471(_0x2756e7['error'](0x1f4,_0x304831));}}logger[_0xb352('0x32')](_0xb352('0x45'));return _0xa45471(_0x2756e7[_0xb352('0x32')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x554449){var _0x4a3b16=this;return new Promise(function(_0x3eaf7f,_0x3d771e){if(_0x554449[_0xb352('0x1d')]&&_0x554449['interaction']&&_0x554449['interaction']['id']){try{var _0x3779ee=getId(_0x554449[_0xb352('0x1d')],_0x554449['message']?_0x554449[_0xb352('0x11')]['id']:0x0,_0x554449[_0xb352('0x12')]?_0x554449[_0xb352('0x12')]['id']:0x0);if(_0x5aceb5['rules'][_0x3779ee]){_0x5aceb5[_0xb352('0x33')][_0x3779ee][_0xb352('0x38')]('end');}return _0x3eaf7f({'code':0xc8,'message':_0x554449});}catch(_0x276b77){logger['error'](_0x276b77[_0xb352('0x3b')]);return _0x3d771e(_0x4a3b16[_0xb352('0x32')](0x1f4,_0x276b77));}}logger[_0xb352('0x32')](_0xb352('0x45'));return _0x3d771e(_0x4a3b16['error'](0x1f4,_0xb352('0x45')));});},'AgentCapacity':function(_0x2f3b82){var _0x4f84d3=this;return new Promise(function(_0xebb8b4,_0x4c2721){if(_0x5aceb5[_0xb352('0x3d')][_0xb352('0x47')](_0x2f3b82['id'])){for(var _0x31ae64 in _0x2f3b82[_0xb352('0x48')]){if(_0x2f3b82[_0xb352('0x48')][_0xb352('0x47')](_0x31ae64)){if(_0x5aceb5['agents'][_0x2f3b82['id']][_0xb352('0x47')](_0x31ae64+_0xb352('0x49'))){_0x5aceb5[_0xb352('0x3d')][_0x2f3b82['id']][_0x31ae64+_0xb352('0x49')]=parseInt(_0x2f3b82[_0xb352('0x48')][_0x31ae64],0xa);}}}_0x5aceb5['agents'][_0x2f3b82['id']][_0xb352('0x4a')]();return _0xebb8b4({'code':0xc8,'message':_0x5aceb5[_0xb352('0x3d')][_0x2f3b82['id']]});}else{return _0x4c2721(_0x4f84d3[_0xb352('0x32')](0x1f4,_0xb352('0x4b')));}});},'Agents':function(_0x15a8b4){return new Promise(function(_0x45a040){var _0x16a3d2=_[_0xb352('0x4c')](_0x5aceb5[_0xb352('0x3d')]);if(_0x15a8b4&&_0x15a8b4['id']){var _0x3c437e=_['find'](_0x16a3d2,function(_0x26f953){return _0x26f953['id']===_0x15a8b4['id'];});_0x45a040(_0x3c437e);}else{_0x45a040({'count':_0x16a3d2[_0xb352('0x16')],'rows':_0x16a3d2});}});},'ChatQueues':function(){return new Promise(function(_0x474949){var _0x5a7a63=[];for(var _0x26d8c4 in _0x5aceb5[_0xb352('0x4d')]){if(_0x5aceb5['chatQueues'][_0xb352('0x47')](_0x26d8c4)){var _0x560dd1=_0x5aceb5['chatQueues'][_0x26d8c4];var _0x1afa35={'id':_0x560dd1['id'],'available':_0x560dd1['available'],'loggedIn':_0x560dd1[_0xb352('0x4e')],'name':_0x560dd1[_0xb352('0x4f')],'paused':_0x560dd1['paused'],'waiting':_0x560dd1['waiting']};_0x5a7a63[_0xb352('0x1f')](_0x1afa35);}}_0x474949({'count':_0x5a7a63[_0xb352('0x16')],'rows':_0x5a7a63});});},'MailQueues':function(){return new Promise(function(_0x11fa08){var _0x40f5c5=[];for(var _0x39b65a in _0x5aceb5[_0xb352('0x50')]){if(_0x5aceb5['mailQueues']['hasOwnProperty'](_0x39b65a)){var _0x307a83=_0x5aceb5[_0xb352('0x50')][_0x39b65a];var _0x111ebe={'id':_0x307a83['id'],'available':_0x307a83[_0xb352('0x51')],'loggedIn':_0x307a83['loggedIn'],'name':_0x307a83[_0xb352('0x4f')],'paused':_0x307a83['paused'],'waiting':_0x307a83['waiting']};_0x40f5c5[_0xb352('0x1f')](_0x111ebe);}}_0x11fa08({'count':_0x40f5c5[_0xb352('0x16')],'rows':_0x40f5c5});});},'OpenchannelQueues':function(){return new Promise(function(_0x554f1f){var _0x4f4184=[];for(var _0x126688 in _0x5aceb5[_0xb352('0x52')]){if(_0x5aceb5[_0xb352('0x52')]['hasOwnProperty'](_0x126688)){var _0x3c8704=_0x5aceb5[_0xb352('0x52')][_0x126688];var _0x31a7d4={'id':_0x3c8704['id'],'available':_0x3c8704['available'],'loggedIn':_0x3c8704[_0xb352('0x4e')],'name':_0x3c8704[_0xb352('0x4f')],'paused':_0x3c8704[_0xb352('0x53')],'waiting':_0x3c8704[_0xb352('0x54')]};_0x4f4184[_0xb352('0x1f')](_0x31a7d4);}}_0x554f1f({'count':_0x4f4184[_0xb352('0x16')],'rows':_0x4f4184});});},'SmsQueues':function(){return new Promise(function(_0xc34267){var _0x4fd67f=[];for(var _0x29b1ea in _0x5aceb5[_0xb352('0x55')]){if(_0x5aceb5['smsQueues'][_0xb352('0x47')](_0x29b1ea)){var _0x2bc079=_0x5aceb5[_0xb352('0x55')][_0x29b1ea];var _0x2a414e={'id':_0x2bc079['id'],'available':_0x2bc079[_0xb352('0x51')],'loggedIn':_0x2bc079[_0xb352('0x4e')],'name':_0x2bc079[_0xb352('0x4f')],'paused':_0x2bc079[_0xb352('0x53')],'waiting':_0x2bc079[_0xb352('0x54')]};_0x4fd67f[_0xb352('0x1f')](_0x2a414e);}}_0xc34267({'count':_0x4fd67f[_0xb352('0x16')],'rows':_0x4fd67f});});},'FaxQueues':function(){return new Promise(function(_0x3be544){var _0x2c1cb0=[];for(var _0x48632f in _0x5aceb5[_0xb352('0x56')]){if(_0x5aceb5['faxQueues']['hasOwnProperty'](_0x48632f)){var _0x5ec6d8=_0x5aceb5['faxQueues'][_0x48632f];var _0x10e117={'id':_0x5ec6d8['id'],'available':_0x5ec6d8['available'],'loggedIn':_0x5ec6d8[_0xb352('0x4e')],'name':_0x5ec6d8[_0xb352('0x4f')],'paused':_0x5ec6d8[_0xb352('0x53')],'waiting':_0x5ec6d8['waiting']};_0x2c1cb0[_0xb352('0x1f')](_0x10e117);}}_0x3be544({'count':_0x2c1cb0[_0xb352('0x16')],'rows':_0x2c1cb0});});},'WhatsappQueues':function(){return new Promise(function(_0x43ae86){var _0x28aa05=[];for(var _0xc37253 in _0x5aceb5[_0xb352('0x57')]){if(_0x5aceb5[_0xb352('0x57')]['hasOwnProperty'](_0xc37253)){var _0x4b45d1=_0x5aceb5['whatsappQueues'][_0xc37253];var _0x26d912={'id':_0x4b45d1['id'],'available':_0x4b45d1[_0xb352('0x51')],'loggedIn':_0x4b45d1['loggedIn'],'name':_0x4b45d1['name'],'paused':_0x4b45d1[_0xb352('0x53')],'waiting':_0x4b45d1[_0xb352('0x54')]};_0x28aa05['push'](_0x26d912);}}_0x43ae86({'count':_0x28aa05[_0xb352('0x16')],'rows':_0x28aa05});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x284531){var _0x35d94f=_[_0xb352('0x4c')](_0x5aceb5[_0xb352('0x58')]);_0x284531({'count':_0x35d94f[_0xb352('0x16')],'rows':_0x35d94f});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x477954){var _0x5ef00c=_[_0xb352('0x4c')](_0x5aceb5[_0xb352('0x59')]);_0x477954({'count':_0x5ef00c['length'],'rows':_0x5ef00c});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x1b5e17){var _0x29ad78=_[_0xb352('0x4c')](_0x5aceb5['openchannelQueuesWaitingInteractions']);_0x1b5e17({'count':_0x29ad78[_0xb352('0x16')],'rows':_0x29ad78});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x325056){var _0x3e3bcf=_[_0xb352('0x4c')](_0x5aceb5['smsQueuesWaitingInteractions']);_0x325056({'count':_0x3e3bcf[_0xb352('0x16')],'rows':_0x3e3bcf});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x5b0896){var _0x71c583=_[_0xb352('0x4c')](_0x5aceb5[_0xb352('0x5a')]);_0x5b0896({'count':_0x71c583[_0xb352('0x16')],'rows':_0x71c583});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x3986d4){var _0xe16e74=_['values'](_0x5aceb5['whatsappQueuesWaitingInteractions']);_0x3986d4({'count':_0xe16e74[_0xb352('0x16')],'rows':_0xe16e74});});}};var _0x1449e0=jayson[_0xb352('0x5b')](_0x1a0573)[_0xb352('0x5c')]();_0x1449e0['on'](_0xb352('0x32'),function(_0x233090){logger['error'](JSON[_0xb352('0x37')](_0x233090));return _0x1636f4(_0x233090);});_0x1449e0[_0xb352('0x10')](0x232c,_0xb352('0x5d'),function(){console[_0xb352('0x5e')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x26fac9(_0xb352('0x5f')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 39b879b..2078270 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 _0x312e=['[%s][INTERVAL]\x20ROUTING\x20STOPPED','some','\x20|\x20','when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','join','stop','../../../utils/iftime','iftime','../../../config/logger','routing','rules','info'];(function(_0x2a4284,_0xf6a40f){var _0x28cd6f=function(_0x110244){while(--_0x110244){_0x2a4284['push'](_0x2a4284['shift']());}};_0x28cd6f(++_0xf6a40f);}(_0x312e,0xd7));var _0xe312=function(_0x38be7c,_0xa2935){_0x38be7c=_0x38be7c-0x0;var _0xa350b7=_0x312e[_0x38be7c];return _0xa350b7;};'use strict';var _=require('lodash');var iftime=require(_0xe312('0x0'))[_0xe312('0x1')];var logger=require(_0xe312('0x2'))(_0xe312('0x3'));exports['condition']=function(_0x1c6588,_0x562a58,_0x5c747a){return function(_0x100b59){if(_0x5c747a[_0xe312('0x4')]&&!_0x5c747a[_0xe312('0x4')][_0x1c6588]){logger[_0xe312('0x5')](_0xe312('0x6'),_0x1c6588);return _0x100b59['stop']();}var _0x4e06fa=_0x562a58['map'](function(_0x22572e){return iftime(_0x22572e);});var _0x1213d5=_[_0xe312('0x7')](_0x4e06fa);if(_0x1213d5){logger[_0xe312('0x5')]('[%s][INTERVAL\x20VALID]\x20%s\x20%s',_0x1c6588,_0x562a58['join'](_0xe312('0x8')),_0x1213d5);_0x100b59[_0xe312('0x9')](_0x1213d5);}else{logger[_0xe312('0x5')](_0xe312('0xa'),_0x1c6588,_0x562a58[_0xe312('0xb')](_0xe312('0x8')));_0x100b59[_0xe312('0xc')]();}};}; \ No newline at end of file +var _0x7e54=['when','iftime','../../../config/logger','routing','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','map','some','[%s][INTERVAL\x20VALID]\x20%s\x20%s','join','\x20|\x20'];(function(_0x209f63,_0x3720c8){var _0x1d81bf=function(_0x1da07b){while(--_0x1da07b){_0x209f63['push'](_0x209f63['shift']());}};_0x1d81bf(++_0x3720c8);}(_0x7e54,0xb7));var _0x47e5=function(_0x1334d7,_0x28edcc){_0x1334d7=_0x1334d7-0x0;var _0x5c53b8=_0x7e54[_0x1334d7];return _0x5c53b8;};'use strict';var _=require('lodash');var iftime=require('../../../utils/iftime')[_0x47e5('0x0')];var logger=require(_0x47e5('0x1'))(_0x47e5('0x2'));exports[_0x47e5('0x3')]=function(_0x5f3862,_0x179d53,_0x5a6eb5){return function(_0x2f6497){if(_0x5a6eb5[_0x47e5('0x4')]&&!_0x5a6eb5['rules'][_0x5f3862]){logger[_0x47e5('0x5')](_0x47e5('0x6'),_0x5f3862);return _0x2f6497[_0x47e5('0x7')]();}var _0x4bd367=_0x179d53[_0x47e5('0x8')](function(_0x40eafc){return iftime(_0x40eafc);});var _0x3f63b0=_[_0x47e5('0x9')](_0x4bd367);if(_0x3f63b0){logger[_0x47e5('0x5')](_0x47e5('0xa'),_0x5f3862,_0x179d53[_0x47e5('0xb')](_0x47e5('0xc')),_0x3f63b0);_0x2f6497[_0x47e5('0xd')](_0x3f63b0);}else{logger['info']('[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s',_0x5f3862,_0x179d53[_0x47e5('0xb')](_0x47e5('0xc')));_0x2f6497['stop']();}};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 97fe2b0..0f46185 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 _0xb43b=['type','agentcomplete','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','agentcalled','format','destuniqueid','connectedlinenum','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','[%s][agents][agentcalled]','agentringnoanswer','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','reason','timeout','ringtime','talktime','push','error','forIn','membername','agentringnoanswerAt','now','abandoned','holdtime','[%s][agents][queuecallerabandon]','agentconnect','debug','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','agentconnectAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','transferuniqueid','origtransfereruniqueid','transfereeuniqueid','agententerreason','clone','calleridname','agentcalledAt','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','lodash','util','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','calleridnum','lastevent','getVoiceQueueByName','then'];(function(_0xca2c3c,_0x53ce03){var _0x2f9e00=function(_0x6631f0){while(--_0x6631f0){_0xca2c3c['push'](_0xca2c3c['shift']());}};_0x2f9e00(++_0x53ce03);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5a9cf0,_0x1a8f6c){_0x5a9cf0=_0x5a9cf0-0x0;var _0x414271=_0xb43b[_0x5a9cf0];return _0x414271;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x1bdcfc,_0x1995f8){utils[_0xbb43('0x2')](util['format'](_0xbb43('0x3'),_0x1bdcfc[_0xbb43('0x4')],_0x1bdcfc[_0xbb43('0x5')],_0x1bdcfc[_0xbb43('0x6')],_0x1bdcfc['membername'],_0x1bdcfc['interface'],_0x1bdcfc[_0xbb43('0x7')],_0x1bdcfc['connectedlinenum'],_0x1bdcfc[_0xbb43('0x8')]));if(_0x1bdcfc[_0xbb43('0x6')]){utils[_0xbb43('0x9')](_0x1bdcfc[_0xbb43('0x6')])[_0xbb43('0xa')](function(_0x4a06f3){if(_0x4a06f3){_0x1bdcfc[_0xbb43('0xb')]=_0x4a06f3[_0xbb43('0xb')];_0x1bdcfc['agentacw']=_0x1bdcfc[_0xbb43('0xc')]?_0x4a06f3[_0xbb43('0xd')]:![];_0x1bdcfc[_0xbb43('0xe')]=_0x1bdcfc[_0xbb43('0xf')]?_0x4a06f3[_0xbb43('0x10')]:0x0;}utils[_0xbb43('0x11')]('CreateVoiceAgentReport',_0x1bdcfc);});}else{utils[_0xbb43('0x11')](_0xbb43('0x12'),_0x1bdcfc);}if(_0x1995f8){delete transfers[_0x1bdcfc['uniqueid']];}else{delete agents[_0x1bdcfc['destuniqueid']];}}exports[_0xbb43('0x13')]=function(_0x4a3714){try{utils['debug'](util[_0xbb43('0x14')]('[%s][agents][agentcalled]',_0x4a3714[_0xbb43('0x4')]),_0x4a3714);agents[_0x4a3714[_0xbb43('0x15')]]=_0x4a3714;agents[_0x4a3714['destuniqueid']]['agentcalledAt']=utils['now']();agents[_0x4a3714[_0xbb43('0x15')]][_0xbb43('0x8')]='called';agents[_0x4a3714['destuniqueid']][_0xbb43('0x16')]=null;agents[_0x4a3714['destuniqueid']]['connectedlinename']=null;utils[_0xbb43('0x2')](util[_0xbb43('0x14')](_0xbb43('0x17'),_0x4a3714['uniqueid'],agents[_0x4a3714[_0xbb43('0x15')]]['membername'],_0x4a3714[_0xbb43('0x15')]));}catch(_0x8e6429){utils['error'](util['format'](_0xbb43('0x18'),_0x4a3714[_0xbb43('0x4')]),_0x8e6429);}};exports[_0xbb43('0x19')]=function(_0x2bf2d4){try{if(!_['isNil'](agents[_0x2bf2d4[_0xbb43('0x15')]])){utils['debug'](util[_0xbb43('0x14')]('[%s][agents][agentringnoanswer]',_0x2bf2d4[_0xbb43('0x4')]),_0x2bf2d4);utils['info'](util[_0xbb43('0x14')](_0xbb43('0x1a'),_0x2bf2d4['uniqueid'],agents[_0x2bf2d4[_0xbb43('0x15')]]['membername'],_0x2bf2d4[_0xbb43('0x15')]));agents[_0x2bf2d4[_0xbb43('0x15')]][_0xbb43('0x19')]=!![];agents[_0x2bf2d4['destuniqueid']]['agentringnoanswerAt']=utils['now']();agents[_0x2bf2d4[_0xbb43('0x15')]][_0xbb43('0x8')]='timeout';agents[_0x2bf2d4[_0xbb43('0x15')]][_0xbb43('0x1b')]=_0xbb43('0x1c');agents[_0x2bf2d4[_0xbb43('0x15')]]['holdtime']=_0x2bf2d4['ringtime']?parseInt(_0x2bf2d4[_0xbb43('0x1d')])/0x3e8:0x0;agents[_0x2bf2d4[_0xbb43('0x15')]][_0xbb43('0x1e')]=0x0;unanswered[_0xbb43('0x1f')](_0x2bf2d4[_0xbb43('0x15')]);}}catch(_0x40b04b){utils[_0xbb43('0x20')](util[_0xbb43('0x14')]('[%s][agents][agentringnoanswer]',_0x2bf2d4[_0xbb43('0x4')]),_0x40b04b);}};exports['queuecallerabandon']=function(_0x31fbc8){try{_[_0xbb43('0x21')](agents,function(_0x34f5b2,_0x1880cd){if(_0x34f5b2['uniqueid']==_0x31fbc8[_0xbb43('0x4')]&&!_['includes'](unanswered,_0x34f5b2['destuniqueid'])){utils['debug'](util[_0xbb43('0x14')]('[%s][agents][queuecallerabandon]',_0x31fbc8[_0xbb43('0x4')]),_0x31fbc8);utils[_0xbb43('0x2')](util[_0xbb43('0x14')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x31fbc8[_0xbb43('0x4')],_0x34f5b2[_0xbb43('0x22')],_0x34f5b2[_0xbb43('0x15')]));_0x34f5b2[_0xbb43('0x19')]=!![];_0x34f5b2[_0xbb43('0x23')]=utils[_0xbb43('0x24')]();_0x34f5b2[_0xbb43('0x8')]=_0xbb43('0x25');_0x34f5b2['reason']=_0xbb43('0x25');_0x34f5b2[_0xbb43('0x26')]=_0x31fbc8[_0xbb43('0x26')];_0x34f5b2[_0xbb43('0x1e')]=0x0;writeDB(_0x34f5b2);}});}catch(_0x4015ec){utils[_0xbb43('0x20')](util[_0xbb43('0x14')](_0xbb43('0x27'),_0x31fbc8[_0xbb43('0x4')]),_0x4015ec);}};exports[_0xbb43('0x28')]=function(_0x21346a){try{if(agents[_0x21346a[_0xbb43('0x15')]]){utils[_0xbb43('0x29')](util[_0xbb43('0x14')](_0xbb43('0x2a'),_0x21346a[_0xbb43('0x4')]),_0x21346a);utils['info'](util[_0xbb43('0x14')](_0xbb43('0x2b'),_0x21346a['uniqueid'],agents[_0x21346a[_0xbb43('0x15')]][_0xbb43('0x22')],_0x21346a[_0xbb43('0x15')]));agents[_0x21346a['destuniqueid']]['agentconnectAt']=utils['now']();agents[_0x21346a[_0xbb43('0x15')]][_0xbb43('0x16')]=_0x21346a['connectedlinenum'];agents[_0x21346a['destuniqueid']][_0xbb43('0x2c')]=_0x21346a[_0xbb43('0x2c')];agents[_0x21346a[_0xbb43('0x15')]][_0xbb43('0x26')]=_0x21346a[_0xbb43('0x1d')];agents[_0x21346a['destuniqueid']][_0xbb43('0x8')]=_0xbb43('0x2d');_[_0xbb43('0x21')](agents,function(_0x3340aa,_0x22fccc){if(_0x3340aa['destuniqueid']!=_0x21346a[_0xbb43('0x15')]&&_0x3340aa['uniqueid']==_0x21346a[_0xbb43('0x4')]){_0x3340aa[_0xbb43('0x1e')]=0x0;_0x3340aa['holdtime']=_0x21346a[_0xbb43('0x1d')];_0x3340aa['agentringnoanswer']=!![];_0x3340aa[_0xbb43('0x23')]=utils[_0xbb43('0x24')]();_0x3340aa[_0xbb43('0x8')]=_0xbb43('0x2e');_0x3340aa['reason']=_0xbb43('0x2e');_0x3340aa[_0xbb43('0x2f')]=_0x21346a['destuniqueid'];_0x3340aa[_0xbb43('0x30')]=_0x21346a['membername'];writeDB(_0x3340aa);}});}}catch(_0x42b965){utils[_0xbb43('0x20')](util[_0xbb43('0x14')](_0xbb43('0x2a'),_0x21346a[_0xbb43('0x4')]),_0x42b965);}};exports[_0xbb43('0xc')]=function(_0x4bf8ed){try{if(!_[_0xbb43('0x31')](agents[_0x4bf8ed['destuniqueid']])){utils[_0xbb43('0x29')](util[_0xbb43('0x14')](_0xbb43('0x32'),_0x4bf8ed[_0xbb43('0x4')]),_0x4bf8ed);utils['info'](util[_0xbb43('0x14')](_0xbb43('0x33'),_0x4bf8ed[_0xbb43('0x4')],agents[_0x4bf8ed[_0xbb43('0x15')]][_0xbb43('0x22')],_0x4bf8ed[_0xbb43('0x15')]));agents[_0x4bf8ed[_0xbb43('0x15')]][_0xbb43('0xc')]=!![];agents[_0x4bf8ed['destuniqueid']][_0xbb43('0x34')]=utils[_0xbb43('0x24')]();agents[_0x4bf8ed['destuniqueid']][_0xbb43('0x1e')]=utils['diffTime'](agents[_0x4bf8ed['destuniqueid']]['agentcompleteAt'],agents[_0x4bf8ed['destuniqueid']][_0xbb43('0x35')]);agents[_0x4bf8ed['destuniqueid']][_0xbb43('0x1b')]=_0x4bf8ed['reason'];agents[_0x4bf8ed[_0xbb43('0x15')]][_0xbb43('0x8')]=_0xbb43('0x36');writeDB(agents[_0x4bf8ed['destuniqueid']]);}}catch(_0x186cd6){utils['error'](util[_0xbb43('0x14')](_0xbb43('0x32'),_0x4bf8ed[_0xbb43('0x4')]),_0x186cd6);}};exports[_0xbb43('0x37')]=function(_0x417ad9){try{if(!_[_0xbb43('0x31')](agents[_0x417ad9[_0xbb43('0x38')]])){utils['debug'](util[_0xbb43('0x14')](_0xbb43('0x39'),_0x417ad9[_0xbb43('0x4')]),_0x417ad9);utils[_0xbb43('0x2')](util['format'](_0xbb43('0x3a'),_0x417ad9[_0xbb43('0x4')],agents[_0x417ad9[_0xbb43('0x38')]][_0xbb43('0x22')],agents[_0x417ad9['transfereruniqueid']][_0xbb43('0x4')]));agents[_0x417ad9[_0xbb43('0x38')]][_0xbb43('0x3b')]=!![];agents[_0x417ad9['transfereruniqueid']][_0xbb43('0x3c')]=_0xbb43('0x3d');agents[_0x417ad9[_0xbb43('0x38')]][_0xbb43('0x3e')]=_0x417ad9[_0xbb43('0x3f')];agents[_0x417ad9['transfereruniqueid']]['transferuniqueid']=agents[_0x417ad9[_0xbb43('0x38')]]['uniqueid'];}}catch(_0xf5d5c){utils[_0xbb43('0x20')](util['format'](_0xbb43('0x39'),_0x417ad9[_0xbb43('0x4')]),_0xf5d5c);}};exports[_0xbb43('0x40')]=function(_0x1a4367){try{utils[_0xbb43('0x29')](util['format'](_0xbb43('0x41'),_0x1a4367['origtransfereruniqueid']),_0x1a4367);if(_0x1a4367['origtransfereruniqueid']==_0x1a4367[_0xbb43('0x42')]){if(!_[_0xbb43('0x31')](agents[_0x1a4367[_0xbb43('0x43')]])){utils[_0xbb43('0x2')](util[_0xbb43('0x14')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x1a4367['origtransfereruniqueid'],agents[_0x1a4367[_0xbb43('0x43')]][_0xbb43('0x22')]));agents[_0x1a4367[_0xbb43('0x43')]][_0xbb43('0x3b')]=!![];agents[_0x1a4367[_0xbb43('0x43')]][_0xbb43('0x3c')]=_0xbb43('0x44');agents[_0x1a4367[_0xbb43('0x43')]][_0xbb43('0x3e')]=_0x1a4367['origtransfererexten'];agents[_0x1a4367[_0xbb43('0x43')]][_0xbb43('0x45')]=_0x1a4367[_0xbb43('0x46')];}if(_0x1a4367[_0xbb43('0x47')]&&agents[_0x1a4367[_0xbb43('0x47')]]){agents[_0x1a4367[_0xbb43('0x47')]][_0xbb43('0x48')]=0x1;transfers[_0x1a4367[_0xbb43('0x47')]]=_[_0xbb43('0x49')](agents[_0x1a4367['transfereeuniqueid']]);transfers[_0x1a4367['transfereeuniqueid']][_0xbb43('0x7')]=agents[_0x1a4367[_0xbb43('0x43')]][_0xbb43('0x7')];transfers[_0x1a4367[_0xbb43('0x47')]][_0xbb43('0x4a')]=agents[_0x1a4367[_0xbb43('0x43')]][_0xbb43('0x4a')];transfers[_0x1a4367['transfereeuniqueid']][_0xbb43('0x4b')]=utils['now']();transfers[_0x1a4367['transfereeuniqueid']][_0xbb43('0x35')]=utils[_0xbb43('0x24')]();transfers[_0x1a4367[_0xbb43('0x47')]][_0xbb43('0x26')]=0x0;transfers[_0x1a4367[_0xbb43('0x47')]][_0xbb43('0x48')]=0x2;}}else if(_0x1a4367[_0xbb43('0x43')]==_0x1a4367[_0xbb43('0x4c')]){if(!_['isNil'](agents[_0x1a4367['origtransfereruniqueid']])){utils[_0xbb43('0x2')](util[_0xbb43('0x14')](_0xbb43('0x4d'),_0x1a4367[_0xbb43('0x46')],agents[_0x1a4367[_0xbb43('0x46')]][_0xbb43('0x22')]));agents[_0x1a4367[_0xbb43('0x46')]][_0xbb43('0x3b')]=!![];agents[_0x1a4367[_0xbb43('0x46')]]['transfertype']=_0xbb43('0x44');agents[_0x1a4367[_0xbb43('0x46')]][_0xbb43('0x3e')]=_0x1a4367[_0xbb43('0x4e')];agents[_0x1a4367[_0xbb43('0x46')]][_0xbb43('0x45')]=_0x1a4367['secondtransfereruniqueid'];}if(_0x1a4367[_0xbb43('0x4f')]&&agents[_0x1a4367[_0xbb43('0x4f')]]){agents[_0x1a4367[_0xbb43('0x4f')]][_0xbb43('0x48')]=0x1;transfers[_0x1a4367[_0xbb43('0x4f')]]=_['clone'](agents[_0x1a4367[_0xbb43('0x4f')]]);transfers[_0x1a4367[_0xbb43('0x4f')]][_0xbb43('0x7')]=agents[_0x1a4367[_0xbb43('0x46')]][_0xbb43('0x7')];transfers[_0x1a4367[_0xbb43('0x4f')]][_0xbb43('0x4a')]=agents[_0x1a4367[_0xbb43('0x46')]][_0xbb43('0x4a')];transfers[_0x1a4367[_0xbb43('0x4f')]]['agentcalledAt']=utils[_0xbb43('0x24')]();transfers[_0x1a4367['transfertargetuniqueid']][_0xbb43('0x35')]=utils[_0xbb43('0x24')]();transfers[_0x1a4367[_0xbb43('0x4f')]][_0xbb43('0x26')]=0x0;transfers[_0x1a4367[_0xbb43('0x4f')]]['agententerreason']=0x2;}}}catch(_0x59a665){utils[_0xbb43('0x20')](util[_0xbb43('0x14')]('[%s][agents][attendedtransfer]',_0x1a4367[_0xbb43('0x46')]),_0x59a665);}};exports[_0xbb43('0x50')]=function(_0x41d26a){try{utils[_0xbb43('0x29')](util[_0xbb43('0x14')](_0xbb43('0x51'),_0x41d26a[_0xbb43('0x4')]),_0x41d26a);if(agents[_0x41d26a[_0xbb43('0x4')]]&&agents[_0x41d26a[_0xbb43('0x4')]][_0xbb43('0x1b')]===_0xbb43('0x1c')){if(_0x41d26a[_0xbb43('0x52')]==='21'){agents[_0x41d26a[_0xbb43('0x4')]][_0xbb43('0x1b')]='rejected';agents[_0x41d26a['uniqueid']][_0xbb43('0x8')]=_0xbb43('0x53');}utils[_0xbb43('0x2')](util['format'](_0xbb43('0x54'),_0x41d26a[_0xbb43('0x4')],agents[_0x41d26a[_0xbb43('0x4')]][_0xbb43('0x22')],agents[_0x41d26a[_0xbb43('0x4')]]['reason'],agents[_0x41d26a[_0xbb43('0x4')]][_0xbb43('0x8')]));writeDB(agents[_0x41d26a[_0xbb43('0x4')]]);var _0x4c1405=unanswered[_0xbb43('0x55')](_0x41d26a[_0xbb43('0x4')]);if(_0x4c1405>-0x1){unanswered[_0xbb43('0x56')](_0x4c1405,0x1);}}if(transfers[_0x41d26a[_0xbb43('0x4')]]){transfers[_0x41d26a[_0xbb43('0x4')]][_0xbb43('0xc')]=!![];transfers[_0x41d26a[_0xbb43('0x4')]][_0xbb43('0x34')]=utils[_0xbb43('0x24')]();transfers[_0x41d26a[_0xbb43('0x4')]][_0xbb43('0x1e')]=utils['diffTime'](transfers[_0x41d26a[_0xbb43('0x4')]][_0xbb43('0x34')],transfers[_0x41d26a[_0xbb43('0x4')]][_0xbb43('0x35')]);transfers[_0x41d26a[_0xbb43('0x4')]]['reason']='agent';transfers[_0x41d26a['uniqueid']][_0xbb43('0x8')]=_0xbb43('0x36');utils[_0xbb43('0x2')](util[_0xbb43('0x14')](_0xbb43('0x54'),_0x41d26a[_0xbb43('0x4')],transfers[_0x41d26a[_0xbb43('0x4')]]['membername'],transfers[_0x41d26a[_0xbb43('0x4')]][_0xbb43('0x1b')],transfers[_0x41d26a[_0xbb43('0x4')]]['lastevent']));writeDB(transfers[_0x41d26a[_0xbb43('0x4')]],!![]);}if(agents[_0x41d26a['uniqueid']]&&agents[_0x41d26a[_0xbb43('0x4')]]['agentconnectAt']){agents[_0x41d26a[_0xbb43('0x4')]][_0xbb43('0xc')]=!![];agents[_0x41d26a[_0xbb43('0x4')]][_0xbb43('0x34')]=utils[_0xbb43('0x24')]();agents[_0x41d26a[_0xbb43('0x4')]][_0xbb43('0x1e')]=utils[_0xbb43('0x57')](agents[_0x41d26a['uniqueid']][_0xbb43('0x34')],agents[_0x41d26a[_0xbb43('0x4')]]['agentconnectAt']);agents[_0x41d26a[_0xbb43('0x4')]][_0xbb43('0x1b')]=agents[_0x41d26a[_0xbb43('0x4')]]['transfer']?_0xbb43('0x3b'):_0xbb43('0x58');agents[_0x41d26a[_0xbb43('0x4')]][_0xbb43('0x8')]=_0xbb43('0x36');utils[_0xbb43('0x2')](util['format'](_0xbb43('0x54'),_0x41d26a['uniqueid'],agents[_0x41d26a[_0xbb43('0x4')]][_0xbb43('0x22')],agents[_0x41d26a['uniqueid']][_0xbb43('0x1b')],agents[_0x41d26a[_0xbb43('0x4')]]['lastevent']));writeDB(agents[_0x41d26a['uniqueid']]);}}catch(_0x337154){utils[_0xbb43('0x20')](util[_0xbb43('0x14')](_0xbb43('0x51'),_0x41d26a[_0xbb43('0x4')]),_0x337154);}}; \ No newline at end of file +var _0x6e6c=['agentconnectAt','complete','blindtransfer','transfereruniqueid','transfer','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','ATTENDED','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','cause','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','[%s][agents][hangup]','lodash','util','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','interface','connectedlinenum','lastevent','getVoiceQueueByName','queue','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','uniqueid','agentcalledAt','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','format','agentringnoanswer','[%s][agents][agentringnoanswer]','info','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','now','timeout','holdtime','ringtime','talktime','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime'];(function(_0x4c7d63,_0x812270){var _0x5c1d76=function(_0x2e42da){while(--_0x2e42da){_0x4c7d63['push'](_0x4c7d63['shift']());}};_0x5c1d76(++_0x812270);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x370b21,_0x1b63fe){utils['info'](util['format'](_0xc6e6('0x2'),_0x370b21['uniqueid'],_0x370b21[_0xc6e6('0x3')],_0x370b21['queue'],_0x370b21[_0xc6e6('0x4')],_0x370b21[_0xc6e6('0x5')],_0x370b21['calleridnum'],_0x370b21[_0xc6e6('0x6')],_0x370b21[_0xc6e6('0x7')]));if(_0x370b21['queue']){utils[_0xc6e6('0x8')](_0x370b21[_0xc6e6('0x9')])['then'](function(_0x324f05){if(_0x324f05){_0x370b21['type']=_0x324f05[_0xc6e6('0xa')];_0x370b21[_0xc6e6('0xb')]=_0x370b21[_0xc6e6('0xc')]?_0x324f05[_0xc6e6('0xd')]:![];_0x370b21[_0xc6e6('0xe')]=_0x370b21[_0xc6e6('0xb')]?_0x324f05[_0xc6e6('0xf')]:0x0;}utils[_0xc6e6('0x10')](_0xc6e6('0x11'),_0x370b21);});}else{utils['request'](_0xc6e6('0x11'),_0x370b21);}if(_0x1b63fe){delete transfers[_0x370b21['uniqueid']];}else{delete agents[_0x370b21[_0xc6e6('0x12')]];}}exports[_0xc6e6('0x13')]=function(_0x33aea0){try{utils[_0xc6e6('0x14')](util['format'](_0xc6e6('0x15'),_0x33aea0[_0xc6e6('0x16')]),_0x33aea0);agents[_0x33aea0[_0xc6e6('0x12')]]=_0x33aea0;agents[_0x33aea0[_0xc6e6('0x12')]][_0xc6e6('0x17')]=utils['now']();agents[_0x33aea0[_0xc6e6('0x12')]][_0xc6e6('0x7')]='called';agents[_0x33aea0[_0xc6e6('0x12')]][_0xc6e6('0x6')]=null;agents[_0x33aea0[_0xc6e6('0x12')]]['connectedlinename']=null;utils['info'](util['format'](_0xc6e6('0x18'),_0x33aea0['uniqueid'],agents[_0x33aea0[_0xc6e6('0x12')]][_0xc6e6('0x4')],_0x33aea0[_0xc6e6('0x12')]));}catch(_0x41afe6){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x15'),_0x33aea0[_0xc6e6('0x16')]),_0x41afe6);}};exports[_0xc6e6('0x1b')]=function(_0x3d734d){try{if(!_['isNil'](agents[_0x3d734d[_0xc6e6('0x12')]])){utils['debug'](util[_0xc6e6('0x1a')](_0xc6e6('0x1c'),_0x3d734d[_0xc6e6('0x16')]),_0x3d734d);utils[_0xc6e6('0x1d')](util['format'](_0xc6e6('0x1e'),_0x3d734d[_0xc6e6('0x16')],agents[_0x3d734d[_0xc6e6('0x12')]][_0xc6e6('0x4')],_0x3d734d[_0xc6e6('0x12')]));agents[_0x3d734d['destuniqueid']][_0xc6e6('0x1b')]=!![];agents[_0x3d734d['destuniqueid']][_0xc6e6('0x1f')]=utils[_0xc6e6('0x20')]();agents[_0x3d734d[_0xc6e6('0x12')]][_0xc6e6('0x7')]='timeout';agents[_0x3d734d[_0xc6e6('0x12')]]['reason']=_0xc6e6('0x21');agents[_0x3d734d['destuniqueid']][_0xc6e6('0x22')]=_0x3d734d[_0xc6e6('0x23')]?parseInt(_0x3d734d[_0xc6e6('0x23')])/0x3e8:0x0;agents[_0x3d734d[_0xc6e6('0x12')]][_0xc6e6('0x24')]=0x0;unanswered['push'](_0x3d734d[_0xc6e6('0x12')]);}}catch(_0x1501bd){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')]('[%s][agents][agentringnoanswer]',_0x3d734d[_0xc6e6('0x16')]),_0x1501bd);}};exports['queuecallerabandon']=function(_0x29411c){try{_[_0xc6e6('0x25')](agents,function(_0x12c616,_0xc578b3){if(_0x12c616[_0xc6e6('0x16')]==_0x29411c[_0xc6e6('0x16')]&&!_[_0xc6e6('0x26')](unanswered,_0x12c616[_0xc6e6('0x12')])){utils[_0xc6e6('0x14')](util[_0xc6e6('0x1a')](_0xc6e6('0x27'),_0x29411c[_0xc6e6('0x16')]),_0x29411c);utils[_0xc6e6('0x1d')](util[_0xc6e6('0x1a')](_0xc6e6('0x28'),_0x29411c[_0xc6e6('0x16')],_0x12c616[_0xc6e6('0x4')],_0x12c616['destuniqueid']));_0x12c616[_0xc6e6('0x1b')]=!![];_0x12c616[_0xc6e6('0x1f')]=utils['now']();_0x12c616['lastevent']=_0xc6e6('0x29');_0x12c616[_0xc6e6('0x2a')]=_0xc6e6('0x29');_0x12c616[_0xc6e6('0x22')]=_0x29411c[_0xc6e6('0x22')];_0x12c616[_0xc6e6('0x24')]=0x0;writeDB(_0x12c616);}});}catch(_0x59a8f0){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x27'),_0x29411c['uniqueid']),_0x59a8f0);}};exports['agentconnect']=function(_0xa5138d){try{if(agents[_0xa5138d[_0xc6e6('0x12')]]){utils[_0xc6e6('0x14')](util[_0xc6e6('0x1a')]('[%s][agents][agentconnect]',_0xa5138d['uniqueid']),_0xa5138d);utils[_0xc6e6('0x1d')](util['format'](_0xc6e6('0x2b'),_0xa5138d['uniqueid'],agents[_0xa5138d[_0xc6e6('0x12')]][_0xc6e6('0x4')],_0xa5138d[_0xc6e6('0x12')]));agents[_0xa5138d[_0xc6e6('0x12')]]['agentconnectAt']=utils['now']();agents[_0xa5138d[_0xc6e6('0x12')]][_0xc6e6('0x6')]=_0xa5138d[_0xc6e6('0x6')];agents[_0xa5138d[_0xc6e6('0x12')]]['connectedlinename']=_0xa5138d['connectedlinename'];agents[_0xa5138d[_0xc6e6('0x12')]][_0xc6e6('0x22')]=_0xa5138d[_0xc6e6('0x23')];agents[_0xa5138d[_0xc6e6('0x12')]]['lastevent']=_0xc6e6('0x2c');_[_0xc6e6('0x25')](agents,function(_0x5ddab4,_0x500b7e){if(_0x5ddab4[_0xc6e6('0x12')]!=_0xa5138d['destuniqueid']&&_0x5ddab4[_0xc6e6('0x16')]==_0xa5138d[_0xc6e6('0x16')]){_0x5ddab4['talktime']=0x0;_0x5ddab4[_0xc6e6('0x22')]=_0xa5138d['ringtime'];_0x5ddab4[_0xc6e6('0x1b')]=!![];_0x5ddab4['agentringnoanswerAt']=utils[_0xc6e6('0x20')]();_0x5ddab4[_0xc6e6('0x7')]=_0xc6e6('0x2d');_0x5ddab4[_0xc6e6('0x2a')]=_0xc6e6('0x2d');_0x5ddab4[_0xc6e6('0x2e')]=_0xa5138d[_0xc6e6('0x12')];_0x5ddab4[_0xc6e6('0x2f')]=_0xa5138d[_0xc6e6('0x4')];writeDB(_0x5ddab4);}});}}catch(_0x5722db){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x30'),_0xa5138d[_0xc6e6('0x16')]),_0x5722db);}};exports['agentcomplete']=function(_0xc5f4fb){try{if(!_[_0xc6e6('0x31')](agents[_0xc5f4fb[_0xc6e6('0x12')]])){utils[_0xc6e6('0x14')](util['format'](_0xc6e6('0x32'),_0xc5f4fb[_0xc6e6('0x16')]),_0xc5f4fb);utils[_0xc6e6('0x1d')](util[_0xc6e6('0x1a')](_0xc6e6('0x33'),_0xc5f4fb['uniqueid'],agents[_0xc5f4fb[_0xc6e6('0x12')]]['membername'],_0xc5f4fb[_0xc6e6('0x12')]));agents[_0xc5f4fb['destuniqueid']][_0xc6e6('0xc')]=!![];agents[_0xc5f4fb[_0xc6e6('0x12')]][_0xc6e6('0x34')]=utils[_0xc6e6('0x20')]();agents[_0xc5f4fb[_0xc6e6('0x12')]][_0xc6e6('0x24')]=utils[_0xc6e6('0x35')](agents[_0xc5f4fb[_0xc6e6('0x12')]]['agentcompleteAt'],agents[_0xc5f4fb[_0xc6e6('0x12')]][_0xc6e6('0x36')]);agents[_0xc5f4fb[_0xc6e6('0x12')]]['reason']=_0xc5f4fb[_0xc6e6('0x2a')];agents[_0xc5f4fb[_0xc6e6('0x12')]][_0xc6e6('0x7')]=_0xc6e6('0x37');writeDB(agents[_0xc5f4fb[_0xc6e6('0x12')]]);}}catch(_0xefd557){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x32'),_0xc5f4fb[_0xc6e6('0x16')]),_0xefd557);}};exports[_0xc6e6('0x38')]=function(_0x470167){try{if(!_[_0xc6e6('0x31')](agents[_0x470167[_0xc6e6('0x39')]])){utils['debug'](util[_0xc6e6('0x1a')]('[%s][agents][blindtransfer]',_0x470167[_0xc6e6('0x16')]),_0x470167);utils[_0xc6e6('0x1d')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x470167['uniqueid'],agents[_0x470167['transfereruniqueid']]['membername'],agents[_0x470167[_0xc6e6('0x39')]][_0xc6e6('0x16')]));agents[_0x470167[_0xc6e6('0x39')]][_0xc6e6('0x3a')]=!![];agents[_0x470167[_0xc6e6('0x39')]]['transfertype']='blind';agents[_0x470167[_0xc6e6('0x39')]][_0xc6e6('0x3b')]=_0x470167[_0xc6e6('0x3c')];agents[_0x470167[_0xc6e6('0x39')]]['transferuniqueid']=agents[_0x470167[_0xc6e6('0x39')]][_0xc6e6('0x16')];}}catch(_0x286dc1){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')]('[%s][agents][blindtransfer]',_0x470167[_0xc6e6('0x16')]),_0x286dc1);}};exports[_0xc6e6('0x3d')]=function(_0x288912){try{utils['debug'](util[_0xc6e6('0x1a')](_0xc6e6('0x3e'),_0x288912[_0xc6e6('0x3f')]),_0x288912);if(_0x288912[_0xc6e6('0x3f')]==_0x288912[_0xc6e6('0x40')]){if(!_['isNil'](agents[_0x288912[_0xc6e6('0x41')]])){utils[_0xc6e6('0x1d')](util[_0xc6e6('0x1a')](_0xc6e6('0x42'),_0x288912[_0xc6e6('0x3f')],agents[_0x288912['secondtransfereruniqueid']]['membername']));agents[_0x288912['secondtransfereruniqueid']][_0xc6e6('0x3a')]=!![];agents[_0x288912[_0xc6e6('0x41')]][_0xc6e6('0x43')]=_0xc6e6('0x44');agents[_0x288912[_0xc6e6('0x41')]][_0xc6e6('0x3b')]=_0x288912['origtransfererexten'];agents[_0x288912[_0xc6e6('0x41')]]['transferuniqueid']=_0x288912[_0xc6e6('0x3f')];}if(_0x288912[_0xc6e6('0x45')]&&agents[_0x288912[_0xc6e6('0x45')]]){agents[_0x288912['transfereeuniqueid']][_0xc6e6('0x46')]=0x1;transfers[_0x288912['transfereeuniqueid']]=_[_0xc6e6('0x47')](agents[_0x288912['transfereeuniqueid']]);transfers[_0x288912['transfereeuniqueid']][_0xc6e6('0x48')]=agents[_0x288912['secondtransfereruniqueid']]['calleridnum'];transfers[_0x288912[_0xc6e6('0x45')]][_0xc6e6('0x49')]=agents[_0x288912[_0xc6e6('0x41')]][_0xc6e6('0x49')];transfers[_0x288912[_0xc6e6('0x45')]][_0xc6e6('0x17')]=utils[_0xc6e6('0x20')]();transfers[_0x288912[_0xc6e6('0x45')]]['agentconnectAt']=utils[_0xc6e6('0x20')]();transfers[_0x288912[_0xc6e6('0x45')]][_0xc6e6('0x22')]=0x0;transfers[_0x288912[_0xc6e6('0x45')]]['agententerreason']=0x2;}}else if(_0x288912[_0xc6e6('0x41')]==_0x288912[_0xc6e6('0x4a')]){if(!_[_0xc6e6('0x31')](agents[_0x288912['origtransfereruniqueid']])){utils['info'](util[_0xc6e6('0x1a')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x288912['origtransfereruniqueid'],agents[_0x288912[_0xc6e6('0x3f')]][_0xc6e6('0x4')]));agents[_0x288912[_0xc6e6('0x3f')]][_0xc6e6('0x3a')]=!![];agents[_0x288912[_0xc6e6('0x3f')]][_0xc6e6('0x43')]=_0xc6e6('0x44');agents[_0x288912[_0xc6e6('0x3f')]][_0xc6e6('0x3b')]=_0x288912[_0xc6e6('0x4b')];agents[_0x288912[_0xc6e6('0x3f')]]['transferuniqueid']=_0x288912['secondtransfereruniqueid'];}if(_0x288912[_0xc6e6('0x4c')]&&agents[_0x288912['transfertargetuniqueid']]){agents[_0x288912['transfertargetuniqueid']][_0xc6e6('0x46')]=0x1;transfers[_0x288912[_0xc6e6('0x4c')]]=_[_0xc6e6('0x47')](agents[_0x288912['transfertargetuniqueid']]);transfers[_0x288912[_0xc6e6('0x4c')]][_0xc6e6('0x48')]=agents[_0x288912['origtransfereruniqueid']]['calleridnum'];transfers[_0x288912[_0xc6e6('0x4c')]][_0xc6e6('0x49')]=agents[_0x288912[_0xc6e6('0x3f')]][_0xc6e6('0x49')];transfers[_0x288912[_0xc6e6('0x4c')]][_0xc6e6('0x17')]=utils['now']();transfers[_0x288912[_0xc6e6('0x4c')]][_0xc6e6('0x36')]=utils[_0xc6e6('0x20')]();transfers[_0x288912[_0xc6e6('0x4c')]][_0xc6e6('0x22')]=0x0;transfers[_0x288912['transfertargetuniqueid']][_0xc6e6('0x46')]=0x2;}}}catch(_0x3b1549){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x3e'),_0x288912[_0xc6e6('0x3f')]),_0x3b1549);}};exports['hangup']=function(_0x27e74b){try{utils['debug'](util[_0xc6e6('0x1a')]('[%s][agents][hangup]',_0x27e74b['uniqueid']),_0x27e74b);if(agents[_0x27e74b[_0xc6e6('0x16')]]&&agents[_0x27e74b['uniqueid']][_0xc6e6('0x2a')]===_0xc6e6('0x21')){if(_0x27e74b[_0xc6e6('0x4d')]==='21'){agents[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x2a')]='rejected';agents[_0x27e74b[_0xc6e6('0x16')]]['lastevent']='rejected';}utils[_0xc6e6('0x1d')](util[_0xc6e6('0x1a')](_0xc6e6('0x4e'),_0x27e74b['uniqueid'],agents[_0x27e74b[_0xc6e6('0x16')]]['membername'],agents[_0x27e74b['uniqueid']][_0xc6e6('0x2a')],agents[_0x27e74b['uniqueid']][_0xc6e6('0x7')]));writeDB(agents[_0x27e74b[_0xc6e6('0x16')]]);var _0x292107=unanswered[_0xc6e6('0x4f')](_0x27e74b['uniqueid']);if(_0x292107>-0x1){unanswered[_0xc6e6('0x50')](_0x292107,0x1);}}if(transfers[_0x27e74b[_0xc6e6('0x16')]]){transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0xc')]=!![];transfers[_0x27e74b[_0xc6e6('0x16')]]['agentcompleteAt']=utils[_0xc6e6('0x20')]();transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x24')]=utils[_0xc6e6('0x35')](transfers[_0x27e74b['uniqueid']]['agentcompleteAt'],transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x36')]);transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x2a')]=_0xc6e6('0x51');transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x7')]=_0xc6e6('0x37');utils[_0xc6e6('0x1d')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x27e74b[_0xc6e6('0x16')],transfers[_0x27e74b['uniqueid']][_0xc6e6('0x4')],transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x2a')],transfers[_0x27e74b['uniqueid']]['lastevent']));writeDB(transfers[_0x27e74b[_0xc6e6('0x16')]],!![]);}if(agents[_0x27e74b['uniqueid']]&&agents[_0x27e74b[_0xc6e6('0x16')]]['agentconnectAt']){agents[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0xc')]=!![];agents[_0x27e74b['uniqueid']][_0xc6e6('0x34')]=utils[_0xc6e6('0x20')]();agents[_0x27e74b[_0xc6e6('0x16')]]['talktime']=utils[_0xc6e6('0x35')](agents[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x34')],agents[_0x27e74b['uniqueid']][_0xc6e6('0x36')]);agents[_0x27e74b[_0xc6e6('0x16')]]['reason']=agents[_0x27e74b['uniqueid']]['transfer']?_0xc6e6('0x3a'):_0xc6e6('0x51');agents[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x7')]=_0xc6e6('0x37');utils[_0xc6e6('0x1d')](util['format'](_0xc6e6('0x4e'),_0x27e74b['uniqueid'],agents[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x4')],agents[_0x27e74b[_0xc6e6('0x16')]]['reason'],agents[_0x27e74b['uniqueid']][_0xc6e6('0x7')]));writeDB(agents[_0x27e74b[_0xc6e6('0x16')]]);}}catch(_0x1826d){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x52'),_0x27e74b[_0xc6e6('0x16')]),_0x1826d);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 670e63c..68b0851 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 _0xac6d=['xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','lastIndexOf','noop','execif','NO\x20ANSWER','ANSWERED','FAILED','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','calleridnum','connectedlinenum','accountcode','UserId','CreateVoiceCallReport','newchannel','debug','linkedid','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','[%s][calls][newchannel]','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','_attended','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s'];(function(_0x200276,_0x3a39b5){var _0x496325=function(_0x36551d){while(--_0x36551d){_0x200276['push'](_0x200276['shift']());}};_0x496325(++_0x3a39b5);}(_0xac6d,0xce));var _0xdac6=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xac6d[_0x4fde08];return _0x12e725;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var dispositions=[_0xdac6('0x0'),'FAILED','FAILED',_0xdac6('0x0'),_0xdac6('0x0'),_0xdac6('0x0'),_0xdac6('0x1'),'BUSY',_0xdac6('0x2'),_0xdac6('0x2'),'FAILED'];var channels={};function writeDB(_0x59dd8a){utils[_0xdac6('0x3')](util[_0xdac6('0x4')](_0xdac6('0x5'),_0x59dd8a[_0xdac6('0x6')],_0x59dd8a['channel'],_0x59dd8a[_0xdac6('0x7')],_0x59dd8a[_0xdac6('0x8')],_0x59dd8a[_0xdac6('0x9')],_0x59dd8a[_0xdac6('0xa')],_0x59dd8a[_0xdac6('0xb')],_0x59dd8a['lastevent']));if(_0x59dd8a[_0xdac6('0xc')]){utils['getUserByInternal'](_0x59dd8a[_0xdac6('0xc')])['then'](function(_0x1e42b8){if(_0x1e42b8){_0x59dd8a[_0xdac6('0xd')]=_0x1e42b8['id'];}utils['request'](_0xdac6('0xe'),_0x59dd8a);});}else{utils['request'](_0xdac6('0xe'),_0x59dd8a);}if(channels[_0x59dd8a[_0xdac6('0x6')]]){delete channels[_0x59dd8a[_0xdac6('0x6')]];}}exports[_0xdac6('0xf')]=function(_0x4ce42b){try{utils[_0xdac6('0x10')](util[_0xdac6('0x4')]('[%s][calls][newchannel]',_0x4ce42b[_0xdac6('0x6')]),_0x4ce42b);if(_0x4ce42b[_0xdac6('0x6')]==_0x4ce42b[_0xdac6('0x11')]&&_0x4ce42b[_0xdac6('0x12')]!=_0xdac6('0x13')){utils[_0xdac6('0x3')](util['format'](_0xdac6('0x14'),_0x4ce42b[_0xdac6('0x6')],_0x4ce42b[_0xdac6('0x15')],_0x4ce42b[_0xdac6('0x16')]));channels[_0x4ce42b[_0xdac6('0x6')]]={'uniqueid':_0x4ce42b[_0xdac6('0x6')],'accountcode':_0x4ce42b['accountcode'],'source':_0x4ce42b['calleridnum'],'destination':_0x4ce42b[_0xdac6('0x16')],'destinationcontext':_0x4ce42b[_0xdac6('0x15')],'channel':_0x4ce42b['channel'],'starttime':utils[_0xdac6('0x17')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xdac6('0x0'),'amaflags':_0xdac6('0x18')};}}catch(_0x2e87e2){utils[_0xdac6('0x19')](util[_0xdac6('0x4')](_0xdac6('0x1a'),_0x4ce42b[_0xdac6('0x6')]),_0x2e87e2);}};exports['newstate']=function(_0x4cd09a){try{utils['debug'](util[_0xdac6('0x4')](_0xdac6('0x1b'),_0x4cd09a[_0xdac6('0x6')]),_0x4cd09a);if(!_['isNil'](channels[_0x4cd09a[_0xdac6('0x6')]])&&_0x4cd09a[_0xdac6('0x1c')]==0x6){utils[_0xdac6('0x3')](util[_0xdac6('0x4')](_0xdac6('0x1d'),_0x4cd09a['uniqueid'],_0x4cd09a[_0xdac6('0x15')],_0x4cd09a['channel']));if(_[_0xdac6('0x1e')](channels[_0x4cd09a[_0xdac6('0x6')]]['systemanswertime'])){channels[_0x4cd09a['uniqueid']][_0xdac6('0x1f')]=utils['now']();}}else if(!_['isNil'](channels[_0x4cd09a[_0xdac6('0x11')]])&&_0x4cd09a[_0xdac6('0x1c')]==0x6&&_0x4cd09a[_0xdac6('0x15')]!='transfer'){utils[_0xdac6('0x3')](util[_0xdac6('0x4')](_0xdac6('0x20'),_0x4cd09a[_0xdac6('0x6')],_0x4cd09a['linkedid'],_0x4cd09a['context'],_0x4cd09a[_0xdac6('0x12')]));channels[_0x4cd09a[_0xdac6('0x11')]][_0xdac6('0xc')]=_0x4cd09a[_0xdac6('0xc')];channels[_0x4cd09a[_0xdac6('0x11')]][_0xdac6('0x21')]=_0x4cd09a[_0xdac6('0x12')];if(_[_0xdac6('0x1e')](channels[_0x4cd09a[_0xdac6('0x11')]][_0xdac6('0x22')])){channels[_0x4cd09a[_0xdac6('0x11')]][_0xdac6('0x22')]=utils[_0xdac6('0x17')]();}channels[_0x4cd09a[_0xdac6('0x11')]]['disposition']=dispositions[_[_0xdac6('0x23')](_0x4cd09a[_0xdac6('0x1c')])]||'ANSWERED';}}catch(_0x5b1623){utils[_0xdac6('0x19')](util[_0xdac6('0x4')](_0xdac6('0x1b'),_0x4cd09a['uniqueid']),_0x5b1623);}};exports[_0xdac6('0x24')]=function(_0x22f6c6){try{if(!_['isNil'](channels[_0x22f6c6[_0xdac6('0x6')]])){utils[_0xdac6('0x10')](util[_0xdac6('0x4')]('[%s][calls][hangup]',_0x22f6c6[_0xdac6('0x6')]),_0x22f6c6);if(_[_0xdac6('0x1e')](channels[_0x22f6c6['uniqueid']][_0xdac6('0x25')])){channels[_0x22f6c6['uniqueid']][_0xdac6('0x25')]=_0x22f6c6[_0xdac6('0x26')]+'\x20<'+_0x22f6c6['calleridnum']+'>';}utils[_0xdac6('0x3')](util[_0xdac6('0x4')](_0xdac6('0x27'),_0x22f6c6[_0xdac6('0x6')],channels[_0x22f6c6[_0xdac6('0x6')]]['callerid'],_0x22f6c6[_0xdac6('0x28')]));channels[_0x22f6c6[_0xdac6('0x6')]][_0xdac6('0x29')]=utils['now']();channels[_0x22f6c6['uniqueid']][_0xdac6('0x2a')]=utils[_0xdac6('0x2b')](channels[_0x22f6c6[_0xdac6('0x6')]][_0xdac6('0x29')],channels[_0x22f6c6[_0xdac6('0x6')]][_0xdac6('0x2c')]);channels[_0x22f6c6[_0xdac6('0x6')]]['billableseconds']=channels[_0x22f6c6['uniqueid']]['answertime']?utils[_0xdac6('0x2b')](channels[_0x22f6c6[_0xdac6('0x6')]]['endtime'],channels[_0x22f6c6[_0xdac6('0x6')]][_0xdac6('0x22')]):0x0;writeDB(channels[_0x22f6c6['uniqueid']]);}}catch(_0x10e659){utils[_0xdac6('0x19')](util[_0xdac6('0x4')]('[%s][calls][hangup]',_0x22f6c6[_0xdac6('0x6')]),_0x10e659);}};exports['attendedtransfer']=function(_0x456b0b){try{if(!_[_0xdac6('0x1e')](channels[_0x456b0b[_0xdac6('0x2d')]])){utils[_0xdac6('0x10')](util[_0xdac6('0x4')](_0xdac6('0x2e'),_0x456b0b[_0xdac6('0x2f')]),_0x456b0b);if(channels[_0x456b0b[_0xdac6('0x2d')]][_0xdac6('0x12')]==_0x456b0b[_0xdac6('0x30')]){utils[_0xdac6('0x3')](util[_0xdac6('0x4')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x456b0b['origtransfereruniqueid'],_0x456b0b[_0xdac6('0x2d')],_0x456b0b[_0xdac6('0x31')]));channels[_0x456b0b['localtwolinkedid']][_0xdac6('0x21')]=_0x456b0b['secondtransfererchannel'];channels[_0x456b0b[_0xdac6('0x2d')]][_0xdac6('0x32')]=_0xdac6('0x33');}else if(channels[_0x456b0b[_0xdac6('0x2d')]][_0xdac6('0x12')]=_0x456b0b['transfertargetchannel']){utils['info'](util[_0xdac6('0x4')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x456b0b[_0xdac6('0x2f')],_0x456b0b[_0xdac6('0x2d')],_0x456b0b[_0xdac6('0x34')]));channels[_0x456b0b['localtwolinkedid']]['destinationchannel']=_0x456b0b[_0xdac6('0x34')];channels[_0x456b0b[_0xdac6('0x2d')]][_0xdac6('0x32')]=_0xdac6('0x33');}}}catch(_0x53c6b1){utils[_0xdac6('0x19')](util[_0xdac6('0x4')](_0xdac6('0x2e'),_0x456b0b['origtransfereruniqueid']),_0x53c6b1);}};exports['musiconholdstart']=function(_0x590361){try{if(!_[_0xdac6('0x1e')](channels[_0x590361['uniqueid']])){utils[_0xdac6('0x10')](util[_0xdac6('0x4')](_0xdac6('0x35'),_0x590361[_0xdac6('0x6')]),_0x590361);channels[_0x590361[_0xdac6('0x6')]][_0xdac6('0x36')]=utils['now']();utils[_0xdac6('0x3')](util['format'](_0xdac6('0x37'),_0x590361[_0xdac6('0x6')],channels[_0x590361[_0xdac6('0x6')]][_0xdac6('0x36')]));}}catch(_0x1abbca){utils['error'](util[_0xdac6('0x4')](_0xdac6('0x35'),_0x590361[_0xdac6('0x6')]),_0x1abbca);}};exports[_0xdac6('0x38')]=function(_0x4cf471){try{if(!_[_0xdac6('0x1e')](channels[_0x4cf471['uniqueid']])){utils[_0xdac6('0x10')](util['format'](_0xdac6('0x39'),_0x4cf471[_0xdac6('0x6')]),_0x4cf471);if(!_[_0xdac6('0x1e')](channels[_0x4cf471[_0xdac6('0x6')]][_0xdac6('0x36')])){channels[_0x4cf471[_0xdac6('0x6')]]['mohtime']+=utils['diffTime'](utils[_0xdac6('0x17')](),channels[_0x4cf471[_0xdac6('0x6')]]['musiconholdstartAt']);utils[_0xdac6('0x3')](util[_0xdac6('0x4')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x4cf471[_0xdac6('0x6')],channels[_0x4cf471['uniqueid']]['mohtime']));delete channels[_0x4cf471['uniqueid']]['musiconholdstartAt'];}}}catch(_0x10e197){utils[_0xdac6('0x19')](util[_0xdac6('0x4')](_0xdac6('0x39'),_0x4cf471[_0xdac6('0x6')]),_0x10e197);}};exports[_0xdac6('0x3a')]=function(_0x4ca5fa){try{if(!_[_0xdac6('0x1e')](channels[_0x4ca5fa[_0xdac6('0x6')]])){utils['debug'](util[_0xdac6('0x4')](_0xdac6('0x3b'),_0x4ca5fa[_0xdac6('0x6')]),_0x4ca5fa);if(!_[_0xdac6('0x1e')](_0x4ca5fa[_0xdac6('0x3c')][_0xdac6('0x3d')])){utils['info'](util[_0xdac6('0x4')](_0xdac6('0x3e'),_0x4ca5fa[_0xdac6('0x6')],_0x4ca5fa[_0xdac6('0x3f')]));channels[_0x4ca5fa[_0xdac6('0x6')]][_0xdac6('0x40')]=_0x4ca5fa[_0xdac6('0x3f')];}if(!_[_0xdac6('0x1e')](_0x4ca5fa[_0xdac6('0x3c')]['xmd-phone'])){utils[_0xdac6('0x3')](util['format'](_0xdac6('0x41'),_0x4ca5fa['uniqueid'],_0x4ca5fa['value']));channels[_0x4ca5fa['uniqueid']]['destination']=_0x4ca5fa[_0xdac6('0x3f')];channels[_0x4ca5fa['uniqueid']][_0xdac6('0x25')]='\x22'+_0x4ca5fa[_0xdac6('0x3f')]+_0xdac6('0x42')+_0x4ca5fa['value']+'>';}if(!_['isNil'](_0x4ca5fa[_0xdac6('0x3c')][_0xdac6('0x43')])||!_['isNil'](_0x4ca5fa[_0xdac6('0x3c')][_0xdac6('0x44')])){utils[_0xdac6('0x3')](util['format'](_0xdac6('0x45'),_0x4ca5fa[_0xdac6('0x6')],!_[_0xdac6('0x1e')](_0x4ca5fa['variable'][_0xdac6('0x43')])?_0xdac6('0x43'):'xmd-callerid',_0x4ca5fa[_0xdac6('0x3f')]));channels[_0x4ca5fa[_0xdac6('0x6')]][_0xdac6('0x25')]=_0x4ca5fa[_0xdac6('0x3f')];}if(!_[_0xdac6('0x1e')](_0x4ca5fa[_0xdac6('0x3c')][_0xdac6('0x46')])||!_[_0xdac6('0x1e')](_0x4ca5fa[_0xdac6('0x3c')][_0xdac6('0x47')])){utils[_0xdac6('0x3')](util[_0xdac6('0x4')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x4ca5fa[_0xdac6('0x6')],!_[_0xdac6('0x1e')](_0x4ca5fa[_0xdac6('0x3c')][_0xdac6('0x46')])?_0xdac6('0x46'):'xmcs-queue',_0x4ca5fa['value']));channels[_0x4ca5fa[_0xdac6('0x6')]][_0xdac6('0x48')]=_0xdac6('0x49');channels[_0x4ca5fa[_0xdac6('0x6')]][_0xdac6('0x4a')]=_0x4ca5fa['value'];channels[_0x4ca5fa[_0xdac6('0x6')]][_0xdac6('0x7')]=!![];}if(!_[_0xdac6('0x1e')](_0x4ca5fa[_0xdac6('0x3c')]['xmd-contactid'])){utils['info'](util[_0xdac6('0x4')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x4ca5fa[_0xdac6('0x6')],_0x4ca5fa['value']));channels[_0x4ca5fa[_0xdac6('0x6')]][_0xdac6('0x4b')]=_0x4ca5fa['value'];}if(!_[_0xdac6('0x1e')](_0x4ca5fa[_0xdac6('0x3c')]['xmd-cdrtype'])){utils['info'](util[_0xdac6('0x4')](_0xdac6('0x4c'),_0x4ca5fa[_0xdac6('0x6')],_0x4ca5fa[_0xdac6('0x3f')]));channels[_0x4ca5fa[_0xdac6('0x6')]]['type']=_0x4ca5fa[_0xdac6('0x3f')];}if(!_[_0xdac6('0x1e')](_0x4ca5fa[_0xdac6('0x3c')]['outboundrouteid'])){utils['info'](util['format']('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x4ca5fa[_0xdac6('0x6')],_0x4ca5fa['value']));channels[_0x4ca5fa[_0xdac6('0x6')]][_0xdac6('0x4d')]=_0x4ca5fa[_0xdac6('0x3f')];}if(!_[_0xdac6('0x1e')](_0x4ca5fa[_0xdac6('0x3c')][_0xdac6('0x4e')])){utils[_0xdac6('0x3')](util['format'](_0xdac6('0x4f'),_0x4ca5fa[_0xdac6('0x6')],_0x4ca5fa[_0xdac6('0x3f')]));channels[_0x4ca5fa['uniqueid']]['sipcallid']=_0x4ca5fa[_0xdac6('0x3f')];}}}catch(_0x4d5cb4){utils[_0xdac6('0x19')](util[_0xdac6('0x4')]('[%s][calls][varset]',_0x4ca5fa[_0xdac6('0x6')]),_0x4d5cb4);}};exports[_0xdac6('0x50')]=function(_0xb7142){try{if(!_['isNil'](channels[_0xb7142[_0xdac6('0x6')]])){utils[_0xdac6('0x10')](util['format'](_0xdac6('0x51'),_0xb7142['uniqueid']),_0xb7142);utils[_0xdac6('0x3')](util[_0xdac6('0x4')](_0xdac6('0x52'),_0xb7142[_0xdac6('0x6')],_0xb7142[_0xdac6('0x53')],_0xb7142[_0xdac6('0x54')]));if(_0xb7142[_0xdac6('0x53')][_0xdac6('0x55')]()==_0xdac6('0x56')&&_[_0xdac6('0x57')](_0xb7142[_0xdac6('0x54')]['toLowerCase'](),_0xdac6('0x58'))){var _0x4ba2ef=_0xb7142[_0xdac6('0x54')]['split']('=');var _0x40b184=_0x4ba2ef[0x0]['substring'](_0x4ba2ef[0x0]['lastIndexOf']('(')+0x1,_0x4ba2ef[0x0][_0xdac6('0x59')](')'));var _0x6fac4a=_0x4ba2ef[0x1];channels[_0xb7142[_0xdac6('0x6')]][_0x40b184]=_0x6fac4a;}if(!_['includes']([_0xdac6('0x24'),_0xdac6('0x5a'),_0xdac6('0x5b'),'set','gotoif'],_0xb7142[_0xdac6('0x53')][_0xdac6('0x55')]())){channels[_0xb7142[_0xdac6('0x6')]]['lastapplication']=_0xb7142[_0xdac6('0x53')];channels[_0xb7142['uniqueid']][_0xdac6('0x4a')]=_0xb7142[_0xdac6('0x54')];}}}catch(_0x594f56){utils[_0xdac6('0x19')](util[_0xdac6('0x4')](_0xdac6('0x51'),_0xb7142[_0xdac6('0x6')]),_0x594f56);}}; \ No newline at end of file +var _0x41eb=['[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','error','newstate','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','isNil','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','userfield','origtransfererchannel','_attended','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','includes','execif','gotoif','lastapplication','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','CreateVoiceCallReport','newchannel','debug','format'];(function(_0x22ab10,_0x51d092){var _0x46f164=function(_0x44ae63){while(--_0x44ae63){_0x22ab10['push'](_0x22ab10['shift']());}};_0x46f164(++_0x51d092);}(_0x41eb,0xc1));var _0xb41e=function(_0x4bd67a,_0x4f9725){_0x4bd67a=_0x4bd67a-0x0;var _0x2be5fb=_0x41eb[_0x4bd67a];return _0x2be5fb;};'use strict';var _=require(_0xb41e('0x0'));var util=require(_0xb41e('0x1'));var utils=require(_0xb41e('0x2'));var dispositions=[_0xb41e('0x3'),_0xb41e('0x4'),_0xb41e('0x4'),_0xb41e('0x3'),'NO\x20ANSWER',_0xb41e('0x3'),_0xb41e('0x5'),_0xb41e('0x6'),_0xb41e('0x4'),_0xb41e('0x4'),'FAILED'];var channels={};function writeDB(_0x14910a){utils[_0xb41e('0x7')](util['format'](_0xb41e('0x8'),_0x14910a[_0xb41e('0x9')],_0x14910a[_0xb41e('0xa')],_0x14910a[_0xb41e('0xb')],_0x14910a[_0xb41e('0xc')],_0x14910a[_0xb41e('0xd')],_0x14910a[_0xb41e('0xe')],_0x14910a[_0xb41e('0xf')],_0x14910a[_0xb41e('0x10')]));if(_0x14910a[_0xb41e('0x11')]){utils[_0xb41e('0x12')](_0x14910a[_0xb41e('0x11')])[_0xb41e('0x13')](function(_0x5bc9c6){if(_0x5bc9c6){_0x14910a[_0xb41e('0x14')]=_0x5bc9c6['id'];}utils['request'](_0xb41e('0x15'),_0x14910a);});}else{utils['request'](_0xb41e('0x15'),_0x14910a);}if(channels[_0x14910a[_0xb41e('0x9')]]){delete channels[_0x14910a[_0xb41e('0x9')]];}}exports[_0xb41e('0x16')]=function(_0x2c1f27){try{utils[_0xb41e('0x17')](util[_0xb41e('0x18')](_0xb41e('0x19'),_0x2c1f27['uniqueid']),_0x2c1f27);if(_0x2c1f27[_0xb41e('0x9')]==_0x2c1f27[_0xb41e('0x1a')]&&_0x2c1f27[_0xb41e('0xa')]!='OutgoingSpoolFailed'){utils[_0xb41e('0x7')](util[_0xb41e('0x18')](_0xb41e('0x1b'),_0x2c1f27[_0xb41e('0x9')],_0x2c1f27[_0xb41e('0x1c')],_0x2c1f27['exten']));channels[_0x2c1f27['uniqueid']]={'uniqueid':_0x2c1f27[_0xb41e('0x9')],'accountcode':_0x2c1f27[_0xb41e('0x11')],'source':_0x2c1f27[_0xb41e('0xe')],'destination':_0x2c1f27[_0xb41e('0x1d')],'destinationcontext':_0x2c1f27['context'],'channel':_0x2c1f27[_0xb41e('0xa')],'starttime':utils[_0xb41e('0x1e')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xb41e('0x3'),'amaflags':'DOCUMENTATION'};}}catch(_0x587f68){utils[_0xb41e('0x1f')](util['format']('[%s][calls][newchannel]',_0x2c1f27[_0xb41e('0x9')]),_0x587f68);}};exports[_0xb41e('0x20')]=function(_0x40ce72){try{utils['debug'](util[_0xb41e('0x18')](_0xb41e('0x21'),_0x40ce72[_0xb41e('0x9')]),_0x40ce72);if(!_['isNil'](channels[_0x40ce72[_0xb41e('0x9')]])&&_0x40ce72[_0xb41e('0x22')]==0x6){utils[_0xb41e('0x7')](util[_0xb41e('0x18')](_0xb41e('0x23'),_0x40ce72[_0xb41e('0x9')],_0x40ce72[_0xb41e('0x1c')],_0x40ce72[_0xb41e('0xa')]));if(_['isNil'](channels[_0x40ce72['uniqueid']][_0xb41e('0x24')])){channels[_0x40ce72['uniqueid']]['systemanswertime']=utils[_0xb41e('0x1e')]();}}else if(!_[_0xb41e('0x25')](channels[_0x40ce72[_0xb41e('0x1a')]])&&_0x40ce72[_0xb41e('0x22')]==0x6&&_0x40ce72['context']!=_0xb41e('0x26')){utils[_0xb41e('0x7')](util[_0xb41e('0x18')](_0xb41e('0x27'),_0x40ce72[_0xb41e('0x9')],_0x40ce72[_0xb41e('0x1a')],_0x40ce72[_0xb41e('0x1c')],_0x40ce72['channel']));channels[_0x40ce72[_0xb41e('0x1a')]][_0xb41e('0x11')]=_0x40ce72[_0xb41e('0x11')];channels[_0x40ce72[_0xb41e('0x1a')]][_0xb41e('0x28')]=_0x40ce72[_0xb41e('0xa')];if(_[_0xb41e('0x25')](channels[_0x40ce72[_0xb41e('0x1a')]][_0xb41e('0x29')])){channels[_0x40ce72[_0xb41e('0x1a')]][_0xb41e('0x29')]=utils[_0xb41e('0x1e')]();}channels[_0x40ce72['linkedid']]['disposition']=dispositions[_[_0xb41e('0x2a')](_0x40ce72['channelstate'])]||'ANSWERED';}}catch(_0x4901fc){utils['error'](util[_0xb41e('0x18')](_0xb41e('0x21'),_0x40ce72['uniqueid']),_0x4901fc);}};exports[_0xb41e('0x2b')]=function(_0x3d2028){try{if(!_['isNil'](channels[_0x3d2028[_0xb41e('0x9')]])){utils[_0xb41e('0x17')](util[_0xb41e('0x18')](_0xb41e('0x2c'),_0x3d2028[_0xb41e('0x9')]),_0x3d2028);if(_[_0xb41e('0x25')](channels[_0x3d2028[_0xb41e('0x9')]][_0xb41e('0x2d')])){channels[_0x3d2028[_0xb41e('0x9')]]['callerid']=_0x3d2028[_0xb41e('0x2e')]+'\x20<'+_0x3d2028['calleridnum']+'>';}utils[_0xb41e('0x7')](util[_0xb41e('0x18')](_0xb41e('0x2f'),_0x3d2028[_0xb41e('0x9')],channels[_0x3d2028['uniqueid']][_0xb41e('0x2d')],_0x3d2028[_0xb41e('0x30')]));channels[_0x3d2028[_0xb41e('0x9')]][_0xb41e('0x31')]=utils['now']();channels[_0x3d2028[_0xb41e('0x9')]][_0xb41e('0x32')]=utils[_0xb41e('0x33')](channels[_0x3d2028['uniqueid']][_0xb41e('0x31')],channels[_0x3d2028[_0xb41e('0x9')]][_0xb41e('0x34')]);channels[_0x3d2028[_0xb41e('0x9')]][_0xb41e('0x35')]=channels[_0x3d2028[_0xb41e('0x9')]][_0xb41e('0x29')]?utils[_0xb41e('0x33')](channels[_0x3d2028[_0xb41e('0x9')]][_0xb41e('0x31')],channels[_0x3d2028[_0xb41e('0x9')]][_0xb41e('0x29')]):0x0;writeDB(channels[_0x3d2028[_0xb41e('0x9')]]);}}catch(_0x21a46f){utils[_0xb41e('0x1f')](util[_0xb41e('0x18')](_0xb41e('0x2c'),_0x3d2028[_0xb41e('0x9')]),_0x21a46f);}};exports[_0xb41e('0x36')]=function(_0x1bed28){try{if(!_[_0xb41e('0x25')](channels[_0x1bed28[_0xb41e('0x37')]])){utils[_0xb41e('0x17')](util[_0xb41e('0x18')](_0xb41e('0x38'),_0x1bed28[_0xb41e('0x39')]),_0x1bed28);if(channels[_0x1bed28[_0xb41e('0x37')]][_0xb41e('0xa')]==_0x1bed28['transfereechannel']){utils[_0xb41e('0x7')](util[_0xb41e('0x18')](_0xb41e('0x3a'),_0x1bed28[_0xb41e('0x39')],_0x1bed28[_0xb41e('0x37')],_0x1bed28['secondtransfererchannel']));channels[_0x1bed28[_0xb41e('0x37')]][_0xb41e('0x28')]=_0x1bed28['secondtransfererchannel'];channels[_0x1bed28['localtwolinkedid']][_0xb41e('0x3b')]='_attended';}else if(channels[_0x1bed28[_0xb41e('0x37')]][_0xb41e('0xa')]=_0x1bed28['transfertargetchannel']){utils[_0xb41e('0x7')](util[_0xb41e('0x18')](_0xb41e('0x3a'),_0x1bed28[_0xb41e('0x39')],_0x1bed28['localtwolinkedid'],_0x1bed28[_0xb41e('0x3c')]));channels[_0x1bed28[_0xb41e('0x37')]]['destinationchannel']=_0x1bed28[_0xb41e('0x3c')];channels[_0x1bed28[_0xb41e('0x37')]][_0xb41e('0x3b')]=_0xb41e('0x3d');}}}catch(_0x3dd746){utils[_0xb41e('0x1f')](util[_0xb41e('0x18')]('[%s][calls][attendedtransfer]',_0x1bed28[_0xb41e('0x39')]),_0x3dd746);}};exports['musiconholdstart']=function(_0x163bd8){try{if(!_['isNil'](channels[_0x163bd8[_0xb41e('0x9')]])){utils[_0xb41e('0x17')](util[_0xb41e('0x18')](_0xb41e('0x3e'),_0x163bd8[_0xb41e('0x9')]),_0x163bd8);channels[_0x163bd8[_0xb41e('0x9')]][_0xb41e('0x3f')]=utils['now']();utils[_0xb41e('0x7')](util[_0xb41e('0x18')](_0xb41e('0x40'),_0x163bd8[_0xb41e('0x9')],channels[_0x163bd8[_0xb41e('0x9')]][_0xb41e('0x3f')]));}}catch(_0x41b933){utils[_0xb41e('0x1f')](util['format'](_0xb41e('0x3e'),_0x163bd8[_0xb41e('0x9')]),_0x41b933);}};exports[_0xb41e('0x41')]=function(_0x931e69){try{if(!_[_0xb41e('0x25')](channels[_0x931e69[_0xb41e('0x9')]])){utils[_0xb41e('0x17')](util[_0xb41e('0x18')]('[%s][calls][musiconholdstop]',_0x931e69[_0xb41e('0x9')]),_0x931e69);if(!_[_0xb41e('0x25')](channels[_0x931e69[_0xb41e('0x9')]][_0xb41e('0x3f')])){channels[_0x931e69[_0xb41e('0x9')]][_0xb41e('0x42')]+=utils[_0xb41e('0x33')](utils[_0xb41e('0x1e')](),channels[_0x931e69['uniqueid']][_0xb41e('0x3f')]);utils[_0xb41e('0x7')](util[_0xb41e('0x18')](_0xb41e('0x43'),_0x931e69['uniqueid'],channels[_0x931e69['uniqueid']][_0xb41e('0x42')]));delete channels[_0x931e69['uniqueid']]['musiconholdstartAt'];}}}catch(_0xb1f996){utils[_0xb41e('0x1f')](util['format']('[%s][calls][musiconholdstop]',_0x931e69[_0xb41e('0x9')]),_0xb1f996);}};exports[_0xb41e('0x44')]=function(_0x1da7e7){try{if(!_[_0xb41e('0x25')](channels[_0x1da7e7[_0xb41e('0x9')]])){utils['debug'](util['format'](_0xb41e('0x45'),_0x1da7e7[_0xb41e('0x9')]),_0x1da7e7);if(!_[_0xb41e('0x25')](_0x1da7e7[_0xb41e('0x46')][_0xb41e('0x47')])){utils[_0xb41e('0x7')](util['format'](_0xb41e('0x48'),_0x1da7e7[_0xb41e('0x9')],_0x1da7e7[_0xb41e('0x49')]));channels[_0x1da7e7['uniqueid']][_0xb41e('0x4a')]=_0x1da7e7[_0xb41e('0x49')];}if(!_['isNil'](_0x1da7e7['variable'][_0xb41e('0x4b')])){utils[_0xb41e('0x7')](util[_0xb41e('0x18')](_0xb41e('0x4c'),_0x1da7e7[_0xb41e('0x9')],_0x1da7e7[_0xb41e('0x49')]));channels[_0x1da7e7[_0xb41e('0x9')]][_0xb41e('0x4d')]=_0x1da7e7[_0xb41e('0x49')];channels[_0x1da7e7['uniqueid']]['callerid']='\x22'+_0x1da7e7['value']+_0xb41e('0x4e')+_0x1da7e7['value']+'>';}if(!_['isNil'](_0x1da7e7[_0xb41e('0x46')][_0xb41e('0x4f')])||!_['isNil'](_0x1da7e7[_0xb41e('0x46')][_0xb41e('0x50')])){utils[_0xb41e('0x7')](util[_0xb41e('0x18')](_0xb41e('0x51'),_0x1da7e7[_0xb41e('0x9')],!_[_0xb41e('0x25')](_0x1da7e7['variable'][_0xb41e('0x4f')])?_0xb41e('0x4f'):_0xb41e('0x50'),_0x1da7e7[_0xb41e('0x49')]));channels[_0x1da7e7[_0xb41e('0x9')]][_0xb41e('0x2d')]=_0x1da7e7[_0xb41e('0x49')];}if(!_[_0xb41e('0x25')](_0x1da7e7[_0xb41e('0x46')][_0xb41e('0x52')])||!_[_0xb41e('0x25')](_0x1da7e7[_0xb41e('0x46')]['xmcs-queue'])){utils[_0xb41e('0x7')](util[_0xb41e('0x18')](_0xb41e('0x51'),_0x1da7e7[_0xb41e('0x9')],!_[_0xb41e('0x25')](_0x1da7e7[_0xb41e('0x46')][_0xb41e('0x52')])?'xmd-queue':'xmcs-queue',_0x1da7e7[_0xb41e('0x49')]));channels[_0x1da7e7[_0xb41e('0x9')]]['lastapplication']=_0xb41e('0x53');channels[_0x1da7e7['uniqueid']][_0xb41e('0x54')]=_0x1da7e7[_0xb41e('0x49')];channels[_0x1da7e7[_0xb41e('0x9')]][_0xb41e('0xb')]=!![];}if(!_[_0xb41e('0x25')](_0x1da7e7[_0xb41e('0x46')][_0xb41e('0x55')])){utils[_0xb41e('0x7')](util[_0xb41e('0x18')](_0xb41e('0x56'),_0x1da7e7['uniqueid'],_0x1da7e7[_0xb41e('0x49')]));channels[_0x1da7e7[_0xb41e('0x9')]][_0xb41e('0x57')]=_0x1da7e7[_0xb41e('0x49')];}if(!_[_0xb41e('0x25')](_0x1da7e7[_0xb41e('0x46')][_0xb41e('0x58')])){utils[_0xb41e('0x7')](util[_0xb41e('0x18')](_0xb41e('0x59'),_0x1da7e7[_0xb41e('0x9')],_0x1da7e7[_0xb41e('0x49')]));channels[_0x1da7e7[_0xb41e('0x9')]][_0xb41e('0x5a')]=_0x1da7e7['value'];}if(!_[_0xb41e('0x25')](_0x1da7e7['variable'][_0xb41e('0x5b')])){utils[_0xb41e('0x7')](util[_0xb41e('0x18')](_0xb41e('0x5c'),_0x1da7e7[_0xb41e('0x9')],_0x1da7e7[_0xb41e('0x49')]));channels[_0x1da7e7[_0xb41e('0x9')]]['routeid']=_0x1da7e7['value'];}if(!_['isNil'](_0x1da7e7['variable'][_0xb41e('0x5d')])){utils['info'](util[_0xb41e('0x18')](_0xb41e('0x5e'),_0x1da7e7[_0xb41e('0x9')],_0x1da7e7[_0xb41e('0x49')]));channels[_0x1da7e7['uniqueid']]['sipcallid']=_0x1da7e7['value'];}}}catch(_0x482bc4){utils[_0xb41e('0x1f')](util[_0xb41e('0x18')](_0xb41e('0x45'),_0x1da7e7[_0xb41e('0x9')]),_0x482bc4);}};exports['newexten']=function(_0x4d7b91){try{if(!_[_0xb41e('0x25')](channels[_0x4d7b91['uniqueid']])){utils[_0xb41e('0x17')](util['format'](_0xb41e('0x5f'),_0x4d7b91[_0xb41e('0x9')]),_0x4d7b91);utils['info'](util['format'](_0xb41e('0x60'),_0x4d7b91[_0xb41e('0x9')],_0x4d7b91[_0xb41e('0x61')],_0x4d7b91[_0xb41e('0x62')]));if(_0x4d7b91['application'][_0xb41e('0x63')]()==_0xb41e('0x64')&&_[_0xb41e('0x65')](_0x4d7b91[_0xb41e('0x62')][_0xb41e('0x63')](),'cdr')){var _0x9d7348=_0x4d7b91[_0xb41e('0x62')][_0xb41e('0x66')]('=');var _0x40e69f=_0x9d7348[0x0][_0xb41e('0x67')](_0x9d7348[0x0][_0xb41e('0x68')]('(')+0x1,_0x9d7348[0x0][_0xb41e('0x68')](')'));var _0x44f79d=_0x9d7348[0x1];channels[_0x4d7b91[_0xb41e('0x9')]][_0x40e69f]=_0x44f79d;}if(!_[_0xb41e('0x69')](['hangup','noop',_0xb41e('0x6a'),_0xb41e('0x64'),_0xb41e('0x6b')],_0x4d7b91[_0xb41e('0x61')][_0xb41e('0x63')]())){channels[_0x4d7b91[_0xb41e('0x9')]][_0xb41e('0x6c')]=_0x4d7b91['application'];channels[_0x4d7b91['uniqueid']][_0xb41e('0x54')]=_0x4d7b91[_0xb41e('0x62')];}}}catch(_0x4c844b){utils['error'](util['format'](_0xb41e('0x5f'),_0x4d7b91[_0xb41e('0x9')]),_0x4c844b);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 28037f9..6281b06 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 _0x72a4=['close','[core]\x20close','managerevent','connect','info','[core]\x20connected','[core]\x20shutdown','fullybooted','error'];(function(_0x4cd071,_0x5c95e9){var _0x4a7f7c=function(_0x4a2c71){while(--_0x4a2c71){_0x4cd071['push'](_0x4cd071['shift']());}};_0x4a7f7c(++_0x5c95e9);}(_0x72a4,0x1c5));var _0x472a=function(_0x188926,_0x1b2429){_0x188926=_0x188926-0x0;var _0x17f4bf=_0x72a4[_0x188926];return _0x17f4bf;};'use strict';var utils=require('./utils');exports[_0x472a('0x0')]=function(){utils[_0x472a('0x1')](_0x472a('0x2'));};exports['shutdown']=function(){utils[_0x472a('0x1')](_0x472a('0x3'));};exports[_0x472a('0x4')]=function(){utils[_0x472a('0x1')]('[core]\x20fullybooted');};exports[_0x472a('0x5')]=function(_0x376148){utils[_0x472a('0x5')]('[core]\x20error',_0x376148);};exports[_0x472a('0x6')]=function(){utils[_0x472a('0x1')](_0x472a('0x7'));};exports[_0x472a('0x8')]=function(_0x488788){}; \ No newline at end of file +var _0xf64f=['./utils','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','close','managerevent'];(function(_0x1a7c37,_0xd1f601){var _0x21f9fc=function(_0x55d1f7){while(--_0x55d1f7){_0x1a7c37['push'](_0x1a7c37['shift']());}};_0x21f9fc(++_0xd1f601);}(_0xf64f,0xb4));var _0xff64=function(_0x1b8582,_0xfdb350){_0x1b8582=_0x1b8582-0x0;var _0x189158=_0xf64f[_0x1b8582];return _0x189158;};'use strict';var utils=require(_0xff64('0x0'));exports['connect']=function(){utils[_0xff64('0x1')](_0xff64('0x2'));};exports[_0xff64('0x3')]=function(){utils[_0xff64('0x1')](_0xff64('0x4'));};exports[_0xff64('0x5')]=function(){utils['info'](_0xff64('0x6'));};exports[_0xff64('0x7')]=function(_0x34c3aa){utils[_0xff64('0x7')]('[core]\x20error',_0x34c3aa);};exports[_0xff64('0x8')]=function(){utils[_0xff64('0x1')]('[core]\x20close');};exports[_0xff64('0x9')]=function(_0x5cf224){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index bdf7701..f38161b 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 _0x0021=['variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]','calleridname','cause-txt','duration','diffTime','holdtime','endtime','billableseconds','lodash','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','dialstring','calleridnum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil'];(function(_0x38043a,_0x1728d4){var _0x5ca8ff=function(_0x2c41ee){while(--_0x2c41ee){_0x38043a['push'](_0x38043a['shift']());}};_0x5ca8ff(++_0x1728d4);}(_0x0021,0x7d));var _0x1002=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0x0021[_0x49d41c];return _0xb64c5f;};'use strict';var _=require(_0x1002('0x0'));var util=require('util');var utils=require('./utils');var dials={};function writeDB(_0x1ff873){utils[_0x1002('0x1')](util['format'](_0x1002('0x2'),_0x1ff873['uniqueid'],_0x1ff873['channel'],_0x1ff873[_0x1002('0x3')],_0x1ff873[_0x1002('0x4')],_0x1ff873['connectedlinenum'],_0x1ff873[_0x1002('0x5')]));utils[_0x1002('0x6')](_0x1002('0x7'),_0x1ff873);delete dials[_0x1ff873[_0x1002('0x8')]];}exports[_0x1002('0x9')]=function(_0x12d0f1){try{utils[_0x1002('0xa')](util[_0x1002('0xb')](_0x1002('0xc'),_0x12d0f1[_0x1002('0x8')]),_0x12d0f1);utils['info'](util[_0x1002('0xb')](_0x1002('0xd'),_0x12d0f1[_0x1002('0x8')],_0x12d0f1[_0x1002('0xe')],_0x12d0f1['appdata']));if(_0x12d0f1[_0x1002('0xe')][_0x1002('0xf')]()==_0x1002('0x10')&&_[_0x1002('0x11')](_0x12d0f1[_0x1002('0x12')]['toLowerCase'](),_0x1002('0x13'))){var _0x365b09=_0x12d0f1[_0x1002('0x12')][_0x1002('0x14')]('=');dials[_0x12d0f1[_0x1002('0x8')]]={'routeId':_0x365b09[0x1]};}}catch(_0x3cb41f){utils[_0x1002('0x15')](util[_0x1002('0xb')](_0x1002('0xc'),_0x12d0f1['uniqueid']),_0x3cb41f);}};exports[_0x1002('0x16')]=function(_0x5044d8){try{utils[_0x1002('0xa')](util[_0x1002('0xb')](_0x1002('0x17'),_0x5044d8['uniqueid']),_0x5044d8);if(!_[_0x1002('0x18')](_0x5044d8[_0x1002('0x19')][_0x1002('0x1a')])){utils[_0x1002('0x1')](util[_0x1002('0xb')](_0x1002('0x1b'),_0x5044d8['uniqueid'],_0x5044d8[_0x1002('0x1c')]));dials[_0x5044d8['uniqueid']]={'routeId':_0x5044d8[_0x1002('0x1c')]};}}catch(_0x12852d){utils[_0x1002('0x15')](util[_0x1002('0xb')]('[%s][dials][varset]',_0x5044d8[_0x1002('0x8')]),_0x12852d);}};exports[_0x1002('0x1d')]=function(_0x4c8f85){try{if(!_[_0x1002('0x18')](dials[_0x4c8f85[_0x1002('0x8')]])){utils[_0x1002('0xa')](util[_0x1002('0xb')](_0x1002('0x1e'),_0x4c8f85[_0x1002('0x8')]),_0x4c8f85);dials[_0x4c8f85['uniqueid']]=_[_0x1002('0x1f')](dials[_0x4c8f85[_0x1002('0x8')]],_0x4c8f85);dials[_0x4c8f85[_0x1002('0x8')]][_0x1002('0x20')]=utils[_0x1002('0x21')]();dials[_0x4c8f85[_0x1002('0x8')]][_0x1002('0x22')]=_0x1002('0x23');utils[_0x1002('0x1')](util[_0x1002('0xb')](_0x1002('0x24'),_0x4c8f85[_0x1002('0x8')],dials[_0x4c8f85[_0x1002('0x8')]][_0x1002('0x20')]));}}catch(_0x2d4994){utils[_0x1002('0x15')](util[_0x1002('0xb')](_0x1002('0x1e'),_0x4c8f85[_0x1002('0x8')]),_0x2d4994);}};exports['dialend']=function(_0x300bcc){try{if(!_[_0x1002('0x18')](dials[_0x300bcc[_0x1002('0x8')]])){utils['debug'](util['format']('[%s][dials][dialend]',_0x300bcc['uniqueid']),_0x300bcc);dials[_0x300bcc[_0x1002('0x8')]][_0x1002('0x5')]=_0x300bcc['dialstatus'];if(_0x300bcc[_0x1002('0x5')]=='ANSWER'){dials[_0x300bcc[_0x1002('0x8')]]=_[_0x1002('0x1f')](dials[_0x300bcc['uniqueid']],_0x300bcc);dials[_0x300bcc[_0x1002('0x8')]]['answertime']=utils['now']();dials[_0x300bcc[_0x1002('0x8')]][_0x1002('0x22')]='connect';utils['info'](util['format'](_0x1002('0x25'),_0x300bcc['uniqueid'],_0x300bcc[_0x1002('0x5')],dials[_0x300bcc[_0x1002('0x8')]][_0x1002('0x26')]));}else{utils['info'](util[_0x1002('0xb')](_0x1002('0x27'),_0x300bcc[_0x1002('0x8')],_0x300bcc[_0x1002('0x5')]));}}}catch(_0x32443b){utils[_0x1002('0x15')](util[_0x1002('0xb')](_0x1002('0x28'),_0x300bcc[_0x1002('0x8')]),_0x32443b);}};exports[_0x1002('0x29')]=function(_0x3aa95a){try{if(!_[_0x1002('0x18')](dials[_0x3aa95a[_0x1002('0x8')]])){utils['debug'](util['format'](_0x1002('0x2a'),_0x3aa95a[_0x1002('0x8')]),_0x3aa95a);utils[_0x1002('0x1')](util[_0x1002('0xb')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x3aa95a[_0x1002('0x8')],_0x3aa95a[_0x1002('0x4')],_0x3aa95a[_0x1002('0x2b')],_0x3aa95a[_0x1002('0x2c')]));dials[_0x3aa95a['uniqueid']]=_[_0x1002('0x1f')](dials[_0x3aa95a[_0x1002('0x8')]],{'endtime':utils[_0x1002('0x21')](),'lastevent':'complete'});dials[_0x3aa95a[_0x1002('0x8')]][_0x1002('0x2d')]=utils[_0x1002('0x2e')](dials[_0x3aa95a[_0x1002('0x8')]]['endtime'],dials[_0x3aa95a['uniqueid']]['starttime']);dials[_0x3aa95a[_0x1002('0x8')]][_0x1002('0x2f')]=utils['diffTime'](dials[_0x3aa95a['uniqueid']][_0x1002('0x26')]||dials[_0x3aa95a[_0x1002('0x8')]][_0x1002('0x30')],dials[_0x3aa95a[_0x1002('0x8')]][_0x1002('0x20')]);dials[_0x3aa95a[_0x1002('0x8')]][_0x1002('0x31')]=dials[_0x3aa95a['uniqueid']][_0x1002('0x26')]?utils[_0x1002('0x2e')](dials[_0x3aa95a['uniqueid']][_0x1002('0x30')],dials[_0x3aa95a[_0x1002('0x8')]][_0x1002('0x26')]):0x0;writeDB(dials[_0x3aa95a[_0x1002('0x8')]]);}}catch(_0xa30dde){utils['error'](util['format']('[%s][dials][hangup]',_0x3aa95a[_0x1002('0x8')]),_0xa30dde);}}; \ No newline at end of file +var _0x0d96=['hangup','[%s][dials][hangup]','complete','duration','diffTime','holdtime','endtime','billableseconds','lodash','util','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport','newexten','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','startsWith','appdata','toLowerCase','cdr(routeid)','error','varset','debug','[%s][dials][varset]','isNil','outboundrouteid','info','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s'];(function(_0xc39db9,_0x4a3832){var _0x52d434=function(_0x1f9493){while(--_0x1f9493){_0xc39db9['push'](_0xc39db9['shift']());}};_0x52d434(++_0x4a3832);}(_0x0d96,0x66));var _0x60d9=function(_0x388321,_0xfe6cc8){_0x388321=_0x388321-0x0;var _0x2e25a6=_0x0d96[_0x388321];return _0x2e25a6;};'use strict';var _=require(_0x60d9('0x0'));var util=require(_0x60d9('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x4f5f60){utils['info'](util[_0x60d9('0x2')](_0x60d9('0x3'),_0x4f5f60[_0x60d9('0x4')],_0x4f5f60[_0x60d9('0x5')],_0x4f5f60['dialstring'],_0x4f5f60[_0x60d9('0x6')],_0x4f5f60[_0x60d9('0x7')],_0x4f5f60[_0x60d9('0x8')]));utils['request'](_0x60d9('0x9'),_0x4f5f60);delete dials[_0x4f5f60[_0x60d9('0x4')]];}exports[_0x60d9('0xa')]=function(_0x1fc6af){try{utils['debug'](util[_0x60d9('0x2')](_0x60d9('0xb'),_0x1fc6af[_0x60d9('0x4')]),_0x1fc6af);utils['info'](util['format'](_0x60d9('0xc'),_0x1fc6af[_0x60d9('0x4')],_0x1fc6af[_0x60d9('0xd')],_0x1fc6af['appdata']));if(_0x1fc6af[_0x60d9('0xd')]['toLowerCase']()=='set'&&_[_0x60d9('0xe')](_0x1fc6af[_0x60d9('0xf')][_0x60d9('0x10')](),_0x60d9('0x11'))){var _0x54bc53=_0x1fc6af[_0x60d9('0xf')]['split']('=');dials[_0x1fc6af['uniqueid']]={'routeId':_0x54bc53[0x1]};}}catch(_0x44f00c){utils[_0x60d9('0x12')](util[_0x60d9('0x2')](_0x60d9('0xb'),_0x1fc6af[_0x60d9('0x4')]),_0x44f00c);}};exports[_0x60d9('0x13')]=function(_0x42194f){try{utils[_0x60d9('0x14')](util[_0x60d9('0x2')](_0x60d9('0x15'),_0x42194f[_0x60d9('0x4')]),_0x42194f);if(!_[_0x60d9('0x16')](_0x42194f['variable'][_0x60d9('0x17')])){utils[_0x60d9('0x18')](util[_0x60d9('0x2')](_0x60d9('0x19'),_0x42194f[_0x60d9('0x4')],_0x42194f[_0x60d9('0x1a')]));dials[_0x42194f[_0x60d9('0x4')]]={'routeId':_0x42194f[_0x60d9('0x1a')]};}}catch(_0x1572e1){utils[_0x60d9('0x12')](util[_0x60d9('0x2')](_0x60d9('0x15'),_0x42194f[_0x60d9('0x4')]),_0x1572e1);}};exports['dialbegin']=function(_0x46428a){try{if(!_['isNil'](dials[_0x46428a['uniqueid']])){utils[_0x60d9('0x14')](util[_0x60d9('0x2')](_0x60d9('0x1b'),_0x46428a['uniqueid']),_0x46428a);dials[_0x46428a[_0x60d9('0x4')]]=_[_0x60d9('0x1c')](dials[_0x46428a[_0x60d9('0x4')]],_0x46428a);dials[_0x46428a[_0x60d9('0x4')]][_0x60d9('0x1d')]=utils[_0x60d9('0x1e')]();dials[_0x46428a['uniqueid']][_0x60d9('0x1f')]=_0x60d9('0x20');utils[_0x60d9('0x18')](util[_0x60d9('0x2')](_0x60d9('0x21'),_0x46428a[_0x60d9('0x4')],dials[_0x46428a[_0x60d9('0x4')]]['starttime']));}}catch(_0x20d45f){utils['error'](util[_0x60d9('0x2')](_0x60d9('0x1b'),_0x46428a['uniqueid']),_0x20d45f);}};exports[_0x60d9('0x22')]=function(_0x2b46e7){try{if(!_[_0x60d9('0x16')](dials[_0x2b46e7[_0x60d9('0x4')]])){utils[_0x60d9('0x14')](util[_0x60d9('0x2')](_0x60d9('0x23'),_0x2b46e7[_0x60d9('0x4')]),_0x2b46e7);dials[_0x2b46e7[_0x60d9('0x4')]][_0x60d9('0x8')]=_0x2b46e7[_0x60d9('0x8')];if(_0x2b46e7[_0x60d9('0x8')]==_0x60d9('0x24')){dials[_0x2b46e7['uniqueid']]=_[_0x60d9('0x1c')](dials[_0x2b46e7[_0x60d9('0x4')]],_0x2b46e7);dials[_0x2b46e7[_0x60d9('0x4')]][_0x60d9('0x25')]=utils[_0x60d9('0x1e')]();dials[_0x2b46e7[_0x60d9('0x4')]][_0x60d9('0x1f')]='connect';utils[_0x60d9('0x18')](util[_0x60d9('0x2')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x2b46e7[_0x60d9('0x4')],_0x2b46e7[_0x60d9('0x8')],dials[_0x2b46e7[_0x60d9('0x4')]][_0x60d9('0x25')]));}else{utils[_0x60d9('0x18')](util[_0x60d9('0x2')](_0x60d9('0x26'),_0x2b46e7['uniqueid'],_0x2b46e7[_0x60d9('0x8')]));}}}catch(_0x4486ad){utils[_0x60d9('0x12')](util[_0x60d9('0x2')](_0x60d9('0x23'),_0x2b46e7['uniqueid']),_0x4486ad);}};exports[_0x60d9('0x27')]=function(_0x5a63e4){try{if(!_[_0x60d9('0x16')](dials[_0x5a63e4[_0x60d9('0x4')]])){utils[_0x60d9('0x14')](util[_0x60d9('0x2')](_0x60d9('0x28'),_0x5a63e4[_0x60d9('0x4')]),_0x5a63e4);utils[_0x60d9('0x18')](util['format']('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x5a63e4['uniqueid'],_0x5a63e4[_0x60d9('0x6')],_0x5a63e4['calleridname'],_0x5a63e4['cause-txt']));dials[_0x5a63e4[_0x60d9('0x4')]]=_[_0x60d9('0x1c')](dials[_0x5a63e4[_0x60d9('0x4')]],{'endtime':utils[_0x60d9('0x1e')](),'lastevent':_0x60d9('0x29')});dials[_0x5a63e4['uniqueid']][_0x60d9('0x2a')]=utils[_0x60d9('0x2b')](dials[_0x5a63e4[_0x60d9('0x4')]]['endtime'],dials[_0x5a63e4[_0x60d9('0x4')]][_0x60d9('0x1d')]);dials[_0x5a63e4[_0x60d9('0x4')]][_0x60d9('0x2c')]=utils[_0x60d9('0x2b')](dials[_0x5a63e4[_0x60d9('0x4')]][_0x60d9('0x25')]||dials[_0x5a63e4[_0x60d9('0x4')]][_0x60d9('0x2d')],dials[_0x5a63e4[_0x60d9('0x4')]][_0x60d9('0x1d')]);dials[_0x5a63e4['uniqueid']][_0x60d9('0x2e')]=dials[_0x5a63e4[_0x60d9('0x4')]][_0x60d9('0x25')]?utils['diffTime'](dials[_0x5a63e4['uniqueid']][_0x60d9('0x2d')],dials[_0x5a63e4[_0x60d9('0x4')]][_0x60d9('0x25')]):0x0;writeDB(dials[_0x5a63e4['uniqueid']]);}}catch(_0x37ef7d){utils[_0x60d9('0x12')](util[_0x60d9('0x2')]('[%s][dials][hangup]',_0x5a63e4[_0x60d9('0x4')]),_0x37ef7d);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 8d1e20a..f10a727 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 _0x1bd1=['origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','xdr','env','production','asterisk','port','username','password','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','format','[%s][index][devicestatechange]','device','devicestatechange','agentcalled','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]'];(function(_0x5b080b,_0xe34631){var _0x3d724c=function(_0x3175ac){while(--_0x3175ac){_0x5b080b['push'](_0x5b080b['shift']());}};_0x3d724c(++_0xe34631);}(_0x1bd1,0x123));var _0x11bd=function(_0x46e510,_0x5897ad){_0x46e510=_0x46e510-0x0;var _0x5bf74c=_0x1bd1[_0x46e510];return _0x5bf74c;};var AsteriskManager=require(_0x11bd('0x0'));var config=require(_0x11bd('0x1'));var utils=require(_0x11bd('0x2'));var util=require('util');var isXDREnabled=config[_0x11bd('0x3')]&&config['xdr']['disabled']?!config['xdr']['disabled']:!![];var isProduction=config[_0x11bd('0x4')]===_0x11bd('0x5')||![];var isLocalAsterisk=config[_0x11bd('0x3')]&&config[_0x11bd('0x3')]['local']===!![]||![];var ami=new AsteriskManager(config[_0x11bd('0x6')][_0x11bd('0x7')],config[_0x11bd('0x6')]['ip'],config[_0x11bd('0x6')][_0x11bd('0x8')],config['asterisk'][_0x11bd('0x9')],!![]);ami['keepConnected']();if(!isXDREnabled){utils['info'](_0x11bd('0xa'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x11bd('0xb')](_0x11bd('0xc'));}else{var agents=require(_0x11bd('0xd'));var calls=require(_0x11bd('0xe'));var queues=require(_0x11bd('0xf'));var recordings=require(_0x11bd('0x10'));var members=require(_0x11bd('0x11'));var dials=require('./dials.controller');var transfers=require(_0x11bd('0x12'));var core=require(_0x11bd('0x13'));ami['on'](_0x11bd('0x14'),core[_0x11bd('0x14')]);ami['on'](_0x11bd('0x15'),core[_0x11bd('0x15')]);ami['on'](_0x11bd('0x16'),core['fullybooted']);ami['on']('error',core[_0x11bd('0x17')]);ami['on'](_0x11bd('0x18'),core[_0x11bd('0x18')]);ami['on']('managerevent',core[_0x11bd('0x19')]);ami['on']('devicestatechange',function(_0x59978e){try{utils[_0x11bd('0x1a')](util[_0x11bd('0x1b')](_0x11bd('0x1c'),_0x59978e[_0x11bd('0x1d')]),_0x59978e);members[_0x11bd('0x1e')](_0x59978e);}catch(_0x5d6448){utils[_0x11bd('0x17')](util[_0x11bd('0x1b')](_0x11bd('0x1c'),_0x59978e[_0x11bd('0x1d')]),_0x5d6448);}});ami['on'](_0x11bd('0x1f'),function(_0x3baea6){try{utils[_0x11bd('0x1a')](util[_0x11bd('0x1b')]('[%s][index][agentcalled]',_0x3baea6['uniqueid']),_0x3baea6);agents[_0x11bd('0x1f')](_0x3baea6);}catch(_0x232811){utils[_0x11bd('0x17')](util[_0x11bd('0x1b')]('[%s][index][agentcalled]',_0x3baea6[_0x11bd('0x20')]),_0x232811);}});ami['on']('agentringnoanswer',function(_0x232f11){try{utils[_0x11bd('0x1a')](util[_0x11bd('0x1b')]('[%s][index][agentringnoanswer]',_0x232f11[_0x11bd('0x20')]),_0x232f11);agents[_0x11bd('0x21')](_0x232f11);}catch(_0x1c0522){utils[_0x11bd('0x17')](util[_0x11bd('0x1b')](_0x11bd('0x22'),_0x232f11[_0x11bd('0x20')]),_0x1c0522);}});ami['on'](_0x11bd('0x23'),function(_0x2c5785){try{utils[_0x11bd('0x1a')](util[_0x11bd('0x1b')](_0x11bd('0x24'),_0x2c5785['uniqueid']),_0x2c5785);agents[_0x11bd('0x23')](_0x2c5785);queues[_0x11bd('0x23')](_0x2c5785);}catch(_0xa08420){utils['error'](util['format']('[%s][index][agentconnect]',_0x2c5785[_0x11bd('0x20')]),_0xa08420);}});ami['on'](_0x11bd('0x25'),function(_0x181fdc){try{utils[_0x11bd('0x1a')](util[_0x11bd('0x1b')](_0x11bd('0x26'),_0x181fdc[_0x11bd('0x20')]),_0x181fdc);agents['agentcomplete'](_0x181fdc);queues[_0x11bd('0x25')](_0x181fdc);members['agentcomplete'](_0x181fdc);}catch(_0x161cb1){utils[_0x11bd('0x17')](util['format'](_0x11bd('0x26'),_0x181fdc[_0x11bd('0x20')]),_0x161cb1);}});ami['on'](_0x11bd('0x27'),function(_0x2cd9c4){try{utils[_0x11bd('0x1a')](util[_0x11bd('0x1b')](_0x11bd('0x28'),_0x2cd9c4[_0x11bd('0x20')]),_0x2cd9c4);agents['queuecallerabandon'](_0x2cd9c4);queues[_0x11bd('0x27')](_0x2cd9c4);}catch(_0x410f2a){utils[_0x11bd('0x17')](util[_0x11bd('0x1b')](_0x11bd('0x28'),_0x2cd9c4[_0x11bd('0x20')]),_0x410f2a);}});ami['on'](_0x11bd('0x29'),function(_0x1098f1){try{utils[_0x11bd('0x1a')](util[_0x11bd('0x1b')]('[%s][index][queuecallerjoin]',_0x1098f1[_0x11bd('0x20')]),_0x1098f1);queues[_0x11bd('0x29')](_0x1098f1);recordings['queuecallerjoin'](_0x1098f1);}catch(_0x2fbe36){utils[_0x11bd('0x17')](util[_0x11bd('0x1b')](_0x11bd('0x2a'),_0x1098f1['uniqueid']),_0x2fbe36);}});ami['on'](_0x11bd('0x2b'),function(_0x485915){try{utils[_0x11bd('0x1a')](util[_0x11bd('0x1b')](_0x11bd('0x2c'),_0x485915[_0x11bd('0x20')]),_0x485915);queues[_0x11bd('0x2b')](_0x485915);}catch(_0x3cb2ab){utils[_0x11bd('0x17')](util[_0x11bd('0x1b')](_0x11bd('0x2c'),_0x485915[_0x11bd('0x20')]),_0x3cb2ab);}});ami['on'](_0x11bd('0x2d'),function(_0x1c4b40){try{utils[_0x11bd('0x1a')](util[_0x11bd('0x1b')]('[%s][index][musiconholdstart]',_0x1c4b40['uniqueid']),_0x1c4b40);queues['musiconholdstart'](_0x1c4b40);calls[_0x11bd('0x2d')](_0x1c4b40);}catch(_0xad0a08){utils['error'](util[_0x11bd('0x1b')](_0x11bd('0x2e'),_0x1c4b40[_0x11bd('0x20')]),_0xad0a08);}});ami['on']('musiconholdstop',function(_0x2b25a3){try{utils[_0x11bd('0x1a')](util[_0x11bd('0x1b')](_0x11bd('0x2f'),_0x2b25a3[_0x11bd('0x20')]),_0x2b25a3);queues[_0x11bd('0x30')](_0x2b25a3);calls['musiconholdstop'](_0x2b25a3);}catch(_0xc6b819){utils['error'](util[_0x11bd('0x1b')]('[%s][index][musiconholdstop]',_0x2b25a3[_0x11bd('0x20')]),_0xc6b819);}});ami['on'](_0x11bd('0x31'),function(_0x5049d4){try{utils[_0x11bd('0x1a')](util[_0x11bd('0x1b')](_0x11bd('0x32'),_0x5049d4[_0x11bd('0x20')]),_0x5049d4);calls['newstate'](_0x5049d4);recordings['newstate'](_0x5049d4);}catch(_0x46dded){utils[_0x11bd('0x17')](util['format'](_0x11bd('0x32'),_0x5049d4['uniqueid']),_0x46dded);}});ami['on'](_0x11bd('0x33'),function(_0x11e2f4){try{utils[_0x11bd('0x1a')](util[_0x11bd('0x1b')](_0x11bd('0x34'),_0x11e2f4[_0x11bd('0x20')]),_0x11e2f4);calls['hangup'](_0x11e2f4);recordings[_0x11bd('0x33')](_0x11e2f4);dials[_0x11bd('0x33')](_0x11e2f4);agents[_0x11bd('0x33')](_0x11e2f4);queues[_0x11bd('0x33')](_0x11e2f4);}catch(_0x38f07e){utils['error'](util[_0x11bd('0x1b')]('[%s][index][hangup]',_0x11e2f4[_0x11bd('0x20')]),_0x38f07e);}});ami['on'](_0x11bd('0x35'),function(_0x32d52d){try{utils['debug'](util[_0x11bd('0x1b')](_0x11bd('0x36'),_0x32d52d[_0x11bd('0x20')]),_0x32d52d);members[_0x11bd('0x35')](_0x32d52d);}catch(_0x4dd9de){utils[_0x11bd('0x17')](util[_0x11bd('0x1b')](_0x11bd('0x36'),_0x32d52d[_0x11bd('0x20')]),_0x4dd9de);}});ami['on'](_0x11bd('0x37'),function(_0x3ad982){try{utils[_0x11bd('0x1a')](util[_0x11bd('0x1b')](_0x11bd('0x38'),_0x3ad982['uniqueid']),_0x3ad982);queues[_0x11bd('0x37')](_0x3ad982);agents[_0x11bd('0x37')](_0x3ad982);transfers['blindtransfer'](_0x3ad982);}catch(_0x16a3f9){utils['error'](util['format']('[%s][index][blindtransfer]',_0x3ad982[_0x11bd('0x20')]),_0x16a3f9);}});ami['on'](_0x11bd('0x39'),function(_0xf1a37){try{utils[_0x11bd('0x1a')](util[_0x11bd('0x1b')](_0x11bd('0x3a'),_0xf1a37[_0x11bd('0x3b')]),_0xf1a37);queues[_0x11bd('0x39')](_0xf1a37);transfers['attendedtransfer'](_0xf1a37);agents['attendedtransfer'](_0xf1a37);calls[_0x11bd('0x39')](_0xf1a37);}catch(_0x300cab){utils[_0x11bd('0x17')](util[_0x11bd('0x1b')](_0x11bd('0x3a'),_0xf1a37[_0x11bd('0x3b')]),_0x300cab);}});ami['on']('varset',function(_0x31099c){try{utils[_0x11bd('0x1a')](util[_0x11bd('0x1b')]('[%s][index][varset]',_0x31099c[_0x11bd('0x20')]),_0x31099c);queues[_0x11bd('0x3c')](_0x31099c);recordings[_0x11bd('0x3c')](_0x31099c);calls[_0x11bd('0x3c')](_0x31099c);dials[_0x11bd('0x3c')](_0x31099c);}catch(_0x4769bc){utils[_0x11bd('0x17')](util[_0x11bd('0x1b')](_0x11bd('0x3d'),_0x31099c[_0x11bd('0x20')]),_0x4769bc);}});ami['on'](_0x11bd('0x3e'),function(_0x2aff64){try{utils[_0x11bd('0x1a')](util['format'](_0x11bd('0x3f'),_0x2aff64[_0x11bd('0x20')]),_0x2aff64);calls[_0x11bd('0x3e')](_0x2aff64);recordings['newexten'](_0x2aff64);dials[_0x11bd('0x3e')](_0x2aff64);}catch(_0x168e3f){utils[_0x11bd('0x17')](util['format'](_0x11bd('0x3f'),_0x2aff64[_0x11bd('0x20')]),_0x168e3f);}});ami['on'](_0x11bd('0x40'),function(_0x52e636){try{utils[_0x11bd('0x1a')](util[_0x11bd('0x1b')](_0x11bd('0x41'),_0x52e636[_0x11bd('0x20')]),_0x52e636);calls[_0x11bd('0x40')](_0x52e636);recordings[_0x11bd('0x40')](_0x52e636);}catch(_0x394b6d){utils['error'](util[_0x11bd('0x1b')](_0x11bd('0x41'),_0x52e636[_0x11bd('0x20')]),_0x394b6d);}});ami['on'](_0x11bd('0x42'),function(_0x525cae){try{utils['debug'](util[_0x11bd('0x1b')](_0x11bd('0x43'),_0x525cae[_0x11bd('0x20')]),_0x525cae);dials[_0x11bd('0x42')](_0x525cae);}catch(_0x4a1ab4){utils[_0x11bd('0x17')](util[_0x11bd('0x1b')]('[%s]dialbegin',_0x525cae[_0x11bd('0x20')]),_0x4a1ab4);}});ami['on'](_0x11bd('0x44'),function(_0x41729b){try{utils[_0x11bd('0x1a')](util[_0x11bd('0x1b')]('[%s][index][dialend]',_0x41729b[_0x11bd('0x20')]),_0x41729b);dials[_0x11bd('0x44')](_0x41729b);}catch(_0x2ad38b){utils[_0x11bd('0x17')](util[_0x11bd('0x1b')](_0x11bd('0x45'),_0x41729b[_0x11bd('0x20')]),_0x2ad38b);}});} \ No newline at end of file +var _0x5e43=['[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','xdr','disabled','production','local','asterisk','port','username','password','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./queues.controller','./members.controller','./dials.controller','./core.controller','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','[%s][index][musiconholdstart]','musiconholdstart','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer'];(function(_0x58394a,_0x17838d){var _0x4b14d5=function(_0x5ba44a){while(--_0x5ba44a){_0x58394a['push'](_0x58394a['shift']());}};_0x4b14d5(++_0x17838d);}(_0x5e43,0x1f2));var _0x35e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e43[_0x3dd15e];return _0x231fd0;};var AsteriskManager=require(_0x35e4('0x0'));var config=require(_0x35e4('0x1'));var utils=require(_0x35e4('0x2'));var util=require('util');var isXDREnabled=config[_0x35e4('0x3')]&&config[_0x35e4('0x3')][_0x35e4('0x4')]?!config[_0x35e4('0x3')][_0x35e4('0x4')]:!![];var isProduction=config['env']===_0x35e4('0x5')||![];var isLocalAsterisk=config[_0x35e4('0x3')]&&config[_0x35e4('0x3')][_0x35e4('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0x35e4('0x7')][_0x35e4('0x8')],config[_0x35e4('0x7')]['ip'],config[_0x35e4('0x7')][_0x35e4('0x9')],config[_0x35e4('0x7')][_0x35e4('0xa')],!![]);ami[_0x35e4('0xb')]();if(!isXDREnabled){utils['info']('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x35e4('0xc')](_0x35e4('0xd'));}else{var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require(_0x35e4('0xe'));var recordings=require('./recordings.controller');var members=require(_0x35e4('0xf'));var dials=require(_0x35e4('0x10'));var transfers=require('./transfers.controller');var core=require(_0x35e4('0x11'));ami['on']('connect',core['connect']);ami['on'](_0x35e4('0x12'),core['shutdown']);ami['on'](_0x35e4('0x13'),core[_0x35e4('0x13')]);ami['on'](_0x35e4('0x14'),core[_0x35e4('0x14')]);ami['on'](_0x35e4('0x15'),core[_0x35e4('0x15')]);ami['on'](_0x35e4('0x16'),core[_0x35e4('0x16')]);ami['on'](_0x35e4('0x17'),function(_0x2d33e5){try{utils[_0x35e4('0x18')](util[_0x35e4('0x19')](_0x35e4('0x1a'),_0x2d33e5[_0x35e4('0x1b')]),_0x2d33e5);members[_0x35e4('0x17')](_0x2d33e5);}catch(_0x33b650){utils[_0x35e4('0x14')](util[_0x35e4('0x19')]('[%s][index][devicestatechange]',_0x2d33e5[_0x35e4('0x1b')]),_0x33b650);}});ami['on'](_0x35e4('0x1c'),function(_0x369c1d){try{utils[_0x35e4('0x18')](util[_0x35e4('0x19')](_0x35e4('0x1d'),_0x369c1d[_0x35e4('0x1e')]),_0x369c1d);agents[_0x35e4('0x1c')](_0x369c1d);}catch(_0x45c8d7){utils['error'](util[_0x35e4('0x19')](_0x35e4('0x1d'),_0x369c1d['uniqueid']),_0x45c8d7);}});ami['on'](_0x35e4('0x1f'),function(_0x1fd990){try{utils[_0x35e4('0x18')](util[_0x35e4('0x19')](_0x35e4('0x20'),_0x1fd990[_0x35e4('0x1e')]),_0x1fd990);agents[_0x35e4('0x1f')](_0x1fd990);}catch(_0x3c60b0){utils['error'](util[_0x35e4('0x19')](_0x35e4('0x20'),_0x1fd990[_0x35e4('0x1e')]),_0x3c60b0);}});ami['on'](_0x35e4('0x21'),function(_0x8c1d41){try{utils[_0x35e4('0x18')](util['format'](_0x35e4('0x22'),_0x8c1d41[_0x35e4('0x1e')]),_0x8c1d41);agents[_0x35e4('0x21')](_0x8c1d41);queues['agentconnect'](_0x8c1d41);}catch(_0x58d37e){utils[_0x35e4('0x14')](util[_0x35e4('0x19')](_0x35e4('0x22'),_0x8c1d41['uniqueid']),_0x58d37e);}});ami['on'](_0x35e4('0x23'),function(_0x4ff584){try{utils[_0x35e4('0x18')](util[_0x35e4('0x19')](_0x35e4('0x24'),_0x4ff584['uniqueid']),_0x4ff584);agents[_0x35e4('0x23')](_0x4ff584);queues['agentcomplete'](_0x4ff584);members['agentcomplete'](_0x4ff584);}catch(_0x32bd1c){utils[_0x35e4('0x14')](util['format']('[%s][index][agentcomplete]',_0x4ff584[_0x35e4('0x1e')]),_0x32bd1c);}});ami['on']('queuecallerabandon',function(_0x2fe2d7){try{utils[_0x35e4('0x18')](util[_0x35e4('0x19')]('[%s][index][queuecallerabandon]',_0x2fe2d7['uniqueid']),_0x2fe2d7);agents[_0x35e4('0x25')](_0x2fe2d7);queues[_0x35e4('0x25')](_0x2fe2d7);}catch(_0x52c2bf){utils[_0x35e4('0x14')](util[_0x35e4('0x19')](_0x35e4('0x26'),_0x2fe2d7[_0x35e4('0x1e')]),_0x52c2bf);}});ami['on'](_0x35e4('0x27'),function(_0x27f5ac){try{utils[_0x35e4('0x18')](util[_0x35e4('0x19')](_0x35e4('0x28'),_0x27f5ac['uniqueid']),_0x27f5ac);queues[_0x35e4('0x27')](_0x27f5ac);recordings[_0x35e4('0x27')](_0x27f5ac);}catch(_0x143f5e){utils['error'](util[_0x35e4('0x19')](_0x35e4('0x28'),_0x27f5ac[_0x35e4('0x1e')]),_0x143f5e);}});ami['on']('queuecallerleave',function(_0x3a567f){try{utils[_0x35e4('0x18')](util[_0x35e4('0x19')](_0x35e4('0x29'),_0x3a567f[_0x35e4('0x1e')]),_0x3a567f);queues[_0x35e4('0x2a')](_0x3a567f);}catch(_0x1a3823){utils['error'](util['format'](_0x35e4('0x29'),_0x3a567f[_0x35e4('0x1e')]),_0x1a3823);}});ami['on']('musiconholdstart',function(_0x170ca9){try{utils[_0x35e4('0x18')](util[_0x35e4('0x19')](_0x35e4('0x2b'),_0x170ca9[_0x35e4('0x1e')]),_0x170ca9);queues[_0x35e4('0x2c')](_0x170ca9);calls[_0x35e4('0x2c')](_0x170ca9);}catch(_0x7dbde5){utils['error'](util[_0x35e4('0x19')](_0x35e4('0x2b'),_0x170ca9[_0x35e4('0x1e')]),_0x7dbde5);}});ami['on']('musiconholdstop',function(_0x4cf33f){try{utils[_0x35e4('0x18')](util['format'](_0x35e4('0x2d'),_0x4cf33f[_0x35e4('0x1e')]),_0x4cf33f);queues['musiconholdstop'](_0x4cf33f);calls[_0x35e4('0x2e')](_0x4cf33f);}catch(_0x4e0f80){utils[_0x35e4('0x14')](util['format'](_0x35e4('0x2d'),_0x4cf33f['uniqueid']),_0x4e0f80);}});ami['on'](_0x35e4('0x2f'),function(_0x1c9594){try{utils[_0x35e4('0x18')](util['format'](_0x35e4('0x30'),_0x1c9594[_0x35e4('0x1e')]),_0x1c9594);calls[_0x35e4('0x2f')](_0x1c9594);recordings[_0x35e4('0x2f')](_0x1c9594);}catch(_0x353c27){utils[_0x35e4('0x14')](util[_0x35e4('0x19')]('[%s][index][newstate]',_0x1c9594[_0x35e4('0x1e')]),_0x353c27);}});ami['on'](_0x35e4('0x31'),function(_0x45fad8){try{utils['debug'](util[_0x35e4('0x19')](_0x35e4('0x32'),_0x45fad8[_0x35e4('0x1e')]),_0x45fad8);calls[_0x35e4('0x31')](_0x45fad8);recordings['hangup'](_0x45fad8);dials[_0x35e4('0x31')](_0x45fad8);agents[_0x35e4('0x31')](_0x45fad8);queues[_0x35e4('0x31')](_0x45fad8);}catch(_0xb5c73e){utils[_0x35e4('0x14')](util[_0x35e4('0x19')](_0x35e4('0x32'),_0x45fad8[_0x35e4('0x1e')]),_0xb5c73e);}});ami['on'](_0x35e4('0x33'),function(_0x42ed87){try{utils[_0x35e4('0x18')](util['format'](_0x35e4('0x34'),_0x42ed87[_0x35e4('0x1e')]),_0x42ed87);members['cdr'](_0x42ed87);}catch(_0x4f9b03){utils['error'](util[_0x35e4('0x19')]('[%s][index][cdr]',_0x42ed87[_0x35e4('0x1e')]),_0x4f9b03);}});ami['on'](_0x35e4('0x35'),function(_0x177a31){try{utils[_0x35e4('0x18')](util['format']('[%s][index][blindtransfer]',_0x177a31['uniqueid']),_0x177a31);queues[_0x35e4('0x35')](_0x177a31);agents['blindtransfer'](_0x177a31);transfers[_0x35e4('0x35')](_0x177a31);}catch(_0x58c6ff){utils[_0x35e4('0x14')](util['format'](_0x35e4('0x36'),_0x177a31['uniqueid']),_0x58c6ff);}});ami['on'](_0x35e4('0x37'),function(_0x529202){try{utils[_0x35e4('0x18')](util[_0x35e4('0x19')](_0x35e4('0x38'),_0x529202['origtransfereruniqueid']),_0x529202);queues[_0x35e4('0x37')](_0x529202);transfers[_0x35e4('0x37')](_0x529202);agents[_0x35e4('0x37')](_0x529202);calls[_0x35e4('0x37')](_0x529202);}catch(_0x1d2a51){utils[_0x35e4('0x14')](util['format'](_0x35e4('0x38'),_0x529202[_0x35e4('0x39')]),_0x1d2a51);}});ami['on'](_0x35e4('0x3a'),function(_0x19aa7c){try{utils['debug'](util[_0x35e4('0x19')](_0x35e4('0x3b'),_0x19aa7c[_0x35e4('0x1e')]),_0x19aa7c);queues[_0x35e4('0x3a')](_0x19aa7c);recordings['varset'](_0x19aa7c);calls[_0x35e4('0x3a')](_0x19aa7c);dials['varset'](_0x19aa7c);}catch(_0x417776){utils['error'](util['format'](_0x35e4('0x3b'),_0x19aa7c[_0x35e4('0x1e')]),_0x417776);}});ami['on'](_0x35e4('0x3c'),function(_0x2c8da1){try{utils['debug'](util[_0x35e4('0x19')](_0x35e4('0x3d'),_0x2c8da1['uniqueid']),_0x2c8da1);calls[_0x35e4('0x3c')](_0x2c8da1);recordings[_0x35e4('0x3c')](_0x2c8da1);dials[_0x35e4('0x3c')](_0x2c8da1);}catch(_0x40cea3){utils['error'](util['format'](_0x35e4('0x3d'),_0x2c8da1[_0x35e4('0x1e')]),_0x40cea3);}});ami['on'](_0x35e4('0x3e'),function(_0x3e39b7){try{utils[_0x35e4('0x18')](util[_0x35e4('0x19')](_0x35e4('0x3f'),_0x3e39b7[_0x35e4('0x1e')]),_0x3e39b7);calls[_0x35e4('0x3e')](_0x3e39b7);recordings[_0x35e4('0x3e')](_0x3e39b7);}catch(_0x5d8ed6){utils[_0x35e4('0x14')](util[_0x35e4('0x19')](_0x35e4('0x3f'),_0x3e39b7[_0x35e4('0x1e')]),_0x5d8ed6);}});ami['on'](_0x35e4('0x40'),function(_0x24a2e1){try{utils['debug'](util[_0x35e4('0x19')](_0x35e4('0x41'),_0x24a2e1[_0x35e4('0x1e')]),_0x24a2e1);dials['dialbegin'](_0x24a2e1);}catch(_0x292901){utils['error'](util['format'](_0x35e4('0x42'),_0x24a2e1[_0x35e4('0x1e')]),_0x292901);}});ami['on'](_0x35e4('0x43'),function(_0x3c1b14){try{utils[_0x35e4('0x18')](util[_0x35e4('0x19')](_0x35e4('0x44'),_0x3c1b14['uniqueid']),_0x3c1b14);dials[_0x35e4('0x43')](_0x3c1b14);}catch(_0x21365e){utils['error'](util[_0x35e4('0x19')](_0x35e4('0x44'),_0x3c1b14['uniqueid']),_0x21365e);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 98f1bba..7f3c3bb 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 _0x3340=['devicestatechange','debug','[%s][members][devicestatechange]','device','state','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','duration','diffTime','agentcomplete','[%s][members][agentcomplete]','queue','assign','[%s][members][cdr]','data1','data2','source','data3','exitAt','destinationchannel','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','type','getUserByInterface','then','membername','name','internal','getUserByName','split','request','catch','error','[%s][members][writeDB]','some'];(function(_0x833f29,_0x56ae23){var _0x130367=function(_0x36aa3e){while(--_0x36aa3e){_0x833f29['push'](_0x833f29['shift']());}};_0x130367(++_0x56ae23);}(_0x3340,0x179));var _0x0334=function(_0x2ab935,_0x31f422){_0x2ab935=_0x2ab935-0x0;var _0x1ae2f=_0x3340[_0x2ab935];return _0x1ae2f;};'use strict';var _=require('lodash');var util=require(_0x0334('0x0'));var utils=require(_0x0334('0x1'));var members={};var exclude=[_0x0334('0x2'),_0x0334('0x3')];function writeDB(_0x8e9f3d){utils[_0x0334('0x4')](util[_0x0334('0x5')](_0x0334('0x6'),_0x8e9f3d[_0x0334('0x7')],_0x8e9f3d[_0x0334('0x8')],_0x8e9f3d[_0x0334('0x9')],_0x8e9f3d['data2'],_0x8e9f3d['membername'],_0x8e9f3d[_0x0334('0xa')]));if(_0x8e9f3d[_0x0334('0x8')]){utils[_0x0334('0xb')](_0x8e9f3d['interface'])[_0x0334('0xc')](function(_0x584ee2){if(_0x584ee2){_0x8e9f3d[_0x0334('0xd')]=_0x584ee2[_0x0334('0xe')];_0x8e9f3d[_0x0334('0xf')]=_0x584ee2[_0x0334('0xf')];utils['request']('CreateMemberReport',_0x8e9f3d);}else{utils[_0x0334('0x10')](_0x8e9f3d[_0x0334('0x8')][_0x0334('0x11')]('/')[0x1])['then'](function(_0x276639){if(_0x276639){_0x8e9f3d[_0x0334('0xd')]=_0x276639[_0x0334('0xe')];_0x8e9f3d[_0x0334('0xf')]=_0x276639['internal'];utils[_0x0334('0x12')]('CreateMemberReport',_0x8e9f3d);}});}})[_0x0334('0x13')](function(_0x4f7f16){utils[_0x0334('0x14')](util[_0x0334('0x5')](_0x0334('0x15'),_0x8e9f3d[_0x0334('0x7')]),_0x4f7f16);});}delete members[_0x8e9f3d[_0x0334('0x8')]];}function startsWith(_0x3003bf,_0x84230c){return _[_0x0334('0x16')](_0x3003bf,function(_0x756286){return _['startsWith'](_0x84230c,_0x756286);});}exports[_0x0334('0x17')]=function(_0x4bf73c){try{utils[_0x0334('0x18')](util[_0x0334('0x5')](_0x0334('0x19'),members[_0x4bf73c['device']]?members[_0x4bf73c[_0x0334('0x1a')]]['uniqueid']:_0x4bf73c[_0x0334('0x1a')]),_0x4bf73c);utils[_0x0334('0x4')](util[_0x0334('0x5')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x4bf73c[_0x0334('0x1a')]]?members[_0x4bf73c[_0x0334('0x1a')]][_0x0334('0x7')]:_0x4bf73c[_0x0334('0x1a')],_0x4bf73c[_0x0334('0x1b')],_0x4bf73c[_0x0334('0x1a')]));switch(_0x4bf73c['state']){case'INUSE':case _0x0334('0x1c'):if(!startsWith(exclude,_0x4bf73c[_0x0334('0x1a')])){members[_0x4bf73c['device']]={'channel':_0x0334('0x1d'),'interface':_0x4bf73c[_0x0334('0x1a')],'type':_0x0334('0x1e'),'enterAt':utils[_0x0334('0x1f')](),'role':_0x0334('0x20')};}break;case _0x0334('0x21'):if(!_[_0x0334('0x22')](members[_0x4bf73c[_0x0334('0x1a')]])){members[_0x4bf73c['device']]['exitAt']=utils[_0x0334('0x1f')]();members[_0x4bf73c[_0x0334('0x1a')]][_0x0334('0x23')]=utils[_0x0334('0x24')](members[_0x4bf73c[_0x0334('0x1a')]]['exitAt'],members[_0x4bf73c[_0x0334('0x1a')]]['enterAt']);if(members[_0x4bf73c[_0x0334('0x1a')]][_0x0334('0x7')]){writeDB(members[_0x4bf73c[_0x0334('0x1a')]]);}}break;default:break;}}catch(_0x6fe169){utils[_0x0334('0x14')](util['format'](_0x0334('0x19'),members[_0x4bf73c[_0x0334('0x1a')]]?members[_0x4bf73c[_0x0334('0x1a')]][_0x0334('0x7')]:_0x4bf73c[_0x0334('0x1a')]),_0x6fe169);}};exports[_0x0334('0x25')]=function(_0xc6e239){try{if(!_[_0x0334('0x22')](members[_0xc6e239[_0x0334('0x8')]])){utils[_0x0334('0x18')](util[_0x0334('0x5')](_0x0334('0x26'),_0xc6e239[_0x0334('0x7')]),_0xc6e239);utils[_0x0334('0x4')](util[_0x0334('0x5')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0xc6e239[_0x0334('0x7')],_0xc6e239[_0x0334('0x8')],_0xc6e239[_0x0334('0x27')]));members[_0xc6e239[_0x0334('0x8')]]=_[_0x0334('0x28')](members[_0xc6e239[_0x0334('0x8')]],{'data4':_0xc6e239[_0x0334('0x27')],'uniqueid':_0xc6e239[_0x0334('0x7')]});}}catch(_0x453b38){utils[_0x0334('0x14')](util[_0x0334('0x5')]('[%s][members][agentcomplete]',_0xc6e239[_0x0334('0x7')]),_0x453b38);}};exports['cdr']=function(_0x3d867d){try{utils[_0x0334('0x18')](util['format'](_0x0334('0x29'),_0x3d867d[_0x0334('0x7')]),_0x3d867d);if(_0x3d867d[_0x0334('0x9')]){var _0x294d62=_0x3d867d['channel'][_0x0334('0x11')]('-')[0x0];if(!_['isNil'](members[_0x294d62])){members[_0x294d62]=_['assign'](members[_0x294d62],{'data1':members[_0x294d62][_0x0334('0x2a')]||_0x3d867d['type'],'data2':members[_0x294d62][_0x0334('0x2b')]||_0x3d867d[_0x0334('0x2c')],'data3':members[_0x294d62][_0x0334('0x2d')]||_0x3d867d['destination'],'uniqueid':members[_0x294d62][_0x0334('0x7')]||_0x3d867d[_0x0334('0x7')]});utils[_0x0334('0x4')](util[_0x0334('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x3d867d['uniqueid'],members[_0x294d62][_0x0334('0x2a')],members[_0x294d62][_0x0334('0x2b')],members[_0x294d62]['data3']));if(members[_0x294d62][_0x0334('0x2e')]){writeDB(members[_0x294d62]);}}}if(_0x3d867d['destinationchannel']){var _0x12cdd2=_0x3d867d[_0x0334('0x2f')]['split']('-')[0x0];if(!_[_0x0334('0x22')](members[_0x12cdd2])){members[_0x12cdd2]=_[_0x0334('0x28')](members[_0x12cdd2],{'data1':members[_0x12cdd2]['data1']||_0x3d867d[_0x0334('0xa')],'data2':members[_0x12cdd2][_0x0334('0x2b')]||_0x3d867d['source'],'data3':members[_0x12cdd2]['data3']||_0x3d867d[_0x0334('0x30')],'uniqueid':members[_0x12cdd2][_0x0334('0x7')]||_0x3d867d[_0x0334('0x7')]});utils[_0x0334('0x4')](util[_0x0334('0x5')](_0x0334('0x31'),_0x3d867d[_0x0334('0x7')],members[_0x12cdd2][_0x0334('0x2a')],members[_0x12cdd2]['data2'],members[_0x12cdd2][_0x0334('0x2d')]));if(members[_0x12cdd2]['exitAt']){writeDB(members[_0x12cdd2]);}}}}catch(_0x1cf65d){utils[_0x0334('0x14')](util['format'](_0x0334('0x29'),_0x3d867d[_0x0334('0x7')]),_0x1cf65d);}}; \ No newline at end of file +var _0x6c74=['[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data1','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','source','util','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','then','name','internal','getUserByName','split','request','CreateMemberReport','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device'];(function(_0x53d934,_0x346ce2){var _0x190dfc=function(_0x397328){while(--_0x397328){_0x53d934['push'](_0x53d934['shift']());}};_0x190dfc(++_0x346ce2);}(_0x6c74,0xb4));var _0x46c7=function(_0x23b267,_0x42b06a){_0x23b267=_0x23b267-0x0;var _0x49fe96=_0x6c74[_0x23b267];return _0x49fe96;};'use strict';var _=require('lodash');var util=require(_0x46c7('0x0'));var utils=require('./utils');var members={};var exclude=[_0x46c7('0x1'),_0x46c7('0x2')];function writeDB(_0x349386){utils[_0x46c7('0x3')](util[_0x46c7('0x4')](_0x46c7('0x5'),_0x349386[_0x46c7('0x6')],_0x349386[_0x46c7('0x7')],_0x349386[_0x46c7('0x8')],_0x349386[_0x46c7('0x9')],_0x349386[_0x46c7('0xa')],_0x349386[_0x46c7('0xb')]));if(_0x349386[_0x46c7('0x7')]){utils['getUserByInterface'](_0x349386[_0x46c7('0x7')])[_0x46c7('0xc')](function(_0x4f2883){if(_0x4f2883){_0x349386[_0x46c7('0xa')]=_0x4f2883[_0x46c7('0xd')];_0x349386[_0x46c7('0xe')]=_0x4f2883[_0x46c7('0xe')];utils['request']('CreateMemberReport',_0x349386);}else{utils[_0x46c7('0xf')](_0x349386['interface'][_0x46c7('0x10')]('/')[0x1])[_0x46c7('0xc')](function(_0x38ef16){if(_0x38ef16){_0x349386[_0x46c7('0xa')]=_0x38ef16[_0x46c7('0xd')];_0x349386[_0x46c7('0xe')]=_0x38ef16['internal'];utils[_0x46c7('0x11')](_0x46c7('0x12'),_0x349386);}});}})[_0x46c7('0x13')](function(_0x382eb4){utils[_0x46c7('0x14')](util[_0x46c7('0x4')](_0x46c7('0x15'),_0x349386[_0x46c7('0x6')]),_0x382eb4);});}delete members[_0x349386[_0x46c7('0x7')]];}function startsWith(_0x30d869,_0xf6d609){return _[_0x46c7('0x16')](_0x30d869,function(_0x3c7197){return _[_0x46c7('0x17')](_0xf6d609,_0x3c7197);});}exports[_0x46c7('0x18')]=function(_0x57c0d5){try{utils[_0x46c7('0x19')](util[_0x46c7('0x4')](_0x46c7('0x1a'),members[_0x57c0d5[_0x46c7('0x1b')]]?members[_0x57c0d5[_0x46c7('0x1b')]]['uniqueid']:_0x57c0d5[_0x46c7('0x1b')]),_0x57c0d5);utils['info'](util['format'](_0x46c7('0x1c'),members[_0x57c0d5[_0x46c7('0x1b')]]?members[_0x57c0d5[_0x46c7('0x1b')]][_0x46c7('0x6')]:_0x57c0d5[_0x46c7('0x1b')],_0x57c0d5[_0x46c7('0x1d')],_0x57c0d5[_0x46c7('0x1b')]));switch(_0x57c0d5['state']){case _0x46c7('0x1e'):case _0x46c7('0x1f'):if(!startsWith(exclude,_0x57c0d5[_0x46c7('0x1b')])){members[_0x57c0d5['device']]={'channel':_0x46c7('0x20'),'interface':_0x57c0d5[_0x46c7('0x1b')],'type':_0x46c7('0x21'),'enterAt':utils[_0x46c7('0x22')](),'role':_0x46c7('0x23')};}break;case _0x46c7('0x24'):if(!_[_0x46c7('0x25')](members[_0x57c0d5[_0x46c7('0x1b')]])){members[_0x57c0d5[_0x46c7('0x1b')]][_0x46c7('0x26')]=utils[_0x46c7('0x22')]();members[_0x57c0d5[_0x46c7('0x1b')]][_0x46c7('0x27')]=utils['diffTime'](members[_0x57c0d5[_0x46c7('0x1b')]]['exitAt'],members[_0x57c0d5[_0x46c7('0x1b')]]['enterAt']);if(members[_0x57c0d5[_0x46c7('0x1b')]][_0x46c7('0x6')]){writeDB(members[_0x57c0d5[_0x46c7('0x1b')]]);}}break;default:break;}}catch(_0x5e2a41){utils[_0x46c7('0x14')](util[_0x46c7('0x4')]('[%s][members][devicestatechange]',members[_0x57c0d5[_0x46c7('0x1b')]]?members[_0x57c0d5[_0x46c7('0x1b')]][_0x46c7('0x6')]:_0x57c0d5['device']),_0x5e2a41);}};exports['agentcomplete']=function(_0xb7b883){try{if(!_[_0x46c7('0x25')](members[_0xb7b883['interface']])){utils[_0x46c7('0x19')](util[_0x46c7('0x4')](_0x46c7('0x28'),_0xb7b883['uniqueid']),_0xb7b883);utils[_0x46c7('0x3')](util[_0x46c7('0x4')](_0x46c7('0x29'),_0xb7b883['uniqueid'],_0xb7b883[_0x46c7('0x7')],_0xb7b883[_0x46c7('0x2a')]));members[_0xb7b883[_0x46c7('0x7')]]=_[_0x46c7('0x2b')](members[_0xb7b883[_0x46c7('0x7')]],{'data4':_0xb7b883[_0x46c7('0x2a')],'uniqueid':_0xb7b883[_0x46c7('0x6')]});}}catch(_0x24a65){utils[_0x46c7('0x14')](util['format'](_0x46c7('0x28'),_0xb7b883[_0x46c7('0x6')]),_0x24a65);}};exports[_0x46c7('0x2c')]=function(_0x3dbf19){try{utils[_0x46c7('0x19')](util['format'](_0x46c7('0x2d'),_0x3dbf19['uniqueid']),_0x3dbf19);if(_0x3dbf19[_0x46c7('0x8')]){var _0x2e43f1=_0x3dbf19['channel'][_0x46c7('0x10')]('-')[0x0];if(!_[_0x46c7('0x25')](members[_0x2e43f1])){members[_0x2e43f1]=_[_0x46c7('0x2b')](members[_0x2e43f1],{'data1':members[_0x2e43f1][_0x46c7('0x2e')]||_0x3dbf19['type'],'data2':members[_0x2e43f1][_0x46c7('0x9')]||_0x3dbf19['source'],'data3':members[_0x2e43f1][_0x46c7('0x2f')]||_0x3dbf19[_0x46c7('0x30')],'uniqueid':members[_0x2e43f1][_0x46c7('0x6')]||_0x3dbf19[_0x46c7('0x6')]});utils['info'](util[_0x46c7('0x4')](_0x46c7('0x31'),_0x3dbf19[_0x46c7('0x6')],members[_0x2e43f1][_0x46c7('0x2e')],members[_0x2e43f1][_0x46c7('0x9')],members[_0x2e43f1][_0x46c7('0x2f')]));if(members[_0x2e43f1][_0x46c7('0x26')]){writeDB(members[_0x2e43f1]);}}}if(_0x3dbf19['destinationchannel']){var _0x267c93=_0x3dbf19[_0x46c7('0x32')][_0x46c7('0x10')]('-')[0x0];if(!_[_0x46c7('0x25')](members[_0x267c93])){members[_0x267c93]=_[_0x46c7('0x2b')](members[_0x267c93],{'data1':members[_0x267c93]['data1']||_0x3dbf19[_0x46c7('0xb')],'data2':members[_0x267c93][_0x46c7('0x9')]||_0x3dbf19[_0x46c7('0x33')],'data3':members[_0x267c93][_0x46c7('0x2f')]||_0x3dbf19[_0x46c7('0x30')],'uniqueid':members[_0x267c93][_0x46c7('0x6')]||_0x3dbf19[_0x46c7('0x6')]});utils[_0x46c7('0x3')](util[_0x46c7('0x4')](_0x46c7('0x31'),_0x3dbf19['uniqueid'],members[_0x267c93][_0x46c7('0x2e')],members[_0x267c93][_0x46c7('0x9')],members[_0x267c93][_0x46c7('0x2f')]));if(members[_0x267c93][_0x46c7('0x26')]){writeDB(members[_0x267c93]);}}}}catch(_0x3aa466){utils['error'](util[_0x46c7('0x4')](_0x46c7('0x2d'),_0x3dbf19['uniqueid']),_0x3aa466);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index f675864..9d270cc 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 _0x4d2c=['reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','transferexten','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','hangup','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][hangup]','varset','[%s][queues][varset]','isNil','variable','queuestatus','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','error','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','holdtime','queuecallerjoinAt','position','count','connectedlinename','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','[%s][queues][agentconnect]','agentcomplete'];(function(_0x258323,_0x483093){var _0x49e0e1=function(_0x4950dd){while(--_0x4950dd){_0x258323['push'](_0x258323['shift']());}};_0x49e0e1(++_0x483093);}(_0x4d2c,0x1ed));var _0xc4d2=function(_0x34cea1,_0x16d860){_0x34cea1=_0x34cea1-0x0;var _0x2d796a=_0x4d2c[_0x34cea1];return _0x2d796a;};'use strict';var _=require(_0xc4d2('0x0'));var util=require(_0xc4d2('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x1d4384){utils[_0xc4d2('0x2')](util[_0xc4d2('0x3')](_0xc4d2('0x4'),_0x1d4384[_0xc4d2('0x5')],_0x1d4384[_0xc4d2('0x6')],_0x1d4384[_0xc4d2('0x7')],_0x1d4384[_0xc4d2('0x8')],_0x1d4384[_0xc4d2('0x9')],_0x1d4384[_0xc4d2('0xa')],_0x1d4384[_0xc4d2('0xb')]));if(_0x1d4384[_0xc4d2('0x7')]){utils[_0xc4d2('0xc')](_0x1d4384[_0xc4d2('0x7')])[_0xc4d2('0xd')](function(_0x370735){if(_0x370735){_0x1d4384['type']=_0x370735['type'];}utils[_0xc4d2('0xe')](_0xc4d2('0xf'),_0x1d4384);});}else{utils[_0xc4d2('0xe')](_0xc4d2('0xf'),_0x1d4384);}if(_0x1d4384[_0xc4d2('0x10')]){delete queues[_0x1d4384['transfereduniqueid']];}else{delete queues[_0x1d4384[_0xc4d2('0x5')]];}}exports[_0xc4d2('0x11')]=function(_0x38026d){try{utils[_0xc4d2('0x12')](util['format'](_0xc4d2('0x13'),_0x38026d[_0xc4d2('0x5')]),_0x38026d);utils[_0xc4d2('0x2')](util[_0xc4d2('0x3')](_0xc4d2('0x14'),_0x38026d[_0xc4d2('0x5')],_0x38026d[_0xc4d2('0x7')],_0x38026d['position']));queues[_0x38026d[_0xc4d2('0x5')]]=_[_0xc4d2('0x15')](_0x38026d,{'originalposition':_0x38026d['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x6e4c9e){utils['error'](util[_0xc4d2('0x3')](_0xc4d2('0x13'),_0x38026d[_0xc4d2('0x5')]),_0x6e4c9e);}};exports[_0xc4d2('0x16')]=function(_0x12825e){try{if(!_['isNil'](queues[_0x12825e[_0xc4d2('0x5')]])){utils[_0xc4d2('0x12')](util['format']('[%s][queues][hangup]',_0x12825e[_0xc4d2('0x5')]),_0x12825e);if(queues[_0x12825e[_0xc4d2('0x5')]][_0xc4d2('0x17')]){if(!queues[_0x12825e['uniqueid']][_0xc4d2('0x18')]&&!queues[_0x12825e['uniqueid']]['queuecallerexit']){queues[_0x12825e[_0xc4d2('0x5')]][_0xc4d2('0x19')]=!![];queues[_0x12825e['uniqueid']][_0xc4d2('0x1a')]=utils[_0xc4d2('0x1b')]();queues[_0x12825e[_0xc4d2('0x5')]][_0xc4d2('0xb')]=_0xc4d2('0x1c');}utils[_0xc4d2('0x2')](util[_0xc4d2('0x3')](_0xc4d2('0x1d'),_0x12825e[_0xc4d2('0x5')],queues[_0x12825e[_0xc4d2('0x5')]][_0xc4d2('0x1e')],queues[_0x12825e[_0xc4d2('0x5')]][_0xc4d2('0xb')]));writeDB(queues[_0x12825e['uniqueid']]);}else if(queues[_0x12825e[_0xc4d2('0x5')]][_0xc4d2('0x10')]){utils[_0xc4d2('0x2')](util[_0xc4d2('0x3')](_0xc4d2('0x1f'),_0x12825e[_0xc4d2('0x5')],queues[_0x12825e[_0xc4d2('0x5')]]['name'],queues[_0x12825e['uniqueid']]['transfereduniqueid']));queues[queues[_0x12825e['uniqueid']][_0xc4d2('0x10')]]=queues[_0x12825e[_0xc4d2('0x5')]];queues[queues[_0x12825e[_0xc4d2('0x5')]][_0xc4d2('0x10')]][_0xc4d2('0x20')]=0x2;delete queues[_0x12825e[_0xc4d2('0x5')]];}}}catch(_0x3c38b7){utils['error'](util[_0xc4d2('0x3')](_0xc4d2('0x21'),_0x12825e[_0xc4d2('0x5')]),_0x3c38b7);}};exports[_0xc4d2('0x22')]=function(_0x191611){try{utils['debug'](util[_0xc4d2('0x3')](_0xc4d2('0x23'),_0x191611[_0xc4d2('0x5')]),_0x191611);if(!_[_0xc4d2('0x24')](_0x191611[_0xc4d2('0x25')][_0xc4d2('0x26')])&&_0x191611['value'][_0xc4d2('0x27')]()!==_0xc4d2('0x28')){if(!_[_0xc4d2('0x24')](queues[_0x191611['uniqueid']])){queues[_0x191611['uniqueid']][_0xc4d2('0x18')]=![];queues[_0x191611[_0xc4d2('0x5')]][_0xc4d2('0x29')]=null;queues[_0x191611[_0xc4d2('0x5')]][_0xc4d2('0x2a')]=!![];queues[_0x191611[_0xc4d2('0x5')]][_0xc4d2('0x2b')]=utils[_0xc4d2('0x1b')]();queues[_0x191611[_0xc4d2('0x5')]]['queuecallerexitreason']=_0x191611[_0xc4d2('0x2c')][_0xc4d2('0x27')]();utils['info'](util[_0xc4d2('0x3')](_0xc4d2('0x2d'),_0x191611[_0xc4d2('0x5')],queues[_0x191611[_0xc4d2('0x5')]][_0xc4d2('0x1e')],_0x191611[_0xc4d2('0x2c')],queues[_0x191611[_0xc4d2('0x5')]][_0xc4d2('0xb')]));writeDB(queues[_0x191611['uniqueid']]);}}else if(!_[_0xc4d2('0x24')](_0x191611[_0xc4d2('0x25')][_0xc4d2('0x2e')])){if(!_[_0xc4d2('0x24')](queues[_0x191611[_0xc4d2('0x5')]])&&!queues[_0x191611[_0xc4d2('0x5')]][_0xc4d2('0x18')]){queues[_0x191611[_0xc4d2('0x5')]][_0xc4d2('0x18')]=![];queues[_0x191611[_0xc4d2('0x5')]][_0xc4d2('0x29')]=null;queues[_0x191611['uniqueid']][_0xc4d2('0x2a')]=!![];queues[_0x191611[_0xc4d2('0x5')]]['queuecallerexitAt']=utils[_0xc4d2('0x1b')]();queues[_0x191611[_0xc4d2('0x5')]][_0xc4d2('0xb')]='EXITWITHKEY';utils['info'](util[_0xc4d2('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x191611[_0xc4d2('0x5')],queues[_0x191611[_0xc4d2('0x5')]][_0xc4d2('0x1e')],_0x191611[_0xc4d2('0x2c')],queues[_0x191611['uniqueid']][_0xc4d2('0xb')]));}}}catch(_0x2a7d37){utils[_0xc4d2('0x2f')](util[_0xc4d2('0x3')](_0xc4d2('0x23'),_0x191611[_0xc4d2('0x5')]),_0x2a7d37);}};exports[_0xc4d2('0x18')]=function(_0x1c1a58){try{if(!_[_0xc4d2('0x24')](queues[_0x1c1a58[_0xc4d2('0x5')]])){utils[_0xc4d2('0x12')](util[_0xc4d2('0x3')]('[%s][queues][queuecallerabandon]',_0x1c1a58[_0xc4d2('0x5')]),_0x1c1a58);queues[_0x1c1a58[_0xc4d2('0x5')]][_0xc4d2('0x2a')]=![];queues[_0x1c1a58[_0xc4d2('0x5')]][_0xc4d2('0x2b')]=null;queues[_0x1c1a58[_0xc4d2('0x5')]][_0xc4d2('0x18')]=!![];queues[_0x1c1a58[_0xc4d2('0x5')]]['queuecallerabandonAt']=utils[_0xc4d2('0x1b')]();queues[_0x1c1a58[_0xc4d2('0x5')]][_0xc4d2('0xb')]=_0xc4d2('0x30');utils[_0xc4d2('0x2')](util[_0xc4d2('0x3')](_0xc4d2('0x31'),_0x1c1a58['uniqueid'],queues[_0x1c1a58['uniqueid']][_0xc4d2('0x1e')],queues[_0x1c1a58[_0xc4d2('0x5')]][_0xc4d2('0xb')]));}}catch(_0x3b8471){utils[_0xc4d2('0x2f')](util[_0xc4d2('0x3')](_0xc4d2('0x32'),_0x1c1a58['uniqueid']),_0x3b8471);}};exports[_0xc4d2('0x33')]=function(_0x5cb7f3){try{if(!_[_0xc4d2('0x24')](queues[_0x5cb7f3['uniqueid']])){utils[_0xc4d2('0x12')](util['format']('[%s][queues][queuecallerleave]',_0x5cb7f3[_0xc4d2('0x5')]),_0x5cb7f3);utils[_0xc4d2('0x2')](util['format'](_0xc4d2('0x34'),_0x5cb7f3[_0xc4d2('0x5')],queues[_0x5cb7f3[_0xc4d2('0x5')]][_0xc4d2('0x1e')],_0x5cb7f3[_0xc4d2('0x35')],_0x5cb7f3['connectedlinename']));queues[_0x5cb7f3[_0xc4d2('0x5')]][_0xc4d2('0x33')]=!![];queues[_0x5cb7f3[_0xc4d2('0x5')]][_0xc4d2('0x17')]=utils[_0xc4d2('0x1b')]();queues[_0x5cb7f3[_0xc4d2('0x5')]][_0xc4d2('0x36')]=utils['diffTime'](queues[_0x5cb7f3[_0xc4d2('0x5')]][_0xc4d2('0x17')],queues[_0x5cb7f3[_0xc4d2('0x5')]][_0xc4d2('0x37')]);queues[_0x5cb7f3[_0xc4d2('0x5')]][_0xc4d2('0x38')]=_0x5cb7f3[_0xc4d2('0x38')];queues[_0x5cb7f3[_0xc4d2('0x5')]][_0xc4d2('0x39')]=_0x5cb7f3['count'];queues[_0x5cb7f3[_0xc4d2('0x5')]][_0xc4d2('0x35')]=_0x5cb7f3[_0xc4d2('0x35')];queues[_0x5cb7f3[_0xc4d2('0x5')]][_0xc4d2('0x3a')]=_0x5cb7f3[_0xc4d2('0x3a')];}}catch(_0xf2c79c){utils['error'](util[_0xc4d2('0x3')](_0xc4d2('0x3b'),_0x5cb7f3['uniqueid']),_0xf2c79c);}};exports[_0xc4d2('0x3c')]=function(_0x4289d3){try{if(!_[_0xc4d2('0x24')](queues[_0x4289d3['uniqueid']])){utils[_0xc4d2('0x12')](util[_0xc4d2('0x3')]('[%s][queues][agentconnect]',_0x4289d3[_0xc4d2('0x5')]),_0x4289d3);utils[_0xc4d2('0x2')](util['format'](_0xc4d2('0x3d'),_0x4289d3['uniqueid'],queues[_0x4289d3[_0xc4d2('0x5')]]['name'],_0x4289d3[_0xc4d2('0x3e')],_0x4289d3[_0xc4d2('0x3f')]));queues[_0x4289d3[_0xc4d2('0x5')]][_0xc4d2('0x18')]=![];queues[_0x4289d3['uniqueid']][_0xc4d2('0x18')]=![];queues[_0x4289d3['uniqueid']][_0xc4d2('0x29')]=null;queues[_0x4289d3['uniqueid']]['queuecallerexit']=![];queues[_0x4289d3[_0xc4d2('0x5')]]['queuecallerexitreason']=null;queues[_0x4289d3['uniqueid']]['queuecallerexitAt']=null;queues[_0x4289d3[_0xc4d2('0x5')]][_0xc4d2('0x40')]=!![];queues[_0x4289d3['uniqueid']][_0xc4d2('0xa')]=_0x4289d3['destaccountcode'];queues[_0x4289d3['uniqueid']]['lastAssignedTo']=_0x4289d3[_0xc4d2('0x3e')];}}catch(_0x769ea0){utils[_0xc4d2('0x2f')](util['format'](_0xc4d2('0x41'),_0x4289d3['uniqueid']),_0x769ea0);}};exports[_0xc4d2('0x42')]=function(_0x541198){try{if(!_[_0xc4d2('0x24')](queues[_0x541198[_0xc4d2('0x5')]])){if(queues[_0x541198['uniqueid']][_0xc4d2('0x17')]){utils['debug'](util[_0xc4d2('0x3')]('[%s][queues][agentcomplete]',_0x541198[_0xc4d2('0x5')]),_0x541198);queues[_0x541198[_0xc4d2('0x5')]][_0xc4d2('0x18')]=![];queues[_0x541198[_0xc4d2('0x5')]][_0xc4d2('0x18')]=![];queues[_0x541198[_0xc4d2('0x5')]][_0xc4d2('0x29')]=null;queues[_0x541198[_0xc4d2('0x5')]]['queuecallerexit']=![];queues[_0x541198[_0xc4d2('0x5')]][_0xc4d2('0x2b')]=null;queues[_0x541198['uniqueid']][_0xc4d2('0x40')]=!![];queues[_0x541198[_0xc4d2('0x5')]][_0xc4d2('0x8')]=_0x541198['membername'];queues[_0x541198[_0xc4d2('0x5')]]['queuecallercomplete']=!![];queues[_0x541198[_0xc4d2('0x5')]][_0xc4d2('0x1a')]=utils[_0xc4d2('0x1b')]();if(_0x541198[_0xc4d2('0x43')]==_0xc4d2('0x44')){if(!queues[_0x541198['uniqueid']][_0xc4d2('0x44')]){queues[_0x541198[_0xc4d2('0x5')]][_0xc4d2('0xb')]=_0xc4d2('0x45');}}else{queues[_0x541198[_0xc4d2('0x5')]]['queuecallerexitreason']=_0xc4d2('0x46')+_0x541198[_0xc4d2('0x43')][_0xc4d2('0x27')]();}utils[_0xc4d2('0x2')](util[_0xc4d2('0x3')](_0xc4d2('0x47'),_0x541198[_0xc4d2('0x5')],queues[_0x541198[_0xc4d2('0x5')]][_0xc4d2('0x1e')],_0x541198[_0xc4d2('0x3e')],queues[_0x541198[_0xc4d2('0x5')]][_0xc4d2('0xb')]));writeDB(queues[_0x541198['uniqueid']]);}}}catch(_0x53d6c6){utils[_0xc4d2('0x2f')](util['format'](_0xc4d2('0x48'),_0x541198[_0xc4d2('0x5')]),_0x53d6c6);}};exports[_0xc4d2('0x49')]=function(_0x34a8c1){try{if(!_[_0xc4d2('0x24')](queues[_0x34a8c1[_0xc4d2('0x4a')]])){utils[_0xc4d2('0x12')](util['format'](_0xc4d2('0x4b'),_0x34a8c1[_0xc4d2('0x5')]),_0x34a8c1);queues[_0x34a8c1[_0xc4d2('0x4a')]][_0xc4d2('0x44')]=!![];queues[_0x34a8c1[_0xc4d2('0x4a')]][_0xc4d2('0x4c')]=_0xc4d2('0x4d');queues[_0x34a8c1[_0xc4d2('0x4a')]]['transferexten']=_0x34a8c1[_0xc4d2('0x4e')];queues[_0x34a8c1[_0xc4d2('0x4a')]][_0xc4d2('0x4f')]=_0x34a8c1[_0xc4d2('0x4a')];queues[_0x34a8c1['transfereeuniqueid']][_0xc4d2('0xb')]=_0xc4d2('0x50');utils[_0xc4d2('0x2')](util[_0xc4d2('0x3')](_0xc4d2('0x51'),_0x34a8c1[_0xc4d2('0x5')],queues[_0x34a8c1[_0xc4d2('0x4a')]]['name'],_0x34a8c1[_0xc4d2('0x4a')],_0x34a8c1[_0xc4d2('0x4e')]));}}catch(_0x316c0e){utils[_0xc4d2('0x2f')](util[_0xc4d2('0x3')](_0xc4d2('0x4b'),_0x34a8c1[_0xc4d2('0x5')]),_0x316c0e);}};exports[_0xc4d2('0x52')]=function(_0x45acff){try{utils[_0xc4d2('0x12')](util['format']('[%s][queues][attendedtransfer]',_0x45acff['origtransfereruniqueid']),_0x45acff);if(_0x45acff[_0xc4d2('0x53')]==_0x45acff['origtransfererlinkedid']){if(!_[_0xc4d2('0x24')](queues[_0x45acff['secondtransfererlinkedid']])){utils[_0xc4d2('0x2')](util[_0xc4d2('0x3')](_0xc4d2('0x54'),_0x45acff[_0xc4d2('0x53')],queues[_0x45acff[_0xc4d2('0x55')]][_0xc4d2('0x1e')],_0x45acff[_0xc4d2('0x56')]));queues[_0x45acff[_0xc4d2('0x55')]][_0xc4d2('0x44')]=!![];queues[_0x45acff[_0xc4d2('0x55')]][_0xc4d2('0x4c')]='ATTENDED';queues[_0x45acff[_0xc4d2('0x55')]][_0xc4d2('0x57')]=_0x45acff[_0xc4d2('0x56')];queues[_0x45acff[_0xc4d2('0x55')]][_0xc4d2('0x4f')]=_0x45acff[_0xc4d2('0x53')];queues[_0x45acff[_0xc4d2('0x55')]][_0xc4d2('0xb')]=_0xc4d2('0x58');}if(!_['isNil'](queues[_0x45acff[_0xc4d2('0x59')]])){if(_0x45acff[_0xc4d2('0x5a')]&&queues[_0x45acff[_0xc4d2('0x5a')]]){queues[_0x45acff[_0xc4d2('0x5a')]][_0xc4d2('0x20')]=0x1;queues[_0x45acff[_0xc4d2('0x4a')]]=_[_0xc4d2('0x5b')](queues[_0x45acff[_0xc4d2('0x5a')]]);queues[_0x45acff[_0xc4d2('0x4a')]][_0xc4d2('0x10')]=_0x45acff[_0xc4d2('0x5c')];queues[_0x45acff[_0xc4d2('0x4a')]][_0xc4d2('0x20')]=0x2;queues[_0x45acff[_0xc4d2('0x4a')]][_0xc4d2('0x9')]=queues[_0x45acff[_0xc4d2('0x55')]][_0xc4d2('0x9')];queues[_0x45acff['transfereeuniqueid']]['calleridname']=queues[_0x45acff[_0xc4d2('0x55')]][_0xc4d2('0x5d')];queues[_0x45acff['transfereeuniqueid']]['queuecallerjoinAt']=utils[_0xc4d2('0x1b')]();queues[_0x45acff[_0xc4d2('0x4a')]]['queuecallerleaveAt']=utils[_0xc4d2('0x1b')]();queues[_0x45acff['transfereeuniqueid']][_0xc4d2('0x36')]=0x0;queues[_0x45acff[_0xc4d2('0x4a')]][_0xc4d2('0x5e')]=0x0;utils[_0xc4d2('0x2')](util[_0xc4d2('0x3')](_0xc4d2('0x5f'),_0x45acff['origtransfereruniqueid'],queues[_0x45acff[_0xc4d2('0x4a')]]['name'],queues[_0x45acff[_0xc4d2('0x4a')]][_0xc4d2('0x9')],queues[_0x45acff[_0xc4d2('0x4a')]]['calleridname']));}else{utils[_0xc4d2('0x2')](util['format'](_0xc4d2('0x60'),_0x45acff[_0xc4d2('0x53')],queues[_0x45acff['origtransfererlinkedid']]['name'],_0x45acff['secondtransfererlinkedid']));queues[_0x45acff[_0xc4d2('0x59')]][_0xc4d2('0x10')]=_0x45acff[_0xc4d2('0x55')];}}}else if(_0x45acff[_0xc4d2('0x61')]==_0x45acff[_0xc4d2('0x55')]){if(!_[_0xc4d2('0x24')](queues[_0x45acff['origtransfererlinkedid']])){utils[_0xc4d2('0x2')](util[_0xc4d2('0x3')](_0xc4d2('0x62'),_0x45acff[_0xc4d2('0x53')],queues[_0x45acff['origtransfererlinkedid']][_0xc4d2('0x1e')],_0x45acff[_0xc4d2('0x61')],_0x45acff['secondtransfererexten']));queues[_0x45acff[_0xc4d2('0x59')]][_0xc4d2('0x44')]=!![];queues[_0x45acff[_0xc4d2('0x59')]][_0xc4d2('0x4c')]=_0xc4d2('0x63');queues[_0x45acff[_0xc4d2('0x59')]][_0xc4d2('0x57')]=_0x45acff[_0xc4d2('0x64')];queues[_0x45acff['origtransfererlinkedid']][_0xc4d2('0x4f')]=_0x45acff['secondtransfereruniqueid'];queues[_0x45acff[_0xc4d2('0x59')]]['queuecallerexitreason']=_0xc4d2('0x58');}if(!_[_0xc4d2('0x24')](queues[_0x45acff[_0xc4d2('0x55')]])){if(_0x45acff[_0xc4d2('0x65')]&&queues[_0x45acff[_0xc4d2('0x65')]]){queues[_0x45acff[_0xc4d2('0x65')]][_0xc4d2('0x20')]=0x1;queues[_0x45acff[_0xc4d2('0x5c')]]=_[_0xc4d2('0x5b')](queues[_0x45acff[_0xc4d2('0x65')]]);queues[_0x45acff[_0xc4d2('0x5c')]]['transfereduniqueid']=_0x45acff[_0xc4d2('0x5c')];queues[_0x45acff[_0xc4d2('0x5c')]][_0xc4d2('0x20')]=0x2;queues[_0x45acff[_0xc4d2('0x5c')]][_0xc4d2('0x9')]=queues[_0x45acff[_0xc4d2('0x59')]][_0xc4d2('0x9')];queues[_0x45acff['transfertargetuniqueid']][_0xc4d2('0x5d')]=queues[_0x45acff[_0xc4d2('0x59')]]['calleridname'];queues[_0x45acff[_0xc4d2('0x5c')]][_0xc4d2('0x37')]=utils[_0xc4d2('0x1b')]();queues[_0x45acff[_0xc4d2('0x5c')]][_0xc4d2('0x17')]=utils[_0xc4d2('0x1b')]();queues[_0x45acff[_0xc4d2('0x5c')]][_0xc4d2('0x36')]=0x0;queues[_0x45acff[_0xc4d2('0x5c')]]['mohtime']=0x0;utils['info'](util[_0xc4d2('0x3')](_0xc4d2('0x66'),_0x45acff[_0xc4d2('0x53')],queues[_0x45acff['transfertargetuniqueid']][_0xc4d2('0x1e')],queues[_0x45acff[_0xc4d2('0x5c')]][_0xc4d2('0x10')],queues[_0x45acff[_0xc4d2('0x5c')]]['calleridnum'],queues[_0x45acff[_0xc4d2('0x5c')]][_0xc4d2('0x5d')]));}else{utils[_0xc4d2('0x2')](util[_0xc4d2('0x3')](_0xc4d2('0x60'),_0x45acff[_0xc4d2('0x53')],queues[_0x45acff[_0xc4d2('0x55')]]['name'],_0x45acff[_0xc4d2('0x59')]));queues[_0x45acff[_0xc4d2('0x55')]][_0xc4d2('0x10')]=_0x45acff[_0xc4d2('0x59')];}}}}catch(_0x274d94){utils[_0xc4d2('0x2f')](util[_0xc4d2('0x3')](_0xc4d2('0x67'),_0x45acff[_0xc4d2('0x53')]),_0x274d94);}};exports[_0xc4d2('0x68')]=function(_0x5236e5){try{if(!_['isNil'](queues[_0x5236e5[_0xc4d2('0x5')]])){utils[_0xc4d2('0x12')](util['format'](_0xc4d2('0x69'),_0x5236e5['uniqueid']),_0x5236e5);queues[_0x5236e5[_0xc4d2('0x5')]][_0xc4d2('0x6a')]=utils[_0xc4d2('0x1b')]();utils[_0xc4d2('0x2')](util[_0xc4d2('0x3')](_0xc4d2('0x6b'),_0x5236e5[_0xc4d2('0x5')],queues[_0x5236e5[_0xc4d2('0x5')]][_0xc4d2('0x1e')],queues[_0x5236e5[_0xc4d2('0x5')]]['musiconholdstartAt']));}}catch(_0x2315ab){utils['error'](util[_0xc4d2('0x3')](_0xc4d2('0x69'),_0x5236e5[_0xc4d2('0x5')]),_0x2315ab);}};exports[_0xc4d2('0x6c')]=function(_0x2edbec){try{if(!_[_0xc4d2('0x24')](queues[_0x2edbec[_0xc4d2('0x5')]])){if(!_[_0xc4d2('0x24')](queues[_0x2edbec[_0xc4d2('0x5')]]['musiconholdstartAt'])){utils[_0xc4d2('0x12')](util[_0xc4d2('0x3')](_0xc4d2('0x6d'),_0x2edbec[_0xc4d2('0x5')]),_0x2edbec);queues[_0x2edbec[_0xc4d2('0x5')]][_0xc4d2('0x5e')]+=utils[_0xc4d2('0x6e')](utils[_0xc4d2('0x1b')](),queues[_0x2edbec[_0xc4d2('0x5')]][_0xc4d2('0x6a')]);utils[_0xc4d2('0x2')](util['format'](_0xc4d2('0x6f'),_0x2edbec[_0xc4d2('0x5')],queues[_0x2edbec[_0xc4d2('0x5')]][_0xc4d2('0x1e')],queues[_0x2edbec[_0xc4d2('0x5')]][_0xc4d2('0x5e')]));delete queues[_0x2edbec[_0xc4d2('0x5')]][_0xc4d2('0x6a')];}}}catch(_0x4894b4){utils[_0xc4d2('0x2f')](util[_0xc4d2('0x3')](_0xc4d2('0x6d'),_0x2edbec[_0xc4d2('0x5')]),_0x4894b4);}}; \ No newline at end of file +var _0x2ee8=['connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','membername','destaccountcode','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','assigned','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','toUpperCase','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDED','transfereelinkedid','clone','transfertargetuniqueid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstartAt','musiconholdstop','mohtime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','error','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','variable','queuestatus','value','CONTINUE','isNil','queuecallerabandonAt','queuecallerexitAt','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s'];(function(_0x51c69d,_0x33cfb8){var _0x11cc28=function(_0x463d90){while(--_0x463d90){_0x51c69d['push'](_0x51c69d['shift']());}};_0x11cc28(++_0x33cfb8);}(_0x2ee8,0x167));var _0x82ee=function(_0x2099e9,_0x4c7a15){_0x2099e9=_0x2099e9-0x0;var _0x3d6dec=_0x2ee8[_0x2099e9];return _0x3d6dec;};'use strict';var _=require(_0x82ee('0x0'));var util=require(_0x82ee('0x1'));var utils=require(_0x82ee('0x2'));var queues={};function writeDB(_0x5113ec){utils['info'](util[_0x82ee('0x3')](_0x82ee('0x4'),_0x5113ec[_0x82ee('0x5')],_0x5113ec[_0x82ee('0x6')],_0x5113ec[_0x82ee('0x7')],_0x5113ec[_0x82ee('0x8')],_0x5113ec[_0x82ee('0x9')],_0x5113ec[_0x82ee('0xa')],_0x5113ec[_0x82ee('0xb')]));if(_0x5113ec[_0x82ee('0x7')]){utils[_0x82ee('0xc')](_0x5113ec[_0x82ee('0x7')])[_0x82ee('0xd')](function(_0x236c40){if(_0x236c40){_0x5113ec['type']=_0x236c40['type'];}utils[_0x82ee('0xe')](_0x82ee('0xf'),_0x5113ec);});}else{utils[_0x82ee('0xe')]('CreateVoiceQueueReport',_0x5113ec);}if(_0x5113ec[_0x82ee('0x10')]){delete queues[_0x5113ec[_0x82ee('0x10')]];}else{delete queues[_0x5113ec[_0x82ee('0x5')]];}}exports[_0x82ee('0x11')]=function(_0x73acd2){try{utils[_0x82ee('0x12')](util[_0x82ee('0x3')](_0x82ee('0x13'),_0x73acd2[_0x82ee('0x5')]),_0x73acd2);utils[_0x82ee('0x14')](util['format'](_0x82ee('0x15'),_0x73acd2[_0x82ee('0x5')],_0x73acd2[_0x82ee('0x7')],_0x73acd2['position']));queues[_0x73acd2[_0x82ee('0x5')]]=_[_0x82ee('0x16')](_0x73acd2,{'originalposition':_0x73acd2[_0x82ee('0x17')],'queuecallerjoinAt':utils[_0x82ee('0x18')](),'mohtime':0x0});}catch(_0x3fbe7c){utils[_0x82ee('0x19')](util[_0x82ee('0x3')](_0x82ee('0x13'),_0x73acd2[_0x82ee('0x5')]),_0x3fbe7c);}};exports['hangup']=function(_0x23c971){try{if(!_['isNil'](queues[_0x23c971[_0x82ee('0x5')]])){utils['debug'](util[_0x82ee('0x3')](_0x82ee('0x1a'),_0x23c971[_0x82ee('0x5')]),_0x23c971);if(queues[_0x23c971[_0x82ee('0x5')]][_0x82ee('0x1b')]){if(!queues[_0x23c971['uniqueid']][_0x82ee('0x1c')]&&!queues[_0x23c971[_0x82ee('0x5')]][_0x82ee('0x1d')]){queues[_0x23c971['uniqueid']]['queuecallercomplete']=!![];queues[_0x23c971['uniqueid']][_0x82ee('0x1e')]=utils[_0x82ee('0x18')]();queues[_0x23c971[_0x82ee('0x5')]][_0x82ee('0xb')]=_0x82ee('0x1f');}utils[_0x82ee('0x14')](util[_0x82ee('0x3')](_0x82ee('0x20'),_0x23c971[_0x82ee('0x5')],queues[_0x23c971['uniqueid']][_0x82ee('0x21')],queues[_0x23c971[_0x82ee('0x5')]][_0x82ee('0xb')]));writeDB(queues[_0x23c971[_0x82ee('0x5')]]);}else if(queues[_0x23c971['uniqueid']][_0x82ee('0x10')]){utils['info'](util[_0x82ee('0x3')](_0x82ee('0x22'),_0x23c971[_0x82ee('0x5')],queues[_0x23c971[_0x82ee('0x5')]][_0x82ee('0x21')],queues[_0x23c971['uniqueid']][_0x82ee('0x10')]));queues[queues[_0x23c971[_0x82ee('0x5')]][_0x82ee('0x10')]]=queues[_0x23c971[_0x82ee('0x5')]];queues[queues[_0x23c971[_0x82ee('0x5')]]['transfereduniqueid']][_0x82ee('0x23')]=0x2;delete queues[_0x23c971[_0x82ee('0x5')]];}}}catch(_0x3abd9f){utils[_0x82ee('0x19')](util[_0x82ee('0x3')]('[%s][queues][hangup]',_0x23c971['uniqueid']),_0x3abd9f);}};exports[_0x82ee('0x24')]=function(_0x4c8764){try{utils['debug'](util[_0x82ee('0x3')]('[%s][queues][varset]',_0x4c8764[_0x82ee('0x5')]),_0x4c8764);if(!_['isNil'](_0x4c8764[_0x82ee('0x25')][_0x82ee('0x26')])&&_0x4c8764[_0x82ee('0x27')]['toUpperCase']()!==_0x82ee('0x28')){if(!_[_0x82ee('0x29')](queues[_0x4c8764[_0x82ee('0x5')]])){queues[_0x4c8764[_0x82ee('0x5')]][_0x82ee('0x1c')]=![];queues[_0x4c8764['uniqueid']][_0x82ee('0x2a')]=null;queues[_0x4c8764[_0x82ee('0x5')]][_0x82ee('0x1d')]=!![];queues[_0x4c8764[_0x82ee('0x5')]][_0x82ee('0x2b')]=utils['now']();queues[_0x4c8764[_0x82ee('0x5')]][_0x82ee('0xb')]=_0x4c8764[_0x82ee('0x27')]['toUpperCase']();utils[_0x82ee('0x14')](util[_0x82ee('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x4c8764['uniqueid'],queues[_0x4c8764[_0x82ee('0x5')]]['name'],_0x4c8764[_0x82ee('0x27')],queues[_0x4c8764[_0x82ee('0x5')]][_0x82ee('0xb')]));writeDB(queues[_0x4c8764[_0x82ee('0x5')]]);}}else if(!_[_0x82ee('0x29')](_0x4c8764['variable'][_0x82ee('0x2c')])){if(!_['isNil'](queues[_0x4c8764[_0x82ee('0x5')]])&&!queues[_0x4c8764[_0x82ee('0x5')]][_0x82ee('0x1c')]){queues[_0x4c8764[_0x82ee('0x5')]][_0x82ee('0x1c')]=![];queues[_0x4c8764[_0x82ee('0x5')]][_0x82ee('0x2a')]=null;queues[_0x4c8764[_0x82ee('0x5')]]['queuecallerexit']=!![];queues[_0x4c8764[_0x82ee('0x5')]]['queuecallerexitAt']=utils['now']();queues[_0x4c8764[_0x82ee('0x5')]]['queuecallerexitreason']='EXITWITHKEY';utils['info'](util['format'](_0x82ee('0x2d'),_0x4c8764[_0x82ee('0x5')],queues[_0x4c8764[_0x82ee('0x5')]][_0x82ee('0x21')],_0x4c8764[_0x82ee('0x27')],queues[_0x4c8764['uniqueid']]['queuecallerexitreason']));}}}catch(_0x1ff8ce){utils[_0x82ee('0x19')](util[_0x82ee('0x3')](_0x82ee('0x2e'),_0x4c8764[_0x82ee('0x5')]),_0x1ff8ce);}};exports[_0x82ee('0x1c')]=function(_0x1ea968){try{if(!_[_0x82ee('0x29')](queues[_0x1ea968[_0x82ee('0x5')]])){utils[_0x82ee('0x12')](util[_0x82ee('0x3')](_0x82ee('0x2f'),_0x1ea968[_0x82ee('0x5')]),_0x1ea968);queues[_0x1ea968[_0x82ee('0x5')]][_0x82ee('0x1d')]=![];queues[_0x1ea968[_0x82ee('0x5')]]['queuecallerexitAt']=null;queues[_0x1ea968[_0x82ee('0x5')]][_0x82ee('0x1c')]=!![];queues[_0x1ea968[_0x82ee('0x5')]][_0x82ee('0x2a')]=utils['now']();queues[_0x1ea968[_0x82ee('0x5')]]['queuecallerexitreason']=_0x82ee('0x30');utils[_0x82ee('0x14')](util[_0x82ee('0x3')](_0x82ee('0x31'),_0x1ea968[_0x82ee('0x5')],queues[_0x1ea968[_0x82ee('0x5')]][_0x82ee('0x21')],queues[_0x1ea968[_0x82ee('0x5')]][_0x82ee('0xb')]));}}catch(_0x120a27){utils['error'](util[_0x82ee('0x3')](_0x82ee('0x2f'),_0x1ea968[_0x82ee('0x5')]),_0x120a27);}};exports[_0x82ee('0x32')]=function(_0x192a0c){try{if(!_['isNil'](queues[_0x192a0c[_0x82ee('0x5')]])){utils['debug'](util['format'](_0x82ee('0x33'),_0x192a0c[_0x82ee('0x5')]),_0x192a0c);utils['info'](util[_0x82ee('0x3')](_0x82ee('0x34'),_0x192a0c[_0x82ee('0x5')],queues[_0x192a0c['uniqueid']]['name'],_0x192a0c[_0x82ee('0x35')],_0x192a0c[_0x82ee('0x36')]));queues[_0x192a0c[_0x82ee('0x5')]][_0x82ee('0x32')]=!![];queues[_0x192a0c[_0x82ee('0x5')]][_0x82ee('0x1b')]=utils[_0x82ee('0x18')]();queues[_0x192a0c[_0x82ee('0x5')]][_0x82ee('0x37')]=utils[_0x82ee('0x38')](queues[_0x192a0c[_0x82ee('0x5')]][_0x82ee('0x1b')],queues[_0x192a0c[_0x82ee('0x5')]][_0x82ee('0x39')]);queues[_0x192a0c[_0x82ee('0x5')]][_0x82ee('0x17')]=_0x192a0c[_0x82ee('0x17')];queues[_0x192a0c['uniqueid']][_0x82ee('0x3a')]=_0x192a0c[_0x82ee('0x3a')];queues[_0x192a0c[_0x82ee('0x5')]][_0x82ee('0x35')]=_0x192a0c['connectedlinenum'];queues[_0x192a0c['uniqueid']][_0x82ee('0x36')]=_0x192a0c[_0x82ee('0x36')];}}catch(_0x1fa0af){utils[_0x82ee('0x19')](util[_0x82ee('0x3')]('[%s][queues][queuecallerleave]',_0x192a0c['uniqueid']),_0x1fa0af);}};exports[_0x82ee('0x3b')]=function(_0x21f59a){try{if(!_['isNil'](queues[_0x21f59a[_0x82ee('0x5')]])){utils[_0x82ee('0x12')](util[_0x82ee('0x3')]('[%s][queues][agentconnect]',_0x21f59a[_0x82ee('0x5')]),_0x21f59a);utils[_0x82ee('0x14')](util[_0x82ee('0x3')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x21f59a[_0x82ee('0x5')],queues[_0x21f59a[_0x82ee('0x5')]][_0x82ee('0x21')],_0x21f59a[_0x82ee('0x3c')],_0x21f59a[_0x82ee('0x3d')]));queues[_0x21f59a[_0x82ee('0x5')]]['queuecallerabandon']=![];queues[_0x21f59a[_0x82ee('0x5')]]['queuecallerabandon']=![];queues[_0x21f59a['uniqueid']]['queuecallerabandonAt']=null;queues[_0x21f59a[_0x82ee('0x5')]][_0x82ee('0x1d')]=![];queues[_0x21f59a[_0x82ee('0x5')]][_0x82ee('0xb')]=null;queues[_0x21f59a[_0x82ee('0x5')]]['queuecallerexitAt']=null;queues[_0x21f59a['uniqueid']]['assigned']=!![];queues[_0x21f59a['uniqueid']]['accountcode']=_0x21f59a[_0x82ee('0x3d')];queues[_0x21f59a[_0x82ee('0x5')]]['lastAssignedTo']=_0x21f59a[_0x82ee('0x3c')];}}catch(_0x2b1437){utils['error'](util[_0x82ee('0x3')](_0x82ee('0x3e'),_0x21f59a[_0x82ee('0x5')]),_0x2b1437);}};exports[_0x82ee('0x3f')]=function(_0x918e49){try{if(!_[_0x82ee('0x29')](queues[_0x918e49[_0x82ee('0x5')]])){if(queues[_0x918e49['uniqueid']][_0x82ee('0x1b')]){utils['debug'](util['format'](_0x82ee('0x40'),_0x918e49[_0x82ee('0x5')]),_0x918e49);queues[_0x918e49[_0x82ee('0x5')]][_0x82ee('0x1c')]=![];queues[_0x918e49[_0x82ee('0x5')]][_0x82ee('0x1c')]=![];queues[_0x918e49[_0x82ee('0x5')]][_0x82ee('0x2a')]=null;queues[_0x918e49['uniqueid']][_0x82ee('0x1d')]=![];queues[_0x918e49[_0x82ee('0x5')]][_0x82ee('0x2b')]=null;queues[_0x918e49[_0x82ee('0x5')]][_0x82ee('0x41')]=!![];queues[_0x918e49['uniqueid']][_0x82ee('0x8')]=_0x918e49[_0x82ee('0x3c')];queues[_0x918e49['uniqueid']][_0x82ee('0x42')]=!![];queues[_0x918e49[_0x82ee('0x5')]][_0x82ee('0x1e')]=utils[_0x82ee('0x18')]();if(_0x918e49[_0x82ee('0x43')]==_0x82ee('0x44')){if(!queues[_0x918e49[_0x82ee('0x5')]][_0x82ee('0x44')]){queues[_0x918e49[_0x82ee('0x5')]][_0x82ee('0xb')]=_0x82ee('0x45');}}else{queues[_0x918e49[_0x82ee('0x5')]][_0x82ee('0xb')]=_0x82ee('0x46')+_0x918e49[_0x82ee('0x43')][_0x82ee('0x47')]();}utils[_0x82ee('0x14')](util[_0x82ee('0x3')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x918e49[_0x82ee('0x5')],queues[_0x918e49['uniqueid']]['name'],_0x918e49[_0x82ee('0x3c')],queues[_0x918e49[_0x82ee('0x5')]][_0x82ee('0xb')]));writeDB(queues[_0x918e49[_0x82ee('0x5')]]);}}}catch(_0x2559b3){utils[_0x82ee('0x19')](util['format']('[%s][queues][agentcomplete]',_0x918e49[_0x82ee('0x5')]),_0x2559b3);}};exports['blindtransfer']=function(_0x7cc00a){try{if(!_['isNil'](queues[_0x7cc00a['transfereeuniqueid']])){utils[_0x82ee('0x12')](util['format'](_0x82ee('0x48'),_0x7cc00a['uniqueid']),_0x7cc00a);queues[_0x7cc00a[_0x82ee('0x49')]][_0x82ee('0x44')]=!![];queues[_0x7cc00a[_0x82ee('0x49')]][_0x82ee('0x4a')]=_0x82ee('0x4b');queues[_0x7cc00a[_0x82ee('0x49')]][_0x82ee('0x4c')]=_0x7cc00a[_0x82ee('0x4d')];queues[_0x7cc00a[_0x82ee('0x49')]][_0x82ee('0x4e')]=_0x7cc00a['transfereeuniqueid'];queues[_0x7cc00a[_0x82ee('0x49')]][_0x82ee('0xb')]=_0x82ee('0x4f');utils[_0x82ee('0x14')](util[_0x82ee('0x3')](_0x82ee('0x50'),_0x7cc00a[_0x82ee('0x5')],queues[_0x7cc00a[_0x82ee('0x49')]][_0x82ee('0x21')],_0x7cc00a[_0x82ee('0x49')],_0x7cc00a[_0x82ee('0x4d')]));}}catch(_0x32e0b1){utils[_0x82ee('0x19')](util[_0x82ee('0x3')](_0x82ee('0x48'),_0x7cc00a[_0x82ee('0x5')]),_0x32e0b1);}};exports[_0x82ee('0x51')]=function(_0x65d140){try{utils[_0x82ee('0x12')](util[_0x82ee('0x3')]('[%s][queues][attendedtransfer]',_0x65d140['origtransfereruniqueid']),_0x65d140);if(_0x65d140[_0x82ee('0x52')]==_0x65d140[_0x82ee('0x53')]){if(!_[_0x82ee('0x29')](queues[_0x65d140[_0x82ee('0x54')]])){utils[_0x82ee('0x14')](util[_0x82ee('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x65d140[_0x82ee('0x52')],queues[_0x65d140['secondtransfererlinkedid']][_0x82ee('0x21')],_0x65d140[_0x82ee('0x55')]));queues[_0x65d140[_0x82ee('0x54')]][_0x82ee('0x44')]=!![];queues[_0x65d140[_0x82ee('0x54')]][_0x82ee('0x4a')]=_0x82ee('0x56');queues[_0x65d140[_0x82ee('0x54')]][_0x82ee('0x4c')]=_0x65d140[_0x82ee('0x55')];queues[_0x65d140[_0x82ee('0x54')]][_0x82ee('0x4e')]=_0x65d140[_0x82ee('0x52')];queues[_0x65d140[_0x82ee('0x54')]][_0x82ee('0xb')]='ATTENDEDTRANSFER';}if(!_[_0x82ee('0x29')](queues[_0x65d140[_0x82ee('0x53')]])){if(_0x65d140['transfereelinkedid']&&queues[_0x65d140[_0x82ee('0x57')]]){queues[_0x65d140[_0x82ee('0x57')]]['queuecallerenterreason']=0x1;queues[_0x65d140['transfereeuniqueid']]=_[_0x82ee('0x58')](queues[_0x65d140[_0x82ee('0x57')]]);queues[_0x65d140['transfereeuniqueid']]['transfereduniqueid']=_0x65d140[_0x82ee('0x59')];queues[_0x65d140['transfereeuniqueid']][_0x82ee('0x23')]=0x2;queues[_0x65d140[_0x82ee('0x49')]][_0x82ee('0x9')]=queues[_0x65d140['secondtransfererlinkedid']][_0x82ee('0x9')];queues[_0x65d140[_0x82ee('0x49')]][_0x82ee('0x5a')]=queues[_0x65d140[_0x82ee('0x54')]][_0x82ee('0x5a')];queues[_0x65d140['transfereeuniqueid']][_0x82ee('0x39')]=utils[_0x82ee('0x18')]();queues[_0x65d140['transfereeuniqueid']][_0x82ee('0x1b')]=utils[_0x82ee('0x18')]();queues[_0x65d140['transfereeuniqueid']][_0x82ee('0x37')]=0x0;queues[_0x65d140[_0x82ee('0x49')]]['mohtime']=0x0;utils[_0x82ee('0x14')](util[_0x82ee('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x65d140[_0x82ee('0x52')],queues[_0x65d140[_0x82ee('0x49')]]['name'],queues[_0x65d140[_0x82ee('0x49')]][_0x82ee('0x9')],queues[_0x65d140[_0x82ee('0x49')]][_0x82ee('0x5a')]));}else{utils['info'](util[_0x82ee('0x3')](_0x82ee('0x5b'),_0x65d140[_0x82ee('0x52')],queues[_0x65d140[_0x82ee('0x53')]][_0x82ee('0x21')],_0x65d140[_0x82ee('0x54')]));queues[_0x65d140[_0x82ee('0x53')]][_0x82ee('0x10')]=_0x65d140[_0x82ee('0x54')];}}}else if(_0x65d140[_0x82ee('0x5c')]==_0x65d140[_0x82ee('0x54')]){if(!_[_0x82ee('0x29')](queues[_0x65d140[_0x82ee('0x53')]])){utils[_0x82ee('0x14')](util['format'](_0x82ee('0x5d'),_0x65d140[_0x82ee('0x52')],queues[_0x65d140[_0x82ee('0x53')]]['name'],_0x65d140[_0x82ee('0x5c')],_0x65d140[_0x82ee('0x5e')]));queues[_0x65d140['origtransfererlinkedid']]['transfer']=!![];queues[_0x65d140[_0x82ee('0x53')]]['transfertype']=_0x82ee('0x56');queues[_0x65d140[_0x82ee('0x53')]][_0x82ee('0x4c')]=_0x65d140[_0x82ee('0x5e')];queues[_0x65d140[_0x82ee('0x53')]][_0x82ee('0x4e')]=_0x65d140[_0x82ee('0x5c')];queues[_0x65d140[_0x82ee('0x53')]][_0x82ee('0xb')]=_0x82ee('0x5f');}if(!_[_0x82ee('0x29')](queues[_0x65d140[_0x82ee('0x54')]])){if(_0x65d140['transfertargetlinkedid']&&queues[_0x65d140[_0x82ee('0x60')]]){queues[_0x65d140['transfertargetlinkedid']][_0x82ee('0x23')]=0x1;queues[_0x65d140['transfertargetuniqueid']]=_[_0x82ee('0x58')](queues[_0x65d140[_0x82ee('0x60')]]);queues[_0x65d140['transfertargetuniqueid']][_0x82ee('0x10')]=_0x65d140[_0x82ee('0x59')];queues[_0x65d140[_0x82ee('0x59')]][_0x82ee('0x23')]=0x2;queues[_0x65d140[_0x82ee('0x59')]][_0x82ee('0x9')]=queues[_0x65d140[_0x82ee('0x53')]][_0x82ee('0x9')];queues[_0x65d140['transfertargetuniqueid']][_0x82ee('0x5a')]=queues[_0x65d140[_0x82ee('0x53')]][_0x82ee('0x5a')];queues[_0x65d140[_0x82ee('0x59')]][_0x82ee('0x39')]=utils[_0x82ee('0x18')]();queues[_0x65d140['transfertargetuniqueid']]['queuecallerleaveAt']=utils[_0x82ee('0x18')]();queues[_0x65d140[_0x82ee('0x59')]][_0x82ee('0x37')]=0x0;queues[_0x65d140[_0x82ee('0x59')]]['mohtime']=0x0;utils[_0x82ee('0x14')](util[_0x82ee('0x3')](_0x82ee('0x61'),_0x65d140['origtransfereruniqueid'],queues[_0x65d140[_0x82ee('0x59')]][_0x82ee('0x21')],queues[_0x65d140[_0x82ee('0x59')]]['transfereduniqueid'],queues[_0x65d140[_0x82ee('0x59')]][_0x82ee('0x9')],queues[_0x65d140[_0x82ee('0x59')]]['calleridname']));}else{utils[_0x82ee('0x14')](util[_0x82ee('0x3')](_0x82ee('0x5b'),_0x65d140[_0x82ee('0x52')],queues[_0x65d140[_0x82ee('0x54')]][_0x82ee('0x21')],_0x65d140['origtransfererlinkedid']));queues[_0x65d140[_0x82ee('0x54')]][_0x82ee('0x10')]=_0x65d140[_0x82ee('0x53')];}}}}catch(_0x233d62){utils[_0x82ee('0x19')](util[_0x82ee('0x3')](_0x82ee('0x62'),_0x65d140[_0x82ee('0x52')]),_0x233d62);}};exports['musiconholdstart']=function(_0x54998b){try{if(!_['isNil'](queues[_0x54998b[_0x82ee('0x5')]])){utils[_0x82ee('0x12')](util['format']('[%s][queues][musiconholdstart]',_0x54998b[_0x82ee('0x5')]),_0x54998b);queues[_0x54998b[_0x82ee('0x5')]][_0x82ee('0x63')]=utils[_0x82ee('0x18')]();utils[_0x82ee('0x14')](util[_0x82ee('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x54998b['uniqueid'],queues[_0x54998b['uniqueid']][_0x82ee('0x21')],queues[_0x54998b['uniqueid']][_0x82ee('0x63')]));}}catch(_0x1d2ceb){utils['error'](util[_0x82ee('0x3')]('[%s][queues][musiconholdstart]',_0x54998b['uniqueid']),_0x1d2ceb);}};exports[_0x82ee('0x64')]=function(_0x4f39a6){try{if(!_[_0x82ee('0x29')](queues[_0x4f39a6['uniqueid']])){if(!_[_0x82ee('0x29')](queues[_0x4f39a6[_0x82ee('0x5')]][_0x82ee('0x63')])){utils['debug'](util[_0x82ee('0x3')]('[%s][queues][musiconholdstop]',_0x4f39a6['uniqueid']),_0x4f39a6);queues[_0x4f39a6[_0x82ee('0x5')]][_0x82ee('0x65')]+=utils[_0x82ee('0x38')](utils[_0x82ee('0x18')](),queues[_0x4f39a6[_0x82ee('0x5')]][_0x82ee('0x63')]);utils['info'](util[_0x82ee('0x3')](_0x82ee('0x66'),_0x4f39a6['uniqueid'],queues[_0x4f39a6[_0x82ee('0x5')]][_0x82ee('0x21')],queues[_0x4f39a6[_0x82ee('0x5')]][_0x82ee('0x65')]));delete queues[_0x4f39a6['uniqueid']]['musiconholdstartAt'];}}}catch(_0x4a58e7){utils['error'](util[_0x82ee('0x3')]('[%s][queues][musiconholdstop]',_0x4f39a6[_0x82ee('0x5')]),_0x4a58e7);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 795a6d9..c0dc2ad 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 _0xd90b=['appdata','set','toLowerCase','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','lodash','util','./utils','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','membername','name','UserId','request','newchannel','debug','[%s][recordings][newchannel]','linkedid','info','context','exten','channel','error','newstate','isNil','channelstate','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','replace','.wav49','.WAV','find','monitors','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','type','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application'];(function(_0x188d8d,_0x3289e2){var _0x4132e4=function(_0x4ae987){while(--_0x4ae987){_0x188d8d['push'](_0x188d8d['shift']());}};_0x4132e4(++_0x3289e2);}(_0xd90b,0x1a7));var _0xbd90=function(_0x280e13,_0x2c7144){_0x280e13=_0x280e13-0x0;var _0x3d20b1=_0xd90b[_0x280e13];return _0x3d20b1;};'use strict';var _=require(_0xbd90('0x0'));var util=require(_0xbd90('0x1'));var utils=require(_0xbd90('0x2'));var recordings={};function writeDB(_0x689f7e){utils['info'](util[_0xbd90('0x3')](_0xbd90('0x4'),_0x689f7e[_0xbd90('0x5')]));if(_0x689f7e[_0xbd90('0x6')]){utils[_0xbd90('0x7')](_0x689f7e[_0xbd90('0x6')])['then'](function(_0x40f73e){if(_0x40f73e){_0x689f7e[_0xbd90('0x8')]=_0x40f73e[_0xbd90('0x9')];_0x689f7e[_0xbd90('0xa')]=_0x40f73e['id'];}utils[_0xbd90('0xb')]('CreateVoiceRecording',_0x689f7e);});}else{utils[_0xbd90('0xb')]('CreateVoiceRecording',_0x689f7e);}}exports[_0xbd90('0xc')]=function(_0x333059){try{utils[_0xbd90('0xd')](util[_0xbd90('0x3')](_0xbd90('0xe'),_0x333059[_0xbd90('0x5')]),_0x333059);if(_0x333059[_0xbd90('0x5')]==_0x333059[_0xbd90('0xf')]){utils[_0xbd90('0x10')](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x333059['uniqueid'],_0x333059[_0xbd90('0x11')],_0x333059[_0xbd90('0x12')]));recordings[_0x333059['uniqueid']]={'uniqueid':_0x333059[_0xbd90('0x5')],'accountcode':_0x333059[_0xbd90('0x6')],'exten':_0x333059[_0xbd90('0x12')],'context':_0x333059[_0xbd90('0x11')],'channel':_0x333059[_0xbd90('0x13')],'monitors':[]};}}catch(_0x31726a){utils[_0xbd90('0x14')](util['format'](_0xbd90('0xe'),_0x333059[_0xbd90('0x5')]),_0x31726a);}};exports[_0xbd90('0x15')]=function(_0x3172b){try{utils['debug'](util['format']('[%s][recordings][newstate]',_0x3172b['uniqueid']),_0x3172b);if(!_[_0xbd90('0x16')](recordings[_0x3172b['uniqueid']])&&_0x3172b[_0xbd90('0x17')]==0x6){utils['info'](util[_0xbd90('0x3')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x3172b[_0xbd90('0x5')],_0x3172b[_0xbd90('0x11')],_0x3172b[_0xbd90('0x13')]));}else if(!_[_0xbd90('0x16')](recordings[_0x3172b[_0xbd90('0xf')]])&&_0x3172b['channelstate']==0x6&&_0x3172b[_0xbd90('0x11')]!='transfer'){utils[_0xbd90('0x10')](util['format']('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x3172b[_0xbd90('0x5')],_0x3172b[_0xbd90('0xf')],_0x3172b[_0xbd90('0x11')],_0x3172b[_0xbd90('0x13')]));recordings[_0x3172b[_0xbd90('0xf')]][_0xbd90('0x6')]=_0x3172b[_0xbd90('0x6')];}}catch(_0x4dbe90){utils[_0xbd90('0x14')](util[_0xbd90('0x3')]('[%s][recordings][newstate]',_0x3172b[_0xbd90('0x5')]),_0x4dbe90);}};exports[_0xbd90('0x18')]=function(_0x57bb32){try{if(!_[_0xbd90('0x16')](_0x57bb32[_0xbd90('0x19')])&&!_[_0xbd90('0x16')](_0x57bb32['variable'][_0xbd90('0x1a')])){utils['debug'](util[_0xbd90('0x3')](_0xbd90('0x1b'),_0x57bb32[_0xbd90('0x5')]),_0x57bb32);utils[_0xbd90('0x10')](util[_0xbd90('0x3')](_0xbd90('0x1c'),_0x57bb32[_0xbd90('0x5')],_0x57bb32['variable'],_0x57bb32[_0xbd90('0x1d')]));if(_['endsWith'](_0x57bb32[_0xbd90('0x1d')],'.wav49')){_0x57bb32[_0xbd90('0x1d')]=_0x57bb32[_0xbd90('0x1d')][_0xbd90('0x1e')](_0xbd90('0x1f'),_0xbd90('0x20'));}if(recordings[_0x57bb32[_0xbd90('0xf')]]){var _0x31fdea=_[_0xbd90('0x21')](recordings[_0x57bb32[_0xbd90('0xf')]][_0xbd90('0x22')],{'value':_0x57bb32[_0xbd90('0x1d')]});if(_['isNil'](_0x31fdea)){recordings[_0x57bb32['linkedid']]['monitors']['push']({'value':_0x57bb32[_0xbd90('0x1d')]});}}}}catch(_0x3ec183){utils[_0xbd90('0x14')](util[_0xbd90('0x3')](_0xbd90('0x1b'),_0x57bb32[_0xbd90('0x5')]),_0x3ec183);}};exports[_0xbd90('0x23')]=function(_0x43a1fc){try{if(!_[_0xbd90('0x16')](recordings[_0x43a1fc[_0xbd90('0x5')]])){utils['debug'](util[_0xbd90('0x3')]('[%s][recordings][hangup]',_0x43a1fc[_0xbd90('0x5')]),_0x43a1fc);utils[_0xbd90('0x10')](util[_0xbd90('0x3')](_0xbd90('0x24'),_0x43a1fc[_0xbd90('0x5')],_0x43a1fc[_0xbd90('0x25')],_0x43a1fc[_0xbd90('0x26')],_0x43a1fc[_0xbd90('0x27')]));recordings[_0x43a1fc['uniqueid']]['calleridnum']=_0x43a1fc[_0xbd90('0x25')];recordings[_0x43a1fc[_0xbd90('0x5')]][_0xbd90('0x26')]=_0x43a1fc[_0xbd90('0x26')];recordings[_0x43a1fc[_0xbd90('0x5')]]['connectedlinenum']=_0x43a1fc[_0xbd90('0x28')];recordings[_0x43a1fc[_0xbd90('0x5')]]['connectedlinename']=_0x43a1fc['connectedlinename'];if(recordings[_0x43a1fc[_0xbd90('0x5')]][_0xbd90('0x29')]=='outbound'&&recordings[_0x43a1fc[_0xbd90('0x5')]]['accountcode']){recordings[_0x43a1fc[_0xbd90('0x5')]][_0xbd90('0x28')]=recordings[_0x43a1fc[_0xbd90('0x5')]]['accountcode'];recordings[_0x43a1fc['uniqueid']]['connectedlinename']='';}recordings[_0x43a1fc[_0xbd90('0x5')]]['monitors'][_0xbd90('0x2a')](function(_0x5c759e){var _0x9f4586=_[_0xbd90('0x2b')](recordings[_0x43a1fc[_0xbd90('0x5')]]);_0x9f4586['value']=_0x5c759e[_0xbd90('0x1d')];writeDB(_0x9f4586);});delete recordings[_0x43a1fc['uniqueid']];}}catch(_0xdad796){utils[_0xbd90('0x14')](util[_0xbd90('0x3')](_0xbd90('0x2c'),_0x43a1fc[_0xbd90('0x5')]),_0xdad796);}};exports[_0xbd90('0x2d')]=function(_0x3be35e){try{if(!_[_0xbd90('0x16')](recordings[_0x3be35e[_0xbd90('0x5')]])){utils[_0xbd90('0xd')](util['format'](_0xbd90('0x2e'),_0x3be35e[_0xbd90('0x5')]),_0x3be35e);utils[_0xbd90('0x10')](util['format'](_0xbd90('0x2f'),_0x3be35e[_0xbd90('0x5')],_0x3be35e[_0xbd90('0x30')],_0x3be35e[_0xbd90('0x31')]));if(_0x3be35e[_0xbd90('0x30')]['toLowerCase']()==_0xbd90('0x32')&&_['startsWith'](_0x3be35e[_0xbd90('0x31')][_0xbd90('0x33')](),_0xbd90('0x34'))){var _0x4f1478=_0x3be35e[_0xbd90('0x31')][_0xbd90('0x35')]('=');var _0x855cc4=_0x4f1478[0x0][_0xbd90('0x36')](_0x4f1478[0x0]['lastIndexOf']('(')+0x1,_0x4f1478[0x0][_0xbd90('0x37')](')'));var _0x5d75a8=_0x4f1478[0x1];recordings[_0x3be35e[_0xbd90('0x5')]][_0x855cc4]=_0x5d75a8;}}}catch(_0x3c985d){utils[_0xbd90('0x14')](util[_0xbd90('0x3')](_0xbd90('0x2e'),_0x3be35e[_0xbd90('0x5')]),_0x3c985d);}};exports[_0xbd90('0x38')]=function(_0x1050ea){try{if(!_[_0xbd90('0x16')](recordings[_0x1050ea[_0xbd90('0x5')]])){utils[_0xbd90('0xd')](util[_0xbd90('0x3')](_0xbd90('0x39'),_0x1050ea[_0xbd90('0x5')]),_0x1050ea);utils[_0xbd90('0x10')](util['format']('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x1050ea[_0xbd90('0x5')],_0x1050ea[_0xbd90('0x3a')]));recordings[_0x1050ea[_0xbd90('0x5')]][_0xbd90('0x3a')]=_0x1050ea[_0xbd90('0x3a')];}}catch(_0x3b4466){utils[_0xbd90('0x14')](util[_0xbd90('0x3')](_0xbd90('0x39'),_0x1050ea['uniqueid']),_0x3b4466);}}; \ No newline at end of file +var _0xa896=['replace','.WAV','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','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','startsWith','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','name','request','CreateVoiceRecording','newchannel','debug','format','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error','newstate','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','varset','variable','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49'];(function(_0x3253fc,_0x444541){var _0x501d87=function(_0x21473b){while(--_0x21473b){_0x3253fc['push'](_0x3253fc['shift']());}};_0x501d87(++_0x444541);}(_0xa896,0x19e));var _0x6a89=function(_0x4b4db3,_0x4be755){_0x4b4db3=_0x4b4db3-0x0;var _0x2f97da=_0xa896[_0x4b4db3];return _0x2f97da;};'use strict';var _=require(_0x6a89('0x0'));var util=require(_0x6a89('0x1'));var utils=require(_0x6a89('0x2'));var recordings={};function writeDB(_0x454244){utils[_0x6a89('0x3')](util['format'](_0x6a89('0x4'),_0x454244[_0x6a89('0x5')]));if(_0x454244[_0x6a89('0x6')]){utils[_0x6a89('0x7')](_0x454244[_0x6a89('0x6')])[_0x6a89('0x8')](function(_0x18e7c7){if(_0x18e7c7){_0x454244[_0x6a89('0x9')]=_0x18e7c7[_0x6a89('0xa')];_0x454244['UserId']=_0x18e7c7['id'];}utils[_0x6a89('0xb')](_0x6a89('0xc'),_0x454244);});}else{utils['request'](_0x6a89('0xc'),_0x454244);}}exports[_0x6a89('0xd')]=function(_0x28c254){try{utils[_0x6a89('0xe')](util[_0x6a89('0xf')](_0x6a89('0x10'),_0x28c254[_0x6a89('0x5')]),_0x28c254);if(_0x28c254[_0x6a89('0x5')]==_0x28c254[_0x6a89('0x11')]){utils[_0x6a89('0x3')](util[_0x6a89('0xf')](_0x6a89('0x12'),_0x28c254[_0x6a89('0x5')],_0x28c254['context'],_0x28c254[_0x6a89('0x13')]));recordings[_0x28c254[_0x6a89('0x5')]]={'uniqueid':_0x28c254['uniqueid'],'accountcode':_0x28c254[_0x6a89('0x6')],'exten':_0x28c254[_0x6a89('0x13')],'context':_0x28c254[_0x6a89('0x14')],'channel':_0x28c254[_0x6a89('0x15')],'monitors':[]};}}catch(_0x49f89c){utils[_0x6a89('0x16')](util[_0x6a89('0xf')](_0x6a89('0x10'),_0x28c254[_0x6a89('0x5')]),_0x49f89c);}};exports[_0x6a89('0x17')]=function(_0x5b57bb){try{utils[_0x6a89('0xe')](util[_0x6a89('0xf')](_0x6a89('0x18'),_0x5b57bb[_0x6a89('0x5')]),_0x5b57bb);if(!_[_0x6a89('0x19')](recordings[_0x5b57bb[_0x6a89('0x5')]])&&_0x5b57bb['channelstate']==0x6){utils[_0x6a89('0x3')](util[_0x6a89('0xf')](_0x6a89('0x1a'),_0x5b57bb[_0x6a89('0x5')],_0x5b57bb[_0x6a89('0x14')],_0x5b57bb[_0x6a89('0x15')]));}else if(!_[_0x6a89('0x19')](recordings[_0x5b57bb[_0x6a89('0x11')]])&&_0x5b57bb[_0x6a89('0x1b')]==0x6&&_0x5b57bb[_0x6a89('0x14')]!='transfer'){utils[_0x6a89('0x3')](util[_0x6a89('0xf')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x5b57bb[_0x6a89('0x5')],_0x5b57bb['linkedid'],_0x5b57bb['context'],_0x5b57bb[_0x6a89('0x15')]));recordings[_0x5b57bb[_0x6a89('0x11')]][_0x6a89('0x6')]=_0x5b57bb[_0x6a89('0x6')];}}catch(_0x12cc57){utils['error'](util[_0x6a89('0xf')](_0x6a89('0x18'),_0x5b57bb[_0x6a89('0x5')]),_0x12cc57);}};exports[_0x6a89('0x1c')]=function(_0xe578fc){try{if(!_[_0x6a89('0x19')](_0xe578fc[_0x6a89('0x1d')])&&!_[_0x6a89('0x19')](_0xe578fc[_0x6a89('0x1d')]['mixmonitor_filename'])){utils[_0x6a89('0xe')](util['format']('[%s][recordings][varset]',_0xe578fc[_0x6a89('0x5')]),_0xe578fc);utils[_0x6a89('0x3')](util[_0x6a89('0xf')](_0x6a89('0x1e'),_0xe578fc[_0x6a89('0x5')],_0xe578fc[_0x6a89('0x1d')],_0xe578fc[_0x6a89('0x1f')]));if(_[_0x6a89('0x20')](_0xe578fc[_0x6a89('0x1f')],_0x6a89('0x21'))){_0xe578fc[_0x6a89('0x1f')]=_0xe578fc[_0x6a89('0x1f')][_0x6a89('0x22')](_0x6a89('0x21'),_0x6a89('0x23'));}if(recordings[_0xe578fc[_0x6a89('0x11')]]){var _0x11535d=_[_0x6a89('0x24')](recordings[_0xe578fc[_0x6a89('0x11')]][_0x6a89('0x25')],{'value':_0xe578fc['value']});if(_[_0x6a89('0x19')](_0x11535d)){recordings[_0xe578fc[_0x6a89('0x11')]][_0x6a89('0x25')]['push']({'value':_0xe578fc[_0x6a89('0x1f')]});}}}}catch(_0x4bf3c6){utils[_0x6a89('0x16')](util['format'](_0x6a89('0x26'),_0xe578fc[_0x6a89('0x5')]),_0x4bf3c6);}};exports[_0x6a89('0x27')]=function(_0x534965){try{if(!_[_0x6a89('0x19')](recordings[_0x534965[_0x6a89('0x5')]])){utils[_0x6a89('0xe')](util['format'](_0x6a89('0x28'),_0x534965[_0x6a89('0x5')]),_0x534965);utils[_0x6a89('0x3')](util['format'](_0x6a89('0x29'),_0x534965[_0x6a89('0x5')],_0x534965[_0x6a89('0x2a')],_0x534965['calleridname'],_0x534965[_0x6a89('0x2b')]));recordings[_0x534965['uniqueid']]['calleridnum']=_0x534965[_0x6a89('0x2a')];recordings[_0x534965[_0x6a89('0x5')]]['calleridname']=_0x534965[_0x6a89('0x2c')];recordings[_0x534965[_0x6a89('0x5')]][_0x6a89('0x2d')]=_0x534965[_0x6a89('0x2d')];recordings[_0x534965[_0x6a89('0x5')]][_0x6a89('0x2e')]=_0x534965[_0x6a89('0x2e')];if(recordings[_0x534965[_0x6a89('0x5')]][_0x6a89('0x2f')]==_0x6a89('0x30')&&recordings[_0x534965['uniqueid']][_0x6a89('0x6')]){recordings[_0x534965[_0x6a89('0x5')]]['connectedlinenum']=recordings[_0x534965[_0x6a89('0x5')]]['accountcode'];recordings[_0x534965[_0x6a89('0x5')]][_0x6a89('0x2e')]='';}recordings[_0x534965[_0x6a89('0x5')]][_0x6a89('0x25')][_0x6a89('0x31')](function(_0x4b398a){var _0x318cee=_[_0x6a89('0x32')](recordings[_0x534965[_0x6a89('0x5')]]);_0x318cee[_0x6a89('0x1f')]=_0x4b398a[_0x6a89('0x1f')];writeDB(_0x318cee);});delete recordings[_0x534965[_0x6a89('0x5')]];}}catch(_0xdea37b){utils[_0x6a89('0x16')](util['format'](_0x6a89('0x28'),_0x534965[_0x6a89('0x5')]),_0xdea37b);}};exports[_0x6a89('0x33')]=function(_0x45dafe){try{if(!_['isNil'](recordings[_0x45dafe['uniqueid']])){utils[_0x6a89('0xe')](util['format'](_0x6a89('0x34'),_0x45dafe[_0x6a89('0x5')]),_0x45dafe);utils[_0x6a89('0x3')](util[_0x6a89('0xf')](_0x6a89('0x35'),_0x45dafe[_0x6a89('0x5')],_0x45dafe['application'],_0x45dafe[_0x6a89('0x36')]));if(_0x45dafe[_0x6a89('0x37')][_0x6a89('0x38')]()=='set'&&_[_0x6a89('0x39')](_0x45dafe['appdata']['toLowerCase'](),'cdr')){var _0x5ee35d=_0x45dafe[_0x6a89('0x36')][_0x6a89('0x3a')]('=');var _0x338208=_0x5ee35d[0x0]['substring'](_0x5ee35d[0x0][_0x6a89('0x3b')]('(')+0x1,_0x5ee35d[0x0][_0x6a89('0x3b')](')'));var _0x3cd16b=_0x5ee35d[0x1];recordings[_0x45dafe[_0x6a89('0x5')]][_0x338208]=_0x3cd16b;}}}catch(_0x3cb69f){utils[_0x6a89('0x16')](util[_0x6a89('0xf')](_0x6a89('0x34'),_0x45dafe['uniqueid']),_0x3cb69f);}};exports[_0x6a89('0x3c')]=function(_0xd32dfc){try{if(!_['isNil'](recordings[_0xd32dfc[_0x6a89('0x5')]])){utils['debug'](util['format'](_0x6a89('0x3d'),_0xd32dfc['uniqueid']),_0xd32dfc);utils['info'](util[_0x6a89('0xf')](_0x6a89('0x3e'),_0xd32dfc[_0x6a89('0x5')],_0xd32dfc['queue']));recordings[_0xd32dfc['uniqueid']]['queue']=_0xd32dfc[_0x6a89('0x3f')];}}catch(_0x3b59cb){utils[_0x6a89('0x16')](util[_0x6a89('0xf')](_0x6a89('0x3d'),_0xd32dfc['uniqueid']),_0x3b59cb);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 2f12cee..1f85847 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 _0x9b64=['secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','origtransferercalleridname'];(function(_0x58efa6,_0x2c00bd){var _0x5d643c=function(_0x1d1ef2){while(--_0x1d1ef2){_0x58efa6['push'](_0x58efa6['shift']());}};_0x5d643c(++_0x2c00bd);}(_0x9b64,0x10c));var _0x49b6=function(_0x4cea31,_0x54ef05){_0x4cea31=_0x4cea31-0x0;var _0x30bf16=_0x9b64[_0x4cea31];return _0x30bf16;};'use strict';var _=require(_0x49b6('0x0'));var util=require(_0x49b6('0x1'));var utils=require(_0x49b6('0x2'));function writeDB(_0x900a53){utils[_0x49b6('0x3')](util[_0x49b6('0x4')](_0x49b6('0x5'),_0x900a53[_0x49b6('0x6')]==='attended'?_0x900a53[_0x49b6('0x7')]:_0x900a53['uniqueid'],_0x900a53[_0x49b6('0x6')]));utils['request'](_0x49b6('0x8'),_0x900a53);}exports[_0x49b6('0x9')]=function(_0x47027c){try{utils[_0x49b6('0xa')](util[_0x49b6('0x4')](_0x49b6('0xb'),_0x47027c[_0x49b6('0xc')]),_0x47027c);utils[_0x49b6('0x3')](util[_0x49b6('0x4')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x47027c[_0x49b6('0xc')],_0x47027c[_0x49b6('0xd')],_0x47027c['transferercalleridname'],_0x47027c[_0x49b6('0xe')],_0x47027c[_0x49b6('0xf')]));_0x47027c[_0x49b6('0x6')]=_0x49b6('0x10');writeDB(_0x47027c);}catch(_0x7dbf79){utils[_0x49b6('0x11')](util[_0x49b6('0x4')](_0x49b6('0xb'),_0x47027c[_0x49b6('0xc')]),_0x7dbf79);}};exports[_0x49b6('0x12')]=function(_0x54dfcb){try{utils[_0x49b6('0xa')](util[_0x49b6('0x4')](_0x49b6('0x13'),_0x54dfcb[_0x49b6('0x7')]),_0x54dfcb);utils[_0x49b6('0x3')](util['format'](_0x49b6('0x14'),_0x54dfcb[_0x49b6('0x7')],_0x54dfcb[_0x49b6('0x15')],_0x54dfcb['origtransferercalleridname'],_0x54dfcb[_0x49b6('0x16')],_0x54dfcb[_0x49b6('0x17')]));_0x54dfcb=_['assign'](_0x54dfcb,{'transfererchannel':_0x54dfcb[_0x49b6('0x18')],'transferercalleridnum':_0x54dfcb[_0x49b6('0x15')],'transferercalleridname':_0x54dfcb[_0x49b6('0x19')],'transfererconnectedlinenum':_0x54dfcb[_0x49b6('0x1a')],'transfererconnectedlinename':_0x54dfcb[_0x49b6('0x1b')],'transfereraccountcode':_0x54dfcb[_0x49b6('0x1c')],'transferercontext':_0x54dfcb['secondtransferercontext'],'transfererexten':_0x54dfcb['secondtransfererexten'],'transfererlinkedid':_0x54dfcb[_0x49b6('0x1d')],'context':_0x54dfcb[_0x49b6('0x1e')],'extension':_0x54dfcb[_0x49b6('0x1f')],'type':_0x49b6('0x20')});if(_[_0x49b6('0x21')](_0x54dfcb[_0x49b6('0x22')])){_0x54dfcb=_[_0x49b6('0x23')](_0x54dfcb,{'transfereechannel':_0x54dfcb[_0x49b6('0x24')],'transfereecalleridnum':_0x54dfcb[_0x49b6('0x16')],'transfereecalleridname':_0x54dfcb[_0x49b6('0x17')],'transfereeconnectedlinenum':_0x54dfcb[_0x49b6('0x25')],'transfereeconnectedlinename':_0x54dfcb[_0x49b6('0x26')],'transfereeaccountcode':_0x54dfcb[_0x49b6('0x27')],'transfereecontext':_0x54dfcb['transfertargetcontext'],'transfereeexten':_0x54dfcb[_0x49b6('0x28')],'transfereelinkedid':_0x54dfcb[_0x49b6('0x29')]});}writeDB(_0x54dfcb);}catch(_0x36fc0e){utils[_0x49b6('0x11')](util['format']('[%s][transfers][attendedtransfer]',_0x54dfcb[_0x49b6('0x7')]),_0x36fc0e);}}; \ No newline at end of file +var _0x9f37=['attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','error','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','attended','uniqueid','type','request','blindtransfer','debug','format','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','[%s][transfers][blindtransfer]'];(function(_0x2083fe,_0x12799f){var _0x33d6cd=function(_0x347c21){while(--_0x347c21){_0x2083fe['push'](_0x2083fe['shift']());}};_0x33d6cd(++_0x12799f);}(_0x9f37,0xb6));var _0x79f3=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x9f37[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0x79f3('0x0'));var util=require(_0x79f3('0x1'));var utils=require(_0x79f3('0x2'));function writeDB(_0x5f3d87){utils[_0x79f3('0x3')](util['format'](_0x79f3('0x4'),_0x5f3d87['type']===_0x79f3('0x5')?_0x5f3d87['origtransfereruniqueid']:_0x5f3d87[_0x79f3('0x6')],_0x5f3d87[_0x79f3('0x7')]));utils[_0x79f3('0x8')]('CreateVoiceTransferReport',_0x5f3d87);}exports[_0x79f3('0x9')]=function(_0xdc75b3){try{utils[_0x79f3('0xa')](util[_0x79f3('0xb')]('[%s][transfers][blindtransfer]',_0xdc75b3[_0x79f3('0x6')]),_0xdc75b3);utils[_0x79f3('0x3')](util[_0x79f3('0xb')](_0x79f3('0xc'),_0xdc75b3[_0x79f3('0x6')],_0xdc75b3[_0x79f3('0xd')],_0xdc75b3[_0x79f3('0xe')],_0xdc75b3[_0x79f3('0xf')],_0xdc75b3[_0x79f3('0x10')]));_0xdc75b3['type']='blind';writeDB(_0xdc75b3);}catch(_0x356383){utils['error'](util[_0x79f3('0xb')](_0x79f3('0x11'),_0xdc75b3[_0x79f3('0x6')]),_0x356383);}};exports[_0x79f3('0x12')]=function(_0x130eac){try{utils[_0x79f3('0xa')](util[_0x79f3('0xb')](_0x79f3('0x13'),_0x130eac[_0x79f3('0x14')]),_0x130eac);utils[_0x79f3('0x3')](util[_0x79f3('0xb')](_0x79f3('0x15'),_0x130eac[_0x79f3('0x14')],_0x130eac[_0x79f3('0x16')],_0x130eac[_0x79f3('0x17')],_0x130eac['transfertargetcalleridnum'],_0x130eac[_0x79f3('0x18')]));_0x130eac=_[_0x79f3('0x19')](_0x130eac,{'transfererchannel':_0x130eac[_0x79f3('0x1a')],'transferercalleridnum':_0x130eac[_0x79f3('0x16')],'transferercalleridname':_0x130eac[_0x79f3('0x17')],'transfererconnectedlinenum':_0x130eac[_0x79f3('0x1b')],'transfererconnectedlinename':_0x130eac['secondtransfererconnectedlinename'],'transfereraccountcode':_0x130eac[_0x79f3('0x1c')],'transferercontext':_0x130eac['secondtransferercontext'],'transfererexten':_0x130eac[_0x79f3('0x1d')],'transfererlinkedid':_0x130eac['origtransfererlinkedid'],'context':_0x130eac[_0x79f3('0x1e')],'extension':_0x130eac[_0x79f3('0x1f')],'type':_0x79f3('0x5')});if(_[_0x79f3('0x20')](_0x130eac[_0x79f3('0x21')])){_0x130eac=_[_0x79f3('0x19')](_0x130eac,{'transfereechannel':_0x130eac['transfertargetchannel'],'transfereecalleridnum':_0x130eac['transfertargetcalleridnum'],'transfereecalleridname':_0x130eac['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x130eac[_0x79f3('0x22')],'transfereeconnectedlinename':_0x130eac[_0x79f3('0x23')],'transfereeaccountcode':_0x130eac[_0x79f3('0x24')],'transfereecontext':_0x130eac[_0x79f3('0x25')],'transfereeexten':_0x130eac[_0x79f3('0x26')],'transfereelinkedid':_0x130eac['transfertargetlinkedid']});}writeDB(_0x130eac);}catch(_0xb62792){utils[_0x79f3('0x27')](util[_0x79f3('0xb')]('[%s][transfers][attendedtransfer]',_0x130eac[_0x79f3('0x14')]),_0xb62792);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 87587fa..4b0c40d 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 _0xff85=['addTime','add','seconds','format','subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss','diff','sumTime','now','isAfter','isBefore','moment','util','http','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','catch','[utils][getUserByInternal]','getUserByName','[utils][getUserByName]','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s'];(function(_0x12553d,_0x160725){var _0x166267=function(_0x49f7ae){while(--_0x49f7ae){_0x12553d['push'](_0x12553d['shift']());}};_0x166267(++_0x160725);}(_0xff85,0x1da));var _0x5ff8=function(_0x3ba48e,_0x3ba43b){_0x3ba48e=_0x3ba48e-0x0;var _0x993fcf=_0xff85[_0x3ba48e];return _0x993fcf;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var moment=require(_0x5ff8('0x0'));var util=require(_0x5ff8('0x1'));var client=jayson['client'][_0x5ff8('0x2')]({'port':0x2329});var logger=require('../../config/logger')(_0x5ff8('0x3'));exports[_0x5ff8('0x4')]=function(_0x355171,_0x3dfb01){logger[_0x5ff8('0x4')](_0x355171,_0x3dfb01?util[_0x5ff8('0x5')](_0x3dfb01,{'showHidden':![],'depth':null}):'');};exports[_0x5ff8('0x6')]=function(_0x5abc4e,_0x21543d){logger[_0x5ff8('0x6')](_0x5abc4e,_0x21543d?util[_0x5ff8('0x5')](_0x21543d,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0xd06160,_0x3a01a4){logger[_0x5ff8('0x7')](_0xd06160,_0x3a01a4?util[_0x5ff8('0x5')](_0x3a01a4,{'showHidden':![],'depth':null}):'');};exports[_0x5ff8('0x8')]=function(_0xa7292b,_0x44136e){return client[_0x5ff8('0x8')](_0xa7292b,{'body':_0x44136e})[_0x5ff8('0x9')](function(_0x56090d){logger['debug']('[utils][request]\x20name:%s',_0xa7292b,_0x56090d?util['inspect'](_0x56090d,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x5e0b63){logger['error'](_0x5ff8('0xa'),_0xa7292b,_0x5e0b63?util[_0x5ff8('0x5')](_0x5e0b63,{'showHidden':![],'depth':null}):'');});};function getUser(_0x5c0989){return client[_0x5ff8('0x8')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x5ff8('0xb'),_0x5ff8('0xc'),_0x5ff8('0xd')],'where':_0x5c0989,'limit':0x1}})[_0x5ff8('0x9')](function(_0x559531){logger[_0x5ff8('0x6')](_0x5ff8('0xe'),JSON[_0x5ff8('0xf')](_0x5c0989),_0x559531?util[_0x5ff8('0x5')](_0x559531,{'showHidden':![],'depth':null}):'');return _0x559531['result'][_0x5ff8('0x10')]?_0x559531[_0x5ff8('0x11')][0x0]:null;});}exports[_0x5ff8('0x12')]=function(_0x241514){return new BPromise(function(_0x30f00f,_0x6d495f){if(_0x241514){return getUser({'internal':_0x241514})[_0x5ff8('0x9')](function(_0x19ba23){logger['info'](_0x5ff8('0x13'),_0x241514,_0x19ba23?_0x5ff8('0x14'):_0x5ff8('0x15'));return _0x30f00f(_0x19ba23);})[_0x5ff8('0x16')](function(_0x23caed){logger[_0x5ff8('0x7')](_0x5ff8('0x17'),_0x23caed?util[_0x5ff8('0x5')](_0x23caed,{'showHidden':![],'depth':null}):'');return _0x30f00f(null);});}return _0x30f00f(null);});};exports['getUserByInterface']=function(_0x580070){return new BPromise(function(_0x22d25f,_0x17917e){if(_0x580070){return getUser({'interface':_0x580070})[_0x5ff8('0x9')](function(_0xaba1f3){logger[_0x5ff8('0x4')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x580070,_0xaba1f3?_0x5ff8('0x14'):'notfound');return _0x22d25f(_0xaba1f3);})['catch'](function(_0x42f59a){logger['error']('[utils][getUserByInterface]',_0x42f59a?util['inspect'](_0x42f59a,{'showHidden':![],'depth':null}):'');return _0x22d25f(null);});}return _0x22d25f(null);});};exports[_0x5ff8('0x18')]=function(_0x46ca2c){return new BPromise(function(_0x508bf5,_0xc362f){if(_0x46ca2c){return getUser({'name':_0x46ca2c})[_0x5ff8('0x9')](function(_0x1ee2a8){logger[_0x5ff8('0x4')]('[utils][getUserByName]\x20name:%s\x20%s',_0x46ca2c,_0x1ee2a8?_0x5ff8('0x14'):'notfound');return _0x508bf5(_0x1ee2a8);})[_0x5ff8('0x16')](function(_0x4d97fd){logger[_0x5ff8('0x7')](_0x5ff8('0x19'),_0x4d97fd?util['inspect'](_0x4d97fd,{'showHidden':![],'depth':null}):'');return _0x508bf5(null);});}return _0x508bf5(null);});};exports['getVoiceQueueByName']=function(_0x276509){return new BPromise(function(_0x4e7638,_0x4fcf2f){if(_0x276509){return client[_0x5ff8('0x8')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x5ff8('0xc'),_0x5ff8('0x1a'),_0x5ff8('0x1b'),_0x5ff8('0x1c')],'where':{'name':_0x276509},'limit':0x1}})['then'](function(_0x16adf1){logger[_0x5ff8('0x6')](_0x5ff8('0x1d'),_0x276509,_0x16adf1?util[_0x5ff8('0x5')](_0x16adf1,{'showHidden':![],'depth':null}):'');logger['info']('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x276509,_0x16adf1?_0x5ff8('0x14'):_0x5ff8('0x15'));return _0x4e7638(_0x16adf1[_0x5ff8('0x11')][_0x5ff8('0x10')]?_0x16adf1['result'][0x0]:null);})[_0x5ff8('0x16')](function(_0x2d02d0){logger[_0x5ff8('0x7')]('[utils][getVoiceQueueByName]',_0x2d02d0?util[_0x5ff8('0x5')](_0x2d02d0,{'showHidden':![],'depth':null}):'');return _0x4e7638(null);});}return _0x4e7638(null);});};exports[_0x5ff8('0x1e')]=function(_0x5e7eab,_0x327467){return moment(_0x5e7eab)[_0x5ff8('0x1f')](_0x327467,_0x5ff8('0x20'))[_0x5ff8('0x21')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x5ff8('0x22')]=function(_0x501791,_0x29db44){return moment(_0x501791)[_0x5ff8('0x23')](_0x29db44,_0x5ff8('0x20'))['format'](_0x5ff8('0x24'));};exports['diffTime']=function(_0x3fb66a,_0x2a3a35){return moment(_0x3fb66a)[_0x5ff8('0x25')](moment(_0x2a3a35),_0x5ff8('0x20'));};exports[_0x5ff8('0x26')]=function(_0x14869c,_0x2214cb){return parseInt(_0x14869c,0xa)+parseInt(_0x2214cb,0xa);};exports[_0x5ff8('0x27')]=function(){return moment()[_0x5ff8('0x21')](_0x5ff8('0x24'));};exports[_0x5ff8('0x28')]=function(_0x56a32e,_0x4432d1){if(_0x4432d1){return moment(_0x56a32e)[_0x5ff8('0x28')](_0x4432d1);}return!![];};exports[_0x5ff8('0x29')]=function(_0x274d10,_0x19f920){if(_0x19f920){return moment(_0x274d10)[_0x5ff8('0x29')](_0x19f920);}else if(_0x274d10){return!![];}return![];}; \ No newline at end of file +var _0x8745=['getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','diff','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','info','inspect','debug','then','catch','request','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','error','[utils][getUserByInternal]'];(function(_0x1227c6,_0x237bb9){var _0x4a509b=function(_0x4e8d1d){while(--_0x4e8d1d){_0x1227c6['push'](_0x1227c6['shift']());}};_0x4a509b(++_0x237bb9);}(_0x8745,0x136));var _0x5874=function(_0x3efa93,_0x3ef95c){_0x3efa93=_0x3efa93-0x0;var _0x1fd888=_0x8745[_0x3efa93];return _0x1fd888;};'use strict';var BPromise=require(_0x5874('0x0'));var jayson=require(_0x5874('0x1'));var moment=require(_0x5874('0x2'));var util=require(_0x5874('0x3'));var client=jayson[_0x5874('0x4')][_0x5874('0x5')]({'port':0x2329});var logger=require(_0x5874('0x6'))('xdr');exports[_0x5874('0x7')]=function(_0x512c3c,_0x4be14b){logger['info'](_0x512c3c,_0x4be14b?util[_0x5874('0x8')](_0x4be14b,{'showHidden':![],'depth':null}):'');};exports[_0x5874('0x9')]=function(_0x4fbe6b,_0x24929c){logger['debug'](_0x4fbe6b,_0x24929c?util[_0x5874('0x8')](_0x24929c,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x363f27,_0x4d5204){logger['error'](_0x363f27,_0x4d5204?util[_0x5874('0x8')](_0x4d5204,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x5e117d,_0x5628d5){return client['request'](_0x5e117d,{'body':_0x5628d5})[_0x5874('0xa')](function(_0x267747){logger[_0x5874('0x9')]('[utils][request]\x20name:%s',_0x5e117d,_0x267747?util[_0x5874('0x8')](_0x267747,{'showHidden':![],'depth':null}):'');})[_0x5874('0xb')](function(_0xbb52cc){logger['error']('[utils][request]\x20name:%s',_0x5e117d,_0xbb52cc?util['inspect'](_0xbb52cc,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4e97ca){return client[_0x5874('0xc')](_0x5874('0xd'),{'options':{'raw':!![],'attributes':['id',_0x5874('0xe'),_0x5874('0xf'),_0x5874('0x10')],'where':_0x4e97ca,'limit':0x1}})[_0x5874('0xa')](function(_0x82b70f){logger['debug'](_0x5874('0x11'),JSON[_0x5874('0x12')](_0x4e97ca),_0x82b70f?util[_0x5874('0x8')](_0x82b70f,{'showHidden':![],'depth':null}):'');return _0x82b70f[_0x5874('0x13')][_0x5874('0x14')]?_0x82b70f['result'][0x0]:null;});}exports['getUserByInternal']=function(_0x3d0465){return new BPromise(function(_0x1c597d,_0x80dd57){if(_0x3d0465){return getUser({'internal':_0x3d0465})[_0x5874('0xa')](function(_0xf921ca){logger[_0x5874('0x7')](_0x5874('0x15'),_0x3d0465,_0xf921ca?_0x5874('0x16'):_0x5874('0x17'));return _0x1c597d(_0xf921ca);})[_0x5874('0xb')](function(_0x2d0fa9){logger[_0x5874('0x18')](_0x5874('0x19'),_0x2d0fa9?util['inspect'](_0x2d0fa9,{'showHidden':![],'depth':null}):'');return _0x1c597d(null);});}return _0x1c597d(null);});};exports[_0x5874('0x1a')]=function(_0x2c6858){return new BPromise(function(_0x16188f,_0x12bab8){if(_0x2c6858){return getUser({'interface':_0x2c6858})[_0x5874('0xa')](function(_0x2e7df8){logger['info'](_0x5874('0x1b'),_0x2c6858,_0x2e7df8?_0x5874('0x16'):'notfound');return _0x16188f(_0x2e7df8);})[_0x5874('0xb')](function(_0x5f25f6){logger[_0x5874('0x18')](_0x5874('0x1c'),_0x5f25f6?util[_0x5874('0x8')](_0x5f25f6,{'showHidden':![],'depth':null}):'');return _0x16188f(null);});}return _0x16188f(null);});};exports[_0x5874('0x1d')]=function(_0x9d4369){return new BPromise(function(_0x57f3cf,_0x3cdbd2){if(_0x9d4369){return getUser({'name':_0x9d4369})[_0x5874('0xa')](function(_0x263b71){logger[_0x5874('0x7')](_0x5874('0x1e'),_0x9d4369,_0x263b71?_0x5874('0x16'):_0x5874('0x17'));return _0x57f3cf(_0x263b71);})[_0x5874('0xb')](function(_0x336cba){logger[_0x5874('0x18')](_0x5874('0x1f'),_0x336cba?util['inspect'](_0x336cba,{'showHidden':![],'depth':null}):'');return _0x57f3cf(null);});}return _0x57f3cf(null);});};exports[_0x5874('0x20')]=function(_0x3fb8f6){return new BPromise(function(_0x5ea132,_0x3d64c8){if(_0x3fb8f6){return client[_0x5874('0xc')](_0x5874('0x21'),{'options':{'raw':!![],'attributes':['id',_0x5874('0xf'),_0x5874('0x22'),'acw',_0x5874('0x23')],'where':{'name':_0x3fb8f6},'limit':0x1}})[_0x5874('0xa')](function(_0xa5a488){logger[_0x5874('0x9')]('[utils][getVoiceQueueByName]\x20name:%s',_0x3fb8f6,_0xa5a488?util[_0x5874('0x8')](_0xa5a488,{'showHidden':![],'depth':null}):'');logger[_0x5874('0x7')](_0x5874('0x24'),_0x3fb8f6,_0xa5a488?_0x5874('0x16'):_0x5874('0x17'));return _0x5ea132(_0xa5a488[_0x5874('0x13')][_0x5874('0x14')]?_0xa5a488[_0x5874('0x13')][0x0]:null);})[_0x5874('0xb')](function(_0xa3a9f2){logger[_0x5874('0x18')]('[utils][getVoiceQueueByName]',_0xa3a9f2?util[_0x5874('0x8')](_0xa3a9f2,{'showHidden':![],'depth':null}):'');return _0x5ea132(null);});}return _0x5ea132(null);});};exports[_0x5874('0x25')]=function(_0x2c78b7,_0x2d5848){return moment(_0x2c78b7)[_0x5874('0x26')](_0x2d5848,'seconds')[_0x5874('0x27')](_0x5874('0x28'));};exports[_0x5874('0x29')]=function(_0x4ea893,_0x305626){return moment(_0x4ea893)[_0x5874('0x2a')](_0x305626,_0x5874('0x2b'))[_0x5874('0x27')](_0x5874('0x28'));};exports['diffTime']=function(_0x2d8a22,_0x50566c){return moment(_0x2d8a22)[_0x5874('0x2c')](moment(_0x50566c),_0x5874('0x2b'));};exports['sumTime']=function(_0x494057,_0x24ca9b){return parseInt(_0x494057,0xa)+parseInt(_0x24ca9b,0xa);};exports[_0x5874('0x2d')]=function(){return moment()['format'](_0x5874('0x28'));};exports['isAfter']=function(_0x561f4a,_0x32088d){if(_0x32088d){return moment(_0x561f4a)[_0x5874('0x2e')](_0x32088d);}return!![];};exports['isBefore']=function(_0x316790,_0x7c58cd){if(_0x7c58cd){return moment(_0x316790)[_0x5874('0x2f')](_0x7c58cd);}else if(_0x316790){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 d9a2e7b..605462d 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 _0xbdbd=['lodash','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','log','xcally','client','role','name','then','catch','user','no-user','data','error','api','set','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other','agent_name','setupLoggers','fs-extra'];(function(_0x7196fe,_0x563248){var _0x24f66d=function(_0x56c47c){while(--_0x56c47c){_0x7196fe['push'](_0x7196fe['shift']());}};_0x24f66d(++_0x563248);}(_0xbdbd,0xb3));var _0xdbdb=function(_0x2f5022,_0x5ba251){_0x2f5022=_0x2f5022-0x0;var _0xcdf166=_0xbdbd[_0x2f5022];return _0xcdf166;};var fs=require(_0xdbdb('0x0'));var _=require(_0xdbdb('0x1'));var ewinston=require('express-winston');var path=require(_0xdbdb('0x2'));var util=require(_0xdbdb('0x3'));var fileLogger=require(_0xdbdb('0x4'))[_0xdbdb('0x5')];var safeTemplate=require(_0xdbdb('0x6'))[_0xdbdb('0x7')];var maskSensitiveData=require(_0xdbdb('0x8'))[_0xdbdb('0x9')];function ClientSideLogger(){function _0x30213d(_0x138278){var _0x14f729=path[_0xdbdb('0xa')]('/var',_0xdbdb('0xb'),_0xdbdb('0xc'));var _0x58b2cc=path[_0xdbdb('0xa')](_0xdbdb('0xd'),_0x138278[_0xdbdb('0xe')]+'-'+_0x138278[_0xdbdb('0xf')]);return fs['ensureDir'](path['join'](_0x14f729,_0x58b2cc))[_0xdbdb('0x10')](function(){var _0x352fcf=fileLogger(_0xdbdb('0xd'),path[_0xdbdb('0xa')](_0x14f729,_0x58b2cc));return _0x352fcf;})[_0xdbdb('0x11')](function(_0x5d6790){throw _0x5d6790;});}this[_0xdbdb('0xb')]=function(_0x37d7,_0x116eb7,_0x49d188,_0x59927c){return _0x30213d(_0x37d7['user'])[_0xdbdb('0x10')](function(_0x13b32a){var _0x2d6e96=_0x13b32a[_0x116eb7];return _0x2d6e96;})[_0xdbdb('0x10')](function(_0x210e7f){var _0x59a8ac=_0x37d7[_0xdbdb('0x12')]?_0x37d7['user']['id']:_0xdbdb('0x13');var _0x1e70c0=_0x59927c[_0xdbdb('0x14')];var _0x4a4b39=_0x59927c['timestamp'];var _0x396f43=new Date(Number(_0x4a4b39));return _0x210e7f(_0x59a8ac,_0x396f43,_0x49d188,_0x1e70c0);})[_0xdbdb('0x11')](function(_0x4ea806){fileLogger(_0xdbdb('0xd'))[_0xdbdb('0x15')](_0x4ea806);});};}function setupLoggers(_0x33447f){return new Promise(function(_0x3e7636){var _0x13bdcb=new ClientSideLogger();var _0x53a7bf=fileLogger(_0xdbdb('0x16'));var _0x43114e=fileLogger('auth');_0x33447f[_0xdbdb('0x17')]('client-side-logger',_0x13bdcb);_0x33447f[_0xdbdb('0x18')](ewinston[_0xdbdb('0x19')]({'winstonInstance':_0x53a7bf,'meta':![],'statusLevels':!![],'msg':function(_0x33c1ce,_0x597afb){var _0x1c7cdd=_0xdbdb('0x1a');if(!_['isEmpty'](_0x33c1ce[_0xdbdb('0x1b')])){_0x1c7cdd+=_0xdbdb('0x1c');var _0x42d2e1=_0x33c1ce[_0xdbdb('0x1b')];maskSensitiveData(_0x42d2e1);}return safeTemplate(util[_0xdbdb('0x1d')](_0x1c7cdd,_0x33c1ce[_0xdbdb('0x1e')],_0x33c1ce[_0xdbdb('0x1f')][_0xdbdb('0x20')]?_0x33c1ce[_0xdbdb('0x1f')][_0xdbdb('0x20')]:_0x33c1ce[_0xdbdb('0x21')][_0xdbdb('0x22')]||_0x33c1ce['ip'],_0x33c1ce[_0xdbdb('0x23')],_0x597afb[_0xdbdb('0x24')],_0x597afb[_0xdbdb('0x25')],_0x33c1ce[_0xdbdb('0x12')]?_0x33c1ce['user']['id']:null,_0x33c1ce[_0xdbdb('0x12')]?_0x33c1ce['user']['name']:null,_0x33c1ce[_0xdbdb('0x12')]?_0x33c1ce['user'][_0xdbdb('0xe')]:null,_0x42d2e1?util['inspect'](_0x42d2e1,![],null):''));}}));_0x33447f[_0xdbdb('0x18')](ewinston[_0xdbdb('0x19')]({'winstonInstance':_0x43114e,'meta':![],'statusLevels':!![],'msg':function(_0x40e6ec,_0x3b7b53){var _0x4a3ecc=_0xdbdb('0x26');if(_0x40e6ec[_0xdbdb('0x1b')]&&_0x40e6ec[_0xdbdb('0x1b')][_0xdbdb('0x27')]&&_0x40e6ec[_0xdbdb('0x1b')][_0xdbdb('0x28')]){_0x4a3ecc=_0xdbdb('0x29');}return util[_0xdbdb('0x1d')](_0x4a3ecc,_0x40e6ec['method'],_0x40e6ec[_0xdbdb('0x1f')]['x-forwarded-for']?_0x40e6ec[_0xdbdb('0x1f')][_0xdbdb('0x20')]:_0x40e6ec[_0xdbdb('0x21')][_0xdbdb('0x22')]||_0x40e6ec['ip'],_0x40e6ec[_0xdbdb('0x23')],_0x3b7b53[_0xdbdb('0x24')],_0x3b7b53[_0xdbdb('0x25')],_0x40e6ec['user']?_0x40e6ec[_0xdbdb('0x12')]['id']:null,_0x40e6ec[_0xdbdb('0x12')]?_0x40e6ec[_0xdbdb('0x12')][_0xdbdb('0xf')]:null,_0x40e6ec['user']?_0x40e6ec[_0xdbdb('0x12')][_0xdbdb('0xe')]:null,_0x40e6ec[_0xdbdb('0x1b')]&&_0x40e6ec[_0xdbdb('0x1b')][_0xdbdb('0x27')]?_0x40e6ec['body'][_0xdbdb('0x27')]:_0xdbdb('0x2a'),_0x40e6ec[_0xdbdb('0x1b')]&&_0x40e6ec['body'][_0xdbdb('0x28')]?_0x40e6ec[_0xdbdb('0x1b')][_0xdbdb('0x28')]:'',_0x40e6ec[_0xdbdb('0x1b')]&&_0x40e6ec[_0xdbdb('0x1b')]['agent_name']?_0x40e6ec[_0xdbdb('0x1b')][_0xdbdb('0x2b')]:'');},'ignoreRoute':function(_0x3856dc){var _0x3b74db=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3b74db['test'](_0x3856dc[_0xdbdb('0x23')]);}}));return _0x3e7636();});}exports[_0xdbdb('0x2c')]=setupLoggers; \ No newline at end of file +var _0xeff4=['device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','util','./loggers','fileLogger','./safe-template','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','role','ensureDir','then','user','no-user','data','timestamp','error','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','name','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeff4,0x1b6));var _0x4eff=function(_0x485f35,_0x45a0fc){_0x485f35=_0x485f35-0x0;var _0x2ad118=_0xeff4[_0x485f35];return _0x2ad118;};var fs=require(_0x4eff('0x0'));var _=require(_0x4eff('0x1'));var ewinston=require(_0x4eff('0x2'));var path=require('path');var util=require(_0x4eff('0x3'));var fileLogger=require(_0x4eff('0x4'))[_0x4eff('0x5')];var safeTemplate=require(_0x4eff('0x6'))['safeTemplate'];var maskSensitiveData=require(_0x4eff('0x7'))[_0x4eff('0x8')];function ClientSideLogger(){function _0x4d4bba(_0xe3307c){var _0x1fb002=path[_0x4eff('0x9')](_0x4eff('0xa'),_0x4eff('0xb'),_0x4eff('0xc'));var _0x3ff9a3=path[_0x4eff('0x9')](_0x4eff('0xd'),_0xe3307c[_0x4eff('0xe')]+'-'+_0xe3307c['name']);return fs[_0x4eff('0xf')](path[_0x4eff('0x9')](_0x1fb002,_0x3ff9a3))[_0x4eff('0x10')](function(){var _0x36b006=fileLogger(_0x4eff('0xd'),path[_0x4eff('0x9')](_0x1fb002,_0x3ff9a3));return _0x36b006;})['catch'](function(_0x591b30){throw _0x591b30;});}this['log']=function(_0x1f1118,_0x1778c1,_0x3d6143,_0x12e266){return _0x4d4bba(_0x1f1118[_0x4eff('0x11')])['then'](function(_0x3de464){var _0x54b463=_0x3de464[_0x1778c1];return _0x54b463;})[_0x4eff('0x10')](function(_0x40ccf2){var _0x4088df=_0x1f1118['user']?_0x1f1118[_0x4eff('0x11')]['id']:_0x4eff('0x12');var _0xaea12c=_0x12e266[_0x4eff('0x13')];var _0x469f9b=_0x12e266[_0x4eff('0x14')];var _0xa08552=new Date(Number(_0x469f9b));return _0x40ccf2(_0x4088df,_0xa08552,_0x3d6143,_0xaea12c);})['catch'](function(_0x18160e){fileLogger('client')[_0x4eff('0x15')](_0x18160e);});};}function setupLoggers(_0xe7edd5){return new Promise(function(_0x5483a3){var _0xc6c602=new ClientSideLogger();var _0x3103a0=fileLogger('api');var _0xc0d672=fileLogger(_0x4eff('0x16'));_0xe7edd5[_0x4eff('0x17')](_0x4eff('0x18'),_0xc6c602);_0xe7edd5[_0x4eff('0x19')](ewinston[_0x4eff('0x1a')]({'winstonInstance':_0x3103a0,'meta':![],'statusLevels':!![],'msg':function(_0x334f71,_0x47dee1){var _0x3abcab=_0x4eff('0x1b');if(!_[_0x4eff('0x1c')](_0x334f71[_0x4eff('0x1d')])){_0x3abcab+=_0x4eff('0x1e');var _0x100ac4=_0x334f71[_0x4eff('0x1d')];maskSensitiveData(_0x100ac4);}return safeTemplate(util[_0x4eff('0x1f')](_0x3abcab,_0x334f71[_0x4eff('0x20')],_0x334f71[_0x4eff('0x21')][_0x4eff('0x22')]?_0x334f71[_0x4eff('0x21')][_0x4eff('0x22')]:_0x334f71[_0x4eff('0x23')][_0x4eff('0x24')]||_0x334f71['ip'],_0x334f71[_0x4eff('0x25')],_0x47dee1[_0x4eff('0x26')],_0x47dee1[_0x4eff('0x27')],_0x334f71[_0x4eff('0x11')]?_0x334f71['user']['id']:null,_0x334f71[_0x4eff('0x11')]?_0x334f71[_0x4eff('0x11')][_0x4eff('0x28')]:null,_0x334f71[_0x4eff('0x11')]?_0x334f71[_0x4eff('0x11')][_0x4eff('0xe')]:null,_0x100ac4?util['inspect'](_0x100ac4,![],null):''));}}));_0xe7edd5[_0x4eff('0x19')](ewinston[_0x4eff('0x1a')]({'winstonInstance':_0xc0d672,'meta':![],'statusLevels':!![],'msg':function(_0x14289d,_0x4bc55c){var _0x5c3cdf=_0x4eff('0x29');if(_0x14289d[_0x4eff('0x1d')]&&_0x14289d[_0x4eff('0x1d')][_0x4eff('0x2a')]&&_0x14289d[_0x4eff('0x1d')][_0x4eff('0x2b')]){_0x5c3cdf=_0x4eff('0x2c');}return util[_0x4eff('0x1f')](_0x5c3cdf,_0x14289d[_0x4eff('0x20')],_0x14289d[_0x4eff('0x21')]['x-forwarded-for']?_0x14289d[_0x4eff('0x21')][_0x4eff('0x22')]:_0x14289d['connection'][_0x4eff('0x24')]||_0x14289d['ip'],_0x14289d['url'],_0x4bc55c['statusCode'],_0x4bc55c['responseTime'],_0x14289d[_0x4eff('0x11')]?_0x14289d['user']['id']:null,_0x14289d['user']?_0x14289d[_0x4eff('0x11')][_0x4eff('0x28')]:null,_0x14289d[_0x4eff('0x11')]?_0x14289d[_0x4eff('0x11')][_0x4eff('0xe')]:null,_0x14289d[_0x4eff('0x1d')]&&_0x14289d['body'][_0x4eff('0x2a')]?_0x14289d[_0x4eff('0x1d')][_0x4eff('0x2a')]:'other',_0x14289d[_0x4eff('0x1d')]&&_0x14289d[_0x4eff('0x1d')][_0x4eff('0x2b')]?_0x14289d['body']['agent_id']:'',_0x14289d['body']&&_0x14289d[_0x4eff('0x1d')][_0x4eff('0x2d')]?_0x14289d[_0x4eff('0x1d')]['agent_name']:'');},'ignoreRoute':function(_0x21c536){var _0x19805d=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x19805d[_0x4eff('0x2e')](_0x21c536[_0x4eff('0x25')]);}}));return _0x5483a3();});}exports[_0x4eff('0x2f')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 97fd0e7..9b69bc7 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6f0=['iftime','moment-timezone','source','join','Interval\x20string\x20not\x20valid','isValid','split','map','locale','toLowerCase','indexOf','slice','concat','exports','clone','minutes','isBefore','day','endOf','isBetween','timeCompare','format','ddd','includes','dowCompare','daysInMonth','max','min','MMM','monthCompare','guess','test','padStart','length'];(function(_0x1c1cca,_0x3e5159){var _0x2f84d7=function(_0x43fc4b){while(--_0x43fc4b){_0x1c1cca['push'](_0x1c1cca['shift']());}};_0x2f84d7(++_0x3e5159);}(_0xc6f0,0xef));var _0x0c6f=function(_0x15a26f,_0x4e8151){_0x15a26f=_0x15a26f-0x0;var _0xf158d=_0xc6f0[_0x15a26f];return _0xf158d;};var _=require('lodash');var moment=require(_0x0c6f('0x0'));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(_0x5b4c50){return _0x5b4c50[_0x0c6f('0x1')];})[_0x0c6f('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x0c6f('0x3');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x206e8b){if(!_0x206e8b[_0x0c6f('0x4')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x3cb0ac){var _0x4b8b31=_0x3cb0ac[_0x0c6f('0x5')](':')[_0x0c6f('0x6')](function(_0x30ad27){return parseInt(_0x30ad27,0xa);});var _0x65579e=_0x4b8b31[0x0];var _0x3c3c5b=_0x4b8b31[0x1];if(_0x65579e<0x0||_0x65579e>0x17||_0x3c3c5b<0x0||_0x3c3c5b>0x3b){throw new Error(EINVALID_DATE);}return[_0x65579e,_0x3c3c5b];}function circularDoWInterval(_0x4a98b7,_0x42dea5){if(_0x4a98b7===_0x42dea5){return[_0x4a98b7];}else{var _0x2de092=moment[_0x0c6f('0x7')]();moment[_0x0c6f('0x7')]('en');var _0x4da3f6=moment['weekdaysShort']()[_0x0c6f('0x6')](function(_0x205aeb){return _0x205aeb[_0x0c6f('0x8')]();});moment['locale'](_0x2de092);var _0x26cd12=_0x4da3f6[_0x0c6f('0x9')](_0x4a98b7);var _0x588daa=_0x4da3f6[_0x0c6f('0x9')](_0x42dea5);if(_0x588daa>_0x26cd12){return _0x4da3f6[_0x0c6f('0xa')](_0x26cd12,_0x588daa+0x1);}else{var _0x31d012=_0x4da3f6[_0x0c6f('0xa')](0x0,_0x588daa+0x1);var _0x5a7599=_0x4da3f6[_0x0c6f('0xa')](_0x26cd12);return _0x5a7599[_0x0c6f('0xb')](_0x31d012);}}}module[_0x0c6f('0xc')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x1dabb2,_0x3da63b){if(_0x1dabb2===_0x3da63b){return[_0x1dabb2];}else{var _0x366829=moment[_0x0c6f('0x7')]();moment[_0x0c6f('0x7')]('en');var _0x49f4ae=moment['monthsShort']()[_0x0c6f('0x6')](function(_0x550d0d){return _0x550d0d[_0x0c6f('0x8')]();});moment[_0x0c6f('0x7')](_0x366829);var _0x242122=_0x49f4ae[_0x0c6f('0x9')](_0x1dabb2);var _0x208ef6=_0x49f4ae['indexOf'](_0x3da63b);if(_0x208ef6>_0x242122){return _0x49f4ae[_0x0c6f('0xa')](_0x242122,_0x208ef6+0x1);}else{var _0x2f3dd4=_0x49f4ae['slice'](0x0,_0x208ef6+0x1);var _0x16ce13=_0x49f4ae['slice'](_0x242122);return _0x16ce13['concat'](_0x2f3dd4);}}}module['exports']['circularMonthInterval']=circularMonthInterval;function parseDom(_0x49ffd1){var _0x14ba83=parseInt(_0x49ffd1,0xa);if(_0x14ba83<0x1||_0x14ba83>0x1f){throw new Error(EINVALID_DATE);}return _0x14ba83;}function timeCompare(_0x2650ab,_0x293da8,_0x3046af){var _0x150af5=_0x2650ab[_0x0c6f('0xd')]();var _0x5a998a=extractTime(_0x293da8);var _0x1e41ea=_0x5a998a[0x0];var _0xc8057d=_0x5a998a[0x1];var _0xfbf2f8=_0x2650ab[_0x0c6f('0xd')]()['hours'](_0x1e41ea)['minutes'](_0xc8057d);throwIfDateNotValid(_0xfbf2f8);var _0x367c3d=extractTime(_0x3046af);var _0x3eebb5=_0x367c3d[0x0];var _0x83d05a=_0x367c3d[0x1];var _0x45eb2e=_0x2650ab[_0x0c6f('0xd')]()['hours'](_0x3eebb5)[_0x0c6f('0xe')](_0x83d05a);throwIfDateNotValid(_0x45eb2e);if(_0x45eb2e[_0x0c6f('0xf')](_0xfbf2f8)){var _0x13f52c=_0x150af5[_0x0c6f('0xd')]()['startOf'](_0x0c6f('0x10'));var _0x491c86=_0x150af5['clone']()[_0x0c6f('0x11')](_0x0c6f('0x10'));return _0x150af5[_0x0c6f('0x12')](_0xfbf2f8,_0x491c86,undefined,'[]')||_0x150af5[_0x0c6f('0x12')](_0x13f52c,_0x45eb2e,undefined,'[]');}else{return _0x150af5[_0x0c6f('0x12')](_0xfbf2f8,_0x45eb2e,undefined,'[]');}}module['exports'][_0x0c6f('0x13')]=timeCompare;function dowCompare(_0x363f1b,_0x5bcd33,_0x54a3cf){var _0x1940bf=_0x363f1b[_0x0c6f('0x7')]('en')[_0x0c6f('0x14')](_0x0c6f('0x15'))[_0x0c6f('0x8')]();return circularDoWInterval(_0x5bcd33,_0x54a3cf)[_0x0c6f('0x16')](_0x1940bf);}module['exports'][_0x0c6f('0x17')]=dowCompare;function domCompare(_0x59d099,_0x4f7aa3,_0xaaa735){var _0x5951e9=_0x59d099['date']();if(_0x4f7aa3===_0xaaa735){return _0x5951e9===_0x4f7aa3;}else{var _0x1ad125=_0x59d099[_0x0c6f('0x18')]();var _0x23afb2=_0x4f7aa3<_0xaaa735;let _0x19bd4b=![];var _0x3819f3=0x0;var _0x1d2c0f=0x0;if(_0x23afb2){_0x3819f3=Math[_0x0c6f('0x19')](0x1,_0x4f7aa3);_0x1d2c0f=Math['min'](_0xaaa735,_0x1ad125);_0x19bd4b=_0x5951e9>=_0x3819f3&&_0x5951e9<=_0x1d2c0f;}else{_0x3819f3=Math[_0x0c6f('0x1a')](_0x4f7aa3,_0x1ad125);_0x1d2c0f=Math[_0x0c6f('0x19')](0x1,_0xaaa735);_0x19bd4b=_0x5951e9>=_0x3819f3||_0x5951e9<=_0x1d2c0f;}return _0x19bd4b;}}module[_0x0c6f('0xc')]['domCompare']=domCompare;function monthCompare(_0x4fd7c0,_0x27e66b,_0x456e93){var _0x155fdd=_0x4fd7c0['locale']('en')[_0x0c6f('0x14')](_0x0c6f('0x1b'))['toLowerCase']();return circularMonthInterval(_0x27e66b,_0x456e93)[_0x0c6f('0x16')](_0x155fdd);}module['exports'][_0x0c6f('0x1c')]=monthCompare;function iftime(_0x4c27ed,_0x2c093f=moment['tz'][_0x0c6f('0x1d')](),_0x2a8bc3=moment()){if(!validateRx[_0x0c6f('0x1e')](_0x4c27ed)){throw new Error(EINVALID_STRING);}else{var _0x34e349=(moment['isMoment'](_0x2a8bc3)?_0x2a8bc3['clone']():moment(_0x2a8bc3))['tz'](_0x2c093f)[_0x0c6f('0x7')]('en');throwIfDateNotValid(_0x34e349);var _0x2724e7=_0x4c27ed['split'](',');var _0x9a1c45=_0x2724e7[0x0];var _0x105fa3=_0x2724e7[0x1];var _0x190beb=_0x2724e7[0x2];var _0x12bb0d=_0x2724e7[0x3];let _0x22670d=!![];if(_0x9a1c45!=='*'){var _0x1aaf8d=_0x9a1c45[_0x0c6f('0x5')]('-');var _0x5ba23c=_[_0x0c6f('0x1f')](_0x1aaf8d[0x0],0x5,'0');var _0x178e6b=_0x1aaf8d[_0x0c6f('0x20')]===0x2?_['padStart'](_0x1aaf8d[0x1],0x5,'0'):_0x5ba23c;_0x22670d=timeCompare(_0x34e349,_0x5ba23c,_0x178e6b);}let _0x9995ec=!![];if(_0x105fa3!=='*'){var _0x21ba8c=_0x105fa3[_0x0c6f('0x5')]('-');var _0x6679c6=_0x21ba8c[0x0];var _0x491229=_0x21ba8c[_0x0c6f('0x20')]===0x2?_0x21ba8c[0x1]:_0x6679c6;_0x9995ec=dowCompare(_0x34e349,_0x6679c6,_0x491229);}let _0x1ca14c=!![];if(_0x190beb!=='*'){var _0x30b0b7=_0x190beb[_0x0c6f('0x5')]('-');var _0x5e816a=parseDom(_0x30b0b7[0x0]);var _0x53fa0d=_0x30b0b7['length']===0x2?parseDom(_0x30b0b7[0x1]):_0x5e816a;_0x1ca14c=domCompare(_0x34e349,_0x5e816a,_0x53fa0d);}let _0x308173=!![];if(_0x12bb0d!=='*'){var _0x1aa807=_0x12bb0d[_0x0c6f('0x5')]('-');var _0x392b55=_0x1aa807[0x0];var _0xbe9846=_0x1aa807[_0x0c6f('0x20')]===0x2?_0x1aa807[0x1]:_0x1aa807[0x0];_0x308173=monthCompare(_0x34e349,_0x392b55,_0xbe9846);}return _0x22670d&&_0x9995ec&&_0x1ca14c&&_0x308173;}}module[_0x0c6f('0xc')][_0x0c6f('0x21')]=iftime; \ No newline at end of file +var _0xdb0d=['min','domCompare','monthCompare','test','isMoment','padStart','length','iftime','lodash','moment-timezone','map','source','Date\x20not\x20valid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','clone','hours','minutes','isBefore','startOf','day','isBetween','timeCompare','format','ddd','includes','dowCompare','date','daysInMonth','max'];(function(_0x3f9584,_0x5ab12c){var _0x9d54c=function(_0x2882df){while(--_0x2882df){_0x3f9584['push'](_0x3f9584['shift']());}};_0x9d54c(++_0x5ab12c);}(_0xdb0d,0x138));var _0xddb0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdb0d[_0x3dd15e];return _0x231fd0;};var _=require(_0xddb0('0x0'));var moment=require(_0xddb0('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][_0xddb0('0x2')](function(_0x3cc193){return _0x3cc193[_0xddb0('0x3')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE=_0xddb0('0x4');function throwIfDateNotValid(_0xec71bd){if(!_0xec71bd['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x29cee7){var _0x1d2463=_0x29cee7[_0xddb0('0x5')](':')['map'](function(_0x27ba2){return parseInt(_0x27ba2,0xa);});var _0x3685d2=_0x1d2463[0x0];var _0x287fb6=_0x1d2463[0x1];if(_0x3685d2<0x0||_0x3685d2>0x17||_0x287fb6<0x0||_0x287fb6>0x3b){throw new Error(EINVALID_DATE);}return[_0x3685d2,_0x287fb6];}function circularDoWInterval(_0x42bb12,_0x49ae34){if(_0x42bb12===_0x49ae34){return[_0x42bb12];}else{var _0x389100=moment[_0xddb0('0x6')]();moment[_0xddb0('0x6')]('en');var _0x3942db=moment[_0xddb0('0x7')]()[_0xddb0('0x2')](function(_0xbac962){return _0xbac962[_0xddb0('0x8')]();});moment[_0xddb0('0x6')](_0x389100);var _0x4a540f=_0x3942db[_0xddb0('0x9')](_0x42bb12);var _0x42dca8=_0x3942db[_0xddb0('0x9')](_0x49ae34);if(_0x42dca8>_0x4a540f){return _0x3942db['slice'](_0x4a540f,_0x42dca8+0x1);}else{var _0x338881=_0x3942db[_0xddb0('0xa')](0x0,_0x42dca8+0x1);var _0x30b4a9=_0x3942db[_0xddb0('0xa')](_0x4a540f);return _0x30b4a9[_0xddb0('0xb')](_0x338881);}}}module[_0xddb0('0xc')][_0xddb0('0xd')]=circularDoWInterval;function circularMonthInterval(_0x2b0538,_0x3a276c){if(_0x2b0538===_0x3a276c){return[_0x2b0538];}else{var _0x18fc3c=moment[_0xddb0('0x6')]();moment[_0xddb0('0x6')]('en');var _0x8cf7df=moment[_0xddb0('0xe')]()[_0xddb0('0x2')](function(_0x4e408b){return _0x4e408b[_0xddb0('0x8')]();});moment['locale'](_0x18fc3c);var _0x42c36c=_0x8cf7df[_0xddb0('0x9')](_0x2b0538);var _0x47d04a=_0x8cf7df['indexOf'](_0x3a276c);if(_0x47d04a>_0x42c36c){return _0x8cf7df[_0xddb0('0xa')](_0x42c36c,_0x47d04a+0x1);}else{var _0x153197=_0x8cf7df[_0xddb0('0xa')](0x0,_0x47d04a+0x1);var _0x3cad75=_0x8cf7df[_0xddb0('0xa')](_0x42c36c);return _0x3cad75[_0xddb0('0xb')](_0x153197);}}}module['exports']['circularMonthInterval']=circularMonthInterval;function parseDom(_0xeabc9f){var _0x1f4f54=parseInt(_0xeabc9f,0xa);if(_0x1f4f54<0x1||_0x1f4f54>0x1f){throw new Error(EINVALID_DATE);}return _0x1f4f54;}function timeCompare(_0x449dd2,_0x243db4,_0x1e876f){var _0x396369=_0x449dd2[_0xddb0('0xf')]();var _0xa641d5=extractTime(_0x243db4);var _0x31af43=_0xa641d5[0x0];var _0x5d0f95=_0xa641d5[0x1];var _0x2af14a=_0x449dd2['clone']()[_0xddb0('0x10')](_0x31af43)[_0xddb0('0x11')](_0x5d0f95);throwIfDateNotValid(_0x2af14a);var _0x3459e9=extractTime(_0x1e876f);var _0x59b08c=_0x3459e9[0x0];var _0x78372b=_0x3459e9[0x1];var _0x2a4931=_0x449dd2['clone']()[_0xddb0('0x10')](_0x59b08c)[_0xddb0('0x11')](_0x78372b);throwIfDateNotValid(_0x2a4931);if(_0x2a4931[_0xddb0('0x12')](_0x2af14a)){var _0x12d928=_0x396369['clone']()[_0xddb0('0x13')]('day');var _0x1e8636=_0x396369[_0xddb0('0xf')]()['endOf'](_0xddb0('0x14'));return _0x396369[_0xddb0('0x15')](_0x2af14a,_0x1e8636,undefined,'[]')||_0x396369[_0xddb0('0x15')](_0x12d928,_0x2a4931,undefined,'[]');}else{return _0x396369['isBetween'](_0x2af14a,_0x2a4931,undefined,'[]');}}module[_0xddb0('0xc')][_0xddb0('0x16')]=timeCompare;function dowCompare(_0x5a05d0,_0x3dedb9,_0xa32017){var _0x273bde=_0x5a05d0[_0xddb0('0x6')]('en')[_0xddb0('0x17')](_0xddb0('0x18'))[_0xddb0('0x8')]();return circularDoWInterval(_0x3dedb9,_0xa32017)[_0xddb0('0x19')](_0x273bde);}module[_0xddb0('0xc')][_0xddb0('0x1a')]=dowCompare;function domCompare(_0x985572,_0x4e5012,_0x16b371){var _0x174332=_0x985572[_0xddb0('0x1b')]();if(_0x4e5012===_0x16b371){return _0x174332===_0x4e5012;}else{var _0x1f8cde=_0x985572[_0xddb0('0x1c')]();var _0x2a5833=_0x4e5012<_0x16b371;let _0x4d3038=![];var _0x46a718=0x0;var _0x516e1d=0x0;if(_0x2a5833){_0x46a718=Math[_0xddb0('0x1d')](0x1,_0x4e5012);_0x516e1d=Math[_0xddb0('0x1e')](_0x16b371,_0x1f8cde);_0x4d3038=_0x174332>=_0x46a718&&_0x174332<=_0x516e1d;}else{_0x46a718=Math[_0xddb0('0x1e')](_0x4e5012,_0x1f8cde);_0x516e1d=Math[_0xddb0('0x1d')](0x1,_0x16b371);_0x4d3038=_0x174332>=_0x46a718||_0x174332<=_0x516e1d;}return _0x4d3038;}}module[_0xddb0('0xc')][_0xddb0('0x1f')]=domCompare;function monthCompare(_0x29a3b9,_0x1bacd7,_0x403780){var _0x4d28bc=_0x29a3b9['locale']('en')[_0xddb0('0x17')]('MMM')[_0xddb0('0x8')]();return circularMonthInterval(_0x1bacd7,_0x403780)[_0xddb0('0x19')](_0x4d28bc);}module['exports'][_0xddb0('0x20')]=monthCompare;function iftime(_0x2aa48d,_0x447f19=moment['tz']['guess'](),_0x24fb10=moment()){if(!validateRx[_0xddb0('0x21')](_0x2aa48d)){throw new Error(EINVALID_STRING);}else{var _0x4e5107=(moment[_0xddb0('0x22')](_0x24fb10)?_0x24fb10[_0xddb0('0xf')]():moment(_0x24fb10))['tz'](_0x447f19)['locale']('en');throwIfDateNotValid(_0x4e5107);var _0x9a381d=_0x2aa48d[_0xddb0('0x5')](',');var _0x4f540f=_0x9a381d[0x0];var _0x5bbe5e=_0x9a381d[0x1];var _0x29ede8=_0x9a381d[0x2];var _0x18b9a3=_0x9a381d[0x3];let _0x40f79e=!![];if(_0x4f540f!=='*'){var _0x230401=_0x4f540f[_0xddb0('0x5')]('-');var _0x212808=_[_0xddb0('0x23')](_0x230401[0x0],0x5,'0');var _0x1fcc97=_0x230401[_0xddb0('0x24')]===0x2?_[_0xddb0('0x23')](_0x230401[0x1],0x5,'0'):_0x212808;_0x40f79e=timeCompare(_0x4e5107,_0x212808,_0x1fcc97);}let _0x5bf743=!![];if(_0x5bbe5e!=='*'){var _0x1ed04e=_0x5bbe5e[_0xddb0('0x5')]('-');var _0x50fa1a=_0x1ed04e[0x0];var _0x473d5b=_0x1ed04e[_0xddb0('0x24')]===0x2?_0x1ed04e[0x1]:_0x50fa1a;_0x5bf743=dowCompare(_0x4e5107,_0x50fa1a,_0x473d5b);}let _0x323410=!![];if(_0x29ede8!=='*'){var _0xa266dc=_0x29ede8[_0xddb0('0x5')]('-');var _0x111709=parseDom(_0xa266dc[0x0]);var _0x1dc6c7=_0xa266dc[_0xddb0('0x24')]===0x2?parseDom(_0xa266dc[0x1]):_0x111709;_0x323410=domCompare(_0x4e5107,_0x111709,_0x1dc6c7);}let _0x98ed8f=!![];if(_0x18b9a3!=='*'){var _0x58b75d=_0x18b9a3[_0xddb0('0x5')]('-');var _0x3ef462=_0x58b75d[0x0];var _0x1b7dc2=_0x58b75d['length']===0x2?_0x58b75d[0x1]:_0x58b75d[0x0];_0x98ed8f=monthCompare(_0x4e5107,_0x3ef462,_0x1b7dc2);}return _0x40f79e&&_0x5bf743&&_0x323410&&_0x98ed8f;}}module['exports'][_0xddb0('0x25')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index bb5b793..404cf08 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d4d=['toUpperCase','meta','keys','level','transports','warn','Logger','File','%s-%s','error','Console','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','}}}','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xceda91,_0x3155d6){var _0x4d42b3=function(_0x477f1f){while(--_0x477f1f){_0xceda91['push'](_0xceda91['shift']());}};_0x4d42b3(++_0x3155d6);}(_0x7d4d,0xcb));var _0xd7d4=function(_0x19115e,_0x507bab){_0x19115e=_0x19115e-0x0;var _0x45bbd4=_0x7d4d[_0x19115e];return _0x45bbd4;};'use strict';var path=require(_0xd7d4('0x0'));var util=require(_0xd7d4('0x1'));var moment=require(_0xd7d4('0x2'));var winston=require(_0xd7d4('0x3'));var config=require(_0xd7d4('0x4'));var debugLevel=config[_0xd7d4('0x5')]?config[_0xd7d4('0x5')][_0xd7d4('0x6')]():_0xd7d4('0x7');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':_0xd7d4('0x8'),'error':_0xd7d4('0x9'),'warn':_0xd7d4('0xa'),'info':_0xd7d4('0xb'),'print':_0xd7d4('0xc'),'success':_0xd7d4('0xd'),'http':_0xd7d4('0xe'),'verbose':'bold\x20magenta','debug':'bold\x20blue','silly':_0xd7d4('0xf')};winston[_0xd7d4('0x10')](XC_LOG_COLORS);function getLogFileName(_0x592502,_0xf3f6fb,_0x22e64a){var _0x2cd17b=_0x592502||_0xd7d4('0x11');return path[_0xd7d4('0x12')](_0x2cd17b,util[_0xd7d4('0x13')](_0xd7d4('0x14'),_0xf3f6fb,_0x22e64a));}function formatter(_0x25621f,_0x1ba402){_0x1ba402['message']=_0x1ba402[_0xd7d4('0x15')][_0xd7d4('0x16')](/@@{/g,'{{{')[_0xd7d4('0x16')](/}@@/g,_0xd7d4('0x17'))[_0xd7d4('0x16')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xd7d4('0x13')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xd7d4('0x13')](_0xd7d4('0x18')),_0x1ba402['level'][_0xd7d4('0x19')](),_0x25621f,_0x1ba402[_0xd7d4('0x15')]);}function fileFormat(_0x5e8613,_0x259614){_0x259614[_0xd7d4('0x15')]=_0x259614[_0xd7d4('0x15')][_0xd7d4('0x16')](/@@{/g,'{{{')['replace'](/}@@/g,_0xd7d4('0x17'))[_0xd7d4('0x16')](/@{/g,'{{')[_0xd7d4('0x16')](/}@/g,'}}');var _0x4433cf=_0x259614[_0xd7d4('0x1a')]&&Object[_0xd7d4('0x1b')](_0x259614[_0xd7d4('0x1a')])['length']?'\x0a\x09'+JSON['stringify'](_0x259614[_0xd7d4('0x1a')]):'';return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0xd7d4('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),_0x259614[_0xd7d4('0x1c')][_0xd7d4('0x19')](),_0x5e8613,_0x259614[_0xd7d4('0x15')],_0x4433cf);}function consoleLogger(){var _0x4c052d=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xd7d4('0x1d'))]['Console']({'level':_0xd7d4('0x1e'),'json':![],'formatter':function(_0x2d6e23){return formatter('',_0x2d6e23);}})]});return _0x4c052d;}function fileLogger(_0xb1af7f,_0x3cbdfe){var _0x407f53=new winston[(_0xd7d4('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xd7d4('0x20'))]({'name':util[_0xd7d4('0x13')](_0xd7d4('0x21'),_0xb1af7f,_0xd7d4('0x22')),'filename':getLogFileName(_0x3cbdfe,_0xb1af7f,_0xd7d4('0x22')),'level':_0xd7d4('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x446ed4){return fileFormat(_0xb1af7f,_0x446ed4);}}),new winston[(_0xd7d4('0x1d'))][(_0xd7d4('0x20'))]({'name':util[_0xd7d4('0x13')](_0xd7d4('0x21'),_0xb1af7f,debugLevel),'filename':getLogFileName(_0x3cbdfe,_0xb1af7f,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x515480){return fileFormat(_0xb1af7f,_0x515480);}}),new winston[(_0xd7d4('0x1d'))][(_0xd7d4('0x23'))]({'level':_0xd7d4('0x1e'),'json':![],'formatter':function(_0x32e467){return fileFormat(_0xb1af7f,_0x32e467);}})]});return _0x407f53;}exports[_0xd7d4('0x24')]=consoleLogger;exports[_0xd7d4('0x25')]=fileLogger; \ No newline at end of file +var _0x1c26=['toLowerCase','info','red','bold\x20magenta','bold\x20blue','addColors','/var/log/xcally','format','%s-%s.log','message','replace','}}}','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','{{{','meta','keys','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','level','Logger','warn','transports','%s-%s','error','File','Console','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel'];(function(_0x279a49,_0x27e41f){var _0x2ace72=function(_0xb0d5e9){while(--_0xb0d5e9){_0x279a49['push'](_0x279a49['shift']());}};_0x2ace72(++_0x27e41f);}(_0x1c26,0x158));var _0x61c2=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1c26[_0x17d9e3];return _0x14192d;};'use strict';var path=require(_0x61c2('0x0'));var util=require(_0x61c2('0x1'));var moment=require(_0x61c2('0x2'));var winston=require(_0x61c2('0x3'));var config=require(_0x61c2('0x4'));var debugLevel=config[_0x61c2('0x5')]?config[_0x61c2('0x5')][_0x61c2('0x6')]():_0x61c2('0x7');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0x61c2('0x8'),'warn':'bold\x20yellow','info':'white','print':'bold\x20white','success':'bold\x20green','http':'gray','verbose':_0x61c2('0x9'),'debug':_0x61c2('0xa'),'silly':'bold\x20cyan'};winston[_0x61c2('0xb')](XC_LOG_COLORS);function getLogFileName(_0x1a141,_0x13d4a7,_0x4483c4){var _0x4e7625=_0x1a141||_0x61c2('0xc');return path['join'](_0x4e7625,util[_0x61c2('0xd')](_0x61c2('0xe'),_0x13d4a7,_0x4483c4));}function formatter(_0x4252c0,_0x33a0eb){_0x33a0eb[_0x61c2('0xf')]=_0x33a0eb['message'][_0x61c2('0x10')](/@@{/g,'{{{')['replace'](/}@@/g,_0x61c2('0x11'))[_0x61c2('0x10')](/@{/g,'{{')[_0x61c2('0x10')](/}@/g,'}}');return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()['format'](_0x61c2('0x12')),_0x33a0eb['level'][_0x61c2('0x13')](),_0x4252c0,_0x33a0eb[_0x61c2('0xf')]);}function fileFormat(_0x5cebc8,_0x1c3aea){_0x1c3aea[_0x61c2('0xf')]=_0x1c3aea[_0x61c2('0xf')][_0x61c2('0x10')](/@@{/g,_0x61c2('0x14'))[_0x61c2('0x10')](/}@@/g,_0x61c2('0x11'))[_0x61c2('0x10')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x34aa52=_0x1c3aea[_0x61c2('0x15')]&&Object[_0x61c2('0x16')](_0x1c3aea['meta'])[_0x61c2('0x17')]?'\x0a\x09'+JSON['stringify'](_0x1c3aea['meta']):'';return util[_0x61c2('0xd')](_0x61c2('0x18'),moment()[_0x61c2('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),_0x1c3aea[_0x61c2('0x19')]['toUpperCase'](),_0x5cebc8,_0x1c3aea['message'],_0x34aa52);}function consoleLogger(){var _0x210425=new winston[(_0x61c2('0x1a'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['Console']({'level':_0x61c2('0x1b'),'json':![],'formatter':function(_0x2ac6cd){return formatter('',_0x2ac6cd);}})]});return _0x210425;}function fileLogger(_0x3b272e,_0x2382a3){var _0x1aa9e2=new winston[(_0x61c2('0x1a'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x61c2('0x1c'))]['File']({'name':util[_0x61c2('0xd')](_0x61c2('0x1d'),_0x3b272e,_0x61c2('0x1e')),'filename':getLogFileName(_0x2382a3,_0x3b272e,_0x61c2('0x1e')),'level':_0x61c2('0x1e'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xea429b){return fileFormat(_0x3b272e,_0xea429b);}}),new winston['transports'][(_0x61c2('0x1f'))]({'name':util[_0x61c2('0xd')](_0x61c2('0x1d'),_0x3b272e,debugLevel),'filename':getLogFileName(_0x2382a3,_0x3b272e,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1ff6e8){return fileFormat(_0x3b272e,_0x1ff6e8);}}),new winston[(_0x61c2('0x1c'))][(_0x61c2('0x20'))]({'level':_0x61c2('0x1b'),'json':![],'formatter':function(_0xc71ed7){return fileFormat(_0x3b272e,_0xc71ed7);}})]});return _0x1aa9e2;}exports[_0x61c2('0x21')]=consoleLogger;exports[_0x61c2('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 4bc64ac..1dff6d9 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 _0xadb5=['exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','street','phone','mobile','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','calleridnum'];(function(_0x3cffbf,_0x32aaf5){var _0x348c54=function(_0x45b524){while(--_0x45b524){_0x3cffbf['push'](_0x3cffbf['shift']());}};_0x348c54(++_0x32aaf5);}(_0xadb5,0xad));var _0x5adb=function(_0x19edee,_0x4f31f4){_0x19edee=_0x19edee-0x0;var _0x5c4299=_0xadb5[_0x19edee];return _0x5c4299;};var _=require('lodash');var sensitiveFields=[_0x5adb('0x0'),'password',_0x5adb('0x1'),_0x5adb('0x2'),_0x5adb('0x3'),'lastName',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6'),'fax',_0x5adb('0x7'),_0x5adb('0x8'),_0x5adb('0x9'),_0x5adb('0xa'),_0x5adb('0xb'),_0x5adb('0xc'),_0x5adb('0xd'),_0x5adb('0xe'),_0x5adb('0xf'),_0x5adb('0x10'),_0x5adb('0x11'),_0x5adb('0x12'),_0x5adb('0x13'),_0x5adb('0x14'),'membername','calleridname',_0x5adb('0x15'),_0x5adb('0x16'),_0x5adb('0x17'),'clientEmail',_0x5adb('0x18'),'accesskeyid',_0x5adb('0x19'),'key',_0x5adb('0x1a'),_0x5adb('0x1b'),_0x5adb('0x1c'),'localstationid',_0x5adb('0x1d'),_0x5adb('0x1e'),_0x5adb('0x1f'),'oldPassword'];function maskSensitiveData(_0x2312de){const _0x518823=/(?!^)[\s\S](?!$)/g;if(_[_0x5adb('0x20')](_0x2312de)){for(const _0x42a482 in _0x2312de){if(_[_0x5adb('0x21')](_0x2312de[_0x42a482])){for(let _0x304784=0x0;_0x304784<_0x2312de[_0x42a482][_0x5adb('0x22')];_0x304784++){maskSensitiveData(_0x2312de[_0x42a482][_0x304784]);}}else if(_[_0x5adb('0x20')](_0x2312de[_0x42a482])){maskSensitiveData(_0x2312de[_0x42a482]);}else if(_[_0x5adb('0x23')](_0x2312de[_0x42a482])){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](/{{{/g,_0x5adb('0x25'))['replace'](/}}}/g,_0x5adb('0x26'))['replace'](/{{/g,'@{')[_0x5adb('0x24')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x42a482)){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](_0x518823,'*');}}}}}module['exports']['maskSensitiveData']=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(_0xeb13c3,_0x25b76d){var _0x36d192=function(_0x3d9cf7){while(--_0x3d9cf7){_0xeb13c3['push'](_0xeb13c3['shift']());}};_0x36d192(++_0x25b76d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x213518,_0x51e022){_0x213518=_0x213518-0x0;var _0x1baf75=_0x0b0e[_0x213518];return _0x1baf75;};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 84f676e..87ee088 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 _0xf4f4=['replace','map','isPlainObject','keys','reduce','exports','safeTemplate','lodash','\x20}\x20}','string'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x1a2674,_0x247245){_0x1a2674=_0x1a2674-0x0;var _0x14ca43=_0xf4f4[_0x1a2674];return _0x14ca43;};var _=require(_0x4f4f('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x230375){return _0x230375==='{{'?'{\x20{\x20':_0x4f4f('0x1');}function safeTemplate(_0x304b11){var _0x19aa05=_0x304b11;if(typeof _0x304b11===_0x4f4f('0x2')){_0x19aa05=_0x304b11[_0x4f4f('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x304b11)){_0x19aa05=_0x304b11[_0x4f4f('0x4')](function(_0x593952){return safeTemplate(_0x593952);});}else if(_[_0x4f4f('0x5')](_0x304b11)){_0x19aa05=Object[_0x4f4f('0x6')](_0x304b11)[_0x4f4f('0x7')](function(_0x1ff75a,_0x3c4877){_0x1ff75a[_0x3c4877]=safeTemplate(_0x304b11[_0x3c4877]);return _0x1ff75a;},{});}return _0x19aa05;}module[_0x4f4f('0x8')][_0x4f4f('0x9')]=safeTemplate; \ No newline at end of file +var _0xea28=['isPlainObject','reduce','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','map'];(function(_0x1bc7fd,_0x53eb4f){var _0x81b999=function(_0x51c417){while(--_0x51c417){_0x1bc7fd['push'](_0x1bc7fd['shift']());}};_0x81b999(++_0x53eb4f);}(_0xea28,0x13a));var _0x8ea2=function(_0x133e68,_0x444d4e){_0x133e68=_0x133e68-0x0;var _0x86dcdb=_0xea28[_0x133e68];return _0x86dcdb;};var _=require(_0x8ea2('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2e031a){return _0x2e031a==='{{'?_0x8ea2('0x1'):_0x8ea2('0x2');}function safeTemplate(_0x459c4e){var _0x25e47e=_0x459c4e;if(typeof _0x459c4e===_0x8ea2('0x3')){_0x25e47e=_0x459c4e[_0x8ea2('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x459c4e)){_0x25e47e=_0x459c4e[_0x8ea2('0x5')](function(_0x23aaf1){return safeTemplate(_0x23aaf1);});}else if(_[_0x8ea2('0x6')](_0x459c4e)){_0x25e47e=Object['keys'](_0x459c4e)[_0x8ea2('0x7')](function(_0x435d78,_0xb7f278){_0x435d78[_0xb7f278]=safeTemplate(_0x459c4e[_0xb7f278]);return _0x435d78;},{});}return _0x25e47e;}module[_0x8ea2('0x8')][_0x8ea2('0x9')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 3f4147e..133d8a6 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 _0xf9eb=['string','pathExists','then','readJSON','info','Updating\x20app.json','fs-extra','path','root','resolve','legacy-libs','apps','findIndex','name','env','NODE_PATH'];(function(_0x54d2fb,_0x31fd9e){var _0x10cb87=function(_0x1a8716){while(--_0x1a8716){_0x54d2fb['push'](_0x54d2fb['shift']());}};_0x10cb87(++_0x31fd9e);}(_0xf9eb,0x86));var _0xbf9e=function(_0x2e6ea9,_0x1b9d9e){_0x2e6ea9=_0x2e6ea9-0x0;var _0x1f8081=_0xf9eb[_0x2e6ea9];return _0x1f8081;};var fs=require(_0xbf9e('0x0'));var path=require(_0xbf9e('0x1'));var config=require('../config/environment');var root=config[_0xbf9e('0x2')];var APP_JSON_PATH=path[_0xbf9e('0x3')](root,'server/app.json');var NODEPATH=path[_0xbf9e('0x3')](root,_0xbf9e('0x4'));function setLegacyLibsNodeEnvPath(_0x537cf0){let _0x2ab6e4=![];if(Array['isArray'](_0x537cf0['apps'])){var _0x55d903=_0x537cf0[_0xbf9e('0x5')][_0xbf9e('0x6')](function(_0x5cabc9){return _0x5cabc9[_0xbf9e('0x7')]==='motion2';});if(_0x55d903>-0x1){var _0x76a278=_0x537cf0[_0xbf9e('0x5')][_0x55d903];if(typeof _0x76a278[_0xbf9e('0x8')][_0xbf9e('0x9')]!==_0xbf9e('0xa')){_0x76a278[_0xbf9e('0x8')][_0xbf9e('0x9')]=NODEPATH;_0x2ab6e4=!![];}}return{'appConfig':_0x537cf0,'updated':_0x2ab6e4};}}function updateAppConfig(_0x1a30f1){return fs[_0xbf9e('0xb')](APP_JSON_PATH)[_0xbf9e('0xc')](function(_0x4576b5){if(_0x4576b5){return fs[_0xbf9e('0xd')](APP_JSON_PATH)[_0xbf9e('0xc')](function(_0x386297){var _0x3ec888=setLegacyLibsNodeEnvPath(_0x386297);if(_0x3ec888['updated']){_0x1a30f1[_0xbf9e('0xe')](_0xbf9e('0xf'));return fs['writeJSON'](APP_JSON_PATH,_0x386297,{'spaces':0x2});}else{return Promise[_0xbf9e('0x3')]();}});}else{return Promise[_0xbf9e('0x3')]();}});}module['exports']=updateAppConfig; \ No newline at end of file +var _0x1384=['../config/environment','root','resolve','server/app.json','isArray','apps','findIndex','name','motion2','NODE_PATH','string','env','then','updated','Updating\x20app.json','writeJSON','exports','fs-extra','path'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x1384,0x17a));var _0x4138=function(_0x5abf75,_0x4e563f){_0x5abf75=_0x5abf75-0x0;var _0x21fa53=_0x1384[_0x5abf75];return _0x21fa53;};var fs=require(_0x4138('0x0'));var path=require(_0x4138('0x1'));var config=require(_0x4138('0x2'));var root=config[_0x4138('0x3')];var APP_JSON_PATH=path[_0x4138('0x4')](root,_0x4138('0x5'));var NODEPATH=path[_0x4138('0x4')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x21ee05){let _0x51b49b=![];if(Array[_0x4138('0x6')](_0x21ee05[_0x4138('0x7')])){var _0x36593d=_0x21ee05[_0x4138('0x7')][_0x4138('0x8')](function(_0x1d56cd){return _0x1d56cd[_0x4138('0x9')]===_0x4138('0xa');});if(_0x36593d>-0x1){var _0x2717a6=_0x21ee05[_0x4138('0x7')][_0x36593d];if(typeof _0x2717a6['env'][_0x4138('0xb')]!==_0x4138('0xc')){_0x2717a6[_0x4138('0xd')]['NODE_PATH']=NODEPATH;_0x51b49b=!![];}}return{'appConfig':_0x21ee05,'updated':_0x51b49b};}}function updateAppConfig(_0x3a753e){return fs['pathExists'](APP_JSON_PATH)[_0x4138('0xe')](function(_0x6b0b9d){if(_0x6b0b9d){return fs['readJSON'](APP_JSON_PATH)[_0x4138('0xe')](function(_0x5357d1){var _0x26c3fe=setLegacyLibsNodeEnvPath(_0x5357d1);if(_0x26c3fe[_0x4138('0xf')]){_0x3a753e['info'](_0x4138('0x10'));return fs[_0x4138('0x11')](APP_JSON_PATH,_0x5357d1,{'spaces':0x2});}else{return Promise[_0x4138('0x4')]();}});}else{return Promise[_0x4138('0x4')]();}});}module[_0x4138('0x12')]=updateAppConfig; \ No newline at end of file